From: Andrea Amorese Date: Tue, 10 Aug 2021 13:28:01 +0000 (+0200) Subject: Built motion from commit 5732f645.|2.5.32 X-Git-Url: http://repos.xcallymotion.com/base/%22angular-material.themes.css/%22card-image.png//%27?a=commitdiff_plain;h=b20fc75057e68db05cc14b4dcdd3c32c8d6bd219;p=motion2.git Built motion from commit 5732f645.|2.5.32 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index 2565ee9..bea9f77 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -17,7 +17,7 @@ define({ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2021-08-10T13:03:45.139Z", + "time": "2021-08-10T13:18:35.325Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index 540c827..e2813d3 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2021-08-10T13:03:45.139Z", + "time": "2021-08-10T13:18:35.325Z", "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 f59b913..4f3131d 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 _0xa076=['motionbar','jscripty','urlForward','browser','bot','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20urlForward[URL]','motionbar[NULL,NULL,WinAppArguments]','sequelize','VIRTUAL','getDataValue','action','STRING','contactManager','integration'];(function(_0x17a32f,_0x5a51a){var _0x15a293=function(_0x55fbd3){while(--_0x55fbd3){_0x17a32f['push'](_0x17a32f['shift']());}};_0x15a293(++_0x5a51a);}(_0xa076,0x107));var _0x6a07=function(_0xc35b56,_0x1e46fd){_0xc35b56=_0xc35b56-0x0;var _0x5974ba=_0xa076[_0xc35b56];return _0x5974ba;};'use strict';var Sequelize=require(_0x6a07('0x0'));module['exports']={'name':{'type':Sequelize[_0x6a07('0x1')],'get':function(_0x4f47f4){return this[_0x6a07('0x2')](_0x6a07('0x3'));}},'action':{'type':Sequelize[_0x6a07('0x4')],'allowNull':![],'validate':{'isIn':{'args':[[_0x6a07('0x5'),_0x6a07('0x6'),_0x6a07('0x7'),_0x6a07('0x8'),_0x6a07('0x9'),_0x6a07('0xa'),_0x6a07('0xb'),'script']],'msg':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'}},'comment':_0x6a07('0xc')},'data1':{'type':Sequelize[_0x6a07('0x4')](0x1000),'comment':'contactManager[ListId],\x20integration[intName(zendesk)],\x20motionbar[Popup(0),URL(1),WinApp(2)],\x20urlForward[GET,POST],\x20browser[TemplateId(0),URL(1)]'},'data2':{'type':Sequelize[_0x6a07('0x4')](0x1000),'comment':_0x6a07('0xd')},'data3':{'type':Sequelize[_0x6a07('0x4')](0x1000),'comment':_0x6a07('0xe')},'data4':{'type':Sequelize['STRING'](0x1000)},'data5':{'type':Sequelize[_0x6a07('0x4')](0x1000)},'data6':{'type':Sequelize['STRING']},'data7':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x0f9b=['integration','motionbar','jscripty','urlForward','browser','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','contactManager[ListId],\x20integration[intName(zendesk)],\x20motionbar[Popup(0),URL(1),WinApp(2)],\x20urlForward[GET,POST],\x20browser[TemplateId(0),URL(1)]','integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20urlForward[URL]','motionbar[NULL,NULL,WinAppArguments]','TEXT','exports','VIRTUAL','getDataValue','action','STRING','contactManager'];(function(_0x34e9b0,_0x5b5009){var _0x49abdf=function(_0x56981d){while(--_0x56981d){_0x34e9b0['push'](_0x34e9b0['shift']());}};_0x49abdf(++_0x5b5009);}(_0x0f9b,0x1aa));var _0xb0f9=function(_0x4d2e2d,_0xa6d3dd){_0x4d2e2d=_0x4d2e2d-0x0;var _0x1b8f03=_0x0f9b[_0x4d2e2d];return _0x1b8f03;};'use strict';var Sequelize=require('sequelize');module[_0xb0f9('0x0')]={'name':{'type':Sequelize[_0xb0f9('0x1')],'get':function(_0x2c4c38){return this[_0xb0f9('0x2')](_0xb0f9('0x3'));}},'action':{'type':Sequelize[_0xb0f9('0x4')],'allowNull':![],'validate':{'isIn':{'args':[[_0xb0f9('0x5'),_0xb0f9('0x6'),_0xb0f9('0x7'),_0xb0f9('0x8'),_0xb0f9('0x9'),_0xb0f9('0xa'),_0xb0f9('0xb'),_0xb0f9('0xc')]],'msg':_0xb0f9('0xd')}},'comment':_0xb0f9('0xd')},'data1':{'type':Sequelize[_0xb0f9('0x4')](0x1000),'comment':_0xb0f9('0xe')},'data2':{'type':Sequelize[_0xb0f9('0x4')](0x1000),'comment':_0xb0f9('0xf')},'data3':{'type':Sequelize[_0xb0f9('0x4')](0x1000),'comment':_0xb0f9('0x10')},'data4':{'type':Sequelize[_0xb0f9('0x4')](0x1000)},'data5':{'type':Sequelize[_0xb0f9('0x4')](0x1000)},'data6':{'type':Sequelize[_0xb0f9('0x4')]},'data7':{'type':Sequelize[_0xb0f9('0x11')]}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index f0e580d..b671d50 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 _0x7ab8=['../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','undefined','offset','count','limit','set','Content-Range','apply','reject','save','then','error','stack','name','send','update','body','Action','find','params','catch','destroy','rimraf','fast-json-patch','mustache','util','path','sox','to-csv','ejs','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x3ed3bb,_0x4889c4){var _0x5c4462=function(_0x1fb516){while(--_0x1fb516){_0x3ed3bb['push'](_0x3ed3bb['shift']());}};_0x5c4462(++_0x4889c4);}(_0x7ab8,0xcd));var _0x87ab=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x7ab8[_0x59ee6f];return _0x4c0979;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x87ab('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x87ab('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x87ab('0x2'));var util=require(_0x87ab('0x3'));var path=require(_0x87ab('0x4'));var sox=require(_0x87ab('0x5'));var csv=require(_0x87ab('0x6'));var ejs=require(_0x87ab('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x87ab('0x8'));var crypto=require('crypto');var jsforce=require(_0x87ab('0x9'));var deskjs=require('desk.js');var toCsv=require(_0x87ab('0x6'));var querystring=require('querystring');var Papa=require(_0x87ab('0xa'));var Redis=require(_0x87ab('0xb'));var authService=require(_0x87ab('0xc'));var qs=require(_0x87ab('0xd'));var as=require(_0x87ab('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x87ab('0xf'))(_0x87ab('0x10'));var utils=require(_0x87ab('0x11'));var config=require(_0x87ab('0x12'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xa762aa,_0x3b0726){_0x3b0726=_0x3b0726||0xcc;return function(_0x366908){if(_0x366908){return _0xa762aa[_0x87ab('0x13')](_0x3b0726);}return _0xa762aa[_0x87ab('0x14')](_0x3b0726)[_0x87ab('0x15')]();};}function respondWithResult(_0x5944bd,_0xdaa0ba){_0xdaa0ba=_0xdaa0ba||0xc8;return function(_0x4382c9){if(_0x4382c9){return _0x5944bd[_0x87ab('0x14')](_0xdaa0ba)[_0x87ab('0x16')](_0x4382c9);}};}function respondWithFilteredResult(_0x2704bd,_0x3360e3){return function(_0x1561d6){if(_0x1561d6){var _0x5cc088=typeof _0x3360e3['offset']===_0x87ab('0x17')&&typeof _0x3360e3['limit']===_0x87ab('0x17');var _0x4ea28e=_0x1561d6['count'];var _0x39c121=_0x5cc088?0x0:_0x3360e3[_0x87ab('0x18')];var _0x3d43bf=_0x5cc088?_0x1561d6[_0x87ab('0x19')]:_0x3360e3[_0x87ab('0x18')]+_0x3360e3[_0x87ab('0x1a')];var _0x7662a7;if(_0x3d43bf>=_0x4ea28e){_0x3d43bf=_0x4ea28e;_0x7662a7=0xc8;}else{_0x7662a7=0xce;}_0x2704bd[_0x87ab('0x14')](_0x7662a7);return _0x2704bd[_0x87ab('0x1b')](_0x87ab('0x1c'),_0x39c121+'-'+_0x3d43bf+'/'+_0x4ea28e)[_0x87ab('0x16')](_0x1561d6);}return null;};}function patchUpdates(_0xaf3f22){return function(_0x47d459){try{jsonpatch[_0x87ab('0x1d')](_0x47d459,_0xaf3f22,!![]);}catch(_0x39e639){return BPromise[_0x87ab('0x1e')](_0x39e639);}return _0x47d459[_0x87ab('0x1f')]();};}function saveUpdates(_0x3792d9,_0x68ff7b){return function(_0x5a6b1e){if(_0x5a6b1e){return _0x5a6b1e['update'](_0x3792d9)[_0x87ab('0x20')](function(_0x2b3013){return _0x2b3013;});}return null;};}function removeEntity(_0x90dba1,_0x3250de){return function(_0x51b90b){if(_0x51b90b){return _0x51b90b['destroy']()['then'](function(){_0x90dba1['status'](0xcc)[_0x87ab('0x15')]();});}};}function handleEntityNotFound(_0x57e244,_0x380730){return function(_0x1c25c4){if(!_0x1c25c4){_0x57e244['sendStatus'](0x194);}return _0x1c25c4;};}function handleError(_0x12cea2,_0x4dc4f8){_0x4dc4f8=_0x4dc4f8||0x1f4;return function(_0x4194b6){logger[_0x87ab('0x21')](_0x4194b6[_0x87ab('0x22')]);if(_0x4194b6[_0x87ab('0x23')]){delete _0x4194b6[_0x87ab('0x23')];}_0x12cea2[_0x87ab('0x14')](_0x4dc4f8)[_0x87ab('0x24')](_0x4194b6);};}exports[_0x87ab('0x25')]=function(_0x137c5a,_0x41d6d0){if(_0x137c5a[_0x87ab('0x26')]['id']){delete _0x137c5a['body']['id'];}return db[_0x87ab('0x27')][_0x87ab('0x28')]({'where':{'id':_0x137c5a[_0x87ab('0x29')]['id']}})[_0x87ab('0x20')](handleEntityNotFound(_0x41d6d0,null))[_0x87ab('0x20')](saveUpdates(_0x137c5a[_0x87ab('0x26')],null))[_0x87ab('0x20')](respondWithResult(_0x41d6d0,null))[_0x87ab('0x2a')](handleError(_0x41d6d0,null));};exports[_0x87ab('0x2b')]=function(_0x213cb4,_0x20a7fd){return db[_0x87ab('0x27')][_0x87ab('0x28')]({'where':{'id':_0x213cb4[_0x87ab('0x29')]['id']}})['then'](handleEntityNotFound(_0x20a7fd,null))[_0x87ab('0x20')](removeEntity(_0x20a7fd,null))['catch'](handleError(_0x20a7fd,null));}; \ No newline at end of file +var _0x6bf9=['bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','destroy','sendStatus','error','stack','name','send','update','body','Action','find','params','then','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x1ebcd3,_0x35b1c4){var _0xc350e=function(_0x226da7){while(--_0x226da7){_0x1ebcd3['push'](_0x1ebcd3['shift']());}};_0xc350e(++_0x35b1c4);}(_0x6bf9,0x96));var _0x96bf=function(_0x243217,_0x522951){_0x243217=_0x243217-0x0;var _0x478029=_0x6bf9[_0x243217];return _0x478029;};'use strict';var emlformat=require(_0x96bf('0x0'));var rimraf=require(_0x96bf('0x1'));var zipdir=require(_0x96bf('0x2'));var jsonpatch=require(_0x96bf('0x3'));var rp=require(_0x96bf('0x4'));var moment=require(_0x96bf('0x5'));var BPromise=require(_0x96bf('0x6'));var Mustache=require(_0x96bf('0x7'));var util=require(_0x96bf('0x8'));var path=require(_0x96bf('0x9'));var sox=require('sox');var csv=require(_0x96bf('0xa'));var ejs=require(_0x96bf('0xb'));var fs=require('fs');var fs_extra=require(_0x96bf('0xc'));var _=require(_0x96bf('0xd'));var squel=require('squel');var crypto=require(_0x96bf('0xe'));var jsforce=require(_0x96bf('0xf'));var deskjs=require(_0x96bf('0x10'));var toCsv=require(_0x96bf('0xa'));var querystring=require('querystring');var Papa=require(_0x96bf('0x11'));var Redis=require(_0x96bf('0x12'));var authService=require(_0x96bf('0x13'));var qs=require(_0x96bf('0x14'));var as=require(_0x96bf('0x15'));var hardwareService=require(_0x96bf('0x16'));var logger=require(_0x96bf('0x17'))(_0x96bf('0x18'));var utils=require('../../config/utils');var config=require(_0x96bf('0x19'));var licenseUtil=require(_0x96bf('0x1a'));var db=require(_0x96bf('0x1b'))['db'];function respondWithStatusCode(_0x3f6ad1,_0x101d5f){_0x101d5f=_0x101d5f||0xcc;return function(_0x29dc31){if(_0x29dc31){return _0x3f6ad1['sendStatus'](_0x101d5f);}return _0x3f6ad1[_0x96bf('0x1c')](_0x101d5f)['end']();};}function respondWithResult(_0x2f8599,_0x1019a1){_0x1019a1=_0x1019a1||0xc8;return function(_0x52eb75){if(_0x52eb75){return _0x2f8599[_0x96bf('0x1c')](_0x1019a1)['json'](_0x52eb75);}};}function respondWithFilteredResult(_0x4a4f98,_0x1e7fdf){return function(_0x3ec62a){if(_0x3ec62a){var _0x4d8b02=typeof _0x1e7fdf['offset']===_0x96bf('0x1d')&&typeof _0x1e7fdf[_0x96bf('0x1e')]===_0x96bf('0x1d');var _0x59ccfc=_0x3ec62a[_0x96bf('0x1f')];var _0x4e84bb=_0x4d8b02?0x0:_0x1e7fdf[_0x96bf('0x20')];var _0x1cd076=_0x4d8b02?_0x3ec62a[_0x96bf('0x1f')]:_0x1e7fdf[_0x96bf('0x20')]+_0x1e7fdf[_0x96bf('0x1e')];var _0x1a77cc;if(_0x1cd076>=_0x59ccfc){_0x1cd076=_0x59ccfc;_0x1a77cc=0xc8;}else{_0x1a77cc=0xce;}_0x4a4f98[_0x96bf('0x1c')](_0x1a77cc);return _0x4a4f98[_0x96bf('0x21')](_0x96bf('0x22'),_0x4e84bb+'-'+_0x1cd076+'/'+_0x59ccfc)[_0x96bf('0x23')](_0x3ec62a);}return null;};}function patchUpdates(_0x27f2f9){return function(_0x3f8824){try{jsonpatch[_0x96bf('0x24')](_0x3f8824,_0x27f2f9,!![]);}catch(_0x417e92){return BPromise[_0x96bf('0x25')](_0x417e92);}return _0x3f8824[_0x96bf('0x26')]();};}function saveUpdates(_0x241893,_0x4977f0){return function(_0x5dba2c){if(_0x5dba2c){return _0x5dba2c['update'](_0x241893)['then'](function(_0x2dae0b){return _0x2dae0b;});}return null;};}function removeEntity(_0x37efb6,_0x186605){return function(_0x50fe7e){if(_0x50fe7e){return _0x50fe7e[_0x96bf('0x27')]()['then'](function(){_0x37efb6[_0x96bf('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0xa092fe,_0x45ee53){return function(_0x39bff9){if(!_0x39bff9){_0xa092fe[_0x96bf('0x28')](0x194);}return _0x39bff9;};}function handleError(_0x2265a4,_0x16fe58){_0x16fe58=_0x16fe58||0x1f4;return function(_0xe90756){logger[_0x96bf('0x29')](_0xe90756[_0x96bf('0x2a')]);if(_0xe90756['name']){delete _0xe90756[_0x96bf('0x2b')];}_0x2265a4[_0x96bf('0x1c')](_0x16fe58)[_0x96bf('0x2c')](_0xe90756);};}exports[_0x96bf('0x2d')]=function(_0xef1537,_0x3b2a43){if(_0xef1537[_0x96bf('0x2e')]['id']){delete _0xef1537[_0x96bf('0x2e')]['id'];}return db[_0x96bf('0x2f')][_0x96bf('0x30')]({'where':{'id':_0xef1537[_0x96bf('0x31')]['id']}})[_0x96bf('0x32')](handleEntityNotFound(_0x3b2a43,null))[_0x96bf('0x32')](saveUpdates(_0xef1537[_0x96bf('0x2e')],null))['then'](respondWithResult(_0x3b2a43,null))['catch'](handleError(_0x3b2a43,null));};exports[_0x96bf('0x27')]=function(_0xe6fa27,_0x3810c4){return db[_0x96bf('0x2f')][_0x96bf('0x30')]({'where':{'id':_0xe6fa27[_0x96bf('0x31')]['id']}})[_0x96bf('0x32')](handleEntityNotFound(_0x3810c4,null))[_0x96bf('0x32')](removeEntity(_0x3810c4,null))[_0x96bf('0x33')](handleError(_0x3810c4,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index 49feba1..8321a48 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 _0xc397=['../../config/environment','exports','Action','tools_actions','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x1b4c04,_0x8d961d){var _0x374f5d=function(_0x11dc31){while(--_0x11dc31){_0x1b4c04['push'](_0x1b4c04['shift']());}};_0x374f5d(++_0x8d961d);}(_0xc397,0x18a));var _0x7c39=function(_0x17c173,_0x564168){_0x17c173=_0x17c173-0x0;var _0x2cc9a2=_0xc397[_0x17c173];return _0x2cc9a2;};'use strict';var _=require('lodash');var util=require(_0x7c39('0x0'));var logger=require(_0x7c39('0x1'))(_0x7c39('0x2'));var moment=require(_0x7c39('0x3'));var BPromise=require(_0x7c39('0x4'));var rp=require(_0x7c39('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7c39('0x6'));var attributes=require('./action.attributes');module[_0x7c39('0x7')]=function(_0x6aeff8,_0x4b9744){return _0x6aeff8['define'](_0x7c39('0x8'),attributes,{'tableName':_0x7c39('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5ae9=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./action.attributes','exports','define','Action','tools_actions','lodash','../../config/logger','api'];(function(_0x557a04,_0x55e21a){var _0x43c6e2=function(_0x2c192d){while(--_0x2c192d){_0x557a04['push'](_0x557a04['shift']());}};_0x43c6e2(++_0x55e21a);}(_0x5ae9,0x131));var _0x95ae=function(_0x568cf0,_0x1a44cb){_0x568cf0=_0x568cf0-0x0;var _0x360f81=_0x5ae9[_0x568cf0];return _0x360f81;};'use strict';var _=require(_0x95ae('0x0'));var util=require('util');var logger=require(_0x95ae('0x1'))(_0x95ae('0x2'));var moment=require(_0x95ae('0x3'));var BPromise=require(_0x95ae('0x4'));var rp=require(_0x95ae('0x5'));var fs=require('fs');var path=require(_0x95ae('0x6'));var rimraf=require(_0x95ae('0x7'));var config=require(_0x95ae('0x8'));var attributes=require(_0x95ae('0x9'));module[_0x95ae('0xa')]=function(_0x396901,_0x510240){return _0x396901[_0x95ae('0xb')](_0x95ae('0xc'),attributes,{'tableName':_0x95ae('0xd'),'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 e99ec87..333f9e3 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 _0xe14b=['../../config/environment','jayson/promise','client','http','then','info','Action,\x20%s,\x20%s','Action,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','randomstring','ioredis','../../config/utils'];(function(_0x588176,_0x55c947){var _0x3c5acd=function(_0x33f5fd){while(--_0x33f5fd){_0x588176['push'](_0x588176['shift']());}};_0x3c5acd(++_0x55c947);}(_0xe14b,0x93));var _0xbe14=function(_0x30688c,_0x20adc7){_0x30688c=_0x30688c-0x0;var _0x574366=_0xe14b[_0x30688c];return _0x574366;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xbe14('0x2'));var fs=require('fs');var Redis=require(_0xbe14('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xbe14('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xbe14('0x5'));var jayson=require(_0xbe14('0x6'));var client=jayson[_0xbe14('0x7')][_0xbe14('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1d9ade,_0x39387e,_0x196fca){return new BPromise(function(_0x566ae7,_0x50f909){return client['request'](_0x1d9ade,_0x196fca)[_0xbe14('0x9')](function(_0x6fceff){logger[_0xbe14('0xa')](_0xbe14('0xb'),_0x39387e,'request\x20sent');logger['debug'](_0xbe14('0xc'),_0x39387e,_0xbe14('0xd'),JSON['stringify'](_0x6fceff));if(_0x6fceff[_0xbe14('0xe')]){if(_0x6fceff[_0xbe14('0xe')][_0xbe14('0xf')]===0x1f4){logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);return _0x50f909(_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);}logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);return _0x566ae7(_0x6fceff['error']['message']);}else{logger[_0xbe14('0xa')](_0xbe14('0xb'),_0x39387e,_0xbe14('0xd'));_0x566ae7(_0x6fceff[_0xbe14('0x11')]['message']);}})[_0xbe14('0x12')](function(_0xe9c3ec){logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0xe9c3ec);_0x50f909(_0xe9c3ec);});});} \ No newline at end of file +var _0x1cb9=['error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','stringify'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x1cb9,0x14e));var _0x91cb=function(_0x511402,_0x38dc1b){_0x511402=_0x511402-0x0;var _0x2b03c6=_0x1cb9[_0x511402];return _0x2b03c6;};'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')]('Action,\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 diff --git a/server/api/action/index.js b/server/api/action/index.js index 6dd93f3..64cd0ea 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 _0x2636=['isAuthenticated','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./action.controller','put','/:id'];(function(_0xf0fc80,_0x9610ec){var _0x5ed527=function(_0x6c6104){while(--_0x6c6104){_0xf0fc80['push'](_0xf0fc80['shift']());}};_0x5ed527(++_0x9610ec);}(_0x2636,0x1f4));var _0x6263=function(_0x1e6a2f,_0xd3d352){_0x1e6a2f=_0x1e6a2f-0x0;var _0x45e077=_0x2636[_0x1e6a2f];return _0x45e077;};'use strict';var multer=require(_0x6263('0x0'));var util=require(_0x6263('0x1'));var path=require(_0x6263('0x2'));var timeout=require(_0x6263('0x3'));var express=require(_0x6263('0x4'));var router=express[_0x6263('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x6263('0x6'));var interaction=require(_0x6263('0x7'));var config=require(_0x6263('0x8'));var controller=require(_0x6263('0x9'));router[_0x6263('0xa')](_0x6263('0xb'),auth[_0x6263('0xc')](),controller[_0x6263('0xd')]);router[_0x6263('0xe')](_0x6263('0xb'),auth[_0x6263('0xc')](),controller['destroy']);module[_0x6263('0xf')]=router; \ No newline at end of file +var _0xf6e6=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','put','/:id','update','delete','isAuthenticated','destroy','exports','multer','path'];(function(_0x305049,_0x513ce4){var _0x408413=function(_0x5e2492){while(--_0x5e2492){_0x305049['push'](_0x305049['shift']());}};_0x408413(++_0x513ce4);}(_0xf6e6,0xa6));var _0x6f6e=function(_0x9cc4a0,_0x387962){_0x9cc4a0=_0x9cc4a0-0x0;var _0x4faac7=_0xf6e6[_0x9cc4a0];return _0x4faac7;};'use strict';var multer=require(_0x6f6e('0x0'));var util=require('util');var path=require(_0x6f6e('0x1'));var timeout=require(_0x6f6e('0x2'));var express=require(_0x6f6e('0x3'));var router=express[_0x6f6e('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x6f6e('0x5'));var interaction=require(_0x6f6e('0x6'));var config=require('../../config/environment');var controller=require('./action.controller');router[_0x6f6e('0x7')](_0x6f6e('0x8'),auth['isAuthenticated'](),controller[_0x6f6e('0x9')]);router[_0x6f6e('0xa')](_0x6f6e('0x8'),auth[_0x6f6e('0xb')](),controller[_0x6f6e('0xc')]);module[_0x6f6e('0xd')]=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index d462e81..50b6b6b 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 _0xee14=['STRING','TEXT'];(function(_0x16ad2d,_0xd2beee){var _0x4e997d=function(_0x1823ba){while(--_0x1823ba){_0x16ad2d['push'](_0x16ad2d['shift']());}};_0x4e997d(++_0xd2beee);}(_0xee14,0x13a));var _0x4ee1=function(_0x3863a1,_0x4a0245){_0x3863a1=_0x3863a1-0x0;var _0x347750=_0xee14[_0x3863a1];return _0x347750;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x4ee1('0x0')],'allowNull':![]},'description':{'type':Sequelize[_0x4ee1('0x0')]},'parent':{'type':Sequelize[_0x4ee1('0x0')]},'table':{'type':Sequelize[_0x4ee1('0x0')]},'conditions':{'type':Sequelize[_0x4ee1('0x1')]},'joins':{'type':Sequelize[_0x4ee1('0x1')]}}; \ No newline at end of file +var _0xb138=['TEXT','sequelize','exports','STRING'];(function(_0x1c2f4b,_0x51b1c0){var _0x520904=function(_0x4fb7e5){while(--_0x4fb7e5){_0x1c2f4b['push'](_0x1c2f4b['shift']());}};_0x520904(++_0x51b1c0);}(_0xb138,0x1dd));var _0x8b13=function(_0x3b359b,_0x31d45a){_0x3b359b=_0x3b359b-0x0;var _0x14efc0=_0xb138[_0x3b359b];return _0x14efc0;};'use strict';var Sequelize=require(_0x8b13('0x0'));module[_0x8b13('0x1')]={'name':{'type':Sequelize[_0x8b13('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x8b13('0x2')]},'parent':{'type':Sequelize[_0x8b13('0x2')]},'table':{'type':Sequelize[_0x8b13('0x2')]},'conditions':{'type':Sequelize[_0x8b13('0x3')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index 9200d92..6d12097 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 _0x813e=['endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','fork','../../files/reports','savename','countTable','COUNT(*)','run','runReport','getFields','debug','Limited\x20Query:','rimraf','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','limit','undefined','count','set','Content-Range','json','reject','save','update','then','destroy','get','UserProfileResource','error','stack','name','map','AnalyticCustomReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','findAll','rows','catch','include','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','CustomReports','body','params','join','left_join','right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MIN(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','rules','group','condition','value','length','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','select','table','MetricId','metric','field','function','format','replace','groupBy','orderBy','order','alias','joins','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','parse','clone','toString','sequelize','QueryTypes','SELECT','MAX(%s)','AVG(%s)','ROUND(%s)','IS\x20EMPTY','operator','Sequelize','keyBy','from','DESC','output','web','fullPath','%s-%s.%s','randomstring','generate','csv','custom','AnalyticExtractedReport','cdr','startDate'];(function(_0x5c3c0b,_0x4ee35e){var _0x52ecd2=function(_0x3cf575){while(--_0x3cf575){_0x5c3c0b['push'](_0x5c3c0b['shift']());}};_0x52ecd2(++_0x4ee35e);}(_0x813e,0xb3));var _0xe813=function(_0x47066d,_0x2ea60d){_0x47066d=_0x47066d-0x0;var _0x34baa9=_0x813e[_0x47066d];return _0x34baa9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe813('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xe813('0x1'));var Mustache=require(_0xe813('0x2'));var util=require(_0xe813('0x3'));var path=require(_0xe813('0x4'));var sox=require(_0xe813('0x5'));var csv=require(_0xe813('0x6'));var ejs=require(_0xe813('0x7'));var fs=require('fs');var fs_extra=require(_0xe813('0x8'));var _=require('lodash');var squel=require(_0xe813('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xe813('0xa'));var toCsv=require(_0xe813('0x6'));var querystring=require(_0xe813('0xb'));var Papa=require(_0xe813('0xc'));var Redis=require(_0xe813('0xd'));var authService=require(_0xe813('0xe'));var qs=require(_0xe813('0xf'));var as=require(_0xe813('0x10'));var hardwareService=require(_0xe813('0x11'));var logger=require(_0xe813('0x12'))('api');var utils=require('../../config/utils');var config=require(_0xe813('0x13'));var licenseUtil=require(_0xe813('0x14'));var db=require(_0xe813('0x15'))['db'];var dbH=require('../../mysqldb')['dbH'];function respondWithStatusCode(_0x36008b,_0x12d096){_0x12d096=_0x12d096||0xcc;return function(_0x564674){if(_0x564674){return _0x36008b[_0xe813('0x16')](_0x12d096);}return _0x36008b['status'](_0x12d096)[_0xe813('0x17')]();};}function respondWithResult(_0x471ab1,_0x1ccb50){_0x1ccb50=_0x1ccb50||0xc8;return function(_0xbd6dfc){if(_0xbd6dfc){return _0x471ab1[_0xe813('0x18')](_0x1ccb50)['json'](_0xbd6dfc);}};}function respondWithFilteredResult(_0x26928f,_0x2e3930){return function(_0x4d6fc8){if(_0x4d6fc8){var _0x1aecee=typeof _0x2e3930[_0xe813('0x19')]==='undefined'&&typeof _0x2e3930[_0xe813('0x1a')]===_0xe813('0x1b');var _0x24ca48=_0x4d6fc8[_0xe813('0x1c')];var _0x6756bb=_0x1aecee?0x0:_0x2e3930[_0xe813('0x19')];var _0x3eb7f9=_0x1aecee?_0x4d6fc8[_0xe813('0x1c')]:_0x2e3930[_0xe813('0x19')]+_0x2e3930['limit'];var _0xbe1fa5;if(_0x3eb7f9>=_0x24ca48){_0x3eb7f9=_0x24ca48;_0xbe1fa5=0xc8;}else{_0xbe1fa5=0xce;}_0x26928f['status'](_0xbe1fa5);return _0x26928f[_0xe813('0x1d')](_0xe813('0x1e'),_0x6756bb+'-'+_0x3eb7f9+'/'+_0x24ca48)[_0xe813('0x1f')](_0x4d6fc8);}return null;};}function patchUpdates(_0x2c2a93){return function(_0x2de41e){try{jsonpatch['apply'](_0x2de41e,_0x2c2a93,!![]);}catch(_0x36516b){return BPromise[_0xe813('0x20')](_0x36516b);}return _0x2de41e[_0xe813('0x21')]();};}function saveUpdates(_0x257464,_0x46c107){return function(_0x37c378){if(_0x37c378){return _0x37c378[_0xe813('0x22')](_0x257464)[_0xe813('0x23')](function(_0x4c2701){return _0x4c2701;});}return null;};}function removeEntity(_0x29157d,_0x4ab38e){return function(_0x1852b2){if(_0x1852b2){return _0x1852b2[_0xe813('0x24')]()[_0xe813('0x23')](function(){var _0x1a5f7d=_0x1852b2[_0xe813('0x25')]({'plain':!![]});var _0x4987ea='CustomReports';return db[_0xe813('0x26')][_0xe813('0x24')]({'where':{'type':_0x4987ea,'resourceId':_0x1a5f7d['id']}})[_0xe813('0x23')](function(){return _0x1852b2;});})[_0xe813('0x23')](function(){_0x29157d[_0xe813('0x18')](0xcc)[_0xe813('0x17')]();});}};}function handleEntityNotFound(_0x5620dc,_0x58f6fa){return function(_0x8a50bd){if(!_0x8a50bd){_0x5620dc[_0xe813('0x16')](0x194);}return _0x8a50bd;};}function handleError(_0x10bda3,_0x179e16){_0x179e16=_0x179e16||0x1f4;return function(_0x17b551){logger[_0xe813('0x27')](_0x17b551[_0xe813('0x28')]);if(_0x17b551[_0xe813('0x29')]){delete _0x17b551['name'];}_0x10bda3[_0xe813('0x18')](_0x179e16)['send'](_0x17b551);};}exports['index']=function(_0x1eb398,_0x577383){var _0x1d9169={},_0x26db44={},_0x12c681={'count':0x0,'rows':[]};var _0x482835=_[_0xe813('0x2a')](db[_0xe813('0x2b')][_0xe813('0x2c')],function(_0x2b720a){return{'name':_0x2b720a[_0xe813('0x2d')],'type':_0x2b720a[_0xe813('0x2e')][_0xe813('0x2f')]};});_0x26db44[_0xe813('0x30')]=_[_0xe813('0x2a')](_0x482835,_0xe813('0x29'));_0x26db44[_0xe813('0x31')]=_[_0xe813('0x32')](_0x1eb398[_0xe813('0x31')]);_0x26db44[_0xe813('0x33')]=_[_0xe813('0x34')](_0x26db44[_0xe813('0x30')],_0x26db44[_0xe813('0x31')]);_0x1d9169[_0xe813('0x35')]=_[_0xe813('0x34')](_0x26db44[_0xe813('0x30')],qs['fields'](_0x1eb398[_0xe813('0x31')][_0xe813('0x36')]));_0x1d9169[_0xe813('0x35')]=_0x1d9169[_0xe813('0x35')]['length']?_0x1d9169['attributes']:_0x26db44[_0xe813('0x30')];if(!_0x1eb398[_0xe813('0x31')][_0xe813('0x37')](_0xe813('0x38'))){_0x1d9169[_0xe813('0x1a')]=qs[_0xe813('0x1a')](_0x1eb398[_0xe813('0x31')][_0xe813('0x1a')]);_0x1d9169[_0xe813('0x19')]=qs[_0xe813('0x19')](_0x1eb398[_0xe813('0x31')][_0xe813('0x19')]);}_0x1d9169['order']=qs[_0xe813('0x39')](_0x1eb398[_0xe813('0x31')][_0xe813('0x39')]);_0x1d9169[_0xe813('0x3a')]=qs['filters'](_[_0xe813('0x3b')](_0x1eb398[_0xe813('0x31')],_0x26db44[_0xe813('0x33')]),_0x482835);if(_0x1eb398['query'][_0xe813('0x3c')]){_0x1d9169['where']=_[_0xe813('0x3d')](_0x1d9169['where'],{'$or':_[_0xe813('0x2a')](_0x482835,function(_0x43a44f){if(_0x43a44f[_0xe813('0x2e')]!=='VIRTUAL'){var _0x3f8253={};_0x3f8253[_0x43a44f[_0xe813('0x29')]]={'$like':'%'+_0x1eb398[_0xe813('0x31')][_0xe813('0x3c')]+'%'};return _0x3f8253;}})});}_0x1d9169=_[_0xe813('0x3d')]({},_0x1d9169,_0x1eb398[_0xe813('0x3e')]);var _0x322fe4={'where':_0x1d9169['where']};return db[_0xe813('0x2b')]['count'](_0x322fe4)[_0xe813('0x23')](function(_0x323e1d){_0x12c681['count']=_0x323e1d;if(_0x1eb398[_0xe813('0x31')][_0xe813('0x3f')]){_0x1d9169['include']=[{'all':!![]}];}return db['AnalyticCustomReport'][_0xe813('0x40')](_0x1d9169);})['then'](function(_0x324df7){_0x12c681[_0xe813('0x41')]=_0x324df7;return _0x12c681;})['then'](respondWithFilteredResult(_0x577383,_0x1d9169))[_0xe813('0x42')](handleError(_0x577383,null));};exports['show']=function(_0x4c228a,_0x373b1f){var _0x25d6a0={'raw':![],'where':{'id':_0x4c228a['params']['id']}},_0x1771ab={};_0x1771ab['model']=_[_0xe813('0x32')](db[_0xe813('0x2b')][_0xe813('0x2c')]);_0x1771ab[_0xe813('0x31')]=_[_0xe813('0x32')](_0x4c228a[_0xe813('0x31')]);_0x1771ab['filters']=_[_0xe813('0x34')](_0x1771ab[_0xe813('0x30')],_0x1771ab[_0xe813('0x31')]);_0x25d6a0[_0xe813('0x35')]=_[_0xe813('0x34')](_0x1771ab[_0xe813('0x30')],qs['fields'](_0x4c228a[_0xe813('0x31')][_0xe813('0x36')]));_0x25d6a0['attributes']=_0x25d6a0[_0xe813('0x35')]['length']?_0x25d6a0['attributes']:_0x1771ab[_0xe813('0x30')];if(_0x4c228a['query'][_0xe813('0x3f')]){_0x25d6a0[_0xe813('0x43')]=[{'all':!![]}];}_0x25d6a0=_[_0xe813('0x3d')]({},_0x25d6a0,_0x4c228a[_0xe813('0x3e')]);return db[_0xe813('0x2b')][_0xe813('0x44')](_0x25d6a0)[_0xe813('0x23')](handleEntityNotFound(_0x373b1f,null))[_0xe813('0x23')](respondWithResult(_0x373b1f,null))['catch'](handleError(_0x373b1f,null));};exports[_0xe813('0x45')]=function(_0x14edac,_0x1a396d){return db[_0xe813('0x2b')]['create'](_0x14edac['body'],{})[_0xe813('0x23')](function(_0x28fa95){var _0x51f358=_0x14edac['user'][_0xe813('0x25')]({'plain':!![]});if(!_0x51f358)throw new Error(_0xe813('0x46'));if(_0x51f358[_0xe813('0x47')]===_0xe813('0x48')){var _0xa3ab99=_0x28fa95['get']({'plain':!![]});var _0x119f7d='Reports';return db[_0xe813('0x49')][_0xe813('0x44')]({'where':{'name':_0x119f7d,'userProfileId':_0x51f358[_0xe813('0x4a')]},'raw':!![]})[_0xe813('0x23')](function(_0xe06680){if(_0xe06680&&_0xe06680[_0xe813('0x4b')]===0x0){return db[_0xe813('0x26')][_0xe813('0x45')]({'name':_0xa3ab99[_0xe813('0x29')],'resourceId':_0xa3ab99['id'],'type':_0xe813('0x4c'),'sectionId':_0xe06680['id']},{})[_0xe813('0x23')](function(){return _0x28fa95;});}else{return _0x28fa95;}})[_0xe813('0x42')](function(_0x285e72){logger[_0xe813('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x285e72);throw _0x285e72;});}return _0x28fa95;})[_0xe813('0x23')](respondWithResult(_0x1a396d,0xc9))[_0xe813('0x42')](handleError(_0x1a396d,null));};exports[_0xe813('0x22')]=function(_0x103160,_0x2aee30){if(_0x103160[_0xe813('0x4d')]['id']){delete _0x103160[_0xe813('0x4d')]['id'];}return db[_0xe813('0x2b')][_0xe813('0x44')]({'where':{'id':_0x103160['params']['id']}})[_0xe813('0x23')](handleEntityNotFound(_0x2aee30,null))[_0xe813('0x23')](saveUpdates(_0x103160['body'],null))[_0xe813('0x23')](respondWithResult(_0x2aee30,null))[_0xe813('0x42')](handleError(_0x2aee30,null));};exports[_0xe813('0x24')]=function(_0x1e0b9e,_0x4bdabe){return db[_0xe813('0x2b')]['find']({'where':{'id':_0x1e0b9e[_0xe813('0x4e')]['id']}})['then'](handleEntityNotFound(_0x4bdabe,null))[_0xe813('0x23')](removeEntity(_0x4bdabe,null))[_0xe813('0x42')](handleError(_0x4bdabe,null));};exports['preview']=function(_0x21e7d2,_0x3b7408){var _0x53ad2d=0xa;var _0x3219c5=[_0xe813('0x4f'),_0xe813('0x50'),_0xe813('0x51'),_0xe813('0x52')];var _0x46819d={'SUM':_0xe813('0x53'),'COUNT':_0xe813('0x54'),'COUNT DISTINCT':_0xe813('0x55'),'MAX':'MAX(%s)','MIN':_0xe813('0x56'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xe813('0x57'),'GROUP_CONCAT ASC':_0xe813('0x58'),'GROUP_CONCAT DESC':_0xe813('0x59')};var _0x32769e={'SEC_TO_TIME':_0xe813('0x5a'),'DATE':_0xe813('0x5b'),'HOUR':_0xe813('0x5c'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xe813('0x5d')};var _0x127ee6=function(_0x441ad9){return!_[_0xe813('0x5e')]([_0xe813('0x5f'),_0xe813('0x60'),'IS\x20EMPTY',_0xe813('0x61')],_0x441ad9);};var _0x42840b=function(_0x916fb6){if(!_0x916fb6||!_0x916fb6['rules']['length']){return'';}for(var _0x46f4ce='(',_0x563379=0x0;_0x563379<_0x916fb6[_0xe813('0x62')]['length'];_0x563379+=0x1){_0x563379>0x0&&(_0x46f4ce+='\x20'+_0x916fb6['operator']+'\x20');_0x46f4ce+=_0x916fb6[_0xe813('0x62')][_0x563379][_0xe813('0x63')]?_0x42840b(_0x916fb6[_0xe813('0x62')][_0x563379][_0xe813('0x63')]):_0x916fb6['rules'][_0x563379]['field']+'\x20'+_0x916fb6[_0xe813('0x62')][_0x563379][_0xe813('0x64')]+(_0x127ee6(_0x916fb6[_0xe813('0x62')][_0x563379][_0xe813('0x64')])?'\x20'+_0x916fb6[_0xe813('0x62')][_0x563379][_0xe813('0x65')]:'');}return _0x46f4ce+')';};var _0x3f541e={'where':{'id':_0x21e7d2[_0xe813('0x4e')]['id']}},_0x1d00cb,_0x214e0a,_0x2bf1b1,_0x273cd4,_0x558b65;_0x3f541e=_[_0xe813('0x3d')]({},_0x3f541e,_0x21e7d2['options']);return db[_0xe813('0x2b')][_0xe813('0x44')](_0x3f541e)[_0xe813('0x23')](function(_0x37916f){if(_0x37916f){_0x1d00cb=_0x37916f;return _0x37916f['getFields']();}return null;})[_0xe813('0x23')](function(_0x7e3833){if(_0x7e3833){if(!_0x7e3833[_0xe813('0x66')]){throw new db['Sequelize'][(_0xe813('0x67'))](_0xe813('0x68'),0x193);}_0x214e0a=_0x7e3833;return db['AnalyticMetric'][_0xe813('0x40')]({'raw':!![]});}return null;})['then'](function(_0x2c88d0){if(_0x2c88d0){_0x2bf1b1=_['keyBy'](_0x2c88d0,'id');var _0x4accc2;var _0x3f14c5=squel[_0xe813('0x69')]();_0x3f14c5['from'](_0x1d00cb[_0xe813('0x6a')]);for(var _0x423186=0x0;_0x423186<_0x214e0a[_0xe813('0x66')];_0x423186+=0x1){_0x4accc2=_0x214e0a[_0x423186]['MetricId']?_0x2bf1b1[_0x214e0a[_0x423186][_0xe813('0x6b')]][_0xe813('0x6c')]:_0x214e0a[_0x423186][_0xe813('0x6d')];_0x4accc2=_0x214e0a[_0x423186][_0xe813('0x6e')]?_['replace'](_0x46819d[_0x214e0a[_0x423186][_0xe813('0x6e')]],'%s',_0x4accc2):_0x4accc2;_0x4accc2=_0x214e0a[_0x423186][_0xe813('0x6f')]?_[_0xe813('0x70')](_0x32769e[_0x214e0a[_0x423186][_0xe813('0x6f')]],'%s',_0x4accc2):_0x4accc2;if(_0x214e0a[_0x423186][_0xe813('0x71')]){_0x3f14c5[_0xe813('0x63')](_0x4accc2);}_0x214e0a[_0x423186][_0xe813('0x72')]&&_0x3f14c5[_0xe813('0x73')](_0x4accc2,_0x214e0a[_0x423186][_0xe813('0x72')]==='DESC'?![]:!![]);_0x3f14c5[_0xe813('0x6d')](_0x4accc2,_0x214e0a[_0x423186][_0xe813('0x74')]||_0x4accc2);}if(_0x1d00cb[_0xe813('0x75')]){_0x1d00cb[_0xe813('0x75')]=JSON['parse'](_0x1d00cb[_0xe813('0x75')]);for(var _0x5e901d=0x0;_0x5e901d<_0x1d00cb[_0xe813('0x75')][_0xe813('0x66')];_0x5e901d+=0x1){if(_0x1d00cb[_0xe813('0x75')][_0x5e901d][_0xe813('0x2e')]&&_[_0xe813('0x5e')](_0x3219c5,_0x1d00cb[_0xe813('0x75')][_0x5e901d][_0xe813('0x2e')])&&_0x1d00cb[_0xe813('0x75')][_0x5e901d][_0xe813('0x76')]&&_0x1d00cb[_0xe813('0x75')][_0x5e901d][_0xe813('0x77')]&&_0x1d00cb['joins'][_0x5e901d][_0xe813('0x78')]){_0x3f14c5[_0x1d00cb[_0xe813('0x75')][_0x5e901d][_0xe813('0x2e')]](_0x1d00cb[_0xe813('0x75')][_0x5e901d]['foreignTable'],null,util[_0xe813('0x6f')](_0xe813('0x79'),_0x1d00cb[_0xe813('0x6a')],_0x1d00cb['joins'][_0x5e901d][_0xe813('0x76')],_0x1d00cb['joins'][_0x5e901d][_0xe813('0x77')],_0x1d00cb[_0xe813('0x75')][_0x5e901d][_0xe813('0x78')]));}}}if(_0x1d00cb[_0xe813('0x7a')]){_0x1d00cb[_0xe813('0x7a')]=JSON[_0xe813('0x7b')](_0x1d00cb[_0xe813('0x7a')]);_0x3f14c5[_0xe813('0x3a')](_0x42840b(_0x1d00cb['conditions'][_0xe813('0x63')]));}_0x558b65=_0x3f14c5[_0xe813('0x7c')]();_0x3f14c5[_0xe813('0x1a')](_0x53ad2d);_0x3f14c5['offset'](0x0);logger['debug']('Limited\x20Query:',_0x3f14c5[_0xe813('0x7d')]());return dbH['sequelize']['query'](_0x3f14c5['toString'](),{'type':dbH[_0xe813('0x7e')][_0xe813('0x7f')][_0xe813('0x80')]});}})[_0xe813('0x23')](respondWithResult(_0x3b7408,null))[_0xe813('0x42')](handleError(_0x3b7408,null));};function runReport(_0xfdc6f9,_0x1ac692,_0x34ee1a){var _0x199c1f=_0x1ac692['name'];var _0x2e6548=0xa;var _0x27afe8=[_0xe813('0x4f'),_0xe813('0x50'),_0xe813('0x51'),_0xe813('0x52')];var _0x90438d={'SUM':'SUM(%s)','COUNT':_0xe813('0x54'),'COUNT DISTINCT':_0xe813('0x55'),'MAX':_0xe813('0x81'),'MIN':_0xe813('0x56'),'AVG':_0xe813('0x82'),'GROUP_CONCAT':_0xe813('0x57'),'GROUP_CONCAT ASC':_0xe813('0x58'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x345c91={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xe813('0x5b'),'HOUR':_0xe813('0x5c'),'ROUND':_0xe813('0x83'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x1a390a=function(_0x2d40){return!_[_0xe813('0x5e')](['IS\x20NULL',_0xe813('0x60'),_0xe813('0x84'),_0xe813('0x61')],_0x2d40);};var _0x59f077=function(_0xe3a2ad){if(!_0xe3a2ad||!_0xe3a2ad['rules']['length']){return'';}for(var _0x25a094='(',_0x16defe=0x0;_0x16defe<_0xe3a2ad['rules'][_0xe813('0x66')];_0x16defe+=0x1){_0x16defe>0x0&&(_0x25a094+='\x20'+_0xe3a2ad[_0xe813('0x85')]+'\x20');_0x25a094+=_0xe3a2ad['rules'][_0x16defe][_0xe813('0x63')]?_0x59f077(_0xe3a2ad['rules'][_0x16defe][_0xe813('0x63')]):_0xe3a2ad[_0xe813('0x62')][_0x16defe]['field']+'\x20'+_0xe3a2ad['rules'][_0x16defe][_0xe813('0x64')]+(_0x1a390a(_0xe3a2ad[_0xe813('0x62')][_0x16defe][_0xe813('0x64')])?'\x20'+_0xe3a2ad['rules'][_0x16defe][_0xe813('0x65')]:'');}return _0x25a094+')';};var _0x2afbb8={'where':{'id':_0xfdc6f9['id']}},_0x5bd09b,_0xd091e8,_0x43a885,_0x4596b8,_0x152f0c;_0x2afbb8=_[_0xe813('0x3d')]({},_0x2afbb8,_0x34ee1a);return db[_0xe813('0x2b')][_0xe813('0x44')](_0x2afbb8)['then'](function(_0x5356ce){if(_0x5356ce){_0x5bd09b=_0x5356ce;return _0x5356ce['getFields']();}return null;})[_0xe813('0x23')](function(_0x111058){if(_0x111058){if(!_0x111058['length']){throw new db[(_0xe813('0x86'))][(_0xe813('0x67'))](_0xe813('0x68'),0x193);}_0xd091e8=_0x111058;return db['AnalyticMetric'][_0xe813('0x40')]({'raw':!![]});}return null;})['then'](function(_0x5a60fd){if(_0x5a60fd){_0x43a885=_[_0xe813('0x87')](_0x5a60fd,'id');var _0x1e1e3a;var _0x25dedc=squel['select']();_0x25dedc[_0xe813('0x88')](_0x5bd09b[_0xe813('0x6a')]);for(var _0xc69fa3=0x0;_0xc69fa3<_0xd091e8[_0xe813('0x66')];_0xc69fa3+=0x1){_0x1e1e3a=_0xd091e8[_0xc69fa3]['MetricId']?_0x43a885[_0xd091e8[_0xc69fa3][_0xe813('0x6b')]][_0xe813('0x6c')]:_0xd091e8[_0xc69fa3][_0xe813('0x6d')];_0x1e1e3a=_0xd091e8[_0xc69fa3][_0xe813('0x6e')]?_['replace'](_0x90438d[_0xd091e8[_0xc69fa3][_0xe813('0x6e')]],'%s',_0x1e1e3a):_0x1e1e3a;_0x1e1e3a=_0xd091e8[_0xc69fa3][_0xe813('0x6f')]?_[_0xe813('0x70')](_0x345c91[_0xd091e8[_0xc69fa3]['format']],'%s',_0x1e1e3a):_0x1e1e3a;if(_0xd091e8[_0xc69fa3][_0xe813('0x71')]){_0x25dedc[_0xe813('0x63')](_0x1e1e3a);}_0xd091e8[_0xc69fa3][_0xe813('0x72')]&&_0x25dedc[_0xe813('0x73')](_0x1e1e3a,_0xd091e8[_0xc69fa3][_0xe813('0x72')]===_0xe813('0x89')?![]:!![]);_0x25dedc[_0xe813('0x6d')](_0x1e1e3a,_0xd091e8[_0xc69fa3][_0xe813('0x74')]||_0x1e1e3a);}if(_0x5bd09b[_0xe813('0x75')]){_0x5bd09b[_0xe813('0x75')]=JSON[_0xe813('0x7b')](_0x5bd09b[_0xe813('0x75')]);for(var _0x3ccf88=0x0;_0x3ccf88<_0x5bd09b['joins'][_0xe813('0x66')];_0x3ccf88+=0x1){if(_0x5bd09b['joins'][_0x3ccf88][_0xe813('0x2e')]&&_[_0xe813('0x5e')](_0x27afe8,_0x5bd09b[_0xe813('0x75')][_0x3ccf88][_0xe813('0x2e')])&&_0x5bd09b[_0xe813('0x75')][_0x3ccf88][_0xe813('0x76')]&&_0x5bd09b['joins'][_0x3ccf88][_0xe813('0x77')]&&_0x5bd09b['joins'][_0x3ccf88][_0xe813('0x78')]){_0x25dedc[_0x5bd09b['joins'][_0x3ccf88][_0xe813('0x2e')]](_0x5bd09b['joins'][_0x3ccf88][_0xe813('0x77')],null,util['format']('%s.%s\x20=\x20%s.%s',_0x5bd09b[_0xe813('0x6a')],_0x5bd09b[_0xe813('0x75')][_0x3ccf88][_0xe813('0x76')],_0x5bd09b[_0xe813('0x75')][_0x3ccf88]['foreignTable'],_0x5bd09b[_0xe813('0x75')][_0x3ccf88][_0xe813('0x78')]));}}}if(_0x5bd09b[_0xe813('0x7a')]){_0x5bd09b['conditions']=JSON[_0xe813('0x7b')](_0x5bd09b['conditions']);_0x25dedc[_0xe813('0x3a')](_0x59f077(_0x5bd09b[_0xe813('0x7a')][_0xe813('0x63')]));}_0x152f0c=_0x25dedc[_0xe813('0x7c')]();_0x25dedc[_0xe813('0x1a')](_0x2e6548);_0x25dedc[_0xe813('0x19')](0x0);return;}})[_0xe813('0x23')](function(){if(_0x1ac692[_0xe813('0x8a')]===_0xe813('0x8b')){return null;}var _0x343a85=_[_0xe813('0x3d')](_0x1ac692,{'name':_0x1ac692[_0xe813('0x8c')]||_0x1ac692[_0xe813('0x29')]||_0x5bd09b[_0xe813('0x29')],'basename':_0x199c1f,'savename':util['format'](_0xe813('0x8d'),_0x1ac692[_0xe813('0x29')]||_0x5bd09b[_0xe813('0x29')],require(_0xe813('0x8e'))[_0xe813('0x8f')](0x4),_0x1ac692['output']||_0xe813('0x90')),'reportId':_0x5bd09b['id'],'reportType':_0xe813('0x91')});return db[_0xe813('0x92')][_0xe813('0x45')](_0x343a85,{'raw':!![]});})[_0xe813('0x23')](function(_0x1a1e75){if(_0x5bd09b[_0xe813('0x6a')]===_0xe813('0x93')){_0x152f0c[_0xe813('0x3a')](_0x5bd09b[_0xe813('0x6a')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x1ac692[_0xe813('0x94')],_0x1ac692[_0xe813('0x95')]);}else{_0x152f0c[_0xe813('0x3a')](_0x5bd09b[_0xe813('0x6a')]+_0xe813('0x96'),_0x1ac692['startDate'],_0x1ac692[_0xe813('0x95')]);}if(_0x1a1e75){logger[_0xe813('0x97')](_0xe813('0x98'),_0x152f0c[_0xe813('0x7d')]());require(_0xe813('0x99'))[_0xe813('0x9a')](path['join'](__dirname,'../../components/export/',_0x1a1e75[_0xe813('0x8a')]),[_0x1a1e75['id'],_0x152f0c[_0xe813('0x7d')](),path[_0xe813('0x4f')](__dirname,_0xe813('0x9b'),_0x1a1e75[_0xe813('0x9c')]),_0x199c1f]);return _0x1a1e75;}else{var _0x52e9c3=squel[_0xe813('0x69')]();_0x52e9c3[_0xe813('0x88')]('('+_0x152f0c[_0xe813('0x7d')]()+')',_0xe813('0x9d'));_0x52e9c3[_0xe813('0x6d')](_0xe813('0x9e'),_0xe813('0x1c'));_0x152f0c[_0xe813('0x1a')](_0x1ac692[_0xe813('0x1a')]||_0x2e6548);_0x152f0c['offset'](_0x1ac692['offset']||0x0);return dbH['sequelize'][_0xe813('0x31')](_0x52e9c3['toString'](),{'type':dbH['sequelize']['QueryTypes'][_0xe813('0x80')]})[_0xe813('0x23')](function(_0x125cb0){if(!_0x125cb0[_0xe813('0x66')]){_0x4596b8=0x0;}else{_0x4596b8=_0x125cb0[0x0]['count']||0x0;}return dbH['sequelize'][_0xe813('0x31')](_0x152f0c[_0xe813('0x7d')](),{'type':dbH['sequelize'][_0xe813('0x7f')][_0xe813('0x80')]});})[_0xe813('0x23')](function(_0x1893b5){return{'rows':_0x1893b5||[],'count':_0x4596b8};});}});}exports[_0xe813('0x9f')]=function(_0x321f66,_0x532cec){return runReport(_0x321f66[_0xe813('0x4e')],_0x321f66[_0xe813('0x31')],_0x321f66[_0xe813('0x3e')])[_0xe813('0x23')](respondWithResult(_0x532cec,null))[_0xe813('0x42')](handleError(_0x532cec,null));};exports[_0xe813('0xa0')]=runReport;exports[_0xe813('0x31')]=function(_0x289475,_0x3eaf5f){var _0x27d442=0xa;var _0x175759=['join','left_join','right_join','cross_join'];var _0x33e41a={'SUM':_0xe813('0x53'),'COUNT':_0xe813('0x54'),'COUNT DISTINCT':_0xe813('0x55'),'MAX':_0xe813('0x81'),'MIN':_0xe813('0x56'),'AVG':_0xe813('0x82'),'GROUP_CONCAT':_0xe813('0x57'),'GROUP_CONCAT ASC':_0xe813('0x58'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0xad23a5={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xe813('0x5b'),'HOUR':_0xe813('0x5c'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xe813('0x5d')};var _0x505837=function(_0x842d9b){return!_[_0xe813('0x5e')]([_0xe813('0x5f'),'IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY'],_0x842d9b);};var _0x8456d5=function(_0x403974){if(!_0x403974||!_0x403974[_0xe813('0x62')][_0xe813('0x66')]){return'';}for(var _0x476644='(',_0x5e3232=0x0;_0x5e3232<_0x403974['rules'][_0xe813('0x66')];_0x5e3232+=0x1){_0x5e3232>0x0&&(_0x476644+='\x20'+_0x403974[_0xe813('0x85')]+'\x20');_0x476644+=_0x403974[_0xe813('0x62')][_0x5e3232][_0xe813('0x63')]?_0x8456d5(_0x403974['rules'][_0x5e3232][_0xe813('0x63')]):_0x403974['rules'][_0x5e3232][_0xe813('0x6d')]+'\x20'+_0x403974[_0xe813('0x62')][_0x5e3232][_0xe813('0x64')]+(_0x505837(_0x403974[_0xe813('0x62')][_0x5e3232]['condition'])?'\x20'+_0x403974[_0xe813('0x62')][_0x5e3232][_0xe813('0x65')]:'');}return _0x476644+')';};var _0x4a05cb={'where':{'id':_0x289475[_0xe813('0x4e')]['id']}},_0x33dce,_0x3cbe74,_0x17c48e,_0x120386,_0x231381;_0x4a05cb=_['merge']({},_0x4a05cb,_0x289475[_0xe813('0x3e')]);return db[_0xe813('0x2b')][_0xe813('0x44')](_0x4a05cb)[_0xe813('0x23')](function(_0x5a1442){if(_0x5a1442){_0x33dce=_0x5a1442;return _0x5a1442[_0xe813('0xa1')]();}return null;})['then'](function(_0x1134af){if(_0x1134af){if(!_0x1134af['length']){throw new db[(_0xe813('0x86'))]['ValidationErrorItem'](_0xe813('0x68'),0x193);}_0x3cbe74=_0x1134af;return db['AnalyticMetric'][_0xe813('0x40')]({'raw':!![]});}return null;})[_0xe813('0x23')](function(_0x1e0672){if(_0x1e0672){_0x17c48e=_[_0xe813('0x87')](_0x1e0672,'id');var _0x2c8db8;var _0x20e551=squel[_0xe813('0x69')]();_0x20e551['from'](_0x33dce[_0xe813('0x6a')]);for(var _0x5d274f=0x0;_0x5d274f<_0x3cbe74[_0xe813('0x66')];_0x5d274f+=0x1){_0x2c8db8=_0x3cbe74[_0x5d274f]['MetricId']?_0x17c48e[_0x3cbe74[_0x5d274f][_0xe813('0x6b')]][_0xe813('0x6c')]:_0x3cbe74[_0x5d274f][_0xe813('0x6d')];_0x2c8db8=_0x3cbe74[_0x5d274f][_0xe813('0x6e')]?_[_0xe813('0x70')](_0x33e41a[_0x3cbe74[_0x5d274f][_0xe813('0x6e')]],'%s',_0x2c8db8):_0x2c8db8;_0x2c8db8=_0x3cbe74[_0x5d274f][_0xe813('0x6f')]?_[_0xe813('0x70')](_0xad23a5[_0x3cbe74[_0x5d274f][_0xe813('0x6f')]],'%s',_0x2c8db8):_0x2c8db8;if(_0x3cbe74[_0x5d274f]['groupBy']){_0x20e551[_0xe813('0x63')](_0x2c8db8);}_0x3cbe74[_0x5d274f][_0xe813('0x72')]&&_0x20e551[_0xe813('0x73')](_0x2c8db8,_0x3cbe74[_0x5d274f]['orderBy']===_0xe813('0x89')?![]:!![]);_0x20e551[_0xe813('0x6d')](_0x2c8db8,_0x3cbe74[_0x5d274f]['alias']||_0x2c8db8);}if(_0x33dce['joins']){_0x33dce[_0xe813('0x75')]=JSON['parse'](_0x33dce[_0xe813('0x75')]);for(var _0x26d504=0x0;_0x26d504<_0x33dce[_0xe813('0x75')][_0xe813('0x66')];_0x26d504+=0x1){if(_0x33dce['joins'][_0x26d504][_0xe813('0x2e')]&&_[_0xe813('0x5e')](_0x175759,_0x33dce[_0xe813('0x75')][_0x26d504][_0xe813('0x2e')])&&_0x33dce['joins'][_0x26d504]['parentKey']&&_0x33dce[_0xe813('0x75')][_0x26d504][_0xe813('0x77')]&&_0x33dce['joins'][_0x26d504][_0xe813('0x78')]){_0x20e551[_0x33dce[_0xe813('0x75')][_0x26d504]['type']](_0x33dce['joins'][_0x26d504]['foreignTable'],null,util[_0xe813('0x6f')](_0xe813('0x79'),_0x33dce[_0xe813('0x6a')],_0x33dce[_0xe813('0x75')][_0x26d504][_0xe813('0x76')],_0x33dce[_0xe813('0x75')][_0x26d504][_0xe813('0x77')],_0x33dce['joins'][_0x26d504]['foreignKey']));}}}if(_0x33dce[_0xe813('0x7a')]){_0x33dce[_0xe813('0x7a')]=JSON['parse'](_0x33dce[_0xe813('0x7a')]);_0x20e551[_0xe813('0x3a')](_0x8456d5(_0x33dce[_0xe813('0x7a')][_0xe813('0x63')]));}_0x231381=_0x20e551[_0xe813('0x7c')]();_0x20e551[_0xe813('0x1a')](_0x27d442);_0x20e551[_0xe813('0x19')](0x0);logger[_0xe813('0xa2')](_0xe813('0xa3'),_0x20e551[_0xe813('0x7d')]());return dbH[_0xe813('0x7e')]['query'](_0x20e551['toString'](),{'type':dbH[_0xe813('0x7e')]['QueryTypes'][_0xe813('0x80')]});}})[_0xe813('0x23')](function(){return{'sql':_0x231381[_0xe813('0x7d')]()};})[_0xe813('0x23')](respondWithResult(_0x3eaf5f,null))[_0xe813('0x42')](handleError(_0x3eaf5f,null));}; \ No newline at end of file +var _0xdb00=['DESC','joins','parse','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','MAX(%s)','value','metric','groupBy','alias','output','web','fullPath','%s-%s.%s','randomstring','custom','startDate','endDate','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','savename','COUNT(*)','run','runReport','COUNT(DISTINCT\x20%s)','AVG(%s)','IS\x20EMPTY','operator','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','set','Content-Range','apply','reject','save','update','then','destroy','get','CustomReports','UserProfileResource','sendStatus','error','stack','name','send','index','map','AnalyticCustomReport','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','options','count','includeAll','include','rows','show','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','preview','join','left_join','right_join','cross_join','SUM(%s)','COUNT(%s)','MIN(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','rules','field','condition','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','findAll','keyBy','select','from','table','MetricId','replace','function','format','group','orderBy','order'];(function(_0x2529b7,_0x5f06c0){var _0x4fb9b6=function(_0x463214){while(--_0x463214){_0x2529b7['push'](_0x2529b7['shift']());}};_0x4fb9b6(++_0x5f06c0);}(_0xdb00,0xd4));var _0x0db0=function(_0x236912,_0x4167cd){_0x236912=_0x236912-0x0;var _0x582904=_0xdb00[_0x236912];return _0x582904;};'use strict';var emlformat=require(_0x0db0('0x0'));var rimraf=require(_0x0db0('0x1'));var zipdir=require(_0x0db0('0x2'));var jsonpatch=require(_0x0db0('0x3'));var rp=require(_0x0db0('0x4'));var moment=require(_0x0db0('0x5'));var BPromise=require(_0x0db0('0x6'));var Mustache=require(_0x0db0('0x7'));var util=require(_0x0db0('0x8'));var path=require(_0x0db0('0x9'));var sox=require(_0x0db0('0xa'));var csv=require(_0x0db0('0xb'));var ejs=require(_0x0db0('0xc'));var fs=require('fs');var fs_extra=require(_0x0db0('0xd'));var _=require(_0x0db0('0xe'));var squel=require(_0x0db0('0xf'));var crypto=require('crypto');var jsforce=require(_0x0db0('0x10'));var deskjs=require(_0x0db0('0x11'));var toCsv=require(_0x0db0('0xb'));var querystring=require(_0x0db0('0x12'));var Papa=require('papaparse');var Redis=require(_0x0db0('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x0db0('0x14'));var as=require(_0x0db0('0x15'));var hardwareService=require(_0x0db0('0x16'));var logger=require(_0x0db0('0x17'))(_0x0db0('0x18'));var utils=require(_0x0db0('0x19'));var config=require(_0x0db0('0x1a'));var licenseUtil=require(_0x0db0('0x1b'));var db=require('../../mysqldb')['db'];var dbH=require(_0x0db0('0x1c'))['dbH'];function respondWithStatusCode(_0x1a8b5c,_0x28c7d6){_0x28c7d6=_0x28c7d6||0xcc;return function(_0x1ea0fb){if(_0x1ea0fb){return _0x1a8b5c['sendStatus'](_0x28c7d6);}return _0x1a8b5c[_0x0db0('0x1d')](_0x28c7d6)[_0x0db0('0x1e')]();};}function respondWithResult(_0x90c02e,_0x2e39f7){_0x2e39f7=_0x2e39f7||0xc8;return function(_0xa1d3f9){if(_0xa1d3f9){return _0x90c02e['status'](_0x2e39f7)[_0x0db0('0x1f')](_0xa1d3f9);}};}function respondWithFilteredResult(_0x27e15d,_0x158a83){return function(_0x7ee78b){if(_0x7ee78b){var _0x549512=typeof _0x158a83[_0x0db0('0x20')]==='undefined'&&typeof _0x158a83[_0x0db0('0x21')]===_0x0db0('0x22');var _0xc138a8=_0x7ee78b['count'];var _0x33c181=_0x549512?0x0:_0x158a83[_0x0db0('0x20')];var _0x177c9f=_0x549512?_0x7ee78b['count']:_0x158a83[_0x0db0('0x20')]+_0x158a83['limit'];var _0x48db9c;if(_0x177c9f>=_0xc138a8){_0x177c9f=_0xc138a8;_0x48db9c=0xc8;}else{_0x48db9c=0xce;}_0x27e15d[_0x0db0('0x1d')](_0x48db9c);return _0x27e15d[_0x0db0('0x23')](_0x0db0('0x24'),_0x33c181+'-'+_0x177c9f+'/'+_0xc138a8)[_0x0db0('0x1f')](_0x7ee78b);}return null;};}function patchUpdates(_0x54bd57){return function(_0x7f85b3){try{jsonpatch[_0x0db0('0x25')](_0x7f85b3,_0x54bd57,!![]);}catch(_0x4ab686){return BPromise[_0x0db0('0x26')](_0x4ab686);}return _0x7f85b3[_0x0db0('0x27')]();};}function saveUpdates(_0x5d731d,_0x468d37){return function(_0x1a4d3e){if(_0x1a4d3e){return _0x1a4d3e[_0x0db0('0x28')](_0x5d731d)[_0x0db0('0x29')](function(_0x2dfc15){return _0x2dfc15;});}return null;};}function removeEntity(_0x53aa31,_0x25dfbb){return function(_0x5bf1fe){if(_0x5bf1fe){return _0x5bf1fe[_0x0db0('0x2a')]()[_0x0db0('0x29')](function(){var _0x385ebf=_0x5bf1fe[_0x0db0('0x2b')]({'plain':!![]});var _0x335c81=_0x0db0('0x2c');return db[_0x0db0('0x2d')][_0x0db0('0x2a')]({'where':{'type':_0x335c81,'resourceId':_0x385ebf['id']}})[_0x0db0('0x29')](function(){return _0x5bf1fe;});})[_0x0db0('0x29')](function(){_0x53aa31[_0x0db0('0x1d')](0xcc)[_0x0db0('0x1e')]();});}};}function handleEntityNotFound(_0x1f90e2,_0x5ef027){return function(_0x13ef0b){if(!_0x13ef0b){_0x1f90e2[_0x0db0('0x2e')](0x194);}return _0x13ef0b;};}function handleError(_0x36aeb0,_0x37b84f){_0x37b84f=_0x37b84f||0x1f4;return function(_0x415997){logger[_0x0db0('0x2f')](_0x415997[_0x0db0('0x30')]);if(_0x415997['name']){delete _0x415997[_0x0db0('0x31')];}_0x36aeb0[_0x0db0('0x1d')](_0x37b84f)[_0x0db0('0x32')](_0x415997);};}exports[_0x0db0('0x33')]=function(_0x29c1a8,_0x5496a0){var _0x385a8e={},_0x469e1a={},_0xa58f85={'count':0x0,'rows':[]};var _0x3e8452=_[_0x0db0('0x34')](db[_0x0db0('0x35')][_0x0db0('0x36')],function(_0x183832){return{'name':_0x183832[_0x0db0('0x37')],'type':_0x183832['type']['key']};});_0x469e1a[_0x0db0('0x38')]=_[_0x0db0('0x34')](_0x3e8452,_0x0db0('0x31'));_0x469e1a[_0x0db0('0x39')]=_[_0x0db0('0x3a')](_0x29c1a8[_0x0db0('0x39')]);_0x469e1a[_0x0db0('0x3b')]=_[_0x0db0('0x3c')](_0x469e1a[_0x0db0('0x38')],_0x469e1a[_0x0db0('0x39')]);_0x385a8e[_0x0db0('0x3d')]=_['intersection'](_0x469e1a[_0x0db0('0x38')],qs[_0x0db0('0x3e')](_0x29c1a8[_0x0db0('0x39')][_0x0db0('0x3e')]));_0x385a8e[_0x0db0('0x3d')]=_0x385a8e[_0x0db0('0x3d')][_0x0db0('0x3f')]?_0x385a8e[_0x0db0('0x3d')]:_0x469e1a['model'];if(!_0x29c1a8['query'][_0x0db0('0x40')](_0x0db0('0x41'))){_0x385a8e['limit']=qs['limit'](_0x29c1a8['query'][_0x0db0('0x21')]);_0x385a8e['offset']=qs[_0x0db0('0x20')](_0x29c1a8['query'][_0x0db0('0x20')]);}_0x385a8e['order']=qs[_0x0db0('0x42')](_0x29c1a8[_0x0db0('0x39')]['sort']);_0x385a8e[_0x0db0('0x43')]=qs[_0x0db0('0x3b')](_[_0x0db0('0x44')](_0x29c1a8['query'],_0x469e1a['filters']),_0x3e8452);if(_0x29c1a8[_0x0db0('0x39')][_0x0db0('0x45')]){_0x385a8e['where']=_[_0x0db0('0x46')](_0x385a8e[_0x0db0('0x43')],{'$or':_[_0x0db0('0x34')](_0x3e8452,function(_0x2675e){if(_0x2675e[_0x0db0('0x47')]!=='VIRTUAL'){var _0x19f66d={};_0x19f66d[_0x2675e['name']]={'$like':'%'+_0x29c1a8[_0x0db0('0x39')][_0x0db0('0x45')]+'%'};return _0x19f66d;}})});}_0x385a8e=_[_0x0db0('0x46')]({},_0x385a8e,_0x29c1a8[_0x0db0('0x48')]);var _0x455431={'where':_0x385a8e[_0x0db0('0x43')]};return db[_0x0db0('0x35')][_0x0db0('0x49')](_0x455431)[_0x0db0('0x29')](function(_0xe12f9c){_0xa58f85[_0x0db0('0x49')]=_0xe12f9c;if(_0x29c1a8['query'][_0x0db0('0x4a')]){_0x385a8e[_0x0db0('0x4b')]=[{'all':!![]}];}return db[_0x0db0('0x35')]['findAll'](_0x385a8e);})[_0x0db0('0x29')](function(_0xcbbd39){_0xa58f85[_0x0db0('0x4c')]=_0xcbbd39;return _0xa58f85;})[_0x0db0('0x29')](respondWithFilteredResult(_0x5496a0,_0x385a8e))['catch'](handleError(_0x5496a0,null));};exports[_0x0db0('0x4d')]=function(_0x3c6e70,_0x4ebda8){var _0x3809ab={'raw':![],'where':{'id':_0x3c6e70['params']['id']}},_0xea06fb={};_0xea06fb[_0x0db0('0x38')]=_[_0x0db0('0x3a')](db[_0x0db0('0x35')][_0x0db0('0x36')]);_0xea06fb[_0x0db0('0x39')]=_['keys'](_0x3c6e70[_0x0db0('0x39')]);_0xea06fb['filters']=_[_0x0db0('0x3c')](_0xea06fb[_0x0db0('0x38')],_0xea06fb['query']);_0x3809ab[_0x0db0('0x3d')]=_[_0x0db0('0x3c')](_0xea06fb[_0x0db0('0x38')],qs[_0x0db0('0x3e')](_0x3c6e70[_0x0db0('0x39')][_0x0db0('0x3e')]));_0x3809ab[_0x0db0('0x3d')]=_0x3809ab[_0x0db0('0x3d')][_0x0db0('0x3f')]?_0x3809ab['attributes']:_0xea06fb[_0x0db0('0x38')];if(_0x3c6e70['query']['includeAll']){_0x3809ab[_0x0db0('0x4b')]=[{'all':!![]}];}_0x3809ab=_[_0x0db0('0x46')]({},_0x3809ab,_0x3c6e70[_0x0db0('0x48')]);return db[_0x0db0('0x35')][_0x0db0('0x4e')](_0x3809ab)[_0x0db0('0x29')](handleEntityNotFound(_0x4ebda8,null))['then'](respondWithResult(_0x4ebda8,null))[_0x0db0('0x4f')](handleError(_0x4ebda8,null));};exports['create']=function(_0x4b08d1,_0x20057b){return db[_0x0db0('0x35')][_0x0db0('0x50')](_0x4b08d1[_0x0db0('0x51')],{})[_0x0db0('0x29')](function(_0xb72bbb){var _0xbb98b0=_0x4b08d1[_0x0db0('0x52')][_0x0db0('0x2b')]({'plain':!![]});if(!_0xbb98b0)throw new Error(_0x0db0('0x53'));if(_0xbb98b0[_0x0db0('0x54')]===_0x0db0('0x52')){var _0x2cdea7=_0xb72bbb['get']({'plain':!![]});var _0x1a6a38=_0x0db0('0x55');return db[_0x0db0('0x56')][_0x0db0('0x4e')]({'where':{'name':_0x1a6a38,'userProfileId':_0xbb98b0['userProfileId']},'raw':!![]})[_0x0db0('0x29')](function(_0x38e05c){if(_0x38e05c&&_0x38e05c[_0x0db0('0x57')]===0x0){return db[_0x0db0('0x2d')][_0x0db0('0x50')]({'name':_0x2cdea7[_0x0db0('0x31')],'resourceId':_0x2cdea7['id'],'type':_0x0db0('0x2c'),'sectionId':_0x38e05c['id']},{})[_0x0db0('0x29')](function(){return _0xb72bbb;});}else{return _0xb72bbb;}})[_0x0db0('0x4f')](function(_0x4da447){logger['error'](_0x0db0('0x58'),_0x4da447);throw _0x4da447;});}return _0xb72bbb;})[_0x0db0('0x29')](respondWithResult(_0x20057b,0xc9))[_0x0db0('0x4f')](handleError(_0x20057b,null));};exports[_0x0db0('0x28')]=function(_0x275f91,_0x50cdf0){if(_0x275f91[_0x0db0('0x51')]['id']){delete _0x275f91[_0x0db0('0x51')]['id'];}return db[_0x0db0('0x35')][_0x0db0('0x4e')]({'where':{'id':_0x275f91[_0x0db0('0x59')]['id']}})[_0x0db0('0x29')](handleEntityNotFound(_0x50cdf0,null))[_0x0db0('0x29')](saveUpdates(_0x275f91[_0x0db0('0x51')],null))['then'](respondWithResult(_0x50cdf0,null))[_0x0db0('0x4f')](handleError(_0x50cdf0,null));};exports[_0x0db0('0x2a')]=function(_0x3c72ca,_0x25e5ae){return db[_0x0db0('0x35')][_0x0db0('0x4e')]({'where':{'id':_0x3c72ca[_0x0db0('0x59')]['id']}})[_0x0db0('0x29')](handleEntityNotFound(_0x25e5ae,null))[_0x0db0('0x29')](removeEntity(_0x25e5ae,null))[_0x0db0('0x4f')](handleError(_0x25e5ae,null));};exports[_0x0db0('0x5a')]=function(_0x4ed715,_0x15daf2){var _0x1349e2=0xa;var _0x38b05b=[_0x0db0('0x5b'),_0x0db0('0x5c'),_0x0db0('0x5d'),_0x0db0('0x5e')];var _0x3005c5={'SUM':_0x0db0('0x5f'),'COUNT':_0x0db0('0x60'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0x0db0('0x61'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x0db0('0x62'),'GROUP_CONCAT ASC':_0x0db0('0x63'),'GROUP_CONCAT DESC':_0x0db0('0x64')};var _0x13436b={'SEC_TO_TIME':_0x0db0('0x65'),'DATE':_0x0db0('0x66'),'HOUR':_0x0db0('0x67'),'ROUND':_0x0db0('0x68'),'UNIX_TIMESTAMP':_0x0db0('0x69')};var _0x45a11c=function(_0x56605d){return!_[_0x0db0('0x6a')]([_0x0db0('0x6b'),_0x0db0('0x6c'),'IS\x20EMPTY',_0x0db0('0x6d')],_0x56605d);};var _0x434c0a=function(_0x313312){if(!_0x313312||!_0x313312[_0x0db0('0x6e')][_0x0db0('0x3f')]){return'';}for(var _0x5e3dcf='(',_0x4c567e=0x0;_0x4c567e<_0x313312[_0x0db0('0x6e')][_0x0db0('0x3f')];_0x4c567e+=0x1){_0x4c567e>0x0&&(_0x5e3dcf+='\x20'+_0x313312['operator']+'\x20');_0x5e3dcf+=_0x313312[_0x0db0('0x6e')][_0x4c567e]['group']?_0x434c0a(_0x313312['rules'][_0x4c567e]['group']):_0x313312[_0x0db0('0x6e')][_0x4c567e][_0x0db0('0x6f')]+'\x20'+_0x313312['rules'][_0x4c567e][_0x0db0('0x70')]+(_0x45a11c(_0x313312['rules'][_0x4c567e][_0x0db0('0x70')])?'\x20'+_0x313312[_0x0db0('0x6e')][_0x4c567e]['value']:'');}return _0x5e3dcf+')';};var _0x385599={'where':{'id':_0x4ed715[_0x0db0('0x59')]['id']}},_0x1f2171,_0x36b072,_0x3bd5bc,_0x581055,_0x195327;_0x385599=_[_0x0db0('0x46')]({},_0x385599,_0x4ed715[_0x0db0('0x48')]);return db[_0x0db0('0x35')][_0x0db0('0x4e')](_0x385599)[_0x0db0('0x29')](function(_0x59030e){if(_0x59030e){_0x1f2171=_0x59030e;return _0x59030e[_0x0db0('0x71')]();}return null;})['then'](function(_0x2b2243){if(_0x2b2243){if(!_0x2b2243[_0x0db0('0x3f')]){throw new db[(_0x0db0('0x72'))][(_0x0db0('0x73'))](_0x0db0('0x74'),0x193);}_0x36b072=_0x2b2243;return db[_0x0db0('0x75')][_0x0db0('0x76')]({'raw':!![]});}return null;})['then'](function(_0xfd7327){if(_0xfd7327){_0x3bd5bc=_[_0x0db0('0x77')](_0xfd7327,'id');var _0x4d7672;var _0x8b15d3=squel[_0x0db0('0x78')]();_0x8b15d3[_0x0db0('0x79')](_0x1f2171[_0x0db0('0x7a')]);for(var _0x3c72a8=0x0;_0x3c72a8<_0x36b072['length'];_0x3c72a8+=0x1){_0x4d7672=_0x36b072[_0x3c72a8][_0x0db0('0x7b')]?_0x3bd5bc[_0x36b072[_0x3c72a8][_0x0db0('0x7b')]]['metric']:_0x36b072[_0x3c72a8][_0x0db0('0x6f')];_0x4d7672=_0x36b072[_0x3c72a8]['function']?_[_0x0db0('0x7c')](_0x3005c5[_0x36b072[_0x3c72a8][_0x0db0('0x7d')]],'%s',_0x4d7672):_0x4d7672;_0x4d7672=_0x36b072[_0x3c72a8][_0x0db0('0x7e')]?_[_0x0db0('0x7c')](_0x13436b[_0x36b072[_0x3c72a8][_0x0db0('0x7e')]],'%s',_0x4d7672):_0x4d7672;if(_0x36b072[_0x3c72a8]['groupBy']){_0x8b15d3[_0x0db0('0x7f')](_0x4d7672);}_0x36b072[_0x3c72a8][_0x0db0('0x80')]&&_0x8b15d3[_0x0db0('0x81')](_0x4d7672,_0x36b072[_0x3c72a8][_0x0db0('0x80')]===_0x0db0('0x82')?![]:!![]);_0x8b15d3[_0x0db0('0x6f')](_0x4d7672,_0x36b072[_0x3c72a8]['alias']||_0x4d7672);}if(_0x1f2171[_0x0db0('0x83')]){_0x1f2171['joins']=JSON[_0x0db0('0x84')](_0x1f2171['joins']);for(var _0x4319a0=0x0;_0x4319a0<_0x1f2171[_0x0db0('0x83')][_0x0db0('0x3f')];_0x4319a0+=0x1){if(_0x1f2171['joins'][_0x4319a0]['type']&&_[_0x0db0('0x6a')](_0x38b05b,_0x1f2171['joins'][_0x4319a0][_0x0db0('0x47')])&&_0x1f2171[_0x0db0('0x83')][_0x4319a0][_0x0db0('0x85')]&&_0x1f2171[_0x0db0('0x83')][_0x4319a0][_0x0db0('0x86')]&&_0x1f2171[_0x0db0('0x83')][_0x4319a0][_0x0db0('0x87')]){_0x8b15d3[_0x1f2171[_0x0db0('0x83')][_0x4319a0]['type']](_0x1f2171[_0x0db0('0x83')][_0x4319a0][_0x0db0('0x86')],null,util[_0x0db0('0x7e')](_0x0db0('0x88'),_0x1f2171['table'],_0x1f2171[_0x0db0('0x83')][_0x4319a0][_0x0db0('0x85')],_0x1f2171[_0x0db0('0x83')][_0x4319a0][_0x0db0('0x86')],_0x1f2171[_0x0db0('0x83')][_0x4319a0][_0x0db0('0x87')]));}}}if(_0x1f2171['conditions']){_0x1f2171[_0x0db0('0x89')]=JSON[_0x0db0('0x84')](_0x1f2171[_0x0db0('0x89')]);_0x8b15d3[_0x0db0('0x43')](_0x434c0a(_0x1f2171[_0x0db0('0x89')]['group']));}_0x195327=_0x8b15d3[_0x0db0('0x8a')]();_0x8b15d3[_0x0db0('0x21')](_0x1349e2);_0x8b15d3[_0x0db0('0x20')](0x0);logger[_0x0db0('0x8b')](_0x0db0('0x8c'),_0x8b15d3[_0x0db0('0x8d')]());return dbH[_0x0db0('0x8e')][_0x0db0('0x39')](_0x8b15d3[_0x0db0('0x8d')](),{'type':dbH[_0x0db0('0x8e')][_0x0db0('0x8f')][_0x0db0('0x90')]});}})['then'](respondWithResult(_0x15daf2,null))[_0x0db0('0x4f')](handleError(_0x15daf2,null));};function runReport(_0x24b717,_0x5e66d8,_0x3c86c4){var _0x453e00=_0x5e66d8[_0x0db0('0x31')];var _0x44ce19=0xa;var _0x388f02=[_0x0db0('0x5b'),_0x0db0('0x5c'),_0x0db0('0x5d'),_0x0db0('0x5e')];var _0x4ba499={'SUM':_0x0db0('0x5f'),'COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x0db0('0x91'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x0db0('0x63'),'GROUP_CONCAT DESC':_0x0db0('0x64')};var _0x139552={'SEC_TO_TIME':_0x0db0('0x65'),'DATE':'DATE(%s)','HOUR':_0x0db0('0x67'),'ROUND':_0x0db0('0x68'),'UNIX_TIMESTAMP':_0x0db0('0x69')};var _0x470ac0=function(_0x4c224d){return!_[_0x0db0('0x6a')]([_0x0db0('0x6b'),'IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY'],_0x4c224d);};var _0x2c8ee9=function(_0x81a220){if(!_0x81a220||!_0x81a220['rules'][_0x0db0('0x3f')]){return'';}for(var _0x477be4='(',_0x58724e=0x0;_0x58724e<_0x81a220['rules'][_0x0db0('0x3f')];_0x58724e+=0x1){_0x58724e>0x0&&(_0x477be4+='\x20'+_0x81a220['operator']+'\x20');_0x477be4+=_0x81a220[_0x0db0('0x6e')][_0x58724e][_0x0db0('0x7f')]?_0x2c8ee9(_0x81a220['rules'][_0x58724e][_0x0db0('0x7f')]):_0x81a220['rules'][_0x58724e][_0x0db0('0x6f')]+'\x20'+_0x81a220[_0x0db0('0x6e')][_0x58724e][_0x0db0('0x70')]+(_0x470ac0(_0x81a220[_0x0db0('0x6e')][_0x58724e][_0x0db0('0x70')])?'\x20'+_0x81a220['rules'][_0x58724e][_0x0db0('0x92')]:'');}return _0x477be4+')';};var _0x3c78a1={'where':{'id':_0x24b717['id']}},_0x31d4fe,_0x5b13cd,_0x463cbe,_0x2486b9,_0x1ca448;_0x3c78a1=_[_0x0db0('0x46')]({},_0x3c78a1,_0x3c86c4);return db[_0x0db0('0x35')][_0x0db0('0x4e')](_0x3c78a1)[_0x0db0('0x29')](function(_0x27bdee){if(_0x27bdee){_0x31d4fe=_0x27bdee;return _0x27bdee[_0x0db0('0x71')]();}return null;})[_0x0db0('0x29')](function(_0x230654){if(_0x230654){if(!_0x230654[_0x0db0('0x3f')]){throw new db[(_0x0db0('0x72'))][(_0x0db0('0x73'))](_0x0db0('0x74'),0x193);}_0x5b13cd=_0x230654;return db['AnalyticMetric'][_0x0db0('0x76')]({'raw':!![]});}return null;})[_0x0db0('0x29')](function(_0x3188e2){if(_0x3188e2){_0x463cbe=_['keyBy'](_0x3188e2,'id');var _0x419cd6;var _0x3f8c57=squel[_0x0db0('0x78')]();_0x3f8c57[_0x0db0('0x79')](_0x31d4fe[_0x0db0('0x7a')]);for(var _0x5c6391=0x0;_0x5c6391<_0x5b13cd['length'];_0x5c6391+=0x1){_0x419cd6=_0x5b13cd[_0x5c6391][_0x0db0('0x7b')]?_0x463cbe[_0x5b13cd[_0x5c6391][_0x0db0('0x7b')]][_0x0db0('0x93')]:_0x5b13cd[_0x5c6391][_0x0db0('0x6f')];_0x419cd6=_0x5b13cd[_0x5c6391][_0x0db0('0x7d')]?_[_0x0db0('0x7c')](_0x4ba499[_0x5b13cd[_0x5c6391]['function']],'%s',_0x419cd6):_0x419cd6;_0x419cd6=_0x5b13cd[_0x5c6391][_0x0db0('0x7e')]?_[_0x0db0('0x7c')](_0x139552[_0x5b13cd[_0x5c6391]['format']],'%s',_0x419cd6):_0x419cd6;if(_0x5b13cd[_0x5c6391][_0x0db0('0x94')]){_0x3f8c57[_0x0db0('0x7f')](_0x419cd6);}_0x5b13cd[_0x5c6391][_0x0db0('0x80')]&&_0x3f8c57[_0x0db0('0x81')](_0x419cd6,_0x5b13cd[_0x5c6391][_0x0db0('0x80')]===_0x0db0('0x82')?![]:!![]);_0x3f8c57[_0x0db0('0x6f')](_0x419cd6,_0x5b13cd[_0x5c6391][_0x0db0('0x95')]||_0x419cd6);}if(_0x31d4fe[_0x0db0('0x83')]){_0x31d4fe['joins']=JSON['parse'](_0x31d4fe['joins']);for(var _0x44d16f=0x0;_0x44d16f<_0x31d4fe[_0x0db0('0x83')][_0x0db0('0x3f')];_0x44d16f+=0x1){if(_0x31d4fe[_0x0db0('0x83')][_0x44d16f][_0x0db0('0x47')]&&_[_0x0db0('0x6a')](_0x388f02,_0x31d4fe[_0x0db0('0x83')][_0x44d16f]['type'])&&_0x31d4fe['joins'][_0x44d16f][_0x0db0('0x85')]&&_0x31d4fe['joins'][_0x44d16f][_0x0db0('0x86')]&&_0x31d4fe[_0x0db0('0x83')][_0x44d16f][_0x0db0('0x87')]){_0x3f8c57[_0x31d4fe[_0x0db0('0x83')][_0x44d16f][_0x0db0('0x47')]](_0x31d4fe[_0x0db0('0x83')][_0x44d16f][_0x0db0('0x86')],null,util[_0x0db0('0x7e')](_0x0db0('0x88'),_0x31d4fe['table'],_0x31d4fe[_0x0db0('0x83')][_0x44d16f][_0x0db0('0x85')],_0x31d4fe['joins'][_0x44d16f][_0x0db0('0x86')],_0x31d4fe[_0x0db0('0x83')][_0x44d16f][_0x0db0('0x87')]));}}}if(_0x31d4fe[_0x0db0('0x89')]){_0x31d4fe[_0x0db0('0x89')]=JSON[_0x0db0('0x84')](_0x31d4fe[_0x0db0('0x89')]);_0x3f8c57[_0x0db0('0x43')](_0x2c8ee9(_0x31d4fe[_0x0db0('0x89')]['group']));}_0x1ca448=_0x3f8c57[_0x0db0('0x8a')]();_0x3f8c57[_0x0db0('0x21')](_0x44ce19);_0x3f8c57[_0x0db0('0x20')](0x0);return;}})[_0x0db0('0x29')](function(){if(_0x5e66d8[_0x0db0('0x96')]===_0x0db0('0x97')){return null;}var _0x4163bf=_[_0x0db0('0x46')](_0x5e66d8,{'name':_0x5e66d8[_0x0db0('0x98')]||_0x5e66d8[_0x0db0('0x31')]||_0x31d4fe[_0x0db0('0x31')],'basename':_0x453e00,'savename':util[_0x0db0('0x7e')](_0x0db0('0x99'),_0x5e66d8[_0x0db0('0x31')]||_0x31d4fe[_0x0db0('0x31')],require(_0x0db0('0x9a'))['generate'](0x4),_0x5e66d8[_0x0db0('0x96')]||'csv'),'reportId':_0x31d4fe['id'],'reportType':_0x0db0('0x9b')});return db['AnalyticExtractedReport']['create'](_0x4163bf,{'raw':!![]});})['then'](function(_0x1f4fd7){if(_0x31d4fe[_0x0db0('0x7a')]==='cdr'){_0x1ca448[_0x0db0('0x43')](_0x31d4fe[_0x0db0('0x7a')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x5e66d8[_0x0db0('0x9c')],_0x5e66d8[_0x0db0('0x9d')]);}else{_0x1ca448[_0x0db0('0x43')](_0x31d4fe['table']+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x5e66d8[_0x0db0('0x9c')],_0x5e66d8[_0x0db0('0x9d')]);}if(_0x1f4fd7){logger['info'](_0x0db0('0x9e'),_0x1ca448[_0x0db0('0x8d')]());require(_0x0db0('0x9f'))[_0x0db0('0xa0')](path['join'](__dirname,_0x0db0('0xa1'),_0x1f4fd7[_0x0db0('0x96')]),[_0x1f4fd7['id'],_0x1ca448[_0x0db0('0x8d')](),path[_0x0db0('0x5b')](__dirname,_0x0db0('0xa2'),_0x1f4fd7[_0x0db0('0xa3')]),_0x453e00]);return _0x1f4fd7;}else{var _0x5175bd=squel[_0x0db0('0x78')]();_0x5175bd['from']('('+_0x1ca448[_0x0db0('0x8d')]()+')','countTable');_0x5175bd['field'](_0x0db0('0xa4'),_0x0db0('0x49'));_0x1ca448['limit'](_0x5e66d8[_0x0db0('0x21')]||_0x44ce19);_0x1ca448[_0x0db0('0x20')](_0x5e66d8[_0x0db0('0x20')]||0x0);return dbH[_0x0db0('0x8e')][_0x0db0('0x39')](_0x5175bd['toString'](),{'type':dbH[_0x0db0('0x8e')][_0x0db0('0x8f')][_0x0db0('0x90')]})[_0x0db0('0x29')](function(_0x3ce224){if(!_0x3ce224[_0x0db0('0x3f')]){_0x2486b9=0x0;}else{_0x2486b9=_0x3ce224[0x0][_0x0db0('0x49')]||0x0;}return dbH['sequelize'][_0x0db0('0x39')](_0x1ca448['toString'](),{'type':dbH[_0x0db0('0x8e')][_0x0db0('0x8f')][_0x0db0('0x90')]});})[_0x0db0('0x29')](function(_0x122200){return{'rows':_0x122200||[],'count':_0x2486b9};});}});}exports[_0x0db0('0xa5')]=function(_0xeddd45,_0x9b0e70){return runReport(_0xeddd45['params'],_0xeddd45[_0x0db0('0x39')],_0xeddd45[_0x0db0('0x48')])[_0x0db0('0x29')](respondWithResult(_0x9b0e70,null))[_0x0db0('0x4f')](handleError(_0x9b0e70,null));};exports[_0x0db0('0xa6')]=runReport;exports['query']=function(_0x110030,_0x46b893){var _0x32dd98=0xa;var _0x16f24a=['join',_0x0db0('0x5c'),_0x0db0('0x5d'),_0x0db0('0x5e')];var _0x194557={'SUM':'SUM(%s)','COUNT':_0x0db0('0x60'),'COUNT DISTINCT':_0x0db0('0xa7'),'MAX':_0x0db0('0x91'),'MIN':_0x0db0('0x61'),'AVG':_0x0db0('0xa8'),'GROUP_CONCAT':_0x0db0('0x62'),'GROUP_CONCAT ASC':_0x0db0('0x63'),'GROUP_CONCAT DESC':_0x0db0('0x64')};var _0x130d01={'SEC_TO_TIME':_0x0db0('0x65'),'DATE':_0x0db0('0x66'),'HOUR':_0x0db0('0x67'),'ROUND':_0x0db0('0x68'),'UNIX_TIMESTAMP':_0x0db0('0x69')};var _0x2a9937=function(_0x808ae1){return!_[_0x0db0('0x6a')](['IS\x20NULL',_0x0db0('0x6c'),_0x0db0('0xa9'),_0x0db0('0x6d')],_0x808ae1);};var _0x4fab94=function(_0x20b764){if(!_0x20b764||!_0x20b764['rules']['length']){return'';}for(var _0x470c4d='(',_0x2f22c9=0x0;_0x2f22c9<_0x20b764[_0x0db0('0x6e')][_0x0db0('0x3f')];_0x2f22c9+=0x1){_0x2f22c9>0x0&&(_0x470c4d+='\x20'+_0x20b764[_0x0db0('0xaa')]+'\x20');_0x470c4d+=_0x20b764[_0x0db0('0x6e')][_0x2f22c9][_0x0db0('0x7f')]?_0x4fab94(_0x20b764[_0x0db0('0x6e')][_0x2f22c9][_0x0db0('0x7f')]):_0x20b764['rules'][_0x2f22c9][_0x0db0('0x6f')]+'\x20'+_0x20b764[_0x0db0('0x6e')][_0x2f22c9]['condition']+(_0x2a9937(_0x20b764[_0x0db0('0x6e')][_0x2f22c9]['condition'])?'\x20'+_0x20b764[_0x0db0('0x6e')][_0x2f22c9]['value']:'');}return _0x470c4d+')';};var _0x425d6d={'where':{'id':_0x110030[_0x0db0('0x59')]['id']}},_0x492066,_0x2994b8,_0x1facf7,_0x354814,_0x97873;_0x425d6d=_['merge']({},_0x425d6d,_0x110030[_0x0db0('0x48')]);return db[_0x0db0('0x35')][_0x0db0('0x4e')](_0x425d6d)['then'](function(_0x5a6d0f){if(_0x5a6d0f){_0x492066=_0x5a6d0f;return _0x5a6d0f[_0x0db0('0x71')]();}return null;})[_0x0db0('0x29')](function(_0xba87b9){if(_0xba87b9){if(!_0xba87b9[_0x0db0('0x3f')]){throw new db[(_0x0db0('0x72'))][(_0x0db0('0x73'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x2994b8=_0xba87b9;return db['AnalyticMetric'][_0x0db0('0x76')]({'raw':!![]});}return null;})['then'](function(_0x4b5b2a){if(_0x4b5b2a){_0x1facf7=_[_0x0db0('0x77')](_0x4b5b2a,'id');var _0x3a7776;var _0x4dff8f=squel[_0x0db0('0x78')]();_0x4dff8f['from'](_0x492066[_0x0db0('0x7a')]);for(var _0x3041c3=0x0;_0x3041c3<_0x2994b8[_0x0db0('0x3f')];_0x3041c3+=0x1){_0x3a7776=_0x2994b8[_0x3041c3][_0x0db0('0x7b')]?_0x1facf7[_0x2994b8[_0x3041c3][_0x0db0('0x7b')]][_0x0db0('0x93')]:_0x2994b8[_0x3041c3][_0x0db0('0x6f')];_0x3a7776=_0x2994b8[_0x3041c3][_0x0db0('0x7d')]?_['replace'](_0x194557[_0x2994b8[_0x3041c3][_0x0db0('0x7d')]],'%s',_0x3a7776):_0x3a7776;_0x3a7776=_0x2994b8[_0x3041c3][_0x0db0('0x7e')]?_[_0x0db0('0x7c')](_0x130d01[_0x2994b8[_0x3041c3][_0x0db0('0x7e')]],'%s',_0x3a7776):_0x3a7776;if(_0x2994b8[_0x3041c3][_0x0db0('0x94')]){_0x4dff8f[_0x0db0('0x7f')](_0x3a7776);}_0x2994b8[_0x3041c3][_0x0db0('0x80')]&&_0x4dff8f[_0x0db0('0x81')](_0x3a7776,_0x2994b8[_0x3041c3][_0x0db0('0x80')]==='DESC'?![]:!![]);_0x4dff8f[_0x0db0('0x6f')](_0x3a7776,_0x2994b8[_0x3041c3][_0x0db0('0x95')]||_0x3a7776);}if(_0x492066[_0x0db0('0x83')]){_0x492066[_0x0db0('0x83')]=JSON[_0x0db0('0x84')](_0x492066[_0x0db0('0x83')]);for(var _0x4828b8=0x0;_0x4828b8<_0x492066[_0x0db0('0x83')]['length'];_0x4828b8+=0x1){if(_0x492066[_0x0db0('0x83')][_0x4828b8][_0x0db0('0x47')]&&_['includes'](_0x16f24a,_0x492066[_0x0db0('0x83')][_0x4828b8]['type'])&&_0x492066['joins'][_0x4828b8][_0x0db0('0x85')]&&_0x492066[_0x0db0('0x83')][_0x4828b8][_0x0db0('0x86')]&&_0x492066[_0x0db0('0x83')][_0x4828b8]['foreignKey']){_0x4dff8f[_0x492066[_0x0db0('0x83')][_0x4828b8][_0x0db0('0x47')]](_0x492066[_0x0db0('0x83')][_0x4828b8][_0x0db0('0x86')],null,util[_0x0db0('0x7e')](_0x0db0('0x88'),_0x492066[_0x0db0('0x7a')],_0x492066[_0x0db0('0x83')][_0x4828b8]['parentKey'],_0x492066[_0x0db0('0x83')][_0x4828b8]['foreignTable'],_0x492066[_0x0db0('0x83')][_0x4828b8][_0x0db0('0x87')]));}}}if(_0x492066[_0x0db0('0x89')]){_0x492066['conditions']=JSON['parse'](_0x492066[_0x0db0('0x89')]);_0x4dff8f['where'](_0x4fab94(_0x492066[_0x0db0('0x89')][_0x0db0('0x7f')]));}_0x97873=_0x4dff8f['clone']();_0x4dff8f[_0x0db0('0x21')](_0x32dd98);_0x4dff8f[_0x0db0('0x20')](0x0);logger['debug'](_0x0db0('0x8c'),_0x4dff8f[_0x0db0('0x8d')]());return dbH[_0x0db0('0x8e')]['query'](_0x4dff8f[_0x0db0('0x8d')](),{'type':dbH[_0x0db0('0x8e')]['QueryTypes'][_0x0db0('0x90')]});}})[_0x0db0('0x29')](function(){return{'sql':_0x97873[_0x0db0('0x8d')]()};})[_0x0db0('0x29')](respondWithResult(_0x46b893,null))[_0x0db0('0x4f')](handleError(_0x46b893,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index 8412cb4..8161919 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 _0xf074=['moment','rimraf','./analyticCustomReport.attributes','exports','define','AnalyticCustomReport','analytics_custom_reports','lodash','util','../../config/logger','api'];(function(_0x5dc4fa,_0x521d21){var _0xda61fa=function(_0x4c9c98){while(--_0x4c9c98){_0x5dc4fa['push'](_0x5dc4fa['shift']());}};_0xda61fa(++_0x521d21);}(_0xf074,0x1e0));var _0x4f07=function(_0x1556c7,_0x204ce5){_0x1556c7=_0x1556c7-0x0;var _0x825624=_0xf074[_0x1556c7];return _0x825624;};'use strict';var _=require(_0x4f07('0x0'));var util=require(_0x4f07('0x1'));var logger=require(_0x4f07('0x2'))(_0x4f07('0x3'));var moment=require(_0x4f07('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x4f07('0x5'));var config=require('../../config/environment');var attributes=require(_0x4f07('0x6'));module[_0x4f07('0x7')]=function(_0x4d15b0,_0x283160){return _0x4d15b0[_0x4f07('0x8')](_0x4f07('0x9'),attributes,{'tableName':_0x4f07('0xa'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8324=['bluebird','request-promise','path','rimraf','./analyticCustomReport.attributes','exports','define','AnalyticCustomReport','analytics_custom_reports','lodash','api','moment'];(function(_0x344517,_0x30694f){var _0x3dcb6c=function(_0x5b7d4c){while(--_0x5b7d4c){_0x344517['push'](_0x344517['shift']());}};_0x3dcb6c(++_0x30694f);}(_0x8324,0x129));var _0x4832=function(_0x23b655,_0x4feb2b){_0x23b655=_0x23b655-0x0;var _0x364b32=_0x8324[_0x23b655];return _0x364b32;};'use strict';var _=require(_0x4832('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x4832('0x1'));var moment=require(_0x4832('0x2'));var BPromise=require(_0x4832('0x3'));var rp=require(_0x4832('0x4'));var fs=require('fs');var path=require(_0x4832('0x5'));var rimraf=require(_0x4832('0x6'));var config=require('../../config/environment');var attributes=require(_0x4832('0x7'));module[_0x4832('0x8')]=function(_0x3e4353,_0x3d9681){return _0x3e4353[_0x4832('0x9')](_0x4832('0xa'),attributes,{'tableName':_0x4832('0xb'),'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 8764ecc..285c54c 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 _0x25be=['debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','code','AnalyticCustomReport,\x20%s,\x20%s','message','result','catch','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','info','request\x20sent'];(function(_0x84fa87,_0x559322){var _0x516222=function(_0x32699d){while(--_0x32699d){_0x84fa87['push'](_0x84fa87['shift']());}};_0x516222(++_0x559322);}(_0x25be,0xdb));var _0xe25b=function(_0x454969,_0x5dd56a){_0x454969=_0x454969-0x0;var _0x3934cc=_0x25be[_0x454969];return _0x3934cc;};'use strict';var _=require(_0xe25b('0x0'));var util=require('util');var moment=require(_0xe25b('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe25b('0x2'));var db=require(_0xe25b('0x3'))['db'];var utils=require(_0xe25b('0x4'));var logger=require(_0xe25b('0x5'))(_0xe25b('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xe25b('0x7')][_0xe25b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x49da30,_0x47687e,_0x36f583){return new BPromise(function(_0x33966c,_0x56bbe2){return client[_0xe25b('0x9')](_0x49da30,_0x36f583)['then'](function(_0x34c4bf){logger[_0xe25b('0xa')]('AnalyticCustomReport,\x20%s,\x20%s',_0x47687e,_0xe25b('0xb'));logger[_0xe25b('0xc')](_0xe25b('0xd'),_0x47687e,'request\x20sent',JSON[_0xe25b('0xe')](_0x34c4bf));if(_0x34c4bf[_0xe25b('0xf')]){if(_0x34c4bf['error'][_0xe25b('0x10')]===0x1f4){logger[_0xe25b('0xf')](_0xe25b('0x11'),_0x47687e,_0x34c4bf[_0xe25b('0xf')][_0xe25b('0x12')]);return _0x56bbe2(_0x34c4bf['error'][_0xe25b('0x12')]);}logger[_0xe25b('0xf')](_0xe25b('0x11'),_0x47687e,_0x34c4bf['error'][_0xe25b('0x12')]);return _0x33966c(_0x34c4bf['error'][_0xe25b('0x12')]);}else{logger[_0xe25b('0xa')](_0xe25b('0x11'),_0x47687e,'request\x20sent');_0x33966c(_0x34c4bf[_0xe25b('0x13')][_0xe25b('0x12')]);}})[_0xe25b('0x14')](function(_0x11db4f){logger[_0xe25b('0xf')](_0xe25b('0x11'),_0x47687e,_0x11db4f);_0x56bbe2(_0x11db4f);});});} \ No newline at end of file +var _0x9d88=['lodash','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch'];(function(_0xc0d9bc,_0x2bd6be){var _0x32ff73=function(_0x28c592){while(--_0x28c592){_0xc0d9bc['push'](_0xc0d9bc['shift']());}};_0x32ff73(++_0x2bd6be);}(_0x9d88,0x168));var _0x89d8=function(_0x2f9967,_0x39e39f){_0x2f9967=_0x2f9967-0x0;var _0x553293=_0x9d88[_0x2f9967];return _0x553293;};'use strict';var _=require(_0x89d8('0x0'));var util=require('util');var moment=require(_0x89d8('0x1'));var BPromise=require(_0x89d8('0x2'));var rs=require(_0x89d8('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x89d8('0x4'));var logger=require(_0x89d8('0x5'))(_0x89d8('0x6'));var config=require(_0x89d8('0x7'));var jayson=require(_0x89d8('0x8'));var client=jayson['client'][_0x89d8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xa6d7b7,_0x13ba73,_0xff9225){return new BPromise(function(_0x1e7ea3,_0x422783){return client[_0x89d8('0xa')](_0xa6d7b7,_0xff9225)['then'](function(_0x55f773){logger[_0x89d8('0xb')](_0x89d8('0xc'),_0x13ba73,_0x89d8('0xd'));logger['debug']('AnalyticCustomReport,\x20%s,\x20%s,\x20%s',_0x13ba73,_0x89d8('0xd'),JSON[_0x89d8('0xe')](_0x55f773));if(_0x55f773['error']){if(_0x55f773[_0x89d8('0xf')][_0x89d8('0x10')]===0x1f4){logger[_0x89d8('0xf')](_0x89d8('0xc'),_0x13ba73,_0x55f773[_0x89d8('0xf')][_0x89d8('0x11')]);return _0x422783(_0x55f773[_0x89d8('0xf')][_0x89d8('0x11')]);}logger[_0x89d8('0xf')](_0x89d8('0xc'),_0x13ba73,_0x55f773['error'][_0x89d8('0x11')]);return _0x1e7ea3(_0x55f773[_0x89d8('0xf')][_0x89d8('0x11')]);}else{logger[_0x89d8('0xb')]('AnalyticCustomReport,\x20%s,\x20%s',_0x13ba73,_0x89d8('0xd'));_0x1e7ea3(_0x55f773[_0x89d8('0x12')][_0x89d8('0x11')]);}})[_0x89d8('0x13')](function(_0x3554b9){logger[_0x89d8('0xf')]('AnalyticCustomReport,\x20%s,\x20%s',_0x13ba73,_0x3554b9);_0x422783(_0x3554b9);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index a5c8558..0a76ca1 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 _0xec87=['/:id/run','run','/:id/query','query','post','/:id','exports','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','show','/:id/preview','preview'];(function(_0x2d7c8a,_0x119ebc){var _0x2b42de=function(_0x566073){while(--_0x566073){_0x2d7c8a['push'](_0x2d7c8a['shift']());}};_0x2b42de(++_0x119ebc);}(_0xec87,0x170));var _0x7ec8=function(_0x2b1551,_0x1776fe){_0x2b1551=_0x2b1551-0x0;var _0x2fc2a1=_0xec87[_0x2b1551];return _0x2fc2a1;};'use strict';var multer=require('multer');var util=require(_0x7ec8('0x0'));var path=require(_0x7ec8('0x1'));var timeout=require('connect-timeout');var express=require(_0x7ec8('0x2'));var router=express['Router']();var fs_extra=require(_0x7ec8('0x3'));var auth=require(_0x7ec8('0x4'));var interaction=require(_0x7ec8('0x5'));var config=require('../../config/environment');var controller=require('./analyticCustomReport.controller');router[_0x7ec8('0x6')]('/',auth[_0x7ec8('0x7')](),controller[_0x7ec8('0x8')]);router[_0x7ec8('0x6')]('/:id',auth[_0x7ec8('0x7')](),controller[_0x7ec8('0x9')]);router['get'](_0x7ec8('0xa'),auth[_0x7ec8('0x7')](),controller[_0x7ec8('0xb')]);router[_0x7ec8('0x6')](_0x7ec8('0xc'),auth[_0x7ec8('0x7')](),controller[_0x7ec8('0xd')]);router[_0x7ec8('0x6')](_0x7ec8('0xe'),auth[_0x7ec8('0x7')](),controller[_0x7ec8('0xf')]);router[_0x7ec8('0x10')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x7ec8('0x11'),auth[_0x7ec8('0x7')](),controller['update']);router['delete'](_0x7ec8('0x11'),auth['isAuthenticated'](),controller['destroy']);module[_0x7ec8('0x12')]=router; \ No newline at end of file +var _0x0bbf=['get','/:id','show','/:id/preview','preview','/:id/run','run','/:id/query','post','create','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','isAuthenticated','index'];(function(_0x367b2f,_0x3713fe){var _0x3f92ba=function(_0x797aee){while(--_0x797aee){_0x367b2f['push'](_0x367b2f['shift']());}};_0x3f92ba(++_0x3713fe);}(_0x0bbf,0x18d));var _0xf0bb=function(_0x1ac6af,_0x9ee48f){_0x1ac6af=_0x1ac6af-0x0;var _0x21f6ef=_0x0bbf[_0x1ac6af];return _0x21f6ef;};'use strict';var multer=require(_0xf0bb('0x0'));var util=require(_0xf0bb('0x1'));var path=require(_0xf0bb('0x2'));var timeout=require(_0xf0bb('0x3'));var express=require(_0xf0bb('0x4'));var router=express['Router']();var fs_extra=require(_0xf0bb('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xf0bb('0x6'));var config=require(_0xf0bb('0x7'));var controller=require(_0xf0bb('0x8'));router['get']('/',auth[_0xf0bb('0x9')](),controller[_0xf0bb('0xa')]);router[_0xf0bb('0xb')](_0xf0bb('0xc'),auth['isAuthenticated'](),controller[_0xf0bb('0xd')]);router[_0xf0bb('0xb')](_0xf0bb('0xe'),auth[_0xf0bb('0x9')](),controller[_0xf0bb('0xf')]);router[_0xf0bb('0xb')](_0xf0bb('0x10'),auth[_0xf0bb('0x9')](),controller[_0xf0bb('0x11')]);router[_0xf0bb('0xb')](_0xf0bb('0x12'),auth[_0xf0bb('0x9')](),controller['query']);router[_0xf0bb('0x13')]('/',auth['isAuthenticated'](),controller[_0xf0bb('0x14')]);router['put']('/:id',auth[_0xf0bb('0x9')](),controller['update']);router[_0xf0bb('0x15')]('/:id',auth[_0xf0bb('0x9')](),controller[_0xf0bb('0x16')]);module[_0xf0bb('0x17')]=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index 69d15de..832ceae 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 _0x1cb9=['TEXT','sequelize','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1cb9,0x14e));var _0x91cb=function(_0x46a1b1,_0x19a0a6){_0x46a1b1=_0x46a1b1-0x0;var _0xb9fe1=_0x1cb9[_0x46a1b1];return _0xb9fe1;};'use strict';var Sequelize=require(_0x91cb('0x0'));module['exports']={'name':{'type':Sequelize[_0x91cb('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x91cb('0x1')]},'parent':{'type':Sequelize[_0x91cb('0x1')]},'table':{'type':Sequelize[_0x91cb('0x1')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0x91cb('0x2')]}}; \ No newline at end of file +var _0x98a8=['sequelize','exports','STRING','TEXT'];(function(_0x3e1200,_0x59d583){var _0x5f2b7b=function(_0x24320c){while(--_0x24320c){_0x3e1200['push'](_0x3e1200['shift']());}};_0x5f2b7b(++_0x59d583);}(_0x98a8,0x12c));var _0x898a=function(_0x2a293d,_0x19b5a6){_0x2a293d=_0x2a293d-0x0;var _0x375cdb=_0x98a8[_0x2a293d];return _0x375cdb;};'use strict';var Sequelize=require(_0x898a('0x0'));module[_0x898a('0x1')]={'name':{'type':Sequelize[_0x898a('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x898a('0x2')]},'parent':{'type':Sequelize[_0x898a('0x2')]},'table':{'type':Sequelize[_0x898a('0x2')]},'conditions':{'type':Sequelize[_0x898a('0x3')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index 551acd9..24dc81b 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 _0x687b=['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/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','then','get','DefaultReports','UserProfileResource','destroy','sendStatus','error','name','send','index','map','AnalyticDefaultReport','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','order','sort','where','pick','VIRTUAL','filter','options','findAll','catch','params','intersection','includeAll','include','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Reports','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','left_join','right_join','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','merge','getFields','Sequelize','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','MetricId','metric','function','replace','format','groupBy','orderBy','alias','joins','parse','foreignTable','foreignKey','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SUM(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ValidationErrorItem','DESC','parentKey','web','fullPath','%s-%s.%s','output','csv','default','AnalyticExtractedReport','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','Run\x20Query:','fork','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','SELECT','run','runReport','cross_join','%s.%s\x20=\x20%s.%s','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x687b,0x14a));var _0xb687=function(_0x4f1da5,_0x4ced17){_0x4f1da5=_0x4f1da5-0x0;var _0xe972a8=_0x687b[_0x4f1da5];return _0xe972a8;};'use strict';var emlformat=require(_0xb687('0x0'));var rimraf=require(_0xb687('0x1'));var zipdir=require(_0xb687('0x2'));var jsonpatch=require(_0xb687('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xb687('0x4'));var Mustache=require(_0xb687('0x5'));var util=require(_0xb687('0x6'));var path=require(_0xb687('0x7'));var sox=require(_0xb687('0x8'));var csv=require(_0xb687('0x9'));var ejs=require(_0xb687('0xa'));var fs=require('fs');var fs_extra=require(_0xb687('0xb'));var _=require(_0xb687('0xc'));var squel=require(_0xb687('0xd'));var crypto=require('crypto');var jsforce=require(_0xb687('0xe'));var deskjs=require(_0xb687('0xf'));var toCsv=require('to-csv');var querystring=require(_0xb687('0x10'));var Papa=require(_0xb687('0x11'));var Redis=require(_0xb687('0x12'));var authService=require(_0xb687('0x13'));var qs=require(_0xb687('0x14'));var as=require(_0xb687('0x15'));var hardwareService=require(_0xb687('0x16'));var logger=require(_0xb687('0x17'))(_0xb687('0x18'));var utils=require('../../config/utils');var config=require(_0xb687('0x19'));var licenseUtil=require(_0xb687('0x1a'));var db=require(_0xb687('0x1b'))['db'];var dbH=require(_0xb687('0x1b'))['dbH'];function respondWithStatusCode(_0x4c97ed,_0x3e85b3){_0x3e85b3=_0x3e85b3||0xcc;return function(_0x155ebe){if(_0x155ebe){return _0x4c97ed['sendStatus'](_0x3e85b3);}return _0x4c97ed[_0xb687('0x1c')](_0x3e85b3)[_0xb687('0x1d')]();};}function respondWithResult(_0x1f1f35,_0x30d502){_0x30d502=_0x30d502||0xc8;return function(_0x838dd4){if(_0x838dd4){return _0x1f1f35[_0xb687('0x1c')](_0x30d502)[_0xb687('0x1e')](_0x838dd4);}};}function respondWithFilteredResult(_0x141375,_0x263085){return function(_0x2c7a18){if(_0x2c7a18){var _0x25124a=typeof _0x263085[_0xb687('0x1f')]==='undefined'&&typeof _0x263085[_0xb687('0x20')]===_0xb687('0x21');var _0x30d370=_0x2c7a18['count'];var _0x48958d=_0x25124a?0x0:_0x263085[_0xb687('0x1f')];var _0x3a10ef=_0x25124a?_0x2c7a18[_0xb687('0x22')]:_0x263085['offset']+_0x263085[_0xb687('0x20')];var _0x481f1d;if(_0x3a10ef>=_0x30d370){_0x3a10ef=_0x30d370;_0x481f1d=0xc8;}else{_0x481f1d=0xce;}_0x141375[_0xb687('0x1c')](_0x481f1d);return _0x141375[_0xb687('0x23')](_0xb687('0x24'),_0x48958d+'-'+_0x3a10ef+'/'+_0x30d370)[_0xb687('0x1e')](_0x2c7a18);}return null;};}function patchUpdates(_0x49d5a1){return function(_0x3a73d5){try{jsonpatch['apply'](_0x3a73d5,_0x49d5a1,!![]);}catch(_0x335541){return BPromise[_0xb687('0x25')](_0x335541);}return _0x3a73d5[_0xb687('0x26')]();};}function saveUpdates(_0x546fde,_0x1dc06b){return function(_0x491623){if(_0x491623){return _0x491623[_0xb687('0x27')](_0x546fde)[_0xb687('0x28')](function(_0xbf6c58){return _0xbf6c58;});}return null;};}function removeEntity(_0x38866c,_0xf48ba4){return function(_0x2f0a0a){if(_0x2f0a0a){return _0x2f0a0a['destroy']()[_0xb687('0x28')](function(){var _0x129347=_0x2f0a0a[_0xb687('0x29')]({'plain':!![]});var _0x1a0261=_0xb687('0x2a');return db[_0xb687('0x2b')][_0xb687('0x2c')]({'where':{'type':_0x1a0261,'resourceId':_0x129347['id']}})[_0xb687('0x28')](function(){return _0x2f0a0a;});})[_0xb687('0x28')](function(){_0x38866c[_0xb687('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3712cf,_0x192966){return function(_0x392721){if(!_0x392721){_0x3712cf[_0xb687('0x2d')](0x194);}return _0x392721;};}function handleError(_0x2e5c8d,_0x173c58){_0x173c58=_0x173c58||0x1f4;return function(_0x4e9a06){logger[_0xb687('0x2e')](_0x4e9a06['stack']);if(_0x4e9a06[_0xb687('0x2f')]){delete _0x4e9a06[_0xb687('0x2f')];}_0x2e5c8d[_0xb687('0x1c')](_0x173c58)[_0xb687('0x30')](_0x4e9a06);};}exports[_0xb687('0x31')]=function(_0x43d20d,_0xf1f0dd){var _0x556815={},_0x3da2be={},_0xe3428f={'count':0x0,'rows':[]};var _0x3c08ab=_[_0xb687('0x32')](db[_0xb687('0x33')][_0xb687('0x34')],function(_0x44be88){return{'name':_0x44be88[_0xb687('0x35')],'type':_0x44be88[_0xb687('0x36')][_0xb687('0x37')]};});_0x3da2be[_0xb687('0x38')]=_['map'](_0x3c08ab,'name');_0x3da2be[_0xb687('0x39')]=_[_0xb687('0x3a')](_0x43d20d[_0xb687('0x39')]);_0x3da2be[_0xb687('0x3b')]=_['intersection'](_0x3da2be['model'],_0x3da2be[_0xb687('0x39')]);_0x556815[_0xb687('0x3c')]=_['intersection'](_0x3da2be[_0xb687('0x38')],qs[_0xb687('0x3d')](_0x43d20d['query'][_0xb687('0x3d')]));_0x556815['attributes']=_0x556815[_0xb687('0x3c')][_0xb687('0x3e')]?_0x556815[_0xb687('0x3c')]:_0x3da2be[_0xb687('0x38')];if(!_0x43d20d[_0xb687('0x39')][_0xb687('0x3f')]('nolimit')){_0x556815[_0xb687('0x20')]=qs[_0xb687('0x20')](_0x43d20d[_0xb687('0x39')][_0xb687('0x20')]);_0x556815['offset']=qs[_0xb687('0x1f')](_0x43d20d[_0xb687('0x39')][_0xb687('0x1f')]);}_0x556815[_0xb687('0x40')]=qs[_0xb687('0x41')](_0x43d20d['query'][_0xb687('0x41')]);_0x556815[_0xb687('0x42')]=qs[_0xb687('0x3b')](_[_0xb687('0x43')](_0x43d20d[_0xb687('0x39')],_0x3da2be[_0xb687('0x3b')]),_0x3c08ab);if(_0x43d20d['query']['filter']){_0x556815[_0xb687('0x42')]=_['merge'](_0x556815[_0xb687('0x42')],{'$or':_[_0xb687('0x32')](_0x3c08ab,function(_0x48d3b1){if(_0x48d3b1[_0xb687('0x36')]!==_0xb687('0x44')){var _0x57776b={};_0x57776b[_0x48d3b1[_0xb687('0x2f')]]={'$like':'%'+_0x43d20d[_0xb687('0x39')][_0xb687('0x45')]+'%'};return _0x57776b;}})});}_0x556815=_['merge']({},_0x556815,_0x43d20d[_0xb687('0x46')]);var _0x9cffb2={'where':_0x556815[_0xb687('0x42')]};return db[_0xb687('0x33')][_0xb687('0x22')](_0x9cffb2)[_0xb687('0x28')](function(_0x21b9ef){_0xe3428f['count']=_0x21b9ef;if(_0x43d20d[_0xb687('0x39')]['includeAll']){_0x556815['include']=[{'all':!![]}];}return db[_0xb687('0x33')][_0xb687('0x47')](_0x556815);})['then'](function(_0x19a21c){_0xe3428f['rows']=_0x19a21c;return _0xe3428f;})[_0xb687('0x28')](respondWithFilteredResult(_0xf1f0dd,_0x556815))[_0xb687('0x48')](handleError(_0xf1f0dd,null));};exports['show']=function(_0x4cb7a0,_0x3a8509){var _0x5d9cb0={'raw':!![],'where':{'id':_0x4cb7a0[_0xb687('0x49')]['id']}},_0x247c67={};_0x247c67[_0xb687('0x38')]=_[_0xb687('0x3a')](db[_0xb687('0x33')][_0xb687('0x34')]);_0x247c67[_0xb687('0x39')]=_[_0xb687('0x3a')](_0x4cb7a0[_0xb687('0x39')]);_0x247c67[_0xb687('0x3b')]=_[_0xb687('0x4a')](_0x247c67[_0xb687('0x38')],_0x247c67['query']);_0x5d9cb0[_0xb687('0x3c')]=_['intersection'](_0x247c67[_0xb687('0x38')],qs[_0xb687('0x3d')](_0x4cb7a0[_0xb687('0x39')][_0xb687('0x3d')]));_0x5d9cb0[_0xb687('0x3c')]=_0x5d9cb0[_0xb687('0x3c')]['length']?_0x5d9cb0['attributes']:_0x247c67[_0xb687('0x38')];if(_0x4cb7a0[_0xb687('0x39')][_0xb687('0x4b')]){_0x5d9cb0[_0xb687('0x4c')]=[{'all':!![]}];}_0x5d9cb0=_['merge']({},_0x5d9cb0,_0x4cb7a0[_0xb687('0x46')]);return db[_0xb687('0x33')][_0xb687('0x4d')](_0x5d9cb0)[_0xb687('0x28')](handleEntityNotFound(_0x3a8509,null))['then'](respondWithResult(_0x3a8509,null))[_0xb687('0x48')](handleError(_0x3a8509,null));};exports[_0xb687('0x4e')]=function(_0x162b19,_0x401b99){return db['AnalyticDefaultReport']['create'](_0x162b19[_0xb687('0x4f')],{})[_0xb687('0x28')](function(_0x42b61a){var _0x508862=_0x162b19['user'][_0xb687('0x29')]({'plain':!![]});if(!_0x508862)throw new Error(_0xb687('0x50'));if(_0x508862[_0xb687('0x51')]===_0xb687('0x52')){var _0x34205d=_0x42b61a[_0xb687('0x29')]({'plain':!![]});var _0x602864=_0xb687('0x53');return db['UserProfileSection'][_0xb687('0x4d')]({'where':{'name':_0x602864,'userProfileId':_0x508862[_0xb687('0x54')]},'raw':!![]})[_0xb687('0x28')](function(_0x4f5784){if(_0x4f5784&&_0x4f5784['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x34205d[_0xb687('0x2f')],'resourceId':_0x34205d['id'],'type':_0xb687('0x2a'),'sectionId':_0x4f5784['id']},{})[_0xb687('0x28')](function(){return _0x42b61a;});}else{return _0x42b61a;}})[_0xb687('0x48')](function(_0x1ddfd4){logger[_0xb687('0x2e')](_0xb687('0x55'),_0x1ddfd4);throw _0x1ddfd4;});}return _0x42b61a;})[_0xb687('0x28')](respondWithResult(_0x401b99,0xc9))[_0xb687('0x48')](handleError(_0x401b99,null));};exports[_0xb687('0x27')]=function(_0x128264,_0x166900){if(_0x128264[_0xb687('0x4f')]['id']){delete _0x128264[_0xb687('0x4f')]['id'];}return db[_0xb687('0x33')][_0xb687('0x4d')]({'where':{'id':_0x128264[_0xb687('0x49')]['id']}})['then'](handleEntityNotFound(_0x166900,null))['then'](saveUpdates(_0x128264[_0xb687('0x4f')],null))[_0xb687('0x28')](respondWithResult(_0x166900,null))[_0xb687('0x48')](handleError(_0x166900,null));};exports[_0xb687('0x2c')]=function(_0x4e5642,_0xfa8790){return db[_0xb687('0x33')]['find']({'where':{'id':_0x4e5642[_0xb687('0x49')]['id']}})['then'](handleEntityNotFound(_0xfa8790,null))[_0xb687('0x28')](removeEntity(_0xfa8790,null))[_0xb687('0x48')](handleError(_0xfa8790,null));};exports['preview']=function(_0x4fb188,_0x13ad6a){var _0x4ab9c5=0xa;var _0x5ea8fd=[_0xb687('0x56'),_0xb687('0x57'),_0xb687('0x58'),'cross_join'];var _0x25e140={'SUM':'SUM(%s)','COUNT':_0xb687('0x59'),'COUNT DISTINCT':_0xb687('0x5a'),'MAX':_0xb687('0x5b'),'MIN':_0xb687('0x5c'),'AVG':_0xb687('0x5d'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xb687('0x5e')};var _0x58ec8b={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':_0xb687('0x5f'),'UNIX_TIMESTAMP':_0xb687('0x60')};var _0xbc3a94=function(_0x4bc18f){return!_[_0xb687('0x61')]([_0xb687('0x62'),_0xb687('0x63'),_0xb687('0x64'),_0xb687('0x65')],_0x4bc18f);};var _0x17505c=function(_0x132e3a){if(!_0x132e3a||!_0x132e3a['rules']['length']){return'';}for(var _0x2714c6='(',_0x4906df=0x0;_0x4906df<_0x132e3a[_0xb687('0x66')][_0xb687('0x3e')];_0x4906df+=0x1){_0x4906df>0x0&&(_0x2714c6+='\x20'+_0x132e3a[_0xb687('0x67')]+'\x20');_0x2714c6+=_0x132e3a[_0xb687('0x66')][_0x4906df][_0xb687('0x68')]?_0x17505c(_0x132e3a['rules'][_0x4906df][_0xb687('0x68')]):_0x132e3a['rules'][_0x4906df][_0xb687('0x69')]+'\x20'+_0x132e3a[_0xb687('0x66')][_0x4906df][_0xb687('0x6a')]+(_0xbc3a94(_0x132e3a[_0xb687('0x66')][_0x4906df][_0xb687('0x6a')])?'\x20'+_0x132e3a[_0xb687('0x66')][_0x4906df][_0xb687('0x6b')]:'');}return _0x2714c6+')';};var _0x5deb7a={'where':{'id':_0x4fb188['params']['id']}},_0x28a6aa,_0x31ed20,_0x8942b7,_0x36bb4b,_0x258caf;_0x5deb7a=_[_0xb687('0x6c')]({},_0x5deb7a,_0x4fb188[_0xb687('0x46')]);return db[_0xb687('0x33')][_0xb687('0x4d')](_0x5deb7a)[_0xb687('0x28')](function(_0x15ef44){if(_0x15ef44){_0x28a6aa=_0x15ef44;return _0x15ef44[_0xb687('0x6d')]();}return null;})[_0xb687('0x28')](function(_0x177ea4){if(_0x177ea4){if(!_0x177ea4[_0xb687('0x3e')]){throw new db[(_0xb687('0x6e'))]['ValidationErrorItem'](_0xb687('0x6f'),0x193);}_0x31ed20=_0x177ea4;return db[_0xb687('0x70')][_0xb687('0x47')]({'raw':!![]});}return null;})[_0xb687('0x28')](function(_0x505f7a){if(_0x505f7a){_0x8942b7=_[_0xb687('0x71')](_0x505f7a,'id');var _0x1a6075;var _0x53b00a=squel[_0xb687('0x72')]();_0x53b00a[_0xb687('0x73')](_0x28a6aa[_0xb687('0x74')]);for(var _0x5eeb75=0x0;_0x5eeb75<_0x31ed20[_0xb687('0x3e')];_0x5eeb75+=0x1){_0x1a6075=_0x31ed20[_0x5eeb75][_0xb687('0x75')]?_0x8942b7[_0x31ed20[_0x5eeb75]['MetricId']][_0xb687('0x76')]:_0x31ed20[_0x5eeb75][_0xb687('0x69')];_0x1a6075=_0x31ed20[_0x5eeb75][_0xb687('0x77')]?_[_0xb687('0x78')](_0x25e140[_0x31ed20[_0x5eeb75]['function']],'%s',_0x1a6075):_0x1a6075;_0x1a6075=_0x31ed20[_0x5eeb75][_0xb687('0x79')]?_[_0xb687('0x78')](_0x58ec8b[_0x31ed20[_0x5eeb75]['format']],'%s',_0x1a6075):_0x1a6075;if(_0x31ed20[_0x5eeb75][_0xb687('0x7a')]){_0x53b00a[_0xb687('0x68')](_0x1a6075);}_0x31ed20[_0x5eeb75]['orderBy']&&_0x53b00a['order'](_0x1a6075,_0x31ed20[_0x5eeb75][_0xb687('0x7b')]==='DESC'?![]:!![]);_0x53b00a[_0xb687('0x69')](_0x1a6075,_0x31ed20[_0x5eeb75][_0xb687('0x7c')]||_0x1a6075);}if(_0x28a6aa[_0xb687('0x7d')]){_0x28a6aa[_0xb687('0x7d')]=JSON[_0xb687('0x7e')](_0x28a6aa[_0xb687('0x7d')]);for(var _0x229bc4=0x0;_0x229bc4<_0x28a6aa[_0xb687('0x7d')]['length'];_0x229bc4+=0x1){if(_0x28a6aa[_0xb687('0x7d')][_0x229bc4][_0xb687('0x36')]&&_[_0xb687('0x61')](_0x5ea8fd,_0x28a6aa[_0xb687('0x7d')][_0x229bc4][_0xb687('0x36')])&&_0x28a6aa[_0xb687('0x7d')][_0x229bc4]['parentKey']&&_0x28a6aa[_0xb687('0x7d')][_0x229bc4][_0xb687('0x7f')]&&_0x28a6aa['joins'][_0x229bc4][_0xb687('0x80')]){_0x53b00a[_0x28a6aa[_0xb687('0x7d')][_0x229bc4][_0xb687('0x36')]](_0x28a6aa[_0xb687('0x7d')][_0x229bc4]['foreignTable'],null,util[_0xb687('0x79')]('%s.%s\x20=\x20%s.%s',_0x28a6aa['table'],_0x28a6aa[_0xb687('0x7d')][_0x229bc4]['parentKey'],_0x28a6aa['joins'][_0x229bc4][_0xb687('0x7f')],_0x28a6aa['joins'][_0x229bc4][_0xb687('0x80')]));}}}if(_0x28a6aa[_0xb687('0x81')]){_0x28a6aa['conditions']=JSON[_0xb687('0x7e')](_0x28a6aa[_0xb687('0x81')]);_0x53b00a['where'](_0x17505c(_0x28a6aa[_0xb687('0x81')][_0xb687('0x68')]));}_0x258caf=_0x53b00a[_0xb687('0x82')]();_0x53b00a[_0xb687('0x20')](_0x4ab9c5);_0x53b00a[_0xb687('0x1f')](0x0);logger[_0xb687('0x83')](_0xb687('0x84'),_0x53b00a[_0xb687('0x85')]());return dbH[_0xb687('0x86')][_0xb687('0x39')](_0x53b00a[_0xb687('0x85')](),{'type':dbH['sequelize'][_0xb687('0x87')]['SELECT']});}})['then'](respondWithResult(_0x13ad6a,null))[_0xb687('0x48')](handleError(_0x13ad6a,null));};function runReport(_0x29e830,_0x22ebca,_0xfecb8d){var _0x3a7339=_0x22ebca['name'];var _0x59c94b=0xa;var _0x29e27e=[_0xb687('0x56'),_0xb687('0x57'),_0xb687('0x58'),'cross_join'];var _0x448d59={'SUM':_0xb687('0x88'),'COUNT':_0xb687('0x59'),'COUNT DISTINCT':_0xb687('0x5a'),'MAX':_0xb687('0x5b'),'MIN':_0xb687('0x5c'),'AVG':_0xb687('0x5d'),'GROUP_CONCAT':_0xb687('0x89'),'GROUP_CONCAT ASC':_0xb687('0x8a'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x25f5c3={'SEC_TO_TIME':_0xb687('0x8b'),'DATE':_0xb687('0x8c'),'HOUR':_0xb687('0x8d'),'ROUND':_0xb687('0x5f'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x1037b1=function(_0x3bf480){return!_['includes']([_0xb687('0x62'),'IS\x20NOT\x20NULL',_0xb687('0x64'),_0xb687('0x65')],_0x3bf480);};var _0x5ec5f6=function(_0x1c683e){if(!_0x1c683e||!_0x1c683e[_0xb687('0x66')]['length']){return'';}for(var _0x231caa='(',_0x3479c5=0x0;_0x3479c5<_0x1c683e[_0xb687('0x66')][_0xb687('0x3e')];_0x3479c5+=0x1){_0x3479c5>0x0&&(_0x231caa+='\x20'+_0x1c683e[_0xb687('0x67')]+'\x20');_0x231caa+=_0x1c683e[_0xb687('0x66')][_0x3479c5]['group']?_0x5ec5f6(_0x1c683e[_0xb687('0x66')][_0x3479c5][_0xb687('0x68')]):_0x1c683e[_0xb687('0x66')][_0x3479c5][_0xb687('0x69')]+'\x20'+_0x1c683e[_0xb687('0x66')][_0x3479c5][_0xb687('0x6a')]+(_0x1037b1(_0x1c683e[_0xb687('0x66')][_0x3479c5][_0xb687('0x6a')])?'\x20'+_0x1c683e[_0xb687('0x66')][_0x3479c5][_0xb687('0x6b')]:'');}return _0x231caa+')';};var _0x290ddf={'where':{'id':_0x29e830['id']}},_0x5ee585,_0x10fb0,_0x5be566,_0x3d98e2,_0x3aa1c8;_0x290ddf=_['merge']({},_0x290ddf,_0xfecb8d);return db['AnalyticDefaultReport'][_0xb687('0x4d')](_0x290ddf)[_0xb687('0x28')](function(_0x3b4acf){if(_0x3b4acf){_0x5ee585=_0x3b4acf;return _0x3b4acf[_0xb687('0x6d')]();}return null;})[_0xb687('0x28')](function(_0x1c3de0){if(_0x1c3de0){if(!_0x1c3de0[_0xb687('0x3e')]){throw new db[(_0xb687('0x6e'))][(_0xb687('0x8e'))](_0xb687('0x6f'),0x193);}_0x10fb0=_0x1c3de0;return db[_0xb687('0x70')][_0xb687('0x47')]({'raw':!![]});}return null;})[_0xb687('0x28')](function(_0x1ea6fd){if(_0x1ea6fd){_0x5be566=_[_0xb687('0x71')](_0x1ea6fd,'id');var _0x3f45b7;var _0x508550=squel['select']();_0x508550[_0xb687('0x73')](_0x5ee585['table']);for(var _0x5f2557=0x0;_0x5f2557<_0x10fb0[_0xb687('0x3e')];_0x5f2557+=0x1){_0x3f45b7=_0x10fb0[_0x5f2557][_0xb687('0x75')]?_0x5be566[_0x10fb0[_0x5f2557]['MetricId']][_0xb687('0x76')]:_0x10fb0[_0x5f2557][_0xb687('0x69')];_0x3f45b7=_0x10fb0[_0x5f2557]['function']?_[_0xb687('0x78')](_0x448d59[_0x10fb0[_0x5f2557][_0xb687('0x77')]],'%s',_0x3f45b7):_0x3f45b7;_0x3f45b7=_0x10fb0[_0x5f2557][_0xb687('0x79')]?_[_0xb687('0x78')](_0x25f5c3[_0x10fb0[_0x5f2557][_0xb687('0x79')]],'%s',_0x3f45b7):_0x3f45b7;if(_0x10fb0[_0x5f2557][_0xb687('0x7a')]){_0x508550[_0xb687('0x68')](_0x3f45b7);}_0x10fb0[_0x5f2557][_0xb687('0x7b')]&&_0x508550[_0xb687('0x40')](_0x3f45b7,_0x10fb0[_0x5f2557]['orderBy']===_0xb687('0x8f')?![]:!![]);_0x508550[_0xb687('0x69')](_0x3f45b7,_0x10fb0[_0x5f2557]['alias']||_0x3f45b7);}if(_0x5ee585[_0xb687('0x7d')]){_0x5ee585['joins']=JSON[_0xb687('0x7e')](_0x5ee585[_0xb687('0x7d')]);for(var _0x59166c=0x0;_0x59166c<_0x5ee585[_0xb687('0x7d')][_0xb687('0x3e')];_0x59166c+=0x1){if(_0x5ee585[_0xb687('0x7d')][_0x59166c][_0xb687('0x36')]&&_[_0xb687('0x61')](_0x29e27e,_0x5ee585[_0xb687('0x7d')][_0x59166c][_0xb687('0x36')])&&_0x5ee585['joins'][_0x59166c]['parentKey']&&_0x5ee585[_0xb687('0x7d')][_0x59166c]['foreignTable']&&_0x5ee585[_0xb687('0x7d')][_0x59166c][_0xb687('0x80')]){_0x508550[_0x5ee585[_0xb687('0x7d')][_0x59166c][_0xb687('0x36')]](_0x5ee585['joins'][_0x59166c][_0xb687('0x7f')],null,util[_0xb687('0x79')]('%s.%s\x20=\x20%s.%s',_0x5ee585[_0xb687('0x74')],_0x5ee585[_0xb687('0x7d')][_0x59166c][_0xb687('0x90')],_0x5ee585[_0xb687('0x7d')][_0x59166c][_0xb687('0x7f')],_0x5ee585[_0xb687('0x7d')][_0x59166c]['foreignKey']));}}}if(_0x5ee585[_0xb687('0x81')]){_0x5ee585[_0xb687('0x81')]=JSON[_0xb687('0x7e')](_0x5ee585[_0xb687('0x81')]);_0x508550[_0xb687('0x42')](_0x5ec5f6(_0x5ee585[_0xb687('0x81')][_0xb687('0x68')]));}_0x3aa1c8=_0x508550[_0xb687('0x82')]();_0x508550[_0xb687('0x20')](_0x59c94b);_0x508550[_0xb687('0x1f')](0x0);return;}})['then'](function(){if(_0x22ebca['output']===_0xb687('0x91')){return null;}var _0x1a7cd8=_[_0xb687('0x6c')](_0x22ebca,{'name':_0x22ebca[_0xb687('0x92')]||_0x22ebca[_0xb687('0x2f')]||_0x5ee585[_0xb687('0x2f')],'basename':_0x3a7339,'savename':util[_0xb687('0x79')](_0xb687('0x93'),_0x22ebca[_0xb687('0x2f')]||_0x5ee585['name'],require('randomstring')['generate'](0x4),_0x22ebca[_0xb687('0x94')]||_0xb687('0x95')),'reportId':_0x5ee585['id'],'reportType':_0xb687('0x96')});return db[_0xb687('0x97')][_0xb687('0x4e')](_0x1a7cd8,{'raw':!![]});})[_0xb687('0x28')](function(_0x473130){if(_0x5ee585[_0xb687('0x74')]==='cdr'){_0x3aa1c8[_0xb687('0x42')](_0x5ee585[_0xb687('0x74')]+_0xb687('0x98'),_0x22ebca[_0xb687('0x99')],_0x22ebca[_0xb687('0x9a')]);}else{_0x3aa1c8[_0xb687('0x42')](_0x5ee585[_0xb687('0x74')]+_0xb687('0x9b'),_0x22ebca['startDate'],_0x22ebca[_0xb687('0x9a')]);}if(_0x473130){logger['info'](_0xb687('0x9c'),_0x3aa1c8[_0xb687('0x85')]());require('child_process')[_0xb687('0x9d')](path[_0xb687('0x56')](__dirname,_0xb687('0x9e'),_0x473130['output']),[_0x473130['id'],_0x3aa1c8[_0xb687('0x85')](),path[_0xb687('0x56')](__dirname,_0xb687('0x9f'),_0x473130[_0xb687('0xa0')]),_0x3a7339]);return _0x473130;}else{var _0x3d4596=squel[_0xb687('0x72')]();_0x3d4596[_0xb687('0x73')]('('+_0x3aa1c8['toString']()+')',_0xb687('0xa1'));_0x3d4596[_0xb687('0x69')](_0xb687('0xa2'),_0xb687('0x22'));_0x3aa1c8[_0xb687('0x20')](_0x22ebca['limit']||_0x59c94b);_0x3aa1c8[_0xb687('0x1f')](_0x22ebca[_0xb687('0x1f')]||0x0);return dbH[_0xb687('0x86')]['query'](_0x3d4596[_0xb687('0x85')](),{'type':dbH['sequelize'][_0xb687('0x87')][_0xb687('0xa3')]})['then'](function(_0x3dbbd6){if(!_0x3dbbd6[_0xb687('0x3e')]){_0x3d98e2=0x0;}else{_0x3d98e2=_0x3dbbd6[0x0][_0xb687('0x22')]||0x0;}return dbH['sequelize'][_0xb687('0x39')](_0x3aa1c8[_0xb687('0x85')](),{'type':dbH[_0xb687('0x86')][_0xb687('0x87')][_0xb687('0xa3')]});})[_0xb687('0x28')](function(_0x15e599){return{'rows':_0x15e599||[],'count':_0x3d98e2};});}});}exports[_0xb687('0xa4')]=function(_0x8f6ba0,_0x568aca){return runReport(_0x8f6ba0[_0xb687('0x49')],_0x8f6ba0[_0xb687('0x39')],_0x8f6ba0[_0xb687('0x46')])['then'](respondWithResult(_0x568aca,null))['catch'](handleError(_0x568aca,null));};exports[_0xb687('0xa5')]=runReport;exports['query']=function(_0x187810,_0x1d21ef){var _0x386d12=0xa;var _0x4dd8f4=['join',_0xb687('0x57'),_0xb687('0x58'),_0xb687('0xa6')];var _0x295795={'SUM':_0xb687('0x88'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xb687('0x5a'),'MAX':_0xb687('0x5b'),'MIN':'MIN(%s)','AVG':_0xb687('0x5d'),'GROUP_CONCAT':_0xb687('0x89'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xb687('0x5e')};var _0xe7056c={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xb687('0x8c'),'HOUR':_0xb687('0x8d'),'ROUND':_0xb687('0x5f'),'UNIX_TIMESTAMP':_0xb687('0x60')};var _0x1b1cf5=function(_0x46283c){return!_[_0xb687('0x61')](['IS\x20NULL',_0xb687('0x63'),'IS\x20EMPTY',_0xb687('0x65')],_0x46283c);};var _0x394ed6=function(_0x875169){if(!_0x875169||!_0x875169[_0xb687('0x66')]['length']){return'';}for(var _0x1ec485='(',_0x55a919=0x0;_0x55a919<_0x875169['rules'][_0xb687('0x3e')];_0x55a919+=0x1){_0x55a919>0x0&&(_0x1ec485+='\x20'+_0x875169[_0xb687('0x67')]+'\x20');_0x1ec485+=_0x875169[_0xb687('0x66')][_0x55a919]['group']?_0x394ed6(_0x875169[_0xb687('0x66')][_0x55a919][_0xb687('0x68')]):_0x875169['rules'][_0x55a919][_0xb687('0x69')]+'\x20'+_0x875169['rules'][_0x55a919][_0xb687('0x6a')]+(_0x1b1cf5(_0x875169[_0xb687('0x66')][_0x55a919]['condition'])?'\x20'+_0x875169[_0xb687('0x66')][_0x55a919]['value']:'');}return _0x1ec485+')';};var _0x2aecd5={'where':{'id':_0x187810[_0xb687('0x49')]['id']}},_0x58955e,_0x488a2a,_0x303738,_0x3904a3,_0x581338;_0x2aecd5=_['merge']({},_0x2aecd5,_0x187810[_0xb687('0x46')]);return db[_0xb687('0x33')][_0xb687('0x4d')](_0x2aecd5)['then'](function(_0xc29834){if(_0xc29834){_0x58955e=_0xc29834;return _0xc29834[_0xb687('0x6d')]();}return null;})[_0xb687('0x28')](function(_0x1f2f2b){if(_0x1f2f2b){if(!_0x1f2f2b[_0xb687('0x3e')]){throw new db[(_0xb687('0x6e'))]['ValidationErrorItem'](_0xb687('0x6f'),0x193);}_0x488a2a=_0x1f2f2b;return db[_0xb687('0x70')][_0xb687('0x47')]({'raw':!![]});}return null;})[_0xb687('0x28')](function(_0x3591e2){if(_0x3591e2){_0x303738=_['keyBy'](_0x3591e2,'id');var _0x4d0c14;var _0x200b55=squel[_0xb687('0x72')]();_0x200b55[_0xb687('0x73')](_0x58955e[_0xb687('0x74')]);for(var _0x33f4de=0x0;_0x33f4de<_0x488a2a[_0xb687('0x3e')];_0x33f4de+=0x1){_0x4d0c14=_0x488a2a[_0x33f4de][_0xb687('0x75')]?_0x303738[_0x488a2a[_0x33f4de]['MetricId']][_0xb687('0x76')]:_0x488a2a[_0x33f4de][_0xb687('0x69')];_0x4d0c14=_0x488a2a[_0x33f4de][_0xb687('0x77')]?_['replace'](_0x295795[_0x488a2a[_0x33f4de][_0xb687('0x77')]],'%s',_0x4d0c14):_0x4d0c14;_0x4d0c14=_0x488a2a[_0x33f4de][_0xb687('0x79')]?_[_0xb687('0x78')](_0xe7056c[_0x488a2a[_0x33f4de]['format']],'%s',_0x4d0c14):_0x4d0c14;if(_0x488a2a[_0x33f4de][_0xb687('0x7a')]){_0x200b55[_0xb687('0x68')](_0x4d0c14);}_0x488a2a[_0x33f4de]['orderBy']&&_0x200b55[_0xb687('0x40')](_0x4d0c14,_0x488a2a[_0x33f4de][_0xb687('0x7b')]===_0xb687('0x8f')?![]:!![]);_0x200b55[_0xb687('0x69')](_0x4d0c14,_0x488a2a[_0x33f4de]['alias']||_0x4d0c14);}if(_0x58955e[_0xb687('0x7d')]){_0x58955e[_0xb687('0x7d')]=JSON[_0xb687('0x7e')](_0x58955e[_0xb687('0x7d')]);for(var _0xcff220=0x0;_0xcff220<_0x58955e['joins'][_0xb687('0x3e')];_0xcff220+=0x1){if(_0x58955e[_0xb687('0x7d')][_0xcff220]['type']&&_[_0xb687('0x61')](_0x4dd8f4,_0x58955e[_0xb687('0x7d')][_0xcff220]['type'])&&_0x58955e[_0xb687('0x7d')][_0xcff220][_0xb687('0x90')]&&_0x58955e[_0xb687('0x7d')][_0xcff220]['foreignTable']&&_0x58955e[_0xb687('0x7d')][_0xcff220][_0xb687('0x80')]){_0x200b55[_0x58955e['joins'][_0xcff220]['type']](_0x58955e['joins'][_0xcff220][_0xb687('0x7f')],null,util['format'](_0xb687('0xa7'),_0x58955e[_0xb687('0x74')],_0x58955e[_0xb687('0x7d')][_0xcff220][_0xb687('0x90')],_0x58955e[_0xb687('0x7d')][_0xcff220]['foreignTable'],_0x58955e['joins'][_0xcff220][_0xb687('0x80')]));}}}if(_0x58955e[_0xb687('0x81')]){_0x58955e[_0xb687('0x81')]=JSON[_0xb687('0x7e')](_0x58955e[_0xb687('0x81')]);_0x200b55[_0xb687('0x42')](_0x394ed6(_0x58955e[_0xb687('0x81')]['group']));}_0x581338=_0x200b55['clone']();_0x200b55['limit'](_0x386d12);_0x200b55[_0xb687('0x1f')](0x0);logger[_0xb687('0x83')](_0xb687('0x84'),_0x200b55['toString']());return dbH['sequelize']['query'](_0x200b55[_0xb687('0x85')](),{'type':dbH['sequelize'][_0xb687('0x87')][_0xb687('0xa3')]});}})[_0xb687('0x28')](function(){return{'sql':_0x581338[_0xb687('0x85')]()};})[_0xb687('0x28')](respondWithResult(_0x1d21ef,null))[_0xb687('0x48')](handleError(_0x1d21ef,null));}; \ No newline at end of file +var _0xabce=['where','findAll','show','includeAll','options','find','catch','create','body','user','role','Reports','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','preview','join','left_join','right_join','cross_join','SUM(%s)','COUNT(%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)','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','condition','value','getFields','Please\x20insert\x20at\x20least\x20one\x20field','table','MetricId','field','function','replace','format','groupBy','orderBy','joins','parse','includes','parentKey','foreignTable','%s.%s\x20=\x20%s.%s','conditions','debug','Limited\x20Query:','toString','SELECT','COUNT(DISTINCT\x20%s)','MAX(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','SEC_TO_TIME(%s)','ValidationErrorItem','AnalyticMetric','keyBy','select','metric','DESC','foreignKey','output','web','%s-%s.%s','default','cdr','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','savename','from','countTable','COUNT(*)','sequelize','QueryTypes','run','runReport','Sequelize','alias','clone','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','dbH','sendStatus','status','offset','limit','undefined','count','set','json','apply','save','update','then','get','DefaultReports','UserProfileResource','destroy','error','stack','name','send','index','map','AnalyticDefaultReport','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','filter','merge'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xabce,0x103));var _0xeabc=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0xabce[_0x110c3d];return _0x226d67;};'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'];var dbH=require(_0xeabc('0x19'))[_0xeabc('0x1a')];function respondWithStatusCode(_0xcfbf06,_0x53df9c){_0x53df9c=_0x53df9c||0xcc;return function(_0x235c2d){if(_0x235c2d){return _0xcfbf06[_0xeabc('0x1b')](_0x53df9c);}return _0xcfbf06[_0xeabc('0x1c')](_0x53df9c)['end']();};}function respondWithResult(_0x5f4ee8,_0x3170ea){_0x3170ea=_0x3170ea||0xc8;return function(_0x3ae954){if(_0x3ae954){return _0x5f4ee8[_0xeabc('0x1c')](_0x3170ea)['json'](_0x3ae954);}};}function respondWithFilteredResult(_0xf913d7,_0x638976){return function(_0x49f2d8){if(_0x49f2d8){var _0x53fe28=typeof _0x638976[_0xeabc('0x1d')]==='undefined'&&typeof _0x638976[_0xeabc('0x1e')]===_0xeabc('0x1f');var _0x58a3c0=_0x49f2d8[_0xeabc('0x20')];var _0x31dd53=_0x53fe28?0x0:_0x638976[_0xeabc('0x1d')];var _0x384be5=_0x53fe28?_0x49f2d8[_0xeabc('0x20')]:_0x638976['offset']+_0x638976[_0xeabc('0x1e')];var _0x4d68ea;if(_0x384be5>=_0x58a3c0){_0x384be5=_0x58a3c0;_0x4d68ea=0xc8;}else{_0x4d68ea=0xce;}_0xf913d7[_0xeabc('0x1c')](_0x4d68ea);return _0xf913d7[_0xeabc('0x21')]('Content-Range',_0x31dd53+'-'+_0x384be5+'/'+_0x58a3c0)[_0xeabc('0x22')](_0x49f2d8);}return null;};}function patchUpdates(_0x41d67a){return function(_0x254590){try{jsonpatch[_0xeabc('0x23')](_0x254590,_0x41d67a,!![]);}catch(_0x3c9611){return BPromise['reject'](_0x3c9611);}return _0x254590[_0xeabc('0x24')]();};}function saveUpdates(_0x10c675,_0x91ab00){return function(_0x5bdd57){if(_0x5bdd57){return _0x5bdd57[_0xeabc('0x25')](_0x10c675)[_0xeabc('0x26')](function(_0x214953){return _0x214953;});}return null;};}function removeEntity(_0x319119,_0x5b8838){return function(_0x109e1d){if(_0x109e1d){return _0x109e1d['destroy']()[_0xeabc('0x26')](function(){var _0x4d4e29=_0x109e1d[_0xeabc('0x27')]({'plain':!![]});var _0x12acbd=_0xeabc('0x28');return db[_0xeabc('0x29')][_0xeabc('0x2a')]({'where':{'type':_0x12acbd,'resourceId':_0x4d4e29['id']}})[_0xeabc('0x26')](function(){return _0x109e1d;});})[_0xeabc('0x26')](function(){_0x319119['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x459c8a,_0x5bf8f2){return function(_0x3c1b5b){if(!_0x3c1b5b){_0x459c8a[_0xeabc('0x1b')](0x194);}return _0x3c1b5b;};}function handleError(_0x48fb52,_0x2163e6){_0x2163e6=_0x2163e6||0x1f4;return function(_0x38572d){logger[_0xeabc('0x2b')](_0x38572d[_0xeabc('0x2c')]);if(_0x38572d[_0xeabc('0x2d')]){delete _0x38572d[_0xeabc('0x2d')];}_0x48fb52[_0xeabc('0x1c')](_0x2163e6)[_0xeabc('0x2e')](_0x38572d);};}exports[_0xeabc('0x2f')]=function(_0x5ebb86,_0x5b34dd){var _0x5bb1f1={},_0x2f03e8={},_0x2d027e={'count':0x0,'rows':[]};var _0x98b445=_[_0xeabc('0x30')](db[_0xeabc('0x31')][_0xeabc('0x32')],function(_0x61c0af){return{'name':_0x61c0af['fieldName'],'type':_0x61c0af[_0xeabc('0x33')][_0xeabc('0x34')]};});_0x2f03e8[_0xeabc('0x35')]=_['map'](_0x98b445,_0xeabc('0x2d'));_0x2f03e8[_0xeabc('0x36')]=_[_0xeabc('0x37')](_0x5ebb86['query']);_0x2f03e8[_0xeabc('0x38')]=_[_0xeabc('0x39')](_0x2f03e8[_0xeabc('0x35')],_0x2f03e8['query']);_0x5bb1f1[_0xeabc('0x3a')]=_[_0xeabc('0x39')](_0x2f03e8['model'],qs['fields'](_0x5ebb86[_0xeabc('0x36')][_0xeabc('0x3b')]));_0x5bb1f1['attributes']=_0x5bb1f1[_0xeabc('0x3a')][_0xeabc('0x3c')]?_0x5bb1f1[_0xeabc('0x3a')]:_0x2f03e8[_0xeabc('0x35')];if(!_0x5ebb86[_0xeabc('0x36')]['hasOwnProperty'](_0xeabc('0x3d'))){_0x5bb1f1['limit']=qs[_0xeabc('0x1e')](_0x5ebb86[_0xeabc('0x36')][_0xeabc('0x1e')]);_0x5bb1f1['offset']=qs['offset'](_0x5ebb86[_0xeabc('0x36')]['offset']);}_0x5bb1f1[_0xeabc('0x3e')]=qs['sort'](_0x5ebb86['query']['sort']);_0x5bb1f1['where']=qs[_0xeabc('0x38')](_['pick'](_0x5ebb86[_0xeabc('0x36')],_0x2f03e8[_0xeabc('0x38')]),_0x98b445);if(_0x5ebb86['query'][_0xeabc('0x3f')]){_0x5bb1f1['where']=_[_0xeabc('0x40')](_0x5bb1f1['where'],{'$or':_[_0xeabc('0x30')](_0x98b445,function(_0xf1b7ef){if(_0xf1b7ef[_0xeabc('0x33')]!=='VIRTUAL'){var _0x5a00d0={};_0x5a00d0[_0xf1b7ef['name']]={'$like':'%'+_0x5ebb86[_0xeabc('0x36')][_0xeabc('0x3f')]+'%'};return _0x5a00d0;}})});}_0x5bb1f1=_[_0xeabc('0x40')]({},_0x5bb1f1,_0x5ebb86['options']);var _0x4f1897={'where':_0x5bb1f1[_0xeabc('0x41')]};return db[_0xeabc('0x31')]['count'](_0x4f1897)[_0xeabc('0x26')](function(_0x5e0b78){_0x2d027e[_0xeabc('0x20')]=_0x5e0b78;if(_0x5ebb86['query']['includeAll']){_0x5bb1f1['include']=[{'all':!![]}];}return db[_0xeabc('0x31')][_0xeabc('0x42')](_0x5bb1f1);})[_0xeabc('0x26')](function(_0x3eeeb5){_0x2d027e['rows']=_0x3eeeb5;return _0x2d027e;})[_0xeabc('0x26')](respondWithFilteredResult(_0x5b34dd,_0x5bb1f1))['catch'](handleError(_0x5b34dd,null));};exports[_0xeabc('0x43')]=function(_0x1a4bbe,_0x3a7807){var _0x17a0df={'raw':!![],'where':{'id':_0x1a4bbe['params']['id']}},_0xc849c9={};_0xc849c9['model']=_[_0xeabc('0x37')](db['AnalyticDefaultReport'][_0xeabc('0x32')]);_0xc849c9[_0xeabc('0x36')]=_['keys'](_0x1a4bbe[_0xeabc('0x36')]);_0xc849c9[_0xeabc('0x38')]=_[_0xeabc('0x39')](_0xc849c9[_0xeabc('0x35')],_0xc849c9[_0xeabc('0x36')]);_0x17a0df[_0xeabc('0x3a')]=_[_0xeabc('0x39')](_0xc849c9['model'],qs[_0xeabc('0x3b')](_0x1a4bbe[_0xeabc('0x36')][_0xeabc('0x3b')]));_0x17a0df[_0xeabc('0x3a')]=_0x17a0df[_0xeabc('0x3a')][_0xeabc('0x3c')]?_0x17a0df[_0xeabc('0x3a')]:_0xc849c9[_0xeabc('0x35')];if(_0x1a4bbe[_0xeabc('0x36')][_0xeabc('0x44')]){_0x17a0df['include']=[{'all':!![]}];}_0x17a0df=_[_0xeabc('0x40')]({},_0x17a0df,_0x1a4bbe[_0xeabc('0x45')]);return db[_0xeabc('0x31')][_0xeabc('0x46')](_0x17a0df)[_0xeabc('0x26')](handleEntityNotFound(_0x3a7807,null))[_0xeabc('0x26')](respondWithResult(_0x3a7807,null))[_0xeabc('0x47')](handleError(_0x3a7807,null));};exports['create']=function(_0x766743,_0x32e09b){return db[_0xeabc('0x31')][_0xeabc('0x48')](_0x766743[_0xeabc('0x49')],{})['then'](function(_0x305946){var _0x2b2b9c=_0x766743[_0xeabc('0x4a')][_0xeabc('0x27')]({'plain':!![]});if(!_0x2b2b9c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2b2b9c[_0xeabc('0x4b')]===_0xeabc('0x4a')){var _0x568847=_0x305946[_0xeabc('0x27')]({'plain':!![]});var _0x5a0d4d=_0xeabc('0x4c');return db['UserProfileSection'][_0xeabc('0x46')]({'where':{'name':_0x5a0d4d,'userProfileId':_0x2b2b9c[_0xeabc('0x4d')]},'raw':!![]})[_0xeabc('0x26')](function(_0x1524c3){if(_0x1524c3&&_0x1524c3[_0xeabc('0x4e')]===0x0){return db[_0xeabc('0x29')][_0xeabc('0x48')]({'name':_0x568847[_0xeabc('0x2d')],'resourceId':_0x568847['id'],'type':_0xeabc('0x28'),'sectionId':_0x1524c3['id']},{})[_0xeabc('0x26')](function(){return _0x305946;});}else{return _0x305946;}})['catch'](function(_0x180a14){logger[_0xeabc('0x2b')](_0xeabc('0x4f'),_0x180a14);throw _0x180a14;});}return _0x305946;})[_0xeabc('0x26')](respondWithResult(_0x32e09b,0xc9))['catch'](handleError(_0x32e09b,null));};exports[_0xeabc('0x25')]=function(_0x392913,_0x10d56f){if(_0x392913[_0xeabc('0x49')]['id']){delete _0x392913['body']['id'];}return db[_0xeabc('0x31')][_0xeabc('0x46')]({'where':{'id':_0x392913[_0xeabc('0x50')]['id']}})[_0xeabc('0x26')](handleEntityNotFound(_0x10d56f,null))[_0xeabc('0x26')](saveUpdates(_0x392913[_0xeabc('0x49')],null))[_0xeabc('0x26')](respondWithResult(_0x10d56f,null))[_0xeabc('0x47')](handleError(_0x10d56f,null));};exports[_0xeabc('0x2a')]=function(_0x58ab08,_0x4546c4){return db['AnalyticDefaultReport']['find']({'where':{'id':_0x58ab08['params']['id']}})[_0xeabc('0x26')](handleEntityNotFound(_0x4546c4,null))[_0xeabc('0x26')](removeEntity(_0x4546c4,null))[_0xeabc('0x47')](handleError(_0x4546c4,null));};exports[_0xeabc('0x51')]=function(_0xe89728,_0x2f78f3){var _0x4a2ad6=0xa;var _0x4358d7=[_0xeabc('0x52'),_0xeabc('0x53'),_0xeabc('0x54'),_0xeabc('0x55')];var _0x2c7b4e={'SUM':_0xeabc('0x56'),'COUNT':_0xeabc('0x57'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0xeabc('0x58'),'AVG':_0xeabc('0x59'),'GROUP_CONCAT':_0xeabc('0x5a'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xeabc('0x5b')};var _0x536f42={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xeabc('0x5c'),'HOUR':_0xeabc('0x5d'),'ROUND':_0xeabc('0x5e'),'UNIX_TIMESTAMP':_0xeabc('0x5f')};var _0x26c784=function(_0xc2ef0c){return!_['includes']([_0xeabc('0x60'),_0xeabc('0x61'),_0xeabc('0x62'),_0xeabc('0x63')],_0xc2ef0c);};var _0x11cc1f=function(_0x514787){if(!_0x514787||!_0x514787['rules'][_0xeabc('0x3c')]){return'';}for(var _0x7b659f='(',_0x1b6675=0x0;_0x1b6675<_0x514787[_0xeabc('0x64')][_0xeabc('0x3c')];_0x1b6675+=0x1){_0x1b6675>0x0&&(_0x7b659f+='\x20'+_0x514787[_0xeabc('0x65')]+'\x20');_0x7b659f+=_0x514787[_0xeabc('0x64')][_0x1b6675][_0xeabc('0x66')]?_0x11cc1f(_0x514787[_0xeabc('0x64')][_0x1b6675]['group']):_0x514787[_0xeabc('0x64')][_0x1b6675]['field']+'\x20'+_0x514787[_0xeabc('0x64')][_0x1b6675][_0xeabc('0x67')]+(_0x26c784(_0x514787[_0xeabc('0x64')][_0x1b6675][_0xeabc('0x67')])?'\x20'+_0x514787[_0xeabc('0x64')][_0x1b6675][_0xeabc('0x68')]:'');}return _0x7b659f+')';};var _0xf48062={'where':{'id':_0xe89728[_0xeabc('0x50')]['id']}},_0xb59a2a,_0x5d4bc2,_0x24d0e5,_0x5702cb,_0x3fa31b;_0xf48062=_[_0xeabc('0x40')]({},_0xf48062,_0xe89728[_0xeabc('0x45')]);return db['AnalyticDefaultReport'][_0xeabc('0x46')](_0xf48062)['then'](function(_0x54e7d6){if(_0x54e7d6){_0xb59a2a=_0x54e7d6;return _0x54e7d6[_0xeabc('0x69')]();}return null;})[_0xeabc('0x26')](function(_0x23270a){if(_0x23270a){if(!_0x23270a[_0xeabc('0x3c')]){throw new db['Sequelize']['ValidationErrorItem'](_0xeabc('0x6a'),0x193);}_0x5d4bc2=_0x23270a;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})[_0xeabc('0x26')](function(_0x4f1a4f){if(_0x4f1a4f){_0x24d0e5=_['keyBy'](_0x4f1a4f,'id');var _0xa44f2d;var _0x1c84b5=squel['select']();_0x1c84b5['from'](_0xb59a2a[_0xeabc('0x6b')]);for(var _0x5d183a=0x0;_0x5d183a<_0x5d4bc2[_0xeabc('0x3c')];_0x5d183a+=0x1){_0xa44f2d=_0x5d4bc2[_0x5d183a][_0xeabc('0x6c')]?_0x24d0e5[_0x5d4bc2[_0x5d183a]['MetricId']]['metric']:_0x5d4bc2[_0x5d183a][_0xeabc('0x6d')];_0xa44f2d=_0x5d4bc2[_0x5d183a][_0xeabc('0x6e')]?_[_0xeabc('0x6f')](_0x2c7b4e[_0x5d4bc2[_0x5d183a][_0xeabc('0x6e')]],'%s',_0xa44f2d):_0xa44f2d;_0xa44f2d=_0x5d4bc2[_0x5d183a][_0xeabc('0x70')]?_['replace'](_0x536f42[_0x5d4bc2[_0x5d183a]['format']],'%s',_0xa44f2d):_0xa44f2d;if(_0x5d4bc2[_0x5d183a][_0xeabc('0x71')]){_0x1c84b5['group'](_0xa44f2d);}_0x5d4bc2[_0x5d183a][_0xeabc('0x72')]&&_0x1c84b5['order'](_0xa44f2d,_0x5d4bc2[_0x5d183a][_0xeabc('0x72')]==='DESC'?![]:!![]);_0x1c84b5[_0xeabc('0x6d')](_0xa44f2d,_0x5d4bc2[_0x5d183a]['alias']||_0xa44f2d);}if(_0xb59a2a[_0xeabc('0x73')]){_0xb59a2a[_0xeabc('0x73')]=JSON[_0xeabc('0x74')](_0xb59a2a[_0xeabc('0x73')]);for(var _0x5e121c=0x0;_0x5e121c<_0xb59a2a[_0xeabc('0x73')]['length'];_0x5e121c+=0x1){if(_0xb59a2a[_0xeabc('0x73')][_0x5e121c][_0xeabc('0x33')]&&_[_0xeabc('0x75')](_0x4358d7,_0xb59a2a[_0xeabc('0x73')][_0x5e121c][_0xeabc('0x33')])&&_0xb59a2a['joins'][_0x5e121c][_0xeabc('0x76')]&&_0xb59a2a[_0xeabc('0x73')][_0x5e121c][_0xeabc('0x77')]&&_0xb59a2a[_0xeabc('0x73')][_0x5e121c]['foreignKey']){_0x1c84b5[_0xb59a2a[_0xeabc('0x73')][_0x5e121c][_0xeabc('0x33')]](_0xb59a2a[_0xeabc('0x73')][_0x5e121c][_0xeabc('0x77')],null,util['format'](_0xeabc('0x78'),_0xb59a2a[_0xeabc('0x6b')],_0xb59a2a[_0xeabc('0x73')][_0x5e121c][_0xeabc('0x76')],_0xb59a2a['joins'][_0x5e121c]['foreignTable'],_0xb59a2a[_0xeabc('0x73')][_0x5e121c]['foreignKey']));}}}if(_0xb59a2a['conditions']){_0xb59a2a[_0xeabc('0x79')]=JSON[_0xeabc('0x74')](_0xb59a2a[_0xeabc('0x79')]);_0x1c84b5['where'](_0x11cc1f(_0xb59a2a[_0xeabc('0x79')][_0xeabc('0x66')]));}_0x3fa31b=_0x1c84b5['clone']();_0x1c84b5[_0xeabc('0x1e')](_0x4a2ad6);_0x1c84b5[_0xeabc('0x1d')](0x0);logger[_0xeabc('0x7a')](_0xeabc('0x7b'),_0x1c84b5[_0xeabc('0x7c')]());return dbH['sequelize'][_0xeabc('0x36')](_0x1c84b5['toString'](),{'type':dbH['sequelize']['QueryTypes'][_0xeabc('0x7d')]});}})[_0xeabc('0x26')](respondWithResult(_0x2f78f3,null))[_0xeabc('0x47')](handleError(_0x2f78f3,null));};function runReport(_0x4424ce,_0x33fa74,_0x51368f){var _0x39f961=_0x33fa74['name'];var _0x1795fe=0xa;var _0x2f95c7=['join',_0xeabc('0x53'),'right_join','cross_join'];var _0x952dc7={'SUM':_0xeabc('0x56'),'COUNT':_0xeabc('0x57'),'COUNT DISTINCT':_0xeabc('0x7e'),'MAX':_0xeabc('0x7f'),'MIN':'MIN(%s)','AVG':_0xeabc('0x59'),'GROUP_CONCAT':_0xeabc('0x5a'),'GROUP_CONCAT ASC':_0xeabc('0x80'),'GROUP_CONCAT DESC':_0xeabc('0x5b')};var _0x348064={'SEC_TO_TIME':_0xeabc('0x81'),'DATE':_0xeabc('0x5c'),'HOUR':_0xeabc('0x5d'),'ROUND':_0xeabc('0x5e'),'UNIX_TIMESTAMP':_0xeabc('0x5f')};var _0x522c6e=function(_0x436f8e){return!_[_0xeabc('0x75')]([_0xeabc('0x60'),'IS\x20NOT\x20NULL','IS\x20EMPTY',_0xeabc('0x63')],_0x436f8e);};var _0x273ca5=function(_0xe90200){if(!_0xe90200||!_0xe90200[_0xeabc('0x64')][_0xeabc('0x3c')]){return'';}for(var _0x5f5a47='(',_0x289f98=0x0;_0x289f98<_0xe90200['rules']['length'];_0x289f98+=0x1){_0x289f98>0x0&&(_0x5f5a47+='\x20'+_0xe90200[_0xeabc('0x65')]+'\x20');_0x5f5a47+=_0xe90200[_0xeabc('0x64')][_0x289f98]['group']?_0x273ca5(_0xe90200[_0xeabc('0x64')][_0x289f98][_0xeabc('0x66')]):_0xe90200[_0xeabc('0x64')][_0x289f98][_0xeabc('0x6d')]+'\x20'+_0xe90200[_0xeabc('0x64')][_0x289f98][_0xeabc('0x67')]+(_0x522c6e(_0xe90200[_0xeabc('0x64')][_0x289f98][_0xeabc('0x67')])?'\x20'+_0xe90200[_0xeabc('0x64')][_0x289f98][_0xeabc('0x68')]:'');}return _0x5f5a47+')';};var _0x1f8197={'where':{'id':_0x4424ce['id']}},_0x485c13,_0xb54c35,_0x5c9d6f,_0x1caaa7,_0x3e764a;_0x1f8197=_[_0xeabc('0x40')]({},_0x1f8197,_0x51368f);return db[_0xeabc('0x31')][_0xeabc('0x46')](_0x1f8197)[_0xeabc('0x26')](function(_0x40f51e){if(_0x40f51e){_0x485c13=_0x40f51e;return _0x40f51e[_0xeabc('0x69')]();}return null;})[_0xeabc('0x26')](function(_0x156e20){if(_0x156e20){if(!_0x156e20[_0xeabc('0x3c')]){throw new db['Sequelize'][(_0xeabc('0x82'))](_0xeabc('0x6a'),0x193);}_0xb54c35=_0x156e20;return db[_0xeabc('0x83')][_0xeabc('0x42')]({'raw':!![]});}return null;})['then'](function(_0x26c595){if(_0x26c595){_0x5c9d6f=_[_0xeabc('0x84')](_0x26c595,'id');var _0x580661;var _0x3de927=squel[_0xeabc('0x85')]();_0x3de927['from'](_0x485c13['table']);for(var _0x489b1d=0x0;_0x489b1d<_0xb54c35['length'];_0x489b1d+=0x1){_0x580661=_0xb54c35[_0x489b1d][_0xeabc('0x6c')]?_0x5c9d6f[_0xb54c35[_0x489b1d][_0xeabc('0x6c')]][_0xeabc('0x86')]:_0xb54c35[_0x489b1d][_0xeabc('0x6d')];_0x580661=_0xb54c35[_0x489b1d][_0xeabc('0x6e')]?_[_0xeabc('0x6f')](_0x952dc7[_0xb54c35[_0x489b1d][_0xeabc('0x6e')]],'%s',_0x580661):_0x580661;_0x580661=_0xb54c35[_0x489b1d][_0xeabc('0x70')]?_[_0xeabc('0x6f')](_0x348064[_0xb54c35[_0x489b1d][_0xeabc('0x70')]],'%s',_0x580661):_0x580661;if(_0xb54c35[_0x489b1d]['groupBy']){_0x3de927[_0xeabc('0x66')](_0x580661);}_0xb54c35[_0x489b1d][_0xeabc('0x72')]&&_0x3de927['order'](_0x580661,_0xb54c35[_0x489b1d][_0xeabc('0x72')]===_0xeabc('0x87')?![]:!![]);_0x3de927[_0xeabc('0x6d')](_0x580661,_0xb54c35[_0x489b1d]['alias']||_0x580661);}if(_0x485c13[_0xeabc('0x73')]){_0x485c13['joins']=JSON[_0xeabc('0x74')](_0x485c13[_0xeabc('0x73')]);for(var _0x1841f0=0x0;_0x1841f0<_0x485c13[_0xeabc('0x73')][_0xeabc('0x3c')];_0x1841f0+=0x1){if(_0x485c13['joins'][_0x1841f0]['type']&&_['includes'](_0x2f95c7,_0x485c13['joins'][_0x1841f0][_0xeabc('0x33')])&&_0x485c13[_0xeabc('0x73')][_0x1841f0][_0xeabc('0x76')]&&_0x485c13['joins'][_0x1841f0][_0xeabc('0x77')]&&_0x485c13[_0xeabc('0x73')][_0x1841f0][_0xeabc('0x88')]){_0x3de927[_0x485c13[_0xeabc('0x73')][_0x1841f0][_0xeabc('0x33')]](_0x485c13[_0xeabc('0x73')][_0x1841f0][_0xeabc('0x77')],null,util[_0xeabc('0x70')](_0xeabc('0x78'),_0x485c13[_0xeabc('0x6b')],_0x485c13[_0xeabc('0x73')][_0x1841f0][_0xeabc('0x76')],_0x485c13['joins'][_0x1841f0]['foreignTable'],_0x485c13[_0xeabc('0x73')][_0x1841f0]['foreignKey']));}}}if(_0x485c13[_0xeabc('0x79')]){_0x485c13[_0xeabc('0x79')]=JSON[_0xeabc('0x74')](_0x485c13['conditions']);_0x3de927[_0xeabc('0x41')](_0x273ca5(_0x485c13[_0xeabc('0x79')][_0xeabc('0x66')]));}_0x3e764a=_0x3de927['clone']();_0x3de927['limit'](_0x1795fe);_0x3de927[_0xeabc('0x1d')](0x0);return;}})[_0xeabc('0x26')](function(){if(_0x33fa74[_0xeabc('0x89')]===_0xeabc('0x8a')){return null;}var _0x2cc9b3=_[_0xeabc('0x40')](_0x33fa74,{'name':_0x33fa74['fullPath']||_0x33fa74['name']||_0x485c13[_0xeabc('0x2d')],'basename':_0x39f961,'savename':util[_0xeabc('0x70')](_0xeabc('0x8b'),_0x33fa74[_0xeabc('0x2d')]||_0x485c13['name'],require('randomstring')['generate'](0x4),_0x33fa74[_0xeabc('0x89')]||'csv'),'reportId':_0x485c13['id'],'reportType':_0xeabc('0x8c')});return db['AnalyticExtractedReport'][_0xeabc('0x48')](_0x2cc9b3,{'raw':!![]});})['then'](function(_0x6e6ab2){if(_0x485c13[_0xeabc('0x6b')]===_0xeabc('0x8d')){_0x3e764a[_0xeabc('0x41')](_0x485c13[_0xeabc('0x6b')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x33fa74[_0xeabc('0x8e')],_0x33fa74[_0xeabc('0x8f')]);}else{_0x3e764a[_0xeabc('0x41')](_0x485c13['table']+_0xeabc('0x90'),_0x33fa74[_0xeabc('0x8e')],_0x33fa74[_0xeabc('0x8f')]);}if(_0x6e6ab2){logger[_0xeabc('0x91')](_0xeabc('0x92'),_0x3e764a['toString']());require(_0xeabc('0x93'))[_0xeabc('0x94')](path['join'](__dirname,_0xeabc('0x95'),_0x6e6ab2[_0xeabc('0x89')]),[_0x6e6ab2['id'],_0x3e764a['toString'](),path[_0xeabc('0x52')](__dirname,_0xeabc('0x96'),_0x6e6ab2[_0xeabc('0x97')]),_0x39f961]);return _0x6e6ab2;}else{var _0x307d26=squel[_0xeabc('0x85')]();_0x307d26[_0xeabc('0x98')]('('+_0x3e764a[_0xeabc('0x7c')]()+')',_0xeabc('0x99'));_0x307d26[_0xeabc('0x6d')](_0xeabc('0x9a'),_0xeabc('0x20'));_0x3e764a[_0xeabc('0x1e')](_0x33fa74[_0xeabc('0x1e')]||_0x1795fe);_0x3e764a['offset'](_0x33fa74['offset']||0x0);return dbH[_0xeabc('0x9b')][_0xeabc('0x36')](_0x307d26[_0xeabc('0x7c')](),{'type':dbH[_0xeabc('0x9b')]['QueryTypes'][_0xeabc('0x7d')]})['then'](function(_0x49fba2){if(!_0x49fba2['length']){_0x1caaa7=0x0;}else{_0x1caaa7=_0x49fba2[0x0]['count']||0x0;}return dbH['sequelize']['query'](_0x3e764a[_0xeabc('0x7c')](),{'type':dbH[_0xeabc('0x9b')][_0xeabc('0x9c')][_0xeabc('0x7d')]});})[_0xeabc('0x26')](function(_0xe27492){return{'rows':_0xe27492||[],'count':_0x1caaa7};});}});}exports[_0xeabc('0x9d')]=function(_0x3eaedf,_0x44dc85){return runReport(_0x3eaedf['params'],_0x3eaedf[_0xeabc('0x36')],_0x3eaedf[_0xeabc('0x45')])[_0xeabc('0x26')](respondWithResult(_0x44dc85,null))[_0xeabc('0x47')](handleError(_0x44dc85,null));};exports[_0xeabc('0x9e')]=runReport;exports[_0xeabc('0x36')]=function(_0x2a29d7,_0x5bb5d6){var _0x3513ce=0xa;var _0x58cb5d=[_0xeabc('0x52'),_0xeabc('0x53'),'right_join',_0xeabc('0x55')];var _0x4c8bf3={'SUM':_0xeabc('0x56'),'COUNT':_0xeabc('0x57'),'COUNT DISTINCT':_0xeabc('0x7e'),'MAX':_0xeabc('0x7f'),'MIN':_0xeabc('0x58'),'AVG':_0xeabc('0x59'),'GROUP_CONCAT':_0xeabc('0x5a'),'GROUP_CONCAT ASC':_0xeabc('0x80'),'GROUP_CONCAT DESC':_0xeabc('0x5b')};var _0x484c75={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xeabc('0x5c'),'HOUR':_0xeabc('0x5d'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xeabc('0x5f')};var _0x580f72=function(_0x37907a){return!_[_0xeabc('0x75')]([_0xeabc('0x60'),_0xeabc('0x61'),_0xeabc('0x62'),_0xeabc('0x63')],_0x37907a);};var _0x57db6d=function(_0x13cc55){if(!_0x13cc55||!_0x13cc55['rules'][_0xeabc('0x3c')]){return'';}for(var _0x43b88e='(',_0x1fa464=0x0;_0x1fa464<_0x13cc55[_0xeabc('0x64')]['length'];_0x1fa464+=0x1){_0x1fa464>0x0&&(_0x43b88e+='\x20'+_0x13cc55[_0xeabc('0x65')]+'\x20');_0x43b88e+=_0x13cc55[_0xeabc('0x64')][_0x1fa464][_0xeabc('0x66')]?_0x57db6d(_0x13cc55['rules'][_0x1fa464][_0xeabc('0x66')]):_0x13cc55[_0xeabc('0x64')][_0x1fa464][_0xeabc('0x6d')]+'\x20'+_0x13cc55['rules'][_0x1fa464]['condition']+(_0x580f72(_0x13cc55['rules'][_0x1fa464]['condition'])?'\x20'+_0x13cc55[_0xeabc('0x64')][_0x1fa464][_0xeabc('0x68')]:'');}return _0x43b88e+')';};var _0x52e84f={'where':{'id':_0x2a29d7[_0xeabc('0x50')]['id']}},_0x12f024,_0x1d35da,_0x2695a4,_0x199251,_0x1899d6;_0x52e84f=_[_0xeabc('0x40')]({},_0x52e84f,_0x2a29d7[_0xeabc('0x45')]);return db[_0xeabc('0x31')]['find'](_0x52e84f)[_0xeabc('0x26')](function(_0x5bb015){if(_0x5bb015){_0x12f024=_0x5bb015;return _0x5bb015[_0xeabc('0x69')]();}return null;})[_0xeabc('0x26')](function(_0x438ce3){if(_0x438ce3){if(!_0x438ce3[_0xeabc('0x3c')]){throw new db[(_0xeabc('0x9f'))][(_0xeabc('0x82'))](_0xeabc('0x6a'),0x193);}_0x1d35da=_0x438ce3;return db['AnalyticMetric'][_0xeabc('0x42')]({'raw':!![]});}return null;})['then'](function(_0x475160){if(_0x475160){_0x2695a4=_['keyBy'](_0x475160,'id');var _0x10d66b;var _0x12a042=squel[_0xeabc('0x85')]();_0x12a042[_0xeabc('0x98')](_0x12f024[_0xeabc('0x6b')]);for(var _0x49bf0f=0x0;_0x49bf0f<_0x1d35da[_0xeabc('0x3c')];_0x49bf0f+=0x1){_0x10d66b=_0x1d35da[_0x49bf0f][_0xeabc('0x6c')]?_0x2695a4[_0x1d35da[_0x49bf0f][_0xeabc('0x6c')]][_0xeabc('0x86')]:_0x1d35da[_0x49bf0f][_0xeabc('0x6d')];_0x10d66b=_0x1d35da[_0x49bf0f]['function']?_[_0xeabc('0x6f')](_0x4c8bf3[_0x1d35da[_0x49bf0f][_0xeabc('0x6e')]],'%s',_0x10d66b):_0x10d66b;_0x10d66b=_0x1d35da[_0x49bf0f][_0xeabc('0x70')]?_[_0xeabc('0x6f')](_0x484c75[_0x1d35da[_0x49bf0f][_0xeabc('0x70')]],'%s',_0x10d66b):_0x10d66b;if(_0x1d35da[_0x49bf0f]['groupBy']){_0x12a042[_0xeabc('0x66')](_0x10d66b);}_0x1d35da[_0x49bf0f]['orderBy']&&_0x12a042[_0xeabc('0x3e')](_0x10d66b,_0x1d35da[_0x49bf0f][_0xeabc('0x72')]===_0xeabc('0x87')?![]:!![]);_0x12a042[_0xeabc('0x6d')](_0x10d66b,_0x1d35da[_0x49bf0f][_0xeabc('0xa0')]||_0x10d66b);}if(_0x12f024[_0xeabc('0x73')]){_0x12f024[_0xeabc('0x73')]=JSON[_0xeabc('0x74')](_0x12f024[_0xeabc('0x73')]);for(var _0x223a3=0x0;_0x223a3<_0x12f024['joins'][_0xeabc('0x3c')];_0x223a3+=0x1){if(_0x12f024[_0xeabc('0x73')][_0x223a3][_0xeabc('0x33')]&&_[_0xeabc('0x75')](_0x58cb5d,_0x12f024['joins'][_0x223a3][_0xeabc('0x33')])&&_0x12f024['joins'][_0x223a3]['parentKey']&&_0x12f024[_0xeabc('0x73')][_0x223a3][_0xeabc('0x77')]&&_0x12f024[_0xeabc('0x73')][_0x223a3]['foreignKey']){_0x12a042[_0x12f024[_0xeabc('0x73')][_0x223a3][_0xeabc('0x33')]](_0x12f024[_0xeabc('0x73')][_0x223a3][_0xeabc('0x77')],null,util[_0xeabc('0x70')]('%s.%s\x20=\x20%s.%s',_0x12f024[_0xeabc('0x6b')],_0x12f024[_0xeabc('0x73')][_0x223a3]['parentKey'],_0x12f024['joins'][_0x223a3][_0xeabc('0x77')],_0x12f024[_0xeabc('0x73')][_0x223a3][_0xeabc('0x88')]));}}}if(_0x12f024[_0xeabc('0x79')]){_0x12f024[_0xeabc('0x79')]=JSON[_0xeabc('0x74')](_0x12f024[_0xeabc('0x79')]);_0x12a042[_0xeabc('0x41')](_0x57db6d(_0x12f024[_0xeabc('0x79')]['group']));}_0x1899d6=_0x12a042[_0xeabc('0xa1')]();_0x12a042['limit'](_0x3513ce);_0x12a042[_0xeabc('0x1d')](0x0);logger['debug'](_0xeabc('0x7b'),_0x12a042[_0xeabc('0x7c')]());return dbH[_0xeabc('0x9b')][_0xeabc('0x36')](_0x12a042[_0xeabc('0x7c')](),{'type':dbH[_0xeabc('0x9b')][_0xeabc('0x9c')][_0xeabc('0x7d')]});}})[_0xeabc('0x26')](function(){return{'sql':_0x1899d6[_0xeabc('0x7c')]()};})['then'](respondWithResult(_0x5bb5d6,null))['catch'](handleError(_0x5bb5d6,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index 813dba5..1da797c 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 _0x5e01=['request-promise','path','rimraf','../../config/environment','./analyticDefaultReport.attributes','exports','lodash','util','../../config/logger'];(function(_0x4a747d,_0x3b747f){var _0x3a5b5c=function(_0x4b3e81){while(--_0x4b3e81){_0x4a747d['push'](_0x4a747d['shift']());}};_0x3a5b5c(++_0x3b747f);}(_0x5e01,0x1a4));var _0x15e0=function(_0x2064e5,_0x4f6fa2){_0x2064e5=_0x2064e5-0x0;var _0x21a233=_0x5e01[_0x2064e5];return _0x21a233;};'use strict';var _=require(_0x15e0('0x0'));var util=require(_0x15e0('0x1'));var logger=require(_0x15e0('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x15e0('0x3'));var fs=require('fs');var path=require(_0x15e0('0x4'));var rimraf=require(_0x15e0('0x5'));var config=require(_0x15e0('0x6'));var attributes=require(_0x15e0('0x7'));module[_0x15e0('0x8')]=function(_0x7b7014,_0x21e9d4){return _0x7b7014['define']('AnalyticDefaultReport',attributes,{'tableName':'analytics_default_reports','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe1f0=['path','rimraf','../../config/environment','./analyticDefaultReport.attributes','exports','define','lodash','util','../../config/logger','moment','request-promise'];(function(_0x18f0bd,_0x2675c3){var _0x314678=function(_0x558bff){while(--_0x558bff){_0x18f0bd['push'](_0x18f0bd['shift']());}};_0x314678(++_0x2675c3);}(_0xe1f0,0xb6));var _0x0e1f=function(_0xefd2f7,_0x2d5e3e){_0xefd2f7=_0xefd2f7-0x0;var _0x2dbe8e=_0xe1f0[_0xefd2f7];return _0x2dbe8e;};'use strict';var _=require(_0x0e1f('0x0'));var util=require(_0x0e1f('0x1'));var logger=require(_0x0e1f('0x2'))('api');var moment=require(_0x0e1f('0x3'));var BPromise=require('bluebird');var rp=require(_0x0e1f('0x4'));var fs=require('fs');var path=require(_0x0e1f('0x5'));var rimraf=require(_0x0e1f('0x6'));var config=require(_0x0e1f('0x7'));var attributes=require(_0x0e1f('0x8'));module[_0x0e1f('0x9')]=function(_0x1f1a61,_0x543f5e){return _0x1f1a61[_0x0e1f('0xa')]('AnalyticDefaultReport',attributes,{'tableName':'analytics_default_reports','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js b/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js index aed3fef..0942d4e 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 _0xd160=['catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client','request','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x43b99a,_0x327ce5){var _0x13085b=function(_0x326752){while(--_0x326752){_0x43b99a['push'](_0x43b99a['shift']());}};_0x13085b(++_0x327ce5);}(_0xd160,0xb5));var _0x0d16=function(_0x277721,_0x46971e){_0x277721=_0x277721-0x0;var _0x286051=_0xd160[_0x277721];return _0x286051;};'use strict';var _=require(_0x0d16('0x0'));var util=require('util');var moment=require(_0x0d16('0x1'));var BPromise=require(_0x0d16('0x2'));var rs=require(_0x0d16('0x3'));var fs=require('fs');var Redis=require(_0x0d16('0x4'));var db=require(_0x0d16('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0d16('0x6'))(_0x0d16('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0d16('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2f3b5b,_0x25ba58,_0x991bc2){return new BPromise(function(_0x42b8e6,_0x5a6990){return client[_0x0d16('0x9')](_0x2f3b5b,_0x991bc2)['then'](function(_0x48e1a3){logger[_0x0d16('0xa')](_0x0d16('0xb'),_0x25ba58,_0x0d16('0xc'));logger['debug'](_0x0d16('0xd'),_0x25ba58,_0x0d16('0xc'),JSON[_0x0d16('0xe')](_0x48e1a3));if(_0x48e1a3['error']){if(_0x48e1a3[_0x0d16('0xf')][_0x0d16('0x10')]===0x1f4){logger[_0x0d16('0xf')](_0x0d16('0xb'),_0x25ba58,_0x48e1a3['error'][_0x0d16('0x11')]);return _0x5a6990(_0x48e1a3[_0x0d16('0xf')][_0x0d16('0x11')]);}logger['error'](_0x0d16('0xb'),_0x25ba58,_0x48e1a3[_0x0d16('0xf')][_0x0d16('0x11')]);return _0x42b8e6(_0x48e1a3[_0x0d16('0xf')][_0x0d16('0x11')]);}else{logger[_0x0d16('0xa')](_0x0d16('0xb'),_0x25ba58,_0x0d16('0xc'));_0x42b8e6(_0x48e1a3[_0x0d16('0x12')][_0x0d16('0x11')]);}})[_0x0d16('0x13')](function(_0x2086a4){logger[_0x0d16('0xf')](_0x0d16('0xb'),_0x25ba58,_0x2086a4);_0x5a6990(_0x2086a4);});});} \ No newline at end of file +var _0x40f8=['request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticDefaultReport,\x20%s,\x20%s'];(function(_0x1930ff,_0x40c327){var _0x5d5eb0=function(_0x517263){while(--_0x517263){_0x1930ff['push'](_0x1930ff['shift']());}};_0x5d5eb0(++_0x40c327);}(_0x40f8,0x98));var _0x840f=function(_0x422af6,_0x61bbee){_0x422af6=_0x422af6-0x0;var _0xc53f63=_0x40f8[_0x422af6];return _0xc53f63;};'use strict';var _=require(_0x840f('0x0'));var util=require(_0x840f('0x1'));var moment=require(_0x840f('0x2'));var BPromise=require('bluebird');var rs=require(_0x840f('0x3'));var fs=require('fs');var Redis=require(_0x840f('0x4'));var db=require(_0x840f('0x5'))['db'];var utils=require(_0x840f('0x6'));var logger=require('../../config/logger')(_0x840f('0x7'));var config=require(_0x840f('0x8'));var jayson=require(_0x840f('0x9'));var client=jayson[_0x840f('0xa')][_0x840f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x20493b,_0x367c85,_0x51a421){return new BPromise(function(_0xba7077,_0x4cf8e9){return client[_0x840f('0xc')](_0x20493b,_0x51a421)[_0x840f('0xd')](function(_0x4fe0ce){logger[_0x840f('0xe')](_0x840f('0xf'),_0x367c85,_0x840f('0x10'));logger[_0x840f('0x11')](_0x840f('0x12'),_0x367c85,_0x840f('0x10'),JSON['stringify'](_0x4fe0ce));if(_0x4fe0ce['error']){if(_0x4fe0ce['error'][_0x840f('0x13')]===0x1f4){logger[_0x840f('0x14')](_0x840f('0xf'),_0x367c85,_0x4fe0ce[_0x840f('0x14')][_0x840f('0x15')]);return _0x4cf8e9(_0x4fe0ce[_0x840f('0x14')][_0x840f('0x15')]);}logger[_0x840f('0x14')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x367c85,_0x4fe0ce[_0x840f('0x14')][_0x840f('0x15')]);return _0xba7077(_0x4fe0ce[_0x840f('0x14')][_0x840f('0x15')]);}else{logger[_0x840f('0xe')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x367c85,_0x840f('0x10'));_0xba7077(_0x4fe0ce[_0x840f('0x16')][_0x840f('0x15')]);}})[_0x840f('0x17')](function(_0x43670f){logger['error'](_0x840f('0xf'),_0x367c85,_0x43670f);_0x4cf8e9(_0x43670f);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index 24ab71b..5796089 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 _0x97f4=['run','/:id/query','query','post','create','put','/:id','delete','exports','multer','util','path','express','Router','../../components/auth/service','./analyticDefaultReport.controller','get','isAuthenticated','index','/:id/preview','preview','/:id/run'];(function(_0x36c5b0,_0x5001da){var _0xf19333=function(_0x1e880a){while(--_0x1e880a){_0x36c5b0['push'](_0x36c5b0['shift']());}};_0xf19333(++_0x5001da);}(_0x97f4,0xcf));var _0x497f=function(_0xbc0aa9,_0x42737e){_0xbc0aa9=_0xbc0aa9-0x0;var _0x526f8c=_0x97f4[_0xbc0aa9];return _0x526f8c;};'use strict';var multer=require(_0x497f('0x0'));var util=require(_0x497f('0x1'));var path=require(_0x497f('0x2'));var timeout=require('connect-timeout');var express=require(_0x497f('0x3'));var router=express[_0x497f('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x497f('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x497f('0x6'));router[_0x497f('0x7')]('/',auth[_0x497f('0x8')](),controller[_0x497f('0x9')]);router[_0x497f('0x7')]('/:id',auth[_0x497f('0x8')](),controller['show']);router[_0x497f('0x7')](_0x497f('0xa'),auth[_0x497f('0x8')](),controller[_0x497f('0xb')]);router['get'](_0x497f('0xc'),auth[_0x497f('0x8')](),controller[_0x497f('0xd')]);router[_0x497f('0x7')](_0x497f('0xe'),auth[_0x497f('0x8')](),controller[_0x497f('0xf')]);router[_0x497f('0x10')]('/',auth[_0x497f('0x8')](),controller[_0x497f('0x11')]);router[_0x497f('0x12')](_0x497f('0x13'),auth[_0x497f('0x8')](),controller['update']);router[_0x497f('0x14')](_0x497f('0x13'),auth['isAuthenticated'](),controller['destroy']);module[_0x497f('0x15')]=router; \ No newline at end of file +var _0xb7a0=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','/:id/preview','/:id/run','run','/:id/query','query','create','update','delete','destroy','exports','util','path'];(function(_0x41565b,_0x4b583f){var _0x2fa14d=function(_0x407a0a){while(--_0x407a0a){_0x41565b['push'](_0x41565b['shift']());}};_0x2fa14d(++_0x4b583f);}(_0xb7a0,0xfa));var _0x0b7a=function(_0x2fc276,_0x2c7e31){_0x2fc276=_0x2fc276-0x0;var _0x48db4b=_0xb7a0[_0x2fc276];return _0x48db4b;};'use strict';var multer=require('multer');var util=require(_0x0b7a('0x0'));var path=require(_0x0b7a('0x1'));var timeout=require(_0x0b7a('0x2'));var express=require(_0x0b7a('0x3'));var router=express[_0x0b7a('0x4')]();var fs_extra=require(_0x0b7a('0x5'));var auth=require(_0x0b7a('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x0b7a('0x7'));var controller=require('./analyticDefaultReport.controller');router[_0x0b7a('0x8')]('/',auth[_0x0b7a('0x9')](),controller['index']);router[_0x0b7a('0x8')](_0x0b7a('0xa'),auth[_0x0b7a('0x9')](),controller['show']);router[_0x0b7a('0x8')](_0x0b7a('0xb'),auth[_0x0b7a('0x9')](),controller['preview']);router[_0x0b7a('0x8')](_0x0b7a('0xc'),auth[_0x0b7a('0x9')](),controller[_0x0b7a('0xd')]);router[_0x0b7a('0x8')](_0x0b7a('0xe'),auth['isAuthenticated'](),controller[_0x0b7a('0xf')]);router['post']('/',auth[_0x0b7a('0x9')](),controller[_0x0b7a('0x10')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x0b7a('0x11')]);router[_0x0b7a('0x12')](_0x0b7a('0xa'),auth['isAuthenticated'](),controller[_0x0b7a('0x13')]);module[_0x0b7a('0x14')]=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index 3dc0e09..b4fa4e0 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 _0x12e2=['DATE','Loading','scheduled','manual','UNSIGNED','moment','exports','STRING','ENUM','pdf','xlsx','csv'];(function(_0x24f315,_0x5d4cd5){var _0x51756b=function(_0x48608e){while(--_0x48608e){_0x24f315['push'](_0x24f315['shift']());}};_0x51756b(++_0x5d4cd5);}(_0x12e2,0x1c1));var _0x212e=function(_0x3568de,_0x25121a){_0x3568de=_0x3568de-0x0;var _0x2def51=_0x12e2[_0x3568de];return _0x2def51;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x212e('0x0'));module[_0x212e('0x1')]={'name':{'type':Sequelize[_0x212e('0x2')],'allowNull':![]},'basename':{'type':Sequelize['STRING'],'allowNull':![]},'output':{'type':Sequelize[_0x212e('0x3')]('csv',_0x212e('0x4'),_0x212e('0x5')),'allowNull':![],'defaultValue':_0x212e('0x6')},'savename':{'type':Sequelize[_0x212e('0x2')],'allowNull':![]},'startDate':{'type':Sequelize[_0x212e('0x7')]},'endDate':{'type':Sequelize[_0x212e('0x7')]},'status':{'type':Sequelize[_0x212e('0x2')],'defaultValue':_0x212e('0x8')},'type':{'type':Sequelize[_0x212e('0x3')]('manual',_0x212e('0x9')),'allowNull':![],'defaultValue':_0x212e('0xa')},'reportId':{'type':Sequelize['INTEGER'](0xb)[_0x212e('0xb')]},'reportType':{'type':Sequelize[_0x212e('0x2')]}}; \ No newline at end of file +var _0x0639=['manual','scheduled','INTEGER','sequelize','moment','exports','STRING','ENUM','pdf','xlsx','DATE','Loading'];(function(_0x2870f1,_0x54e83a){var _0x4ebc99=function(_0x3b4a87){while(--_0x3b4a87){_0x2870f1['push'](_0x2870f1['shift']());}};_0x4ebc99(++_0x54e83a);}(_0x0639,0x7b));var _0x9063=function(_0x3c22e0,_0x1dc6ea){_0x3c22e0=_0x3c22e0-0x0;var _0x215811=_0x0639[_0x3c22e0];return _0x215811;};'use strict';var Sequelize=require(_0x9063('0x0'));var moment=require(_0x9063('0x1'));module[_0x9063('0x2')]={'name':{'type':Sequelize[_0x9063('0x3')],'allowNull':![]},'basename':{'type':Sequelize[_0x9063('0x3')],'allowNull':![]},'output':{'type':Sequelize[_0x9063('0x4')]('csv',_0x9063('0x5'),_0x9063('0x6')),'allowNull':![],'defaultValue':'csv'},'savename':{'type':Sequelize[_0x9063('0x3')],'allowNull':![]},'startDate':{'type':Sequelize[_0x9063('0x7')]},'endDate':{'type':Sequelize[_0x9063('0x7')]},'status':{'type':Sequelize[_0x9063('0x3')],'defaultValue':_0x9063('0x8')},'type':{'type':Sequelize[_0x9063('0x4')](_0x9063('0x9'),_0x9063('0xa')),'allowNull':![],'defaultValue':_0x9063('0x9')},'reportId':{'type':Sequelize[_0x9063('0xb')](0xb)['UNSIGNED']},'reportType':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index 5620394..d03cbc3 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 _0x2715=['ExtractedReports','UserProfileResource','sendStatus','error','stack','name','map','rawAttributes','type','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','AnalyticExtractedReport','includeAll','include','findAll','rows','show','params','keys','find','catch','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','download','basename','savename','output','existsSync','join','root','server/files/reports','Sequelize','ValidationError','exists','format','eml-format','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','offset','undefined','limit','count','set','Content-Range','reject','save','then','destroy','get'];(function(_0x557d85,_0x314b93){var _0x4cf2fb=function(_0x583756){while(--_0x583756){_0x557d85['push'](_0x557d85['shift']());}};_0x4cf2fb(++_0x314b93);}(_0x2715,0x1ac));var _0x5271=function(_0x20508d,_0x29e57f){_0x20508d=_0x20508d-0x0;var _0x278bb8=_0x2715[_0x20508d];return _0x278bb8;};'use strict';var emlformat=require(_0x5271('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x5271('0x1'));var rp=require('request-promise');var moment=require(_0x5271('0x2'));var BPromise=require(_0x5271('0x3'));var Mustache=require(_0x5271('0x4'));var util=require(_0x5271('0x5'));var path=require(_0x5271('0x6'));var sox=require(_0x5271('0x7'));var csv=require('to-csv');var ejs=require(_0x5271('0x8'));var fs=require('fs');var fs_extra=require(_0x5271('0x9'));var _=require(_0x5271('0xa'));var squel=require(_0x5271('0xb'));var crypto=require(_0x5271('0xc'));var jsforce=require(_0x5271('0xd'));var deskjs=require(_0x5271('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x5271('0xf'));var Redis=require('ioredis');var authService=require(_0x5271('0x10'));var qs=require(_0x5271('0x11'));var as=require(_0x5271('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5271('0x13'))(_0x5271('0x14'));var utils=require(_0x5271('0x15'));var config=require(_0x5271('0x16'));var licenseUtil=require(_0x5271('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x36999c,_0x3aa025){_0x3aa025=_0x3aa025||0xcc;return function(_0x2d36c7){if(_0x2d36c7){return _0x36999c['sendStatus'](_0x3aa025);}return _0x36999c[_0x5271('0x18')](_0x3aa025)[_0x5271('0x19')]();};}function respondWithResult(_0x4397d9,_0x2e624d){_0x2e624d=_0x2e624d||0xc8;return function(_0x3df841){if(_0x3df841){return _0x4397d9[_0x5271('0x18')](_0x2e624d)['json'](_0x3df841);}};}function respondWithFilteredResult(_0x126b11,_0x215d4a){return function(_0x490e25){if(_0x490e25){var _0x331668=typeof _0x215d4a[_0x5271('0x1a')]===_0x5271('0x1b')&&typeof _0x215d4a[_0x5271('0x1c')]===_0x5271('0x1b');var _0x5b7330=_0x490e25[_0x5271('0x1d')];var _0x2e942d=_0x331668?0x0:_0x215d4a[_0x5271('0x1a')];var _0xf39aa1=_0x331668?_0x490e25[_0x5271('0x1d')]:_0x215d4a[_0x5271('0x1a')]+_0x215d4a[_0x5271('0x1c')];var _0x390096;if(_0xf39aa1>=_0x5b7330){_0xf39aa1=_0x5b7330;_0x390096=0xc8;}else{_0x390096=0xce;}_0x126b11[_0x5271('0x18')](_0x390096);return _0x126b11[_0x5271('0x1e')](_0x5271('0x1f'),_0x2e942d+'-'+_0xf39aa1+'/'+_0x5b7330)['json'](_0x490e25);}return null;};}function patchUpdates(_0x5db04b){return function(_0x24d786){try{jsonpatch['apply'](_0x24d786,_0x5db04b,!![]);}catch(_0x3ff4e1){return BPromise[_0x5271('0x20')](_0x3ff4e1);}return _0x24d786[_0x5271('0x21')]();};}function saveUpdates(_0x338673,_0x5cf4b1){return function(_0x5c139e){if(_0x5c139e){return _0x5c139e['update'](_0x338673)[_0x5271('0x22')](function(_0x2f0154){return _0x2f0154;});}return null;};}function removeEntity(_0x25f935,_0x565c32){return function(_0x57539d){if(_0x57539d){return _0x57539d[_0x5271('0x23')]()['then'](function(){var _0x1daa39=_0x57539d[_0x5271('0x24')]({'plain':!![]});var _0x2b03c5=_0x5271('0x25');return db[_0x5271('0x26')][_0x5271('0x23')]({'where':{'type':_0x2b03c5,'resourceId':_0x1daa39['id']}})[_0x5271('0x22')](function(){return _0x57539d;});})[_0x5271('0x22')](function(){_0x25f935[_0x5271('0x18')](0xcc)[_0x5271('0x19')]();});}};}function handleEntityNotFound(_0x566403,_0x28734e){return function(_0x192b9f){if(!_0x192b9f){_0x566403[_0x5271('0x27')](0x194);}return _0x192b9f;};}function handleError(_0x18319e,_0x443e58){_0x443e58=_0x443e58||0x1f4;return function(_0x4f5f68){logger[_0x5271('0x28')](_0x4f5f68[_0x5271('0x29')]);if(_0x4f5f68[_0x5271('0x2a')]){delete _0x4f5f68['name'];}_0x18319e[_0x5271('0x18')](_0x443e58)['send'](_0x4f5f68);};}exports['index']=function(_0x168007,_0x305dc0){var _0x1068f9={},_0x56a145={},_0x16d26e={'count':0x0,'rows':[]};var _0x363cce=_[_0x5271('0x2b')](db['AnalyticExtractedReport'][_0x5271('0x2c')],function(_0x33d8f1){return{'name':_0x33d8f1['fieldName'],'type':_0x33d8f1[_0x5271('0x2d')][_0x5271('0x2e')]};});_0x56a145[_0x5271('0x2f')]=_['map'](_0x363cce,_0x5271('0x2a'));_0x56a145[_0x5271('0x30')]=_['keys'](_0x168007['query']);_0x56a145[_0x5271('0x31')]=_[_0x5271('0x32')](_0x56a145[_0x5271('0x2f')],_0x56a145[_0x5271('0x30')]);_0x1068f9['attributes']=_[_0x5271('0x32')](_0x56a145[_0x5271('0x2f')],qs[_0x5271('0x33')](_0x168007[_0x5271('0x30')][_0x5271('0x33')]));_0x1068f9[_0x5271('0x34')]=_0x1068f9[_0x5271('0x34')]['length']?_0x1068f9['attributes']:_0x56a145['model'];if(!_0x168007['query'][_0x5271('0x35')](_0x5271('0x36'))){_0x1068f9['limit']=qs[_0x5271('0x1c')](_0x168007[_0x5271('0x30')][_0x5271('0x1c')]);_0x1068f9['offset']=qs[_0x5271('0x1a')](_0x168007['query'][_0x5271('0x1a')]);}_0x1068f9[_0x5271('0x37')]=qs[_0x5271('0x38')](_0x168007['query']['sort']);_0x1068f9['where']=qs[_0x5271('0x31')](_[_0x5271('0x39')](_0x168007['query'],_0x56a145[_0x5271('0x31')]),_0x363cce);if(_0x168007['query'][_0x5271('0x3a')]){_0x1068f9[_0x5271('0x3b')]=_[_0x5271('0x3c')](_0x1068f9[_0x5271('0x3b')],{'$or':_[_0x5271('0x2b')](_0x363cce,function(_0x3fd9d5){if(_0x3fd9d5['type']!==_0x5271('0x3d')){var _0x26aed5={};_0x26aed5[_0x3fd9d5['name']]={'$like':'%'+_0x168007[_0x5271('0x30')]['filter']+'%'};return _0x26aed5;}})});}_0x1068f9=_[_0x5271('0x3c')]({},_0x1068f9,_0x168007[_0x5271('0x3e')]);var _0x1baaf7={'where':_0x1068f9[_0x5271('0x3b')]};return db[_0x5271('0x3f')][_0x5271('0x1d')](_0x1baaf7)[_0x5271('0x22')](function(_0x42d9d2){_0x16d26e['count']=_0x42d9d2;if(_0x168007['query'][_0x5271('0x40')]){_0x1068f9[_0x5271('0x41')]=[{'all':!![]}];}return db[_0x5271('0x3f')][_0x5271('0x42')](_0x1068f9);})['then'](function(_0x29e31f){_0x16d26e[_0x5271('0x43')]=_0x29e31f;return _0x16d26e;})[_0x5271('0x22')](respondWithFilteredResult(_0x305dc0,_0x1068f9))['catch'](handleError(_0x305dc0,null));};exports[_0x5271('0x44')]=function(_0x294f5a,_0x47ea56){var _0x297c3f={'raw':!![],'where':{'id':_0x294f5a[_0x5271('0x45')]['id']}},_0x5abbca={};_0x5abbca[_0x5271('0x2f')]=_[_0x5271('0x46')](db['AnalyticExtractedReport']['rawAttributes']);_0x5abbca['query']=_[_0x5271('0x46')](_0x294f5a['query']);_0x5abbca[_0x5271('0x31')]=_[_0x5271('0x32')](_0x5abbca[_0x5271('0x2f')],_0x5abbca[_0x5271('0x30')]);_0x297c3f['attributes']=_[_0x5271('0x32')](_0x5abbca[_0x5271('0x2f')],qs[_0x5271('0x33')](_0x294f5a['query'][_0x5271('0x33')]));_0x297c3f[_0x5271('0x34')]=_0x297c3f[_0x5271('0x34')]['length']?_0x297c3f[_0x5271('0x34')]:_0x5abbca[_0x5271('0x2f')];if(_0x294f5a[_0x5271('0x30')][_0x5271('0x40')]){_0x297c3f['include']=[{'all':!![]}];}_0x297c3f=_[_0x5271('0x3c')]({},_0x297c3f,_0x294f5a[_0x5271('0x3e')]);return db['AnalyticExtractedReport'][_0x5271('0x47')](_0x297c3f)[_0x5271('0x22')](handleEntityNotFound(_0x47ea56,null))[_0x5271('0x22')](respondWithResult(_0x47ea56,null))[_0x5271('0x48')](handleError(_0x47ea56,null));};exports[_0x5271('0x49')]=function(_0x436868,_0x3ec533){return db[_0x5271('0x3f')]['create'](_0x436868[_0x5271('0x4a')],{})[_0x5271('0x22')](function(_0x2897d3){var _0x579eed=_0x436868[_0x5271('0x4b')][_0x5271('0x24')]({'plain':!![]});if(!_0x579eed)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x579eed[_0x5271('0x4c')]===_0x5271('0x4b')){var _0x247139=_0x2897d3[_0x5271('0x24')]({'plain':!![]});var _0x2a0400='ExtractedReports';return db[_0x5271('0x4d')]['find']({'where':{'name':_0x2a0400,'userProfileId':_0x579eed[_0x5271('0x4e')]},'raw':!![]})[_0x5271('0x22')](function(_0x385441){if(_0x385441&&_0x385441[_0x5271('0x4f')]===0x0){return db['UserProfileResource'][_0x5271('0x49')]({'name':_0x247139['name'],'resourceId':_0x247139['id'],'type':_0x385441[_0x5271('0x2a')],'sectionId':_0x385441['id']},{})[_0x5271('0x22')](function(){return _0x2897d3;});}else{return _0x2897d3;}})[_0x5271('0x48')](function(_0x299aed){logger[_0x5271('0x28')](_0x5271('0x50'),_0x299aed);throw _0x299aed;});}return _0x2897d3;})[_0x5271('0x22')](respondWithResult(_0x3ec533,0xc9))[_0x5271('0x48')](handleError(_0x3ec533,null));};exports['update']=function(_0x1de3ff,_0x54da20){if(_0x1de3ff[_0x5271('0x4a')]['id']){delete _0x1de3ff[_0x5271('0x4a')]['id'];}return db[_0x5271('0x3f')][_0x5271('0x47')]({'where':{'id':_0x1de3ff[_0x5271('0x45')]['id']}})[_0x5271('0x22')](handleEntityNotFound(_0x54da20,null))[_0x5271('0x22')](saveUpdates(_0x1de3ff['body'],null))[_0x5271('0x22')](respondWithResult(_0x54da20,null))[_0x5271('0x48')](handleError(_0x54da20,null));};exports[_0x5271('0x23')]=function(_0x58eea0,_0x3e8170){return db[_0x5271('0x3f')][_0x5271('0x47')]({'where':{'id':_0x58eea0[_0x5271('0x45')]['id']}})[_0x5271('0x22')](handleEntityNotFound(_0x3e8170,null))[_0x5271('0x22')](removeEntity(_0x3e8170,null))[_0x5271('0x48')](handleError(_0x3e8170,null));};exports[_0x5271('0x51')]=function(_0x5f5368,_0x33af8f,_0x38fc82){return db[_0x5271('0x3f')][_0x5271('0x47')]({'where':{'id':_0x5f5368[_0x5271('0x45')]['id']},'attributes':[_0x5271('0x2a'),_0x5271('0x52'),_0x5271('0x53'),_0x5271('0x54')],'raw':!![]})['then'](handleEntityNotFound(_0x33af8f,null))[_0x5271('0x22')](function(_0x2da474){if(_0x2da474){if(!fs[_0x5271('0x55')](path[_0x5271('0x56')](config[_0x5271('0x57')],_0x5271('0x58'),_0x2da474['savename']))){throw new db[(_0x5271('0x59'))][(_0x5271('0x5a'))]('Report\x20not\x20found\x20or\x20empty');}if(_0x5f5368['query'][_0x5271('0x5b')]){return _0x33af8f['sendStatus'](0xc8);}return _0x33af8f[_0x5271('0x51')](path[_0x5271('0x56')](config['root'],'server/files/reports',_0x2da474[_0x5271('0x53')]),util[_0x5271('0x5c')]('%s.%s',_0x2da474[_0x5271('0x52')]||_0x2da474[_0x5271('0x2a')],_0x2da474[_0x5271('0x54')]['toLowerCase']()));}})[_0x5271('0x48')](handleError(_0x33af8f,null));}; \ No newline at end of file +var _0xfb73=['attributes','fields','length','hasOwnProperty','nolimit','order','where','filters','pick','filter','merge','includeAll','include','findAll','rows','catch','params','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','download','savename','output','join','root','server/files/reports','Sequelize','Report\x20not\x20found\x20or\x20empty','exists','format','%s.%s','basename','toLowerCase','eml-format','rimraf','zip-dir','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','save','then','get','ExtractedReports','UserProfileResource','destroy','error','name','send','AnalyticExtractedReport','rawAttributes','fieldName','model','map','query','keys','intersection'];(function(_0x57014b,_0xfbd4c){var _0x19b0a2=function(_0x5761c8){while(--_0x5761c8){_0x57014b['push'](_0x57014b['shift']());}};_0x19b0a2(++_0xfbd4c);}(_0xfb73,0xdd));var _0x3fb7=function(_0x2ce142,_0x46b524){_0x2ce142=_0x2ce142-0x0;var _0x196e38=_0xfb73[_0x2ce142];return _0x196e38;};'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('request-promise');var moment=require(_0x3fb7('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x3fb7('0x4'));var util=require(_0x3fb7('0x5'));var path=require(_0x3fb7('0x6'));var sox=require('sox');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(_0x3fb7('0x7'));var querystring=require('querystring');var Papa=require(_0x3fb7('0xf'));var Redis=require(_0x3fb7('0x10'));var authService=require(_0x3fb7('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x3fb7('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x3fb7('0x13'));var utils=require(_0x3fb7('0x14'));var config=require(_0x3fb7('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x506ad3,_0x25c7a3){_0x25c7a3=_0x25c7a3||0xcc;return function(_0x1e6bdd){if(_0x1e6bdd){return _0x506ad3[_0x3fb7('0x16')](_0x25c7a3);}return _0x506ad3[_0x3fb7('0x17')](_0x25c7a3)[_0x3fb7('0x18')]();};}function respondWithResult(_0x2f31e6,_0x1b05ec){_0x1b05ec=_0x1b05ec||0xc8;return function(_0x1cce8f){if(_0x1cce8f){return _0x2f31e6[_0x3fb7('0x17')](_0x1b05ec)[_0x3fb7('0x19')](_0x1cce8f);}};}function respondWithFilteredResult(_0x331b9b,_0x57ad3a){return function(_0x110d9e){if(_0x110d9e){var _0x456154=typeof _0x57ad3a[_0x3fb7('0x1a')]==='undefined'&&typeof _0x57ad3a[_0x3fb7('0x1b')]===_0x3fb7('0x1c');var _0x2d333f=_0x110d9e[_0x3fb7('0x1d')];var _0x3cc854=_0x456154?0x0:_0x57ad3a['offset'];var _0x2598c6=_0x456154?_0x110d9e[_0x3fb7('0x1d')]:_0x57ad3a[_0x3fb7('0x1a')]+_0x57ad3a[_0x3fb7('0x1b')];var _0x2b20a3;if(_0x2598c6>=_0x2d333f){_0x2598c6=_0x2d333f;_0x2b20a3=0xc8;}else{_0x2b20a3=0xce;}_0x331b9b['status'](_0x2b20a3);return _0x331b9b['set'](_0x3fb7('0x1e'),_0x3cc854+'-'+_0x2598c6+'/'+_0x2d333f)[_0x3fb7('0x19')](_0x110d9e);}return null;};}function patchUpdates(_0x13410e){return function(_0x543b42){try{jsonpatch[_0x3fb7('0x1f')](_0x543b42,_0x13410e,!![]);}catch(_0x3a624e){return BPromise['reject'](_0x3a624e);}return _0x543b42[_0x3fb7('0x20')]();};}function saveUpdates(_0xa43398,_0x3e866c){return function(_0x583ea7){if(_0x583ea7){return _0x583ea7['update'](_0xa43398)['then'](function(_0x852a93){return _0x852a93;});}return null;};}function removeEntity(_0x1f4c68,_0x4308c2){return function(_0x538141){if(_0x538141){return _0x538141['destroy']()[_0x3fb7('0x21')](function(){var _0xad3fb0=_0x538141[_0x3fb7('0x22')]({'plain':!![]});var _0x4e0d2b=_0x3fb7('0x23');return db[_0x3fb7('0x24')][_0x3fb7('0x25')]({'where':{'type':_0x4e0d2b,'resourceId':_0xad3fb0['id']}})[_0x3fb7('0x21')](function(){return _0x538141;});})[_0x3fb7('0x21')](function(){_0x1f4c68['status'](0xcc)[_0x3fb7('0x18')]();});}};}function handleEntityNotFound(_0x3ba4ed,_0x2a46d1){return function(_0x43a217){if(!_0x43a217){_0x3ba4ed[_0x3fb7('0x16')](0x194);}return _0x43a217;};}function handleError(_0x5a437f,_0x257329){_0x257329=_0x257329||0x1f4;return function(_0xc5cd92){logger[_0x3fb7('0x26')](_0xc5cd92['stack']);if(_0xc5cd92[_0x3fb7('0x27')]){delete _0xc5cd92[_0x3fb7('0x27')];}_0x5a437f['status'](_0x257329)[_0x3fb7('0x28')](_0xc5cd92);};}exports['index']=function(_0x33a11e,_0x811537){var _0x1edba7={},_0x4ca25c={},_0x3449bc={'count':0x0,'rows':[]};var _0x4ec648=_['map'](db[_0x3fb7('0x29')][_0x3fb7('0x2a')],function(_0x301185){return{'name':_0x301185[_0x3fb7('0x2b')],'type':_0x301185['type']['key']};});_0x4ca25c[_0x3fb7('0x2c')]=_[_0x3fb7('0x2d')](_0x4ec648,_0x3fb7('0x27'));_0x4ca25c[_0x3fb7('0x2e')]=_[_0x3fb7('0x2f')](_0x33a11e[_0x3fb7('0x2e')]);_0x4ca25c['filters']=_[_0x3fb7('0x30')](_0x4ca25c[_0x3fb7('0x2c')],_0x4ca25c[_0x3fb7('0x2e')]);_0x1edba7[_0x3fb7('0x31')]=_['intersection'](_0x4ca25c[_0x3fb7('0x2c')],qs[_0x3fb7('0x32')](_0x33a11e[_0x3fb7('0x2e')]['fields']));_0x1edba7['attributes']=_0x1edba7[_0x3fb7('0x31')][_0x3fb7('0x33')]?_0x1edba7[_0x3fb7('0x31')]:_0x4ca25c[_0x3fb7('0x2c')];if(!_0x33a11e[_0x3fb7('0x2e')][_0x3fb7('0x34')](_0x3fb7('0x35'))){_0x1edba7[_0x3fb7('0x1b')]=qs['limit'](_0x33a11e[_0x3fb7('0x2e')][_0x3fb7('0x1b')]);_0x1edba7[_0x3fb7('0x1a')]=qs['offset'](_0x33a11e[_0x3fb7('0x2e')][_0x3fb7('0x1a')]);}_0x1edba7[_0x3fb7('0x36')]=qs['sort'](_0x33a11e[_0x3fb7('0x2e')]['sort']);_0x1edba7[_0x3fb7('0x37')]=qs[_0x3fb7('0x38')](_[_0x3fb7('0x39')](_0x33a11e['query'],_0x4ca25c['filters']),_0x4ec648);if(_0x33a11e[_0x3fb7('0x2e')][_0x3fb7('0x3a')]){_0x1edba7[_0x3fb7('0x37')]=_[_0x3fb7('0x3b')](_0x1edba7[_0x3fb7('0x37')],{'$or':_['map'](_0x4ec648,function(_0x3c74ec){if(_0x3c74ec['type']!=='VIRTUAL'){var _0xed711d={};_0xed711d[_0x3c74ec[_0x3fb7('0x27')]]={'$like':'%'+_0x33a11e[_0x3fb7('0x2e')][_0x3fb7('0x3a')]+'%'};return _0xed711d;}})});}_0x1edba7=_[_0x3fb7('0x3b')]({},_0x1edba7,_0x33a11e['options']);var _0x1176cb={'where':_0x1edba7[_0x3fb7('0x37')]};return db['AnalyticExtractedReport'][_0x3fb7('0x1d')](_0x1176cb)[_0x3fb7('0x21')](function(_0x2d7b92){_0x3449bc[_0x3fb7('0x1d')]=_0x2d7b92;if(_0x33a11e[_0x3fb7('0x2e')][_0x3fb7('0x3c')]){_0x1edba7[_0x3fb7('0x3d')]=[{'all':!![]}];}return db[_0x3fb7('0x29')][_0x3fb7('0x3e')](_0x1edba7);})[_0x3fb7('0x21')](function(_0x537bc4){_0x3449bc[_0x3fb7('0x3f')]=_0x537bc4;return _0x3449bc;})[_0x3fb7('0x21')](respondWithFilteredResult(_0x811537,_0x1edba7))[_0x3fb7('0x40')](handleError(_0x811537,null));};exports['show']=function(_0x458588,_0x10bd60){var _0x10581b={'raw':!![],'where':{'id':_0x458588[_0x3fb7('0x41')]['id']}},_0x4a9b74={};_0x4a9b74[_0x3fb7('0x2c')]=_[_0x3fb7('0x2f')](db[_0x3fb7('0x29')][_0x3fb7('0x2a')]);_0x4a9b74['query']=_['keys'](_0x458588['query']);_0x4a9b74[_0x3fb7('0x38')]=_[_0x3fb7('0x30')](_0x4a9b74[_0x3fb7('0x2c')],_0x4a9b74['query']);_0x10581b[_0x3fb7('0x31')]=_[_0x3fb7('0x30')](_0x4a9b74['model'],qs['fields'](_0x458588[_0x3fb7('0x2e')][_0x3fb7('0x32')]));_0x10581b['attributes']=_0x10581b['attributes'][_0x3fb7('0x33')]?_0x10581b['attributes']:_0x4a9b74['model'];if(_0x458588[_0x3fb7('0x2e')][_0x3fb7('0x3c')]){_0x10581b[_0x3fb7('0x3d')]=[{'all':!![]}];}_0x10581b=_[_0x3fb7('0x3b')]({},_0x10581b,_0x458588[_0x3fb7('0x42')]);return db[_0x3fb7('0x29')][_0x3fb7('0x43')](_0x10581b)[_0x3fb7('0x21')](handleEntityNotFound(_0x10bd60,null))['then'](respondWithResult(_0x10bd60,null))[_0x3fb7('0x40')](handleError(_0x10bd60,null));};exports[_0x3fb7('0x44')]=function(_0xd0cd2d,_0x585d33){return db[_0x3fb7('0x29')]['create'](_0xd0cd2d['body'],{})[_0x3fb7('0x21')](function(_0x1ac7fa){var _0x168e92=_0xd0cd2d[_0x3fb7('0x45')][_0x3fb7('0x22')]({'plain':!![]});if(!_0x168e92)throw new Error(_0x3fb7('0x46'));if(_0x168e92[_0x3fb7('0x47')]==='user'){var _0x5b0d4c=_0x1ac7fa['get']({'plain':!![]});var _0x5da2c7='ExtractedReports';return db[_0x3fb7('0x48')][_0x3fb7('0x43')]({'where':{'name':_0x5da2c7,'userProfileId':_0x168e92[_0x3fb7('0x49')]},'raw':!![]})[_0x3fb7('0x21')](function(_0x531c91){if(_0x531c91&&_0x531c91[_0x3fb7('0x4a')]===0x0){return db[_0x3fb7('0x24')][_0x3fb7('0x44')]({'name':_0x5b0d4c[_0x3fb7('0x27')],'resourceId':_0x5b0d4c['id'],'type':_0x531c91['name'],'sectionId':_0x531c91['id']},{})[_0x3fb7('0x21')](function(){return _0x1ac7fa;});}else{return _0x1ac7fa;}})[_0x3fb7('0x40')](function(_0x33e298){logger[_0x3fb7('0x26')](_0x3fb7('0x4b'),_0x33e298);throw _0x33e298;});}return _0x1ac7fa;})[_0x3fb7('0x21')](respondWithResult(_0x585d33,0xc9))[_0x3fb7('0x40')](handleError(_0x585d33,null));};exports['update']=function(_0x216aa7,_0xeb9418){if(_0x216aa7[_0x3fb7('0x4c')]['id']){delete _0x216aa7['body']['id'];}return db[_0x3fb7('0x29')][_0x3fb7('0x43')]({'where':{'id':_0x216aa7[_0x3fb7('0x41')]['id']}})[_0x3fb7('0x21')](handleEntityNotFound(_0xeb9418,null))[_0x3fb7('0x21')](saveUpdates(_0x216aa7[_0x3fb7('0x4c')],null))['then'](respondWithResult(_0xeb9418,null))[_0x3fb7('0x40')](handleError(_0xeb9418,null));};exports[_0x3fb7('0x25')]=function(_0x5ec978,_0x36f930){return db[_0x3fb7('0x29')][_0x3fb7('0x43')]({'where':{'id':_0x5ec978[_0x3fb7('0x41')]['id']}})[_0x3fb7('0x21')](handleEntityNotFound(_0x36f930,null))[_0x3fb7('0x21')](removeEntity(_0x36f930,null))[_0x3fb7('0x40')](handleError(_0x36f930,null));};exports[_0x3fb7('0x4d')]=function(_0x2b4772,_0x5209d4,_0x3332fa){return db[_0x3fb7('0x29')][_0x3fb7('0x43')]({'where':{'id':_0x2b4772[_0x3fb7('0x41')]['id']},'attributes':[_0x3fb7('0x27'),'basename',_0x3fb7('0x4e'),_0x3fb7('0x4f')],'raw':!![]})[_0x3fb7('0x21')](handleEntityNotFound(_0x5209d4,null))[_0x3fb7('0x21')](function(_0xf8ecb4){if(_0xf8ecb4){if(!fs['existsSync'](path[_0x3fb7('0x50')](config[_0x3fb7('0x51')],_0x3fb7('0x52'),_0xf8ecb4[_0x3fb7('0x4e')]))){throw new db[(_0x3fb7('0x53'))]['ValidationError'](_0x3fb7('0x54'));}if(_0x2b4772[_0x3fb7('0x2e')][_0x3fb7('0x55')]){return _0x5209d4[_0x3fb7('0x16')](0xc8);}return _0x5209d4[_0x3fb7('0x4d')](path[_0x3fb7('0x50')](config[_0x3fb7('0x51')],_0x3fb7('0x52'),_0xf8ecb4[_0x3fb7('0x4e')]),util[_0x3fb7('0x56')](_0x3fb7('0x57'),_0xf8ecb4[_0x3fb7('0x58')]||_0xf8ecb4[_0x3fb7('0x27')],_0xf8ecb4['output'][_0x3fb7('0x59')]()));}})['catch'](handleError(_0x5209d4,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index 38a217d..e7c0a14 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 _0x5d35=['bluebird','request-promise','rimraf','../../config/environment','./analyticExtractedReport.attributes','exports','define','AnalyticExtractedReport','lodash','../../config/logger','moment'];(function(_0x10c51f,_0x11270f){var _0x56a0cd=function(_0x563ac6){while(--_0x563ac6){_0x10c51f['push'](_0x10c51f['shift']());}};_0x56a0cd(++_0x11270f);}(_0x5d35,0x1c0));var _0x55d3=function(_0x50b381,_0x5ae2d3){_0x50b381=_0x50b381-0x0;var _0x551adf=_0x5d35[_0x50b381];return _0x551adf;};'use strict';var _=require(_0x55d3('0x0'));var util=require('util');var logger=require(_0x55d3('0x1'))('api');var moment=require(_0x55d3('0x2'));var BPromise=require(_0x55d3('0x3'));var rp=require(_0x55d3('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x55d3('0x5'));var config=require(_0x55d3('0x6'));var attributes=require(_0x55d3('0x7'));module[_0x55d3('0x8')]=function(_0x2be48a,_0x4c7914){return _0x2be48a[_0x55d3('0x9')](_0x55d3('0xa'),attributes,{'tableName':'analytics_extracted_reports','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1e9e=['request-promise','rimraf','./analyticExtractedReport.attributes','exports','define','AnalyticExtractedReport','analytics_extracted_reports','util','../../config/logger','api','moment','bluebird'];(function(_0x5c9207,_0x4737ef){var _0x587913=function(_0x5df589){while(--_0x5df589){_0x5c9207['push'](_0x5c9207['shift']());}};_0x587913(++_0x4737ef);}(_0x1e9e,0x67));var _0xe1e9=function(_0xcf0fd,_0x2324a2){_0xcf0fd=_0xcf0fd-0x0;var _0x4e7565=_0x1e9e[_0xcf0fd];return _0x4e7565;};'use strict';var _=require('lodash');var util=require(_0xe1e9('0x0'));var logger=require(_0xe1e9('0x1'))(_0xe1e9('0x2'));var moment=require(_0xe1e9('0x3'));var BPromise=require(_0xe1e9('0x4'));var rp=require(_0xe1e9('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe1e9('0x6'));var config=require('../../config/environment');var attributes=require(_0xe1e9('0x7'));module[_0xe1e9('0x8')]=function(_0x5efc9b,_0x1ca523){return _0x5efc9b[_0xe1e9('0x9')](_0xe1e9('0xa'),attributes,{'tableName':_0xe1e9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js b/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js index 3635c82..0d799b8 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 _0x5543=['stringify','error','code','message','catch','lodash','util','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s'];(function(_0x27af4f,_0x41432e){var _0x108117=function(_0x49a723){while(--_0x49a723){_0x27af4f['push'](_0x27af4f['shift']());}};_0x108117(++_0x41432e);}(_0x5543,0x1a7));var _0x3554=function(_0x45d1fd,_0x463212){_0x45d1fd=_0x45d1fd-0x0;var _0xd0e542=_0x5543[_0x45d1fd];return _0xd0e542;};'use strict';var _=require(_0x3554('0x0'));var util=require(_0x3554('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3554('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x3554('0x3'));var logger=require(_0x3554('0x4'))(_0x3554('0x5'));var config=require(_0x3554('0x6'));var jayson=require(_0x3554('0x7'));var client=jayson[_0x3554('0x8')][_0x3554('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x57d0a7,_0x328da6,_0x42c42c){return new BPromise(function(_0xa428c1,_0x40da5d){return client[_0x3554('0xa')](_0x57d0a7,_0x42c42c)[_0x3554('0xb')](function(_0x152ec6){logger[_0x3554('0xc')](_0x3554('0xd'),_0x328da6,_0x3554('0xe'));logger[_0x3554('0xf')](_0x3554('0x10'),_0x328da6,_0x3554('0xe'),JSON[_0x3554('0x11')](_0x152ec6));if(_0x152ec6[_0x3554('0x12')]){if(_0x152ec6[_0x3554('0x12')][_0x3554('0x13')]===0x1f4){logger[_0x3554('0x12')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x328da6,_0x152ec6[_0x3554('0x12')]['message']);return _0x40da5d(_0x152ec6[_0x3554('0x12')][_0x3554('0x14')]);}logger[_0x3554('0x12')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x328da6,_0x152ec6[_0x3554('0x12')][_0x3554('0x14')]);return _0xa428c1(_0x152ec6['error'][_0x3554('0x14')]);}else{logger[_0x3554('0xc')](_0x3554('0xd'),_0x328da6,'request\x20sent');_0xa428c1(_0x152ec6['result'][_0x3554('0x14')]);}})[_0x3554('0x15')](function(_0x58f1be){logger['error'](_0x3554('0xd'),_0x328da6,_0x58f1be);_0x40da5d(_0x58f1be);});});} \ No newline at end of file +var _0xbf55=['request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','AnalyticExtractedReport,\x20%s,\x20%s'];(function(_0x3c4702,_0x315207){var _0x186a83=function(_0x5a2786){while(--_0x5a2786){_0x3c4702['push'](_0x3c4702['shift']());}};_0x186a83(++_0x315207);}(_0xbf55,0x168));var _0x5bf5=function(_0x2b8d15,_0x6bc740){_0x2b8d15=_0x2b8d15-0x0;var _0x42a035=_0xbf55[_0x2b8d15];return _0x42a035;};'use strict';var _=require(_0x5bf5('0x0'));var util=require(_0x5bf5('0x1'));var moment=require(_0x5bf5('0x2'));var BPromise=require('bluebird');var rs=require(_0x5bf5('0x3'));var fs=require('fs');var Redis=require(_0x5bf5('0x4'));var db=require(_0x5bf5('0x5'))['db'];var utils=require(_0x5bf5('0x6'));var logger=require(_0x5bf5('0x7'))(_0x5bf5('0x8'));var config=require(_0x5bf5('0x9'));var jayson=require(_0x5bf5('0xa'));var client=jayson['client'][_0x5bf5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1ce5f9,_0xf8620c,_0x4230b5){return new BPromise(function(_0x3fd66d,_0x13e29a){return client[_0x5bf5('0xc')](_0x1ce5f9,_0x4230b5)[_0x5bf5('0xd')](function(_0x2af3aa){logger['info'](_0x5bf5('0xe'),_0xf8620c,_0x5bf5('0xf'));logger[_0x5bf5('0x10')](_0x5bf5('0x11'),_0xf8620c,'request\x20sent',JSON[_0x5bf5('0x12')](_0x2af3aa));if(_0x2af3aa[_0x5bf5('0x13')]){if(_0x2af3aa[_0x5bf5('0x13')][_0x5bf5('0x14')]===0x1f4){logger[_0x5bf5('0x13')]('AnalyticExtractedReport,\x20%s,\x20%s',_0xf8620c,_0x2af3aa[_0x5bf5('0x13')][_0x5bf5('0x15')]);return _0x13e29a(_0x2af3aa['error'][_0x5bf5('0x15')]);}logger[_0x5bf5('0x13')]('AnalyticExtractedReport,\x20%s,\x20%s',_0xf8620c,_0x2af3aa[_0x5bf5('0x13')][_0x5bf5('0x15')]);return _0x3fd66d(_0x2af3aa[_0x5bf5('0x13')][_0x5bf5('0x15')]);}else{logger[_0x5bf5('0x16')](_0x5bf5('0xe'),_0xf8620c,_0x5bf5('0xf'));_0x3fd66d(_0x2af3aa[_0x5bf5('0x17')]['message']);}})[_0x5bf5('0x18')](function(_0x390dc2){logger[_0x5bf5('0x13')](_0x5bf5('0xe'),_0xf8620c,_0x390dc2);_0x13e29a(_0x390dc2);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index 23ba734..afe1237 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 _0xb80a=['util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','isAuthenticated','index','get','/:id','/:id/download','create','update','delete','destroy','multer'];(function(_0x5f3f88,_0x562baf){var _0xd08119=function(_0x42dbf7){while(--_0x42dbf7){_0x5f3f88['push'](_0x5f3f88['shift']());}};_0xd08119(++_0x562baf);}(_0xb80a,0x18b));var _0xab80=function(_0x2b6b4a,_0x5c7462){_0x2b6b4a=_0x2b6b4a-0x0;var _0x275001=_0xb80a[_0x2b6b4a];return _0x275001;};'use strict';var multer=require(_0xab80('0x0'));var util=require(_0xab80('0x1'));var path=require('path');var timeout=require(_0xab80('0x2'));var express=require('express');var router=express[_0xab80('0x3')]();var fs_extra=require(_0xab80('0x4'));var auth=require(_0xab80('0x5'));var interaction=require(_0xab80('0x6'));var config=require(_0xab80('0x7'));var controller=require(_0xab80('0x8'));router['get']('/',auth[_0xab80('0x9')](),controller[_0xab80('0xa')]);router[_0xab80('0xb')](_0xab80('0xc'),auth[_0xab80('0x9')](),controller['show']);router[_0xab80('0xb')](_0xab80('0xd'),auth[_0xab80('0x9')](),controller['download']);router['post']('/',auth[_0xab80('0x9')](),controller[_0xab80('0xe')]);router['put'](_0xab80('0xc'),auth[_0xab80('0x9')](),controller[_0xab80('0xf')]);router[_0xab80('0x10')](_0xab80('0xc'),auth[_0xab80('0x9')](),controller[_0xab80('0x11')]);module['exports']=router; \ No newline at end of file +var _0x35a7=['get','isAuthenticated','index','/:id','download','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../config/environment','./analyticExtractedReport.controller'];(function(_0x4070e5,_0x3cba2c){var _0x421852=function(_0x3c76c4){while(--_0x3c76c4){_0x4070e5['push'](_0x4070e5['shift']());}};_0x421852(++_0x3cba2c);}(_0x35a7,0x65));var _0x735a=function(_0x246508,_0x4716f7){_0x246508=_0x246508-0x0;var _0x3f6f41=_0x35a7[_0x246508];return _0x3f6f41;};'use strict';var multer=require(_0x735a('0x0'));var util=require(_0x735a('0x1'));var path=require(_0x735a('0x2'));var timeout=require(_0x735a('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x735a('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x735a('0x5'));var controller=require(_0x735a('0x6'));router[_0x735a('0x7')]('/',auth[_0x735a('0x8')](),controller[_0x735a('0x9')]);router[_0x735a('0x7')](_0x735a('0xa'),auth[_0x735a('0x8')](),controller['show']);router[_0x735a('0x7')]('/:id/download',auth[_0x735a('0x8')](),controller[_0x735a('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0x735a('0xc')]);router[_0x735a('0xd')](_0x735a('0xa'),auth[_0x735a('0x8')](),controller[_0x735a('0xe')]);router[_0x735a('0xf')](_0x735a('0xa'),auth['isAuthenticated'](),controller[_0x735a('0x10')]);module[_0x735a('0x11')]=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index 8f92ebe..3a0dd26 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 _0x04c9=['sequelize','TEXT','STRING','BOOLEAN'];(function(_0x285824,_0x3da647){var _0x311d7e=function(_0x2f3de0){while(--_0x2f3de0){_0x285824['push'](_0x285824['shift']());}};_0x311d7e(++_0x3da647);}(_0x04c9,0x78));var _0x904c=function(_0x87758c,_0x688339){_0x87758c=_0x87758c-0x0;var _0x2ed562=_0x04c9[_0x87758c];return _0x2ed562;};'use strict';var Sequelize=require(_0x904c('0x0'));module['exports']={'field':{'type':Sequelize[_0x904c('0x1')]},'alias':{'type':Sequelize['STRING']},'function':{'type':Sequelize[_0x904c('0x2')]},'format':{'type':Sequelize[_0x904c('0x2')]},'groupBy':{'type':Sequelize[_0x904c('0x3')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x904c('0x2')]},'custom':{'type':Sequelize[_0x904c('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x796d=['BOOLEAN','exports','TEXT','STRING'];(function(_0x3e1ba4,_0x19d230){var _0x18ec32=function(_0x16d22e){while(--_0x16d22e){_0x3e1ba4['push'](_0x3e1ba4['shift']());}};_0x18ec32(++_0x19d230);}(_0x796d,0x105));var _0xd796=function(_0x3c2a69,_0x4c8b41){_0x3c2a69=_0x3c2a69-0x0;var _0x596bc8=_0x796d[_0x3c2a69];return _0x596bc8;};'use strict';var Sequelize=require('sequelize');module[_0xd796('0x0')]={'field':{'type':Sequelize[_0xd796('0x1')]},'alias':{'type':Sequelize[_0xd796('0x2')]},'function':{'type':Sequelize[_0xd796('0x2')]},'format':{'type':Sequelize[_0xd796('0x2')]},'groupBy':{'type':Sequelize[_0xd796('0x3')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0xd796('0x2')]},'custom':{'type':Sequelize[_0xd796('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 b242046..52c9526 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 _0x9397=['error','stack','name','send','index','map','AnalyticFieldReport','fieldName','type','key','model','keys','query','intersection','fields','attributes','length','order','sort','where','pick','filters','filter','merge','options','includeAll','include','findAll','rows','show','params','rawAttributes','find','catch','create','body','bulkCreate','update','bulkDestroy','ids','addFields','AnalyticCustomReport','sequelize','transaction','CustomReportId','eml-format','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','offset','count','limit','set','Content-Range','destroy','then'];(function(_0x2abd03,_0x15bd78){var _0x397306=function(_0x203b1e){while(--_0x203b1e){_0x2abd03['push'](_0x2abd03['shift']());}};_0x397306(++_0x15bd78);}(_0x9397,0x7d));var _0x7939=function(_0x3c0b75,_0x3b5cb3){_0x3c0b75=_0x3c0b75-0x0;var _0x101b35=_0x9397[_0x3c0b75];return _0x101b35;};'use strict';var emlformat=require(_0x7939('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x7939('0x1'));var moment=require(_0x7939('0x2'));var BPromise=require(_0x7939('0x3'));var Mustache=require(_0x7939('0x4'));var util=require(_0x7939('0x5'));var path=require('path');var sox=require(_0x7939('0x6'));var csv=require('to-csv');var ejs=require(_0x7939('0x7'));var fs=require('fs');var fs_extra=require(_0x7939('0x8'));var _=require(_0x7939('0x9'));var squel=require(_0x7939('0xa'));var crypto=require(_0x7939('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x7939('0xc'));var toCsv=require(_0x7939('0xd'));var querystring=require(_0x7939('0xe'));var Papa=require(_0x7939('0xf'));var Redis=require(_0x7939('0x10'));var authService=require(_0x7939('0x11'));var qs=require(_0x7939('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x7939('0x13'))(_0x7939('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x7939('0x15'));var db=require(_0x7939('0x16'))['db'];function respondWithStatusCode(_0x2b91af,_0x23a225){_0x23a225=_0x23a225||0xcc;return function(_0x34b708){if(_0x34b708){return _0x2b91af[_0x7939('0x17')](_0x23a225);}return _0x2b91af[_0x7939('0x18')](_0x23a225)[_0x7939('0x19')]();};}function respondWithResult(_0xff44a2,_0x352c13){_0x352c13=_0x352c13||0xc8;return function(_0x76c90d){if(_0x76c90d){return _0xff44a2[_0x7939('0x18')](_0x352c13)[_0x7939('0x1a')](_0x76c90d);}};}function respondWithFilteredResult(_0x455c4b,_0x531b30){return function(_0x4ae6a0){if(_0x4ae6a0){var _0x4a0c09=typeof _0x531b30['offset']===_0x7939('0x1b')&&typeof _0x531b30['limit']===_0x7939('0x1b');var _0xfd8609=_0x4ae6a0['count'];var _0x5c4a8f=_0x4a0c09?0x0:_0x531b30[_0x7939('0x1c')];var _0x48e0a8=_0x4a0c09?_0x4ae6a0[_0x7939('0x1d')]:_0x531b30[_0x7939('0x1c')]+_0x531b30[_0x7939('0x1e')];var _0x1bee08;if(_0x48e0a8>=_0xfd8609){_0x48e0a8=_0xfd8609;_0x1bee08=0xc8;}else{_0x1bee08=0xce;}_0x455c4b[_0x7939('0x18')](_0x1bee08);return _0x455c4b[_0x7939('0x1f')](_0x7939('0x20'),_0x5c4a8f+'-'+_0x48e0a8+'/'+_0xfd8609)[_0x7939('0x1a')](_0x4ae6a0);}return null;};}function patchUpdates(_0x15b566){return function(_0x1fccc8){try{jsonpatch['apply'](_0x1fccc8,_0x15b566,!![]);}catch(_0x525534){return BPromise['reject'](_0x525534);}return _0x1fccc8['save']();};}function saveUpdates(_0x124a09,_0x368b2c){return function(_0xf2b276){if(_0xf2b276){return _0xf2b276['update'](_0x124a09)['then'](function(_0x2499a9){return _0x2499a9;});}return null;};}function removeEntity(_0x265213,_0x2344de){return function(_0x3b0a35){if(_0x3b0a35){return _0x3b0a35[_0x7939('0x21')]()[_0x7939('0x22')](function(){_0x265213[_0x7939('0x18')](0xcc)[_0x7939('0x19')]();});}};}function handleEntityNotFound(_0x13e90c,_0x45efcf){return function(_0xda1015){if(!_0xda1015){_0x13e90c['sendStatus'](0x194);}return _0xda1015;};}function handleError(_0x2bf0e5,_0x17d2f9){_0x17d2f9=_0x17d2f9||0x1f4;return function(_0x19416b){logger[_0x7939('0x23')](_0x19416b[_0x7939('0x24')]);if(_0x19416b[_0x7939('0x25')]){delete _0x19416b[_0x7939('0x25')];}_0x2bf0e5[_0x7939('0x18')](_0x17d2f9)[_0x7939('0x26')](_0x19416b);};}exports[_0x7939('0x27')]=function(_0x4fc4ef,_0x5311ef){var _0x2ac721={},_0x3a7506={},_0x13a310={'count':0x0,'rows':[]};var _0x11ef11=_[_0x7939('0x28')](db[_0x7939('0x29')]['rawAttributes'],function(_0x27ca39){return{'name':_0x27ca39[_0x7939('0x2a')],'type':_0x27ca39[_0x7939('0x2b')][_0x7939('0x2c')]};});_0x3a7506[_0x7939('0x2d')]=_[_0x7939('0x28')](_0x11ef11,_0x7939('0x25'));_0x3a7506['query']=_[_0x7939('0x2e')](_0x4fc4ef['query']);_0x3a7506['filters']=_['intersection'](_0x3a7506[_0x7939('0x2d')],_0x3a7506[_0x7939('0x2f')]);_0x2ac721['attributes']=_[_0x7939('0x30')](_0x3a7506['model'],qs[_0x7939('0x31')](_0x4fc4ef[_0x7939('0x2f')]['fields']));_0x2ac721[_0x7939('0x32')]=_0x2ac721[_0x7939('0x32')][_0x7939('0x33')]?_0x2ac721[_0x7939('0x32')]:_0x3a7506['model'];if(!_0x4fc4ef[_0x7939('0x2f')]['hasOwnProperty']('nolimit')){_0x2ac721[_0x7939('0x1e')]=qs[_0x7939('0x1e')](_0x4fc4ef[_0x7939('0x2f')][_0x7939('0x1e')]);_0x2ac721['offset']=qs[_0x7939('0x1c')](_0x4fc4ef[_0x7939('0x2f')][_0x7939('0x1c')]);}_0x2ac721[_0x7939('0x34')]=qs[_0x7939('0x35')](_0x4fc4ef['query'][_0x7939('0x35')]);_0x2ac721[_0x7939('0x36')]=qs['filters'](_[_0x7939('0x37')](_0x4fc4ef[_0x7939('0x2f')],_0x3a7506[_0x7939('0x38')]),_0x11ef11);if(_0x4fc4ef[_0x7939('0x2f')][_0x7939('0x39')]){_0x2ac721['where']=_[_0x7939('0x3a')](_0x2ac721['where'],{'$or':_[_0x7939('0x28')](_0x11ef11,function(_0x4a846c){if(_0x4a846c[_0x7939('0x2b')]!=='VIRTUAL'){var _0x5c0ba8={};_0x5c0ba8[_0x4a846c[_0x7939('0x25')]]={'$like':'%'+_0x4fc4ef[_0x7939('0x2f')]['filter']+'%'};return _0x5c0ba8;}})});}_0x2ac721=_[_0x7939('0x3a')]({},_0x2ac721,_0x4fc4ef[_0x7939('0x3b')]);var _0x3fbb2e={'where':_0x2ac721['where']};return db[_0x7939('0x29')][_0x7939('0x1d')](_0x3fbb2e)[_0x7939('0x22')](function(_0xc96bb6){_0x13a310[_0x7939('0x1d')]=_0xc96bb6;if(_0x4fc4ef[_0x7939('0x2f')][_0x7939('0x3c')]){_0x2ac721[_0x7939('0x3d')]=[{'all':!![]}];}return db[_0x7939('0x29')][_0x7939('0x3e')](_0x2ac721);})[_0x7939('0x22')](function(_0x1c2363){_0x13a310[_0x7939('0x3f')]=_0x1c2363;return _0x13a310;})[_0x7939('0x22')](respondWithFilteredResult(_0x5311ef,_0x2ac721))['catch'](handleError(_0x5311ef,null));};exports[_0x7939('0x40')]=function(_0x266262,_0xb05c7){var _0x5c86bf={'raw':![],'where':{'id':_0x266262[_0x7939('0x41')]['id']}},_0x42bb0f={};_0x42bb0f['model']=_[_0x7939('0x2e')](db[_0x7939('0x29')][_0x7939('0x42')]);_0x42bb0f[_0x7939('0x2f')]=_[_0x7939('0x2e')](_0x266262[_0x7939('0x2f')]);_0x42bb0f['filters']=_[_0x7939('0x30')](_0x42bb0f[_0x7939('0x2d')],_0x42bb0f['query']);_0x5c86bf['attributes']=_[_0x7939('0x30')](_0x42bb0f[_0x7939('0x2d')],qs['fields'](_0x266262[_0x7939('0x2f')]['fields']));_0x5c86bf['attributes']=_0x5c86bf[_0x7939('0x32')][_0x7939('0x33')]?_0x5c86bf['attributes']:_0x42bb0f[_0x7939('0x2d')];if(_0x266262[_0x7939('0x2f')]['includeAll']){_0x5c86bf['include']=[{'all':!![]}];}_0x5c86bf=_[_0x7939('0x3a')]({},_0x5c86bf,_0x266262['options']);return db[_0x7939('0x29')][_0x7939('0x43')](_0x5c86bf)['then'](handleEntityNotFound(_0xb05c7,null))[_0x7939('0x22')](respondWithResult(_0xb05c7,null))[_0x7939('0x44')](handleError(_0xb05c7,null));};exports[_0x7939('0x45')]=function(_0xe4475c,_0x36b79b){return db[_0x7939('0x29')][_0x7939('0x45')](_0xe4475c[_0x7939('0x46')],{})['then'](respondWithResult(_0x36b79b,0xc9))[_0x7939('0x44')](handleError(_0x36b79b,null));};exports[_0x7939('0x47')]=function(_0x429d7a,_0xf03ec2){return db[_0x7939('0x29')]['bulkCreate'](_0x429d7a[_0x7939('0x46')],{'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0xf03ec2,0xc9))[_0x7939('0x44')](handleError(_0xf03ec2,null));};exports[_0x7939('0x48')]=function(_0x556553,_0x5216ea){if(_0x556553[_0x7939('0x46')]['id']){delete _0x556553[_0x7939('0x46')]['id'];}return db[_0x7939('0x29')][_0x7939('0x43')]({'where':{'id':_0x556553[_0x7939('0x41')]['id']}})['then'](handleEntityNotFound(_0x5216ea,null))[_0x7939('0x22')](saveUpdates(_0x556553[_0x7939('0x46')],null))[_0x7939('0x22')](respondWithResult(_0x5216ea,null))[_0x7939('0x44')](handleError(_0x5216ea,null));};exports['destroy']=function(_0x133a23,_0x559b55){return db[_0x7939('0x29')]['find']({'where':{'id':_0x133a23[_0x7939('0x41')]['id']}})[_0x7939('0x22')](handleEntityNotFound(_0x559b55,null))['then'](removeEntity(_0x559b55,null))[_0x7939('0x44')](handleError(_0x559b55,null));};exports[_0x7939('0x49')]=function(_0x1ae1b4,_0xeb368){return db[_0x7939('0x29')]['destroy']({'where':{'id':_0x1ae1b4[_0x7939('0x2f')][_0x7939('0x4a')]||[]},'raw':![],'individualHooks':!![]})[_0x7939('0x22')](respondWithResult(_0xeb368,0xcc))['catch'](handleError(_0xeb368,null));};exports[_0x7939('0x4b')]=function(_0x3dbc50,_0x345492,_0x1ebd00){return db[_0x7939('0x4c')]['findOne']({'where':{'id':_0x3dbc50[_0x7939('0x41')]['id']}})[_0x7939('0x22')](handleEntityNotFound(_0x345492,null))[_0x7939('0x22')](function(_0x2a13b4){if(_0x2a13b4){return db[_0x7939('0x4d')][_0x7939('0x4e')](function(_0x3d8ee3){return db[_0x7939('0x29')]['destroy']({'where':{'CustomReportId':_0x3dbc50[_0x7939('0x41')]['id']},'transaction':_0x3d8ee3})['then'](function(_0x4d328a){var _0x21881a=_[_0x7939('0x28')](_0x3dbc50[_0x7939('0x46')],function(_0xe2cccb){delete _0xe2cccb['id'];_0xe2cccb[_0x7939('0x4f')]=_0x3dbc50['params']['id'];return _0xe2cccb;});return db[_0x7939('0x29')][_0x7939('0x47')](_0x21881a,{'transaction':_0x3d8ee3});});})[_0x7939('0x22')](function(){return db['AnalyticFieldReport'][_0x7939('0x3e')]({'where':{'CustomReportId':_0x3dbc50['params']['id']}});});}})['then'](respondWithResult(_0x345492,null))[_0x7939('0x44')](handleError(_0x345492,null));}; \ No newline at end of file +var _0x19aa=['rimraf','fast-json-patch','moment','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','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','reject','save','update','then','destroy','error','stack','name','send','AnalyticFieldReport','fieldName','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','rows','catch','params','rawAttributes','options','find','create','body','bulkCreate','ids','AnalyticCustomReport','findOne','sequelize','transaction','CustomReportId','findAll','eml-format'];(function(_0x3c71f7,_0x10fdc4){var _0x350432=function(_0x5d3d59){while(--_0x5d3d59){_0x3c71f7['push'](_0x3c71f7['shift']());}};_0x350432(++_0x10fdc4);}(_0x19aa,0x147));var _0xa19a=function(_0x375421,_0x61587a){_0x375421=_0x375421-0x0;var _0x52c95b=_0x19aa[_0x375421];return _0x52c95b;};'use strict';var emlformat=require(_0xa19a('0x0'));var rimraf=require(_0xa19a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa19a('0x2'));var rp=require('request-promise');var moment=require(_0xa19a('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xa19a('0x4'));var util=require(_0xa19a('0x5'));var path=require(_0xa19a('0x6'));var sox=require(_0xa19a('0x7'));var csv=require(_0xa19a('0x8'));var ejs=require(_0xa19a('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa19a('0xa'));var squel=require(_0xa19a('0xb'));var crypto=require(_0xa19a('0xc'));var jsforce=require(_0xa19a('0xd'));var deskjs=require(_0xa19a('0xe'));var toCsv=require('to-csv');var querystring=require(_0xa19a('0xf'));var Papa=require(_0xa19a('0x10'));var Redis=require(_0xa19a('0x11'));var authService=require(_0xa19a('0x12'));var qs=require(_0xa19a('0x13'));var as=require(_0xa19a('0x14'));var hardwareService=require(_0xa19a('0x15'));var logger=require('../../config/logger')(_0xa19a('0x16'));var utils=require('../../config/utils');var config=require(_0xa19a('0x17'));var licenseUtil=require(_0xa19a('0x18'));var db=require(_0xa19a('0x19'))['db'];function respondWithStatusCode(_0x6f7dd3,_0x104cdd){_0x104cdd=_0x104cdd||0xcc;return function(_0xf77a0){if(_0xf77a0){return _0x6f7dd3[_0xa19a('0x1a')](_0x104cdd);}return _0x6f7dd3['status'](_0x104cdd)[_0xa19a('0x1b')]();};}function respondWithResult(_0x118b6e,_0x1901a7){_0x1901a7=_0x1901a7||0xc8;return function(_0x5573ce){if(_0x5573ce){return _0x118b6e[_0xa19a('0x1c')](_0x1901a7)[_0xa19a('0x1d')](_0x5573ce);}};}function respondWithFilteredResult(_0x40b739,_0x5e0dc4){return function(_0x2abb26){if(_0x2abb26){var _0x1d5d69=typeof _0x5e0dc4[_0xa19a('0x1e')]===_0xa19a('0x1f')&&typeof _0x5e0dc4[_0xa19a('0x20')]==='undefined';var _0x44e527=_0x2abb26[_0xa19a('0x21')];var _0x405551=_0x1d5d69?0x0:_0x5e0dc4['offset'];var _0x138001=_0x1d5d69?_0x2abb26[_0xa19a('0x21')]:_0x5e0dc4['offset']+_0x5e0dc4[_0xa19a('0x20')];var _0x224e53;if(_0x138001>=_0x44e527){_0x138001=_0x44e527;_0x224e53=0xc8;}else{_0x224e53=0xce;}_0x40b739[_0xa19a('0x1c')](_0x224e53);return _0x40b739['set'](_0xa19a('0x22'),_0x405551+'-'+_0x138001+'/'+_0x44e527)[_0xa19a('0x1d')](_0x2abb26);}return null;};}function patchUpdates(_0x4573a4){return function(_0x21ead4){try{jsonpatch['apply'](_0x21ead4,_0x4573a4,!![]);}catch(_0x207332){return BPromise[_0xa19a('0x23')](_0x207332);}return _0x21ead4[_0xa19a('0x24')]();};}function saveUpdates(_0x378737,_0x260370){return function(_0x5d6e03){if(_0x5d6e03){return _0x5d6e03[_0xa19a('0x25')](_0x378737)[_0xa19a('0x26')](function(_0x10c2c2){return _0x10c2c2;});}return null;};}function removeEntity(_0x44fa1d,_0x525cdc){return function(_0x477473){if(_0x477473){return _0x477473[_0xa19a('0x27')]()[_0xa19a('0x26')](function(){_0x44fa1d[_0xa19a('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2d13c0,_0x6051b9){return function(_0x173510){if(!_0x173510){_0x2d13c0[_0xa19a('0x1a')](0x194);}return _0x173510;};}function handleError(_0x4a23b2,_0x3bd405){_0x3bd405=_0x3bd405||0x1f4;return function(_0x311c8a){logger[_0xa19a('0x28')](_0x311c8a[_0xa19a('0x29')]);if(_0x311c8a[_0xa19a('0x2a')]){delete _0x311c8a[_0xa19a('0x2a')];}_0x4a23b2[_0xa19a('0x1c')](_0x3bd405)[_0xa19a('0x2b')](_0x311c8a);};}exports['index']=function(_0x4e331f,_0x4169c5){var _0x397157={},_0xa7a683={},_0x46e3cd={'count':0x0,'rows':[]};var _0x11d422=_['map'](db[_0xa19a('0x2c')]['rawAttributes'],function(_0x3574a9){return{'name':_0x3574a9[_0xa19a('0x2d')],'type':_0x3574a9['type'][_0xa19a('0x2e')]};});_0xa7a683[_0xa19a('0x2f')]=_[_0xa19a('0x30')](_0x11d422,_0xa19a('0x2a'));_0xa7a683[_0xa19a('0x31')]=_[_0xa19a('0x32')](_0x4e331f[_0xa19a('0x31')]);_0xa7a683[_0xa19a('0x33')]=_[_0xa19a('0x34')](_0xa7a683[_0xa19a('0x2f')],_0xa7a683[_0xa19a('0x31')]);_0x397157['attributes']=_[_0xa19a('0x34')](_0xa7a683['model'],qs[_0xa19a('0x35')](_0x4e331f['query'][_0xa19a('0x35')]));_0x397157[_0xa19a('0x36')]=_0x397157[_0xa19a('0x36')][_0xa19a('0x37')]?_0x397157[_0xa19a('0x36')]:_0xa7a683['model'];if(!_0x4e331f[_0xa19a('0x31')][_0xa19a('0x38')]('nolimit')){_0x397157[_0xa19a('0x20')]=qs['limit'](_0x4e331f[_0xa19a('0x31')][_0xa19a('0x20')]);_0x397157[_0xa19a('0x1e')]=qs[_0xa19a('0x1e')](_0x4e331f[_0xa19a('0x31')][_0xa19a('0x1e')]);}_0x397157[_0xa19a('0x39')]=qs[_0xa19a('0x3a')](_0x4e331f['query']['sort']);_0x397157[_0xa19a('0x3b')]=qs[_0xa19a('0x33')](_[_0xa19a('0x3c')](_0x4e331f[_0xa19a('0x31')],_0xa7a683[_0xa19a('0x33')]),_0x11d422);if(_0x4e331f[_0xa19a('0x31')]['filter']){_0x397157[_0xa19a('0x3b')]=_[_0xa19a('0x3d')](_0x397157['where'],{'$or':_[_0xa19a('0x30')](_0x11d422,function(_0x59af90){if(_0x59af90['type']!==_0xa19a('0x3e')){var _0x491fd9={};_0x491fd9[_0x59af90[_0xa19a('0x2a')]]={'$like':'%'+_0x4e331f[_0xa19a('0x31')][_0xa19a('0x3f')]+'%'};return _0x491fd9;}})});}_0x397157=_[_0xa19a('0x3d')]({},_0x397157,_0x4e331f['options']);var _0x5ecd9b={'where':_0x397157[_0xa19a('0x3b')]};return db['AnalyticFieldReport'][_0xa19a('0x21')](_0x5ecd9b)[_0xa19a('0x26')](function(_0x2d591c){_0x46e3cd[_0xa19a('0x21')]=_0x2d591c;if(_0x4e331f[_0xa19a('0x31')][_0xa19a('0x40')]){_0x397157[_0xa19a('0x41')]=[{'all':!![]}];}return db[_0xa19a('0x2c')]['findAll'](_0x397157);})[_0xa19a('0x26')](function(_0x11e710){_0x46e3cd[_0xa19a('0x42')]=_0x11e710;return _0x46e3cd;})[_0xa19a('0x26')](respondWithFilteredResult(_0x4169c5,_0x397157))[_0xa19a('0x43')](handleError(_0x4169c5,null));};exports['show']=function(_0x421b81,_0xf505ba){var _0x388d66={'raw':![],'where':{'id':_0x421b81[_0xa19a('0x44')]['id']}},_0x483505={};_0x483505[_0xa19a('0x2f')]=_['keys'](db['AnalyticFieldReport'][_0xa19a('0x45')]);_0x483505[_0xa19a('0x31')]=_['keys'](_0x421b81[_0xa19a('0x31')]);_0x483505[_0xa19a('0x33')]=_['intersection'](_0x483505[_0xa19a('0x2f')],_0x483505['query']);_0x388d66[_0xa19a('0x36')]=_[_0xa19a('0x34')](_0x483505['model'],qs[_0xa19a('0x35')](_0x421b81[_0xa19a('0x31')][_0xa19a('0x35')]));_0x388d66[_0xa19a('0x36')]=_0x388d66[_0xa19a('0x36')][_0xa19a('0x37')]?_0x388d66[_0xa19a('0x36')]:_0x483505[_0xa19a('0x2f')];if(_0x421b81[_0xa19a('0x31')][_0xa19a('0x40')]){_0x388d66[_0xa19a('0x41')]=[{'all':!![]}];}_0x388d66=_[_0xa19a('0x3d')]({},_0x388d66,_0x421b81[_0xa19a('0x46')]);return db['AnalyticFieldReport'][_0xa19a('0x47')](_0x388d66)[_0xa19a('0x26')](handleEntityNotFound(_0xf505ba,null))[_0xa19a('0x26')](respondWithResult(_0xf505ba,null))[_0xa19a('0x43')](handleError(_0xf505ba,null));};exports[_0xa19a('0x48')]=function(_0x3595c6,_0x325c4a){return db['AnalyticFieldReport'][_0xa19a('0x48')](_0x3595c6[_0xa19a('0x49')],{})[_0xa19a('0x26')](respondWithResult(_0x325c4a,0xc9))[_0xa19a('0x43')](handleError(_0x325c4a,null));};exports[_0xa19a('0x4a')]=function(_0x1885c4,_0x2821a0){return db[_0xa19a('0x2c')][_0xa19a('0x4a')](_0x1885c4['body'],{'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x2821a0,0xc9))[_0xa19a('0x43')](handleError(_0x2821a0,null));};exports[_0xa19a('0x25')]=function(_0x11df49,_0x11cc5a){if(_0x11df49['body']['id']){delete _0x11df49['body']['id'];}return db['AnalyticFieldReport'][_0xa19a('0x47')]({'where':{'id':_0x11df49[_0xa19a('0x44')]['id']}})[_0xa19a('0x26')](handleEntityNotFound(_0x11cc5a,null))['then'](saveUpdates(_0x11df49[_0xa19a('0x49')],null))['then'](respondWithResult(_0x11cc5a,null))['catch'](handleError(_0x11cc5a,null));};exports[_0xa19a('0x27')]=function(_0x3d092e,_0xa5dc8f){return db[_0xa19a('0x2c')][_0xa19a('0x47')]({'where':{'id':_0x3d092e[_0xa19a('0x44')]['id']}})['then'](handleEntityNotFound(_0xa5dc8f,null))['then'](removeEntity(_0xa5dc8f,null))['catch'](handleError(_0xa5dc8f,null));};exports['bulkDestroy']=function(_0x49d37e,_0x569276){return db['AnalyticFieldReport'][_0xa19a('0x27')]({'where':{'id':_0x49d37e[_0xa19a('0x31')][_0xa19a('0x4b')]||[]},'raw':![],'individualHooks':!![]})[_0xa19a('0x26')](respondWithResult(_0x569276,0xcc))['catch'](handleError(_0x569276,null));};exports['addFields']=function(_0x2a8e35,_0x58fafc,_0x5d43d8){return db[_0xa19a('0x4c')][_0xa19a('0x4d')]({'where':{'id':_0x2a8e35[_0xa19a('0x44')]['id']}})['then'](handleEntityNotFound(_0x58fafc,null))[_0xa19a('0x26')](function(_0x57194a){if(_0x57194a){return db[_0xa19a('0x4e')][_0xa19a('0x4f')](function(_0x49d840){return db[_0xa19a('0x2c')][_0xa19a('0x27')]({'where':{'CustomReportId':_0x2a8e35['params']['id']},'transaction':_0x49d840})[_0xa19a('0x26')](function(_0x2c02e3){var _0x2c6284=_['map'](_0x2a8e35[_0xa19a('0x49')],function(_0x52a23b){delete _0x52a23b['id'];_0x52a23b[_0xa19a('0x50')]=_0x2a8e35[_0xa19a('0x44')]['id'];return _0x52a23b;});return db[_0xa19a('0x2c')][_0xa19a('0x4a')](_0x2c6284,{'transaction':_0x49d840});});})[_0xa19a('0x26')](function(){return db[_0xa19a('0x2c')][_0xa19a('0x51')]({'where':{'CustomReportId':_0x2a8e35['params']['id']}});});}})[_0xa19a('0x26')](respondWithResult(_0x58fafc,null))[_0xa19a('0x43')](handleError(_0x58fafc,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index 42b42ed..27e0bc0 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 _0xf374=['moment','bluebird','request-promise','rimraf','../../config/environment','./analyticFieldReport.attributes','exports','define','AnalyticFieldReport','analytics_report_fields','lodash','util','../../config/logger','api'];(function(_0x290b1b,_0x353177){var _0x47ab7d=function(_0x535507){while(--_0x535507){_0x290b1b['push'](_0x290b1b['shift']());}};_0x47ab7d(++_0x353177);}(_0xf374,0xea));var _0x4f37=function(_0xa943c,_0x260bbd){_0xa943c=_0xa943c-0x0;var _0x53be95=_0xf374[_0xa943c];return _0x53be95;};'use strict';var _=require(_0x4f37('0x0'));var util=require(_0x4f37('0x1'));var logger=require(_0x4f37('0x2'))(_0x4f37('0x3'));var moment=require(_0x4f37('0x4'));var BPromise=require(_0x4f37('0x5'));var rp=require(_0x4f37('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4f37('0x7'));var config=require(_0x4f37('0x8'));var attributes=require(_0x4f37('0x9'));module[_0x4f37('0xa')]=function(_0x341c25,_0x1dd59f){return _0x341c25[_0x4f37('0xb')](_0x4f37('0xc'),attributes,{'tableName':_0x4f37('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x563f=['moment','bluebird','request-promise','path','../../config/environment','./analyticFieldReport.attributes','exports','define','AnalyticFieldReport','analytics_report_fields','lodash','util','../../config/logger','api'];(function(_0x5f519b,_0x5b606f){var _0x2461e2=function(_0x510241){while(--_0x510241){_0x5f519b['push'](_0x5f519b['shift']());}};_0x2461e2(++_0x5b606f);}(_0x563f,0xce));var _0xf563=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x563f[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0xf563('0x0'));var util=require(_0xf563('0x1'));var logger=require(_0xf563('0x2'))(_0xf563('0x3'));var moment=require(_0xf563('0x4'));var BPromise=require(_0xf563('0x5'));var rp=require(_0xf563('0x6'));var fs=require('fs');var path=require(_0xf563('0x7'));var rimraf=require('rimraf');var config=require(_0xf563('0x8'));var attributes=require(_0xf563('0x9'));module[_0xf563('0xa')]=function(_0xf55529,_0xb601a0){return _0xf55529[_0xf563('0xb')](_0xf563('0xc'),attributes,{'tableName':_0xf563('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.rpc.js b/server/api/analyticFieldReport/analyticFieldReport.rpc.js index 01ec66d..5638491 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 _0x02ef=['AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','jayson/promise','client','http','then','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x5833bc,_0x574b06){var _0x289d04=function(_0x28c294){while(--_0x28c294){_0x5833bc['push'](_0x5833bc['shift']());}};_0x289d04(++_0x574b06);}(_0x02ef,0xed));var _0xf02e=function(_0x3034ce,_0x1421b6){_0x3034ce=_0x3034ce-0x0;var _0x4bc0e3=_0x02ef[_0x3034ce];return _0x4bc0e3;};'use strict';var _=require(_0xf02e('0x0'));var util=require(_0xf02e('0x1'));var moment=require(_0xf02e('0x2'));var BPromise=require(_0xf02e('0x3'));var rs=require(_0xf02e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xf02e('0x5'));var logger=require(_0xf02e('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xf02e('0x7'));var client=jayson[_0xf02e('0x8')][_0xf02e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x264fc4,_0x27855c,_0x223cac){return new BPromise(function(_0x311790,_0x3405ec){return client['request'](_0x264fc4,_0x223cac)[_0xf02e('0xa')](function(_0xede5eb){logger[_0xf02e('0xb')](_0xf02e('0xc'),_0x27855c,_0xf02e('0xd'));logger[_0xf02e('0xe')](_0xf02e('0xf'),_0x27855c,_0xf02e('0xd'),JSON[_0xf02e('0x10')](_0xede5eb));if(_0xede5eb[_0xf02e('0x11')]){if(_0xede5eb[_0xf02e('0x11')]['code']===0x1f4){logger[_0xf02e('0x11')](_0xf02e('0xc'),_0x27855c,_0xede5eb['error'][_0xf02e('0x12')]);return _0x3405ec(_0xede5eb[_0xf02e('0x11')]['message']);}logger[_0xf02e('0x11')](_0xf02e('0xc'),_0x27855c,_0xede5eb['error']['message']);return _0x311790(_0xede5eb['error']['message']);}else{logger['info'](_0xf02e('0xc'),_0x27855c,'request\x20sent');_0x311790(_0xede5eb[_0xf02e('0x13')][_0xf02e('0x12')]);}})[_0xf02e('0x14')](function(_0x24546f){logger[_0xf02e('0x11')](_0xf02e('0xc'),_0x27855c,_0x24546f);_0x3405ec(_0x24546f);});});} \ No newline at end of file +var _0x4da8=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','request\x20sent','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','code','AnalyticFieldReport,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0xe25a65,_0x4c06bb){var _0x664c9e=function(_0x1616e6){while(--_0x1616e6){_0xe25a65['push'](_0xe25a65['shift']());}};_0x664c9e(++_0x4c06bb);}(_0x4da8,0x126));var _0x84da=function(_0x5765d8,_0xd8553e){_0x5765d8=_0x5765d8-0x0;var _0x12e996=_0x4da8[_0x5765d8];return _0x12e996;};'use strict';var _=require(_0x84da('0x0'));var util=require(_0x84da('0x1'));var moment=require(_0x84da('0x2'));var BPromise=require(_0x84da('0x3'));var rs=require(_0x84da('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x84da('0x5'))['db'];var utils=require(_0x84da('0x6'));var logger=require(_0x84da('0x7'))(_0x84da('0x8'));var config=require(_0x84da('0x9'));var jayson=require(_0x84da('0xa'));var client=jayson['client'][_0x84da('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x53fb31,_0x5acd10,_0x2f9713){return new BPromise(function(_0x1ceb35,_0x494735){return client['request'](_0x53fb31,_0x2f9713)[_0x84da('0xc')](function(_0x1c10b8){logger[_0x84da('0xd')]('AnalyticFieldReport,\x20%s,\x20%s',_0x5acd10,_0x84da('0xe'));logger['debug'](_0x84da('0xf'),_0x5acd10,'request\x20sent',JSON[_0x84da('0x10')](_0x1c10b8));if(_0x1c10b8['error']){if(_0x1c10b8[_0x84da('0x11')][_0x84da('0x12')]===0x1f4){logger[_0x84da('0x11')](_0x84da('0x13'),_0x5acd10,_0x1c10b8[_0x84da('0x11')][_0x84da('0x14')]);return _0x494735(_0x1c10b8[_0x84da('0x11')]['message']);}logger['error'](_0x84da('0x13'),_0x5acd10,_0x1c10b8[_0x84da('0x11')][_0x84da('0x14')]);return _0x1ceb35(_0x1c10b8['error'][_0x84da('0x14')]);}else{logger[_0x84da('0xd')](_0x84da('0x13'),_0x5acd10,_0x84da('0xe'));_0x1ceb35(_0x1c10b8[_0x84da('0x15')]['message']);}})[_0x84da('0x16')](function(_0xe8fff5){logger[_0x84da('0x11')](_0x84da('0x13'),_0x5acd10,_0xe8fff5);_0x494735(_0xe8fff5);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index e466090..c20c5f3 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(_0x56ca38,_0xb8c2b7){var _0x139a5b=function(_0x2cb8a3){while(--_0x2cb8a3){_0x56ca38['push'](_0x56ca38['shift']());}};_0x139a5b(++_0xb8c2b7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0xa9e0[_0x43d11d];return _0x38cd08;};'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(_0x1df099,_0x353123){var _0x35f53f=function(_0x7d55fd){while(--_0x7d55fd){_0x1df099['push'](_0x1df099['shift']());}};_0x35f53f(++_0x353123);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c3c0b,_0x4ee35e){_0x5c3c0b=_0x5c3c0b-0x0;var _0x52ecd2=_0xa9e0[_0x5c3c0b];return _0x52ecd2;};'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 34a7000..d2c24cb 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 _0xd845=['exports','STRING','name','TEXT','sequelize'];(function(_0x511bd1,_0x223e5b){var _0x4c48ec=function(_0x31814e){while(--_0x31814e){_0x511bd1['push'](_0x511bd1['shift']());}};_0x4c48ec(++_0x223e5b);}(_0xd845,0x135));var _0x5d84=function(_0x186376,_0x5d988a){_0x186376=_0x186376-0x0;var _0x2dbdd9=_0xd845[_0x186376];return _0x2dbdd9;};'use strict';var Sequelize=require(_0x5d84('0x0'));module[_0x5d84('0x1')]={'name':{'type':Sequelize[_0x5d84('0x2')],'allowNull':![],'unique':_0x5d84('0x3')},'table':{'type':Sequelize['STRING']},'metric':{'type':Sequelize[_0x5d84('0x4')]},'description':{'type':Sequelize[_0x5d84('0x2')]}}; \ No newline at end of file +var _0x2547=['TEXT','exports','STRING','name'];(function(_0x264073,_0x4d124c){var _0x400df3=function(_0x3859ee){while(--_0x3859ee){_0x264073['push'](_0x264073['shift']());}};_0x400df3(++_0x4d124c);}(_0x2547,0x1cd));var _0x7254=function(_0x12fe8b,_0x590047){_0x12fe8b=_0x12fe8b-0x0;var _0x38d597=_0x2547[_0x12fe8b];return _0x38d597;};'use strict';var Sequelize=require('sequelize');module[_0x7254('0x0')]={'name':{'type':Sequelize[_0x7254('0x1')],'allowNull':![],'unique':_0x7254('0x2')},'table':{'type':Sequelize[_0x7254('0x1')]},'metric':{'type':Sequelize[_0x7254('0x3')]},'description':{'type':Sequelize[_0x7254('0x1')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index 9670b4e..c765481 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 _0xe5b3=['undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','Metrics','UserProfileResource','destroy','error','stack','name','send','index','map','AnalyticMetric','rawAttributes','type','keys','query','filters','intersection','model','attributes','fields','length','nolimit','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','include','findAll','params','find','catch','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json'];(function(_0x5abe03,_0x26e451){var _0x5302d2=function(_0x2174a5){while(--_0x2174a5){_0x5abe03['push'](_0x5abe03['shift']());}};_0x5302d2(++_0x26e451);}(_0xe5b3,0x133));var _0x3e5b=function(_0x31bdff,_0x21a396){_0x31bdff=_0x31bdff-0x0;var _0x1600bd=_0xe5b3[_0x31bdff];return _0x1600bd;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3e5b('0x0'));var zipdir=require(_0x3e5b('0x1'));var jsonpatch=require(_0x3e5b('0x2'));var rp=require(_0x3e5b('0x3'));var moment=require(_0x3e5b('0x4'));var BPromise=require(_0x3e5b('0x5'));var Mustache=require(_0x3e5b('0x6'));var util=require(_0x3e5b('0x7'));var path=require(_0x3e5b('0x8'));var sox=require(_0x3e5b('0x9'));var csv=require(_0x3e5b('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3e5b('0xb'));var _=require(_0x3e5b('0xc'));var squel=require('squel');var crypto=require(_0x3e5b('0xd'));var jsforce=require(_0x3e5b('0xe'));var deskjs=require(_0x3e5b('0xf'));var toCsv=require(_0x3e5b('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x3e5b('0x10'));var authService=require(_0x3e5b('0x11'));var qs=require(_0x3e5b('0x12'));var as=require(_0x3e5b('0x13'));var hardwareService=require(_0x3e5b('0x14'));var logger=require('../../config/logger')(_0x3e5b('0x15'));var utils=require('../../config/utils');var config=require(_0x3e5b('0x16'));var licenseUtil=require(_0x3e5b('0x17'));var db=require(_0x3e5b('0x18'))['db'];function respondWithStatusCode(_0x374068,_0x20b97b){_0x20b97b=_0x20b97b||0xcc;return function(_0x3c4eb1){if(_0x3c4eb1){return _0x374068[_0x3e5b('0x19')](_0x20b97b);}return _0x374068['status'](_0x20b97b)[_0x3e5b('0x1a')]();};}function respondWithResult(_0x5f2f9c,_0x51a188){_0x51a188=_0x51a188||0xc8;return function(_0x4d71a3){if(_0x4d71a3){return _0x5f2f9c[_0x3e5b('0x1b')](_0x51a188)[_0x3e5b('0x1c')](_0x4d71a3);}};}function respondWithFilteredResult(_0x17aaa3,_0x4fb471){return function(_0x1f81a7){if(_0x1f81a7){var _0x59ddc0=typeof _0x4fb471['offset']===_0x3e5b('0x1d')&&typeof _0x4fb471[_0x3e5b('0x1e')]==='undefined';var _0x3d58a4=_0x1f81a7[_0x3e5b('0x1f')];var _0x555002=_0x59ddc0?0x0:_0x4fb471[_0x3e5b('0x20')];var _0x3365dd=_0x59ddc0?_0x1f81a7['count']:_0x4fb471['offset']+_0x4fb471[_0x3e5b('0x1e')];var _0x20806a;if(_0x3365dd>=_0x3d58a4){_0x3365dd=_0x3d58a4;_0x20806a=0xc8;}else{_0x20806a=0xce;}_0x17aaa3[_0x3e5b('0x1b')](_0x20806a);return _0x17aaa3[_0x3e5b('0x21')](_0x3e5b('0x22'),_0x555002+'-'+_0x3365dd+'/'+_0x3d58a4)[_0x3e5b('0x1c')](_0x1f81a7);}return null;};}function patchUpdates(_0x447d36){return function(_0x21fc32){try{jsonpatch[_0x3e5b('0x23')](_0x21fc32,_0x447d36,!![]);}catch(_0x3d95f3){return BPromise[_0x3e5b('0x24')](_0x3d95f3);}return _0x21fc32[_0x3e5b('0x25')]();};}function saveUpdates(_0x2d77cc,_0x402873){return function(_0x5b46d4){if(_0x5b46d4){return _0x5b46d4[_0x3e5b('0x26')](_0x2d77cc)[_0x3e5b('0x27')](function(_0x2146d4){return _0x2146d4;});}return null;};}function removeEntity(_0x150674,_0x50039b){return function(_0x1eb80f){if(_0x1eb80f){return _0x1eb80f['destroy']()[_0x3e5b('0x27')](function(){var _0x36d960=_0x1eb80f['get']({'plain':!![]});var _0x41b684=_0x3e5b('0x28');return db[_0x3e5b('0x29')][_0x3e5b('0x2a')]({'where':{'type':_0x41b684,'resourceId':_0x36d960['id']}})[_0x3e5b('0x27')](function(){return _0x1eb80f;});})[_0x3e5b('0x27')](function(){_0x150674[_0x3e5b('0x1b')](0xcc)[_0x3e5b('0x1a')]();});}};}function handleEntityNotFound(_0x4c4b89,_0x1c7278){return function(_0x505f40){if(!_0x505f40){_0x4c4b89[_0x3e5b('0x19')](0x194);}return _0x505f40;};}function handleError(_0x4fd64b,_0x101653){_0x101653=_0x101653||0x1f4;return function(_0x1f6473){logger[_0x3e5b('0x2b')](_0x1f6473[_0x3e5b('0x2c')]);if(_0x1f6473[_0x3e5b('0x2d')]){delete _0x1f6473[_0x3e5b('0x2d')];}_0x4fd64b[_0x3e5b('0x1b')](_0x101653)[_0x3e5b('0x2e')](_0x1f6473);};}exports[_0x3e5b('0x2f')]=function(_0x112dc0,_0x1e1565){var _0x489221={},_0x21bc10={},_0x1882aa={'count':0x0,'rows':[]};var _0xa8760b=_[_0x3e5b('0x30')](db[_0x3e5b('0x31')][_0x3e5b('0x32')],function(_0x345927){return{'name':_0x345927['fieldName'],'type':_0x345927[_0x3e5b('0x33')]['key']};});_0x21bc10['model']=_[_0x3e5b('0x30')](_0xa8760b,_0x3e5b('0x2d'));_0x21bc10['query']=_[_0x3e5b('0x34')](_0x112dc0[_0x3e5b('0x35')]);_0x21bc10[_0x3e5b('0x36')]=_[_0x3e5b('0x37')](_0x21bc10[_0x3e5b('0x38')],_0x21bc10[_0x3e5b('0x35')]);_0x489221[_0x3e5b('0x39')]=_[_0x3e5b('0x37')](_0x21bc10[_0x3e5b('0x38')],qs[_0x3e5b('0x3a')](_0x112dc0[_0x3e5b('0x35')][_0x3e5b('0x3a')]));_0x489221['attributes']=_0x489221[_0x3e5b('0x39')][_0x3e5b('0x3b')]?_0x489221['attributes']:_0x21bc10['model'];if(!_0x112dc0[_0x3e5b('0x35')]['hasOwnProperty'](_0x3e5b('0x3c'))){_0x489221[_0x3e5b('0x1e')]=qs[_0x3e5b('0x1e')](_0x112dc0[_0x3e5b('0x35')]['limit']);_0x489221[_0x3e5b('0x20')]=qs['offset'](_0x112dc0[_0x3e5b('0x35')]['offset']);}_0x489221['order']=qs['sort'](_0x112dc0[_0x3e5b('0x35')][_0x3e5b('0x3d')]);_0x489221[_0x3e5b('0x3e')]=qs[_0x3e5b('0x36')](_[_0x3e5b('0x3f')](_0x112dc0[_0x3e5b('0x35')],_0x21bc10['filters']),_0xa8760b);if(_0x112dc0['query']['filter']){_0x489221['where']=_['merge'](_0x489221['where'],{'$or':_['map'](_0xa8760b,function(_0x182bc4){if(_0x182bc4[_0x3e5b('0x33')]!==_0x3e5b('0x40')){var _0x1aafd5={};_0x1aafd5[_0x182bc4[_0x3e5b('0x2d')]]={'$like':'%'+_0x112dc0[_0x3e5b('0x35')][_0x3e5b('0x41')]+'%'};return _0x1aafd5;}})});}_0x489221=_[_0x3e5b('0x42')]({},_0x489221,_0x112dc0[_0x3e5b('0x43')]);var _0xbbc6b={'where':_0x489221[_0x3e5b('0x3e')]};return db['AnalyticMetric'][_0x3e5b('0x1f')](_0xbbc6b)[_0x3e5b('0x27')](function(_0x1e8075){_0x1882aa[_0x3e5b('0x1f')]=_0x1e8075;if(_0x112dc0[_0x3e5b('0x35')][_0x3e5b('0x44')]){_0x489221[_0x3e5b('0x45')]=[{'all':!![]}];}return db[_0x3e5b('0x31')][_0x3e5b('0x46')](_0x489221);})[_0x3e5b('0x27')](function(_0x13c8d5){_0x1882aa['rows']=_0x13c8d5;return _0x1882aa;})['then'](respondWithFilteredResult(_0x1e1565,_0x489221))['catch'](handleError(_0x1e1565,null));};exports['show']=function(_0xa99d75,_0x21ee8a){var _0x9fc025={'raw':!![],'where':{'id':_0xa99d75[_0x3e5b('0x47')]['id']}},_0x24c416={};_0x24c416[_0x3e5b('0x38')]=_[_0x3e5b('0x34')](db[_0x3e5b('0x31')][_0x3e5b('0x32')]);_0x24c416[_0x3e5b('0x35')]=_['keys'](_0xa99d75[_0x3e5b('0x35')]);_0x24c416[_0x3e5b('0x36')]=_[_0x3e5b('0x37')](_0x24c416[_0x3e5b('0x38')],_0x24c416[_0x3e5b('0x35')]);_0x9fc025['attributes']=_['intersection'](_0x24c416['model'],qs[_0x3e5b('0x3a')](_0xa99d75[_0x3e5b('0x35')][_0x3e5b('0x3a')]));_0x9fc025['attributes']=_0x9fc025['attributes'][_0x3e5b('0x3b')]?_0x9fc025[_0x3e5b('0x39')]:_0x24c416[_0x3e5b('0x38')];if(_0xa99d75['query']['includeAll']){_0x9fc025[_0x3e5b('0x45')]=[{'all':!![]}];}_0x9fc025=_['merge']({},_0x9fc025,_0xa99d75[_0x3e5b('0x43')]);return db[_0x3e5b('0x31')][_0x3e5b('0x48')](_0x9fc025)[_0x3e5b('0x27')](handleEntityNotFound(_0x21ee8a,null))[_0x3e5b('0x27')](respondWithResult(_0x21ee8a,null))[_0x3e5b('0x49')](handleError(_0x21ee8a,null));};exports[_0x3e5b('0x4a')]=function(_0x3ea5aa,_0x339852){return db['AnalyticMetric'][_0x3e5b('0x4a')](_0x3ea5aa['body'],{})[_0x3e5b('0x27')](function(_0x2e7047){var _0x26e11e=_0x3ea5aa[_0x3e5b('0x4b')][_0x3e5b('0x4c')]({'plain':!![]});if(!_0x26e11e)throw new Error(_0x3e5b('0x4d'));if(_0x26e11e[_0x3e5b('0x4e')]===_0x3e5b('0x4b')){var _0x2b5d3d=_0x2e7047[_0x3e5b('0x4c')]({'plain':!![]});var _0xf6ca5b=_0x3e5b('0x28');return db[_0x3e5b('0x4f')]['find']({'where':{'name':_0xf6ca5b,'userProfileId':_0x26e11e[_0x3e5b('0x50')]},'raw':!![]})[_0x3e5b('0x27')](function(_0x2ca33b){if(_0x2ca33b&&_0x2ca33b[_0x3e5b('0x51')]===0x0){return db[_0x3e5b('0x29')][_0x3e5b('0x4a')]({'name':_0x2b5d3d['name'],'resourceId':_0x2b5d3d['id'],'type':_0x2ca33b[_0x3e5b('0x2d')],'sectionId':_0x2ca33b['id']},{})[_0x3e5b('0x27')](function(){return _0x2e7047;});}else{return _0x2e7047;}})[_0x3e5b('0x49')](function(_0x314d42){logger[_0x3e5b('0x2b')](_0x3e5b('0x52'),_0x314d42);throw _0x314d42;});}return _0x2e7047;})[_0x3e5b('0x27')](respondWithResult(_0x339852,0xc9))[_0x3e5b('0x49')](handleError(_0x339852,null));};exports['update']=function(_0x1e6403,_0x5e702f){if(_0x1e6403['body']['id']){delete _0x1e6403[_0x3e5b('0x53')]['id'];}return db['AnalyticMetric'][_0x3e5b('0x48')]({'where':{'id':_0x1e6403[_0x3e5b('0x47')]['id']}})[_0x3e5b('0x27')](handleEntityNotFound(_0x5e702f,null))[_0x3e5b('0x27')](saveUpdates(_0x1e6403['body'],null))['then'](respondWithResult(_0x5e702f,null))['catch'](handleError(_0x5e702f,null));};exports['destroy']=function(_0x2ab5f3,_0x999518){return db[_0x3e5b('0x31')][_0x3e5b('0x48')]({'where':{'id':_0x2ab5f3[_0x3e5b('0x47')]['id']}})['then'](handleEntityNotFound(_0x999518,null))['then'](removeEntity(_0x999518,null))[_0x3e5b('0x49')](handleError(_0x999518,null));}; \ No newline at end of file +var _0x9a19=['AnalyticMetric','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','params','options','find','body','user','UserProfileSection','autoAssociation','create','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','save','then','destroy','get','Metrics','stack','name','send','index','map'];(function(_0x54c10f,_0x36e4a6){var _0x10481c=function(_0x43b8df){while(--_0x43b8df){_0x54c10f['push'](_0x54c10f['shift']());}};_0x10481c(++_0x36e4a6);}(_0x9a19,0x114));var _0x99a1=function(_0xa148b7,_0x2f3eb2){_0xa148b7=_0xa148b7-0x0;var _0x51efd3=_0x9a19[_0xa148b7];return _0x51efd3;};'use strict';var emlformat=require(_0x99a1('0x0'));var rimraf=require(_0x99a1('0x1'));var zipdir=require(_0x99a1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x99a1('0x3'));var moment=require(_0x99a1('0x4'));var BPromise=require(_0x99a1('0x5'));var Mustache=require(_0x99a1('0x6'));var util=require(_0x99a1('0x7'));var path=require(_0x99a1('0x8'));var sox=require(_0x99a1('0x9'));var csv=require(_0x99a1('0xa'));var ejs=require(_0x99a1('0xb'));var fs=require('fs');var fs_extra=require(_0x99a1('0xc'));var _=require(_0x99a1('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x99a1('0xe'));var toCsv=require(_0x99a1('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x99a1('0xf'));var authService=require(_0x99a1('0x10'));var qs=require(_0x99a1('0x11'));var as=require(_0x99a1('0x12'));var hardwareService=require(_0x99a1('0x13'));var logger=require('../../config/logger')(_0x99a1('0x14'));var utils=require(_0x99a1('0x15'));var config=require(_0x99a1('0x16'));var licenseUtil=require(_0x99a1('0x17'));var db=require(_0x99a1('0x18'))['db'];function respondWithStatusCode(_0x1bc7aa,_0x2ff655){_0x2ff655=_0x2ff655||0xcc;return function(_0x532f56){if(_0x532f56){return _0x1bc7aa[_0x99a1('0x19')](_0x2ff655);}return _0x1bc7aa[_0x99a1('0x1a')](_0x2ff655)[_0x99a1('0x1b')]();};}function respondWithResult(_0x47815e,_0xe1a1f){_0xe1a1f=_0xe1a1f||0xc8;return function(_0x3c9ef4){if(_0x3c9ef4){return _0x47815e[_0x99a1('0x1a')](_0xe1a1f)['json'](_0x3c9ef4);}};}function respondWithFilteredResult(_0x2d81ed,_0x3e45d4){return function(_0x1bb464){if(_0x1bb464){var _0x3d40cc=typeof _0x3e45d4[_0x99a1('0x1c')]===_0x99a1('0x1d')&&typeof _0x3e45d4[_0x99a1('0x1e')]==='undefined';var _0x4f049c=_0x1bb464[_0x99a1('0x1f')];var _0xbf62f1=_0x3d40cc?0x0:_0x3e45d4[_0x99a1('0x1c')];var _0x1fcd00=_0x3d40cc?_0x1bb464[_0x99a1('0x1f')]:_0x3e45d4[_0x99a1('0x1c')]+_0x3e45d4[_0x99a1('0x1e')];var _0x3cd62c;if(_0x1fcd00>=_0x4f049c){_0x1fcd00=_0x4f049c;_0x3cd62c=0xc8;}else{_0x3cd62c=0xce;}_0x2d81ed[_0x99a1('0x1a')](_0x3cd62c);return _0x2d81ed[_0x99a1('0x20')](_0x99a1('0x21'),_0xbf62f1+'-'+_0x1fcd00+'/'+_0x4f049c)['json'](_0x1bb464);}return null;};}function patchUpdates(_0x3023a1){return function(_0x20007e){try{jsonpatch['apply'](_0x20007e,_0x3023a1,!![]);}catch(_0x38435b){return BPromise['reject'](_0x38435b);}return _0x20007e[_0x99a1('0x22')]();};}function saveUpdates(_0x2927b0,_0x2d6f20){return function(_0x2d3b82){if(_0x2d3b82){return _0x2d3b82['update'](_0x2927b0)[_0x99a1('0x23')](function(_0x1268a7){return _0x1268a7;});}return null;};}function removeEntity(_0x483c17,_0x44df2d){return function(_0x5b5dfa){if(_0x5b5dfa){return _0x5b5dfa[_0x99a1('0x24')]()[_0x99a1('0x23')](function(){var _0x179597=_0x5b5dfa[_0x99a1('0x25')]({'plain':!![]});var _0x3c813=_0x99a1('0x26');return db['UserProfileResource'][_0x99a1('0x24')]({'where':{'type':_0x3c813,'resourceId':_0x179597['id']}})['then'](function(){return _0x5b5dfa;});})['then'](function(){_0x483c17[_0x99a1('0x1a')](0xcc)[_0x99a1('0x1b')]();});}};}function handleEntityNotFound(_0xa6799b,_0x15a0b6){return function(_0x25d560){if(!_0x25d560){_0xa6799b[_0x99a1('0x19')](0x194);}return _0x25d560;};}function handleError(_0x183037,_0x549645){_0x549645=_0x549645||0x1f4;return function(_0xf41b0d){logger['error'](_0xf41b0d[_0x99a1('0x27')]);if(_0xf41b0d[_0x99a1('0x28')]){delete _0xf41b0d[_0x99a1('0x28')];}_0x183037['status'](_0x549645)[_0x99a1('0x29')](_0xf41b0d);};}exports[_0x99a1('0x2a')]=function(_0x5718b9,_0x37514e){var _0x1434a0={},_0x36aa34={},_0x303d1e={'count':0x0,'rows':[]};var _0x2a5b8c=_[_0x99a1('0x2b')](db[_0x99a1('0x2c')][_0x99a1('0x2d')],function(_0x52da8d){return{'name':_0x52da8d['fieldName'],'type':_0x52da8d[_0x99a1('0x2e')]['key']};});_0x36aa34[_0x99a1('0x2f')]=_[_0x99a1('0x2b')](_0x2a5b8c,'name');_0x36aa34[_0x99a1('0x30')]=_[_0x99a1('0x31')](_0x5718b9[_0x99a1('0x30')]);_0x36aa34[_0x99a1('0x32')]=_[_0x99a1('0x33')](_0x36aa34[_0x99a1('0x2f')],_0x36aa34[_0x99a1('0x30')]);_0x1434a0[_0x99a1('0x34')]=_[_0x99a1('0x33')](_0x36aa34[_0x99a1('0x2f')],qs[_0x99a1('0x35')](_0x5718b9[_0x99a1('0x30')][_0x99a1('0x35')]));_0x1434a0[_0x99a1('0x34')]=_0x1434a0['attributes']['length']?_0x1434a0[_0x99a1('0x34')]:_0x36aa34[_0x99a1('0x2f')];if(!_0x5718b9[_0x99a1('0x30')][_0x99a1('0x36')](_0x99a1('0x37'))){_0x1434a0[_0x99a1('0x1e')]=qs[_0x99a1('0x1e')](_0x5718b9['query'][_0x99a1('0x1e')]);_0x1434a0[_0x99a1('0x1c')]=qs['offset'](_0x5718b9[_0x99a1('0x30')][_0x99a1('0x1c')]);}_0x1434a0[_0x99a1('0x38')]=qs[_0x99a1('0x39')](_0x5718b9[_0x99a1('0x30')][_0x99a1('0x39')]);_0x1434a0[_0x99a1('0x3a')]=qs[_0x99a1('0x32')](_[_0x99a1('0x3b')](_0x5718b9[_0x99a1('0x30')],_0x36aa34[_0x99a1('0x32')]),_0x2a5b8c);if(_0x5718b9[_0x99a1('0x30')][_0x99a1('0x3c')]){_0x1434a0['where']=_['merge'](_0x1434a0['where'],{'$or':_[_0x99a1('0x2b')](_0x2a5b8c,function(_0x169df7){if(_0x169df7[_0x99a1('0x2e')]!==_0x99a1('0x3d')){var _0x40613a={};_0x40613a[_0x169df7['name']]={'$like':'%'+_0x5718b9[_0x99a1('0x30')][_0x99a1('0x3c')]+'%'};return _0x40613a;}})});}_0x1434a0=_[_0x99a1('0x3e')]({},_0x1434a0,_0x5718b9['options']);var _0x49be37={'where':_0x1434a0[_0x99a1('0x3a')]};return db[_0x99a1('0x2c')][_0x99a1('0x1f')](_0x49be37)['then'](function(_0x6c4cb){_0x303d1e[_0x99a1('0x1f')]=_0x6c4cb;if(_0x5718b9[_0x99a1('0x30')][_0x99a1('0x3f')]){_0x1434a0[_0x99a1('0x40')]=[{'all':!![]}];}return db[_0x99a1('0x2c')][_0x99a1('0x41')](_0x1434a0);})[_0x99a1('0x23')](function(_0x1c4ce4){_0x303d1e[_0x99a1('0x42')]=_0x1c4ce4;return _0x303d1e;})['then'](respondWithFilteredResult(_0x37514e,_0x1434a0))[_0x99a1('0x43')](handleError(_0x37514e,null));};exports[_0x99a1('0x44')]=function(_0x3d5373,_0x50d38b){var _0x1beed2={'raw':!![],'where':{'id':_0x3d5373[_0x99a1('0x45')]['id']}},_0x51536d={};_0x51536d[_0x99a1('0x2f')]=_[_0x99a1('0x31')](db[_0x99a1('0x2c')][_0x99a1('0x2d')]);_0x51536d[_0x99a1('0x30')]=_['keys'](_0x3d5373[_0x99a1('0x30')]);_0x51536d['filters']=_[_0x99a1('0x33')](_0x51536d[_0x99a1('0x2f')],_0x51536d[_0x99a1('0x30')]);_0x1beed2[_0x99a1('0x34')]=_[_0x99a1('0x33')](_0x51536d[_0x99a1('0x2f')],qs[_0x99a1('0x35')](_0x3d5373[_0x99a1('0x30')][_0x99a1('0x35')]));_0x1beed2[_0x99a1('0x34')]=_0x1beed2[_0x99a1('0x34')]['length']?_0x1beed2[_0x99a1('0x34')]:_0x51536d[_0x99a1('0x2f')];if(_0x3d5373['query'][_0x99a1('0x3f')]){_0x1beed2[_0x99a1('0x40')]=[{'all':!![]}];}_0x1beed2=_[_0x99a1('0x3e')]({},_0x1beed2,_0x3d5373[_0x99a1('0x46')]);return db[_0x99a1('0x2c')][_0x99a1('0x47')](_0x1beed2)[_0x99a1('0x23')](handleEntityNotFound(_0x50d38b,null))['then'](respondWithResult(_0x50d38b,null))[_0x99a1('0x43')](handleError(_0x50d38b,null));};exports['create']=function(_0x1d4d3f,_0x269798){return db['AnalyticMetric']['create'](_0x1d4d3f[_0x99a1('0x48')],{})[_0x99a1('0x23')](function(_0x462c15){var _0x4519fb=_0x1d4d3f[_0x99a1('0x49')]['get']({'plain':!![]});if(!_0x4519fb)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4519fb['role']===_0x99a1('0x49')){var _0x4ae90e=_0x462c15[_0x99a1('0x25')]({'plain':!![]});var _0x30fdfb=_0x99a1('0x26');return db[_0x99a1('0x4a')][_0x99a1('0x47')]({'where':{'name':_0x30fdfb,'userProfileId':_0x4519fb['userProfileId']},'raw':!![]})[_0x99a1('0x23')](function(_0x22bfd8){if(_0x22bfd8&&_0x22bfd8[_0x99a1('0x4b')]===0x0){return db['UserProfileResource'][_0x99a1('0x4c')]({'name':_0x4ae90e['name'],'resourceId':_0x4ae90e['id'],'type':_0x22bfd8['name'],'sectionId':_0x22bfd8['id']},{})[_0x99a1('0x23')](function(){return _0x462c15;});}else{return _0x462c15;}})[_0x99a1('0x43')](function(_0x1dd17b){logger[_0x99a1('0x4d')](_0x99a1('0x4e'),_0x1dd17b);throw _0x1dd17b;});}return _0x462c15;})[_0x99a1('0x23')](respondWithResult(_0x269798,0xc9))[_0x99a1('0x43')](handleError(_0x269798,null));};exports[_0x99a1('0x4f')]=function(_0x16641e,_0x53e9eb){if(_0x16641e[_0x99a1('0x48')]['id']){delete _0x16641e['body']['id'];}return db[_0x99a1('0x2c')][_0x99a1('0x47')]({'where':{'id':_0x16641e['params']['id']}})[_0x99a1('0x23')](handleEntityNotFound(_0x53e9eb,null))[_0x99a1('0x23')](saveUpdates(_0x16641e[_0x99a1('0x48')],null))[_0x99a1('0x23')](respondWithResult(_0x53e9eb,null))[_0x99a1('0x43')](handleError(_0x53e9eb,null));};exports[_0x99a1('0x24')]=function(_0x157c49,_0x1a5658){return db[_0x99a1('0x2c')][_0x99a1('0x47')]({'where':{'id':_0x157c49[_0x99a1('0x45')]['id']}})[_0x99a1('0x23')](handleEntityNotFound(_0x1a5658,null))['then'](removeEntity(_0x1a5658,null))['catch'](handleError(_0x1a5658,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index 6424af9..4e2f35e 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 _0x077e=['./analyticMetric.attributes','exports','define','AnalyticMetric','analytics_metrics','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment'];(function(_0x2cbec0,_0x262fef){var _0x3d4101=function(_0x549a36){while(--_0x549a36){_0x2cbec0['push'](_0x2cbec0['shift']());}};_0x3d4101(++_0x262fef);}(_0x077e,0x14a));var _0xe077=function(_0x42c93e,_0x17b116){_0x42c93e=_0x42c93e-0x0;var _0x39b6b3=_0x077e[_0x42c93e];return _0x39b6b3;};'use strict';var _=require(_0xe077('0x0'));var util=require(_0xe077('0x1'));var logger=require(_0xe077('0x2'))(_0xe077('0x3'));var moment=require('moment');var BPromise=require(_0xe077('0x4'));var rp=require(_0xe077('0x5'));var fs=require('fs');var path=require(_0xe077('0x6'));var rimraf=require('rimraf');var config=require(_0xe077('0x7'));var attributes=require(_0xe077('0x8'));module[_0xe077('0x9')]=function(_0xe4430c,_0x3a9d18){return _0xe4430c[_0xe077('0xa')](_0xe077('0xb'),attributes,{'tableName':_0xe077('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x58e6=['lodash','util','bluebird','path','rimraf','../../config/environment','./analyticMetric.attributes','exports','analytics_metrics'];(function(_0x524fc3,_0x5f15e4){var _0xd772ba=function(_0x2870da){while(--_0x2870da){_0x524fc3['push'](_0x524fc3['shift']());}};_0xd772ba(++_0x5f15e4);}(_0x58e6,0x1c2));var _0x658e=function(_0x2e9590,_0x54fe0e){_0x2e9590=_0x2e9590-0x0;var _0x375a8a=_0x58e6[_0x2e9590];return _0x375a8a;};'use strict';var _=require(_0x658e('0x0'));var util=require(_0x658e('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x658e('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x658e('0x3'));var rimraf=require(_0x658e('0x4'));var config=require(_0x658e('0x5'));var attributes=require(_0x658e('0x6'));module[_0x658e('0x7')]=function(_0x2add44,_0x3251b8){return _0x2add44['define']('AnalyticMetric',attributes,{'tableName':_0x658e('0x8'),'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 493e526..f0ee46d 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 _0x715a=['AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then'];(function(_0x2b9b7f,_0x4d47df){var _0x4ed19a=function(_0x72b5ff){while(--_0x72b5ff){_0x2b9b7f['push'](_0x2b9b7f['shift']());}};_0x4ed19a(++_0x4d47df);}(_0x715a,0xf0));var _0xa715=function(_0x14fddb,_0x3ed40b){_0x14fddb=_0x14fddb-0x0;var _0x1c2b95=_0x715a[_0x14fddb];return _0x1c2b95;};'use strict';var _=require(_0xa715('0x0'));var util=require(_0xa715('0x1'));var moment=require('moment');var BPromise=require(_0xa715('0x2'));var rs=require(_0xa715('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa715('0x4'))['db'];var utils=require(_0xa715('0x5'));var logger=require(_0xa715('0x6'))(_0xa715('0x7'));var config=require(_0xa715('0x8'));var jayson=require(_0xa715('0x9'));var client=jayson[_0xa715('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3663ff,_0x54ebec,_0xfad623){return new BPromise(function(_0x252b9b,_0x31302b){return client['request'](_0x3663ff,_0xfad623)[_0xa715('0xb')](function(_0x34c002){logger['info'](_0xa715('0xc'),_0x54ebec,_0xa715('0xd'));logger[_0xa715('0xe')](_0xa715('0xf'),_0x54ebec,_0xa715('0xd'),JSON[_0xa715('0x10')](_0x34c002));if(_0x34c002[_0xa715('0x11')]){if(_0x34c002[_0xa715('0x11')]['code']===0x1f4){logger[_0xa715('0x11')](_0xa715('0xc'),_0x54ebec,_0x34c002[_0xa715('0x11')][_0xa715('0x12')]);return _0x31302b(_0x34c002[_0xa715('0x11')][_0xa715('0x12')]);}logger['error']('AnalyticMetric,\x20%s,\x20%s',_0x54ebec,_0x34c002[_0xa715('0x11')][_0xa715('0x12')]);return _0x252b9b(_0x34c002[_0xa715('0x11')]['message']);}else{logger[_0xa715('0x13')](_0xa715('0xc'),_0x54ebec,_0xa715('0xd'));_0x252b9b(_0x34c002['result'][_0xa715('0x12')]);}})[_0xa715('0x14')](function(_0x1c02f7){logger['error'](_0xa715('0xc'),_0x54ebec,_0x1c02f7);_0x31302b(_0x1c02f7);});});} \ No newline at end of file +var _0xbccb=['debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','code','AnalyticMetric,\x20%s,\x20%s','message','result','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','info','request\x20sent'];(function(_0x1bbb9f,_0x296ef6){var _0x2293cd=function(_0x5827f6){while(--_0x5827f6){_0x1bbb9f['push'](_0x1bbb9f['shift']());}};_0x2293cd(++_0x296ef6);}(_0xbccb,0x138));var _0xbbcc=function(_0x23ac30,_0x2a1d00){_0x23ac30=_0x23ac30-0x0;var _0x208fec=_0xbccb[_0x23ac30];return _0x208fec;};'use strict';var _=require('lodash');var util=require(_0xbbcc('0x0'));var moment=require(_0xbbcc('0x1'));var BPromise=require('bluebird');var rs=require(_0xbbcc('0x2'));var fs=require('fs');var Redis=require(_0xbbcc('0x3'));var db=require(_0xbbcc('0x4'))['db'];var utils=require(_0xbbcc('0x5'));var logger=require(_0xbbcc('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xbbcc('0x7'));var client=jayson['client'][_0xbbcc('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1a8713,_0x44543c,_0x552e25){return new BPromise(function(_0xac73f6,_0x54b286){return client['request'](_0x1a8713,_0x552e25)['then'](function(_0x419530){logger[_0xbbcc('0x9')]('AnalyticMetric,\x20%s,\x20%s',_0x44543c,_0xbbcc('0xa'));logger[_0xbbcc('0xb')](_0xbbcc('0xc'),_0x44543c,_0xbbcc('0xa'),JSON[_0xbbcc('0xd')](_0x419530));if(_0x419530[_0xbbcc('0xe')]){if(_0x419530[_0xbbcc('0xe')][_0xbbcc('0xf')]===0x1f4){logger['error'](_0xbbcc('0x10'),_0x44543c,_0x419530[_0xbbcc('0xe')]['message']);return _0x54b286(_0x419530[_0xbbcc('0xe')][_0xbbcc('0x11')]);}logger['error'](_0xbbcc('0x10'),_0x44543c,_0x419530['error'][_0xbbcc('0x11')]);return _0xac73f6(_0x419530[_0xbbcc('0xe')][_0xbbcc('0x11')]);}else{logger[_0xbbcc('0x9')](_0xbbcc('0x10'),_0x44543c,'request\x20sent');_0xac73f6(_0x419530[_0xbbcc('0x12')][_0xbbcc('0x11')]);}})['catch'](function(_0x10dd14){logger[_0xbbcc('0xe')]('AnalyticMetric,\x20%s,\x20%s',_0x44543c,_0x10dd14);_0x54b286(_0x10dd14);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index 556f0d7..ff1091c 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 _0xa9b1=['index','/:id','show','post','create','put','delete','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','get','isAuthenticated'];(function(_0x3b3880,_0x3782ee){var _0x2243bc=function(_0x25a391){while(--_0x25a391){_0x3b3880['push'](_0x3b3880['shift']());}};_0x2243bc(++_0x3782ee);}(_0xa9b1,0x133));var _0x1a9b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa9b1[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1a9b('0x0'));var timeout=require(_0x1a9b('0x1'));var express=require(_0x1a9b('0x2'));var router=express[_0x1a9b('0x3')]();var fs_extra=require(_0x1a9b('0x4'));var auth=require(_0x1a9b('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./analyticMetric.controller');router[_0x1a9b('0x6')]('/',auth[_0x1a9b('0x7')](),controller[_0x1a9b('0x8')]);router[_0x1a9b('0x6')](_0x1a9b('0x9'),auth[_0x1a9b('0x7')](),controller[_0x1a9b('0xa')]);router[_0x1a9b('0xb')]('/',auth[_0x1a9b('0x7')](),controller[_0x1a9b('0xc')]);router[_0x1a9b('0xd')](_0x1a9b('0x9'),auth['isAuthenticated'](),controller['update']);router[_0x1a9b('0xe')](_0x1a9b('0x9'),auth[_0x1a9b('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xaa3f=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','index','/:id','isAuthenticated','show','post','put','delete','destroy','exports','multer','util','path'];(function(_0x255d5b,_0x4f6f35){var _0x3e141a=function(_0x249ee2){while(--_0x249ee2){_0x255d5b['push'](_0x255d5b['shift']());}};_0x3e141a(++_0x4f6f35);}(_0xaa3f,0xbb));var _0xfaa3=function(_0x8031f3,_0x356086){_0x8031f3=_0x8031f3-0x0;var _0x39a15a=_0xaa3f[_0x8031f3];return _0x39a15a;};'use strict';var multer=require(_0xfaa3('0x0'));var util=require(_0xfaa3('0x1'));var path=require(_0xfaa3('0x2'));var timeout=require(_0xfaa3('0x3'));var express=require(_0xfaa3('0x4'));var router=express[_0xfaa3('0x5')]();var fs_extra=require(_0xfaa3('0x6'));var auth=require(_0xfaa3('0x7'));var interaction=require(_0xfaa3('0x8'));var config=require('../../config/environment');var controller=require('./analyticMetric.controller');router[_0xfaa3('0x9')]('/',auth['isAuthenticated'](),controller[_0xfaa3('0xa')]);router[_0xfaa3('0x9')](_0xfaa3('0xb'),auth[_0xfaa3('0xc')](),controller[_0xfaa3('0xd')]);router[_0xfaa3('0xe')]('/',auth[_0xfaa3('0xc')](),controller['create']);router[_0xfaa3('0xf')](_0xfaa3('0xb'),auth['isAuthenticated'](),controller['update']);router[_0xfaa3('0x10')](_0xfaa3('0xb'),auth[_0xfaa3('0xc')](),controller[_0xfaa3('0x11')]);module[_0xfaa3('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 d237864..a4dee8f 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 _0xe075=['TEXT','exports'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0xe075,0x143));var _0x5e07=function(_0x22c758,_0x3f09df){_0x22c758=_0x22c758-0x0;var _0x2d6cf3=_0xe075[_0x22c758];return _0x2d6cf3;};'use strict';var Sequelize=require('sequelize');module[_0x5e07('0x0')]={'tree':{'type':Sequelize[_0x5e07('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x7267=['TEXT','sequelize','exports'];(function(_0x41fb98,_0x470189){var _0x4b0044=function(_0xf8b2ec){while(--_0xf8b2ec){_0x41fb98['push'](_0x41fb98['shift']());}};_0x4b0044(++_0x470189);}(_0x7267,0x97));var _0x7726=function(_0x4ef040,_0x434b97){_0x4ef040=_0x4ef040-0x0;var _0x5d7f4d=_0x7267[_0x4ef040];return _0x5d7f4d;};'use strict';var Sequelize=require(_0x7726('0x0'));module[_0x7726('0x1')]={'tree':{'type':Sequelize[_0x7726('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index 7cdc1ed..8f29302 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 _0x582f=['save','update','then','destroy','stack','name','send','map','AnalyticTreeReport','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','options','includeAll','include','rows','params','rawAttributes','catch','create','body','find','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','desk.js','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','sendStatus','end','offset','undefined','count','limit','status','set','Content-Range','json','reject'];(function(_0x11ea14,_0x5bddf5){var _0x5286f8=function(_0x31ba7a){while(--_0x31ba7a){_0x11ea14['push'](_0x11ea14['shift']());}};_0x5286f8(++_0x5bddf5);}(_0x582f,0x179));var _0xf582=function(_0x45f111,_0x3a1a4a){_0x45f111=_0x45f111-0x0;var _0x483508=_0x582f[_0x45f111];return _0x483508;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf582('0x0'));var zipdir=require(_0xf582('0x1'));var jsonpatch=require(_0xf582('0x2'));var rp=require(_0xf582('0x3'));var moment=require(_0xf582('0x4'));var BPromise=require(_0xf582('0x5'));var Mustache=require(_0xf582('0x6'));var util=require(_0xf582('0x7'));var path=require(_0xf582('0x8'));var sox=require(_0xf582('0x9'));var csv=require(_0xf582('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf582('0xb'));var squel=require(_0xf582('0xc'));var crypto=require(_0xf582('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xf582('0xe'));var toCsv=require(_0xf582('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xf582('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xf582('0x10'));var hardwareService=require(_0xf582('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0xf582('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xf582('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x30b1db,_0x5d5e43){_0x5d5e43=_0x5d5e43||0xcc;return function(_0xf2a751){if(_0xf2a751){return _0x30b1db[_0xf582('0x14')](_0x5d5e43);}return _0x30b1db['status'](_0x5d5e43)[_0xf582('0x15')]();};}function respondWithResult(_0x5096af,_0x1c3ddd){_0x1c3ddd=_0x1c3ddd||0xc8;return function(_0xb0c1bd){if(_0xb0c1bd){return _0x5096af['status'](_0x1c3ddd)['json'](_0xb0c1bd);}};}function respondWithFilteredResult(_0x5e16a5,_0x69a0d4){return function(_0x51ea4e){if(_0x51ea4e){var _0x2ae539=typeof _0x69a0d4[_0xf582('0x16')]===_0xf582('0x17')&&typeof _0x69a0d4['limit']===_0xf582('0x17');var _0x3d6f16=_0x51ea4e[_0xf582('0x18')];var _0x5acf84=_0x2ae539?0x0:_0x69a0d4[_0xf582('0x16')];var _0x4a935a=_0x2ae539?_0x51ea4e[_0xf582('0x18')]:_0x69a0d4['offset']+_0x69a0d4[_0xf582('0x19')];var _0x3ee3ac;if(_0x4a935a>=_0x3d6f16){_0x4a935a=_0x3d6f16;_0x3ee3ac=0xc8;}else{_0x3ee3ac=0xce;}_0x5e16a5[_0xf582('0x1a')](_0x3ee3ac);return _0x5e16a5[_0xf582('0x1b')](_0xf582('0x1c'),_0x5acf84+'-'+_0x4a935a+'/'+_0x3d6f16)[_0xf582('0x1d')](_0x51ea4e);}return null;};}function patchUpdates(_0x56ace6){return function(_0x1e21c9){try{jsonpatch['apply'](_0x1e21c9,_0x56ace6,!![]);}catch(_0x101181){return BPromise[_0xf582('0x1e')](_0x101181);}return _0x1e21c9[_0xf582('0x1f')]();};}function saveUpdates(_0x256125,_0x1397f2){return function(_0x3ab768){if(_0x3ab768){return _0x3ab768[_0xf582('0x20')](_0x256125)[_0xf582('0x21')](function(_0x34f6ca){return _0x34f6ca;});}return null;};}function removeEntity(_0x240818,_0x1f7295){return function(_0x1b06ac){if(_0x1b06ac){return _0x1b06ac[_0xf582('0x22')]()[_0xf582('0x21')](function(){_0x240818[_0xf582('0x1a')](0xcc)[_0xf582('0x15')]();});}};}function handleEntityNotFound(_0x5d85cd,_0x774cb3){return function(_0x3073b5){if(!_0x3073b5){_0x5d85cd[_0xf582('0x14')](0x194);}return _0x3073b5;};}function handleError(_0x51bce9,_0x13256e){_0x13256e=_0x13256e||0x1f4;return function(_0x22578b){logger['error'](_0x22578b[_0xf582('0x23')]);if(_0x22578b[_0xf582('0x24')]){delete _0x22578b[_0xf582('0x24')];}_0x51bce9[_0xf582('0x1a')](_0x13256e)[_0xf582('0x25')](_0x22578b);};}exports['index']=function(_0x540e92,_0x2d582d){var _0x1918e1={},_0x5dc65a={},_0x57f1ff={'count':0x0,'rows':[]};var _0x464926=_[_0xf582('0x26')](db[_0xf582('0x27')]['rawAttributes'],function(_0x55bbf4){return{'name':_0x55bbf4['fieldName'],'type':_0x55bbf4[_0xf582('0x28')][_0xf582('0x29')]};});_0x5dc65a['model']=_[_0xf582('0x26')](_0x464926,_0xf582('0x24'));_0x5dc65a[_0xf582('0x2a')]=_[_0xf582('0x2b')](_0x540e92['query']);_0x5dc65a[_0xf582('0x2c')]=_[_0xf582('0x2d')](_0x5dc65a[_0xf582('0x2e')],_0x5dc65a['query']);_0x1918e1[_0xf582('0x2f')]=_[_0xf582('0x2d')](_0x5dc65a[_0xf582('0x2e')],qs['fields'](_0x540e92['query'][_0xf582('0x30')]));_0x1918e1['attributes']=_0x1918e1[_0xf582('0x2f')][_0xf582('0x31')]?_0x1918e1[_0xf582('0x2f')]:_0x5dc65a[_0xf582('0x2e')];if(!_0x540e92[_0xf582('0x2a')][_0xf582('0x32')](_0xf582('0x33'))){_0x1918e1[_0xf582('0x19')]=qs[_0xf582('0x19')](_0x540e92['query'][_0xf582('0x19')]);_0x1918e1[_0xf582('0x16')]=qs[_0xf582('0x16')](_0x540e92[_0xf582('0x2a')]['offset']);}_0x1918e1[_0xf582('0x34')]=qs['sort'](_0x540e92[_0xf582('0x2a')][_0xf582('0x35')]);_0x1918e1[_0xf582('0x36')]=qs[_0xf582('0x2c')](_['pick'](_0x540e92[_0xf582('0x2a')],_0x5dc65a['filters']),_0x464926);if(_0x540e92['query'][_0xf582('0x37')]){_0x1918e1[_0xf582('0x36')]=_['merge'](_0x1918e1['where'],{'$or':_[_0xf582('0x26')](_0x464926,function(_0x240274){if(_0x240274[_0xf582('0x28')]!==_0xf582('0x38')){var _0x552933={};_0x552933[_0x240274[_0xf582('0x24')]]={'$like':'%'+_0x540e92[_0xf582('0x2a')][_0xf582('0x37')]+'%'};return _0x552933;}})});}_0x1918e1=_[_0xf582('0x39')]({},_0x1918e1,_0x540e92[_0xf582('0x3a')]);var _0x6eb4ba={'where':_0x1918e1[_0xf582('0x36')]};return db[_0xf582('0x27')][_0xf582('0x18')](_0x6eb4ba)['then'](function(_0xd6cf29){_0x57f1ff[_0xf582('0x18')]=_0xd6cf29;if(_0x540e92[_0xf582('0x2a')][_0xf582('0x3b')]){_0x1918e1[_0xf582('0x3c')]=[{'all':!![]}];}return db[_0xf582('0x27')]['findAll'](_0x1918e1);})[_0xf582('0x21')](function(_0x775413){_0x57f1ff[_0xf582('0x3d')]=_0x775413;return _0x57f1ff;})[_0xf582('0x21')](respondWithFilteredResult(_0x2d582d,_0x1918e1))['catch'](handleError(_0x2d582d,null));};exports['show']=function(_0x2b288d,_0x5da7d7){var _0x250570={'raw':!![],'where':{'id':_0x2b288d[_0xf582('0x3e')]['id']}},_0x38d482={};_0x38d482[_0xf582('0x2e')]=_[_0xf582('0x2b')](db[_0xf582('0x27')][_0xf582('0x3f')]);_0x38d482[_0xf582('0x2a')]=_[_0xf582('0x2b')](_0x2b288d[_0xf582('0x2a')]);_0x38d482['filters']=_[_0xf582('0x2d')](_0x38d482['model'],_0x38d482['query']);_0x250570[_0xf582('0x2f')]=_['intersection'](_0x38d482[_0xf582('0x2e')],qs['fields'](_0x2b288d[_0xf582('0x2a')][_0xf582('0x30')]));_0x250570['attributes']=_0x250570[_0xf582('0x2f')][_0xf582('0x31')]?_0x250570[_0xf582('0x2f')]:_0x38d482[_0xf582('0x2e')];if(_0x2b288d['query'][_0xf582('0x3b')]){_0x250570[_0xf582('0x3c')]=[{'all':!![]}];}_0x250570=_['merge']({},_0x250570,_0x2b288d[_0xf582('0x3a')]);return db[_0xf582('0x27')]['find'](_0x250570)[_0xf582('0x21')](handleEntityNotFound(_0x5da7d7,null))['then'](respondWithResult(_0x5da7d7,null))[_0xf582('0x40')](handleError(_0x5da7d7,null));};exports[_0xf582('0x41')]=function(_0x510700,_0x368cb7){return db['AnalyticTreeReport']['create'](_0x510700[_0xf582('0x42')],{})['then'](respondWithResult(_0x368cb7,0xc9))[_0xf582('0x40')](handleError(_0x368cb7,null));};exports[_0xf582('0x20')]=function(_0x258a2f,_0x38a9c6){if(_0x258a2f[_0xf582('0x42')]['id']){delete _0x258a2f[_0xf582('0x42')]['id'];}return db['AnalyticTreeReport'][_0xf582('0x43')]({'where':{'id':_0x258a2f['params']['id']}})['then'](handleEntityNotFound(_0x38a9c6,null))[_0xf582('0x21')](saveUpdates(_0x258a2f['body'],null))['then'](respondWithResult(_0x38a9c6,null))[_0xf582('0x40')](handleError(_0x38a9c6,null));};exports['destroy']=function(_0x320bfc,_0x5f433d){return db[_0xf582('0x27')][_0xf582('0x43')]({'where':{'id':_0x320bfc['params']['id']}})[_0xf582('0x21')](handleEntityNotFound(_0x5f433d,null))[_0xf582('0x21')](removeEntity(_0x5f433d,null))[_0xf582('0x40')](handleError(_0x5f433d,null));}; \ No newline at end of file +var _0x7610=['crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','then','destroy','error','name','send','index','map','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','AnalyticTreeReport','includeAll','include','rows','show','params','keys','find','create','body','catch','update','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel'];(function(_0xe5287b,_0x26b8ab){var _0x346f77=function(_0x4d52d7){while(--_0x4d52d7){_0xe5287b['push'](_0xe5287b['shift']());}};_0x346f77(++_0x26b8ab);}(_0x7610,0x1ec));var _0x0761=function(_0x56d92b,_0x5a4d5e){_0x56d92b=_0x56d92b-0x0;var _0x4d7f32=_0x7610[_0x56d92b];return _0x4d7f32;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0761('0x0'));var zipdir=require(_0x0761('0x1'));var jsonpatch=require(_0x0761('0x2'));var rp=require('request-promise');var moment=require(_0x0761('0x3'));var BPromise=require(_0x0761('0x4'));var Mustache=require(_0x0761('0x5'));var util=require(_0x0761('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x0761('0x7'));var ejs=require(_0x0761('0x8'));var fs=require('fs');var fs_extra=require(_0x0761('0x9'));var _=require(_0x0761('0xa'));var squel=require(_0x0761('0xb'));var crypto=require(_0x0761('0xc'));var jsforce=require(_0x0761('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0761('0xe'));var Redis=require(_0x0761('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x0761('0x10'));var as=require(_0x0761('0x11'));var hardwareService=require(_0x0761('0x12'));var logger=require('../../config/logger')(_0x0761('0x13'));var utils=require(_0x0761('0x14'));var config=require(_0x0761('0x15'));var licenseUtil=require(_0x0761('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x147810,_0x3040d9){_0x3040d9=_0x3040d9||0xcc;return function(_0x4a4bf2){if(_0x4a4bf2){return _0x147810[_0x0761('0x17')](_0x3040d9);}return _0x147810[_0x0761('0x18')](_0x3040d9)[_0x0761('0x19')]();};}function respondWithResult(_0x55fa85,_0x444a24){_0x444a24=_0x444a24||0xc8;return function(_0x31db61){if(_0x31db61){return _0x55fa85[_0x0761('0x18')](_0x444a24)[_0x0761('0x1a')](_0x31db61);}};}function respondWithFilteredResult(_0x4c19eb,_0x2d7475){return function(_0x53a509){if(_0x53a509){var _0x4789a3=typeof _0x2d7475['offset']===_0x0761('0x1b')&&typeof _0x2d7475[_0x0761('0x1c')]===_0x0761('0x1b');var _0x1aa3e4=_0x53a509[_0x0761('0x1d')];var _0x473cd4=_0x4789a3?0x0:_0x2d7475[_0x0761('0x1e')];var _0x225758=_0x4789a3?_0x53a509[_0x0761('0x1d')]:_0x2d7475[_0x0761('0x1e')]+_0x2d7475[_0x0761('0x1c')];var _0x264240;if(_0x225758>=_0x1aa3e4){_0x225758=_0x1aa3e4;_0x264240=0xc8;}else{_0x264240=0xce;}_0x4c19eb[_0x0761('0x18')](_0x264240);return _0x4c19eb[_0x0761('0x1f')](_0x0761('0x20'),_0x473cd4+'-'+_0x225758+'/'+_0x1aa3e4)['json'](_0x53a509);}return null;};}function patchUpdates(_0x29019c){return function(_0x2bdf79){try{jsonpatch[_0x0761('0x21')](_0x2bdf79,_0x29019c,!![]);}catch(_0xfe45c){return BPromise[_0x0761('0x22')](_0xfe45c);}return _0x2bdf79[_0x0761('0x23')]();};}function saveUpdates(_0x9efb50,_0x2f1554){return function(_0x1dd0bc){if(_0x1dd0bc){return _0x1dd0bc['update'](_0x9efb50)[_0x0761('0x24')](function(_0x486d51){return _0x486d51;});}return null;};}function removeEntity(_0x36ba27,_0x2044ef){return function(_0x1e3e5c){if(_0x1e3e5c){return _0x1e3e5c[_0x0761('0x25')]()[_0x0761('0x24')](function(){_0x36ba27[_0x0761('0x18')](0xcc)[_0x0761('0x19')]();});}};}function handleEntityNotFound(_0x112720,_0x1d42aa){return function(_0x4e43c8){if(!_0x4e43c8){_0x112720[_0x0761('0x17')](0x194);}return _0x4e43c8;};}function handleError(_0x2e4aa8,_0x37fbe7){_0x37fbe7=_0x37fbe7||0x1f4;return function(_0x3d409a){logger[_0x0761('0x26')](_0x3d409a['stack']);if(_0x3d409a['name']){delete _0x3d409a[_0x0761('0x27')];}_0x2e4aa8[_0x0761('0x18')](_0x37fbe7)[_0x0761('0x28')](_0x3d409a);};}exports[_0x0761('0x29')]=function(_0x11f00e,_0x565dd8){var _0x356b06={},_0x3b4425={},_0xab02e7={'count':0x0,'rows':[]};var _0x4efd4f=_[_0x0761('0x2a')](db['AnalyticTreeReport']['rawAttributes'],function(_0x5ad365){return{'name':_0x5ad365['fieldName'],'type':_0x5ad365[_0x0761('0x2b')][_0x0761('0x2c')]};});_0x3b4425[_0x0761('0x2d')]=_[_0x0761('0x2a')](_0x4efd4f,'name');_0x3b4425[_0x0761('0x2e')]=_['keys'](_0x11f00e[_0x0761('0x2e')]);_0x3b4425[_0x0761('0x2f')]=_[_0x0761('0x30')](_0x3b4425[_0x0761('0x2d')],_0x3b4425[_0x0761('0x2e')]);_0x356b06[_0x0761('0x31')]=_['intersection'](_0x3b4425[_0x0761('0x2d')],qs['fields'](_0x11f00e[_0x0761('0x2e')][_0x0761('0x32')]));_0x356b06['attributes']=_0x356b06[_0x0761('0x31')][_0x0761('0x33')]?_0x356b06['attributes']:_0x3b4425[_0x0761('0x2d')];if(!_0x11f00e['query'][_0x0761('0x34')]('nolimit')){_0x356b06['limit']=qs[_0x0761('0x1c')](_0x11f00e[_0x0761('0x2e')][_0x0761('0x1c')]);_0x356b06[_0x0761('0x1e')]=qs[_0x0761('0x1e')](_0x11f00e['query']['offset']);}_0x356b06['order']=qs[_0x0761('0x35')](_0x11f00e[_0x0761('0x2e')][_0x0761('0x35')]);_0x356b06[_0x0761('0x36')]=qs[_0x0761('0x2f')](_[_0x0761('0x37')](_0x11f00e[_0x0761('0x2e')],_0x3b4425['filters']),_0x4efd4f);if(_0x11f00e['query'][_0x0761('0x38')]){_0x356b06[_0x0761('0x36')]=_[_0x0761('0x39')](_0x356b06[_0x0761('0x36')],{'$or':_[_0x0761('0x2a')](_0x4efd4f,function(_0x36e6b8){if(_0x36e6b8[_0x0761('0x2b')]!==_0x0761('0x3a')){var _0x34b58c={};_0x34b58c[_0x36e6b8[_0x0761('0x27')]]={'$like':'%'+_0x11f00e[_0x0761('0x2e')]['filter']+'%'};return _0x34b58c;}})});}_0x356b06=_[_0x0761('0x39')]({},_0x356b06,_0x11f00e[_0x0761('0x3b')]);var _0x2dad5b={'where':_0x356b06[_0x0761('0x36')]};return db[_0x0761('0x3c')]['count'](_0x2dad5b)[_0x0761('0x24')](function(_0x5d5c8f){_0xab02e7[_0x0761('0x1d')]=_0x5d5c8f;if(_0x11f00e[_0x0761('0x2e')][_0x0761('0x3d')]){_0x356b06[_0x0761('0x3e')]=[{'all':!![]}];}return db[_0x0761('0x3c')]['findAll'](_0x356b06);})[_0x0761('0x24')](function(_0x3fcc38){_0xab02e7[_0x0761('0x3f')]=_0x3fcc38;return _0xab02e7;})['then'](respondWithFilteredResult(_0x565dd8,_0x356b06))['catch'](handleError(_0x565dd8,null));};exports[_0x0761('0x40')]=function(_0x416694,_0x30a224){var _0x198eb2={'raw':!![],'where':{'id':_0x416694[_0x0761('0x41')]['id']}},_0x2db6d8={};_0x2db6d8[_0x0761('0x2d')]=_[_0x0761('0x42')](db['AnalyticTreeReport']['rawAttributes']);_0x2db6d8[_0x0761('0x2e')]=_[_0x0761('0x42')](_0x416694[_0x0761('0x2e')]);_0x2db6d8[_0x0761('0x2f')]=_['intersection'](_0x2db6d8[_0x0761('0x2d')],_0x2db6d8['query']);_0x198eb2[_0x0761('0x31')]=_[_0x0761('0x30')](_0x2db6d8[_0x0761('0x2d')],qs[_0x0761('0x32')](_0x416694[_0x0761('0x2e')]['fields']));_0x198eb2['attributes']=_0x198eb2[_0x0761('0x31')][_0x0761('0x33')]?_0x198eb2[_0x0761('0x31')]:_0x2db6d8['model'];if(_0x416694[_0x0761('0x2e')]['includeAll']){_0x198eb2[_0x0761('0x3e')]=[{'all':!![]}];}_0x198eb2=_[_0x0761('0x39')]({},_0x198eb2,_0x416694['options']);return db[_0x0761('0x3c')][_0x0761('0x43')](_0x198eb2)[_0x0761('0x24')](handleEntityNotFound(_0x30a224,null))[_0x0761('0x24')](respondWithResult(_0x30a224,null))['catch'](handleError(_0x30a224,null));};exports[_0x0761('0x44')]=function(_0x57c476,_0x18b706){return db[_0x0761('0x3c')][_0x0761('0x44')](_0x57c476[_0x0761('0x45')],{})[_0x0761('0x24')](respondWithResult(_0x18b706,0xc9))[_0x0761('0x46')](handleError(_0x18b706,null));};exports[_0x0761('0x47')]=function(_0x7a95d5,_0x42b991){if(_0x7a95d5[_0x0761('0x45')]['id']){delete _0x7a95d5[_0x0761('0x45')]['id'];}return db['AnalyticTreeReport'][_0x0761('0x43')]({'where':{'id':_0x7a95d5[_0x0761('0x41')]['id']}})[_0x0761('0x24')](handleEntityNotFound(_0x42b991,null))[_0x0761('0x24')](saveUpdates(_0x7a95d5['body'],null))[_0x0761('0x24')](respondWithResult(_0x42b991,null))['catch'](handleError(_0x42b991,null));};exports['destroy']=function(_0x23d816,_0x2f7b4a){return db[_0x0761('0x3c')]['find']({'where':{'id':_0x23d816[_0x0761('0x41')]['id']}})[_0x0761('0x24')](handleEntityNotFound(_0x2f7b4a,null))[_0x0761('0x24')](removeEntity(_0x2f7b4a,null))[_0x0761('0x46')](handleError(_0x2f7b4a,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index c98c1cb..aa3cb4b 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 _0x7d2d=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticTreeReport.attributes','define','analytics_report_trees'];(function(_0x403c20,_0x4a7b99){var _0x2b271a=function(_0x106ecb){while(--_0x106ecb){_0x403c20['push'](_0x403c20['shift']());}};_0x2b271a(++_0x4a7b99);}(_0x7d2d,0x1d4));var _0xd7d2=function(_0x438ccf,_0x4ef98b){_0x438ccf=_0x438ccf-0x0;var _0xac48c=_0x7d2d[_0x438ccf];return _0xac48c;};'use strict';var _=require(_0xd7d2('0x0'));var util=require(_0xd7d2('0x1'));var logger=require(_0xd7d2('0x2'))(_0xd7d2('0x3'));var moment=require(_0xd7d2('0x4'));var BPromise=require(_0xd7d2('0x5'));var rp=require(_0xd7d2('0x6'));var fs=require('fs');var path=require(_0xd7d2('0x7'));var rimraf=require(_0xd7d2('0x8'));var config=require(_0xd7d2('0x9'));var attributes=require(_0xd7d2('0xa'));module['exports']=function(_0x3edb63,_0x326d8e){return _0x3edb63[_0xd7d2('0xb')]('AnalyticTreeReport',attributes,{'tableName':_0xd7d2('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2bc4=['exports','define','AnalyticTreeReport','analytics_report_trees','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x5d07d0,_0x213a3b){var _0x3e5b5a=function(_0x15aba6){while(--_0x15aba6){_0x5d07d0['push'](_0x5d07d0['shift']());}};_0x3e5b5a(++_0x213a3b);}(_0x2bc4,0x190));var _0x42bc=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x2bc4[_0x40a045];return _0x1a687c;};'use strict';var _=require(_0x42bc('0x0'));var util=require(_0x42bc('0x1'));var logger=require(_0x42bc('0x2'))('api');var moment=require(_0x42bc('0x3'));var BPromise=require(_0x42bc('0x4'));var rp=require(_0x42bc('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x42bc('0x6'));var config=require(_0x42bc('0x7'));var attributes=require('./analyticTreeReport.attributes');module[_0x42bc('0x8')]=function(_0x105a9b,_0x297001){return _0x105a9b[_0x42bc('0x9')](_0x42bc('0xa'),attributes,{'tableName':_0x42bc('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.rpc.js b/server/api/analyticTreeReport/analyticTreeReport.rpc.js index 51c9a7b..4cde50b 100644 --- a/server/api/analyticTreeReport/analyticTreeReport.rpc.js +++ b/server/api/analyticTreeReport/analyticTreeReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['info','AnalyticTreeReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x7a54,0x106));var _0x47a5=function(_0x1b4734,_0x5ab912){_0x1b4734=_0x1b4734-0x0;var _0x399796=_0x7a54[_0x1b4734];return _0x399796;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file +var _0x5f2f=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','AnalyticTreeReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch'];(function(_0x221f53,_0x24af8b){var _0x1079a8=function(_0x54b976){while(--_0x54b976){_0x221f53['push'](_0x221f53['shift']());}};_0x1079a8(++_0x24af8b);}(_0x5f2f,0x73));var _0xf5f2=function(_0x1d89af,_0x4c78e3){_0x1d89af=_0x1d89af-0x0;var _0x2ba25d=_0x5f2f[_0x1d89af];return _0x2ba25d;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3133bc,_0x473100,_0x5907aa){return new BPromise(function(_0x466882,_0x46cd9c){return client[_0xf5f2('0xc')](_0x3133bc,_0x5907aa)['then'](function(_0x375da4){logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,'request\x20sent');logger[_0xf5f2('0xf')]('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x473100,'request\x20sent',JSON[_0xf5f2('0x10')](_0x375da4));if(_0x375da4[_0xf5f2('0x11')]){if(_0x375da4['error'][_0xf5f2('0x12')]===0x1f4){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x46cd9c(_0x375da4[_0xf5f2('0x11')]['message']);}logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x466882(_0x375da4[_0xf5f2('0x11')]['message']);}else{logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,_0xf5f2('0x14'));_0x466882(_0x375da4[_0xf5f2('0x15')][_0xf5f2('0x13')]);}})[_0xf5f2('0x16')](function(_0xdb61b3){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0xdb61b3);_0x46cd9c(_0xdb61b3);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index 6fa1c9f..d872fcb 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 _0x0aa0=['exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./analyticTreeReport.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x0aa0,0x1a5));var _0x00aa=function(_0x845896,_0x399300){_0x845896=_0x845896-0x0;var _0x1125dc=_0x0aa0[_0x845896];return _0x1125dc;};'use strict';var multer=require(_0x00aa('0x0'));var util=require('util');var path=require(_0x00aa('0x1'));var timeout=require(_0x00aa('0x2'));var express=require(_0x00aa('0x3'));var router=express[_0x00aa('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x00aa('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x00aa('0x6'));var controller=require(_0x00aa('0x7'));router[_0x00aa('0x8')]('/',auth[_0x00aa('0x9')](),controller[_0x00aa('0xa')]);router['get'](_0x00aa('0xb'),auth[_0x00aa('0x9')](),controller[_0x00aa('0xc')]);router[_0x00aa('0xd')]('/',auth['isAuthenticated'](),controller[_0x00aa('0xe')]);router[_0x00aa('0xf')](_0x00aa('0xb'),auth[_0x00aa('0x9')](),controller[_0x00aa('0x10')]);router[_0x00aa('0x11')](_0x00aa('0xb'),auth[_0x00aa('0x9')](),controller[_0x00aa('0x12')]);module[_0x00aa('0x13')]=router; \ No newline at end of file +var _0x804e=['get','isAuthenticated','index','show','post','create','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x804e,0xb3));var _0xe804=function(_0x4a2117,_0x5e6c25){_0x4a2117=_0x4a2117-0x0;var _0x50f270=_0x804e[_0x4a2117];return _0x50f270;};'use strict';var multer=require(_0xe804('0x0'));var util=require(_0xe804('0x1'));var path=require(_0xe804('0x2'));var timeout=require(_0xe804('0x3'));var express=require('express');var router=express[_0xe804('0x4')]();var fs_extra=require(_0xe804('0x5'));var auth=require(_0xe804('0x6'));var interaction=require(_0xe804('0x7'));var config=require(_0xe804('0x8'));var controller=require(_0xe804('0x9'));router[_0xe804('0xa')]('/',auth[_0xe804('0xb')](),controller[_0xe804('0xc')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xe804('0xd')]);router[_0xe804('0xe')]('/',auth[_0xe804('0xb')](),controller[_0xe804('0xf')]);router[_0xe804('0x10')](_0xe804('0x11'),auth[_0xe804('0xb')](),controller[_0xe804('0x12')]);router['delete'](_0xe804('0x11'),auth[_0xe804('0xb')](),controller[_0xe804('0x13')]);module[_0xe804('0x14')]=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index 1383e27..a25f15f 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 _0x6183=['STRING','exports'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x6183,0x19b));var _0x3618=function(_0x40df5f,_0x8fd59f){_0x40df5f=_0x40df5f-0x0;var _0x1573f1=_0x6183[_0x40df5f];return _0x1573f1;};'use strict';var Sequelize=require('sequelize');module[_0x3618('0x0')]={'name':{'type':Sequelize[_0x3618('0x1')]},'basename':{'type':Sequelize[_0x3618('0x1')]},'type':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xbbfa=['STRING','sequelize'];(function(_0x2eba5c,_0x437f1f){var _0x28fccf=function(_0x2ed371){while(--_0x2ed371){_0x2eba5c['push'](_0x2eba5c['shift']());}};_0x28fccf(++_0x437f1f);}(_0xbbfa,0x1e9));var _0xabbf=function(_0x4c9191,_0xe10c76){_0x4c9191=_0x4c9191-0x0;var _0x593642=_0xbbfa[_0x4c9191];return _0x593642;};'use strict';var Sequelize=require(_0xabbf('0x0'));module['exports']={'name':{'type':Sequelize[_0xabbf('0x1')]},'basename':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xabbf('0x1')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index d334925..48364b4 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 _0xf0f9=['then','destroy','error','name','send','index','map','type','key','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','options','Attachment','findAll','catch','params','find','rawAttributes','include','get','omit','createdAt','updatedAt','body','create','includeAll','update','file','originalname','filename','mimetype','download','findOne','ChatOfflineMessageId','join','root','offline-chat/','basename','zip-dir','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','save'];(function(_0xf71120,_0x25b7f9){var _0xbe2fd3=function(_0x1acbdd){while(--_0x1acbdd){_0xf71120['push'](_0xf71120['shift']());}};_0xbe2fd3(++_0x25b7f9);}(_0xf0f9,0x86));var _0x9f0f=function(_0x177b33,_0xe3b323){_0x177b33=_0x177b33-0x0;var _0x28a250=_0xf0f9[_0x177b33];return _0x28a250;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x9f0f('0x0'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x9f0f('0x1'));var BPromise=require(_0x9f0f('0x2'));var Mustache=require(_0x9f0f('0x3'));var util=require(_0x9f0f('0x4'));var path=require(_0x9f0f('0x5'));var sox=require('sox');var csv=require(_0x9f0f('0x6'));var ejs=require(_0x9f0f('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9f0f('0x8'));var squel=require(_0x9f0f('0x9'));var crypto=require(_0x9f0f('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x9f0f('0xb'));var toCsv=require('to-csv');var querystring=require(_0x9f0f('0xc'));var Papa=require('papaparse');var Redis=require(_0x9f0f('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x9f0f('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9f0f('0xf'));var logger=require(_0x9f0f('0x10'))(_0x9f0f('0x11'));var utils=require(_0x9f0f('0x12'));var config=require(_0x9f0f('0x13'));var licenseUtil=require(_0x9f0f('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x39c1fd,_0x228a6d){_0x228a6d=_0x228a6d||0xcc;return function(_0x10c5f7){if(_0x10c5f7){return _0x39c1fd[_0x9f0f('0x15')](_0x228a6d);}return _0x39c1fd[_0x9f0f('0x16')](_0x228a6d)[_0x9f0f('0x17')]();};}function respondWithResult(_0x501495,_0x39a1a9){_0x39a1a9=_0x39a1a9||0xc8;return function(_0x2178da){if(_0x2178da){return _0x501495['status'](_0x39a1a9)[_0x9f0f('0x18')](_0x2178da);}};}function respondWithFilteredResult(_0x2bff76,_0x495b64){return function(_0x391279){if(_0x391279){var _0x56b5ad=typeof _0x495b64[_0x9f0f('0x19')]===_0x9f0f('0x1a')&&typeof _0x495b64[_0x9f0f('0x1b')]===_0x9f0f('0x1a');var _0x592d0d=_0x391279[_0x9f0f('0x1c')];var _0x328c77=_0x56b5ad?0x0:_0x495b64['offset'];var _0x131767=_0x56b5ad?_0x391279[_0x9f0f('0x1c')]:_0x495b64[_0x9f0f('0x19')]+_0x495b64['limit'];var _0x1d43c6;if(_0x131767>=_0x592d0d){_0x131767=_0x592d0d;_0x1d43c6=0xc8;}else{_0x1d43c6=0xce;}_0x2bff76[_0x9f0f('0x16')](_0x1d43c6);return _0x2bff76[_0x9f0f('0x1d')](_0x9f0f('0x1e'),_0x328c77+'-'+_0x131767+'/'+_0x592d0d)[_0x9f0f('0x18')](_0x391279);}return null;};}function patchUpdates(_0x26d21d){return function(_0x3af3dd){try{jsonpatch['apply'](_0x3af3dd,_0x26d21d,!![]);}catch(_0x40b4ed){return BPromise['reject'](_0x40b4ed);}return _0x3af3dd[_0x9f0f('0x1f')]();};}function saveUpdates(_0x4b5826,_0x43fbdb){return function(_0xc94376){if(_0xc94376){return _0xc94376['update'](_0x4b5826)[_0x9f0f('0x20')](function(_0x37ede1){return _0x37ede1;});}return null;};}function removeEntity(_0xdfc7b,_0x5bebca){return function(_0x461358){if(_0x461358){return _0x461358[_0x9f0f('0x21')]()['then'](function(){_0xdfc7b[_0x9f0f('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1b6afd,_0x5143e2){return function(_0x36ec07){if(!_0x36ec07){_0x1b6afd['sendStatus'](0x194);}return _0x36ec07;};}function handleError(_0x5871ba,_0x5b47d8){_0x5b47d8=_0x5b47d8||0x1f4;return function(_0x339238){logger[_0x9f0f('0x22')](_0x339238['stack']);if(_0x339238[_0x9f0f('0x23')]){delete _0x339238[_0x9f0f('0x23')];}_0x5871ba[_0x9f0f('0x16')](_0x5b47d8)[_0x9f0f('0x24')](_0x339238);};}exports[_0x9f0f('0x25')]=function(_0x428d30,_0x37aa3e){var _0x317aa7={},_0x3dbe0f={},_0x4435e3={'count':0x0,'rows':[]};var _0x137070=_[_0x9f0f('0x26')](db['Attachment']['rawAttributes'],function(_0x256fdb){return{'name':_0x256fdb['fieldName'],'type':_0x256fdb[_0x9f0f('0x27')][_0x9f0f('0x28')]};});_0x3dbe0f['model']=_['map'](_0x137070,_0x9f0f('0x23'));_0x3dbe0f[_0x9f0f('0x29')]=_[_0x9f0f('0x2a')](_0x428d30['query']);_0x3dbe0f['filters']=_[_0x9f0f('0x2b')](_0x3dbe0f[_0x9f0f('0x2c')],_0x3dbe0f[_0x9f0f('0x29')]);_0x317aa7['attributes']=_['intersection'](_0x3dbe0f['model'],qs[_0x9f0f('0x2d')](_0x428d30[_0x9f0f('0x29')]['fields']));_0x317aa7[_0x9f0f('0x2e')]=_0x317aa7[_0x9f0f('0x2e')][_0x9f0f('0x2f')]?_0x317aa7[_0x9f0f('0x2e')]:_0x3dbe0f[_0x9f0f('0x2c')];if(!_0x428d30['query'][_0x9f0f('0x30')](_0x9f0f('0x31'))){_0x317aa7['limit']=qs[_0x9f0f('0x1b')](_0x428d30['query']['limit']);_0x317aa7[_0x9f0f('0x19')]=qs[_0x9f0f('0x19')](_0x428d30[_0x9f0f('0x29')][_0x9f0f('0x19')]);}_0x317aa7[_0x9f0f('0x32')]=qs[_0x9f0f('0x33')](_0x428d30[_0x9f0f('0x29')][_0x9f0f('0x33')]);_0x317aa7[_0x9f0f('0x34')]=qs[_0x9f0f('0x35')](_['pick'](_0x428d30[_0x9f0f('0x29')],_0x3dbe0f[_0x9f0f('0x35')]),_0x137070);if(_0x428d30['query'][_0x9f0f('0x36')]){_0x317aa7[_0x9f0f('0x34')]=_[_0x9f0f('0x37')](_0x317aa7['where'],{'$or':_[_0x9f0f('0x26')](_0x137070,function(_0x1d8ec5){if(_0x1d8ec5['type']!=='VIRTUAL'){var _0x18837b={};_0x18837b[_0x1d8ec5[_0x9f0f('0x23')]]={'$like':'%'+_0x428d30[_0x9f0f('0x29')][_0x9f0f('0x36')]+'%'};return _0x18837b;}})});}_0x317aa7=_[_0x9f0f('0x37')]({},_0x317aa7,_0x428d30[_0x9f0f('0x38')]);var _0xae8831={'where':_0x317aa7[_0x9f0f('0x34')]};return db[_0x9f0f('0x39')][_0x9f0f('0x1c')](_0xae8831)['then'](function(_0x321238){_0x4435e3[_0x9f0f('0x1c')]=_0x321238;if(_0x428d30[_0x9f0f('0x29')]['includeAll']){_0x317aa7['include']=[{'all':!![]}];}return db[_0x9f0f('0x39')][_0x9f0f('0x3a')](_0x317aa7);})[_0x9f0f('0x20')](function(_0x6828){_0x4435e3['rows']=_0x6828;return _0x4435e3;})[_0x9f0f('0x20')](respondWithFilteredResult(_0x37aa3e,_0x317aa7))[_0x9f0f('0x3b')](handleError(_0x37aa3e,null));};exports['show']=function(_0x8e5e78,_0x33b7e1){var _0x254784={'raw':!![],'where':{'id':_0x8e5e78[_0x9f0f('0x3c')]['id']}},_0x241065={};_0x241065['model']=_[_0x9f0f('0x2a')](db[_0x9f0f('0x39')]['rawAttributes']);_0x241065['query']=_[_0x9f0f('0x2a')](_0x8e5e78[_0x9f0f('0x29')]);_0x241065['filters']=_[_0x9f0f('0x2b')](_0x241065[_0x9f0f('0x2c')],_0x241065[_0x9f0f('0x29')]);_0x254784[_0x9f0f('0x2e')]=_[_0x9f0f('0x2b')](_0x241065['model'],qs['fields'](_0x8e5e78[_0x9f0f('0x29')]['fields']));_0x254784['attributes']=_0x254784['attributes']['length']?_0x254784[_0x9f0f('0x2e')]:_0x241065[_0x9f0f('0x2c')];if(_0x8e5e78['query']['includeAll']){_0x254784['include']=[{'all':!![]}];}_0x254784=_[_0x9f0f('0x37')]({},_0x254784,_0x8e5e78[_0x9f0f('0x38')]);return db[_0x9f0f('0x39')][_0x9f0f('0x3d')](_0x254784)[_0x9f0f('0x20')](handleEntityNotFound(_0x33b7e1,null))['then'](respondWithResult(_0x33b7e1,null))[_0x9f0f('0x3b')](handleError(_0x33b7e1,null));};exports['clone']=function(_0x1f1936,_0x466248){var _0x143cb2={'where':{'id':_0x1f1936[_0x9f0f('0x3c')]['id']}},_0x4dd100={};_0x4dd100['model']=_['keys'](db[_0x9f0f('0x39')][_0x9f0f('0x3e')]);_0x143cb2[_0x9f0f('0x2e')]=_[_0x9f0f('0x2b')](_0x4dd100[_0x9f0f('0x2c')],qs[_0x9f0f('0x2d')](_0x1f1936[_0x9f0f('0x29')][_0x9f0f('0x2d')]));_0x143cb2[_0x9f0f('0x2e')]=_0x143cb2[_0x9f0f('0x2e')]['length']?_0x143cb2['attributes']:_0x4dd100[_0x9f0f('0x2c')];if(_0x1f1936['query']['includeAll']){_0x143cb2[_0x9f0f('0x3f')]=[{'all':!![]}];}_0x143cb2=_[_0x9f0f('0x37')]({},_0x143cb2,_0x1f1936[_0x9f0f('0x38')]);return db[_0x9f0f('0x39')][_0x9f0f('0x3d')](_0x143cb2)[_0x9f0f('0x20')](handleEntityNotFound(_0x466248,null))['then'](function(_0x2aedd){if(_0x2aedd){var _0x20a5fc=_0x2aedd[_0x9f0f('0x40')]({'plain':!![]});_0x20a5fc=qs[_0x9f0f('0x41')](_0x20a5fc,['id',_0x9f0f('0x42'),_0x9f0f('0x43')]);_0x1f1936[_0x9f0f('0x44')]=_[_0x9f0f('0x41')](_0x1f1936[_0x9f0f('0x44')],['id',_0x9f0f('0x42'),'updatedAt']);return db['Attachment'][_0x9f0f('0x45')](_['merge'](_0x20a5fc,_0x1f1936[_0x9f0f('0x44')]),{'include':_0x1f1936[_0x9f0f('0x29')][_0x9f0f('0x46')]?[{'all':!![]}]:undefined});}})[_0x9f0f('0x20')](respondWithResult(_0x466248,0xc9))[_0x9f0f('0x3b')](handleError(_0x466248,null));};exports[_0x9f0f('0x47')]=function(_0x148c97,_0x1d34d3){if(_0x148c97[_0x9f0f('0x44')]['id']){delete _0x148c97[_0x9f0f('0x44')]['id'];}return db['Attachment'][_0x9f0f('0x3d')]({'where':{'id':_0x148c97[_0x9f0f('0x3c')]['id']}})[_0x9f0f('0x20')](handleEntityNotFound(_0x1d34d3,null))['then'](saveUpdates(_0x148c97[_0x9f0f('0x44')],null))['then'](respondWithResult(_0x1d34d3,null))['catch'](handleError(_0x1d34d3,null));};exports[_0x9f0f('0x21')]=function(_0x2d485c,_0x17074b){return db['Attachment'][_0x9f0f('0x3d')]({'where':{'id':_0x2d485c['params']['id']}})[_0x9f0f('0x20')](handleEntityNotFound(_0x17074b,null))['then'](removeEntity(_0x17074b,null))['catch'](handleError(_0x17074b,null));};exports['create']=function(_0x172888,_0x19652d,_0x499281){_0x172888[_0x9f0f('0x44')][_0x9f0f('0x23')]=_0x172888[_0x9f0f('0x48')][_0x9f0f('0x49')];_0x172888[_0x9f0f('0x44')]['basename']=_0x172888[_0x9f0f('0x48')][_0x9f0f('0x4a')];_0x172888[_0x9f0f('0x44')]['type']=_0x172888[_0x9f0f('0x48')][_0x9f0f('0x4b')];return db['Attachment']['create'](_0x172888[_0x9f0f('0x44')])[_0x9f0f('0x20')](respondWithResult(_0x19652d,0xc9))[_0x9f0f('0x3b')](handleError(_0x19652d,null));};exports[_0x9f0f('0x4c')]=function(_0xc6ca,_0x6c38f6,_0x57dfbb){return db[_0x9f0f('0x39')][_0x9f0f('0x4d')]({'where':{'id':_0xc6ca[_0x9f0f('0x3c')]['id']},'raw':!![]})[_0x9f0f('0x20')](handleEntityNotFound(_0x6c38f6,null))[_0x9f0f('0x20')](function(_0x2a4463){if(_0x2a4463){var _0x1cc878=_0x2a4463[_0x9f0f('0x4e')]!==null;var _0x341f64=path[_0x9f0f('0x4f')](config[_0x9f0f('0x50')],'server/files/attachments/');if(_0x1cc878){_0x341f64=path[_0x9f0f('0x4f')](_0x341f64,_0x9f0f('0x51'));}var _0x40aa32=path[_0x9f0f('0x4f')](_0x341f64,_0x2a4463[_0x9f0f('0x52')]);return _0x6c38f6[_0x9f0f('0x4c')](_0x40aa32);}})[_0x9f0f('0x3b')](handleError(_0x6c38f6,null));}; \ No newline at end of file +var _0x522f=['catch','show','params','find','clone','get','omit','updatedAt','body','createdAt','update','file','originalname','basename','filename','mimetype','create','download','findOne','offline-chat/','join','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','save','destroy','then','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','options','Attachment','includeAll','include'];(function(_0x564523,_0x5db1c8){var _0x404d2a=function(_0x346236){while(--_0x346236){_0x564523['push'](_0x564523['shift']());}};_0x404d2a(++_0x5db1c8);}(_0x522f,0x171));var _0xf522=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x522f[_0x122ef9];return _0x42fba0;};'use strict';var emlformat=require(_0xf522('0x0'));var rimraf=require(_0xf522('0x1'));var zipdir=require(_0xf522('0x2'));var jsonpatch=require(_0xf522('0x3'));var rp=require(_0xf522('0x4'));var moment=require(_0xf522('0x5'));var BPromise=require(_0xf522('0x6'));var Mustache=require(_0xf522('0x7'));var util=require(_0xf522('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0xf522('0x9'));var ejs=require(_0xf522('0xa'));var fs=require('fs');var fs_extra=require(_0xf522('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xf522('0xc'));var jsforce=require(_0xf522('0xd'));var deskjs=require(_0xf522('0xe'));var toCsv=require(_0xf522('0x9'));var querystring=require(_0xf522('0xf'));var Papa=require(_0xf522('0x10'));var Redis=require('ioredis');var authService=require(_0xf522('0x11'));var qs=require(_0xf522('0x12'));var as=require(_0xf522('0x13'));var hardwareService=require(_0xf522('0x14'));var logger=require('../../config/logger')(_0xf522('0x15'));var utils=require(_0xf522('0x16'));var config=require(_0xf522('0x17'));var licenseUtil=require(_0xf522('0x18'));var db=require(_0xf522('0x19'))['db'];function respondWithStatusCode(_0x172622,_0x3d7f8d){_0x3d7f8d=_0x3d7f8d||0xcc;return function(_0x58b1eb){if(_0x58b1eb){return _0x172622[_0xf522('0x1a')](_0x3d7f8d);}return _0x172622['status'](_0x3d7f8d)[_0xf522('0x1b')]();};}function respondWithResult(_0xef10fb,_0x48e847){_0x48e847=_0x48e847||0xc8;return function(_0x17d900){if(_0x17d900){return _0xef10fb[_0xf522('0x1c')](_0x48e847)[_0xf522('0x1d')](_0x17d900);}};}function respondWithFilteredResult(_0x4a342a,_0x4df475){return function(_0x96f520){if(_0x96f520){var _0x4d160f=typeof _0x4df475[_0xf522('0x1e')]===_0xf522('0x1f')&&typeof _0x4df475[_0xf522('0x20')]===_0xf522('0x1f');var _0x3e65d1=_0x96f520[_0xf522('0x21')];var _0x31ee22=_0x4d160f?0x0:_0x4df475[_0xf522('0x1e')];var _0x3c58a8=_0x4d160f?_0x96f520[_0xf522('0x21')]:_0x4df475['offset']+_0x4df475[_0xf522('0x20')];var _0x33f942;if(_0x3c58a8>=_0x3e65d1){_0x3c58a8=_0x3e65d1;_0x33f942=0xc8;}else{_0x33f942=0xce;}_0x4a342a[_0xf522('0x1c')](_0x33f942);return _0x4a342a['set'](_0xf522('0x22'),_0x31ee22+'-'+_0x3c58a8+'/'+_0x3e65d1)[_0xf522('0x1d')](_0x96f520);}return null;};}function patchUpdates(_0x543072){return function(_0x427335){try{jsonpatch['apply'](_0x427335,_0x543072,!![]);}catch(_0x597608){return BPromise['reject'](_0x597608);}return _0x427335[_0xf522('0x23')]();};}function saveUpdates(_0x55d0d1,_0x38788b){return function(_0x98560d){if(_0x98560d){return _0x98560d['update'](_0x55d0d1)['then'](function(_0x483e1f){return _0x483e1f;});}return null;};}function removeEntity(_0x596fee,_0x1f4367){return function(_0x450b59){if(_0x450b59){return _0x450b59[_0xf522('0x24')]()[_0xf522('0x25')](function(){_0x596fee[_0xf522('0x1c')](0xcc)[_0xf522('0x1b')]();});}};}function handleEntityNotFound(_0x185e8d,_0x548f1f){return function(_0x4df196){if(!_0x4df196){_0x185e8d[_0xf522('0x1a')](0x194);}return _0x4df196;};}function handleError(_0x4cf807,_0x2c0f07){_0x2c0f07=_0x2c0f07||0x1f4;return function(_0x1691d0){logger[_0xf522('0x26')](_0x1691d0[_0xf522('0x27')]);if(_0x1691d0[_0xf522('0x28')]){delete _0x1691d0[_0xf522('0x28')];}_0x4cf807[_0xf522('0x1c')](_0x2c0f07)['send'](_0x1691d0);};}exports[_0xf522('0x29')]=function(_0x3fcc84,_0x34fb92){var _0x2c55b4={},_0xb16510={},_0x333909={'count':0x0,'rows':[]};var _0xf1c8eb=_[_0xf522('0x2a')](db['Attachment'][_0xf522('0x2b')],function(_0x1e0129){return{'name':_0x1e0129[_0xf522('0x2c')],'type':_0x1e0129[_0xf522('0x2d')][_0xf522('0x2e')]};});_0xb16510[_0xf522('0x2f')]=_[_0xf522('0x2a')](_0xf1c8eb,'name');_0xb16510[_0xf522('0x30')]=_[_0xf522('0x31')](_0x3fcc84[_0xf522('0x30')]);_0xb16510['filters']=_[_0xf522('0x32')](_0xb16510['model'],_0xb16510['query']);_0x2c55b4['attributes']=_[_0xf522('0x32')](_0xb16510[_0xf522('0x2f')],qs[_0xf522('0x33')](_0x3fcc84[_0xf522('0x30')][_0xf522('0x33')]));_0x2c55b4[_0xf522('0x34')]=_0x2c55b4[_0xf522('0x34')][_0xf522('0x35')]?_0x2c55b4[_0xf522('0x34')]:_0xb16510[_0xf522('0x2f')];if(!_0x3fcc84[_0xf522('0x30')]['hasOwnProperty'](_0xf522('0x36'))){_0x2c55b4[_0xf522('0x20')]=qs[_0xf522('0x20')](_0x3fcc84['query'][_0xf522('0x20')]);_0x2c55b4[_0xf522('0x1e')]=qs[_0xf522('0x1e')](_0x3fcc84[_0xf522('0x30')][_0xf522('0x1e')]);}_0x2c55b4[_0xf522('0x37')]=qs[_0xf522('0x38')](_0x3fcc84['query'][_0xf522('0x38')]);_0x2c55b4[_0xf522('0x39')]=qs[_0xf522('0x3a')](_[_0xf522('0x3b')](_0x3fcc84[_0xf522('0x30')],_0xb16510[_0xf522('0x3a')]),_0xf1c8eb);if(_0x3fcc84['query']['filter']){_0x2c55b4[_0xf522('0x39')]=_[_0xf522('0x3c')](_0x2c55b4['where'],{'$or':_[_0xf522('0x2a')](_0xf1c8eb,function(_0x374994){if(_0x374994[_0xf522('0x2d')]!==_0xf522('0x3d')){var _0x5f1454={};_0x5f1454[_0x374994[_0xf522('0x28')]]={'$like':'%'+_0x3fcc84[_0xf522('0x30')]['filter']+'%'};return _0x5f1454;}})});}_0x2c55b4=_[_0xf522('0x3c')]({},_0x2c55b4,_0x3fcc84[_0xf522('0x3e')]);var _0x9bd5c9={'where':_0x2c55b4[_0xf522('0x39')]};return db[_0xf522('0x3f')][_0xf522('0x21')](_0x9bd5c9)['then'](function(_0x3798d7){_0x333909[_0xf522('0x21')]=_0x3798d7;if(_0x3fcc84[_0xf522('0x30')][_0xf522('0x40')]){_0x2c55b4[_0xf522('0x41')]=[{'all':!![]}];}return db['Attachment']['findAll'](_0x2c55b4);})[_0xf522('0x25')](function(_0x483447){_0x333909['rows']=_0x483447;return _0x333909;})[_0xf522('0x25')](respondWithFilteredResult(_0x34fb92,_0x2c55b4))[_0xf522('0x42')](handleError(_0x34fb92,null));};exports[_0xf522('0x43')]=function(_0x46896b,_0x195fa5){var _0x2aff49={'raw':!![],'where':{'id':_0x46896b[_0xf522('0x44')]['id']}},_0x51fd71={};_0x51fd71[_0xf522('0x2f')]=_[_0xf522('0x31')](db[_0xf522('0x3f')][_0xf522('0x2b')]);_0x51fd71[_0xf522('0x30')]=_[_0xf522('0x31')](_0x46896b[_0xf522('0x30')]);_0x51fd71[_0xf522('0x3a')]=_['intersection'](_0x51fd71[_0xf522('0x2f')],_0x51fd71['query']);_0x2aff49[_0xf522('0x34')]=_[_0xf522('0x32')](_0x51fd71[_0xf522('0x2f')],qs['fields'](_0x46896b['query']['fields']));_0x2aff49[_0xf522('0x34')]=_0x2aff49[_0xf522('0x34')][_0xf522('0x35')]?_0x2aff49[_0xf522('0x34')]:_0x51fd71['model'];if(_0x46896b[_0xf522('0x30')]['includeAll']){_0x2aff49[_0xf522('0x41')]=[{'all':!![]}];}_0x2aff49=_[_0xf522('0x3c')]({},_0x2aff49,_0x46896b[_0xf522('0x3e')]);return db[_0xf522('0x3f')][_0xf522('0x45')](_0x2aff49)[_0xf522('0x25')](handleEntityNotFound(_0x195fa5,null))[_0xf522('0x25')](respondWithResult(_0x195fa5,null))[_0xf522('0x42')](handleError(_0x195fa5,null));};exports[_0xf522('0x46')]=function(_0x23cb24,_0x314254){var _0x5c10ee={'where':{'id':_0x23cb24[_0xf522('0x44')]['id']}},_0x44eeb3={};_0x44eeb3[_0xf522('0x2f')]=_[_0xf522('0x31')](db['Attachment'][_0xf522('0x2b')]);_0x5c10ee[_0xf522('0x34')]=_[_0xf522('0x32')](_0x44eeb3['model'],qs['fields'](_0x23cb24[_0xf522('0x30')][_0xf522('0x33')]));_0x5c10ee[_0xf522('0x34')]=_0x5c10ee[_0xf522('0x34')][_0xf522('0x35')]?_0x5c10ee[_0xf522('0x34')]:_0x44eeb3[_0xf522('0x2f')];if(_0x23cb24[_0xf522('0x30')][_0xf522('0x40')]){_0x5c10ee[_0xf522('0x41')]=[{'all':!![]}];}_0x5c10ee=_[_0xf522('0x3c')]({},_0x5c10ee,_0x23cb24[_0xf522('0x3e')]);return db['Attachment'][_0xf522('0x45')](_0x5c10ee)[_0xf522('0x25')](handleEntityNotFound(_0x314254,null))['then'](function(_0x5787b8){if(_0x5787b8){var _0x5389d6=_0x5787b8[_0xf522('0x47')]({'plain':!![]});_0x5389d6=qs[_0xf522('0x48')](_0x5389d6,['id','createdAt',_0xf522('0x49')]);_0x23cb24[_0xf522('0x4a')]=_[_0xf522('0x48')](_0x23cb24['body'],['id',_0xf522('0x4b'),_0xf522('0x49')]);return db[_0xf522('0x3f')]['create'](_[_0xf522('0x3c')](_0x5389d6,_0x23cb24['body']),{'include':_0x23cb24[_0xf522('0x30')][_0xf522('0x40')]?[{'all':!![]}]:undefined});}})[_0xf522('0x25')](respondWithResult(_0x314254,0xc9))[_0xf522('0x42')](handleError(_0x314254,null));};exports[_0xf522('0x4c')]=function(_0x5c5d5c,_0x39a0de){if(_0x5c5d5c['body']['id']){delete _0x5c5d5c[_0xf522('0x4a')]['id'];}return db[_0xf522('0x3f')]['find']({'where':{'id':_0x5c5d5c[_0xf522('0x44')]['id']}})[_0xf522('0x25')](handleEntityNotFound(_0x39a0de,null))[_0xf522('0x25')](saveUpdates(_0x5c5d5c['body'],null))[_0xf522('0x25')](respondWithResult(_0x39a0de,null))[_0xf522('0x42')](handleError(_0x39a0de,null));};exports[_0xf522('0x24')]=function(_0x431813,_0x37796c){return db[_0xf522('0x3f')][_0xf522('0x45')]({'where':{'id':_0x431813['params']['id']}})[_0xf522('0x25')](handleEntityNotFound(_0x37796c,null))['then'](removeEntity(_0x37796c,null))['catch'](handleError(_0x37796c,null));};exports['create']=function(_0x258982,_0x536335,_0x462277){_0x258982['body'][_0xf522('0x28')]=_0x258982[_0xf522('0x4d')][_0xf522('0x4e')];_0x258982['body'][_0xf522('0x4f')]=_0x258982[_0xf522('0x4d')][_0xf522('0x50')];_0x258982[_0xf522('0x4a')][_0xf522('0x2d')]=_0x258982['file'][_0xf522('0x51')];return db[_0xf522('0x3f')][_0xf522('0x52')](_0x258982[_0xf522('0x4a')])[_0xf522('0x25')](respondWithResult(_0x536335,0xc9))[_0xf522('0x42')](handleError(_0x536335,null));};exports[_0xf522('0x53')]=function(_0x384b65,_0x375408,_0x2b3f6c){return db[_0xf522('0x3f')][_0xf522('0x54')]({'where':{'id':_0x384b65[_0xf522('0x44')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x375408,null))['then'](function(_0x1bd52f){if(_0x1bd52f){var _0x468c6a=_0x1bd52f['ChatOfflineMessageId']!==null;var _0x1f673b=path['join'](config['root'],'server/files/attachments/');if(_0x468c6a){_0x1f673b=path['join'](_0x1f673b,_0xf522('0x55'));}var _0x22a65b=path[_0xf522('0x56')](_0x1f673b,_0x1bd52f[_0xf522('0x4f')]);return _0x375408[_0xf522('0x53')](_0x22a65b);}})[_0xf522('0x42')](handleError(_0x375408,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index a7aa81f..9412d29 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 _0x4389=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./attachment.attributes','define','Attachment','attachments','lodash','util'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x4389,0x1da));var _0x9438=function(_0x567976,_0x167205){_0x567976=_0x567976-0x0;var _0x1fdd50=_0x4389[_0x567976];return _0x1fdd50;};'use strict';var _=require(_0x9438('0x0'));var util=require(_0x9438('0x1'));var logger=require(_0x9438('0x2'))(_0x9438('0x3'));var moment=require(_0x9438('0x4'));var BPromise=require(_0x9438('0x5'));var rp=require(_0x9438('0x6'));var fs=require('fs');var path=require(_0x9438('0x7'));var rimraf=require(_0x9438('0x8'));var config=require(_0x9438('0x9'));var attributes=require(_0x9438('0xa'));module['exports']=function(_0x557c4f,_0x383695){return _0x557c4f[_0x9438('0xb')](_0x9438('0xc'),attributes,{'tableName':_0x9438('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfe5d=['lodash','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./attachment.attributes','exports','define','Attachment','attachments'];(function(_0x53f9e2,_0x1cea17){var _0x5db0a0=function(_0x258e07){while(--_0x258e07){_0x53f9e2['push'](_0x53f9e2['shift']());}};_0x5db0a0(++_0x1cea17);}(_0xfe5d,0x120));var _0xdfe5=function(_0x3a30c0,_0x38d965){_0x3a30c0=_0x3a30c0-0x0;var _0xcd92c7=_0xfe5d[_0x3a30c0];return _0xcd92c7;};'use strict';var _=require(_0xdfe5('0x0'));var util=require('util');var logger=require(_0xdfe5('0x1'))(_0xdfe5('0x2'));var moment=require(_0xdfe5('0x3'));var BPromise=require(_0xdfe5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xdfe5('0x5'));var config=require(_0xdfe5('0x6'));var attributes=require(_0xdfe5('0x7'));module[_0xdfe5('0x8')]=function(_0x52446d,_0x2aac4e){return _0x52446d[_0xdfe5('0x9')](_0xdfe5('0xa'),attributes,{'tableName':_0xdfe5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/attachment/attachment.rpc.js b/server/api/attachment/attachment.rpc.js index f607772..9860832 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 _0xd691=['Attachment,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateAttachment','Attachment','create','options','raw','info','stringify','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Attachment,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x357c48,_0x2eb444){var _0x45f72f=function(_0x5ba5ad){while(--_0x5ba5ad){_0x357c48['push'](_0x357c48['shift']());}};_0x45f72f(++_0x2eb444);}(_0xd691,0xe6));var _0x1d69=function(_0x7f6e9,_0x2cf772){_0x7f6e9=_0x7f6e9-0x0;var _0x5a3124=_0xd691[_0x7f6e9];return _0x5a3124;};'use strict';var _=require(_0x1d69('0x0'));var util=require(_0x1d69('0x1'));var moment=require(_0x1d69('0x2'));var BPromise=require('bluebird');var rs=require(_0x1d69('0x3'));var fs=require('fs');var Redis=require(_0x1d69('0x4'));var db=require(_0x1d69('0x5'))['db'];var utils=require(_0x1d69('0x6'));var logger=require(_0x1d69('0x7'))(_0x1d69('0x8'));var config=require(_0x1d69('0x9'));var jayson=require(_0x1d69('0xa'));var client=jayson[_0x1d69('0xb')][_0x1d69('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5a5b0c,_0x520acb,_0x267da3){return new BPromise(function(_0x49f008,_0x369d44){return client[_0x1d69('0xd')](_0x5a5b0c,_0x267da3)[_0x1d69('0xe')](function(_0x364061){logger['info'](_0x1d69('0xf'),_0x520acb,_0x1d69('0x10'));logger[_0x1d69('0x11')](_0x1d69('0x12'),_0x520acb,_0x1d69('0x10'),JSON['stringify'](_0x364061));if(_0x364061['error']){if(_0x364061[_0x1d69('0x13')][_0x1d69('0x14')]===0x1f4){logger[_0x1d69('0x13')](_0x1d69('0xf'),_0x520acb,_0x364061[_0x1d69('0x13')][_0x1d69('0x15')]);return _0x369d44(_0x364061[_0x1d69('0x13')][_0x1d69('0x15')]);}logger[_0x1d69('0x13')](_0x1d69('0xf'),_0x520acb,_0x364061[_0x1d69('0x13')][_0x1d69('0x15')]);return _0x49f008(_0x364061[_0x1d69('0x13')]['message']);}else{logger['info'](_0x1d69('0xf'),_0x520acb,_0x1d69('0x10'));_0x49f008(_0x364061[_0x1d69('0x16')][_0x1d69('0x15')]);}})[_0x1d69('0x17')](function(_0x383771){logger['error'](_0x1d69('0xf'),_0x520acb,_0x383771);_0x369d44(_0x383771);});});}exports[_0x1d69('0x18')]=function(_0x34f6d4){var _0x53915f=this;return new Promise(function(_0x4cebea,_0x258249){return db[_0x1d69('0x19')][_0x1d69('0x1a')](_0x34f6d4['body'],{'raw':_0x34f6d4[_0x1d69('0x1b')]?_0x34f6d4[_0x1d69('0x1b')][_0x1d69('0x1c')]===undefined?!![]:![]:!![]})[_0x1d69('0xe')](function(_0x3ef4dc){logger[_0x1d69('0x1d')](_0x1d69('0x18'),_0x34f6d4);logger[_0x1d69('0x11')]('CreateAttachment',_0x34f6d4,JSON[_0x1d69('0x1e')](_0x3ef4dc));_0x4cebea(_0x3ef4dc);})[_0x1d69('0x17')](function(_0x1786e1){logger[_0x1d69('0x13')]('CreateAttachment',_0x1786e1[_0x1d69('0x15')],_0x34f6d4);_0x258249(_0x53915f[_0x1d69('0x13')](0x1f4,_0x1786e1[_0x1d69('0x15')]));});});}; \ No newline at end of file +var _0x5c12=['CreateAttachment','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','Attachment,\x20%s,\x20%s','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','error','message','info','options','raw'];(function(_0xa148b7,_0x2f3eb2){var _0x51efd3=function(_0x34bcec){while(--_0x34bcec){_0xa148b7['push'](_0xa148b7['shift']());}};_0x51efd3(++_0x2f3eb2);}(_0x5c12,0x188));var _0x25c1=function(_0x2718c7,_0x5a1636){_0x2718c7=_0x2718c7-0x0;var _0x59d89c=_0x5c12[_0x2718c7];return _0x59d89c;};'use strict';var _=require('lodash');var util=require(_0x25c1('0x0'));var moment=require(_0x25c1('0x1'));var BPromise=require('bluebird');var rs=require(_0x25c1('0x2'));var fs=require('fs');var Redis=require(_0x25c1('0x3'));var db=require(_0x25c1('0x4'))['db'];var utils=require(_0x25c1('0x5'));var logger=require(_0x25c1('0x6'))(_0x25c1('0x7'));var config=require(_0x25c1('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x25c1('0x9')][_0x25c1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x382922,_0x4ab674,_0x5c69b1){return new BPromise(function(_0x24981c,_0x3b69ba){return client[_0x25c1('0xb')](_0x382922,_0x5c69b1)[_0x25c1('0xc')](function(_0xf8363f){logger['info'](_0x25c1('0xd'),_0x4ab674,_0x25c1('0xe'));logger[_0x25c1('0xf')](_0x25c1('0x10'),_0x4ab674,_0x25c1('0xe'),JSON['stringify'](_0xf8363f));if(_0xf8363f[_0x25c1('0x11')]){if(_0xf8363f[_0x25c1('0x11')]['code']===0x1f4){logger[_0x25c1('0x11')](_0x25c1('0xd'),_0x4ab674,_0xf8363f[_0x25c1('0x11')][_0x25c1('0x12')]);return _0x3b69ba(_0xf8363f['error']['message']);}logger['error']('Attachment,\x20%s,\x20%s',_0x4ab674,_0xf8363f[_0x25c1('0x11')][_0x25c1('0x12')]);return _0x24981c(_0xf8363f[_0x25c1('0x11')][_0x25c1('0x12')]);}else{logger[_0x25c1('0x13')]('Attachment,\x20%s,\x20%s',_0x4ab674,_0x25c1('0xe'));_0x24981c(_0xf8363f['result']['message']);}})['catch'](function(_0x284712){logger[_0x25c1('0x11')]('Attachment,\x20%s,\x20%s',_0x4ab674,_0x284712);_0x3b69ba(_0x284712);});});}exports['CreateAttachment']=function(_0x61a29f){var _0x4c0d49=this;return new Promise(function(_0x7175d4,_0x23a418){return db['Attachment']['create'](_0x61a29f['body'],{'raw':_0x61a29f[_0x25c1('0x14')]?_0x61a29f[_0x25c1('0x14')][_0x25c1('0x15')]===undefined?!![]:![]:!![]})[_0x25c1('0xc')](function(_0x481c12){logger[_0x25c1('0x13')](_0x25c1('0x16'),_0x61a29f);logger[_0x25c1('0xf')](_0x25c1('0x16'),_0x61a29f,JSON['stringify'](_0x481c12));_0x7175d4(_0x481c12);})['catch'](function(_0x2a8a84){logger[_0x25c1('0x11')](_0x25c1('0x16'),_0x2a8a84[_0x25c1('0x12')],_0x61a29f);_0x23a418(_0x4c0d49[_0x25c1('0x11')](0x1f4,_0x2a8a84[_0x25c1('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index ffc7f2b..1b1ec9b 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(_0x2b7ced,_0x56de2e){var _0x323d6f=function(_0x1301cb){while(--_0x1301cb){_0x2b7ced['push'](_0x2b7ced['shift']());}};_0x323d6f(++_0x56de2e);}(_0xb10b,0x12a));var _0xbb10=function(_0x59f2fe,_0x372cfb){_0x59f2fe=_0x59f2fe-0x0;var _0x121432=_0xb10b[_0x59f2fe];return _0x121432;};'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(_0x447ba6,_0x20f96a){var _0x4103cb=function(_0x3eab76){while(--_0x3eab76){_0x447ba6['push'](_0x447ba6['shift']());}};_0x4103cb(++_0x20f96a);}(_0xadb5,0xad));var _0x5adb=function(_0x4f5c87,_0x5504cc){_0x4f5c87=_0x4f5c87-0x0;var _0x45368d=_0xadb5[_0x4f5c87];return _0x45368d;};'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 aaa1aa0..b2ea51d 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 _0xd004=['../../config/environment','../../components/auth/service','signToken','../../config/utils','login','authenticate','google','/login','profile','email','callback','use','clientID','clientSecret','callbackURL','Setting','findOne','allowedLoginAttempts','then','User','find','map','emails','value','user','agent','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blocked','blockedAt','add','blockDuration','minutes','clearBlockUser','getLicense','catch','lodash','passport','Strategy','moment','../../mysqldb'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xd004,0x195));var _0x4d00=function(_0x4382bc,_0x231a2d){_0x4382bc=_0x4382bc-0x0;var _0x13c82a=_0xd004[_0x4382bc];return _0x13c82a;};'use strict';var _=require(_0x4d00('0x0'));var passport=require(_0x4d00('0x1'));var GoogleStrategy=require('passport-google-oauth20')[_0x4d00('0x2')];var moment=require(_0x4d00('0x3'));var db=require(_0x4d00('0x4'))['db'];var config=require(_0x4d00('0x5'));var signToken=require(_0x4d00('0x6'))[_0x4d00('0x7')];var utils=require(_0x4d00('0x8'));exports[_0x4d00('0x9')]=passport[_0x4d00('0xa')](_0x4d00('0xb'),{'failureRedirect':_0x4d00('0xc'),'scope':[_0x4d00('0xd'),_0x4d00('0xe')],'session':![]});exports[_0x4d00('0xf')]=passport[_0x4d00('0xa')](_0x4d00('0xb'),{'failureRedirect':'/login','session':![]});passport[_0x4d00('0x10')](new GoogleStrategy({'clientID':config[_0x4d00('0xb')]?config[_0x4d00('0xb')][_0x4d00('0x11')]:'id','clientSecret':config[_0x4d00('0xb')]?config['google'][_0x4d00('0x12')]:'secret','callbackURL':config[_0x4d00('0xb')]?config[_0x4d00('0xb')][_0x4d00('0x13')]:''},function(_0x9f909d,_0x2e42cb,_0x1de724,_0x507052){var _0x4bc338,_0x19c58e;return db[_0x4d00('0x14')][_0x4d00('0x15')]({'where':{'id':0x1},'attributes':[_0x4d00('0x16'),'blockDuration'],'raw':!![]})[_0x4d00('0x17')](function(_0x1295c9){_0x4bc338=_0x1295c9;return db[_0x4d00('0x18')][_0x4d00('0x19')]({'where':{'email':_[_0x4d00('0x1a')](_0x1de724[_0x4d00('0x1b')],_0x4d00('0x1c')),'role':{'$or':['admin',_0x4d00('0x1d'),_0x4d00('0x1e')]}}});})['then'](function(_0x564d07){_0x19c58e=_0x564d07;if(_0x19c58e){if(_0x19c58e[_0x4d00('0x1f')]){return _0x507052(_0x4d00('0x20'));}else if(_0x4bc338['blockDuration']>0x0){if(_0x19c58e[_0x4d00('0x21')]){if(moment(_0x19c58e[_0x4d00('0x22')])[_0x4d00('0x23')](_0x4bc338[_0x4d00('0x24')],_0x4d00('0x25'))>moment()){return _0x507052(_0x4d00('0x20'));}else{return utils[_0x4d00('0x26')](_0x19c58e,0x0,![],null)[_0x4d00('0x17')](function(){return utils[_0x4d00('0x27')](_0x19c58e);})[_0x4d00('0x17')](function(){return _0x507052(null,_0x19c58e);});}}else{return utils[_0x4d00('0x27')](_0x19c58e)[_0x4d00('0x17')](function(){return _0x507052(null,_0x19c58e);});}}else{return utils['getLicense'](_0x19c58e)[_0x4d00('0x17')](function(){return _0x507052(null,_0x19c58e);});}}return _0x507052(_0x4d00('0x20'));})[_0x4d00('0x28')](function(_0x4cf3ce){_0x507052(_0x4cf3ce);});})); \ No newline at end of file +var _0xfd8a=['value','admin','user','blocked','blockedAt','minutes','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','getLicense','catch','passport-google-oauth20','Strategy','moment','../../config/environment','../../components/auth/service','../../config/utils','authenticate','google','/login','profile','email','callback','use','clientSecret','secret','callbackURL','Setting','findOne','blockDuration','then','User','find','map','emails'];(function(_0x205e83,_0x2df5a4){var _0x10bb19=function(_0x41a375){while(--_0x41a375){_0x205e83['push'](_0x205e83['shift']());}};_0x10bb19(++_0x2df5a4);}(_0xfd8a,0x195));var _0xafd8=function(_0x5c7a85,_0x41dd19){_0x5c7a85=_0x5c7a85-0x0;var _0x35290f=_0xfd8a[_0x5c7a85];return _0x35290f;};'use strict';var _=require('lodash');var passport=require('passport');var GoogleStrategy=require(_0xafd8('0x0'))[_0xafd8('0x1')];var moment=require(_0xafd8('0x2'));var db=require('../../mysqldb')['db'];var config=require(_0xafd8('0x3'));var signToken=require(_0xafd8('0x4'))['signToken'];var utils=require(_0xafd8('0x5'));exports['login']=passport[_0xafd8('0x6')](_0xafd8('0x7'),{'failureRedirect':_0xafd8('0x8'),'scope':[_0xafd8('0x9'),_0xafd8('0xa')],'session':![]});exports[_0xafd8('0xb')]=passport['authenticate']('google',{'failureRedirect':'/login','session':![]});passport[_0xafd8('0xc')](new GoogleStrategy({'clientID':config[_0xafd8('0x7')]?config[_0xafd8('0x7')]['clientID']:'id','clientSecret':config[_0xafd8('0x7')]?config[_0xafd8('0x7')][_0xafd8('0xd')]:_0xafd8('0xe'),'callbackURL':config['google']?config[_0xafd8('0x7')][_0xafd8('0xf')]:''},function(_0x51a078,_0x15be0c,_0x1336de,_0x70bbde){var _0xc7bb29,_0x4529b5;return db[_0xafd8('0x10')][_0xafd8('0x11')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0xafd8('0x12')],'raw':!![]})[_0xafd8('0x13')](function(_0x9ba4ab){_0xc7bb29=_0x9ba4ab;return db[_0xafd8('0x14')][_0xafd8('0x15')]({'where':{'email':_[_0xafd8('0x16')](_0x1336de[_0xafd8('0x17')],_0xafd8('0x18')),'role':{'$or':[_0xafd8('0x19'),_0xafd8('0x1a'),'agent']}}});})['then'](function(_0x551f43){_0x4529b5=_0x551f43;if(_0x4529b5){if(_0x4529b5['disabled']){return _0x70bbde('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else if(_0xc7bb29[_0xafd8('0x12')]>0x0){if(_0x4529b5[_0xafd8('0x1b')]){if(moment(_0x4529b5[_0xafd8('0x1c')])['add'](_0xc7bb29[_0xafd8('0x12')],_0xafd8('0x1d'))>moment()){return _0x70bbde(_0xafd8('0x1e'));}else{return utils['clearBlockUser'](_0x4529b5,0x0,![],null)[_0xafd8('0x13')](function(){return utils[_0xafd8('0x1f')](_0x4529b5);})[_0xafd8('0x13')](function(){return _0x70bbde(null,_0x4529b5);});}}else{return utils['getLicense'](_0x4529b5)[_0xafd8('0x13')](function(){return _0x70bbde(null,_0x4529b5);});}}else{return utils['getLicense'](_0x4529b5)[_0xafd8('0x13')](function(){return _0x70bbde(null,_0x4529b5);});}}return _0x70bbde(_0xafd8('0x1e'));})[_0xafd8('0x20')](function(_0x1ea14d){_0x70bbde(_0x1ea14d);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index 0a15a94..104cac8 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 _0x2c0a=['/callback','callback','setTokenCookie','exports','express','passport','Router','../user/user.controller.js','../../components/auth/service','get','login'];(function(_0x24be14,_0x2c32f6){var _0x1c3233=function(_0x3e8a5a){while(--_0x3e8a5a){_0x24be14['push'](_0x24be14['shift']());}};_0x1c3233(++_0x2c32f6);}(_0x2c0a,0x1a6));var _0xa2c0=function(_0x1b4c04,_0x8d961d){_0x1b4c04=_0x1b4c04-0x0;var _0x374f5d=_0x2c0a[_0x1b4c04];return _0x374f5d;};'use strict';var express=require(_0xa2c0('0x0'));var passport=require(_0xa2c0('0x1'));var router=express[_0xa2c0('0x2')]();var controller=require('./authGoogle.controller');var userController=require(_0xa2c0('0x3'));var authService=require(_0xa2c0('0x4'));router[_0xa2c0('0x5')]('/',controller[_0xa2c0('0x6')]);router[_0xa2c0('0x5')](_0xa2c0('0x7'),controller[_0xa2c0('0x8')],authService['isMiddleware'],userController[_0xa2c0('0x6')],authService[_0xa2c0('0x9')]);module[_0xa2c0('0xa')]=router; \ No newline at end of file +var _0xacda=['callback','isMiddleware','login','setTokenCookie','express','passport','Router','./authGoogle.controller','get','/callback'];(function(_0x4e61a9,_0x595c7d){var _0x149126=function(_0x508fc0){while(--_0x508fc0){_0x4e61a9['push'](_0x4e61a9['shift']());}};_0x149126(++_0x595c7d);}(_0xacda,0x7c));var _0xaacd=function(_0x3cf5bf,_0x22092e){_0x3cf5bf=_0x3cf5bf-0x0;var _0x181a6b=_0xacda[_0x3cf5bf];return _0x181a6b;};'use strict';var express=require(_0xaacd('0x0'));var passport=require(_0xaacd('0x1'));var router=express[_0xaacd('0x2')]();var controller=require(_0xaacd('0x3'));var userController=require('../user/user.controller.js');var authService=require('../../components/auth/service');router[_0xaacd('0x4')]('/',controller['login']);router[_0xaacd('0x4')](_0xaacd('0x5'),controller[_0xaacd('0x6')],authService[_0xaacd('0x7')],userController[_0xaacd('0x8')],authService[_0xaacd('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 24a6908..4421d7a 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 _0xbd94=['enforcePasswordHistory','previousPasswords','validatePasswordHistory','use','util','Strategy','lodash','randomstring','moment','../../components/auth/service','../../config/utils','http','Setting','findOne','allowedLoginAttempts','blockDuration','then','role','blocked','loginAttempts','admin','user','agent','name','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','clearBlockUser','add','getLicense','catch','MailAccount','find','email','MailServerOut','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','Smtp','service','host','port','secure','authentication','auth','pass','\x22%s\x22\x20<%s>','request','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','status','send','message','login','authenticate','local','signToken','json','online','body','Email\x20parameter\x20is\x20missing','generate','trim','toLowerCase','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','blockedAt','minutes','resetPasswordToken','resetPasswordExpires','now','save','xCally\x20Motion\x20Password\x20Reset','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','headers','/reset/','Reset\x20Email\x20sent!','reset','params','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','passwordHistoryLimit','password'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xbd94,0xfd));var _0x4bd9=function(_0x2112d4,_0x3c863c){_0x2112d4=_0x2112d4-0x0;var _0x434972=_0xbd94[_0x2112d4];return _0x434972;};'use strict';var util=require(_0x4bd9('0x0'));var passport=require('passport');var LocalStrategy=require('passport-local')[_0x4bd9('0x1')];var jayson=require('jayson/promise');var _=require(_0x4bd9('0x2'));var rs=require(_0x4bd9('0x3'));var moment=require(_0x4bd9('0x4'));var db=require('../../mysqldb')['db'];var authService=require(_0x4bd9('0x5'));var utils=require(_0x4bd9('0x6'));var client=jayson['client'][_0x4bd9('0x7')]({'port':0x232b});function localAuthenticate(_0x2011f9,_0x513442,_0x15c6c1,_0x1e16fd){var _0x4c5301,_0x1aa51f;return db[_0x4bd9('0x8')][_0x4bd9('0x9')]({'where':{'id':0x1},'attributes':[_0x4bd9('0xa'),_0x4bd9('0xb')],'raw':!![]})[_0x4bd9('0xc')](function(_0x348a54){_0x4c5301=_0x348a54;return _0x2011f9[_0x4bd9('0x9')]({'attributes':['id','name','password','salt',_0x4bd9('0xd'),'disabled',_0x4bd9('0xe'),'blockedAt',_0x4bd9('0xf')],'where':{'name':_0x513442,'role':{'$or':[_0x4bd9('0x10'),_0x4bd9('0x11'),_0x4bd9('0x12')]}}});})[_0x4bd9('0xc')](function(_0x472551){if(!_0x472551||_0x472551&&_0x472551[_0x4bd9('0x13')]!==_0x513442){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x1aa51f=_0x472551;return _0x1aa51f;}})['then'](function(){_0x1aa51f['authenticate'](_0x15c6c1,function(_0x14deee,_0x3142fb){var _0x33682d=_0x1aa51f['loginAttempts']+0x1;if(_0x14deee){return _0x1e16fd(_0x14deee);}else if(!_0x3142fb){if(_0x1aa51f[_0x4bd9('0x14')]){return _0x1e16fd(null,![],{'message':_0x4bd9('0x15')});}else if(_0x4c5301['allowedLoginAttempts']>0x0){if(_0x1aa51f[_0x4bd9('0xe')]){if(_0x4c5301['blockDuration']>0x0){if(moment(_0x1aa51f['blockedAt'])['add'](_0x4c5301[_0x4bd9('0xb')],'minutes')>moment()){return _0x1e16fd(null,![],{'message':_0x4bd9('0x15')});}else{return utils[_0x4bd9('0x16')](_0x1aa51f,_0x33682d,![],null)[_0x4bd9('0xc')](function(){return _0x1e16fd(null,![],{'message':_0x4bd9('0x15')});});}}else{return _0x1e16fd(null,![],{'message':_0x4bd9('0x15')});}}else{if(_0x33682d>=_0x4c5301[_0x4bd9('0xa')]){return utils[_0x4bd9('0x16')](_0x1aa51f,0x0,!![],moment())[_0x4bd9('0xc')](function(){return _0x1e16fd(null,![],{'message':_0x4bd9('0x15')});});}else{return utils['clearBlockUser'](_0x1aa51f,_0x33682d,![],null)[_0x4bd9('0xc')](function(){return _0x1e16fd(null,![],{'message':_0x4bd9('0x15')});});}}}else{return _0x1e16fd(null,![],{'message':_0x4bd9('0x15')});}}else{if(_0x1aa51f[_0x4bd9('0x14')]){return _0x1e16fd(null,![],{'message':_0x4bd9('0x15')});}else if(_0x4c5301['allowedLoginAttempts']>0x0){if(_0x1aa51f[_0x4bd9('0xe')]){if(_0x4c5301[_0x4bd9('0xb')]>0x0){if(moment(_0x1aa51f['blockedAt'])[_0x4bd9('0x17')](_0x4c5301['blockDuration'],'minutes')>moment()){return _0x1e16fd(null,![],{'message':_0x4bd9('0x15')});}else{return utils['clearBlockUser'](_0x1aa51f,0x0,![],null)[_0x4bd9('0xc')](function(){return utils[_0x4bd9('0x18')](_0x1aa51f);})[_0x4bd9('0xc')](function(){return _0x1e16fd(null,_0x1aa51f);});}}else{return _0x1e16fd(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{return utils[_0x4bd9('0x16')](_0x1aa51f,0x0,![],null)[_0x4bd9('0xc')](function(){return utils[_0x4bd9('0x18')](_0x1aa51f);})[_0x4bd9('0xc')](function(){return _0x1e16fd(null,_0x1aa51f);})[_0x4bd9('0x19')](function(_0x56a050){return _0x1e16fd(null,![],_0x56a050);});}}else{if(_0x1aa51f[_0x4bd9('0xe')]){return _0x1e16fd(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0x4bd9('0x18')](_0x1aa51f)[_0x4bd9('0xc')](function(){return _0x1e16fd(null,_0x1aa51f);});}}}});})[_0x4bd9('0x19')](function(_0x2fb899){return _0x1e16fd(null,![],_0x2fb899);});}function sendServiceMail(_0x157e6f){return db[_0x4bd9('0x1a')][_0x4bd9('0x1b')]({'where':{'service':!![]},'attributes':['id',_0x4bd9('0x13'),_0x4bd9('0x1c')],'include':[{'model':db[_0x4bd9('0x1d')],'as':'Smtp'}]})[_0x4bd9('0xc')](function(_0x51432e){if(!_0x51432e){throw new Error(_0x4bd9('0x1e'));}var _0x40f568={'tls':{'rejectUnauthorized':![]}};if(_0x51432e[_0x4bd9('0x1f')]['service']){_0x40f568[_0x4bd9('0x20')]=_0x51432e[_0x4bd9('0x1f')]['service'];}else{_0x40f568[_0x4bd9('0x21')]=_0x51432e[_0x4bd9('0x1f')][_0x4bd9('0x21')];_0x40f568[_0x4bd9('0x22')]=_0x51432e[_0x4bd9('0x1f')][_0x4bd9('0x22')];_0x40f568[_0x4bd9('0x23')]=_0x51432e[_0x4bd9('0x1f')][_0x4bd9('0x23')];}if(_0x51432e[_0x4bd9('0x1f')][_0x4bd9('0x24')]){_0x40f568[_0x4bd9('0x25')]={'user':_0x51432e['Smtp'][_0x4bd9('0x11')],'pass':_0x51432e['Smtp'][_0x4bd9('0x26')]};}var _0x397961={'account':_0x40f568,'message':_['merge']({'from':util['format'](_0x4bd9('0x27'),_0x51432e[_0x4bd9('0x13')],_0x51432e[_0x4bd9('0x1c')]||_0x51432e['Smtp']['user'])},_0x157e6f)};return client[_0x4bd9('0x28')](_0x4bd9('0x29'),_0x397961);})[_0x4bd9('0xc')](function(_0x1ef550){if(_0x1ef550[_0x4bd9('0x2a')]){throw new Error(util['format'](_0x4bd9('0x2b'),_0x1ef550['error']['message']||JSON['stringify'](_0x1ef550[_0x4bd9('0x2a')])));}return!![];});}function handleError(_0x397462,_0x3af482,_0x24c52d){return _0x397462[_0x4bd9('0x2c')](_0x3af482||0x1f4)[_0x4bd9('0x2d')]({'message':_0x24c52d?_0x24c52d[_0x4bd9('0x2e')]||_0x24c52d:''});}exports[_0x4bd9('0x2f')]=function(_0x59808c,_0x270703,_0x304875){passport[_0x4bd9('0x30')](_0x4bd9('0x31'),function(_0x53bbd9,_0xd3ac98,_0x23f74f){var _0x25573d=_0x53bbd9||_0x23f74f;if(_0x25573d){return handleError(_0x270703,0x191,_0x25573d);}if(!_0xd3ac98){return handleError(_0x270703,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x2e030c={'payload':{'id':_0xd3ac98['id'],'role':_0xd3ac98[_0x4bd9('0xd')]},'options':{'expiresIn':0x15180}};return authService[_0x4bd9('0x32')](_0x2e030c)['then'](function(_0xd3f7af){_0x270703[_0x4bd9('0x33')]({'id':_0xd3ac98['id'],'token':_0xd3f7af,'statusCall':'','isAlreadyLogged':_0xd3ac98[_0x4bd9('0x34')]});});}})(_0x59808c,_0x270703,_0x304875);};exports['forgot']=function(_0x19ec2e,_0xb3744e,_0x2b8088){if(!_0x19ec2e[_0x4bd9('0x35')]['email']){return handleError(_0xb3744e,0x1f4,{'message':_0x4bd9('0x36')});}var _0x3d55a1=rs[_0x4bd9('0x37')]();_0x19ec2e[_0x4bd9('0x35')]['email']=_0x19ec2e[_0x4bd9('0x35')][_0x4bd9('0x1c')][_0x4bd9('0x38')]()[_0x4bd9('0x39')]();var _0x22ff60;return db['Setting'][_0x4bd9('0x9')]({'where':{'id':0x1},'attributes':[_0x4bd9('0xa'),'blockDuration'],'raw':!![]})['then'](function(_0x2062b0){_0x22ff60=_0x2062b0;return db[_0x4bd9('0x3a')]['find']({'where':{'email':_0x19ec2e[_0x4bd9('0x35')][_0x4bd9('0x1c')]}});})[_0x4bd9('0xc')](function(_0x2ffcb4){if(!_0x2ffcb4){throw new Error(_0x4bd9('0x3b'));}if(_0x2ffcb4[_0x4bd9('0x14')]){throw new Error(_0x4bd9('0x3c'));}if(_0x2ffcb4[_0x4bd9('0xe')]){if(moment(_0x2ffcb4[_0x4bd9('0x3d')])[_0x4bd9('0x17')](_0x22ff60[_0x4bd9('0xb')],_0x4bd9('0x3e'))>moment()){throw new Error('The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.');}else{_0x2ffcb4['blocked']=![];_0x2ffcb4[_0x4bd9('0x3d')]=null;}}_0x2ffcb4[_0x4bd9('0x3f')]=_0x3d55a1;_0x2ffcb4[_0x4bd9('0x40')]=Date[_0x4bd9('0x41')]()+0x36ee80;return _0x2ffcb4[_0x4bd9('0x42')]();})[_0x4bd9('0xc')](function(){return sendServiceMail({'to':_0x19ec2e['body']['email'],'subject':_0x4bd9('0x43'),'text':'You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a'+_0x4bd9('0x44')+'https://'+_0x19ec2e[_0x4bd9('0x45')][_0x4bd9('0x21')]+_0x4bd9('0x46')+_0x3d55a1+'\x0a\x0a'+'If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a'});})['then'](function(){_0xb3744e[_0x4bd9('0x2c')](0xc8)[_0x4bd9('0x2d')]({'message':_0x4bd9('0x47')});})[_0x4bd9('0x19')](function(_0x3710a0){return handleError(_0xb3744e,0x1f4,_0x3710a0);});};exports[_0x4bd9('0x48')]=function(_0xd52b6,_0x194477,_0x5c5ed9){return db[_0x4bd9('0x3a')][_0x4bd9('0x1b')]({'where':{'resetPasswordToken':_0xd52b6[_0x4bd9('0x49')][_0x4bd9('0x4a')],'resetPasswordExpires':{'$gt':Date['now']()}}})[_0x4bd9('0xc')](function(_0x1a5e53){if(!_0x1a5e53){throw new Error(_0x4bd9('0x4b'));}return db[_0x4bd9('0x8')]['findOne']({'attributes':['id',_0x4bd9('0x4c'),'enforcePasswordHistory',_0x4bd9('0x4d')]})[_0x4bd9('0xc')](function(_0x1349dc){if(_0x1349dc[_0x4bd9('0x4c')])authService['validatePasswordPattern'](_0xd52b6[_0x4bd9('0x35')][_0x4bd9('0x4e')]);if(!_0x1349dc[_0x4bd9('0x4f')]||!_0x1a5e53[_0x4bd9('0x50')])return _0x1a5e53;authService[_0x4bd9('0x51')](_0xd52b6['body'][_0x4bd9('0x4e')],_0x1a5e53[_0x4bd9('0x50')],_0x1349dc[_0x4bd9('0x4d')]);return _0x1a5e53;})[_0x4bd9('0xc')](function(){_0x1a5e53['password']=_0xd52b6[_0x4bd9('0x35')][_0x4bd9('0x4e')];_0x1a5e53[_0x4bd9('0x3f')]=null;_0x1a5e53[_0x4bd9('0x40')]=null;return _0x1a5e53[_0x4bd9('0x42')]();});})[_0x4bd9('0xc')](function(){_0x194477[_0x4bd9('0x2c')](0xc8)[_0x4bd9('0x2d')]({'message':'Password\x20reset!'});})[_0x4bd9('0x19')](function(_0x1f81ac){return handleError(_0x194477,0x1f4,_0x1f81ac);});};passport[_0x4bd9('0x52')](new LocalStrategy({'usernameField':_0x4bd9('0x13'),'passwordField':_0x4bd9('0x4e')},function(_0x202db1,_0x31e912,_0x2c65b6){return localAuthenticate(db['User'],_0x202db1,_0x31e912,_0x2c65b6);})); \ No newline at end of file +var _0xc00a=['allowedLoginAttempts','blockDuration','name','salt','role','blocked','loginAttempts','admin','user','agent','then','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','disabled','add','minutes','clearBlockUser','blockedAt','getLicense','catch','MailAccount','MailServerOut','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','Smtp','service','host','port','secure','authentication','auth','format','email','request','SendMail','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','error','message','stringify','send','login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','Email\x20parameter\x20is\x20missing','generate','body','trim','toLowerCase','find','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','save','xCally\x20Motion\x20Password\x20Reset','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','headers','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','reset','User','params','token','now','enforcePasswordHistory','passwordHistoryLimit','securePassword','validatePasswordPattern','password','previousPasswords','validatePasswordHistory','status','Password\x20reset!','util','passport','Strategy','jayson/promise','lodash','moment','../../components/auth/service','../../config/utils','http','Setting','findOne'];(function(_0x2509b7,_0x34c982){var _0x4b4657=function(_0xbe4234){while(--_0xbe4234){_0x2509b7['push'](_0x2509b7['shift']());}};_0x4b4657(++_0x34c982);}(_0xc00a,0x1f3));var _0xac00=function(_0x24f326,_0x616a7){_0x24f326=_0x24f326-0x0;var _0x488e2d=_0xc00a[_0x24f326];return _0x488e2d;};'use strict';var util=require(_0xac00('0x0'));var passport=require(_0xac00('0x1'));var LocalStrategy=require('passport-local')[_0xac00('0x2')];var jayson=require(_0xac00('0x3'));var _=require(_0xac00('0x4'));var rs=require('randomstring');var moment=require(_0xac00('0x5'));var db=require('../../mysqldb')['db'];var authService=require(_0xac00('0x6'));var utils=require(_0xac00('0x7'));var client=jayson['client'][_0xac00('0x8')]({'port':0x232b});function localAuthenticate(_0x1344d0,_0x22d1c8,_0x447613,_0x552147){var _0x45950e,_0x39cdce;return db[_0xac00('0x9')][_0xac00('0xa')]({'where':{'id':0x1},'attributes':[_0xac00('0xb'),_0xac00('0xc')],'raw':!![]})['then'](function(_0x204833){_0x45950e=_0x204833;return _0x1344d0[_0xac00('0xa')]({'attributes':['id',_0xac00('0xd'),'password',_0xac00('0xe'),_0xac00('0xf'),'disabled',_0xac00('0x10'),'blockedAt',_0xac00('0x11')],'where':{'name':_0x22d1c8,'role':{'$or':[_0xac00('0x12'),_0xac00('0x13'),_0xac00('0x14')]}}});})[_0xac00('0x15')](function(_0x26726f){if(!_0x26726f||_0x26726f&&_0x26726f['name']!==_0x22d1c8){throw new Error(_0xac00('0x16'));}else{_0x39cdce=_0x26726f;return _0x39cdce;}})[_0xac00('0x15')](function(){_0x39cdce[_0xac00('0x17')](_0x447613,function(_0x1a51be,_0xef3db8){var _0x173d2f=_0x39cdce[_0xac00('0x11')]+0x1;if(_0x1a51be){return _0x552147(_0x1a51be);}else if(!_0xef3db8){if(_0x39cdce[_0xac00('0x18')]){return _0x552147(null,![],{'message':_0xac00('0x16')});}else if(_0x45950e[_0xac00('0xb')]>0x0){if(_0x39cdce[_0xac00('0x10')]){if(_0x45950e['blockDuration']>0x0){if(moment(_0x39cdce['blockedAt'])[_0xac00('0x19')](_0x45950e['blockDuration'],_0xac00('0x1a'))>moment()){return _0x552147(null,![],{'message':_0xac00('0x16')});}else{return utils[_0xac00('0x1b')](_0x39cdce,_0x173d2f,![],null)[_0xac00('0x15')](function(){return _0x552147(null,![],{'message':_0xac00('0x16')});});}}else{return _0x552147(null,![],{'message':_0xac00('0x16')});}}else{if(_0x173d2f>=_0x45950e[_0xac00('0xb')]){return utils['clearBlockUser'](_0x39cdce,0x0,!![],moment())[_0xac00('0x15')](function(){return _0x552147(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}else{return utils['clearBlockUser'](_0x39cdce,_0x173d2f,![],null)['then'](function(){return _0x552147(null,![],{'message':_0xac00('0x16')});});}}}else{return _0x552147(null,![],{'message':_0xac00('0x16')});}}else{if(_0x39cdce[_0xac00('0x18')]){return _0x552147(null,![],{'message':_0xac00('0x16')});}else if(_0x45950e[_0xac00('0xb')]>0x0){if(_0x39cdce[_0xac00('0x10')]){if(_0x45950e[_0xac00('0xc')]>0x0){if(moment(_0x39cdce[_0xac00('0x1c')])['add'](_0x45950e[_0xac00('0xc')],_0xac00('0x1a'))>moment()){return _0x552147(null,![],{'message':_0xac00('0x16')});}else{return utils['clearBlockUser'](_0x39cdce,0x0,![],null)[_0xac00('0x15')](function(){return utils[_0xac00('0x1d')](_0x39cdce);})[_0xac00('0x15')](function(){return _0x552147(null,_0x39cdce);});}}else{return _0x552147(null,![],{'message':_0xac00('0x16')});}}else{return utils[_0xac00('0x1b')](_0x39cdce,0x0,![],null)[_0xac00('0x15')](function(){return utils[_0xac00('0x1d')](_0x39cdce);})[_0xac00('0x15')](function(){return _0x552147(null,_0x39cdce);})[_0xac00('0x1e')](function(_0x5dfbef){return _0x552147(null,![],_0x5dfbef);});}}else{if(_0x39cdce['blocked']){return _0x552147(null,![],{'message':_0xac00('0x16')});}else{return utils['getLicense'](_0x39cdce)['then'](function(){return _0x552147(null,_0x39cdce);});}}}});})[_0xac00('0x1e')](function(_0x4a64d0){return _0x552147(null,![],_0x4a64d0);});}function sendServiceMail(_0x5b4b58){return db[_0xac00('0x1f')]['find']({'where':{'service':!![]},'attributes':['id',_0xac00('0xd'),'email'],'include':[{'model':db[_0xac00('0x20')],'as':'Smtp'}]})['then'](function(_0x2716c0){if(!_0x2716c0){throw new Error(_0xac00('0x21'));}var _0x396144={'tls':{'rejectUnauthorized':![]}};if(_0x2716c0[_0xac00('0x22')][_0xac00('0x23')]){_0x396144['service']=_0x2716c0['Smtp'][_0xac00('0x23')];}else{_0x396144[_0xac00('0x24')]=_0x2716c0[_0xac00('0x22')]['host'];_0x396144[_0xac00('0x25')]=_0x2716c0[_0xac00('0x22')][_0xac00('0x25')];_0x396144[_0xac00('0x26')]=_0x2716c0['Smtp']['secure'];}if(_0x2716c0[_0xac00('0x22')][_0xac00('0x27')]){_0x396144[_0xac00('0x28')]={'user':_0x2716c0[_0xac00('0x22')][_0xac00('0x13')],'pass':_0x2716c0[_0xac00('0x22')]['pass']};}var _0x3f55e5={'account':_0x396144,'message':_['merge']({'from':util[_0xac00('0x29')]('\x22%s\x22\x20<%s>',_0x2716c0[_0xac00('0xd')],_0x2716c0[_0xac00('0x2a')]||_0x2716c0['Smtp']['user'])},_0x5b4b58)};return client[_0xac00('0x2b')](_0xac00('0x2c'),_0x3f55e5);})['then'](function(_0x390b46){if(_0x390b46['error']){throw new Error(util[_0xac00('0x29')](_0xac00('0x2d'),_0x390b46[_0xac00('0x2e')][_0xac00('0x2f')]||JSON[_0xac00('0x30')](_0x390b46[_0xac00('0x2e')])));}return!![];});}function handleError(_0xc9ff73,_0x58a02d,_0x518ea3){return _0xc9ff73['status'](_0x58a02d||0x1f4)[_0xac00('0x31')]({'message':_0x518ea3?_0x518ea3[_0xac00('0x2f')]||_0x518ea3:''});}exports[_0xac00('0x32')]=function(_0x5e5d8d,_0x46a6ee,_0x2c6617){passport[_0xac00('0x17')]('local',function(_0x48e368,_0x510789,_0xfe8526){var _0x2dd423=_0x48e368||_0xfe8526;if(_0x2dd423){return handleError(_0x46a6ee,0x191,_0x2dd423);}if(!_0x510789){return handleError(_0x46a6ee,0x194,{'message':_0xac00('0x33')});}else{var _0x9a1344={'payload':{'id':_0x510789['id'],'role':_0x510789[_0xac00('0xf')]},'options':{'expiresIn':0x15180}};return authService[_0xac00('0x34')](_0x9a1344)[_0xac00('0x15')](function(_0x14e1f6){_0x46a6ee['json']({'id':_0x510789['id'],'token':_0x14e1f6,'statusCall':'','isAlreadyLogged':_0x510789['online']});});}})(_0x5e5d8d,_0x46a6ee,_0x2c6617);};exports['forgot']=function(_0x50d433,_0x45a5ae,_0x3c52be){if(!_0x50d433['body'][_0xac00('0x2a')]){return handleError(_0x45a5ae,0x1f4,{'message':_0xac00('0x35')});}var _0x2db240=rs[_0xac00('0x36')]();_0x50d433[_0xac00('0x37')][_0xac00('0x2a')]=_0x50d433[_0xac00('0x37')][_0xac00('0x2a')][_0xac00('0x38')]()[_0xac00('0x39')]();var _0x232e23;return db[_0xac00('0x9')][_0xac00('0xa')]({'where':{'id':0x1},'attributes':[_0xac00('0xb'),_0xac00('0xc')],'raw':!![]})[_0xac00('0x15')](function(_0x70289a){_0x232e23=_0x70289a;return db['User'][_0xac00('0x3a')]({'where':{'email':_0x50d433[_0xac00('0x37')]['email']}});})[_0xac00('0x15')](function(_0x4f8b70){if(!_0x4f8b70){throw new Error(_0xac00('0x3b'));}if(_0x4f8b70[_0xac00('0x18')]){throw new Error(_0xac00('0x3c'));}if(_0x4f8b70[_0xac00('0x10')]){if(moment(_0x4f8b70['blockedAt'])[_0xac00('0x19')](_0x232e23[_0xac00('0xc')],_0xac00('0x1a'))>moment()){throw new Error(_0xac00('0x3d'));}else{_0x4f8b70['blocked']=![];_0x4f8b70[_0xac00('0x1c')]=null;}}_0x4f8b70[_0xac00('0x3e')]=_0x2db240;_0x4f8b70['resetPasswordExpires']=Date['now']()+0x36ee80;return _0x4f8b70[_0xac00('0x3f')]();})['then'](function(){return sendServiceMail({'to':_0x50d433[_0xac00('0x37')][_0xac00('0x2a')],'subject':_0xac00('0x40'),'text':'You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a'+_0xac00('0x41')+_0xac00('0x42')+_0x50d433[_0xac00('0x43')][_0xac00('0x24')]+_0xac00('0x44')+_0x2db240+'\x0a\x0a'+_0xac00('0x45')});})[_0xac00('0x15')](function(){_0x45a5ae['status'](0xc8)[_0xac00('0x31')]({'message':_0xac00('0x46')});})['catch'](function(_0x3dfff4){return handleError(_0x45a5ae,0x1f4,_0x3dfff4);});};exports[_0xac00('0x47')]=function(_0x3336b1,_0x37c99e,_0x3133a2){return db[_0xac00('0x48')]['find']({'where':{'resetPasswordToken':_0x3336b1[_0xac00('0x49')][_0xac00('0x4a')],'resetPasswordExpires':{'$gt':Date[_0xac00('0x4b')]()}}})[_0xac00('0x15')](function(_0x174d8e){if(!_0x174d8e){throw new Error('Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.');}return db[_0xac00('0x9')]['findOne']({'attributes':['id','securePassword',_0xac00('0x4c'),_0xac00('0x4d')]})[_0xac00('0x15')](function(_0x1bc3c6){if(_0x1bc3c6[_0xac00('0x4e')])authService[_0xac00('0x4f')](_0x3336b1['body'][_0xac00('0x50')]);if(!_0x1bc3c6[_0xac00('0x4c')]||!_0x174d8e[_0xac00('0x51')])return _0x174d8e;authService[_0xac00('0x52')](_0x3336b1[_0xac00('0x37')][_0xac00('0x50')],_0x174d8e['previousPasswords'],_0x1bc3c6[_0xac00('0x4d')]);return _0x174d8e;})[_0xac00('0x15')](function(){_0x174d8e[_0xac00('0x50')]=_0x3336b1[_0xac00('0x37')][_0xac00('0x50')];_0x174d8e[_0xac00('0x3e')]=null;_0x174d8e['resetPasswordExpires']=null;return _0x174d8e[_0xac00('0x3f')]();});})[_0xac00('0x15')](function(){_0x37c99e[_0xac00('0x53')](0xc8)[_0xac00('0x31')]({'message':_0xac00('0x54')});})[_0xac00('0x1e')](function(_0x8d1314){return handleError(_0x37c99e,0x1f4,_0x8d1314);});};passport['use'](new LocalStrategy({'usernameField':_0xac00('0xd'),'passwordField':'password'},function(_0x591e5e,_0x4523b2,_0x15af2e){return localAuthenticate(db[_0xac00('0x48')],_0x591e5e,_0x4523b2,_0x15af2e);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index b1cc82e..66239b3 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 _0x7751=['exports','express','Router','./authLocal.controller','login','post','/forgot','forgot','/reset/:token','reset'];(function(_0x4dcdfc,_0x11374f){var _0x25d086=function(_0x4e1141){while(--_0x4e1141){_0x4dcdfc['push'](_0x4dcdfc['shift']());}};_0x25d086(++_0x11374f);}(_0x7751,0x97));var _0x1775=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7751[_0x3dd15e];return _0x231fd0;};'use strict';var express=require(_0x1775('0x0'));var router=express[_0x1775('0x1')]();var controller=require(_0x1775('0x2'));router['post']('/',controller[_0x1775('0x3')]);router[_0x1775('0x4')](_0x1775('0x5'),controller[_0x1775('0x6')]);router[_0x1775('0x4')](_0x1775('0x7'),controller[_0x1775('0x8')]);module[_0x1775('0x9')]=router; \ No newline at end of file +var _0x2085=['./authLocal.controller','post','/forgot','reset','express','Router'];(function(_0x7ea1fb,_0x2f0b74){var _0x478241=function(_0xd06b3a){while(--_0xd06b3a){_0x7ea1fb['push'](_0x7ea1fb['shift']());}};_0x478241(++_0x2f0b74);}(_0x2085,0xf4));var _0x5208=function(_0x24c963,_0x5f32a4){_0x24c963=_0x24c963-0x0;var _0x32a0eb=_0x2085[_0x24c963];return _0x32a0eb;};'use strict';var express=require(_0x5208('0x0'));var router=express[_0x5208('0x1')]();var controller=require(_0x5208('0x2'));router['post']('/',controller['login']);router[_0x5208('0x3')](_0x5208('0x4'),controller['forgot']);router['post']('/reset/:token',controller[_0x5208('0x5')]);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 f0a025c..295353b 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 _0x0e6b=['sequelize','exports','STRING','BOOLEAN','INTEGER'];(function(_0xf8ed4a,_0x35d9bb){var _0x5aee7f=function(_0x46f715){while(--_0x46f715){_0xf8ed4a['push'](_0xf8ed4a['shift']());}};_0x5aee7f(++_0x35d9bb);}(_0x0e6b,0x1db));var _0xb0e6=function(_0x333714,_0x3370ac){_0x333714=_0x333714-0x0;var _0x4c211e=_0x0e6b[_0x333714];return _0x4c211e;};'use strict';var Sequelize=require(_0xb0e6('0x0'));module[_0xb0e6('0x1')]={'name':{'type':Sequelize[_0xb0e6('0x2')],'allowNull':![]},'channel':{'type':Sequelize[_0xb0e6('0x2')]},'description':{'type':Sequelize[_0xb0e6('0x2')]},'status':{'type':Sequelize[_0xb0e6('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize[_0xb0e6('0x4')],'defaultValue':0xa}}; \ No newline at end of file +var _0x69f8=['exports','STRING'];(function(_0x239769,_0x340362){var _0x3f70a0=function(_0x41d685){while(--_0x41d685){_0x239769['push'](_0x239769['shift']());}};_0x3f70a0(++_0x340362);}(_0x69f8,0x1ea));var _0x869f=function(_0x3023c9,_0x5e2ec6){_0x3023c9=_0x3023c9-0x0;var _0x12938f=_0x69f8[_0x3023c9];return _0x12938f;};'use strict';var Sequelize=require('sequelize');module[_0x869f('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'channel':{'type':Sequelize[_0x869f('0x1')]},'description':{'type':Sequelize[_0x869f('0x1')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timeout':{'type':Sequelize['INTEGER'],'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 a715943..3458d84 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 _0x85fd=['../../config/license/util','../../mysqldb','sendStatus','status','end','limit','undefined','count','offset','set','apply','reject','save','update','then','destroy','error','stack','name','index','Automation','rawAttributes','fieldName','model','map','query','filters','attributes','intersection','fields','length','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','catch','show','params','keys','find','create','body','Condition','ids','getConditions','findOne','hasOwnProperty','nolimit','addActions','Action','omit','order','getActions','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment'];(function(_0xbb94f8,_0x106612){var _0x2ad44a=function(_0x22701a){while(--_0x22701a){_0xbb94f8['push'](_0xbb94f8['shift']());}};_0x2ad44a(++_0x106612);}(_0x85fd,0xe4));var _0xd85f=function(_0x1c9074,_0x85fb6d){_0x1c9074=_0x1c9074-0x0;var _0x4316c3=_0x85fd[_0x1c9074];return _0x4316c3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd85f('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd85f('0x1'));var rp=require(_0xd85f('0x2'));var moment=require(_0xd85f('0x3'));var BPromise=require(_0xd85f('0x4'));var Mustache=require(_0xd85f('0x5'));var util=require('util');var path=require(_0xd85f('0x6'));var sox=require(_0xd85f('0x7'));var csv=require('to-csv');var ejs=require(_0xd85f('0x8'));var fs=require('fs');var fs_extra=require(_0xd85f('0x9'));var _=require(_0xd85f('0xa'));var squel=require(_0xd85f('0xb'));var crypto=require(_0xd85f('0xc'));var jsforce=require(_0xd85f('0xd'));var deskjs=require(_0xd85f('0xe'));var toCsv=require(_0xd85f('0xf'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xd85f('0x10'));var authService=require(_0xd85f('0x11'));var qs=require(_0xd85f('0x12'));var as=require(_0xd85f('0x13'));var hardwareService=require(_0xd85f('0x14'));var logger=require(_0xd85f('0x15'))('api');var utils=require(_0xd85f('0x16'));var config=require(_0xd85f('0x17'));var licenseUtil=require(_0xd85f('0x18'));var db=require(_0xd85f('0x19'))['db'];function respondWithStatusCode(_0x58a477,_0x301af2){_0x301af2=_0x301af2||0xcc;return function(_0x2c85c3){if(_0x2c85c3){return _0x58a477[_0xd85f('0x1a')](_0x301af2);}return _0x58a477[_0xd85f('0x1b')](_0x301af2)[_0xd85f('0x1c')]();};}function respondWithResult(_0x4fab86,_0x2f434c){_0x2f434c=_0x2f434c||0xc8;return function(_0xa7a946){if(_0xa7a946){return _0x4fab86[_0xd85f('0x1b')](_0x2f434c)['json'](_0xa7a946);}};}function respondWithFilteredResult(_0x2d98f5,_0x23bd3f){return function(_0x136554){if(_0x136554){var _0xde58ab=typeof _0x23bd3f['offset']==='undefined'&&typeof _0x23bd3f[_0xd85f('0x1d')]===_0xd85f('0x1e');var _0x585389=_0x136554[_0xd85f('0x1f')];var _0x327d04=_0xde58ab?0x0:_0x23bd3f[_0xd85f('0x20')];var _0x3d6aa0=_0xde58ab?_0x136554['count']:_0x23bd3f['offset']+_0x23bd3f['limit'];var _0x47b156;if(_0x3d6aa0>=_0x585389){_0x3d6aa0=_0x585389;_0x47b156=0xc8;}else{_0x47b156=0xce;}_0x2d98f5[_0xd85f('0x1b')](_0x47b156);return _0x2d98f5[_0xd85f('0x21')]('Content-Range',_0x327d04+'-'+_0x3d6aa0+'/'+_0x585389)['json'](_0x136554);}return null;};}function patchUpdates(_0x1f0249){return function(_0x36ecca){try{jsonpatch[_0xd85f('0x22')](_0x36ecca,_0x1f0249,!![]);}catch(_0x905128){return BPromise[_0xd85f('0x23')](_0x905128);}return _0x36ecca[_0xd85f('0x24')]();};}function saveUpdates(_0x3302ca,_0xb4dfe6){return function(_0x2c0771){if(_0x2c0771){return _0x2c0771[_0xd85f('0x25')](_0x3302ca)[_0xd85f('0x26')](function(_0x4d7657){return _0x4d7657;});}return null;};}function removeEntity(_0x531dc,_0x184372){return function(_0x50d561){if(_0x50d561){return _0x50d561[_0xd85f('0x27')]()[_0xd85f('0x26')](function(){_0x531dc[_0xd85f('0x1b')](0xcc)[_0xd85f('0x1c')]();});}};}function handleEntityNotFound(_0x2e6489,_0x198b4d){return function(_0x3798e0){if(!_0x3798e0){_0x2e6489[_0xd85f('0x1a')](0x194);}return _0x3798e0;};}function handleError(_0x43acce,_0x3a13fe){_0x3a13fe=_0x3a13fe||0x1f4;return function(_0x420792){logger[_0xd85f('0x28')](_0x420792[_0xd85f('0x29')]);if(_0x420792['name']){delete _0x420792[_0xd85f('0x2a')];}_0x43acce[_0xd85f('0x1b')](_0x3a13fe)['send'](_0x420792);};}exports[_0xd85f('0x2b')]=function(_0x248325,_0x265e1a){var _0x2dc7f9={},_0x43375b={},_0x2fdb09={'count':0x0,'rows':[]};var _0x3210ea=_['map'](db[_0xd85f('0x2c')][_0xd85f('0x2d')],function(_0x48b6e6){return{'name':_0x48b6e6[_0xd85f('0x2e')],'type':_0x48b6e6['type']['key']};});_0x43375b[_0xd85f('0x2f')]=_[_0xd85f('0x30')](_0x3210ea,_0xd85f('0x2a'));_0x43375b['query']=_['keys'](_0x248325[_0xd85f('0x31')]);_0x43375b[_0xd85f('0x32')]=_['intersection'](_0x43375b[_0xd85f('0x2f')],_0x43375b[_0xd85f('0x31')]);_0x2dc7f9[_0xd85f('0x33')]=_[_0xd85f('0x34')](_0x43375b[_0xd85f('0x2f')],qs[_0xd85f('0x35')](_0x248325[_0xd85f('0x31')][_0xd85f('0x35')]));_0x2dc7f9['attributes']=_0x2dc7f9[_0xd85f('0x33')][_0xd85f('0x36')]?_0x2dc7f9[_0xd85f('0x33')]:_0x43375b[_0xd85f('0x2f')];if(!_0x248325[_0xd85f('0x31')]['hasOwnProperty']('nolimit')){_0x2dc7f9['limit']=qs[_0xd85f('0x1d')](_0x248325[_0xd85f('0x31')]['limit']);_0x2dc7f9['offset']=qs[_0xd85f('0x20')](_0x248325[_0xd85f('0x31')][_0xd85f('0x20')]);}_0x2dc7f9['order']=qs[_0xd85f('0x37')](_0x248325['query'][_0xd85f('0x37')]);_0x2dc7f9[_0xd85f('0x38')]=qs[_0xd85f('0x32')](_[_0xd85f('0x39')](_0x248325[_0xd85f('0x31')],_0x43375b[_0xd85f('0x32')]),_0x3210ea);if(_0x248325[_0xd85f('0x31')][_0xd85f('0x3a')]){_0x2dc7f9[_0xd85f('0x38')]=_[_0xd85f('0x3b')](_0x2dc7f9[_0xd85f('0x38')],{'$or':_[_0xd85f('0x30')](_0x3210ea,function(_0x45ce2c){if(_0x45ce2c[_0xd85f('0x3c')]!==_0xd85f('0x3d')){var _0x2758bf={};_0x2758bf[_0x45ce2c['name']]={'$like':'%'+_0x248325['query'][_0xd85f('0x3a')]+'%'};return _0x2758bf;}})});}_0x2dc7f9=_[_0xd85f('0x3b')]({},_0x2dc7f9,_0x248325[_0xd85f('0x3e')]);var _0x27541f={'where':_0x2dc7f9[_0xd85f('0x38')]};return db[_0xd85f('0x2c')][_0xd85f('0x1f')](_0x27541f)[_0xd85f('0x26')](function(_0x1a2e94){_0x2fdb09[_0xd85f('0x1f')]=_0x1a2e94;if(_0x248325[_0xd85f('0x31')][_0xd85f('0x3f')]){_0x2dc7f9[_0xd85f('0x40')]=[{'all':!![]}];}return db[_0xd85f('0x2c')][_0xd85f('0x41')](_0x2dc7f9);})[_0xd85f('0x26')](function(_0x3eb2d9){_0x2fdb09['rows']=_0x3eb2d9;return _0x2fdb09;})[_0xd85f('0x26')](respondWithFilteredResult(_0x265e1a,_0x2dc7f9))[_0xd85f('0x42')](handleError(_0x265e1a,null));};exports[_0xd85f('0x43')]=function(_0x290a56,_0x16f318){var _0xddbc4d={'raw':![],'where':{'id':_0x290a56[_0xd85f('0x44')]['id']}},_0x138dd5={};_0x138dd5[_0xd85f('0x2f')]=_['keys'](db['Automation'][_0xd85f('0x2d')]);_0x138dd5[_0xd85f('0x31')]=_[_0xd85f('0x45')](_0x290a56[_0xd85f('0x31')]);_0x138dd5['filters']=_[_0xd85f('0x34')](_0x138dd5[_0xd85f('0x2f')],_0x138dd5['query']);_0xddbc4d[_0xd85f('0x33')]=_[_0xd85f('0x34')](_0x138dd5[_0xd85f('0x2f')],qs[_0xd85f('0x35')](_0x290a56['query'][_0xd85f('0x35')]));_0xddbc4d['attributes']=_0xddbc4d[_0xd85f('0x33')][_0xd85f('0x36')]?_0xddbc4d[_0xd85f('0x33')]:_0x138dd5['model'];if(_0x290a56['query'][_0xd85f('0x3f')]){_0xddbc4d['include']=[{'all':!![]}];}_0xddbc4d=_[_0xd85f('0x3b')]({},_0xddbc4d,_0x290a56['options']);return db[_0xd85f('0x2c')][_0xd85f('0x46')](_0xddbc4d)[_0xd85f('0x26')](handleEntityNotFound(_0x16f318,null))[_0xd85f('0x26')](respondWithResult(_0x16f318,null))[_0xd85f('0x42')](handleError(_0x16f318,null));};exports['create']=function(_0x5d6192,_0x5cc415){return db[_0xd85f('0x2c')][_0xd85f('0x47')](_0x5d6192[_0xd85f('0x48')],{})[_0xd85f('0x26')](respondWithResult(_0x5cc415,0xc9))[_0xd85f('0x42')](handleError(_0x5cc415,null));};exports[_0xd85f('0x25')]=function(_0x4d4377,_0x5d169b){if(_0x4d4377[_0xd85f('0x48')]['id']){delete _0x4d4377['body']['id'];}return db[_0xd85f('0x2c')][_0xd85f('0x46')]({'where':{'id':_0x4d4377[_0xd85f('0x44')]['id']}})['then'](handleEntityNotFound(_0x5d169b,null))[_0xd85f('0x26')](saveUpdates(_0x4d4377[_0xd85f('0x48')],null))[_0xd85f('0x26')](respondWithResult(_0x5d169b,null))[_0xd85f('0x42')](handleError(_0x5d169b,null));};exports['destroy']=function(_0x204145,_0x5b8b9e){return db[_0xd85f('0x2c')][_0xd85f('0x46')]({'where':{'id':_0x204145['params']['id']}})[_0xd85f('0x26')](handleEntityNotFound(_0x5b8b9e,null))['then'](removeEntity(_0x5b8b9e,null))[_0xd85f('0x42')](handleError(_0x5b8b9e,null));};exports['addConditions']=function(_0x1566d4,_0x570fdf,_0x113630){return db[_0xd85f('0x49')][_0xd85f('0x46')]({'where':{'id':_0x1566d4[_0xd85f('0x44')]['id']}})[_0xd85f('0x26')](handleEntityNotFound(_0x570fdf,null))['then'](function(_0x1ba1b2){if(_0x1ba1b2){return _0x1ba1b2['addConditions'](_0x1566d4['body'][_0xd85f('0x4a')],_['omit'](_0x1566d4[_0xd85f('0x48')],[_0xd85f('0x4a'),'id'])||{});}})[_0xd85f('0x26')](respondWithResult(_0x570fdf,null))['catch'](handleError(_0x570fdf,null));};exports[_0xd85f('0x4b')]=function(_0x50b4fd,_0x2980f3,_0x510534){var _0x497130={};var _0x4a45ab={};var _0x2f6979;var _0x33ac70;return db[_0xd85f('0x2c')][_0xd85f('0x4c')]({'where':{'id':_0x50b4fd['params']['id']}})[_0xd85f('0x26')](handleEntityNotFound(_0x2980f3,null))[_0xd85f('0x26')](function(_0x1a8eb5){if(_0x1a8eb5){_0x2f6979=_0x1a8eb5;_0x4a45ab[_0xd85f('0x2f')]=_['keys'](db[_0xd85f('0x49')][_0xd85f('0x2d')]);_0x4a45ab[_0xd85f('0x31')]=_[_0xd85f('0x45')](_0x50b4fd['query']);_0x4a45ab[_0xd85f('0x32')]=_[_0xd85f('0x34')](_0x4a45ab[_0xd85f('0x2f')],_0x4a45ab['query']);_0x497130['attributes']=_[_0xd85f('0x34')](_0x4a45ab['model'],qs['fields'](_0x50b4fd[_0xd85f('0x31')][_0xd85f('0x35')]));_0x497130[_0xd85f('0x33')]=_0x497130['attributes'][_0xd85f('0x36')]?_0x497130[_0xd85f('0x33')]:_0x4a45ab[_0xd85f('0x2f')];_0x497130['order']=qs['sort'](_0x50b4fd[_0xd85f('0x31')]['sort']);_0x497130[_0xd85f('0x38')]=qs['filters'](_[_0xd85f('0x39')](_0x50b4fd[_0xd85f('0x31')],_0x4a45ab[_0xd85f('0x32')]));if(_0x50b4fd[_0xd85f('0x31')][_0xd85f('0x3a')]){_0x497130[_0xd85f('0x38')]=_[_0xd85f('0x3b')](_0x497130[_0xd85f('0x38')],{'$or':_[_0xd85f('0x30')](_0x497130[_0xd85f('0x33')],function(_0x51b148){var _0x39794a={};_0x39794a[_0x51b148]={'$like':'%'+_0x50b4fd[_0xd85f('0x31')][_0xd85f('0x3a')]+'%'};return _0x39794a;})});}_0x497130=_['merge']({},_0x497130,_0x50b4fd[_0xd85f('0x3e')]);return _0x2f6979['getConditions'](_0x497130);}})['then'](function(_0x5c0bc8){if(_0x5c0bc8){_0x33ac70=_0x5c0bc8[_0xd85f('0x36')];if(!_0x50b4fd[_0xd85f('0x31')][_0xd85f('0x4d')](_0xd85f('0x4e'))){_0x497130[_0xd85f('0x1d')]=qs[_0xd85f('0x1d')](_0x50b4fd[_0xd85f('0x31')][_0xd85f('0x1d')]);_0x497130[_0xd85f('0x20')]=qs[_0xd85f('0x20')](_0x50b4fd[_0xd85f('0x31')][_0xd85f('0x20')]);}return _0x2f6979[_0xd85f('0x4b')](_0x497130);}})[_0xd85f('0x26')](function(_0x5154c7){if(_0x5154c7){return _0x5154c7?{'count':_0x33ac70,'rows':_0x5154c7}:null;}})[_0xd85f('0x26')](respondWithResult(_0x2980f3,null))[_0xd85f('0x42')](handleError(_0x2980f3,null));};exports[_0xd85f('0x4f')]=function(_0x386189,_0x167525,_0x201dee){return db[_0xd85f('0x50')][_0xd85f('0x46')]({'where':{'id':_0x386189[_0xd85f('0x44')]['id']}})['then'](handleEntityNotFound(_0x167525,null))['then'](function(_0x3ea58b){if(_0x3ea58b){return _0x3ea58b[_0xd85f('0x4f')](_0x386189[_0xd85f('0x48')][_0xd85f('0x4a')],_[_0xd85f('0x51')](_0x386189[_0xd85f('0x48')],['ids','id'])||{});}})[_0xd85f('0x26')](respondWithResult(_0x167525,null))[_0xd85f('0x42')](handleError(_0x167525,null));};exports['getActions']=function(_0x5750c0,_0x54c710,_0x43fd98){var _0x45c379={};var _0x2459c6={};var _0xb8dcef;var _0x2ab76d;return db[_0xd85f('0x2c')][_0xd85f('0x4c')]({'where':{'id':_0x5750c0[_0xd85f('0x44')]['id']}})[_0xd85f('0x26')](handleEntityNotFound(_0x54c710,null))[_0xd85f('0x26')](function(_0x47f8e1){if(_0x47f8e1){_0xb8dcef=_0x47f8e1;_0x2459c6[_0xd85f('0x2f')]=_['keys'](db[_0xd85f('0x50')][_0xd85f('0x2d')]);_0x2459c6[_0xd85f('0x31')]=_[_0xd85f('0x45')](_0x5750c0[_0xd85f('0x31')]);_0x2459c6[_0xd85f('0x32')]=_['intersection'](_0x2459c6[_0xd85f('0x2f')],_0x2459c6[_0xd85f('0x31')]);_0x45c379['attributes']=_[_0xd85f('0x34')](_0x2459c6[_0xd85f('0x2f')],qs[_0xd85f('0x35')](_0x5750c0['query'][_0xd85f('0x35')]));_0x45c379[_0xd85f('0x33')]=_0x45c379[_0xd85f('0x33')][_0xd85f('0x36')]?_0x45c379[_0xd85f('0x33')]:_0x2459c6[_0xd85f('0x2f')];_0x45c379[_0xd85f('0x52')]=qs[_0xd85f('0x37')](_0x5750c0[_0xd85f('0x31')][_0xd85f('0x37')]);_0x45c379[_0xd85f('0x38')]=qs['filters'](_['pick'](_0x5750c0[_0xd85f('0x31')],_0x2459c6[_0xd85f('0x32')]));if(_0x5750c0[_0xd85f('0x31')][_0xd85f('0x3a')]){_0x45c379['where']=_[_0xd85f('0x3b')](_0x45c379[_0xd85f('0x38')],{'$or':_['map'](_0x45c379[_0xd85f('0x33')],function(_0x589e82){var _0x35d6d0={};_0x35d6d0[_0x589e82]={'$like':'%'+_0x5750c0['query'][_0xd85f('0x3a')]+'%'};return _0x35d6d0;})});}_0x45c379=_[_0xd85f('0x3b')]({},_0x45c379,_0x5750c0[_0xd85f('0x3e')]);return _0xb8dcef['getActions'](_0x45c379);}})[_0xd85f('0x26')](function(_0x21c420){if(_0x21c420){_0x2ab76d=_0x21c420[_0xd85f('0x36')];if(!_0x5750c0[_0xd85f('0x31')][_0xd85f('0x4d')](_0xd85f('0x4e'))){_0x45c379[_0xd85f('0x1d')]=qs[_0xd85f('0x1d')](_0x5750c0[_0xd85f('0x31')][_0xd85f('0x1d')]);_0x45c379['offset']=qs[_0xd85f('0x20')](_0x5750c0[_0xd85f('0x31')][_0xd85f('0x20')]);}return _0xb8dcef[_0xd85f('0x53')](_0x45c379);}})[_0xd85f('0x26')](function(_0x393799){if(_0x393799){return _0x393799?{'count':_0x2ab76d,'rows':_0x393799}:null;}})['then'](respondWithResult(_0x54c710,null))['catch'](handleError(_0x54c710,null));}; \ No newline at end of file +var _0xd1e5=['eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','then','destroy','error','stack','name','index','map','Automation','fieldName','type','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','findAll','params','rawAttributes','fields','includeAll','include','options','find','create','body','catch','addConditions','Condition','ids','omit','findOne','getConditions','addActions','getActions'];(function(_0x2468b5,_0x506b9e){var _0x1056e4=function(_0x26da1c){while(--_0x26da1c){_0x2468b5['push'](_0x2468b5['shift']());}};_0x1056e4(++_0x506b9e);}(_0xd1e5,0x19a));var _0x5d1e=function(_0x54b99b,_0x123cf9){_0x54b99b=_0x54b99b-0x0;var _0xa94ced=_0xd1e5[_0x54b99b];return _0xa94ced;};'use strict';var emlformat=require(_0x5d1e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5d1e('0x1'));var jsonpatch=require(_0x5d1e('0x2'));var rp=require(_0x5d1e('0x3'));var moment=require(_0x5d1e('0x4'));var BPromise=require(_0x5d1e('0x5'));var Mustache=require(_0x5d1e('0x6'));var util=require(_0x5d1e('0x7'));var path=require(_0x5d1e('0x8'));var sox=require(_0x5d1e('0x9'));var csv=require(_0x5d1e('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5d1e('0xb'));var squel=require(_0x5d1e('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x5d1e('0xd'));var toCsv=require(_0x5d1e('0xa'));var querystring=require(_0x5d1e('0xe'));var Papa=require(_0x5d1e('0xf'));var Redis=require(_0x5d1e('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x5d1e('0x11'));var as=require(_0x5d1e('0x12'));var hardwareService=require(_0x5d1e('0x13'));var logger=require(_0x5d1e('0x14'))(_0x5d1e('0x15'));var utils=require(_0x5d1e('0x16'));var config=require(_0x5d1e('0x17'));var licenseUtil=require(_0x5d1e('0x18'));var db=require(_0x5d1e('0x19'))['db'];function respondWithStatusCode(_0x5e4511,_0x4bcdb0){_0x4bcdb0=_0x4bcdb0||0xcc;return function(_0x2e86ff){if(_0x2e86ff){return _0x5e4511[_0x5d1e('0x1a')](_0x4bcdb0);}return _0x5e4511[_0x5d1e('0x1b')](_0x4bcdb0)[_0x5d1e('0x1c')]();};}function respondWithResult(_0x38eca9,_0x47b50a){_0x47b50a=_0x47b50a||0xc8;return function(_0x8278bf){if(_0x8278bf){return _0x38eca9[_0x5d1e('0x1b')](_0x47b50a)[_0x5d1e('0x1d')](_0x8278bf);}};}function respondWithFilteredResult(_0x565ed3,_0x273eec){return function(_0x23c10d){if(_0x23c10d){var _0x35b1aa=typeof _0x273eec[_0x5d1e('0x1e')]===_0x5d1e('0x1f')&&typeof _0x273eec[_0x5d1e('0x20')]===_0x5d1e('0x1f');var _0x17ba2e=_0x23c10d[_0x5d1e('0x21')];var _0x17e05b=_0x35b1aa?0x0:_0x273eec['offset'];var _0x100238=_0x35b1aa?_0x23c10d[_0x5d1e('0x21')]:_0x273eec[_0x5d1e('0x1e')]+_0x273eec[_0x5d1e('0x20')];var _0x1f1607;if(_0x100238>=_0x17ba2e){_0x100238=_0x17ba2e;_0x1f1607=0xc8;}else{_0x1f1607=0xce;}_0x565ed3[_0x5d1e('0x1b')](_0x1f1607);return _0x565ed3['set'](_0x5d1e('0x22'),_0x17e05b+'-'+_0x100238+'/'+_0x17ba2e)[_0x5d1e('0x1d')](_0x23c10d);}return null;};}function patchUpdates(_0x25943e){return function(_0xe92bd7){try{jsonpatch[_0x5d1e('0x23')](_0xe92bd7,_0x25943e,!![]);}catch(_0x5a49f3){return BPromise[_0x5d1e('0x24')](_0x5a49f3);}return _0xe92bd7[_0x5d1e('0x25')]();};}function saveUpdates(_0x363e7a,_0x2e2074){return function(_0x347e38){if(_0x347e38){return _0x347e38['update'](_0x363e7a)[_0x5d1e('0x26')](function(_0x2d1d5c){return _0x2d1d5c;});}return null;};}function removeEntity(_0x9a03c1,_0x47cd6d){return function(_0x12dc8){if(_0x12dc8){return _0x12dc8[_0x5d1e('0x27')]()[_0x5d1e('0x26')](function(){_0x9a03c1[_0x5d1e('0x1b')](0xcc)[_0x5d1e('0x1c')]();});}};}function handleEntityNotFound(_0x4e7b0f,_0xd2b3b4){return function(_0x4a7ad9){if(!_0x4a7ad9){_0x4e7b0f['sendStatus'](0x194);}return _0x4a7ad9;};}function handleError(_0xc74da0,_0x12e325){_0x12e325=_0x12e325||0x1f4;return function(_0x3eeeae){logger[_0x5d1e('0x28')](_0x3eeeae[_0x5d1e('0x29')]);if(_0x3eeeae[_0x5d1e('0x2a')]){delete _0x3eeeae[_0x5d1e('0x2a')];}_0xc74da0[_0x5d1e('0x1b')](_0x12e325)['send'](_0x3eeeae);};}exports[_0x5d1e('0x2b')]=function(_0x3c21d8,_0x473c5f){var _0x5962fa={},_0x2bc8b9={},_0x546061={'count':0x0,'rows':[]};var _0x19af0c=_[_0x5d1e('0x2c')](db[_0x5d1e('0x2d')]['rawAttributes'],function(_0x36a207){return{'name':_0x36a207[_0x5d1e('0x2e')],'type':_0x36a207[_0x5d1e('0x2f')]['key']};});_0x2bc8b9[_0x5d1e('0x30')]=_[_0x5d1e('0x2c')](_0x19af0c,_0x5d1e('0x2a'));_0x2bc8b9[_0x5d1e('0x31')]=_[_0x5d1e('0x32')](_0x3c21d8[_0x5d1e('0x31')]);_0x2bc8b9[_0x5d1e('0x33')]=_[_0x5d1e('0x34')](_0x2bc8b9[_0x5d1e('0x30')],_0x2bc8b9[_0x5d1e('0x31')]);_0x5962fa[_0x5d1e('0x35')]=_['intersection'](_0x2bc8b9[_0x5d1e('0x30')],qs['fields'](_0x3c21d8[_0x5d1e('0x31')]['fields']));_0x5962fa[_0x5d1e('0x35')]=_0x5962fa['attributes'][_0x5d1e('0x36')]?_0x5962fa['attributes']:_0x2bc8b9['model'];if(!_0x3c21d8[_0x5d1e('0x31')][_0x5d1e('0x37')](_0x5d1e('0x38'))){_0x5962fa[_0x5d1e('0x20')]=qs[_0x5d1e('0x20')](_0x3c21d8[_0x5d1e('0x31')][_0x5d1e('0x20')]);_0x5962fa[_0x5d1e('0x1e')]=qs[_0x5d1e('0x1e')](_0x3c21d8[_0x5d1e('0x31')][_0x5d1e('0x1e')]);}_0x5962fa[_0x5d1e('0x39')]=qs[_0x5d1e('0x3a')](_0x3c21d8['query'][_0x5d1e('0x3a')]);_0x5962fa[_0x5d1e('0x3b')]=qs[_0x5d1e('0x33')](_[_0x5d1e('0x3c')](_0x3c21d8[_0x5d1e('0x31')],_0x2bc8b9[_0x5d1e('0x33')]),_0x19af0c);if(_0x3c21d8[_0x5d1e('0x31')][_0x5d1e('0x3d')]){_0x5962fa[_0x5d1e('0x3b')]=_[_0x5d1e('0x3e')](_0x5962fa['where'],{'$or':_[_0x5d1e('0x2c')](_0x19af0c,function(_0x158448){if(_0x158448[_0x5d1e('0x2f')]!=='VIRTUAL'){var _0x49abc2={};_0x49abc2[_0x158448[_0x5d1e('0x2a')]]={'$like':'%'+_0x3c21d8['query'][_0x5d1e('0x3d')]+'%'};return _0x49abc2;}})});}_0x5962fa=_[_0x5d1e('0x3e')]({},_0x5962fa,_0x3c21d8['options']);var _0x315615={'where':_0x5962fa['where']};return db[_0x5d1e('0x2d')][_0x5d1e('0x21')](_0x315615)[_0x5d1e('0x26')](function(_0x470338){_0x546061[_0x5d1e('0x21')]=_0x470338;if(_0x3c21d8['query']['includeAll']){_0x5962fa['include']=[{'all':!![]}];}return db[_0x5d1e('0x2d')][_0x5d1e('0x3f')](_0x5962fa);})[_0x5d1e('0x26')](function(_0x3a303f){_0x546061['rows']=_0x3a303f;return _0x546061;})[_0x5d1e('0x26')](respondWithFilteredResult(_0x473c5f,_0x5962fa))['catch'](handleError(_0x473c5f,null));};exports['show']=function(_0x2af9d6,_0xbd417b){var _0x1ca5de={'raw':![],'where':{'id':_0x2af9d6[_0x5d1e('0x40')]['id']}},_0x65afc8={};_0x65afc8[_0x5d1e('0x30')]=_[_0x5d1e('0x32')](db[_0x5d1e('0x2d')][_0x5d1e('0x41')]);_0x65afc8[_0x5d1e('0x31')]=_['keys'](_0x2af9d6['query']);_0x65afc8[_0x5d1e('0x33')]=_['intersection'](_0x65afc8[_0x5d1e('0x30')],_0x65afc8[_0x5d1e('0x31')]);_0x1ca5de[_0x5d1e('0x35')]=_[_0x5d1e('0x34')](_0x65afc8[_0x5d1e('0x30')],qs[_0x5d1e('0x42')](_0x2af9d6[_0x5d1e('0x31')][_0x5d1e('0x42')]));_0x1ca5de[_0x5d1e('0x35')]=_0x1ca5de[_0x5d1e('0x35')][_0x5d1e('0x36')]?_0x1ca5de['attributes']:_0x65afc8[_0x5d1e('0x30')];if(_0x2af9d6[_0x5d1e('0x31')][_0x5d1e('0x43')]){_0x1ca5de[_0x5d1e('0x44')]=[{'all':!![]}];}_0x1ca5de=_['merge']({},_0x1ca5de,_0x2af9d6[_0x5d1e('0x45')]);return db['Automation'][_0x5d1e('0x46')](_0x1ca5de)['then'](handleEntityNotFound(_0xbd417b,null))['then'](respondWithResult(_0xbd417b,null))['catch'](handleError(_0xbd417b,null));};exports[_0x5d1e('0x47')]=function(_0xbb0104,_0x2baa44){return db[_0x5d1e('0x2d')][_0x5d1e('0x47')](_0xbb0104[_0x5d1e('0x48')],{})['then'](respondWithResult(_0x2baa44,0xc9))['catch'](handleError(_0x2baa44,null));};exports['update']=function(_0x1caa33,_0x32e68b){if(_0x1caa33[_0x5d1e('0x48')]['id']){delete _0x1caa33[_0x5d1e('0x48')]['id'];}return db[_0x5d1e('0x2d')][_0x5d1e('0x46')]({'where':{'id':_0x1caa33['params']['id']}})[_0x5d1e('0x26')](handleEntityNotFound(_0x32e68b,null))[_0x5d1e('0x26')](saveUpdates(_0x1caa33[_0x5d1e('0x48')],null))[_0x5d1e('0x26')](respondWithResult(_0x32e68b,null))[_0x5d1e('0x49')](handleError(_0x32e68b,null));};exports[_0x5d1e('0x27')]=function(_0x57918f,_0x1db99a){return db['Automation']['find']({'where':{'id':_0x57918f[_0x5d1e('0x40')]['id']}})['then'](handleEntityNotFound(_0x1db99a,null))[_0x5d1e('0x26')](removeEntity(_0x1db99a,null))[_0x5d1e('0x49')](handleError(_0x1db99a,null));};exports[_0x5d1e('0x4a')]=function(_0x13e2ae,_0x22b7a2,_0x43fdd6){return db[_0x5d1e('0x4b')][_0x5d1e('0x46')]({'where':{'id':_0x13e2ae[_0x5d1e('0x40')]['id']}})[_0x5d1e('0x26')](handleEntityNotFound(_0x22b7a2,null))[_0x5d1e('0x26')](function(_0x2e9c3a){if(_0x2e9c3a){return _0x2e9c3a[_0x5d1e('0x4a')](_0x13e2ae[_0x5d1e('0x48')][_0x5d1e('0x4c')],_[_0x5d1e('0x4d')](_0x13e2ae[_0x5d1e('0x48')],[_0x5d1e('0x4c'),'id'])||{});}})['then'](respondWithResult(_0x22b7a2,null))[_0x5d1e('0x49')](handleError(_0x22b7a2,null));};exports['getConditions']=function(_0x27b4a0,_0x40f259,_0x525aec){var _0x220c4a={};var _0x3f40a7={};var _0xb9d493;var _0xee3e6b;return db[_0x5d1e('0x2d')][_0x5d1e('0x4e')]({'where':{'id':_0x27b4a0[_0x5d1e('0x40')]['id']}})[_0x5d1e('0x26')](handleEntityNotFound(_0x40f259,null))[_0x5d1e('0x26')](function(_0x47003d){if(_0x47003d){_0xb9d493=_0x47003d;_0x3f40a7[_0x5d1e('0x30')]=_[_0x5d1e('0x32')](db[_0x5d1e('0x4b')][_0x5d1e('0x41')]);_0x3f40a7['query']=_[_0x5d1e('0x32')](_0x27b4a0[_0x5d1e('0x31')]);_0x3f40a7[_0x5d1e('0x33')]=_[_0x5d1e('0x34')](_0x3f40a7[_0x5d1e('0x30')],_0x3f40a7[_0x5d1e('0x31')]);_0x220c4a[_0x5d1e('0x35')]=_['intersection'](_0x3f40a7[_0x5d1e('0x30')],qs['fields'](_0x27b4a0['query']['fields']));_0x220c4a[_0x5d1e('0x35')]=_0x220c4a[_0x5d1e('0x35')][_0x5d1e('0x36')]?_0x220c4a[_0x5d1e('0x35')]:_0x3f40a7['model'];_0x220c4a[_0x5d1e('0x39')]=qs[_0x5d1e('0x3a')](_0x27b4a0[_0x5d1e('0x31')]['sort']);_0x220c4a[_0x5d1e('0x3b')]=qs[_0x5d1e('0x33')](_[_0x5d1e('0x3c')](_0x27b4a0[_0x5d1e('0x31')],_0x3f40a7[_0x5d1e('0x33')]));if(_0x27b4a0[_0x5d1e('0x31')][_0x5d1e('0x3d')]){_0x220c4a[_0x5d1e('0x3b')]=_[_0x5d1e('0x3e')](_0x220c4a[_0x5d1e('0x3b')],{'$or':_[_0x5d1e('0x2c')](_0x220c4a[_0x5d1e('0x35')],function(_0x4aabba){var _0x12b76d={};_0x12b76d[_0x4aabba]={'$like':'%'+_0x27b4a0[_0x5d1e('0x31')][_0x5d1e('0x3d')]+'%'};return _0x12b76d;})});}_0x220c4a=_['merge']({},_0x220c4a,_0x27b4a0[_0x5d1e('0x45')]);return _0xb9d493[_0x5d1e('0x4f')](_0x220c4a);}})[_0x5d1e('0x26')](function(_0x19a666){if(_0x19a666){_0xee3e6b=_0x19a666['length'];if(!_0x27b4a0[_0x5d1e('0x31')][_0x5d1e('0x37')]('nolimit')){_0x220c4a[_0x5d1e('0x20')]=qs[_0x5d1e('0x20')](_0x27b4a0[_0x5d1e('0x31')][_0x5d1e('0x20')]);_0x220c4a['offset']=qs[_0x5d1e('0x1e')](_0x27b4a0['query'][_0x5d1e('0x1e')]);}return _0xb9d493['getConditions'](_0x220c4a);}})[_0x5d1e('0x26')](function(_0x47ec9a){if(_0x47ec9a){return _0x47ec9a?{'count':_0xee3e6b,'rows':_0x47ec9a}:null;}})[_0x5d1e('0x26')](respondWithResult(_0x40f259,null))[_0x5d1e('0x49')](handleError(_0x40f259,null));};exports[_0x5d1e('0x50')]=function(_0x4d9a15,_0x91abe6,_0x4b81a4){return db['Action']['find']({'where':{'id':_0x4d9a15[_0x5d1e('0x40')]['id']}})['then'](handleEntityNotFound(_0x91abe6,null))[_0x5d1e('0x26')](function(_0x1875fc){if(_0x1875fc){return _0x1875fc[_0x5d1e('0x50')](_0x4d9a15['body'][_0x5d1e('0x4c')],_[_0x5d1e('0x4d')](_0x4d9a15[_0x5d1e('0x48')],[_0x5d1e('0x4c'),'id'])||{});}})[_0x5d1e('0x26')](respondWithResult(_0x91abe6,null))[_0x5d1e('0x49')](handleError(_0x91abe6,null));};exports[_0x5d1e('0x51')]=function(_0xdd3a60,_0x1b6070,_0x44bf9f){var _0x5ef965={};var _0x335949={};var _0x4ff726;var _0x3acede;return db[_0x5d1e('0x2d')][_0x5d1e('0x4e')]({'where':{'id':_0xdd3a60[_0x5d1e('0x40')]['id']}})[_0x5d1e('0x26')](handleEntityNotFound(_0x1b6070,null))[_0x5d1e('0x26')](function(_0x389b59){if(_0x389b59){_0x4ff726=_0x389b59;_0x335949['model']=_[_0x5d1e('0x32')](db['Action'][_0x5d1e('0x41')]);_0x335949[_0x5d1e('0x31')]=_[_0x5d1e('0x32')](_0xdd3a60[_0x5d1e('0x31')]);_0x335949['filters']=_['intersection'](_0x335949['model'],_0x335949['query']);_0x5ef965['attributes']=_['intersection'](_0x335949[_0x5d1e('0x30')],qs[_0x5d1e('0x42')](_0xdd3a60[_0x5d1e('0x31')]['fields']));_0x5ef965[_0x5d1e('0x35')]=_0x5ef965['attributes']['length']?_0x5ef965[_0x5d1e('0x35')]:_0x335949[_0x5d1e('0x30')];_0x5ef965[_0x5d1e('0x39')]=qs['sort'](_0xdd3a60[_0x5d1e('0x31')][_0x5d1e('0x3a')]);_0x5ef965[_0x5d1e('0x3b')]=qs[_0x5d1e('0x33')](_[_0x5d1e('0x3c')](_0xdd3a60[_0x5d1e('0x31')],_0x335949[_0x5d1e('0x33')]));if(_0xdd3a60[_0x5d1e('0x31')][_0x5d1e('0x3d')]){_0x5ef965[_0x5d1e('0x3b')]=_[_0x5d1e('0x3e')](_0x5ef965[_0x5d1e('0x3b')],{'$or':_[_0x5d1e('0x2c')](_0x5ef965['attributes'],function(_0x157262){var _0x4c2ddb={};_0x4c2ddb[_0x157262]={'$like':'%'+_0xdd3a60[_0x5d1e('0x31')][_0x5d1e('0x3d')]+'%'};return _0x4c2ddb;})});}_0x5ef965=_[_0x5d1e('0x3e')]({},_0x5ef965,_0xdd3a60[_0x5d1e('0x45')]);return _0x4ff726[_0x5d1e('0x51')](_0x5ef965);}})[_0x5d1e('0x26')](function(_0x398e1a){if(_0x398e1a){_0x3acede=_0x398e1a['length'];if(!_0xdd3a60['query']['hasOwnProperty'](_0x5d1e('0x38'))){_0x5ef965[_0x5d1e('0x20')]=qs[_0x5d1e('0x20')](_0xdd3a60['query']['limit']);_0x5ef965[_0x5d1e('0x1e')]=qs[_0x5d1e('0x1e')](_0xdd3a60['query'][_0x5d1e('0x1e')]);}return _0x4ff726[_0x5d1e('0x51')](_0x5ef965);}})[_0x5d1e('0x26')](function(_0x3997ba){if(_0x3997ba){return _0x3997ba?{'count':_0x3acede,'rows':_0x3997ba}:null;}})['then'](respondWithResult(_0x1b6070,null))['catch'](handleError(_0x1b6070,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index a5f1ddc..2262b16 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 _0x042f=['exports','define','Automation','tools_automations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x042f,0xdc));var _0xf042=function(_0x4fbfd9,_0x3ab91a){_0x4fbfd9=_0x4fbfd9-0x0;var _0x31dc94=_0x042f[_0x4fbfd9];return _0x31dc94;};'use strict';var _=require(_0xf042('0x0'));var util=require(_0xf042('0x1'));var logger=require(_0xf042('0x2'))(_0xf042('0x3'));var moment=require(_0xf042('0x4'));var BPromise=require(_0xf042('0x5'));var rp=require(_0xf042('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf042('0x7'));var config=require('../../config/environment');var attributes=require('./automation.attributes');module[_0xf042('0x8')]=function(_0x2d7519,_0x4d01e6){return _0x2d7519[_0xf042('0x9')](_0xf042('0xa'),attributes,{'tableName':_0xf042('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf2c8=['util','../../config/logger','api','moment','request-promise','path','rimraf','exports','define','Automation','tools_automations'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf2c8,0xdc));var _0x8f2c=function(_0x97f926,_0x5399ab){_0x97f926=_0x97f926-0x0;var _0x49d60f=_0xf2c8[_0x97f926];return _0x49d60f;};'use strict';var _=require('lodash');var util=require(_0x8f2c('0x0'));var logger=require(_0x8f2c('0x1'))(_0x8f2c('0x2'));var moment=require(_0x8f2c('0x3'));var BPromise=require('bluebird');var rp=require(_0x8f2c('0x4'));var fs=require('fs');var path=require(_0x8f2c('0x5'));var rimraf=require(_0x8f2c('0x6'));var config=require('../../config/environment');var attributes=require('./automation.attributes');module[_0x8f2c('0x7')]=function(_0x5ac861,_0x5e5888){return _0x5ac861[_0x8f2c('0x8')](_0x8f2c('0x9'),attributes,{'tableName':_0x8f2c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/automation/automation.rpc.js b/server/api/automation/automation.rpc.js index 94381dc..6e1d57e 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 _0xb10d=['debug','Automation,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','Automation,\x20%s,\x20%s','request\x20sent'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xb10d,0x17f));var _0xdb10=function(_0x55f826,_0x22028c){_0x55f826=_0x55f826-0x0;var _0x4b9435=_0xb10d[_0x55f826];return _0x4b9435;};'use strict';var _=require(_0xdb10('0x0'));var util=require('util');var moment=require(_0xdb10('0x1'));var BPromise=require(_0xdb10('0x2'));var rs=require(_0xdb10('0x3'));var fs=require('fs');var Redis=require(_0xdb10('0x4'));var db=require(_0xdb10('0x5'))['db'];var utils=require(_0xdb10('0x6'));var logger=require(_0xdb10('0x7'))(_0xdb10('0x8'));var config=require(_0xdb10('0x9'));var jayson=require(_0xdb10('0xa'));var client=jayson[_0xdb10('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x431feb,_0x1faed7,_0x13a590){return new BPromise(function(_0x2e43df,_0x3d59e3){return client[_0xdb10('0xc')](_0x431feb,_0x13a590)[_0xdb10('0xd')](function(_0x1cad13){logger[_0xdb10('0xe')](_0xdb10('0xf'),_0x1faed7,_0xdb10('0x10'));logger[_0xdb10('0x11')](_0xdb10('0x12'),_0x1faed7,_0xdb10('0x10'),JSON[_0xdb10('0x13')](_0x1cad13));if(_0x1cad13[_0xdb10('0x14')]){if(_0x1cad13[_0xdb10('0x14')][_0xdb10('0x15')]===0x1f4){logger[_0xdb10('0x14')](_0xdb10('0xf'),_0x1faed7,_0x1cad13[_0xdb10('0x14')][_0xdb10('0x16')]);return _0x3d59e3(_0x1cad13[_0xdb10('0x14')][_0xdb10('0x16')]);}logger['error'](_0xdb10('0xf'),_0x1faed7,_0x1cad13[_0xdb10('0x14')][_0xdb10('0x16')]);return _0x2e43df(_0x1cad13[_0xdb10('0x14')][_0xdb10('0x16')]);}else{logger[_0xdb10('0xe')]('Automation,\x20%s,\x20%s',_0x1faed7,_0xdb10('0x10'));_0x2e43df(_0x1cad13[_0xdb10('0x17')][_0xdb10('0x16')]);}})[_0xdb10('0x18')](function(_0xbce3f1){logger['error'](_0xdb10('0xf'),_0x1faed7,_0xbce3f1);_0x3d59e3(_0xbce3f1);});});} \ No newline at end of file +var _0xe0dd=['../../config/utils','../../config/logger','jayson/promise','client','then','info','Automation,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x5f09c5,_0x2bfca0){var _0x426ad9=function(_0x18fe5f){while(--_0x18fe5f){_0x5f09c5['push'](_0x5f09c5['shift']());}};_0x426ad9(++_0x2bfca0);}(_0xe0dd,0x163));var _0xde0d=function(_0x6cf19c,_0x2f3f02){_0x6cf19c=_0x6cf19c-0x0;var _0xce14f3=_0xe0dd[_0x6cf19c];return _0xce14f3;};'use strict';var _=require(_0xde0d('0x0'));var util=require(_0xde0d('0x1'));var moment=require('moment');var BPromise=require(_0xde0d('0x2'));var rs=require(_0xde0d('0x3'));var fs=require('fs');var Redis=require(_0xde0d('0x4'));var db=require(_0xde0d('0x5'))['db'];var utils=require(_0xde0d('0x6'));var logger=require(_0xde0d('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xde0d('0x8'));var client=jayson[_0xde0d('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x323200,_0x3ce23c,_0x33a644){return new BPromise(function(_0x570b78,_0x25f0fe){return client['request'](_0x323200,_0x33a644)[_0xde0d('0xa')](function(_0x5e6588){logger[_0xde0d('0xb')](_0xde0d('0xc'),_0x3ce23c,_0xde0d('0xd'));logger['debug']('Automation,\x20%s,\x20%s,\x20%s',_0x3ce23c,'request\x20sent',JSON[_0xde0d('0xe')](_0x5e6588));if(_0x5e6588[_0xde0d('0xf')]){if(_0x5e6588[_0xde0d('0xf')]['code']===0x1f4){logger[_0xde0d('0xf')](_0xde0d('0xc'),_0x3ce23c,_0x5e6588['error'][_0xde0d('0x10')]);return _0x25f0fe(_0x5e6588[_0xde0d('0xf')][_0xde0d('0x10')]);}logger[_0xde0d('0xf')](_0xde0d('0xc'),_0x3ce23c,_0x5e6588['error'][_0xde0d('0x10')]);return _0x570b78(_0x5e6588['error'][_0xde0d('0x10')]);}else{logger['info'](_0xde0d('0xc'),_0x3ce23c,'request\x20sent');_0x570b78(_0x5e6588[_0xde0d('0x11')][_0xde0d('0x10')]);}})[_0xde0d('0x12')](function(_0x228666){logger[_0xde0d('0xf')](_0xde0d('0xc'),_0x3ce23c,_0x228666);_0x25f0fe(_0x228666);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index 1f3ee5c..0c15ba8 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 _0x2e35=['destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./automation.controller','get','isAuthenticated','/:id/conditions','/:id/actions','getActions','create','post','addConditions','update','delete','/:id'];(function(_0x3de71b,_0xabb8ad){var _0x1dc0f0=function(_0x14e26e){while(--_0x14e26e){_0x3de71b['push'](_0x3de71b['shift']());}};_0x1dc0f0(++_0xabb8ad);}(_0x2e35,0x1d0));var _0x52e3=function(_0x2e2de8,_0x8d7c2a){_0x2e2de8=_0x2e2de8-0x0;var _0x4b905d=_0x2e35[_0x2e2de8];return _0x4b905d;};'use strict';var multer=require(_0x52e3('0x0'));var util=require(_0x52e3('0x1'));var path=require(_0x52e3('0x2'));var timeout=require('connect-timeout');var express=require(_0x52e3('0x3'));var router=express[_0x52e3('0x4')]();var fs_extra=require(_0x52e3('0x5'));var auth=require(_0x52e3('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x52e3('0x7'));var controller=require(_0x52e3('0x8'));router[_0x52e3('0x9')]('/',auth[_0x52e3('0xa')](),controller['index']);router['get']('/:id',auth[_0x52e3('0xa')](),controller['show']);router['get'](_0x52e3('0xb'),auth[_0x52e3('0xa')](),controller['getConditions']);router[_0x52e3('0x9')](_0x52e3('0xc'),auth['isAuthenticated'](),controller[_0x52e3('0xd')]);router['post']('/',auth[_0x52e3('0xa')](),controller[_0x52e3('0xe')]);router[_0x52e3('0xf')]('/:id/conditions',auth[_0x52e3('0xa')](),controller[_0x52e3('0x10')]);router['post'](_0x52e3('0xc'),auth['isAuthenticated'](),controller['addActions']);router['put']('/:id',auth['isAuthenticated'](),controller[_0x52e3('0x11')]);router[_0x52e3('0x12')](_0x52e3('0x13'),auth[_0x52e3('0xa')](),controller[_0x52e3('0x14')]);module[_0x52e3('0x15')]=router; \ No newline at end of file +var _0xf097=['update','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','./automation.controller','get','isAuthenticated','index','show','/:id/conditions','getConditions','getActions','post','create','addConditions','/:id/actions','addActions','put','/:id'];(function(_0x3f3d64,_0x41016c){var _0x52f4c5=function(_0x363bfb){while(--_0x363bfb){_0x3f3d64['push'](_0x3f3d64['shift']());}};_0x52f4c5(++_0x41016c);}(_0xf097,0x1b2));var _0x7f09=function(_0x2e8322,_0x452d17){_0x2e8322=_0x2e8322-0x0;var _0x12779d=_0xf097[_0x2e8322];return _0x12779d;};'use strict';var multer=require(_0x7f09('0x0'));var util=require(_0x7f09('0x1'));var path=require(_0x7f09('0x2'));var timeout=require(_0x7f09('0x3'));var express=require(_0x7f09('0x4'));var router=express[_0x7f09('0x5')]();var fs_extra=require(_0x7f09('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x7f09('0x7'));router[_0x7f09('0x8')]('/',auth[_0x7f09('0x9')](),controller[_0x7f09('0xa')]);router[_0x7f09('0x8')]('/:id',auth[_0x7f09('0x9')](),controller[_0x7f09('0xb')]);router['get'](_0x7f09('0xc'),auth[_0x7f09('0x9')](),controller[_0x7f09('0xd')]);router[_0x7f09('0x8')]('/:id/actions',auth[_0x7f09('0x9')](),controller[_0x7f09('0xe')]);router[_0x7f09('0xf')]('/',auth[_0x7f09('0x9')](),controller[_0x7f09('0x10')]);router[_0x7f09('0xf')](_0x7f09('0xc'),auth[_0x7f09('0x9')](),controller[_0x7f09('0x11')]);router[_0x7f09('0xf')](_0x7f09('0x12'),auth[_0x7f09('0x9')](),controller[_0x7f09('0x13')]);router[_0x7f09('0x14')](_0x7f09('0x15'),auth['isAuthenticated'](),controller[_0x7f09('0x16')]);router['delete'](_0x7f09('0x15'),auth['isAuthenticated'](),controller[_0x7f09('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index 7e41bf0..f6afbef 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 _0xe58f=['onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Maximum\x20Word\x20Length','ASC','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports','STRING','name','ENUM','ivr','BOOLEAN','Active/Disactive\x20Campaign','UNSIGNED','Max\x20200\x20calls.','INTEGER','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','always','never'];(function(_0x5ae176,_0x5bd0f9){var _0x1ecd16=function(_0x7f308f){while(--_0x7f308f){_0x5ae176['push'](_0x5ae176['shift']());}};_0x1ecd16(++_0x5bd0f9);}(_0xe58f,0x1c5));var _0xfe58=function(_0x5bff62,_0x3c41ee){_0x5bff62=_0x5bff62-0x0;var _0x3ab631=_0xe58f[_0x5bff62];return _0x3ab631;};'use strict';var Sequelize=require(_0xfe58('0x0'));module[_0xfe58('0x1')]={'name':{'type':Sequelize[_0xfe58('0x2')],'unique':_0xfe58('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0xfe58('0x4')](_0xfe58('0x5')),'allowNull':![],'defaultValue':_0xfe58('0x5')},'description':{'type':Sequelize[_0xfe58('0x2')]},'active':{'type':Sequelize[_0xfe58('0x6')],'defaultValue':0x0,'comment':_0xfe58('0x7')},'limitCalls':{'type':Sequelize['INTEGER'](0x4)[_0xfe58('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0xfe58('0x9')},'dialOriginateCallerIdName':{'type':Sequelize[_0xfe58('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xfe58('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0xfe58('0xa')](0x3)[_0xfe58('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xfe58('0xb')},'dialCongestionMaxRetry':{'type':Sequelize[_0xfe58('0xa')](0x3)[_0xfe58('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xfe58('0xc')},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xfe58('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xfe58('0xd')},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xfe58('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xfe58('0xe')},'dialBusyRetryFrequency':{'type':Sequelize[_0xfe58('0xa')](0x5)[_0xfe58('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xfe58('0xf')},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xfe58('0x8')],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xfe58('0x10')},'dialGlobalMaxRetry':{'type':Sequelize[_0xfe58('0xa')](0x3)[_0xfe58('0x8')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xfe58('0x11')},'dialTimezone':{'type':Sequelize[_0xfe58('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xfe58('0x2')],'defaultValue':'07:00-22:00,*,*,*'},'dialCheckDuplicateType':{'type':Sequelize[_0xfe58('0x4')](_0xfe58('0x12'),_0xfe58('0x13'),_0xfe58('0x14')),'defaultValue':_0xfe58('0x12')},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0xfe58('0x15')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0xfe58('0x8')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xfe58('0x16')},'dialAMDGreeting':{'type':Sequelize[_0xfe58('0xa')](0x9)[_0xfe58('0x8')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xfe58('0x17')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xfe58('0xa')](0x9)[_0xfe58('0x8')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xfe58('0xa')](0x9)[_0xfe58('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xfe58('0x18')},'dialAMDMinWordLength':{'type':Sequelize[_0xfe58('0xa')](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xfe58('0x19')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xfe58('0xa')](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xfe58('0x1a')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xfe58('0xa')](0x9)[_0xfe58('0x8')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xfe58('0x1b')},'dialAMDSilenceThreshold':{'type':Sequelize[_0xfe58('0xa')](0x5)[_0xfe58('0x8')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0xfe58('0xa')](0x9)[_0xfe58('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xfe58('0x1c')},'dialOrderByScheduledAt':{'type':Sequelize['ENUM']('DESC',_0xfe58('0x1d')),'defaultValue':_0xfe58('0x1e')},'dialPrefix':{'type':Sequelize[_0xfe58('0x2')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xfe58('0xa')](0x3)[_0xfe58('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xfe58('0x1f')},'dialCutDigit':{'type':Sequelize[_0xfe58('0xa')](0x3)[_0xfe58('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xfe58('0x20')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xfe58('0xa')](0x3)[_0xfe58('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xfe58('0x21')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xfe58('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xfe58('0x22')},'dialDropMaxRetry':{'type':Sequelize[_0xfe58('0xa')](0x3)[_0xfe58('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xfe58('0x23')},'dialDropRetryFrequency':{'type':Sequelize[_0xfe58('0xa')](0x5)[_0xfe58('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xfe58('0x24')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xfe58('0xa')](0x3)[_0xfe58('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xfe58('0x25')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xfe58('0xa')](0x5)[_0xfe58('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xfe58('0x26')},'dialMachineMaxRetry':{'type':Sequelize[_0xfe58('0xa')](0x3)[_0xfe58('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xfe58('0x27')},'dialMachineRetryFrequency':{'type':Sequelize[_0xfe58('0xa')](0x5)[_0xfe58('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xfe58('0x28')},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xfe58('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xfe58('0x29')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xfe58('0xa')](0x5)[_0xfe58('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xfe58('0x2a')}}; \ No newline at end of file +var _0x0268=['#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','ASC','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','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','STRING','name','ivr','BOOLEAN','Active/Disactive\x20Campaign','UNSIGNED','Max\x20200\x20calls.','INTEGER','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','ENUM','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words'];(function(_0x487b0c,_0x14ff74){var _0x1adbdc=function(_0x2e7b9d){while(--_0x2e7b9d){_0x487b0c['push'](_0x487b0c['shift']());}};_0x1adbdc(++_0x14ff74);}(_0x0268,0x17e));var _0x8026=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x0268[_0x3947c9];return _0x2e7871;};'use strict';var Sequelize=require(_0x8026('0x0'));module['exports']={'name':{'type':Sequelize[_0x8026('0x1')],'unique':_0x8026('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0x8026('0x3')),'allowNull':![],'defaultValue':_0x8026('0x3')},'description':{'type':Sequelize[_0x8026('0x1')]},'active':{'type':Sequelize[_0x8026('0x4')],'defaultValue':0x0,'comment':_0x8026('0x5')},'limitCalls':{'type':Sequelize['INTEGER'](0x4)[_0x8026('0x6')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x8026('0x7')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x8026('0x1')]},'dialOriginateTimeout':{'type':Sequelize[_0x8026('0x8')](0x3)[_0x8026('0x6')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8026('0x9')},'dialCongestionMaxRetry':{'type':Sequelize[_0x8026('0x8')](0x3)[_0x8026('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8026('0xa')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x8026('0x8')](0x5)[_0x8026('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8026('0xb')},'dialBusyMaxRetry':{'type':Sequelize[_0x8026('0x8')](0x3)[_0x8026('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8026('0xc')},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x8026('0x8')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0x8026('0xd')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x8026('0x8')](0x5)[_0x8026('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8026('0xe')},'dialGlobalMaxRetry':{'type':Sequelize[_0x8026('0x8')](0x3)[_0x8026('0x6')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x8026('0xf')},'dialTimezone':{'type':Sequelize[_0x8026('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x8026('0x1')],'defaultValue':_0x8026('0x10')},'dialCheckDuplicateType':{'type':Sequelize[_0x8026('0x11')](_0x8026('0x12'),_0x8026('0x13'),_0x8026('0x14')),'defaultValue':_0x8026('0x12')},'dialAMDActive':{'type':Sequelize[_0x8026('0x4')],'defaultValue':0x0,'comment':_0x8026('0x15')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x8026('0x16')},'dialAMDGreeting':{'type':Sequelize[_0x8026('0x8')](0x9)[_0x8026('0x6')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x8026('0x17')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x8026('0x8')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x8026('0x18')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x8026('0x8')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x8026('0x19')},'dialAMDMinWordLength':{'type':Sequelize[_0x8026('0x8')](0x9)[_0x8026('0x6')],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)[_0x8026('0x6')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x8026('0x1a')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0x8026('0x6')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x8026('0x1b')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0x8026('0x6')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x8026('0x1c')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x8026('0x8')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x8026('0x1d')},'dialOrderByScheduledAt':{'type':Sequelize[_0x8026('0x11')]('DESC',_0x8026('0x1e')),'defaultValue':_0x8026('0x1f')},'dialPrefix':{'type':Sequelize[_0x8026('0x1')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x8026('0x8')](0x3)[_0x8026('0x6')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x8026('0x20')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0x8026('0x6')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x8026('0x21')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x8026('0x8')](0x3)[_0x8026('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8026('0x22')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x8026('0x8')](0x5)[_0x8026('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x8026('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8026('0x23')},'dialDropRetryFrequency':{'type':Sequelize[_0x8026('0x8')](0x5)[_0x8026('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8026('0x24')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x8026('0x8')](0x3)[_0x8026('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x8026('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8026('0x25')},'dialMachineMaxRetry':{'type':Sequelize[_0x8026('0x8')](0x3)[_0x8026('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0x8026('0x8')](0x5)[_0x8026('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8026('0x26')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x8026('0x8')](0x3)[_0x8026('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8026('0x27')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x8026('0x8')](0x5)[_0x8026('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8026('0x28')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index e30fa65..f0e7a16 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 _0x1430=['getLists','addLists','ids','dialCheckDuplicateType','always','into','fromQuery','phone','scheduledAt','ContactId','select','field','NOW()','toString','ListId','from','cm_contacts','deletedAt\x20IS\x20NULL','CmListId','phone\x20NOT\x20IN\x20(?)','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','onlyIfOpen','insert','cm_hopper','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','all','removeLists','getBlackLists','spread','cm_hopper_black','push','removeBlackLists','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','fs-extra','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','IvrCampaigns','UserProfileResource','error','stack','name','send','index','Campaign','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','fields','length','attributes','hasOwnProperty','nolimit','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','catch','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','clone','find','omit','createdAt','updatedAt','role','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','getHoppers','findOne','order','CampaignId','CmHopper','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','CmHopperBlack','CmList'];(function(_0x53b398,_0x39bfd8){var _0x32c9ed=function(_0x5f5c4f){while(--_0x5f5c4f){_0x53b398['push'](_0x53b398['shift']());}};_0x32c9ed(++_0x39bfd8);}(_0x1430,0x1a5));var _0x0143=function(_0x3c8103,_0x2a4125){_0x3c8103=_0x3c8103-0x0;var _0x16496f=_0x1430[_0x3c8103];return _0x16496f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0143('0x0'));var zipdir=require(_0x0143('0x1'));var jsonpatch=require(_0x0143('0x2'));var rp=require('request-promise');var moment=require(_0x0143('0x3'));var BPromise=require(_0x0143('0x4'));var Mustache=require(_0x0143('0x5'));var util=require('util');var path=require(_0x0143('0x6'));var sox=require(_0x0143('0x7'));var csv=require(_0x0143('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0143('0x9'));var _=require('lodash');var squel=require(_0x0143('0xa'));var crypto=require('crypto');var jsforce=require(_0x0143('0xb'));var deskjs=require(_0x0143('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0143('0xd'));var Redis=require(_0x0143('0xe'));var authService=require(_0x0143('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x0143('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x0143('0x11'));var utils=require(_0x0143('0x12'));var config=require(_0x0143('0x13'));var licenseUtil=require(_0x0143('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1e1db3,_0x27c458){_0x27c458=_0x27c458||0xcc;return function(_0x33c7a9){if(_0x33c7a9){return _0x1e1db3[_0x0143('0x15')](_0x27c458);}return _0x1e1db3[_0x0143('0x16')](_0x27c458)[_0x0143('0x17')]();};}function respondWithResult(_0x4ee7da,_0x123a8d){_0x123a8d=_0x123a8d||0xc8;return function(_0x10b5ec){if(_0x10b5ec){return _0x4ee7da[_0x0143('0x16')](_0x123a8d)[_0x0143('0x18')](_0x10b5ec);}};}function respondWithFilteredResult(_0x14af2e,_0xb10711){return function(_0x2655e7){if(_0x2655e7){var _0x5940b6=typeof _0xb10711[_0x0143('0x19')]===_0x0143('0x1a')&&typeof _0xb10711[_0x0143('0x1b')]===_0x0143('0x1a');var _0x334894=_0x2655e7[_0x0143('0x1c')];var _0x489a5b=_0x5940b6?0x0:_0xb10711[_0x0143('0x19')];var _0x369c15=_0x5940b6?_0x2655e7['count']:_0xb10711[_0x0143('0x19')]+_0xb10711['limit'];var _0xa8aabc;if(_0x369c15>=_0x334894){_0x369c15=_0x334894;_0xa8aabc=0xc8;}else{_0xa8aabc=0xce;}_0x14af2e[_0x0143('0x16')](_0xa8aabc);return _0x14af2e[_0x0143('0x1d')](_0x0143('0x1e'),_0x489a5b+'-'+_0x369c15+'/'+_0x334894)[_0x0143('0x18')](_0x2655e7);}return null;};}function patchUpdates(_0x14c8d1){return function(_0x427a37){try{jsonpatch[_0x0143('0x1f')](_0x427a37,_0x14c8d1,!![]);}catch(_0x1e7616){return BPromise[_0x0143('0x20')](_0x1e7616);}return _0x427a37[_0x0143('0x21')]();};}function saveUpdates(_0xa65b87,_0x122266){return function(_0x3e49b6){if(_0x3e49b6){return _0x3e49b6[_0x0143('0x22')](_0xa65b87)[_0x0143('0x23')](function(_0x561de3){return _0x561de3;});}return null;};}function removeEntity(_0x335bc9,_0x23b1a1){return function(_0x558bff){if(_0x558bff){return _0x558bff[_0x0143('0x24')]()['then'](function(){var _0x71a946=_0x558bff['get']({'plain':!![]});var _0x73fdd4=_0x0143('0x25');return db[_0x0143('0x26')][_0x0143('0x24')]({'where':{'type':_0x73fdd4,'resourceId':_0x71a946['id']}})[_0x0143('0x23')](function(){return _0x558bff;});})[_0x0143('0x23')](function(){_0x335bc9[_0x0143('0x16')](0xcc)[_0x0143('0x17')]();});}};}function handleEntityNotFound(_0x8eb5f8,_0x1e5361){return function(_0x2fb7b0){if(!_0x2fb7b0){_0x8eb5f8[_0x0143('0x15')](0x194);}return _0x2fb7b0;};}function handleError(_0x5fac5e,_0xafc02c){_0xafc02c=_0xafc02c||0x1f4;return function(_0x33be8c){logger[_0x0143('0x27')](_0x33be8c[_0x0143('0x28')]);if(_0x33be8c['name']){delete _0x33be8c[_0x0143('0x29')];}_0x5fac5e['status'](_0xafc02c)[_0x0143('0x2a')](_0x33be8c);};}exports[_0x0143('0x2b')]=function(_0x559b32,_0x35783e){var _0x2884c2={},_0x4d9997={},_0x483648={'count':0x0,'rows':[]};var _0x4a2526=_['map'](db[_0x0143('0x2c')][_0x0143('0x2d')],function(_0x3c67e2){return{'name':_0x3c67e2[_0x0143('0x2e')],'type':_0x3c67e2['type'][_0x0143('0x2f')]};});_0x4d9997[_0x0143('0x30')]=_[_0x0143('0x31')](_0x4a2526,_0x0143('0x29'));_0x4d9997[_0x0143('0x32')]=_[_0x0143('0x33')](_0x559b32[_0x0143('0x32')]);_0x4d9997[_0x0143('0x34')]=_[_0x0143('0x35')](_0x4d9997['model'],_0x4d9997[_0x0143('0x32')]);_0x2884c2['attributes']=_[_0x0143('0x35')](_0x4d9997[_0x0143('0x30')],qs[_0x0143('0x36')](_0x559b32[_0x0143('0x32')]['fields']));_0x2884c2['attributes']=_0x2884c2['attributes'][_0x0143('0x37')]?_0x2884c2[_0x0143('0x38')]:_0x4d9997['model'];if(!_0x559b32[_0x0143('0x32')][_0x0143('0x39')](_0x0143('0x3a'))){_0x2884c2['limit']=qs[_0x0143('0x1b')](_0x559b32[_0x0143('0x32')][_0x0143('0x1b')]);_0x2884c2[_0x0143('0x19')]=qs[_0x0143('0x19')](_0x559b32[_0x0143('0x32')]['offset']);}_0x2884c2['order']=qs['sort'](_0x559b32[_0x0143('0x32')][_0x0143('0x3b')]);_0x2884c2[_0x0143('0x3c')]=qs[_0x0143('0x34')](_[_0x0143('0x3d')](_0x559b32[_0x0143('0x32')],_0x4d9997[_0x0143('0x34')]),_0x4a2526);if(_0x559b32[_0x0143('0x32')]['filter']){_0x2884c2[_0x0143('0x3c')]=_['merge'](_0x2884c2[_0x0143('0x3c')],{'$or':_[_0x0143('0x31')](_0x4a2526,function(_0x1faa6e){if(_0x1faa6e['type']!==_0x0143('0x3e')){var _0x1f191c={};_0x1f191c[_0x1faa6e[_0x0143('0x29')]]={'$like':'%'+_0x559b32['query'][_0x0143('0x3f')]+'%'};return _0x1f191c;}})});}_0x2884c2=_[_0x0143('0x40')]({},_0x2884c2,_0x559b32[_0x0143('0x41')]);var _0x41244b={'where':_0x2884c2['where']};return db[_0x0143('0x2c')][_0x0143('0x1c')](_0x41244b)['then'](function(_0x6cf355){_0x483648[_0x0143('0x1c')]=_0x6cf355;if(_0x559b32[_0x0143('0x32')][_0x0143('0x42')]){_0x2884c2[_0x0143('0x43')]=[{'all':!![]}];}return db[_0x0143('0x2c')][_0x0143('0x44')](_0x2884c2);})['then'](function(_0x18e6f9){_0x483648[_0x0143('0x45')]=_0x18e6f9;return _0x483648;})['then'](respondWithFilteredResult(_0x35783e,_0x2884c2))['catch'](handleError(_0x35783e,null));};exports['show']=function(_0x275351,_0x598a61){var _0x1ebc3d={'raw':![],'where':{'id':_0x275351['params']['id']}},_0x3e6041={};_0x3e6041[_0x0143('0x30')]=_['keys'](db[_0x0143('0x2c')][_0x0143('0x2d')]);_0x3e6041['query']=_[_0x0143('0x33')](_0x275351[_0x0143('0x32')]);_0x3e6041[_0x0143('0x34')]=_['intersection'](_0x3e6041['model'],_0x3e6041[_0x0143('0x32')]);_0x1ebc3d[_0x0143('0x38')]=_['intersection'](_0x3e6041[_0x0143('0x30')],qs['fields'](_0x275351[_0x0143('0x32')][_0x0143('0x36')]));_0x1ebc3d['attributes']=_0x1ebc3d[_0x0143('0x38')][_0x0143('0x37')]?_0x1ebc3d[_0x0143('0x38')]:_0x3e6041['model'];if(_0x275351[_0x0143('0x32')][_0x0143('0x42')]){_0x1ebc3d[_0x0143('0x43')]=[{'all':!![]}];}_0x1ebc3d=_[_0x0143('0x40')]({},_0x1ebc3d,_0x275351[_0x0143('0x41')]);return db['Campaign']['find'](_0x1ebc3d)['then'](handleEntityNotFound(_0x598a61,null))[_0x0143('0x23')](respondWithResult(_0x598a61,null))[_0x0143('0x46')](handleError(_0x598a61,null));};exports[_0x0143('0x47')]=function(_0x40dcaa,_0x131cfe){return db[_0x0143('0x2c')][_0x0143('0x47')](_0x40dcaa[_0x0143('0x48')],{})[_0x0143('0x23')](function(_0x304224){var _0x297683=_0x40dcaa['user'][_0x0143('0x49')]({'plain':!![]});if(!_0x297683)throw new Error(_0x0143('0x4a'));if(_0x297683['role']===_0x0143('0x4b')){var _0x192a9e=_0x304224[_0x0143('0x49')]({'plain':!![]});var _0x39c354=_0x0143('0x25');return db['UserProfileSection']['find']({'where':{'name':_0x39c354,'userProfileId':_0x297683['userProfileId']},'raw':!![]})['then'](function(_0xfb0f6b){if(_0xfb0f6b&&_0xfb0f6b['autoAssociation']===0x0){return db['UserProfileResource'][_0x0143('0x47')]({'name':_0x192a9e['name'],'resourceId':_0x192a9e['id'],'type':_0xfb0f6b[_0x0143('0x29')],'sectionId':_0xfb0f6b['id']},{})[_0x0143('0x23')](function(){return _0x304224;});}else{return _0x304224;}})[_0x0143('0x46')](function(_0x3163d4){logger[_0x0143('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3163d4);throw _0x3163d4;});}return _0x304224;})[_0x0143('0x23')](respondWithResult(_0x131cfe,0xc9))[_0x0143('0x46')](handleError(_0x131cfe,null));};exports[_0x0143('0x4c')]=function(_0x2721c1,_0x13c706){var _0x1af98f={'where':{'id':_0x2721c1['params']['id']}},_0x1dc11b={};_0x1dc11b['model']=_[_0x0143('0x33')](db[_0x0143('0x2c')][_0x0143('0x2d')]);_0x1af98f[_0x0143('0x38')]=_[_0x0143('0x35')](_0x1dc11b[_0x0143('0x30')],qs['fields'](_0x2721c1[_0x0143('0x32')]['fields']));_0x1af98f[_0x0143('0x38')]=_0x1af98f[_0x0143('0x38')][_0x0143('0x37')]?_0x1af98f[_0x0143('0x38')]:_0x1dc11b['model'];if(_0x2721c1[_0x0143('0x32')][_0x0143('0x42')]){_0x1af98f[_0x0143('0x43')]=[{'all':!![]}];}_0x1af98f=_[_0x0143('0x40')]({},_0x1af98f,_0x2721c1[_0x0143('0x41')]);return db[_0x0143('0x2c')][_0x0143('0x4d')](_0x1af98f)[_0x0143('0x23')](handleEntityNotFound(_0x13c706,null))['then'](function(_0x1b87ce){if(_0x1b87ce){var _0x1909bf=_0x1b87ce[_0x0143('0x49')]({'plain':!![]});_0x1909bf=qs[_0x0143('0x4e')](_0x1909bf,['id',_0x0143('0x4f'),_0x0143('0x50')]);_0x2721c1['body']=_['omit'](_0x2721c1[_0x0143('0x48')],['id',_0x0143('0x4f'),_0x0143('0x50')]);return db[_0x0143('0x2c')]['create'](_[_0x0143('0x40')](_0x1909bf,_0x2721c1['body']),{'include':_0x2721c1[_0x0143('0x32')][_0x0143('0x42')]?[{'all':!![]}]:undefined})[_0x0143('0x23')](function(_0x206438){var _0x5547d0=_0x2721c1[_0x0143('0x4b')]['get']({'plain':!![]});if(!_0x5547d0)throw new Error(_0x0143('0x4a'));if(_0x5547d0[_0x0143('0x51')]===_0x0143('0x4b')){var _0x4b286d=_0x206438['get']({'plain':!![]});var _0xc15d6c=_0x0143('0x25');return db['UserProfileSection'][_0x0143('0x4d')]({'where':{'name':_0xc15d6c,'userProfileId':_0x5547d0['userProfileId']},'raw':!![]})['then'](function(_0x2d98b8){if(_0x2d98b8&&_0x2d98b8['autoAssociation']===0x0){return db[_0x0143('0x26')][_0x0143('0x47')]({'name':_0x4b286d[_0x0143('0x29')],'resourceId':_0x4b286d['id'],'type':_0x2d98b8[_0x0143('0x29')],'sectionId':_0x2d98b8['id']},{})[_0x0143('0x23')](function(){return _0x206438;});}else{return _0x206438;}})[_0x0143('0x46')](function(_0xfea5c6){logger[_0x0143('0x27')](_0x0143('0x52'),_0xfea5c6);throw _0xfea5c6;});}return _0x206438;});}})['then'](respondWithResult(_0x13c706,0xc9))['catch'](handleError(_0x13c706,null));};exports['update']=function(_0x1a875d,_0x21d640){if(_0x1a875d[_0x0143('0x48')]['id']){delete _0x1a875d[_0x0143('0x48')]['id'];}return db[_0x0143('0x2c')][_0x0143('0x4d')]({'where':{'id':_0x1a875d[_0x0143('0x53')]['id']}})['then'](handleEntityNotFound(_0x21d640,null))['then'](saveUpdates(_0x1a875d['body'],null))[_0x0143('0x23')](respondWithResult(_0x21d640,null))[_0x0143('0x46')](handleError(_0x21d640,null));};exports['destroy']=function(_0x5f3392,_0xea52c7){return db[_0x0143('0x2c')]['find']({'where':{'id':_0x5f3392[_0x0143('0x53')]['id']}})[_0x0143('0x23')](handleEntityNotFound(_0xea52c7,null))[_0x0143('0x23')](removeEntity(_0xea52c7,null))[_0x0143('0x46')](handleError(_0xea52c7,null));};exports[_0x0143('0x54')]=function(_0x272cb5,_0x238aba,_0x1f2e11){var _0x59aca5={'raw':!![],'where':{}};var _0x3ab36f={};var _0x513cd8={'count':0x0,'rows':[]};return db[_0x0143('0x2c')][_0x0143('0x55')]({'where':{'id':_0x272cb5[_0x0143('0x53')]['id']}})[_0x0143('0x23')](handleEntityNotFound(_0x238aba,null))['then'](function(_0x3903a8){if(_0x3903a8){_0x3ab36f[_0x0143('0x30')]=_[_0x0143('0x33')](db['CmHopper'][_0x0143('0x2d')]);_0x3ab36f['query']=_['keys'](_0x272cb5[_0x0143('0x32')]);_0x3ab36f[_0x0143('0x34')]=_[_0x0143('0x35')](_0x3ab36f[_0x0143('0x30')],_0x3ab36f[_0x0143('0x32')]);_0x59aca5['attributes']=_[_0x0143('0x35')](_0x3ab36f['model'],qs['fields'](_0x272cb5[_0x0143('0x32')][_0x0143('0x36')]));_0x59aca5[_0x0143('0x38')]=_0x59aca5['attributes'][_0x0143('0x37')]?_0x59aca5[_0x0143('0x38')]:_0x3ab36f['model'];if(!_0x272cb5[_0x0143('0x32')][_0x0143('0x39')](_0x0143('0x3a'))){_0x59aca5[_0x0143('0x1b')]=qs[_0x0143('0x1b')](_0x272cb5[_0x0143('0x32')]['limit']);_0x59aca5['offset']=qs[_0x0143('0x19')](_0x272cb5[_0x0143('0x32')]['offset']);}_0x59aca5[_0x0143('0x56')]=qs[_0x0143('0x3b')](_0x272cb5[_0x0143('0x32')]['sort']);_0x59aca5['where']=qs[_0x0143('0x34')](_[_0x0143('0x3d')](_0x272cb5[_0x0143('0x32')],_0x3ab36f['filters']));_0x59aca5['where'][_0x0143('0x57')]=_0x3903a8['id'];if(_0x272cb5[_0x0143('0x32')]['filter']){_0x59aca5['where']=_['merge'](_0x59aca5[_0x0143('0x3c')],{'$or':_[_0x0143('0x31')](_0x59aca5[_0x0143('0x38')],function(_0x176c4c){var _0x3a3018={};_0x3a3018[_0x176c4c]={'$like':'%'+_0x272cb5['query']['filter']+'%'};return _0x3a3018;})});}_0x59aca5=_[_0x0143('0x40')]({},_0x59aca5,_0x272cb5[_0x0143('0x41')]);return db['CmHopper'][_0x0143('0x1c')]({'where':_0x59aca5['where']})['then'](function(_0x43412a){_0x513cd8[_0x0143('0x1c')]=_0x43412a;if(_0x272cb5[_0x0143('0x32')]['includeAll']){_0x59aca5[_0x0143('0x43')]=[{'all':!![]}];}return db[_0x0143('0x58')][_0x0143('0x44')](_0x59aca5);})[_0x0143('0x23')](function(_0x4e6a83){_0x513cd8[_0x0143('0x45')]=_0x4e6a83;return _0x513cd8;});}})['then'](respondWithFilteredResult(_0x238aba,_0x59aca5))[_0x0143('0x46')](handleError(_0x238aba,null));};exports[_0x0143('0x59')]=function(_0x45f9e8,_0x4df366,_0x53b6ad){var _0x7d4f61={'raw':!![],'where':{}};var _0x26716d={};var _0x104497={'count':0x0,'rows':[]};return db['Campaign']['findOne']({'where':{'id':_0x45f9e8['params']['id']}})[_0x0143('0x23')](handleEntityNotFound(_0x4df366,null))[_0x0143('0x23')](function(_0x33bcd5){if(_0x33bcd5){_0x26716d[_0x0143('0x30')]=_[_0x0143('0x33')](db[_0x0143('0x5a')][_0x0143('0x2d')]);_0x26716d[_0x0143('0x32')]=_[_0x0143('0x33')](_0x45f9e8[_0x0143('0x32')]);_0x26716d[_0x0143('0x34')]=_[_0x0143('0x35')](_0x26716d[_0x0143('0x30')],_0x26716d[_0x0143('0x32')]);_0x7d4f61['attributes']=_['intersection'](_0x26716d[_0x0143('0x30')],qs[_0x0143('0x36')](_0x45f9e8[_0x0143('0x32')][_0x0143('0x36')]));_0x7d4f61[_0x0143('0x38')]=_0x7d4f61[_0x0143('0x38')][_0x0143('0x37')]?_0x7d4f61['attributes']:_0x26716d[_0x0143('0x30')];if(!_0x45f9e8[_0x0143('0x32')][_0x0143('0x39')](_0x0143('0x3a'))){_0x7d4f61['limit']=qs[_0x0143('0x1b')](_0x45f9e8[_0x0143('0x32')][_0x0143('0x1b')]);_0x7d4f61[_0x0143('0x19')]=qs[_0x0143('0x19')](_0x45f9e8['query']['offset']);}_0x7d4f61[_0x0143('0x56')]=qs['sort'](_0x45f9e8[_0x0143('0x32')][_0x0143('0x3b')]);_0x7d4f61['where']=qs[_0x0143('0x34')](_[_0x0143('0x3d')](_0x45f9e8[_0x0143('0x32')],_0x26716d[_0x0143('0x34')]));_0x7d4f61['where'][_0x0143('0x57')]=_0x33bcd5['id'];if(_0x45f9e8[_0x0143('0x32')][_0x0143('0x3f')]){_0x7d4f61[_0x0143('0x3c')]=_[_0x0143('0x40')](_0x7d4f61[_0x0143('0x3c')],{'$or':_['map'](_0x7d4f61[_0x0143('0x38')],function(_0x50ff50){var _0x423a40={};_0x423a40[_0x50ff50]={'$like':'%'+_0x45f9e8[_0x0143('0x32')][_0x0143('0x3f')]+'%'};return _0x423a40;})});}_0x7d4f61=_[_0x0143('0x40')]({},_0x7d4f61,_0x45f9e8['options']);return db[_0x0143('0x5a')][_0x0143('0x1c')]({'where':_0x7d4f61[_0x0143('0x3c')]})[_0x0143('0x23')](function(_0x5b0000){_0x104497[_0x0143('0x1c')]=_0x5b0000;if(_0x45f9e8[_0x0143('0x32')][_0x0143('0x42')]){_0x7d4f61[_0x0143('0x43')]=[{'all':!![]}];}return db['CmHopperHistory'][_0x0143('0x44')](_0x7d4f61);})[_0x0143('0x23')](function(_0xfc505a){_0x104497[_0x0143('0x45')]=_0xfc505a;return _0x104497;});}})[_0x0143('0x23')](respondWithFilteredResult(_0x4df366,_0x7d4f61))[_0x0143('0x46')](handleError(_0x4df366,null));};exports[_0x0143('0x5b')]=function(_0x49e4ec,_0x3dca7a,_0x5d63bf){var _0x45b354={'raw':!![],'where':{}};var _0x3af3d3={};var _0x265bbc={'count':0x0,'rows':[]};return db[_0x0143('0x2c')][_0x0143('0x55')]({'where':{'id':_0x49e4ec[_0x0143('0x53')]['id']}})[_0x0143('0x23')](handleEntityNotFound(_0x3dca7a,null))[_0x0143('0x23')](function(_0x50f7c6){if(_0x50f7c6){_0x3af3d3[_0x0143('0x30')]=_[_0x0143('0x33')](db[_0x0143('0x5c')][_0x0143('0x2d')]);_0x3af3d3[_0x0143('0x32')]=_['keys'](_0x49e4ec[_0x0143('0x32')]);_0x3af3d3[_0x0143('0x34')]=_[_0x0143('0x35')](_0x3af3d3['model'],_0x3af3d3[_0x0143('0x32')]);_0x45b354[_0x0143('0x38')]=_[_0x0143('0x35')](_0x3af3d3[_0x0143('0x30')],qs[_0x0143('0x36')](_0x49e4ec['query'][_0x0143('0x36')]));_0x45b354['attributes']=_0x45b354['attributes'][_0x0143('0x37')]?_0x45b354[_0x0143('0x38')]:_0x3af3d3[_0x0143('0x30')];if(!_0x49e4ec[_0x0143('0x32')][_0x0143('0x39')]('nolimit')){_0x45b354['limit']=qs[_0x0143('0x1b')](_0x49e4ec[_0x0143('0x32')]['limit']);_0x45b354[_0x0143('0x19')]=qs[_0x0143('0x19')](_0x49e4ec['query']['offset']);}_0x45b354[_0x0143('0x56')]=qs[_0x0143('0x3b')](_0x49e4ec[_0x0143('0x32')][_0x0143('0x3b')]);_0x45b354[_0x0143('0x3c')]=qs[_0x0143('0x34')](_[_0x0143('0x3d')](_0x49e4ec['query'],_0x3af3d3['filters']));_0x45b354['where']['CampaignId']=_0x50f7c6['id'];if(_0x49e4ec[_0x0143('0x32')][_0x0143('0x3f')]){_0x45b354[_0x0143('0x3c')]=_['merge'](_0x45b354['where'],{'$or':_[_0x0143('0x31')](_0x45b354[_0x0143('0x38')],function(_0x3287a4){var _0x1c14a4={};_0x1c14a4[_0x3287a4]={'$like':'%'+_0x49e4ec[_0x0143('0x32')][_0x0143('0x3f')]+'%'};return _0x1c14a4;})});}_0x45b354=_[_0x0143('0x40')]({},_0x45b354,_0x49e4ec[_0x0143('0x41')]);return db[_0x0143('0x5c')][_0x0143('0x1c')]({'where':_0x45b354['where']})[_0x0143('0x23')](function(_0x2c912a){_0x265bbc[_0x0143('0x1c')]=_0x2c912a;if(_0x49e4ec[_0x0143('0x32')][_0x0143('0x42')]){_0x45b354['include']=[{'all':!![]}];}return db['CmHopperFinal'][_0x0143('0x44')](_0x45b354);})['then'](function(_0x52ff56){_0x265bbc['rows']=_0x52ff56;return _0x265bbc;});}})[_0x0143('0x23')](respondWithFilteredResult(_0x3dca7a,_0x45b354))['catch'](handleError(_0x3dca7a,null));};exports['getHopperBlacks']=function(_0x476d6d,_0x5673c8,_0x1f0cad){var _0x2668ad={'raw':!![],'where':{}};var _0x3850c0={};var _0x2bfe2c={'count':0x0,'rows':[]};return db[_0x0143('0x2c')][_0x0143('0x55')]({'where':{'id':_0x476d6d['params']['id']}})[_0x0143('0x23')](handleEntityNotFound(_0x5673c8,null))[_0x0143('0x23')](function(_0x38c507){if(_0x38c507){_0x3850c0['model']=_[_0x0143('0x33')](db[_0x0143('0x5d')][_0x0143('0x2d')]);_0x3850c0[_0x0143('0x32')]=_[_0x0143('0x33')](_0x476d6d['query']);_0x3850c0[_0x0143('0x34')]=_['intersection'](_0x3850c0[_0x0143('0x30')],_0x3850c0[_0x0143('0x32')]);_0x2668ad[_0x0143('0x38')]=_[_0x0143('0x35')](_0x3850c0['model'],qs['fields'](_0x476d6d['query'][_0x0143('0x36')]));_0x2668ad[_0x0143('0x38')]=_0x2668ad[_0x0143('0x38')][_0x0143('0x37')]?_0x2668ad[_0x0143('0x38')]:_0x3850c0['model'];if(!_0x476d6d[_0x0143('0x32')]['hasOwnProperty'](_0x0143('0x3a'))){_0x2668ad[_0x0143('0x1b')]=qs[_0x0143('0x1b')](_0x476d6d[_0x0143('0x32')][_0x0143('0x1b')]);_0x2668ad[_0x0143('0x19')]=qs[_0x0143('0x19')](_0x476d6d['query'][_0x0143('0x19')]);}_0x2668ad[_0x0143('0x56')]=qs[_0x0143('0x3b')](_0x476d6d['query'][_0x0143('0x3b')]);_0x2668ad[_0x0143('0x3c')]=qs[_0x0143('0x34')](_['pick'](_0x476d6d[_0x0143('0x32')],_0x3850c0['filters']));_0x2668ad[_0x0143('0x3c')][_0x0143('0x57')]=_0x38c507['id'];if(_0x476d6d['query']['filter']){_0x2668ad['where']=_[_0x0143('0x40')](_0x2668ad[_0x0143('0x3c')],{'$or':_[_0x0143('0x31')](_0x2668ad[_0x0143('0x38')],function(_0x2c6474){var _0x110761={};_0x110761[_0x2c6474]={'$like':'%'+_0x476d6d[_0x0143('0x32')][_0x0143('0x3f')]+'%'};return _0x110761;})});}_0x2668ad=_[_0x0143('0x40')]({},_0x2668ad,_0x476d6d[_0x0143('0x41')]);return db[_0x0143('0x5d')][_0x0143('0x1c')]({'where':_0x2668ad[_0x0143('0x3c')]})[_0x0143('0x23')](function(_0xa4688){_0x2bfe2c['count']=_0xa4688;if(_0x476d6d[_0x0143('0x32')][_0x0143('0x42')]){_0x2668ad[_0x0143('0x43')]=[{'all':!![]}];}return db['CmHopperBlack']['findAll'](_0x2668ad);})[_0x0143('0x23')](function(_0x1b527a){_0x2bfe2c['rows']=_0x1b527a;return _0x2bfe2c;});}})[_0x0143('0x23')](respondWithFilteredResult(_0x5673c8,_0x2668ad))[_0x0143('0x46')](handleError(_0x5673c8,null));};exports['getLists']=function(_0x4b2c1a,_0x397ded,_0x3f299d){var _0x23f85d={};var _0x36656d={};var _0x5edc13;var _0x214b42;return db[_0x0143('0x2c')][_0x0143('0x55')]({'where':{'id':_0x4b2c1a[_0x0143('0x53')]['id']}})['then'](handleEntityNotFound(_0x397ded,null))[_0x0143('0x23')](function(_0x22b726){if(_0x22b726){_0x5edc13=_0x22b726;_0x36656d[_0x0143('0x30')]=_[_0x0143('0x33')](db[_0x0143('0x5e')][_0x0143('0x2d')]);_0x36656d['query']=_['keys'](_0x4b2c1a[_0x0143('0x32')]);_0x36656d[_0x0143('0x34')]=_[_0x0143('0x35')](_0x36656d['model'],_0x36656d[_0x0143('0x32')]);_0x23f85d[_0x0143('0x38')]=_['intersection'](_0x36656d['model'],qs['fields'](_0x4b2c1a['query'][_0x0143('0x36')]));_0x23f85d[_0x0143('0x38')]=_0x23f85d[_0x0143('0x38')][_0x0143('0x37')]?_0x23f85d[_0x0143('0x38')]:_0x36656d[_0x0143('0x30')];_0x23f85d[_0x0143('0x56')]=qs[_0x0143('0x3b')](_0x4b2c1a[_0x0143('0x32')]['sort']);_0x23f85d['where']=qs[_0x0143('0x34')](_['pick'](_0x4b2c1a['query'],_0x36656d['filters']));if(_0x4b2c1a[_0x0143('0x32')][_0x0143('0x3f')]){_0x23f85d['where']=_[_0x0143('0x40')](_0x23f85d[_0x0143('0x3c')],{'$or':_[_0x0143('0x31')](_0x23f85d[_0x0143('0x38')],function(_0x519df0){var _0x33a5f4={};_0x33a5f4[_0x519df0]={'$like':'%'+_0x4b2c1a['query']['filter']+'%'};return _0x33a5f4;})});}_0x23f85d=_['merge']({},_0x23f85d,_0x4b2c1a[_0x0143('0x41')]);return _0x5edc13[_0x0143('0x5f')](_0x23f85d);}})['then'](function(_0xc276d8){if(_0xc276d8){_0x214b42=_0xc276d8[_0x0143('0x37')];if(!_0x4b2c1a[_0x0143('0x32')][_0x0143('0x39')](_0x0143('0x3a'))){_0x23f85d[_0x0143('0x1b')]=qs[_0x0143('0x1b')](_0x4b2c1a[_0x0143('0x32')][_0x0143('0x1b')]);_0x23f85d[_0x0143('0x19')]=qs['offset'](_0x4b2c1a[_0x0143('0x32')]['offset']);}return _0x5edc13[_0x0143('0x5f')](_0x23f85d);}})['then'](function(_0x2c34d6){if(_0x2c34d6){return _0x2c34d6?{'count':_0x214b42,'rows':_0x2c34d6}:null;}})[_0x0143('0x23')](respondWithResult(_0x397ded,null))['catch'](handleError(_0x397ded,null));};exports[_0x0143('0x60')]=function(_0x5aab86,_0x3175b9,_0x3ec1d1){var _0x2e6be3,_0x245284;return db[_0x0143('0x2c')][_0x0143('0x4d')]({'where':{'id':_0x5aab86[_0x0143('0x53')]['id']}})[_0x0143('0x23')](handleEntityNotFound(_0x3175b9,null))[_0x0143('0x23')](function(_0x9f8296){if(_0x9f8296){_0x245284=_0x9f8296;return _0x9f8296[_0x0143('0x60')](_0x5aab86['body'][_0x0143('0x61')],_[_0x0143('0x4e')](_0x5aab86[_0x0143('0x48')],[_0x0143('0x61'),'id'])||{});}return null;})['spread'](function(_0x3593a9){var _0x2b2012;_0x2e6be3=_0x3593a9||[];var _0x485eb0=[];if(_0x3593a9){for(var _0x39ddc0=0x0;_0x39ddc0<_0x3593a9['length'];_0x39ddc0+=0x1){var _0x5a7d46=_0x3593a9[_0x39ddc0][_0x0143('0x49')]({'plain':!![]});_0x245284[_0x0143('0x62')]=_0x5aab86[_0x0143('0x48')][_0x0143('0x62')]?_0x5aab86[_0x0143('0x48')][_0x0143('0x62')]:_0x245284[_0x0143('0x62')];switch(_0x245284['dialCheckDuplicateType']){case _0x0143('0x63'):_0x2b2012=squel['insert']()[_0x0143('0x64')]('cm_hopper')[_0x0143('0x65')]([_0x0143('0x66'),_0x0143('0x67'),_0x0143('0x68'),'ListId',_0x0143('0x57'),_0x0143('0x4f'),'updatedAt'],squel[_0x0143('0x69')]()['field'](_0x0143('0x66'),'phone')[_0x0143('0x6a')](_0x0143('0x6b'),_0x0143('0x67'))[_0x0143('0x6a')]('id',_0x0143('0x68'))[_0x0143('0x6a')](_0x5a7d46['CmListId'][_0x0143('0x6c')](),_0x0143('0x6d'))[_0x0143('0x6a')](_0x5aab86['params']['id'][_0x0143('0x6c')](),_0x0143('0x57'))[_0x0143('0x6a')](_0x0143('0x6b'),_0x0143('0x4f'))[_0x0143('0x6a')](_0x0143('0x6b'),_0x0143('0x50'))[_0x0143('0x6e')](_0x0143('0x6f'))['where'](_0x0143('0x70'))[_0x0143('0x3c')]('ListId\x20=\x20?',_0x5a7d46[_0x0143('0x71')][_0x0143('0x6c')]())['where']('phone\x20IS\x20NOT\x20NULL')[_0x0143('0x3c')](_0x0143('0x72'),squel[_0x0143('0x69')]()[_0x0143('0x6a')]('COALESCE(calleridnum,\x27\x27)')[_0x0143('0x6e')]('cm_hopper_final')[_0x0143('0x3c')](_0x0143('0x73'),_0x5aab86[_0x0143('0x53')]['id'][_0x0143('0x6c')]()))[_0x0143('0x3c')](_0x0143('0x72'),squel['select']()['field'](_0x0143('0x74'))['from']('cm_hopper')[_0x0143('0x3c')]('CampaignId\x20=\x20?',_0x5aab86[_0x0143('0x53')]['id'][_0x0143('0x6c')]())))['toString']();break;case _0x0143('0x75'):_0x2b2012=squel[_0x0143('0x76')]()[_0x0143('0x64')](_0x0143('0x77'))[_0x0143('0x65')]([_0x0143('0x66'),_0x0143('0x67'),_0x0143('0x68'),_0x0143('0x6d'),_0x0143('0x57'),_0x0143('0x4f'),_0x0143('0x50')],squel[_0x0143('0x69')]()[_0x0143('0x6a')]('phone',_0x0143('0x66'))[_0x0143('0x6a')](_0x0143('0x6b'),'scheduledAt')[_0x0143('0x6a')]('id','ContactId')[_0x0143('0x6a')](_0x5a7d46[_0x0143('0x71')][_0x0143('0x6c')](),_0x0143('0x6d'))[_0x0143('0x6a')](_0x5aab86['params']['id'][_0x0143('0x6c')](),_0x0143('0x57'))[_0x0143('0x6a')](_0x0143('0x6b'),_0x0143('0x4f'))[_0x0143('0x6a')]('NOW()',_0x0143('0x50'))['from'](_0x0143('0x6f'))[_0x0143('0x3c')](_0x0143('0x70'))['where'](_0x0143('0x78'),_0x5a7d46[_0x0143('0x71')][_0x0143('0x6c')]())['where'](_0x0143('0x79'))[_0x0143('0x3c')]('phone\x20NOT\x20IN\x20(?)',squel[_0x0143('0x69')]()[_0x0143('0x6a')](_0x0143('0x74'))[_0x0143('0x6e')]('cm_hopper')[_0x0143('0x3c')](_0x0143('0x73'),_0x5aab86['params']['id'][_0x0143('0x6c')]())))['toString']();break;default:_0x2b2012=squel['insert']()[_0x0143('0x64')](_0x0143('0x77'))[_0x0143('0x65')]([_0x0143('0x66'),_0x0143('0x67'),_0x0143('0x68'),_0x0143('0x6d'),_0x0143('0x57'),_0x0143('0x4f'),_0x0143('0x50')],squel[_0x0143('0x69')]()[_0x0143('0x6a')](_0x0143('0x66'),_0x0143('0x66'))[_0x0143('0x6a')](_0x0143('0x6b'),_0x0143('0x67'))[_0x0143('0x6a')]('id',_0x0143('0x68'))['field'](_0x5a7d46[_0x0143('0x71')]['toString'](),_0x0143('0x6d'))[_0x0143('0x6a')](_0x5aab86[_0x0143('0x53')]['id'][_0x0143('0x6c')](),'CampaignId')[_0x0143('0x6a')](_0x0143('0x6b'),_0x0143('0x4f'))['field'](_0x0143('0x6b'),_0x0143('0x50'))[_0x0143('0x6e')](_0x0143('0x6f'))['where'](_0x0143('0x70'))['where'](_0x0143('0x78'),_0x5a7d46[_0x0143('0x71')][_0x0143('0x6c')]())[_0x0143('0x3c')](_0x0143('0x79')))[_0x0143('0x6c')]();}_0x485eb0['push'](db['sequelize']['query'](_0x2b2012));}return BPromise[_0x0143('0x7a')](_0x485eb0);}})['then'](function(){return _0x2e6be3;})[_0x0143('0x23')](respondWithResult(_0x3175b9,null))[_0x0143('0x46')](handleError(_0x3175b9,null));};exports[_0x0143('0x7b')]=function(_0x1546f1,_0x17caae,_0x485f0f){return db[_0x0143('0x2c')][_0x0143('0x4d')]({'where':{'id':_0x1546f1['params']['id']}})[_0x0143('0x23')](handleEntityNotFound(_0x17caae,null))[_0x0143('0x23')](function(_0xd3fdd2){if(_0xd3fdd2){return _0xd3fdd2['removeLists'](_0x1546f1[_0x0143('0x32')][_0x0143('0x61')]);}})[_0x0143('0x23')](function(_0x4a6c4c){if(_0x4a6c4c){return db['CmHopper']['destroy']({'where':{'ListId':_0x1546f1['query'][_0x0143('0x61')],'CampaignId':_0x1546f1[_0x0143('0x53')]['id']}})[_0x0143('0x23')](function(){return _0x4a6c4c;});}})[_0x0143('0x23')](respondWithStatusCode(_0x17caae,null))[_0x0143('0x46')](handleError(_0x17caae,null));};exports[_0x0143('0x7c')]=function(_0x312bfe,_0x34f2a8,_0x150966){var _0x16b1c3={};var _0x288324={};var _0x5b5030;var _0x29d162;return db['Campaign'][_0x0143('0x55')]({'where':{'id':_0x312bfe[_0x0143('0x53')]['id']}})[_0x0143('0x23')](handleEntityNotFound(_0x34f2a8,null))[_0x0143('0x23')](function(_0x5194b2){if(_0x5194b2){_0x5b5030=_0x5194b2;_0x288324[_0x0143('0x30')]=_[_0x0143('0x33')](db[_0x0143('0x5e')][_0x0143('0x2d')]);_0x288324[_0x0143('0x32')]=_[_0x0143('0x33')](_0x312bfe[_0x0143('0x32')]);_0x288324[_0x0143('0x34')]=_[_0x0143('0x35')](_0x288324[_0x0143('0x30')],_0x288324[_0x0143('0x32')]);_0x16b1c3[_0x0143('0x38')]=_[_0x0143('0x35')](_0x288324['model'],qs[_0x0143('0x36')](_0x312bfe[_0x0143('0x32')][_0x0143('0x36')]));_0x16b1c3['attributes']=_0x16b1c3[_0x0143('0x38')]['length']?_0x16b1c3[_0x0143('0x38')]:_0x288324['model'];_0x16b1c3['order']=qs[_0x0143('0x3b')](_0x312bfe[_0x0143('0x32')][_0x0143('0x3b')]);_0x16b1c3['where']=qs[_0x0143('0x34')](_[_0x0143('0x3d')](_0x312bfe[_0x0143('0x32')],_0x288324[_0x0143('0x34')]));if(_0x312bfe[_0x0143('0x32')][_0x0143('0x3f')]){_0x16b1c3[_0x0143('0x3c')]=_[_0x0143('0x40')](_0x16b1c3['where'],{'$or':_[_0x0143('0x31')](_0x16b1c3[_0x0143('0x38')],function(_0x427840){var _0x4a0457={};_0x4a0457[_0x427840]={'$like':'%'+_0x312bfe[_0x0143('0x32')][_0x0143('0x3f')]+'%'};return _0x4a0457;})});}_0x16b1c3=_[_0x0143('0x40')]({},_0x16b1c3,_0x312bfe[_0x0143('0x41')]);return _0x5b5030[_0x0143('0x7c')](_0x16b1c3);}})[_0x0143('0x23')](function(_0x14bbcb){if(_0x14bbcb){_0x29d162=_0x14bbcb[_0x0143('0x37')];if(!_0x312bfe[_0x0143('0x32')][_0x0143('0x39')](_0x0143('0x3a'))){_0x16b1c3['limit']=qs['limit'](_0x312bfe[_0x0143('0x32')][_0x0143('0x1b')]);_0x16b1c3[_0x0143('0x19')]=qs['offset'](_0x312bfe[_0x0143('0x32')][_0x0143('0x19')]);}return _0x5b5030[_0x0143('0x7c')](_0x16b1c3);}})[_0x0143('0x23')](function(_0x28c368){if(_0x28c368){return _0x28c368?{'count':_0x29d162,'rows':_0x28c368}:null;}})[_0x0143('0x23')](respondWithResult(_0x34f2a8,null))[_0x0143('0x46')](handleError(_0x34f2a8,null));};exports['addBlackLists']=function(_0x38fb57,_0x4f1693,_0x5e9193){var _0x51641b,_0x1d6aa9;return db[_0x0143('0x2c')][_0x0143('0x4d')]({'where':{'id':_0x38fb57[_0x0143('0x53')]['id']}})[_0x0143('0x23')](handleEntityNotFound(_0x4f1693,null))[_0x0143('0x23')](function(_0xe969db){if(_0xe969db){_0x1d6aa9=_0xe969db;return _0xe969db['addBlackLists'](_0x38fb57[_0x0143('0x48')][_0x0143('0x61')],_[_0x0143('0x4e')](_0x38fb57['body'],['ids','id'])||{});}return null;})[_0x0143('0x7d')](function(_0x177c8c){var _0x2a041a;_0x51641b=_0x177c8c||[];var _0x5f3d44=[];if(_0x177c8c){for(var _0xdc7db5=0x0;_0xdc7db5<_0x177c8c[_0x0143('0x37')];_0xdc7db5+=0x1){var _0x3dfe65=_0x177c8c[_0xdc7db5][_0x0143('0x49')]({'plain':!![]});_0x2a041a=squel['insert']()[_0x0143('0x64')](_0x0143('0x7e'))[_0x0143('0x65')]([_0x0143('0x66'),'ContactId','ListId',_0x0143('0x57'),_0x0143('0x4f'),_0x0143('0x50')],squel[_0x0143('0x69')]()[_0x0143('0x6a')](_0x0143('0x66'),_0x0143('0x66'))[_0x0143('0x6a')]('id',_0x0143('0x68'))[_0x0143('0x6a')](_0x3dfe65[_0x0143('0x71')][_0x0143('0x6c')](),_0x0143('0x6d'))[_0x0143('0x6a')](_0x38fb57[_0x0143('0x53')]['id'][_0x0143('0x6c')](),_0x0143('0x57'))[_0x0143('0x6a')](_0x0143('0x6b'),'createdAt')[_0x0143('0x6a')](_0x0143('0x6b'),_0x0143('0x50'))[_0x0143('0x6e')](_0x0143('0x6f'))[_0x0143('0x3c')](_0x0143('0x70'))[_0x0143('0x3c')](_0x0143('0x78'),_0x3dfe65[_0x0143('0x71')]['toString']())['where']('phone\x20IS\x20NOT\x20NULL'))[_0x0143('0x6c')]();_0x5f3d44[_0x0143('0x7f')](db['sequelize'][_0x0143('0x32')](_0x2a041a));}return BPromise[_0x0143('0x7a')](_0x5f3d44);}})[_0x0143('0x23')](function(){return _0x51641b;})['then'](respondWithResult(_0x4f1693,null))[_0x0143('0x46')](handleError(_0x4f1693,null));};exports[_0x0143('0x80')]=function(_0x302e5c,_0x334f68,_0x121e4a){return db[_0x0143('0x2c')][_0x0143('0x4d')]({'where':{'id':_0x302e5c['params']['id']}})[_0x0143('0x23')](handleEntityNotFound(_0x334f68,null))[_0x0143('0x23')](function(_0x5bd518){if(_0x5bd518){return _0x5bd518['removeBlackLists'](_0x302e5c['query'][_0x0143('0x61')]);}})['then'](function(_0x4637ab){if(_0x4637ab){return db[_0x0143('0x5d')]['destroy']({'where':{'ListId':_0x302e5c[_0x0143('0x32')]['ids'],'CampaignId':_0x302e5c['params']['id']}})[_0x0143('0x23')](function(){return _0x4637ab;});}})[_0x0143('0x23')](respondWithStatusCode(_0x334f68,null))['catch'](handleError(_0x334f68,null));}; \ No newline at end of file +var _0xc040=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','undefined','count','offset','limit','set','Content-Range','json','apply','reject','update','then','destroy','get','IvrCampaigns','UserProfileResource','status','stack','name','index','map','rawAttributes','fieldName','type','key','query','keys','model','intersection','fields','attributes','length','hasOwnProperty','order','sort','filters','pick','filter','where','merge','VIRTUAL','Campaign','includeAll','findAll','rows','show','params','include','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','create','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','options','find','createdAt','omit','updatedAt','role','catch','getHoppers','findOne','CmHopper','nolimit','CampaignId','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','CmHopperBlack','CmList','getLists','addLists','ids','dialCheckDuplicateType','always','insert','into','cm_hopper','phone','scheduledAt','ListId','field','NOW()','ContactId','CmListId','toString','from','cm_contacts','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','select','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','onlyIfOpen','deletedAt\x20IS\x20NULL','fromQuery','push','sequelize','all','removeLists','getBlackLists','addBlackLists','spread','removeBlackLists','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring'];(function(_0x20ef64,_0x4a8fe9){var _0x3707d8=function(_0x5b9a88){while(--_0x5b9a88){_0x20ef64['push'](_0x20ef64['shift']());}};_0x3707d8(++_0x4a8fe9);}(_0xc040,0x195));var _0x0c04=function(_0x144357,_0x3c5283){_0x144357=_0x144357-0x0;var _0x48339c=_0xc040[_0x144357];return _0x48339c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0c04('0x0'));var zipdir=require(_0x0c04('0x1'));var jsonpatch=require(_0x0c04('0x2'));var rp=require('request-promise');var moment=require(_0x0c04('0x3'));var BPromise=require(_0x0c04('0x4'));var Mustache=require(_0x0c04('0x5'));var util=require(_0x0c04('0x6'));var path=require(_0x0c04('0x7'));var sox=require(_0x0c04('0x8'));var csv=require(_0x0c04('0x9'));var ejs=require(_0x0c04('0xa'));var fs=require('fs');var fs_extra=require(_0x0c04('0xb'));var _=require(_0x0c04('0xc'));var squel=require(_0x0c04('0xd'));var crypto=require(_0x0c04('0xe'));var jsforce=require(_0x0c04('0xf'));var deskjs=require(_0x0c04('0x10'));var toCsv=require(_0x0c04('0x9'));var querystring=require(_0x0c04('0x11'));var Papa=require(_0x0c04('0x12'));var Redis=require(_0x0c04('0x13'));var authService=require(_0x0c04('0x14'));var qs=require(_0x0c04('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x0c04('0x16'));var utils=require(_0x0c04('0x17'));var config=require(_0x0c04('0x18'));var licenseUtil=require(_0x0c04('0x19'));var db=require(_0x0c04('0x1a'))['db'];function respondWithStatusCode(_0x5db1bb,_0x3b337c){_0x3b337c=_0x3b337c||0xcc;return function(_0x22a803){if(_0x22a803){return _0x5db1bb[_0x0c04('0x1b')](_0x3b337c);}return _0x5db1bb['status'](_0x3b337c)[_0x0c04('0x1c')]();};}function respondWithResult(_0xfb2145,_0x3bbe20){_0x3bbe20=_0x3bbe20||0xc8;return function(_0x10ac73){if(_0x10ac73){return _0xfb2145['status'](_0x3bbe20)['json'](_0x10ac73);}};}function respondWithFilteredResult(_0x2e23fa,_0x38af95){return function(_0x2fcbbd){if(_0x2fcbbd){var _0x56ccd1=typeof _0x38af95['offset']===_0x0c04('0x1d')&&typeof _0x38af95['limit']===_0x0c04('0x1d');var _0x5a1111=_0x2fcbbd[_0x0c04('0x1e')];var _0xea741f=_0x56ccd1?0x0:_0x38af95['offset'];var _0x6fe1a7=_0x56ccd1?_0x2fcbbd[_0x0c04('0x1e')]:_0x38af95[_0x0c04('0x1f')]+_0x38af95[_0x0c04('0x20')];var _0x34f32d;if(_0x6fe1a7>=_0x5a1111){_0x6fe1a7=_0x5a1111;_0x34f32d=0xc8;}else{_0x34f32d=0xce;}_0x2e23fa['status'](_0x34f32d);return _0x2e23fa[_0x0c04('0x21')](_0x0c04('0x22'),_0xea741f+'-'+_0x6fe1a7+'/'+_0x5a1111)[_0x0c04('0x23')](_0x2fcbbd);}return null;};}function patchUpdates(_0x5562fd){return function(_0x35d0da){try{jsonpatch[_0x0c04('0x24')](_0x35d0da,_0x5562fd,!![]);}catch(_0x471a95){return BPromise[_0x0c04('0x25')](_0x471a95);}return _0x35d0da['save']();};}function saveUpdates(_0x462ed2,_0x42d3db){return function(_0x478363){if(_0x478363){return _0x478363[_0x0c04('0x26')](_0x462ed2)[_0x0c04('0x27')](function(_0x5200f5){return _0x5200f5;});}return null;};}function removeEntity(_0x5637bb,_0x2ec995){return function(_0x269883){if(_0x269883){return _0x269883[_0x0c04('0x28')]()['then'](function(){var _0x1bec7e=_0x269883[_0x0c04('0x29')]({'plain':!![]});var _0x162f98=_0x0c04('0x2a');return db[_0x0c04('0x2b')][_0x0c04('0x28')]({'where':{'type':_0x162f98,'resourceId':_0x1bec7e['id']}})['then'](function(){return _0x269883;});})['then'](function(){_0x5637bb[_0x0c04('0x2c')](0xcc)[_0x0c04('0x1c')]();});}};}function handleEntityNotFound(_0x3ab49c,_0x166195){return function(_0x298df8){if(!_0x298df8){_0x3ab49c[_0x0c04('0x1b')](0x194);}return _0x298df8;};}function handleError(_0x429738,_0x2b8f53){_0x2b8f53=_0x2b8f53||0x1f4;return function(_0x21968c){logger['error'](_0x21968c[_0x0c04('0x2d')]);if(_0x21968c[_0x0c04('0x2e')]){delete _0x21968c[_0x0c04('0x2e')];}_0x429738[_0x0c04('0x2c')](_0x2b8f53)['send'](_0x21968c);};}exports[_0x0c04('0x2f')]=function(_0x3cb32f,_0x58ceeb){var _0x418258={},_0x491eab={},_0x5cc40a={'count':0x0,'rows':[]};var _0x2fd367=_[_0x0c04('0x30')](db['Campaign'][_0x0c04('0x31')],function(_0x1aa907){return{'name':_0x1aa907[_0x0c04('0x32')],'type':_0x1aa907[_0x0c04('0x33')][_0x0c04('0x34')]};});_0x491eab['model']=_['map'](_0x2fd367,_0x0c04('0x2e'));_0x491eab[_0x0c04('0x35')]=_[_0x0c04('0x36')](_0x3cb32f[_0x0c04('0x35')]);_0x491eab['filters']=_['intersection'](_0x491eab[_0x0c04('0x37')],_0x491eab[_0x0c04('0x35')]);_0x418258['attributes']=_[_0x0c04('0x38')](_0x491eab['model'],qs[_0x0c04('0x39')](_0x3cb32f[_0x0c04('0x35')][_0x0c04('0x39')]));_0x418258[_0x0c04('0x3a')]=_0x418258[_0x0c04('0x3a')][_0x0c04('0x3b')]?_0x418258[_0x0c04('0x3a')]:_0x491eab[_0x0c04('0x37')];if(!_0x3cb32f[_0x0c04('0x35')][_0x0c04('0x3c')]('nolimit')){_0x418258['limit']=qs[_0x0c04('0x20')](_0x3cb32f[_0x0c04('0x35')]['limit']);_0x418258[_0x0c04('0x1f')]=qs[_0x0c04('0x1f')](_0x3cb32f[_0x0c04('0x35')]['offset']);}_0x418258[_0x0c04('0x3d')]=qs['sort'](_0x3cb32f['query'][_0x0c04('0x3e')]);_0x418258['where']=qs[_0x0c04('0x3f')](_[_0x0c04('0x40')](_0x3cb32f[_0x0c04('0x35')],_0x491eab['filters']),_0x2fd367);if(_0x3cb32f[_0x0c04('0x35')][_0x0c04('0x41')]){_0x418258[_0x0c04('0x42')]=_[_0x0c04('0x43')](_0x418258['where'],{'$or':_[_0x0c04('0x30')](_0x2fd367,function(_0x44d370){if(_0x44d370[_0x0c04('0x33')]!==_0x0c04('0x44')){var _0x50451e={};_0x50451e[_0x44d370['name']]={'$like':'%'+_0x3cb32f[_0x0c04('0x35')]['filter']+'%'};return _0x50451e;}})});}_0x418258=_[_0x0c04('0x43')]({},_0x418258,_0x3cb32f['options']);var _0x16efb9={'where':_0x418258[_0x0c04('0x42')]};return db[_0x0c04('0x45')][_0x0c04('0x1e')](_0x16efb9)[_0x0c04('0x27')](function(_0x5ac906){_0x5cc40a[_0x0c04('0x1e')]=_0x5ac906;if(_0x3cb32f[_0x0c04('0x35')][_0x0c04('0x46')]){_0x418258['include']=[{'all':!![]}];}return db[_0x0c04('0x45')][_0x0c04('0x47')](_0x418258);})[_0x0c04('0x27')](function(_0x4f58a2){_0x5cc40a[_0x0c04('0x48')]=_0x4f58a2;return _0x5cc40a;})[_0x0c04('0x27')](respondWithFilteredResult(_0x58ceeb,_0x418258))['catch'](handleError(_0x58ceeb,null));};exports[_0x0c04('0x49')]=function(_0x2f5e77,_0x285fad){var _0x2530e8={'raw':![],'where':{'id':_0x2f5e77[_0x0c04('0x4a')]['id']}},_0x34c824={};_0x34c824[_0x0c04('0x37')]=_[_0x0c04('0x36')](db[_0x0c04('0x45')][_0x0c04('0x31')]);_0x34c824[_0x0c04('0x35')]=_['keys'](_0x2f5e77[_0x0c04('0x35')]);_0x34c824[_0x0c04('0x3f')]=_['intersection'](_0x34c824[_0x0c04('0x37')],_0x34c824['query']);_0x2530e8['attributes']=_['intersection'](_0x34c824[_0x0c04('0x37')],qs[_0x0c04('0x39')](_0x2f5e77['query'][_0x0c04('0x39')]));_0x2530e8['attributes']=_0x2530e8[_0x0c04('0x3a')][_0x0c04('0x3b')]?_0x2530e8['attributes']:_0x34c824[_0x0c04('0x37')];if(_0x2f5e77[_0x0c04('0x35')]['includeAll']){_0x2530e8[_0x0c04('0x4b')]=[{'all':!![]}];}_0x2530e8=_[_0x0c04('0x43')]({},_0x2530e8,_0x2f5e77['options']);return db[_0x0c04('0x45')]['find'](_0x2530e8)[_0x0c04('0x27')](handleEntityNotFound(_0x285fad,null))[_0x0c04('0x27')](respondWithResult(_0x285fad,null))['catch'](handleError(_0x285fad,null));};exports['create']=function(_0x1ea21f,_0x1e7eb1){return db[_0x0c04('0x45')]['create'](_0x1ea21f[_0x0c04('0x4c')],{})[_0x0c04('0x27')](function(_0x24cc5f){var _0x36aa22=_0x1ea21f['user'][_0x0c04('0x29')]({'plain':!![]});if(!_0x36aa22)throw new Error(_0x0c04('0x4d'));if(_0x36aa22['role']===_0x0c04('0x4e')){var _0x36f2fd=_0x24cc5f[_0x0c04('0x29')]({'plain':!![]});var _0x488a6e=_0x0c04('0x2a');return db[_0x0c04('0x4f')]['find']({'where':{'name':_0x488a6e,'userProfileId':_0x36aa22[_0x0c04('0x50')]},'raw':!![]})[_0x0c04('0x27')](function(_0x4c84ec){if(_0x4c84ec&&_0x4c84ec[_0x0c04('0x51')]===0x0){return db[_0x0c04('0x2b')][_0x0c04('0x52')]({'name':_0x36f2fd[_0x0c04('0x2e')],'resourceId':_0x36f2fd['id'],'type':_0x4c84ec[_0x0c04('0x2e')],'sectionId':_0x4c84ec['id']},{})[_0x0c04('0x27')](function(){return _0x24cc5f;});}else{return _0x24cc5f;}})['catch'](function(_0x24886f){logger[_0x0c04('0x53')](_0x0c04('0x54'),_0x24886f);throw _0x24886f;});}return _0x24cc5f;})[_0x0c04('0x27')](respondWithResult(_0x1e7eb1,0xc9))['catch'](handleError(_0x1e7eb1,null));};exports[_0x0c04('0x55')]=function(_0x4f31c9,_0x3f0df8){var _0x3aeedc={'where':{'id':_0x4f31c9[_0x0c04('0x4a')]['id']}},_0x8ba408={};_0x8ba408[_0x0c04('0x37')]=_[_0x0c04('0x36')](db[_0x0c04('0x45')][_0x0c04('0x31')]);_0x3aeedc[_0x0c04('0x3a')]=_[_0x0c04('0x38')](_0x8ba408[_0x0c04('0x37')],qs['fields'](_0x4f31c9[_0x0c04('0x35')][_0x0c04('0x39')]));_0x3aeedc[_0x0c04('0x3a')]=_0x3aeedc[_0x0c04('0x3a')][_0x0c04('0x3b')]?_0x3aeedc['attributes']:_0x8ba408[_0x0c04('0x37')];if(_0x4f31c9[_0x0c04('0x35')][_0x0c04('0x46')]){_0x3aeedc['include']=[{'all':!![]}];}_0x3aeedc=_[_0x0c04('0x43')]({},_0x3aeedc,_0x4f31c9[_0x0c04('0x56')]);return db[_0x0c04('0x45')][_0x0c04('0x57')](_0x3aeedc)[_0x0c04('0x27')](handleEntityNotFound(_0x3f0df8,null))['then'](function(_0x518019){if(_0x518019){var _0x57d7b3=_0x518019[_0x0c04('0x29')]({'plain':!![]});_0x57d7b3=qs['omit'](_0x57d7b3,['id',_0x0c04('0x58'),'updatedAt']);_0x4f31c9['body']=_[_0x0c04('0x59')](_0x4f31c9['body'],['id','createdAt',_0x0c04('0x5a')]);return db['Campaign'][_0x0c04('0x52')](_['merge'](_0x57d7b3,_0x4f31c9['body']),{'include':_0x4f31c9[_0x0c04('0x35')][_0x0c04('0x46')]?[{'all':!![]}]:undefined})[_0x0c04('0x27')](function(_0x57a000){var _0x1eb5c4=_0x4f31c9[_0x0c04('0x4e')][_0x0c04('0x29')]({'plain':!![]});if(!_0x1eb5c4)throw new Error(_0x0c04('0x4d'));if(_0x1eb5c4[_0x0c04('0x5b')]==='user'){var _0x5bc7e5=_0x57a000[_0x0c04('0x29')]({'plain':!![]});var _0x2d0491=_0x0c04('0x2a');return db[_0x0c04('0x4f')][_0x0c04('0x57')]({'where':{'name':_0x2d0491,'userProfileId':_0x1eb5c4[_0x0c04('0x50')]},'raw':!![]})[_0x0c04('0x27')](function(_0x5b6941){if(_0x5b6941&&_0x5b6941[_0x0c04('0x51')]===0x0){return db[_0x0c04('0x2b')][_0x0c04('0x52')]({'name':_0x5bc7e5[_0x0c04('0x2e')],'resourceId':_0x5bc7e5['id'],'type':_0x5b6941[_0x0c04('0x2e')],'sectionId':_0x5b6941['id']},{})[_0x0c04('0x27')](function(){return _0x57a000;});}else{return _0x57a000;}})['catch'](function(_0x27fcd4){logger[_0x0c04('0x53')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x27fcd4);throw _0x27fcd4;});}return _0x57a000;});}})[_0x0c04('0x27')](respondWithResult(_0x3f0df8,0xc9))[_0x0c04('0x5c')](handleError(_0x3f0df8,null));};exports[_0x0c04('0x26')]=function(_0x474756,_0x41e004){if(_0x474756[_0x0c04('0x4c')]['id']){delete _0x474756['body']['id'];}return db[_0x0c04('0x45')][_0x0c04('0x57')]({'where':{'id':_0x474756[_0x0c04('0x4a')]['id']}})[_0x0c04('0x27')](handleEntityNotFound(_0x41e004,null))[_0x0c04('0x27')](saveUpdates(_0x474756[_0x0c04('0x4c')],null))['then'](respondWithResult(_0x41e004,null))['catch'](handleError(_0x41e004,null));};exports[_0x0c04('0x28')]=function(_0x449ea9,_0x3394fa){return db[_0x0c04('0x45')]['find']({'where':{'id':_0x449ea9[_0x0c04('0x4a')]['id']}})[_0x0c04('0x27')](handleEntityNotFound(_0x3394fa,null))[_0x0c04('0x27')](removeEntity(_0x3394fa,null))[_0x0c04('0x5c')](handleError(_0x3394fa,null));};exports[_0x0c04('0x5d')]=function(_0x1dd840,_0x3fa853,_0x32dec4){var _0x1162b3={'raw':!![],'where':{}};var _0x21f84b={};var _0x5d2447={'count':0x0,'rows':[]};return db[_0x0c04('0x45')][_0x0c04('0x5e')]({'where':{'id':_0x1dd840[_0x0c04('0x4a')]['id']}})[_0x0c04('0x27')](handleEntityNotFound(_0x3fa853,null))[_0x0c04('0x27')](function(_0x400b18){if(_0x400b18){_0x21f84b[_0x0c04('0x37')]=_[_0x0c04('0x36')](db[_0x0c04('0x5f')]['rawAttributes']);_0x21f84b[_0x0c04('0x35')]=_[_0x0c04('0x36')](_0x1dd840['query']);_0x21f84b[_0x0c04('0x3f')]=_[_0x0c04('0x38')](_0x21f84b[_0x0c04('0x37')],_0x21f84b['query']);_0x1162b3[_0x0c04('0x3a')]=_[_0x0c04('0x38')](_0x21f84b[_0x0c04('0x37')],qs[_0x0c04('0x39')](_0x1dd840['query'][_0x0c04('0x39')]));_0x1162b3[_0x0c04('0x3a')]=_0x1162b3[_0x0c04('0x3a')][_0x0c04('0x3b')]?_0x1162b3[_0x0c04('0x3a')]:_0x21f84b[_0x0c04('0x37')];if(!_0x1dd840['query'][_0x0c04('0x3c')](_0x0c04('0x60'))){_0x1162b3['limit']=qs['limit'](_0x1dd840[_0x0c04('0x35')][_0x0c04('0x20')]);_0x1162b3['offset']=qs[_0x0c04('0x1f')](_0x1dd840['query'][_0x0c04('0x1f')]);}_0x1162b3['order']=qs[_0x0c04('0x3e')](_0x1dd840['query']['sort']);_0x1162b3['where']=qs['filters'](_[_0x0c04('0x40')](_0x1dd840[_0x0c04('0x35')],_0x21f84b[_0x0c04('0x3f')]));_0x1162b3[_0x0c04('0x42')][_0x0c04('0x61')]=_0x400b18['id'];if(_0x1dd840[_0x0c04('0x35')]['filter']){_0x1162b3[_0x0c04('0x42')]=_[_0x0c04('0x43')](_0x1162b3[_0x0c04('0x42')],{'$or':_[_0x0c04('0x30')](_0x1162b3[_0x0c04('0x3a')],function(_0x1a6200){var _0xb5260={};_0xb5260[_0x1a6200]={'$like':'%'+_0x1dd840[_0x0c04('0x35')][_0x0c04('0x41')]+'%'};return _0xb5260;})});}_0x1162b3=_[_0x0c04('0x43')]({},_0x1162b3,_0x1dd840['options']);return db[_0x0c04('0x5f')][_0x0c04('0x1e')]({'where':_0x1162b3['where']})[_0x0c04('0x27')](function(_0x5a2c6b){_0x5d2447['count']=_0x5a2c6b;if(_0x1dd840[_0x0c04('0x35')]['includeAll']){_0x1162b3[_0x0c04('0x4b')]=[{'all':!![]}];}return db[_0x0c04('0x5f')][_0x0c04('0x47')](_0x1162b3);})[_0x0c04('0x27')](function(_0x57dc7c){_0x5d2447[_0x0c04('0x48')]=_0x57dc7c;return _0x5d2447;});}})[_0x0c04('0x27')](respondWithFilteredResult(_0x3fa853,_0x1162b3))[_0x0c04('0x5c')](handleError(_0x3fa853,null));};exports[_0x0c04('0x62')]=function(_0x521473,_0x531f82,_0x16f3da){var _0x135342={'raw':!![],'where':{}};var _0x5a8217={};var _0x1ac2a8={'count':0x0,'rows':[]};return db['Campaign'][_0x0c04('0x5e')]({'where':{'id':_0x521473[_0x0c04('0x4a')]['id']}})[_0x0c04('0x27')](handleEntityNotFound(_0x531f82,null))[_0x0c04('0x27')](function(_0x5caa89){if(_0x5caa89){_0x5a8217[_0x0c04('0x37')]=_['keys'](db[_0x0c04('0x63')][_0x0c04('0x31')]);_0x5a8217[_0x0c04('0x35')]=_[_0x0c04('0x36')](_0x521473[_0x0c04('0x35')]);_0x5a8217[_0x0c04('0x3f')]=_[_0x0c04('0x38')](_0x5a8217[_0x0c04('0x37')],_0x5a8217['query']);_0x135342[_0x0c04('0x3a')]=_[_0x0c04('0x38')](_0x5a8217[_0x0c04('0x37')],qs[_0x0c04('0x39')](_0x521473['query'][_0x0c04('0x39')]));_0x135342[_0x0c04('0x3a')]=_0x135342[_0x0c04('0x3a')][_0x0c04('0x3b')]?_0x135342['attributes']:_0x5a8217['model'];if(!_0x521473['query']['hasOwnProperty'](_0x0c04('0x60'))){_0x135342[_0x0c04('0x20')]=qs[_0x0c04('0x20')](_0x521473[_0x0c04('0x35')][_0x0c04('0x20')]);_0x135342[_0x0c04('0x1f')]=qs[_0x0c04('0x1f')](_0x521473['query'][_0x0c04('0x1f')]);}_0x135342['order']=qs['sort'](_0x521473[_0x0c04('0x35')][_0x0c04('0x3e')]);_0x135342[_0x0c04('0x42')]=qs[_0x0c04('0x3f')](_[_0x0c04('0x40')](_0x521473[_0x0c04('0x35')],_0x5a8217[_0x0c04('0x3f')]));_0x135342['where']['CampaignId']=_0x5caa89['id'];if(_0x521473[_0x0c04('0x35')][_0x0c04('0x41')]){_0x135342[_0x0c04('0x42')]=_['merge'](_0x135342[_0x0c04('0x42')],{'$or':_[_0x0c04('0x30')](_0x135342[_0x0c04('0x3a')],function(_0x169f03){var _0x2517d7={};_0x2517d7[_0x169f03]={'$like':'%'+_0x521473['query'][_0x0c04('0x41')]+'%'};return _0x2517d7;})});}_0x135342=_['merge']({},_0x135342,_0x521473[_0x0c04('0x56')]);return db[_0x0c04('0x63')]['count']({'where':_0x135342[_0x0c04('0x42')]})[_0x0c04('0x27')](function(_0x390851){_0x1ac2a8[_0x0c04('0x1e')]=_0x390851;if(_0x521473[_0x0c04('0x35')][_0x0c04('0x46')]){_0x135342[_0x0c04('0x4b')]=[{'all':!![]}];}return db['CmHopperHistory'][_0x0c04('0x47')](_0x135342);})[_0x0c04('0x27')](function(_0x21acde){_0x1ac2a8[_0x0c04('0x48')]=_0x21acde;return _0x1ac2a8;});}})[_0x0c04('0x27')](respondWithFilteredResult(_0x531f82,_0x135342))['catch'](handleError(_0x531f82,null));};exports[_0x0c04('0x64')]=function(_0x58d92d,_0x3de362,_0x569ce9){var _0x58342b={'raw':!![],'where':{}};var _0x4fa2f5={};var _0x2c4797={'count':0x0,'rows':[]};return db[_0x0c04('0x45')][_0x0c04('0x5e')]({'where':{'id':_0x58d92d[_0x0c04('0x4a')]['id']}})[_0x0c04('0x27')](handleEntityNotFound(_0x3de362,null))['then'](function(_0x1b326a){if(_0x1b326a){_0x4fa2f5[_0x0c04('0x37')]=_[_0x0c04('0x36')](db[_0x0c04('0x65')][_0x0c04('0x31')]);_0x4fa2f5[_0x0c04('0x35')]=_['keys'](_0x58d92d['query']);_0x4fa2f5[_0x0c04('0x3f')]=_[_0x0c04('0x38')](_0x4fa2f5['model'],_0x4fa2f5[_0x0c04('0x35')]);_0x58342b[_0x0c04('0x3a')]=_[_0x0c04('0x38')](_0x4fa2f5[_0x0c04('0x37')],qs['fields'](_0x58d92d[_0x0c04('0x35')][_0x0c04('0x39')]));_0x58342b[_0x0c04('0x3a')]=_0x58342b[_0x0c04('0x3a')]['length']?_0x58342b[_0x0c04('0x3a')]:_0x4fa2f5[_0x0c04('0x37')];if(!_0x58d92d['query']['hasOwnProperty']('nolimit')){_0x58342b['limit']=qs[_0x0c04('0x20')](_0x58d92d[_0x0c04('0x35')][_0x0c04('0x20')]);_0x58342b[_0x0c04('0x1f')]=qs[_0x0c04('0x1f')](_0x58d92d[_0x0c04('0x35')][_0x0c04('0x1f')]);}_0x58342b[_0x0c04('0x3d')]=qs['sort'](_0x58d92d[_0x0c04('0x35')]['sort']);_0x58342b['where']=qs[_0x0c04('0x3f')](_[_0x0c04('0x40')](_0x58d92d[_0x0c04('0x35')],_0x4fa2f5['filters']));_0x58342b[_0x0c04('0x42')][_0x0c04('0x61')]=_0x1b326a['id'];if(_0x58d92d[_0x0c04('0x35')][_0x0c04('0x41')]){_0x58342b[_0x0c04('0x42')]=_[_0x0c04('0x43')](_0x58342b['where'],{'$or':_['map'](_0x58342b[_0x0c04('0x3a')],function(_0xe7e27a){var _0x1ec971={};_0x1ec971[_0xe7e27a]={'$like':'%'+_0x58d92d[_0x0c04('0x35')][_0x0c04('0x41')]+'%'};return _0x1ec971;})});}_0x58342b=_[_0x0c04('0x43')]({},_0x58342b,_0x58d92d[_0x0c04('0x56')]);return db[_0x0c04('0x65')][_0x0c04('0x1e')]({'where':_0x58342b['where']})[_0x0c04('0x27')](function(_0x4e7b4f){_0x2c4797['count']=_0x4e7b4f;if(_0x58d92d[_0x0c04('0x35')]['includeAll']){_0x58342b[_0x0c04('0x4b')]=[{'all':!![]}];}return db['CmHopperFinal'][_0x0c04('0x47')](_0x58342b);})[_0x0c04('0x27')](function(_0x290272){_0x2c4797[_0x0c04('0x48')]=_0x290272;return _0x2c4797;});}})['then'](respondWithFilteredResult(_0x3de362,_0x58342b))[_0x0c04('0x5c')](handleError(_0x3de362,null));};exports['getHopperBlacks']=function(_0x5b96fd,_0x502ef9,_0x50b272){var _0x2e8db7={'raw':!![],'where':{}};var _0x4af3be={};var _0x37e95a={'count':0x0,'rows':[]};return db[_0x0c04('0x45')]['findOne']({'where':{'id':_0x5b96fd[_0x0c04('0x4a')]['id']}})[_0x0c04('0x27')](handleEntityNotFound(_0x502ef9,null))['then'](function(_0x4f7c1f){if(_0x4f7c1f){_0x4af3be[_0x0c04('0x37')]=_[_0x0c04('0x36')](db[_0x0c04('0x66')][_0x0c04('0x31')]);_0x4af3be[_0x0c04('0x35')]=_[_0x0c04('0x36')](_0x5b96fd[_0x0c04('0x35')]);_0x4af3be['filters']=_['intersection'](_0x4af3be[_0x0c04('0x37')],_0x4af3be[_0x0c04('0x35')]);_0x2e8db7['attributes']=_[_0x0c04('0x38')](_0x4af3be[_0x0c04('0x37')],qs[_0x0c04('0x39')](_0x5b96fd[_0x0c04('0x35')][_0x0c04('0x39')]));_0x2e8db7[_0x0c04('0x3a')]=_0x2e8db7['attributes'][_0x0c04('0x3b')]?_0x2e8db7[_0x0c04('0x3a')]:_0x4af3be[_0x0c04('0x37')];if(!_0x5b96fd[_0x0c04('0x35')][_0x0c04('0x3c')]('nolimit')){_0x2e8db7[_0x0c04('0x20')]=qs['limit'](_0x5b96fd['query'][_0x0c04('0x20')]);_0x2e8db7[_0x0c04('0x1f')]=qs[_0x0c04('0x1f')](_0x5b96fd[_0x0c04('0x35')][_0x0c04('0x1f')]);}_0x2e8db7[_0x0c04('0x3d')]=qs['sort'](_0x5b96fd['query'][_0x0c04('0x3e')]);_0x2e8db7[_0x0c04('0x42')]=qs[_0x0c04('0x3f')](_['pick'](_0x5b96fd['query'],_0x4af3be['filters']));_0x2e8db7['where'][_0x0c04('0x61')]=_0x4f7c1f['id'];if(_0x5b96fd['query'][_0x0c04('0x41')]){_0x2e8db7[_0x0c04('0x42')]=_[_0x0c04('0x43')](_0x2e8db7[_0x0c04('0x42')],{'$or':_[_0x0c04('0x30')](_0x2e8db7[_0x0c04('0x3a')],function(_0x301ae1){var _0x4ab911={};_0x4ab911[_0x301ae1]={'$like':'%'+_0x5b96fd[_0x0c04('0x35')][_0x0c04('0x41')]+'%'};return _0x4ab911;})});}_0x2e8db7=_[_0x0c04('0x43')]({},_0x2e8db7,_0x5b96fd[_0x0c04('0x56')]);return db[_0x0c04('0x66')][_0x0c04('0x1e')]({'where':_0x2e8db7[_0x0c04('0x42')]})[_0x0c04('0x27')](function(_0x39c513){_0x37e95a[_0x0c04('0x1e')]=_0x39c513;if(_0x5b96fd['query'][_0x0c04('0x46')]){_0x2e8db7['include']=[{'all':!![]}];}return db['CmHopperBlack'][_0x0c04('0x47')](_0x2e8db7);})[_0x0c04('0x27')](function(_0x587c95){_0x37e95a[_0x0c04('0x48')]=_0x587c95;return _0x37e95a;});}})[_0x0c04('0x27')](respondWithFilteredResult(_0x502ef9,_0x2e8db7))[_0x0c04('0x5c')](handleError(_0x502ef9,null));};exports['getLists']=function(_0x59cbb7,_0x1316a9,_0x2f3922){var _0x353911={};var _0x56f24e={};var _0xe7d94f;var _0x2615a1;return db[_0x0c04('0x45')][_0x0c04('0x5e')]({'where':{'id':_0x59cbb7['params']['id']}})[_0x0c04('0x27')](handleEntityNotFound(_0x1316a9,null))[_0x0c04('0x27')](function(_0x29256d){if(_0x29256d){_0xe7d94f=_0x29256d;_0x56f24e[_0x0c04('0x37')]=_['keys'](db[_0x0c04('0x67')]['rawAttributes']);_0x56f24e[_0x0c04('0x35')]=_['keys'](_0x59cbb7[_0x0c04('0x35')]);_0x56f24e['filters']=_[_0x0c04('0x38')](_0x56f24e[_0x0c04('0x37')],_0x56f24e[_0x0c04('0x35')]);_0x353911[_0x0c04('0x3a')]=_[_0x0c04('0x38')](_0x56f24e[_0x0c04('0x37')],qs[_0x0c04('0x39')](_0x59cbb7['query']['fields']));_0x353911[_0x0c04('0x3a')]=_0x353911[_0x0c04('0x3a')][_0x0c04('0x3b')]?_0x353911['attributes']:_0x56f24e[_0x0c04('0x37')];_0x353911[_0x0c04('0x3d')]=qs['sort'](_0x59cbb7['query'][_0x0c04('0x3e')]);_0x353911['where']=qs[_0x0c04('0x3f')](_[_0x0c04('0x40')](_0x59cbb7['query'],_0x56f24e[_0x0c04('0x3f')]));if(_0x59cbb7[_0x0c04('0x35')][_0x0c04('0x41')]){_0x353911[_0x0c04('0x42')]=_[_0x0c04('0x43')](_0x353911['where'],{'$or':_[_0x0c04('0x30')](_0x353911[_0x0c04('0x3a')],function(_0x433e06){var _0x34af4c={};_0x34af4c[_0x433e06]={'$like':'%'+_0x59cbb7['query'][_0x0c04('0x41')]+'%'};return _0x34af4c;})});}_0x353911=_[_0x0c04('0x43')]({},_0x353911,_0x59cbb7[_0x0c04('0x56')]);return _0xe7d94f[_0x0c04('0x68')](_0x353911);}})[_0x0c04('0x27')](function(_0x474697){if(_0x474697){_0x2615a1=_0x474697[_0x0c04('0x3b')];if(!_0x59cbb7[_0x0c04('0x35')][_0x0c04('0x3c')](_0x0c04('0x60'))){_0x353911[_0x0c04('0x20')]=qs['limit'](_0x59cbb7[_0x0c04('0x35')][_0x0c04('0x20')]);_0x353911[_0x0c04('0x1f')]=qs[_0x0c04('0x1f')](_0x59cbb7[_0x0c04('0x35')][_0x0c04('0x1f')]);}return _0xe7d94f[_0x0c04('0x68')](_0x353911);}})[_0x0c04('0x27')](function(_0x3d7cfd){if(_0x3d7cfd){return _0x3d7cfd?{'count':_0x2615a1,'rows':_0x3d7cfd}:null;}})[_0x0c04('0x27')](respondWithResult(_0x1316a9,null))[_0x0c04('0x5c')](handleError(_0x1316a9,null));};exports['addLists']=function(_0x283b,_0x34f36e,_0x11af4e){var _0x3949e4,_0x4a5924;return db[_0x0c04('0x45')][_0x0c04('0x57')]({'where':{'id':_0x283b['params']['id']}})[_0x0c04('0x27')](handleEntityNotFound(_0x34f36e,null))[_0x0c04('0x27')](function(_0x3c8785){if(_0x3c8785){_0x4a5924=_0x3c8785;return _0x3c8785[_0x0c04('0x69')](_0x283b[_0x0c04('0x4c')]['ids'],_[_0x0c04('0x59')](_0x283b['body'],[_0x0c04('0x6a'),'id'])||{});}return null;})['spread'](function(_0x5a3c41){var _0x4abb02;_0x3949e4=_0x5a3c41||[];var _0x547e74=[];if(_0x5a3c41){for(var _0x184749=0x0;_0x184749<_0x5a3c41[_0x0c04('0x3b')];_0x184749+=0x1){var _0x435c99=_0x5a3c41[_0x184749][_0x0c04('0x29')]({'plain':!![]});_0x4a5924[_0x0c04('0x6b')]=_0x283b[_0x0c04('0x4c')][_0x0c04('0x6b')]?_0x283b[_0x0c04('0x4c')][_0x0c04('0x6b')]:_0x4a5924[_0x0c04('0x6b')];switch(_0x4a5924[_0x0c04('0x6b')]){case _0x0c04('0x6c'):_0x4abb02=squel[_0x0c04('0x6d')]()[_0x0c04('0x6e')](_0x0c04('0x6f'))['fromQuery']([_0x0c04('0x70'),_0x0c04('0x71'),'ContactId',_0x0c04('0x72'),_0x0c04('0x61'),'createdAt',_0x0c04('0x5a')],squel['select']()[_0x0c04('0x73')](_0x0c04('0x70'),_0x0c04('0x70'))['field'](_0x0c04('0x74'),'scheduledAt')['field']('id',_0x0c04('0x75'))['field'](_0x435c99[_0x0c04('0x76')][_0x0c04('0x77')](),_0x0c04('0x72'))[_0x0c04('0x73')](_0x283b['params']['id'][_0x0c04('0x77')](),_0x0c04('0x61'))[_0x0c04('0x73')](_0x0c04('0x74'),_0x0c04('0x58'))[_0x0c04('0x73')](_0x0c04('0x74'),_0x0c04('0x5a'))[_0x0c04('0x78')](_0x0c04('0x79'))[_0x0c04('0x42')]('deletedAt\x20IS\x20NULL')['where'](_0x0c04('0x7a'),_0x435c99[_0x0c04('0x76')]['toString']())[_0x0c04('0x42')](_0x0c04('0x7b'))['where'](_0x0c04('0x7c'),squel[_0x0c04('0x7d')]()[_0x0c04('0x73')](_0x0c04('0x7e'))[_0x0c04('0x78')](_0x0c04('0x7f'))['where'](_0x0c04('0x80'),_0x283b[_0x0c04('0x4a')]['id']['toString']()))['where'](_0x0c04('0x7c'),squel[_0x0c04('0x7d')]()[_0x0c04('0x73')](_0x0c04('0x81'))[_0x0c04('0x78')]('cm_hopper')['where'](_0x0c04('0x80'),_0x283b[_0x0c04('0x4a')]['id']['toString']())))['toString']();break;case _0x0c04('0x82'):_0x4abb02=squel[_0x0c04('0x6d')]()[_0x0c04('0x6e')](_0x0c04('0x6f'))['fromQuery']([_0x0c04('0x70'),_0x0c04('0x71'),_0x0c04('0x75'),_0x0c04('0x72'),_0x0c04('0x61'),_0x0c04('0x58'),_0x0c04('0x5a')],squel['select']()[_0x0c04('0x73')](_0x0c04('0x70'),_0x0c04('0x70'))[_0x0c04('0x73')](_0x0c04('0x74'),_0x0c04('0x71'))[_0x0c04('0x73')]('id',_0x0c04('0x75'))[_0x0c04('0x73')](_0x435c99[_0x0c04('0x76')][_0x0c04('0x77')](),_0x0c04('0x72'))[_0x0c04('0x73')](_0x283b[_0x0c04('0x4a')]['id'][_0x0c04('0x77')](),_0x0c04('0x61'))[_0x0c04('0x73')](_0x0c04('0x74'),_0x0c04('0x58'))['field'](_0x0c04('0x74'),_0x0c04('0x5a'))[_0x0c04('0x78')](_0x0c04('0x79'))[_0x0c04('0x42')](_0x0c04('0x83'))[_0x0c04('0x42')]('ListId\x20=\x20?',_0x435c99['CmListId'][_0x0c04('0x77')]())['where'](_0x0c04('0x7b'))[_0x0c04('0x42')](_0x0c04('0x7c'),squel['select']()[_0x0c04('0x73')]('COALESCE(phone,\x27\x27)')['from'](_0x0c04('0x6f'))[_0x0c04('0x42')]('CampaignId\x20=\x20?',_0x283b['params']['id']['toString']())))['toString']();break;default:_0x4abb02=squel[_0x0c04('0x6d')]()[_0x0c04('0x6e')](_0x0c04('0x6f'))[_0x0c04('0x84')]([_0x0c04('0x70'),_0x0c04('0x71'),_0x0c04('0x75'),_0x0c04('0x72'),'CampaignId',_0x0c04('0x58'),'updatedAt'],squel[_0x0c04('0x7d')]()[_0x0c04('0x73')](_0x0c04('0x70'),_0x0c04('0x70'))['field'](_0x0c04('0x74'),_0x0c04('0x71'))['field']('id',_0x0c04('0x75'))[_0x0c04('0x73')](_0x435c99[_0x0c04('0x76')]['toString'](),_0x0c04('0x72'))[_0x0c04('0x73')](_0x283b[_0x0c04('0x4a')]['id'][_0x0c04('0x77')](),'CampaignId')[_0x0c04('0x73')](_0x0c04('0x74'),'createdAt')[_0x0c04('0x73')]('NOW()',_0x0c04('0x5a'))[_0x0c04('0x78')](_0x0c04('0x79'))[_0x0c04('0x42')]('deletedAt\x20IS\x20NULL')['where'](_0x0c04('0x7a'),_0x435c99[_0x0c04('0x76')]['toString']())[_0x0c04('0x42')](_0x0c04('0x7b')))['toString']();}_0x547e74[_0x0c04('0x85')](db[_0x0c04('0x86')][_0x0c04('0x35')](_0x4abb02));}return BPromise[_0x0c04('0x87')](_0x547e74);}})['then'](function(){return _0x3949e4;})[_0x0c04('0x27')](respondWithResult(_0x34f36e,null))['catch'](handleError(_0x34f36e,null));};exports[_0x0c04('0x88')]=function(_0x50a6cf,_0x4194fa,_0x3b785a){return db[_0x0c04('0x45')][_0x0c04('0x57')]({'where':{'id':_0x50a6cf['params']['id']}})[_0x0c04('0x27')](handleEntityNotFound(_0x4194fa,null))[_0x0c04('0x27')](function(_0x5729ff){if(_0x5729ff){return _0x5729ff[_0x0c04('0x88')](_0x50a6cf[_0x0c04('0x35')]['ids']);}})[_0x0c04('0x27')](function(_0x3e19ce){if(_0x3e19ce){return db[_0x0c04('0x5f')][_0x0c04('0x28')]({'where':{'ListId':_0x50a6cf['query'][_0x0c04('0x6a')],'CampaignId':_0x50a6cf['params']['id']}})[_0x0c04('0x27')](function(){return _0x3e19ce;});}})['then'](respondWithStatusCode(_0x4194fa,null))[_0x0c04('0x5c')](handleError(_0x4194fa,null));};exports[_0x0c04('0x89')]=function(_0x177797,_0x545fe4,_0x268e80){var _0x14f774={};var _0x3448c9={};var _0x5ddf07;var _0x4bcb38;return db[_0x0c04('0x45')][_0x0c04('0x5e')]({'where':{'id':_0x177797[_0x0c04('0x4a')]['id']}})[_0x0c04('0x27')](handleEntityNotFound(_0x545fe4,null))['then'](function(_0x2d6862){if(_0x2d6862){_0x5ddf07=_0x2d6862;_0x3448c9[_0x0c04('0x37')]=_[_0x0c04('0x36')](db[_0x0c04('0x67')][_0x0c04('0x31')]);_0x3448c9[_0x0c04('0x35')]=_[_0x0c04('0x36')](_0x177797[_0x0c04('0x35')]);_0x3448c9['filters']=_[_0x0c04('0x38')](_0x3448c9['model'],_0x3448c9['query']);_0x14f774[_0x0c04('0x3a')]=_['intersection'](_0x3448c9['model'],qs[_0x0c04('0x39')](_0x177797[_0x0c04('0x35')]['fields']));_0x14f774['attributes']=_0x14f774[_0x0c04('0x3a')]['length']?_0x14f774[_0x0c04('0x3a')]:_0x3448c9[_0x0c04('0x37')];_0x14f774['order']=qs[_0x0c04('0x3e')](_0x177797[_0x0c04('0x35')]['sort']);_0x14f774['where']=qs[_0x0c04('0x3f')](_[_0x0c04('0x40')](_0x177797[_0x0c04('0x35')],_0x3448c9[_0x0c04('0x3f')]));if(_0x177797['query'][_0x0c04('0x41')]){_0x14f774['where']=_[_0x0c04('0x43')](_0x14f774[_0x0c04('0x42')],{'$or':_['map'](_0x14f774[_0x0c04('0x3a')],function(_0x44f213){var _0x82138d={};_0x82138d[_0x44f213]={'$like':'%'+_0x177797[_0x0c04('0x35')]['filter']+'%'};return _0x82138d;})});}_0x14f774=_['merge']({},_0x14f774,_0x177797['options']);return _0x5ddf07[_0x0c04('0x89')](_0x14f774);}})[_0x0c04('0x27')](function(_0x4509a0){if(_0x4509a0){_0x4bcb38=_0x4509a0[_0x0c04('0x3b')];if(!_0x177797[_0x0c04('0x35')][_0x0c04('0x3c')](_0x0c04('0x60'))){_0x14f774[_0x0c04('0x20')]=qs[_0x0c04('0x20')](_0x177797[_0x0c04('0x35')][_0x0c04('0x20')]);_0x14f774[_0x0c04('0x1f')]=qs[_0x0c04('0x1f')](_0x177797[_0x0c04('0x35')][_0x0c04('0x1f')]);}return _0x5ddf07[_0x0c04('0x89')](_0x14f774);}})[_0x0c04('0x27')](function(_0x403a0e){if(_0x403a0e){return _0x403a0e?{'count':_0x4bcb38,'rows':_0x403a0e}:null;}})[_0x0c04('0x27')](respondWithResult(_0x545fe4,null))[_0x0c04('0x5c')](handleError(_0x545fe4,null));};exports[_0x0c04('0x8a')]=function(_0x5a6c0f,_0x40da15,_0x4f279b){var _0x1ea007,_0x1f00e6;return db[_0x0c04('0x45')][_0x0c04('0x57')]({'where':{'id':_0x5a6c0f[_0x0c04('0x4a')]['id']}})[_0x0c04('0x27')](handleEntityNotFound(_0x40da15,null))['then'](function(_0xb48511){if(_0xb48511){_0x1f00e6=_0xb48511;return _0xb48511[_0x0c04('0x8a')](_0x5a6c0f[_0x0c04('0x4c')][_0x0c04('0x6a')],_[_0x0c04('0x59')](_0x5a6c0f[_0x0c04('0x4c')],[_0x0c04('0x6a'),'id'])||{});}return null;})[_0x0c04('0x8b')](function(_0x5d71e1){var _0x5f541a;_0x1ea007=_0x5d71e1||[];var _0x3afd1a=[];if(_0x5d71e1){for(var _0x38421e=0x0;_0x38421e<_0x5d71e1['length'];_0x38421e+=0x1){var _0x1590e9=_0x5d71e1[_0x38421e][_0x0c04('0x29')]({'plain':!![]});_0x5f541a=squel[_0x0c04('0x6d')]()[_0x0c04('0x6e')]('cm_hopper_black')[_0x0c04('0x84')]([_0x0c04('0x70'),_0x0c04('0x75'),_0x0c04('0x72'),_0x0c04('0x61'),'createdAt','updatedAt'],squel[_0x0c04('0x7d')]()[_0x0c04('0x73')](_0x0c04('0x70'),_0x0c04('0x70'))[_0x0c04('0x73')]('id',_0x0c04('0x75'))[_0x0c04('0x73')](_0x1590e9['CmListId'][_0x0c04('0x77')](),_0x0c04('0x72'))[_0x0c04('0x73')](_0x5a6c0f[_0x0c04('0x4a')]['id'][_0x0c04('0x77')](),_0x0c04('0x61'))[_0x0c04('0x73')](_0x0c04('0x74'),_0x0c04('0x58'))[_0x0c04('0x73')](_0x0c04('0x74'),_0x0c04('0x5a'))[_0x0c04('0x78')](_0x0c04('0x79'))[_0x0c04('0x42')](_0x0c04('0x83'))[_0x0c04('0x42')]('ListId\x20=\x20?',_0x1590e9[_0x0c04('0x76')][_0x0c04('0x77')]())[_0x0c04('0x42')](_0x0c04('0x7b')))[_0x0c04('0x77')]();_0x3afd1a[_0x0c04('0x85')](db[_0x0c04('0x86')][_0x0c04('0x35')](_0x5f541a));}return BPromise[_0x0c04('0x87')](_0x3afd1a);}})[_0x0c04('0x27')](function(){return _0x1ea007;})[_0x0c04('0x27')](respondWithResult(_0x40da15,null))[_0x0c04('0x5c')](handleError(_0x40da15,null));};exports['removeBlackLists']=function(_0x24bd61,_0x5d41bc,_0x58843e){return db['Campaign'][_0x0c04('0x57')]({'where':{'id':_0x24bd61[_0x0c04('0x4a')]['id']}})[_0x0c04('0x27')](handleEntityNotFound(_0x5d41bc,null))['then'](function(_0x3a0d45){if(_0x3a0d45){return _0x3a0d45[_0x0c04('0x8c')](_0x24bd61['query']['ids']);}})[_0x0c04('0x27')](function(_0x21f38a){if(_0x21f38a){return db[_0x0c04('0x66')][_0x0c04('0x28')]({'where':{'ListId':_0x24bd61[_0x0c04('0x35')][_0x0c04('0x6a')],'CampaignId':_0x24bd61['params']['id']}})[_0x0c04('0x27')](function(){return _0x21f38a;});}})[_0x0c04('0x27')](respondWithStatusCode(_0x5d41bc,null))[_0x0c04('0x5c')](handleError(_0x5d41bc,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index d257ad1..a2c6f70 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 _0x9957=['exports','define','Campaign','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./campaign.attributes'];(function(_0x599f41,_0x4db732){var _0x2e4d58=function(_0x14c882){while(--_0x14c882){_0x599f41['push'](_0x599f41['shift']());}};_0x2e4d58(++_0x4db732);}(_0x9957,0x93));var _0x7995=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x9957[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var 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 +var _0x7a54=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./campaign.attributes','exports','Campaign','campaigns','lodash','util'];(function(_0x97d4b6,_0x1b8eab){var _0x364238=function(_0x496705){while(--_0x496705){_0x97d4b6['push'](_0x97d4b6['shift']());}};_0x364238(++_0x1b8eab);}(_0x7a54,0x106));var _0x47a5=function(_0x2108e7,_0x4c2863){_0x2108e7=_0x2108e7-0x0;var _0x293d3d=_0x7a54[_0x2108e7];return _0x293d3d;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/campaign/campaign.rpc.js b/server/api/campaign/campaign.rpc.js index d2fd792..6cceaef 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 _0xa101=['then','info','Campaign,\x20%s,\x20%s','debug','Campaign,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','GetCampaign','Campaign','findAll','options','raw','where','attributes','include','model','map','stringify','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x2f71f6,_0x3a1f4d){var _0x2b23ea=function(_0x285980){while(--_0x285980){_0x2f71f6['push'](_0x2f71f6['shift']());}};_0x2b23ea(++_0x3a1f4d);}(_0xa101,0x15f));var _0x1a10=function(_0x37d0bc,_0x109b96){_0x37d0bc=_0x37d0bc-0x0;var _0x170e60=_0xa101[_0x37d0bc];return _0x170e60;};'use strict';var _=require(_0x1a10('0x0'));var util=require(_0x1a10('0x1'));var moment=require('moment');var BPromise=require(_0x1a10('0x2'));var rs=require(_0x1a10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1a10('0x4'))['db'];var utils=require(_0x1a10('0x5'));var logger=require('../../config/logger')(_0x1a10('0x6'));var config=require(_0x1a10('0x7'));var jayson=require(_0x1a10('0x8'));var client=jayson[_0x1a10('0x9')][_0x1a10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2b95f3,_0x5eea77,_0x4f0cd4){return new BPromise(function(_0x3c90fa,_0x2df5ef){return client[_0x1a10('0xb')](_0x2b95f3,_0x4f0cd4)[_0x1a10('0xc')](function(_0x7c7a8a){logger[_0x1a10('0xd')](_0x1a10('0xe'),_0x5eea77,'request\x20sent');logger[_0x1a10('0xf')](_0x1a10('0x10'),_0x5eea77,_0x1a10('0x11'),JSON['stringify'](_0x7c7a8a));if(_0x7c7a8a[_0x1a10('0x12')]){if(_0x7c7a8a[_0x1a10('0x12')][_0x1a10('0x13')]===0x1f4){logger['error'](_0x1a10('0xe'),_0x5eea77,_0x7c7a8a[_0x1a10('0x12')][_0x1a10('0x14')]);return _0x2df5ef(_0x7c7a8a[_0x1a10('0x12')][_0x1a10('0x14')]);}logger['error'](_0x1a10('0xe'),_0x5eea77,_0x7c7a8a['error']['message']);return _0x3c90fa(_0x7c7a8a['error'][_0x1a10('0x14')]);}else{logger[_0x1a10('0xd')](_0x1a10('0xe'),_0x5eea77,_0x1a10('0x11'));_0x3c90fa(_0x7c7a8a['result'][_0x1a10('0x14')]);}})[_0x1a10('0x15')](function(_0x5395b4){logger[_0x1a10('0x12')](_0x1a10('0xe'),_0x5eea77,_0x5395b4);_0x2df5ef(_0x5395b4);});});}exports[_0x1a10('0x16')]=function(_0x457e2f){var _0x4a3813=this;return new Promise(function(_0x169cf2,_0x1b394c){return db[_0x1a10('0x17')][_0x1a10('0x18')]({'raw':_0x457e2f[_0x1a10('0x19')]?_0x457e2f[_0x1a10('0x19')][_0x1a10('0x1a')]===undefined?!![]:![]:!![],'where':_0x457e2f[_0x1a10('0x19')]?_0x457e2f[_0x1a10('0x19')][_0x1a10('0x1b')]||null:null,'attributes':_0x457e2f[_0x1a10('0x19')]?_0x457e2f[_0x1a10('0x19')][_0x1a10('0x1c')]||null:null,'limit':_0x457e2f[_0x1a10('0x19')]?_0x457e2f[_0x1a10('0x19')]['limit']||null:null,'include':_0x457e2f[_0x1a10('0x19')]?_0x457e2f['options'][_0x1a10('0x1d')]?_['map'](_0x457e2f[_0x1a10('0x19')]['include'],function(_0x11148c){return{'model':db[_0x11148c[_0x1a10('0x1e')]],'as':_0x11148c['as'],'attributes':_0x11148c['attributes'],'include':_0x11148c[_0x1a10('0x1d')]?_[_0x1a10('0x1f')](_0x11148c[_0x1a10('0x1d')],function(_0x43cae0){return{'model':db[_0x43cae0['model']],'as':_0x43cae0['as'],'attributes':_0x43cae0[_0x1a10('0x1c')],'include':_0x43cae0[_0x1a10('0x1d')]?_[_0x1a10('0x1f')](_0x43cae0[_0x1a10('0x1d')],function(_0xc093f6){return{'model':db[_0xc093f6[_0x1a10('0x1e')]],'as':_0xc093f6['as'],'attributes':_0xc093f6[_0x1a10('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x1a10('0xc')](function(_0x4ba1a2){logger['info']('GetCampaign',_0x457e2f);logger[_0x1a10('0xf')](_0x1a10('0x16'),_0x457e2f,JSON[_0x1a10('0x20')](_0x4ba1a2));_0x169cf2(_0x4ba1a2);})[_0x1a10('0x15')](function(_0x4c2d92){logger[_0x1a10('0x12')](_0x1a10('0x16'),_0x4c2d92['message'],_0x457e2f);_0x1b394c(_0x4a3813[_0x1a10('0x12')](0x1f4,_0x4c2d92[_0x1a10('0x14')]));});});}; \ No newline at end of file +var _0xa73a=['stringify','error','code','message','result','catch','findAll','options','raw','attributes','limit','include','map','model','util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Campaign,\x20%s,\x20%s','Campaign,\x20%s,\x20%s,\x20%s'];(function(_0x4b3e59,_0x5c179c){var _0x27848d=function(_0x382919){while(--_0x382919){_0x4b3e59['push'](_0x4b3e59['shift']());}};_0x27848d(++_0x5c179c);}(_0xa73a,0x82));var _0xaa73=function(_0x397cfb,_0xb8f317){_0x397cfb=_0x397cfb-0x0;var _0x15fed9=_0xa73a[_0x397cfb];return _0x15fed9;};'use strict';var _=require('lodash');var util=require(_0xaa73('0x0'));var moment=require(_0xaa73('0x1'));var BPromise=require(_0xaa73('0x2'));var rs=require(_0xaa73('0x3'));var fs=require('fs');var Redis=require(_0xaa73('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xaa73('0x5'));var config=require(_0xaa73('0x6'));var jayson=require(_0xaa73('0x7'));var client=jayson[_0xaa73('0x8')][_0xaa73('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3c6837,_0x9ecf94,_0x52dea4){return new BPromise(function(_0x5772ab,_0x3d0e03){return client[_0xaa73('0xa')](_0x3c6837,_0x52dea4)[_0xaa73('0xb')](function(_0x13a31a){logger[_0xaa73('0xc')](_0xaa73('0xd'),_0x9ecf94,'request\x20sent');logger['debug'](_0xaa73('0xe'),_0x9ecf94,'request\x20sent',JSON[_0xaa73('0xf')](_0x13a31a));if(_0x13a31a['error']){if(_0x13a31a[_0xaa73('0x10')][_0xaa73('0x11')]===0x1f4){logger[_0xaa73('0x10')](_0xaa73('0xd'),_0x9ecf94,_0x13a31a[_0xaa73('0x10')][_0xaa73('0x12')]);return _0x3d0e03(_0x13a31a['error'][_0xaa73('0x12')]);}logger[_0xaa73('0x10')](_0xaa73('0xd'),_0x9ecf94,_0x13a31a[_0xaa73('0x10')][_0xaa73('0x12')]);return _0x5772ab(_0x13a31a[_0xaa73('0x10')][_0xaa73('0x12')]);}else{logger[_0xaa73('0xc')](_0xaa73('0xd'),_0x9ecf94,'request\x20sent');_0x5772ab(_0x13a31a[_0xaa73('0x13')]['message']);}})[_0xaa73('0x14')](function(_0x350974){logger[_0xaa73('0x10')]('Campaign,\x20%s,\x20%s',_0x9ecf94,_0x350974);_0x3d0e03(_0x350974);});});}exports['GetCampaign']=function(_0x3ce616){var _0x5cc83b=this;return new Promise(function(_0x9ec989,_0x388ded){return db['Campaign'][_0xaa73('0x15')]({'raw':_0x3ce616[_0xaa73('0x16')]?_0x3ce616[_0xaa73('0x16')][_0xaa73('0x17')]===undefined?!![]:![]:!![],'where':_0x3ce616[_0xaa73('0x16')]?_0x3ce616[_0xaa73('0x16')]['where']||null:null,'attributes':_0x3ce616[_0xaa73('0x16')]?_0x3ce616['options'][_0xaa73('0x18')]||null:null,'limit':_0x3ce616[_0xaa73('0x16')]?_0x3ce616[_0xaa73('0x16')][_0xaa73('0x19')]||null:null,'include':_0x3ce616['options']?_0x3ce616['options'][_0xaa73('0x1a')]?_[_0xaa73('0x1b')](_0x3ce616[_0xaa73('0x16')][_0xaa73('0x1a')],function(_0x346d57){return{'model':db[_0x346d57['model']],'as':_0x346d57['as'],'attributes':_0x346d57[_0xaa73('0x18')],'include':_0x346d57[_0xaa73('0x1a')]?_[_0xaa73('0x1b')](_0x346d57['include'],function(_0x3cae16){return{'model':db[_0x3cae16[_0xaa73('0x1c')]],'as':_0x3cae16['as'],'attributes':_0x3cae16[_0xaa73('0x18')],'include':_0x3cae16[_0xaa73('0x1a')]?_[_0xaa73('0x1b')](_0x3cae16[_0xaa73('0x1a')],function(_0x1ed112){return{'model':db[_0x1ed112[_0xaa73('0x1c')]],'as':_0x1ed112['as'],'attributes':_0x1ed112['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x5ce5a3){logger[_0xaa73('0xc')]('GetCampaign',_0x3ce616);logger['debug']('GetCampaign',_0x3ce616,JSON[_0xaa73('0xf')](_0x5ce5a3));_0x9ec989(_0x5ce5a3);})[_0xaa73('0x14')](function(_0x5613a4){logger['error']('GetCampaign',_0x5613a4[_0xaa73('0x12')],_0x3ce616);_0x388ded(_0x5cc83b[_0xaa73('0x10')](0x1f4,_0x5613a4[_0xaa73('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index 3251d41..83c346b 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 _0xaca4=['/:id/clone','clone','addBlackLists','put','/:id','delete','destroy','removeBlackLists','exports','multer','util','path','Router','../../config/environment','./campaign.controller','get','isAuthenticated','index','show','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperFinals','/:id/hopper_black','/:id/lists','getLists','/:id/blacklists','getBlackLists','post','create'];(function(_0x378771,_0x42c998){var _0x2cf76d=function(_0x735d7a){while(--_0x735d7a){_0x378771['push'](_0x378771['shift']());}};_0x2cf76d(++_0x42c998);}(_0xaca4,0xbd));var _0x4aca=function(_0x12c55d,_0x178a39){_0x12c55d=_0x12c55d-0x0;var _0x342c55=_0xaca4[_0x12c55d];return _0x342c55;};'use strict';var multer=require(_0x4aca('0x0'));var util=require(_0x4aca('0x1'));var path=require(_0x4aca('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x4aca('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x4aca('0x4'));var controller=require(_0x4aca('0x5'));router[_0x4aca('0x6')]('/',auth[_0x4aca('0x7')](),controller[_0x4aca('0x8')]);router[_0x4aca('0x6')]('/:id',auth['isAuthenticated'](),controller[_0x4aca('0x9')]);router['get'](_0x4aca('0xa'),auth['isAuthenticated'](),controller[_0x4aca('0xb')]);router[_0x4aca('0x6')](_0x4aca('0xc'),auth[_0x4aca('0x7')](),controller['getHopperHistories']);router[_0x4aca('0x6')]('/:id/hopper_finals',auth[_0x4aca('0x7')](),controller[_0x4aca('0xd')]);router[_0x4aca('0x6')](_0x4aca('0xe'),auth[_0x4aca('0x7')](),controller['getHopperBlacks']);router[_0x4aca('0x6')](_0x4aca('0xf'),auth[_0x4aca('0x7')](),controller[_0x4aca('0x10')]);router[_0x4aca('0x6')](_0x4aca('0x11'),auth['isAuthenticated'](),controller[_0x4aca('0x12')]);router[_0x4aca('0x13')]('/',auth['isAuthenticated'](),controller[_0x4aca('0x14')]);router['post'](_0x4aca('0x15'),auth[_0x4aca('0x7')](),controller[_0x4aca('0x16')]);router['post']('/:id/lists',auth[_0x4aca('0x7')](),controller['addLists']);router['post'](_0x4aca('0x11'),auth[_0x4aca('0x7')](),controller[_0x4aca('0x17')]);router[_0x4aca('0x18')](_0x4aca('0x19'),auth['isAuthenticated'](),controller['update']);router[_0x4aca('0x1a')](_0x4aca('0x19'),auth['isAuthenticated'](),controller[_0x4aca('0x1b')]);router[_0x4aca('0x1a')]('/:id/lists',auth[_0x4aca('0x7')](),controller['removeLists']);router['delete'](_0x4aca('0x11'),auth[_0x4aca('0x7')](),controller[_0x4aca('0x1c')]);module[_0x4aca('0x1d')]=router; \ No newline at end of file +var _0xb098=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./campaign.controller','get','index','/:id','isAuthenticated','show','/:id/hoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','getHopperBlacks','/:id/lists','getLists','/:id/blacklists','getBlackLists','post','create','clone','addLists','put','update','delete','removeLists','removeBlackLists','exports','multer','util','express'];(function(_0x322070,_0x3d4c9c){var _0x2e205c=function(_0x488649){while(--_0x488649){_0x322070['push'](_0x322070['shift']());}};_0x2e205c(++_0x3d4c9c);}(_0xb098,0x195));var _0x8b09=function(_0x216f35,_0x16b557){_0x216f35=_0x216f35-0x0;var _0x1c11b8=_0xb098[_0x216f35];return _0x1c11b8;};'use strict';var multer=require(_0x8b09('0x0'));var util=require(_0x8b09('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x8b09('0x2'));var router=express[_0x8b09('0x3')]();var fs_extra=require(_0x8b09('0x4'));var auth=require(_0x8b09('0x5'));var interaction=require(_0x8b09('0x6'));var config=require(_0x8b09('0x7'));var controller=require(_0x8b09('0x8'));router[_0x8b09('0x9')]('/',auth['isAuthenticated'](),controller[_0x8b09('0xa')]);router[_0x8b09('0x9')](_0x8b09('0xb'),auth[_0x8b09('0xc')](),controller[_0x8b09('0xd')]);router[_0x8b09('0x9')](_0x8b09('0xe'),auth[_0x8b09('0xc')](),controller['getHoppers']);router[_0x8b09('0x9')](_0x8b09('0xf'),auth[_0x8b09('0xc')](),controller[_0x8b09('0x10')]);router[_0x8b09('0x9')](_0x8b09('0x11'),auth['isAuthenticated'](),controller[_0x8b09('0x12')]);router[_0x8b09('0x9')]('/:id/hopper_black',auth[_0x8b09('0xc')](),controller[_0x8b09('0x13')]);router[_0x8b09('0x9')](_0x8b09('0x14'),auth['isAuthenticated'](),controller[_0x8b09('0x15')]);router['get'](_0x8b09('0x16'),auth[_0x8b09('0xc')](),controller[_0x8b09('0x17')]);router[_0x8b09('0x18')]('/',auth[_0x8b09('0xc')](),controller[_0x8b09('0x19')]);router[_0x8b09('0x18')]('/:id/clone',auth[_0x8b09('0xc')](),controller[_0x8b09('0x1a')]);router['post'](_0x8b09('0x14'),auth[_0x8b09('0xc')](),controller[_0x8b09('0x1b')]);router[_0x8b09('0x18')](_0x8b09('0x16'),auth[_0x8b09('0xc')](),controller['addBlackLists']);router[_0x8b09('0x1c')]('/:id',auth['isAuthenticated'](),controller[_0x8b09('0x1d')]);router[_0x8b09('0x1e')](_0x8b09('0xb'),auth[_0x8b09('0xc')](),controller['destroy']);router[_0x8b09('0x1e')](_0x8b09('0x14'),auth[_0x8b09('0xc')](),controller[_0x8b09('0x1f')]);router[_0x8b09('0x1e')](_0x8b09('0x16'),auth[_0x8b09('0xc')](),controller[_0x8b09('0x20')]);module[_0x8b09('0x21')]=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index 94bf4ca..7020b1e 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 _0x5f82=['STRING','TEXT','VIRTUAL','getDataValue','key'];(function(_0x4b0d6,_0x227fc3){var _0x41fda0=function(_0x47a13c){while(--_0x47a13c){_0x4b0d6['push'](_0x4b0d6['shift']());}};_0x41fda0(++_0x227fc3);}(_0x5f82,0x10e));var _0x25f8=function(_0xac151d,_0x4ea1d2){_0xac151d=_0xac151d-0x0;var _0x111dba=_0x5f82[_0xac151d];return _0x111dba;};'use strict';var Sequelize=require('sequelize');module['exports']={'key':{'type':Sequelize[_0x25f8('0x0')],'allowNull':![]},'value':{'type':Sequelize[_0x25f8('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x25f8('0x0')]},'name':{'type':Sequelize[_0x25f8('0x2')],'get':function(){return this[_0x25f8('0x3')](_0x25f8('0x4'));}}}; \ No newline at end of file +var _0x2f7f=['TEXT','VIRTUAL','getDataValue','key','sequelize','exports','STRING'];(function(_0x283c17,_0x144549){var _0x34ae98=function(_0x147a30){while(--_0x147a30){_0x283c17['push'](_0x283c17['shift']());}};_0x34ae98(++_0x144549);}(_0x2f7f,0x138));var _0xf2f7=function(_0x277107,_0x3420dc){_0x277107=_0x277107-0x0;var _0x1da046=_0x2f7f[_0x277107];return _0x1da046;};'use strict';var Sequelize=require(_0xf2f7('0x0'));module[_0xf2f7('0x1')]={'key':{'type':Sequelize[_0xf2f7('0x2')],'allowNull':![]},'value':{'type':Sequelize[_0xf2f7('0x3')],'allowNull':![]},'description':{'type':Sequelize[_0xf2f7('0x2')]},'name':{'type':Sequelize[_0xf2f7('0x4')],'get':function(){return this[_0xf2f7('0x5')](_0xf2f7('0x6'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index 64d156b..7ba45d1 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 _0x0410=['type','key','model','query','filters','attributes','intersection','fields','length','nolimit','order','sort','where','merge','filter','options','CannedAnswer','include','show','keys','rawAttributes','includeAll','find','catch','body','params','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','error','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','squel','jsforce','desk.js','to-csv','querystring','papaparse','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','limit','count','offset','set','Content-Range','apply','reject','save','update','then','get','CannedAnswers','UserProfileResource','destroy','stack','name','send','index','map','fieldName'];(function(_0x5a852b,_0x1694c2){var _0xd74d84=function(_0x170a6d){while(--_0x170a6d){_0x5a852b['push'](_0x5a852b['shift']());}};_0xd74d84(++_0x1694c2);}(_0x0410,0xda));var _0x0041=function(_0x18a168,_0x312f92){_0x18a168=_0x18a168-0x0;var _0x47f483=_0x0410[_0x18a168];return _0x47f483;};'use strict';var emlformat=require(_0x0041('0x0'));var rimraf=require(_0x0041('0x1'));var zipdir=require(_0x0041('0x2'));var jsonpatch=require(_0x0041('0x3'));var rp=require(_0x0041('0x4'));var moment=require(_0x0041('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x0041('0x6'));var util=require(_0x0041('0x7'));var path=require(_0x0041('0x8'));var sox=require(_0x0041('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x0041('0xa'));var crypto=require('crypto');var jsforce=require(_0x0041('0xb'));var deskjs=require(_0x0041('0xc'));var toCsv=require(_0x0041('0xd'));var querystring=require(_0x0041('0xe'));var Papa=require(_0x0041('0xf'));var Redis=require(_0x0041('0x10'));var authService=require(_0x0041('0x11'));var qs=require(_0x0041('0x12'));var as=require(_0x0041('0x13'));var hardwareService=require(_0x0041('0x14'));var logger=require(_0x0041('0x15'))('api');var utils=require(_0x0041('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x0041('0x17'));var db=require(_0x0041('0x18'))['db'];function respondWithStatusCode(_0x3b4fa4,_0x596b04){_0x596b04=_0x596b04||0xcc;return function(_0x322872){if(_0x322872){return _0x3b4fa4[_0x0041('0x19')](_0x596b04);}return _0x3b4fa4[_0x0041('0x1a')](_0x596b04)[_0x0041('0x1b')]();};}function respondWithResult(_0x1614c2,_0x95d728){_0x95d728=_0x95d728||0xc8;return function(_0x1b625d){if(_0x1b625d){return _0x1614c2[_0x0041('0x1a')](_0x95d728)[_0x0041('0x1c')](_0x1b625d);}};}function respondWithFilteredResult(_0x566eb9,_0x4150d5){return function(_0x254233){if(_0x254233){var _0x46f3aa=typeof _0x4150d5['offset']==='undefined'&&typeof _0x4150d5[_0x0041('0x1d')]==='undefined';var _0x5c68ff=_0x254233[_0x0041('0x1e')];var _0xee49e=_0x46f3aa?0x0:_0x4150d5[_0x0041('0x1f')];var _0x3ef0fd=_0x46f3aa?_0x254233[_0x0041('0x1e')]:_0x4150d5[_0x0041('0x1f')]+_0x4150d5[_0x0041('0x1d')];var _0x486c44;if(_0x3ef0fd>=_0x5c68ff){_0x3ef0fd=_0x5c68ff;_0x486c44=0xc8;}else{_0x486c44=0xce;}_0x566eb9[_0x0041('0x1a')](_0x486c44);return _0x566eb9[_0x0041('0x20')](_0x0041('0x21'),_0xee49e+'-'+_0x3ef0fd+'/'+_0x5c68ff)[_0x0041('0x1c')](_0x254233);}return null;};}function patchUpdates(_0x5dface){return function(_0x57ed2c){try{jsonpatch[_0x0041('0x22')](_0x57ed2c,_0x5dface,!![]);}catch(_0x1b658b){return BPromise[_0x0041('0x23')](_0x1b658b);}return _0x57ed2c[_0x0041('0x24')]();};}function saveUpdates(_0x395d90,_0x304d03){return function(_0x5355df){if(_0x5355df){return _0x5355df[_0x0041('0x25')](_0x395d90)[_0x0041('0x26')](function(_0x18f6ac){return _0x18f6ac;});}return null;};}function removeEntity(_0x114a0d,_0x32817b){return function(_0x24406d){if(_0x24406d){return _0x24406d['destroy']()[_0x0041('0x26')](function(){var _0x1f1dee=_0x24406d[_0x0041('0x27')]({'plain':!![]});var _0x2e078a=_0x0041('0x28');return db[_0x0041('0x29')][_0x0041('0x2a')]({'where':{'type':_0x2e078a,'resourceId':_0x1f1dee['id']}})[_0x0041('0x26')](function(){return _0x24406d;});})[_0x0041('0x26')](function(){_0x114a0d['status'](0xcc)[_0x0041('0x1b')]();});}};}function handleEntityNotFound(_0x1b23de,_0x485432){return function(_0x3fbcb8){if(!_0x3fbcb8){_0x1b23de[_0x0041('0x19')](0x194);}return _0x3fbcb8;};}function handleError(_0x3feecd,_0x2fef7f){_0x2fef7f=_0x2fef7f||0x1f4;return function(_0x2a3d85){logger['error'](_0x2a3d85[_0x0041('0x2b')]);if(_0x2a3d85[_0x0041('0x2c')]){delete _0x2a3d85[_0x0041('0x2c')];}_0x3feecd['status'](_0x2fef7f)[_0x0041('0x2d')](_0x2a3d85);};}exports[_0x0041('0x2e')]=function(_0x486c46,_0xa252b5){var _0x5ab18b={},_0x15ddd2={},_0xd8bcb0={'count':0x0,'rows':[]};var _0x1a0ba6=_[_0x0041('0x2f')](db['CannedAnswer']['rawAttributes'],function(_0x40ab7c){return{'name':_0x40ab7c[_0x0041('0x30')],'type':_0x40ab7c[_0x0041('0x31')][_0x0041('0x32')]};});_0x15ddd2[_0x0041('0x33')]=_[_0x0041('0x2f')](_0x1a0ba6,'name');_0x15ddd2[_0x0041('0x34')]=_['keys'](_0x486c46['query']);_0x15ddd2[_0x0041('0x35')]=_['intersection'](_0x15ddd2[_0x0041('0x33')],_0x15ddd2[_0x0041('0x34')]);_0x5ab18b[_0x0041('0x36')]=_[_0x0041('0x37')](_0x15ddd2['model'],qs[_0x0041('0x38')](_0x486c46[_0x0041('0x34')][_0x0041('0x38')]));_0x5ab18b[_0x0041('0x36')]=_0x5ab18b[_0x0041('0x36')][_0x0041('0x39')]?_0x5ab18b[_0x0041('0x36')]:_0x15ddd2[_0x0041('0x33')];if(!_0x486c46[_0x0041('0x34')]['hasOwnProperty'](_0x0041('0x3a'))){_0x5ab18b[_0x0041('0x1d')]=qs[_0x0041('0x1d')](_0x486c46['query'][_0x0041('0x1d')]);_0x5ab18b[_0x0041('0x1f')]=qs[_0x0041('0x1f')](_0x486c46[_0x0041('0x34')][_0x0041('0x1f')]);}_0x5ab18b[_0x0041('0x3b')]=qs[_0x0041('0x3c')](_0x486c46[_0x0041('0x34')][_0x0041('0x3c')]);_0x5ab18b['where']=qs[_0x0041('0x35')](_['pick'](_0x486c46[_0x0041('0x34')],_0x15ddd2[_0x0041('0x35')]),_0x1a0ba6);if(_0x486c46[_0x0041('0x34')]['filter']){_0x5ab18b[_0x0041('0x3d')]=_[_0x0041('0x3e')](_0x5ab18b['where'],{'$or':[{'key':{'$like':'%'+_0x486c46[_0x0041('0x34')][_0x0041('0x3f')]+'%'}},{'value':{'$like':'%'+_0x486c46[_0x0041('0x34')][_0x0041('0x3f')]+'%'}}]});}_0x5ab18b=_['merge']({},_0x5ab18b,_0x486c46[_0x0041('0x40')]);var _0x4e18d0={'where':_0x5ab18b[_0x0041('0x3d')]};return db[_0x0041('0x41')][_0x0041('0x1e')](_0x4e18d0)['then'](function(_0x5cde54){_0xd8bcb0[_0x0041('0x1e')]=_0x5cde54;if(_0x486c46[_0x0041('0x34')]['includeAll']){_0x5ab18b[_0x0041('0x42')]=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x5ab18b);})[_0x0041('0x26')](function(_0x7dd190){_0xd8bcb0['rows']=_0x7dd190;return _0xd8bcb0;})[_0x0041('0x26')](respondWithFilteredResult(_0xa252b5,_0x5ab18b))['catch'](handleError(_0xa252b5,null));};exports[_0x0041('0x43')]=function(_0x4d3909,_0x47f841){var _0x908687={'raw':!![],'where':{'id':_0x4d3909['params']['id']}},_0xe50925={};_0xe50925['model']=_[_0x0041('0x44')](db[_0x0041('0x41')][_0x0041('0x45')]);_0xe50925[_0x0041('0x34')]=_[_0x0041('0x44')](_0x4d3909[_0x0041('0x34')]);_0xe50925[_0x0041('0x35')]=_[_0x0041('0x37')](_0xe50925[_0x0041('0x33')],_0xe50925[_0x0041('0x34')]);_0x908687[_0x0041('0x36')]=_[_0x0041('0x37')](_0xe50925[_0x0041('0x33')],qs['fields'](_0x4d3909['query'][_0x0041('0x38')]));_0x908687[_0x0041('0x36')]=_0x908687[_0x0041('0x36')]['length']?_0x908687[_0x0041('0x36')]:_0xe50925[_0x0041('0x33')];if(_0x4d3909[_0x0041('0x34')][_0x0041('0x46')]){_0x908687[_0x0041('0x42')]=[{'all':!![]}];}_0x908687=_[_0x0041('0x3e')]({},_0x908687,_0x4d3909['options']);return db[_0x0041('0x41')][_0x0041('0x47')](_0x908687)[_0x0041('0x26')](handleEntityNotFound(_0x47f841,null))[_0x0041('0x26')](respondWithResult(_0x47f841,null))[_0x0041('0x48')](handleError(_0x47f841,null));};exports[_0x0041('0x25')]=function(_0x510d1d,_0x41a06d){if(_0x510d1d[_0x0041('0x49')]['id']){delete _0x510d1d[_0x0041('0x49')]['id'];}return db['CannedAnswer'][_0x0041('0x47')]({'where':{'id':_0x510d1d[_0x0041('0x4a')]['id']}})[_0x0041('0x26')](handleEntityNotFound(_0x41a06d,null))[_0x0041('0x26')](saveUpdates(_0x510d1d[_0x0041('0x49')],null))[_0x0041('0x26')](respondWithResult(_0x41a06d,null))[_0x0041('0x48')](handleError(_0x41a06d,null));};exports[_0x0041('0x2a')]=function(_0x421668,_0xeac147){return db[_0x0041('0x41')][_0x0041('0x47')]({'where':{'id':_0x421668[_0x0041('0x4a')]['id']}})[_0x0041('0x26')](handleEntityNotFound(_0xeac147,null))['then'](removeEntity(_0xeac147,null))['catch'](handleError(_0xeac147,null));};exports[_0x0041('0x4b')]=function(_0x4b2ebe,_0x5ecef8){var _0x2f3b65={'key':_0x4b2ebe[_0x0041('0x49')][_0x0041('0x32')]};if(_0x4b2ebe[_0x0041('0x49')]['MailAccountId']){_0x2f3b65[_0x0041('0x4c')]=_0x4b2ebe[_0x0041('0x49')][_0x0041('0x4c')];}else if(_0x4b2ebe[_0x0041('0x49')][_0x0041('0x4d')]){_0x2f3b65[_0x0041('0x4d')]=_0x4b2ebe[_0x0041('0x49')][_0x0041('0x4d')];}else if(_0x4b2ebe[_0x0041('0x49')][_0x0041('0x4e')]){_0x2f3b65['OpenchannelAccountId']=_0x4b2ebe['body'][_0x0041('0x4e')];}else if(_0x4b2ebe[_0x0041('0x49')]['ChatWebsiteId']){_0x2f3b65[_0x0041('0x4f')]=_0x4b2ebe['body'][_0x0041('0x4f')];}return db[_0x0041('0x41')][_0x0041('0x47')]({'where':_0x2f3b65})['then'](function(_0x17b71f){if(_0x17b71f){throw new db[(_0x0041('0x50'))][(_0x0041('0x51'))](_0x0041('0x52'));}return db[_0x0041('0x41')][_0x0041('0x4b')](_0x4b2ebe[_0x0041('0x49')]);})[_0x0041('0x26')](function(_0x239c9c){var _0x49a6c8=_0x4b2ebe[_0x0041('0x53')]['get']({'plain':!![]});if(!_0x49a6c8)throw new Error(_0x0041('0x54'));if(_0x49a6c8['role']===_0x0041('0x53')){var _0x15ec1c=_0x239c9c[_0x0041('0x27')]({'plain':!![]});return db[_0x0041('0x55')]['find']({'where':{'name':'CannedAnswers','userProfileId':_0x49a6c8[_0x0041('0x56')]},'raw':!![]})[_0x0041('0x26')](function(_0x36111d){if(_0x36111d&&_0x36111d[_0x0041('0x57')]===0x0){return db[_0x0041('0x29')][_0x0041('0x4b')]({'name':_0x15ec1c[_0x0041('0x2c')],'resourceId':_0x15ec1c['id'],'type':_0x36111d[_0x0041('0x2c')],'sectionId':_0x36111d['id']},{})[_0x0041('0x26')](function(){return _0x239c9c;});}else{return _0x239c9c;}})[_0x0041('0x48')](function(_0x592dbe){logger[_0x0041('0x58')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x592dbe);throw _0x592dbe;});}return _0x239c9c;})['then'](respondWithResult(_0x5ecef8,0xc9))[_0x0041('0x48')](handleError(_0x5ecef8,null));}; \ No newline at end of file +var _0x042f=['sort','where','filter','merge','options','include','rows','catch','show','params','update','body','find','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','save','then','get','CannedAnswers','UserProfileResource','destroy','error','stack','name','index','map','CannedAnswer','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order'];(function(_0x15fc3c,_0x35665b){var _0x94c5c8=function(_0xbab268){while(--_0xbab268){_0x15fc3c['push'](_0x15fc3c['shift']());}};_0x94c5c8(++_0x35665b);}(_0x042f,0xd3));var _0xf042=function(_0x454018,_0x46e33a){_0x454018=_0x454018-0x0;var _0x24697d=_0x042f[_0x454018];return _0x24697d;};'use strict';var emlformat=require(_0xf042('0x0'));var rimraf=require(_0xf042('0x1'));var zipdir=require(_0xf042('0x2'));var jsonpatch=require(_0xf042('0x3'));var rp=require(_0xf042('0x4'));var moment=require(_0xf042('0x5'));var BPromise=require(_0xf042('0x6'));var Mustache=require(_0xf042('0x7'));var util=require('util');var path=require(_0xf042('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xf042('0x9'));var fs=require('fs');var fs_extra=require(_0xf042('0xa'));var _=require(_0xf042('0xb'));var squel=require(_0xf042('0xc'));var crypto=require(_0xf042('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xf042('0xe'));var toCsv=require(_0xf042('0xf'));var querystring=require(_0xf042('0x10'));var Papa=require(_0xf042('0x11'));var Redis=require(_0xf042('0x12'));var authService=require(_0xf042('0x13'));var qs=require(_0xf042('0x14'));var as=require(_0xf042('0x15'));var hardwareService=require(_0xf042('0x16'));var logger=require(_0xf042('0x17'))(_0xf042('0x18'));var utils=require(_0xf042('0x19'));var config=require(_0xf042('0x1a'));var licenseUtil=require(_0xf042('0x1b'));var db=require(_0xf042('0x1c'))['db'];function respondWithStatusCode(_0x2e85bc,_0x4e4353){_0x4e4353=_0x4e4353||0xcc;return function(_0x5e304a){if(_0x5e304a){return _0x2e85bc['sendStatus'](_0x4e4353);}return _0x2e85bc['status'](_0x4e4353)[_0xf042('0x1d')]();};}function respondWithResult(_0x247ec6,_0x4ed1a7){_0x4ed1a7=_0x4ed1a7||0xc8;return function(_0x2ecf6c){if(_0x2ecf6c){return _0x247ec6['status'](_0x4ed1a7)[_0xf042('0x1e')](_0x2ecf6c);}};}function respondWithFilteredResult(_0x34d93e,_0x3109b8){return function(_0x217d42){if(_0x217d42){var _0x1dab4d=typeof _0x3109b8[_0xf042('0x1f')]===_0xf042('0x20')&&typeof _0x3109b8[_0xf042('0x21')]===_0xf042('0x20');var _0x752534=_0x217d42['count'];var _0x3e94b2=_0x1dab4d?0x0:_0x3109b8['offset'];var _0x258737=_0x1dab4d?_0x217d42[_0xf042('0x22')]:_0x3109b8[_0xf042('0x1f')]+_0x3109b8['limit'];var _0x65d169;if(_0x258737>=_0x752534){_0x258737=_0x752534;_0x65d169=0xc8;}else{_0x65d169=0xce;}_0x34d93e[_0xf042('0x23')](_0x65d169);return _0x34d93e[_0xf042('0x24')](_0xf042('0x25'),_0x3e94b2+'-'+_0x258737+'/'+_0x752534)[_0xf042('0x1e')](_0x217d42);}return null;};}function patchUpdates(_0x57fa11){return function(_0x149c36){try{jsonpatch[_0xf042('0x26')](_0x149c36,_0x57fa11,!![]);}catch(_0x3b581c){return BPromise[_0xf042('0x27')](_0x3b581c);}return _0x149c36[_0xf042('0x28')]();};}function saveUpdates(_0x58c072,_0x54a45f){return function(_0xfa0d69){if(_0xfa0d69){return _0xfa0d69['update'](_0x58c072)['then'](function(_0x517518){return _0x517518;});}return null;};}function removeEntity(_0x3a2791,_0x88b6b3){return function(_0x1c8ef8){if(_0x1c8ef8){return _0x1c8ef8['destroy']()[_0xf042('0x29')](function(){var _0xb7f096=_0x1c8ef8[_0xf042('0x2a')]({'plain':!![]});var _0xa1eb89=_0xf042('0x2b');return db[_0xf042('0x2c')][_0xf042('0x2d')]({'where':{'type':_0xa1eb89,'resourceId':_0xb7f096['id']}})[_0xf042('0x29')](function(){return _0x1c8ef8;});})[_0xf042('0x29')](function(){_0x3a2791[_0xf042('0x23')](0xcc)['end']();});}};}function handleEntityNotFound(_0x250e11,_0x39cc17){return function(_0x2a2ca5){if(!_0x2a2ca5){_0x250e11['sendStatus'](0x194);}return _0x2a2ca5;};}function handleError(_0x514320,_0x56a776){_0x56a776=_0x56a776||0x1f4;return function(_0x6b2125){logger[_0xf042('0x2e')](_0x6b2125[_0xf042('0x2f')]);if(_0x6b2125[_0xf042('0x30')]){delete _0x6b2125[_0xf042('0x30')];}_0x514320[_0xf042('0x23')](_0x56a776)['send'](_0x6b2125);};}exports[_0xf042('0x31')]=function(_0x540a98,_0x349c74){var _0x43ccef={},_0x438a79={},_0xc2e087={'count':0x0,'rows':[]};var _0x26dd1=_[_0xf042('0x32')](db[_0xf042('0x33')][_0xf042('0x34')],function(_0x46e733){return{'name':_0x46e733[_0xf042('0x35')],'type':_0x46e733['type'][_0xf042('0x36')]};});_0x438a79[_0xf042('0x37')]=_[_0xf042('0x32')](_0x26dd1,_0xf042('0x30'));_0x438a79[_0xf042('0x38')]=_[_0xf042('0x39')](_0x540a98[_0xf042('0x38')]);_0x438a79[_0xf042('0x3a')]=_[_0xf042('0x3b')](_0x438a79[_0xf042('0x37')],_0x438a79[_0xf042('0x38')]);_0x43ccef['attributes']=_['intersection'](_0x438a79[_0xf042('0x37')],qs[_0xf042('0x3c')](_0x540a98[_0xf042('0x38')][_0xf042('0x3c')]));_0x43ccef[_0xf042('0x3d')]=_0x43ccef[_0xf042('0x3d')][_0xf042('0x3e')]?_0x43ccef[_0xf042('0x3d')]:_0x438a79[_0xf042('0x37')];if(!_0x540a98[_0xf042('0x38')]['hasOwnProperty'](_0xf042('0x3f'))){_0x43ccef[_0xf042('0x21')]=qs[_0xf042('0x21')](_0x540a98[_0xf042('0x38')][_0xf042('0x21')]);_0x43ccef[_0xf042('0x1f')]=qs['offset'](_0x540a98[_0xf042('0x38')][_0xf042('0x1f')]);}_0x43ccef[_0xf042('0x40')]=qs[_0xf042('0x41')](_0x540a98[_0xf042('0x38')][_0xf042('0x41')]);_0x43ccef[_0xf042('0x42')]=qs['filters'](_['pick'](_0x540a98[_0xf042('0x38')],_0x438a79[_0xf042('0x3a')]),_0x26dd1);if(_0x540a98[_0xf042('0x38')][_0xf042('0x43')]){_0x43ccef[_0xf042('0x42')]=_['merge'](_0x43ccef[_0xf042('0x42')],{'$or':[{'key':{'$like':'%'+_0x540a98[_0xf042('0x38')]['filter']+'%'}},{'value':{'$like':'%'+_0x540a98[_0xf042('0x38')][_0xf042('0x43')]+'%'}}]});}_0x43ccef=_[_0xf042('0x44')]({},_0x43ccef,_0x540a98[_0xf042('0x45')]);var _0x37b636={'where':_0x43ccef[_0xf042('0x42')]};return db[_0xf042('0x33')][_0xf042('0x22')](_0x37b636)[_0xf042('0x29')](function(_0x34ff54){_0xc2e087['count']=_0x34ff54;if(_0x540a98[_0xf042('0x38')]['includeAll']){_0x43ccef[_0xf042('0x46')]=[{'all':!![]}];}return db[_0xf042('0x33')]['findAll'](_0x43ccef);})[_0xf042('0x29')](function(_0xb72140){_0xc2e087[_0xf042('0x47')]=_0xb72140;return _0xc2e087;})[_0xf042('0x29')](respondWithFilteredResult(_0x349c74,_0x43ccef))[_0xf042('0x48')](handleError(_0x349c74,null));};exports[_0xf042('0x49')]=function(_0xa531ac,_0x51a828){var _0x28fd69={'raw':!![],'where':{'id':_0xa531ac[_0xf042('0x4a')]['id']}},_0x3e0761={};_0x3e0761[_0xf042('0x37')]=_[_0xf042('0x39')](db[_0xf042('0x33')]['rawAttributes']);_0x3e0761[_0xf042('0x38')]=_['keys'](_0xa531ac[_0xf042('0x38')]);_0x3e0761[_0xf042('0x3a')]=_['intersection'](_0x3e0761['model'],_0x3e0761[_0xf042('0x38')]);_0x28fd69[_0xf042('0x3d')]=_[_0xf042('0x3b')](_0x3e0761[_0xf042('0x37')],qs[_0xf042('0x3c')](_0xa531ac[_0xf042('0x38')][_0xf042('0x3c')]));_0x28fd69[_0xf042('0x3d')]=_0x28fd69['attributes'][_0xf042('0x3e')]?_0x28fd69[_0xf042('0x3d')]:_0x3e0761[_0xf042('0x37')];if(_0xa531ac[_0xf042('0x38')]['includeAll']){_0x28fd69[_0xf042('0x46')]=[{'all':!![]}];}_0x28fd69=_[_0xf042('0x44')]({},_0x28fd69,_0xa531ac[_0xf042('0x45')]);return db[_0xf042('0x33')]['find'](_0x28fd69)[_0xf042('0x29')](handleEntityNotFound(_0x51a828,null))[_0xf042('0x29')](respondWithResult(_0x51a828,null))['catch'](handleError(_0x51a828,null));};exports[_0xf042('0x4b')]=function(_0x3c7d8f,_0x1a2377){if(_0x3c7d8f[_0xf042('0x4c')]['id']){delete _0x3c7d8f[_0xf042('0x4c')]['id'];}return db['CannedAnswer'][_0xf042('0x4d')]({'where':{'id':_0x3c7d8f[_0xf042('0x4a')]['id']}})[_0xf042('0x29')](handleEntityNotFound(_0x1a2377,null))[_0xf042('0x29')](saveUpdates(_0x3c7d8f[_0xf042('0x4c')],null))['then'](respondWithResult(_0x1a2377,null))[_0xf042('0x48')](handleError(_0x1a2377,null));};exports['destroy']=function(_0xee621a,_0x386b51){return db[_0xf042('0x33')][_0xf042('0x4d')]({'where':{'id':_0xee621a['params']['id']}})[_0xf042('0x29')](handleEntityNotFound(_0x386b51,null))[_0xf042('0x29')](removeEntity(_0x386b51,null))[_0xf042('0x48')](handleError(_0x386b51,null));};exports[_0xf042('0x4e')]=function(_0x5538e0,_0x34527a){var _0x5d68f8={'key':_0x5538e0[_0xf042('0x4c')][_0xf042('0x36')]};if(_0x5538e0[_0xf042('0x4c')][_0xf042('0x4f')]){_0x5d68f8[_0xf042('0x4f')]=_0x5538e0['body'][_0xf042('0x4f')];}else if(_0x5538e0[_0xf042('0x4c')][_0xf042('0x50')]){_0x5d68f8[_0xf042('0x50')]=_0x5538e0[_0xf042('0x4c')][_0xf042('0x50')];}else if(_0x5538e0['body']['OpenchannelAccountId']){_0x5d68f8[_0xf042('0x51')]=_0x5538e0[_0xf042('0x4c')][_0xf042('0x51')];}else if(_0x5538e0[_0xf042('0x4c')][_0xf042('0x52')]){_0x5d68f8['ChatWebsiteId']=_0x5538e0[_0xf042('0x4c')]['ChatWebsiteId'];}return db[_0xf042('0x33')][_0xf042('0x4d')]({'where':_0x5d68f8})[_0xf042('0x29')](function(_0x335c8f){if(_0x335c8f){throw new db[(_0xf042('0x53'))][(_0xf042('0x54'))](_0xf042('0x55'));}return db['CannedAnswer']['create'](_0x5538e0[_0xf042('0x4c')]);})[_0xf042('0x29')](function(_0x55e8fb){var _0x19f641=_0x5538e0[_0xf042('0x56')][_0xf042('0x2a')]({'plain':!![]});if(!_0x19f641)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x19f641[_0xf042('0x57')]===_0xf042('0x56')){var _0x4944ce=_0x55e8fb[_0xf042('0x2a')]({'plain':!![]});return db[_0xf042('0x58')][_0xf042('0x4d')]({'where':{'name':_0xf042('0x2b'),'userProfileId':_0x19f641[_0xf042('0x59')]},'raw':!![]})[_0xf042('0x29')](function(_0x4a20ca){if(_0x4a20ca&&_0x4a20ca[_0xf042('0x5a')]===0x0){return db[_0xf042('0x2c')][_0xf042('0x4e')]({'name':_0x4944ce['name'],'resourceId':_0x4944ce['id'],'type':_0x4a20ca[_0xf042('0x30')],'sectionId':_0x4a20ca['id']},{})[_0xf042('0x29')](function(){return _0x55e8fb;});}else{return _0x55e8fb;}})['catch'](function(_0x12e5a9){logger[_0xf042('0x2e')](_0xf042('0x5b'),_0x12e5a9);throw _0x12e5a9;});}return _0x55e8fb;})[_0xf042('0x29')](respondWithResult(_0x34527a,0xc9))[_0xf042('0x48')](handleError(_0x34527a,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index d27d0e7..4155387 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 _0xb475=['api','moment','bluebird','request-promise','path','./cannedAnswer.attributes','define','tools_canned_answers','utf8mb4','utf8mb4_unicode_ci','util'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xb475,0x107));var _0x5b47=function(_0x4e4f0e,_0x1c3892){_0x4e4f0e=_0x4e4f0e-0x0;var _0x1a7219=_0xb475[_0x4e4f0e];return _0x1a7219;};'use strict';var _=require('lodash');var util=require(_0x5b47('0x0'));var logger=require('../../config/logger')(_0x5b47('0x1'));var moment=require(_0x5b47('0x2'));var BPromise=require(_0x5b47('0x3'));var rp=require(_0x5b47('0x4'));var fs=require('fs');var path=require(_0x5b47('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x5b47('0x6'));module['exports']=function(_0x33e749,_0x230b72){return _0x33e749[_0x5b47('0x7')]('CannedAnswer',attributes,{'tableName':_0x5b47('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x5b47('0x9'),'collate':_0x5b47('0xa')});}; \ No newline at end of file +var _0x0d2a=['exports','define','tools_canned_answers','utf8mb4','utf8mb4_unicode_ci','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./cannedAnswer.attributes'];(function(_0x1a8991,_0x101c4c){var _0x5f4de0=function(_0x633dda){while(--_0x633dda){_0x1a8991['push'](_0x1a8991['shift']());}};_0x5f4de0(++_0x101c4c);}(_0x0d2a,0x1e6));var _0xa0d2=function(_0x3ff225,_0x1b4937){_0x3ff225=_0x3ff225-0x0;var _0x154f3a=_0x0d2a[_0x3ff225];return _0x154f3a;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xa0d2('0x0'))(_0xa0d2('0x1'));var moment=require(_0xa0d2('0x2'));var BPromise=require(_0xa0d2('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa0d2('0x4'));var rimraf=require(_0xa0d2('0x5'));var config=require(_0xa0d2('0x6'));var attributes=require(_0xa0d2('0x7'));module[_0xa0d2('0x8')]=function(_0x164154,_0x175146){return _0x164154[_0xa0d2('0x9')]('CannedAnswer',attributes,{'tableName':_0xa0d2('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa0d2('0xb'),'collate':_0xa0d2('0xc')});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index a6992ae..0698fde 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(_0x5036d8,_0x521f89){var _0x448632=function(_0x5c3e17){while(--_0x5c3e17){_0x5036d8['push'](_0x5036d8['shift']());}};_0x448632(++_0x521f89);}(_0xa9e0,0x123));var _0x0a9e=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0xa9e0[_0x13ea00];return _0x1f7347;};'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(_0xfd7294,_0x297643){var _0x1e42db=function(_0x86d18a){while(--_0x86d18a){_0xfd7294['push'](_0xfd7294['shift']());}};_0x1e42db(++_0x297643);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3a6efd,_0x2a5102){_0x3a6efd=_0x3a6efd-0x0;var _0x487b9a=_0xa9e0[_0x3a6efd];return _0x487b9a;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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 854dda0..86453e2 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 _0x151b=['create','update','destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./cannedAnswer.controller','get','isAuthenticated','index','/:id','show'];(function(_0x561bd8,_0x2458de){var _0x355db5=function(_0x2d221b){while(--_0x2d221b){_0x561bd8['push'](_0x561bd8['shift']());}};_0x355db5(++_0x2458de);}(_0x151b,0x9c));var _0xb151=function(_0x47b613,_0x57153b){_0x47b613=_0x47b613-0x0;var _0x2e5256=_0x151b[_0x47b613];return _0x2e5256;};'use strict';var multer=require(_0xb151('0x0'));var util=require(_0xb151('0x1'));var path=require(_0xb151('0x2'));var timeout=require(_0xb151('0x3'));var express=require(_0xb151('0x4'));var router=express['Router']();var fs_extra=require(_0xb151('0x5'));var auth=require(_0xb151('0x6'));var interaction=require(_0xb151('0x7'));var config=require('../../config/environment');var controller=require(_0xb151('0x8'));router[_0xb151('0x9')]('/',auth[_0xb151('0xa')](),controller[_0xb151('0xb')]);router['get'](_0xb151('0xc'),auth[_0xb151('0xa')](),controller[_0xb151('0xd')]);router['post']('/',auth[_0xb151('0xa')](),controller[_0xb151('0xe')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xb151('0xf')]);router['delete']('/:id',auth[_0xb151('0xa')](),controller[_0xb151('0x10')]);module['exports']=router; \ No newline at end of file +var _0x8f70=['/:id','isAuthenticated','put','update','destroy','exports','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./cannedAnswer.controller','index','get'];(function(_0xbf40bc,_0x53211a){var _0x170ca0=function(_0x5726a2){while(--_0x5726a2){_0xbf40bc['push'](_0xbf40bc['shift']());}};_0x170ca0(++_0x53211a);}(_0x8f70,0x1c8));var _0x08f7=function(_0x3900ae,_0x5a5d96){_0x3900ae=_0x3900ae-0x0;var _0x2a1bec=_0x8f70[_0x3900ae];return _0x2a1bec;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x08f7('0x0'));var timeout=require(_0x08f7('0x1'));var express=require(_0x08f7('0x2'));var router=express['Router']();var fs_extra=require(_0x08f7('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x08f7('0x4'));var config=require(_0x08f7('0x5'));var controller=require(_0x08f7('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x08f7('0x7')]);router[_0x08f7('0x8')](_0x08f7('0x9'),auth[_0x08f7('0xa')](),controller['show']);router['post']('/',auth[_0x08f7('0xa')](),controller['create']);router[_0x08f7('0xb')](_0x08f7('0x9'),auth[_0x08f7('0xa')](),controller[_0x08f7('0xc')]);router['delete'](_0x08f7('0x9'),auth[_0x08f7('0xa')](),controller[_0x08f7('0xd')]);module[_0x08f7('0xe')]=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index f12991c..4239825 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 _0x9879=['STRING','INTEGER','exports','DATE','1970-01-01\x2000:00:01'];(function(_0x530027,_0x471651){var _0xc93713=function(_0x39c587){while(--_0x39c587){_0x530027['push'](_0x530027['shift']());}};_0xc93713(++_0x471651);}(_0x9879,0x98));var _0x9987=function(_0x22d216,_0x478279){_0x22d216=_0x22d216-0x0;var _0x4038ee=_0x9879[_0x22d216];return _0x4038ee;};'use strict';var Sequelize=require('sequelize');module[_0x9987('0x0')]={'calldate':{'type':Sequelize[_0x9987('0x1')],'allowNull':![],'defaultValue':_0x9987('0x2')},'clid':{'type':Sequelize[_0x9987('0x3')]},'src':{'type':Sequelize[_0x9987('0x3')]},'dst':{'type':Sequelize[_0x9987('0x3')]},'dcontext':{'type':Sequelize[_0x9987('0x3')]},'channel':{'type':Sequelize[_0x9987('0x3')]},'dstchannel':{'type':Sequelize[_0x9987('0x3')]},'lastapp':{'type':Sequelize[_0x9987('0x3')]},'lastdata':{'type':Sequelize[_0x9987('0x3')]},'duration':{'type':Sequelize[_0x9987('0x4')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x9987('0x4')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x9987('0x3')]},'amaflags':{'type':Sequelize[_0x9987('0x4')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0x9987('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize['STRING']},'sequence':{'type':Sequelize[_0x9987('0x3')]},'peeraccount':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x9987('0x3')]},'tag':{'type':Sequelize[_0x9987('0x3')]}}; \ No newline at end of file +var _0x7f1b=['STRING','INTEGER','sequelize'];(function(_0x1de4b8,_0x529b41){var _0x557699=function(_0xb10c18){while(--_0xb10c18){_0x1de4b8['push'](_0x1de4b8['shift']());}};_0x557699(++_0x529b41);}(_0x7f1b,0x12b));var _0xb7f1=function(_0x28df47,_0x58d0e8){_0x28df47=_0x28df47-0x0;var _0x36f6b7=_0x7f1b[_0x28df47];return _0x36f6b7;};'use strict';var Sequelize=require(_0xb7f1('0x0'));module['exports']={'calldate':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':'1970-01-01\x2000:00:01'},'clid':{'type':Sequelize[_0xb7f1('0x1')]},'src':{'type':Sequelize['STRING']},'dst':{'type':Sequelize['STRING']},'dcontext':{'type':Sequelize[_0xb7f1('0x1')]},'channel':{'type':Sequelize[_0xb7f1('0x1')]},'dstchannel':{'type':Sequelize[_0xb7f1('0x1')]},'lastapp':{'type':Sequelize[_0xb7f1('0x1')]},'lastdata':{'type':Sequelize[_0xb7f1('0x1')]},'duration':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0xb7f1('0x2')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xb7f1('0x1')]},'amaflags':{'type':Sequelize[_0xb7f1('0x2')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0xb7f1('0x1')]},'userfield':{'type':Sequelize[_0xb7f1('0x1')]},'uniqueid':{'type':Sequelize[_0xb7f1('0x1')]},'linkedid':{'type':Sequelize[_0xb7f1('0x1')]},'sequence':{'type':Sequelize[_0xb7f1('0x1')]},'peeraccount':{'type':Sequelize[_0xb7f1('0x1')]},'type':{'type':Sequelize[_0xb7f1('0x1')]},'tag':{'type':Sequelize[_0xb7f1('0x1')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index 51f0247..33189c4 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 _0xb66c=['catch','show','params','includeAll','find','create','body','describe','eml-format','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','update','then','error','stack','name','send','index','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','Cdr','include'];(function(_0x1928c9,_0x13a6d1){var _0x51b5fb=function(_0x24cf70){while(--_0x24cf70){_0x1928c9['push'](_0x1928c9['shift']());}};_0x51b5fb(++_0x13a6d1);}(_0xb66c,0x175));var _0xcb66=function(_0x32d462,_0x3f564e){_0x32d462=_0x32d462-0x0;var _0x54a24d=_0xb66c[_0x32d462];return _0x54a24d;};'use strict';var emlformat=require(_0xcb66('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xcb66('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xcb66('0x2'));var moment=require(_0xcb66('0x3'));var BPromise=require(_0xcb66('0x4'));var Mustache=require('mustache');var util=require(_0xcb66('0x5'));var path=require(_0xcb66('0x6'));var sox=require(_0xcb66('0x7'));var csv=require(_0xcb66('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xcb66('0x9'));var squel=require(_0xcb66('0xa'));var crypto=require(_0xcb66('0xb'));var jsforce=require(_0xcb66('0xc'));var deskjs=require(_0xcb66('0xd'));var toCsv=require('to-csv');var querystring=require(_0xcb66('0xe'));var Papa=require(_0xcb66('0xf'));var Redis=require(_0xcb66('0x10'));var authService=require(_0xcb66('0x11'));var qs=require(_0xcb66('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcb66('0x13'));var logger=require(_0xcb66('0x14'))(_0xcb66('0x15'));var utils=require(_0xcb66('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xcb66('0x17'));var db=require(_0xcb66('0x18'))['db'];function respondWithStatusCode(_0x4105d2,_0x2339bb){_0x2339bb=_0x2339bb||0xcc;return function(_0x582523){if(_0x582523){return _0x4105d2[_0xcb66('0x19')](_0x2339bb);}return _0x4105d2[_0xcb66('0x1a')](_0x2339bb)[_0xcb66('0x1b')]();};}function respondWithResult(_0x401bc9,_0x58fb9e){_0x58fb9e=_0x58fb9e||0xc8;return function(_0x19072b){if(_0x19072b){return _0x401bc9['status'](_0x58fb9e)[_0xcb66('0x1c')](_0x19072b);}};}function respondWithFilteredResult(_0x52b058,_0x27442d){return function(_0x573dc7){if(_0x573dc7){var _0x4bef09=typeof _0x27442d[_0xcb66('0x1d')]===_0xcb66('0x1e')&&typeof _0x27442d[_0xcb66('0x1f')]===_0xcb66('0x1e');var _0x4d99c0=_0x573dc7[_0xcb66('0x20')];var _0x42ad03=_0x4bef09?0x0:_0x27442d[_0xcb66('0x1d')];var _0x58bca0=_0x4bef09?_0x573dc7[_0xcb66('0x20')]:_0x27442d['offset']+_0x27442d[_0xcb66('0x1f')];var _0x41edae;if(_0x58bca0>=_0x4d99c0){_0x58bca0=_0x4d99c0;_0x41edae=0xc8;}else{_0x41edae=0xce;}_0x52b058[_0xcb66('0x1a')](_0x41edae);return _0x52b058[_0xcb66('0x21')]('Content-Range',_0x42ad03+'-'+_0x58bca0+'/'+_0x4d99c0)['json'](_0x573dc7);}return null;};}function patchUpdates(_0x4d9690){return function(_0xb39b87){try{jsonpatch['apply'](_0xb39b87,_0x4d9690,!![]);}catch(_0x5e07e8){return BPromise[_0xcb66('0x22')](_0x5e07e8);}return _0xb39b87['save']();};}function saveUpdates(_0x1c1219,_0x12e2bc){return function(_0x602b44){if(_0x602b44){return _0x602b44[_0xcb66('0x23')](_0x1c1219)[_0xcb66('0x24')](function(_0x204f15){return _0x204f15;});}return null;};}function removeEntity(_0x3391a0,_0x5977e1){return function(_0x36faba){if(_0x36faba){return _0x36faba['destroy']()['then'](function(){_0x3391a0[_0xcb66('0x1a')](0xcc)[_0xcb66('0x1b')]();});}};}function handleEntityNotFound(_0x19da3b,_0x5f389f){return function(_0x341554){if(!_0x341554){_0x19da3b[_0xcb66('0x19')](0x194);}return _0x341554;};}function handleError(_0x43cd8f,_0x40e3de){_0x40e3de=_0x40e3de||0x1f4;return function(_0x5affdb){logger[_0xcb66('0x25')](_0x5affdb[_0xcb66('0x26')]);if(_0x5affdb[_0xcb66('0x27')]){delete _0x5affdb[_0xcb66('0x27')];}_0x43cd8f[_0xcb66('0x1a')](_0x40e3de)[_0xcb66('0x28')](_0x5affdb);};}exports[_0xcb66('0x29')]=function(_0x967710,_0x28fc0b){var _0x178a06={},_0x516194={},_0x2152dc={'count':0x0,'rows':[]};var _0x5b7cf2=_['map'](db['Cdr'][_0xcb66('0x2a')],function(_0x4ca8b4){return{'name':_0x4ca8b4[_0xcb66('0x2b')],'type':_0x4ca8b4[_0xcb66('0x2c')][_0xcb66('0x2d')]};});_0x516194['model']=_[_0xcb66('0x2e')](_0x5b7cf2,_0xcb66('0x27'));_0x516194[_0xcb66('0x2f')]=_[_0xcb66('0x30')](_0x967710[_0xcb66('0x2f')]);_0x516194[_0xcb66('0x31')]=_[_0xcb66('0x32')](_0x516194[_0xcb66('0x33')],_0x516194[_0xcb66('0x2f')]);_0x178a06[_0xcb66('0x34')]=_['intersection'](_0x516194[_0xcb66('0x33')],qs[_0xcb66('0x35')](_0x967710[_0xcb66('0x2f')][_0xcb66('0x35')]));_0x178a06[_0xcb66('0x34')]=_0x178a06[_0xcb66('0x34')][_0xcb66('0x36')]?_0x178a06['attributes']:_0x516194[_0xcb66('0x33')];if(!_0x967710[_0xcb66('0x2f')][_0xcb66('0x37')](_0xcb66('0x38'))){_0x178a06['limit']=qs[_0xcb66('0x1f')](_0x967710[_0xcb66('0x2f')][_0xcb66('0x1f')]);_0x178a06[_0xcb66('0x1d')]=qs[_0xcb66('0x1d')](_0x967710[_0xcb66('0x2f')][_0xcb66('0x1d')]);}_0x178a06[_0xcb66('0x39')]=qs[_0xcb66('0x3a')](_0x967710[_0xcb66('0x2f')][_0xcb66('0x3a')]);_0x178a06[_0xcb66('0x3b')]=qs['filters'](_['pick'](_0x967710['query'],_0x516194[_0xcb66('0x31')]),_0x5b7cf2);if(_0x967710[_0xcb66('0x2f')][_0xcb66('0x3c')]){_0x178a06[_0xcb66('0x3b')]=_[_0xcb66('0x3d')](_0x178a06[_0xcb66('0x3b')],{'$or':_['map'](_0x5b7cf2,function(_0x13865f){if(_0x13865f['type']!=='VIRTUAL'){var _0x5af5d4={};_0x5af5d4[_0x13865f[_0xcb66('0x27')]]={'$like':'%'+_0x967710[_0xcb66('0x2f')][_0xcb66('0x3c')]+'%'};return _0x5af5d4;}})});}_0x178a06=_[_0xcb66('0x3d')]({},_0x178a06,_0x967710[_0xcb66('0x3e')]);var _0x3e71a7={'where':_0x178a06[_0xcb66('0x3b')]};return db[_0xcb66('0x3f')][_0xcb66('0x20')](_0x3e71a7)['then'](function(_0xe45331){_0x2152dc[_0xcb66('0x20')]=_0xe45331;if(_0x967710[_0xcb66('0x2f')]['includeAll']){_0x178a06[_0xcb66('0x40')]=[{'all':!![]}];}return db[_0xcb66('0x3f')]['findAll'](_0x178a06);})['then'](function(_0x277838){_0x2152dc['rows']=_0x277838;return _0x2152dc;})['then'](respondWithFilteredResult(_0x28fc0b,_0x178a06))[_0xcb66('0x41')](handleError(_0x28fc0b,null));};exports[_0xcb66('0x42')]=function(_0x3a260b,_0x165bcc){var _0x99229={'raw':!![],'where':{'id':_0x3a260b[_0xcb66('0x43')]['id']}},_0x235862={};_0x235862[_0xcb66('0x33')]=_[_0xcb66('0x30')](db['Cdr']['rawAttributes']);_0x235862['query']=_[_0xcb66('0x30')](_0x3a260b['query']);_0x235862[_0xcb66('0x31')]=_['intersection'](_0x235862[_0xcb66('0x33')],_0x235862[_0xcb66('0x2f')]);_0x99229[_0xcb66('0x34')]=_[_0xcb66('0x32')](_0x235862[_0xcb66('0x33')],qs[_0xcb66('0x35')](_0x3a260b['query']['fields']));_0x99229[_0xcb66('0x34')]=_0x99229[_0xcb66('0x34')][_0xcb66('0x36')]?_0x99229[_0xcb66('0x34')]:_0x235862[_0xcb66('0x33')];if(_0x3a260b[_0xcb66('0x2f')][_0xcb66('0x44')]){_0x99229[_0xcb66('0x40')]=[{'all':!![]}];}_0x99229=_[_0xcb66('0x3d')]({},_0x99229,_0x3a260b['options']);return db[_0xcb66('0x3f')][_0xcb66('0x45')](_0x99229)[_0xcb66('0x24')](handleEntityNotFound(_0x165bcc,null))[_0xcb66('0x24')](respondWithResult(_0x165bcc,null))['catch'](handleError(_0x165bcc,null));};exports[_0xcb66('0x46')]=function(_0x2f9fb5,_0x1aab4e){return db['Cdr'][_0xcb66('0x46')](_0x2f9fb5[_0xcb66('0x47')],{})[_0xcb66('0x24')](respondWithResult(_0x1aab4e,0xc9))[_0xcb66('0x41')](handleError(_0x1aab4e,null));};exports['update']=function(_0x43e0e0,_0xb0854f){if(_0x43e0e0[_0xcb66('0x47')]['id']){delete _0x43e0e0['body']['id'];}return db['Cdr'][_0xcb66('0x45')]({'where':{'id':_0x43e0e0['params']['id']}})[_0xcb66('0x24')](handleEntityNotFound(_0xb0854f,null))['then'](saveUpdates(_0x43e0e0[_0xcb66('0x47')],null))[_0xcb66('0x24')](respondWithResult(_0xb0854f,null))[_0xcb66('0x41')](handleError(_0xb0854f,null));};exports['destroy']=function(_0x2071d5,_0x5f01a2){return db[_0xcb66('0x3f')][_0xcb66('0x45')]({'where':{'id':_0x2071d5[_0xcb66('0x43')]['id']}})[_0xcb66('0x24')](handleEntityNotFound(_0x5f01a2,null))[_0xcb66('0x24')](removeEntity(_0x5f01a2,null))['catch'](handleError(_0x5f01a2,null));};exports[_0xcb66('0x48')]=function(_0x5b04ad,_0xd68e76){return db[_0xcb66('0x3f')][_0xcb66('0x48')]()['then'](respondWithResult(_0xd68e76,null))['catch'](handleError(_0xd68e76,null));}; \ No newline at end of file +var _0x5162=['undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','map','Cdr','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','catch','show','params','intersection','find','create','body','eml-format','moment','bluebird','mustache','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5162,0x103));var _0x2516=function(_0x1627cd,_0x2a9058){_0x1627cd=_0x1627cd-0x0;var _0x3d7971=_0x5162[_0x1627cd];return _0x3d7971;};'use strict';var emlformat=require(_0x2516('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x2516('0x1'));var BPromise=require(_0x2516('0x2'));var Mustache=require(_0x2516('0x3'));var util=require(_0x2516('0x4'));var path=require(_0x2516('0x5'));var sox=require(_0x2516('0x6'));var csv=require(_0x2516('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x2516('0x8'));var crypto=require(_0x2516('0x9'));var jsforce=require(_0x2516('0xa'));var deskjs=require(_0x2516('0xb'));var toCsv=require(_0x2516('0x7'));var querystring=require(_0x2516('0xc'));var Papa=require(_0x2516('0xd'));var Redis=require('ioredis');var authService=require(_0x2516('0xe'));var qs=require(_0x2516('0xf'));var as=require(_0x2516('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x2516('0x11'));var licenseUtil=require(_0x2516('0x12'));var db=require(_0x2516('0x13'))['db'];function respondWithStatusCode(_0x3ef6ff,_0x56c69c){_0x56c69c=_0x56c69c||0xcc;return function(_0x33496b){if(_0x33496b){return _0x3ef6ff[_0x2516('0x14')](_0x56c69c);}return _0x3ef6ff[_0x2516('0x15')](_0x56c69c)[_0x2516('0x16')]();};}function respondWithResult(_0x42c771,_0x558d20){_0x558d20=_0x558d20||0xc8;return function(_0x3e5e0f){if(_0x3e5e0f){return _0x42c771[_0x2516('0x15')](_0x558d20)[_0x2516('0x17')](_0x3e5e0f);}};}function respondWithFilteredResult(_0x181a28,_0x2637e8){return function(_0x2ec31f){if(_0x2ec31f){var _0x19aacb=typeof _0x2637e8[_0x2516('0x18')]===_0x2516('0x19')&&typeof _0x2637e8['limit']===_0x2516('0x19');var _0x1ced29=_0x2ec31f[_0x2516('0x1a')];var _0x564d05=_0x19aacb?0x0:_0x2637e8[_0x2516('0x18')];var _0x5e96c7=_0x19aacb?_0x2ec31f['count']:_0x2637e8[_0x2516('0x18')]+_0x2637e8[_0x2516('0x1b')];var _0x151168;if(_0x5e96c7>=_0x1ced29){_0x5e96c7=_0x1ced29;_0x151168=0xc8;}else{_0x151168=0xce;}_0x181a28[_0x2516('0x15')](_0x151168);return _0x181a28[_0x2516('0x1c')](_0x2516('0x1d'),_0x564d05+'-'+_0x5e96c7+'/'+_0x1ced29)[_0x2516('0x17')](_0x2ec31f);}return null;};}function patchUpdates(_0x113616){return function(_0x248c5a){try{jsonpatch[_0x2516('0x1e')](_0x248c5a,_0x113616,!![]);}catch(_0x39ba5b){return BPromise[_0x2516('0x1f')](_0x39ba5b);}return _0x248c5a[_0x2516('0x20')]();};}function saveUpdates(_0x4fb7d9,_0x559a3e){return function(_0x12db4d){if(_0x12db4d){return _0x12db4d[_0x2516('0x21')](_0x4fb7d9)[_0x2516('0x22')](function(_0x2d5b1b){return _0x2d5b1b;});}return null;};}function removeEntity(_0x3ffb6d,_0x32de7a){return function(_0x3d906d){if(_0x3d906d){return _0x3d906d[_0x2516('0x23')]()['then'](function(){_0x3ffb6d[_0x2516('0x15')](0xcc)[_0x2516('0x16')]();});}};}function handleEntityNotFound(_0x774b60,_0x434d54){return function(_0x47f4fb){if(!_0x47f4fb){_0x774b60[_0x2516('0x14')](0x194);}return _0x47f4fb;};}function handleError(_0x30eeb9,_0x1f722c){_0x1f722c=_0x1f722c||0x1f4;return function(_0x3d728a){logger[_0x2516('0x24')](_0x3d728a['stack']);if(_0x3d728a[_0x2516('0x25')]){delete _0x3d728a[_0x2516('0x25')];}_0x30eeb9[_0x2516('0x15')](_0x1f722c)[_0x2516('0x26')](_0x3d728a);};}exports[_0x2516('0x27')]=function(_0x285e67,_0x556f01){var _0x136893={},_0x20dc9f={},_0x493a3e={'count':0x0,'rows':[]};var _0x19d90d=_[_0x2516('0x28')](db[_0x2516('0x29')][_0x2516('0x2a')],function(_0x539704){return{'name':_0x539704[_0x2516('0x2b')],'type':_0x539704[_0x2516('0x2c')][_0x2516('0x2d')]};});_0x20dc9f[_0x2516('0x2e')]=_[_0x2516('0x28')](_0x19d90d,_0x2516('0x25'));_0x20dc9f[_0x2516('0x2f')]=_[_0x2516('0x30')](_0x285e67[_0x2516('0x2f')]);_0x20dc9f[_0x2516('0x31')]=_['intersection'](_0x20dc9f[_0x2516('0x2e')],_0x20dc9f['query']);_0x136893[_0x2516('0x32')]=_['intersection'](_0x20dc9f[_0x2516('0x2e')],qs['fields'](_0x285e67[_0x2516('0x2f')][_0x2516('0x33')]));_0x136893[_0x2516('0x32')]=_0x136893[_0x2516('0x32')][_0x2516('0x34')]?_0x136893[_0x2516('0x32')]:_0x20dc9f[_0x2516('0x2e')];if(!_0x285e67[_0x2516('0x2f')][_0x2516('0x35')]('nolimit')){_0x136893[_0x2516('0x1b')]=qs[_0x2516('0x1b')](_0x285e67[_0x2516('0x2f')][_0x2516('0x1b')]);_0x136893['offset']=qs['offset'](_0x285e67[_0x2516('0x2f')][_0x2516('0x18')]);}_0x136893[_0x2516('0x36')]=qs[_0x2516('0x37')](_0x285e67[_0x2516('0x2f')][_0x2516('0x37')]);_0x136893[_0x2516('0x38')]=qs[_0x2516('0x31')](_[_0x2516('0x39')](_0x285e67[_0x2516('0x2f')],_0x20dc9f['filters']),_0x19d90d);if(_0x285e67['query'][_0x2516('0x3a')]){_0x136893[_0x2516('0x38')]=_['merge'](_0x136893['where'],{'$or':_[_0x2516('0x28')](_0x19d90d,function(_0x3b310f){if(_0x3b310f['type']!==_0x2516('0x3b')){var _0x52ef6b={};_0x52ef6b[_0x3b310f[_0x2516('0x25')]]={'$like':'%'+_0x285e67[_0x2516('0x2f')]['filter']+'%'};return _0x52ef6b;}})});}_0x136893=_[_0x2516('0x3c')]({},_0x136893,_0x285e67[_0x2516('0x3d')]);var _0x155cf7={'where':_0x136893[_0x2516('0x38')]};return db[_0x2516('0x29')][_0x2516('0x1a')](_0x155cf7)[_0x2516('0x22')](function(_0x2371a8){_0x493a3e[_0x2516('0x1a')]=_0x2371a8;if(_0x285e67[_0x2516('0x2f')][_0x2516('0x3e')]){_0x136893[_0x2516('0x3f')]=[{'all':!![]}];}return db[_0x2516('0x29')]['findAll'](_0x136893);})[_0x2516('0x22')](function(_0x1bc0e){_0x493a3e['rows']=_0x1bc0e;return _0x493a3e;})[_0x2516('0x22')](respondWithFilteredResult(_0x556f01,_0x136893))[_0x2516('0x40')](handleError(_0x556f01,null));};exports[_0x2516('0x41')]=function(_0x1afefb,_0x421c58){var _0x582cb6={'raw':!![],'where':{'id':_0x1afefb[_0x2516('0x42')]['id']}},_0x1a8d2d={};_0x1a8d2d[_0x2516('0x2e')]=_[_0x2516('0x30')](db[_0x2516('0x29')][_0x2516('0x2a')]);_0x1a8d2d['query']=_[_0x2516('0x30')](_0x1afefb[_0x2516('0x2f')]);_0x1a8d2d[_0x2516('0x31')]=_[_0x2516('0x43')](_0x1a8d2d[_0x2516('0x2e')],_0x1a8d2d[_0x2516('0x2f')]);_0x582cb6[_0x2516('0x32')]=_['intersection'](_0x1a8d2d[_0x2516('0x2e')],qs['fields'](_0x1afefb[_0x2516('0x2f')]['fields']));_0x582cb6[_0x2516('0x32')]=_0x582cb6[_0x2516('0x32')][_0x2516('0x34')]?_0x582cb6['attributes']:_0x1a8d2d['model'];if(_0x1afefb[_0x2516('0x2f')][_0x2516('0x3e')]){_0x582cb6['include']=[{'all':!![]}];}_0x582cb6=_['merge']({},_0x582cb6,_0x1afefb[_0x2516('0x3d')]);return db[_0x2516('0x29')][_0x2516('0x44')](_0x582cb6)['then'](handleEntityNotFound(_0x421c58,null))[_0x2516('0x22')](respondWithResult(_0x421c58,null))['catch'](handleError(_0x421c58,null));};exports[_0x2516('0x45')]=function(_0x39fd32,_0x318128){return db[_0x2516('0x29')]['create'](_0x39fd32[_0x2516('0x46')],{})[_0x2516('0x22')](respondWithResult(_0x318128,0xc9))[_0x2516('0x40')](handleError(_0x318128,null));};exports[_0x2516('0x21')]=function(_0x43874c,_0x482883){if(_0x43874c[_0x2516('0x46')]['id']){delete _0x43874c[_0x2516('0x46')]['id'];}return db[_0x2516('0x29')][_0x2516('0x44')]({'where':{'id':_0x43874c['params']['id']}})[_0x2516('0x22')](handleEntityNotFound(_0x482883,null))[_0x2516('0x22')](saveUpdates(_0x43874c[_0x2516('0x46')],null))[_0x2516('0x22')](respondWithResult(_0x482883,null))[_0x2516('0x40')](handleError(_0x482883,null));};exports['destroy']=function(_0x1c4be3,_0x1aa854){return db[_0x2516('0x29')][_0x2516('0x44')]({'where':{'id':_0x1c4be3[_0x2516('0x42')]['id']}})[_0x2516('0x22')](handleEntityNotFound(_0x1aa854,null))['then'](removeEntity(_0x1aa854,null))['catch'](handleError(_0x1aa854,null));};exports['describe']=function(_0x323590,_0x4f7eb4){return db['Cdr']['describe']()[_0x2516('0x22')](respondWithResult(_0x4f7eb4,null))[_0x2516('0x40')](handleError(_0x4f7eb4,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index 1e5f8a3..97d5184 100644 --- a/server/api/cdr/cdr.model.js +++ b/server/api/cdr/cdr.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['dst','src','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./cdr.attributes','exports','define','Cdr','accountcode','calldate','disposition'];(function(_0x2c7887,_0x1766eb){var _0x14ef50=function(_0x26a2ce){while(--_0x26a2ce){_0x2c7887['push'](_0x2c7887['shift']());}};_0x14ef50(++_0x1766eb);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'cdr','paranoid':![],'indexes':[{'name':_0x7995('0xc'),'fields':[_0x7995('0xc')]},{'name':'calldate','fields':[_0x7995('0xd')]},{'name':_0x7995('0xe'),'fields':[_0x7995('0xe')]},{'name':_0x7995('0xf'),'fields':[_0x7995('0xf')]},{'name':_0x7995('0x10'),'fields':[_0x7995('0x10')]},{'name':'uniqueid','fields':[_0x7995('0x11')]}],'timestamps':![]});}; \ No newline at end of file +var _0x9957=['dst','src','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./cdr.attributes','exports','define','Cdr','accountcode','calldate','disposition'];(function(_0x524b91,_0x114311){var _0x35988a=function(_0x5d1153){while(--_0x5d1153){_0x524b91['push'](_0x524b91['shift']());}};_0x35988a(++_0x114311);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'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 ccd058b..06c5250 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 _0xe282=['error','message','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','info','Cdr,\x20%s,\x20%s','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x156a84,_0x1e54bf){var _0x63b32f=function(_0x35fbe9){while(--_0x35fbe9){_0x156a84['push'](_0x156a84['shift']());}};_0x63b32f(++_0x1e54bf);}(_0xe282,0x194));var _0x2e28=function(_0x343306,_0x357170){_0x343306=_0x343306-0x0;var _0xc64b08=_0xe282[_0x343306];return _0xc64b08;};'use strict';var _=require(_0x2e28('0x0'));var util=require(_0x2e28('0x1'));var moment=require('moment');var BPromise=require(_0x2e28('0x2'));var rs=require(_0x2e28('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2e28('0x4'))['db'];var utils=require(_0x2e28('0x5'));var logger=require(_0x2e28('0x6'))('rpc');var config=require(_0x2e28('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x2e28('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x464067,_0x65c56f,_0x37c819){return new BPromise(function(_0x55cf99,_0x3c8eda){return client[_0x2e28('0x9')](_0x464067,_0x37c819)['then'](function(_0x55829f){logger[_0x2e28('0xa')](_0x2e28('0xb'),_0x65c56f,_0x2e28('0xc'));logger[_0x2e28('0xd')](_0x2e28('0xe'),_0x65c56f,'request\x20sent',JSON[_0x2e28('0xf')](_0x55829f));if(_0x55829f['error']){if(_0x55829f['error']['code']===0x1f4){logger[_0x2e28('0x10')](_0x2e28('0xb'),_0x65c56f,_0x55829f[_0x2e28('0x10')][_0x2e28('0x11')]);return _0x3c8eda(_0x55829f[_0x2e28('0x10')][_0x2e28('0x11')]);}logger[_0x2e28('0x10')](_0x2e28('0xb'),_0x65c56f,_0x55829f[_0x2e28('0x10')]['message']);return _0x55cf99(_0x55829f[_0x2e28('0x10')][_0x2e28('0x11')]);}else{logger[_0x2e28('0xa')](_0x2e28('0xb'),_0x65c56f,_0x2e28('0xc'));_0x55cf99(_0x55829f[_0x2e28('0x12')][_0x2e28('0x11')]);}})[_0x2e28('0x13')](function(_0x3ebd0a){logger[_0x2e28('0x10')]('Cdr,\x20%s,\x20%s',_0x65c56f,_0x3ebd0a);_0x3c8eda(_0x3ebd0a);});});} \ No newline at end of file +var _0xa83a=['rpc','../../config/environment','jayson/promise','client','request','then','Cdr,\x20%s,\x20%s','debug','Cdr,\x20%s,\x20%s,\x20%s','error','code','message','info','request\x20sent','catch','util','moment','ioredis','../../mysqldb','../../config/logger'];(function(_0x7293e1,_0x3e8cf2){var _0x3ec34f=function(_0x29f472){while(--_0x29f472){_0x7293e1['push'](_0x7293e1['shift']());}};_0x3ec34f(++_0x3e8cf2);}(_0xa83a,0x1ef));var _0xaa83=function(_0x43181e,_0x1afd63){_0x43181e=_0x43181e-0x0;var _0x3c1df3=_0xa83a[_0x43181e];return _0x3c1df3;};'use strict';var _=require('lodash');var util=require(_0xaa83('0x0'));var moment=require(_0xaa83('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xaa83('0x2'));var db=require(_0xaa83('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xaa83('0x4'))(_0xaa83('0x5'));var config=require(_0xaa83('0x6'));var jayson=require(_0xaa83('0x7'));var client=jayson[_0xaa83('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x52f727,_0x5c7964,_0x96a339){return new BPromise(function(_0x1e41d2,_0x3ef085){return client[_0xaa83('0x9')](_0x52f727,_0x96a339)[_0xaa83('0xa')](function(_0x502560){logger['info'](_0xaa83('0xb'),_0x5c7964,'request\x20sent');logger[_0xaa83('0xc')](_0xaa83('0xd'),_0x5c7964,'request\x20sent',JSON['stringify'](_0x502560));if(_0x502560[_0xaa83('0xe')]){if(_0x502560[_0xaa83('0xe')][_0xaa83('0xf')]===0x1f4){logger[_0xaa83('0xe')](_0xaa83('0xb'),_0x5c7964,_0x502560[_0xaa83('0xe')][_0xaa83('0x10')]);return _0x3ef085(_0x502560[_0xaa83('0xe')][_0xaa83('0x10')]);}logger[_0xaa83('0xe')](_0xaa83('0xb'),_0x5c7964,_0x502560['error']['message']);return _0x1e41d2(_0x502560[_0xaa83('0xe')][_0xaa83('0x10')]);}else{logger[_0xaa83('0x11')](_0xaa83('0xb'),_0x5c7964,_0xaa83('0x12'));_0x1e41d2(_0x502560['result'][_0xaa83('0x10')]);}})[_0xaa83('0x13')](function(_0x42dc4d){logger[_0xaa83('0xe')](_0xaa83('0xb'),_0x5c7964,_0x42dc4d);_0x3ef085(_0x42dc4d);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index 3ea7b25..31b92e2 100644 --- a/server/api/cdr/index.js +++ b/server/api/cdr/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','create','put','update'];(function(_0x772156,_0x5b5faa){var _0x79234b=function(_0x54773f){while(--_0x54773f){_0x772156['push'](_0x772156['shift']());}};_0x79234b(++_0x5b5faa);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./cdr.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file +var _0xd8b0=['destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','create','put','update'];(function(_0x434339,_0x2abf5e){var _0x507ca6=function(_0x23770a){while(--_0x23770a){_0x434339['push'](_0x434339['shift']());}};_0x507ca6(++_0x2abf5e);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./cdr.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index e4148ad..508ccd4 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 _0x7ff2=['exports','STRING','noop','*,*,*,*','sequelize'];(function(_0xd1da9f,_0x422c1e){var _0x3dc5d5=function(_0x54c2ed){while(--_0x54c2ed){_0xd1da9f['push'](_0xd1da9f['shift']());}};_0x3dc5d5(++_0x422c1e);}(_0x7ff2,0x18f));var _0x27ff=function(_0x5fc11b,_0x363fa5){_0x5fc11b=_0x5fc11b-0x0;var _0x34fa91=_0x7ff2[_0x5fc11b];return _0x34fa91;};'use strict';var Sequelize=require(_0x27ff('0x0'));module[_0x27ff('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x27ff('0x2')],'allowNull':![],'defaultValue':_0x27ff('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x27ff('0x2')]},'interval':{'type':Sequelize[_0x27ff('0x2')],'defaultValue':_0x27ff('0x4')}}; \ No newline at end of file +var _0x835f=['TEXT','*,*,*,*','INTEGER','STRING'];(function(_0x5f1391,_0x19c132){var _0x50ebe3=function(_0x3d00a3){while(--_0x3d00a3){_0x5f1391['push'](_0x5f1391['shift']());}};_0x50ebe3(++_0x19c132);}(_0x835f,0x82));var _0xf835=function(_0x251d9c,_0x580977){_0x251d9c=_0x251d9c-0x0;var _0x16ae64=_0x835f[_0x251d9c];return _0x16ae64;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize[_0xf835('0x0')],'allowNull':![]},'app':{'type':Sequelize[_0xf835('0x1')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xf835('0x2')]()},'description':{'type':Sequelize[_0xf835('0x1')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xf835('0x3')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index 0d7a49e..4ca928d 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 _0xbca8=['papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','limit','count','offset','apply','reject','then','destroy','end','error','stack','name','show','params','model','keys','rawAttributes','query','attributes','fields','length','includeAll','include','merge','options','find','catch','update','body','ChatApplication','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring'];(function(_0x3ee1fe,_0x59f2a1){var _0x1ae57a=function(_0x1ef0c4){while(--_0x1ef0c4){_0x3ee1fe['push'](_0x3ee1fe['shift']());}};_0x1ae57a(++_0x59f2a1);}(_0xbca8,0xcc));var _0x8bca=function(_0x189cec,_0x3fb941){_0x189cec=_0x189cec-0x0;var _0x595fd2=_0xbca8[_0x189cec];return _0x595fd2;};'use strict';var emlformat=require(_0x8bca('0x0'));var rimraf=require(_0x8bca('0x1'));var zipdir=require(_0x8bca('0x2'));var jsonpatch=require(_0x8bca('0x3'));var rp=require(_0x8bca('0x4'));var moment=require('moment');var BPromise=require(_0x8bca('0x5'));var Mustache=require(_0x8bca('0x6'));var util=require(_0x8bca('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x8bca('0x8'));var ejs=require(_0x8bca('0x9'));var fs=require('fs');var fs_extra=require(_0x8bca('0xa'));var _=require(_0x8bca('0xb'));var squel=require('squel');var crypto=require(_0x8bca('0xc'));var jsforce=require(_0x8bca('0xd'));var deskjs=require(_0x8bca('0xe'));var toCsv=require(_0x8bca('0x8'));var querystring=require(_0x8bca('0xf'));var Papa=require(_0x8bca('0x10'));var Redis=require(_0x8bca('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x8bca('0x12'));var hardwareService=require(_0x8bca('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x8bca('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x8bca('0x15'));var db=require(_0x8bca('0x16'))['db'];function respondWithStatusCode(_0x5eec01,_0x62c6d1){_0x62c6d1=_0x62c6d1||0xcc;return function(_0x1fe1b5){if(_0x1fe1b5){return _0x5eec01[_0x8bca('0x17')](_0x62c6d1);}return _0x5eec01[_0x8bca('0x18')](_0x62c6d1)['end']();};}function respondWithResult(_0x4bbf5c,_0x250d09){_0x250d09=_0x250d09||0xc8;return function(_0x59b65b){if(_0x59b65b){return _0x4bbf5c[_0x8bca('0x18')](_0x250d09)[_0x8bca('0x19')](_0x59b65b);}};}function respondWithFilteredResult(_0x145cfd,_0x2e3633){return function(_0x1c3590){if(_0x1c3590){var _0x1c78d5=typeof _0x2e3633['offset']==='undefined'&&typeof _0x2e3633[_0x8bca('0x1a')]==='undefined';var _0x2bd7b1=_0x1c3590[_0x8bca('0x1b')];var _0x4e24c8=_0x1c78d5?0x0:_0x2e3633['offset'];var _0x5622ba=_0x1c78d5?_0x1c3590[_0x8bca('0x1b')]:_0x2e3633[_0x8bca('0x1c')]+_0x2e3633['limit'];var _0x1a834c;if(_0x5622ba>=_0x2bd7b1){_0x5622ba=_0x2bd7b1;_0x1a834c=0xc8;}else{_0x1a834c=0xce;}_0x145cfd['status'](_0x1a834c);return _0x145cfd['set']('Content-Range',_0x4e24c8+'-'+_0x5622ba+'/'+_0x2bd7b1)[_0x8bca('0x19')](_0x1c3590);}return null;};}function patchUpdates(_0x17046f){return function(_0xdafaa1){try{jsonpatch[_0x8bca('0x1d')](_0xdafaa1,_0x17046f,!![]);}catch(_0x2d64cd){return BPromise[_0x8bca('0x1e')](_0x2d64cd);}return _0xdafaa1['save']();};}function saveUpdates(_0x315a59,_0x20dc10){return function(_0xf3296b){if(_0xf3296b){return _0xf3296b['update'](_0x315a59)[_0x8bca('0x1f')](function(_0x5ac207){return _0x5ac207;});}return null;};}function removeEntity(_0x1f014d,_0x4e4bff){return function(_0x2e3522){if(_0x2e3522){return _0x2e3522[_0x8bca('0x20')]()[_0x8bca('0x1f')](function(){_0x1f014d[_0x8bca('0x18')](0xcc)[_0x8bca('0x21')]();});}};}function handleEntityNotFound(_0x3a7498,_0x2dc5c8){return function(_0x5f056b){if(!_0x5f056b){_0x3a7498['sendStatus'](0x194);}return _0x5f056b;};}function handleError(_0x1e911a,_0x1feba3){_0x1feba3=_0x1feba3||0x1f4;return function(_0x4c10db){logger[_0x8bca('0x22')](_0x4c10db[_0x8bca('0x23')]);if(_0x4c10db[_0x8bca('0x24')]){delete _0x4c10db[_0x8bca('0x24')];}_0x1e911a[_0x8bca('0x18')](_0x1feba3)['send'](_0x4c10db);};}exports[_0x8bca('0x25')]=function(_0x58bfda,_0x18c7f2){var _0x4e8525={'raw':!![],'where':{'id':_0x58bfda[_0x8bca('0x26')]['id']}},_0x18ff94={};_0x18ff94[_0x8bca('0x27')]=_[_0x8bca('0x28')](db['ChatApplication'][_0x8bca('0x29')]);_0x18ff94[_0x8bca('0x2a')]=_[_0x8bca('0x28')](_0x58bfda['query']);_0x18ff94['filters']=_['intersection'](_0x18ff94[_0x8bca('0x27')],_0x18ff94[_0x8bca('0x2a')]);_0x4e8525[_0x8bca('0x2b')]=_['intersection'](_0x18ff94[_0x8bca('0x27')],qs[_0x8bca('0x2c')](_0x58bfda['query'][_0x8bca('0x2c')]));_0x4e8525[_0x8bca('0x2b')]=_0x4e8525[_0x8bca('0x2b')][_0x8bca('0x2d')]?_0x4e8525[_0x8bca('0x2b')]:_0x18ff94['model'];if(_0x58bfda[_0x8bca('0x2a')][_0x8bca('0x2e')]){_0x4e8525[_0x8bca('0x2f')]=[{'all':!![]}];}_0x4e8525=_[_0x8bca('0x30')]({},_0x4e8525,_0x58bfda[_0x8bca('0x31')]);return db['ChatApplication'][_0x8bca('0x32')](_0x4e8525)['then'](handleEntityNotFound(_0x18c7f2,null))['then'](respondWithResult(_0x18c7f2,null))[_0x8bca('0x33')](handleError(_0x18c7f2,null));};exports[_0x8bca('0x34')]=function(_0x5e4607,_0x51bb8a){if(_0x5e4607[_0x8bca('0x35')]['id']){delete _0x5e4607[_0x8bca('0x35')]['id'];}return db[_0x8bca('0x36')]['find']({'where':{'id':_0x5e4607[_0x8bca('0x26')]['id']}})['then'](handleEntityNotFound(_0x51bb8a,null))[_0x8bca('0x1f')](saveUpdates(_0x5e4607[_0x8bca('0x35')],null))['then'](respondWithResult(_0x51bb8a,null))[_0x8bca('0x33')](handleError(_0x51bb8a,null));};exports[_0x8bca('0x20')]=function(_0x1a66c6,_0x5874de){return db[_0x8bca('0x36')][_0x8bca('0x32')]({'where':{'id':_0x1a66c6['params']['id']}})['then'](handleEntityNotFound(_0x5874de,null))[_0x8bca('0x1f')](removeEntity(_0x5874de,null))[_0x8bca('0x33')](handleError(_0x5874de,null));}; \ No newline at end of file +var _0x13f6=['send','model','keys','ChatApplication','query','filters','attributes','intersection','fields','includeAll','include','merge','options','catch','find','params','body','eml-format','rimraf','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','Content-Range','apply','reject','save','update','then','destroy','name'];(function(_0x52f3bd,_0x51ab76){var _0x550f59=function(_0x46be5c){while(--_0x46be5c){_0x52f3bd['push'](_0x52f3bd['shift']());}};_0x550f59(++_0x51ab76);}(_0x13f6,0x124));var _0x613f=function(_0x27ec50,_0x1d8698){_0x27ec50=_0x27ec50-0x0;var _0x2da0f5=_0x13f6[_0x27ec50];return _0x2da0f5;};'use strict';var emlformat=require(_0x613f('0x0'));var rimraf=require(_0x613f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x613f('0x2'));var moment=require(_0x613f('0x3'));var BPromise=require(_0x613f('0x4'));var Mustache=require('mustache');var util=require(_0x613f('0x5'));var path=require(_0x613f('0x6'));var sox=require(_0x613f('0x7'));var csv=require('to-csv');var ejs=require(_0x613f('0x8'));var fs=require('fs');var fs_extra=require(_0x613f('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x613f('0xa'));var toCsv=require(_0x613f('0xb'));var querystring=require(_0x613f('0xc'));var Papa=require(_0x613f('0xd'));var Redis=require('ioredis');var authService=require(_0x613f('0xe'));var qs=require(_0x613f('0xf'));var as=require(_0x613f('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x613f('0x11'))(_0x613f('0x12'));var utils=require(_0x613f('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x613f('0x14'));var db=require(_0x613f('0x15'))['db'];function respondWithStatusCode(_0x542230,_0x4c2a85){_0x4c2a85=_0x4c2a85||0xcc;return function(_0x517f57){if(_0x517f57){return _0x542230[_0x613f('0x16')](_0x4c2a85);}return _0x542230[_0x613f('0x17')](_0x4c2a85)[_0x613f('0x18')]();};}function respondWithResult(_0x375db1,_0x329fcf){_0x329fcf=_0x329fcf||0xc8;return function(_0x4a6fc){if(_0x4a6fc){return _0x375db1[_0x613f('0x17')](_0x329fcf)[_0x613f('0x19')](_0x4a6fc);}};}function respondWithFilteredResult(_0x2eee4d,_0x1d68fd){return function(_0x548218){if(_0x548218){var _0x3c9edf=typeof _0x1d68fd['offset']==='undefined'&&typeof _0x1d68fd[_0x613f('0x1a')]===_0x613f('0x1b');var _0x544eca=_0x548218[_0x613f('0x1c')];var _0x4f9dae=_0x3c9edf?0x0:_0x1d68fd[_0x613f('0x1d')];var _0x1e5a11=_0x3c9edf?_0x548218[_0x613f('0x1c')]:_0x1d68fd[_0x613f('0x1d')]+_0x1d68fd[_0x613f('0x1a')];var _0x1ba35f;if(_0x1e5a11>=_0x544eca){_0x1e5a11=_0x544eca;_0x1ba35f=0xc8;}else{_0x1ba35f=0xce;}_0x2eee4d['status'](_0x1ba35f);return _0x2eee4d['set'](_0x613f('0x1e'),_0x4f9dae+'-'+_0x1e5a11+'/'+_0x544eca)['json'](_0x548218);}return null;};}function patchUpdates(_0x48493c){return function(_0x3c9b58){try{jsonpatch[_0x613f('0x1f')](_0x3c9b58,_0x48493c,!![]);}catch(_0x4f5a5a){return BPromise[_0x613f('0x20')](_0x4f5a5a);}return _0x3c9b58[_0x613f('0x21')]();};}function saveUpdates(_0x2aa14b,_0x48b28a){return function(_0x5401c2){if(_0x5401c2){return _0x5401c2[_0x613f('0x22')](_0x2aa14b)[_0x613f('0x23')](function(_0x2acfcf){return _0x2acfcf;});}return null;};}function removeEntity(_0x51f376,_0x41104e){return function(_0x33e0c6){if(_0x33e0c6){return _0x33e0c6[_0x613f('0x24')]()[_0x613f('0x23')](function(){_0x51f376[_0x613f('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x30fb15,_0x204185){return function(_0x51bba1){if(!_0x51bba1){_0x30fb15[_0x613f('0x16')](0x194);}return _0x51bba1;};}function handleError(_0x5d4ff6,_0x32e747){_0x32e747=_0x32e747||0x1f4;return function(_0x4a878d){logger['error'](_0x4a878d['stack']);if(_0x4a878d[_0x613f('0x25')]){delete _0x4a878d['name'];}_0x5d4ff6[_0x613f('0x17')](_0x32e747)[_0x613f('0x26')](_0x4a878d);};}exports['show']=function(_0x121241,_0x2551c1){var _0x4c8aa1={'raw':!![],'where':{'id':_0x121241['params']['id']}},_0x4cff5d={};_0x4cff5d[_0x613f('0x27')]=_[_0x613f('0x28')](db[_0x613f('0x29')]['rawAttributes']);_0x4cff5d[_0x613f('0x2a')]=_[_0x613f('0x28')](_0x121241[_0x613f('0x2a')]);_0x4cff5d[_0x613f('0x2b')]=_['intersection'](_0x4cff5d[_0x613f('0x27')],_0x4cff5d[_0x613f('0x2a')]);_0x4c8aa1[_0x613f('0x2c')]=_[_0x613f('0x2d')](_0x4cff5d[_0x613f('0x27')],qs[_0x613f('0x2e')](_0x121241['query'][_0x613f('0x2e')]));_0x4c8aa1[_0x613f('0x2c')]=_0x4c8aa1[_0x613f('0x2c')]['length']?_0x4c8aa1[_0x613f('0x2c')]:_0x4cff5d['model'];if(_0x121241[_0x613f('0x2a')][_0x613f('0x2f')]){_0x4c8aa1[_0x613f('0x30')]=[{'all':!![]}];}_0x4c8aa1=_[_0x613f('0x31')]({},_0x4c8aa1,_0x121241[_0x613f('0x32')]);return db[_0x613f('0x29')]['find'](_0x4c8aa1)[_0x613f('0x23')](handleEntityNotFound(_0x2551c1,null))[_0x613f('0x23')](respondWithResult(_0x2551c1,null))[_0x613f('0x33')](handleError(_0x2551c1,null));};exports[_0x613f('0x22')]=function(_0x477ac9,_0x47a9f6){if(_0x477ac9['body']['id']){delete _0x477ac9['body']['id'];}return db[_0x613f('0x29')][_0x613f('0x34')]({'where':{'id':_0x477ac9[_0x613f('0x35')]['id']}})[_0x613f('0x23')](handleEntityNotFound(_0x47a9f6,null))['then'](saveUpdates(_0x477ac9[_0x613f('0x36')],null))[_0x613f('0x23')](respondWithResult(_0x47a9f6,null))['catch'](handleError(_0x47a9f6,null));};exports[_0x613f('0x24')]=function(_0x550cea,_0x310016){return db['ChatApplication'][_0x613f('0x34')]({'where':{'id':_0x550cea['params']['id']}})[_0x613f('0x23')](handleEntityNotFound(_0x310016,null))[_0x613f('0x23')](removeEntity(_0x310016,null))[_0x613f('0x33')](handleError(_0x310016,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index 5488227..64f1b6b 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 _0x38fa=['rimraf','./chatApplication.attributes','exports','define','ChatApplication','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','request-promise','path'];(function(_0x48c9d8,_0x2266c8){var _0x50b362=function(_0x5f4b4f){while(--_0x5f4b4f){_0x48c9d8['push'](_0x48c9d8['shift']());}};_0x50b362(++_0x2266c8);}(_0x38fa,0x1c3));var _0xa38f=function(_0x439e8c,_0x41fb41){_0x439e8c=_0x439e8c-0x0;var _0x44c11f=_0x38fa[_0x439e8c];return _0x44c11f;};'use strict';var _=require('lodash');var util=require(_0xa38f('0x0'));var logger=require(_0xa38f('0x1'))(_0xa38f('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa38f('0x3'));var fs=require('fs');var path=require(_0xa38f('0x4'));var rimraf=require(_0xa38f('0x5'));var config=require('../../config/environment');var attributes=require(_0xa38f('0x6'));module[_0xa38f('0x7')]=function(_0x17ebf1,_0x23edbf){return _0x17ebf1[_0xa38f('0x8')](_0xa38f('0x9'),attributes,{'tableName':'chat_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa38f('0xa'),'collate':_0xa38f('0xb')});}; \ No newline at end of file +var _0xc1f7=['exports','define','ChatApplication','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./chatApplication.attributes'];(function(_0x1b2d64,_0x145ba4){var _0x364831=function(_0xcc26de){while(--_0xcc26de){_0x1b2d64['push'](_0x1b2d64['shift']());}};_0x364831(++_0x145ba4);}(_0xc1f7,0x19b));var _0x7c1f=function(_0x5d44e4,_0x30434d){_0x5d44e4=_0x5d44e4-0x0;var _0x468e29=_0xc1f7[_0x5d44e4];return _0x468e29;};'use strict';var _=require(_0x7c1f('0x0'));var util=require(_0x7c1f('0x1'));var logger=require('../../config/logger')(_0x7c1f('0x2'));var moment=require('moment');var BPromise=require(_0x7c1f('0x3'));var rp=require(_0x7c1f('0x4'));var fs=require('fs');var path=require(_0x7c1f('0x5'));var rimraf=require(_0x7c1f('0x6'));var config=require(_0x7c1f('0x7'));var attributes=require(_0x7c1f('0x8'));module[_0x7c1f('0x9')]=function(_0x5d95a4,_0xc3d2d7){return _0x5d95a4[_0x7c1f('0xa')](_0x7c1f('0xb'),attributes,{'tableName':'chat_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7c1f('0xc'),'collate':_0x7c1f('0xd')});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index 72677f4..60245af 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 _0x65e0=['../../config/environment','client','then','info','ChatApplication,\x20%s,\x20%s','debug','ChatApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x3dd8b3,_0x18cd08){var _0x5172bd=function(_0x2be851){while(--_0x2be851){_0x3dd8b3['push'](_0x3dd8b3['shift']());}};_0x5172bd(++_0x18cd08);}(_0x65e0,0x76));var _0x065e=function(_0x3cfaea,_0x59581c){_0x3cfaea=_0x3cfaea-0x0;var _0x5131f6=_0x65e0[_0x3cfaea];return _0x5131f6;};'use strict';var _=require('lodash');var util=require(_0x065e('0x0'));var moment=require('moment');var BPromise=require(_0x065e('0x1'));var rs=require(_0x065e('0x2'));var fs=require('fs');var Redis=require(_0x065e('0x3'));var db=require(_0x065e('0x4'))['db'];var utils=require(_0x065e('0x5'));var logger=require(_0x065e('0x6'))(_0x065e('0x7'));var config=require(_0x065e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x065e('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x50e07d,_0x1566a9,_0x4edb51){return new BPromise(function(_0x3b49c3,_0x463c59){return client['request'](_0x50e07d,_0x4edb51)[_0x065e('0xa')](function(_0x44f90b){logger[_0x065e('0xb')](_0x065e('0xc'),_0x1566a9,'request\x20sent');logger[_0x065e('0xd')](_0x065e('0xe'),_0x1566a9,_0x065e('0xf'),JSON[_0x065e('0x10')](_0x44f90b));if(_0x44f90b[_0x065e('0x11')]){if(_0x44f90b['error']['code']===0x1f4){logger['error']('ChatApplication,\x20%s,\x20%s',_0x1566a9,_0x44f90b[_0x065e('0x11')]['message']);return _0x463c59(_0x44f90b[_0x065e('0x11')][_0x065e('0x12')]);}logger[_0x065e('0x11')](_0x065e('0xc'),_0x1566a9,_0x44f90b[_0x065e('0x11')][_0x065e('0x12')]);return _0x3b49c3(_0x44f90b[_0x065e('0x11')][_0x065e('0x12')]);}else{logger['info']('ChatApplication,\x20%s,\x20%s',_0x1566a9,'request\x20sent');_0x3b49c3(_0x44f90b[_0x065e('0x13')]['message']);}})[_0x065e('0x14')](function(_0x10c97c){logger[_0x065e('0x11')](_0x065e('0xc'),_0x1566a9,_0x10c97c);_0x463c59(_0x10c97c);});});} \ No newline at end of file +var _0xa7ec=['request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','ChatApplication,\x20%s,\x20%s'];(function(_0x2d81d1,_0x112049){var _0x569ecc=function(_0x5e885d){while(--_0x5e885d){_0x2d81d1['push'](_0x2d81d1['shift']());}};_0x569ecc(++_0x112049);}(_0xa7ec,0x181));var _0xca7e=function(_0x585d3d,_0x103614){_0x585d3d=_0x585d3d-0x0;var _0x59115e=_0xa7ec[_0x585d3d];return _0x59115e;};'use strict';var _=require(_0xca7e('0x0'));var util=require(_0xca7e('0x1'));var moment=require(_0xca7e('0x2'));var BPromise=require(_0xca7e('0x3'));var rs=require(_0xca7e('0x4'));var fs=require('fs');var Redis=require(_0xca7e('0x5'));var db=require(_0xca7e('0x6'))['db'];var utils=require(_0xca7e('0x7'));var logger=require(_0xca7e('0x8'))(_0xca7e('0x9'));var config=require('../../config/environment');var jayson=require(_0xca7e('0xa'));var client=jayson[_0xca7e('0xb')][_0xca7e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5caca0,_0x28b35f,_0x55eb25){return new BPromise(function(_0x3f84b2,_0x7cf882){return client['request'](_0x5caca0,_0x55eb25)[_0xca7e('0xd')](function(_0x154da6){logger['info'](_0xca7e('0xe'),_0x28b35f,_0xca7e('0xf'));logger[_0xca7e('0x10')](_0xca7e('0x11'),_0x28b35f,_0xca7e('0xf'),JSON[_0xca7e('0x12')](_0x154da6));if(_0x154da6[_0xca7e('0x13')]){if(_0x154da6[_0xca7e('0x13')][_0xca7e('0x14')]===0x1f4){logger[_0xca7e('0x13')](_0xca7e('0xe'),_0x28b35f,_0x154da6[_0xca7e('0x13')][_0xca7e('0x15')]);return _0x7cf882(_0x154da6['error']['message']);}logger['error'](_0xca7e('0xe'),_0x28b35f,_0x154da6['error'][_0xca7e('0x15')]);return _0x3f84b2(_0x154da6[_0xca7e('0x13')][_0xca7e('0x15')]);}else{logger[_0xca7e('0x16')](_0xca7e('0xe'),_0x28b35f,'request\x20sent');_0x3f84b2(_0x154da6[_0xca7e('0x17')]['message']);}})[_0xca7e('0x18')](function(_0x32f5c2){logger[_0xca7e('0x13')](_0xca7e('0xe'),_0x28b35f,_0x32f5c2);_0x7cf882(_0x32f5c2);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index 76ee685..3f3c89d 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 _0xea6e=['./chatApplication.controller','get','isAuthenticated','show','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x8a912d,_0x53c52b){var _0x4fb44b=function(_0xb62428){while(--_0xb62428){_0x8a912d['push'](_0x8a912d['shift']());}};_0x4fb44b(++_0x53c52b);}(_0xea6e,0xf7));var _0xeea6=function(_0x7664d9,_0x24e562){_0x7664d9=_0x7664d9-0x0;var _0x3b9def=_0xea6e[_0x7664d9];return _0x3b9def;};'use strict';var multer=require(_0xeea6('0x0'));var util=require(_0xeea6('0x1'));var path=require(_0xeea6('0x2'));var timeout=require(_0xeea6('0x3'));var express=require(_0xeea6('0x4'));var router=express[_0xeea6('0x5')]();var fs_extra=require(_0xeea6('0x6'));var auth=require(_0xeea6('0x7'));var interaction=require(_0xeea6('0x8'));var config=require('../../config/environment');var controller=require(_0xeea6('0x9'));router[_0xeea6('0xa')]('/:id',auth[_0xeea6('0xb')](),controller[_0xeea6('0xc')]);router['put'](_0xeea6('0xd'),auth[_0xeea6('0xb')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xeea6('0xe')]);module[_0xeea6('0xf')]=router; \ No newline at end of file +var _0xaa54=['express','Router','../../components/auth/service','../../config/environment','get','/:id','isAuthenticated','update','delete','destroy','multer','util'];(function(_0x1e61ee,_0x1d13e6){var _0x3a6d72=function(_0xb0b8b9){while(--_0xb0b8b9){_0x1e61ee['push'](_0x1e61ee['shift']());}};_0x3a6d72(++_0x1d13e6);}(_0xaa54,0x14e));var _0x4aa5=function(_0x2db12b,_0x30ab1d){_0x2db12b=_0x2db12b-0x0;var _0x20990b=_0xaa54[_0x2db12b];return _0x20990b;};'use strict';var multer=require(_0x4aa5('0x0'));var util=require(_0x4aa5('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x4aa5('0x2'));var router=express[_0x4aa5('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x4aa5('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x4aa5('0x5'));var controller=require('./chatApplication.controller');router[_0x4aa5('0x6')](_0x4aa5('0x7'),auth[_0x4aa5('0x8')](),controller['show']);router['put']('/:id',auth[_0x4aa5('0x8')](),controller[_0x4aa5('0x9')]);router[_0x4aa5('0xa')](_0x4aa5('0x7'),auth[_0x4aa5('0x8')](),controller[_0x4aa5('0xb')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index c88500f..3598cf2 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 _0x80b2=['BOOLEAN','sequelize','exports','STRING'];(function(_0x164a7b,_0x4a8c79){var _0x24403c=function(_0x167ea6){while(--_0x167ea6){_0x164a7b['push'](_0x164a7b['shift']());}};_0x24403c(++_0x4a8c79);}(_0x80b2,0x141));var _0x280b=function(_0x3b69e9,_0x26d81d){_0x3b69e9=_0x3b69e9-0x0;var _0x2bf555=_0x80b2[_0x3b69e9];return _0x2bf555;};'use strict';var Sequelize=require(_0x280b('0x0'));module[_0x280b('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x280b('0x2')]},'write':{'type':Sequelize[_0x280b('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x4e39=['STRING','BOOLEAN','sequelize'];(function(_0x5834bc,_0x3d4801){var _0x3e183a=function(_0x18b023){while(--_0x18b023){_0x5834bc['push'](_0x5834bc['shift']());}};_0x3e183a(++_0x3d4801);}(_0x4e39,0x95));var _0x94e3=function(_0x365e54,_0x44be74){_0x365e54=_0x365e54-0x0;var _0x13317a=_0x4e39[_0x365e54];return _0x13317a;};'use strict';var Sequelize=require(_0x94e3('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x94e3('0x1')]},'write':{'type':Sequelize[_0x94e3('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 042697f..037916e 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 _0xa9e0=['../../config/license/hardware','../../config/license/util','../../mysqldb','redis','defaults','localhost','./chatGroup.socket','register','jayson/promise','client','http','then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','save','update','destroy','stack','name','ChatGroup','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','options','includeAll','include','findAll','rows','show','params','length','create','body','find','describe','getUnread','ChatInternalMessage','toInteger','addMembers','ids','getMembers','findOne','User','removeMembers','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','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'];(function(_0x63c794,_0x14f52c){var _0x16f319=function(_0x149940){while(--_0x149940){_0x63c794['push'](_0x63c794['shift']());}};_0x16f319(++_0x14f52c);}(_0xa9e0,0x123));var _0x0a9e=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0xa9e0[_0xa1e3e3];return _0xc980e9;};'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':0x232a});function respondWithRpcPromise(_0x52a03d,_0x22dccb,_0x5d0880,_0x1985b6){return new BPromise(function(_0x519dfd,_0x16033c){var _0x12066b=_0x1985b6||client;return _0x12066b['request'](_0x52a03d,_0x5d0880)[_0x0a9e('0x1d')](function(_0x5a0a06){logger[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x22dccb,_0x0a9e('0x20'));logger[_0x0a9e('0x21')](_0x0a9e('0x22'),_0x22dccb,_0x0a9e('0x20'),JSON[_0x0a9e('0x23')](_0x5a0a06));if(_0x5a0a06[_0x0a9e('0x24')]){if(_0x5a0a06[_0x0a9e('0x24')][_0x0a9e('0x25')]===0x1f4){logger[_0x0a9e('0x24')](_0x0a9e('0x1f'),_0x22dccb,_0x5a0a06['error'][_0x0a9e('0x26')]);return _0x16033c(_0x5a0a06[_0x0a9e('0x24')]['message']);}logger[_0x0a9e('0x24')]('ChatGroup,\x20%s,\x20%s',_0x22dccb,_0x5a0a06['error'][_0x0a9e('0x26')]);return _0x519dfd(_0x5a0a06[_0x0a9e('0x24')][_0x0a9e('0x26')]);}else{logger[_0x0a9e('0x1e')]('ChatGroup,\x20%s,\x20%s',_0x22dccb,_0x0a9e('0x20'));_0x519dfd(_0x5a0a06[_0x0a9e('0x27')][_0x0a9e('0x26')]);}})[_0x0a9e('0x28')](function(_0x370d86){logger[_0x0a9e('0x24')](_0x0a9e('0x1f'),_0x22dccb,_0x370d86);_0x16033c(_0x370d86);});});}function respondWithStatusCode(_0x5ea472,_0x59181e){_0x59181e=_0x59181e||0xcc;return function(_0x197ec0){if(_0x197ec0){return _0x5ea472[_0x0a9e('0x29')](_0x59181e);}return _0x5ea472[_0x0a9e('0x2a')](_0x59181e)[_0x0a9e('0x2b')]();};}function respondWithResult(_0x526cf3,_0x384319){_0x384319=_0x384319||0xc8;return function(_0x479bc4){if(_0x479bc4){return _0x526cf3[_0x0a9e('0x2a')](_0x384319)['json'](_0x479bc4);}};}function respondWithFilteredResult(_0x1dc186,_0x34dc65){return function(_0x25fba9){if(_0x25fba9){var _0x14433c=typeof _0x34dc65[_0x0a9e('0x2c')]===_0x0a9e('0x2d')&&typeof _0x34dc65[_0x0a9e('0x2e')]===_0x0a9e('0x2d');var _0x5a101a=_0x25fba9[_0x0a9e('0x2f')];var _0x468813=_0x14433c?0x0:_0x34dc65[_0x0a9e('0x2c')];var _0x2ec755=_0x14433c?_0x25fba9['count']:_0x34dc65[_0x0a9e('0x2c')]+_0x34dc65[_0x0a9e('0x2e')];var _0x1843b2;if(_0x2ec755>=_0x5a101a){_0x2ec755=_0x5a101a;_0x1843b2=0xc8;}else{_0x1843b2=0xce;}_0x1dc186[_0x0a9e('0x2a')](_0x1843b2);return _0x1dc186[_0x0a9e('0x30')](_0x0a9e('0x31'),_0x468813+'-'+_0x2ec755+'/'+_0x5a101a)[_0x0a9e('0x32')](_0x25fba9);}return null;};}function patchUpdates(_0x2e8759){return function(_0x1dbde2){try{jsonpatch['apply'](_0x1dbde2,_0x2e8759,!![]);}catch(_0x426950){return BPromise['reject'](_0x426950);}return _0x1dbde2[_0x0a9e('0x33')]();};}function saveUpdates(_0x3ae878,_0x1122db){return function(_0x33bdb7){if(_0x33bdb7){return _0x33bdb7[_0x0a9e('0x34')](_0x3ae878)['then'](function(_0x66c1d2){return _0x66c1d2;});}return null;};}function removeEntity(_0x46f0a5,_0x40cb85){return function(_0x2da5c0){if(_0x2da5c0){return _0x2da5c0[_0x0a9e('0x35')]()[_0x0a9e('0x1d')](function(){_0x46f0a5[_0x0a9e('0x2a')](0xcc)[_0x0a9e('0x2b')]();});}};}function handleEntityNotFound(_0x5583a4,_0x44295a){return function(_0x5e7238){if(!_0x5e7238){_0x5583a4[_0x0a9e('0x29')](0x194);}return _0x5e7238;};}function handleError(_0x14b13f,_0x2b7e7f){_0x2b7e7f=_0x2b7e7f||0x1f4;return function(_0x3f3d41){logger['error'](_0x3f3d41[_0x0a9e('0x36')]);if(_0x3f3d41[_0x0a9e('0x37')]){delete _0x3f3d41[_0x0a9e('0x37')];}_0x14b13f[_0x0a9e('0x2a')](_0x2b7e7f)['send'](_0x3f3d41);};}exports['index']=function(_0x1e8694,_0x5640eb){var _0x24936a={},_0x3d9717={},_0x381c37={'count':0x0,'rows':[]};var _0x1ef87a=_['map'](db[_0x0a9e('0x38')][_0x0a9e('0x39')],function(_0x3cae){return{'name':_0x3cae['fieldName'],'type':_0x3cae[_0x0a9e('0x3a')][_0x0a9e('0x3b')]};});_0x3d9717[_0x0a9e('0x3c')]=_['map'](_0x1ef87a,'name');_0x3d9717[_0x0a9e('0x3d')]=_[_0x0a9e('0x3e')](_0x1e8694['query']);_0x3d9717[_0x0a9e('0x3f')]=_[_0x0a9e('0x40')](_0x3d9717[_0x0a9e('0x3c')],_0x3d9717[_0x0a9e('0x3d')]);_0x24936a['attributes']=_['intersection'](_0x3d9717[_0x0a9e('0x3c')],qs[_0x0a9e('0x41')](_0x1e8694['query'][_0x0a9e('0x41')]));_0x24936a[_0x0a9e('0x42')]=_0x24936a[_0x0a9e('0x42')]['length']?_0x24936a[_0x0a9e('0x42')]:_0x3d9717[_0x0a9e('0x3c')];if(!_0x1e8694[_0x0a9e('0x3d')][_0x0a9e('0x43')](_0x0a9e('0x44'))){_0x24936a[_0x0a9e('0x2e')]=qs[_0x0a9e('0x2e')](_0x1e8694[_0x0a9e('0x3d')][_0x0a9e('0x2e')]);_0x24936a[_0x0a9e('0x2c')]=qs[_0x0a9e('0x2c')](_0x1e8694[_0x0a9e('0x3d')][_0x0a9e('0x2c')]);}_0x24936a[_0x0a9e('0x45')]=qs[_0x0a9e('0x46')](_0x1e8694['query']['sort']);_0x24936a[_0x0a9e('0x47')]=qs[_0x0a9e('0x3f')](_[_0x0a9e('0x48')](_0x1e8694[_0x0a9e('0x3d')],_0x3d9717[_0x0a9e('0x3f')]),_0x1ef87a);if(_0x1e8694[_0x0a9e('0x3d')][_0x0a9e('0x49')]){_0x24936a[_0x0a9e('0x47')]=_[_0x0a9e('0x4a')](_0x24936a[_0x0a9e('0x47')],{'$or':_[_0x0a9e('0x4b')](_0x1ef87a,function(_0x35ed4a){if(_0x35ed4a['type']!==_0x0a9e('0x4c')){var _0x138b8b={};_0x138b8b[_0x35ed4a[_0x0a9e('0x37')]]={'$like':'%'+_0x1e8694[_0x0a9e('0x3d')][_0x0a9e('0x49')]+'%'};return _0x138b8b;}})});}_0x24936a=_[_0x0a9e('0x4a')]({},_0x24936a,_0x1e8694[_0x0a9e('0x4d')]);var _0x44dd99={'where':_0x24936a['where']};return db[_0x0a9e('0x38')]['count'](_0x44dd99)[_0x0a9e('0x1d')](function(_0x476688){_0x381c37[_0x0a9e('0x2f')]=_0x476688;if(_0x1e8694['query'][_0x0a9e('0x4e')]){_0x24936a[_0x0a9e('0x4f')]=[{'all':!![]}];}return db[_0x0a9e('0x38')][_0x0a9e('0x50')](_0x24936a);})[_0x0a9e('0x1d')](function(_0x37be73){_0x381c37[_0x0a9e('0x51')]=_0x37be73;return _0x381c37;})['then'](respondWithFilteredResult(_0x5640eb,_0x24936a))[_0x0a9e('0x28')](handleError(_0x5640eb,null));};exports[_0x0a9e('0x52')]=function(_0x1b5e80,_0x16f976){var _0x409789={'raw':!![],'where':{'id':_0x1b5e80[_0x0a9e('0x53')]['id']}},_0x992c77={};_0x992c77[_0x0a9e('0x3c')]=_[_0x0a9e('0x3e')](db['ChatGroup'][_0x0a9e('0x39')]);_0x992c77[_0x0a9e('0x3d')]=_['keys'](_0x1b5e80['query']);_0x992c77['filters']=_[_0x0a9e('0x40')](_0x992c77[_0x0a9e('0x3c')],_0x992c77[_0x0a9e('0x3d')]);_0x409789[_0x0a9e('0x42')]=_[_0x0a9e('0x40')](_0x992c77[_0x0a9e('0x3c')],qs[_0x0a9e('0x41')](_0x1b5e80[_0x0a9e('0x3d')]['fields']));_0x409789['attributes']=_0x409789['attributes'][_0x0a9e('0x54')]?_0x409789[_0x0a9e('0x42')]:_0x992c77[_0x0a9e('0x3c')];if(_0x1b5e80['query'][_0x0a9e('0x4e')]){_0x409789[_0x0a9e('0x4f')]=[{'all':!![]}];}_0x409789=_['merge']({},_0x409789,_0x1b5e80['options']);return db[_0x0a9e('0x38')]['find'](_0x409789)[_0x0a9e('0x1d')](handleEntityNotFound(_0x16f976,null))['then'](respondWithResult(_0x16f976,null))[_0x0a9e('0x28')](handleError(_0x16f976,null));};exports[_0x0a9e('0x55')]=function(_0x439340,_0x53613a){return db[_0x0a9e('0x38')][_0x0a9e('0x55')](_0x439340['body'],{})['then'](respondWithResult(_0x53613a,0xc9))[_0x0a9e('0x28')](handleError(_0x53613a,null));};exports[_0x0a9e('0x34')]=function(_0x49c095,_0x145931){if(_0x49c095['body']['id']){delete _0x49c095[_0x0a9e('0x56')]['id'];}return db['ChatGroup'][_0x0a9e('0x57')]({'where':{'id':_0x49c095['params']['id']}})['then'](handleEntityNotFound(_0x145931,null))['then'](saveUpdates(_0x49c095[_0x0a9e('0x56')],null))['then'](respondWithResult(_0x145931,null))[_0x0a9e('0x28')](handleError(_0x145931,null));};exports[_0x0a9e('0x35')]=function(_0x3cfd00,_0x19b4df){return db[_0x0a9e('0x38')][_0x0a9e('0x57')]({'where':{'id':_0x3cfd00[_0x0a9e('0x53')]['id']}})[_0x0a9e('0x1d')](handleEntityNotFound(_0x19b4df,null))['then'](removeEntity(_0x19b4df,null))[_0x0a9e('0x28')](handleError(_0x19b4df,null));};exports[_0x0a9e('0x58')]=function(_0x2642bb,_0x30c491){return db[_0x0a9e('0x38')][_0x0a9e('0x58')]()['then'](respondWithResult(_0x30c491,null))[_0x0a9e('0x28')](handleError(_0x30c491,null));};exports[_0x0a9e('0x59')]=function(_0x5239ef,_0x3649cc,_0x5cc8fb){return db[_0x0a9e('0x5a')]['count']({'where':{'ChatGroupId':_0x5239ef['params']['id'],'ToId':_0x5239ef['user']['id'],'read':![]}})[_0x0a9e('0x1d')](function(_0x49d231){return{'id':_[_0x0a9e('0x5b')](_0x5239ef[_0x0a9e('0x53')]['id']),'count':_0x49d231};})[_0x0a9e('0x1d')](respondWithResult(_0x3649cc,null))[_0x0a9e('0x28')](handleError(_0x3649cc,null));};exports[_0x0a9e('0x5c')]=function(_0x26d7db,_0x49eed0,_0x1627a7){return db['ChatGroup'][_0x0a9e('0x57')]({'where':{'id':_0x26d7db[_0x0a9e('0x53')]['id']}})[_0x0a9e('0x1d')](handleEntityNotFound(_0x49eed0,null))['then'](function(_0x453360){if(_0x453360){return _0x453360[_0x0a9e('0x5c')](_0x26d7db[_0x0a9e('0x56')][_0x0a9e('0x5d')],_['omit'](_0x26d7db[_0x0a9e('0x56')],[_0x0a9e('0x5d'),'id'])||{});}})['then'](respondWithResult(_0x49eed0,null))[_0x0a9e('0x28')](handleError(_0x49eed0,null));};exports[_0x0a9e('0x5e')]=function(_0x88dcbf,_0x409b29,_0x401837){var _0x4d4a35={};var _0x176840={};var _0x2937e0;var _0x281c7d;return db['ChatGroup'][_0x0a9e('0x5f')]({'where':{'id':_0x88dcbf['params']['id']}})['then'](handleEntityNotFound(_0x409b29,null))[_0x0a9e('0x1d')](function(_0x4556c5){if(_0x4556c5){_0x2937e0=_0x4556c5;_0x176840[_0x0a9e('0x3c')]=_[_0x0a9e('0x3e')](db[_0x0a9e('0x60')][_0x0a9e('0x39')]);_0x176840[_0x0a9e('0x3d')]=_[_0x0a9e('0x3e')](_0x88dcbf[_0x0a9e('0x3d')]);_0x176840[_0x0a9e('0x3f')]=_[_0x0a9e('0x40')](_0x176840[_0x0a9e('0x3c')],_0x176840[_0x0a9e('0x3d')]);_0x4d4a35[_0x0a9e('0x42')]=_[_0x0a9e('0x40')](_0x176840[_0x0a9e('0x3c')],qs[_0x0a9e('0x41')](_0x88dcbf[_0x0a9e('0x3d')]['fields']));_0x4d4a35[_0x0a9e('0x42')]=_0x4d4a35[_0x0a9e('0x42')][_0x0a9e('0x54')]?_0x4d4a35['attributes']:_0x176840[_0x0a9e('0x3c')];_0x4d4a35[_0x0a9e('0x45')]=qs['sort'](_0x88dcbf[_0x0a9e('0x3d')][_0x0a9e('0x46')]);_0x4d4a35[_0x0a9e('0x47')]=qs[_0x0a9e('0x3f')](_[_0x0a9e('0x48')](_0x88dcbf['query'],_0x176840['filters']));if(_0x88dcbf['query'][_0x0a9e('0x49')]){_0x4d4a35[_0x0a9e('0x47')]=_[_0x0a9e('0x4a')](_0x4d4a35[_0x0a9e('0x47')],{'$or':_[_0x0a9e('0x4b')](_0x4d4a35[_0x0a9e('0x42')],function(_0xeef20){var _0x1a0677={};_0x1a0677[_0xeef20]={'$like':'%'+_0x88dcbf['query'][_0x0a9e('0x49')]+'%'};return _0x1a0677;})});}_0x4d4a35=_[_0x0a9e('0x4a')]({},_0x4d4a35,_0x88dcbf[_0x0a9e('0x4d')]);return _0x2937e0['getMembers'](_0x4d4a35);}})[_0x0a9e('0x1d')](function(_0x583b2e){if(_0x583b2e){_0x281c7d=_0x583b2e[_0x0a9e('0x54')];if(!_0x88dcbf[_0x0a9e('0x3d')]['hasOwnProperty'](_0x0a9e('0x44'))){_0x4d4a35[_0x0a9e('0x2e')]=qs[_0x0a9e('0x2e')](_0x88dcbf[_0x0a9e('0x3d')]['limit']);_0x4d4a35[_0x0a9e('0x2c')]=qs[_0x0a9e('0x2c')](_0x88dcbf[_0x0a9e('0x3d')][_0x0a9e('0x2c')]);}return _0x2937e0['getMembers'](_0x4d4a35);}})[_0x0a9e('0x1d')](function(_0x3d91db){if(_0x3d91db){return _0x3d91db?{'count':_0x281c7d,'rows':_0x3d91db}:null;}})[_0x0a9e('0x1d')](respondWithResult(_0x409b29,null))[_0x0a9e('0x28')](handleError(_0x409b29,null));};exports['removeMembers']=function(_0x290d43,_0x3511c9,_0x30a4c7){return db[_0x0a9e('0x38')][_0x0a9e('0x57')]({'where':{'id':_0x290d43[_0x0a9e('0x53')]['id']}})[_0x0a9e('0x1d')](handleEntityNotFound(_0x3511c9,null))[_0x0a9e('0x1d')](function(_0x1a7b03){if(_0x1a7b03){return _0x1a7b03[_0x0a9e('0x61')](_0x290d43[_0x0a9e('0x3d')][_0x0a9e('0x5d')]);}})[_0x0a9e('0x1d')](respondWithStatusCode(_0x3511c9,null))[_0x0a9e('0x28')](handleError(_0x3511c9,null));};exports['addMessage']=function(_0xf4120f,_0x11da9c,_0xc599b3){if(_0xf4120f['body']['id']){delete _0xf4120f[_0x0a9e('0x56')]['id'];}return db[_0x0a9e('0x38')][_0x0a9e('0x57')]({'where':{'id':_0xf4120f[_0x0a9e('0x53')]['id']}})['then'](handleEntityNotFound(_0x11da9c,null))['then'](function(_0x7ebea8){if(_0x7ebea8){_0xf4120f[_0x0a9e('0x56')]['ChatGroupId']=_0x7ebea8['id'];return db[_0x0a9e('0x5a')]['create'](_0xf4120f[_0x0a9e('0x56')]);}})[_0x0a9e('0x1d')](respondWithResult(_0x11da9c,null))['catch'](handleError(_0x11da9c,null));};exports[_0x0a9e('0x62')]=function(_0x41cf12,_0x2d2286,_0x42b959){var _0x3755fe={};var _0x1f42a0={};var _0x444f1f;var _0x482ca2;return db[_0x0a9e('0x38')][_0x0a9e('0x5f')]({'where':{'id':_0x41cf12[_0x0a9e('0x53')]['id']}})[_0x0a9e('0x1d')](handleEntityNotFound(_0x2d2286,null))['then'](function(_0xf51744){if(_0xf51744){_0x444f1f=_0xf51744;_0x1f42a0[_0x0a9e('0x3c')]=_['keys'](db[_0x0a9e('0x5a')]['rawAttributes']);_0x1f42a0[_0x0a9e('0x3d')]=_[_0x0a9e('0x3e')](_0x41cf12[_0x0a9e('0x3d')]);_0x1f42a0[_0x0a9e('0x3f')]=_['intersection'](_0x1f42a0['model'],_0x1f42a0[_0x0a9e('0x3d')]);_0x3755fe[_0x0a9e('0x42')]=_[_0x0a9e('0x40')](_0x1f42a0['model'],qs[_0x0a9e('0x41')](_0x41cf12[_0x0a9e('0x3d')]['fields']));_0x3755fe['attributes']=_0x3755fe[_0x0a9e('0x42')]['length']?_0x3755fe['attributes']:_0x1f42a0['model'];_0x3755fe[_0x0a9e('0x45')]=qs[_0x0a9e('0x46')](_0x41cf12[_0x0a9e('0x3d')][_0x0a9e('0x46')]);_0x3755fe[_0x0a9e('0x47')]=qs[_0x0a9e('0x3f')](_['pick'](_0x41cf12[_0x0a9e('0x3d')],_0x1f42a0['filters']));if(_0x41cf12[_0x0a9e('0x3d')][_0x0a9e('0x49')]){_0x3755fe[_0x0a9e('0x47')]=_[_0x0a9e('0x4a')](_0x3755fe['where'],{'$or':_[_0x0a9e('0x4b')](_0x3755fe[_0x0a9e('0x42')],function(_0x1d4877){var _0x5b74c3={};_0x5b74c3[_0x1d4877]={'$like':'%'+_0x41cf12[_0x0a9e('0x3d')][_0x0a9e('0x49')]+'%'};return _0x5b74c3;})});}if(_0x41cf12[_0x0a9e('0x3d')][_0x0a9e('0x63')]){var _0x255e49=_0x41cf12[_0x0a9e('0x3d')][_0x0a9e('0x63')][_0x0a9e('0x64')](',');var _0x509efe={};_0x509efe[_0x255e49[0x0]]={'$gte':moment(_0x255e49[0x1])[_0x0a9e('0x65')](_0x0a9e('0x66'))};_0x3755fe['where']=_[_0x0a9e('0x4a')](_0x3755fe[_0x0a9e('0x47')],_0x509efe);}_0x3755fe=_[_0x0a9e('0x4a')]({},_0x3755fe,_0x41cf12['options']);return _0x444f1f[_0x0a9e('0x62')](_0x3755fe);}})['then'](function(_0x8c8fbe){if(_0x8c8fbe){_0x482ca2=_0x8c8fbe[_0x0a9e('0x54')];if(!_0x41cf12[_0x0a9e('0x3d')][_0x0a9e('0x43')](_0x0a9e('0x44'))){_0x3755fe[_0x0a9e('0x2e')]=qs[_0x0a9e('0x2e')](_0x41cf12[_0x0a9e('0x3d')]['limit']);_0x3755fe[_0x0a9e('0x2c')]=qs[_0x0a9e('0x2c')](_0x41cf12[_0x0a9e('0x3d')][_0x0a9e('0x2c')]);}return _0x444f1f[_0x0a9e('0x62')](_0x3755fe);}})[_0x0a9e('0x1d')](function(_0x6803d6){if(_0x6803d6){return _0x6803d6?{'count':_0x482ca2,'rows':_0x6803d6}:null;}})[_0x0a9e('0x1d')](respondWithResult(_0x2d2286,null))[_0x0a9e('0x28')](handleError(_0x2d2286,null));}; \ No newline at end of file +var _0xa9e0=['../../config/license/hardware','../../config/license/util','../../mysqldb','redis','defaults','localhost','./chatGroup.socket','register','jayson/promise','client','http','then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','save','update','destroy','stack','name','ChatGroup','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','options','includeAll','include','findAll','rows','show','params','length','create','body','find','describe','getUnread','ChatInternalMessage','toInteger','addMembers','ids','getMembers','findOne','User','removeMembers','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','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'];(function(_0x32d1ae,_0x575e52){var _0x49cf0b=function(_0x7dc05c){while(--_0x7dc05c){_0x32d1ae['push'](_0x32d1ae['shift']());}};_0x49cf0b(++_0x575e52);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c3c0b,_0x4ee35e){_0x5c3c0b=_0x5c3c0b-0x0;var _0x52ecd2=_0xa9e0[_0x5c3c0b];return _0x52ecd2;};'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':0x232a});function respondWithRpcPromise(_0x52a03d,_0x22dccb,_0x5d0880,_0x1985b6){return new BPromise(function(_0x519dfd,_0x16033c){var _0x12066b=_0x1985b6||client;return _0x12066b['request'](_0x52a03d,_0x5d0880)[_0x0a9e('0x1d')](function(_0x5a0a06){logger[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x22dccb,_0x0a9e('0x20'));logger[_0x0a9e('0x21')](_0x0a9e('0x22'),_0x22dccb,_0x0a9e('0x20'),JSON[_0x0a9e('0x23')](_0x5a0a06));if(_0x5a0a06[_0x0a9e('0x24')]){if(_0x5a0a06[_0x0a9e('0x24')][_0x0a9e('0x25')]===0x1f4){logger[_0x0a9e('0x24')](_0x0a9e('0x1f'),_0x22dccb,_0x5a0a06['error'][_0x0a9e('0x26')]);return _0x16033c(_0x5a0a06[_0x0a9e('0x24')]['message']);}logger[_0x0a9e('0x24')]('ChatGroup,\x20%s,\x20%s',_0x22dccb,_0x5a0a06['error'][_0x0a9e('0x26')]);return _0x519dfd(_0x5a0a06[_0x0a9e('0x24')][_0x0a9e('0x26')]);}else{logger[_0x0a9e('0x1e')]('ChatGroup,\x20%s,\x20%s',_0x22dccb,_0x0a9e('0x20'));_0x519dfd(_0x5a0a06[_0x0a9e('0x27')][_0x0a9e('0x26')]);}})[_0x0a9e('0x28')](function(_0x370d86){logger[_0x0a9e('0x24')](_0x0a9e('0x1f'),_0x22dccb,_0x370d86);_0x16033c(_0x370d86);});});}function respondWithStatusCode(_0x5ea472,_0x59181e){_0x59181e=_0x59181e||0xcc;return function(_0x197ec0){if(_0x197ec0){return _0x5ea472[_0x0a9e('0x29')](_0x59181e);}return _0x5ea472[_0x0a9e('0x2a')](_0x59181e)[_0x0a9e('0x2b')]();};}function respondWithResult(_0x526cf3,_0x384319){_0x384319=_0x384319||0xc8;return function(_0x479bc4){if(_0x479bc4){return _0x526cf3[_0x0a9e('0x2a')](_0x384319)['json'](_0x479bc4);}};}function respondWithFilteredResult(_0x1dc186,_0x34dc65){return function(_0x25fba9){if(_0x25fba9){var _0x14433c=typeof _0x34dc65[_0x0a9e('0x2c')]===_0x0a9e('0x2d')&&typeof _0x34dc65[_0x0a9e('0x2e')]===_0x0a9e('0x2d');var _0x5a101a=_0x25fba9[_0x0a9e('0x2f')];var _0x468813=_0x14433c?0x0:_0x34dc65[_0x0a9e('0x2c')];var _0x2ec755=_0x14433c?_0x25fba9['count']:_0x34dc65[_0x0a9e('0x2c')]+_0x34dc65[_0x0a9e('0x2e')];var _0x1843b2;if(_0x2ec755>=_0x5a101a){_0x2ec755=_0x5a101a;_0x1843b2=0xc8;}else{_0x1843b2=0xce;}_0x1dc186[_0x0a9e('0x2a')](_0x1843b2);return _0x1dc186[_0x0a9e('0x30')](_0x0a9e('0x31'),_0x468813+'-'+_0x2ec755+'/'+_0x5a101a)[_0x0a9e('0x32')](_0x25fba9);}return null;};}function patchUpdates(_0x2e8759){return function(_0x1dbde2){try{jsonpatch['apply'](_0x1dbde2,_0x2e8759,!![]);}catch(_0x426950){return BPromise['reject'](_0x426950);}return _0x1dbde2[_0x0a9e('0x33')]();};}function saveUpdates(_0x3ae878,_0x1122db){return function(_0x33bdb7){if(_0x33bdb7){return _0x33bdb7[_0x0a9e('0x34')](_0x3ae878)['then'](function(_0x66c1d2){return _0x66c1d2;});}return null;};}function removeEntity(_0x46f0a5,_0x40cb85){return function(_0x2da5c0){if(_0x2da5c0){return _0x2da5c0[_0x0a9e('0x35')]()[_0x0a9e('0x1d')](function(){_0x46f0a5[_0x0a9e('0x2a')](0xcc)[_0x0a9e('0x2b')]();});}};}function handleEntityNotFound(_0x5583a4,_0x44295a){return function(_0x5e7238){if(!_0x5e7238){_0x5583a4[_0x0a9e('0x29')](0x194);}return _0x5e7238;};}function handleError(_0x14b13f,_0x2b7e7f){_0x2b7e7f=_0x2b7e7f||0x1f4;return function(_0x3f3d41){logger['error'](_0x3f3d41[_0x0a9e('0x36')]);if(_0x3f3d41[_0x0a9e('0x37')]){delete _0x3f3d41[_0x0a9e('0x37')];}_0x14b13f[_0x0a9e('0x2a')](_0x2b7e7f)['send'](_0x3f3d41);};}exports['index']=function(_0x1e8694,_0x5640eb){var _0x24936a={},_0x3d9717={},_0x381c37={'count':0x0,'rows':[]};var _0x1ef87a=_['map'](db[_0x0a9e('0x38')][_0x0a9e('0x39')],function(_0x3cae){return{'name':_0x3cae['fieldName'],'type':_0x3cae[_0x0a9e('0x3a')][_0x0a9e('0x3b')]};});_0x3d9717[_0x0a9e('0x3c')]=_['map'](_0x1ef87a,'name');_0x3d9717[_0x0a9e('0x3d')]=_[_0x0a9e('0x3e')](_0x1e8694['query']);_0x3d9717[_0x0a9e('0x3f')]=_[_0x0a9e('0x40')](_0x3d9717[_0x0a9e('0x3c')],_0x3d9717[_0x0a9e('0x3d')]);_0x24936a['attributes']=_['intersection'](_0x3d9717[_0x0a9e('0x3c')],qs[_0x0a9e('0x41')](_0x1e8694['query'][_0x0a9e('0x41')]));_0x24936a[_0x0a9e('0x42')]=_0x24936a[_0x0a9e('0x42')]['length']?_0x24936a[_0x0a9e('0x42')]:_0x3d9717[_0x0a9e('0x3c')];if(!_0x1e8694[_0x0a9e('0x3d')][_0x0a9e('0x43')](_0x0a9e('0x44'))){_0x24936a[_0x0a9e('0x2e')]=qs[_0x0a9e('0x2e')](_0x1e8694[_0x0a9e('0x3d')][_0x0a9e('0x2e')]);_0x24936a[_0x0a9e('0x2c')]=qs[_0x0a9e('0x2c')](_0x1e8694[_0x0a9e('0x3d')][_0x0a9e('0x2c')]);}_0x24936a[_0x0a9e('0x45')]=qs[_0x0a9e('0x46')](_0x1e8694['query']['sort']);_0x24936a[_0x0a9e('0x47')]=qs[_0x0a9e('0x3f')](_[_0x0a9e('0x48')](_0x1e8694[_0x0a9e('0x3d')],_0x3d9717[_0x0a9e('0x3f')]),_0x1ef87a);if(_0x1e8694[_0x0a9e('0x3d')][_0x0a9e('0x49')]){_0x24936a[_0x0a9e('0x47')]=_[_0x0a9e('0x4a')](_0x24936a[_0x0a9e('0x47')],{'$or':_[_0x0a9e('0x4b')](_0x1ef87a,function(_0x35ed4a){if(_0x35ed4a['type']!==_0x0a9e('0x4c')){var _0x138b8b={};_0x138b8b[_0x35ed4a[_0x0a9e('0x37')]]={'$like':'%'+_0x1e8694[_0x0a9e('0x3d')][_0x0a9e('0x49')]+'%'};return _0x138b8b;}})});}_0x24936a=_[_0x0a9e('0x4a')]({},_0x24936a,_0x1e8694[_0x0a9e('0x4d')]);var _0x44dd99={'where':_0x24936a['where']};return db[_0x0a9e('0x38')]['count'](_0x44dd99)[_0x0a9e('0x1d')](function(_0x476688){_0x381c37[_0x0a9e('0x2f')]=_0x476688;if(_0x1e8694['query'][_0x0a9e('0x4e')]){_0x24936a[_0x0a9e('0x4f')]=[{'all':!![]}];}return db[_0x0a9e('0x38')][_0x0a9e('0x50')](_0x24936a);})[_0x0a9e('0x1d')](function(_0x37be73){_0x381c37[_0x0a9e('0x51')]=_0x37be73;return _0x381c37;})['then'](respondWithFilteredResult(_0x5640eb,_0x24936a))[_0x0a9e('0x28')](handleError(_0x5640eb,null));};exports[_0x0a9e('0x52')]=function(_0x1b5e80,_0x16f976){var _0x409789={'raw':!![],'where':{'id':_0x1b5e80[_0x0a9e('0x53')]['id']}},_0x992c77={};_0x992c77[_0x0a9e('0x3c')]=_[_0x0a9e('0x3e')](db['ChatGroup'][_0x0a9e('0x39')]);_0x992c77[_0x0a9e('0x3d')]=_['keys'](_0x1b5e80['query']);_0x992c77['filters']=_[_0x0a9e('0x40')](_0x992c77[_0x0a9e('0x3c')],_0x992c77[_0x0a9e('0x3d')]);_0x409789[_0x0a9e('0x42')]=_[_0x0a9e('0x40')](_0x992c77[_0x0a9e('0x3c')],qs[_0x0a9e('0x41')](_0x1b5e80[_0x0a9e('0x3d')]['fields']));_0x409789['attributes']=_0x409789['attributes'][_0x0a9e('0x54')]?_0x409789[_0x0a9e('0x42')]:_0x992c77[_0x0a9e('0x3c')];if(_0x1b5e80['query'][_0x0a9e('0x4e')]){_0x409789[_0x0a9e('0x4f')]=[{'all':!![]}];}_0x409789=_['merge']({},_0x409789,_0x1b5e80['options']);return db[_0x0a9e('0x38')]['find'](_0x409789)[_0x0a9e('0x1d')](handleEntityNotFound(_0x16f976,null))['then'](respondWithResult(_0x16f976,null))[_0x0a9e('0x28')](handleError(_0x16f976,null));};exports[_0x0a9e('0x55')]=function(_0x439340,_0x53613a){return db[_0x0a9e('0x38')][_0x0a9e('0x55')](_0x439340['body'],{})['then'](respondWithResult(_0x53613a,0xc9))[_0x0a9e('0x28')](handleError(_0x53613a,null));};exports[_0x0a9e('0x34')]=function(_0x49c095,_0x145931){if(_0x49c095['body']['id']){delete _0x49c095[_0x0a9e('0x56')]['id'];}return db['ChatGroup'][_0x0a9e('0x57')]({'where':{'id':_0x49c095['params']['id']}})['then'](handleEntityNotFound(_0x145931,null))['then'](saveUpdates(_0x49c095[_0x0a9e('0x56')],null))['then'](respondWithResult(_0x145931,null))[_0x0a9e('0x28')](handleError(_0x145931,null));};exports[_0x0a9e('0x35')]=function(_0x3cfd00,_0x19b4df){return db[_0x0a9e('0x38')][_0x0a9e('0x57')]({'where':{'id':_0x3cfd00[_0x0a9e('0x53')]['id']}})[_0x0a9e('0x1d')](handleEntityNotFound(_0x19b4df,null))['then'](removeEntity(_0x19b4df,null))[_0x0a9e('0x28')](handleError(_0x19b4df,null));};exports[_0x0a9e('0x58')]=function(_0x2642bb,_0x30c491){return db[_0x0a9e('0x38')][_0x0a9e('0x58')]()['then'](respondWithResult(_0x30c491,null))[_0x0a9e('0x28')](handleError(_0x30c491,null));};exports[_0x0a9e('0x59')]=function(_0x5239ef,_0x3649cc,_0x5cc8fb){return db[_0x0a9e('0x5a')]['count']({'where':{'ChatGroupId':_0x5239ef['params']['id'],'ToId':_0x5239ef['user']['id'],'read':![]}})[_0x0a9e('0x1d')](function(_0x49d231){return{'id':_[_0x0a9e('0x5b')](_0x5239ef[_0x0a9e('0x53')]['id']),'count':_0x49d231};})[_0x0a9e('0x1d')](respondWithResult(_0x3649cc,null))[_0x0a9e('0x28')](handleError(_0x3649cc,null));};exports[_0x0a9e('0x5c')]=function(_0x26d7db,_0x49eed0,_0x1627a7){return db['ChatGroup'][_0x0a9e('0x57')]({'where':{'id':_0x26d7db[_0x0a9e('0x53')]['id']}})[_0x0a9e('0x1d')](handleEntityNotFound(_0x49eed0,null))['then'](function(_0x453360){if(_0x453360){return _0x453360[_0x0a9e('0x5c')](_0x26d7db[_0x0a9e('0x56')][_0x0a9e('0x5d')],_['omit'](_0x26d7db[_0x0a9e('0x56')],[_0x0a9e('0x5d'),'id'])||{});}})['then'](respondWithResult(_0x49eed0,null))[_0x0a9e('0x28')](handleError(_0x49eed0,null));};exports[_0x0a9e('0x5e')]=function(_0x88dcbf,_0x409b29,_0x401837){var _0x4d4a35={};var _0x176840={};var _0x2937e0;var _0x281c7d;return db['ChatGroup'][_0x0a9e('0x5f')]({'where':{'id':_0x88dcbf['params']['id']}})['then'](handleEntityNotFound(_0x409b29,null))[_0x0a9e('0x1d')](function(_0x4556c5){if(_0x4556c5){_0x2937e0=_0x4556c5;_0x176840[_0x0a9e('0x3c')]=_[_0x0a9e('0x3e')](db[_0x0a9e('0x60')][_0x0a9e('0x39')]);_0x176840[_0x0a9e('0x3d')]=_[_0x0a9e('0x3e')](_0x88dcbf[_0x0a9e('0x3d')]);_0x176840[_0x0a9e('0x3f')]=_[_0x0a9e('0x40')](_0x176840[_0x0a9e('0x3c')],_0x176840[_0x0a9e('0x3d')]);_0x4d4a35[_0x0a9e('0x42')]=_[_0x0a9e('0x40')](_0x176840[_0x0a9e('0x3c')],qs[_0x0a9e('0x41')](_0x88dcbf[_0x0a9e('0x3d')]['fields']));_0x4d4a35[_0x0a9e('0x42')]=_0x4d4a35[_0x0a9e('0x42')][_0x0a9e('0x54')]?_0x4d4a35['attributes']:_0x176840[_0x0a9e('0x3c')];_0x4d4a35[_0x0a9e('0x45')]=qs['sort'](_0x88dcbf[_0x0a9e('0x3d')][_0x0a9e('0x46')]);_0x4d4a35[_0x0a9e('0x47')]=qs[_0x0a9e('0x3f')](_[_0x0a9e('0x48')](_0x88dcbf['query'],_0x176840['filters']));if(_0x88dcbf['query'][_0x0a9e('0x49')]){_0x4d4a35[_0x0a9e('0x47')]=_[_0x0a9e('0x4a')](_0x4d4a35[_0x0a9e('0x47')],{'$or':_[_0x0a9e('0x4b')](_0x4d4a35[_0x0a9e('0x42')],function(_0xeef20){var _0x1a0677={};_0x1a0677[_0xeef20]={'$like':'%'+_0x88dcbf['query'][_0x0a9e('0x49')]+'%'};return _0x1a0677;})});}_0x4d4a35=_[_0x0a9e('0x4a')]({},_0x4d4a35,_0x88dcbf[_0x0a9e('0x4d')]);return _0x2937e0['getMembers'](_0x4d4a35);}})[_0x0a9e('0x1d')](function(_0x583b2e){if(_0x583b2e){_0x281c7d=_0x583b2e[_0x0a9e('0x54')];if(!_0x88dcbf[_0x0a9e('0x3d')]['hasOwnProperty'](_0x0a9e('0x44'))){_0x4d4a35[_0x0a9e('0x2e')]=qs[_0x0a9e('0x2e')](_0x88dcbf[_0x0a9e('0x3d')]['limit']);_0x4d4a35[_0x0a9e('0x2c')]=qs[_0x0a9e('0x2c')](_0x88dcbf[_0x0a9e('0x3d')][_0x0a9e('0x2c')]);}return _0x2937e0['getMembers'](_0x4d4a35);}})[_0x0a9e('0x1d')](function(_0x3d91db){if(_0x3d91db){return _0x3d91db?{'count':_0x281c7d,'rows':_0x3d91db}:null;}})[_0x0a9e('0x1d')](respondWithResult(_0x409b29,null))[_0x0a9e('0x28')](handleError(_0x409b29,null));};exports['removeMembers']=function(_0x290d43,_0x3511c9,_0x30a4c7){return db[_0x0a9e('0x38')][_0x0a9e('0x57')]({'where':{'id':_0x290d43[_0x0a9e('0x53')]['id']}})[_0x0a9e('0x1d')](handleEntityNotFound(_0x3511c9,null))[_0x0a9e('0x1d')](function(_0x1a7b03){if(_0x1a7b03){return _0x1a7b03[_0x0a9e('0x61')](_0x290d43[_0x0a9e('0x3d')][_0x0a9e('0x5d')]);}})[_0x0a9e('0x1d')](respondWithStatusCode(_0x3511c9,null))[_0x0a9e('0x28')](handleError(_0x3511c9,null));};exports['addMessage']=function(_0xf4120f,_0x11da9c,_0xc599b3){if(_0xf4120f['body']['id']){delete _0xf4120f[_0x0a9e('0x56')]['id'];}return db[_0x0a9e('0x38')][_0x0a9e('0x57')]({'where':{'id':_0xf4120f[_0x0a9e('0x53')]['id']}})['then'](handleEntityNotFound(_0x11da9c,null))['then'](function(_0x7ebea8){if(_0x7ebea8){_0xf4120f[_0x0a9e('0x56')]['ChatGroupId']=_0x7ebea8['id'];return db[_0x0a9e('0x5a')]['create'](_0xf4120f[_0x0a9e('0x56')]);}})[_0x0a9e('0x1d')](respondWithResult(_0x11da9c,null))['catch'](handleError(_0x11da9c,null));};exports[_0x0a9e('0x62')]=function(_0x41cf12,_0x2d2286,_0x42b959){var _0x3755fe={};var _0x1f42a0={};var _0x444f1f;var _0x482ca2;return db[_0x0a9e('0x38')][_0x0a9e('0x5f')]({'where':{'id':_0x41cf12[_0x0a9e('0x53')]['id']}})[_0x0a9e('0x1d')](handleEntityNotFound(_0x2d2286,null))['then'](function(_0xf51744){if(_0xf51744){_0x444f1f=_0xf51744;_0x1f42a0[_0x0a9e('0x3c')]=_['keys'](db[_0x0a9e('0x5a')]['rawAttributes']);_0x1f42a0[_0x0a9e('0x3d')]=_[_0x0a9e('0x3e')](_0x41cf12[_0x0a9e('0x3d')]);_0x1f42a0[_0x0a9e('0x3f')]=_['intersection'](_0x1f42a0['model'],_0x1f42a0[_0x0a9e('0x3d')]);_0x3755fe[_0x0a9e('0x42')]=_[_0x0a9e('0x40')](_0x1f42a0['model'],qs[_0x0a9e('0x41')](_0x41cf12[_0x0a9e('0x3d')]['fields']));_0x3755fe['attributes']=_0x3755fe[_0x0a9e('0x42')]['length']?_0x3755fe['attributes']:_0x1f42a0['model'];_0x3755fe[_0x0a9e('0x45')]=qs[_0x0a9e('0x46')](_0x41cf12[_0x0a9e('0x3d')][_0x0a9e('0x46')]);_0x3755fe[_0x0a9e('0x47')]=qs[_0x0a9e('0x3f')](_['pick'](_0x41cf12[_0x0a9e('0x3d')],_0x1f42a0['filters']));if(_0x41cf12[_0x0a9e('0x3d')][_0x0a9e('0x49')]){_0x3755fe[_0x0a9e('0x47')]=_[_0x0a9e('0x4a')](_0x3755fe['where'],{'$or':_[_0x0a9e('0x4b')](_0x3755fe[_0x0a9e('0x42')],function(_0x1d4877){var _0x5b74c3={};_0x5b74c3[_0x1d4877]={'$like':'%'+_0x41cf12[_0x0a9e('0x3d')][_0x0a9e('0x49')]+'%'};return _0x5b74c3;})});}if(_0x41cf12[_0x0a9e('0x3d')][_0x0a9e('0x63')]){var _0x255e49=_0x41cf12[_0x0a9e('0x3d')][_0x0a9e('0x63')][_0x0a9e('0x64')](',');var _0x509efe={};_0x509efe[_0x255e49[0x0]]={'$gte':moment(_0x255e49[0x1])[_0x0a9e('0x65')](_0x0a9e('0x66'))};_0x3755fe['where']=_[_0x0a9e('0x4a')](_0x3755fe[_0x0a9e('0x47')],_0x509efe);}_0x3755fe=_[_0x0a9e('0x4a')]({},_0x3755fe,_0x41cf12['options']);return _0x444f1f[_0x0a9e('0x62')](_0x3755fe);}})['then'](function(_0x8c8fbe){if(_0x8c8fbe){_0x482ca2=_0x8c8fbe[_0x0a9e('0x54')];if(!_0x41cf12[_0x0a9e('0x3d')][_0x0a9e('0x43')](_0x0a9e('0x44'))){_0x3755fe[_0x0a9e('0x2e')]=qs[_0x0a9e('0x2e')](_0x41cf12[_0x0a9e('0x3d')]['limit']);_0x3755fe[_0x0a9e('0x2c')]=qs[_0x0a9e('0x2c')](_0x41cf12[_0x0a9e('0x3d')][_0x0a9e('0x2c')]);}return _0x444f1f[_0x0a9e('0x62')](_0x3755fe);}})[_0x0a9e('0x1d')](function(_0x6803d6){if(_0x6803d6){return _0x6803d6?{'count':_0x482ca2,'rows':_0x6803d6}:null;}})[_0x0a9e('0x1d')](respondWithResult(_0x2d2286,null))[_0x0a9e('0x28')](handleError(_0x2d2286,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index 9d9e2da..7e69dad 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 _0x4ba3=['exports','events','../../mysqldb','save','update','remove','hasOwnProperty','hook'];(function(_0x302baf,_0x4ac7b5){var _0x5310ee=function(_0x2770e5){while(--_0x2770e5){_0x302baf['push'](_0x302baf['shift']());}};_0x5310ee(++_0x4ac7b5);}(_0x4ba3,0xe9));var _0x34ba=function(_0x239dba,_0x309e95){_0x239dba=_0x239dba-0x0;var _0x1ceb11=_0x4ba3[_0x239dba];return _0x1ceb11;};'use strict';var EventEmitter=require(_0x34ba('0x0'));var ChatGroup=require(_0x34ba('0x1'))['db']['ChatGroup'];var ChatGroupEvents=new EventEmitter();ChatGroupEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x34ba('0x2'),'afterUpdate':_0x34ba('0x3'),'afterDestroy':_0x34ba('0x4')};function emitEvent(_0x1e43b9){return function(_0x4be4fb,_0x47cc57,_0x5eeda2){ChatGroupEvents['emit'](_0x1e43b9+':'+_0x4be4fb['id'],_0x4be4fb);ChatGroupEvents['emit'](_0x1e43b9,_0x4be4fb);_0x5eeda2(null);};}for(var e in events){if(events[_0x34ba('0x5')](e)){var event=events[e];ChatGroup[_0x34ba('0x6')](e,emitEvent(event));}}module[_0x34ba('0x7')]=ChatGroupEvents; \ No newline at end of file +var _0xb19a=['setMaxListeners','save','update','remove','emit','hook','exports','../../mysqldb'];(function(_0x23ce00,_0x150f24){var _0x19a863=function(_0x102b55){while(--_0x102b55){_0x23ce00['push'](_0x23ce00['shift']());}};_0x19a863(++_0x150f24);}(_0xb19a,0x19f));var _0xab19=function(_0x41a2b9,_0x35f80e){_0x41a2b9=_0x41a2b9-0x0;var _0x22170d=_0xb19a[_0x41a2b9];return _0x22170d;};'use strict';var EventEmitter=require('events');var ChatGroup=require(_0xab19('0x0'))['db']['ChatGroup'];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0xab19('0x1')](0x0);var events={'afterCreate':_0xab19('0x2'),'afterUpdate':_0xab19('0x3'),'afterDestroy':_0xab19('0x4')};function emitEvent(_0x482f81){return function(_0x4ff646,_0x3189b5,_0x5f2d83){ChatGroupEvents['emit'](_0x482f81+':'+_0x4ff646['id'],_0x4ff646);ChatGroupEvents[_0xab19('0x5')](_0x482f81,_0x4ff646);_0x5f2d83(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatGroup[_0xab19('0x6')](e,emitEvent(event));}}module[_0xab19('0x7')]=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index ee9b5a0..3592192 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 _0x5c73=['api','moment','request-promise','path','rimraf','ChatGroup','chat_groups','lodash','util'];(function(_0xde6cf6,_0xa68cd3){var _0x1804fb=function(_0x3c14a0){while(--_0x3c14a0){_0xde6cf6['push'](_0xde6cf6['shift']());}};_0x1804fb(++_0xa68cd3);}(_0x5c73,0x7c));var _0x35c7=function(_0x862cd4,_0x7d5c3c){_0x862cd4=_0x862cd4-0x0;var _0x36791a=_0x5c73[_0x862cd4];return _0x36791a;};'use strict';var _=require(_0x35c7('0x0'));var util=require(_0x35c7('0x1'));var logger=require('../../config/logger')(_0x35c7('0x2'));var moment=require(_0x35c7('0x3'));var BPromise=require('bluebird');var rp=require(_0x35c7('0x4'));var fs=require('fs');var path=require(_0x35c7('0x5'));var rimraf=require(_0x35c7('0x6'));var config=require('../../config/environment');var attributes=require('./chatGroup.attributes');module['exports']=function(_0x5c435f,_0x5d429b){return _0x5c435f['define'](_0x35c7('0x7'),attributes,{'tableName':_0x35c7('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0ae7=['bluebird','rimraf','../../config/environment','exports','define','chat_groups','lodash','util','../../config/logger','api','moment'];(function(_0x5a42d9,_0x2d397e){var _0x190cf2=function(_0x57430a){while(--_0x57430a){_0x5a42d9['push'](_0x5a42d9['shift']());}};_0x190cf2(++_0x2d397e);}(_0x0ae7,0x171));var _0x70ae=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x0ae7[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0x70ae('0x0'));var util=require(_0x70ae('0x1'));var logger=require(_0x70ae('0x2'))(_0x70ae('0x3'));var moment=require(_0x70ae('0x4'));var BPromise=require(_0x70ae('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x70ae('0x6'));var config=require(_0x70ae('0x7'));var attributes=require('./chatGroup.attributes');module[_0x70ae('0x8')]=function(_0x10d2dd,_0x3d6cfc){return _0x10d2dd[_0x70ae('0x9')]('ChatGroup',attributes,{'tableName':_0x70ae('0xa'),'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 e6bf133..2714295 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 _0x3edb=['localhost','socket.io-emitter','./chatGroup.socket','register','request','then','info','request\x20sent','stringify','error','code','ChatGroup,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','http','redis'];(function(_0x35d43a,_0x400f30){var _0x328868=function(_0x4480d3){while(--_0x4480d3){_0x35d43a['push'](_0x35d43a['shift']());}};_0x328868(++_0x400f30);}(_0x3edb,0x1c9));var _0xb3ed=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x3edb[_0x465028];return _0xb783d4;};'use strict';var _=require(_0xb3ed('0x0'));var util=require(_0xb3ed('0x1'));var moment=require('moment');var BPromise=require(_0xb3ed('0x2'));var rs=require(_0xb3ed('0x3'));var fs=require('fs');var Redis=require(_0xb3ed('0x4'));var db=require(_0xb3ed('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xb3ed('0x6'))('rpc');var config=require(_0xb3ed('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xb3ed('0x8')][_0xb3ed('0x9')]({'port':0x232a});config[_0xb3ed('0xa')]=_['defaults'](config[_0xb3ed('0xa')],{'host':_0xb3ed('0xb'),'port':0x18eb});var socket=require(_0xb3ed('0xc'))(new Redis(config[_0xb3ed('0xa')]));require(_0xb3ed('0xd'))[_0xb3ed('0xe')](socket);function respondWithRpcPromise(_0x4f1692,_0x21fa7f,_0x5c5fec){return new BPromise(function(_0x5402f0,_0x245eec){return client[_0xb3ed('0xf')](_0x4f1692,_0x5c5fec)[_0xb3ed('0x10')](function(_0xda646b){logger[_0xb3ed('0x11')]('ChatGroup,\x20%s,\x20%s',_0x21fa7f,_0xb3ed('0x12'));logger['debug']('ChatGroup,\x20%s,\x20%s,\x20%s',_0x21fa7f,_0xb3ed('0x12'),JSON[_0xb3ed('0x13')](_0xda646b));if(_0xda646b['error']){if(_0xda646b[_0xb3ed('0x14')][_0xb3ed('0x15')]===0x1f4){logger[_0xb3ed('0x14')](_0xb3ed('0x16'),_0x21fa7f,_0xda646b[_0xb3ed('0x14')][_0xb3ed('0x17')]);return _0x245eec(_0xda646b['error'][_0xb3ed('0x17')]);}logger[_0xb3ed('0x14')]('ChatGroup,\x20%s,\x20%s',_0x21fa7f,_0xda646b[_0xb3ed('0x14')][_0xb3ed('0x17')]);return _0x5402f0(_0xda646b[_0xb3ed('0x14')]['message']);}else{logger['info'](_0xb3ed('0x16'),_0x21fa7f,_0xb3ed('0x12'));_0x5402f0(_0xda646b[_0xb3ed('0x18')][_0xb3ed('0x17')]);}})[_0xb3ed('0x19')](function(_0x184038){logger[_0xb3ed('0x14')](_0xb3ed('0x16'),_0x21fa7f,_0x184038);_0x245eec(_0x184038);});});} \ No newline at end of file +var _0x8cce=['stringify','error','code','message','request\x20sent','result','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./chatGroup.socket','register','request','then','info','ChatGroup,\x20%s,\x20%s','debug','ChatGroup,\x20%s,\x20%s,\x20%s'];(function(_0xcff320,_0x59cc1c){var _0x2306db=function(_0x23dcf9){while(--_0x23dcf9){_0xcff320['push'](_0xcff320['shift']());}};_0x2306db(++_0x59cc1c);}(_0x8cce,0xee));var _0xe8cc=function(_0x1c344b,_0x300991){_0x1c344b=_0x1c344b-0x0;var _0x34588c=_0x8cce[_0x1c344b];return _0x34588c;};'use strict';var _=require(_0xe8cc('0x0'));var util=require(_0xe8cc('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xe8cc('0x2'));var fs=require('fs');var Redis=require(_0xe8cc('0x3'));var db=require(_0xe8cc('0x4'))['db'];var utils=require(_0xe8cc('0x5'));var logger=require(_0xe8cc('0x6'))(_0xe8cc('0x7'));var config=require(_0xe8cc('0x8'));var jayson=require(_0xe8cc('0x9'));var client=jayson[_0xe8cc('0xa')][_0xe8cc('0xb')]({'port':0x232a});config[_0xe8cc('0xc')]=_[_0xe8cc('0xd')](config[_0xe8cc('0xc')],{'host':_0xe8cc('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xe8cc('0xf'))[_0xe8cc('0x10')](socket);function respondWithRpcPromise(_0x34d557,_0x5954e2,_0x45fcab){return new BPromise(function(_0x38fbf3,_0x4d9828){return client[_0xe8cc('0x11')](_0x34d557,_0x45fcab)[_0xe8cc('0x12')](function(_0x44e9d2){logger[_0xe8cc('0x13')](_0xe8cc('0x14'),_0x5954e2,'request\x20sent');logger[_0xe8cc('0x15')](_0xe8cc('0x16'),_0x5954e2,'request\x20sent',JSON[_0xe8cc('0x17')](_0x44e9d2));if(_0x44e9d2['error']){if(_0x44e9d2[_0xe8cc('0x18')][_0xe8cc('0x19')]===0x1f4){logger[_0xe8cc('0x18')]('ChatGroup,\x20%s,\x20%s',_0x5954e2,_0x44e9d2[_0xe8cc('0x18')]['message']);return _0x4d9828(_0x44e9d2[_0xe8cc('0x18')]['message']);}logger[_0xe8cc('0x18')](_0xe8cc('0x14'),_0x5954e2,_0x44e9d2[_0xe8cc('0x18')]['message']);return _0x38fbf3(_0x44e9d2['error'][_0xe8cc('0x1a')]);}else{logger['info'](_0xe8cc('0x14'),_0x5954e2,_0xe8cc('0x1b'));_0x38fbf3(_0x44e9d2[_0xe8cc('0x1c')][_0xe8cc('0x1a')]);}})['catch'](function(_0x43e91d){logger[_0xe8cc('0x18')](_0xe8cc('0x14'),_0x5954e2,_0x43e91d);_0x4d9828(_0x43e91d);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index c776b72..4ac58bc 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 _0x0880=['update','emit','removeListener','register','length','./chatGroup.events','remove'];(function(_0x63e0cd,_0x355757){var _0x557629=function(_0x20ff14){while(--_0x20ff14){_0x63e0cd['push'](_0x63e0cd['shift']());}};_0x557629(++_0x355757);}(_0x0880,0x1b0));var _0x0088=function(_0x6465b0,_0x45653a){_0x6465b0=_0x6465b0-0x0;var _0x4884fe=_0x0880[_0x6465b0];return _0x4884fe;};'use strict';var ChatGroupEvents=require(_0x0088('0x0'));var events=['save',_0x0088('0x1'),_0x0088('0x2')];function createListener(_0x17c0d7,_0x4743a5){return function(_0x182cf1){_0x4743a5[_0x0088('0x3')](_0x17c0d7,_0x182cf1);};}function removeListener(_0x16f730,_0x55915c){return function(){ChatGroupEvents[_0x0088('0x4')](_0x16f730,_0x55915c);};}exports[_0x0088('0x5')]=function(_0x5eef34){for(var _0x53c9cd=0x0,_0x3a93ec=events[_0x0088('0x6')];_0x53c9cd<_0x3a93ec;_0x53c9cd++){var _0x597dda=events[_0x53c9cd];var _0x10b017=createListener('chatGroup:'+_0x597dda,_0x5eef34);ChatGroupEvents['on'](_0x597dda,_0x10b017);}}; \ No newline at end of file +var _0x4c68=['length','chatGroup:','./chatGroup.events','save','remove','update','removeListener'];(function(_0x1d39f6,_0x146f4a){var _0x3dbd7a=function(_0x4486f2){while(--_0x4486f2){_0x1d39f6['push'](_0x1d39f6['shift']());}};_0x3dbd7a(++_0x146f4a);}(_0x4c68,0x198));var _0x84c6=function(_0x31688a,_0x588c7d){_0x31688a=_0x31688a-0x0;var _0xc7b088=_0x4c68[_0x31688a];return _0xc7b088;};'use strict';var ChatGroupEvents=require(_0x84c6('0x0'));var events=[_0x84c6('0x1'),_0x84c6('0x2'),_0x84c6('0x3')];function createListener(_0x487ee6,_0x576bb8){return function(_0x1f9ff9){_0x576bb8['emit'](_0x487ee6,_0x1f9ff9);};}function removeListener(_0xc3393c,_0xe2156e){return function(){ChatGroupEvents[_0x84c6('0x4')](_0xc3393c,_0xe2156e);};}exports['register']=function(_0xc2b9ae){for(var _0x76d309=0x0,_0xbfdd50=events[_0x84c6('0x5')];_0x76d309<_0xbfdd50;_0x76d309++){var _0x3d5cb2=events[_0x76d309];var _0x4a1c3f=createListener(_0x84c6('0x6')+_0x3d5cb2,_0xc2b9ae);ChatGroupEvents['on'](_0x3d5cb2,_0x4a1c3f);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index 71905a6..de006f1 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 _0x4b09=['addMembers','update','destroy','removeMembers','exports','util','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatGroup.controller','get','index','/describe','isAuthenticated','/:id','show','/:id/unread','getUnread','/:id/members','getMembers','/:id/messages','getMessages','post','create'];(function(_0x55fb83,_0x1d3856){var _0x59a87a=function(_0x38bdd1){while(--_0x38bdd1){_0x55fb83['push'](_0x55fb83['shift']());}};_0x59a87a(++_0x1d3856);}(_0x4b09,0x1a5));var _0x94b0=function(_0x2ff238,_0x1811d2){_0x2ff238=_0x2ff238-0x0;var _0x204a56=_0x4b09[_0x2ff238];return _0x204a56;};'use strict';var multer=require('multer');var util=require(_0x94b0('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x94b0('0x1'));var router=express['Router']();var fs_extra=require(_0x94b0('0x2'));var auth=require(_0x94b0('0x3'));var interaction=require(_0x94b0('0x4'));var config=require(_0x94b0('0x5'));var controller=require(_0x94b0('0x6'));router[_0x94b0('0x7')]('/',auth['isAuthenticated'](),controller[_0x94b0('0x8')]);router[_0x94b0('0x7')](_0x94b0('0x9'),auth[_0x94b0('0xa')](),controller['describe']);router[_0x94b0('0x7')](_0x94b0('0xb'),auth[_0x94b0('0xa')](),controller[_0x94b0('0xc')]);router['get'](_0x94b0('0xd'),auth['isAuthenticated'](),controller[_0x94b0('0xe')]);router[_0x94b0('0x7')](_0x94b0('0xf'),auth[_0x94b0('0xa')](),controller[_0x94b0('0x10')]);router[_0x94b0('0x7')](_0x94b0('0x11'),auth[_0x94b0('0xa')](),controller[_0x94b0('0x12')]);router[_0x94b0('0x13')]('/',auth[_0x94b0('0xa')](),controller[_0x94b0('0x14')]);router[_0x94b0('0x13')]('/:id/members',auth[_0x94b0('0xa')](),controller[_0x94b0('0x15')]);router['post'](_0x94b0('0x11'),auth['isAuthenticated'](),controller['addMessage']);router['put'](_0x94b0('0xb'),auth['isAuthenticated'](),controller[_0x94b0('0x16')]);router['delete'](_0x94b0('0xb'),auth[_0x94b0('0xa')](),controller[_0x94b0('0x17')]);router['delete'](_0x94b0('0xf'),auth['isAuthenticated'](),controller[_0x94b0('0x18')]);module[_0x94b0('0x19')]=router; \ No newline at end of file +var _0xc397=['../../config/environment','./chatGroup.controller','get','isAuthenticated','/describe','/:id','show','/:id/unread','getUnread','getMembers','/:id/messages','getMessages','post','create','/:id/members','addMembers','update','delete','destroy','removeMembers','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x33cf52,_0x3fee68){var _0x33b634=function(_0x5e70dd){while(--_0x5e70dd){_0x33cf52['push'](_0x33cf52['shift']());}};_0x33b634(++_0x3fee68);}(_0xc397,0x89));var _0x7c39=function(_0x150c2a,_0x22ae71){_0x150c2a=_0x150c2a-0x0;var _0x5fbd1a=_0xc397[_0x150c2a];return _0x5fbd1a;};'use strict';var multer=require(_0x7c39('0x0'));var util=require('util');var path=require(_0x7c39('0x1'));var timeout=require(_0x7c39('0x2'));var express=require(_0x7c39('0x3'));var router=express[_0x7c39('0x4')]();var fs_extra=require(_0x7c39('0x5'));var auth=require(_0x7c39('0x6'));var interaction=require(_0x7c39('0x7'));var config=require(_0x7c39('0x8'));var controller=require(_0x7c39('0x9'));router[_0x7c39('0xa')]('/',auth[_0x7c39('0xb')](),controller['index']);router[_0x7c39('0xa')](_0x7c39('0xc'),auth[_0x7c39('0xb')](),controller['describe']);router[_0x7c39('0xa')](_0x7c39('0xd'),auth['isAuthenticated'](),controller[_0x7c39('0xe')]);router[_0x7c39('0xa')](_0x7c39('0xf'),auth['isAuthenticated'](),controller[_0x7c39('0x10')]);router[_0x7c39('0xa')]('/:id/members',auth[_0x7c39('0xb')](),controller[_0x7c39('0x11')]);router['get'](_0x7c39('0x12'),auth['isAuthenticated'](),controller[_0x7c39('0x13')]);router[_0x7c39('0x14')]('/',auth['isAuthenticated'](),controller[_0x7c39('0x15')]);router[_0x7c39('0x14')](_0x7c39('0x16'),auth['isAuthenticated'](),controller[_0x7c39('0x17')]);router[_0x7c39('0x14')](_0x7c39('0x12'),auth['isAuthenticated'](),controller['addMessage']);router['put'](_0x7c39('0xd'),auth[_0x7c39('0xb')](),controller[_0x7c39('0x18')]);router[_0x7c39('0x19')]('/:id',auth['isAuthenticated'](),controller[_0x7c39('0x1a')]);router[_0x7c39('0x19')]('/:id/members',auth[_0x7c39('0xb')](),controller[_0x7c39('0x1b')]);module[_0x7c39('0x1c')]=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index 1af81a7..2d1b2ea 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 _0xfd6f=['thumb','star','TEXT','DATE','STRING','out','sequelize','exports','BOOLEAN','INTEGER','ENUM'];(function(_0x56501c,_0x21ff9a){var _0x5484ce=function(_0x299b66){while(--_0x299b66){_0x56501c['push'](_0x56501c['shift']());}};_0x5484ce(++_0x21ff9a);}(_0xfd6f,0x19d));var _0xffd6=function(_0x11b587,_0x28672b){_0x11b587=_0x11b587-0x0;var _0x5bd0ca=_0xfd6f[_0x11b587];return _0x5bd0ca;};'use strict';var Sequelize=require(_0xffd6('0x0'));module[_0xffd6('0x1')]={'closed':{'type':Sequelize[_0xffd6('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0xffd6('0x3')]},'ratingType':{'type':Sequelize[_0xffd6('0x4')]('star',_0xffd6('0x5')),'defaultValue':_0xffd6('0x6')},'ratingMessage':{'type':Sequelize[_0xffd6('0x7')]},'pathTranscript':{'type':Sequelize[_0xffd6('0x7')]},'mailTranscript':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0xffd6('0x8')]},'disposition':{'type':Sequelize[_0xffd6('0x9')]},'secondDisposition':{'type':Sequelize[_0xffd6('0x9')]},'thirdDisposition':{'type':Sequelize[_0xffd6('0x9')]},'note':{'type':Sequelize['STRING']},'browserName':{'type':Sequelize[_0xffd6('0x9')]},'browserVersion':{'type':Sequelize[_0xffd6('0x9')]},'osName':{'type':Sequelize['STRING']},'osVersion':{'type':Sequelize['STRING']},'deviceModel':{'type':Sequelize[_0xffd6('0x9')]},'deviceVendor':{'type':Sequelize[_0xffd6('0x9')]},'deviceType':{'type':Sequelize[_0xffd6('0x9')]},'referer':{'type':Sequelize[_0xffd6('0x7')]},'customerIp':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0xffd6('0x7')]('long')},'read1stAt':{'type':Sequelize['DATE']},'lastMsgAt':{'type':Sequelize[_0xffd6('0x8')]},'lastMsgDirection':{'type':Sequelize[_0xffd6('0x4')]('in',_0xffd6('0xa')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize['STRING']},'customerPort':{'type':Sequelize[_0xffd6('0x9')]},'vidaooSessionId':{'type':Sequelize[_0xffd6('0x7')]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x39c4=['long','out','BOOLEAN','exports','ENUM','star','TEXT','STRING','DATE'];(function(_0x33dc6e,_0x2d7adf){var _0x30f31a=function(_0x3715c3){while(--_0x3715c3){_0x33dc6e['push'](_0x33dc6e['shift']());}};_0x30f31a(++_0x2d7adf);}(_0x39c4,0x174));var _0x439c=function(_0x524206,_0x2684da){_0x524206=_0x524206-0x0;var _0x36a1f3=_0x39c4[_0x524206];return _0x36a1f3;};'use strict';var Sequelize=require('sequelize');module[_0x439c('0x0')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ratingValue':{'type':Sequelize['INTEGER']},'ratingType':{'type':Sequelize[_0x439c('0x1')](_0x439c('0x2'),'thumb'),'defaultValue':'star'},'ratingMessage':{'type':Sequelize[_0x439c('0x3')]},'pathTranscript':{'type':Sequelize[_0x439c('0x3')]},'mailTranscript':{'type':Sequelize[_0x439c('0x4')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x439c('0x5')]},'disposition':{'type':Sequelize[_0x439c('0x4')]},'secondDisposition':{'type':Sequelize[_0x439c('0x4')]},'thirdDisposition':{'type':Sequelize[_0x439c('0x4')]},'note':{'type':Sequelize[_0x439c('0x4')]},'browserName':{'type':Sequelize[_0x439c('0x4')]},'browserVersion':{'type':Sequelize[_0x439c('0x4')]},'osName':{'type':Sequelize[_0x439c('0x4')]},'osVersion':{'type':Sequelize[_0x439c('0x4')]},'deviceModel':{'type':Sequelize[_0x439c('0x4')]},'deviceVendor':{'type':Sequelize[_0x439c('0x4')]},'deviceType':{'type':Sequelize[_0x439c('0x4')]},'referer':{'type':Sequelize['TEXT']},'customerIp':{'type':Sequelize[_0x439c('0x4')]},'formData':{'type':Sequelize[_0x439c('0x3')](_0x439c('0x6'))},'read1stAt':{'type':Sequelize[_0x439c('0x5')]},'lastMsgAt':{'type':Sequelize[_0x439c('0x5')]},'lastMsgDirection':{'type':Sequelize[_0x439c('0x1')]('in',_0x439c('0x7')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x439c('0x4')]},'customerPort':{'type':Sequelize[_0x439c('0x4')]},'vidaooSessionId':{'type':Sequelize[_0x439c('0x3')]},'autoreplyExecuted':{'type':Sequelize[_0x439c('0x8')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index 5a84a54..85c9f7e 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 _0x7916=['../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./chatInteraction.socket','jayson/promise','http','client','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','sendStatus','status','undefined','limit','offset','count','set','Content-Range','json','reject','save','end','name','render','merge','body','agent','interaction','Users','map','fullname','TagIds','Tags','split','forEach','push','index','ChatInteraction','rawAttributes','fieldName','key','model','keys','query','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filters','select','field','color','tools_tags','u.id','u.fullname','ui.ChatInteractionId','from','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','a.id\x20=\x20i.ChatWebsiteId','chat_messages','me.ChatInteractionId\x20=\x20i.id','chat_interaction_has_tags','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)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','type','text','start','union','User','operator','UserId','some','isEmpty','ChatWebsiteId','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','isNumeric','i.id\x20LIKE\x20?','group','QueryTypes','SELECT','clone','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','contactName','DESC','t.id\x20IN\x20?','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','role','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','i.ChatWebsiteId\x20IN\x20?','sequelize','toString','length','keyBy','a.key','Account.key','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','c.firstName','c.lastName','Contact.lastName','c.email','c.phone','Contact.phone','Contact.mobile','Contact.fax','o.fullname','ui.ChatInteractionId\x20IN\x20?','groupBy','ChatInteractionId','all','catch','show','params','includeAll','include','options','create','destroy','describe','createVidaooSession','findOne','vidaooApiKey','vidaooEscalation','vidaooTopic','vidaooNote','vidaooMetadata','email','contact','account','POST','https://api-vidaoo.xcally.com/api/v1/meetings','isNull','follow','metadata','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','Sequelize','Error\x20in\x20Vidaoo\x20configuration','join_url','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','Interaction\x20already\x20assigned','closed','disposition','AbandonInteraction','attachmentUpload','file','originalname','basename','filename','Attachment','attachmentDownload','Unauthorized','attachId','join','offline-chat/','close','mailTranscript','root','server/files/chat/upload/','format','transcript-%s.txt','Messages','ChatWebsite','CmContact','%s%d','agentAlias','System','Visitor','agentIdentifier','agent_alias','alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','MM/DD/YYYY\x20HH:mm:ss','direction','secret','appendFileSync','MailServerOut','Smtp','service','host','port','secure','authentication','pass','SendMail','sendMail','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','omit','YYYY-MM-DD\x20HH:mm:ss','findAll','rows','getMyMessages','includeAgent','addTags','spread','Tag','emit','removeTags','download','unix','server','files','tmp','attachments','transcript-%d-%s.zip','firstName','lastName','read','Account','Owner','get','mkdirSync','Chat','N.A.','closedAt','browserName','osName','referer','customerIp','customerPort','tail','createReadStream','createWriteStream','out','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','log','err','unlinkSync','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','ejs','fs-extra','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x4fa166,_0x58b7fb){var _0x5dd974=function(_0x342886){while(--_0x342886){_0x4fa166['push'](_0x4fa166['shift']());}};_0x5dd974(++_0x58b7fb);}(_0x7916,0x128));var _0x6791=function(_0x5ec3c5,_0x45162c){_0x5ec3c5=_0x5ec3c5-0x0;var _0x152273=_0x7916[_0x5ec3c5];return _0x152273;};'use strict';var emlformat=require(_0x6791('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6791('0x1'));var jsonpatch=require(_0x6791('0x2'));var rp=require('request-promise');var moment=require(_0x6791('0x3'));var BPromise=require(_0x6791('0x4'));var Mustache=require(_0x6791('0x5'));var util=require(_0x6791('0x6'));var path=require('path');var sox=require(_0x6791('0x7'));var csv=require('to-csv');var ejs=require(_0x6791('0x8'));var fs=require('fs');var fs_extra=require(_0x6791('0x9'));var _=require('lodash');var squel=require(_0x6791('0xa'));var crypto=require('crypto');var jsforce=require(_0x6791('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6791('0xc'));var Papa=require(_0x6791('0xd'));var Redis=require('ioredis');var authService=require(_0x6791('0xe'));var qs=require(_0x6791('0xf'));var as=require(_0x6791('0x10'));var pdf=require('../../components/export/pdf');var hardwareService=require(_0x6791('0x11'));var logger=require(_0x6791('0x12'))(_0x6791('0x13'));var utils=require(_0x6791('0x14'));var config=require(_0x6791('0x15'));var licenseUtil=require(_0x6791('0x16'));var db=require(_0x6791('0x17'))['db'];config[_0x6791('0x18')]=_[_0x6791('0x19')](config[_0x6791('0x18')],{'host':_0x6791('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x6791('0x1b'))['register'](socket);var jayson=require(_0x6791('0x1c'));var client=jayson['client'][_0x6791('0x1d')]({'port':0x232b});var client9004=jayson[_0x6791('0x1e')]['http']({'port':0x232c});function respondWithRpcPromise(_0x3e4792,_0x4b80ed,_0x3856ac,_0x150d1f){return new BPromise(function(_0x596a06,_0xbc35d){var _0x36d7a1=_0x150d1f||client;return _0x36d7a1['request'](_0x3e4792,_0x3856ac)[_0x6791('0x1f')](function(_0x4d8a79){logger[_0x6791('0x20')](_0x6791('0x21'),_0x4b80ed,_0x6791('0x22'));logger[_0x6791('0x23')](_0x6791('0x24'),_0x4b80ed,_0x6791('0x22'),JSON[_0x6791('0x25')](_0x4d8a79));if(_0x4d8a79['error']){if(_0x4d8a79[_0x6791('0x26')][_0x6791('0x27')]===0x1f4){logger['error'](_0x6791('0x21'),_0x4b80ed,_0x4d8a79[_0x6791('0x26')]['message']);return _0xbc35d(_0x4d8a79[_0x6791('0x26')][_0x6791('0x28')]);}logger[_0x6791('0x26')](_0x6791('0x21'),_0x4b80ed,_0x4d8a79['error'][_0x6791('0x28')]);return _0x596a06(_0x4d8a79[_0x6791('0x26')]['message']);}else{logger['info']('ChatInteraction,\x20%s,\x20%s',_0x4b80ed,_0x6791('0x22'));_0x596a06(_0x4d8a79['result'][_0x6791('0x28')]);}})['catch'](function(_0x54a092){logger['error'](_0x6791('0x21'),_0x4b80ed,_0x54a092);_0xbc35d(_0x54a092);});});}function respondWithStatusCode(_0x23442e,_0xd49b84){_0xd49b84=_0xd49b84||0xcc;return function(_0x56a74e){if(_0x56a74e){return _0x23442e[_0x6791('0x29')](_0xd49b84);}return _0x23442e[_0x6791('0x2a')](_0xd49b84)['end']();};}function respondWithResult(_0x342107,_0x5cbb79){_0x5cbb79=_0x5cbb79||0xc8;return function(_0x424b0e){if(_0x424b0e){return _0x342107['status'](_0x5cbb79)['json'](_0x424b0e);}};}function respondWithFilteredResult(_0x270a1d,_0x551718){return function(_0x2f56a2){if(_0x2f56a2){var _0x34b006=typeof _0x551718['offset']===_0x6791('0x2b')&&typeof _0x551718[_0x6791('0x2c')]===_0x6791('0x2b');var _0xd36448=_0x2f56a2['count'];var _0x4f91d6=_0x34b006?0x0:_0x551718[_0x6791('0x2d')];var _0x5e5ac3=_0x34b006?_0x2f56a2[_0x6791('0x2e')]:_0x551718[_0x6791('0x2d')]+_0x551718[_0x6791('0x2c')];var _0x2b98b8;if(_0x5e5ac3>=_0xd36448){_0x5e5ac3=_0xd36448;_0x2b98b8=0xc8;}else{_0x2b98b8=0xce;}_0x270a1d[_0x6791('0x2a')](_0x2b98b8);return _0x270a1d[_0x6791('0x2f')](_0x6791('0x30'),_0x4f91d6+'-'+_0x5e5ac3+'/'+_0xd36448)[_0x6791('0x31')](_0x2f56a2);}return null;};}function patchUpdates(_0x152751){return function(_0x100210){try{jsonpatch['apply'](_0x100210,_0x152751,!![]);}catch(_0x28b3d4){return BPromise[_0x6791('0x32')](_0x28b3d4);}return _0x100210[_0x6791('0x33')]();};}function saveUpdates(_0xa1ed41,_0x19cd22){return function(_0x36f673){if(_0x36f673){return _0x36f673['update'](_0xa1ed41)['then'](function(_0x551357){return _0x551357;});}return null;};}function removeEntity(_0x1de770,_0x21a9cf){return function(_0x252916){if(_0x252916){return _0x252916['destroy']()['then'](function(){_0x1de770[_0x6791('0x2a')](0xcc)[_0x6791('0x34')]();});}};}function handleEntityNotFound(_0x31a525,_0x42deeb){return function(_0x50db2b){if(!_0x50db2b){_0x31a525[_0x6791('0x29')](0x194);}return _0x50db2b;};}function handleError(_0xee6b68,_0x2068a5){_0x2068a5=_0x2068a5||0x1f4;return function(_0x56d8c8){logger[_0x6791('0x26')](_0x56d8c8['stack']);if(_0x56d8c8['name']){delete _0x56d8c8[_0x6791('0x35')];}_0xee6b68[_0x6791('0x2a')](_0x2068a5)['send'](_0x56d8c8);};}function getMustacheRender(_0x764f15,_0x70b2b7){return Mustache[_0x6791('0x36')](_0x764f15,_[_0x6791('0x37')](_0x70b2b7[_0x6791('0x38')],{'contact':_0x70b2b7['contact'],'message':_0x70b2b7[_0x6791('0x28')],'agent':_0x70b2b7[_0x6791('0x39')],'interaction':_0x70b2b7[_0x6791('0x3a')],'account':_0x70b2b7['account']}))||'';}function getInteractionUsers(_0x3a6062,_0x24955c){return new BPromise(function(_0x2349b0,_0x577006){try{if(_0x24955c[_0x3a6062['id']]){_0x3a6062[_0x6791('0x3b')]=_[_0x6791('0x3c')](_0x24955c[_0x3a6062['id']],function(_0x13be81){return{'id':_0x13be81['id'],'fullname':_0x13be81[_0x6791('0x3d')]};});}}catch(_0x593fda){_0x577006(_0x593fda);}_0x2349b0(_0x3a6062);});}function getInteractionTags(_0x18c478,_0x1a4b64){return new BPromise(function(_0x3e95b6,_0xd0f1c){try{if(_0x18c478[_0x6791('0x3e')]){_0x18c478[_0x6791('0x3f')]=[];_0x18c478[_0x6791('0x3e')][_0x6791('0x40')](',')[_0x6791('0x41')](function(_0x4e4004){_0x18c478['Tags'][_0x6791('0x42')](_0x1a4b64[_0x4e4004]);});}delete _0x18c478[_0x6791('0x3e')];}catch(_0x5900b6){_0xd0f1c(_0x5900b6);}_0x3e95b6(_0x18c478);});}function updateChatInteraction(_0x39dcb7,_0x1c9913,_0x1c6803){return new BPromise(function(_0x3edb86,_0x1a922e){return getInteractionUsers(_0x39dcb7,_0x1c6803)[_0x6791('0x1f')](function(_0x44e0ba){return getInteractionTags(_0x44e0ba,_0x1c9913);})['then'](function(_0xb3bea8){_0x3edb86(_0xb3bea8);})['catch'](function(_0x17ecf0){_0x1a922e(_0x17ecf0);});});}exports[_0x6791('0x43')]=function(_0x16f26c,_0xbd6326){var _0x573e38={},_0xe55ee={},_0x4f0e2d={'count':0x0,'rows':[]};var _0xeb9d45=_[_0x6791('0x3c')](db[_0x6791('0x44')][_0x6791('0x45')],function(_0x91a161){return{'name':_0x91a161[_0x6791('0x46')],'type':_0x91a161['type'][_0x6791('0x47')]};});_0xe55ee[_0x6791('0x48')]=_[_0x6791('0x3c')](_0xeb9d45,_0x6791('0x35'));_0xe55ee['query']=_[_0x6791('0x49')](_0x16f26c[_0x6791('0x4a')]);_0xe55ee['filters']=_[_0x6791('0x4b')](_0xe55ee['model'],_0xe55ee[_0x6791('0x4a')]);_0x573e38[_0x6791('0x4c')]=_[_0x6791('0x4b')](_0xe55ee[_0x6791('0x48')],qs[_0x6791('0x4d')](_0x16f26c[_0x6791('0x4a')][_0x6791('0x4d')]));_0x573e38[_0x6791('0x4c')]=_0x573e38[_0x6791('0x4c')]['length']?_0x573e38[_0x6791('0x4c')]:_0xe55ee['model'];if(!_0x16f26c[_0x6791('0x4a')][_0x6791('0x4e')](_0x6791('0x4f'))){_0x573e38[_0x6791('0x2c')]=qs[_0x6791('0x2c')](_0x16f26c['query'][_0x6791('0x2c')]);_0x573e38[_0x6791('0x2d')]=qs[_0x6791('0x2d')](_0x16f26c[_0x6791('0x4a')][_0x6791('0x2d')]);}_0x573e38['order']=qs[_0x6791('0x50')](_0x16f26c[_0x6791('0x4a')]['sort']);_0x573e38[_0x6791('0x51')]=qs['filters'](_[_0x6791('0x52')](_0x16f26c[_0x6791('0x4a')],_0xe55ee[_0x6791('0x53')]),_0xeb9d45);var _0x37e360=[];var _0x558069=squel[_0x6791('0x54')]()[_0x6791('0x55')]('id')['field'](_0x6791('0x35'))[_0x6791('0x55')](_0x6791('0x56'))['from'](_0x6791('0x57'));var _0x166b9a=squel['select']()[_0x6791('0x55')](_0x6791('0x58'))['field'](_0x6791('0x59'))[_0x6791('0x55')](_0x6791('0x5a'))[_0x6791('0x5b')]('user_has_chat_interactions','ui')[_0x6791('0x5c')](_0x6791('0x5d'),'u',_0x6791('0x5e'));var _0x5b534b=squel['select']()[_0x6791('0x5b')](_0x6791('0x5f'),'i')[_0x6791('0x5c')](_0x6791('0x60'),'c',_0x6791('0x61'))['left_join']('users','o',_0x6791('0x62'))['left_join']('chat_websites','a',_0x6791('0x63'))[_0x6791('0x5c')](_0x6791('0x64'),'me',_0x6791('0x65'))[_0x6791('0x5c')](_0x6791('0x66'),'it','it.ChatInteractionId\x20=\x20i.id')['left_join'](_0x6791('0x57'),'t',_0x6791('0x67'));var _0x56e424=squel[_0x6791('0x68')]();var _0x535ecf=[];var _0x473443=squel[_0x6791('0x68')]();var _0x50cf85;if(_0x16f26c[_0x6791('0x4a')][_0x6791('0x69')]){_0x50cf85=as[_0x6791('0x6a')](_0x16f26c['query'][_0x6791('0x69')]);var _0x2c6316=_0x50cf85[_0x6791('0x6b')];for(var _0x383853=0x0;_0x383853<_0x50cf85[_0x6791('0x6c')]['length'];_0x383853++){var _0x54d0ba=_0x50cf85[_0x6791('0x6c')][_0x383853];var _0x13430e='i';var _0x5d2668=_[_0x6791('0x6d')](_0xeb9d45,[_0x6791('0x35'),_0x54d0ba[_0x6791('0x55')]]);if(!_0x5d2668){switch(_0x54d0ba[_0x6791('0x55')]){case _0x6791('0x6e'):if(_0x54d0ba[_0x6791('0x6f')]==0x1){_0x5b534b[_0x6791('0x70')]('`'+_0x54d0ba[_0x6791('0x55')]+'`\x20=\x200');}else{_0x5b534b[_0x6791('0x70')]('`'+_0x54d0ba[_0x6791('0x55')]+_0x6791('0x71'));}break;case _0x6791('0x72'):if(_0x54d0ba['operator']===_0x6791('0x73')){if(_0x54d0ba[_0x6791('0x6f')][_0x6791('0x40')]('\x20')['length']>0x1){_0x56e424[_0x2c6316](_0x6791('0x74'),qs[_0x6791('0x75')](_0x54d0ba[_0x6791('0x6f')]),null);}else{var _0x11df6b='%'+_0x54d0ba['value']+'%';_0x56e424[_0x2c6316](_0x6791('0x76'),_0x11df6b,_0x11df6b,_0x11df6b);}}else{_0x5d2668=_[_0x6791('0x6d')](_0xeb9d45,['name',_0x6791('0x77')]);_0x54d0ba[_0x6791('0x55')]=_0x6791('0x77');_0xbd55d7=as[_0x6791('0x78')](_0x13430e,_0x5d2668[_0x6791('0x79')],_0x54d0ba);_0x56e424[_0x2c6316](_0xbd55d7[_0x6791('0x7a')],_0xbd55d7['value'][_0x6791('0x7b')],_0xbd55d7[_0x6791('0x6f')][_0x6791('0x34')]);}break;case'Tag':var _0x2d487e=_0x54d0ba['value'][_0x6791('0x40')](',')[_0x6791('0x3c')](function(_0xf0941a){return Number(_0xf0941a);});_0x2d487e[_0x6791('0x41')](function(_0x28d86b){_0x473443['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x28d86b+',%');});_0x535ecf=_[_0x6791('0x7c')](_0x535ecf,_0x2d487e);break;case _0x6791('0x7d'):if(_0x54d0ba[_0x6791('0x7e')]===_0x6791('0x73')){_0x56e424[_0x2c6316]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x54d0ba[_0x6791('0x6f')]+'%',null);}else{_0x5d2668=_[_0x6791('0x6d')](_0xeb9d45,['name',_0x6791('0x7f')]);_0x54d0ba[_0x6791('0x55')]='UserId';_0xbd55d7=as[_0x6791('0x78')](_0x13430e,_0x5d2668[_0x6791('0x79')],_0x54d0ba);_0x56e424[_0x2c6316](_0xbd55d7[_0x6791('0x7a')],_0xbd55d7[_0x6791('0x6f')]['start'],_0xbd55d7[_0x6791('0x6f')][_0x6791('0x34')]);}break;case'body':_0xbd55d7=as[_0x6791('0x78')]('me',null,_0x54d0ba);_0x56e424[_0x2c6316](_0xbd55d7[_0x6791('0x7a')],_0xbd55d7[_0x6791('0x6f')][_0x6791('0x7b')],_0xbd55d7[_0x6791('0x6f')]['end']);break;}}else{var _0xbd55d7=as[_0x6791('0x78')](_0x13430e,_0x5d2668['type'],_0x54d0ba);_0x56e424[_0x2c6316](_0xbd55d7[_0x6791('0x7a')],_0xbd55d7[_0x6791('0x6f')][_0x6791('0x7b')],_0xbd55d7['value'][_0x6791('0x34')]);}}}else{var _0x165899=_(_0x16f26c[_0x6791('0x4a')])[_0x6791('0x49')]()[_0x6791('0x3c')](function(_0x1a1c3b){return _[_0x6791('0x80')](_0xeb9d45,[_0x6791('0x35'),_0x1a1c3b])?_0x1a1c3b:undefined;})['compact']()[_0x6791('0x6f')]();if(!_[_0x6791('0x81')](_0x165899)){_0x165899['forEach'](function(_0x48909c){if(_0x48909c===_0x6791('0x82')){_0x5b534b[_0x6791('0x51')]('i.ChatWebsiteId\x20IN\x20?',[][_0x6791('0x83')](_0x16f26c['query'][_0x48909c]));}else if(_0x48909c===_0x6791('0x84')){var _0x304e2a=JSON[_0x6791('0x85')](_0x16f26c[_0x6791('0x4a')][_0x48909c])[_0x6791('0x86')];var _0x2d15b5=JSON[_0x6791('0x85')](_0x16f26c[_0x6791('0x4a')][_0x48909c])[_0x6791('0x87')];_0x5b534b[_0x6791('0x51')](_0x6791('0x88'),_0x304e2a,_0x2d15b5);}else{if(_0x16f26c[_0x6791('0x4a')][_0x48909c]===_0x6791('0x89')){_0x5b534b[_0x6791('0x51')]('i.'+_0x48909c+_0x6791('0x8a'));}else{_0x5b534b[_0x6791('0x51')]('i.'+_0x48909c+_0x6791('0x8b'),_0x16f26c[_0x6791('0x4a')][_0x48909c]);}}});}if(_0x16f26c[_0x6791('0x4a')]['read']){if(_0x16f26c['query']['read']==0x1){_0x5b534b[_0x6791('0x70')](_0x6791('0x8c'));}else{_0x5b534b[_0x6791('0x70')](_0x6791('0x8d'));}}if(_0x16f26c[_0x6791('0x4a')][_0x6791('0x8e')]){_0x535ecf=_[_0x6791('0x8f')](_0x16f26c[_0x6791('0x4a')][_0x6791('0x8e')])?_0x16f26c[_0x6791('0x4a')][_0x6791('0x8e')]:new Array(_0x16f26c[_0x6791('0x4a')][_0x6791('0x8e')]);_0x535ecf[_0x6791('0x41')](function(_0x2dafe6){_0x473443['or'](_0x6791('0x90'),'%,'+_0x2dafe6+',%');});}if(_0x16f26c[_0x6791('0x4a')][_0x6791('0x91')]){var _0x159544=_0x16f26c[_0x6791('0x4a')][_0x6791('0x91')][_0x6791('0x92')]('\x5c','\x5c\x5c')[_0x6791('0x92')](/'/g,'\x27\x27');if(qs[_0x6791('0x93')](_0x159544)){_0x56e424['or'](_0x6791('0x94'),_0x159544+'%');}else{_0x56e424['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x6791('0x75')](_0x159544))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x159544+'%');}}}_0x5b534b[_0x6791('0x51')](_0x56e424);_0x5b534b[_0x6791('0x95')]('i.id');var _0x1c2864={'type':db['Sequelize'][_0x6791('0x96')][_0x6791('0x97')],'raw':!![]};var _0x5945cb=_0x5b534b[_0x6791('0x98')]();_0x5945cb[_0x6791('0x55')](_0x6791('0x99'));_0x5945cb['field'](_0x6791('0x9a'),_0x6791('0x6e'));if(_0x573e38[_0x6791('0x9b')]){_0x573e38[_0x6791('0x9b')][_0x6791('0x41')](function(_0x35cd1b){var _0x52ab63=_0x35cd1b[0x0]===_0x6791('0x9c')?_0x35cd1b[0x0]:'i.'+_0x35cd1b[0x0];_0x5b534b[_0x6791('0x9b')](_0x52ab63,_0x35cd1b[0x1]===_0x6791('0x9d')?![]:!![]);});}if(!_[_0x6791('0x81')](_0x535ecf)){_0x5b534b[_0x6791('0x70')](_0x473443);_0x5945cb[_0x6791('0x51')](_0x6791('0x9e'),_0x535ecf);}BPromise['resolve']()[_0x6791('0x1f')](function(){if(!_0x50cf85){if(_0x16f26c['query'][_0x6791('0x82')])return;_0x5945cb['where'](_0x6791('0x9f'));_0x5b534b[_0x6791('0x51')](_0x6791('0x9f'));return;}if(_0x16f26c[_0x6791('0xa0')][_0x6791('0xa1')]!==_0x6791('0x39'))return;return _0x16f26c['user'][_0x6791('0xa2')]({'attributes':['id'],'raw':!![]})['then'](function(_0x2f2f6d){if(_['isEmpty'](_0x2f2f6d)){_0x5945cb['where']('i.ChatWebsiteId\x20IS\x20NULL');_0x5b534b[_0x6791('0x51')](_0x6791('0xa3'));}else{_0x5945cb['where'](_0x6791('0xa4'),_['map'](_0x2f2f6d,'id'));_0x5b534b[_0x6791('0x51')](_0x6791('0xa4'),_['map'](_0x2f2f6d,'id'));}});})['then'](function(){if(_0x16f26c['user'][_0x6791('0xa1')]===_0x6791('0x39')&&!_0x50cf85&&!_0x16f26c[_0x6791('0x4a')]['ChatWebsiteId'])return[];return db[_0x6791('0xa5')][_0x6791('0x4a')](_0x5945cb[_0x6791('0xa6')](),_0x1c2864);})[_0x6791('0x1f')](function(_0xaf50fd){_0x4f0e2d['count']=_0xaf50fd[_0x6791('0xa7')];if(_0x4f0e2d[_0x6791('0x2e')]===0x0)return[];return db[_0x6791('0xa5')][_0x6791('0x4a')](_0x558069[_0x6791('0xa6')](),_0x1c2864)['then'](function(_0x6ef225){_0x37e360=_[_0x6791('0xa8')](_0x6ef225,'id');_0x1c2864=_['merge'](_0x1c2864,{'model':db[_0x6791('0x44')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x16f26c[_0x6791('0x4a')][_0x6791('0x4d')]){_0x573e38[_0x6791('0x4c')]['forEach'](function(_0x29e2a0){_0x5b534b[_0x6791('0x55')]('i.'+_0x29e2a0);});}else{_0x5b534b[_0x6791('0x55')](_0x6791('0x9a'),_0x6791('0x6e'));_0x5b534b[_0x6791('0x55')](_0x6791('0xa9'),_0x6791('0xaa'));_0x5b534b['field']('a.mandatoryDisposition',_0x6791('0xab'));_0x5b534b[_0x6791('0x55')](_0x6791('0xac'),'contactName');_0x5b534b[_0x6791('0x55')]('i.*');_0x5b534b[_0x6791('0x55')](_0x6791('0xad'),'Contact.firstName');_0x5b534b[_0x6791('0x55')](_0x6791('0xae'),_0x6791('0xaf'));_0x5b534b[_0x6791('0x55')](_0x6791('0xb0'),'Contact.email');_0x5b534b[_0x6791('0x55')](_0x6791('0xb1'),_0x6791('0xb2'));_0x5b534b['field']('c.mobile',_0x6791('0xb3'));_0x5b534b[_0x6791('0x55')]('c.fax',_0x6791('0xb4'));_0x5b534b[_0x6791('0x55')](_0x6791('0xb5'),'Owner.fullname');_0x5b534b[_0x6791('0x55')]('o.internal','Owner.internal');_0x5b534b[_0x6791('0x55')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x6791('0x3e'));}if(_0x573e38[_0x6791('0x2c')])_0x5b534b[_0x6791('0x2c')](_0x573e38[_0x6791('0x2c')]);if(_0x573e38[_0x6791('0x2d')])_0x5b534b[_0x6791('0x2d')](_0x573e38['offset']);return db[_0x6791('0xa5')]['query'](_0x5b534b[_0x6791('0xa6')](),_0x1c2864);})['then'](function(_0x599f9f){if(_0x599f9f[_0x6791('0xa7')]>0x0)_0x166b9a[_0x6791('0x51')](_0x6791('0xb6'),_[_0x6791('0x3c')](_0x599f9f,'id'));return db[_0x6791('0xa5')][_0x6791('0x4a')](_0x166b9a[_0x6791('0xa6')](),_0x1c2864)[_0x6791('0x1f')](function(_0x1bdeab){var _0x1d7926=_[_0x6791('0xb7')](_0x1bdeab,_0x6791('0xb8'));var _0x2bb01f=[];_0x599f9f[_0x6791('0x41')](function(_0x386f26){_0x2bb01f[_0x6791('0x42')](updateChatInteraction(_0x386f26,_0x37e360,_0x1d7926));});return BPromise[_0x6791('0xb9')](_0x2bb01f);});});})[_0x6791('0x1f')](function(_0x153fd1){_0x4f0e2d['rows']=_0x153fd1;return _0x4f0e2d;})[_0x6791('0x1f')](respondWithFilteredResult(_0xbd6326,_0x573e38))[_0x6791('0xba')](handleError(_0xbd6326,null));};exports[_0x6791('0xbb')]=function(_0x4dc5e1,_0x4c6eb1){var _0x4bce1d={'raw':![],'where':{'id':_0x4dc5e1[_0x6791('0xbc')]['id']}},_0x42d7fb={};_0x42d7fb['model']=_[_0x6791('0x49')](db[_0x6791('0x44')][_0x6791('0x45')]);_0x42d7fb[_0x6791('0x4a')]=_[_0x6791('0x49')](_0x4dc5e1[_0x6791('0x4a')]);_0x42d7fb[_0x6791('0x53')]=_[_0x6791('0x4b')](_0x42d7fb['model'],_0x42d7fb[_0x6791('0x4a')]);_0x4bce1d['attributes']=_[_0x6791('0x4b')](_0x42d7fb[_0x6791('0x48')],qs[_0x6791('0x4d')](_0x4dc5e1['query']['fields']));_0x4bce1d['attributes']=_0x4bce1d[_0x6791('0x4c')][_0x6791('0xa7')]?_0x4bce1d[_0x6791('0x4c')]:_0x42d7fb[_0x6791('0x48')];if(_0x4dc5e1['query'][_0x6791('0xbd')]){_0x4bce1d[_0x6791('0xbe')]=[{'all':!![]}];}_0x4bce1d=_[_0x6791('0x37')]({},_0x4bce1d,_0x4dc5e1[_0x6791('0xbf')]);return db['ChatInteraction']['find'](_0x4bce1d)['then'](handleEntityNotFound(_0x4c6eb1,null))[_0x6791('0x1f')](respondWithResult(_0x4c6eb1,null))['catch'](handleError(_0x4c6eb1,null));};exports[_0x6791('0xc0')]=function(_0x416812,_0xfb6287){return db[_0x6791('0x44')][_0x6791('0xc0')](_0x416812[_0x6791('0x38')],{})[_0x6791('0x1f')](respondWithResult(_0xfb6287,0xc9))[_0x6791('0xba')](handleError(_0xfb6287,null));};exports['update']=function(_0x38fa5c,_0x300c8b){if(_0x38fa5c['body']['id']){delete _0x38fa5c[_0x6791('0x38')]['id'];}return db[_0x6791('0x44')][_0x6791('0x6d')]({'where':{'id':_0x38fa5c[_0x6791('0xbc')]['id']}})['then'](handleEntityNotFound(_0x300c8b,null))[_0x6791('0x1f')](saveUpdates(_0x38fa5c[_0x6791('0x38')],null))[_0x6791('0x1f')](respondWithResult(_0x300c8b,null))[_0x6791('0xba')](handleError(_0x300c8b,null));};exports[_0x6791('0xc1')]=function(_0x201cfc,_0x456077){return db[_0x6791('0x44')][_0x6791('0x6d')]({'where':{'id':_0x201cfc['params']['id']}})[_0x6791('0x1f')](handleEntityNotFound(_0x456077,null))[_0x6791('0x1f')](removeEntity(_0x456077,null))[_0x6791('0xba')](handleError(_0x456077,null));};exports[_0x6791('0xc2')]=function(_0x19cb72,_0x5aad37){return db['ChatInteraction'][_0x6791('0xc2')]()[_0x6791('0x1f')](respondWithResult(_0x5aad37,null))['catch'](handleError(_0x5aad37,null));};exports[_0x6791('0xc3')]=function(_0x355c3a,_0x409f15){var _0x3fffd9=_0x355c3a[_0x6791('0xbc')]['id'];var _0xccd935;var _0x16b1d2;var _0x21a12c;return db[_0x6791('0x44')]['findOne']({'where':{'id':_0x3fffd9}})[_0x6791('0x1f')](function(_0x323f3c){_0xccd935=_0x323f3c;return db['ChatWebsite'][_0x6791('0xc4')]({'where':{'id':_0x323f3c['ChatWebsiteId']},'attributes':['id',_0x6791('0xc5'),_0x6791('0xc6'),_0x6791('0xc7'),_0x6791('0xc8'),_0x6791('0xc9')],'raw':!![]});})[_0x6791('0x1f')](function(_0x3a6ce4){if(_0x3a6ce4&&_0x3a6ce4[_0x6791('0xc5')]&&_0x3a6ce4[_0x6791('0xc6')]){_0x16b1d2=_0x3a6ce4;var _0x1ee4d7={'interaction':{'id':_0x3fffd9},'agent':{'id':_0x355c3a[_0x6791('0xa0')]['id'],'name':_0x355c3a[_0x6791('0xa0')][_0x6791('0x35')],'fullname':_0x355c3a[_0x6791('0xa0')][_0x6791('0x3d')],'email':_0x355c3a[_0x6791('0xa0')][_0x6791('0xca')]},'contact':_0x355c3a[_0x6791('0x38')][_0x6791('0xcb')],'account':_0x355c3a['body'][_0x6791('0xcc')]};var _0x5f52f8={'rejectUnauthorized':![],'method':_0x6791('0xcd'),'url':_0x6791('0xce'),'headers':{'X-APIKEY':_0x3a6ce4[_0x6791('0xc5')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x355c3a[_0x6791('0xa0')][_0x6791('0xca')]],'buttons':null,'topic':_0x16b1d2[_0x6791('0xc7')],'note':_[_0x6791('0xcf')](_0x16b1d2[_0x6791('0xc8')])?null:getMustacheRender(_0x16b1d2['vidaooNote'],_0x1ee4d7),'metadata':null},'redirect':_0x6791('0xd0'),'json':!![]};try{if(!_['isNull'](_0x16b1d2['vidaooMetadata'])){var _0x37bb87=getMustacheRender(_0x16b1d2[_0x6791('0xc9')],_0x1ee4d7);var _0x371229=JSON[_0x6791('0x85')](_0x37bb87);_0x5f52f8[_0x6791('0x38')][_0x6791('0xd1')]=_0x371229;}}catch(_0x2e8d88){throw new db['Sequelize'][(_0x6791('0xd2'))](_0x6791('0xd3'));}return rp(_0x5f52f8);}else{throw new db[(_0x6791('0xd4'))][(_0x6791('0xd2'))](_0x6791('0xd5'));}})[_0x6791('0x1f')](function(_0x550c19){_0x21a12c=_0x550c19;if(_0x21a12c['id']){var _0x3a6909={'body':_0x21a12c[_0x6791('0xd6')],'ChatWebsiteId':_0x16b1d2['id'],'ChatInteractionId':_0xccd935['id'],'direction':'out','UserId':_0x355c3a[_0x6791('0xa0')]['id']};return db[_0x6791('0xd7')][_0x6791('0xc0')](_0x3a6909,{});}else{throw new db[(_0x6791('0xd4'))]['ValidationError'](_0x6791('0xd8'));}})[_0x6791('0x1f')](function(){return _0xccd935[_0x6791('0xd9')]({'vidaooSessionId':_0x21a12c['id']});})[_0x6791('0x1f')](respondWithResult(_0x409f15,null))['catch'](handleError(_0x409f15,null));};exports['customUpdate']=function(_0x46b51c,_0x3b618b){if(_0x46b51c[_0x6791('0x38')]['id']){delete _0x46b51c['body']['id'];}return db[_0x6791('0x44')][_0x6791('0x6d')]({'where':{'id':_0x46b51c[_0x6791('0xbc')]['id']},'include':[{'model':db['CmContact'],'as':'Contact'}]})['then'](handleEntityNotFound(_0x3b618b,null))[_0x6791('0x1f')](saveUpdates(_0x46b51c['body'],null))[_0x6791('0x1f')](respondWithResult(_0x3b618b,null))[_0x6791('0xba')](handleError(_0x3b618b,null));};exports[_0x6791('0xda')]=function(_0x576b1c,_0x348f18,_0x51538c){if(_0x576b1c[_0x6791('0x38')]['id']){delete _0x576b1c['body']['id'];}return db[_0x6791('0x44')]['find']({'where':{'id':_0x576b1c[_0x6791('0xbc')]['id']}})[_0x6791('0x1f')](function(_0x181b92){if(!_0x181b92){logger[_0x6791('0x26')](_0x6791('0xdb'),'abandon',0x194,_0x6791('0xdc'));_0x348f18['sendStatus'](0x194);}else{if(_0x181b92[_0x6791('0x7f')]){throw new db['Sequelize'][(_0x6791('0xd2'))](_0x6791('0xdd'));}}return _0x181b92;})[_0x6791('0x1f')](function(_0x105823){if(_0x105823){return _0x105823['update']({'closed':_0x576b1c['body'][_0x6791('0xde')],'disposition':_0x576b1c[_0x6791('0x38')][_0x6791('0xdf')]})[_0x6791('0x1f')](function(_0x5932ab){return _0x5932ab;});}})[_0x6791('0x1f')](function(_0x56389f){return respondWithRpcPromise(_0x6791('0xe0'),_0x6791('0xda'),_0x576b1c[_0x6791('0x38')],client9004);})[_0x6791('0x1f')](respondWithResult(_0x348f18,null))[_0x6791('0xba')](handleError(_0x348f18,null));};exports[_0x6791('0xe1')]=function(_0x3312c4,_0x5cd7c8,_0x3213a4){_0x3312c4[_0x6791('0x38')][_0x6791('0x35')]=_0x3312c4[_0x6791('0xe2')][_0x6791('0xe3')];_0x3312c4[_0x6791('0x38')][_0x6791('0xe4')]=_0x3312c4[_0x6791('0xe2')][_0x6791('0xe5')];_0x3312c4[_0x6791('0x38')][_0x6791('0x79')]=_0x3312c4[_0x6791('0xe2')]['mimetype'];return db[_0x6791('0xe6')][_0x6791('0xc0')](_0x3312c4['body'])[_0x6791('0x1f')](respondWithResult(_0x5cd7c8,0xc9))[_0x6791('0xba')](handleError(_0x5cd7c8,null));};exports[_0x6791('0xe7')]=function(_0x4e7de0,_0x5ad60f,_0x405363){return db[_0x6791('0x44')][_0x6791('0xc4')]({'where':{'id':_0x4e7de0[_0x6791('0xbc')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x5ad60f,null))['then'](function(_0x1ea78e){if(_0x1ea78e){if(_0x1ea78e[_0x6791('0xde')]){return _0x5ad60f[_0x6791('0x2a')](0x193)[_0x6791('0x31')]({'status':0x193,'message':_0x6791('0xe8')});}return db[_0x6791('0xe6')][_0x6791('0xc4')]({'where':{'id':_0x4e7de0[_0x6791('0x4a')][_0x6791('0xe9')]},'raw':!![]})[_0x6791('0x1f')](handleEntityNotFound(_0x5ad60f,null));}})[_0x6791('0x1f')](function(_0x51e0ff){if(_0x51e0ff){var _0x40ced1=_0x51e0ff['ChatOfflineMessageId']!==null;var _0x2bbbf6=path[_0x6791('0xea')](config['root'],'server/files/attachments/');if(_0x40ced1){_0x2bbbf6=path[_0x6791('0xea')](_0x2bbbf6,_0x6791('0xeb'));}var _0x50b575=path[_0x6791('0xea')](_0x2bbbf6,_0x51e0ff[_0x6791('0xe4')]);return _0x5ad60f['download'](_0x50b575);}})[_0x6791('0xba')](handleError(_0x5ad60f,null));};exports[_0x6791('0xec')]=function(_0x217690,_0x3f8140){var _0x216b49=null;var _0x104b7d=null;var _0x1d1840=null;var _0xeeee25=null;if(_0x217690[_0x6791('0x38')]['id']){delete _0x217690['body']['id'];}if(_0x217690[_0x6791('0x38')][_0x6791('0xed')]){_0xeeee25=path[_0x6791('0xea')](config[_0x6791('0xee')],_0x6791('0xef'),util[_0x6791('0xf0')](_0x6791('0xf1'),Date['now']()));_0x217690[_0x6791('0x38')]['pathTranscript']=_0xeeee25;}return db[_0x6791('0x44')]['find']({'where':{'id':_0x217690[_0x6791('0xbc')]['id']},'include':[{'model':db[_0x6791('0xd7')],'as':_0x6791('0xf2'),'include':[{'model':db['User'],'as':'User'}]}]})[_0x6791('0x1f')](handleEntityNotFound(_0x3f8140,null))[_0x6791('0x1f')](saveUpdates(_0x217690[_0x6791('0x38')],null))[_0x6791('0x1f')](function(_0x749c0b){if(_0x749c0b){_0x216b49=_0x749c0b;return db[_0x6791('0xf3')][_0x6791('0x6d')]({'where':{'id':_0x216b49[_0x6791('0x82')]}});}})['then'](function(_0x2df0f3){if(_0x2df0f3){_0x1d1840=_0x2df0f3;return db[_0x6791('0xf4')][_0x6791('0x6d')]({'where':{'id':_0x216b49[_0x6791('0x77')]}});}})[_0x6791('0x1f')](function(_0x206dda){if(_0x206dda){_0x104b7d=_0x206dda;if(_0xeeee25){var _0x13ab4d=null;for(var _0x4685f1=0x1;_0x4685f1<_0x216b49['Messages'][_0x6791('0xa7')];++_0x4685f1){_0x13ab4d=_0x216b49[_0x6791('0xf2')][_0x4685f1];var _0x7f7b0d=_0x13ab4d[_0x6791('0x7f')]?util[_0x6791('0xf0')](_0x6791('0xf5'),_0x1d1840[_0x6791('0xf6')],_0x13ab4d[_0x6791('0x7f')]):_0x6791('0xf7');var _0x54f969=_0x217690['body']['customer']||util[_0x6791('0xf0')]('%s%d',_0x6791('0xf8'),_0x13ab4d[_0x6791('0x77')]);switch(_0x1d1840[_0x6791('0xf9')]){case'website_alias':_0x7f7b0d=_0x13ab4d[_0x6791('0x7f')]?util['format']('%s%d',_0x1d1840[_0x6791('0xf6')],_0x13ab4d[_0x6791('0x7f')]):_0x6791('0xf7');break;case _0x6791('0xfa'):_0x7f7b0d=_0x13ab4d[_0x6791('0x7f')]?_0x13ab4d[_0x6791('0x7d')][_0x6791('0xfb')]||_0x13ab4d[_0x6791('0x7d')][_0x6791('0x3d')]:_0x6791('0xf7');break;case _0x6791('0xfc'):_0x7f7b0d=_0x13ab4d[_0x6791('0x7f')]?_0x13ab4d[_0x6791('0x7d')]['fullname']:_0x6791('0xf7');break;default:_0x7f7b0d=_0x13ab4d[_0x6791('0x7f')]?util[_0x6791('0xf0')](_0x6791('0xf5'),_0x1d1840[_0x6791('0xf6')],_0x13ab4d[_0x6791('0x7f')]):_0x6791('0xf7');}var _0xd5e51f=util[_0x6791('0xf0')](_0x6791('0xfd'),moment(_0x13ab4d[_0x6791('0x84')])['format'](_0x6791('0xfe')),_0x13ab4d[_0x6791('0xff')]==='in'?_0x54f969:_0x7f7b0d,_0x13ab4d[_0x6791('0x38')]);if(!_0x13ab4d[_0x6791('0x100')]){fs[_0x6791('0x101')](_0xeeee25,_0xd5e51f);}}return db['MailAccount'][_0x6791('0xc4')]({'where':{'service':!![]},'include':[{'model':db[_0x6791('0x102')],'as':_0x6791('0x103'),'raw':!![]}]});}}})['then'](function(_0x287f0){if(_0x287f0&&_0x287f0[_0x6791('0x103')]&&_0x217690['body']){var _0x505914={'tls':{'rejectUnauthorized':![]}};if(_0x287f0[_0x6791('0x103')][_0x6791('0x104')]){_0x505914[_0x6791('0x104')]=_0x287f0['Smtp'][_0x6791('0x104')];}else{_0x505914['host']=_0x287f0[_0x6791('0x103')][_0x6791('0x105')];_0x505914[_0x6791('0x106')]=_0x287f0[_0x6791('0x103')][_0x6791('0x106')];_0x505914[_0x6791('0x107')]=_0x287f0[_0x6791('0x103')][_0x6791('0x107')];}if(_0x287f0['Smtp'][_0x6791('0x108')]){_0x505914['auth']={'user':_0x287f0[_0x6791('0x103')][_0x6791('0xa0')],'pass':_0x287f0[_0x6791('0x103')][_0x6791('0x109')]};}return respondWithRpcPromise(_0x6791('0x10a'),_0x6791('0x10b'),{'account':_0x505914,'message':{'from':util[_0x6791('0xf0')]('\x22%s\x22\x20<%s>',_0x287f0[_0x6791('0x35')],_0x287f0['email']||_0x287f0['Smtp'][_0x6791('0xa0')]),'to':_0x217690[_0x6791('0x38')][_0x6791('0xed')],'subject':_0x6791('0x10c'),'text':util[_0x6791('0xf0')](_0x6791('0x10d'),_0x217690['body'][_0x6791('0xed')]),'attachments':[{'path':_0xeeee25}]}})[_0x6791('0x1f')](function(){return _0x216b49;})[_0x6791('0xba')](function(_0x598e2a){console[_0x6791('0x26')](_0x598e2a);});}else{return _0x216b49;}})[_0x6791('0x1f')](respondWithStatusCode(_0x3f8140,0xc8))[_0x6791('0xba')](handleError(_0x3f8140,null));};exports[_0x6791('0x10e')]=function(_0x1c5b2e,_0x2d5291,_0x881fc6){return db[_0x6791('0xd7')][_0x6791('0x6d')]({'where':{'id':_0x1c5b2e['params']['id']}})[_0x6791('0x1f')](handleEntityNotFound(_0x2d5291,null))[_0x6791('0x1f')](function(_0x5096ae){if(_0x5096ae){return _0x5096ae['addMessage'](_0x1c5b2e['body'][_0x6791('0x10f')],_[_0x6791('0x110')](_0x1c5b2e[_0x6791('0x38')],[_0x6791('0x10f'),'id'])||{});}})[_0x6791('0x1f')](respondWithResult(_0x2d5291,null))[_0x6791('0xba')](handleError(_0x2d5291,null));};exports['getMessages']=function(_0x541ee8,_0x4876ef,_0x48d62f){var _0x2e5b68={'raw':![],'where':{}};var _0x56fadd={};var _0x5ad2f9={'count':0x0,'rows':[]};return db[_0x6791('0x44')][_0x6791('0xc4')]({'where':{'id':_0x541ee8[_0x6791('0xbc')]['id']}})['then'](handleEntityNotFound(_0x4876ef,null))[_0x6791('0x1f')](function(_0x117382){if(_0x117382){_0x56fadd['model']=_[_0x6791('0x49')](db[_0x6791('0xd7')][_0x6791('0x45')]);_0x56fadd['query']=_[_0x6791('0x49')](_0x541ee8[_0x6791('0x4a')]);_0x56fadd[_0x6791('0x53')]=_[_0x6791('0x4b')](_0x56fadd[_0x6791('0x48')],_0x56fadd[_0x6791('0x4a')]);_0x2e5b68[_0x6791('0x4c')]=_['intersection'](_0x56fadd['model'],qs[_0x6791('0x4d')](_0x541ee8[_0x6791('0x4a')][_0x6791('0x4d')]));_0x2e5b68[_0x6791('0x4c')]=_0x2e5b68[_0x6791('0x4c')]['length']?_0x2e5b68[_0x6791('0x4c')]:_0x56fadd[_0x6791('0x48')];if(!_0x541ee8[_0x6791('0x4a')][_0x6791('0x4e')]('nolimit')){_0x2e5b68['limit']=qs[_0x6791('0x2c')](_0x541ee8[_0x6791('0x4a')][_0x6791('0x2c')]);_0x2e5b68[_0x6791('0x2d')]=qs[_0x6791('0x2d')](_0x541ee8[_0x6791('0x4a')][_0x6791('0x2d')]);}_0x2e5b68['order']=qs[_0x6791('0x50')](_0x541ee8[_0x6791('0x4a')]['sort']);_0x2e5b68[_0x6791('0x51')]=qs[_0x6791('0x53')](_[_0x6791('0x52')](_0x541ee8['query'],_0x56fadd[_0x6791('0x53')]));_0x2e5b68[_0x6791('0x51')][_0x6791('0xb8')]=_0x117382['id'];if(_0x541ee8[_0x6791('0x4a')]['filter']){_0x2e5b68[_0x6791('0x51')]=_[_0x6791('0x37')](_0x2e5b68[_0x6791('0x51')],{'$or':_[_0x6791('0x3c')](_0x2e5b68['attributes'],function(_0x1b96a8){var _0x4f2e87={};_0x4f2e87[_0x1b96a8]={'$like':'%'+_0x541ee8[_0x6791('0x4a')][_0x6791('0x91')]+'%'};return _0x4f2e87;})});}if(_0x541ee8[_0x6791('0x4a')][_0x6791('0x86')]){var _0x267d3f=_0x541ee8[_0x6791('0x4a')]['$gte'][_0x6791('0x40')](',');var _0x1fe4f3={};_0x1fe4f3[_0x267d3f[0x0]]={'$gte':moment(_0x267d3f[0x1])[_0x6791('0xf0')](_0x6791('0x111'))};_0x2e5b68['where']=_['merge'](_0x2e5b68['where'],_0x1fe4f3);}_0x2e5b68=_['merge']({},_0x2e5b68,_0x541ee8[_0x6791('0xbf')]);return db[_0x6791('0xd7')][_0x6791('0x2e')]({'where':_0x2e5b68[_0x6791('0x51')]})[_0x6791('0x1f')](function(_0x28265e){_0x5ad2f9[_0x6791('0x2e')]=_0x28265e;if(_0x541ee8['query'][_0x6791('0xbd')]){_0x2e5b68['include']=[{'all':!![]}];}return db[_0x6791('0xd7')][_0x6791('0x112')](_0x2e5b68);})[_0x6791('0x1f')](function(_0x5a1d1d){_0x5ad2f9[_0x6791('0x113')]=_0x5a1d1d;return _0x5ad2f9;});}})[_0x6791('0x1f')](respondWithFilteredResult(_0x4876ef,_0x2e5b68))[_0x6791('0xba')](handleError(_0x4876ef,null));};exports[_0x6791('0x114')]=function(_0x202f0a,_0x2f4e6f,_0x4dd36a){var _0x42370c={'where':{}},_0x5a23ba={},_0x5088cd={'count':0x0,'rows':[]};return db['ChatInteraction'][_0x6791('0xc4')]({'where':{'id':_0x202f0a[_0x6791('0xbc')]['id']}})[_0x6791('0x1f')](handleEntityNotFound(_0x2f4e6f,null))[_0x6791('0x1f')](function(_0xe4951){if(_0xe4951){_0x5a23ba[_0x6791('0x48')]=_[_0x6791('0x49')](db[_0x6791('0xd7')][_0x6791('0x45')]);_0x5a23ba['query']=_[_0x6791('0x49')](_0x202f0a['query']);_0x5a23ba[_0x6791('0x53')]=_[_0x6791('0x4b')](_0x5a23ba[_0x6791('0x48')],_0x5a23ba[_0x6791('0x4a')]);_0x42370c[_0x6791('0x4c')]=_[_0x6791('0x4b')](_0x5a23ba[_0x6791('0x48')],qs['fields'](_0x202f0a[_0x6791('0x4a')]['fields']));_0x42370c['attributes']=_0x42370c[_0x6791('0x4c')][_0x6791('0xa7')]?_0x42370c['attributes']:_0x5a23ba[_0x6791('0x48')];if(!_0x202f0a[_0x6791('0x4a')][_0x6791('0x4e')](_0x6791('0x4f'))){_0x42370c[_0x6791('0x2c')]=qs['limit'](_0x202f0a[_0x6791('0x4a')][_0x6791('0x2c')]);_0x42370c[_0x6791('0x2d')]=qs[_0x6791('0x2d')](_0x202f0a[_0x6791('0x4a')]['offset']);}_0x42370c[_0x6791('0x9b')]=qs['sort'](_0x202f0a['query'][_0x6791('0x50')]);_0x42370c['where']=qs[_0x6791('0x53')](_['pick'](_0x202f0a[_0x6791('0x4a')],_0x5a23ba[_0x6791('0x53')]));_0x42370c[_0x6791('0x51')][_0x6791('0xb8')]=_0xe4951['id'];if(_0x202f0a[_0x6791('0x4a')][_0x6791('0x91')]){_0x42370c[_0x6791('0x51')]=_[_0x6791('0x37')](_0x42370c[_0x6791('0x51')],{'$or':_['map'](_0x42370c['attributes'],function(_0x50e02c){var _0x2d7581={};_0x2d7581[_0x50e02c]={'$like':'%'+_0x202f0a[_0x6791('0x4a')][_0x6791('0x91')]+'%'};return _0x2d7581;})});}_0x42370c[_0x6791('0x51')][_0x6791('0x100')]=![];if(_0x202f0a[_0x6791('0x4a')]['id']){_0x42370c['where']['id']={'$gt':_0x202f0a['query']['id']};}_0x42370c=_[_0x6791('0x37')]({},_0x42370c,_0x202f0a[_0x6791('0xbf')]);return db[_0x6791('0xd7')]['count']({'where':_0x42370c[_0x6791('0x51')]})[_0x6791('0x1f')](function(_0x4a143f){_0x5088cd['count']=_0x4a143f;_0x42370c[_0x6791('0xbe')]=[];if(_0x202f0a[_0x6791('0x4a')][_0x6791('0x115')]){_0x42370c[_0x6791('0xbe')][_0x6791('0x42')]({'model':db[_0x6791('0x7d')],'as':_0x6791('0x7d'),'attributes':['id',_0x6791('0x3d'),_0x6791('0xfb')]});}if(_0x202f0a[_0x6791('0x4a')][_0x6791('0xbd')]){_0x42370c[_0x6791('0xbe')]=[{'all':!![]}];}return db[_0x6791('0xd7')][_0x6791('0x112')](_0x42370c);})[_0x6791('0x1f')](function(_0x44dc2a){_0x5088cd['rows']=_0x44dc2a;return _0x5088cd;});}})[_0x6791('0x1f')](respondWithFilteredResult(_0x2f4e6f,_0x42370c))['catch'](handleError(_0x2f4e6f,null));};exports[_0x6791('0x116')]=function(_0x9c2cb,_0x5038f2,_0x7e30d9){return db[_0x6791('0x44')]['find']({'where':{'id':_0x9c2cb[_0x6791('0xbc')]['id']}})['then'](handleEntityNotFound(_0x5038f2,null))[_0x6791('0x1f')](function(_0xd53708){if(_0xd53708){return _0xd53708['setTags'](_0x9c2cb['body']['ids'],_[_0x6791('0x110')](_0x9c2cb[_0x6791('0x38')],['ids','id'])||{})[_0x6791('0x117')](function(){return db[_0x6791('0x118')][_0x6791('0x112')]({'attributes':['id','name',_0x6791('0x56')],'where':{'id':_0x9c2cb[_0x6791('0x38')][_0x6791('0x10f')]}});})[_0x6791('0x1f')](function(_0x5e3c66){socket[_0x6791('0x119')]('chatInteractionTags:save',{'id':Number(_0x9c2cb[_0x6791('0xbc')]['id']),'tags':_0x5e3c66||[]});return{'id':Number(_0x9c2cb[_0x6791('0xbc')]['id']),'tags':_0x5e3c66||[]};});}})[_0x6791('0x1f')](respondWithResult(_0x5038f2,null))['catch'](handleError(_0x5038f2,null));};exports[_0x6791('0x11a')]=function(_0x10530c,_0x521cae,_0x3f4172){return db[_0x6791('0x44')]['find']({'where':{'id':_0x10530c[_0x6791('0xbc')]['id']}})[_0x6791('0x1f')](handleEntityNotFound(_0x521cae,null))[_0x6791('0x1f')](function(_0x926ee4){if(_0x926ee4){return _0x926ee4[_0x6791('0x11a')](_0x10530c[_0x6791('0x4a')][_0x6791('0x10f')]);}})['then'](respondWithStatusCode(_0x521cae,null))[_0x6791('0xba')](handleError(_0x521cae,null));};exports[_0x6791('0x11b')]=function(_0x22dbd0,_0x1cc5c3){var _0x1d2613=moment()[_0x6791('0x11c')]()[_0x6791('0xa6')]();var _0x1d3607=path[_0x6791('0xea')](config[_0x6791('0xee')],_0x6791('0x11d'),_0x6791('0x11e'),_0x6791('0x11f'));var _0x3b3363=path[_0x6791('0xea')](config['root'],'server',_0x6791('0x11e'),_0x6791('0x120'));var _0x56d353=path[_0x6791('0xea')](_0x1d3607,_0x1d2613);var _0x481b70=util[_0x6791('0xf0')](_0x6791('0x121'),_0x22dbd0[_0x6791('0xbc')]['id'],_0x1d2613);var _0x1caa00=path[_0x6791('0xea')](_0x1d3607,_0x481b70);var _0x14d7e3=[];_0x14d7e3[_0x6791('0x42')]({'model':db[_0x6791('0x7d')],'as':_0x6791('0x7d'),'attributes':['id',_0x6791('0x3d')],'raw':!![]});_0x14d7e3[_0x6791('0x42')]({'model':db[_0x6791('0xf4')],'as':'Contact','attributes':['id',_0x6791('0x122'),_0x6791('0x123')],'raw':!![]});if(_0x22dbd0[_0x6791('0x4a')][_0x6791('0x120')]){_0x14d7e3[_0x6791('0x42')]({'model':db[_0x6791('0xe6')],'as':_0x6791('0xe6'),'raw':!![]});}var _0xb8d13a=[{'model':db[_0x6791('0xd7')],'as':_0x6791('0xf2'),'attributes':['id',_0x6791('0x38'),_0x6791('0x84'),_0x6791('0xff'),_0x6791('0x100'),_0x6791('0x124')],'include':_0x14d7e3}];_0xb8d13a[_0x6791('0x42')]({'model':db[_0x6791('0xf3')],'as':_0x6791('0x125'),'attributes':['id','name']});_0xb8d13a[_0x6791('0x42')]({'model':db['User'],'as':_0x6791('0x126'),'attributes':['id','fullname']});return db[_0x6791('0x44')][_0x6791('0x6d')]({'where':{'id':_0x22dbd0['params']['id']},'include':_0xb8d13a})[_0x6791('0x1f')](handleEntityNotFound(_0x1cc5c3,null))[_0x6791('0x1f')](function(_0x3c7b66){if(_0x3c7b66){var _0x3d7e1f=_0x3c7b66[_0x6791('0x127')]({'plain':!![]});fs[_0x6791('0x128')](_0x56d353);var _0x2e6bc5={'channel':_0x6791('0x129'),'account':_0x3d7e1f[_0x6791('0x125')][_0x6791('0x35')],'agent':_0x3d7e1f[_0x6791('0x126')]?_0x3d7e1f[_0x6791('0x126')][_0x6791('0x3d')]:_0x6791('0x12a'),'createdAt':moment(_0x3d7e1f[_0x6791('0x84')])[_0x6791('0xf0')](_0x6791('0x111'))[_0x6791('0xa6')](),'closedAt':_0x3d7e1f[_0x6791('0xde')]?moment(_0x3d7e1f[_0x6791('0x12b')])[_0x6791('0xf0')](_0x6791('0x111'))['toString']():'','disposition':_0x3d7e1f[_0x6791('0xdf')],'chatInfo':{'browser':_0x3d7e1f[_0x6791('0x12c')],'os':_0x3d7e1f[_0x6791('0x12d')],'referer':_0x3d7e1f[_0x6791('0x12e')],'customerIp':_0x3d7e1f[_0x6791('0x12f')],'customerPort':_0x3d7e1f[_0x6791('0x130')]?_0x3d7e1f[_0x6791('0x130')]:_0x6791('0x12a')},'messages':_(_0x3d7e1f[_0x6791('0xf2')])[_0x6791('0x131')]()[_0x6791('0x91')]({'secret':![]})[_0x6791('0x3c')](function(_0x449a9f){if(_0x449a9f[_0x6791('0xe6')]){var _0xc6d9ba=path[_0x6791('0xea')](_0x3b3363,_0x449a9f[_0x6791('0xe6')][_0x6791('0xe4')]);if(fs['existsSync'](_0xc6d9ba)){fs[_0x6791('0x132')](_0xc6d9ba)['pipe'](fs[_0x6791('0x133')](path['join'](_0x56d353,_0x449a9f[_0x6791('0xe6')][_0x6791('0xe4')])));}}return{'date':moment(_0x449a9f[_0x6791('0x84')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0x6791('0xa6')](),'sender':_0x449a9f[_0x6791('0xff')]===_0x6791('0x134')?_0x449a9f[_0x6791('0x7d')]?_0x449a9f['User'][_0x6791('0x3d')]:'System':_0x449a9f['Contact'][_0x6791('0x122')]+(_0x449a9f[_0x6791('0x72')][_0x6791('0x123')]?'\x20'+_0x449a9f[_0x6791('0x72')][_0x6791('0x123')]:''),'body':_0x449a9f[_0x6791('0xe6')]?_0x449a9f[_0x6791('0xe6')]['basename']:_0x449a9f[_0x6791('0x38')],'direction':_0x449a9f['direction']===_0x6791('0x134')?'A':'C','secret':_0x449a9f['secret'],'read':_0x449a9f[_0x6791('0x124')],'attachment':_0x449a9f[_0x6791('0xe6')]};})[_0x6791('0x6f')]()};return ejs['renderFile'](path[_0x6791('0xea')](config[_0x6791('0xee')],_0x6791('0x11d'),_0x6791('0x135'),_0x6791('0x136')),{'interaction':_0x2e6bc5})[_0x6791('0x1f')](function(_0x2946bd){var _0x4ede2f=path[_0x6791('0xea')](_0x56d353,_0x6791('0x137')+_0x3d7e1f['id']+'-'+_0x1d2613+_0x6791('0x138'));var _0x2a8d18={'path':_0x4ede2f,'channel':_0x6791('0x129'),'interactionId':_0x3d7e1f['id']};return pdf[_0x6791('0x139')](_0x2946bd,_0x2a8d18);})[_0x6791('0x1f')](function(){return new BPromise(function(_0x192f05,_0x1e661a){zipdir(_0x56d353,{'saveTo':_0x1caa00},function(_0x102182,_0x2f15a2){if(_0x102182)return _0x1e661a(_0x102182);return _0x192f05(_0x2f15a2);});})[_0x6791('0x1f')](function(){return new BPromise(function(_0x2aa871,_0x59376b){rimraf(_0x56d353,function(_0xefb45b){if(_0xefb45b)_0x59376b(_0xefb45b);return _0x2aa871();});});})[_0x6791('0x1f')](function(){return _0x1cc5c3['download'](_0x1caa00,_0x481b70,function(_0x4c3ef2){if(_0x4c3ef2){console[_0x6791('0x13a')](_0x6791('0x13b'),_0x4c3ef2);}else{fs[_0x6791('0x13c')](_0x1caa00);}});});});}else{return _0x1cc5c3[_0x6791('0x29')](0xc8);}})['catch'](handleError(_0x1cc5c3,null));}; \ No newline at end of file +var _0x757a=['u.id','u.fullname','user_has_chat_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','a.id\x20=\x20i.ChatWebsiteId','chat_messages','me.ChatInteractionId\x20=\x20i.id','chat_interaction_has_tags','it.ChatInteractionId\x20=\x20i.id','search','parseSearch','conditions','length','find','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','type','start','some','compact','isEmpty','ChatWebsiteId','i.ChatWebsiteId\x20IN\x20?','createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','Sequelize','QueryTypes','SELECT','clone','unreadMessages','contactName','DESC','t.id\x20IN\x20?','resolve','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','i.ChatWebsiteId\x20IS\x20NULL','sequelize','toString','keyBy','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','c.phone','Contact.phone','c.mobile','Contact.mobile','Owner.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','ChatInteractionId','all','show','params','rawAttributes','includeAll','include','options','create','findOne','ChatWebsite','vidaooApiKey','vidaooTopic','vidaooNote','vidaooMetadata','vidaooEscalation','fullname','email','https://api-vidaoo.xcally.com/api/v1/meetings','isNull','follow','metadata','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','Error\x20in\x20Vidaoo\x20configuration','join_url','out','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','customUpdate','CmContact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','UserId','Interaction\x20already\x20assigned','closed','AbandonInteraction','file','filename','mimetype','Attachment','attachmentDownload','Unauthorized','attachId','ChatOfflineMessageId','join','basename','server/files/chat/upload/','format','transcript-%s.txt','now','pathTranscript','Messages','%s%d','System','customer','Visitor','agentIdentifier','website_alias','agent_alias','alias','agent_fullname','agentAlias','[%s]\x20%s:\x20%s\x0a','MM/DD/YYYY\x20HH:mm:ss','direction','MailAccount','MailServerOut','Smtp','service','host','port','authentication','auth','pass','SendMail','sendMail','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','mailTranscript','addMessage','ids','omit','getMessages','$gte','findAll','getMyMessages','secret','includeAgent','addTags','setTags','color','emit','chatInteractionTags:save','removeTags','download','server','files','tmp','root','attachments','transcript-%d-%s.zip','firstName','Account','Owner','get','mkdirSync','Chat','N.A.','closedAt','YYYY-MM-DD\x20HH:mm:ss','browserName','osName','referer','customerIp','customerPort','tail','existsSync','createReadStream','pipe','createWriteStream','lastName','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','log','err','unlinkSync','rimraf','zip-dir','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/logger','redis','localhost','./chatInteraction.socket','register','jayson/promise','client','http','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','sendStatus','status','undefined','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','end','stack','name','send','render','merge','body','contact','agent','interaction','account','Users','map','TagIds','Tags','split','forEach','push','catch','index','ChatInteraction','fieldName','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','select','field','from','tools_tags'];(function(_0x189fe2,_0x1808c4){var _0x2077ef=function(_0x39750f){while(--_0x39750f){_0x189fe2['push'](_0x189fe2['shift']());}};_0x2077ef(++_0x1808c4);}(_0x757a,0xde));var _0xa757=function(_0x24e69a,_0x1ea080){_0x24e69a=_0x24e69a-0x0;var _0xdb7ce4=_0x757a[_0x24e69a];return _0xdb7ce4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa757('0x0'));var zipdir=require(_0xa757('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xa757('0x2'));var Mustache=require(_0xa757('0x3'));var util=require(_0xa757('0x4'));var path=require(_0xa757('0x5'));var sox=require(_0xa757('0x6'));var csv=require(_0xa757('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa757('0x8'));var _=require(_0xa757('0x9'));var squel=require('squel');var crypto=require(_0xa757('0xa'));var jsforce=require(_0xa757('0xb'));var deskjs=require(_0xa757('0xc'));var toCsv=require(_0xa757('0x7'));var querystring=require(_0xa757('0xd'));var Papa=require('papaparse');var Redis=require(_0xa757('0xe'));var authService=require(_0xa757('0xf'));var qs=require(_0xa757('0x10'));var as=require(_0xa757('0x11'));var pdf=require(_0xa757('0x12'));var hardwareService=require(_0xa757('0x13'));var logger=require(_0xa757('0x14'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xa757('0x15')]=_['defaults'](config['redis'],{'host':_0xa757('0x16'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xa757('0x17'))[_0xa757('0x18')](socket);var jayson=require(_0xa757('0x19'));var client=jayson[_0xa757('0x1a')][_0xa757('0x1b')]({'port':0x232b});var client9004=jayson[_0xa757('0x1a')][_0xa757('0x1b')]({'port':0x232c});function respondWithRpcPromise(_0x2f7947,_0x185011,_0x3df1f9,_0x50aac1){return new BPromise(function(_0x2e195b,_0x44eab8){var _0xde8248=_0x50aac1||client;return _0xde8248['request'](_0x2f7947,_0x3df1f9)['then'](function(_0x151c04){logger[_0xa757('0x1c')](_0xa757('0x1d'),_0x185011,_0xa757('0x1e'));logger[_0xa757('0x1f')](_0xa757('0x20'),_0x185011,'request\x20sent',JSON[_0xa757('0x21')](_0x151c04));if(_0x151c04['error']){if(_0x151c04[_0xa757('0x22')][_0xa757('0x23')]===0x1f4){logger[_0xa757('0x22')](_0xa757('0x1d'),_0x185011,_0x151c04['error']['message']);return _0x44eab8(_0x151c04[_0xa757('0x22')][_0xa757('0x24')]);}logger[_0xa757('0x22')](_0xa757('0x1d'),_0x185011,_0x151c04[_0xa757('0x22')][_0xa757('0x24')]);return _0x2e195b(_0x151c04[_0xa757('0x22')][_0xa757('0x24')]);}else{logger[_0xa757('0x1c')]('ChatInteraction,\x20%s,\x20%s',_0x185011,_0xa757('0x1e'));_0x2e195b(_0x151c04['result'][_0xa757('0x24')]);}})['catch'](function(_0x40551d){logger[_0xa757('0x22')](_0xa757('0x1d'),_0x185011,_0x40551d);_0x44eab8(_0x40551d);});});}function respondWithStatusCode(_0x4d58a4,_0x2b19d5){_0x2b19d5=_0x2b19d5||0xcc;return function(_0xcd98bd){if(_0xcd98bd){return _0x4d58a4[_0xa757('0x25')](_0x2b19d5);}return _0x4d58a4[_0xa757('0x26')](_0x2b19d5)['end']();};}function respondWithResult(_0x449a7d,_0x54263b){_0x54263b=_0x54263b||0xc8;return function(_0x5a5664){if(_0x5a5664){return _0x449a7d['status'](_0x54263b)['json'](_0x5a5664);}};}function respondWithFilteredResult(_0xfdf69d,_0x596ae2){return function(_0x2208f9){if(_0x2208f9){var _0x3bc24c=typeof _0x596ae2['offset']===_0xa757('0x27')&&typeof _0x596ae2['limit']===_0xa757('0x27');var _0xa6d0f6=_0x2208f9['count'];var _0x235e54=_0x3bc24c?0x0:_0x596ae2['offset'];var _0x3a4a66=_0x3bc24c?_0x2208f9[_0xa757('0x28')]:_0x596ae2[_0xa757('0x29')]+_0x596ae2[_0xa757('0x2a')];var _0xcc87c0;if(_0x3a4a66>=_0xa6d0f6){_0x3a4a66=_0xa6d0f6;_0xcc87c0=0xc8;}else{_0xcc87c0=0xce;}_0xfdf69d[_0xa757('0x26')](_0xcc87c0);return _0xfdf69d[_0xa757('0x2b')](_0xa757('0x2c'),_0x235e54+'-'+_0x3a4a66+'/'+_0xa6d0f6)[_0xa757('0x2d')](_0x2208f9);}return null;};}function patchUpdates(_0x384424){return function(_0x1f5d5a){try{jsonpatch[_0xa757('0x2e')](_0x1f5d5a,_0x384424,!![]);}catch(_0x25dfbb){return BPromise[_0xa757('0x2f')](_0x25dfbb);}return _0x1f5d5a[_0xa757('0x30')]();};}function saveUpdates(_0xc1cc20,_0x3e64b7){return function(_0x1ad384){if(_0x1ad384){return _0x1ad384[_0xa757('0x31')](_0xc1cc20)[_0xa757('0x32')](function(_0x3de18f){return _0x3de18f;});}return null;};}function removeEntity(_0x170aa9,_0x379de7){return function(_0x3aae1e){if(_0x3aae1e){return _0x3aae1e['destroy']()[_0xa757('0x32')](function(){_0x170aa9[_0xa757('0x26')](0xcc)[_0xa757('0x33')]();});}};}function handleEntityNotFound(_0x1794a9,_0x1c4c40){return function(_0x51e2aa){if(!_0x51e2aa){_0x1794a9[_0xa757('0x25')](0x194);}return _0x51e2aa;};}function handleError(_0x2af470,_0x37b1a3){_0x37b1a3=_0x37b1a3||0x1f4;return function(_0x2c34b1){logger[_0xa757('0x22')](_0x2c34b1[_0xa757('0x34')]);if(_0x2c34b1['name']){delete _0x2c34b1[_0xa757('0x35')];}_0x2af470[_0xa757('0x26')](_0x37b1a3)[_0xa757('0x36')](_0x2c34b1);};}function getMustacheRender(_0xc34409,_0x3b5104){return Mustache[_0xa757('0x37')](_0xc34409,_[_0xa757('0x38')](_0x3b5104[_0xa757('0x39')],{'contact':_0x3b5104[_0xa757('0x3a')],'message':_0x3b5104['message'],'agent':_0x3b5104[_0xa757('0x3b')],'interaction':_0x3b5104[_0xa757('0x3c')],'account':_0x3b5104[_0xa757('0x3d')]}))||'';}function getInteractionUsers(_0x35c15a,_0x2531be){return new BPromise(function(_0x2fd99e,_0x501e26){try{if(_0x2531be[_0x35c15a['id']]){_0x35c15a[_0xa757('0x3e')]=_[_0xa757('0x3f')](_0x2531be[_0x35c15a['id']],function(_0x48cde9){return{'id':_0x48cde9['id'],'fullname':_0x48cde9['fullname']};});}}catch(_0x9607af){_0x501e26(_0x9607af);}_0x2fd99e(_0x35c15a);});}function getInteractionTags(_0x6193bf,_0x5b11fe){return new BPromise(function(_0x51c3d1,_0xcff7c4){try{if(_0x6193bf[_0xa757('0x40')]){_0x6193bf[_0xa757('0x41')]=[];_0x6193bf['TagIds'][_0xa757('0x42')](',')[_0xa757('0x43')](function(_0x26802c){_0x6193bf[_0xa757('0x41')][_0xa757('0x44')](_0x5b11fe[_0x26802c]);});}delete _0x6193bf['TagIds'];}catch(_0x1f9af){_0xcff7c4(_0x1f9af);}_0x51c3d1(_0x6193bf);});}function updateChatInteraction(_0x52c728,_0x564d40,_0x43329c){return new BPromise(function(_0x57298b,_0x373747){return getInteractionUsers(_0x52c728,_0x43329c)[_0xa757('0x32')](function(_0x9a0934){return getInteractionTags(_0x9a0934,_0x564d40);})['then'](function(_0x5d25bb){_0x57298b(_0x5d25bb);})[_0xa757('0x45')](function(_0x129d77){_0x373747(_0x129d77);});});}exports[_0xa757('0x46')]=function(_0xe03a3c,_0xc063db){var _0x3db5d5={},_0x4f12b1={},_0xd61628={'count':0x0,'rows':[]};var _0x364998=_['map'](db[_0xa757('0x47')]['rawAttributes'],function(_0x2d111e){return{'name':_0x2d111e[_0xa757('0x48')],'type':_0x2d111e['type'][_0xa757('0x49')]};});_0x4f12b1[_0xa757('0x4a')]=_['map'](_0x364998,_0xa757('0x35'));_0x4f12b1[_0xa757('0x4b')]=_[_0xa757('0x4c')](_0xe03a3c[_0xa757('0x4b')]);_0x4f12b1['filters']=_[_0xa757('0x4d')](_0x4f12b1[_0xa757('0x4a')],_0x4f12b1[_0xa757('0x4b')]);_0x3db5d5[_0xa757('0x4e')]=_['intersection'](_0x4f12b1[_0xa757('0x4a')],qs['fields'](_0xe03a3c['query'][_0xa757('0x4f')]));_0x3db5d5[_0xa757('0x4e')]=_0x3db5d5[_0xa757('0x4e')]['length']?_0x3db5d5[_0xa757('0x4e')]:_0x4f12b1['model'];if(!_0xe03a3c[_0xa757('0x4b')][_0xa757('0x50')](_0xa757('0x51'))){_0x3db5d5[_0xa757('0x2a')]=qs[_0xa757('0x2a')](_0xe03a3c[_0xa757('0x4b')][_0xa757('0x2a')]);_0x3db5d5[_0xa757('0x29')]=qs['offset'](_0xe03a3c[_0xa757('0x4b')][_0xa757('0x29')]);}_0x3db5d5[_0xa757('0x52')]=qs[_0xa757('0x53')](_0xe03a3c[_0xa757('0x4b')][_0xa757('0x53')]);_0x3db5d5[_0xa757('0x54')]=qs[_0xa757('0x55')](_[_0xa757('0x56')](_0xe03a3c[_0xa757('0x4b')],_0x4f12b1[_0xa757('0x55')]),_0x364998);var _0x19ceef=[];var _0x2367c7=squel[_0xa757('0x57')]()[_0xa757('0x58')]('id')[_0xa757('0x58')]('name')[_0xa757('0x58')]('color')[_0xa757('0x59')](_0xa757('0x5a'));var _0xa89d24=squel[_0xa757('0x57')]()['field'](_0xa757('0x5b'))[_0xa757('0x58')](_0xa757('0x5c'))[_0xa757('0x58')]('ui.ChatInteractionId')[_0xa757('0x59')](_0xa757('0x5d'),'ui')[_0xa757('0x5e')](_0xa757('0x5f'),'u',_0xa757('0x60'));var _0x291b26=squel['select']()['from']('chat_interactions','i')['left_join'](_0xa757('0x61'),'c',_0xa757('0x62'))[_0xa757('0x5e')](_0xa757('0x5f'),'o',_0xa757('0x63'))[_0xa757('0x5e')]('chat_websites','a',_0xa757('0x64'))[_0xa757('0x5e')](_0xa757('0x65'),'me',_0xa757('0x66'))['left_join'](_0xa757('0x67'),'it',_0xa757('0x68'))['left_join'](_0xa757('0x5a'),'t','t.id\x20=\x20it.TagId');var _0x211980=squel['expr']();var _0x51be6e=[];var _0x58633a=squel['expr']();var _0x367b48;if(_0xe03a3c[_0xa757('0x4b')][_0xa757('0x69')]){_0x367b48=as[_0xa757('0x6a')](_0xe03a3c[_0xa757('0x4b')][_0xa757('0x69')]);var _0x4c19a6=_0x367b48['sqlOperator'];for(var _0x201557=0x0;_0x201557<_0x367b48[_0xa757('0x6b')][_0xa757('0x6c')];_0x201557++){var _0x4a5ad5=_0x367b48['conditions'][_0x201557];var _0x18dff7='i';var _0x31c4cd=_[_0xa757('0x6d')](_0x364998,[_0xa757('0x35'),_0x4a5ad5[_0xa757('0x58')]]);if(!_0x31c4cd){switch(_0x4a5ad5[_0xa757('0x58')]){case'unreadMessages':if(_0x4a5ad5[_0xa757('0x6e')]==0x1){_0x291b26[_0xa757('0x6f')]('`'+_0x4a5ad5[_0xa757('0x58')]+_0xa757('0x70'));}else{_0x291b26[_0xa757('0x6f')]('`'+_0x4a5ad5[_0xa757('0x58')]+_0xa757('0x71'));}break;case _0xa757('0x72'):if(_0x4a5ad5[_0xa757('0x73')]===_0xa757('0x74')){if(_0x4a5ad5['value'][_0xa757('0x42')]('\x20')['length']>0x1){_0x211980[_0x4c19a6]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xa757('0x75')](_0x4a5ad5[_0xa757('0x6e')]),null);}else{var _0x432856='%'+_0x4a5ad5[_0xa757('0x6e')]+'%';_0x211980[_0x4c19a6](_0xa757('0x76'),_0x432856,_0x432856,_0x432856);}}else{_0x31c4cd=_[_0xa757('0x6d')](_0x364998,[_0xa757('0x35'),_0xa757('0x77')]);_0x4a5ad5[_0xa757('0x58')]=_0xa757('0x77');_0x423f3a=as[_0xa757('0x78')](_0x18dff7,_0x31c4cd['type'],_0x4a5ad5);_0x211980[_0x4c19a6](_0x423f3a[_0xa757('0x79')],_0x423f3a[_0xa757('0x6e')]['start'],_0x423f3a[_0xa757('0x6e')][_0xa757('0x33')]);}break;case _0xa757('0x7a'):var _0x180cec=_0x4a5ad5[_0xa757('0x6e')][_0xa757('0x42')](',')['map'](function(_0x413217){return Number(_0x413217);});_0x180cec['forEach'](function(_0xee5b78){_0x58633a['or'](_0xa757('0x7b'),'%,'+_0xee5b78+',%');});_0x51be6e=_[_0xa757('0x7c')](_0x51be6e,_0x180cec);break;case _0xa757('0x7d'):if(_0x4a5ad5[_0xa757('0x73')]==='$substring'){_0x211980[_0x4c19a6]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x4a5ad5[_0xa757('0x6e')]+'%',null);}else{_0x31c4cd=_[_0xa757('0x6d')](_0x364998,[_0xa757('0x35'),'UserId']);_0x4a5ad5[_0xa757('0x58')]='UserId';_0x423f3a=as[_0xa757('0x78')](_0x18dff7,_0x31c4cd[_0xa757('0x7e')],_0x4a5ad5);_0x211980[_0x4c19a6](_0x423f3a[_0xa757('0x79')],_0x423f3a[_0xa757('0x6e')][_0xa757('0x7f')],_0x423f3a[_0xa757('0x6e')]['end']);}break;case _0xa757('0x39'):_0x423f3a=as[_0xa757('0x78')]('me',null,_0x4a5ad5);_0x211980[_0x4c19a6](_0x423f3a[_0xa757('0x79')],_0x423f3a[_0xa757('0x6e')][_0xa757('0x7f')],_0x423f3a['value'][_0xa757('0x33')]);break;}}else{var _0x423f3a=as[_0xa757('0x78')](_0x18dff7,_0x31c4cd[_0xa757('0x7e')],_0x4a5ad5);_0x211980[_0x4c19a6](_0x423f3a[_0xa757('0x79')],_0x423f3a['value'][_0xa757('0x7f')],_0x423f3a[_0xa757('0x6e')][_0xa757('0x33')]);}}}else{var _0x529298=_(_0xe03a3c[_0xa757('0x4b')])[_0xa757('0x4c')]()[_0xa757('0x3f')](function(_0x60f518){return _[_0xa757('0x80')](_0x364998,[_0xa757('0x35'),_0x60f518])?_0x60f518:undefined;})[_0xa757('0x81')]()[_0xa757('0x6e')]();if(!_[_0xa757('0x82')](_0x529298)){_0x529298[_0xa757('0x43')](function(_0x1a868d){if(_0x1a868d===_0xa757('0x83')){_0x291b26[_0xa757('0x54')](_0xa757('0x84'),[]['concat'](_0xe03a3c[_0xa757('0x4b')][_0x1a868d]));}else if(_0x1a868d===_0xa757('0x85')){var _0x532ab5=JSON[_0xa757('0x86')](_0xe03a3c[_0xa757('0x4b')][_0x1a868d])['$gte'];var _0x29aea2=JSON[_0xa757('0x86')](_0xe03a3c[_0xa757('0x4b')][_0x1a868d])[_0xa757('0x87')];_0x291b26[_0xa757('0x54')](_0xa757('0x88'),_0x532ab5,_0x29aea2);}else{if(_0xe03a3c[_0xa757('0x4b')][_0x1a868d]===_0xa757('0x89')){_0x291b26[_0xa757('0x54')]('i.'+_0x1a868d+_0xa757('0x8a'));}else{_0x291b26[_0xa757('0x54')]('i.'+_0x1a868d+_0xa757('0x8b'),_0xe03a3c[_0xa757('0x4b')][_0x1a868d]);}}});}if(_0xe03a3c[_0xa757('0x4b')][_0xa757('0x8c')]){if(_0xe03a3c[_0xa757('0x4b')]['read']==0x1){_0x291b26[_0xa757('0x6f')]('`unreadMessages`\x20=\x200');}else{_0x291b26[_0xa757('0x6f')](_0xa757('0x8d'));}}if(_0xe03a3c[_0xa757('0x4b')][_0xa757('0x8e')]){_0x51be6e=_[_0xa757('0x8f')](_0xe03a3c['query'][_0xa757('0x8e')])?_0xe03a3c[_0xa757('0x4b')][_0xa757('0x8e')]:new Array(_0xe03a3c['query'][_0xa757('0x8e')]);_0x51be6e[_0xa757('0x43')](function(_0x2c05d5){_0x58633a['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x2c05d5+',%');});}if(_0xe03a3c['query'][_0xa757('0x90')]){var _0x351e0e=_0xe03a3c[_0xa757('0x4b')]['filter'][_0xa757('0x91')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs['isNumeric'](_0x351e0e)){_0x211980['or'](_0xa757('0x92'),_0x351e0e+'%');}else{_0x211980['or'](_0xa757('0x93'),qs[_0xa757('0x75')](_0x351e0e))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x351e0e+'%');}}}_0x291b26[_0xa757('0x54')](_0x211980);_0x291b26[_0xa757('0x94')](_0xa757('0x95'));var _0x199f75={'type':db[_0xa757('0x96')][_0xa757('0x97')][_0xa757('0x98')],'raw':!![]};var _0x44c681=_0x291b26[_0xa757('0x99')]();_0x44c681[_0xa757('0x58')](_0xa757('0x95'));_0x44c681[_0xa757('0x58')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xa757('0x9a'));if(_0x3db5d5[_0xa757('0x52')]){_0x3db5d5[_0xa757('0x52')][_0xa757('0x43')](function(_0x1a46d6){var _0x7440f6=_0x1a46d6[0x0]===_0xa757('0x9b')?_0x1a46d6[0x0]:'i.'+_0x1a46d6[0x0];_0x291b26[_0xa757('0x52')](_0x7440f6,_0x1a46d6[0x1]===_0xa757('0x9c')?![]:!![]);});}if(!_[_0xa757('0x82')](_0x51be6e)){_0x291b26[_0xa757('0x6f')](_0x58633a);_0x44c681[_0xa757('0x54')](_0xa757('0x9d'),_0x51be6e);}BPromise[_0xa757('0x9e')]()[_0xa757('0x32')](function(){if(!_0x367b48){if(_0xe03a3c[_0xa757('0x4b')][_0xa757('0x83')])return;_0x44c681[_0xa757('0x54')](_0xa757('0x9f'));_0x291b26[_0xa757('0x54')](_0xa757('0x9f'));return;}if(_0xe03a3c[_0xa757('0xa0')]['role']!==_0xa757('0x3b'))return;return _0xe03a3c[_0xa757('0xa0')]['getChatWebsites']({'attributes':['id'],'raw':!![]})[_0xa757('0x32')](function(_0x4c4b1a){if(_[_0xa757('0x82')](_0x4c4b1a)){_0x44c681[_0xa757('0x54')]('i.ChatWebsiteId\x20IS\x20NULL');_0x291b26[_0xa757('0x54')](_0xa757('0xa1'));}else{_0x44c681[_0xa757('0x54')](_0xa757('0x84'),_['map'](_0x4c4b1a,'id'));_0x291b26[_0xa757('0x54')](_0xa757('0x84'),_['map'](_0x4c4b1a,'id'));}});})[_0xa757('0x32')](function(){if(_0xe03a3c[_0xa757('0xa0')]['role']===_0xa757('0x3b')&&!_0x367b48&&!_0xe03a3c[_0xa757('0x4b')][_0xa757('0x83')])return[];return db[_0xa757('0xa2')][_0xa757('0x4b')](_0x44c681[_0xa757('0xa3')](),_0x199f75);})[_0xa757('0x32')](function(_0x2d6405){_0xd61628[_0xa757('0x28')]=_0x2d6405['length'];if(_0xd61628['count']===0x0)return[];return db[_0xa757('0xa2')][_0xa757('0x4b')](_0x2367c7[_0xa757('0xa3')](),_0x199f75)[_0xa757('0x32')](function(_0x38d0f8){_0x19ceef=_[_0xa757('0xa4')](_0x38d0f8,'id');_0x199f75=_[_0xa757('0x38')](_0x199f75,{'model':db['ChatInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0xe03a3c[_0xa757('0x4b')]['fields']){_0x3db5d5[_0xa757('0x4e')][_0xa757('0x43')](function(_0x365a0d){_0x291b26[_0xa757('0x58')]('i.'+_0x365a0d);});}else{_0x291b26[_0xa757('0x58')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xa757('0x9a'));_0x291b26['field'](_0xa757('0xa5'),_0xa757('0xa6'));_0x291b26[_0xa757('0x58')](_0xa757('0xa7'),'Account.mandatoryDisposition');_0x291b26[_0xa757('0x58')](_0xa757('0xa8'),_0xa757('0x9b'));_0x291b26[_0xa757('0x58')](_0xa757('0xa9'));_0x291b26[_0xa757('0x58')](_0xa757('0xaa'),_0xa757('0xab'));_0x291b26['field'](_0xa757('0xac'),_0xa757('0xad'));_0x291b26[_0xa757('0x58')](_0xa757('0xae'),'Contact.email');_0x291b26[_0xa757('0x58')](_0xa757('0xaf'),_0xa757('0xb0'));_0x291b26[_0xa757('0x58')](_0xa757('0xb1'),_0xa757('0xb2'));_0x291b26[_0xa757('0x58')]('c.fax','Contact.fax');_0x291b26[_0xa757('0x58')]('o.fullname',_0xa757('0xb3'));_0x291b26['field']('o.internal',_0xa757('0xb4'));_0x291b26[_0xa757('0x58')](_0xa757('0xb5'),_0xa757('0x40'));}if(_0x3db5d5[_0xa757('0x2a')])_0x291b26[_0xa757('0x2a')](_0x3db5d5[_0xa757('0x2a')]);if(_0x3db5d5[_0xa757('0x29')])_0x291b26[_0xa757('0x29')](_0x3db5d5[_0xa757('0x29')]);return db['sequelize'][_0xa757('0x4b')](_0x291b26['toString'](),_0x199f75);})[_0xa757('0x32')](function(_0x4e7280){if(_0x4e7280[_0xa757('0x6c')]>0x0)_0xa89d24[_0xa757('0x54')]('ui.ChatInteractionId\x20IN\x20?',_[_0xa757('0x3f')](_0x4e7280,'id'));return db[_0xa757('0xa2')][_0xa757('0x4b')](_0xa89d24[_0xa757('0xa3')](),_0x199f75)[_0xa757('0x32')](function(_0x162ff6){var _0x1c789c=_[_0xa757('0xb6')](_0x162ff6,_0xa757('0xb7'));var _0x358268=[];_0x4e7280[_0xa757('0x43')](function(_0x204489){_0x358268[_0xa757('0x44')](updateChatInteraction(_0x204489,_0x19ceef,_0x1c789c));});return BPromise[_0xa757('0xb8')](_0x358268);});});})[_0xa757('0x32')](function(_0x56a060){_0xd61628['rows']=_0x56a060;return _0xd61628;})[_0xa757('0x32')](respondWithFilteredResult(_0xc063db,_0x3db5d5))['catch'](handleError(_0xc063db,null));};exports[_0xa757('0xb9')]=function(_0x3404f1,_0x2edad2){var _0x1d03a7={'raw':![],'where':{'id':_0x3404f1[_0xa757('0xba')]['id']}},_0x48c52f={};_0x48c52f[_0xa757('0x4a')]=_[_0xa757('0x4c')](db[_0xa757('0x47')][_0xa757('0xbb')]);_0x48c52f[_0xa757('0x4b')]=_['keys'](_0x3404f1[_0xa757('0x4b')]);_0x48c52f[_0xa757('0x55')]=_[_0xa757('0x4d')](_0x48c52f[_0xa757('0x4a')],_0x48c52f[_0xa757('0x4b')]);_0x1d03a7['attributes']=_['intersection'](_0x48c52f[_0xa757('0x4a')],qs['fields'](_0x3404f1[_0xa757('0x4b')]['fields']));_0x1d03a7[_0xa757('0x4e')]=_0x1d03a7[_0xa757('0x4e')][_0xa757('0x6c')]?_0x1d03a7[_0xa757('0x4e')]:_0x48c52f[_0xa757('0x4a')];if(_0x3404f1[_0xa757('0x4b')][_0xa757('0xbc')]){_0x1d03a7[_0xa757('0xbd')]=[{'all':!![]}];}_0x1d03a7=_[_0xa757('0x38')]({},_0x1d03a7,_0x3404f1[_0xa757('0xbe')]);return db[_0xa757('0x47')]['find'](_0x1d03a7)[_0xa757('0x32')](handleEntityNotFound(_0x2edad2,null))[_0xa757('0x32')](respondWithResult(_0x2edad2,null))[_0xa757('0x45')](handleError(_0x2edad2,null));};exports[_0xa757('0xbf')]=function(_0x1f308f,_0x1ea6d7){return db['ChatInteraction'][_0xa757('0xbf')](_0x1f308f[_0xa757('0x39')],{})['then'](respondWithResult(_0x1ea6d7,0xc9))[_0xa757('0x45')](handleError(_0x1ea6d7,null));};exports[_0xa757('0x31')]=function(_0x1f4782,_0x5e6171){if(_0x1f4782[_0xa757('0x39')]['id']){delete _0x1f4782[_0xa757('0x39')]['id'];}return db[_0xa757('0x47')][_0xa757('0x6d')]({'where':{'id':_0x1f4782[_0xa757('0xba')]['id']}})['then'](handleEntityNotFound(_0x5e6171,null))[_0xa757('0x32')](saveUpdates(_0x1f4782['body'],null))['then'](respondWithResult(_0x5e6171,null))[_0xa757('0x45')](handleError(_0x5e6171,null));};exports['destroy']=function(_0x5d9102,_0x44023e){return db[_0xa757('0x47')][_0xa757('0x6d')]({'where':{'id':_0x5d9102[_0xa757('0xba')]['id']}})[_0xa757('0x32')](handleEntityNotFound(_0x44023e,null))[_0xa757('0x32')](removeEntity(_0x44023e,null))['catch'](handleError(_0x44023e,null));};exports['describe']=function(_0x556b78,_0x4b4a87){return db['ChatInteraction']['describe']()['then'](respondWithResult(_0x4b4a87,null))[_0xa757('0x45')](handleError(_0x4b4a87,null));};exports['createVidaooSession']=function(_0x1ba0df,_0xccb91e){var _0x146305=_0x1ba0df[_0xa757('0xba')]['id'];var _0x46fd6b;var _0xc0a523;var _0x399952;return db[_0xa757('0x47')][_0xa757('0xc0')]({'where':{'id':_0x146305}})['then'](function(_0x4dd40a){_0x46fd6b=_0x4dd40a;return db[_0xa757('0xc1')][_0xa757('0xc0')]({'where':{'id':_0x4dd40a[_0xa757('0x83')]},'attributes':['id',_0xa757('0xc2'),'vidaooEscalation',_0xa757('0xc3'),_0xa757('0xc4'),_0xa757('0xc5')],'raw':!![]});})[_0xa757('0x32')](function(_0x30c170){if(_0x30c170&&_0x30c170[_0xa757('0xc2')]&&_0x30c170[_0xa757('0xc6')]){_0xc0a523=_0x30c170;var _0x4e552d={'interaction':{'id':_0x146305},'agent':{'id':_0x1ba0df[_0xa757('0xa0')]['id'],'name':_0x1ba0df[_0xa757('0xa0')]['name'],'fullname':_0x1ba0df[_0xa757('0xa0')][_0xa757('0xc7')],'email':_0x1ba0df[_0xa757('0xa0')][_0xa757('0xc8')]},'contact':_0x1ba0df[_0xa757('0x39')]['contact'],'account':_0x1ba0df[_0xa757('0x39')][_0xa757('0x3d')]};var _0x3d031d={'rejectUnauthorized':![],'method':'POST','url':_0xa757('0xc9'),'headers':{'X-APIKEY':_0x30c170[_0xa757('0xc2')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x1ba0df[_0xa757('0xa0')]['email']],'buttons':null,'topic':_0xc0a523[_0xa757('0xc3')],'note':_[_0xa757('0xca')](_0xc0a523[_0xa757('0xc4')])?null:getMustacheRender(_0xc0a523[_0xa757('0xc4')],_0x4e552d),'metadata':null},'redirect':_0xa757('0xcb'),'json':!![]};try{if(!_['isNull'](_0xc0a523[_0xa757('0xc5')])){var _0x4b440e=getMustacheRender(_0xc0a523['vidaooMetadata'],_0x4e552d);var _0x6e9075=JSON[_0xa757('0x86')](_0x4b440e);_0x3d031d[_0xa757('0x39')][_0xa757('0xcc')]=_0x6e9075;}}catch(_0x4d3423){throw new db[(_0xa757('0x96'))][(_0xa757('0xcd'))](_0xa757('0xce'));}return rp(_0x3d031d);}else{throw new db[(_0xa757('0x96'))][(_0xa757('0xcd'))](_0xa757('0xcf'));}})[_0xa757('0x32')](function(_0xad41e1){_0x399952=_0xad41e1;if(_0x399952['id']){var _0x564db3={'body':_0x399952[_0xa757('0xd0')],'ChatWebsiteId':_0xc0a523['id'],'ChatInteractionId':_0x46fd6b['id'],'direction':_0xa757('0xd1'),'UserId':_0x1ba0df[_0xa757('0xa0')]['id']};return db[_0xa757('0xd2')][_0xa757('0xbf')](_0x564db3,{});}else{throw new db[(_0xa757('0x96'))][(_0xa757('0xcd'))](_0xa757('0xd3'));}})[_0xa757('0x32')](function(){return _0x46fd6b['updateAttributes']({'vidaooSessionId':_0x399952['id']});})['then'](respondWithResult(_0xccb91e,null))[_0xa757('0x45')](handleError(_0xccb91e,null));};exports[_0xa757('0xd4')]=function(_0x542faf,_0x3e7174){if(_0x542faf['body']['id']){delete _0x542faf[_0xa757('0x39')]['id'];}return db[_0xa757('0x47')][_0xa757('0x6d')]({'where':{'id':_0x542faf[_0xa757('0xba')]['id']},'include':[{'model':db[_0xa757('0xd5')],'as':_0xa757('0x72')}]})[_0xa757('0x32')](handleEntityNotFound(_0x3e7174,null))[_0xa757('0x32')](saveUpdates(_0x542faf[_0xa757('0x39')],null))['then'](respondWithResult(_0x3e7174,null))[_0xa757('0x45')](handleError(_0x3e7174,null));};exports[_0xa757('0xd6')]=function(_0x4a7a69,_0xea878b,_0x434c4b){if(_0x4a7a69[_0xa757('0x39')]['id']){delete _0x4a7a69[_0xa757('0x39')]['id'];}return db[_0xa757('0x47')][_0xa757('0x6d')]({'where':{'id':_0x4a7a69[_0xa757('0xba')]['id']}})[_0xa757('0x32')](function(_0x2ea80d){if(!_0x2ea80d){logger[_0xa757('0x22')](_0xa757('0xd7'),_0xa757('0xd6'),0x194,'entity\x20not\x20found');_0xea878b[_0xa757('0x25')](0x194);}else{if(_0x2ea80d[_0xa757('0xd8')]){throw new db['Sequelize'][(_0xa757('0xcd'))](_0xa757('0xd9'));}}return _0x2ea80d;})['then'](function(_0x124eff){if(_0x124eff){return _0x124eff[_0xa757('0x31')]({'closed':_0x4a7a69[_0xa757('0x39')][_0xa757('0xda')],'disposition':_0x4a7a69['body']['disposition']})[_0xa757('0x32')](function(_0x48a9d0){return _0x48a9d0;});}})[_0xa757('0x32')](function(_0x551930){return respondWithRpcPromise(_0xa757('0xdb'),_0xa757('0xd6'),_0x4a7a69[_0xa757('0x39')],client9004);})[_0xa757('0x32')](respondWithResult(_0xea878b,null))[_0xa757('0x45')](handleError(_0xea878b,null));};exports['attachmentUpload']=function(_0x54385d,_0xa77319,_0x7c238d){_0x54385d[_0xa757('0x39')][_0xa757('0x35')]=_0x54385d['file']['originalname'];_0x54385d[_0xa757('0x39')]['basename']=_0x54385d[_0xa757('0xdc')][_0xa757('0xdd')];_0x54385d[_0xa757('0x39')][_0xa757('0x7e')]=_0x54385d[_0xa757('0xdc')][_0xa757('0xde')];return db[_0xa757('0xdf')]['create'](_0x54385d[_0xa757('0x39')])[_0xa757('0x32')](respondWithResult(_0xa77319,0xc9))[_0xa757('0x45')](handleError(_0xa77319,null));};exports[_0xa757('0xe0')]=function(_0x177db5,_0x1f678e,_0x377663){return db['ChatInteraction']['findOne']({'where':{'id':_0x177db5[_0xa757('0xba')]['id']},'raw':!![]})[_0xa757('0x32')](handleEntityNotFound(_0x1f678e,null))[_0xa757('0x32')](function(_0x54da87){if(_0x54da87){if(_0x54da87[_0xa757('0xda')]){return _0x1f678e[_0xa757('0x26')](0x193)['json']({'status':0x193,'message':_0xa757('0xe1')});}return db['Attachment'][_0xa757('0xc0')]({'where':{'id':_0x177db5[_0xa757('0x4b')][_0xa757('0xe2')]},'raw':!![]})[_0xa757('0x32')](handleEntityNotFound(_0x1f678e,null));}})[_0xa757('0x32')](function(_0x1b4e62){if(_0x1b4e62){var _0x42e409=_0x1b4e62[_0xa757('0xe3')]!==null;var _0x19f834=path[_0xa757('0xe4')](config['root'],'server/files/attachments/');if(_0x42e409){_0x19f834=path[_0xa757('0xe4')](_0x19f834,'offline-chat/');}var _0x4bd0a6=path[_0xa757('0xe4')](_0x19f834,_0x1b4e62[_0xa757('0xe5')]);return _0x1f678e['download'](_0x4bd0a6);}})[_0xa757('0x45')](handleError(_0x1f678e,null));};exports['close']=function(_0x334f77,_0x45dc56){var _0x2fe93c=null;var _0x101410=null;var _0x2cc39e=null;var _0x1aa70d=null;if(_0x334f77[_0xa757('0x39')]['id']){delete _0x334f77[_0xa757('0x39')]['id'];}if(_0x334f77['body']['mailTranscript']){_0x1aa70d=path[_0xa757('0xe4')](config['root'],_0xa757('0xe6'),util[_0xa757('0xe7')](_0xa757('0xe8'),Date[_0xa757('0xe9')]()));_0x334f77[_0xa757('0x39')][_0xa757('0xea')]=_0x1aa70d;}return db[_0xa757('0x47')][_0xa757('0x6d')]({'where':{'id':_0x334f77['params']['id']},'include':[{'model':db[_0xa757('0xd2')],'as':'Messages','include':[{'model':db['User'],'as':_0xa757('0x7d')}]}]})[_0xa757('0x32')](handleEntityNotFound(_0x45dc56,null))[_0xa757('0x32')](saveUpdates(_0x334f77[_0xa757('0x39')],null))['then'](function(_0xce5af4){if(_0xce5af4){_0x2fe93c=_0xce5af4;return db['ChatWebsite'][_0xa757('0x6d')]({'where':{'id':_0x2fe93c['ChatWebsiteId']}});}})[_0xa757('0x32')](function(_0x3e9009){if(_0x3e9009){_0x2cc39e=_0x3e9009;return db['CmContact'][_0xa757('0x6d')]({'where':{'id':_0x2fe93c[_0xa757('0x77')]}});}})['then'](function(_0x2a5b41){if(_0x2a5b41){_0x101410=_0x2a5b41;if(_0x1aa70d){var _0x1ec56a=null;for(var _0xa09d83=0x1;_0xa09d83<_0x2fe93c[_0xa757('0xeb')][_0xa757('0x6c')];++_0xa09d83){_0x1ec56a=_0x2fe93c[_0xa757('0xeb')][_0xa09d83];var _0x2439f9=_0x1ec56a['UserId']?util[_0xa757('0xe7')](_0xa757('0xec'),_0x2cc39e['agentAlias'],_0x1ec56a['UserId']):_0xa757('0xed');var _0x30f2da=_0x334f77[_0xa757('0x39')][_0xa757('0xee')]||util[_0xa757('0xe7')](_0xa757('0xec'),_0xa757('0xef'),_0x1ec56a[_0xa757('0x77')]);switch(_0x2cc39e[_0xa757('0xf0')]){case _0xa757('0xf1'):_0x2439f9=_0x1ec56a[_0xa757('0xd8')]?util[_0xa757('0xe7')](_0xa757('0xec'),_0x2cc39e['agentAlias'],_0x1ec56a[_0xa757('0xd8')]):_0xa757('0xed');break;case _0xa757('0xf2'):_0x2439f9=_0x1ec56a['UserId']?_0x1ec56a['User'][_0xa757('0xf3')]||_0x1ec56a[_0xa757('0x7d')]['fullname']:_0xa757('0xed');break;case _0xa757('0xf4'):_0x2439f9=_0x1ec56a['UserId']?_0x1ec56a[_0xa757('0x7d')]['fullname']:_0xa757('0xed');break;default:_0x2439f9=_0x1ec56a[_0xa757('0xd8')]?util[_0xa757('0xe7')](_0xa757('0xec'),_0x2cc39e[_0xa757('0xf5')],_0x1ec56a[_0xa757('0xd8')]):_0xa757('0xed');}var _0x69af1f=util['format'](_0xa757('0xf6'),moment(_0x1ec56a['createdAt'])['format'](_0xa757('0xf7')),_0x1ec56a[_0xa757('0xf8')]==='in'?_0x30f2da:_0x2439f9,_0x1ec56a['body']);if(!_0x1ec56a['secret']){fs['appendFileSync'](_0x1aa70d,_0x69af1f);}}return db[_0xa757('0xf9')][_0xa757('0xc0')]({'where':{'service':!![]},'include':[{'model':db[_0xa757('0xfa')],'as':'Smtp','raw':!![]}]});}}})[_0xa757('0x32')](function(_0x2e76e5){if(_0x2e76e5&&_0x2e76e5[_0xa757('0xfb')]&&_0x334f77[_0xa757('0x39')]){var _0x1caccc={'tls':{'rejectUnauthorized':![]}};if(_0x2e76e5[_0xa757('0xfb')][_0xa757('0xfc')]){_0x1caccc[_0xa757('0xfc')]=_0x2e76e5['Smtp'][_0xa757('0xfc')];}else{_0x1caccc['host']=_0x2e76e5[_0xa757('0xfb')][_0xa757('0xfd')];_0x1caccc[_0xa757('0xfe')]=_0x2e76e5[_0xa757('0xfb')][_0xa757('0xfe')];_0x1caccc['secure']=_0x2e76e5[_0xa757('0xfb')]['secure'];}if(_0x2e76e5[_0xa757('0xfb')][_0xa757('0xff')]){_0x1caccc[_0xa757('0x100')]={'user':_0x2e76e5[_0xa757('0xfb')][_0xa757('0xa0')],'pass':_0x2e76e5[_0xa757('0xfb')][_0xa757('0x101')]};}return respondWithRpcPromise(_0xa757('0x102'),_0xa757('0x103'),{'account':_0x1caccc,'message':{'from':util['format']('\x22%s\x22\x20<%s>',_0x2e76e5[_0xa757('0x35')],_0x2e76e5[_0xa757('0xc8')]||_0x2e76e5['Smtp'][_0xa757('0xa0')]),'to':_0x334f77[_0xa757('0x39')]['mailTranscript'],'subject':_0xa757('0x104'),'text':util['format'](_0xa757('0x105'),_0x334f77[_0xa757('0x39')][_0xa757('0x106')]),'attachments':[{'path':_0x1aa70d}]}})[_0xa757('0x32')](function(){return _0x2fe93c;})[_0xa757('0x45')](function(_0xa285fa){console[_0xa757('0x22')](_0xa285fa);});}else{return _0x2fe93c;}})[_0xa757('0x32')](respondWithStatusCode(_0x45dc56,0xc8))[_0xa757('0x45')](handleError(_0x45dc56,null));};exports[_0xa757('0x107')]=function(_0x379660,_0x36643f,_0xe704f0){return db['ChatMessage']['find']({'where':{'id':_0x379660[_0xa757('0xba')]['id']}})[_0xa757('0x32')](handleEntityNotFound(_0x36643f,null))[_0xa757('0x32')](function(_0x4f1a01){if(_0x4f1a01){return _0x4f1a01[_0xa757('0x107')](_0x379660[_0xa757('0x39')][_0xa757('0x108')],_[_0xa757('0x109')](_0x379660[_0xa757('0x39')],['ids','id'])||{});}})['then'](respondWithResult(_0x36643f,null))[_0xa757('0x45')](handleError(_0x36643f,null));};exports[_0xa757('0x10a')]=function(_0xada3bd,_0x566095,_0x25c4da){var _0x35b41e={'raw':![],'where':{}};var _0x4b60b9={};var _0x2d7d24={'count':0x0,'rows':[]};return db[_0xa757('0x47')][_0xa757('0xc0')]({'where':{'id':_0xada3bd['params']['id']}})[_0xa757('0x32')](handleEntityNotFound(_0x566095,null))[_0xa757('0x32')](function(_0x1b702f){if(_0x1b702f){_0x4b60b9[_0xa757('0x4a')]=_[_0xa757('0x4c')](db[_0xa757('0xd2')][_0xa757('0xbb')]);_0x4b60b9['query']=_[_0xa757('0x4c')](_0xada3bd['query']);_0x4b60b9[_0xa757('0x55')]=_[_0xa757('0x4d')](_0x4b60b9[_0xa757('0x4a')],_0x4b60b9[_0xa757('0x4b')]);_0x35b41e['attributes']=_['intersection'](_0x4b60b9[_0xa757('0x4a')],qs[_0xa757('0x4f')](_0xada3bd[_0xa757('0x4b')][_0xa757('0x4f')]));_0x35b41e[_0xa757('0x4e')]=_0x35b41e['attributes']['length']?_0x35b41e[_0xa757('0x4e')]:_0x4b60b9[_0xa757('0x4a')];if(!_0xada3bd[_0xa757('0x4b')][_0xa757('0x50')](_0xa757('0x51'))){_0x35b41e[_0xa757('0x2a')]=qs['limit'](_0xada3bd[_0xa757('0x4b')][_0xa757('0x2a')]);_0x35b41e[_0xa757('0x29')]=qs['offset'](_0xada3bd[_0xa757('0x4b')][_0xa757('0x29')]);}_0x35b41e[_0xa757('0x52')]=qs[_0xa757('0x53')](_0xada3bd[_0xa757('0x4b')][_0xa757('0x53')]);_0x35b41e[_0xa757('0x54')]=qs['filters'](_[_0xa757('0x56')](_0xada3bd[_0xa757('0x4b')],_0x4b60b9[_0xa757('0x55')]));_0x35b41e[_0xa757('0x54')][_0xa757('0xb7')]=_0x1b702f['id'];if(_0xada3bd[_0xa757('0x4b')][_0xa757('0x90')]){_0x35b41e['where']=_[_0xa757('0x38')](_0x35b41e['where'],{'$or':_[_0xa757('0x3f')](_0x35b41e['attributes'],function(_0x4438ec){var _0x1491c7={};_0x1491c7[_0x4438ec]={'$like':'%'+_0xada3bd[_0xa757('0x4b')]['filter']+'%'};return _0x1491c7;})});}if(_0xada3bd['query']['$gte']){var _0xa89e07=_0xada3bd[_0xa757('0x4b')][_0xa757('0x10b')][_0xa757('0x42')](',');var _0x560b05={};_0x560b05[_0xa89e07[0x0]]={'$gte':moment(_0xa89e07[0x1])[_0xa757('0xe7')]('YYYY-MM-DD\x20HH:mm:ss')};_0x35b41e[_0xa757('0x54')]=_[_0xa757('0x38')](_0x35b41e[_0xa757('0x54')],_0x560b05);}_0x35b41e=_['merge']({},_0x35b41e,_0xada3bd[_0xa757('0xbe')]);return db['ChatMessage'][_0xa757('0x28')]({'where':_0x35b41e[_0xa757('0x54')]})['then'](function(_0x31c25e){_0x2d7d24[_0xa757('0x28')]=_0x31c25e;if(_0xada3bd[_0xa757('0x4b')]['includeAll']){_0x35b41e['include']=[{'all':!![]}];}return db['ChatMessage'][_0xa757('0x10c')](_0x35b41e);})[_0xa757('0x32')](function(_0x4867c8){_0x2d7d24['rows']=_0x4867c8;return _0x2d7d24;});}})[_0xa757('0x32')](respondWithFilteredResult(_0x566095,_0x35b41e))[_0xa757('0x45')](handleError(_0x566095,null));};exports[_0xa757('0x10d')]=function(_0x4da912,_0x4b0e40,_0x4fe6f5){var _0x3cf8d3={'where':{}},_0x1a1605={},_0x4074a3={'count':0x0,'rows':[]};return db[_0xa757('0x47')][_0xa757('0xc0')]({'where':{'id':_0x4da912[_0xa757('0xba')]['id']}})[_0xa757('0x32')](handleEntityNotFound(_0x4b0e40,null))[_0xa757('0x32')](function(_0x4b3270){if(_0x4b3270){_0x1a1605[_0xa757('0x4a')]=_[_0xa757('0x4c')](db['ChatMessage'][_0xa757('0xbb')]);_0x1a1605[_0xa757('0x4b')]=_[_0xa757('0x4c')](_0x4da912[_0xa757('0x4b')]);_0x1a1605[_0xa757('0x55')]=_[_0xa757('0x4d')](_0x1a1605[_0xa757('0x4a')],_0x1a1605[_0xa757('0x4b')]);_0x3cf8d3[_0xa757('0x4e')]=_[_0xa757('0x4d')](_0x1a1605[_0xa757('0x4a')],qs[_0xa757('0x4f')](_0x4da912['query']['fields']));_0x3cf8d3[_0xa757('0x4e')]=_0x3cf8d3[_0xa757('0x4e')][_0xa757('0x6c')]?_0x3cf8d3[_0xa757('0x4e')]:_0x1a1605[_0xa757('0x4a')];if(!_0x4da912[_0xa757('0x4b')][_0xa757('0x50')]('nolimit')){_0x3cf8d3[_0xa757('0x2a')]=qs[_0xa757('0x2a')](_0x4da912[_0xa757('0x4b')][_0xa757('0x2a')]);_0x3cf8d3[_0xa757('0x29')]=qs[_0xa757('0x29')](_0x4da912[_0xa757('0x4b')]['offset']);}_0x3cf8d3[_0xa757('0x52')]=qs[_0xa757('0x53')](_0x4da912['query']['sort']);_0x3cf8d3['where']=qs[_0xa757('0x55')](_['pick'](_0x4da912['query'],_0x1a1605[_0xa757('0x55')]));_0x3cf8d3[_0xa757('0x54')][_0xa757('0xb7')]=_0x4b3270['id'];if(_0x4da912[_0xa757('0x4b')]['filter']){_0x3cf8d3[_0xa757('0x54')]=_[_0xa757('0x38')](_0x3cf8d3['where'],{'$or':_[_0xa757('0x3f')](_0x3cf8d3[_0xa757('0x4e')],function(_0x2782e3){var _0x2f8045={};_0x2f8045[_0x2782e3]={'$like':'%'+_0x4da912['query'][_0xa757('0x90')]+'%'};return _0x2f8045;})});}_0x3cf8d3[_0xa757('0x54')][_0xa757('0x10e')]=![];if(_0x4da912[_0xa757('0x4b')]['id']){_0x3cf8d3[_0xa757('0x54')]['id']={'$gt':_0x4da912[_0xa757('0x4b')]['id']};}_0x3cf8d3=_[_0xa757('0x38')]({},_0x3cf8d3,_0x4da912[_0xa757('0xbe')]);return db[_0xa757('0xd2')]['count']({'where':_0x3cf8d3[_0xa757('0x54')]})[_0xa757('0x32')](function(_0x409ae1){_0x4074a3[_0xa757('0x28')]=_0x409ae1;_0x3cf8d3[_0xa757('0xbd')]=[];if(_0x4da912[_0xa757('0x4b')][_0xa757('0x10f')]){_0x3cf8d3['include'][_0xa757('0x44')]({'model':db[_0xa757('0x7d')],'as':_0xa757('0x7d'),'attributes':['id',_0xa757('0xc7'),_0xa757('0xf3')]});}if(_0x4da912[_0xa757('0x4b')][_0xa757('0xbc')]){_0x3cf8d3[_0xa757('0xbd')]=[{'all':!![]}];}return db[_0xa757('0xd2')]['findAll'](_0x3cf8d3);})[_0xa757('0x32')](function(_0x4c86fd){_0x4074a3['rows']=_0x4c86fd;return _0x4074a3;});}})[_0xa757('0x32')](respondWithFilteredResult(_0x4b0e40,_0x3cf8d3))['catch'](handleError(_0x4b0e40,null));};exports[_0xa757('0x110')]=function(_0x40e0df,_0x54f4ca,_0x4152da){return db['ChatInteraction']['find']({'where':{'id':_0x40e0df[_0xa757('0xba')]['id']}})['then'](handleEntityNotFound(_0x54f4ca,null))['then'](function(_0x59ff48){if(_0x59ff48){return _0x59ff48[_0xa757('0x111')](_0x40e0df['body'][_0xa757('0x108')],_[_0xa757('0x109')](_0x40e0df[_0xa757('0x39')],[_0xa757('0x108'),'id'])||{})['spread'](function(){return db[_0xa757('0x7a')][_0xa757('0x10c')]({'attributes':['id',_0xa757('0x35'),_0xa757('0x112')],'where':{'id':_0x40e0df[_0xa757('0x39')][_0xa757('0x108')]}});})[_0xa757('0x32')](function(_0x5d2063){socket[_0xa757('0x113')](_0xa757('0x114'),{'id':Number(_0x40e0df['params']['id']),'tags':_0x5d2063||[]});return{'id':Number(_0x40e0df[_0xa757('0xba')]['id']),'tags':_0x5d2063||[]};});}})[_0xa757('0x32')](respondWithResult(_0x54f4ca,null))['catch'](handleError(_0x54f4ca,null));};exports[_0xa757('0x115')]=function(_0x1474f7,_0x1449d4,_0x2aaf2a){return db[_0xa757('0x47')][_0xa757('0x6d')]({'where':{'id':_0x1474f7[_0xa757('0xba')]['id']}})['then'](handleEntityNotFound(_0x1449d4,null))[_0xa757('0x32')](function(_0x1ba7d0){if(_0x1ba7d0){return _0x1ba7d0[_0xa757('0x115')](_0x1474f7[_0xa757('0x4b')]['ids']);}})[_0xa757('0x32')](respondWithStatusCode(_0x1449d4,null))[_0xa757('0x45')](handleError(_0x1449d4,null));};exports[_0xa757('0x116')]=function(_0x563988,_0x43e9cb){var _0xaf7112=moment()['unix']()[_0xa757('0xa3')]();var _0x5ea526=path[_0xa757('0xe4')](config['root'],_0xa757('0x117'),_0xa757('0x118'),_0xa757('0x119'));var _0x58f20d=path[_0xa757('0xe4')](config[_0xa757('0x11a')],_0xa757('0x117'),_0xa757('0x118'),_0xa757('0x11b'));var _0x4b274f=path[_0xa757('0xe4')](_0x5ea526,_0xaf7112);var _0x225b14=util[_0xa757('0xe7')](_0xa757('0x11c'),_0x563988[_0xa757('0xba')]['id'],_0xaf7112);var _0x14d04e=path['join'](_0x5ea526,_0x225b14);var _0x3798ea=[];_0x3798ea[_0xa757('0x44')]({'model':db[_0xa757('0x7d')],'as':_0xa757('0x7d'),'attributes':['id',_0xa757('0xc7')],'raw':!![]});_0x3798ea[_0xa757('0x44')]({'model':db[_0xa757('0xd5')],'as':'Contact','attributes':['id',_0xa757('0x11d'),'lastName'],'raw':!![]});if(_0x563988['query'][_0xa757('0x11b')]){_0x3798ea[_0xa757('0x44')]({'model':db[_0xa757('0xdf')],'as':'Attachment','raw':!![]});}var _0x3bd69c=[{'model':db['ChatMessage'],'as':_0xa757('0xeb'),'attributes':['id',_0xa757('0x39'),'createdAt',_0xa757('0xf8'),'secret',_0xa757('0x8c')],'include':_0x3798ea}];_0x3bd69c[_0xa757('0x44')]({'model':db[_0xa757('0xc1')],'as':_0xa757('0x11e'),'attributes':['id',_0xa757('0x35')]});_0x3bd69c[_0xa757('0x44')]({'model':db[_0xa757('0x7d')],'as':_0xa757('0x11f'),'attributes':['id',_0xa757('0xc7')]});return db[_0xa757('0x47')][_0xa757('0x6d')]({'where':{'id':_0x563988['params']['id']},'include':_0x3bd69c})[_0xa757('0x32')](handleEntityNotFound(_0x43e9cb,null))[_0xa757('0x32')](function(_0x374216){if(_0x374216){var _0x1a8c73=_0x374216[_0xa757('0x120')]({'plain':!![]});fs[_0xa757('0x121')](_0x4b274f);var _0xd20b89={'channel':_0xa757('0x122'),'account':_0x1a8c73['Account'][_0xa757('0x35')],'agent':_0x1a8c73['Owner']?_0x1a8c73[_0xa757('0x11f')][_0xa757('0xc7')]:_0xa757('0x123'),'createdAt':moment(_0x1a8c73[_0xa757('0x85')])[_0xa757('0xe7')]('YYYY-MM-DD\x20HH:mm:ss')[_0xa757('0xa3')](),'closedAt':_0x1a8c73[_0xa757('0xda')]?moment(_0x1a8c73[_0xa757('0x124')])['format'](_0xa757('0x125'))['toString']():'','disposition':_0x1a8c73['disposition'],'chatInfo':{'browser':_0x1a8c73[_0xa757('0x126')],'os':_0x1a8c73[_0xa757('0x127')],'referer':_0x1a8c73[_0xa757('0x128')],'customerIp':_0x1a8c73[_0xa757('0x129')],'customerPort':_0x1a8c73['customerPort']?_0x1a8c73[_0xa757('0x12a')]:_0xa757('0x123')},'messages':_(_0x1a8c73[_0xa757('0xeb')])[_0xa757('0x12b')]()[_0xa757('0x90')]({'secret':![]})['map'](function(_0x535599){if(_0x535599['Attachment']){var _0x56c9b9=path[_0xa757('0xe4')](_0x58f20d,_0x535599['Attachment'][_0xa757('0xe5')]);if(fs[_0xa757('0x12c')](_0x56c9b9)){fs[_0xa757('0x12d')](_0x56c9b9)[_0xa757('0x12e')](fs[_0xa757('0x12f')](path[_0xa757('0xe4')](_0x4b274f,_0x535599[_0xa757('0xdf')][_0xa757('0xe5')])));}}return{'date':moment(_0x535599[_0xa757('0x85')])[_0xa757('0xe7')](_0xa757('0x125'))[_0xa757('0xa3')](),'sender':_0x535599[_0xa757('0xf8')]===_0xa757('0xd1')?_0x535599[_0xa757('0x7d')]?_0x535599[_0xa757('0x7d')][_0xa757('0xc7')]:_0xa757('0xed'):_0x535599[_0xa757('0x72')][_0xa757('0x11d')]+(_0x535599[_0xa757('0x72')][_0xa757('0x130')]?'\x20'+_0x535599[_0xa757('0x72')][_0xa757('0x130')]:''),'body':_0x535599[_0xa757('0xdf')]?_0x535599[_0xa757('0xdf')][_0xa757('0xe5')]:_0x535599[_0xa757('0x39')],'direction':_0x535599['direction']===_0xa757('0xd1')?'A':'C','secret':_0x535599[_0xa757('0x10e')],'read':_0x535599[_0xa757('0x8c')],'attachment':_0x535599[_0xa757('0xdf')]};})['value']()};return ejs[_0xa757('0x131')](path[_0xa757('0xe4')](config[_0xa757('0x11a')],_0xa757('0x117'),_0xa757('0x132'),_0xa757('0x133')),{'interaction':_0xd20b89})[_0xa757('0x32')](function(_0xd7df6f){var _0x7e03ff=path[_0xa757('0xe4')](_0x4b274f,_0xa757('0x134')+_0x1a8c73['id']+'-'+_0xaf7112+_0xa757('0x135'));var _0x1d21e7={'path':_0x7e03ff,'channel':_0xa757('0x122'),'interactionId':_0x1a8c73['id']};return pdf['createPdfFromHTML'](_0xd7df6f,_0x1d21e7);})[_0xa757('0x32')](function(){return new BPromise(function(_0xacfa4b,_0x567517){zipdir(_0x4b274f,{'saveTo':_0x14d04e},function(_0x22e7f5,_0x435552){if(_0x22e7f5)return _0x567517(_0x22e7f5);return _0xacfa4b(_0x435552);});})[_0xa757('0x32')](function(){return new BPromise(function(_0x466f7b,_0x4f5ae1){rimraf(_0x4b274f,function(_0x404003){if(_0x404003)_0x4f5ae1(_0x404003);return _0x466f7b();});});})[_0xa757('0x32')](function(){return _0x43e9cb[_0xa757('0x116')](_0x14d04e,_0x225b14,function(_0x34f745){if(_0x34f745){console[_0xa757('0x136')](_0xa757('0x137'),_0x34f745);}else{fs[_0xa757('0x138')](_0x14d04e);}});});});}else{return _0x43e9cb[_0xa757('0x25')](0xc8);}})[_0xa757('0x45')](handleError(_0x43e9cb,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index ff68437..46373ed 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 _0x317d=['setDataValue','Users','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','exports','events','../../mysqldb','ChatInteraction','ChatMessage','save'];(function(_0x4383f7,_0x74939d){var _0x42b586=function(_0x10cd7d){while(--_0x10cd7d){_0x4383f7['push'](_0x4383f7['shift']());}};_0x42b586(++_0x74939d);}(_0x317d,0x172));var _0xd317=function(_0x1f1b8a,_0x16b1db){_0x1f1b8a=_0x1f1b8a-0x0;var _0x3aaa5a=_0x317d[_0x1f1b8a];return _0x3aaa5a;};'use strict';var EventEmitter=require(_0xd317('0x0'));var ChatInteraction=require(_0xd317('0x1'))['db'][_0xd317('0x2')];var ChatMessage=require(_0xd317('0x1'))['db'][_0xd317('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xd317('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x3c3def){return function(_0x4d5443,_0x59225a,_0xd30ecf){_0x4d5443['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x110271){_0x4d5443[_0xd317('0x5')](_0xd317('0x6'),_0x110271[_0xd317('0x7')](function(_0x52682b){return{'id':_0x52682b['id']};}));return ChatMessage[_0xd317('0x8')]({'where':{'ChatInteractionId':_0x4d5443['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x2a9cb5){_0x4d5443['setDataValue'](_0xd317('0x9'),_0x2a9cb5[_0xd317('0xa')]);ChatInteractionEvents[_0xd317('0xb')](_0x3c3def+':'+_0x4d5443['id'],_0x4d5443);ChatInteractionEvents[_0xd317('0xb')](_0x3c3def,_0x4d5443);_0xd30ecf(null);})[_0xd317('0xc')](_0xd30ecf(null));};}for(var e in events){if(events[_0xd317('0xd')](e)){var event=events[e];ChatInteraction['hook'](e,emitEvent(event));}}module[_0xd317('0xe')]=ChatInteractionEvents; \ No newline at end of file +var _0xc0e7=['map','findAll','then','unreadMessages','length','emit','hook','exports','events','../../mysqldb','ChatInteraction','setMaxListeners','save','update','setDataValue','Users'];(function(_0x26462c,_0xd20a35){var _0x509a42=function(_0x1b22c9){while(--_0x1b22c9){_0x26462c['push'](_0x26462c['shift']());}};_0x509a42(++_0xd20a35);}(_0xc0e7,0xf8));var _0x7c0e=function(_0x1332c1,_0x1e1044){_0x1332c1=_0x1332c1-0x0;var _0x707ac0=_0xc0e7[_0x1332c1];return _0x707ac0;};'use strict';var EventEmitter=require(_0x7c0e('0x0'));var ChatInteraction=require(_0x7c0e('0x1'))['db'][_0x7c0e('0x2')];var ChatMessage=require(_0x7c0e('0x1'))['db']['ChatMessage'];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x7c0e('0x3')](0x0);var events={'afterCreate':_0x7c0e('0x4'),'afterUpdate':_0x7c0e('0x5'),'afterDestroy':'remove'};function emitEvent(_0x315e7c){return function(_0x5c2ebc,_0x5399a1,_0x5511a9){_0x5c2ebc['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x1b3827){_0x5c2ebc[_0x7c0e('0x6')](_0x7c0e('0x7'),_0x1b3827[_0x7c0e('0x8')](function(_0x3c9373){return{'id':_0x3c9373['id']};}));return ChatMessage[_0x7c0e('0x9')]({'where':{'ChatInteractionId':_0x5c2ebc['id'],'direction':'in','read':![]},'raw':!![]});})[_0x7c0e('0xa')](function(_0x25901a){_0x5c2ebc[_0x7c0e('0x6')](_0x7c0e('0xb'),_0x25901a[_0x7c0e('0xc')]);ChatInteractionEvents[_0x7c0e('0xd')](_0x315e7c+':'+_0x5c2ebc['id'],_0x5c2ebc);ChatInteractionEvents['emit'](_0x315e7c,_0x5c2ebc);_0x5511a9(null);})['catch'](_0x5511a9(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInteraction[_0x7c0e('0xe')](e,emitEvent(event));}}module[_0x7c0e('0xf')]=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index 6d46c76..ca44b15 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 _0x3d0b=['util','api','moment','request-promise','path','rimraf','../../config/environment','./chatInteraction.attributes','exports','define','ChatInteraction','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3d0b,0x11c));var _0xb3d0=function(_0x5aa992,_0x559ebb){_0x5aa992=_0x5aa992-0x0;var _0x2e2d59=_0x3d0b[_0x5aa992];return _0x2e2d59;};'use strict';var _=require(_0xb3d0('0x0'));var util=require(_0xb3d0('0x1'));var logger=require('../../config/logger')(_0xb3d0('0x2'));var moment=require(_0xb3d0('0x3'));var BPromise=require('bluebird');var rp=require(_0xb3d0('0x4'));var fs=require('fs');var path=require(_0xb3d0('0x5'));var rimraf=require(_0xb3d0('0x6'));var config=require(_0xb3d0('0x7'));var attributes=require(_0xb3d0('0x8'));module[_0xb3d0('0x9')]=function(_0x520022,_0x2941aa){return _0x520022[_0xb3d0('0xa')](_0xb3d0('0xb'),attributes,{'tableName':'chat_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x14d2e3,_0x3ff51f,_0x30a02b){if(_0x14d2e3['changed']('closed')){_0x14d2e3[_0xb3d0('0xc')]=moment()[_0xb3d0('0xd')](_0xb3d0('0xe'));}_0x30a02b(null,_0x14d2e3);}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x9643=['utf8mb4','lodash','util','../../config/logger','api','moment','./chatInteraction.attributes','exports','ChatInteraction','chat_interactions','changed','closed','closedAt','format'];(function(_0x36dc04,_0x77c234){var _0x43d207=function(_0x3f8519){while(--_0x3f8519){_0x36dc04['push'](_0x36dc04['shift']());}};_0x43d207(++_0x77c234);}(_0x9643,0x7f));var _0x3964=function(_0x3f29d4,_0x20b952){_0x3f29d4=_0x3f29d4-0x0;var _0x26ff48=_0x9643[_0x3f29d4];return _0x26ff48;};'use strict';var _=require(_0x3964('0x0'));var util=require(_0x3964('0x1'));var logger=require(_0x3964('0x2'))(_0x3964('0x3'));var moment=require(_0x3964('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x3964('0x5'));module[_0x3964('0x6')]=function(_0x7b482a,_0xe3bb5f){return _0x7b482a['define'](_0x3964('0x7'),attributes,{'tableName':_0x3964('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x264451,_0x55d24d,_0x3b0be7){if(_0x264451[_0x3964('0x9')](_0x3964('0xa'))){_0x264451[_0x3964('0xb')]=moment()[_0x3964('0xc')]('YYYY-MM-DD\x20HH:mm:ss');}_0x3b0be7(null,_0x264451);}},'charset':_0x3964('0xd'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index 4e29795..a2ea2b1 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 _0x2b43=['ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','redis','defaults','socket.io-emitter','./chatInteraction.socket','request','then','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','ChatInteraction','update','body','options','raw','UpdateChatInteraction','AddTagsToChatInteraction','where','addTags','ids','omit','spread','AddTags','lodash','util','moment'];(function(_0x5d5fe4,_0x9cab73){var _0x207cb5=function(_0x4e7dc8){while(--_0x4e7dc8){_0x5d5fe4['push'](_0x5d5fe4['shift']());}};_0x207cb5(++_0x9cab73);}(_0x2b43,0xc0));var _0x32b4=function(_0xd0664b,_0x2d0002){_0xd0664b=_0xd0664b-0x0;var _0x2ff330=_0x2b43[_0xd0664b];return _0x2ff330;};'use strict';var _=require(_0x32b4('0x0'));var util=require(_0x32b4('0x1'));var moment=require(_0x32b4('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x32b4('0x3'));var db=require(_0x32b4('0x4'))['db'];var utils=require(_0x32b4('0x5'));var logger=require(_0x32b4('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x32b4('0x7'));var client=jayson[_0x32b4('0x8')][_0x32b4('0x9')]({'port':0x232a});config[_0x32b4('0xa')]=_[_0x32b4('0xb')](config[_0x32b4('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x32b4('0xc'))(new Redis(config[_0x32b4('0xa')]));require(_0x32b4('0xd'))['register'](socket);function respondWithRpcPromise(_0x577744,_0x19f897,_0x4eae23){return new BPromise(function(_0x95952c,_0x53b87d){return client[_0x32b4('0xe')](_0x577744,_0x4eae23)[_0x32b4('0xf')](function(_0x10fe97){logger['info'](_0x32b4('0x10'),_0x19f897,_0x32b4('0x11'));logger[_0x32b4('0x12')](_0x32b4('0x13'),_0x19f897,'request\x20sent',JSON[_0x32b4('0x14')](_0x10fe97));if(_0x10fe97[_0x32b4('0x15')]){if(_0x10fe97[_0x32b4('0x15')][_0x32b4('0x16')]===0x1f4){logger[_0x32b4('0x15')](_0x32b4('0x10'),_0x19f897,_0x10fe97[_0x32b4('0x15')][_0x32b4('0x17')]);return _0x53b87d(_0x10fe97[_0x32b4('0x15')][_0x32b4('0x17')]);}logger['error'](_0x32b4('0x10'),_0x19f897,_0x10fe97[_0x32b4('0x15')][_0x32b4('0x17')]);return _0x95952c(_0x10fe97['error'][_0x32b4('0x17')]);}else{logger[_0x32b4('0x18')](_0x32b4('0x10'),_0x19f897,'request\x20sent');_0x95952c(_0x10fe97['result'][_0x32b4('0x17')]);}})[_0x32b4('0x19')](function(_0x550dfd){logger[_0x32b4('0x15')]('ChatInteraction,\x20%s,\x20%s',_0x19f897,_0x550dfd);_0x53b87d(_0x550dfd);});});}exports['UpdateChatInteraction']=function(_0x269a7d){var _0x403574=this;return new Promise(function(_0x2584f8,_0x4d79d6){return db[_0x32b4('0x1a')][_0x32b4('0x1b')](_0x269a7d[_0x32b4('0x1c')],{'raw':_0x269a7d[_0x32b4('0x1d')]?_0x269a7d['options'][_0x32b4('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x269a7d[_0x32b4('0x1d')]?_0x269a7d[_0x32b4('0x1d')]['where']||null:null,'attributes':_0x269a7d[_0x32b4('0x1d')]?_0x269a7d[_0x32b4('0x1d')]['attributes']||null:null,'limit':_0x269a7d['options']?_0x269a7d[_0x32b4('0x1d')]['limit']||null:null})[_0x32b4('0xf')](function(_0x46fdb2){logger[_0x32b4('0x18')](_0x32b4('0x1f'),_0x269a7d);logger[_0x32b4('0x12')]('UpdateChatInteraction',_0x269a7d,JSON[_0x32b4('0x14')](_0x46fdb2));_0x2584f8(_0x46fdb2);})[_0x32b4('0x19')](function(_0x2cf5c2){logger[_0x32b4('0x15')](_0x32b4('0x1f'),_0x2cf5c2[_0x32b4('0x17')],_0x269a7d);_0x4d79d6(_0x403574[_0x32b4('0x15')](0x1f4,_0x2cf5c2[_0x32b4('0x17')]));});});};exports[_0x32b4('0x20')]=function(_0x469dad){return new Promise(function(_0x2cd9de,_0x45da8e){return db['ChatInteraction']['find']({'where':_0x469dad['options']?_0x469dad[_0x32b4('0x1d')][_0x32b4('0x21')]||null:null})['then'](function(_0x250b5a){if(_0x250b5a){return _0x250b5a[_0x32b4('0x22')](_0x469dad[_0x32b4('0x1c')][_0x32b4('0x23')],_[_0x32b4('0x24')](_0x469dad[_0x32b4('0x1c')],[_0x32b4('0x23'),'id'])||{});}})[_0x32b4('0x25')](function(_0x9c4c86){logger[_0x32b4('0x18')](_0x32b4('0x26'),_0x469dad);logger[_0x32b4('0x12')](_0x32b4('0x26'),_0x469dad,JSON['stringify'](_0x9c4c86));_0x2cd9de(_0x9c4c86);})[_0x32b4('0x19')](function(_0x593971){logger[_0x32b4('0x15')](_0x32b4('0x26'),_0x593971[_0x32b4('0x17')],_0x469dad);_0x45da8e(_this[_0x32b4('0x15')](0x1f4,_0x593971[_0x32b4('0x17')]));});});}; \ No newline at end of file +var _0x9665=['rpc','jayson/promise','client','http','redis','socket.io-emitter','./chatInteraction.socket','request','then','info','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','ChatInteraction,\x20%s,\x20%s','message','result','UpdateChatInteraction','body','options','raw','attributes','catch','ChatInteraction','find','addTags','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9665,0x6d));var _0x5966=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x9665[_0x53ccf2];return _0x5a2964;};'use strict';var _=require(_0x5966('0x0'));var util=require(_0x5966('0x1'));var moment=require(_0x5966('0x2'));var BPromise=require(_0x5966('0x3'));var rs=require(_0x5966('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5966('0x5'))['db'];var utils=require(_0x5966('0x6'));var logger=require(_0x5966('0x7'))(_0x5966('0x8'));var config=require('../../config/environment');var jayson=require(_0x5966('0x9'));var client=jayson[_0x5966('0xa')][_0x5966('0xb')]({'port':0x232a});config[_0x5966('0xc')]=_['defaults'](config[_0x5966('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x5966('0xd'))(new Redis(config[_0x5966('0xc')]));require(_0x5966('0xe'))['register'](socket);function respondWithRpcPromise(_0x57b163,_0x78c7e9,_0x6e255a){return new BPromise(function(_0xb37ac6,_0x5b2641){return client[_0x5966('0xf')](_0x57b163,_0x6e255a)[_0x5966('0x10')](function(_0x25f8a2){logger[_0x5966('0x11')]('ChatInteraction,\x20%s,\x20%s',_0x78c7e9,_0x5966('0x12'));logger[_0x5966('0x13')](_0x5966('0x14'),_0x78c7e9,'request\x20sent',JSON[_0x5966('0x15')](_0x25f8a2));if(_0x25f8a2['error']){if(_0x25f8a2[_0x5966('0x16')]['code']===0x1f4){logger[_0x5966('0x16')](_0x5966('0x17'),_0x78c7e9,_0x25f8a2[_0x5966('0x16')][_0x5966('0x18')]);return _0x5b2641(_0x25f8a2[_0x5966('0x16')]['message']);}logger[_0x5966('0x16')](_0x5966('0x17'),_0x78c7e9,_0x25f8a2[_0x5966('0x16')][_0x5966('0x18')]);return _0xb37ac6(_0x25f8a2[_0x5966('0x16')][_0x5966('0x18')]);}else{logger['info'](_0x5966('0x17'),_0x78c7e9,_0x5966('0x12'));_0xb37ac6(_0x25f8a2[_0x5966('0x19')][_0x5966('0x18')]);}})['catch'](function(_0x56e8a9){logger['error']('ChatInteraction,\x20%s,\x20%s',_0x78c7e9,_0x56e8a9);_0x5b2641(_0x56e8a9);});});}exports[_0x5966('0x1a')]=function(_0x3330b2){var _0x117035=this;return new Promise(function(_0x562ffc,_0x9a570){return db['ChatInteraction']['update'](_0x3330b2[_0x5966('0x1b')],{'raw':_0x3330b2[_0x5966('0x1c')]?_0x3330b2['options'][_0x5966('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3330b2[_0x5966('0x1c')]?_0x3330b2[_0x5966('0x1c')]['where']||null:null,'attributes':_0x3330b2[_0x5966('0x1c')]?_0x3330b2[_0x5966('0x1c')][_0x5966('0x1e')]||null:null,'limit':_0x3330b2[_0x5966('0x1c')]?_0x3330b2[_0x5966('0x1c')]['limit']||null:null})['then'](function(_0x473d50){logger[_0x5966('0x11')](_0x5966('0x1a'),_0x3330b2);logger[_0x5966('0x13')]('UpdateChatInteraction',_0x3330b2,JSON['stringify'](_0x473d50));_0x562ffc(_0x473d50);})[_0x5966('0x1f')](function(_0x1e6afd){logger[_0x5966('0x16')](_0x5966('0x1a'),_0x1e6afd[_0x5966('0x18')],_0x3330b2);_0x9a570(_0x117035[_0x5966('0x16')](0x1f4,_0x1e6afd[_0x5966('0x18')]));});});};exports['AddTagsToChatInteraction']=function(_0x339529){return new Promise(function(_0x22495d,_0x37c0aa){return db[_0x5966('0x20')][_0x5966('0x21')]({'where':_0x339529['options']?_0x339529[_0x5966('0x1c')]['where']||null:null})[_0x5966('0x10')](function(_0x3d0748){if(_0x3d0748){return _0x3d0748[_0x5966('0x22')](_0x339529[_0x5966('0x1b')][_0x5966('0x23')],_[_0x5966('0x24')](_0x339529[_0x5966('0x1b')],[_0x5966('0x23'),'id'])||{});}})[_0x5966('0x25')](function(_0x1dda93){logger[_0x5966('0x11')](_0x5966('0x26'),_0x339529);logger['debug']('AddTags',_0x339529,JSON[_0x5966('0x15')](_0x1dda93));_0x22495d(_0x1dda93);})[_0x5966('0x1f')](function(_0x1adeb5){logger['error']('AddTags',_0x1adeb5[_0x5966('0x18')],_0x339529);_0x37c0aa(_this['error'](0x1f4,_0x1adeb5[_0x5966('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index 529664d..ff2fdc2 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 _0x427f=['emit','removeListener','register','length','./chatInteraction.events','save','remove','update'];(function(_0x426ab4,_0x3aa799){var _0x290c07=function(_0x41ffe4){while(--_0x41ffe4){_0x426ab4['push'](_0x426ab4['shift']());}};_0x290c07(++_0x3aa799);}(_0x427f,0xc4));var _0xf427=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x427f[_0x1ac595];return _0x455fff;};'use strict';var ChatInteractionEvents=require(_0xf427('0x0'));var events=[_0xf427('0x1'),_0xf427('0x2'),_0xf427('0x3')];function createListener(_0x272479,_0xbf0f2b){return function(_0x133301){_0xbf0f2b[_0xf427('0x4')](_0x272479,_0x133301);};}function removeListener(_0x4c3707,_0xa4d11){return function(){ChatInteractionEvents[_0xf427('0x5')](_0x4c3707,_0xa4d11);};}exports[_0xf427('0x6')]=function(_0x4bc020){for(var _0x55b7bd=0x0,_0x35e528=events[_0xf427('0x7')];_0x55b7bd<_0x35e528;_0x55b7bd++){var _0x30e4b8=events[_0x55b7bd];var _0x3b11a3=createListener('chatInteraction:'+_0x30e4b8,_0x4bc020);ChatInteractionEvents['on'](_0x30e4b8,_0x3b11a3);}}; \ No newline at end of file +var _0x9b61=['./chatInteraction.events','save','remove','update','emit','removeListener','register','length','chatInteraction:'];(function(_0x44210e,_0x1c76d6){var _0x2c6399=function(_0xae5886){while(--_0xae5886){_0x44210e['push'](_0x44210e['shift']());}};_0x2c6399(++_0x1c76d6);}(_0x9b61,0x14d));var _0x19b6=function(_0x3d9063,_0x19277b){_0x3d9063=_0x3d9063-0x0;var _0x5c3b46=_0x9b61[_0x3d9063];return _0x5c3b46;};'use strict';var ChatInteractionEvents=require(_0x19b6('0x0'));var events=[_0x19b6('0x1'),_0x19b6('0x2'),_0x19b6('0x3')];function createListener(_0xadb293,_0x5edfe5){return function(_0x59d50a){_0x5edfe5[_0x19b6('0x4')](_0xadb293,_0x59d50a);};}function removeListener(_0x5bbc44,_0x893cca){return function(){ChatInteractionEvents[_0x19b6('0x5')](_0x5bbc44,_0x893cca);};}exports[_0x19b6('0x6')]=function(_0x12e70e){for(var _0x5db0ec=0x0,_0x41d264=events[_0x19b6('0x7')];_0x5db0ec<_0x41d264;_0x5db0ec++){var _0x2e2c36=events[_0x5db0ec];var _0x3bfc81=createListener(_0x19b6('0x8')+_0x2e2c36,_0x12e70e);ChatInteractionEvents['on'](_0x2e2c36,_0x3bfc81);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index 86d0b4b..86d86c8 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 _0x9962=['/:id/abandon','/:id/close','chatinteraction:destroy','destroy','delete','removeTags','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatInteraction.controller','get','index','describe','/:id','isChatInteractionAuthorized','show','/:id/attachment_download','/:id/messages','isAuthenticated','getMessages','getMyMessages','post','/:id/vidaoo','createVidaooSession','diskStorage','server/files/attachments/','format','%s-%s','now','originalname','replace','/:id/attachment_upload','single','file','addMessage','/:id/tags','tracked','chat','chatinteraction:addtags','put','update','/:id/custom_update','customUpdate'];(function(_0x49a1c7,_0x29708f){var _0x425904=function(_0x30c802){while(--_0x30c802){_0x49a1c7['push'](_0x49a1c7['shift']());}};_0x425904(++_0x29708f);}(_0x9962,0xcb));var _0x2996=function(_0x377686,_0x3dd0c4){_0x377686=_0x377686-0x0;var _0x3487fc=_0x9962[_0x377686];return _0x3487fc;};'use strict';var multer=require('multer');var util=require(_0x2996('0x0'));var path=require(_0x2996('0x1'));var timeout=require(_0x2996('0x2'));var express=require(_0x2996('0x3'));var router=express[_0x2996('0x4')]();var fs_extra=require(_0x2996('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x2996('0x6'));var config=require(_0x2996('0x7'));var controller=require(_0x2996('0x8'));router[_0x2996('0x9')]('/',auth['isAuthenticated'](),controller[_0x2996('0xa')]);router[_0x2996('0x9')]('/describe',auth['isAuthenticated'](),controller[_0x2996('0xb')]);router[_0x2996('0x9')](_0x2996('0xc'),auth[_0x2996('0xd')](),controller[_0x2996('0xe')]);router[_0x2996('0x9')](_0x2996('0xf'),auth[_0x2996('0xd')](),controller['attachmentDownload']);router[_0x2996('0x9')](_0x2996('0x10'),auth[_0x2996('0x11')](),controller[_0x2996('0x12')]);router[_0x2996('0x9')]('/:id/my_messages',auth[_0x2996('0xd')](),controller[_0x2996('0x13')]);router[_0x2996('0x9')]('/:id/download',auth[_0x2996('0x11')](),controller['download']);router[_0x2996('0x14')]('/',auth[_0x2996('0x11')](),controller['create']);router['post'](_0x2996('0x15'),auth['isAuthenticated'](),controller[_0x2996('0x16')]);var upload=multer({'storage':multer[_0x2996('0x17')]({'destination':function(_0x1f60b1,_0x4ee031,_0x73c704){_0x73c704(null,path['join'](config['root'],_0x2996('0x18')));},'filename':function(_0x30aadd,_0x1e746e,_0x449808){_0x449808(null,util[_0x2996('0x19')](_0x2996('0x1a'),Date[_0x2996('0x1b')](),_0x1e746e[_0x2996('0x1c')][_0x2996('0x1d')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x2996('0x14')](_0x2996('0x1e'),upload[_0x2996('0x1f')](_0x2996('0x20')),controller['attachmentUpload']);router[_0x2996('0x14')]('/:id/messages',auth[_0x2996('0xd')](),controller[_0x2996('0x21')]);router[_0x2996('0x14')](_0x2996('0x22'),auth['isAuthenticated'](),interaction[_0x2996('0x23')](_0x2996('0x24'),_0x2996('0x25')),controller['addTags']);router[_0x2996('0x26')](_0x2996('0xc'),auth[_0x2996('0x11')](),interaction[_0x2996('0x23')]('chat','chatinteraction:update'),controller[_0x2996('0x27')]);router['put'](_0x2996('0x28'),controller[_0x2996('0x29')]);router[_0x2996('0x26')](_0x2996('0x2a'),auth[_0x2996('0xd')](),controller['abandon']);router[_0x2996('0x26')](_0x2996('0x2b'),controller['close']);router['delete'](_0x2996('0xc'),auth[_0x2996('0x11')](),interaction[_0x2996('0x23')](_0x2996('0x24'),_0x2996('0x2c')),controller[_0x2996('0x2d')]);router[_0x2996('0x2e')](_0x2996('0x22'),auth[_0x2996('0x11')](),controller[_0x2996('0x2f')]);module[_0x2996('0x30')]=router; \ No newline at end of file +var _0x03f6=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','isChatInteractionAuthorized','show','/:id/attachment_download','attachmentDownload','/:id/messages','getMessages','/:id/my_messages','/:id/download','download','post','/:id/vidaoo','createVidaooSession','root','server/files/attachments/','format','%s-%s','now','replace','/:id/attachment_upload','addMessage','/:id/tags','chat','chatinteraction:addtags','addTags','put','update','/:id/custom_update','customUpdate','/:id/abandon','/:id/close','delete','tracked','chatinteraction:destroy','destroy','removeTags','exports','multer'];(function(_0xd030de,_0x326fe5){var _0x50e400=function(_0x17eb00){while(--_0x17eb00){_0xd030de['push'](_0xd030de['shift']());}};_0x50e400(++_0x326fe5);}(_0x03f6,0x16b));var _0x603f=function(_0x30666e,_0x13055c){_0x30666e=_0x30666e-0x0;var _0x4d2459=_0x03f6[_0x30666e];return _0x4d2459;};'use strict';var multer=require(_0x603f('0x0'));var util=require(_0x603f('0x1'));var path=require(_0x603f('0x2'));var timeout=require(_0x603f('0x3'));var express=require(_0x603f('0x4'));var router=express[_0x603f('0x5')]();var fs_extra=require(_0x603f('0x6'));var auth=require(_0x603f('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x603f('0x8'));var controller=require(_0x603f('0x9'));router[_0x603f('0xa')]('/',auth[_0x603f('0xb')](),controller[_0x603f('0xc')]);router[_0x603f('0xa')](_0x603f('0xd'),auth[_0x603f('0xb')](),controller[_0x603f('0xe')]);router[_0x603f('0xa')](_0x603f('0xf'),auth[_0x603f('0x10')](),controller[_0x603f('0x11')]);router[_0x603f('0xa')](_0x603f('0x12'),auth[_0x603f('0x10')](),controller[_0x603f('0x13')]);router[_0x603f('0xa')](_0x603f('0x14'),auth['isAuthenticated'](),controller[_0x603f('0x15')]);router['get'](_0x603f('0x16'),auth[_0x603f('0x10')](),controller['getMyMessages']);router[_0x603f('0xa')](_0x603f('0x17'),auth[_0x603f('0xb')](),controller[_0x603f('0x18')]);router[_0x603f('0x19')]('/',auth[_0x603f('0xb')](),controller['create']);router[_0x603f('0x19')](_0x603f('0x1a'),auth[_0x603f('0xb')](),controller[_0x603f('0x1b')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x421d8a,_0x135316,_0x398206){_0x398206(null,path['join'](config[_0x603f('0x1c')],_0x603f('0x1d')));},'filename':function(_0x8e6161,_0x2436d5,_0x9ffc14){_0x9ffc14(null,util[_0x603f('0x1e')](_0x603f('0x1f'),Date[_0x603f('0x20')](),_0x2436d5['originalname'][_0x603f('0x21')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post'](_0x603f('0x22'),upload['single']('file'),controller['attachmentUpload']);router[_0x603f('0x19')](_0x603f('0x14'),auth['isChatInteractionAuthorized'](),controller[_0x603f('0x23')]);router[_0x603f('0x19')](_0x603f('0x24'),auth['isAuthenticated'](),interaction['tracked'](_0x603f('0x25'),_0x603f('0x26')),controller[_0x603f('0x27')]);router[_0x603f('0x28')](_0x603f('0xf'),auth['isAuthenticated'](),interaction['tracked'](_0x603f('0x25'),'chatinteraction:update'),controller[_0x603f('0x29')]);router[_0x603f('0x28')](_0x603f('0x2a'),controller[_0x603f('0x2b')]);router[_0x603f('0x28')](_0x603f('0x2c'),auth[_0x603f('0x10')](),controller['abandon']);router['put'](_0x603f('0x2d'),controller['close']);router[_0x603f('0x2e')](_0x603f('0xf'),auth['isAuthenticated'](),interaction[_0x603f('0x2f')](_0x603f('0x25'),_0x603f('0x30')),controller[_0x603f('0x31')]);router[_0x603f('0x2e')](_0x603f('0x24'),auth['isAuthenticated'](),controller[_0x603f('0x32')]);module[_0x603f('0x33')]=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index f3b0f1d..80f38a6 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 _0x6632=['sequelize','exports','TEXT','medium','BOOLEAN','INTEGER'];(function(_0x55abaa,_0x2f2841){var _0x2782b4=function(_0x28dec9){while(--_0x28dec9){_0x55abaa['push'](_0x55abaa['shift']());}};_0x2782b4(++_0x2f2841);}(_0x6632,0x168));var _0x2663=function(_0x1d496c,_0xaa8e94){_0x1d496c=_0x1d496c-0x0;var _0x5de8ec=_0x6632[_0x1d496c];return _0x5de8ec;};'use strict';var Sequelize=require(_0x2663('0x0'));module[_0x2663('0x1')]={'body':{'type':Sequelize[_0x2663('0x2')](_0x2663('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x2663('0x4')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x2663('0x5')]}}; \ No newline at end of file +var _0xc2f6=['INTEGER','sequelize','TEXT','medium','BOOLEAN'];(function(_0x5e2437,_0x3e2d19){var _0x38324b=function(_0x3d12ab){while(--_0x3d12ab){_0x5e2437['push'](_0x5e2437['shift']());}};_0x38324b(++_0x3e2d19);}(_0xc2f6,0x11e));var _0x6c2f=function(_0x5e49cf,_0x3a27bc){_0x5e49cf=_0x5e49cf-0x0;var _0x7bb9db=_0xc2f6[_0x5e49cf];return _0x7bb9db;};'use strict';var Sequelize=require(_0x6c2f('0x0'));module['exports']={'body':{'type':Sequelize[_0x6c2f('0x1')](_0x6c2f('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x6c2f('0x3')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x6c2f('0x4')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index 5596bd4..eba1ac7 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 _0xa5af=['include','options','find','create','body','catch','params','describe','get','messages','lastMessage','format','YYYY-MM-DD\x20HH:mm:ss','getUsers','User','agent','admin','role','userpic','internal','online','lastLoginAt','allowmessenger','showWebBar','-online','VoiceQueue','VoiceQueues','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','isEmpty','resourceId','push','FromId','ToId','-createdAt','all','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./chatInternalMessage.socket','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','end','sendStatus','error','stack','name','send','index','map','ChatInternalMessage','rawAttributes','fieldName','type','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','includeAll','findAll','rows','show','keys'];(function(_0x22265b,_0x398b59){var _0x332d4d=function(_0x3a4569){while(--_0x3a4569){_0x22265b['push'](_0x22265b['shift']());}};_0x332d4d(++_0x398b59);}(_0xa5af,0x104));var _0xfa5a=function(_0x3b0beb,_0x115222){_0x3b0beb=_0x3b0beb-0x0;var _0x47f9d9=_0xa5af[_0x3b0beb];return _0x47f9d9;};'use strict';var emlformat=require(_0xfa5a('0x0'));var rimraf=require(_0xfa5a('0x1'));var zipdir=require(_0xfa5a('0x2'));var jsonpatch=require(_0xfa5a('0x3'));var rp=require(_0xfa5a('0x4'));var moment=require(_0xfa5a('0x5'));var BPromise=require(_0xfa5a('0x6'));var Mustache=require(_0xfa5a('0x7'));var util=require(_0xfa5a('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0xfa5a('0x9'));var ejs=require(_0xfa5a('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfa5a('0xb'));var squel=require(_0xfa5a('0xc'));var crypto=require(_0xfa5a('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xfa5a('0x9'));var querystring=require(_0xfa5a('0xe'));var Papa=require(_0xfa5a('0xf'));var Redis=require('ioredis');var authService=require(_0xfa5a('0x10'));var qs=require(_0xfa5a('0x11'));var as=require(_0xfa5a('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xfa5a('0x13'))('api');var utils=require('../../config/utils');var config=require(_0xfa5a('0x14'));var licenseUtil=require(_0xfa5a('0x15'));var db=require(_0xfa5a('0x16'))['db'];config[_0xfa5a('0x17')]=_[_0xfa5a('0x18')](config[_0xfa5a('0x17')],{'host':_0xfa5a('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xfa5a('0x17')]));require(_0xfa5a('0x1a'))['register'](socket);function respondWithStatusCode(_0x3e9758,_0x5b3f42){_0x5b3f42=_0x5b3f42||0xcc;return function(_0x245d83){if(_0x245d83){return _0x3e9758['sendStatus'](_0x5b3f42);}return _0x3e9758[_0xfa5a('0x1b')](_0x5b3f42)['end']();};}function respondWithResult(_0xcc1747,_0x18e112){_0x18e112=_0x18e112||0xc8;return function(_0xe5ee84){if(_0xe5ee84){return _0xcc1747['status'](_0x18e112)[_0xfa5a('0x1c')](_0xe5ee84);}};}function respondWithFilteredResult(_0x5d5659,_0x506bca){return function(_0x26b41a){if(_0x26b41a){var _0x1964b6=typeof _0x506bca[_0xfa5a('0x1d')]===_0xfa5a('0x1e')&&typeof _0x506bca[_0xfa5a('0x1f')]===_0xfa5a('0x1e');var _0x4d28ef=_0x26b41a[_0xfa5a('0x20')];var _0x60fa29=_0x1964b6?0x0:_0x506bca[_0xfa5a('0x1d')];var _0x1bab8a=_0x1964b6?_0x26b41a['count']:_0x506bca[_0xfa5a('0x1d')]+_0x506bca['limit'];var _0x40aceb;if(_0x1bab8a>=_0x4d28ef){_0x1bab8a=_0x4d28ef;_0x40aceb=0xc8;}else{_0x40aceb=0xce;}_0x5d5659['status'](_0x40aceb);return _0x5d5659['set'](_0xfa5a('0x21'),_0x60fa29+'-'+_0x1bab8a+'/'+_0x4d28ef)[_0xfa5a('0x1c')](_0x26b41a);}return null;};}function patchUpdates(_0x18911a){return function(_0x46ffe6){try{jsonpatch[_0xfa5a('0x22')](_0x46ffe6,_0x18911a,!![]);}catch(_0x4fe933){return BPromise[_0xfa5a('0x23')](_0x4fe933);}return _0x46ffe6[_0xfa5a('0x24')]();};}function saveUpdates(_0x3b4abd,_0x3b1c3d){return function(_0x23b24e){if(_0x23b24e){return _0x23b24e[_0xfa5a('0x25')](_0x3b4abd)[_0xfa5a('0x26')](function(_0x85eedb){return _0x85eedb;});}return null;};}function removeEntity(_0x59e6a2,_0xbc7cac){return function(_0x5c2e50){if(_0x5c2e50){return _0x5c2e50[_0xfa5a('0x27')]()[_0xfa5a('0x26')](function(){_0x59e6a2[_0xfa5a('0x1b')](0xcc)[_0xfa5a('0x28')]();});}};}function handleEntityNotFound(_0x3877e9,_0x5475e0){return function(_0x5ffba9){if(!_0x5ffba9){_0x3877e9[_0xfa5a('0x29')](0x194);}return _0x5ffba9;};}function handleError(_0x265229,_0x23a912){_0x23a912=_0x23a912||0x1f4;return function(_0x25a0fd){logger[_0xfa5a('0x2a')](_0x25a0fd[_0xfa5a('0x2b')]);if(_0x25a0fd[_0xfa5a('0x2c')]){delete _0x25a0fd[_0xfa5a('0x2c')];}_0x265229[_0xfa5a('0x1b')](_0x23a912)[_0xfa5a('0x2d')](_0x25a0fd);};}exports[_0xfa5a('0x2e')]=function(_0x17ff99,_0x382cc0){var _0x4e2cd2={},_0x13d5aa={},_0x23dfb5={'count':0x0,'rows':[]};var _0x58e36e=_[_0xfa5a('0x2f')](db[_0xfa5a('0x30')][_0xfa5a('0x31')],function(_0xf0711f){return{'name':_0xf0711f[_0xfa5a('0x32')],'type':_0xf0711f[_0xfa5a('0x33')]['key']};});_0x13d5aa[_0xfa5a('0x34')]=_['map'](_0x58e36e,_0xfa5a('0x2c'));_0x13d5aa[_0xfa5a('0x35')]=_['keys'](_0x17ff99['query']);_0x13d5aa['filters']=_[_0xfa5a('0x36')](_0x13d5aa[_0xfa5a('0x34')],_0x13d5aa['query']);_0x4e2cd2[_0xfa5a('0x37')]=_[_0xfa5a('0x36')](_0x13d5aa[_0xfa5a('0x34')],qs[_0xfa5a('0x38')](_0x17ff99[_0xfa5a('0x35')][_0xfa5a('0x38')]));_0x4e2cd2[_0xfa5a('0x37')]=_0x4e2cd2['attributes'][_0xfa5a('0x39')]?_0x4e2cd2['attributes']:_0x13d5aa['model'];if(!_0x17ff99[_0xfa5a('0x35')][_0xfa5a('0x3a')](_0xfa5a('0x3b'))){_0x4e2cd2['limit']=qs[_0xfa5a('0x1f')](_0x17ff99['query'][_0xfa5a('0x1f')]);_0x4e2cd2[_0xfa5a('0x1d')]=qs[_0xfa5a('0x1d')](_0x17ff99[_0xfa5a('0x35')][_0xfa5a('0x1d')]);}_0x4e2cd2[_0xfa5a('0x3c')]=qs[_0xfa5a('0x3d')](_0x17ff99[_0xfa5a('0x35')][_0xfa5a('0x3d')]);_0x4e2cd2['where']=qs[_0xfa5a('0x3e')](_[_0xfa5a('0x3f')](_0x17ff99[_0xfa5a('0x35')],_0x13d5aa[_0xfa5a('0x3e')]),_0x58e36e);if(_0x17ff99['query'][_0xfa5a('0x40')]){_0x4e2cd2[_0xfa5a('0x41')]=_[_0xfa5a('0x42')](_0x4e2cd2['where'],{'$or':_[_0xfa5a('0x2f')](_0x58e36e,function(_0x19a640){if(_0x19a640['type']!==_0xfa5a('0x43')){var _0x22c5b4={};_0x22c5b4[_0x19a640[_0xfa5a('0x2c')]]={'$like':'%'+_0x17ff99['query']['filter']+'%'};return _0x22c5b4;}})});}_0x4e2cd2=_[_0xfa5a('0x42')]({},_0x4e2cd2,_0x17ff99['options']);var _0x42ffe3={'where':_0x4e2cd2[_0xfa5a('0x41')]};return db[_0xfa5a('0x30')][_0xfa5a('0x20')](_0x42ffe3)[_0xfa5a('0x26')](function(_0x374397){_0x23dfb5['count']=_0x374397;if(_0x17ff99['query'][_0xfa5a('0x44')]){_0x4e2cd2['include']=[{'all':!![]}];}return db[_0xfa5a('0x30')][_0xfa5a('0x45')](_0x4e2cd2);})['then'](function(_0x5c41ed){_0x23dfb5[_0xfa5a('0x46')]=_0x5c41ed;return _0x23dfb5;})[_0xfa5a('0x26')](respondWithFilteredResult(_0x382cc0,_0x4e2cd2))['catch'](handleError(_0x382cc0,null));};exports[_0xfa5a('0x47')]=function(_0x10c7cc,_0x3064b2){var _0x158f22={'raw':!![],'where':{'id':_0x10c7cc['params']['id']}},_0x34c7c3={};_0x34c7c3[_0xfa5a('0x34')]=_[_0xfa5a('0x48')](db[_0xfa5a('0x30')][_0xfa5a('0x31')]);_0x34c7c3[_0xfa5a('0x35')]=_[_0xfa5a('0x48')](_0x10c7cc[_0xfa5a('0x35')]);_0x34c7c3[_0xfa5a('0x3e')]=_[_0xfa5a('0x36')](_0x34c7c3[_0xfa5a('0x34')],_0x34c7c3[_0xfa5a('0x35')]);_0x158f22[_0xfa5a('0x37')]=_[_0xfa5a('0x36')](_0x34c7c3[_0xfa5a('0x34')],qs[_0xfa5a('0x38')](_0x10c7cc[_0xfa5a('0x35')]['fields']));_0x158f22[_0xfa5a('0x37')]=_0x158f22[_0xfa5a('0x37')][_0xfa5a('0x39')]?_0x158f22[_0xfa5a('0x37')]:_0x34c7c3[_0xfa5a('0x34')];if(_0x10c7cc[_0xfa5a('0x35')][_0xfa5a('0x44')]){_0x158f22[_0xfa5a('0x49')]=[{'all':!![]}];}_0x158f22=_[_0xfa5a('0x42')]({},_0x158f22,_0x10c7cc[_0xfa5a('0x4a')]);return db[_0xfa5a('0x30')][_0xfa5a('0x4b')](_0x158f22)[_0xfa5a('0x26')](handleEntityNotFound(_0x3064b2,null))[_0xfa5a('0x26')](respondWithResult(_0x3064b2,null))['catch'](handleError(_0x3064b2,null));};exports[_0xfa5a('0x4c')]=function(_0x129ed8,_0x4879ab){return db[_0xfa5a('0x30')][_0xfa5a('0x4c')](_0x129ed8[_0xfa5a('0x4d')],{})[_0xfa5a('0x26')](respondWithResult(_0x4879ab,0xc9))[_0xfa5a('0x4e')](handleError(_0x4879ab,null));};exports[_0xfa5a('0x25')]=function(_0x79c64,_0x2013ae){if(_0x79c64[_0xfa5a('0x4d')]['id']){delete _0x79c64[_0xfa5a('0x4d')]['id'];}return db['ChatInternalMessage'][_0xfa5a('0x4b')]({'where':{'id':_0x79c64[_0xfa5a('0x4f')]['id']}})['then'](handleEntityNotFound(_0x2013ae,null))['then'](saveUpdates(_0x79c64[_0xfa5a('0x4d')],null))[_0xfa5a('0x26')](respondWithResult(_0x2013ae,null))[_0xfa5a('0x4e')](handleError(_0x2013ae,null));};exports[_0xfa5a('0x27')]=function(_0x4258a6,_0x2a0b5e){return db[_0xfa5a('0x30')][_0xfa5a('0x4b')]({'where':{'id':_0x4258a6['params']['id']}})[_0xfa5a('0x26')](handleEntityNotFound(_0x2a0b5e,null))[_0xfa5a('0x26')](removeEntity(_0x2a0b5e,null))[_0xfa5a('0x4e')](handleError(_0x2a0b5e,null));};exports[_0xfa5a('0x50')]=function(_0x5b5dd6,_0x1adc4b){return db[_0xfa5a('0x30')][_0xfa5a('0x50')]()[_0xfa5a('0x26')](respondWithResult(_0x1adc4b,null))[_0xfa5a('0x4e')](handleError(_0x1adc4b,null));};function wrapUser(_0x56fe5e){return function(_0x5339f4){var _0x366249=_0x56fe5e[_0xfa5a('0x51')]({'plain':!![]});_0x366249[_0xfa5a('0x52')]=[];if(_0x5339f4){_0x366249['lastMessageAt']=_0x5339f4['createdAt'];_0x366249[_0xfa5a('0x53')]=_0x5339f4;}else{_0x366249['lastMessageAt']=moment(0x0)[_0xfa5a('0x54')](_0xfa5a('0x55'));_0x366249[_0xfa5a('0x53')]={};}return _0x366249;};}exports[_0xfa5a('0x56')]=function(_0x256238,_0x1bf9bf,_0x3c5d39){var _0x464788=[];return db[_0xfa5a('0x57')]['findAll']({'where':{'role':[_0xfa5a('0x58'),_0xfa5a('0x59'),'user']},'attributes':['id','fullname',_0xfa5a('0x2c'),_0xfa5a('0x5a'),_0xfa5a('0x5b'),_0xfa5a('0x5c'),_0xfa5a('0x5d'),_0xfa5a('0x5e'),_0xfa5a('0x5f'),_0xfa5a('0x60')],'order':qs[_0xfa5a('0x3d')](_0xfa5a('0x61')),'include':[{'model':db[_0xfa5a('0x62')],'as':_0xfa5a('0x63'),'attributes':['id',_0xfa5a('0x2c'),_0xfa5a('0x33')],'through':{'attributes':[]}}]})[_0xfa5a('0x26')](function(_0x462d08){if(_0x462d08){var _0x10e36b=_0x256238[_0xfa5a('0x64')][_0xfa5a('0x51')]({'plain':!![]});if(!_0x10e36b)throw new Error(_0xfa5a('0x65'));if(_0x10e36b[_0xfa5a('0x5a')]===_0xfa5a('0x64')){return db['UserProfileSection'][_0xfa5a('0x4b')]({'where':{'name':'Agents','userProfileId':_0x10e36b[_0xfa5a('0x66')]},'raw':!![]})[_0xfa5a('0x26')](function(_0xda00fd){if(_0xda00fd){if(_0xda00fd[_0xfa5a('0x67')]===0x0){return db['UserProfileResource'][_0xfa5a('0x45')]({'where':{'sectionId':_0xda00fd['id']},'raw':!![]})[_0xfa5a('0x26')](function(_0x54f328){var _0x247417=[];if(_[_0xfa5a('0x68')](_0x54f328)){_0x247417=_[_0xfa5a('0x40')](_0x462d08,function(_0x709593){if(_0x709593[_0xfa5a('0x5a')]!==_0xfa5a('0x58')){return _0x709593;}});return _0x247417;}else{for(var _0x1b5e70=0x0;_0x1b5e70<_0x462d08[_0xfa5a('0x39')];_0x1b5e70++){var _0xace185=_0x462d08[_0x1b5e70];if(_0xace185[_0xfa5a('0x5a')]===_0xfa5a('0x58')){var _0x11e78e=_[_0xfa5a('0x4b')](_0x54f328,function(_0x3104c){return _0x3104c[_0xfa5a('0x69')]===_0xace185['id'];});if(_0x11e78e)_0x247417[_0xfa5a('0x6a')](_0xace185);}else{_0x247417[_0xfa5a('0x6a')](_0xace185);}}return _0x247417;}});}else{return _0x462d08;}}else{var _0x35584c=_[_0xfa5a('0x40')](_0x462d08,function(_0xd25101){if(_0xd25101[_0xfa5a('0x5a')]!==_0xfa5a('0x58')){return _0xd25101;}});return _0x35584c;}});}else{return _0x462d08;}}})[_0xfa5a('0x26')](function(_0x32fd18){var _0x4df72e=[];if(_0x32fd18){_0x464788=_0x32fd18;for(var _0x527b82=0x0;_0x527b82<_0x32fd18['length'];_0x527b82+=0x1){_0x464788[_0x527b82][_0xfa5a('0x52')]=[];_0x4df72e[_0xfa5a('0x6a')](db[_0xfa5a('0x30')][_0xfa5a('0x4b')]({'where':{'FromId':[_0x256238['user']['id'],_0x32fd18[_0x527b82]['id']],'ToId':[_0x256238['user']['id'],_0x32fd18[_0x527b82]['id']],'ChatGroupId':null},'attributes':['id','createdAt',_0xfa5a('0x6b'),_0xfa5a('0x6c'),'read',_0xfa5a('0x4d')],'order':qs['sort'](_0xfa5a('0x6d')),'limit':0x1,'offset':0x0,'raw':!![]})[_0xfa5a('0x26')](wrapUser(_0x32fd18[_0x527b82])));}return BPromise[_0xfa5a('0x6e')](_0x4df72e);}return[];})[_0xfa5a('0x26')](function(_0x3c67e6){return{'rows':_0x3c67e6,'count':_0x3c67e6[_0xfa5a('0x39')]};})[_0xfa5a('0x26')](respondWithResult(_0x1bf9bf,null))['catch'](handleError(_0x1bf9bf,null));}; \ No newline at end of file +var _0xe5f1=['map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','options','includeAll','findAll','rows','show','params','length','include','find','create','body','catch','describe','get','messages','lastMessageAt','createdAt','format','YYYY-MM-DD\x20HH:mm:ss','getUsers','agent','admin','user','fullname','role','lastLoginAt','allowmessenger','showWebBar','-online','VoiceQueue','UserProfileSection','Agents','userProfileId','UserProfileResource','isEmpty','push','FromId','ToId','-createdAt','all','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','fs-extra','lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','defaults','localhost','redis','./chatInternalMessage.socket','register','sendStatus','status','json','offset','limit','undefined','count','Content-Range','save','update','then','destroy','end','error','stack','name','send','index','ChatInternalMessage','rawAttributes','fieldName','key','model'];(function(_0x4a2052,_0x1780c5){var _0x1749b0=function(_0x4f0332){while(--_0x4f0332){_0x4a2052['push'](_0x4a2052['shift']());}};_0x1749b0(++_0x1780c5);}(_0xe5f1,0xa2));var _0x1e5f=function(_0x48a45c,_0x3c0565){_0x48a45c=_0x48a45c-0x0;var _0x4f9dc5=_0xe5f1[_0x48a45c];return _0x4f9dc5;};'use strict';var emlformat=require(_0x1e5f('0x0'));var rimraf=require(_0x1e5f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1e5f('0x2'));var rp=require(_0x1e5f('0x3'));var moment=require(_0x1e5f('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x1e5f('0x5'));var util=require('util');var path=require(_0x1e5f('0x6'));var sox=require(_0x1e5f('0x7'));var csv=require(_0x1e5f('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1e5f('0x9'));var _=require(_0x1e5f('0xa'));var squel=require(_0x1e5f('0xb'));var crypto=require('crypto');var jsforce=require(_0x1e5f('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x1e5f('0x8'));var querystring=require(_0x1e5f('0xd'));var Papa=require(_0x1e5f('0xe'));var Redis=require('ioredis');var authService=require(_0x1e5f('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x1e5f('0x10'));var hardwareService=require(_0x1e5f('0x11'));var logger=require(_0x1e5f('0x12'))(_0x1e5f('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x1e5f('0x14'));var db=require(_0x1e5f('0x15'))['db'];config['redis']=_[_0x1e5f('0x16')](config['redis'],{'host':_0x1e5f('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1e5f('0x18')]));require(_0x1e5f('0x19'))[_0x1e5f('0x1a')](socket);function respondWithStatusCode(_0x3030be,_0xe4c6ab){_0xe4c6ab=_0xe4c6ab||0xcc;return function(_0x2ff0e6){if(_0x2ff0e6){return _0x3030be[_0x1e5f('0x1b')](_0xe4c6ab);}return _0x3030be[_0x1e5f('0x1c')](_0xe4c6ab)['end']();};}function respondWithResult(_0x2eb979,_0x3b0111){_0x3b0111=_0x3b0111||0xc8;return function(_0x2ff4cc){if(_0x2ff4cc){return _0x2eb979['status'](_0x3b0111)[_0x1e5f('0x1d')](_0x2ff4cc);}};}function respondWithFilteredResult(_0x1a5c15,_0x47ff61){return function(_0x411d42){if(_0x411d42){var _0x122e80=typeof _0x47ff61[_0x1e5f('0x1e')]==='undefined'&&typeof _0x47ff61[_0x1e5f('0x1f')]===_0x1e5f('0x20');var _0xfc4a3a=_0x411d42[_0x1e5f('0x21')];var _0x3cc73b=_0x122e80?0x0:_0x47ff61['offset'];var _0x321d24=_0x122e80?_0x411d42[_0x1e5f('0x21')]:_0x47ff61['offset']+_0x47ff61[_0x1e5f('0x1f')];var _0x1cb509;if(_0x321d24>=_0xfc4a3a){_0x321d24=_0xfc4a3a;_0x1cb509=0xc8;}else{_0x1cb509=0xce;}_0x1a5c15[_0x1e5f('0x1c')](_0x1cb509);return _0x1a5c15['set'](_0x1e5f('0x22'),_0x3cc73b+'-'+_0x321d24+'/'+_0xfc4a3a)[_0x1e5f('0x1d')](_0x411d42);}return null;};}function patchUpdates(_0x2627da){return function(_0x1b3c3a){try{jsonpatch['apply'](_0x1b3c3a,_0x2627da,!![]);}catch(_0x187b23){return BPromise['reject'](_0x187b23);}return _0x1b3c3a[_0x1e5f('0x23')]();};}function saveUpdates(_0xd6abbb,_0xe67fa4){return function(_0x53f96b){if(_0x53f96b){return _0x53f96b[_0x1e5f('0x24')](_0xd6abbb)[_0x1e5f('0x25')](function(_0x10a2c1){return _0x10a2c1;});}return null;};}function removeEntity(_0x4b6946,_0x53edca){return function(_0x35e651){if(_0x35e651){return _0x35e651[_0x1e5f('0x26')]()['then'](function(){_0x4b6946[_0x1e5f('0x1c')](0xcc)[_0x1e5f('0x27')]();});}};}function handleEntityNotFound(_0x309bb0,_0xef8c41){return function(_0x2bcc03){if(!_0x2bcc03){_0x309bb0[_0x1e5f('0x1b')](0x194);}return _0x2bcc03;};}function handleError(_0x403b34,_0x234562){_0x234562=_0x234562||0x1f4;return function(_0x4c7bc7){logger[_0x1e5f('0x28')](_0x4c7bc7[_0x1e5f('0x29')]);if(_0x4c7bc7[_0x1e5f('0x2a')]){delete _0x4c7bc7[_0x1e5f('0x2a')];}_0x403b34[_0x1e5f('0x1c')](_0x234562)[_0x1e5f('0x2b')](_0x4c7bc7);};}exports[_0x1e5f('0x2c')]=function(_0x4d8c2d,_0x5c78d2){var _0x47a913={},_0x161d08={},_0x495a94={'count':0x0,'rows':[]};var _0x407771=_['map'](db[_0x1e5f('0x2d')][_0x1e5f('0x2e')],function(_0x45c8fb){return{'name':_0x45c8fb[_0x1e5f('0x2f')],'type':_0x45c8fb['type'][_0x1e5f('0x30')]};});_0x161d08[_0x1e5f('0x31')]=_[_0x1e5f('0x32')](_0x407771,'name');_0x161d08[_0x1e5f('0x33')]=_[_0x1e5f('0x34')](_0x4d8c2d[_0x1e5f('0x33')]);_0x161d08[_0x1e5f('0x35')]=_[_0x1e5f('0x36')](_0x161d08['model'],_0x161d08['query']);_0x47a913[_0x1e5f('0x37')]=_[_0x1e5f('0x36')](_0x161d08[_0x1e5f('0x31')],qs[_0x1e5f('0x38')](_0x4d8c2d[_0x1e5f('0x33')][_0x1e5f('0x38')]));_0x47a913[_0x1e5f('0x37')]=_0x47a913[_0x1e5f('0x37')]['length']?_0x47a913['attributes']:_0x161d08[_0x1e5f('0x31')];if(!_0x4d8c2d['query'][_0x1e5f('0x39')](_0x1e5f('0x3a'))){_0x47a913[_0x1e5f('0x1f')]=qs['limit'](_0x4d8c2d[_0x1e5f('0x33')]['limit']);_0x47a913[_0x1e5f('0x1e')]=qs[_0x1e5f('0x1e')](_0x4d8c2d['query'][_0x1e5f('0x1e')]);}_0x47a913[_0x1e5f('0x3b')]=qs[_0x1e5f('0x3c')](_0x4d8c2d['query'][_0x1e5f('0x3c')]);_0x47a913[_0x1e5f('0x3d')]=qs[_0x1e5f('0x35')](_[_0x1e5f('0x3e')](_0x4d8c2d[_0x1e5f('0x33')],_0x161d08[_0x1e5f('0x35')]),_0x407771);if(_0x4d8c2d['query'][_0x1e5f('0x3f')]){_0x47a913[_0x1e5f('0x3d')]=_[_0x1e5f('0x40')](_0x47a913[_0x1e5f('0x3d')],{'$or':_[_0x1e5f('0x32')](_0x407771,function(_0x51d458){if(_0x51d458[_0x1e5f('0x41')]!=='VIRTUAL'){var _0x551620={};_0x551620[_0x51d458[_0x1e5f('0x2a')]]={'$like':'%'+_0x4d8c2d[_0x1e5f('0x33')]['filter']+'%'};return _0x551620;}})});}_0x47a913=_[_0x1e5f('0x40')]({},_0x47a913,_0x4d8c2d[_0x1e5f('0x42')]);var _0xe1db4b={'where':_0x47a913[_0x1e5f('0x3d')]};return db[_0x1e5f('0x2d')]['count'](_0xe1db4b)[_0x1e5f('0x25')](function(_0x43e965){_0x495a94[_0x1e5f('0x21')]=_0x43e965;if(_0x4d8c2d['query'][_0x1e5f('0x43')]){_0x47a913['include']=[{'all':!![]}];}return db[_0x1e5f('0x2d')][_0x1e5f('0x44')](_0x47a913);})[_0x1e5f('0x25')](function(_0x2f2946){_0x495a94[_0x1e5f('0x45')]=_0x2f2946;return _0x495a94;})[_0x1e5f('0x25')](respondWithFilteredResult(_0x5c78d2,_0x47a913))['catch'](handleError(_0x5c78d2,null));};exports[_0x1e5f('0x46')]=function(_0x33574c,_0x186ece){var _0x4b0704={'raw':!![],'where':{'id':_0x33574c[_0x1e5f('0x47')]['id']}},_0x35282e={};_0x35282e[_0x1e5f('0x31')]=_[_0x1e5f('0x34')](db[_0x1e5f('0x2d')]['rawAttributes']);_0x35282e['query']=_[_0x1e5f('0x34')](_0x33574c[_0x1e5f('0x33')]);_0x35282e['filters']=_[_0x1e5f('0x36')](_0x35282e[_0x1e5f('0x31')],_0x35282e[_0x1e5f('0x33')]);_0x4b0704['attributes']=_[_0x1e5f('0x36')](_0x35282e[_0x1e5f('0x31')],qs[_0x1e5f('0x38')](_0x33574c['query'][_0x1e5f('0x38')]));_0x4b0704['attributes']=_0x4b0704['attributes'][_0x1e5f('0x48')]?_0x4b0704[_0x1e5f('0x37')]:_0x35282e['model'];if(_0x33574c['query']['includeAll']){_0x4b0704[_0x1e5f('0x49')]=[{'all':!![]}];}_0x4b0704=_[_0x1e5f('0x40')]({},_0x4b0704,_0x33574c['options']);return db[_0x1e5f('0x2d')][_0x1e5f('0x4a')](_0x4b0704)['then'](handleEntityNotFound(_0x186ece,null))[_0x1e5f('0x25')](respondWithResult(_0x186ece,null))['catch'](handleError(_0x186ece,null));};exports['create']=function(_0x30dbb5,_0x2c8ed1){return db[_0x1e5f('0x2d')][_0x1e5f('0x4b')](_0x30dbb5[_0x1e5f('0x4c')],{})['then'](respondWithResult(_0x2c8ed1,0xc9))[_0x1e5f('0x4d')](handleError(_0x2c8ed1,null));};exports[_0x1e5f('0x24')]=function(_0x151681,_0x3cde17){if(_0x151681[_0x1e5f('0x4c')]['id']){delete _0x151681[_0x1e5f('0x4c')]['id'];}return db[_0x1e5f('0x2d')]['find']({'where':{'id':_0x151681[_0x1e5f('0x47')]['id']}})[_0x1e5f('0x25')](handleEntityNotFound(_0x3cde17,null))['then'](saveUpdates(_0x151681[_0x1e5f('0x4c')],null))[_0x1e5f('0x25')](respondWithResult(_0x3cde17,null))[_0x1e5f('0x4d')](handleError(_0x3cde17,null));};exports[_0x1e5f('0x26')]=function(_0x1da5e1,_0x3b162b){return db['ChatInternalMessage'][_0x1e5f('0x4a')]({'where':{'id':_0x1da5e1['params']['id']}})[_0x1e5f('0x25')](handleEntityNotFound(_0x3b162b,null))[_0x1e5f('0x25')](removeEntity(_0x3b162b,null))[_0x1e5f('0x4d')](handleError(_0x3b162b,null));};exports[_0x1e5f('0x4e')]=function(_0x2329e2,_0x5e30a8){return db[_0x1e5f('0x2d')][_0x1e5f('0x4e')]()['then'](respondWithResult(_0x5e30a8,null))[_0x1e5f('0x4d')](handleError(_0x5e30a8,null));};function wrapUser(_0x266249){return function(_0x3f9349){var _0x4bcb90=_0x266249[_0x1e5f('0x4f')]({'plain':!![]});_0x4bcb90[_0x1e5f('0x50')]=[];if(_0x3f9349){_0x4bcb90[_0x1e5f('0x51')]=_0x3f9349[_0x1e5f('0x52')];_0x4bcb90['lastMessage']=_0x3f9349;}else{_0x4bcb90[_0x1e5f('0x51')]=moment(0x0)[_0x1e5f('0x53')](_0x1e5f('0x54'));_0x4bcb90['lastMessage']={};}return _0x4bcb90;};}exports[_0x1e5f('0x55')]=function(_0x142014,_0x47706a,_0x47a144){var _0x5a7d52=[];return db['User'][_0x1e5f('0x44')]({'where':{'role':[_0x1e5f('0x56'),_0x1e5f('0x57'),_0x1e5f('0x58')]},'attributes':['id',_0x1e5f('0x59'),_0x1e5f('0x2a'),_0x1e5f('0x5a'),'userpic','internal','online',_0x1e5f('0x5b'),_0x1e5f('0x5c'),_0x1e5f('0x5d')],'order':qs[_0x1e5f('0x3c')](_0x1e5f('0x5e')),'include':[{'model':db[_0x1e5f('0x5f')],'as':'VoiceQueues','attributes':['id',_0x1e5f('0x2a'),_0x1e5f('0x41')],'through':{'attributes':[]}}]})['then'](function(_0x84b6e6){if(_0x84b6e6){var _0x255050=_0x142014[_0x1e5f('0x58')][_0x1e5f('0x4f')]({'plain':!![]});if(!_0x255050)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x255050['role']===_0x1e5f('0x58')){return db[_0x1e5f('0x60')][_0x1e5f('0x4a')]({'where':{'name':_0x1e5f('0x61'),'userProfileId':_0x255050[_0x1e5f('0x62')]},'raw':!![]})['then'](function(_0x24853f){if(_0x24853f){if(_0x24853f['autoAssociation']===0x0){return db[_0x1e5f('0x63')]['findAll']({'where':{'sectionId':_0x24853f['id']},'raw':!![]})['then'](function(_0x3f1d48){var _0x45b216=[];if(_[_0x1e5f('0x64')](_0x3f1d48)){_0x45b216=_[_0x1e5f('0x3f')](_0x84b6e6,function(_0x5f093d){if(_0x5f093d[_0x1e5f('0x5a')]!=='agent'){return _0x5f093d;}});return _0x45b216;}else{for(var _0x1e2495=0x0;_0x1e2495<_0x84b6e6[_0x1e5f('0x48')];_0x1e2495++){var _0x3f2dca=_0x84b6e6[_0x1e2495];if(_0x3f2dca[_0x1e5f('0x5a')]==='agent'){var _0x2a4486=_[_0x1e5f('0x4a')](_0x3f1d48,function(_0x256b4a){return _0x256b4a['resourceId']===_0x3f2dca['id'];});if(_0x2a4486)_0x45b216['push'](_0x3f2dca);}else{_0x45b216[_0x1e5f('0x65')](_0x3f2dca);}}return _0x45b216;}});}else{return _0x84b6e6;}}else{var _0x222f8d=_[_0x1e5f('0x3f')](_0x84b6e6,function(_0x15e1b2){if(_0x15e1b2[_0x1e5f('0x5a')]!==_0x1e5f('0x56')){return _0x15e1b2;}});return _0x222f8d;}});}else{return _0x84b6e6;}}})[_0x1e5f('0x25')](function(_0x10e686){var _0x25c06b=[];if(_0x10e686){_0x5a7d52=_0x10e686;for(var _0x53f618=0x0;_0x53f618<_0x10e686[_0x1e5f('0x48')];_0x53f618+=0x1){_0x5a7d52[_0x53f618]['messages']=[];_0x25c06b[_0x1e5f('0x65')](db[_0x1e5f('0x2d')][_0x1e5f('0x4a')]({'where':{'FromId':[_0x142014['user']['id'],_0x10e686[_0x53f618]['id']],'ToId':[_0x142014[_0x1e5f('0x58')]['id'],_0x10e686[_0x53f618]['id']],'ChatGroupId':null},'attributes':['id',_0x1e5f('0x52'),_0x1e5f('0x66'),_0x1e5f('0x67'),'read',_0x1e5f('0x4c')],'order':qs['sort'](_0x1e5f('0x68')),'limit':0x1,'offset':0x0,'raw':!![]})[_0x1e5f('0x25')](wrapUser(_0x10e686[_0x53f618])));}return BPromise[_0x1e5f('0x69')](_0x25c06b);}return[];})['then'](function(_0x2bd6c0){return{'rows':_0x2bd6c0,'count':_0x2bd6c0['length']};})[_0x1e5f('0x25')](respondWithResult(_0x47706a,null))[_0x1e5f('0x4d')](handleError(_0x47706a,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index 9331966..8910ba9 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 _0x4ec0=['update','remove','emit','hasOwnProperty','hook','exports','events','ChatInternalMessage','save'];(function(_0xd351a2,_0xe53b2d){var _0x2982b6=function(_0xef2152){while(--_0xef2152){_0xd351a2['push'](_0xd351a2['shift']());}};_0x2982b6(++_0xe53b2d);}(_0x4ec0,0x11d));var _0x04ec=function(_0x3b1a47,_0x93317e){_0x3b1a47=_0x3b1a47-0x0;var _0x2a59d2=_0x4ec0[_0x3b1a47];return _0x2a59d2;};'use strict';var EventEmitter=require(_0x04ec('0x0'));var ChatInternalMessage=require('../../mysqldb')['db'][_0x04ec('0x1')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x04ec('0x2'),'afterUpdate':_0x04ec('0x3'),'afterDestroy':_0x04ec('0x4')};function emitEvent(_0x48fb06){return function(_0x10325f,_0x468764,_0x5c111c){ChatInternalMessageEvents[_0x04ec('0x5')](_0x48fb06+':'+_0x10325f['id'],_0x10325f);ChatInternalMessageEvents[_0x04ec('0x5')](_0x48fb06,_0x10325f);_0x5c111c(null);};}for(var e in events){if(events[_0x04ec('0x6')](e)){var event=events[e];ChatInternalMessage[_0x04ec('0x7')](e,emitEvent(event));}}module[_0x04ec('0x8')]=ChatInternalMessageEvents; \ No newline at end of file +var _0x1afc=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb'];(function(_0x349a6a,_0x291b2a){var _0x3f6577=function(_0x384071){while(--_0x384071){_0x349a6a['push'](_0x349a6a['shift']());}};_0x3f6577(++_0x291b2a);}(_0x1afc,0xce));var _0xc1af=function(_0x542d2e,_0x4d4e8a){_0x542d2e=_0x542d2e-0x0;var _0x2f66e3=_0x1afc[_0x542d2e];return _0x2f66e3;};'use strict';var EventEmitter=require('events');var ChatInternalMessage=require(_0xc1af('0x0'))['db']['ChatInternalMessage'];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0xc1af('0x1')](0x0);var events={'afterCreate':_0xc1af('0x2'),'afterUpdate':_0xc1af('0x3'),'afterDestroy':_0xc1af('0x4')};function emitEvent(_0x48d535){return function(_0x1828d2,_0x2e5f40,_0x3e7b58){ChatInternalMessageEvents[_0xc1af('0x5')](_0x48d535+':'+_0x1828d2['id'],_0x1828d2);ChatInternalMessageEvents[_0xc1af('0x5')](_0x48d535,_0x1828d2);_0x3e7b58(null);};}for(var e in events){if(events[_0xc1af('0x6')](e)){var event=events[e];ChatInternalMessage[_0xc1af('0x7')](e,emitEvent(event));}}module[_0xc1af('0x8')]=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index 4e46171..ce9cd57 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 _0x5bd6=['../../config/logger','api','moment','request-promise','path','rimraf','./chatInternalMessage.attributes','define','ChatInternalMessage','utf8mb4_unicode_ci','lodash'];(function(_0x51fa38,_0x86f463){var _0x25da73=function(_0x4f5f8c){while(--_0x4f5f8c){_0x51fa38['push'](_0x51fa38['shift']());}};_0x25da73(++_0x86f463);}(_0x5bd6,0x1d8));var _0x65bd=function(_0x413b4d,_0xa3459c){_0x413b4d=_0x413b4d-0x0;var _0x8b810a=_0x5bd6[_0x413b4d];return _0x8b810a;};'use strict';var _=require(_0x65bd('0x0'));var util=require('util');var logger=require(_0x65bd('0x1'))(_0x65bd('0x2'));var moment=require(_0x65bd('0x3'));var BPromise=require('bluebird');var rp=require(_0x65bd('0x4'));var fs=require('fs');var path=require(_0x65bd('0x5'));var rimraf=require(_0x65bd('0x6'));var config=require('../../config/environment');var attributes=require(_0x65bd('0x7'));module['exports']=function(_0x425d93,_0x2dcd42){return _0x425d93[_0x65bd('0x8')](_0x65bd('0x9'),attributes,{'tableName':'chat_internal_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x65bd('0xa')});}; \ No newline at end of file +var _0xfda4=['ChatInternalMessage','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','rimraf','../../config/environment','./chatInternalMessage.attributes','exports','define'];(function(_0x31eb67,_0x9bc8c0){var _0x2a8cb8=function(_0xac1c5d){while(--_0xac1c5d){_0x31eb67['push'](_0x31eb67['shift']());}};_0x2a8cb8(++_0x9bc8c0);}(_0xfda4,0x78));var _0x4fda=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0xfda4[_0x68c979];return _0x4f0001;};'use strict';var _=require(_0x4fda('0x0'));var util=require(_0x4fda('0x1'));var logger=require('../../config/logger')(_0x4fda('0x2'));var moment=require(_0x4fda('0x3'));var BPromise=require(_0x4fda('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x4fda('0x5'));var config=require(_0x4fda('0x6'));var attributes=require(_0x4fda('0x7'));module[_0x4fda('0x8')]=function(_0x4d3611,_0x4d2590){return _0x4d3611[_0x4fda('0x9')](_0x4fda('0xa'),attributes,{'tableName':'chat_internal_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x4fda('0xb'),'collate':_0x4fda('0xc')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index 85814f3..9f31fbc 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 _0xb077=['ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','request','then','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','bluebird','randomstring'];(function(_0x31688a,_0x588c7d){var _0xc7b088=function(_0x3ed4c8){while(--_0x3ed4c8){_0x31688a['push'](_0x31688a['shift']());}};_0xc7b088(++_0x588c7d);}(_0xb077,0x7f));var _0x7b07=function(_0x36e31c,_0x3c562f){_0x36e31c=_0x36e31c-0x0;var _0x124b00=_0xb077[_0x36e31c];return _0x124b00;};'use strict';var _=require('lodash');var util=require(_0x7b07('0x0'));var moment=require('moment');var BPromise=require(_0x7b07('0x1'));var rs=require(_0x7b07('0x2'));var fs=require('fs');var Redis=require(_0x7b07('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x7b07('0x4'));var logger=require(_0x7b07('0x5'))(_0x7b07('0x6'));var config=require(_0x7b07('0x7'));var jayson=require(_0x7b07('0x8'));var client=jayson[_0x7b07('0x9')]['http']({'port':0x232a});config[_0x7b07('0xa')]=_[_0x7b07('0xb')](config[_0x7b07('0xa')],{'host':_0x7b07('0xc'),'port':0x18eb});var socket=require(_0x7b07('0xd'))(new Redis(config[_0x7b07('0xa')]));require(_0x7b07('0xe'))['register'](socket);function respondWithRpcPromise(_0x340e44,_0x5e2e91,_0x29e10b){return new BPromise(function(_0x1b06be,_0x55cd79){return client[_0x7b07('0xf')](_0x340e44,_0x29e10b)[_0x7b07('0x10')](function(_0x235f81){logger[_0x7b07('0x11')](_0x7b07('0x12'),_0x5e2e91,_0x7b07('0x13'));logger['debug'](_0x7b07('0x14'),_0x5e2e91,'request\x20sent',JSON[_0x7b07('0x15')](_0x235f81));if(_0x235f81['error']){if(_0x235f81[_0x7b07('0x16')][_0x7b07('0x17')]===0x1f4){logger[_0x7b07('0x16')](_0x7b07('0x12'),_0x5e2e91,_0x235f81['error']['message']);return _0x55cd79(_0x235f81[_0x7b07('0x16')]['message']);}logger[_0x7b07('0x16')](_0x7b07('0x12'),_0x5e2e91,_0x235f81['error'][_0x7b07('0x18')]);return _0x1b06be(_0x235f81['error']['message']);}else{logger['info']('ChatInternalMessage,\x20%s,\x20%s',_0x5e2e91,_0x7b07('0x13'));_0x1b06be(_0x235f81['result'][_0x7b07('0x18')]);}})[_0x7b07('0x19')](function(_0x1cc2aa){logger[_0x7b07('0x16')](_0x7b07('0x12'),_0x5e2e91,_0x1cc2aa);_0x55cd79(_0x1cc2aa);});});} \ No newline at end of file +var _0x27cf=['catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','redis','defaults','socket.io-emitter','./chatInternalMessage.socket','register','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result'];(function(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0x27cf,0x1aa));var _0xf27c=function(_0x5834bc,_0x3d4801){_0x5834bc=_0x5834bc-0x0;var _0x3e183a=_0x27cf[_0x5834bc];return _0x3e183a;};'use strict';var _=require(_0xf27c('0x0'));var util=require(_0xf27c('0x1'));var moment=require(_0xf27c('0x2'));var BPromise=require(_0xf27c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf27c('0x4'));var db=require(_0xf27c('0x5'))['db'];var utils=require(_0xf27c('0x6'));var logger=require(_0xf27c('0x7'))(_0xf27c('0x8'));var config=require('../../config/environment');var jayson=require(_0xf27c('0x9'));var client=jayson[_0xf27c('0xa')]['http']({'port':0x232a});config[_0xf27c('0xb')]=_[_0xf27c('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xf27c('0xd'))(new Redis(config[_0xf27c('0xb')]));require(_0xf27c('0xe'))[_0xf27c('0xf')](socket);function respondWithRpcPromise(_0x567320,_0x38d072,_0x1bfcd7){return new BPromise(function(_0x32eeb3,_0x48a53d){return client['request'](_0x567320,_0x1bfcd7)['then'](function(_0x1da1b3){logger[_0xf27c('0x10')](_0xf27c('0x11'),_0x38d072,_0xf27c('0x12'));logger[_0xf27c('0x13')]('ChatInternalMessage,\x20%s,\x20%s,\x20%s',_0x38d072,_0xf27c('0x12'),JSON['stringify'](_0x1da1b3));if(_0x1da1b3[_0xf27c('0x14')]){if(_0x1da1b3['error'][_0xf27c('0x15')]===0x1f4){logger[_0xf27c('0x14')]('ChatInternalMessage,\x20%s,\x20%s',_0x38d072,_0x1da1b3[_0xf27c('0x14')][_0xf27c('0x16')]);return _0x48a53d(_0x1da1b3['error'][_0xf27c('0x16')]);}logger[_0xf27c('0x14')](_0xf27c('0x11'),_0x38d072,_0x1da1b3[_0xf27c('0x14')][_0xf27c('0x16')]);return _0x32eeb3(_0x1da1b3[_0xf27c('0x14')][_0xf27c('0x16')]);}else{logger[_0xf27c('0x10')](_0xf27c('0x11'),_0x38d072,_0xf27c('0x12'));_0x32eeb3(_0x1da1b3[_0xf27c('0x17')][_0xf27c('0x16')]);}})[_0xf27c('0x18')](function(_0x2c636b){logger[_0xf27c('0x14')]('ChatInternalMessage,\x20%s,\x20%s',_0x38d072,_0x2c636b);_0x48a53d(_0x2c636b);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index 34ef91b..31253ce 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 _0xff4d=['update','emit','removeListener','length','chatInternalMessage:','./chatInternalMessage.events'];(function(_0x5e0aab,_0x20d622){var _0x6e7bea=function(_0x10ea8f){while(--_0x10ea8f){_0x5e0aab['push'](_0x5e0aab['shift']());}};_0x6e7bea(++_0x20d622);}(_0xff4d,0xf5));var _0xdff4=function(_0x2dbd12,_0x3eedd2){_0x2dbd12=_0x2dbd12-0x0;var _0x378a8=_0xff4d[_0x2dbd12];return _0x378a8;};'use strict';var ChatInternalMessageEvents=require(_0xdff4('0x0'));var events=['save','remove',_0xdff4('0x1')];function createListener(_0x1543e3,_0x390d4b){return function(_0x76a12f){_0x390d4b[_0xdff4('0x2')](_0x1543e3,_0x76a12f);};}function removeListener(_0x2d2f2e,_0xd8aca6){return function(){ChatInternalMessageEvents[_0xdff4('0x3')](_0x2d2f2e,_0xd8aca6);};}exports['register']=function(_0x1057a7){for(var _0x2c049e=0x0,_0x312514=events[_0xdff4('0x4')];_0x2c049e<_0x312514;_0x2c049e++){var _0x563ea1=events[_0x2c049e];var _0x47f49d=createListener(_0xdff4('0x5')+_0x563ea1,_0x1057a7);ChatInternalMessageEvents['on'](_0x563ea1,_0x47f49d);}}; \ No newline at end of file +var _0x80b9=['chatInternalMessage:','./chatInternalMessage.events','remove','update','removeListener','register','length'];(function(_0x25d4ee,_0xc95872){var _0x214a35=function(_0x4285a0){while(--_0x4285a0){_0x25d4ee['push'](_0x25d4ee['shift']());}};_0x214a35(++_0xc95872);}(_0x80b9,0xd3));var _0x980b=function(_0x368aeb,_0x1411b2){_0x368aeb=_0x368aeb-0x0;var _0x4e2a4e=_0x80b9[_0x368aeb];return _0x4e2a4e;};'use strict';var ChatInternalMessageEvents=require(_0x980b('0x0'));var events=['save',_0x980b('0x1'),_0x980b('0x2')];function createListener(_0x518ac3,_0x6df784){return function(_0x3a28c3){_0x6df784['emit'](_0x518ac3,_0x3a28c3);};}function removeListener(_0x521ec0,_0xb085e1){return function(){ChatInternalMessageEvents[_0x980b('0x3')](_0x521ec0,_0xb085e1);};}exports[_0x980b('0x4')]=function(_0x5146de){for(var _0x4e59d9=0x0,_0xfe0cb2=events[_0x980b('0x5')];_0x4e59d9<_0xfe0cb2;_0x4e59d9++){var _0x35a91a=events[_0x4e59d9];var _0x1d2854=createListener(_0x980b('0x6')+_0x35a91a,_0x5146de);ChatInternalMessageEvents['on'](_0x35a91a,_0x1d2854);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index a208bef..869caae 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 _0xde89=['/:id','show','post','create','put','update','delete','destroy','exports','path','connect-timeout','express','../../components/auth/service','./chatInternalMessage.controller','get','isAuthenticated','index','/describe','/users'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xde89,0x126));var _0x9de8=function(_0x82129b,_0x484ae9){_0x82129b=_0x82129b-0x0;var _0x2ae5dc=_0xde89[_0x82129b];return _0x2ae5dc;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x9de8('0x0'));var timeout=require(_0x9de8('0x1'));var express=require(_0x9de8('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x9de8('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x9de8('0x4'));router[_0x9de8('0x5')]('/',auth[_0x9de8('0x6')](),controller[_0x9de8('0x7')]);router[_0x9de8('0x5')](_0x9de8('0x8'),auth['isAuthenticated'](),controller['describe']);router['get'](_0x9de8('0x9'),auth[_0x9de8('0x6')](),controller['getUsers']);router[_0x9de8('0x5')](_0x9de8('0xa'),auth[_0x9de8('0x6')](),controller[_0x9de8('0xb')]);router[_0x9de8('0xc')]('/',auth[_0x9de8('0x6')](),controller[_0x9de8('0xd')]);router[_0x9de8('0xe')](_0x9de8('0xa'),controller[_0x9de8('0xf')]);router[_0x9de8('0x10')](_0x9de8('0xa'),auth[_0x9de8('0x6')](),controller[_0x9de8('0x11')]);module[_0x9de8('0x12')]=router; \ No newline at end of file +var _0x3752=['exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','isAuthenticated','index','get','/describe','describe','/users','getUsers','/:id','show','post','create','put','update','delete','destroy'];(function(_0x23c4e4,_0x5b4a6f){var _0x3dda8a=function(_0x4f2725){while(--_0x4f2725){_0x23c4e4['push'](_0x23c4e4['shift']());}};_0x3dda8a(++_0x5b4a6f);}(_0x3752,0xeb));var _0x2375=function(_0x9fc5a2,_0x46c38f){_0x9fc5a2=_0x9fc5a2-0x0;var _0x10a4a8=_0x3752[_0x9fc5a2];return _0x10a4a8;};'use strict';var multer=require(_0x2375('0x0'));var util=require(_0x2375('0x1'));var path=require(_0x2375('0x2'));var timeout=require('connect-timeout');var express=require(_0x2375('0x3'));var router=express[_0x2375('0x4')]();var fs_extra=require(_0x2375('0x5'));var auth=require(_0x2375('0x6'));var interaction=require(_0x2375('0x7'));var config=require(_0x2375('0x8'));var controller=require(_0x2375('0x9'));router['get']('/',auth[_0x2375('0xa')](),controller[_0x2375('0xb')]);router[_0x2375('0xc')](_0x2375('0xd'),auth[_0x2375('0xa')](),controller[_0x2375('0xe')]);router[_0x2375('0xc')](_0x2375('0xf'),auth[_0x2375('0xa')](),controller[_0x2375('0x10')]);router[_0x2375('0xc')](_0x2375('0x11'),auth[_0x2375('0xa')](),controller[_0x2375('0x12')]);router[_0x2375('0x13')]('/',auth[_0x2375('0xa')](),controller[_0x2375('0x14')]);router[_0x2375('0x15')](_0x2375('0x11'),controller[_0x2375('0x16')]);router[_0x2375('0x17')]('/:id',auth[_0x2375('0xa')](),controller[_0x2375('0x18')]);module[_0x2375('0x19')]=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index 2e54201..fd16b7c 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 _0x5eb1=['ENUM','out','DATE','STRING','exports','TEXT','medium','BOOLEAN'];(function(_0x336ca2,_0x1a813a){var _0xda59a6=function(_0x47caa6){while(--_0x47caa6){_0x336ca2['push'](_0x336ca2['shift']());}};_0xda59a6(++_0x1a813a);}(_0x5eb1,0x7c));var _0x15eb=function(_0x2183ca,_0x3778a9){_0x2183ca=_0x2183ca-0x0;var _0x21d00e=_0x5eb1[_0x2183ca];return _0x21d00e;};'use strict';var Sequelize=require('sequelize');module[_0x15eb('0x0')]={'body':{'type':Sequelize[_0x15eb('0x1')](_0x15eb('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x15eb('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0x15eb('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x15eb('0x4')]('in','out'),'defaultValue':_0x15eb('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0x15eb('0x6')]},'providerName':{'type':Sequelize[_0x15eb('0x7')]},'providerResponse':{'type':Sequelize[_0x15eb('0x1')]}}; \ No newline at end of file +var _0x0833=['medium','BOOLEAN','out','STRING','sequelize','exports','TEXT'];(function(_0x372cd8,_0x5b5c1f){var _0x4d70a7=function(_0xaea837){while(--_0xaea837){_0x372cd8['push'](_0x372cd8['shift']());}};_0x4d70a7(++_0x5b5c1f);}(_0x0833,0x1bd));var _0x3083=function(_0x49ef1d,_0x282a87){_0x49ef1d=_0x49ef1d-0x0;var _0x54f0d1=_0x0833[_0x49ef1d];return _0x54f0d1;};'use strict';var Sequelize=require(_0x3083('0x0'));module[_0x3083('0x1')]={'body':{'type':Sequelize[_0x3083('0x2')](_0x3083('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x3083('0x4')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0x3083('0x5'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize[_0x3083('0x6')]},'providerResponse':{'type':Sequelize[_0x3083('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index 878fb22..8d206d6 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 _0xa206=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','defaults','socket.io-emitter','redis','./chatMessage.socket','register','jayson/promise','client','http','request','info','debug','ChatMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','ChatMessage,\x20%s,\x20%s','message','result','catch','sendStatus','end','json','offset','undefined','limit','count','status','Content-Range','save','then','destroy','stack','index','map','rawAttributes','type','key','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','filter','merge','VIRTUAL','options','ChatMessage','includeAll','include','rows','show','params','find','create','body','update','describe','chat-interactions','accept','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','CmContact','Contact','get','ChatInteraction','isNil','read1stAt','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','acceptMessage','startsWith','push','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','SELECT','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','reject','chat','ChatInteractionId','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','cf_','Sequelize','QueryTypes','contact','rejectmessage','parse','formData','rimraf','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis'];(function(_0xf71120,_0x25b7f9){var _0xbe2fd3=function(_0x1acbdd){while(--_0x1acbdd){_0xf71120['push'](_0xf71120['shift']());}};_0xbe2fd3(++_0x25b7f9);}(_0xa206,0x77));var _0x6a20=function(_0x3d7f0e,_0x104d69){_0x3d7f0e=_0x3d7f0e-0x0;var _0x3e45dd=_0xa206[_0x3d7f0e];return _0x3e45dd;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6a20('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x6a20('0x1'));var BPromise=require(_0x6a20('0x2'));var Mustache=require(_0x6a20('0x3'));var util=require('util');var path=require('path');var sox=require(_0x6a20('0x4'));var csv=require(_0x6a20('0x5'));var ejs=require(_0x6a20('0x6'));var fs=require('fs');var fs_extra=require(_0x6a20('0x7'));var _=require('lodash');var squel=require(_0x6a20('0x8'));var crypto=require(_0x6a20('0x9'));var jsforce=require(_0x6a20('0xa'));var deskjs=require(_0x6a20('0xb'));var toCsv=require('to-csv');var querystring=require(_0x6a20('0xc'));var Papa=require(_0x6a20('0xd'));var Redis=require(_0x6a20('0xe'));var authService=require(_0x6a20('0xf'));var qs=require(_0x6a20('0x10'));var as=require(_0x6a20('0x11'));var hardwareService=require(_0x6a20('0x12'));var logger=require(_0x6a20('0x13'))(_0x6a20('0x14'));var utils=require('../../config/utils');var config=require(_0x6a20('0x15'));var licenseUtil=require(_0x6a20('0x16'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x6a20('0x17')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x6a20('0x18'))(new Redis(config[_0x6a20('0x19')]));require(_0x6a20('0x1a'))[_0x6a20('0x1b')](socket);var jayson=require(_0x6a20('0x1c'));var client=jayson[_0x6a20('0x1d')][_0x6a20('0x1e')]({'port':0x232c});var client9002=jayson[_0x6a20('0x1d')]['http']({'port':0x232a});function respondWithRpcPromise(_0x19709b,_0xf155de,_0x1deac3,_0x4bd3a8){return new BPromise(function(_0x35c960,_0x566002){var _0x1b5711=_0x4bd3a8||client;return _0x1b5711[_0x6a20('0x1f')](_0x19709b,_0x1deac3)['then'](function(_0x31e410){logger[_0x6a20('0x20')]('ChatMessage,\x20%s,\x20%s',_0xf155de,'request\x20sent');logger[_0x6a20('0x21')](_0x6a20('0x22'),_0xf155de,_0x6a20('0x23'),JSON[_0x6a20('0x24')](_0x31e410));if(_0x31e410['error']){if(_0x31e410[_0x6a20('0x25')][_0x6a20('0x26')]===0x1f4){logger[_0x6a20('0x25')](_0x6a20('0x27'),_0xf155de,_0x31e410[_0x6a20('0x25')][_0x6a20('0x28')]);return _0x566002(_0x31e410[_0x6a20('0x25')][_0x6a20('0x28')]);}logger[_0x6a20('0x25')](_0x6a20('0x27'),_0xf155de,_0x31e410[_0x6a20('0x25')]['message']);return _0x35c960(_0x31e410['error'][_0x6a20('0x28')]);}else{logger[_0x6a20('0x20')](_0x6a20('0x27'),_0xf155de,'request\x20sent');_0x35c960(_0x31e410[_0x6a20('0x29')]['message']);}})[_0x6a20('0x2a')](function(_0x5a5486){logger[_0x6a20('0x25')](_0x6a20('0x27'),_0xf155de,_0x5a5486);_0x566002(_0x5a5486);});});}function respondWithStatusCode(_0x81fb3e,_0x4dcde9){_0x4dcde9=_0x4dcde9||0xcc;return function(_0x755e8){if(_0x755e8){return _0x81fb3e[_0x6a20('0x2b')](_0x4dcde9);}return _0x81fb3e['status'](_0x4dcde9)[_0x6a20('0x2c')]();};}function respondWithResult(_0x1f80f8,_0x28dfa2){_0x28dfa2=_0x28dfa2||0xc8;return function(_0x442498){if(_0x442498){return _0x1f80f8['status'](_0x28dfa2)[_0x6a20('0x2d')](_0x442498);}};}function respondWithFilteredResult(_0x264125,_0xe7b6aa){return function(_0x10a161){if(_0x10a161){var _0xf317b=typeof _0xe7b6aa[_0x6a20('0x2e')]===_0x6a20('0x2f')&&typeof _0xe7b6aa[_0x6a20('0x30')]===_0x6a20('0x2f');var _0x29c947=_0x10a161['count'];var _0x15e88b=_0xf317b?0x0:_0xe7b6aa[_0x6a20('0x2e')];var _0x19e32c=_0xf317b?_0x10a161[_0x6a20('0x31')]:_0xe7b6aa[_0x6a20('0x2e')]+_0xe7b6aa[_0x6a20('0x30')];var _0xef2e1b;if(_0x19e32c>=_0x29c947){_0x19e32c=_0x29c947;_0xef2e1b=0xc8;}else{_0xef2e1b=0xce;}_0x264125[_0x6a20('0x32')](_0xef2e1b);return _0x264125['set'](_0x6a20('0x33'),_0x15e88b+'-'+_0x19e32c+'/'+_0x29c947)['json'](_0x10a161);}return null;};}function patchUpdates(_0x5e99af){return function(_0x4fb08f){try{jsonpatch['apply'](_0x4fb08f,_0x5e99af,!![]);}catch(_0xb7d711){return BPromise['reject'](_0xb7d711);}return _0x4fb08f[_0x6a20('0x34')]();};}function saveUpdates(_0x20770a,_0x4c9884){return function(_0x3aa436){if(_0x3aa436){return _0x3aa436['update'](_0x20770a)[_0x6a20('0x35')](function(_0x480caf){return _0x480caf;});}return null;};}function removeEntity(_0x21a85f,_0x4c4f92){return function(_0x2e5103){if(_0x2e5103){return _0x2e5103[_0x6a20('0x36')]()[_0x6a20('0x35')](function(){_0x21a85f[_0x6a20('0x32')](0xcc)[_0x6a20('0x2c')]();});}};}function handleEntityNotFound(_0x5c2f18,_0x1ea844){return function(_0x144c53){if(!_0x144c53){_0x5c2f18['sendStatus'](0x194);}return _0x144c53;};}function handleError(_0x383765,_0x1d45fa){_0x1d45fa=_0x1d45fa||0x1f4;return function(_0x3e959e){logger[_0x6a20('0x25')](_0x3e959e[_0x6a20('0x37')]);if(_0x3e959e['name']){delete _0x3e959e['name'];}_0x383765['status'](_0x1d45fa)['send'](_0x3e959e);};}exports[_0x6a20('0x38')]=function(_0xf8c21f,_0x4354d4){var _0x454186={},_0x4d2085={},_0x6ff17e={'count':0x0,'rows':[]};var _0x3b6613=_[_0x6a20('0x39')](db['ChatMessage'][_0x6a20('0x3a')],function(_0x62358){return{'name':_0x62358['fieldName'],'type':_0x62358[_0x6a20('0x3b')][_0x6a20('0x3c')]};});_0x4d2085[_0x6a20('0x3d')]=_[_0x6a20('0x39')](_0x3b6613,_0x6a20('0x3e'));_0x4d2085[_0x6a20('0x3f')]=_[_0x6a20('0x40')](_0xf8c21f[_0x6a20('0x3f')]);_0x4d2085[_0x6a20('0x41')]=_[_0x6a20('0x42')](_0x4d2085['model'],_0x4d2085[_0x6a20('0x3f')]);_0x454186[_0x6a20('0x43')]=_[_0x6a20('0x42')](_0x4d2085[_0x6a20('0x3d')],qs[_0x6a20('0x44')](_0xf8c21f[_0x6a20('0x3f')][_0x6a20('0x44')]));_0x454186['attributes']=_0x454186[_0x6a20('0x43')][_0x6a20('0x45')]?_0x454186[_0x6a20('0x43')]:_0x4d2085[_0x6a20('0x3d')];if(!_0xf8c21f[_0x6a20('0x3f')][_0x6a20('0x46')](_0x6a20('0x47'))){_0x454186[_0x6a20('0x30')]=qs[_0x6a20('0x30')](_0xf8c21f['query']['limit']);_0x454186[_0x6a20('0x2e')]=qs[_0x6a20('0x2e')](_0xf8c21f['query'][_0x6a20('0x2e')]);}_0x454186[_0x6a20('0x48')]=qs['sort'](_0xf8c21f['query']['sort']);_0x454186[_0x6a20('0x49')]=qs[_0x6a20('0x41')](_['pick'](_0xf8c21f['query'],_0x4d2085[_0x6a20('0x41')]),_0x3b6613);if(_0xf8c21f['query'][_0x6a20('0x4a')]){_0x454186[_0x6a20('0x49')]=_[_0x6a20('0x4b')](_0x454186[_0x6a20('0x49')],{'$or':_[_0x6a20('0x39')](_0x3b6613,function(_0x50386c){if(_0x50386c['type']!==_0x6a20('0x4c')){var _0x2d1f8a={};_0x2d1f8a[_0x50386c[_0x6a20('0x3e')]]={'$like':'%'+_0xf8c21f[_0x6a20('0x3f')][_0x6a20('0x4a')]+'%'};return _0x2d1f8a;}})});}_0x454186=_['merge']({},_0x454186,_0xf8c21f[_0x6a20('0x4d')]);var _0x4c49fa={'where':_0x454186['where']};return db[_0x6a20('0x4e')][_0x6a20('0x31')](_0x4c49fa)['then'](function(_0x205fbe){_0x6ff17e[_0x6a20('0x31')]=_0x205fbe;if(_0xf8c21f[_0x6a20('0x3f')][_0x6a20('0x4f')]){_0x454186[_0x6a20('0x50')]=[{'all':!![]}];}return db['ChatMessage']['findAll'](_0x454186);})[_0x6a20('0x35')](function(_0x264b3d){_0x6ff17e[_0x6a20('0x51')]=_0x264b3d;return _0x6ff17e;})[_0x6a20('0x35')](respondWithFilteredResult(_0x4354d4,_0x454186))['catch'](handleError(_0x4354d4,null));};exports[_0x6a20('0x52')]=function(_0x4605ac,_0x343f8b){var _0x559b66={'raw':!![],'where':{'id':_0x4605ac[_0x6a20('0x53')]['id']}},_0x2911b1={};_0x2911b1[_0x6a20('0x3d')]=_[_0x6a20('0x40')](db[_0x6a20('0x4e')][_0x6a20('0x3a')]);_0x2911b1[_0x6a20('0x3f')]=_[_0x6a20('0x40')](_0x4605ac[_0x6a20('0x3f')]);_0x2911b1[_0x6a20('0x41')]=_[_0x6a20('0x42')](_0x2911b1[_0x6a20('0x3d')],_0x2911b1[_0x6a20('0x3f')]);_0x559b66[_0x6a20('0x43')]=_[_0x6a20('0x42')](_0x2911b1[_0x6a20('0x3d')],qs[_0x6a20('0x44')](_0x4605ac[_0x6a20('0x3f')][_0x6a20('0x44')]));_0x559b66[_0x6a20('0x43')]=_0x559b66[_0x6a20('0x43')][_0x6a20('0x45')]?_0x559b66[_0x6a20('0x43')]:_0x2911b1['model'];if(_0x4605ac[_0x6a20('0x3f')][_0x6a20('0x4f')]){_0x559b66['include']=[{'all':!![]}];}_0x559b66=_[_0x6a20('0x4b')]({},_0x559b66,_0x4605ac[_0x6a20('0x4d')]);return db['ChatMessage'][_0x6a20('0x54')](_0x559b66)[_0x6a20('0x35')](handleEntityNotFound(_0x343f8b,null))[_0x6a20('0x35')](respondWithResult(_0x343f8b,null))[_0x6a20('0x2a')](handleError(_0x343f8b,null));};exports[_0x6a20('0x55')]=function(_0x49b20f,_0x5845c2){return db[_0x6a20('0x4e')][_0x6a20('0x55')](_0x49b20f[_0x6a20('0x56')],{})['then'](respondWithResult(_0x5845c2,0xc9))[_0x6a20('0x2a')](handleError(_0x5845c2,null));};exports[_0x6a20('0x57')]=function(_0x27e7c5,_0x357250){if(_0x27e7c5[_0x6a20('0x56')]['id']){delete _0x27e7c5[_0x6a20('0x56')]['id'];}return db[_0x6a20('0x4e')]['find']({'where':{'id':_0x27e7c5[_0x6a20('0x53')]['id']}})[_0x6a20('0x35')](handleEntityNotFound(_0x357250,null))[_0x6a20('0x35')](saveUpdates(_0x27e7c5[_0x6a20('0x56')],null))[_0x6a20('0x35')](respondWithResult(_0x357250,null))[_0x6a20('0x2a')](handleError(_0x357250,null));};exports[_0x6a20('0x36')]=function(_0x3a1140,_0xa74440){return db[_0x6a20('0x4e')][_0x6a20('0x54')]({'where':{'id':_0x3a1140['params']['id']}})[_0x6a20('0x35')](handleEntityNotFound(_0xa74440,null))[_0x6a20('0x35')](removeEntity(_0xa74440,null))['catch'](handleError(_0xa74440,null));};exports[_0x6a20('0x58')]=function(_0x5b11b5,_0x429886){return db['ChatMessage'][_0x6a20('0x58')]()[_0x6a20('0x35')](respondWithResult(_0x429886,null))[_0x6a20('0x2a')](handleError(_0x429886,null));};var interaction_log=require(_0x6a20('0x13'))(_0x6a20('0x59'));exports[_0x6a20('0x5a')]=function(_0x157388,_0xeb5a71,_0x304c60){var _0x22e4e5={'agent':{},'channel':'chat'};if(_0x157388[_0x6a20('0x56')]['id']){delete _0x157388[_0x6a20('0x56')]['id'];}_0x157388[_0x6a20('0x56')][_0x6a20('0x5b')]=!![];_0x157388[_0x6a20('0x56')][_0x6a20('0x5c')]=moment()[_0x6a20('0x5d')](_0x6a20('0x5e'));_0x157388['body'][_0x6a20('0x5f')]=_0x157388[_0x6a20('0x56')][_0x6a20('0x5f')]||_0x157388[_0x6a20('0x60')]['id'];_0x22e4e5[_0x6a20('0x61')]['id']=_0x157388[_0x6a20('0x56')][_0x6a20('0x5f')];return db[_0x6a20('0x4e')][_0x6a20('0x54')]({'where':{'id':_0x157388[_0x6a20('0x53')]['id'],'UserId':null},'include':[{'model':db[_0x6a20('0x62')],'as':_0x6a20('0x63')}]})[_0x6a20('0x35')](handleEntityNotFound(_0xeb5a71,null))['then'](saveUpdates(_0x157388[_0x6a20('0x56')],null))[_0x6a20('0x35')](function(_0x1a1819){if(_0x1a1819){_0x22e4e5[_0x6a20('0x28')]=_0x1a1819[_0x6a20('0x64')]({'plain':!![]});return db[_0x6a20('0x65')]['find']({'where':{'id':_0x1a1819['ChatInteractionId']}});}return null;})[_0x6a20('0x35')](handleEntityNotFound(_0xeb5a71,null))[_0x6a20('0x35')](function(_0x253506){if(_0x253506){return _0x253506[_0x6a20('0x57')]({'UserId':_0x157388[_0x6a20('0x56')][_0x6a20('0x5f')],'read1stAt':_[_0x6a20('0x66')](_0x253506[_0x6a20('0x67')])?moment()[_0x6a20('0x5d')](_0x6a20('0x5e')):undefined});}return null;})[_0x6a20('0x35')](function(_0x62bce0){if(_0x62bce0){_0x22e4e5[_0x6a20('0x68')]=_0x62bce0[_0x6a20('0x64')]({'plain':!![]});interaction_log[_0x6a20('0x20')](_0x6a20('0x69'),_0x157388[_0x6a20('0x60')]['id'],_0x157388['user'][_0x6a20('0x3e')],_0x157388['user']['role'],_0x22e4e5[_0x6a20('0x68')]['id'],_0x157388[_0x6a20('0x56')]?JSON[_0x6a20('0x24')](_0x157388[_0x6a20('0x56')]):_0x6a20('0x6a'));return respondWithRpcPromise('AcceptMessage',_0x6a20('0x6b'),_0x22e4e5);}return null;})[_0x6a20('0x35')](function(_0x3b9335){return db[_0x6a20('0x62')][_0x6a20('0x58')]()[_0x6a20('0x35')](function(_0x9a034e){var _0x219c82=[];for(var _0x29fa68=0x0;_0x29fa68=_0x3ad04b){_0x5c1f03=_0x3ad04b;_0x5022fa=0xc8;}else{_0x5022fa=0xce;}_0x2dc9e1['status'](_0x5022fa);return _0x2dc9e1[_0xcd32('0x34')](_0xcd32('0x35'),_0x3a6442+'-'+_0x5c1f03+'/'+_0x3ad04b)[_0xcd32('0x2f')](_0x58820f);}return null;};}function patchUpdates(_0x1f119c){return function(_0x10ec9f){try{jsonpatch['apply'](_0x10ec9f,_0x1f119c,!![]);}catch(_0x304036){return BPromise[_0xcd32('0x36')](_0x304036);}return _0x10ec9f[_0xcd32('0x37')]();};}function saveUpdates(_0x45ab8c,_0x208fdb){return function(_0x4f6c34){if(_0x4f6c34){return _0x4f6c34[_0xcd32('0x38')](_0x45ab8c)['then'](function(_0x5148ba){return _0x5148ba;});}return null;};}function removeEntity(_0x5298ed,_0x45f7bf){return function(_0x188691){if(_0x188691){return _0x188691[_0xcd32('0x39')]()[_0xcd32('0x22')](function(){_0x5298ed[_0xcd32('0x2d')](0xcc)[_0xcd32('0x2e')]();});}};}function handleEntityNotFound(_0x648411,_0x4fa9a6){return function(_0x4d6d6b){if(!_0x4d6d6b){_0x648411['sendStatus'](0x194);}return _0x4d6d6b;};}function handleError(_0x47cac4,_0x24f9a8){_0x24f9a8=_0x24f9a8||0x1f4;return function(_0xe936eb){logger['error'](_0xe936eb[_0xcd32('0x3a')]);if(_0xe936eb[_0xcd32('0x3b')]){delete _0xe936eb[_0xcd32('0x3b')];}_0x47cac4[_0xcd32('0x2d')](_0x24f9a8)['send'](_0xe936eb);};}exports[_0xcd32('0x3c')]=function(_0x3d177f,_0x43a942){var _0xfd082f={},_0x22d1f1={},_0x2d62fd={'count':0x0,'rows':[]};var _0x1b5545=_[_0xcd32('0x3d')](db[_0xcd32('0x3e')][_0xcd32('0x3f')],function(_0x6ffa38){return{'name':_0x6ffa38[_0xcd32('0x40')],'type':_0x6ffa38[_0xcd32('0x41')][_0xcd32('0x42')]};});_0x22d1f1['model']=_[_0xcd32('0x3d')](_0x1b5545,_0xcd32('0x3b'));_0x22d1f1[_0xcd32('0x43')]=_['keys'](_0x3d177f[_0xcd32('0x43')]);_0x22d1f1['filters']=_[_0xcd32('0x44')](_0x22d1f1[_0xcd32('0x45')],_0x22d1f1[_0xcd32('0x43')]);_0xfd082f['attributes']=_['intersection'](_0x22d1f1['model'],qs[_0xcd32('0x46')](_0x3d177f[_0xcd32('0x43')]['fields']));_0xfd082f[_0xcd32('0x47')]=_0xfd082f[_0xcd32('0x47')][_0xcd32('0x48')]?_0xfd082f[_0xcd32('0x47')]:_0x22d1f1[_0xcd32('0x45')];if(!_0x3d177f[_0xcd32('0x43')][_0xcd32('0x49')](_0xcd32('0x4a'))){_0xfd082f[_0xcd32('0x32')]=qs[_0xcd32('0x32')](_0x3d177f['query']['limit']);_0xfd082f['offset']=qs[_0xcd32('0x30')](_0x3d177f[_0xcd32('0x43')][_0xcd32('0x30')]);}_0xfd082f[_0xcd32('0x4b')]=qs['sort'](_0x3d177f[_0xcd32('0x43')][_0xcd32('0x4c')]);_0xfd082f['where']=qs[_0xcd32('0x4d')](_[_0xcd32('0x4e')](_0x3d177f[_0xcd32('0x43')],_0x22d1f1[_0xcd32('0x4d')]),_0x1b5545);if(_0x3d177f[_0xcd32('0x43')][_0xcd32('0x4f')]){_0xfd082f[_0xcd32('0x50')]=_[_0xcd32('0x51')](_0xfd082f[_0xcd32('0x50')],{'$or':_[_0xcd32('0x3d')](_0x1b5545,function(_0x258721){if(_0x258721['type']!=='VIRTUAL'){var _0x2d4ccf={};_0x2d4ccf[_0x258721[_0xcd32('0x3b')]]={'$like':'%'+_0x3d177f[_0xcd32('0x43')][_0xcd32('0x4f')]+'%'};return _0x2d4ccf;}})});}_0xfd082f=_['merge']({},_0xfd082f,_0x3d177f['options']);var _0x15740b={'where':_0xfd082f['where']};return db[_0xcd32('0x3e')][_0xcd32('0x33')](_0x15740b)[_0xcd32('0x22')](function(_0x204307){_0x2d62fd['count']=_0x204307;if(_0x3d177f['query'][_0xcd32('0x52')]){_0xfd082f[_0xcd32('0x53')]=[{'all':!![]}];}return db['ChatMessage'][_0xcd32('0x54')](_0xfd082f);})[_0xcd32('0x22')](function(_0x2da982){_0x2d62fd[_0xcd32('0x55')]=_0x2da982;return _0x2d62fd;})['then'](respondWithFilteredResult(_0x43a942,_0xfd082f))[_0xcd32('0x2b')](handleError(_0x43a942,null));};exports['show']=function(_0x4b6356,_0x3e6ef0){var _0x7899a8={'raw':!![],'where':{'id':_0x4b6356[_0xcd32('0x56')]['id']}},_0x4ba32c={};_0x4ba32c['model']=_[_0xcd32('0x57')](db[_0xcd32('0x3e')][_0xcd32('0x3f')]);_0x4ba32c['query']=_[_0xcd32('0x57')](_0x4b6356['query']);_0x4ba32c['filters']=_[_0xcd32('0x44')](_0x4ba32c['model'],_0x4ba32c['query']);_0x7899a8['attributes']=_[_0xcd32('0x44')](_0x4ba32c[_0xcd32('0x45')],qs[_0xcd32('0x46')](_0x4b6356[_0xcd32('0x43')]['fields']));_0x7899a8['attributes']=_0x7899a8[_0xcd32('0x47')][_0xcd32('0x48')]?_0x7899a8[_0xcd32('0x47')]:_0x4ba32c['model'];if(_0x4b6356[_0xcd32('0x43')][_0xcd32('0x52')]){_0x7899a8['include']=[{'all':!![]}];}_0x7899a8=_[_0xcd32('0x51')]({},_0x7899a8,_0x4b6356[_0xcd32('0x58')]);return db[_0xcd32('0x3e')][_0xcd32('0x59')](_0x7899a8)[_0xcd32('0x22')](handleEntityNotFound(_0x3e6ef0,null))['then'](respondWithResult(_0x3e6ef0,null))[_0xcd32('0x2b')](handleError(_0x3e6ef0,null));};exports[_0xcd32('0x5a')]=function(_0x419211,_0x5d49b8){return db[_0xcd32('0x3e')][_0xcd32('0x5a')](_0x419211[_0xcd32('0x5b')],{})[_0xcd32('0x22')](respondWithResult(_0x5d49b8,0xc9))['catch'](handleError(_0x5d49b8,null));};exports[_0xcd32('0x38')]=function(_0x2175aa,_0x3390d2){if(_0x2175aa['body']['id']){delete _0x2175aa['body']['id'];}return db[_0xcd32('0x3e')][_0xcd32('0x59')]({'where':{'id':_0x2175aa['params']['id']}})['then'](handleEntityNotFound(_0x3390d2,null))[_0xcd32('0x22')](saveUpdates(_0x2175aa['body'],null))[_0xcd32('0x22')](respondWithResult(_0x3390d2,null))[_0xcd32('0x2b')](handleError(_0x3390d2,null));};exports[_0xcd32('0x39')]=function(_0x1ac77e,_0x39465c){return db[_0xcd32('0x3e')][_0xcd32('0x59')]({'where':{'id':_0x1ac77e[_0xcd32('0x56')]['id']}})[_0xcd32('0x22')](handleEntityNotFound(_0x39465c,null))[_0xcd32('0x22')](removeEntity(_0x39465c,null))[_0xcd32('0x2b')](handleError(_0x39465c,null));};exports['describe']=function(_0x274b9a,_0x4ee61b){return db[_0xcd32('0x3e')]['describe']()['then'](respondWithResult(_0x4ee61b,null))['catch'](handleError(_0x4ee61b,null));};var interaction_log=require(_0xcd32('0x15'))(_0xcd32('0x5c'));exports[_0xcd32('0x5d')]=function(_0x474e68,_0x179c9c,_0x1db349){var _0x470dc2={'agent':{},'channel':'chat'};if(_0x474e68[_0xcd32('0x5b')]['id']){delete _0x474e68[_0xcd32('0x5b')]['id'];}_0x474e68[_0xcd32('0x5b')][_0xcd32('0x5e')]=!![];_0x474e68[_0xcd32('0x5b')][_0xcd32('0x5f')]=moment()[_0xcd32('0x60')](_0xcd32('0x61'));_0x474e68['body'][_0xcd32('0x62')]=_0x474e68[_0xcd32('0x5b')][_0xcd32('0x62')]||_0x474e68[_0xcd32('0x63')]['id'];_0x470dc2[_0xcd32('0x64')]['id']=_0x474e68['body'][_0xcd32('0x62')];return db[_0xcd32('0x3e')][_0xcd32('0x59')]({'where':{'id':_0x474e68[_0xcd32('0x56')]['id'],'UserId':null},'include':[{'model':db[_0xcd32('0x65')],'as':'Contact'}]})[_0xcd32('0x22')](handleEntityNotFound(_0x179c9c,null))[_0xcd32('0x22')](saveUpdates(_0x474e68['body'],null))[_0xcd32('0x22')](function(_0x1ca2e2){if(_0x1ca2e2){_0x470dc2[_0xcd32('0x29')]=_0x1ca2e2[_0xcd32('0x66')]({'plain':!![]});return db[_0xcd32('0x67')][_0xcd32('0x59')]({'where':{'id':_0x1ca2e2['ChatInteractionId']}});}return null;})[_0xcd32('0x22')](handleEntityNotFound(_0x179c9c,null))[_0xcd32('0x22')](function(_0x178623){if(_0x178623){return _0x178623['update']({'UserId':_0x474e68[_0xcd32('0x5b')][_0xcd32('0x62')],'read1stAt':_[_0xcd32('0x68')](_0x178623[_0xcd32('0x69')])?moment()[_0xcd32('0x60')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0x1de31b){if(_0x1de31b){_0x470dc2[_0xcd32('0x6a')]=_0x1de31b[_0xcd32('0x66')]({'plain':!![]});interaction_log[_0xcd32('0x6b')](_0xcd32('0x6c'),_0x474e68[_0xcd32('0x63')]['id'],_0x474e68['user']['name'],_0x474e68['user'][_0xcd32('0x6d')],_0x470dc2[_0xcd32('0x6a')]['id'],_0x474e68[_0xcd32('0x5b')]?JSON[_0xcd32('0x6e')](_0x474e68[_0xcd32('0x5b')]):_0xcd32('0x6f'));return respondWithRpcPromise(_0xcd32('0x70'),'acceptMessage',_0x470dc2);}return null;})[_0xcd32('0x22')](function(_0x377b1a){return db[_0xcd32('0x65')][_0xcd32('0x71')]()[_0xcd32('0x22')](function(_0x1d125c){var _0x12cc52=[];for(var _0x39994d=0x0;_0x39994d=_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 +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(_0x1b5aea,_0x3f04b7){var _0x15cfc6=function(_0x204e92){while(--_0x204e92){_0x1b5aea['push'](_0x1b5aea['shift']());}};_0x15cfc6(++_0x3f04b7);}(_0x7a54,0x106));var _0x47a5=function(_0x18431a,_0x11b907){_0x18431a=_0x18431a-0x0;var _0x22ef6a=_0x7a54[_0x18431a];return _0x22ef6a;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x29')]=function(_0x136b14,_0x16631f){var _0x361bfa={},_0x1127f8={},_0x11a4fa={'count':0x0,'rows':[]};var _0x3ad507=_['map'](db[_0x47a5('0x2a')]['rawAttributes'],function(_0x2ef875){return{'name':_0x2ef875[_0x47a5('0x2b')],'type':_0x2ef875[_0x47a5('0x2c')]['key']};});_0x1127f8[_0x47a5('0x2d')]=_[_0x47a5('0x2e')](_0x3ad507,_0x47a5('0x27'));_0x1127f8[_0x47a5('0x2f')]=_['keys'](_0x136b14['query']);_0x1127f8[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x1127f8['model'],_0x1127f8['query']);_0x361bfa[_0x47a5('0x32')]=_[_0x47a5('0x31')](_0x1127f8['model'],qs[_0x47a5('0x33')](_0x136b14['query'][_0x47a5('0x33')]));_0x361bfa[_0x47a5('0x32')]=_0x361bfa['attributes']['length']?_0x361bfa[_0x47a5('0x32')]:_0x1127f8['model'];if(!_0x136b14[_0x47a5('0x2f')][_0x47a5('0x34')](_0x47a5('0x35'))){_0x361bfa['limit']=qs[_0x47a5('0x1d')](_0x136b14['query']['limit']);_0x361bfa[_0x47a5('0x1a')]=qs['offset'](_0x136b14[_0x47a5('0x2f')]['offset']);}_0x361bfa[_0x47a5('0x36')]=qs[_0x47a5('0x37')](_0x136b14[_0x47a5('0x2f')][_0x47a5('0x37')]);_0x361bfa[_0x47a5('0x38')]=qs[_0x47a5('0x30')](_[_0x47a5('0x39')](_0x136b14[_0x47a5('0x2f')],_0x1127f8[_0x47a5('0x30')]),_0x3ad507);if(_0x136b14['query'][_0x47a5('0x3a')]){_0x361bfa[_0x47a5('0x38')]=_['merge'](_0x361bfa[_0x47a5('0x38')],{'$or':_[_0x47a5('0x2e')](_0x3ad507,function(_0x1d4348){if(_0x1d4348['type']!==_0x47a5('0x3b')){var _0x10f660={};_0x10f660[_0x1d4348['name']]={'$like':'%'+_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3a')]+'%'};return _0x10f660;}})});}_0x361bfa=_['merge']({},_0x361bfa,_0x136b14['options']);var _0x5ebd8c={'where':_0x361bfa[_0x47a5('0x38')]};return db['ChatOfflineMessage'][_0x47a5('0x1c')](_0x5ebd8c)[_0x47a5('0x23')](function(_0x301a85){_0x11a4fa[_0x47a5('0x1c')]=_0x301a85;if(_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x361bfa[_0x47a5('0x3d')]=[{'all':!![]}];}return db[_0x47a5('0x2a')][_0x47a5('0x3e')](_0x361bfa);})[_0x47a5('0x23')](function(_0x280500){_0x11a4fa[_0x47a5('0x3f')]=_0x280500;return _0x11a4fa;})[_0x47a5('0x23')](respondWithFilteredResult(_0x16631f,_0x361bfa))['catch'](handleError(_0x16631f,null));};exports[_0x47a5('0x40')]=function(_0x1c36fa,_0x331474){var _0x23bd8d={'raw':!![],'where':{'id':_0x1c36fa[_0x47a5('0x41')]['id']}},_0x586f4f={};_0x586f4f['model']=_['keys'](db['ChatOfflineMessage']['rawAttributes']);_0x586f4f[_0x47a5('0x2f')]=_['keys'](_0x1c36fa[_0x47a5('0x2f')]);_0x586f4f[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x586f4f['model'],_0x586f4f[_0x47a5('0x2f')]);_0x23bd8d[_0x47a5('0x32')]=_['intersection'](_0x586f4f['model'],qs[_0x47a5('0x33')](_0x1c36fa['query'][_0x47a5('0x33')]));_0x23bd8d[_0x47a5('0x32')]=_0x23bd8d[_0x47a5('0x32')][_0x47a5('0x42')]?_0x23bd8d[_0x47a5('0x32')]:_0x586f4f[_0x47a5('0x2d')];if(_0x1c36fa[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x23bd8d[_0x47a5('0x3d')]=[{'all':!![]}];}_0x23bd8d=_[_0x47a5('0x43')]({},_0x23bd8d,_0x1c36fa[_0x47a5('0x44')]);return db[_0x47a5('0x2a')][_0x47a5('0x45')](_0x23bd8d)[_0x47a5('0x23')](handleEntityNotFound(_0x331474,null))[_0x47a5('0x23')](respondWithResult(_0x331474,null))[_0x47a5('0x46')](handleError(_0x331474,null));};exports['create']=function(_0x2d38de,_0x23bb04){return db['ChatOfflineMessage']['create'](_0x2d38de[_0x47a5('0x47')],{})['then'](respondWithResult(_0x23bb04,0xc9))[_0x47a5('0x46')](handleError(_0x23bb04,null));};exports[_0x47a5('0x22')]=function(_0x54c35f,_0x4f62d3){if(_0x54c35f[_0x47a5('0x47')]['id']){delete _0x54c35f['body']['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x54c35f[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x4f62d3,null))[_0x47a5('0x23')](saveUpdates(_0x54c35f[_0x47a5('0x47')],null))[_0x47a5('0x23')](respondWithResult(_0x4f62d3,null))['catch'](handleError(_0x4f62d3,null));};exports['destroy']=function(_0x2dd1db,_0x411230){return db[_0x47a5('0x48')][_0x47a5('0x3e')]({'where':{'ChatOfflineMessageId':_0x2dd1db[_0x47a5('0x41')]['id']},'raw':!![]})[_0x47a5('0x23')](function(_0x249de5){_0x249de5['forEach'](function(_0x45cca5){var _0x1c9a62=path[_0x47a5('0x49')](config['root'],_0x47a5('0x4a'),'files',_0x47a5('0x4b'),_0x47a5('0x4c'),_0x45cca5[_0x47a5('0x4d')]);var _0xf03bd5=fs['existsSync'](_0x1c9a62);if(_0xf03bd5)fs_extra[_0x47a5('0x4e')](_0x1c9a62);});})[_0x47a5('0x23')](function(){return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x2dd1db[_0x47a5('0x41')]['id']},'individualHooks':!![]});})[_0x47a5('0x23')](handleEntityNotFound(_0x411230,null))[_0x47a5('0x23')](removeEntity(_0x411230,null))['catch'](handleError(_0x411230,null));};exports[_0x47a5('0x4f')]=function(_0x43721b,_0x187d7e){return db[_0x47a5('0x2a')][_0x47a5('0x4f')]()[_0x47a5('0x23')](respondWithResult(_0x187d7e,null))['catch'](handleError(_0x187d7e,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index ebb9ece..4d53c93 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 _0x0aa7=['utf8mb4','utf8mb4_unicode_ci','lodash','request-promise','path','rimraf','../../config/environment','./chatOfflineMessage.attributes','exports','define','ChatOfflineMessage','chat_offline_messages'];(function(_0x10a426,_0x5aa6e0){var _0x291ac7=function(_0xf71baa){while(--_0xf71baa){_0x10a426['push'](_0x10a426['shift']());}};_0x291ac7(++_0x5aa6e0);}(_0x0aa7,0x92));var _0x70aa=function(_0x5c4f6b,_0x2cdfce){_0x5c4f6b=_0x5c4f6b-0x0;var _0x104c4e=_0x0aa7[_0x5c4f6b];return _0x104c4e;};'use strict';var _=require(_0x70aa('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x70aa('0x1'));var fs=require('fs');var path=require(_0x70aa('0x2'));var rimraf=require(_0x70aa('0x3'));var config=require(_0x70aa('0x4'));var attributes=require(_0x70aa('0x5'));module[_0x70aa('0x6')]=function(_0x3bc480,_0x4fc010){return _0x3bc480[_0x70aa('0x7')](_0x70aa('0x8'),attributes,{'tableName':_0x70aa('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x70aa('0xa'),'collate':_0x70aa('0xb')});}; \ No newline at end of file +var _0x65b2=['path','rimraf','define','ChatOfflineMessage','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x2bce58,_0x317d28){var _0x1e30a7=function(_0x498c83){while(--_0x498c83){_0x2bce58['push'](_0x2bce58['shift']());}};_0x1e30a7(++_0x317d28);}(_0x65b2,0x125));var _0x265b=function(_0x34a923,_0x3ce38d){_0x34a923=_0x34a923-0x0;var _0x46442b=_0x65b2[_0x34a923];return _0x46442b;};'use strict';var _=require(_0x265b('0x0'));var util=require(_0x265b('0x1'));var logger=require(_0x265b('0x2'))(_0x265b('0x3'));var moment=require(_0x265b('0x4'));var BPromise=require(_0x265b('0x5'));var rp=require(_0x265b('0x6'));var fs=require('fs');var path=require(_0x265b('0x7'));var rimraf=require(_0x265b('0x8'));var config=require('../../config/environment');var attributes=require('./chatOfflineMessage.attributes');module['exports']=function(_0x3b5efe,_0x5b704f){return _0x3b5efe[_0x265b('0x9')](_0x265b('0xa'),attributes,{'tableName':'chat_offline_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x265b('0xb')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index ce23d59..e47423d 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 _0x7007=['ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info'];(function(_0x1af98d,_0x3c608e){var _0x3553ea=function(_0x5668a4){while(--_0x5668a4){_0x1af98d['push'](_0x1af98d['shift']());}};_0x3553ea(++_0x3c608e);}(_0x7007,0xbc));var _0x7700=function(_0x2f35d8,_0x5f4470){_0x2f35d8=_0x2f35d8-0x0;var _0x4b048b=_0x7007[_0x2f35d8];return _0x4b048b;};'use strict';var _=require(_0x7700('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7700('0x1'))['db'];var utils=require(_0x7700('0x2'));var logger=require(_0x7700('0x3'))(_0x7700('0x4'));var config=require('../../config/environment');var jayson=require(_0x7700('0x5'));var client=jayson['client'][_0x7700('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x1eee4c,_0x52eedb,_0x574aa6){return new BPromise(function(_0x4a1d70,_0x12e03a){return client[_0x7700('0x7')](_0x1eee4c,_0x574aa6)[_0x7700('0x8')](function(_0x1d5f36){logger[_0x7700('0x9')](_0x7700('0xa'),_0x52eedb,_0x7700('0xb'));logger[_0x7700('0xc')](_0x7700('0xd'),_0x52eedb,_0x7700('0xb'),JSON[_0x7700('0xe')](_0x1d5f36));if(_0x1d5f36[_0x7700('0xf')]){if(_0x1d5f36[_0x7700('0xf')]['code']===0x1f4){logger[_0x7700('0xf')](_0x7700('0xa'),_0x52eedb,_0x1d5f36[_0x7700('0xf')][_0x7700('0x10')]);return _0x12e03a(_0x1d5f36[_0x7700('0xf')]['message']);}logger[_0x7700('0xf')]('ChatOfflineMessage,\x20%s,\x20%s',_0x52eedb,_0x1d5f36[_0x7700('0xf')]['message']);return _0x4a1d70(_0x1d5f36[_0x7700('0xf')][_0x7700('0x10')]);}else{logger[_0x7700('0x9')](_0x7700('0xa'),_0x52eedb,'request\x20sent');_0x4a1d70(_0x1d5f36[_0x7700('0x11')][_0x7700('0x10')]);}})['catch'](function(_0x1970c5){logger[_0x7700('0xf')](_0x7700('0xa'),_0x52eedb,_0x1970c5);_0x12e03a(_0x1970c5);});});} \ No newline at end of file +var _0xdbcf=['debug','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','ChatOfflineMessage,\x20%s,\x20%s'];(function(_0x291525,_0x1cdac7){var _0x41beb5=function(_0x2acb26){while(--_0x2acb26){_0x291525['push'](_0x291525['shift']());}};_0x41beb5(++_0x1cdac7);}(_0xdbcf,0x158));var _0xfdbc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdbcf[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xfdbc('0x0'));var util=require(_0xfdbc('0x1'));var moment=require(_0xfdbc('0x2'));var BPromise=require(_0xfdbc('0x3'));var rs=require(_0xfdbc('0x4'));var fs=require('fs');var Redis=require(_0xfdbc('0x5'));var db=require(_0xfdbc('0x6'))['db'];var utils=require(_0xfdbc('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xfdbc('0x8'));var jayson=require(_0xfdbc('0x9'));var client=jayson[_0xfdbc('0xa')][_0xfdbc('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x464f99,_0x1ee20e,_0x3278e3){return new BPromise(function(_0x46de74,_0xe431bf){return client[_0xfdbc('0xc')](_0x464f99,_0x3278e3)[_0xfdbc('0xd')](function(_0x2fbb13){logger[_0xfdbc('0xe')](_0xfdbc('0xf'),_0x1ee20e,'request\x20sent');logger[_0xfdbc('0x10')]('ChatOfflineMessage,\x20%s,\x20%s,\x20%s',_0x1ee20e,_0xfdbc('0x11'),JSON[_0xfdbc('0x12')](_0x2fbb13));if(_0x2fbb13['error']){if(_0x2fbb13[_0xfdbc('0x13')][_0xfdbc('0x14')]===0x1f4){logger[_0xfdbc('0x13')](_0xfdbc('0xf'),_0x1ee20e,_0x2fbb13[_0xfdbc('0x13')][_0xfdbc('0x15')]);return _0xe431bf(_0x2fbb13['error']['message']);}logger[_0xfdbc('0x13')](_0xfdbc('0xf'),_0x1ee20e,_0x2fbb13[_0xfdbc('0x13')][_0xfdbc('0x15')]);return _0x46de74(_0x2fbb13[_0xfdbc('0x13')][_0xfdbc('0x15')]);}else{logger[_0xfdbc('0xe')](_0xfdbc('0xf'),_0x1ee20e,_0xfdbc('0x11'));_0x46de74(_0x2fbb13[_0xfdbc('0x16')]['message']);}})[_0xfdbc('0x17')](function(_0x2f18b0){logger[_0xfdbc('0x13')]('ChatOfflineMessage,\x20%s,\x20%s',_0x1ee20e,_0x2f18b0);_0xe431bf(_0x2f18b0);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index db8f0c8..ee28cbb 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 _0x4e32=['show','post','create','put','update','delete','exports','util','connect-timeout','Router','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x5b81ca,_0x3b8ea9){var _0x9a9a78=function(_0x1b908b){while(--_0x1b908b){_0x5b81ca['push'](_0x5b81ca['shift']());}};_0x9a9a78(++_0x3b8ea9);}(_0x4e32,0x1a9));var _0x24e3=function(_0x3a3291,_0x541888){_0x3a3291=_0x3a3291-0x0;var _0x23b24a=_0x4e32[_0x3a3291];return _0x23b24a;};'use strict';var multer=require('multer');var util=require(_0x24e3('0x0'));var path=require('path');var timeout=require(_0x24e3('0x1'));var express=require('express');var router=express[_0x24e3('0x2')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x24e3('0x3'));var config=require(_0x24e3('0x4'));var controller=require(_0x24e3('0x5'));router[_0x24e3('0x6')]('/',auth[_0x24e3('0x7')](),controller[_0x24e3('0x8')]);router[_0x24e3('0x6')](_0x24e3('0x9'),auth[_0x24e3('0x7')](),controller[_0x24e3('0xa')]);router['get'](_0x24e3('0xb'),auth[_0x24e3('0x7')](),controller[_0x24e3('0xc')]);router[_0x24e3('0xd')]('/',auth[_0x24e3('0x7')](),controller[_0x24e3('0xe')]);router[_0x24e3('0xf')]('/:id',auth[_0x24e3('0x7')](),controller[_0x24e3('0x10')]);router[_0x24e3('0x11')](_0x24e3('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x24e3('0x12')]=router; \ No newline at end of file +var _0x2fba=['describe','show','post','create','put','/:id','delete','exports','multer','util','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','./chatOfflineMessage.controller','get','isAuthenticated','/describe'];(function(_0x49dd47,_0x2c58b3){var _0x3dc16b=function(_0x57ec59){while(--_0x57ec59){_0x49dd47['push'](_0x49dd47['shift']());}};_0x3dc16b(++_0x2c58b3);}(_0x2fba,0x1a6));var _0xa2fb=function(_0x1fb846,_0x4d47b1){_0x1fb846=_0x1fb846-0x0;var _0x1a7c94=_0x2fba[_0x1fb846];return _0x1a7c94;};'use strict';var multer=require(_0xa2fb('0x0'));var util=require(_0xa2fb('0x1'));var path=require('path');var timeout=require(_0xa2fb('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xa2fb('0x3'));var auth=require(_0xa2fb('0x4'));var interaction=require(_0xa2fb('0x5'));var config=require('../../config/environment');var controller=require(_0xa2fb('0x6'));router[_0xa2fb('0x7')]('/',auth[_0xa2fb('0x8')](),controller['index']);router[_0xa2fb('0x7')](_0xa2fb('0x9'),auth['isAuthenticated'](),controller[_0xa2fb('0xa')]);router[_0xa2fb('0x7')]('/:id',auth[_0xa2fb('0x8')](),controller[_0xa2fb('0xb')]);router[_0xa2fb('0xc')]('/',auth['isAuthenticated'](),controller[_0xa2fb('0xd')]);router[_0xa2fb('0xe')](_0xa2fb('0xf'),auth['isAuthenticated'](),controller['update']);router[_0xa2fb('0x10')](_0xa2fb('0xf'),auth[_0xa2fb('0x8')](),controller['destroy']);module[_0xa2fb('0x11')]=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index 4a8de98..92968f9 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 _0xc3ab=['INTEGER','sequelize','exports','STRING','mouseOver','timeout'];(function(_0x54ed9b,_0x188281){var _0x2c48eb=function(_0x57f0a1){while(--_0x57f0a1){_0x54ed9b['push'](_0x54ed9b['shift']());}};_0x2c48eb(++_0x188281);}(_0xc3ab,0xeb));var _0xbc3a=function(_0x4214b4,_0x3052c0){_0x4214b4=_0x4214b4-0x0;var _0x53ec8b=_0xc3ab[_0x4214b4];return _0x53ec8b;};'use strict';var Sequelize=require(_0xbc3a('0x0'));module[_0xbc3a('0x1')]={'name':{'type':Sequelize[_0xbc3a('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xbc3a('0x3'),_0xbc3a('0x4')),'defaultValue':_0xbc3a('0x3')},'selector':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xbc3a('0x5')]}}; \ No newline at end of file +var _0x8245=['STRING','ENUM','mouseOver','sequelize'];(function(_0x2df7c7,_0x5ec3eb){var _0x42995b=function(_0x294b44){while(--_0x294b44){_0x2df7c7['push'](_0x2df7c7['shift']());}};_0x42995b(++_0x5ec3eb);}(_0x8245,0x18b));var _0x5824=function(_0x53dcd4,_0xb52a53){_0x53dcd4=_0x53dcd4-0x0;var _0x9ab430=_0x8245[_0x53dcd4];return _0x9ab430;};'use strict';var Sequelize=require(_0x5824('0x0'));module['exports']={'name':{'type':Sequelize[_0x5824('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x5824('0x2')]('mouseOver','timeout'),'defaultValue':_0x5824('0x3')},'selector':{'type':Sequelize[_0x5824('0x1')]},'timeout':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index 2cc4c2c..7e8035f 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 _0xbcc7=['find','create','body','catch','eml-format','rimraf','fast-json-patch','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','Content-Range','reject','save','update','then','destroy','stack','name','send','show','params','keys','ChatProactiveAction','filters','intersection','model','query','fields','attributes','length','includeAll','include','merge','options'];(function(_0x35dbe3,_0x4cb7e5){var _0xff6f95=function(_0x4fa4fd){while(--_0x4fa4fd){_0x35dbe3['push'](_0x35dbe3['shift']());}};_0xff6f95(++_0x4cb7e5);}(_0xbcc7,0x19a));var _0x7bcc=function(_0x2d253c,_0x25dd0b){_0x2d253c=_0x2d253c-0x0;var _0x17fd8d=_0xbcc7[_0x2d253c];return _0x17fd8d;};'use strict';var emlformat=require(_0x7bcc('0x0'));var rimraf=require(_0x7bcc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7bcc('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x7bcc('0x3'));var Mustache=require('mustache');var util=require(_0x7bcc('0x4'));var path=require(_0x7bcc('0x5'));var sox=require('sox');var csv=require(_0x7bcc('0x6'));var ejs=require(_0x7bcc('0x7'));var fs=require('fs');var fs_extra=require(_0x7bcc('0x8'));var _=require(_0x7bcc('0x9'));var squel=require(_0x7bcc('0xa'));var crypto=require(_0x7bcc('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x7bcc('0xc'));var toCsv=require('to-csv');var querystring=require(_0x7bcc('0xd'));var Papa=require(_0x7bcc('0xe'));var Redis=require('ioredis');var authService=require(_0x7bcc('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x7bcc('0x10'))(_0x7bcc('0x11'));var utils=require(_0x7bcc('0x12'));var config=require(_0x7bcc('0x13'));var licenseUtil=require(_0x7bcc('0x14'));var db=require(_0x7bcc('0x15'))['db'];function respondWithStatusCode(_0xae46e8,_0x51b0e8){_0x51b0e8=_0x51b0e8||0xcc;return function(_0x3e3580){if(_0x3e3580){return _0xae46e8[_0x7bcc('0x16')](_0x51b0e8);}return _0xae46e8[_0x7bcc('0x17')](_0x51b0e8)[_0x7bcc('0x18')]();};}function respondWithResult(_0x39f912,_0x217896){_0x217896=_0x217896||0xc8;return function(_0x4a2539){if(_0x4a2539){return _0x39f912[_0x7bcc('0x17')](_0x217896)[_0x7bcc('0x19')](_0x4a2539);}};}function respondWithFilteredResult(_0x148618,_0x461ff7){return function(_0x30caa2){if(_0x30caa2){var _0x134d55=typeof _0x461ff7[_0x7bcc('0x1a')]==='undefined'&&typeof _0x461ff7[_0x7bcc('0x1b')]==='undefined';var _0x3156f3=_0x30caa2[_0x7bcc('0x1c')];var _0x340bd6=_0x134d55?0x0:_0x461ff7[_0x7bcc('0x1a')];var _0x49168c=_0x134d55?_0x30caa2['count']:_0x461ff7[_0x7bcc('0x1a')]+_0x461ff7[_0x7bcc('0x1b')];var _0x1a1b7f;if(_0x49168c>=_0x3156f3){_0x49168c=_0x3156f3;_0x1a1b7f=0xc8;}else{_0x1a1b7f=0xce;}_0x148618[_0x7bcc('0x17')](_0x1a1b7f);return _0x148618[_0x7bcc('0x1d')](_0x7bcc('0x1e'),_0x340bd6+'-'+_0x49168c+'/'+_0x3156f3)[_0x7bcc('0x19')](_0x30caa2);}return null;};}function patchUpdates(_0x3d0719){return function(_0x15b2c3){try{jsonpatch['apply'](_0x15b2c3,_0x3d0719,!![]);}catch(_0x553865){return BPromise[_0x7bcc('0x1f')](_0x553865);}return _0x15b2c3[_0x7bcc('0x20')]();};}function saveUpdates(_0x34ee2a,_0x3050cf){return function(_0x201f40){if(_0x201f40){return _0x201f40[_0x7bcc('0x21')](_0x34ee2a)[_0x7bcc('0x22')](function(_0x345671){return _0x345671;});}return null;};}function removeEntity(_0x32b3ea,_0x54c611){return function(_0x2d25b8){if(_0x2d25b8){return _0x2d25b8[_0x7bcc('0x23')]()[_0x7bcc('0x22')](function(){_0x32b3ea[_0x7bcc('0x17')](0xcc)[_0x7bcc('0x18')]();});}};}function handleEntityNotFound(_0x1d085c,_0x4f8562){return function(_0x48b296){if(!_0x48b296){_0x1d085c[_0x7bcc('0x16')](0x194);}return _0x48b296;};}function handleError(_0x4a91d0,_0x4db3c0){_0x4db3c0=_0x4db3c0||0x1f4;return function(_0xd3ca3b){logger['error'](_0xd3ca3b[_0x7bcc('0x24')]);if(_0xd3ca3b[_0x7bcc('0x25')]){delete _0xd3ca3b[_0x7bcc('0x25')];}_0x4a91d0['status'](_0x4db3c0)[_0x7bcc('0x26')](_0xd3ca3b);};}exports[_0x7bcc('0x27')]=function(_0x2e92e1,_0x319943){var _0x20c458={'raw':!![],'where':{'id':_0x2e92e1[_0x7bcc('0x28')]['id']}},_0x1ecf95={};_0x1ecf95['model']=_[_0x7bcc('0x29')](db[_0x7bcc('0x2a')]['rawAttributes']);_0x1ecf95['query']=_[_0x7bcc('0x29')](_0x2e92e1['query']);_0x1ecf95[_0x7bcc('0x2b')]=_[_0x7bcc('0x2c')](_0x1ecf95[_0x7bcc('0x2d')],_0x1ecf95[_0x7bcc('0x2e')]);_0x20c458['attributes']=_[_0x7bcc('0x2c')](_0x1ecf95[_0x7bcc('0x2d')],qs[_0x7bcc('0x2f')](_0x2e92e1['query'][_0x7bcc('0x2f')]));_0x20c458[_0x7bcc('0x30')]=_0x20c458[_0x7bcc('0x30')][_0x7bcc('0x31')]?_0x20c458[_0x7bcc('0x30')]:_0x1ecf95[_0x7bcc('0x2d')];if(_0x2e92e1[_0x7bcc('0x2e')][_0x7bcc('0x32')]){_0x20c458[_0x7bcc('0x33')]=[{'all':!![]}];}_0x20c458=_[_0x7bcc('0x34')]({},_0x20c458,_0x2e92e1[_0x7bcc('0x35')]);return db['ChatProactiveAction'][_0x7bcc('0x36')](_0x20c458)[_0x7bcc('0x22')](handleEntityNotFound(_0x319943,null))[_0x7bcc('0x22')](respondWithResult(_0x319943,null))['catch'](handleError(_0x319943,null));};exports['create']=function(_0x409ff4,_0x1ef50b){return db[_0x7bcc('0x2a')][_0x7bcc('0x37')](_0x409ff4[_0x7bcc('0x38')],{})[_0x7bcc('0x22')](respondWithResult(_0x1ef50b,0xc9))[_0x7bcc('0x39')](handleError(_0x1ef50b,null));};exports['update']=function(_0x5bbb4b,_0x5584f6){if(_0x5bbb4b['body']['id']){delete _0x5bbb4b[_0x7bcc('0x38')]['id'];}return db[_0x7bcc('0x2a')][_0x7bcc('0x36')]({'where':{'id':_0x5bbb4b['params']['id']}})[_0x7bcc('0x22')](handleEntityNotFound(_0x5584f6,null))[_0x7bcc('0x22')](saveUpdates(_0x5bbb4b[_0x7bcc('0x38')],null))['then'](respondWithResult(_0x5584f6,null))['catch'](handleError(_0x5584f6,null));};exports[_0x7bcc('0x23')]=function(_0xca6ce3,_0x1d9c06){return db['ChatProactiveAction']['find']({'where':{'id':_0xca6ce3[_0x7bcc('0x28')]['id']}})[_0x7bcc('0x22')](handleEntityNotFound(_0x1d9c06,null))[_0x7bcc('0x22')](removeEntity(_0x1d9c06,null))['catch'](handleError(_0x1d9c06,null));}; \ No newline at end of file +var _0xabe8=['send','model','keys','filters','intersection','query','attributes','fields','length','includeAll','include','merge','options','ChatProactiveAction','find','create','update','body','catch','params','eml-format','rimraf','zip-dir','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','save','then','destroy','end','sendStatus','error','stack','name'];(function(_0x582d37,_0xc34a90){var _0x4aa6b6=function(_0x47224a){while(--_0x47224a){_0x582d37['push'](_0x582d37['shift']());}};_0x4aa6b6(++_0xc34a90);}(_0xabe8,0x8c));var _0x8abe=function(_0x14c257,_0x5c8cb3){_0x14c257=_0x14c257-0x0;var _0x14d71d=_0xabe8[_0x14c257];return _0x14d71d;};'use strict';var emlformat=require(_0x8abe('0x0'));var rimraf=require(_0x8abe('0x1'));var zipdir=require(_0x8abe('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8abe('0x3'));var moment=require(_0x8abe('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x8abe('0x5'));var util=require('util');var path=require(_0x8abe('0x6'));var sox=require(_0x8abe('0x7'));var csv=require(_0x8abe('0x8'));var ejs=require(_0x8abe('0x9'));var fs=require('fs');var fs_extra=require(_0x8abe('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x8abe('0xb'));var jsforce=require(_0x8abe('0xc'));var deskjs=require(_0x8abe('0xd'));var toCsv=require(_0x8abe('0x8'));var querystring=require(_0x8abe('0xe'));var Papa=require(_0x8abe('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x8abe('0x10'));var hardwareService=require(_0x8abe('0x11'));var logger=require(_0x8abe('0x12'))(_0x8abe('0x13'));var utils=require(_0x8abe('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x8abe('0x15'))['db'];function respondWithStatusCode(_0x8d4179,_0x1970b2){_0x1970b2=_0x1970b2||0xcc;return function(_0x3890f8){if(_0x3890f8){return _0x8d4179['sendStatus'](_0x1970b2);}return _0x8d4179['status'](_0x1970b2)['end']();};}function respondWithResult(_0xb75397,_0x5e7c8b){_0x5e7c8b=_0x5e7c8b||0xc8;return function(_0x1c407d){if(_0x1c407d){return _0xb75397['status'](_0x5e7c8b)[_0x8abe('0x16')](_0x1c407d);}};}function respondWithFilteredResult(_0x168f96,_0x5d24ad){return function(_0x1bcd6d){if(_0x1bcd6d){var _0x5bc34a=typeof _0x5d24ad[_0x8abe('0x17')]===_0x8abe('0x18')&&typeof _0x5d24ad[_0x8abe('0x19')]===_0x8abe('0x18');var _0x3f5d9b=_0x1bcd6d[_0x8abe('0x1a')];var _0x1cd7c9=_0x5bc34a?0x0:_0x5d24ad[_0x8abe('0x17')];var _0x45905e=_0x5bc34a?_0x1bcd6d[_0x8abe('0x1a')]:_0x5d24ad[_0x8abe('0x17')]+_0x5d24ad['limit'];var _0x190e2e;if(_0x45905e>=_0x3f5d9b){_0x45905e=_0x3f5d9b;_0x190e2e=0xc8;}else{_0x190e2e=0xce;}_0x168f96[_0x8abe('0x1b')](_0x190e2e);return _0x168f96[_0x8abe('0x1c')](_0x8abe('0x1d'),_0x1cd7c9+'-'+_0x45905e+'/'+_0x3f5d9b)[_0x8abe('0x16')](_0x1bcd6d);}return null;};}function patchUpdates(_0x49f03d){return function(_0x4f6c1c){try{jsonpatch[_0x8abe('0x1e')](_0x4f6c1c,_0x49f03d,!![]);}catch(_0xfa8e74){return BPromise[_0x8abe('0x1f')](_0xfa8e74);}return _0x4f6c1c[_0x8abe('0x20')]();};}function saveUpdates(_0x346153,_0x2f7e3c){return function(_0x113ab2){if(_0x113ab2){return _0x113ab2['update'](_0x346153)[_0x8abe('0x21')](function(_0x1eaf31){return _0x1eaf31;});}return null;};}function removeEntity(_0x383ca7,_0x1873d5){return function(_0x1f9bde){if(_0x1f9bde){return _0x1f9bde[_0x8abe('0x22')]()[_0x8abe('0x21')](function(){_0x383ca7[_0x8abe('0x1b')](0xcc)[_0x8abe('0x23')]();});}};}function handleEntityNotFound(_0x3d1785,_0x40f33a){return function(_0x301d4a){if(!_0x301d4a){_0x3d1785[_0x8abe('0x24')](0x194);}return _0x301d4a;};}function handleError(_0x189440,_0x14c9db){_0x14c9db=_0x14c9db||0x1f4;return function(_0x261c62){logger[_0x8abe('0x25')](_0x261c62[_0x8abe('0x26')]);if(_0x261c62['name']){delete _0x261c62[_0x8abe('0x27')];}_0x189440[_0x8abe('0x1b')](_0x14c9db)[_0x8abe('0x28')](_0x261c62);};}exports['show']=function(_0xca4d,_0x4a899c){var _0x1e9316={'raw':!![],'where':{'id':_0xca4d['params']['id']}},_0x3f30bf={};_0x3f30bf[_0x8abe('0x29')]=_['keys'](db['ChatProactiveAction']['rawAttributes']);_0x3f30bf['query']=_[_0x8abe('0x2a')](_0xca4d['query']);_0x3f30bf[_0x8abe('0x2b')]=_[_0x8abe('0x2c')](_0x3f30bf[_0x8abe('0x29')],_0x3f30bf[_0x8abe('0x2d')]);_0x1e9316[_0x8abe('0x2e')]=_[_0x8abe('0x2c')](_0x3f30bf[_0x8abe('0x29')],qs['fields'](_0xca4d[_0x8abe('0x2d')][_0x8abe('0x2f')]));_0x1e9316[_0x8abe('0x2e')]=_0x1e9316[_0x8abe('0x2e')][_0x8abe('0x30')]?_0x1e9316[_0x8abe('0x2e')]:_0x3f30bf['model'];if(_0xca4d[_0x8abe('0x2d')][_0x8abe('0x31')]){_0x1e9316[_0x8abe('0x32')]=[{'all':!![]}];}_0x1e9316=_[_0x8abe('0x33')]({},_0x1e9316,_0xca4d[_0x8abe('0x34')]);return db[_0x8abe('0x35')][_0x8abe('0x36')](_0x1e9316)[_0x8abe('0x21')](handleEntityNotFound(_0x4a899c,null))[_0x8abe('0x21')](respondWithResult(_0x4a899c,null))['catch'](handleError(_0x4a899c,null));};exports[_0x8abe('0x37')]=function(_0x47d627,_0x1a0364){return db[_0x8abe('0x35')]['create'](_0x47d627['body'],{})[_0x8abe('0x21')](respondWithResult(_0x1a0364,0xc9))['catch'](handleError(_0x1a0364,null));};exports[_0x8abe('0x38')]=function(_0xbf1d9,_0x3599de){if(_0xbf1d9[_0x8abe('0x39')]['id']){delete _0xbf1d9[_0x8abe('0x39')]['id'];}return db['ChatProactiveAction'][_0x8abe('0x36')]({'where':{'id':_0xbf1d9['params']['id']}})['then'](handleEntityNotFound(_0x3599de,null))[_0x8abe('0x21')](saveUpdates(_0xbf1d9[_0x8abe('0x39')],null))[_0x8abe('0x21')](respondWithResult(_0x3599de,null))[_0x8abe('0x3a')](handleError(_0x3599de,null));};exports['destroy']=function(_0xf736e6,_0x30af7c){return db['ChatProactiveAction'][_0x8abe('0x36')]({'where':{'id':_0xf736e6[_0x8abe('0x3b')]['id']}})['then'](handleEntityNotFound(_0x30af7c,null))[_0x8abe('0x21')](removeEntity(_0x30af7c,null))['catch'](handleError(_0x30af7c,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index 898e27e..bd7c3aa 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 _0x8b76=['chat_proactive_actions','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','ChatProactiveAction'];(function(_0x37e73c,_0x4fa2c3){var _0x254f4a=function(_0x50cc8a){while(--_0x50cc8a){_0x37e73c['push'](_0x37e73c['shift']());}};_0x254f4a(++_0x4fa2c3);}(_0x8b76,0xa6));var _0x68b7=function(_0x4fe14f,_0x37b889){_0x4fe14f=_0x4fe14f-0x0;var _0x4ee627=_0x8b76[_0x4fe14f];return _0x4ee627;};'use strict';var _=require('lodash');var util=require(_0x68b7('0x0'));var logger=require(_0x68b7('0x1'))('api');var moment=require(_0x68b7('0x2'));var BPromise=require(_0x68b7('0x3'));var rp=require(_0x68b7('0x4'));var fs=require('fs');var path=require(_0x68b7('0x5'));var rimraf=require(_0x68b7('0x6'));var config=require(_0x68b7('0x7'));var attributes=require('./chatProactiveAction.attributes');module[_0x68b7('0x8')]=function(_0x51188b,_0x1ba7fb){return _0x51188b['define'](_0x68b7('0x9'),attributes,{'tableName':_0x68b7('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2993=['exports','define','ChatProactiveAction','lodash','api','bluebird','request-promise','path','./chatProactiveAction.attributes'];(function(_0x98f259,_0x2717e0){var _0x1efd09=function(_0x5275a8){while(--_0x5275a8){_0x98f259['push'](_0x98f259['shift']());}};_0x1efd09(++_0x2717e0);}(_0x2993,0x111));var _0x3299=function(_0x558d79,_0x277c8b){_0x558d79=_0x558d79-0x0;var _0x6efbf9=_0x2993[_0x558d79];return _0x6efbf9;};'use strict';var _=require(_0x3299('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x3299('0x1'));var moment=require('moment');var BPromise=require(_0x3299('0x2'));var rp=require(_0x3299('0x3'));var fs=require('fs');var path=require(_0x3299('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x3299('0x5'));module[_0x3299('0x6')]=function(_0x3d624c,_0x4141b2){return _0x3d624c[_0x3299('0x7')](_0x3299('0x8'),attributes,{'tableName':'chat_proactive_actions','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 2314176..6eeb2cb 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 _0x8bc9=['jayson/promise','client','http','request','then','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x2dadb9,_0x42cfe6){var _0x2f0097=function(_0x21163f){while(--_0x21163f){_0x2dadb9['push'](_0x2dadb9['shift']());}};_0x2f0097(++_0x42cfe6);}(_0x8bc9,0x1c3));var _0x98bc=function(_0x3c9f35,_0x5b7c71){_0x3c9f35=_0x3c9f35-0x0;var _0x1debe1=_0x8bc9[_0x3c9f35];return _0x1debe1;};'use strict';var _=require(_0x98bc('0x0'));var util=require(_0x98bc('0x1'));var moment=require('moment');var BPromise=require(_0x98bc('0x2'));var rs=require(_0x98bc('0x3'));var fs=require('fs');var Redis=require(_0x98bc('0x4'));var db=require(_0x98bc('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x98bc('0x6'))(_0x98bc('0x7'));var config=require(_0x98bc('0x8'));var jayson=require(_0x98bc('0x9'));var client=jayson[_0x98bc('0xa')][_0x98bc('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x31bc8a,_0x3bb921,_0x1d277a){return new BPromise(function(_0x1a6e5f,_0x40c817){return client[_0x98bc('0xc')](_0x31bc8a,_0x1d277a)[_0x98bc('0xd')](function(_0x150986){logger[_0x98bc('0xe')](_0x98bc('0xf'),_0x3bb921,_0x98bc('0x10'));logger[_0x98bc('0x11')](_0x98bc('0x12'),_0x3bb921,_0x98bc('0x10'),JSON['stringify'](_0x150986));if(_0x150986[_0x98bc('0x13')]){if(_0x150986[_0x98bc('0x13')][_0x98bc('0x14')]===0x1f4){logger[_0x98bc('0x13')](_0x98bc('0xf'),_0x3bb921,_0x150986[_0x98bc('0x13')][_0x98bc('0x15')]);return _0x40c817(_0x150986[_0x98bc('0x13')][_0x98bc('0x15')]);}logger['error'](_0x98bc('0xf'),_0x3bb921,_0x150986[_0x98bc('0x13')]['message']);return _0x1a6e5f(_0x150986[_0x98bc('0x13')][_0x98bc('0x15')]);}else{logger[_0x98bc('0xe')](_0x98bc('0xf'),_0x3bb921,_0x98bc('0x10'));_0x1a6e5f(_0x150986['result']['message']);}})[_0x98bc('0x16')](function(_0x15b52c){logger[_0x98bc('0x13')]('ChatProactiveAction,\x20%s,\x20%s',_0x3bb921,_0x15b52c);_0x40c817(_0x15b52c);});});} \ No newline at end of file +var _0x747f=['request','info','ChatProactiveAction,\x20%s,\x20%s','ChatProactiveAction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http'];(function(_0x44f1a9,_0x5900db){var _0x23c674=function(_0x4921b2){while(--_0x4921b2){_0x44f1a9['push'](_0x44f1a9['shift']());}};_0x23c674(++_0x5900db);}(_0x747f,0x96));var _0xf747=function(_0x107d5a,_0x76116){_0x107d5a=_0x107d5a-0x0;var _0x1c42a1=_0x747f[_0x107d5a];return _0x1c42a1;};'use strict';var _=require('lodash');var util=require(_0xf747('0x0'));var moment=require(_0xf747('0x1'));var BPromise=require(_0xf747('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf747('0x3'));var db=require(_0xf747('0x4'))['db'];var utils=require(_0xf747('0x5'));var logger=require(_0xf747('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xf747('0x7'));var client=jayson[_0xf747('0x8')][_0xf747('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x11e47a,_0x125ed6,_0x24aeb6){return new BPromise(function(_0xf0b5b1,_0x5f153a){return client[_0xf747('0xa')](_0x11e47a,_0x24aeb6)['then'](function(_0x118b13){logger[_0xf747('0xb')](_0xf747('0xc'),_0x125ed6,'request\x20sent');logger['debug'](_0xf747('0xd'),_0x125ed6,_0xf747('0xe'),JSON[_0xf747('0xf')](_0x118b13));if(_0x118b13[_0xf747('0x10')]){if(_0x118b13[_0xf747('0x10')]['code']===0x1f4){logger[_0xf747('0x10')](_0xf747('0xc'),_0x125ed6,_0x118b13[_0xf747('0x10')][_0xf747('0x11')]);return _0x5f153a(_0x118b13['error']['message']);}logger[_0xf747('0x10')](_0xf747('0xc'),_0x125ed6,_0x118b13[_0xf747('0x10')][_0xf747('0x11')]);return _0xf0b5b1(_0x118b13['error'][_0xf747('0x11')]);}else{logger[_0xf747('0xb')](_0xf747('0xc'),_0x125ed6,'request\x20sent');_0xf0b5b1(_0x118b13[_0xf747('0x12')][_0xf747('0x11')]);}})[_0xf747('0x13')](function(_0x1960ae){logger['error'](_0xf747('0xc'),_0x125ed6,_0x1960ae);_0x5f153a(_0x1960ae);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index 47f3250..f0bbc17 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 _0xfdbd=['create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatProactiveAction.controller','/:id','isAuthenticated'];(function(_0x359103,_0x3c6910){var _0x292883=function(_0x3f2034){while(--_0x3f2034){_0x359103['push'](_0x359103['shift']());}};_0x292883(++_0x3c6910);}(_0xfdbd,0xf0));var _0xdfdb=function(_0x1c546c,_0x5c57cb){_0x1c546c=_0x1c546c-0x0;var _0x2cc384=_0xfdbd[_0x1c546c];return _0x2cc384;};'use strict';var multer=require(_0xdfdb('0x0'));var util=require(_0xdfdb('0x1'));var path=require(_0xdfdb('0x2'));var timeout=require(_0xdfdb('0x3'));var express=require(_0xdfdb('0x4'));var router=express[_0xdfdb('0x5')]();var fs_extra=require(_0xdfdb('0x6'));var auth=require(_0xdfdb('0x7'));var interaction=require(_0xdfdb('0x8'));var config=require('../../config/environment');var controller=require(_0xdfdb('0x9'));router['get'](_0xdfdb('0xa'),auth[_0xdfdb('0xb')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0xdfdb('0xc')]);router[_0xdfdb('0xd')]('/:id',auth[_0xdfdb('0xb')](),controller[_0xdfdb('0xe')]);router[_0xdfdb('0xf')](_0xdfdb('0xa'),auth[_0xdfdb('0xb')](),controller[_0xdfdb('0x10')]);module[_0xdfdb('0x11')]=router; \ No newline at end of file +var _0xeda8=['get','/:id','isAuthenticated','show','create','put','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller'];(function(_0x26cc1e,_0xcf207b){var _0x322a29=function(_0x5c74cc){while(--_0x5c74cc){_0x26cc1e['push'](_0x26cc1e['shift']());}};_0x322a29(++_0xcf207b);}(_0xeda8,0x104));var _0x8eda=function(_0x1384db,_0x4ef2c6){_0x1384db=_0x1384db-0x0;var _0x3a53e3=_0xeda8[_0x1384db];return _0x3a53e3;};'use strict';var multer=require(_0x8eda('0x0'));var util=require(_0x8eda('0x1'));var path=require('path');var timeout=require(_0x8eda('0x2'));var express=require(_0x8eda('0x3'));var router=express[_0x8eda('0x4')]();var fs_extra=require(_0x8eda('0x5'));var auth=require(_0x8eda('0x6'));var interaction=require(_0x8eda('0x7'));var config=require(_0x8eda('0x8'));var controller=require(_0x8eda('0x9'));router[_0x8eda('0xa')](_0x8eda('0xb'),auth[_0x8eda('0xc')](),controller[_0x8eda('0xd')]);router['post']('/',auth[_0x8eda('0xc')](),controller[_0x8eda('0xe')]);router[_0x8eda('0xf')](_0x8eda('0xb'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x8eda('0xc')](),controller[_0x8eda('0x10')]);module[_0x8eda('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 a1a2d5b..b330372 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 _0xcac9=['name','INTEGER','rrmemory','beepall','roundrobin','sequelize','STRING'];(function(_0x43aebc,_0x249358){var _0x4bd802=function(_0x15d5c4){while(--_0x15d5c4){_0x43aebc['push'](_0x43aebc['shift']());}};_0x4bd802(++_0x249358);}(_0xcac9,0x178));var _0x9cac=function(_0x40220a,_0x22feb1){_0x40220a=_0x40220a-0x0;var _0x3903cc=_0xcac9[_0x40220a];return _0x3903cc;};'use strict';var Sequelize=require(_0x9cac('0x0'));module['exports']={'name':{'type':Sequelize[_0x9cac('0x1')],'unique':_0x9cac('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x9cac('0x1')]},'timeout':{'type':Sequelize[_0x9cac('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x9cac('0x4'),_0x9cac('0x5'),_0x9cac('0x6'))}}; \ No newline at end of file +var _0xd982=['exports','STRING','INTEGER','ENUM','rrmemory','beepall'];(function(_0x1406ae,_0x292395){var _0x23a076=function(_0x5e147a){while(--_0x5e147a){_0x1406ae['push'](_0x1406ae['shift']());}};_0x23a076(++_0x292395);}(_0xd982,0xa8));var _0x2d98=function(_0xd7bb0b,_0x3e7cd5){_0xd7bb0b=_0xd7bb0b-0x0;var _0x116565=_0xd982[_0xd7bb0b];return _0x116565;};'use strict';var Sequelize=require('sequelize');module[_0x2d98('0x0')]={'name':{'type':Sequelize[_0x2d98('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x2d98('0x1')]},'timeout':{'type':Sequelize[_0x2d98('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x2d98('0x3')](_0x2d98('0x4'),_0x2d98('0x5'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index 628ed46..2075fc4 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 _0xb7a0=['client','http','request','then','info','ChatQueue,\x20%s,\x20%s','debug','ChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','get','ChatQueues','UserProfileResource','name','send','map','ChatQueue','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','order','sort','pick','where','merge','VIRTUAL','filter','options','findAll','rows','params','keys','includeAll','include','create','user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','UserChatQueue','hasOwnProperty','nolimit','User','findAndCountAll','UserId','agent','chatPause','updatedAt','createdAt','SIP','Team','getTeams','addTeams','ids','Agents','flatMap','sequelize','transaction','each','findOrCreate','emit','userChatQueue:save','removeTeams','field','tq.TeamId','from','team_has_chat_queues','user_has_teams','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','SELECT','TeamId','includes','all','compact','value','isEmpty','removeAgents','forEach','userChatQueue:remove','addAgents','omit','spread','isArray','getAgents','findOne','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','redis','defaults','socket.io-emitter'];(function(_0x3857c0,_0x4bd9ac){var _0x4ee3a9=function(_0x553023){while(--_0x553023){_0x3857c0['push'](_0x3857c0['shift']());}};_0x4ee3a9(++_0x4bd9ac);}(_0xb7a0,0x7a));var _0x0b7a=function(_0x12d8a0,_0x5c14b){_0x12d8a0=_0x12d8a0-0x0;var _0x2b8cb6=_0xb7a0[_0x12d8a0];return _0x2b8cb6;};'use strict';var emlformat=require(_0x0b7a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0b7a('0x1'));var jsonpatch=require(_0x0b7a('0x2'));var rp=require(_0x0b7a('0x3'));var moment=require(_0x0b7a('0x4'));var BPromise=require(_0x0b7a('0x5'));var Mustache=require(_0x0b7a('0x6'));var util=require(_0x0b7a('0x7'));var path=require(_0x0b7a('0x8'));var sox=require(_0x0b7a('0x9'));var csv=require(_0x0b7a('0xa'));var ejs=require(_0x0b7a('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x0b7a('0xc'));var crypto=require(_0x0b7a('0xd'));var jsforce=require(_0x0b7a('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x0b7a('0xa'));var querystring=require(_0x0b7a('0xf'));var Papa=require(_0x0b7a('0x10'));var Redis=require('ioredis');var authService=require(_0x0b7a('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x0b7a('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0b7a('0x13'))(_0x0b7a('0x14'));var utils=require('../../config/utils');var config=require(_0x0b7a('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x0b7a('0x16')]=_[_0x0b7a('0x17')](config[_0x0b7a('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0x0b7a('0x18'))(new Redis(config[_0x0b7a('0x16')]));require('./chatQueue.socket')['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x0b7a('0x19')][_0x0b7a('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x1f51e2,_0x1754a0,_0x4b1320,_0xb21f28){return new BPromise(function(_0x33dcfd,_0x433b8c){var _0x4acc60=_0xb21f28||client;return _0x4acc60[_0x0b7a('0x1b')](_0x1f51e2,_0x4b1320)[_0x0b7a('0x1c')](function(_0x4a8329){logger[_0x0b7a('0x1d')](_0x0b7a('0x1e'),_0x1754a0,'request\x20sent');logger[_0x0b7a('0x1f')](_0x0b7a('0x20'),_0x1754a0,_0x0b7a('0x21'),JSON['stringify'](_0x4a8329));if(_0x4a8329[_0x0b7a('0x22')]){if(_0x4a8329['error'][_0x0b7a('0x23')]===0x1f4){logger[_0x0b7a('0x22')](_0x0b7a('0x1e'),_0x1754a0,_0x4a8329[_0x0b7a('0x22')][_0x0b7a('0x24')]);return _0x433b8c(_0x4a8329['error'][_0x0b7a('0x24')]);}logger[_0x0b7a('0x22')]('ChatQueue,\x20%s,\x20%s',_0x1754a0,_0x4a8329['error'][_0x0b7a('0x24')]);return _0x33dcfd(_0x4a8329['error'][_0x0b7a('0x24')]);}else{logger[_0x0b7a('0x1d')](_0x0b7a('0x1e'),_0x1754a0,'request\x20sent');_0x33dcfd(_0x4a8329[_0x0b7a('0x25')][_0x0b7a('0x24')]);}})[_0x0b7a('0x26')](function(_0x3c31f0){logger[_0x0b7a('0x22')](_0x0b7a('0x1e'),_0x1754a0,_0x3c31f0);_0x433b8c(_0x3c31f0);});});}function respondWithStatusCode(_0x29412c,_0x26d990){_0x26d990=_0x26d990||0xcc;return function(_0x50f3bd){if(_0x50f3bd){return _0x29412c[_0x0b7a('0x27')](_0x26d990);}return _0x29412c[_0x0b7a('0x28')](_0x26d990)[_0x0b7a('0x29')]();};}function respondWithResult(_0x189be2,_0xb6b405){_0xb6b405=_0xb6b405||0xc8;return function(_0x59f012){if(_0x59f012){return _0x189be2[_0x0b7a('0x28')](_0xb6b405)[_0x0b7a('0x2a')](_0x59f012);}};}function respondWithFilteredResult(_0x4a090f,_0x6f5a47){return function(_0x15db84){if(_0x15db84){var _0x41cbcb=typeof _0x6f5a47[_0x0b7a('0x2b')]===_0x0b7a('0x2c')&&typeof _0x6f5a47[_0x0b7a('0x2d')]==='undefined';var _0x18b6af=_0x15db84['count'];var _0x127978=_0x41cbcb?0x0:_0x6f5a47[_0x0b7a('0x2b')];var _0x4cdc21=_0x41cbcb?_0x15db84[_0x0b7a('0x2e')]:_0x6f5a47[_0x0b7a('0x2b')]+_0x6f5a47[_0x0b7a('0x2d')];var _0x3fc2a6;if(_0x4cdc21>=_0x18b6af){_0x4cdc21=_0x18b6af;_0x3fc2a6=0xc8;}else{_0x3fc2a6=0xce;}_0x4a090f['status'](_0x3fc2a6);return _0x4a090f[_0x0b7a('0x2f')](_0x0b7a('0x30'),_0x127978+'-'+_0x4cdc21+'/'+_0x18b6af)[_0x0b7a('0x2a')](_0x15db84);}return null;};}function patchUpdates(_0xf3a331){return function(_0x3d2317){try{jsonpatch[_0x0b7a('0x31')](_0x3d2317,_0xf3a331,!![]);}catch(_0x22145e){return BPromise[_0x0b7a('0x32')](_0x22145e);}return _0x3d2317[_0x0b7a('0x33')]();};}function saveUpdates(_0x32592e,_0x3bd5ca){return function(_0x32fe95){if(_0x32fe95){return _0x32fe95[_0x0b7a('0x34')](_0x32592e)[_0x0b7a('0x1c')](function(_0x4b8371){return _0x4b8371;});}return null;};}function removeEntity(_0x28bae6,_0x5c1e5f){return function(_0x535269){if(_0x535269){return _0x535269[_0x0b7a('0x35')]()[_0x0b7a('0x1c')](function(){var _0x15c5aa=_0x535269[_0x0b7a('0x36')]({'plain':!![]});var _0x3a4ef3=_0x0b7a('0x37');return db[_0x0b7a('0x38')]['destroy']({'where':{'type':_0x3a4ef3,'resourceId':_0x15c5aa['id']}})[_0x0b7a('0x1c')](function(){return _0x535269;});})['then'](function(){_0x28bae6[_0x0b7a('0x28')](0xcc)[_0x0b7a('0x29')]();});}};}function handleEntityNotFound(_0x1fa16f,_0x366e0f){return function(_0x310ca7){if(!_0x310ca7){_0x1fa16f['sendStatus'](0x194);}return _0x310ca7;};}function handleError(_0x4c9b97,_0x1b893a){_0x1b893a=_0x1b893a||0x1f4;return function(_0x92e730){logger['error'](_0x92e730['stack']);if(_0x92e730[_0x0b7a('0x39')]){delete _0x92e730[_0x0b7a('0x39')];}_0x4c9b97['status'](_0x1b893a)[_0x0b7a('0x3a')](_0x92e730);};}exports['index']=function(_0x39d506,_0x250e9d){var _0x2e31b7={},_0x2d2fd3={},_0x2a7be8={'count':0x0,'rows':[]};var _0x590f0a=_[_0x0b7a('0x3b')](db[_0x0b7a('0x3c')][_0x0b7a('0x3d')],function(_0x52ef7c){return{'name':_0x52ef7c[_0x0b7a('0x3e')],'type':_0x52ef7c[_0x0b7a('0x3f')][_0x0b7a('0x40')]};});_0x2d2fd3[_0x0b7a('0x41')]=_[_0x0b7a('0x3b')](_0x590f0a,_0x0b7a('0x39'));_0x2d2fd3[_0x0b7a('0x42')]=_['keys'](_0x39d506['query']);_0x2d2fd3[_0x0b7a('0x43')]=_[_0x0b7a('0x44')](_0x2d2fd3['model'],_0x2d2fd3[_0x0b7a('0x42')]);_0x2e31b7['attributes']=_[_0x0b7a('0x44')](_0x2d2fd3[_0x0b7a('0x41')],qs[_0x0b7a('0x45')](_0x39d506[_0x0b7a('0x42')][_0x0b7a('0x45')]));_0x2e31b7[_0x0b7a('0x46')]=_0x2e31b7[_0x0b7a('0x46')][_0x0b7a('0x47')]?_0x2e31b7['attributes']:_0x2d2fd3[_0x0b7a('0x41')];if(!_0x39d506[_0x0b7a('0x42')]['hasOwnProperty']('nolimit')){_0x2e31b7['limit']=qs['limit'](_0x39d506[_0x0b7a('0x42')][_0x0b7a('0x2d')]);_0x2e31b7[_0x0b7a('0x2b')]=qs[_0x0b7a('0x2b')](_0x39d506[_0x0b7a('0x42')][_0x0b7a('0x2b')]);}_0x2e31b7[_0x0b7a('0x48')]=qs[_0x0b7a('0x49')](_0x39d506[_0x0b7a('0x42')][_0x0b7a('0x49')]);_0x2e31b7['where']=qs['filters'](_[_0x0b7a('0x4a')](_0x39d506[_0x0b7a('0x42')],_0x2d2fd3[_0x0b7a('0x43')]),_0x590f0a);if(_0x39d506[_0x0b7a('0x42')]['filter']){_0x2e31b7[_0x0b7a('0x4b')]=_[_0x0b7a('0x4c')](_0x2e31b7[_0x0b7a('0x4b')],{'$or':_[_0x0b7a('0x3b')](_0x590f0a,function(_0x390c83){if(_0x390c83['type']!==_0x0b7a('0x4d')){var _0x43793c={};_0x43793c[_0x390c83['name']]={'$like':'%'+_0x39d506[_0x0b7a('0x42')][_0x0b7a('0x4e')]+'%'};return _0x43793c;}})});}_0x2e31b7=_['merge']({},_0x2e31b7,_0x39d506[_0x0b7a('0x4f')]);var _0x299778={'where':_0x2e31b7['where']};return db[_0x0b7a('0x3c')][_0x0b7a('0x2e')](_0x299778)[_0x0b7a('0x1c')](function(_0x3230fa){_0x2a7be8[_0x0b7a('0x2e')]=_0x3230fa;if(_0x39d506[_0x0b7a('0x42')]['includeAll']){_0x2e31b7['include']=[{'all':!![]}];}return db[_0x0b7a('0x3c')][_0x0b7a('0x50')](_0x2e31b7);})['then'](function(_0x37c645){_0x2a7be8[_0x0b7a('0x51')]=_0x37c645;return _0x2a7be8;})['then'](respondWithFilteredResult(_0x250e9d,_0x2e31b7))['catch'](handleError(_0x250e9d,null));};exports['show']=function(_0x479f8b,_0x1f3b5a){var _0x591875={'raw':!![],'where':{'id':_0x479f8b[_0x0b7a('0x52')]['id']}},_0x504ca1={};_0x504ca1['model']=_[_0x0b7a('0x53')](db[_0x0b7a('0x3c')][_0x0b7a('0x3d')]);_0x504ca1[_0x0b7a('0x42')]=_[_0x0b7a('0x53')](_0x479f8b['query']);_0x504ca1['filters']=_[_0x0b7a('0x44')](_0x504ca1[_0x0b7a('0x41')],_0x504ca1[_0x0b7a('0x42')]);_0x591875[_0x0b7a('0x46')]=_[_0x0b7a('0x44')](_0x504ca1[_0x0b7a('0x41')],qs['fields'](_0x479f8b[_0x0b7a('0x42')][_0x0b7a('0x45')]));_0x591875[_0x0b7a('0x46')]=_0x591875[_0x0b7a('0x46')][_0x0b7a('0x47')]?_0x591875['attributes']:_0x504ca1[_0x0b7a('0x41')];if(_0x479f8b[_0x0b7a('0x42')][_0x0b7a('0x54')]){_0x591875[_0x0b7a('0x55')]=[{'all':!![]}];}_0x591875=_['merge']({},_0x591875,_0x479f8b[_0x0b7a('0x4f')]);return db[_0x0b7a('0x3c')]['find'](_0x591875)['then'](handleEntityNotFound(_0x1f3b5a,null))[_0x0b7a('0x1c')](respondWithResult(_0x1f3b5a,null))[_0x0b7a('0x26')](handleError(_0x1f3b5a,null));};exports[_0x0b7a('0x56')]=function(_0x2585ca,_0x43ecaf){return db[_0x0b7a('0x3c')][_0x0b7a('0x56')](_0x2585ca['body'],{})['then'](function(_0x5c261d){var _0x4dd07a=_0x2585ca[_0x0b7a('0x57')]['get']({'plain':!![]});if(!_0x4dd07a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4dd07a[_0x0b7a('0x58')]===_0x0b7a('0x57')){var _0x1761e5=_0x5c261d['get']({'plain':!![]});var _0x16b2e2='ChatQueues';return db[_0x0b7a('0x59')][_0x0b7a('0x5a')]({'where':{'name':_0x16b2e2,'userProfileId':_0x4dd07a[_0x0b7a('0x5b')]},'raw':!![]})[_0x0b7a('0x1c')](function(_0x26995f){if(_0x26995f&&_0x26995f[_0x0b7a('0x5c')]===0x0){return db[_0x0b7a('0x38')][_0x0b7a('0x56')]({'name':_0x1761e5[_0x0b7a('0x39')],'resourceId':_0x1761e5['id'],'type':_0x26995f[_0x0b7a('0x39')],'sectionId':_0x26995f['id']},{})['then'](function(){return _0x5c261d;});}else{return _0x5c261d;}})[_0x0b7a('0x26')](function(_0x5963ea){logger[_0x0b7a('0x22')](_0x0b7a('0x5d'),_0x5963ea);throw _0x5963ea;});}return _0x5c261d;})[_0x0b7a('0x1c')](respondWithResult(_0x43ecaf,0xc9))['catch'](handleError(_0x43ecaf,null));};exports[_0x0b7a('0x34')]=function(_0x5c376d,_0x5dc6c7){if(_0x5c376d[_0x0b7a('0x5e')]['id']){delete _0x5c376d[_0x0b7a('0x5e')]['id'];}return db['ChatQueue'][_0x0b7a('0x5a')]({'where':{'id':_0x5c376d['params']['id']}})[_0x0b7a('0x1c')](handleEntityNotFound(_0x5dc6c7,null))[_0x0b7a('0x1c')](saveUpdates(_0x5c376d['body'],null))[_0x0b7a('0x1c')](respondWithResult(_0x5dc6c7,null))[_0x0b7a('0x26')](handleError(_0x5dc6c7,null));};exports[_0x0b7a('0x35')]=function(_0x252bff,_0x3cde5c){return db[_0x0b7a('0x3c')]['find']({'where':{'id':_0x252bff[_0x0b7a('0x52')]['id']}})[_0x0b7a('0x1c')](handleEntityNotFound(_0x3cde5c,null))['then'](removeEntity(_0x3cde5c,null))[_0x0b7a('0x26')](handleError(_0x3cde5c,null));};exports[_0x0b7a('0x5f')]=function(_0x5f2d34,_0x3ff498){return db['ChatQueue'][_0x0b7a('0x5f')]()[_0x0b7a('0x1c')](respondWithResult(_0x3ff498,null))['catch'](handleError(_0x3ff498,null));};exports[_0x0b7a('0x60')]=function(_0x4f8879,_0x54a2c4,_0x44efb0){var _0x5b8ccd={'raw':!![],'where':{}},_0x4cfb11={},_0x4d7cb0;return db[_0x0b7a('0x3c')]['findOne']({'where':{'id':_0x4f8879['params']['id']}})[_0x0b7a('0x1c')](handleEntityNotFound(_0x54a2c4,null))[_0x0b7a('0x1c')](function(_0x22cfa2){if(_0x22cfa2){_0x4d7cb0=_0x22cfa2[_0x0b7a('0x36')]({'plain':!![]});_0x4cfb11[_0x0b7a('0x41')]=_['keys'](db[_0x0b7a('0x61')][_0x0b7a('0x3d')]);_0x4cfb11[_0x0b7a('0x42')]=_[_0x0b7a('0x53')](_0x4f8879['query']);_0x4cfb11['filters']=_[_0x0b7a('0x44')](_0x4cfb11[_0x0b7a('0x41')],_0x4cfb11[_0x0b7a('0x42')]);_0x5b8ccd[_0x0b7a('0x46')]=_['intersection'](_0x4cfb11['model'],qs[_0x0b7a('0x45')](_0x4f8879[_0x0b7a('0x42')][_0x0b7a('0x45')]));_0x5b8ccd['attributes']=_0x5b8ccd[_0x0b7a('0x46')][_0x0b7a('0x47')]?_0x5b8ccd[_0x0b7a('0x46')]:_0x4cfb11[_0x0b7a('0x41')];if(!_0x4f8879[_0x0b7a('0x42')][_0x0b7a('0x62')](_0x0b7a('0x63'))){_0x5b8ccd['limit']=qs[_0x0b7a('0x2d')](_0x4f8879['query'][_0x0b7a('0x2d')]);_0x5b8ccd[_0x0b7a('0x2b')]=qs[_0x0b7a('0x2b')](_0x4f8879[_0x0b7a('0x42')][_0x0b7a('0x2b')]);}_0x5b8ccd[_0x0b7a('0x48')]=qs['sort'](_0x4f8879[_0x0b7a('0x42')]['sort']);_0x5b8ccd[_0x0b7a('0x4b')]=qs[_0x0b7a('0x43')](_['pick'](_0x4f8879[_0x0b7a('0x42')],_0x4cfb11[_0x0b7a('0x43')]));_0x5b8ccd[_0x0b7a('0x4b')]['ChatQueueId']=_0x22cfa2['id'];if(_0x4f8879[_0x0b7a('0x42')][_0x0b7a('0x4e')]){_0x5b8ccd[_0x0b7a('0x4b')]=_['merge'](_0x5b8ccd[_0x0b7a('0x4b')],{'$or':_['map'](_0x5b8ccd['attributes'],function(_0x426e2a){var _0x3bc134={};_0x3bc134[_0x426e2a]={'$like':'%'+_0x4f8879[_0x0b7a('0x42')]['filter']+'%'};return _0x3bc134;})});}_0x5b8ccd=_[_0x0b7a('0x4c')]({},_0x5b8ccd,_0x4f8879['options']);return db[_0x0b7a('0x61')][_0x0b7a('0x50')](_0x5b8ccd);}})['then'](function(_0x56b05e){if(_0x56b05e){return db[_0x0b7a('0x64')][_0x0b7a('0x65')]({'where':{'id':_[_0x0b7a('0x3b')](_0x56b05e,_0x0b7a('0x66')),'role':_0x0b7a('0x67')},'attributes':['id','name',_0x0b7a('0x68'),_0x0b7a('0x69'),_0x0b7a('0x6a')]});}})[_0x0b7a('0x1c')](function(_0x5cda5b){if(_0x5cda5b){return{'count':_0x5cda5b['count'],'rows':_[_0x0b7a('0x3b')](_0x5cda5b['rows'],function(_0x51c671){return{'membername':_0x51c671[_0x0b7a('0x39')],'UserId':_0x51c671['id'],'queue_name':_0x4d7cb0[_0x0b7a('0x39')],'ChatQueueId':_0x4d7cb0['id'],'interface':util['format']('%s/%s',_0x0b7a('0x6b'),_0x51c671[_0x0b7a('0x39')]),'penalty':0x0,'paused':_0x51c671['chatPause'],'createdAt':_0x51c671['createdAt'],'updatedAt':_0x51c671['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x0b7a('0x1c')](respondWithFilteredResult(_0x54a2c4,_0x5b8ccd))[_0x0b7a('0x26')](handleError(_0x54a2c4,null));};exports['getTeams']=function(_0x2404d2,_0x149432,_0x108a93){var _0x310831={};var _0x1128b8={};var _0x284d4d;var _0x614f52;return db['ChatQueue']['findOne']({'where':{'id':_0x2404d2[_0x0b7a('0x52')]['id']}})[_0x0b7a('0x1c')](handleEntityNotFound(_0x149432,null))[_0x0b7a('0x1c')](function(_0x638846){if(_0x638846){_0x284d4d=_0x638846;_0x1128b8[_0x0b7a('0x41')]=_[_0x0b7a('0x53')](db[_0x0b7a('0x6c')]['rawAttributes']);_0x1128b8[_0x0b7a('0x42')]=_['keys'](_0x2404d2[_0x0b7a('0x42')]);_0x1128b8[_0x0b7a('0x43')]=_[_0x0b7a('0x44')](_0x1128b8[_0x0b7a('0x41')],_0x1128b8[_0x0b7a('0x42')]);_0x310831['attributes']=_[_0x0b7a('0x44')](_0x1128b8['model'],qs[_0x0b7a('0x45')](_0x2404d2['query'][_0x0b7a('0x45')]));_0x310831[_0x0b7a('0x46')]=_0x310831['attributes'][_0x0b7a('0x47')]?_0x310831['attributes']:_0x1128b8[_0x0b7a('0x41')];_0x310831[_0x0b7a('0x48')]=qs[_0x0b7a('0x49')](_0x2404d2[_0x0b7a('0x42')][_0x0b7a('0x49')]);_0x310831[_0x0b7a('0x4b')]=qs[_0x0b7a('0x43')](_[_0x0b7a('0x4a')](_0x2404d2[_0x0b7a('0x42')],_0x1128b8[_0x0b7a('0x43')]));if(_0x2404d2[_0x0b7a('0x42')]['filter']){_0x310831[_0x0b7a('0x4b')]=_[_0x0b7a('0x4c')](_0x310831['where'],{'$or':_[_0x0b7a('0x3b')](_0x310831[_0x0b7a('0x46')],function(_0x593f48){var _0x2b99ee={};_0x2b99ee[_0x593f48]={'$like':'%'+_0x2404d2['query']['filter']+'%'};return _0x2b99ee;})});}_0x310831=_[_0x0b7a('0x4c')]({},_0x310831,_0x2404d2[_0x0b7a('0x4f')]);return _0x284d4d[_0x0b7a('0x6d')](_0x310831);}})[_0x0b7a('0x1c')](function(_0x5aba99){if(_0x5aba99){_0x614f52=_0x5aba99[_0x0b7a('0x47')];if(!_0x2404d2[_0x0b7a('0x42')][_0x0b7a('0x62')](_0x0b7a('0x63'))){_0x310831['limit']=qs[_0x0b7a('0x2d')](_0x2404d2[_0x0b7a('0x42')][_0x0b7a('0x2d')]);_0x310831[_0x0b7a('0x2b')]=qs[_0x0b7a('0x2b')](_0x2404d2['query'][_0x0b7a('0x2b')]);}return _0x284d4d['getTeams'](_0x310831);}})[_0x0b7a('0x1c')](function(_0x4bc2db){if(_0x4bc2db){return _0x4bc2db?{'count':_0x614f52,'rows':_0x4bc2db}:null;}})[_0x0b7a('0x1c')](respondWithResult(_0x149432,null))[_0x0b7a('0x26')](handleError(_0x149432,null));};exports[_0x0b7a('0x6e')]=function(_0x81bd50,_0x2e2102,_0x52350c){var _0x35e4f0=_0x81bd50['body'][_0x0b7a('0x6f')];return db[_0x0b7a('0x6c')]['findAll']({'where':{'id':_0x35e4f0},'attributes':['id'],'include':[{'model':db[_0x0b7a('0x64')],'as':_0x0b7a('0x70'),'attributes':['id',_0x0b7a('0x39'),'online','voicePause','interface'],'raw':!![]}]})[_0x0b7a('0x1c')](function(_0x522d6a){if(_0x522d6a){var _0x248818=_[_0x0b7a('0x71')](_0x522d6a,function(_0x2b46d7){var _0x20aba8=_0x2b46d7[_0x0b7a('0x36')]({'plain':!![]});return _0x20aba8[_0x0b7a('0x70')];});return db[_0x0b7a('0x3c')][_0x0b7a('0x5a')]({'where':{'id':_0x81bd50[_0x0b7a('0x52')]['id']}})[_0x0b7a('0x1c')](function(_0x1c4eaa){return db[_0x0b7a('0x72')][_0x0b7a('0x73')](function(_0x13c7e4){return _0x1c4eaa[_0x0b7a('0x6e')](_0x35e4f0,{'transaction':_0x13c7e4})[_0x0b7a('0x1c')](function(){return BPromise[_0x0b7a('0x74')](_0x248818,function(_0x210a62){return db[_0x0b7a('0x61')][_0x0b7a('0x75')]({'where':{'UserId':_0x210a62['id'],'ChatQueueId':_0x81bd50[_0x0b7a('0x52')]['id']},'transaction':_0x13c7e4});});})[_0x0b7a('0x1c')](function(){_0x248818['forEach'](function(_0x5ac49a){socket[_0x0b7a('0x76')](_0x0b7a('0x77'),{'UserId':_0x5ac49a['id'],'ChatQueueId':_0x1c4eaa['id']});});});});});}})['then'](respondWithStatusCode(_0x2e2102,null))[_0x0b7a('0x26')](handleError(_0x2e2102,null));};exports[_0x0b7a('0x78')]=function(_0xaebcde,_0x5d4636,_0x1418fe){return db['Team'][_0x0b7a('0x50')]({'where':{'id':_0xaebcde[_0x0b7a('0x42')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0x0b7a('0x70'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x5d4636,null))['then'](function(_0x5c7dea){var _0x4324bb=_[_0x0b7a('0x3b')](_0x5c7dea,'id');var _0x4eacf1=[];var _0x4c60ec=[];var _0xd6f75=squel['select']();_0xd6f75[_0x0b7a('0x79')](_0x0b7a('0x7a'))[_0x0b7a('0x7b')](_0x0b7a('0x7c'),'tq')['join'](_0x0b7a('0x7d'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x0b7a('0x4b')](_0x0b7a('0x7e'),_0xaebcde['params']['id']);for(var _0x4ce356=0x0;_0x4ce356<_0x5c7dea[_0x0b7a('0x47')];_0x4ce356+=0x1){let _0x140b1e=_0x5c7dea[_0x4ce356];for(var _0x12f5b1=0x0;_0x12f5b1<_0x140b1e[_0x0b7a('0x70')][_0x0b7a('0x47')];_0x12f5b1+=0x1){let _0x5333a8=_0x140b1e[_0x0b7a('0x70')][_0x12f5b1];var _0x588d5e=_0xd6f75[_0x0b7a('0x7f')]();_0x588d5e['where'](_0x0b7a('0x80'),_0x5333a8['id']);_0x4c60ec[_0x0b7a('0x81')](db[_0x0b7a('0x72')]['query'](_0x588d5e[_0x0b7a('0x82')](),{'type':db[_0x0b7a('0x72')]['QueryTypes'][_0x0b7a('0x83')]})[_0x0b7a('0x1c')](function(_0x32f1fe){if(_0x32f1fe[_0x0b7a('0x47')]===0x1){return _0x5333a8['id'];}else{var _0x5a1a4f=_['every'](_[_0x0b7a('0x3b')](_0x32f1fe,_0x0b7a('0x84')),function(_0x48f8a2){return _[_0x0b7a('0x85')](_0x4324bb,_0x48f8a2);});if(_0x5a1a4f){return _0x5333a8['id'];}}}));}}return BPromise[_0x0b7a('0x86')](_0x4c60ec)[_0x0b7a('0x1c')](function(_0x2c5c46){_0x4eacf1=_(_0x4eacf1)['union'](_0x2c5c46)[_0x0b7a('0x87')]()[_0x0b7a('0x88')]();return db[_0x0b7a('0x3c')][_0x0b7a('0x5a')]({'where':{'id':_0xaebcde[_0x0b7a('0x52')]['id']}})[_0x0b7a('0x1c')](function(_0x3adf73){return db[_0x0b7a('0x72')][_0x0b7a('0x73')](function(_0x210245){return _0x3adf73[_0x0b7a('0x78')](_0xaebcde['query'][_0x0b7a('0x6f')],{'transaction':_0x210245})[_0x0b7a('0x1c')](function(){if(!_[_0x0b7a('0x89')](_0x4eacf1)){return _0x3adf73[_0x0b7a('0x8a')](_0x4eacf1,{'transaction':_0x210245});}})[_0x0b7a('0x1c')](function(){_0x4eacf1[_0x0b7a('0x8b')](function(_0x4c686f){socket[_0x0b7a('0x76')](_0x0b7a('0x8c'),{'UserId':_0x4c686f,'ChatQueueId':_0x3adf73['id']});});});});});});})[_0x0b7a('0x1c')](respondWithStatusCode(_0x5d4636,null))['catch'](handleError(_0x5d4636,null));};exports[_0x0b7a('0x8d')]=function(_0x324d42,_0x2b42e3,_0x1a3c0a){return db[_0x0b7a('0x3c')][_0x0b7a('0x5a')]({'where':{'id':_0x324d42[_0x0b7a('0x52')]['id']}})['then'](handleEntityNotFound(_0x2b42e3,null))[_0x0b7a('0x1c')](function(_0x35c5c7){if(_0x35c5c7){return _0x35c5c7[_0x0b7a('0x8d')](_0x324d42[_0x0b7a('0x5e')][_0x0b7a('0x6f')],_[_0x0b7a('0x8e')](_0x324d42[_0x0b7a('0x5e')],[_0x0b7a('0x6f'),'id'])||{})[_0x0b7a('0x8f')](function(_0x58af14){for(var _0x1c0f75=0x0;_0x1c0f75<_0x324d42['body'][_0x0b7a('0x6f')][_0x0b7a('0x47')];_0x1c0f75+=0x1){socket[_0x0b7a('0x76')](_0x0b7a('0x77'),{'UserId':_0x324d42[_0x0b7a('0x5e')]['ids'][_0x1c0f75],'ChatQueueId':_0x324d42[_0x0b7a('0x52')]['id']});}return _0x58af14;});}})[_0x0b7a('0x1c')](respondWithResult(_0x2b42e3,null))[_0x0b7a('0x26')](handleError(_0x2b42e3,null));};exports[_0x0b7a('0x8a')]=function(_0x395372,_0x149f99,_0x22de12){return db[_0x0b7a('0x3c')]['find']({'where':{'id':_0x395372['params']['id']}})[_0x0b7a('0x1c')](handleEntityNotFound(_0x149f99,null))[_0x0b7a('0x1c')](function(_0x490917){if(_0x490917){return _0x490917[_0x0b7a('0x8a')](_0x395372[_0x0b7a('0x42')]['ids'])[_0x0b7a('0x1c')](function(){if(_[_0x0b7a('0x90')](_0x395372['query'][_0x0b7a('0x6f')])){for(var _0x106163=0x0;_0x106163<_0x395372[_0x0b7a('0x42')]['ids']['length'];_0x106163+=0x1){socket[_0x0b7a('0x76')](_0x0b7a('0x8c'),{'UserId':Number(_0x395372[_0x0b7a('0x42')][_0x0b7a('0x6f')][_0x106163]),'ChatQueueId':Number(_0x395372[_0x0b7a('0x52')]['id'])});}}else{socket[_0x0b7a('0x76')]('userChatQueue:remove',{'UserId':Number(_0x395372[_0x0b7a('0x42')][_0x0b7a('0x6f')]),'ChatQueueId':Number(_0x395372[_0x0b7a('0x52')]['id'])});}});}})['then'](respondWithStatusCode(_0x149f99,null))[_0x0b7a('0x26')](handleError(_0x149f99,null));};exports[_0x0b7a('0x91')]=function(_0x90ee7a,_0x1b3a7e,_0x5319a6){var _0x133966={};var _0x210459={};var _0x35ec43;var _0x337859;return db[_0x0b7a('0x3c')][_0x0b7a('0x92')]({'where':{'id':_0x90ee7a[_0x0b7a('0x52')]['id']}})[_0x0b7a('0x1c')](handleEntityNotFound(_0x1b3a7e,null))['then'](function(_0x353fca){if(_0x353fca){_0x35ec43=_0x353fca;_0x210459[_0x0b7a('0x41')]=_[_0x0b7a('0x53')](db[_0x0b7a('0x64')][_0x0b7a('0x3d')]);_0x210459[_0x0b7a('0x42')]=_['keys'](_0x90ee7a[_0x0b7a('0x42')]);_0x210459['filters']=_[_0x0b7a('0x44')](_0x210459[_0x0b7a('0x41')],_0x210459[_0x0b7a('0x42')]);_0x133966[_0x0b7a('0x46')]=_[_0x0b7a('0x44')](_0x210459[_0x0b7a('0x41')],qs[_0x0b7a('0x45')](_0x90ee7a[_0x0b7a('0x42')][_0x0b7a('0x45')]));_0x133966[_0x0b7a('0x46')]=_0x133966['attributes']['length']?_0x133966[_0x0b7a('0x46')]:_0x210459[_0x0b7a('0x41')];_0x133966['order']=qs[_0x0b7a('0x49')](_0x90ee7a[_0x0b7a('0x42')]['sort']);_0x133966[_0x0b7a('0x4b')]=qs[_0x0b7a('0x43')](_[_0x0b7a('0x4a')](_0x90ee7a[_0x0b7a('0x42')],_0x210459[_0x0b7a('0x43')]));if(_0x90ee7a[_0x0b7a('0x42')]['filter']){_0x133966[_0x0b7a('0x4b')]=_['merge'](_0x133966['where'],{'$or':_['map'](_0x133966[_0x0b7a('0x46')],function(_0x2b8637){var _0x5058e1={};_0x5058e1[_0x2b8637]={'$like':'%'+_0x90ee7a[_0x0b7a('0x42')][_0x0b7a('0x4e')]+'%'};return _0x5058e1;})});}_0x133966=_['merge']({},_0x133966,_0x90ee7a[_0x0b7a('0x4f')]);return _0x35ec43[_0x0b7a('0x91')](_0x133966);}})[_0x0b7a('0x1c')](function(_0x9b0329){if(_0x9b0329){_0x337859=_0x9b0329[_0x0b7a('0x47')];if(!_0x90ee7a[_0x0b7a('0x42')]['hasOwnProperty'](_0x0b7a('0x63'))){_0x133966['limit']=qs[_0x0b7a('0x2d')](_0x90ee7a[_0x0b7a('0x42')][_0x0b7a('0x2d')]);_0x133966[_0x0b7a('0x2b')]=qs[_0x0b7a('0x2b')](_0x90ee7a[_0x0b7a('0x42')]['offset']);}return _0x35ec43['getAgents'](_0x133966);}})[_0x0b7a('0x1c')](function(_0x32e057){if(_0x32e057){return _0x32e057?{'count':_0x337859,'rows':_0x32e057}:null;}})[_0x0b7a('0x1c')](respondWithResult(_0x1b3a7e,null))['catch'](handleError(_0x1b3a7e,null));}; \ No newline at end of file +var _0xb306=['save','update','then','destroy','get','ChatQueues','UserProfileResource','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','ChatQueue','include','findAll','show','params','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','findOne','UserChatQueue','order','ChatQueueId','findAndCountAll','chatPause','updatedAt','rows','format','%s/%s','SIP','getTeams','Team','hasOwnProperty','ids','User','Agents','online','voicePause','interface','flatMap','each','forEach','emit','userChatQueue:save','select','field','from','team_has_chat_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','sequelize','QueryTypes','every','TeamId','includes','union','value','removeTeams','removeAgents','userChatQueue:remove','addAgents','omit','isArray','getAgents','eml-format','fast-json-patch','request-promise','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./chatQueue.socket','jayson/promise','client','http','request','info','debug','ChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','ChatQueue,\x20%s,\x20%s','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject'];(function(_0x817d9b,_0x3c37e3){var _0x2752e1=function(_0x2b434e){while(--_0x2b434e){_0x817d9b['push'](_0x817d9b['shift']());}};_0x2752e1(++_0x3c37e3);}(_0xb306,0x18c));var _0x6b30=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xb306[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0x6b30('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x6b30('0x1'));var rp=require(_0x6b30('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x6b30('0x3'));var util=require(_0x6b30('0x4'));var path=require(_0x6b30('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x6b30('0x6'));var fs=require('fs');var fs_extra=require(_0x6b30('0x7'));var _=require(_0x6b30('0x8'));var squel=require(_0x6b30('0x9'));var crypto=require(_0x6b30('0xa'));var jsforce=require(_0x6b30('0xb'));var deskjs=require(_0x6b30('0xc'));var toCsv=require(_0x6b30('0xd'));var querystring=require('querystring');var Papa=require(_0x6b30('0xe'));var Redis=require(_0x6b30('0xf'));var authService=require(_0x6b30('0x10'));var qs=require(_0x6b30('0x11'));var as=require(_0x6b30('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6b30('0x13'))(_0x6b30('0x14'));var utils=require(_0x6b30('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x6b30('0x16'));var db=require(_0x6b30('0x17'))['db'];config[_0x6b30('0x18')]=_[_0x6b30('0x19')](config[_0x6b30('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x6b30('0x1a'))(new Redis(config[_0x6b30('0x18')]));require(_0x6b30('0x1b'))['register'](socket);var jayson=require(_0x6b30('0x1c'));var client=jayson[_0x6b30('0x1d')][_0x6b30('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x107902,_0x5b8e76,_0x3d0a0c,_0x310b5b){return new BPromise(function(_0x4f51f8,_0x1c4ea2){var _0x4ab23b=_0x310b5b||client;return _0x4ab23b[_0x6b30('0x1f')](_0x107902,_0x3d0a0c)['then'](function(_0x10c696){logger[_0x6b30('0x20')]('ChatQueue,\x20%s,\x20%s',_0x5b8e76,'request\x20sent');logger[_0x6b30('0x21')](_0x6b30('0x22'),_0x5b8e76,_0x6b30('0x23'),JSON[_0x6b30('0x24')](_0x10c696));if(_0x10c696['error']){if(_0x10c696[_0x6b30('0x25')]['code']===0x1f4){logger[_0x6b30('0x25')]('ChatQueue,\x20%s,\x20%s',_0x5b8e76,_0x10c696[_0x6b30('0x25')]['message']);return _0x1c4ea2(_0x10c696[_0x6b30('0x25')][_0x6b30('0x26')]);}logger[_0x6b30('0x25')]('ChatQueue,\x20%s,\x20%s',_0x5b8e76,_0x10c696[_0x6b30('0x25')][_0x6b30('0x26')]);return _0x4f51f8(_0x10c696[_0x6b30('0x25')]['message']);}else{logger[_0x6b30('0x20')](_0x6b30('0x27'),_0x5b8e76,_0x6b30('0x23'));_0x4f51f8(_0x10c696[_0x6b30('0x28')][_0x6b30('0x26')]);}})[_0x6b30('0x29')](function(_0x2958fb){logger[_0x6b30('0x25')](_0x6b30('0x27'),_0x5b8e76,_0x2958fb);_0x1c4ea2(_0x2958fb);});});}function respondWithStatusCode(_0x49e705,_0x25653d){_0x25653d=_0x25653d||0xcc;return function(_0x5e202a){if(_0x5e202a){return _0x49e705[_0x6b30('0x2a')](_0x25653d);}return _0x49e705[_0x6b30('0x2b')](_0x25653d)[_0x6b30('0x2c')]();};}function respondWithResult(_0x3a76bb,_0x38a7f5){_0x38a7f5=_0x38a7f5||0xc8;return function(_0x408dd2){if(_0x408dd2){return _0x3a76bb[_0x6b30('0x2b')](_0x38a7f5)[_0x6b30('0x2d')](_0x408dd2);}};}function respondWithFilteredResult(_0x640810,_0x1e82f9){return function(_0x18ce08){if(_0x18ce08){var _0x480b95=typeof _0x1e82f9[_0x6b30('0x2e')]===_0x6b30('0x2f')&&typeof _0x1e82f9[_0x6b30('0x30')]==='undefined';var _0x2f123b=_0x18ce08[_0x6b30('0x31')];var _0x1d6dad=_0x480b95?0x0:_0x1e82f9[_0x6b30('0x2e')];var _0x161c7=_0x480b95?_0x18ce08['count']:_0x1e82f9[_0x6b30('0x2e')]+_0x1e82f9[_0x6b30('0x30')];var _0x39f443;if(_0x161c7>=_0x2f123b){_0x161c7=_0x2f123b;_0x39f443=0xc8;}else{_0x39f443=0xce;}_0x640810[_0x6b30('0x2b')](_0x39f443);return _0x640810[_0x6b30('0x32')](_0x6b30('0x33'),_0x1d6dad+'-'+_0x161c7+'/'+_0x2f123b)[_0x6b30('0x2d')](_0x18ce08);}return null;};}function patchUpdates(_0x12891d){return function(_0x22ebad){try{jsonpatch[_0x6b30('0x34')](_0x22ebad,_0x12891d,!![]);}catch(_0x25b6e5){return BPromise[_0x6b30('0x35')](_0x25b6e5);}return _0x22ebad[_0x6b30('0x36')]();};}function saveUpdates(_0x15e698,_0x33034a){return function(_0x169571){if(_0x169571){return _0x169571[_0x6b30('0x37')](_0x15e698)[_0x6b30('0x38')](function(_0x47ec8c){return _0x47ec8c;});}return null;};}function removeEntity(_0x2501ce,_0x3ad2d1){return function(_0x42e1e9){if(_0x42e1e9){return _0x42e1e9[_0x6b30('0x39')]()[_0x6b30('0x38')](function(){var _0x3f334b=_0x42e1e9[_0x6b30('0x3a')]({'plain':!![]});var _0x41b0a5=_0x6b30('0x3b');return db[_0x6b30('0x3c')][_0x6b30('0x39')]({'where':{'type':_0x41b0a5,'resourceId':_0x3f334b['id']}})['then'](function(){return _0x42e1e9;});})[_0x6b30('0x38')](function(){_0x2501ce[_0x6b30('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x58021c,_0x1b2999){return function(_0xf9af30){if(!_0xf9af30){_0x58021c[_0x6b30('0x2a')](0x194);}return _0xf9af30;};}function handleError(_0x186f9c,_0x1c5c37){_0x1c5c37=_0x1c5c37||0x1f4;return function(_0x44a978){logger[_0x6b30('0x25')](_0x44a978[_0x6b30('0x3d')]);if(_0x44a978[_0x6b30('0x3e')]){delete _0x44a978[_0x6b30('0x3e')];}_0x186f9c['status'](_0x1c5c37)[_0x6b30('0x3f')](_0x44a978);};}exports[_0x6b30('0x40')]=function(_0xddada6,_0x514e4d){var _0x95b25f={},_0x3c3602={},_0x28b170={'count':0x0,'rows':[]};var _0x425614=_['map'](db['ChatQueue'][_0x6b30('0x41')],function(_0x35ed6a){return{'name':_0x35ed6a[_0x6b30('0x42')],'type':_0x35ed6a[_0x6b30('0x43')][_0x6b30('0x44')]};});_0x3c3602[_0x6b30('0x45')]=_[_0x6b30('0x46')](_0x425614,_0x6b30('0x3e'));_0x3c3602[_0x6b30('0x47')]=_[_0x6b30('0x48')](_0xddada6[_0x6b30('0x47')]);_0x3c3602[_0x6b30('0x49')]=_[_0x6b30('0x4a')](_0x3c3602['model'],_0x3c3602[_0x6b30('0x47')]);_0x95b25f[_0x6b30('0x4b')]=_['intersection'](_0x3c3602[_0x6b30('0x45')],qs[_0x6b30('0x4c')](_0xddada6[_0x6b30('0x47')][_0x6b30('0x4c')]));_0x95b25f['attributes']=_0x95b25f[_0x6b30('0x4b')][_0x6b30('0x4d')]?_0x95b25f[_0x6b30('0x4b')]:_0x3c3602['model'];if(!_0xddada6[_0x6b30('0x47')]['hasOwnProperty'](_0x6b30('0x4e'))){_0x95b25f['limit']=qs[_0x6b30('0x30')](_0xddada6[_0x6b30('0x47')][_0x6b30('0x30')]);_0x95b25f[_0x6b30('0x2e')]=qs['offset'](_0xddada6[_0x6b30('0x47')]['offset']);}_0x95b25f['order']=qs[_0x6b30('0x4f')](_0xddada6[_0x6b30('0x47')]['sort']);_0x95b25f[_0x6b30('0x50')]=qs['filters'](_[_0x6b30('0x51')](_0xddada6['query'],_0x3c3602[_0x6b30('0x49')]),_0x425614);if(_0xddada6[_0x6b30('0x47')]['filter']){_0x95b25f['where']=_[_0x6b30('0x52')](_0x95b25f[_0x6b30('0x50')],{'$or':_[_0x6b30('0x46')](_0x425614,function(_0x1a472b){if(_0x1a472b[_0x6b30('0x43')]!==_0x6b30('0x53')){var _0x1725db={};_0x1725db[_0x1a472b[_0x6b30('0x3e')]]={'$like':'%'+_0xddada6[_0x6b30('0x47')][_0x6b30('0x54')]+'%'};return _0x1725db;}})});}_0x95b25f=_['merge']({},_0x95b25f,_0xddada6[_0x6b30('0x55')]);var _0x3873b1={'where':_0x95b25f[_0x6b30('0x50')]};return db[_0x6b30('0x56')][_0x6b30('0x31')](_0x3873b1)[_0x6b30('0x38')](function(_0x383f7f){_0x28b170[_0x6b30('0x31')]=_0x383f7f;if(_0xddada6[_0x6b30('0x47')]['includeAll']){_0x95b25f[_0x6b30('0x57')]=[{'all':!![]}];}return db[_0x6b30('0x56')][_0x6b30('0x58')](_0x95b25f);})['then'](function(_0xab3b54){_0x28b170['rows']=_0xab3b54;return _0x28b170;})[_0x6b30('0x38')](respondWithFilteredResult(_0x514e4d,_0x95b25f))['catch'](handleError(_0x514e4d,null));};exports[_0x6b30('0x59')]=function(_0x45d7b4,_0x20148a){var _0x288f18={'raw':!![],'where':{'id':_0x45d7b4[_0x6b30('0x5a')]['id']}},_0x39ddfb={};_0x39ddfb['model']=_[_0x6b30('0x48')](db[_0x6b30('0x56')][_0x6b30('0x41')]);_0x39ddfb[_0x6b30('0x47')]=_[_0x6b30('0x48')](_0x45d7b4['query']);_0x39ddfb[_0x6b30('0x49')]=_[_0x6b30('0x4a')](_0x39ddfb[_0x6b30('0x45')],_0x39ddfb['query']);_0x288f18[_0x6b30('0x4b')]=_[_0x6b30('0x4a')](_0x39ddfb[_0x6b30('0x45')],qs['fields'](_0x45d7b4[_0x6b30('0x47')]['fields']));_0x288f18[_0x6b30('0x4b')]=_0x288f18['attributes'][_0x6b30('0x4d')]?_0x288f18[_0x6b30('0x4b')]:_0x39ddfb[_0x6b30('0x45')];if(_0x45d7b4[_0x6b30('0x47')][_0x6b30('0x5b')]){_0x288f18[_0x6b30('0x57')]=[{'all':!![]}];}_0x288f18=_[_0x6b30('0x52')]({},_0x288f18,_0x45d7b4[_0x6b30('0x55')]);return db[_0x6b30('0x56')][_0x6b30('0x5c')](_0x288f18)[_0x6b30('0x38')](handleEntityNotFound(_0x20148a,null))[_0x6b30('0x38')](respondWithResult(_0x20148a,null))[_0x6b30('0x29')](handleError(_0x20148a,null));};exports[_0x6b30('0x5d')]=function(_0x372d7f,_0x55e37d){return db[_0x6b30('0x56')][_0x6b30('0x5d')](_0x372d7f[_0x6b30('0x5e')],{})['then'](function(_0x183569){var _0x25f009=_0x372d7f[_0x6b30('0x5f')][_0x6b30('0x3a')]({'plain':!![]});if(!_0x25f009)throw new Error(_0x6b30('0x60'));if(_0x25f009[_0x6b30('0x61')]===_0x6b30('0x5f')){var _0x28bc87=_0x183569[_0x6b30('0x3a')]({'plain':!![]});var _0x1439dd=_0x6b30('0x3b');return db['UserProfileSection'][_0x6b30('0x5c')]({'where':{'name':_0x1439dd,'userProfileId':_0x25f009[_0x6b30('0x62')]},'raw':!![]})['then'](function(_0x5c1680){if(_0x5c1680&&_0x5c1680['autoAssociation']===0x0){return db[_0x6b30('0x3c')][_0x6b30('0x5d')]({'name':_0x28bc87[_0x6b30('0x3e')],'resourceId':_0x28bc87['id'],'type':_0x5c1680[_0x6b30('0x3e')],'sectionId':_0x5c1680['id']},{})[_0x6b30('0x38')](function(){return _0x183569;});}else{return _0x183569;}})['catch'](function(_0x2162e1){logger['error'](_0x6b30('0x63'),_0x2162e1);throw _0x2162e1;});}return _0x183569;})[_0x6b30('0x38')](respondWithResult(_0x55e37d,0xc9))[_0x6b30('0x29')](handleError(_0x55e37d,null));};exports[_0x6b30('0x37')]=function(_0x377814,_0xf0fdb2){if(_0x377814[_0x6b30('0x5e')]['id']){delete _0x377814[_0x6b30('0x5e')]['id'];}return db[_0x6b30('0x56')]['find']({'where':{'id':_0x377814[_0x6b30('0x5a')]['id']}})[_0x6b30('0x38')](handleEntityNotFound(_0xf0fdb2,null))['then'](saveUpdates(_0x377814[_0x6b30('0x5e')],null))['then'](respondWithResult(_0xf0fdb2,null))[_0x6b30('0x29')](handleError(_0xf0fdb2,null));};exports[_0x6b30('0x39')]=function(_0x38f804,_0x4b9095){return db['ChatQueue'][_0x6b30('0x5c')]({'where':{'id':_0x38f804[_0x6b30('0x5a')]['id']}})[_0x6b30('0x38')](handleEntityNotFound(_0x4b9095,null))['then'](removeEntity(_0x4b9095,null))[_0x6b30('0x29')](handleError(_0x4b9095,null));};exports[_0x6b30('0x64')]=function(_0x3f7320,_0xec8923){return db[_0x6b30('0x56')][_0x6b30('0x64')]()[_0x6b30('0x38')](respondWithResult(_0xec8923,null))['catch'](handleError(_0xec8923,null));};exports['getMembers']=function(_0x3b2b92,_0x48c505,_0x34c854){var _0x346b1e={'raw':!![],'where':{}},_0x325f3e={},_0x943537;return db['ChatQueue'][_0x6b30('0x65')]({'where':{'id':_0x3b2b92[_0x6b30('0x5a')]['id']}})[_0x6b30('0x38')](handleEntityNotFound(_0x48c505,null))['then'](function(_0x37e2d1){if(_0x37e2d1){_0x943537=_0x37e2d1[_0x6b30('0x3a')]({'plain':!![]});_0x325f3e[_0x6b30('0x45')]=_[_0x6b30('0x48')](db[_0x6b30('0x66')]['rawAttributes']);_0x325f3e[_0x6b30('0x47')]=_[_0x6b30('0x48')](_0x3b2b92[_0x6b30('0x47')]);_0x325f3e[_0x6b30('0x49')]=_[_0x6b30('0x4a')](_0x325f3e[_0x6b30('0x45')],_0x325f3e['query']);_0x346b1e['attributes']=_['intersection'](_0x325f3e[_0x6b30('0x45')],qs[_0x6b30('0x4c')](_0x3b2b92[_0x6b30('0x47')]['fields']));_0x346b1e[_0x6b30('0x4b')]=_0x346b1e['attributes']['length']?_0x346b1e[_0x6b30('0x4b')]:_0x325f3e[_0x6b30('0x45')];if(!_0x3b2b92[_0x6b30('0x47')]['hasOwnProperty'](_0x6b30('0x4e'))){_0x346b1e[_0x6b30('0x30')]=qs[_0x6b30('0x30')](_0x3b2b92[_0x6b30('0x47')]['limit']);_0x346b1e[_0x6b30('0x2e')]=qs[_0x6b30('0x2e')](_0x3b2b92['query'][_0x6b30('0x2e')]);}_0x346b1e[_0x6b30('0x67')]=qs[_0x6b30('0x4f')](_0x3b2b92['query']['sort']);_0x346b1e[_0x6b30('0x50')]=qs['filters'](_['pick'](_0x3b2b92[_0x6b30('0x47')],_0x325f3e[_0x6b30('0x49')]));_0x346b1e[_0x6b30('0x50')][_0x6b30('0x68')]=_0x37e2d1['id'];if(_0x3b2b92[_0x6b30('0x47')][_0x6b30('0x54')]){_0x346b1e['where']=_[_0x6b30('0x52')](_0x346b1e[_0x6b30('0x50')],{'$or':_[_0x6b30('0x46')](_0x346b1e['attributes'],function(_0x2b21a4){var _0x2e46eb={};_0x2e46eb[_0x2b21a4]={'$like':'%'+_0x3b2b92[_0x6b30('0x47')][_0x6b30('0x54')]+'%'};return _0x2e46eb;})});}_0x346b1e=_['merge']({},_0x346b1e,_0x3b2b92[_0x6b30('0x55')]);return db[_0x6b30('0x66')]['findAll'](_0x346b1e);}})[_0x6b30('0x38')](function(_0x1fe0bb){if(_0x1fe0bb){return db['User'][_0x6b30('0x69')]({'where':{'id':_[_0x6b30('0x46')](_0x1fe0bb,'UserId'),'role':'agent'},'attributes':['id','name',_0x6b30('0x6a'),_0x6b30('0x6b'),'createdAt']});}})['then'](function(_0x2bdd99){if(_0x2bdd99){return{'count':_0x2bdd99[_0x6b30('0x31')],'rows':_[_0x6b30('0x46')](_0x2bdd99[_0x6b30('0x6c')],function(_0x10c54a){return{'membername':_0x10c54a[_0x6b30('0x3e')],'UserId':_0x10c54a['id'],'queue_name':_0x943537['name'],'ChatQueueId':_0x943537['id'],'interface':util[_0x6b30('0x6d')](_0x6b30('0x6e'),_0x6b30('0x6f'),_0x10c54a[_0x6b30('0x3e')]),'penalty':0x0,'paused':_0x10c54a[_0x6b30('0x6a')],'createdAt':_0x10c54a['createdAt'],'updatedAt':_0x10c54a[_0x6b30('0x6b')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x6b30('0x38')](respondWithFilteredResult(_0x48c505,_0x346b1e))['catch'](handleError(_0x48c505,null));};exports[_0x6b30('0x70')]=function(_0x47787d,_0x361953,_0x8da39b){var _0x10cf1e={};var _0x19ead0={};var _0x5df41c;var _0x1d1bdb;return db[_0x6b30('0x56')][_0x6b30('0x65')]({'where':{'id':_0x47787d['params']['id']}})['then'](handleEntityNotFound(_0x361953,null))['then'](function(_0x150370){if(_0x150370){_0x5df41c=_0x150370;_0x19ead0['model']=_[_0x6b30('0x48')](db[_0x6b30('0x71')][_0x6b30('0x41')]);_0x19ead0[_0x6b30('0x47')]=_[_0x6b30('0x48')](_0x47787d[_0x6b30('0x47')]);_0x19ead0[_0x6b30('0x49')]=_[_0x6b30('0x4a')](_0x19ead0[_0x6b30('0x45')],_0x19ead0[_0x6b30('0x47')]);_0x10cf1e[_0x6b30('0x4b')]=_[_0x6b30('0x4a')](_0x19ead0[_0x6b30('0x45')],qs[_0x6b30('0x4c')](_0x47787d[_0x6b30('0x47')][_0x6b30('0x4c')]));_0x10cf1e[_0x6b30('0x4b')]=_0x10cf1e[_0x6b30('0x4b')][_0x6b30('0x4d')]?_0x10cf1e[_0x6b30('0x4b')]:_0x19ead0[_0x6b30('0x45')];_0x10cf1e[_0x6b30('0x67')]=qs[_0x6b30('0x4f')](_0x47787d[_0x6b30('0x47')][_0x6b30('0x4f')]);_0x10cf1e[_0x6b30('0x50')]=qs['filters'](_[_0x6b30('0x51')](_0x47787d[_0x6b30('0x47')],_0x19ead0[_0x6b30('0x49')]));if(_0x47787d[_0x6b30('0x47')]['filter']){_0x10cf1e[_0x6b30('0x50')]=_[_0x6b30('0x52')](_0x10cf1e[_0x6b30('0x50')],{'$or':_[_0x6b30('0x46')](_0x10cf1e[_0x6b30('0x4b')],function(_0x48538a){var _0x37af2a={};_0x37af2a[_0x48538a]={'$like':'%'+_0x47787d[_0x6b30('0x47')][_0x6b30('0x54')]+'%'};return _0x37af2a;})});}_0x10cf1e=_['merge']({},_0x10cf1e,_0x47787d[_0x6b30('0x55')]);return _0x5df41c[_0x6b30('0x70')](_0x10cf1e);}})['then'](function(_0x570740){if(_0x570740){_0x1d1bdb=_0x570740[_0x6b30('0x4d')];if(!_0x47787d[_0x6b30('0x47')][_0x6b30('0x72')](_0x6b30('0x4e'))){_0x10cf1e[_0x6b30('0x30')]=qs[_0x6b30('0x30')](_0x47787d['query'][_0x6b30('0x30')]);_0x10cf1e[_0x6b30('0x2e')]=qs['offset'](_0x47787d['query'][_0x6b30('0x2e')]);}return _0x5df41c[_0x6b30('0x70')](_0x10cf1e);}})[_0x6b30('0x38')](function(_0x35a1ad){if(_0x35a1ad){return _0x35a1ad?{'count':_0x1d1bdb,'rows':_0x35a1ad}:null;}})[_0x6b30('0x38')](respondWithResult(_0x361953,null))['catch'](handleError(_0x361953,null));};exports['addTeams']=function(_0x3672e2,_0x418c54,_0x21c43a){var _0x21cfea=_0x3672e2[_0x6b30('0x5e')][_0x6b30('0x73')];return db['Team'][_0x6b30('0x58')]({'where':{'id':_0x21cfea},'attributes':['id'],'include':[{'model':db[_0x6b30('0x74')],'as':_0x6b30('0x75'),'attributes':['id',_0x6b30('0x3e'),_0x6b30('0x76'),_0x6b30('0x77'),_0x6b30('0x78')],'raw':!![]}]})['then'](function(_0x3de6e9){if(_0x3de6e9){var _0x9cf933=_[_0x6b30('0x79')](_0x3de6e9,function(_0x2c712b){var _0x498d1f=_0x2c712b[_0x6b30('0x3a')]({'plain':!![]});return _0x498d1f[_0x6b30('0x75')];});return db[_0x6b30('0x56')][_0x6b30('0x5c')]({'where':{'id':_0x3672e2[_0x6b30('0x5a')]['id']}})['then'](function(_0xa74993){return db['sequelize']['transaction'](function(_0x12b24d){return _0xa74993['addTeams'](_0x21cfea,{'transaction':_0x12b24d})[_0x6b30('0x38')](function(){return BPromise[_0x6b30('0x7a')](_0x9cf933,function(_0x73f133){return db['UserChatQueue']['findOrCreate']({'where':{'UserId':_0x73f133['id'],'ChatQueueId':_0x3672e2[_0x6b30('0x5a')]['id']},'transaction':_0x12b24d});});})['then'](function(){_0x9cf933[_0x6b30('0x7b')](function(_0x254a07){socket[_0x6b30('0x7c')](_0x6b30('0x7d'),{'UserId':_0x254a07['id'],'ChatQueueId':_0xa74993['id']});});});});});}})[_0x6b30('0x38')](respondWithStatusCode(_0x418c54,null))['catch'](handleError(_0x418c54,null));};exports['removeTeams']=function(_0xba39fd,_0x4cac6b,_0x1fcb39){return db[_0x6b30('0x71')][_0x6b30('0x58')]({'where':{'id':_0xba39fd[_0x6b30('0x47')]['ids']},'attributes':['id'],'include':[{'model':db[_0x6b30('0x74')],'as':_0x6b30('0x75'),'attributes':['id'],'raw':!![]}]})[_0x6b30('0x38')](handleEntityNotFound(_0x4cac6b,null))[_0x6b30('0x38')](function(_0x6c8ac9){var _0x45598f=_[_0x6b30('0x46')](_0x6c8ac9,'id');var _0x26573e=[];var _0x154388=[];var _0x49e52b=squel[_0x6b30('0x7e')]();_0x49e52b[_0x6b30('0x7f')]('tq.TeamId')[_0x6b30('0x80')](_0x6b30('0x81'),'tq')[_0x6b30('0x82')](_0x6b30('0x83'),'ut',_0x6b30('0x84'))['where'](_0x6b30('0x85'),_0xba39fd[_0x6b30('0x5a')]['id']);for(var _0x1bb432=0x0;_0x1bb432<_0x6c8ac9[_0x6b30('0x4d')];_0x1bb432+=0x1){let _0x27d3a4=_0x6c8ac9[_0x1bb432];for(var _0x1469d5=0x0;_0x1469d5<_0x27d3a4[_0x6b30('0x75')][_0x6b30('0x4d')];_0x1469d5+=0x1){let _0x127576=_0x27d3a4['Agents'][_0x1469d5];var _0x5db0dd=_0x49e52b[_0x6b30('0x86')]();_0x5db0dd['where'](_0x6b30('0x87'),_0x127576['id']);_0x154388['push'](db[_0x6b30('0x88')][_0x6b30('0x47')](_0x5db0dd['toString'](),{'type':db[_0x6b30('0x88')][_0x6b30('0x89')]['SELECT']})[_0x6b30('0x38')](function(_0x325b6d){if(_0x325b6d[_0x6b30('0x4d')]===0x1){return _0x127576['id'];}else{var _0x3c4877=_[_0x6b30('0x8a')](_[_0x6b30('0x46')](_0x325b6d,_0x6b30('0x8b')),function(_0x53462c){return _[_0x6b30('0x8c')](_0x45598f,_0x53462c);});if(_0x3c4877){return _0x127576['id'];}}}));}}return BPromise['all'](_0x154388)[_0x6b30('0x38')](function(_0x4156c9){_0x26573e=_(_0x26573e)[_0x6b30('0x8d')](_0x4156c9)['compact']()[_0x6b30('0x8e')]();return db['ChatQueue'][_0x6b30('0x5c')]({'where':{'id':_0xba39fd[_0x6b30('0x5a')]['id']}})[_0x6b30('0x38')](function(_0x2f6b78){return db[_0x6b30('0x88')]['transaction'](function(_0x389ec6){return _0x2f6b78[_0x6b30('0x8f')](_0xba39fd[_0x6b30('0x47')][_0x6b30('0x73')],{'transaction':_0x389ec6})[_0x6b30('0x38')](function(){if(!_['isEmpty'](_0x26573e)){return _0x2f6b78[_0x6b30('0x90')](_0x26573e,{'transaction':_0x389ec6});}})[_0x6b30('0x38')](function(){_0x26573e[_0x6b30('0x7b')](function(_0x68c812){socket[_0x6b30('0x7c')](_0x6b30('0x91'),{'UserId':_0x68c812,'ChatQueueId':_0x2f6b78['id']});});});});});});})[_0x6b30('0x38')](respondWithStatusCode(_0x4cac6b,null))['catch'](handleError(_0x4cac6b,null));};exports[_0x6b30('0x92')]=function(_0x2e65f8,_0x1b2c4f,_0x127fff){return db[_0x6b30('0x56')][_0x6b30('0x5c')]({'where':{'id':_0x2e65f8['params']['id']}})[_0x6b30('0x38')](handleEntityNotFound(_0x1b2c4f,null))['then'](function(_0x430937){if(_0x430937){return _0x430937[_0x6b30('0x92')](_0x2e65f8['body']['ids'],_[_0x6b30('0x93')](_0x2e65f8[_0x6b30('0x5e')],[_0x6b30('0x73'),'id'])||{})['spread'](function(_0xf99c39){for(var _0x31bbe4=0x0;_0x31bbe4<_0x2e65f8[_0x6b30('0x5e')]['ids'][_0x6b30('0x4d')];_0x31bbe4+=0x1){socket['emit'](_0x6b30('0x7d'),{'UserId':_0x2e65f8[_0x6b30('0x5e')]['ids'][_0x31bbe4],'ChatQueueId':_0x2e65f8[_0x6b30('0x5a')]['id']});}return _0xf99c39;});}})[_0x6b30('0x38')](respondWithResult(_0x1b2c4f,null))['catch'](handleError(_0x1b2c4f,null));};exports[_0x6b30('0x90')]=function(_0x38b979,_0x4694c3,_0x2334b8){return db[_0x6b30('0x56')][_0x6b30('0x5c')]({'where':{'id':_0x38b979['params']['id']}})[_0x6b30('0x38')](handleEntityNotFound(_0x4694c3,null))[_0x6b30('0x38')](function(_0x57a4e1){if(_0x57a4e1){return _0x57a4e1['removeAgents'](_0x38b979[_0x6b30('0x47')][_0x6b30('0x73')])[_0x6b30('0x38')](function(){if(_[_0x6b30('0x94')](_0x38b979['query'][_0x6b30('0x73')])){for(var _0x3ccb86=0x0;_0x3ccb86<_0x38b979['query'][_0x6b30('0x73')][_0x6b30('0x4d')];_0x3ccb86+=0x1){socket[_0x6b30('0x7c')](_0x6b30('0x91'),{'UserId':Number(_0x38b979['query'][_0x6b30('0x73')][_0x3ccb86]),'ChatQueueId':Number(_0x38b979[_0x6b30('0x5a')]['id'])});}}else{socket['emit'](_0x6b30('0x91'),{'UserId':Number(_0x38b979[_0x6b30('0x47')][_0x6b30('0x73')]),'ChatQueueId':Number(_0x38b979[_0x6b30('0x5a')]['id'])});}});}})[_0x6b30('0x38')](respondWithStatusCode(_0x4694c3,null))[_0x6b30('0x29')](handleError(_0x4694c3,null));};exports['getAgents']=function(_0x3e107b,_0x37f893,_0x1bceb5){var _0x110112={};var _0x5816e6={};var _0x16d0c0;var _0x56b8b6;return db['ChatQueue'][_0x6b30('0x65')]({'where':{'id':_0x3e107b['params']['id']}})['then'](handleEntityNotFound(_0x37f893,null))[_0x6b30('0x38')](function(_0x1b743a){if(_0x1b743a){_0x16d0c0=_0x1b743a;_0x5816e6[_0x6b30('0x45')]=_[_0x6b30('0x48')](db['User'][_0x6b30('0x41')]);_0x5816e6['query']=_['keys'](_0x3e107b[_0x6b30('0x47')]);_0x5816e6[_0x6b30('0x49')]=_['intersection'](_0x5816e6[_0x6b30('0x45')],_0x5816e6[_0x6b30('0x47')]);_0x110112[_0x6b30('0x4b')]=_[_0x6b30('0x4a')](_0x5816e6[_0x6b30('0x45')],qs[_0x6b30('0x4c')](_0x3e107b[_0x6b30('0x47')]['fields']));_0x110112[_0x6b30('0x4b')]=_0x110112[_0x6b30('0x4b')][_0x6b30('0x4d')]?_0x110112[_0x6b30('0x4b')]:_0x5816e6['model'];_0x110112[_0x6b30('0x67')]=qs[_0x6b30('0x4f')](_0x3e107b[_0x6b30('0x47')][_0x6b30('0x4f')]);_0x110112[_0x6b30('0x50')]=qs['filters'](_[_0x6b30('0x51')](_0x3e107b[_0x6b30('0x47')],_0x5816e6[_0x6b30('0x49')]));if(_0x3e107b[_0x6b30('0x47')][_0x6b30('0x54')]){_0x110112[_0x6b30('0x50')]=_[_0x6b30('0x52')](_0x110112[_0x6b30('0x50')],{'$or':_[_0x6b30('0x46')](_0x110112[_0x6b30('0x4b')],function(_0x192f7a){var _0x1ea8b0={};_0x1ea8b0[_0x192f7a]={'$like':'%'+_0x3e107b[_0x6b30('0x47')][_0x6b30('0x54')]+'%'};return _0x1ea8b0;})});}_0x110112=_['merge']({},_0x110112,_0x3e107b[_0x6b30('0x55')]);return _0x16d0c0[_0x6b30('0x95')](_0x110112);}})[_0x6b30('0x38')](function(_0x581e0d){if(_0x581e0d){_0x56b8b6=_0x581e0d[_0x6b30('0x4d')];if(!_0x3e107b[_0x6b30('0x47')][_0x6b30('0x72')](_0x6b30('0x4e'))){_0x110112['limit']=qs[_0x6b30('0x30')](_0x3e107b[_0x6b30('0x47')]['limit']);_0x110112['offset']=qs[_0x6b30('0x2e')](_0x3e107b[_0x6b30('0x47')][_0x6b30('0x2e')]);}return _0x16d0c0[_0x6b30('0x95')](_0x110112);}})['then'](function(_0x17b465){if(_0x17b465){return _0x17b465?{'count':_0x56b8b6,'rows':_0x17b465}:null;}})[_0x6b30('0x38')](respondWithResult(_0x37f893,null))[_0x6b30('0x29')](handleError(_0x37f893,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index 57d0149..1bf4c7c 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 _0x7b1f=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatQueue','setMaxListeners','save'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7b1f,0xab));var _0xf7b1=function(_0x4fb122,_0x38df6a){_0x4fb122=_0x4fb122-0x0;var _0x78527=_0x7b1f[_0x4fb122];return _0x78527;};'use strict';var EventEmitter=require(_0xf7b1('0x0'));var ChatQueue=require(_0xf7b1('0x1'))['db'][_0xf7b1('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0xf7b1('0x3')](0x0);var events={'afterCreate':_0xf7b1('0x4'),'afterUpdate':_0xf7b1('0x5'),'afterDestroy':_0xf7b1('0x6')};function emitEvent(_0x527765){return function(_0x5d3aa1,_0x54dd56,_0xd864a6){ChatQueueEvents[_0xf7b1('0x7')](_0x527765+':'+_0x5d3aa1['id'],_0x5d3aa1);ChatQueueEvents[_0xf7b1('0x7')](_0x527765,_0x5d3aa1);_0xd864a6(null);};}for(var e in events){if(events[_0xf7b1('0x8')](e)){var event=events[e];ChatQueue[_0xf7b1('0x9')](e,emitEvent(event));}}module[_0xf7b1('0xa')]=ChatQueueEvents; \ No newline at end of file +var _0xdc1c=['save','update','remove','emit','hook','exports','events','../../mysqldb','ChatQueue','setMaxListeners'];(function(_0x57fb80,_0x417379){var _0x45e23d=function(_0x5c941a){while(--_0x5c941a){_0x57fb80['push'](_0x57fb80['shift']());}};_0x45e23d(++_0x417379);}(_0xdc1c,0x1f0));var _0xcdc1=function(_0x4100c0,_0x5289f2){_0x4100c0=_0x4100c0-0x0;var _0x4df2bc=_0xdc1c[_0x4100c0];return _0x4df2bc;};'use strict';var EventEmitter=require(_0xcdc1('0x0'));var ChatQueue=require(_0xcdc1('0x1'))['db'][_0xcdc1('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0xcdc1('0x3')](0x0);var events={'afterCreate':_0xcdc1('0x4'),'afterUpdate':_0xcdc1('0x5'),'afterDestroy':_0xcdc1('0x6')};function emitEvent(_0x24f016){return function(_0x4be37b,_0x1c0eba,_0x44564a){ChatQueueEvents[_0xcdc1('0x7')](_0x24f016+':'+_0x4be37b['id'],_0x4be37b);ChatQueueEvents[_0xcdc1('0x7')](_0x24f016,_0x4be37b);_0x44564a(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatQueue[_0xcdc1('0x8')](e,emitEvent(event));}}module[_0xcdc1('0x9')]=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index b9c41da..4850670 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 _0xea93=['define','chat_queues','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','exports'];(function(_0x5f5107,_0x5a7ff4){var _0x47a1c5=function(_0x27481f){while(--_0x27481f){_0x5f5107['push'](_0x5f5107['shift']());}};_0x47a1c5(++_0x5a7ff4);}(_0xea93,0x16d));var _0x3ea9=function(_0x5756c6,_0x58290a){_0x5756c6=_0x5756c6-0x0;var _0x4b5806=_0xea93[_0x5756c6];return _0x4b5806;};'use strict';var _=require(_0x3ea9('0x0'));var util=require(_0x3ea9('0x1'));var logger=require(_0x3ea9('0x2'))('api');var moment=require(_0x3ea9('0x3'));var BPromise=require(_0x3ea9('0x4'));var rp=require(_0x3ea9('0x5'));var fs=require('fs');var path=require(_0x3ea9('0x6'));var rimraf=require(_0x3ea9('0x7'));var config=require('../../config/environment');var attributes=require('./chatQueue.attributes');module[_0x3ea9('0x8')]=function(_0xc7cf01,_0x3693d2){return _0xc7cf01[_0x3ea9('0x9')]('ChatQueue',attributes,{'tableName':_0x3ea9('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4fab=['../../config/environment','./chatQueue.attributes','exports','ChatQueue','chat_queues','util','../../config/logger','api','rimraf'];(function(_0x1901f2,_0x43e45a){var _0x23843d=function(_0x216b44){while(--_0x216b44){_0x1901f2['push'](_0x1901f2['shift']());}};_0x23843d(++_0x43e45a);}(_0x4fab,0x1d9));var _0xb4fa=function(_0x301211,_0x4c6d31){_0x301211=_0x301211-0x0;var _0x46d7a3=_0x4fab[_0x301211];return _0x46d7a3;};'use strict';var _=require('lodash');var util=require(_0xb4fa('0x0'));var logger=require(_0xb4fa('0x1'))(_0xb4fa('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xb4fa('0x3'));var config=require(_0xb4fa('0x4'));var attributes=require(_0xb4fa('0x5'));module[_0xb4fa('0x6')]=function(_0x511f1e,_0x4fe43b){return _0x511f1e['define'](_0xb4fa('0x7'),attributes,{'tableName':_0xb4fa('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.rpc.js b/server/api/chatQueue/chatQueue.rpc.js index ae1024b..de2f0af 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 _0xc038=['raw','ShowChatQueue','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','./chatQueue.socket','register','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','error','message','result','catch','GetChatQueue','ChatQueue','options','where','attributes','limit','include','model','map','stringify'];(function(_0x58afd5,_0x534a48){var _0x3e503b=function(_0x27ba44){while(--_0x27ba44){_0x58afd5['push'](_0x58afd5['shift']());}};_0x3e503b(++_0x534a48);}(_0xc038,0x17e));var _0x8c03=function(_0x266b18,_0x509210){_0x266b18=_0x266b18-0x0;var _0x2c76ce=_0xc038[_0x266b18];return _0x2c76ce;};'use strict';var _=require(_0x8c03('0x0'));var util=require(_0x8c03('0x1'));var moment=require('moment');var BPromise=require(_0x8c03('0x2'));var rs=require(_0x8c03('0x3'));var fs=require('fs');var Redis=require(_0x8c03('0x4'));var db=require(_0x8c03('0x5'))['db'];var utils=require(_0x8c03('0x6'));var logger=require('../../config/logger')(_0x8c03('0x7'));var config=require(_0x8c03('0x8'));var jayson=require(_0x8c03('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0x8c03('0xa')]=_[_0x8c03('0xb')](config[_0x8c03('0xa')],{'host':_0x8c03('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8c03('0xa')]));require(_0x8c03('0xd'))[_0x8c03('0xe')](socket);function respondWithRpcPromise(_0x46c575,_0x1acd8b,_0x111c02){return new BPromise(function(_0x47f31f,_0x1693f7){return client[_0x8c03('0xf')](_0x46c575,_0x111c02)[_0x8c03('0x10')](function(_0x53931b){logger[_0x8c03('0x11')](_0x8c03('0x12'),_0x1acd8b,_0x8c03('0x13'));logger[_0x8c03('0x14')](_0x8c03('0x15'),_0x1acd8b,_0x8c03('0x13'),JSON['stringify'](_0x53931b));if(_0x53931b[_0x8c03('0x16')]){if(_0x53931b[_0x8c03('0x16')]['code']===0x1f4){logger[_0x8c03('0x16')]('ChatQueue,\x20%s,\x20%s',_0x1acd8b,_0x53931b[_0x8c03('0x16')][_0x8c03('0x17')]);return _0x1693f7(_0x53931b[_0x8c03('0x16')]['message']);}logger[_0x8c03('0x16')](_0x8c03('0x12'),_0x1acd8b,_0x53931b[_0x8c03('0x16')][_0x8c03('0x17')]);return _0x47f31f(_0x53931b[_0x8c03('0x16')][_0x8c03('0x17')]);}else{logger[_0x8c03('0x11')](_0x8c03('0x12'),_0x1acd8b,'request\x20sent');_0x47f31f(_0x53931b[_0x8c03('0x18')][_0x8c03('0x17')]);}})[_0x8c03('0x19')](function(_0x29e587){logger[_0x8c03('0x16')](_0x8c03('0x12'),_0x1acd8b,_0x29e587);_0x1693f7(_0x29e587);});});}exports[_0x8c03('0x1a')]=function(_0x2ea4cb){var _0x31a68a=this;return new Promise(function(_0x4a0ecc,_0x3e4766){return db[_0x8c03('0x1b')]['findAll']({'raw':_0x2ea4cb[_0x8c03('0x1c')]?_0x2ea4cb['options']['raw']===undefined?!![]:![]:!![],'where':_0x2ea4cb[_0x8c03('0x1c')]?_0x2ea4cb[_0x8c03('0x1c')][_0x8c03('0x1d')]||null:null,'attributes':_0x2ea4cb[_0x8c03('0x1c')]?_0x2ea4cb[_0x8c03('0x1c')][_0x8c03('0x1e')]||null:null,'limit':_0x2ea4cb[_0x8c03('0x1c')]?_0x2ea4cb[_0x8c03('0x1c')][_0x8c03('0x1f')]||null:null,'include':_0x2ea4cb['options']?_0x2ea4cb[_0x8c03('0x1c')]['include']?_['map'](_0x2ea4cb[_0x8c03('0x1c')][_0x8c03('0x20')],function(_0x21bfdd){return{'model':db[_0x21bfdd[_0x8c03('0x21')]],'as':_0x21bfdd['as'],'attributes':_0x21bfdd[_0x8c03('0x1e')],'include':_0x21bfdd[_0x8c03('0x20')]?_[_0x8c03('0x22')](_0x21bfdd['include'],function(_0x1eceeb){return{'model':db[_0x1eceeb[_0x8c03('0x21')]],'as':_0x1eceeb['as'],'attributes':_0x1eceeb[_0x8c03('0x1e')],'include':_0x1eceeb[_0x8c03('0x20')]?_[_0x8c03('0x22')](_0x1eceeb[_0x8c03('0x20')],function(_0x16283e){return{'model':db[_0x16283e[_0x8c03('0x21')]],'as':_0x16283e['as'],'attributes':_0x16283e[_0x8c03('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x8c03('0x10')](function(_0x2038c8){logger[_0x8c03('0x11')]('GetChatQueue',_0x2ea4cb);logger[_0x8c03('0x14')](_0x8c03('0x1a'),_0x2ea4cb,JSON[_0x8c03('0x23')](_0x2038c8));_0x4a0ecc(_0x2038c8);})[_0x8c03('0x19')](function(_0x7bfaf2){logger[_0x8c03('0x16')](_0x8c03('0x1a'),_0x7bfaf2[_0x8c03('0x17')],_0x2ea4cb);_0x3e4766(_0x31a68a['error'](0x1f4,_0x7bfaf2[_0x8c03('0x17')]));});});};exports['ShowChatQueue']=function(_0xc4274f){var _0x58973f=this;return new Promise(function(_0x500e12,_0x1f4bb7){return db['ChatQueue']['find']({'raw':_0xc4274f[_0x8c03('0x1c')]?_0xc4274f[_0x8c03('0x1c')][_0x8c03('0x24')]===undefined?!![]:![]:!![],'where':_0xc4274f[_0x8c03('0x1c')]?_0xc4274f[_0x8c03('0x1c')]['where']||null:null,'attributes':_0xc4274f[_0x8c03('0x1c')]?_0xc4274f['options'][_0x8c03('0x1e')]||null:null,'include':_0xc4274f[_0x8c03('0x1c')]?_0xc4274f[_0x8c03('0x1c')]['include']?_[_0x8c03('0x22')](_0xc4274f[_0x8c03('0x1c')]['include'],function(_0x57046d){return{'model':db[_0x57046d[_0x8c03('0x21')]],'as':_0x57046d['as'],'attributes':_0x57046d['attributes'],'include':_0x57046d[_0x8c03('0x20')]?_[_0x8c03('0x22')](_0x57046d[_0x8c03('0x20')],function(_0x1fc385){return{'model':db[_0x1fc385['model']],'as':_0x1fc385['as'],'attributes':_0x1fc385[_0x8c03('0x1e')],'include':_0x1fc385['include']?_[_0x8c03('0x22')](_0x1fc385['include'],function(_0x872cc8){return{'model':db[_0x872cc8['model']],'as':_0x872cc8['as'],'attributes':_0x872cc8[_0x8c03('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x8c03('0x10')](function(_0x24fef8){logger['info'](_0x8c03('0x25'),_0xc4274f);logger[_0x8c03('0x14')](_0x8c03('0x25'),_0xc4274f,JSON[_0x8c03('0x23')](_0x24fef8));_0x500e12(_0x24fef8);})[_0x8c03('0x19')](function(_0x299a52){logger[_0x8c03('0x16')](_0x8c03('0x25'),_0x299a52[_0x8c03('0x17')],_0xc4274f);_0x1f4bb7(_0x58973f[_0x8c03('0x16')](0x1f4,_0x299a52['message']));});});}; \ No newline at end of file +var _0xf29d=['include','map','model','ShowChatQueue','where','debug','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','http','defaults','redis','localhost','./chatQueue.socket','register','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetChatQueue','ChatQueue','findAll','options','raw','attributes','limit'];(function(_0x24edfc,_0xc0d024){var _0x42f13f=function(_0x25dfc4){while(--_0x25dfc4){_0x24edfc['push'](_0x24edfc['shift']());}};_0x42f13f(++_0xc0d024);}(_0xf29d,0xc4));var _0xdf29=function(_0x508a07,_0x3752cf){_0x508a07=_0x508a07-0x0;var _0x286b21=_0xf29d[_0x508a07];return _0x286b21;};'use strict';var _=require(_0xdf29('0x0'));var util=require(_0xdf29('0x1'));var moment=require('moment');var BPromise=require(_0xdf29('0x2'));var rs=require(_0xdf29('0x3'));var fs=require('fs');var Redis=require(_0xdf29('0x4'));var db=require(_0xdf29('0x5'))['db'];var utils=require(_0xdf29('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xdf29('0x7'));var client=jayson[_0xdf29('0x8')][_0xdf29('0x9')]({'port':0x232a});config['redis']=_[_0xdf29('0xa')](config[_0xdf29('0xb')],{'host':_0xdf29('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xdf29('0xb')]));require(_0xdf29('0xd'))[_0xdf29('0xe')](socket);function respondWithRpcPromise(_0x298dbb,_0x517d89,_0x5503f0){return new BPromise(function(_0x3e1865,_0x14b4ec){return client['request'](_0x298dbb,_0x5503f0)[_0xdf29('0xf')](function(_0x26b212){logger[_0xdf29('0x10')](_0xdf29('0x11'),_0x517d89,_0xdf29('0x12'));logger['debug'](_0xdf29('0x13'),_0x517d89,'request\x20sent',JSON[_0xdf29('0x14')](_0x26b212));if(_0x26b212[_0xdf29('0x15')]){if(_0x26b212[_0xdf29('0x15')]['code']===0x1f4){logger[_0xdf29('0x15')](_0xdf29('0x11'),_0x517d89,_0x26b212['error'][_0xdf29('0x16')]);return _0x14b4ec(_0x26b212[_0xdf29('0x15')][_0xdf29('0x16')]);}logger['error'](_0xdf29('0x11'),_0x517d89,_0x26b212['error']['message']);return _0x3e1865(_0x26b212[_0xdf29('0x15')][_0xdf29('0x16')]);}else{logger['info']('ChatQueue,\x20%s,\x20%s',_0x517d89,_0xdf29('0x12'));_0x3e1865(_0x26b212[_0xdf29('0x17')]['message']);}})[_0xdf29('0x18')](function(_0xf56cfa){logger[_0xdf29('0x15')](_0xdf29('0x11'),_0x517d89,_0xf56cfa);_0x14b4ec(_0xf56cfa);});});}exports[_0xdf29('0x19')]=function(_0x407f30){var _0x3cc6d7=this;return new Promise(function(_0x2f1f7d,_0x15501e){return db[_0xdf29('0x1a')][_0xdf29('0x1b')]({'raw':_0x407f30[_0xdf29('0x1c')]?_0x407f30[_0xdf29('0x1c')][_0xdf29('0x1d')]===undefined?!![]:![]:!![],'where':_0x407f30[_0xdf29('0x1c')]?_0x407f30[_0xdf29('0x1c')]['where']||null:null,'attributes':_0x407f30['options']?_0x407f30[_0xdf29('0x1c')][_0xdf29('0x1e')]||null:null,'limit':_0x407f30[_0xdf29('0x1c')]?_0x407f30[_0xdf29('0x1c')][_0xdf29('0x1f')]||null:null,'include':_0x407f30['options']?_0x407f30[_0xdf29('0x1c')][_0xdf29('0x20')]?_[_0xdf29('0x21')](_0x407f30[_0xdf29('0x1c')]['include'],function(_0x29d3a1){return{'model':db[_0x29d3a1['model']],'as':_0x29d3a1['as'],'attributes':_0x29d3a1['attributes'],'include':_0x29d3a1['include']?_['map'](_0x29d3a1['include'],function(_0x3ba001){return{'model':db[_0x3ba001['model']],'as':_0x3ba001['as'],'attributes':_0x3ba001[_0xdf29('0x1e')],'include':_0x3ba001['include']?_['map'](_0x3ba001['include'],function(_0x3f5a96){return{'model':db[_0x3f5a96[_0xdf29('0x22')]],'as':_0x3f5a96['as'],'attributes':_0x3f5a96[_0xdf29('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xdf29('0xf')](function(_0x37ca23){logger[_0xdf29('0x10')]('GetChatQueue',_0x407f30);logger['debug'](_0xdf29('0x19'),_0x407f30,JSON[_0xdf29('0x14')](_0x37ca23));_0x2f1f7d(_0x37ca23);})[_0xdf29('0x18')](function(_0x240777){logger[_0xdf29('0x15')](_0xdf29('0x19'),_0x240777[_0xdf29('0x16')],_0x407f30);_0x15501e(_0x3cc6d7[_0xdf29('0x15')](0x1f4,_0x240777[_0xdf29('0x16')]));});});};exports[_0xdf29('0x23')]=function(_0x1bb3ce){var _0x38ad0d=this;return new Promise(function(_0x15141e,_0x1a4c24){return db[_0xdf29('0x1a')]['find']({'raw':_0x1bb3ce[_0xdf29('0x1c')]?_0x1bb3ce[_0xdf29('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x1bb3ce[_0xdf29('0x1c')]?_0x1bb3ce[_0xdf29('0x1c')][_0xdf29('0x24')]||null:null,'attributes':_0x1bb3ce['options']?_0x1bb3ce[_0xdf29('0x1c')][_0xdf29('0x1e')]||null:null,'include':_0x1bb3ce[_0xdf29('0x1c')]?_0x1bb3ce[_0xdf29('0x1c')]['include']?_[_0xdf29('0x21')](_0x1bb3ce[_0xdf29('0x1c')]['include'],function(_0x36eac3){return{'model':db[_0x36eac3['model']],'as':_0x36eac3['as'],'attributes':_0x36eac3[_0xdf29('0x1e')],'include':_0x36eac3[_0xdf29('0x20')]?_[_0xdf29('0x21')](_0x36eac3[_0xdf29('0x20')],function(_0x174c9e){return{'model':db[_0x174c9e[_0xdf29('0x22')]],'as':_0x174c9e['as'],'attributes':_0x174c9e[_0xdf29('0x1e')],'include':_0x174c9e[_0xdf29('0x20')]?_[_0xdf29('0x21')](_0x174c9e['include'],function(_0x1868ef){return{'model':db[_0x1868ef[_0xdf29('0x22')]],'as':_0x1868ef['as'],'attributes':_0x1868ef[_0xdf29('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xdf29('0xf')](function(_0x1bab4f){logger[_0xdf29('0x10')](_0xdf29('0x23'),_0x1bb3ce);logger[_0xdf29('0x25')]('ShowChatQueue',_0x1bb3ce,JSON['stringify'](_0x1bab4f));_0x15141e(_0x1bab4f);})[_0xdf29('0x18')](function(_0x53e82b){logger[_0xdf29('0x15')](_0xdf29('0x23'),_0x53e82b[_0xdf29('0x16')],_0x1bb3ce);_0x1a4c24(_0x38ad0d[_0xdf29('0x15')](0x1f4,_0x53e82b[_0xdf29('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index 96a2608..bc8d007 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 _0xb903=['update','emit','removeListener','register','chatQueue:','./chatQueue.events','save','remove'];(function(_0xbf8ebe,_0x3b69a5){var _0x1e25e8=function(_0x40c390){while(--_0x40c390){_0xbf8ebe['push'](_0xbf8ebe['shift']());}};_0x1e25e8(++_0x3b69a5);}(_0xb903,0x185));var _0x3b90=function(_0x3cb896,_0x265ac1){_0x3cb896=_0x3cb896-0x0;var _0xf50a52=_0xb903[_0x3cb896];return _0xf50a52;};'use strict';var ChatQueueEvents=require(_0x3b90('0x0'));var events=[_0x3b90('0x1'),_0x3b90('0x2'),_0x3b90('0x3')];function createListener(_0x5191d8,_0x3312ca){return function(_0xf414f4){_0x3312ca[_0x3b90('0x4')](_0x5191d8,_0xf414f4);};}function removeListener(_0x1cd5d8,_0x30d8db){return function(){ChatQueueEvents[_0x3b90('0x5')](_0x1cd5d8,_0x30d8db);};}exports[_0x3b90('0x6')]=function(_0x5acd76){for(var _0x15b68f=0x0,_0x5e845a=events['length'];_0x15b68f<_0x5e845a;_0x15b68f++){var _0x153283=events[_0x15b68f];var _0x2e4c06=createListener(_0x3b90('0x7')+_0x153283,_0x5acd76);ChatQueueEvents['on'](_0x153283,_0x2e4c06);}}; \ No newline at end of file +var _0x55ca=['removeListener','register','./chatQueue.events','save'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x55ca,0x126));var _0xa55c=function(_0xbfc560,_0x311fba){_0xbfc560=_0xbfc560-0x0;var _0x47b022=_0x55ca[_0xbfc560];return _0x47b022;};'use strict';var ChatQueueEvents=require(_0xa55c('0x0'));var events=[_0xa55c('0x1'),'remove','update'];function createListener(_0x49875a,_0x1c6ec3){return function(_0x267ea0){_0x1c6ec3['emit'](_0x49875a,_0x267ea0);};}function removeListener(_0x3b478a,_0x2db02a){return function(){ChatQueueEvents[_0xa55c('0x2')](_0x3b478a,_0x2db02a);};}exports[_0xa55c('0x3')]=function(_0x3c97c8){for(var _0x279caa=0x0,_0x36b623=events['length'];_0x279caa<_0x36b623;_0x279caa++){var _0x2121fd=events[_0x279caa];var _0x2537f0=createListener('chatQueue:'+_0x2121fd,_0x3c97c8);ChatQueueEvents['on'](_0x2121fd,_0x2537f0);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index 63d8233..76f3d85 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 _0x3e74=['../../config/environment','./chatQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getMembers','/:id/teams','getTeams','getAgents','post','addTeams','addAgents','put','delete','removeTeams','/:id/users','removeAgents','exports','multer','path','connect-timeout','express','../../components/auth/service'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x3e74,0x175));var _0x43e7=function(_0x5d328b,_0x3499d3){_0x5d328b=_0x5d328b-0x0;var _0x734dd1=_0x3e74[_0x5d328b];return _0x734dd1;};'use strict';var multer=require(_0x43e7('0x0'));var util=require('util');var path=require(_0x43e7('0x1'));var timeout=require(_0x43e7('0x2'));var express=require(_0x43e7('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x43e7('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x43e7('0x5'));var controller=require(_0x43e7('0x6'));router[_0x43e7('0x7')]('/',auth[_0x43e7('0x8')](),controller[_0x43e7('0x9')]);router['get'](_0x43e7('0xa'),auth[_0x43e7('0x8')](),controller[_0x43e7('0xb')]);router[_0x43e7('0x7')](_0x43e7('0xc'),auth['isAuthenticated'](),controller[_0x43e7('0xd')]);router['get']('/:id/members',auth[_0x43e7('0x8')](),controller[_0x43e7('0xe')]);router['get'](_0x43e7('0xf'),auth['isAuthenticated'](),controller[_0x43e7('0x10')]);router[_0x43e7('0x7')]('/:id/users',auth[_0x43e7('0x8')](),controller[_0x43e7('0x11')]);router[_0x43e7('0x12')]('/',auth[_0x43e7('0x8')](),controller['create']);router['post'](_0x43e7('0xf'),auth[_0x43e7('0x8')](),controller[_0x43e7('0x13')]);router['post']('/:id/users',auth[_0x43e7('0x8')](),controller[_0x43e7('0x14')]);router[_0x43e7('0x15')](_0x43e7('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x43e7('0x16')](_0x43e7('0xc'),auth[_0x43e7('0x8')](),controller['destroy']);router['delete'](_0x43e7('0xf'),auth[_0x43e7('0x8')](),controller[_0x43e7('0x17')]);router[_0x43e7('0x16')](_0x43e7('0x18'),auth[_0x43e7('0x8')](),controller[_0x43e7('0x19')]);module[_0x43e7('0x1a')]=router; \ No newline at end of file +var _0x55ca=['post','addAgents','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatQueue.controller','get','isAuthenticated','index','describe','/:id','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','addTeams'];(function(_0x125ed3,_0x46823c){var _0x5bbdc5=function(_0x38418a){while(--_0x38418a){_0x125ed3['push'](_0x125ed3['shift']());}};_0x5bbdc5(++_0x46823c);}(_0x55ca,0x126));var _0xa55c=function(_0x27c822,_0x4850f1){_0x27c822=_0x27c822-0x0;var _0x2e60b2=_0x55ca[_0x27c822];return _0x2e60b2;};'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')]('/describe',auth[_0xa55c('0x8')](),controller[_0xa55c('0xa')]);router['get'](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller['show']);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['getAgents']);router['post']('/',auth[_0xa55c('0x8')](),controller['create']);router['post']('/:id/teams',auth[_0xa55c('0x8')](),controller[_0xa55c('0x11')]);router[_0xa55c('0x12')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x13')]);router['put'](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x14')]);router[_0xa55c('0x15')](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x16')]);router[_0xa55c('0x15')](_0xa55c('0xe'),auth['isAuthenticated'](),controller[_0xa55c('0x17')]);router[_0xa55c('0x15')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x18')]);module[_0xa55c('0x19')]=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index 3b3b506..75e93dc 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 _0xccc2=['moment','sequelize','exports','STRING','DATE'];(function(_0x5a35bf,_0x432709){var _0x17fbe0=function(_0x489198){while(--_0x489198){_0x5a35bf['push'](_0x5a35bf['shift']());}};_0x17fbe0(++_0x432709);}(_0xccc2,0xb9));var _0x2ccc=function(_0x45e335,_0x1add07){_0x45e335=_0x45e335-0x0;var _0x31497d=_0xccc2[_0x45e335];return _0x31497d;};'use strict';var moment=require(_0x2ccc('0x0'));var Sequelize=require(_0x2ccc('0x1'));module[_0x2ccc('0x2')]={'uniqueid':{'type':Sequelize[_0x2ccc('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x2ccc('0x3')]},'joinAt':{'type':Sequelize[_0x2ccc('0x4')]},'leaveAt':{'type':Sequelize[_0x2ccc('0x4')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x2ccc('0x3')]}}; \ No newline at end of file +var _0xc2b2=['DATE','moment','sequelize','exports','STRING'];(function(_0x4ac8d0,_0x2bdb49){var _0x209b3b=function(_0x5c6202){while(--_0x5c6202){_0x4ac8d0['push'](_0x4ac8d0['shift']());}};_0x209b3b(++_0x2bdb49);}(_0xc2b2,0xd3));var _0x2c2b=function(_0x394706,_0x1abab7){_0x394706=_0x394706-0x0;var _0x1b00bb=_0xc2b2[_0x394706];return _0x1b00bb;};'use strict';var moment=require(_0x2c2b('0x0'));var Sequelize=require(_0x2c2b('0x1'));module[_0x2c2b('0x2')]={'uniqueid':{'type':Sequelize[_0x2c2b('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x2c2b('0x3')]},'joinAt':{'type':Sequelize[_0x2c2b('0x4')]},'leaveAt':{'type':Sequelize[_0x2c2b('0x4')]},'acceptAt':{'type':Sequelize[_0x2c2b('0x4')]},'exitAt':{'type':Sequelize[_0x2c2b('0x4')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index 2f2962a..2b56aed 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 _0x01d9=['rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','catch','show','params','includeAll','find','create','body','describe','eml-format','rimraf','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','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save','update','then','destroy','error','name','send','index','map','ChatQueueReport'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x01d9,0x6c));var _0x901d=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x01d9[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0x901d('0x0'));var rimraf=require(_0x901d('0x1'));var zipdir=require(_0x901d('0x2'));var jsonpatch=require(_0x901d('0x3'));var rp=require('request-promise');var moment=require(_0x901d('0x4'));var BPromise=require(_0x901d('0x5'));var Mustache=require(_0x901d('0x6'));var util=require(_0x901d('0x7'));var path=require(_0x901d('0x8'));var sox=require(_0x901d('0x9'));var csv=require(_0x901d('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x901d('0xb'));var _=require(_0x901d('0xc'));var squel=require(_0x901d('0xd'));var crypto=require(_0x901d('0xe'));var jsforce=require(_0x901d('0xf'));var deskjs=require(_0x901d('0x10'));var toCsv=require(_0x901d('0xa'));var querystring=require(_0x901d('0x11'));var Papa=require(_0x901d('0x12'));var Redis=require(_0x901d('0x13'));var authService=require(_0x901d('0x14'));var qs=require(_0x901d('0x15'));var as=require(_0x901d('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x901d('0x17'))('api');var utils=require(_0x901d('0x18'));var config=require(_0x901d('0x19'));var licenseUtil=require(_0x901d('0x1a'));var db=require(_0x901d('0x1b'))['db'];function respondWithStatusCode(_0x15ebaf,_0x5d2345){_0x5d2345=_0x5d2345||0xcc;return function(_0x1d8117){if(_0x1d8117){return _0x15ebaf[_0x901d('0x1c')](_0x5d2345);}return _0x15ebaf[_0x901d('0x1d')](_0x5d2345)[_0x901d('0x1e')]();};}function respondWithResult(_0xb8869a,_0x14d99b){_0x14d99b=_0x14d99b||0xc8;return function(_0x530a2b){if(_0x530a2b){return _0xb8869a[_0x901d('0x1d')](_0x14d99b)[_0x901d('0x1f')](_0x530a2b);}};}function respondWithFilteredResult(_0x11b0cc,_0x17d451){return function(_0x1aba97){if(_0x1aba97){var _0x7dd5f4=typeof _0x17d451[_0x901d('0x20')]===_0x901d('0x21')&&typeof _0x17d451[_0x901d('0x22')]===_0x901d('0x21');var _0x28caae=_0x1aba97[_0x901d('0x23')];var _0x285353=_0x7dd5f4?0x0:_0x17d451[_0x901d('0x20')];var _0x38f42b=_0x7dd5f4?_0x1aba97[_0x901d('0x23')]:_0x17d451[_0x901d('0x20')]+_0x17d451[_0x901d('0x22')];var _0x57d518;if(_0x38f42b>=_0x28caae){_0x38f42b=_0x28caae;_0x57d518=0xc8;}else{_0x57d518=0xce;}_0x11b0cc[_0x901d('0x1d')](_0x57d518);return _0x11b0cc[_0x901d('0x24')]('Content-Range',_0x285353+'-'+_0x38f42b+'/'+_0x28caae)['json'](_0x1aba97);}return null;};}function patchUpdates(_0x496a06){return function(_0x53f8ae){try{jsonpatch[_0x901d('0x25')](_0x53f8ae,_0x496a06,!![]);}catch(_0x44ea6f){return BPromise['reject'](_0x44ea6f);}return _0x53f8ae[_0x901d('0x26')]();};}function saveUpdates(_0x3ea3f6,_0x488e24){return function(_0x20778b){if(_0x20778b){return _0x20778b[_0x901d('0x27')](_0x3ea3f6)[_0x901d('0x28')](function(_0x3f80b9){return _0x3f80b9;});}return null;};}function removeEntity(_0x1e7d36,_0x1818d3){return function(_0x46e5c6){if(_0x46e5c6){return _0x46e5c6[_0x901d('0x29')]()['then'](function(){_0x1e7d36[_0x901d('0x1d')](0xcc)[_0x901d('0x1e')]();});}};}function handleEntityNotFound(_0xbc89a5,_0x1f0ee5){return function(_0x557809){if(!_0x557809){_0xbc89a5[_0x901d('0x1c')](0x194);}return _0x557809;};}function handleError(_0x23fd43,_0x27f4ca){_0x27f4ca=_0x27f4ca||0x1f4;return function(_0x3cbe43){logger[_0x901d('0x2a')](_0x3cbe43['stack']);if(_0x3cbe43[_0x901d('0x2b')]){delete _0x3cbe43[_0x901d('0x2b')];}_0x23fd43[_0x901d('0x1d')](_0x27f4ca)[_0x901d('0x2c')](_0x3cbe43);};}exports[_0x901d('0x2d')]=function(_0x3de9b9,_0x48e86e){var _0xae6dfe={},_0x533038={},_0x128830={'count':0x0,'rows':[]};var _0x389fd9=_[_0x901d('0x2e')](db[_0x901d('0x2f')][_0x901d('0x30')],function(_0x20df02){return{'name':_0x20df02[_0x901d('0x31')],'type':_0x20df02[_0x901d('0x32')][_0x901d('0x33')]};});_0x533038[_0x901d('0x34')]=_[_0x901d('0x2e')](_0x389fd9,_0x901d('0x2b'));_0x533038[_0x901d('0x35')]=_[_0x901d('0x36')](_0x3de9b9[_0x901d('0x35')]);_0x533038['filters']=_[_0x901d('0x37')](_0x533038[_0x901d('0x34')],_0x533038[_0x901d('0x35')]);_0xae6dfe['attributes']=_[_0x901d('0x37')](_0x533038[_0x901d('0x34')],qs[_0x901d('0x38')](_0x3de9b9[_0x901d('0x35')][_0x901d('0x38')]));_0xae6dfe[_0x901d('0x39')]=_0xae6dfe[_0x901d('0x39')][_0x901d('0x3a')]?_0xae6dfe[_0x901d('0x39')]:_0x533038[_0x901d('0x34')];if(!_0x3de9b9['query']['hasOwnProperty'](_0x901d('0x3b'))){_0xae6dfe['limit']=qs[_0x901d('0x22')](_0x3de9b9[_0x901d('0x35')]['limit']);_0xae6dfe[_0x901d('0x20')]=qs[_0x901d('0x20')](_0x3de9b9[_0x901d('0x35')]['offset']);}_0xae6dfe[_0x901d('0x3c')]=qs[_0x901d('0x3d')](_0x3de9b9[_0x901d('0x35')][_0x901d('0x3d')]);_0xae6dfe[_0x901d('0x3e')]=qs[_0x901d('0x3f')](_[_0x901d('0x40')](_0x3de9b9[_0x901d('0x35')],_0x533038[_0x901d('0x3f')]),_0x389fd9);if(_0x3de9b9[_0x901d('0x35')][_0x901d('0x41')]){_0xae6dfe[_0x901d('0x3e')]=_[_0x901d('0x42')](_0xae6dfe[_0x901d('0x3e')],{'$or':_[_0x901d('0x2e')](_0x389fd9,function(_0x1644d8){if(_0x1644d8['type']!==_0x901d('0x43')){var _0x423cab={};_0x423cab[_0x1644d8['name']]={'$like':'%'+_0x3de9b9['query'][_0x901d('0x41')]+'%'};return _0x423cab;}})});}_0xae6dfe=_['merge']({},_0xae6dfe,_0x3de9b9[_0x901d('0x44')]);var _0x3d0556={'where':_0xae6dfe[_0x901d('0x3e')]};return db[_0x901d('0x2f')][_0x901d('0x23')](_0x3d0556)[_0x901d('0x28')](function(_0x5df4cb){_0x128830['count']=_0x5df4cb;if(_0x3de9b9['query']['includeAll']){_0xae6dfe[_0x901d('0x45')]=[{'all':!![]}];}return db[_0x901d('0x2f')]['findAll'](_0xae6dfe);})[_0x901d('0x28')](function(_0x22fc44){_0x128830['rows']=_0x22fc44;return _0x128830;})[_0x901d('0x28')](respondWithFilteredResult(_0x48e86e,_0xae6dfe))[_0x901d('0x46')](handleError(_0x48e86e,null));};exports[_0x901d('0x47')]=function(_0x2c1895,_0x53663d){var _0x5aeb41={'raw':!![],'where':{'id':_0x2c1895[_0x901d('0x48')]['id']}},_0xa9c008={};_0xa9c008[_0x901d('0x34')]=_[_0x901d('0x36')](db[_0x901d('0x2f')][_0x901d('0x30')]);_0xa9c008[_0x901d('0x35')]=_[_0x901d('0x36')](_0x2c1895[_0x901d('0x35')]);_0xa9c008[_0x901d('0x3f')]=_[_0x901d('0x37')](_0xa9c008['model'],_0xa9c008[_0x901d('0x35')]);_0x5aeb41['attributes']=_[_0x901d('0x37')](_0xa9c008['model'],qs[_0x901d('0x38')](_0x2c1895['query'][_0x901d('0x38')]));_0x5aeb41[_0x901d('0x39')]=_0x5aeb41[_0x901d('0x39')][_0x901d('0x3a')]?_0x5aeb41[_0x901d('0x39')]:_0xa9c008[_0x901d('0x34')];if(_0x2c1895[_0x901d('0x35')][_0x901d('0x49')]){_0x5aeb41[_0x901d('0x45')]=[{'all':!![]}];}_0x5aeb41=_[_0x901d('0x42')]({},_0x5aeb41,_0x2c1895[_0x901d('0x44')]);return db['ChatQueueReport'][_0x901d('0x4a')](_0x5aeb41)[_0x901d('0x28')](handleEntityNotFound(_0x53663d,null))[_0x901d('0x28')](respondWithResult(_0x53663d,null))[_0x901d('0x46')](handleError(_0x53663d,null));};exports[_0x901d('0x4b')]=function(_0x24b6fa,_0x27459b){return db[_0x901d('0x2f')][_0x901d('0x4b')](_0x24b6fa[_0x901d('0x4c')],{})[_0x901d('0x28')](respondWithResult(_0x27459b,0xc9))[_0x901d('0x46')](handleError(_0x27459b,null));};exports[_0x901d('0x27')]=function(_0x23f2a9,_0x4888e8){if(_0x23f2a9['body']['id']){delete _0x23f2a9[_0x901d('0x4c')]['id'];}return db[_0x901d('0x2f')][_0x901d('0x4a')]({'where':{'id':_0x23f2a9[_0x901d('0x48')]['id']}})[_0x901d('0x28')](handleEntityNotFound(_0x4888e8,null))['then'](saveUpdates(_0x23f2a9['body'],null))[_0x901d('0x28')](respondWithResult(_0x4888e8,null))[_0x901d('0x46')](handleError(_0x4888e8,null));};exports['destroy']=function(_0x23673d,_0x165207){return db['ChatQueueReport'][_0x901d('0x4a')]({'where':{'id':_0x23673d['params']['id']}})[_0x901d('0x28')](handleEntityNotFound(_0x165207,null))[_0x901d('0x28')](removeEntity(_0x165207,null))[_0x901d('0x46')](handleError(_0x165207,null));};exports[_0x901d('0x4d')]=function(_0x52aa2d,_0x3a3ea6){return db[_0x901d('0x2f')][_0x901d('0x4d')]()[_0x901d('0x28')](respondWithResult(_0x3a3ea6,null))[_0x901d('0x46')](handleError(_0x3a3ea6,null));}; \ No newline at end of file +var _0xcf71=['intersection','attributes','model','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','count','includeAll','include','findAll','rows','catch','show','length','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','name','send','index','map','ChatQueueReport','rawAttributes','fieldName','type','query','keys'];(function(_0x452936,_0x58263d){var _0x43e274=function(_0x58d970){while(--_0x58d970){_0x452936['push'](_0x452936['shift']());}};_0x43e274(++_0x58263d);}(_0xcf71,0xba));var _0x1cf7=function(_0x57eb2d,_0x5e4918){_0x57eb2d=_0x57eb2d-0x0;var _0xd8e18=_0xcf71[_0x57eb2d];return _0xd8e18;};'use strict';var emlformat=require(_0x1cf7('0x0'));var rimraf=require(_0x1cf7('0x1'));var zipdir=require(_0x1cf7('0x2'));var jsonpatch=require(_0x1cf7('0x3'));var rp=require('request-promise');var moment=require(_0x1cf7('0x4'));var BPromise=require(_0x1cf7('0x5'));var Mustache=require(_0x1cf7('0x6'));var util=require(_0x1cf7('0x7'));var path=require(_0x1cf7('0x8'));var sox=require(_0x1cf7('0x9'));var csv=require(_0x1cf7('0xa'));var ejs=require(_0x1cf7('0xb'));var fs=require('fs');var fs_extra=require(_0x1cf7('0xc'));var _=require(_0x1cf7('0xd'));var squel=require(_0x1cf7('0xe'));var crypto=require(_0x1cf7('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x1cf7('0xa'));var querystring=require(_0x1cf7('0x10'));var Papa=require(_0x1cf7('0x11'));var Redis=require('ioredis');var authService=require(_0x1cf7('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1cf7('0x13'));var logger=require(_0x1cf7('0x14'))(_0x1cf7('0x15'));var utils=require(_0x1cf7('0x16'));var config=require(_0x1cf7('0x17'));var licenseUtil=require(_0x1cf7('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x18dc3b,_0x58c99f){_0x58c99f=_0x58c99f||0xcc;return function(_0x1ad008){if(_0x1ad008){return _0x18dc3b['sendStatus'](_0x58c99f);}return _0x18dc3b[_0x1cf7('0x19')](_0x58c99f)[_0x1cf7('0x1a')]();};}function respondWithResult(_0x5a1b77,_0x33d5b2){_0x33d5b2=_0x33d5b2||0xc8;return function(_0x328d2c){if(_0x328d2c){return _0x5a1b77[_0x1cf7('0x19')](_0x33d5b2)[_0x1cf7('0x1b')](_0x328d2c);}};}function respondWithFilteredResult(_0x1bab03,_0x43d6e){return function(_0x769ee3){if(_0x769ee3){var _0x172915=typeof _0x43d6e[_0x1cf7('0x1c')]===_0x1cf7('0x1d')&&typeof _0x43d6e[_0x1cf7('0x1e')]===_0x1cf7('0x1d');var _0x3f762b=_0x769ee3['count'];var _0x391553=_0x172915?0x0:_0x43d6e[_0x1cf7('0x1c')];var _0x13875c=_0x172915?_0x769ee3['count']:_0x43d6e[_0x1cf7('0x1c')]+_0x43d6e[_0x1cf7('0x1e')];var _0xf1a5ba;if(_0x13875c>=_0x3f762b){_0x13875c=_0x3f762b;_0xf1a5ba=0xc8;}else{_0xf1a5ba=0xce;}_0x1bab03['status'](_0xf1a5ba);return _0x1bab03[_0x1cf7('0x1f')](_0x1cf7('0x20'),_0x391553+'-'+_0x13875c+'/'+_0x3f762b)[_0x1cf7('0x1b')](_0x769ee3);}return null;};}function patchUpdates(_0x37fc26){return function(_0x2c20c4){try{jsonpatch[_0x1cf7('0x21')](_0x2c20c4,_0x37fc26,!![]);}catch(_0x3ad138){return BPromise[_0x1cf7('0x22')](_0x3ad138);}return _0x2c20c4[_0x1cf7('0x23')]();};}function saveUpdates(_0x256151,_0x4ec792){return function(_0x345997){if(_0x345997){return _0x345997[_0x1cf7('0x24')](_0x256151)[_0x1cf7('0x25')](function(_0x1f293c){return _0x1f293c;});}return null;};}function removeEntity(_0x7baff3,_0x1c9100){return function(_0x31b4e9){if(_0x31b4e9){return _0x31b4e9[_0x1cf7('0x26')]()['then'](function(){_0x7baff3['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3af3e8,_0x489d1f){return function(_0x42046b){if(!_0x42046b){_0x3af3e8[_0x1cf7('0x27')](0x194);}return _0x42046b;};}function handleError(_0x3db370,_0x1ce3ae){_0x1ce3ae=_0x1ce3ae||0x1f4;return function(_0x4dcf35){logger['error'](_0x4dcf35[_0x1cf7('0x28')]);if(_0x4dcf35[_0x1cf7('0x29')]){delete _0x4dcf35[_0x1cf7('0x29')];}_0x3db370[_0x1cf7('0x19')](_0x1ce3ae)[_0x1cf7('0x2a')](_0x4dcf35);};}exports[_0x1cf7('0x2b')]=function(_0x131e8b,_0x5e2047){var _0x125c48={},_0x5c6fee={},_0x4719fe={'count':0x0,'rows':[]};var _0x3d2f45=_[_0x1cf7('0x2c')](db[_0x1cf7('0x2d')][_0x1cf7('0x2e')],function(_0x3efa9c){return{'name':_0x3efa9c[_0x1cf7('0x2f')],'type':_0x3efa9c[_0x1cf7('0x30')]['key']};});_0x5c6fee['model']=_[_0x1cf7('0x2c')](_0x3d2f45,_0x1cf7('0x29'));_0x5c6fee[_0x1cf7('0x31')]=_[_0x1cf7('0x32')](_0x131e8b[_0x1cf7('0x31')]);_0x5c6fee['filters']=_[_0x1cf7('0x33')](_0x5c6fee['model'],_0x5c6fee[_0x1cf7('0x31')]);_0x125c48[_0x1cf7('0x34')]=_['intersection'](_0x5c6fee[_0x1cf7('0x35')],qs[_0x1cf7('0x36')](_0x131e8b[_0x1cf7('0x31')][_0x1cf7('0x36')]));_0x125c48[_0x1cf7('0x34')]=_0x125c48[_0x1cf7('0x34')]['length']?_0x125c48[_0x1cf7('0x34')]:_0x5c6fee['model'];if(!_0x131e8b['query'][_0x1cf7('0x37')](_0x1cf7('0x38'))){_0x125c48[_0x1cf7('0x1e')]=qs[_0x1cf7('0x1e')](_0x131e8b[_0x1cf7('0x31')][_0x1cf7('0x1e')]);_0x125c48['offset']=qs['offset'](_0x131e8b[_0x1cf7('0x31')][_0x1cf7('0x1c')]);}_0x125c48[_0x1cf7('0x39')]=qs[_0x1cf7('0x3a')](_0x131e8b[_0x1cf7('0x31')][_0x1cf7('0x3a')]);_0x125c48[_0x1cf7('0x3b')]=qs[_0x1cf7('0x3c')](_[_0x1cf7('0x3d')](_0x131e8b[_0x1cf7('0x31')],_0x5c6fee['filters']),_0x3d2f45);if(_0x131e8b[_0x1cf7('0x31')]['filter']){_0x125c48[_0x1cf7('0x3b')]=_[_0x1cf7('0x3e')](_0x125c48['where'],{'$or':_['map'](_0x3d2f45,function(_0x5a0a7c){if(_0x5a0a7c['type']!==_0x1cf7('0x3f')){var _0x197497={};_0x197497[_0x5a0a7c[_0x1cf7('0x29')]]={'$like':'%'+_0x131e8b[_0x1cf7('0x31')][_0x1cf7('0x40')]+'%'};return _0x197497;}})});}_0x125c48=_[_0x1cf7('0x3e')]({},_0x125c48,_0x131e8b[_0x1cf7('0x41')]);var _0x7cfd70={'where':_0x125c48['where']};return db[_0x1cf7('0x2d')][_0x1cf7('0x42')](_0x7cfd70)[_0x1cf7('0x25')](function(_0x35a4e2){_0x4719fe[_0x1cf7('0x42')]=_0x35a4e2;if(_0x131e8b[_0x1cf7('0x31')][_0x1cf7('0x43')]){_0x125c48[_0x1cf7('0x44')]=[{'all':!![]}];}return db[_0x1cf7('0x2d')][_0x1cf7('0x45')](_0x125c48);})[_0x1cf7('0x25')](function(_0x359486){_0x4719fe[_0x1cf7('0x46')]=_0x359486;return _0x4719fe;})['then'](respondWithFilteredResult(_0x5e2047,_0x125c48))[_0x1cf7('0x47')](handleError(_0x5e2047,null));};exports[_0x1cf7('0x48')]=function(_0x16bf17,_0xb9d92f){var _0x5aa0a3={'raw':!![],'where':{'id':_0x16bf17['params']['id']}},_0x3307b4={};_0x3307b4[_0x1cf7('0x35')]=_[_0x1cf7('0x32')](db[_0x1cf7('0x2d')][_0x1cf7('0x2e')]);_0x3307b4[_0x1cf7('0x31')]=_[_0x1cf7('0x32')](_0x16bf17[_0x1cf7('0x31')]);_0x3307b4[_0x1cf7('0x3c')]=_['intersection'](_0x3307b4[_0x1cf7('0x35')],_0x3307b4[_0x1cf7('0x31')]);_0x5aa0a3[_0x1cf7('0x34')]=_[_0x1cf7('0x33')](_0x3307b4[_0x1cf7('0x35')],qs[_0x1cf7('0x36')](_0x16bf17[_0x1cf7('0x31')][_0x1cf7('0x36')]));_0x5aa0a3[_0x1cf7('0x34')]=_0x5aa0a3['attributes'][_0x1cf7('0x49')]?_0x5aa0a3[_0x1cf7('0x34')]:_0x3307b4[_0x1cf7('0x35')];if(_0x16bf17['query'][_0x1cf7('0x43')]){_0x5aa0a3[_0x1cf7('0x44')]=[{'all':!![]}];}_0x5aa0a3=_[_0x1cf7('0x3e')]({},_0x5aa0a3,_0x16bf17[_0x1cf7('0x41')]);return db[_0x1cf7('0x2d')][_0x1cf7('0x4a')](_0x5aa0a3)[_0x1cf7('0x25')](handleEntityNotFound(_0xb9d92f,null))[_0x1cf7('0x25')](respondWithResult(_0xb9d92f,null))['catch'](handleError(_0xb9d92f,null));};exports[_0x1cf7('0x4b')]=function(_0x218b58,_0x3828d0){return db[_0x1cf7('0x2d')][_0x1cf7('0x4b')](_0x218b58[_0x1cf7('0x4c')],{})[_0x1cf7('0x25')](respondWithResult(_0x3828d0,0xc9))[_0x1cf7('0x47')](handleError(_0x3828d0,null));};exports[_0x1cf7('0x24')]=function(_0x4f27fc,_0xa608b6){if(_0x4f27fc[_0x1cf7('0x4c')]['id']){delete _0x4f27fc['body']['id'];}return db[_0x1cf7('0x2d')][_0x1cf7('0x4a')]({'where':{'id':_0x4f27fc[_0x1cf7('0x4d')]['id']}})[_0x1cf7('0x25')](handleEntityNotFound(_0xa608b6,null))[_0x1cf7('0x25')](saveUpdates(_0x4f27fc[_0x1cf7('0x4c')],null))[_0x1cf7('0x25')](respondWithResult(_0xa608b6,null))[_0x1cf7('0x47')](handleError(_0xa608b6,null));};exports['destroy']=function(_0x4c291c,_0x1004cf){return db[_0x1cf7('0x2d')][_0x1cf7('0x4a')]({'where':{'id':_0x4c291c[_0x1cf7('0x4d')]['id']}})[_0x1cf7('0x25')](handleEntityNotFound(_0x1004cf,null))[_0x1cf7('0x25')](removeEntity(_0x1004cf,null))[_0x1cf7('0x47')](handleError(_0x1004cf,null));};exports[_0x1cf7('0x4e')]=function(_0x3b9dc9,_0x230a77){return db[_0x1cf7('0x2d')][_0x1cf7('0x4e')]()[_0x1cf7('0x25')](respondWithResult(_0x230a77,null))[_0x1cf7('0x47')](handleError(_0x230a77,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index aa5df31..0698f5f 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 _0xb10b=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define','report_chat_queue','uniqueid','lodash'];(function(_0x2c3a47,_0x170687){var _0x1c04de=function(_0x367deb){while(--_0x367deb){_0x2c3a47['push'](_0x2c3a47['shift']());}};_0x1c04de(++_0x170687);}(_0xb10b,0x12a));var _0xbb10=function(_0x39479f,_0x822ae4){_0x39479f=_0x39479f-0x0;var _0x4a6d96=_0xb10b[_0x39479f];return _0x4a6d96;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var logger=require(_0xbb10('0x1'))(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var BPromise=require('bluebird');var rp=require(_0xbb10('0x4'));var fs=require('fs');var path=require(_0xbb10('0x5'));var rimraf=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var attributes=require(_0xbb10('0x8'));module[_0xbb10('0x9')]=function(_0x481979,_0x328583){return _0x481979[_0xbb10('0xa')]('ChatQueueReport',attributes,{'tableName':_0xbb10('0xb'),'paranoid':![],'indexes':[{'name':_0xbb10('0xc'),'fields':[_0xbb10('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb7e7=['../../config/logger','moment','request-promise','rimraf','../../config/environment','./chatQueueReport.attributes','define','ChatQueueReport','uniqueid','lodash'];(function(_0x37e0c4,_0x11bd8f){var _0x345f3d=function(_0x4fa96b){while(--_0x4fa96b){_0x37e0c4['push'](_0x37e0c4['shift']());}};_0x345f3d(++_0x11bd8f);}(_0xb7e7,0x121));var _0x7b7e=function(_0x38ced4,_0x24263f){_0x38ced4=_0x38ced4-0x0;var _0x547c07=_0xb7e7[_0x38ced4];return _0x547c07;};'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 5c2bd29..638fe31 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 _0xb2c8=['ChatQueueReport','create','body','options','raw','UpdateChatQueueReport','update','where','attributes','limit','then','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','CreateChatQueueReport'];(function(_0x455d61,_0x34e24b){var _0x5425c2=function(_0x457e1c){while(--_0x457e1c){_0x455d61['push'](_0x455d61['shift']());}};_0x5425c2(++_0x34e24b);}(_0xb2c8,0x197));var _0x8b2c=function(_0x12267d,_0x4b279e){_0x12267d=_0x12267d-0x0;var _0x2d4a64=_0xb2c8[_0x12267d];return _0x2d4a64;};'use strict';var _=require(_0x8b2c('0x0'));var util=require(_0x8b2c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x8b2c('0x2'));var fs=require('fs');var Redis=require(_0x8b2c('0x3'));var db=require(_0x8b2c('0x4'))['db'];var utils=require(_0x8b2c('0x5'));var logger=require(_0x8b2c('0x6'))('rpc');var config=require(_0x8b2c('0x7'));var jayson=require(_0x8b2c('0x8'));var client=jayson[_0x8b2c('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x319d59,_0x326788,_0xc81444){return new BPromise(function(_0x59d8a1,_0x35608c){return client[_0x8b2c('0xa')](_0x319d59,_0xc81444)['then'](function(_0x1ef19a){logger['info'](_0x8b2c('0xb'),_0x326788,_0x8b2c('0xc'));logger[_0x8b2c('0xd')]('ChatQueueReport,\x20%s,\x20%s,\x20%s',_0x326788,_0x8b2c('0xc'),JSON[_0x8b2c('0xe')](_0x1ef19a));if(_0x1ef19a[_0x8b2c('0xf')]){if(_0x1ef19a[_0x8b2c('0xf')][_0x8b2c('0x10')]===0x1f4){logger['error'](_0x8b2c('0xb'),_0x326788,_0x1ef19a[_0x8b2c('0xf')][_0x8b2c('0x11')]);return _0x35608c(_0x1ef19a[_0x8b2c('0xf')][_0x8b2c('0x11')]);}logger[_0x8b2c('0xf')](_0x8b2c('0xb'),_0x326788,_0x1ef19a['error']['message']);return _0x59d8a1(_0x1ef19a['error'][_0x8b2c('0x11')]);}else{logger[_0x8b2c('0x12')]('ChatQueueReport,\x20%s,\x20%s',_0x326788,_0x8b2c('0xc'));_0x59d8a1(_0x1ef19a[_0x8b2c('0x13')][_0x8b2c('0x11')]);}})[_0x8b2c('0x14')](function(_0x50a626){logger['error'](_0x8b2c('0xb'),_0x326788,_0x50a626);_0x35608c(_0x50a626);});});}exports[_0x8b2c('0x15')]=function(_0x3ae5bc){var _0x39dd59=this;return new Promise(function(_0x532586,_0x33a7ee){return db[_0x8b2c('0x16')][_0x8b2c('0x17')](_0x3ae5bc[_0x8b2c('0x18')],{'raw':_0x3ae5bc[_0x8b2c('0x19')]?_0x3ae5bc[_0x8b2c('0x19')][_0x8b2c('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x43b8ea){logger[_0x8b2c('0x12')]('CreateChatQueueReport',_0x3ae5bc);logger[_0x8b2c('0xd')](_0x8b2c('0x15'),_0x3ae5bc,JSON[_0x8b2c('0xe')](_0x43b8ea));_0x532586(_0x43b8ea);})['catch'](function(_0x4136ba){logger['error'](_0x8b2c('0x15'),_0x4136ba[_0x8b2c('0x11')],_0x3ae5bc);_0x33a7ee(_0x39dd59[_0x8b2c('0xf')](0x1f4,_0x4136ba[_0x8b2c('0x11')]));});});};exports[_0x8b2c('0x1b')]=function(_0x29d277){var _0x555fce=this;return new Promise(function(_0x4803a7,_0xe1cb95){return db[_0x8b2c('0x16')][_0x8b2c('0x1c')](_0x29d277[_0x8b2c('0x18')],{'raw':_0x29d277[_0x8b2c('0x19')]?_0x29d277[_0x8b2c('0x19')][_0x8b2c('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x29d277[_0x8b2c('0x19')]?_0x29d277[_0x8b2c('0x19')][_0x8b2c('0x1d')]||null:null,'attributes':_0x29d277[_0x8b2c('0x19')]?_0x29d277[_0x8b2c('0x19')][_0x8b2c('0x1e')]||null:null,'limit':_0x29d277[_0x8b2c('0x19')]?_0x29d277[_0x8b2c('0x19')][_0x8b2c('0x1f')]||null:null})[_0x8b2c('0x20')](function(_0x53cac6){logger[_0x8b2c('0x12')](_0x8b2c('0x1b'),_0x29d277);logger['debug']('UpdateChatQueueReport',_0x29d277,JSON[_0x8b2c('0xe')](_0x53cac6));_0x4803a7(_0x53cac6);})[_0x8b2c('0x14')](function(_0x29eff4){logger[_0x8b2c('0xf')](_0x8b2c('0x1b'),_0x29eff4[_0x8b2c('0x11')],_0x29d277);_0xe1cb95(_0x555fce[_0x8b2c('0xf')](0x1f4,_0x29eff4[_0x8b2c('0x11')]));});});}; \ No newline at end of file +var _0x51a1=['util','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','ChatQueueReport','create','body','options','raw','CreateChatQueueReport','update','where','limit','UpdateChatQueueReport','lodash'];(function(_0x1ef0c4,_0x4baf84){var _0x408259=function(_0x55cfa8){while(--_0x55cfa8){_0x1ef0c4['push'](_0x1ef0c4['shift']());}};_0x408259(++_0x4baf84);}(_0x51a1,0x149));var _0x151a=function(_0x3ef984,_0xca08e){_0x3ef984=_0x3ef984-0x0;var _0x38c742=_0x51a1[_0x3ef984];return _0x38c742;};'use strict';var _=require(_0x151a('0x0'));var util=require(_0x151a('0x1'));var moment=require('moment');var BPromise=require(_0x151a('0x2'));var rs=require(_0x151a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x151a('0x4'));var logger=require(_0x151a('0x5'))(_0x151a('0x6'));var config=require(_0x151a('0x7'));var jayson=require(_0x151a('0x8'));var client=jayson['client'][_0x151a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3d0d7f,_0x3fc919,_0x421325){return new BPromise(function(_0x11896f,_0x2f5d26){return client[_0x151a('0xa')](_0x3d0d7f,_0x421325)[_0x151a('0xb')](function(_0x65f7f8){logger['info'](_0x151a('0xc'),_0x3fc919,_0x151a('0xd'));logger[_0x151a('0xe')](_0x151a('0xf'),_0x3fc919,'request\x20sent',JSON[_0x151a('0x10')](_0x65f7f8));if(_0x65f7f8[_0x151a('0x11')]){if(_0x65f7f8[_0x151a('0x11')][_0x151a('0x12')]===0x1f4){logger[_0x151a('0x11')](_0x151a('0xc'),_0x3fc919,_0x65f7f8[_0x151a('0x11')]['message']);return _0x2f5d26(_0x65f7f8['error'][_0x151a('0x13')]);}logger[_0x151a('0x11')](_0x151a('0xc'),_0x3fc919,_0x65f7f8[_0x151a('0x11')][_0x151a('0x13')]);return _0x11896f(_0x65f7f8[_0x151a('0x11')]['message']);}else{logger[_0x151a('0x14')]('ChatQueueReport,\x20%s,\x20%s',_0x3fc919,_0x151a('0xd'));_0x11896f(_0x65f7f8[_0x151a('0x15')]['message']);}})[_0x151a('0x16')](function(_0x35f44a){logger[_0x151a('0x11')](_0x151a('0xc'),_0x3fc919,_0x35f44a);_0x2f5d26(_0x35f44a);});});}exports['CreateChatQueueReport']=function(_0x31bd25){var _0x50b58f=this;return new Promise(function(_0x2cfec3,_0xa7ac75){return db[_0x151a('0x17')][_0x151a('0x18')](_0x31bd25[_0x151a('0x19')],{'raw':_0x31bd25[_0x151a('0x1a')]?_0x31bd25[_0x151a('0x1a')][_0x151a('0x1b')]===undefined?!![]:![]:!![]})[_0x151a('0xb')](function(_0x4c640a){logger[_0x151a('0x14')](_0x151a('0x1c'),_0x31bd25);logger['debug']('CreateChatQueueReport',_0x31bd25,JSON[_0x151a('0x10')](_0x4c640a));_0x2cfec3(_0x4c640a);})[_0x151a('0x16')](function(_0x31108f){logger['error'](_0x151a('0x1c'),_0x31108f[_0x151a('0x13')],_0x31bd25);_0xa7ac75(_0x50b58f[_0x151a('0x11')](0x1f4,_0x31108f[_0x151a('0x13')]));});});};exports['UpdateChatQueueReport']=function(_0x26d73d){var _0x5aed1b=this;return new Promise(function(_0x353054,_0x49386d){return db[_0x151a('0x17')][_0x151a('0x1d')](_0x26d73d['body'],{'raw':_0x26d73d['options']?_0x26d73d['options'][_0x151a('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x26d73d[_0x151a('0x1a')]?_0x26d73d['options'][_0x151a('0x1e')]||null:null,'attributes':_0x26d73d[_0x151a('0x1a')]?_0x26d73d[_0x151a('0x1a')]['attributes']||null:null,'limit':_0x26d73d[_0x151a('0x1a')]?_0x26d73d[_0x151a('0x1a')][_0x151a('0x1f')]||null:null})['then'](function(_0x5e014e){logger['info'](_0x151a('0x20'),_0x26d73d);logger[_0x151a('0xe')]('UpdateChatQueueReport',_0x26d73d,JSON[_0x151a('0x10')](_0x5e014e));_0x353054(_0x5e014e);})[_0x151a('0x16')](function(_0x292f84){logger[_0x151a('0x11')](_0x151a('0x20'),_0x292f84['message'],_0x26d73d);_0x49386d(_0x5aed1b[_0x151a('0x11')](0x1f4,_0x292f84[_0x151a('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index a049aae..3a0ff0c 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 _0xab0e=['isAuthenticated','index','describe','show','create','put','delete','destroy','exports','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x431122,_0x29bf6e){var _0x51dd3f=function(_0x3dc91d){while(--_0x3dc91d){_0x431122['push'](_0x431122['shift']());}};_0x51dd3f(++_0x29bf6e);}(_0xab0e,0x15d));var _0xeab0=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0xab0e[_0x160c73];return _0xd9302;};'use strict';var multer=require(_0xeab0('0x0'));var util=require(_0xeab0('0x1'));var path=require('path');var timeout=require(_0xeab0('0x2'));var express=require('express');var router=express[_0xeab0('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xeab0('0x4'));var interaction=require(_0xeab0('0x5'));var config=require(_0xeab0('0x6'));var controller=require('./chatQueueReport.controller');router[_0xeab0('0x7')]('/',auth[_0xeab0('0x8')](),controller[_0xeab0('0x9')]);router['get']('/describe',auth[_0xeab0('0x8')](),controller[_0xeab0('0xa')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xeab0('0xb')]);router['post']('/',auth[_0xeab0('0x8')](),controller[_0xeab0('0xc')]);router[_0xeab0('0xd')]('/:id',auth[_0xeab0('0x8')](),controller['update']);router[_0xeab0('0xe')]('/:id',auth[_0xeab0('0x8')](),controller[_0xeab0('0xf')]);module[_0xeab0('0x10')]=router; \ No newline at end of file +var _0xf6e1=['create','update','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id','post'];(function(_0x2fe5fa,_0x528194){var _0x47a039=function(_0x30241a){while(--_0x30241a){_0x2fe5fa['push'](_0x2fe5fa['shift']());}};_0x47a039(++_0x528194);}(_0xf6e1,0xb7));var _0x1f6e=function(_0x411085,_0x3c89ff){_0x411085=_0x411085-0x0;var _0x100e6f=_0xf6e1[_0x411085];return _0x100e6f;};'use strict';var multer=require(_0x1f6e('0x0'));var util=require(_0x1f6e('0x1'));var path=require(_0x1f6e('0x2'));var timeout=require(_0x1f6e('0x3'));var express=require('express');var router=express[_0x1f6e('0x4')]();var fs_extra=require(_0x1f6e('0x5'));var auth=require(_0x1f6e('0x6'));var interaction=require(_0x1f6e('0x7'));var config=require('../../config/environment');var controller=require('./chatQueueReport.controller');router[_0x1f6e('0x8')]('/',auth[_0x1f6e('0x9')](),controller[_0x1f6e('0xa')]);router[_0x1f6e('0x8')](_0x1f6e('0xb'),auth[_0x1f6e('0x9')](),controller[_0x1f6e('0xc')]);router[_0x1f6e('0x8')](_0x1f6e('0xd'),auth[_0x1f6e('0x9')](),controller['show']);router[_0x1f6e('0xe')]('/',auth[_0x1f6e('0x9')](),controller[_0x1f6e('0xf')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x1f6e('0x10')]);router['delete'](_0x1f6e('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0x1f6e('0x11')]=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index cf92211..abc1ed4 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 _0x9bde=['NOW','sequelize','STRING','account','agent','queue','DATE'];(function(_0x474bc0,_0x26989c){var _0x4b24cf=function(_0x4be866){while(--_0x4be866){_0x474bc0['push'](_0x474bc0['shift']());}};_0x4b24cf(++_0x26989c);}(_0x9bde,0xe1));var _0xe9bd=function(_0x98332,_0x1a37ec){_0x98332=_0x98332-0x0;var _0x5ccd9b=_0x9bde[_0x98332];return _0x5ccd9b;};'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 _0x00bb=['moment','sequelize','exports','ENUM','agent','queue','DATE','NOW'];(function(_0x157cc0,_0x5572a3){var _0x5c871b=function(_0x1d0430){while(--_0x1d0430){_0x157cc0['push'](_0x157cc0['shift']());}};_0x5c871b(++_0x5572a3);}(_0x00bb,0x1d8));var _0xb00b=function(_0x23e7c1,_0x35110c){_0x23e7c1=_0x23e7c1-0x0;var _0x1add43=_0x00bb[_0x23e7c1];return _0x1add43;};'use strict';var moment=require(_0xb00b('0x0'));var Sequelize=require(_0xb00b('0x1'));module[_0xb00b('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xb00b('0x3')]('account',_0xb00b('0x4'),_0xb00b('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0xb00b('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xb00b('0x7')]}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index 8e6a1ec..a954982 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 _0xb70a=['rawAttributes','length','create','update','body','destroy','find','describe','eml-format','rimraf','fast-json-patch','moment','mustache','sox','to-csv','ejs','fs-extra','squel','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','status','json','undefined','count','offset','set','Content-Range','apply','then','end','sendStatus','error','stack','send','map','ChatTransferReport','fieldName','type','model','name','query','keys','filters','intersection','attributes','fields','limit','order','pick','where','merge','filter','options','includeAll','include','catch','params'];(function(_0x31511d,_0x518dd0){var _0xc7962d=function(_0x584c61){while(--_0x584c61){_0x31511d['push'](_0x31511d['shift']());}};_0xc7962d(++_0x518dd0);}(_0xb70a,0x19a));var _0xab70=function(_0x19bbde,_0x223744){_0x19bbde=_0x19bbde-0x0;var _0x1aec32=_0xb70a[_0x19bbde];return _0x1aec32;};'use strict';var emlformat=require(_0xab70('0x0'));var rimraf=require(_0xab70('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xab70('0x2'));var rp=require('request-promise');var moment=require(_0xab70('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xab70('0x4'));var util=require('util');var path=require('path');var sox=require(_0xab70('0x5'));var csv=require(_0xab70('0x6'));var ejs=require(_0xab70('0x7'));var fs=require('fs');var fs_extra=require(_0xab70('0x8'));var _=require('lodash');var squel=require(_0xab70('0x9'));var crypto=require('crypto');var jsforce=require(_0xab70('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xab70('0x6'));var querystring=require(_0xab70('0xb'));var Papa=require(_0xab70('0xc'));var Redis=require('ioredis');var authService=require(_0xab70('0xd'));var qs=require(_0xab70('0xe'));var as=require(_0xab70('0xf'));var hardwareService=require(_0xab70('0x10'));var logger=require(_0xab70('0x11'))(_0xab70('0x12'));var utils=require(_0xab70('0x13'));var config=require(_0xab70('0x14'));var licenseUtil=require(_0xab70('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3804d8,_0x452440){_0x452440=_0x452440||0xcc;return function(_0x1f8e76){if(_0x1f8e76){return _0x3804d8['sendStatus'](_0x452440);}return _0x3804d8[_0xab70('0x16')](_0x452440)['end']();};}function respondWithResult(_0x1a426d,_0x1d2ec3){_0x1d2ec3=_0x1d2ec3||0xc8;return function(_0x4be434){if(_0x4be434){return _0x1a426d[_0xab70('0x16')](_0x1d2ec3)[_0xab70('0x17')](_0x4be434);}};}function respondWithFilteredResult(_0x9e331f,_0x37a678){return function(_0x1f9cb7){if(_0x1f9cb7){var _0x5718cc=typeof _0x37a678['offset']===_0xab70('0x18')&&typeof _0x37a678['limit']===_0xab70('0x18');var _0x2a3ad7=_0x1f9cb7['count'];var _0x598c6a=_0x5718cc?0x0:_0x37a678['offset'];var _0x25df2a=_0x5718cc?_0x1f9cb7[_0xab70('0x19')]:_0x37a678[_0xab70('0x1a')]+_0x37a678['limit'];var _0x268f22;if(_0x25df2a>=_0x2a3ad7){_0x25df2a=_0x2a3ad7;_0x268f22=0xc8;}else{_0x268f22=0xce;}_0x9e331f[_0xab70('0x16')](_0x268f22);return _0x9e331f[_0xab70('0x1b')](_0xab70('0x1c'),_0x598c6a+'-'+_0x25df2a+'/'+_0x2a3ad7)[_0xab70('0x17')](_0x1f9cb7);}return null;};}function patchUpdates(_0x589987){return function(_0x3a8534){try{jsonpatch[_0xab70('0x1d')](_0x3a8534,_0x589987,!![]);}catch(_0x4d2b76){return BPromise['reject'](_0x4d2b76);}return _0x3a8534['save']();};}function saveUpdates(_0x29c2dc,_0x34f2a5){return function(_0x342067){if(_0x342067){return _0x342067['update'](_0x29c2dc)[_0xab70('0x1e')](function(_0x1ee873){return _0x1ee873;});}return null;};}function removeEntity(_0x3852e4,_0x31109a){return function(_0x60830c){if(_0x60830c){return _0x60830c['destroy']()['then'](function(){_0x3852e4[_0xab70('0x16')](0xcc)[_0xab70('0x1f')]();});}};}function handleEntityNotFound(_0x4cd87a,_0x278fb7){return function(_0x6d593b){if(!_0x6d593b){_0x4cd87a[_0xab70('0x20')](0x194);}return _0x6d593b;};}function handleError(_0x330f5d,_0x4b8c78){_0x4b8c78=_0x4b8c78||0x1f4;return function(_0x2f09c7){logger[_0xab70('0x21')](_0x2f09c7[_0xab70('0x22')]);if(_0x2f09c7['name']){delete _0x2f09c7['name'];}_0x330f5d[_0xab70('0x16')](_0x4b8c78)[_0xab70('0x23')](_0x2f09c7);};}exports['index']=function(_0x8c87cd,_0x2cd596){var _0x32ebb0={},_0x5c49c0={},_0x35251a={'count':0x0,'rows':[]};var _0x5526b9=_[_0xab70('0x24')](db[_0xab70('0x25')]['rawAttributes'],function(_0x969b2c){return{'name':_0x969b2c[_0xab70('0x26')],'type':_0x969b2c[_0xab70('0x27')]['key']};});_0x5c49c0[_0xab70('0x28')]=_[_0xab70('0x24')](_0x5526b9,_0xab70('0x29'));_0x5c49c0[_0xab70('0x2a')]=_[_0xab70('0x2b')](_0x8c87cd[_0xab70('0x2a')]);_0x5c49c0[_0xab70('0x2c')]=_[_0xab70('0x2d')](_0x5c49c0[_0xab70('0x28')],_0x5c49c0['query']);_0x32ebb0[_0xab70('0x2e')]=_[_0xab70('0x2d')](_0x5c49c0['model'],qs[_0xab70('0x2f')](_0x8c87cd[_0xab70('0x2a')][_0xab70('0x2f')]));_0x32ebb0[_0xab70('0x2e')]=_0x32ebb0[_0xab70('0x2e')]['length']?_0x32ebb0[_0xab70('0x2e')]:_0x5c49c0[_0xab70('0x28')];if(!_0x8c87cd[_0xab70('0x2a')]['hasOwnProperty']('nolimit')){_0x32ebb0[_0xab70('0x30')]=qs[_0xab70('0x30')](_0x8c87cd[_0xab70('0x2a')]['limit']);_0x32ebb0['offset']=qs[_0xab70('0x1a')](_0x8c87cd[_0xab70('0x2a')][_0xab70('0x1a')]);}_0x32ebb0[_0xab70('0x31')]=qs['sort'](_0x8c87cd[_0xab70('0x2a')]['sort']);_0x32ebb0['where']=qs[_0xab70('0x2c')](_[_0xab70('0x32')](_0x8c87cd[_0xab70('0x2a')],_0x5c49c0['filters']),_0x5526b9);if(_0x8c87cd['query']['filter']){_0x32ebb0[_0xab70('0x33')]=_[_0xab70('0x34')](_0x32ebb0[_0xab70('0x33')],{'$or':_['map'](_0x5526b9,function(_0x666ae2){if(_0x666ae2['type']!=='VIRTUAL'){var _0x3dc3ba={};_0x3dc3ba[_0x666ae2[_0xab70('0x29')]]={'$like':'%'+_0x8c87cd['query'][_0xab70('0x35')]+'%'};return _0x3dc3ba;}})});}_0x32ebb0=_['merge']({},_0x32ebb0,_0x8c87cd[_0xab70('0x36')]);var _0x5b89f6={'where':_0x32ebb0['where']};return db[_0xab70('0x25')][_0xab70('0x19')](_0x5b89f6)[_0xab70('0x1e')](function(_0x41402b){_0x35251a[_0xab70('0x19')]=_0x41402b;if(_0x8c87cd[_0xab70('0x2a')][_0xab70('0x37')]){_0x32ebb0[_0xab70('0x38')]=[{'all':!![]}];}return db['ChatTransferReport']['findAll'](_0x32ebb0);})['then'](function(_0x4fb35e){_0x35251a['rows']=_0x4fb35e;return _0x35251a;})[_0xab70('0x1e')](respondWithFilteredResult(_0x2cd596,_0x32ebb0))[_0xab70('0x39')](handleError(_0x2cd596,null));};exports['show']=function(_0x309e13,_0x2994c2){var _0x9464a5={'raw':!![],'where':{'id':_0x309e13[_0xab70('0x3a')]['id']}},_0x362182={};_0x362182[_0xab70('0x28')]=_[_0xab70('0x2b')](db[_0xab70('0x25')][_0xab70('0x3b')]);_0x362182[_0xab70('0x2a')]=_[_0xab70('0x2b')](_0x309e13[_0xab70('0x2a')]);_0x362182[_0xab70('0x2c')]=_[_0xab70('0x2d')](_0x362182['model'],_0x362182[_0xab70('0x2a')]);_0x9464a5[_0xab70('0x2e')]=_['intersection'](_0x362182[_0xab70('0x28')],qs[_0xab70('0x2f')](_0x309e13[_0xab70('0x2a')]['fields']));_0x9464a5[_0xab70('0x2e')]=_0x9464a5['attributes'][_0xab70('0x3c')]?_0x9464a5['attributes']:_0x362182[_0xab70('0x28')];if(_0x309e13[_0xab70('0x2a')][_0xab70('0x37')]){_0x9464a5['include']=[{'all':!![]}];}_0x9464a5=_[_0xab70('0x34')]({},_0x9464a5,_0x309e13[_0xab70('0x36')]);return db[_0xab70('0x25')]['find'](_0x9464a5)[_0xab70('0x1e')](handleEntityNotFound(_0x2994c2,null))['then'](respondWithResult(_0x2994c2,null))[_0xab70('0x39')](handleError(_0x2994c2,null));};exports['create']=function(_0x4dce59,_0x10dadc){return db[_0xab70('0x25')][_0xab70('0x3d')](_0x4dce59['body'],{})['then'](respondWithResult(_0x10dadc,0xc9))[_0xab70('0x39')](handleError(_0x10dadc,null));};exports[_0xab70('0x3e')]=function(_0x58ccf9,_0x21591a){if(_0x58ccf9[_0xab70('0x3f')]['id']){delete _0x58ccf9[_0xab70('0x3f')]['id'];}return db[_0xab70('0x25')]['find']({'where':{'id':_0x58ccf9[_0xab70('0x3a')]['id']}})['then'](handleEntityNotFound(_0x21591a,null))[_0xab70('0x1e')](saveUpdates(_0x58ccf9[_0xab70('0x3f')],null))[_0xab70('0x1e')](respondWithResult(_0x21591a,null))[_0xab70('0x39')](handleError(_0x21591a,null));};exports[_0xab70('0x40')]=function(_0x2e7b0c,_0x235f56){return db['ChatTransferReport'][_0xab70('0x41')]({'where':{'id':_0x2e7b0c[_0xab70('0x3a')]['id']}})[_0xab70('0x1e')](handleEntityNotFound(_0x235f56,null))['then'](removeEntity(_0x235f56,null))[_0xab70('0x39')](handleError(_0x235f56,null));};exports[_0xab70('0x42')]=function(_0x3d7d1c,_0x537e9c){return db['ChatTransferReport'][_0xab70('0x42')]()[_0xab70('0x1e')](respondWithResult(_0x537e9c,null))['catch'](handleError(_0x537e9c,null));}; \ No newline at end of file +var _0x3fb5=['find','create','body','update','describe','eml-format','rimraf','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','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','Content-Range','apply','reject','save','then','destroy','end','error','stack','name','send','index','map','ChatTransferReport','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','limit','order','sort','where','filter','merge','VIRTUAL','options','findAll','rows','catch','show','params','includeAll'];(function(_0x4810a2,_0x16be70){var _0x56ca74=function(_0x4b881e){while(--_0x4b881e){_0x4810a2['push'](_0x4810a2['shift']());}};_0x56ca74(++_0x16be70);}(_0x3fb5,0x18b));var _0x53fb=function(_0x30d9de,_0x3ca214){_0x30d9de=_0x30d9de-0x0;var _0x386419=_0x3fb5[_0x30d9de];return _0x386419;};'use strict';var emlformat=require(_0x53fb('0x0'));var rimraf=require(_0x53fb('0x1'));var zipdir=require(_0x53fb('0x2'));var jsonpatch=require(_0x53fb('0x3'));var rp=require(_0x53fb('0x4'));var moment=require(_0x53fb('0x5'));var BPromise=require(_0x53fb('0x6'));var Mustache=require(_0x53fb('0x7'));var util=require(_0x53fb('0x8'));var path=require(_0x53fb('0x9'));var sox=require('sox');var csv=require(_0x53fb('0xa'));var ejs=require(_0x53fb('0xb'));var fs=require('fs');var fs_extra=require(_0x53fb('0xc'));var _=require(_0x53fb('0xd'));var squel=require(_0x53fb('0xe'));var crypto=require('crypto');var jsforce=require(_0x53fb('0xf'));var deskjs=require(_0x53fb('0x10'));var toCsv=require(_0x53fb('0xa'));var querystring=require(_0x53fb('0x11'));var Papa=require(_0x53fb('0x12'));var Redis=require('ioredis');var authService=require(_0x53fb('0x13'));var qs=require(_0x53fb('0x14'));var as=require(_0x53fb('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x53fb('0x16'))(_0x53fb('0x17'));var utils=require('../../config/utils');var config=require(_0x53fb('0x18'));var licenseUtil=require(_0x53fb('0x19'));var db=require(_0x53fb('0x1a'))['db'];function respondWithStatusCode(_0x9caf9e,_0x40d582){_0x40d582=_0x40d582||0xcc;return function(_0x143903){if(_0x143903){return _0x9caf9e[_0x53fb('0x1b')](_0x40d582);}return _0x9caf9e['status'](_0x40d582)['end']();};}function respondWithResult(_0x9f7efa,_0x566940){_0x566940=_0x566940||0xc8;return function(_0x98854a){if(_0x98854a){return _0x9f7efa[_0x53fb('0x1c')](_0x566940)[_0x53fb('0x1d')](_0x98854a);}};}function respondWithFilteredResult(_0x59f8ed,_0x1aa93b){return function(_0x4ad97e){if(_0x4ad97e){var _0x25e093=typeof _0x1aa93b[_0x53fb('0x1e')]===_0x53fb('0x1f')&&typeof _0x1aa93b['limit']===_0x53fb('0x1f');var _0x21bed9=_0x4ad97e[_0x53fb('0x20')];var _0x41562f=_0x25e093?0x0:_0x1aa93b[_0x53fb('0x1e')];var _0x7078b=_0x25e093?_0x4ad97e[_0x53fb('0x20')]:_0x1aa93b['offset']+_0x1aa93b['limit'];var _0x3e8bcf;if(_0x7078b>=_0x21bed9){_0x7078b=_0x21bed9;_0x3e8bcf=0xc8;}else{_0x3e8bcf=0xce;}_0x59f8ed[_0x53fb('0x1c')](_0x3e8bcf);return _0x59f8ed['set'](_0x53fb('0x21'),_0x41562f+'-'+_0x7078b+'/'+_0x21bed9)[_0x53fb('0x1d')](_0x4ad97e);}return null;};}function patchUpdates(_0x537286){return function(_0x472ebd){try{jsonpatch[_0x53fb('0x22')](_0x472ebd,_0x537286,!![]);}catch(_0x2faa22){return BPromise[_0x53fb('0x23')](_0x2faa22);}return _0x472ebd[_0x53fb('0x24')]();};}function saveUpdates(_0x42e2b1,_0x5beee1){return function(_0x4f0bf9){if(_0x4f0bf9){return _0x4f0bf9['update'](_0x42e2b1)[_0x53fb('0x25')](function(_0x5b2a0e){return _0x5b2a0e;});}return null;};}function removeEntity(_0x55add8,_0x34d1fb){return function(_0x23cb34){if(_0x23cb34){return _0x23cb34[_0x53fb('0x26')]()[_0x53fb('0x25')](function(){_0x55add8[_0x53fb('0x1c')](0xcc)[_0x53fb('0x27')]();});}};}function handleEntityNotFound(_0x16943b,_0x1dbe00){return function(_0x2f3365){if(!_0x2f3365){_0x16943b[_0x53fb('0x1b')](0x194);}return _0x2f3365;};}function handleError(_0x58fde3,_0x28902d){_0x28902d=_0x28902d||0x1f4;return function(_0xd280f9){logger[_0x53fb('0x28')](_0xd280f9[_0x53fb('0x29')]);if(_0xd280f9[_0x53fb('0x2a')]){delete _0xd280f9[_0x53fb('0x2a')];}_0x58fde3[_0x53fb('0x1c')](_0x28902d)[_0x53fb('0x2b')](_0xd280f9);};}exports[_0x53fb('0x2c')]=function(_0x5232b4,_0x567524){var _0x378043={},_0x34a64f={},_0x38d59c={'count':0x0,'rows':[]};var _0x239877=_[_0x53fb('0x2d')](db[_0x53fb('0x2e')][_0x53fb('0x2f')],function(_0x169fd9){return{'name':_0x169fd9['fieldName'],'type':_0x169fd9[_0x53fb('0x30')][_0x53fb('0x31')]};});_0x34a64f[_0x53fb('0x32')]=_[_0x53fb('0x2d')](_0x239877,_0x53fb('0x2a'));_0x34a64f[_0x53fb('0x33')]=_[_0x53fb('0x34')](_0x5232b4[_0x53fb('0x33')]);_0x34a64f[_0x53fb('0x35')]=_[_0x53fb('0x36')](_0x34a64f[_0x53fb('0x32')],_0x34a64f[_0x53fb('0x33')]);_0x378043['attributes']=_['intersection'](_0x34a64f[_0x53fb('0x32')],qs[_0x53fb('0x37')](_0x5232b4[_0x53fb('0x33')][_0x53fb('0x37')]));_0x378043['attributes']=_0x378043[_0x53fb('0x38')][_0x53fb('0x39')]?_0x378043['attributes']:_0x34a64f[_0x53fb('0x32')];if(!_0x5232b4[_0x53fb('0x33')]['hasOwnProperty'](_0x53fb('0x3a'))){_0x378043[_0x53fb('0x3b')]=qs[_0x53fb('0x3b')](_0x5232b4[_0x53fb('0x33')][_0x53fb('0x3b')]);_0x378043[_0x53fb('0x1e')]=qs[_0x53fb('0x1e')](_0x5232b4[_0x53fb('0x33')][_0x53fb('0x1e')]);}_0x378043[_0x53fb('0x3c')]=qs[_0x53fb('0x3d')](_0x5232b4['query'][_0x53fb('0x3d')]);_0x378043[_0x53fb('0x3e')]=qs[_0x53fb('0x35')](_['pick'](_0x5232b4[_0x53fb('0x33')],_0x34a64f[_0x53fb('0x35')]),_0x239877);if(_0x5232b4[_0x53fb('0x33')][_0x53fb('0x3f')]){_0x378043[_0x53fb('0x3e')]=_[_0x53fb('0x40')](_0x378043[_0x53fb('0x3e')],{'$or':_['map'](_0x239877,function(_0x1ebe48){if(_0x1ebe48[_0x53fb('0x30')]!==_0x53fb('0x41')){var _0x2de971={};_0x2de971[_0x1ebe48[_0x53fb('0x2a')]]={'$like':'%'+_0x5232b4[_0x53fb('0x33')][_0x53fb('0x3f')]+'%'};return _0x2de971;}})});}_0x378043=_['merge']({},_0x378043,_0x5232b4[_0x53fb('0x42')]);var _0x4894f7={'where':_0x378043['where']};return db['ChatTransferReport'][_0x53fb('0x20')](_0x4894f7)[_0x53fb('0x25')](function(_0x3d5fc7){_0x38d59c[_0x53fb('0x20')]=_0x3d5fc7;if(_0x5232b4[_0x53fb('0x33')]['includeAll']){_0x378043['include']=[{'all':!![]}];}return db[_0x53fb('0x2e')][_0x53fb('0x43')](_0x378043);})[_0x53fb('0x25')](function(_0x36b765){_0x38d59c[_0x53fb('0x44')]=_0x36b765;return _0x38d59c;})[_0x53fb('0x25')](respondWithFilteredResult(_0x567524,_0x378043))[_0x53fb('0x45')](handleError(_0x567524,null));};exports[_0x53fb('0x46')]=function(_0x3514de,_0x8f04b5){var _0x30d653={'raw':!![],'where':{'id':_0x3514de[_0x53fb('0x47')]['id']}},_0x56f5d9={};_0x56f5d9['model']=_[_0x53fb('0x34')](db[_0x53fb('0x2e')][_0x53fb('0x2f')]);_0x56f5d9['query']=_[_0x53fb('0x34')](_0x3514de[_0x53fb('0x33')]);_0x56f5d9[_0x53fb('0x35')]=_[_0x53fb('0x36')](_0x56f5d9[_0x53fb('0x32')],_0x56f5d9['query']);_0x30d653[_0x53fb('0x38')]=_[_0x53fb('0x36')](_0x56f5d9[_0x53fb('0x32')],qs['fields'](_0x3514de['query'][_0x53fb('0x37')]));_0x30d653['attributes']=_0x30d653[_0x53fb('0x38')][_0x53fb('0x39')]?_0x30d653[_0x53fb('0x38')]:_0x56f5d9[_0x53fb('0x32')];if(_0x3514de[_0x53fb('0x33')][_0x53fb('0x48')]){_0x30d653['include']=[{'all':!![]}];}_0x30d653=_[_0x53fb('0x40')]({},_0x30d653,_0x3514de[_0x53fb('0x42')]);return db['ChatTransferReport'][_0x53fb('0x49')](_0x30d653)['then'](handleEntityNotFound(_0x8f04b5,null))['then'](respondWithResult(_0x8f04b5,null))[_0x53fb('0x45')](handleError(_0x8f04b5,null));};exports[_0x53fb('0x4a')]=function(_0xc7f208,_0x4e8d0b){return db[_0x53fb('0x2e')]['create'](_0xc7f208[_0x53fb('0x4b')],{})['then'](respondWithResult(_0x4e8d0b,0xc9))['catch'](handleError(_0x4e8d0b,null));};exports[_0x53fb('0x4c')]=function(_0x3adf6d,_0x55f69a){if(_0x3adf6d[_0x53fb('0x4b')]['id']){delete _0x3adf6d[_0x53fb('0x4b')]['id'];}return db[_0x53fb('0x2e')][_0x53fb('0x49')]({'where':{'id':_0x3adf6d['params']['id']}})['then'](handleEntityNotFound(_0x55f69a,null))[_0x53fb('0x25')](saveUpdates(_0x3adf6d['body'],null))[_0x53fb('0x25')](respondWithResult(_0x55f69a,null))[_0x53fb('0x45')](handleError(_0x55f69a,null));};exports['destroy']=function(_0x4b614b,_0x5a3da8){return db[_0x53fb('0x2e')][_0x53fb('0x49')]({'where':{'id':_0x4b614b[_0x53fb('0x47')]['id']}})[_0x53fb('0x25')](handleEntityNotFound(_0x5a3da8,null))[_0x53fb('0x25')](removeEntity(_0x5a3da8,null))[_0x53fb('0x45')](handleError(_0x5a3da8,null));};exports[_0x53fb('0x4d')]=function(_0x4c957b,_0x5b3679){return db[_0x53fb('0x2e')]['describe']()['then'](respondWithResult(_0x5b3679,null))['catch'](handleError(_0x5b3679,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index b74d4d6..0298b02 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 _0xbb3b=['../../config/environment','exports','ChatTransferReport','report_chat_transfer','uniqueid','lodash','util','../../config/logger','api','moment','request-promise','rimraf'];(function(_0x430a5c,_0x28952c){var _0x190ed2=function(_0x164725){while(--_0x164725){_0x430a5c['push'](_0x430a5c['shift']());}};_0x190ed2(++_0x28952c);}(_0xbb3b,0x161));var _0xbbb3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbb3b[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xbbb3('0x0'));var util=require(_0xbbb3('0x1'));var logger=require(_0xbbb3('0x2'))(_0xbbb3('0x3'));var moment=require(_0xbbb3('0x4'));var BPromise=require('bluebird');var rp=require(_0xbbb3('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbbb3('0x6'));var config=require(_0xbbb3('0x7'));var attributes=require('./chatTransferReport.attributes');module[_0xbbb3('0x8')]=function(_0x573fc9,_0x1eef0e){return _0x573fc9['define'](_0xbbb3('0x9'),attributes,{'tableName':_0xbbb3('0xa'),'paranoid':![],'indexes':[{'name':_0xbbb3('0xb'),'fields':[_0xbbb3('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x338d=['define','ChatTransferReport','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x206e7d,_0x406925){var _0x3b647d=function(_0xa1aa61){while(--_0xa1aa61){_0x206e7d['push'](_0x206e7d['shift']());}};_0x3b647d(++_0x406925);}(_0x338d,0x9f));var _0xd338=function(_0x1f4896,_0x71df11){_0x1f4896=_0x1f4896-0x0;var _0x24aacc=_0x338d[_0x1f4896];return _0x24aacc;};'use strict';var _=require(_0xd338('0x0'));var util=require(_0xd338('0x1'));var logger=require(_0xd338('0x2'))(_0xd338('0x3'));var moment=require(_0xd338('0x4'));var BPromise=require(_0xd338('0x5'));var rp=require(_0xd338('0x6'));var fs=require('fs');var path=require(_0xd338('0x7'));var rimraf=require(_0xd338('0x8'));var config=require(_0xd338('0x9'));var attributes=require('./chatTransferReport.attributes');module['exports']=function(_0x52f9a3,_0x3ff0c9){return _0x52f9a3[_0xd338('0xa')](_0xd338('0xb'),attributes,{'tableName':'report_chat_transfer','paranoid':![],'indexes':[{'name':_0xd338('0xc'),'fields':[_0xd338('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index a20e908..ba2eb01 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 _0xffc3=['error','ChatTransferReport,\x20%s,\x20%s','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ChatTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x1758c7,_0x2653a8){var _0x48b8a4=function(_0x4b0ba5){while(--_0x4b0ba5){_0x1758c7['push'](_0x1758c7['shift']());}};_0x48b8a4(++_0x2653a8);}(_0xffc3,0x1d3));var _0x3ffc=function(_0x2e5ff6,_0x4c37a3){_0x2e5ff6=_0x2e5ff6-0x0;var _0x1509df=_0xffc3[_0x2e5ff6];return _0x1509df;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3ffc('0x0'));var BPromise=require(_0x3ffc('0x1'));var rs=require(_0x3ffc('0x2'));var fs=require('fs');var Redis=require(_0x3ffc('0x3'));var db=require(_0x3ffc('0x4'))['db'];var utils=require(_0x3ffc('0x5'));var logger=require('../../config/logger')(_0x3ffc('0x6'));var config=require(_0x3ffc('0x7'));var jayson=require(_0x3ffc('0x8'));var client=jayson[_0x3ffc('0x9')][_0x3ffc('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4eb0dd,_0x47fea0,_0x5ebfe2){return new BPromise(function(_0x360cfb,_0x44ecf0){return client[_0x3ffc('0xb')](_0x4eb0dd,_0x5ebfe2)[_0x3ffc('0xc')](function(_0x2676f6){logger[_0x3ffc('0xd')]('ChatTransferReport,\x20%s,\x20%s',_0x47fea0,'request\x20sent');logger['debug'](_0x3ffc('0xe'),_0x47fea0,_0x3ffc('0xf'),JSON['stringify'](_0x2676f6));if(_0x2676f6[_0x3ffc('0x10')]){if(_0x2676f6[_0x3ffc('0x10')]['code']===0x1f4){logger[_0x3ffc('0x10')](_0x3ffc('0x11'),_0x47fea0,_0x2676f6[_0x3ffc('0x10')][_0x3ffc('0x12')]);return _0x44ecf0(_0x2676f6[_0x3ffc('0x10')][_0x3ffc('0x12')]);}logger['error'](_0x3ffc('0x11'),_0x47fea0,_0x2676f6[_0x3ffc('0x10')]['message']);return _0x360cfb(_0x2676f6[_0x3ffc('0x10')][_0x3ffc('0x12')]);}else{logger[_0x3ffc('0xd')](_0x3ffc('0x11'),_0x47fea0,_0x3ffc('0xf'));_0x360cfb(_0x2676f6[_0x3ffc('0x13')][_0x3ffc('0x12')]);}})[_0x3ffc('0x14')](function(_0x45b5bb){logger['error']('ChatTransferReport,\x20%s,\x20%s',_0x47fea0,_0x45b5bb);_0x44ecf0(_0x45b5bb);});});} \ No newline at end of file +var _0x0cd0=['../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','then','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','lodash','util','moment','bluebird','ioredis'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x0cd0,0x136));var _0x00cd=function(_0x33b6e4,_0x464d4b){_0x33b6e4=_0x33b6e4-0x0;var _0x379452=_0x0cd0[_0x33b6e4];return _0x379452;};'use strict';var _=require(_0x00cd('0x0'));var util=require(_0x00cd('0x1'));var moment=require(_0x00cd('0x2'));var BPromise=require(_0x00cd('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x00cd('0x4'));var db=require(_0x00cd('0x5'))['db'];var utils=require(_0x00cd('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x00cd('0x7'));var jayson=require(_0x00cd('0x8'));var client=jayson[_0x00cd('0x9')][_0x00cd('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1a1f8a,_0x5755de,_0x58787c){return new BPromise(function(_0x195f19,_0x332b74){return client['request'](_0x1a1f8a,_0x58787c)[_0x00cd('0xb')](function(_0x1c27dd){logger['info'](_0x00cd('0xc'),_0x5755de,_0x00cd('0xd'));logger[_0x00cd('0xe')](_0x00cd('0xf'),_0x5755de,_0x00cd('0xd'),JSON['stringify'](_0x1c27dd));if(_0x1c27dd[_0x00cd('0x10')]){if(_0x1c27dd[_0x00cd('0x10')]['code']===0x1f4){logger[_0x00cd('0x10')](_0x00cd('0xc'),_0x5755de,_0x1c27dd[_0x00cd('0x10')][_0x00cd('0x11')]);return _0x332b74(_0x1c27dd[_0x00cd('0x10')][_0x00cd('0x11')]);}logger['error'](_0x00cd('0xc'),_0x5755de,_0x1c27dd[_0x00cd('0x10')][_0x00cd('0x11')]);return _0x195f19(_0x1c27dd[_0x00cd('0x10')]['message']);}else{logger[_0x00cd('0x12')](_0x00cd('0xc'),_0x5755de,_0x00cd('0xd'));_0x195f19(_0x1c27dd[_0x00cd('0x13')][_0x00cd('0x11')]);}})[_0x00cd('0x14')](function(_0x4de441){logger[_0x00cd('0x10')]('ChatTransferReport,\x20%s,\x20%s',_0x5755de,_0x4de441);_0x332b74(_0x4de441);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index 63d8296..0281e35 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 _0xcf91=['destroy','exports','multer','util','path','Router','fs-extra','../../config/environment','get','/describe','isAuthenticated','show','put','update','delete','/:id'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xcf91,0x132));var _0x1cf9=function(_0x4efa8a,_0xcacc86){_0x4efa8a=_0x4efa8a-0x0;var _0x46317d=_0xcf91[_0x4efa8a];return _0x46317d;};'use strict';var multer=require(_0x1cf9('0x0'));var util=require(_0x1cf9('0x1'));var path=require(_0x1cf9('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x1cf9('0x3')]();var fs_extra=require(_0x1cf9('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x1cf9('0x5'));var controller=require('./chatTransferReport.controller');router[_0x1cf9('0x6')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x1cf9('0x7'),auth['isAuthenticated'](),controller['describe']);router['get']('/:id',auth[_0x1cf9('0x8')](),controller[_0x1cf9('0x9')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x1cf9('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x1cf9('0xb')]);router[_0x1cf9('0xc')](_0x1cf9('0xd'),auth[_0x1cf9('0x8')](),controller[_0x1cf9('0xe')]);module[_0x1cf9('0xf')]=router; \ No newline at end of file +var _0x13a6=['isAuthenticated','describe','/:id','show','post','create','put','delete','exports','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x13a6,0x1cb));var _0x613a=function(_0x28ab07,_0x5910d3){_0x28ab07=_0x28ab07-0x0;var _0x2cd2fa=_0x13a6[_0x28ab07];return _0x2cd2fa;};'use strict';var multer=require('multer');var util=require(_0x613a('0x0'));var path=require('path');var timeout=require(_0x613a('0x1'));var express=require('express');var router=express[_0x613a('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x613a('0x3'));var interaction=require(_0x613a('0x4'));var config=require(_0x613a('0x5'));var controller=require('./chatTransferReport.controller');router[_0x613a('0x6')]('/',auth['isAuthenticated'](),controller[_0x613a('0x7')]);router[_0x613a('0x6')](_0x613a('0x8'),auth[_0x613a('0x9')](),controller[_0x613a('0xa')]);router[_0x613a('0x6')](_0x613a('0xb'),auth[_0x613a('0x9')](),controller[_0x613a('0xc')]);router[_0x613a('0xd')]('/',auth[_0x613a('0x9')](),controller[_0x613a('0xe')]);router[_0x613a('0xf')]('/:id',auth[_0x613a('0x9')](),controller['update']);router[_0x613a('0x10')](_0x613a('0xb'),auth[_0x613a('0x9')](),controller['destroy']);module[_0x613a('0x11')]=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index acf669f..83b7c93 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 _0x6b0f=['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','Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','randomstring','exports','STRING','email','Agent','#011F6A','#ffffff','INTEGER','BOOLEAN','ENUM','rounded','squared','We\x20are\x20here!','Chat','Send','Contact\x20us','Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Skip','Feedback','star','thumb','stringify','input','name','getDataValue','onlineForm','parse','setDataValue','textarea'];(function(_0x2063d2,_0x55ed75){var _0x27190e=function(_0x171279){while(--_0x171279){_0x2063d2['push'](_0x2063d2['shift']());}};_0x27190e(++_0x55ed75);}(_0x6b0f,0x9f));var _0xf6b0=function(_0x12c5c0,_0x411c81){_0x12c5c0=_0x12c5c0-0x0;var _0x22320b=_0x6b0f[_0x12c5c0];return _0x22320b;};'use strict';var Sequelize=require('sequelize');var rs=require(_0xf6b0('0x0'));module[_0xf6b0('0x1')]={'name':{'type':Sequelize[_0xf6b0('0x2')],'allowNull':![]},'address':{'type':Sequelize[_0xf6b0('0x2')],'allowNull':![],'unique':'address'},'description':{'type':Sequelize[_0xf6b0('0x2')]},'mapKey':{'type':Sequelize[_0xf6b0('0x2')],'defaultValue':'email'},'mapKeyOffline':{'type':Sequelize['STRING'],'defaultValue':_0xf6b0('0x3')},'key':{'type':Sequelize[_0xf6b0('0x2')],'allowNull':![]},'agentAlias':{'type':Sequelize['STRING'],'defaultValue':_0xf6b0('0x4')},'customerAlias':{'type':Sequelize[_0xf6b0('0x2')],'defaultValue':'Me'},'color':{'type':Sequelize[_0xf6b0('0x2')],'allowNull':![],'defaultValue':_0xf6b0('0x5'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0xf6b0('0x2')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0xf6b0('0x2')],'allowNull':![],'defaultValue':_0xf6b0('0x6'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0xf6b0('0x7')],'defaultValue':0xf},'remote':{'type':Sequelize[_0xf6b0('0x2')]},'animation':{'type':Sequelize[_0xf6b0('0x8')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0xf6b0('0x9')](_0xf6b0('0xa'),_0xf6b0('0xb')),'defaultValue':_0xf6b0('0xa')},'header_online':{'type':Sequelize[_0xf6b0('0x2')],'defaultValue':_0xf6b0('0xc')},'start_chat_button':{'type':Sequelize[_0xf6b0('0x2')],'defaultValue':_0xf6b0('0xd')},'offline_chat_button':{'type':Sequelize[_0xf6b0('0x2')],'defaultValue':_0xf6b0('0xe')},'header_offline':{'type':Sequelize[_0xf6b0('0x2')],'defaultValue':_0xf6b0('0xf')},'download_transcript':{'type':Sequelize[_0xf6b0('0x8')],'defaultValue':!![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0xf6b0('0x2')],'defaultValue':_0xf6b0('0x10')},'defaultWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0xf6b0('0x11')]},'closingQuestion':{'type':Sequelize[_0xf6b0('0x2')],'defaultValue':_0xf6b0('0x12')},'formSubmitSuccessMessage':{'type':Sequelize['STRING'],'defaultValue':_0xf6b0('0x13')},'formSubmitFailureMessage':{'type':Sequelize[_0xf6b0('0x2')],'defaultValue':_0xf6b0('0x14')},'noteTitle':{'type':Sequelize['STRING'],'defaultValue':'Note'},'placeholderMessage':{'type':Sequelize[_0xf6b0('0x2')],'defaultValue':'Type\x20a\x20message'},'closingMessage':{'type':Sequelize[_0xf6b0('0x2')],'defaultValue':'Thanks\x20you\x20for\x20your\x20time!'},'closingMessageButton':{'type':Sequelize[_0xf6b0('0x2')],'defaultValue':_0xf6b0('0xe')},'skipMessageButton':{'type':Sequelize[_0xf6b0('0x2')],'defaultValue':_0xf6b0('0x15')},'conditionAgreement':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableRating':{'type':Sequelize[_0xf6b0('0x8')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0xf6b0('0x8')],'defaultValue':![]},'enableSendButton':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0xf6b0('0x2')],'defaultValue':_0xf6b0('0x16')},'ratingType':{'type':Sequelize[_0xf6b0('0x9')](_0xf6b0('0x17'),_0xf6b0('0x18')),'defaultValue':'star'},'ratingStarsNumber':{'type':Sequelize[_0xf6b0('0x7')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0xf6b0('0x11')],'defaultValue':function(){return JSON[_0xf6b0('0x19')]({'items':[{'type':_0xf6b0('0x1a'),'variable':null,'config':{'placeholder':_0xf6b0('0x1b'),'type':'text','required':!![]},'props':{'title':_0xf6b0('0x1b'),'helpText':''}},{'type':'input','props':{'title':_0xf6b0('0x3'),'helpText':''},'config':{'required':!![],'placeholder':_0xf6b0('0x3'),'type':_0xf6b0('0x3')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0xf6b0('0x1c')](_0xf6b0('0x1d'))?JSON[_0xf6b0('0x1e')](this[_0xf6b0('0x1c')]('onlineForm')):{};},'set':function(_0x51d49e){return this[_0xf6b0('0x1f')](_0xf6b0('0x1d'),JSON[_0xf6b0('0x19')](_0x51d49e));}},'offlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0xf6b0('0x19')]({'items':[{'type':'input','props':{'title':_0xf6b0('0x3'),'helpText':''},'config':{'required':!![],'placeholder':_0xf6b0('0x3'),'type':_0xf6b0('0x3')},'variable':null},{'type':_0xf6b0('0x20'),'config':{'placeholder':_0xf6b0('0x21')},'props':{'title':_0xf6b0('0x21'),'helpText':_0xf6b0('0x22')}}],'fromKey':0x0});},'get':function(){return this[_0xf6b0('0x1c')](_0xf6b0('0x23'))?JSON[_0xf6b0('0x1e')](this[_0xf6b0('0x1c')]('offlineForm')):{};},'set':function(_0x344666){return this['setDataValue'](_0xf6b0('0x23'),JSON['stringify'](_0x344666));}},'token':{'type':Sequelize[_0xf6b0('0x2')],'defaultValue':function(){return rs['generate']();}},'autoclose':{'type':Sequelize[_0xf6b0('0x8')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscript':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0xf6b0('0x2')]},'forwardOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize['STRING']},'waitingTitle':{'type':Sequelize[_0xf6b0('0x2')],'defaultValue':_0xf6b0('0x24')},'waitingMessage':{'type':Sequelize[_0xf6b0('0x2')],'defaultValue':_0xf6b0('0x25')},'offlineMessageSubject':{'type':Sequelize[_0xf6b0('0x2')],'defaultValue':_0xf6b0('0x26')},'offlineMessageBody':{'type':Sequelize['STRING'],'defaultValue':'You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:'},'enableUnmanagedNote':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0xf6b0('0x2')],'defaultValue':_0xf6b0('0x27')},'skipUnmanaged':{'type':Sequelize[_0xf6b0('0x2')],'defaultValue':_0xf6b0('0x15')},'sendUnmanaged':{'type':Sequelize[_0xf6b0('0x2')],'defaultValue':_0xf6b0('0xe')},'enableCustomerAttachment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0xf6b0('0x8')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0xf6b0('0x11')]},'showAgentAvatar':{'type':Sequelize[_0xf6b0('0x8')],'defaultValue':![]},'timezone':{'type':Sequelize[_0xf6b0('0x2')]},'notificationTemplate':{'type':Sequelize[_0xf6b0('0x11')],'defaultValue':function(){return _0xf6b0('0x28');}},'notificationSound':{'type':Sequelize[_0xf6b0('0x8')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0xf6b0('0x8')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0xf6b0('0x2')],'defaultValue':_0xf6b0('0x29')},'waitForTheAssignedAgent':{'type':Sequelize[_0xf6b0('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0xf6b0('0x2')],'defaultValue':_0xf6b0('0x2a')},'verticalAlignment':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize[_0xf6b0('0x2')],'defaultValue':'alternate'},'defaultTitle':{'type':Sequelize['STRING']},'customerAvatar':{'type':Sequelize[_0xf6b0('0x11')]},'showCustomerAvatar':{'type':Sequelize[_0xf6b0('0x8')],'defaultValue':![]},'messageFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc},'backgroundColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#fafafa','validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0xf6b0('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xf6b0('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xf6b0('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xf6b0('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0xf6b0('0x2')],'defaultValue':_0xf6b0('0x2b')},'systemAvatar':{'type':Sequelize[_0xf6b0('0x11')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0xf6b0('0x2c')},'mandatoryDisposition':{'type':Sequelize[_0xf6b0('0x8')],'defaultValue':![],'comment':_0xf6b0('0x2d'),'set':function(_0x2b3357){if(!_0x2b3357)this['setDataValue']('mandatoryDispositionPauseId',null);this[_0xf6b0('0x1f')](_0xf6b0('0x2e'),_0x2b3357);}},'vidaooEscalation':{'type':Sequelize[_0xf6b0('0x8')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0xf6b0('0x2')]},'vidaooTopic':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xf6b0('0x2f')},'vidaooNote':{'type':Sequelize[_0xf6b0('0x2')],'defaultValue':function(){return'Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}';}},'vidaooMetadata':{'type':Sequelize['TEXT'],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0xf6b0('0x8')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0xf6b0('0x11')]}}; \ No newline at end of file +var _0x6dd2=['website_alias','alternate','#fafafa','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','address','email','#011F6A','#ffffff','INTEGER','BOOLEAN','ENUM','rounded','Chat','Send','Contact\x20us','Powered\x20by\x20xCALLY','TEXT','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Skip','Feedback','star','thumb','stringify','input','name','text','getDataValue','onlineForm','parse','setDataValue','textarea','Comments','Leave\x20your\x20comments','offlineForm','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}'];(function(_0x24b7a9,_0x4cde14){var _0xc990a=function(_0xf3d4c8){while(--_0xf3d4c8){_0x24b7a9['push'](_0x24b7a9['shift']());}};_0xc990a(++_0x4cde14);}(_0x6dd2,0x1a0));var _0x26dd=function(_0x143a7a,_0x582af1){_0x143a7a=_0x143a7a-0x0;var _0x15f94d=_0x6dd2[_0x143a7a];return _0x15f94d;};'use strict';var Sequelize=require(_0x26dd('0x0'));var rs=require(_0x26dd('0x1'));module[_0x26dd('0x2')]={'name':{'type':Sequelize[_0x26dd('0x3')],'allowNull':![]},'address':{'type':Sequelize[_0x26dd('0x3')],'allowNull':![],'unique':_0x26dd('0x4')},'description':{'type':Sequelize[_0x26dd('0x3')]},'mapKey':{'type':Sequelize[_0x26dd('0x3')],'defaultValue':'email'},'mapKeyOffline':{'type':Sequelize['STRING'],'defaultValue':_0x26dd('0x5')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x26dd('0x3')],'defaultValue':'Agent'},'customerAlias':{'type':Sequelize[_0x26dd('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x26dd('0x3')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x26dd('0x3')],'allowNull':![],'defaultValue':_0x26dd('0x6'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x26dd('0x3')],'allowNull':![],'defaultValue':_0x26dd('0x7'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x26dd('0x8')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x26dd('0x3')]},'animation':{'type':Sequelize[_0x26dd('0x9')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x26dd('0xa')](_0x26dd('0xb'),'squared'),'defaultValue':_0x26dd('0xb')},'header_online':{'type':Sequelize[_0x26dd('0x3')],'defaultValue':'We\x20are\x20here!'},'start_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0x26dd('0xc')},'offline_chat_button':{'type':Sequelize[_0x26dd('0x3')],'defaultValue':_0x26dd('0xd')},'header_offline':{'type':Sequelize[_0x26dd('0x3')],'defaultValue':_0x26dd('0xe')},'download_transcript':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x26dd('0x8')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x26dd('0x3')],'defaultValue':_0x26dd('0xf')},'defaultWhiteLabel':{'type':Sequelize[_0x26dd('0x9')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x26dd('0x10')]},'closingQuestion':{'type':Sequelize['STRING'],'defaultValue':'Do\x20you\x20want\x20to\x20close\x20the\x20interaction?'},'formSubmitSuccessMessage':{'type':Sequelize[_0x26dd('0x3')],'defaultValue':_0x26dd('0x11')},'formSubmitFailureMessage':{'type':Sequelize[_0x26dd('0x3')],'defaultValue':_0x26dd('0x12')},'noteTitle':{'type':Sequelize[_0x26dd('0x3')],'defaultValue':_0x26dd('0x13')},'placeholderMessage':{'type':Sequelize['STRING'],'defaultValue':'Type\x20a\x20message'},'closingMessage':{'type':Sequelize[_0x26dd('0x3')],'defaultValue':'Thanks\x20you\x20for\x20your\x20time!'},'closingMessageButton':{'type':Sequelize[_0x26dd('0x3')],'defaultValue':_0x26dd('0xd')},'skipMessageButton':{'type':Sequelize[_0x26dd('0x3')],'defaultValue':_0x26dd('0x14')},'conditionAgreement':{'type':Sequelize[_0x26dd('0x9')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x26dd('0x9')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x26dd('0x9')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x26dd('0x9')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x26dd('0x3')],'defaultValue':_0x26dd('0x15')},'ratingType':{'type':Sequelize[_0x26dd('0xa')](_0x26dd('0x16'),_0x26dd('0x17')),'defaultValue':'star'},'ratingStarsNumber':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x26dd('0x10')],'defaultValue':function(){return JSON[_0x26dd('0x18')]({'items':[{'type':_0x26dd('0x19'),'variable':null,'config':{'placeholder':_0x26dd('0x1a'),'type':_0x26dd('0x1b'),'required':!![]},'props':{'title':_0x26dd('0x1a'),'helpText':''}},{'type':_0x26dd('0x19'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0x26dd('0x5'),'type':_0x26dd('0x5')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x26dd('0x1c')](_0x26dd('0x1d'))?JSON[_0x26dd('0x1e')](this[_0x26dd('0x1c')](_0x26dd('0x1d'))):{};},'set':function(_0x2613e2){return this[_0x26dd('0x1f')](_0x26dd('0x1d'),JSON[_0x26dd('0x18')](_0x2613e2));}},'offlineForm':{'type':Sequelize[_0x26dd('0x10')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':'input','props':{'title':_0x26dd('0x5'),'helpText':''},'config':{'required':!![],'placeholder':_0x26dd('0x5'),'type':_0x26dd('0x5')},'variable':null},{'type':_0x26dd('0x20'),'config':{'placeholder':_0x26dd('0x21')},'props':{'title':_0x26dd('0x21'),'helpText':_0x26dd('0x22')}}],'fromKey':0x0});},'get':function(){return this['getDataValue']('offlineForm')?JSON[_0x26dd('0x1e')](this[_0x26dd('0x1c')]('offlineForm')):{};},'set':function(_0x3f3857){return this[_0x26dd('0x1f')](_0x26dd('0x23'),JSON[_0x26dd('0x18')](_0x3f3857));}},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x26dd('0x24')]();}},'autoclose':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x26dd('0x9')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x26dd('0x9')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x26dd('0x3')]},'forwardOffline':{'type':Sequelize[_0x26dd('0x9')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize['STRING']},'waitingTitle':{'type':Sequelize['STRING'],'defaultValue':_0x26dd('0x25')},'waitingMessage':{'type':Sequelize[_0x26dd('0x3')],'defaultValue':_0x26dd('0x26')},'offlineMessageSubject':{'type':Sequelize[_0x26dd('0x3')],'defaultValue':_0x26dd('0x27')},'offlineMessageBody':{'type':Sequelize[_0x26dd('0x3')],'defaultValue':_0x26dd('0x28')},'enableUnmanagedNote':{'type':Sequelize[_0x26dd('0x9')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x26dd('0x3')],'defaultValue':_0x26dd('0x29')},'skipUnmanaged':{'type':Sequelize[_0x26dd('0x3')],'defaultValue':'Skip'},'sendUnmanaged':{'type':Sequelize[_0x26dd('0x3')],'defaultValue':_0x26dd('0xd')},'enableCustomerAttachment':{'type':Sequelize[_0x26dd('0x9')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x26dd('0x9')],'defaultValue':![]},'agentAvatar':{'type':Sequelize['TEXT']},'showAgentAvatar':{'type':Sequelize[_0x26dd('0x9')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x26dd('0x3')]},'notificationTemplate':{'type':Sequelize[_0x26dd('0x10')],'defaultValue':function(){return _0x26dd('0x2a');}},'notificationSound':{'type':Sequelize[_0x26dd('0x9')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x26dd('0x3')],'defaultValue':_0x26dd('0x2b')},'waitForTheAssignedAgent':{'type':Sequelize[_0x26dd('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x26dd('0x3')],'defaultValue':'bottom_right'},'verticalAlignment':{'type':Sequelize[_0x26dd('0x8')],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':_0x26dd('0x2c')},'defaultTitle':{'type':Sequelize[_0x26dd('0x3')]},'customerAvatar':{'type':Sequelize[_0x26dd('0x10')]},'showCustomerAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'messageFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc},'backgroundColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x26dd('0x2d'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x26dd('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x26dd('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x26dd('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x26dd('0x3')],'defaultValue':'System'},'systemAvatar':{'type':Sequelize[_0x26dd('0x10')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x26dd('0x8')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x26dd('0x2e'),'set':function(_0x58112d){if(!_0x58112d)this[_0x26dd('0x1f')](_0x26dd('0x2f'),null);this[_0x26dd('0x1f')](_0x26dd('0x30'),_0x58112d);}},'vidaooEscalation':{'type':Sequelize[_0x26dd('0x9')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x26dd('0x3')]},'vidaooTopic':{'type':Sequelize[_0x26dd('0x3')],'allowNull':![],'defaultValue':_0x26dd('0x31')},'vidaooNote':{'type':Sequelize[_0x26dd('0x3')],'defaultValue':function(){return _0x26dd('0x32');}},'vidaooMetadata':{'type':Sequelize['TEXT'],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x26dd('0x9')],'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 4d7c9f4..439c953 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 _0x8077=['ListId','from','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','ChatApplication','Applications','account','list','applications','priority','asc','contact','customerIp','cf-connecting-ip','x-forwarded-for','first','split','lastName','x-real-port','browser','version','format','%s\x20%s','unknown','device','vendor','%s\x20%s\x20%s','threadId','ChatInteraction','externalUrl','ContactId','interaction','spread','firstName','messageId','created','autoclose','close','unmanaged','ChatMessage','UserId','User','unshift','agent','waitForTheAssignedAgent','*,*,*,*','forcedOwnership','Start','startRouting','EventManager','offline','files','send','from\x20is\x20mandatory','mapKeyOffline','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','findOrCreate','server/files/templates/chatOfflineMessage.ejs','utf8','toPairs','offlineMessageBody','ChatOfflineMessage','originalname','mimetype','attachments','offline-chat','basename','openNewInteraction','bulkCreate','MailServerOut','Smtp','forwardOfflineAddress','service','host','port','secure','auth','pass','sendMail','\x22%s\x22\x20<%s>','email','offlineMessageSubject','MailAccountId','subjectOffline','mapValues','NotifyMailAccount','notifyMail','server','remove','addInteraction','ids','getInteractions','pick','Contact','fullname','Tag','Tags','color','tag','Command','timezone','iftime\x20%s,%s','interval','iftime\x20%s','indexOf','true','ONLINE','OFFLINE','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','getSnippet','Interval','Intervals','getProactiveActions','getLicense','virtual','custom','chatLicenseExceeded','all','server/files/chat/iframe.ejs','remote','x-real-ip','connection','referer','replace','render','textColor','color_button','backgroundColor','addApplications','sequelize','getApplications','addProactiveActions','chatProactiveAction','omit','ChatProactiveAction','getFields','online','false','onlineForm','items','fromKey','Attachment','addAgents','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','./chatWebsite.socket','jayson/promise','client','http','then','info','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','ChatWebsite,\x20%s,\x20%s','message','result','catch','sendStatus','status','json','offset','undefined','count','limit','reject','save','update','destroy','get','UserProfileResource','stack','name','index','Pause','map','ChatWebsite','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','include','rows','show','params','mandatoryDispositionPause','fields','includeAll','options','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','ChatWebsites','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','ChatWebsiteId','Disposition','getDispositions','findOne','findAll','removeDispositions','addAnswer','getAnswers','CannedAnswer','addLogo','sitepic','file','addAvatar','agentAvatar','customerAvatar','filename','addSystemAvatar','systemAvatar','getLogo','join','root','server/files/images/logos/default_logo.svg','isNil','server/files/images/logos/','download','getAvatar','existsSync','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','getSystemAvatar','user-agent-parser','setUA','headers','user-agent','chat','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId'];(function(_0x2cf2e9,_0xd58ea1){var _0xd3670d=function(_0x272868){while(--_0x272868){_0x2cf2e9['push'](_0x2cf2e9['shift']());}};_0xd3670d(++_0xd58ea1);}(_0x8077,0x1ca));var _0x7807=function(_0x54a4f9,_0x327eb9){_0x54a4f9=_0x54a4f9-0x0;var _0x474753=_0x8077[_0x54a4f9];return _0x474753;};'use strict';var emlformat=require(_0x7807('0x0'));var rimraf=require(_0x7807('0x1'));var zipdir=require(_0x7807('0x2'));var jsonpatch=require(_0x7807('0x3'));var rp=require(_0x7807('0x4'));var moment=require('moment');var BPromise=require(_0x7807('0x5'));var Mustache=require(_0x7807('0x6'));var util=require(_0x7807('0x7'));var path=require('path');var sox=require(_0x7807('0x8'));var csv=require('to-csv');var ejs=require(_0x7807('0x9'));var fs=require('fs');var fs_extra=require(_0x7807('0xa'));var _=require(_0x7807('0xb'));var squel=require(_0x7807('0xc'));var crypto=require(_0x7807('0xd'));var jsforce=require(_0x7807('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x7807('0xf'));var Redis=require(_0x7807('0x10'));var authService=require(_0x7807('0x11'));var qs=require(_0x7807('0x12'));var as=require(_0x7807('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7807('0x14'))(_0x7807('0x15'));var utils=require(_0x7807('0x16'));var config=require(_0x7807('0x17'));var licenseUtil=require(_0x7807('0x18'));var db=require('../../mysqldb')['db'];config[_0x7807('0x19')]=_[_0x7807('0x1a')](config['redis'],{'host':_0x7807('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7807('0x19')]));require(_0x7807('0x1c'))['register'](socket);var jayson=require(_0x7807('0x1d'));var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0x7807('0x1e')][_0x7807('0x1f')]({'port':0x232a});var client9003=jayson[_0x7807('0x1e')]['http']({'port':0x232b});var client9001=jayson[_0x7807('0x1e')][_0x7807('0x1f')]({'port':0x2329});function respondWithRpcPromise(_0x5aec80,_0x1e1d04,_0x5de83a,_0x52c7fb){return new BPromise(function(_0x4fcf79,_0xfa6d7d){var _0x15086e=_0x52c7fb||client;return _0x15086e['request'](_0x5aec80,_0x5de83a)[_0x7807('0x20')](function(_0x5e17f3){logger[_0x7807('0x21')]('ChatWebsite,\x20%s,\x20%s',_0x1e1d04,_0x7807('0x22'));logger[_0x7807('0x23')](_0x7807('0x24'),_0x1e1d04,_0x7807('0x22'),JSON[_0x7807('0x25')](_0x5e17f3));if(_0x5e17f3[_0x7807('0x26')]){if(_0x5e17f3[_0x7807('0x26')]['code']===0x1f4){logger[_0x7807('0x26')](_0x7807('0x27'),_0x1e1d04,_0x5e17f3[_0x7807('0x26')]['message']);return _0xfa6d7d(_0x5e17f3['error'][_0x7807('0x28')]);}logger['error'](_0x7807('0x27'),_0x1e1d04,_0x5e17f3[_0x7807('0x26')][_0x7807('0x28')]);return _0x4fcf79(_0x5e17f3[_0x7807('0x26')][_0x7807('0x28')]);}else{logger[_0x7807('0x21')](_0x7807('0x27'),_0x1e1d04,_0x7807('0x22'));_0x4fcf79(_0x5e17f3[_0x7807('0x29')][_0x7807('0x28')]);}})[_0x7807('0x2a')](function(_0x1b8879){logger[_0x7807('0x26')]('ChatWebsite,\x20%s,\x20%s',_0x1e1d04,_0x1b8879);_0xfa6d7d(_0x1b8879);});});}function respondWithStatusCode(_0x2bd993,_0x27a30a){_0x27a30a=_0x27a30a||0xcc;return function(_0x2f2457){if(_0x2f2457){return _0x2bd993[_0x7807('0x2b')](_0x27a30a);}return _0x2bd993[_0x7807('0x2c')](_0x27a30a)['end']();};}function respondWithResult(_0x304401,_0x2c3192){_0x2c3192=_0x2c3192||0xc8;return function(_0x32a40f){if(_0x32a40f){return _0x304401['status'](_0x2c3192)[_0x7807('0x2d')](_0x32a40f);}};}function respondWithFilteredResult(_0x2833bc,_0x3e480f){return function(_0x3dc945){if(_0x3dc945){var _0xd237a5=typeof _0x3e480f[_0x7807('0x2e')]===_0x7807('0x2f')&&typeof _0x3e480f['limit']==='undefined';var _0x4d9253=_0x3dc945[_0x7807('0x30')];var _0x27e067=_0xd237a5?0x0:_0x3e480f[_0x7807('0x2e')];var _0x464bcd=_0xd237a5?_0x3dc945[_0x7807('0x30')]:_0x3e480f[_0x7807('0x2e')]+_0x3e480f[_0x7807('0x31')];var _0x2d3582;if(_0x464bcd>=_0x4d9253){_0x464bcd=_0x4d9253;_0x2d3582=0xc8;}else{_0x2d3582=0xce;}_0x2833bc[_0x7807('0x2c')](_0x2d3582);return _0x2833bc['set']('Content-Range',_0x27e067+'-'+_0x464bcd+'/'+_0x4d9253)['json'](_0x3dc945);}return null;};}function patchUpdates(_0xadebcd){return function(_0x43ea38){try{jsonpatch['apply'](_0x43ea38,_0xadebcd,!![]);}catch(_0x1d4692){return BPromise[_0x7807('0x32')](_0x1d4692);}return _0x43ea38[_0x7807('0x33')]();};}function saveUpdates(_0x3fe0d9,_0x18954a){return function(_0x581ea3){if(_0x581ea3){return _0x581ea3[_0x7807('0x34')](_0x3fe0d9)[_0x7807('0x20')](function(_0x3334b0){return _0x3334b0;});}return null;};}function removeEntity(_0x3f9365,_0x5b94e8){return function(_0x16862f){if(_0x16862f){return _0x16862f[_0x7807('0x35')]()[_0x7807('0x20')](function(){var _0xbbb993=_0x16862f[_0x7807('0x36')]({'plain':!![]});var _0x550611='ChatWebsites';return db[_0x7807('0x37')]['destroy']({'where':{'type':_0x550611,'resourceId':_0xbbb993['id']}})[_0x7807('0x20')](function(){return _0x16862f;});})[_0x7807('0x20')](function(){_0x3f9365[_0x7807('0x2c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x52c4f7,_0x392767){return function(_0x4c4716){if(!_0x4c4716){_0x52c4f7[_0x7807('0x2b')](0x194);}return _0x4c4716;};}function handleError(_0x424231,_0x462c88){_0x462c88=_0x462c88||0x1f4;return function(_0x48c4a8){logger[_0x7807('0x26')](_0x48c4a8[_0x7807('0x38')]);if(_0x48c4a8[_0x7807('0x39')]){delete _0x48c4a8['name'];}_0x424231[_0x7807('0x2c')](_0x462c88)['send'](_0x48c4a8);};}exports[_0x7807('0x3a')]=function(_0x8699be,_0xe49cff){var _0x17cb7a={'include':[{'model':db[_0x7807('0x3b')],'as':'mandatoryDispositionPause'}]},_0xceab9a={},_0x356006={'count':0x0,'rows':[]};var _0x11ec43=_[_0x7807('0x3c')](db[_0x7807('0x3d')][_0x7807('0x3e')],function(_0x4c85ca){return{'name':_0x4c85ca[_0x7807('0x3f')],'type':_0x4c85ca[_0x7807('0x40')][_0x7807('0x41')]};});_0xceab9a[_0x7807('0x42')]=_['map'](_0x11ec43,'name');_0xceab9a[_0x7807('0x43')]=_[_0x7807('0x44')](_0x8699be['query']);_0xceab9a[_0x7807('0x45')]=_['intersection'](_0xceab9a[_0x7807('0x42')],_0xceab9a[_0x7807('0x43')]);_0x17cb7a[_0x7807('0x46')]=_[_0x7807('0x47')](_0xceab9a['model'],qs['fields'](_0x8699be[_0x7807('0x43')]['fields']));_0x17cb7a['attributes']=_0x17cb7a[_0x7807('0x46')][_0x7807('0x48')]?_0x17cb7a[_0x7807('0x46')]:_0xceab9a[_0x7807('0x42')];if(!_0x8699be[_0x7807('0x43')][_0x7807('0x49')](_0x7807('0x4a'))){_0x17cb7a[_0x7807('0x31')]=qs['limit'](_0x8699be['query'][_0x7807('0x31')]);_0x17cb7a[_0x7807('0x2e')]=qs[_0x7807('0x2e')](_0x8699be[_0x7807('0x43')]['offset']);}_0x17cb7a[_0x7807('0x4b')]=qs[_0x7807('0x4c')](_0x8699be[_0x7807('0x43')][_0x7807('0x4c')]);_0x17cb7a[_0x7807('0x4d')]=qs[_0x7807('0x45')](_['pick'](_0x8699be[_0x7807('0x43')],_0xceab9a[_0x7807('0x45')]),_0x11ec43);if(_0x8699be['query'][_0x7807('0x4e')]){_0x17cb7a[_0x7807('0x4d')]=_[_0x7807('0x4f')](_0x17cb7a[_0x7807('0x4d')],{'$or':_[_0x7807('0x3c')](_0x11ec43,function(_0x2d3456){if(_0x2d3456[_0x7807('0x40')]!==_0x7807('0x50')){var _0x3a28da={};_0x3a28da[_0x2d3456[_0x7807('0x39')]]={'$like':'%'+_0x8699be[_0x7807('0x43')]['filter']+'%'};return _0x3a28da;}})});}_0x17cb7a=_[_0x7807('0x4f')]({},_0x17cb7a,_0x8699be['options']);var _0x17e258={'where':_0x17cb7a[_0x7807('0x4d')]};return db[_0x7807('0x3d')][_0x7807('0x30')](_0x17e258)['then'](function(_0x3e1138){_0x356006[_0x7807('0x30')]=_0x3e1138;if(_0x8699be[_0x7807('0x43')]['includeAll']){_0x17cb7a[_0x7807('0x51')]=[{'all':!![]}];}return db[_0x7807('0x3d')]['findAll'](_0x17cb7a);})[_0x7807('0x20')](function(_0x38a150){_0x356006[_0x7807('0x52')]=_0x38a150;return _0x356006;})[_0x7807('0x20')](respondWithFilteredResult(_0xe49cff,_0x17cb7a))['catch'](handleError(_0xe49cff,null));};exports[_0x7807('0x53')]=function(_0x14c8e7,_0x52d8b1){var _0x177ea2={'raw':![],'where':{'id':_0x14c8e7[_0x7807('0x54')]['id']},'include':[{'model':db[_0x7807('0x3b')],'as':_0x7807('0x55')}]},_0x28d89d={};_0x28d89d[_0x7807('0x42')]=_['keys'](db['ChatWebsite']['rawAttributes']);_0x28d89d[_0x7807('0x43')]=_[_0x7807('0x44')](_0x14c8e7['query']);_0x28d89d['filters']=_['intersection'](_0x28d89d[_0x7807('0x42')],_0x28d89d[_0x7807('0x43')]);_0x177ea2[_0x7807('0x46')]=_[_0x7807('0x47')](_0x28d89d[_0x7807('0x42')],qs[_0x7807('0x56')](_0x14c8e7[_0x7807('0x43')]['fields']));_0x177ea2[_0x7807('0x46')]=_0x177ea2[_0x7807('0x46')][_0x7807('0x48')]?_0x177ea2[_0x7807('0x46')]:_0x28d89d[_0x7807('0x42')];if(_0x14c8e7['query'][_0x7807('0x57')]){_0x177ea2[_0x7807('0x51')]=[{'all':!![]}];}_0x177ea2=_[_0x7807('0x4f')]({},_0x177ea2,_0x14c8e7[_0x7807('0x58')]);return db['ChatWebsite'][_0x7807('0x59')](_0x177ea2)[_0x7807('0x20')](handleEntityNotFound(_0x52d8b1,null))['then'](respondWithResult(_0x52d8b1,null))[_0x7807('0x2a')](handleError(_0x52d8b1,null));};exports[_0x7807('0x5a')]=function(_0x13aaae,_0x18abfc){return db[_0x7807('0x3d')][_0x7807('0x5a')](_0x13aaae['body'],{})['then'](function(_0x2fd012){var _0x4483a2=_0x13aaae['user']['get']({'plain':!![]});if(!_0x4483a2)throw new Error(_0x7807('0x5b'));if(_0x4483a2[_0x7807('0x5c')]===_0x7807('0x5d')){var _0x26eb7e=_0x2fd012[_0x7807('0x36')]({'plain':!![]});var _0x2c9762=_0x7807('0x5e');return db[_0x7807('0x5f')][_0x7807('0x59')]({'where':{'name':_0x2c9762,'userProfileId':_0x4483a2[_0x7807('0x60')]},'raw':!![]})[_0x7807('0x20')](function(_0x4aac32){if(_0x4aac32&&_0x4aac32['autoAssociation']===0x0){return db[_0x7807('0x37')]['create']({'name':_0x26eb7e['name'],'resourceId':_0x26eb7e['id'],'type':_0x4aac32[_0x7807('0x39')],'sectionId':_0x4aac32['id']},{})[_0x7807('0x20')](function(){return _0x2fd012;});}else{return _0x2fd012;}})[_0x7807('0x2a')](function(_0x167065){logger[_0x7807('0x26')](_0x7807('0x61'),_0x167065);throw _0x167065;});}return _0x2fd012;})['then'](respondWithResult(_0x18abfc,0xc9))[_0x7807('0x2a')](handleError(_0x18abfc,null));};exports[_0x7807('0x34')]=function(_0x31eb01,_0x24469d){if(_0x31eb01[_0x7807('0x62')]['id']){delete _0x31eb01['body']['id'];}return db[_0x7807('0x3d')][_0x7807('0x59')]({'where':{'id':_0x31eb01[_0x7807('0x54')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})[_0x7807('0x20')](handleEntityNotFound(_0x24469d,null))['then'](saveUpdates(_0x31eb01[_0x7807('0x62')],null))[_0x7807('0x20')](respondWithResult(_0x24469d,null))[_0x7807('0x2a')](handleError(_0x24469d,null));};exports[_0x7807('0x35')]=function(_0x3116a1,_0x19e478){return db['ChatWebsite']['find']({'where':{'id':_0x3116a1[_0x7807('0x54')]['id']}})[_0x7807('0x20')](handleEntityNotFound(_0x19e478,null))[_0x7807('0x20')](removeEntity(_0x19e478,null))[_0x7807('0x2a')](handleError(_0x19e478,null));};exports[_0x7807('0x63')]=function(_0x44bc61,_0x3821da){return db[_0x7807('0x3d')][_0x7807('0x63')]()[_0x7807('0x20')](respondWithResult(_0x3821da,null))[_0x7807('0x2a')](handleError(_0x3821da,null));};exports[_0x7807('0x64')]=function(_0x2fbb95,_0x41f834,_0x29dff1){if(_0x2fbb95['body']['id']){delete _0x2fbb95[_0x7807('0x62')]['id'];}return db[_0x7807('0x3d')][_0x7807('0x59')]({'where':{'id':_0x2fbb95[_0x7807('0x54')]['id']}})['then'](handleEntityNotFound(_0x41f834,null))['then'](function(_0x2ecfe1){if(_0x2ecfe1){_0x2fbb95['body'][_0x7807('0x65')]=_0x2ecfe1['id'];return db[_0x7807('0x66')][_0x7807('0x5a')](_0x2fbb95['body']);}})[_0x7807('0x20')](respondWithResult(_0x41f834,null))['catch'](handleError(_0x41f834,null));};exports[_0x7807('0x67')]=function(_0x4a63c6,_0x2c9787,_0x3f4e9e){var _0xfe8089={'raw':![],'where':{}};var _0x90bbe2={};var _0x612118={'count':0x0,'rows':[]};return db[_0x7807('0x3d')][_0x7807('0x68')]({'where':{'id':_0x4a63c6[_0x7807('0x54')]['id']}})[_0x7807('0x20')](handleEntityNotFound(_0x2c9787,null))[_0x7807('0x20')](function(_0x3b3204){if(_0x3b3204){_0x90bbe2['model']=_['keys'](db['Disposition'][_0x7807('0x3e')]);_0x90bbe2['query']=_[_0x7807('0x44')](_0x4a63c6[_0x7807('0x43')]);_0x90bbe2[_0x7807('0x45')]=_[_0x7807('0x47')](_0x90bbe2['model'],_0x90bbe2[_0x7807('0x43')]);_0xfe8089[_0x7807('0x46')]=_[_0x7807('0x47')](_0x90bbe2[_0x7807('0x42')],qs[_0x7807('0x56')](_0x4a63c6[_0x7807('0x43')]['fields']));_0xfe8089[_0x7807('0x46')]=_0xfe8089['attributes'][_0x7807('0x48')]?_0xfe8089[_0x7807('0x46')]:_0x90bbe2['model'];if(!_0x4a63c6[_0x7807('0x43')][_0x7807('0x49')](_0x7807('0x4a'))){_0xfe8089[_0x7807('0x31')]=qs['limit'](_0x4a63c6['query'][_0x7807('0x31')]);_0xfe8089[_0x7807('0x2e')]=qs['offset'](_0x4a63c6[_0x7807('0x43')][_0x7807('0x2e')]);}_0xfe8089[_0x7807('0x4b')]=qs[_0x7807('0x4c')](_0x4a63c6['query'][_0x7807('0x4c')]);_0xfe8089['where']=qs[_0x7807('0x45')](_['pick'](_0x4a63c6[_0x7807('0x43')],_0x90bbe2[_0x7807('0x45')]));_0xfe8089[_0x7807('0x4d')][_0x7807('0x65')]=_0x3b3204['id'];if(_0x4a63c6[_0x7807('0x43')][_0x7807('0x4e')]){_0xfe8089[_0x7807('0x4d')]=_[_0x7807('0x4f')](_0xfe8089['where'],{'$or':_[_0x7807('0x3c')](_0xfe8089[_0x7807('0x46')],function(_0x230a85){var _0x5cc793={};_0x5cc793[_0x230a85]={'$like':'%'+_0x4a63c6[_0x7807('0x43')]['filter']+'%'};return _0x5cc793;})});}_0xfe8089=_[_0x7807('0x4f')]({},_0xfe8089,_0x4a63c6['options']);return db[_0x7807('0x66')][_0x7807('0x30')]({'where':_0xfe8089[_0x7807('0x4d')]})[_0x7807('0x20')](function(_0xb9f528){_0x612118[_0x7807('0x30')]=_0xb9f528;if(_0x4a63c6[_0x7807('0x43')][_0x7807('0x57')]){_0xfe8089[_0x7807('0x51')]=[{'all':!![]}];}return db['Disposition'][_0x7807('0x69')](_0xfe8089);})['then'](function(_0x50b958){_0x612118[_0x7807('0x52')]=_0x50b958;return _0x612118;});}})[_0x7807('0x20')](respondWithFilteredResult(_0x2c9787,_0xfe8089))[_0x7807('0x2a')](handleError(_0x2c9787,null));};exports[_0x7807('0x6a')]=function(_0x229660,_0x4e8f82,_0x51f9d2){return db[_0x7807('0x3d')][_0x7807('0x59')]({'where':{'id':_0x229660[_0x7807('0x54')]['id']}})['then'](handleEntityNotFound(_0x4e8f82,null))[_0x7807('0x20')](function(_0x2ef10f){if(_0x2ef10f){return _0x2ef10f[_0x7807('0x6a')](_0x229660[_0x7807('0x43')]['ids']);}})[_0x7807('0x20')](respondWithStatusCode(_0x4e8f82,null))[_0x7807('0x2a')](handleError(_0x4e8f82,null));};exports[_0x7807('0x6b')]=function(_0x511930,_0x3d7674,_0x41e02d){if(_0x511930[_0x7807('0x62')]['id']){delete _0x511930['body']['id'];}return db[_0x7807('0x3d')][_0x7807('0x59')]({'where':{'id':_0x511930['params']['id']}})[_0x7807('0x20')](handleEntityNotFound(_0x3d7674,null))[_0x7807('0x20')](function(_0x21c5be){if(_0x21c5be){_0x511930[_0x7807('0x62')]['ChatWebsiteId']=_0x21c5be['id'];return db['CannedAnswer'][_0x7807('0x5a')](_0x511930[_0x7807('0x62')]);}})[_0x7807('0x20')](respondWithResult(_0x3d7674,null))[_0x7807('0x2a')](handleError(_0x3d7674,null));};exports[_0x7807('0x6c')]=function(_0x30c73b,_0x107708,_0x2e9597){var _0x5125f1={'raw':![],'where':{}};var _0x4aac67={};var _0x15213c={'count':0x0,'rows':[]};return db[_0x7807('0x3d')][_0x7807('0x68')]({'where':{'id':_0x30c73b[_0x7807('0x54')]['id']}})[_0x7807('0x20')](handleEntityNotFound(_0x107708,null))[_0x7807('0x20')](function(_0x352543){if(_0x352543){_0x4aac67[_0x7807('0x42')]=_[_0x7807('0x44')](db['CannedAnswer'][_0x7807('0x3e')]);_0x4aac67['query']=_[_0x7807('0x44')](_0x30c73b['query']);_0x4aac67[_0x7807('0x45')]=_[_0x7807('0x47')](_0x4aac67[_0x7807('0x42')],_0x4aac67[_0x7807('0x43')]);_0x5125f1['attributes']=_[_0x7807('0x47')](_0x4aac67[_0x7807('0x42')],qs[_0x7807('0x56')](_0x30c73b[_0x7807('0x43')]['fields']));_0x5125f1['attributes']=_0x5125f1[_0x7807('0x46')][_0x7807('0x48')]?_0x5125f1[_0x7807('0x46')]:_0x4aac67['model'];if(!_0x30c73b[_0x7807('0x43')][_0x7807('0x49')](_0x7807('0x4a'))){_0x5125f1['limit']=qs[_0x7807('0x31')](_0x30c73b['query'][_0x7807('0x31')]);_0x5125f1['offset']=qs[_0x7807('0x2e')](_0x30c73b[_0x7807('0x43')][_0x7807('0x2e')]);}_0x5125f1[_0x7807('0x4b')]=qs['sort'](_0x30c73b[_0x7807('0x43')]['sort']);_0x5125f1[_0x7807('0x4d')]=qs[_0x7807('0x45')](_['pick'](_0x30c73b[_0x7807('0x43')],_0x4aac67[_0x7807('0x45')]));_0x5125f1[_0x7807('0x4d')]['ChatWebsiteId']=_0x352543['id'];if(_0x30c73b[_0x7807('0x43')][_0x7807('0x4e')]){_0x5125f1[_0x7807('0x4d')]=_[_0x7807('0x4f')](_0x5125f1['where'],{'$or':_[_0x7807('0x3c')](_0x5125f1[_0x7807('0x46')],function(_0x451bb5){var _0x4c0cf1={};_0x4c0cf1[_0x451bb5]={'$like':'%'+_0x30c73b[_0x7807('0x43')][_0x7807('0x4e')]+'%'};return _0x4c0cf1;})});}_0x5125f1=_[_0x7807('0x4f')]({},_0x5125f1,_0x30c73b[_0x7807('0x58')]);return db[_0x7807('0x6d')]['count']({'where':_0x5125f1['where']})['then'](function(_0x4fffd5){_0x15213c[_0x7807('0x30')]=_0x4fffd5;if(_0x30c73b[_0x7807('0x43')][_0x7807('0x57')]){_0x5125f1[_0x7807('0x51')]=[{'all':!![]}];}return db[_0x7807('0x6d')][_0x7807('0x69')](_0x5125f1);})['then'](function(_0x5305be){_0x15213c[_0x7807('0x52')]=_0x5305be;return _0x15213c;});}})[_0x7807('0x20')](respondWithFilteredResult(_0x107708,_0x5125f1))['catch'](handleError(_0x107708,null));};exports['removeAnswers']=function(_0x26000e,_0x4a2399,_0x9eb127){return db[_0x7807('0x3d')][_0x7807('0x59')]({'where':{'id':_0x26000e['params']['id']}})[_0x7807('0x20')](handleEntityNotFound(_0x4a2399,null))['then'](function(_0x3eaa1c){if(_0x3eaa1c){return _0x3eaa1c['removeAnswers'](_0x26000e['query']['ids']);}})[_0x7807('0x20')](respondWithStatusCode(_0x4a2399,null))[_0x7807('0x2a')](handleError(_0x4a2399,null));};exports[_0x7807('0x6e')]=function(_0x5bc23d,_0x51bd42,_0x235456){_0x5bc23d['body'][_0x7807('0x6f')]=_0x5bc23d[_0x7807('0x70')]['filename'];return db[_0x7807('0x3d')][_0x7807('0x59')]({'where':{'id':_0x5bc23d[_0x7807('0x54')]['id']}})['then'](handleEntityNotFound(_0x51bd42,null))[_0x7807('0x20')](saveUpdates(_0x5bc23d[_0x7807('0x62')],null))[_0x7807('0x20')](respondWithResult(_0x51bd42,null))['catch'](handleError(_0x51bd42,null));};exports[_0x7807('0x71')]=function(_0x49df9c,_0x484ff0,_0x754c94){_0x49df9c[_0x7807('0x62')][_0x7807('0x72')]=_0x49df9c[_0x7807('0x70')]['filename'];return db[_0x7807('0x3d')][_0x7807('0x59')]({'where':{'id':_0x49df9c[_0x7807('0x54')]['id']}})[_0x7807('0x20')](handleEntityNotFound(_0x484ff0,null))[_0x7807('0x20')](saveUpdates(_0x49df9c[_0x7807('0x62')],null))[_0x7807('0x20')](respondWithResult(_0x484ff0,null))['catch'](handleError(_0x484ff0,null));};exports['addCustomerAvatar']=function(_0x561817,_0x3484e9,_0x47bd58){_0x561817['body'][_0x7807('0x73')]=_0x561817[_0x7807('0x70')][_0x7807('0x74')];return db[_0x7807('0x3d')][_0x7807('0x59')]({'where':{'id':_0x561817[_0x7807('0x54')]['id']}})[_0x7807('0x20')](handleEntityNotFound(_0x3484e9,null))[_0x7807('0x20')](saveUpdates(_0x561817[_0x7807('0x62')],null))[_0x7807('0x20')](respondWithResult(_0x3484e9,null))[_0x7807('0x2a')](handleError(_0x3484e9,null));};exports[_0x7807('0x75')]=function(_0x45c31b,_0x4c04fb,_0x36aeac){_0x45c31b['body'][_0x7807('0x76')]=_0x45c31b[_0x7807('0x70')]['filename'];return db['ChatWebsite'][_0x7807('0x59')]({'where':{'id':_0x45c31b[_0x7807('0x54')]['id']}})[_0x7807('0x20')](handleEntityNotFound(_0x4c04fb,null))[_0x7807('0x20')](saveUpdates(_0x45c31b[_0x7807('0x62')],null))[_0x7807('0x20')](respondWithResult(_0x4c04fb,null))[_0x7807('0x2a')](handleError(_0x4c04fb,null));};exports[_0x7807('0x77')]=function(_0x466bdc,_0x4c7a55,_0x20f42e){var _0x153fa8=path[_0x7807('0x78')](config[_0x7807('0x79')],_0x7807('0x7a'));var _0x1d67a4={'where':{'id':_0x466bdc[_0x7807('0x54')]['id']},'attributes':['id',_0x7807('0x6f')],'raw':!![]};var _0x2348db=![];return require(_0x7807('0x18'))['getLicense']()[_0x7807('0x20')](function(_0x22ed84){if(_0x22ed84){_0x2348db=_0x22ed84['custom'];}})[_0x7807('0x20')](function(){return db[_0x7807('0x3d')]['find'](_0x1d67a4);})[_0x7807('0x20')](handleEntityNotFound(_0x4c7a55,null))['then'](function(_0x1d1163){if(_0x1d1163){if(!_[_0x7807('0x7b')](_0x1d1163[_0x7807('0x6f')])){if(fs['existsSync'](path[_0x7807('0x78')](config['root'],_0x7807('0x7c'),_0x1d1163[_0x7807('0x6f')]))&&_0x2348db){_0x153fa8=path['join'](config[_0x7807('0x79')],'server/files/images/logos/',_0x1d1163['sitepic']);}}return _0x4c7a55[_0x7807('0x7d')](_0x153fa8);}})[_0x7807('0x2a')](handleError(_0x4c7a55,null));};exports[_0x7807('0x7e')]=function(_0x206c1e,_0x41a2c1,_0x44f1da){var _0x328dbc=path[_0x7807('0x78')](config[_0x7807('0x79')],'server/files/images/avatars/default_avatar.png');var _0x1b7384={'where':{'id':_0x206c1e[_0x7807('0x54')]['id']},'attributes':['id',_0x7807('0x72')],'raw':!![]};return db[_0x7807('0x3d')]['find'](_0x1b7384)[_0x7807('0x20')](handleEntityNotFound(_0x41a2c1,null))['then'](function(_0x477236){if(_0x477236){if(!_['isNil'](_0x477236[_0x7807('0x72')])){if(fs[_0x7807('0x7f')](path[_0x7807('0x78')](config[_0x7807('0x79')],'server/files/images/avatars/',_0x477236[_0x7807('0x72')]))){_0x328dbc=path['join'](config[_0x7807('0x79')],_0x7807('0x80'),_0x477236['agentAvatar']);}}return _0x41a2c1[_0x7807('0x7d')](_0x328dbc);}})[_0x7807('0x2a')](handleError(_0x41a2c1,null));};exports[_0x7807('0x81')]=function(_0x10977a,_0x46ecea,_0x111cd2){var _0x5b70a6=path['join'](config[_0x7807('0x79')],_0x7807('0x82'));var _0xe79ddf={'where':{'id':_0x10977a[_0x7807('0x54')]['id']},'attributes':['id','customerAvatar',_0x7807('0x83')],'raw':!![]};return db['ChatWebsite']['find'](_0xe79ddf)[_0x7807('0x20')](handleEntityNotFound(_0x46ecea,null))[_0x7807('0x20')](function(_0xb211a5){if(_0xb211a5){if(!_[_0x7807('0x7b')](_0xb211a5[_0x7807('0x73')])){if(fs['existsSync'](path['join'](config[_0x7807('0x79')],_0x7807('0x80'),_0xb211a5[_0x7807('0x73')]))&&_0xb211a5['showCustomerAvatar']){_0x5b70a6=path[_0x7807('0x78')](config['root'],_0x7807('0x80'),_0xb211a5[_0x7807('0x73')]);}}return _0x46ecea[_0x7807('0x7d')](_0x5b70a6);}})[_0x7807('0x2a')](handleError(_0x46ecea,null));};exports[_0x7807('0x84')]=function(_0x2edef5,_0x12d1eb,_0x5149d0){var _0x8274bb=path[_0x7807('0x78')](config['root'],'server/files/images/avatars/system_avatar.png');var _0x5e7fcb={'where':{'id':_0x2edef5[_0x7807('0x54')]['id']},'attributes':['id',_0x7807('0x76')],'raw':!![]};return db[_0x7807('0x3d')][_0x7807('0x59')](_0x5e7fcb)[_0x7807('0x20')](handleEntityNotFound(_0x12d1eb,null))['then'](function(_0x3a88de){if(_0x3a88de){if(!_['isNil'](_0x3a88de[_0x7807('0x76')])){if(fs[_0x7807('0x7f')](path[_0x7807('0x78')](config[_0x7807('0x79')],_0x7807('0x80'),_0x3a88de[_0x7807('0x76')]))){_0x8274bb=path[_0x7807('0x78')](config['root'],_0x7807('0x80'),_0x3a88de[_0x7807('0x76')]);}}return _0x12d1eb[_0x7807('0x7d')](_0x8274bb);}})[_0x7807('0x2a')](handleError(_0x12d1eb,null));};exports['notify']=function(_0x168e6f,_0x5dac1f,_0x50c841){var _0x41843b=require(_0x7807('0x85'));var _0x307825=new _0x41843b();var _0x4fc75b=_0x307825[_0x7807('0x86')](_0x168e6f[_0x7807('0x87')][_0x7807('0x88')])['getResult']();var _0xed91ee={'body':_0x168e6f[_0x7807('0x62')],'channel':_0x7807('0x89')};var _0x1bccb1=[];var _0x56c8ff=[];var _0x55f27a={};var _0xcc2ec9=![];return db[_0x7807('0x8a')][_0x7807('0x63')]()['then'](function(_0x4a8157){if(!_0x4a8157){throw new db[(_0x7807('0x8b'))][(_0x7807('0x8c'))](_0x7807('0x8d'));}_0x1bccb1=_[_0x7807('0x8e')](_[_0x7807('0x44')](_0x4a8157),[_0x7807('0x8f'),_0x7807('0x90')]);_0x56c8ff=_[_0x7807('0x8e')](_[_0x7807('0x44')](_0x4a8157),[_0x7807('0x8f'),_0x7807('0x90'),_0x7807('0x91'),_0x7807('0x92')]);if(_0x168e6f[_0x7807('0x62')]['id']){delete _0x168e6f[_0x7807('0x62')]['id'];}if(_[_0x7807('0x7b')](_0x168e6f['body'][_0x7807('0x93')])){throw new db[(_0x7807('0x8b'))][(_0x7807('0x8c'))]('from\x20is\x20mandatory');}if(_[_0x7807('0x7b')](_0x168e6f[_0x7807('0x62')][_0x7807('0x62')])||_0x168e6f[_0x7807('0x62')][_0x7807('0x62')]===''){throw new db[(_0x7807('0x8b'))][(_0x7807('0x8c'))](_0x7807('0x94'));}if(_[_0x7807('0x7b')](_0x168e6f[_0x7807('0x62')][_0x7807('0x95')])){throw new db[(_0x7807('0x8b'))][(_0x7807('0x8c'))](_0x7807('0x96')+_0x56c8ff);}if(!_[_0x7807('0x97')](_0x56c8ff,_0x168e6f[_0x7807('0x62')][_0x7807('0x95')])){throw new db['Sequelize']['ValidationError'](_0x7807('0x98')+_0x56c8ff);}_0x55f27a[_0x168e6f[_0x7807('0x62')][_0x7807('0x95')]]=_0x168e6f[_0x7807('0x62')][_0x7807('0x93')];})[_0x7807('0x20')](function(){return db[_0x7807('0x3d')][_0x7807('0x59')]({'where':{'id':_0x168e6f[_0x7807('0x54')]['id']},'include':[{'model':db[_0x7807('0x99')],'as':_0x7807('0x9a'),'include':[{'model':db[_0x7807('0x8a')],'as':_0x7807('0x9b'),'where':_0x55f27a,'limit':0x1,'order':[[_0x7807('0x90'),'DESC']]}]},{'model':db[_0x7807('0x9c')],'as':_0x7807('0x9d')}]});})['then'](handleEntityNotFound(_0x5dac1f,null))[_0x7807('0x20')](function(_0xda7f82){if(_0xda7f82&&_0xda7f82[_0x7807('0x9a')]){_0xed91ee[_0x7807('0x9e')]=_0xda7f82;_0xed91ee['applications']=_0xda7f82[_0x7807('0x9d')];_0xed91ee[_0x7807('0x9f')]=_0xda7f82[_0x7807('0x9a')];_0xed91ee[_0x7807('0xa0')]=_['orderBy'](_0xed91ee[_0x7807('0xa0')],[_0x7807('0xa1')],[_0x7807('0xa2')]);if(_0xed91ee[_0x7807('0x9e')][_0x7807('0x9d')]){delete _0xed91ee[_0x7807('0x9e')]['Applications'];}if(_0xed91ee[_0x7807('0x9e')][_0x7807('0x9a')]&&_0xed91ee[_0x7807('0x9e')]['List']['Contacts'][_0x7807('0x48')]){return _0xed91ee[_0x7807('0x9e')][_0x7807('0x9a')][_0x7807('0x9b')][0x0];}var _0x6d8642=_['defaults'](_0x168e6f['body'],{'firstName':_0x168e6f[_0x7807('0x62')][_0x7807('0x93')],'ListId':_0xda7f82[_0x7807('0x92')]});_0x6d8642[_0x168e6f['body']['mapKey']]=_0x168e6f[_0x7807('0x62')][_0x7807('0x93')];return db[_0x7807('0x8a')][_0x7807('0x5a')](_0x6d8642,{'fields':_0x1bccb1,'raw':!![]});}})[_0x7807('0x20')](handleEntityNotFound(_0x5dac1f,null))[_0x7807('0x20')](function(_0x5c92dc){_0xed91ee[_0x7807('0xa3')]=_0x5c92dc;var _0x9bdb85=_0x168e6f[_0x7807('0x62')][_0x7807('0xa4')];if(_0x168e6f['headers'][_0x7807('0xa5')]){_0x9bdb85=_0x168e6f[_0x7807('0x87')][_0x7807('0xa5')];}else if(_0x168e6f[_0x7807('0x87')][_0x7807('0xa6')]){_0x9bdb85=_[_0x7807('0xa7')](_0x168e6f['headers'][_0x7807('0xa6')][_0x7807('0xa8')](','));}if(_0x5c92dc){var _0x5170ff={'ContactId':_0x5c92dc['id'],'ChatWebsiteId':_0x168e6f['params']['id'],'from':(_0x5c92dc['firstName']||'')+'\x20'+(_0x5c92dc[_0x7807('0xa9')]||''),'customerIp':_0x9bdb85,'customerPort':_0x168e6f[_0x7807('0x87')][_0x7807('0xaa')]?_0x168e6f[_0x7807('0x87')][_0x7807('0xaa')]:null,'referer':_0x168e6f[_0x7807('0x62')]['referer'],'browserName':_0x4fc75b[_0x7807('0xab')]['name']&&_0x4fc75b['browser'][_0x7807('0xac')]?util[_0x7807('0xad')](_0x7807('0xae'),_0x4fc75b[_0x7807('0xab')][_0x7807('0x39')],_0x4fc75b['browser'][_0x7807('0xac')]):_0x7807('0xaf'),'browserVersion':_0x4fc75b[_0x7807('0xab')][_0x7807('0xac')]||'unknown','osName':util[_0x7807('0xad')]('%s\x20%s',_0x4fc75b['os'][_0x7807('0x39')],_0x4fc75b['os'][_0x7807('0xac')]),'osVersion':_0x4fc75b['os'][_0x7807('0xac')],'deviceModel':_0x4fc75b[_0x7807('0xb0')][_0x7807('0x42')]&&_0x4fc75b['device'][_0x7807('0xb1')]?util[_0x7807('0xad')](_0x7807('0xb2'),_0x4fc75b[_0x7807('0xb0')]['model'],_0x4fc75b[_0x7807('0xb0')]['vendor'],_0x4fc75b[_0x7807('0xb0')][_0x7807('0x40')]):null,'deviceVendor':_0x4fc75b[_0x7807('0xb0')][_0x7807('0xb1')],'deviceType':_0x4fc75b[_0x7807('0xb0')]['type'],'formData':JSON['stringify'](_0x168e6f[_0x7807('0x62')])};var _0xfaa902={'ChatWebsiteId':_0x168e6f[_0x7807('0x54')]['id'],'closed':![]};if(_0x168e6f['body'][_0x7807('0xb3')]){_0xfaa902[_0x7807('0xb3')]=_0x168e6f[_0x7807('0x62')]['threadId'];return db[_0x7807('0xb4')][_0x7807('0x59')]({'where':_0xfaa902})[_0x7807('0x20')](function(_0x40ad56){if(_0x40ad56){return[_0x40ad56,![]];}_0x5170ff[_0x7807('0xb3')]=_0x168e6f[_0x7807('0x62')][_0x7807('0xb3')];_0x5170ff[_0x7807('0xb5')]=_0x168e6f['body'][_0x7807('0xb5')];return db[_0x7807('0xb4')]['create'](_0x5170ff)[_0x7807('0x20')](function(_0x5cfda4){return[_0x5cfda4,!![]];});});}_0xfaa902[_0x7807('0xb6')]=_0x5c92dc['id'];if(_0x168e6f['body']['interaction']&&_0x168e6f[_0x7807('0x62')][_0x7807('0xb7')]['id']){_0xfaa902['id']=_0x168e6f[_0x7807('0x62')]['interaction']['id'];return db['ChatInteraction'][_0x7807('0x59')]({'where':_0xfaa902})[_0x7807('0x20')](function(_0x2101d4){if(_0x2101d4){return[_0x2101d4,![]];}return db[_0x7807('0xb4')]['create'](_0x5170ff)[_0x7807('0x20')](function(_0xee3f){return[_0xee3f,!![]];});});}return db[_0x7807('0xb4')][_0x7807('0x5a')](_0x5170ff)['then'](function(_0x27ad1d){return[_0x27ad1d,!![]];});}})[_0x7807('0xb8')](function(_0x4a8446,_0x17df30){if(_0x4a8446){_0xcc2ec9=_0x17df30;if(!_0x17df30){var _0x1258f4={'from':(_0xed91ee[_0x7807('0xa3')][_0x7807('0xb9')]||'')+'\x20'+(_0xed91ee[_0x7807('0xa3')][_0x7807('0xa9')]||'')};if(_0x168e6f['body'][_0x7807('0xb3')]&&_0x168e6f[_0x7807('0x62')][_0x7807('0xba')]&&_0x168e6f[_0x7807('0x62')][_0x7807('0xb3')]!=_0x168e6f['body'][_0x7807('0xba')]){_0x1258f4[_0x7807('0xb3')]=_0x168e6f[_0x7807('0x62')]['messageId'];}return _0x4a8446[_0x7807('0x34')](_0x1258f4);}else{return _0x4a8446;}}})[_0x7807('0x20')](function(_0xbe2087){_0xed91ee[_0x7807('0xb7')]=_0xbe2087[_0x7807('0x36')]({'plain':!![]});_0xed91ee[_0x7807('0xb7')][_0x7807('0xbb')]=_0xcc2ec9;if(_0xed91ee['interaction'][_0x7807('0xbb')]){if(_0xed91ee[_0x7807('0x9e')][_0x7807('0xbc')]){_0xed91ee[_0x7807('0xa0')]['push']({'id':0x0,'priority':_0xed91ee['applications'][_0x7807('0x48')]+0x1,'app':_0x7807('0xbd'),'appdata':_0x7807('0xbe'),'interval':'*,*,*,*'});}}return db[_0x7807('0xbf')]['create']({'body':_0x168e6f[_0x7807('0x62')][_0x7807('0x62')],'ChatWebsiteId':_0x168e6f['params']['id'],'ChatInteractionId':_0xbe2087['id'],'direction':'in','ContactId':_0xed91ee[_0x7807('0xa3')]['id'],'AttachmentId':_0x168e6f['body']['AttachmentId']});})[_0x7807('0x20')](function(_0x10655e){_0xed91ee['message']=_0x10655e;if(_0xed91ee[_0x7807('0xb7')][_0x7807('0xc0')]){return db[_0x7807('0xc1')]['find']({'attributes':['id',_0x7807('0x39')],'where':{'id':_0xed91ee['interaction']['UserId']}})[_0x7807('0x20')](function(_0x33ef63){if(_0x33ef63){_0xed91ee['applications'][_0x7807('0xc2')]({'id':0x0,'priority':0x0,'app':_0x7807('0xc3'),'appdata':_0x33ef63[_0x7807('0x39')]+','+(_0xed91ee[_0x7807('0x9e')][_0x7807('0xc4')]||0xa),'interval':_0x7807('0xc5')});_0xed91ee[_0x7807('0xc6')]=!![];}return respondWithRpcPromise(_0x7807('0xc7'),_0x7807('0xc8'),_0xed91ee);});}return respondWithRpcPromise('Start',_0x7807('0xc8'),_0xed91ee);})[_0x7807('0x20')](function(_0x12665d){respondWithRpcPromise(_0x7807('0xc9'),'EventManager',{'event':'notify','message':_0x12665d},client9002);return _0x12665d;})[_0x7807('0x20')](respondWithResult(_0x5dac1f,null))[_0x7807('0x2a')](handleError(_0x5dac1f,null));};exports[_0x7807('0xca')]=function(_0x5d1ecf,_0x4b32fb,_0x2331f3){var _0x3bd54d,_0x39c9ba,_0x1a40ef;var _0x53de76=[];var _0x14c16c=[];var _0x1c1ed5={};var _0x12b80e=_0x5d1ecf[_0x7807('0xcb')]||[];var _0xf22247=[];var _0x528b00;return db[_0x7807('0x8a')]['describe']()['then'](function(_0x5dfb6b){if(!_0x5dfb6b){throw new db[(_0x7807('0x8b'))][(_0x7807('0x8c'))](_0x7807('0x8d'));}_0x14c16c=_['difference'](_[_0x7807('0x44')](_0x5dfb6b),[_0x7807('0x8f'),'updatedAt']);_0x53de76=_[_0x7807('0x8e')](_[_0x7807('0x44')](_0x5dfb6b),['createdAt',_0x7807('0x90'),'CompanyId','ListId']);if(_0x5d1ecf[_0x7807('0x62')]['id']){delete _0x5d1ecf[_0x7807('0x62')]['id'];}if(_[_0x7807('0x7b')](_0x5d1ecf[_0x7807('0x62')]['from'])){throw _0x4b32fb[_0x7807('0x2c')](0x1f4)[_0x7807('0xcc')](new db[(_0x7807('0x8b'))][(_0x7807('0x8c'))](_0x7807('0xcd')));}if(_[_0x7807('0x7b')](_0x5d1ecf['body'][_0x7807('0x62')])||_0x5d1ecf[_0x7807('0x62')][_0x7807('0x62')]===''){throw _0x4b32fb[_0x7807('0x2c')](0x1f4)[_0x7807('0xcc')](new db[(_0x7807('0x8b'))][(_0x7807('0x8c'))](_0x7807('0x94')));}if(_[_0x7807('0x7b')](_0x5d1ecf[_0x7807('0x62')]['mapKeyOffline'])){throw _0x4b32fb[_0x7807('0x2c')](0x1f4)['send'](new db['Sequelize'][(_0x7807('0x8c'))]('mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x53de76));}if(!_[_0x7807('0x97')](_0x53de76,_0x5d1ecf[_0x7807('0x62')][_0x7807('0xce')])){throw _0x4b32fb[_0x7807('0x2c')](0x1f4)[_0x7807('0xcc')](new db['Sequelize'][(_0x7807('0x8c'))](_0x7807('0xcf')+_0x53de76));}_0x1c1ed5[_0x5d1ecf[_0x7807('0x62')][_0x7807('0xce')]]=_0x5d1ecf[_0x7807('0x62')][_0x7807('0x93')];})[_0x7807('0x20')](function(){return db[_0x7807('0x3d')][_0x7807('0x59')]({'where':{'id':_0x5d1ecf[_0x7807('0x54')]['id']},'include':[{'model':db[_0x7807('0x99')],'as':'List'},{'model':db['MailAccount'],'as':_0x7807('0xd0')}]});})[_0x7807('0x20')](handleEntityNotFound(_0x4b32fb,null))[_0x7807('0x20')](function(_0x164918){if(_0x164918&&_0x164918[_0x7807('0x9a')]){_0x39c9ba=_0x164918;var _0x1379f0=_['defaults'](_0x5d1ecf['body'],{'firstName':_0x5d1ecf[_0x7807('0x62')][_0x7807('0x93')],'phone':_0x5d1ecf[_0x7807('0x62')][_0x7807('0x93')],'ListId':_0x164918['ListId']});_0x1379f0[_0x5d1ecf[_0x7807('0x62')]['mapKeyOffline']]=_0x5d1ecf[_0x7807('0x62')]['from'];return db[_0x7807('0x8a')][_0x7807('0xd1')]({'where':_0x1c1ed5,'defaults':_0x1379f0});}})[_0x7807('0xb8')](function(_0x384675){if(_0x384675){_0x1a40ef=_0x384675;var _0x290a53=fs['readFileSync'](path[_0x7807('0x78')](config['root'],_0x7807('0xd2')),_0x7807('0xd3'));var _0x12ea2a=ejs['render'](_0x290a53,{'body':_[_0x7807('0xd4')](_0x5d1ecf['body'][_0x7807('0x62')]),'bodyTitle':_0x39c9ba[_0x7807('0xd5')]});return db[_0x7807('0xd6')]['create']({'body':_0x12ea2a,'ContactId':_0x384675['id'],'ChatWebsiteId':_0x39c9ba['id']});}})[_0x7807('0x20')](function(_0x255121){_0x528b00=_0x255121;if(_0x12b80e[_0x7807('0x48')]){var _0x40b3ea=_0x12b80e[_0x7807('0x3c')](function(_0x5cfe53){return{'name':_0x5cfe53[_0x7807('0xd7')],'basename':_0x5cfe53['filename'],'type':_0x5cfe53[_0x7807('0xd8')],'ChatOfflineMessageId':_0x255121['id']};});_0xf22247=_0x40b3ea[_0x7807('0x3c')](_0x4b26e4=>{var _0x2ee04d={'filename':_0x4b26e4[_0x7807('0x39')],'path':path['join'](config[_0x7807('0x79')],'server',_0x7807('0xcb'),_0x7807('0xd9'),_0x7807('0xda'),_0x4b26e4[_0x7807('0xdb')])};return _0x2ee04d;});if(!_0x39c9ba[_0x7807('0xdc')]){return db['sequelize']['transaction'](function(_0x55fed5){return db['Attachment'][_0x7807('0xdd')](_0x40b3ea,{'transaction':_0x55fed5});});}}})[_0x7807('0x20')](function(){if(_0x528b00){_0x3bd54d=_0x528b00;return db[_0x7807('0xd0')][_0x7807('0x68')]({'where':{'active':!![]},'include':[{'model':db[_0x7807('0xde')],'as':_0x7807('0xdf'),'raw':!![]}]});}})[_0x7807('0x20')](function(_0x5bffb2){if(_0x5bffb2&&_0x5bffb2[_0x7807('0xdf')]&&_0x39c9ba['forwardOffline']&&_0x39c9ba[_0x7807('0xe0')]){var _0x2ec634={'tls':{'rejectUnauthorized':![]}};if(_0x5bffb2['Smtp'][_0x7807('0xe1')]){_0x2ec634[_0x7807('0xe1')]=_0x5bffb2[_0x7807('0xdf')][_0x7807('0xe1')];}else{_0x2ec634[_0x7807('0xe2')]=_0x5bffb2[_0x7807('0xdf')]['host'];_0x2ec634[_0x7807('0xe3')]=_0x5bffb2[_0x7807('0xdf')][_0x7807('0xe3')];_0x2ec634['secure']=_0x5bffb2[_0x7807('0xdf')][_0x7807('0xe4')];}if(_0x5bffb2['Smtp']['authentication']){_0x2ec634[_0x7807('0xe5')]={'user':_0x5bffb2[_0x7807('0xdf')][_0x7807('0x5d')],'pass':_0x5bffb2[_0x7807('0xdf')][_0x7807('0xe6')]};}return respondWithRpcPromise('SendMail',_0x7807('0xe7'),{'account':_0x2ec634,'message':{'from':util[_0x7807('0xad')](_0x7807('0xe8'),_0x5bffb2['name'],_0x5bffb2[_0x7807('0xe9')]||_0x5bffb2[_0x7807('0xdf')][_0x7807('0x5d')]),'to':_0x39c9ba[_0x7807('0xe0')],'subject':_0x39c9ba[_0x7807('0xea')],'html':_0x3bd54d[_0x7807('0x62')],'attachments':_0xf22247}},client9003)[_0x7807('0x20')](function(){return _0x3bd54d;})[_0x7807('0x2a')](function(_0x4d5f4a){console[_0x7807('0x26')](_0x4d5f4a);});}})[_0x7807('0x20')](function(){if(_0x39c9ba&&_0x39c9ba['openNewInteraction']&&_0x39c9ba[_0x7807('0xeb')]){var _0x3294dd=[];if(_0x12b80e[_0x7807('0x48')]){_0x3294dd=_0x12b80e[_0x7807('0x3c')](function(_0xc0e60a){return{'name':_0xc0e60a[_0x7807('0xd7')],'basename':_0xc0e60a[_0x7807('0x74')],'type':_0xc0e60a['mimetype'],'ChatOfflineMessageId':_0x528b00['id']};});}var _0x361a27;if(!_[_0x7807('0x7b')](_0x39c9ba[_0x7807('0xec')])){var _0x22cf8b=_[_0x7807('0x3c')](_0x5d1ecf[_0x7807('0x62')],function(_0x463737){return _0x463737;});var _0x26b6ea=_['toPairsIn'](_0x22cf8b)[0x0];var _0x3175bb=_[_0x7807('0xed')](_0x26b6ea,function(_0x35c74b){return _0x35c74b;});_0x361a27=_0x3175bb[0x1][_0x39c9ba[_0x7807('0xec')]];}var _0x69aedd={'from':_0x1a40ef[_0x7807('0xe9')],'firstName':_0x1a40ef[_0x7807('0xb9')],'lastName':_0x1a40ef['lastName'],'mapKey':_0x7807('0xe9'),'message':{'from':_0x1a40ef[_0x7807('0xe9')],'to':_0x39c9ba['MailAccount'][_0x7807('0xe9')],'cc':'','subject':_[_0x7807('0x7b')](_0x361a27)?_0x39c9ba[_0x7807('0xea')]:_0x361a27,'messageId':'','sentAt':new Date(),'attach':_0x3294dd[_0x7807('0x48')],'attachments':_0x3294dd,'originChannel':'Chat','ChatWebsiteId':_0x39c9ba['id'],'ChatOfflineMessageId':_0x3bd54d['id'],'originTo':_0x39c9ba[_0x7807('0xd0')][_0x7807('0xe9')]},'body':_0x3bd54d[_0x7807('0x62')]};var _0x81d415={'account':{'id':_0x39c9ba[_0x7807('0xeb')]},'body':_0x69aedd,'log':_0x7807('0xee')};return respondWithRpcPromise(_0x7807('0xee'),_0x7807('0xef'),_0x81d415,client9001)[_0x7807('0x20')](function(){return _0x3bd54d;})[_0x7807('0x2a')](function(_0x16e46a){console[_0x7807('0x26')](_0x16e46a);});}return;})[_0x7807('0x20')](function(){if(_0x3bd54d){return _0x3bd54d;}})['then'](respondWithResult(_0x4b32fb,null))[_0x7807('0x2a')](function(_0x115454){console[_0x7807('0x26')](_0x7807('0x2a'),_0x115454);for(var _0x22f047 of _0x12b80e){var _0x4b9603=path[_0x7807('0x78')](config[_0x7807('0x79')],_0x7807('0xf0'),_0x7807('0xcb'),_0x7807('0xd9'),_0x7807('0xda'),_0x22f047['filename']);fs_extra[_0x7807('0xf1')](_0x4b9603)['catch'](function(_0x2b4585){console[_0x7807('0x26')]('Could\x20not\x20remove\x20attachment\x20file',_0x4b9603,_0x2b4585);});}});};exports[_0x7807('0xf2')]=function(_0x31200c,_0x28932f,_0x421b3e){return db[_0x7807('0xb4')][_0x7807('0x59')]({'where':{'id':_0x31200c[_0x7807('0x54')]['id']}})['then'](handleEntityNotFound(_0x28932f,null))['then'](function(_0x6dbb67){if(_0x6dbb67){return _0x6dbb67[_0x7807('0xf2')](_0x31200c['body'][_0x7807('0xf3')],_['omit'](_0x31200c[_0x7807('0x62')],['ids','id'])||{});}})[_0x7807('0x20')](respondWithResult(_0x28932f,null))[_0x7807('0x2a')](handleError(_0x28932f,null));};exports[_0x7807('0xf4')]=function(_0x2a8e77,_0x389925,_0x497ccf){var _0x40d7c3={'raw':![],'where':{}};var _0x2e7364={};var _0x293ba9={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x7807('0x68')]({'where':{'id':_0x2a8e77[_0x7807('0x54')]['id']}})['then'](handleEntityNotFound(_0x389925,null))[_0x7807('0x20')](function(_0x28c769){if(_0x28c769){_0x2e7364[_0x7807('0x42')]=_[_0x7807('0x44')](db[_0x7807('0xb4')][_0x7807('0x3e')]);_0x2e7364[_0x7807('0x43')]=_['keys'](_0x2a8e77['query']);_0x2e7364[_0x7807('0x45')]=_[_0x7807('0x47')](_0x2e7364[_0x7807('0x42')],_0x2e7364[_0x7807('0x43')]);_0x40d7c3[_0x7807('0x46')]=_['intersection'](_0x2e7364[_0x7807('0x42')],qs['fields'](_0x2a8e77[_0x7807('0x43')][_0x7807('0x56')]));_0x40d7c3[_0x7807('0x46')]=_0x40d7c3[_0x7807('0x46')][_0x7807('0x48')]?_0x40d7c3[_0x7807('0x46')]:_0x2e7364[_0x7807('0x42')];if(!_0x2a8e77[_0x7807('0x43')][_0x7807('0x49')](_0x7807('0x4a'))){_0x40d7c3['limit']=qs[_0x7807('0x31')](_0x2a8e77[_0x7807('0x43')][_0x7807('0x31')]);_0x40d7c3[_0x7807('0x2e')]=qs['offset'](_0x2a8e77[_0x7807('0x43')][_0x7807('0x2e')]);}_0x40d7c3[_0x7807('0x4b')]=qs[_0x7807('0x4c')](_0x2a8e77[_0x7807('0x43')][_0x7807('0x4c')]);_0x40d7c3[_0x7807('0x4d')]=qs[_0x7807('0x45')](_[_0x7807('0xf5')](_0x2a8e77[_0x7807('0x43')],_0x2e7364[_0x7807('0x45')]));_0x40d7c3[_0x7807('0x4d')][_0x7807('0x65')]=_0x28c769['id'];if(_0x2a8e77[_0x7807('0x43')][_0x7807('0x4e')]){_0x40d7c3[_0x7807('0x4d')]=_[_0x7807('0x4f')](_0x40d7c3['where'],{'$or':_[_0x7807('0x3c')](_0x40d7c3[_0x7807('0x46')],function(_0x5903fc){var _0x4ef251={};_0x4ef251[_0x5903fc]={'$like':'%'+_0x2a8e77[_0x7807('0x43')][_0x7807('0x4e')]+'%'};return _0x4ef251;})});}_0x40d7c3=_['merge']({},_0x40d7c3,_0x2a8e77['options']);return db[_0x7807('0xb4')][_0x7807('0x30')]({'where':_0x40d7c3[_0x7807('0x4d')]})[_0x7807('0x20')](function(_0x156700){_0x293ba9[_0x7807('0x30')]=_0x156700;if(_0x2a8e77['query'][_0x7807('0x57')]){_0x40d7c3[_0x7807('0x51')]=[{'model':db['CmContact'],'as':_0x7807('0xf6'),'required':![]},{'model':db[_0x7807('0xc1')],'as':'Owner','attributes':[_0x7807('0x39'),_0x7807('0xf7'),'internal'],'required':![]},{'model':db[_0x7807('0xf8')],'as':_0x7807('0xf9'),'attributes':['id',_0x7807('0x39'),_0x7807('0xfa')],'where':_0x2a8e77['query'][_0x7807('0xfb')]?{'id':_0x2a8e77[_0x7807('0x43')][_0x7807('0xfb')]}:undefined,'required':_0x2a8e77[_0x7807('0x43')][_0x7807('0xfb')]?!![]:![]}];}return db['ChatInteraction'][_0x7807('0x69')](_0x40d7c3);})['then'](function(_0x4a787e){_0x293ba9[_0x7807('0x52')]=_0x4a787e;return _0x293ba9;});}})['then'](respondWithFilteredResult(_0x389925,_0x40d7c3))['catch'](handleError(_0x389925,null));};function iftimePromise(_0x19766f,_0x2c71e5){return respondWithRpcPromise(_0x7807('0xfc'),'getSnippet',{'command':_0x2c71e5[_0x7807('0xfd')]?util[_0x7807('0xad')](_0x7807('0xfe'),_0x19766f[_0x7807('0xff')],_0x2c71e5['timezone']):util[_0x7807('0xad')](_0x7807('0x100'),_0x19766f['interval'])},client9002)[_0x7807('0x20')](function(_0x354075){var _0x2cd3dd=_0x354075&&_0x354075[_0x7807('0x101')](_0x7807('0x102'))>=0x0?!![]:![];logger[_0x7807('0x21')]('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x2c71e5['id'],_0x19766f['id'],_0x19766f['interval'],_0x2cd3dd?_0x7807('0x103'):_0x7807('0x104'),_0x2c71e5['timezone']?_0x2c71e5[_0x7807('0xfd')]:'No\x20timezone');return _0x2cd3dd;})[_0x7807('0x2a')](function(_0x4e46c3){logger[_0x7807('0x26')](_0x7807('0x105'),_0x2c71e5['id'],_0x19766f['id'],_0x19766f[_0x7807('0xff')],util['inspect'](_0x4e46c3,{'showHidden':![],'depth':null}),_0x2c71e5['timezone']?_0x2c71e5[_0x7807('0xfd')]:'No\x20timezone');return![];});}exports[_0x7807('0x106')]=function(_0x46bf25,_0x496033,_0xd1a232){var _0x200d4b=0x0;var _0x358595=0x0;var _0x4aa6af=![];var _0x2ef130;var _0xfc4cbc;return db[_0x7807('0x3d')]['find']({'where':{'id':_0x46bf25['params']['id']},'include':[{'model':db[_0x7807('0x107')],'as':'Interval','include':[{'model':db[_0x7807('0x107')],'as':_0x7807('0x108'),'attributes':['id','interval'],'raw':!![]}]}]})[_0x7807('0x20')](handleEntityNotFound(_0x496033,null))[_0x7807('0x20')](function(_0x35e482){if(_0x35e482){_0x2ef130=_0x35e482;return _0x35e482[_0x7807('0x109')]({'raw':!![]});}})[_0x7807('0x20')](function(_0x472629){if(_0x2ef130){if(_0x472629){_0xfc4cbc=_0x472629;}}return require('../../config/license/util')[_0x7807('0x10a')]();})[_0x7807('0x20')](function(_0x4b6f5e){if(_0x4b6f5e){_0x358595=_0x4b6f5e[_0x7807('0x10b')];_0x4aa6af=_0x4b6f5e[_0x7807('0x10c')];}})['then'](function(){return db[_0x7807('0xb4')][_0x7807('0x30')]({'where':{'closed':![]}});})[_0x7807('0x20')](function(_0x175642){_0x200d4b=_0x175642;if(_0x358595&&_0x175642>_0x358595){return db['License'][_0x7807('0x68')]({'where':{'id':0x1}})[_0x7807('0x20')](function(_0x199df3){if(_0x199df3){_0x199df3['increment'](_0x7807('0x10d'));}});}})[_0x7807('0x20')](function(){if(_0x2ef130[_0x7807('0x107')]&&_0x2ef130[_0x7807('0x107')][_0x7807('0x108')]){var _0x131ce6=[];for(var _0x4dca26=0x0;_0x4dca26<_0x2ef130[_0x7807('0x107')]['Intervals'][_0x7807('0x48')];_0x4dca26++){var _0x3ed8ab=_0x2ef130[_0x7807('0x107')][_0x7807('0x108')][_0x4dca26]['get']({'plain':!![]});_0x131ce6['push'](iftimePromise(_0x3ed8ab,_0x2ef130));}return BPromise[_0x7807('0x10e')](_0x131ce6)[_0x7807('0x20')](function(_0x2c6ed3){return _['some'](_0x2c6ed3);});}else{return!![];}})[_0x7807('0x20')](function(_0x270b60){var _0x5a73c3=fs['readFileSync'](path[_0x7807('0x78')](config['root'],_0x7807('0x10f')),_0x7807('0xd3'));var _0x284b0c={'remote':_0x2ef130[_0x7807('0x110')],'query':querystring[_0x7807('0x25')](_[_0x7807('0x4f')](_0x2ef130['get']({'plain':!![]}),{'customerIp':_0x46bf25[_0x7807('0x87')][_0x7807('0xa6')]||_0x46bf25[_0x7807('0x87')][_0x7807('0x111')]||_0x46bf25[_0x7807('0x112')]['remoteAddress']||_0x46bf25['ip'],'referer':_0x46bf25[_0x7807('0x87')][_0x7807('0x113')],'openedInteractions':_0x200d4b,'maxInteractions':_0x358595,'virtual':_0x4aa6af[_0x7807('0x10b')],'online':_0x270b60,'custom':_0x4aa6af}))[_0x7807('0x114')](/'/g,'\x5c\x27')};_0x496033[_0x7807('0xcc')](ejs['render'](Mustache[_0x7807('0x115')](_0x5a73c3,_0x284b0c),{'proactiveActions':_0xfc4cbc,'alignment':_0x2ef130['alignment'],'verticalAlignment':_0x2ef130['verticalAlignment'],'div_color':_0x2ef130[_0x7807('0xfa')],'text_color':_0x2ef130[_0x7807('0x116')],'button_color':_0x2ef130[_0x7807('0x117')],'background_color':_0x2ef130[_0x7807('0x118')]}));})[_0x7807('0x2a')](handleError(_0x496033,null));};exports[_0x7807('0x119')]=function(_0x2c2fe9,_0x4579d1,_0x463da5){return db[_0x7807('0x3d')]['findOne']({'where':{'id':_0x2c2fe9[_0x7807('0x54')]['id']}})[_0x7807('0x20')](handleEntityNotFound(_0x4579d1,null))[_0x7807('0x20')](function(_0x41059e){if(_0x41059e){return db[_0x7807('0x11a')]['transaction'](function(_0xdf4a31){return db['ChatApplication']['destroy']({'where':{'ChatWebsiteId':_0x2c2fe9['params']['id']},'transaction':_0xdf4a31})[_0x7807('0x20')](function(_0x3ec375){var _0x2617d8=_[_0x7807('0x3c')](_0x2c2fe9['body'],function(_0x490948){_0x490948[_0x7807('0x65')]=_0x2c2fe9[_0x7807('0x54')]['id'];return _0x490948;});return db[_0x7807('0x9c')]['bulkCreate'](_0x2617d8,{'transaction':_0xdf4a31});});})['then'](function(){return db[_0x7807('0x9c')]['findAndCountAll']({'where':{'ChatWebsiteId':_0x2c2fe9[_0x7807('0x54')]['id']},'order':_0x7807('0xa1')});});}})['then'](respondWithResult(_0x4579d1,null))['catch'](handleError(_0x4579d1,null));};exports[_0x7807('0x11b')]=function(_0x204187,_0x3d2a5f,_0x1c5dcc){var _0x496c1b={};var _0x2e4a04={};var _0x192700;var _0x55f562;return db['ChatWebsite'][_0x7807('0x68')]({'where':{'id':_0x204187[_0x7807('0x54')]['id']}})['then'](handleEntityNotFound(_0x3d2a5f,null))['then'](function(_0x2771f8){if(_0x2771f8){_0x192700=_0x2771f8;_0x2e4a04['model']=_[_0x7807('0x44')](db['ChatApplication'][_0x7807('0x3e')]);_0x2e4a04['query']=_[_0x7807('0x44')](_0x204187[_0x7807('0x43')]);_0x2e4a04[_0x7807('0x45')]=_[_0x7807('0x47')](_0x2e4a04[_0x7807('0x42')],_0x2e4a04[_0x7807('0x43')]);_0x496c1b['attributes']=_[_0x7807('0x47')](_0x2e4a04[_0x7807('0x42')],qs['fields'](_0x204187[_0x7807('0x43')]['fields']));_0x496c1b['attributes']=_0x496c1b['attributes'][_0x7807('0x48')]?_0x496c1b[_0x7807('0x46')]:_0x2e4a04['model'];_0x496c1b[_0x7807('0x4b')]=qs[_0x7807('0x4c')](_0x204187['query'][_0x7807('0x4c')]);_0x496c1b['where']=qs[_0x7807('0x45')](_[_0x7807('0xf5')](_0x204187['query'],_0x2e4a04[_0x7807('0x45')]));if(_0x204187[_0x7807('0x43')][_0x7807('0x4e')]){_0x496c1b[_0x7807('0x4d')]=_[_0x7807('0x4f')](_0x496c1b[_0x7807('0x4d')],{'$or':_[_0x7807('0x3c')](_0x496c1b[_0x7807('0x46')],function(_0x464a57){var _0x54430f={};_0x54430f[_0x464a57]={'$like':'%'+_0x204187[_0x7807('0x43')][_0x7807('0x4e')]+'%'};return _0x54430f;})});}_0x496c1b=_[_0x7807('0x4f')]({},_0x496c1b,_0x204187[_0x7807('0x58')]);return _0x192700['getApplications'](_0x496c1b);}})['then'](function(_0x13a885){if(_0x13a885){_0x55f562=_0x13a885[_0x7807('0x48')];if(!_0x204187[_0x7807('0x43')][_0x7807('0x49')](_0x7807('0x4a'))){_0x496c1b[_0x7807('0x31')]=qs['limit'](_0x204187[_0x7807('0x43')]['limit']);_0x496c1b[_0x7807('0x2e')]=qs[_0x7807('0x2e')](_0x204187['query'][_0x7807('0x2e')]);}return _0x192700[_0x7807('0x11b')](_0x496c1b);}})[_0x7807('0x20')](function(_0x39cc38){if(_0x39cc38){return _0x39cc38?{'count':_0x55f562,'rows':_0x39cc38}:null;}})['then'](respondWithResult(_0x3d2a5f,null))[_0x7807('0x2a')](handleError(_0x3d2a5f,null));};exports[_0x7807('0x11c')]=function(_0x11ccce,_0x28171f,_0x1e2b64){return db[_0x7807('0x11d')]['find']({'where':{'id':_0x11ccce[_0x7807('0x54')]['id']}})[_0x7807('0x20')](handleEntityNotFound(_0x28171f,null))[_0x7807('0x20')](function(_0x2ba039){if(_0x2ba039){return _0x2ba039[_0x7807('0x11c')](_0x11ccce[_0x7807('0x62')][_0x7807('0xf3')],_[_0x7807('0x11e')](_0x11ccce[_0x7807('0x62')],[_0x7807('0xf3'),'id'])||{});}})['then'](respondWithResult(_0x28171f,null))['catch'](handleError(_0x28171f,null));};exports[_0x7807('0x109')]=function(_0x45629b,_0x248033,_0x54fe6d){var _0x12a905={};var _0x523e56={};var _0x50b3bf;var _0x272fbc;return db[_0x7807('0x3d')]['findOne']({'where':{'id':_0x45629b[_0x7807('0x54')]['id']}})[_0x7807('0x20')](handleEntityNotFound(_0x248033,null))[_0x7807('0x20')](function(_0x4f7d87){if(_0x4f7d87){_0x50b3bf=_0x4f7d87;_0x523e56[_0x7807('0x42')]=_[_0x7807('0x44')](db[_0x7807('0x11f')]['rawAttributes']);_0x523e56[_0x7807('0x43')]=_[_0x7807('0x44')](_0x45629b[_0x7807('0x43')]);_0x523e56[_0x7807('0x45')]=_['intersection'](_0x523e56[_0x7807('0x42')],_0x523e56[_0x7807('0x43')]);_0x12a905[_0x7807('0x46')]=_[_0x7807('0x47')](_0x523e56[_0x7807('0x42')],qs['fields'](_0x45629b[_0x7807('0x43')][_0x7807('0x56')]));_0x12a905[_0x7807('0x46')]=_0x12a905[_0x7807('0x46')][_0x7807('0x48')]?_0x12a905[_0x7807('0x46')]:_0x523e56[_0x7807('0x42')];_0x12a905[_0x7807('0x4b')]=qs[_0x7807('0x4c')](_0x45629b['query'][_0x7807('0x4c')]);_0x12a905['where']=qs[_0x7807('0x45')](_[_0x7807('0xf5')](_0x45629b['query'],_0x523e56[_0x7807('0x45')]));if(_0x45629b[_0x7807('0x43')][_0x7807('0x4e')]){_0x12a905[_0x7807('0x4d')]=_[_0x7807('0x4f')](_0x12a905[_0x7807('0x4d')],{'$or':_[_0x7807('0x3c')](_0x12a905[_0x7807('0x46')],function(_0x495f5a){var _0x4e116d={};_0x4e116d[_0x495f5a]={'$like':'%'+_0x45629b[_0x7807('0x43')][_0x7807('0x4e')]+'%'};return _0x4e116d;})});}_0x12a905=_['merge']({},_0x12a905,_0x45629b[_0x7807('0x58')]);return _0x50b3bf[_0x7807('0x109')](_0x12a905);}})[_0x7807('0x20')](function(_0x4ac976){if(_0x4ac976){_0x272fbc=_0x4ac976['length'];if(!_0x45629b[_0x7807('0x43')][_0x7807('0x49')](_0x7807('0x4a'))){_0x12a905[_0x7807('0x31')]=qs[_0x7807('0x31')](_0x45629b['query'][_0x7807('0x31')]);_0x12a905[_0x7807('0x2e')]=qs[_0x7807('0x2e')](_0x45629b[_0x7807('0x43')][_0x7807('0x2e')]);}return _0x50b3bf['getProactiveActions'](_0x12a905);}})[_0x7807('0x20')](function(_0x38bd63){if(_0x38bd63){return _0x38bd63?{'count':_0x272fbc,'rows':_0x38bd63}:null;}})[_0x7807('0x20')](respondWithResult(_0x248033,null))[_0x7807('0x2a')](handleError(_0x248033,null));};exports[_0x7807('0x120')]=function(_0x8946fc,_0x1a4db9,_0x24d65){var _0x596367=_0x8946fc[_0x7807('0x43')][_0x7807('0x121')]===_0x7807('0x122')?'offlineForm':_0x7807('0x123');return db[_0x7807('0x3d')]['find']({'attributes':['id',_0x596367],'where':{'id':_0x8946fc[_0x7807('0x54')]['id']}})[_0x7807('0x20')](handleEntityNotFound(_0x1a4db9,null))[_0x7807('0x20')](function(_0x5420a7){if(_0x5420a7){var _0x366ff5=_0x5420a7[_0x596367];var _0x11a7c2=_0x366ff5&&_0x366ff5[_0x7807('0x124')]?_0x366ff5[_0x7807('0x124')]:[];_0x1a4db9['send']({'fromKey':_[_0x7807('0x7b')](_0x366ff5[_0x7807('0x125')])?undefined:_0x366ff5[_0x7807('0x125')],'count':_0x11a7c2[_0x7807('0x48')],'rows':_0x11a7c2});}})[_0x7807('0x2a')](handleError(_0x1a4db9,null));};exports['getOfflineMessages']=function(_0x3cc018,_0x349aa4,_0x2bf36d){var _0x502e17={'raw':![],'where':{}};var _0x2f3e52={};var _0x6fffc4={'count':0x0,'rows':[]};return db[_0x7807('0x3d')][_0x7807('0x68')]({'where':{'id':_0x3cc018['params']['id']}})[_0x7807('0x20')](handleEntityNotFound(_0x349aa4,null))['then'](function(_0x271986){if(_0x271986){_0x2f3e52[_0x7807('0x42')]=_[_0x7807('0x44')](db[_0x7807('0xd6')][_0x7807('0x3e')]);_0x2f3e52['query']=_[_0x7807('0x44')](_0x3cc018[_0x7807('0x43')]);_0x2f3e52[_0x7807('0x45')]=_[_0x7807('0x47')](_0x2f3e52[_0x7807('0x42')],_0x2f3e52[_0x7807('0x43')]);_0x502e17[_0x7807('0x46')]=_[_0x7807('0x47')](_0x2f3e52[_0x7807('0x42')],qs[_0x7807('0x56')](_0x3cc018['query']['fields']));_0x502e17[_0x7807('0x46')]=_0x502e17['attributes']['length']?_0x502e17[_0x7807('0x46')]:_0x2f3e52[_0x7807('0x42')];if(!_0x3cc018[_0x7807('0x43')]['hasOwnProperty']('nolimit')){_0x502e17[_0x7807('0x31')]=qs[_0x7807('0x31')](_0x3cc018['query'][_0x7807('0x31')]);_0x502e17[_0x7807('0x2e')]=qs['offset'](_0x3cc018['query'][_0x7807('0x2e')]);}_0x502e17['order']=qs['sort'](_0x3cc018['query'][_0x7807('0x4c')]);_0x502e17[_0x7807('0x4d')]=qs[_0x7807('0x45')](_[_0x7807('0xf5')](_0x3cc018[_0x7807('0x43')],_0x2f3e52['filters']));_0x502e17[_0x7807('0x4d')]['ChatWebsiteId']=_0x271986['id'];if(_0x3cc018['query'][_0x7807('0x4e')]){_0x502e17[_0x7807('0x4d')]=_[_0x7807('0x4f')](_0x502e17[_0x7807('0x4d')],{'$or':_[_0x7807('0x3c')](_0x502e17['attributes'],function(_0x41943f){var _0x485b05={};_0x485b05[_0x41943f]={'$like':'%'+_0x3cc018[_0x7807('0x43')][_0x7807('0x4e')]+'%'};return _0x485b05;})});}_0x502e17=_[_0x7807('0x4f')]({},_0x502e17,_0x3cc018[_0x7807('0x58')]);return db[_0x7807('0xd6')][_0x7807('0x30')]({'where':_0x502e17[_0x7807('0x4d')]})['then'](function(_0x178e51){_0x6fffc4[_0x7807('0x30')]=_0x178e51;if(_0x3cc018[_0x7807('0x43')][_0x7807('0x57')]){_0x502e17['include']=[{'all':!![]}];}else{_0x502e17['include']=[{'model':db['CmContact'],'as':_0x7807('0xf6'),'required':![]},{'model':db[_0x7807('0x126')],'as':'Attachments','required':![]}];}return db[_0x7807('0xd6')][_0x7807('0x69')](_0x502e17);})['then'](function(_0x28c36f){_0x6fffc4[_0x7807('0x52')]=_0x28c36f;return _0x6fffc4;});}})['then'](respondWithFilteredResult(_0x349aa4,_0x502e17))[_0x7807('0x2a')](handleError(_0x349aa4,null));};exports[_0x7807('0x127')]=function(_0x37feef,_0x1e4c81,_0x34f12b){return db['ChatWebsite']['find']({'where':{'id':_0x37feef[_0x7807('0x54')]['id']}})[_0x7807('0x20')](handleEntityNotFound(_0x1e4c81,null))[_0x7807('0x20')](function(_0x4ee302){if(_0x4ee302){return _0x4ee302[_0x7807('0x127')](_0x37feef[_0x7807('0x62')][_0x7807('0xf3')],_[_0x7807('0x11e')](_0x37feef[_0x7807('0x62')],[_0x7807('0xf3'),'id'])||{})[_0x7807('0xb8')](function(_0xdfacbc){for(var _0xae87c2=0x0;_0xae87c2<_0x37feef[_0x7807('0x62')][_0x7807('0xf3')][_0x7807('0x48')];_0xae87c2+=0x1){socket[_0x7807('0x128')](_0x7807('0x129'),{'UserId':_0x37feef[_0x7807('0x62')][_0x7807('0xf3')][_0xae87c2],'ChatWebsiteId':_0x37feef['params']['id']});}return _0xdfacbc;});}})[_0x7807('0x20')](respondWithResult(_0x1e4c81,null))[_0x7807('0x2a')](handleError(_0x1e4c81,null));};exports[_0x7807('0x12a')]=function(_0x344e91,_0x197554,_0x16b127){return db[_0x7807('0x3d')][_0x7807('0x59')]({'where':{'id':_0x344e91[_0x7807('0x54')]['id']}})[_0x7807('0x20')](handleEntityNotFound(_0x197554,null))[_0x7807('0x20')](function(_0x516df7){if(_0x516df7){return _0x516df7[_0x7807('0x12a')](_0x344e91[_0x7807('0x43')][_0x7807('0xf3')])[_0x7807('0x20')](function(){if(_[_0x7807('0x12b')](_0x344e91[_0x7807('0x43')][_0x7807('0xf3')])){for(var _0x4122f9=0x0;_0x4122f9<_0x344e91[_0x7807('0x43')][_0x7807('0xf3')][_0x7807('0x48')];_0x4122f9+=0x1){socket[_0x7807('0x128')]('userChatWebsite:remove',{'UserId':Number(_0x344e91[_0x7807('0x43')][_0x7807('0xf3')][_0x4122f9]),'ChatWebsiteId':Number(_0x344e91[_0x7807('0x54')]['id'])});}}else{socket['emit'](_0x7807('0x12c'),{'UserId':Number(_0x344e91[_0x7807('0x43')]['ids']),'ChatWebsiteId':Number(_0x344e91[_0x7807('0x54')]['id'])});}});}})[_0x7807('0x20')](respondWithStatusCode(_0x197554,null))[_0x7807('0x2a')](handleError(_0x197554,null));};exports[_0x7807('0x12d')]=function(_0x3a433f,_0x2a9a66,_0x3219d5){var _0x16ca0d={};var _0x476779={};var _0x47d092;var _0x339577;return db['ChatWebsite'][_0x7807('0x68')]({'where':{'id':_0x3a433f['params']['id']}})[_0x7807('0x20')](handleEntityNotFound(_0x2a9a66,null))['then'](function(_0x4a3d69){if(_0x4a3d69){_0x47d092=_0x4a3d69;_0x476779[_0x7807('0x42')]=_[_0x7807('0x44')](db[_0x7807('0xc1')][_0x7807('0x3e')]);_0x476779[_0x7807('0x43')]=_[_0x7807('0x44')](_0x3a433f[_0x7807('0x43')]);_0x476779[_0x7807('0x45')]=_[_0x7807('0x47')](_0x476779['model'],_0x476779[_0x7807('0x43')]);_0x16ca0d['attributes']=_[_0x7807('0x47')](_0x476779[_0x7807('0x42')],qs[_0x7807('0x56')](_0x3a433f['query']['fields']));_0x16ca0d[_0x7807('0x46')]=_0x16ca0d[_0x7807('0x46')][_0x7807('0x48')]?_0x16ca0d[_0x7807('0x46')]:_0x476779[_0x7807('0x42')];_0x16ca0d[_0x7807('0x4b')]=qs['sort'](_0x3a433f['query']['sort']);_0x16ca0d[_0x7807('0x4d')]=qs[_0x7807('0x45')](_['pick'](_0x3a433f[_0x7807('0x43')],_0x476779['filters']));if(_0x3a433f[_0x7807('0x43')][_0x7807('0x4e')]){_0x16ca0d[_0x7807('0x4d')]=_[_0x7807('0x4f')](_0x16ca0d[_0x7807('0x4d')],{'$or':_[_0x7807('0x3c')](_0x16ca0d[_0x7807('0x46')],function(_0x27a6a8){var _0x38021f={};_0x38021f[_0x27a6a8]={'$like':'%'+_0x3a433f['query'][_0x7807('0x4e')]+'%'};return _0x38021f;})});}_0x16ca0d=_['merge']({},_0x16ca0d,_0x3a433f['options']);return _0x47d092['getAgents'](_0x16ca0d);}})[_0x7807('0x20')](function(_0x559be0){if(_0x559be0){_0x339577=_0x559be0[_0x7807('0x48')];if(!_0x3a433f['query']['hasOwnProperty'](_0x7807('0x4a'))){_0x16ca0d[_0x7807('0x31')]=qs['limit'](_0x3a433f[_0x7807('0x43')][_0x7807('0x31')]);_0x16ca0d[_0x7807('0x2e')]=qs[_0x7807('0x2e')](_0x3a433f['query']['offset']);}return _0x47d092[_0x7807('0x12d')](_0x16ca0d);}})[_0x7807('0x20')](function(_0x3ff92d){if(_0x3ff92d){return _0x3ff92d?{'count':_0x339577,'rows':_0x3ff92d}:null;}})[_0x7807('0x20')](respondWithResult(_0x2a9a66,null))[_0x7807('0x2a')](handleError(_0x2a9a66,null));}; \ No newline at end of file +var _0x9a14=['replace','render','alignment','verticalAlignment','color_button','backgroundColor','addApplications','findAndCountAll','getApplications','chatProactiveAction','addProactiveActions','ChatProactiveAction','getFields','online','false','offlineForm','onlineForm','items','fromKey','getOfflineMessages','ChatOfflineMessage','addAgents','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','register','jayson/promise','client','http','info','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','ChatWebsite,\x20%s,\x20%s','message','catch','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','get','ChatWebsites','UserProfileResource','destroy','end','stack','name','index','mandatoryDispositionPause','map','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','ChatWebsite','findAll','rows','show','params','Pause','includeAll','include','merge','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','ChatWebsiteId','Disposition','getDispositions','findOne','removeDispositions','ids','CannedAnswer','removeAnswers','addLogo','sitepic','file','filename','addAvatar','agentAvatar','customerAvatar','addSystemAvatar','systemAvatar','join','root','server/files/images/logos/default_logo.svg','server/files/images/logos/','download','server/files/images/avatars/default_avatar.png','isNil','existsSync','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','notify','setUA','headers','user-agent','getResult','chat','Sequelize','ValidationError','updatedAt','createdAt','CompanyId','ListId','from','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','List','CmContact','Contacts','DESC','ChatApplication','Applications','account','applications','list','orderBy','priority','asc','contact','cf-connecting-ip','x-forwarded-for','first','split','lastName','x-real-port','referer','browser','version','format','%s\x20%s','unknown','device','vendor','%s\x20%s\x20%s','threadId','externalUrl','ChatInteraction','ContactId','interaction','spread','firstName','messageId','created','autoclose','push','close','unmanaged','ChatMessage','AttachmentId','User','UserId','unshift','*,*,*,*','forcedOwnership','Start','startRouting','EventManager','files','no\x20available\x20attributes','difference','send','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','findOrCreate','readFileSync','utf8','offlineMessageBody','originalname','mimetype','server','basename','openNewInteraction','sequelize','transaction','Attachment','bulkCreate','MailServerOut','Smtp','forwardOffline','service','host','port','secure','authentication','auth','pass','SendMail','\x22%s\x22\x20<%s>','forwardOfflineAddress','MailAccountId','subjectOffline','toPairsIn','email','offlineMessageSubject','Chat','NotifyMailAccount','attachments','offline-chat','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','getInteractions','Contact','Owner','fullname','internal','Tag','Tags','color','tag','getSnippet','timezone','iftime\x20%s,%s','interval','iftime\x20%s','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','OFFLINE','inspect','Interval','getProactiveActions','custom','increment','Intervals','server/files/chat/iframe.ejs','remote','x-real-ip','connection','remoteAddress','virtual'];(function(_0x584dbc,_0x1640ca){var _0x4d51ec=function(_0x7a8bcc){while(--_0x7a8bcc){_0x584dbc['push'](_0x584dbc['shift']());}};_0x4d51ec(++_0x1640ca);}(_0x9a14,0x153));var _0x49a1=function(_0x3467be,_0x39877b){_0x3467be=_0x3467be-0x0;var _0x2bd46c=_0x9a14[_0x3467be];return _0x2bd46c;};'use strict';var emlformat=require(_0x49a1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x49a1('0x1'));var jsonpatch=require(_0x49a1('0x2'));var rp=require(_0x49a1('0x3'));var moment=require(_0x49a1('0x4'));var BPromise=require(_0x49a1('0x5'));var Mustache=require(_0x49a1('0x6'));var util=require(_0x49a1('0x7'));var path=require(_0x49a1('0x8'));var sox=require(_0x49a1('0x9'));var csv=require(_0x49a1('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x49a1('0xb'));var _=require('lodash');var squel=require(_0x49a1('0xc'));var crypto=require(_0x49a1('0xd'));var jsforce=require(_0x49a1('0xe'));var deskjs=require(_0x49a1('0xf'));var toCsv=require(_0x49a1('0xa'));var querystring=require(_0x49a1('0x10'));var Papa=require(_0x49a1('0x11'));var Redis=require(_0x49a1('0x12'));var authService=require(_0x49a1('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x49a1('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x49a1('0x15'))(_0x49a1('0x16'));var utils=require(_0x49a1('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x49a1('0x18'));var db=require('../../mysqldb')['db'];config[_0x49a1('0x19')]=_[_0x49a1('0x1a')](config[_0x49a1('0x19')],{'host':_0x49a1('0x1b'),'port':0x18eb});var socket=require(_0x49a1('0x1c'))(new Redis(config[_0x49a1('0x19')]));require(_0x49a1('0x1d'))[_0x49a1('0x1e')](socket);var jayson=require(_0x49a1('0x1f'));var client=jayson[_0x49a1('0x20')]['http']({'port':0x232c});var client9002=jayson[_0x49a1('0x20')][_0x49a1('0x21')]({'port':0x232a});var client9003=jayson[_0x49a1('0x20')][_0x49a1('0x21')]({'port':0x232b});var client9001=jayson['client'][_0x49a1('0x21')]({'port':0x2329});function respondWithRpcPromise(_0xd3bd61,_0x58da1b,_0x3e7904,_0x3378c0){return new BPromise(function(_0x13cf47,_0x4b2943){var _0x235bd7=_0x3378c0||client;return _0x235bd7['request'](_0xd3bd61,_0x3e7904)['then'](function(_0x1f79dc){logger[_0x49a1('0x22')]('ChatWebsite,\x20%s,\x20%s',_0x58da1b,'request\x20sent');logger[_0x49a1('0x23')](_0x49a1('0x24'),_0x58da1b,_0x49a1('0x25'),JSON[_0x49a1('0x26')](_0x1f79dc));if(_0x1f79dc['error']){if(_0x1f79dc[_0x49a1('0x27')][_0x49a1('0x28')]===0x1f4){logger[_0x49a1('0x27')](_0x49a1('0x29'),_0x58da1b,_0x1f79dc[_0x49a1('0x27')]['message']);return _0x4b2943(_0x1f79dc['error'][_0x49a1('0x2a')]);}logger['error'](_0x49a1('0x29'),_0x58da1b,_0x1f79dc[_0x49a1('0x27')]['message']);return _0x13cf47(_0x1f79dc[_0x49a1('0x27')][_0x49a1('0x2a')]);}else{logger[_0x49a1('0x22')](_0x49a1('0x29'),_0x58da1b,_0x49a1('0x25'));_0x13cf47(_0x1f79dc['result'][_0x49a1('0x2a')]);}})[_0x49a1('0x2b')](function(_0x487d3b){logger[_0x49a1('0x27')](_0x49a1('0x29'),_0x58da1b,_0x487d3b);_0x4b2943(_0x487d3b);});});}function respondWithStatusCode(_0x21411a,_0x269878){_0x269878=_0x269878||0xcc;return function(_0x8ddc7c){if(_0x8ddc7c){return _0x21411a[_0x49a1('0x2c')](_0x269878);}return _0x21411a[_0x49a1('0x2d')](_0x269878)['end']();};}function respondWithResult(_0x348e6f,_0x1027d8){_0x1027d8=_0x1027d8||0xc8;return function(_0x4d395e){if(_0x4d395e){return _0x348e6f['status'](_0x1027d8)[_0x49a1('0x2e')](_0x4d395e);}};}function respondWithFilteredResult(_0x1cd9b6,_0x33b120){return function(_0x1176b4){if(_0x1176b4){var _0x5efc45=typeof _0x33b120[_0x49a1('0x2f')]===_0x49a1('0x30')&&typeof _0x33b120[_0x49a1('0x31')]===_0x49a1('0x30');var _0x39677e=_0x1176b4['count'];var _0x46129e=_0x5efc45?0x0:_0x33b120[_0x49a1('0x2f')];var _0x190107=_0x5efc45?_0x1176b4[_0x49a1('0x32')]:_0x33b120[_0x49a1('0x2f')]+_0x33b120[_0x49a1('0x31')];var _0x598b2c;if(_0x190107>=_0x39677e){_0x190107=_0x39677e;_0x598b2c=0xc8;}else{_0x598b2c=0xce;}_0x1cd9b6[_0x49a1('0x2d')](_0x598b2c);return _0x1cd9b6[_0x49a1('0x33')](_0x49a1('0x34'),_0x46129e+'-'+_0x190107+'/'+_0x39677e)[_0x49a1('0x2e')](_0x1176b4);}return null;};}function patchUpdates(_0x171714){return function(_0x410614){try{jsonpatch['apply'](_0x410614,_0x171714,!![]);}catch(_0x917735){return BPromise[_0x49a1('0x35')](_0x917735);}return _0x410614[_0x49a1('0x36')]();};}function saveUpdates(_0x2458ae,_0x478a84){return function(_0x2eb29e){if(_0x2eb29e){return _0x2eb29e[_0x49a1('0x37')](_0x2458ae)[_0x49a1('0x38')](function(_0x2cb49b){return _0x2cb49b;});}return null;};}function removeEntity(_0x15c757,_0x51cce8){return function(_0x1322a2){if(_0x1322a2){return _0x1322a2['destroy']()['then'](function(){var _0x40b4c4=_0x1322a2[_0x49a1('0x39')]({'plain':!![]});var _0xa2cbda=_0x49a1('0x3a');return db[_0x49a1('0x3b')][_0x49a1('0x3c')]({'where':{'type':_0xa2cbda,'resourceId':_0x40b4c4['id']}})[_0x49a1('0x38')](function(){return _0x1322a2;});})[_0x49a1('0x38')](function(){_0x15c757[_0x49a1('0x2d')](0xcc)[_0x49a1('0x3d')]();});}};}function handleEntityNotFound(_0x3ef6b2,_0x261abe){return function(_0x527c4f){if(!_0x527c4f){_0x3ef6b2[_0x49a1('0x2c')](0x194);}return _0x527c4f;};}function handleError(_0x24076e,_0x31bcc8){_0x31bcc8=_0x31bcc8||0x1f4;return function(_0x486ef5){logger[_0x49a1('0x27')](_0x486ef5[_0x49a1('0x3e')]);if(_0x486ef5[_0x49a1('0x3f')]){delete _0x486ef5[_0x49a1('0x3f')];}_0x24076e[_0x49a1('0x2d')](_0x31bcc8)['send'](_0x486ef5);};}exports[_0x49a1('0x40')]=function(_0x22d1f3,_0x52bc2a){var _0x24da09={'include':[{'model':db['Pause'],'as':_0x49a1('0x41')}]},_0x4946a8={},_0x367c2c={'count':0x0,'rows':[]};var _0xd8c28c=_[_0x49a1('0x42')](db['ChatWebsite'][_0x49a1('0x43')],function(_0x4b845b){return{'name':_0x4b845b[_0x49a1('0x44')],'type':_0x4b845b[_0x49a1('0x45')]['key']};});_0x4946a8[_0x49a1('0x46')]=_[_0x49a1('0x42')](_0xd8c28c,_0x49a1('0x3f'));_0x4946a8['query']=_[_0x49a1('0x47')](_0x22d1f3[_0x49a1('0x48')]);_0x4946a8[_0x49a1('0x49')]=_[_0x49a1('0x4a')](_0x4946a8[_0x49a1('0x46')],_0x4946a8[_0x49a1('0x48')]);_0x24da09[_0x49a1('0x4b')]=_[_0x49a1('0x4a')](_0x4946a8[_0x49a1('0x46')],qs[_0x49a1('0x4c')](_0x22d1f3[_0x49a1('0x48')][_0x49a1('0x4c')]));_0x24da09[_0x49a1('0x4b')]=_0x24da09[_0x49a1('0x4b')][_0x49a1('0x4d')]?_0x24da09['attributes']:_0x4946a8[_0x49a1('0x46')];if(!_0x22d1f3[_0x49a1('0x48')][_0x49a1('0x4e')](_0x49a1('0x4f'))){_0x24da09['limit']=qs[_0x49a1('0x31')](_0x22d1f3[_0x49a1('0x48')]['limit']);_0x24da09['offset']=qs[_0x49a1('0x2f')](_0x22d1f3[_0x49a1('0x48')][_0x49a1('0x2f')]);}_0x24da09[_0x49a1('0x50')]=qs['sort'](_0x22d1f3[_0x49a1('0x48')][_0x49a1('0x51')]);_0x24da09[_0x49a1('0x52')]=qs[_0x49a1('0x49')](_[_0x49a1('0x53')](_0x22d1f3[_0x49a1('0x48')],_0x4946a8[_0x49a1('0x49')]),_0xd8c28c);if(_0x22d1f3[_0x49a1('0x48')][_0x49a1('0x54')]){_0x24da09[_0x49a1('0x52')]=_['merge'](_0x24da09[_0x49a1('0x52')],{'$or':_[_0x49a1('0x42')](_0xd8c28c,function(_0x404716){if(_0x404716['type']!==_0x49a1('0x55')){var _0x54081d={};_0x54081d[_0x404716[_0x49a1('0x3f')]]={'$like':'%'+_0x22d1f3[_0x49a1('0x48')][_0x49a1('0x54')]+'%'};return _0x54081d;}})});}_0x24da09=_['merge']({},_0x24da09,_0x22d1f3[_0x49a1('0x56')]);var _0x431fd3={'where':_0x24da09[_0x49a1('0x52')]};return db[_0x49a1('0x57')][_0x49a1('0x32')](_0x431fd3)[_0x49a1('0x38')](function(_0x5459cf){_0x367c2c[_0x49a1('0x32')]=_0x5459cf;if(_0x22d1f3[_0x49a1('0x48')]['includeAll']){_0x24da09['include']=[{'all':!![]}];}return db[_0x49a1('0x57')][_0x49a1('0x58')](_0x24da09);})[_0x49a1('0x38')](function(_0x56a7b4){_0x367c2c[_0x49a1('0x59')]=_0x56a7b4;return _0x367c2c;})[_0x49a1('0x38')](respondWithFilteredResult(_0x52bc2a,_0x24da09))[_0x49a1('0x2b')](handleError(_0x52bc2a,null));};exports[_0x49a1('0x5a')]=function(_0xd9ac2f,_0x47ddff){var _0x541b4e={'raw':![],'where':{'id':_0xd9ac2f[_0x49a1('0x5b')]['id']},'include':[{'model':db[_0x49a1('0x5c')],'as':_0x49a1('0x41')}]},_0x165a9a={};_0x165a9a[_0x49a1('0x46')]=_[_0x49a1('0x47')](db[_0x49a1('0x57')][_0x49a1('0x43')]);_0x165a9a['query']=_[_0x49a1('0x47')](_0xd9ac2f['query']);_0x165a9a['filters']=_[_0x49a1('0x4a')](_0x165a9a[_0x49a1('0x46')],_0x165a9a[_0x49a1('0x48')]);_0x541b4e[_0x49a1('0x4b')]=_['intersection'](_0x165a9a['model'],qs[_0x49a1('0x4c')](_0xd9ac2f[_0x49a1('0x48')]['fields']));_0x541b4e[_0x49a1('0x4b')]=_0x541b4e['attributes'][_0x49a1('0x4d')]?_0x541b4e[_0x49a1('0x4b')]:_0x165a9a[_0x49a1('0x46')];if(_0xd9ac2f[_0x49a1('0x48')][_0x49a1('0x5d')]){_0x541b4e[_0x49a1('0x5e')]=[{'all':!![]}];}_0x541b4e=_[_0x49a1('0x5f')]({},_0x541b4e,_0xd9ac2f['options']);return db[_0x49a1('0x57')][_0x49a1('0x60')](_0x541b4e)[_0x49a1('0x38')](handleEntityNotFound(_0x47ddff,null))[_0x49a1('0x38')](respondWithResult(_0x47ddff,null))[_0x49a1('0x2b')](handleError(_0x47ddff,null));};exports['create']=function(_0x45d56f,_0x2d1527){return db['ChatWebsite'][_0x49a1('0x61')](_0x45d56f[_0x49a1('0x62')],{})[_0x49a1('0x38')](function(_0x2141e4){var _0x4189fb=_0x45d56f[_0x49a1('0x63')][_0x49a1('0x39')]({'plain':!![]});if(!_0x4189fb)throw new Error(_0x49a1('0x64'));if(_0x4189fb['role']==='user'){var _0x4e68de=_0x2141e4[_0x49a1('0x39')]({'plain':!![]});var _0x1f055f=_0x49a1('0x3a');return db[_0x49a1('0x65')][_0x49a1('0x60')]({'where':{'name':_0x1f055f,'userProfileId':_0x4189fb[_0x49a1('0x66')]},'raw':!![]})[_0x49a1('0x38')](function(_0x558fec){if(_0x558fec&&_0x558fec[_0x49a1('0x67')]===0x0){return db[_0x49a1('0x3b')]['create']({'name':_0x4e68de[_0x49a1('0x3f')],'resourceId':_0x4e68de['id'],'type':_0x558fec[_0x49a1('0x3f')],'sectionId':_0x558fec['id']},{})[_0x49a1('0x38')](function(){return _0x2141e4;});}else{return _0x2141e4;}})[_0x49a1('0x2b')](function(_0x1da1f3){logger[_0x49a1('0x27')](_0x49a1('0x68'),_0x1da1f3);throw _0x1da1f3;});}return _0x2141e4;})[_0x49a1('0x38')](respondWithResult(_0x2d1527,0xc9))[_0x49a1('0x2b')](handleError(_0x2d1527,null));};exports[_0x49a1('0x37')]=function(_0x589518,_0x423e90){if(_0x589518[_0x49a1('0x62')]['id']){delete _0x589518['body']['id'];}return db[_0x49a1('0x57')][_0x49a1('0x60')]({'where':{'id':_0x589518[_0x49a1('0x5b')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})[_0x49a1('0x38')](handleEntityNotFound(_0x423e90,null))[_0x49a1('0x38')](saveUpdates(_0x589518[_0x49a1('0x62')],null))[_0x49a1('0x38')](respondWithResult(_0x423e90,null))[_0x49a1('0x2b')](handleError(_0x423e90,null));};exports[_0x49a1('0x3c')]=function(_0x2ee1d1,_0x514c88){return db[_0x49a1('0x57')]['find']({'where':{'id':_0x2ee1d1[_0x49a1('0x5b')]['id']}})[_0x49a1('0x38')](handleEntityNotFound(_0x514c88,null))['then'](removeEntity(_0x514c88,null))[_0x49a1('0x2b')](handleError(_0x514c88,null));};exports[_0x49a1('0x69')]=function(_0x11c601,_0x19fdc7){return db[_0x49a1('0x57')][_0x49a1('0x69')]()[_0x49a1('0x38')](respondWithResult(_0x19fdc7,null))[_0x49a1('0x2b')](handleError(_0x19fdc7,null));};exports[_0x49a1('0x6a')]=function(_0x147d20,_0x326963,_0x23cab1){if(_0x147d20['body']['id']){delete _0x147d20[_0x49a1('0x62')]['id'];}return db['ChatWebsite'][_0x49a1('0x60')]({'where':{'id':_0x147d20[_0x49a1('0x5b')]['id']}})['then'](handleEntityNotFound(_0x326963,null))[_0x49a1('0x38')](function(_0x4d31d6){if(_0x4d31d6){_0x147d20['body'][_0x49a1('0x6b')]=_0x4d31d6['id'];return db[_0x49a1('0x6c')][_0x49a1('0x61')](_0x147d20[_0x49a1('0x62')]);}})[_0x49a1('0x38')](respondWithResult(_0x326963,null))[_0x49a1('0x2b')](handleError(_0x326963,null));};exports[_0x49a1('0x6d')]=function(_0x10c2fd,_0x29e89a,_0x1b9f9b){var _0x71dbde={'raw':![],'where':{}};var _0xf092b1={};var _0xafaf45={'count':0x0,'rows':[]};return db[_0x49a1('0x57')][_0x49a1('0x6e')]({'where':{'id':_0x10c2fd[_0x49a1('0x5b')]['id']}})[_0x49a1('0x38')](handleEntityNotFound(_0x29e89a,null))[_0x49a1('0x38')](function(_0x18cb97){if(_0x18cb97){_0xf092b1[_0x49a1('0x46')]=_[_0x49a1('0x47')](db[_0x49a1('0x6c')][_0x49a1('0x43')]);_0xf092b1[_0x49a1('0x48')]=_[_0x49a1('0x47')](_0x10c2fd['query']);_0xf092b1[_0x49a1('0x49')]=_[_0x49a1('0x4a')](_0xf092b1[_0x49a1('0x46')],_0xf092b1['query']);_0x71dbde['attributes']=_[_0x49a1('0x4a')](_0xf092b1[_0x49a1('0x46')],qs['fields'](_0x10c2fd['query'][_0x49a1('0x4c')]));_0x71dbde[_0x49a1('0x4b')]=_0x71dbde[_0x49a1('0x4b')][_0x49a1('0x4d')]?_0x71dbde[_0x49a1('0x4b')]:_0xf092b1[_0x49a1('0x46')];if(!_0x10c2fd[_0x49a1('0x48')][_0x49a1('0x4e')](_0x49a1('0x4f'))){_0x71dbde[_0x49a1('0x31')]=qs[_0x49a1('0x31')](_0x10c2fd[_0x49a1('0x48')][_0x49a1('0x31')]);_0x71dbde[_0x49a1('0x2f')]=qs[_0x49a1('0x2f')](_0x10c2fd[_0x49a1('0x48')][_0x49a1('0x2f')]);}_0x71dbde[_0x49a1('0x50')]=qs['sort'](_0x10c2fd[_0x49a1('0x48')]['sort']);_0x71dbde['where']=qs[_0x49a1('0x49')](_[_0x49a1('0x53')](_0x10c2fd[_0x49a1('0x48')],_0xf092b1[_0x49a1('0x49')]));_0x71dbde[_0x49a1('0x52')][_0x49a1('0x6b')]=_0x18cb97['id'];if(_0x10c2fd[_0x49a1('0x48')][_0x49a1('0x54')]){_0x71dbde[_0x49a1('0x52')]=_[_0x49a1('0x5f')](_0x71dbde[_0x49a1('0x52')],{'$or':_[_0x49a1('0x42')](_0x71dbde['attributes'],function(_0x3a3ae5){var _0x2f6904={};_0x2f6904[_0x3a3ae5]={'$like':'%'+_0x10c2fd[_0x49a1('0x48')][_0x49a1('0x54')]+'%'};return _0x2f6904;})});}_0x71dbde=_[_0x49a1('0x5f')]({},_0x71dbde,_0x10c2fd[_0x49a1('0x56')]);return db[_0x49a1('0x6c')][_0x49a1('0x32')]({'where':_0x71dbde['where']})[_0x49a1('0x38')](function(_0x1f9e8c){_0xafaf45[_0x49a1('0x32')]=_0x1f9e8c;if(_0x10c2fd[_0x49a1('0x48')]['includeAll']){_0x71dbde[_0x49a1('0x5e')]=[{'all':!![]}];}return db[_0x49a1('0x6c')][_0x49a1('0x58')](_0x71dbde);})['then'](function(_0x48be25){_0xafaf45[_0x49a1('0x59')]=_0x48be25;return _0xafaf45;});}})['then'](respondWithFilteredResult(_0x29e89a,_0x71dbde))['catch'](handleError(_0x29e89a,null));};exports[_0x49a1('0x6f')]=function(_0x4e2d52,_0x196cd3,_0x2cb2d4){return db[_0x49a1('0x57')]['find']({'where':{'id':_0x4e2d52[_0x49a1('0x5b')]['id']}})[_0x49a1('0x38')](handleEntityNotFound(_0x196cd3,null))[_0x49a1('0x38')](function(_0x257886){if(_0x257886){return _0x257886[_0x49a1('0x6f')](_0x4e2d52[_0x49a1('0x48')][_0x49a1('0x70')]);}})[_0x49a1('0x38')](respondWithStatusCode(_0x196cd3,null))[_0x49a1('0x2b')](handleError(_0x196cd3,null));};exports['addAnswer']=function(_0x53d72f,_0xaf1a39,_0x54beb8){if(_0x53d72f[_0x49a1('0x62')]['id']){delete _0x53d72f['body']['id'];}return db[_0x49a1('0x57')][_0x49a1('0x60')]({'where':{'id':_0x53d72f[_0x49a1('0x5b')]['id']}})['then'](handleEntityNotFound(_0xaf1a39,null))['then'](function(_0x1acaec){if(_0x1acaec){_0x53d72f[_0x49a1('0x62')][_0x49a1('0x6b')]=_0x1acaec['id'];return db[_0x49a1('0x71')][_0x49a1('0x61')](_0x53d72f[_0x49a1('0x62')]);}})['then'](respondWithResult(_0xaf1a39,null))[_0x49a1('0x2b')](handleError(_0xaf1a39,null));};exports['getAnswers']=function(_0x34c33e,_0x26e6fd,_0x498317){var _0x51a512={'raw':![],'where':{}};var _0x53da90={};var _0x397899={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x49a1('0x6e')]({'where':{'id':_0x34c33e['params']['id']}})[_0x49a1('0x38')](handleEntityNotFound(_0x26e6fd,null))['then'](function(_0x3e14a2){if(_0x3e14a2){_0x53da90[_0x49a1('0x46')]=_[_0x49a1('0x47')](db['CannedAnswer']['rawAttributes']);_0x53da90['query']=_[_0x49a1('0x47')](_0x34c33e['query']);_0x53da90[_0x49a1('0x49')]=_[_0x49a1('0x4a')](_0x53da90[_0x49a1('0x46')],_0x53da90[_0x49a1('0x48')]);_0x51a512[_0x49a1('0x4b')]=_[_0x49a1('0x4a')](_0x53da90['model'],qs[_0x49a1('0x4c')](_0x34c33e[_0x49a1('0x48')][_0x49a1('0x4c')]));_0x51a512[_0x49a1('0x4b')]=_0x51a512[_0x49a1('0x4b')]['length']?_0x51a512['attributes']:_0x53da90[_0x49a1('0x46')];if(!_0x34c33e['query'][_0x49a1('0x4e')](_0x49a1('0x4f'))){_0x51a512['limit']=qs['limit'](_0x34c33e[_0x49a1('0x48')][_0x49a1('0x31')]);_0x51a512[_0x49a1('0x2f')]=qs['offset'](_0x34c33e[_0x49a1('0x48')][_0x49a1('0x2f')]);}_0x51a512[_0x49a1('0x50')]=qs['sort'](_0x34c33e[_0x49a1('0x48')]['sort']);_0x51a512[_0x49a1('0x52')]=qs['filters'](_[_0x49a1('0x53')](_0x34c33e[_0x49a1('0x48')],_0x53da90[_0x49a1('0x49')]));_0x51a512[_0x49a1('0x52')][_0x49a1('0x6b')]=_0x3e14a2['id'];if(_0x34c33e[_0x49a1('0x48')][_0x49a1('0x54')]){_0x51a512[_0x49a1('0x52')]=_[_0x49a1('0x5f')](_0x51a512[_0x49a1('0x52')],{'$or':_[_0x49a1('0x42')](_0x51a512[_0x49a1('0x4b')],function(_0x30d1e8){var _0x2dc8dc={};_0x2dc8dc[_0x30d1e8]={'$like':'%'+_0x34c33e[_0x49a1('0x48')][_0x49a1('0x54')]+'%'};return _0x2dc8dc;})});}_0x51a512=_[_0x49a1('0x5f')]({},_0x51a512,_0x34c33e[_0x49a1('0x56')]);return db[_0x49a1('0x71')][_0x49a1('0x32')]({'where':_0x51a512[_0x49a1('0x52')]})[_0x49a1('0x38')](function(_0x3b6b6e){_0x397899[_0x49a1('0x32')]=_0x3b6b6e;if(_0x34c33e[_0x49a1('0x48')][_0x49a1('0x5d')]){_0x51a512[_0x49a1('0x5e')]=[{'all':!![]}];}return db['CannedAnswer'][_0x49a1('0x58')](_0x51a512);})[_0x49a1('0x38')](function(_0x45d486){_0x397899[_0x49a1('0x59')]=_0x45d486;return _0x397899;});}})[_0x49a1('0x38')](respondWithFilteredResult(_0x26e6fd,_0x51a512))[_0x49a1('0x2b')](handleError(_0x26e6fd,null));};exports[_0x49a1('0x72')]=function(_0x360281,_0x4280a1,_0x1b9a2d){return db[_0x49a1('0x57')][_0x49a1('0x60')]({'where':{'id':_0x360281['params']['id']}})['then'](handleEntityNotFound(_0x4280a1,null))[_0x49a1('0x38')](function(_0xe4590d){if(_0xe4590d){return _0xe4590d['removeAnswers'](_0x360281['query'][_0x49a1('0x70')]);}})[_0x49a1('0x38')](respondWithStatusCode(_0x4280a1,null))[_0x49a1('0x2b')](handleError(_0x4280a1,null));};exports[_0x49a1('0x73')]=function(_0x146a40,_0x5a6c03,_0x1a6380){_0x146a40[_0x49a1('0x62')][_0x49a1('0x74')]=_0x146a40[_0x49a1('0x75')][_0x49a1('0x76')];return db[_0x49a1('0x57')][_0x49a1('0x60')]({'where':{'id':_0x146a40['params']['id']}})[_0x49a1('0x38')](handleEntityNotFound(_0x5a6c03,null))[_0x49a1('0x38')](saveUpdates(_0x146a40['body'],null))[_0x49a1('0x38')](respondWithResult(_0x5a6c03,null))['catch'](handleError(_0x5a6c03,null));};exports[_0x49a1('0x77')]=function(_0x44596b,_0x218cf2,_0x4c181d){_0x44596b['body'][_0x49a1('0x78')]=_0x44596b[_0x49a1('0x75')][_0x49a1('0x76')];return db[_0x49a1('0x57')]['find']({'where':{'id':_0x44596b[_0x49a1('0x5b')]['id']}})[_0x49a1('0x38')](handleEntityNotFound(_0x218cf2,null))[_0x49a1('0x38')](saveUpdates(_0x44596b[_0x49a1('0x62')],null))['then'](respondWithResult(_0x218cf2,null))[_0x49a1('0x2b')](handleError(_0x218cf2,null));};exports['addCustomerAvatar']=function(_0x4e92fd,_0x3d36d2,_0x2e7e87){_0x4e92fd['body'][_0x49a1('0x79')]=_0x4e92fd[_0x49a1('0x75')]['filename'];return db['ChatWebsite'][_0x49a1('0x60')]({'where':{'id':_0x4e92fd[_0x49a1('0x5b')]['id']}})[_0x49a1('0x38')](handleEntityNotFound(_0x3d36d2,null))[_0x49a1('0x38')](saveUpdates(_0x4e92fd['body'],null))[_0x49a1('0x38')](respondWithResult(_0x3d36d2,null))[_0x49a1('0x2b')](handleError(_0x3d36d2,null));};exports[_0x49a1('0x7a')]=function(_0x4bb60c,_0x406b49,_0x32b005){_0x4bb60c[_0x49a1('0x62')][_0x49a1('0x7b')]=_0x4bb60c[_0x49a1('0x75')]['filename'];return db[_0x49a1('0x57')][_0x49a1('0x60')]({'where':{'id':_0x4bb60c['params']['id']}})[_0x49a1('0x38')](handleEntityNotFound(_0x406b49,null))[_0x49a1('0x38')](saveUpdates(_0x4bb60c[_0x49a1('0x62')],null))[_0x49a1('0x38')](respondWithResult(_0x406b49,null))[_0x49a1('0x2b')](handleError(_0x406b49,null));};exports['getLogo']=function(_0x5a804a,_0x19e5b5,_0xd2f647){var _0x36ee71=path[_0x49a1('0x7c')](config[_0x49a1('0x7d')],_0x49a1('0x7e'));var _0x4dc90e={'where':{'id':_0x5a804a[_0x49a1('0x5b')]['id']},'attributes':['id','sitepic'],'raw':!![]};var _0xae00df=![];return require(_0x49a1('0x18'))['getLicense']()[_0x49a1('0x38')](function(_0x2fb3ef){if(_0x2fb3ef){_0xae00df=_0x2fb3ef['custom'];}})[_0x49a1('0x38')](function(){return db[_0x49a1('0x57')][_0x49a1('0x60')](_0x4dc90e);})[_0x49a1('0x38')](handleEntityNotFound(_0x19e5b5,null))[_0x49a1('0x38')](function(_0x3b6bb6){if(_0x3b6bb6){if(!_['isNil'](_0x3b6bb6[_0x49a1('0x74')])){if(fs['existsSync'](path[_0x49a1('0x7c')](config['root'],_0x49a1('0x7f'),_0x3b6bb6[_0x49a1('0x74')]))&&_0xae00df){_0x36ee71=path[_0x49a1('0x7c')](config[_0x49a1('0x7d')],_0x49a1('0x7f'),_0x3b6bb6['sitepic']);}}return _0x19e5b5[_0x49a1('0x80')](_0x36ee71);}})[_0x49a1('0x2b')](handleError(_0x19e5b5,null));};exports['getAvatar']=function(_0x16bf25,_0x21f527,_0x860482){var _0x653a1c=path['join'](config['root'],_0x49a1('0x81'));var _0x678744={'where':{'id':_0x16bf25[_0x49a1('0x5b')]['id']},'attributes':['id','agentAvatar'],'raw':!![]};return db[_0x49a1('0x57')][_0x49a1('0x60')](_0x678744)['then'](handleEntityNotFound(_0x21f527,null))[_0x49a1('0x38')](function(_0x44d3cb){if(_0x44d3cb){if(!_[_0x49a1('0x82')](_0x44d3cb[_0x49a1('0x78')])){if(fs[_0x49a1('0x83')](path[_0x49a1('0x7c')](config['root'],_0x49a1('0x84'),_0x44d3cb[_0x49a1('0x78')]))){_0x653a1c=path[_0x49a1('0x7c')](config['root'],_0x49a1('0x84'),_0x44d3cb[_0x49a1('0x78')]);}}return _0x21f527[_0x49a1('0x80')](_0x653a1c);}})[_0x49a1('0x2b')](handleError(_0x21f527,null));};exports[_0x49a1('0x85')]=function(_0x4b9646,_0x1bdf9c,_0x537eae){var _0x5726fd=path[_0x49a1('0x7c')](config[_0x49a1('0x7d')],_0x49a1('0x86'));var _0x308021={'where':{'id':_0x4b9646[_0x49a1('0x5b')]['id']},'attributes':['id',_0x49a1('0x79'),_0x49a1('0x87')],'raw':!![]};return db['ChatWebsite']['find'](_0x308021)[_0x49a1('0x38')](handleEntityNotFound(_0x1bdf9c,null))[_0x49a1('0x38')](function(_0x1df308){if(_0x1df308){if(!_[_0x49a1('0x82')](_0x1df308[_0x49a1('0x79')])){if(fs[_0x49a1('0x83')](path[_0x49a1('0x7c')](config[_0x49a1('0x7d')],_0x49a1('0x84'),_0x1df308['customerAvatar']))&&_0x1df308['showCustomerAvatar']){_0x5726fd=path[_0x49a1('0x7c')](config['root'],_0x49a1('0x84'),_0x1df308[_0x49a1('0x79')]);}}return _0x1bdf9c[_0x49a1('0x80')](_0x5726fd);}})[_0x49a1('0x2b')](handleError(_0x1bdf9c,null));};exports[_0x49a1('0x88')]=function(_0x34c61a,_0xc5e8e5,_0x33a67e){var _0x4f3199=path[_0x49a1('0x7c')](config[_0x49a1('0x7d')],_0x49a1('0x89'));var _0x566a47={'where':{'id':_0x34c61a[_0x49a1('0x5b')]['id']},'attributes':['id','systemAvatar'],'raw':!![]};return db[_0x49a1('0x57')][_0x49a1('0x60')](_0x566a47)[_0x49a1('0x38')](handleEntityNotFound(_0xc5e8e5,null))[_0x49a1('0x38')](function(_0x29d43f){if(_0x29d43f){if(!_['isNil'](_0x29d43f[_0x49a1('0x7b')])){if(fs[_0x49a1('0x83')](path[_0x49a1('0x7c')](config[_0x49a1('0x7d')],_0x49a1('0x84'),_0x29d43f['systemAvatar']))){_0x4f3199=path['join'](config[_0x49a1('0x7d')],_0x49a1('0x84'),_0x29d43f[_0x49a1('0x7b')]);}}return _0xc5e8e5[_0x49a1('0x80')](_0x4f3199);}})[_0x49a1('0x2b')](handleError(_0xc5e8e5,null));};exports[_0x49a1('0x8a')]=function(_0x4ef3ef,_0x4b9112,_0x4bbbc0){var _0x3be051=require('user-agent-parser');var _0x5be035=new _0x3be051();var _0x3e5a72=_0x5be035[_0x49a1('0x8b')](_0x4ef3ef[_0x49a1('0x8c')][_0x49a1('0x8d')])[_0x49a1('0x8e')]();var _0x3e4006={'body':_0x4ef3ef[_0x49a1('0x62')],'channel':_0x49a1('0x8f')};var _0x37f470=[];var _0x255c7c=[];var _0x5c2da0={};var _0x35dbdb=![];return db['CmContact'][_0x49a1('0x69')]()[_0x49a1('0x38')](function(_0x3a4f04){if(!_0x3a4f04){throw new db[(_0x49a1('0x90'))][(_0x49a1('0x91'))]('no\x20available\x20attributes');}_0x37f470=_['difference'](_[_0x49a1('0x47')](_0x3a4f04),['createdAt',_0x49a1('0x92')]);_0x255c7c=_['difference'](_[_0x49a1('0x47')](_0x3a4f04),[_0x49a1('0x93'),'updatedAt',_0x49a1('0x94'),_0x49a1('0x95')]);if(_0x4ef3ef[_0x49a1('0x62')]['id']){delete _0x4ef3ef[_0x49a1('0x62')]['id'];}if(_[_0x49a1('0x82')](_0x4ef3ef[_0x49a1('0x62')][_0x49a1('0x96')])){throw new db[(_0x49a1('0x90'))][(_0x49a1('0x91'))](_0x49a1('0x97'));}if(_[_0x49a1('0x82')](_0x4ef3ef['body'][_0x49a1('0x62')])||_0x4ef3ef[_0x49a1('0x62')][_0x49a1('0x62')]===''){throw new db['Sequelize']['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x49a1('0x82')](_0x4ef3ef[_0x49a1('0x62')][_0x49a1('0x98')])){throw new db[(_0x49a1('0x90'))][(_0x49a1('0x91'))](_0x49a1('0x99')+_0x255c7c);}if(!_[_0x49a1('0x9a')](_0x255c7c,_0x4ef3ef[_0x49a1('0x62')][_0x49a1('0x98')])){throw new db[(_0x49a1('0x90'))]['ValidationError']('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x255c7c);}_0x5c2da0[_0x4ef3ef[_0x49a1('0x62')][_0x49a1('0x98')]]=_0x4ef3ef[_0x49a1('0x62')][_0x49a1('0x96')];})[_0x49a1('0x38')](function(){return db[_0x49a1('0x57')][_0x49a1('0x60')]({'where':{'id':_0x4ef3ef['params']['id']},'include':[{'model':db['CmList'],'as':_0x49a1('0x9b'),'include':[{'model':db[_0x49a1('0x9c')],'as':_0x49a1('0x9d'),'where':_0x5c2da0,'limit':0x1,'order':[[_0x49a1('0x92'),_0x49a1('0x9e')]]}]},{'model':db[_0x49a1('0x9f')],'as':_0x49a1('0xa0')}]});})[_0x49a1('0x38')](handleEntityNotFound(_0x4b9112,null))['then'](function(_0xe81555){if(_0xe81555&&_0xe81555[_0x49a1('0x9b')]){_0x3e4006[_0x49a1('0xa1')]=_0xe81555;_0x3e4006[_0x49a1('0xa2')]=_0xe81555[_0x49a1('0xa0')];_0x3e4006[_0x49a1('0xa3')]=_0xe81555[_0x49a1('0x9b')];_0x3e4006[_0x49a1('0xa2')]=_[_0x49a1('0xa4')](_0x3e4006[_0x49a1('0xa2')],[_0x49a1('0xa5')],[_0x49a1('0xa6')]);if(_0x3e4006[_0x49a1('0xa1')][_0x49a1('0xa0')]){delete _0x3e4006[_0x49a1('0xa1')][_0x49a1('0xa0')];}if(_0x3e4006['account']['List']&&_0x3e4006['account'][_0x49a1('0x9b')][_0x49a1('0x9d')][_0x49a1('0x4d')]){return _0x3e4006['account'][_0x49a1('0x9b')][_0x49a1('0x9d')][0x0];}var _0x2d4999=_[_0x49a1('0x1a')](_0x4ef3ef[_0x49a1('0x62')],{'firstName':_0x4ef3ef[_0x49a1('0x62')][_0x49a1('0x96')],'ListId':_0xe81555[_0x49a1('0x95')]});_0x2d4999[_0x4ef3ef[_0x49a1('0x62')][_0x49a1('0x98')]]=_0x4ef3ef['body'][_0x49a1('0x96')];return db[_0x49a1('0x9c')][_0x49a1('0x61')](_0x2d4999,{'fields':_0x37f470,'raw':!![]});}})[_0x49a1('0x38')](handleEntityNotFound(_0x4b9112,null))[_0x49a1('0x38')](function(_0x27ea0d){_0x3e4006[_0x49a1('0xa7')]=_0x27ea0d;var _0x141fb3=_0x4ef3ef[_0x49a1('0x62')]['customerIp'];if(_0x4ef3ef['headers'][_0x49a1('0xa8')]){_0x141fb3=_0x4ef3ef['headers'][_0x49a1('0xa8')];}else if(_0x4ef3ef[_0x49a1('0x8c')][_0x49a1('0xa9')]){_0x141fb3=_[_0x49a1('0xaa')](_0x4ef3ef[_0x49a1('0x8c')]['x-forwarded-for'][_0x49a1('0xab')](','));}if(_0x27ea0d){var _0x777c0={'ContactId':_0x27ea0d['id'],'ChatWebsiteId':_0x4ef3ef['params']['id'],'from':(_0x27ea0d['firstName']||'')+'\x20'+(_0x27ea0d[_0x49a1('0xac')]||''),'customerIp':_0x141fb3,'customerPort':_0x4ef3ef[_0x49a1('0x8c')][_0x49a1('0xad')]?_0x4ef3ef['headers'][_0x49a1('0xad')]:null,'referer':_0x4ef3ef[_0x49a1('0x62')][_0x49a1('0xae')],'browserName':_0x3e5a72['browser'][_0x49a1('0x3f')]&&_0x3e5a72[_0x49a1('0xaf')][_0x49a1('0xb0')]?util[_0x49a1('0xb1')](_0x49a1('0xb2'),_0x3e5a72[_0x49a1('0xaf')]['name'],_0x3e5a72[_0x49a1('0xaf')]['version']):_0x49a1('0xb3'),'browserVersion':_0x3e5a72['browser'][_0x49a1('0xb0')]||_0x49a1('0xb3'),'osName':util[_0x49a1('0xb1')](_0x49a1('0xb2'),_0x3e5a72['os'][_0x49a1('0x3f')],_0x3e5a72['os'][_0x49a1('0xb0')]),'osVersion':_0x3e5a72['os'][_0x49a1('0xb0')],'deviceModel':_0x3e5a72[_0x49a1('0xb4')][_0x49a1('0x46')]&&_0x3e5a72[_0x49a1('0xb4')][_0x49a1('0xb5')]?util[_0x49a1('0xb1')](_0x49a1('0xb6'),_0x3e5a72[_0x49a1('0xb4')]['model'],_0x3e5a72[_0x49a1('0xb4')][_0x49a1('0xb5')],_0x3e5a72['device']['type']):null,'deviceVendor':_0x3e5a72[_0x49a1('0xb4')][_0x49a1('0xb5')],'deviceType':_0x3e5a72['device'][_0x49a1('0x45')],'formData':JSON[_0x49a1('0x26')](_0x4ef3ef[_0x49a1('0x62')])};var _0x5b2ad4={'ChatWebsiteId':_0x4ef3ef[_0x49a1('0x5b')]['id'],'closed':![]};if(_0x4ef3ef[_0x49a1('0x62')][_0x49a1('0xb7')]){_0x5b2ad4['threadId']=_0x4ef3ef[_0x49a1('0x62')]['threadId'];return db['ChatInteraction'][_0x49a1('0x60')]({'where':_0x5b2ad4})[_0x49a1('0x38')](function(_0x40f0bc){if(_0x40f0bc){return[_0x40f0bc,![]];}_0x777c0[_0x49a1('0xb7')]=_0x4ef3ef[_0x49a1('0x62')][_0x49a1('0xb7')];_0x777c0['externalUrl']=_0x4ef3ef[_0x49a1('0x62')][_0x49a1('0xb8')];return db[_0x49a1('0xb9')][_0x49a1('0x61')](_0x777c0)[_0x49a1('0x38')](function(_0x170e42){return[_0x170e42,!![]];});});}_0x5b2ad4[_0x49a1('0xba')]=_0x27ea0d['id'];if(_0x4ef3ef['body'][_0x49a1('0xbb')]&&_0x4ef3ef[_0x49a1('0x62')]['interaction']['id']){_0x5b2ad4['id']=_0x4ef3ef[_0x49a1('0x62')][_0x49a1('0xbb')]['id'];return db[_0x49a1('0xb9')][_0x49a1('0x60')]({'where':_0x5b2ad4})[_0x49a1('0x38')](function(_0xd16030){if(_0xd16030){return[_0xd16030,![]];}return db[_0x49a1('0xb9')][_0x49a1('0x61')](_0x777c0)[_0x49a1('0x38')](function(_0xd65e69){return[_0xd65e69,!![]];});});}return db['ChatInteraction'][_0x49a1('0x61')](_0x777c0)[_0x49a1('0x38')](function(_0x2a5a2f){return[_0x2a5a2f,!![]];});}})[_0x49a1('0xbc')](function(_0x40de90,_0x5c0162){if(_0x40de90){_0x35dbdb=_0x5c0162;if(!_0x5c0162){var _0xad0efa={'from':(_0x3e4006[_0x49a1('0xa7')][_0x49a1('0xbd')]||'')+'\x20'+(_0x3e4006[_0x49a1('0xa7')][_0x49a1('0xac')]||'')};if(_0x4ef3ef[_0x49a1('0x62')][_0x49a1('0xb7')]&&_0x4ef3ef[_0x49a1('0x62')][_0x49a1('0xbe')]&&_0x4ef3ef['body'][_0x49a1('0xb7')]!=_0x4ef3ef[_0x49a1('0x62')][_0x49a1('0xbe')]){_0xad0efa[_0x49a1('0xb7')]=_0x4ef3ef[_0x49a1('0x62')][_0x49a1('0xbe')];}return _0x40de90[_0x49a1('0x37')](_0xad0efa);}else{return _0x40de90;}}})[_0x49a1('0x38')](function(_0x1ffe75){_0x3e4006[_0x49a1('0xbb')]=_0x1ffe75[_0x49a1('0x39')]({'plain':!![]});_0x3e4006[_0x49a1('0xbb')][_0x49a1('0xbf')]=_0x35dbdb;if(_0x3e4006[_0x49a1('0xbb')][_0x49a1('0xbf')]){if(_0x3e4006[_0x49a1('0xa1')][_0x49a1('0xc0')]){_0x3e4006[_0x49a1('0xa2')][_0x49a1('0xc1')]({'id':0x0,'priority':_0x3e4006[_0x49a1('0xa2')]['length']+0x1,'app':_0x49a1('0xc2'),'appdata':_0x49a1('0xc3'),'interval':'*,*,*,*'});}}return db[_0x49a1('0xc4')][_0x49a1('0x61')]({'body':_0x4ef3ef[_0x49a1('0x62')]['body'],'ChatWebsiteId':_0x4ef3ef['params']['id'],'ChatInteractionId':_0x1ffe75['id'],'direction':'in','ContactId':_0x3e4006[_0x49a1('0xa7')]['id'],'AttachmentId':_0x4ef3ef[_0x49a1('0x62')][_0x49a1('0xc5')]});})[_0x49a1('0x38')](function(_0x23fd12){_0x3e4006[_0x49a1('0x2a')]=_0x23fd12;if(_0x3e4006['interaction']['UserId']){return db[_0x49a1('0xc6')]['find']({'attributes':['id',_0x49a1('0x3f')],'where':{'id':_0x3e4006[_0x49a1('0xbb')][_0x49a1('0xc7')]}})[_0x49a1('0x38')](function(_0xbb0287){if(_0xbb0287){_0x3e4006['applications'][_0x49a1('0xc8')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0xbb0287[_0x49a1('0x3f')]+','+(_0x3e4006[_0x49a1('0xa1')]['waitForTheAssignedAgent']||0xa),'interval':_0x49a1('0xc9')});_0x3e4006[_0x49a1('0xca')]=!![];}return respondWithRpcPromise(_0x49a1('0xcb'),'startRouting',_0x3e4006);});}return respondWithRpcPromise(_0x49a1('0xcb'),_0x49a1('0xcc'),_0x3e4006);})[_0x49a1('0x38')](function(_0xd28116){respondWithRpcPromise(_0x49a1('0xcd'),'EventManager',{'event':_0x49a1('0x8a'),'message':_0xd28116},client9002);return _0xd28116;})['then'](respondWithResult(_0x4b9112,null))['catch'](handleError(_0x4b9112,null));};exports['offline']=function(_0x194a78,_0x169827,_0x1f03a8){var _0x5425cf,_0x3a0024,_0x1ce8a3;var _0x3c56cb=[];var _0x569bf3=[];var _0x481e6c={};var _0x47cefd=_0x194a78[_0x49a1('0xce')]||[];var _0x39903b=[];var _0x5b41b7;return db[_0x49a1('0x9c')][_0x49a1('0x69')]()[_0x49a1('0x38')](function(_0x350eee){if(!_0x350eee){throw new db[(_0x49a1('0x90'))][(_0x49a1('0x91'))](_0x49a1('0xcf'));}_0x569bf3=_[_0x49a1('0xd0')](_[_0x49a1('0x47')](_0x350eee),[_0x49a1('0x93'),_0x49a1('0x92')]);_0x3c56cb=_[_0x49a1('0xd0')](_[_0x49a1('0x47')](_0x350eee),[_0x49a1('0x93'),_0x49a1('0x92'),_0x49a1('0x94'),_0x49a1('0x95')]);if(_0x194a78['body']['id']){delete _0x194a78[_0x49a1('0x62')]['id'];}if(_[_0x49a1('0x82')](_0x194a78[_0x49a1('0x62')]['from'])){throw _0x169827['status'](0x1f4)[_0x49a1('0xd1')](new db[(_0x49a1('0x90'))][(_0x49a1('0x91'))](_0x49a1('0x97')));}if(_[_0x49a1('0x82')](_0x194a78[_0x49a1('0x62')][_0x49a1('0x62')])||_0x194a78['body']['body']===''){throw _0x169827[_0x49a1('0x2d')](0x1f4)[_0x49a1('0xd1')](new db[(_0x49a1('0x90'))][(_0x49a1('0x91'))](_0x49a1('0xd2')));}if(_[_0x49a1('0x82')](_0x194a78[_0x49a1('0x62')][_0x49a1('0xd3')])){throw _0x169827[_0x49a1('0x2d')](0x1f4)['send'](new db['Sequelize'][(_0x49a1('0x91'))](_0x49a1('0xd4')+_0x3c56cb));}if(!_[_0x49a1('0x9a')](_0x3c56cb,_0x194a78[_0x49a1('0x62')][_0x49a1('0xd3')])){throw _0x169827[_0x49a1('0x2d')](0x1f4)['send'](new db[(_0x49a1('0x90'))][(_0x49a1('0x91'))](_0x49a1('0xd5')+_0x3c56cb));}_0x481e6c[_0x194a78[_0x49a1('0x62')]['mapKeyOffline']]=_0x194a78[_0x49a1('0x62')]['from'];})[_0x49a1('0x38')](function(){return db['ChatWebsite']['find']({'where':{'id':_0x194a78[_0x49a1('0x5b')]['id']},'include':[{'model':db['CmList'],'as':_0x49a1('0x9b')},{'model':db[_0x49a1('0xd6')],'as':'MailAccount'}]});})['then'](handleEntityNotFound(_0x169827,null))['then'](function(_0x3f15b8){if(_0x3f15b8&&_0x3f15b8[_0x49a1('0x9b')]){_0x3a0024=_0x3f15b8;var _0x37f3f3=_[_0x49a1('0x1a')](_0x194a78[_0x49a1('0x62')],{'firstName':_0x194a78[_0x49a1('0x62')][_0x49a1('0x96')],'phone':_0x194a78[_0x49a1('0x62')][_0x49a1('0x96')],'ListId':_0x3f15b8[_0x49a1('0x95')]});_0x37f3f3[_0x194a78[_0x49a1('0x62')][_0x49a1('0xd3')]]=_0x194a78[_0x49a1('0x62')][_0x49a1('0x96')];return db[_0x49a1('0x9c')][_0x49a1('0xd7')]({'where':_0x481e6c,'defaults':_0x37f3f3});}})[_0x49a1('0xbc')](function(_0x55004c){if(_0x55004c){_0x1ce8a3=_0x55004c;var _0x2322f3=fs[_0x49a1('0xd8')](path['join'](config[_0x49a1('0x7d')],'server/files/templates/chatOfflineMessage.ejs'),_0x49a1('0xd9'));var _0x44bfe0=ejs['render'](_0x2322f3,{'body':_['toPairs'](_0x194a78[_0x49a1('0x62')][_0x49a1('0x62')]),'bodyTitle':_0x3a0024[_0x49a1('0xda')]});return db['ChatOfflineMessage'][_0x49a1('0x61')]({'body':_0x44bfe0,'ContactId':_0x55004c['id'],'ChatWebsiteId':_0x3a0024['id']});}})['then'](function(_0x2b671f){_0x5b41b7=_0x2b671f;if(_0x47cefd[_0x49a1('0x4d')]){var _0x53b9cd=_0x47cefd[_0x49a1('0x42')](function(_0x2b8b3e){return{'name':_0x2b8b3e[_0x49a1('0xdb')],'basename':_0x2b8b3e[_0x49a1('0x76')],'type':_0x2b8b3e[_0x49a1('0xdc')],'ChatOfflineMessageId':_0x2b671f['id']};});_0x39903b=_0x53b9cd[_0x49a1('0x42')](_0x3583e9=>{var _0x2019c5={'filename':_0x3583e9[_0x49a1('0x3f')],'path':path['join'](config[_0x49a1('0x7d')],_0x49a1('0xdd'),'files','attachments','offline-chat',_0x3583e9[_0x49a1('0xde')])};return _0x2019c5;});if(!_0x3a0024[_0x49a1('0xdf')]){return db[_0x49a1('0xe0')][_0x49a1('0xe1')](function(_0x1d3d5c){return db[_0x49a1('0xe2')][_0x49a1('0xe3')](_0x53b9cd,{'transaction':_0x1d3d5c});});}}})[_0x49a1('0x38')](function(){if(_0x5b41b7){_0x5425cf=_0x5b41b7;return db[_0x49a1('0xd6')][_0x49a1('0x6e')]({'where':{'active':!![]},'include':[{'model':db[_0x49a1('0xe4')],'as':'Smtp','raw':!![]}]});}})['then'](function(_0x5bc2c2){if(_0x5bc2c2&&_0x5bc2c2[_0x49a1('0xe5')]&&_0x3a0024[_0x49a1('0xe6')]&&_0x3a0024['forwardOfflineAddress']){var _0x998e15={'tls':{'rejectUnauthorized':![]}};if(_0x5bc2c2[_0x49a1('0xe5')][_0x49a1('0xe7')]){_0x998e15[_0x49a1('0xe7')]=_0x5bc2c2[_0x49a1('0xe5')]['service'];}else{_0x998e15[_0x49a1('0xe8')]=_0x5bc2c2['Smtp']['host'];_0x998e15[_0x49a1('0xe9')]=_0x5bc2c2[_0x49a1('0xe5')]['port'];_0x998e15[_0x49a1('0xea')]=_0x5bc2c2[_0x49a1('0xe5')]['secure'];}if(_0x5bc2c2['Smtp'][_0x49a1('0xeb')]){_0x998e15[_0x49a1('0xec')]={'user':_0x5bc2c2['Smtp'][_0x49a1('0x63')],'pass':_0x5bc2c2[_0x49a1('0xe5')][_0x49a1('0xed')]};}return respondWithRpcPromise(_0x49a1('0xee'),'sendMail',{'account':_0x998e15,'message':{'from':util[_0x49a1('0xb1')](_0x49a1('0xef'),_0x5bc2c2['name'],_0x5bc2c2['email']||_0x5bc2c2[_0x49a1('0xe5')][_0x49a1('0x63')]),'to':_0x3a0024[_0x49a1('0xf0')],'subject':_0x3a0024['offlineMessageSubject'],'html':_0x5425cf[_0x49a1('0x62')],'attachments':_0x39903b}},client9003)['then'](function(){return _0x5425cf;})['catch'](function(_0x13022b){console[_0x49a1('0x27')](_0x13022b);});}})[_0x49a1('0x38')](function(){if(_0x3a0024&&_0x3a0024[_0x49a1('0xdf')]&&_0x3a0024[_0x49a1('0xf1')]){var _0x45bcf3=[];if(_0x47cefd[_0x49a1('0x4d')]){_0x45bcf3=_0x47cefd[_0x49a1('0x42')](function(_0x251139){return{'name':_0x251139[_0x49a1('0xdb')],'basename':_0x251139['filename'],'type':_0x251139[_0x49a1('0xdc')],'ChatOfflineMessageId':_0x5b41b7['id']};});}var _0x4b8f94;if(!_[_0x49a1('0x82')](_0x3a0024[_0x49a1('0xf2')])){var _0x4ad302=_[_0x49a1('0x42')](_0x194a78[_0x49a1('0x62')],function(_0x456ebd){return _0x456ebd;});var _0x489f7c=_[_0x49a1('0xf3')](_0x4ad302)[0x0];var _0x28b600=_['mapValues'](_0x489f7c,function(_0x1c8eeb){return _0x1c8eeb;});_0x4b8f94=_0x28b600[0x1][_0x3a0024[_0x49a1('0xf2')]];}var _0x1282d9={'from':_0x1ce8a3[_0x49a1('0xf4')],'firstName':_0x1ce8a3[_0x49a1('0xbd')],'lastName':_0x1ce8a3[_0x49a1('0xac')],'mapKey':_0x49a1('0xf4'),'message':{'from':_0x1ce8a3[_0x49a1('0xf4')],'to':_0x3a0024[_0x49a1('0xd6')]['email'],'cc':'','subject':_['isNil'](_0x4b8f94)?_0x3a0024[_0x49a1('0xf5')]:_0x4b8f94,'messageId':'','sentAt':new Date(),'attach':_0x45bcf3[_0x49a1('0x4d')],'attachments':_0x45bcf3,'originChannel':_0x49a1('0xf6'),'ChatWebsiteId':_0x3a0024['id'],'ChatOfflineMessageId':_0x5425cf['id'],'originTo':_0x3a0024[_0x49a1('0xd6')][_0x49a1('0xf4')]},'body':_0x5425cf[_0x49a1('0x62')]};var _0x31c163={'account':{'id':_0x3a0024[_0x49a1('0xf1')]},'body':_0x1282d9,'log':'NotifyMailAccount'};return respondWithRpcPromise(_0x49a1('0xf7'),'notifyMail',_0x31c163,client9001)['then'](function(){return _0x5425cf;})[_0x49a1('0x2b')](function(_0x5cf1fd){console[_0x49a1('0x27')](_0x5cf1fd);});}return;})[_0x49a1('0x38')](function(){if(_0x5425cf){return _0x5425cf;}})['then'](respondWithResult(_0x169827,null))[_0x49a1('0x2b')](function(_0x18075a){console[_0x49a1('0x27')](_0x49a1('0x2b'),_0x18075a);for(var _0x5ebed7 of _0x47cefd){var _0x1b019a=path['join'](config[_0x49a1('0x7d')],'server',_0x49a1('0xce'),_0x49a1('0xf8'),_0x49a1('0xf9'),_0x5ebed7['filename']);fs_extra[_0x49a1('0xfa')](_0x1b019a)[_0x49a1('0x2b')](function(_0x339df4){console[_0x49a1('0x27')](_0x49a1('0xfb'),_0x1b019a,_0x339df4);});}});};exports[_0x49a1('0xfc')]=function(_0x1f4490,_0x582f4f,_0x3b60c5){return db[_0x49a1('0xb9')]['find']({'where':{'id':_0x1f4490['params']['id']}})[_0x49a1('0x38')](handleEntityNotFound(_0x582f4f,null))[_0x49a1('0x38')](function(_0x302627){if(_0x302627){return _0x302627[_0x49a1('0xfc')](_0x1f4490[_0x49a1('0x62')][_0x49a1('0x70')],_[_0x49a1('0xfd')](_0x1f4490[_0x49a1('0x62')],[_0x49a1('0x70'),'id'])||{});}})[_0x49a1('0x38')](respondWithResult(_0x582f4f,null))[_0x49a1('0x2b')](handleError(_0x582f4f,null));};exports[_0x49a1('0xfe')]=function(_0xd8bdbe,_0x1b1ae5,_0x2e1ea3){var _0x535a34={'raw':![],'where':{}};var _0x2dfbc3={};var _0x740fc4={'count':0x0,'rows':[]};return db[_0x49a1('0x57')][_0x49a1('0x6e')]({'where':{'id':_0xd8bdbe['params']['id']}})[_0x49a1('0x38')](handleEntityNotFound(_0x1b1ae5,null))[_0x49a1('0x38')](function(_0x26f987){if(_0x26f987){_0x2dfbc3[_0x49a1('0x46')]=_['keys'](db['ChatInteraction'][_0x49a1('0x43')]);_0x2dfbc3[_0x49a1('0x48')]=_[_0x49a1('0x47')](_0xd8bdbe[_0x49a1('0x48')]);_0x2dfbc3[_0x49a1('0x49')]=_['intersection'](_0x2dfbc3[_0x49a1('0x46')],_0x2dfbc3['query']);_0x535a34[_0x49a1('0x4b')]=_[_0x49a1('0x4a')](_0x2dfbc3[_0x49a1('0x46')],qs[_0x49a1('0x4c')](_0xd8bdbe[_0x49a1('0x48')]['fields']));_0x535a34[_0x49a1('0x4b')]=_0x535a34['attributes'][_0x49a1('0x4d')]?_0x535a34[_0x49a1('0x4b')]:_0x2dfbc3[_0x49a1('0x46')];if(!_0xd8bdbe['query'][_0x49a1('0x4e')](_0x49a1('0x4f'))){_0x535a34[_0x49a1('0x31')]=qs[_0x49a1('0x31')](_0xd8bdbe[_0x49a1('0x48')][_0x49a1('0x31')]);_0x535a34['offset']=qs['offset'](_0xd8bdbe[_0x49a1('0x48')][_0x49a1('0x2f')]);}_0x535a34[_0x49a1('0x50')]=qs[_0x49a1('0x51')](_0xd8bdbe['query']['sort']);_0x535a34[_0x49a1('0x52')]=qs['filters'](_['pick'](_0xd8bdbe[_0x49a1('0x48')],_0x2dfbc3['filters']));_0x535a34['where'][_0x49a1('0x6b')]=_0x26f987['id'];if(_0xd8bdbe[_0x49a1('0x48')][_0x49a1('0x54')]){_0x535a34[_0x49a1('0x52')]=_['merge'](_0x535a34['where'],{'$or':_[_0x49a1('0x42')](_0x535a34[_0x49a1('0x4b')],function(_0x5dd743){var _0xaf377e={};_0xaf377e[_0x5dd743]={'$like':'%'+_0xd8bdbe[_0x49a1('0x48')][_0x49a1('0x54')]+'%'};return _0xaf377e;})});}_0x535a34=_[_0x49a1('0x5f')]({},_0x535a34,_0xd8bdbe['options']);return db[_0x49a1('0xb9')][_0x49a1('0x32')]({'where':_0x535a34[_0x49a1('0x52')]})['then'](function(_0x134717){_0x740fc4['count']=_0x134717;if(_0xd8bdbe[_0x49a1('0x48')][_0x49a1('0x5d')]){_0x535a34['include']=[{'model':db[_0x49a1('0x9c')],'as':_0x49a1('0xff'),'required':![]},{'model':db[_0x49a1('0xc6')],'as':_0x49a1('0x100'),'attributes':[_0x49a1('0x3f'),_0x49a1('0x101'),_0x49a1('0x102')],'required':![]},{'model':db[_0x49a1('0x103')],'as':_0x49a1('0x104'),'attributes':['id','name',_0x49a1('0x105')],'where':_0xd8bdbe[_0x49a1('0x48')]['tag']?{'id':_0xd8bdbe[_0x49a1('0x48')][_0x49a1('0x106')]}:undefined,'required':_0xd8bdbe[_0x49a1('0x48')][_0x49a1('0x106')]?!![]:![]}];}return db['ChatInteraction'][_0x49a1('0x58')](_0x535a34);})[_0x49a1('0x38')](function(_0x127f34){_0x740fc4[_0x49a1('0x59')]=_0x127f34;return _0x740fc4;});}})[_0x49a1('0x38')](respondWithFilteredResult(_0x1b1ae5,_0x535a34))[_0x49a1('0x2b')](handleError(_0x1b1ae5,null));};function iftimePromise(_0x5b7791,_0x3987bd){return respondWithRpcPromise('Command',_0x49a1('0x107'),{'command':_0x3987bd[_0x49a1('0x108')]?util[_0x49a1('0xb1')](_0x49a1('0x109'),_0x5b7791[_0x49a1('0x10a')],_0x3987bd[_0x49a1('0x108')]):util[_0x49a1('0xb1')](_0x49a1('0x10b'),_0x5b7791[_0x49a1('0x10a')])},client9002)[_0x49a1('0x38')](function(_0x2db035){var _0x1d49eb=_0x2db035&&_0x2db035['indexOf']('true')>=0x0?!![]:![];logger[_0x49a1('0x22')](_0x49a1('0x10c'),_0x3987bd['id'],_0x5b7791['id'],_0x5b7791['interval'],_0x1d49eb?_0x49a1('0x10d'):_0x49a1('0x10e'),_0x3987bd[_0x49a1('0x108')]?_0x3987bd[_0x49a1('0x108')]:'No\x20timezone');return _0x1d49eb;})[_0x49a1('0x2b')](function(_0x2dbaeb){logger[_0x49a1('0x27')](_0x49a1('0x10c'),_0x3987bd['id'],_0x5b7791['id'],_0x5b7791[_0x49a1('0x10a')],util[_0x49a1('0x10f')](_0x2dbaeb,{'showHidden':![],'depth':null}),_0x3987bd[_0x49a1('0x108')]?_0x3987bd[_0x49a1('0x108')]:'No\x20timezone');return![];});}exports[_0x49a1('0x107')]=function(_0x218be9,_0x164c4e,_0x1aeee1){var _0x3d3900=0x0;var _0x46ddbd=0x0;var _0x43d78f=![];var _0x19b9ed;var _0x6be731;return db[_0x49a1('0x57')][_0x49a1('0x60')]({'where':{'id':_0x218be9[_0x49a1('0x5b')]['id']},'include':[{'model':db['Interval'],'as':_0x49a1('0x110'),'include':[{'model':db[_0x49a1('0x110')],'as':'Intervals','attributes':['id','interval'],'raw':!![]}]}]})[_0x49a1('0x38')](handleEntityNotFound(_0x164c4e,null))[_0x49a1('0x38')](function(_0x5c23f4){if(_0x5c23f4){_0x19b9ed=_0x5c23f4;return _0x5c23f4[_0x49a1('0x111')]({'raw':!![]});}})[_0x49a1('0x38')](function(_0x3e8dbc){if(_0x19b9ed){if(_0x3e8dbc){_0x6be731=_0x3e8dbc;}}return require(_0x49a1('0x18'))['getLicense']();})[_0x49a1('0x38')](function(_0x417436){if(_0x417436){_0x46ddbd=_0x417436['virtual'];_0x43d78f=_0x417436[_0x49a1('0x112')];}})[_0x49a1('0x38')](function(){return db[_0x49a1('0xb9')][_0x49a1('0x32')]({'where':{'closed':![]}});})[_0x49a1('0x38')](function(_0x44901c){_0x3d3900=_0x44901c;if(_0x46ddbd&&_0x44901c>_0x46ddbd){return db['License'][_0x49a1('0x6e')]({'where':{'id':0x1}})[_0x49a1('0x38')](function(_0x72d7b){if(_0x72d7b){_0x72d7b[_0x49a1('0x113')]('chatLicenseExceeded');}});}})['then'](function(){if(_0x19b9ed[_0x49a1('0x110')]&&_0x19b9ed[_0x49a1('0x110')][_0x49a1('0x114')]){var _0x18a579=[];for(var _0x1bb38e=0x0;_0x1bb38e<_0x19b9ed['Interval'][_0x49a1('0x114')][_0x49a1('0x4d')];_0x1bb38e++){var _0x26916c=_0x19b9ed[_0x49a1('0x110')][_0x49a1('0x114')][_0x1bb38e][_0x49a1('0x39')]({'plain':!![]});_0x18a579[_0x49a1('0xc1')](iftimePromise(_0x26916c,_0x19b9ed));}return BPromise['all'](_0x18a579)[_0x49a1('0x38')](function(_0x218d4e){return _['some'](_0x218d4e);});}else{return!![];}})[_0x49a1('0x38')](function(_0x1e2110){var _0x189577=fs[_0x49a1('0xd8')](path[_0x49a1('0x7c')](config[_0x49a1('0x7d')],_0x49a1('0x115')),_0x49a1('0xd9'));var _0x1a2904={'remote':_0x19b9ed[_0x49a1('0x116')],'query':querystring[_0x49a1('0x26')](_['merge'](_0x19b9ed['get']({'plain':!![]}),{'customerIp':_0x218be9[_0x49a1('0x8c')][_0x49a1('0xa9')]||_0x218be9[_0x49a1('0x8c')][_0x49a1('0x117')]||_0x218be9[_0x49a1('0x118')][_0x49a1('0x119')]||_0x218be9['ip'],'referer':_0x218be9['headers'][_0x49a1('0xae')],'openedInteractions':_0x3d3900,'maxInteractions':_0x46ddbd,'virtual':_0x43d78f[_0x49a1('0x11a')],'online':_0x1e2110,'custom':_0x43d78f}))[_0x49a1('0x11b')](/'/g,'\x5c\x27')};_0x164c4e[_0x49a1('0xd1')](ejs[_0x49a1('0x11c')](Mustache['render'](_0x189577,_0x1a2904),{'proactiveActions':_0x6be731,'alignment':_0x19b9ed[_0x49a1('0x11d')],'verticalAlignment':_0x19b9ed[_0x49a1('0x11e')],'div_color':_0x19b9ed['color'],'text_color':_0x19b9ed['textColor'],'button_color':_0x19b9ed[_0x49a1('0x11f')],'background_color':_0x19b9ed[_0x49a1('0x120')]}));})[_0x49a1('0x2b')](handleError(_0x164c4e,null));};exports[_0x49a1('0x121')]=function(_0x1af159,_0x451790,_0x203ef0){return db[_0x49a1('0x57')][_0x49a1('0x6e')]({'where':{'id':_0x1af159[_0x49a1('0x5b')]['id']}})[_0x49a1('0x38')](handleEntityNotFound(_0x451790,null))[_0x49a1('0x38')](function(_0x1fa639){if(_0x1fa639){return db[_0x49a1('0xe0')][_0x49a1('0xe1')](function(_0x2e4c03){return db[_0x49a1('0x9f')][_0x49a1('0x3c')]({'where':{'ChatWebsiteId':_0x1af159[_0x49a1('0x5b')]['id']},'transaction':_0x2e4c03})[_0x49a1('0x38')](function(_0xfe34ea){var _0x505ba2=_[_0x49a1('0x42')](_0x1af159['body'],function(_0x51acc0){_0x51acc0['ChatWebsiteId']=_0x1af159[_0x49a1('0x5b')]['id'];return _0x51acc0;});return db[_0x49a1('0x9f')][_0x49a1('0xe3')](_0x505ba2,{'transaction':_0x2e4c03});});})[_0x49a1('0x38')](function(){return db[_0x49a1('0x9f')][_0x49a1('0x122')]({'where':{'ChatWebsiteId':_0x1af159['params']['id']},'order':_0x49a1('0xa5')});});}})[_0x49a1('0x38')](respondWithResult(_0x451790,null))[_0x49a1('0x2b')](handleError(_0x451790,null));};exports[_0x49a1('0x123')]=function(_0x15c41b,_0x3fca1d,_0x151d64){var _0x532aea={};var _0x5af2e3={};var _0x2201f5;var _0x490841;return db[_0x49a1('0x57')]['findOne']({'where':{'id':_0x15c41b['params']['id']}})['then'](handleEntityNotFound(_0x3fca1d,null))['then'](function(_0x36cdab){if(_0x36cdab){_0x2201f5=_0x36cdab;_0x5af2e3[_0x49a1('0x46')]=_[_0x49a1('0x47')](db['ChatApplication']['rawAttributes']);_0x5af2e3[_0x49a1('0x48')]=_['keys'](_0x15c41b['query']);_0x5af2e3[_0x49a1('0x49')]=_['intersection'](_0x5af2e3[_0x49a1('0x46')],_0x5af2e3['query']);_0x532aea[_0x49a1('0x4b')]=_[_0x49a1('0x4a')](_0x5af2e3[_0x49a1('0x46')],qs[_0x49a1('0x4c')](_0x15c41b[_0x49a1('0x48')][_0x49a1('0x4c')]));_0x532aea[_0x49a1('0x4b')]=_0x532aea[_0x49a1('0x4b')][_0x49a1('0x4d')]?_0x532aea[_0x49a1('0x4b')]:_0x5af2e3[_0x49a1('0x46')];_0x532aea[_0x49a1('0x50')]=qs[_0x49a1('0x51')](_0x15c41b[_0x49a1('0x48')][_0x49a1('0x51')]);_0x532aea[_0x49a1('0x52')]=qs['filters'](_['pick'](_0x15c41b[_0x49a1('0x48')],_0x5af2e3['filters']));if(_0x15c41b[_0x49a1('0x48')]['filter']){_0x532aea['where']=_[_0x49a1('0x5f')](_0x532aea[_0x49a1('0x52')],{'$or':_[_0x49a1('0x42')](_0x532aea['attributes'],function(_0x2a3f78){var _0xc3c16a={};_0xc3c16a[_0x2a3f78]={'$like':'%'+_0x15c41b['query'][_0x49a1('0x54')]+'%'};return _0xc3c16a;})});}_0x532aea=_[_0x49a1('0x5f')]({},_0x532aea,_0x15c41b[_0x49a1('0x56')]);return _0x2201f5[_0x49a1('0x123')](_0x532aea);}})['then'](function(_0x5a38b3){if(_0x5a38b3){_0x490841=_0x5a38b3[_0x49a1('0x4d')];if(!_0x15c41b[_0x49a1('0x48')][_0x49a1('0x4e')]('nolimit')){_0x532aea[_0x49a1('0x31')]=qs['limit'](_0x15c41b['query']['limit']);_0x532aea['offset']=qs[_0x49a1('0x2f')](_0x15c41b[_0x49a1('0x48')]['offset']);}return _0x2201f5[_0x49a1('0x123')](_0x532aea);}})[_0x49a1('0x38')](function(_0x4c4925){if(_0x4c4925){return _0x4c4925?{'count':_0x490841,'rows':_0x4c4925}:null;}})[_0x49a1('0x38')](respondWithResult(_0x3fca1d,null))[_0x49a1('0x2b')](handleError(_0x3fca1d,null));};exports['addProactiveActions']=function(_0x16de80,_0x2e708d,_0x4ac446){return db[_0x49a1('0x124')]['find']({'where':{'id':_0x16de80['params']['id']}})[_0x49a1('0x38')](handleEntityNotFound(_0x2e708d,null))[_0x49a1('0x38')](function(_0x559c17){if(_0x559c17){return _0x559c17[_0x49a1('0x125')](_0x16de80['body'][_0x49a1('0x70')],_[_0x49a1('0xfd')](_0x16de80['body'],[_0x49a1('0x70'),'id'])||{});}})[_0x49a1('0x38')](respondWithResult(_0x2e708d,null))['catch'](handleError(_0x2e708d,null));};exports['getProactiveActions']=function(_0x269b76,_0x3d0f88,_0x4b42b6){var _0x2e3fd7={};var _0x52e112={};var _0x4d2c35;var _0x557fb5;return db[_0x49a1('0x57')][_0x49a1('0x6e')]({'where':{'id':_0x269b76[_0x49a1('0x5b')]['id']}})['then'](handleEntityNotFound(_0x3d0f88,null))[_0x49a1('0x38')](function(_0x12ff75){if(_0x12ff75){_0x4d2c35=_0x12ff75;_0x52e112[_0x49a1('0x46')]=_[_0x49a1('0x47')](db[_0x49a1('0x126')][_0x49a1('0x43')]);_0x52e112[_0x49a1('0x48')]=_['keys'](_0x269b76[_0x49a1('0x48')]);_0x52e112[_0x49a1('0x49')]=_[_0x49a1('0x4a')](_0x52e112[_0x49a1('0x46')],_0x52e112[_0x49a1('0x48')]);_0x2e3fd7['attributes']=_[_0x49a1('0x4a')](_0x52e112[_0x49a1('0x46')],qs[_0x49a1('0x4c')](_0x269b76[_0x49a1('0x48')][_0x49a1('0x4c')]));_0x2e3fd7[_0x49a1('0x4b')]=_0x2e3fd7['attributes'][_0x49a1('0x4d')]?_0x2e3fd7[_0x49a1('0x4b')]:_0x52e112['model'];_0x2e3fd7[_0x49a1('0x50')]=qs[_0x49a1('0x51')](_0x269b76[_0x49a1('0x48')][_0x49a1('0x51')]);_0x2e3fd7[_0x49a1('0x52')]=qs['filters'](_['pick'](_0x269b76['query'],_0x52e112[_0x49a1('0x49')]));if(_0x269b76[_0x49a1('0x48')]['filter']){_0x2e3fd7[_0x49a1('0x52')]=_[_0x49a1('0x5f')](_0x2e3fd7[_0x49a1('0x52')],{'$or':_['map'](_0x2e3fd7[_0x49a1('0x4b')],function(_0x28577e){var _0xf1ca14={};_0xf1ca14[_0x28577e]={'$like':'%'+_0x269b76['query'][_0x49a1('0x54')]+'%'};return _0xf1ca14;})});}_0x2e3fd7=_[_0x49a1('0x5f')]({},_0x2e3fd7,_0x269b76[_0x49a1('0x56')]);return _0x4d2c35['getProactiveActions'](_0x2e3fd7);}})[_0x49a1('0x38')](function(_0x549983){if(_0x549983){_0x557fb5=_0x549983[_0x49a1('0x4d')];if(!_0x269b76[_0x49a1('0x48')][_0x49a1('0x4e')]('nolimit')){_0x2e3fd7[_0x49a1('0x31')]=qs[_0x49a1('0x31')](_0x269b76[_0x49a1('0x48')][_0x49a1('0x31')]);_0x2e3fd7[_0x49a1('0x2f')]=qs['offset'](_0x269b76[_0x49a1('0x48')][_0x49a1('0x2f')]);}return _0x4d2c35[_0x49a1('0x111')](_0x2e3fd7);}})[_0x49a1('0x38')](function(_0x983685){if(_0x983685){return _0x983685?{'count':_0x557fb5,'rows':_0x983685}:null;}})[_0x49a1('0x38')](respondWithResult(_0x3d0f88,null))[_0x49a1('0x2b')](handleError(_0x3d0f88,null));};exports[_0x49a1('0x127')]=function(_0x109aeb,_0x1c0934,_0x342cd4){var _0x552121=_0x109aeb[_0x49a1('0x48')][_0x49a1('0x128')]===_0x49a1('0x129')?_0x49a1('0x12a'):_0x49a1('0x12b');return db[_0x49a1('0x57')]['find']({'attributes':['id',_0x552121],'where':{'id':_0x109aeb[_0x49a1('0x5b')]['id']}})['then'](handleEntityNotFound(_0x1c0934,null))['then'](function(_0x2c9c3e){if(_0x2c9c3e){var _0x488377=_0x2c9c3e[_0x552121];var _0x182f0b=_0x488377&&_0x488377[_0x49a1('0x12c')]?_0x488377[_0x49a1('0x12c')]:[];_0x1c0934[_0x49a1('0xd1')]({'fromKey':_['isNil'](_0x488377['fromKey'])?undefined:_0x488377[_0x49a1('0x12d')],'count':_0x182f0b['length'],'rows':_0x182f0b});}})[_0x49a1('0x2b')](handleError(_0x1c0934,null));};exports[_0x49a1('0x12e')]=function(_0xde4226,_0xa99f4,_0x46279e){var _0xe95373={'raw':![],'where':{}};var _0x19a500={};var _0xc7d5={'count':0x0,'rows':[]};return db[_0x49a1('0x57')][_0x49a1('0x6e')]({'where':{'id':_0xde4226[_0x49a1('0x5b')]['id']}})[_0x49a1('0x38')](handleEntityNotFound(_0xa99f4,null))[_0x49a1('0x38')](function(_0x1a4826){if(_0x1a4826){_0x19a500['model']=_[_0x49a1('0x47')](db['ChatOfflineMessage']['rawAttributes']);_0x19a500['query']=_['keys'](_0xde4226[_0x49a1('0x48')]);_0x19a500[_0x49a1('0x49')]=_['intersection'](_0x19a500[_0x49a1('0x46')],_0x19a500[_0x49a1('0x48')]);_0xe95373[_0x49a1('0x4b')]=_[_0x49a1('0x4a')](_0x19a500['model'],qs[_0x49a1('0x4c')](_0xde4226[_0x49a1('0x48')][_0x49a1('0x4c')]));_0xe95373[_0x49a1('0x4b')]=_0xe95373[_0x49a1('0x4b')][_0x49a1('0x4d')]?_0xe95373[_0x49a1('0x4b')]:_0x19a500[_0x49a1('0x46')];if(!_0xde4226[_0x49a1('0x48')][_0x49a1('0x4e')](_0x49a1('0x4f'))){_0xe95373['limit']=qs[_0x49a1('0x31')](_0xde4226[_0x49a1('0x48')][_0x49a1('0x31')]);_0xe95373['offset']=qs[_0x49a1('0x2f')](_0xde4226[_0x49a1('0x48')][_0x49a1('0x2f')]);}_0xe95373[_0x49a1('0x50')]=qs[_0x49a1('0x51')](_0xde4226[_0x49a1('0x48')]['sort']);_0xe95373['where']=qs[_0x49a1('0x49')](_[_0x49a1('0x53')](_0xde4226[_0x49a1('0x48')],_0x19a500['filters']));_0xe95373[_0x49a1('0x52')][_0x49a1('0x6b')]=_0x1a4826['id'];if(_0xde4226['query'][_0x49a1('0x54')]){_0xe95373[_0x49a1('0x52')]=_[_0x49a1('0x5f')](_0xe95373[_0x49a1('0x52')],{'$or':_[_0x49a1('0x42')](_0xe95373[_0x49a1('0x4b')],function(_0x2a17b4){var _0x354cac={};_0x354cac[_0x2a17b4]={'$like':'%'+_0xde4226['query'][_0x49a1('0x54')]+'%'};return _0x354cac;})});}_0xe95373=_[_0x49a1('0x5f')]({},_0xe95373,_0xde4226[_0x49a1('0x56')]);return db[_0x49a1('0x12f')][_0x49a1('0x32')]({'where':_0xe95373[_0x49a1('0x52')]})[_0x49a1('0x38')](function(_0x108aff){_0xc7d5[_0x49a1('0x32')]=_0x108aff;if(_0xde4226[_0x49a1('0x48')][_0x49a1('0x5d')]){_0xe95373[_0x49a1('0x5e')]=[{'all':!![]}];}else{_0xe95373[_0x49a1('0x5e')]=[{'model':db[_0x49a1('0x9c')],'as':_0x49a1('0xff'),'required':![]},{'model':db[_0x49a1('0xe2')],'as':'Attachments','required':![]}];}return db[_0x49a1('0x12f')][_0x49a1('0x58')](_0xe95373);})['then'](function(_0xfe5374){_0xc7d5[_0x49a1('0x59')]=_0xfe5374;return _0xc7d5;});}})['then'](respondWithFilteredResult(_0xa99f4,_0xe95373))[_0x49a1('0x2b')](handleError(_0xa99f4,null));};exports['addAgents']=function(_0x11b19e,_0x2d6950,_0x301062){return db[_0x49a1('0x57')]['find']({'where':{'id':_0x11b19e['params']['id']}})['then'](handleEntityNotFound(_0x2d6950,null))['then'](function(_0xca56f5){if(_0xca56f5){return _0xca56f5[_0x49a1('0x130')](_0x11b19e[_0x49a1('0x62')][_0x49a1('0x70')],_[_0x49a1('0xfd')](_0x11b19e[_0x49a1('0x62')],[_0x49a1('0x70'),'id'])||{})['spread'](function(_0x387e03){for(var _0x225a2e=0x0;_0x225a2e<_0x11b19e['body']['ids']['length'];_0x225a2e+=0x1){socket[_0x49a1('0x131')](_0x49a1('0x132'),{'UserId':_0x11b19e[_0x49a1('0x62')][_0x49a1('0x70')][_0x225a2e],'ChatWebsiteId':_0x11b19e[_0x49a1('0x5b')]['id']});}return _0x387e03;});}})[_0x49a1('0x38')](respondWithResult(_0x2d6950,null))[_0x49a1('0x2b')](handleError(_0x2d6950,null));};exports[_0x49a1('0x133')]=function(_0x23e9bc,_0x1b80f7,_0x58d6d9){return db[_0x49a1('0x57')][_0x49a1('0x60')]({'where':{'id':_0x23e9bc[_0x49a1('0x5b')]['id']}})[_0x49a1('0x38')](handleEntityNotFound(_0x1b80f7,null))[_0x49a1('0x38')](function(_0x59dff4){if(_0x59dff4){return _0x59dff4[_0x49a1('0x133')](_0x23e9bc[_0x49a1('0x48')][_0x49a1('0x70')])[_0x49a1('0x38')](function(){if(_[_0x49a1('0x134')](_0x23e9bc[_0x49a1('0x48')]['ids'])){for(var _0x37a309=0x0;_0x37a309<_0x23e9bc[_0x49a1('0x48')]['ids'][_0x49a1('0x4d')];_0x37a309+=0x1){socket[_0x49a1('0x131')](_0x49a1('0x135'),{'UserId':Number(_0x23e9bc['query'][_0x49a1('0x70')][_0x37a309]),'ChatWebsiteId':Number(_0x23e9bc[_0x49a1('0x5b')]['id'])});}}else{socket[_0x49a1('0x131')](_0x49a1('0x135'),{'UserId':Number(_0x23e9bc[_0x49a1('0x48')]['ids']),'ChatWebsiteId':Number(_0x23e9bc['params']['id'])});}});}})[_0x49a1('0x38')](respondWithStatusCode(_0x1b80f7,null))[_0x49a1('0x2b')](handleError(_0x1b80f7,null));};exports[_0x49a1('0x136')]=function(_0x43a2e6,_0x43cfb4,_0x517d0a){var _0x211797={};var _0x18758c={};var _0x29e66e;var _0x476071;return db[_0x49a1('0x57')]['findOne']({'where':{'id':_0x43a2e6[_0x49a1('0x5b')]['id']}})[_0x49a1('0x38')](handleEntityNotFound(_0x43cfb4,null))[_0x49a1('0x38')](function(_0x2b31b3){if(_0x2b31b3){_0x29e66e=_0x2b31b3;_0x18758c[_0x49a1('0x46')]=_[_0x49a1('0x47')](db[_0x49a1('0xc6')][_0x49a1('0x43')]);_0x18758c[_0x49a1('0x48')]=_[_0x49a1('0x47')](_0x43a2e6[_0x49a1('0x48')]);_0x18758c[_0x49a1('0x49')]=_['intersection'](_0x18758c[_0x49a1('0x46')],_0x18758c['query']);_0x211797[_0x49a1('0x4b')]=_[_0x49a1('0x4a')](_0x18758c[_0x49a1('0x46')],qs['fields'](_0x43a2e6[_0x49a1('0x48')][_0x49a1('0x4c')]));_0x211797[_0x49a1('0x4b')]=_0x211797[_0x49a1('0x4b')][_0x49a1('0x4d')]?_0x211797[_0x49a1('0x4b')]:_0x18758c['model'];_0x211797[_0x49a1('0x50')]=qs[_0x49a1('0x51')](_0x43a2e6[_0x49a1('0x48')][_0x49a1('0x51')]);_0x211797[_0x49a1('0x52')]=qs['filters'](_[_0x49a1('0x53')](_0x43a2e6[_0x49a1('0x48')],_0x18758c[_0x49a1('0x49')]));if(_0x43a2e6[_0x49a1('0x48')]['filter']){_0x211797[_0x49a1('0x52')]=_[_0x49a1('0x5f')](_0x211797[_0x49a1('0x52')],{'$or':_[_0x49a1('0x42')](_0x211797[_0x49a1('0x4b')],function(_0x26937c){var _0x470605={};_0x470605[_0x26937c]={'$like':'%'+_0x43a2e6[_0x49a1('0x48')][_0x49a1('0x54')]+'%'};return _0x470605;})});}_0x211797=_['merge']({},_0x211797,_0x43a2e6[_0x49a1('0x56')]);return _0x29e66e[_0x49a1('0x136')](_0x211797);}})[_0x49a1('0x38')](function(_0x290e05){if(_0x290e05){_0x476071=_0x290e05[_0x49a1('0x4d')];if(!_0x43a2e6[_0x49a1('0x48')]['hasOwnProperty'](_0x49a1('0x4f'))){_0x211797['limit']=qs[_0x49a1('0x31')](_0x43a2e6[_0x49a1('0x48')]['limit']);_0x211797[_0x49a1('0x2f')]=qs['offset'](_0x43a2e6[_0x49a1('0x48')][_0x49a1('0x2f')]);}return _0x29e66e[_0x49a1('0x136')](_0x211797);}})[_0x49a1('0x38')](function(_0x3c4f1d){if(_0x3c4f1d){return _0x3c4f1d?{'count':_0x476071,'rows':_0x3c4f1d}:null;}})[_0x49a1('0x38')](respondWithResult(_0x43cfb4,null))[_0x49a1('0x2b')](handleError(_0x43cfb4,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index da6a95d..2053520 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 _0x6737=['emit','hasOwnProperty','../../mysqldb','ChatWebsite','save','update','remove'];(function(_0x4f7444,_0x27f48a){var _0x45e3af=function(_0x56e921){while(--_0x56e921){_0x4f7444['push'](_0x4f7444['shift']());}};_0x45e3af(++_0x27f48a);}(_0x6737,0xe2));var _0x7673=function(_0x4c935d,_0x3f53ac){_0x4c935d=_0x4c935d-0x0;var _0x3324c2=_0x6737[_0x4c935d];return _0x3324c2;};'use strict';var EventEmitter=require('events');var ChatWebsite=require(_0x7673('0x0'))['db'][_0x7673('0x1')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x7673('0x2'),'afterUpdate':_0x7673('0x3'),'afterDestroy':_0x7673('0x4')};function emitEvent(_0x12efff){return function(_0x54002e,_0x32e6f2,_0x22ce8d){ChatWebsiteEvents['emit'](_0x12efff+':'+_0x54002e['id'],_0x54002e);ChatWebsiteEvents[_0x7673('0x5')](_0x12efff,_0x54002e);_0x22ce8d(null);};}for(var e in events){if(events[_0x7673('0x6')](e)){var event=events[e];ChatWebsite['hook'](e,emitEvent(event));}}module['exports']=ChatWebsiteEvents; \ No newline at end of file +var _0xd6ce=['ChatWebsite','setMaxListeners','save','update','remove','emit','hasOwnProperty','events','../../mysqldb'];(function(_0x50d289,_0x1a39ad){var _0x1d760c=function(_0x446810){while(--_0x446810){_0x50d289['push'](_0x50d289['shift']());}};_0x1d760c(++_0x1a39ad);}(_0xd6ce,0x127));var _0xed6c=function(_0x5875ad,_0x30c3a3){_0x5875ad=_0x5875ad-0x0;var _0x30280e=_0xd6ce[_0x5875ad];return _0x30280e;};'use strict';var EventEmitter=require(_0xed6c('0x0'));var ChatWebsite=require(_0xed6c('0x1'))['db'][_0xed6c('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0xed6c('0x3')](0x0);var events={'afterCreate':_0xed6c('0x4'),'afterUpdate':_0xed6c('0x5'),'afterDestroy':_0xed6c('0x6')};function emitEvent(_0x111385){return function(_0x5cc704,_0x5881f5,_0x3f0c2d){ChatWebsiteEvents[_0xed6c('0x7')](_0x111385+':'+_0x5cc704['id'],_0x5cc704);ChatWebsiteEvents[_0xed6c('0x7')](_0x111385,_0x5cc704);_0x3f0c2d(null);};}for(var e in events){if(events[_0xed6c('0x8')](e)){var event=events[e];ChatWebsite['hook'](e,emitEvent(event));}}module['exports']=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index 8051e1e..310b2bf 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 _0xba75=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','define','chat_websites'];(function(_0x399941,_0x34b885){var _0x52c9f2=function(_0x21ea6c){while(--_0x21ea6c){_0x399941['push'](_0x399941['shift']());}};_0x52c9f2(++_0x34b885);}(_0xba75,0x118));var _0x5ba7=function(_0x1e9ae1,_0x10dc5d){_0x1e9ae1=_0x1e9ae1-0x0;var _0xc6bc15=_0xba75[_0x1e9ae1];return _0xc6bc15;};'use strict';var _=require(_0x5ba7('0x0'));var util=require(_0x5ba7('0x1'));var logger=require(_0x5ba7('0x2'))(_0x5ba7('0x3'));var moment=require(_0x5ba7('0x4'));var BPromise=require(_0x5ba7('0x5'));var rp=require(_0x5ba7('0x6'));var fs=require('fs');var path=require(_0x5ba7('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./chatWebsite.attributes');module['exports']=function(_0x17b22c,_0x4d3d09){return _0x17b22c[_0x5ba7('0x8')]('ChatWebsite',attributes,{'tableName':_0x5ba7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5794=['path','../../config/environment','./chatWebsite.attributes','exports','define','ChatWebsite','chat_websites','lodash','util','../../config/logger','moment','request-promise'];(function(_0x16bfc5,_0x4f9dc3){var _0x43b820=function(_0x363ced){while(--_0x363ced){_0x16bfc5['push'](_0x16bfc5['shift']());}};_0x43b820(++_0x4f9dc3);}(_0x5794,0x1e7));var _0x4579=function(_0x12d263,_0x1cefdc){_0x12d263=_0x12d263-0x0;var _0x1d4cf5=_0x5794[_0x12d263];return _0x1d4cf5;};'use strict';var _=require(_0x4579('0x0'));var util=require(_0x4579('0x1'));var logger=require(_0x4579('0x2'))('api');var moment=require(_0x4579('0x3'));var BPromise=require('bluebird');var rp=require(_0x4579('0x4'));var fs=require('fs');var path=require(_0x4579('0x5'));var rimraf=require('rimraf');var config=require(_0x4579('0x6'));var attributes=require(_0x4579('0x7'));module[_0x4579('0x8')]=function(_0x402875,_0x41d04c){return _0x402875[_0x4579('0x9')](_0x4579('0xa'),attributes,{'tableName':_0x4579('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.rpc.js b/server/api/chatWebsite/chatWebsite.rpc.js index af1d120..e246021 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 _0x7627=['../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','socket.io-emitter','register','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','ChatWebsite,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x35344b,_0x4af2ba){var _0x2b0a57=function(_0x2d683c){while(--_0x2d683c){_0x35344b['push'](_0x35344b['shift']());}};_0x2b0a57(++_0x4af2ba);}(_0x7627,0x181));var _0x7762=function(_0x24135c,_0x2da912){_0x24135c=_0x24135c-0x0;var _0x59c46e=_0x7627[_0x24135c];return _0x59c46e;};'use strict';var _=require(_0x7762('0x0'));var util=require(_0x7762('0x1'));var moment=require(_0x7762('0x2'));var BPromise=require(_0x7762('0x3'));var rs=require(_0x7762('0x4'));var fs=require('fs');var Redis=require(_0x7762('0x5'));var db=require(_0x7762('0x6'))['db'];var utils=require(_0x7762('0x7'));var logger=require(_0x7762('0x8'))(_0x7762('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x7762('0xa')][_0x7762('0xb')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x7762('0xc'))(new Redis(config['redis']));require('./chatWebsite.socket')[_0x7762('0xd')](socket);function respondWithRpcPromise(_0x2d7325,_0x3ebec1,_0x37b0f3){return new BPromise(function(_0x3110da,_0x16d4b3){return client['request'](_0x2d7325,_0x37b0f3)['then'](function(_0x4f4a7f){logger[_0x7762('0xe')](_0x7762('0xf'),_0x3ebec1,_0x7762('0x10'));logger['debug'](_0x7762('0x11'),_0x3ebec1,_0x7762('0x10'),JSON['stringify'](_0x4f4a7f));if(_0x4f4a7f['error']){if(_0x4f4a7f['error'][_0x7762('0x12')]===0x1f4){logger[_0x7762('0x13')](_0x7762('0xf'),_0x3ebec1,_0x4f4a7f[_0x7762('0x13')]['message']);return _0x16d4b3(_0x4f4a7f[_0x7762('0x13')][_0x7762('0x14')]);}logger[_0x7762('0x13')](_0x7762('0xf'),_0x3ebec1,_0x4f4a7f[_0x7762('0x13')][_0x7762('0x14')]);return _0x3110da(_0x4f4a7f[_0x7762('0x13')][_0x7762('0x14')]);}else{logger['info'](_0x7762('0xf'),_0x3ebec1,_0x7762('0x10'));_0x3110da(_0x4f4a7f[_0x7762('0x15')][_0x7762('0x14')]);}})[_0x7762('0x16')](function(_0x3cfa94){logger[_0x7762('0x13')](_0x7762('0xf'),_0x3ebec1,_0x3cfa94);_0x16d4b3(_0x3cfa94);});});} \ No newline at end of file +var _0xe9cd=['register','request','then','info','request\x20sent','stringify','error','code','message','ChatWebsite,\x20%s,\x20%s','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','./chatWebsite.socket'];(function(_0x3bf5ef,_0x5e0a25){var _0x2a9d7b=function(_0x4b338e){while(--_0x4b338e){_0x3bf5ef['push'](_0x3bf5ef['shift']());}};_0x2a9d7b(++_0x5e0a25);}(_0xe9cd,0xc2));var _0xde9c=function(_0xdea41a,_0x552987){_0xdea41a=_0xdea41a-0x0;var _0x15d0d8=_0xe9cd[_0xdea41a];return _0x15d0d8;};'use strict';var _=require(_0xde9c('0x0'));var util=require(_0xde9c('0x1'));var moment=require(_0xde9c('0x2'));var BPromise=require('bluebird');var rs=require(_0xde9c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xde9c('0x4'))['db'];var utils=require(_0xde9c('0x5'));var logger=require(_0xde9c('0x6'))('rpc');var config=require(_0xde9c('0x7'));var jayson=require(_0xde9c('0x8'));var client=jayson[_0xde9c('0x9')][_0xde9c('0xa')]({'port':0x232a});config[_0xde9c('0xb')]=_[_0xde9c('0xc')](config[_0xde9c('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xde9c('0xb')]));require(_0xde9c('0xd'))[_0xde9c('0xe')](socket);function respondWithRpcPromise(_0x2ec0f3,_0x141a7c,_0x608cdb){return new BPromise(function(_0xb694f4,_0x370952){return client[_0xde9c('0xf')](_0x2ec0f3,_0x608cdb)[_0xde9c('0x10')](function(_0x2969f8){logger[_0xde9c('0x11')]('ChatWebsite,\x20%s,\x20%s',_0x141a7c,'request\x20sent');logger['debug']('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x141a7c,_0xde9c('0x12'),JSON[_0xde9c('0x13')](_0x2969f8));if(_0x2969f8['error']){if(_0x2969f8[_0xde9c('0x14')][_0xde9c('0x15')]===0x1f4){logger[_0xde9c('0x14')]('ChatWebsite,\x20%s,\x20%s',_0x141a7c,_0x2969f8[_0xde9c('0x14')][_0xde9c('0x16')]);return _0x370952(_0x2969f8[_0xde9c('0x14')][_0xde9c('0x16')]);}logger[_0xde9c('0x14')](_0xde9c('0x17'),_0x141a7c,_0x2969f8['error'][_0xde9c('0x16')]);return _0xb694f4(_0x2969f8[_0xde9c('0x14')][_0xde9c('0x16')]);}else{logger[_0xde9c('0x11')]('ChatWebsite,\x20%s,\x20%s',_0x141a7c,'request\x20sent');_0xb694f4(_0x2969f8[_0xde9c('0x18')][_0xde9c('0x16')]);}})[_0xde9c('0x19')](function(_0x3a9207){logger['error']('ChatWebsite,\x20%s,\x20%s',_0x141a7c,_0x3a9207);_0x370952(_0x3a9207);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index 4e0d242..58aa1cf 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 _0xfa76=['chatWebsite:','./chatWebsite.events','remove','update','removeListener','register','length'];(function(_0x245545,_0x4983b3){var _0x106a5f=function(_0x278277){while(--_0x278277){_0x245545['push'](_0x245545['shift']());}};_0x106a5f(++_0x4983b3);}(_0xfa76,0x135));var _0x6fa7=function(_0x3e83a2,_0x1989b6){_0x3e83a2=_0x3e83a2-0x0;var _0x674625=_0xfa76[_0x3e83a2];return _0x674625;};'use strict';var ChatWebsiteEvents=require(_0x6fa7('0x0'));var events=['save',_0x6fa7('0x1'),_0x6fa7('0x2')];function createListener(_0x217004,_0x657409){return function(_0x4739ba){_0x657409['emit'](_0x217004,_0x4739ba);};}function removeListener(_0x32e753,_0x221515){return function(){ChatWebsiteEvents[_0x6fa7('0x3')](_0x32e753,_0x221515);};}exports[_0x6fa7('0x4')]=function(_0x229777){for(var _0x28bc7a=0x0,_0x41e61c=events[_0x6fa7('0x5')];_0x28bc7a<_0x41e61c;_0x28bc7a++){var _0x54a1cd=events[_0x28bc7a];var _0x7ea78a=createListener(_0x6fa7('0x6')+_0x54a1cd,_0x229777);ChatWebsiteEvents['on'](_0x54a1cd,_0x7ea78a);}}; \ No newline at end of file +var _0xf2d4=['length','remove','update','emit','removeListener','register'];(function(_0x564821,_0x4d037e){var _0x2b604d=function(_0x26fabf){while(--_0x26fabf){_0x564821['push'](_0x564821['shift']());}};_0x2b604d(++_0x4d037e);}(_0xf2d4,0xa9));var _0x4f2d=function(_0x4cfe89,_0x59a64d){_0x4cfe89=_0x4cfe89-0x0;var _0x4c817e=_0xf2d4[_0x4cfe89];return _0x4c817e;};'use strict';var ChatWebsiteEvents=require('./chatWebsite.events');var events=['save',_0x4f2d('0x0'),_0x4f2d('0x1')];function createListener(_0x1ab341,_0x3bb273){return function(_0x2bfeaf){_0x3bb273[_0x4f2d('0x2')](_0x1ab341,_0x2bfeaf);};}function removeListener(_0x286cf2,_0x1184e4){return function(){ChatWebsiteEvents[_0x4f2d('0x3')](_0x286cf2,_0x1184e4);};}exports[_0x4f2d('0x4')]=function(_0x583913){for(var _0x4ba885=0x0,_0x5080d1=events[_0x4f2d('0x5')];_0x4ba885<_0x5080d1;_0x4ba885++){var _0x5a45c7=events[_0x4ba885];var _0x2190fd=createListener('chatWebsite:'+_0x5a45c7,_0x583913);ChatWebsiteEvents['on'](_0x5a45c7,_0x2190fd);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index b2e733f..bc8e08c 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 _0x4c32=['/:id/snippet','getSnippet','/:id/applications','/:id/proactive_actions','/:id/fields','getFields','/:id/offline_messages','getOfflineMessages','/:id/users','getAgents','post','create','addDisposition','addAnswer','diskStorage','join','root','format','originalname','single','addLogo','%s-%s','/:id/avatar','file','addAvatar','now','server/files/images/avatars/','addSystemAvatar','/:id/notify','attachments','offline-chat','ensureDir','replace','extname','any','offline','/:id/interactions','addApplications','addProactiveActions','addAgents','put','delete','removeDispositions','removeAnswers','removeAgents','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/dispositions','/:id/canned_answers','/:id/logo','getLogo','getAvatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar'];(function(_0x33be8b,_0x1a33e4){var _0x22d91d=function(_0x10a09e){while(--_0x10a09e){_0x33be8b['push'](_0x33be8b['shift']());}};_0x22d91d(++_0x1a33e4);}(_0x4c32,0x186));var _0x24c3=function(_0x1d6a82,_0x37c315){_0x1d6a82=_0x1d6a82-0x0;var _0x5834ac=_0x4c32[_0x1d6a82];return _0x5834ac;};'use strict';var multer=require(_0x24c3('0x0'));var util=require(_0x24c3('0x1'));var path=require(_0x24c3('0x2'));var timeout=require(_0x24c3('0x3'));var express=require(_0x24c3('0x4'));var router=express[_0x24c3('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x24c3('0x6'));var config=require(_0x24c3('0x7'));var controller=require('./chatWebsite.controller');router['get']('/',auth[_0x24c3('0x8')](),controller[_0x24c3('0x9')]);router[_0x24c3('0xa')](_0x24c3('0xb'),auth['isAuthenticated'](),controller[_0x24c3('0xc')]);router[_0x24c3('0xa')](_0x24c3('0xd'),auth[_0x24c3('0x8')](),controller[_0x24c3('0xe')]);router[_0x24c3('0xa')](_0x24c3('0xf'),auth[_0x24c3('0x8')](),controller['getDispositions']);router[_0x24c3('0xa')](_0x24c3('0x10'),auth['isAuthenticated'](),controller['getAnswers']);router[_0x24c3('0xa')](_0x24c3('0x11'),controller[_0x24c3('0x12')]);router[_0x24c3('0xa')]('/:id/avatar',controller[_0x24c3('0x13')]);router[_0x24c3('0xa')](_0x24c3('0x14'),controller[_0x24c3('0x15')]);router['get'](_0x24c3('0x16'),controller[_0x24c3('0x17')]);router['get']('/:id/interactions',auth[_0x24c3('0x8')](),controller['getInteractions']);router[_0x24c3('0xa')](_0x24c3('0x18'),controller[_0x24c3('0x19')]);router[_0x24c3('0xa')](_0x24c3('0x1a'),auth['isAuthenticated'](),controller['getApplications']);router[_0x24c3('0xa')](_0x24c3('0x1b'),auth[_0x24c3('0x8')](),controller['getProactiveActions']);router[_0x24c3('0xa')](_0x24c3('0x1c'),controller[_0x24c3('0x1d')]);router[_0x24c3('0xa')](_0x24c3('0x1e'),auth[_0x24c3('0x8')](),controller[_0x24c3('0x1f')]);router[_0x24c3('0xa')](_0x24c3('0x20'),auth[_0x24c3('0x8')](),controller[_0x24c3('0x21')]);router[_0x24c3('0x22')]('/',auth[_0x24c3('0x8')](),controller[_0x24c3('0x23')]);router[_0x24c3('0x22')](_0x24c3('0xf'),auth[_0x24c3('0x8')](),controller[_0x24c3('0x24')]);router['post'](_0x24c3('0x10'),auth['isAuthenticated'](),controller[_0x24c3('0x25')]);var upload=multer({'storage':multer[_0x24c3('0x26')]({'destination':function(_0x577f68,_0x378043,_0x4be132){_0x4be132(null,path[_0x24c3('0x27')](config[_0x24c3('0x28')],'server/files/images/logos/'));},'filename':function(_0x2f354f,_0xddd444,_0xe6034){_0xe6034(null,util[_0x24c3('0x29')]('%s-%s',Date['now'](),_0xddd444[_0x24c3('0x2a')]));}})});router[_0x24c3('0x22')]('/:id/logo',upload[_0x24c3('0x2b')]('file'),controller[_0x24c3('0x2c')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x399506,_0x1eb205,_0x57b990){_0x57b990(null,path[_0x24c3('0x27')](config[_0x24c3('0x28')],'server/files/images/avatars/'));},'filename':function(_0x162e34,_0x2025d0,_0x5dc951){_0x5dc951(null,util[_0x24c3('0x29')](_0x24c3('0x2d'),Date['now'](),_0x2025d0['originalname']));}})});router[_0x24c3('0x22')](_0x24c3('0x2e'),upload['single'](_0x24c3('0x2f')),controller[_0x24c3('0x30')]);var upload=multer({'storage':multer[_0x24c3('0x26')]({'destination':function(_0x3f5750,_0x3616ab,_0x281dc){_0x281dc(null,path['join'](config[_0x24c3('0x28')],'server/files/images/avatars/'));},'filename':function(_0xdfa6b8,_0x1f7a7e,_0x284267){_0x284267(null,util[_0x24c3('0x29')](_0x24c3('0x2d'),Date[_0x24c3('0x31')](),_0x1f7a7e['originalname']));}})});router[_0x24c3('0x22')](_0x24c3('0x14'),upload[_0x24c3('0x2b')](_0x24c3('0x2f')),controller['addCustomerAvatar']);var upload=multer({'storage':multer[_0x24c3('0x26')]({'destination':function(_0x45c62f,_0x5baca4,_0x5a6cce){_0x5a6cce(null,path['join'](config['root'],_0x24c3('0x32')));},'filename':function(_0x17849b,_0x57750d,_0x37bf19){_0x37bf19(null,util[_0x24c3('0x29')](_0x24c3('0x2d'),Date[_0x24c3('0x31')](),_0x57750d[_0x24c3('0x2a')]));}})});router[_0x24c3('0x22')](_0x24c3('0x16'),upload[_0x24c3('0x2b')](_0x24c3('0x2f')),controller[_0x24c3('0x33')]);router['post'](_0x24c3('0x34'),controller['notify']);const offlineUploadMulter=multer({'storage':multer[_0x24c3('0x26')]({'destination':function(_0x42bddb,_0x4745ed,_0x2f97bf){const _0x4dc750=path['join'](config['root'],'server/files',_0x24c3('0x35'),_0x24c3('0x36'));fs_extra[_0x24c3('0x37')](_0x4dc750,function(){_0x2f97bf(null,_0x4dc750);});},'filename':function(_0x11fb98,_0x1f66b0,_0x452f16){const _0x43fdd9=_0x1f66b0[_0x24c3('0x2a')][_0x24c3('0x38')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x1109a4=path[_0x24c3('0x39')](_0x43fdd9);const _0x327cd2=Date[_0x24c3('0x31')]()+'-'+_0x43fdd9[_0x24c3('0x38')](_0x1109a4,'')+_0x1109a4;_0x452f16(null,_0x327cd2);}})});router[_0x24c3('0x22')]('/:id/offline',offlineUploadMulter[_0x24c3('0x3a')](),controller[_0x24c3('0x3b')]);router['post'](_0x24c3('0x3c'),auth[_0x24c3('0x8')](),controller['addInteraction']);router[_0x24c3('0x22')]('/:id/applications',auth[_0x24c3('0x8')](),controller[_0x24c3('0x3d')]);router['post'](_0x24c3('0x1b'),auth[_0x24c3('0x8')](),controller[_0x24c3('0x3e')]);router['post'](_0x24c3('0x20'),auth[_0x24c3('0x8')](),controller[_0x24c3('0x3f')]);router[_0x24c3('0x40')]('/:id',auth[_0x24c3('0x8')](),controller['update']);router[_0x24c3('0x41')](_0x24c3('0xd'),auth[_0x24c3('0x8')](),controller['destroy']);router[_0x24c3('0x41')]('/:id/dispositions',auth[_0x24c3('0x8')](),controller[_0x24c3('0x42')]);router['delete']('/:id/canned_answers',auth[_0x24c3('0x8')](),controller[_0x24c3('0x43')]);router[_0x24c3('0x41')](_0x24c3('0x20'),auth[_0x24c3('0x8')](),controller[_0x24c3('0x44')]);module['exports']=router; \ No newline at end of file +var _0x9c7e=['getSnippet','getApplications','/:id/proactive_actions','getProactiveActions','/:id/offline_messages','getOfflineMessages','getAgents','post','create','/:id/dispositions','addDisposition','addAnswer','join','root','server/files/images/logos/','format','%s-%s','now','single','file','diskStorage','server/files/images/avatars/','addAvatar','originalname','addCustomerAvatar','addSystemAvatar','/:id/notify','notify','server/files','attachments','offline-chat','ensureDir','replace','/:id/offline','/:id/applications','addApplications','addProactiveActions','/:id/users','addAgents','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','getDispositions','/:id/canned_answers','getAnswers','/:id/logo','getLogo','/:id/avatar','getAvatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','/:id/interactions','/:id/snippet'];(function(_0x12aec9,_0x5aeb7f){var _0x243bf0=function(_0x57faaf){while(--_0x57faaf){_0x12aec9['push'](_0x12aec9['shift']());}};_0x243bf0(++_0x5aeb7f);}(_0x9c7e,0x190));var _0xe9c7=function(_0x105001,_0x4cbac6){_0x105001=_0x105001-0x0;var _0x597221=_0x9c7e[_0x105001];return _0x597221;};'use strict';var multer=require(_0xe9c7('0x0'));var util=require('util');var path=require(_0xe9c7('0x1'));var timeout=require(_0xe9c7('0x2'));var express=require(_0xe9c7('0x3'));var router=express[_0xe9c7('0x4')]();var fs_extra=require(_0xe9c7('0x5'));var auth=require(_0xe9c7('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xe9c7('0x7'));var controller=require('./chatWebsite.controller');router[_0xe9c7('0x8')]('/',auth[_0xe9c7('0x9')](),controller[_0xe9c7('0xa')]);router[_0xe9c7('0x8')](_0xe9c7('0xb'),auth['isAuthenticated'](),controller[_0xe9c7('0xc')]);router[_0xe9c7('0x8')](_0xe9c7('0xd'),auth['isAuthenticated'](),controller['show']);router[_0xe9c7('0x8')]('/:id/dispositions',auth[_0xe9c7('0x9')](),controller[_0xe9c7('0xe')]);router[_0xe9c7('0x8')](_0xe9c7('0xf'),auth[_0xe9c7('0x9')](),controller[_0xe9c7('0x10')]);router[_0xe9c7('0x8')](_0xe9c7('0x11'),controller[_0xe9c7('0x12')]);router[_0xe9c7('0x8')](_0xe9c7('0x13'),controller[_0xe9c7('0x14')]);router[_0xe9c7('0x8')](_0xe9c7('0x15'),controller[_0xe9c7('0x16')]);router[_0xe9c7('0x8')](_0xe9c7('0x17'),controller['getSystemAvatar']);router['get'](_0xe9c7('0x18'),auth[_0xe9c7('0x9')](),controller['getInteractions']);router['get'](_0xe9c7('0x19'),controller[_0xe9c7('0x1a')]);router[_0xe9c7('0x8')]('/:id/applications',auth[_0xe9c7('0x9')](),controller[_0xe9c7('0x1b')]);router[_0xe9c7('0x8')](_0xe9c7('0x1c'),auth['isAuthenticated'](),controller[_0xe9c7('0x1d')]);router[_0xe9c7('0x8')]('/:id/fields',controller['getFields']);router[_0xe9c7('0x8')](_0xe9c7('0x1e'),auth['isAuthenticated'](),controller[_0xe9c7('0x1f')]);router[_0xe9c7('0x8')]('/:id/users',auth['isAuthenticated'](),controller[_0xe9c7('0x20')]);router[_0xe9c7('0x21')]('/',auth[_0xe9c7('0x9')](),controller[_0xe9c7('0x22')]);router['post'](_0xe9c7('0x23'),auth[_0xe9c7('0x9')](),controller[_0xe9c7('0x24')]);router['post'](_0xe9c7('0xf'),auth['isAuthenticated'](),controller[_0xe9c7('0x25')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0xc2cc09,_0x47c0af,_0x57c79e){_0x57c79e(null,path[_0xe9c7('0x26')](config[_0xe9c7('0x27')],_0xe9c7('0x28')));},'filename':function(_0x3f331a,_0x24e840,_0xb8ec57){_0xb8ec57(null,util[_0xe9c7('0x29')](_0xe9c7('0x2a'),Date[_0xe9c7('0x2b')](),_0x24e840['originalname']));}})});router[_0xe9c7('0x21')](_0xe9c7('0x11'),upload[_0xe9c7('0x2c')](_0xe9c7('0x2d')),controller['addLogo']);var upload=multer({'storage':multer[_0xe9c7('0x2e')]({'destination':function(_0x4327e0,_0x41df74,_0x2ad917){_0x2ad917(null,path[_0xe9c7('0x26')](config[_0xe9c7('0x27')],_0xe9c7('0x2f')));},'filename':function(_0x5b3ca0,_0x32e3c0,_0x58cfea){_0x58cfea(null,util[_0xe9c7('0x29')](_0xe9c7('0x2a'),Date[_0xe9c7('0x2b')](),_0x32e3c0['originalname']));}})});router[_0xe9c7('0x21')]('/:id/avatar',upload['single'](_0xe9c7('0x2d')),controller[_0xe9c7('0x30')]);var upload=multer({'storage':multer[_0xe9c7('0x2e')]({'destination':function(_0x4f8d04,_0x117e8d,_0x905fc4){_0x905fc4(null,path[_0xe9c7('0x26')](config['root'],_0xe9c7('0x2f')));},'filename':function(_0x5f1ec9,_0x36a939,_0x457f8a){_0x457f8a(null,util[_0xe9c7('0x29')](_0xe9c7('0x2a'),Date[_0xe9c7('0x2b')](),_0x36a939[_0xe9c7('0x31')]));}})});router[_0xe9c7('0x21')](_0xe9c7('0x15'),upload['single'](_0xe9c7('0x2d')),controller[_0xe9c7('0x32')]);var upload=multer({'storage':multer[_0xe9c7('0x2e')]({'destination':function(_0x4f9f6c,_0x3abb6d,_0x16ad15){_0x16ad15(null,path[_0xe9c7('0x26')](config['root'],_0xe9c7('0x2f')));},'filename':function(_0x386df6,_0x51de67,_0x4e466d){_0x4e466d(null,util[_0xe9c7('0x29')]('%s-%s',Date['now'](),_0x51de67['originalname']));}})});router['post'](_0xe9c7('0x17'),upload['single']('file'),controller[_0xe9c7('0x33')]);router[_0xe9c7('0x21')](_0xe9c7('0x34'),controller[_0xe9c7('0x35')]);const offlineUploadMulter=multer({'storage':multer['diskStorage']({'destination':function(_0x3fc589,_0x248def,_0x62cee9){const _0x4dd0a2=path['join'](config[_0xe9c7('0x27')],_0xe9c7('0x36'),_0xe9c7('0x37'),_0xe9c7('0x38'));fs_extra[_0xe9c7('0x39')](_0x4dd0a2,function(){_0x62cee9(null,_0x4dd0a2);});},'filename':function(_0x375546,_0x5dd95e,_0x23954a){const _0x469612=_0x5dd95e['originalname'][_0xe9c7('0x3a')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x489767=path['extname'](_0x469612);const _0x209e18=Date[_0xe9c7('0x2b')]()+'-'+_0x469612[_0xe9c7('0x3a')](_0x489767,'')+_0x489767;_0x23954a(null,_0x209e18);}})});router[_0xe9c7('0x21')](_0xe9c7('0x3b'),offlineUploadMulter['any'](),controller['offline']);router[_0xe9c7('0x21')](_0xe9c7('0x18'),auth[_0xe9c7('0x9')](),controller['addInteraction']);router[_0xe9c7('0x21')](_0xe9c7('0x3c'),auth[_0xe9c7('0x9')](),controller[_0xe9c7('0x3d')]);router[_0xe9c7('0x21')](_0xe9c7('0x1c'),auth[_0xe9c7('0x9')](),controller[_0xe9c7('0x3e')]);router[_0xe9c7('0x21')](_0xe9c7('0x3f'),auth[_0xe9c7('0x9')](),controller[_0xe9c7('0x40')]);router['put'](_0xe9c7('0xd'),auth['isAuthenticated'](),controller['update']);router[_0xe9c7('0x41')](_0xe9c7('0xd'),auth[_0xe9c7('0x9')](),controller[_0xe9c7('0x42')]);router[_0xe9c7('0x41')](_0xe9c7('0x23'),auth['isAuthenticated'](),controller[_0xe9c7('0x43')]);router[_0xe9c7('0x41')](_0xe9c7('0xf'),auth['isAuthenticated'](),controller[_0xe9c7('0x44')]);router[_0xe9c7('0x41')](_0xe9c7('0x3f'),auth[_0xe9c7('0x9')](),controller[_0xe9c7('0x45')]);module[_0xe9c7('0x46')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index 042a3cb..f58ba8d 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 _0x6f47=['AmazonAWS','exports','STRING'];(function(_0x359349,_0x131c65){var _0x4b4827=function(_0x779681){while(--_0x779681){_0x359349['push'](_0x359349['shift']());}};_0x4b4827(++_0x131c65);}(_0x6f47,0xc7));var _0x76f4=function(_0x1f9f37,_0x18776e){_0x1f9f37=_0x1f9f37-0x0;var _0x21c080=_0x6f47[_0x1f9f37];return _0x21c080;};'use strict';var Sequelize=require('sequelize');module[_0x76f4('0x0')]={'name':{'type':Sequelize[_0x76f4('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize['ENUM'](_0x76f4('0x2'),'Google'),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize[_0x76f4('0x1')]},'data2':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x93bb=['ENUM','AmazonAWS','Google','sequelize','exports','STRING'];(function(_0x2d8fc2,_0x1c461d){var _0x3a9e53=function(_0x18941c){while(--_0x18941c){_0x2d8fc2['push'](_0x2d8fc2['shift']());}};_0x3a9e53(++_0x1c461d);}(_0x93bb,0x135));var _0xb93b=function(_0x446407,_0x2dcdc0){_0x446407=_0x446407-0x0;var _0xde6209=_0x93bb[_0x446407];return _0xde6209;};'use strict';var Sequelize=require(_0xb93b('0x0'));module[_0xb93b('0x1')]={'name':{'type':Sequelize[_0xb93b('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0xb93b('0x3')](_0xb93b('0x4'),_0xb93b('0x5')),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize[_0xb93b('0x2')]},'data2':{'type':Sequelize[_0xb93b('0x2')]}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index 960fb36..7534424 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 _0xadb5=['model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filters','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','create','body','find','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','end','stack','name','send','index','map','CloudProvider','fieldName','type','key'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0xadb5,0xad));var _0x5adb=function(_0x451e46,_0x28e9f9){_0x451e46=_0x451e46-0x0;var _0x5b0cd0=_0xadb5[_0x451e46];return _0x5b0cd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5adb('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5adb('0x1'));var rp=require(_0x5adb('0x2'));var moment=require(_0x5adb('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x5adb('0x4'));var util=require(_0x5adb('0x5'));var path=require(_0x5adb('0x6'));var sox=require('sox');var csv=require(_0x5adb('0x7'));var ejs=require(_0x5adb('0x8'));var fs=require('fs');var fs_extra=require(_0x5adb('0x9'));var _=require(_0x5adb('0xa'));var squel=require(_0x5adb('0xb'));var crypto=require(_0x5adb('0xc'));var jsforce=require(_0x5adb('0xd'));var deskjs=require(_0x5adb('0xe'));var toCsv=require(_0x5adb('0x7'));var querystring=require(_0x5adb('0xf'));var Papa=require(_0x5adb('0x10'));var Redis=require(_0x5adb('0x11'));var authService=require(_0x5adb('0x12'));var qs=require(_0x5adb('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x5adb('0x14'))(_0x5adb('0x15'));var utils=require(_0x5adb('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x5adb('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2a0b70,_0x5433bf){_0x5433bf=_0x5433bf||0xcc;return function(_0x8cfcc6){if(_0x8cfcc6){return _0x2a0b70[_0x5adb('0x18')](_0x5433bf);}return _0x2a0b70[_0x5adb('0x19')](_0x5433bf)['end']();};}function respondWithResult(_0x2a545b,_0x34af2c){_0x34af2c=_0x34af2c||0xc8;return function(_0xf82f72){if(_0xf82f72){return _0x2a545b['status'](_0x34af2c)[_0x5adb('0x1a')](_0xf82f72);}};}function respondWithFilteredResult(_0x518823,_0x367d82){return function(_0x42a482){if(_0x42a482){var _0x30614e=typeof _0x367d82[_0x5adb('0x1b')]===_0x5adb('0x1c')&&typeof _0x367d82[_0x5adb('0x1d')]===_0x5adb('0x1c');var _0x42f4c6=_0x42a482[_0x5adb('0x1e')];var _0x529b65=_0x30614e?0x0:_0x367d82[_0x5adb('0x1b')];var _0x5de028=_0x30614e?_0x42a482[_0x5adb('0x1e')]:_0x367d82['offset']+_0x367d82[_0x5adb('0x1d')];var _0x50e84f;if(_0x5de028>=_0x42f4c6){_0x5de028=_0x42f4c6;_0x50e84f=0xc8;}else{_0x50e84f=0xce;}_0x518823['status'](_0x50e84f);return _0x518823[_0x5adb('0x1f')](_0x5adb('0x20'),_0x529b65+'-'+_0x5de028+'/'+_0x42f4c6)[_0x5adb('0x1a')](_0x42a482);}return null;};}function patchUpdates(_0x1fd4a7){return function(_0x99bc6c){try{jsonpatch['apply'](_0x99bc6c,_0x1fd4a7,!![]);}catch(_0x3255b3){return BPromise['reject'](_0x3255b3);}return _0x99bc6c['save']();};}function saveUpdates(_0x3754cc,_0x379b33){return function(_0x1a38d3){if(_0x1a38d3){return _0x1a38d3[_0x5adb('0x21')](_0x3754cc)[_0x5adb('0x22')](function(_0x413911){return _0x413911;});}return null;};}function removeEntity(_0xfd9bb9,_0x4ca150){return function(_0x4b1957){if(_0x4b1957){return _0x4b1957[_0x5adb('0x23')]()[_0x5adb('0x22')](function(){_0xfd9bb9[_0x5adb('0x19')](0xcc)[_0x5adb('0x24')]();});}};}function handleEntityNotFound(_0x49f203,_0x2fee18){return function(_0x2e1e63){if(!_0x2e1e63){_0x49f203['sendStatus'](0x194);}return _0x2e1e63;};}function handleError(_0x1feecf,_0x1ded9f){_0x1ded9f=_0x1ded9f||0x1f4;return function(_0x1a0acd){logger['error'](_0x1a0acd[_0x5adb('0x25')]);if(_0x1a0acd[_0x5adb('0x26')]){delete _0x1a0acd[_0x5adb('0x26')];}_0x1feecf[_0x5adb('0x19')](_0x1ded9f)[_0x5adb('0x27')](_0x1a0acd);};}exports[_0x5adb('0x28')]=function(_0x4a5d46,_0x49992e){var _0x5d457e={},_0x39bddd={},_0x1eac55={'count':0x0,'rows':[]};var _0x60a672=_[_0x5adb('0x29')](db[_0x5adb('0x2a')]['rawAttributes'],function(_0x11ec2a){return{'name':_0x11ec2a[_0x5adb('0x2b')],'type':_0x11ec2a[_0x5adb('0x2c')][_0x5adb('0x2d')]};});_0x39bddd[_0x5adb('0x2e')]=_[_0x5adb('0x29')](_0x60a672,_0x5adb('0x26'));_0x39bddd[_0x5adb('0x2f')]=_[_0x5adb('0x30')](_0x4a5d46[_0x5adb('0x2f')]);_0x39bddd['filters']=_[_0x5adb('0x31')](_0x39bddd['model'],_0x39bddd[_0x5adb('0x2f')]);_0x5d457e[_0x5adb('0x32')]=_['intersection'](_0x39bddd[_0x5adb('0x2e')],qs[_0x5adb('0x33')](_0x4a5d46[_0x5adb('0x2f')]['fields']));_0x5d457e[_0x5adb('0x32')]=_0x5d457e[_0x5adb('0x32')]['length']?_0x5d457e['attributes']:_0x39bddd[_0x5adb('0x2e')];if(!_0x4a5d46['query'][_0x5adb('0x34')](_0x5adb('0x35'))){_0x5d457e[_0x5adb('0x1d')]=qs[_0x5adb('0x1d')](_0x4a5d46[_0x5adb('0x2f')]['limit']);_0x5d457e[_0x5adb('0x1b')]=qs[_0x5adb('0x1b')](_0x4a5d46[_0x5adb('0x2f')]['offset']);}_0x5d457e['order']=qs[_0x5adb('0x36')](_0x4a5d46[_0x5adb('0x2f')]['sort']);_0x5d457e[_0x5adb('0x37')]=qs['filters'](_[_0x5adb('0x38')](_0x4a5d46['query'],_0x39bddd[_0x5adb('0x39')]),_0x60a672);if(_0x4a5d46['query'][_0x5adb('0x3a')]){_0x5d457e[_0x5adb('0x37')]=_['merge'](_0x5d457e[_0x5adb('0x37')],{'$or':_['map'](_0x60a672,function(_0xadbe37){if(_0xadbe37[_0x5adb('0x2c')]!==_0x5adb('0x3b')){var _0x50edd1={};_0x50edd1[_0xadbe37[_0x5adb('0x26')]]={'$like':'%'+_0x4a5d46[_0x5adb('0x2f')][_0x5adb('0x3a')]+'%'};return _0x50edd1;}})});}_0x5d457e=_[_0x5adb('0x3c')]({},_0x5d457e,_0x4a5d46[_0x5adb('0x3d')]);var _0x52d74f={'where':_0x5d457e['where']};return db['CloudProvider']['count'](_0x52d74f)[_0x5adb('0x22')](function(_0x2fbe14){_0x1eac55[_0x5adb('0x1e')]=_0x2fbe14;if(_0x4a5d46[_0x5adb('0x2f')][_0x5adb('0x3e')]){_0x5d457e[_0x5adb('0x3f')]=[{'all':!![]}];}return db[_0x5adb('0x2a')][_0x5adb('0x40')](_0x5d457e);})['then'](function(_0x53f2c6){_0x1eac55[_0x5adb('0x41')]=_0x53f2c6;return _0x1eac55;})['then'](respondWithFilteredResult(_0x49992e,_0x5d457e))[_0x5adb('0x42')](handleError(_0x49992e,null));};exports[_0x5adb('0x43')]=function(_0x299746,_0x121714){var _0xdfecfd={'raw':!![],'where':{'id':_0x299746[_0x5adb('0x44')]['id']}},_0x522ee5={};_0x522ee5[_0x5adb('0x2e')]=_['keys'](db[_0x5adb('0x2a')][_0x5adb('0x45')]);_0x522ee5['query']=_[_0x5adb('0x30')](_0x299746[_0x5adb('0x2f')]);_0x522ee5[_0x5adb('0x39')]=_[_0x5adb('0x31')](_0x522ee5[_0x5adb('0x2e')],_0x522ee5[_0x5adb('0x2f')]);_0xdfecfd[_0x5adb('0x32')]=_['intersection'](_0x522ee5['model'],qs[_0x5adb('0x33')](_0x299746[_0x5adb('0x2f')][_0x5adb('0x33')]));_0xdfecfd[_0x5adb('0x32')]=_0xdfecfd['attributes']['length']?_0xdfecfd[_0x5adb('0x32')]:_0x522ee5[_0x5adb('0x2e')];if(_0x299746[_0x5adb('0x2f')][_0x5adb('0x3e')]){_0xdfecfd[_0x5adb('0x3f')]=[{'all':!![]}];}_0xdfecfd=_['merge']({},_0xdfecfd,_0x299746[_0x5adb('0x3d')]);return db[_0x5adb('0x2a')]['find'](_0xdfecfd)[_0x5adb('0x22')](handleEntityNotFound(_0x121714,null))[_0x5adb('0x22')](respondWithResult(_0x121714,null))[_0x5adb('0x42')](handleError(_0x121714,null));};exports[_0x5adb('0x46')]=function(_0x186bd2,_0x3a5409){return db[_0x5adb('0x2a')][_0x5adb('0x46')](_0x186bd2['body'],{})[_0x5adb('0x22')](respondWithResult(_0x3a5409,0xc9))['catch'](handleError(_0x3a5409,null));};exports['update']=function(_0x5015ee,_0x3cd211){if(_0x5015ee[_0x5adb('0x47')]['id']){delete _0x5015ee[_0x5adb('0x47')]['id'];}return db['CloudProvider'][_0x5adb('0x48')]({'where':{'id':_0x5015ee['params']['id']}})[_0x5adb('0x22')](handleEntityNotFound(_0x3cd211,null))[_0x5adb('0x22')](saveUpdates(_0x5015ee[_0x5adb('0x47')],null))['then'](respondWithResult(_0x3cd211,null))[_0x5adb('0x42')](handleError(_0x3cd211,null));};exports['destroy']=function(_0x22fa54,_0x6dc067){return db['CloudProvider'][_0x5adb('0x48')]({'where':{'id':_0x22fa54[_0x5adb('0x44')]['id']}})[_0x5adb('0x22')](handleEntityNotFound(_0x6dc067,null))[_0x5adb('0x22')](removeEntity(_0x6dc067,null))[_0x5adb('0x42')](handleError(_0x6dc067,null));}; \ No newline at end of file +var _0x2ef3=['update','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','CloudProvider','then','includeAll','include','findAll','catch','show','params','keys','create','body','find','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save'];(function(_0x343c8d,_0xa735ac){var _0x270f07=function(_0x191d76){while(--_0x191d76){_0x343c8d['push'](_0x343c8d['shift']());}};_0x270f07(++_0xa735ac);}(_0x2ef3,0xba));var _0x32ef=function(_0x10a7c5,_0x448552){_0x10a7c5=_0x10a7c5-0x0;var _0x3e9dcf=_0x2ef3[_0x10a7c5];return _0x3e9dcf;};'use strict';var emlformat=require(_0x32ef('0x0'));var rimraf=require(_0x32ef('0x1'));var zipdir=require(_0x32ef('0x2'));var jsonpatch=require(_0x32ef('0x3'));var rp=require(_0x32ef('0x4'));var moment=require(_0x32ef('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x32ef('0x6'));var util=require(_0x32ef('0x7'));var path=require('path');var sox=require(_0x32ef('0x8'));var csv=require(_0x32ef('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x32ef('0xa'));var squel=require(_0x32ef('0xb'));var crypto=require(_0x32ef('0xc'));var jsforce=require(_0x32ef('0xd'));var deskjs=require(_0x32ef('0xe'));var toCsv=require(_0x32ef('0x9'));var querystring=require(_0x32ef('0xf'));var Papa=require(_0x32ef('0x10'));var Redis=require(_0x32ef('0x11'));var authService=require(_0x32ef('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x32ef('0x13'));var logger=require(_0x32ef('0x14'))(_0x32ef('0x15'));var utils=require(_0x32ef('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x32ef('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1a5106,_0x49d590){_0x49d590=_0x49d590||0xcc;return function(_0x3e98df){if(_0x3e98df){return _0x1a5106[_0x32ef('0x18')](_0x49d590);}return _0x1a5106['status'](_0x49d590)['end']();};}function respondWithResult(_0x19ce1,_0x4d8009){_0x4d8009=_0x4d8009||0xc8;return function(_0x326fce){if(_0x326fce){return _0x19ce1[_0x32ef('0x19')](_0x4d8009)[_0x32ef('0x1a')](_0x326fce);}};}function respondWithFilteredResult(_0x54c7f5,_0x57aff1){return function(_0x55bf0b){if(_0x55bf0b){var _0x531e30=typeof _0x57aff1[_0x32ef('0x1b')]===_0x32ef('0x1c')&&typeof _0x57aff1[_0x32ef('0x1d')]==='undefined';var _0x5d559b=_0x55bf0b[_0x32ef('0x1e')];var _0x1a9476=_0x531e30?0x0:_0x57aff1[_0x32ef('0x1b')];var _0x57863c=_0x531e30?_0x55bf0b[_0x32ef('0x1e')]:_0x57aff1[_0x32ef('0x1b')]+_0x57aff1['limit'];var _0x304505;if(_0x57863c>=_0x5d559b){_0x57863c=_0x5d559b;_0x304505=0xc8;}else{_0x304505=0xce;}_0x54c7f5[_0x32ef('0x19')](_0x304505);return _0x54c7f5[_0x32ef('0x1f')](_0x32ef('0x20'),_0x1a9476+'-'+_0x57863c+'/'+_0x5d559b)[_0x32ef('0x1a')](_0x55bf0b);}return null;};}function patchUpdates(_0x3aec05){return function(_0x4de441){try{jsonpatch[_0x32ef('0x21')](_0x4de441,_0x3aec05,!![]);}catch(_0x5cc3ef){return BPromise[_0x32ef('0x22')](_0x5cc3ef);}return _0x4de441[_0x32ef('0x23')]();};}function saveUpdates(_0x49f2d8,_0x1af371){return function(_0x97780){if(_0x97780){return _0x97780[_0x32ef('0x24')](_0x49f2d8)['then'](function(_0x57f5e5){return _0x57f5e5;});}return null;};}function removeEntity(_0x22f2d7,_0xb30fab){return function(_0x225feb){if(_0x225feb){return _0x225feb['destroy']()['then'](function(){_0x22f2d7[_0x32ef('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x51a412,_0x278495){return function(_0x14d4b3){if(!_0x14d4b3){_0x51a412[_0x32ef('0x18')](0x194);}return _0x14d4b3;};}function handleError(_0x1dbe98,_0x15ce54){_0x15ce54=_0x15ce54||0x1f4;return function(_0x234175){logger[_0x32ef('0x25')](_0x234175[_0x32ef('0x26')]);if(_0x234175[_0x32ef('0x27')]){delete _0x234175[_0x32ef('0x27')];}_0x1dbe98[_0x32ef('0x19')](_0x15ce54)[_0x32ef('0x28')](_0x234175);};}exports['index']=function(_0xd65fde,_0x2f5d06){var _0x5a04cd={},_0x12de1a={},_0x3c569d={'count':0x0,'rows':[]};var _0x30b250=_[_0x32ef('0x29')](db['CloudProvider'][_0x32ef('0x2a')],function(_0x22bf86){return{'name':_0x22bf86[_0x32ef('0x2b')],'type':_0x22bf86[_0x32ef('0x2c')][_0x32ef('0x2d')]};});_0x12de1a[_0x32ef('0x2e')]=_[_0x32ef('0x29')](_0x30b250,'name');_0x12de1a[_0x32ef('0x2f')]=_['keys'](_0xd65fde[_0x32ef('0x2f')]);_0x12de1a[_0x32ef('0x30')]=_['intersection'](_0x12de1a[_0x32ef('0x2e')],_0x12de1a[_0x32ef('0x2f')]);_0x5a04cd[_0x32ef('0x31')]=_[_0x32ef('0x32')](_0x12de1a[_0x32ef('0x2e')],qs['fields'](_0xd65fde['query'][_0x32ef('0x33')]));_0x5a04cd['attributes']=_0x5a04cd[_0x32ef('0x31')][_0x32ef('0x34')]?_0x5a04cd[_0x32ef('0x31')]:_0x12de1a[_0x32ef('0x2e')];if(!_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x35')]('nolimit')){_0x5a04cd['limit']=qs['limit'](_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x1d')]);_0x5a04cd[_0x32ef('0x1b')]=qs['offset'](_0xd65fde['query'][_0x32ef('0x1b')]);}_0x5a04cd[_0x32ef('0x36')]=qs[_0x32ef('0x37')](_0xd65fde['query']['sort']);_0x5a04cd[_0x32ef('0x38')]=qs[_0x32ef('0x30')](_[_0x32ef('0x39')](_0xd65fde[_0x32ef('0x2f')],_0x12de1a[_0x32ef('0x30')]),_0x30b250);if(_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3a')]){_0x5a04cd[_0x32ef('0x38')]=_[_0x32ef('0x3b')](_0x5a04cd['where'],{'$or':_[_0x32ef('0x29')](_0x30b250,function(_0x36e374){if(_0x36e374[_0x32ef('0x2c')]!=='VIRTUAL'){var _0x365125={};_0x365125[_0x36e374[_0x32ef('0x27')]]={'$like':'%'+_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3a')]+'%'};return _0x365125;}})});}_0x5a04cd=_[_0x32ef('0x3b')]({},_0x5a04cd,_0xd65fde[_0x32ef('0x3c')]);var _0x256c40={'where':_0x5a04cd[_0x32ef('0x38')]};return db[_0x32ef('0x3d')][_0x32ef('0x1e')](_0x256c40)[_0x32ef('0x3e')](function(_0x4615b4){_0x3c569d['count']=_0x4615b4;if(_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3f')]){_0x5a04cd[_0x32ef('0x40')]=[{'all':!![]}];}return db[_0x32ef('0x3d')][_0x32ef('0x41')](_0x5a04cd);})[_0x32ef('0x3e')](function(_0x3c0e44){_0x3c569d['rows']=_0x3c0e44;return _0x3c569d;})['then'](respondWithFilteredResult(_0x2f5d06,_0x5a04cd))[_0x32ef('0x42')](handleError(_0x2f5d06,null));};exports[_0x32ef('0x43')]=function(_0x2a33dd,_0x765c63){var _0x5dca14={'raw':!![],'where':{'id':_0x2a33dd[_0x32ef('0x44')]['id']}},_0x2901a1={};_0x2901a1['model']=_[_0x32ef('0x45')](db['CloudProvider'][_0x32ef('0x2a')]);_0x2901a1[_0x32ef('0x2f')]=_[_0x32ef('0x45')](_0x2a33dd[_0x32ef('0x2f')]);_0x2901a1[_0x32ef('0x30')]=_[_0x32ef('0x32')](_0x2901a1[_0x32ef('0x2e')],_0x2901a1[_0x32ef('0x2f')]);_0x5dca14[_0x32ef('0x31')]=_[_0x32ef('0x32')](_0x2901a1['model'],qs[_0x32ef('0x33')](_0x2a33dd['query'][_0x32ef('0x33')]));_0x5dca14[_0x32ef('0x31')]=_0x5dca14[_0x32ef('0x31')]['length']?_0x5dca14[_0x32ef('0x31')]:_0x2901a1[_0x32ef('0x2e')];if(_0x2a33dd[_0x32ef('0x2f')][_0x32ef('0x3f')]){_0x5dca14[_0x32ef('0x40')]=[{'all':!![]}];}_0x5dca14=_[_0x32ef('0x3b')]({},_0x5dca14,_0x2a33dd[_0x32ef('0x3c')]);return db['CloudProvider']['find'](_0x5dca14)[_0x32ef('0x3e')](handleEntityNotFound(_0x765c63,null))[_0x32ef('0x3e')](respondWithResult(_0x765c63,null))[_0x32ef('0x42')](handleError(_0x765c63,null));};exports[_0x32ef('0x46')]=function(_0x209361,_0xd67dc9){return db[_0x32ef('0x3d')][_0x32ef('0x46')](_0x209361[_0x32ef('0x47')],{})[_0x32ef('0x3e')](respondWithResult(_0xd67dc9,0xc9))[_0x32ef('0x42')](handleError(_0xd67dc9,null));};exports[_0x32ef('0x24')]=function(_0x36a65c,_0x4c2534){if(_0x36a65c[_0x32ef('0x47')]['id']){delete _0x36a65c[_0x32ef('0x47')]['id'];}return db[_0x32ef('0x3d')][_0x32ef('0x48')]({'where':{'id':_0x36a65c[_0x32ef('0x44')]['id']}})[_0x32ef('0x3e')](handleEntityNotFound(_0x4c2534,null))[_0x32ef('0x3e')](saveUpdates(_0x36a65c[_0x32ef('0x47')],null))[_0x32ef('0x3e')](respondWithResult(_0x4c2534,null))[_0x32ef('0x42')](handleError(_0x4c2534,null));};exports[_0x32ef('0x49')]=function(_0x29d456,_0x272377){return db[_0x32ef('0x3d')][_0x32ef('0x48')]({'where':{'id':_0x29d456[_0x32ef('0x44')]['id']}})[_0x32ef('0x3e')](handleEntityNotFound(_0x272377,null))[_0x32ef('0x3e')](removeEntity(_0x272377,null))['catch'](handleError(_0x272377,null));}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index d3790bf..7a3d108 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 _0xc17f=['CloudProvider','cloud_providers','lodash','api','path','rimraf','../../config/environment','./cloudProvider.attributes','exports','define'];(function(_0x4edd0e,_0x5c3e87){var _0x525ad8=function(_0x4015db){while(--_0x4015db){_0x4edd0e['push'](_0x4edd0e['shift']());}};_0x525ad8(++_0x5c3e87);}(_0xc17f,0x98));var _0xfc17=function(_0x32578e,_0x23c75e){_0x32578e=_0x32578e-0x0;var _0xe3459a=_0xc17f[_0x32578e];return _0xe3459a;};'use strict';var _=require(_0xfc17('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xfc17('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xfc17('0x2'));var rimraf=require(_0xfc17('0x3'));var config=require(_0xfc17('0x4'));var attributes=require(_0xfc17('0x5'));module[_0xfc17('0x6')]=function(_0x333dbf,_0x1363db){return _0x333dbf[_0xfc17('0x7')](_0xfc17('0x8'),attributes,{'tableName':_0xfc17('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x573d=['util','../../config/logger','api','bluebird','path','../../config/environment','./cloudProvider.attributes','define','CloudProvider','cloud_providers','lodash'];(function(_0x3e6d5d,_0x264c7a){var _0x238923=function(_0x201b19){while(--_0x201b19){_0x3e6d5d['push'](_0x3e6d5d['shift']());}};_0x238923(++_0x264c7a);}(_0x573d,0x107));var _0xd573=function(_0x4aeaf1,_0x2548a7){_0x4aeaf1=_0x4aeaf1-0x0;var _0x3b190e=_0x573d[_0x4aeaf1];return _0x3b190e;};'use strict';var _=require(_0xd573('0x0'));var util=require(_0xd573('0x1'));var logger=require(_0xd573('0x2'))(_0xd573('0x3'));var moment=require('moment');var BPromise=require(_0xd573('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd573('0x5'));var rimraf=require('rimraf');var config=require(_0xd573('0x6'));var attributes=require(_0xd573('0x7'));module['exports']=function(_0x350a5c,_0x3be837){return _0x350a5c[_0xd573('0x8')](_0xd573('0x9'),attributes,{'tableName':_0xd573('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.rpc.js b/server/api/cloudProvider/cloudProvider.rpc.js index f3b1d38..a42c7d0 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 _0x2faf=['../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','code','CloudProvider,\x20%s,\x20%s','message','result','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x1e5a0c,_0x3a16fc){var _0x5cc15b=function(_0x39e08f){while(--_0x39e08f){_0x1e5a0c['push'](_0x1e5a0c['shift']());}};_0x5cc15b(++_0x3a16fc);}(_0x2faf,0xb0));var _0xf2fa=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x2faf[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0xf2fa('0x0'));var util=require(_0xf2fa('0x1'));var moment=require(_0xf2fa('0x2'));var BPromise=require('bluebird');var rs=require(_0xf2fa('0x3'));var fs=require('fs');var Redis=require(_0xf2fa('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xf2fa('0x5'));var logger=require(_0xf2fa('0x6'))(_0xf2fa('0x7'));var config=require(_0xf2fa('0x8'));var jayson=require(_0xf2fa('0x9'));var client=jayson[_0xf2fa('0xa')][_0xf2fa('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4c7035,_0x2fcd02,_0x3287ac){return new BPromise(function(_0x28ca24,_0x19ce5a){return client['request'](_0x4c7035,_0x3287ac)[_0xf2fa('0xc')](function(_0x530819){logger[_0xf2fa('0xd')]('CloudProvider,\x20%s,\x20%s',_0x2fcd02,_0xf2fa('0xe'));logger[_0xf2fa('0xf')](_0xf2fa('0x10'),_0x2fcd02,_0xf2fa('0xe'),JSON[_0xf2fa('0x11')](_0x530819));if(_0x530819[_0xf2fa('0x12')]){if(_0x530819[_0xf2fa('0x12')][_0xf2fa('0x13')]===0x1f4){logger[_0xf2fa('0x12')](_0xf2fa('0x14'),_0x2fcd02,_0x530819['error'][_0xf2fa('0x15')]);return _0x19ce5a(_0x530819[_0xf2fa('0x12')][_0xf2fa('0x15')]);}logger[_0xf2fa('0x12')](_0xf2fa('0x14'),_0x2fcd02,_0x530819[_0xf2fa('0x12')][_0xf2fa('0x15')]);return _0x28ca24(_0x530819[_0xf2fa('0x12')]['message']);}else{logger[_0xf2fa('0xd')]('CloudProvider,\x20%s,\x20%s',_0x2fcd02,_0xf2fa('0xe'));_0x28ca24(_0x530819[_0xf2fa('0x16')]['message']);}})['catch'](function(_0x1db062){logger[_0xf2fa('0x12')](_0xf2fa('0x14'),_0x2fcd02,_0x1db062);_0x19ce5a(_0x1db062);});});} \ No newline at end of file +var _0x9db7=['client','http','request','then','CloudProvider,\x20%s,\x20%s','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0xb153b1,_0x36d627){var _0x330339=function(_0x76eeb9){while(--_0x76eeb9){_0xb153b1['push'](_0xb153b1['shift']());}};_0x330339(++_0x36d627);}(_0x9db7,0x1bf));var _0x79db=function(_0x55ffb7,_0x2d21e0){_0x55ffb7=_0x55ffb7-0x0;var _0x49863e=_0x9db7[_0x55ffb7];return _0x49863e;};'use strict';var _=require(_0x79db('0x0'));var util=require(_0x79db('0x1'));var moment=require(_0x79db('0x2'));var BPromise=require(_0x79db('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x79db('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x79db('0x5'));var logger=require(_0x79db('0x6'))('rpc');var config=require(_0x79db('0x7'));var jayson=require(_0x79db('0x8'));var client=jayson[_0x79db('0x9')][_0x79db('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x7980b1,_0x395883,_0x214bf9){return new BPromise(function(_0x792510,_0x27d02a){return client[_0x79db('0xb')](_0x7980b1,_0x214bf9)[_0x79db('0xc')](function(_0x145a31){logger['info'](_0x79db('0xd'),_0x395883,_0x79db('0xe'));logger[_0x79db('0xf')](_0x79db('0x10'),_0x395883,_0x79db('0xe'),JSON[_0x79db('0x11')](_0x145a31));if(_0x145a31[_0x79db('0x12')]){if(_0x145a31[_0x79db('0x12')][_0x79db('0x13')]===0x1f4){logger['error']('CloudProvider,\x20%s,\x20%s',_0x395883,_0x145a31['error'][_0x79db('0x14')]);return _0x27d02a(_0x145a31['error'][_0x79db('0x14')]);}logger['error'](_0x79db('0xd'),_0x395883,_0x145a31[_0x79db('0x12')][_0x79db('0x14')]);return _0x792510(_0x145a31[_0x79db('0x12')][_0x79db('0x14')]);}else{logger[_0x79db('0x15')](_0x79db('0xd'),_0x395883,_0x79db('0xe'));_0x792510(_0x145a31[_0x79db('0x16')][_0x79db('0x14')]);}})[_0x79db('0x17')](function(_0x365889){logger[_0x79db('0x12')]('CloudProvider,\x20%s,\x20%s',_0x395883,_0x365889);_0x27d02a(_0x365889);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index 53c06e7..bc35a6e 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 _0xc7b4=['../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','show','create','update','delete','/:id','destroy','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x54aec7,_0x5184ce){var _0x209eab=function(_0x258812){while(--_0x258812){_0x54aec7['push'](_0x54aec7['shift']());}};_0x209eab(++_0x5184ce);}(_0xc7b4,0x9b));var _0x4c7b=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xc7b4[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x4c7b('0x0'));var util=require(_0x4c7b('0x1'));var path=require(_0x4c7b('0x2'));var timeout=require(_0x4c7b('0x3'));var express=require(_0x4c7b('0x4'));var router=express[_0x4c7b('0x5')]();var fs_extra=require(_0x4c7b('0x6'));var auth=require(_0x4c7b('0x7'));var interaction=require(_0x4c7b('0x8'));var config=require('../../config/environment');var controller=require('./cloudProvider.controller');router[_0x4c7b('0x9')]('/',auth[_0x4c7b('0xa')](),controller[_0x4c7b('0xb')]);router['get']('/:id',auth[_0x4c7b('0xa')](),controller[_0x4c7b('0xc')]);router['post']('/',auth[_0x4c7b('0xa')](),controller[_0x4c7b('0xd')]);router['put']('/:id',auth[_0x4c7b('0xa')](),controller[_0x4c7b('0xe')]);router[_0x4c7b('0xf')](_0x4c7b('0x10'),auth[_0x4c7b('0xa')](),controller[_0x4c7b('0x11')]);module['exports']=router; \ No newline at end of file +var _0xf0be=['path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./cloudProvider.controller','get','index','/:id','show','post','isAuthenticated','update','delete','multer'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xf0be,0x1cf));var _0xef0b=function(_0x2293aa,_0x2982b4){_0x2293aa=_0x2293aa-0x0;var _0x10ed1c=_0xf0be[_0x2293aa];return _0x10ed1c;};'use strict';var multer=require(_0xef0b('0x0'));var util=require('util');var path=require(_0xef0b('0x1'));var timeout=require(_0xef0b('0x2'));var express=require(_0xef0b('0x3'));var router=express[_0xef0b('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xef0b('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xef0b('0x6'));var controller=require(_0xef0b('0x7'));router[_0xef0b('0x8')]('/',auth['isAuthenticated'](),controller[_0xef0b('0x9')]);router[_0xef0b('0x8')](_0xef0b('0xa'),auth['isAuthenticated'](),controller[_0xef0b('0xb')]);router[_0xef0b('0xc')]('/',auth[_0xef0b('0xd')](),controller['create']);router['put']('/:id',auth[_0xef0b('0xd')](),controller[_0xef0b('0xe')]);router[_0xef0b('0xf')](_0xef0b('0xa'),auth[_0xef0b('0xd')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index f390243..2871829 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 _0x2d22=['name','sequelize','exports','STRING'];(function(_0x5c7e72,_0x4d4cc5){var _0x47ac0f=function(_0x14dbe0){while(--_0x14dbe0){_0x5c7e72['push'](_0x5c7e72['shift']());}};_0x47ac0f(++_0x4d4cc5);}(_0x2d22,0x1bd));var _0x22d2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2d22[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x22d2('0x0'));module[_0x22d2('0x1')]={'name':{'type':Sequelize[_0x22d2('0x2')],'unique':_0x22d2('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x22d2('0x2')]},'companyId':{'type':Sequelize[_0x22d2('0x2')]},'website':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x22d2('0x2')]},'fax':{'type':Sequelize[_0x22d2('0x2')]},'type':{'type':Sequelize[_0x22d2('0x2')]},'street':{'type':Sequelize[_0x22d2('0x2')]},'postalCode':{'type':Sequelize[_0x22d2('0x2')]},'city':{'type':Sequelize[_0x22d2('0x2')]},'country':{'type':Sequelize['STRING']},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x22d2('0x2')]},'sStreet':{'type':Sequelize['STRING']},'sPostalCode':{'type':Sequelize[_0x22d2('0x2')]},'sCity':{'type':Sequelize[_0x22d2('0x2')]},'sCountry':{'type':Sequelize[_0x22d2('0x2')]},'description':{'type':Sequelize[_0x22d2('0x2')]}}; \ No newline at end of file +var _0x3114=['exports','STRING','name','sequelize'];(function(_0xae7c2f,_0xf31e04){var _0x5d7001=function(_0x4eeadb){while(--_0x4eeadb){_0xae7c2f['push'](_0xae7c2f['shift']());}};_0x5d7001(++_0xf31e04);}(_0x3114,0x19f));var _0x4311=function(_0x331399,_0x1082b9){_0x331399=_0x331399-0x0;var _0x3d7868=_0x3114[_0x331399];return _0x3d7868;};'use strict';var Sequelize=require(_0x4311('0x0'));module[_0x4311('0x1')]={'name':{'type':Sequelize[_0x4311('0x2')],'unique':_0x4311('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x4311('0x2')]},'companyId':{'type':Sequelize[_0x4311('0x2')]},'website':{'type':Sequelize[_0x4311('0x2')]},'phone':{'type':Sequelize[_0x4311('0x2')]},'fax':{'type':Sequelize[_0x4311('0x2')]},'type':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0x4311('0x2')]},'postalCode':{'type':Sequelize[_0x4311('0x2')]},'city':{'type':Sequelize[_0x4311('0x2')]},'country':{'type':Sequelize[_0x4311('0x2')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x4311('0x2')]},'sStreet':{'type':Sequelize[_0x4311('0x2')]},'sPostalCode':{'type':Sequelize[_0x4311('0x2')]},'sCity':{'type':Sequelize[_0x4311('0x2')]},'sCountry':{'type':Sequelize[_0x4311('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index 5a16d6e..036f1f2 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 _0x8e30=['stack','name','send','index','describe','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','map','options','CmCompany','includeAll','include','findAll','rows','catch','show','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','params','addContacts','CmContact','ids','omit','getContacts','findOne','rawAttributes','eml-format','rimraf','fast-json-patch','request-promise','bluebird','util','path','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','set','apply','save','update','destroy','then','get','Companies','UserProfileResource','error'];(function(_0x4ac8a1,_0x4ad1a8){var _0x2c15c7=function(_0x54b106){while(--_0x54b106){_0x4ac8a1['push'](_0x4ac8a1['shift']());}};_0x2c15c7(++_0x4ad1a8);}(_0x8e30,0x135));var _0x08e3=function(_0x3095c1,_0x28b036){_0x3095c1=_0x3095c1-0x0;var _0x57b610=_0x8e30[_0x3095c1];return _0x57b610;};'use strict';var emlformat=require(_0x08e3('0x0'));var rimraf=require(_0x08e3('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x08e3('0x2'));var rp=require(_0x08e3('0x3'));var moment=require('moment');var BPromise=require(_0x08e3('0x4'));var Mustache=require('mustache');var util=require(_0x08e3('0x5'));var path=require(_0x08e3('0x6'));var sox=require('sox');var csv=require(_0x08e3('0x7'));var ejs=require(_0x08e3('0x8'));var fs=require('fs');var fs_extra=require(_0x08e3('0x9'));var _=require(_0x08e3('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x08e3('0xb'));var deskjs=require(_0x08e3('0xc'));var toCsv=require('to-csv');var querystring=require(_0x08e3('0xd'));var Papa=require(_0x08e3('0xe'));var Redis=require('ioredis');var authService=require(_0x08e3('0xf'));var qs=require(_0x08e3('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x08e3('0x11'));var logger=require(_0x08e3('0x12'))('api');var utils=require(_0x08e3('0x13'));var config=require(_0x08e3('0x14'));var licenseUtil=require(_0x08e3('0x15'));var db=require(_0x08e3('0x16'))['db'];function respondWithStatusCode(_0x113b84,_0x2cd8f4){_0x2cd8f4=_0x2cd8f4||0xcc;return function(_0x68f6df){if(_0x68f6df){return _0x113b84[_0x08e3('0x17')](_0x2cd8f4);}return _0x113b84[_0x08e3('0x18')](_0x2cd8f4)['end']();};}function respondWithResult(_0x19c80e,_0x53e680){_0x53e680=_0x53e680||0xc8;return function(_0x4d99a3){if(_0x4d99a3){return _0x19c80e[_0x08e3('0x18')](_0x53e680)[_0x08e3('0x19')](_0x4d99a3);}};}function respondWithFilteredResult(_0x1320fd,_0x4a1589){return function(_0x3116d6){if(_0x3116d6){var _0x4ef48d=typeof _0x4a1589['offset']===_0x08e3('0x1a')&&typeof _0x4a1589['limit']===_0x08e3('0x1a');var _0x25c1d4=_0x3116d6[_0x08e3('0x1b')];var _0x4e794b=_0x4ef48d?0x0:_0x4a1589[_0x08e3('0x1c')];var _0x36628e=_0x4ef48d?_0x3116d6[_0x08e3('0x1b')]:_0x4a1589[_0x08e3('0x1c')]+_0x4a1589['limit'];var _0x447b03;if(_0x36628e>=_0x25c1d4){_0x36628e=_0x25c1d4;_0x447b03=0xc8;}else{_0x447b03=0xce;}_0x1320fd[_0x08e3('0x18')](_0x447b03);return _0x1320fd[_0x08e3('0x1d')]('Content-Range',_0x4e794b+'-'+_0x36628e+'/'+_0x25c1d4)[_0x08e3('0x19')](_0x3116d6);}return null;};}function patchUpdates(_0x477ca4){return function(_0x4dbf83){try{jsonpatch[_0x08e3('0x1e')](_0x4dbf83,_0x477ca4,!![]);}catch(_0x8b5a09){return BPromise['reject'](_0x8b5a09);}return _0x4dbf83[_0x08e3('0x1f')]();};}function saveUpdates(_0x8589e4,_0x3bde89){return function(_0x52b560){if(_0x52b560){return _0x52b560[_0x08e3('0x20')](_0x8589e4)['then'](function(_0x110cc3){return _0x110cc3;});}return null;};}function removeEntity(_0x70db2d,_0x184dc4){return function(_0x4f8099){if(_0x4f8099){return _0x4f8099[_0x08e3('0x21')]()[_0x08e3('0x22')](function(){var _0x309b11=_0x4f8099[_0x08e3('0x23')]({'plain':!![]});var _0x35752d=_0x08e3('0x24');return db[_0x08e3('0x25')][_0x08e3('0x21')]({'where':{'type':_0x35752d,'resourceId':_0x309b11['id']}})[_0x08e3('0x22')](function(){return _0x4f8099;});})[_0x08e3('0x22')](function(){_0x70db2d[_0x08e3('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x38f1b2,_0xd18c5a){return function(_0x215224){if(!_0x215224){_0x38f1b2[_0x08e3('0x17')](0x194);}return _0x215224;};}function handleError(_0x5a0938,_0x13cd56){_0x13cd56=_0x13cd56||0x1f4;return function(_0x15bf61){logger[_0x08e3('0x26')](_0x15bf61[_0x08e3('0x27')]);if(_0x15bf61[_0x08e3('0x28')]){delete _0x15bf61[_0x08e3('0x28')];}_0x5a0938[_0x08e3('0x18')](_0x13cd56)[_0x08e3('0x29')](_0x15bf61);};}exports[_0x08e3('0x2a')]=function(_0x1e986a,_0x450fc3){var _0x2cc813={},_0xb590a7={},_0x4dc5cc={'count':0x0,'rows':[]};return db['CmCompany'][_0x08e3('0x2b')]()['then'](function(_0x21627a){_0xb590a7[_0x08e3('0x2c')]=_[_0x08e3('0x2d')](_0x21627a);_0xb590a7[_0x08e3('0x2e')]=_['keys'](_0x1e986a['query']);_0xb590a7[_0x08e3('0x2f')]=_['intersection'](_0xb590a7[_0x08e3('0x2c')],_0xb590a7[_0x08e3('0x2e')]);_0x2cc813[_0x08e3('0x30')]=_[_0x08e3('0x31')](_0xb590a7[_0x08e3('0x2c')],qs[_0x08e3('0x32')](_0x1e986a['query'][_0x08e3('0x32')]));_0x2cc813['attributes']=_0x2cc813[_0x08e3('0x30')][_0x08e3('0x33')]?_0x2cc813[_0x08e3('0x30')]:_0xb590a7[_0x08e3('0x2c')];if(!_0x1e986a[_0x08e3('0x2e')][_0x08e3('0x34')](_0x08e3('0x35'))){_0x2cc813[_0x08e3('0x36')]=qs[_0x08e3('0x36')](_0x1e986a[_0x08e3('0x2e')][_0x08e3('0x36')]);_0x2cc813[_0x08e3('0x1c')]=qs[_0x08e3('0x1c')](_0x1e986a['query'][_0x08e3('0x1c')]);}_0x2cc813[_0x08e3('0x37')]=qs[_0x08e3('0x38')](_0x1e986a[_0x08e3('0x2e')][_0x08e3('0x38')]);_0x2cc813[_0x08e3('0x39')]=qs[_0x08e3('0x2f')](_[_0x08e3('0x3a')](_0x1e986a[_0x08e3('0x2e')],_0xb590a7[_0x08e3('0x2f')]),_0x21627a);if(_0x1e986a[_0x08e3('0x2e')][_0x08e3('0x3b')]){_0x2cc813['where']=_[_0x08e3('0x3c')](_0x2cc813[_0x08e3('0x39')],{'$or':_[_0x08e3('0x3d')](_0x2cc813[_0x08e3('0x30')],function(_0x35750a){var _0xa3c36f={};_0xa3c36f[_0x35750a]={'$like':'%'+_0x1e986a['query'][_0x08e3('0x3b')]+'%'};return _0xa3c36f;})});}_0x2cc813=_[_0x08e3('0x3c')]({},_0x2cc813,_0x1e986a[_0x08e3('0x3e')]);var _0x5eaca7={'where':_0x2cc813[_0x08e3('0x39')]};return db[_0x08e3('0x3f')][_0x08e3('0x1b')](_0x5eaca7)[_0x08e3('0x22')](function(_0x5d352f){_0x4dc5cc[_0x08e3('0x1b')]=_0x5d352f;if(_0x1e986a[_0x08e3('0x2e')][_0x08e3('0x40')]){_0x2cc813[_0x08e3('0x41')]=[{'all':!![]}];}return db[_0x08e3('0x3f')][_0x08e3('0x42')](_0x2cc813);})[_0x08e3('0x22')](function(_0x1c8530){_0x4dc5cc[_0x08e3('0x43')]=_0x1c8530;return _0x4dc5cc;})['then'](respondWithFilteredResult(_0x450fc3,_0x2cc813))[_0x08e3('0x44')](handleError(_0x450fc3,null));})[_0x08e3('0x44')](handleError(_0x450fc3,null));};exports[_0x08e3('0x45')]=function(_0xaadd4f,_0x29c0b2){var _0xc11e62={'raw':![],'where':{'id':_0xaadd4f['params']['id']}},_0x47903f={};_0x47903f[_0x08e3('0x2c')]=_[_0x08e3('0x2d')](db[_0x08e3('0x3f')]['rawAttributes']);_0x47903f['query']=_[_0x08e3('0x2d')](_0xaadd4f[_0x08e3('0x2e')]);_0x47903f[_0x08e3('0x2f')]=_[_0x08e3('0x31')](_0x47903f[_0x08e3('0x2c')],_0x47903f['query']);_0xc11e62[_0x08e3('0x30')]=_[_0x08e3('0x31')](_0x47903f['model'],qs['fields'](_0xaadd4f[_0x08e3('0x2e')]['fields']));_0xc11e62['attributes']=_0xc11e62['attributes'][_0x08e3('0x33')]?_0xc11e62['attributes']:_0x47903f[_0x08e3('0x2c')];if(_0xaadd4f[_0x08e3('0x2e')][_0x08e3('0x40')]){_0xc11e62[_0x08e3('0x41')]=[{'all':!![]}];}_0xc11e62=_[_0x08e3('0x3c')]({},_0xc11e62,_0xaadd4f[_0x08e3('0x3e')]);return db[_0x08e3('0x3f')]['find'](_0xc11e62)[_0x08e3('0x22')](handleEntityNotFound(_0x29c0b2,null))[_0x08e3('0x22')](respondWithResult(_0x29c0b2,null))[_0x08e3('0x44')](handleError(_0x29c0b2,null));};exports[_0x08e3('0x46')]=function(_0x5d8818,_0x76b0f4){return db[_0x08e3('0x3f')]['create'](_0x5d8818[_0x08e3('0x47')],{})[_0x08e3('0x22')](function(_0x4d6718){var _0x334a76=_0x5d8818[_0x08e3('0x48')][_0x08e3('0x23')]({'plain':!![]});if(!_0x334a76)throw new Error(_0x08e3('0x49'));if(_0x334a76[_0x08e3('0x4a')]==='user'){var _0x45305d=_0x4d6718[_0x08e3('0x23')]({'plain':!![]});var _0x3e14e7=_0x08e3('0x24');return db[_0x08e3('0x4b')][_0x08e3('0x4c')]({'where':{'name':_0x3e14e7,'userProfileId':_0x334a76[_0x08e3('0x4d')]},'raw':!![]})[_0x08e3('0x22')](function(_0x3aadab){if(_0x3aadab&&_0x3aadab[_0x08e3('0x4e')]===0x0){return db['UserProfileResource']['create']({'name':_0x45305d[_0x08e3('0x28')],'resourceId':_0x45305d['id'],'type':_0x3aadab[_0x08e3('0x28')],'sectionId':_0x3aadab['id']},{})['then'](function(){return _0x4d6718;});}else{return _0x4d6718;}})[_0x08e3('0x44')](function(_0x9b16ac){logger[_0x08e3('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x9b16ac);throw _0x9b16ac;});}return _0x4d6718;})[_0x08e3('0x22')](respondWithResult(_0x76b0f4,0xc9))[_0x08e3('0x44')](handleError(_0x76b0f4,null));};exports[_0x08e3('0x20')]=function(_0x255589,_0x4e346b){if(_0x255589[_0x08e3('0x47')]['id']){delete _0x255589['body']['id'];}return db[_0x08e3('0x3f')][_0x08e3('0x4c')]({'where':{'id':_0x255589[_0x08e3('0x4f')]['id']}})['then'](handleEntityNotFound(_0x4e346b,null))['then'](saveUpdates(_0x255589['body'],null))[_0x08e3('0x22')](respondWithResult(_0x4e346b,null))[_0x08e3('0x44')](handleError(_0x4e346b,null));};exports['destroy']=function(_0x5c8244,_0x32d7ad){return db[_0x08e3('0x3f')][_0x08e3('0x4c')]({'where':{'id':_0x5c8244[_0x08e3('0x4f')]['id']}})[_0x08e3('0x22')](handleEntityNotFound(_0x32d7ad,null))[_0x08e3('0x22')](removeEntity(_0x32d7ad,null))[_0x08e3('0x44')](handleError(_0x32d7ad,null));};exports[_0x08e3('0x2b')]=function(_0x3fc52b,_0x28a427){return db[_0x08e3('0x3f')]['describe']()[_0x08e3('0x22')](respondWithResult(_0x28a427,null))[_0x08e3('0x44')](handleError(_0x28a427,null));};exports[_0x08e3('0x50')]=function(_0x32c0fd,_0x252dc1,_0xf8813a){return db[_0x08e3('0x51')][_0x08e3('0x4c')]({'where':{'id':_0x32c0fd[_0x08e3('0x4f')]['id']}})[_0x08e3('0x22')](handleEntityNotFound(_0x252dc1,null))[_0x08e3('0x22')](function(_0x580528){if(_0x580528){return _0x580528[_0x08e3('0x50')](_0x32c0fd[_0x08e3('0x47')][_0x08e3('0x52')],_[_0x08e3('0x53')](_0x32c0fd[_0x08e3('0x47')],['ids','id'])||{});}})[_0x08e3('0x22')](respondWithResult(_0x252dc1,null))[_0x08e3('0x44')](handleError(_0x252dc1,null));};exports[_0x08e3('0x54')]=function(_0x31a133,_0x1aba6d,_0x28639e){var _0x5b068c={};var _0x4c819f={};var _0x590e08;var _0x4342f3;return db[_0x08e3('0x3f')][_0x08e3('0x55')]({'where':{'id':_0x31a133[_0x08e3('0x4f')]['id']}})[_0x08e3('0x22')](handleEntityNotFound(_0x1aba6d,null))['then'](function(_0x1d5cb2){if(_0x1d5cb2){_0x590e08=_0x1d5cb2;_0x4c819f['model']=_[_0x08e3('0x2d')](db[_0x08e3('0x51')][_0x08e3('0x56')]);_0x4c819f[_0x08e3('0x2e')]=_[_0x08e3('0x2d')](_0x31a133[_0x08e3('0x2e')]);_0x4c819f[_0x08e3('0x2f')]=_['intersection'](_0x4c819f[_0x08e3('0x2c')],_0x4c819f[_0x08e3('0x2e')]);_0x5b068c['attributes']=_[_0x08e3('0x31')](_0x4c819f['model'],qs['fields'](_0x31a133[_0x08e3('0x2e')][_0x08e3('0x32')]));_0x5b068c[_0x08e3('0x30')]=_0x5b068c[_0x08e3('0x30')][_0x08e3('0x33')]?_0x5b068c[_0x08e3('0x30')]:_0x4c819f['model'];_0x5b068c[_0x08e3('0x37')]=qs[_0x08e3('0x38')](_0x31a133[_0x08e3('0x2e')]['sort']);_0x5b068c[_0x08e3('0x39')]=qs[_0x08e3('0x2f')](_['pick'](_0x31a133[_0x08e3('0x2e')],_0x4c819f['filters']));if(_0x31a133[_0x08e3('0x2e')][_0x08e3('0x3b')]){_0x5b068c[_0x08e3('0x39')]=_[_0x08e3('0x3c')](_0x5b068c[_0x08e3('0x39')],{'$or':_[_0x08e3('0x3d')](_0x5b068c[_0x08e3('0x30')],function(_0x25cea6){var _0x49450e={};_0x49450e[_0x25cea6]={'$like':'%'+_0x31a133[_0x08e3('0x2e')][_0x08e3('0x3b')]+'%'};return _0x49450e;})});}_0x5b068c=_['merge']({},_0x5b068c,_0x31a133[_0x08e3('0x3e')]);return _0x590e08[_0x08e3('0x54')](_0x5b068c);}})[_0x08e3('0x22')](function(_0x14a4cc){if(_0x14a4cc){_0x4342f3=_0x14a4cc[_0x08e3('0x33')];if(!_0x31a133[_0x08e3('0x2e')]['hasOwnProperty']('nolimit')){_0x5b068c[_0x08e3('0x36')]=qs[_0x08e3('0x36')](_0x31a133[_0x08e3('0x2e')][_0x08e3('0x36')]);_0x5b068c[_0x08e3('0x1c')]=qs[_0x08e3('0x1c')](_0x31a133[_0x08e3('0x2e')][_0x08e3('0x1c')]);}return _0x590e08['getContacts'](_0x5b068c);}})[_0x08e3('0x22')](function(_0x6efce2){if(_0x6efce2){return _0x6efce2?{'count':_0x4342f3,'rows':_0x6efce2}:null;}})[_0x08e3('0x22')](respondWithResult(_0x1aba6d,null))['catch'](handleError(_0x1aba6d,null));}; \ No newline at end of file +var _0x2647=['describe','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','map','options','CmCompany','includeAll','include','rows','catch','show','params','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addContacts','CmContact','ids','omit','findOne','pick','getContacts','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','ejs','fs-extra','squel','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','stack','name','send'];(function(_0x3e44fa,_0x75ed2a){var _0x2a0aba=function(_0x1db6a7){while(--_0x1db6a7){_0x3e44fa['push'](_0x3e44fa['shift']());}};_0x2a0aba(++_0x75ed2a);}(_0x2647,0x83));var _0x7264=function(_0x368abc,_0x8bbc6f){_0x368abc=_0x368abc-0x0;var _0x2fd9f0=_0x2647[_0x368abc];return _0x2fd9f0;};'use strict';var emlformat=require(_0x7264('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7264('0x1'));var jsonpatch=require(_0x7264('0x2'));var rp=require(_0x7264('0x3'));var moment=require('moment');var BPromise=require(_0x7264('0x4'));var Mustache=require(_0x7264('0x5'));var util=require(_0x7264('0x6'));var path=require('path');var sox=require(_0x7264('0x7'));var csv=require('to-csv');var ejs=require(_0x7264('0x8'));var fs=require('fs');var fs_extra=require(_0x7264('0x9'));var _=require('lodash');var squel=require(_0x7264('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x7264('0xb'));var toCsv=require(_0x7264('0xc'));var querystring=require('querystring');var Papa=require(_0x7264('0xd'));var Redis=require(_0x7264('0xe'));var authService=require(_0x7264('0xf'));var qs=require(_0x7264('0x10'));var as=require(_0x7264('0x11'));var hardwareService=require(_0x7264('0x12'));var logger=require(_0x7264('0x13'))(_0x7264('0x14'));var utils=require('../../config/utils');var config=require(_0x7264('0x15'));var licenseUtil=require(_0x7264('0x16'));var db=require(_0x7264('0x17'))['db'];function respondWithStatusCode(_0x28ea09,_0x29e35a){_0x29e35a=_0x29e35a||0xcc;return function(_0x5f889){if(_0x5f889){return _0x28ea09[_0x7264('0x18')](_0x29e35a);}return _0x28ea09[_0x7264('0x19')](_0x29e35a)[_0x7264('0x1a')]();};}function respondWithResult(_0x3019f1,_0x4c0b7b){_0x4c0b7b=_0x4c0b7b||0xc8;return function(_0x3a6af2){if(_0x3a6af2){return _0x3019f1['status'](_0x4c0b7b)[_0x7264('0x1b')](_0x3a6af2);}};}function respondWithFilteredResult(_0x3f9549,_0x4ad6ed){return function(_0x6c0afb){if(_0x6c0afb){var _0x224a7b=typeof _0x4ad6ed[_0x7264('0x1c')]==='undefined'&&typeof _0x4ad6ed[_0x7264('0x1d')]===_0x7264('0x1e');var _0x39b770=_0x6c0afb[_0x7264('0x1f')];var _0x220a91=_0x224a7b?0x0:_0x4ad6ed[_0x7264('0x1c')];var _0x5555e1=_0x224a7b?_0x6c0afb[_0x7264('0x1f')]:_0x4ad6ed['offset']+_0x4ad6ed[_0x7264('0x1d')];var _0x1285a2;if(_0x5555e1>=_0x39b770){_0x5555e1=_0x39b770;_0x1285a2=0xc8;}else{_0x1285a2=0xce;}_0x3f9549[_0x7264('0x19')](_0x1285a2);return _0x3f9549[_0x7264('0x20')](_0x7264('0x21'),_0x220a91+'-'+_0x5555e1+'/'+_0x39b770)['json'](_0x6c0afb);}return null;};}function patchUpdates(_0x22b777){return function(_0x49e8a7){try{jsonpatch[_0x7264('0x22')](_0x49e8a7,_0x22b777,!![]);}catch(_0x239a77){return BPromise[_0x7264('0x23')](_0x239a77);}return _0x49e8a7[_0x7264('0x24')]();};}function saveUpdates(_0x3a1f56,_0x2e060d){return function(_0x2212fb){if(_0x2212fb){return _0x2212fb[_0x7264('0x25')](_0x3a1f56)[_0x7264('0x26')](function(_0x256a7f){return _0x256a7f;});}return null;};}function removeEntity(_0x4f90e7,_0x23ba92){return function(_0x4a1a7d){if(_0x4a1a7d){return _0x4a1a7d[_0x7264('0x27')]()['then'](function(){var _0xbb5456=_0x4a1a7d[_0x7264('0x28')]({'plain':!![]});var _0x1f6a67='Companies';return db[_0x7264('0x29')][_0x7264('0x27')]({'where':{'type':_0x1f6a67,'resourceId':_0xbb5456['id']}})[_0x7264('0x26')](function(){return _0x4a1a7d;});})[_0x7264('0x26')](function(){_0x4f90e7[_0x7264('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2da18e,_0xc06fa7){return function(_0x409b2c){if(!_0x409b2c){_0x2da18e['sendStatus'](0x194);}return _0x409b2c;};}function handleError(_0x133c42,_0x2f0e0a){_0x2f0e0a=_0x2f0e0a||0x1f4;return function(_0x4b6ebf){logger['error'](_0x4b6ebf[_0x7264('0x2a')]);if(_0x4b6ebf[_0x7264('0x2b')]){delete _0x4b6ebf[_0x7264('0x2b')];}_0x133c42[_0x7264('0x19')](_0x2f0e0a)[_0x7264('0x2c')](_0x4b6ebf);};}exports['index']=function(_0x5f9d82,_0xe226cc){var _0x52ba19={},_0x58798e={},_0x1d0f8e={'count':0x0,'rows':[]};return db['CmCompany'][_0x7264('0x2d')]()['then'](function(_0x2f900a){_0x58798e[_0x7264('0x2e')]=_['keys'](_0x2f900a);_0x58798e[_0x7264('0x2f')]=_[_0x7264('0x30')](_0x5f9d82[_0x7264('0x2f')]);_0x58798e[_0x7264('0x31')]=_['intersection'](_0x58798e[_0x7264('0x2e')],_0x58798e['query']);_0x52ba19['attributes']=_[_0x7264('0x32')](_0x58798e['model'],qs[_0x7264('0x33')](_0x5f9d82[_0x7264('0x2f')]['fields']));_0x52ba19['attributes']=_0x52ba19[_0x7264('0x34')][_0x7264('0x35')]?_0x52ba19[_0x7264('0x34')]:_0x58798e['model'];if(!_0x5f9d82[_0x7264('0x2f')][_0x7264('0x36')](_0x7264('0x37'))){_0x52ba19[_0x7264('0x1d')]=qs['limit'](_0x5f9d82[_0x7264('0x2f')][_0x7264('0x1d')]);_0x52ba19[_0x7264('0x1c')]=qs['offset'](_0x5f9d82['query'][_0x7264('0x1c')]);}_0x52ba19[_0x7264('0x38')]=qs[_0x7264('0x39')](_0x5f9d82[_0x7264('0x2f')][_0x7264('0x39')]);_0x52ba19['where']=qs[_0x7264('0x31')](_['pick'](_0x5f9d82[_0x7264('0x2f')],_0x58798e['filters']),_0x2f900a);if(_0x5f9d82['query'][_0x7264('0x3a')]){_0x52ba19[_0x7264('0x3b')]=_[_0x7264('0x3c')](_0x52ba19[_0x7264('0x3b')],{'$or':_[_0x7264('0x3d')](_0x52ba19[_0x7264('0x34')],function(_0x173b40){var _0x709893={};_0x709893[_0x173b40]={'$like':'%'+_0x5f9d82[_0x7264('0x2f')][_0x7264('0x3a')]+'%'};return _0x709893;})});}_0x52ba19=_['merge']({},_0x52ba19,_0x5f9d82[_0x7264('0x3e')]);var _0x208770={'where':_0x52ba19[_0x7264('0x3b')]};return db[_0x7264('0x3f')]['count'](_0x208770)[_0x7264('0x26')](function(_0x94bbc8){_0x1d0f8e['count']=_0x94bbc8;if(_0x5f9d82[_0x7264('0x2f')][_0x7264('0x40')]){_0x52ba19[_0x7264('0x41')]=[{'all':!![]}];}return db[_0x7264('0x3f')]['findAll'](_0x52ba19);})['then'](function(_0x59a090){_0x1d0f8e[_0x7264('0x42')]=_0x59a090;return _0x1d0f8e;})[_0x7264('0x26')](respondWithFilteredResult(_0xe226cc,_0x52ba19))[_0x7264('0x43')](handleError(_0xe226cc,null));})[_0x7264('0x43')](handleError(_0xe226cc,null));};exports[_0x7264('0x44')]=function(_0x16535d,_0x4cfa02){var _0x7774ff={'raw':![],'where':{'id':_0x16535d[_0x7264('0x45')]['id']}},_0x5a6746={};_0x5a6746[_0x7264('0x2e')]=_[_0x7264('0x30')](db[_0x7264('0x3f')][_0x7264('0x46')]);_0x5a6746[_0x7264('0x2f')]=_['keys'](_0x16535d[_0x7264('0x2f')]);_0x5a6746['filters']=_['intersection'](_0x5a6746[_0x7264('0x2e')],_0x5a6746[_0x7264('0x2f')]);_0x7774ff[_0x7264('0x34')]=_[_0x7264('0x32')](_0x5a6746[_0x7264('0x2e')],qs[_0x7264('0x33')](_0x16535d[_0x7264('0x2f')][_0x7264('0x33')]));_0x7774ff[_0x7264('0x34')]=_0x7774ff[_0x7264('0x34')][_0x7264('0x35')]?_0x7774ff[_0x7264('0x34')]:_0x5a6746[_0x7264('0x2e')];if(_0x16535d[_0x7264('0x2f')]['includeAll']){_0x7774ff[_0x7264('0x41')]=[{'all':!![]}];}_0x7774ff=_[_0x7264('0x3c')]({},_0x7774ff,_0x16535d[_0x7264('0x3e')]);return db[_0x7264('0x3f')][_0x7264('0x47')](_0x7774ff)[_0x7264('0x26')](handleEntityNotFound(_0x4cfa02,null))['then'](respondWithResult(_0x4cfa02,null))[_0x7264('0x43')](handleError(_0x4cfa02,null));};exports[_0x7264('0x48')]=function(_0x329d82,_0x68090c){return db[_0x7264('0x3f')][_0x7264('0x48')](_0x329d82[_0x7264('0x49')],{})[_0x7264('0x26')](function(_0x459538){var _0x114ab1=_0x329d82[_0x7264('0x4a')][_0x7264('0x28')]({'plain':!![]});if(!_0x114ab1)throw new Error(_0x7264('0x4b'));if(_0x114ab1[_0x7264('0x4c')]===_0x7264('0x4a')){var _0x2baa06=_0x459538[_0x7264('0x28')]({'plain':!![]});var _0x25022a='Companies';return db[_0x7264('0x4d')][_0x7264('0x47')]({'where':{'name':_0x25022a,'userProfileId':_0x114ab1['userProfileId']},'raw':!![]})['then'](function(_0x4eb184){if(_0x4eb184&&_0x4eb184[_0x7264('0x4e')]===0x0){return db[_0x7264('0x29')][_0x7264('0x48')]({'name':_0x2baa06[_0x7264('0x2b')],'resourceId':_0x2baa06['id'],'type':_0x4eb184[_0x7264('0x2b')],'sectionId':_0x4eb184['id']},{})[_0x7264('0x26')](function(){return _0x459538;});}else{return _0x459538;}})[_0x7264('0x43')](function(_0x255406){logger[_0x7264('0x4f')](_0x7264('0x50'),_0x255406);throw _0x255406;});}return _0x459538;})[_0x7264('0x26')](respondWithResult(_0x68090c,0xc9))['catch'](handleError(_0x68090c,null));};exports[_0x7264('0x25')]=function(_0x12754a,_0x5aeb93){if(_0x12754a[_0x7264('0x49')]['id']){delete _0x12754a[_0x7264('0x49')]['id'];}return db[_0x7264('0x3f')][_0x7264('0x47')]({'where':{'id':_0x12754a[_0x7264('0x45')]['id']}})[_0x7264('0x26')](handleEntityNotFound(_0x5aeb93,null))[_0x7264('0x26')](saveUpdates(_0x12754a['body'],null))[_0x7264('0x26')](respondWithResult(_0x5aeb93,null))[_0x7264('0x43')](handleError(_0x5aeb93,null));};exports[_0x7264('0x27')]=function(_0x30e505,_0x56b932){return db[_0x7264('0x3f')][_0x7264('0x47')]({'where':{'id':_0x30e505[_0x7264('0x45')]['id']}})['then'](handleEntityNotFound(_0x56b932,null))[_0x7264('0x26')](removeEntity(_0x56b932,null))[_0x7264('0x43')](handleError(_0x56b932,null));};exports['describe']=function(_0xa57cfa,_0x2bc9e7){return db['CmCompany'][_0x7264('0x2d')]()[_0x7264('0x26')](respondWithResult(_0x2bc9e7,null))[_0x7264('0x43')](handleError(_0x2bc9e7,null));};exports[_0x7264('0x51')]=function(_0x5717a9,_0x2af246,_0x1226ff){return db[_0x7264('0x52')]['find']({'where':{'id':_0x5717a9[_0x7264('0x45')]['id']}})[_0x7264('0x26')](handleEntityNotFound(_0x2af246,null))[_0x7264('0x26')](function(_0x549a12){if(_0x549a12){return _0x549a12[_0x7264('0x51')](_0x5717a9[_0x7264('0x49')][_0x7264('0x53')],_[_0x7264('0x54')](_0x5717a9['body'],[_0x7264('0x53'),'id'])||{});}})[_0x7264('0x26')](respondWithResult(_0x2af246,null))[_0x7264('0x43')](handleError(_0x2af246,null));};exports['getContacts']=function(_0x27dd2c,_0x1d5b2f,_0x4f1bc2){var _0x5e8abd={};var _0x2d57a0={};var _0x55ac09;var _0x588bda;return db[_0x7264('0x3f')][_0x7264('0x55')]({'where':{'id':_0x27dd2c[_0x7264('0x45')]['id']}})['then'](handleEntityNotFound(_0x1d5b2f,null))['then'](function(_0x410a65){if(_0x410a65){_0x55ac09=_0x410a65;_0x2d57a0[_0x7264('0x2e')]=_[_0x7264('0x30')](db[_0x7264('0x52')]['rawAttributes']);_0x2d57a0[_0x7264('0x2f')]=_['keys'](_0x27dd2c['query']);_0x2d57a0[_0x7264('0x31')]=_['intersection'](_0x2d57a0[_0x7264('0x2e')],_0x2d57a0['query']);_0x5e8abd[_0x7264('0x34')]=_['intersection'](_0x2d57a0['model'],qs[_0x7264('0x33')](_0x27dd2c['query'][_0x7264('0x33')]));_0x5e8abd[_0x7264('0x34')]=_0x5e8abd[_0x7264('0x34')][_0x7264('0x35')]?_0x5e8abd['attributes']:_0x2d57a0['model'];_0x5e8abd['order']=qs[_0x7264('0x39')](_0x27dd2c['query'][_0x7264('0x39')]);_0x5e8abd['where']=qs[_0x7264('0x31')](_[_0x7264('0x56')](_0x27dd2c[_0x7264('0x2f')],_0x2d57a0[_0x7264('0x31')]));if(_0x27dd2c[_0x7264('0x2f')][_0x7264('0x3a')]){_0x5e8abd[_0x7264('0x3b')]=_[_0x7264('0x3c')](_0x5e8abd[_0x7264('0x3b')],{'$or':_[_0x7264('0x3d')](_0x5e8abd['attributes'],function(_0xfd515){var _0x4f3c3f={};_0x4f3c3f[_0xfd515]={'$like':'%'+_0x27dd2c[_0x7264('0x2f')]['filter']+'%'};return _0x4f3c3f;})});}_0x5e8abd=_[_0x7264('0x3c')]({},_0x5e8abd,_0x27dd2c[_0x7264('0x3e')]);return _0x55ac09[_0x7264('0x57')](_0x5e8abd);}})['then'](function(_0x3192d7){if(_0x3192d7){_0x588bda=_0x3192d7[_0x7264('0x35')];if(!_0x27dd2c[_0x7264('0x2f')][_0x7264('0x36')]('nolimit')){_0x5e8abd[_0x7264('0x1d')]=qs['limit'](_0x27dd2c[_0x7264('0x2f')][_0x7264('0x1d')]);_0x5e8abd['offset']=qs[_0x7264('0x1c')](_0x27dd2c[_0x7264('0x2f')]['offset']);}return _0x55ac09['getContacts'](_0x5e8abd);}})[_0x7264('0x26')](function(_0x3e86b4){if(_0x3e86b4){return _0x3e86b4?{'count':_0x588bda,'rows':_0x3e86b4}:null;}})[_0x7264('0x26')](respondWithResult(_0x1d5b2f,null))[_0x7264('0x43')](handleError(_0x1d5b2f,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index 4f2b6b3..3425963 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 _0x62a2=['api','path','rimraf','./cmCompany.attributes','exports','define','CmCompany','cm_companies','lodash','util','../../config/logger'];(function(_0x3b74ff,_0x59f048){var _0x544746=function(_0x12198a){while(--_0x12198a){_0x3b74ff['push'](_0x3b74ff['shift']());}};_0x544746(++_0x59f048);}(_0x62a2,0x6b));var _0x262a=function(_0x50bde0,_0x4243de){_0x50bde0=_0x50bde0-0x0;var _0x4e4e46=_0x62a2[_0x50bde0];return _0x4e4e46;};'use strict';var _=require(_0x262a('0x0'));var util=require(_0x262a('0x1'));var logger=require(_0x262a('0x2'))(_0x262a('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x262a('0x4'));var rimraf=require(_0x262a('0x5'));var config=require('../../config/environment');var attributes=require(_0x262a('0x6'));module[_0x262a('0x7')]=function(_0x4e5b0d,_0x57abe4){return _0x4e5b0d[_0x262a('0x8')](_0x262a('0x9'),attributes,{'tableName':_0x262a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3a7b=['./cmCompany.attributes','exports','define','cm_companies','lodash','../../config/logger','api','request-promise','path','rimraf','../../config/environment'];(function(_0x2f97d5,_0x285487){var _0x256716=function(_0x3a7726){while(--_0x3a7726){_0x2f97d5['push'](_0x2f97d5['shift']());}};_0x256716(++_0x285487);}(_0x3a7b,0x10c));var _0xb3a7=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x3a7b[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0xb3a7('0x0'));var util=require('util');var logger=require(_0xb3a7('0x1'))(_0xb3a7('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xb3a7('0x3'));var fs=require('fs');var path=require(_0xb3a7('0x4'));var rimraf=require(_0xb3a7('0x5'));var config=require(_0xb3a7('0x6'));var attributes=require(_0xb3a7('0x7'));module[_0xb3a7('0x8')]=function(_0x420452,_0x3e5f6e){return _0x420452[_0xb3a7('0x9')]('CmCompany',attributes,{'tableName':_0xb3a7('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.rpc.js b/server/api/cmCompany/cmCompany.rpc.js index 161b507..b402689 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 _0x1406=['bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','code','CmCompany,\x20%s,\x20%s','message','result','catch','util','moment'];(function(_0x489ba5,_0xa1a03c){var _0x3727e9=function(_0x53613e){while(--_0x53613e){_0x489ba5['push'](_0x489ba5['shift']());}};_0x3727e9(++_0xa1a03c);}(_0x1406,0x136));var _0x6140=function(_0x5e3948,_0x433308){_0x5e3948=_0x5e3948-0x0;var _0x3adf39=_0x1406[_0x5e3948];return _0x3adf39;};'use strict';var _=require('lodash');var util=require(_0x6140('0x0'));var moment=require(_0x6140('0x1'));var BPromise=require(_0x6140('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6140('0x3'));var db=require(_0x6140('0x4'))['db'];var utils=require(_0x6140('0x5'));var logger=require(_0x6140('0x6'))(_0x6140('0x7'));var config=require(_0x6140('0x8'));var jayson=require(_0x6140('0x9'));var client=jayson[_0x6140('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4661df,_0xbf88de,_0x7d9e06){return new BPromise(function(_0x40035b,_0x1a554b){return client[_0x6140('0xb')](_0x4661df,_0x7d9e06)[_0x6140('0xc')](function(_0x33c7ab){logger[_0x6140('0xd')]('CmCompany,\x20%s,\x20%s',_0xbf88de,_0x6140('0xe'));logger[_0x6140('0xf')](_0x6140('0x10'),_0xbf88de,_0x6140('0xe'),JSON[_0x6140('0x11')](_0x33c7ab));if(_0x33c7ab[_0x6140('0x12')]){if(_0x33c7ab[_0x6140('0x12')][_0x6140('0x13')]===0x1f4){logger['error'](_0x6140('0x14'),_0xbf88de,_0x33c7ab[_0x6140('0x12')][_0x6140('0x15')]);return _0x1a554b(_0x33c7ab[_0x6140('0x12')][_0x6140('0x15')]);}logger[_0x6140('0x12')](_0x6140('0x14'),_0xbf88de,_0x33c7ab[_0x6140('0x12')][_0x6140('0x15')]);return _0x40035b(_0x33c7ab[_0x6140('0x12')][_0x6140('0x15')]);}else{logger[_0x6140('0xd')](_0x6140('0x14'),_0xbf88de,'request\x20sent');_0x40035b(_0x33c7ab[_0x6140('0x16')][_0x6140('0x15')]);}})[_0x6140('0x17')](function(_0x2c5c16){logger[_0x6140('0x12')](_0x6140('0x14'),_0xbf88de,_0x2c5c16);_0x1a554b(_0x2c5c16);});});} \ No newline at end of file +var _0xae71=['error','code','message','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','then','info','CmCompany,\x20%s,\x20%s','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x24061a,_0x1c9f4d){var _0x82054e=function(_0x2ec346){while(--_0x2ec346){_0x24061a['push'](_0x24061a['shift']());}};_0x82054e(++_0x1c9f4d);}(_0xae71,0xb4));var _0x1ae7=function(_0x5d61a0,_0x170553){_0x5d61a0=_0x5d61a0-0x0;var _0x289c7e=_0xae71[_0x5d61a0];return _0x289c7e;};'use strict';var _=require(_0x1ae7('0x0'));var util=require(_0x1ae7('0x1'));var moment=require(_0x1ae7('0x2'));var BPromise=require(_0x1ae7('0x3'));var rs=require(_0x1ae7('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1ae7('0x5'))['db'];var utils=require(_0x1ae7('0x6'));var logger=require('../../config/logger')(_0x1ae7('0x7'));var config=require('../../config/environment');var jayson=require(_0x1ae7('0x8'));var client=jayson[_0x1ae7('0x9')][_0x1ae7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x18a6f4,_0x4890af,_0x12c652){return new BPromise(function(_0x2862dc,_0x27216c){return client['request'](_0x18a6f4,_0x12c652)[_0x1ae7('0xb')](function(_0x26b91f){logger[_0x1ae7('0xc')](_0x1ae7('0xd'),_0x4890af,_0x1ae7('0xe'));logger[_0x1ae7('0xf')](_0x1ae7('0x10'),_0x4890af,_0x1ae7('0xe'),JSON[_0x1ae7('0x11')](_0x26b91f));if(_0x26b91f[_0x1ae7('0x12')]){if(_0x26b91f[_0x1ae7('0x12')][_0x1ae7('0x13')]===0x1f4){logger['error'](_0x1ae7('0xd'),_0x4890af,_0x26b91f[_0x1ae7('0x12')][_0x1ae7('0x14')]);return _0x27216c(_0x26b91f[_0x1ae7('0x12')][_0x1ae7('0x14')]);}logger[_0x1ae7('0x12')]('CmCompany,\x20%s,\x20%s',_0x4890af,_0x26b91f[_0x1ae7('0x12')][_0x1ae7('0x14')]);return _0x2862dc(_0x26b91f[_0x1ae7('0x12')][_0x1ae7('0x14')]);}else{logger['info'](_0x1ae7('0xd'),_0x4890af,'request\x20sent');_0x2862dc(_0x26b91f[_0x1ae7('0x15')][_0x1ae7('0x14')]);}})['catch'](function(_0x5c98fb){logger[_0x1ae7('0x12')](_0x1ae7('0xd'),_0x4890af,_0x5c98fb);_0x27216c(_0x5c98fb);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index 91243fe..56fe5d2 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 _0xf53e=['post','create','put','update','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCompany.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/contacts','getContacts'];(function(_0x4828ce,_0x12b362){var _0x1e4bf1=function(_0x380708){while(--_0x380708){_0x4828ce['push'](_0x4828ce['shift']());}};_0x1e4bf1(++_0x12b362);}(_0xf53e,0xce));var _0xef53=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xf53e[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0xef53('0x0'));var util=require(_0xef53('0x1'));var path=require(_0xef53('0x2'));var timeout=require('connect-timeout');var express=require(_0xef53('0x3'));var router=express[_0xef53('0x4')]();var fs_extra=require(_0xef53('0x5'));var auth=require(_0xef53('0x6'));var interaction=require(_0xef53('0x7'));var config=require(_0xef53('0x8'));var controller=require(_0xef53('0x9'));router[_0xef53('0xa')]('/',auth[_0xef53('0xb')](),controller[_0xef53('0xc')]);router['get'](_0xef53('0xd'),auth['isAuthenticated'](),controller[_0xef53('0xe')]);router[_0xef53('0xa')](_0xef53('0xf'),auth['isAuthenticated'](),controller[_0xef53('0x10')]);router[_0xef53('0xa')](_0xef53('0x11'),auth[_0xef53('0xb')](),controller[_0xef53('0x12')]);router[_0xef53('0x13')]('/',auth['isAuthenticated'](),controller[_0xef53('0x14')]);router[_0xef53('0x13')](_0xef53('0x11'),auth[_0xef53('0xb')](),controller['addContacts']);router[_0xef53('0x15')](_0xef53('0xf'),auth[_0xef53('0xb')](),controller[_0xef53('0x16')]);router['delete'](_0xef53('0xf'),auth[_0xef53('0xb')](),controller[_0xef53('0x17')]);module[_0xef53('0x18')]=router; \ No newline at end of file +var _0x30eb=['path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./cmCompany.controller','isAuthenticated','get','/describe','describe','/:id','show','/:id/contacts','getContacts','create','post','addContacts','put','update','delete','destroy','exports','multer','util'];(function(_0x282943,_0x2d037b){var _0x535aa5=function(_0x36eb77){while(--_0x36eb77){_0x282943['push'](_0x282943['shift']());}};_0x535aa5(++_0x2d037b);}(_0x30eb,0xce));var _0xb30e=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x30eb[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0xb30e('0x0'));var util=require(_0xb30e('0x1'));var path=require(_0xb30e('0x2'));var timeout=require(_0xb30e('0x3'));var express=require(_0xb30e('0x4'));var router=express[_0xb30e('0x5')]();var fs_extra=require(_0xb30e('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xb30e('0x7'));var config=require(_0xb30e('0x8'));var controller=require(_0xb30e('0x9'));router['get']('/',auth[_0xb30e('0xa')](),controller['index']);router[_0xb30e('0xb')](_0xb30e('0xc'),auth['isAuthenticated'](),controller[_0xb30e('0xd')]);router[_0xb30e('0xb')](_0xb30e('0xe'),auth[_0xb30e('0xa')](),controller[_0xb30e('0xf')]);router['get'](_0xb30e('0x10'),auth[_0xb30e('0xa')](),controller[_0xb30e('0x11')]);router['post']('/',auth[_0xb30e('0xa')](),controller[_0xb30e('0x12')]);router[_0xb30e('0x13')](_0xb30e('0x10'),auth[_0xb30e('0xa')](),controller[_0xb30e('0x14')]);router[_0xb30e('0x15')]('/:id',auth[_0xb30e('0xa')](),controller[_0xb30e('0x16')]);router[_0xb30e('0x17')](_0xb30e('0xe'),auth[_0xb30e('0xa')](),controller[_0xb30e('0x18')]);module[_0xb30e('0x19')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index 11841db..3bc4921 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 _0x418b=['lodash','sequelize','exports','STRING','INTEGER','UNSIGNED','NOW'];(function(_0x725b8e,_0xc22b48){var _0x43ac45=function(_0x46bb4a){while(--_0x46bb4a){_0x725b8e['push'](_0x725b8e['shift']());}};_0x43ac45(++_0xc22b48);}(_0x418b,0x1c7));var _0xb418=function(_0x1b0ee3,_0x3c8841){_0x1b0ee3=_0x1b0ee3-0x0;var _0x34fe59=_0x418b[_0x1b0ee3];return _0x34fe59;};'use strict';var _=require(_0xb418('0x0'));var Sequelize=require(_0xb418('0x1'));module[_0xb418('0x2')]={'firstName':{'type':Sequelize['STRING'],'allowNull':![]},'lastName':{'type':Sequelize[_0xb418('0x3')]},'street':{'type':Sequelize[_0xb418('0x3')]},'postalCode':{'type':Sequelize[_0xb418('0x3')]},'city':{'type':Sequelize[_0xb418('0x3')]},'country':{'type':Sequelize[_0xb418('0x3')]},'dateOfBirth':{'type':Sequelize['STRING']},'description':{'type':Sequelize['TEXT']},'phone':{'type':Sequelize[_0xb418('0x3')]},'mobile':{'type':Sequelize[_0xb418('0x3')]},'fax':{'type':Sequelize[_0xb418('0x3')]},'email':{'type':Sequelize[_0xb418('0x3')]},'url':{'type':Sequelize[_0xb418('0x3')]},'facebook':{'type':Sequelize[_0xb418('0x3')]},'fb_data':{'type':Sequelize['STRING']},'twitter':{'type':Sequelize[_0xb418('0x3')]},'skype':{'type':Sequelize[_0xb418('0x3')]},'teams':{'type':Sequelize['STRING']},'viber':{'type':Sequelize[_0xb418('0x3')]},'line':{'type':Sequelize[_0xb418('0x3')]},'wechat':{'type':Sequelize[_0xb418('0x3')]},'telegram':{'type':Sequelize['STRING']},'UserId':{'type':Sequelize[_0xb418('0x4')]},'priority':{'type':Sequelize[_0xb418('0x4')](0x2)[_0xb418('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':Sequelize[_0xb418('0x6')]}}; \ No newline at end of file +var _0x39fd=['exports','STRING','INTEGER','UNSIGNED','DATE','NOW','lodash','sequelize'];(function(_0x368ed0,_0x4d240b){var _0x20eb24=function(_0x39d996){while(--_0x39d996){_0x368ed0['push'](_0x368ed0['shift']());}};_0x20eb24(++_0x4d240b);}(_0x39fd,0x196));var _0xd39f=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x39fd[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0xd39f('0x0'));var Sequelize=require(_0xd39f('0x1'));module[_0xd39f('0x2')]={'firstName':{'type':Sequelize[_0xd39f('0x3')],'allowNull':![]},'lastName':{'type':Sequelize[_0xd39f('0x3')]},'street':{'type':Sequelize[_0xd39f('0x3')]},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0xd39f('0x3')]},'dateOfBirth':{'type':Sequelize[_0xd39f('0x3')]},'description':{'type':Sequelize['TEXT']},'phone':{'type':Sequelize[_0xd39f('0x3')]},'mobile':{'type':Sequelize[_0xd39f('0x3')]},'fax':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0xd39f('0x3')]},'url':{'type':Sequelize[_0xd39f('0x3')]},'facebook':{'type':Sequelize[_0xd39f('0x3')]},'fb_data':{'type':Sequelize[_0xd39f('0x3')]},'twitter':{'type':Sequelize['STRING']},'skype':{'type':Sequelize[_0xd39f('0x3')]},'teams':{'type':Sequelize[_0xd39f('0x3')]},'viber':{'type':Sequelize[_0xd39f('0x3')]},'line':{'type':Sequelize[_0xd39f('0x3')]},'wechat':{'type':Sequelize[_0xd39f('0x3')]},'telegram':{'type':Sequelize['STRING']},'UserId':{'type':Sequelize[_0xd39f('0x4')]},'priority':{'type':Sequelize[_0xd39f('0x4')](0x2)[_0xd39f('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0xd39f('0x6')],'defaultValue':Sequelize[_0xd39f('0x7')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index 107dd29..ec90f9d 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 _0x6212=['map','union','User','dateOfBirth','castTo','buildExpression','type','text','start','filter','isNil','Contact','push','isEmpty','forEach','ListId','c.ListId\x20IN\x20?','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','replace','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','isNumeric','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','group','c.id','Sequelize','QueryTypes','clone','order','DESC','having','t.id\x20IN\x20?','resolve','role','agent','some','c.ListId\x20IS\x20NULL','sequelize','count','toString','merge','c.firstName','c.lastName','c.phone','c.mobile','c.fax','c.email','c.ListId','c.createdAt','c.deletedAt','c.CompanyId','TagIds','Tags','rows','catch','tags','columnName','CmCustomField','findAll','displayName','custom','values','body','get','mergeWith','isArray','join','info','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','ChatInteraction','ChatMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxInteraction','FaxMessage','OpenchannelInteraction','CmHopperFinal','ReportAgentPreview','VoiceCallReport','FaxQueueReport','OpenchannelQueueReport','SmsQueueReport','JscriptySessionReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','create','each','duplicates','findOrCreate','spread','show','params','$and','format','pickBy','cf_%d','id\x20=\x20?','toParam','getTags','findOne','rawAttributes','setTags','ids','getHoppers','options','include','getHopperHistories','CmHopperHistory','includeAll','getHopperFinals','ContactId','getJscriptySessions','uploadCsv','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','Incorrect\x20binding\x20parameters\x20passed!','zipObject','phone','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','root','server/files/tmp','file','filename','0777','child_process','fork','../../components/import/cm/csv','CompanyId','socket_timestamp','File\x20uploaded\x20correctly!','pid','createReadStream','path','parse','meta','binding','../../components/import/cm/csv2','stringify','message','start\x20child\x20process\x20correctly!','error\x20child\x20process','getJourney','chat','sms','openchannel','fax','whatsapp','voice','-createdAt','channel','toLowerCase','isValid','Invalid\x20date\x20for\x20range\x20from\x20filter','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter','uniqueid','source','destination','callerid','starttime','endtime','note','createdAt','userDisposition','userSecondDisposition','fullname','alias','range','findAndCountAll','startCase','Website','Account','closedAt','disposition','secondDisposition','thirdDisposition','key','Owner','browserName','customerIp','customerPort','deviceModel','osName','ratingMessage','ratingValue','referer','mail','substatus','threadId','Interaction','flatten','sortBy','reverse','slice','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','socket.io-emitter','./cmContact.socket','register','sendStatus','status','end','json','undefined','limit','offset','apply','update','then','destroy','error','name','send','index','CmContact','describe','keys','length','startsWith','cf_','trimStart','all','fieldType','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','select','field','color','from','tools_tags','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','find','Tag','value'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x6212,0xd4));var _0x2621=function(_0x7c6a39,_0x166a14){_0x7c6a39=_0x7c6a39-0x0;var _0x2a8a88=_0x6212[_0x7c6a39];return _0x2a8a88;};'use strict';var emlformat=require(_0x2621('0x0'));var rimraf=require(_0x2621('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2621('0x2'));var rp=require(_0x2621('0x3'));var moment=require(_0x2621('0x4'));var BPromise=require(_0x2621('0x5'));var Mustache=require('mustache');var util=require(_0x2621('0x6'));var path=require('path');var sox=require(_0x2621('0x7'));var csv=require(_0x2621('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x2621('0x9'));var crypto=require(_0x2621('0xa'));var jsforce=require(_0x2621('0xb'));var deskjs=require(_0x2621('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2621('0xd'));var Redis=require('ioredis');var authService=require(_0x2621('0xe'));var qs=require(_0x2621('0xf'));var as=require(_0x2621('0x10'));var hardwareService=require(_0x2621('0x11'));var logger=require(_0x2621('0x12'))(_0x2621('0x13'));var utils=require(_0x2621('0x14'));var config=require(_0x2621('0x15'));var licenseUtil=require(_0x2621('0x16'));var db=require('../../mysqldb')['db'];config[_0x2621('0x17')]=_['defaults'](config[_0x2621('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0x2621('0x18'))(new Redis(config[_0x2621('0x17')]));require(_0x2621('0x19'))[_0x2621('0x1a')](socket);function respondWithStatusCode(_0x34b97d,_0x2b00a4){_0x2b00a4=_0x2b00a4||0xcc;return function(_0x4fea0b){if(_0x4fea0b){return _0x34b97d[_0x2621('0x1b')](_0x2b00a4);}return _0x34b97d[_0x2621('0x1c')](_0x2b00a4)[_0x2621('0x1d')]();};}function respondWithResult(_0x438486,_0x27fbcc){_0x27fbcc=_0x27fbcc||0xc8;return function(_0x406629){if(_0x406629){return _0x438486['status'](_0x27fbcc)[_0x2621('0x1e')](_0x406629);}};}function respondWithFilteredResult(_0x32330d,_0x371337){return function(_0x150dd5){if(_0x150dd5){var _0x5c2573=typeof _0x371337['offset']===_0x2621('0x1f')&&typeof _0x371337[_0x2621('0x20')]==='undefined';var _0x512a84=_0x150dd5['count'];var _0x2f74b4=_0x5c2573?0x0:_0x371337[_0x2621('0x21')];var _0x592f2d=_0x5c2573?_0x150dd5['count']:_0x371337['offset']+_0x371337['limit'];var _0x54dd98;if(_0x592f2d>=_0x512a84){_0x592f2d=_0x512a84;_0x54dd98=0xc8;}else{_0x54dd98=0xce;}_0x32330d[_0x2621('0x1c')](_0x54dd98);return _0x32330d['set']('Content-Range',_0x2f74b4+'-'+_0x592f2d+'/'+_0x512a84)['json'](_0x150dd5);}return null;};}function patchUpdates(_0xcba54f){return function(_0x569c54){try{jsonpatch[_0x2621('0x22')](_0x569c54,_0xcba54f,!![]);}catch(_0x1af097){return BPromise['reject'](_0x1af097);}return _0x569c54['save']();};}function saveUpdates(_0x1ccbfb,_0xa0b104){return function(_0x585fb2){if(_0x585fb2){return _0x585fb2[_0x2621('0x23')](_0x1ccbfb)[_0x2621('0x24')](function(_0x2ee0c2){return _0x2ee0c2;});}return null;};}function removeEntity(_0x9f2fe1,_0x4d53bd){return function(_0x209b5d){if(_0x209b5d){return _0x209b5d[_0x2621('0x25')]()[_0x2621('0x24')](function(){_0x9f2fe1[_0x2621('0x1c')](0xcc)[_0x2621('0x1d')]();});}};}function handleEntityNotFound(_0x717463,_0x367768){return function(_0x473013){if(!_0x473013){_0x717463[_0x2621('0x1b')](0x194);}return _0x473013;};}function handleError(_0x6c0a3d,_0x3b9138){_0x3b9138=_0x3b9138||0x1f4;return function(_0x2e598f){logger[_0x2621('0x26')](_0x2e598f['stack']);if(_0x2e598f[_0x2621('0x27')]){delete _0x2e598f[_0x2621('0x27')];}_0x6c0a3d[_0x2621('0x1c')](_0x3b9138)[_0x2621('0x28')](_0x2e598f);};}exports[_0x2621('0x29')]=function(_0x2e201a,_0x13c849){var _0x92ea73={},_0x506a2d={},_0x4a5b96={'count':0x0,'rows':[]};return db[_0x2621('0x2a')][_0x2621('0x2b')]()['then'](function(_0x51e695){var _0x3c59a6=[];for(var _0x36d42d=0x0;_0x36d42d0x1){_0x44b6c1['or'](_0x2621('0x6a'),qs['getFullTextValue'](_0xa57157),null);}else{if(qs[_0x2621('0x6b')](_0xa57157)){_0x44b6c1['or']('c.id\x20LIKE\x20?',_0xa57157+'%');_0x44b6c1['or'](_0x2621('0x6c'),_0xa57157+'%');_0x44b6c1['or'](_0x2621('0x6d'),_0xa57157+'%');_0x44b6c1['or'](_0x2621('0x6e'),_0xa57157+'%');}else if(qs['isEmail'](_0xa57157)){_0x44b6c1['or'](_0x2621('0x6f'),_0xa57157+'%');}else{_0x44b6c1['or'](_0x2621('0x70'),'%'+_0xa57157+'%');_0x44b6c1['or']('c.lastName\x20LIKE\x20?','%'+_0xa57157+'%');_0x44b6c1['or'](_0x2621('0x6f'),'%'+_0xa57157+'%');}}}}_0xf16d06[_0x2621('0x3c')](_0x44b6c1);_0xf16d06[_0x2621('0x71')](_0x2621('0x72'));var _0x2c502b={'type':db[_0x2621('0x73')][_0x2621('0x74')]['SELECT'],'raw':!![]};var _0x2ec9e7=_0xf16d06[_0x2621('0x75')]()['field']('c.id');if(_0x92ea73['order']){_0x92ea73[_0x2621('0x76')]['forEach'](function(_0x306c98){_0xf16d06[_0x2621('0x76')]('c.'+_0x306c98[0x0],_0x306c98[0x1]===_0x2621('0x77')?![]:!![]);});}if(!_[_0x2621('0x60')](_0x563745)){_0xf16d06[_0x2621('0x78')](_0x3f245f);_0x2ec9e7[_0x2621('0x3c')](_0x2621('0x79'),_0x563745);}BPromise[_0x2621('0x7a')]()[_0x2621('0x24')](function(){if(!_0x3e64fe)return;if(_0x2e201a['user'][_0x2621('0x7b')]!==_0x2621('0x7c'))return;if(!_[_0x2621('0x7d')](_0x3e64fe[_0x2621('0x4f')],[_0x2621('0x3f'),_0x2621('0x55')])){return _0x2e201a['user']['getLists']({'attributes':['id'],'raw':!![]})[_0x2621('0x24')](function(_0x30fc2c){if(_[_0x2621('0x60')](_0x30fc2c)){_0x2ec9e7[_0x2621('0x3c')](_0x2621('0x7e'));_0xf16d06[_0x2621('0x3c')](_0x2621('0x7e'));}else{_0x2ec9e7[_0x2621('0x3c')](_0x2621('0x63'),_[_0x2621('0x53')](_0x30fc2c,'id'));_0xf16d06[_0x2621('0x3c')](_0x2621('0x63'),_['map'](_0x30fc2c,'id'));}});}})['then'](function(){if(_0x2e201a['user'][_0x2621('0x7b')]==='agent'&&!_0x3e64fe&&!_0x2e201a[_0x2621('0x34')][_0x2621('0x62')])return[];return db[_0x2621('0x7f')]['query'](_0x2ec9e7['toString'](),_0x2c502b);})['then'](function(_0x12bdf5){_0x4a5b96['count']=_0x12bdf5['length'];if(_0x4a5b96[_0x2621('0x80')]===0x0)return[];return db[_0x2621('0x7f')]['query'](_0x55ad6a[_0x2621('0x81')](),_0x2c502b)[_0x2621('0x24')](function(_0x269860){_0x42128a=_['keyBy'](_0x269860,'id');_0x2c502b=_[_0x2621('0x82')](_0x2c502b,{'model':db[_0x2621('0x2a')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2e201a[_0x2621('0x34')][_0x2621('0x38')]){_0x92ea73['attributes'][_0x2621('0x61')](function(_0x39d7b3){_0xf16d06['field']('c.'+_0x39d7b3);});}else{_0xf16d06[_0x2621('0x3f')](_0x2621('0x72'));_0xf16d06[_0x2621('0x3f')](_0x2621('0x83'));_0xf16d06[_0x2621('0x3f')](_0x2621('0x84'));_0xf16d06['field'](_0x2621('0x85'));_0xf16d06[_0x2621('0x3f')](_0x2621('0x86'));_0xf16d06['field'](_0x2621('0x87'));_0xf16d06[_0x2621('0x3f')](_0x2621('0x88'));_0xf16d06['field'](_0x2621('0x89'));_0xf16d06['field'](_0x2621('0x8a'));_0xf16d06[_0x2621('0x3f')](_0x2621('0x8b'));_0xf16d06['field'](_0x2621('0x8c'));_0xf16d06['field']('GROUP_CONCAT(DISTINCT\x20t.id)',_0x2621('0x8d'));}if(_0x92ea73[_0x2621('0x20')])_0xf16d06['limit'](_0x92ea73[_0x2621('0x20')]);if(_0x92ea73['offset'])_0xf16d06['offset'](_0x92ea73['offset']);return db[_0x2621('0x7f')]['query'](_0xf16d06[_0x2621('0x81')](),_0x2c502b);});})[_0x2621('0x24')](function(_0x2ddb8e){_0x2ddb8e[_0x2621('0x61')](function(_0x5aae47){if(_0x5aae47[_0x2621('0x8d')]){_0x5aae47[_0x2621('0x8e')]=[];_0x5aae47[_0x2621('0x8d')][_0x2621('0x69')](',')[_0x2621('0x61')](function(_0x336ed0){_0x5aae47[_0x2621('0x8e')][_0x2621('0x5f')](_0x42128a[_0x336ed0]);});}delete _0x5aae47['TagIds'];});_0x4a5b96[_0x2621('0x8f')]=_0x2ddb8e;return _0x4a5b96;})[_0x2621('0x24')](respondWithFilteredResult(_0x13c849,_0x92ea73));})['catch'](handleError(_0x13c849,null));};exports[_0x2621('0x25')]=function(_0x4010d6,_0x32ad4f){return db[_0x2621('0x2a')]['find']({'where':{'id':_0x4010d6['params']['id']}})[_0x2621('0x24')](handleEntityNotFound(_0x32ad4f,null))[_0x2621('0x24')](removeEntity(_0x32ad4f,null))[_0x2621('0x90')](handleError(_0x32ad4f,null));};exports[_0x2621('0x2b')]=function(_0x53f902,_0x4a0393){return db[_0x2621('0x2a')][_0x2621('0x2b')]()[_0x2621('0x24')](function(_0x453b38){delete _0x453b38[_0x2621('0x91')];for(var _0x3f8bbf=0x0;_0x3f8bbf=_0x578e94){_0x8535b1=_0x578e94;_0x523d64=0xc8;}else{_0x523d64=0xce;}_0x40b596[_0xf08f('0x21')](_0x523d64);return _0x40b596['set'](_0xf08f('0x28'),_0x29d610+'-'+_0x8535b1+'/'+_0x578e94)[_0xf08f('0x23')](_0x46be71);}return null;};}function patchUpdates(_0x5bd314){return function(_0x280884){try{jsonpatch[_0xf08f('0x29')](_0x280884,_0x5bd314,!![]);}catch(_0x13ffe1){return BPromise[_0xf08f('0x2a')](_0x13ffe1);}return _0x280884['save']();};}function saveUpdates(_0x45f079,_0x2b66e5){return function(_0x5b8bf3){if(_0x5b8bf3){return _0x5b8bf3[_0xf08f('0x2b')](_0x45f079)[_0xf08f('0x2c')](function(_0xa2c9a5){return _0xa2c9a5;});}return null;};}function removeEntity(_0x4d2f2b,_0x8641d){return function(_0x24861b){if(_0x24861b){return _0x24861b[_0xf08f('0x2d')]()[_0xf08f('0x2c')](function(){_0x4d2f2b[_0xf08f('0x21')](0xcc)[_0xf08f('0x22')]();});}};}function handleEntityNotFound(_0x5045d8,_0x19d273){return function(_0x23811a){if(!_0x23811a){_0x5045d8[_0xf08f('0x2e')](0x194);}return _0x23811a;};}function handleError(_0x37ef8e,_0x2c0d7e){_0x2c0d7e=_0x2c0d7e||0x1f4;return function(_0x250e38){logger[_0xf08f('0x2f')](_0x250e38['stack']);if(_0x250e38[_0xf08f('0x30')]){delete _0x250e38['name'];}_0x37ef8e['status'](_0x2c0d7e)[_0xf08f('0x31')](_0x250e38);};}exports['index']=function(_0x42c2a9,_0x3d2049){var _0x3a221f={},_0x35c3b0={},_0x1f30cd={'count':0x0,'rows':[]};return db[_0xf08f('0x32')][_0xf08f('0x33')]()[_0xf08f('0x2c')](function(_0xd54289){var _0x3a56b7=[];for(var _0x4ca475=0x0;_0x4ca4750x1){_0x89292a['or']('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x5f09c4),null);}else{if(qs[_0xf08f('0x72')](_0x5f09c4)){_0x89292a['or'](_0xf08f('0x73'),_0x5f09c4+'%');_0x89292a['or'](_0xf08f('0x74'),_0x5f09c4+'%');_0x89292a['or']('c.mobile\x20LIKE\x20?',_0x5f09c4+'%');_0x89292a['or'](_0xf08f('0x75'),_0x5f09c4+'%');}else if(qs[_0xf08f('0x76')](_0x5f09c4)){_0x89292a['or']('c.email\x20LIKE\x20?',_0x5f09c4+'%');}else{_0x89292a['or'](_0xf08f('0x77'),'%'+_0x5f09c4+'%');_0x89292a['or'](_0xf08f('0x78'),'%'+_0x5f09c4+'%');_0x89292a['or'](_0xf08f('0x79'),'%'+_0x5f09c4+'%');}}}}_0x53abe7[_0xf08f('0x52')](_0x89292a);_0x53abe7[_0xf08f('0x7a')](_0xf08f('0x7b'));var _0x21e564={'type':db['Sequelize'][_0xf08f('0x7c')][_0xf08f('0x7d')],'raw':!![]};var _0x158741=_0x53abe7[_0xf08f('0x7e')]()['field']('c.id');if(_0x3a221f[_0xf08f('0x45')]){_0x3a221f['order'][_0xf08f('0x5c')](function(_0x30426c){_0x53abe7[_0xf08f('0x45')]('c.'+_0x30426c[0x0],_0x30426c[0x1]==='DESC'?![]:!![]);});}if(!_['isEmpty'](_0x1ae303)){_0x53abe7['having'](_0x40191c);_0x158741[_0xf08f('0x52')]('t.id\x20IN\x20?',_0x1ae303);}BPromise[_0xf08f('0x7f')]()[_0xf08f('0x2c')](function(){if(!_0x3e18fb)return;if(_0x42c2a9[_0xf08f('0x80')][_0xf08f('0x81')]!==_0xf08f('0x82'))return;if(!_[_0xf08f('0x83')](_0x3e18fb[_0xf08f('0x56')],['field',_0xf08f('0x5f')])){return _0x42c2a9[_0xf08f('0x80')][_0xf08f('0x84')]({'attributes':['id'],'raw':!![]})[_0xf08f('0x2c')](function(_0x509c1a){if(_['isEmpty'](_0x509c1a)){_0x158741[_0xf08f('0x52')](_0xf08f('0x85'));_0x53abe7[_0xf08f('0x52')](_0xf08f('0x85'));}else{_0x158741['where'](_0xf08f('0x86'),_[_0xf08f('0x5b')](_0x509c1a,'id'));_0x53abe7[_0xf08f('0x52')](_0xf08f('0x86'),_[_0xf08f('0x5b')](_0x509c1a,'id'));}});}})[_0xf08f('0x2c')](function(){if(_0x42c2a9['user'][_0xf08f('0x81')]===_0xf08f('0x82')&&!_0x3e18fb&&!_0x42c2a9[_0xf08f('0x3f')][_0xf08f('0x6c')])return[];return db[_0xf08f('0x87')][_0xf08f('0x3f')](_0x158741[_0xf08f('0x88')](),_0x21e564);})[_0xf08f('0x2c')](function(_0x39289e){_0x1f30cd[_0xf08f('0x27')]=_0x39289e[_0xf08f('0x35')];if(_0x1f30cd[_0xf08f('0x27')]===0x0)return[];return db[_0xf08f('0x87')][_0xf08f('0x3f')](_0x3672ce['toString'](),_0x21e564)[_0xf08f('0x2c')](function(_0x4203f2){_0x12976d=_['keyBy'](_0x4203f2,'id');_0x21e564=_[_0xf08f('0x89')](_0x21e564,{'model':db['CmContact'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x42c2a9[_0xf08f('0x3f')]['fields']){_0x3a221f['attributes'][_0xf08f('0x5c')](function(_0x595c8d){_0x53abe7[_0xf08f('0x4a')]('c.'+_0x595c8d);});}else{_0x53abe7['field']('c.id');_0x53abe7['field'](_0xf08f('0x8a'));_0x53abe7['field'](_0xf08f('0x8b'));_0x53abe7[_0xf08f('0x4a')](_0xf08f('0x8c'));_0x53abe7[_0xf08f('0x4a')]('c.mobile');_0x53abe7[_0xf08f('0x4a')](_0xf08f('0x8d'));_0x53abe7[_0xf08f('0x4a')](_0xf08f('0x8e'));_0x53abe7['field']('c.ListId');_0x53abe7[_0xf08f('0x4a')]('c.createdAt');_0x53abe7[_0xf08f('0x4a')](_0xf08f('0x8f'));_0x53abe7['field']('c.CompanyId');_0x53abe7[_0xf08f('0x4a')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0xf08f('0x90'));}if(_0x3a221f[_0xf08f('0x26')])_0x53abe7[_0xf08f('0x26')](_0x3a221f[_0xf08f('0x26')]);if(_0x3a221f['offset'])_0x53abe7[_0xf08f('0x24')](_0x3a221f[_0xf08f('0x24')]);return db[_0xf08f('0x87')][_0xf08f('0x3f')](_0x53abe7['toString'](),_0x21e564);});})[_0xf08f('0x2c')](function(_0x510e3c){_0x510e3c[_0xf08f('0x5c')](function(_0x14130c){if(_0x14130c[_0xf08f('0x90')]){_0x14130c[_0xf08f('0x91')]=[];_0x14130c[_0xf08f('0x90')][_0xf08f('0x5a')](',')[_0xf08f('0x5c')](function(_0x28d8aa){_0x14130c[_0xf08f('0x91')][_0xf08f('0x38')](_0x12976d[_0x28d8aa]);});}delete _0x14130c[_0xf08f('0x90')];});_0x1f30cd['rows']=_0x510e3c;return _0x1f30cd;})[_0xf08f('0x2c')](respondWithFilteredResult(_0x3d2049,_0x3a221f));})['catch'](handleError(_0x3d2049,null));};exports[_0xf08f('0x2d')]=function(_0x51bd0e,_0x1c0482){return db[_0xf08f('0x32')]['find']({'where':{'id':_0x51bd0e[_0xf08f('0x92')]['id']}})['then'](handleEntityNotFound(_0x1c0482,null))['then'](removeEntity(_0x1c0482,null))[_0xf08f('0x93')](handleError(_0x1c0482,null));};exports[_0xf08f('0x33')]=function(_0x2495cc,_0x42cc84){return db['CmContact'][_0xf08f('0x33')]()[_0xf08f('0x2c')](function(_0x11ae16){delete _0x11ae16['tags'];for(var _0x62d010=0x0;_0x62d010{}\s\\|]/g,'-');_0x57e2ad(null,util[_0xac3e('0x22')](_0xac3e('0x23'),path[_0xac3e('0x24')](_0x47ac72[_0xac3e('0x20')],path['extname'](_0x47ac72[_0xac3e('0x20')])),Date[_0xac3e('0x25')](),path[_0xac3e('0x26')](_0x47ac72[_0xac3e('0x20')])));}})});router['post'](_0xac3e('0x27'),upload[_0xac3e('0x28')](_0xac3e('0x29')),controller[_0xac3e('0x2a')]);var upload=multer({'storage':multer[_0xac3e('0x1d')]({'destination':function(_0x252f32,_0x929654,_0x3b1735){_0x3b1735(null,path['join'](config[_0xac3e('0x1f')],_0xac3e('0x2b')));},'filename':function(_0x24a3dc,_0x353c35,_0x57fbde){_0x353c35[_0xac3e('0x20')]=_0x353c35[_0xac3e('0x20')][_0xac3e('0x21')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x57fbde(null,util[_0xac3e('0x22')](_0xac3e('0x23'),path[_0xac3e('0x24')](_0x353c35[_0xac3e('0x20')],path[_0xac3e('0x26')](_0x353c35[_0xac3e('0x20')])),Date['now'](),path[_0xac3e('0x26')](_0x353c35[_0xac3e('0x20')])));}})});router[_0xac3e('0x18')](_0xac3e('0x2c'),upload[_0xac3e('0x28')](_0xac3e('0x29')),controller[_0xac3e('0x2d')]);router[_0xac3e('0x18')](_0xac3e('0x2e'),auth[_0xac3e('0x9')](),controller[_0xac3e('0x2f')]);router[_0xac3e('0x30')](_0xac3e('0x31'),auth[_0xac3e('0x9')](),controller['update']);router[_0xac3e('0x32')](_0xac3e('0x31'),auth[_0xac3e('0x9')](),controller['destroy']);module[_0xac3e('0x33')]=router; \ No newline at end of file +var _0x605e=['%s-%s%s','extname','single','file','basename','now','upload','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContact.controller','get','isAuthenticated','index','describe','/:id','show','getTags','/:id/hoppers','/:id/hopper_histories','/:id/hopper_finals','/:id/jscripty_sessions','/:id/journey','getJourney','/merge','merge','post','create','/create_many','bulkCreate','/:id/tags','setTags','diskStorage','join','root','server/files/tmp','originalname','replace','format'];(function(_0x4ad8fd,_0x561f3e){var _0xe1cf0e=function(_0x1e34b9){while(--_0x1e34b9){_0x4ad8fd['push'](_0x4ad8fd['shift']());}};_0xe1cf0e(++_0x561f3e);}(_0x605e,0x106));var _0xe605=function(_0x4d37b9,_0x3bc5e9){_0x4d37b9=_0x4d37b9-0x0;var _0xa9f965=_0x605e[_0x4d37b9];return _0xa9f965;};'use strict';var multer=require(_0xe605('0x0'));var util=require(_0xe605('0x1'));var path=require(_0xe605('0x2'));var timeout=require('connect-timeout');var express=require(_0xe605('0x3'));var router=express[_0xe605('0x4')]();var fs_extra=require(_0xe605('0x5'));var auth=require(_0xe605('0x6'));var interaction=require(_0xe605('0x7'));var config=require(_0xe605('0x8'));var controller=require(_0xe605('0x9'));router[_0xe605('0xa')]('/',auth[_0xe605('0xb')](),controller[_0xe605('0xc')]);router[_0xe605('0xa')]('/describe',auth[_0xe605('0xb')](),controller[_0xe605('0xd')]);router[_0xe605('0xa')](_0xe605('0xe'),auth[_0xe605('0xb')](),controller[_0xe605('0xf')]);router[_0xe605('0xa')]('/:id/tags',auth[_0xe605('0xb')](),controller[_0xe605('0x10')]);router[_0xe605('0xa')](_0xe605('0x11'),auth[_0xe605('0xb')](),controller['getHoppers']);router['get'](_0xe605('0x12'),auth[_0xe605('0xb')](),controller['getHopperHistories']);router[_0xe605('0xa')](_0xe605('0x13'),auth['isAuthenticated'](),controller['getHopperFinals']);router[_0xe605('0xa')](_0xe605('0x14'),auth[_0xe605('0xb')](),controller['getJscriptySessions']);router['get'](_0xe605('0x15'),auth[_0xe605('0xb')](),controller[_0xe605('0x16')]);router['post'](_0xe605('0x17'),auth['isAuthenticated'](),controller[_0xe605('0x18')]);router[_0xe605('0x19')]('/',auth['isAuthenticated'](),controller[_0xe605('0x1a')]);router[_0xe605('0x19')](_0xe605('0x1b'),auth[_0xe605('0xb')](),controller[_0xe605('0x1c')]);router['post'](_0xe605('0x1d'),auth[_0xe605('0xb')](),controller[_0xe605('0x1e')]);var upload=multer({'storage':multer[_0xe605('0x1f')]({'destination':function(_0x15d292,_0x4bb2a9,_0x506117){_0x506117(null,path[_0xe605('0x20')](config[_0xe605('0x21')],_0xe605('0x22')));},'filename':function(_0x4f084d,_0x13561c,_0x4bef09){_0x13561c[_0xe605('0x23')]=_0x13561c['originalname'][_0xe605('0x24')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x4bef09(null,util[_0xe605('0x25')](_0xe605('0x26'),path['basename'](_0x13561c[_0xe605('0x23')],path[_0xe605('0x27')](_0x13561c[_0xe605('0x23')])),Date['now'](),path[_0xe605('0x27')](_0x13561c[_0xe605('0x23')])));}})});router[_0xe605('0x19')]('/csv',upload[_0xe605('0x28')](_0xe605('0x29')),controller['uploadCsv']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x262dc8,_0x14465f,_0x24ae80){_0x24ae80(null,path[_0xe605('0x20')](config[_0xe605('0x21')],'server/files/tmp'));},'filename':function(_0x311072,_0x340de4,_0x4aa95c){_0x340de4[_0xe605('0x23')]=_0x340de4[_0xe605('0x23')][_0xe605('0x24')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x4aa95c(null,util['format'](_0xe605('0x26'),path[_0xe605('0x2a')](_0x340de4[_0xe605('0x23')],path[_0xe605('0x27')](_0x340de4['originalname'])),Date[_0xe605('0x2b')](),path[_0xe605('0x27')](_0x340de4[_0xe605('0x23')])));}})});router[_0xe605('0x19')]('/upload',upload['single'](_0xe605('0x29')),controller[_0xe605('0x2c')]);router[_0xe605('0x19')]('/upload/:id',auth['isAuthenticated'](),controller['import']);router[_0xe605('0x2d')]('/:id',auth[_0xe605('0xb')](),controller[_0xe605('0x2e')]);router[_0xe605('0x2f')](_0xe605('0xe'),auth[_0xe605('0xb')](),controller[_0xe605('0x30')]);module[_0xe605('0x31')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index f3960fb..eccf776 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 _0x9728=['values','isArray','stringify','BOOLEAN','ENUM','sequelize','lodash','exports','VIRTUAL','getDataValue','setDataValue','alias','name','STRING','long','parse'];(function(_0x259360,_0x448aca){var _0x321b72=function(_0x5229f9){while(--_0x5229f9){_0x259360['push'](_0x259360['shift']());}};_0x321b72(++_0x448aca);}(_0x9728,0x1a5));var _0x8972=function(_0x58dfe7,_0x5d0591){_0x58dfe7=_0x58dfe7-0x0;var _0x5d8d4f=_0x9728[_0x58dfe7];return _0x5d8d4f;};'use strict';var Sequelize=require(_0x8972('0x0'));var _=require(_0x8972('0x1'));module[_0x8972('0x2')]={'name':{'type':Sequelize[_0x8972('0x3')],'get':function(_0x3c50a2){return this[_0x8972('0x4')]('alias');}},'alias':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x73e1bf){this[_0x8972('0x5')](_0x8972('0x6'),_0x73e1bf?_0x73e1bf:this[_0x8972('0x4')](_0x8972('0x7')));}},'type':{'type':Sequelize[_0x8972('0x8')],'allowNull':![]},'values':{'type':Sequelize['TEXT'](_0x8972('0x9')),'get':function(){if(this[_0x8972('0x4')]('type')==='select'){return JSON[_0x8972('0xa')](this[_0x8972('0x4')]('values'));}else{return this[_0x8972('0x4')](_0x8972('0xb'));}},'set':function(_0x548479){if(Array[_0x8972('0xc')](_0x548479)){this['setDataValue'](_0x8972('0xb'),JSON[_0x8972('0xd')](_0x548479));}else{this[_0x8972('0x5')](_0x8972('0xb'),_0x548479);}}},'required':{'type':Sequelize[_0x8972('0xe')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x8972('0xe')],'defaultValue':![]},'actionType':{'type':Sequelize[_0x8972('0xf')]('voice')}}; \ No newline at end of file +var _0x8330=['name','TEXT','long','type','parse','values','stringify','BOOLEAN','ENUM','voice','VIRTUAL','getDataValue','alias','STRING','setDataValue'];(function(_0xd67723,_0x1e576f){var _0x53b62b=function(_0x2460a3){while(--_0x2460a3){_0xd67723['push'](_0xd67723['shift']());}};_0x53b62b(++_0x1e576f);}(_0x8330,0x1db));var _0x0833=function(_0x94a629,_0x3075a1){_0x94a629=_0x94a629-0x0;var _0x520465=_0x8330[_0x94a629];return _0x520465;};'use strict';var Sequelize=require('sequelize');var _=require('lodash');module['exports']={'name':{'type':Sequelize[_0x0833('0x0')],'get':function(_0x3858c5){return this[_0x0833('0x1')](_0x0833('0x2'));}},'alias':{'type':Sequelize[_0x0833('0x3')],'allowNull':![],'set':function(_0x78181){this[_0x0833('0x4')](_0x0833('0x2'),_0x78181?_0x78181:this[_0x0833('0x1')](_0x0833('0x5')));}},'type':{'type':Sequelize[_0x0833('0x3')],'allowNull':![]},'values':{'type':Sequelize[_0x0833('0x6')](_0x0833('0x7')),'get':function(){if(this['getDataValue'](_0x0833('0x8'))==='select'){return JSON[_0x0833('0x9')](this['getDataValue'](_0x0833('0xa')));}else{return this['getDataValue'](_0x0833('0xa'));}},'set':function(_0x2240a8){if(Array['isArray'](_0x2240a8)){this['setDataValue']('values',JSON[_0x0833('0xb')](_0x2240a8));}else{this['setDataValue']('values',_0x2240a8);}}},'required':{'type':Sequelize[_0x0833('0xc')],'defaultValue':![]},'clickToAction':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'actionType':{'type':Sequelize[_0x0833('0xd')](_0x0833('0xe'))}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index 4b15bdd..8911c5a 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 _0x8a29=['VIRTUAL','include','findAll','rows','catch','show','params','find','body','create','transaction','Sequelize','TEXT','text','switch','defaultValue','sequelize','cm_contacts','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','destroy','end','error','stack','name','send','map','CmCustomField','rawAttributes','type','key','model','differenceBy','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','merge'];(function(_0x1a4e2b,_0x34f4d7){var _0x404e66=function(_0x13307f){while(--_0x13307f){_0x1a4e2b['push'](_0x1a4e2b['shift']());}};_0x404e66(++_0x34f4d7);}(_0x8a29,0x105));var _0x98a2=function(_0xc2df92,_0x30fc9d){_0xc2df92=_0xc2df92-0x0;var _0x185a14=_0x8a29[_0xc2df92];return _0x185a14;};'use strict';var emlformat=require(_0x98a2('0x0'));var rimraf=require(_0x98a2('0x1'));var zipdir=require(_0x98a2('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x98a2('0x3'));var moment=require(_0x98a2('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x98a2('0x5'));var util=require(_0x98a2('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x98a2('0x7'));var ejs=require(_0x98a2('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x98a2('0x9'));var squel=require(_0x98a2('0xa'));var crypto=require(_0x98a2('0xb'));var jsforce=require(_0x98a2('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x98a2('0x7'));var querystring=require(_0x98a2('0xd'));var Papa=require(_0x98a2('0xe'));var Redis=require(_0x98a2('0xf'));var authService=require(_0x98a2('0x10'));var qs=require(_0x98a2('0x11'));var as=require(_0x98a2('0x12'));var hardwareService=require(_0x98a2('0x13'));var logger=require('../../config/logger')(_0x98a2('0x14'));var utils=require(_0x98a2('0x15'));var config=require(_0x98a2('0x16'));var licenseUtil=require(_0x98a2('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3986c9,_0x539fa2){_0x539fa2=_0x539fa2||0xcc;return function(_0x4bd9f3){if(_0x4bd9f3){return _0x3986c9[_0x98a2('0x18')](_0x539fa2);}return _0x3986c9[_0x98a2('0x19')](_0x539fa2)['end']();};}function respondWithResult(_0x1f45ab,_0x3d11db){_0x3d11db=_0x3d11db||0xc8;return function(_0x118158){if(_0x118158){return _0x1f45ab[_0x98a2('0x19')](_0x3d11db)[_0x98a2('0x1a')](_0x118158);}};}function respondWithFilteredResult(_0x241c8d,_0x1e30e4){return function(_0x2be659){if(_0x2be659){var _0x1bb39c=typeof _0x1e30e4[_0x98a2('0x1b')]===_0x98a2('0x1c')&&typeof _0x1e30e4[_0x98a2('0x1d')]===_0x98a2('0x1c');var _0x484a6e=_0x2be659[_0x98a2('0x1e')];var _0x20edb5=_0x1bb39c?0x0:_0x1e30e4[_0x98a2('0x1b')];var _0x272fd5=_0x1bb39c?_0x2be659[_0x98a2('0x1e')]:_0x1e30e4[_0x98a2('0x1b')]+_0x1e30e4[_0x98a2('0x1d')];var _0x4a2a7b;if(_0x272fd5>=_0x484a6e){_0x272fd5=_0x484a6e;_0x4a2a7b=0xc8;}else{_0x4a2a7b=0xce;}_0x241c8d['status'](_0x4a2a7b);return _0x241c8d[_0x98a2('0x1f')](_0x98a2('0x20'),_0x20edb5+'-'+_0x272fd5+'/'+_0x484a6e)['json'](_0x2be659);}return null;};}function patchUpdates(_0x25b78c){return function(_0x9b8e66){try{jsonpatch['apply'](_0x9b8e66,_0x25b78c,!![]);}catch(_0x550cfd){return BPromise[_0x98a2('0x21')](_0x550cfd);}return _0x9b8e66['save']();};}function saveUpdates(_0x3705b2,_0x43b992){return function(_0x175810){if(_0x175810){return _0x175810[_0x98a2('0x22')](_0x3705b2)[_0x98a2('0x23')](function(_0x301063){return _0x301063;});}return null;};}function removeEntity(_0x280099,_0x47c714){return function(_0xf04c00){if(_0xf04c00){return _0xf04c00[_0x98a2('0x24')]()['then'](function(){_0x280099[_0x98a2('0x19')](0xcc)[_0x98a2('0x25')]();});}};}function handleEntityNotFound(_0x3cb560,_0x4c9193){return function(_0x5921bf){if(!_0x5921bf){_0x3cb560[_0x98a2('0x18')](0x194);}return _0x5921bf;};}function handleError(_0x2fb764,_0x520b6){_0x520b6=_0x520b6||0x1f4;return function(_0x7bd2d2){logger[_0x98a2('0x26')](_0x7bd2d2[_0x98a2('0x27')]);if(_0x7bd2d2['name']){delete _0x7bd2d2[_0x98a2('0x28')];}_0x2fb764[_0x98a2('0x19')](_0x520b6)[_0x98a2('0x29')](_0x7bd2d2);};}exports['index']=function(_0x37a80b,_0x2f056b){var _0x4a8f2f={},_0x1b85ea={},_0xaa09a6={'count':0x0,'rows':[]};var _0x5a0743=_[_0x98a2('0x2a')](db[_0x98a2('0x2b')][_0x98a2('0x2c')],function(_0x3829fd){return{'name':_0x3829fd['fieldName'],'type':_0x3829fd[_0x98a2('0x2d')][_0x98a2('0x2e')]};});_0x1b85ea[_0x98a2('0x2f')]=_[_0x98a2('0x30')](_['map'](_0x5a0743,_0x98a2('0x28')),[_0x98a2('0x28')]);_0x1b85ea[_0x98a2('0x31')]=_[_0x98a2('0x32')](_0x37a80b['query']);_0x1b85ea[_0x98a2('0x33')]=_['intersection'](_0x1b85ea[_0x98a2('0x2f')],_0x1b85ea[_0x98a2('0x31')]);_0x4a8f2f[_0x98a2('0x34')]=_[_0x98a2('0x35')](_0x1b85ea[_0x98a2('0x2f')],qs[_0x98a2('0x36')](_0x37a80b['query']['fields']));_0x4a8f2f[_0x98a2('0x34')]=_0x4a8f2f[_0x98a2('0x34')][_0x98a2('0x37')]?_0x4a8f2f[_0x98a2('0x34')]:_0x1b85ea[_0x98a2('0x2f')];if(!_0x37a80b[_0x98a2('0x31')]['hasOwnProperty'](_0x98a2('0x38'))){_0x4a8f2f['limit']=qs[_0x98a2('0x1d')](_0x37a80b[_0x98a2('0x31')]['limit']);_0x4a8f2f['offset']=qs[_0x98a2('0x1b')](_0x37a80b[_0x98a2('0x31')][_0x98a2('0x1b')]);}_0x4a8f2f[_0x98a2('0x39')]=qs[_0x98a2('0x3a')](_0x37a80b[_0x98a2('0x31')]['sort']);_0x4a8f2f[_0x98a2('0x3b')]=qs[_0x98a2('0x33')](_[_0x98a2('0x3c')](_0x37a80b[_0x98a2('0x31')],_0x1b85ea['filters']),_0x5a0743);if(_0x37a80b[_0x98a2('0x31')][_0x98a2('0x3d')]){_0x4a8f2f[_0x98a2('0x3b')]=_[_0x98a2('0x3e')](_0x4a8f2f['where'],{'$or':_['map'](_0x5a0743,function(_0x4ca80a){if(_0x4ca80a[_0x98a2('0x2d')]!==_0x98a2('0x3f')){var _0x895d8e={};_0x895d8e[_0x4ca80a['name']]={'$like':'%'+_0x37a80b[_0x98a2('0x31')][_0x98a2('0x3d')]+'%'};return _0x895d8e;}})});}_0x4a8f2f=_[_0x98a2('0x3e')]({},_0x4a8f2f,_0x37a80b['options']);var _0x53bafc={'where':_0x4a8f2f[_0x98a2('0x3b')]};return db[_0x98a2('0x2b')][_0x98a2('0x1e')](_0x53bafc)[_0x98a2('0x23')](function(_0xc3cb96){_0xaa09a6[_0x98a2('0x1e')]=_0xc3cb96;if(_0x37a80b[_0x98a2('0x31')]['includeAll']){_0x4a8f2f[_0x98a2('0x40')]=[{'all':!![]}];}return db[_0x98a2('0x2b')][_0x98a2('0x41')](_0x4a8f2f);})[_0x98a2('0x23')](function(_0x15322b){_0xaa09a6[_0x98a2('0x42')]=_0x15322b;return _0xaa09a6;})[_0x98a2('0x23')](respondWithFilteredResult(_0x2f056b,_0x4a8f2f))[_0x98a2('0x43')](handleError(_0x2f056b,null));};exports[_0x98a2('0x44')]=function(_0xd720c6,_0x49c26c){var _0x412bd9={'raw':!![],'where':{'id':_0xd720c6[_0x98a2('0x45')]['id']}},_0x5c522f={};_0x5c522f[_0x98a2('0x2f')]=_[_0x98a2('0x32')](db['CmCustomField'][_0x98a2('0x2c')]);_0x5c522f['query']=_[_0x98a2('0x32')](_0xd720c6[_0x98a2('0x31')]);_0x5c522f['filters']=_[_0x98a2('0x35')](_0x5c522f['model'],_0x5c522f[_0x98a2('0x31')]);_0x412bd9[_0x98a2('0x34')]=_[_0x98a2('0x35')](_0x5c522f[_0x98a2('0x2f')],qs[_0x98a2('0x36')](_0xd720c6[_0x98a2('0x31')]['fields']));_0x412bd9[_0x98a2('0x34')]=_0x412bd9['attributes'][_0x98a2('0x37')]?_0x412bd9['attributes']:_0x5c522f[_0x98a2('0x2f')];if(_0xd720c6['query']['includeAll']){_0x412bd9[_0x98a2('0x40')]=[{'all':!![]}];}_0x412bd9=_[_0x98a2('0x3e')]({},_0x412bd9,_0xd720c6['options']);return db[_0x98a2('0x2b')][_0x98a2('0x46')](_0x412bd9)[_0x98a2('0x23')](handleEntityNotFound(_0x49c26c,null))[_0x98a2('0x23')](respondWithResult(_0x49c26c,null))['catch'](handleError(_0x49c26c,null));};exports['update']=function(_0x211361,_0x1ac6c0){if(_0x211361['body']['id']){delete _0x211361[_0x98a2('0x47')]['id'];}return db['CmCustomField'][_0x98a2('0x46')]({'where':{'id':_0x211361[_0x98a2('0x45')]['id']}})['then'](handleEntityNotFound(_0x1ac6c0,null))[_0x98a2('0x23')](saveUpdates(_0x211361['body'],null))[_0x98a2('0x23')](respondWithResult(_0x1ac6c0,null))[_0x98a2('0x43')](handleError(_0x1ac6c0,null));};exports[_0x98a2('0x24')]=function(_0x361cf7,_0x342403){return db[_0x98a2('0x2b')]['find']({'where':{'id':_0x361cf7[_0x98a2('0x45')]['id']}})['then'](handleEntityNotFound(_0x342403,null))['then'](removeEntity(_0x342403,null))[_0x98a2('0x43')](handleError(_0x342403,null));};exports[_0x98a2('0x48')]=function(_0x2dc489,_0x3919da){var _0x7c4ca5;return db['sequelize'][_0x98a2('0x49')](function(_0x457a18){return db['CmCustomField']['create'](_0x2dc489['body'],{'transaction':_0x457a18})[_0x98a2('0x23')](function(_0x4ed745){_0x7c4ca5=_0x4ed745;var _0x212b3a={'type':db[_0x98a2('0x4a')][_0x98a2('0x4b')],'transaction':_0x457a18};switch(_0x2dc489[_0x98a2('0x47')][_0x98a2('0x2d')]){case _0x98a2('0x4c'):_0x212b3a['type']=db[_0x98a2('0x4a')][_0x98a2('0x4b')];break;case'number':_0x212b3a[_0x98a2('0x2d')]=db[_0x98a2('0x4a')]['INTEGER'];break;case _0x98a2('0x4d'):_0x212b3a[_0x98a2('0x2d')]=db['Sequelize']['BOOLEAN'];_0x212b3a[_0x98a2('0x4e')]=![];break;default:}return db[_0x98a2('0x4f')]['queryInterface']['addColumn'](_0x98a2('0x50'),util['format']('cf_%d',_0x7c4ca5['id']),_0x212b3a);})[_0x98a2('0x23')](function(){return _0x7c4ca5;});})[_0x98a2('0x23')](respondWithResult(_0x3919da,0xc9))['catch'](handleError(_0x3919da,null));}; \ No newline at end of file +var _0xfddd=['nolimit','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','length','find','body','params','create','transaction','TEXT','text','Sequelize','number','INTEGER','switch','BOOLEAN','defaultValue','sequelize','queryInterface','addColumn','cf_%d','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','apply','reject','save','update','destroy','then','error','name','index','map','CmCustomField','rawAttributes','fieldName','type','key','model','differenceBy','keys','query','attributes','intersection','fields','hasOwnProperty'];(function(_0x4708eb,_0x45998c){var _0xb3d9d8=function(_0x8a903a){while(--_0x8a903a){_0x4708eb['push'](_0x4708eb['shift']());}};_0xb3d9d8(++_0x45998c);}(_0xfddd,0x126));var _0xdfdd=function(_0x2cb8f5,_0x434f38){_0x2cb8f5=_0x2cb8f5-0x0;var _0x87410a=_0xfddd[_0x2cb8f5];return _0x87410a;};'use strict';var emlformat=require(_0xdfdd('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xdfdd('0x1'));var jsonpatch=require(_0xdfdd('0x2'));var rp=require(_0xdfdd('0x3'));var moment=require(_0xdfdd('0x4'));var BPromise=require(_0xdfdd('0x5'));var Mustache=require(_0xdfdd('0x6'));var util=require(_0xdfdd('0x7'));var path=require(_0xdfdd('0x8'));var sox=require(_0xdfdd('0x9'));var csv=require(_0xdfdd('0xa'));var ejs=require(_0xdfdd('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xdfdd('0xc'));var squel=require('squel');var crypto=require(_0xdfdd('0xd'));var jsforce=require(_0xdfdd('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xdfdd('0xf'));var Papa=require('papaparse');var Redis=require(_0xdfdd('0x10'));var authService=require(_0xdfdd('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xdfdd('0x12'))(_0xdfdd('0x13'));var utils=require(_0xdfdd('0x14'));var config=require(_0xdfdd('0x15'));var licenseUtil=require(_0xdfdd('0x16'));var db=require(_0xdfdd('0x17'))['db'];function respondWithStatusCode(_0xf104f3,_0x4a86c4){_0x4a86c4=_0x4a86c4||0xcc;return function(_0x27f2ba){if(_0x27f2ba){return _0xf104f3[_0xdfdd('0x18')](_0x4a86c4);}return _0xf104f3['status'](_0x4a86c4)[_0xdfdd('0x19')]();};}function respondWithResult(_0x4cab1a,_0x4e4c98){_0x4e4c98=_0x4e4c98||0xc8;return function(_0x59abf9){if(_0x59abf9){return _0x4cab1a[_0xdfdd('0x1a')](_0x4e4c98)['json'](_0x59abf9);}};}function respondWithFilteredResult(_0x29017b,_0x23e519){return function(_0x5cb1ab){if(_0x5cb1ab){var _0x2432b4=typeof _0x23e519[_0xdfdd('0x1b')]===_0xdfdd('0x1c')&&typeof _0x23e519[_0xdfdd('0x1d')]===_0xdfdd('0x1c');var _0xde0adc=_0x5cb1ab[_0xdfdd('0x1e')];var _0x524769=_0x2432b4?0x0:_0x23e519[_0xdfdd('0x1b')];var _0x11be48=_0x2432b4?_0x5cb1ab[_0xdfdd('0x1e')]:_0x23e519[_0xdfdd('0x1b')]+_0x23e519[_0xdfdd('0x1d')];var _0x273ac5;if(_0x11be48>=_0xde0adc){_0x11be48=_0xde0adc;_0x273ac5=0xc8;}else{_0x273ac5=0xce;}_0x29017b[_0xdfdd('0x1a')](_0x273ac5);return _0x29017b['set']('Content-Range',_0x524769+'-'+_0x11be48+'/'+_0xde0adc)['json'](_0x5cb1ab);}return null;};}function patchUpdates(_0x27e3db){return function(_0x85f0fc){try{jsonpatch[_0xdfdd('0x1f')](_0x85f0fc,_0x27e3db,!![]);}catch(_0x10dd70){return BPromise[_0xdfdd('0x20')](_0x10dd70);}return _0x85f0fc[_0xdfdd('0x21')]();};}function saveUpdates(_0x4d2ffe,_0x5dc75b){return function(_0x47584b){if(_0x47584b){return _0x47584b[_0xdfdd('0x22')](_0x4d2ffe)['then'](function(_0xb72d5b){return _0xb72d5b;});}return null;};}function removeEntity(_0x46e836,_0x340b37){return function(_0x4ee0c5){if(_0x4ee0c5){return _0x4ee0c5[_0xdfdd('0x23')]()[_0xdfdd('0x24')](function(){_0x46e836[_0xdfdd('0x1a')](0xcc)[_0xdfdd('0x19')]();});}};}function handleEntityNotFound(_0xbac0c8,_0x1098d0){return function(_0x771885){if(!_0x771885){_0xbac0c8[_0xdfdd('0x18')](0x194);}return _0x771885;};}function handleError(_0x55e56a,_0x44aec7){_0x44aec7=_0x44aec7||0x1f4;return function(_0x11dde1){logger[_0xdfdd('0x25')](_0x11dde1['stack']);if(_0x11dde1[_0xdfdd('0x26')]){delete _0x11dde1[_0xdfdd('0x26')];}_0x55e56a['status'](_0x44aec7)['send'](_0x11dde1);};}exports[_0xdfdd('0x27')]=function(_0x1941d4,_0x3246d9){var _0x24c54c={},_0x216f35={},_0x5699d0={'count':0x0,'rows':[]};var _0x36aacd=_[_0xdfdd('0x28')](db[_0xdfdd('0x29')][_0xdfdd('0x2a')],function(_0xc16202){return{'name':_0xc16202[_0xdfdd('0x2b')],'type':_0xc16202[_0xdfdd('0x2c')][_0xdfdd('0x2d')]};});_0x216f35[_0xdfdd('0x2e')]=_[_0xdfdd('0x2f')](_[_0xdfdd('0x28')](_0x36aacd,_0xdfdd('0x26')),[_0xdfdd('0x26')]);_0x216f35['query']=_[_0xdfdd('0x30')](_0x1941d4['query']);_0x216f35['filters']=_['intersection'](_0x216f35[_0xdfdd('0x2e')],_0x216f35[_0xdfdd('0x31')]);_0x24c54c[_0xdfdd('0x32')]=_[_0xdfdd('0x33')](_0x216f35[_0xdfdd('0x2e')],qs[_0xdfdd('0x34')](_0x1941d4[_0xdfdd('0x31')][_0xdfdd('0x34')]));_0x24c54c['attributes']=_0x24c54c[_0xdfdd('0x32')]['length']?_0x24c54c[_0xdfdd('0x32')]:_0x216f35[_0xdfdd('0x2e')];if(!_0x1941d4[_0xdfdd('0x31')][_0xdfdd('0x35')](_0xdfdd('0x36'))){_0x24c54c[_0xdfdd('0x1d')]=qs['limit'](_0x1941d4[_0xdfdd('0x31')][_0xdfdd('0x1d')]);_0x24c54c[_0xdfdd('0x1b')]=qs[_0xdfdd('0x1b')](_0x1941d4[_0xdfdd('0x31')][_0xdfdd('0x1b')]);}_0x24c54c['order']=qs[_0xdfdd('0x37')](_0x1941d4[_0xdfdd('0x31')][_0xdfdd('0x37')]);_0x24c54c[_0xdfdd('0x38')]=qs['filters'](_[_0xdfdd('0x39')](_0x1941d4[_0xdfdd('0x31')],_0x216f35[_0xdfdd('0x3a')]),_0x36aacd);if(_0x1941d4[_0xdfdd('0x31')][_0xdfdd('0x3b')]){_0x24c54c[_0xdfdd('0x38')]=_[_0xdfdd('0x3c')](_0x24c54c[_0xdfdd('0x38')],{'$or':_[_0xdfdd('0x28')](_0x36aacd,function(_0xf1ca19){if(_0xf1ca19[_0xdfdd('0x2c')]!==_0xdfdd('0x3d')){var _0x1df0b6={};_0x1df0b6[_0xf1ca19[_0xdfdd('0x26')]]={'$like':'%'+_0x1941d4[_0xdfdd('0x31')]['filter']+'%'};return _0x1df0b6;}})});}_0x24c54c=_[_0xdfdd('0x3c')]({},_0x24c54c,_0x1941d4[_0xdfdd('0x3e')]);var _0x4ba4e4={'where':_0x24c54c[_0xdfdd('0x38')]};return db[_0xdfdd('0x29')]['count'](_0x4ba4e4)['then'](function(_0x161f3f){_0x5699d0[_0xdfdd('0x1e')]=_0x161f3f;if(_0x1941d4[_0xdfdd('0x31')][_0xdfdd('0x3f')]){_0x24c54c[_0xdfdd('0x40')]=[{'all':!![]}];}return db[_0xdfdd('0x29')][_0xdfdd('0x41')](_0x24c54c);})[_0xdfdd('0x24')](function(_0x2049fa){_0x5699d0[_0xdfdd('0x42')]=_0x2049fa;return _0x5699d0;})[_0xdfdd('0x24')](respondWithFilteredResult(_0x3246d9,_0x24c54c))[_0xdfdd('0x43')](handleError(_0x3246d9,null));};exports[_0xdfdd('0x44')]=function(_0x3cb663,_0x346b54){var _0x5a875a={'raw':!![],'where':{'id':_0x3cb663['params']['id']}},_0x11b7c3={};_0x11b7c3[_0xdfdd('0x2e')]=_[_0xdfdd('0x30')](db[_0xdfdd('0x29')]['rawAttributes']);_0x11b7c3[_0xdfdd('0x31')]=_[_0xdfdd('0x30')](_0x3cb663[_0xdfdd('0x31')]);_0x11b7c3[_0xdfdd('0x3a')]=_['intersection'](_0x11b7c3[_0xdfdd('0x2e')],_0x11b7c3['query']);_0x5a875a['attributes']=_[_0xdfdd('0x33')](_0x11b7c3[_0xdfdd('0x2e')],qs[_0xdfdd('0x34')](_0x3cb663[_0xdfdd('0x31')][_0xdfdd('0x34')]));_0x5a875a[_0xdfdd('0x32')]=_0x5a875a[_0xdfdd('0x32')][_0xdfdd('0x45')]?_0x5a875a[_0xdfdd('0x32')]:_0x11b7c3[_0xdfdd('0x2e')];if(_0x3cb663['query']['includeAll']){_0x5a875a['include']=[{'all':!![]}];}_0x5a875a=_['merge']({},_0x5a875a,_0x3cb663['options']);return db[_0xdfdd('0x29')][_0xdfdd('0x46')](_0x5a875a)[_0xdfdd('0x24')](handleEntityNotFound(_0x346b54,null))['then'](respondWithResult(_0x346b54,null))[_0xdfdd('0x43')](handleError(_0x346b54,null));};exports['update']=function(_0x5622b1,_0x1a336d){if(_0x5622b1[_0xdfdd('0x47')]['id']){delete _0x5622b1[_0xdfdd('0x47')]['id'];}return db[_0xdfdd('0x29')][_0xdfdd('0x46')]({'where':{'id':_0x5622b1[_0xdfdd('0x48')]['id']}})[_0xdfdd('0x24')](handleEntityNotFound(_0x1a336d,null))[_0xdfdd('0x24')](saveUpdates(_0x5622b1[_0xdfdd('0x47')],null))['then'](respondWithResult(_0x1a336d,null))[_0xdfdd('0x43')](handleError(_0x1a336d,null));};exports[_0xdfdd('0x23')]=function(_0x428605,_0x76ac3c){return db[_0xdfdd('0x29')][_0xdfdd('0x46')]({'where':{'id':_0x428605[_0xdfdd('0x48')]['id']}})['then'](handleEntityNotFound(_0x76ac3c,null))['then'](removeEntity(_0x76ac3c,null))['catch'](handleError(_0x76ac3c,null));};exports[_0xdfdd('0x49')]=function(_0x19c409,_0x5e1d63){var _0x58e904;return db['sequelize'][_0xdfdd('0x4a')](function(_0x1e5943){return db['CmCustomField'][_0xdfdd('0x49')](_0x19c409[_0xdfdd('0x47')],{'transaction':_0x1e5943})[_0xdfdd('0x24')](function(_0x3e7cc2){_0x58e904=_0x3e7cc2;var _0x3628cc={'type':db['Sequelize'][_0xdfdd('0x4b')],'transaction':_0x1e5943};switch(_0x19c409['body'][_0xdfdd('0x2c')]){case _0xdfdd('0x4c'):_0x3628cc['type']=db[_0xdfdd('0x4d')][_0xdfdd('0x4b')];break;case _0xdfdd('0x4e'):_0x3628cc[_0xdfdd('0x2c')]=db[_0xdfdd('0x4d')][_0xdfdd('0x4f')];break;case _0xdfdd('0x50'):_0x3628cc[_0xdfdd('0x2c')]=db['Sequelize'][_0xdfdd('0x51')];_0x3628cc[_0xdfdd('0x52')]=![];break;default:}return db[_0xdfdd('0x53')][_0xdfdd('0x54')][_0xdfdd('0x55')]('cm_contacts',util['format'](_0xdfdd('0x56'),_0x58e904['id']),_0x3628cc);})[_0xdfdd('0x24')](function(){return _0x58e904;});})[_0xdfdd('0x24')](respondWithResult(_0x5e1d63,0xc9))['catch'](handleError(_0x5e1d63,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index d5fdb52..bf02de7 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 _0x8210=['define','CmCustomField','cm_custom_fields','lodash','../../config/logger','moment','bluebird','path','../../config/environment','./cmCustomField.attributes','exports'];(function(_0x56fb1f,_0x160b0a){var _0x2dd606=function(_0x4cc1fe){while(--_0x4cc1fe){_0x56fb1f['push'](_0x56fb1f['shift']());}};_0x2dd606(++_0x160b0a);}(_0x8210,0x87));var _0x0821=function(_0x5f09c5,_0x2bfca0){_0x5f09c5=_0x5f09c5-0x0;var _0x426ad9=_0x8210[_0x5f09c5];return _0x426ad9;};'use strict';var _=require(_0x0821('0x0'));var util=require('util');var logger=require(_0x0821('0x1'))('api');var moment=require(_0x0821('0x2'));var BPromise=require(_0x0821('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0821('0x4'));var rimraf=require('rimraf');var config=require(_0x0821('0x5'));var attributes=require(_0x0821('0x6'));module[_0x0821('0x7')]=function(_0x58003f,_0x4211ce){return _0x58003f[_0x0821('0x8')](_0x0821('0x9'),attributes,{'tableName':_0x0821('0xa'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x56eb=['./cmCustomField.attributes','exports','define','CmCustomField','cm_custom_fields','lodash','../../config/logger','api','moment','path','rimraf','../../config/environment'];(function(_0x43a0da,_0x47dde0){var _0x57a161=function(_0x1d23e3){while(--_0x1d23e3){_0x43a0da['push'](_0x43a0da['shift']());}};_0x57a161(++_0x47dde0);}(_0x56eb,0x16d));var _0xb56e=function(_0x4cc53b,_0x46aa5d){_0x4cc53b=_0x4cc53b-0x0;var _0x77bf55=_0x56eb[_0x4cc53b];return _0x77bf55;};'use strict';var _=require(_0xb56e('0x0'));var util=require('util');var logger=require(_0xb56e('0x1'))(_0xb56e('0x2'));var moment=require(_0xb56e('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xb56e('0x4'));var rimraf=require(_0xb56e('0x5'));var config=require(_0xb56e('0x6'));var attributes=require(_0xb56e('0x7'));module[_0xb56e('0x8')]=function(_0x8998cf,_0x5b0874){return _0x8998cf[_0xb56e('0x9')](_0xb56e('0xa'),attributes,{'tableName':_0xb56e('0xb'),'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 c3538ff..3196e37 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 _0xd234=['message','result','catch','lodash','util','bluebird','randomstring','../../config/logger','rpc','jayson/promise','client','http','request','then','info','CmCustomField,\x20%s,\x20%s','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x59dc16,_0x584463){var _0x19af28=function(_0x8f4a20){while(--_0x8f4a20){_0x59dc16['push'](_0x59dc16['shift']());}};_0x19af28(++_0x584463);}(_0xd234,0xea));var _0x4d23=function(_0x2737fb,_0xd5f8f4){_0x2737fb=_0x2737fb-0x0;var _0x44b22b=_0xd234[_0x2737fb];return _0x44b22b;};'use strict';var _=require(_0x4d23('0x0'));var util=require(_0x4d23('0x1'));var moment=require('moment');var BPromise=require(_0x4d23('0x2'));var rs=require(_0x4d23('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x4d23('0x4'))(_0x4d23('0x5'));var config=require('../../config/environment');var jayson=require(_0x4d23('0x6'));var client=jayson[_0x4d23('0x7')][_0x4d23('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4af56d,_0x36b787,_0x41356e){return new BPromise(function(_0x2e7dd3,_0xa9a89a){return client[_0x4d23('0x9')](_0x4af56d,_0x41356e)[_0x4d23('0xa')](function(_0x39d538){logger[_0x4d23('0xb')](_0x4d23('0xc'),_0x36b787,_0x4d23('0xd'));logger[_0x4d23('0xe')](_0x4d23('0xf'),_0x36b787,_0x4d23('0xd'),JSON[_0x4d23('0x10')](_0x39d538));if(_0x39d538[_0x4d23('0x11')]){if(_0x39d538['error']['code']===0x1f4){logger[_0x4d23('0x11')](_0x4d23('0xc'),_0x36b787,_0x39d538['error']['message']);return _0xa9a89a(_0x39d538[_0x4d23('0x11')][_0x4d23('0x12')]);}logger['error']('CmCustomField,\x20%s,\x20%s',_0x36b787,_0x39d538[_0x4d23('0x11')][_0x4d23('0x12')]);return _0x2e7dd3(_0x39d538[_0x4d23('0x11')]['message']);}else{logger['info']('CmCustomField,\x20%s,\x20%s',_0x36b787,_0x4d23('0xd'));_0x2e7dd3(_0x39d538[_0x4d23('0x13')][_0x4d23('0x12')]);}})[_0x4d23('0x14')](function(_0x1cfeb2){logger[_0x4d23('0x11')](_0x4d23('0xc'),_0x36b787,_0x1cfeb2);_0xa9a89a(_0x1cfeb2);});});} \ No newline at end of file +var _0x6567=['debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','CmCustomField,\x20%s,\x20%s','request\x20sent'];(function(_0x4d177d,_0x8e4345){var _0x23df25=function(_0x32f914){while(--_0x32f914){_0x4d177d['push'](_0x4d177d['shift']());}};_0x23df25(++_0x8e4345);}(_0x6567,0x6c));var _0x7656=function(_0x324de4,_0x40c13d){_0x324de4=_0x324de4-0x0;var _0x221c3d=_0x6567[_0x324de4];return _0x221c3d;};'use strict';var _=require('lodash');var util=require(_0x7656('0x0'));var moment=require(_0x7656('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7656('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x7656('0x3'));var logger=require(_0x7656('0x4'))(_0x7656('0x5'));var config=require(_0x7656('0x6'));var jayson=require(_0x7656('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x36e749,_0x3b9518,_0x21ee7e){return new BPromise(function(_0x2d6705,_0x507010){return client[_0x7656('0x8')](_0x36e749,_0x21ee7e)[_0x7656('0x9')](function(_0x281b93){logger['info'](_0x7656('0xa'),_0x3b9518,_0x7656('0xb'));logger[_0x7656('0xc')](_0x7656('0xd'),_0x3b9518,_0x7656('0xb'),JSON[_0x7656('0xe')](_0x281b93));if(_0x281b93[_0x7656('0xf')]){if(_0x281b93['error'][_0x7656('0x10')]===0x1f4){logger[_0x7656('0xf')](_0x7656('0xa'),_0x3b9518,_0x281b93['error'][_0x7656('0x11')]);return _0x507010(_0x281b93[_0x7656('0xf')][_0x7656('0x11')]);}logger[_0x7656('0xf')]('CmCustomField,\x20%s,\x20%s',_0x3b9518,_0x281b93[_0x7656('0xf')]['message']);return _0x2d6705(_0x281b93['error'][_0x7656('0x11')]);}else{logger[_0x7656('0x12')](_0x7656('0xa'),_0x3b9518,_0x7656('0xb'));_0x2d6705(_0x281b93[_0x7656('0x13')][_0x7656('0x11')]);}})['catch'](function(_0x12508a){logger['error']('CmCustomField,\x20%s,\x20%s',_0x3b9518,_0x12508a);_0x507010(_0x12508a);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index 4631dd8..5c15974 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 _0xfbdb=['get','isAuthenticated','index','/:id','show','post','create','put','update','delete','multer','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./cmCustomField.controller'];(function(_0xd5c6bc,_0x156f84){var _0x135c9f=function(_0x460d23){while(--_0x460d23){_0xd5c6bc['push'](_0xd5c6bc['shift']());}};_0x135c9f(++_0x156f84);}(_0xfbdb,0x1ba));var _0xbfbd=function(_0x51cadd,_0x3203ea){_0x51cadd=_0x51cadd-0x0;var _0x552b28=_0xfbdb[_0x51cadd];return _0x552b28;};'use strict';var multer=require(_0xbfbd('0x0'));var util=require('util');var path=require(_0xbfbd('0x1'));var timeout=require('connect-timeout');var express=require(_0xbfbd('0x2'));var router=express[_0xbfbd('0x3')]();var fs_extra=require(_0xbfbd('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xbfbd('0x5'));var config=require(_0xbfbd('0x6'));var controller=require(_0xbfbd('0x7'));router[_0xbfbd('0x8')]('/',auth[_0xbfbd('0x9')](),controller[_0xbfbd('0xa')]);router[_0xbfbd('0x8')](_0xbfbd('0xb'),auth[_0xbfbd('0x9')](),controller[_0xbfbd('0xc')]);router[_0xbfbd('0xd')]('/',auth['isAuthenticated'](),controller[_0xbfbd('0xe')]);router[_0xbfbd('0xf')](_0xbfbd('0xb'),auth['isAuthenticated'](),controller[_0xbfbd('0x10')]);router[_0xbfbd('0x11')](_0xbfbd('0xb'),auth[_0xbfbd('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x2384=['../../components/interaction/service','./cmCustomField.controller','get','isAuthenticated','index','/:id','show','post','create','put','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra'];(function(_0x3f9b1b,_0x29ad99){var _0x4775a9=function(_0xf5e83f){while(--_0xf5e83f){_0x3f9b1b['push'](_0x3f9b1b['shift']());}};_0x4775a9(++_0x29ad99);}(_0x2384,0x1aa));var _0x4238=function(_0x293409,_0xc632cd){_0x293409=_0x293409-0x0;var _0x3103fb=_0x2384[_0x293409];return _0x3103fb;};'use strict';var multer=require(_0x4238('0x0'));var util=require('util');var path=require(_0x4238('0x1'));var timeout=require(_0x4238('0x2'));var express=require(_0x4238('0x3'));var router=express[_0x4238('0x4')]();var fs_extra=require(_0x4238('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x4238('0x6'));var config=require('../../config/environment');var controller=require(_0x4238('0x7'));router[_0x4238('0x8')]('/',auth[_0x4238('0x9')](),controller[_0x4238('0xa')]);router[_0x4238('0x8')](_0x4238('0xb'),auth[_0x4238('0x9')](),controller[_0x4238('0xc')]);router[_0x4238('0xd')]('/',auth['isAuthenticated'](),controller[_0x4238('0xe')]);router[_0x4238('0xf')]('/:id',auth[_0x4238('0x9')](),controller['update']);router['delete'](_0x4238('0xb'),auth[_0x4238('0x9')](),controller[_0x4238('0x10')]);module[_0x4238('0x11')]=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index f05ead7..b8c9851 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 _0x8a5b=['exports','STRING','BOOLEAN','DATE','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','contactListQueue','moment'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x8a5b,0xc5));var _0xb8a5=function(_0x576adf,_0x32b849){_0x576adf=_0x576adf-0x0;var _0x31f9c5=_0x8a5b[_0x576adf];return _0x31f9c5;};'use strict';var moment=require(_0xb8a5('0x0'));var Sequelize=require('sequelize');module[_0xb8a5('0x1')]={'phone':{'type':Sequelize[_0xb8a5('0x2')],'allowNull':![]},'active':{'type':Sequelize[_0xb8a5('0x3')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0xb8a5('0x4')],'defaultValue':moment()[_0xb8a5('0x5')](_0xb8a5('0x6'))},'countbusyretry':{'type':Sequelize[_0xb8a5('0x7')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xb8a5('0x7')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xb8a5('0x7')],'defaultValue':0x0},'callback':{'type':Sequelize[_0xb8a5('0x3')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xb8a5('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xb8a5('0x4')]},'priority':{'type':Sequelize[_0xb8a5('0x7')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0xb8a5('0x3')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0xb8a5('0x7')],'unique':_0xb8a5('0x8')},'ListId':{'type':Sequelize[_0xb8a5('0x7')],'unique':_0xb8a5('0x8')},'UserId':{'type':Sequelize[_0xb8a5('0x7')]},'VoiceQueueId':{'type':Sequelize[_0xb8a5('0x7')],'unique':'contactListQueue'},'CampaignId':{'type':Sequelize[_0xb8a5('0x7')]},'countnosuchnumberretry':{'type':Sequelize[_0xb8a5('0x7')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xb8a5('0x7')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xb8a5('0x7')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xb8a5('0x7')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x3067=['BOOLEAN','format','INTEGER','DATE','UNSIGNED','contactListQueue','moment','sequelize','STRING'];(function(_0x11946c,_0x12152c){var _0x383935=function(_0x61fce2){while(--_0x61fce2){_0x11946c['push'](_0x11946c['shift']());}};_0x383935(++_0x12152c);}(_0x3067,0x1d1));var _0x7306=function(_0x3751ca,_0x337ebd){_0x3751ca=_0x3751ca-0x0;var _0x124a26=_0x3067[_0x3751ca];return _0x124a26;};'use strict';var moment=require(_0x7306('0x0'));var Sequelize=require(_0x7306('0x1'));module['exports']={'phone':{'type':Sequelize[_0x7306('0x2')],'allowNull':![]},'active':{'type':Sequelize[_0x7306('0x3')],'defaultValue':![]},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()[_0x7306('0x4')]('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x7306('0x5')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x7306('0x5')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x7306('0x3')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x7306('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x7306('0x6')]},'priority':{'type':Sequelize[_0x7306('0x5')](0x2)[_0x7306('0x7')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':_0x7306('0x8')},'ListId':{'type':Sequelize[_0x7306('0x5')],'unique':'contactListQueue'},'UserId':{'type':Sequelize['INTEGER']},'VoiceQueueId':{'type':Sequelize[_0x7306('0x5')],'unique':_0x7306('0x8')},'CampaignId':{'type':Sequelize[_0x7306('0x5')]},'countnosuchnumberretry':{'type':Sequelize[_0x7306('0x5')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x7306('0x5')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x7306('0x5')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x7306('0x5')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x7306('0x5')],'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 8ccd3c5..b8ea909 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 _0x0552=['campaigntype','queue','ivr','CmContact','firstName','lastName','isNil','calleridname','finally','getPreview','outbound','dialOrderByScheduledAt','sequelize','prev','isEmpty','hopperIds','priority','ASC','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','DESC','findOne','scheduledat','LOCK','UPDATE','CmCompany','Company','CmList','List','Queue','getOpenContacts','getVoiceQueues','preview','isNumber','entity\x20not\x20found','eml-format','zip-dir','fast-json-patch','request-promise','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','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','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','update','destroy','sendStatus','error','stack','name','index','map','fieldName','type','key','model','query','keys','intersection','filters','concat','$and','$or','$gte','$lt','$lte','$ne','$eq','$not','$between','$notBetween','$in','$notIn','$like','$notLike','$iLike','$notILike','$overlap','$contains','$contained','$any','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','CmHopper','includeAll','findAll','then','catch','show','rawAttributes','include','find','create','body','params','describe','CampaignId','VoiceQueueId','VoiceQueue','Campaign','omit','dataValues','createdAt','state','statedesc','campaign','membername','user','UserId','deleted','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','phone'];(function(_0xc11078,_0x116936){var _0xa14660=function(_0x147865){while(--_0x147865){_0xc11078['push'](_0xc11078['shift']());}};_0xa14660(++_0x116936);}(_0x0552,0x1e8));var _0x2055=function(_0x33e1e4,_0x3f0aed){_0x33e1e4=_0x33e1e4-0x0;var _0x107cc5=_0x0552[_0x33e1e4];return _0x107cc5;};'use strict';var emlformat=require(_0x2055('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2055('0x1'));var jsonpatch=require(_0x2055('0x2'));var rp=require(_0x2055('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x2055('0x4'));var util=require(_0x2055('0x5'));var path=require('path');var sox=require(_0x2055('0x6'));var csv=require('to-csv');var ejs=require(_0x2055('0x7'));var fs=require('fs');var fs_extra=require(_0x2055('0x8'));var _=require(_0x2055('0x9'));var squel=require(_0x2055('0xa'));var crypto=require(_0x2055('0xb'));var jsforce=require(_0x2055('0xc'));var deskjs=require(_0x2055('0xd'));var toCsv=require(_0x2055('0xe'));var querystring=require('querystring');var Papa=require(_0x2055('0xf'));var Redis=require(_0x2055('0x10'));var authService=require(_0x2055('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x2055('0x12'));var hardwareService=require(_0x2055('0x13'));var logger=require(_0x2055('0x14'))('api');var utils=require(_0x2055('0x15'));var config=require(_0x2055('0x16'));var licenseUtil=require(_0x2055('0x17'));var db=require(_0x2055('0x18'))['db'];function respondWithStatusCode(_0x3b7ecc,_0x1f7d53){_0x1f7d53=_0x1f7d53||0xcc;return function(_0x4e597a){if(_0x4e597a){return _0x3b7ecc['sendStatus'](_0x1f7d53);}return _0x3b7ecc[_0x2055('0x19')](_0x1f7d53)[_0x2055('0x1a')]();};}function respondWithResult(_0x11f2dd,_0x3bdcd9){_0x3bdcd9=_0x3bdcd9||0xc8;return function(_0x46eee7){if(_0x46eee7){return _0x11f2dd['status'](_0x3bdcd9)[_0x2055('0x1b')](_0x46eee7);}};}function respondWithFilteredResult(_0x28d848,_0xb19e){return function(_0x2e4acd){if(_0x2e4acd){var _0x4f87e1=typeof _0xb19e[_0x2055('0x1c')]===_0x2055('0x1d')&&typeof _0xb19e[_0x2055('0x1e')]==='undefined';var _0x3ccd00=_0x2e4acd[_0x2055('0x1f')];var _0x48704c=_0x4f87e1?0x0:_0xb19e[_0x2055('0x1c')];var _0x2c9e4d=_0x4f87e1?_0x2e4acd['count']:_0xb19e[_0x2055('0x1c')]+_0xb19e['limit'];var _0x112a39;if(_0x2c9e4d>=_0x3ccd00){_0x2c9e4d=_0x3ccd00;_0x112a39=0xc8;}else{_0x112a39=0xce;}_0x28d848[_0x2055('0x19')](_0x112a39);return _0x28d848['set'](_0x2055('0x20'),_0x48704c+'-'+_0x2c9e4d+'/'+_0x3ccd00)[_0x2055('0x1b')](_0x2e4acd);}return null;};}function patchUpdates(_0x49bfe4){return function(_0x3790f1){try{jsonpatch[_0x2055('0x21')](_0x3790f1,_0x49bfe4,!![]);}catch(_0x25f31b){return BPromise['reject'](_0x25f31b);}return _0x3790f1[_0x2055('0x22')]();};}function saveUpdates(_0x477ed2,_0x5e9e59){return function(_0x4b178c){if(_0x4b178c){return _0x4b178c[_0x2055('0x23')](_0x477ed2)['then'](function(_0x23e187){return _0x23e187;});}return null;};}function removeEntity(_0x306ad1,_0x25b84e){return function(_0xb26c11){if(_0xb26c11){return _0xb26c11[_0x2055('0x24')]()['then'](function(){_0x306ad1['status'](0xcc)[_0x2055('0x1a')]();});}};}function handleEntityNotFound(_0x1bda2a,_0xfb2d9a){return function(_0x3f605c){if(!_0x3f605c){_0x1bda2a[_0x2055('0x25')](0x194);}return _0x3f605c;};}function handleError(_0x359458,_0x30eeea){_0x30eeea=_0x30eeea||0x1f4;return function(_0x336548){logger[_0x2055('0x26')](_0x336548[_0x2055('0x27')]);if(_0x336548['name']){delete _0x336548[_0x2055('0x28')];}_0x359458[_0x2055('0x19')](_0x30eeea)['send'](_0x336548);};}exports[_0x2055('0x29')]=function(_0x31f2ec,_0x361903){var _0x5bf7fe={},_0x291e43={},_0x12f677={'count':0x0,'rows':[]};var _0x5d74b0=_[_0x2055('0x2a')](db['CmHopper']['rawAttributes'],function(_0xb20d14){return{'name':_0xb20d14[_0x2055('0x2b')],'type':_0xb20d14[_0x2055('0x2c')][_0x2055('0x2d')]};});_0x291e43[_0x2055('0x2e')]=_[_0x2055('0x2a')](_0x5d74b0,_0x2055('0x28'));_0x291e43[_0x2055('0x2f')]=_[_0x2055('0x30')](_0x31f2ec[_0x2055('0x2f')]);_0x291e43['filters']=_[_0x2055('0x31')](_0x291e43['model'],_0x291e43[_0x2055('0x2f')]);_0x291e43[_0x2055('0x32')]=_[_0x2055('0x33')](_0x291e43['filters'],[_0x2055('0x34'),_0x2055('0x35'),'$gt',_0x2055('0x36'),_0x2055('0x37'),_0x2055('0x38'),_0x2055('0x39'),_0x2055('0x3a'),_0x2055('0x3b'),_0x2055('0x3c'),_0x2055('0x3d'),_0x2055('0x3e'),_0x2055('0x3f'),_0x2055('0x40'),_0x2055('0x41'),_0x2055('0x42'),_0x2055('0x43'),_0x2055('0x40'),_0x2055('0x44'),_0x2055('0x45'),_0x2055('0x46'),_0x2055('0x47')]);_0x5bf7fe[_0x2055('0x48')]=_[_0x2055('0x31')](_0x291e43['model'],qs['fields'](_0x31f2ec[_0x2055('0x2f')][_0x2055('0x49')]));_0x5bf7fe[_0x2055('0x48')]=_0x5bf7fe['attributes'][_0x2055('0x4a')]?_0x5bf7fe[_0x2055('0x48')]:_0x291e43[_0x2055('0x2e')];if(!_0x31f2ec[_0x2055('0x2f')][_0x2055('0x4b')](_0x2055('0x4c'))){_0x5bf7fe[_0x2055('0x1e')]=qs[_0x2055('0x1e')](_0x31f2ec['query'][_0x2055('0x1e')]);_0x5bf7fe[_0x2055('0x1c')]=qs[_0x2055('0x1c')](_0x31f2ec['query'][_0x2055('0x1c')]);}_0x5bf7fe[_0x2055('0x4d')]=qs[_0x2055('0x4e')](_0x31f2ec[_0x2055('0x2f')][_0x2055('0x4e')]);_0x5bf7fe['where']=qs[_0x2055('0x32')](_[_0x2055('0x4f')](_0x31f2ec[_0x2055('0x2f')],_0x291e43['filters']),_0x5d74b0);if(_0x31f2ec[_0x2055('0x2f')][_0x2055('0x50')]){_0x5bf7fe['where']=_['merge'](_0x5bf7fe[_0x2055('0x51')],{'$or':_[_0x2055('0x2a')](_0x5d74b0,function(_0x2d8037){if(_0x2d8037[_0x2055('0x2c')]!==_0x2055('0x52')){var _0x18af52={};_0x18af52[_0x2d8037['name']]={'$like':'%'+_0x31f2ec[_0x2055('0x2f')][_0x2055('0x50')]+'%'};return _0x18af52;}})});}_0x5bf7fe=_[_0x2055('0x53')]({},_0x5bf7fe,_0x31f2ec[_0x2055('0x54')]);var _0x3bc42f={'where':_0x5bf7fe[_0x2055('0x51')]};return db[_0x2055('0x55')][_0x2055('0x1f')](_0x3bc42f)['then'](function(_0xb975a6){_0x12f677['count']=_0xb975a6;if(_0x31f2ec[_0x2055('0x2f')][_0x2055('0x56')]){_0x5bf7fe['include']=[{'all':!![]}];}return db[_0x2055('0x55')][_0x2055('0x57')](_0x5bf7fe);})[_0x2055('0x58')](function(_0x7c7e9c){_0x12f677['rows']=_0x7c7e9c;return _0x12f677;})[_0x2055('0x58')](respondWithFilteredResult(_0x361903,_0x5bf7fe))[_0x2055('0x59')](handleError(_0x361903,null));};exports[_0x2055('0x5a')]=function(_0x1808e7,_0x4b1f3c){var _0x335cb6={'raw':!![],'where':{'id':_0x1808e7['params']['id']}},_0x28cc25={};_0x28cc25[_0x2055('0x2e')]=_[_0x2055('0x30')](db[_0x2055('0x55')][_0x2055('0x5b')]);_0x28cc25[_0x2055('0x2f')]=_[_0x2055('0x30')](_0x1808e7[_0x2055('0x2f')]);_0x28cc25[_0x2055('0x32')]=_['intersection'](_0x28cc25['model'],_0x28cc25[_0x2055('0x2f')]);_0x335cb6[_0x2055('0x48')]=_[_0x2055('0x31')](_0x28cc25['model'],qs[_0x2055('0x49')](_0x1808e7['query'][_0x2055('0x49')]));_0x335cb6['attributes']=_0x335cb6[_0x2055('0x48')]['length']?_0x335cb6[_0x2055('0x48')]:_0x28cc25[_0x2055('0x2e')];if(_0x1808e7['query'][_0x2055('0x56')]){_0x335cb6[_0x2055('0x5c')]=[{'all':!![]}];}_0x335cb6=_[_0x2055('0x53')]({},_0x335cb6,_0x1808e7[_0x2055('0x54')]);return db[_0x2055('0x55')][_0x2055('0x5d')](_0x335cb6)[_0x2055('0x58')](handleEntityNotFound(_0x4b1f3c,null))['then'](respondWithResult(_0x4b1f3c,null))[_0x2055('0x59')](handleError(_0x4b1f3c,null));};exports[_0x2055('0x5e')]=function(_0x431bff,_0x2ee7e5){return db[_0x2055('0x55')][_0x2055('0x5e')](_0x431bff[_0x2055('0x5f')],{})[_0x2055('0x58')](respondWithResult(_0x2ee7e5,0xc9))[_0x2055('0x59')](handleError(_0x2ee7e5,null));};exports[_0x2055('0x23')]=function(_0x2c8309,_0x5a44b2){if(_0x2c8309[_0x2055('0x5f')]['id']){delete _0x2c8309[_0x2055('0x5f')]['id'];}return db['CmHopper']['find']({'where':{'id':_0x2c8309[_0x2055('0x60')]['id']}})[_0x2055('0x58')](handleEntityNotFound(_0x5a44b2,null))[_0x2055('0x58')](saveUpdates(_0x2c8309[_0x2055('0x5f')],null))['then'](respondWithResult(_0x5a44b2,null))['catch'](handleError(_0x5a44b2,null));};exports[_0x2055('0x61')]=function(_0x28e80b,_0x3955ce){return db[_0x2055('0x55')]['describe']()[_0x2055('0x58')](respondWithResult(_0x3955ce,null))['catch'](handleError(_0x3955ce,null));};exports[_0x2055('0x24')]=function(_0xf3f0f,_0x151975){var _0x145ae0;return db[_0x2055('0x55')]['find']({'where':{'id':_0xf3f0f[_0x2055('0x60')]['id']}})[_0x2055('0x58')](handleEntityNotFound(_0x151975,null))[_0x2055('0x58')](function(_0x2a37b6){if(_0x2a37b6){return _0x2a37b6['destroy']()[_0x2055('0x58')](function(_0x3bf147){return _0x3bf147;});}})[_0x2055('0x58')](function(_0x20b9e6){_0x145ae0=_0x20b9e6;if(_0x20b9e6){if(_0x20b9e6['VoiceQueueId']||_0x20b9e6[_0x2055('0x62')]){return db[_0x20b9e6[_0x2055('0x63')]?_0x2055('0x64'):_0x2055('0x65')][_0x2055('0x5d')]({'where':{'id':_0x20b9e6['VoiceQueueId']?_0x20b9e6[_0x2055('0x63')]:_0x20b9e6['CampaignId']},'attributes':['id','name'],'raw':!![]});}}})[_0x2055('0x58')](function(_0x1942b1){var _0x31d58f={};if(_0x1942b1){_[_0x2055('0x53')](_0x31d58f,_[_0x2055('0x66')](_0x145ae0[_0x2055('0x67')],[_0x2055('0x68'),'updatedAt','id']));_0x31d58f[_0x2055('0x69')]=0x15;_0x31d58f[_0x2055('0x6a')]='deleted';_0x31d58f[_0x2055('0x6b')]=_0x1942b1[_0x2055('0x28')];_0x31d58f[_0x2055('0x6c')]=_0xf3f0f[_0x2055('0x6d')][_0x2055('0x28')];_0x31d58f[_0x2055('0x6e')]=_0xf3f0f['user']['id'];_0x31d58f[_0x2055('0x6f')]=!![];_0x31d58f[_0x2055('0x70')]=moment()[_0x2055('0x71')](_0x2055('0x72'));_0x31d58f['calleridnum']=_0x145ae0[_0x2055('0x73')];_0x31d58f[_0x2055('0x74')]=_0x145ae0['VoiceQueueId']?_0x2055('0x75'):_0x2055('0x76');return db[_0x2055('0x77')]['find']({'where':{'id':_0x31d58f['ContactId']},'attributes':[_0x2055('0x78'),_0x2055('0x79')]})[_0x2055('0x58')](function(_0x4dda19){if(!_[_0x2055('0x7a')](_0x151975)&&!_[_0x2055('0x7a')](_0x4dda19[_0x2055('0x78')])){_0x31d58f[_0x2055('0x7b')]=_0x4dda19[_0x2055('0x78')];if(!_['isNil'](_0x4dda19['lastName'])){_0x31d58f[_0x2055('0x7b')]+='\x20'+_0x4dda19['lastName'];}}})[_0x2055('0x7c')](function(){return db['CmHopperFinal'][_0x2055('0x5e')](_0x31d58f);});}})[_0x2055('0x58')](function(){return _0x151975[_0x2055('0x19')](0xcc)['end']();})['catch'](handleError(_0x151975,null));};exports[_0x2055('0x7d')]=function(_0xee6524,_0x4b8f6c,_0x8afe8e){var _0x21dccb=[];return db[_0x2055('0x77')][_0x2055('0x61')]()[_0x2055('0x58')](function(_0xc5d321){_0x21dccb=_[_0x2055('0x30')](_0xc5d321);return _0xee6524[_0x2055('0x6d')]['getVoiceQueues']({'where':{'type':_0x2055('0x7e'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id',_0x2055('0x7f')],'raw':!![]});})['then'](function(_0x1795d0){if(_0x1795d0&&_0x1795d0[_0x2055('0x4a')]){return db[_0x2055('0x80')]['transaction'](function(_0x51f101){var _0x9a209d={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x2055('0x71')](_0x2055('0x72'))},'VoiceQueueId':{'$in':_[_0x2055('0x2a')](_0x1795d0,'id')},'$or':[{'UserId':null},{'UserId':_0xee6524[_0x2055('0x6d')]['id']}]};var _0x9b6807=[];if(_0xee6524[_0x2055('0x5f')]['direction']&&_0xee6524[_0x2055('0x5f')]['direction']===_0x2055('0x81')){if(!_[_0x2055('0x82')](_0xee6524[_0x2055('0x5f')][_0x2055('0x83')])){_0x9a209d['id']={'$in':_0xee6524[_0x2055('0x5f')]['hopperIds']};}_0x9b6807=[[_0x2055('0x84'),'ASC'],['scheduledAt',_0x1795d0[0x0]['dialOrderByScheduledAt']===_0x2055('0x85')?'DESC':_0x2055('0x85')],db[_0x2055('0x80')][_0x2055('0x86')](_0x2055('0x87')),['id',_0x2055('0x88')]];}else{if(!_['isEmpty'](_0xee6524[_0x2055('0x5f')][_0x2055('0x83')])){_0x9a209d['id']={'$notIn':_0xee6524[_0x2055('0x5f')][_0x2055('0x83')]};}_0x9b6807=[['priority',_0x2055('0x88')],['scheduledAt',_0x1795d0[0x0][_0x2055('0x7f')]],db['sequelize'][_0x2055('0x86')]('COALESCE(CmHopper.UserId,\x200)\x20DESC'),['id',_0x2055('0x85')]];}return db[_0x2055('0x55')][_0x2055('0x89')]({'attributes':['id',_0x2055('0x8a')],'where':_0x9a209d,'order':_0x9b6807,'transaction':_0x51f101,'lock':_0x51f101[_0x2055('0x8b')][_0x2055('0x8c')],'include':[{'model':db[_0x2055('0x77')],'as':'Contact','attributes':_0x21dccb,'include':[{'model':db[_0x2055('0x8d')],'as':_0x2055('0x8e'),'attributes':['id',_0x2055('0x28')]}]},{'model':db[_0x2055('0x8f')],'as':_0x2055('0x90'),'attributes':['id',_0x2055('0x28')]},{'model':db[_0x2055('0x64')],'as':_0x2055('0x91'),'attributes':['id',_0x2055('0x28'),'dialActive']}]})[_0x2055('0x58')](function(_0x54ce99){if(_0x54ce99){return _0x54ce99[_0x2055('0x23')]({'UserId':_0xee6524[_0x2055('0x6d')]['id']},{'transaction':_0x51f101});}});});}})[_0x2055('0x58')](handleEntityNotFound(_0x4b8f6c,null))[_0x2055('0x58')](respondWithResult(_0x4b8f6c,null))[_0x2055('0x59')](handleError(_0x4b8f6c,null));};exports[_0x2055('0x92')]=function(_0x1dfeeb,_0x5d88b5,_0x43bcd3){return _0x1dfeeb[_0x2055('0x6d')][_0x2055('0x93')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0x2055('0x94')},'attributes':['id'],'raw':!![]})['then'](function(_0x5d407f){if(_0x5d407f&&_0x5d407f[_0x2055('0x4a')]){return db['CmHopper']['count']({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0x2055('0x72'))},'VoiceQueueId':{'$in':_[_0x2055('0x2a')](_0x5d407f,'id')},'$or':[{'UserId':null},{'UserId':_0x1dfeeb[_0x2055('0x6d')]['id']}]}});}return 0x0;})['then'](function(_0x4e4a87){if(!_[_0x2055('0x7a')](_0x4e4a87)&&_[_0x2055('0x95')](_0x4e4a87)){return _0x5d88b5[_0x2055('0x19')](0xc8)[_0x2055('0x1b')]({'contacts':_0x4e4a87});}else{logger[_0x2055('0x26')]('CmHopper,\x20%s,\x20%s,\x20%s',_0x2055('0x92'),0x194,_0x2055('0x96'));_0x5d88b5[_0x2055('0x25')](0x194);}})[_0x2055('0x59')](handleError(_0x5d88b5,null));}; \ No newline at end of file +var _0xce99=['calleridname','finally','CmHopperFinal','getPreview','outbound','preview','dialOrderByScheduledAt','sequelize','transaction','format','hopperIds','priority','ASC','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','isEmpty','DESC','scheduledAt','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','LOCK','CmList','Queue','getOpenContacts','getVoiceQueues','error','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','rimraf','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','squel','crypto','jsforce','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','then','destroy','end','stack','name','send','index','map','CmHopper','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','concat','$or','$gt','$gte','$lt','$ne','$notBetween','$notIn','$like','$notLike','$iLike','$notILike','$overlap','$contains','$any','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','create','body','describe','VoiceQueueId','VoiceQueue','Campaign','CampaignId','omit','dataValues','updatedAt','statedesc','deleted','campaign','membername','user','UserId','deletedat','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','campaigntype','queue','ivr','CmContact','ContactId','isNil','firstName','lastName'];(function(_0x3b2369,_0x4c68b9){var _0x5a1367=function(_0x58ddcf){while(--_0x58ddcf){_0x3b2369['push'](_0x3b2369['shift']());}};_0x5a1367(++_0x4c68b9);}(_0xce99,0x131));var _0x9ce9=function(_0x7732d2,_0x2c0f5a){_0x7732d2=_0x7732d2-0x0;var _0x48051b=_0xce99[_0x7732d2];return _0x48051b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9ce9('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x9ce9('0x1'));var moment=require(_0x9ce9('0x2'));var BPromise=require(_0x9ce9('0x3'));var Mustache=require(_0x9ce9('0x4'));var util=require(_0x9ce9('0x5'));var path=require('path');var sox=require(_0x9ce9('0x6'));var csv=require(_0x9ce9('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9ce9('0x8'));var _=require('lodash');var squel=require(_0x9ce9('0x9'));var crypto=require(_0x9ce9('0xa'));var jsforce=require(_0x9ce9('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x9ce9('0xc'));var authService=require('../../components/auth/service');var qs=require(_0x9ce9('0xd'));var as=require(_0x9ce9('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9ce9('0xf'))('api');var utils=require('../../config/utils');var config=require(_0x9ce9('0x10'));var licenseUtil=require('../../config/license/util');var db=require(_0x9ce9('0x11'))['db'];function respondWithStatusCode(_0x2d13e9,_0x1c0457){_0x1c0457=_0x1c0457||0xcc;return function(_0x4be6ff){if(_0x4be6ff){return _0x2d13e9[_0x9ce9('0x12')](_0x1c0457);}return _0x2d13e9[_0x9ce9('0x13')](_0x1c0457)['end']();};}function respondWithResult(_0x1fd18a,_0x5b5209){_0x5b5209=_0x5b5209||0xc8;return function(_0x14cafb){if(_0x14cafb){return _0x1fd18a[_0x9ce9('0x13')](_0x5b5209)[_0x9ce9('0x14')](_0x14cafb);}};}function respondWithFilteredResult(_0x12c480,_0xde58de){return function(_0x4ab721){if(_0x4ab721){var _0x296884=typeof _0xde58de[_0x9ce9('0x15')]===_0x9ce9('0x16')&&typeof _0xde58de['limit']===_0x9ce9('0x16');var _0x113001=_0x4ab721[_0x9ce9('0x17')];var _0x252a6c=_0x296884?0x0:_0xde58de[_0x9ce9('0x15')];var _0x70b9d=_0x296884?_0x4ab721[_0x9ce9('0x17')]:_0xde58de[_0x9ce9('0x15')]+_0xde58de[_0x9ce9('0x18')];var _0x4ec2c6;if(_0x70b9d>=_0x113001){_0x70b9d=_0x113001;_0x4ec2c6=0xc8;}else{_0x4ec2c6=0xce;}_0x12c480[_0x9ce9('0x13')](_0x4ec2c6);return _0x12c480[_0x9ce9('0x19')](_0x9ce9('0x1a'),_0x252a6c+'-'+_0x70b9d+'/'+_0x113001)[_0x9ce9('0x14')](_0x4ab721);}return null;};}function patchUpdates(_0xb11c2e){return function(_0xa670af){try{jsonpatch[_0x9ce9('0x1b')](_0xa670af,_0xb11c2e,!![]);}catch(_0x17a600){return BPromise[_0x9ce9('0x1c')](_0x17a600);}return _0xa670af['save']();};}function saveUpdates(_0x35d1c2,_0x3eb075){return function(_0x4159b2){if(_0x4159b2){return _0x4159b2[_0x9ce9('0x1d')](_0x35d1c2)[_0x9ce9('0x1e')](function(_0x53c477){return _0x53c477;});}return null;};}function removeEntity(_0xdbd2e7,_0x1ea5ce){return function(_0x395283){if(_0x395283){return _0x395283[_0x9ce9('0x1f')]()[_0x9ce9('0x1e')](function(){_0xdbd2e7[_0x9ce9('0x13')](0xcc)[_0x9ce9('0x20')]();});}};}function handleEntityNotFound(_0xa475d1,_0x1de57d){return function(_0x2e1f35){if(!_0x2e1f35){_0xa475d1[_0x9ce9('0x12')](0x194);}return _0x2e1f35;};}function handleError(_0x13cfe0,_0x1c511d){_0x1c511d=_0x1c511d||0x1f4;return function(_0x1ae332){logger['error'](_0x1ae332[_0x9ce9('0x21')]);if(_0x1ae332[_0x9ce9('0x22')]){delete _0x1ae332[_0x9ce9('0x22')];}_0x13cfe0[_0x9ce9('0x13')](_0x1c511d)[_0x9ce9('0x23')](_0x1ae332);};}exports[_0x9ce9('0x24')]=function(_0x51da3e,_0x495b97){var _0x19a448={},_0x4fa434={},_0x587fe3={'count':0x0,'rows':[]};var _0x39bd4f=_[_0x9ce9('0x25')](db[_0x9ce9('0x26')][_0x9ce9('0x27')],function(_0x3df7d6){return{'name':_0x3df7d6[_0x9ce9('0x28')],'type':_0x3df7d6[_0x9ce9('0x29')][_0x9ce9('0x2a')]};});_0x4fa434[_0x9ce9('0x2b')]=_[_0x9ce9('0x25')](_0x39bd4f,_0x9ce9('0x22'));_0x4fa434['query']=_[_0x9ce9('0x2c')](_0x51da3e[_0x9ce9('0x2d')]);_0x4fa434[_0x9ce9('0x2e')]=_[_0x9ce9('0x2f')](_0x4fa434['model'],_0x4fa434[_0x9ce9('0x2d')]);_0x4fa434[_0x9ce9('0x2e')]=_[_0x9ce9('0x30')](_0x4fa434[_0x9ce9('0x2e')],['$and',_0x9ce9('0x31'),_0x9ce9('0x32'),_0x9ce9('0x33'),_0x9ce9('0x34'),'$lte',_0x9ce9('0x35'),'$eq','$not','$between',_0x9ce9('0x36'),'$in',_0x9ce9('0x37'),_0x9ce9('0x38'),_0x9ce9('0x39'),_0x9ce9('0x3a'),_0x9ce9('0x3b'),'$like',_0x9ce9('0x3c'),_0x9ce9('0x3d'),'$contained',_0x9ce9('0x3e')]);_0x19a448[_0x9ce9('0x3f')]=_[_0x9ce9('0x2f')](_0x4fa434[_0x9ce9('0x2b')],qs[_0x9ce9('0x40')](_0x51da3e[_0x9ce9('0x2d')]['fields']));_0x19a448[_0x9ce9('0x3f')]=_0x19a448[_0x9ce9('0x3f')][_0x9ce9('0x41')]?_0x19a448[_0x9ce9('0x3f')]:_0x4fa434[_0x9ce9('0x2b')];if(!_0x51da3e[_0x9ce9('0x2d')][_0x9ce9('0x42')]('nolimit')){_0x19a448[_0x9ce9('0x18')]=qs[_0x9ce9('0x18')](_0x51da3e[_0x9ce9('0x2d')]['limit']);_0x19a448[_0x9ce9('0x15')]=qs[_0x9ce9('0x15')](_0x51da3e['query'][_0x9ce9('0x15')]);}_0x19a448[_0x9ce9('0x43')]=qs[_0x9ce9('0x44')](_0x51da3e[_0x9ce9('0x2d')][_0x9ce9('0x44')]);_0x19a448[_0x9ce9('0x45')]=qs[_0x9ce9('0x2e')](_['pick'](_0x51da3e[_0x9ce9('0x2d')],_0x4fa434[_0x9ce9('0x2e')]),_0x39bd4f);if(_0x51da3e['query'][_0x9ce9('0x46')]){_0x19a448[_0x9ce9('0x45')]=_[_0x9ce9('0x47')](_0x19a448[_0x9ce9('0x45')],{'$or':_['map'](_0x39bd4f,function(_0x578994){if(_0x578994[_0x9ce9('0x29')]!==_0x9ce9('0x48')){var _0x541bcf={};_0x541bcf[_0x578994[_0x9ce9('0x22')]]={'$like':'%'+_0x51da3e['query'][_0x9ce9('0x46')]+'%'};return _0x541bcf;}})});}_0x19a448=_[_0x9ce9('0x47')]({},_0x19a448,_0x51da3e[_0x9ce9('0x49')]);var _0x484e9a={'where':_0x19a448['where']};return db['CmHopper'][_0x9ce9('0x17')](_0x484e9a)[_0x9ce9('0x1e')](function(_0xdede87){_0x587fe3[_0x9ce9('0x17')]=_0xdede87;if(_0x51da3e[_0x9ce9('0x2d')][_0x9ce9('0x4a')]){_0x19a448[_0x9ce9('0x4b')]=[{'all':!![]}];}return db['CmHopper']['findAll'](_0x19a448);})[_0x9ce9('0x1e')](function(_0x57e16b){_0x587fe3[_0x9ce9('0x4c')]=_0x57e16b;return _0x587fe3;})[_0x9ce9('0x1e')](respondWithFilteredResult(_0x495b97,_0x19a448))[_0x9ce9('0x4d')](handleError(_0x495b97,null));};exports[_0x9ce9('0x4e')]=function(_0xfa44c3,_0x1766b2){var _0x15012d={'raw':!![],'where':{'id':_0xfa44c3[_0x9ce9('0x4f')]['id']}},_0xe5b160={};_0xe5b160['model']=_[_0x9ce9('0x2c')](db[_0x9ce9('0x26')]['rawAttributes']);_0xe5b160[_0x9ce9('0x2d')]=_[_0x9ce9('0x2c')](_0xfa44c3[_0x9ce9('0x2d')]);_0xe5b160[_0x9ce9('0x2e')]=_[_0x9ce9('0x2f')](_0xe5b160[_0x9ce9('0x2b')],_0xe5b160[_0x9ce9('0x2d')]);_0x15012d[_0x9ce9('0x3f')]=_[_0x9ce9('0x2f')](_0xe5b160['model'],qs[_0x9ce9('0x40')](_0xfa44c3['query'][_0x9ce9('0x40')]));_0x15012d[_0x9ce9('0x3f')]=_0x15012d[_0x9ce9('0x3f')]['length']?_0x15012d[_0x9ce9('0x3f')]:_0xe5b160[_0x9ce9('0x2b')];if(_0xfa44c3[_0x9ce9('0x2d')][_0x9ce9('0x4a')]){_0x15012d['include']=[{'all':!![]}];}_0x15012d=_[_0x9ce9('0x47')]({},_0x15012d,_0xfa44c3[_0x9ce9('0x49')]);return db[_0x9ce9('0x26')][_0x9ce9('0x50')](_0x15012d)[_0x9ce9('0x1e')](handleEntityNotFound(_0x1766b2,null))[_0x9ce9('0x1e')](respondWithResult(_0x1766b2,null))[_0x9ce9('0x4d')](handleError(_0x1766b2,null));};exports[_0x9ce9('0x51')]=function(_0x5202a2,_0x50a4cc){return db[_0x9ce9('0x26')]['create'](_0x5202a2[_0x9ce9('0x52')],{})[_0x9ce9('0x1e')](respondWithResult(_0x50a4cc,0xc9))['catch'](handleError(_0x50a4cc,null));};exports[_0x9ce9('0x1d')]=function(_0x4d7c3f,_0x5bca7e){if(_0x4d7c3f[_0x9ce9('0x52')]['id']){delete _0x4d7c3f['body']['id'];}return db[_0x9ce9('0x26')]['find']({'where':{'id':_0x4d7c3f[_0x9ce9('0x4f')]['id']}})[_0x9ce9('0x1e')](handleEntityNotFound(_0x5bca7e,null))[_0x9ce9('0x1e')](saveUpdates(_0x4d7c3f[_0x9ce9('0x52')],null))[_0x9ce9('0x1e')](respondWithResult(_0x5bca7e,null))[_0x9ce9('0x4d')](handleError(_0x5bca7e,null));};exports[_0x9ce9('0x53')]=function(_0x67c948,_0x261e0b){return db[_0x9ce9('0x26')]['describe']()[_0x9ce9('0x1e')](respondWithResult(_0x261e0b,null))[_0x9ce9('0x4d')](handleError(_0x261e0b,null));};exports[_0x9ce9('0x1f')]=function(_0x107cd8,_0x270150){var _0x4a2f13;return db['CmHopper'][_0x9ce9('0x50')]({'where':{'id':_0x107cd8[_0x9ce9('0x4f')]['id']}})[_0x9ce9('0x1e')](handleEntityNotFound(_0x270150,null))[_0x9ce9('0x1e')](function(_0x27b14f){if(_0x27b14f){return _0x27b14f[_0x9ce9('0x1f')]()[_0x9ce9('0x1e')](function(_0x2ee45a){return _0x2ee45a;});}})[_0x9ce9('0x1e')](function(_0x3b6f59){_0x4a2f13=_0x3b6f59;if(_0x3b6f59){if(_0x3b6f59[_0x9ce9('0x54')]||_0x3b6f59['CampaignId']){return db[_0x3b6f59[_0x9ce9('0x54')]?_0x9ce9('0x55'):_0x9ce9('0x56')]['find']({'where':{'id':_0x3b6f59[_0x9ce9('0x54')]?_0x3b6f59[_0x9ce9('0x54')]:_0x3b6f59[_0x9ce9('0x57')]},'attributes':['id','name'],'raw':!![]});}}})[_0x9ce9('0x1e')](function(_0x377d50){var _0xf043e3={};if(_0x377d50){_[_0x9ce9('0x47')](_0xf043e3,_[_0x9ce9('0x58')](_0x4a2f13[_0x9ce9('0x59')],['createdAt',_0x9ce9('0x5a'),'id']));_0xf043e3['state']=0x15;_0xf043e3[_0x9ce9('0x5b')]=_0x9ce9('0x5c');_0xf043e3[_0x9ce9('0x5d')]=_0x377d50[_0x9ce9('0x22')];_0xf043e3[_0x9ce9('0x5e')]=_0x107cd8[_0x9ce9('0x5f')][_0x9ce9('0x22')];_0xf043e3[_0x9ce9('0x60')]=_0x107cd8[_0x9ce9('0x5f')]['id'];_0xf043e3[_0x9ce9('0x5c')]=!![];_0xf043e3[_0x9ce9('0x61')]=moment()['format'](_0x9ce9('0x62'));_0xf043e3[_0x9ce9('0x63')]=_0x4a2f13[_0x9ce9('0x64')];_0xf043e3[_0x9ce9('0x65')]=_0x4a2f13[_0x9ce9('0x54')]?_0x9ce9('0x66'):_0x9ce9('0x67');return db[_0x9ce9('0x68')][_0x9ce9('0x50')]({'where':{'id':_0xf043e3[_0x9ce9('0x69')]},'attributes':['firstName','lastName']})[_0x9ce9('0x1e')](function(_0x4ca07a){if(!_[_0x9ce9('0x6a')](_0x270150)&&!_['isNil'](_0x4ca07a[_0x9ce9('0x6b')])){_0xf043e3['calleridname']=_0x4ca07a[_0x9ce9('0x6b')];if(!_['isNil'](_0x4ca07a[_0x9ce9('0x6c')])){_0xf043e3[_0x9ce9('0x6d')]+='\x20'+_0x4ca07a[_0x9ce9('0x6c')];}}})[_0x9ce9('0x6e')](function(){return db[_0x9ce9('0x6f')][_0x9ce9('0x51')](_0xf043e3);});}})[_0x9ce9('0x1e')](function(){return _0x270150[_0x9ce9('0x13')](0xcc)[_0x9ce9('0x20')]();})[_0x9ce9('0x4d')](handleError(_0x270150,null));};exports[_0x9ce9('0x70')]=function(_0x32f15c,_0x286d0c,_0x2e96fb){var _0x30677c=[];return db[_0x9ce9('0x68')][_0x9ce9('0x53')]()['then'](function(_0x59ee4a){_0x30677c=_[_0x9ce9('0x2c')](_0x59ee4a);return _0x32f15c[_0x9ce9('0x5f')]['getVoiceQueues']({'where':{'type':_0x9ce9('0x71'),'dialActive':!![],'dialMethod':_0x9ce9('0x72')},'attributes':['id',_0x9ce9('0x73')],'raw':!![]});})[_0x9ce9('0x1e')](function(_0x32330f){if(_0x32330f&&_0x32330f[_0x9ce9('0x41')]){return db[_0x9ce9('0x74')][_0x9ce9('0x75')](function(_0xc9b33a){var _0x366f26={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x9ce9('0x76')](_0x9ce9('0x62'))},'VoiceQueueId':{'$in':_[_0x9ce9('0x25')](_0x32330f,'id')},'$or':[{'UserId':null},{'UserId':_0x32f15c[_0x9ce9('0x5f')]['id']}]};var _0x34a353=[];if(_0x32f15c[_0x9ce9('0x52')]['direction']&&_0x32f15c[_0x9ce9('0x52')]['direction']==='prev'){if(!_['isEmpty'](_0x32f15c[_0x9ce9('0x52')]['hopperIds'])){_0x366f26['id']={'$in':_0x32f15c['body'][_0x9ce9('0x77')]};}_0x34a353=[[_0x9ce9('0x78'),_0x9ce9('0x79')],['scheduledAt',_0x32330f[0x0][_0x9ce9('0x73')]===_0x9ce9('0x79')?'DESC':'ASC'],db[_0x9ce9('0x74')][_0x9ce9('0x7a')](_0x9ce9('0x7b')),['id','DESC']];}else{if(!_[_0x9ce9('0x7c')](_0x32f15c[_0x9ce9('0x52')][_0x9ce9('0x77')])){_0x366f26['id']={'$notIn':_0x32f15c[_0x9ce9('0x52')][_0x9ce9('0x77')]};}_0x34a353=[[_0x9ce9('0x78'),_0x9ce9('0x7d')],[_0x9ce9('0x7e'),_0x32330f[0x0][_0x9ce9('0x73')]],db[_0x9ce9('0x74')][_0x9ce9('0x7a')](_0x9ce9('0x7f')),['id',_0x9ce9('0x79')]];}return db['CmHopper'][_0x9ce9('0x80')]({'attributes':['id',_0x9ce9('0x81')],'where':_0x366f26,'order':_0x34a353,'transaction':_0xc9b33a,'lock':_0xc9b33a[_0x9ce9('0x82')]['UPDATE'],'include':[{'model':db[_0x9ce9('0x68')],'as':'Contact','attributes':_0x30677c,'include':[{'model':db['CmCompany'],'as':'Company','attributes':['id','name']}]},{'model':db[_0x9ce9('0x83')],'as':'List','attributes':['id',_0x9ce9('0x22')]},{'model':db[_0x9ce9('0x55')],'as':_0x9ce9('0x84'),'attributes':['id','name','dialActive']}]})['then'](function(_0x59411e){if(_0x59411e){return _0x59411e[_0x9ce9('0x1d')]({'UserId':_0x32f15c[_0x9ce9('0x5f')]['id']},{'transaction':_0xc9b33a});}});});}})[_0x9ce9('0x1e')](handleEntityNotFound(_0x286d0c,null))[_0x9ce9('0x1e')](respondWithResult(_0x286d0c,null))['catch'](handleError(_0x286d0c,null));};exports[_0x9ce9('0x85')]=function(_0x3de89b,_0x386f80,_0xef4335){return _0x3de89b[_0x9ce9('0x5f')][_0x9ce9('0x86')]({'where':{'type':_0x9ce9('0x71'),'dialActive':!![],'dialMethod':_0x9ce9('0x72')},'attributes':['id'],'raw':!![]})[_0x9ce9('0x1e')](function(_0x4e613b){if(_0x4e613b&&_0x4e613b[_0x9ce9('0x41')]){return db['CmHopper'][_0x9ce9('0x17')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x9ce9('0x76')](_0x9ce9('0x62'))},'VoiceQueueId':{'$in':_['map'](_0x4e613b,'id')},'$or':[{'UserId':null},{'UserId':_0x3de89b['user']['id']}]}});}return 0x0;})[_0x9ce9('0x1e')](function(_0x383403){if(!_['isNil'](_0x383403)&&_['isNumber'](_0x383403)){return _0x386f80[_0x9ce9('0x13')](0xc8)[_0x9ce9('0x14')]({'contacts':_0x383403});}else{logger[_0x9ce9('0x87')](_0x9ce9('0x88'),_0x9ce9('0x85'),0x194,_0x9ce9('0x89'));_0x386f80[_0x9ce9('0x12')](0x194);}})[_0x9ce9('0x4d')](handleError(_0x386f80,null));}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index 4e6c66f..bffccee 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 _0x1967=['scheduledat','phone','priority','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopper.attributes','define','CmHopper','cm_hopper'];(function(_0x54defc,_0x627178){var _0x1955d3=function(_0x299afe){while(--_0x299afe){_0x54defc['push'](_0x54defc['shift']());}};_0x1955d3(++_0x627178);}(_0x1967,0x173));var _0x7196=function(_0x48158f,_0x43bee9){_0x48158f=_0x48158f-0x0;var _0x517b18=_0x1967[_0x48158f];return _0x517b18;};'use strict';var _=require('lodash');var util=require(_0x7196('0x0'));var logger=require(_0x7196('0x1'))(_0x7196('0x2'));var moment=require(_0x7196('0x3'));var BPromise=require(_0x7196('0x4'));var rp=require(_0x7196('0x5'));var fs=require('fs');var path=require(_0x7196('0x6'));var rimraf=require(_0x7196('0x7'));var config=require(_0x7196('0x8'));var attributes=require(_0x7196('0x9'));module['exports']=function(_0x36b01e,_0x186175){return _0x36b01e[_0x7196('0xa')](_0x7196('0xb'),attributes,{'tableName':_0x7196('0xc'),'paranoid':![],'indexes':[{'name':_0x7196('0xd'),'fields':['scheduledat']},{'name':_0x7196('0xe'),'fields':[_0x7196('0xe')]},{'name':_0x7196('0xf'),'fields':[_0x7196('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2675=['path','rimraf','./cmHopper.attributes','exports','define','CmHopper','scheduledat','phone','priority','lodash','moment','bluebird'];(function(_0x142ec2,_0x5bb03d){var _0x45ef4e=function(_0x4bc513){while(--_0x4bc513){_0x142ec2['push'](_0x142ec2['shift']());}};_0x45ef4e(++_0x5bb03d);}(_0x2675,0x75));var _0x5267=function(_0xe307a6,_0x28c8d2){_0xe307a6=_0xe307a6-0x0;var _0x12437c=_0x2675[_0xe307a6];return _0x12437c;};'use strict';var _=require(_0x5267('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x5267('0x1'));var BPromise=require(_0x5267('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5267('0x3'));var rimraf=require(_0x5267('0x4'));var config=require('../../config/environment');var attributes=require(_0x5267('0x5'));module[_0x5267('0x6')]=function(_0x4bd042,_0x10f92c){return _0x4bd042[_0x5267('0x7')](_0x5267('0x8'),attributes,{'tableName':'cm_hopper','paranoid':![],'indexes':[{'name':_0x5267('0x9'),'fields':[_0x5267('0x9')]},{'name':'phone','fields':[_0x5267('0xa')]},{'name':'priority','fields':[_0x5267('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index 45f6eeb..395c35e 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 _0xdf4e=['findAll','LOCK','UPDATE','Contact','keys','User','voicePause','length','UserId','push','update','includes','all','MoveContactManagedDialer','CmHopperFinal','CountReScheduled','COUNT','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','order','GetContactRecallMe','GetCmHopperPreview','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','then','info','CmHopper,\x20%s,\x20%s','request\x20sent','CmHopper,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetCmHopper','CmHopper','options','raw','where','attributes','include','map','model','debug','ShowCmHopper','find','CreateCmHopper','create','body','UpdateCmHopper','limit','DestroyCmHopper','destroy','GetContactDialer','CmContact','describe','sequelize','transaction'];(function(_0x5a3c7b,_0x3fad44){var _0x5763f5=function(_0x238f9b){while(--_0x238f9b){_0x5a3c7b['push'](_0x5a3c7b['shift']());}};_0x5763f5(++_0x3fad44);}(_0xdf4e,0x132));var _0xedf4=function(_0x512f81,_0x4a7986){_0x512f81=_0x512f81-0x0;var _0xa15099=_0xdf4e[_0x512f81];return _0xa15099;};'use strict';var _=require('lodash');var util=require(_0xedf4('0x0'));var moment=require(_0xedf4('0x1'));var BPromise=require('bluebird');var rs=require(_0xedf4('0x2'));var fs=require('fs');var Redis=require(_0xedf4('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xedf4('0x4'));var logger=require(_0xedf4('0x5'))(_0xedf4('0x6'));var config=require(_0xedf4('0x7'));var jayson=require(_0xedf4('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x391061,_0x523d8f,_0x498000){return new BPromise(function(_0x2dedd6,_0x149500){return client['request'](_0x391061,_0x498000)[_0xedf4('0x9')](function(_0xcae11b){logger[_0xedf4('0xa')](_0xedf4('0xb'),_0x523d8f,_0xedf4('0xc'));logger['debug'](_0xedf4('0xd'),_0x523d8f,_0xedf4('0xc'),JSON[_0xedf4('0xe')](_0xcae11b));if(_0xcae11b[_0xedf4('0xf')]){if(_0xcae11b[_0xedf4('0xf')][_0xedf4('0x10')]===0x1f4){logger[_0xedf4('0xf')](_0xedf4('0xb'),_0x523d8f,_0xcae11b[_0xedf4('0xf')][_0xedf4('0x11')]);return _0x149500(_0xcae11b[_0xedf4('0xf')][_0xedf4('0x11')]);}logger['error'](_0xedf4('0xb'),_0x523d8f,_0xcae11b[_0xedf4('0xf')][_0xedf4('0x11')]);return _0x2dedd6(_0xcae11b[_0xedf4('0xf')][_0xedf4('0x11')]);}else{logger['info'](_0xedf4('0xb'),_0x523d8f,_0xedf4('0xc'));_0x2dedd6(_0xcae11b[_0xedf4('0x12')][_0xedf4('0x11')]);}})[_0xedf4('0x13')](function(_0x484667){logger['error'](_0xedf4('0xb'),_0x523d8f,_0x484667);_0x149500(_0x484667);});});}exports[_0xedf4('0x14')]=function(_0x20ce2d){var _0x10df57=this;return new Promise(function(_0xa4dc7,_0x45b086){return db[_0xedf4('0x15')]['findAll']({'raw':_0x20ce2d[_0xedf4('0x16')]?_0x20ce2d[_0xedf4('0x16')][_0xedf4('0x17')]===undefined?!![]:![]:!![],'where':_0x20ce2d['options']?_0x20ce2d[_0xedf4('0x16')][_0xedf4('0x18')]||null:null,'attributes':_0x20ce2d[_0xedf4('0x16')]?_0x20ce2d[_0xedf4('0x16')][_0xedf4('0x19')]||null:null,'limit':_0x20ce2d[_0xedf4('0x16')]?_0x20ce2d[_0xedf4('0x16')]['limit']||null:null,'include':_0x20ce2d[_0xedf4('0x16')]?_0x20ce2d[_0xedf4('0x16')][_0xedf4('0x1a')]?_[_0xedf4('0x1b')](_0x20ce2d[_0xedf4('0x16')][_0xedf4('0x1a')],function(_0x1d6335){return{'model':db[_0x1d6335['model']],'as':_0x1d6335['as'],'attributes':_0x1d6335['attributes'],'include':_0x1d6335[_0xedf4('0x1a')]?_['map'](_0x1d6335[_0xedf4('0x1a')],function(_0x246df5){return{'model':db[_0x246df5['model']],'as':_0x246df5['as'],'attributes':_0x246df5['attributes'],'include':_0x246df5[_0xedf4('0x1a')]?_[_0xedf4('0x1b')](_0x246df5[_0xedf4('0x1a')],function(_0x2088cd){return{'model':db[_0x2088cd[_0xedf4('0x1c')]],'as':_0x2088cd['as'],'attributes':_0x2088cd[_0xedf4('0x19')]};}):[]};}):[]};}):[]:[]})[_0xedf4('0x9')](function(_0x430df0){logger[_0xedf4('0xa')](_0xedf4('0x14'),_0x20ce2d);logger[_0xedf4('0x1d')](_0xedf4('0x14'),_0x20ce2d,JSON['stringify'](_0x430df0));_0xa4dc7(_0x430df0);})[_0xedf4('0x13')](function(_0x19d49f){logger[_0xedf4('0xf')](_0xedf4('0x14'),_0x19d49f[_0xedf4('0x11')],_0x20ce2d);_0x45b086(_0x10df57['error'](0x1f4,_0x19d49f[_0xedf4('0x11')]));});});};exports[_0xedf4('0x1e')]=function(_0x256179){var _0x3944c1=this;return new Promise(function(_0x28f6c5,_0x1ef864){return db[_0xedf4('0x15')][_0xedf4('0x1f')]({'raw':_0x256179[_0xedf4('0x16')]?_0x256179['options']['raw']===undefined?!![]:![]:!![],'where':_0x256179[_0xedf4('0x16')]?_0x256179['options']['where']||null:null,'attributes':_0x256179[_0xedf4('0x16')]?_0x256179[_0xedf4('0x16')]['attributes']||null:null,'include':_0x256179[_0xedf4('0x16')]?_0x256179[_0xedf4('0x16')][_0xedf4('0x1a')]?_['map'](_0x256179[_0xedf4('0x16')][_0xedf4('0x1a')],function(_0x889516){return{'model':db[_0x889516[_0xedf4('0x1c')]],'as':_0x889516['as'],'attributes':_0x889516[_0xedf4('0x19')],'include':_0x889516['include']?_[_0xedf4('0x1b')](_0x889516[_0xedf4('0x1a')],function(_0x4ba2c8){return{'model':db[_0x4ba2c8['model']],'as':_0x4ba2c8['as'],'attributes':_0x4ba2c8[_0xedf4('0x19')],'include':_0x4ba2c8['include']?_[_0xedf4('0x1b')](_0x4ba2c8[_0xedf4('0x1a')],function(_0x220bab){return{'model':db[_0x220bab['model']],'as':_0x220bab['as'],'attributes':_0x220bab[_0xedf4('0x19')]};}):[]};}):[]};}):[]:[]})[_0xedf4('0x9')](function(_0x338a7a){logger[_0xedf4('0xa')](_0xedf4('0x1e'),_0x256179);logger[_0xedf4('0x1d')](_0xedf4('0x1e'),_0x256179,JSON[_0xedf4('0xe')](_0x338a7a));_0x28f6c5(_0x338a7a);})[_0xedf4('0x13')](function(_0x147d88){logger[_0xedf4('0xf')](_0xedf4('0x1e'),_0x147d88[_0xedf4('0x11')],_0x256179);_0x1ef864(_0x3944c1[_0xedf4('0xf')](0x1f4,_0x147d88[_0xedf4('0x11')]));});});};exports[_0xedf4('0x20')]=function(_0x5eb1ac){var _0x28b79c=this;return new Promise(function(_0x3596fd,_0x2be2c9){return db['CmHopper'][_0xedf4('0x21')](_0x5eb1ac[_0xedf4('0x22')],{'raw':_0x5eb1ac['options']?_0x5eb1ac[_0xedf4('0x16')][_0xedf4('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x4be1d0){logger['info'](_0xedf4('0x20'),_0x5eb1ac);logger[_0xedf4('0x1d')](_0xedf4('0x20'),_0x5eb1ac,JSON[_0xedf4('0xe')](_0x4be1d0));_0x3596fd(_0x4be1d0);})[_0xedf4('0x13')](function(_0x211ab1){logger[_0xedf4('0xf')](_0xedf4('0x20'),_0x211ab1[_0xedf4('0x11')],_0x5eb1ac);_0x2be2c9(_0x28b79c[_0xedf4('0xf')](0x1f4,_0x211ab1['message']));});});};exports[_0xedf4('0x23')]=function(_0x1fff45){var _0x4e5f28=this;return new Promise(function(_0xe070f2,_0x43551d){return db[_0xedf4('0x15')]['update'](_0x1fff45['body'],{'raw':_0x1fff45[_0xedf4('0x16')]?_0x1fff45[_0xedf4('0x16')][_0xedf4('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1fff45[_0xedf4('0x16')]?_0x1fff45[_0xedf4('0x16')][_0xedf4('0x18')]||null:null,'attributes':_0x1fff45[_0xedf4('0x16')]?_0x1fff45[_0xedf4('0x16')][_0xedf4('0x19')]||null:null,'limit':_0x1fff45[_0xedf4('0x16')]?_0x1fff45[_0xedf4('0x16')][_0xedf4('0x24')]||null:null})[_0xedf4('0x9')](function(_0x455120){logger['info'](_0xedf4('0x23'),_0x1fff45);logger[_0xedf4('0x1d')](_0xedf4('0x23'),_0x1fff45,JSON[_0xedf4('0xe')](_0x455120));_0xe070f2(_0x455120);})['catch'](function(_0x468641){logger['error']('UpdateCmHopper',_0x468641[_0xedf4('0x11')],_0x1fff45);_0x43551d(_0x4e5f28[_0xedf4('0xf')](0x1f4,_0x468641[_0xedf4('0x11')]));});});};exports[_0xedf4('0x25')]=function(_0x3e00db){var _0x4e364c=this;return new Promise(function(_0x46be0a,_0x41addd){return db[_0xedf4('0x15')][_0xedf4('0x26')]({'where':_0x3e00db[_0xedf4('0x16')]?_0x3e00db[_0xedf4('0x16')]['where']||null:null})['then'](function(_0x2cbbfa){logger[_0xedf4('0xa')]('DestroyCmHopper',_0x3e00db);logger[_0xedf4('0x1d')]('DestroyCmHopper',_0x3e00db,JSON[_0xedf4('0xe')](_0x2cbbfa));_0x46be0a(_0x2cbbfa);})[_0xedf4('0x13')](function(_0x28f449){logger[_0xedf4('0xf')](_0xedf4('0x25'),_0x28f449[_0xedf4('0x11')],_0x3e00db);_0x41addd(_0x4e364c[_0xedf4('0xf')](0x1f4,_0x28f449[_0xedf4('0x11')]));});});};exports[_0xedf4('0x27')]=function(_0x3accdb){var _0x3ddd9f=this;return new Promise(function(_0x2022ed,_0x21403a){return db[_0xedf4('0x28')][_0xedf4('0x29')]()[_0xedf4('0x9')](function(_0x2f1994){return db[_0xedf4('0x2a')][_0xedf4('0x2b')](function(_0x43b36f){return db[_0xedf4('0x15')][_0xedf4('0x2c')]({'where':_0x3accdb[_0xedf4('0x16')]?_0x3accdb['options'][_0xedf4('0x18')]||null:null,'attributes':_0x3accdb[_0xedf4('0x16')]?_0x3accdb['options'][_0xedf4('0x19')]||null:null,'limit':_0x3accdb[_0xedf4('0x16')]?_0x3accdb[_0xedf4('0x16')][_0xedf4('0x24')]||null:null,'order':_0x3accdb[_0xedf4('0x16')]?_0x3accdb[_0xedf4('0x16')]['order']||null:null,'transaction':_0x43b36f,'lock':_0x43b36f[_0xedf4('0x2d')][_0xedf4('0x2e')],'include':[{'model':db[_0xedf4('0x28')],'as':_0xedf4('0x2f'),'attributes':_[_0xedf4('0x30')](_0x2f1994)},{'model':db[_0xedf4('0x31')],'as':'Agent','attributes':['id','name',_0xedf4('0x32')]}]})[_0xedf4('0x9')](function(_0x4c3709){var _0x1384e2=[];var _0x4a7016=[];for(var _0x4b6cd7=0x0;_0x4b6cd7<_0x4c3709[_0xedf4('0x33')];_0x4b6cd7+=0x1){var _0x4575f8=_0x4c3709[_0x4b6cd7][_0xedf4('0x34')];if(_0x4575f8===null){_0x1384e2[_0xedf4('0x35')](_0x4c3709[_0x4b6cd7][_0xedf4('0x36')](_0x3accdb[_0xedf4('0x22')],{'transaction':_0x43b36f}));}else if(!_0x4a7016[_0xedf4('0x37')](_0x4575f8)){_0x4a7016['push'](_0x4575f8);_0x1384e2['push'](_0x4c3709[_0x4b6cd7][_0xedf4('0x36')](_0x3accdb['body'],{'transaction':_0x43b36f}));}}return BPromise[_0xedf4('0x38')](_0x1384e2);});})[_0xedf4('0x9')](function(_0x485040){logger[_0xedf4('0xa')](_0xedf4('0x27'),_0x3accdb);logger[_0xedf4('0x1d')](_0xedf4('0x27'),_0x3accdb,JSON[_0xedf4('0xe')](_0x485040));_0x2022ed(_0x485040);})[_0xedf4('0x13')](function(_0x4643a3){logger[_0xedf4('0xf')](_0xedf4('0x27'),_0x4643a3[_0xedf4('0x11')],_0x3accdb);_0x21403a(_0x3ddd9f[_0xedf4('0xf')](0x1f4,_0x4643a3[_0xedf4('0x11')]));});});});};exports[_0xedf4('0x39')]=function(_0x217117){var _0x1f9948=this;return new Promise(function(_0x179897,_0x1c043e){return db['sequelize']['transaction'](function(_0x584b10){return db[_0xedf4('0x3a')]['create'](_0x217117[_0xedf4('0x22')],{'raw':_0x217117['options']?_0x217117[_0xedf4('0x16')][_0xedf4('0x17')]===undefined?!![]:![]:!![],'transaction':_0x584b10})[_0xedf4('0x9')](function(){return db[_0xedf4('0x15')][_0xedf4('0x26')]({'where':_0x217117[_0xedf4('0x16')]?_0x217117[_0xedf4('0x16')][_0xedf4('0x18')]||null:null,'transaction':_0x584b10});});})[_0xedf4('0x9')](function(_0x5078ad){logger[_0xedf4('0xa')]('MoveContactManagedDialer',_0x217117);logger[_0xedf4('0x1d')](_0xedf4('0x39'),_0x217117,JSON['stringify'](_0x5078ad));_0x179897(_0x5078ad);})[_0xedf4('0x13')](function(_0x5adb0f){logger[_0xedf4('0xf')](_0xedf4('0x39'),_0x5adb0f[_0xedf4('0x11')],_0x217117);_0x1c043e(_0x1f9948[_0xedf4('0xf')](0x1f4,_0x5adb0f[_0xedf4('0x11')]));});});};exports[_0xedf4('0x3b')]=function(_0x442368){var _0x4537bc=this;return new Promise(function(_0x3e21a2,_0x23e19b){return db['CmHopper'][_0xedf4('0x2c')]({'raw':_0x442368[_0xedf4('0x16')]?_0x442368[_0xedf4('0x16')][_0xedf4('0x17')]===undefined?!![]:![]:!![],'where':_0x442368['options']?_0x442368[_0xedf4('0x16')][_0xedf4('0x18')]||null:null,'attributes':[[db['sequelize']['fn'](_0xedf4('0x3c'),db[_0xedf4('0x2a')]['fn']('IF',db[_0xedf4('0x2a')]['literal'](_0xedf4('0x3d')+util[_0xedf4('0x3e')](_0xedf4('0x3f'),moment()[_0xedf4('0x3e')](_0xedf4('0x40')))+_0xedf4('0x41')))),_0xedf4('0x42')]]})[_0xedf4('0x9')](function(_0x5ba15f){logger['info'](_0xedf4('0x3b'),_0x442368);logger[_0xedf4('0x1d')](_0xedf4('0x3b'),_0x442368,JSON[_0xedf4('0xe')](_0x5ba15f));_0x3e21a2(_0x5ba15f);})['catch'](function(_0x4e34cb){logger['error'](_0xedf4('0x3b'),_0x4e34cb['message'],_0x442368);_0x23e19b(_0x4537bc[_0xedf4('0xf')](0x1f4,_0x4e34cb[_0xedf4('0x11')]));});});};exports['GetContactRecallMe']=function(_0x3a086e){var _0x465911=this;return new Promise(function(_0x2f2de9,_0x18bfdb){return db[_0xedf4('0x28')][_0xedf4('0x29')]()[_0xedf4('0x9')](function(_0x52c3cb){return db['sequelize']['transaction'](function(_0xcfd34e){return db[_0xedf4('0x15')][_0xedf4('0x2c')]({'where':_0x3a086e[_0xedf4('0x16')]?_0x3a086e[_0xedf4('0x16')][_0xedf4('0x18')]||null:null,'attributes':_0x3a086e[_0xedf4('0x16')]?_0x3a086e[_0xedf4('0x16')][_0xedf4('0x19')]||null:null,'limit':0x1,'order':_0x3a086e[_0xedf4('0x16')]?_0x3a086e[_0xedf4('0x16')][_0xedf4('0x43')]||null:null,'group':db[_0xedf4('0x15')]['UserId'],'transaction':_0xcfd34e,'lock':_0xcfd34e[_0xedf4('0x2d')]['UPDATE'],'include':_0x3a086e[_0xedf4('0x16')]?_0x3a086e['options'][_0xedf4('0x1a')]?_['map'](_0x3a086e[_0xedf4('0x16')]['include'],function(_0x55c4ed){return{'model':db[_0x55c4ed[_0xedf4('0x1c')]],'as':_0x55c4ed['as'],'attributes':_0x55c4ed[_0xedf4('0x19')],'include':_0x55c4ed[_0xedf4('0x1a')]?_[_0xedf4('0x1b')](_0x55c4ed[_0xedf4('0x1a')],function(_0xfc014f){return{'model':db[_0xfc014f['model']],'as':_0xfc014f['as'],'attributes':_0xfc014f['attributes'],'include':_0xfc014f[_0xedf4('0x1a')]?_[_0xedf4('0x1b')](_0xfc014f['include'],function(_0x1908f7){return{'model':db[_0x1908f7[_0xedf4('0x1c')]],'as':_0x1908f7['as'],'attributes':_0x1908f7[_0xedf4('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x25362b){var _0x3633d6=[];for(var _0x5cc338=0x0;_0x5cc338<_0x25362b[_0xedf4('0x33')];_0x5cc338+=0x1){_0x3633d6[_0xedf4('0x35')](_0x25362b[_0x5cc338][_0xedf4('0x36')](_0x3a086e['body'],{'transaction':_0xcfd34e}));}return BPromise['all'](_0x3633d6);});})['then'](function(_0x3b5acb){logger[_0xedf4('0xa')](_0xedf4('0x44'),_0x3a086e);logger[_0xedf4('0x1d')](_0xedf4('0x44'),_0x3a086e,JSON[_0xedf4('0xe')](_0x3b5acb));_0x2f2de9(_0x3b5acb);})[_0xedf4('0x13')](function(_0x3449ac){logger[_0xedf4('0xf')](_0xedf4('0x44'),_0x3449ac[_0xedf4('0x11')],_0x3a086e);_0x18bfdb(_0x465911[_0xedf4('0xf')](0x1f4,_0x3449ac[_0xedf4('0x11')]));});});});};exports[_0xedf4('0x45')]=function(_0x3a2883){var _0x423c06=this;return new Promise(function(_0x430f6c,_0x4bd5e1){db[_0xedf4('0x28')][_0xedf4('0x29')]()[_0xedf4('0x9')](function(_0x570488){return db['CmHopper'][_0xedf4('0x2c')]({'raw':_0x3a2883[_0xedf4('0x16')]?_0x3a2883[_0xedf4('0x16')][_0xedf4('0x17')]===undefined?!![]:![]:!![],'where':_0x3a2883[_0xedf4('0x16')]?_0x3a2883[_0xedf4('0x16')][_0xedf4('0x18')]||null:null,'attributes':_0x3a2883['options']?_0x3a2883[_0xedf4('0x16')][_0xedf4('0x19')]||null:null,'limit':_0x3a2883[_0xedf4('0x16')]?_0x3a2883[_0xedf4('0x16')][_0xedf4('0x24')]||null:null,'include':_0x3a2883[_0xedf4('0x16')]?_0x3a2883[_0xedf4('0x16')][_0xedf4('0x1a')]?_[_0xedf4('0x1b')](_0x3a2883[_0xedf4('0x16')]['include'],function(_0x559ec1){return{'model':db[_0x559ec1[_0xedf4('0x1c')]],'as':_0x559ec1['as'],'attributes':_0x559ec1['as']==='Contact'?_[_0xedf4('0x30')](_0x570488):_0x559ec1['attributes'],'include':_0x559ec1[_0xedf4('0x1a')]?_[_0xedf4('0x1b')](_0x559ec1[_0xedf4('0x1a')],function(_0x47551f){return{'model':db[_0x47551f[_0xedf4('0x1c')]],'as':_0x47551f['as'],'attributes':_0x47551f[_0xedf4('0x19')],'include':_0x47551f['include']?_[_0xedf4('0x1b')](_0x47551f[_0xedf4('0x1a')],function(_0x390a04){return{'model':db[_0x390a04['model']],'as':_0x390a04['as'],'attributes':_0x390a04[_0xedf4('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1ca1a7){logger[_0xedf4('0xa')](_0xedf4('0x14'),_0x3a2883);logger[_0xedf4('0x1d')](_0xedf4('0x14'),_0x3a2883,JSON['stringify'](_0x1ca1a7));_0x430f6c(_0x1ca1a7);})[_0xedf4('0x13')](function(_0x57316d){logger[_0xedf4('0xf')](_0xedf4('0x14'),_0x57316d[_0xedf4('0x11')],_0x3a2883);_0x4bd5e1(_0x423c06[_0xedf4('0xf')](0x1f4,_0x57316d[_0xedf4('0x11')]));});});});}; \ No newline at end of file +var _0xfb6b=['Contact','User','Agent','voicePause','length','push','includes','update','body','all','CmHopperFinal','destroy','MoveContactManagedDialer','CountReScheduled','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','GetContactRecallMe','describe','GetCmHopperPreview','keys','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','info','CmHopper,\x20%s,\x20%s','debug','CmHopper,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','GetCmHopper','CmHopper','findAll','options','limit','map','include','model','attributes','then','ShowCmHopper','find','raw','where','CreateCmHopper','create','UpdateCmHopper','DestroyCmHopper','GetContactDialer','CmContact','sequelize','transaction','order','UPDATE'];(function(_0x2e128c,_0x548947){var _0xe834f4=function(_0x525b84){while(--_0x525b84){_0x2e128c['push'](_0x2e128c['shift']());}};_0xe834f4(++_0x548947);}(_0xfb6b,0xe0));var _0xbfb6=function(_0x395f38,_0x50cd9e){_0x395f38=_0x395f38-0x0;var _0x519e5d=_0xfb6b[_0x395f38];return _0x519e5d;};'use strict';var _=require(_0xbfb6('0x0'));var util=require(_0xbfb6('0x1'));var moment=require(_0xbfb6('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbfb6('0x3'));var db=require(_0xbfb6('0x4'))['db'];var utils=require(_0xbfb6('0x5'));var logger=require(_0xbfb6('0x6'))(_0xbfb6('0x7'));var config=require('../../config/environment');var jayson=require(_0xbfb6('0x8'));var client=jayson[_0xbfb6('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x142a98,_0x1aafe9,_0x227dc0){return new BPromise(function(_0x51ca81,_0x2a749a){return client['request'](_0x142a98,_0x227dc0)['then'](function(_0x17afbb){logger[_0xbfb6('0xa')](_0xbfb6('0xb'),_0x1aafe9,'request\x20sent');logger[_0xbfb6('0xc')](_0xbfb6('0xd'),_0x1aafe9,_0xbfb6('0xe'),JSON[_0xbfb6('0xf')](_0x17afbb));if(_0x17afbb[_0xbfb6('0x10')]){if(_0x17afbb[_0xbfb6('0x10')]['code']===0x1f4){logger[_0xbfb6('0x10')](_0xbfb6('0xb'),_0x1aafe9,_0x17afbb['error'][_0xbfb6('0x11')]);return _0x2a749a(_0x17afbb[_0xbfb6('0x10')][_0xbfb6('0x11')]);}logger[_0xbfb6('0x10')]('CmHopper,\x20%s,\x20%s',_0x1aafe9,_0x17afbb[_0xbfb6('0x10')][_0xbfb6('0x11')]);return _0x51ca81(_0x17afbb[_0xbfb6('0x10')][_0xbfb6('0x11')]);}else{logger[_0xbfb6('0xa')](_0xbfb6('0xb'),_0x1aafe9,_0xbfb6('0xe'));_0x51ca81(_0x17afbb[_0xbfb6('0x12')]['message']);}})[_0xbfb6('0x13')](function(_0x221536){logger[_0xbfb6('0x10')](_0xbfb6('0xb'),_0x1aafe9,_0x221536);_0x2a749a(_0x221536);});});}exports[_0xbfb6('0x14')]=function(_0x59105c){var _0x195a14=this;return new Promise(function(_0x4f5950,_0x23fd87){return db[_0xbfb6('0x15')][_0xbfb6('0x16')]({'raw':_0x59105c['options']?_0x59105c[_0xbfb6('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x59105c[_0xbfb6('0x17')]?_0x59105c['options']['where']||null:null,'attributes':_0x59105c['options']?_0x59105c[_0xbfb6('0x17')]['attributes']||null:null,'limit':_0x59105c[_0xbfb6('0x17')]?_0x59105c['options'][_0xbfb6('0x18')]||null:null,'include':_0x59105c[_0xbfb6('0x17')]?_0x59105c[_0xbfb6('0x17')]['include']?_[_0xbfb6('0x19')](_0x59105c[_0xbfb6('0x17')][_0xbfb6('0x1a')],function(_0x406e77){return{'model':db[_0x406e77[_0xbfb6('0x1b')]],'as':_0x406e77['as'],'attributes':_0x406e77['attributes'],'include':_0x406e77[_0xbfb6('0x1a')]?_['map'](_0x406e77['include'],function(_0x5fecab){return{'model':db[_0x5fecab[_0xbfb6('0x1b')]],'as':_0x5fecab['as'],'attributes':_0x5fecab[_0xbfb6('0x1c')],'include':_0x5fecab['include']?_[_0xbfb6('0x19')](_0x5fecab[_0xbfb6('0x1a')],function(_0xc4ab22){return{'model':db[_0xc4ab22[_0xbfb6('0x1b')]],'as':_0xc4ab22['as'],'attributes':_0xc4ab22[_0xbfb6('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xbfb6('0x1d')](function(_0x2af2d9){logger[_0xbfb6('0xa')]('GetCmHopper',_0x59105c);logger['debug'](_0xbfb6('0x14'),_0x59105c,JSON[_0xbfb6('0xf')](_0x2af2d9));_0x4f5950(_0x2af2d9);})[_0xbfb6('0x13')](function(_0x2b0286){logger[_0xbfb6('0x10')](_0xbfb6('0x14'),_0x2b0286[_0xbfb6('0x11')],_0x59105c);_0x23fd87(_0x195a14[_0xbfb6('0x10')](0x1f4,_0x2b0286['message']));});});};exports[_0xbfb6('0x1e')]=function(_0x968bc2){var _0xd9a1e9=this;return new Promise(function(_0x50937e,_0x544610){return db[_0xbfb6('0x15')][_0xbfb6('0x1f')]({'raw':_0x968bc2[_0xbfb6('0x17')]?_0x968bc2[_0xbfb6('0x17')][_0xbfb6('0x20')]===undefined?!![]:![]:!![],'where':_0x968bc2[_0xbfb6('0x17')]?_0x968bc2[_0xbfb6('0x17')][_0xbfb6('0x21')]||null:null,'attributes':_0x968bc2[_0xbfb6('0x17')]?_0x968bc2[_0xbfb6('0x17')][_0xbfb6('0x1c')]||null:null,'include':_0x968bc2[_0xbfb6('0x17')]?_0x968bc2[_0xbfb6('0x17')][_0xbfb6('0x1a')]?_[_0xbfb6('0x19')](_0x968bc2[_0xbfb6('0x17')]['include'],function(_0x493017){return{'model':db[_0x493017[_0xbfb6('0x1b')]],'as':_0x493017['as'],'attributes':_0x493017[_0xbfb6('0x1c')],'include':_0x493017['include']?_['map'](_0x493017[_0xbfb6('0x1a')],function(_0x3da15b){return{'model':db[_0x3da15b[_0xbfb6('0x1b')]],'as':_0x3da15b['as'],'attributes':_0x3da15b['attributes'],'include':_0x3da15b[_0xbfb6('0x1a')]?_[_0xbfb6('0x19')](_0x3da15b[_0xbfb6('0x1a')],function(_0x261042){return{'model':db[_0x261042['model']],'as':_0x261042['as'],'attributes':_0x261042[_0xbfb6('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xbfb6('0x1d')](function(_0x30a528){logger[_0xbfb6('0xa')](_0xbfb6('0x1e'),_0x968bc2);logger[_0xbfb6('0xc')](_0xbfb6('0x1e'),_0x968bc2,JSON[_0xbfb6('0xf')](_0x30a528));_0x50937e(_0x30a528);})['catch'](function(_0x1cae17){logger[_0xbfb6('0x10')](_0xbfb6('0x1e'),_0x1cae17[_0xbfb6('0x11')],_0x968bc2);_0x544610(_0xd9a1e9[_0xbfb6('0x10')](0x1f4,_0x1cae17[_0xbfb6('0x11')]));});});};exports[_0xbfb6('0x22')]=function(_0x46b930){var _0x232494=this;return new Promise(function(_0x582d52,_0x1c9297){return db[_0xbfb6('0x15')][_0xbfb6('0x23')](_0x46b930['body'],{'raw':_0x46b930[_0xbfb6('0x17')]?_0x46b930[_0xbfb6('0x17')][_0xbfb6('0x20')]===undefined?!![]:![]:!![]})['then'](function(_0x1b73b6){logger[_0xbfb6('0xa')]('CreateCmHopper',_0x46b930);logger[_0xbfb6('0xc')]('CreateCmHopper',_0x46b930,JSON[_0xbfb6('0xf')](_0x1b73b6));_0x582d52(_0x1b73b6);})[_0xbfb6('0x13')](function(_0x3e5275){logger[_0xbfb6('0x10')](_0xbfb6('0x22'),_0x3e5275['message'],_0x46b930);_0x1c9297(_0x232494[_0xbfb6('0x10')](0x1f4,_0x3e5275[_0xbfb6('0x11')]));});});};exports[_0xbfb6('0x24')]=function(_0x424f37){var _0x4ba838=this;return new Promise(function(_0xe05315,_0x32debf){return db['CmHopper']['update'](_0x424f37['body'],{'raw':_0x424f37[_0xbfb6('0x17')]?_0x424f37[_0xbfb6('0x17')][_0xbfb6('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x424f37[_0xbfb6('0x17')]?_0x424f37['options'][_0xbfb6('0x21')]||null:null,'attributes':_0x424f37['options']?_0x424f37['options']['attributes']||null:null,'limit':_0x424f37['options']?_0x424f37[_0xbfb6('0x17')][_0xbfb6('0x18')]||null:null})['then'](function(_0x560264){logger[_0xbfb6('0xa')](_0xbfb6('0x24'),_0x424f37);logger[_0xbfb6('0xc')](_0xbfb6('0x24'),_0x424f37,JSON[_0xbfb6('0xf')](_0x560264));_0xe05315(_0x560264);})['catch'](function(_0x4b3b90){logger['error'](_0xbfb6('0x24'),_0x4b3b90[_0xbfb6('0x11')],_0x424f37);_0x32debf(_0x4ba838[_0xbfb6('0x10')](0x1f4,_0x4b3b90[_0xbfb6('0x11')]));});});};exports[_0xbfb6('0x25')]=function(_0x409b8d){var _0x1bdb83=this;return new Promise(function(_0x2c8124,_0x287c52){return db[_0xbfb6('0x15')]['destroy']({'where':_0x409b8d[_0xbfb6('0x17')]?_0x409b8d['options'][_0xbfb6('0x21')]||null:null})['then'](function(_0x158afa){logger['info']('DestroyCmHopper',_0x409b8d);logger[_0xbfb6('0xc')]('DestroyCmHopper',_0x409b8d,JSON['stringify'](_0x158afa));_0x2c8124(_0x158afa);})['catch'](function(_0x3cbae8){logger[_0xbfb6('0x10')](_0xbfb6('0x25'),_0x3cbae8[_0xbfb6('0x11')],_0x409b8d);_0x287c52(_0x1bdb83[_0xbfb6('0x10')](0x1f4,_0x3cbae8[_0xbfb6('0x11')]));});});};exports[_0xbfb6('0x26')]=function(_0x56e8d6){var _0x45b7df=this;return new Promise(function(_0x215519,_0x52b75d){return db[_0xbfb6('0x27')]['describe']()[_0xbfb6('0x1d')](function(_0x5eb241){return db[_0xbfb6('0x28')][_0xbfb6('0x29')](function(_0x530f22){return db[_0xbfb6('0x15')][_0xbfb6('0x16')]({'where':_0x56e8d6[_0xbfb6('0x17')]?_0x56e8d6[_0xbfb6('0x17')][_0xbfb6('0x21')]||null:null,'attributes':_0x56e8d6[_0xbfb6('0x17')]?_0x56e8d6['options'][_0xbfb6('0x1c')]||null:null,'limit':_0x56e8d6[_0xbfb6('0x17')]?_0x56e8d6[_0xbfb6('0x17')][_0xbfb6('0x18')]||null:null,'order':_0x56e8d6[_0xbfb6('0x17')]?_0x56e8d6[_0xbfb6('0x17')][_0xbfb6('0x2a')]||null:null,'transaction':_0x530f22,'lock':_0x530f22['LOCK'][_0xbfb6('0x2b')],'include':[{'model':db[_0xbfb6('0x27')],'as':_0xbfb6('0x2c'),'attributes':_['keys'](_0x5eb241)},{'model':db[_0xbfb6('0x2d')],'as':_0xbfb6('0x2e'),'attributes':['id','name',_0xbfb6('0x2f')]}]})[_0xbfb6('0x1d')](function(_0x555e52){var _0x41d1c9=[];var _0xbf258=[];for(var _0x526bca=0x0;_0x526bca<_0x555e52[_0xbfb6('0x30')];_0x526bca+=0x1){var _0x318b78=_0x555e52[_0x526bca]['UserId'];if(_0x318b78===null){_0x41d1c9[_0xbfb6('0x31')](_0x555e52[_0x526bca]['update'](_0x56e8d6['body'],{'transaction':_0x530f22}));}else if(!_0xbf258[_0xbfb6('0x32')](_0x318b78)){_0xbf258[_0xbfb6('0x31')](_0x318b78);_0x41d1c9['push'](_0x555e52[_0x526bca][_0xbfb6('0x33')](_0x56e8d6[_0xbfb6('0x34')],{'transaction':_0x530f22}));}}return BPromise[_0xbfb6('0x35')](_0x41d1c9);});})[_0xbfb6('0x1d')](function(_0x325f6f){logger['info'](_0xbfb6('0x26'),_0x56e8d6);logger[_0xbfb6('0xc')]('GetContactDialer',_0x56e8d6,JSON[_0xbfb6('0xf')](_0x325f6f));_0x215519(_0x325f6f);})['catch'](function(_0x1d5055){logger[_0xbfb6('0x10')](_0xbfb6('0x26'),_0x1d5055['message'],_0x56e8d6);_0x52b75d(_0x45b7df['error'](0x1f4,_0x1d5055['message']));});});});};exports['MoveContactManagedDialer']=function(_0x4c4f15){var _0x3c0651=this;return new Promise(function(_0x3e4525,_0x41848c){return db[_0xbfb6('0x28')][_0xbfb6('0x29')](function(_0x19883d){return db[_0xbfb6('0x36')][_0xbfb6('0x23')](_0x4c4f15[_0xbfb6('0x34')],{'raw':_0x4c4f15[_0xbfb6('0x17')]?_0x4c4f15[_0xbfb6('0x17')][_0xbfb6('0x20')]===undefined?!![]:![]:!![],'transaction':_0x19883d})[_0xbfb6('0x1d')](function(){return db[_0xbfb6('0x15')][_0xbfb6('0x37')]({'where':_0x4c4f15[_0xbfb6('0x17')]?_0x4c4f15[_0xbfb6('0x17')][_0xbfb6('0x21')]||null:null,'transaction':_0x19883d});});})[_0xbfb6('0x1d')](function(_0x3fbb56){logger[_0xbfb6('0xa')]('MoveContactManagedDialer',_0x4c4f15);logger[_0xbfb6('0xc')](_0xbfb6('0x38'),_0x4c4f15,JSON['stringify'](_0x3fbb56));_0x3e4525(_0x3fbb56);})[_0xbfb6('0x13')](function(_0x28c81b){logger['error']('MoveContactManagedDialer',_0x28c81b['message'],_0x4c4f15);_0x41848c(_0x3c0651['error'](0x1f4,_0x28c81b[_0xbfb6('0x11')]));});});};exports[_0xbfb6('0x39')]=function(_0x25f52a){var _0x1d23ba=this;return new Promise(function(_0x3a2bf7,_0x141791){return db[_0xbfb6('0x15')]['findAll']({'raw':_0x25f52a[_0xbfb6('0x17')]?_0x25f52a['options'][_0xbfb6('0x20')]===undefined?!![]:![]:!![],'where':_0x25f52a[_0xbfb6('0x17')]?_0x25f52a['options'][_0xbfb6('0x21')]||null:null,'attributes':[[db['sequelize']['fn']('COUNT',db[_0xbfb6('0x28')]['fn']('IF',db[_0xbfb6('0x28')][_0xbfb6('0x3a')](_0xbfb6('0x3b')+util[_0xbfb6('0x3c')](_0xbfb6('0x3d'),moment()[_0xbfb6('0x3c')](_0xbfb6('0x3e')))+'\x20,\x201,\x20null'))),'contactsRescheduled']]})['then'](function(_0x48311b){logger[_0xbfb6('0xa')](_0xbfb6('0x39'),_0x25f52a);logger[_0xbfb6('0xc')]('CountReScheduled',_0x25f52a,JSON['stringify'](_0x48311b));_0x3a2bf7(_0x48311b);})['catch'](function(_0x4e3117){logger[_0xbfb6('0x10')]('CountReScheduled',_0x4e3117['message'],_0x25f52a);_0x141791(_0x1d23ba[_0xbfb6('0x10')](0x1f4,_0x4e3117['message']));});});};exports[_0xbfb6('0x3f')]=function(_0x5deb19){var _0x14d696=this;return new Promise(function(_0x49f2fa,_0x2c819d){return db['CmContact'][_0xbfb6('0x40')]()[_0xbfb6('0x1d')](function(_0x53e094){return db[_0xbfb6('0x28')][_0xbfb6('0x29')](function(_0x49b6c8){return db[_0xbfb6('0x15')][_0xbfb6('0x16')]({'where':_0x5deb19[_0xbfb6('0x17')]?_0x5deb19[_0xbfb6('0x17')][_0xbfb6('0x21')]||null:null,'attributes':_0x5deb19[_0xbfb6('0x17')]?_0x5deb19[_0xbfb6('0x17')][_0xbfb6('0x1c')]||null:null,'limit':0x1,'order':_0x5deb19[_0xbfb6('0x17')]?_0x5deb19['options'][_0xbfb6('0x2a')]||null:null,'group':db[_0xbfb6('0x15')]['UserId'],'transaction':_0x49b6c8,'lock':_0x49b6c8['LOCK'][_0xbfb6('0x2b')],'include':_0x5deb19[_0xbfb6('0x17')]?_0x5deb19[_0xbfb6('0x17')]['include']?_[_0xbfb6('0x19')](_0x5deb19['options'][_0xbfb6('0x1a')],function(_0x4559d5){return{'model':db[_0x4559d5[_0xbfb6('0x1b')]],'as':_0x4559d5['as'],'attributes':_0x4559d5[_0xbfb6('0x1c')],'include':_0x4559d5[_0xbfb6('0x1a')]?_[_0xbfb6('0x19')](_0x4559d5[_0xbfb6('0x1a')],function(_0x22a236){return{'model':db[_0x22a236[_0xbfb6('0x1b')]],'as':_0x22a236['as'],'attributes':_0x22a236[_0xbfb6('0x1c')],'include':_0x22a236[_0xbfb6('0x1a')]?_['map'](_0x22a236[_0xbfb6('0x1a')],function(_0x4bbb88){return{'model':db[_0x4bbb88['model']],'as':_0x4bbb88['as'],'attributes':_0x4bbb88[_0xbfb6('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x509ca2){var _0xd78d3a=[];for(var _0x406eab=0x0;_0x406eab<_0x509ca2[_0xbfb6('0x30')];_0x406eab+=0x1){_0xd78d3a['push'](_0x509ca2[_0x406eab][_0xbfb6('0x33')](_0x5deb19[_0xbfb6('0x34')],{'transaction':_0x49b6c8}));}return BPromise['all'](_0xd78d3a);});})['then'](function(_0x434922){logger[_0xbfb6('0xa')](_0xbfb6('0x3f'),_0x5deb19);logger[_0xbfb6('0xc')](_0xbfb6('0x3f'),_0x5deb19,JSON['stringify'](_0x434922));_0x49f2fa(_0x434922);})[_0xbfb6('0x13')](function(_0x475007){logger[_0xbfb6('0x10')]('GetContactRecallMe',_0x475007[_0xbfb6('0x11')],_0x5deb19);_0x2c819d(_0x14d696[_0xbfb6('0x10')](0x1f4,_0x475007[_0xbfb6('0x11')]));});});});};exports[_0xbfb6('0x41')]=function(_0x50c937){var _0x358073=this;return new Promise(function(_0x2c23f1,_0x4546d4){db[_0xbfb6('0x27')][_0xbfb6('0x40')]()[_0xbfb6('0x1d')](function(_0x366bef){return db[_0xbfb6('0x15')][_0xbfb6('0x16')]({'raw':_0x50c937[_0xbfb6('0x17')]?_0x50c937[_0xbfb6('0x17')][_0xbfb6('0x20')]===undefined?!![]:![]:!![],'where':_0x50c937[_0xbfb6('0x17')]?_0x50c937['options']['where']||null:null,'attributes':_0x50c937[_0xbfb6('0x17')]?_0x50c937[_0xbfb6('0x17')][_0xbfb6('0x1c')]||null:null,'limit':_0x50c937[_0xbfb6('0x17')]?_0x50c937['options'][_0xbfb6('0x18')]||null:null,'include':_0x50c937[_0xbfb6('0x17')]?_0x50c937[_0xbfb6('0x17')][_0xbfb6('0x1a')]?_[_0xbfb6('0x19')](_0x50c937[_0xbfb6('0x17')][_0xbfb6('0x1a')],function(_0xaa4ad8){return{'model':db[_0xaa4ad8[_0xbfb6('0x1b')]],'as':_0xaa4ad8['as'],'attributes':_0xaa4ad8['as']==='Contact'?_[_0xbfb6('0x42')](_0x366bef):_0xaa4ad8[_0xbfb6('0x1c')],'include':_0xaa4ad8[_0xbfb6('0x1a')]?_[_0xbfb6('0x19')](_0xaa4ad8[_0xbfb6('0x1a')],function(_0x1d4ce8){return{'model':db[_0x1d4ce8['model']],'as':_0x1d4ce8['as'],'attributes':_0x1d4ce8[_0xbfb6('0x1c')],'include':_0x1d4ce8['include']?_[_0xbfb6('0x19')](_0x1d4ce8[_0xbfb6('0x1a')],function(_0x258bc5){return{'model':db[_0x258bc5[_0xbfb6('0x1b')]],'as':_0x258bc5['as'],'attributes':_0x258bc5[_0xbfb6('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xbfb6('0x1d')](function(_0x4202a9){logger[_0xbfb6('0xa')](_0xbfb6('0x14'),_0x50c937);logger[_0xbfb6('0xc')](_0xbfb6('0x14'),_0x50c937,JSON[_0xbfb6('0xf')](_0x4202a9));_0x2c23f1(_0x4202a9);})[_0xbfb6('0x13')](function(_0x44eaa4){logger[_0xbfb6('0x10')](_0xbfb6('0x14'),_0x44eaa4[_0xbfb6('0x11')],_0x50c937);_0x4546d4(_0x358073[_0xbfb6('0x10')](0x1f4,_0x44eaa4['message']));});});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index 30751a7..850338c 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 _0x34d3=['get','isAuthenticated','index','/describe','describe','/opencontacts','getOpenContacts','/:id','show','create','post','/preview','getPreview','put','delete','destroy','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopper.controller'];(function(_0x27e2d1,_0x1a81ed){var _0x34a757=function(_0x244ff7){while(--_0x244ff7){_0x27e2d1['push'](_0x27e2d1['shift']());}};_0x34a757(++_0x1a81ed);}(_0x34d3,0x10a));var _0x334d=function(_0x16ae94,_0x32e9fe){_0x16ae94=_0x16ae94-0x0;var _0x2a04f5=_0x34d3[_0x16ae94];return _0x2a04f5;};'use strict';var multer=require(_0x334d('0x0'));var util=require('util');var path=require(_0x334d('0x1'));var timeout=require('connect-timeout');var express=require(_0x334d('0x2'));var router=express[_0x334d('0x3')]();var fs_extra=require(_0x334d('0x4'));var auth=require(_0x334d('0x5'));var interaction=require(_0x334d('0x6'));var config=require(_0x334d('0x7'));var controller=require(_0x334d('0x8'));router[_0x334d('0x9')]('/',auth[_0x334d('0xa')](),controller[_0x334d('0xb')]);router['get'](_0x334d('0xc'),auth['isAuthenticated'](),controller[_0x334d('0xd')]);router[_0x334d('0x9')](_0x334d('0xe'),auth[_0x334d('0xa')](),controller[_0x334d('0xf')]);router['get'](_0x334d('0x10'),auth[_0x334d('0xa')](),controller[_0x334d('0x11')]);router['post']('/',auth[_0x334d('0xa')](),controller[_0x334d('0x12')]);router[_0x334d('0x13')](_0x334d('0x14'),auth[_0x334d('0xa')](),controller[_0x334d('0x15')]);router[_0x334d('0x16')]('/:id',auth[_0x334d('0xa')](),controller['update']);router[_0x334d('0x17')]('/:id',auth[_0x334d('0xa')](),controller[_0x334d('0x18')]);module['exports']=router; \ No newline at end of file +var _0x17fa=['util','path','fs-extra','../../components/auth/service','../../components/interaction/service','./cmHopper.controller','get','isAuthenticated','/describe','describe','/opencontacts','getOpenContacts','post','create','/preview','getPreview','put','/:id','delete','destroy'];(function(_0x1f6d59,_0x5e8d22){var _0x37b2ea=function(_0x4b0c02){while(--_0x4b0c02){_0x1f6d59['push'](_0x1f6d59['shift']());}};_0x37b2ea(++_0x5e8d22);}(_0x17fa,0x190));var _0xa17f=function(_0x2e3ce4,_0x439e5d){_0x2e3ce4=_0x2e3ce4-0x0;var _0x52e93e=_0x17fa[_0x2e3ce4];return _0x52e93e;};'use strict';var multer=require('multer');var util=require(_0xa17f('0x0'));var path=require(_0xa17f('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xa17f('0x2'));var auth=require(_0xa17f('0x3'));var interaction=require(_0xa17f('0x4'));var config=require('../../config/environment');var controller=require(_0xa17f('0x5'));router[_0xa17f('0x6')]('/',auth[_0xa17f('0x7')](),controller['index']);router['get'](_0xa17f('0x8'),auth[_0xa17f('0x7')](),controller[_0xa17f('0x9')]);router[_0xa17f('0x6')](_0xa17f('0xa'),auth[_0xa17f('0x7')](),controller[_0xa17f('0xb')]);router['get']('/:id',auth[_0xa17f('0x7')](),controller['show']);router[_0xa17f('0xc')]('/',auth['isAuthenticated'](),controller[_0xa17f('0xd')]);router[_0xa17f('0xc')](_0xa17f('0xe'),auth[_0xa17f('0x7')](),controller[_0xa17f('0xf')]);router[_0xa17f('0x10')](_0xa17f('0x11'),auth[_0xa17f('0x7')](),controller['update']);router[_0xa17f('0x12')]('/:id',auth[_0xa17f('0x7')](),controller[_0xa17f('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 13312c1..73e93cf 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 _0xb242=['exports','STRING','INTEGER','contactListQueue','sequelize'];(function(_0x5461ea,_0xc51bad){var _0x39fc8e=function(_0x1f4fa){while(--_0x1f4fa){_0x5461ea['push'](_0x5461ea['shift']());}};_0x39fc8e(++_0xc51bad);}(_0xb242,0x1f3));var _0x2b24=function(_0xd0cd0b,_0x490956){_0xd0cd0b=_0xd0cd0b-0x0;var _0x59cced=_0xb242[_0xd0cd0b];return _0x59cced;};'use strict';var moment=require('moment');var Sequelize=require(_0x2b24('0x0'));module[_0x2b24('0x1')]={'phone':{'type':Sequelize[_0x2b24('0x2')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x2b24('0x3')],'unique':_0x2b24('0x4')},'ListId':{'type':Sequelize[_0x2b24('0x3')],'unique':_0x2b24('0x4')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'}}; \ No newline at end of file +var _0x2709=['STRING','contactListQueue','INTEGER','moment','exports'];(function(_0x51168d,_0x3695ab){var _0x29e776=function(_0x2006b9){while(--_0x2006b9){_0x51168d['push'](_0x51168d['shift']());}};_0x29e776(++_0x3695ab);}(_0x2709,0x189));var _0x9270=function(_0x25ff5a,_0x3aea4d){_0x25ff5a=_0x25ff5a-0x0;var _0xff9f50=_0x2709[_0x25ff5a];return _0xff9f50;};'use strict';var moment=require(_0x9270('0x0'));var Sequelize=require('sequelize');module[_0x9270('0x1')]={'phone':{'type':Sequelize[_0x9270('0x2')],'allowNull':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':_0x9270('0x3')},'ListId':{'type':Sequelize['INTEGER'],'unique':_0x9270('0x3')},'VoiceQueueId':{'type':Sequelize[_0x9270('0x4')],'unique':_0x9270('0x3')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index d58f190..793aef5 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 _0xc39e=['CmHopperBlack','fieldName','type','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','rows','catch','show','keys','rawAttributes','find','body','params','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','name','send'];(function(_0x2dadb9,_0x42cfe6){var _0x2f0097=function(_0x21163f){while(--_0x21163f){_0x2dadb9['push'](_0x2dadb9['shift']());}};_0x2f0097(++_0x42cfe6);}(_0xc39e,0x1e3));var _0xec39=function(_0x2fc113,_0x45ec6e){_0x2fc113=_0x2fc113-0x0;var _0x5144ce=_0xc39e[_0x2fc113];return _0x5144ce;};'use strict';var emlformat=require(_0xec39('0x0'));var rimraf=require(_0xec39('0x1'));var zipdir=require(_0xec39('0x2'));var jsonpatch=require(_0xec39('0x3'));var rp=require(_0xec39('0x4'));var moment=require(_0xec39('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xec39('0x6'));var util=require(_0xec39('0x7'));var path=require('path');var sox=require(_0xec39('0x8'));var csv=require(_0xec39('0x9'));var ejs=require(_0xec39('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xec39('0xb'));var squel=require('squel');var crypto=require(_0xec39('0xc'));var jsforce=require(_0xec39('0xd'));var deskjs=require(_0xec39('0xe'));var toCsv=require(_0xec39('0x9'));var querystring=require(_0xec39('0xf'));var Papa=require(_0xec39('0x10'));var Redis=require(_0xec39('0x11'));var authService=require(_0xec39('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xec39('0x13'))(_0xec39('0x14'));var utils=require(_0xec39('0x15'));var config=require(_0xec39('0x16'));var licenseUtil=require(_0xec39('0x17'));var db=require(_0xec39('0x18'))['db'];function respondWithStatusCode(_0x5e1be2,_0x379312){_0x379312=_0x379312||0xcc;return function(_0x4bfadd){if(_0x4bfadd){return _0x5e1be2[_0xec39('0x19')](_0x379312);}return _0x5e1be2[_0xec39('0x1a')](_0x379312)[_0xec39('0x1b')]();};}function respondWithResult(_0x43e210,_0x52987f){_0x52987f=_0x52987f||0xc8;return function(_0x2c2d7b){if(_0x2c2d7b){return _0x43e210[_0xec39('0x1a')](_0x52987f)[_0xec39('0x1c')](_0x2c2d7b);}};}function respondWithFilteredResult(_0x39b7e5,_0x417cd9){return function(_0x727911){if(_0x727911){var _0x2bc851=typeof _0x417cd9[_0xec39('0x1d')]===_0xec39('0x1e')&&typeof _0x417cd9['limit']==='undefined';var _0x228c72=_0x727911[_0xec39('0x1f')];var _0x1943e7=_0x2bc851?0x0:_0x417cd9[_0xec39('0x1d')];var _0x2dc7c2=_0x2bc851?_0x727911['count']:_0x417cd9[_0xec39('0x1d')]+_0x417cd9[_0xec39('0x20')];var _0x2154d5;if(_0x2dc7c2>=_0x228c72){_0x2dc7c2=_0x228c72;_0x2154d5=0xc8;}else{_0x2154d5=0xce;}_0x39b7e5[_0xec39('0x1a')](_0x2154d5);return _0x39b7e5[_0xec39('0x21')](_0xec39('0x22'),_0x1943e7+'-'+_0x2dc7c2+'/'+_0x228c72)[_0xec39('0x1c')](_0x727911);}return null;};}function patchUpdates(_0x4a4e9f){return function(_0x47b5ad){try{jsonpatch[_0xec39('0x23')](_0x47b5ad,_0x4a4e9f,!![]);}catch(_0x2e880c){return BPromise[_0xec39('0x24')](_0x2e880c);}return _0x47b5ad[_0xec39('0x25')]();};}function saveUpdates(_0x2b5eda,_0xf4559a){return function(_0x5edb64){if(_0x5edb64){return _0x5edb64[_0xec39('0x26')](_0x2b5eda)[_0xec39('0x27')](function(_0x29023d){return _0x29023d;});}return null;};}function removeEntity(_0x150480,_0x49bc3f){return function(_0x5c7692){if(_0x5c7692){return _0x5c7692['destroy']()[_0xec39('0x27')](function(){_0x150480[_0xec39('0x1a')](0xcc)[_0xec39('0x1b')]();});}};}function handleEntityNotFound(_0x42ab49,_0xf31bbe){return function(_0x54ad45){if(!_0x54ad45){_0x42ab49[_0xec39('0x19')](0x194);}return _0x54ad45;};}function handleError(_0x4ea4d1,_0x1f5777){_0x1f5777=_0x1f5777||0x1f4;return function(_0x5291f2){logger['error'](_0x5291f2['stack']);if(_0x5291f2[_0xec39('0x28')]){delete _0x5291f2[_0xec39('0x28')];}_0x4ea4d1[_0xec39('0x1a')](_0x1f5777)[_0xec39('0x29')](_0x5291f2);};}exports['index']=function(_0x1e922e,_0x1725c3){var _0x1e9bc7={},_0x3a1cb3={},_0x4d46fe={'count':0x0,'rows':[]};var _0x21de67=_['map'](db[_0xec39('0x2a')]['rawAttributes'],function(_0x4148a5){return{'name':_0x4148a5[_0xec39('0x2b')],'type':_0x4148a5[_0xec39('0x2c')][_0xec39('0x2d')]};});_0x3a1cb3['model']=_['map'](_0x21de67,_0xec39('0x28'));_0x3a1cb3['query']=_['keys'](_0x1e922e[_0xec39('0x2e')]);_0x3a1cb3[_0xec39('0x2f')]=_[_0xec39('0x30')](_0x3a1cb3[_0xec39('0x31')],_0x3a1cb3[_0xec39('0x2e')]);_0x1e9bc7['attributes']=_[_0xec39('0x30')](_0x3a1cb3[_0xec39('0x31')],qs['fields'](_0x1e922e[_0xec39('0x2e')][_0xec39('0x32')]));_0x1e9bc7[_0xec39('0x33')]=_0x1e9bc7[_0xec39('0x33')][_0xec39('0x34')]?_0x1e9bc7[_0xec39('0x33')]:_0x3a1cb3[_0xec39('0x31')];if(!_0x1e922e[_0xec39('0x2e')][_0xec39('0x35')](_0xec39('0x36'))){_0x1e9bc7[_0xec39('0x20')]=qs[_0xec39('0x20')](_0x1e922e[_0xec39('0x2e')][_0xec39('0x20')]);_0x1e9bc7[_0xec39('0x1d')]=qs['offset'](_0x1e922e['query'][_0xec39('0x1d')]);}_0x1e9bc7[_0xec39('0x37')]=qs[_0xec39('0x38')](_0x1e922e[_0xec39('0x2e')][_0xec39('0x38')]);_0x1e9bc7[_0xec39('0x39')]=qs[_0xec39('0x2f')](_[_0xec39('0x3a')](_0x1e922e['query'],_0x3a1cb3[_0xec39('0x2f')]),_0x21de67);if(_0x1e922e[_0xec39('0x2e')][_0xec39('0x3b')]){_0x1e9bc7[_0xec39('0x39')]=_['merge'](_0x1e9bc7[_0xec39('0x39')],{'$or':_['map'](_0x21de67,function(_0x342c5d){if(_0x342c5d[_0xec39('0x2c')]!==_0xec39('0x3c')){var _0xd8699f={};_0xd8699f[_0x342c5d[_0xec39('0x28')]]={'$like':'%'+_0x1e922e[_0xec39('0x2e')]['filter']+'%'};return _0xd8699f;}})});}_0x1e9bc7=_[_0xec39('0x3d')]({},_0x1e9bc7,_0x1e922e[_0xec39('0x3e')]);var _0xe8c462={'where':_0x1e9bc7[_0xec39('0x39')]};return db[_0xec39('0x2a')][_0xec39('0x1f')](_0xe8c462)['then'](function(_0x4c95e0){_0x4d46fe['count']=_0x4c95e0;if(_0x1e922e[_0xec39('0x2e')][_0xec39('0x3f')]){_0x1e9bc7[_0xec39('0x40')]=[{'all':!![]}];}return db[_0xec39('0x2a')]['findAll'](_0x1e9bc7);})[_0xec39('0x27')](function(_0xd908a){_0x4d46fe[_0xec39('0x41')]=_0xd908a;return _0x4d46fe;})[_0xec39('0x27')](respondWithFilteredResult(_0x1725c3,_0x1e9bc7))[_0xec39('0x42')](handleError(_0x1725c3,null));};exports[_0xec39('0x43')]=function(_0x24f8a2,_0x5a9736){var _0xf7aa8e={'raw':!![],'where':{'id':_0x24f8a2['params']['id']}},_0x4eb8cd={};_0x4eb8cd[_0xec39('0x31')]=_[_0xec39('0x44')](db[_0xec39('0x2a')][_0xec39('0x45')]);_0x4eb8cd[_0xec39('0x2e')]=_[_0xec39('0x44')](_0x24f8a2[_0xec39('0x2e')]);_0x4eb8cd[_0xec39('0x2f')]=_[_0xec39('0x30')](_0x4eb8cd['model'],_0x4eb8cd[_0xec39('0x2e')]);_0xf7aa8e['attributes']=_[_0xec39('0x30')](_0x4eb8cd['model'],qs[_0xec39('0x32')](_0x24f8a2['query']['fields']));_0xf7aa8e[_0xec39('0x33')]=_0xf7aa8e[_0xec39('0x33')][_0xec39('0x34')]?_0xf7aa8e[_0xec39('0x33')]:_0x4eb8cd['model'];if(_0x24f8a2[_0xec39('0x2e')]['includeAll']){_0xf7aa8e[_0xec39('0x40')]=[{'all':!![]}];}_0xf7aa8e=_[_0xec39('0x3d')]({},_0xf7aa8e,_0x24f8a2[_0xec39('0x3e')]);return db[_0xec39('0x2a')][_0xec39('0x46')](_0xf7aa8e)[_0xec39('0x27')](handleEntityNotFound(_0x5a9736,null))[_0xec39('0x27')](respondWithResult(_0x5a9736,null))[_0xec39('0x42')](handleError(_0x5a9736,null));};exports[_0xec39('0x26')]=function(_0x487dd1,_0x20c135){if(_0x487dd1[_0xec39('0x47')]['id']){delete _0x487dd1[_0xec39('0x47')]['id'];}return db[_0xec39('0x2a')][_0xec39('0x46')]({'where':{'id':_0x487dd1[_0xec39('0x48')]['id']}})[_0xec39('0x27')](handleEntityNotFound(_0x20c135,null))['then'](saveUpdates(_0x487dd1[_0xec39('0x47')],null))[_0xec39('0x27')](respondWithResult(_0x20c135,null))['catch'](handleError(_0x20c135,null));};exports[_0xec39('0x49')]=function(_0x205453,_0x1283d3){return db['CmHopperBlack'][_0xec39('0x46')]({'where':{'id':_0x205453[_0xec39('0x48')]['id']}})[_0xec39('0x27')](handleEntityNotFound(_0x1283d3,null))['then'](removeEntity(_0x1283d3,null))[_0xec39('0x42')](handleError(_0x1283d3,null));};exports[_0xec39('0x4a')]=function(_0x97bea0,_0x49f788){return db['CmHopperBlack'][_0xec39('0x4a')]()[_0xec39('0x27')](respondWithResult(_0x49f788,null))[_0xec39('0x42')](handleError(_0x49f788,null));}; \ No newline at end of file +var _0xd046=['intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','type','VIRTUAL','options','include','CmHopperBlack','findAll','rows','show','params','includeAll','find','body','catch','describe','rimraf','zip-dir','fast-json-patch','moment','util','sox','fs-extra','lodash','jsforce','desk.js','papaparse','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','then','destroy','error','stack','name','index','rawAttributes','fieldName','key','model','map','query','keys','filters'];(function(_0x176f0c,_0x31c114){var _0x446bf0=function(_0x1bb04e){while(--_0x1bb04e){_0x176f0c['push'](_0x176f0c['shift']());}};_0x446bf0(++_0x31c114);}(_0xd046,0x129));var _0x6d04=function(_0x3bb29e,_0x260973){_0x3bb29e=_0x3bb29e-0x0;var _0x522031=_0xd046[_0x3bb29e];return _0x522031;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6d04('0x0'));var zipdir=require(_0x6d04('0x1'));var jsonpatch=require(_0x6d04('0x2'));var rp=require('request-promise');var moment=require(_0x6d04('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x6d04('0x4'));var path=require('path');var sox=require(_0x6d04('0x5'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6d04('0x6'));var _=require(_0x6d04('0x7'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x6d04('0x8'));var deskjs=require(_0x6d04('0x9'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x6d04('0xa'));var Redis=require('ioredis');var authService=require(_0x6d04('0xb'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x6d04('0xc'))(_0x6d04('0xd'));var utils=require(_0x6d04('0xe'));var config=require(_0x6d04('0xf'));var licenseUtil=require('../../config/license/util');var db=require(_0x6d04('0x10'))['db'];function respondWithStatusCode(_0x103593,_0x39156e){_0x39156e=_0x39156e||0xcc;return function(_0x16526b){if(_0x16526b){return _0x103593[_0x6d04('0x11')](_0x39156e);}return _0x103593[_0x6d04('0x12')](_0x39156e)[_0x6d04('0x13')]();};}function respondWithResult(_0x3d7dd5,_0x3667cf){_0x3667cf=_0x3667cf||0xc8;return function(_0x3ab977){if(_0x3ab977){return _0x3d7dd5[_0x6d04('0x12')](_0x3667cf)[_0x6d04('0x14')](_0x3ab977);}};}function respondWithFilteredResult(_0x165b23,_0x92a88b){return function(_0x2da704){if(_0x2da704){var _0x14f13c=typeof _0x92a88b[_0x6d04('0x15')]===_0x6d04('0x16')&&typeof _0x92a88b[_0x6d04('0x17')]===_0x6d04('0x16');var _0x14190b=_0x2da704[_0x6d04('0x18')];var _0x2bc798=_0x14f13c?0x0:_0x92a88b[_0x6d04('0x15')];var _0x4e93b5=_0x14f13c?_0x2da704[_0x6d04('0x18')]:_0x92a88b[_0x6d04('0x15')]+_0x92a88b[_0x6d04('0x17')];var _0x7edbfc;if(_0x4e93b5>=_0x14190b){_0x4e93b5=_0x14190b;_0x7edbfc=0xc8;}else{_0x7edbfc=0xce;}_0x165b23[_0x6d04('0x12')](_0x7edbfc);return _0x165b23[_0x6d04('0x19')](_0x6d04('0x1a'),_0x2bc798+'-'+_0x4e93b5+'/'+_0x14190b)[_0x6d04('0x14')](_0x2da704);}return null;};}function patchUpdates(_0x2e9d6e){return function(_0x27d8eb){try{jsonpatch[_0x6d04('0x1b')](_0x27d8eb,_0x2e9d6e,!![]);}catch(_0x2994d9){return BPromise[_0x6d04('0x1c')](_0x2994d9);}return _0x27d8eb['save']();};}function saveUpdates(_0x7aa27,_0x280eab){return function(_0x54cf0e){if(_0x54cf0e){return _0x54cf0e['update'](_0x7aa27)[_0x6d04('0x1d')](function(_0x326276){return _0x326276;});}return null;};}function removeEntity(_0x4386bd,_0xe8f198){return function(_0x36113c){if(_0x36113c){return _0x36113c[_0x6d04('0x1e')]()[_0x6d04('0x1d')](function(){_0x4386bd[_0x6d04('0x12')](0xcc)[_0x6d04('0x13')]();});}};}function handleEntityNotFound(_0x38e90f,_0x2c4d5b){return function(_0x23d78a){if(!_0x23d78a){_0x38e90f[_0x6d04('0x11')](0x194);}return _0x23d78a;};}function handleError(_0x1c4404,_0x52ed38){_0x52ed38=_0x52ed38||0x1f4;return function(_0x1dc29b){logger[_0x6d04('0x1f')](_0x1dc29b[_0x6d04('0x20')]);if(_0x1dc29b[_0x6d04('0x21')]){delete _0x1dc29b[_0x6d04('0x21')];}_0x1c4404[_0x6d04('0x12')](_0x52ed38)['send'](_0x1dc29b);};}exports[_0x6d04('0x22')]=function(_0x3a7f68,_0x1c99d6){var _0x40b9e6={},_0x2ed2bb={},_0x5d2b7e={'count':0x0,'rows':[]};var _0x5d1033=_['map'](db['CmHopperBlack'][_0x6d04('0x23')],function(_0x48dee3){return{'name':_0x48dee3[_0x6d04('0x24')],'type':_0x48dee3['type'][_0x6d04('0x25')]};});_0x2ed2bb[_0x6d04('0x26')]=_[_0x6d04('0x27')](_0x5d1033,_0x6d04('0x21'));_0x2ed2bb[_0x6d04('0x28')]=_[_0x6d04('0x29')](_0x3a7f68[_0x6d04('0x28')]);_0x2ed2bb[_0x6d04('0x2a')]=_[_0x6d04('0x2b')](_0x2ed2bb[_0x6d04('0x26')],_0x2ed2bb['query']);_0x40b9e6['attributes']=_[_0x6d04('0x2b')](_0x2ed2bb[_0x6d04('0x26')],qs[_0x6d04('0x2c')](_0x3a7f68[_0x6d04('0x28')]['fields']));_0x40b9e6[_0x6d04('0x2d')]=_0x40b9e6[_0x6d04('0x2d')][_0x6d04('0x2e')]?_0x40b9e6[_0x6d04('0x2d')]:_0x2ed2bb['model'];if(!_0x3a7f68[_0x6d04('0x28')][_0x6d04('0x2f')](_0x6d04('0x30'))){_0x40b9e6[_0x6d04('0x17')]=qs[_0x6d04('0x17')](_0x3a7f68[_0x6d04('0x28')][_0x6d04('0x17')]);_0x40b9e6[_0x6d04('0x15')]=qs[_0x6d04('0x15')](_0x3a7f68[_0x6d04('0x28')][_0x6d04('0x15')]);}_0x40b9e6[_0x6d04('0x31')]=qs[_0x6d04('0x32')](_0x3a7f68[_0x6d04('0x28')][_0x6d04('0x32')]);_0x40b9e6['where']=qs[_0x6d04('0x2a')](_['pick'](_0x3a7f68[_0x6d04('0x28')],_0x2ed2bb[_0x6d04('0x2a')]),_0x5d1033);if(_0x3a7f68['query'][_0x6d04('0x33')]){_0x40b9e6[_0x6d04('0x34')]=_[_0x6d04('0x35')](_0x40b9e6[_0x6d04('0x34')],{'$or':_[_0x6d04('0x27')](_0x5d1033,function(_0xdbae2c){if(_0xdbae2c[_0x6d04('0x36')]!==_0x6d04('0x37')){var _0x533096={};_0x533096[_0xdbae2c[_0x6d04('0x21')]]={'$like':'%'+_0x3a7f68[_0x6d04('0x28')][_0x6d04('0x33')]+'%'};return _0x533096;}})});}_0x40b9e6=_[_0x6d04('0x35')]({},_0x40b9e6,_0x3a7f68[_0x6d04('0x38')]);var _0x4f8da7={'where':_0x40b9e6[_0x6d04('0x34')]};return db['CmHopperBlack']['count'](_0x4f8da7)['then'](function(_0x4fd1fb){_0x5d2b7e['count']=_0x4fd1fb;if(_0x3a7f68[_0x6d04('0x28')]['includeAll']){_0x40b9e6[_0x6d04('0x39')]=[{'all':!![]}];}return db[_0x6d04('0x3a')][_0x6d04('0x3b')](_0x40b9e6);})[_0x6d04('0x1d')](function(_0x5c271f){_0x5d2b7e[_0x6d04('0x3c')]=_0x5c271f;return _0x5d2b7e;})[_0x6d04('0x1d')](respondWithFilteredResult(_0x1c99d6,_0x40b9e6))['catch'](handleError(_0x1c99d6,null));};exports[_0x6d04('0x3d')]=function(_0x1a036d,_0x43873e){var _0x44a27d={'raw':!![],'where':{'id':_0x1a036d[_0x6d04('0x3e')]['id']}},_0x291577={};_0x291577[_0x6d04('0x26')]=_['keys'](db[_0x6d04('0x3a')]['rawAttributes']);_0x291577['query']=_[_0x6d04('0x29')](_0x1a036d['query']);_0x291577[_0x6d04('0x2a')]=_[_0x6d04('0x2b')](_0x291577['model'],_0x291577[_0x6d04('0x28')]);_0x44a27d[_0x6d04('0x2d')]=_[_0x6d04('0x2b')](_0x291577['model'],qs['fields'](_0x1a036d[_0x6d04('0x28')][_0x6d04('0x2c')]));_0x44a27d[_0x6d04('0x2d')]=_0x44a27d[_0x6d04('0x2d')][_0x6d04('0x2e')]?_0x44a27d['attributes']:_0x291577[_0x6d04('0x26')];if(_0x1a036d[_0x6d04('0x28')][_0x6d04('0x3f')]){_0x44a27d[_0x6d04('0x39')]=[{'all':!![]}];}_0x44a27d=_[_0x6d04('0x35')]({},_0x44a27d,_0x1a036d[_0x6d04('0x38')]);return db['CmHopperBlack'][_0x6d04('0x40')](_0x44a27d)[_0x6d04('0x1d')](handleEntityNotFound(_0x43873e,null))[_0x6d04('0x1d')](respondWithResult(_0x43873e,null))['catch'](handleError(_0x43873e,null));};exports['update']=function(_0x146e51,_0x339076){if(_0x146e51['body']['id']){delete _0x146e51['body']['id'];}return db['CmHopperBlack']['find']({'where':{'id':_0x146e51['params']['id']}})['then'](handleEntityNotFound(_0x339076,null))[_0x6d04('0x1d')](saveUpdates(_0x146e51[_0x6d04('0x41')],null))[_0x6d04('0x1d')](respondWithResult(_0x339076,null))[_0x6d04('0x42')](handleError(_0x339076,null));};exports['destroy']=function(_0x3dccba,_0x35db71){return db['CmHopperBlack'][_0x6d04('0x40')]({'where':{'id':_0x3dccba['params']['id']}})[_0x6d04('0x1d')](handleEntityNotFound(_0x35db71,null))['then'](removeEntity(_0x35db71,null))['catch'](handleError(_0x35db71,null));};exports[_0x6d04('0x43')]=function(_0x265926,_0xe4a07a){return db[_0x6d04('0x3a')][_0x6d04('0x43')]()[_0x6d04('0x1d')](respondWithResult(_0xe4a07a,null))[_0x6d04('0x42')](handleError(_0xe4a07a,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index 97ff687..a897410 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 _0x4efd=['bluebird','request-promise','path','../../config/environment','./cmHopperBlack.attributes','exports','define','CmHopperBlack','cm_hopper_black','lodash','util','../../config/logger','api','moment'];(function(_0x954b3a,_0x10a7c1){var _0x3a313e=function(_0x1070ad){while(--_0x1070ad){_0x954b3a['push'](_0x954b3a['shift']());}};_0x3a313e(++_0x10a7c1);}(_0x4efd,0x159));var _0xd4ef=function(_0x515afd,_0x1a1e91){_0x515afd=_0x515afd-0x0;var _0x536d53=_0x4efd[_0x515afd];return _0x536d53;};'use strict';var _=require(_0xd4ef('0x0'));var util=require(_0xd4ef('0x1'));var logger=require(_0xd4ef('0x2'))(_0xd4ef('0x3'));var moment=require(_0xd4ef('0x4'));var BPromise=require(_0xd4ef('0x5'));var rp=require(_0xd4ef('0x6'));var fs=require('fs');var path=require(_0xd4ef('0x7'));var rimraf=require('rimraf');var config=require(_0xd4ef('0x8'));var attributes=require(_0xd4ef('0x9'));module[_0xd4ef('0xa')]=function(_0x14f937,_0x2a6707){return _0x14f937[_0xd4ef('0xb')](_0xd4ef('0xc'),attributes,{'tableName':_0xd4ef('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x61e7=['../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./cmHopperBlack.attributes','exports','define','CmHopperBlack','lodash'];(function(_0x2e873f,_0x5503a9){var _0x1c56f6=function(_0x1f2700){while(--_0x1f2700){_0x2e873f['push'](_0x2e873f['shift']());}};_0x1c56f6(++_0x5503a9);}(_0x61e7,0x18b));var _0x761e=function(_0x46b900,_0x3c91a7){_0x46b900=_0x46b900-0x0;var _0x2f4d9d=_0x61e7[_0x46b900];return _0x2f4d9d;};'use strict';var _=require(_0x761e('0x0'));var util=require('util');var logger=require(_0x761e('0x1'))('api');var moment=require(_0x761e('0x2'));var BPromise=require('bluebird');var rp=require(_0x761e('0x3'));var fs=require('fs');var path=require(_0x761e('0x4'));var rimraf=require(_0x761e('0x5'));var config=require(_0x761e('0x6'));var attributes=require(_0x761e('0x7'));module[_0x761e('0x8')]=function(_0xd4bcbe,_0x51f1e7){return _0xd4bcbe[_0x761e('0x9')](_0x761e('0xa'),attributes,{'tableName':'cm_hopper_black','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.rpc.js b/server/api/cmHopperBlack/cmHopperBlack.rpc.js index 24ffc23..a22a542 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 _0x8819=['request','then','info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','CmHopperBlack,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','GetCmHopperBlack','CmHopperBlack','findAll','options','where','limit','include','model','attributes','map','debug','stringify','update','body','raw','UpdateCmHopperBlack','DestroyCmHopperBlack','destroy','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client','http'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x8819,0x92));var _0x9881=function(_0x5e199e,_0x12335d){_0x5e199e=_0x5e199e-0x0;var _0x5cfc72=_0x8819[_0x5e199e];return _0x5cfc72;};'use strict';var _=require('lodash');var util=require(_0x9881('0x0'));var moment=require(_0x9881('0x1'));var BPromise=require(_0x9881('0x2'));var rs=require(_0x9881('0x3'));var fs=require('fs');var Redis=require(_0x9881('0x4'));var db=require(_0x9881('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x9881('0x6'))(_0x9881('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x9881('0x8')][_0x9881('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xc5c2b6,_0x2ee1c3,_0x3fa455){return new BPromise(function(_0x2363ad,_0x58b055){return client[_0x9881('0xa')](_0xc5c2b6,_0x3fa455)[_0x9881('0xb')](function(_0x1e88ba){logger[_0x9881('0xc')](_0x9881('0xd'),_0x2ee1c3,_0x9881('0xe'));logger['debug'](_0x9881('0xf'),_0x2ee1c3,_0x9881('0xe'),JSON['stringify'](_0x1e88ba));if(_0x1e88ba['error']){if(_0x1e88ba['error'][_0x9881('0x10')]===0x1f4){logger['error'](_0x9881('0xd'),_0x2ee1c3,_0x1e88ba[_0x9881('0x11')]['message']);return _0x58b055(_0x1e88ba[_0x9881('0x11')]['message']);}logger[_0x9881('0x11')]('CmHopperBlack,\x20%s,\x20%s',_0x2ee1c3,_0x1e88ba['error']['message']);return _0x2363ad(_0x1e88ba['error'][_0x9881('0x12')]);}else{logger[_0x9881('0xc')](_0x9881('0xd'),_0x2ee1c3,'request\x20sent');_0x2363ad(_0x1e88ba[_0x9881('0x13')][_0x9881('0x12')]);}})[_0x9881('0x14')](function(_0x43b07c){logger['error'](_0x9881('0xd'),_0x2ee1c3,_0x43b07c);_0x58b055(_0x43b07c);});});}exports[_0x9881('0x15')]=function(_0x2909ac){var _0xfb56ad=this;return new Promise(function(_0x46843a,_0x8e5082){return db[_0x9881('0x16')][_0x9881('0x17')]({'raw':_0x2909ac[_0x9881('0x18')]?_0x2909ac[_0x9881('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x2909ac['options']?_0x2909ac['options'][_0x9881('0x19')]||null:null,'attributes':_0x2909ac[_0x9881('0x18')]?_0x2909ac[_0x9881('0x18')]['attributes']||null:null,'limit':_0x2909ac[_0x9881('0x18')]?_0x2909ac[_0x9881('0x18')][_0x9881('0x1a')]||null:null,'include':_0x2909ac[_0x9881('0x18')]?_0x2909ac[_0x9881('0x18')][_0x9881('0x1b')]?_['map'](_0x2909ac[_0x9881('0x18')]['include'],function(_0x23b5c7){return{'model':db[_0x23b5c7[_0x9881('0x1c')]],'as':_0x23b5c7['as'],'attributes':_0x23b5c7[_0x9881('0x1d')],'include':_0x23b5c7[_0x9881('0x1b')]?_[_0x9881('0x1e')](_0x23b5c7[_0x9881('0x1b')],function(_0x39100d){return{'model':db[_0x39100d[_0x9881('0x1c')]],'as':_0x39100d['as'],'attributes':_0x39100d['attributes'],'include':_0x39100d[_0x9881('0x1b')]?_['map'](_0x39100d[_0x9881('0x1b')],function(_0x164dd3){return{'model':db[_0x164dd3[_0x9881('0x1c')]],'as':_0x164dd3['as'],'attributes':_0x164dd3[_0x9881('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x9881('0xb')](function(_0x203030){logger[_0x9881('0xc')](_0x9881('0x15'),_0x2909ac);logger[_0x9881('0x1f')](_0x9881('0x15'),_0x2909ac,JSON[_0x9881('0x20')](_0x203030));_0x46843a(_0x203030);})[_0x9881('0x14')](function(_0x48d95c){logger[_0x9881('0x11')]('GetCmHopperBlack',_0x48d95c['message'],_0x2909ac);_0x8e5082(_0xfb56ad['error'](0x1f4,_0x48d95c[_0x9881('0x12')]));});});};exports['UpdateCmHopperBlack']=function(_0x3301e7){var _0x1c5b08=this;return new Promise(function(_0x2504fe,_0x23b620){return db[_0x9881('0x16')][_0x9881('0x21')](_0x3301e7[_0x9881('0x22')],{'raw':_0x3301e7[_0x9881('0x18')]?_0x3301e7[_0x9881('0x18')][_0x9881('0x23')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3301e7[_0x9881('0x18')]?_0x3301e7[_0x9881('0x18')][_0x9881('0x19')]||null:null,'attributes':_0x3301e7[_0x9881('0x18')]?_0x3301e7['options'][_0x9881('0x1d')]||null:null,'limit':_0x3301e7['options']?_0x3301e7[_0x9881('0x18')][_0x9881('0x1a')]||null:null})[_0x9881('0xb')](function(_0x110e5e){logger[_0x9881('0xc')](_0x9881('0x24'),_0x3301e7);logger[_0x9881('0x1f')](_0x9881('0x24'),_0x3301e7,JSON[_0x9881('0x20')](_0x110e5e));_0x2504fe(_0x110e5e);})[_0x9881('0x14')](function(_0xf35b27){logger['error'](_0x9881('0x24'),_0xf35b27[_0x9881('0x12')],_0x3301e7);_0x23b620(_0x1c5b08[_0x9881('0x11')](0x1f4,_0xf35b27['message']));});});};exports[_0x9881('0x25')]=function(_0x16c49e){var _0x14e3bb=this;return new Promise(function(_0x3a05ff,_0xcd9d04){return db['CmHopperBlack'][_0x9881('0x26')]({'where':_0x16c49e[_0x9881('0x18')]?_0x16c49e[_0x9881('0x18')][_0x9881('0x19')]||null:null})['then'](function(_0x3dbb24){logger[_0x9881('0xc')](_0x9881('0x25'),_0x16c49e);logger[_0x9881('0x1f')](_0x9881('0x25'),_0x16c49e,JSON[_0x9881('0x20')](_0x3dbb24));_0x3a05ff(_0x3dbb24);})[_0x9881('0x14')](function(_0x27af51){logger[_0x9881('0x11')](_0x9881('0x25'),_0x27af51[_0x9881('0x12')],_0x16c49e);_0xcd9d04(_0x14e3bb[_0x9881('0x11')](0x1f4,_0x27af51[_0x9881('0x12')]));});});}; \ No newline at end of file +var _0xbc88=['destroy','DestroyCmHopperBlack','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','then','info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','findAll','options','raw','where','limit','include','model','attributes','map','GetCmHopperBlack','UpdateCmHopperBlack','CmHopperBlack','update','body','debug'];(function(_0x38f610,_0x3948a0){var _0x4b11cf=function(_0x2c9646){while(--_0x2c9646){_0x38f610['push'](_0x38f610['shift']());}};_0x4b11cf(++_0x3948a0);}(_0xbc88,0xbb));var _0x8bc8=function(_0x1310ae,_0x5bbf42){_0x1310ae=_0x1310ae-0x0;var _0x28341f=_0xbc88[_0x1310ae];return _0x28341f;};'use strict';var _=require(_0x8bc8('0x0'));var util=require(_0x8bc8('0x1'));var moment=require('moment');var BPromise=require(_0x8bc8('0x2'));var rs=require(_0x8bc8('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8bc8('0x4'))['db'];var utils=require(_0x8bc8('0x5'));var logger=require(_0x8bc8('0x6'))('rpc');var config=require(_0x8bc8('0x7'));var jayson=require(_0x8bc8('0x8'));var client=jayson[_0x8bc8('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x128bd2,_0x3a5f0d,_0x1c2578){return new BPromise(function(_0x137444,_0x283a36){return client['request'](_0x128bd2,_0x1c2578)[_0x8bc8('0xa')](function(_0x5534c7){logger[_0x8bc8('0xb')](_0x8bc8('0xc'),_0x3a5f0d,_0x8bc8('0xd'));logger['debug']('CmHopperBlack,\x20%s,\x20%s,\x20%s',_0x3a5f0d,'request\x20sent',JSON[_0x8bc8('0xe')](_0x5534c7));if(_0x5534c7[_0x8bc8('0xf')]){if(_0x5534c7[_0x8bc8('0xf')][_0x8bc8('0x10')]===0x1f4){logger[_0x8bc8('0xf')](_0x8bc8('0xc'),_0x3a5f0d,_0x5534c7['error'][_0x8bc8('0x11')]);return _0x283a36(_0x5534c7['error']['message']);}logger[_0x8bc8('0xf')](_0x8bc8('0xc'),_0x3a5f0d,_0x5534c7['error'][_0x8bc8('0x11')]);return _0x137444(_0x5534c7['error'][_0x8bc8('0x11')]);}else{logger['info']('CmHopperBlack,\x20%s,\x20%s',_0x3a5f0d,_0x8bc8('0xd'));_0x137444(_0x5534c7[_0x8bc8('0x12')][_0x8bc8('0x11')]);}})[_0x8bc8('0x13')](function(_0x3b4adf){logger[_0x8bc8('0xf')](_0x8bc8('0xc'),_0x3a5f0d,_0x3b4adf);_0x283a36(_0x3b4adf);});});}exports['GetCmHopperBlack']=function(_0x22c8c7){var _0x5b284b=this;return new Promise(function(_0x3fb4c9,_0x20641f){return db['CmHopperBlack'][_0x8bc8('0x14')]({'raw':_0x22c8c7['options']?_0x22c8c7[_0x8bc8('0x15')][_0x8bc8('0x16')]===undefined?!![]:![]:!![],'where':_0x22c8c7[_0x8bc8('0x15')]?_0x22c8c7[_0x8bc8('0x15')][_0x8bc8('0x17')]||null:null,'attributes':_0x22c8c7[_0x8bc8('0x15')]?_0x22c8c7['options']['attributes']||null:null,'limit':_0x22c8c7[_0x8bc8('0x15')]?_0x22c8c7[_0x8bc8('0x15')][_0x8bc8('0x18')]||null:null,'include':_0x22c8c7['options']?_0x22c8c7[_0x8bc8('0x15')][_0x8bc8('0x19')]?_['map'](_0x22c8c7[_0x8bc8('0x15')][_0x8bc8('0x19')],function(_0x29ffcf){return{'model':db[_0x29ffcf[_0x8bc8('0x1a')]],'as':_0x29ffcf['as'],'attributes':_0x29ffcf[_0x8bc8('0x1b')],'include':_0x29ffcf['include']?_[_0x8bc8('0x1c')](_0x29ffcf[_0x8bc8('0x19')],function(_0x33fa3f){return{'model':db[_0x33fa3f[_0x8bc8('0x1a')]],'as':_0x33fa3f['as'],'attributes':_0x33fa3f[_0x8bc8('0x1b')],'include':_0x33fa3f[_0x8bc8('0x19')]?_[_0x8bc8('0x1c')](_0x33fa3f[_0x8bc8('0x19')],function(_0x45dcf8){return{'model':db[_0x45dcf8[_0x8bc8('0x1a')]],'as':_0x45dcf8['as'],'attributes':_0x45dcf8[_0x8bc8('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x8bc8('0xa')](function(_0x3cf138){logger[_0x8bc8('0xb')]('GetCmHopperBlack',_0x22c8c7);logger['debug'](_0x8bc8('0x1d'),_0x22c8c7,JSON[_0x8bc8('0xe')](_0x3cf138));_0x3fb4c9(_0x3cf138);})[_0x8bc8('0x13')](function(_0x382a80){logger[_0x8bc8('0xf')](_0x8bc8('0x1d'),_0x382a80[_0x8bc8('0x11')],_0x22c8c7);_0x20641f(_0x5b284b[_0x8bc8('0xf')](0x1f4,_0x382a80['message']));});});};exports[_0x8bc8('0x1e')]=function(_0x55da27){var _0x2f4f54=this;return new Promise(function(_0x28750e,_0x2e52a7){return db[_0x8bc8('0x1f')][_0x8bc8('0x20')](_0x55da27[_0x8bc8('0x21')],{'raw':_0x55da27[_0x8bc8('0x15')]?_0x55da27[_0x8bc8('0x15')][_0x8bc8('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x55da27[_0x8bc8('0x15')]?_0x55da27['options'][_0x8bc8('0x17')]||null:null,'attributes':_0x55da27['options']?_0x55da27[_0x8bc8('0x15')][_0x8bc8('0x1b')]||null:null,'limit':_0x55da27['options']?_0x55da27['options'][_0x8bc8('0x18')]||null:null})[_0x8bc8('0xa')](function(_0x1b1111){logger[_0x8bc8('0xb')]('UpdateCmHopperBlack',_0x55da27);logger[_0x8bc8('0x22')](_0x8bc8('0x1e'),_0x55da27,JSON[_0x8bc8('0xe')](_0x1b1111));_0x28750e(_0x1b1111);})[_0x8bc8('0x13')](function(_0x16e714){logger[_0x8bc8('0xf')]('UpdateCmHopperBlack',_0x16e714['message'],_0x55da27);_0x2e52a7(_0x2f4f54[_0x8bc8('0xf')](0x1f4,_0x16e714[_0x8bc8('0x11')]));});});};exports['DestroyCmHopperBlack']=function(_0x2f52a9){var _0x69782f=this;return new Promise(function(_0x11134c,_0x25b07f){return db['CmHopperBlack'][_0x8bc8('0x23')]({'where':_0x2f52a9[_0x8bc8('0x15')]?_0x2f52a9['options']['where']||null:null})['then'](function(_0x57ffdf){logger[_0x8bc8('0xb')]('DestroyCmHopperBlack',_0x2f52a9);logger['debug'](_0x8bc8('0x24'),_0x2f52a9,JSON[_0x8bc8('0xe')](_0x57ffdf));_0x11134c(_0x57ffdf);})[_0x8bc8('0x13')](function(_0x4d1472){logger[_0x8bc8('0xf')]('DestroyCmHopperBlack',_0x4d1472[_0x8bc8('0x11')],_0x2f52a9);_0x25b07f(_0x69782f[_0x8bc8('0xf')](0x1f4,_0x4d1472['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index 8ac4d70..feb9e3d 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 _0xb091=['index','get','describe','/:id','show','put','update','delete','destroy','util','path','connect-timeout','express','fs-extra','../../config/environment','./cmHopperBlack.controller','isAuthenticated'];(function(_0x565fed,_0xb85768){var _0x3e018f=function(_0x104d8e){while(--_0x104d8e){_0x565fed['push'](_0x565fed['shift']());}};_0x3e018f(++_0xb85768);}(_0xb091,0x16e));var _0x1b09=function(_0x54d6d2,_0x2d300d){_0x54d6d2=_0x54d6d2-0x0;var _0x3eebe6=_0xb091[_0x54d6d2];return _0x3eebe6;};'use strict';var multer=require('multer');var util=require(_0x1b09('0x0'));var path=require(_0x1b09('0x1'));var timeout=require(_0x1b09('0x2'));var express=require(_0x1b09('0x3'));var router=express['Router']();var fs_extra=require(_0x1b09('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x1b09('0x5'));var controller=require(_0x1b09('0x6'));router['get']('/',auth[_0x1b09('0x7')](),controller[_0x1b09('0x8')]);router[_0x1b09('0x9')]('/describe',auth[_0x1b09('0x7')](),controller[_0x1b09('0xa')]);router[_0x1b09('0x9')](_0x1b09('0xb'),auth[_0x1b09('0x7')](),controller[_0x1b09('0xc')]);router[_0x1b09('0xd')](_0x1b09('0xb'),auth[_0x1b09('0x7')](),controller[_0x1b09('0xe')]);router[_0x1b09('0xf')]('/:id',auth[_0x1b09('0x7')](),controller[_0x1b09('0x10')]);module['exports']=router; \ No newline at end of file +var _0x5d17=['index','/describe','isAuthenticated','describe','/:id','put','update','delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','get'];(function(_0x4db46b,_0xadcb1a){var _0x565be8=function(_0x5d2e50){while(--_0x5d2e50){_0x4db46b['push'](_0x4db46b['shift']());}};_0x565be8(++_0xadcb1a);}(_0x5d17,0x114));var _0x75d1=function(_0x450076,_0x10983b){_0x450076=_0x450076-0x0;var _0x2029cc=_0x5d17[_0x450076];return _0x2029cc;};'use strict';var multer=require(_0x75d1('0x0'));var util=require(_0x75d1('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x75d1('0x2'));var router=express[_0x75d1('0x3')]();var fs_extra=require(_0x75d1('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x75d1('0x5'));var config=require(_0x75d1('0x6'));var controller=require(_0x75d1('0x7'));router[_0x75d1('0x8')]('/',auth['isAuthenticated'](),controller[_0x75d1('0x9')]);router[_0x75d1('0x8')](_0x75d1('0xa'),auth[_0x75d1('0xb')](),controller[_0x75d1('0xc')]);router[_0x75d1('0x8')](_0x75d1('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x75d1('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x75d1('0xf')]);router[_0x75d1('0x10')]('/:id',auth[_0x75d1('0xb')](),controller[_0x75d1('0x11')]);module[_0x75d1('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 b470464..0c7f2b3 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 _0x0297=['sequelize','moment','exports','INTEGER','STRING','DATE','getDataValue','setDataValue','followuptime','diff','seconds','dispositionat','BOOLEAN'];(function(_0x34325b,_0x5e5afe){var _0x3da348=function(_0x3bf709){while(--_0x3bf709){_0x34325b['push'](_0x34325b['shift']());}};_0x3da348(++_0x5e5afe);}(_0x0297,0xd0));var _0x7029=function(_0x512672,_0x240349){_0x512672=_0x512672-0x0;var _0x20ea9d=_0x0297[_0x512672];return _0x20ea9d;};'use strict';var Sequelize=require(_0x7029('0x0'));var moment=require(_0x7029('0x1'));module[_0x7029('0x2')]={'state':{'type':Sequelize[_0x7029('0x3')](0x2)},'statedesc':{'type':Sequelize[_0x7029('0x4')]},'scheduledat':{'type':Sequelize[_0x7029('0x5')]},'countbusyretry':{'type':Sequelize[_0x7029('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x7029('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x7029('0x3')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x7029('0x4')]},'originatecalleridnum':{'type':Sequelize[_0x7029('0x4')]},'originatecalleridname':{'type':Sequelize[_0x7029('0x4')]},'calleridnum':{'type':Sequelize[_0x7029('0x4')]},'calleridname':{'type':Sequelize[_0x7029('0x4')]},'starttime':{'type':Sequelize[_0x7029('0x5')]},'responsetime':{'type':Sequelize[_0x7029('0x5')]},'answertime':{'type':Sequelize[_0x7029('0x5')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x7029('0x5')]},'ringtime':{'type':Sequelize[_0x7029('0x3')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x7029('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x7029('0x3')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x7029('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x7029('0x4')]},'campaign':{'type':Sequelize[_0x7029('0x4')]},'campaigntype':{'type':Sequelize[_0x7029('0x4')]},'membername':{'type':Sequelize[_0x7029('0x4')]},'reason':{'type':Sequelize[_0x7029('0x4')]},'disposition':{'type':Sequelize[_0x7029('0x4')]},'secondDisposition':{'type':Sequelize[_0x7029('0x4')]},'thirdDisposition':{'type':Sequelize[_0x7029('0x4')]},'dispositionat':{'type':Sequelize[_0x7029('0x5')],'set':function(_0x5dc765){var _0xb08d4d=this[_0x7029('0x6')]('endtime');if(_0xb08d4d&&_0x5dc765){this[_0x7029('0x7')](_0x7029('0x8'),moment(_0x5dc765)[_0x7029('0x9')](moment(_0xb08d4d),_0x7029('0xa')));}return this[_0x7029('0x7')](_0x7029('0xb'),_0x5dc765);}},'amd':{'type':Sequelize[_0x7029('0xc')],'defaultValue':![]},'fax':{'type':Sequelize[_0x7029('0xc')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x7029('0xc')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x7029('0xc')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x7029('0x5')]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x7029('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'deleted':{'type':Sequelize[_0x7029('0x4')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x7029('0x5')]},'recallme':{'type':Sequelize[_0x7029('0xc')],'defaultValue':![]},'agiafterat':{'type':Sequelize['DATE']},'countnosuchnumberretry':{'type':Sequelize[_0x7029('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x7029('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x7029('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x7029('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x961a=['moment','INTEGER','STRING','DATE','getDataValue','setDataValue','diff','seconds','dispositionat','BOOLEAN'];(function(_0x137d80,_0x4ca815){var _0x406c15=function(_0x1f0e13){while(--_0x1f0e13){_0x137d80['push'](_0x137d80['shift']());}};_0x406c15(++_0x4ca815);}(_0x961a,0xb4));var _0xa961=function(_0x190e1b,_0xcd1a37){_0x190e1b=_0x190e1b-0x0;var _0x174361=_0x961a[_0x190e1b];return _0x174361;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xa961('0x0'));module['exports']={'state':{'type':Sequelize[_0xa961('0x1')](0x2)},'statedesc':{'type':Sequelize[_0xa961('0x2')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0xa961('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xa961('0x1')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xa961('0x1')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xa961('0x2')]},'originatecalleridnum':{'type':Sequelize[_0xa961('0x2')]},'originatecalleridname':{'type':Sequelize[_0xa961('0x2')]},'calleridnum':{'type':Sequelize[_0xa961('0x2')]},'calleridname':{'type':Sequelize[_0xa961('0x2')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0xa961('0x3')]},'answertime':{'type':Sequelize[_0xa961('0x3')]},'droptime':{'type':Sequelize[_0xa961('0x3')]},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0xa961('0x1')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xa961('0x1')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xa961('0x1')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xa961('0x1')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xa961('0x2')]},'campaign':{'type':Sequelize[_0xa961('0x2')]},'campaigntype':{'type':Sequelize[_0xa961('0x2')]},'membername':{'type':Sequelize[_0xa961('0x2')]},'reason':{'type':Sequelize[_0xa961('0x2')]},'disposition':{'type':Sequelize[_0xa961('0x2')]},'secondDisposition':{'type':Sequelize[_0xa961('0x2')]},'thirdDisposition':{'type':Sequelize[_0xa961('0x2')]},'dispositionat':{'type':Sequelize[_0xa961('0x3')],'set':function(_0x582a92){var _0x19538f=this[_0xa961('0x4')]('endtime');if(_0x19538f&&_0x582a92){this[_0xa961('0x5')]('followuptime',moment(_0x582a92)[_0xa961('0x6')](moment(_0x19538f),_0xa961('0x7')));}return this[_0xa961('0x5')](_0xa961('0x8'),_0x582a92);}},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0xa961('0x9')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0xa961('0x9')],'defaultValue':![]},'rescheduled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0xa961('0x3')]},'callback':{'type':Sequelize[_0xa961('0x9')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xa961('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'deleted':{'type':Sequelize['STRING'],'defaultValue':null},'deletedat':{'type':Sequelize[_0xa961('0x3')]},'recallme':{'type':Sequelize[_0xa961('0x9')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0xa961('0x3')]},'countnosuchnumberretry':{'type':Sequelize[_0xa961('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xa961('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xa961('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xa961('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.controller.js b/server/api/cmHopperFinal/cmHopperFinal.controller.js index f69f364..e418c56 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 _0xe2fe=['calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','cm_hopper','select','calleridnum','state\x20=\x204','group','scheduledAt','CampaignId','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','checkContactHopper','eml-format','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','querystring','ioredis','../../components/auth/service','api','../../mysqldb','sendStatus','status','offset','limit','count','set','Content-Range','json','reject','save','update','then','destroy','end','name','send','index','map','CmHopperFinal','rawAttributes','type','key','keys','query','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','catch','show','find','body','uniqueid','params','countContactsQueueCampaignHopperFinal','findAll','sequelize','COUNT','literal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','into','fromQuery','phone','ContactId','ListId','VoiceQueueId','updatedAt','field','ANY_VALUE(calleridnum)','NOW()','createdAt','from','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','state'];(function(_0x8735ed,_0x1f7842){var _0x36c3fd=function(_0x374339){while(--_0x374339){_0x8735ed['push'](_0x8735ed['shift']());}};_0x36c3fd(++_0x1f7842);}(_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'];function respondWithStatusCode(_0x346dbc,_0xa13e7b){_0xa13e7b=_0xa13e7b||0xcc;return function(_0x100449){if(_0x100449){return _0x346dbc[_0xee2f('0x11')](_0xa13e7b);}return _0x346dbc[_0xee2f('0x12')](_0xa13e7b)['end']();};}function respondWithResult(_0x3861e6,_0x531c3a){_0x531c3a=_0x531c3a||0xc8;return function(_0x36db10){if(_0x36db10){return _0x3861e6[_0xee2f('0x12')](_0x531c3a)['json'](_0x36db10);}};}function respondWithFilteredResult(_0x445ba8,_0x145241){return function(_0x28b614){if(_0x28b614){var _0x1bbf7d=typeof _0x145241[_0xee2f('0x13')]==='undefined'&&typeof _0x145241[_0xee2f('0x14')]==='undefined';var _0x17d288=_0x28b614[_0xee2f('0x15')];var _0x502eb6=_0x1bbf7d?0x0:_0x145241['offset'];var _0x40b5bc=_0x1bbf7d?_0x28b614['count']:_0x145241[_0xee2f('0x13')]+_0x145241[_0xee2f('0x14')];var _0x28549d;if(_0x40b5bc>=_0x17d288){_0x40b5bc=_0x17d288;_0x28549d=0xc8;}else{_0x28549d=0xce;}_0x445ba8['status'](_0x28549d);return _0x445ba8[_0xee2f('0x16')](_0xee2f('0x17'),_0x502eb6+'-'+_0x40b5bc+'/'+_0x17d288)[_0xee2f('0x18')](_0x28b614);}return null;};}function patchUpdates(_0x21fdf4){return function(_0x3d892d){try{jsonpatch['apply'](_0x3d892d,_0x21fdf4,!![]);}catch(_0x5e73ad){return BPromise[_0xee2f('0x19')](_0x5e73ad);}return _0x3d892d[_0xee2f('0x1a')]();};}function saveUpdates(_0x1ea808,_0x203b2f){return function(_0x472e3b){if(_0x472e3b){return _0x472e3b[_0xee2f('0x1b')](_0x1ea808)[_0xee2f('0x1c')](function(_0x4d68d3){return _0x4d68d3;});}return null;};}function removeEntity(_0x250399,_0x2c47c5){return function(_0x15ceda){if(_0x15ceda){return _0x15ceda[_0xee2f('0x1d')]()[_0xee2f('0x1c')](function(){_0x250399[_0xee2f('0x12')](0xcc)[_0xee2f('0x1e')]();});}};}function handleEntityNotFound(_0x13013f,_0x382174){return function(_0x1e394f){if(!_0x1e394f){_0x13013f[_0xee2f('0x11')](0x194);}return _0x1e394f;};}function handleError(_0x168adc,_0x1c8454){_0x1c8454=_0x1c8454||0x1f4;return function(_0x45c4a0){logger['error'](_0x45c4a0['stack']);if(_0x45c4a0['name']){delete _0x45c4a0[_0xee2f('0x1f')];}_0x168adc[_0xee2f('0x12')](_0x1c8454)[_0xee2f('0x20')](_0x45c4a0);};}exports[_0xee2f('0x21')]=function(_0x892a4e,_0x3737fd){var _0x4d8398={},_0x3d3806={},_0x52e1fa={'count':0x0,'rows':[]};var _0x235697=_[_0xee2f('0x22')](db[_0xee2f('0x23')][_0xee2f('0x24')],function(_0x3ddbe3){return{'name':_0x3ddbe3['fieldName'],'type':_0x3ddbe3[_0xee2f('0x25')][_0xee2f('0x26')]};});_0x3d3806['model']=_['map'](_0x235697,_0xee2f('0x1f'));_0x3d3806['query']=_[_0xee2f('0x27')](_0x892a4e[_0xee2f('0x28')]);_0x3d3806['filters']=_[_0xee2f('0x29')](_0x3d3806['model'],_0x3d3806['query']);_0x4d8398['attributes']=_[_0xee2f('0x29')](_0x3d3806[_0xee2f('0x2a')],qs['fields'](_0x892a4e[_0xee2f('0x28')][_0xee2f('0x2b')]));_0x4d8398[_0xee2f('0x2c')]=_0x4d8398[_0xee2f('0x2c')][_0xee2f('0x2d')]?_0x4d8398['attributes']:_0x3d3806[_0xee2f('0x2a')];if(!_0x892a4e['query'][_0xee2f('0x2e')](_0xee2f('0x2f'))){_0x4d8398[_0xee2f('0x14')]=qs['limit'](_0x892a4e[_0xee2f('0x28')]['limit']);_0x4d8398[_0xee2f('0x13')]=qs['offset'](_0x892a4e[_0xee2f('0x28')][_0xee2f('0x13')]);}_0x4d8398[_0xee2f('0x30')]=qs[_0xee2f('0x31')](_0x892a4e[_0xee2f('0x28')][_0xee2f('0x31')]);_0x4d8398[_0xee2f('0x32')]=qs[_0xee2f('0x33')](_[_0xee2f('0x34')](_0x892a4e[_0xee2f('0x28')],_0x3d3806[_0xee2f('0x33')]),_0x235697);if(_0x892a4e['query'][_0xee2f('0x35')]){_0x4d8398['where']=_[_0xee2f('0x36')](_0x4d8398[_0xee2f('0x32')],{'$or':_[_0xee2f('0x22')](_0x235697,function(_0x2cbb89){if(_0x2cbb89[_0xee2f('0x25')]!==_0xee2f('0x37')){var _0x694950={};_0x694950[_0x2cbb89[_0xee2f('0x1f')]]={'$like':'%'+_0x892a4e['query']['filter']+'%'};return _0x694950;}})});}_0x4d8398=_['merge']({},_0x4d8398,_0x892a4e[_0xee2f('0x38')]);var _0x5483ae={'where':_0x4d8398[_0xee2f('0x32')]};return db['CmHopperFinal']['count'](_0x5483ae)['then'](function(_0x58e361){_0x52e1fa[_0xee2f('0x15')]=_0x58e361;if(_0x892a4e[_0xee2f('0x28')][_0xee2f('0x39')]){_0x4d8398[_0xee2f('0x3a')]=[{'all':!![]}];}return db['CmHopperFinal']['findAll'](_0x4d8398);})[_0xee2f('0x1c')](function(_0x5e12b7){_0x52e1fa['rows']=_0x5e12b7;return _0x52e1fa;})[_0xee2f('0x1c')](respondWithFilteredResult(_0x3737fd,_0x4d8398))[_0xee2f('0x3b')](handleError(_0x3737fd,null));};exports[_0xee2f('0x3c')]=function(_0x54130b,_0x3bc173){var _0x27c447={'raw':!![],'where':{'id':_0x54130b['params']['id']}},_0x19bd4d={};_0x19bd4d['model']=_[_0xee2f('0x27')](db[_0xee2f('0x23')][_0xee2f('0x24')]);_0x19bd4d[_0xee2f('0x28')]=_['keys'](_0x54130b[_0xee2f('0x28')]);_0x19bd4d[_0xee2f('0x33')]=_[_0xee2f('0x29')](_0x19bd4d[_0xee2f('0x2a')],_0x19bd4d[_0xee2f('0x28')]);_0x27c447[_0xee2f('0x2c')]=_[_0xee2f('0x29')](_0x19bd4d[_0xee2f('0x2a')],qs[_0xee2f('0x2b')](_0x54130b[_0xee2f('0x28')]['fields']));_0x27c447['attributes']=_0x27c447['attributes']['length']?_0x27c447[_0xee2f('0x2c')]:_0x19bd4d[_0xee2f('0x2a')];if(_0x54130b[_0xee2f('0x28')][_0xee2f('0x39')]){_0x27c447[_0xee2f('0x3a')]=[{'all':!![]}];}_0x27c447=_['merge']({},_0x27c447,_0x54130b[_0xee2f('0x38')]);return db[_0xee2f('0x23')][_0xee2f('0x3d')](_0x27c447)[_0xee2f('0x1c')](handleEntityNotFound(_0x3bc173,null))['then'](respondWithResult(_0x3bc173,null))['catch'](handleError(_0x3bc173,null));};exports['describe']=function(_0x1609f0,_0x54cc44){return db['CmHopperFinal']['describe']()['then'](respondWithResult(_0x54cc44,null))[_0xee2f('0x3b')](handleError(_0x54cc44,null));};exports[_0xee2f('0x1b')]=function(_0x32da72,_0x584383){if(_0x32da72[_0xee2f('0x3e')]['uniqueid']){delete _0x32da72[_0xee2f('0x3e')][_0xee2f('0x3f')];}return db[_0xee2f('0x23')][_0xee2f('0x3d')]({'where':{'uniqueid':_0x32da72[_0xee2f('0x40')]['id']}})['then'](handleEntityNotFound(_0x584383,null))['then'](saveUpdates(_0x32da72[_0xee2f('0x3e')],null))['then'](respondWithResult(_0x584383,null))[_0xee2f('0x3b')](handleError(_0x584383,null));};exports[_0xee2f('0x41')]=function(_0x1928f8,_0x88e683,_0x4fb3a0){return db['CmHopperFinal'][_0xee2f('0x42')]({'raw':![],'where':{'VoiceQueueId':_0x1928f8[_0xee2f('0x40')]['id']},'attributes':[[db[_0xee2f('0x43')]['fn'](_0xee2f('0x44'),db[_0xee2f('0x43')]['fn']('IF',db[_0xee2f('0x43')][_0xee2f('0x45')](_0xee2f('0x46')))),_0xee2f('0x47')],[db[_0xee2f('0x43')]['fn'](_0xee2f('0x44'),db[_0xee2f('0x43')]['fn']('IF',db['sequelize'][_0xee2f('0x45')](_0xee2f('0x48')))),_0xee2f('0x49')],[db[_0xee2f('0x43')]['fn']('COUNT',db[_0xee2f('0x43')]['fn']('IF',db[_0xee2f('0x43')][_0xee2f('0x45')](_0xee2f('0x4a')))),_0xee2f('0x4b')],[db['sequelize']['fn'](_0xee2f('0x44'),db['sequelize']['fn']('IF',db['sequelize'][_0xee2f('0x45')](_0xee2f('0x4c')))),_0xee2f('0x4d')],[db[_0xee2f('0x43')]['fn'](_0xee2f('0x44'),db[_0xee2f('0x43')]['fn']('IF',db[_0xee2f('0x43')]['literal'](_0xee2f('0x4e')))),_0xee2f('0x4f')],[db[_0xee2f('0x43')]['fn'](_0xee2f('0x44'),db[_0xee2f('0x43')]['fn']('IF',db[_0xee2f('0x43')][_0xee2f('0x45')](_0xee2f('0x50')))),_0xee2f('0x51')],[db['sequelize']['fn'](_0xee2f('0x44'),db['sequelize']['fn']('IF',db[_0xee2f('0x43')][_0xee2f('0x45')](_0xee2f('0x52')))),_0xee2f('0x53')],[db[_0xee2f('0x43')]['fn']('COUNT',db[_0xee2f('0x43')]['fn']('IF',db[_0xee2f('0x43')][_0xee2f('0x45')](_0xee2f('0x54')))),'answeringMachine']]})['then'](handleEntityNotFound(_0x88e683,null))['then'](respondWithResult(_0x88e683,null))['catch'](handleError(_0x88e683,null));};exports['countContactsIvrCampaignHopperFinal']=function(_0x8f90e6,_0x511e54,_0x2891ed){return db[_0xee2f('0x23')][_0xee2f('0x42')]({'raw':![],'where':{'CampaignId':_0x8f90e6[_0xee2f('0x40')]['id']},'attributes':[[db[_0xee2f('0x43')]['fn'](_0xee2f('0x44'),db['sequelize']['fn']('IF',db['sequelize'][_0xee2f('0x45')]('`state`\x20=\x200,\x201,\x20null'))),_0xee2f('0x47')],[db['sequelize']['fn'](_0xee2f('0x44'),db['sequelize']['fn']('IF',db[_0xee2f('0x43')][_0xee2f('0x45')](_0xee2f('0x48')))),'noAnswerContacts'],[db[_0xee2f('0x43')]['fn'](_0xee2f('0x44'),db[_0xee2f('0x43')]['fn']('IF',db[_0xee2f('0x43')][_0xee2f('0x45')](_0xee2f('0x4a')))),_0xee2f('0x4b')],[db['sequelize']['fn'](_0xee2f('0x44'),db[_0xee2f('0x43')]['fn']('IF',db[_0xee2f('0x43')][_0xee2f('0x45')](_0xee2f('0x4c')))),_0xee2f('0x4d')],[db[_0xee2f('0x43')]['fn'](_0xee2f('0x44'),db[_0xee2f('0x43')]['fn']('IF',db[_0xee2f('0x43')][_0xee2f('0x45')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0xee2f('0x4f')],[db[_0xee2f('0x43')]['fn']('COUNT',db[_0xee2f('0x43')]['fn']('IF',db['sequelize'][_0xee2f('0x45')]('`state`\x20=\x2011\x20,\x201,\x20null'))),'abandonedContacts'],[db[_0xee2f('0x43')]['fn'](_0xee2f('0x44'),db[_0xee2f('0x43')]['fn']('IF',db[_0xee2f('0x43')][_0xee2f('0x45')]('`state`\x20=\x2022,\x201,\x20null'))),_0xee2f('0x53')],[db[_0xee2f('0x43')]['fn'](_0xee2f('0x44'),db['sequelize']['fn']('IF',db[_0xee2f('0x43')][_0xee2f('0x45')]('`state`\x20=\x2019,\x201,\x20null'))),_0xee2f('0x55')]]})[_0xee2f('0x1c')](handleEntityNotFound(_0x511e54,null))[_0xee2f('0x1c')](respondWithResult(_0x511e54,null))[_0xee2f('0x3b')](handleError(_0x511e54,null));};exports[_0xee2f('0x56')]=function(_0x2adcc6,_0x43b883,_0x97edb2){return db[_0xee2f('0x57')]['find']({'where':{'id':_0x2adcc6['params']['id']}})['then'](handleEntityNotFound(_0x43b883,null))[_0xee2f('0x1c')](function(_0x19ce25){var _0x4288eb;if(_0x19ce25){_0x4288eb=squel[_0xee2f('0x58')]()[_0xee2f('0x59')]('cm_hopper')[_0xee2f('0x5a')]([_0xee2f('0x5b'),'scheduledAt',_0xee2f('0x5c'),_0xee2f('0x5d'),_0xee2f('0x5e'),'createdAt',_0xee2f('0x5f')],squel['select']()[_0xee2f('0x60')](_0xee2f('0x61'),'phone')[_0xee2f('0x60')](_0xee2f('0x62'),'scheduledAt')['field']('ANY_VALUE(ContactId)',_0xee2f('0x5c'))['field']('ANY_VALUE(ListId)',_0xee2f('0x5d'))[_0xee2f('0x60')]('ANY_VALUE(VoiceQueueId)',_0xee2f('0x5e'))['field'](_0xee2f('0x62'),_0xee2f('0x63'))[_0xee2f('0x60')](_0xee2f('0x62'),_0xee2f('0x5f'))[_0xee2f('0x64')](_0xee2f('0x65'))['where'](_0xee2f('0x66'),_0x2adcc6[_0xee2f('0x40')]['id'][_0xee2f('0x67')]())[_0xee2f('0x32')](_0xee2f('0x68'),_0x2adcc6['body'][_0xee2f('0x69')][_0xee2f('0x67')]())[_0xee2f('0x32')](_0xee2f('0x6a'))[_0xee2f('0x32')](_0xee2f('0x6b'),squel['select']()['field'](_0xee2f('0x5b'))[_0xee2f('0x64')](_0xee2f('0x6c'))[_0xee2f('0x32')](_0xee2f('0x66'),_0x2adcc6[_0xee2f('0x40')]['id'][_0xee2f('0x67')]()))['where']('calleridnum\x20NOT\x20IN\x20(?)',squel[_0xee2f('0x6d')]()[_0xee2f('0x60')](_0xee2f('0x6e'))[_0xee2f('0x64')](_0xee2f('0x65'))[_0xee2f('0x32')](_0xee2f('0x66'),_0x2adcc6[_0xee2f('0x40')]['id'][_0xee2f('0x67')]())[_0xee2f('0x32')](_0xee2f('0x6f')))[_0xee2f('0x70')]('ContactId'))['toString']();return db[_0xee2f('0x43')]['query'](_0x4288eb);}return[];})['then'](respondWithResult(_0x43b883,null))['catch'](handleError(_0x43b883,null));};exports['moveContactsIvrCampaignHopperFinal']=function(_0x2ea31f,_0x277507,_0x500459){return db['Campaign'][_0xee2f('0x3d')]({'where':{'id':_0x2ea31f[_0xee2f('0x40')]['id']}})[_0xee2f('0x1c')](handleEntityNotFound(_0x277507,null))['then'](function(_0x4aeae5){var _0x2b6f0f;if(_0x4aeae5){_0x2b6f0f=squel[_0xee2f('0x58')]()[_0xee2f('0x59')]('cm_hopper')[_0xee2f('0x5a')](['phone',_0xee2f('0x71'),'ContactId',_0xee2f('0x5d'),_0xee2f('0x72'),_0xee2f('0x63'),'updatedAt'],squel['select']()[_0xee2f('0x60')](_0xee2f('0x61'),_0xee2f('0x5b'))['field'](_0xee2f('0x62'),_0xee2f('0x71'))[_0xee2f('0x60')](_0xee2f('0x73'),_0xee2f('0x5c'))[_0xee2f('0x60')](_0xee2f('0x74'),_0xee2f('0x5d'))[_0xee2f('0x60')](_0xee2f('0x75'),_0xee2f('0x72'))[_0xee2f('0x60')](_0xee2f('0x62'),_0xee2f('0x63'))['field'](_0xee2f('0x62'),_0xee2f('0x5f'))[_0xee2f('0x64')](_0xee2f('0x65'))[_0xee2f('0x32')](_0xee2f('0x76'),_0x2ea31f[_0xee2f('0x40')]['id'][_0xee2f('0x67')]())[_0xee2f('0x32')](_0xee2f('0x68'),_0x2ea31f[_0xee2f('0x3e')]['state'][_0xee2f('0x67')]())[_0xee2f('0x32')](_0xee2f('0x6a'))[_0xee2f('0x32')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0xee2f('0x6d')]()[_0xee2f('0x60')](_0xee2f('0x5b'))['from']('cm_hopper')[_0xee2f('0x32')]('CampaignId\x20=\x20?',_0x2ea31f['params']['id']['toString']()))[_0xee2f('0x32')](_0xee2f('0x6b'),squel[_0xee2f('0x6d')]()[_0xee2f('0x60')]('calleridnum')[_0xee2f('0x64')](_0xee2f('0x65'))[_0xee2f('0x32')]('CampaignId\x20=\x20?',_0x2ea31f[_0xee2f('0x40')]['id']['toString']())[_0xee2f('0x32')]('state\x20=\x204'))['group'](_0xee2f('0x5c')))['toString']();return db[_0xee2f('0x43')]['query'](_0x2b6f0f);}return[];})['then'](respondWithResult(_0x277507,null))[_0xee2f('0x3b')](handleError(_0x277507,null));};exports[_0xee2f('0x77')]=function(_0x4fed80,_0x2685ed,_0x34f882){return db['CmHopper']['findOne']({'where':{'VoiceQueueId':_0x4fed80[_0xee2f('0x3e')][_0xee2f('0x5e')],'CampaignId':_0x4fed80['body'][_0xee2f('0x72')],'ContactId':_0x4fed80[_0xee2f('0x3e')][_0xee2f('0x5c')]}})[_0xee2f('0x1c')](handleEntityNotFound(_0x2685ed,null))[_0xee2f('0x1c')](function(_0x4f20e9){if(_0x4f20e9){return _0x4f20e9;}return null;})['then'](respondWithResult(_0x2685ed,null))['catch'](handleError(_0x2685ed,null));}; \ No newline at end of file +var _0x0295=['ejs','fs-extra','lodash','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','end','status','json','offset','undefined','limit','count','set','apply','save','update','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','CmHopperFinal','includeAll','rows','catch','show','params','intersection','include','find','describe','body','uniqueid','findAll','sequelize','literal','noSuchContacts','COUNT','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','`state`\x20=\x200,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','`state`\x20=\x2022,\x201,\x20null','moveContactsQueueCampaignHopperFinal','cm_hopper','fromQuery','phone','scheduledAt','ListId','VoiceQueueId','updatedAt','select','field','NOW()','ANY_VALUE(ContactId)','ContactId','ANY_VALUE(ListId)','createdAt','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','state','calleridnum\x20NOT\x20IN\x20(?)','from','calleridnum','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','Campaign','insert','into','CampaignId','ANY_VALUE(calleridnum)','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','CmHopper','findOne','eml-format','fast-json-patch','bluebird','mustache','util','path','sox','to-csv'];(function(_0x472116,_0x691f75){var _0x447832=function(_0x54534f){while(--_0x54534f){_0x472116['push'](_0x472116['shift']());}};_0x447832(++_0x691f75);}(_0x0295,0x1f0));var _0x5029=function(_0x583e98,_0x5534f5){_0x583e98=_0x583e98-0x0;var _0x84cc30=_0x0295[_0x583e98];return _0x84cc30;};'use strict';var emlformat=require(_0x5029('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x5029('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x5029('0x2'));var Mustache=require(_0x5029('0x3'));var util=require(_0x5029('0x4'));var path=require(_0x5029('0x5'));var sox=require(_0x5029('0x6'));var csv=require(_0x5029('0x7'));var ejs=require(_0x5029('0x8'));var fs=require('fs');var fs_extra=require(_0x5029('0x9'));var _=require(_0x5029('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x5029('0xb'));var toCsv=require('to-csv');var querystring=require(_0x5029('0xc'));var Papa=require('papaparse');var Redis=require(_0x5029('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x5029('0xe'));var as=require(_0x5029('0xf'));var hardwareService=require(_0x5029('0x10'));var logger=require('../../config/logger')(_0x5029('0x11'));var utils=require(_0x5029('0x12'));var config=require(_0x5029('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x5029('0x14'))['db'];function respondWithStatusCode(_0x2442b2,_0x4cced9){_0x4cced9=_0x4cced9||0xcc;return function(_0x4fa22d){if(_0x4fa22d){return _0x2442b2['sendStatus'](_0x4cced9);}return _0x2442b2['status'](_0x4cced9)[_0x5029('0x15')]();};}function respondWithResult(_0x2e0369,_0x12c237){_0x12c237=_0x12c237||0xc8;return function(_0x434630){if(_0x434630){return _0x2e0369[_0x5029('0x16')](_0x12c237)[_0x5029('0x17')](_0x434630);}};}function respondWithFilteredResult(_0xe278b7,_0x317c20){return function(_0x10bf55){if(_0x10bf55){var _0x326923=typeof _0x317c20[_0x5029('0x18')]===_0x5029('0x19')&&typeof _0x317c20[_0x5029('0x1a')]===_0x5029('0x19');var _0x343918=_0x10bf55['count'];var _0x1ed567=_0x326923?0x0:_0x317c20[_0x5029('0x18')];var _0x35de81=_0x326923?_0x10bf55[_0x5029('0x1b')]:_0x317c20[_0x5029('0x18')]+_0x317c20[_0x5029('0x1a')];var _0xaba461;if(_0x35de81>=_0x343918){_0x35de81=_0x343918;_0xaba461=0xc8;}else{_0xaba461=0xce;}_0xe278b7['status'](_0xaba461);return _0xe278b7[_0x5029('0x1c')]('Content-Range',_0x1ed567+'-'+_0x35de81+'/'+_0x343918)[_0x5029('0x17')](_0x10bf55);}return null;};}function patchUpdates(_0x8a414c){return function(_0x2710aa){try{jsonpatch[_0x5029('0x1d')](_0x2710aa,_0x8a414c,!![]);}catch(_0x4b5854){return BPromise['reject'](_0x4b5854);}return _0x2710aa[_0x5029('0x1e')]();};}function saveUpdates(_0x4a49b6,_0x3f657d){return function(_0x853a34){if(_0x853a34){return _0x853a34[_0x5029('0x1f')](_0x4a49b6)[_0x5029('0x20')](function(_0x16bd22){return _0x16bd22;});}return null;};}function removeEntity(_0x3a3e52,_0x125c26){return function(_0x356dac){if(_0x356dac){return _0x356dac[_0x5029('0x21')]()['then'](function(){_0x3a3e52['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x588d90,_0x45666c){return function(_0x51093c){if(!_0x51093c){_0x588d90['sendStatus'](0x194);}return _0x51093c;};}function handleError(_0x181da0,_0x1e7e61){_0x1e7e61=_0x1e7e61||0x1f4;return function(_0x36d810){logger['error'](_0x36d810[_0x5029('0x22')]);if(_0x36d810[_0x5029('0x23')]){delete _0x36d810['name'];}_0x181da0[_0x5029('0x16')](_0x1e7e61)[_0x5029('0x24')](_0x36d810);};}exports[_0x5029('0x25')]=function(_0x4a24b9,_0x32da06){var _0x251f99={},_0xe5313e={},_0x4b6f92={'count':0x0,'rows':[]};var _0x2cedf6=_[_0x5029('0x26')](db['CmHopperFinal'][_0x5029('0x27')],function(_0x25032b){return{'name':_0x25032b[_0x5029('0x28')],'type':_0x25032b[_0x5029('0x29')][_0x5029('0x2a')]};});_0xe5313e[_0x5029('0x2b')]=_[_0x5029('0x26')](_0x2cedf6,_0x5029('0x23'));_0xe5313e[_0x5029('0x2c')]=_[_0x5029('0x2d')](_0x4a24b9[_0x5029('0x2c')]);_0xe5313e[_0x5029('0x2e')]=_['intersection'](_0xe5313e[_0x5029('0x2b')],_0xe5313e['query']);_0x251f99[_0x5029('0x2f')]=_['intersection'](_0xe5313e['model'],qs[_0x5029('0x30')](_0x4a24b9[_0x5029('0x2c')][_0x5029('0x30')]));_0x251f99['attributes']=_0x251f99[_0x5029('0x2f')][_0x5029('0x31')]?_0x251f99[_0x5029('0x2f')]:_0xe5313e[_0x5029('0x2b')];if(!_0x4a24b9[_0x5029('0x2c')][_0x5029('0x32')](_0x5029('0x33'))){_0x251f99[_0x5029('0x1a')]=qs[_0x5029('0x1a')](_0x4a24b9['query'][_0x5029('0x1a')]);_0x251f99[_0x5029('0x18')]=qs[_0x5029('0x18')](_0x4a24b9[_0x5029('0x2c')]['offset']);}_0x251f99[_0x5029('0x34')]=qs[_0x5029('0x35')](_0x4a24b9[_0x5029('0x2c')]['sort']);_0x251f99['where']=qs[_0x5029('0x2e')](_[_0x5029('0x36')](_0x4a24b9['query'],_0xe5313e['filters']),_0x2cedf6);if(_0x4a24b9[_0x5029('0x2c')][_0x5029('0x37')]){_0x251f99[_0x5029('0x38')]=_[_0x5029('0x39')](_0x251f99[_0x5029('0x38')],{'$or':_[_0x5029('0x26')](_0x2cedf6,function(_0x3cb84e){if(_0x3cb84e[_0x5029('0x29')]!==_0x5029('0x3a')){var _0x3effa4={};_0x3effa4[_0x3cb84e[_0x5029('0x23')]]={'$like':'%'+_0x4a24b9[_0x5029('0x2c')][_0x5029('0x37')]+'%'};return _0x3effa4;}})});}_0x251f99=_[_0x5029('0x39')]({},_0x251f99,_0x4a24b9['options']);var _0x57c2b5={'where':_0x251f99[_0x5029('0x38')]};return db[_0x5029('0x3b')][_0x5029('0x1b')](_0x57c2b5)['then'](function(_0x32d8a3){_0x4b6f92[_0x5029('0x1b')]=_0x32d8a3;if(_0x4a24b9['query'][_0x5029('0x3c')]){_0x251f99['include']=[{'all':!![]}];}return db[_0x5029('0x3b')]['findAll'](_0x251f99);})[_0x5029('0x20')](function(_0x359838){_0x4b6f92[_0x5029('0x3d')]=_0x359838;return _0x4b6f92;})[_0x5029('0x20')](respondWithFilteredResult(_0x32da06,_0x251f99))[_0x5029('0x3e')](handleError(_0x32da06,null));};exports[_0x5029('0x3f')]=function(_0x4b2219,_0x1021ea){var _0x2ae047={'raw':!![],'where':{'id':_0x4b2219[_0x5029('0x40')]['id']}},_0x5a3e4d={};_0x5a3e4d[_0x5029('0x2b')]=_[_0x5029('0x2d')](db[_0x5029('0x3b')][_0x5029('0x27')]);_0x5a3e4d[_0x5029('0x2c')]=_['keys'](_0x4b2219[_0x5029('0x2c')]);_0x5a3e4d[_0x5029('0x2e')]=_[_0x5029('0x41')](_0x5a3e4d[_0x5029('0x2b')],_0x5a3e4d[_0x5029('0x2c')]);_0x2ae047['attributes']=_[_0x5029('0x41')](_0x5a3e4d[_0x5029('0x2b')],qs[_0x5029('0x30')](_0x4b2219[_0x5029('0x2c')][_0x5029('0x30')]));_0x2ae047[_0x5029('0x2f')]=_0x2ae047[_0x5029('0x2f')][_0x5029('0x31')]?_0x2ae047[_0x5029('0x2f')]:_0x5a3e4d['model'];if(_0x4b2219[_0x5029('0x2c')][_0x5029('0x3c')]){_0x2ae047[_0x5029('0x42')]=[{'all':!![]}];}_0x2ae047=_[_0x5029('0x39')]({},_0x2ae047,_0x4b2219['options']);return db['CmHopperFinal'][_0x5029('0x43')](_0x2ae047)[_0x5029('0x20')](handleEntityNotFound(_0x1021ea,null))[_0x5029('0x20')](respondWithResult(_0x1021ea,null))[_0x5029('0x3e')](handleError(_0x1021ea,null));};exports[_0x5029('0x44')]=function(_0x3dfc08,_0x2bb7fc){return db[_0x5029('0x3b')][_0x5029('0x44')]()[_0x5029('0x20')](respondWithResult(_0x2bb7fc,null))[_0x5029('0x3e')](handleError(_0x2bb7fc,null));};exports[_0x5029('0x1f')]=function(_0x449ef5,_0x18f1f5){if(_0x449ef5[_0x5029('0x45')][_0x5029('0x46')]){delete _0x449ef5[_0x5029('0x45')][_0x5029('0x46')];}return db[_0x5029('0x3b')][_0x5029('0x43')]({'where':{'uniqueid':_0x449ef5[_0x5029('0x40')]['id']}})['then'](handleEntityNotFound(_0x18f1f5,null))[_0x5029('0x20')](saveUpdates(_0x449ef5['body'],null))[_0x5029('0x20')](respondWithResult(_0x18f1f5,null))[_0x5029('0x3e')](handleError(_0x18f1f5,null));};exports['countContactsQueueCampaignHopperFinal']=function(_0x5343c6,_0x319bff,_0x5e739d){return db['CmHopperFinal'][_0x5029('0x47')]({'raw':![],'where':{'VoiceQueueId':_0x5343c6[_0x5029('0x40')]['id']},'attributes':[[db[_0x5029('0x48')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x5029('0x48')][_0x5029('0x49')]('`state`\x20=\x200,\x201,\x20null'))),_0x5029('0x4a')],[db['sequelize']['fn'](_0x5029('0x4b'),db['sequelize']['fn']('IF',db[_0x5029('0x48')][_0x5029('0x49')](_0x5029('0x4c')))),_0x5029('0x4d')],[db[_0x5029('0x48')]['fn'](_0x5029('0x4b'),db[_0x5029('0x48')]['fn']('IF',db[_0x5029('0x48')]['literal'](_0x5029('0x4e')))),'busyContacts'],[db[_0x5029('0x48')]['fn'](_0x5029('0x4b'),db['sequelize']['fn']('IF',db[_0x5029('0x48')]['literal']('`state`\x20=\x208,\x201,\x20null'))),'congestionContacts'],[db[_0x5029('0x48')]['fn']('COUNT',db[_0x5029('0x48')]['fn']('IF',db[_0x5029('0x48')][_0x5029('0x49')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x5029('0x4f')],[db['sequelize']['fn']('COUNT',db[_0x5029('0x48')]['fn']('IF',db[_0x5029('0x48')][_0x5029('0x49')](_0x5029('0x50')))),_0x5029('0x51')],[db['sequelize']['fn'](_0x5029('0x4b'),db[_0x5029('0x48')]['fn']('IF',db[_0x5029('0x48')][_0x5029('0x49')]('`state`\x20=\x2022,\x201,\x20null'))),_0x5029('0x52')],[db[_0x5029('0x48')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x5029('0x48')][_0x5029('0x49')](_0x5029('0x53')))),_0x5029('0x54')]]})['then'](handleEntityNotFound(_0x319bff,null))[_0x5029('0x20')](respondWithResult(_0x319bff,null))[_0x5029('0x3e')](handleError(_0x319bff,null));};exports[_0x5029('0x55')]=function(_0x2aebb3,_0x3a82f7,_0x26f56f){return db['CmHopperFinal']['findAll']({'raw':![],'where':{'CampaignId':_0x2aebb3[_0x5029('0x40')]['id']},'attributes':[[db[_0x5029('0x48')]['fn'](_0x5029('0x4b'),db['sequelize']['fn']('IF',db[_0x5029('0x48')][_0x5029('0x49')](_0x5029('0x56')))),_0x5029('0x4a')],[db[_0x5029('0x48')]['fn']('COUNT',db[_0x5029('0x48')]['fn']('IF',db[_0x5029('0x48')][_0x5029('0x49')]('`state`\x20=\x203,\x201,\x20null'))),_0x5029('0x4d')],[db['sequelize']['fn'](_0x5029('0x4b'),db['sequelize']['fn']('IF',db[_0x5029('0x48')][_0x5029('0x49')](_0x5029('0x4e')))),_0x5029('0x57')],[db[_0x5029('0x48')]['fn'](_0x5029('0x4b'),db['sequelize']['fn']('IF',db[_0x5029('0x48')][_0x5029('0x49')](_0x5029('0x58')))),_0x5029('0x59')],[db[_0x5029('0x48')]['fn']('COUNT',db[_0x5029('0x48')]['fn']('IF',db['sequelize'][_0x5029('0x49')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x5029('0x4f')],[db['sequelize']['fn'](_0x5029('0x4b'),db['sequelize']['fn']('IF',db['sequelize'][_0x5029('0x49')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x5029('0x51')],[db[_0x5029('0x48')]['fn'](_0x5029('0x4b'),db['sequelize']['fn']('IF',db[_0x5029('0x48')]['literal'](_0x5029('0x5a')))),_0x5029('0x52')],[db[_0x5029('0x48')]['fn'](_0x5029('0x4b'),db[_0x5029('0x48')]['fn']('IF',db['sequelize'][_0x5029('0x49')](_0x5029('0x53')))),'answeringMachine']]})[_0x5029('0x20')](handleEntityNotFound(_0x3a82f7,null))[_0x5029('0x20')](respondWithResult(_0x3a82f7,null))[_0x5029('0x3e')](handleError(_0x3a82f7,null));};exports[_0x5029('0x5b')]=function(_0x9b1c13,_0x1bd1c6,_0x5bd84e){return db['VoiceQueue'][_0x5029('0x43')]({'where':{'id':_0x9b1c13['params']['id']}})[_0x5029('0x20')](handleEntityNotFound(_0x1bd1c6,null))[_0x5029('0x20')](function(_0x58db57){var _0x181956;if(_0x58db57){_0x181956=squel['insert']()['into'](_0x5029('0x5c'))[_0x5029('0x5d')]([_0x5029('0x5e'),_0x5029('0x5f'),'ContactId',_0x5029('0x60'),_0x5029('0x61'),'createdAt',_0x5029('0x62')],squel[_0x5029('0x63')]()['field']('ANY_VALUE(calleridnum)','phone')[_0x5029('0x64')](_0x5029('0x65'),_0x5029('0x5f'))[_0x5029('0x64')](_0x5029('0x66'),_0x5029('0x67'))[_0x5029('0x64')](_0x5029('0x68'),_0x5029('0x60'))['field']('ANY_VALUE(VoiceQueueId)',_0x5029('0x61'))[_0x5029('0x64')](_0x5029('0x65'),_0x5029('0x69'))[_0x5029('0x64')](_0x5029('0x65'),_0x5029('0x62'))['from'](_0x5029('0x6a'))[_0x5029('0x38')](_0x5029('0x6b'),_0x9b1c13['params']['id'][_0x5029('0x6c')]())[_0x5029('0x38')](_0x5029('0x6d'),_0x9b1c13['body'][_0x5029('0x6e')][_0x5029('0x6c')]())[_0x5029('0x38')]('calleridnum\x20IS\x20NOT\x20NULL')[_0x5029('0x38')](_0x5029('0x6f'),squel['select']()[_0x5029('0x64')](_0x5029('0x5e'))[_0x5029('0x70')](_0x5029('0x5c'))[_0x5029('0x38')]('VoiceQueueId\x20=\x20?',_0x9b1c13[_0x5029('0x40')]['id'][_0x5029('0x6c')]()))[_0x5029('0x38')](_0x5029('0x6f'),squel[_0x5029('0x63')]()['field'](_0x5029('0x71'))[_0x5029('0x70')](_0x5029('0x6a'))['where'](_0x5029('0x6b'),_0x9b1c13[_0x5029('0x40')]['id'][_0x5029('0x6c')]())[_0x5029('0x38')](_0x5029('0x72')))[_0x5029('0x73')](_0x5029('0x67')))['toString']();return db[_0x5029('0x48')][_0x5029('0x2c')](_0x181956);}return[];})[_0x5029('0x20')](respondWithResult(_0x1bd1c6,null))[_0x5029('0x3e')](handleError(_0x1bd1c6,null));};exports[_0x5029('0x74')]=function(_0x4c40d1,_0x209c83,_0x443070){return db[_0x5029('0x75')]['find']({'where':{'id':_0x4c40d1[_0x5029('0x40')]['id']}})[_0x5029('0x20')](handleEntityNotFound(_0x209c83,null))['then'](function(_0x5c8bd4){var _0x524825;if(_0x5c8bd4){_0x524825=squel[_0x5029('0x76')]()[_0x5029('0x77')](_0x5029('0x5c'))[_0x5029('0x5d')]([_0x5029('0x5e'),'scheduledAt',_0x5029('0x67'),_0x5029('0x60'),_0x5029('0x78'),'createdAt','updatedAt'],squel[_0x5029('0x63')]()[_0x5029('0x64')](_0x5029('0x79'),_0x5029('0x5e'))['field'](_0x5029('0x65'),_0x5029('0x5f'))[_0x5029('0x64')](_0x5029('0x66'),_0x5029('0x67'))[_0x5029('0x64')](_0x5029('0x68'),_0x5029('0x60'))['field'](_0x5029('0x7a'),'CampaignId')['field'](_0x5029('0x65'),'createdAt')[_0x5029('0x64')](_0x5029('0x65'),_0x5029('0x62'))[_0x5029('0x70')](_0x5029('0x6a'))[_0x5029('0x38')](_0x5029('0x7b'),_0x4c40d1[_0x5029('0x40')]['id']['toString']())['where'](_0x5029('0x6d'),_0x4c40d1['body']['state'][_0x5029('0x6c')]())['where']('calleridnum\x20IS\x20NOT\x20NULL')[_0x5029('0x38')](_0x5029('0x6f'),squel[_0x5029('0x63')]()[_0x5029('0x64')](_0x5029('0x5e'))['from'](_0x5029('0x5c'))[_0x5029('0x38')](_0x5029('0x7b'),_0x4c40d1['params']['id'][_0x5029('0x6c')]()))[_0x5029('0x38')](_0x5029('0x6f'),squel[_0x5029('0x63')]()[_0x5029('0x64')]('calleridnum')['from'](_0x5029('0x6a'))[_0x5029('0x38')]('CampaignId\x20=\x20?',_0x4c40d1[_0x5029('0x40')]['id'][_0x5029('0x6c')]())[_0x5029('0x38')](_0x5029('0x72')))[_0x5029('0x73')](_0x5029('0x67')))[_0x5029('0x6c')]();return db[_0x5029('0x48')]['query'](_0x524825);}return[];})['then'](respondWithResult(_0x209c83,null))[_0x5029('0x3e')](handleError(_0x209c83,null));};exports['checkContactHopper']=function(_0x20a259,_0x5e5f88,_0x36fdce){return db[_0x5029('0x7c')][_0x5029('0x7d')]({'where':{'VoiceQueueId':_0x20a259['body'][_0x5029('0x61')],'CampaignId':_0x20a259[_0x5029('0x45')][_0x5029('0x78')],'ContactId':_0x20a259['body'][_0x5029('0x67')]}})[_0x5029('0x20')](handleEntityNotFound(_0x5e5f88,null))[_0x5029('0x20')](function(_0x4421bd){if(_0x4421bd){return _0x4421bd;}return null;})[_0x5029('0x20')](respondWithResult(_0x5e5f88,null))[_0x5029('0x3e')](handleError(_0x5e5f88,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index ff0f61a..c9fcd02 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 _0x2da2=['request-promise','./cmHopperFinal.attributes','exports','define','CmHopperFinal','cm_hopper_final','uniqueid','../../config/logger','api','bluebird'];(function(_0x7ef41e,_0x1da6c4){var _0x1cfb32=function(_0x810388){while(--_0x810388){_0x7ef41e['push'](_0x7ef41e['shift']());}};_0x1cfb32(++_0x1da6c4);}(_0x2da2,0x10b));var _0x22da=function(_0x397846,_0x37ae81){_0x397846=_0x397846-0x0;var _0x470b55=_0x2da2[_0x397846];return _0x470b55;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x22da('0x0'))(_0x22da('0x1'));var moment=require('moment');var BPromise=require(_0x22da('0x2'));var rp=require(_0x22da('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x22da('0x4'));module[_0x22da('0x5')]=function(_0x1a7051,_0x10a213){return _0x1a7051[_0x22da('0x6')](_0x22da('0x7'),attributes,{'tableName':_0x22da('0x8'),'paranoid':![],'indexes':[{'name':'calleridnum','fields':['calleridnum']},{'name':_0x22da('0x9'),'fields':[_0x22da('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6133=['api','moment','bluebird','request-promise','path','./cmHopperFinal.attributes','exports','define','CmHopperFinal','calleridnum','uniqueid','lodash','util'];(function(_0x26fb65,_0x3dd5a0){var _0x187b8d=function(_0x42be57){while(--_0x42be57){_0x26fb65['push'](_0x26fb65['shift']());}};_0x187b8d(++_0x3dd5a0);}(_0x6133,0x15d));var _0x3613=function(_0x34cf99,_0x2a7a83){_0x34cf99=_0x34cf99-0x0;var _0x1fc740=_0x6133[_0x34cf99];return _0x1fc740;};'use strict';var _=require(_0x3613('0x0'));var util=require(_0x3613('0x1'));var logger=require('../../config/logger')(_0x3613('0x2'));var moment=require(_0x3613('0x3'));var BPromise=require(_0x3613('0x4'));var rp=require(_0x3613('0x5'));var fs=require('fs');var path=require(_0x3613('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x3613('0x7'));module[_0x3613('0x8')]=function(_0x758f25,_0x374bee){return _0x758f25[_0x3613('0x9')](_0x3613('0xa'),attributes,{'tableName':'cm_hopper_final','paranoid':![],'indexes':[{'name':_0x3613('0xb'),'fields':[_0x3613('0xb')]},{'name':_0x3613('0xc'),'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 5ebd4b5..7839dba 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 _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(_0x1b57ac,_0x3e5364){var _0x53eb9f=function(_0x1cf3fd){while(--_0x1cf3fd){_0x1b57ac['push'](_0x1b57ac['shift']());}};_0x53eb9f(++_0x3e5364);}(_0x7a54,0x106));var _0x47a5=function(_0x56a54f,_0x594dfd){_0x56a54f=_0x56a54f-0x0;var _0x205478=_0x7a54[_0x56a54f];return _0x205478;};'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 +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(_0xd3ae92,_0x119dcf){var _0x2a8046=function(_0x4413c3){while(--_0x4413c3){_0xd3ae92['push'](_0xd3ae92['shift']());}};_0x2a8046(++_0x119dcf);}(_0xb10b,0x12a));var _0xbb10=function(_0x417ea3,_0x156e87){_0x417ea3=_0x417ea3-0x0;var _0x18c29d=_0xb10b[_0x417ea3];return _0x18c29d;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')](_0x378da8['body'],{'raw':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![]})[_0xbb10('0xc')](function(_0xdf237d){logger[_0xbb10('0xd')]('CreateCmHopperFinal',_0x378da8);logger[_0xbb10('0x1a')](_0xbb10('0x15'),_0x378da8,JSON['stringify'](_0xdf237d));_0x575cca(_0xdf237d);})['catch'](function(_0x8e2b97){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x8e2b97[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x8e2b97[_0xbb10('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index 10a9a18..f21b985 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 _0x69a4=['multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','get','index','isAuthenticated','describe','/:id','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','/voice/queue/moveContacts/:id','post','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','put','exports'];(function(_0x599f41,_0x4db732){var _0x2e4d58=function(_0x14c882){while(--_0x14c882){_0x599f41['push'](_0x599f41['shift']());}};_0x2e4d58(++_0x4db732);}(_0x69a4,0x1cb));var _0x469a=function(_0x138e55,_0x5e3046){_0x138e55=_0x138e55-0x0;var _0x23a3cc=_0x69a4[_0x138e55];return _0x23a3cc;};'use strict';var multer=require(_0x469a('0x0'));var util=require('util');var path=require(_0x469a('0x1'));var timeout=require(_0x469a('0x2'));var express=require(_0x469a('0x3'));var router=express[_0x469a('0x4')]();var fs_extra=require(_0x469a('0x5'));var auth=require(_0x469a('0x6'));var interaction=require(_0x469a('0x7'));var config=require(_0x469a('0x8'));var controller=require(_0x469a('0x9'));router[_0x469a('0xa')]('/',auth['isAuthenticated'](),controller[_0x469a('0xb')]);router['get']('/describe',auth[_0x469a('0xc')](),controller[_0x469a('0xd')]);router[_0x469a('0xa')](_0x469a('0xe'),auth[_0x469a('0xc')](),controller['show']);router[_0x469a('0xa')](_0x469a('0xf'),auth[_0x469a('0xc')](),controller[_0x469a('0x10')]);router[_0x469a('0xa')](_0x469a('0x11'),auth[_0x469a('0xc')](),controller[_0x469a('0x12')]);router['post'](_0x469a('0x13'),auth[_0x469a('0xc')](),controller['moveContactsQueueCampaignHopperFinal']);router[_0x469a('0x14')](_0x469a('0x15'),auth['isAuthenticated'](),controller[_0x469a('0x16')]);router[_0x469a('0x14')](_0x469a('0x17'),auth[_0x469a('0xc')](),controller[_0x469a('0x18')]);router[_0x469a('0x19')](_0x469a('0xe'),auth[_0x469a('0xc')](),controller['update']);module[_0x469a('0x1a')]=router; \ No newline at end of file +var _0x6eb7=['isAuthenticated','index','/describe','describe','/:id','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','checkContactHopper','put','update','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','get'];(function(_0x46e6e3,_0x5e1396){var _0x4b0c5a=function(_0x23a49c){while(--_0x23a49c){_0x46e6e3['push'](_0x46e6e3['shift']());}};_0x4b0c5a(++_0x5e1396);}(_0x6eb7,0x1d2));var _0x76eb=function(_0x5817d9,_0x2c8486){_0x5817d9=_0x5817d9-0x0;var _0x30f116=_0x6eb7[_0x5817d9];return _0x30f116;};'use strict';var multer=require('multer');var util=require(_0x76eb('0x0'));var path=require('path');var timeout=require(_0x76eb('0x1'));var express=require(_0x76eb('0x2'));var router=express[_0x76eb('0x3')]();var fs_extra=require(_0x76eb('0x4'));var auth=require(_0x76eb('0x5'));var interaction=require(_0x76eb('0x6'));var config=require(_0x76eb('0x7'));var controller=require(_0x76eb('0x8'));router[_0x76eb('0x9')]('/',auth[_0x76eb('0xa')](),controller[_0x76eb('0xb')]);router['get'](_0x76eb('0xc'),auth[_0x76eb('0xa')](),controller[_0x76eb('0xd')]);router[_0x76eb('0x9')](_0x76eb('0xe'),auth[_0x76eb('0xa')](),controller[_0x76eb('0xf')]);router[_0x76eb('0x9')](_0x76eb('0x10'),auth[_0x76eb('0xa')](),controller[_0x76eb('0x11')]);router[_0x76eb('0x9')](_0x76eb('0x12'),auth['isAuthenticated'](),controller[_0x76eb('0x13')]);router[_0x76eb('0x14')]('/voice/queue/moveContacts/:id',auth[_0x76eb('0xa')](),controller[_0x76eb('0x15')]);router[_0x76eb('0x14')](_0x76eb('0x16'),auth[_0x76eb('0xa')](),controller[_0x76eb('0x17')]);router['post']('/checkContactHopper',auth[_0x76eb('0xa')](),controller[_0x76eb('0x18')]);router[_0x76eb('0x19')](_0x76eb('0xe'),auth[_0x76eb('0xa')](),controller[_0x76eb('0x1a')]);module[_0x76eb('0x1b')]=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index 658b069..233ecc6 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 _0x5352=['exports','STRING','INTEGER','DATE','BOOLEAN','sequelize'];(function(_0xf71b61,_0x218f11){var _0x1b9b5d=function(_0x37b146){while(--_0x37b146){_0xf71b61['push'](_0xf71b61['shift']());}};_0x1b9b5d(++_0x218f11);}(_0x5352,0x14f));var _0x2535=function(_0x286305,_0x413532){_0x286305=_0x286305-0x0;var _0x130437=_0x5352[_0x286305];return _0x130437;};'use strict';var Sequelize=require(_0x2535('0x0'));module[_0x2535('0x1')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0x2535('0x2')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x2535('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x2535('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x2535('0x3')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x2535('0x2')]},'originatecalleridnum':{'type':Sequelize[_0x2535('0x2')]},'originatecalleridname':{'type':Sequelize[_0x2535('0x2')]},'calleridnum':{'type':Sequelize[_0x2535('0x2')]},'calleridname':{'type':Sequelize[_0x2535('0x2')]},'starttime':{'type':Sequelize[_0x2535('0x4')]},'responsetime':{'type':Sequelize[_0x2535('0x4')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x2535('0x4')]},'ringtime':{'type':Sequelize[_0x2535('0x3')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x2535('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x2535('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x2535('0x2')]},'campaign':{'type':Sequelize[_0x2535('0x2')]},'campaigntype':{'type':Sequelize[_0x2535('0x2')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize['STRING']},'amd':{'type':Sequelize[_0x2535('0x5')],'defaultValue':![]},'fax':{'type':Sequelize[_0x2535('0x5')],'defaultValue':![]},'callback':{'type':Sequelize[_0x2535('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x2535('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x2535('0x4')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'editedat':{'type':Sequelize[_0x2535('0x4')]},'edited':{'type':Sequelize[_0x2535('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x2535('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x2535('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x2535('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x2535('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0xa2a4=['DATE','BOOLEAN','exports','INTEGER','STRING'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xa2a4,0xf7));var _0x4a2a=function(_0x121607,_0x20897b){_0x121607=_0x121607-0x0;var _0x1de6d0=_0xa2a4[_0x121607];return _0x1de6d0;};'use strict';var Sequelize=require('sequelize');module[_0x4a2a('0x0')]={'state':{'type':Sequelize[_0x4a2a('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x4a2a('0x2')]},'scheduledat':{'type':Sequelize[_0x4a2a('0x3')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x4a2a('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x4a2a('0x1')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x4a2a('0x1')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x4a2a('0x2')]},'originatecalleridnum':{'type':Sequelize[_0x4a2a('0x2')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x4a2a('0x2')]},'starttime':{'type':Sequelize[_0x4a2a('0x3')]},'responsetime':{'type':Sequelize[_0x4a2a('0x3')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0x4a2a('0x3')]},'endtime':{'type':Sequelize[_0x4a2a('0x3')]},'ringtime':{'type':Sequelize[_0x4a2a('0x1')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x4a2a('0x1')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x4a2a('0x1')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x4a2a('0x2')]},'campaign':{'type':Sequelize[_0x4a2a('0x2')]},'campaigntype':{'type':Sequelize[_0x4a2a('0x2')]},'membername':{'type':Sequelize[_0x4a2a('0x2')]},'reason':{'type':Sequelize[_0x4a2a('0x2')]},'amd':{'type':Sequelize[_0x4a2a('0x4')],'defaultValue':![]},'fax':{'type':Sequelize[_0x4a2a('0x4')],'defaultValue':![]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x4a2a('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0x4a2a('0x4')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x4a2a('0x3')]},'edited':{'type':Sequelize[_0x4a2a('0x4')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x4a2a('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x4a2a('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x4a2a('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x4a2a('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index 9d26951..6e205c4 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 _0x73ff=['limit','count','set','reject','save','update','then','destroy','end','sendStatus','error','name','send','index','map','CmHopperHistory','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','include','findAll','rows','catch','show','params','includeAll','create','body','describe','uniqueid','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','json','offset','undefined'];(function(_0x3394c9,_0x48d5ea){var _0x42b4db=function(_0x3f2108){while(--_0x3f2108){_0x3394c9['push'](_0x3394c9['shift']());}};_0x42b4db(++_0x48d5ea);}(_0x73ff,0x11d));var _0xf73f=function(_0xf58e5b,_0x483eb7){_0xf58e5b=_0xf58e5b-0x0;var _0x503772=_0x73ff[_0xf58e5b];return _0x503772;};'use strict';var emlformat=require(_0xf73f('0x0'));var rimraf=require(_0xf73f('0x1'));var zipdir=require(_0xf73f('0x2'));var jsonpatch=require(_0xf73f('0x3'));var rp=require(_0xf73f('0x4'));var moment=require(_0xf73f('0x5'));var BPromise=require(_0xf73f('0x6'));var Mustache=require(_0xf73f('0x7'));var util=require(_0xf73f('0x8'));var path=require(_0xf73f('0x9'));var sox=require('sox');var csv=require(_0xf73f('0xa'));var ejs=require(_0xf73f('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf73f('0xc'));var squel=require('squel');var crypto=require(_0xf73f('0xd'));var jsforce=require(_0xf73f('0xe'));var deskjs=require(_0xf73f('0xf'));var toCsv=require(_0xf73f('0xa'));var querystring=require(_0xf73f('0x10'));var Papa=require('papaparse');var Redis=require(_0xf73f('0x11'));var authService=require(_0xf73f('0x12'));var qs=require(_0xf73f('0x13'));var as=require(_0xf73f('0x14'));var hardwareService=require(_0xf73f('0x15'));var logger=require(_0xf73f('0x16'))(_0xf73f('0x17'));var utils=require(_0xf73f('0x18'));var config=require(_0xf73f('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xf73f('0x1a'))['db'];function respondWithStatusCode(_0x3b3df3,_0x5e9080){_0x5e9080=_0x5e9080||0xcc;return function(_0x5f036f){if(_0x5f036f){return _0x3b3df3['sendStatus'](_0x5e9080);}return _0x3b3df3[_0xf73f('0x1b')](_0x5e9080)['end']();};}function respondWithResult(_0x372f5f,_0x4e8e31){_0x4e8e31=_0x4e8e31||0xc8;return function(_0x197691){if(_0x197691){return _0x372f5f[_0xf73f('0x1b')](_0x4e8e31)[_0xf73f('0x1c')](_0x197691);}};}function respondWithFilteredResult(_0x58c332,_0x35ff85){return function(_0x9e65ad){if(_0x9e65ad){var _0x41c7a5=typeof _0x35ff85[_0xf73f('0x1d')]===_0xf73f('0x1e')&&typeof _0x35ff85[_0xf73f('0x1f')]===_0xf73f('0x1e');var _0x2f476b=_0x9e65ad[_0xf73f('0x20')];var _0x4dad64=_0x41c7a5?0x0:_0x35ff85[_0xf73f('0x1d')];var _0x37432e=_0x41c7a5?_0x9e65ad[_0xf73f('0x20')]:_0x35ff85[_0xf73f('0x1d')]+_0x35ff85[_0xf73f('0x1f')];var _0x3343dd;if(_0x37432e>=_0x2f476b){_0x37432e=_0x2f476b;_0x3343dd=0xc8;}else{_0x3343dd=0xce;}_0x58c332[_0xf73f('0x1b')](_0x3343dd);return _0x58c332[_0xf73f('0x21')]('Content-Range',_0x4dad64+'-'+_0x37432e+'/'+_0x2f476b)[_0xf73f('0x1c')](_0x9e65ad);}return null;};}function patchUpdates(_0xde5375){return function(_0x34ad71){try{jsonpatch['apply'](_0x34ad71,_0xde5375,!![]);}catch(_0x36d4ec){return BPromise[_0xf73f('0x22')](_0x36d4ec);}return _0x34ad71[_0xf73f('0x23')]();};}function saveUpdates(_0x53f34c,_0x38056c){return function(_0x1de6d6){if(_0x1de6d6){return _0x1de6d6[_0xf73f('0x24')](_0x53f34c)[_0xf73f('0x25')](function(_0x2e46f6){return _0x2e46f6;});}return null;};}function removeEntity(_0x1b621f,_0x5e7bfd){return function(_0x24421c){if(_0x24421c){return _0x24421c[_0xf73f('0x26')]()['then'](function(){_0x1b621f[_0xf73f('0x1b')](0xcc)[_0xf73f('0x27')]();});}};}function handleEntityNotFound(_0x5ed690,_0x5205be){return function(_0x4e42d1){if(!_0x4e42d1){_0x5ed690[_0xf73f('0x28')](0x194);}return _0x4e42d1;};}function handleError(_0x53deb1,_0x19d778){_0x19d778=_0x19d778||0x1f4;return function(_0x2d5a4b){logger[_0xf73f('0x29')](_0x2d5a4b['stack']);if(_0x2d5a4b[_0xf73f('0x2a')]){delete _0x2d5a4b[_0xf73f('0x2a')];}_0x53deb1[_0xf73f('0x1b')](_0x19d778)[_0xf73f('0x2b')](_0x2d5a4b);};}exports[_0xf73f('0x2c')]=function(_0x2ac696,_0x4b9249){var _0x40512e={},_0xf7821={},_0xd53096={'count':0x0,'rows':[]};var _0x3949c3=_[_0xf73f('0x2d')](db[_0xf73f('0x2e')][_0xf73f('0x2f')],function(_0x4f2cf0){return{'name':_0x4f2cf0[_0xf73f('0x30')],'type':_0x4f2cf0[_0xf73f('0x31')][_0xf73f('0x32')]};});_0xf7821[_0xf73f('0x33')]=_[_0xf73f('0x2d')](_0x3949c3,_0xf73f('0x2a'));_0xf7821[_0xf73f('0x34')]=_[_0xf73f('0x35')](_0x2ac696[_0xf73f('0x34')]);_0xf7821[_0xf73f('0x36')]=_[_0xf73f('0x37')](_0xf7821[_0xf73f('0x33')],_0xf7821[_0xf73f('0x34')]);_0x40512e[_0xf73f('0x38')]=_[_0xf73f('0x37')](_0xf7821[_0xf73f('0x33')],qs[_0xf73f('0x39')](_0x2ac696[_0xf73f('0x34')][_0xf73f('0x39')]));_0x40512e[_0xf73f('0x38')]=_0x40512e[_0xf73f('0x38')][_0xf73f('0x3a')]?_0x40512e[_0xf73f('0x38')]:_0xf7821['model'];if(!_0x2ac696[_0xf73f('0x34')][_0xf73f('0x3b')](_0xf73f('0x3c'))){_0x40512e['limit']=qs[_0xf73f('0x1f')](_0x2ac696[_0xf73f('0x34')][_0xf73f('0x1f')]);_0x40512e[_0xf73f('0x1d')]=qs['offset'](_0x2ac696['query'][_0xf73f('0x1d')]);}_0x40512e['order']=qs['sort'](_0x2ac696[_0xf73f('0x34')][_0xf73f('0x3d')]);_0x40512e[_0xf73f('0x3e')]=qs[_0xf73f('0x36')](_[_0xf73f('0x3f')](_0x2ac696[_0xf73f('0x34')],_0xf7821[_0xf73f('0x36')]),_0x3949c3);if(_0x2ac696['query'][_0xf73f('0x40')]){_0x40512e[_0xf73f('0x3e')]=_['merge'](_0x40512e['where'],{'$or':_[_0xf73f('0x2d')](_0x3949c3,function(_0x1d6f07){if(_0x1d6f07[_0xf73f('0x31')]!=='VIRTUAL'){var _0x4de089={};_0x4de089[_0x1d6f07[_0xf73f('0x2a')]]={'$like':'%'+_0x2ac696[_0xf73f('0x34')]['filter']+'%'};return _0x4de089;}})});}_0x40512e=_[_0xf73f('0x41')]({},_0x40512e,_0x2ac696[_0xf73f('0x42')]);var _0x5b789d={'where':_0x40512e[_0xf73f('0x3e')]};return db[_0xf73f('0x2e')][_0xf73f('0x20')](_0x5b789d)[_0xf73f('0x25')](function(_0x3a0df8){_0xd53096[_0xf73f('0x20')]=_0x3a0df8;if(_0x2ac696['query']['includeAll']){_0x40512e[_0xf73f('0x43')]=[{'all':!![]}];}return db[_0xf73f('0x2e')][_0xf73f('0x44')](_0x40512e);})['then'](function(_0x129bd6){_0xd53096[_0xf73f('0x45')]=_0x129bd6;return _0xd53096;})[_0xf73f('0x25')](respondWithFilteredResult(_0x4b9249,_0x40512e))[_0xf73f('0x46')](handleError(_0x4b9249,null));};exports[_0xf73f('0x47')]=function(_0x5bd61e,_0x1a7790){var _0x21662a={'raw':!![],'where':{'id':_0x5bd61e[_0xf73f('0x48')]['id']}},_0x32c0b9={};_0x32c0b9[_0xf73f('0x33')]=_[_0xf73f('0x35')](db['CmHopperHistory'][_0xf73f('0x2f')]);_0x32c0b9[_0xf73f('0x34')]=_[_0xf73f('0x35')](_0x5bd61e[_0xf73f('0x34')]);_0x32c0b9['filters']=_[_0xf73f('0x37')](_0x32c0b9[_0xf73f('0x33')],_0x32c0b9[_0xf73f('0x34')]);_0x21662a['attributes']=_[_0xf73f('0x37')](_0x32c0b9[_0xf73f('0x33')],qs['fields'](_0x5bd61e[_0xf73f('0x34')][_0xf73f('0x39')]));_0x21662a['attributes']=_0x21662a[_0xf73f('0x38')]['length']?_0x21662a[_0xf73f('0x38')]:_0x32c0b9[_0xf73f('0x33')];if(_0x5bd61e[_0xf73f('0x34')][_0xf73f('0x49')]){_0x21662a[_0xf73f('0x43')]=[{'all':!![]}];}_0x21662a=_[_0xf73f('0x41')]({},_0x21662a,_0x5bd61e[_0xf73f('0x42')]);return db[_0xf73f('0x2e')]['find'](_0x21662a)[_0xf73f('0x25')](handleEntityNotFound(_0x1a7790,null))['then'](respondWithResult(_0x1a7790,null))[_0xf73f('0x46')](handleError(_0x1a7790,null));};exports[_0xf73f('0x4a')]=function(_0x492342,_0x9387f4){return db[_0xf73f('0x2e')]['create'](_0x492342[_0xf73f('0x4b')],{})[_0xf73f('0x25')](respondWithResult(_0x9387f4,0xc9))['catch'](handleError(_0x9387f4,null));};exports[_0xf73f('0x4c')]=function(_0x4af6cb,_0x5c1c16){return db[_0xf73f('0x2e')][_0xf73f('0x4c')]()['then'](respondWithResult(_0x5c1c16,null))[_0xf73f('0x46')](handleError(_0x5c1c16,null));};exports['update']=function(_0x1a759f,_0x5d1460){if(_0x1a759f[_0xf73f('0x4b')][_0xf73f('0x4d')]){delete _0x1a759f[_0xf73f('0x4b')][_0xf73f('0x4d')];}return db[_0xf73f('0x2e')][_0xf73f('0x4e')]({'where':{'uniqueid':_0x1a759f[_0xf73f('0x48')]['id']}})['then'](handleEntityNotFound(_0x5d1460,null))[_0xf73f('0x25')](saveUpdates(_0x1a759f['body'],null))[_0xf73f('0x25')](respondWithResult(_0x5d1460,null))['catch'](handleError(_0x5d1460,null));}; \ No newline at end of file +var _0x956f=['mustache','util','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/utils','../../config/license/util','sendStatus','end','json','undefined','count','offset','limit','status','set','Content-Range','reject','save','update','then','destroy','error','stack','name','index','map','CmHopperHistory','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','filter','merge','type','VIRTUAL','options','where','includeAll','include','findAll','rows','catch','show','params','create','body','describe','uniqueid','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird'];(function(_0x18d263,_0x25993e){var _0x15dc63=function(_0x3d36fb){while(--_0x3d36fb){_0x18d263['push'](_0x18d263['shift']());}};_0x15dc63(++_0x25993e);}(_0x956f,0x1aa));var _0xf956=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0x956f[_0x5d6456];return _0x4d66c1;};'use strict';var emlformat=require(_0xf956('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf956('0x1'));var jsonpatch=require(_0xf956('0x2'));var rp=require(_0xf956('0x3'));var moment=require(_0xf956('0x4'));var BPromise=require(_0xf956('0x5'));var Mustache=require(_0xf956('0x6'));var util=require(_0xf956('0x7'));var path=require(_0xf956('0x8'));var sox=require('sox');var csv=require(_0xf956('0x9'));var ejs=require(_0xf956('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf956('0xb'));var squel=require('squel');var crypto=require(_0xf956('0xc'));var jsforce=require(_0xf956('0xd'));var deskjs=require(_0xf956('0xe'));var toCsv=require(_0xf956('0x9'));var querystring=require(_0xf956('0xf'));var Papa=require('papaparse');var Redis=require(_0xf956('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xf956('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xf956('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xf956('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x521878,_0x4050be){_0x4050be=_0x4050be||0xcc;return function(_0x4d90f2){if(_0x4d90f2){return _0x521878[_0xf956('0x14')](_0x4050be);}return _0x521878['status'](_0x4050be)[_0xf956('0x15')]();};}function respondWithResult(_0x12254b,_0x125fb2){_0x125fb2=_0x125fb2||0xc8;return function(_0x7890b4){if(_0x7890b4){return _0x12254b['status'](_0x125fb2)[_0xf956('0x16')](_0x7890b4);}};}function respondWithFilteredResult(_0x48a080,_0x10d5fe){return function(_0x2297c4){if(_0x2297c4){var _0x240823=typeof _0x10d5fe['offset']===_0xf956('0x17')&&typeof _0x10d5fe['limit']===_0xf956('0x17');var _0x1a1cd5=_0x2297c4[_0xf956('0x18')];var _0x145d39=_0x240823?0x0:_0x10d5fe[_0xf956('0x19')];var _0x319741=_0x240823?_0x2297c4[_0xf956('0x18')]:_0x10d5fe['offset']+_0x10d5fe[_0xf956('0x1a')];var _0x1dbda5;if(_0x319741>=_0x1a1cd5){_0x319741=_0x1a1cd5;_0x1dbda5=0xc8;}else{_0x1dbda5=0xce;}_0x48a080[_0xf956('0x1b')](_0x1dbda5);return _0x48a080[_0xf956('0x1c')](_0xf956('0x1d'),_0x145d39+'-'+_0x319741+'/'+_0x1a1cd5)[_0xf956('0x16')](_0x2297c4);}return null;};}function patchUpdates(_0x46bd94){return function(_0x1b8e2d){try{jsonpatch['apply'](_0x1b8e2d,_0x46bd94,!![]);}catch(_0x43ae96){return BPromise[_0xf956('0x1e')](_0x43ae96);}return _0x1b8e2d[_0xf956('0x1f')]();};}function saveUpdates(_0x170bb6,_0x3c6b35){return function(_0x5d5111){if(_0x5d5111){return _0x5d5111[_0xf956('0x20')](_0x170bb6)[_0xf956('0x21')](function(_0xeabe66){return _0xeabe66;});}return null;};}function removeEntity(_0x31e5df,_0x2fdfe0){return function(_0x3e1aae){if(_0x3e1aae){return _0x3e1aae[_0xf956('0x22')]()['then'](function(){_0x31e5df[_0xf956('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x29a4ac,_0x24e803){return function(_0x292c01){if(!_0x292c01){_0x29a4ac[_0xf956('0x14')](0x194);}return _0x292c01;};}function handleError(_0x520952,_0x49c9c5){_0x49c9c5=_0x49c9c5||0x1f4;return function(_0x480987){logger[_0xf956('0x23')](_0x480987[_0xf956('0x24')]);if(_0x480987[_0xf956('0x25')]){delete _0x480987[_0xf956('0x25')];}_0x520952[_0xf956('0x1b')](_0x49c9c5)['send'](_0x480987);};}exports[_0xf956('0x26')]=function(_0x360de5,_0x97a89b){var _0x590b16={},_0x56ef8a={},_0x5d2258={'count':0x0,'rows':[]};var _0x21bbe7=_[_0xf956('0x27')](db[_0xf956('0x28')][_0xf956('0x29')],function(_0x35e54c){return{'name':_0x35e54c[_0xf956('0x2a')],'type':_0x35e54c['type'][_0xf956('0x2b')]};});_0x56ef8a[_0xf956('0x2c')]=_['map'](_0x21bbe7,'name');_0x56ef8a[_0xf956('0x2d')]=_[_0xf956('0x2e')](_0x360de5['query']);_0x56ef8a[_0xf956('0x2f')]=_[_0xf956('0x30')](_0x56ef8a[_0xf956('0x2c')],_0x56ef8a[_0xf956('0x2d')]);_0x590b16['attributes']=_[_0xf956('0x30')](_0x56ef8a[_0xf956('0x2c')],qs[_0xf956('0x31')](_0x360de5[_0xf956('0x2d')][_0xf956('0x31')]));_0x590b16[_0xf956('0x32')]=_0x590b16['attributes'][_0xf956('0x33')]?_0x590b16['attributes']:_0x56ef8a[_0xf956('0x2c')];if(!_0x360de5[_0xf956('0x2d')][_0xf956('0x34')](_0xf956('0x35'))){_0x590b16[_0xf956('0x1a')]=qs[_0xf956('0x1a')](_0x360de5['query'][_0xf956('0x1a')]);_0x590b16['offset']=qs[_0xf956('0x19')](_0x360de5['query'][_0xf956('0x19')]);}_0x590b16['order']=qs[_0xf956('0x36')](_0x360de5[_0xf956('0x2d')][_0xf956('0x36')]);_0x590b16['where']=qs[_0xf956('0x2f')](_['pick'](_0x360de5[_0xf956('0x2d')],_0x56ef8a[_0xf956('0x2f')]),_0x21bbe7);if(_0x360de5[_0xf956('0x2d')][_0xf956('0x37')]){_0x590b16['where']=_[_0xf956('0x38')](_0x590b16['where'],{'$or':_[_0xf956('0x27')](_0x21bbe7,function(_0x254b03){if(_0x254b03[_0xf956('0x39')]!==_0xf956('0x3a')){var _0x208ccc={};_0x208ccc[_0x254b03[_0xf956('0x25')]]={'$like':'%'+_0x360de5[_0xf956('0x2d')][_0xf956('0x37')]+'%'};return _0x208ccc;}})});}_0x590b16=_[_0xf956('0x38')]({},_0x590b16,_0x360de5[_0xf956('0x3b')]);var _0x36cd0e={'where':_0x590b16[_0xf956('0x3c')]};return db['CmHopperHistory'][_0xf956('0x18')](_0x36cd0e)[_0xf956('0x21')](function(_0x4c5de4){_0x5d2258[_0xf956('0x18')]=_0x4c5de4;if(_0x360de5[_0xf956('0x2d')][_0xf956('0x3d')]){_0x590b16[_0xf956('0x3e')]=[{'all':!![]}];}return db[_0xf956('0x28')][_0xf956('0x3f')](_0x590b16);})['then'](function(_0x3af392){_0x5d2258[_0xf956('0x40')]=_0x3af392;return _0x5d2258;})[_0xf956('0x21')](respondWithFilteredResult(_0x97a89b,_0x590b16))[_0xf956('0x41')](handleError(_0x97a89b,null));};exports[_0xf956('0x42')]=function(_0x291b2b,_0xcafb4){var _0x240357={'raw':!![],'where':{'id':_0x291b2b[_0xf956('0x43')]['id']}},_0x52cae7={};_0x52cae7[_0xf956('0x2c')]=_[_0xf956('0x2e')](db['CmHopperHistory'][_0xf956('0x29')]);_0x52cae7[_0xf956('0x2d')]=_[_0xf956('0x2e')](_0x291b2b[_0xf956('0x2d')]);_0x52cae7[_0xf956('0x2f')]=_[_0xf956('0x30')](_0x52cae7[_0xf956('0x2c')],_0x52cae7[_0xf956('0x2d')]);_0x240357[_0xf956('0x32')]=_[_0xf956('0x30')](_0x52cae7[_0xf956('0x2c')],qs['fields'](_0x291b2b[_0xf956('0x2d')][_0xf956('0x31')]));_0x240357[_0xf956('0x32')]=_0x240357[_0xf956('0x32')][_0xf956('0x33')]?_0x240357[_0xf956('0x32')]:_0x52cae7[_0xf956('0x2c')];if(_0x291b2b[_0xf956('0x2d')]['includeAll']){_0x240357[_0xf956('0x3e')]=[{'all':!![]}];}_0x240357=_[_0xf956('0x38')]({},_0x240357,_0x291b2b[_0xf956('0x3b')]);return db[_0xf956('0x28')]['find'](_0x240357)[_0xf956('0x21')](handleEntityNotFound(_0xcafb4,null))['then'](respondWithResult(_0xcafb4,null))[_0xf956('0x41')](handleError(_0xcafb4,null));};exports[_0xf956('0x44')]=function(_0x4fa3a2,_0x36fd3a){return db['CmHopperHistory'][_0xf956('0x44')](_0x4fa3a2[_0xf956('0x45')],{})[_0xf956('0x21')](respondWithResult(_0x36fd3a,0xc9))[_0xf956('0x41')](handleError(_0x36fd3a,null));};exports[_0xf956('0x46')]=function(_0x34eaad,_0x35450e){return db[_0xf956('0x28')][_0xf956('0x46')]()[_0xf956('0x21')](respondWithResult(_0x35450e,null))['catch'](handleError(_0x35450e,null));};exports['update']=function(_0xf666bf,_0x18e066){if(_0xf666bf[_0xf956('0x45')]['uniqueid']){delete _0xf666bf['body'][_0xf956('0x47')];}return db[_0xf956('0x28')]['find']({'where':{'uniqueid':_0xf666bf[_0xf956('0x43')]['id']}})[_0xf956('0x21')](handleEntityNotFound(_0x18e066,null))[_0xf956('0x21')](saveUpdates(_0xf666bf[_0xf956('0x45')],null))[_0xf956('0x21')](respondWithResult(_0x18e066,null))['catch'](handleError(_0x18e066,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index 601cf8e..276e8c3 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 _0xd26f=['define','CmHopperHistory','cm_hopper_history','endtime','uniqueid','lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperHistory.attributes','exports'];(function(_0x1d3149,_0x571cea){var _0x53c537=function(_0x1d54c4){while(--_0x1d54c4){_0x1d3149['push'](_0x1d3149['shift']());}};_0x53c537(++_0x571cea);}(_0xd26f,0x113));var _0xfd26=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0xd26f[_0x55f8b4];return _0x2475f9;};'use strict';var _=require(_0xfd26('0x0'));var util=require(_0xfd26('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xfd26('0x2'));var BPromise=require(_0xfd26('0x3'));var rp=require(_0xfd26('0x4'));var fs=require('fs');var path=require(_0xfd26('0x5'));var rimraf=require(_0xfd26('0x6'));var config=require(_0xfd26('0x7'));var attributes=require(_0xfd26('0x8'));module[_0xfd26('0x9')]=function(_0x3a3ae9,_0x510311){return _0x3a3ae9[_0xfd26('0xa')](_0xfd26('0xb'),attributes,{'tableName':_0xfd26('0xc'),'paranoid':![],'indexes':[{'name':_0xfd26('0xd'),'fields':[_0xfd26('0xd')]},{'name':_0xfd26('0xe'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x6017=['../../config/environment','define','CmHopperHistory','cm_hopper_history','endtime','uniqueid','lodash','util','../../config/logger','moment','bluebird','path'];(function(_0x3124f8,_0x1a8b23){var _0x5bab5f=function(_0x18b09b){while(--_0x18b09b){_0x3124f8['push'](_0x3124f8['shift']());}};_0x5bab5f(++_0x1a8b23);}(_0x6017,0xae));var _0x7601=function(_0x243a70,_0x20ea7e){_0x243a70=_0x243a70-0x0;var _0xa32908=_0x6017[_0x243a70];return _0xa32908;};'use strict';var _=require(_0x7601('0x0'));var util=require(_0x7601('0x1'));var logger=require(_0x7601('0x2'))('api');var moment=require(_0x7601('0x3'));var BPromise=require(_0x7601('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7601('0x5'));var rimraf=require('rimraf');var config=require(_0x7601('0x6'));var attributes=require('./cmHopperHistory.attributes');module['exports']=function(_0x425bf9,_0xc62b2c){return _0x425bf9[_0x7601('0x7')](_0x7601('0x8'),attributes,{'tableName':_0x7601('0x9'),'paranoid':![],'indexes':[{'name':_0x7601('0xa'),'fields':['endtime']},{'name':_0x7601('0xb'),'fields':[_0x7601('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index 3133fa1..5e4d2f8 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 _0x86a8=['`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x204,\x201,\x20null','GetCampaignHopperHistory','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateCmHopperHistory','CmHopperHistory','create','options','raw','AvgHandleTime','findAll','where','sequelize','COUNT','col','literal','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','GetVoiceQueueHopperHistory','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','outboundAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay'];(function(_0x680821,_0x23e67f){var _0x3f132c=function(_0x1bbcea){while(--_0x1bbcea){_0x680821['push'](_0x680821['shift']());}};_0x3f132c(++_0x23e67f);}(_0x86a8,0x1ae));var _0x886a=function(_0x461025,_0x42a52a){_0x461025=_0x461025-0x0;var _0x28d220=_0x86a8[_0x461025];return _0x28d220;};'use strict';var _=require(_0x886a('0x0'));var util=require(_0x886a('0x1'));var moment=require(_0x886a('0x2'));var BPromise=require(_0x886a('0x3'));var rs=require(_0x886a('0x4'));var fs=require('fs');var Redis=require(_0x886a('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x886a('0x6'));var logger=require(_0x886a('0x7'))('rpc');var config=require(_0x886a('0x8'));var jayson=require(_0x886a('0x9'));var client=jayson['client'][_0x886a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x572c8e,_0x31434c,_0x557bcb){return new BPromise(function(_0x752eed,_0x10641b){return client[_0x886a('0xb')](_0x572c8e,_0x557bcb)[_0x886a('0xc')](function(_0x22d3c0){logger[_0x886a('0xd')](_0x886a('0xe'),_0x31434c,_0x886a('0xf'));logger[_0x886a('0x10')](_0x886a('0x11'),_0x31434c,'request\x20sent',JSON[_0x886a('0x12')](_0x22d3c0));if(_0x22d3c0[_0x886a('0x13')]){if(_0x22d3c0[_0x886a('0x13')][_0x886a('0x14')]===0x1f4){logger['error'](_0x886a('0xe'),_0x31434c,_0x22d3c0[_0x886a('0x13')][_0x886a('0x15')]);return _0x10641b(_0x22d3c0[_0x886a('0x13')][_0x886a('0x15')]);}logger[_0x886a('0x13')](_0x886a('0xe'),_0x31434c,_0x22d3c0[_0x886a('0x13')][_0x886a('0x15')]);return _0x752eed(_0x22d3c0[_0x886a('0x13')]['message']);}else{logger[_0x886a('0xd')](_0x886a('0xe'),_0x31434c,_0x886a('0xf'));_0x752eed(_0x22d3c0[_0x886a('0x16')]['message']);}})[_0x886a('0x17')](function(_0x435cec){logger['error'](_0x886a('0xe'),_0x31434c,_0x435cec);_0x10641b(_0x435cec);});});}exports[_0x886a('0x18')]=function(_0x49cfa1){var _0x36c4c7=this;return new Promise(function(_0x36fca3,_0x157a45){return db[_0x886a('0x19')][_0x886a('0x1a')](_0x49cfa1['body'],{'raw':_0x49cfa1[_0x886a('0x1b')]?_0x49cfa1['options'][_0x886a('0x1c')]===undefined?!![]:![]:!![]})[_0x886a('0xc')](function(_0x39ba85){logger[_0x886a('0xd')]('CreateCmHopperHistory',_0x49cfa1);logger[_0x886a('0x10')]('CreateCmHopperHistory',_0x49cfa1,JSON[_0x886a('0x12')](_0x39ba85));_0x36fca3(_0x39ba85);})['catch'](function(_0x51be2c){logger[_0x886a('0x13')](_0x886a('0x18'),_0x51be2c[_0x886a('0x15')],_0x49cfa1);_0x157a45(_0x36c4c7[_0x886a('0x13')](0x1f4,_0x51be2c[_0x886a('0x15')]));});});};exports[_0x886a('0x1d')]=function(_0x531c82){var _0x27ea6d=this;return new Promise(function(_0x37d9e4,_0x4d065f){return db[_0x886a('0x19')][_0x886a('0x1e')]({'raw':_0x531c82['options']?_0x531c82[_0x886a('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x531c82['options']?_0x531c82[_0x886a('0x1b')][_0x886a('0x1f')]||null:null,'attributes':[[db[_0x886a('0x20')]['fn'](_0x886a('0x21'),db[_0x886a('0x20')][_0x886a('0x22')]('id')),'predictiveIntervalTotalCalls'],[db[_0x886a('0x20')]['fn'](_0x886a('0x21'),db[_0x886a('0x20')]['fn']('IF',db[_0x886a('0x20')][_0x886a('0x23')]('`state`\x20=\x204,\x201,\x20null'))),_0x886a('0x24')],[db[_0x886a('0x20')]['fn'](_0x886a('0x21'),db[_0x886a('0x20')]['fn']('IF',db[_0x886a('0x20')][_0x886a('0x23')](_0x886a('0x25')))),_0x886a('0x26')],[db[_0x886a('0x20')]['fn'](_0x886a('0x21'),db[_0x886a('0x20')]['fn']('IF',db[_0x886a('0x20')][_0x886a('0x23')](_0x886a('0x27')))),_0x886a('0x28')],[db[_0x886a('0x20')]['fn'](_0x886a('0x29'),db[_0x886a('0x20')]['fn']('IF',db[_0x886a('0x20')][_0x886a('0x23')](_0x886a('0x2a')))),_0x886a('0x2b')],[db[_0x886a('0x20')]['fn'](_0x886a('0x29'),db[_0x886a('0x20')]['fn']('IF',db[_0x886a('0x20')][_0x886a('0x23')]('`state`\x20=\x204,\x20`talktime`,\x20null'))),_0x886a('0x2c')]]})[_0x886a('0xc')](function(_0x1f7926){logger[_0x886a('0xd')]('AvgHandleTime',_0x531c82);logger[_0x886a('0x10')](_0x886a('0x1d'),_0x531c82,JSON[_0x886a('0x12')](_0x1f7926));_0x37d9e4(_0x1f7926);})[_0x886a('0x17')](function(_0xaa3bcc){logger['error'](_0x886a('0x1d'),_0xaa3bcc[_0x886a('0x15')],_0x531c82);_0x4d065f(_0x27ea6d[_0x886a('0x13')](0x1f4,_0xaa3bcc[_0x886a('0x15')]));});});};exports[_0x886a('0x2d')]=function(_0x468dfa){var _0xc6f581=this;return new Promise(function(_0x5da718,_0xf6b54d){return db[_0x886a('0x19')][_0x886a('0x1e')]({'raw':_0x468dfa[_0x886a('0x1b')]?_0x468dfa[_0x886a('0x1b')][_0x886a('0x1c')]===undefined?!![]:![]:!![],'where':_0x468dfa[_0x886a('0x1b')]?_0x468dfa[_0x886a('0x1b')][_0x886a('0x1f')]||null:null,'attributes':[[_0x886a('0x2e'),_0x886a('0x2f')],[db[_0x886a('0x20')]['fn']('COUNT',db[_0x886a('0x20')]['fn']('IF',db[_0x886a('0x20')]['literal'](_0x886a('0x30')))),_0x886a('0x31')],[db[_0x886a('0x20')]['fn'](_0x886a('0x21'),db[_0x886a('0x20')]['fn']('IF',db[_0x886a('0x20')][_0x886a('0x23')](_0x886a('0x32')))),_0x886a('0x33')],[db[_0x886a('0x20')]['fn'](_0x886a('0x21'),db[_0x886a('0x20')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x204,\x201,\x20null'))),_0x886a('0x34')],[db[_0x886a('0x20')]['fn'](_0x886a('0x21'),db[_0x886a('0x20')]['fn']('IF',db[_0x886a('0x20')][_0x886a('0x23')]('`state`\x20=\x205,\x201,\x20null'))),_0x886a('0x35')],[db[_0x886a('0x20')]['fn']('COUNT',db[_0x886a('0x20')]['fn']('IF',db[_0x886a('0x20')]['literal']('`state`\x20=\x208,\x201,\x20null'))),_0x886a('0x36')],[db['sequelize']['fn'](_0x886a('0x21'),db[_0x886a('0x20')]['fn']('IF',db[_0x886a('0x20')][_0x886a('0x23')](_0x886a('0x37')))),_0x886a('0x38')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x886a('0x20')][_0x886a('0x23')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x886a('0x39')],[db[_0x886a('0x20')]['fn']('COUNT',db[_0x886a('0x20')]['fn']('IF',db[_0x886a('0x20')]['literal'](_0x886a('0x3a')))),_0x886a('0x3b')],[db['sequelize']['fn'](_0x886a('0x21'),db['sequelize']['fn']('IF',db[_0x886a('0x20')]['literal'](_0x886a('0x3c')))),_0x886a('0x3d')],[db[_0x886a('0x20')]['fn'](_0x886a('0x21'),db[_0x886a('0x20')]['fn']('IF',db[_0x886a('0x20')]['literal'](_0x886a('0x3e')))),_0x886a('0x3f')],[db['sequelize']['fn'](_0x886a('0x21'),db[_0x886a('0x20')]['fn']('IF',db[_0x886a('0x20')][_0x886a('0x23')](_0x886a('0x40')))),_0x886a('0x41')],[db[_0x886a('0x20')]['fn']('COUNT',db[_0x886a('0x20')]['fn']('IF',db['sequelize'][_0x886a('0x23')]('`state`\x20=\x2016,\x201,\x20null'))),_0x886a('0x42')],[db[_0x886a('0x20')]['fn'](_0x886a('0x21'),db[_0x886a('0x20')]['fn']('IF',db[_0x886a('0x20')][_0x886a('0x23')](_0x886a('0x43')))),_0x886a('0x41')],[db[_0x886a('0x20')]['fn'](_0x886a('0x21'),db[_0x886a('0x20')]['fn']('IF',db[_0x886a('0x20')][_0x886a('0x23')]('`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null'))),'outboundReCallsDay']],'group':[_0x886a('0x2e')]})[_0x886a('0xc')](function(_0x443f76){logger['info'](_0x886a('0x2d'),_0x468dfa);logger['debug']('GetVoiceQueueHopperHistory',_0x468dfa,JSON[_0x886a('0x12')](_0x443f76));_0x5da718(_0x443f76);})[_0x886a('0x17')](function(_0x5ac7fb){logger[_0x886a('0x13')](_0x886a('0x2d'),_0x5ac7fb[_0x886a('0x15')],_0x468dfa);_0xf6b54d(_0xc6f581['error'](0x1f4,_0x5ac7fb[_0x886a('0x15')]));});});};exports['GetCampaignHopperHistory']=function(_0x5227dd){var _0x59d8e4=this;return new Promise(function(_0x55ce63,_0x5478e2){return db[_0x886a('0x19')][_0x886a('0x1e')]({'raw':_0x5227dd[_0x886a('0x1b')]?_0x5227dd[_0x886a('0x1b')][_0x886a('0x1c')]===undefined?!![]:![]:!![],'where':_0x5227dd[_0x886a('0x1b')]?_0x5227dd[_0x886a('0x1b')][_0x886a('0x1f')]||null:null,'attributes':[[_0x886a('0x2e'),_0x886a('0x2f')],[db[_0x886a('0x20')]['fn']('COUNT',db[_0x886a('0x20')][_0x886a('0x22')]('id')),'ivrTotalCallsDays'],[db[_0x886a('0x20')]['fn'](_0x886a('0x21'),db[_0x886a('0x20')]['fn']('IF',db[_0x886a('0x20')][_0x886a('0x23')](_0x886a('0x44')))),'ivrAnswerCallsDay']],'group':['campaign']})['then'](function(_0x1a7689){logger[_0x886a('0xd')](_0x886a('0x45'),_0x5227dd);logger[_0x886a('0x10')](_0x886a('0x45'),_0x5227dd,JSON[_0x886a('0x12')](_0x1a7689));_0x55ce63(_0x1a7689);})[_0x886a('0x17')](function(_0x4fd52d){logger[_0x886a('0x13')](_0x886a('0x45'),_0x4fd52d[_0x886a('0x15')],_0x5227dd);_0x5478e2(_0x59d8e4[_0x886a('0x13')](0x1f4,_0x4fd52d[_0x886a('0x15')]));});});}; \ No newline at end of file +var _0x2c59=['body','options','findAll','raw','where','sequelize','COUNT','col','predictiveIntervalTotalCalls','`state`\x20=\x204,\x201,\x20null','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','literal','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','AvgHandleTime','GetVoiceQueueHopperHistory','campaign','name','outboundNoSuchCallsDay','outboundNoAnswerCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`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','ivrTotalCallsDays','GetCampaignHopperHistory','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','debug','request\x20sent','stringify','code','error','CmHopperHistory,\x20%s,\x20%s','message','info','catch','CreateCmHopperHistory','CmHopperHistory'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2c59,0xb7));var _0x92c5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2c59[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x92c5('0x0'));var BPromise=require(_0x92c5('0x1'));var rs=require(_0x92c5('0x2'));var fs=require('fs');var Redis=require(_0x92c5('0x3'));var db=require(_0x92c5('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x92c5('0x5'))(_0x92c5('0x6'));var config=require(_0x92c5('0x7'));var jayson=require(_0x92c5('0x8'));var client=jayson[_0x92c5('0x9')][_0x92c5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x6fef34,_0x1bff7b,_0x20f742){return new BPromise(function(_0x14690e,_0x36079d){return client[_0x92c5('0xb')](_0x6fef34,_0x20f742)[_0x92c5('0xc')](function(_0x2fdb8b){logger['info']('CmHopperHistory,\x20%s,\x20%s',_0x1bff7b,'request\x20sent');logger[_0x92c5('0xd')]('CmHopperHistory,\x20%s,\x20%s,\x20%s',_0x1bff7b,_0x92c5('0xe'),JSON[_0x92c5('0xf')](_0x2fdb8b));if(_0x2fdb8b['error']){if(_0x2fdb8b['error'][_0x92c5('0x10')]===0x1f4){logger[_0x92c5('0x11')](_0x92c5('0x12'),_0x1bff7b,_0x2fdb8b['error'][_0x92c5('0x13')]);return _0x36079d(_0x2fdb8b[_0x92c5('0x11')][_0x92c5('0x13')]);}logger['error'](_0x92c5('0x12'),_0x1bff7b,_0x2fdb8b[_0x92c5('0x11')][_0x92c5('0x13')]);return _0x14690e(_0x2fdb8b[_0x92c5('0x11')][_0x92c5('0x13')]);}else{logger[_0x92c5('0x14')](_0x92c5('0x12'),_0x1bff7b,_0x92c5('0xe'));_0x14690e(_0x2fdb8b['result'][_0x92c5('0x13')]);}})[_0x92c5('0x15')](function(_0x4f14da){logger[_0x92c5('0x11')](_0x92c5('0x12'),_0x1bff7b,_0x4f14da);_0x36079d(_0x4f14da);});});}exports[_0x92c5('0x16')]=function(_0xb6a178){var _0x8a3e32=this;return new Promise(function(_0x2f2fdc,_0x171ce4){return db[_0x92c5('0x17')]['create'](_0xb6a178[_0x92c5('0x18')],{'raw':_0xb6a178['options']?_0xb6a178[_0x92c5('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x92c5('0xc')](function(_0x36a3f2){logger[_0x92c5('0x14')](_0x92c5('0x16'),_0xb6a178);logger['debug'](_0x92c5('0x16'),_0xb6a178,JSON[_0x92c5('0xf')](_0x36a3f2));_0x2f2fdc(_0x36a3f2);})[_0x92c5('0x15')](function(_0x16d8fd){logger['error'](_0x92c5('0x16'),_0x16d8fd[_0x92c5('0x13')],_0xb6a178);_0x171ce4(_0x8a3e32[_0x92c5('0x11')](0x1f4,_0x16d8fd[_0x92c5('0x13')]));});});};exports['AvgHandleTime']=function(_0x1e960f){var _0x49556d=this;return new Promise(function(_0x488c84,_0x32c9be){return db[_0x92c5('0x17')][_0x92c5('0x1a')]({'raw':_0x1e960f[_0x92c5('0x19')]?_0x1e960f[_0x92c5('0x19')][_0x92c5('0x1b')]===undefined?!![]:![]:!![],'where':_0x1e960f[_0x92c5('0x19')]?_0x1e960f[_0x92c5('0x19')][_0x92c5('0x1c')]||null:null,'attributes':[[db[_0x92c5('0x1d')]['fn'](_0x92c5('0x1e'),db[_0x92c5('0x1d')][_0x92c5('0x1f')]('id')),_0x92c5('0x20')],[db[_0x92c5('0x1d')]['fn'](_0x92c5('0x1e'),db[_0x92c5('0x1d')]['fn']('IF',db[_0x92c5('0x1d')]['literal'](_0x92c5('0x21')))),'predictiveIntervalAnsweredCalls'],[db[_0x92c5('0x1d')]['fn'](_0x92c5('0x1e'),db[_0x92c5('0x1d')]['fn']('IF',db[_0x92c5('0x1d')]['literal'](_0x92c5('0x22')))),_0x92c5('0x23')],[db['sequelize']['fn'](_0x92c5('0x1e'),db[_0x92c5('0x1d')]['fn']('IF',db[_0x92c5('0x1d')][_0x92c5('0x24')](_0x92c5('0x25')))),_0x92c5('0x26')],[db[_0x92c5('0x1d')]['fn'](_0x92c5('0x27'),db[_0x92c5('0x1d')]['fn']('IF',db[_0x92c5('0x1d')][_0x92c5('0x24')](_0x92c5('0x28')))),_0x92c5('0x29')],[db['sequelize']['fn'](_0x92c5('0x27'),db[_0x92c5('0x1d')]['fn']('IF',db[_0x92c5('0x1d')][_0x92c5('0x24')](_0x92c5('0x2a')))),_0x92c5('0x2b')]]})[_0x92c5('0xc')](function(_0x3459f6){logger[_0x92c5('0x14')](_0x92c5('0x2c'),_0x1e960f);logger[_0x92c5('0xd')]('AvgHandleTime',_0x1e960f,JSON[_0x92c5('0xf')](_0x3459f6));_0x488c84(_0x3459f6);})[_0x92c5('0x15')](function(_0x34df3d){logger['error'](_0x92c5('0x2c'),_0x34df3d[_0x92c5('0x13')],_0x1e960f);_0x32c9be(_0x49556d[_0x92c5('0x11')](0x1f4,_0x34df3d[_0x92c5('0x13')]));});});};exports[_0x92c5('0x2d')]=function(_0x3616a2){var _0xdfb763=this;return new Promise(function(_0x4322b3,_0x47c9a6){return db[_0x92c5('0x17')][_0x92c5('0x1a')]({'raw':_0x3616a2[_0x92c5('0x19')]?_0x3616a2['options'][_0x92c5('0x1b')]===undefined?!![]:![]:!![],'where':_0x3616a2[_0x92c5('0x19')]?_0x3616a2[_0x92c5('0x19')][_0x92c5('0x1c')]||null:null,'attributes':[[_0x92c5('0x2e'),_0x92c5('0x2f')],[db[_0x92c5('0x1d')]['fn'](_0x92c5('0x1e'),db[_0x92c5('0x1d')]['fn']('IF',db['sequelize'][_0x92c5('0x24')]('`state`\x20=\x200,\x201,\x20null'))),_0x92c5('0x30')],[db[_0x92c5('0x1d')]['fn'](_0x92c5('0x1e'),db[_0x92c5('0x1d')]['fn']('IF',db[_0x92c5('0x1d')][_0x92c5('0x24')]('`state`\x20=\x203,\x201,\x20null'))),_0x92c5('0x31')],[db['sequelize']['fn'](_0x92c5('0x1e'),db[_0x92c5('0x1d')]['fn']('IF',db['sequelize'][_0x92c5('0x24')]('`state`\x20=\x204,\x201,\x20null'))),_0x92c5('0x32')],[db[_0x92c5('0x1d')]['fn'](_0x92c5('0x1e'),db[_0x92c5('0x1d')]['fn']('IF',db[_0x92c5('0x1d')][_0x92c5('0x24')](_0x92c5('0x33')))),_0x92c5('0x34')],[db['sequelize']['fn'](_0x92c5('0x1e'),db[_0x92c5('0x1d')]['fn']('IF',db[_0x92c5('0x1d')][_0x92c5('0x24')](_0x92c5('0x35')))),'outboundCongestionCallsDay'],[db[_0x92c5('0x1d')]['fn'](_0x92c5('0x1e'),db['sequelize']['fn']('IF',db['sequelize'][_0x92c5('0x24')](_0x92c5('0x36')))),_0x92c5('0x37')],[db[_0x92c5('0x1d')]['fn'](_0x92c5('0x1e'),db[_0x92c5('0x1d')]['fn']('IF',db[_0x92c5('0x1d')][_0x92c5('0x24')](_0x92c5('0x38')))),'outboundDropCallsDayCallersExit'],[db[_0x92c5('0x1d')]['fn']('COUNT',db[_0x92c5('0x1d')]['fn']('IF',db[_0x92c5('0x1d')][_0x92c5('0x24')](_0x92c5('0x39')))),_0x92c5('0x3a')],[db[_0x92c5('0x1d')]['fn'](_0x92c5('0x1e'),db[_0x92c5('0x1d')]['fn']('IF',db[_0x92c5('0x1d')][_0x92c5('0x24')]('`state`\x20=\x2013,\x201,\x20null'))),'outboundBlacklistCallsDay'],[db['sequelize']['fn'](_0x92c5('0x1e'),db['sequelize']['fn']('IF',db[_0x92c5('0x1d')][_0x92c5('0x24')](_0x92c5('0x3b')))),_0x92c5('0x3c')],[db[_0x92c5('0x1d')]['fn'](_0x92c5('0x1e'),db[_0x92c5('0x1d')]['fn']('IF',db[_0x92c5('0x1d')][_0x92c5('0x24')](_0x92c5('0x3d')))),_0x92c5('0x3e')],[db[_0x92c5('0x1d')]['fn']('COUNT',db[_0x92c5('0x1d')]['fn']('IF',db['sequelize'][_0x92c5('0x24')](_0x92c5('0x3f')))),_0x92c5('0x40')],[db[_0x92c5('0x1d')]['fn'](_0x92c5('0x1e'),db[_0x92c5('0x1d')]['fn']('IF',db[_0x92c5('0x1d')][_0x92c5('0x24')]('`state`\x20=\x2020,\x201,\x20null'))),_0x92c5('0x3e')],[db[_0x92c5('0x1d')]['fn'](_0x92c5('0x1e'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0x92c5('0x41')))),_0x92c5('0x42')]],'group':['campaign']})['then'](function(_0x30f3d7){logger[_0x92c5('0x14')](_0x92c5('0x2d'),_0x3616a2);logger['debug']('GetVoiceQueueHopperHistory',_0x3616a2,JSON[_0x92c5('0xf')](_0x30f3d7));_0x4322b3(_0x30f3d7);})[_0x92c5('0x15')](function(_0x55650d){logger['error']('GetVoiceQueueHopperHistory',_0x55650d['message'],_0x3616a2);_0x47c9a6(_0xdfb763[_0x92c5('0x11')](0x1f4,_0x55650d[_0x92c5('0x13')]));});});};exports['GetCampaignHopperHistory']=function(_0x52cdc2){var _0x488b09=this;return new Promise(function(_0x40b248,_0x1b32ed){return db[_0x92c5('0x17')][_0x92c5('0x1a')]({'raw':_0x52cdc2[_0x92c5('0x19')]?_0x52cdc2[_0x92c5('0x19')][_0x92c5('0x1b')]===undefined?!![]:![]:!![],'where':_0x52cdc2[_0x92c5('0x19')]?_0x52cdc2['options'][_0x92c5('0x1c')]||null:null,'attributes':[[_0x92c5('0x2e'),_0x92c5('0x2f')],[db['sequelize']['fn'](_0x92c5('0x1e'),db[_0x92c5('0x1d')]['col']('id')),_0x92c5('0x43')],[db[_0x92c5('0x1d')]['fn'](_0x92c5('0x1e'),db[_0x92c5('0x1d')]['fn']('IF',db[_0x92c5('0x1d')][_0x92c5('0x24')](_0x92c5('0x21')))),'ivrAnswerCallsDay']],'group':[_0x92c5('0x2e')]})[_0x92c5('0xc')](function(_0x1ed295){logger['info'](_0x92c5('0x44'),_0x52cdc2);logger['debug'](_0x92c5('0x44'),_0x52cdc2,JSON[_0x92c5('0xf')](_0x1ed295));_0x40b248(_0x1ed295);})[_0x92c5('0x15')](function(_0xee5f93){logger[_0x92c5('0x11')]('GetCampaignHopperHistory',_0xee5f93[_0x92c5('0x13')],_0x52cdc2);_0x1b32ed(_0x488b09[_0x92c5('0x11')](0x1f4,_0xee5f93['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index fc341bb..0fd49d6 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 _0x1fe9=['post','create','update','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x307bf6,_0x55bdd5){var _0x2878fc=function(_0x4fa44f){while(--_0x4fa44f){_0x307bf6['push'](_0x307bf6['shift']());}};_0x2878fc(++_0x55bdd5);}(_0x1fe9,0x12f));var _0x91fe=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x1fe9[_0x4565bf];return _0x5610ba;};'use strict';var multer=require(_0x91fe('0x0'));var util=require(_0x91fe('0x1'));var path=require(_0x91fe('0x2'));var timeout=require(_0x91fe('0x3'));var express=require(_0x91fe('0x4'));var router=express[_0x91fe('0x5')]();var fs_extra=require(_0x91fe('0x6'));var auth=require(_0x91fe('0x7'));var interaction=require(_0x91fe('0x8'));var config=require(_0x91fe('0x9'));var controller=require(_0x91fe('0xa'));router[_0x91fe('0xb')]('/',auth[_0x91fe('0xc')](),controller[_0x91fe('0xd')]);router[_0x91fe('0xb')](_0x91fe('0xe'),auth['isAuthenticated'](),controller[_0x91fe('0xf')]);router[_0x91fe('0xb')](_0x91fe('0x10'),auth['isAuthenticated'](),controller['show']);router[_0x91fe('0x11')]('/',auth[_0x91fe('0xc')](),controller[_0x91fe('0x12')]);router['put'](_0x91fe('0x10'),auth['isAuthenticated'](),controller[_0x91fe('0x13')]);module['exports']=router; \ No newline at end of file +var _0xe19d=['create','put','update','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cmHopperHistory.controller','get','index','/describe','isAuthenticated','describe','/:id','show'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0xe19d,0x7b));var _0xde19=function(_0x5a148f,_0x114dfa){_0x5a148f=_0x5a148f-0x0;var _0x5af2d4=_0xe19d[_0x5a148f];return _0x5af2d4;};'use strict';var multer=require(_0xde19('0x0'));var util=require(_0xde19('0x1'));var path=require(_0xde19('0x2'));var timeout=require(_0xde19('0x3'));var express=require(_0xde19('0x4'));var router=express[_0xde19('0x5')]();var fs_extra=require(_0xde19('0x6'));var auth=require(_0xde19('0x7'));var interaction=require(_0xde19('0x8'));var config=require('../../config/environment');var controller=require(_0xde19('0x9'));router[_0xde19('0xa')]('/',auth['isAuthenticated'](),controller[_0xde19('0xb')]);router[_0xde19('0xa')](_0xde19('0xc'),auth[_0xde19('0xd')](),controller[_0xde19('0xe')]);router[_0xde19('0xa')](_0xde19('0xf'),auth[_0xde19('0xd')](),controller[_0xde19('0x10')]);router['post']('/',auth[_0xde19('0xd')](),controller[_0xde19('0x11')]);router[_0xde19('0x12')](_0xde19('0xf'),auth['isAuthenticated'](),controller[_0xde19('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index 414184b..e3ea5c3 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 _0x9ffd=['exports','STRING','name','sequelize'];(function(_0x56e4e7,_0x1db098){var _0x383618=function(_0xb088c6){while(--_0xb088c6){_0x56e4e7['push'](_0x56e4e7['shift']());}};_0x383618(++_0x1db098);}(_0x9ffd,0x1d7));var _0xd9ff=function(_0xf1660c,_0xbff978){_0xf1660c=_0xf1660c-0x0;var _0x522101=_0x9ffd[_0xf1660c];return _0x522101;};'use strict';var Sequelize=require(_0xd9ff('0x0'));module[_0xd9ff('0x1')]={'name':{'type':Sequelize[_0xd9ff('0x2')],'unique':_0xd9ff('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'dialPrefix':{'type':Sequelize[_0xd9ff('0x2')]}}; \ No newline at end of file +var _0xcabc=['STRING','name','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcabc,0x16a));var _0xccab=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xcabc[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require('sequelize');module[_0xccab('0x0')]={'name':{'type':Sequelize[_0xccab('0x1')],'unique':_0xccab('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xccab('0x1')]},'dialPrefix':{'type':Sequelize[_0xccab('0x1')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index 0c696e2..c328ab1 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 _0xbbbc=['Content-type','text/csv','download','/tmp/list_%d_%s.csv','addCustomField','transaction','addCustomFields','Sequelize','TEXT','text','number','switch','defaultValue','sequelize','queryInterface','cf_%s','getCustomFields','findAndCountAll','addAgents','omit','spread','emit','userCmList:save','userCmList:remove','getAgents','User','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','defaults','redis','localhost','./cmList.socket','sendStatus','status','end','offset','undefined','count','limit','Content-Range','apply','save','then','destroy','get','UserProfileResource','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','VIRTUAL','merge','CmList','include','findAll','rows','catch','show','params','includeAll','options','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Lists','UserProfileSection','find','userProfileId','autoAssociation','update','describe','addDisposition','Disposition','findOne','keys','order','ListId','filter','removeDispositions','addContacts','CmContact','tags','isArray','push','ids','success','errors','message','json','Malformed\x20request\x20syntax','getContacts','CustomFields','concat','format','cf_%d','raw','getContactsCsv','CmCustomField','isEmpty','now','writeFileSync','setHeader','attachment;\x20filename=','list_%d_%s.csv'];(function(_0x1c93ab,_0x180187){var _0x146856=function(_0x2e30eb){while(--_0x2e30eb){_0x1c93ab['push'](_0x1c93ab['shift']());}};_0x146856(++_0x180187);}(_0xbbbc,0xac));var _0xcbbb=function(_0x3a5bf9,_0x482667){_0x3a5bf9=_0x3a5bf9-0x0;var _0x2fbfb4=_0xbbbc[_0x3a5bf9];return _0x2fbfb4;};'use strict';var emlformat=require(_0xcbbb('0x0'));var rimraf=require(_0xcbbb('0x1'));var zipdir=require(_0xcbbb('0x2'));var jsonpatch=require(_0xcbbb('0x3'));var rp=require(_0xcbbb('0x4'));var moment=require(_0xcbbb('0x5'));var BPromise=require(_0xcbbb('0x6'));var Mustache=require(_0xcbbb('0x7'));var util=require(_0xcbbb('0x8'));var path=require('path');var sox=require(_0xcbbb('0x9'));var csv=require(_0xcbbb('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xcbbb('0xb'));var crypto=require(_0xcbbb('0xc'));var jsforce=require(_0xcbbb('0xd'));var deskjs=require(_0xcbbb('0xe'));var toCsv=require(_0xcbbb('0xa'));var querystring=require('querystring');var Papa=require(_0xcbbb('0xf'));var Redis=require(_0xcbbb('0x10'));var authService=require(_0xcbbb('0x11'));var qs=require(_0xcbbb('0x12'));var as=require(_0xcbbb('0x13'));var hardwareService=require(_0xcbbb('0x14'));var logger=require('../../config/logger')(_0xcbbb('0x15'));var utils=require(_0xcbbb('0x16'));var config=require(_0xcbbb('0x17'));var licenseUtil=require(_0xcbbb('0x18'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xcbbb('0x19')](config[_0xcbbb('0x1a')],{'host':_0xcbbb('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xcbbb('0x1c'))['register'](socket);function respondWithStatusCode(_0x465af4,_0x5c6ac3){_0x5c6ac3=_0x5c6ac3||0xcc;return function(_0x352c12){if(_0x352c12){return _0x465af4[_0xcbbb('0x1d')](_0x5c6ac3);}return _0x465af4[_0xcbbb('0x1e')](_0x5c6ac3)[_0xcbbb('0x1f')]();};}function respondWithResult(_0x5b5e01,_0x1b2c9c){_0x1b2c9c=_0x1b2c9c||0xc8;return function(_0x3983c4){if(_0x3983c4){return _0x5b5e01[_0xcbbb('0x1e')](_0x1b2c9c)['json'](_0x3983c4);}};}function respondWithFilteredResult(_0x4ac859,_0x357867){return function(_0x226616){if(_0x226616){var _0x433197=typeof _0x357867[_0xcbbb('0x20')]==='undefined'&&typeof _0x357867['limit']===_0xcbbb('0x21');var _0x48471d=_0x226616['count'];var _0x452d46=_0x433197?0x0:_0x357867[_0xcbbb('0x20')];var _0x95b130=_0x433197?_0x226616[_0xcbbb('0x22')]:_0x357867[_0xcbbb('0x20')]+_0x357867[_0xcbbb('0x23')];var _0x46ddbd;if(_0x95b130>=_0x48471d){_0x95b130=_0x48471d;_0x46ddbd=0xc8;}else{_0x46ddbd=0xce;}_0x4ac859[_0xcbbb('0x1e')](_0x46ddbd);return _0x4ac859['set'](_0xcbbb('0x24'),_0x452d46+'-'+_0x95b130+'/'+_0x48471d)['json'](_0x226616);}return null;};}function patchUpdates(_0x58b306){return function(_0x1dd008){try{jsonpatch[_0xcbbb('0x25')](_0x1dd008,_0x58b306,!![]);}catch(_0x4e5a91){return BPromise['reject'](_0x4e5a91);}return _0x1dd008[_0xcbbb('0x26')]();};}function saveUpdates(_0x1692a9,_0x1fdb82){return function(_0x5a3c80){if(_0x5a3c80){return _0x5a3c80['update'](_0x1692a9)[_0xcbbb('0x27')](function(_0xa1a74a){return _0xa1a74a;});}return null;};}function removeEntity(_0x5ac89c,_0x2f4048){return function(_0x5da953){if(_0x5da953){return _0x5da953[_0xcbbb('0x28')]()[_0xcbbb('0x27')](function(){var _0xa59caa=_0x5da953[_0xcbbb('0x29')]({'plain':!![]});var _0x2a3941='Lists';return db[_0xcbbb('0x2a')]['destroy']({'where':{'type':_0x2a3941,'resourceId':_0xa59caa['id']}})[_0xcbbb('0x27')](function(){return _0x5da953;});})[_0xcbbb('0x27')](function(){_0x5ac89c[_0xcbbb('0x1e')](0xcc)[_0xcbbb('0x1f')]();});}};}function handleEntityNotFound(_0x1d938f,_0x1a3ef9){return function(_0x20b09a){if(!_0x20b09a){_0x1d938f[_0xcbbb('0x1d')](0x194);}return _0x20b09a;};}function handleError(_0x470a88,_0x4572e2){_0x4572e2=_0x4572e2||0x1f4;return function(_0xed750e){logger[_0xcbbb('0x2b')](_0xed750e[_0xcbbb('0x2c')]);if(_0xed750e[_0xcbbb('0x2d')]){delete _0xed750e[_0xcbbb('0x2d')];}_0x470a88[_0xcbbb('0x1e')](_0x4572e2)[_0xcbbb('0x2e')](_0xed750e);};}exports[_0xcbbb('0x2f')]=function(_0x3d9747,_0x5aa8ae){var _0x4c34f0={},_0x3e25e6={},_0x44b00e={'count':0x0,'rows':[]};var _0x1a9960=_['map'](db['CmList'][_0xcbbb('0x30')],function(_0x1594d6){return{'name':_0x1594d6[_0xcbbb('0x31')],'type':_0x1594d6[_0xcbbb('0x32')][_0xcbbb('0x33')]};});_0x3e25e6[_0xcbbb('0x34')]=_[_0xcbbb('0x35')](_0x1a9960,_0xcbbb('0x2d'));_0x3e25e6[_0xcbbb('0x36')]=_['keys'](_0x3d9747[_0xcbbb('0x36')]);_0x3e25e6[_0xcbbb('0x37')]=_[_0xcbbb('0x38')](_0x3e25e6[_0xcbbb('0x34')],_0x3e25e6[_0xcbbb('0x36')]);_0x4c34f0['attributes']=_[_0xcbbb('0x38')](_0x3e25e6['model'],qs[_0xcbbb('0x39')](_0x3d9747[_0xcbbb('0x36')]['fields']));_0x4c34f0['attributes']=_0x4c34f0[_0xcbbb('0x3a')][_0xcbbb('0x3b')]?_0x4c34f0['attributes']:_0x3e25e6['model'];if(!_0x3d9747[_0xcbbb('0x36')][_0xcbbb('0x3c')](_0xcbbb('0x3d'))){_0x4c34f0['limit']=qs[_0xcbbb('0x23')](_0x3d9747[_0xcbbb('0x36')][_0xcbbb('0x23')]);_0x4c34f0[_0xcbbb('0x20')]=qs[_0xcbbb('0x20')](_0x3d9747['query'][_0xcbbb('0x20')]);}_0x4c34f0['order']=qs[_0xcbbb('0x3e')](_0x3d9747[_0xcbbb('0x36')][_0xcbbb('0x3e')]);_0x4c34f0[_0xcbbb('0x3f')]=qs['filters'](_[_0xcbbb('0x40')](_0x3d9747['query'],_0x3e25e6['filters']),_0x1a9960);if(_0x3d9747[_0xcbbb('0x36')]['filter']){_0x4c34f0['where']=_['merge'](_0x4c34f0['where'],{'$or':_[_0xcbbb('0x35')](_0x1a9960,function(_0x24bd38){if(_0x24bd38['type']!==_0xcbbb('0x41')){var _0x5d586b={};_0x5d586b[_0x24bd38['name']]={'$like':'%'+_0x3d9747['query']['filter']+'%'};return _0x5d586b;}})});}_0x4c34f0=_[_0xcbbb('0x42')]({},_0x4c34f0,_0x3d9747['options']);var _0x179aec={'where':_0x4c34f0['where']};return db[_0xcbbb('0x43')][_0xcbbb('0x22')](_0x179aec)[_0xcbbb('0x27')](function(_0x4ed4c4){_0x44b00e[_0xcbbb('0x22')]=_0x4ed4c4;if(_0x3d9747[_0xcbbb('0x36')]['includeAll']){_0x4c34f0[_0xcbbb('0x44')]=[{'all':!![]}];}return db[_0xcbbb('0x43')][_0xcbbb('0x45')](_0x4c34f0);})[_0xcbbb('0x27')](function(_0x25169c){_0x44b00e[_0xcbbb('0x46')]=_0x25169c;return _0x44b00e;})['then'](respondWithFilteredResult(_0x5aa8ae,_0x4c34f0))[_0xcbbb('0x47')](handleError(_0x5aa8ae,null));};exports[_0xcbbb('0x48')]=function(_0x1ec0ea,_0x3d696e){var _0xee9934={'raw':![],'where':{'id':_0x1ec0ea[_0xcbbb('0x49')]['id']}},_0x54dca1={};_0x54dca1[_0xcbbb('0x34')]=_['keys'](db[_0xcbbb('0x43')][_0xcbbb('0x30')]);_0x54dca1[_0xcbbb('0x36')]=_['keys'](_0x1ec0ea[_0xcbbb('0x36')]);_0x54dca1[_0xcbbb('0x37')]=_[_0xcbbb('0x38')](_0x54dca1['model'],_0x54dca1[_0xcbbb('0x36')]);_0xee9934['attributes']=_[_0xcbbb('0x38')](_0x54dca1[_0xcbbb('0x34')],qs[_0xcbbb('0x39')](_0x1ec0ea['query'][_0xcbbb('0x39')]));_0xee9934['attributes']=_0xee9934['attributes'][_0xcbbb('0x3b')]?_0xee9934[_0xcbbb('0x3a')]:_0x54dca1[_0xcbbb('0x34')];if(_0x1ec0ea[_0xcbbb('0x36')][_0xcbbb('0x4a')]){_0xee9934[_0xcbbb('0x44')]=[{'all':!![]}];}_0xee9934=_[_0xcbbb('0x42')]({},_0xee9934,_0x1ec0ea[_0xcbbb('0x4b')]);return db['CmList']['find'](_0xee9934)[_0xcbbb('0x27')](handleEntityNotFound(_0x3d696e,null))[_0xcbbb('0x27')](respondWithResult(_0x3d696e,null))[_0xcbbb('0x47')](handleError(_0x3d696e,null));};exports[_0xcbbb('0x4c')]=function(_0x29cd8f,_0x1b9a7f){return db[_0xcbbb('0x43')][_0xcbbb('0x4c')](_0x29cd8f[_0xcbbb('0x4d')],{})[_0xcbbb('0x27')](function(_0x1be44b){var _0x3f4e71=_0x29cd8f['user']['get']({'plain':!![]});if(!_0x3f4e71)throw new Error(_0xcbbb('0x4e'));if(_0x3f4e71[_0xcbbb('0x4f')]==='user'){var _0x25002d=_0x1be44b[_0xcbbb('0x29')]({'plain':!![]});var _0x1149b5=_0xcbbb('0x50');return db[_0xcbbb('0x51')][_0xcbbb('0x52')]({'where':{'name':_0x1149b5,'userProfileId':_0x3f4e71[_0xcbbb('0x53')]},'raw':!![]})[_0xcbbb('0x27')](function(_0xeb8f20){if(_0xeb8f20&&_0xeb8f20[_0xcbbb('0x54')]===0x0){return db['UserProfileResource'][_0xcbbb('0x4c')]({'name':_0x25002d[_0xcbbb('0x2d')],'resourceId':_0x25002d['id'],'type':_0xeb8f20[_0xcbbb('0x2d')],'sectionId':_0xeb8f20['id']},{})[_0xcbbb('0x27')](function(){return _0x1be44b;});}else{return _0x1be44b;}})[_0xcbbb('0x47')](function(_0x218063){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x218063);throw _0x218063;});}return _0x1be44b;})[_0xcbbb('0x27')](respondWithResult(_0x1b9a7f,0xc9))[_0xcbbb('0x47')](handleError(_0x1b9a7f,null));};exports[_0xcbbb('0x55')]=function(_0x3c2c92,_0xe10e51){if(_0x3c2c92[_0xcbbb('0x4d')]['id']){delete _0x3c2c92[_0xcbbb('0x4d')]['id'];}return db[_0xcbbb('0x43')][_0xcbbb('0x52')]({'where':{'id':_0x3c2c92[_0xcbbb('0x49')]['id']}})[_0xcbbb('0x27')](handleEntityNotFound(_0xe10e51,null))[_0xcbbb('0x27')](saveUpdates(_0x3c2c92['body'],null))[_0xcbbb('0x27')](respondWithResult(_0xe10e51,null))[_0xcbbb('0x47')](handleError(_0xe10e51,null));};exports[_0xcbbb('0x28')]=function(_0x108111,_0x571c1d){return db[_0xcbbb('0x43')][_0xcbbb('0x52')]({'where':{'id':_0x108111[_0xcbbb('0x49')]['id']}})[_0xcbbb('0x27')](handleEntityNotFound(_0x571c1d,null))[_0xcbbb('0x27')](removeEntity(_0x571c1d,null))[_0xcbbb('0x47')](handleError(_0x571c1d,null));};exports[_0xcbbb('0x56')]=function(_0x216589,_0x12782e){return db[_0xcbbb('0x43')][_0xcbbb('0x56')]()[_0xcbbb('0x27')](respondWithResult(_0x12782e,null))[_0xcbbb('0x47')](handleError(_0x12782e,null));};exports[_0xcbbb('0x57')]=function(_0x34db71,_0x5c7241,_0x3f7dc5){if(_0x34db71[_0xcbbb('0x4d')]['id']){delete _0x34db71[_0xcbbb('0x4d')]['id'];}return db['CmList'][_0xcbbb('0x52')]({'where':{'id':_0x34db71[_0xcbbb('0x49')]['id']}})[_0xcbbb('0x27')](handleEntityNotFound(_0x5c7241,null))[_0xcbbb('0x27')](function(_0x49e72e){if(_0x49e72e){_0x34db71[_0xcbbb('0x4d')]['ListId']=_0x49e72e['id'];return db[_0xcbbb('0x58')]['create'](_0x34db71['body']);}})[_0xcbbb('0x27')](respondWithResult(_0x5c7241,null))[_0xcbbb('0x47')](handleError(_0x5c7241,null));};exports['getDispositions']=function(_0x10682d,_0x29cc24,_0x37dd2a){var _0x599181={'raw':![],'where':{}};var _0x34939c={};var _0x21026e={'count':0x0,'rows':[]};return db[_0xcbbb('0x43')][_0xcbbb('0x59')]({'where':{'id':_0x10682d[_0xcbbb('0x49')]['id']}})['then'](handleEntityNotFound(_0x29cc24,null))[_0xcbbb('0x27')](function(_0x1ea286){if(_0x1ea286){_0x34939c[_0xcbbb('0x34')]=_['keys'](db[_0xcbbb('0x58')]['rawAttributes']);_0x34939c[_0xcbbb('0x36')]=_[_0xcbbb('0x5a')](_0x10682d['query']);_0x34939c[_0xcbbb('0x37')]=_[_0xcbbb('0x38')](_0x34939c[_0xcbbb('0x34')],_0x34939c[_0xcbbb('0x36')]);_0x599181[_0xcbbb('0x3a')]=_[_0xcbbb('0x38')](_0x34939c[_0xcbbb('0x34')],qs[_0xcbbb('0x39')](_0x10682d['query'][_0xcbbb('0x39')]));_0x599181[_0xcbbb('0x3a')]=_0x599181[_0xcbbb('0x3a')][_0xcbbb('0x3b')]?_0x599181[_0xcbbb('0x3a')]:_0x34939c[_0xcbbb('0x34')];if(!_0x10682d[_0xcbbb('0x36')][_0xcbbb('0x3c')](_0xcbbb('0x3d'))){_0x599181[_0xcbbb('0x23')]=qs[_0xcbbb('0x23')](_0x10682d[_0xcbbb('0x36')][_0xcbbb('0x23')]);_0x599181[_0xcbbb('0x20')]=qs[_0xcbbb('0x20')](_0x10682d[_0xcbbb('0x36')]['offset']);}_0x599181[_0xcbbb('0x5b')]=qs['sort'](_0x10682d[_0xcbbb('0x36')]['sort']);_0x599181['where']=qs[_0xcbbb('0x37')](_['pick'](_0x10682d[_0xcbbb('0x36')],_0x34939c[_0xcbbb('0x37')]));_0x599181[_0xcbbb('0x3f')][_0xcbbb('0x5c')]=_0x1ea286['id'];if(_0x10682d[_0xcbbb('0x36')]['filter']){_0x599181[_0xcbbb('0x3f')]=_[_0xcbbb('0x42')](_0x599181[_0xcbbb('0x3f')],{'$or':_[_0xcbbb('0x35')](_0x599181[_0xcbbb('0x3a')],function(_0x20c09c){var _0x239d7e={};_0x239d7e[_0x20c09c]={'$like':'%'+_0x10682d[_0xcbbb('0x36')][_0xcbbb('0x5d')]+'%'};return _0x239d7e;})});}_0x599181=_['merge']({},_0x599181,_0x10682d[_0xcbbb('0x4b')]);return db[_0xcbbb('0x58')][_0xcbbb('0x22')]({'where':_0x599181[_0xcbbb('0x3f')]})[_0xcbbb('0x27')](function(_0x410717){_0x21026e['count']=_0x410717;if(_0x10682d[_0xcbbb('0x36')][_0xcbbb('0x4a')]){_0x599181[_0xcbbb('0x44')]=[{'all':!![]}];}return db['Disposition'][_0xcbbb('0x45')](_0x599181);})[_0xcbbb('0x27')](function(_0x543260){_0x21026e[_0xcbbb('0x46')]=_0x543260;return _0x21026e;});}})['then'](respondWithFilteredResult(_0x29cc24,_0x599181))[_0xcbbb('0x47')](handleError(_0x29cc24,null));};exports[_0xcbbb('0x5e')]=function(_0x50df24,_0x17c0dc,_0x1ba2e0){return db[_0xcbbb('0x43')][_0xcbbb('0x52')]({'where':{'id':_0x50df24[_0xcbbb('0x49')]['id']}})[_0xcbbb('0x27')](handleEntityNotFound(_0x17c0dc,null))[_0xcbbb('0x27')](function(_0x2988ed){if(_0x2988ed){return _0x2988ed['removeDispositions'](_0x50df24[_0xcbbb('0x36')]['ids']);}})[_0xcbbb('0x27')](respondWithStatusCode(_0x17c0dc,null))[_0xcbbb('0x47')](handleError(_0x17c0dc,null));};exports[_0xcbbb('0x5f')]=function(_0x5eb3d0,_0x48c361,_0x4dd788){return db[_0xcbbb('0x43')][_0xcbbb('0x52')]({'where':{'id':_0x5eb3d0[_0xcbbb('0x49')]['id']}})['then'](handleEntityNotFound(_0x48c361,null))['then'](function(_0x4a753d){if(_0x4a753d){var _0x5d2947=[];var _0x2b9b98={'success':[],'errors':[]};return db[_0xcbbb('0x60')]['describe']()['then'](function(_0x2fdbed){if(_0x5eb3d0[_0xcbbb('0x4d')][_0xcbbb('0x61')]&&_[_0xcbbb('0x62')](_0x5eb3d0[_0xcbbb('0x4d')][_0xcbbb('0x61')])){if(_0x5eb3d0['body']['tags'][_0xcbbb('0x3b')]){_0x5eb3d0['body']['tags']=_0x5eb3d0['body'][_0xcbbb('0x61')]['join'](';')+';';}else{_0x5eb3d0[_0xcbbb('0x4d')][_0xcbbb('0x61')]=null;}}else{_0x5eb3d0[_0xcbbb('0x4d')]['tags']=null;}if(_0x5eb3d0[_0xcbbb('0x4d')]&&_[_0xcbbb('0x62')](_0x5eb3d0['body'])){for(var _0x28ad56=0x0;_0x28ad56<_0x5eb3d0[_0xcbbb('0x4d')]['length'];_0x28ad56+=0x1){_0x5eb3d0[_0xcbbb('0x4d')][_0x28ad56][_0xcbbb('0x5c')]=_0x5eb3d0[_0xcbbb('0x49')]['id'];_0x5d2947[_0xcbbb('0x63')](_0x5eb3d0[_0xcbbb('0x4d')][_0x28ad56]);}return BPromise['each'](_0x5d2947,function(_0x30d36f){return db['CmContact'][_0xcbbb('0x4c')](_['omit'](_0x30d36f,[_0xcbbb('0x64'),'id'])||{},{'fields':_[_0xcbbb('0x5a')](_0x2fdbed),'raw':!![]})[_0xcbbb('0x27')](function(_0x5a26c0){_0x2b9b98[_0xcbbb('0x65')][_0xcbbb('0x63')](_0x5a26c0['dataValues']);})['catch'](function(_0x4d0633){_0x2b9b98[_0xcbbb('0x66')]['push']({'data':_0x30d36f,'error':_0x4d0633[_0xcbbb('0x67')]});});})[_0xcbbb('0x27')](function(_0x318168){return _0x2b9b98;})[_0xcbbb('0x47')](function(_0x490466){return _0x490466;});}else{_0x48c361[_0xcbbb('0x1e')](0x190)[_0xcbbb('0x68')]({'message':_0xcbbb('0x69')});}});}})[_0xcbbb('0x27')](respondWithResult(_0x48c361,null))[_0xcbbb('0x47')](handleError(_0x48c361,null));};exports[_0xcbbb('0x6a')]=function(_0x2fe02b,_0x271621,_0x13e481){var _0xb77da9;return db['CmList'][_0xcbbb('0x52')]({'where':{'id':_0x2fe02b['params']['id']},'include':[{'model':db['CmCustomField'],'as':_0xcbbb('0x6b')}]})[_0xcbbb('0x27')](handleEntityNotFound(_0x271621,null))['then'](function(_0x472bf5){if(_0x472bf5){_0xb77da9=_0x472bf5;return db['CmContact'][_0xcbbb('0x30')];}})['then'](function(_0x3769fd){if(_0x3769fd){var _0x4fa64a={};var _0xa5ede9={};_0xa5ede9['model']=_[_0xcbbb('0x6c')](_[_0xcbbb('0x5a')](_0x3769fd),_[_0xcbbb('0x35')](_0xb77da9[_0xcbbb('0x6b')],function(_0x73c201){return util[_0xcbbb('0x6d')](_0xcbbb('0x6e'),_0x73c201['id']);}));_0xa5ede9['query']=_[_0xcbbb('0x5a')](_0x2fe02b[_0xcbbb('0x36')]);_0xa5ede9[_0xcbbb('0x37')]=_[_0xcbbb('0x38')](_0xa5ede9[_0xcbbb('0x34')],_0xa5ede9[_0xcbbb('0x36')]);_0x4fa64a[_0xcbbb('0x3a')]=_[_0xcbbb('0x38')](_0xa5ede9[_0xcbbb('0x34')],qs[_0xcbbb('0x39')](_0x2fe02b[_0xcbbb('0x36')][_0xcbbb('0x39')]));_0x4fa64a[_0xcbbb('0x3a')]=_0x4fa64a[_0xcbbb('0x3a')][_0xcbbb('0x3b')]?_0x4fa64a['attributes']:_0xa5ede9[_0xcbbb('0x34')];if(!_0x2fe02b[_0xcbbb('0x36')][_0xcbbb('0x3c')](_0xcbbb('0x3d'))){_0x4fa64a['limit']=qs[_0xcbbb('0x23')](_0x2fe02b['query'][_0xcbbb('0x23')]);_0x4fa64a[_0xcbbb('0x20')]=qs[_0xcbbb('0x20')](_0x2fe02b[_0xcbbb('0x36')][_0xcbbb('0x20')]);}_0x4fa64a[_0xcbbb('0x5b')]=qs['sort'](_0x2fe02b[_0xcbbb('0x36')][_0xcbbb('0x3e')]);_0x4fa64a[_0xcbbb('0x3f')]=qs[_0xcbbb('0x37')](_[_0xcbbb('0x40')](_0x2fe02b[_0xcbbb('0x36')],_0xa5ede9['filters']));_0x4fa64a[_0xcbbb('0x6f')]=!![];if(_0x2fe02b[_0xcbbb('0x36')][_0xcbbb('0x5d')]){_0x4fa64a[_0xcbbb('0x3f')]=_['merge'](_0x4fa64a[_0xcbbb('0x3f')],{'$or':_[_0xcbbb('0x35')](_0x4fa64a[_0xcbbb('0x3a')],function(_0x54ad1c){var _0x186364={};_0x186364[_0x54ad1c]={'$like':'%'+_0x2fe02b['query']['filter']+'%'};return _0x186364;})});}_0x4fa64a=_[_0xcbbb('0x42')]({},_0x4fa64a,_0x2fe02b[_0xcbbb('0x4b')]);return _0xb77da9[_0xcbbb('0x6a')](_0x4fa64a);}})[_0xcbbb('0x27')](respondWithResult(_0x271621,null))[_0xcbbb('0x47')](handleError(_0x271621,null));};exports[_0xcbbb('0x70')]=function(_0x4cc2aa,_0x1406eb,_0x399baf){var _0x9e4805;return db['CmList'][_0xcbbb('0x52')]({'where':{'id':_0x4cc2aa[_0xcbbb('0x49')]['id']},'include':[{'model':db[_0xcbbb('0x71')],'as':_0xcbbb('0x6b')}]})[_0xcbbb('0x27')](handleEntityNotFound(_0x1406eb,null))[_0xcbbb('0x27')](function(_0x337ce9){if(_0x337ce9){_0x9e4805=_0x337ce9;return db[_0xcbbb('0x60')][_0xcbbb('0x30')];}})[_0xcbbb('0x27')](function(_0x45e44f){if(_0x45e44f){var _0x5495ad={};var _0x2dcf1b={};_0x2dcf1b['model']=_[_0xcbbb('0x6c')](_[_0xcbbb('0x5a')](_0x45e44f),_[_0xcbbb('0x35')](_0x9e4805['CustomFields'],function(_0x5991ea){return util[_0xcbbb('0x6d')](_0xcbbb('0x6e'),_0x5991ea['id']);}));_0x2dcf1b[_0xcbbb('0x36')]=_[_0xcbbb('0x5a')](_0x4cc2aa['query']);_0x2dcf1b[_0xcbbb('0x37')]=_['intersection'](_0x2dcf1b['model'],_0x2dcf1b[_0xcbbb('0x36')]);_0x5495ad[_0xcbbb('0x3a')]=_['intersection'](_0x2dcf1b[_0xcbbb('0x34')],qs[_0xcbbb('0x39')](_0x4cc2aa[_0xcbbb('0x36')][_0xcbbb('0x39')]));_0x5495ad[_0xcbbb('0x3a')]=_0x5495ad['attributes'][_0xcbbb('0x3b')]?_0x5495ad[_0xcbbb('0x3a')]:_0x2dcf1b[_0xcbbb('0x34')];if(!_0x4cc2aa[_0xcbbb('0x36')][_0xcbbb('0x3c')](_0xcbbb('0x3d'))){_0x5495ad[_0xcbbb('0x23')]=qs[_0xcbbb('0x23')](_0x4cc2aa['query'][_0xcbbb('0x23')]);_0x5495ad[_0xcbbb('0x20')]=qs[_0xcbbb('0x20')](_0x4cc2aa['query'][_0xcbbb('0x20')]);}_0x5495ad[_0xcbbb('0x5b')]=qs[_0xcbbb('0x3e')](_0x4cc2aa[_0xcbbb('0x36')]['sort']);_0x5495ad[_0xcbbb('0x3f')]=qs['filters'](_[_0xcbbb('0x40')](_0x4cc2aa[_0xcbbb('0x36')],_0x2dcf1b[_0xcbbb('0x37')]));_0x5495ad[_0xcbbb('0x6f')]=!![];if(_0x4cc2aa['query'][_0xcbbb('0x5d')]){_0x5495ad[_0xcbbb('0x3f')]=_[_0xcbbb('0x42')](_0x5495ad[_0xcbbb('0x3f')],{'$or':_[_0xcbbb('0x35')](_0x5495ad['attributes'],function(_0x23a216){var _0x15f11f={};_0x15f11f[_0x23a216]={'$like':'%'+_0x4cc2aa[_0xcbbb('0x36')]['filter']+'%'};return _0x15f11f;})});}_0x5495ad=_['merge']({},_0x5495ad,_0x4cc2aa[_0xcbbb('0x4b')]);return _0x9e4805[_0xcbbb('0x6a')](_0x5495ad);}})[_0xcbbb('0x27')](function(_0x278305){if(!_[_0xcbbb('0x72')](_0x278305)){var _0x2a6ef3=toCsv(_0x278305);var _0x5cb11c=Date[_0xcbbb('0x73')]();fs[_0xcbbb('0x74')](util[_0xcbbb('0x6d')]('/tmp/list_%d_%s.csv',_0x9e4805['id'],_0x5cb11c),_0x2a6ef3);_0x1406eb[_0xcbbb('0x75')]('Content-disposition',_0xcbbb('0x76')+util['format'](_0xcbbb('0x77'),_0x9e4805['id'],_0x5cb11c));_0x1406eb[_0xcbbb('0x75')](_0xcbbb('0x78'),_0xcbbb('0x79'));return _0x1406eb[_0xcbbb('0x7a')](util['format'](_0xcbbb('0x7b'),_0x9e4805['id'],_0x5cb11c));}else{return _0x1406eb[_0xcbbb('0x1d')](0xcc);}})[_0xcbbb('0x47')](handleError(_0x1406eb,null));};exports[_0xcbbb('0x7c')]=function(_0x15acc0,_0x2f7d59,_0x1110e9){var _0x485d5f;delete _0x15acc0[_0xcbbb('0x4d')]['id'];return db[_0xcbbb('0x43')][_0xcbbb('0x59')]({'where':{'id':_0x15acc0['params']['id']}})['then'](handleEntityNotFound(_0x2f7d59,null))['then'](function(_0x2a8fe3){if(_0x2a8fe3){return db['sequelize'][_0xcbbb('0x7d')](function(_0x28967f){return db[_0xcbbb('0x71')][_0xcbbb('0x4c')](_0x15acc0[_0xcbbb('0x4d')],{'transaction':_0x28967f})[_0xcbbb('0x27')](function(_0x152693){_0x485d5f=_0x152693;return _0x2a8fe3[_0xcbbb('0x7e')](_0x152693,{'transaction':_0x28967f});})[_0xcbbb('0x27')](function(){var _0x40da2e={'type':db[_0xcbbb('0x7f')][_0xcbbb('0x80')],'transaction':_0x28967f};switch(_0x15acc0[_0xcbbb('0x4d')][_0xcbbb('0x32')]){case _0xcbbb('0x81'):_0x40da2e['type']=db[_0xcbbb('0x7f')][_0xcbbb('0x80')];break;case _0xcbbb('0x82'):_0x40da2e['type']=db['Sequelize']['INTEGER'];break;case _0xcbbb('0x83'):_0x40da2e[_0xcbbb('0x32')]=db['Sequelize']['BOOLEAN'];_0x40da2e[_0xcbbb('0x84')]=![];break;default:}return db[_0xcbbb('0x85')][_0xcbbb('0x86')]['addColumn']('cm_contacts',util['format'](_0xcbbb('0x87'),_0x485d5f['id']),_0x40da2e);})[_0xcbbb('0x27')](function(){return _0x485d5f;});});}})[_0xcbbb('0x27')](respondWithResult(_0x2f7d59,null))[_0xcbbb('0x47')](handleError(_0x2f7d59,null));};exports[_0xcbbb('0x88')]=function(_0x7f8ed8,_0x2a4c6c,_0x4332ec){var _0x19152d={};var _0x40a538={};var _0x2afc99;var _0x57a83a;return db[_0xcbbb('0x43')]['findOne']({'where':{'id':_0x7f8ed8['params']['id']}})[_0xcbbb('0x27')](handleEntityNotFound(_0x2a4c6c,null))[_0xcbbb('0x27')](function(_0x3258e8){if(_0x3258e8){_0x2afc99=_0x3258e8;_0x40a538[_0xcbbb('0x34')]=_['keys'](db['CmCustomField'][_0xcbbb('0x30')]);_0x40a538[_0xcbbb('0x36')]=_[_0xcbbb('0x5a')](_0x7f8ed8[_0xcbbb('0x36')]);_0x40a538['filters']=_['intersection'](_0x40a538[_0xcbbb('0x34')],_0x40a538[_0xcbbb('0x36')]);_0x19152d[_0xcbbb('0x3a')]=_[_0xcbbb('0x38')](_0x40a538[_0xcbbb('0x34')],qs[_0xcbbb('0x39')](_0x7f8ed8[_0xcbbb('0x36')][_0xcbbb('0x39')]));_0x19152d[_0xcbbb('0x3a')]=_0x19152d['attributes'][_0xcbbb('0x3b')]?_0x19152d[_0xcbbb('0x3a')]:_0x40a538['model'];_0x19152d['order']=qs[_0xcbbb('0x3e')](_0x7f8ed8[_0xcbbb('0x36')][_0xcbbb('0x3e')]);_0x19152d['where']=qs[_0xcbbb('0x37')](_[_0xcbbb('0x40')](_0x7f8ed8[_0xcbbb('0x36')],_0x40a538[_0xcbbb('0x37')]));_0x19152d[_0xcbbb('0x3f')]=_[_0xcbbb('0x42')](_0x19152d[_0xcbbb('0x3f')],{'$or':[{'ListId':_0x3258e8['id']},{'ListId':null}]});if(_0x7f8ed8[_0xcbbb('0x36')][_0xcbbb('0x5d')]){_0x19152d[_0xcbbb('0x3f')]=_[_0xcbbb('0x42')](_0x19152d[_0xcbbb('0x3f')],{'$or':_['map'](_0x19152d[_0xcbbb('0x3a')],function(_0xa229a6){var _0x5436c4={};_0x5436c4[_0xa229a6]={'$like':'%'+_0x7f8ed8[_0xcbbb('0x36')][_0xcbbb('0x5d')]+'%'};return _0x5436c4;})});}_0x19152d=_[_0xcbbb('0x42')]({},_0x19152d,_0x7f8ed8[_0xcbbb('0x4b')]);return db['CmCustomField'][_0xcbbb('0x89')](_0x19152d);}})[_0xcbbb('0x27')](respondWithResult(_0x2a4c6c,null))['catch'](handleError(_0x2a4c6c,null));};exports[_0xcbbb('0x8a')]=function(_0x341a0a,_0x45a1a1,_0x27b97e){return db['CmList'][_0xcbbb('0x52')]({'where':{'id':_0x341a0a[_0xcbbb('0x49')]['id']}})[_0xcbbb('0x27')](handleEntityNotFound(_0x45a1a1,null))[_0xcbbb('0x27')](function(_0x2fd6d2){if(_0x2fd6d2){return _0x2fd6d2[_0xcbbb('0x8a')](_0x341a0a[_0xcbbb('0x4d')][_0xcbbb('0x64')],_[_0xcbbb('0x8b')](_0x341a0a['body'],[_0xcbbb('0x64'),'id'])||{})[_0xcbbb('0x8c')](function(_0x5c3c19){for(var _0x1e95d9=0x0;_0x1e95d9<_0x341a0a[_0xcbbb('0x4d')]['ids'][_0xcbbb('0x3b')];_0x1e95d9+=0x1){socket[_0xcbbb('0x8d')](_0xcbbb('0x8e'),{'UserId':_0x341a0a[_0xcbbb('0x4d')][_0xcbbb('0x64')][_0x1e95d9],'CmListId':_0x341a0a['params']['id']});}return _0x5c3c19;});}})['then'](respondWithResult(_0x45a1a1,null))[_0xcbbb('0x47')](handleError(_0x45a1a1,null));};exports['removeAgents']=function(_0x3235cb,_0x55e1ea,_0x218ba1){return db['CmList'][_0xcbbb('0x52')]({'where':{'id':_0x3235cb[_0xcbbb('0x49')]['id']}})[_0xcbbb('0x27')](handleEntityNotFound(_0x55e1ea,null))['then'](function(_0x29155c){if(_0x29155c){return _0x29155c['removeAgents'](_0x3235cb[_0xcbbb('0x36')][_0xcbbb('0x64')])[_0xcbbb('0x27')](function(){if(_[_0xcbbb('0x62')](_0x3235cb[_0xcbbb('0x36')]['ids'])){for(var _0x3f122f=0x0;_0x3f122f<_0x3235cb[_0xcbbb('0x36')][_0xcbbb('0x64')]['length'];_0x3f122f+=0x1){socket[_0xcbbb('0x8d')](_0xcbbb('0x8f'),{'UserId':Number(_0x3235cb[_0xcbbb('0x36')]['ids'][_0x3f122f]),'CmListId':Number(_0x3235cb[_0xcbbb('0x49')]['id'])});}}else{socket[_0xcbbb('0x8d')](_0xcbbb('0x8f'),{'UserId':Number(_0x3235cb[_0xcbbb('0x36')][_0xcbbb('0x64')]),'CmListId':Number(_0x3235cb[_0xcbbb('0x49')]['id'])});}});}})[_0xcbbb('0x27')](respondWithStatusCode(_0x55e1ea,null))[_0xcbbb('0x47')](handleError(_0x55e1ea,null));};exports[_0xcbbb('0x90')]=function(_0x2ce28b,_0x1dcabb,_0x36853a){var _0x3ee718={};var _0x1c1eef={};var _0x250bfd;var _0x2fe7c7;return db[_0xcbbb('0x43')]['findOne']({'where':{'id':_0x2ce28b[_0xcbbb('0x49')]['id']}})[_0xcbbb('0x27')](handleEntityNotFound(_0x1dcabb,null))[_0xcbbb('0x27')](function(_0x249702){if(_0x249702){_0x250bfd=_0x249702;_0x1c1eef[_0xcbbb('0x34')]=_[_0xcbbb('0x5a')](db[_0xcbbb('0x91')]['rawAttributes']);_0x1c1eef[_0xcbbb('0x36')]=_[_0xcbbb('0x5a')](_0x2ce28b['query']);_0x1c1eef['filters']=_[_0xcbbb('0x38')](_0x1c1eef[_0xcbbb('0x34')],_0x1c1eef[_0xcbbb('0x36')]);_0x3ee718[_0xcbbb('0x3a')]=_[_0xcbbb('0x38')](_0x1c1eef['model'],qs['fields'](_0x2ce28b[_0xcbbb('0x36')]['fields']));_0x3ee718[_0xcbbb('0x3a')]=_0x3ee718[_0xcbbb('0x3a')][_0xcbbb('0x3b')]?_0x3ee718[_0xcbbb('0x3a')]:_0x1c1eef[_0xcbbb('0x34')];_0x3ee718[_0xcbbb('0x5b')]=qs['sort'](_0x2ce28b['query'][_0xcbbb('0x3e')]);_0x3ee718[_0xcbbb('0x3f')]=qs[_0xcbbb('0x37')](_[_0xcbbb('0x40')](_0x2ce28b['query'],_0x1c1eef[_0xcbbb('0x37')]));if(_0x2ce28b[_0xcbbb('0x36')]['filter']){_0x3ee718[_0xcbbb('0x3f')]=_['merge'](_0x3ee718[_0xcbbb('0x3f')],{'$or':_[_0xcbbb('0x35')](_0x3ee718[_0xcbbb('0x3a')],function(_0x1e2494){var _0x54c6e1={};_0x54c6e1[_0x1e2494]={'$like':'%'+_0x2ce28b[_0xcbbb('0x36')][_0xcbbb('0x5d')]+'%'};return _0x54c6e1;})});}_0x3ee718=_[_0xcbbb('0x42')]({},_0x3ee718,_0x2ce28b[_0xcbbb('0x4b')]);return _0x250bfd['getAgents'](_0x3ee718);}})[_0xcbbb('0x27')](function(_0x4249b7){if(_0x4249b7){_0x2fe7c7=_0x4249b7['length'];if(!_0x2ce28b[_0xcbbb('0x36')]['hasOwnProperty'](_0xcbbb('0x3d'))){_0x3ee718[_0xcbbb('0x23')]=qs[_0xcbbb('0x23')](_0x2ce28b['query']['limit']);_0x3ee718[_0xcbbb('0x20')]=qs['offset'](_0x2ce28b[_0xcbbb('0x36')]['offset']);}return _0x250bfd[_0xcbbb('0x90')](_0x3ee718);}})[_0xcbbb('0x27')](function(_0x4b7b33){if(_0x4b7b33){return _0x4b7b33?{'count':_0x2fe7c7,'rows':_0x4b7b33}:null;}})[_0xcbbb('0x27')](respondWithResult(_0x1dcabb,null))[_0xcbbb('0x47')](handleError(_0x1dcabb,null));}; \ No newline at end of file +var _0x347a=['/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','Content-type','text/csv','findOne','sequelize','transaction','addCustomFields','Sequelize','TEXT','text','number','INTEGER','switch','BOOLEAN','defaultValue','addColumn','cf_%s','getCustomFields','findAndCountAll','addAgents','spread','emit','userCmList:save','removeAgents','userCmList:remove','User','getAgents','eml-format','rimraf','fast-json-patch','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/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./cmList.socket','register','status','json','undefined','limit','count','Content-Range','apply','reject','save','update','destroy','get','Lists','then','end','sendStatus','stack','name','send','index','map','CmList','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','offset','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','rows','catch','show','params','length','options','find','create','body','user','role','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','ListId','getDispositions','Disposition','rawAttributes','removeDispositions','ids','addContacts','CmContact','tags','isArray','join','push','each','omit','success','dataValues','errors','message','Malformed\x20request\x20syntax','CmCustomField','concat','raw','getContactsCsv','CustomFields','format','cf_%d','getContacts','isEmpty','now'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x347a,0x153));var _0xa347=function(_0x24ffa5,_0x119b94){_0x24ffa5=_0x24ffa5-0x0;var _0x1f0a5f=_0x347a[_0x24ffa5];return _0x1f0a5f;};'use strict';var emlformat=require(_0xa347('0x0'));var rimraf=require(_0xa347('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa347('0x2'));var rp=require('request-promise');var moment=require(_0xa347('0x3'));var BPromise=require(_0xa347('0x4'));var Mustache=require(_0xa347('0x5'));var util=require(_0xa347('0x6'));var path=require(_0xa347('0x7'));var sox=require(_0xa347('0x8'));var csv=require(_0xa347('0x9'));var ejs=require(_0xa347('0xa'));var fs=require('fs');var fs_extra=require(_0xa347('0xb'));var _=require(_0xa347('0xc'));var squel=require(_0xa347('0xd'));var crypto=require(_0xa347('0xe'));var jsforce=require(_0xa347('0xf'));var deskjs=require(_0xa347('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xa347('0x11'));var Redis=require(_0xa347('0x12'));var authService=require(_0xa347('0x13'));var qs=require(_0xa347('0x14'));var as=require(_0xa347('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa347('0x16'))(_0xa347('0x17'));var utils=require(_0xa347('0x18'));var config=require(_0xa347('0x19'));var licenseUtil=require(_0xa347('0x1a'));var db=require(_0xa347('0x1b'))['db'];config[_0xa347('0x1c')]=_[_0xa347('0x1d')](config[_0xa347('0x1c')],{'host':'localhost','port':0x18eb});var socket=require(_0xa347('0x1e'))(new Redis(config[_0xa347('0x1c')]));require(_0xa347('0x1f'))[_0xa347('0x20')](socket);function respondWithStatusCode(_0x741cad,_0x2e56c0){_0x2e56c0=_0x2e56c0||0xcc;return function(_0xd0d95f){if(_0xd0d95f){return _0x741cad['sendStatus'](_0x2e56c0);}return _0x741cad[_0xa347('0x21')](_0x2e56c0)['end']();};}function respondWithResult(_0x4eb673,_0x3eb6f4){_0x3eb6f4=_0x3eb6f4||0xc8;return function(_0x5957ba){if(_0x5957ba){return _0x4eb673[_0xa347('0x21')](_0x3eb6f4)[_0xa347('0x22')](_0x5957ba);}};}function respondWithFilteredResult(_0x23049a,_0x18d3b3){return function(_0x581d3c){if(_0x581d3c){var _0x11e5d5=typeof _0x18d3b3['offset']===_0xa347('0x23')&&typeof _0x18d3b3[_0xa347('0x24')]===_0xa347('0x23');var _0x2dcaa0=_0x581d3c[_0xa347('0x25')];var _0x2dcd1c=_0x11e5d5?0x0:_0x18d3b3['offset'];var _0xf8334=_0x11e5d5?_0x581d3c[_0xa347('0x25')]:_0x18d3b3['offset']+_0x18d3b3[_0xa347('0x24')];var _0x193772;if(_0xf8334>=_0x2dcaa0){_0xf8334=_0x2dcaa0;_0x193772=0xc8;}else{_0x193772=0xce;}_0x23049a[_0xa347('0x21')](_0x193772);return _0x23049a['set'](_0xa347('0x26'),_0x2dcd1c+'-'+_0xf8334+'/'+_0x2dcaa0)[_0xa347('0x22')](_0x581d3c);}return null;};}function patchUpdates(_0x4ffd0e){return function(_0x2a8e39){try{jsonpatch[_0xa347('0x27')](_0x2a8e39,_0x4ffd0e,!![]);}catch(_0x5e6f26){return BPromise[_0xa347('0x28')](_0x5e6f26);}return _0x2a8e39[_0xa347('0x29')]();};}function saveUpdates(_0x1d2ce3,_0x32f8c3){return function(_0x1fc173){if(_0x1fc173){return _0x1fc173[_0xa347('0x2a')](_0x1d2ce3)['then'](function(_0x162837){return _0x162837;});}return null;};}function removeEntity(_0x46d2de,_0x481c18){return function(_0x484c77){if(_0x484c77){return _0x484c77[_0xa347('0x2b')]()['then'](function(){var _0x359d56=_0x484c77[_0xa347('0x2c')]({'plain':!![]});var _0xf4318e=_0xa347('0x2d');return db['UserProfileResource'][_0xa347('0x2b')]({'where':{'type':_0xf4318e,'resourceId':_0x359d56['id']}})['then'](function(){return _0x484c77;});})[_0xa347('0x2e')](function(){_0x46d2de[_0xa347('0x21')](0xcc)[_0xa347('0x2f')]();});}};}function handleEntityNotFound(_0x1f80d5,_0x320944){return function(_0x180dfb){if(!_0x180dfb){_0x1f80d5[_0xa347('0x30')](0x194);}return _0x180dfb;};}function handleError(_0x4315ba,_0x2cbaf0){_0x2cbaf0=_0x2cbaf0||0x1f4;return function(_0x54fcf2){logger['error'](_0x54fcf2[_0xa347('0x31')]);if(_0x54fcf2['name']){delete _0x54fcf2[_0xa347('0x32')];}_0x4315ba[_0xa347('0x21')](_0x2cbaf0)[_0xa347('0x33')](_0x54fcf2);};}exports[_0xa347('0x34')]=function(_0xb331b7,_0x1d902c){var _0x318133={},_0x28fe41={},_0x516da4={'count':0x0,'rows':[]};var _0x496927=_[_0xa347('0x35')](db[_0xa347('0x36')]['rawAttributes'],function(_0x4b00d9){return{'name':_0x4b00d9[_0xa347('0x37')],'type':_0x4b00d9[_0xa347('0x38')]['key']};});_0x28fe41[_0xa347('0x39')]=_['map'](_0x496927,_0xa347('0x32'));_0x28fe41[_0xa347('0x3a')]=_[_0xa347('0x3b')](_0xb331b7[_0xa347('0x3a')]);_0x28fe41[_0xa347('0x3c')]=_[_0xa347('0x3d')](_0x28fe41['model'],_0x28fe41[_0xa347('0x3a')]);_0x318133[_0xa347('0x3e')]=_[_0xa347('0x3d')](_0x28fe41[_0xa347('0x39')],qs['fields'](_0xb331b7[_0xa347('0x3a')][_0xa347('0x3f')]));_0x318133[_0xa347('0x3e')]=_0x318133[_0xa347('0x3e')]['length']?_0x318133['attributes']:_0x28fe41[_0xa347('0x39')];if(!_0xb331b7['query'][_0xa347('0x40')](_0xa347('0x41'))){_0x318133[_0xa347('0x24')]=qs['limit'](_0xb331b7['query'][_0xa347('0x24')]);_0x318133[_0xa347('0x42')]=qs[_0xa347('0x42')](_0xb331b7[_0xa347('0x3a')][_0xa347('0x42')]);}_0x318133[_0xa347('0x43')]=qs[_0xa347('0x44')](_0xb331b7[_0xa347('0x3a')][_0xa347('0x44')]);_0x318133[_0xa347('0x45')]=qs[_0xa347('0x3c')](_[_0xa347('0x46')](_0xb331b7[_0xa347('0x3a')],_0x28fe41['filters']),_0x496927);if(_0xb331b7[_0xa347('0x3a')][_0xa347('0x47')]){_0x318133[_0xa347('0x45')]=_['merge'](_0x318133[_0xa347('0x45')],{'$or':_['map'](_0x496927,function(_0x2bfc7b){if(_0x2bfc7b[_0xa347('0x38')]!==_0xa347('0x48')){var _0x58b9c6={};_0x58b9c6[_0x2bfc7b[_0xa347('0x32')]]={'$like':'%'+_0xb331b7['query'][_0xa347('0x47')]+'%'};return _0x58b9c6;}})});}_0x318133=_[_0xa347('0x49')]({},_0x318133,_0xb331b7['options']);var _0x29146a={'where':_0x318133[_0xa347('0x45')]};return db[_0xa347('0x36')][_0xa347('0x25')](_0x29146a)[_0xa347('0x2e')](function(_0x4e58fb){_0x516da4[_0xa347('0x25')]=_0x4e58fb;if(_0xb331b7[_0xa347('0x3a')][_0xa347('0x4a')]){_0x318133[_0xa347('0x4b')]=[{'all':!![]}];}return db[_0xa347('0x36')]['findAll'](_0x318133);})['then'](function(_0x4a39ba){_0x516da4[_0xa347('0x4c')]=_0x4a39ba;return _0x516da4;})[_0xa347('0x2e')](respondWithFilteredResult(_0x1d902c,_0x318133))[_0xa347('0x4d')](handleError(_0x1d902c,null));};exports[_0xa347('0x4e')]=function(_0x4b6e9b,_0x1c91e9){var _0x5c29c5={'raw':![],'where':{'id':_0x4b6e9b[_0xa347('0x4f')]['id']}},_0x2a4267={};_0x2a4267[_0xa347('0x39')]=_[_0xa347('0x3b')](db[_0xa347('0x36')]['rawAttributes']);_0x2a4267[_0xa347('0x3a')]=_[_0xa347('0x3b')](_0x4b6e9b['query']);_0x2a4267[_0xa347('0x3c')]=_[_0xa347('0x3d')](_0x2a4267[_0xa347('0x39')],_0x2a4267[_0xa347('0x3a')]);_0x5c29c5[_0xa347('0x3e')]=_[_0xa347('0x3d')](_0x2a4267[_0xa347('0x39')],qs['fields'](_0x4b6e9b[_0xa347('0x3a')]['fields']));_0x5c29c5[_0xa347('0x3e')]=_0x5c29c5[_0xa347('0x3e')][_0xa347('0x50')]?_0x5c29c5[_0xa347('0x3e')]:_0x2a4267[_0xa347('0x39')];if(_0x4b6e9b[_0xa347('0x3a')][_0xa347('0x4a')]){_0x5c29c5[_0xa347('0x4b')]=[{'all':!![]}];}_0x5c29c5=_[_0xa347('0x49')]({},_0x5c29c5,_0x4b6e9b[_0xa347('0x51')]);return db[_0xa347('0x36')][_0xa347('0x52')](_0x5c29c5)['then'](handleEntityNotFound(_0x1c91e9,null))[_0xa347('0x2e')](respondWithResult(_0x1c91e9,null))[_0xa347('0x4d')](handleError(_0x1c91e9,null));};exports[_0xa347('0x53')]=function(_0x279ab7,_0x4222bd){return db[_0xa347('0x36')][_0xa347('0x53')](_0x279ab7[_0xa347('0x54')],{})[_0xa347('0x2e')](function(_0x484109){var _0x26dcca=_0x279ab7[_0xa347('0x55')][_0xa347('0x2c')]({'plain':!![]});if(!_0x26dcca)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x26dcca[_0xa347('0x56')]===_0xa347('0x55')){var _0x5024a3=_0x484109['get']({'plain':!![]});var _0x258c92=_0xa347('0x2d');return db['UserProfileSection'][_0xa347('0x52')]({'where':{'name':_0x258c92,'userProfileId':_0x26dcca[_0xa347('0x57')]},'raw':!![]})[_0xa347('0x2e')](function(_0x29930b){if(_0x29930b&&_0x29930b[_0xa347('0x58')]===0x0){return db[_0xa347('0x59')][_0xa347('0x53')]({'name':_0x5024a3[_0xa347('0x32')],'resourceId':_0x5024a3['id'],'type':_0x29930b[_0xa347('0x32')],'sectionId':_0x29930b['id']},{})[_0xa347('0x2e')](function(){return _0x484109;});}else{return _0x484109;}})['catch'](function(_0x4af5ec){logger[_0xa347('0x5a')](_0xa347('0x5b'),_0x4af5ec);throw _0x4af5ec;});}return _0x484109;})[_0xa347('0x2e')](respondWithResult(_0x4222bd,0xc9))[_0xa347('0x4d')](handleError(_0x4222bd,null));};exports[_0xa347('0x2a')]=function(_0x9c7325,_0xe1c713){if(_0x9c7325[_0xa347('0x54')]['id']){delete _0x9c7325['body']['id'];}return db[_0xa347('0x36')]['find']({'where':{'id':_0x9c7325['params']['id']}})[_0xa347('0x2e')](handleEntityNotFound(_0xe1c713,null))[_0xa347('0x2e')](saveUpdates(_0x9c7325['body'],null))[_0xa347('0x2e')](respondWithResult(_0xe1c713,null))[_0xa347('0x4d')](handleError(_0xe1c713,null));};exports['destroy']=function(_0x4b7643,_0x3a3d98){return db[_0xa347('0x36')]['find']({'where':{'id':_0x4b7643[_0xa347('0x4f')]['id']}})[_0xa347('0x2e')](handleEntityNotFound(_0x3a3d98,null))['then'](removeEntity(_0x3a3d98,null))['catch'](handleError(_0x3a3d98,null));};exports[_0xa347('0x5c')]=function(_0x84940,_0x1b96e8){return db[_0xa347('0x36')]['describe']()[_0xa347('0x2e')](respondWithResult(_0x1b96e8,null))[_0xa347('0x4d')](handleError(_0x1b96e8,null));};exports[_0xa347('0x5d')]=function(_0x3edc85,_0x595ed5,_0x2435e5){if(_0x3edc85[_0xa347('0x54')]['id']){delete _0x3edc85[_0xa347('0x54')]['id'];}return db[_0xa347('0x36')]['find']({'where':{'id':_0x3edc85[_0xa347('0x4f')]['id']}})['then'](handleEntityNotFound(_0x595ed5,null))[_0xa347('0x2e')](function(_0x141302){if(_0x141302){_0x3edc85[_0xa347('0x54')][_0xa347('0x5e')]=_0x141302['id'];return db['Disposition'][_0xa347('0x53')](_0x3edc85[_0xa347('0x54')]);}})[_0xa347('0x2e')](respondWithResult(_0x595ed5,null))[_0xa347('0x4d')](handleError(_0x595ed5,null));};exports[_0xa347('0x5f')]=function(_0x492f63,_0x279f66,_0x8625ad){var _0x452c82={'raw':![],'where':{}};var _0x56389c={};var _0x2d9660={'count':0x0,'rows':[]};return db[_0xa347('0x36')]['findOne']({'where':{'id':_0x492f63[_0xa347('0x4f')]['id']}})['then'](handleEntityNotFound(_0x279f66,null))[_0xa347('0x2e')](function(_0x56ab55){if(_0x56ab55){_0x56389c['model']=_[_0xa347('0x3b')](db[_0xa347('0x60')][_0xa347('0x61')]);_0x56389c[_0xa347('0x3a')]=_[_0xa347('0x3b')](_0x492f63[_0xa347('0x3a')]);_0x56389c['filters']=_[_0xa347('0x3d')](_0x56389c[_0xa347('0x39')],_0x56389c[_0xa347('0x3a')]);_0x452c82[_0xa347('0x3e')]=_[_0xa347('0x3d')](_0x56389c['model'],qs[_0xa347('0x3f')](_0x492f63['query']['fields']));_0x452c82[_0xa347('0x3e')]=_0x452c82[_0xa347('0x3e')][_0xa347('0x50')]?_0x452c82[_0xa347('0x3e')]:_0x56389c[_0xa347('0x39')];if(!_0x492f63[_0xa347('0x3a')][_0xa347('0x40')](_0xa347('0x41'))){_0x452c82[_0xa347('0x24')]=qs[_0xa347('0x24')](_0x492f63[_0xa347('0x3a')][_0xa347('0x24')]);_0x452c82[_0xa347('0x42')]=qs[_0xa347('0x42')](_0x492f63[_0xa347('0x3a')]['offset']);}_0x452c82[_0xa347('0x43')]=qs[_0xa347('0x44')](_0x492f63['query'][_0xa347('0x44')]);_0x452c82[_0xa347('0x45')]=qs[_0xa347('0x3c')](_[_0xa347('0x46')](_0x492f63['query'],_0x56389c['filters']));_0x452c82[_0xa347('0x45')][_0xa347('0x5e')]=_0x56ab55['id'];if(_0x492f63['query'][_0xa347('0x47')]){_0x452c82[_0xa347('0x45')]=_[_0xa347('0x49')](_0x452c82[_0xa347('0x45')],{'$or':_[_0xa347('0x35')](_0x452c82[_0xa347('0x3e')],function(_0x5a038e){var _0x4674b3={};_0x4674b3[_0x5a038e]={'$like':'%'+_0x492f63['query'][_0xa347('0x47')]+'%'};return _0x4674b3;})});}_0x452c82=_[_0xa347('0x49')]({},_0x452c82,_0x492f63[_0xa347('0x51')]);return db[_0xa347('0x60')][_0xa347('0x25')]({'where':_0x452c82[_0xa347('0x45')]})[_0xa347('0x2e')](function(_0x3de8eb){_0x2d9660[_0xa347('0x25')]=_0x3de8eb;if(_0x492f63['query'][_0xa347('0x4a')]){_0x452c82[_0xa347('0x4b')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0x452c82);})[_0xa347('0x2e')](function(_0x3648bc){_0x2d9660[_0xa347('0x4c')]=_0x3648bc;return _0x2d9660;});}})[_0xa347('0x2e')](respondWithFilteredResult(_0x279f66,_0x452c82))['catch'](handleError(_0x279f66,null));};exports['removeDispositions']=function(_0x3d44f7,_0x224678,_0x378411){return db[_0xa347('0x36')]['find']({'where':{'id':_0x3d44f7[_0xa347('0x4f')]['id']}})[_0xa347('0x2e')](handleEntityNotFound(_0x224678,null))['then'](function(_0x2f48cb){if(_0x2f48cb){return _0x2f48cb[_0xa347('0x62')](_0x3d44f7[_0xa347('0x3a')][_0xa347('0x63')]);}})[_0xa347('0x2e')](respondWithStatusCode(_0x224678,null))[_0xa347('0x4d')](handleError(_0x224678,null));};exports[_0xa347('0x64')]=function(_0x30f66f,_0x5391ba,_0x2537f9){return db[_0xa347('0x36')][_0xa347('0x52')]({'where':{'id':_0x30f66f[_0xa347('0x4f')]['id']}})[_0xa347('0x2e')](handleEntityNotFound(_0x5391ba,null))[_0xa347('0x2e')](function(_0xb6c26d){if(_0xb6c26d){var _0xd51d2f=[];var _0x6fb4c0={'success':[],'errors':[]};return db[_0xa347('0x65')][_0xa347('0x5c')]()[_0xa347('0x2e')](function(_0x49c070){if(_0x30f66f[_0xa347('0x54')][_0xa347('0x66')]&&_[_0xa347('0x67')](_0x30f66f[_0xa347('0x54')]['tags'])){if(_0x30f66f[_0xa347('0x54')][_0xa347('0x66')][_0xa347('0x50')]){_0x30f66f[_0xa347('0x54')][_0xa347('0x66')]=_0x30f66f[_0xa347('0x54')][_0xa347('0x66')][_0xa347('0x68')](';')+';';}else{_0x30f66f[_0xa347('0x54')][_0xa347('0x66')]=null;}}else{_0x30f66f['body'][_0xa347('0x66')]=null;}if(_0x30f66f[_0xa347('0x54')]&&_[_0xa347('0x67')](_0x30f66f[_0xa347('0x54')])){for(var _0x117218=0x0;_0x117218<_0x30f66f['body'][_0xa347('0x50')];_0x117218+=0x1){_0x30f66f[_0xa347('0x54')][_0x117218]['ListId']=_0x30f66f['params']['id'];_0xd51d2f[_0xa347('0x69')](_0x30f66f[_0xa347('0x54')][_0x117218]);}return BPromise[_0xa347('0x6a')](_0xd51d2f,function(_0x57fb49){return db[_0xa347('0x65')][_0xa347('0x53')](_[_0xa347('0x6b')](_0x57fb49,[_0xa347('0x63'),'id'])||{},{'fields':_[_0xa347('0x3b')](_0x49c070),'raw':!![]})[_0xa347('0x2e')](function(_0x38412c){_0x6fb4c0[_0xa347('0x6c')][_0xa347('0x69')](_0x38412c[_0xa347('0x6d')]);})['catch'](function(_0x3b9002){_0x6fb4c0[_0xa347('0x6e')][_0xa347('0x69')]({'data':_0x57fb49,'error':_0x3b9002[_0xa347('0x6f')]});});})[_0xa347('0x2e')](function(_0xe68965){return _0x6fb4c0;})['catch'](function(_0xddd22e){return _0xddd22e;});}else{_0x5391ba['status'](0x190)[_0xa347('0x22')]({'message':_0xa347('0x70')});}});}})[_0xa347('0x2e')](respondWithResult(_0x5391ba,null))[_0xa347('0x4d')](handleError(_0x5391ba,null));};exports['getContacts']=function(_0x129f0a,_0x566895,_0xed1d4c){var _0xe6baf2;return db['CmList'][_0xa347('0x52')]({'where':{'id':_0x129f0a[_0xa347('0x4f')]['id']},'include':[{'model':db[_0xa347('0x71')],'as':'CustomFields'}]})[_0xa347('0x2e')](handleEntityNotFound(_0x566895,null))[_0xa347('0x2e')](function(_0x1996fd){if(_0x1996fd){_0xe6baf2=_0x1996fd;return db['CmContact'][_0xa347('0x61')];}})[_0xa347('0x2e')](function(_0x116712){if(_0x116712){var _0x4b81f4={};var _0x2e092d={};_0x2e092d[_0xa347('0x39')]=_[_0xa347('0x72')](_[_0xa347('0x3b')](_0x116712),_[_0xa347('0x35')](_0xe6baf2['CustomFields'],function(_0x1fc8ed){return util['format']('cf_%d',_0x1fc8ed['id']);}));_0x2e092d[_0xa347('0x3a')]=_[_0xa347('0x3b')](_0x129f0a[_0xa347('0x3a')]);_0x2e092d['filters']=_['intersection'](_0x2e092d['model'],_0x2e092d[_0xa347('0x3a')]);_0x4b81f4[_0xa347('0x3e')]=_['intersection'](_0x2e092d[_0xa347('0x39')],qs['fields'](_0x129f0a[_0xa347('0x3a')]['fields']));_0x4b81f4[_0xa347('0x3e')]=_0x4b81f4['attributes'][_0xa347('0x50')]?_0x4b81f4[_0xa347('0x3e')]:_0x2e092d['model'];if(!_0x129f0a[_0xa347('0x3a')][_0xa347('0x40')](_0xa347('0x41'))){_0x4b81f4[_0xa347('0x24')]=qs[_0xa347('0x24')](_0x129f0a[_0xa347('0x3a')]['limit']);_0x4b81f4[_0xa347('0x42')]=qs[_0xa347('0x42')](_0x129f0a[_0xa347('0x3a')][_0xa347('0x42')]);}_0x4b81f4[_0xa347('0x43')]=qs[_0xa347('0x44')](_0x129f0a['query'][_0xa347('0x44')]);_0x4b81f4['where']=qs[_0xa347('0x3c')](_[_0xa347('0x46')](_0x129f0a[_0xa347('0x3a')],_0x2e092d[_0xa347('0x3c')]));_0x4b81f4[_0xa347('0x73')]=!![];if(_0x129f0a['query']['filter']){_0x4b81f4['where']=_[_0xa347('0x49')](_0x4b81f4[_0xa347('0x45')],{'$or':_[_0xa347('0x35')](_0x4b81f4['attributes'],function(_0x9bbf74){var _0x10ea82={};_0x10ea82[_0x9bbf74]={'$like':'%'+_0x129f0a[_0xa347('0x3a')][_0xa347('0x47')]+'%'};return _0x10ea82;})});}_0x4b81f4=_[_0xa347('0x49')]({},_0x4b81f4,_0x129f0a[_0xa347('0x51')]);return _0xe6baf2['getContacts'](_0x4b81f4);}})[_0xa347('0x2e')](respondWithResult(_0x566895,null))[_0xa347('0x4d')](handleError(_0x566895,null));};exports[_0xa347('0x74')]=function(_0x298e63,_0x203880,_0x58d2da){var _0x284ce5;return db[_0xa347('0x36')][_0xa347('0x52')]({'where':{'id':_0x298e63[_0xa347('0x4f')]['id']},'include':[{'model':db['CmCustomField'],'as':_0xa347('0x75')}]})['then'](handleEntityNotFound(_0x203880,null))[_0xa347('0x2e')](function(_0x49823e){if(_0x49823e){_0x284ce5=_0x49823e;return db[_0xa347('0x65')][_0xa347('0x61')];}})[_0xa347('0x2e')](function(_0x26c71e){if(_0x26c71e){var _0x349555={};var _0x1dbd70={};_0x1dbd70[_0xa347('0x39')]=_['concat'](_[_0xa347('0x3b')](_0x26c71e),_['map'](_0x284ce5[_0xa347('0x75')],function(_0x308c46){return util[_0xa347('0x76')](_0xa347('0x77'),_0x308c46['id']);}));_0x1dbd70[_0xa347('0x3a')]=_[_0xa347('0x3b')](_0x298e63[_0xa347('0x3a')]);_0x1dbd70[_0xa347('0x3c')]=_[_0xa347('0x3d')](_0x1dbd70[_0xa347('0x39')],_0x1dbd70[_0xa347('0x3a')]);_0x349555[_0xa347('0x3e')]=_[_0xa347('0x3d')](_0x1dbd70[_0xa347('0x39')],qs[_0xa347('0x3f')](_0x298e63[_0xa347('0x3a')]['fields']));_0x349555['attributes']=_0x349555[_0xa347('0x3e')][_0xa347('0x50')]?_0x349555[_0xa347('0x3e')]:_0x1dbd70[_0xa347('0x39')];if(!_0x298e63['query'][_0xa347('0x40')](_0xa347('0x41'))){_0x349555[_0xa347('0x24')]=qs['limit'](_0x298e63[_0xa347('0x3a')]['limit']);_0x349555[_0xa347('0x42')]=qs[_0xa347('0x42')](_0x298e63['query']['offset']);}_0x349555[_0xa347('0x43')]=qs[_0xa347('0x44')](_0x298e63[_0xa347('0x3a')][_0xa347('0x44')]);_0x349555[_0xa347('0x45')]=qs[_0xa347('0x3c')](_['pick'](_0x298e63['query'],_0x1dbd70[_0xa347('0x3c')]));_0x349555['raw']=!![];if(_0x298e63['query'][_0xa347('0x47')]){_0x349555['where']=_[_0xa347('0x49')](_0x349555[_0xa347('0x45')],{'$or':_[_0xa347('0x35')](_0x349555[_0xa347('0x3e')],function(_0x4ce7b4){var _0x5f032f={};_0x5f032f[_0x4ce7b4]={'$like':'%'+_0x298e63['query'][_0xa347('0x47')]+'%'};return _0x5f032f;})});}_0x349555=_[_0xa347('0x49')]({},_0x349555,_0x298e63[_0xa347('0x51')]);return _0x284ce5[_0xa347('0x78')](_0x349555);}})[_0xa347('0x2e')](function(_0x256aeb){if(!_[_0xa347('0x79')](_0x256aeb)){var _0xe38b0f=toCsv(_0x256aeb);var _0x2a95ce=Date[_0xa347('0x7a')]();fs['writeFileSync'](util['format'](_0xa347('0x7b'),_0x284ce5['id'],_0x2a95ce),_0xe38b0f);_0x203880[_0xa347('0x7c')](_0xa347('0x7d'),_0xa347('0x7e')+util[_0xa347('0x76')](_0xa347('0x7f'),_0x284ce5['id'],_0x2a95ce));_0x203880[_0xa347('0x7c')](_0xa347('0x80'),_0xa347('0x81'));return _0x203880['download'](util[_0xa347('0x76')](_0xa347('0x7b'),_0x284ce5['id'],_0x2a95ce));}else{return _0x203880[_0xa347('0x30')](0xcc);}})[_0xa347('0x4d')](handleError(_0x203880,null));};exports['addCustomField']=function(_0x1635b5,_0x18f0d5,_0x2459bb){var _0x24754d;delete _0x1635b5[_0xa347('0x54')]['id'];return db['CmList'][_0xa347('0x82')]({'where':{'id':_0x1635b5[_0xa347('0x4f')]['id']}})[_0xa347('0x2e')](handleEntityNotFound(_0x18f0d5,null))[_0xa347('0x2e')](function(_0x1589b0){if(_0x1589b0){return db[_0xa347('0x83')][_0xa347('0x84')](function(_0x549979){return db['CmCustomField']['create'](_0x1635b5[_0xa347('0x54')],{'transaction':_0x549979})[_0xa347('0x2e')](function(_0x261134){_0x24754d=_0x261134;return _0x1589b0[_0xa347('0x85')](_0x261134,{'transaction':_0x549979});})[_0xa347('0x2e')](function(){var _0x2299c9={'type':db[_0xa347('0x86')][_0xa347('0x87')],'transaction':_0x549979};switch(_0x1635b5[_0xa347('0x54')]['type']){case _0xa347('0x88'):_0x2299c9[_0xa347('0x38')]=db[_0xa347('0x86')][_0xa347('0x87')];break;case _0xa347('0x89'):_0x2299c9[_0xa347('0x38')]=db[_0xa347('0x86')][_0xa347('0x8a')];break;case _0xa347('0x8b'):_0x2299c9['type']=db[_0xa347('0x86')][_0xa347('0x8c')];_0x2299c9[_0xa347('0x8d')]=![];break;default:}return db['sequelize']['queryInterface'][_0xa347('0x8e')]('cm_contacts',util[_0xa347('0x76')](_0xa347('0x8f'),_0x24754d['id']),_0x2299c9);})[_0xa347('0x2e')](function(){return _0x24754d;});});}})['then'](respondWithResult(_0x18f0d5,null))['catch'](handleError(_0x18f0d5,null));};exports[_0xa347('0x90')]=function(_0x8ee3b3,_0x31fbd1,_0x3b494e){var _0x381ecf={};var _0x135f3e={};var _0xd014cd;var _0x5a0fc1;return db[_0xa347('0x36')][_0xa347('0x82')]({'where':{'id':_0x8ee3b3['params']['id']}})[_0xa347('0x2e')](handleEntityNotFound(_0x31fbd1,null))['then'](function(_0x424126){if(_0x424126){_0xd014cd=_0x424126;_0x135f3e[_0xa347('0x39')]=_[_0xa347('0x3b')](db[_0xa347('0x71')][_0xa347('0x61')]);_0x135f3e[_0xa347('0x3a')]=_['keys'](_0x8ee3b3[_0xa347('0x3a')]);_0x135f3e['filters']=_['intersection'](_0x135f3e[_0xa347('0x39')],_0x135f3e['query']);_0x381ecf['attributes']=_[_0xa347('0x3d')](_0x135f3e[_0xa347('0x39')],qs[_0xa347('0x3f')](_0x8ee3b3[_0xa347('0x3a')]['fields']));_0x381ecf[_0xa347('0x3e')]=_0x381ecf[_0xa347('0x3e')][_0xa347('0x50')]?_0x381ecf[_0xa347('0x3e')]:_0x135f3e[_0xa347('0x39')];_0x381ecf['order']=qs[_0xa347('0x44')](_0x8ee3b3[_0xa347('0x3a')][_0xa347('0x44')]);_0x381ecf['where']=qs[_0xa347('0x3c')](_[_0xa347('0x46')](_0x8ee3b3['query'],_0x135f3e[_0xa347('0x3c')]));_0x381ecf['where']=_[_0xa347('0x49')](_0x381ecf[_0xa347('0x45')],{'$or':[{'ListId':_0x424126['id']},{'ListId':null}]});if(_0x8ee3b3[_0xa347('0x3a')][_0xa347('0x47')]){_0x381ecf[_0xa347('0x45')]=_[_0xa347('0x49')](_0x381ecf[_0xa347('0x45')],{'$or':_[_0xa347('0x35')](_0x381ecf[_0xa347('0x3e')],function(_0x37bf4a){var _0x2fd7fb={};_0x2fd7fb[_0x37bf4a]={'$like':'%'+_0x8ee3b3['query'][_0xa347('0x47')]+'%'};return _0x2fd7fb;})});}_0x381ecf=_[_0xa347('0x49')]({},_0x381ecf,_0x8ee3b3['options']);return db[_0xa347('0x71')][_0xa347('0x91')](_0x381ecf);}})[_0xa347('0x2e')](respondWithResult(_0x31fbd1,null))[_0xa347('0x4d')](handleError(_0x31fbd1,null));};exports[_0xa347('0x92')]=function(_0x4a73dd,_0x41e687,_0xe20a97){return db['CmList']['find']({'where':{'id':_0x4a73dd['params']['id']}})['then'](handleEntityNotFound(_0x41e687,null))[_0xa347('0x2e')](function(_0x5f1f95){if(_0x5f1f95){return _0x5f1f95[_0xa347('0x92')](_0x4a73dd[_0xa347('0x54')][_0xa347('0x63')],_[_0xa347('0x6b')](_0x4a73dd[_0xa347('0x54')],[_0xa347('0x63'),'id'])||{})[_0xa347('0x93')](function(_0x292fba){for(var _0x2d1819=0x0;_0x2d1819<_0x4a73dd[_0xa347('0x54')][_0xa347('0x63')][_0xa347('0x50')];_0x2d1819+=0x1){socket[_0xa347('0x94')](_0xa347('0x95'),{'UserId':_0x4a73dd['body']['ids'][_0x2d1819],'CmListId':_0x4a73dd[_0xa347('0x4f')]['id']});}return _0x292fba;});}})[_0xa347('0x2e')](respondWithResult(_0x41e687,null))['catch'](handleError(_0x41e687,null));};exports[_0xa347('0x96')]=function(_0x4c77ca,_0x4f66a8,_0x6298e8){return db['CmList'][_0xa347('0x52')]({'where':{'id':_0x4c77ca[_0xa347('0x4f')]['id']}})[_0xa347('0x2e')](handleEntityNotFound(_0x4f66a8,null))[_0xa347('0x2e')](function(_0x4b228a){if(_0x4b228a){return _0x4b228a['removeAgents'](_0x4c77ca['query'][_0xa347('0x63')])[_0xa347('0x2e')](function(){if(_[_0xa347('0x67')](_0x4c77ca[_0xa347('0x3a')]['ids'])){for(var _0x261ede=0x0;_0x261ede<_0x4c77ca['query'][_0xa347('0x63')][_0xa347('0x50')];_0x261ede+=0x1){socket['emit']('userCmList:remove',{'UserId':Number(_0x4c77ca[_0xa347('0x3a')][_0xa347('0x63')][_0x261ede]),'CmListId':Number(_0x4c77ca[_0xa347('0x4f')]['id'])});}}else{socket[_0xa347('0x94')](_0xa347('0x97'),{'UserId':Number(_0x4c77ca[_0xa347('0x3a')][_0xa347('0x63')]),'CmListId':Number(_0x4c77ca[_0xa347('0x4f')]['id'])});}});}})[_0xa347('0x2e')](respondWithStatusCode(_0x4f66a8,null))['catch'](handleError(_0x4f66a8,null));};exports['getAgents']=function(_0x13a6d0,_0x575be5,_0x57cb62){var _0x1d2558={};var _0x1316fb={};var _0x4137e8;var _0x8c0e36;return db['CmList'][_0xa347('0x82')]({'where':{'id':_0x13a6d0['params']['id']}})['then'](handleEntityNotFound(_0x575be5,null))[_0xa347('0x2e')](function(_0x1d60d1){if(_0x1d60d1){_0x4137e8=_0x1d60d1;_0x1316fb[_0xa347('0x39')]=_[_0xa347('0x3b')](db[_0xa347('0x98')][_0xa347('0x61')]);_0x1316fb[_0xa347('0x3a')]=_['keys'](_0x13a6d0[_0xa347('0x3a')]);_0x1316fb[_0xa347('0x3c')]=_[_0xa347('0x3d')](_0x1316fb[_0xa347('0x39')],_0x1316fb[_0xa347('0x3a')]);_0x1d2558[_0xa347('0x3e')]=_[_0xa347('0x3d')](_0x1316fb['model'],qs['fields'](_0x13a6d0[_0xa347('0x3a')][_0xa347('0x3f')]));_0x1d2558['attributes']=_0x1d2558[_0xa347('0x3e')][_0xa347('0x50')]?_0x1d2558[_0xa347('0x3e')]:_0x1316fb['model'];_0x1d2558['order']=qs['sort'](_0x13a6d0['query'][_0xa347('0x44')]);_0x1d2558[_0xa347('0x45')]=qs[_0xa347('0x3c')](_[_0xa347('0x46')](_0x13a6d0[_0xa347('0x3a')],_0x1316fb[_0xa347('0x3c')]));if(_0x13a6d0[_0xa347('0x3a')][_0xa347('0x47')]){_0x1d2558[_0xa347('0x45')]=_['merge'](_0x1d2558[_0xa347('0x45')],{'$or':_[_0xa347('0x35')](_0x1d2558[_0xa347('0x3e')],function(_0x50d590){var _0x433621={};_0x433621[_0x50d590]={'$like':'%'+_0x13a6d0[_0xa347('0x3a')][_0xa347('0x47')]+'%'};return _0x433621;})});}_0x1d2558=_['merge']({},_0x1d2558,_0x13a6d0[_0xa347('0x51')]);return _0x4137e8[_0xa347('0x99')](_0x1d2558);}})['then'](function(_0x803a23){if(_0x803a23){_0x8c0e36=_0x803a23['length'];if(!_0x13a6d0['query'][_0xa347('0x40')](_0xa347('0x41'))){_0x1d2558[_0xa347('0x24')]=qs[_0xa347('0x24')](_0x13a6d0['query'][_0xa347('0x24')]);_0x1d2558['offset']=qs['offset'](_0x13a6d0[_0xa347('0x3a')]['offset']);}return _0x4137e8[_0xa347('0x99')](_0x1d2558);}})[_0xa347('0x2e')](function(_0xc1196f){if(_0xc1196f){return _0xc1196f?{'count':_0x8c0e36,'rows':_0xc1196f}:null;}})['then'](respondWithResult(_0x575be5,null))[_0xa347('0x4d')](handleError(_0x575be5,null));}; \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index dbd9e3e..7a0cc41 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(_0x55237b,_0x493ab6){var _0x111011=function(_0x3f0fec){while(--_0x3f0fec){_0x55237b['push'](_0x55237b['shift']());}};_0x111011(++_0x493ab6);}(_0x814b,0x1a2));var _0xb814=function(_0x3d89ce,_0x5d5e4b){_0x3d89ce=_0x3d89ce-0x0;var _0x494a2e=_0x814b[_0x3d89ce];return _0x494a2e;};'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 _0x814b=['update','emit','hook','exports','events','../../mysqldb','CmList','setMaxListeners','save'];(function(_0x5774af,_0x411c94){var _0x480589=function(_0x414114){while(--_0x414114){_0x5774af['push'](_0x5774af['shift']());}};_0x480589(++_0x411c94);}(_0x814b,0x1a2));var _0xb814=function(_0x199b1f,_0x4ed849){_0x199b1f=_0x199b1f-0x0;var _0x267ac9=_0x814b[_0x199b1f];return _0x267ac9;};'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 diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index d003aa2..135101b 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 _0x4522=['path','rimraf','../../config/environment','./cmList.attributes','exports','define','CmList','cm_lists','../../config/logger','api','moment','request-promise'];(function(_0x5c447a,_0x33b174){var _0x3b8861=function(_0x5af1ff){while(--_0x5af1ff){_0x5c447a['push'](_0x5c447a['shift']());}};_0x3b8861(++_0x33b174);}(_0x4522,0x1a0));var _0x2452=function(_0x4b477a,_0x3e3f1e){_0x4b477a=_0x4b477a-0x0;var _0x291072=_0x4522[_0x4b477a];return _0x291072;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x2452('0x0'))(_0x2452('0x1'));var moment=require(_0x2452('0x2'));var BPromise=require('bluebird');var rp=require(_0x2452('0x3'));var fs=require('fs');var path=require(_0x2452('0x4'));var rimraf=require(_0x2452('0x5'));var config=require(_0x2452('0x6'));var attributes=require(_0x2452('0x7'));module[_0x2452('0x8')]=function(_0x15fc69,_0x226578){return _0x15fc69[_0x2452('0x9')](_0x2452('0xa'),attributes,{'tableName':_0x2452('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x878f=['path','rimraf','../../config/environment','./cmList.attributes','exports','define','CmList','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x878f,0x173));var _0xf878=function(_0x509263,_0x449e22){_0x509263=_0x509263-0x0;var _0x733a25=_0x878f[_0x509263];return _0x733a25;};'use strict';var _=require('lodash');var util=require(_0xf878('0x0'));var logger=require(_0xf878('0x1'))(_0xf878('0x2'));var moment=require(_0xf878('0x3'));var BPromise=require(_0xf878('0x4'));var rp=require(_0xf878('0x5'));var fs=require('fs');var path=require(_0xf878('0x6'));var rimraf=require(_0xf878('0x7'));var config=require(_0xf878('0x8'));var attributes=require(_0xf878('0x9'));module[_0xf878('0xa')]=function(_0x4bc9aa,_0x4ac8d8){return _0x4bc9aa[_0xf878('0xb')](_0xf878('0xc'),attributes,{'tableName':'cm_lists','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 70ecf24..99fe099 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 _0x1c35=['socket.io-emitter','request','then','info','CmList,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','defaults','redis','localhost'];(function(_0x2858a6,_0x19228b){var _0x22f784=function(_0x428d11){while(--_0x428d11){_0x2858a6['push'](_0x2858a6['shift']());}};_0x22f784(++_0x19228b);}(_0x1c35,0x17c));var _0x51c3=function(_0x254291,_0x35dd38){_0x254291=_0x254291-0x0;var _0x2f2eae=_0x1c35[_0x254291];return _0x2f2eae;};'use strict';var _=require(_0x51c3('0x0'));var util=require('util');var moment=require(_0x51c3('0x1'));var BPromise=require(_0x51c3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x51c3('0x3'));var db=require(_0x51c3('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x51c3('0x5'))('rpc');var config=require(_0x51c3('0x6'));var jayson=require(_0x51c3('0x7'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0x51c3('0x8')](config[_0x51c3('0x9')],{'host':_0x51c3('0xa'),'port':0x18eb});var socket=require(_0x51c3('0xb'))(new Redis(config['redis']));require('./cmList.socket')['register'](socket);function respondWithRpcPromise(_0x40b9cc,_0x46514a,_0x4fb675){return new BPromise(function(_0x42d62d,_0x28fb6c){return client[_0x51c3('0xc')](_0x40b9cc,_0x4fb675)[_0x51c3('0xd')](function(_0x4ff859){logger[_0x51c3('0xe')](_0x51c3('0xf'),_0x46514a,_0x51c3('0x10'));logger[_0x51c3('0x11')]('CmList,\x20%s,\x20%s,\x20%s',_0x46514a,'request\x20sent',JSON[_0x51c3('0x12')](_0x4ff859));if(_0x4ff859[_0x51c3('0x13')]){if(_0x4ff859[_0x51c3('0x13')][_0x51c3('0x14')]===0x1f4){logger[_0x51c3('0x13')](_0x51c3('0xf'),_0x46514a,_0x4ff859['error'][_0x51c3('0x15')]);return _0x28fb6c(_0x4ff859[_0x51c3('0x13')]['message']);}logger[_0x51c3('0x13')](_0x51c3('0xf'),_0x46514a,_0x4ff859[_0x51c3('0x13')][_0x51c3('0x15')]);return _0x42d62d(_0x4ff859[_0x51c3('0x13')]['message']);}else{logger[_0x51c3('0xe')](_0x51c3('0xf'),_0x46514a,_0x51c3('0x10'));_0x42d62d(_0x4ff859['result'][_0x51c3('0x15')]);}})[_0x51c3('0x16')](function(_0x4b1884){logger['error'](_0x51c3('0xf'),_0x46514a,_0x4b1884);_0x28fb6c(_0x4b1884);});});} \ No newline at end of file +var _0x95eb=['../../config/logger','../../config/environment','client','redis','defaults','localhost','./cmList.socket','then','CmList,\x20%s,\x20%s','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','error','code','message','info','result','util','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x5e1e77,_0x1b1221){var _0x3c832c=function(_0x191667){while(--_0x191667){_0x5e1e77['push'](_0x5e1e77['shift']());}};_0x3c832c(++_0x1b1221);}(_0x95eb,0x95));var _0xb95e=function(_0xf05a3a,_0x17d98d){_0xf05a3a=_0xf05a3a-0x0;var _0x6759f=_0x95eb[_0xf05a3a];return _0x6759f;};'use strict';var _=require('lodash');var util=require(_0xb95e('0x0'));var moment=require('moment');var BPromise=require(_0xb95e('0x1'));var rs=require(_0xb95e('0x2'));var fs=require('fs');var Redis=require(_0xb95e('0x3'));var db=require(_0xb95e('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xb95e('0x5'))('rpc');var config=require(_0xb95e('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xb95e('0x7')]['http']({'port':0x232a});config[_0xb95e('0x8')]=_[_0xb95e('0x9')](config[_0xb95e('0x8')],{'host':_0xb95e('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb95e('0x8')]));require(_0xb95e('0xb'))['register'](socket);function respondWithRpcPromise(_0x35d9f5,_0x498d04,_0x117baf){return new BPromise(function(_0x43442d,_0x48a420){return client['request'](_0x35d9f5,_0x117baf)[_0xb95e('0xc')](function(_0xee428f){logger['info'](_0xb95e('0xd'),_0x498d04,_0xb95e('0xe'));logger[_0xb95e('0xf')](_0xb95e('0x10'),_0x498d04,'request\x20sent',JSON['stringify'](_0xee428f));if(_0xee428f[_0xb95e('0x11')]){if(_0xee428f[_0xb95e('0x11')][_0xb95e('0x12')]===0x1f4){logger[_0xb95e('0x11')](_0xb95e('0xd'),_0x498d04,_0xee428f[_0xb95e('0x11')][_0xb95e('0x13')]);return _0x48a420(_0xee428f[_0xb95e('0x11')][_0xb95e('0x13')]);}logger[_0xb95e('0x11')](_0xb95e('0xd'),_0x498d04,_0xee428f['error'][_0xb95e('0x13')]);return _0x43442d(_0xee428f['error'][_0xb95e('0x13')]);}else{logger[_0xb95e('0x14')](_0xb95e('0xd'),_0x498d04,_0xb95e('0xe'));_0x43442d(_0xee428f[_0xb95e('0x15')][_0xb95e('0x13')]);}})['catch'](function(_0x164dd6){logger['error'](_0xb95e('0xd'),_0x498d04,_0x164dd6);_0x48a420(_0x164dd6);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index 39e9a6f..28e3d8b 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 _0xfa60=['register','length','cmList:','./cmList.events','save','remove','emit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfa60,0x122));var _0x0fa6=function(_0x31a148,_0x2bfaf5){_0x31a148=_0x31a148-0x0;var _0x450c1d=_0xfa60[_0x31a148];return _0x450c1d;};'use strict';var CmListEvents=require(_0x0fa6('0x0'));var events=[_0x0fa6('0x1'),_0x0fa6('0x2'),'update'];function createListener(_0x52b8f6,_0x4deb9c){return function(_0x5d39e9){_0x4deb9c[_0x0fa6('0x3')](_0x52b8f6,_0x5d39e9);};}function removeListener(_0x590492,_0x2dbec6){return function(){CmListEvents['removeListener'](_0x590492,_0x2dbec6);};}exports[_0x0fa6('0x4')]=function(_0x4ed874){for(var _0x2e1fea=0x0,_0x24e059=events[_0x0fa6('0x5')];_0x2e1fea<_0x24e059;_0x2e1fea++){var _0x5681e9=events[_0x2e1fea];var _0x5518e5=createListener(_0x0fa6('0x6')+_0x5681e9,_0x4ed874);CmListEvents['on'](_0x5681e9,_0x5518e5);}}; \ No newline at end of file +var _0x3161=['./cmList.events','save','remove','update','emit','removeListener','register','length','cmList:'];(function(_0x39db2a,_0x1a3a67){var _0x2b7434=function(_0x310870){while(--_0x310870){_0x39db2a['push'](_0x39db2a['shift']());}};_0x2b7434(++_0x1a3a67);}(_0x3161,0xd8));var _0x1316=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x3161[_0x20a584];return _0x4b41a8;};'use strict';var CmListEvents=require(_0x1316('0x0'));var events=[_0x1316('0x1'),_0x1316('0x2'),_0x1316('0x3')];function createListener(_0x252e85,_0x1bcb3e){return function(_0x49414b){_0x1bcb3e[_0x1316('0x4')](_0x252e85,_0x49414b);};}function removeListener(_0x44ff05,_0x5986dc){return function(){CmListEvents[_0x1316('0x5')](_0x44ff05,_0x5986dc);};}exports[_0x1316('0x6')]=function(_0x485f02){for(var _0x76d8e5=0x0,_0x54df0f=events[_0x1316('0x7')];_0x76d8e5<_0x54df0f;_0x76d8e5++){var _0x2a54e0=events[_0x76d8e5];var _0x555067=createListener(_0x1316('0x8')+_0x2a54e0,_0x485f02);CmListEvents['on'](_0x2a54e0,_0x555067);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index b224b1d..8b38cf9 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 _0x4c18=['get','isAuthenticated','index','/describe','describe','/:id','show','getDispositions','/:id/contacts','getContacts','/:id/contacts/csv','getContactsCsv','/:id/fields','/:id/users','getAgents','/:id/dispositions','addDisposition','post','addAgents','put','update','delete','destroy','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./cmList.controller'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x4c18,0x18f));var _0x84c1=function(_0x2175ea,_0x58925e){_0x2175ea=_0x2175ea-0x0;var _0x579e81=_0x4c18[_0x2175ea];return _0x579e81;};'use strict';var multer=require(_0x84c1('0x0'));var util=require(_0x84c1('0x1'));var path=require(_0x84c1('0x2'));var timeout=require(_0x84c1('0x3'));var express=require(_0x84c1('0x4'));var router=express[_0x84c1('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x84c1('0x6'));var interaction=require(_0x84c1('0x7'));var config=require('../../config/environment');var controller=require(_0x84c1('0x8'));router[_0x84c1('0x9')]('/',auth[_0x84c1('0xa')](),controller[_0x84c1('0xb')]);router[_0x84c1('0x9')](_0x84c1('0xc'),auth[_0x84c1('0xa')](),controller[_0x84c1('0xd')]);router['get'](_0x84c1('0xe'),auth['isAuthenticated'](),controller[_0x84c1('0xf')]);router[_0x84c1('0x9')]('/:id/dispositions',auth[_0x84c1('0xa')](),controller[_0x84c1('0x10')]);router[_0x84c1('0x9')](_0x84c1('0x11'),auth['isAuthenticated'](),controller[_0x84c1('0x12')]);router['get'](_0x84c1('0x13'),auth[_0x84c1('0xa')](),controller[_0x84c1('0x14')]);router[_0x84c1('0x9')](_0x84c1('0x15'),auth['isAuthenticated'](),controller['getCustomFields']);router[_0x84c1('0x9')](_0x84c1('0x16'),auth[_0x84c1('0xa')](),controller[_0x84c1('0x17')]);router['post']('/',auth[_0x84c1('0xa')](),controller['create']);router['post'](_0x84c1('0x18'),auth[_0x84c1('0xa')](),controller[_0x84c1('0x19')]);router[_0x84c1('0x1a')](_0x84c1('0x11'),auth[_0x84c1('0xa')](),controller['addContacts']);router[_0x84c1('0x1a')](_0x84c1('0x15'),auth[_0x84c1('0xa')](),controller['addCustomField']);router[_0x84c1('0x1a')](_0x84c1('0x16'),auth[_0x84c1('0xa')](),controller[_0x84c1('0x1b')]);router[_0x84c1('0x1c')]('/:id',auth[_0x84c1('0xa')](),controller[_0x84c1('0x1d')]);router[_0x84c1('0x1e')](_0x84c1('0xe'),auth['isAuthenticated'](),controller[_0x84c1('0x1f')]);router[_0x84c1('0x1e')](_0x84c1('0x18'),auth[_0x84c1('0xa')](),controller['removeDispositions']);router[_0x84c1('0x1e')](_0x84c1('0x16'),auth[_0x84c1('0xa')](),controller[_0x84c1('0x20')]);module[_0x84c1('0x21')]=router; \ No newline at end of file +var _0x79d7=['describe','/:id','show','/:id/dispositions','getDispositions','getContacts','/:id/contacts/csv','/:id/fields','getCustomFields','/:id/users','getAgents','post','create','addDisposition','/:id/contacts','addContacts','addAgents','update','delete','destroy','removeDispositions','removeAgents','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cmList.controller','get','isAuthenticated','index','/describe'];(function(_0x5c9671,_0xc76376){var _0x103592=function(_0x317c44){while(--_0x317c44){_0x5c9671['push'](_0x5c9671['shift']());}};_0x103592(++_0xc76376);}(_0x79d7,0x1bb));var _0x779d=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x79d7[_0x42cae2];return _0x5f256f;};'use strict';var multer=require(_0x779d('0x0'));var util=require(_0x779d('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x779d('0x2'));var router=express[_0x779d('0x3')]();var fs_extra=require(_0x779d('0x4'));var auth=require(_0x779d('0x5'));var interaction=require(_0x779d('0x6'));var config=require('../../config/environment');var controller=require(_0x779d('0x7'));router[_0x779d('0x8')]('/',auth[_0x779d('0x9')](),controller[_0x779d('0xa')]);router[_0x779d('0x8')](_0x779d('0xb'),auth['isAuthenticated'](),controller[_0x779d('0xc')]);router[_0x779d('0x8')](_0x779d('0xd'),auth[_0x779d('0x9')](),controller[_0x779d('0xe')]);router[_0x779d('0x8')](_0x779d('0xf'),auth['isAuthenticated'](),controller[_0x779d('0x10')]);router['get']('/:id/contacts',auth[_0x779d('0x9')](),controller[_0x779d('0x11')]);router['get'](_0x779d('0x12'),auth['isAuthenticated'](),controller['getContactsCsv']);router[_0x779d('0x8')](_0x779d('0x13'),auth[_0x779d('0x9')](),controller[_0x779d('0x14')]);router['get'](_0x779d('0x15'),auth[_0x779d('0x9')](),controller[_0x779d('0x16')]);router[_0x779d('0x17')]('/',auth[_0x779d('0x9')](),controller[_0x779d('0x18')]);router[_0x779d('0x17')]('/:id/dispositions',auth[_0x779d('0x9')](),controller[_0x779d('0x19')]);router[_0x779d('0x17')](_0x779d('0x1a'),auth['isAuthenticated'](),controller[_0x779d('0x1b')]);router[_0x779d('0x17')](_0x779d('0x13'),auth[_0x779d('0x9')](),controller['addCustomField']);router[_0x779d('0x17')](_0x779d('0x15'),auth['isAuthenticated'](),controller[_0x779d('0x1c')]);router['put'](_0x779d('0xd'),auth[_0x779d('0x9')](),controller[_0x779d('0x1d')]);router[_0x779d('0x1e')](_0x779d('0xd'),auth[_0x779d('0x9')](),controller[_0x779d('0x1f')]);router[_0x779d('0x1e')](_0x779d('0xf'),auth[_0x779d('0x9')](),controller[_0x779d('0x20')]);router['delete']('/:id/users',auth[_0x779d('0x9')](),controller[_0x779d('0x21')]);module[_0x779d('0x22')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index e3f6eeb..efb8a2f 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 _0x82d7=['getDataValue','field','STRING','sequelize','exports','VIRTUAL'];(function(_0x232125,_0x3cf995){var _0x147f96=function(_0x416a35){while(--_0x416a35){_0x232125['push'](_0x232125['shift']());}};_0x147f96(++_0x3cf995);}(_0x82d7,0x99));var _0x782d=function(_0xf9bcaf,_0x3c9230){_0xf9bcaf=_0xf9bcaf-0x0;var _0x1dff25=_0x82d7[_0xf9bcaf];return _0x1dff25;};'use strict';var Sequelize=require(_0x782d('0x0'));module[_0x782d('0x1')]={'name':{'type':Sequelize[_0x782d('0x2')],'get':function(_0x1b2968){return this[_0x782d('0x3')](_0x782d('0x4'));}},'field':{'type':Sequelize['STRING'],'allowNull':![]},'operator':{'type':Sequelize[_0x782d('0x5')],'allowNull':![]},'value':{'type':Sequelize[_0x782d('0x5')],'allowNull':![]}}; \ No newline at end of file +var _0x6616=['STRING','sequelize','VIRTUAL','getDataValue','field'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x6616,0x12d));var _0x6661=function(_0x5e7daf,_0x3a895e){_0x5e7daf=_0x5e7daf-0x0;var _0x4a3009=_0x6616[_0x5e7daf];return _0x4a3009;};'use strict';var Sequelize=require(_0x6661('0x0'));module['exports']={'name':{'type':Sequelize[_0x6661('0x1')],'get':function(_0x3d7600){return this[_0x6661('0x2')](_0x6661('0x3'));}},'field':{'type':Sequelize['STRING'],'allowNull':![]},'operator':{'type':Sequelize[_0x6661('0x4')],'allowNull':![]},'value':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index 980f5d8..f24fc6b 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(_0x271302,_0x33307b){var _0x2d7f1b=function(_0x1e1a60){while(--_0x1e1a60){_0x271302['push'](_0x271302['shift']());}};_0x2d7f1b(++_0x33307b);}(_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(_0x3d5aa5,_0x21d437){var _0x29fedf=function(_0x1f9452){while(--_0x1f9452){_0x3d5aa5['push'](_0x3d5aa5['shift']());}};_0x29fedf(++_0x21d437);}(_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){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 e573752..13a92c3 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 _0xc458=['./condition.attributes','define','Condition','tools_conditions','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc458,0x101));var _0x8c45=function(_0x518c38,_0x322f4c){_0x518c38=_0x518c38-0x0;var _0x34504e=_0xc458[_0x518c38];return _0x34504e;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x8c45('0x0'));var moment=require(_0x8c45('0x1'));var BPromise=require(_0x8c45('0x2'));var rp=require(_0x8c45('0x3'));var fs=require('fs');var path=require(_0x8c45('0x4'));var rimraf=require(_0x8c45('0x5'));var config=require(_0x8c45('0x6'));var attributes=require(_0x8c45('0x7'));module['exports']=function(_0x951336,_0x75d84f){return _0x951336[_0x8c45('0x8')](_0x8c45('0x9'),attributes,{'tableName':_0x8c45('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8d4e=['path','rimraf','../../config/environment','./condition.attributes','exports','define','Condition','tools_conditions','lodash','../../config/logger','bluebird','request-promise'];(function(_0x159fa6,_0xe80b79){var _0x3a1319=function(_0x379b3c){while(--_0x379b3c){_0x159fa6['push'](_0x159fa6['shift']());}};_0x3a1319(++_0xe80b79);}(_0x8d4e,0xbc));var _0xe8d4=function(_0x37fd83,_0x203c63){_0x37fd83=_0x37fd83-0x0;var _0x211a7d=_0x8d4e[_0x37fd83];return _0x211a7d;};'use strict';var _=require(_0xe8d4('0x0'));var util=require('util');var logger=require(_0xe8d4('0x1'))('api');var moment=require('moment');var BPromise=require(_0xe8d4('0x2'));var rp=require(_0xe8d4('0x3'));var fs=require('fs');var path=require(_0xe8d4('0x4'));var rimraf=require(_0xe8d4('0x5'));var config=require(_0xe8d4('0x6'));var attributes=require(_0xe8d4('0x7'));module[_0xe8d4('0x8')]=function(_0x42e0b5,_0x500281){return _0x42e0b5[_0xe8d4('0x9')](_0xe8d4('0xa'),attributes,{'tableName':_0xe8d4('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 ffa9181..5cdfb6c 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 _0xc13b=['error','code','Condition,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/logger','rpc','../../config/environment','client','http','request','then','info','request\x20sent','debug','stringify'];(function(_0x1107d8,_0x114c00){var _0x38984b=function(_0x48d956){while(--_0x48d956){_0x1107d8['push'](_0x1107d8['shift']());}};_0x38984b(++_0x114c00);}(_0xc13b,0x150));var _0xbc13=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0xc13b[_0x110c3d];return _0x226d67;};'use strict';var _=require(_0xbc13('0x0'));var util=require(_0xbc13('0x1'));var moment=require(_0xbc13('0x2'));var BPromise=require(_0xbc13('0x3'));var rs=require(_0xbc13('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xbc13('0x5'))(_0xbc13('0x6'));var config=require(_0xbc13('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xbc13('0x8')][_0xbc13('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x43ac26,_0x42db4b,_0x289e1e){return new BPromise(function(_0xdc200e,_0x2425bf){return client[_0xbc13('0xa')](_0x43ac26,_0x289e1e)[_0xbc13('0xb')](function(_0x1f799e){logger[_0xbc13('0xc')]('Condition,\x20%s,\x20%s',_0x42db4b,_0xbc13('0xd'));logger[_0xbc13('0xe')]('Condition,\x20%s,\x20%s,\x20%s',_0x42db4b,_0xbc13('0xd'),JSON[_0xbc13('0xf')](_0x1f799e));if(_0x1f799e[_0xbc13('0x10')]){if(_0x1f799e[_0xbc13('0x10')][_0xbc13('0x11')]===0x1f4){logger[_0xbc13('0x10')](_0xbc13('0x12'),_0x42db4b,_0x1f799e[_0xbc13('0x10')]['message']);return _0x2425bf(_0x1f799e[_0xbc13('0x10')][_0xbc13('0x13')]);}logger[_0xbc13('0x10')](_0xbc13('0x12'),_0x42db4b,_0x1f799e[_0xbc13('0x10')][_0xbc13('0x13')]);return _0xdc200e(_0x1f799e['error']['message']);}else{logger['info'](_0xbc13('0x12'),_0x42db4b,_0xbc13('0xd'));_0xdc200e(_0x1f799e[_0xbc13('0x14')]['message']);}})[_0xbc13('0x15')](function(_0x348cf1){logger[_0xbc13('0x10')](_0xbc13('0x12'),_0x42db4b,_0x348cf1);_0x2425bf(_0x348cf1);});});} \ No newline at end of file +var _0x9885=['Condition,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','Condition,\x20%s,\x20%s,\x20%s','request\x20sent','error','code'];(function(_0x1298d4,_0xe49c6){var _0x2f6ccc=function(_0x1123ee){while(--_0x1123ee){_0x1298d4['push'](_0x1298d4['shift']());}};_0x2f6ccc(++_0xe49c6);}(_0x9885,0x10c));var _0x5988=function(_0x464fea,_0xd633a){_0x464fea=_0x464fea-0x0;var _0x10c0e5=_0x9885[_0x464fea];return _0x10c0e5;};'use strict';var _=require('lodash');var util=require(_0x5988('0x0'));var moment=require(_0x5988('0x1'));var BPromise=require(_0x5988('0x2'));var rs=require(_0x5988('0x3'));var fs=require('fs');var Redis=require(_0x5988('0x4'));var db=require(_0x5988('0x5'))['db'];var utils=require(_0x5988('0x6'));var logger=require('../../config/logger')(_0x5988('0x7'));var config=require(_0x5988('0x8'));var jayson=require(_0x5988('0x9'));var client=jayson[_0x5988('0xa')][_0x5988('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3c875b,_0x54fad7,_0x523081){return new BPromise(function(_0x1d51e1,_0x1e79bf){return client[_0x5988('0xc')](_0x3c875b,_0x523081)[_0x5988('0xd')](function(_0x182240){logger[_0x5988('0xe')]('Condition,\x20%s,\x20%s',_0x54fad7,'request\x20sent');logger[_0x5988('0xf')](_0x5988('0x10'),_0x54fad7,_0x5988('0x11'),JSON['stringify'](_0x182240));if(_0x182240['error']){if(_0x182240[_0x5988('0x12')][_0x5988('0x13')]===0x1f4){logger[_0x5988('0x12')](_0x5988('0x14'),_0x54fad7,_0x182240[_0x5988('0x12')][_0x5988('0x15')]);return _0x1e79bf(_0x182240[_0x5988('0x12')][_0x5988('0x15')]);}logger[_0x5988('0x12')](_0x5988('0x14'),_0x54fad7,_0x182240[_0x5988('0x12')][_0x5988('0x15')]);return _0x1d51e1(_0x182240[_0x5988('0x12')]['message']);}else{logger[_0x5988('0xe')](_0x5988('0x14'),_0x54fad7,_0x5988('0x11'));_0x1d51e1(_0x182240[_0x5988('0x16')]['message']);}})[_0x5988('0x17')](function(_0x15bed2){logger[_0x5988('0x12')](_0x5988('0x14'),_0x54fad7,_0x15bed2);_0x1e79bf(_0x15bed2);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index 70b2493..2663476 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 _0x85d8=['connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./condition.controller','put','/:id','isAuthenticated','delete','destroy','exports','multer','util','path'];(function(_0x1d81b7,_0x4cba08){var _0x57db07=function(_0x41b4ec){while(--_0x41b4ec){_0x1d81b7['push'](_0x1d81b7['shift']());}};_0x57db07(++_0x4cba08);}(_0x85d8,0x11d));var _0x885d=function(_0x5d0d80,_0x2ec5f7){_0x5d0d80=_0x5d0d80-0x0;var _0x1f0c72=_0x85d8[_0x5d0d80];return _0x1f0c72;};'use strict';var multer=require(_0x885d('0x0'));var util=require(_0x885d('0x1'));var path=require(_0x885d('0x2'));var timeout=require(_0x885d('0x3'));var express=require(_0x885d('0x4'));var router=express[_0x885d('0x5')]();var fs_extra=require(_0x885d('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x885d('0x7'));var config=require(_0x885d('0x8'));var controller=require(_0x885d('0x9'));router[_0x885d('0xa')](_0x885d('0xb'),auth[_0x885d('0xc')](),controller['update']);router[_0x885d('0xd')](_0x885d('0xb'),auth[_0x885d('0xc')](),controller[_0x885d('0xe')]);module[_0x885d('0xf')]=router; \ No newline at end of file +var _0x7849=['./condition.controller','put','/:id','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0xeffd4e,_0x546a63){var _0x510783=function(_0x5b0d73){while(--_0x5b0d73){_0xeffd4e['push'](_0xeffd4e['shift']());}};_0x510783(++_0x546a63);}(_0x7849,0x1f3));var _0x9784=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x7849[_0x14add3];return _0x4a174f;};'use strict';var multer=require('multer');var util=require(_0x9784('0x0'));var path=require(_0x9784('0x1'));var timeout=require(_0x9784('0x2'));var express=require('express');var router=express[_0x9784('0x3')]();var fs_extra=require(_0x9784('0x4'));var auth=require(_0x9784('0x5'));var interaction=require(_0x9784('0x6'));var config=require('../../config/environment');var controller=require(_0x9784('0x7'));router[_0x9784('0x8')]('/:id',auth['isAuthenticated'](),controller['update']);router['delete'](_0x9784('0x9'),auth['isAuthenticated'](),controller['destroy']);module[_0x9784('0xa')]=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index da508b1..dc0ada0 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(_0x5cc8,_0x1faa02){var _0x450661=function(_0x237b05){while(--_0x237b05){_0x5cc8['push'](_0x5cc8['shift']());}};_0x450661(++_0x1faa02);}(_0xb7e7,0x121));var _0x7b7e=function(_0x166d93,_0x301f09){_0x166d93=_0x166d93-0x0;var _0xba708=_0xb7e7[_0x166d93];return _0xba708;};'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 _0xe706=['STRING','sequelize','exports'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0xe706,0xa3));var _0x6e70=function(_0x4cae38,_0x1f7372){_0x4cae38=_0x4cae38-0x0;var _0x4fc0d6=_0xe706[_0x4cae38];return _0x4fc0d6;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'name':{'type':Sequelize[_0x6e70('0x2')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize[_0x6e70('0x2')]}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index e399397..3212c34 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 _0x0a6d=['fields','length','hasOwnProperty','nolimit','order','sort','where','filters','merge','VIRTUAL','filter','options','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','clone','omit','createdAt','updatedAt','includeAll','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','type','iframe','attrUrl','attrs','https://','custom','attrPath','value','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','multibar-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','addItem','DashboardId','DashboardItem','getItems','findOne','pick','eml-format','rimraf','zip-dir','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','./dashboard.socket','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','get','CustomDashboards','UserProfileResource','error','stack','name','send','map','Dashboard','fieldName','key','model','query','keys','intersection','attributes'];(function(_0x23da4d,_0x63498c){var _0x4ae55=function(_0x323d75){while(--_0x323d75){_0x23da4d['push'](_0x23da4d['shift']());}};_0x4ae55(++_0x63498c);}(_0x0a6d,0xc1));var _0xd0a6=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0x0a6d[_0x50a0c2];return _0x5ebadd;};'use strict';var emlformat=require(_0xd0a6('0x0'));var rimraf=require(_0xd0a6('0x1'));var zipdir=require(_0xd0a6('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xd0a6('0x3'));var Mustache=require(_0xd0a6('0x4'));var util=require(_0xd0a6('0x5'));var path=require(_0xd0a6('0x6'));var sox=require(_0xd0a6('0x7'));var csv=require(_0xd0a6('0x8'));var ejs=require(_0xd0a6('0x9'));var fs=require('fs');var fs_extra=require(_0xd0a6('0xa'));var _=require(_0xd0a6('0xb'));var squel=require(_0xd0a6('0xc'));var crypto=require(_0xd0a6('0xd'));var jsforce=require(_0xd0a6('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xd0a6('0x8'));var querystring=require('querystring');var Papa=require(_0xd0a6('0xf'));var Redis=require(_0xd0a6('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xd0a6('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd0a6('0x12'));var logger=require(_0xd0a6('0x13'))(_0xd0a6('0x14'));var utils=require('../../config/utils');var config=require(_0xd0a6('0x15'));var licenseUtil=require(_0xd0a6('0x16'));var db=require('../../mysqldb')['db'];config[_0xd0a6('0x17')]=_[_0xd0a6('0x18')](config[_0xd0a6('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0xd0a6('0x19'))(new Redis(config[_0xd0a6('0x17')]));require(_0xd0a6('0x1a'))['register'](socket);function respondWithStatusCode(_0x57a9f0,_0x5ae8e8){_0x5ae8e8=_0x5ae8e8||0xcc;return function(_0x2905a5){if(_0x2905a5){return _0x57a9f0[_0xd0a6('0x1b')](_0x5ae8e8);}return _0x57a9f0[_0xd0a6('0x1c')](_0x5ae8e8)[_0xd0a6('0x1d')]();};}function respondWithResult(_0x59011c,_0x1a06de){_0x1a06de=_0x1a06de||0xc8;return function(_0x25d1f4){if(_0x25d1f4){return _0x59011c[_0xd0a6('0x1c')](_0x1a06de)['json'](_0x25d1f4);}};}function respondWithFilteredResult(_0x1cc61f,_0x5675cf){return function(_0x15f316){if(_0x15f316){var _0x1a0b30=typeof _0x5675cf[_0xd0a6('0x1e')]===_0xd0a6('0x1f')&&typeof _0x5675cf[_0xd0a6('0x20')]===_0xd0a6('0x1f');var _0x512b35=_0x15f316[_0xd0a6('0x21')];var _0x1f97f8=_0x1a0b30?0x0:_0x5675cf['offset'];var _0x4ad221=_0x1a0b30?_0x15f316[_0xd0a6('0x21')]:_0x5675cf[_0xd0a6('0x1e')]+_0x5675cf[_0xd0a6('0x20')];var _0x59e772;if(_0x4ad221>=_0x512b35){_0x4ad221=_0x512b35;_0x59e772=0xc8;}else{_0x59e772=0xce;}_0x1cc61f[_0xd0a6('0x1c')](_0x59e772);return _0x1cc61f[_0xd0a6('0x22')](_0xd0a6('0x23'),_0x1f97f8+'-'+_0x4ad221+'/'+_0x512b35)[_0xd0a6('0x24')](_0x15f316);}return null;};}function patchUpdates(_0x505197){return function(_0x9f7860){try{jsonpatch[_0xd0a6('0x25')](_0x9f7860,_0x505197,!![]);}catch(_0x2cdf31){return BPromise[_0xd0a6('0x26')](_0x2cdf31);}return _0x9f7860[_0xd0a6('0x27')]();};}function saveUpdates(_0x2b73f4,_0xe1ef99){return function(_0x3674d8){if(_0x3674d8){return _0x3674d8[_0xd0a6('0x28')](_0x2b73f4)[_0xd0a6('0x29')](function(_0x22029c){return _0x22029c;});}return null;};}function removeEntity(_0x11cb1b,_0x463214){return function(_0x49b915){if(_0x49b915){return _0x49b915[_0xd0a6('0x2a')]()[_0xd0a6('0x29')](function(){var _0x17a14e=_0x49b915[_0xd0a6('0x2b')]({'plain':!![]});var _0x2e74a8=_0xd0a6('0x2c');return db[_0xd0a6('0x2d')][_0xd0a6('0x2a')]({'where':{'type':_0x2e74a8,'resourceId':_0x17a14e['id']}})[_0xd0a6('0x29')](function(){return _0x49b915;});})['then'](function(){_0x11cb1b['status'](0xcc)[_0xd0a6('0x1d')]();});}};}function handleEntityNotFound(_0x55e65b,_0x418c6d){return function(_0x4131ca){if(!_0x4131ca){_0x55e65b[_0xd0a6('0x1b')](0x194);}return _0x4131ca;};}function handleError(_0x11bec5,_0x353ec8){_0x353ec8=_0x353ec8||0x1f4;return function(_0x14c3aa){logger[_0xd0a6('0x2e')](_0x14c3aa[_0xd0a6('0x2f')]);if(_0x14c3aa['name']){delete _0x14c3aa[_0xd0a6('0x30')];}_0x11bec5[_0xd0a6('0x1c')](_0x353ec8)[_0xd0a6('0x31')](_0x14c3aa);};}exports['index']=function(_0x1f9381,_0x41d81c){var _0x223227={},_0x3b7ec0={},_0x59e025={'count':0x0,'rows':[]};var _0x25d489=_[_0xd0a6('0x32')](db[_0xd0a6('0x33')]['rawAttributes'],function(_0x3c5807){return{'name':_0x3c5807[_0xd0a6('0x34')],'type':_0x3c5807['type'][_0xd0a6('0x35')]};});_0x3b7ec0[_0xd0a6('0x36')]=_[_0xd0a6('0x32')](_0x25d489,_0xd0a6('0x30'));_0x3b7ec0[_0xd0a6('0x37')]=_[_0xd0a6('0x38')](_0x1f9381['query']);_0x3b7ec0['filters']=_[_0xd0a6('0x39')](_0x3b7ec0[_0xd0a6('0x36')],_0x3b7ec0[_0xd0a6('0x37')]);_0x223227[_0xd0a6('0x3a')]=_[_0xd0a6('0x39')](_0x3b7ec0[_0xd0a6('0x36')],qs['fields'](_0x1f9381[_0xd0a6('0x37')][_0xd0a6('0x3b')]));_0x223227[_0xd0a6('0x3a')]=_0x223227[_0xd0a6('0x3a')][_0xd0a6('0x3c')]?_0x223227[_0xd0a6('0x3a')]:_0x3b7ec0['model'];if(!_0x1f9381[_0xd0a6('0x37')][_0xd0a6('0x3d')](_0xd0a6('0x3e'))){_0x223227[_0xd0a6('0x20')]=qs[_0xd0a6('0x20')](_0x1f9381[_0xd0a6('0x37')]['limit']);_0x223227[_0xd0a6('0x1e')]=qs[_0xd0a6('0x1e')](_0x1f9381[_0xd0a6('0x37')][_0xd0a6('0x1e')]);}_0x223227[_0xd0a6('0x3f')]=qs[_0xd0a6('0x40')](_0x1f9381[_0xd0a6('0x37')][_0xd0a6('0x40')]);_0x223227[_0xd0a6('0x41')]=qs[_0xd0a6('0x42')](_['pick'](_0x1f9381[_0xd0a6('0x37')],_0x3b7ec0[_0xd0a6('0x42')]),_0x25d489);if(_0x1f9381[_0xd0a6('0x37')]['filter']){_0x223227[_0xd0a6('0x41')]=_[_0xd0a6('0x43')](_0x223227[_0xd0a6('0x41')],{'$or':_[_0xd0a6('0x32')](_0x25d489,function(_0xc91a38){if(_0xc91a38['type']!==_0xd0a6('0x44')){var _0x40f477={};_0x40f477[_0xc91a38[_0xd0a6('0x30')]]={'$like':'%'+_0x1f9381[_0xd0a6('0x37')][_0xd0a6('0x45')]+'%'};return _0x40f477;}})});}_0x223227=_[_0xd0a6('0x43')]({},_0x223227,_0x1f9381[_0xd0a6('0x46')]);var _0x4f0e35={'where':_0x223227[_0xd0a6('0x41')]};return db[_0xd0a6('0x33')][_0xd0a6('0x21')](_0x4f0e35)['then'](function(_0xeb996){_0x59e025[_0xd0a6('0x21')]=_0xeb996;if(_0x1f9381[_0xd0a6('0x37')]['includeAll']){_0x223227[_0xd0a6('0x47')]=[{'all':!![]}];}return db[_0xd0a6('0x33')][_0xd0a6('0x48')](_0x223227);})['then'](function(_0x217622){_0x59e025[_0xd0a6('0x49')]=_0x217622;return _0x59e025;})[_0xd0a6('0x29')](respondWithFilteredResult(_0x41d81c,_0x223227))[_0xd0a6('0x4a')](handleError(_0x41d81c,null));};exports[_0xd0a6('0x4b')]=function(_0x18954a,_0x16a320){var _0x7ae202={'raw':![],'where':{'id':_0x18954a[_0xd0a6('0x4c')]['id']}},_0x2577f8={};_0x2577f8[_0xd0a6('0x36')]=_[_0xd0a6('0x38')](db[_0xd0a6('0x33')][_0xd0a6('0x4d')]);_0x2577f8[_0xd0a6('0x37')]=_[_0xd0a6('0x38')](_0x18954a[_0xd0a6('0x37')]);_0x2577f8[_0xd0a6('0x42')]=_[_0xd0a6('0x39')](_0x2577f8['model'],_0x2577f8[_0xd0a6('0x37')]);_0x7ae202[_0xd0a6('0x3a')]=_[_0xd0a6('0x39')](_0x2577f8[_0xd0a6('0x36')],qs[_0xd0a6('0x3b')](_0x18954a[_0xd0a6('0x37')][_0xd0a6('0x3b')]));_0x7ae202['attributes']=_0x7ae202[_0xd0a6('0x3a')][_0xd0a6('0x3c')]?_0x7ae202[_0xd0a6('0x3a')]:_0x2577f8['model'];if(_0x18954a[_0xd0a6('0x37')]['includeAll']){_0x7ae202[_0xd0a6('0x47')]=[{'all':!![]}];}_0x7ae202=_[_0xd0a6('0x43')]({},_0x7ae202,_0x18954a[_0xd0a6('0x46')]);return db[_0xd0a6('0x33')][_0xd0a6('0x4e')](_0x7ae202)['then'](handleEntityNotFound(_0x16a320,null))['then'](respondWithResult(_0x16a320,null))[_0xd0a6('0x4a')](handleError(_0x16a320,null));};exports[_0xd0a6('0x4f')]=function(_0x4563fa,_0x1140b3){return db[_0xd0a6('0x33')][_0xd0a6('0x4f')](_0x4563fa[_0xd0a6('0x50')],{})[_0xd0a6('0x29')](function(_0x324236){var _0x13b710=_0x4563fa['user']['get']({'plain':!![]});if(!_0x13b710)throw new Error(_0xd0a6('0x51'));if(_0x13b710[_0xd0a6('0x52')]===_0xd0a6('0x53')){var _0x5cc6d0=_0x324236[_0xd0a6('0x2b')]({'plain':!![]});var _0x20babe='CustomDashboards';return db['UserProfileSection']['find']({'where':{'name':_0x20babe,'userProfileId':_0x13b710[_0xd0a6('0x54')]},'raw':!![]})['then'](function(_0x2c45cd){if(_0x2c45cd&&_0x2c45cd[_0xd0a6('0x55')]===0x0){return db[_0xd0a6('0x2d')][_0xd0a6('0x4f')]({'name':_0x5cc6d0[_0xd0a6('0x30')],'resourceId':_0x5cc6d0['id'],'type':_0x2c45cd[_0xd0a6('0x30')],'sectionId':_0x2c45cd['id']},{})[_0xd0a6('0x29')](function(){return _0x324236;});}else{return _0x324236;}})[_0xd0a6('0x4a')](function(_0x2f820e){logger[_0xd0a6('0x2e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2f820e);throw _0x2f820e;});}return _0x324236;})['then'](respondWithResult(_0x1140b3,0xc9))[_0xd0a6('0x4a')](handleError(_0x1140b3,null));};exports[_0xd0a6('0x56')]=function(_0x59145b,_0x1f700f){var _0x2c746c={'where':{'id':_0x59145b[_0xd0a6('0x4c')]['id']}},_0x3de69c={};_0x3de69c['model']=_['keys'](db[_0xd0a6('0x33')][_0xd0a6('0x4d')]);_0x2c746c[_0xd0a6('0x3a')]=_['intersection'](_0x3de69c[_0xd0a6('0x36')],qs[_0xd0a6('0x3b')](_0x59145b['query'][_0xd0a6('0x3b')]));_0x2c746c[_0xd0a6('0x3a')]=_0x2c746c[_0xd0a6('0x3a')][_0xd0a6('0x3c')]?_0x2c746c[_0xd0a6('0x3a')]:_0x3de69c['model'];if(_0x59145b['query']['includeAll']){_0x2c746c[_0xd0a6('0x47')]=[{'all':!![]}];}_0x2c746c=_[_0xd0a6('0x43')]({},_0x2c746c,_0x59145b[_0xd0a6('0x46')]);return db['Dashboard'][_0xd0a6('0x4e')](_0x2c746c)[_0xd0a6('0x29')](handleEntityNotFound(_0x1f700f,null))[_0xd0a6('0x29')](function(_0x3eaf20){if(_0x3eaf20){var _0x1bc59c=_0x3eaf20[_0xd0a6('0x2b')]({'plain':!![]});_0x1bc59c=qs[_0xd0a6('0x57')](_0x1bc59c,['id','createdAt','updatedAt']);_0x59145b[_0xd0a6('0x50')]=_[_0xd0a6('0x57')](_0x59145b[_0xd0a6('0x50')],['id',_0xd0a6('0x58'),_0xd0a6('0x59')]);return db[_0xd0a6('0x33')][_0xd0a6('0x4f')](_[_0xd0a6('0x43')](_0x1bc59c,_0x59145b['body']),{'include':_0x59145b[_0xd0a6('0x37')][_0xd0a6('0x5a')]?[{'all':!![]}]:undefined})['then'](function(_0x4e6945){var _0x1cf0cf=_0x59145b['user'][_0xd0a6('0x2b')]({'plain':!![]});if(!_0x1cf0cf)throw new Error(_0xd0a6('0x51'));if(_0x1cf0cf[_0xd0a6('0x52')]===_0xd0a6('0x53')){var _0x2c2ca6=_0x4e6945[_0xd0a6('0x2b')]({'plain':!![]});var _0x1914ad='CustomDashboards';return db[_0xd0a6('0x5b')][_0xd0a6('0x4e')]({'where':{'name':_0x1914ad,'userProfileId':_0x1cf0cf['userProfileId']},'raw':!![]})[_0xd0a6('0x29')](function(_0x2c8494){if(_0x2c8494&&_0x2c8494[_0xd0a6('0x55')]===0x0){return db[_0xd0a6('0x2d')][_0xd0a6('0x4f')]({'name':_0x2c2ca6[_0xd0a6('0x30')],'resourceId':_0x2c2ca6['id'],'type':_0x2c8494['name'],'sectionId':_0x2c8494['id']},{})[_0xd0a6('0x29')](function(){return _0x4e6945;});}else{return _0x4e6945;}})['catch'](function(_0x245e0c){logger[_0xd0a6('0x2e')](_0xd0a6('0x5c'),_0x245e0c);throw _0x245e0c;});}return _0x4e6945;});}})[_0xd0a6('0x29')](respondWithResult(_0x1f700f,0xc9))[_0xd0a6('0x4a')](handleError(_0x1f700f,null));};exports[_0xd0a6('0x28')]=function(_0x323d63,_0x44ab9e){if(_0x323d63['body']['id']){delete _0x323d63['body']['id'];}return db['Dashboard'][_0xd0a6('0x4e')]({'where':{'id':_0x323d63[_0xd0a6('0x4c')]['id']}})[_0xd0a6('0x29')](handleEntityNotFound(_0x44ab9e,null))[_0xd0a6('0x29')](saveUpdates(_0x323d63[_0xd0a6('0x50')],null))[_0xd0a6('0x29')](respondWithResult(_0x44ab9e,null))[_0xd0a6('0x4a')](handleError(_0x44ab9e,null));};exports['destroy']=function(_0x5cbbfc,_0x3aaadf){return db[_0xd0a6('0x33')]['find']({'where':{'id':_0x5cbbfc[_0xd0a6('0x4c')]['id']}})['then'](handleEntityNotFound(_0x3aaadf,null))[_0xd0a6('0x29')](removeEntity(_0x3aaadf,null))[_0xd0a6('0x4a')](handleError(_0x3aaadf,null));};function widgetAttributes(_0x1d90d3){try{switch(_0x1d90d3[_0xd0a6('0x5d')]){case _0xd0a6('0x5e'):return[{'name':_0xd0a6('0x5f'),'value':_0x1d90d3[_0xd0a6('0x5f')]||(_0x1d90d3[_0xd0a6('0x60')]&&_0x1d90d3[_0xd0a6('0x60')][0x0]?_0x1d90d3[_0xd0a6('0x60')][0x0]['value']:undefined)||_0xd0a6('0x61')}];case _0xd0a6('0x62'):return[{'name':_0xd0a6('0x63'),'value':_0x1d90d3[_0xd0a6('0x63')]||(_0x1d90d3['attrs']&&_0x1d90d3[_0xd0a6('0x60')][0x0]?_0x1d90d3[_0xd0a6('0x60')][0x0][_0xd0a6('0x64')]:undefined)||''}];case _0xd0a6('0x65'):return[{'name':_0xd0a6('0x66'),'value':_0x1d90d3['attrHourFormat']||(_0x1d90d3[_0xd0a6('0x60')]&&_0x1d90d3[_0xd0a6('0x60')][0x0]?_0x1d90d3['attrs'][0x0][_0xd0a6('0x64')]:undefined)||_0xd0a6('0x67')},{'name':_0xd0a6('0x68'),'value':_0x1d90d3[_0xd0a6('0x68')]||(_0x1d90d3[_0xd0a6('0x60')]&&_0x1d90d3[_0xd0a6('0x60')][0x1]?_0x1d90d3[_0xd0a6('0x60')][0x1]['value']:undefined)||_0xd0a6('0x69')},{'name':_0xd0a6('0x6a'),'value':_0x1d90d3[_0xd0a6('0x6a')]||(_0x1d90d3['attrs']&&_0x1d90d3[_0xd0a6('0x60')][0x2]?_0x1d90d3[_0xd0a6('0x60')][0x2]['value']:undefined)||0xc}];case _0xd0a6('0x6b'):return[{'name':_0xd0a6('0x6c'),'value':_0x1d90d3[_0xd0a6('0x6c')]||(_0x1d90d3[_0xd0a6('0x60')]&&_0x1d90d3[_0xd0a6('0x60')][0x0]?_0x1d90d3['attrs'][0x0][_0xd0a6('0x64')]:undefined)||_0xd0a6('0x6d')},{'name':_0xd0a6('0x6e'),'value':_0x1d90d3[_0xd0a6('0x6e')]||(_0x1d90d3[_0xd0a6('0x60')]&&_0x1d90d3[_0xd0a6('0x60')][0x1]?_0x1d90d3['attrs'][0x1][_0xd0a6('0x64')]:undefined)||[]},{'name':_0xd0a6('0x6a'),'value':_0x1d90d3['attrFontSize']||(_0x1d90d3[_0xd0a6('0x60')]&&_0x1d90d3[_0xd0a6('0x60')][0x2]?_0x1d90d3[_0xd0a6('0x60')][0x2][_0xd0a6('0x64')]:undefined)||0x14}];case _0xd0a6('0x6f'):case'pie-chart':return[{'name':'attrSerie1','value':_0x1d90d3[_0xd0a6('0x70')]||(_0x1d90d3[_0xd0a6('0x60')]&&_0x1d90d3[_0xd0a6('0x60')][0x0]?_0x1d90d3['attrs'][0x0][_0xd0a6('0x64')]:undefined)||_0xd0a6('0x6d')},{'name':'attrSerie2','value':_0x1d90d3[_0xd0a6('0x71')]||(_0x1d90d3[_0xd0a6('0x60')]&&_0x1d90d3[_0xd0a6('0x60')][0x1]?_0x1d90d3[_0xd0a6('0x60')][0x1][_0xd0a6('0x64')]:undefined)||null},{'name':_0xd0a6('0x72'),'value':_0x1d90d3[_0xd0a6('0x72')]||(_0x1d90d3[_0xd0a6('0x60')]&&_0x1d90d3[_0xd0a6('0x60')][0x2]?_0x1d90d3[_0xd0a6('0x60')][0x2][_0xd0a6('0x64')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x1d90d3[_0xd0a6('0x6e')]||(_0x1d90d3[_0xd0a6('0x60')]&&_0x1d90d3['attrs'][0x3]?_0x1d90d3[_0xd0a6('0x60')][0x3]['value']:undefined)||[]}];case _0xd0a6('0x73'):return[{'name':_0xd0a6('0x74'),'type':_0x1d90d3[_0xd0a6('0x75')]||(_0x1d90d3[_0xd0a6('0x60')]&&_0x1d90d3[_0xd0a6('0x60')][0x0]?_0x1d90d3[_0xd0a6('0x60')][0x0][_0xd0a6('0x5d')]:undefined)||null,'value':_0x1d90d3[_0xd0a6('0x74')]||(_0x1d90d3[_0xd0a6('0x60')]&&_0x1d90d3['attrs'][0x0]?_0x1d90d3['attrs'][0x0]['value']:undefined)||null},{'name':_0xd0a6('0x76'),'value':_0x1d90d3[_0xd0a6('0x76')]||(_0x1d90d3[_0xd0a6('0x60')]&&_0x1d90d3[_0xd0a6('0x60')][0x1]?_0x1d90d3[_0xd0a6('0x60')][0x1][_0xd0a6('0x64')]:undefined)||0x0}];default:return[];}}catch(_0x21b782){logger[_0xd0a6('0x2e')](_0xd0a6('0x77'),JSON['stringify'](_0x21b782));return[];}}exports[_0xd0a6('0x78')]=function(_0x242e52,_0x1293cd,_0x58a216){if(_0x242e52[_0xd0a6('0x50')]['id']){delete _0x242e52['body']['id'];}return db[_0xd0a6('0x33')]['find']({'where':{'id':_0x242e52['params']['id']}})[_0xd0a6('0x29')](handleEntityNotFound(_0x1293cd,null))[_0xd0a6('0x29')](function(_0x22b71c){if(_0x22b71c){_0x242e52['body'][_0xd0a6('0x79')]=_0x22b71c['id'];_0x242e52['body'][_0xd0a6('0x60')]=widgetAttributes(_0x242e52['body']);return db[_0xd0a6('0x7a')][_0xd0a6('0x4f')](_0x242e52[_0xd0a6('0x50')]);}})[_0xd0a6('0x29')](respondWithResult(_0x1293cd,null))[_0xd0a6('0x4a')](handleError(_0x1293cd,null));};exports[_0xd0a6('0x7b')]=function(_0x2dcfcb,_0xf057da,_0x359c75){var _0x569c8d={};var _0x288704={};var _0x4ce36c;var _0x51080d;return db['Dashboard'][_0xd0a6('0x7c')]({'where':{'id':_0x2dcfcb[_0xd0a6('0x4c')]['id']}})[_0xd0a6('0x29')](handleEntityNotFound(_0xf057da,null))[_0xd0a6('0x29')](function(_0x27bca8){if(_0x27bca8){_0x4ce36c=_0x27bca8;_0x288704[_0xd0a6('0x36')]=_[_0xd0a6('0x38')](db[_0xd0a6('0x7a')][_0xd0a6('0x4d')]);_0x288704[_0xd0a6('0x37')]=_[_0xd0a6('0x38')](_0x2dcfcb['query']);_0x288704[_0xd0a6('0x42')]=_[_0xd0a6('0x39')](_0x288704[_0xd0a6('0x36')],_0x288704['query']);_0x569c8d[_0xd0a6('0x3a')]=_[_0xd0a6('0x39')](_0x288704[_0xd0a6('0x36')],qs[_0xd0a6('0x3b')](_0x2dcfcb[_0xd0a6('0x37')]['fields']));_0x569c8d[_0xd0a6('0x3a')]=_0x569c8d[_0xd0a6('0x3a')]['length']?_0x569c8d[_0xd0a6('0x3a')]:_0x288704[_0xd0a6('0x36')];_0x569c8d[_0xd0a6('0x3f')]=qs[_0xd0a6('0x40')](_0x2dcfcb[_0xd0a6('0x37')][_0xd0a6('0x40')]);_0x569c8d[_0xd0a6('0x41')]=qs[_0xd0a6('0x42')](_[_0xd0a6('0x7d')](_0x2dcfcb[_0xd0a6('0x37')],_0x288704[_0xd0a6('0x42')]));if(_0x2dcfcb['query']['filter']){_0x569c8d[_0xd0a6('0x41')]=_['merge'](_0x569c8d[_0xd0a6('0x41')],{'$or':_['map'](_0x569c8d[_0xd0a6('0x3a')],function(_0x11a275){var _0x518450={};_0x518450[_0x11a275]={'$like':'%'+_0x2dcfcb[_0xd0a6('0x37')][_0xd0a6('0x45')]+'%'};return _0x518450;})});}_0x569c8d=_[_0xd0a6('0x43')]({},_0x569c8d,_0x2dcfcb['options']);return _0x4ce36c['getItems'](_0x569c8d);}})['then'](function(_0x1c43fa){if(_0x1c43fa){_0x51080d=_0x1c43fa[_0xd0a6('0x3c')];if(!_0x2dcfcb['query'][_0xd0a6('0x3d')](_0xd0a6('0x3e'))){_0x569c8d[_0xd0a6('0x20')]=qs['limit'](_0x2dcfcb[_0xd0a6('0x37')][_0xd0a6('0x20')]);_0x569c8d[_0xd0a6('0x1e')]=qs[_0xd0a6('0x1e')](_0x2dcfcb[_0xd0a6('0x37')][_0xd0a6('0x1e')]);}return _0x4ce36c[_0xd0a6('0x7b')](_0x569c8d);}})[_0xd0a6('0x29')](function(_0x52128f){if(_0x52128f){return _0x52128f?{'count':_0x51080d,'rows':_0x52128f}:null;}})[_0xd0a6('0x29')](respondWithResult(_0xf057da,null))['catch'](handleError(_0xf057da,null));}; \ No newline at end of file +var _0xd977=['attrHourFormat','HH:mm:ss','attrTimezone','0.00','counter','attrMetric','total','attrVoiceQueues','attrFontSize','multibar-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','addItem','DashboardId','DashboardItem','order','getItems','eml-format','rimraf','request-promise','moment','mustache','util','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','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','./dashboard.socket','register','sendStatus','status','end','json','undefined','limit','count','offset','apply','reject','save','update','then','destroy','get','UserProfileResource','name','send','index','rawAttributes','fieldName','type','key','model','map','keys','query','filters','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','Dashboard','findAll','catch','show','intersection','includeAll','include','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','CustomDashboards','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','merge','omit','createdAt','updatedAt','params','attrUrl','attrs','https://','custom','attrPath','value','clock'];(function(_0x48980b,_0x1ba972){var _0x4f3415=function(_0x3c7197){while(--_0x3c7197){_0x48980b['push'](_0x48980b['shift']());}};_0x4f3415(++_0x1ba972);}(_0xd977,0x1f2));var _0x7d97=function(_0xfe0a,_0x2069d0){_0xfe0a=_0xfe0a-0x0;var _0x454f30=_0xd977[_0xfe0a];return _0x454f30;};'use strict';var emlformat=require(_0x7d97('0x0'));var rimraf=require(_0x7d97('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x7d97('0x2'));var moment=require(_0x7d97('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x7d97('0x4'));var util=require(_0x7d97('0x5'));var path=require('path');var sox=require(_0x7d97('0x6'));var csv=require('to-csv');var ejs=require(_0x7d97('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7d97('0x8'));var squel=require('squel');var crypto=require(_0x7d97('0x9'));var jsforce=require(_0x7d97('0xa'));var deskjs=require(_0x7d97('0xb'));var toCsv=require(_0x7d97('0xc'));var querystring=require(_0x7d97('0xd'));var Papa=require('papaparse');var Redis=require(_0x7d97('0xe'));var authService=require(_0x7d97('0xf'));var qs=require(_0x7d97('0x10'));var as=require(_0x7d97('0x11'));var hardwareService=require(_0x7d97('0x12'));var logger=require(_0x7d97('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x7d97('0x14'));var licenseUtil=require(_0x7d97('0x15'));var db=require(_0x7d97('0x16'))['db'];config[_0x7d97('0x17')]=_['defaults'](config[_0x7d97('0x17')],{'host':_0x7d97('0x18'),'port':0x18eb});var socket=require(_0x7d97('0x19'))(new Redis(config[_0x7d97('0x17')]));require(_0x7d97('0x1a'))[_0x7d97('0x1b')](socket);function respondWithStatusCode(_0x153b0c,_0x54ddc3){_0x54ddc3=_0x54ddc3||0xcc;return function(_0x1e6bba){if(_0x1e6bba){return _0x153b0c[_0x7d97('0x1c')](_0x54ddc3);}return _0x153b0c[_0x7d97('0x1d')](_0x54ddc3)[_0x7d97('0x1e')]();};}function respondWithResult(_0x20002f,_0x2f2dbe){_0x2f2dbe=_0x2f2dbe||0xc8;return function(_0x2b6f5a){if(_0x2b6f5a){return _0x20002f[_0x7d97('0x1d')](_0x2f2dbe)[_0x7d97('0x1f')](_0x2b6f5a);}};}function respondWithFilteredResult(_0x490c1e,_0x580b0f){return function(_0x420c92){if(_0x420c92){var _0x4aa2d6=typeof _0x580b0f['offset']===_0x7d97('0x20')&&typeof _0x580b0f[_0x7d97('0x21')]===_0x7d97('0x20');var _0x1debe5=_0x420c92[_0x7d97('0x22')];var _0x4a7ab3=_0x4aa2d6?0x0:_0x580b0f[_0x7d97('0x23')];var _0x1075d2=_0x4aa2d6?_0x420c92[_0x7d97('0x22')]:_0x580b0f[_0x7d97('0x23')]+_0x580b0f[_0x7d97('0x21')];var _0x16a0cb;if(_0x1075d2>=_0x1debe5){_0x1075d2=_0x1debe5;_0x16a0cb=0xc8;}else{_0x16a0cb=0xce;}_0x490c1e['status'](_0x16a0cb);return _0x490c1e['set']('Content-Range',_0x4a7ab3+'-'+_0x1075d2+'/'+_0x1debe5)[_0x7d97('0x1f')](_0x420c92);}return null;};}function patchUpdates(_0x534f8d){return function(_0x597361){try{jsonpatch[_0x7d97('0x24')](_0x597361,_0x534f8d,!![]);}catch(_0x590969){return BPromise[_0x7d97('0x25')](_0x590969);}return _0x597361[_0x7d97('0x26')]();};}function saveUpdates(_0x1ec046,_0x4ac669){return function(_0x413376){if(_0x413376){return _0x413376[_0x7d97('0x27')](_0x1ec046)[_0x7d97('0x28')](function(_0x4250a4){return _0x4250a4;});}return null;};}function removeEntity(_0x461e4f,_0x1dc539){return function(_0x17fa9d){if(_0x17fa9d){return _0x17fa9d[_0x7d97('0x29')]()[_0x7d97('0x28')](function(){var _0x39240f=_0x17fa9d[_0x7d97('0x2a')]({'plain':!![]});var _0x39c2a6='CustomDashboards';return db[_0x7d97('0x2b')][_0x7d97('0x29')]({'where':{'type':_0x39c2a6,'resourceId':_0x39240f['id']}})['then'](function(){return _0x17fa9d;});})[_0x7d97('0x28')](function(){_0x461e4f['status'](0xcc)[_0x7d97('0x1e')]();});}};}function handleEntityNotFound(_0x3609c0,_0x27e96f){return function(_0x42a280){if(!_0x42a280){_0x3609c0[_0x7d97('0x1c')](0x194);}return _0x42a280;};}function handleError(_0x2f9055,_0x509aca){_0x509aca=_0x509aca||0x1f4;return function(_0x5f4d1d){logger['error'](_0x5f4d1d['stack']);if(_0x5f4d1d[_0x7d97('0x2c')]){delete _0x5f4d1d[_0x7d97('0x2c')];}_0x2f9055[_0x7d97('0x1d')](_0x509aca)[_0x7d97('0x2d')](_0x5f4d1d);};}exports[_0x7d97('0x2e')]=function(_0x2255e5,_0x23dae4){var _0x1d41a8={},_0x47f6c6={},_0x3bd659={'count':0x0,'rows':[]};var _0x168e5b=_['map'](db['Dashboard'][_0x7d97('0x2f')],function(_0x16b445){return{'name':_0x16b445[_0x7d97('0x30')],'type':_0x16b445[_0x7d97('0x31')][_0x7d97('0x32')]};});_0x47f6c6[_0x7d97('0x33')]=_[_0x7d97('0x34')](_0x168e5b,_0x7d97('0x2c'));_0x47f6c6['query']=_[_0x7d97('0x35')](_0x2255e5[_0x7d97('0x36')]);_0x47f6c6[_0x7d97('0x37')]=_['intersection'](_0x47f6c6['model'],_0x47f6c6[_0x7d97('0x36')]);_0x1d41a8['attributes']=_['intersection'](_0x47f6c6['model'],qs['fields'](_0x2255e5[_0x7d97('0x36')][_0x7d97('0x38')]));_0x1d41a8[_0x7d97('0x39')]=_0x1d41a8[_0x7d97('0x39')][_0x7d97('0x3a')]?_0x1d41a8[_0x7d97('0x39')]:_0x47f6c6[_0x7d97('0x33')];if(!_0x2255e5[_0x7d97('0x36')][_0x7d97('0x3b')](_0x7d97('0x3c'))){_0x1d41a8[_0x7d97('0x21')]=qs[_0x7d97('0x21')](_0x2255e5[_0x7d97('0x36')]['limit']);_0x1d41a8[_0x7d97('0x23')]=qs[_0x7d97('0x23')](_0x2255e5[_0x7d97('0x36')]['offset']);}_0x1d41a8['order']=qs['sort'](_0x2255e5[_0x7d97('0x36')][_0x7d97('0x3d')]);_0x1d41a8[_0x7d97('0x3e')]=qs[_0x7d97('0x37')](_[_0x7d97('0x3f')](_0x2255e5[_0x7d97('0x36')],_0x47f6c6[_0x7d97('0x37')]),_0x168e5b);if(_0x2255e5[_0x7d97('0x36')][_0x7d97('0x40')]){_0x1d41a8['where']=_['merge'](_0x1d41a8[_0x7d97('0x3e')],{'$or':_[_0x7d97('0x34')](_0x168e5b,function(_0x24a02e){if(_0x24a02e[_0x7d97('0x31')]!==_0x7d97('0x41')){var _0xedbf5={};_0xedbf5[_0x24a02e[_0x7d97('0x2c')]]={'$like':'%'+_0x2255e5[_0x7d97('0x36')][_0x7d97('0x40')]+'%'};return _0xedbf5;}})});}_0x1d41a8=_['merge']({},_0x1d41a8,_0x2255e5['options']);var _0x10a82b={'where':_0x1d41a8[_0x7d97('0x3e')]};return db['Dashboard'][_0x7d97('0x22')](_0x10a82b)[_0x7d97('0x28')](function(_0x33dc77){_0x3bd659[_0x7d97('0x22')]=_0x33dc77;if(_0x2255e5['query']['includeAll']){_0x1d41a8['include']=[{'all':!![]}];}return db[_0x7d97('0x42')][_0x7d97('0x43')](_0x1d41a8);})[_0x7d97('0x28')](function(_0x1df37b){_0x3bd659['rows']=_0x1df37b;return _0x3bd659;})[_0x7d97('0x28')](respondWithFilteredResult(_0x23dae4,_0x1d41a8))[_0x7d97('0x44')](handleError(_0x23dae4,null));};exports[_0x7d97('0x45')]=function(_0x3bb4e4,_0x263b65){var _0x15b4a7={'raw':![],'where':{'id':_0x3bb4e4['params']['id']}},_0x3eb4fc={};_0x3eb4fc[_0x7d97('0x33')]=_[_0x7d97('0x35')](db[_0x7d97('0x42')][_0x7d97('0x2f')]);_0x3eb4fc[_0x7d97('0x36')]=_['keys'](_0x3bb4e4[_0x7d97('0x36')]);_0x3eb4fc['filters']=_['intersection'](_0x3eb4fc[_0x7d97('0x33')],_0x3eb4fc[_0x7d97('0x36')]);_0x15b4a7['attributes']=_[_0x7d97('0x46')](_0x3eb4fc[_0x7d97('0x33')],qs['fields'](_0x3bb4e4[_0x7d97('0x36')][_0x7d97('0x38')]));_0x15b4a7[_0x7d97('0x39')]=_0x15b4a7['attributes'][_0x7d97('0x3a')]?_0x15b4a7[_0x7d97('0x39')]:_0x3eb4fc['model'];if(_0x3bb4e4['query'][_0x7d97('0x47')]){_0x15b4a7[_0x7d97('0x48')]=[{'all':!![]}];}_0x15b4a7=_['merge']({},_0x15b4a7,_0x3bb4e4[_0x7d97('0x49')]);return db[_0x7d97('0x42')][_0x7d97('0x4a')](_0x15b4a7)[_0x7d97('0x28')](handleEntityNotFound(_0x263b65,null))[_0x7d97('0x28')](respondWithResult(_0x263b65,null))[_0x7d97('0x44')](handleError(_0x263b65,null));};exports[_0x7d97('0x4b')]=function(_0x1bb781,_0x4f1364){return db[_0x7d97('0x42')]['create'](_0x1bb781[_0x7d97('0x4c')],{})[_0x7d97('0x28')](function(_0x3a6edd){var _0x1f7791=_0x1bb781['user'][_0x7d97('0x2a')]({'plain':!![]});if(!_0x1f7791)throw new Error(_0x7d97('0x4d'));if(_0x1f7791[_0x7d97('0x4e')]===_0x7d97('0x4f')){var _0x59d987=_0x3a6edd['get']({'plain':!![]});var _0x340864=_0x7d97('0x50');return db['UserProfileSection']['find']({'where':{'name':_0x340864,'userProfileId':_0x1f7791[_0x7d97('0x51')]},'raw':!![]})[_0x7d97('0x28')](function(_0x345b17){if(_0x345b17&&_0x345b17[_0x7d97('0x52')]===0x0){return db[_0x7d97('0x2b')][_0x7d97('0x4b')]({'name':_0x59d987[_0x7d97('0x2c')],'resourceId':_0x59d987['id'],'type':_0x345b17[_0x7d97('0x2c')],'sectionId':_0x345b17['id']},{})[_0x7d97('0x28')](function(){return _0x3a6edd;});}else{return _0x3a6edd;}})[_0x7d97('0x44')](function(_0x2e2d3f){logger[_0x7d97('0x53')](_0x7d97('0x54'),_0x2e2d3f);throw _0x2e2d3f;});}return _0x3a6edd;})[_0x7d97('0x28')](respondWithResult(_0x4f1364,0xc9))['catch'](handleError(_0x4f1364,null));};exports['clone']=function(_0x13b31c,_0x53485f){var _0x56e740={'where':{'id':_0x13b31c['params']['id']}},_0x183d8b={};_0x183d8b[_0x7d97('0x33')]=_[_0x7d97('0x35')](db[_0x7d97('0x42')][_0x7d97('0x2f')]);_0x56e740[_0x7d97('0x39')]=_[_0x7d97('0x46')](_0x183d8b[_0x7d97('0x33')],qs[_0x7d97('0x38')](_0x13b31c[_0x7d97('0x36')][_0x7d97('0x38')]));_0x56e740[_0x7d97('0x39')]=_0x56e740[_0x7d97('0x39')][_0x7d97('0x3a')]?_0x56e740[_0x7d97('0x39')]:_0x183d8b[_0x7d97('0x33')];if(_0x13b31c['query']['includeAll']){_0x56e740[_0x7d97('0x48')]=[{'all':!![]}];}_0x56e740=_[_0x7d97('0x55')]({},_0x56e740,_0x13b31c[_0x7d97('0x49')]);return db[_0x7d97('0x42')][_0x7d97('0x4a')](_0x56e740)[_0x7d97('0x28')](handleEntityNotFound(_0x53485f,null))[_0x7d97('0x28')](function(_0xbef99a){if(_0xbef99a){var _0x568e4c=_0xbef99a[_0x7d97('0x2a')]({'plain':!![]});_0x568e4c=qs[_0x7d97('0x56')](_0x568e4c,['id',_0x7d97('0x57'),'updatedAt']);_0x13b31c[_0x7d97('0x4c')]=_[_0x7d97('0x56')](_0x13b31c[_0x7d97('0x4c')],['id','createdAt',_0x7d97('0x58')]);return db[_0x7d97('0x42')][_0x7d97('0x4b')](_[_0x7d97('0x55')](_0x568e4c,_0x13b31c[_0x7d97('0x4c')]),{'include':_0x13b31c[_0x7d97('0x36')][_0x7d97('0x47')]?[{'all':!![]}]:undefined})[_0x7d97('0x28')](function(_0x64a018){var _0xfb649a=_0x13b31c['user'][_0x7d97('0x2a')]({'plain':!![]});if(!_0xfb649a)throw new Error(_0x7d97('0x4d'));if(_0xfb649a[_0x7d97('0x4e')]===_0x7d97('0x4f')){var _0x10a68a=_0x64a018['get']({'plain':!![]});var _0x2bb196=_0x7d97('0x50');return db['UserProfileSection'][_0x7d97('0x4a')]({'where':{'name':_0x2bb196,'userProfileId':_0xfb649a[_0x7d97('0x51')]},'raw':!![]})['then'](function(_0xd21c5f){if(_0xd21c5f&&_0xd21c5f[_0x7d97('0x52')]===0x0){return db[_0x7d97('0x2b')][_0x7d97('0x4b')]({'name':_0x10a68a[_0x7d97('0x2c')],'resourceId':_0x10a68a['id'],'type':_0xd21c5f['name'],'sectionId':_0xd21c5f['id']},{})[_0x7d97('0x28')](function(){return _0x64a018;});}else{return _0x64a018;}})['catch'](function(_0x46e891){logger['error'](_0x7d97('0x54'),_0x46e891);throw _0x46e891;});}return _0x64a018;});}})['then'](respondWithResult(_0x53485f,0xc9))['catch'](handleError(_0x53485f,null));};exports[_0x7d97('0x27')]=function(_0x5eb847,_0x510c7e){if(_0x5eb847[_0x7d97('0x4c')]['id']){delete _0x5eb847[_0x7d97('0x4c')]['id'];}return db['Dashboard'][_0x7d97('0x4a')]({'where':{'id':_0x5eb847['params']['id']}})['then'](handleEntityNotFound(_0x510c7e,null))[_0x7d97('0x28')](saveUpdates(_0x5eb847[_0x7d97('0x4c')],null))[_0x7d97('0x28')](respondWithResult(_0x510c7e,null))['catch'](handleError(_0x510c7e,null));};exports['destroy']=function(_0x51783c,_0x2a2261){return db[_0x7d97('0x42')][_0x7d97('0x4a')]({'where':{'id':_0x51783c[_0x7d97('0x59')]['id']}})[_0x7d97('0x28')](handleEntityNotFound(_0x2a2261,null))['then'](removeEntity(_0x2a2261,null))[_0x7d97('0x44')](handleError(_0x2a2261,null));};function widgetAttributes(_0x214fdd){try{switch(_0x214fdd[_0x7d97('0x31')]){case'iframe':return[{'name':'attrUrl','value':_0x214fdd[_0x7d97('0x5a')]||(_0x214fdd[_0x7d97('0x5b')]&&_0x214fdd[_0x7d97('0x5b')][0x0]?_0x214fdd['attrs'][0x0]['value']:undefined)||_0x7d97('0x5c')}];case _0x7d97('0x5d'):return[{'name':_0x7d97('0x5e'),'value':_0x214fdd['attrPath']||(_0x214fdd[_0x7d97('0x5b')]&&_0x214fdd[_0x7d97('0x5b')][0x0]?_0x214fdd[_0x7d97('0x5b')][0x0][_0x7d97('0x5f')]:undefined)||''}];case _0x7d97('0x60'):return[{'name':_0x7d97('0x61'),'value':_0x214fdd['attrHourFormat']||(_0x214fdd[_0x7d97('0x5b')]&&_0x214fdd[_0x7d97('0x5b')][0x0]?_0x214fdd['attrs'][0x0]['value']:undefined)||_0x7d97('0x62')},{'name':_0x7d97('0x63'),'value':_0x214fdd[_0x7d97('0x63')]||(_0x214fdd[_0x7d97('0x5b')]&&_0x214fdd['attrs'][0x1]?_0x214fdd['attrs'][0x1][_0x7d97('0x5f')]:undefined)||_0x7d97('0x64')},{'name':'attrFontSize','value':_0x214fdd['attrFontSize']||(_0x214fdd[_0x7d97('0x5b')]&&_0x214fdd[_0x7d97('0x5b')][0x2]?_0x214fdd['attrs'][0x2][_0x7d97('0x5f')]:undefined)||0xc}];case _0x7d97('0x65'):return[{'name':_0x7d97('0x66'),'value':_0x214fdd['attrMetric']||(_0x214fdd['attrs']&&_0x214fdd[_0x7d97('0x5b')][0x0]?_0x214fdd['attrs'][0x0][_0x7d97('0x5f')]:undefined)||_0x7d97('0x67')},{'name':'attrVoiceQueues','value':_0x214fdd[_0x7d97('0x68')]||(_0x214fdd[_0x7d97('0x5b')]&&_0x214fdd[_0x7d97('0x5b')][0x1]?_0x214fdd[_0x7d97('0x5b')][0x1][_0x7d97('0x5f')]:undefined)||[]},{'name':_0x7d97('0x69'),'value':_0x214fdd[_0x7d97('0x69')]||(_0x214fdd[_0x7d97('0x5b')]&&_0x214fdd[_0x7d97('0x5b')][0x2]?_0x214fdd[_0x7d97('0x5b')][0x2][_0x7d97('0x5f')]:undefined)||0x14}];case _0x7d97('0x6a'):case'pie-chart':return[{'name':'attrSerie1','value':_0x214fdd[_0x7d97('0x6b')]||(_0x214fdd[_0x7d97('0x5b')]&&_0x214fdd['attrs'][0x0]?_0x214fdd[_0x7d97('0x5b')][0x0][_0x7d97('0x5f')]:undefined)||'total'},{'name':'attrSerie2','value':_0x214fdd[_0x7d97('0x6c')]||(_0x214fdd[_0x7d97('0x5b')]&&_0x214fdd[_0x7d97('0x5b')][0x1]?_0x214fdd[_0x7d97('0x5b')][0x1][_0x7d97('0x5f')]:undefined)||null},{'name':_0x7d97('0x6d'),'value':_0x214fdd[_0x7d97('0x6d')]||(_0x214fdd[_0x7d97('0x5b')]&&_0x214fdd[_0x7d97('0x5b')][0x2]?_0x214fdd[_0x7d97('0x5b')][0x2]['value']:undefined)||null},{'name':_0x7d97('0x68'),'value':_0x214fdd[_0x7d97('0x68')]||(_0x214fdd[_0x7d97('0x5b')]&&_0x214fdd[_0x7d97('0x5b')][0x3]?_0x214fdd[_0x7d97('0x5b')][0x3][_0x7d97('0x5f')]:undefined)||[]}];case _0x7d97('0x6e'):return[{'name':_0x7d97('0x6f'),'type':_0x214fdd[_0x7d97('0x70')]||(_0x214fdd[_0x7d97('0x5b')]&&_0x214fdd[_0x7d97('0x5b')][0x0]?_0x214fdd[_0x7d97('0x5b')][0x0][_0x7d97('0x31')]:undefined)||null,'value':_0x214fdd['attrReport']||(_0x214fdd[_0x7d97('0x5b')]&&_0x214fdd['attrs'][0x0]?_0x214fdd[_0x7d97('0x5b')][0x0][_0x7d97('0x5f')]:undefined)||null},{'name':_0x7d97('0x71'),'value':_0x214fdd['attrRefresh']||(_0x214fdd[_0x7d97('0x5b')]&&_0x214fdd[_0x7d97('0x5b')][0x1]?_0x214fdd[_0x7d97('0x5b')][0x1][_0x7d97('0x5f')]:undefined)||0x0}];default:return[];}}catch(_0x18f86a){logger[_0x7d97('0x53')]('widgetAttributes:\x20%s',JSON['stringify'](_0x18f86a));return[];}}exports[_0x7d97('0x72')]=function(_0x5f501e,_0x165d4b,_0x23c809){if(_0x5f501e[_0x7d97('0x4c')]['id']){delete _0x5f501e['body']['id'];}return db['Dashboard']['find']({'where':{'id':_0x5f501e[_0x7d97('0x59')]['id']}})[_0x7d97('0x28')](handleEntityNotFound(_0x165d4b,null))[_0x7d97('0x28')](function(_0x56b508){if(_0x56b508){_0x5f501e[_0x7d97('0x4c')][_0x7d97('0x73')]=_0x56b508['id'];_0x5f501e[_0x7d97('0x4c')][_0x7d97('0x5b')]=widgetAttributes(_0x5f501e[_0x7d97('0x4c')]);return db[_0x7d97('0x74')][_0x7d97('0x4b')](_0x5f501e[_0x7d97('0x4c')]);}})['then'](respondWithResult(_0x165d4b,null))['catch'](handleError(_0x165d4b,null));};exports['getItems']=function(_0x57a739,_0x41e7b0,_0x202069){var _0x5925de={};var _0x168d6e={};var _0x1dc564;var _0xc24bc9;return db[_0x7d97('0x42')]['findOne']({'where':{'id':_0x57a739[_0x7d97('0x59')]['id']}})[_0x7d97('0x28')](handleEntityNotFound(_0x41e7b0,null))[_0x7d97('0x28')](function(_0x30bc8f){if(_0x30bc8f){_0x1dc564=_0x30bc8f;_0x168d6e[_0x7d97('0x33')]=_['keys'](db[_0x7d97('0x74')][_0x7d97('0x2f')]);_0x168d6e[_0x7d97('0x36')]=_[_0x7d97('0x35')](_0x57a739['query']);_0x168d6e['filters']=_['intersection'](_0x168d6e[_0x7d97('0x33')],_0x168d6e['query']);_0x5925de[_0x7d97('0x39')]=_[_0x7d97('0x46')](_0x168d6e[_0x7d97('0x33')],qs[_0x7d97('0x38')](_0x57a739[_0x7d97('0x36')][_0x7d97('0x38')]));_0x5925de['attributes']=_0x5925de[_0x7d97('0x39')]['length']?_0x5925de[_0x7d97('0x39')]:_0x168d6e[_0x7d97('0x33')];_0x5925de[_0x7d97('0x75')]=qs['sort'](_0x57a739[_0x7d97('0x36')][_0x7d97('0x3d')]);_0x5925de[_0x7d97('0x3e')]=qs['filters'](_[_0x7d97('0x3f')](_0x57a739[_0x7d97('0x36')],_0x168d6e[_0x7d97('0x37')]));if(_0x57a739[_0x7d97('0x36')][_0x7d97('0x40')]){_0x5925de[_0x7d97('0x3e')]=_[_0x7d97('0x55')](_0x5925de[_0x7d97('0x3e')],{'$or':_['map'](_0x5925de[_0x7d97('0x39')],function(_0x545cff){var _0x3155c6={};_0x3155c6[_0x545cff]={'$like':'%'+_0x57a739[_0x7d97('0x36')][_0x7d97('0x40')]+'%'};return _0x3155c6;})});}_0x5925de=_['merge']({},_0x5925de,_0x57a739[_0x7d97('0x49')]);return _0x1dc564['getItems'](_0x5925de);}})['then'](function(_0x215193){if(_0x215193){_0xc24bc9=_0x215193[_0x7d97('0x3a')];if(!_0x57a739['query'][_0x7d97('0x3b')]('nolimit')){_0x5925de[_0x7d97('0x21')]=qs[_0x7d97('0x21')](_0x57a739[_0x7d97('0x36')][_0x7d97('0x21')]);_0x5925de['offset']=qs[_0x7d97('0x23')](_0x57a739[_0x7d97('0x36')][_0x7d97('0x23')]);}return _0x1dc564[_0x7d97('0x76')](_0x5925de);}})[_0x7d97('0x28')](function(_0x3f79c3){if(_0x3f79c3){return _0x3f79c3?{'count':_0xc24bc9,'rows':_0x3f79c3}:null;}})[_0x7d97('0x28')](respondWithResult(_0x41e7b0,null))[_0x7d97('0x44')](handleError(_0x41e7b0,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index 49bbb94..90210f6 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 _0xc1db=['hasOwnProperty','events','Dashboard','setMaxListeners','save','update','remove'];(function(_0x2112d4,_0x3c863c){var _0x434972=function(_0x477020){while(--_0x477020){_0x2112d4['push'](_0x2112d4['shift']());}};_0x434972(++_0x3c863c);}(_0xc1db,0x120));var _0xbc1d=function(_0x362b43,_0x6cfa8d){_0x362b43=_0x362b43-0x0;var _0x13c633=_0xc1db[_0x362b43];return _0x13c633;};'use strict';var EventEmitter=require(_0xbc1d('0x0'));var Dashboard=require('../../mysqldb')['db'][_0xbc1d('0x1')];var DashboardEvents=new EventEmitter();DashboardEvents[_0xbc1d('0x2')](0x0);var events={'afterCreate':_0xbc1d('0x3'),'afterUpdate':_0xbc1d('0x4'),'afterDestroy':_0xbc1d('0x5')};function emitEvent(_0x4b69f6){return function(_0x3d0b27,_0x329960,_0x23a61e){DashboardEvents['emit'](_0x4b69f6+':'+_0x3d0b27['id'],_0x3d0b27);DashboardEvents['emit'](_0x4b69f6,_0x3d0b27);_0x23a61e(null);};}for(var e in events){if(events[_0xbc1d('0x6')](e)){var event=events[e];Dashboard['hook'](e,emitEvent(event));}}module['exports']=DashboardEvents; \ No newline at end of file +var _0x4af8=['emit','events','../../mysqldb','Dashboard','setMaxListeners','save','update','remove'];(function(_0x3585cc,_0x43fc48){var _0x19e326=function(_0xa18404){while(--_0xa18404){_0x3585cc['push'](_0x3585cc['shift']());}};_0x19e326(++_0x43fc48);}(_0x4af8,0x81));var _0x84af=function(_0x481bf7,_0x437f69){_0x481bf7=_0x481bf7-0x0;var _0x461787=_0x4af8[_0x481bf7];return _0x461787;};'use strict';var EventEmitter=require(_0x84af('0x0'));var Dashboard=require(_0x84af('0x1'))['db'][_0x84af('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents[_0x84af('0x3')](0x0);var events={'afterCreate':_0x84af('0x4'),'afterUpdate':_0x84af('0x5'),'afterDestroy':_0x84af('0x6')};function emitEvent(_0x1c1320){return function(_0x23fbcb,_0x4804a9,_0x77017){DashboardEvents[_0x84af('0x7')](_0x1c1320+':'+_0x23fbcb['id'],_0x23fbcb);DashboardEvents[_0x84af('0x7')](_0x1c1320,_0x23fbcb);_0x77017(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Dashboard['hook'](e,emitEvent(event));}}module['exports']=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index b621e96..f787022 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 _0x37bd=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./dashboard.attributes','exports','define','Dashboard','dashboards','lodash','api'];(function(_0x2c5255,_0x4340c3){var _0x30d0ea=function(_0x131ba1){while(--_0x131ba1){_0x2c5255['push'](_0x2c5255['shift']());}};_0x30d0ea(++_0x4340c3);}(_0x37bd,0x191));var _0xd37b=function(_0x3d505e,_0x2f2c37){_0x3d505e=_0x3d505e-0x0;var _0x2a675d=_0x37bd[_0x3d505e];return _0x2a675d;};'use strict';var _=require(_0xd37b('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xd37b('0x1'));var moment=require(_0xd37b('0x2'));var BPromise=require(_0xd37b('0x3'));var rp=require(_0xd37b('0x4'));var fs=require('fs');var path=require(_0xd37b('0x5'));var rimraf=require(_0xd37b('0x6'));var config=require(_0xd37b('0x7'));var attributes=require(_0xd37b('0x8'));module[_0xd37b('0x9')]=function(_0x37e59e,_0x2ad344){return _0x37e59e[_0xd37b('0xa')](_0xd37b('0xb'),attributes,{'tableName':_0xd37b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3c2d=['exports','define','Dashboard','lodash','util','../../config/logger','api','moment','../../config/environment'];(function(_0x218d1e,_0x1b892d){var _0x39be50=function(_0xb0e004){while(--_0xb0e004){_0x218d1e['push'](_0x218d1e['shift']());}};_0x39be50(++_0x1b892d);}(_0x3c2d,0x1e9));var _0xd3c2=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x3c2d[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0xd3c2('0x0'));var util=require(_0xd3c2('0x1'));var logger=require(_0xd3c2('0x2'))(_0xd3c2('0x3'));var moment=require(_0xd3c2('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xd3c2('0x5'));var attributes=require('./dashboard.attributes');module[_0xd3c2('0x6')]=function(_0x536d28,_0x2f9e45){return _0x536d28[_0xd3c2('0x7')](_0xd3c2('0x8'),attributes,{'tableName':'dashboards','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 1033576..3cd0df1 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 _0x5257=['localhost','./dashboard.socket','register','request','then','Dashboard,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','Dashboard,\x20%s,\x20%s','message','info','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults'];(function(_0x3e8817,_0x1a23a1){var _0x22c378=function(_0x288a38){while(--_0x288a38){_0x3e8817['push'](_0x3e8817['shift']());}};_0x22c378(++_0x1a23a1);}(_0x5257,0x75));var _0x7525=function(_0x12fc8d,_0x19ee33){_0x12fc8d=_0x12fc8d-0x0;var _0x3f9d04=_0x5257[_0x12fc8d];return _0x3f9d04;};'use strict';var _=require('lodash');var util=require(_0x7525('0x0'));var moment=require(_0x7525('0x1'));var BPromise=require(_0x7525('0x2'));var rs=require(_0x7525('0x3'));var fs=require('fs');var Redis=require(_0x7525('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x7525('0x5'));var logger=require(_0x7525('0x6'))(_0x7525('0x7'));var config=require(_0x7525('0x8'));var jayson=require(_0x7525('0x9'));var client=jayson[_0x7525('0xa')]['http']({'port':0x232a});config[_0x7525('0xb')]=_[_0x7525('0xc')](config[_0x7525('0xb')],{'host':_0x7525('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7525('0xb')]));require(_0x7525('0xe'))[_0x7525('0xf')](socket);function respondWithRpcPromise(_0x4445a5,_0xd21e91,_0x462f9){return new BPromise(function(_0xe4da65,_0x59242a){return client[_0x7525('0x10')](_0x4445a5,_0x462f9)[_0x7525('0x11')](function(_0x284b55){logger['info']('Dashboard,\x20%s,\x20%s',_0xd21e91,'request\x20sent');logger['debug'](_0x7525('0x12'),_0xd21e91,_0x7525('0x13'),JSON['stringify'](_0x284b55));if(_0x284b55['error']){if(_0x284b55[_0x7525('0x14')][_0x7525('0x15')]===0x1f4){logger[_0x7525('0x14')](_0x7525('0x16'),_0xd21e91,_0x284b55[_0x7525('0x14')][_0x7525('0x17')]);return _0x59242a(_0x284b55[_0x7525('0x14')]['message']);}logger[_0x7525('0x14')](_0x7525('0x16'),_0xd21e91,_0x284b55[_0x7525('0x14')]['message']);return _0xe4da65(_0x284b55[_0x7525('0x14')][_0x7525('0x17')]);}else{logger[_0x7525('0x18')](_0x7525('0x16'),_0xd21e91,_0x7525('0x13'));_0xe4da65(_0x284b55['result'][_0x7525('0x17')]);}})[_0x7525('0x19')](function(_0x477e0e){logger[_0x7525('0x14')]('Dashboard,\x20%s,\x20%s',_0xd21e91,_0x477e0e);_0x59242a(_0x477e0e);});});} \ No newline at end of file +var _0xe9a1=['../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./dashboard.socket','request','then','info','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','error','code','message','Dashboard,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x4c4293,_0x2ad119){var _0x4e2402=function(_0x12db1e){while(--_0x12db1e){_0x4c4293['push'](_0x4c4293['shift']());}};_0x4e2402(++_0x2ad119);}(_0xe9a1,0x153));var _0x1e9a=function(_0x578794,_0x3d9990){_0x578794=_0x578794-0x0;var _0x58e0e3=_0xe9a1[_0x578794];return _0x58e0e3;};'use strict';var _=require(_0x1e9a('0x0'));var util=require(_0x1e9a('0x1'));var moment=require(_0x1e9a('0x2'));var BPromise=require(_0x1e9a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1e9a('0x4'));var db=require(_0x1e9a('0x5'))['db'];var utils=require(_0x1e9a('0x6'));var logger=require(_0x1e9a('0x7'))(_0x1e9a('0x8'));var config=require(_0x1e9a('0x9'));var jayson=require(_0x1e9a('0xa'));var client=jayson[_0x1e9a('0xb')][_0x1e9a('0xc')]({'port':0x232a});config[_0x1e9a('0xd')]=_[_0x1e9a('0xe')](config[_0x1e9a('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x1e9a('0xf'))(new Redis(config['redis']));require(_0x1e9a('0x10'))['register'](socket);function respondWithRpcPromise(_0x41a3ee,_0x7acf34,_0x22e4f4){return new BPromise(function(_0x37cd73,_0x3ffd46){return client[_0x1e9a('0x11')](_0x41a3ee,_0x22e4f4)[_0x1e9a('0x12')](function(_0x5023ff){logger[_0x1e9a('0x13')]('Dashboard,\x20%s,\x20%s',_0x7acf34,_0x1e9a('0x14'));logger[_0x1e9a('0x15')](_0x1e9a('0x16'),_0x7acf34,_0x1e9a('0x14'),JSON['stringify'](_0x5023ff));if(_0x5023ff[_0x1e9a('0x17')]){if(_0x5023ff[_0x1e9a('0x17')][_0x1e9a('0x18')]===0x1f4){logger[_0x1e9a('0x17')]('Dashboard,\x20%s,\x20%s',_0x7acf34,_0x5023ff[_0x1e9a('0x17')][_0x1e9a('0x19')]);return _0x3ffd46(_0x5023ff[_0x1e9a('0x17')]['message']);}logger[_0x1e9a('0x17')](_0x1e9a('0x1a'),_0x7acf34,_0x5023ff[_0x1e9a('0x17')]['message']);return _0x37cd73(_0x5023ff[_0x1e9a('0x17')][_0x1e9a('0x19')]);}else{logger['info'](_0x1e9a('0x1a'),_0x7acf34,_0x1e9a('0x14'));_0x37cd73(_0x5023ff[_0x1e9a('0x1b')]['message']);}})[_0x1e9a('0x1c')](function(_0xd28dd9){logger[_0x1e9a('0x17')]('Dashboard,\x20%s,\x20%s',_0x7acf34,_0xd28dd9);_0x3ffd46(_0xd28dd9);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index a492ea6..9d70b93 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 _0xdfb2=['./dashboard.events','save','update','removeListener','register','dashboard:'];(function(_0x242fc3,_0x3c7b31){var _0x5e5cfb=function(_0x466e5c){while(--_0x466e5c){_0x242fc3['push'](_0x242fc3['shift']());}};_0x5e5cfb(++_0x3c7b31);}(_0xdfb2,0xfc));var _0x2dfb=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0xdfb2[_0x5b561d];return _0x431060;};'use strict';var DashboardEvents=require(_0x2dfb('0x0'));var events=[_0x2dfb('0x1'),'remove',_0x2dfb('0x2')];function createListener(_0x72c4e,_0x1e46e7){return function(_0x4356ac){_0x1e46e7['emit'](_0x72c4e,_0x4356ac);};}function removeListener(_0x551a60,_0x2e02c7){return function(){DashboardEvents[_0x2dfb('0x3')](_0x551a60,_0x2e02c7);};}exports[_0x2dfb('0x4')]=function(_0x1d2bb6){for(var _0x3548f7=0x0,_0x272b94=events['length'];_0x3548f7<_0x272b94;_0x3548f7++){var _0x1cdaaf=events[_0x3548f7];var _0x4fe7cf=createListener(_0x2dfb('0x5')+_0x1cdaaf,_0x1d2bb6);DashboardEvents['on'](_0x1cdaaf,_0x4fe7cf);}}; \ No newline at end of file +var _0xd0bb=['update','emit','removeListener','register','dashboard:','save'];(function(_0x2711d7,_0x24a535){var _0x28cc61=function(_0x5b0283){while(--_0x5b0283){_0x2711d7['push'](_0x2711d7['shift']());}};_0x28cc61(++_0x24a535);}(_0xd0bb,0x167));var _0xbd0b=function(_0x38bc51,_0x3e2a6c){_0x38bc51=_0x38bc51-0x0;var _0x492b1a=_0xd0bb[_0x38bc51];return _0x492b1a;};'use strict';var DashboardEvents=require('./dashboard.events');var events=[_0xbd0b('0x0'),'remove',_0xbd0b('0x1')];function createListener(_0x132970,_0x2215db){return function(_0x53c5d3){_0x2215db[_0xbd0b('0x2')](_0x132970,_0x53c5d3);};}function removeListener(_0x5986e6,_0x3efde1){return function(){DashboardEvents[_0xbd0b('0x3')](_0x5986e6,_0x3efde1);};}exports[_0xbd0b('0x4')]=function(_0x3c6157){for(var _0x1b13da=0x0,_0x4558c4=events['length'];_0x1b13da<_0x4558c4;_0x1b13da++){var _0x80f70e=events[_0x1b13da];var _0x5acb27=createListener(_0xbd0b('0x5')+_0x80f70e,_0x3c6157);DashboardEvents['on'](_0x80f70e,_0x5acb27);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index e9ce51f..d186de0 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 _0x35d5=['util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboard.controller','get','isAuthenticated','index','/:id','show','post','create','clone','addItem','put','update','delete','destroy','exports'];(function(_0x4e67c2,_0x1e5ad6){var _0x4ef3d2=function(_0x5a9ea1){while(--_0x5a9ea1){_0x4e67c2['push'](_0x4e67c2['shift']());}};_0x4ef3d2(++_0x1e5ad6);}(_0x35d5,0x1b5));var _0x535d=function(_0x523a73,_0x5c99c9){_0x523a73=_0x523a73-0x0;var _0x4a88ee=_0x35d5[_0x523a73];return _0x4a88ee;};'use strict';var multer=require('multer');var util=require(_0x535d('0x0'));var path=require(_0x535d('0x1'));var timeout=require(_0x535d('0x2'));var express=require('express');var router=express[_0x535d('0x3')]();var fs_extra=require(_0x535d('0x4'));var auth=require(_0x535d('0x5'));var interaction=require(_0x535d('0x6'));var config=require(_0x535d('0x7'));var controller=require(_0x535d('0x8'));router[_0x535d('0x9')]('/',auth[_0x535d('0xa')](),controller[_0x535d('0xb')]);router[_0x535d('0x9')](_0x535d('0xc'),auth[_0x535d('0xa')](),controller[_0x535d('0xd')]);router[_0x535d('0x9')]('/:id/items',auth[_0x535d('0xa')](),controller['getItems']);router[_0x535d('0xe')]('/',auth['isAuthenticated'](),controller[_0x535d('0xf')]);router[_0x535d('0xe')]('/:id/clone',auth[_0x535d('0xa')](),controller[_0x535d('0x10')]);router['post']('/:id/items',auth[_0x535d('0xa')](),controller[_0x535d('0x11')]);router[_0x535d('0x12')]('/:id',auth[_0x535d('0xa')](),controller[_0x535d('0x13')]);router[_0x535d('0x14')](_0x535d('0xc'),auth[_0x535d('0xa')](),controller[_0x535d('0x15')]);module[_0x535d('0x16')]=router; \ No newline at end of file +var _0x1bec=['/:id/clone','/:id/items','destroy','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./dashboard.controller','get','isAuthenticated','/:id','post','create'];(function(_0x1dfa63,_0x362bd4){var _0x26f2a9=function(_0x31cc52){while(--_0x31cc52){_0x1dfa63['push'](_0x1dfa63['shift']());}};_0x26f2a9(++_0x362bd4);}(_0x1bec,0x193));var _0xc1be=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0x1bec[_0x30ae5e];return _0x1f2e93;};'use strict';var multer=require('multer');var util=require(_0xc1be('0x0'));var path=require('path');var timeout=require(_0xc1be('0x1'));var express=require(_0xc1be('0x2'));var router=express[_0xc1be('0x3')]();var fs_extra=require(_0xc1be('0x4'));var auth=require(_0xc1be('0x5'));var interaction=require(_0xc1be('0x6'));var config=require('../../config/environment');var controller=require(_0xc1be('0x7'));router[_0xc1be('0x8')]('/',auth[_0xc1be('0x9')](),controller['index']);router[_0xc1be('0x8')](_0xc1be('0xa'),auth[_0xc1be('0x9')](),controller['show']);router[_0xc1be('0x8')]('/:id/items',auth[_0xc1be('0x9')](),controller['getItems']);router[_0xc1be('0xb')]('/',auth[_0xc1be('0x9')](),controller[_0xc1be('0xc')]);router[_0xc1be('0xb')](_0xc1be('0xd'),auth[_0xc1be('0x9')](),controller['clone']);router[_0xc1be('0xb')](_0xc1be('0xe'),auth[_0xc1be('0x9')](),controller['addItem']);router['put'](_0xc1be('0xa'),auth[_0xc1be('0x9')](),controller['update']);router['delete']('/:id',auth[_0xc1be('0x9')](),controller[_0xc1be('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index 7a404d9..fe8c5e6 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 _0x46ed=['sequelize','squel','exports','STRING','long','parse','attrs','setDataValue','stringify','INTEGER','#ffffff','#2196f3'];(function(_0x34b87f,_0x28aef2){var _0x449805=function(_0x3735b7){while(--_0x3735b7){_0x34b87f['push'](_0x34b87f['shift']());}};_0x449805(++_0x28aef2);}(_0x46ed,0x168));var _0xd46e=function(_0x25e7cb,_0x3579b7){_0x25e7cb=_0x25e7cb-0x0;var _0x375d92=_0x46ed[_0x25e7cb];return _0x375d92;};'use strict';var Sequelize=require(_0xd46e('0x0'));var squel=require(_0xd46e('0x1'));var _=require('lodash');module[_0xd46e('0x2')]={'title':{'type':Sequelize[_0xd46e('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xd46e('0x3')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize['TEXT'](_0xd46e('0x4')),'get':function(){try{return JSON[_0xd46e('0x5')](this['getDataValue'](_0xd46e('0x6')));}catch(_0x1926d9){return[];}},'set':function(_0x160bcf){try{this[_0xd46e('0x7')](_0xd46e('0x6'),JSON[_0xd46e('0x8')](_0x160bcf));}catch(_0x437ea0){this[_0xd46e('0x7')](_0xd46e('0x6'),JSON[_0xd46e('0x8')]([]));}}},'sizeX':{'type':Sequelize[_0xd46e('0x9')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0xd46e('0x9')]},'col':{'type':Sequelize[_0xd46e('0x9')]},'background':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xd46e('0xa'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0xd46e('0x3')],'allowNull':![],'defaultValue':_0xd46e('0xb'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0xd46e('0x3')]},'titleFontSize':{'type':Sequelize[_0xd46e('0x9')],'defaultValue':0xc}}; \ No newline at end of file +var _0x2542=['exports','STRING','long','parse','getDataValue','attrs','setDataValue','stringify','INTEGER','#ffffff','#2196f3','sequelize','squel','lodash'];(function(_0x59145a,_0x1f60f1){var _0xf04d7=function(_0x247581){while(--_0x247581){_0x59145a['push'](_0x59145a['shift']());}};_0xf04d7(++_0x1f60f1);}(_0x2542,0x169));var _0x2254=function(_0x214c7c,_0x2cd804){_0x214c7c=_0x214c7c-0x0;var _0x1663d5=_0x2542[_0x214c7c];return _0x1663d5;};'use strict';var Sequelize=require(_0x2254('0x0'));var squel=require(_0x2254('0x1'));var _=require(_0x2254('0x2'));module[_0x2254('0x3')]={'title':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x2254('0x4')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize['TEXT'](_0x2254('0x5')),'get':function(){try{return JSON[_0x2254('0x6')](this[_0x2254('0x7')](_0x2254('0x8')));}catch(_0x76c902){return[];}},'set':function(_0x508183){try{this[_0x2254('0x9')](_0x2254('0x8'),JSON[_0x2254('0xa')](_0x508183));}catch(_0x3c45ec){this[_0x2254('0x9')](_0x2254('0x8'),JSON[_0x2254('0xa')]([]));}}},'sizeX':{'type':Sequelize[_0x2254('0xb')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x2254('0xb')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x2254('0xb')]},'col':{'type':Sequelize[_0x2254('0xb')]},'background':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x2254('0xc'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x2254('0x4')],'allowNull':![],'defaultValue':_0x2254('0xd'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x2254('0x4')]},'titleFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc}}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.controller.js b/server/api/dashboardItem/dashboardItem.controller.js index a1cab89..f97c8cd 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 _0x634a=['iframe','attrs','value','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','attrFontSize','attrMetric','total','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','stringify','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','end','json','limit','undefined','count','offset','set','Content-Range','apply','reject','save','update','then','status','error','stack','name','send','show','params','model','keys','DashboardItem','rawAttributes','query','filters','intersection','fields','attributes','include','find','catch','destroy','type'];(function(_0x25048e,_0x48d685){var _0x5dc636=function(_0x4e5171){while(--_0x4e5171){_0x25048e['push'](_0x25048e['shift']());}};_0x5dc636(++_0x48d685);}(_0x634a,0x17f));var _0xa634=function(_0x582b92,_0x42bf6f){_0x582b92=_0x582b92-0x0;var _0x261dbe=_0x634a[_0x582b92];return _0x261dbe;};'use strict';var emlformat=require(_0xa634('0x0'));var rimraf=require(_0xa634('0x1'));var zipdir=require(_0xa634('0x2'));var jsonpatch=require(_0xa634('0x3'));var rp=require(_0xa634('0x4'));var moment=require(_0xa634('0x5'));var BPromise=require(_0xa634('0x6'));var Mustache=require(_0xa634('0x7'));var util=require(_0xa634('0x8'));var path=require(_0xa634('0x9'));var sox=require(_0xa634('0xa'));var csv=require(_0xa634('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa634('0xc'));var _=require(_0xa634('0xd'));var squel=require(_0xa634('0xe'));var crypto=require('crypto');var jsforce=require(_0xa634('0xf'));var deskjs=require(_0xa634('0x10'));var toCsv=require(_0xa634('0xb'));var querystring=require(_0xa634('0x11'));var Papa=require(_0xa634('0x12'));var Redis=require(_0xa634('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xa634('0x14'));var as=require(_0xa634('0x15'));var hardwareService=require(_0xa634('0x16'));var logger=require(_0xa634('0x17'))('api');var utils=require(_0xa634('0x18'));var config=require(_0xa634('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xa634('0x1a'))['db'];config[_0xa634('0x1b')]=_[_0xa634('0x1c')](config['redis'],{'host':_0xa634('0x1d'),'port':0x18eb});var socket=require(_0xa634('0x1e'))(new Redis(config[_0xa634('0x1b')]));require('./dashboardItem.socket')[_0xa634('0x1f')](socket);function respondWithStatusCode(_0x49c986,_0x41226e){_0x41226e=_0x41226e||0xcc;return function(_0x5af9ad){if(_0x5af9ad){return _0x49c986[_0xa634('0x20')](_0x41226e);}return _0x49c986['status'](_0x41226e)[_0xa634('0x21')]();};}function respondWithResult(_0x284ebe,_0x1ee8f6){_0x1ee8f6=_0x1ee8f6||0xc8;return function(_0x1ff748){if(_0x1ff748){return _0x284ebe['status'](_0x1ee8f6)[_0xa634('0x22')](_0x1ff748);}};}function respondWithFilteredResult(_0x16983c,_0x58dffe){return function(_0x13b4ee){if(_0x13b4ee){var _0x49e9eb=typeof _0x58dffe['offset']==='undefined'&&typeof _0x58dffe[_0xa634('0x23')]===_0xa634('0x24');var _0x5e0b58=_0x13b4ee[_0xa634('0x25')];var _0x3020d9=_0x49e9eb?0x0:_0x58dffe[_0xa634('0x26')];var _0xb14e37=_0x49e9eb?_0x13b4ee[_0xa634('0x25')]:_0x58dffe[_0xa634('0x26')]+_0x58dffe[_0xa634('0x23')];var _0x4b3f86;if(_0xb14e37>=_0x5e0b58){_0xb14e37=_0x5e0b58;_0x4b3f86=0xc8;}else{_0x4b3f86=0xce;}_0x16983c['status'](_0x4b3f86);return _0x16983c[_0xa634('0x27')](_0xa634('0x28'),_0x3020d9+'-'+_0xb14e37+'/'+_0x5e0b58)[_0xa634('0x22')](_0x13b4ee);}return null;};}function patchUpdates(_0x2c90ea){return function(_0x426910){try{jsonpatch[_0xa634('0x29')](_0x426910,_0x2c90ea,!![]);}catch(_0x58c772){return BPromise[_0xa634('0x2a')](_0x58c772);}return _0x426910[_0xa634('0x2b')]();};}function saveUpdates(_0x476418,_0x2052d7){return function(_0xa43900){if(_0xa43900){return _0xa43900[_0xa634('0x2c')](_0x476418)[_0xa634('0x2d')](function(_0x440bae){return _0x440bae;});}return null;};}function removeEntity(_0x536b69,_0x23a976){return function(_0x5c82b8){if(_0x5c82b8){return _0x5c82b8['destroy']()['then'](function(){_0x536b69[_0xa634('0x2e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x45a7ee,_0x4d5f67){return function(_0x161f68){if(!_0x161f68){_0x45a7ee[_0xa634('0x20')](0x194);}return _0x161f68;};}function handleError(_0x3f9147,_0x3948c8){_0x3948c8=_0x3948c8||0x1f4;return function(_0x53a6ac){logger[_0xa634('0x2f')](_0x53a6ac[_0xa634('0x30')]);if(_0x53a6ac[_0xa634('0x31')]){delete _0x53a6ac[_0xa634('0x31')];}_0x3f9147[_0xa634('0x2e')](_0x3948c8)[_0xa634('0x32')](_0x53a6ac);};}exports[_0xa634('0x33')]=function(_0x39517d,_0x387fab){var _0x350eb8={'raw':![],'where':{'id':_0x39517d[_0xa634('0x34')]['id']}},_0x5b110d={};_0x5b110d[_0xa634('0x35')]=_[_0xa634('0x36')](db[_0xa634('0x37')][_0xa634('0x38')]);_0x5b110d['query']=_['keys'](_0x39517d[_0xa634('0x39')]);_0x5b110d[_0xa634('0x3a')]=_['intersection'](_0x5b110d[_0xa634('0x35')],_0x5b110d[_0xa634('0x39')]);_0x350eb8['attributes']=_[_0xa634('0x3b')](_0x5b110d['model'],qs[_0xa634('0x3c')](_0x39517d[_0xa634('0x39')][_0xa634('0x3c')]));_0x350eb8['attributes']=_0x350eb8[_0xa634('0x3d')]['length']?_0x350eb8['attributes']:_0x5b110d['model'];if(_0x39517d[_0xa634('0x39')]['includeAll']){_0x350eb8[_0xa634('0x3e')]=[{'all':!![]}];}_0x350eb8=_['merge']({},_0x350eb8,_0x39517d['options']);return db[_0xa634('0x37')][_0xa634('0x3f')](_0x350eb8)[_0xa634('0x2d')](handleEntityNotFound(_0x387fab,null))[_0xa634('0x2d')](respondWithResult(_0x387fab,null))[_0xa634('0x40')](handleError(_0x387fab,null));};exports[_0xa634('0x41')]=function(_0x5a0333,_0x23c461){return db[_0xa634('0x37')][_0xa634('0x3f')]({'where':{'id':_0x5a0333[_0xa634('0x34')]['id']}})[_0xa634('0x2d')](handleEntityNotFound(_0x23c461,null))[_0xa634('0x2d')](removeEntity(_0x23c461,null))[_0xa634('0x40')](handleError(_0x23c461,null));};function widgetAttributes(_0x21bbd2){try{switch(_0x21bbd2[_0xa634('0x42')]){case _0xa634('0x43'):return[{'name':'attrUrl','value':_0x21bbd2['attrUrl']||(_0x21bbd2[_0xa634('0x44')]&&_0x21bbd2[_0xa634('0x44')][0x0]?_0x21bbd2[_0xa634('0x44')][0x0][_0xa634('0x45')]:undefined)||'https://'}];case'custom':return[{'name':_0xa634('0x46'),'value':_0x21bbd2[_0xa634('0x46')]||(_0x21bbd2[_0xa634('0x44')]&&_0x21bbd2[_0xa634('0x44')][0x0]?_0x21bbd2[_0xa634('0x44')][0x0]['value']:undefined)||''}];case _0xa634('0x47'):return[{'name':_0xa634('0x48'),'value':_0x21bbd2[_0xa634('0x48')]||(_0x21bbd2[_0xa634('0x44')]&&_0x21bbd2[_0xa634('0x44')][0x0]?_0x21bbd2[_0xa634('0x44')][0x0][_0xa634('0x45')]:undefined)||_0xa634('0x49')},{'name':_0xa634('0x4a'),'value':_0x21bbd2[_0xa634('0x4a')]||(_0x21bbd2[_0xa634('0x44')]&&_0x21bbd2[_0xa634('0x44')][0x1]?_0x21bbd2[_0xa634('0x44')][0x1]['value']:undefined)||'0.00'},{'name':_0xa634('0x4b'),'value':_0x21bbd2[_0xa634('0x4b')]||(_0x21bbd2[_0xa634('0x44')]&&_0x21bbd2[_0xa634('0x44')][0x2]?_0x21bbd2[_0xa634('0x44')][0x2][_0xa634('0x45')]:undefined)||0xc}];case'counter':return[{'name':_0xa634('0x4c'),'value':_0x21bbd2[_0xa634('0x4c')]||(_0x21bbd2[_0xa634('0x44')]&&_0x21bbd2[_0xa634('0x44')][0x0]?_0x21bbd2['attrs'][0x0]['value']:undefined)||_0xa634('0x4d')},{'name':_0xa634('0x4e'),'value':_0x21bbd2[_0xa634('0x4e')]||(_0x21bbd2[_0xa634('0x44')]&&_0x21bbd2[_0xa634('0x44')][0x1]?_0x21bbd2[_0xa634('0x44')][0x1][_0xa634('0x45')]:undefined)||[]},{'name':'attrFontSize','value':_0x21bbd2[_0xa634('0x4b')]||(_0x21bbd2['attrs']&&_0x21bbd2['attrs'][0x2]?_0x21bbd2[_0xa634('0x44')][0x2][_0xa634('0x45')]:undefined)||0x14}];case _0xa634('0x4f'):case _0xa634('0x50'):return[{'name':_0xa634('0x51'),'value':_0x21bbd2['attrSerie1']||(_0x21bbd2['attrs']&&_0x21bbd2[_0xa634('0x44')][0x0]?_0x21bbd2[_0xa634('0x44')][0x0][_0xa634('0x45')]:undefined)||_0xa634('0x4d')},{'name':_0xa634('0x52'),'value':_0x21bbd2[_0xa634('0x52')]||(_0x21bbd2[_0xa634('0x44')]&&_0x21bbd2[_0xa634('0x44')][0x1]?_0x21bbd2[_0xa634('0x44')][0x1][_0xa634('0x45')]:undefined)||null},{'name':_0xa634('0x53'),'value':_0x21bbd2[_0xa634('0x53')]||(_0x21bbd2['attrs']&&_0x21bbd2[_0xa634('0x44')][0x2]?_0x21bbd2[_0xa634('0x44')][0x2][_0xa634('0x45')]:undefined)||null},{'name':_0xa634('0x4e'),'value':_0x21bbd2[_0xa634('0x4e')]||(_0x21bbd2[_0xa634('0x44')]&&_0x21bbd2[_0xa634('0x44')][0x3]?_0x21bbd2[_0xa634('0x44')][0x3][_0xa634('0x45')]:undefined)||[]}];case _0xa634('0x54'):return[{'name':_0xa634('0x55'),'type':_0x21bbd2[_0xa634('0x56')]||(_0x21bbd2[_0xa634('0x44')]&&_0x21bbd2[_0xa634('0x44')][0x0]?_0x21bbd2['attrs'][0x0][_0xa634('0x42')]:undefined)||null,'value':_0x21bbd2[_0xa634('0x55')]||(_0x21bbd2['attrs']&&_0x21bbd2[_0xa634('0x44')][0x0]?_0x21bbd2[_0xa634('0x44')][0x0][_0xa634('0x45')]:undefined)||null},{'name':_0xa634('0x57'),'value':_0x21bbd2[_0xa634('0x57')]||(_0x21bbd2[_0xa634('0x44')]&&_0x21bbd2[_0xa634('0x44')][0x1]?_0x21bbd2[_0xa634('0x44')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x29d170){logger[_0xa634('0x2f')]('widgetAttributes:\x20%s',JSON[_0xa634('0x58')](_0x29d170));return[];}}exports['create']=function(_0x489bd5,_0x5e4de7){if(_0x489bd5['body']){_0x489bd5[_0xa634('0x59')][_0xa634('0x44')]=widgetAttributes(_0x489bd5[_0xa634('0x59')]);}return db['DashboardItem']['create'](_0x489bd5[_0xa634('0x59')],{})[_0xa634('0x2d')](respondWithResult(_0x5e4de7,0xc9))[_0xa634('0x40')](handleError(_0x5e4de7,null));};exports[_0xa634('0x2c')]=function(_0x1f52f4,_0x59f8a5){if(_0x1f52f4[_0xa634('0x59')]['id']){delete _0x1f52f4['body']['id'];}_0x1f52f4['body']['attrs']=widgetAttributes(_0x1f52f4[_0xa634('0x59')]);return db[_0xa634('0x37')][_0xa634('0x3f')]({'where':{'id':_0x1f52f4[_0xa634('0x34')]['id']}})['then'](handleEntityNotFound(_0x59f8a5,null))['then'](saveUpdates(_0x1f52f4[_0xa634('0x59')],null))['then'](respondWithResult(_0x59f8a5,null))[_0xa634('0x40')](handleError(_0x59f8a5,null));}; \ No newline at end of file +var _0xda06=['custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','attrFontSize','counter','attrMetric','total','attrVoiceQueues','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrReport','reportType','attrRefresh','stringify','create','body','catch','rimraf','zip-dir','moment','bluebird','mustache','util','path','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','show','params','model','DashboardItem','rawAttributes','query','keys','filters','intersection','attributes','fields','length','includeAll','include','merge','options','find','type','iframe','attrUrl','attrs','value','https://'];(function(_0x2027f5,_0x5a68c1){var _0x346d21=function(_0x28735c){while(--_0x28735c){_0x2027f5['push'](_0x2027f5['shift']());}};_0x346d21(++_0x5a68c1);}(_0xda06,0x176));var _0x6da0=function(_0x2d94b5,_0x365c4d){_0x2d94b5=_0x2d94b5-0x0;var _0x5d8cce=_0xda06[_0x2d94b5];return _0x5d8cce;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6da0('0x0'));var zipdir=require(_0x6da0('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x6da0('0x2'));var BPromise=require(_0x6da0('0x3'));var Mustache=require(_0x6da0('0x4'));var util=require(_0x6da0('0x5'));var path=require(_0x6da0('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x6da0('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x6da0('0x8'));var crypto=require(_0x6da0('0x9'));var jsforce=require(_0x6da0('0xa'));var deskjs=require(_0x6da0('0xb'));var toCsv=require('to-csv');var querystring=require(_0x6da0('0xc'));var Papa=require(_0x6da0('0xd'));var Redis=require(_0x6da0('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x6da0('0xf'))('api');var utils=require(_0x6da0('0x10'));var config=require('../../config/environment');var licenseUtil=require(_0x6da0('0x11'));var db=require(_0x6da0('0x12'))['db'];config[_0x6da0('0x13')]=_[_0x6da0('0x14')](config['redis'],{'host':_0x6da0('0x15'),'port':0x18eb});var socket=require(_0x6da0('0x16'))(new Redis(config[_0x6da0('0x13')]));require(_0x6da0('0x17'))['register'](socket);function respondWithStatusCode(_0x1fa54b,_0x295c2c){_0x295c2c=_0x295c2c||0xcc;return function(_0x2926e1){if(_0x2926e1){return _0x1fa54b[_0x6da0('0x18')](_0x295c2c);}return _0x1fa54b[_0x6da0('0x19')](_0x295c2c)[_0x6da0('0x1a')]();};}function respondWithResult(_0x2ce332,_0x191452){_0x191452=_0x191452||0xc8;return function(_0x139aac){if(_0x139aac){return _0x2ce332[_0x6da0('0x19')](_0x191452)[_0x6da0('0x1b')](_0x139aac);}};}function respondWithFilteredResult(_0x5ac5d5,_0x53b6cf){return function(_0x12a074){if(_0x12a074){var _0x8d1561=typeof _0x53b6cf[_0x6da0('0x1c')]===_0x6da0('0x1d')&&typeof _0x53b6cf[_0x6da0('0x1e')]==='undefined';var _0x43f89c=_0x12a074[_0x6da0('0x1f')];var _0x3f393e=_0x8d1561?0x0:_0x53b6cf[_0x6da0('0x1c')];var _0x576d28=_0x8d1561?_0x12a074[_0x6da0('0x1f')]:_0x53b6cf[_0x6da0('0x1c')]+_0x53b6cf[_0x6da0('0x1e')];var _0x21d43e;if(_0x576d28>=_0x43f89c){_0x576d28=_0x43f89c;_0x21d43e=0xc8;}else{_0x21d43e=0xce;}_0x5ac5d5[_0x6da0('0x19')](_0x21d43e);return _0x5ac5d5[_0x6da0('0x20')](_0x6da0('0x21'),_0x3f393e+'-'+_0x576d28+'/'+_0x43f89c)['json'](_0x12a074);}return null;};}function patchUpdates(_0x2681dd){return function(_0x110bef){try{jsonpatch[_0x6da0('0x22')](_0x110bef,_0x2681dd,!![]);}catch(_0x36ac4c){return BPromise[_0x6da0('0x23')](_0x36ac4c);}return _0x110bef[_0x6da0('0x24')]();};}function saveUpdates(_0x535003,_0x195394){return function(_0x12fb07){if(_0x12fb07){return _0x12fb07[_0x6da0('0x25')](_0x535003)[_0x6da0('0x26')](function(_0x344bd2){return _0x344bd2;});}return null;};}function removeEntity(_0x2d721c,_0x323e95){return function(_0xba7a7c){if(_0xba7a7c){return _0xba7a7c[_0x6da0('0x27')]()[_0x6da0('0x26')](function(){_0x2d721c[_0x6da0('0x19')](0xcc)[_0x6da0('0x1a')]();});}};}function handleEntityNotFound(_0x130023,_0x599163){return function(_0xb70bfb){if(!_0xb70bfb){_0x130023['sendStatus'](0x194);}return _0xb70bfb;};}function handleError(_0x20ebe2,_0x3d88d1){_0x3d88d1=_0x3d88d1||0x1f4;return function(_0x4413dd){logger[_0x6da0('0x28')](_0x4413dd[_0x6da0('0x29')]);if(_0x4413dd[_0x6da0('0x2a')]){delete _0x4413dd['name'];}_0x20ebe2[_0x6da0('0x19')](_0x3d88d1)['send'](_0x4413dd);};}exports[_0x6da0('0x2b')]=function(_0x3c3b51,_0x5a9509){var _0xe1af0d={'raw':![],'where':{'id':_0x3c3b51[_0x6da0('0x2c')]['id']}},_0x4826ed={};_0x4826ed[_0x6da0('0x2d')]=_['keys'](db[_0x6da0('0x2e')][_0x6da0('0x2f')]);_0x4826ed[_0x6da0('0x30')]=_[_0x6da0('0x31')](_0x3c3b51['query']);_0x4826ed[_0x6da0('0x32')]=_[_0x6da0('0x33')](_0x4826ed[_0x6da0('0x2d')],_0x4826ed[_0x6da0('0x30')]);_0xe1af0d[_0x6da0('0x34')]=_[_0x6da0('0x33')](_0x4826ed[_0x6da0('0x2d')],qs[_0x6da0('0x35')](_0x3c3b51[_0x6da0('0x30')][_0x6da0('0x35')]));_0xe1af0d['attributes']=_0xe1af0d[_0x6da0('0x34')][_0x6da0('0x36')]?_0xe1af0d['attributes']:_0x4826ed[_0x6da0('0x2d')];if(_0x3c3b51['query'][_0x6da0('0x37')]){_0xe1af0d[_0x6da0('0x38')]=[{'all':!![]}];}_0xe1af0d=_[_0x6da0('0x39')]({},_0xe1af0d,_0x3c3b51[_0x6da0('0x3a')]);return db['DashboardItem'][_0x6da0('0x3b')](_0xe1af0d)[_0x6da0('0x26')](handleEntityNotFound(_0x5a9509,null))[_0x6da0('0x26')](respondWithResult(_0x5a9509,null))['catch'](handleError(_0x5a9509,null));};exports['destroy']=function(_0x15043c,_0x3f4ddc){return db[_0x6da0('0x2e')]['find']({'where':{'id':_0x15043c[_0x6da0('0x2c')]['id']}})[_0x6da0('0x26')](handleEntityNotFound(_0x3f4ddc,null))[_0x6da0('0x26')](removeEntity(_0x3f4ddc,null))['catch'](handleError(_0x3f4ddc,null));};function widgetAttributes(_0xda7b7b){try{switch(_0xda7b7b[_0x6da0('0x3c')]){case _0x6da0('0x3d'):return[{'name':_0x6da0('0x3e'),'value':_0xda7b7b[_0x6da0('0x3e')]||(_0xda7b7b[_0x6da0('0x3f')]&&_0xda7b7b['attrs'][0x0]?_0xda7b7b[_0x6da0('0x3f')][0x0][_0x6da0('0x40')]:undefined)||_0x6da0('0x41')}];case _0x6da0('0x42'):return[{'name':_0x6da0('0x43'),'value':_0xda7b7b[_0x6da0('0x43')]||(_0xda7b7b[_0x6da0('0x3f')]&&_0xda7b7b[_0x6da0('0x3f')][0x0]?_0xda7b7b[_0x6da0('0x3f')][0x0][_0x6da0('0x40')]:undefined)||''}];case _0x6da0('0x44'):return[{'name':_0x6da0('0x45'),'value':_0xda7b7b[_0x6da0('0x45')]||(_0xda7b7b[_0x6da0('0x3f')]&&_0xda7b7b[_0x6da0('0x3f')][0x0]?_0xda7b7b['attrs'][0x0][_0x6da0('0x40')]:undefined)||_0x6da0('0x46')},{'name':_0x6da0('0x47'),'value':_0xda7b7b['attrTimezone']||(_0xda7b7b[_0x6da0('0x3f')]&&_0xda7b7b['attrs'][0x1]?_0xda7b7b['attrs'][0x1][_0x6da0('0x40')]:undefined)||'0.00'},{'name':'attrFontSize','value':_0xda7b7b[_0x6da0('0x48')]||(_0xda7b7b['attrs']&&_0xda7b7b[_0x6da0('0x3f')][0x2]?_0xda7b7b[_0x6da0('0x3f')][0x2][_0x6da0('0x40')]:undefined)||0xc}];case _0x6da0('0x49'):return[{'name':_0x6da0('0x4a'),'value':_0xda7b7b[_0x6da0('0x4a')]||(_0xda7b7b['attrs']&&_0xda7b7b[_0x6da0('0x3f')][0x0]?_0xda7b7b[_0x6da0('0x3f')][0x0][_0x6da0('0x40')]:undefined)||_0x6da0('0x4b')},{'name':'attrVoiceQueues','value':_0xda7b7b[_0x6da0('0x4c')]||(_0xda7b7b['attrs']&&_0xda7b7b[_0x6da0('0x3f')][0x1]?_0xda7b7b['attrs'][0x1][_0x6da0('0x40')]:undefined)||[]},{'name':_0x6da0('0x48'),'value':_0xda7b7b['attrFontSize']||(_0xda7b7b[_0x6da0('0x3f')]&&_0xda7b7b[_0x6da0('0x3f')][0x2]?_0xda7b7b[_0x6da0('0x3f')][0x2]['value']:undefined)||0x14}];case'multibar-chart':case _0x6da0('0x4d'):return[{'name':_0x6da0('0x4e'),'value':_0xda7b7b[_0x6da0('0x4e')]||(_0xda7b7b[_0x6da0('0x3f')]&&_0xda7b7b['attrs'][0x0]?_0xda7b7b[_0x6da0('0x3f')][0x0]['value']:undefined)||_0x6da0('0x4b')},{'name':_0x6da0('0x4f'),'value':_0xda7b7b[_0x6da0('0x4f')]||(_0xda7b7b[_0x6da0('0x3f')]&&_0xda7b7b['attrs'][0x1]?_0xda7b7b['attrs'][0x1]['value']:undefined)||null},{'name':_0x6da0('0x50'),'value':_0xda7b7b[_0x6da0('0x50')]||(_0xda7b7b['attrs']&&_0xda7b7b['attrs'][0x2]?_0xda7b7b[_0x6da0('0x3f')][0x2][_0x6da0('0x40')]:undefined)||null},{'name':_0x6da0('0x4c'),'value':_0xda7b7b[_0x6da0('0x4c')]||(_0xda7b7b[_0x6da0('0x3f')]&&_0xda7b7b[_0x6da0('0x3f')][0x3]?_0xda7b7b['attrs'][0x3]['value']:undefined)||[]}];case'web-report':return[{'name':_0x6da0('0x51'),'type':_0xda7b7b[_0x6da0('0x52')]||(_0xda7b7b[_0x6da0('0x3f')]&&_0xda7b7b[_0x6da0('0x3f')][0x0]?_0xda7b7b[_0x6da0('0x3f')][0x0]['type']:undefined)||null,'value':_0xda7b7b[_0x6da0('0x51')]||(_0xda7b7b[_0x6da0('0x3f')]&&_0xda7b7b['attrs'][0x0]?_0xda7b7b[_0x6da0('0x3f')][0x0][_0x6da0('0x40')]:undefined)||null},{'name':_0x6da0('0x53'),'value':_0xda7b7b[_0x6da0('0x53')]||(_0xda7b7b[_0x6da0('0x3f')]&&_0xda7b7b['attrs'][0x1]?_0xda7b7b[_0x6da0('0x3f')][0x1][_0x6da0('0x40')]:undefined)||0x0}];default:return[];}}catch(_0x4e1f8f){logger['error']('widgetAttributes:\x20%s',JSON[_0x6da0('0x54')](_0x4e1f8f));return[];}}exports[_0x6da0('0x55')]=function(_0x48db4f,_0x873c6e){if(_0x48db4f[_0x6da0('0x56')]){_0x48db4f[_0x6da0('0x56')]['attrs']=widgetAttributes(_0x48db4f[_0x6da0('0x56')]);}return db[_0x6da0('0x2e')]['create'](_0x48db4f[_0x6da0('0x56')],{})[_0x6da0('0x26')](respondWithResult(_0x873c6e,0xc9))[_0x6da0('0x57')](handleError(_0x873c6e,null));};exports[_0x6da0('0x25')]=function(_0x2b9b99,_0x10df86){if(_0x2b9b99[_0x6da0('0x56')]['id']){delete _0x2b9b99['body']['id'];}_0x2b9b99[_0x6da0('0x56')][_0x6da0('0x3f')]=widgetAttributes(_0x2b9b99[_0x6da0('0x56')]);return db[_0x6da0('0x2e')][_0x6da0('0x3b')]({'where':{'id':_0x2b9b99[_0x6da0('0x2c')]['id']}})[_0x6da0('0x26')](handleEntityNotFound(_0x10df86,null))[_0x6da0('0x26')](saveUpdates(_0x2b9b99['body'],null))[_0x6da0('0x26')](respondWithResult(_0x10df86,null))['catch'](handleError(_0x10df86,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index 76fb778..48c5a0f 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 _0x3482=['../../mysqldb','DashboardItem','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x92c539,_0x325156){var _0x4fca02=function(_0x5f34da){while(--_0x5f34da){_0x92c539['push'](_0x92c539['shift']());}};_0x4fca02(++_0x325156);}(_0x3482,0x1cd));var _0x2348=function(_0x57bd47,_0x321b35){_0x57bd47=_0x57bd47-0x0;var _0x2c1ce3=_0x3482[_0x57bd47];return _0x2c1ce3;};'use strict';var EventEmitter=require(_0x2348('0x0'));var DashboardItem=require(_0x2348('0x1'))['db'][_0x2348('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x2348('0x3')](0x0);var events={'afterCreate':_0x2348('0x4'),'afterUpdate':_0x2348('0x5'),'afterDestroy':_0x2348('0x6')};function emitEvent(_0x2978dd){return function(_0x150128,_0x82d54b,_0x1c3dfb){DashboardItemEvents[_0x2348('0x7')](_0x2978dd+':'+_0x150128['id'],_0x150128);DashboardItemEvents[_0x2348('0x7')](_0x2978dd,_0x150128);_0x1c3dfb(null);};}for(var e in events){if(events[_0x2348('0x8')](e)){var event=events[e];DashboardItem[_0x2348('0x9')](e,emitEvent(event));}}module[_0x2348('0xa')]=DashboardItemEvents; \ No newline at end of file +var _0xb5d7=['setMaxListeners','update','remove','emit','hasOwnProperty','exports','events','../../mysqldb','DashboardItem'];(function(_0x1e62a8,_0x3bc41b){var _0x3482d7=function(_0x3815c6){while(--_0x3815c6){_0x1e62a8['push'](_0x1e62a8['shift']());}};_0x3482d7(++_0x3bc41b);}(_0xb5d7,0x1da));var _0x7b5d=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0xb5d7[_0x2d7f0e];return _0x110b07;};'use strict';var EventEmitter=require(_0x7b5d('0x0'));var DashboardItem=require(_0x7b5d('0x1'))['db'][_0x7b5d('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x7b5d('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7b5d('0x4'),'afterDestroy':_0x7b5d('0x5')};function emitEvent(_0xc014c4){return function(_0x46ab57,_0x12afb5,_0x316274){DashboardItemEvents[_0x7b5d('0x6')](_0xc014c4+':'+_0x46ab57['id'],_0x46ab57);DashboardItemEvents[_0x7b5d('0x6')](_0xc014c4,_0x46ab57);_0x316274(null);};}for(var e in events){if(events[_0x7b5d('0x7')](e)){var event=events[e];DashboardItem['hook'](e,emitEvent(event));}}module[_0x7b5d('0x8')]=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index f8bf941..a29cfab 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 _0xecd5=['DashboardItem','dashboard_items','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./dashboardItem.attributes'];(function(_0x4f48ca,_0x4d37e8){var _0x43c2a5=function(_0x5aab69){while(--_0x5aab69){_0x4f48ca['push'](_0x4f48ca['shift']());}};_0x43c2a5(++_0x4d37e8);}(_0xecd5,0x110));var _0x5ecd=function(_0x4130e3,_0x2ca182){_0x4130e3=_0x4130e3-0x0;var _0x3235eb=_0xecd5[_0x4130e3];return _0x3235eb;};'use strict';var _=require('lodash');var util=require(_0x5ecd('0x0'));var logger=require(_0x5ecd('0x1'))(_0x5ecd('0x2'));var moment=require('moment');var BPromise=require(_0x5ecd('0x3'));var rp=require(_0x5ecd('0x4'));var fs=require('fs');var path=require(_0x5ecd('0x5'));var rimraf=require(_0x5ecd('0x6'));var config=require('../../config/environment');var attributes=require(_0x5ecd('0x7'));module['exports']=function(_0x1ddbad,_0x492eba){return _0x1ddbad['define'](_0x5ecd('0x8'),attributes,{'tableName':_0x5ecd('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4f79=['../../config/environment','exports','define','dashboard_items','lodash','util','api','moment','bluebird','path','rimraf'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x4f79,0x1d2));var _0x94f7=function(_0x51b03f,_0x4250cc){_0x51b03f=_0x51b03f-0x0;var _0x173e45=_0x4f79[_0x51b03f];return _0x173e45;};'use strict';var _=require(_0x94f7('0x0'));var util=require(_0x94f7('0x1'));var logger=require('../../config/logger')(_0x94f7('0x2'));var moment=require(_0x94f7('0x3'));var BPromise=require(_0x94f7('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x94f7('0x5'));var rimraf=require(_0x94f7('0x6'));var config=require(_0x94f7('0x7'));var attributes=require('./dashboardItem.attributes');module[_0x94f7('0x8')]=function(_0x30bae8,_0x4314b2){return _0x30bae8[_0x94f7('0x9')]('DashboardItem',attributes,{'tableName':_0x94f7('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 61431ca..f86994e 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 _0x60c5=['result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','http','redis','localhost','./dashboardItem.socket','register','request','then','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info'];(function(_0x38ee8f,_0x23c2e6){var _0x379696=function(_0x9d0020){while(--_0x9d0020){_0x38ee8f['push'](_0x38ee8f['shift']());}};_0x379696(++_0x23c2e6);}(_0x60c5,0xd9));var _0x560c=function(_0x4b124a,_0x536538){_0x4b124a=_0x4b124a-0x0;var _0x46de58=_0x60c5[_0x4b124a];return _0x46de58;};'use strict';var _=require(_0x560c('0x0'));var util=require(_0x560c('0x1'));var moment=require(_0x560c('0x2'));var BPromise=require(_0x560c('0x3'));var rs=require(_0x560c('0x4'));var fs=require('fs');var Redis=require(_0x560c('0x5'));var db=require(_0x560c('0x6'))['db'];var utils=require(_0x560c('0x7'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x560c('0x8'));var client=jayson[_0x560c('0x9')][_0x560c('0xa')]({'port':0x232a});config[_0x560c('0xb')]=_['defaults'](config[_0x560c('0xb')],{'host':_0x560c('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x560c('0xb')]));require(_0x560c('0xd'))[_0x560c('0xe')](socket);function respondWithRpcPromise(_0x352018,_0x56f08c,_0x4627e8){return new BPromise(function(_0x32000e,_0x4e1b9b){return client[_0x560c('0xf')](_0x352018,_0x4627e8)[_0x560c('0x10')](function(_0x140b66){logger['info'](_0x560c('0x11'),_0x56f08c,_0x560c('0x12'));logger[_0x560c('0x13')](_0x560c('0x14'),_0x56f08c,'request\x20sent',JSON[_0x560c('0x15')](_0x140b66));if(_0x140b66[_0x560c('0x16')]){if(_0x140b66[_0x560c('0x16')][_0x560c('0x17')]===0x1f4){logger[_0x560c('0x16')](_0x560c('0x11'),_0x56f08c,_0x140b66[_0x560c('0x16')]['message']);return _0x4e1b9b(_0x140b66[_0x560c('0x16')][_0x560c('0x18')]);}logger['error'](_0x560c('0x11'),_0x56f08c,_0x140b66[_0x560c('0x16')][_0x560c('0x18')]);return _0x32000e(_0x140b66[_0x560c('0x16')][_0x560c('0x18')]);}else{logger[_0x560c('0x19')](_0x560c('0x11'),_0x56f08c,_0x560c('0x12'));_0x32000e(_0x140b66[_0x560c('0x1a')][_0x560c('0x18')]);}})['catch'](function(_0x32c039){logger[_0x560c('0x16')](_0x560c('0x11'),_0x56f08c,_0x32c039);_0x4e1b9b(_0x32c039);});});} \ No newline at end of file +var _0x8a12=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','moment','bluebird','randomstring'];(function(_0x2bc86a,_0x2bbbcb){var _0x18499f=function(_0x5e6d3d){while(--_0x5e6d3d){_0x2bc86a['push'](_0x2bc86a['shift']());}};_0x18499f(++_0x2bbbcb);}(_0x8a12,0xe3));var _0x28a1=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x8a12[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x28a1('0x0'));var BPromise=require(_0x28a1('0x1'));var rs=require(_0x28a1('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x28a1('0x3'))['db'];var utils=require(_0x28a1('0x4'));var logger=require(_0x28a1('0x5'))(_0x28a1('0x6'));var config=require(_0x28a1('0x7'));var jayson=require(_0x28a1('0x8'));var client=jayson[_0x28a1('0x9')]['http']({'port':0x232a});config['redis']=_['defaults'](config[_0x28a1('0xa')],{'host':_0x28a1('0xb'),'port':0x18eb});var socket=require(_0x28a1('0xc'))(new Redis(config[_0x28a1('0xa')]));require('./dashboardItem.socket')['register'](socket);function respondWithRpcPromise(_0x4c9354,_0xfc97f9,_0x3eadca){return new BPromise(function(_0x98201f,_0x29be0c){return client['request'](_0x4c9354,_0x3eadca)['then'](function(_0x47a356){logger['info'](_0x28a1('0xd'),_0xfc97f9,_0x28a1('0xe'));logger[_0x28a1('0xf')](_0x28a1('0x10'),_0xfc97f9,_0x28a1('0xe'),JSON[_0x28a1('0x11')](_0x47a356));if(_0x47a356['error']){if(_0x47a356['error']['code']===0x1f4){logger[_0x28a1('0x12')](_0x28a1('0xd'),_0xfc97f9,_0x47a356[_0x28a1('0x12')][_0x28a1('0x13')]);return _0x29be0c(_0x47a356[_0x28a1('0x12')]['message']);}logger['error'](_0x28a1('0xd'),_0xfc97f9,_0x47a356['error']['message']);return _0x98201f(_0x47a356[_0x28a1('0x12')][_0x28a1('0x13')]);}else{logger[_0x28a1('0x14')](_0x28a1('0xd'),_0xfc97f9,_0x28a1('0xe'));_0x98201f(_0x47a356[_0x28a1('0x15')][_0x28a1('0x13')]);}})[_0x28a1('0x16')](function(_0x3f0f51){logger[_0x28a1('0x12')](_0x28a1('0xd'),_0xfc97f9,_0x3f0f51);_0x29be0c(_0x3f0f51);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index 5d3bd89..4382a88 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 _0xf072=['emit','length','./dashboardItem.events','save','remove','update'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xf072,0x74));var _0x2f07=function(_0x3ea94c,_0x4928a9){_0x3ea94c=_0x3ea94c-0x0;var _0x2a991d=_0xf072[_0x3ea94c];return _0x2a991d;};'use strict';var DashboardItemEvents=require(_0x2f07('0x0'));var events=[_0x2f07('0x1'),_0x2f07('0x2'),_0x2f07('0x3')];function createListener(_0x455be0,_0x27717c){return function(_0x561a0c){_0x27717c[_0x2f07('0x4')](_0x455be0,_0x561a0c);};}function removeListener(_0xf801b4,_0x2efa42){return function(){DashboardItemEvents['removeListener'](_0xf801b4,_0x2efa42);};}exports['register']=function(_0x1f38b1){for(var _0x4ceffe=0x0,_0x1dadb5=events[_0x2f07('0x5')];_0x4ceffe<_0x1dadb5;_0x4ceffe++){var _0x4db6fb=events[_0x4ceffe];var _0x57fe88=createListener('dashboardItem:'+_0x4db6fb,_0x1f38b1);DashboardItemEvents['on'](_0x4db6fb,_0x57fe88);}}; \ No newline at end of file +var _0x5bfa=['dashboardItem:','./dashboardItem.events','save','update','register','length'];(function(_0x312abc,_0x17f25c){var _0x314298=function(_0x1d2e48){while(--_0x1d2e48){_0x312abc['push'](_0x312abc['shift']());}};_0x314298(++_0x17f25c);}(_0x5bfa,0x10f));var _0xa5bf=function(_0x46ae5a,_0x2a38d0){_0x46ae5a=_0x46ae5a-0x0;var _0x434986=_0x5bfa[_0x46ae5a];return _0x434986;};'use strict';var DashboardItemEvents=require(_0xa5bf('0x0'));var events=[_0xa5bf('0x1'),'remove',_0xa5bf('0x2')];function createListener(_0x3b7d41,_0x30dd54){return function(_0x7a1186){_0x30dd54['emit'](_0x3b7d41,_0x7a1186);};}function removeListener(_0x33c752,_0xd32a2a){return function(){DashboardItemEvents['removeListener'](_0x33c752,_0xd32a2a);};}exports[_0xa5bf('0x3')]=function(_0x431b9f){for(var _0x28a9ac=0x0,_0x5389c4=events[_0xa5bf('0x4')];_0x28a9ac<_0x5389c4;_0x28a9ac++){var _0x4ac85d=events[_0x28a9ac];var _0xc9439f=createListener(_0xa5bf('0x5')+_0x4ac85d,_0x431b9f);DashboardItemEvents['on'](_0x4ac85d,_0xc9439f);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index d533849..2e29304 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 _0xf3f3=['../../config/environment','./dashboardItem.controller','get','/:id','isAuthenticated','show','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x32342f,_0xfbc976){var _0x548046=function(_0x34767a){while(--_0x34767a){_0x32342f['push'](_0x32342f['shift']());}};_0x548046(++_0xfbc976);}(_0xf3f3,0x1e6));var _0x3f3f=function(_0x27d958,_0x29ef87){_0x27d958=_0x27d958-0x0;var _0x53e63e=_0xf3f3[_0x27d958];return _0x53e63e;};'use strict';var multer=require('multer');var util=require(_0x3f3f('0x0'));var path=require(_0x3f3f('0x1'));var timeout=require(_0x3f3f('0x2'));var express=require(_0x3f3f('0x3'));var router=express[_0x3f3f('0x4')]();var fs_extra=require(_0x3f3f('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x3f3f('0x6'));var config=require(_0x3f3f('0x7'));var controller=require(_0x3f3f('0x8'));router[_0x3f3f('0x9')](_0x3f3f('0xa'),auth[_0x3f3f('0xb')](),controller[_0x3f3f('0xc')]);router['post']('/',auth[_0x3f3f('0xb')](),controller['create']);router['put'](_0x3f3f('0xa'),auth['isAuthenticated'](),controller[_0x3f3f('0xd')]);router[_0x3f3f('0xe')]('/:id',auth[_0x3f3f('0xb')](),controller[_0x3f3f('0xf')]);module[_0x3f3f('0x10')]=router; \ No newline at end of file +var _0xd08d=['get','/:id','isAuthenticated','create','put','update','delete','destroy','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboardItem.controller'];(function(_0x32ce31,_0x2f87d2){var _0xf13059=function(_0x101702){while(--_0x101702){_0x32ce31['push'](_0x32ce31['shift']());}};_0xf13059(++_0x2f87d2);}(_0xd08d,0x1d3));var _0xdd08=function(_0x3ec1da,_0x1e36f5){_0x3ec1da=_0x3ec1da-0x0;var _0x472358=_0xd08d[_0x3ec1da];return _0x472358;};'use strict';var multer=require(_0xdd08('0x0'));var util=require('util');var path=require(_0xdd08('0x1'));var timeout=require(_0xdd08('0x2'));var express=require(_0xdd08('0x3'));var router=express['Router']();var fs_extra=require(_0xdd08('0x4'));var auth=require(_0xdd08('0x5'));var interaction=require(_0xdd08('0x6'));var config=require(_0xdd08('0x7'));var controller=require(_0xdd08('0x8'));router[_0xdd08('0x9')](_0xdd08('0xa'),auth[_0xdd08('0xb')](),controller['show']);router['post']('/',auth[_0xdd08('0xb')](),controller[_0xdd08('0xc')]);router[_0xdd08('0xd')](_0xdd08('0xa'),auth['isAuthenticated'](),controller[_0xdd08('0xe')]);router[_0xdd08('0xf')](_0xdd08('0xa'),auth[_0xdd08('0xb')](),controller[_0xdd08('0x10')]);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 dc9cb66..69ffd28 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 _0x880e=['STRING','ENUM','first','second','third','sequelize','exports'];(function(_0x484fea,_0x3a11a0){var _0x543077=function(_0x7a22c9){while(--_0x7a22c9){_0x484fea['push'](_0x484fea['shift']());}};_0x543077(++_0x3a11a0);}(_0x880e,0x83));var _0xe880=function(_0x1d8119,_0xc98f17){_0x1d8119=_0x1d8119-0x0;var _0x3e30f6=_0x880e[_0x1d8119];return _0x3e30f6;};'use strict';var Sequelize=require(_0xe880('0x0'));module[_0xe880('0x1')]={'name':{'type':Sequelize[_0xe880('0x2')],'allowNull':![]},'level':{'type':Sequelize[_0xe880('0x3')](_0xe880('0x4'),_0xe880('0x5'),_0xe880('0x6')),'allowNull':![],'defaultValue':_0xe880('0x4')},'description':{'type':Sequelize[_0xe880('0x2')]}}; \ No newline at end of file +var _0xae58=['third','first','sequelize','STRING','ENUM','second'];(function(_0x2c1dcd,_0x350452){var _0x158ce5=function(_0x5c1c57){while(--_0x5c1c57){_0x2c1dcd['push'](_0x2c1dcd['shift']());}};_0x158ce5(++_0x350452);}(_0xae58,0xe0));var _0x8ae5=function(_0x565fed,_0xb85768){_0x565fed=_0x565fed-0x0;var _0x3e018f=_0xae58[_0x565fed];return _0x3e018f;};'use strict';var Sequelize=require(_0x8ae5('0x0'));module['exports']={'name':{'type':Sequelize[_0x8ae5('0x1')],'allowNull':![]},'level':{'type':Sequelize[_0x8ae5('0x2')]('first',_0x8ae5('0x3'),_0x8ae5('0x4')),'allowNull':![],'defaultValue':_0x8ae5('0x5')},'description':{'type':Sequelize[_0x8ae5('0x1')]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index 7dda228..7b308bf 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 _0x3761=['undefined','limit','count','Content-Range','apply','reject','save','update','destroy','get','Dispositions','UserProfileResource','then','sendStatus','stack','name','index','map','Disposition','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','options','includeAll','findAll','catch','show','params','include','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','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset'];(function(_0x2dec07,_0x370ba8){var _0x20f85a=function(_0x13a62e){while(--_0x13a62e){_0x2dec07['push'](_0x2dec07['shift']());}};_0x20f85a(++_0x370ba8);}(_0x3761,0x8a));var _0x1376=function(_0x40227e,_0x2a1c52){_0x40227e=_0x40227e-0x0;var _0x419728=_0x3761[_0x40227e];return _0x419728;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1376('0x0'));var zipdir=require(_0x1376('0x1'));var jsonpatch=require(_0x1376('0x2'));var rp=require(_0x1376('0x3'));var moment=require(_0x1376('0x4'));var BPromise=require(_0x1376('0x5'));var Mustache=require(_0x1376('0x6'));var util=require('util');var path=require(_0x1376('0x7'));var sox=require('sox');var csv=require(_0x1376('0x8'));var ejs=require(_0x1376('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1376('0xa'));var squel=require('squel');var crypto=require(_0x1376('0xb'));var jsforce=require(_0x1376('0xc'));var deskjs=require(_0x1376('0xd'));var toCsv=require(_0x1376('0x8'));var querystring=require(_0x1376('0xe'));var Papa=require(_0x1376('0xf'));var Redis=require(_0x1376('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x1376('0x11'));var hardwareService=require(_0x1376('0x12'));var logger=require('../../config/logger')(_0x1376('0x13'));var utils=require(_0x1376('0x14'));var config=require(_0x1376('0x15'));var licenseUtil=require(_0x1376('0x16'));var db=require(_0x1376('0x17'))['db'];function respondWithStatusCode(_0x27c397,_0x174f43){_0x174f43=_0x174f43||0xcc;return function(_0x241feb){if(_0x241feb){return _0x27c397['sendStatus'](_0x174f43);}return _0x27c397[_0x1376('0x18')](_0x174f43)[_0x1376('0x19')]();};}function respondWithResult(_0x145b54,_0x46f2b1){_0x46f2b1=_0x46f2b1||0xc8;return function(_0x3c3f3f){if(_0x3c3f3f){return _0x145b54[_0x1376('0x18')](_0x46f2b1)[_0x1376('0x1a')](_0x3c3f3f);}};}function respondWithFilteredResult(_0x3ba567,_0x5b21ac){return function(_0x2e6a5d){if(_0x2e6a5d){var _0x2a22c7=typeof _0x5b21ac[_0x1376('0x1b')]===_0x1376('0x1c')&&typeof _0x5b21ac[_0x1376('0x1d')]==='undefined';var _0x4c6f74=_0x2e6a5d[_0x1376('0x1e')];var _0x42b1b4=_0x2a22c7?0x0:_0x5b21ac[_0x1376('0x1b')];var _0x4b3c01=_0x2a22c7?_0x2e6a5d[_0x1376('0x1e')]:_0x5b21ac[_0x1376('0x1b')]+_0x5b21ac[_0x1376('0x1d')];var _0x51f864;if(_0x4b3c01>=_0x4c6f74){_0x4b3c01=_0x4c6f74;_0x51f864=0xc8;}else{_0x51f864=0xce;}_0x3ba567[_0x1376('0x18')](_0x51f864);return _0x3ba567['set'](_0x1376('0x1f'),_0x42b1b4+'-'+_0x4b3c01+'/'+_0x4c6f74)[_0x1376('0x1a')](_0x2e6a5d);}return null;};}function patchUpdates(_0x41b202){return function(_0x3c7cc0){try{jsonpatch[_0x1376('0x20')](_0x3c7cc0,_0x41b202,!![]);}catch(_0x458c3e){return BPromise[_0x1376('0x21')](_0x458c3e);}return _0x3c7cc0[_0x1376('0x22')]();};}function saveUpdates(_0x7924e,_0x4ac7c5){return function(_0x27bd6a){if(_0x27bd6a){return _0x27bd6a[_0x1376('0x23')](_0x7924e)['then'](function(_0x5bca3a){return _0x5bca3a;});}return null;};}function removeEntity(_0x41d483,_0x4f82be){return function(_0x1896c2){if(_0x1896c2){return _0x1896c2[_0x1376('0x24')]()['then'](function(){var _0x4c8d79=_0x1896c2[_0x1376('0x25')]({'plain':!![]});var _0x196594=_0x1376('0x26');return db[_0x1376('0x27')]['destroy']({'where':{'type':_0x196594,'resourceId':_0x4c8d79['id']}})[_0x1376('0x28')](function(){return _0x1896c2;});})[_0x1376('0x28')](function(){_0x41d483['status'](0xcc)[_0x1376('0x19')]();});}};}function handleEntityNotFound(_0x4a68c8,_0x3239db){return function(_0x208f14){if(!_0x208f14){_0x4a68c8[_0x1376('0x29')](0x194);}return _0x208f14;};}function handleError(_0x45b202,_0x376c5a){_0x376c5a=_0x376c5a||0x1f4;return function(_0x58b909){logger['error'](_0x58b909[_0x1376('0x2a')]);if(_0x58b909[_0x1376('0x2b')]){delete _0x58b909['name'];}_0x45b202[_0x1376('0x18')](_0x376c5a)['send'](_0x58b909);};}exports[_0x1376('0x2c')]=function(_0x14603e,_0x67d24){var _0x18ef10={},_0xfc76e1={},_0x51a6cc={'count':0x0,'rows':[]};var _0x345730=_[_0x1376('0x2d')](db[_0x1376('0x2e')][_0x1376('0x2f')],function(_0x5b9143){return{'name':_0x5b9143[_0x1376('0x30')],'type':_0x5b9143[_0x1376('0x31')][_0x1376('0x32')]};});_0xfc76e1[_0x1376('0x33')]=_['map'](_0x345730,'name');_0xfc76e1['query']=_[_0x1376('0x34')](_0x14603e[_0x1376('0x35')]);_0xfc76e1[_0x1376('0x36')]=_[_0x1376('0x37')](_0xfc76e1[_0x1376('0x33')],_0xfc76e1['query']);_0x18ef10[_0x1376('0x38')]=_['intersection'](_0xfc76e1['model'],qs[_0x1376('0x39')](_0x14603e[_0x1376('0x35')][_0x1376('0x39')]));_0x18ef10[_0x1376('0x38')]=_0x18ef10[_0x1376('0x38')][_0x1376('0x3a')]?_0x18ef10[_0x1376('0x38')]:_0xfc76e1[_0x1376('0x33')];if(!_0x14603e['query'][_0x1376('0x3b')](_0x1376('0x3c'))){_0x18ef10[_0x1376('0x1d')]=qs[_0x1376('0x1d')](_0x14603e[_0x1376('0x35')][_0x1376('0x1d')]);_0x18ef10['offset']=qs[_0x1376('0x1b')](_0x14603e[_0x1376('0x35')][_0x1376('0x1b')]);}_0x18ef10[_0x1376('0x3d')]=qs[_0x1376('0x3e')](_0x14603e[_0x1376('0x35')][_0x1376('0x3e')]);_0x18ef10[_0x1376('0x3f')]=qs[_0x1376('0x36')](_[_0x1376('0x40')](_0x14603e[_0x1376('0x35')],_0xfc76e1[_0x1376('0x36')]),_0x345730);if(_0x14603e[_0x1376('0x35')]['filter']){_0x18ef10[_0x1376('0x3f')]=_[_0x1376('0x41')](_0x18ef10[_0x1376('0x3f')],{'$or':_['map'](_0x345730,function(_0x14dfe7){if(_0x14dfe7['type']!=='VIRTUAL'){var _0x52cf02={};_0x52cf02[_0x14dfe7['name']]={'$like':'%'+_0x14603e[_0x1376('0x35')]['filter']+'%'};return _0x52cf02;}})});}_0x18ef10=_[_0x1376('0x41')]({},_0x18ef10,_0x14603e[_0x1376('0x42')]);var _0x837b48={'where':_0x18ef10[_0x1376('0x3f')]};return db[_0x1376('0x2e')][_0x1376('0x1e')](_0x837b48)[_0x1376('0x28')](function(_0x3ed9a3){_0x51a6cc[_0x1376('0x1e')]=_0x3ed9a3;if(_0x14603e[_0x1376('0x35')][_0x1376('0x43')]){_0x18ef10['include']=[{'all':!![]}];}return db[_0x1376('0x2e')][_0x1376('0x44')](_0x18ef10);})[_0x1376('0x28')](function(_0x542633){_0x51a6cc['rows']=_0x542633;return _0x51a6cc;})['then'](respondWithFilteredResult(_0x67d24,_0x18ef10))[_0x1376('0x45')](handleError(_0x67d24,null));};exports[_0x1376('0x46')]=function(_0x5b4c63,_0xd2be50){var _0x55442b={'raw':!![],'where':{'id':_0x5b4c63[_0x1376('0x47')]['id']}},_0x21a831={};_0x21a831['model']=_[_0x1376('0x34')](db['Disposition'][_0x1376('0x2f')]);_0x21a831['query']=_['keys'](_0x5b4c63['query']);_0x21a831[_0x1376('0x36')]=_[_0x1376('0x37')](_0x21a831[_0x1376('0x33')],_0x21a831[_0x1376('0x35')]);_0x55442b[_0x1376('0x38')]=_[_0x1376('0x37')](_0x21a831[_0x1376('0x33')],qs[_0x1376('0x39')](_0x5b4c63['query'][_0x1376('0x39')]));_0x55442b[_0x1376('0x38')]=_0x55442b[_0x1376('0x38')][_0x1376('0x3a')]?_0x55442b[_0x1376('0x38')]:_0x21a831['model'];if(_0x5b4c63['query'][_0x1376('0x43')]){_0x55442b[_0x1376('0x48')]=[{'all':!![]}];}_0x55442b=_[_0x1376('0x41')]({},_0x55442b,_0x5b4c63['options']);return db[_0x1376('0x2e')][_0x1376('0x49')](_0x55442b)[_0x1376('0x28')](handleEntityNotFound(_0xd2be50,null))['then'](respondWithResult(_0xd2be50,null))['catch'](handleError(_0xd2be50,null));};exports['create']=function(_0x2c865b,_0x3a286b){return db['Disposition'][_0x1376('0x4a')](_0x2c865b[_0x1376('0x4b')],{})[_0x1376('0x28')](function(_0x3951d1){var _0x43e1af=_0x2c865b[_0x1376('0x4c')][_0x1376('0x25')]({'plain':!![]});if(!_0x43e1af)throw new Error(_0x1376('0x4d'));if(_0x43e1af[_0x1376('0x4e')]===_0x1376('0x4c')){var _0x432908=_0x3951d1[_0x1376('0x25')]({'plain':!![]});var _0x411f75=_0x1376('0x26');return db[_0x1376('0x4f')]['find']({'where':{'name':_0x411f75,'userProfileId':_0x43e1af[_0x1376('0x50')]},'raw':!![]})[_0x1376('0x28')](function(_0x4fea7b){if(_0x4fea7b&&_0x4fea7b[_0x1376('0x51')]===0x0){return db['UserProfileResource']['create']({'name':_0x432908[_0x1376('0x2b')],'resourceId':_0x432908['id'],'type':_0x4fea7b[_0x1376('0x2b')],'sectionId':_0x4fea7b['id']},{})['then'](function(){return _0x3951d1;});}else{return _0x3951d1;}})[_0x1376('0x45')](function(_0x37c494){logger['error'](_0x1376('0x52'),_0x37c494);throw _0x37c494;});}return _0x3951d1;})[_0x1376('0x28')](respondWithResult(_0x3a286b,0xc9))['catch'](handleError(_0x3a286b,null));};exports['update']=function(_0x1ad280,_0x53226e){if(_0x1ad280[_0x1376('0x4b')]['id']){delete _0x1ad280[_0x1376('0x4b')]['id'];}return db[_0x1376('0x2e')][_0x1376('0x49')]({'where':{'id':_0x1ad280[_0x1376('0x47')]['id']}})[_0x1376('0x28')](handleEntityNotFound(_0x53226e,null))[_0x1376('0x28')](saveUpdates(_0x1ad280['body'],null))[_0x1376('0x28')](respondWithResult(_0x53226e,null))[_0x1376('0x45')](handleError(_0x53226e,null));};exports[_0x1376('0x24')]=function(_0x35a30f,_0x3a5ce1){return db[_0x1376('0x2e')][_0x1376('0x49')]({'where':{'id':_0x35a30f['params']['id']}})['then'](handleEntityNotFound(_0x3a5ce1,null))[_0x1376('0x28')](removeEntity(_0x3a5ce1,null))['catch'](handleError(_0x3a5ce1,null));}; \ No newline at end of file +var _0x70ff=['count','set','Content-Range','reject','update','then','get','Dispositions','destroy','error','stack','name','index','Disposition','fieldName','type','key','model','keys','query','filters','attributes','fields','length','limit','order','sort','where','pick','filter','merge','map','VIRTUAL','include','findAll','rows','catch','show','params','intersection','includeAll','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','sendStatus','status','end','json','offset','undefined'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x70ff,0x1ce));var _0xf70f=function(_0x4fb001,_0x3f9e2e){_0x4fb001=_0x4fb001-0x0;var _0x207eda=_0x70ff[_0x4fb001];return _0x207eda;};'use strict';var emlformat=require(_0xf70f('0x0'));var rimraf=require(_0xf70f('0x1'));var zipdir=require(_0xf70f('0x2'));var jsonpatch=require(_0xf70f('0x3'));var rp=require(_0xf70f('0x4'));var moment=require(_0xf70f('0x5'));var BPromise=require(_0xf70f('0x6'));var Mustache=require(_0xf70f('0x7'));var util=require(_0xf70f('0x8'));var path=require(_0xf70f('0x9'));var sox=require(_0xf70f('0xa'));var csv=require(_0xf70f('0xb'));var ejs=require(_0xf70f('0xc'));var fs=require('fs');var fs_extra=require(_0xf70f('0xd'));var _=require(_0xf70f('0xe'));var squel=require(_0xf70f('0xf'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xf70f('0x10'));var toCsv=require(_0xf70f('0xb'));var querystring=require(_0xf70f('0x11'));var Papa=require(_0xf70f('0x12'));var Redis=require('ioredis');var authService=require(_0xf70f('0x13'));var qs=require(_0xf70f('0x14'));var as=require(_0xf70f('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf70f('0x16'));var utils=require(_0xf70f('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4176b7,_0x5cac1a){_0x5cac1a=_0x5cac1a||0xcc;return function(_0x48931d){if(_0x48931d){return _0x4176b7[_0xf70f('0x18')](_0x5cac1a);}return _0x4176b7[_0xf70f('0x19')](_0x5cac1a)[_0xf70f('0x1a')]();};}function respondWithResult(_0x86c38c,_0x25ec5b){_0x25ec5b=_0x25ec5b||0xc8;return function(_0x4e9da7){if(_0x4e9da7){return _0x86c38c[_0xf70f('0x19')](_0x25ec5b)[_0xf70f('0x1b')](_0x4e9da7);}};}function respondWithFilteredResult(_0x2ecb22,_0x1ab426){return function(_0x5e80b7){if(_0x5e80b7){var _0x15b1f8=typeof _0x1ab426[_0xf70f('0x1c')]===_0xf70f('0x1d')&&typeof _0x1ab426['limit']==='undefined';var _0x51cd11=_0x5e80b7[_0xf70f('0x1e')];var _0x4bdf1b=_0x15b1f8?0x0:_0x1ab426[_0xf70f('0x1c')];var _0x16bbc2=_0x15b1f8?_0x5e80b7['count']:_0x1ab426[_0xf70f('0x1c')]+_0x1ab426['limit'];var _0xbbb397;if(_0x16bbc2>=_0x51cd11){_0x16bbc2=_0x51cd11;_0xbbb397=0xc8;}else{_0xbbb397=0xce;}_0x2ecb22[_0xf70f('0x19')](_0xbbb397);return _0x2ecb22[_0xf70f('0x1f')](_0xf70f('0x20'),_0x4bdf1b+'-'+_0x16bbc2+'/'+_0x51cd11)[_0xf70f('0x1b')](_0x5e80b7);}return null;};}function patchUpdates(_0x54e9f9){return function(_0xff1ef){try{jsonpatch['apply'](_0xff1ef,_0x54e9f9,!![]);}catch(_0x32d8a3){return BPromise[_0xf70f('0x21')](_0x32d8a3);}return _0xff1ef['save']();};}function saveUpdates(_0x4d56be,_0x5e8b71){return function(_0x14f430){if(_0x14f430){return _0x14f430[_0xf70f('0x22')](_0x4d56be)['then'](function(_0x17d6fd){return _0x17d6fd;});}return null;};}function removeEntity(_0x46bc07,_0x367417){return function(_0x5037d6){if(_0x5037d6){return _0x5037d6['destroy']()[_0xf70f('0x23')](function(){var _0x5c90d7=_0x5037d6[_0xf70f('0x24')]({'plain':!![]});var _0x30e150=_0xf70f('0x25');return db['UserProfileResource'][_0xf70f('0x26')]({'where':{'type':_0x30e150,'resourceId':_0x5c90d7['id']}})['then'](function(){return _0x5037d6;});})[_0xf70f('0x23')](function(){_0x46bc07['status'](0xcc)[_0xf70f('0x1a')]();});}};}function handleEntityNotFound(_0x48f76b,_0x49f8c3){return function(_0x9685ba){if(!_0x9685ba){_0x48f76b[_0xf70f('0x18')](0x194);}return _0x9685ba;};}function handleError(_0x5903c5,_0x58588b){_0x58588b=_0x58588b||0x1f4;return function(_0x6bf5f){logger[_0xf70f('0x27')](_0x6bf5f[_0xf70f('0x28')]);if(_0x6bf5f[_0xf70f('0x29')]){delete _0x6bf5f[_0xf70f('0x29')];}_0x5903c5['status'](_0x58588b)['send'](_0x6bf5f);};}exports[_0xf70f('0x2a')]=function(_0xcff797,_0x44365a){var _0x143843={},_0x35d37e={},_0x1e80af={'count':0x0,'rows':[]};var _0xcad622=_['map'](db[_0xf70f('0x2b')]['rawAttributes'],function(_0xcf98dd){return{'name':_0xcf98dd[_0xf70f('0x2c')],'type':_0xcf98dd[_0xf70f('0x2d')][_0xf70f('0x2e')]};});_0x35d37e[_0xf70f('0x2f')]=_['map'](_0xcad622,_0xf70f('0x29'));_0x35d37e['query']=_[_0xf70f('0x30')](_0xcff797[_0xf70f('0x31')]);_0x35d37e[_0xf70f('0x32')]=_['intersection'](_0x35d37e['model'],_0x35d37e['query']);_0x143843[_0xf70f('0x33')]=_['intersection'](_0x35d37e[_0xf70f('0x2f')],qs[_0xf70f('0x34')](_0xcff797[_0xf70f('0x31')][_0xf70f('0x34')]));_0x143843[_0xf70f('0x33')]=_0x143843[_0xf70f('0x33')][_0xf70f('0x35')]?_0x143843[_0xf70f('0x33')]:_0x35d37e[_0xf70f('0x2f')];if(!_0xcff797[_0xf70f('0x31')]['hasOwnProperty']('nolimit')){_0x143843[_0xf70f('0x36')]=qs['limit'](_0xcff797[_0xf70f('0x31')]['limit']);_0x143843[_0xf70f('0x1c')]=qs[_0xf70f('0x1c')](_0xcff797['query'][_0xf70f('0x1c')]);}_0x143843[_0xf70f('0x37')]=qs[_0xf70f('0x38')](_0xcff797[_0xf70f('0x31')]['sort']);_0x143843[_0xf70f('0x39')]=qs[_0xf70f('0x32')](_[_0xf70f('0x3a')](_0xcff797[_0xf70f('0x31')],_0x35d37e['filters']),_0xcad622);if(_0xcff797[_0xf70f('0x31')][_0xf70f('0x3b')]){_0x143843[_0xf70f('0x39')]=_[_0xf70f('0x3c')](_0x143843[_0xf70f('0x39')],{'$or':_[_0xf70f('0x3d')](_0xcad622,function(_0xbeaaae){if(_0xbeaaae[_0xf70f('0x2d')]!==_0xf70f('0x3e')){var _0x36df33={};_0x36df33[_0xbeaaae[_0xf70f('0x29')]]={'$like':'%'+_0xcff797['query'][_0xf70f('0x3b')]+'%'};return _0x36df33;}})});}_0x143843=_[_0xf70f('0x3c')]({},_0x143843,_0xcff797['options']);var _0x234340={'where':_0x143843[_0xf70f('0x39')]};return db[_0xf70f('0x2b')]['count'](_0x234340)[_0xf70f('0x23')](function(_0x4cc68f){_0x1e80af['count']=_0x4cc68f;if(_0xcff797[_0xf70f('0x31')]['includeAll']){_0x143843[_0xf70f('0x3f')]=[{'all':!![]}];}return db[_0xf70f('0x2b')][_0xf70f('0x40')](_0x143843);})[_0xf70f('0x23')](function(_0x2e12c6){_0x1e80af[_0xf70f('0x41')]=_0x2e12c6;return _0x1e80af;})['then'](respondWithFilteredResult(_0x44365a,_0x143843))[_0xf70f('0x42')](handleError(_0x44365a,null));};exports[_0xf70f('0x43')]=function(_0x464866,_0x2efc96){var _0xd615cd={'raw':!![],'where':{'id':_0x464866[_0xf70f('0x44')]['id']}},_0x8a43d5={};_0x8a43d5[_0xf70f('0x2f')]=_['keys'](db[_0xf70f('0x2b')]['rawAttributes']);_0x8a43d5['query']=_[_0xf70f('0x30')](_0x464866[_0xf70f('0x31')]);_0x8a43d5[_0xf70f('0x32')]=_[_0xf70f('0x45')](_0x8a43d5[_0xf70f('0x2f')],_0x8a43d5['query']);_0xd615cd[_0xf70f('0x33')]=_['intersection'](_0x8a43d5[_0xf70f('0x2f')],qs[_0xf70f('0x34')](_0x464866[_0xf70f('0x31')][_0xf70f('0x34')]));_0xd615cd['attributes']=_0xd615cd[_0xf70f('0x33')][_0xf70f('0x35')]?_0xd615cd[_0xf70f('0x33')]:_0x8a43d5[_0xf70f('0x2f')];if(_0x464866[_0xf70f('0x31')][_0xf70f('0x46')]){_0xd615cd[_0xf70f('0x3f')]=[{'all':!![]}];}_0xd615cd=_[_0xf70f('0x3c')]({},_0xd615cd,_0x464866[_0xf70f('0x47')]);return db[_0xf70f('0x2b')][_0xf70f('0x48')](_0xd615cd)[_0xf70f('0x23')](handleEntityNotFound(_0x2efc96,null))['then'](respondWithResult(_0x2efc96,null))['catch'](handleError(_0x2efc96,null));};exports[_0xf70f('0x49')]=function(_0x1f7f59,_0x3397ea){return db[_0xf70f('0x2b')][_0xf70f('0x49')](_0x1f7f59[_0xf70f('0x4a')],{})[_0xf70f('0x23')](function(_0x287e97){var _0xb62ba7=_0x1f7f59[_0xf70f('0x4b')]['get']({'plain':!![]});if(!_0xb62ba7)throw new Error(_0xf70f('0x4c'));if(_0xb62ba7[_0xf70f('0x4d')]===_0xf70f('0x4b')){var _0xb98144=_0x287e97[_0xf70f('0x24')]({'plain':!![]});var _0x296d77=_0xf70f('0x25');return db[_0xf70f('0x4e')][_0xf70f('0x48')]({'where':{'name':_0x296d77,'userProfileId':_0xb62ba7[_0xf70f('0x4f')]},'raw':!![]})[_0xf70f('0x23')](function(_0x3411b1){if(_0x3411b1&&_0x3411b1[_0xf70f('0x50')]===0x0){return db[_0xf70f('0x51')][_0xf70f('0x49')]({'name':_0xb98144[_0xf70f('0x29')],'resourceId':_0xb98144['id'],'type':_0x3411b1['name'],'sectionId':_0x3411b1['id']},{})[_0xf70f('0x23')](function(){return _0x287e97;});}else{return _0x287e97;}})['catch'](function(_0x2acc1d){logger[_0xf70f('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2acc1d);throw _0x2acc1d;});}return _0x287e97;})['then'](respondWithResult(_0x3397ea,0xc9))[_0xf70f('0x42')](handleError(_0x3397ea,null));};exports[_0xf70f('0x22')]=function(_0x51cd32,_0x4aade3){if(_0x51cd32[_0xf70f('0x4a')]['id']){delete _0x51cd32[_0xf70f('0x4a')]['id'];}return db['Disposition'][_0xf70f('0x48')]({'where':{'id':_0x51cd32[_0xf70f('0x44')]['id']}})['then'](handleEntityNotFound(_0x4aade3,null))['then'](saveUpdates(_0x51cd32[_0xf70f('0x4a')],null))[_0xf70f('0x23')](respondWithResult(_0x4aade3,null))[_0xf70f('0x42')](handleError(_0x4aade3,null));};exports[_0xf70f('0x26')]=function(_0x237312,_0x1ecc24){return db[_0xf70f('0x2b')]['find']({'where':{'id':_0x237312['params']['id']}})['then'](handleEntityNotFound(_0x1ecc24,null))[_0xf70f('0x23')](removeEntity(_0x1ecc24,null))[_0xf70f('0x42')](handleError(_0x1ecc24,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index 4aac7ba..45c2abf 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 _0x9fac=['name_mail','MailAccountId','name_sms','FaxAccountId','name_openchannel','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./disposition.attributes','Disposition','tools_dispositions','name_voice','name','ListId'];(function(_0x27d735,_0x13a69d){var _0x441f30=function(_0x47df96){while(--_0x47df96){_0x27d735['push'](_0x27d735['shift']());}};_0x441f30(++_0x13a69d);}(_0x9fac,0x17e));var _0xc9fa=function(_0x5cf52f,_0x2304cc){_0x5cf52f=_0x5cf52f-0x0;var _0x5b4b76=_0x9fac[_0x5cf52f];return _0x5b4b76;};'use strict';var _=require('lodash');var util=require(_0xc9fa('0x0'));var logger=require(_0xc9fa('0x1'))(_0xc9fa('0x2'));var moment=require(_0xc9fa('0x3'));var BPromise=require('bluebird');var rp=require(_0xc9fa('0x4'));var fs=require('fs');var path=require(_0xc9fa('0x5'));var rimraf=require(_0xc9fa('0x6'));var config=require(_0xc9fa('0x7'));var attributes=require(_0xc9fa('0x8'));module['exports']=function(_0xf04a56,_0x17f382){return _0xf04a56['define'](_0xc9fa('0x9'),attributes,{'tableName':_0xc9fa('0xa'),'paranoid':![],'indexes':[{'unique':!![],'name':_0xc9fa('0xb'),'fields':[_0xc9fa('0xc'),_0xc9fa('0xd')]},{'unique':!![],'name':'name_chat','fields':['name','ChatWebsiteId']},{'unique':!![],'name':_0xc9fa('0xe'),'fields':[_0xc9fa('0xc'),_0xc9fa('0xf')]},{'unique':!![],'name':_0xc9fa('0x10'),'fields':[_0xc9fa('0xc'),'SmsAccountId']},{'unique':!![],'name':'name_fax','fields':[_0xc9fa('0xc'),_0xc9fa('0x11')]},{'unique':!![],'name':_0xc9fa('0x12'),'fields':[_0xc9fa('0xc'),_0xc9fa('0x13')]},{'unique':!![],'name':_0xc9fa('0x14'),'fields':[_0xc9fa('0xc'),_0xc9fa('0x15')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4844=['./disposition.attributes','Disposition','name_voice','ListId','name_chat','name','name_mail','MailAccountId','name_sms','SmsAccountId','name_fax','name_openchannel','name_whatsapp','WhatsappAccountId','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x1718b9,_0x4f32d6){var _0x25aa63=function(_0x208942){while(--_0x208942){_0x1718b9['push'](_0x1718b9['shift']());}};_0x25aa63(++_0x4f32d6);}(_0x4844,0x1f2));var _0x4484=function(_0x22ee55,_0x3d1e02){_0x22ee55=_0x22ee55-0x0;var _0x559fc6=_0x4844[_0x22ee55];return _0x559fc6;};'use strict';var _=require(_0x4484('0x0'));var util=require('util');var logger=require(_0x4484('0x1'))(_0x4484('0x2'));var moment=require('moment');var BPromise=require(_0x4484('0x3'));var rp=require(_0x4484('0x4'));var fs=require('fs');var path=require(_0x4484('0x5'));var rimraf=require(_0x4484('0x6'));var config=require(_0x4484('0x7'));var attributes=require(_0x4484('0x8'));module['exports']=function(_0x53edef,_0x5581ea){return _0x53edef['define'](_0x4484('0x9'),attributes,{'tableName':'tools_dispositions','paranoid':![],'indexes':[{'unique':!![],'name':_0x4484('0xa'),'fields':['name',_0x4484('0xb')]},{'unique':!![],'name':_0x4484('0xc'),'fields':[_0x4484('0xd'),'ChatWebsiteId']},{'unique':!![],'name':_0x4484('0xe'),'fields':[_0x4484('0xd'),_0x4484('0xf')]},{'unique':!![],'name':_0x4484('0x10'),'fields':[_0x4484('0xd'),_0x4484('0x11')]},{'unique':!![],'name':_0x4484('0x12'),'fields':[_0x4484('0xd'),'FaxAccountId']},{'unique':!![],'name':_0x4484('0x13'),'fields':[_0x4484('0xd'),'OpenchannelAccountId']},{'unique':!![],'name':_0x4484('0x14'),'fields':['name',_0x4484('0x15')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index 315c105..2032693 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(_0x18a7bb,_0x3a1b0e){var _0x117ede=function(_0x58c3a9){while(--_0x58c3a9){_0x18a7bb['push'](_0x18a7bb['shift']());}};_0x117ede(++_0x3a1b0e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0xa9e0[_0x3054be];return _0x3df150;};'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(_0xc06c94,_0x2dd902){var _0x11f17f=function(_0x34a543){while(--_0x34a543){_0xc06c94['push'](_0xc06c94['shift']());}};_0x11f17f(++_0x2dd902);}(_0xa9e0,0x123));var _0x0a9e=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0xa9e0[_0x28947d];return _0x12d2ee;};'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 7bb7c31..fe2e870 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 _0xe223=['isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','get'];(function(_0x5e0de8,_0x4fc62c){var _0x6e9b38=function(_0x28f8c8){while(--_0x28f8c8){_0x5e0de8['push'](_0x5e0de8['shift']());}};_0x6e9b38(++_0x4fc62c);}(_0xe223,0x13b));var _0x3e22=function(_0x1c8791,_0x17d51f){_0x1c8791=_0x1c8791-0x0;var _0x44e64c=_0xe223[_0x1c8791];return _0x44e64c;};'use strict';var multer=require(_0x3e22('0x0'));var util=require(_0x3e22('0x1'));var path=require('path');var timeout=require(_0x3e22('0x2'));var express=require(_0x3e22('0x3'));var router=express['Router']();var fs_extra=require(_0x3e22('0x4'));var auth=require(_0x3e22('0x5'));var interaction=require(_0x3e22('0x6'));var config=require('../../config/environment');var controller=require('./disposition.controller');router[_0x3e22('0x7')]('/',auth[_0x3e22('0x8')](),controller[_0x3e22('0x9')]);router[_0x3e22('0x7')](_0x3e22('0xa'),auth[_0x3e22('0x8')](),controller[_0x3e22('0xb')]);router[_0x3e22('0xc')]('/',auth['isAuthenticated'](),controller[_0x3e22('0xd')]);router[_0x3e22('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x3e22('0xf')]);router[_0x3e22('0x10')](_0x3e22('0xa'),auth[_0x3e22('0x8')](),controller[_0x3e22('0x11')]);module[_0x3e22('0x12')]=router; \ No newline at end of file +var _0x8c29=['create','put','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./disposition.controller','isAuthenticated','index','get','/:id','show'];(function(_0x469146,_0x56088b){var _0x29c59f=function(_0x1db5dc){while(--_0x1db5dc){_0x469146['push'](_0x469146['shift']());}};_0x29c59f(++_0x56088b);}(_0x8c29,0x147));var _0x98c2=function(_0x362192,_0x1e5c33){_0x362192=_0x362192-0x0;var _0xd11ae=_0x8c29[_0x362192];return _0xd11ae;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x98c2('0x0'));var timeout=require(_0x98c2('0x1'));var express=require(_0x98c2('0x2'));var router=express[_0x98c2('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x98c2('0x4'));var interaction=require(_0x98c2('0x5'));var config=require(_0x98c2('0x6'));var controller=require(_0x98c2('0x7'));router['get']('/',auth[_0x98c2('0x8')](),controller[_0x98c2('0x9')]);router[_0x98c2('0xa')](_0x98c2('0xb'),auth[_0x98c2('0x8')](),controller[_0x98c2('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x98c2('0xd')]);router[_0x98c2('0xe')](_0x98c2('0xb'),auth[_0x98c2('0x8')](),controller['update']);router['delete'](_0x98c2('0xb'),auth[_0x98c2('0x8')](),controller[_0x98c2('0xf')]);module[_0x98c2('0x10')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index 9f502af..478a74f 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 _0x2f38=['2400','7200','9600','12000','14400','4800','INTEGER','IAX','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','localstationid'];(function(_0x2b43ba,_0x3510f1){var _0x26d41e=function(_0x321267){while(--_0x321267){_0x2b43ba['push'](_0x2b43ba['shift']());}};_0x26d41e(++_0x3510f1);}(_0x2f38,0x83));var _0x82f3=function(_0x55d221,_0x36bfb7){_0x55d221=_0x55d221-0x0;var _0x2ab506=_0x2f38[_0x55d221];return _0x2ab506;};'use strict';var Sequelize=require(_0x82f3('0x0'));module[_0x82f3('0x1')]={'name':{'type':Sequelize[_0x82f3('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'ecm':{'type':Sequelize[_0x82f3('0x3')](_0x82f3('0x4'),'no'),'defaultValue':_0x82f3('0x4')},'headerinfo':{'type':Sequelize['STRING'],'defaultValue':_0x82f3('0x5')},'localstationid':{'type':Sequelize[_0x82f3('0x2')],'unique':_0x82f3('0x6')},'minrate':{'type':Sequelize[_0x82f3('0x3')](_0x82f3('0x7'),'4800',_0x82f3('0x8'),_0x82f3('0x9'),_0x82f3('0xa'),_0x82f3('0xb')),'defaultValue':_0x82f3('0xc')},'maxrate':{'type':Sequelize['ENUM'](_0x82f3('0x7'),_0x82f3('0xc'),_0x82f3('0x8'),_0x82f3('0x9'),_0x82f3('0xa'),_0x82f3('0xb')),'defaultValue':_0x82f3('0xb')},'modem':{'type':Sequelize[_0x82f3('0x2')],'defaultValue':'v17,v27,v29'},'gateway':{'type':Sequelize[_0x82f3('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x82f3('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x82f3('0xd')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x82f3('0x3')]('SIP',_0x82f3('0xe'),'DADHI','KHOMP'),'defaultValue':'SIP'},'key':{'type':Sequelize[_0x82f3('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x82f3('0xf')],'defaultValue':function(){return _0x82f3('0x10');}},'notificationSound':{'type':Sequelize[_0x82f3('0x11')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x82f3('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x82f3('0x11')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x82f3('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x82f3('0x11')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x82f3('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x82f3('0xd')],'allowNull':!![],'defaultValue':null,'comment':_0x82f3('0x12')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x82f3('0x13'),'set':function(_0x891a8a){if(!_0x891a8a)this[_0x82f3('0x14')](_0x82f3('0x15'),null);this[_0x82f3('0x14')](_0x82f3('0x16'),_0x891a8a);}}}; \ No newline at end of file +var _0x6b16=['12000','14400','INTEGER','IAX','DADHI','KHOMP','SIP','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','sequelize','exports','STRING','yes','xCALLY\x20Motion\x20Fax','ENUM','2400','4800','7200','9600'];(function(_0x363ef8,_0x4ecb1a){var _0x148822=function(_0x232634){while(--_0x232634){_0x363ef8['push'](_0x363ef8['shift']());}};_0x148822(++_0x4ecb1a);}(_0x6b16,0x14f));var _0x66b1=function(_0x1c7889,_0x24cd26){_0x1c7889=_0x1c7889-0x0;var _0x2f14e5=_0x6b16[_0x1c7889];return _0x2f14e5;};'use strict';var Sequelize=require(_0x66b1('0x0'));module[_0x66b1('0x1')]={'name':{'type':Sequelize[_0x66b1('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x66b1('0x2')]},'ecm':{'type':Sequelize['ENUM'](_0x66b1('0x3'),'no'),'defaultValue':'yes'},'headerinfo':{'type':Sequelize[_0x66b1('0x2')],'defaultValue':_0x66b1('0x4')},'localstationid':{'type':Sequelize[_0x66b1('0x2')],'unique':'localstationid'},'minrate':{'type':Sequelize[_0x66b1('0x5')](_0x66b1('0x6'),_0x66b1('0x7'),_0x66b1('0x8'),_0x66b1('0x9'),_0x66b1('0xa'),_0x66b1('0xb')),'defaultValue':_0x66b1('0x7')},'maxrate':{'type':Sequelize[_0x66b1('0x5')](_0x66b1('0x6'),_0x66b1('0x7'),_0x66b1('0x8'),_0x66b1('0x9'),_0x66b1('0xa'),'14400'),'defaultValue':_0x66b1('0xb')},'modem':{'type':Sequelize['STRING'],'defaultValue':'v17,v27,v29'},'gateway':{'type':Sequelize[_0x66b1('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x66b1('0xc')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x66b1('0x5')]('SIP',_0x66b1('0xd'),_0x66b1('0xe'),_0x66b1('0xf')),'defaultValue':_0x66b1('0x10')},'key':{'type':Sequelize[_0x66b1('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x66b1('0x11')],'defaultValue':function(){return _0x66b1('0x12');}},'notificationSound':{'type':Sequelize[_0x66b1('0x13')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x66b1('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x66b1('0x13')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x66b1('0x13')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x66b1('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x66b1('0xc')],'allowNull':!![],'defaultValue':null,'comment':_0x66b1('0x14')},'mandatoryDisposition':{'type':Sequelize[_0x66b1('0x13')],'defaultValue':![],'comment':_0x66b1('0x15'),'set':function(_0x2a9e86){if(!_0x2a9e86)this[_0x66b1('0x16')]('mandatoryDispositionPauseId',null);this[_0x66b1('0x16')]('mandatoryDisposition',_0x2a9e86);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index 3051c59..33bf2c0 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 _0x7916=['getDispositions','findOne','rawAttributes','pick','options','Disposition','findAll','rows','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addInteraction','FaxInteraction','omit','CmContact','Contact','User','Owner','fullname','internal','Tag','color','tag','addApplications','sequelize','FaxApplication','bulkCreate','findAndCountAll','priority','getApplications','context','from-voip-provider','exten','app','description','Fax\x20Extension','push','CDR(type)=inbound-fax','Set','ecm','localstationid','gateway','faxdetect','headerinfo','maxrate','minrate','t38timeout','FAXOPT(','/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','addAccountApplications','transaction','VoiceExtension','updateAccountApplications','tech','createdAt','updatedAt','TrunkId','findById','getMessages','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','CmList','List','Contacts','attachments','join','root','server/files/attachments','CheckAfterSend','isNil','path','from','\x22%s\x22\x20<%s>','fax','ListId','Send\x20Fax\x20failed','filename','Messages','spread','out','dataValues','SendFax','info','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','ejs','fs-extra','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','client','http','request','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','update','destroy','get','FaxAccounts','UserProfileResource','then','sendStatus','stack','name','send','index','mandatoryDispositionPause','map','FaxAccount','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','includeAll','include','show','params','Pause','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','FaxAccountId'];(function(_0x4a749d,_0x136259){var _0x3c5f52=function(_0x4d3627){while(--_0x4d3627){_0x4a749d['push'](_0x4a749d['shift']());}};_0x3c5f52(++_0x136259);}(_0x7916,0x128));var _0x6791=function(_0x44cbef,_0x533a1a){_0x44cbef=_0x44cbef-0x0;var _0x196610=_0x7916[_0x44cbef];return _0x196610;};'use strict';var emlformat=require(_0x6791('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6791('0x1'));var jsonpatch=require(_0x6791('0x2'));var rp=require('request-promise');var moment=require(_0x6791('0x3'));var BPromise=require(_0x6791('0x4'));var Mustache=require(_0x6791('0x5'));var util=require(_0x6791('0x6'));var path=require('path');var sox=require(_0x6791('0x7'));var csv=require('to-csv');var ejs=require(_0x6791('0x8'));var fs=require('fs');var fs_extra=require(_0x6791('0x9'));var _=require('lodash');var squel=require(_0x6791('0xa'));var crypto=require('crypto');var jsforce=require(_0x6791('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6791('0xc'));var Papa=require(_0x6791('0xd'));var Redis=require('ioredis');var authService=require(_0x6791('0xe'));var qs=require(_0x6791('0xf'));var as=require(_0x6791('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6791('0x11'))(_0x6791('0x12'));var utils=require(_0x6791('0x13'));var config=require(_0x6791('0x14'));var licenseUtil=require(_0x6791('0x15'));var db=require(_0x6791('0x16'))['db'];config[_0x6791('0x17')]=_[_0x6791('0x18')](config[_0x6791('0x17')],{'host':_0x6791('0x19'),'port':0x18eb});var socket=require(_0x6791('0x1a'))(new Redis(config['redis']));require('./faxAccount.socket')[_0x6791('0x1b')](socket);var jayson=require('jayson/promise');var client=jayson[_0x6791('0x1c')]['http']({'port':0x232c});var client9002=jayson[_0x6791('0x1c')][_0x6791('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x517910,_0x3e4792,_0x4b80ed,_0x3856ac){return new BPromise(function(_0x150d1f,_0x596a06){var _0xbc35d=_0x3856ac||client;return _0xbc35d[_0x6791('0x1e')](_0x517910,_0x4b80ed)['then'](function(_0x1872f5){logger['info'](_0x6791('0x1f'),_0x3e4792,_0x6791('0x20'));logger[_0x6791('0x21')](_0x6791('0x22'),_0x3e4792,_0x6791('0x20'),JSON[_0x6791('0x23')](_0x1872f5));if(_0x1872f5[_0x6791('0x24')]){if(_0x1872f5['error'][_0x6791('0x25')]===0x1f4){logger[_0x6791('0x24')]('FaxAccount,\x20%s,\x20%s',_0x3e4792,_0x1872f5[_0x6791('0x24')][_0x6791('0x26')]);return _0x596a06(_0x1872f5['error'][_0x6791('0x26')]);}logger[_0x6791('0x24')](_0x6791('0x1f'),_0x3e4792,_0x1872f5[_0x6791('0x24')]['message']);return _0x150d1f(_0x1872f5[_0x6791('0x24')][_0x6791('0x26')]);}else{logger['info']('FaxAccount,\x20%s,\x20%s',_0x3e4792,'request\x20sent');_0x150d1f(_0x1872f5[_0x6791('0x27')]['message']);}})[_0x6791('0x28')](function(_0x5409f1){logger['error']('FaxAccount,\x20%s,\x20%s',_0x3e4792,_0x5409f1);_0x596a06(_0x5409f1);});});}function respondWithStatusCode(_0x5cadc,_0x23442e){_0x23442e=_0x23442e||0xcc;return function(_0xd49b84){if(_0xd49b84){return _0x5cadc['sendStatus'](_0x23442e);}return _0x5cadc[_0x6791('0x29')](_0x23442e)[_0x6791('0x2a')]();};}function respondWithResult(_0x493a59,_0x342107){_0x342107=_0x342107||0xc8;return function(_0x5cbb79){if(_0x5cbb79){return _0x493a59[_0x6791('0x29')](_0x342107)['json'](_0x5cbb79);}};}function respondWithFilteredResult(_0x4fc5d5,_0x270a1d){return function(_0x551718){if(_0x551718){var _0x2f56a2=typeof _0x270a1d[_0x6791('0x2b')]==='undefined'&&typeof _0x270a1d[_0x6791('0x2c')]===_0x6791('0x2d');var _0x234c5e=_0x551718[_0x6791('0x2e')];var _0x5d9d54=_0x2f56a2?0x0:_0x270a1d['offset'];var _0x348b9c=_0x2f56a2?_0x551718['count']:_0x270a1d[_0x6791('0x2b')]+_0x270a1d[_0x6791('0x2c')];var _0x30397e;if(_0x348b9c>=_0x234c5e){_0x348b9c=_0x234c5e;_0x30397e=0xc8;}else{_0x30397e=0xce;}_0x4fc5d5[_0x6791('0x29')](_0x30397e);return _0x4fc5d5[_0x6791('0x2f')](_0x6791('0x30'),_0x5d9d54+'-'+_0x348b9c+'/'+_0x234c5e)[_0x6791('0x31')](_0x551718);}return null;};}function patchUpdates(_0x14307e){return function(_0x152751){try{jsonpatch[_0x6791('0x32')](_0x152751,_0x14307e,!![]);}catch(_0x4cdf98){return BPromise[_0x6791('0x33')](_0x4cdf98);}return _0x152751[_0x6791('0x34')]();};}function saveUpdates(_0x28385c,_0xa1ed41){return function(_0x19cd22){if(_0x19cd22){return _0x19cd22[_0x6791('0x35')](_0x28385c)['then'](function(_0x4a304f){return _0x4a304f;});}return null;};}function removeEntity(_0x551357,_0x1de770){return function(_0x21a9cf){if(_0x21a9cf){return _0x21a9cf[_0x6791('0x36')]()['then'](function(){var _0x5657c0=_0x21a9cf[_0x6791('0x37')]({'plain':!![]});var _0x9b1ad2=_0x6791('0x38');return db[_0x6791('0x39')]['destroy']({'where':{'type':_0x9b1ad2,'resourceId':_0x5657c0['id']}})[_0x6791('0x3a')](function(){return _0x21a9cf;});})[_0x6791('0x3a')](function(){_0x551357[_0x6791('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x31217d,_0x567e36){return function(_0x4ee010){if(!_0x4ee010){_0x31217d[_0x6791('0x3b')](0x194);}return _0x4ee010;};}function handleError(_0x1803ab,_0x530b13){_0x530b13=_0x530b13||0x1f4;return function(_0x764f15){logger[_0x6791('0x24')](_0x764f15[_0x6791('0x3c')]);if(_0x764f15[_0x6791('0x3d')]){delete _0x764f15[_0x6791('0x3d')];}_0x1803ab['status'](_0x530b13)[_0x6791('0x3e')](_0x764f15);};}exports[_0x6791('0x3f')]=function(_0x2d0dd8,_0x53f48d){var _0x3a6062={'include':[{'model':db['Pause'],'as':_0x6791('0x40')}]},_0x24955c={},_0x2349b0={'count':0x0,'rows':[]};var _0x31f2bb=_[_0x6791('0x41')](db[_0x6791('0x42')]['rawAttributes'],function(_0x18c478){return{'name':_0x18c478[_0x6791('0x43')],'type':_0x18c478[_0x6791('0x44')][_0x6791('0x45')]};});_0x24955c[_0x6791('0x46')]=_[_0x6791('0x41')](_0x31f2bb,_0x6791('0x3d'));_0x24955c[_0x6791('0x47')]=_[_0x6791('0x48')](_0x2d0dd8['query']);_0x24955c['filters']=_[_0x6791('0x49')](_0x24955c[_0x6791('0x46')],_0x24955c['query']);_0x3a6062[_0x6791('0x4a')]=_[_0x6791('0x49')](_0x24955c[_0x6791('0x46')],qs[_0x6791('0x4b')](_0x2d0dd8[_0x6791('0x47')][_0x6791('0x4b')]));_0x3a6062[_0x6791('0x4a')]=_0x3a6062['attributes'][_0x6791('0x4c')]?_0x3a6062['attributes']:_0x24955c[_0x6791('0x46')];if(!_0x2d0dd8[_0x6791('0x47')][_0x6791('0x4d')](_0x6791('0x4e'))){_0x3a6062['limit']=qs[_0x6791('0x2c')](_0x2d0dd8[_0x6791('0x47')][_0x6791('0x2c')]);_0x3a6062[_0x6791('0x2b')]=qs[_0x6791('0x2b')](_0x2d0dd8[_0x6791('0x47')][_0x6791('0x2b')]);}_0x3a6062[_0x6791('0x4f')]=qs['sort'](_0x2d0dd8[_0x6791('0x47')][_0x6791('0x50')]);_0x3a6062[_0x6791('0x51')]=qs[_0x6791('0x52')](_['pick'](_0x2d0dd8[_0x6791('0x47')],_0x24955c[_0x6791('0x52')]),_0x31f2bb);if(_0x2d0dd8['query'][_0x6791('0x53')]){_0x3a6062['where']=_[_0x6791('0x54')](_0x3a6062[_0x6791('0x51')],{'$or':_[_0x6791('0x41')](_0x31f2bb,function(_0x3ddccc){if(_0x3ddccc[_0x6791('0x44')]!==_0x6791('0x55')){var _0x4163f5={};_0x4163f5[_0x3ddccc[_0x6791('0x3d')]]={'$like':'%'+_0x2d0dd8[_0x6791('0x47')]['filter']+'%'};return _0x4163f5;}})});}_0x3a6062=_[_0x6791('0x54')]({},_0x3a6062,_0x2d0dd8['options']);var _0x10e806={'where':_0x3a6062[_0x6791('0x51')]};return db[_0x6791('0x42')][_0x6791('0x2e')](_0x10e806)[_0x6791('0x3a')](function(_0x5f5a74){_0x2349b0[_0x6791('0x2e')]=_0x5f5a74;if(_0x2d0dd8[_0x6791('0x47')][_0x6791('0x56')]){_0x3a6062[_0x6791('0x57')]=[{'all':!![]}];}return db[_0x6791('0x42')]['findAll'](_0x3a6062);})[_0x6791('0x3a')](function(_0x42948b){_0x2349b0['rows']=_0x42948b;return _0x2349b0;})[_0x6791('0x3a')](respondWithFilteredResult(_0x53f48d,_0x3a6062))['catch'](handleError(_0x53f48d,null));};exports[_0x6791('0x58')]=function(_0x22a4d3,_0x12f926){var _0x37e360={'raw':![],'where':{'id':_0x22a4d3[_0x6791('0x59')]['id']},'include':[{'model':db[_0x6791('0x5a')],'as':'mandatoryDispositionPause'}]},_0x558069={};_0x558069[_0x6791('0x46')]=_[_0x6791('0x48')](db[_0x6791('0x42')]['rawAttributes']);_0x558069[_0x6791('0x47')]=_[_0x6791('0x48')](_0x22a4d3['query']);_0x558069[_0x6791('0x52')]=_[_0x6791('0x49')](_0x558069['model'],_0x558069[_0x6791('0x47')]);_0x37e360[_0x6791('0x4a')]=_[_0x6791('0x49')](_0x558069[_0x6791('0x46')],qs['fields'](_0x22a4d3[_0x6791('0x47')][_0x6791('0x4b')]));_0x37e360[_0x6791('0x4a')]=_0x37e360['attributes']['length']?_0x37e360[_0x6791('0x4a')]:_0x558069[_0x6791('0x46')];if(_0x22a4d3[_0x6791('0x47')][_0x6791('0x56')]){_0x37e360[_0x6791('0x57')]=[{'all':!![]}];}_0x37e360=_['merge']({},_0x37e360,_0x22a4d3['options']);return db[_0x6791('0x42')]['find'](_0x37e360)['then'](handleEntityNotFound(_0x12f926,null))[_0x6791('0x3a')](respondWithResult(_0x12f926,null))[_0x6791('0x28')](handleError(_0x12f926,null));};exports[_0x6791('0x5b')]=function(_0x10b41b,_0x13089d){return db[_0x6791('0x42')]['create'](_0x10b41b['body'],{})[_0x6791('0x3a')](function(_0x2aeb6e){var _0x56e424=_0x10b41b[_0x6791('0x5c')]['get']({'plain':!![]});if(!_0x56e424)throw new Error(_0x6791('0x5d'));if(_0x56e424[_0x6791('0x5e')]==='user'){var _0x1ebfb6=_0x2aeb6e[_0x6791('0x37')]({'plain':!![]});var _0x3fd984='FaxAccounts';return db[_0x6791('0x5f')][_0x6791('0x60')]({'where':{'name':_0x3fd984,'userProfileId':_0x56e424[_0x6791('0x61')]},'raw':!![]})[_0x6791('0x3a')](function(_0x396698){if(_0x396698&&_0x396698['autoAssociation']===0x0){return db['UserProfileResource'][_0x6791('0x5b')]({'name':_0x1ebfb6[_0x6791('0x3d')],'resourceId':_0x1ebfb6['id'],'type':_0x396698['name'],'sectionId':_0x396698['id']},{})[_0x6791('0x3a')](function(){return _0x2aeb6e;});}else{return _0x2aeb6e;}})[_0x6791('0x28')](function(_0x66f6b4){logger[_0x6791('0x24')](_0x6791('0x62'),_0x66f6b4);throw _0x66f6b4;});}return _0x2aeb6e;})[_0x6791('0x3a')](respondWithResult(_0x13089d,0xc9))[_0x6791('0x28')](handleError(_0x13089d,null));};exports[_0x6791('0x35')]=function(_0x5b74b9,_0x2c5f12){if(_0x5b74b9[_0x6791('0x63')]['id']){delete _0x5b74b9[_0x6791('0x63')]['id'];}return db[_0x6791('0x42')]['find']({'where':{'id':_0x5b74b9[_0x6791('0x59')]['id']},'include':[{'model':db[_0x6791('0x5a')],'as':_0x6791('0x40')}]})['then'](handleEntityNotFound(_0x2c5f12,null))[_0x6791('0x3a')](saveUpdates(_0x5b74b9[_0x6791('0x63')],null))[_0x6791('0x3a')](respondWithResult(_0x2c5f12,null))[_0x6791('0x28')](handleError(_0x2c5f12,null));};exports['destroy']=function(_0x2c834f,_0x2843fb){return db['FaxAccount'][_0x6791('0x60')]({'where':{'id':_0x2c834f[_0x6791('0x59')]['id']}})[_0x6791('0x3a')](handleEntityNotFound(_0x2843fb,null))[_0x6791('0x3a')](removeEntity(_0x2843fb,null))[_0x6791('0x28')](handleError(_0x2843fb,null));};exports[_0x6791('0x64')]=function(_0x4a9e82,_0x301f2f){return db[_0x6791('0x42')][_0x6791('0x64')]()['then'](respondWithResult(_0x301f2f,null))[_0x6791('0x28')](handleError(_0x301f2f,null));};exports['addDisposition']=function(_0x2648fa,_0x11f3b2,_0xf0941a){if(_0x2648fa[_0x6791('0x63')]['id']){delete _0x2648fa[_0x6791('0x63')]['id'];}return db['FaxAccount'][_0x6791('0x60')]({'where':{'id':_0x2648fa[_0x6791('0x59')]['id']}})[_0x6791('0x3a')](handleEntityNotFound(_0x11f3b2,null))[_0x6791('0x3a')](function(_0x5f158f){if(_0x5f158f){_0x2648fa[_0x6791('0x63')][_0x6791('0x65')]=_0x5f158f['id'];return db['Disposition'][_0x6791('0x5b')](_0x2648fa[_0x6791('0x63')]);}})['then'](respondWithResult(_0x11f3b2,null))[_0x6791('0x28')](handleError(_0x11f3b2,null));};exports[_0x6791('0x66')]=function(_0x113d9f,_0x271b93,_0x55d389){var _0x35583a={'raw':![],'where':{}};var _0x3511c7={};var _0x505021={'count':0x0,'rows':[]};return db[_0x6791('0x42')][_0x6791('0x67')]({'where':{'id':_0x113d9f[_0x6791('0x59')]['id']}})[_0x6791('0x3a')](handleEntityNotFound(_0x271b93,null))[_0x6791('0x3a')](function(_0x4ecf62){if(_0x4ecf62){_0x3511c7[_0x6791('0x46')]=_[_0x6791('0x48')](db['Disposition'][_0x6791('0x68')]);_0x3511c7[_0x6791('0x47')]=_[_0x6791('0x48')](_0x113d9f['query']);_0x3511c7[_0x6791('0x52')]=_[_0x6791('0x49')](_0x3511c7[_0x6791('0x46')],_0x3511c7[_0x6791('0x47')]);_0x35583a[_0x6791('0x4a')]=_[_0x6791('0x49')](_0x3511c7[_0x6791('0x46')],qs[_0x6791('0x4b')](_0x113d9f['query'][_0x6791('0x4b')]));_0x35583a[_0x6791('0x4a')]=_0x35583a['attributes'][_0x6791('0x4c')]?_0x35583a[_0x6791('0x4a')]:_0x3511c7[_0x6791('0x46')];if(!_0x113d9f['query'][_0x6791('0x4d')]('nolimit')){_0x35583a[_0x6791('0x2c')]=qs[_0x6791('0x2c')](_0x113d9f[_0x6791('0x47')][_0x6791('0x2c')]);_0x35583a[_0x6791('0x2b')]=qs[_0x6791('0x2b')](_0x113d9f[_0x6791('0x47')][_0x6791('0x2b')]);}_0x35583a[_0x6791('0x4f')]=qs[_0x6791('0x50')](_0x113d9f[_0x6791('0x47')][_0x6791('0x50')]);_0x35583a[_0x6791('0x51')]=qs[_0x6791('0x52')](_[_0x6791('0x69')](_0x113d9f[_0x6791('0x47')],_0x3511c7[_0x6791('0x52')]));_0x35583a[_0x6791('0x51')][_0x6791('0x65')]=_0x4ecf62['id'];if(_0x113d9f['query']['filter']){_0x35583a['where']=_[_0x6791('0x54')](_0x35583a[_0x6791('0x51')],{'$or':_[_0x6791('0x41')](_0x35583a[_0x6791('0x4a')],function(_0xa0a3ec){var _0x4f95e3={};_0x4f95e3[_0xa0a3ec]={'$like':'%'+_0x113d9f[_0x6791('0x47')][_0x6791('0x53')]+'%'};return _0x4f95e3;})});}_0x35583a=_[_0x6791('0x54')]({},_0x35583a,_0x113d9f[_0x6791('0x6a')]);return db[_0x6791('0x6b')][_0x6791('0x2e')]({'where':_0x35583a[_0x6791('0x51')]})[_0x6791('0x3a')](function(_0x2dafe6){_0x505021[_0x6791('0x2e')]=_0x2dafe6;if(_0x113d9f[_0x6791('0x47')][_0x6791('0x56')]){_0x35583a[_0x6791('0x57')]=[{'all':!![]}];}return db[_0x6791('0x6b')][_0x6791('0x6c')](_0x35583a);})[_0x6791('0x3a')](function(_0x3007a0){_0x505021[_0x6791('0x6d')]=_0x3007a0;return _0x505021;});}})[_0x6791('0x3a')](respondWithFilteredResult(_0x271b93,_0x35583a))['catch'](handleError(_0x271b93,null));};exports[_0x6791('0x6e')]=function(_0x56aecf,_0x8d9556,_0x11eb22){return db['FaxAccount'][_0x6791('0x60')]({'where':{'id':_0x56aecf['params']['id']}})[_0x6791('0x3a')](handleEntityNotFound(_0x8d9556,null))[_0x6791('0x3a')](function(_0x5945cb){if(_0x5945cb){return _0x5945cb[_0x6791('0x6e')](_0x56aecf[_0x6791('0x47')][_0x6791('0x6f')]);}})['then'](respondWithStatusCode(_0x8d9556,null))[_0x6791('0x28')](handleError(_0x8d9556,null));};exports[_0x6791('0x70')]=function(_0x43f905,_0x2fc1c3,_0x2eb20b){if(_0x43f905[_0x6791('0x63')]['id']){delete _0x43f905['body']['id'];}return db[_0x6791('0x42')][_0x6791('0x60')]({'where':{'id':_0x43f905[_0x6791('0x59')]['id']}})[_0x6791('0x3a')](handleEntityNotFound(_0x2fc1c3,null))[_0x6791('0x3a')](function(_0xb34f91){if(_0xb34f91){_0x43f905[_0x6791('0x63')]['FaxAccountId']=_0xb34f91['id'];return db[_0x6791('0x71')]['create'](_0x43f905[_0x6791('0x63')]);}})['then'](respondWithResult(_0x2fc1c3,null))[_0x6791('0x28')](handleError(_0x2fc1c3,null));};exports[_0x6791('0x72')]=function(_0x1a117c,_0x37762e,_0xcc3155){var _0x17159d={'raw':![],'where':{}};var _0x5a7029={};var _0x25dab9={'count':0x0,'rows':[]};return db['FaxAccount'][_0x6791('0x67')]({'where':{'id':_0x1a117c['params']['id']}})['then'](handleEntityNotFound(_0x37762e,null))['then'](function(_0x1c6eb1){if(_0x1c6eb1){_0x5a7029[_0x6791('0x46')]=_['keys'](db[_0x6791('0x71')]['rawAttributes']);_0x5a7029[_0x6791('0x47')]=_[_0x6791('0x48')](_0x1a117c['query']);_0x5a7029['filters']=_['intersection'](_0x5a7029[_0x6791('0x46')],_0x5a7029[_0x6791('0x47')]);_0x17159d[_0x6791('0x4a')]=_['intersection'](_0x5a7029[_0x6791('0x46')],qs[_0x6791('0x4b')](_0x1a117c[_0x6791('0x47')][_0x6791('0x4b')]));_0x17159d[_0x6791('0x4a')]=_0x17159d['attributes'][_0x6791('0x4c')]?_0x17159d[_0x6791('0x4a')]:_0x5a7029[_0x6791('0x46')];if(!_0x1a117c[_0x6791('0x47')][_0x6791('0x4d')]('nolimit')){_0x17159d[_0x6791('0x2c')]=qs[_0x6791('0x2c')](_0x1a117c['query'][_0x6791('0x2c')]);_0x17159d[_0x6791('0x2b')]=qs[_0x6791('0x2b')](_0x1a117c[_0x6791('0x47')]['offset']);}_0x17159d[_0x6791('0x4f')]=qs[_0x6791('0x50')](_0x1a117c[_0x6791('0x47')][_0x6791('0x50')]);_0x17159d[_0x6791('0x51')]=qs[_0x6791('0x52')](_[_0x6791('0x69')](_0x1a117c[_0x6791('0x47')],_0x5a7029['filters']));_0x17159d['where'][_0x6791('0x65')]=_0x1c6eb1['id'];if(_0x1a117c[_0x6791('0x47')][_0x6791('0x53')]){_0x17159d['where']=_[_0x6791('0x54')](_0x17159d['where'],{'$or':_[_0x6791('0x41')](_0x17159d[_0x6791('0x4a')],function(_0x47edee){var _0xc7b93={};_0xc7b93[_0x47edee]={'$like':'%'+_0x1a117c[_0x6791('0x47')][_0x6791('0x53')]+'%'};return _0xc7b93;})});}_0x17159d=_[_0x6791('0x54')]({},_0x17159d,_0x1a117c[_0x6791('0x6a')]);return db['CannedAnswer'][_0x6791('0x2e')]({'where':_0x17159d[_0x6791('0x51')]})[_0x6791('0x3a')](function(_0x5c4e05){_0x25dab9['count']=_0x5c4e05;if(_0x1a117c[_0x6791('0x47')][_0x6791('0x56')]){_0x17159d['include']=[{'all':!![]}];}return db[_0x6791('0x71')][_0x6791('0x6c')](_0x17159d);})[_0x6791('0x3a')](function(_0x5dbcf3){_0x25dab9[_0x6791('0x6d')]=_0x5dbcf3;return _0x25dab9;});}})['then'](respondWithFilteredResult(_0x37762e,_0x17159d))['catch'](handleError(_0x37762e,null));};exports[_0x6791('0x73')]=function(_0x5e7379,_0x3cb412,_0x456583){return db[_0x6791('0x42')][_0x6791('0x60')]({'where':{'id':_0x5e7379[_0x6791('0x59')]['id']}})[_0x6791('0x3a')](handleEntityNotFound(_0x3cb412,null))['then'](function(_0x242d63){if(_0x242d63){return _0x242d63['removeAnswers'](_0x5e7379[_0x6791('0x47')]['ids']);}})['then'](respondWithStatusCode(_0x3cb412,null))[_0x6791('0x28')](handleError(_0x3cb412,null));};exports[_0x6791('0x74')]=function(_0x3ac91c,_0x244989,_0x13c601){return db[_0x6791('0x75')][_0x6791('0x60')]({'where':{'id':_0x3ac91c[_0x6791('0x59')]['id']}})[_0x6791('0x3a')](handleEntityNotFound(_0x244989,null))[_0x6791('0x3a')](function(_0x2fe37c){if(_0x2fe37c){return _0x2fe37c[_0x6791('0x74')](_0x3ac91c[_0x6791('0x63')][_0x6791('0x6f')],_[_0x6791('0x76')](_0x3ac91c[_0x6791('0x63')],[_0x6791('0x6f'),'id'])||{});}})[_0x6791('0x3a')](respondWithResult(_0x244989,null))[_0x6791('0x28')](handleError(_0x244989,null));};exports['getInteractions']=function(_0xfef30e,_0xf06510,_0x51f438){var _0x4dc5e1={'raw':![],'where':{}};var _0x4c6eb1={};var _0x4bce1d={'count':0x0,'rows':[]};return db[_0x6791('0x42')][_0x6791('0x67')]({'where':{'id':_0xfef30e['params']['id']}})[_0x6791('0x3a')](handleEntityNotFound(_0xf06510,null))[_0x6791('0x3a')](function(_0x1aea01){if(_0x1aea01){_0x4c6eb1[_0x6791('0x46')]=_[_0x6791('0x48')](db[_0x6791('0x75')][_0x6791('0x68')]);_0x4c6eb1[_0x6791('0x47')]=_['keys'](_0xfef30e[_0x6791('0x47')]);_0x4c6eb1['filters']=_[_0x6791('0x49')](_0x4c6eb1[_0x6791('0x46')],_0x4c6eb1[_0x6791('0x47')]);_0x4dc5e1['attributes']=_['intersection'](_0x4c6eb1['model'],qs[_0x6791('0x4b')](_0xfef30e[_0x6791('0x47')][_0x6791('0x4b')]));_0x4dc5e1[_0x6791('0x4a')]=_0x4dc5e1['attributes'][_0x6791('0x4c')]?_0x4dc5e1[_0x6791('0x4a')]:_0x4c6eb1[_0x6791('0x46')];if(!_0xfef30e[_0x6791('0x47')]['hasOwnProperty']('nolimit')){_0x4dc5e1['limit']=qs[_0x6791('0x2c')](_0xfef30e['query'][_0x6791('0x2c')]);_0x4dc5e1[_0x6791('0x2b')]=qs[_0x6791('0x2b')](_0xfef30e[_0x6791('0x47')][_0x6791('0x2b')]);}_0x4dc5e1[_0x6791('0x4f')]=qs[_0x6791('0x50')](_0xfef30e[_0x6791('0x47')]['sort']);_0x4dc5e1[_0x6791('0x51')]=qs[_0x6791('0x52')](_['pick'](_0xfef30e[_0x6791('0x47')],_0x4c6eb1[_0x6791('0x52')]));_0x4dc5e1[_0x6791('0x51')][_0x6791('0x65')]=_0x1aea01['id'];if(_0xfef30e['query'][_0x6791('0x53')]){_0x4dc5e1[_0x6791('0x51')]=_[_0x6791('0x54')](_0x4dc5e1[_0x6791('0x51')],{'$or':_[_0x6791('0x41')](_0x4dc5e1[_0x6791('0x4a')],function(_0x456077){var _0x42a171={};_0x42a171[_0x456077]={'$like':'%'+_0xfef30e[_0x6791('0x47')]['filter']+'%'};return _0x42a171;})});}_0x4dc5e1=_[_0x6791('0x54')]({},_0x4dc5e1,_0xfef30e[_0x6791('0x6a')]);return db[_0x6791('0x75')][_0x6791('0x2e')]({'where':_0x4dc5e1[_0x6791('0x51')]})['then'](function(_0x57a350){_0x4bce1d[_0x6791('0x2e')]=_0x57a350;if(_0xfef30e[_0x6791('0x47')]['includeAll']){_0x4dc5e1[_0x6791('0x57')]=[{'model':db[_0x6791('0x77')],'as':_0x6791('0x78'),'required':![]},{'model':db[_0x6791('0x79')],'as':_0x6791('0x7a'),'attributes':[_0x6791('0x3d'),_0x6791('0x7b'),_0x6791('0x7c')],'required':![]},{'model':db[_0x6791('0x7d')],'as':'Tags','attributes':['id',_0x6791('0x3d'),_0x6791('0x7e')],'where':_0xfef30e['query'][_0x6791('0x7f')]?{'id':_0xfef30e['query'][_0x6791('0x7f')]}:undefined,'required':_0xfef30e[_0x6791('0x47')][_0x6791('0x7f')]?!![]:![]}];}return db[_0x6791('0x75')][_0x6791('0x6c')](_0x4dc5e1);})[_0x6791('0x3a')](function(_0x3a6ce4){_0x4bce1d[_0x6791('0x6d')]=_0x3a6ce4;return _0x4bce1d;});}})[_0x6791('0x3a')](respondWithFilteredResult(_0xf06510,_0x4dc5e1))[_0x6791('0x28')](handleError(_0xf06510,null));};exports[_0x6791('0x80')]=function(_0x3eb148,_0x1f06d8,_0x33e4a9){return db[_0x6791('0x42')][_0x6791('0x67')]({'where':{'id':_0x3eb148[_0x6791('0x59')]['id']}})[_0x6791('0x3a')](handleEntityNotFound(_0x1f06d8,null))[_0x6791('0x3a')](function(_0x4edb6e){if(_0x4edb6e){return db[_0x6791('0x81')]['transaction'](function(_0x41385c){return db[_0x6791('0x82')][_0x6791('0x36')]({'where':{'FaxAccountId':_0x3eb148[_0x6791('0x59')]['id']},'transaction':_0x41385c})[_0x6791('0x3a')](function(_0x28da4c){var _0x45aa07=_[_0x6791('0x41')](_0x3eb148['body'],function(_0x30a0a4){_0x30a0a4['FaxAccountId']=_0x3eb148['params']['id'];return _0x30a0a4;});return db[_0x6791('0x82')][_0x6791('0x83')](_0x45aa07,{'transaction':_0x41385c});});})[_0x6791('0x3a')](function(){return db[_0x6791('0x82')][_0x6791('0x84')]({'where':{'FaxAccountId':_0x3eb148[_0x6791('0x59')]['id']},'order':_0x6791('0x85')});});}})['then'](respondWithResult(_0x1f06d8,null))[_0x6791('0x28')](handleError(_0x1f06d8,null));};exports[_0x6791('0x86')]=function(_0x4151de,_0x146c85,_0x1fc7a6){var _0x400547={};var _0x550c19={};var _0x3a6909;var _0x704f62;return db['FaxAccount'][_0x6791('0x67')]({'where':{'id':_0x4151de[_0x6791('0x59')]['id']}})[_0x6791('0x3a')](handleEntityNotFound(_0x146c85,null))[_0x6791('0x3a')](function(_0x5ed450){if(_0x5ed450){_0x3a6909=_0x5ed450;_0x550c19[_0x6791('0x46')]=_[_0x6791('0x48')](db[_0x6791('0x82')][_0x6791('0x68')]);_0x550c19['query']=_['keys'](_0x4151de[_0x6791('0x47')]);_0x550c19[_0x6791('0x52')]=_[_0x6791('0x49')](_0x550c19['model'],_0x550c19[_0x6791('0x47')]);_0x400547[_0x6791('0x4a')]=_[_0x6791('0x49')](_0x550c19['model'],qs['fields'](_0x4151de['query'][_0x6791('0x4b')]));_0x400547['attributes']=_0x400547[_0x6791('0x4a')][_0x6791('0x4c')]?_0x400547[_0x6791('0x4a')]:_0x550c19['model'];_0x400547[_0x6791('0x4f')]=qs['sort'](_0x4151de[_0x6791('0x47')]['sort']);_0x400547[_0x6791('0x51')]=qs['filters'](_[_0x6791('0x69')](_0x4151de[_0x6791('0x47')],_0x550c19[_0x6791('0x52')]));if(_0x4151de[_0x6791('0x47')][_0x6791('0x53')]){_0x400547['where']=_[_0x6791('0x54')](_0x400547['where'],{'$or':_[_0x6791('0x41')](_0x400547['attributes'],function(_0x87286e){var _0x7e90f1={};_0x7e90f1[_0x87286e]={'$like':'%'+_0x4151de[_0x6791('0x47')][_0x6791('0x53')]+'%'};return _0x7e90f1;})});}_0x400547=_['merge']({},_0x400547,_0x4151de['options']);return _0x3a6909[_0x6791('0x86')](_0x400547);}})[_0x6791('0x3a')](function(_0x2611f1){if(_0x2611f1){_0x704f62=_0x2611f1[_0x6791('0x4c')];if(!_0x4151de['query'][_0x6791('0x4d')]('nolimit')){_0x400547[_0x6791('0x2c')]=qs[_0x6791('0x2c')](_0x4151de[_0x6791('0x47')][_0x6791('0x2c')]);_0x400547[_0x6791('0x2b')]=qs[_0x6791('0x2b')](_0x4151de[_0x6791('0x47')]['offset']);}return _0x3a6909[_0x6791('0x86')](_0x400547);}})[_0x6791('0x3a')](function(_0x204d3a){if(_0x204d3a){return _0x204d3a?{'count':_0x704f62,'rows':_0x204d3a}:null;}})[_0x6791('0x3a')](respondWithResult(_0x146c85,null))[_0x6791('0x28')](handleError(_0x146c85,null));};function Extension(_0x221d15,_0xa61fcc,_0x257b04,_0x7acebe){this[_0x6791('0x87')]=_0x6791('0x88');this[_0x6791('0x89')]=_0x221d15['localstationid'];this[_0x6791('0x8a')]=_0x7acebe;this[_0x6791('0x44')]='system';this[_0x6791('0x8b')]=_0x6791('0x8c');this[_0x6791('0x65')]=_0x221d15['id'];this['priority']=_0xa61fcc;this['appdata']=_0x257b04;}function createExtensionsReciveFax(_0x405363){var _0x54d569=0x1;var _0xc1a202=[];_0xc1a202[_0x6791('0x8d')](new Extension(_0x405363,_0x54d569,'','Answer'));_0x54d569+=0x1;_0xc1a202['push'](new Extension(_0x405363,_0x54d569,_0x6791('0x8e'),_0x6791('0x8f')));_0x54d569+=0x1;for(var _0x707d88 in _0x405363){if(_0x405363[_0x6791('0x4d')](_0x707d88)&&(_0x707d88===_0x6791('0x90')||_0x707d88===_0x6791('0x91')||_0x707d88===_0x6791('0x92')||_0x707d88===_0x6791('0x93')||_0x707d88===_0x6791('0x94')||_0x707d88===_0x6791('0x95')||_0x707d88===_0x6791('0x96')||_0x707d88==='modem'||_0x707d88===_0x6791('0x97'))){_0xc1a202['push'](new Extension(_0x405363,_0x54d569,_0x6791('0x98')+_0x707d88+')='+_0x405363[_0x707d88],_0x6791('0x8f')));_0x54d569+=0x1;}}_0xc1a202['push'](new Extension(_0x405363,_0x54d569,'6','Wait'));_0x54d569+=0x1;_0xc1a202[_0x6791('0x8d')](new Extension(_0x405363,_0x54d569,_0x6791('0x99'),'ReceiveFax'));_0x54d569=0x0;return _0xc1a202;}exports[_0x6791('0x9a')]=function(_0x158767,_0x54af89,_0x426d10){var _0x3297e7;return db[_0x6791('0x81')][_0x6791('0x9b')](function(_0x216b49){return db[_0x6791('0x42')][_0x6791('0x5b')](_0x158767[_0x6791('0x63')],{'transaction':_0x216b49})[_0x6791('0x3a')](function(_0x5c1a1a){_0x3297e7=_0x5c1a1a[_0x6791('0x37')]({'plain':!![]});return db[_0x6791('0x9c')][_0x6791('0x83')](createExtensionsReciveFax(_0x3297e7),{'transaction':_0x216b49});});})[_0x6791('0x3a')](function(){return _0x3297e7;})[_0x6791('0x3a')](respondWithResult(_0x54af89,null))[_0x6791('0x28')](handleError(_0x54af89,null));};exports[_0x6791('0x9d')]=function(_0x560c2d,_0x2b103f,_0x5a56b4){var _0x1d0385;return db['sequelize'][_0x6791('0x9b')](function(_0x461356){return db[_0x6791('0x42')]['update'](_0x560c2d['body'],{'where':{'id':_0x560c2d[_0x6791('0x63')]['id']},'transaction':_0x461356})[_0x6791('0x3a')](function(_0x3e2be2){return db[_0x6791('0x9c')][_0x6791('0x36')]({'where':{'FaxAccountId':_0x560c2d[_0x6791('0x63')]['id']},'transaction':_0x461356})[_0x6791('0x3a')](function(_0x206609){return db['VoiceExtension'][_0x6791('0x83')](createExtensionsReciveFax(_[_0x6791('0x76')](_0x560c2d[_0x6791('0x63')],[_0x6791('0x9e'),_0x6791('0x45'),_0x6791('0x9f'),_0x6791('0xa0'),_0x6791('0xa1'),'ListId'])),{'transaction':_0x461356});});});})[_0x6791('0x3a')](function(){return db[_0x6791('0x42')][_0x6791('0xa2')](_0x560c2d[_0x6791('0x63')]['id']);})[_0x6791('0x3a')](respondWithResult(_0x2b103f,null))[_0x6791('0x28')](handleError(_0x2b103f,null));};exports[_0x6791('0xa3')]=function(_0x2048dd,_0x465fc4,_0x54f969){var _0x5c995d={'raw':!![],'where':{}};var _0x5e3d05={};var _0x1abe6a={'count':0x0,'rows':[]};return db['FaxAccount'][_0x6791('0x67')]({'where':{'id':_0x2048dd[_0x6791('0x59')]['id']}})[_0x6791('0x3a')](handleEntityNotFound(_0x465fc4,null))['then'](function(_0x32ebc5){if(_0x32ebc5){_0x5e3d05['model']=_['keys'](db[_0x6791('0xa4')][_0x6791('0x68')]);_0x5e3d05[_0x6791('0x47')]=_[_0x6791('0x48')](_0x2048dd[_0x6791('0x47')]);_0x5e3d05[_0x6791('0x52')]=_[_0x6791('0x49')](_0x5e3d05[_0x6791('0x46')],_0x5e3d05[_0x6791('0x47')]);_0x5c995d[_0x6791('0x4a')]=_[_0x6791('0x49')](_0x5e3d05[_0x6791('0x46')],qs[_0x6791('0x4b')](_0x2048dd['query'][_0x6791('0x4b')]));_0x5c995d[_0x6791('0x4a')]=_0x5c995d[_0x6791('0x4a')][_0x6791('0x4c')]?_0x5c995d[_0x6791('0x4a')]:_0x5e3d05[_0x6791('0x46')];if(!_0x2048dd[_0x6791('0x47')][_0x6791('0x4d')](_0x6791('0x4e'))){_0x5c995d[_0x6791('0x2c')]=qs[_0x6791('0x2c')](_0x2048dd['query'][_0x6791('0x2c')]);_0x5c995d[_0x6791('0x2b')]=qs[_0x6791('0x2b')](_0x2048dd[_0x6791('0x47')][_0x6791('0x2b')]);}_0x5c995d['order']=qs[_0x6791('0x50')](_0x2048dd[_0x6791('0x47')][_0x6791('0x50')]);_0x5c995d['where']=qs[_0x6791('0x52')](_[_0x6791('0x69')](_0x2048dd['query'],_0x5e3d05['filters']));_0x5c995d[_0x6791('0x51')][_0x6791('0x65')]=_0x32ebc5['id'];if(_0x2048dd[_0x6791('0x47')]['filter']){_0x5c995d[_0x6791('0x51')]=_['merge'](_0x5c995d[_0x6791('0x51')],{'$or':_[_0x6791('0x41')](_0x5c995d[_0x6791('0x4a')],function(_0x46d04c){var _0x18f02e={};_0x18f02e[_0x46d04c]={'$like':'%'+_0x2048dd[_0x6791('0x47')][_0x6791('0x53')]+'%'};return _0x18f02e;})});}if(_0x2048dd[_0x6791('0x47')]['$gte']){var _0x3d11f6=_0x2048dd['query'][_0x6791('0xa5')][_0x6791('0xa6')](',');var _0xe2d681={};_0xe2d681[_0x3d11f6[0x0]]={'$gte':moment(_0x3d11f6[0x1])[_0x6791('0xa7')](_0x6791('0xa8'))};_0x5c995d[_0x6791('0x51')]=_[_0x6791('0x54')](_0x5c995d['where'],_0xe2d681);}_0x5c995d=_[_0x6791('0x54')]({},_0x5c995d,_0x2048dd['options']);return db['FaxMessage'][_0x6791('0x2e')]({'where':_0x5c995d[_0x6791('0x51')]})[_0x6791('0x3a')](function(_0x13be6b){_0x1abe6a[_0x6791('0x2e')]=_0x13be6b;if(_0x2048dd[_0x6791('0x47')]['includeAll']){_0x5c995d[_0x6791('0x57')]=[{'all':!![]}];}return db[_0x6791('0xa4')][_0x6791('0x6c')](_0x5c995d);})['then'](function(_0x42b729){_0x1abe6a[_0x6791('0x6d')]=_0x42b729;return _0x1abe6a;});}})[_0x6791('0x3a')](respondWithFilteredResult(_0x465fc4,_0x5c995d))[_0x6791('0x28')](handleError(_0x465fc4,null));};exports[_0x6791('0x3e')]=function(_0x2d5291,_0x881fc6,_0x8801cd){var _0x44bd43,_0x5b9d67={},_0x3e332f;if(_0x2d5291[_0x6791('0x63')]['to']){_0x3e332f=_0x2d5291['body']['to'][0x0];}return db['FaxAccount']['find']({'where':{'id':_0x2d5291[_0x6791('0x59')]['id']},'include':[{'model':db[_0x6791('0xa9')],'as':_0x6791('0xaa'),'include':[{'model':db[_0x6791('0x77')],'as':_0x6791('0xab'),'where':{'fax':_0x3e332f},'limit':0x1,'order':[[_0x6791('0xa0'),'DESC']]}]}]})['then'](handleEntityNotFound(_0x881fc6,null))['then'](function(_0x48d62f){_0x44bd43=_0x48d62f;if(_0x2d5291[_0x6791('0x63')]['attachments']&&_0x2d5291['body'][_0x6791('0xac')][_0x6791('0x4c')]){for(var _0x11da2a=0x0;_0x11da2a<_0x2d5291['body'][_0x6791('0xac')][_0x6791('0x4c')];_0x11da2a+=0x1){_0x2d5291['body'][_0x6791('0xac')][_0x11da2a]={'filename':_0x2d5291[_0x6791('0x63')][_0x6791('0xac')][_0x11da2a]['name'],'id':_0x2d5291[_0x6791('0x63')][_0x6791('0xac')][_0x11da2a]['id'],'path':path[_0x6791('0xad')](config[_0x6791('0xae')],_0x6791('0xaf'),_0x2d5291[_0x6791('0x63')][_0x6791('0xac')][_0x11da2a]['basename'])};}}return respondWithRpcPromise('CheckAfterSend',_0x6791('0xb0'),{'FaxAccountId':_[_0x6791('0xb1')](_0x2d5291[_0x6791('0x59')]['id'])?undefined:_0x2d5291[_0x6791('0x59')]['id'],'path':_[_0x6791('0xb1')](_0x2d5291['body'][_0x6791('0xac')][0x0][_0x6791('0xb2')])?undefined:_0x2d5291[_0x6791('0x63')][_0x6791('0xac')][0x0]['path'],'fax':_['isNil'](_0x2d5291[_0x6791('0x63')]['to'][0x0])?undefined:_0x2d5291[_0x6791('0x63')]['to'][0x0]},client9002);})[_0x6791('0x3a')](function(){if(_0x44bd43){if(_[_0x6791('0xb1')](_0x2d5291[_0x6791('0x63')][_0x6791('0xb3')])){_0x2d5291[_0x6791('0x63')]['from']=util[_0x6791('0xa7')](_0x6791('0xb4'),_0x44bd43['name'],_0x44bd43[_0x6791('0xb5')]);}if(_0x44bd43[_0x6791('0xaa')]){if(_0x44bd43[_0x6791('0xaa')]['Contacts'][_0x6791('0x4c')]){return _0x44bd43[_0x6791('0xaa')][_0x6791('0xab')][0x0];}else{return db[_0x6791('0x77')]['create'](_[_0x6791('0x18')](_0x2d5291[_0x6791('0x63')],{'firstName':_0x2d5291[_0x6791('0x63')]['to'][0x0],'phone':_0x2d5291[_0x6791('0x63')]['to'][0x0],'fax':_0x2d5291['body']['to'][0x0],'ListId':_0x44bd43[_0x6791('0xb6')]}));}}else{throw new Error('List\x20not\x20found');}}else{throw new Error(_0x6791('0xb7'));}})[_0x6791('0x3a')](function(_0x12109f){if(_0x12109f){return db[_0x6791('0x75')][_0x6791('0x60')]({'where':{'ContactId':_0x12109f['id'],'closed':![],'FaxAccountId':_0x44bd43['id']}})[_0x6791('0x3a')](function(_0x4842b3){if(_0x4842b3){return[_0x4842b3,![]];}return db[_0x6791('0x75')][_0x6791('0x5b')]({'UserId':_0x2d5291[_0x6791('0x5c')]['id'],'ContactId':_0x12109f['id'],'FaxAccountId':_0x44bd43['id'],'fax':_0x2d5291[_0x6791('0x63')]['to'][0x0],'firstMsgDirection':'out','Messages':[_['merge'](_0x2d5291['body'],{'read':![],'body':_0x2d5291['body'][_0x6791('0xac')][0x0][_0x6791('0xb8')],'FaxAccountId':_0x44bd43['id'],'UserId':_0x2d5291[_0x6791('0x5c')]['id'],'ContactId':_0x12109f['id'],'AttachmentId':_0x2d5291[_0x6791('0x63')][_0x6791('0xac')][0x0]['id']})]},{'include':[{'model':db[_0x6791('0xa4')],'as':_0x6791('0xb9')}]})['then'](function(_0x11ddc8){return[_0x11ddc8,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0x6791('0xba')](function(_0x150b0e,_0x1564f9){if(_0x1564f9){return _0x150b0e;}return db['FaxMessage'][_0x6791('0x5b')]({'direction':_0x6791('0xbb'),'read':![],'body':_0x2d5291[_0x6791('0x63')][_0x6791('0xac')][0x0][_0x6791('0xb8')],'FaxAccountId':_0x44bd43['id'],'FaxInteractionId':_0x150b0e['id'],'UserId':_0x2d5291[_0x6791('0x5c')]['id'],'ContactId':_0x150b0e['ContactId'],'AttachmentId':_0x2d5291[_0x6791('0x63')]['attachments'][0x0]['id']})['then'](function(_0x4ce391){_0x150b0e[_0x6791('0xbc')][_0x6791('0xb9')]=[];_0x150b0e[_0x6791('0xbc')][_0x6791('0xb9')][_0x6791('0x8d')](_0x4ce391[_0x6791('0xbc')]);return _0x150b0e;});})[_0x6791('0x3a')](function(_0x26976b){respondWithRpcPromise(_0x6791('0xbd'),'SendFax',{'FaxAccountId':_[_0x6791('0xb1')](_0x2d5291['params']['id'])?undefined:_0x2d5291[_0x6791('0x59')]['id'],'path':_[_0x6791('0xb1')](_0x2d5291[_0x6791('0x63')][_0x6791('0xac')][0x0][_0x6791('0xb2')])?undefined:_0x2d5291[_0x6791('0x63')][_0x6791('0xac')][0x0]['path'],'fax':_[_0x6791('0xb1')](_0x2d5291['body']['to'][0x0])?undefined:_0x2d5291['body']['to'][0x0],'AttachmentId':_0x2d5291[_0x6791('0x63')][_0x6791('0xac')][0x0]['id']},client9002)['then'](function(_0x3ef666){logger[_0x6791('0xbe')](_0x6791('0xbf'),_0x3ef666);})[_0x6791('0x28')](function(_0x45eeef){logger['info'](_0x6791('0xbf'),_0x45eeef);});return _0x26976b;})[_0x6791('0x3a')](respondWithResult(_0x881fc6,null))[_0x6791('0x28')](handleError(_0x881fc6,null));};exports[_0x6791('0xc0')]=function(_0x243933,_0x5b4ca4,_0x21bbae){return db['FaxAccount']['find']({'where':{'id':_0x243933[_0x6791('0x59')]['id']}})['then'](handleEntityNotFound(_0x5b4ca4,null))[_0x6791('0x3a')](function(_0x53ce18){if(_0x53ce18){return _0x53ce18[_0x6791('0xc0')](_0x243933[_0x6791('0x63')][_0x6791('0x6f')],_[_0x6791('0x76')](_0x243933[_0x6791('0x63')],[_0x6791('0x6f'),'id'])||{})[_0x6791('0xba')](function(_0x10707e){for(var _0x2d4ddf=0x0;_0x2d4ddf<_0x243933['body']['ids']['length'];_0x2d4ddf+=0x1){socket[_0x6791('0xc1')](_0x6791('0xc2'),{'UserId':_0x243933[_0x6791('0x63')][_0x6791('0x6f')][_0x2d4ddf],'FaxAccountId':_0x243933[_0x6791('0x59')]['id']});}return _0x10707e;});}})[_0x6791('0x3a')](respondWithResult(_0x5b4ca4,null))['catch'](handleError(_0x5b4ca4,null));};exports['removeAgents']=function(_0x21e688,_0xd2e245,_0xb975f0){return db['FaxAccount'][_0x6791('0x60')]({'where':{'id':_0x21e688[_0x6791('0x59')]['id']}})['then'](handleEntityNotFound(_0xd2e245,null))['then'](function(_0x348ac3){if(_0x348ac3){return _0x348ac3[_0x6791('0xc3')](_0x21e688[_0x6791('0x47')][_0x6791('0x6f')])[_0x6791('0x3a')](function(){if(_[_0x6791('0xc4')](_0x21e688[_0x6791('0x47')][_0x6791('0x6f')])){for(var _0x1671ab=0x0;_0x1671ab<_0x21e688[_0x6791('0x47')][_0x6791('0x6f')][_0x6791('0x4c')];_0x1671ab+=0x1){socket[_0x6791('0xc1')](_0x6791('0xc5'),{'UserId':Number(_0x21e688[_0x6791('0x47')][_0x6791('0x6f')][_0x1671ab]),'FaxAccountId':Number(_0x21e688['params']['id'])});}}else{socket[_0x6791('0xc1')]('userFaxAccount:remove',{'UserId':Number(_0x21e688[_0x6791('0x47')][_0x6791('0x6f')]),'FaxAccountId':Number(_0x21e688['params']['id'])});}});}})[_0x6791('0x3a')](respondWithStatusCode(_0xd2e245,null))[_0x6791('0x28')](handleError(_0xd2e245,null));};exports['getAgents']=function(_0x4171b9,_0x5725a8,_0x1c6f23){var _0xd53708={};var _0x5cc96d={};var _0x5152ec;var _0x5dbf0c;return db[_0x6791('0x42')][_0x6791('0x67')]({'where':{'id':_0x4171b9['params']['id']}})[_0x6791('0x3a')](handleEntityNotFound(_0x5725a8,null))[_0x6791('0x3a')](function(_0x2dff7a){if(_0x2dff7a){_0x5152ec=_0x2dff7a;_0x5cc96d['model']=_[_0x6791('0x48')](db[_0x6791('0x79')][_0x6791('0x68')]);_0x5cc96d[_0x6791('0x47')]=_['keys'](_0x4171b9[_0x6791('0x47')]);_0x5cc96d['filters']=_[_0x6791('0x49')](_0x5cc96d[_0x6791('0x46')],_0x5cc96d[_0x6791('0x47')]);_0xd53708['attributes']=_[_0x6791('0x49')](_0x5cc96d[_0x6791('0x46')],qs['fields'](_0x4171b9[_0x6791('0x47')][_0x6791('0x4b')]));_0xd53708['attributes']=_0xd53708[_0x6791('0x4a')][_0x6791('0x4c')]?_0xd53708[_0x6791('0x4a')]:_0x5cc96d[_0x6791('0x46')];_0xd53708[_0x6791('0x4f')]=qs[_0x6791('0x50')](_0x4171b9[_0x6791('0x47')]['sort']);_0xd53708[_0x6791('0x51')]=qs[_0x6791('0x52')](_[_0x6791('0x69')](_0x4171b9[_0x6791('0x47')],_0x5cc96d[_0x6791('0x52')]));if(_0x4171b9[_0x6791('0x47')][_0x6791('0x53')]){_0xd53708[_0x6791('0x51')]=_[_0x6791('0x54')](_0xd53708[_0x6791('0x51')],{'$or':_[_0x6791('0x41')](_0xd53708[_0x6791('0x4a')],function(_0x363a32){var _0x3b3363={};_0x3b3363[_0x363a32]={'$like':'%'+_0x4171b9[_0x6791('0x47')]['filter']+'%'};return _0x3b3363;})});}_0xd53708=_['merge']({},_0xd53708,_0x4171b9[_0x6791('0x6a')]);return _0x5152ec[_0x6791('0xc6')](_0xd53708);}})['then'](function(_0x32a122){if(_0x32a122){_0x5dbf0c=_0x32a122['length'];if(!_0x4171b9[_0x6791('0x47')][_0x6791('0x4d')](_0x6791('0x4e'))){_0xd53708[_0x6791('0x2c')]=qs[_0x6791('0x2c')](_0x4171b9[_0x6791('0x47')][_0x6791('0x2c')]);_0xd53708[_0x6791('0x2b')]=qs[_0x6791('0x2b')](_0x4171b9[_0x6791('0x47')][_0x6791('0x2b')]);}return _0x5152ec[_0x6791('0xc6')](_0xd53708);}})['then'](function(_0x2a0bde){if(_0x2a0bde){return _0x2a0bde?{'count':_0x5dbf0c,'rows':_0x2a0bde}:null;}})[_0x6791('0x3a')](respondWithResult(_0x5725a8,null))[_0x6791('0x28')](handleError(_0x5725a8,null));}; \ No newline at end of file +var _0x5f66=['DESC','attachments','root','server/files/attachments','CheckAfterSend','isNil','from','format','\x22%s\x22\x20<%s>','fax','ListId','List\x20not\x20found','Send\x20Fax\x20failed','out','filename','spread','dataValues','Messages','SendFax','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','User','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','redis','localhost','socket.io-emitter','./faxAccount.socket','register','jayson/promise','client','http','request','then','info','debug','error','FaxAccount,\x20%s,\x20%s','message','request\x20sent','result','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','UserProfileResource','end','name','send','index','Pause','FaxAccount','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','mandatoryDispositionPause','describe','addDisposition','FaxAccountId','Disposition','getDispositions','findOne','merge','removeDispositions','addAnswer','getAnswers','CannedAnswer','removeAnswers','addInteraction','FaxInteraction','ids','omit','getInteractions','CmContact','Contact','fullname','internal','Tag','color','tag','sequelize','FaxApplication','bulkCreate','findAndCountAll','getApplications','context','from-voip-provider','exten','app','system','Fax\x20Extension','priority','appdata','push','Answer','CDR(type)=inbound-fax','Set','ecm','localstationid','gateway','headerinfo','minrate','modem','t38timeout','FAXOPT(','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','addAccountApplications','transaction','VoiceExtension','updateAccountApplications','tech','createdAt','updatedAt','TrunkId','findById','getMessages','FaxMessage','$gte','split','CmList','List','Contacts'];(function(_0x496517,_0x5e89f3){var _0x10a99e=function(_0x1e6e6b){while(--_0x1e6e6b){_0x496517['push'](_0x496517['shift']());}};_0x10a99e(++_0x5e89f3);}(_0x5f66,0x1a0));var _0x65f6=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x5f66[_0x432682];return _0x463d05;};'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'];config[_0x65f6('0x14')]=_['defaults'](config[_0x65f6('0x14')],{'host':_0x65f6('0x15'),'port':0x18eb});var socket=require(_0x65f6('0x16'))(new Redis(config[_0x65f6('0x14')]));require(_0x65f6('0x17'))[_0x65f6('0x18')](socket);var jayson=require(_0x65f6('0x19'));var client=jayson[_0x65f6('0x1a')][_0x65f6('0x1b')]({'port':0x232c});var client9002=jayson[_0x65f6('0x1a')]['http']({'port':0x232a});function respondWithRpcPromise(_0x19b9ff,_0x49a913,_0x5dd324,_0x1693e6){return new BPromise(function(_0x5c69f8,_0x37330d){var _0x1c955c=_0x1693e6||client;return _0x1c955c[_0x65f6('0x1c')](_0x19b9ff,_0x5dd324)[_0x65f6('0x1d')](function(_0xc8660c){logger[_0x65f6('0x1e')]('FaxAccount,\x20%s,\x20%s',_0x49a913,'request\x20sent');logger[_0x65f6('0x1f')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x49a913,'request\x20sent',JSON['stringify'](_0xc8660c));if(_0xc8660c[_0x65f6('0x20')]){if(_0xc8660c[_0x65f6('0x20')]['code']===0x1f4){logger[_0x65f6('0x20')](_0x65f6('0x21'),_0x49a913,_0xc8660c[_0x65f6('0x20')][_0x65f6('0x22')]);return _0x37330d(_0xc8660c[_0x65f6('0x20')][_0x65f6('0x22')]);}logger['error'](_0x65f6('0x21'),_0x49a913,_0xc8660c['error']['message']);return _0x5c69f8(_0xc8660c[_0x65f6('0x20')][_0x65f6('0x22')]);}else{logger['info'](_0x65f6('0x21'),_0x49a913,_0x65f6('0x23'));_0x5c69f8(_0xc8660c[_0x65f6('0x24')][_0x65f6('0x22')]);}})['catch'](function(_0x9d7bb0){logger[_0x65f6('0x20')](_0x65f6('0x21'),_0x49a913,_0x9d7bb0);_0x37330d(_0x9d7bb0);});});}function respondWithStatusCode(_0x5963e0,_0x5cb131){_0x5cb131=_0x5cb131||0xcc;return function(_0x4fde2f){if(_0x4fde2f){return _0x5963e0[_0x65f6('0x25')](_0x5cb131);}return _0x5963e0[_0x65f6('0x26')](_0x5cb131)['end']();};}function respondWithResult(_0x296cd9,_0x28f710){_0x28f710=_0x28f710||0xc8;return function(_0x52277c){if(_0x52277c){return _0x296cd9[_0x65f6('0x26')](_0x28f710)[_0x65f6('0x27')](_0x52277c);}};}function respondWithFilteredResult(_0x28d0df,_0x559330){return function(_0x4ac04b){if(_0x4ac04b){var _0x488d36=typeof _0x559330[_0x65f6('0x28')]===_0x65f6('0x29')&&typeof _0x559330[_0x65f6('0x2a')]===_0x65f6('0x29');var _0x518cac=_0x4ac04b[_0x65f6('0x2b')];var _0x144e55=_0x488d36?0x0:_0x559330['offset'];var _0x4ea23d=_0x488d36?_0x4ac04b[_0x65f6('0x2b')]:_0x559330[_0x65f6('0x28')]+_0x559330['limit'];var _0x4e50c0;if(_0x4ea23d>=_0x518cac){_0x4ea23d=_0x518cac;_0x4e50c0=0xc8;}else{_0x4e50c0=0xce;}_0x28d0df[_0x65f6('0x26')](_0x4e50c0);return _0x28d0df[_0x65f6('0x2c')](_0x65f6('0x2d'),_0x144e55+'-'+_0x4ea23d+'/'+_0x518cac)[_0x65f6('0x27')](_0x4ac04b);}return null;};}function patchUpdates(_0x1217fd){return function(_0x2d32be){try{jsonpatch['apply'](_0x2d32be,_0x1217fd,!![]);}catch(_0x103265){return BPromise[_0x65f6('0x2e')](_0x103265);}return _0x2d32be[_0x65f6('0x2f')]();};}function saveUpdates(_0x4bc037,_0x217f35){return function(_0x2a7aa8){if(_0x2a7aa8){return _0x2a7aa8[_0x65f6('0x30')](_0x4bc037)[_0x65f6('0x1d')](function(_0x37c086){return _0x37c086;});}return null;};}function removeEntity(_0x2f054c,_0x4d4d84){return function(_0x3c7c58){if(_0x3c7c58){return _0x3c7c58[_0x65f6('0x31')]()['then'](function(){var _0x36dbf4=_0x3c7c58['get']({'plain':!![]});var _0x2b403b='FaxAccounts';return db[_0x65f6('0x32')][_0x65f6('0x31')]({'where':{'type':_0x2b403b,'resourceId':_0x36dbf4['id']}})['then'](function(){return _0x3c7c58;});})[_0x65f6('0x1d')](function(){_0x2f054c[_0x65f6('0x26')](0xcc)[_0x65f6('0x33')]();});}};}function handleEntityNotFound(_0x515648,_0x582c7e){return function(_0x30109d){if(!_0x30109d){_0x515648['sendStatus'](0x194);}return _0x30109d;};}function handleError(_0x26de30,_0x4e6653){_0x4e6653=_0x4e6653||0x1f4;return function(_0x22d760){logger[_0x65f6('0x20')](_0x22d760['stack']);if(_0x22d760[_0x65f6('0x34')]){delete _0x22d760['name'];}_0x26de30['status'](_0x4e6653)[_0x65f6('0x35')](_0x22d760);};}exports[_0x65f6('0x36')]=function(_0x413956,_0x313be5){var _0xbe54fe={'include':[{'model':db[_0x65f6('0x37')],'as':'mandatoryDispositionPause'}]},_0x28845a={},_0x1a55da={'count':0x0,'rows':[]};var _0x3aa254=_['map'](db[_0x65f6('0x38')][_0x65f6('0x39')],function(_0x4ba7db){return{'name':_0x4ba7db[_0x65f6('0x3a')],'type':_0x4ba7db['type'][_0x65f6('0x3b')]};});_0x28845a[_0x65f6('0x3c')]=_[_0x65f6('0x3d')](_0x3aa254,_0x65f6('0x34'));_0x28845a[_0x65f6('0x3e')]=_[_0x65f6('0x3f')](_0x413956[_0x65f6('0x3e')]);_0x28845a[_0x65f6('0x40')]=_[_0x65f6('0x41')](_0x28845a['model'],_0x28845a[_0x65f6('0x3e')]);_0xbe54fe[_0x65f6('0x42')]=_[_0x65f6('0x41')](_0x28845a[_0x65f6('0x3c')],qs[_0x65f6('0x43')](_0x413956[_0x65f6('0x3e')][_0x65f6('0x43')]));_0xbe54fe[_0x65f6('0x42')]=_0xbe54fe[_0x65f6('0x42')][_0x65f6('0x44')]?_0xbe54fe[_0x65f6('0x42')]:_0x28845a[_0x65f6('0x3c')];if(!_0x413956[_0x65f6('0x3e')][_0x65f6('0x45')](_0x65f6('0x46'))){_0xbe54fe[_0x65f6('0x2a')]=qs['limit'](_0x413956[_0x65f6('0x3e')][_0x65f6('0x2a')]);_0xbe54fe[_0x65f6('0x28')]=qs[_0x65f6('0x28')](_0x413956['query'][_0x65f6('0x28')]);}_0xbe54fe[_0x65f6('0x47')]=qs[_0x65f6('0x48')](_0x413956['query'][_0x65f6('0x48')]);_0xbe54fe[_0x65f6('0x49')]=qs[_0x65f6('0x40')](_[_0x65f6('0x4a')](_0x413956['query'],_0x28845a[_0x65f6('0x40')]),_0x3aa254);if(_0x413956['query'][_0x65f6('0x4b')]){_0xbe54fe[_0x65f6('0x49')]=_['merge'](_0xbe54fe[_0x65f6('0x49')],{'$or':_['map'](_0x3aa254,function(_0x30812d){if(_0x30812d[_0x65f6('0x4c')]!==_0x65f6('0x4d')){var _0xc0db01={};_0xc0db01[_0x30812d[_0x65f6('0x34')]]={'$like':'%'+_0x413956[_0x65f6('0x3e')]['filter']+'%'};return _0xc0db01;}})});}_0xbe54fe=_['merge']({},_0xbe54fe,_0x413956[_0x65f6('0x4e')]);var _0x15d3ba={'where':_0xbe54fe[_0x65f6('0x49')]};return db[_0x65f6('0x38')][_0x65f6('0x2b')](_0x15d3ba)[_0x65f6('0x1d')](function(_0x149c28){_0x1a55da[_0x65f6('0x2b')]=_0x149c28;if(_0x413956[_0x65f6('0x3e')]['includeAll']){_0xbe54fe[_0x65f6('0x4f')]=[{'all':!![]}];}return db[_0x65f6('0x38')][_0x65f6('0x50')](_0xbe54fe);})['then'](function(_0x47e749){_0x1a55da[_0x65f6('0x51')]=_0x47e749;return _0x1a55da;})['then'](respondWithFilteredResult(_0x313be5,_0xbe54fe))[_0x65f6('0x52')](handleError(_0x313be5,null));};exports[_0x65f6('0x53')]=function(_0x57eb04,_0x309ec6){var _0x4f96c4={'raw':![],'where':{'id':_0x57eb04[_0x65f6('0x54')]['id']},'include':[{'model':db[_0x65f6('0x37')],'as':'mandatoryDispositionPause'}]},_0x247be3={};_0x247be3[_0x65f6('0x3c')]=_[_0x65f6('0x3f')](db['FaxAccount'][_0x65f6('0x39')]);_0x247be3[_0x65f6('0x3e')]=_['keys'](_0x57eb04[_0x65f6('0x3e')]);_0x247be3[_0x65f6('0x40')]=_[_0x65f6('0x41')](_0x247be3[_0x65f6('0x3c')],_0x247be3[_0x65f6('0x3e')]);_0x4f96c4[_0x65f6('0x42')]=_[_0x65f6('0x41')](_0x247be3[_0x65f6('0x3c')],qs['fields'](_0x57eb04['query']['fields']));_0x4f96c4[_0x65f6('0x42')]=_0x4f96c4[_0x65f6('0x42')][_0x65f6('0x44')]?_0x4f96c4[_0x65f6('0x42')]:_0x247be3['model'];if(_0x57eb04[_0x65f6('0x3e')][_0x65f6('0x55')]){_0x4f96c4[_0x65f6('0x4f')]=[{'all':!![]}];}_0x4f96c4=_['merge']({},_0x4f96c4,_0x57eb04[_0x65f6('0x4e')]);return db[_0x65f6('0x38')][_0x65f6('0x56')](_0x4f96c4)['then'](handleEntityNotFound(_0x309ec6,null))['then'](respondWithResult(_0x309ec6,null))[_0x65f6('0x52')](handleError(_0x309ec6,null));};exports[_0x65f6('0x57')]=function(_0x4125cb,_0x39364f){return db[_0x65f6('0x38')][_0x65f6('0x57')](_0x4125cb[_0x65f6('0x58')],{})[_0x65f6('0x1d')](function(_0x2d8b5b){var _0xddbd90=_0x4125cb[_0x65f6('0x59')][_0x65f6('0x5a')]({'plain':!![]});if(!_0xddbd90)throw new Error(_0x65f6('0x5b'));if(_0xddbd90[_0x65f6('0x5c')]==='user'){var _0x47610a=_0x2d8b5b[_0x65f6('0x5a')]({'plain':!![]});var _0x42a805='FaxAccounts';return db[_0x65f6('0x5d')][_0x65f6('0x56')]({'where':{'name':_0x42a805,'userProfileId':_0xddbd90[_0x65f6('0x5e')]},'raw':!![]})[_0x65f6('0x1d')](function(_0x4ef333){if(_0x4ef333&&_0x4ef333[_0x65f6('0x5f')]===0x0){return db[_0x65f6('0x32')][_0x65f6('0x57')]({'name':_0x47610a[_0x65f6('0x34')],'resourceId':_0x47610a['id'],'type':_0x4ef333['name'],'sectionId':_0x4ef333['id']},{})[_0x65f6('0x1d')](function(){return _0x2d8b5b;});}else{return _0x2d8b5b;}})[_0x65f6('0x52')](function(_0x5c55e4){logger[_0x65f6('0x20')](_0x65f6('0x60'),_0x5c55e4);throw _0x5c55e4;});}return _0x2d8b5b;})[_0x65f6('0x1d')](respondWithResult(_0x39364f,0xc9))['catch'](handleError(_0x39364f,null));};exports[_0x65f6('0x30')]=function(_0x439365,_0x3974ef){if(_0x439365[_0x65f6('0x58')]['id']){delete _0x439365[_0x65f6('0x58')]['id'];}return db[_0x65f6('0x38')]['find']({'where':{'id':_0x439365['params']['id']},'include':[{'model':db['Pause'],'as':_0x65f6('0x61')}]})[_0x65f6('0x1d')](handleEntityNotFound(_0x3974ef,null))[_0x65f6('0x1d')](saveUpdates(_0x439365[_0x65f6('0x58')],null))[_0x65f6('0x1d')](respondWithResult(_0x3974ef,null))[_0x65f6('0x52')](handleError(_0x3974ef,null));};exports['destroy']=function(_0xfbfebc,_0x1d1532){return db['FaxAccount'][_0x65f6('0x56')]({'where':{'id':_0xfbfebc[_0x65f6('0x54')]['id']}})[_0x65f6('0x1d')](handleEntityNotFound(_0x1d1532,null))['then'](removeEntity(_0x1d1532,null))[_0x65f6('0x52')](handleError(_0x1d1532,null));};exports[_0x65f6('0x62')]=function(_0x4e83dc,_0x271d76){return db[_0x65f6('0x38')][_0x65f6('0x62')]()[_0x65f6('0x1d')](respondWithResult(_0x271d76,null))[_0x65f6('0x52')](handleError(_0x271d76,null));};exports[_0x65f6('0x63')]=function(_0x2dbf47,_0x4e9bc1,_0x4e5e94){if(_0x2dbf47[_0x65f6('0x58')]['id']){delete _0x2dbf47[_0x65f6('0x58')]['id'];}return db['FaxAccount'][_0x65f6('0x56')]({'where':{'id':_0x2dbf47['params']['id']}})[_0x65f6('0x1d')](handleEntityNotFound(_0x4e9bc1,null))['then'](function(_0x440df1){if(_0x440df1){_0x2dbf47[_0x65f6('0x58')][_0x65f6('0x64')]=_0x440df1['id'];return db[_0x65f6('0x65')][_0x65f6('0x57')](_0x2dbf47[_0x65f6('0x58')]);}})[_0x65f6('0x1d')](respondWithResult(_0x4e9bc1,null))[_0x65f6('0x52')](handleError(_0x4e9bc1,null));};exports[_0x65f6('0x66')]=function(_0x4b7ecd,_0x480190,_0x3d7619){var _0x13ee4b={'raw':![],'where':{}};var _0x37bc3b={};var _0x51497f={'count':0x0,'rows':[]};return db['FaxAccount'][_0x65f6('0x67')]({'where':{'id':_0x4b7ecd[_0x65f6('0x54')]['id']}})[_0x65f6('0x1d')](handleEntityNotFound(_0x480190,null))[_0x65f6('0x1d')](function(_0x2c330e){if(_0x2c330e){_0x37bc3b[_0x65f6('0x3c')]=_['keys'](db['Disposition'][_0x65f6('0x39')]);_0x37bc3b[_0x65f6('0x3e')]=_['keys'](_0x4b7ecd[_0x65f6('0x3e')]);_0x37bc3b['filters']=_[_0x65f6('0x41')](_0x37bc3b[_0x65f6('0x3c')],_0x37bc3b[_0x65f6('0x3e')]);_0x13ee4b[_0x65f6('0x42')]=_['intersection'](_0x37bc3b[_0x65f6('0x3c')],qs[_0x65f6('0x43')](_0x4b7ecd[_0x65f6('0x3e')]['fields']));_0x13ee4b['attributes']=_0x13ee4b[_0x65f6('0x42')]['length']?_0x13ee4b[_0x65f6('0x42')]:_0x37bc3b[_0x65f6('0x3c')];if(!_0x4b7ecd[_0x65f6('0x3e')][_0x65f6('0x45')]('nolimit')){_0x13ee4b['limit']=qs['limit'](_0x4b7ecd[_0x65f6('0x3e')][_0x65f6('0x2a')]);_0x13ee4b[_0x65f6('0x28')]=qs['offset'](_0x4b7ecd[_0x65f6('0x3e')][_0x65f6('0x28')]);}_0x13ee4b[_0x65f6('0x47')]=qs['sort'](_0x4b7ecd[_0x65f6('0x3e')][_0x65f6('0x48')]);_0x13ee4b['where']=qs[_0x65f6('0x40')](_[_0x65f6('0x4a')](_0x4b7ecd['query'],_0x37bc3b[_0x65f6('0x40')]));_0x13ee4b['where'][_0x65f6('0x64')]=_0x2c330e['id'];if(_0x4b7ecd['query'][_0x65f6('0x4b')]){_0x13ee4b[_0x65f6('0x49')]=_['merge'](_0x13ee4b[_0x65f6('0x49')],{'$or':_[_0x65f6('0x3d')](_0x13ee4b[_0x65f6('0x42')],function(_0x299b85){var _0x3b84f1={};_0x3b84f1[_0x299b85]={'$like':'%'+_0x4b7ecd[_0x65f6('0x3e')][_0x65f6('0x4b')]+'%'};return _0x3b84f1;})});}_0x13ee4b=_[_0x65f6('0x68')]({},_0x13ee4b,_0x4b7ecd[_0x65f6('0x4e')]);return db[_0x65f6('0x65')][_0x65f6('0x2b')]({'where':_0x13ee4b['where']})[_0x65f6('0x1d')](function(_0x1cf1bd){_0x51497f[_0x65f6('0x2b')]=_0x1cf1bd;if(_0x4b7ecd[_0x65f6('0x3e')]['includeAll']){_0x13ee4b[_0x65f6('0x4f')]=[{'all':!![]}];}return db[_0x65f6('0x65')]['findAll'](_0x13ee4b);})[_0x65f6('0x1d')](function(_0x556f53){_0x51497f[_0x65f6('0x51')]=_0x556f53;return _0x51497f;});}})['then'](respondWithFilteredResult(_0x480190,_0x13ee4b))[_0x65f6('0x52')](handleError(_0x480190,null));};exports[_0x65f6('0x69')]=function(_0x5e7d9d,_0x4946c7,_0xa4a742){return db[_0x65f6('0x38')]['find']({'where':{'id':_0x5e7d9d[_0x65f6('0x54')]['id']}})[_0x65f6('0x1d')](handleEntityNotFound(_0x4946c7,null))[_0x65f6('0x1d')](function(_0x4edba0){if(_0x4edba0){return _0x4edba0[_0x65f6('0x69')](_0x5e7d9d[_0x65f6('0x3e')]['ids']);}})[_0x65f6('0x1d')](respondWithStatusCode(_0x4946c7,null))['catch'](handleError(_0x4946c7,null));};exports[_0x65f6('0x6a')]=function(_0x57eb49,_0x51105d,_0x20687f){if(_0x57eb49[_0x65f6('0x58')]['id']){delete _0x57eb49[_0x65f6('0x58')]['id'];}return db[_0x65f6('0x38')][_0x65f6('0x56')]({'where':{'id':_0x57eb49[_0x65f6('0x54')]['id']}})[_0x65f6('0x1d')](handleEntityNotFound(_0x51105d,null))[_0x65f6('0x1d')](function(_0x4d66fe){if(_0x4d66fe){_0x57eb49['body'][_0x65f6('0x64')]=_0x4d66fe['id'];return db['CannedAnswer'][_0x65f6('0x57')](_0x57eb49[_0x65f6('0x58')]);}})[_0x65f6('0x1d')](respondWithResult(_0x51105d,null))[_0x65f6('0x52')](handleError(_0x51105d,null));};exports[_0x65f6('0x6b')]=function(_0x56bd9d,_0x398cac,_0x257247){var _0x14c908={'raw':![],'where':{}};var _0x576ecd={};var _0xc7cee1={'count':0x0,'rows':[]};return db[_0x65f6('0x38')][_0x65f6('0x67')]({'where':{'id':_0x56bd9d[_0x65f6('0x54')]['id']}})[_0x65f6('0x1d')](handleEntityNotFound(_0x398cac,null))[_0x65f6('0x1d')](function(_0x53f0ea){if(_0x53f0ea){_0x576ecd['model']=_[_0x65f6('0x3f')](db[_0x65f6('0x6c')][_0x65f6('0x39')]);_0x576ecd[_0x65f6('0x3e')]=_['keys'](_0x56bd9d['query']);_0x576ecd[_0x65f6('0x40')]=_[_0x65f6('0x41')](_0x576ecd[_0x65f6('0x3c')],_0x576ecd[_0x65f6('0x3e')]);_0x14c908[_0x65f6('0x42')]=_[_0x65f6('0x41')](_0x576ecd['model'],qs['fields'](_0x56bd9d['query'][_0x65f6('0x43')]));_0x14c908[_0x65f6('0x42')]=_0x14c908[_0x65f6('0x42')][_0x65f6('0x44')]?_0x14c908['attributes']:_0x576ecd['model'];if(!_0x56bd9d[_0x65f6('0x3e')][_0x65f6('0x45')]('nolimit')){_0x14c908[_0x65f6('0x2a')]=qs['limit'](_0x56bd9d[_0x65f6('0x3e')]['limit']);_0x14c908[_0x65f6('0x28')]=qs[_0x65f6('0x28')](_0x56bd9d['query'][_0x65f6('0x28')]);}_0x14c908[_0x65f6('0x47')]=qs[_0x65f6('0x48')](_0x56bd9d[_0x65f6('0x3e')][_0x65f6('0x48')]);_0x14c908[_0x65f6('0x49')]=qs['filters'](_[_0x65f6('0x4a')](_0x56bd9d['query'],_0x576ecd[_0x65f6('0x40')]));_0x14c908['where'][_0x65f6('0x64')]=_0x53f0ea['id'];if(_0x56bd9d[_0x65f6('0x3e')][_0x65f6('0x4b')]){_0x14c908[_0x65f6('0x49')]=_['merge'](_0x14c908[_0x65f6('0x49')],{'$or':_[_0x65f6('0x3d')](_0x14c908[_0x65f6('0x42')],function(_0x5d42bd){var _0x52348e={};_0x52348e[_0x5d42bd]={'$like':'%'+_0x56bd9d[_0x65f6('0x3e')][_0x65f6('0x4b')]+'%'};return _0x52348e;})});}_0x14c908=_['merge']({},_0x14c908,_0x56bd9d[_0x65f6('0x4e')]);return db[_0x65f6('0x6c')][_0x65f6('0x2b')]({'where':_0x14c908['where']})[_0x65f6('0x1d')](function(_0xf1e6a1){_0xc7cee1['count']=_0xf1e6a1;if(_0x56bd9d[_0x65f6('0x3e')][_0x65f6('0x55')]){_0x14c908[_0x65f6('0x4f')]=[{'all':!![]}];}return db['CannedAnswer'][_0x65f6('0x50')](_0x14c908);})[_0x65f6('0x1d')](function(_0x150b5b){_0xc7cee1['rows']=_0x150b5b;return _0xc7cee1;});}})[_0x65f6('0x1d')](respondWithFilteredResult(_0x398cac,_0x14c908))['catch'](handleError(_0x398cac,null));};exports[_0x65f6('0x6d')]=function(_0x87a9e4,_0x31ec61,_0x22be6e){return db[_0x65f6('0x38')][_0x65f6('0x56')]({'where':{'id':_0x87a9e4['params']['id']}})[_0x65f6('0x1d')](handleEntityNotFound(_0x31ec61,null))[_0x65f6('0x1d')](function(_0x41efc6){if(_0x41efc6){return _0x41efc6[_0x65f6('0x6d')](_0x87a9e4[_0x65f6('0x3e')]['ids']);}})['then'](respondWithStatusCode(_0x31ec61,null))['catch'](handleError(_0x31ec61,null));};exports[_0x65f6('0x6e')]=function(_0xdced81,_0xcfc47a,_0x59b715){return db[_0x65f6('0x6f')]['find']({'where':{'id':_0xdced81['params']['id']}})[_0x65f6('0x1d')](handleEntityNotFound(_0xcfc47a,null))[_0x65f6('0x1d')](function(_0x521b6e){if(_0x521b6e){return _0x521b6e[_0x65f6('0x6e')](_0xdced81[_0x65f6('0x58')][_0x65f6('0x70')],_[_0x65f6('0x71')](_0xdced81[_0x65f6('0x58')],[_0x65f6('0x70'),'id'])||{});}})[_0x65f6('0x1d')](respondWithResult(_0xcfc47a,null))[_0x65f6('0x52')](handleError(_0xcfc47a,null));};exports[_0x65f6('0x72')]=function(_0x350641,_0x31bd06,_0x2ddda4){var _0x5c9cc0={'raw':![],'where':{}};var _0x349af7={};var _0x52dc75={'count':0x0,'rows':[]};return db['FaxAccount'][_0x65f6('0x67')]({'where':{'id':_0x350641[_0x65f6('0x54')]['id']}})[_0x65f6('0x1d')](handleEntityNotFound(_0x31bd06,null))[_0x65f6('0x1d')](function(_0x4fab49){if(_0x4fab49){_0x349af7[_0x65f6('0x3c')]=_['keys'](db['FaxInteraction'][_0x65f6('0x39')]);_0x349af7[_0x65f6('0x3e')]=_[_0x65f6('0x3f')](_0x350641[_0x65f6('0x3e')]);_0x349af7[_0x65f6('0x40')]=_[_0x65f6('0x41')](_0x349af7['model'],_0x349af7[_0x65f6('0x3e')]);_0x5c9cc0['attributes']=_[_0x65f6('0x41')](_0x349af7[_0x65f6('0x3c')],qs[_0x65f6('0x43')](_0x350641['query'][_0x65f6('0x43')]));_0x5c9cc0['attributes']=_0x5c9cc0['attributes'][_0x65f6('0x44')]?_0x5c9cc0[_0x65f6('0x42')]:_0x349af7[_0x65f6('0x3c')];if(!_0x350641[_0x65f6('0x3e')][_0x65f6('0x45')]('nolimit')){_0x5c9cc0[_0x65f6('0x2a')]=qs[_0x65f6('0x2a')](_0x350641[_0x65f6('0x3e')][_0x65f6('0x2a')]);_0x5c9cc0['offset']=qs[_0x65f6('0x28')](_0x350641[_0x65f6('0x3e')][_0x65f6('0x28')]);}_0x5c9cc0[_0x65f6('0x47')]=qs[_0x65f6('0x48')](_0x350641[_0x65f6('0x3e')][_0x65f6('0x48')]);_0x5c9cc0[_0x65f6('0x49')]=qs['filters'](_[_0x65f6('0x4a')](_0x350641[_0x65f6('0x3e')],_0x349af7[_0x65f6('0x40')]));_0x5c9cc0[_0x65f6('0x49')][_0x65f6('0x64')]=_0x4fab49['id'];if(_0x350641[_0x65f6('0x3e')]['filter']){_0x5c9cc0[_0x65f6('0x49')]=_[_0x65f6('0x68')](_0x5c9cc0['where'],{'$or':_[_0x65f6('0x3d')](_0x5c9cc0['attributes'],function(_0x24ff7c){var _0x2a7f97={};_0x2a7f97[_0x24ff7c]={'$like':'%'+_0x350641[_0x65f6('0x3e')][_0x65f6('0x4b')]+'%'};return _0x2a7f97;})});}_0x5c9cc0=_[_0x65f6('0x68')]({},_0x5c9cc0,_0x350641['options']);return db[_0x65f6('0x6f')][_0x65f6('0x2b')]({'where':_0x5c9cc0[_0x65f6('0x49')]})[_0x65f6('0x1d')](function(_0x99ca39){_0x52dc75['count']=_0x99ca39;if(_0x350641['query'][_0x65f6('0x55')]){_0x5c9cc0[_0x65f6('0x4f')]=[{'model':db[_0x65f6('0x73')],'as':_0x65f6('0x74'),'required':![]},{'model':db['User'],'as':'Owner','attributes':['name',_0x65f6('0x75'),_0x65f6('0x76')],'required':![]},{'model':db[_0x65f6('0x77')],'as':'Tags','attributes':['id',_0x65f6('0x34'),_0x65f6('0x78')],'where':_0x350641[_0x65f6('0x3e')][_0x65f6('0x79')]?{'id':_0x350641[_0x65f6('0x3e')]['tag']}:undefined,'required':_0x350641[_0x65f6('0x3e')][_0x65f6('0x79')]?!![]:![]}];}return db['FaxInteraction']['findAll'](_0x5c9cc0);})[_0x65f6('0x1d')](function(_0x173b54){_0x52dc75[_0x65f6('0x51')]=_0x173b54;return _0x52dc75;});}})[_0x65f6('0x1d')](respondWithFilteredResult(_0x31bd06,_0x5c9cc0))[_0x65f6('0x52')](handleError(_0x31bd06,null));};exports['addApplications']=function(_0x3682cc,_0x4b080a,_0x280c96){return db['FaxAccount'][_0x65f6('0x67')]({'where':{'id':_0x3682cc['params']['id']}})[_0x65f6('0x1d')](handleEntityNotFound(_0x4b080a,null))['then'](function(_0x631885){if(_0x631885){return db[_0x65f6('0x7a')]['transaction'](function(_0x4f2f43){return db[_0x65f6('0x7b')][_0x65f6('0x31')]({'where':{'FaxAccountId':_0x3682cc[_0x65f6('0x54')]['id']},'transaction':_0x4f2f43})[_0x65f6('0x1d')](function(_0x861892){var _0xf862e3=_[_0x65f6('0x3d')](_0x3682cc[_0x65f6('0x58')],function(_0x3ef6bb){_0x3ef6bb[_0x65f6('0x64')]=_0x3682cc[_0x65f6('0x54')]['id'];return _0x3ef6bb;});return db[_0x65f6('0x7b')][_0x65f6('0x7c')](_0xf862e3,{'transaction':_0x4f2f43});});})[_0x65f6('0x1d')](function(){return db[_0x65f6('0x7b')][_0x65f6('0x7d')]({'where':{'FaxAccountId':_0x3682cc[_0x65f6('0x54')]['id']},'order':'priority'});});}})[_0x65f6('0x1d')](respondWithResult(_0x4b080a,null))[_0x65f6('0x52')](handleError(_0x4b080a,null));};exports[_0x65f6('0x7e')]=function(_0x16e246,_0x172d97,_0x1dbf36){var _0x849936={};var _0x2b3415={};var _0x3c9d49;var _0x55a325;return db[_0x65f6('0x38')][_0x65f6('0x67')]({'where':{'id':_0x16e246[_0x65f6('0x54')]['id']}})[_0x65f6('0x1d')](handleEntityNotFound(_0x172d97,null))['then'](function(_0x38db52){if(_0x38db52){_0x3c9d49=_0x38db52;_0x2b3415[_0x65f6('0x3c')]=_['keys'](db[_0x65f6('0x7b')][_0x65f6('0x39')]);_0x2b3415[_0x65f6('0x3e')]=_[_0x65f6('0x3f')](_0x16e246[_0x65f6('0x3e')]);_0x2b3415[_0x65f6('0x40')]=_['intersection'](_0x2b3415[_0x65f6('0x3c')],_0x2b3415[_0x65f6('0x3e')]);_0x849936[_0x65f6('0x42')]=_[_0x65f6('0x41')](_0x2b3415['model'],qs['fields'](_0x16e246['query'][_0x65f6('0x43')]));_0x849936[_0x65f6('0x42')]=_0x849936[_0x65f6('0x42')][_0x65f6('0x44')]?_0x849936[_0x65f6('0x42')]:_0x2b3415['model'];_0x849936['order']=qs[_0x65f6('0x48')](_0x16e246[_0x65f6('0x3e')][_0x65f6('0x48')]);_0x849936['where']=qs['filters'](_[_0x65f6('0x4a')](_0x16e246['query'],_0x2b3415[_0x65f6('0x40')]));if(_0x16e246[_0x65f6('0x3e')][_0x65f6('0x4b')]){_0x849936[_0x65f6('0x49')]=_[_0x65f6('0x68')](_0x849936[_0x65f6('0x49')],{'$or':_[_0x65f6('0x3d')](_0x849936[_0x65f6('0x42')],function(_0x8f7173){var _0x4cdc4c={};_0x4cdc4c[_0x8f7173]={'$like':'%'+_0x16e246[_0x65f6('0x3e')][_0x65f6('0x4b')]+'%'};return _0x4cdc4c;})});}_0x849936=_['merge']({},_0x849936,_0x16e246[_0x65f6('0x4e')]);return _0x3c9d49['getApplications'](_0x849936);}})[_0x65f6('0x1d')](function(_0x3417b2){if(_0x3417b2){_0x55a325=_0x3417b2[_0x65f6('0x44')];if(!_0x16e246['query'][_0x65f6('0x45')]('nolimit')){_0x849936['limit']=qs[_0x65f6('0x2a')](_0x16e246[_0x65f6('0x3e')]['limit']);_0x849936[_0x65f6('0x28')]=qs['offset'](_0x16e246[_0x65f6('0x3e')][_0x65f6('0x28')]);}return _0x3c9d49[_0x65f6('0x7e')](_0x849936);}})[_0x65f6('0x1d')](function(_0x1e0121){if(_0x1e0121){return _0x1e0121?{'count':_0x55a325,'rows':_0x1e0121}:null;}})[_0x65f6('0x1d')](respondWithResult(_0x172d97,null))[_0x65f6('0x52')](handleError(_0x172d97,null));};function Extension(_0x1326cb,_0x5ed6ff,_0x1b67af,_0x420908){this[_0x65f6('0x7f')]=_0x65f6('0x80');this[_0x65f6('0x81')]=_0x1326cb['localstationid'];this[_0x65f6('0x82')]=_0x420908;this['type']=_0x65f6('0x83');this['description']=_0x65f6('0x84');this[_0x65f6('0x64')]=_0x1326cb['id'];this[_0x65f6('0x85')]=_0x5ed6ff;this[_0x65f6('0x86')]=_0x1b67af;}function createExtensionsReciveFax(_0x230eb9){var _0x400318=0x1;var _0x380318=[];_0x380318[_0x65f6('0x87')](new Extension(_0x230eb9,_0x400318,'',_0x65f6('0x88')));_0x400318+=0x1;_0x380318[_0x65f6('0x87')](new Extension(_0x230eb9,_0x400318,_0x65f6('0x89'),_0x65f6('0x8a')));_0x400318+=0x1;for(var _0x3739fd in _0x230eb9){if(_0x230eb9[_0x65f6('0x45')](_0x3739fd)&&(_0x3739fd===_0x65f6('0x8b')||_0x3739fd===_0x65f6('0x8c')||_0x3739fd===_0x65f6('0x8d')||_0x3739fd==='faxdetect'||_0x3739fd===_0x65f6('0x8e')||_0x3739fd==='maxrate'||_0x3739fd===_0x65f6('0x8f')||_0x3739fd===_0x65f6('0x90')||_0x3739fd===_0x65f6('0x91'))){_0x380318[_0x65f6('0x87')](new Extension(_0x230eb9,_0x400318,_0x65f6('0x92')+_0x3739fd+')='+_0x230eb9[_0x3739fd],_0x65f6('0x8a')));_0x400318+=0x1;}}_0x380318['push'](new Extension(_0x230eb9,_0x400318,'6',_0x65f6('0x93')));_0x400318+=0x1;_0x380318[_0x65f6('0x87')](new Extension(_0x230eb9,_0x400318,_0x65f6('0x94'),_0x65f6('0x95')));_0x400318=0x0;return _0x380318;}exports[_0x65f6('0x96')]=function(_0x40c63f,_0x967b39,_0x315251){var _0xebee03;return db[_0x65f6('0x7a')][_0x65f6('0x97')](function(_0x4ecd83){return db['FaxAccount'][_0x65f6('0x57')](_0x40c63f[_0x65f6('0x58')],{'transaction':_0x4ecd83})[_0x65f6('0x1d')](function(_0x179fed){_0xebee03=_0x179fed[_0x65f6('0x5a')]({'plain':!![]});return db[_0x65f6('0x98')][_0x65f6('0x7c')](createExtensionsReciveFax(_0xebee03),{'transaction':_0x4ecd83});});})['then'](function(){return _0xebee03;})[_0x65f6('0x1d')](respondWithResult(_0x967b39,null))[_0x65f6('0x52')](handleError(_0x967b39,null));};exports[_0x65f6('0x99')]=function(_0xa68327,_0x4e2821,_0x129f29){var _0x46a685;return db[_0x65f6('0x7a')][_0x65f6('0x97')](function(_0x4517c9){return db[_0x65f6('0x38')][_0x65f6('0x30')](_0xa68327[_0x65f6('0x58')],{'where':{'id':_0xa68327['body']['id']},'transaction':_0x4517c9})['then'](function(_0x56e0c0){return db[_0x65f6('0x98')][_0x65f6('0x31')]({'where':{'FaxAccountId':_0xa68327[_0x65f6('0x58')]['id']},'transaction':_0x4517c9})['then'](function(_0x26ae24){return db[_0x65f6('0x98')][_0x65f6('0x7c')](createExtensionsReciveFax(_['omit'](_0xa68327[_0x65f6('0x58')],[_0x65f6('0x9a'),'key',_0x65f6('0x9b'),_0x65f6('0x9c'),_0x65f6('0x9d'),'ListId'])),{'transaction':_0x4517c9});});});})[_0x65f6('0x1d')](function(){return db[_0x65f6('0x38')][_0x65f6('0x9e')](_0xa68327[_0x65f6('0x58')]['id']);})[_0x65f6('0x1d')](respondWithResult(_0x4e2821,null))[_0x65f6('0x52')](handleError(_0x4e2821,null));};exports[_0x65f6('0x9f')]=function(_0xa5af18,_0x362966,_0x128304){var _0x594e61={'raw':!![],'where':{}};var _0x43c89e={};var _0x18e1ea={'count':0x0,'rows':[]};return db[_0x65f6('0x38')]['findOne']({'where':{'id':_0xa5af18['params']['id']}})[_0x65f6('0x1d')](handleEntityNotFound(_0x362966,null))['then'](function(_0x3f5cf8){if(_0x3f5cf8){_0x43c89e[_0x65f6('0x3c')]=_[_0x65f6('0x3f')](db[_0x65f6('0xa0')][_0x65f6('0x39')]);_0x43c89e['query']=_[_0x65f6('0x3f')](_0xa5af18[_0x65f6('0x3e')]);_0x43c89e[_0x65f6('0x40')]=_[_0x65f6('0x41')](_0x43c89e['model'],_0x43c89e[_0x65f6('0x3e')]);_0x594e61[_0x65f6('0x42')]=_[_0x65f6('0x41')](_0x43c89e[_0x65f6('0x3c')],qs[_0x65f6('0x43')](_0xa5af18[_0x65f6('0x3e')][_0x65f6('0x43')]));_0x594e61[_0x65f6('0x42')]=_0x594e61[_0x65f6('0x42')][_0x65f6('0x44')]?_0x594e61[_0x65f6('0x42')]:_0x43c89e[_0x65f6('0x3c')];if(!_0xa5af18[_0x65f6('0x3e')][_0x65f6('0x45')](_0x65f6('0x46'))){_0x594e61['limit']=qs[_0x65f6('0x2a')](_0xa5af18[_0x65f6('0x3e')]['limit']);_0x594e61['offset']=qs[_0x65f6('0x28')](_0xa5af18[_0x65f6('0x3e')][_0x65f6('0x28')]);}_0x594e61[_0x65f6('0x47')]=qs[_0x65f6('0x48')](_0xa5af18[_0x65f6('0x3e')][_0x65f6('0x48')]);_0x594e61['where']=qs[_0x65f6('0x40')](_['pick'](_0xa5af18['query'],_0x43c89e[_0x65f6('0x40')]));_0x594e61[_0x65f6('0x49')][_0x65f6('0x64')]=_0x3f5cf8['id'];if(_0xa5af18[_0x65f6('0x3e')]['filter']){_0x594e61['where']=_[_0x65f6('0x68')](_0x594e61[_0x65f6('0x49')],{'$or':_['map'](_0x594e61['attributes'],function(_0x4c522d){var _0x23741d={};_0x23741d[_0x4c522d]={'$like':'%'+_0xa5af18[_0x65f6('0x3e')][_0x65f6('0x4b')]+'%'};return _0x23741d;})});}if(_0xa5af18[_0x65f6('0x3e')][_0x65f6('0xa1')]){var _0x4f36fe=_0xa5af18['query'][_0x65f6('0xa1')][_0x65f6('0xa2')](',');var _0x19fef0={};_0x19fef0[_0x4f36fe[0x0]]={'$gte':moment(_0x4f36fe[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x594e61[_0x65f6('0x49')]=_[_0x65f6('0x68')](_0x594e61['where'],_0x19fef0);}_0x594e61=_[_0x65f6('0x68')]({},_0x594e61,_0xa5af18[_0x65f6('0x4e')]);return db['FaxMessage'][_0x65f6('0x2b')]({'where':_0x594e61['where']})[_0x65f6('0x1d')](function(_0x19d502){_0x18e1ea[_0x65f6('0x2b')]=_0x19d502;if(_0xa5af18[_0x65f6('0x3e')][_0x65f6('0x55')]){_0x594e61[_0x65f6('0x4f')]=[{'all':!![]}];}return db['FaxMessage'][_0x65f6('0x50')](_0x594e61);})[_0x65f6('0x1d')](function(_0x5474c6){_0x18e1ea[_0x65f6('0x51')]=_0x5474c6;return _0x18e1ea;});}})[_0x65f6('0x1d')](respondWithFilteredResult(_0x362966,_0x594e61))[_0x65f6('0x52')](handleError(_0x362966,null));};exports['send']=function(_0x491533,_0x322df1,_0x2229ae){var _0x4254ca,_0x65b561={},_0x337ade;if(_0x491533[_0x65f6('0x58')]['to']){_0x337ade=_0x491533['body']['to'][0x0];}return db['FaxAccount'][_0x65f6('0x56')]({'where':{'id':_0x491533[_0x65f6('0x54')]['id']},'include':[{'model':db[_0x65f6('0xa3')],'as':_0x65f6('0xa4'),'include':[{'model':db[_0x65f6('0x73')],'as':_0x65f6('0xa5'),'where':{'fax':_0x337ade},'limit':0x1,'order':[[_0x65f6('0x9c'),_0x65f6('0xa6')]]}]}]})[_0x65f6('0x1d')](handleEntityNotFound(_0x322df1,null))[_0x65f6('0x1d')](function(_0x169632){_0x4254ca=_0x169632;if(_0x491533[_0x65f6('0x58')]['attachments']&&_0x491533[_0x65f6('0x58')][_0x65f6('0xa7')][_0x65f6('0x44')]){for(var _0x101050=0x0;_0x101050<_0x491533[_0x65f6('0x58')][_0x65f6('0xa7')][_0x65f6('0x44')];_0x101050+=0x1){_0x491533[_0x65f6('0x58')][_0x65f6('0xa7')][_0x101050]={'filename':_0x491533[_0x65f6('0x58')]['attachments'][_0x101050][_0x65f6('0x34')],'id':_0x491533[_0x65f6('0x58')][_0x65f6('0xa7')][_0x101050]['id'],'path':path['join'](config[_0x65f6('0xa8')],_0x65f6('0xa9'),_0x491533[_0x65f6('0x58')]['attachments'][_0x101050]['basename'])};}}return respondWithRpcPromise(_0x65f6('0xaa'),_0x65f6('0xaa'),{'FaxAccountId':_[_0x65f6('0xab')](_0x491533[_0x65f6('0x54')]['id'])?undefined:_0x491533[_0x65f6('0x54')]['id'],'path':_[_0x65f6('0xab')](_0x491533[_0x65f6('0x58')][_0x65f6('0xa7')][0x0][_0x65f6('0x6')])?undefined:_0x491533[_0x65f6('0x58')][_0x65f6('0xa7')][0x0][_0x65f6('0x6')],'fax':_[_0x65f6('0xab')](_0x491533[_0x65f6('0x58')]['to'][0x0])?undefined:_0x491533[_0x65f6('0x58')]['to'][0x0]},client9002);})[_0x65f6('0x1d')](function(){if(_0x4254ca){if(_[_0x65f6('0xab')](_0x491533[_0x65f6('0x58')]['from'])){_0x491533[_0x65f6('0x58')][_0x65f6('0xac')]=util[_0x65f6('0xad')](_0x65f6('0xae'),_0x4254ca['name'],_0x4254ca[_0x65f6('0xaf')]);}if(_0x4254ca['List']){if(_0x4254ca[_0x65f6('0xa4')][_0x65f6('0xa5')][_0x65f6('0x44')]){return _0x4254ca[_0x65f6('0xa4')][_0x65f6('0xa5')][0x0];}else{return db['CmContact'][_0x65f6('0x57')](_['defaults'](_0x491533['body'],{'firstName':_0x491533['body']['to'][0x0],'phone':_0x491533[_0x65f6('0x58')]['to'][0x0],'fax':_0x491533['body']['to'][0x0],'ListId':_0x4254ca[_0x65f6('0xb0')]}));}}else{throw new Error(_0x65f6('0xb1'));}}else{throw new Error(_0x65f6('0xb2'));}})[_0x65f6('0x1d')](function(_0x33290a){if(_0x33290a){return db[_0x65f6('0x6f')][_0x65f6('0x56')]({'where':{'ContactId':_0x33290a['id'],'closed':![],'FaxAccountId':_0x4254ca['id']}})[_0x65f6('0x1d')](function(_0x4887c1){if(_0x4887c1){return[_0x4887c1,![]];}return db['FaxInteraction'][_0x65f6('0x57')]({'UserId':_0x491533[_0x65f6('0x59')]['id'],'ContactId':_0x33290a['id'],'FaxAccountId':_0x4254ca['id'],'fax':_0x491533['body']['to'][0x0],'firstMsgDirection':_0x65f6('0xb3'),'Messages':[_['merge'](_0x491533['body'],{'read':![],'body':_0x491533[_0x65f6('0x58')][_0x65f6('0xa7')][0x0][_0x65f6('0xb4')],'FaxAccountId':_0x4254ca['id'],'UserId':_0x491533[_0x65f6('0x59')]['id'],'ContactId':_0x33290a['id'],'AttachmentId':_0x491533[_0x65f6('0x58')]['attachments'][0x0]['id']})]},{'include':[{'model':db[_0x65f6('0xa0')],'as':'Messages'}]})[_0x65f6('0x1d')](function(_0x532538){return[_0x532538,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0x65f6('0xb5')](function(_0x378c70,_0x242fde){if(_0x242fde){return _0x378c70;}return db[_0x65f6('0xa0')][_0x65f6('0x57')]({'direction':_0x65f6('0xb3'),'read':![],'body':_0x491533[_0x65f6('0x58')][_0x65f6('0xa7')][0x0][_0x65f6('0xb4')],'FaxAccountId':_0x4254ca['id'],'FaxInteractionId':_0x378c70['id'],'UserId':_0x491533[_0x65f6('0x59')]['id'],'ContactId':_0x378c70['ContactId'],'AttachmentId':_0x491533[_0x65f6('0x58')][_0x65f6('0xa7')][0x0]['id']})[_0x65f6('0x1d')](function(_0x588b38){_0x378c70[_0x65f6('0xb6')][_0x65f6('0xb7')]=[];_0x378c70['dataValues'][_0x65f6('0xb7')][_0x65f6('0x87')](_0x588b38[_0x65f6('0xb6')]);return _0x378c70;});})[_0x65f6('0x1d')](function(_0x3a87cc){respondWithRpcPromise('SendFax',_0x65f6('0xb8'),{'FaxAccountId':_[_0x65f6('0xab')](_0x491533[_0x65f6('0x54')]['id'])?undefined:_0x491533['params']['id'],'path':_['isNil'](_0x491533[_0x65f6('0x58')][_0x65f6('0xa7')][0x0][_0x65f6('0x6')])?undefined:_0x491533[_0x65f6('0x58')][_0x65f6('0xa7')][0x0]['path'],'fax':_['isNil'](_0x491533['body']['to'][0x0])?undefined:_0x491533[_0x65f6('0x58')]['to'][0x0],'AttachmentId':_0x491533[_0x65f6('0x58')]['attachments'][0x0]['id']},client9002)['then'](function(_0x5f38c0){logger[_0x65f6('0x1e')](_0x65f6('0xb9'),_0x5f38c0);})[_0x65f6('0x52')](function(_0x3c77bb){logger[_0x65f6('0x1e')](_0x65f6('0xb9'),_0x3c77bb);});return _0x3a87cc;})[_0x65f6('0x1d')](respondWithResult(_0x322df1,null))[_0x65f6('0x52')](handleError(_0x322df1,null));};exports[_0x65f6('0xba')]=function(_0x433145,_0x25fb9b,_0x3e8fbe){return db[_0x65f6('0x38')][_0x65f6('0x56')]({'where':{'id':_0x433145[_0x65f6('0x54')]['id']}})['then'](handleEntityNotFound(_0x25fb9b,null))[_0x65f6('0x1d')](function(_0x1979c2){if(_0x1979c2){return _0x1979c2[_0x65f6('0xba')](_0x433145[_0x65f6('0x58')][_0x65f6('0x70')],_[_0x65f6('0x71')](_0x433145['body'],[_0x65f6('0x70'),'id'])||{})[_0x65f6('0xb5')](function(_0x5aabb5){for(var _0x5119e4=0x0;_0x5119e4<_0x433145[_0x65f6('0x58')]['ids']['length'];_0x5119e4+=0x1){socket[_0x65f6('0xbb')](_0x65f6('0xbc'),{'UserId':_0x433145['body'][_0x65f6('0x70')][_0x5119e4],'FaxAccountId':_0x433145[_0x65f6('0x54')]['id']});}return _0x5aabb5;});}})['then'](respondWithResult(_0x25fb9b,null))[_0x65f6('0x52')](handleError(_0x25fb9b,null));};exports[_0x65f6('0xbd')]=function(_0x27ce0d,_0x1c2a83,_0x10467a){return db[_0x65f6('0x38')][_0x65f6('0x56')]({'where':{'id':_0x27ce0d[_0x65f6('0x54')]['id']}})[_0x65f6('0x1d')](handleEntityNotFound(_0x1c2a83,null))['then'](function(_0x144c8d){if(_0x144c8d){return _0x144c8d[_0x65f6('0xbd')](_0x27ce0d[_0x65f6('0x3e')][_0x65f6('0x70')])[_0x65f6('0x1d')](function(){if(_[_0x65f6('0xbe')](_0x27ce0d['query'][_0x65f6('0x70')])){for(var _0x52853a=0x0;_0x52853a<_0x27ce0d['query']['ids'][_0x65f6('0x44')];_0x52853a+=0x1){socket['emit'](_0x65f6('0xbf'),{'UserId':Number(_0x27ce0d[_0x65f6('0x3e')][_0x65f6('0x70')][_0x52853a]),'FaxAccountId':Number(_0x27ce0d[_0x65f6('0x54')]['id'])});}}else{socket[_0x65f6('0xbb')](_0x65f6('0xbf'),{'UserId':Number(_0x27ce0d[_0x65f6('0x3e')]['ids']),'FaxAccountId':Number(_0x27ce0d['params']['id'])});}});}})[_0x65f6('0x1d')](respondWithStatusCode(_0x1c2a83,null))[_0x65f6('0x52')](handleError(_0x1c2a83,null));};exports[_0x65f6('0xc0')]=function(_0x4bb32e,_0x27c203,_0x5d8c8e){var _0x1188a2={};var _0x2b1dfc={};var _0x2e4df8;var _0x4b920a;return db[_0x65f6('0x38')][_0x65f6('0x67')]({'where':{'id':_0x4bb32e[_0x65f6('0x54')]['id']}})[_0x65f6('0x1d')](handleEntityNotFound(_0x27c203,null))['then'](function(_0x522058){if(_0x522058){_0x2e4df8=_0x522058;_0x2b1dfc[_0x65f6('0x3c')]=_['keys'](db[_0x65f6('0xc1')]['rawAttributes']);_0x2b1dfc[_0x65f6('0x3e')]=_[_0x65f6('0x3f')](_0x4bb32e[_0x65f6('0x3e')]);_0x2b1dfc['filters']=_[_0x65f6('0x41')](_0x2b1dfc[_0x65f6('0x3c')],_0x2b1dfc[_0x65f6('0x3e')]);_0x1188a2[_0x65f6('0x42')]=_[_0x65f6('0x41')](_0x2b1dfc[_0x65f6('0x3c')],qs[_0x65f6('0x43')](_0x4bb32e['query'][_0x65f6('0x43')]));_0x1188a2[_0x65f6('0x42')]=_0x1188a2[_0x65f6('0x42')][_0x65f6('0x44')]?_0x1188a2[_0x65f6('0x42')]:_0x2b1dfc[_0x65f6('0x3c')];_0x1188a2[_0x65f6('0x47')]=qs[_0x65f6('0x48')](_0x4bb32e[_0x65f6('0x3e')]['sort']);_0x1188a2[_0x65f6('0x49')]=qs['filters'](_[_0x65f6('0x4a')](_0x4bb32e[_0x65f6('0x3e')],_0x2b1dfc[_0x65f6('0x40')]));if(_0x4bb32e[_0x65f6('0x3e')][_0x65f6('0x4b')]){_0x1188a2[_0x65f6('0x49')]=_[_0x65f6('0x68')](_0x1188a2[_0x65f6('0x49')],{'$or':_[_0x65f6('0x3d')](_0x1188a2[_0x65f6('0x42')],function(_0x148993){var _0x38e6ff={};_0x38e6ff[_0x148993]={'$like':'%'+_0x4bb32e[_0x65f6('0x3e')][_0x65f6('0x4b')]+'%'};return _0x38e6ff;})});}_0x1188a2=_[_0x65f6('0x68')]({},_0x1188a2,_0x4bb32e[_0x65f6('0x4e')]);return _0x2e4df8[_0x65f6('0xc0')](_0x1188a2);}})['then'](function(_0xdb0a2){if(_0xdb0a2){_0x4b920a=_0xdb0a2[_0x65f6('0x44')];if(!_0x4bb32e['query'][_0x65f6('0x45')](_0x65f6('0x46'))){_0x1188a2[_0x65f6('0x2a')]=qs[_0x65f6('0x2a')](_0x4bb32e[_0x65f6('0x3e')][_0x65f6('0x2a')]);_0x1188a2['offset']=qs['offset'](_0x4bb32e[_0x65f6('0x3e')][_0x65f6('0x28')]);}return _0x2e4df8[_0x65f6('0xc0')](_0x1188a2);}})['then'](function(_0x18be9e){if(_0x18be9e){return _0x18be9e?{'count':_0x4b920a,'rows':_0x18be9e}:null;}})['then'](respondWithResult(_0x27c203,null))[_0x65f6('0x52')](handleError(_0x27c203,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index 75f0fff..630c390 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 _0x31dc=['save','update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','FaxAccount','setMaxListeners'];(function(_0x139030,_0x4f4975){var _0x431626=function(_0x2651da){while(--_0x2651da){_0x139030['push'](_0x139030['shift']());}};_0x431626(++_0x4f4975);}(_0x31dc,0x1ab));var _0xc31d=function(_0x4e9553,_0x1eca46){_0x4e9553=_0x4e9553-0x0;var _0x49fc2d=_0x31dc[_0x4e9553];return _0x49fc2d;};'use strict';var EventEmitter=require('events');var FaxAccount=require(_0xc31d('0x0'))['db'][_0xc31d('0x1')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0xc31d('0x2')](0x0);var events={'afterCreate':_0xc31d('0x3'),'afterUpdate':_0xc31d('0x4'),'afterDestroy':_0xc31d('0x5')};function emitEvent(_0x1206af){return function(_0xb4ebfe,_0xacf39a,_0xe2d9a7){FaxAccountEvents[_0xc31d('0x6')](_0x1206af+':'+_0xb4ebfe['id'],_0xb4ebfe);FaxAccountEvents[_0xc31d('0x6')](_0x1206af,_0xb4ebfe);_0xe2d9a7(null);};}for(var e in events){if(events[_0xc31d('0x7')](e)){var event=events[e];FaxAccount[_0xc31d('0x8')](e,emitEvent(event));}}module[_0xc31d('0x9')]=FaxAccountEvents; \ No newline at end of file +var _0xac9b=['emit','hook','exports','../../mysqldb','save','update','remove'];(function(_0xa86f7,_0x260c99){var _0x202b8d=function(_0x39434d){while(--_0x39434d){_0xa86f7['push'](_0xa86f7['shift']());}};_0x202b8d(++_0x260c99);}(_0xac9b,0x7a));var _0xbac9=function(_0x334841,_0x2bbc4c){_0x334841=_0x334841-0x0;var _0x5beb4b=_0xac9b[_0x334841];return _0x5beb4b;};'use strict';var EventEmitter=require('events');var FaxAccount=require(_0xbac9('0x0'))['db']['FaxAccount'];var FaxAccountEvents=new EventEmitter();FaxAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xbac9('0x1'),'afterUpdate':_0xbac9('0x2'),'afterDestroy':_0xbac9('0x3')};function emitEvent(_0x531fdc){return function(_0x143e75,_0x5a8827,_0x5cc1a7){FaxAccountEvents['emit'](_0x531fdc+':'+_0x143e75['id'],_0x143e75);FaxAccountEvents[_0xbac9('0x4')](_0x531fdc,_0x143e75);_0x5cc1a7(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxAccount[_0xbac9('0x5')](e,emitEvent(event));}}module[_0xbac9('0x6')]=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index 9a2cfa8..7b381f9 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 _0x9adc=['exports','define','FaxAccount','fax_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxAccount.attributes'];(function(_0x2f8b7b,_0x599619){var _0x3982b8=function(_0x8dd389){while(--_0x8dd389){_0x2f8b7b['push'](_0x2f8b7b['shift']());}};_0x3982b8(++_0x599619);}(_0x9adc,0x6d));var _0xc9ad=function(_0x3ca1ae,_0x152975){_0x3ca1ae=_0x3ca1ae-0x0;var _0x1f06c6=_0x9adc[_0x3ca1ae];return _0x1f06c6;};'use strict';var _=require(_0xc9ad('0x0'));var util=require(_0xc9ad('0x1'));var logger=require(_0xc9ad('0x2'))(_0xc9ad('0x3'));var moment=require(_0xc9ad('0x4'));var BPromise=require(_0xc9ad('0x5'));var rp=require(_0xc9ad('0x6'));var fs=require('fs');var path=require(_0xc9ad('0x7'));var rimraf=require(_0xc9ad('0x8'));var config=require(_0xc9ad('0x9'));var attributes=require(_0xc9ad('0xa'));module[_0xc9ad('0xb')]=function(_0x4843d3,_0x38816f){return _0x4843d3[_0xc9ad('0xc')](_0xc9ad('0xd'),attributes,{'tableName':_0xc9ad('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaa5b=['./faxAccount.attributes','exports','define','FaxAccount','lodash','api','bluebird','request-promise','path','../../config/environment'];(function(_0x4b36f5,_0x18ff85){var _0x2d289b=function(_0x302f5a){while(--_0x302f5a){_0x4b36f5['push'](_0x4b36f5['shift']());}};_0x2d289b(++_0x18ff85);}(_0xaa5b,0xb8));var _0xbaa5=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xaa5b[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xbaa5('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xbaa5('0x1'));var moment=require('moment');var BPromise=require(_0xbaa5('0x2'));var rp=require(_0xbaa5('0x3'));var fs=require('fs');var path=require(_0xbaa5('0x4'));var rimraf=require('rimraf');var config=require(_0xbaa5('0x5'));var attributes=require(_0xbaa5('0x6'));module[_0xbaa5('0x7')]=function(_0x2af650,_0x12735f){return _0x2af650[_0xbaa5('0x8')](_0xbaa5('0x9'),attributes,{'tableName':'fax_accounts','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 33e9065..70fb6d0 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 _0x7833=['name','unshift','agent','waitForTheAssignedAgent','*,*,*,*','Start','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','FaxAccount','findAll','options','raw','where','include','map','model','attributes','GetFaxAccount','catch','fax','describe','Sequelize','ValidationError','no\x20available\x20attributes','difference','updatedAt','keys','CompanyId','ListId','body','isNil','from','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','account','CmList','Contacts','DESC','FaxApplication','List','get','Applications','list','priority','asc','CmContact','create','contact','FaxInteraction','Contact\x20not\x20found','spread','autoclose','applications','push','length','close','unmanaged','created','interaction','FaxMessage','ContactId','AttachmentId','UserId','User'];(function(_0x1af6db,_0x274a32){var _0x3942ba=function(_0x245465){while(--_0x245465){_0x1af6db['push'](_0x1af6db['shift']());}};_0x3942ba(++_0x274a32);}(_0x7833,0x1dc));var _0x3783=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x7833[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0x3783('0x0'));var util=require(_0x3783('0x1'));var moment=require(_0x3783('0x2'));var BPromise=require(_0x3783('0x3'));var rs=require(_0x3783('0x4'));var fs=require('fs');var Redis=require(_0x3783('0x5'));var db=require(_0x3783('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x3783('0x7'))(_0x3783('0x8'));var config=require(_0x3783('0x9'));var jayson=require(_0x3783('0xa'));var client=jayson[_0x3783('0xb')][_0x3783('0xc')]({'port':0x232c});config[_0x3783('0xd')]=_[_0x3783('0xe')](config[_0x3783('0xd')],{'host':_0x3783('0xf'),'port':0x18eb});var socket=require(_0x3783('0x10'))(new Redis(config[_0x3783('0xd')]));require(_0x3783('0x11'))['register'](socket);function respondWithRpcPromise(_0x58b87b,_0x220ab3,_0x131ea8){return new BPromise(function(_0xa3be57,_0x5c991e){return client['request'](_0x58b87b,_0x131ea8)[_0x3783('0x12')](function(_0x4a3e25){logger[_0x3783('0x13')](_0x3783('0x14'),_0x220ab3,_0x3783('0x15'));logger['debug'](_0x3783('0x16'),_0x220ab3,_0x3783('0x15'),JSON[_0x3783('0x17')](_0x4a3e25));if(_0x4a3e25[_0x3783('0x18')]){if(_0x4a3e25[_0x3783('0x18')][_0x3783('0x19')]===0x1f4){logger[_0x3783('0x18')](_0x3783('0x14'),_0x220ab3,_0x4a3e25[_0x3783('0x18')][_0x3783('0x1a')]);return _0x5c991e(_0x4a3e25[_0x3783('0x18')][_0x3783('0x1a')]);}logger[_0x3783('0x18')](_0x3783('0x14'),_0x220ab3,_0x4a3e25['error'][_0x3783('0x1a')]);return _0xa3be57(_0x4a3e25[_0x3783('0x18')][_0x3783('0x1a')]);}else{logger[_0x3783('0x13')](_0x3783('0x14'),_0x220ab3,'request\x20sent');_0xa3be57(_0x4a3e25[_0x3783('0x1b')][_0x3783('0x1a')]);}})['catch'](function(_0xbcdbbb){logger[_0x3783('0x18')](_0x3783('0x14'),_0x220ab3,_0xbcdbbb);_0x5c991e(_0xbcdbbb);});});}exports['GetFaxAccount']=function(_0x3ffbb1){var _0x484fa9=this;return new Promise(function(_0x5e299f,_0x32c5f4){return db[_0x3783('0x1c')][_0x3783('0x1d')]({'raw':_0x3ffbb1[_0x3783('0x1e')]?_0x3ffbb1[_0x3783('0x1e')][_0x3783('0x1f')]===undefined?!![]:![]:!![],'where':_0x3ffbb1[_0x3783('0x1e')]?_0x3ffbb1[_0x3783('0x1e')][_0x3783('0x20')]||null:null,'attributes':_0x3ffbb1[_0x3783('0x1e')]?_0x3ffbb1[_0x3783('0x1e')]['attributes']||null:null,'limit':_0x3ffbb1[_0x3783('0x1e')]?_0x3ffbb1[_0x3783('0x1e')]['limit']||null:null,'include':_0x3ffbb1[_0x3783('0x1e')]?_0x3ffbb1['options'][_0x3783('0x21')]?_[_0x3783('0x22')](_0x3ffbb1[_0x3783('0x1e')]['include'],function(_0x3a2651){return{'model':db[_0x3a2651[_0x3783('0x23')]],'as':_0x3a2651['as'],'attributes':_0x3a2651['attributes'],'include':_0x3a2651[_0x3783('0x21')]?_[_0x3783('0x22')](_0x3a2651[_0x3783('0x21')],function(_0x228f19){return{'model':db[_0x228f19[_0x3783('0x23')]],'as':_0x228f19['as'],'attributes':_0x228f19[_0x3783('0x24')],'include':_0x228f19[_0x3783('0x21')]?_[_0x3783('0x22')](_0x228f19[_0x3783('0x21')],function(_0x613ec5){return{'model':db[_0x613ec5[_0x3783('0x23')]],'as':_0x613ec5['as'],'attributes':_0x613ec5[_0x3783('0x24')]};}):[]};}):[]};}):[]:[]})[_0x3783('0x12')](function(_0x229040){logger[_0x3783('0x13')](_0x3783('0x25'),_0x3ffbb1);logger['debug'](_0x3783('0x25'),_0x3ffbb1,JSON[_0x3783('0x17')](_0x229040));_0x5e299f(_0x229040);})[_0x3783('0x26')](function(_0x297295){logger[_0x3783('0x18')](_0x3783('0x25'),_0x297295[_0x3783('0x1a')],_0x3ffbb1);_0x32c5f4(_0x484fa9[_0x3783('0x18')](0x1f4,_0x297295[_0x3783('0x1a')]));});});};exports['NotifyFaxAccount']=function(_0x13647d,_0x5d74a0,_0x9fef8a){var _0x70acce=this;return new Promise(function(_0x384df9,_0x44c430){var _0xe5aa00={'body':_0x13647d['body'],'channel':_0x3783('0x27')};var _0x5a2f1e=[];var _0x826c48=[];var _0x508a78={};return db['CmContact'][_0x3783('0x28')]()['then'](function(_0x39350e){if(!_0x39350e){throw new db[(_0x3783('0x29'))][(_0x3783('0x2a'))](_0x3783('0x2b'));}_0x5a2f1e=_[_0x3783('0x2c')](_['keys'](_0x39350e),['createdAt',_0x3783('0x2d')]);_0x826c48=_[_0x3783('0x2c')](_[_0x3783('0x2e')](_0x39350e),['createdAt',_0x3783('0x2d'),_0x3783('0x2f'),_0x3783('0x30')]);if(_0x13647d[_0x3783('0x31')]['id']){delete _0x13647d['body']['id'];}if(_[_0x3783('0x32')](_0x13647d[_0x3783('0x31')][_0x3783('0x33')])){throw new db[(_0x3783('0x29'))][(_0x3783('0x2a'))](_0x3783('0x34'));}if(_['isNil'](_0x13647d[_0x3783('0x31')]['body'])||_0x13647d[_0x3783('0x31')][_0x3783('0x31')]===''){throw new db['Sequelize'][(_0x3783('0x2a'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x13647d[_0x3783('0x31')][_0x3783('0x35')])){throw new db['Sequelize'][(_0x3783('0x2a'))](_0x3783('0x36')+_0x826c48);}if(!_[_0x3783('0x37')](_0x826c48,_0x13647d[_0x3783('0x31')][_0x3783('0x35')])){throw new db[(_0x3783('0x29'))]['ValidationError'](_0x3783('0x38')+_0x826c48);}_0x508a78[_0x13647d[_0x3783('0x31')][_0x3783('0x35')]]=_0x13647d[_0x3783('0x31')][_0x3783('0x33')];})[_0x3783('0x12')](function(){return db['FaxAccount'][_0x3783('0x39')]({'where':{'id':_0x13647d[_0x3783('0x3a')]['id']},'include':[{'model':db[_0x3783('0x3b')],'as':'List','include':[{'model':db['CmContact'],'as':_0x3783('0x3c'),'where':_0x508a78,'limit':0x1,'order':[[_0x3783('0x2d'),_0x3783('0x3d')]]}]},{'model':db[_0x3783('0x3e')],'as':'Applications'}]});})['then'](function(_0x5e236d){if(_0x5e236d&&_0x5e236d[_0x3783('0x3f')]){var _0x51a246=_0x5e236d[_0x3783('0x40')]({'plain':!![]});_0xe5aa00[_0x3783('0x3a')]=_0x51a246;_0xe5aa00['applications']=_0x51a246[_0x3783('0x41')];_0xe5aa00[_0x3783('0x42')]=_0x51a246['List'];_0xe5aa00['applications']=_['orderBy'](_0xe5aa00['applications'],[_0x3783('0x43')],[_0x3783('0x44')]);if(_0xe5aa00['account'][_0x3783('0x41')]){delete _0xe5aa00['account'][_0x3783('0x41')];}if(_0xe5aa00['account'][_0x3783('0x3f')]&&_0xe5aa00[_0x3783('0x3a')]['List'][_0x3783('0x3c')]['length']){return _0xe5aa00['account'][_0x3783('0x3f')]['Contacts'][0x0];}var _0x3e562d=_[_0x3783('0xe')](_0x13647d[_0x3783('0x31')],{'firstName':_0x13647d[_0x3783('0x31')]['from'],'ListId':_0x51a246[_0x3783('0x30')]});_0x3e562d[_0x13647d[_0x3783('0x31')][_0x3783('0x35')]]=_0x13647d['body'][_0x3783('0x33')];return db[_0x3783('0x45')][_0x3783('0x46')](_0x3e562d,{'fields':_0x5a2f1e,'raw':!![]});}})[_0x3783('0x12')](function(_0x11c2bc){_0xe5aa00[_0x3783('0x47')]=_0x11c2bc;if(_0x11c2bc){var _0x25b163={'ContactId':_0x11c2bc['id'],'FaxAccountId':_0x13647d[_0x3783('0x3a')]['id'],'fax':_0x11c2bc[_0x3783('0x27')]};return db['FaxInteraction'][_0x3783('0x39')]({'where':{'ContactId':_0x11c2bc['id'],'closed':![],'FaxAccountId':_0x13647d[_0x3783('0x3a')]['id']}})[_0x3783('0x12')](function(_0x4b904d){if(_0x4b904d){return[_0x4b904d,![]];}return db[_0x3783('0x48')][_0x3783('0x46')](_0x25b163)['then'](function(_0x179a06){return[_0x179a06,!![]];});});}else{throw new Error(_0x3783('0x49'));}})[_0x3783('0x4a')](function(_0x18c34d,_0x28fa77){var _0x228d78=_0x18c34d[_0x3783('0x40')]({'plain':!![]});if(_0x28fa77){if(_0xe5aa00['account'][_0x3783('0x4b')]){_0xe5aa00[_0x3783('0x4c')][_0x3783('0x4d')]({'id':0x0,'priority':_0xe5aa00['applications'][_0x3783('0x4e')]+0x1,'app':_0x3783('0x4f'),'appdata':_0x3783('0x50'),'interval':'*,*,*,*'});}_0x228d78[_0x3783('0x51')]=!![];}else{_0x228d78[_0x3783('0x51')]=![];}_0xe5aa00[_0x3783('0x52')]=_0x228d78;return db[_0x3783('0x53')][_0x3783('0x46')]({'body':_0x13647d[_0x3783('0x31')]['body'],'FaxAccountId':_0x13647d[_0x3783('0x3a')]['id'],'FaxInteractionId':_0x18c34d['id'],'direction':'in','ContactId':_0x18c34d[_0x3783('0x54')],'AttachmentId':_0x13647d[_0x3783('0x31')][_0x3783('0x55')]});})['then'](function(_0x14458f){_0xe5aa00[_0x3783('0x1a')]=_0x14458f;if(_0xe5aa00[_0x3783('0x52')][_0x3783('0x56')]){return db[_0x3783('0x57')][_0x3783('0x39')]({'attributes':['id',_0x3783('0x58')],'where':{'id':_0xe5aa00[_0x3783('0x52')][_0x3783('0x56')]}})[_0x3783('0x12')](function(_0x3aa0bd){if(_0x3aa0bd){_0xe5aa00[_0x3783('0x4c')][_0x3783('0x59')]({'id':0x0,'priority':0x0,'app':_0x3783('0x5a'),'appdata':_0x3aa0bd['name']+','+(_0xe5aa00[_0x3783('0x3a')][_0x3783('0x5b')]||0xa),'interval':_0x3783('0x5c')});}return respondWithRpcPromise(_0x3783('0x5d'),'startRouting',_0xe5aa00);});}return respondWithRpcPromise(_0x3783('0x5d'),'startRouting',_0xe5aa00);})[_0x3783('0x12')](function(_0x158fef){_0x384df9(_0x158fef);})['catch'](function(_0x41c638){_0x44c430(_0x70acce[_0x3783('0x18')](0x1f4,_0x41c638[_0x3783('0x1a')]));});});}; \ No newline at end of file +var _0xda47=['DESC','FaxApplication','get','applications','Applications','list','orderBy','length','create','contact','FaxInteraction','Contact\x20not\x20found','spread','autoclose','push','close','unmanaged','*,*,*,*','created','interaction','FaxMessage','ContactId','AttachmentId','UserId','User','name','unshift','agent','waitForTheAssignedAgent','Start','startRouting','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','localhost','./faxAccount.socket','request','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetFaxAccount','FaxAccount','findAll','options','raw','where','attributes','limit','include','model','map','then','catch','NotifyFaxAccount','body','fax','Sequelize','ValidationError','no\x20available\x20attributes','keys','updatedAt','difference','createdAt','CompanyId','isNil','from','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','account','CmList','List','CmContact','Contacts'];(function(_0x4ac7de,_0x1585f5){var _0x3de877=function(_0x13684f){while(--_0x13684f){_0x4ac7de['push'](_0x4ac7de['shift']());}};_0x3de877(++_0x1585f5);}(_0xda47,0x130));var _0x7da4=function(_0x441f7a,_0x576321){_0x441f7a=_0x441f7a-0x0;var _0x4821da=_0xda47[_0x441f7a];return _0x4821da;};'use strict';var _=require(_0x7da4('0x0'));var util=require('util');var moment=require(_0x7da4('0x1'));var BPromise=require(_0x7da4('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7da4('0x3'));var db=require(_0x7da4('0x4'))['db'];var utils=require(_0x7da4('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x7da4('0x6'));var jayson=require(_0x7da4('0x7'));var client=jayson[_0x7da4('0x8')][_0x7da4('0x9')]({'port':0x232c});config[_0x7da4('0xa')]=_['defaults'](config['redis'],{'host':_0x7da4('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7da4('0xa')]));require(_0x7da4('0xc'))['register'](socket);function respondWithRpcPromise(_0x347045,_0x4d65c2,_0x10e442){return new BPromise(function(_0x38247b,_0x457673){return client[_0x7da4('0xd')](_0x347045,_0x10e442)['then'](function(_0x4986e2){logger[_0x7da4('0xe')](_0x7da4('0xf'),_0x4d65c2,_0x7da4('0x10'));logger[_0x7da4('0x11')](_0x7da4('0x12'),_0x4d65c2,_0x7da4('0x10'),JSON[_0x7da4('0x13')](_0x4986e2));if(_0x4986e2[_0x7da4('0x14')]){if(_0x4986e2['error'][_0x7da4('0x15')]===0x1f4){logger[_0x7da4('0x14')]('FaxAccount,\x20%s,\x20%s',_0x4d65c2,_0x4986e2[_0x7da4('0x14')][_0x7da4('0x16')]);return _0x457673(_0x4986e2['error'][_0x7da4('0x16')]);}logger[_0x7da4('0x14')](_0x7da4('0xf'),_0x4d65c2,_0x4986e2['error'][_0x7da4('0x16')]);return _0x38247b(_0x4986e2[_0x7da4('0x14')][_0x7da4('0x16')]);}else{logger['info'](_0x7da4('0xf'),_0x4d65c2,_0x7da4('0x10'));_0x38247b(_0x4986e2[_0x7da4('0x17')][_0x7da4('0x16')]);}})['catch'](function(_0x41dfaf){logger[_0x7da4('0x14')](_0x7da4('0xf'),_0x4d65c2,_0x41dfaf);_0x457673(_0x41dfaf);});});}exports[_0x7da4('0x18')]=function(_0x467754){var _0x39b18d=this;return new Promise(function(_0x334e81,_0x3b2f47){return db[_0x7da4('0x19')][_0x7da4('0x1a')]({'raw':_0x467754[_0x7da4('0x1b')]?_0x467754[_0x7da4('0x1b')][_0x7da4('0x1c')]===undefined?!![]:![]:!![],'where':_0x467754['options']?_0x467754['options'][_0x7da4('0x1d')]||null:null,'attributes':_0x467754[_0x7da4('0x1b')]?_0x467754['options'][_0x7da4('0x1e')]||null:null,'limit':_0x467754[_0x7da4('0x1b')]?_0x467754[_0x7da4('0x1b')][_0x7da4('0x1f')]||null:null,'include':_0x467754[_0x7da4('0x1b')]?_0x467754[_0x7da4('0x1b')]['include']?_['map'](_0x467754[_0x7da4('0x1b')][_0x7da4('0x20')],function(_0x469a8a){return{'model':db[_0x469a8a[_0x7da4('0x21')]],'as':_0x469a8a['as'],'attributes':_0x469a8a[_0x7da4('0x1e')],'include':_0x469a8a['include']?_[_0x7da4('0x22')](_0x469a8a[_0x7da4('0x20')],function(_0x3193dd){return{'model':db[_0x3193dd[_0x7da4('0x21')]],'as':_0x3193dd['as'],'attributes':_0x3193dd[_0x7da4('0x1e')],'include':_0x3193dd[_0x7da4('0x20')]?_[_0x7da4('0x22')](_0x3193dd['include'],function(_0x184f6d){return{'model':db[_0x184f6d[_0x7da4('0x21')]],'as':_0x184f6d['as'],'attributes':_0x184f6d[_0x7da4('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x7da4('0x23')](function(_0x3f4985){logger[_0x7da4('0xe')](_0x7da4('0x18'),_0x467754);logger['debug'](_0x7da4('0x18'),_0x467754,JSON[_0x7da4('0x13')](_0x3f4985));_0x334e81(_0x3f4985);})[_0x7da4('0x24')](function(_0xe66387){logger[_0x7da4('0x14')]('GetFaxAccount',_0xe66387['message'],_0x467754);_0x3b2f47(_0x39b18d[_0x7da4('0x14')](0x1f4,_0xe66387[_0x7da4('0x16')]));});});};exports[_0x7da4('0x25')]=function(_0x4aadb5,_0x7e177c,_0x2770a2){var _0x278be9=this;return new Promise(function(_0x25f7ad,_0xe643f8){var _0x14f0d2={'body':_0x4aadb5[_0x7da4('0x26')],'channel':_0x7da4('0x27')};var _0x45c0a5=[];var _0x133ac1=[];var _0x2deadd={};return db['CmContact']['describe']()[_0x7da4('0x23')](function(_0xc197e0){if(!_0xc197e0){throw new db[(_0x7da4('0x28'))][(_0x7da4('0x29'))](_0x7da4('0x2a'));}_0x45c0a5=_['difference'](_[_0x7da4('0x2b')](_0xc197e0),['createdAt',_0x7da4('0x2c')]);_0x133ac1=_[_0x7da4('0x2d')](_['keys'](_0xc197e0),[_0x7da4('0x2e'),_0x7da4('0x2c'),_0x7da4('0x2f'),'ListId']);if(_0x4aadb5['body']['id']){delete _0x4aadb5[_0x7da4('0x26')]['id'];}if(_[_0x7da4('0x30')](_0x4aadb5['body'][_0x7da4('0x31')])){throw new db[(_0x7da4('0x28'))][(_0x7da4('0x29'))](_0x7da4('0x32'));}if(_[_0x7da4('0x30')](_0x4aadb5[_0x7da4('0x26')][_0x7da4('0x26')])||_0x4aadb5[_0x7da4('0x26')]['body']===''){throw new db[(_0x7da4('0x28'))][(_0x7da4('0x29'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x7da4('0x30')](_0x4aadb5[_0x7da4('0x26')][_0x7da4('0x33')])){throw new db[(_0x7da4('0x28'))][(_0x7da4('0x29'))](_0x7da4('0x34')+_0x133ac1);}if(!_['includes'](_0x133ac1,_0x4aadb5[_0x7da4('0x26')][_0x7da4('0x33')])){throw new db[(_0x7da4('0x28'))][(_0x7da4('0x29'))](_0x7da4('0x35')+_0x133ac1);}_0x2deadd[_0x4aadb5[_0x7da4('0x26')][_0x7da4('0x33')]]=_0x4aadb5[_0x7da4('0x26')][_0x7da4('0x31')];})[_0x7da4('0x23')](function(){return db[_0x7da4('0x19')][_0x7da4('0x36')]({'where':{'id':_0x4aadb5[_0x7da4('0x37')]['id']},'include':[{'model':db[_0x7da4('0x38')],'as':_0x7da4('0x39'),'include':[{'model':db[_0x7da4('0x3a')],'as':_0x7da4('0x3b'),'where':_0x2deadd,'limit':0x1,'order':[['updatedAt',_0x7da4('0x3c')]]}]},{'model':db[_0x7da4('0x3d')],'as':'Applications'}]});})[_0x7da4('0x23')](function(_0x2bc378){if(_0x2bc378&&_0x2bc378[_0x7da4('0x39')]){var _0x1bb9c8=_0x2bc378[_0x7da4('0x3e')]({'plain':!![]});_0x14f0d2['account']=_0x1bb9c8;_0x14f0d2[_0x7da4('0x3f')]=_0x1bb9c8[_0x7da4('0x40')];_0x14f0d2[_0x7da4('0x41')]=_0x1bb9c8['List'];_0x14f0d2[_0x7da4('0x3f')]=_[_0x7da4('0x42')](_0x14f0d2['applications'],['priority'],['asc']);if(_0x14f0d2[_0x7da4('0x37')][_0x7da4('0x40')]){delete _0x14f0d2['account'][_0x7da4('0x40')];}if(_0x14f0d2[_0x7da4('0x37')][_0x7da4('0x39')]&&_0x14f0d2[_0x7da4('0x37')][_0x7da4('0x39')]['Contacts'][_0x7da4('0x43')]){return _0x14f0d2['account'][_0x7da4('0x39')][_0x7da4('0x3b')][0x0];}var _0x5ba1cf=_['defaults'](_0x4aadb5['body'],{'firstName':_0x4aadb5[_0x7da4('0x26')][_0x7da4('0x31')],'ListId':_0x1bb9c8['ListId']});_0x5ba1cf[_0x4aadb5[_0x7da4('0x26')][_0x7da4('0x33')]]=_0x4aadb5['body']['from'];return db[_0x7da4('0x3a')][_0x7da4('0x44')](_0x5ba1cf,{'fields':_0x45c0a5,'raw':!![]});}})['then'](function(_0x1377a9){_0x14f0d2[_0x7da4('0x45')]=_0x1377a9;if(_0x1377a9){var _0x459005={'ContactId':_0x1377a9['id'],'FaxAccountId':_0x4aadb5[_0x7da4('0x37')]['id'],'fax':_0x1377a9[_0x7da4('0x27')]};return db[_0x7da4('0x46')][_0x7da4('0x36')]({'where':{'ContactId':_0x1377a9['id'],'closed':![],'FaxAccountId':_0x4aadb5[_0x7da4('0x37')]['id']}})['then'](function(_0x4c185f){if(_0x4c185f){return[_0x4c185f,![]];}return db['FaxInteraction']['create'](_0x459005)[_0x7da4('0x23')](function(_0x3330a4){return[_0x3330a4,!![]];});});}else{throw new Error(_0x7da4('0x47'));}})[_0x7da4('0x48')](function(_0xcbf650,_0x3f14e7){var _0x1598c7=_0xcbf650[_0x7da4('0x3e')]({'plain':!![]});if(_0x3f14e7){if(_0x14f0d2[_0x7da4('0x37')][_0x7da4('0x49')]){_0x14f0d2[_0x7da4('0x3f')][_0x7da4('0x4a')]({'id':0x0,'priority':_0x14f0d2['applications'][_0x7da4('0x43')]+0x1,'app':_0x7da4('0x4b'),'appdata':_0x7da4('0x4c'),'interval':_0x7da4('0x4d')});}_0x1598c7[_0x7da4('0x4e')]=!![];}else{_0x1598c7['created']=![];}_0x14f0d2[_0x7da4('0x4f')]=_0x1598c7;return db[_0x7da4('0x50')]['create']({'body':_0x4aadb5[_0x7da4('0x26')][_0x7da4('0x26')],'FaxAccountId':_0x4aadb5[_0x7da4('0x37')]['id'],'FaxInteractionId':_0xcbf650['id'],'direction':'in','ContactId':_0xcbf650[_0x7da4('0x51')],'AttachmentId':_0x4aadb5['body'][_0x7da4('0x52')]});})[_0x7da4('0x23')](function(_0x394ed9){_0x14f0d2[_0x7da4('0x16')]=_0x394ed9;if(_0x14f0d2[_0x7da4('0x4f')][_0x7da4('0x53')]){return db[_0x7da4('0x54')][_0x7da4('0x36')]({'attributes':['id',_0x7da4('0x55')],'where':{'id':_0x14f0d2[_0x7da4('0x4f')][_0x7da4('0x53')]}})[_0x7da4('0x23')](function(_0x258ec1){if(_0x258ec1){_0x14f0d2[_0x7da4('0x3f')][_0x7da4('0x56')]({'id':0x0,'priority':0x0,'app':_0x7da4('0x57'),'appdata':_0x258ec1[_0x7da4('0x55')]+','+(_0x14f0d2[_0x7da4('0x37')][_0x7da4('0x58')]||0xa),'interval':_0x7da4('0x4d')});}return respondWithRpcPromise(_0x7da4('0x59'),_0x7da4('0x5a'),_0x14f0d2);});}return respondWithRpcPromise(_0x7da4('0x59'),_0x7da4('0x5a'),_0x14f0d2);})['then'](function(_0x4fa05d){_0x25f7ad(_0x4fa05d);})[_0x7da4('0x24')](function(_0x1c5247){_0xe643f8(_0x278be9[_0x7da4('0x14')](0x1f4,_0x1c5247[_0x7da4('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index 75c45bb..8dc78ed 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 _0xc758=['register','./faxAccount.events','save','remove','update','emit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc758,0xd3));var _0x8c75=function(_0x190518,_0x5d0791){_0x190518=_0x190518-0x0;var _0x5998d5=_0xc758[_0x190518];return _0x5998d5;};'use strict';var FaxAccountEvents=require(_0x8c75('0x0'));var events=[_0x8c75('0x1'),_0x8c75('0x2'),_0x8c75('0x3')];function createListener(_0x3bf925,_0x533b69){return function(_0x1e99b0){_0x533b69[_0x8c75('0x4')](_0x3bf925,_0x1e99b0);};}function removeListener(_0x22b2af,_0x1c4864){return function(){FaxAccountEvents['removeListener'](_0x22b2af,_0x1c4864);};}exports[_0x8c75('0x5')]=function(_0xc9d560){for(var _0x5a1f5a=0x0,_0x4f3245=events['length'];_0x5a1f5a<_0x4f3245;_0x5a1f5a++){var _0x4e3ef3=events[_0x5a1f5a];var _0x8f3e49=createListener('faxAccount:'+_0x4e3ef3,_0xc9d560);FaxAccountEvents['on'](_0x4e3ef3,_0x8f3e49);}}; \ No newline at end of file +var _0x6d9e=['register','faxAccount:','save','remove','update','emit'];(function(_0x44813f,_0x40d363){var _0x5e8f86=function(_0x7d7db6){while(--_0x7d7db6){_0x44813f['push'](_0x44813f['shift']());}};_0x5e8f86(++_0x40d363);}(_0x6d9e,0xbc));var _0xe6d9=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x6d9e[_0x5b644e];return _0x49c6bf;};'use strict';var FaxAccountEvents=require('./faxAccount.events');var events=[_0xe6d9('0x0'),_0xe6d9('0x1'),_0xe6d9('0x2')];function createListener(_0x26156c,_0x1a809c){return function(_0x6df2d8){_0x1a809c[_0xe6d9('0x3')](_0x26156c,_0x6df2d8);};}function removeListener(_0x404ea5,_0x1169e0){return function(){FaxAccountEvents['removeListener'](_0x404ea5,_0x1169e0);};}exports[_0xe6d9('0x4')]=function(_0x71311f){for(var _0x53bbc8=0x0,_0x5b1f3d=events['length'];_0x53bbc8<_0x5b1f3d;_0x53bbc8++){var _0x9d549=events[_0x53bbc8];var _0x4c936c=createListener(_0xe6d9('0x5')+_0x9d549,_0x71311f);FaxAccountEvents['on'](_0x9d549,_0x4c936c);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index ed61fc1..5b09f8a 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(_0x2e3ba5,_0x4b3768){var _0x14b665=function(_0x37bf34){while(--_0x37bf34){_0x2e3ba5['push'](_0x2e3ba5['shift']());}};_0x14b665(++_0x4b3768);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0xa9e0[_0x2d8fc2];return _0x3a9e53;};'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(_0x530a71,_0xeca2c2){var _0x16d1f8=function(_0x5bd520){while(--_0x5bd520){_0x530a71['push'](_0x530a71['shift']());}};_0x16d1f8(++_0xeca2c2);}(_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/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 8ea92c3..7bc4e85 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 _0xfebd=['TEXT','exports','INTEGER','STRING'];(function(_0x4c6f90,_0x20fd9f){var _0xc84599=function(_0x28b769){while(--_0x28b769){_0x4c6f90['push'](_0x4c6f90['shift']());}};_0xc84599(++_0x20fd9f);}(_0xfebd,0xb5));var _0xdfeb=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xfebd[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require('sequelize');module[_0xdfeb('0x0')]={'priority':{'type':Sequelize[_0xdfeb('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xdfeb('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xdfeb('0x3')]()},'description':{'type':Sequelize[_0xdfeb('0x2')]},'interval':{'type':Sequelize[_0xdfeb('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x79f0=['sequelize','exports','INTEGER','STRING','TEXT'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x79f0,0x190));var _0x079f=function(_0x36dfbd,_0x5bfe2d){_0x36dfbd=_0x36dfbd-0x0;var _0x4ecad9=_0x79f0[_0x36dfbd];return _0x4ecad9;};'use strict';var Sequelize=require(_0x079f('0x0'));module[_0x079f('0x1')]={'priority':{'type':Sequelize[_0x079f('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x079f('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x079f('0x4')]()},'description':{'type':Sequelize[_0x079f('0x3')]},'interval':{'type':Sequelize[_0x079f('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 b9309be..73d0b8a 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 _0x5098=['offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','FaxApplication','rawAttributes','fieldName','type','map','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','create','body','find','eml-format','rimraf','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json'];(function(_0x4db946,_0x578863){var _0x444091=function(_0x594bfb){while(--_0x594bfb){_0x4db946['push'](_0x4db946['shift']());}};_0x444091(++_0x578863);}(_0x5098,0x168));var _0x8509=function(_0x1704da,_0x1bd1ed){_0x1704da=_0x1704da-0x0;var _0x4b4610=_0x5098[_0x1704da];return _0x4b4610;};'use strict';var emlformat=require(_0x8509('0x0'));var rimraf=require(_0x8509('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x8509('0x2'));var moment=require(_0x8509('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x8509('0x4'));var util=require(_0x8509('0x5'));var path=require(_0x8509('0x6'));var sox=require(_0x8509('0x7'));var csv=require(_0x8509('0x8'));var ejs=require(_0x8509('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8509('0xa'));var squel=require(_0x8509('0xb'));var crypto=require(_0x8509('0xc'));var jsforce=require(_0x8509('0xd'));var deskjs=require(_0x8509('0xe'));var toCsv=require(_0x8509('0x8'));var querystring=require(_0x8509('0xf'));var Papa=require(_0x8509('0x10'));var Redis=require(_0x8509('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x8509('0x12'));var as=require(_0x8509('0x13'));var hardwareService=require(_0x8509('0x14'));var logger=require(_0x8509('0x15'))(_0x8509('0x16'));var utils=require(_0x8509('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x8509('0x18'));var db=require(_0x8509('0x19'))['db'];function respondWithStatusCode(_0x541b47,_0x5df1f0){_0x5df1f0=_0x5df1f0||0xcc;return function(_0x463c49){if(_0x463c49){return _0x541b47[_0x8509('0x1a')](_0x5df1f0);}return _0x541b47[_0x8509('0x1b')](_0x5df1f0)[_0x8509('0x1c')]();};}function respondWithResult(_0xb7f01e,_0x1bb682){_0x1bb682=_0x1bb682||0xc8;return function(_0xb4c6fc){if(_0xb4c6fc){return _0xb7f01e[_0x8509('0x1b')](_0x1bb682)[_0x8509('0x1d')](_0xb4c6fc);}};}function respondWithFilteredResult(_0x4ea601,_0x55c7a9){return function(_0x1d710e){if(_0x1d710e){var _0x3063e5=typeof _0x55c7a9[_0x8509('0x1e')]===_0x8509('0x1f')&&typeof _0x55c7a9[_0x8509('0x20')]===_0x8509('0x1f');var _0x49c2ea=_0x1d710e[_0x8509('0x21')];var _0x4866e6=_0x3063e5?0x0:_0x55c7a9['offset'];var _0x5b237e=_0x3063e5?_0x1d710e[_0x8509('0x21')]:_0x55c7a9['offset']+_0x55c7a9[_0x8509('0x20')];var _0x42bac1;if(_0x5b237e>=_0x49c2ea){_0x5b237e=_0x49c2ea;_0x42bac1=0xc8;}else{_0x42bac1=0xce;}_0x4ea601[_0x8509('0x1b')](_0x42bac1);return _0x4ea601[_0x8509('0x22')](_0x8509('0x23'),_0x4866e6+'-'+_0x5b237e+'/'+_0x49c2ea)['json'](_0x1d710e);}return null;};}function patchUpdates(_0x182dfd){return function(_0x3339d4){try{jsonpatch[_0x8509('0x24')](_0x3339d4,_0x182dfd,!![]);}catch(_0x2bddb0){return BPromise[_0x8509('0x25')](_0x2bddb0);}return _0x3339d4[_0x8509('0x26')]();};}function saveUpdates(_0x30439e,_0x31a7b8){return function(_0x1deb43){if(_0x1deb43){return _0x1deb43[_0x8509('0x27')](_0x30439e)[_0x8509('0x28')](function(_0x4e0d95){return _0x4e0d95;});}return null;};}function removeEntity(_0x3e3090,_0x54d06c){return function(_0x59ef01){if(_0x59ef01){return _0x59ef01[_0x8509('0x29')]()[_0x8509('0x28')](function(){_0x3e3090['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x38fd6f,_0xa7fa61){return function(_0x18f4ea){if(!_0x18f4ea){_0x38fd6f[_0x8509('0x1a')](0x194);}return _0x18f4ea;};}function handleError(_0x4558d1,_0x31308d){_0x31308d=_0x31308d||0x1f4;return function(_0x4eb25c){logger[_0x8509('0x2a')](_0x4eb25c[_0x8509('0x2b')]);if(_0x4eb25c[_0x8509('0x2c')]){delete _0x4eb25c['name'];}_0x4558d1[_0x8509('0x1b')](_0x31308d)[_0x8509('0x2d')](_0x4eb25c);};}exports[_0x8509('0x2e')]=function(_0x208ed1,_0x5be6cb){var _0x7d90e2={},_0x3ab049={},_0x5966d9={'count':0x0,'rows':[]};var _0x27a1d7=_['map'](db[_0x8509('0x2f')][_0x8509('0x30')],function(_0x5bb932){return{'name':_0x5bb932[_0x8509('0x31')],'type':_0x5bb932[_0x8509('0x32')]['key']};});_0x3ab049['model']=_[_0x8509('0x33')](_0x27a1d7,'name');_0x3ab049['query']=_[_0x8509('0x34')](_0x208ed1[_0x8509('0x35')]);_0x3ab049[_0x8509('0x36')]=_[_0x8509('0x37')](_0x3ab049[_0x8509('0x38')],_0x3ab049[_0x8509('0x35')]);_0x7d90e2[_0x8509('0x39')]=_[_0x8509('0x37')](_0x3ab049[_0x8509('0x38')],qs[_0x8509('0x3a')](_0x208ed1['query'][_0x8509('0x3a')]));_0x7d90e2['attributes']=_0x7d90e2['attributes'][_0x8509('0x3b')]?_0x7d90e2['attributes']:_0x3ab049[_0x8509('0x38')];if(!_0x208ed1[_0x8509('0x35')][_0x8509('0x3c')]('nolimit')){_0x7d90e2[_0x8509('0x20')]=qs[_0x8509('0x20')](_0x208ed1[_0x8509('0x35')][_0x8509('0x20')]);_0x7d90e2[_0x8509('0x1e')]=qs[_0x8509('0x1e')](_0x208ed1[_0x8509('0x35')][_0x8509('0x1e')]);}_0x7d90e2[_0x8509('0x3d')]=qs[_0x8509('0x3e')](_0x208ed1['query']['sort']);_0x7d90e2[_0x8509('0x3f')]=qs[_0x8509('0x36')](_[_0x8509('0x40')](_0x208ed1['query'],_0x3ab049[_0x8509('0x36')]),_0x27a1d7);if(_0x208ed1[_0x8509('0x35')][_0x8509('0x41')]){_0x7d90e2['where']=_[_0x8509('0x42')](_0x7d90e2[_0x8509('0x3f')],{'$or':_[_0x8509('0x33')](_0x27a1d7,function(_0x4f7119){if(_0x4f7119[_0x8509('0x32')]!==_0x8509('0x43')){var _0x54ad29={};_0x54ad29[_0x4f7119[_0x8509('0x2c')]]={'$like':'%'+_0x208ed1[_0x8509('0x35')]['filter']+'%'};return _0x54ad29;}})});}_0x7d90e2=_[_0x8509('0x42')]({},_0x7d90e2,_0x208ed1[_0x8509('0x44')]);var _0x513ce8={'where':_0x7d90e2['where']};return db[_0x8509('0x2f')]['count'](_0x513ce8)['then'](function(_0x194ed4){_0x5966d9[_0x8509('0x21')]=_0x194ed4;if(_0x208ed1['query'][_0x8509('0x45')]){_0x7d90e2[_0x8509('0x46')]=[{'all':!![]}];}return db[_0x8509('0x2f')][_0x8509('0x47')](_0x7d90e2);})['then'](function(_0x407d7b){_0x5966d9[_0x8509('0x48')]=_0x407d7b;return _0x5966d9;})[_0x8509('0x28')](respondWithFilteredResult(_0x5be6cb,_0x7d90e2))[_0x8509('0x49')](handleError(_0x5be6cb,null));};exports['show']=function(_0x174176,_0x46869d){var _0x3f5b7f={'raw':!![],'where':{'id':_0x174176[_0x8509('0x4a')]['id']}},_0x3aa393={};_0x3aa393[_0x8509('0x38')]=_[_0x8509('0x34')](db[_0x8509('0x2f')]['rawAttributes']);_0x3aa393[_0x8509('0x35')]=_[_0x8509('0x34')](_0x174176['query']);_0x3aa393['filters']=_[_0x8509('0x37')](_0x3aa393[_0x8509('0x38')],_0x3aa393[_0x8509('0x35')]);_0x3f5b7f[_0x8509('0x39')]=_['intersection'](_0x3aa393[_0x8509('0x38')],qs[_0x8509('0x3a')](_0x174176[_0x8509('0x35')][_0x8509('0x3a')]));_0x3f5b7f['attributes']=_0x3f5b7f[_0x8509('0x39')][_0x8509('0x3b')]?_0x3f5b7f[_0x8509('0x39')]:_0x3aa393[_0x8509('0x38')];if(_0x174176[_0x8509('0x35')][_0x8509('0x45')]){_0x3f5b7f['include']=[{'all':!![]}];}_0x3f5b7f=_['merge']({},_0x3f5b7f,_0x174176[_0x8509('0x44')]);return db[_0x8509('0x2f')]['find'](_0x3f5b7f)['then'](handleEntityNotFound(_0x46869d,null))[_0x8509('0x28')](respondWithResult(_0x46869d,null))[_0x8509('0x49')](handleError(_0x46869d,null));};exports[_0x8509('0x4b')]=function(_0x191a1e,_0x3bd7b0){return db[_0x8509('0x2f')]['create'](_0x191a1e['body'],{})[_0x8509('0x28')](respondWithResult(_0x3bd7b0,0xc9))[_0x8509('0x49')](handleError(_0x3bd7b0,null));};exports[_0x8509('0x27')]=function(_0x31f2ef,_0x52a509){if(_0x31f2ef[_0x8509('0x4c')]['id']){delete _0x31f2ef[_0x8509('0x4c')]['id'];}return db['FaxApplication']['find']({'where':{'id':_0x31f2ef[_0x8509('0x4a')]['id']}})[_0x8509('0x28')](handleEntityNotFound(_0x52a509,null))[_0x8509('0x28')](saveUpdates(_0x31f2ef[_0x8509('0x4c')],null))['then'](respondWithResult(_0x52a509,null))[_0x8509('0x49')](handleError(_0x52a509,null));};exports[_0x8509('0x29')]=function(_0x41da2c,_0x3af07a){return db['FaxApplication'][_0x8509('0x4d')]({'where':{'id':_0x41da2c['params']['id']}})['then'](handleEntityNotFound(_0x3af07a,null))[_0x8509('0x28')](removeEntity(_0x3af07a,null))[_0x8509('0x49')](handleError(_0x3af07a,null));}; \ No newline at end of file +var _0x031b=['map','FaxApplication','fieldName','type','key','model','query','keys','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','findAll','rows','catch','show','params','rawAttributes','intersection','include','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','stack','name'];(function(_0x47e02d,_0x4e667a){var _0x95923c=function(_0x1f4c20){while(--_0x1f4c20){_0x47e02d['push'](_0x47e02d['shift']());}};_0x95923c(++_0x4e667a);}(_0x031b,0x1dd));var _0xb031=function(_0x2af48a,_0x1175d6){_0x2af48a=_0x2af48a-0x0;var _0x25551d=_0x031b[_0x2af48a];return _0x25551d;};'use strict';var emlformat=require(_0xb031('0x0'));var rimraf=require(_0xb031('0x1'));var zipdir=require(_0xb031('0x2'));var jsonpatch=require(_0xb031('0x3'));var rp=require('request-promise');var moment=require(_0xb031('0x4'));var BPromise=require(_0xb031('0x5'));var Mustache=require('mustache');var util=require(_0xb031('0x6'));var path=require(_0xb031('0x7'));var sox=require('sox');var csv=require(_0xb031('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb031('0x9'));var _=require(_0xb031('0xa'));var squel=require(_0xb031('0xb'));var crypto=require(_0xb031('0xc'));var jsforce=require(_0xb031('0xd'));var deskjs=require(_0xb031('0xe'));var toCsv=require(_0xb031('0x8'));var querystring=require(_0xb031('0xf'));var Papa=require('papaparse');var Redis=require(_0xb031('0x10'));var authService=require(_0xb031('0x11'));var qs=require(_0xb031('0x12'));var as=require(_0xb031('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb031('0x14'))(_0xb031('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xb031('0x16'));var db=require(_0xb031('0x17'))['db'];function respondWithStatusCode(_0xf603ed,_0x2a9c10){_0x2a9c10=_0x2a9c10||0xcc;return function(_0x949106){if(_0x949106){return _0xf603ed['sendStatus'](_0x2a9c10);}return _0xf603ed[_0xb031('0x18')](_0x2a9c10)[_0xb031('0x19')]();};}function respondWithResult(_0x469cd8,_0x57c202){_0x57c202=_0x57c202||0xc8;return function(_0x222a4f){if(_0x222a4f){return _0x469cd8['status'](_0x57c202)[_0xb031('0x1a')](_0x222a4f);}};}function respondWithFilteredResult(_0x30010f,_0x3c8375){return function(_0x3bbf3b){if(_0x3bbf3b){var _0x54e7fe=typeof _0x3c8375['offset']===_0xb031('0x1b')&&typeof _0x3c8375[_0xb031('0x1c')]===_0xb031('0x1b');var _0x1ae141=_0x3bbf3b[_0xb031('0x1d')];var _0x40158a=_0x54e7fe?0x0:_0x3c8375[_0xb031('0x1e')];var _0x776932=_0x54e7fe?_0x3bbf3b[_0xb031('0x1d')]:_0x3c8375[_0xb031('0x1e')]+_0x3c8375[_0xb031('0x1c')];var _0x747f3b;if(_0x776932>=_0x1ae141){_0x776932=_0x1ae141;_0x747f3b=0xc8;}else{_0x747f3b=0xce;}_0x30010f['status'](_0x747f3b);return _0x30010f[_0xb031('0x1f')](_0xb031('0x20'),_0x40158a+'-'+_0x776932+'/'+_0x1ae141)[_0xb031('0x1a')](_0x3bbf3b);}return null;};}function patchUpdates(_0x1b8206){return function(_0x1393f5){try{jsonpatch[_0xb031('0x21')](_0x1393f5,_0x1b8206,!![]);}catch(_0x40ed7d){return BPromise[_0xb031('0x22')](_0x40ed7d);}return _0x1393f5[_0xb031('0x23')]();};}function saveUpdates(_0x34c079,_0x1979ef){return function(_0x568f2a){if(_0x568f2a){return _0x568f2a[_0xb031('0x24')](_0x34c079)[_0xb031('0x25')](function(_0x2c7c20){return _0x2c7c20;});}return null;};}function removeEntity(_0x42da98,_0x4e8881){return function(_0x35337e){if(_0x35337e){return _0x35337e[_0xb031('0x26')]()[_0xb031('0x25')](function(){_0x42da98[_0xb031('0x18')](0xcc)[_0xb031('0x19')]();});}};}function handleEntityNotFound(_0x507289,_0xd18709){return function(_0x9d9fc8){if(!_0x9d9fc8){_0x507289['sendStatus'](0x194);}return _0x9d9fc8;};}function handleError(_0x4a6b69,_0x23b112){_0x23b112=_0x23b112||0x1f4;return function(_0x4c177e){logger['error'](_0x4c177e[_0xb031('0x27')]);if(_0x4c177e[_0xb031('0x28')]){delete _0x4c177e[_0xb031('0x28')];}_0x4a6b69[_0xb031('0x18')](_0x23b112)['send'](_0x4c177e);};}exports['index']=function(_0x5b81a8,_0x551c4e){var _0x5e75ef={},_0x23b975={},_0x1fc160={'count':0x0,'rows':[]};var _0x442632=_[_0xb031('0x29')](db[_0xb031('0x2a')]['rawAttributes'],function(_0x3d266f){return{'name':_0x3d266f[_0xb031('0x2b')],'type':_0x3d266f[_0xb031('0x2c')][_0xb031('0x2d')]};});_0x23b975[_0xb031('0x2e')]=_['map'](_0x442632,'name');_0x23b975[_0xb031('0x2f')]=_[_0xb031('0x30')](_0x5b81a8[_0xb031('0x2f')]);_0x23b975['filters']=_['intersection'](_0x23b975[_0xb031('0x2e')],_0x23b975[_0xb031('0x2f')]);_0x5e75ef[_0xb031('0x31')]=_['intersection'](_0x23b975[_0xb031('0x2e')],qs[_0xb031('0x32')](_0x5b81a8[_0xb031('0x2f')][_0xb031('0x32')]));_0x5e75ef[_0xb031('0x31')]=_0x5e75ef[_0xb031('0x31')]['length']?_0x5e75ef[_0xb031('0x31')]:_0x23b975[_0xb031('0x2e')];if(!_0x5b81a8['query'][_0xb031('0x33')](_0xb031('0x34'))){_0x5e75ef[_0xb031('0x1c')]=qs[_0xb031('0x1c')](_0x5b81a8[_0xb031('0x2f')][_0xb031('0x1c')]);_0x5e75ef[_0xb031('0x1e')]=qs[_0xb031('0x1e')](_0x5b81a8[_0xb031('0x2f')][_0xb031('0x1e')]);}_0x5e75ef[_0xb031('0x35')]=qs[_0xb031('0x36')](_0x5b81a8[_0xb031('0x2f')][_0xb031('0x36')]);_0x5e75ef[_0xb031('0x37')]=qs[_0xb031('0x38')](_[_0xb031('0x39')](_0x5b81a8[_0xb031('0x2f')],_0x23b975[_0xb031('0x38')]),_0x442632);if(_0x5b81a8[_0xb031('0x2f')]['filter']){_0x5e75ef[_0xb031('0x37')]=_[_0xb031('0x3a')](_0x5e75ef[_0xb031('0x37')],{'$or':_[_0xb031('0x29')](_0x442632,function(_0x13e2d5){if(_0x13e2d5[_0xb031('0x2c')]!==_0xb031('0x3b')){var _0x152063={};_0x152063[_0x13e2d5[_0xb031('0x28')]]={'$like':'%'+_0x5b81a8[_0xb031('0x2f')][_0xb031('0x3c')]+'%'};return _0x152063;}})});}_0x5e75ef=_[_0xb031('0x3a')]({},_0x5e75ef,_0x5b81a8[_0xb031('0x3d')]);var _0x339d9e={'where':_0x5e75ef[_0xb031('0x37')]};return db[_0xb031('0x2a')][_0xb031('0x1d')](_0x339d9e)[_0xb031('0x25')](function(_0x3cdf85){_0x1fc160[_0xb031('0x1d')]=_0x3cdf85;if(_0x5b81a8[_0xb031('0x2f')][_0xb031('0x3e')]){_0x5e75ef['include']=[{'all':!![]}];}return db[_0xb031('0x2a')][_0xb031('0x3f')](_0x5e75ef);})['then'](function(_0x13addc){_0x1fc160[_0xb031('0x40')]=_0x13addc;return _0x1fc160;})[_0xb031('0x25')](respondWithFilteredResult(_0x551c4e,_0x5e75ef))[_0xb031('0x41')](handleError(_0x551c4e,null));};exports[_0xb031('0x42')]=function(_0x5111fa,_0x3323f1){var _0x534dd4={'raw':!![],'where':{'id':_0x5111fa[_0xb031('0x43')]['id']}},_0x426c41={};_0x426c41['model']=_[_0xb031('0x30')](db[_0xb031('0x2a')][_0xb031('0x44')]);_0x426c41[_0xb031('0x2f')]=_[_0xb031('0x30')](_0x5111fa[_0xb031('0x2f')]);_0x426c41[_0xb031('0x38')]=_[_0xb031('0x45')](_0x426c41[_0xb031('0x2e')],_0x426c41['query']);_0x534dd4[_0xb031('0x31')]=_['intersection'](_0x426c41['model'],qs[_0xb031('0x32')](_0x5111fa[_0xb031('0x2f')][_0xb031('0x32')]));_0x534dd4[_0xb031('0x31')]=_0x534dd4[_0xb031('0x31')]['length']?_0x534dd4[_0xb031('0x31')]:_0x426c41[_0xb031('0x2e')];if(_0x5111fa[_0xb031('0x2f')][_0xb031('0x3e')]){_0x534dd4[_0xb031('0x46')]=[{'all':!![]}];}_0x534dd4=_['merge']({},_0x534dd4,_0x5111fa[_0xb031('0x3d')]);return db[_0xb031('0x2a')][_0xb031('0x47')](_0x534dd4)['then'](handleEntityNotFound(_0x3323f1,null))[_0xb031('0x25')](respondWithResult(_0x3323f1,null))['catch'](handleError(_0x3323f1,null));};exports[_0xb031('0x48')]=function(_0x5341b4,_0x25ff3c){return db[_0xb031('0x2a')][_0xb031('0x48')](_0x5341b4[_0xb031('0x49')],{})[_0xb031('0x25')](respondWithResult(_0x25ff3c,0xc9))[_0xb031('0x41')](handleError(_0x25ff3c,null));};exports[_0xb031('0x24')]=function(_0x36c51b,_0x52cd60){if(_0x36c51b[_0xb031('0x49')]['id']){delete _0x36c51b[_0xb031('0x49')]['id'];}return db[_0xb031('0x2a')][_0xb031('0x47')]({'where':{'id':_0x36c51b[_0xb031('0x43')]['id']}})[_0xb031('0x25')](handleEntityNotFound(_0x52cd60,null))[_0xb031('0x25')](saveUpdates(_0x36c51b['body'],null))[_0xb031('0x25')](respondWithResult(_0x52cd60,null))['catch'](handleError(_0x52cd60,null));};exports['destroy']=function(_0x406c1f,_0x417dad){return db['FaxApplication'][_0xb031('0x47')]({'where':{'id':_0x406c1f['params']['id']}})['then'](handleEntityNotFound(_0x417dad,null))[_0xb031('0x25')](removeEntity(_0x417dad,null))[_0xb031('0x41')](handleError(_0x417dad,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index b718bc4..ffbb12f 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 _0xbb01=['define','FaxApplication','fax_applications','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./faxApplication.attributes','exports'];(function(_0x25e239,_0x5d70eb){var _0x5b7ae9=function(_0x13034b){while(--_0x13034b){_0x25e239['push'](_0x25e239['shift']());}};_0x5b7ae9(++_0x5d70eb);}(_0xbb01,0xf5));var _0x1bb0=function(_0x34f701,_0x37e407){_0x34f701=_0x34f701-0x0;var _0x3e2429=_0xbb01[_0x34f701];return _0x3e2429;};'use strict';var _=require('lodash');var util=require(_0x1bb0('0x0'));var logger=require(_0x1bb0('0x1'))(_0x1bb0('0x2'));var moment=require(_0x1bb0('0x3'));var BPromise=require('bluebird');var rp=require(_0x1bb0('0x4'));var fs=require('fs');var path=require(_0x1bb0('0x5'));var rimraf=require(_0x1bb0('0x6'));var config=require(_0x1bb0('0x7'));var attributes=require(_0x1bb0('0x8'));module[_0x1bb0('0x9')]=function(_0x424a10,_0x456b3a){return _0x424a10[_0x1bb0('0xa')](_0x1bb0('0xb'),attributes,{'tableName':_0x1bb0('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x1bb0('0xd'),'collate':_0x1bb0('0xe')});}; \ No newline at end of file +var _0x8ebc=['path','rimraf','../../config/environment','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x4c9d1b,_0x423880){var _0x57db93=function(_0x342aae){while(--_0x342aae){_0x4c9d1b['push'](_0x4c9d1b['shift']());}};_0x57db93(++_0x423880);}(_0x8ebc,0x90));var _0xc8eb=function(_0x1a80da,_0x1b532b){_0x1a80da=_0x1a80da-0x0;var _0x1c1df0=_0x8ebc[_0x1a80da];return _0x1c1df0;};'use strict';var _=require(_0xc8eb('0x0'));var util=require(_0xc8eb('0x1'));var logger=require(_0xc8eb('0x2'))(_0xc8eb('0x3'));var moment=require('moment');var BPromise=require(_0xc8eb('0x4'));var rp=require(_0xc8eb('0x5'));var fs=require('fs');var path=require(_0xc8eb('0x6'));var rimraf=require(_0xc8eb('0x7'));var config=require(_0xc8eb('0x8'));var attributes=require('./faxApplication.attributes');module['exports']=function(_0x5bbbc5,_0xe29ca5){return _0x5bbbc5['define']('FaxApplication',attributes,{'tableName':'fax_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xc8eb('0x9')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index 09d77f6..97a02e9 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 _0xa69a=['../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','FaxApplication,\x20%s,\x20%s','debug','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','UpdateFaxApplication','FaxApplication','body','options','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x1fac71,_0x35c307){var _0x1f4241=function(_0x18bb4){while(--_0x18bb4){_0x1fac71['push'](_0x1fac71['shift']());}};_0x1f4241(++_0x35c307);}(_0xa69a,0x8e));var _0xaa69=function(_0x4a300b,_0x3bf780){_0x4a300b=_0x4a300b-0x0;var _0x134879=_0xa69a[_0x4a300b];return _0x134879;};'use strict';var _=require(_0xaa69('0x0'));var util=require(_0xaa69('0x1'));var moment=require(_0xaa69('0x2'));var BPromise=require(_0xaa69('0x3'));var rs=require(_0xaa69('0x4'));var fs=require('fs');var Redis=require(_0xaa69('0x5'));var db=require(_0xaa69('0x6'))['db'];var utils=require(_0xaa69('0x7'));var logger=require(_0xaa69('0x8'))(_0xaa69('0x9'));var config=require(_0xaa69('0xa'));var jayson=require(_0xaa69('0xb'));var client=jayson['client'][_0xaa69('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5625a1,_0x5970ca,_0x503f76){return new BPromise(function(_0x20db00,_0x170a41){return client[_0xaa69('0xd')](_0x5625a1,_0x503f76)[_0xaa69('0xe')](function(_0xf2420){logger[_0xaa69('0xf')](_0xaa69('0x10'),_0x5970ca,'request\x20sent');logger[_0xaa69('0x11')](_0xaa69('0x12'),_0x5970ca,'request\x20sent',JSON[_0xaa69('0x13')](_0xf2420));if(_0xf2420['error']){if(_0xf2420['error'][_0xaa69('0x14')]===0x1f4){logger[_0xaa69('0x15')](_0xaa69('0x10'),_0x5970ca,_0xf2420['error'][_0xaa69('0x16')]);return _0x170a41(_0xf2420['error'][_0xaa69('0x16')]);}logger[_0xaa69('0x15')]('FaxApplication,\x20%s,\x20%s',_0x5970ca,_0xf2420['error'][_0xaa69('0x16')]);return _0x20db00(_0xf2420[_0xaa69('0x15')]['message']);}else{logger[_0xaa69('0xf')](_0xaa69('0x10'),_0x5970ca,'request\x20sent');_0x20db00(_0xf2420[_0xaa69('0x17')][_0xaa69('0x16')]);}})[_0xaa69('0x18')](function(_0x3085f2){logger['error'](_0xaa69('0x10'),_0x5970ca,_0x3085f2);_0x170a41(_0x3085f2);});});}exports[_0xaa69('0x19')]=function(_0x25ef23){var _0x29d4fb=this;return new Promise(function(_0x56d8ca,_0x2ea6e2){return db[_0xaa69('0x1a')]['update'](_0x25ef23[_0xaa69('0x1b')],{'raw':_0x25ef23[_0xaa69('0x1c')]?_0x25ef23[_0xaa69('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x25ef23[_0xaa69('0x1c')]?_0x25ef23[_0xaa69('0x1c')][_0xaa69('0x1d')]||null:null,'attributes':_0x25ef23[_0xaa69('0x1c')]?_0x25ef23[_0xaa69('0x1c')]['attributes']||null:null,'limit':_0x25ef23[_0xaa69('0x1c')]?_0x25ef23['options']['limit']||null:null})[_0xaa69('0xe')](function(_0x5830fd){logger[_0xaa69('0xf')](_0xaa69('0x19'),_0x25ef23);logger['debug'](_0xaa69('0x19'),_0x25ef23,JSON[_0xaa69('0x13')](_0x5830fd));_0x56d8ca(_0x5830fd);})[_0xaa69('0x18')](function(_0x1fffa3){logger[_0xaa69('0x15')](_0xaa69('0x19'),_0x1fffa3[_0xaa69('0x16')],_0x25ef23);_0x2ea6e2(_0x29d4fb[_0xaa69('0x15')](0x1f4,_0x1fffa3[_0xaa69('0x16')]));});});}; \ No newline at end of file +var _0xaf66=['../../config/environment','jayson/promise','client','info','FaxApplication,\x20%s,\x20%s','debug','FaxApplication,\x20%s,\x20%s,\x20%s','error','message','request\x20sent','catch','UpdateFaxApplication','FaxApplication','body','options','where','attributes','then','stringify','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xaf66,0x7f));var _0x6af6=function(_0x2e04ef,_0x31a596){_0x2e04ef=_0x2e04ef-0x0;var _0x5722b0=_0xaf66[_0x2e04ef];return _0x5722b0;};'use strict';var _=require(_0x6af6('0x0'));var util=require(_0x6af6('0x1'));var moment=require(_0x6af6('0x2'));var BPromise=require(_0x6af6('0x3'));var rs=require(_0x6af6('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6af6('0x5'))['db'];var utils=require(_0x6af6('0x6'));var logger=require('../../config/logger')(_0x6af6('0x7'));var config=require(_0x6af6('0x8'));var jayson=require(_0x6af6('0x9'));var client=jayson[_0x6af6('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x102ea5,_0xbe04fb,_0x27993c){return new BPromise(function(_0x318904,_0x34d53e){return client['request'](_0x102ea5,_0x27993c)['then'](function(_0xf8fe2){logger[_0x6af6('0xb')](_0x6af6('0xc'),_0xbe04fb,'request\x20sent');logger[_0x6af6('0xd')](_0x6af6('0xe'),_0xbe04fb,'request\x20sent',JSON['stringify'](_0xf8fe2));if(_0xf8fe2[_0x6af6('0xf')]){if(_0xf8fe2[_0x6af6('0xf')]['code']===0x1f4){logger[_0x6af6('0xf')]('FaxApplication,\x20%s,\x20%s',_0xbe04fb,_0xf8fe2[_0x6af6('0xf')]['message']);return _0x34d53e(_0xf8fe2[_0x6af6('0xf')][_0x6af6('0x10')]);}logger['error'](_0x6af6('0xc'),_0xbe04fb,_0xf8fe2['error'][_0x6af6('0x10')]);return _0x318904(_0xf8fe2['error'][_0x6af6('0x10')]);}else{logger[_0x6af6('0xb')]('FaxApplication,\x20%s,\x20%s',_0xbe04fb,_0x6af6('0x11'));_0x318904(_0xf8fe2['result'][_0x6af6('0x10')]);}})[_0x6af6('0x12')](function(_0x2ee1b2){logger[_0x6af6('0xf')](_0x6af6('0xc'),_0xbe04fb,_0x2ee1b2);_0x34d53e(_0x2ee1b2);});});}exports[_0x6af6('0x13')]=function(_0x148761){var _0x4fd099=this;return new Promise(function(_0x1938cc,_0xce46ca){return db[_0x6af6('0x14')]['update'](_0x148761[_0x6af6('0x15')],{'raw':_0x148761['options']?_0x148761['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x148761[_0x6af6('0x16')]?_0x148761[_0x6af6('0x16')][_0x6af6('0x17')]||null:null,'attributes':_0x148761[_0x6af6('0x16')]?_0x148761[_0x6af6('0x16')][_0x6af6('0x18')]||null:null,'limit':_0x148761['options']?_0x148761[_0x6af6('0x16')]['limit']||null:null})[_0x6af6('0x19')](function(_0x5b5347){logger[_0x6af6('0xb')](_0x6af6('0x13'),_0x148761);logger['debug'](_0x6af6('0x13'),_0x148761,JSON[_0x6af6('0x1a')](_0x5b5347));_0x1938cc(_0x5b5347);})[_0x6af6('0x12')](function(_0x3fd2fa){logger[_0x6af6('0xf')](_0x6af6('0x13'),_0x3fd2fa[_0x6af6('0x10')],_0x148761);_0xce46ca(_0x4fd099[_0x6af6('0xf')](0x1f4,_0x3fd2fa[_0x6af6('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index 58379b1..9727447 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 _0x80ed=['path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','put','update','destroy','exports','multer'];(function(_0x507403,_0x3f954d){var _0x1327c=function(_0x2aea1b){while(--_0x2aea1b){_0x507403['push'](_0x507403['shift']());}};_0x1327c(++_0x3f954d);}(_0x80ed,0x11c));var _0xd80e=function(_0x1d8e17,_0x2bf871){_0x1d8e17=_0x1d8e17-0x0;var _0x3af090=_0x80ed[_0x1d8e17];return _0x3af090;};'use strict';var multer=require(_0xd80e('0x0'));var util=require('util');var path=require(_0xd80e('0x1'));var timeout=require(_0xd80e('0x2'));var express=require(_0xd80e('0x3'));var router=express['Router']();var fs_extra=require(_0xd80e('0x4'));var auth=require(_0xd80e('0x5'));var interaction=require(_0xd80e('0x6'));var config=require(_0xd80e('0x7'));var controller=require('./faxApplication.controller');router[_0xd80e('0x8')]('/',auth[_0xd80e('0x9')](),controller[_0xd80e('0xa')]);router['get'](_0xd80e('0xb'),auth[_0xd80e('0x9')](),controller[_0xd80e('0xc')]);router[_0xd80e('0xd')]('/',auth[_0xd80e('0x9')](),controller[_0xd80e('0xe')]);router[_0xd80e('0xf')](_0xd80e('0xb'),auth[_0xd80e('0x9')](),controller[_0xd80e('0x10')]);router['delete'](_0xd80e('0xb'),auth[_0xd80e('0x9')](),controller[_0xd80e('0x11')]);module[_0xd80e('0x12')]=router; \ No newline at end of file +var _0x9348=['util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./faxApplication.controller','get','isAuthenticated','index','show','post','delete','/:id','destroy','exports','multer'];(function(_0x4c1d38,_0x9ec4e){var _0x183246=function(_0x5a62f5){while(--_0x5a62f5){_0x4c1d38['push'](_0x4c1d38['shift']());}};_0x183246(++_0x9ec4e);}(_0x9348,0x10d));var _0x8934=function(_0x34c00e,_0x4873a9){_0x34c00e=_0x34c00e-0x0;var _0x1e9548=_0x9348[_0x34c00e];return _0x1e9548;};'use strict';var multer=require(_0x8934('0x0'));var util=require(_0x8934('0x1'));var path=require(_0x8934('0x2'));var timeout=require(_0x8934('0x3'));var express=require(_0x8934('0x4'));var router=express['Router']();var fs_extra=require(_0x8934('0x5'));var auth=require(_0x8934('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x8934('0x7'));var controller=require(_0x8934('0x8'));router[_0x8934('0x9')]('/',auth[_0x8934('0xa')](),controller[_0x8934('0xb')]);router[_0x8934('0x9')]('/:id',auth[_0x8934('0xa')](),controller[_0x8934('0xc')]);router[_0x8934('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put']('/:id',auth[_0x8934('0xa')](),controller['update']);router[_0x8934('0xe')](_0x8934('0xf'),auth[_0x8934('0xa')](),controller[_0x8934('0x10')]);module[_0x8934('0x11')]=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index d7404e8..b644789 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 _0x4037=['exports','BOOLEAN','DATE','STRING','ENUM','out'];(function(_0x5f09c5,_0x2bfca0){var _0x426ad9=function(_0x18fe5f){while(--_0x18fe5f){_0x5f09c5['push'](_0x5f09c5['shift']());}};_0x426ad9(++_0x2bfca0);}(_0x4037,0xea));var _0x7403=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x4037[_0x2b4411];return _0x8e41ef;};'use strict';var Sequelize=require('sequelize');module[_0x7403('0x0')]={'closed':{'type':Sequelize[_0x7403('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x7403('0x2')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x7403('0x3')]},'read1stAt':{'type':Sequelize[_0x7403('0x2')]},'fax':{'type':Sequelize[_0x7403('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x7403('0x4')]('in',_0x7403('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x7403('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x7403('0x4')]('in',_0x7403('0x5')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x4532=['STRING','out','ENUM','sequelize','exports','BOOLEAN','DATE'];(function(_0x500419,_0x549162){var _0x241c1a=function(_0x3bea1a){while(--_0x3bea1a){_0x500419['push'](_0x500419['shift']());}};_0x241c1a(++_0x549162);}(_0x4532,0xea));var _0x2453=function(_0x5ddfaa,_0x4c3f2b){_0x5ddfaa=_0x5ddfaa-0x0;var _0x24706e=_0x4532[_0x5ddfaa];return _0x24706e;};'use strict';var Sequelize=require(_0x2453('0x0'));module[_0x2453('0x1')]={'closed':{'type':Sequelize[_0x2453('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x2453('0x3')]},'disposition':{'type':Sequelize[_0x2453('0x4')]},'secondDisposition':{'type':Sequelize[_0x2453('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x2453('0x4')]},'read1stAt':{'type':Sequelize[_0x2453('0x3')]},'fax':{'type':Sequelize['STRING']},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x2453('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x2453('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x2453('0x6')]('in',_0x2453('0x5')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.controller.js b/server/api/faxInteraction/faxInteraction.controller.js index 72406a5..2cf2da4 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 _0x4d0f=['sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','Users','map','fullname','TagIds','Tags','split','forEach','catch','index','FaxInteraction','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','select','field','color','from','tools_tags','u.id','u.fullname','ui.FaxInteractionId','left_join','users','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','fax_accounts','a.id\x20=\x20i.FaxAccountId','fax_messages','me.FaxInteractionId\x20=\x20i.id','fax_interaction_has_tags','it.FaxInteractionId\x20=\x20i.id','expr','parseSearch','search','conditions','length','find','having','`\x20>\x200','Contact','operator','$substring','value','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','some','compact','isEmpty','i.FaxAccountId\x20IN\x20?','createdAt','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.fax\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','contactName','DESC','t.id\x20IN\x20?','resolve','FaxAccountId','i.FaxAccountId\x20IS\x20NOT\x20NULL','role','agent','user','getFaxAccounts','i.FaxAccountId\x20IS\x20NULL','toString','sequelize','keyBy','merge','a.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.lastName','c.email','Contact.email','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.FaxInteractionId\x20IN\x20?','groupBy','FaxInteractionId','push','all','rows','show','params','includeAll','include','options','create','describe','FaxMessage','ids','omit','getMessages','YYYY-MM-DD\x20HH:mm:ss','findAll','setTags','spread','removeTags','download','unix','join','root','server','files','tmp','format','transcript-%d-%s.zip','Attachment','Messages','get','mkdirSync','basename','createReadStream','pipe','log','err','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register'];(function(_0x37408b,_0x4f4382){var _0x26e6a2=function(_0x1cee26){while(--_0x1cee26){_0x37408b['push'](_0x37408b['shift']());}};_0x26e6a2(++_0x4f4382);}(_0x4d0f,0xc1));var _0xf4d0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4d0f[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xf4d0('0x0'));var rimraf=require(_0xf4d0('0x1'));var zipdir=require(_0xf4d0('0x2'));var jsonpatch=require(_0xf4d0('0x3'));var rp=require(_0xf4d0('0x4'));var moment=require(_0xf4d0('0x5'));var BPromise=require(_0xf4d0('0x6'));var Mustache=require(_0xf4d0('0x7'));var util=require('util');var path=require(_0xf4d0('0x8'));var sox=require(_0xf4d0('0x9'));var csv=require(_0xf4d0('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf4d0('0xb'));var _=require(_0xf4d0('0xc'));var squel=require(_0xf4d0('0xd'));var crypto=require(_0xf4d0('0xe'));var jsforce=require(_0xf4d0('0xf'));var deskjs=require(_0xf4d0('0x10'));var toCsv=require('to-csv');var querystring=require(_0xf4d0('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xf4d0('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf4d0('0x13'));var logger=require(_0xf4d0('0x14'))('api');var utils=require(_0xf4d0('0x15'));var config=require(_0xf4d0('0x16'));var licenseUtil=require(_0xf4d0('0x17'));var db=require(_0xf4d0('0x18'))['db'];config[_0xf4d0('0x19')]=_[_0xf4d0('0x1a')](config[_0xf4d0('0x19')],{'host':_0xf4d0('0x1b'),'port':0x18eb});var socket=require(_0xf4d0('0x1c'))(new Redis(config[_0xf4d0('0x19')]));require('./faxInteraction.socket')[_0xf4d0('0x1d')](socket);function respondWithStatusCode(_0x85a824,_0x11345f){_0x11345f=_0x11345f||0xcc;return function(_0x318ead){if(_0x318ead){return _0x85a824[_0xf4d0('0x1e')](_0x11345f);}return _0x85a824[_0xf4d0('0x1f')](_0x11345f)[_0xf4d0('0x20')]();};}function respondWithResult(_0x31d9ed,_0x1b6e2a){_0x1b6e2a=_0x1b6e2a||0xc8;return function(_0x4cf643){if(_0x4cf643){return _0x31d9ed['status'](_0x1b6e2a)[_0xf4d0('0x21')](_0x4cf643);}};}function respondWithFilteredResult(_0x3ebf43,_0x13f940){return function(_0x430a9f){if(_0x430a9f){var _0x1f02c6=typeof _0x13f940['offset']===_0xf4d0('0x22')&&typeof _0x13f940[_0xf4d0('0x23')]===_0xf4d0('0x22');var _0x4e733e=_0x430a9f[_0xf4d0('0x24')];var _0x3f24fd=_0x1f02c6?0x0:_0x13f940[_0xf4d0('0x25')];var _0x126b11=_0x1f02c6?_0x430a9f[_0xf4d0('0x24')]:_0x13f940[_0xf4d0('0x25')]+_0x13f940[_0xf4d0('0x23')];var _0x5c24c2;if(_0x126b11>=_0x4e733e){_0x126b11=_0x4e733e;_0x5c24c2=0xc8;}else{_0x5c24c2=0xce;}_0x3ebf43['status'](_0x5c24c2);return _0x3ebf43[_0xf4d0('0x26')](_0xf4d0('0x27'),_0x3f24fd+'-'+_0x126b11+'/'+_0x4e733e)['json'](_0x430a9f);}return null;};}function patchUpdates(_0x2089cb){return function(_0x1577ff){try{jsonpatch[_0xf4d0('0x28')](_0x1577ff,_0x2089cb,!![]);}catch(_0x2a247f){return BPromise[_0xf4d0('0x29')](_0x2a247f);}return _0x1577ff[_0xf4d0('0x2a')]();};}function saveUpdates(_0x5a3f1b,_0x3be186){return function(_0x52da6d){if(_0x52da6d){return _0x52da6d[_0xf4d0('0x2b')](_0x5a3f1b)[_0xf4d0('0x2c')](function(_0x572930){return _0x572930;});}return null;};}function removeEntity(_0x5b7f38,_0x34ca0d){return function(_0x3c322f){if(_0x3c322f){return _0x3c322f[_0xf4d0('0x2d')]()[_0xf4d0('0x2c')](function(){_0x5b7f38[_0xf4d0('0x1f')](0xcc)[_0xf4d0('0x20')]();});}};}function handleEntityNotFound(_0x28d5f1,_0x2ea8a5){return function(_0x2342f7){if(!_0x2342f7){_0x28d5f1[_0xf4d0('0x1e')](0x194);}return _0x2342f7;};}function handleError(_0x2c1007,_0x31e541){_0x31e541=_0x31e541||0x1f4;return function(_0x253345){logger[_0xf4d0('0x2e')](_0x253345[_0xf4d0('0x2f')]);if(_0x253345[_0xf4d0('0x30')]){delete _0x253345[_0xf4d0('0x30')];}_0x2c1007['status'](_0x31e541)[_0xf4d0('0x31')](_0x253345);};}function getInteractionUsers(_0x338630,_0x322a3c){return new BPromise(function(_0x2c6899,_0x3c02f7){try{if(_0x322a3c[_0x338630['id']]){_0x338630[_0xf4d0('0x32')]=_[_0xf4d0('0x33')](_0x322a3c[_0x338630['id']],function(_0xfce016){return{'id':_0xfce016['id'],'fullname':_0xfce016[_0xf4d0('0x34')]};});}}catch(_0x4b7c38){_0x3c02f7(_0x4b7c38);}_0x2c6899(_0x338630);});}function getInteractionTags(_0x180146,_0x33aecc){return new BPromise(function(_0x3ad463,_0x1f2f52){try{if(_0x180146[_0xf4d0('0x35')]){_0x180146[_0xf4d0('0x36')]=[];_0x180146['TagIds'][_0xf4d0('0x37')](',')[_0xf4d0('0x38')](function(_0x280762){_0x180146[_0xf4d0('0x36')]['push'](_0x33aecc[_0x280762]);});}delete _0x180146[_0xf4d0('0x35')];}catch(_0x3abda8){_0x1f2f52(_0x3abda8);}_0x3ad463(_0x180146);});}function updateFaxInteraction(_0x39f12b,_0x517eb5,_0x94f3a5){return new BPromise(function(_0x4c2e01,_0x4fd565){return getInteractionUsers(_0x39f12b,_0x94f3a5)[_0xf4d0('0x2c')](function(_0x69387c){return getInteractionTags(_0x69387c,_0x517eb5);})[_0xf4d0('0x2c')](function(_0x31bcc7){_0x4c2e01(_0x31bcc7);})[_0xf4d0('0x39')](function(_0x3a0adf){_0x4fd565(_0x3a0adf);});});}exports[_0xf4d0('0x3a')]=function(_0xf1ccdc,_0x268b91){var _0xab73f1={},_0x3da418={},_0x1ec2c7={'count':0x0,'rows':[]};var _0x5678ed=_[_0xf4d0('0x33')](db[_0xf4d0('0x3b')][_0xf4d0('0x3c')],function(_0x431707){return{'name':_0x431707[_0xf4d0('0x3d')],'type':_0x431707[_0xf4d0('0x3e')][_0xf4d0('0x3f')]};});_0x3da418[_0xf4d0('0x40')]=_['map'](_0x5678ed,'name');_0x3da418[_0xf4d0('0x41')]=_[_0xf4d0('0x42')](_0xf1ccdc[_0xf4d0('0x41')]);_0x3da418[_0xf4d0('0x43')]=_[_0xf4d0('0x44')](_0x3da418[_0xf4d0('0x40')],_0x3da418[_0xf4d0('0x41')]);_0xab73f1[_0xf4d0('0x45')]=_[_0xf4d0('0x44')](_0x3da418[_0xf4d0('0x40')],qs[_0xf4d0('0x46')](_0xf1ccdc['query'][_0xf4d0('0x46')]));_0xab73f1['attributes']=_0xab73f1[_0xf4d0('0x45')]['length']?_0xab73f1[_0xf4d0('0x45')]:_0x3da418[_0xf4d0('0x40')];if(!_0xf1ccdc[_0xf4d0('0x41')][_0xf4d0('0x47')](_0xf4d0('0x48'))){_0xab73f1[_0xf4d0('0x23')]=qs[_0xf4d0('0x23')](_0xf1ccdc[_0xf4d0('0x41')]['limit']);_0xab73f1[_0xf4d0('0x25')]=qs[_0xf4d0('0x25')](_0xf1ccdc[_0xf4d0('0x41')][_0xf4d0('0x25')]);}_0xab73f1[_0xf4d0('0x49')]=qs[_0xf4d0('0x4a')](_0xf1ccdc[_0xf4d0('0x41')][_0xf4d0('0x4a')]);_0xab73f1[_0xf4d0('0x4b')]=qs[_0xf4d0('0x43')](_[_0xf4d0('0x4c')](_0xf1ccdc[_0xf4d0('0x41')],_0x3da418[_0xf4d0('0x43')]),_0x5678ed);var _0x132013=[];var _0x7dcb8c=squel[_0xf4d0('0x4d')]()[_0xf4d0('0x4e')]('id')['field'](_0xf4d0('0x30'))['field'](_0xf4d0('0x4f'))[_0xf4d0('0x50')](_0xf4d0('0x51'));var _0x32fe36=squel[_0xf4d0('0x4d')]()[_0xf4d0('0x4e')](_0xf4d0('0x52'))[_0xf4d0('0x4e')](_0xf4d0('0x53'))[_0xf4d0('0x4e')](_0xf4d0('0x54'))[_0xf4d0('0x50')]('user_has_fax_interactions','ui')[_0xf4d0('0x55')](_0xf4d0('0x56'),'u','u.id\x20=\x20ui.UserId');var _0x3e9552=squel[_0xf4d0('0x4d')]()[_0xf4d0('0x50')]('fax_interactions','i')[_0xf4d0('0x55')](_0xf4d0('0x57'),'c',_0xf4d0('0x58'))[_0xf4d0('0x55')]('users','o',_0xf4d0('0x59'))[_0xf4d0('0x55')](_0xf4d0('0x5a'),'a',_0xf4d0('0x5b'))['left_join'](_0xf4d0('0x5c'),'me',_0xf4d0('0x5d'))[_0xf4d0('0x55')](_0xf4d0('0x5e'),'it',_0xf4d0('0x5f'))[_0xf4d0('0x55')]('tools_tags','t','t.id\x20=\x20it.TagId');var _0x426848=squel[_0xf4d0('0x60')]();var _0x5bb43d=[];var _0x1c2302=squel[_0xf4d0('0x60')]();var _0x13cc8d;if(_0xf1ccdc['query']['search']){_0x13cc8d=as[_0xf4d0('0x61')](_0xf1ccdc[_0xf4d0('0x41')][_0xf4d0('0x62')]);var _0x19668f=_0x13cc8d['sqlOperator'];for(var _0x514281=0x0;_0x514281<_0x13cc8d[_0xf4d0('0x63')][_0xf4d0('0x64')];_0x514281++){var _0x5c0d12=_0x13cc8d['conditions'][_0x514281];var _0x46d05d='i';var _0x3707c0=_[_0xf4d0('0x65')](_0x5678ed,[_0xf4d0('0x30'),_0x5c0d12[_0xf4d0('0x4e')]]);if(!_0x3707c0){switch(_0x5c0d12[_0xf4d0('0x4e')]){case'unreadMessages':if(_0x5c0d12['value']==0x1){_0x3e9552[_0xf4d0('0x66')]('`'+_0x5c0d12['field']+'`\x20=\x200');}else{_0x3e9552[_0xf4d0('0x66')]('`'+_0x5c0d12['field']+_0xf4d0('0x67'));}break;case _0xf4d0('0x68'):if(_0x5c0d12[_0xf4d0('0x69')]===_0xf4d0('0x6a')){if(_0x5c0d12[_0xf4d0('0x6b')][_0xf4d0('0x37')]('\x20')[_0xf4d0('0x64')]>0x1){_0x426848[_0x19668f](_0xf4d0('0x6c'),qs[_0xf4d0('0x6d')](_0x5c0d12['value']),null);}else{var _0x2b1d3c='%'+_0x5c0d12[_0xf4d0('0x6b')]+'%';_0x426848[_0x19668f](_0xf4d0('0x6e'),_0x2b1d3c,_0x2b1d3c,_0x2b1d3c);}}else{_0x3707c0=_[_0xf4d0('0x65')](_0x5678ed,[_0xf4d0('0x30'),_0xf4d0('0x6f')]);_0x5c0d12[_0xf4d0('0x4e')]='ContactId';_0x58776e=as[_0xf4d0('0x70')](_0x46d05d,_0x3707c0[_0xf4d0('0x3e')],_0x5c0d12);_0x426848[_0x19668f](_0x58776e[_0xf4d0('0x71')],_0x58776e['value'][_0xf4d0('0x72')],_0x58776e[_0xf4d0('0x6b')][_0xf4d0('0x20')]);}break;case _0xf4d0('0x73'):var _0xfef4a3=_0x5c0d12[_0xf4d0('0x6b')]['split'](',')[_0xf4d0('0x33')](function(_0x492a26){return Number(_0x492a26);});_0xfef4a3[_0xf4d0('0x38')](function(_0x3e78ce){_0x1c2302['or'](_0xf4d0('0x74'),'%,'+_0x3e78ce+',%');});_0x5bb43d=_[_0xf4d0('0x75')](_0x5bb43d,_0xfef4a3);break;case _0xf4d0('0x76'):if(_0x5c0d12[_0xf4d0('0x69')]===_0xf4d0('0x6a')){_0x426848[_0x19668f](_0xf4d0('0x77'),'%'+_0x5c0d12[_0xf4d0('0x6b')]+'%',null);}else{_0x3707c0=_[_0xf4d0('0x65')](_0x5678ed,[_0xf4d0('0x30'),_0xf4d0('0x78')]);_0x5c0d12[_0xf4d0('0x4e')]=_0xf4d0('0x78');_0x58776e=as['buildExpression'](_0x46d05d,_0x3707c0['type'],_0x5c0d12);_0x426848[_0x19668f](_0x58776e[_0xf4d0('0x71')],_0x58776e[_0xf4d0('0x6b')][_0xf4d0('0x72')],_0x58776e[_0xf4d0('0x6b')]['end']);}break;case _0xf4d0('0x79'):_0x58776e=as['buildExpression']('me',null,_0x5c0d12);_0x426848[_0x19668f](_0x58776e[_0xf4d0('0x71')],_0x58776e['value'][_0xf4d0('0x72')],_0x58776e[_0xf4d0('0x6b')][_0xf4d0('0x20')]);break;}}else{var _0x58776e=as[_0xf4d0('0x70')](_0x46d05d,_0x3707c0[_0xf4d0('0x3e')],_0x5c0d12);_0x426848[_0x19668f](_0x58776e[_0xf4d0('0x71')],_0x58776e[_0xf4d0('0x6b')][_0xf4d0('0x72')],_0x58776e[_0xf4d0('0x6b')][_0xf4d0('0x20')]);}}}else{var _0x3d9d55=_(_0xf1ccdc[_0xf4d0('0x41')])[_0xf4d0('0x42')]()[_0xf4d0('0x33')](function(_0x426d19){return _[_0xf4d0('0x7a')](_0x5678ed,['name',_0x426d19])?_0x426d19:undefined;})[_0xf4d0('0x7b')]()[_0xf4d0('0x6b')]();if(!_[_0xf4d0('0x7c')](_0x3d9d55)){_0x3d9d55[_0xf4d0('0x38')](function(_0x436076){if(_0x436076==='FaxAccountId'){_0x3e9552[_0xf4d0('0x4b')](_0xf4d0('0x7d'),[]['concat'](_0xf1ccdc[_0xf4d0('0x41')][_0x436076]));}else if(_0x436076===_0xf4d0('0x7e')){var _0x4c800c=JSON[_0xf4d0('0x7f')](_0xf1ccdc[_0xf4d0('0x41')][_0x436076])[_0xf4d0('0x80')];var _0x4020d5=JSON[_0xf4d0('0x7f')](_0xf1ccdc[_0xf4d0('0x41')][_0x436076])['$lte'];_0x3e9552['where'](_0xf4d0('0x81'),_0x4c800c,_0x4020d5);}else{if(_0xf1ccdc[_0xf4d0('0x41')][_0x436076]===_0xf4d0('0x82')){_0x3e9552[_0xf4d0('0x4b')]('i.'+_0x436076+_0xf4d0('0x83'));}else{_0x3e9552[_0xf4d0('0x4b')]('i.'+_0x436076+_0xf4d0('0x84'),_0xf1ccdc['query'][_0x436076]);}}});}if(_0xf1ccdc['query'][_0xf4d0('0x85')]){if(_0xf1ccdc[_0xf4d0('0x41')]['read']==0x1){_0x3e9552[_0xf4d0('0x66')](_0xf4d0('0x86'));}else{_0x3e9552[_0xf4d0('0x66')]('`unreadMessages`\x20>\x200');}}if(_0xf1ccdc[_0xf4d0('0x41')]['tag']){_0x5bb43d=_['isArray'](_0xf1ccdc['query']['tag'])?_0xf1ccdc[_0xf4d0('0x41')][_0xf4d0('0x87')]:new Array(_0xf1ccdc[_0xf4d0('0x41')][_0xf4d0('0x87')]);_0x5bb43d['forEach'](function(_0x325b67){_0x1c2302['or'](_0xf4d0('0x74'),'%,'+_0x325b67+',%');});}if(_0xf1ccdc[_0xf4d0('0x41')][_0xf4d0('0x88')]){var _0x44eb6a=_0xf1ccdc[_0xf4d0('0x41')][_0xf4d0('0x88')][_0xf4d0('0x89')]('\x5c','\x5c\x5c')[_0xf4d0('0x89')](/'/g,'\x27\x27');if(qs[_0xf4d0('0x8a')](_0x44eb6a)){_0x426848['or'](_0xf4d0('0x8b'),_0x44eb6a+'%')['or'](_0xf4d0('0x8c'),_0x44eb6a+'%');}_0x426848['or'](_0xf4d0('0x8d'),_0x44eb6a+'%');}}_0x3e9552[_0xf4d0('0x4b')](_0x426848);_0x3e9552[_0xf4d0('0x8e')](_0xf4d0('0x8f'));var _0x289afb={'type':db[_0xf4d0('0x90')]['QueryTypes']['SELECT'],'raw':!![]};var _0x594e28=_0x3e9552[_0xf4d0('0x91')]();_0x594e28['field'](_0xf4d0('0x8f'));_0x594e28['field'](_0xf4d0('0x92'),_0xf4d0('0x93'));if(_0xab73f1[_0xf4d0('0x49')]){_0xab73f1['order'][_0xf4d0('0x38')](function(_0x31b823){var _0x1ad438=_0x31b823[0x0]===_0xf4d0('0x94')?_0x31b823[0x0]:'i.'+_0x31b823[0x0];_0x3e9552[_0xf4d0('0x49')](_0x1ad438,_0x31b823[0x1]===_0xf4d0('0x95')?![]:!![]);});}if(!_[_0xf4d0('0x7c')](_0x5bb43d)){_0x3e9552['having'](_0x1c2302);_0x594e28[_0xf4d0('0x4b')](_0xf4d0('0x96'),_0x5bb43d);}BPromise[_0xf4d0('0x97')]()[_0xf4d0('0x2c')](function(){if(!_0x13cc8d){if(_0xf1ccdc[_0xf4d0('0x41')][_0xf4d0('0x98')])return;_0x594e28['where'](_0xf4d0('0x99'));_0x3e9552[_0xf4d0('0x4b')](_0xf4d0('0x99'));return;}if(_0xf1ccdc['user'][_0xf4d0('0x9a')]!==_0xf4d0('0x9b'))return;return _0xf1ccdc[_0xf4d0('0x9c')][_0xf4d0('0x9d')]({'attributes':['id'],'raw':!![]})[_0xf4d0('0x2c')](function(_0x199dd1){if(_[_0xf4d0('0x7c')](_0x199dd1)){_0x594e28['where']('i.FaxAccountId\x20IS\x20NULL');_0x3e9552[_0xf4d0('0x4b')](_0xf4d0('0x9e'));}else{_0x594e28[_0xf4d0('0x4b')]('i.FaxAccountId\x20IN\x20?',_[_0xf4d0('0x33')](_0x199dd1,'id'));_0x3e9552[_0xf4d0('0x4b')]('i.FaxAccountId\x20IN\x20?',_[_0xf4d0('0x33')](_0x199dd1,'id'));}});})[_0xf4d0('0x2c')](function(){if(_0xf1ccdc[_0xf4d0('0x9c')][_0xf4d0('0x9a')]===_0xf4d0('0x9b')&&!_0x13cc8d&&!_0xf1ccdc[_0xf4d0('0x41')][_0xf4d0('0x98')])return[];return db['sequelize']['query'](_0x594e28[_0xf4d0('0x9f')](),_0x289afb);})[_0xf4d0('0x2c')](function(_0xb5a7cc){_0x1ec2c7[_0xf4d0('0x24')]=_0xb5a7cc[_0xf4d0('0x64')];if(_0x1ec2c7['count']===0x0)return[];return db[_0xf4d0('0xa0')][_0xf4d0('0x41')](_0x7dcb8c[_0xf4d0('0x9f')](),_0x289afb)[_0xf4d0('0x2c')](function(_0xc3e9ed){_0x132013=_[_0xf4d0('0xa1')](_0xc3e9ed,'id');_0x289afb=_[_0xf4d0('0xa2')](_0x289afb,{'model':db['FaxInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0xf1ccdc[_0xf4d0('0x41')][_0xf4d0('0x46')]){_0xab73f1[_0xf4d0('0x45')][_0xf4d0('0x38')](function(_0x515645){_0x3e9552['field']('i.'+_0x515645);});}else{_0x3e9552[_0xf4d0('0x4e')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');_0x3e9552[_0xf4d0('0x4e')](_0xf4d0('0xa3'),'Account.key');_0x3e9552[_0xf4d0('0x4e')](_0xf4d0('0xa4'),_0xf4d0('0xa5'));_0x3e9552['field'](_0xf4d0('0xa6'),_0xf4d0('0x94'));_0x3e9552[_0xf4d0('0x4e')](_0xf4d0('0xa7'));_0x3e9552['field'](_0xf4d0('0xa8'),_0xf4d0('0xa9'));_0x3e9552[_0xf4d0('0x4e')](_0xf4d0('0xaa'),'Contact.lastName');_0x3e9552[_0xf4d0('0x4e')](_0xf4d0('0xab'),_0xf4d0('0xac'));_0x3e9552['field']('c.phone',_0xf4d0('0xad'));_0x3e9552[_0xf4d0('0x4e')](_0xf4d0('0xae'),_0xf4d0('0xaf'));_0x3e9552['field'](_0xf4d0('0xb0'),_0xf4d0('0xb1'));_0x3e9552[_0xf4d0('0x4e')](_0xf4d0('0xb2'),_0xf4d0('0xb3'));_0x3e9552[_0xf4d0('0x4e')](_0xf4d0('0xb4'),_0xf4d0('0xb5'));_0x3e9552[_0xf4d0('0x4e')](_0xf4d0('0xb6'),_0xf4d0('0x35'));}if(_0xab73f1[_0xf4d0('0x23')])_0x3e9552['limit'](_0xab73f1[_0xf4d0('0x23')]);if(_0xab73f1['offset'])_0x3e9552[_0xf4d0('0x25')](_0xab73f1[_0xf4d0('0x25')]);return db[_0xf4d0('0xa0')]['query'](_0x3e9552[_0xf4d0('0x9f')](),_0x289afb);})[_0xf4d0('0x2c')](function(_0x2c4504){if(_0x2c4504[_0xf4d0('0x64')]>0x0)_0x32fe36['where'](_0xf4d0('0xb7'),_[_0xf4d0('0x33')](_0x2c4504,'id'));return db[_0xf4d0('0xa0')][_0xf4d0('0x41')](_0x32fe36[_0xf4d0('0x9f')](),_0x289afb)[_0xf4d0('0x2c')](function(_0x439384){var _0x155937=_[_0xf4d0('0xb8')](_0x439384,_0xf4d0('0xb9'));var _0x5f121c=[];_0x2c4504['forEach'](function(_0x1b0e13){_0x5f121c[_0xf4d0('0xba')](updateFaxInteraction(_0x1b0e13,_0x132013,_0x155937));});return BPromise[_0xf4d0('0xbb')](_0x5f121c);});});})[_0xf4d0('0x2c')](function(_0x243199){_0x1ec2c7[_0xf4d0('0xbc')]=_0x243199;return _0x1ec2c7;})[_0xf4d0('0x2c')](respondWithFilteredResult(_0x268b91,_0xab73f1))[_0xf4d0('0x39')](handleError(_0x268b91,null));};exports[_0xf4d0('0xbd')]=function(_0x4a73cf,_0xc47d87){var _0x1ae23d={'raw':![],'where':{'id':_0x4a73cf[_0xf4d0('0xbe')]['id']}},_0x341111={};_0x341111[_0xf4d0('0x40')]=_['keys'](db[_0xf4d0('0x3b')][_0xf4d0('0x3c')]);_0x341111[_0xf4d0('0x41')]=_['keys'](_0x4a73cf[_0xf4d0('0x41')]);_0x341111['filters']=_['intersection'](_0x341111[_0xf4d0('0x40')],_0x341111[_0xf4d0('0x41')]);_0x1ae23d['attributes']=_[_0xf4d0('0x44')](_0x341111[_0xf4d0('0x40')],qs[_0xf4d0('0x46')](_0x4a73cf[_0xf4d0('0x41')][_0xf4d0('0x46')]));_0x1ae23d['attributes']=_0x1ae23d[_0xf4d0('0x45')]['length']?_0x1ae23d[_0xf4d0('0x45')]:_0x341111[_0xf4d0('0x40')];if(_0x4a73cf[_0xf4d0('0x41')][_0xf4d0('0xbf')]){_0x1ae23d[_0xf4d0('0xc0')]=[{'all':!![]}];}_0x1ae23d=_['merge']({},_0x1ae23d,_0x4a73cf[_0xf4d0('0xc1')]);return db[_0xf4d0('0x3b')][_0xf4d0('0x65')](_0x1ae23d)['then'](handleEntityNotFound(_0xc47d87,null))[_0xf4d0('0x2c')](respondWithResult(_0xc47d87,null))[_0xf4d0('0x39')](handleError(_0xc47d87,null));};exports[_0xf4d0('0xc2')]=function(_0x938443,_0x16badf){return db[_0xf4d0('0x3b')][_0xf4d0('0xc2')](_0x938443['body'],{})[_0xf4d0('0x2c')](respondWithResult(_0x16badf,0xc9))[_0xf4d0('0x39')](handleError(_0x16badf,null));};exports[_0xf4d0('0x2b')]=function(_0x5c32cb,_0x57cf74){if(_0x5c32cb[_0xf4d0('0x79')]['id']){delete _0x5c32cb[_0xf4d0('0x79')]['id'];}return db['FaxInteraction'][_0xf4d0('0x65')]({'where':{'id':_0x5c32cb[_0xf4d0('0xbe')]['id']}})['then'](handleEntityNotFound(_0x57cf74,null))['then'](saveUpdates(_0x5c32cb[_0xf4d0('0x79')],null))[_0xf4d0('0x2c')](respondWithResult(_0x57cf74,null))[_0xf4d0('0x39')](handleError(_0x57cf74,null));};exports[_0xf4d0('0x2d')]=function(_0x350a9d,_0x4a45b8){return db['FaxInteraction'][_0xf4d0('0x65')]({'where':{'id':_0x350a9d[_0xf4d0('0xbe')]['id']}})['then'](handleEntityNotFound(_0x4a45b8,null))['then'](removeEntity(_0x4a45b8,null))[_0xf4d0('0x39')](handleError(_0x4a45b8,null));};exports[_0xf4d0('0xc3')]=function(_0x1a2739,_0x24fdd5){return db[_0xf4d0('0x3b')][_0xf4d0('0xc3')]()[_0xf4d0('0x2c')](respondWithResult(_0x24fdd5,null))[_0xf4d0('0x39')](handleError(_0x24fdd5,null));};exports['addMessage']=function(_0x373ab6,_0x2866e2,_0x4c7cb1){return db[_0xf4d0('0xc4')][_0xf4d0('0x65')]({'where':{'id':_0x373ab6[_0xf4d0('0xbe')]['id']}})[_0xf4d0('0x2c')](handleEntityNotFound(_0x2866e2,null))[_0xf4d0('0x2c')](function(_0x3d7b96){if(_0x3d7b96){return _0x3d7b96['addMessage'](_0x373ab6[_0xf4d0('0x79')][_0xf4d0('0xc5')],_[_0xf4d0('0xc6')](_0x373ab6[_0xf4d0('0x79')],[_0xf4d0('0xc5'),'id'])||{});}})[_0xf4d0('0x2c')](respondWithResult(_0x2866e2,null))[_0xf4d0('0x39')](handleError(_0x2866e2,null));};exports[_0xf4d0('0xc7')]=function(_0x5d5acf,_0x1c25f9,_0x1d6e44){var _0x285d0d={'raw':![],'where':{}};var _0x4dde8f={};var _0x230024={'count':0x0,'rows':[]};return db[_0xf4d0('0x3b')]['findOne']({'where':{'id':_0x5d5acf[_0xf4d0('0xbe')]['id']}})[_0xf4d0('0x2c')](handleEntityNotFound(_0x1c25f9,null))[_0xf4d0('0x2c')](function(_0x21b626){if(_0x21b626){_0x4dde8f['model']=_[_0xf4d0('0x42')](db[_0xf4d0('0xc4')]['rawAttributes']);_0x4dde8f[_0xf4d0('0x41')]=_['keys'](_0x5d5acf['query']);_0x4dde8f['filters']=_[_0xf4d0('0x44')](_0x4dde8f[_0xf4d0('0x40')],_0x4dde8f[_0xf4d0('0x41')]);_0x285d0d[_0xf4d0('0x45')]=_[_0xf4d0('0x44')](_0x4dde8f['model'],qs['fields'](_0x5d5acf['query']['fields']));_0x285d0d[_0xf4d0('0x45')]=_0x285d0d[_0xf4d0('0x45')][_0xf4d0('0x64')]?_0x285d0d[_0xf4d0('0x45')]:_0x4dde8f[_0xf4d0('0x40')];if(!_0x5d5acf[_0xf4d0('0x41')][_0xf4d0('0x47')](_0xf4d0('0x48'))){_0x285d0d[_0xf4d0('0x23')]=qs[_0xf4d0('0x23')](_0x5d5acf[_0xf4d0('0x41')][_0xf4d0('0x23')]);_0x285d0d['offset']=qs[_0xf4d0('0x25')](_0x5d5acf['query'][_0xf4d0('0x25')]);}_0x285d0d[_0xf4d0('0x49')]=qs[_0xf4d0('0x4a')](_0x5d5acf[_0xf4d0('0x41')]['sort']);_0x285d0d[_0xf4d0('0x4b')]=qs[_0xf4d0('0x43')](_[_0xf4d0('0x4c')](_0x5d5acf[_0xf4d0('0x41')],_0x4dde8f[_0xf4d0('0x43')]));_0x285d0d[_0xf4d0('0x4b')]['FaxInteractionId']=_0x21b626['id'];if(_0x5d5acf[_0xf4d0('0x41')][_0xf4d0('0x88')]){_0x285d0d[_0xf4d0('0x4b')]=_[_0xf4d0('0xa2')](_0x285d0d['where'],{'$or':_['map'](_0x285d0d['attributes'],function(_0xbd35a3){var _0x22f3dc={};_0x22f3dc[_0xbd35a3]={'$like':'%'+_0x5d5acf[_0xf4d0('0x41')][_0xf4d0('0x88')]+'%'};return _0x22f3dc;})});}if(_0x5d5acf[_0xf4d0('0x41')][_0xf4d0('0x80')]){var _0x550072=_0x5d5acf['query'][_0xf4d0('0x80')][_0xf4d0('0x37')](',');var _0x1f27fd={};_0x1f27fd[_0x550072[0x0]]={'$gte':moment(_0x550072[0x1])['format'](_0xf4d0('0xc8'))};_0x285d0d[_0xf4d0('0x4b')]=_[_0xf4d0('0xa2')](_0x285d0d[_0xf4d0('0x4b')],_0x1f27fd);}_0x285d0d=_[_0xf4d0('0xa2')]({},_0x285d0d,_0x5d5acf[_0xf4d0('0xc1')]);return db['FaxMessage']['count']({'where':_0x285d0d['where']})['then'](function(_0x5624f9){_0x230024[_0xf4d0('0x24')]=_0x5624f9;if(_0x5d5acf[_0xf4d0('0x41')][_0xf4d0('0xbf')]){_0x285d0d[_0xf4d0('0xc0')]=[{'all':!![]}];}return db[_0xf4d0('0xc4')][_0xf4d0('0xc9')](_0x285d0d);})[_0xf4d0('0x2c')](function(_0x1612e1){_0x230024['rows']=_0x1612e1;return _0x230024;});}})[_0xf4d0('0x2c')](respondWithFilteredResult(_0x1c25f9,_0x285d0d))[_0xf4d0('0x39')](handleError(_0x1c25f9,null));};exports['addTags']=function(_0x17a942,_0x45ab20,_0x2c73dc){return db[_0xf4d0('0x3b')][_0xf4d0('0x65')]({'where':{'id':_0x17a942[_0xf4d0('0xbe')]['id']}})[_0xf4d0('0x2c')](handleEntityNotFound(_0x45ab20,null))['then'](function(_0x1b07a7){if(_0x1b07a7){return _0x1b07a7[_0xf4d0('0xca')](_0x17a942['body'][_0xf4d0('0xc5')],_[_0xf4d0('0xc6')](_0x17a942[_0xf4d0('0x79')],[_0xf4d0('0xc5'),'id'])||{})[_0xf4d0('0xcb')](function(){return db[_0xf4d0('0x73')][_0xf4d0('0xc9')]({'attributes':['id',_0xf4d0('0x30'),_0xf4d0('0x4f')],'where':{'id':_0x17a942['body'][_0xf4d0('0xc5')]}});})['then'](function(_0x3aa711){socket['emit']('faxInteractionTags:save',{'id':Number(_0x17a942[_0xf4d0('0xbe')]['id']),'tags':_0x3aa711||[]});return{'id':Number(_0x17a942[_0xf4d0('0xbe')]['id']),'tags':_0x3aa711||[]};});}})[_0xf4d0('0x2c')](respondWithResult(_0x45ab20,null))[_0xf4d0('0x39')](handleError(_0x45ab20,null));};exports[_0xf4d0('0xcc')]=function(_0x5892e9,_0x3e7e5c,_0x196742){return db['FaxInteraction'][_0xf4d0('0x65')]({'where':{'id':_0x5892e9[_0xf4d0('0xbe')]['id']}})['then'](handleEntityNotFound(_0x3e7e5c,null))[_0xf4d0('0x2c')](function(_0x1520dc){if(_0x1520dc){return _0x1520dc['removeTags'](_0x5892e9['query'][_0xf4d0('0xc5')]);}})['then'](respondWithStatusCode(_0x3e7e5c,null))['catch'](handleError(_0x3e7e5c,null));};exports[_0xf4d0('0xcd')]=function(_0x382839,_0x3134a2){var _0x2a8eef=moment()[_0xf4d0('0xce')]()['toString']();var _0x31aa96=path[_0xf4d0('0xcf')](config[_0xf4d0('0xd0')],_0xf4d0('0xd1'),_0xf4d0('0xd2'),_0xf4d0('0xd3'));var _0x353150=path[_0xf4d0('0xcf')](config[_0xf4d0('0xd0')],_0xf4d0('0xd1'),_0xf4d0('0xd2'),'attachments');var _0x5774ba=path['join'](_0x31aa96,_0x2a8eef);var _0x1a5679=util[_0xf4d0('0xd4')](_0xf4d0('0xd5'),_0x382839[_0xf4d0('0xbe')]['id'],_0x2a8eef);var _0x39b369=path[_0xf4d0('0xcf')](_0x31aa96,_0x1a5679);var _0x3a6696=[];_0x3a6696[_0xf4d0('0xba')]({'model':db[_0xf4d0('0xd6')],'as':'Attachment','raw':!![]});var _0xe7db24=[{'model':db[_0xf4d0('0xc4')],'as':_0xf4d0('0xd7'),'attributes':['id',_0xf4d0('0x79'),'createdAt'],'include':_0x3a6696}];return db[_0xf4d0('0x3b')][_0xf4d0('0x65')]({'where':{'id':_0x382839[_0xf4d0('0xbe')]['id']},'include':_0xe7db24})[_0xf4d0('0x2c')](handleEntityNotFound(_0x3134a2,null))[_0xf4d0('0x2c')](function(_0x39ec66){if(_0x39ec66&&_0x39ec66[_0xf4d0('0xd7')]){var _0x130555=_0x39ec66[_0xf4d0('0xd8')]({'plain':!![]});fs[_0xf4d0('0xd9')](_0x5774ba);for(var _0x1c620d=0x0;_0x1c620d<_0x130555[_0xf4d0('0xd7')][_0xf4d0('0x64')];_0x1c620d++){var _0xe8c76f=_0x130555[_0xf4d0('0xd7')][_0x1c620d]['Attachment'];if(_0xe8c76f){var _0x117da2=path[_0xf4d0('0xcf')](_0x353150,_0xe8c76f[_0xf4d0('0xda')]);if(fs['existsSync'](_0x117da2)){fs[_0xf4d0('0xdb')](_0x117da2)[_0xf4d0('0xdc')](fs['createWriteStream'](path[_0xf4d0('0xcf')](_0x5774ba,_0xe8c76f[_0xf4d0('0xda')])));}}}return BPromise[_0xf4d0('0x97')]()['then'](function(){return new BPromise(function(_0x1e283b,_0x491331){zipdir(_0x5774ba,{'saveTo':_0x39b369},function(_0x410e3a,_0x3771c2){if(_0x410e3a)return _0x491331(_0x410e3a);return _0x1e283b(_0x3771c2);});})['then'](function(){return new BPromise(function(_0x571bf4,_0x1b5d65){rimraf(_0x5774ba,function(_0x8117a4){if(_0x8117a4)_0x1b5d65(_0x8117a4);return _0x571bf4();});});})['then'](function(){return _0x3134a2[_0xf4d0('0xcd')](_0x39b369,_0x1a5679,function(_0x2a9aba){if(_0x2a9aba){console[_0xf4d0('0xdd')](_0xf4d0('0xde'),_0x2a9aba);}else{fs['unlinkSync'](_0x39b369);}});});});}else{return _0x3134a2[_0xf4d0('0x1e')](0xc8);}})[_0xf4d0('0x39')](handleError(_0x3134a2,null));}; \ No newline at end of file +var _0x4cd4=['join','root','attachments','format','transcript-%d-%s.zip','push','Attachment','Messages','get','mkdirSync','existsSync','createReadStream','pipe','createWriteStream','basename','log','err','unlinkSync','eml-format','zip-dir','fast-json-patch','bluebird','path','sox','to-csv','ejs','lodash','squel','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','localhost','register','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','update','destroy','then','end','error','stack','name','send','Users','map','fullname','TagIds','split','forEach','catch','index','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','select','field','color','from','tools_tags','u.id','ui.FaxInteractionId','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','me.FaxInteractionId\x20=\x20i.id','it.FaxInteractionId\x20=\x20i.id','expr','search','parseSearch','sqlOperator','conditions','unreadMessages','`\x20=\x200','having','`\x20>\x200','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','value','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','buildExpression','type','text','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','operator','$substring','UserId','start','body','some','isEmpty','FaxAccountId','i.FaxAccountId\x20IN\x20?','concat','createdAt','parse','$lte','null','\x20IS\x20NULL','read','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','t.id\x20IN\x20?','resolve','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getFaxAccounts','i.FaxAccountId\x20IS\x20NULL','sequelize','toString','keyBy','merge','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','c.firstName','c.lastName','Contact.lastName','c.email','Contact.email','Contact.phone','c.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.FaxInteractionId\x20IN\x20?','groupBy','FaxInteractionId','all','rows','FaxInteraction','includeAll','include','options','create','describe','addMessage','FaxMessage','params','ids','omit','hasOwnProperty','$gte','YYYY-MM-DD\x20HH:mm:ss','findAll','spread','Tag','removeTags','server','files','tmp'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4cd4,0xe0));var _0x44cd=function(_0x4a5d1e,_0xe74366){_0x4a5d1e=_0x4a5d1e-0x0;var _0x10e678=_0x4cd4[_0x4a5d1e];return _0x10e678;};'use strict';var emlformat=require(_0x44cd('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x44cd('0x1'));var jsonpatch=require(_0x44cd('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x44cd('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0x44cd('0x4'));var sox=require(_0x44cd('0x5'));var csv=require(_0x44cd('0x6'));var ejs=require(_0x44cd('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x44cd('0x8'));var squel=require(_0x44cd('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x44cd('0xa'));var Papa=require(_0x44cd('0xb'));var Redis=require(_0x44cd('0xc'));var authService=require('../../components/auth/service');var qs=require(_0x44cd('0xd'));var as=require(_0x44cd('0xe'));var hardwareService=require(_0x44cd('0xf'));var logger=require(_0x44cd('0x10'))(_0x44cd('0x11'));var utils=require(_0x44cd('0x12'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x44cd('0x13'))['db'];config[_0x44cd('0x14')]=_[_0x44cd('0x15')](config[_0x44cd('0x14')],{'host':_0x44cd('0x16'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x44cd('0x14')]));require('./faxInteraction.socket')[_0x44cd('0x17')](socket);function respondWithStatusCode(_0x54f9b3,_0x23c532){_0x23c532=_0x23c532||0xcc;return function(_0x28e9c0){if(_0x28e9c0){return _0x54f9b3[_0x44cd('0x18')](_0x23c532);}return _0x54f9b3[_0x44cd('0x19')](_0x23c532)['end']();};}function respondWithResult(_0x4d78e8,_0x8be41a){_0x8be41a=_0x8be41a||0xc8;return function(_0x565e85){if(_0x565e85){return _0x4d78e8[_0x44cd('0x19')](_0x8be41a)[_0x44cd('0x1a')](_0x565e85);}};}function respondWithFilteredResult(_0x375b81,_0x5f5129){return function(_0xfab550){if(_0xfab550){var _0x37f0d7=typeof _0x5f5129[_0x44cd('0x1b')]===_0x44cd('0x1c')&&typeof _0x5f5129[_0x44cd('0x1d')]===_0x44cd('0x1c');var _0x1e72f6=_0xfab550[_0x44cd('0x1e')];var _0xac0fb7=_0x37f0d7?0x0:_0x5f5129[_0x44cd('0x1b')];var _0x223908=_0x37f0d7?_0xfab550[_0x44cd('0x1e')]:_0x5f5129[_0x44cd('0x1b')]+_0x5f5129[_0x44cd('0x1d')];var _0x1ed67d;if(_0x223908>=_0x1e72f6){_0x223908=_0x1e72f6;_0x1ed67d=0xc8;}else{_0x1ed67d=0xce;}_0x375b81[_0x44cd('0x19')](_0x1ed67d);return _0x375b81[_0x44cd('0x1f')]('Content-Range',_0xac0fb7+'-'+_0x223908+'/'+_0x1e72f6)[_0x44cd('0x1a')](_0xfab550);}return null;};}function patchUpdates(_0x24517f){return function(_0x16afd0){try{jsonpatch[_0x44cd('0x20')](_0x16afd0,_0x24517f,!![]);}catch(_0x45e5b1){return BPromise[_0x44cd('0x21')](_0x45e5b1);}return _0x16afd0['save']();};}function saveUpdates(_0x2cb747,_0x2f5eaa){return function(_0x5ae551){if(_0x5ae551){return _0x5ae551[_0x44cd('0x22')](_0x2cb747)['then'](function(_0x56eab0){return _0x56eab0;});}return null;};}function removeEntity(_0x26bd39,_0x4fff0b){return function(_0x47b282){if(_0x47b282){return _0x47b282[_0x44cd('0x23')]()[_0x44cd('0x24')](function(){_0x26bd39[_0x44cd('0x19')](0xcc)[_0x44cd('0x25')]();});}};}function handleEntityNotFound(_0x2af473,_0x457f5d){return function(_0x1a81ce){if(!_0x1a81ce){_0x2af473[_0x44cd('0x18')](0x194);}return _0x1a81ce;};}function handleError(_0x3d5d0b,_0x523dc8){_0x523dc8=_0x523dc8||0x1f4;return function(_0x5b782d){logger[_0x44cd('0x26')](_0x5b782d[_0x44cd('0x27')]);if(_0x5b782d[_0x44cd('0x28')]){delete _0x5b782d[_0x44cd('0x28')];}_0x3d5d0b[_0x44cd('0x19')](_0x523dc8)[_0x44cd('0x29')](_0x5b782d);};}function getInteractionUsers(_0x4a6ad6,_0x3089de){return new BPromise(function(_0x1de1f3,_0x11f10f){try{if(_0x3089de[_0x4a6ad6['id']]){_0x4a6ad6[_0x44cd('0x2a')]=_[_0x44cd('0x2b')](_0x3089de[_0x4a6ad6['id']],function(_0x6e465a){return{'id':_0x6e465a['id'],'fullname':_0x6e465a[_0x44cd('0x2c')]};});}}catch(_0x3cf447){_0x11f10f(_0x3cf447);}_0x1de1f3(_0x4a6ad6);});}function getInteractionTags(_0x2da0f6,_0x47c3db){return new BPromise(function(_0x36d391,_0x47159b){try{if(_0x2da0f6[_0x44cd('0x2d')]){_0x2da0f6['Tags']=[];_0x2da0f6[_0x44cd('0x2d')][_0x44cd('0x2e')](',')[_0x44cd('0x2f')](function(_0x340d41){_0x2da0f6['Tags']['push'](_0x47c3db[_0x340d41]);});}delete _0x2da0f6['TagIds'];}catch(_0x816056){_0x47159b(_0x816056);}_0x36d391(_0x2da0f6);});}function updateFaxInteraction(_0x20b971,_0x15d671,_0x1456be){return new BPromise(function(_0x1a3eec,_0x233250){return getInteractionUsers(_0x20b971,_0x1456be)['then'](function(_0x3f1712){return getInteractionTags(_0x3f1712,_0x15d671);})['then'](function(_0x562719){_0x1a3eec(_0x562719);})[_0x44cd('0x30')](function(_0xd944f4){_0x233250(_0xd944f4);});});}exports[_0x44cd('0x31')]=function(_0x12b972,_0x86709f){var _0x27764e={},_0xa924ba={},_0x234363={'count':0x0,'rows':[]};var _0x47ec3e=_['map'](db['FaxInteraction'][_0x44cd('0x32')],function(_0x19cf5a){return{'name':_0x19cf5a[_0x44cd('0x33')],'type':_0x19cf5a['type']['key']};});_0xa924ba[_0x44cd('0x34')]=_['map'](_0x47ec3e,'name');_0xa924ba[_0x44cd('0x35')]=_[_0x44cd('0x36')](_0x12b972['query']);_0xa924ba[_0x44cd('0x37')]=_[_0x44cd('0x38')](_0xa924ba[_0x44cd('0x34')],_0xa924ba[_0x44cd('0x35')]);_0x27764e[_0x44cd('0x39')]=_[_0x44cd('0x38')](_0xa924ba[_0x44cd('0x34')],qs['fields'](_0x12b972[_0x44cd('0x35')][_0x44cd('0x3a')]));_0x27764e[_0x44cd('0x39')]=_0x27764e[_0x44cd('0x39')][_0x44cd('0x3b')]?_0x27764e[_0x44cd('0x39')]:_0xa924ba['model'];if(!_0x12b972[_0x44cd('0x35')]['hasOwnProperty'](_0x44cd('0x3c'))){_0x27764e['limit']=qs[_0x44cd('0x1d')](_0x12b972[_0x44cd('0x35')]['limit']);_0x27764e[_0x44cd('0x1b')]=qs[_0x44cd('0x1b')](_0x12b972[_0x44cd('0x35')][_0x44cd('0x1b')]);}_0x27764e[_0x44cd('0x3d')]=qs[_0x44cd('0x3e')](_0x12b972['query'][_0x44cd('0x3e')]);_0x27764e[_0x44cd('0x3f')]=qs[_0x44cd('0x37')](_[_0x44cd('0x40')](_0x12b972[_0x44cd('0x35')],_0xa924ba[_0x44cd('0x37')]),_0x47ec3e);var _0x10ee39=[];var _0x49909a=squel[_0x44cd('0x41')]()[_0x44cd('0x42')]('id')[_0x44cd('0x42')](_0x44cd('0x28'))[_0x44cd('0x42')](_0x44cd('0x43'))[_0x44cd('0x44')](_0x44cd('0x45'));var _0x513eb7=squel['select']()[_0x44cd('0x42')](_0x44cd('0x46'))[_0x44cd('0x42')]('u.fullname')[_0x44cd('0x42')](_0x44cd('0x47'))[_0x44cd('0x44')]('user_has_fax_interactions','ui')[_0x44cd('0x48')](_0x44cd('0x49'),'u',_0x44cd('0x4a'));var _0x3b6717=squel['select']()['from']('fax_interactions','i')[_0x44cd('0x48')](_0x44cd('0x4b'),'c',_0x44cd('0x4c'))[_0x44cd('0x48')](_0x44cd('0x49'),'o',_0x44cd('0x4d'))[_0x44cd('0x48')](_0x44cd('0x4e'),'a','a.id\x20=\x20i.FaxAccountId')['left_join'](_0x44cd('0x4f'),'me',_0x44cd('0x50'))[_0x44cd('0x48')]('fax_interaction_has_tags','it',_0x44cd('0x51'))['left_join']('tools_tags','t','t.id\x20=\x20it.TagId');var _0x1f9236=squel[_0x44cd('0x52')]();var _0x41e836=[];var _0x2aa562=squel['expr']();var _0x2a83a9;if(_0x12b972[_0x44cd('0x35')][_0x44cd('0x53')]){_0x2a83a9=as[_0x44cd('0x54')](_0x12b972[_0x44cd('0x35')]['search']);var _0xde7d8d=_0x2a83a9[_0x44cd('0x55')];for(var _0x5c413c=0x0;_0x5c413c<_0x2a83a9['conditions'][_0x44cd('0x3b')];_0x5c413c++){var _0x1fa2da=_0x2a83a9[_0x44cd('0x56')][_0x5c413c];var _0x322795='i';var _0x310a13=_['find'](_0x47ec3e,[_0x44cd('0x28'),_0x1fa2da[_0x44cd('0x42')]]);if(!_0x310a13){switch(_0x1fa2da[_0x44cd('0x42')]){case _0x44cd('0x57'):if(_0x1fa2da['value']==0x1){_0x3b6717['having']('`'+_0x1fa2da[_0x44cd('0x42')]+_0x44cd('0x58'));}else{_0x3b6717[_0x44cd('0x59')]('`'+_0x1fa2da[_0x44cd('0x42')]+_0x44cd('0x5a'));}break;case'Contact':if(_0x1fa2da['operator']==='$substring'){if(_0x1fa2da['value']['split']('\x20')[_0x44cd('0x3b')]>0x1){_0x1f9236[_0xde7d8d](_0x44cd('0x5b'),qs[_0x44cd('0x5c')](_0x1fa2da[_0x44cd('0x5d')]),null);}else{var _0x20cdef='%'+_0x1fa2da['value']+'%';_0x1f9236[_0xde7d8d](_0x44cd('0x5e'),_0x20cdef,_0x20cdef,_0x20cdef);}}else{_0x310a13=_[_0x44cd('0x5f')](_0x47ec3e,[_0x44cd('0x28'),_0x44cd('0x60')]);_0x1fa2da[_0x44cd('0x42')]=_0x44cd('0x60');_0x404733=as[_0x44cd('0x61')](_0x322795,_0x310a13[_0x44cd('0x62')],_0x1fa2da);_0x1f9236[_0xde7d8d](_0x404733[_0x44cd('0x63')],_0x404733[_0x44cd('0x5d')]['start'],_0x404733[_0x44cd('0x5d')]['end']);}break;case'Tag':var _0x1e6031=_0x1fa2da[_0x44cd('0x5d')][_0x44cd('0x2e')](',')[_0x44cd('0x2b')](function(_0x42f8f8){return Number(_0x42f8f8);});_0x1e6031[_0x44cd('0x2f')](function(_0x21c911){_0x2aa562['or'](_0x44cd('0x64'),'%,'+_0x21c911+',%');});_0x41e836=_['union'](_0x41e836,_0x1e6031);break;case _0x44cd('0x65'):if(_0x1fa2da[_0x44cd('0x66')]===_0x44cd('0x67')){_0x1f9236[_0xde7d8d]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x1fa2da[_0x44cd('0x5d')]+'%',null);}else{_0x310a13=_[_0x44cd('0x5f')](_0x47ec3e,['name',_0x44cd('0x68')]);_0x1fa2da[_0x44cd('0x42')]='UserId';_0x404733=as[_0x44cd('0x61')](_0x322795,_0x310a13[_0x44cd('0x62')],_0x1fa2da);_0x1f9236[_0xde7d8d](_0x404733[_0x44cd('0x63')],_0x404733[_0x44cd('0x5d')][_0x44cd('0x69')],_0x404733[_0x44cd('0x5d')][_0x44cd('0x25')]);}break;case _0x44cd('0x6a'):_0x404733=as['buildExpression']('me',null,_0x1fa2da);_0x1f9236[_0xde7d8d](_0x404733[_0x44cd('0x63')],_0x404733['value']['start'],_0x404733[_0x44cd('0x5d')][_0x44cd('0x25')]);break;}}else{var _0x404733=as['buildExpression'](_0x322795,_0x310a13['type'],_0x1fa2da);_0x1f9236[_0xde7d8d](_0x404733[_0x44cd('0x63')],_0x404733[_0x44cd('0x5d')][_0x44cd('0x69')],_0x404733[_0x44cd('0x5d')][_0x44cd('0x25')]);}}}else{var _0x15672d=_(_0x12b972[_0x44cd('0x35')])[_0x44cd('0x36')]()[_0x44cd('0x2b')](function(_0x45477a){return _[_0x44cd('0x6b')](_0x47ec3e,[_0x44cd('0x28'),_0x45477a])?_0x45477a:undefined;})['compact']()[_0x44cd('0x5d')]();if(!_[_0x44cd('0x6c')](_0x15672d)){_0x15672d[_0x44cd('0x2f')](function(_0x2e3bd8){if(_0x2e3bd8===_0x44cd('0x6d')){_0x3b6717[_0x44cd('0x3f')](_0x44cd('0x6e'),[][_0x44cd('0x6f')](_0x12b972[_0x44cd('0x35')][_0x2e3bd8]));}else if(_0x2e3bd8===_0x44cd('0x70')){var _0x3e08de=JSON[_0x44cd('0x71')](_0x12b972['query'][_0x2e3bd8])['$gte'];var _0x5251ec=JSON[_0x44cd('0x71')](_0x12b972[_0x44cd('0x35')][_0x2e3bd8])[_0x44cd('0x72')];_0x3b6717['where']('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x3e08de,_0x5251ec);}else{if(_0x12b972[_0x44cd('0x35')][_0x2e3bd8]===_0x44cd('0x73')){_0x3b6717[_0x44cd('0x3f')]('i.'+_0x2e3bd8+_0x44cd('0x74'));}else{_0x3b6717[_0x44cd('0x3f')]('i.'+_0x2e3bd8+'\x20=\x20?',_0x12b972[_0x44cd('0x35')][_0x2e3bd8]);}}});}if(_0x12b972[_0x44cd('0x35')][_0x44cd('0x75')]){if(_0x12b972[_0x44cd('0x35')][_0x44cd('0x75')]==0x1){_0x3b6717['having']('`unreadMessages`\x20=\x200');}else{_0x3b6717['having']('`unreadMessages`\x20>\x200');}}if(_0x12b972[_0x44cd('0x35')][_0x44cd('0x76')]){_0x41e836=_['isArray'](_0x12b972['query'][_0x44cd('0x76')])?_0x12b972[_0x44cd('0x35')][_0x44cd('0x76')]:new Array(_0x12b972['query']['tag']);_0x41e836[_0x44cd('0x2f')](function(_0x532d31){_0x2aa562['or'](_0x44cd('0x64'),'%,'+_0x532d31+',%');});}if(_0x12b972[_0x44cd('0x35')][_0x44cd('0x77')]){var _0x950a70=_0x12b972['query'][_0x44cd('0x77')][_0x44cd('0x78')]('\x5c','\x5c\x5c')[_0x44cd('0x78')](/'/g,'\x27\x27');if(qs[_0x44cd('0x79')](_0x950a70)){_0x1f9236['or'](_0x44cd('0x7a'),_0x950a70+'%')['or']('i.fax\x20LIKE\x20?',_0x950a70+'%');}_0x1f9236['or'](_0x44cd('0x7b'),_0x950a70+'%');}}_0x3b6717[_0x44cd('0x3f')](_0x1f9236);_0x3b6717[_0x44cd('0x7c')](_0x44cd('0x7d'));var _0x4affda={'type':db[_0x44cd('0x7e')]['QueryTypes'][_0x44cd('0x7f')],'raw':!![]};var _0x574cac=_0x3b6717[_0x44cd('0x80')]();_0x574cac[_0x44cd('0x42')](_0x44cd('0x7d'));_0x574cac[_0x44cd('0x42')](_0x44cd('0x81'),_0x44cd('0x57'));if(_0x27764e[_0x44cd('0x3d')]){_0x27764e[_0x44cd('0x3d')][_0x44cd('0x2f')](function(_0x3a7866){var _0x5b82ad=_0x3a7866[0x0]===_0x44cd('0x82')?_0x3a7866[0x0]:'i.'+_0x3a7866[0x0];_0x3b6717['order'](_0x5b82ad,_0x3a7866[0x1]==='DESC'?![]:!![]);});}if(!_['isEmpty'](_0x41e836)){_0x3b6717[_0x44cd('0x59')](_0x2aa562);_0x574cac['where'](_0x44cd('0x83'),_0x41e836);}BPromise[_0x44cd('0x84')]()[_0x44cd('0x24')](function(){if(!_0x2a83a9){if(_0x12b972[_0x44cd('0x35')][_0x44cd('0x6d')])return;_0x574cac[_0x44cd('0x3f')](_0x44cd('0x85'));_0x3b6717[_0x44cd('0x3f')](_0x44cd('0x85'));return;}if(_0x12b972[_0x44cd('0x86')][_0x44cd('0x87')]!==_0x44cd('0x88'))return;return _0x12b972[_0x44cd('0x86')][_0x44cd('0x89')]({'attributes':['id'],'raw':!![]})[_0x44cd('0x24')](function(_0x347fb2){if(_[_0x44cd('0x6c')](_0x347fb2)){_0x574cac[_0x44cd('0x3f')]('i.FaxAccountId\x20IS\x20NULL');_0x3b6717[_0x44cd('0x3f')](_0x44cd('0x8a'));}else{_0x574cac[_0x44cd('0x3f')](_0x44cd('0x6e'),_[_0x44cd('0x2b')](_0x347fb2,'id'));_0x3b6717['where']('i.FaxAccountId\x20IN\x20?',_[_0x44cd('0x2b')](_0x347fb2,'id'));}});})[_0x44cd('0x24')](function(){if(_0x12b972[_0x44cd('0x86')]['role']===_0x44cd('0x88')&&!_0x2a83a9&&!_0x12b972['query']['FaxAccountId'])return[];return db[_0x44cd('0x8b')][_0x44cd('0x35')](_0x574cac[_0x44cd('0x8c')](),_0x4affda);})[_0x44cd('0x24')](function(_0x27ea4a){_0x234363[_0x44cd('0x1e')]=_0x27ea4a[_0x44cd('0x3b')];if(_0x234363[_0x44cd('0x1e')]===0x0)return[];return db[_0x44cd('0x8b')][_0x44cd('0x35')](_0x49909a[_0x44cd('0x8c')](),_0x4affda)[_0x44cd('0x24')](function(_0x4da3f0){_0x10ee39=_[_0x44cd('0x8d')](_0x4da3f0,'id');_0x4affda=_[_0x44cd('0x8e')](_0x4affda,{'model':db['FaxInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x12b972[_0x44cd('0x35')][_0x44cd('0x3a')]){_0x27764e[_0x44cd('0x39')]['forEach'](function(_0x5700fd){_0x3b6717[_0x44cd('0x42')]('i.'+_0x5700fd);});}else{_0x3b6717['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x44cd('0x57'));_0x3b6717[_0x44cd('0x42')](_0x44cd('0x8f'),_0x44cd('0x90'));_0x3b6717[_0x44cd('0x42')](_0x44cd('0x91'),_0x44cd('0x92'));_0x3b6717[_0x44cd('0x42')](_0x44cd('0x93'),_0x44cd('0x82'));_0x3b6717[_0x44cd('0x42')]('i.*');_0x3b6717[_0x44cd('0x42')](_0x44cd('0x94'),'Contact.firstName');_0x3b6717[_0x44cd('0x42')](_0x44cd('0x95'),_0x44cd('0x96'));_0x3b6717['field'](_0x44cd('0x97'),_0x44cd('0x98'));_0x3b6717[_0x44cd('0x42')]('c.phone',_0x44cd('0x99'));_0x3b6717['field'](_0x44cd('0x9a'),'Contact.mobile');_0x3b6717['field'](_0x44cd('0x9b'),_0x44cd('0x9c'));_0x3b6717[_0x44cd('0x42')](_0x44cd('0x9d'),_0x44cd('0x9e'));_0x3b6717[_0x44cd('0x42')](_0x44cd('0x9f'),_0x44cd('0xa0'));_0x3b6717['field'](_0x44cd('0xa1'),_0x44cd('0x2d'));}if(_0x27764e[_0x44cd('0x1d')])_0x3b6717[_0x44cd('0x1d')](_0x27764e[_0x44cd('0x1d')]);if(_0x27764e['offset'])_0x3b6717[_0x44cd('0x1b')](_0x27764e['offset']);return db['sequelize'][_0x44cd('0x35')](_0x3b6717[_0x44cd('0x8c')](),_0x4affda);})['then'](function(_0x20749c){if(_0x20749c['length']>0x0)_0x513eb7['where'](_0x44cd('0xa2'),_[_0x44cd('0x2b')](_0x20749c,'id'));return db[_0x44cd('0x8b')][_0x44cd('0x35')](_0x513eb7['toString'](),_0x4affda)[_0x44cd('0x24')](function(_0x12981a){var _0x4ef0c0=_[_0x44cd('0xa3')](_0x12981a,_0x44cd('0xa4'));var _0x5b3699=[];_0x20749c[_0x44cd('0x2f')](function(_0x1b9155){_0x5b3699['push'](updateFaxInteraction(_0x1b9155,_0x10ee39,_0x4ef0c0));});return BPromise[_0x44cd('0xa5')](_0x5b3699);});});})[_0x44cd('0x24')](function(_0x4009d5){_0x234363[_0x44cd('0xa6')]=_0x4009d5;return _0x234363;})[_0x44cd('0x24')](respondWithFilteredResult(_0x86709f,_0x27764e))['catch'](handleError(_0x86709f,null));};exports['show']=function(_0x14f5ac,_0xa3ae01){var _0x54797c={'raw':![],'where':{'id':_0x14f5ac['params']['id']}},_0x38496c={};_0x38496c[_0x44cd('0x34')]=_[_0x44cd('0x36')](db[_0x44cd('0xa7')][_0x44cd('0x32')]);_0x38496c[_0x44cd('0x35')]=_[_0x44cd('0x36')](_0x14f5ac['query']);_0x38496c[_0x44cd('0x37')]=_[_0x44cd('0x38')](_0x38496c[_0x44cd('0x34')],_0x38496c[_0x44cd('0x35')]);_0x54797c[_0x44cd('0x39')]=_[_0x44cd('0x38')](_0x38496c[_0x44cd('0x34')],qs[_0x44cd('0x3a')](_0x14f5ac[_0x44cd('0x35')]['fields']));_0x54797c[_0x44cd('0x39')]=_0x54797c[_0x44cd('0x39')][_0x44cd('0x3b')]?_0x54797c[_0x44cd('0x39')]:_0x38496c[_0x44cd('0x34')];if(_0x14f5ac[_0x44cd('0x35')][_0x44cd('0xa8')]){_0x54797c[_0x44cd('0xa9')]=[{'all':!![]}];}_0x54797c=_[_0x44cd('0x8e')]({},_0x54797c,_0x14f5ac[_0x44cd('0xaa')]);return db[_0x44cd('0xa7')][_0x44cd('0x5f')](_0x54797c)['then'](handleEntityNotFound(_0xa3ae01,null))['then'](respondWithResult(_0xa3ae01,null))['catch'](handleError(_0xa3ae01,null));};exports[_0x44cd('0xab')]=function(_0x1d10b8,_0x4cb1e8){return db[_0x44cd('0xa7')][_0x44cd('0xab')](_0x1d10b8['body'],{})[_0x44cd('0x24')](respondWithResult(_0x4cb1e8,0xc9))[_0x44cd('0x30')](handleError(_0x4cb1e8,null));};exports['update']=function(_0x401920,_0x229895){if(_0x401920[_0x44cd('0x6a')]['id']){delete _0x401920[_0x44cd('0x6a')]['id'];}return db[_0x44cd('0xa7')]['find']({'where':{'id':_0x401920['params']['id']}})[_0x44cd('0x24')](handleEntityNotFound(_0x229895,null))['then'](saveUpdates(_0x401920[_0x44cd('0x6a')],null))[_0x44cd('0x24')](respondWithResult(_0x229895,null))['catch'](handleError(_0x229895,null));};exports['destroy']=function(_0x11ccee,_0x17f5c2){return db[_0x44cd('0xa7')][_0x44cd('0x5f')]({'where':{'id':_0x11ccee['params']['id']}})[_0x44cd('0x24')](handleEntityNotFound(_0x17f5c2,null))['then'](removeEntity(_0x17f5c2,null))[_0x44cd('0x30')](handleError(_0x17f5c2,null));};exports[_0x44cd('0xac')]=function(_0x481844,_0x283816){return db[_0x44cd('0xa7')][_0x44cd('0xac')]()[_0x44cd('0x24')](respondWithResult(_0x283816,null))[_0x44cd('0x30')](handleError(_0x283816,null));};exports[_0x44cd('0xad')]=function(_0x187c97,_0x3a9a77,_0x3d28e2){return db[_0x44cd('0xae')][_0x44cd('0x5f')]({'where':{'id':_0x187c97[_0x44cd('0xaf')]['id']}})[_0x44cd('0x24')](handleEntityNotFound(_0x3a9a77,null))[_0x44cd('0x24')](function(_0x383432){if(_0x383432){return _0x383432['addMessage'](_0x187c97[_0x44cd('0x6a')][_0x44cd('0xb0')],_[_0x44cd('0xb1')](_0x187c97[_0x44cd('0x6a')],[_0x44cd('0xb0'),'id'])||{});}})[_0x44cd('0x24')](respondWithResult(_0x3a9a77,null))[_0x44cd('0x30')](handleError(_0x3a9a77,null));};exports['getMessages']=function(_0x181218,_0x5ec4e5,_0xc6e0c){var _0x509eb0={'raw':![],'where':{}};var _0x450d4a={};var _0x288323={'count':0x0,'rows':[]};return db[_0x44cd('0xa7')]['findOne']({'where':{'id':_0x181218['params']['id']}})[_0x44cd('0x24')](handleEntityNotFound(_0x5ec4e5,null))[_0x44cd('0x24')](function(_0x198544){if(_0x198544){_0x450d4a[_0x44cd('0x34')]=_[_0x44cd('0x36')](db[_0x44cd('0xae')][_0x44cd('0x32')]);_0x450d4a[_0x44cd('0x35')]=_['keys'](_0x181218[_0x44cd('0x35')]);_0x450d4a[_0x44cd('0x37')]=_[_0x44cd('0x38')](_0x450d4a['model'],_0x450d4a['query']);_0x509eb0[_0x44cd('0x39')]=_[_0x44cd('0x38')](_0x450d4a[_0x44cd('0x34')],qs[_0x44cd('0x3a')](_0x181218[_0x44cd('0x35')][_0x44cd('0x3a')]));_0x509eb0[_0x44cd('0x39')]=_0x509eb0[_0x44cd('0x39')][_0x44cd('0x3b')]?_0x509eb0[_0x44cd('0x39')]:_0x450d4a[_0x44cd('0x34')];if(!_0x181218['query'][_0x44cd('0xb2')]('nolimit')){_0x509eb0[_0x44cd('0x1d')]=qs[_0x44cd('0x1d')](_0x181218[_0x44cd('0x35')]['limit']);_0x509eb0[_0x44cd('0x1b')]=qs['offset'](_0x181218['query']['offset']);}_0x509eb0[_0x44cd('0x3d')]=qs['sort'](_0x181218[_0x44cd('0x35')][_0x44cd('0x3e')]);_0x509eb0[_0x44cd('0x3f')]=qs[_0x44cd('0x37')](_['pick'](_0x181218[_0x44cd('0x35')],_0x450d4a[_0x44cd('0x37')]));_0x509eb0[_0x44cd('0x3f')][_0x44cd('0xa4')]=_0x198544['id'];if(_0x181218[_0x44cd('0x35')]['filter']){_0x509eb0[_0x44cd('0x3f')]=_[_0x44cd('0x8e')](_0x509eb0[_0x44cd('0x3f')],{'$or':_[_0x44cd('0x2b')](_0x509eb0[_0x44cd('0x39')],function(_0x4a25d0){var _0x2c12fb={};_0x2c12fb[_0x4a25d0]={'$like':'%'+_0x181218[_0x44cd('0x35')][_0x44cd('0x77')]+'%'};return _0x2c12fb;})});}if(_0x181218[_0x44cd('0x35')]['$gte']){var _0x123b0d=_0x181218[_0x44cd('0x35')][_0x44cd('0xb3')][_0x44cd('0x2e')](',');var _0x481ba1={};_0x481ba1[_0x123b0d[0x0]]={'$gte':moment(_0x123b0d[0x1])['format'](_0x44cd('0xb4'))};_0x509eb0[_0x44cd('0x3f')]=_[_0x44cd('0x8e')](_0x509eb0[_0x44cd('0x3f')],_0x481ba1);}_0x509eb0=_[_0x44cd('0x8e')]({},_0x509eb0,_0x181218[_0x44cd('0xaa')]);return db[_0x44cd('0xae')][_0x44cd('0x1e')]({'where':_0x509eb0[_0x44cd('0x3f')]})[_0x44cd('0x24')](function(_0xfc068d){_0x288323[_0x44cd('0x1e')]=_0xfc068d;if(_0x181218[_0x44cd('0x35')][_0x44cd('0xa8')]){_0x509eb0['include']=[{'all':!![]}];}return db[_0x44cd('0xae')][_0x44cd('0xb5')](_0x509eb0);})[_0x44cd('0x24')](function(_0x5a1d74){_0x288323[_0x44cd('0xa6')]=_0x5a1d74;return _0x288323;});}})[_0x44cd('0x24')](respondWithFilteredResult(_0x5ec4e5,_0x509eb0))[_0x44cd('0x30')](handleError(_0x5ec4e5,null));};exports['addTags']=function(_0x183879,_0x5b3373,_0x466fe4){return db[_0x44cd('0xa7')][_0x44cd('0x5f')]({'where':{'id':_0x183879[_0x44cd('0xaf')]['id']}})[_0x44cd('0x24')](handleEntityNotFound(_0x5b3373,null))[_0x44cd('0x24')](function(_0x40c403){if(_0x40c403){return _0x40c403['setTags'](_0x183879[_0x44cd('0x6a')][_0x44cd('0xb0')],_[_0x44cd('0xb1')](_0x183879[_0x44cd('0x6a')],[_0x44cd('0xb0'),'id'])||{})[_0x44cd('0xb6')](function(){return db[_0x44cd('0xb7')][_0x44cd('0xb5')]({'attributes':['id',_0x44cd('0x28'),_0x44cd('0x43')],'where':{'id':_0x183879['body'][_0x44cd('0xb0')]}});})[_0x44cd('0x24')](function(_0x370a78){socket['emit']('faxInteractionTags:save',{'id':Number(_0x183879[_0x44cd('0xaf')]['id']),'tags':_0x370a78||[]});return{'id':Number(_0x183879[_0x44cd('0xaf')]['id']),'tags':_0x370a78||[]};});}})['then'](respondWithResult(_0x5b3373,null))[_0x44cd('0x30')](handleError(_0x5b3373,null));};exports['removeTags']=function(_0x532c06,_0x2e99af,_0x30e097){return db[_0x44cd('0xa7')][_0x44cd('0x5f')]({'where':{'id':_0x532c06['params']['id']}})[_0x44cd('0x24')](handleEntityNotFound(_0x2e99af,null))['then'](function(_0x185d5e){if(_0x185d5e){return _0x185d5e[_0x44cd('0xb8')](_0x532c06[_0x44cd('0x35')][_0x44cd('0xb0')]);}})[_0x44cd('0x24')](respondWithStatusCode(_0x2e99af,null))[_0x44cd('0x30')](handleError(_0x2e99af,null));};exports['download']=function(_0x4e68de,_0x417cae){var _0x50c512=moment()['unix']()['toString']();var _0x5a602b=path['join'](config['root'],_0x44cd('0xb9'),_0x44cd('0xba'),_0x44cd('0xbb'));var _0x1af674=path[_0x44cd('0xbc')](config[_0x44cd('0xbd')],_0x44cd('0xb9'),_0x44cd('0xba'),_0x44cd('0xbe'));var _0x25fc30=path[_0x44cd('0xbc')](_0x5a602b,_0x50c512);var _0x1b5d05=util[_0x44cd('0xbf')](_0x44cd('0xc0'),_0x4e68de[_0x44cd('0xaf')]['id'],_0x50c512);var _0x5fd71e=path[_0x44cd('0xbc')](_0x5a602b,_0x1b5d05);var _0x373149=[];_0x373149[_0x44cd('0xc1')]({'model':db[_0x44cd('0xc2')],'as':_0x44cd('0xc2'),'raw':!![]});var _0x303e73=[{'model':db['FaxMessage'],'as':_0x44cd('0xc3'),'attributes':['id',_0x44cd('0x6a'),_0x44cd('0x70')],'include':_0x373149}];return db['FaxInteraction'][_0x44cd('0x5f')]({'where':{'id':_0x4e68de[_0x44cd('0xaf')]['id']},'include':_0x303e73})['then'](handleEntityNotFound(_0x417cae,null))[_0x44cd('0x24')](function(_0x3a5262){if(_0x3a5262&&_0x3a5262[_0x44cd('0xc3')]){var _0x22f373=_0x3a5262[_0x44cd('0xc4')]({'plain':!![]});fs[_0x44cd('0xc5')](_0x25fc30);for(var _0x53f563=0x0;_0x53f563<_0x22f373[_0x44cd('0xc3')][_0x44cd('0x3b')];_0x53f563++){var _0x4131f1=_0x22f373[_0x44cd('0xc3')][_0x53f563]['Attachment'];if(_0x4131f1){var _0x4d48ee=path['join'](_0x1af674,_0x4131f1['basename']);if(fs[_0x44cd('0xc6')](_0x4d48ee)){fs[_0x44cd('0xc7')](_0x4d48ee)[_0x44cd('0xc8')](fs[_0x44cd('0xc9')](path[_0x44cd('0xbc')](_0x25fc30,_0x4131f1[_0x44cd('0xca')])));}}}return BPromise[_0x44cd('0x84')]()['then'](function(){return new BPromise(function(_0x206e44,_0x164aac){zipdir(_0x25fc30,{'saveTo':_0x5fd71e},function(_0x3a9520,_0x4cb48d){if(_0x3a9520)return _0x164aac(_0x3a9520);return _0x206e44(_0x4cb48d);});})['then'](function(){return new BPromise(function(_0x40e718,_0x324bb1){rimraf(_0x25fc30,function(_0x59ab5b){if(_0x59ab5b)_0x324bb1(_0x59ab5b);return _0x40e718();});});})[_0x44cd('0x24')](function(){return _0x417cae['download'](_0x5fd71e,_0x1b5d05,function(_0x2930fc){if(_0x2930fc){console[_0x44cd('0xcb')](_0x44cd('0xcc'),_0x2930fc);}else{fs[_0x44cd('0xcd')](_0x5fd71e);}});});});}else{return _0x417cae[_0x44cd('0x18')](0xc8);}})[_0x44cd('0x30')](handleError(_0x417cae,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index bb4f57b..413f36c 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 _0x1524=['map','setDataValue','unreadMessages','length','emit','catch','hasOwnProperty','exports','events','../../mysqldb','FaxInteraction','setMaxListeners','save','update','remove','getUsers','then','Users'];(function(_0x1a7846,_0x59723e){var _0x48049=function(_0x203ff6){while(--_0x203ff6){_0x1a7846['push'](_0x1a7846['shift']());}};_0x48049(++_0x59723e);}(_0x1524,0x170));var _0x4152=function(_0x58a975,_0x4f7451){_0x58a975=_0x58a975-0x0;var _0x47f055=_0x1524[_0x58a975];return _0x47f055;};'use strict';var EventEmitter=require(_0x4152('0x0'));var FaxInteraction=require(_0x4152('0x1'))['db'][_0x4152('0x2')];var FaxMessage=require('../../mysqldb')['db']['FaxMessage'];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x4152('0x3')](0x0);var events={'afterCreate':_0x4152('0x4'),'afterUpdate':_0x4152('0x5'),'afterDestroy':_0x4152('0x6')};function emitEvent(_0x33fa34){return function(_0x5e0a90,_0x2f8d0d,_0x1e7e95){_0x5e0a90[_0x4152('0x7')]({'attributes':['id'],'raw':!![]})[_0x4152('0x8')](function(_0x2467ad){_0x5e0a90['setDataValue'](_0x4152('0x9'),_0x2467ad[_0x4152('0xa')](function(_0x22b93c){return{'id':_0x22b93c['id']};}));return FaxMessage['findAll']({'where':{'FaxInteractionId':_0x5e0a90['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x341916){_0x5e0a90[_0x4152('0xb')](_0x4152('0xc'),_0x341916[_0x4152('0xd')]);FaxInteractionEvents['emit'](_0x33fa34+':'+_0x5e0a90['id'],_0x5e0a90);FaxInteractionEvents[_0x4152('0xe')](_0x33fa34,_0x5e0a90);_0x1e7e95(null);})[_0x4152('0xf')](_0x1e7e95(null));};}for(var e in events){if(events[_0x4152('0x10')](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module[_0x4152('0x11')]=FaxInteractionEvents; \ No newline at end of file +var _0x3677=['map','findAll','then','setDataValue','length','emit','hasOwnProperty','exports','setMaxListeners','update','getUsers','Users'];(function(_0x1a8c3d,_0x300c78){var _0x256c7d=function(_0x4f06b3){while(--_0x4f06b3){_0x1a8c3d['push'](_0x1a8c3d['shift']());}};_0x256c7d(++_0x300c78);}(_0x3677,0x140));var _0x7367=function(_0x152ffe,_0x7e95d){_0x152ffe=_0x152ffe-0x0;var _0x35324c=_0x3677[_0x152ffe];return _0x35324c;};'use strict';var EventEmitter=require('events');var FaxInteraction=require('../../mysqldb')['db']['FaxInteraction'];var FaxMessage=require('../../mysqldb')['db']['FaxMessage'];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x7367('0x0')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7367('0x1'),'afterDestroy':'remove'};function emitEvent(_0x1f7cdb){return function(_0x27be9c,_0x42a7ee,_0x5ed811){_0x27be9c[_0x7367('0x2')]({'attributes':['id'],'raw':!![]})['then'](function(_0x2841ca){_0x27be9c['setDataValue'](_0x7367('0x3'),_0x2841ca[_0x7367('0x4')](function(_0x4612d2){return{'id':_0x4612d2['id']};}));return FaxMessage[_0x7367('0x5')]({'where':{'FaxInteractionId':_0x27be9c['id'],'direction':'in','read':![]},'raw':!![]});})[_0x7367('0x6')](function(_0x2d3ba5){_0x27be9c[_0x7367('0x7')]('unreadMessages',_0x2d3ba5[_0x7367('0x8')]);FaxInteractionEvents[_0x7367('0x9')](_0x1f7cdb+':'+_0x27be9c['id'],_0x27be9c);FaxInteractionEvents['emit'](_0x1f7cdb,_0x27be9c);_0x5ed811(null);})['catch'](_0x5ed811(null));};}for(var e in events){if(events[_0x7367('0xa')](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module[_0x7367('0xb')]=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index 62c5a01..f6770d8 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 _0x3f21=['api','bluebird','request-promise','path','rimraf','../../config/environment','./faxInteraction.attributes','exports','define','FaxInteraction','fax_interactions','changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger'];(function(_0x2feee8,_0x3df2e9){var _0x5d817a=function(_0x1854d4){while(--_0x1854d4){_0x2feee8['push'](_0x2feee8['shift']());}};_0x5d817a(++_0x3df2e9);}(_0x3f21,0x7b));var _0x13f2=function(_0x12ecaf,_0x49b6e3){_0x12ecaf=_0x12ecaf-0x0;var _0x514eae=_0x3f21[_0x12ecaf];return _0x514eae;};'use strict';var _=require(_0x13f2('0x0'));var util=require(_0x13f2('0x1'));var logger=require(_0x13f2('0x2'))(_0x13f2('0x3'));var moment=require('moment');var BPromise=require(_0x13f2('0x4'));var rp=require(_0x13f2('0x5'));var fs=require('fs');var path=require(_0x13f2('0x6'));var rimraf=require(_0x13f2('0x7'));var config=require(_0x13f2('0x8'));var attributes=require(_0x13f2('0x9'));module[_0x13f2('0xa')]=function(_0x46ff0e,_0x7bc7a5){return _0x46ff0e[_0x13f2('0xb')](_0x13f2('0xc'),attributes,{'tableName':_0x13f2('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xd5d871,_0x548bef,_0x5301d2){if(_0xd5d871[_0x13f2('0xe')](_0x13f2('0xf'))){_0xd5d871[_0x13f2('0x10')]=moment()['format'](_0x13f2('0x11'));}_0x5301d2(null,_0xd5d871);}}});}; \ No newline at end of file +var _0x0da2=['./faxInteraction.attributes','define','fax_interactions','changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x2bf466,_0x4929a5){var _0x856885=function(_0x102ef1){while(--_0x102ef1){_0x2bf466['push'](_0x2bf466['shift']());}};_0x856885(++_0x4929a5);}(_0x0da2,0x107));var _0x20da=function(_0xe97c7f,_0xc4747a){_0xe97c7f=_0xe97c7f-0x0;var _0x478a61=_0x0da2[_0xe97c7f];return _0x478a61;};'use strict';var _=require(_0x20da('0x0'));var util=require('util');var logger=require(_0x20da('0x1'))(_0x20da('0x2'));var moment=require(_0x20da('0x3'));var BPromise=require(_0x20da('0x4'));var rp=require(_0x20da('0x5'));var fs=require('fs');var path=require(_0x20da('0x6'));var rimraf=require(_0x20da('0x7'));var config=require(_0x20da('0x8'));var attributes=require(_0x20da('0x9'));module['exports']=function(_0x2714ba,_0x517598){return _0x2714ba[_0x20da('0xa')]('FaxInteraction',attributes,{'tableName':_0x20da('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2b7ff6,_0x552102,_0xc7f117){if(_0x2b7ff6[_0x20da('0xc')](_0x20da('0xd'))){_0x2b7ff6[_0x20da('0xe')]=moment()['format'](_0x20da('0xf'));}_0xc7f117(null,_0x2b7ff6);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index 0601ac2..151f7d1 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 _0xd882=['then','info','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxInteraction,\x20%s,\x20%s','message','result','UpdateFaxInteraction','FaxInteraction','update','options','raw','where','attributes','limit','catch','AddTagsToFaxInteraction','find','addTags','ids','omit','body','AddTags','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','localhost','socket.io-emitter','./faxInteraction.socket','request'];(function(_0x5a776b,_0x46f785){var _0xbbef59=function(_0x38313e){while(--_0x38313e){_0x5a776b['push'](_0x5a776b['shift']());}};_0xbbef59(++_0x46f785);}(_0xd882,0x9f));var _0x2d88=function(_0x378a07,_0x26dbbe){_0x378a07=_0x378a07-0x0;var _0x1013e7=_0xd882[_0x378a07];return _0x1013e7;};'use strict';var _=require(_0x2d88('0x0'));var util=require('util');var moment=require(_0x2d88('0x1'));var BPromise=require(_0x2d88('0x2'));var rs=require(_0x2d88('0x3'));var fs=require('fs');var Redis=require(_0x2d88('0x4'));var db=require(_0x2d88('0x5'))['db'];var utils=require(_0x2d88('0x6'));var logger=require(_0x2d88('0x7'))(_0x2d88('0x8'));var config=require('../../config/environment');var jayson=require(_0x2d88('0x9'));var client=jayson[_0x2d88('0xa')][_0x2d88('0xb')]({'port':0x232a});config[_0x2d88('0xc')]=_['defaults'](config[_0x2d88('0xc')],{'host':_0x2d88('0xd'),'port':0x18eb});var socket=require(_0x2d88('0xe'))(new Redis(config[_0x2d88('0xc')]));require(_0x2d88('0xf'))['register'](socket);function respondWithRpcPromise(_0x53461c,_0x2a0a67,_0x114b97){return new BPromise(function(_0x1ea09d,_0x1e1303){return client[_0x2d88('0x10')](_0x53461c,_0x114b97)[_0x2d88('0x11')](function(_0x478306){logger[_0x2d88('0x12')]('FaxInteraction,\x20%s,\x20%s',_0x2a0a67,_0x2d88('0x13'));logger[_0x2d88('0x14')](_0x2d88('0x15'),_0x2a0a67,_0x2d88('0x13'),JSON[_0x2d88('0x16')](_0x478306));if(_0x478306[_0x2d88('0x17')]){if(_0x478306[_0x2d88('0x17')][_0x2d88('0x18')]===0x1f4){logger[_0x2d88('0x17')](_0x2d88('0x19'),_0x2a0a67,_0x478306[_0x2d88('0x17')][_0x2d88('0x1a')]);return _0x1e1303(_0x478306[_0x2d88('0x17')][_0x2d88('0x1a')]);}logger['error']('FaxInteraction,\x20%s,\x20%s',_0x2a0a67,_0x478306[_0x2d88('0x17')][_0x2d88('0x1a')]);return _0x1ea09d(_0x478306[_0x2d88('0x17')]['message']);}else{logger[_0x2d88('0x12')](_0x2d88('0x19'),_0x2a0a67,_0x2d88('0x13'));_0x1ea09d(_0x478306[_0x2d88('0x1b')][_0x2d88('0x1a')]);}})['catch'](function(_0x30f83f){logger[_0x2d88('0x17')](_0x2d88('0x19'),_0x2a0a67,_0x30f83f);_0x1e1303(_0x30f83f);});});}exports[_0x2d88('0x1c')]=function(_0x1841b0){var _0x3313fe=this;return new Promise(function(_0x4a26ac,_0xe70324){return db[_0x2d88('0x1d')][_0x2d88('0x1e')](_0x1841b0['body'],{'raw':_0x1841b0['options']?_0x1841b0[_0x2d88('0x1f')][_0x2d88('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1841b0['options']?_0x1841b0[_0x2d88('0x1f')][_0x2d88('0x21')]||null:null,'attributes':_0x1841b0[_0x2d88('0x1f')]?_0x1841b0[_0x2d88('0x1f')][_0x2d88('0x22')]||null:null,'limit':_0x1841b0[_0x2d88('0x1f')]?_0x1841b0['options'][_0x2d88('0x23')]||null:null})[_0x2d88('0x11')](function(_0x3a19ac){logger[_0x2d88('0x12')]('UpdateFaxInteraction',_0x1841b0);logger['debug']('UpdateFaxInteraction',_0x1841b0,JSON[_0x2d88('0x16')](_0x3a19ac));_0x4a26ac(_0x3a19ac);})[_0x2d88('0x24')](function(_0x10b01e){logger[_0x2d88('0x17')](_0x2d88('0x1c'),_0x10b01e[_0x2d88('0x1a')],_0x1841b0);_0xe70324(_0x3313fe[_0x2d88('0x17')](0x1f4,_0x10b01e['message']));});});};exports[_0x2d88('0x25')]=function(_0x462210){return new Promise(function(_0x658256,_0x4d138c){return db[_0x2d88('0x1d')][_0x2d88('0x26')]({'where':_0x462210[_0x2d88('0x1f')]?_0x462210['options']['where']||null:null})[_0x2d88('0x11')](function(_0x55bb5d){if(_0x55bb5d){return _0x55bb5d[_0x2d88('0x27')](_0x462210['body'][_0x2d88('0x28')],_[_0x2d88('0x29')](_0x462210[_0x2d88('0x2a')],[_0x2d88('0x28'),'id'])||{});}})['spread'](function(_0x8324b2){logger['info'](_0x2d88('0x2b'),_0x462210);logger[_0x2d88('0x14')](_0x2d88('0x2b'),_0x462210,JSON['stringify'](_0x8324b2));_0x658256(_0x8324b2);})[_0x2d88('0x24')](function(_0x270754){logger[_0x2d88('0x17')](_0x2d88('0x2b'),_0x270754[_0x2d88('0x1a')],_0x462210);_0x4d138c(_this[_0x2d88('0x17')](0x1f4,_0x270754['message']));});});}; \ No newline at end of file +var _0xbd2d=['limit','AddTagsToFaxInteraction','find','where','ids','omit','spread','AddTags','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','socket.io-emitter','./faxInteraction.socket','request','then','info','FaxInteraction,\x20%s,\x20%s','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','UpdateFaxInteraction','FaxInteraction','update','body','options','raw'];(function(_0x56d8df,_0x28c6f2){var _0x51cfa0=function(_0x1625f4){while(--_0x1625f4){_0x56d8df['push'](_0x56d8df['shift']());}};_0x51cfa0(++_0x28c6f2);}(_0xbd2d,0x150));var _0xdbd2=function(_0x4c05ff,_0x90c390){_0x4c05ff=_0x4c05ff-0x0;var _0x37ec71=_0xbd2d[_0x4c05ff];return _0x37ec71;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xdbd2('0x0'));var BPromise=require(_0xdbd2('0x1'));var rs=require(_0xdbd2('0x2'));var fs=require('fs');var Redis=require(_0xdbd2('0x3'));var db=require(_0xdbd2('0x4'))['db'];var utils=require(_0xdbd2('0x5'));var logger=require(_0xdbd2('0x6'))(_0xdbd2('0x7'));var config=require('../../config/environment');var jayson=require(_0xdbd2('0x8'));var client=jayson[_0xdbd2('0x9')][_0xdbd2('0xa')]({'port':0x232a});config[_0xdbd2('0xb')]=_['defaults'](config[_0xdbd2('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xdbd2('0xc'))(new Redis(config[_0xdbd2('0xb')]));require(_0xdbd2('0xd'))['register'](socket);function respondWithRpcPromise(_0x558600,_0x199ef5,_0x4b03cd){return new BPromise(function(_0x52d074,_0x27c51f){return client[_0xdbd2('0xe')](_0x558600,_0x4b03cd)[_0xdbd2('0xf')](function(_0x52f99d){logger[_0xdbd2('0x10')](_0xdbd2('0x11'),_0x199ef5,'request\x20sent');logger[_0xdbd2('0x12')](_0xdbd2('0x13'),_0x199ef5,_0xdbd2('0x14'),JSON[_0xdbd2('0x15')](_0x52f99d));if(_0x52f99d[_0xdbd2('0x16')]){if(_0x52f99d['error'][_0xdbd2('0x17')]===0x1f4){logger[_0xdbd2('0x16')](_0xdbd2('0x11'),_0x199ef5,_0x52f99d[_0xdbd2('0x16')][_0xdbd2('0x18')]);return _0x27c51f(_0x52f99d[_0xdbd2('0x16')][_0xdbd2('0x18')]);}logger['error']('FaxInteraction,\x20%s,\x20%s',_0x199ef5,_0x52f99d['error'][_0xdbd2('0x18')]);return _0x52d074(_0x52f99d['error']['message']);}else{logger[_0xdbd2('0x10')](_0xdbd2('0x11'),_0x199ef5,'request\x20sent');_0x52d074(_0x52f99d[_0xdbd2('0x19')][_0xdbd2('0x18')]);}})[_0xdbd2('0x1a')](function(_0x333c54){logger[_0xdbd2('0x16')](_0xdbd2('0x11'),_0x199ef5,_0x333c54);_0x27c51f(_0x333c54);});});}exports[_0xdbd2('0x1b')]=function(_0x45634d){var _0x5cf8d0=this;return new Promise(function(_0x1dafa2,_0x245a56){return db[_0xdbd2('0x1c')][_0xdbd2('0x1d')](_0x45634d[_0xdbd2('0x1e')],{'raw':_0x45634d[_0xdbd2('0x1f')]?_0x45634d[_0xdbd2('0x1f')][_0xdbd2('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x45634d[_0xdbd2('0x1f')]?_0x45634d[_0xdbd2('0x1f')]['where']||null:null,'attributes':_0x45634d[_0xdbd2('0x1f')]?_0x45634d[_0xdbd2('0x1f')]['attributes']||null:null,'limit':_0x45634d[_0xdbd2('0x1f')]?_0x45634d[_0xdbd2('0x1f')][_0xdbd2('0x21')]||null:null})['then'](function(_0x1691fc){logger[_0xdbd2('0x10')](_0xdbd2('0x1b'),_0x45634d);logger['debug']('UpdateFaxInteraction',_0x45634d,JSON[_0xdbd2('0x15')](_0x1691fc));_0x1dafa2(_0x1691fc);})['catch'](function(_0x1719e2){logger[_0xdbd2('0x16')](_0xdbd2('0x1b'),_0x1719e2[_0xdbd2('0x18')],_0x45634d);_0x245a56(_0x5cf8d0[_0xdbd2('0x16')](0x1f4,_0x1719e2[_0xdbd2('0x18')]));});});};exports[_0xdbd2('0x22')]=function(_0xb873a1){return new Promise(function(_0x3ee70b,_0xf37ef2){return db['FaxInteraction'][_0xdbd2('0x23')]({'where':_0xb873a1[_0xdbd2('0x1f')]?_0xb873a1[_0xdbd2('0x1f')][_0xdbd2('0x24')]||null:null})['then'](function(_0x37a5da){if(_0x37a5da){return _0x37a5da['addTags'](_0xb873a1[_0xdbd2('0x1e')][_0xdbd2('0x25')],_[_0xdbd2('0x26')](_0xb873a1[_0xdbd2('0x1e')],['ids','id'])||{});}})[_0xdbd2('0x27')](function(_0x557f5a){logger[_0xdbd2('0x10')]('AddTags',_0xb873a1);logger[_0xdbd2('0x12')](_0xdbd2('0x28'),_0xb873a1,JSON['stringify'](_0x557f5a));_0x3ee70b(_0x557f5a);})[_0xdbd2('0x1a')](function(_0x286f01){logger[_0xdbd2('0x16')](_0xdbd2('0x28'),_0x286f01[_0xdbd2('0x18')],_0xb873a1);_0xf37ef2(_this[_0xdbd2('0x16')](0x1f4,_0x286f01[_0xdbd2('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index fd733dc..fe67160 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 _0x7d1a=['remove','emit','register','length','faxInteraction:','./faxInteraction.events','save'];(function(_0x4c440b,_0x3ea627){var _0x2d48cf=function(_0x56bac7){while(--_0x56bac7){_0x4c440b['push'](_0x4c440b['shift']());}};_0x2d48cf(++_0x3ea627);}(_0x7d1a,0x91));var _0xa7d1=function(_0x404a04,_0x49b4b1){_0x404a04=_0x404a04-0x0;var _0x4efab8=_0x7d1a[_0x404a04];return _0x4efab8;};'use strict';var FaxInteractionEvents=require(_0xa7d1('0x0'));var events=[_0xa7d1('0x1'),_0xa7d1('0x2'),'update'];function createListener(_0x6b64ec,_0x5b38ca){return function(_0x5f5967){_0x5b38ca[_0xa7d1('0x3')](_0x6b64ec,_0x5f5967);};}function removeListener(_0x14c791,_0x3d891a){return function(){FaxInteractionEvents['removeListener'](_0x14c791,_0x3d891a);};}exports[_0xa7d1('0x4')]=function(_0xbde5c1){for(var _0x124afd=0x0,_0x2aa7ae=events[_0xa7d1('0x5')];_0x124afd<_0x2aa7ae;_0x124afd++){var _0x428021=events[_0x124afd];var _0x50c679=createListener(_0xa7d1('0x6')+_0x428021,_0xbde5c1);FaxInteractionEvents['on'](_0x428021,_0x50c679);}}; \ No newline at end of file +var _0xe740=['register','faxInteraction:','remove','emit','removeListener'];(function(_0x23ca4d,_0x5c2a32){var _0x435432=function(_0xe1a5e5){while(--_0xe1a5e5){_0x23ca4d['push'](_0x23ca4d['shift']());}};_0x435432(++_0x5c2a32);}(_0xe740,0x16f));var _0x0e74=function(_0x5d4607,_0x6b5e7b){_0x5d4607=_0x5d4607-0x0;var _0x5e4a86=_0xe740[_0x5d4607];return _0x5e4a86;};'use strict';var FaxInteractionEvents=require('./faxInteraction.events');var events=['save',_0x0e74('0x0'),'update'];function createListener(_0x5b3d39,_0x341ec4){return function(_0x3e28ca){_0x341ec4[_0x0e74('0x1')](_0x5b3d39,_0x3e28ca);};}function removeListener(_0x54c4f2,_0x1870e4){return function(){FaxInteractionEvents[_0x0e74('0x2')](_0x54c4f2,_0x1870e4);};}exports[_0x0e74('0x3')]=function(_0x150de2){for(var _0x4d286b=0x0,_0x14e308=events['length'];_0x4d286b<_0x14e308;_0x4d286b++){var _0x33bdb4=events[_0x4d286b];var _0x511079=createListener(_0x0e74('0x4')+_0x33bdb4,_0x150de2);FaxInteractionEvents['on'](_0x33bdb4,_0x511079);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index e9bad08..d1d7bba 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 _0x2b18=['getMessages','/:id/download','download','post','create','addMessage','tracked','fax','faxinteraction:addtags','addTags','put','faxinteraction:update','update','delete','removeTags','exports','multer','util','path','Router','../../config/environment','get','/describe','isAuthenticated','/:id','show','/:id/messages'];(function(_0x4f497a,_0x1d4835){var _0x5b738e=function(_0xe0ca3b){while(--_0xe0ca3b){_0x4f497a['push'](_0x4f497a['shift']());}};_0x5b738e(++_0x1d4835);}(_0x2b18,0x11e));var _0x82b1=function(_0x1518ca,_0x548df7){_0x1518ca=_0x1518ca-0x0;var _0x4fa136=_0x2b18[_0x1518ca];return _0x4fa136;};'use strict';var multer=require(_0x82b1('0x0'));var util=require(_0x82b1('0x1'));var path=require(_0x82b1('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x82b1('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x82b1('0x4'));var controller=require('./faxInteraction.controller');router[_0x82b1('0x5')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x82b1('0x6'),auth[_0x82b1('0x7')](),controller['describe']);router[_0x82b1('0x5')](_0x82b1('0x8'),auth[_0x82b1('0x7')](),controller[_0x82b1('0x9')]);router[_0x82b1('0x5')](_0x82b1('0xa'),auth[_0x82b1('0x7')](),controller[_0x82b1('0xb')]);router[_0x82b1('0x5')](_0x82b1('0xc'),auth[_0x82b1('0x7')](),controller[_0x82b1('0xd')]);router[_0x82b1('0xe')]('/',auth[_0x82b1('0x7')](),controller[_0x82b1('0xf')]);router['post'](_0x82b1('0xa'),auth[_0x82b1('0x7')](),controller[_0x82b1('0x10')]);router['post']('/:id/tags',auth[_0x82b1('0x7')](),interaction[_0x82b1('0x11')](_0x82b1('0x12'),_0x82b1('0x13')),controller[_0x82b1('0x14')]);router[_0x82b1('0x15')]('/:id',auth[_0x82b1('0x7')](),interaction[_0x82b1('0x11')](_0x82b1('0x12'),_0x82b1('0x16')),controller[_0x82b1('0x17')]);router[_0x82b1('0x18')](_0x82b1('0x8'),auth[_0x82b1('0x7')](),interaction['tracked']('fax','faxinteraction:destroy'),controller['destroy']);router[_0x82b1('0x18')]('/:id/tags',auth[_0x82b1('0x7')](),controller[_0x82b1('0x19')]);module[_0x82b1('0x1a')]=router; \ No newline at end of file +var _0xcff4=['post','create','tracked','fax','faxinteraction:addtags','addTags','put','faxinteraction:update','update','destroy','delete','removeTags','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./faxInteraction.controller','get','isAuthenticated','index','describe','/:id','show','/:id/messages','getMessages','/:id/download','download'];(function(_0x269946,_0x47fe24){var _0x198bca=function(_0x5b39ee){while(--_0x5b39ee){_0x269946['push'](_0x269946['shift']());}};_0x198bca(++_0x47fe24);}(_0xcff4,0x6d));var _0x4cff=function(_0xa4bcbb,_0x29d4e7){_0xa4bcbb=_0xa4bcbb-0x0;var _0x38d69a=_0xcff4[_0xa4bcbb];return _0x38d69a;};'use strict';var multer=require(_0x4cff('0x0'));var util=require(_0x4cff('0x1'));var path=require(_0x4cff('0x2'));var timeout=require(_0x4cff('0x3'));var express=require(_0x4cff('0x4'));var router=express[_0x4cff('0x5')]();var fs_extra=require(_0x4cff('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x4cff('0x7'));var controller=require(_0x4cff('0x8'));router[_0x4cff('0x9')]('/',auth[_0x4cff('0xa')](),controller[_0x4cff('0xb')]);router[_0x4cff('0x9')]('/describe',auth[_0x4cff('0xa')](),controller[_0x4cff('0xc')]);router[_0x4cff('0x9')](_0x4cff('0xd'),auth[_0x4cff('0xa')](),controller[_0x4cff('0xe')]);router[_0x4cff('0x9')](_0x4cff('0xf'),auth[_0x4cff('0xa')](),controller[_0x4cff('0x10')]);router['get'](_0x4cff('0x11'),auth[_0x4cff('0xa')](),controller[_0x4cff('0x12')]);router[_0x4cff('0x13')]('/',auth['isAuthenticated'](),controller[_0x4cff('0x14')]);router['post'](_0x4cff('0xf'),auth[_0x4cff('0xa')](),controller['addMessage']);router['post']('/:id/tags',auth[_0x4cff('0xa')](),interaction[_0x4cff('0x15')](_0x4cff('0x16'),_0x4cff('0x17')),controller[_0x4cff('0x18')]);router[_0x4cff('0x19')]('/:id',auth[_0x4cff('0xa')](),interaction[_0x4cff('0x15')](_0x4cff('0x16'),_0x4cff('0x1a')),controller[_0x4cff('0x1b')]);router['delete'](_0x4cff('0xd'),auth[_0x4cff('0xa')](),interaction[_0x4cff('0x15')](_0x4cff('0x16'),'faxinteraction:destroy'),controller[_0x4cff('0x1c')]);router[_0x4cff('0x1d')]('/:id/tags',auth['isAuthenticated'](),controller[_0x4cff('0x1e')]);module[_0x4cff('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 7baa57d..71ccae5 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 _0xe630=['DATE','sequelize','exports','medium','BOOLEAN','ENUM','out','TEXT'];(function(_0x1a36a5,_0x746928){var _0x746243=function(_0x481966){while(--_0x481966){_0x1a36a5['push'](_0x1a36a5['shift']());}};_0x746243(++_0x746928);}(_0xe630,0x149));var _0x0e63=function(_0x530ec8,_0x3b402d){_0x530ec8=_0x530ec8-0x0;var _0xdd83a5=_0xe630[_0x530ec8];return _0xdd83a5;};'use strict';var Sequelize=require(_0x0e63('0x0'));module[_0x0e63('0x1')]={'body':{'type':Sequelize['TEXT'](_0x0e63('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x0e63('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x0e63('0x4')]('in','out'),'defaultValue':_0x0e63('0x5'),'allowNull':![]},'failMessage':{'type':Sequelize[_0x0e63('0x6')],'defaultValue':null},'readAt':{'type':Sequelize[_0x0e63('0x7')]}}; \ No newline at end of file +var _0xc73e=['BOOLEAN','TEXT','DATE','sequelize','exports','medium'];(function(_0x802997,_0x5534a2){var _0x35c641=function(_0x22c4f2){while(--_0x22c4f2){_0x802997['push'](_0x802997['shift']());}};_0x35c641(++_0x5534a2);}(_0xc73e,0x1e9));var _0xec73=function(_0x3a2f1f,_0x334cc5){_0x3a2f1f=_0x3a2f1f-0x0;var _0x55824a=_0xc73e[_0x3a2f1f];return _0x55824a;};'use strict';var Sequelize=require(_0xec73('0x0'));module[_0xec73('0x1')]={'body':{'type':Sequelize['TEXT'](_0xec73('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xec73('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'out','allowNull':![]},'failMessage':{'type':Sequelize[_0xec73('0x4')],'defaultValue':null},'readAt':{'type':Sequelize[_0xec73('0x5')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index e509632..63a0706 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 _0x11d5=['debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','FaxMessage,\x20%s,\x20%s','request\x20sent','result','catch','sendStatus','status','end','json','offset','limit','count','set','Content-Range','reject','save','update','destroy','stack','name','index','map','FaxMessage','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','find','body','describe','accept','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','CmContact','get','FaxInteraction','FaxInteractionId','read1stAt','format','interaction','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','acceptMessage','startsWith','cf_','push','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','manual','interface','channel','event','EventManager','acceptmessage','../../config/logger','fax-interactions','fax','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','rejectMessage','SIP/%s','rejectmessage','create','isNil','findOne','AttachmentId','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','download','join','root','server','files','Attachment','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../mysqldb','defaults','redis','./faxMessage.socket','jayson/promise','client','http','request','then','info'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x11d5,0x102));var _0x511d=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x11d5[_0x501510];return _0x1e6ee5;};'use strict';var emlformat=require(_0x511d('0x0'));var rimraf=require(_0x511d('0x1'));var zipdir=require(_0x511d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x511d('0x3'));var moment=require(_0x511d('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x511d('0x5'));var util=require(_0x511d('0x6'));var path=require(_0x511d('0x7'));var sox=require(_0x511d('0x8'));var csv=require('to-csv');var ejs=require(_0x511d('0x9'));var fs=require('fs');var fs_extra=require(_0x511d('0xa'));var _=require(_0x511d('0xb'));var squel=require('squel');var crypto=require(_0x511d('0xc'));var jsforce=require(_0x511d('0xd'));var deskjs=require(_0x511d('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x511d('0xf'));var authService=require(_0x511d('0x10'));var qs=require(_0x511d('0x11'));var as=require(_0x511d('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x511d('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x511d('0x14'))['db'];config['redis']=_[_0x511d('0x15')](config[_0x511d('0x16')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x511d('0x16')]));require(_0x511d('0x17'))['register'](socket);var jayson=require(_0x511d('0x18'));var client=jayson[_0x511d('0x19')][_0x511d('0x1a')]({'port':0x232c});var client9002=jayson[_0x511d('0x19')][_0x511d('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x664a6a,_0x1a272a,_0x1c5676,_0x31f7c1){return new BPromise(function(_0x4a6670,_0x578b9a){var _0x41a608=_0x31f7c1||client;return _0x41a608[_0x511d('0x1b')](_0x664a6a,_0x1c5676)[_0x511d('0x1c')](function(_0x1ab8c6){logger[_0x511d('0x1d')]('FaxMessage,\x20%s,\x20%s',_0x1a272a,'request\x20sent');logger[_0x511d('0x1e')](_0x511d('0x1f'),_0x1a272a,'request\x20sent',JSON[_0x511d('0x20')](_0x1ab8c6));if(_0x1ab8c6[_0x511d('0x21')]){if(_0x1ab8c6['error'][_0x511d('0x22')]===0x1f4){logger[_0x511d('0x21')]('FaxMessage,\x20%s,\x20%s',_0x1a272a,_0x1ab8c6[_0x511d('0x21')][_0x511d('0x23')]);return _0x578b9a(_0x1ab8c6['error']['message']);}logger[_0x511d('0x21')](_0x511d('0x24'),_0x1a272a,_0x1ab8c6[_0x511d('0x21')]['message']);return _0x4a6670(_0x1ab8c6['error'][_0x511d('0x23')]);}else{logger[_0x511d('0x1d')](_0x511d('0x24'),_0x1a272a,_0x511d('0x25'));_0x4a6670(_0x1ab8c6[_0x511d('0x26')][_0x511d('0x23')]);}})[_0x511d('0x27')](function(_0x409b98){logger[_0x511d('0x21')]('FaxMessage,\x20%s,\x20%s',_0x1a272a,_0x409b98);_0x578b9a(_0x409b98);});});}function respondWithStatusCode(_0x521cdd,_0x39ec38){_0x39ec38=_0x39ec38||0xcc;return function(_0x43708f){if(_0x43708f){return _0x521cdd[_0x511d('0x28')](_0x39ec38);}return _0x521cdd[_0x511d('0x29')](_0x39ec38)[_0x511d('0x2a')]();};}function respondWithResult(_0x192daa,_0xbcab58){_0xbcab58=_0xbcab58||0xc8;return function(_0x21f543){if(_0x21f543){return _0x192daa['status'](_0xbcab58)[_0x511d('0x2b')](_0x21f543);}};}function respondWithFilteredResult(_0x4d2354,_0x2d45d8){return function(_0x497f49){if(_0x497f49){var _0x3e90bd=typeof _0x2d45d8[_0x511d('0x2c')]==='undefined'&&typeof _0x2d45d8[_0x511d('0x2d')]==='undefined';var _0x460e5d=_0x497f49[_0x511d('0x2e')];var _0x13bce1=_0x3e90bd?0x0:_0x2d45d8[_0x511d('0x2c')];var _0x34cb0b=_0x3e90bd?_0x497f49['count']:_0x2d45d8[_0x511d('0x2c')]+_0x2d45d8[_0x511d('0x2d')];var _0x31a7b0;if(_0x34cb0b>=_0x460e5d){_0x34cb0b=_0x460e5d;_0x31a7b0=0xc8;}else{_0x31a7b0=0xce;}_0x4d2354[_0x511d('0x29')](_0x31a7b0);return _0x4d2354[_0x511d('0x2f')](_0x511d('0x30'),_0x13bce1+'-'+_0x34cb0b+'/'+_0x460e5d)[_0x511d('0x2b')](_0x497f49);}return null;};}function patchUpdates(_0x194e0a){return function(_0x2eda5c){try{jsonpatch['apply'](_0x2eda5c,_0x194e0a,!![]);}catch(_0x4bf4ef){return BPromise[_0x511d('0x31')](_0x4bf4ef);}return _0x2eda5c[_0x511d('0x32')]();};}function saveUpdates(_0x29c189,_0x55d186){return function(_0x27117d){if(_0x27117d){return _0x27117d[_0x511d('0x33')](_0x29c189)['then'](function(_0x3106e5){return _0x3106e5;});}return null;};}function removeEntity(_0x53221,_0x3a8fb7){return function(_0x291104){if(_0x291104){return _0x291104[_0x511d('0x34')]()[_0x511d('0x1c')](function(){_0x53221['status'](0xcc)[_0x511d('0x2a')]();});}};}function handleEntityNotFound(_0x1dd4d7,_0x3f58d9){return function(_0x2c96e6){if(!_0x2c96e6){_0x1dd4d7[_0x511d('0x28')](0x194);}return _0x2c96e6;};}function handleError(_0x129834,_0x24c9bd){_0x24c9bd=_0x24c9bd||0x1f4;return function(_0x59fec7){logger['error'](_0x59fec7[_0x511d('0x35')]);if(_0x59fec7[_0x511d('0x36')]){delete _0x59fec7[_0x511d('0x36')];}_0x129834[_0x511d('0x29')](_0x24c9bd)['send'](_0x59fec7);};}exports[_0x511d('0x37')]=function(_0x544b97,_0xa86325){var _0x4344f1={},_0x1f8559={},_0x5f2ced={'count':0x0,'rows':[]};var _0x5eb00f=_[_0x511d('0x38')](db[_0x511d('0x39')][_0x511d('0x3a')],function(_0x18dd35){return{'name':_0x18dd35[_0x511d('0x3b')],'type':_0x18dd35[_0x511d('0x3c')][_0x511d('0x3d')]};});_0x1f8559[_0x511d('0x3e')]=_[_0x511d('0x38')](_0x5eb00f,_0x511d('0x36'));_0x1f8559['query']=_[_0x511d('0x3f')](_0x544b97['query']);_0x1f8559[_0x511d('0x40')]=_[_0x511d('0x41')](_0x1f8559['model'],_0x1f8559[_0x511d('0x42')]);_0x4344f1['attributes']=_['intersection'](_0x1f8559[_0x511d('0x3e')],qs[_0x511d('0x43')](_0x544b97['query'][_0x511d('0x43')]));_0x4344f1['attributes']=_0x4344f1[_0x511d('0x44')][_0x511d('0x45')]?_0x4344f1[_0x511d('0x44')]:_0x1f8559[_0x511d('0x3e')];if(!_0x544b97[_0x511d('0x42')][_0x511d('0x46')](_0x511d('0x47'))){_0x4344f1[_0x511d('0x2d')]=qs[_0x511d('0x2d')](_0x544b97[_0x511d('0x42')][_0x511d('0x2d')]);_0x4344f1[_0x511d('0x2c')]=qs[_0x511d('0x2c')](_0x544b97[_0x511d('0x42')][_0x511d('0x2c')]);}_0x4344f1[_0x511d('0x48')]=qs[_0x511d('0x49')](_0x544b97[_0x511d('0x42')][_0x511d('0x49')]);_0x4344f1[_0x511d('0x4a')]=qs[_0x511d('0x40')](_['pick'](_0x544b97[_0x511d('0x42')],_0x1f8559['filters']),_0x5eb00f);if(_0x544b97[_0x511d('0x42')][_0x511d('0x4b')]){_0x4344f1[_0x511d('0x4a')]=_['merge'](_0x4344f1['where'],{'$or':_[_0x511d('0x38')](_0x5eb00f,function(_0x2ac6ef){if(_0x2ac6ef[_0x511d('0x3c')]!==_0x511d('0x4c')){var _0x3ad57a={};_0x3ad57a[_0x2ac6ef[_0x511d('0x36')]]={'$like':'%'+_0x544b97['query'][_0x511d('0x4b')]+'%'};return _0x3ad57a;}})});}_0x4344f1=_[_0x511d('0x4d')]({},_0x4344f1,_0x544b97[_0x511d('0x4e')]);var _0x208a7c={'where':_0x4344f1[_0x511d('0x4a')]};return db[_0x511d('0x39')][_0x511d('0x2e')](_0x208a7c)[_0x511d('0x1c')](function(_0x22623c){_0x5f2ced[_0x511d('0x2e')]=_0x22623c;if(_0x544b97[_0x511d('0x42')][_0x511d('0x4f')]){_0x4344f1[_0x511d('0x50')]=[{'all':!![]}];}return db[_0x511d('0x39')][_0x511d('0x51')](_0x4344f1);})[_0x511d('0x1c')](function(_0x4704f6){_0x5f2ced[_0x511d('0x52')]=_0x4704f6;return _0x5f2ced;})['then'](respondWithFilteredResult(_0xa86325,_0x4344f1))[_0x511d('0x27')](handleError(_0xa86325,null));};exports[_0x511d('0x53')]=function(_0x5b6290,_0x11da01){var _0x1929bf={'raw':!![],'where':{'id':_0x5b6290[_0x511d('0x54')]['id']}},_0x446b83={};_0x446b83[_0x511d('0x3e')]=_[_0x511d('0x3f')](db[_0x511d('0x39')][_0x511d('0x3a')]);_0x446b83[_0x511d('0x42')]=_[_0x511d('0x3f')](_0x5b6290['query']);_0x446b83['filters']=_[_0x511d('0x41')](_0x446b83[_0x511d('0x3e')],_0x446b83[_0x511d('0x42')]);_0x1929bf[_0x511d('0x44')]=_['intersection'](_0x446b83[_0x511d('0x3e')],qs[_0x511d('0x43')](_0x5b6290['query'][_0x511d('0x43')]));_0x1929bf[_0x511d('0x44')]=_0x1929bf[_0x511d('0x44')][_0x511d('0x45')]?_0x1929bf[_0x511d('0x44')]:_0x446b83[_0x511d('0x3e')];if(_0x5b6290[_0x511d('0x42')][_0x511d('0x4f')]){_0x1929bf[_0x511d('0x50')]=[{'all':!![]}];}_0x1929bf=_[_0x511d('0x4d')]({},_0x1929bf,_0x5b6290[_0x511d('0x4e')]);return db[_0x511d('0x39')][_0x511d('0x55')](_0x1929bf)[_0x511d('0x1c')](handleEntityNotFound(_0x11da01,null))['then'](respondWithResult(_0x11da01,null))[_0x511d('0x27')](handleError(_0x11da01,null));};exports[_0x511d('0x33')]=function(_0x475cd8,_0x2f62eb){if(_0x475cd8['body']['id']){delete _0x475cd8[_0x511d('0x56')]['id'];}return db[_0x511d('0x39')][_0x511d('0x55')]({'where':{'id':_0x475cd8['params']['id']}})[_0x511d('0x1c')](handleEntityNotFound(_0x2f62eb,null))[_0x511d('0x1c')](saveUpdates(_0x475cd8[_0x511d('0x56')],null))[_0x511d('0x1c')](respondWithResult(_0x2f62eb,null))[_0x511d('0x27')](handleError(_0x2f62eb,null));};exports['destroy']=function(_0xb85701,_0x4cbadb){return db['FaxMessage'][_0x511d('0x55')]({'where':{'id':_0xb85701[_0x511d('0x54')]['id']}})[_0x511d('0x1c')](handleEntityNotFound(_0x4cbadb,null))[_0x511d('0x1c')](removeEntity(_0x4cbadb,null))[_0x511d('0x27')](handleError(_0x4cbadb,null));};exports[_0x511d('0x57')]=function(_0x15543a,_0x150b58){return db[_0x511d('0x39')][_0x511d('0x57')]()[_0x511d('0x1c')](respondWithResult(_0x150b58,null))['catch'](handleError(_0x150b58,null));};var interaction_log=require('../../config/logger')('fax-interactions');exports[_0x511d('0x58')]=function(_0x4a121a,_0xb39493,_0x411081){var _0x2987c2={'agent':{},'channel':'fax'};if(_0x4a121a[_0x511d('0x56')]['id']){delete _0x4a121a[_0x511d('0x56')]['id'];}_0x4a121a[_0x511d('0x56')][_0x511d('0x59')]=!![];_0x4a121a[_0x511d('0x56')][_0x511d('0x5a')]=moment()['format'](_0x511d('0x5b'));_0x4a121a[_0x511d('0x56')]['UserId']=_0x4a121a['body'][_0x511d('0x5c')]||_0x4a121a[_0x511d('0x5d')]['id'];_0x2987c2[_0x511d('0x5e')]['id']=_0x4a121a['body']['UserId'];return db[_0x511d('0x39')][_0x511d('0x55')]({'where':{'id':_0x4a121a['params']['id'],'UserId':null},'include':[{'model':db[_0x511d('0x5f')],'as':'Contact'}]})[_0x511d('0x1c')](handleEntityNotFound(_0xb39493,null))[_0x511d('0x1c')](saveUpdates(_0x4a121a[_0x511d('0x56')],null))[_0x511d('0x1c')](function(_0x517f37){if(_0x517f37){_0x2987c2[_0x511d('0x23')]=_0x517f37[_0x511d('0x60')]({'plain':!![]});return db[_0x511d('0x61')]['find']({'where':{'id':_0x517f37[_0x511d('0x62')]}});}return null;})[_0x511d('0x1c')](handleEntityNotFound(_0xb39493,null))[_0x511d('0x1c')](function(_0x89ec28){if(_0x89ec28){return _0x89ec28[_0x511d('0x33')]({'UserId':_0x4a121a['body'][_0x511d('0x5c')],'read1stAt':_['isNil'](_0x89ec28[_0x511d('0x63')])?moment()[_0x511d('0x64')](_0x511d('0x5b')):undefined});}return null;})[_0x511d('0x1c')](function(_0x133233){if(_0x133233){_0x2987c2[_0x511d('0x65')]=_0x133233['get']({'plain':!![]});interaction_log[_0x511d('0x1d')](_0x511d('0x66'),_0x4a121a[_0x511d('0x5d')]['id'],_0x4a121a[_0x511d('0x5d')]['name'],_0x4a121a[_0x511d('0x5d')]['role'],_0x2987c2[_0x511d('0x65')]['id'],_0x4a121a[_0x511d('0x56')]?JSON[_0x511d('0x20')](_0x4a121a[_0x511d('0x56')]):_0x511d('0x67'));return respondWithRpcPromise('AcceptMessage',_0x511d('0x68'),_0x2987c2);}return null;})['then'](function(_0xaf65f7){return db[_0x511d('0x5f')][_0x511d('0x57')]()[_0x511d('0x1c')](function(_0x2670b7){var _0x5f3567=[];for(var _0x560816=0x0;_0x560816=_0x5f2725){_0x4b11f0=_0x5f2725;_0x38573a=0xc8;}else{_0x38573a=0xce;}_0x3e96f7['status'](_0x38573a);return _0x3e96f7[_0xd8de('0x31')](_0xd8de('0x32'),_0x5579fc+'-'+_0x4b11f0+'/'+_0x5f2725)[_0xd8de('0x33')](_0x21a0b5);}return null;};}function patchUpdates(_0x51a6ab){return function(_0x3f176e){try{jsonpatch[_0xd8de('0x34')](_0x3f176e,_0x51a6ab,!![]);}catch(_0x5aca00){return BPromise['reject'](_0x5aca00);}return _0x3f176e['save']();};}function saveUpdates(_0x1331b2,_0x25d519){return function(_0x3db174){if(_0x3db174){return _0x3db174[_0xd8de('0x35')](_0x1331b2)[_0xd8de('0x20')](function(_0x42e80e){return _0x42e80e;});}return null;};}function removeEntity(_0x1ed041,_0x2f42df){return function(_0x1c666f){if(_0x1c666f){return _0x1c666f[_0xd8de('0x36')]()['then'](function(){_0x1ed041[_0xd8de('0x2c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x413717,_0x43f23f){return function(_0x52bcb7){if(!_0x52bcb7){_0x413717[_0xd8de('0x2a')](0x194);}return _0x52bcb7;};}function handleError(_0x525de3,_0x33de30){_0x33de30=_0x33de30||0x1f4;return function(_0x58b1b2){logger[_0xd8de('0x26')](_0x58b1b2[_0xd8de('0x37')]);if(_0x58b1b2[_0xd8de('0x38')]){delete _0x58b1b2[_0xd8de('0x38')];}_0x525de3[_0xd8de('0x2c')](_0x33de30)['send'](_0x58b1b2);};}exports[_0xd8de('0x39')]=function(_0xd6d034,_0x16f827){var _0x5d5ce2={},_0x420286={},_0x23fe20={'count':0x0,'rows':[]};var _0xe1c384=_[_0xd8de('0x3a')](db[_0xd8de('0x3b')][_0xd8de('0x3c')],function(_0x519f1c){return{'name':_0x519f1c[_0xd8de('0x3d')],'type':_0x519f1c['type'][_0xd8de('0x3e')]};});_0x420286[_0xd8de('0x3f')]=_['map'](_0xe1c384,_0xd8de('0x38'));_0x420286[_0xd8de('0x40')]=_['keys'](_0xd6d034[_0xd8de('0x40')]);_0x420286[_0xd8de('0x41')]=_['intersection'](_0x420286[_0xd8de('0x3f')],_0x420286[_0xd8de('0x40')]);_0x5d5ce2['attributes']=_[_0xd8de('0x42')](_0x420286[_0xd8de('0x3f')],qs['fields'](_0xd6d034['query']['fields']));_0x5d5ce2[_0xd8de('0x43')]=_0x5d5ce2[_0xd8de('0x43')][_0xd8de('0x44')]?_0x5d5ce2[_0xd8de('0x43')]:_0x420286[_0xd8de('0x3f')];if(!_0xd6d034[_0xd8de('0x40')]['hasOwnProperty'](_0xd8de('0x45'))){_0x5d5ce2['limit']=qs[_0xd8de('0x2e')](_0xd6d034[_0xd8de('0x40')]['limit']);_0x5d5ce2[_0xd8de('0x2d')]=qs[_0xd8de('0x2d')](_0xd6d034[_0xd8de('0x40')][_0xd8de('0x2d')]);}_0x5d5ce2[_0xd8de('0x46')]=qs[_0xd8de('0x47')](_0xd6d034['query'][_0xd8de('0x47')]);_0x5d5ce2[_0xd8de('0x48')]=qs['filters'](_[_0xd8de('0x49')](_0xd6d034[_0xd8de('0x40')],_0x420286['filters']),_0xe1c384);if(_0xd6d034[_0xd8de('0x40')][_0xd8de('0x4a')]){_0x5d5ce2[_0xd8de('0x48')]=_[_0xd8de('0x4b')](_0x5d5ce2[_0xd8de('0x48')],{'$or':_['map'](_0xe1c384,function(_0x297a13){if(_0x297a13[_0xd8de('0x4c')]!==_0xd8de('0x4d')){var _0x4afb2d={};_0x4afb2d[_0x297a13[_0xd8de('0x38')]]={'$like':'%'+_0xd6d034['query']['filter']+'%'};return _0x4afb2d;}})});}_0x5d5ce2=_['merge']({},_0x5d5ce2,_0xd6d034[_0xd8de('0x4e')]);var _0x17c72b={'where':_0x5d5ce2['where']};return db[_0xd8de('0x3b')][_0xd8de('0x30')](_0x17c72b)['then'](function(_0x220994){_0x23fe20[_0xd8de('0x30')]=_0x220994;if(_0xd6d034[_0xd8de('0x40')][_0xd8de('0x4f')]){_0x5d5ce2[_0xd8de('0x50')]=[{'all':!![]}];}return db['FaxMessage'][_0xd8de('0x51')](_0x5d5ce2);})['then'](function(_0x58db93){_0x23fe20['rows']=_0x58db93;return _0x23fe20;})[_0xd8de('0x20')](respondWithFilteredResult(_0x16f827,_0x5d5ce2))[_0xd8de('0x52')](handleError(_0x16f827,null));};exports['show']=function(_0x5070aa,_0x109d17){var _0x5dda51={'raw':!![],'where':{'id':_0x5070aa[_0xd8de('0x53')]['id']}},_0x9b3e13={};_0x9b3e13[_0xd8de('0x3f')]=_[_0xd8de('0x54')](db[_0xd8de('0x3b')][_0xd8de('0x3c')]);_0x9b3e13[_0xd8de('0x40')]=_[_0xd8de('0x54')](_0x5070aa[_0xd8de('0x40')]);_0x9b3e13[_0xd8de('0x41')]=_[_0xd8de('0x42')](_0x9b3e13[_0xd8de('0x3f')],_0x9b3e13['query']);_0x5dda51[_0xd8de('0x43')]=_['intersection'](_0x9b3e13['model'],qs[_0xd8de('0x55')](_0x5070aa[_0xd8de('0x40')][_0xd8de('0x55')]));_0x5dda51[_0xd8de('0x43')]=_0x5dda51[_0xd8de('0x43')]['length']?_0x5dda51[_0xd8de('0x43')]:_0x9b3e13['model'];if(_0x5070aa[_0xd8de('0x40')]['includeAll']){_0x5dda51['include']=[{'all':!![]}];}_0x5dda51=_[_0xd8de('0x4b')]({},_0x5dda51,_0x5070aa[_0xd8de('0x4e')]);return db[_0xd8de('0x3b')][_0xd8de('0x56')](_0x5dda51)['then'](handleEntityNotFound(_0x109d17,null))['then'](respondWithResult(_0x109d17,null))['catch'](handleError(_0x109d17,null));};exports['update']=function(_0x1b29d1,_0x1a3d7c){if(_0x1b29d1[_0xd8de('0x57')]['id']){delete _0x1b29d1[_0xd8de('0x57')]['id'];}return db[_0xd8de('0x3b')][_0xd8de('0x56')]({'where':{'id':_0x1b29d1[_0xd8de('0x53')]['id']}})[_0xd8de('0x20')](handleEntityNotFound(_0x1a3d7c,null))['then'](saveUpdates(_0x1b29d1[_0xd8de('0x57')],null))[_0xd8de('0x20')](respondWithResult(_0x1a3d7c,null))['catch'](handleError(_0x1a3d7c,null));};exports[_0xd8de('0x36')]=function(_0x3d4b3f,_0x15bafa){return db[_0xd8de('0x3b')][_0xd8de('0x56')]({'where':{'id':_0x3d4b3f[_0xd8de('0x53')]['id']}})[_0xd8de('0x20')](handleEntityNotFound(_0x15bafa,null))[_0xd8de('0x20')](removeEntity(_0x15bafa,null))[_0xd8de('0x52')](handleError(_0x15bafa,null));};exports[_0xd8de('0x58')]=function(_0x1b9609,_0x294e30){return db[_0xd8de('0x3b')][_0xd8de('0x58')]()[_0xd8de('0x20')](respondWithResult(_0x294e30,null))['catch'](handleError(_0x294e30,null));};var interaction_log=require('../../config/logger')(_0xd8de('0x59'));exports[_0xd8de('0x5a')]=function(_0x5ce3f1,_0x930251,_0x4f3edf){var _0x247ac5={'agent':{},'channel':_0xd8de('0x5b')};if(_0x5ce3f1[_0xd8de('0x57')]['id']){delete _0x5ce3f1[_0xd8de('0x57')]['id'];}_0x5ce3f1[_0xd8de('0x57')]['read']=!![];_0x5ce3f1[_0xd8de('0x57')]['readAt']=moment()[_0xd8de('0x5c')](_0xd8de('0x5d'));_0x5ce3f1[_0xd8de('0x57')][_0xd8de('0x5e')]=_0x5ce3f1[_0xd8de('0x57')][_0xd8de('0x5e')]||_0x5ce3f1[_0xd8de('0x5f')]['id'];_0x247ac5[_0xd8de('0x60')]['id']=_0x5ce3f1[_0xd8de('0x57')][_0xd8de('0x5e')];return db[_0xd8de('0x3b')]['find']({'where':{'id':_0x5ce3f1['params']['id'],'UserId':null},'include':[{'model':db[_0xd8de('0x61')],'as':_0xd8de('0x62')}]})[_0xd8de('0x20')](handleEntityNotFound(_0x930251,null))[_0xd8de('0x20')](saveUpdates(_0x5ce3f1[_0xd8de('0x57')],null))[_0xd8de('0x20')](function(_0x48805d){if(_0x48805d){_0x247ac5[_0xd8de('0x28')]=_0x48805d[_0xd8de('0x63')]({'plain':!![]});return db[_0xd8de('0x64')]['find']({'where':{'id':_0x48805d['FaxInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x930251,null))[_0xd8de('0x20')](function(_0x2019ea){if(_0x2019ea){return _0x2019ea['update']({'UserId':_0x5ce3f1['body'][_0xd8de('0x5e')],'read1stAt':_['isNil'](_0x2019ea[_0xd8de('0x65')])?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xd8de('0x20')](function(_0x3b5405){if(_0x3b5405){_0x247ac5['interaction']=_0x3b5405[_0xd8de('0x63')]({'plain':!![]});interaction_log[_0xd8de('0x21')](_0xd8de('0x66'),_0x5ce3f1[_0xd8de('0x5f')]['id'],_0x5ce3f1[_0xd8de('0x5f')][_0xd8de('0x38')],_0x5ce3f1[_0xd8de('0x5f')]['role'],_0x247ac5['interaction']['id'],_0x5ce3f1[_0xd8de('0x57')]?JSON[_0xd8de('0x25')](_0x5ce3f1[_0xd8de('0x57')]):'null');return respondWithRpcPromise(_0xd8de('0x67'),_0xd8de('0x68'),_0x247ac5);}return null;})[_0xd8de('0x20')](function(_0x183a6a){return db[_0xd8de('0x61')][_0xd8de('0x58')]()[_0xd8de('0x20')](function(_0x101966){var _0x5f3ad0=[];for(var _0x3bdee2=0x0;_0x3bdee2=_0x37425e){_0x2f73b2=_0x37425e;_0x32c63a=0xc8;}else{_0x32c63a=0xce;}_0x24ee53[_0x2729('0x21')](_0x32c63a);return _0x24ee53[_0x2729('0x26')](_0x2729('0x27'),_0xbdcfd3+'-'+_0x2f73b2+'/'+_0x37425e)['json'](_0x41623f);}return null;};}function patchUpdates(_0x193ca3){return function(_0x2f3e9c){try{jsonpatch[_0x2729('0x28')](_0x2f3e9c,_0x193ca3,!![]);}catch(_0x5629f6){return BPromise['reject'](_0x5629f6);}return _0x2f3e9c[_0x2729('0x29')]();};}function saveUpdates(_0x18bd4f,_0x598770){return function(_0x20e906){if(_0x20e906){return _0x20e906[_0x2729('0x2a')](_0x18bd4f)[_0x2729('0x2b')](function(_0x379014){return _0x379014;});}return null;};}function removeEntity(_0x37ab53,_0x3c7df0){return function(_0x3cb1c8){if(_0x3cb1c8){return _0x3cb1c8[_0x2729('0x2c')]()['then'](function(){var _0x3f8da4=_0x3cb1c8[_0x2729('0x2d')]({'plain':!![]});var _0x51cfe5=_0x2729('0x2e');return db['UserProfileResource']['destroy']({'where':{'type':_0x51cfe5,'resourceId':_0x3f8da4['id']}})['then'](function(){return _0x3cb1c8;});})['then'](function(){_0x37ab53['status'](0xcc)[_0x2729('0x22')]();});}};}function handleEntityNotFound(_0x4625fb,_0x4806e3){return function(_0x466e90){if(!_0x466e90){_0x4625fb[_0x2729('0x2f')](0x194);}return _0x466e90;};}function handleError(_0x39fb61,_0x3547f8){_0x3547f8=_0x3547f8||0x1f4;return function(_0x578a94){logger[_0x2729('0x30')](_0x578a94[_0x2729('0x31')]);if(_0x578a94[_0x2729('0x32')]){delete _0x578a94['name'];}_0x39fb61['status'](_0x3547f8)[_0x2729('0x33')](_0x578a94);};}exports[_0x2729('0x34')]=function(_0x390145,_0xe3feda){var _0x53d0c8={},_0x1bf906={},_0x34d5e5={'count':0x0,'rows':[]};var _0x55803a=_[_0x2729('0x35')](db[_0x2729('0x36')][_0x2729('0x37')],function(_0x435492){return{'name':_0x435492[_0x2729('0x38')],'type':_0x435492['type'][_0x2729('0x39')]};});_0x1bf906[_0x2729('0x3a')]=_[_0x2729('0x35')](_0x55803a,_0x2729('0x32'));_0x1bf906[_0x2729('0x3b')]=_[_0x2729('0x3c')](_0x390145[_0x2729('0x3b')]);_0x1bf906['filters']=_[_0x2729('0x3d')](_0x1bf906[_0x2729('0x3a')],_0x1bf906['query']);_0x53d0c8[_0x2729('0x3e')]=_['intersection'](_0x1bf906['model'],qs[_0x2729('0x3f')](_0x390145[_0x2729('0x3b')][_0x2729('0x3f')]));_0x53d0c8['attributes']=_0x53d0c8[_0x2729('0x3e')][_0x2729('0x40')]?_0x53d0c8['attributes']:_0x1bf906[_0x2729('0x3a')];if(!_0x390145[_0x2729('0x3b')][_0x2729('0x41')](_0x2729('0x42'))){_0x53d0c8[_0x2729('0x43')]=qs[_0x2729('0x43')](_0x390145['query']['limit']);_0x53d0c8[_0x2729('0x23')]=qs['offset'](_0x390145[_0x2729('0x3b')]['offset']);}_0x53d0c8[_0x2729('0x44')]=qs['sort'](_0x390145[_0x2729('0x3b')]['sort']);_0x53d0c8[_0x2729('0x45')]=qs[_0x2729('0x46')](_[_0x2729('0x47')](_0x390145['query'],_0x1bf906['filters']),_0x55803a);if(_0x390145[_0x2729('0x3b')]['filter']){_0x53d0c8[_0x2729('0x45')]=_['merge'](_0x53d0c8['where'],{'$or':_[_0x2729('0x35')](_0x55803a,function(_0x48dedf){if(_0x48dedf[_0x2729('0x48')]!=='VIRTUAL'){var _0x2cf731={};_0x2cf731[_0x48dedf[_0x2729('0x32')]]={'$like':'%'+_0x390145[_0x2729('0x3b')][_0x2729('0x49')]+'%'};return _0x2cf731;}})});}_0x53d0c8=_[_0x2729('0x4a')]({},_0x53d0c8,_0x390145['options']);var _0x43e0fb={'where':_0x53d0c8[_0x2729('0x45')]};return db['FaxQueue']['count'](_0x43e0fb)[_0x2729('0x2b')](function(_0x45acf3){_0x34d5e5[_0x2729('0x25')]=_0x45acf3;if(_0x390145[_0x2729('0x3b')][_0x2729('0x4b')]){_0x53d0c8[_0x2729('0x4c')]=[{'all':!![]}];}return db[_0x2729('0x36')][_0x2729('0x4d')](_0x53d0c8);})[_0x2729('0x2b')](function(_0x1c4f42){_0x34d5e5[_0x2729('0x4e')]=_0x1c4f42;return _0x34d5e5;})[_0x2729('0x2b')](respondWithFilteredResult(_0xe3feda,_0x53d0c8))[_0x2729('0x4f')](handleError(_0xe3feda,null));};exports[_0x2729('0x50')]=function(_0x5ceb88,_0x1f36f0){var _0x438210={'raw':!![],'where':{'id':_0x5ceb88[_0x2729('0x51')]['id']}},_0x4fe81b={};_0x4fe81b['model']=_[_0x2729('0x3c')](db[_0x2729('0x36')][_0x2729('0x37')]);_0x4fe81b['query']=_['keys'](_0x5ceb88[_0x2729('0x3b')]);_0x4fe81b[_0x2729('0x46')]=_['intersection'](_0x4fe81b['model'],_0x4fe81b[_0x2729('0x3b')]);_0x438210[_0x2729('0x3e')]=_[_0x2729('0x3d')](_0x4fe81b[_0x2729('0x3a')],qs['fields'](_0x5ceb88[_0x2729('0x3b')][_0x2729('0x3f')]));_0x438210['attributes']=_0x438210[_0x2729('0x3e')]['length']?_0x438210[_0x2729('0x3e')]:_0x4fe81b[_0x2729('0x3a')];if(_0x5ceb88['query'][_0x2729('0x4b')]){_0x438210['include']=[{'all':!![]}];}_0x438210=_['merge']({},_0x438210,_0x5ceb88[_0x2729('0x52')]);return db['FaxQueue'][_0x2729('0x53')](_0x438210)[_0x2729('0x2b')](handleEntityNotFound(_0x1f36f0,null))[_0x2729('0x2b')](respondWithResult(_0x1f36f0,null))[_0x2729('0x4f')](handleError(_0x1f36f0,null));};exports[_0x2729('0x54')]=function(_0x3f6fe5,_0x515515){return db[_0x2729('0x36')]['create'](_0x3f6fe5[_0x2729('0x55')],{})[_0x2729('0x2b')](function(_0x1c8ec2){var _0x5cea9b=_0x3f6fe5[_0x2729('0x56')][_0x2729('0x2d')]({'plain':!![]});if(!_0x5cea9b)throw new Error(_0x2729('0x57'));if(_0x5cea9b[_0x2729('0x58')]===_0x2729('0x56')){var _0x4336da=_0x1c8ec2[_0x2729('0x2d')]({'plain':!![]});var _0x593ac5=_0x2729('0x2e');return db['UserProfileSection'][_0x2729('0x53')]({'where':{'name':_0x593ac5,'userProfileId':_0x5cea9b['userProfileId']},'raw':!![]})['then'](function(_0x4f7b04){if(_0x4f7b04&&_0x4f7b04[_0x2729('0x59')]===0x0){return db[_0x2729('0x5a')][_0x2729('0x54')]({'name':_0x4336da[_0x2729('0x32')],'resourceId':_0x4336da['id'],'type':_0x4f7b04[_0x2729('0x32')],'sectionId':_0x4f7b04['id']},{})[_0x2729('0x2b')](function(){return _0x1c8ec2;});}else{return _0x1c8ec2;}})[_0x2729('0x4f')](function(_0x2fb141){logger['error'](_0x2729('0x5b'),_0x2fb141);throw _0x2fb141;});}return _0x1c8ec2;})[_0x2729('0x2b')](respondWithResult(_0x515515,0xc9))['catch'](handleError(_0x515515,null));};exports[_0x2729('0x2a')]=function(_0x971bd4,_0x327291){if(_0x971bd4[_0x2729('0x55')]['id']){delete _0x971bd4[_0x2729('0x55')]['id'];}return db['FaxQueue'][_0x2729('0x53')]({'where':{'id':_0x971bd4[_0x2729('0x51')]['id']}})['then'](handleEntityNotFound(_0x327291,null))[_0x2729('0x2b')](saveUpdates(_0x971bd4[_0x2729('0x55')],null))['then'](respondWithResult(_0x327291,null))['catch'](handleError(_0x327291,null));};exports[_0x2729('0x2c')]=function(_0x1cf520,_0x411947){return db[_0x2729('0x36')]['find']({'where':{'id':_0x1cf520[_0x2729('0x51')]['id']}})[_0x2729('0x2b')](handleEntityNotFound(_0x411947,null))[_0x2729('0x2b')](removeEntity(_0x411947,null))[_0x2729('0x4f')](handleError(_0x411947,null));};exports[_0x2729('0x5c')]=function(_0x5eb4b5,_0xddfb2f){return db[_0x2729('0x36')][_0x2729('0x5c')]()['then'](respondWithResult(_0xddfb2f,null))[_0x2729('0x4f')](handleError(_0xddfb2f,null));};exports[_0x2729('0x5d')]=function(_0x499deb,_0x4768b0,_0x14b6ad){var _0xc73985={'raw':!![],'where':{}},_0x2b3740={},_0x5f3ec4;return db['FaxQueue']['findOne']({'where':{'id':_0x499deb['params']['id']}})['then'](handleEntityNotFound(_0x4768b0,null))[_0x2729('0x2b')](function(_0x37d94e){if(_0x37d94e){_0x5f3ec4=_0x37d94e['get']({'plain':!![]});_0x2b3740[_0x2729('0x3a')]=_[_0x2729('0x3c')](db[_0x2729('0x5e')][_0x2729('0x37')]);_0x2b3740['query']=_[_0x2729('0x3c')](_0x499deb[_0x2729('0x3b')]);_0x2b3740[_0x2729('0x46')]=_[_0x2729('0x3d')](_0x2b3740['model'],_0x2b3740[_0x2729('0x3b')]);_0xc73985[_0x2729('0x3e')]=_['intersection'](_0x2b3740[_0x2729('0x3a')],qs['fields'](_0x499deb[_0x2729('0x3b')][_0x2729('0x3f')]));_0xc73985['attributes']=_0xc73985[_0x2729('0x3e')]['length']?_0xc73985[_0x2729('0x3e')]:_0x2b3740[_0x2729('0x3a')];if(!_0x499deb[_0x2729('0x3b')][_0x2729('0x41')](_0x2729('0x42'))){_0xc73985['limit']=qs[_0x2729('0x43')](_0x499deb[_0x2729('0x3b')][_0x2729('0x43')]);_0xc73985[_0x2729('0x23')]=qs[_0x2729('0x23')](_0x499deb['query']['offset']);}_0xc73985[_0x2729('0x44')]=qs[_0x2729('0x5f')](_0x499deb['query']['sort']);_0xc73985[_0x2729('0x45')]=qs['filters'](_[_0x2729('0x47')](_0x499deb[_0x2729('0x3b')],_0x2b3740[_0x2729('0x46')]));_0xc73985[_0x2729('0x45')][_0x2729('0x60')]=_0x37d94e['id'];if(_0x499deb[_0x2729('0x3b')][_0x2729('0x49')]){_0xc73985[_0x2729('0x45')]=_[_0x2729('0x4a')](_0xc73985[_0x2729('0x45')],{'$or':_[_0x2729('0x35')](_0xc73985[_0x2729('0x3e')],function(_0xbe409a){var _0x399986={};_0x399986[_0xbe409a]={'$like':'%'+_0x499deb[_0x2729('0x3b')][_0x2729('0x49')]+'%'};return _0x399986;})});}_0xc73985=_['merge']({},_0xc73985,_0x499deb['options']);return db[_0x2729('0x5e')]['findAll'](_0xc73985);}})['then'](function(_0x339df6){if(_0x339df6){return db[_0x2729('0x61')][_0x2729('0x62')]({'where':{'id':_[_0x2729('0x35')](_0x339df6,_0x2729('0x63')),'role':_0x2729('0x64')},'attributes':['id',_0x2729('0x32'),_0x2729('0x65'),_0x2729('0x66'),_0x2729('0x67')]});}})[_0x2729('0x2b')](function(_0x2082d8){if(_0x2082d8){return{'count':_0x2082d8[_0x2729('0x25')],'rows':_[_0x2729('0x35')](_0x2082d8[_0x2729('0x4e')],function(_0x525029){return{'membername':_0x525029[_0x2729('0x32')],'UserId':_0x525029['id'],'queue_name':_0x5f3ec4[_0x2729('0x32')],'FaxQueueId':_0x5f3ec4['id'],'interface':util[_0x2729('0x68')](_0x2729('0x69'),_0x2729('0x6a'),_0x525029['name']),'penalty':0x0,'paused':_0x525029[_0x2729('0x65')],'createdAt':_0x525029[_0x2729('0x67')],'updatedAt':_0x525029['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x2729('0x2b')](respondWithFilteredResult(_0x4768b0,_0xc73985))['catch'](handleError(_0x4768b0,null));};exports[_0x2729('0x6b')]=function(_0x18e5bd,_0x5debb1,_0xbe6e99){var _0x568747={};var _0x49b8e0={};var _0x34495b;var _0x180f4f;return db[_0x2729('0x36')][_0x2729('0x6c')]({'where':{'id':_0x18e5bd['params']['id']}})[_0x2729('0x2b')](handleEntityNotFound(_0x5debb1,null))[_0x2729('0x2b')](function(_0x55d31a){if(_0x55d31a){_0x34495b=_0x55d31a;_0x49b8e0[_0x2729('0x3a')]=_[_0x2729('0x3c')](db[_0x2729('0x6d')][_0x2729('0x37')]);_0x49b8e0[_0x2729('0x3b')]=_[_0x2729('0x3c')](_0x18e5bd[_0x2729('0x3b')]);_0x49b8e0[_0x2729('0x46')]=_[_0x2729('0x3d')](_0x49b8e0[_0x2729('0x3a')],_0x49b8e0[_0x2729('0x3b')]);_0x568747['attributes']=_['intersection'](_0x49b8e0[_0x2729('0x3a')],qs['fields'](_0x18e5bd[_0x2729('0x3b')][_0x2729('0x3f')]));_0x568747[_0x2729('0x3e')]=_0x568747[_0x2729('0x3e')]['length']?_0x568747[_0x2729('0x3e')]:_0x49b8e0[_0x2729('0x3a')];_0x568747[_0x2729('0x44')]=qs['sort'](_0x18e5bd[_0x2729('0x3b')][_0x2729('0x5f')]);_0x568747[_0x2729('0x45')]=qs[_0x2729('0x46')](_[_0x2729('0x47')](_0x18e5bd['query'],_0x49b8e0[_0x2729('0x46')]));if(_0x18e5bd[_0x2729('0x3b')][_0x2729('0x49')]){_0x568747[_0x2729('0x45')]=_[_0x2729('0x4a')](_0x568747[_0x2729('0x45')],{'$or':_['map'](_0x568747[_0x2729('0x3e')],function(_0x9aa0c9){var _0x36f422={};_0x36f422[_0x9aa0c9]={'$like':'%'+_0x18e5bd['query'][_0x2729('0x49')]+'%'};return _0x36f422;})});}_0x568747=_[_0x2729('0x4a')]({},_0x568747,_0x18e5bd[_0x2729('0x52')]);return _0x34495b['getTeams'](_0x568747);}})[_0x2729('0x2b')](function(_0x1c7c30){if(_0x1c7c30){_0x180f4f=_0x1c7c30[_0x2729('0x40')];if(!_0x18e5bd['query']['hasOwnProperty'](_0x2729('0x42'))){_0x568747[_0x2729('0x43')]=qs[_0x2729('0x43')](_0x18e5bd[_0x2729('0x3b')][_0x2729('0x43')]);_0x568747[_0x2729('0x23')]=qs[_0x2729('0x23')](_0x18e5bd[_0x2729('0x3b')][_0x2729('0x23')]);}return _0x34495b[_0x2729('0x6b')](_0x568747);}})[_0x2729('0x2b')](function(_0x536ffd){if(_0x536ffd){return _0x536ffd?{'count':_0x180f4f,'rows':_0x536ffd}:null;}})[_0x2729('0x2b')](respondWithResult(_0x5debb1,null))[_0x2729('0x4f')](handleError(_0x5debb1,null));};exports[_0x2729('0x6e')]=function(_0x5f3494,_0x4818cf,_0x10ff86){var _0x55fed0=_0x5f3494['body'][_0x2729('0x6f')];return db['Team'][_0x2729('0x4d')]({'where':{'id':_0x55fed0},'attributes':['id'],'include':[{'model':db[_0x2729('0x61')],'as':_0x2729('0x70'),'attributes':['id',_0x2729('0x32'),_0x2729('0x71'),_0x2729('0x72'),_0x2729('0x73')],'raw':!![]}]})[_0x2729('0x2b')](function(_0x44ec73){if(_0x44ec73){var _0x39f4fc=_[_0x2729('0x74')](_0x44ec73,function(_0x595839){var _0x4e52a2=_0x595839[_0x2729('0x2d')]({'plain':!![]});return _0x4e52a2['Agents'];});return db[_0x2729('0x36')][_0x2729('0x53')]({'where':{'id':_0x5f3494[_0x2729('0x51')]['id']}})[_0x2729('0x2b')](function(_0x59b84b){return db[_0x2729('0x75')][_0x2729('0x76')](function(_0x895a2c){return _0x59b84b[_0x2729('0x6e')](_0x55fed0,{'transaction':_0x895a2c})[_0x2729('0x2b')](function(){return BPromise['each'](_0x39f4fc,function(_0x33f590){return db['UserFaxQueue'][_0x2729('0x77')]({'where':{'UserId':_0x33f590['id'],'FaxQueueId':_0x5f3494[_0x2729('0x51')]['id']},'transaction':_0x895a2c});});})[_0x2729('0x2b')](function(){_0x39f4fc[_0x2729('0x78')](function(_0xff589a){socket[_0x2729('0x79')](_0x2729('0x7a'),{'UserId':_0xff589a['id'],'FaxQueueId':_0x59b84b['id']});});});});});}})[_0x2729('0x2b')](respondWithStatusCode(_0x4818cf,null))[_0x2729('0x4f')](handleError(_0x4818cf,null));};exports[_0x2729('0x7b')]=function(_0x1e0082,_0x2588f7,_0x59b820){return db['Team'][_0x2729('0x4d')]({'where':{'id':_0x1e0082[_0x2729('0x3b')]['ids']},'attributes':['id'],'include':[{'model':db[_0x2729('0x61')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x2729('0x2b')](handleEntityNotFound(_0x2588f7,null))[_0x2729('0x2b')](function(_0x70b924){var _0xa7370e=_['map'](_0x70b924,'id');var _0x5c7807=[];var _0x241f35=[];var _0x26c254=squel[_0x2729('0x7c')]();_0x26c254['field']('tq.TeamId')[_0x2729('0x7d')]('team_has_fax_queues','tq')[_0x2729('0x7e')](_0x2729('0x7f'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x2729('0x45')]('FaxQueueId\x20=\x20?',_0x1e0082[_0x2729('0x51')]['id']);for(var _0x38c8d3=0x0;_0x38c8d3<_0x70b924[_0x2729('0x40')];_0x38c8d3+=0x1){let _0x435ea6=_0x70b924[_0x38c8d3];for(var _0x1b215c=0x0;_0x1b215c<_0x435ea6[_0x2729('0x70')][_0x2729('0x40')];_0x1b215c+=0x1){let _0x228707=_0x435ea6[_0x2729('0x70')][_0x1b215c];var _0x54911a=_0x26c254[_0x2729('0x80')]();_0x54911a[_0x2729('0x45')](_0x2729('0x81'),_0x228707['id']);_0x241f35[_0x2729('0x82')](db['sequelize'][_0x2729('0x3b')](_0x54911a[_0x2729('0x83')](),{'type':db['sequelize'][_0x2729('0x84')][_0x2729('0x85')]})[_0x2729('0x2b')](function(_0x207c7c){if(_0x207c7c['length']===0x1){return _0x228707['id'];}else{var _0x4ed119=_['every'](_[_0x2729('0x35')](_0x207c7c,_0x2729('0x86')),function(_0x30a2c2){return _[_0x2729('0x87')](_0xa7370e,_0x30a2c2);});if(_0x4ed119){return _0x228707['id'];}}}));}}return BPromise[_0x2729('0x88')](_0x241f35)[_0x2729('0x2b')](function(_0x3499bd){_0x5c7807=_(_0x5c7807)[_0x2729('0x89')](_0x3499bd)[_0x2729('0x8a')]()[_0x2729('0x8b')]();return db[_0x2729('0x36')][_0x2729('0x53')]({'where':{'id':_0x1e0082[_0x2729('0x51')]['id']}})[_0x2729('0x2b')](function(_0x323342){return db[_0x2729('0x75')][_0x2729('0x76')](function(_0x565738){return _0x323342[_0x2729('0x7b')](_0x1e0082[_0x2729('0x3b')][_0x2729('0x6f')],{'transaction':_0x565738})[_0x2729('0x2b')](function(){if(!_[_0x2729('0x8c')](_0x5c7807)){return _0x323342[_0x2729('0x8d')](_0x5c7807,{'transaction':_0x565738});}})[_0x2729('0x2b')](function(){_0x5c7807['forEach'](function(_0xbc2c2a){socket[_0x2729('0x79')](_0x2729('0x8e'),{'UserId':_0xbc2c2a,'FaxQueueId':_0x323342['id']});});});});});});})['then'](respondWithStatusCode(_0x2588f7,null))[_0x2729('0x4f')](handleError(_0x2588f7,null));};exports['addAgents']=function(_0x214026,_0xeda223,_0x369ca5){return db[_0x2729('0x36')][_0x2729('0x53')]({'where':{'id':_0x214026['params']['id']}})[_0x2729('0x2b')](handleEntityNotFound(_0xeda223,null))[_0x2729('0x2b')](function(_0xe1b83){if(_0xe1b83){return _0xe1b83[_0x2729('0x8f')](_0x214026['body']['ids'],_['omit'](_0x214026['body'],[_0x2729('0x6f'),'id'])||{})[_0x2729('0x90')](function(_0x3b5327){for(var _0x6c859f=0x0;_0x6c859f<_0x214026[_0x2729('0x55')][_0x2729('0x6f')][_0x2729('0x40')];_0x6c859f+=0x1){socket[_0x2729('0x79')](_0x2729('0x7a'),{'UserId':_0x214026[_0x2729('0x55')][_0x2729('0x6f')][_0x6c859f],'FaxQueueId':_0x214026[_0x2729('0x51')]['id']});}return _0x3b5327;});}})['then'](respondWithResult(_0xeda223,null))[_0x2729('0x4f')](handleError(_0xeda223,null));};exports[_0x2729('0x8d')]=function(_0x14bcd0,_0x3a9b12,_0x15fd2a){return db['FaxQueue'][_0x2729('0x53')]({'where':{'id':_0x14bcd0[_0x2729('0x51')]['id']}})[_0x2729('0x2b')](handleEntityNotFound(_0x3a9b12,null))[_0x2729('0x2b')](function(_0x1d0103){if(_0x1d0103){return _0x1d0103[_0x2729('0x8d')](_0x14bcd0[_0x2729('0x3b')][_0x2729('0x6f')])[_0x2729('0x2b')](function(){if(_['isArray'](_0x14bcd0[_0x2729('0x3b')][_0x2729('0x6f')])){for(var _0x709897=0x0;_0x709897<_0x14bcd0['query']['ids']['length'];_0x709897+=0x1){socket['emit']('userFaxQueue:remove',{'UserId':Number(_0x14bcd0[_0x2729('0x3b')][_0x2729('0x6f')][_0x709897]),'FaxQueueId':Number(_0x14bcd0['params']['id'])});}}else{socket[_0x2729('0x79')](_0x2729('0x8e'),{'UserId':Number(_0x14bcd0[_0x2729('0x3b')][_0x2729('0x6f')]),'FaxQueueId':Number(_0x14bcd0[_0x2729('0x51')]['id'])});}});}})[_0x2729('0x2b')](respondWithStatusCode(_0x3a9b12,null))[_0x2729('0x4f')](handleError(_0x3a9b12,null));};exports[_0x2729('0x91')]=function(_0x1f3983,_0x21f5f4,_0x34ac32){var _0x3e6b64={};var _0x2a66b5={};var _0x3ad572;var _0x25293d;return db[_0x2729('0x36')][_0x2729('0x6c')]({'where':{'id':_0x1f3983[_0x2729('0x51')]['id']}})[_0x2729('0x2b')](handleEntityNotFound(_0x21f5f4,null))['then'](function(_0x29a81c){if(_0x29a81c){_0x3ad572=_0x29a81c;_0x2a66b5[_0x2729('0x3a')]=_['keys'](db[_0x2729('0x61')][_0x2729('0x37')]);_0x2a66b5[_0x2729('0x3b')]=_[_0x2729('0x3c')](_0x1f3983[_0x2729('0x3b')]);_0x2a66b5[_0x2729('0x46')]=_[_0x2729('0x3d')](_0x2a66b5[_0x2729('0x3a')],_0x2a66b5['query']);_0x3e6b64['attributes']=_['intersection'](_0x2a66b5['model'],qs[_0x2729('0x3f')](_0x1f3983['query'][_0x2729('0x3f')]));_0x3e6b64['attributes']=_0x3e6b64[_0x2729('0x3e')][_0x2729('0x40')]?_0x3e6b64[_0x2729('0x3e')]:_0x2a66b5['model'];_0x3e6b64['order']=qs['sort'](_0x1f3983[_0x2729('0x3b')][_0x2729('0x5f')]);_0x3e6b64[_0x2729('0x45')]=qs[_0x2729('0x46')](_[_0x2729('0x47')](_0x1f3983['query'],_0x2a66b5['filters']));if(_0x1f3983['query']['filter']){_0x3e6b64['where']=_[_0x2729('0x4a')](_0x3e6b64[_0x2729('0x45')],{'$or':_[_0x2729('0x35')](_0x3e6b64['attributes'],function(_0x3a64a3){var _0x4943ad={};_0x4943ad[_0x3a64a3]={'$like':'%'+_0x1f3983[_0x2729('0x3b')][_0x2729('0x49')]+'%'};return _0x4943ad;})});}_0x3e6b64=_[_0x2729('0x4a')]({},_0x3e6b64,_0x1f3983[_0x2729('0x52')]);return _0x3ad572[_0x2729('0x91')](_0x3e6b64);}})[_0x2729('0x2b')](function(_0x567109){if(_0x567109){_0x25293d=_0x567109[_0x2729('0x40')];if(!_0x1f3983[_0x2729('0x3b')][_0x2729('0x41')]('nolimit')){_0x3e6b64['limit']=qs[_0x2729('0x43')](_0x1f3983[_0x2729('0x3b')][_0x2729('0x43')]);_0x3e6b64[_0x2729('0x23')]=qs[_0x2729('0x23')](_0x1f3983[_0x2729('0x3b')][_0x2729('0x23')]);}return _0x3ad572[_0x2729('0x91')](_0x3e6b64);}})[_0x2729('0x2b')](function(_0x3842ed){if(_0x3842ed){return _0x3842ed?{'count':_0x25293d,'rows':_0x3842ed}:null;}})[_0x2729('0x2b')](respondWithResult(_0x21f5f4,null))[_0x2729('0x4f')](handleError(_0x21f5f4,null));}; \ No newline at end of file +var _0xb78e=['updatedAt','rows','format','%s/%s','SIP','createdAt','getTeams','findOne','Team','addTeams','ids','Agents','online','voicePause','flatMap','transaction','each','findOrCreate','emit','userFaxQueue:save','removeTeams','select','tq.TeamId','from','join','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','sequelize','QueryTypes','every','TeamId','all','union','compact','value','isEmpty','removeAgents','forEach','addAgents','omit','spread','isArray','getAgents','pick','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','end','json','offset','undefined','limit','count','status','set','Content-Range','reject','update','then','get','FaxQueues','destroy','sendStatus','name','index','map','FaxQueue','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','options','include','findAll','catch','params','keys','rawAttributes','length','includeAll','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','UserFaxQueue','merge','User','findAndCountAll','UserId','faxPause'];(function(_0x4c33aa,_0x202fce){var _0x534d5f=function(_0x2dd847){while(--_0x2dd847){_0x4c33aa['push'](_0x4c33aa['shift']());}};_0x534d5f(++_0x202fce);}(_0xb78e,0x1c9));var _0xeb78=function(_0x5dc4c1,_0x2756f2){_0x5dc4c1=_0x5dc4c1-0x0;var _0x3e3986=_0xb78e[_0x5dc4c1];return _0x3e3986;};'use strict';var emlformat=require(_0xeb78('0x0'));var rimraf=require(_0xeb78('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xeb78('0x2'));var rp=require(_0xeb78('0x3'));var moment=require(_0xeb78('0x4'));var BPromise=require(_0xeb78('0x5'));var Mustache=require(_0xeb78('0x6'));var util=require(_0xeb78('0x7'));var path=require(_0xeb78('0x8'));var sox=require(_0xeb78('0x9'));var csv=require('to-csv');var ejs=require(_0xeb78('0xa'));var fs=require('fs');var fs_extra=require(_0xeb78('0xb'));var _=require(_0xeb78('0xc'));var squel=require(_0xeb78('0xd'));var crypto=require(_0xeb78('0xe'));var jsforce=require(_0xeb78('0xf'));var deskjs=require(_0xeb78('0x10'));var toCsv=require('to-csv');var querystring=require(_0xeb78('0x11'));var Papa=require(_0xeb78('0x12'));var Redis=require(_0xeb78('0x13'));var authService=require(_0xeb78('0x14'));var qs=require(_0xeb78('0x15'));var as=require(_0xeb78('0x16'));var hardwareService=require(_0xeb78('0x17'));var logger=require(_0xeb78('0x18'))(_0xeb78('0x19'));var utils=require('../../config/utils');var config=require(_0xeb78('0x1a'));var licenseUtil=require(_0xeb78('0x1b'));var db=require(_0xeb78('0x1c'))['db'];config[_0xeb78('0x1d')]=_[_0xeb78('0x1e')](config[_0xeb78('0x1d')],{'host':_0xeb78('0x1f'),'port':0x18eb});var socket=require(_0xeb78('0x20'))(new Redis(config[_0xeb78('0x1d')]));require(_0xeb78('0x21'))['register'](socket);function respondWithStatusCode(_0x315914,_0x3e4d24){_0x3e4d24=_0x3e4d24||0xcc;return function(_0x4e8b8c){if(_0x4e8b8c){return _0x315914['sendStatus'](_0x3e4d24);}return _0x315914['status'](_0x3e4d24)[_0xeb78('0x22')]();};}function respondWithResult(_0x50ebae,_0xa28d5e){_0xa28d5e=_0xa28d5e||0xc8;return function(_0x247cb1){if(_0x247cb1){return _0x50ebae['status'](_0xa28d5e)[_0xeb78('0x23')](_0x247cb1);}};}function respondWithFilteredResult(_0x53c811,_0x21c521){return function(_0x92e410){if(_0x92e410){var _0x576802=typeof _0x21c521[_0xeb78('0x24')]===_0xeb78('0x25')&&typeof _0x21c521[_0xeb78('0x26')]==='undefined';var _0x24d845=_0x92e410[_0xeb78('0x27')];var _0x4ab933=_0x576802?0x0:_0x21c521['offset'];var _0x455e30=_0x576802?_0x92e410[_0xeb78('0x27')]:_0x21c521[_0xeb78('0x24')]+_0x21c521[_0xeb78('0x26')];var _0x432b18;if(_0x455e30>=_0x24d845){_0x455e30=_0x24d845;_0x432b18=0xc8;}else{_0x432b18=0xce;}_0x53c811[_0xeb78('0x28')](_0x432b18);return _0x53c811[_0xeb78('0x29')](_0xeb78('0x2a'),_0x4ab933+'-'+_0x455e30+'/'+_0x24d845)[_0xeb78('0x23')](_0x92e410);}return null;};}function patchUpdates(_0x52b8c1){return function(_0x5d3cf8){try{jsonpatch['apply'](_0x5d3cf8,_0x52b8c1,!![]);}catch(_0x5c9e0d){return BPromise[_0xeb78('0x2b')](_0x5c9e0d);}return _0x5d3cf8['save']();};}function saveUpdates(_0x2159c1,_0x1fbf2f){return function(_0x566336){if(_0x566336){return _0x566336[_0xeb78('0x2c')](_0x2159c1)['then'](function(_0x9a00b){return _0x9a00b;});}return null;};}function removeEntity(_0x5fc575,_0x315f98){return function(_0x12b3b2){if(_0x12b3b2){return _0x12b3b2['destroy']()[_0xeb78('0x2d')](function(){var _0x515158=_0x12b3b2[_0xeb78('0x2e')]({'plain':!![]});var _0x23295a=_0xeb78('0x2f');return db['UserProfileResource'][_0xeb78('0x30')]({'where':{'type':_0x23295a,'resourceId':_0x515158['id']}})[_0xeb78('0x2d')](function(){return _0x12b3b2;});})[_0xeb78('0x2d')](function(){_0x5fc575[_0xeb78('0x28')](0xcc)[_0xeb78('0x22')]();});}};}function handleEntityNotFound(_0x3516b8,_0x1131a9){return function(_0x22c25f){if(!_0x22c25f){_0x3516b8[_0xeb78('0x31')](0x194);}return _0x22c25f;};}function handleError(_0x19ad00,_0x1f3a14){_0x1f3a14=_0x1f3a14||0x1f4;return function(_0x505468){logger['error'](_0x505468['stack']);if(_0x505468[_0xeb78('0x32')]){delete _0x505468[_0xeb78('0x32')];}_0x19ad00[_0xeb78('0x28')](_0x1f3a14)['send'](_0x505468);};}exports[_0xeb78('0x33')]=function(_0x1ecdfb,_0x3de59f){var _0x83b35d={},_0x4e720c={},_0x1a0ce6={'count':0x0,'rows':[]};var _0x1ec0bc=_[_0xeb78('0x34')](db[_0xeb78('0x35')]['rawAttributes'],function(_0x3ff33f){return{'name':_0x3ff33f['fieldName'],'type':_0x3ff33f[_0xeb78('0x36')][_0xeb78('0x37')]};});_0x4e720c[_0xeb78('0x38')]=_[_0xeb78('0x34')](_0x1ec0bc,_0xeb78('0x32'));_0x4e720c[_0xeb78('0x39')]=_['keys'](_0x1ecdfb['query']);_0x4e720c[_0xeb78('0x3a')]=_[_0xeb78('0x3b')](_0x4e720c[_0xeb78('0x38')],_0x4e720c[_0xeb78('0x39')]);_0x83b35d[_0xeb78('0x3c')]=_['intersection'](_0x4e720c[_0xeb78('0x38')],qs[_0xeb78('0x3d')](_0x1ecdfb[_0xeb78('0x39')][_0xeb78('0x3d')]));_0x83b35d[_0xeb78('0x3c')]=_0x83b35d[_0xeb78('0x3c')]['length']?_0x83b35d['attributes']:_0x4e720c['model'];if(!_0x1ecdfb['query'][_0xeb78('0x3e')](_0xeb78('0x3f'))){_0x83b35d[_0xeb78('0x26')]=qs['limit'](_0x1ecdfb[_0xeb78('0x39')][_0xeb78('0x26')]);_0x83b35d['offset']=qs['offset'](_0x1ecdfb['query'][_0xeb78('0x24')]);}_0x83b35d[_0xeb78('0x40')]=qs[_0xeb78('0x41')](_0x1ecdfb['query'][_0xeb78('0x41')]);_0x83b35d[_0xeb78('0x42')]=qs[_0xeb78('0x3a')](_['pick'](_0x1ecdfb[_0xeb78('0x39')],_0x4e720c[_0xeb78('0x3a')]),_0x1ec0bc);if(_0x1ecdfb[_0xeb78('0x39')][_0xeb78('0x43')]){_0x83b35d['where']=_['merge'](_0x83b35d[_0xeb78('0x42')],{'$or':_[_0xeb78('0x34')](_0x1ec0bc,function(_0x2e416b){if(_0x2e416b[_0xeb78('0x36')]!==_0xeb78('0x44')){var _0x2fbdb4={};_0x2fbdb4[_0x2e416b[_0xeb78('0x32')]]={'$like':'%'+_0x1ecdfb[_0xeb78('0x39')][_0xeb78('0x43')]+'%'};return _0x2fbdb4;}})});}_0x83b35d=_['merge']({},_0x83b35d,_0x1ecdfb[_0xeb78('0x45')]);var _0xa02a32={'where':_0x83b35d[_0xeb78('0x42')]};return db['FaxQueue'][_0xeb78('0x27')](_0xa02a32)['then'](function(_0x21f81b){_0x1a0ce6[_0xeb78('0x27')]=_0x21f81b;if(_0x1ecdfb[_0xeb78('0x39')]['includeAll']){_0x83b35d[_0xeb78('0x46')]=[{'all':!![]}];}return db[_0xeb78('0x35')][_0xeb78('0x47')](_0x83b35d);})[_0xeb78('0x2d')](function(_0x2dc9f7){_0x1a0ce6['rows']=_0x2dc9f7;return _0x1a0ce6;})[_0xeb78('0x2d')](respondWithFilteredResult(_0x3de59f,_0x83b35d))[_0xeb78('0x48')](handleError(_0x3de59f,null));};exports['show']=function(_0xece1cb,_0x31a146){var _0x1f2610={'raw':!![],'where':{'id':_0xece1cb[_0xeb78('0x49')]['id']}},_0x51dfbc={};_0x51dfbc[_0xeb78('0x38')]=_[_0xeb78('0x4a')](db[_0xeb78('0x35')][_0xeb78('0x4b')]);_0x51dfbc[_0xeb78('0x39')]=_['keys'](_0xece1cb['query']);_0x51dfbc[_0xeb78('0x3a')]=_[_0xeb78('0x3b')](_0x51dfbc['model'],_0x51dfbc[_0xeb78('0x39')]);_0x1f2610[_0xeb78('0x3c')]=_[_0xeb78('0x3b')](_0x51dfbc[_0xeb78('0x38')],qs[_0xeb78('0x3d')](_0xece1cb[_0xeb78('0x39')][_0xeb78('0x3d')]));_0x1f2610[_0xeb78('0x3c')]=_0x1f2610[_0xeb78('0x3c')][_0xeb78('0x4c')]?_0x1f2610[_0xeb78('0x3c')]:_0x51dfbc[_0xeb78('0x38')];if(_0xece1cb[_0xeb78('0x39')][_0xeb78('0x4d')]){_0x1f2610[_0xeb78('0x46')]=[{'all':!![]}];}_0x1f2610=_['merge']({},_0x1f2610,_0xece1cb[_0xeb78('0x45')]);return db[_0xeb78('0x35')][_0xeb78('0x4e')](_0x1f2610)[_0xeb78('0x2d')](handleEntityNotFound(_0x31a146,null))['then'](respondWithResult(_0x31a146,null))[_0xeb78('0x48')](handleError(_0x31a146,null));};exports[_0xeb78('0x4f')]=function(_0xcaccc5,_0x3d30a4){return db[_0xeb78('0x35')]['create'](_0xcaccc5['body'],{})['then'](function(_0x438c20){var _0x21ee21=_0xcaccc5['user'][_0xeb78('0x2e')]({'plain':!![]});if(!_0x21ee21)throw new Error(_0xeb78('0x50'));if(_0x21ee21[_0xeb78('0x51')]==='user'){var _0x4d6a21=_0x438c20[_0xeb78('0x2e')]({'plain':!![]});var _0x48e2=_0xeb78('0x2f');return db['UserProfileSection'][_0xeb78('0x4e')]({'where':{'name':_0x48e2,'userProfileId':_0x21ee21[_0xeb78('0x52')]},'raw':!![]})[_0xeb78('0x2d')](function(_0x4a3c91){if(_0x4a3c91&&_0x4a3c91['autoAssociation']===0x0){return db['UserProfileResource'][_0xeb78('0x4f')]({'name':_0x4d6a21[_0xeb78('0x32')],'resourceId':_0x4d6a21['id'],'type':_0x4a3c91['name'],'sectionId':_0x4a3c91['id']},{})[_0xeb78('0x2d')](function(){return _0x438c20;});}else{return _0x438c20;}})[_0xeb78('0x48')](function(_0x2a77c8){logger['error'](_0xeb78('0x53'),_0x2a77c8);throw _0x2a77c8;});}return _0x438c20;})['then'](respondWithResult(_0x3d30a4,0xc9))[_0xeb78('0x48')](handleError(_0x3d30a4,null));};exports[_0xeb78('0x2c')]=function(_0x165515,_0x579a4e){if(_0x165515['body']['id']){delete _0x165515['body']['id'];}return db['FaxQueue'][_0xeb78('0x4e')]({'where':{'id':_0x165515['params']['id']}})[_0xeb78('0x2d')](handleEntityNotFound(_0x579a4e,null))[_0xeb78('0x2d')](saveUpdates(_0x165515[_0xeb78('0x54')],null))[_0xeb78('0x2d')](respondWithResult(_0x579a4e,null))[_0xeb78('0x48')](handleError(_0x579a4e,null));};exports[_0xeb78('0x30')]=function(_0x4a9dcd,_0x528a53){return db[_0xeb78('0x35')][_0xeb78('0x4e')]({'where':{'id':_0x4a9dcd[_0xeb78('0x49')]['id']}})[_0xeb78('0x2d')](handleEntityNotFound(_0x528a53,null))['then'](removeEntity(_0x528a53,null))[_0xeb78('0x48')](handleError(_0x528a53,null));};exports['describe']=function(_0x4cb7e6,_0x1b1a55){return db[_0xeb78('0x35')]['describe']()[_0xeb78('0x2d')](respondWithResult(_0x1b1a55,null))[_0xeb78('0x48')](handleError(_0x1b1a55,null));};exports['getMembers']=function(_0x5a5de3,_0x154f19,_0x442937){var _0x4a303b={'raw':!![],'where':{}},_0x21b96c={},_0x437a3f;return db['FaxQueue']['findOne']({'where':{'id':_0x5a5de3[_0xeb78('0x49')]['id']}})['then'](handleEntityNotFound(_0x154f19,null))['then'](function(_0x2029ea){if(_0x2029ea){_0x437a3f=_0x2029ea['get']({'plain':!![]});_0x21b96c[_0xeb78('0x38')]=_[_0xeb78('0x4a')](db[_0xeb78('0x55')]['rawAttributes']);_0x21b96c[_0xeb78('0x39')]=_[_0xeb78('0x4a')](_0x5a5de3[_0xeb78('0x39')]);_0x21b96c['filters']=_[_0xeb78('0x3b')](_0x21b96c[_0xeb78('0x38')],_0x21b96c[_0xeb78('0x39')]);_0x4a303b[_0xeb78('0x3c')]=_[_0xeb78('0x3b')](_0x21b96c[_0xeb78('0x38')],qs['fields'](_0x5a5de3[_0xeb78('0x39')]['fields']));_0x4a303b[_0xeb78('0x3c')]=_0x4a303b[_0xeb78('0x3c')][_0xeb78('0x4c')]?_0x4a303b[_0xeb78('0x3c')]:_0x21b96c[_0xeb78('0x38')];if(!_0x5a5de3['query'][_0xeb78('0x3e')](_0xeb78('0x3f'))){_0x4a303b[_0xeb78('0x26')]=qs[_0xeb78('0x26')](_0x5a5de3[_0xeb78('0x39')][_0xeb78('0x26')]);_0x4a303b[_0xeb78('0x24')]=qs[_0xeb78('0x24')](_0x5a5de3[_0xeb78('0x39')][_0xeb78('0x24')]);}_0x4a303b[_0xeb78('0x40')]=qs[_0xeb78('0x41')](_0x5a5de3[_0xeb78('0x39')][_0xeb78('0x41')]);_0x4a303b[_0xeb78('0x42')]=qs[_0xeb78('0x3a')](_['pick'](_0x5a5de3[_0xeb78('0x39')],_0x21b96c[_0xeb78('0x3a')]));_0x4a303b[_0xeb78('0x42')]['FaxQueueId']=_0x2029ea['id'];if(_0x5a5de3[_0xeb78('0x39')][_0xeb78('0x43')]){_0x4a303b[_0xeb78('0x42')]=_[_0xeb78('0x56')](_0x4a303b[_0xeb78('0x42')],{'$or':_[_0xeb78('0x34')](_0x4a303b[_0xeb78('0x3c')],function(_0xb4b5bd){var _0x411252={};_0x411252[_0xb4b5bd]={'$like':'%'+_0x5a5de3['query']['filter']+'%'};return _0x411252;})});}_0x4a303b=_[_0xeb78('0x56')]({},_0x4a303b,_0x5a5de3[_0xeb78('0x45')]);return db[_0xeb78('0x55')][_0xeb78('0x47')](_0x4a303b);}})[_0xeb78('0x2d')](function(_0x86c3f0){if(_0x86c3f0){return db[_0xeb78('0x57')][_0xeb78('0x58')]({'where':{'id':_[_0xeb78('0x34')](_0x86c3f0,_0xeb78('0x59')),'role':'agent'},'attributes':['id',_0xeb78('0x32'),_0xeb78('0x5a'),_0xeb78('0x5b'),'createdAt']});}})['then'](function(_0x5f4995){if(_0x5f4995){return{'count':_0x5f4995['count'],'rows':_[_0xeb78('0x34')](_0x5f4995[_0xeb78('0x5c')],function(_0x4027ff){return{'membername':_0x4027ff[_0xeb78('0x32')],'UserId':_0x4027ff['id'],'queue_name':_0x437a3f[_0xeb78('0x32')],'FaxQueueId':_0x437a3f['id'],'interface':util[_0xeb78('0x5d')](_0xeb78('0x5e'),_0xeb78('0x5f'),_0x4027ff[_0xeb78('0x32')]),'penalty':0x0,'paused':_0x4027ff[_0xeb78('0x5a')],'createdAt':_0x4027ff[_0xeb78('0x60')],'updatedAt':_0x4027ff['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xeb78('0x2d')](respondWithFilteredResult(_0x154f19,_0x4a303b))['catch'](handleError(_0x154f19,null));};exports[_0xeb78('0x61')]=function(_0x4bac4b,_0x437ce2,_0x1fe11a){var _0x2a9d4d={};var _0x1a94ee={};var _0xbe8a5b;var _0x5d7f6e;return db[_0xeb78('0x35')][_0xeb78('0x62')]({'where':{'id':_0x4bac4b[_0xeb78('0x49')]['id']}})[_0xeb78('0x2d')](handleEntityNotFound(_0x437ce2,null))[_0xeb78('0x2d')](function(_0x2da098){if(_0x2da098){_0xbe8a5b=_0x2da098;_0x1a94ee[_0xeb78('0x38')]=_[_0xeb78('0x4a')](db[_0xeb78('0x63')][_0xeb78('0x4b')]);_0x1a94ee['query']=_[_0xeb78('0x4a')](_0x4bac4b[_0xeb78('0x39')]);_0x1a94ee[_0xeb78('0x3a')]=_[_0xeb78('0x3b')](_0x1a94ee[_0xeb78('0x38')],_0x1a94ee[_0xeb78('0x39')]);_0x2a9d4d[_0xeb78('0x3c')]=_['intersection'](_0x1a94ee[_0xeb78('0x38')],qs['fields'](_0x4bac4b[_0xeb78('0x39')][_0xeb78('0x3d')]));_0x2a9d4d[_0xeb78('0x3c')]=_0x2a9d4d['attributes'][_0xeb78('0x4c')]?_0x2a9d4d[_0xeb78('0x3c')]:_0x1a94ee['model'];_0x2a9d4d[_0xeb78('0x40')]=qs[_0xeb78('0x41')](_0x4bac4b['query'][_0xeb78('0x41')]);_0x2a9d4d[_0xeb78('0x42')]=qs[_0xeb78('0x3a')](_['pick'](_0x4bac4b[_0xeb78('0x39')],_0x1a94ee[_0xeb78('0x3a')]));if(_0x4bac4b[_0xeb78('0x39')]['filter']){_0x2a9d4d[_0xeb78('0x42')]=_[_0xeb78('0x56')](_0x2a9d4d['where'],{'$or':_['map'](_0x2a9d4d['attributes'],function(_0x4e73fb){var _0x183c99={};_0x183c99[_0x4e73fb]={'$like':'%'+_0x4bac4b[_0xeb78('0x39')][_0xeb78('0x43')]+'%'};return _0x183c99;})});}_0x2a9d4d=_[_0xeb78('0x56')]({},_0x2a9d4d,_0x4bac4b[_0xeb78('0x45')]);return _0xbe8a5b[_0xeb78('0x61')](_0x2a9d4d);}})[_0xeb78('0x2d')](function(_0x34a1f3){if(_0x34a1f3){_0x5d7f6e=_0x34a1f3[_0xeb78('0x4c')];if(!_0x4bac4b[_0xeb78('0x39')][_0xeb78('0x3e')](_0xeb78('0x3f'))){_0x2a9d4d[_0xeb78('0x26')]=qs['limit'](_0x4bac4b['query'][_0xeb78('0x26')]);_0x2a9d4d[_0xeb78('0x24')]=qs[_0xeb78('0x24')](_0x4bac4b[_0xeb78('0x39')][_0xeb78('0x24')]);}return _0xbe8a5b[_0xeb78('0x61')](_0x2a9d4d);}})['then'](function(_0x1262a9){if(_0x1262a9){return _0x1262a9?{'count':_0x5d7f6e,'rows':_0x1262a9}:null;}})[_0xeb78('0x2d')](respondWithResult(_0x437ce2,null))['catch'](handleError(_0x437ce2,null));};exports[_0xeb78('0x64')]=function(_0x339037,_0x2c6965,_0x17e845){var _0x358315=_0x339037[_0xeb78('0x54')][_0xeb78('0x65')];return db['Team'][_0xeb78('0x47')]({'where':{'id':_0x358315},'attributes':['id'],'include':[{'model':db['User'],'as':_0xeb78('0x66'),'attributes':['id',_0xeb78('0x32'),_0xeb78('0x67'),_0xeb78('0x68'),'interface'],'raw':!![]}]})[_0xeb78('0x2d')](function(_0x573736){if(_0x573736){var _0x59eac9=_[_0xeb78('0x69')](_0x573736,function(_0x39ba48){var _0x3d8612=_0x39ba48[_0xeb78('0x2e')]({'plain':!![]});return _0x3d8612[_0xeb78('0x66')];});return db[_0xeb78('0x35')][_0xeb78('0x4e')]({'where':{'id':_0x339037[_0xeb78('0x49')]['id']}})[_0xeb78('0x2d')](function(_0x4ec413){return db['sequelize'][_0xeb78('0x6a')](function(_0x368b36){return _0x4ec413[_0xeb78('0x64')](_0x358315,{'transaction':_0x368b36})['then'](function(){return BPromise[_0xeb78('0x6b')](_0x59eac9,function(_0x3dd35f){return db[_0xeb78('0x55')][_0xeb78('0x6c')]({'where':{'UserId':_0x3dd35f['id'],'FaxQueueId':_0x339037['params']['id']},'transaction':_0x368b36});});})['then'](function(){_0x59eac9['forEach'](function(_0x556416){socket[_0xeb78('0x6d')](_0xeb78('0x6e'),{'UserId':_0x556416['id'],'FaxQueueId':_0x4ec413['id']});});});});});}})[_0xeb78('0x2d')](respondWithStatusCode(_0x2c6965,null))[_0xeb78('0x48')](handleError(_0x2c6965,null));};exports[_0xeb78('0x6f')]=function(_0xa99ad9,_0x5f2b54,_0x4324bd){return db[_0xeb78('0x63')][_0xeb78('0x47')]({'where':{'id':_0xa99ad9[_0xeb78('0x39')][_0xeb78('0x65')]},'attributes':['id'],'include':[{'model':db[_0xeb78('0x57')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xeb78('0x2d')](handleEntityNotFound(_0x5f2b54,null))['then'](function(_0x3041c6){var _0x506734=_[_0xeb78('0x34')](_0x3041c6,'id');var _0x43637d=[];var _0x1ad737=[];var _0x25cb1c=squel[_0xeb78('0x70')]();_0x25cb1c['field'](_0xeb78('0x71'))[_0xeb78('0x72')]('team_has_fax_queues','tq')[_0xeb78('0x73')]('user_has_teams','ut',_0xeb78('0x74'))['where'](_0xeb78('0x75'),_0xa99ad9[_0xeb78('0x49')]['id']);for(var _0x298285=0x0;_0x298285<_0x3041c6[_0xeb78('0x4c')];_0x298285+=0x1){let _0x29e34a=_0x3041c6[_0x298285];for(var _0x1cf3eb=0x0;_0x1cf3eb<_0x29e34a[_0xeb78('0x66')][_0xeb78('0x4c')];_0x1cf3eb+=0x1){let _0x4da338=_0x29e34a[_0xeb78('0x66')][_0x1cf3eb];var _0x1711c2=_0x25cb1c['clone']();_0x1711c2[_0xeb78('0x42')](_0xeb78('0x76'),_0x4da338['id']);_0x1ad737[_0xeb78('0x77')](db[_0xeb78('0x78')][_0xeb78('0x39')](_0x1711c2['toString'](),{'type':db[_0xeb78('0x78')][_0xeb78('0x79')]['SELECT']})[_0xeb78('0x2d')](function(_0x423544){if(_0x423544['length']===0x1){return _0x4da338['id'];}else{var _0x6059c4=_[_0xeb78('0x7a')](_['map'](_0x423544,_0xeb78('0x7b')),function(_0x587ba3){return _['includes'](_0x506734,_0x587ba3);});if(_0x6059c4){return _0x4da338['id'];}}}));}}return BPromise[_0xeb78('0x7c')](_0x1ad737)[_0xeb78('0x2d')](function(_0x2c3cb2){_0x43637d=_(_0x43637d)[_0xeb78('0x7d')](_0x2c3cb2)[_0xeb78('0x7e')]()[_0xeb78('0x7f')]();return db[_0xeb78('0x35')][_0xeb78('0x4e')]({'where':{'id':_0xa99ad9[_0xeb78('0x49')]['id']}})[_0xeb78('0x2d')](function(_0x5496b1){return db['sequelize'][_0xeb78('0x6a')](function(_0x11a133){return _0x5496b1[_0xeb78('0x6f')](_0xa99ad9[_0xeb78('0x39')][_0xeb78('0x65')],{'transaction':_0x11a133})[_0xeb78('0x2d')](function(){if(!_[_0xeb78('0x80')](_0x43637d)){return _0x5496b1[_0xeb78('0x81')](_0x43637d,{'transaction':_0x11a133});}})[_0xeb78('0x2d')](function(){_0x43637d[_0xeb78('0x82')](function(_0x3b4de3){socket[_0xeb78('0x6d')]('userFaxQueue:remove',{'UserId':_0x3b4de3,'FaxQueueId':_0x5496b1['id']});});});});});});})['then'](respondWithStatusCode(_0x5f2b54,null))[_0xeb78('0x48')](handleError(_0x5f2b54,null));};exports['addAgents']=function(_0x24edc3,_0x53c186,_0x577f5f){return db[_0xeb78('0x35')][_0xeb78('0x4e')]({'where':{'id':_0x24edc3[_0xeb78('0x49')]['id']}})[_0xeb78('0x2d')](handleEntityNotFound(_0x53c186,null))[_0xeb78('0x2d')](function(_0xb69f0e){if(_0xb69f0e){return _0xb69f0e[_0xeb78('0x83')](_0x24edc3[_0xeb78('0x54')]['ids'],_[_0xeb78('0x84')](_0x24edc3[_0xeb78('0x54')],['ids','id'])||{})[_0xeb78('0x85')](function(_0x3373bd){for(var _0x3b4d06=0x0;_0x3b4d06<_0x24edc3[_0xeb78('0x54')]['ids'][_0xeb78('0x4c')];_0x3b4d06+=0x1){socket['emit'](_0xeb78('0x6e'),{'UserId':_0x24edc3[_0xeb78('0x54')][_0xeb78('0x65')][_0x3b4d06],'FaxQueueId':_0x24edc3['params']['id']});}return _0x3373bd;});}})[_0xeb78('0x2d')](respondWithResult(_0x53c186,null))[_0xeb78('0x48')](handleError(_0x53c186,null));};exports[_0xeb78('0x81')]=function(_0x286cb1,_0x15702f,_0xf2825d){return db[_0xeb78('0x35')][_0xeb78('0x4e')]({'where':{'id':_0x286cb1[_0xeb78('0x49')]['id']}})[_0xeb78('0x2d')](handleEntityNotFound(_0x15702f,null))[_0xeb78('0x2d')](function(_0x2a80a2){if(_0x2a80a2){return _0x2a80a2[_0xeb78('0x81')](_0x286cb1[_0xeb78('0x39')]['ids'])['then'](function(){if(_[_0xeb78('0x86')](_0x286cb1[_0xeb78('0x39')][_0xeb78('0x65')])){for(var _0x46674c=0x0;_0x46674c<_0x286cb1['query'][_0xeb78('0x65')]['length'];_0x46674c+=0x1){socket['emit']('userFaxQueue:remove',{'UserId':Number(_0x286cb1[_0xeb78('0x39')][_0xeb78('0x65')][_0x46674c]),'FaxQueueId':Number(_0x286cb1['params']['id'])});}}else{socket['emit']('userFaxQueue:remove',{'UserId':Number(_0x286cb1[_0xeb78('0x39')][_0xeb78('0x65')]),'FaxQueueId':Number(_0x286cb1[_0xeb78('0x49')]['id'])});}});}})['then'](respondWithStatusCode(_0x15702f,null))[_0xeb78('0x48')](handleError(_0x15702f,null));};exports[_0xeb78('0x87')]=function(_0x9efd92,_0xdfa0c8,_0x12eb0b){var _0x3e4ec4={};var _0x7841fc={};var _0x285113;var _0x40550d;return db['FaxQueue'][_0xeb78('0x62')]({'where':{'id':_0x9efd92[_0xeb78('0x49')]['id']}})['then'](handleEntityNotFound(_0xdfa0c8,null))[_0xeb78('0x2d')](function(_0x3a80b7){if(_0x3a80b7){_0x285113=_0x3a80b7;_0x7841fc[_0xeb78('0x38')]=_[_0xeb78('0x4a')](db[_0xeb78('0x57')][_0xeb78('0x4b')]);_0x7841fc[_0xeb78('0x39')]=_[_0xeb78('0x4a')](_0x9efd92['query']);_0x7841fc[_0xeb78('0x3a')]=_[_0xeb78('0x3b')](_0x7841fc[_0xeb78('0x38')],_0x7841fc['query']);_0x3e4ec4['attributes']=_[_0xeb78('0x3b')](_0x7841fc[_0xeb78('0x38')],qs['fields'](_0x9efd92[_0xeb78('0x39')][_0xeb78('0x3d')]));_0x3e4ec4['attributes']=_0x3e4ec4[_0xeb78('0x3c')][_0xeb78('0x4c')]?_0x3e4ec4['attributes']:_0x7841fc[_0xeb78('0x38')];_0x3e4ec4[_0xeb78('0x40')]=qs['sort'](_0x9efd92[_0xeb78('0x39')][_0xeb78('0x41')]);_0x3e4ec4[_0xeb78('0x42')]=qs[_0xeb78('0x3a')](_[_0xeb78('0x88')](_0x9efd92[_0xeb78('0x39')],_0x7841fc[_0xeb78('0x3a')]));if(_0x9efd92['query'][_0xeb78('0x43')]){_0x3e4ec4[_0xeb78('0x42')]=_[_0xeb78('0x56')](_0x3e4ec4[_0xeb78('0x42')],{'$or':_[_0xeb78('0x34')](_0x3e4ec4['attributes'],function(_0x4ecb4f){var _0x286b6a={};_0x286b6a[_0x4ecb4f]={'$like':'%'+_0x9efd92[_0xeb78('0x39')]['filter']+'%'};return _0x286b6a;})});}_0x3e4ec4=_['merge']({},_0x3e4ec4,_0x9efd92[_0xeb78('0x45')]);return _0x285113[_0xeb78('0x87')](_0x3e4ec4);}})[_0xeb78('0x2d')](function(_0x39147b){if(_0x39147b){_0x40550d=_0x39147b[_0xeb78('0x4c')];if(!_0x9efd92['query'][_0xeb78('0x3e')]('nolimit')){_0x3e4ec4['limit']=qs[_0xeb78('0x26')](_0x9efd92['query'][_0xeb78('0x26')]);_0x3e4ec4['offset']=qs['offset'](_0x9efd92[_0xeb78('0x39')][_0xeb78('0x24')]);}return _0x285113['getAgents'](_0x3e4ec4);}})[_0xeb78('0x2d')](function(_0x10f23e){if(_0x10f23e){return _0x10f23e?{'count':_0x40550d,'rows':_0x10f23e}:null;}})['then'](respondWithResult(_0xdfa0c8,null))[_0xeb78('0x48')](handleError(_0xdfa0c8,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index dd95def..4b33534 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 _0xf454=['setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','events','FaxQueue'];(function(_0x2c27ed,_0x5c50f0){var _0x597bd1=function(_0xd6db18){while(--_0xd6db18){_0x2c27ed['push'](_0x2c27ed['shift']());}};_0x597bd1(++_0x5c50f0);}(_0xf454,0xd6));var _0x4f45=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xf454[_0x3bf83f];return _0x22c4a9;};'use strict';var EventEmitter=require(_0x4f45('0x0'));var FaxQueue=require('../../mysqldb')['db'][_0x4f45('0x1')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x4f45('0x2')](0x0);var events={'afterCreate':_0x4f45('0x3'),'afterUpdate':_0x4f45('0x4'),'afterDestroy':'remove'};function emitEvent(_0x2b1cd4){return function(_0x4635d9,_0x47b5d3,_0x1638b4){FaxQueueEvents[_0x4f45('0x5')](_0x2b1cd4+':'+_0x4635d9['id'],_0x4635d9);FaxQueueEvents['emit'](_0x2b1cd4,_0x4635d9);_0x1638b4(null);};}for(var e in events){if(events[_0x4f45('0x6')](e)){var event=events[e];FaxQueue[_0x4f45('0x7')](e,emitEvent(event));}}module[_0x4f45('0x8')]=FaxQueueEvents; \ No newline at end of file +var _0x1d25=['update','emit','hasOwnProperty','hook','events','../../mysqldb','FaxQueue','setMaxListeners','save'];(function(_0x126a6f,_0x390a17){var _0x3988db=function(_0x162d81){while(--_0x162d81){_0x126a6f['push'](_0x126a6f['shift']());}};_0x3988db(++_0x390a17);}(_0x1d25,0x199));var _0x51d2=function(_0x296144,_0x26bbbf){_0x296144=_0x296144-0x0;var _0x5329b1=_0x1d25[_0x296144];return _0x5329b1;};'use strict';var EventEmitter=require(_0x51d2('0x0'));var FaxQueue=require(_0x51d2('0x1'))['db'][_0x51d2('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x51d2('0x3')](0x0);var events={'afterCreate':_0x51d2('0x4'),'afterUpdate':_0x51d2('0x5'),'afterDestroy':'remove'};function emitEvent(_0x5f1c99){return function(_0x3347d7,_0x8717a,_0xe6fca4){FaxQueueEvents[_0x51d2('0x6')](_0x5f1c99+':'+_0x3347d7['id'],_0x3347d7);FaxQueueEvents[_0x51d2('0x6')](_0x5f1c99,_0x3347d7);_0xe6fca4(null);};}for(var e in events){if(events[_0x51d2('0x7')](e)){var event=events[e];FaxQueue[_0x51d2('0x8')](e,emitEvent(event));}}module['exports']=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index 9cdfccc..73c19f9 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 _0xbf58=['path','rimraf','../../config/environment','./faxQueue.attributes','exports','define','FaxQueue','fax_queues','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x49285f,_0x4b0734){var _0x203e53=function(_0x50d189){while(--_0x50d189){_0x49285f['push'](_0x49285f['shift']());}};_0x203e53(++_0x4b0734);}(_0xbf58,0x1e4));var _0x8bf5=function(_0x515ad9,_0x24860c){_0x515ad9=_0x515ad9-0x0;var _0x36d50d=_0xbf58[_0x515ad9];return _0x36d50d;};'use strict';var _=require(_0x8bf5('0x0'));var util=require(_0x8bf5('0x1'));var logger=require(_0x8bf5('0x2'))('api');var moment=require(_0x8bf5('0x3'));var BPromise=require(_0x8bf5('0x4'));var rp=require(_0x8bf5('0x5'));var fs=require('fs');var path=require(_0x8bf5('0x6'));var rimraf=require(_0x8bf5('0x7'));var config=require(_0x8bf5('0x8'));var attributes=require(_0x8bf5('0x9'));module[_0x8bf5('0xa')]=function(_0x375bfe,_0x4cb4df){return _0x375bfe[_0x8bf5('0xb')](_0x8bf5('0xc'),attributes,{'tableName':_0x8bf5('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x88eb=['moment','request-promise','path','rimraf','./faxQueue.attributes','exports','define','FaxQueue','fax_queues','lodash','../../config/logger','api'];(function(_0xa1bf00,_0x4c91f9){var _0x2357d=function(_0x24b463){while(--_0x24b463){_0xa1bf00['push'](_0xa1bf00['shift']());}};_0x2357d(++_0x4c91f9);}(_0x88eb,0xc9));var _0xb88e=function(_0x476d87,_0xf0b58f){_0x476d87=_0x476d87-0x0;var _0x2498d9=_0x88eb[_0x476d87];return _0x2498d9;};'use strict';var _=require(_0xb88e('0x0'));var util=require('util');var logger=require(_0xb88e('0x1'))(_0xb88e('0x2'));var moment=require(_0xb88e('0x3'));var BPromise=require('bluebird');var rp=require(_0xb88e('0x4'));var fs=require('fs');var path=require(_0xb88e('0x5'));var rimraf=require(_0xb88e('0x6'));var config=require('../../config/environment');var attributes=require(_0xb88e('0x7'));module[_0xb88e('0x8')]=function(_0x317975,_0x3a27ae){return _0x317975[_0xb88e('0x9')](_0xb88e('0xa'),attributes,{'tableName':_0xb88e('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 ab8368b..2e1a978 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 _0x4a3f=['./faxQueue.socket','register','request','then','FaxQueue,\x20%s,\x20%s','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','info','request\x20sent','result','catch','GetFaxQueue','FaxQueue','findAll','raw','options','where','attributes','limit','include','map','model','ShowFaxQueue','find','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost'];(function(_0x4674d8,_0xf12022){var _0x26f97d=function(_0x9984b7){while(--_0x9984b7){_0x4674d8['push'](_0x4674d8['shift']());}};_0x26f97d(++_0xf12022);}(_0x4a3f,0x195));var _0xf4a3=function(_0x2b47ad,_0x55c7cc){_0x2b47ad=_0x2b47ad-0x0;var _0x1a2426=_0x4a3f[_0x2b47ad];return _0x1a2426;};'use strict';var _=require(_0xf4a3('0x0'));var util=require(_0xf4a3('0x1'));var moment=require(_0xf4a3('0x2'));var BPromise=require(_0xf4a3('0x3'));var rs=require(_0xf4a3('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf4a3('0x5'))['db'];var utils=require(_0xf4a3('0x6'));var logger=require(_0xf4a3('0x7'))(_0xf4a3('0x8'));var config=require('../../config/environment');var jayson=require(_0xf4a3('0x9'));var client=jayson[_0xf4a3('0xa')][_0xf4a3('0xb')]({'port':0x232a});config[_0xf4a3('0xc')]=_[_0xf4a3('0xd')](config[_0xf4a3('0xc')],{'host':_0xf4a3('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xf4a3('0xf'))[_0xf4a3('0x10')](socket);function respondWithRpcPromise(_0xb0a73e,_0x387ed8,_0x1839b0){return new BPromise(function(_0x465065,_0xf1718d){return client[_0xf4a3('0x11')](_0xb0a73e,_0x1839b0)[_0xf4a3('0x12')](function(_0x153e92){logger['info'](_0xf4a3('0x13'),_0x387ed8,'request\x20sent');logger[_0xf4a3('0x14')](_0xf4a3('0x15'),_0x387ed8,'request\x20sent',JSON[_0xf4a3('0x16')](_0x153e92));if(_0x153e92[_0xf4a3('0x17')]){if(_0x153e92[_0xf4a3('0x17')]['code']===0x1f4){logger['error'](_0xf4a3('0x13'),_0x387ed8,_0x153e92[_0xf4a3('0x17')][_0xf4a3('0x18')]);return _0xf1718d(_0x153e92[_0xf4a3('0x17')][_0xf4a3('0x18')]);}logger['error'](_0xf4a3('0x13'),_0x387ed8,_0x153e92[_0xf4a3('0x17')][_0xf4a3('0x18')]);return _0x465065(_0x153e92['error'][_0xf4a3('0x18')]);}else{logger[_0xf4a3('0x19')]('FaxQueue,\x20%s,\x20%s',_0x387ed8,_0xf4a3('0x1a'));_0x465065(_0x153e92[_0xf4a3('0x1b')][_0xf4a3('0x18')]);}})[_0xf4a3('0x1c')](function(_0x4ac99a){logger[_0xf4a3('0x17')](_0xf4a3('0x13'),_0x387ed8,_0x4ac99a);_0xf1718d(_0x4ac99a);});});}exports[_0xf4a3('0x1d')]=function(_0x1e6b73){var _0x3b224e=this;return new Promise(function(_0x354784,_0x13e8aa){return db[_0xf4a3('0x1e')][_0xf4a3('0x1f')]({'raw':_0x1e6b73['options']?_0x1e6b73['options'][_0xf4a3('0x20')]===undefined?!![]:![]:!![],'where':_0x1e6b73[_0xf4a3('0x21')]?_0x1e6b73['options'][_0xf4a3('0x22')]||null:null,'attributes':_0x1e6b73[_0xf4a3('0x21')]?_0x1e6b73[_0xf4a3('0x21')][_0xf4a3('0x23')]||null:null,'limit':_0x1e6b73['options']?_0x1e6b73[_0xf4a3('0x21')][_0xf4a3('0x24')]||null:null,'include':_0x1e6b73[_0xf4a3('0x21')]?_0x1e6b73[_0xf4a3('0x21')][_0xf4a3('0x25')]?_[_0xf4a3('0x26')](_0x1e6b73['options'][_0xf4a3('0x25')],function(_0x358a32){return{'model':db[_0x358a32[_0xf4a3('0x27')]],'as':_0x358a32['as'],'attributes':_0x358a32[_0xf4a3('0x23')],'include':_0x358a32['include']?_['map'](_0x358a32[_0xf4a3('0x25')],function(_0xe227bd){return{'model':db[_0xe227bd[_0xf4a3('0x27')]],'as':_0xe227bd['as'],'attributes':_0xe227bd[_0xf4a3('0x23')],'include':_0xe227bd[_0xf4a3('0x25')]?_[_0xf4a3('0x26')](_0xe227bd[_0xf4a3('0x25')],function(_0x346d38){return{'model':db[_0x346d38[_0xf4a3('0x27')]],'as':_0x346d38['as'],'attributes':_0x346d38['attributes']};}):[]};}):[]};}):[]:[]})[_0xf4a3('0x12')](function(_0x5c768a){logger['info'](_0xf4a3('0x1d'),_0x1e6b73);logger[_0xf4a3('0x14')](_0xf4a3('0x1d'),_0x1e6b73,JSON[_0xf4a3('0x16')](_0x5c768a));_0x354784(_0x5c768a);})['catch'](function(_0x1de72b){logger['error'](_0xf4a3('0x1d'),_0x1de72b[_0xf4a3('0x18')],_0x1e6b73);_0x13e8aa(_0x3b224e['error'](0x1f4,_0x1de72b[_0xf4a3('0x18')]));});});};exports[_0xf4a3('0x28')]=function(_0x2d2cde){var _0x879711=this;return new Promise(function(_0x4eb9e3,_0x2467e1){return db[_0xf4a3('0x1e')][_0xf4a3('0x29')]({'raw':_0x2d2cde['options']?_0x2d2cde['options'][_0xf4a3('0x20')]===undefined?!![]:![]:!![],'where':_0x2d2cde[_0xf4a3('0x21')]?_0x2d2cde[_0xf4a3('0x21')][_0xf4a3('0x22')]||null:null,'attributes':_0x2d2cde[_0xf4a3('0x21')]?_0x2d2cde[_0xf4a3('0x21')][_0xf4a3('0x23')]||null:null,'include':_0x2d2cde[_0xf4a3('0x21')]?_0x2d2cde[_0xf4a3('0x21')][_0xf4a3('0x25')]?_[_0xf4a3('0x26')](_0x2d2cde[_0xf4a3('0x21')][_0xf4a3('0x25')],function(_0xb73d40){return{'model':db[_0xb73d40[_0xf4a3('0x27')]],'as':_0xb73d40['as'],'attributes':_0xb73d40[_0xf4a3('0x23')],'include':_0xb73d40[_0xf4a3('0x25')]?_['map'](_0xb73d40['include'],function(_0x2b7a2e){return{'model':db[_0x2b7a2e[_0xf4a3('0x27')]],'as':_0x2b7a2e['as'],'attributes':_0x2b7a2e[_0xf4a3('0x23')],'include':_0x2b7a2e[_0xf4a3('0x25')]?_[_0xf4a3('0x26')](_0x2b7a2e[_0xf4a3('0x25')],function(_0x117a8d){return{'model':db[_0x117a8d['model']],'as':_0x117a8d['as'],'attributes':_0x117a8d['attributes']};}):[]};}):[]};}):[]:[]})[_0xf4a3('0x12')](function(_0xb24885){logger[_0xf4a3('0x19')](_0xf4a3('0x28'),_0x2d2cde);logger['debug'](_0xf4a3('0x28'),_0x2d2cde,JSON[_0xf4a3('0x16')](_0xb24885));_0x4eb9e3(_0xb24885);})['catch'](function(_0xdc080f){logger[_0xf4a3('0x17')]('ShowFaxQueue',_0xdc080f['message'],_0x2d2cde);_0x2467e1(_0x879711[_0xf4a3('0x17')](0x1f4,_0xdc080f[_0xf4a3('0x18')]));});});}; \ No newline at end of file +var _0x69a5=['../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','socket.io-emitter','./faxQueue.socket','then','info','FaxQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','FaxQueue,\x20%s,\x20%s','result','catch','GetFaxQueue','findAll','options','raw','where','attributes','include','map','model','stringify','ShowFaxQueue','FaxQueue','debug','lodash','util','randomstring','../../mysqldb'];(function(_0x4fbfd9,_0x3ab91a){var _0x31dc94=function(_0x11e53b){while(--_0x11e53b){_0x4fbfd9['push'](_0x4fbfd9['shift']());}};_0x31dc94(++_0x3ab91a);}(_0x69a5,0x193));var _0x569a=function(_0x3749af,_0xd40d86){_0x3749af=_0x3749af-0x0;var _0x24411c=_0x69a5[_0x3749af];return _0x24411c;};'use strict';var _=require(_0x569a('0x0'));var util=require(_0x569a('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x569a('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x569a('0x3'))['db'];var utils=require(_0x569a('0x4'));var logger=require(_0x569a('0x5'))(_0x569a('0x6'));var config=require(_0x569a('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x569a('0x8')][_0x569a('0x9')]({'port':0x232a});config[_0x569a('0xa')]=_['defaults'](config['redis'],{'host':_0x569a('0xb'),'port':0x18eb});var socket=require(_0x569a('0xc'))(new Redis(config[_0x569a('0xa')]));require(_0x569a('0xd'))['register'](socket);function respondWithRpcPromise(_0x477060,_0x13805c,_0x488678){return new BPromise(function(_0x19ba9a,_0x126693){return client['request'](_0x477060,_0x488678)[_0x569a('0xe')](function(_0x1aac37){logger[_0x569a('0xf')]('FaxQueue,\x20%s,\x20%s',_0x13805c,'request\x20sent');logger['debug'](_0x569a('0x10'),_0x13805c,_0x569a('0x11'),JSON['stringify'](_0x1aac37));if(_0x1aac37[_0x569a('0x12')]){if(_0x1aac37[_0x569a('0x12')][_0x569a('0x13')]===0x1f4){logger['error']('FaxQueue,\x20%s,\x20%s',_0x13805c,_0x1aac37[_0x569a('0x12')][_0x569a('0x14')]);return _0x126693(_0x1aac37['error'][_0x569a('0x14')]);}logger[_0x569a('0x12')](_0x569a('0x15'),_0x13805c,_0x1aac37[_0x569a('0x12')][_0x569a('0x14')]);return _0x19ba9a(_0x1aac37[_0x569a('0x12')][_0x569a('0x14')]);}else{logger['info'](_0x569a('0x15'),_0x13805c,_0x569a('0x11'));_0x19ba9a(_0x1aac37[_0x569a('0x16')][_0x569a('0x14')]);}})[_0x569a('0x17')](function(_0x165be6){logger['error'](_0x569a('0x15'),_0x13805c,_0x165be6);_0x126693(_0x165be6);});});}exports[_0x569a('0x18')]=function(_0x332a65){var _0xa160a7=this;return new Promise(function(_0xe08317,_0x5aba64){return db['FaxQueue'][_0x569a('0x19')]({'raw':_0x332a65[_0x569a('0x1a')]?_0x332a65['options'][_0x569a('0x1b')]===undefined?!![]:![]:!![],'where':_0x332a65['options']?_0x332a65[_0x569a('0x1a')][_0x569a('0x1c')]||null:null,'attributes':_0x332a65[_0x569a('0x1a')]?_0x332a65[_0x569a('0x1a')][_0x569a('0x1d')]||null:null,'limit':_0x332a65[_0x569a('0x1a')]?_0x332a65[_0x569a('0x1a')]['limit']||null:null,'include':_0x332a65[_0x569a('0x1a')]?_0x332a65['options'][_0x569a('0x1e')]?_[_0x569a('0x1f')](_0x332a65['options'][_0x569a('0x1e')],function(_0x1f3f09){return{'model':db[_0x1f3f09[_0x569a('0x20')]],'as':_0x1f3f09['as'],'attributes':_0x1f3f09[_0x569a('0x1d')],'include':_0x1f3f09[_0x569a('0x1e')]?_[_0x569a('0x1f')](_0x1f3f09[_0x569a('0x1e')],function(_0x39a37e){return{'model':db[_0x39a37e[_0x569a('0x20')]],'as':_0x39a37e['as'],'attributes':_0x39a37e['attributes'],'include':_0x39a37e[_0x569a('0x1e')]?_['map'](_0x39a37e[_0x569a('0x1e')],function(_0xbf8de4){return{'model':db[_0xbf8de4[_0x569a('0x20')]],'as':_0xbf8de4['as'],'attributes':_0xbf8de4['attributes']};}):[]};}):[]};}):[]:[]})[_0x569a('0xe')](function(_0x49b657){logger[_0x569a('0xf')](_0x569a('0x18'),_0x332a65);logger['debug']('GetFaxQueue',_0x332a65,JSON[_0x569a('0x21')](_0x49b657));_0xe08317(_0x49b657);})['catch'](function(_0x278e01){logger[_0x569a('0x12')](_0x569a('0x18'),_0x278e01['message'],_0x332a65);_0x5aba64(_0xa160a7['error'](0x1f4,_0x278e01['message']));});});};exports[_0x569a('0x22')]=function(_0x58052b){var _0x4736e2=this;return new Promise(function(_0x49bf3c,_0xb6fd7a){return db[_0x569a('0x23')]['find']({'raw':_0x58052b[_0x569a('0x1a')]?_0x58052b[_0x569a('0x1a')][_0x569a('0x1b')]===undefined?!![]:![]:!![],'where':_0x58052b[_0x569a('0x1a')]?_0x58052b[_0x569a('0x1a')][_0x569a('0x1c')]||null:null,'attributes':_0x58052b['options']?_0x58052b[_0x569a('0x1a')]['attributes']||null:null,'include':_0x58052b[_0x569a('0x1a')]?_0x58052b['options'][_0x569a('0x1e')]?_[_0x569a('0x1f')](_0x58052b[_0x569a('0x1a')][_0x569a('0x1e')],function(_0x13f75d){return{'model':db[_0x13f75d[_0x569a('0x20')]],'as':_0x13f75d['as'],'attributes':_0x13f75d[_0x569a('0x1d')],'include':_0x13f75d['include']?_['map'](_0x13f75d[_0x569a('0x1e')],function(_0x17b75b){return{'model':db[_0x17b75b[_0x569a('0x20')]],'as':_0x17b75b['as'],'attributes':_0x17b75b[_0x569a('0x1d')],'include':_0x17b75b[_0x569a('0x1e')]?_[_0x569a('0x1f')](_0x17b75b[_0x569a('0x1e')],function(_0x596c22){return{'model':db[_0x596c22[_0x569a('0x20')]],'as':_0x596c22['as'],'attributes':_0x596c22[_0x569a('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x40f4f9){logger[_0x569a('0xf')]('ShowFaxQueue',_0x58052b);logger[_0x569a('0x24')]('ShowFaxQueue',_0x58052b,JSON[_0x569a('0x21')](_0x40f4f9));_0x49bf3c(_0x40f4f9);})[_0x569a('0x17')](function(_0x3aec95){logger[_0x569a('0x12')](_0x569a('0x22'),_0x3aec95[_0x569a('0x14')],_0x58052b);_0xb6fd7a(_0x4736e2[_0x569a('0x12')](0x1f4,_0x3aec95[_0x569a('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index ed26648..206fbbd 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 _0x0e5d=['register','faxQueue:','./faxQueue.events','save','update','emit','removeListener'];(function(_0x232a66,_0x20d334){var _0x160f44=function(_0x36715d){while(--_0x36715d){_0x232a66['push'](_0x232a66['shift']());}};_0x160f44(++_0x20d334);}(_0x0e5d,0x152));var _0xd0e5=function(_0x57554d,_0x472b2d){_0x57554d=_0x57554d-0x0;var _0x2173f7=_0x0e5d[_0x57554d];return _0x2173f7;};'use strict';var FaxQueueEvents=require(_0xd0e5('0x0'));var events=[_0xd0e5('0x1'),'remove',_0xd0e5('0x2')];function createListener(_0x30e3b9,_0x12f47c){return function(_0x5702cd){_0x12f47c[_0xd0e5('0x3')](_0x30e3b9,_0x5702cd);};}function removeListener(_0x25644d,_0x33e42d){return function(){FaxQueueEvents[_0xd0e5('0x4')](_0x25644d,_0x33e42d);};}exports[_0xd0e5('0x5')]=function(_0x46d98f){for(var _0x9f0912=0x0,_0x16a07d=events['length'];_0x9f0912<_0x16a07d;_0x9f0912++){var _0x450231=events[_0x9f0912];var _0xba9514=createListener(_0xd0e5('0x6')+_0x450231,_0x46d98f);FaxQueueEvents['on'](_0x450231,_0xba9514);}}; \ No newline at end of file +var _0x3fde=['save','remove','update','emit','removeListener','register','length','faxQueue:','./faxQueue.events'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x3fde,0xa1));var _0xe3fd=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x3fde[_0x42cae2];return _0x5f256f;};'use strict';var FaxQueueEvents=require(_0xe3fd('0x0'));var events=[_0xe3fd('0x1'),_0xe3fd('0x2'),_0xe3fd('0x3')];function createListener(_0x2e7443,_0x47af5f){return function(_0x370604){_0x47af5f[_0xe3fd('0x4')](_0x2e7443,_0x370604);};}function removeListener(_0x528aa5,_0x52de69){return function(){FaxQueueEvents[_0xe3fd('0x5')](_0x528aa5,_0x52de69);};}exports[_0xe3fd('0x6')]=function(_0x5c87e0){for(var _0x2b2c8e=0x0,_0x301363=events[_0xe3fd('0x7')];_0x2b2c8e<_0x301363;_0x2b2c8e++){var _0x221ee7=events[_0x2b2c8e];var _0x446f39=createListener(_0xe3fd('0x8')+_0x221ee7,_0x5c87e0);FaxQueueEvents['on'](_0x221ee7,_0x446f39);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index d6e918f..78bad59 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 _0xe2bc=['/:id/users','update','destroy','delete','removeTeams','removeAgents','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./faxQueue.controller','get','isAuthenticated','index','describe','/:id','show','/:id/members','getMembers','/:id/teams','getAgents','post','create'];(function(_0x4c41c4,_0x75bc8a){var _0x2bdc48=function(_0x2ea5e8){while(--_0x2ea5e8){_0x4c41c4['push'](_0x4c41c4['shift']());}};_0x2bdc48(++_0x75bc8a);}(_0xe2bc,0x1a6));var _0xce2b=function(_0x2112d4,_0x3c863c){_0x2112d4=_0x2112d4-0x0;var _0x434972=_0xe2bc[_0x2112d4];return _0x434972;};'use strict';var multer=require(_0xce2b('0x0'));var util=require('util');var path=require(_0xce2b('0x1'));var timeout=require('connect-timeout');var express=require(_0xce2b('0x2'));var router=express[_0xce2b('0x3')]();var fs_extra=require(_0xce2b('0x4'));var auth=require(_0xce2b('0x5'));var interaction=require(_0xce2b('0x6'));var config=require('../../config/environment');var controller=require(_0xce2b('0x7'));router[_0xce2b('0x8')]('/',auth[_0xce2b('0x9')](),controller[_0xce2b('0xa')]);router[_0xce2b('0x8')]('/describe',auth[_0xce2b('0x9')](),controller[_0xce2b('0xb')]);router['get'](_0xce2b('0xc'),auth[_0xce2b('0x9')](),controller[_0xce2b('0xd')]);router[_0xce2b('0x8')](_0xce2b('0xe'),auth[_0xce2b('0x9')](),controller[_0xce2b('0xf')]);router[_0xce2b('0x8')](_0xce2b('0x10'),auth[_0xce2b('0x9')](),controller['getTeams']);router[_0xce2b('0x8')]('/:id/users',auth[_0xce2b('0x9')](),controller[_0xce2b('0x11')]);router[_0xce2b('0x12')]('/',auth[_0xce2b('0x9')](),controller[_0xce2b('0x13')]);router[_0xce2b('0x12')](_0xce2b('0x10'),auth[_0xce2b('0x9')](),controller['addTeams']);router[_0xce2b('0x12')](_0xce2b('0x14'),auth['isAuthenticated'](),controller['addAgents']);router['put'](_0xce2b('0xc'),auth[_0xce2b('0x9')](),controller[_0xce2b('0x15')]);router['delete']('/:id',auth[_0xce2b('0x9')](),controller[_0xce2b('0x16')]);router[_0xce2b('0x17')](_0xce2b('0x10'),auth[_0xce2b('0x9')](),controller[_0xce2b('0x18')]);router[_0xce2b('0x17')](_0xce2b('0x14'),auth[_0xce2b('0x9')](),controller[_0xce2b('0x19')]);module['exports']=router; \ No newline at end of file +var _0xd9fb=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','index','isAuthenticated','describe','/:id','show','/:id/members','getMembers','/:id/teams','post','create','addTeams','/:id/users','put','update','delete','removeTeams','removeAgents'];(function(_0x1deb03,_0xd05ad8){var _0x189fe7=function(_0x321225){while(--_0x321225){_0x1deb03['push'](_0x1deb03['shift']());}};_0x189fe7(++_0xd05ad8);}(_0xd9fb,0x189));var _0xbd9f=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0xd9fb[_0x13d07a];return _0x5ee0ee;};'use strict';var multer=require(_0xbd9f('0x0'));var util=require(_0xbd9f('0x1'));var path=require(_0xbd9f('0x2'));var timeout=require(_0xbd9f('0x3'));var express=require(_0xbd9f('0x4'));var router=express[_0xbd9f('0x5')]();var fs_extra=require(_0xbd9f('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xbd9f('0x7'));var config=require(_0xbd9f('0x8'));var controller=require('./faxQueue.controller');router[_0xbd9f('0x9')]('/',auth['isAuthenticated'](),controller[_0xbd9f('0xa')]);router[_0xbd9f('0x9')]('/describe',auth[_0xbd9f('0xb')](),controller[_0xbd9f('0xc')]);router[_0xbd9f('0x9')](_0xbd9f('0xd'),auth['isAuthenticated'](),controller[_0xbd9f('0xe')]);router[_0xbd9f('0x9')](_0xbd9f('0xf'),auth[_0xbd9f('0xb')](),controller[_0xbd9f('0x10')]);router[_0xbd9f('0x9')](_0xbd9f('0x11'),auth['isAuthenticated'](),controller['getTeams']);router['get']('/:id/users',auth[_0xbd9f('0xb')](),controller['getAgents']);router[_0xbd9f('0x12')]('/',auth[_0xbd9f('0xb')](),controller[_0xbd9f('0x13')]);router['post'](_0xbd9f('0x11'),auth['isAuthenticated'](),controller[_0xbd9f('0x14')]);router[_0xbd9f('0x12')](_0xbd9f('0x15'),auth[_0xbd9f('0xb')](),controller['addAgents']);router[_0xbd9f('0x16')](_0xbd9f('0xd'),auth[_0xbd9f('0xb')](),controller[_0xbd9f('0x17')]);router[_0xbd9f('0x18')](_0xbd9f('0xd'),auth[_0xbd9f('0xb')](),controller['destroy']);router['delete'](_0xbd9f('0x11'),auth['isAuthenticated'](),controller[_0xbd9f('0x19')]);router[_0xbd9f('0x18')](_0xbd9f('0x15'),auth[_0xbd9f('0xb')](),controller[_0xbd9f('0x1a')]);module[_0xbd9f('0x1b')]=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index a89b771..753b9ff 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 _0x9e58=['sequelize','exports','STRING','DATE'];(function(_0x152e41,_0x25540c){var _0xc94d33=function(_0x36e3bb){while(--_0x36e3bb){_0x152e41['push'](_0x152e41['shift']());}};_0xc94d33(++_0x25540c);}(_0x9e58,0xec));var _0x89e5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9e58[_0x3dd15e];return _0x231fd0;};'use strict';var moment=require('moment');var Sequelize=require(_0x89e5('0x0'));module[_0x89e5('0x1')]={'uniqueid':{'type':Sequelize[_0x89e5('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x89e5('0x2')]},'joinAt':{'type':Sequelize[_0x89e5('0x3')]},'leaveAt':{'type':Sequelize[_0x89e5('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x89e5('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xc012=['sequelize','STRING','DATE','moment'];(function(_0x30e776,_0x2eeb1f){var _0x28a302=function(_0x35118b){while(--_0x35118b){_0x30e776['push'](_0x30e776['shift']());}};_0x28a302(++_0x2eeb1f);}(_0xc012,0x97));var _0x2c01=function(_0x8f55d9,_0x1b1b8d){_0x8f55d9=_0x8f55d9-0x0;var _0x164443=_0xc012[_0x8f55d9];return _0x164443;};'use strict';var moment=require(_0x2c01('0x0'));var Sequelize=require(_0x2c01('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x2c01('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x2c01('0x2')]},'joinAt':{'type':Sequelize[_0x2c01('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x2c01('0x3')]},'exitAt':{'type':Sequelize[_0x2c01('0x3')]},'reason':{'type':Sequelize[_0x2c01('0x2')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index e844c53..fbe85e2 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 _0xfe57=['to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','apply','reject','save','update','then','name','send','map','FaxQueueReport','fieldName','key','model','query','filters','intersection','fields','attributes','length','sort','where','filter','merge','type','VIRTUAL','options','include','findAll','rows','params','keys','includeAll','find','catch','create','body','destroy','describe','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox'];(function(_0x80f51a,_0x32e95e){var _0x327148=function(_0x16f788){while(--_0x16f788){_0x80f51a['push'](_0x80f51a['shift']());}};_0x327148(++_0x32e95e);}(_0xfe57,0x195));var _0x7fe5=function(_0x3e531a,_0x28a82a){_0x3e531a=_0x3e531a-0x0;var _0x3c2574=_0xfe57[_0x3e531a];return _0x3c2574;};'use strict';var emlformat=require(_0x7fe5('0x0'));var rimraf=require(_0x7fe5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x7fe5('0x2'));var moment=require(_0x7fe5('0x3'));var BPromise=require(_0x7fe5('0x4'));var Mustache=require(_0x7fe5('0x5'));var util=require(_0x7fe5('0x6'));var path=require(_0x7fe5('0x7'));var sox=require(_0x7fe5('0x8'));var csv=require(_0x7fe5('0x9'));var ejs=require(_0x7fe5('0xa'));var fs=require('fs');var fs_extra=require(_0x7fe5('0xb'));var _=require(_0x7fe5('0xc'));var squel=require(_0x7fe5('0xd'));var crypto=require(_0x7fe5('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x7fe5('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7fe5('0x10'));var Papa=require(_0x7fe5('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x7fe5('0x12'));var as=require(_0x7fe5('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7fe5('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x7fe5('0x15'));var licenseUtil=require(_0x7fe5('0x16'));var db=require(_0x7fe5('0x17'))['db'];function respondWithStatusCode(_0x225fc3,_0x53f76c){_0x53f76c=_0x53f76c||0xcc;return function(_0x329c95){if(_0x329c95){return _0x225fc3[_0x7fe5('0x18')](_0x53f76c);}return _0x225fc3['status'](_0x53f76c)[_0x7fe5('0x19')]();};}function respondWithResult(_0x54cfb2,_0x1f84b5){_0x1f84b5=_0x1f84b5||0xc8;return function(_0x2d297b){if(_0x2d297b){return _0x54cfb2['status'](_0x1f84b5)[_0x7fe5('0x1a')](_0x2d297b);}};}function respondWithFilteredResult(_0x56e76f,_0x39f175){return function(_0x221ab2){if(_0x221ab2){var _0xbdf0a4=typeof _0x39f175[_0x7fe5('0x1b')]===_0x7fe5('0x1c')&&typeof _0x39f175[_0x7fe5('0x1d')]==='undefined';var _0x166e23=_0x221ab2[_0x7fe5('0x1e')];var _0x340d5e=_0xbdf0a4?0x0:_0x39f175[_0x7fe5('0x1b')];var _0x2533db=_0xbdf0a4?_0x221ab2[_0x7fe5('0x1e')]:_0x39f175[_0x7fe5('0x1b')]+_0x39f175[_0x7fe5('0x1d')];var _0x478523;if(_0x2533db>=_0x166e23){_0x2533db=_0x166e23;_0x478523=0xc8;}else{_0x478523=0xce;}_0x56e76f[_0x7fe5('0x1f')](_0x478523);return _0x56e76f['set']('Content-Range',_0x340d5e+'-'+_0x2533db+'/'+_0x166e23)[_0x7fe5('0x1a')](_0x221ab2);}return null;};}function patchUpdates(_0x459c2d){return function(_0x2f6592){try{jsonpatch[_0x7fe5('0x20')](_0x2f6592,_0x459c2d,!![]);}catch(_0x39c560){return BPromise[_0x7fe5('0x21')](_0x39c560);}return _0x2f6592[_0x7fe5('0x22')]();};}function saveUpdates(_0xdd9df7,_0x1b271c){return function(_0x28a7fd){if(_0x28a7fd){return _0x28a7fd[_0x7fe5('0x23')](_0xdd9df7)[_0x7fe5('0x24')](function(_0x54ee98){return _0x54ee98;});}return null;};}function removeEntity(_0x3e7340,_0x2f39e0){return function(_0x43e547){if(_0x43e547){return _0x43e547['destroy']()[_0x7fe5('0x24')](function(){_0x3e7340['status'](0xcc)[_0x7fe5('0x19')]();});}};}function handleEntityNotFound(_0x53f522,_0x5c3b37){return function(_0x190355){if(!_0x190355){_0x53f522[_0x7fe5('0x18')](0x194);}return _0x190355;};}function handleError(_0x2a96f4,_0x399c55){_0x399c55=_0x399c55||0x1f4;return function(_0x4393c3){logger['error'](_0x4393c3['stack']);if(_0x4393c3[_0x7fe5('0x25')]){delete _0x4393c3[_0x7fe5('0x25')];}_0x2a96f4[_0x7fe5('0x1f')](_0x399c55)[_0x7fe5('0x26')](_0x4393c3);};}exports['index']=function(_0x46f816,_0x4a77e9){var _0x150ab9={},_0x1420de={},_0x204bc8={'count':0x0,'rows':[]};var _0x28a689=_[_0x7fe5('0x27')](db[_0x7fe5('0x28')]['rawAttributes'],function(_0xe521c6){return{'name':_0xe521c6[_0x7fe5('0x29')],'type':_0xe521c6['type'][_0x7fe5('0x2a')]};});_0x1420de[_0x7fe5('0x2b')]=_[_0x7fe5('0x27')](_0x28a689,_0x7fe5('0x25'));_0x1420de[_0x7fe5('0x2c')]=_['keys'](_0x46f816['query']);_0x1420de[_0x7fe5('0x2d')]=_[_0x7fe5('0x2e')](_0x1420de[_0x7fe5('0x2b')],_0x1420de[_0x7fe5('0x2c')]);_0x150ab9['attributes']=_[_0x7fe5('0x2e')](_0x1420de[_0x7fe5('0x2b')],qs[_0x7fe5('0x2f')](_0x46f816[_0x7fe5('0x2c')][_0x7fe5('0x2f')]));_0x150ab9[_0x7fe5('0x30')]=_0x150ab9['attributes'][_0x7fe5('0x31')]?_0x150ab9[_0x7fe5('0x30')]:_0x1420de[_0x7fe5('0x2b')];if(!_0x46f816[_0x7fe5('0x2c')]['hasOwnProperty']('nolimit')){_0x150ab9[_0x7fe5('0x1d')]=qs['limit'](_0x46f816[_0x7fe5('0x2c')]['limit']);_0x150ab9[_0x7fe5('0x1b')]=qs['offset'](_0x46f816['query']['offset']);}_0x150ab9['order']=qs[_0x7fe5('0x32')](_0x46f816[_0x7fe5('0x2c')]['sort']);_0x150ab9[_0x7fe5('0x33')]=qs[_0x7fe5('0x2d')](_['pick'](_0x46f816[_0x7fe5('0x2c')],_0x1420de['filters']),_0x28a689);if(_0x46f816['query'][_0x7fe5('0x34')]){_0x150ab9[_0x7fe5('0x33')]=_[_0x7fe5('0x35')](_0x150ab9[_0x7fe5('0x33')],{'$or':_[_0x7fe5('0x27')](_0x28a689,function(_0x4c4b05){if(_0x4c4b05[_0x7fe5('0x36')]!==_0x7fe5('0x37')){var _0x5839b2={};_0x5839b2[_0x4c4b05[_0x7fe5('0x25')]]={'$like':'%'+_0x46f816[_0x7fe5('0x2c')][_0x7fe5('0x34')]+'%'};return _0x5839b2;}})});}_0x150ab9=_[_0x7fe5('0x35')]({},_0x150ab9,_0x46f816[_0x7fe5('0x38')]);var _0x1c81c8={'where':_0x150ab9[_0x7fe5('0x33')]};return db['FaxQueueReport']['count'](_0x1c81c8)[_0x7fe5('0x24')](function(_0x5f5db0){_0x204bc8[_0x7fe5('0x1e')]=_0x5f5db0;if(_0x46f816[_0x7fe5('0x2c')]['includeAll']){_0x150ab9[_0x7fe5('0x39')]=[{'all':!![]}];}return db[_0x7fe5('0x28')][_0x7fe5('0x3a')](_0x150ab9);})[_0x7fe5('0x24')](function(_0x2fd004){_0x204bc8[_0x7fe5('0x3b')]=_0x2fd004;return _0x204bc8;})[_0x7fe5('0x24')](respondWithFilteredResult(_0x4a77e9,_0x150ab9))['catch'](handleError(_0x4a77e9,null));};exports['show']=function(_0x411002,_0x4f81ca){var _0xad0b05={'raw':!![],'where':{'id':_0x411002[_0x7fe5('0x3c')]['id']}},_0x1a3e0d={};_0x1a3e0d[_0x7fe5('0x2b')]=_['keys'](db[_0x7fe5('0x28')]['rawAttributes']);_0x1a3e0d['query']=_[_0x7fe5('0x3d')](_0x411002[_0x7fe5('0x2c')]);_0x1a3e0d['filters']=_[_0x7fe5('0x2e')](_0x1a3e0d[_0x7fe5('0x2b')],_0x1a3e0d[_0x7fe5('0x2c')]);_0xad0b05[_0x7fe5('0x30')]=_[_0x7fe5('0x2e')](_0x1a3e0d['model'],qs[_0x7fe5('0x2f')](_0x411002[_0x7fe5('0x2c')]['fields']));_0xad0b05[_0x7fe5('0x30')]=_0xad0b05[_0x7fe5('0x30')][_0x7fe5('0x31')]?_0xad0b05[_0x7fe5('0x30')]:_0x1a3e0d['model'];if(_0x411002[_0x7fe5('0x2c')][_0x7fe5('0x3e')]){_0xad0b05[_0x7fe5('0x39')]=[{'all':!![]}];}_0xad0b05=_['merge']({},_0xad0b05,_0x411002[_0x7fe5('0x38')]);return db[_0x7fe5('0x28')][_0x7fe5('0x3f')](_0xad0b05)['then'](handleEntityNotFound(_0x4f81ca,null))[_0x7fe5('0x24')](respondWithResult(_0x4f81ca,null))[_0x7fe5('0x40')](handleError(_0x4f81ca,null));};exports[_0x7fe5('0x41')]=function(_0x4b8642,_0x19c4a6){return db[_0x7fe5('0x28')][_0x7fe5('0x41')](_0x4b8642[_0x7fe5('0x42')],{})[_0x7fe5('0x24')](respondWithResult(_0x19c4a6,0xc9))[_0x7fe5('0x40')](handleError(_0x19c4a6,null));};exports[_0x7fe5('0x23')]=function(_0x447b57,_0x446f01){if(_0x447b57[_0x7fe5('0x42')]['id']){delete _0x447b57[_0x7fe5('0x42')]['id'];}return db['FaxQueueReport']['find']({'where':{'id':_0x447b57['params']['id']}})['then'](handleEntityNotFound(_0x446f01,null))[_0x7fe5('0x24')](saveUpdates(_0x447b57['body'],null))[_0x7fe5('0x24')](respondWithResult(_0x446f01,null))[_0x7fe5('0x40')](handleError(_0x446f01,null));};exports[_0x7fe5('0x43')]=function(_0x1d9ca8,_0x362f33){return db['FaxQueueReport'][_0x7fe5('0x3f')]({'where':{'id':_0x1d9ca8[_0x7fe5('0x3c')]['id']}})[_0x7fe5('0x24')](handleEntityNotFound(_0x362f33,null))[_0x7fe5('0x24')](removeEntity(_0x362f33,null))[_0x7fe5('0x40')](handleError(_0x362f33,null));};exports[_0x7fe5('0x44')]=function(_0x16ccca,_0x2165b0){return db[_0x7fe5('0x28')][_0x7fe5('0x44')]()['then'](respondWithResult(_0x2165b0,null))[_0x7fe5('0x40')](handleError(_0x2165b0,null));}; \ No newline at end of file +var _0x765e=['type','VIRTUAL','includeAll','include','findAll','rows','catch','rawAttributes','find','create','body','params','describe','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','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../mysqldb','sendStatus','end','status','undefined','limit','count','offset','set','json','apply','update','then','destroy','error','stack','index','map','FaxQueueReport','fieldName','key','model','name','query','filters','intersection','attributes','fields','length','order','sort','pick','filter','where','merge'];(function(_0x4a0816,_0x218420){var _0x34681f=function(_0x3a7d35){while(--_0x3a7d35){_0x4a0816['push'](_0x4a0816['shift']());}};_0x34681f(++_0x218420);}(_0x765e,0x131));var _0xe765=function(_0x1e890f,_0x3693e5){_0x1e890f=_0x1e890f-0x0;var _0x250a60=_0x765e[_0x1e890f];return _0x250a60;};'use strict';var emlformat=require(_0xe765('0x0'));var rimraf=require(_0xe765('0x1'));var zipdir=require(_0xe765('0x2'));var jsonpatch=require(_0xe765('0x3'));var rp=require(_0xe765('0x4'));var moment=require(_0xe765('0x5'));var BPromise=require(_0xe765('0x6'));var Mustache=require(_0xe765('0x7'));var util=require(_0xe765('0x8'));var path=require(_0xe765('0x9'));var sox=require(_0xe765('0xa'));var csv=require(_0xe765('0xb'));var ejs=require(_0xe765('0xc'));var fs=require('fs');var fs_extra=require(_0xe765('0xd'));var _=require(_0xe765('0xe'));var squel=require('squel');var crypto=require(_0xe765('0xf'));var jsforce=require(_0xe765('0x10'));var deskjs=require(_0xe765('0x11'));var toCsv=require(_0xe765('0xb'));var querystring=require(_0xe765('0x12'));var Papa=require(_0xe765('0x13'));var Redis=require(_0xe765('0x14'));var authService=require('../../components/auth/service');var qs=require(_0xe765('0x15'));var as=require(_0xe765('0x16'));var hardwareService=require(_0xe765('0x17'));var logger=require('../../config/logger')(_0xe765('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xe765('0x19'))['db'];function respondWithStatusCode(_0x18177f,_0x9411a0){_0x9411a0=_0x9411a0||0xcc;return function(_0x27456b){if(_0x27456b){return _0x18177f[_0xe765('0x1a')](_0x9411a0);}return _0x18177f['status'](_0x9411a0)[_0xe765('0x1b')]();};}function respondWithResult(_0x3a26d8,_0x395312){_0x395312=_0x395312||0xc8;return function(_0x58dc37){if(_0x58dc37){return _0x3a26d8[_0xe765('0x1c')](_0x395312)['json'](_0x58dc37);}};}function respondWithFilteredResult(_0x50e2ab,_0x2f673b){return function(_0x1b1cfe){if(_0x1b1cfe){var _0x3c887b=typeof _0x2f673b['offset']===_0xe765('0x1d')&&typeof _0x2f673b[_0xe765('0x1e')]===_0xe765('0x1d');var _0x1db3ca=_0x1b1cfe[_0xe765('0x1f')];var _0xf93371=_0x3c887b?0x0:_0x2f673b[_0xe765('0x20')];var _0x2a95a9=_0x3c887b?_0x1b1cfe[_0xe765('0x1f')]:_0x2f673b['offset']+_0x2f673b[_0xe765('0x1e')];var _0x56905c;if(_0x2a95a9>=_0x1db3ca){_0x2a95a9=_0x1db3ca;_0x56905c=0xc8;}else{_0x56905c=0xce;}_0x50e2ab[_0xe765('0x1c')](_0x56905c);return _0x50e2ab[_0xe765('0x21')]('Content-Range',_0xf93371+'-'+_0x2a95a9+'/'+_0x1db3ca)[_0xe765('0x22')](_0x1b1cfe);}return null;};}function patchUpdates(_0x59118f){return function(_0x1c73c8){try{jsonpatch[_0xe765('0x23')](_0x1c73c8,_0x59118f,!![]);}catch(_0x1efb96){return BPromise['reject'](_0x1efb96);}return _0x1c73c8['save']();};}function saveUpdates(_0x4b789b,_0x1c6de4){return function(_0x2a4427){if(_0x2a4427){return _0x2a4427[_0xe765('0x24')](_0x4b789b)[_0xe765('0x25')](function(_0x54b59c){return _0x54b59c;});}return null;};}function removeEntity(_0x50cfcb,_0x18ba77){return function(_0x2e2a34){if(_0x2e2a34){return _0x2e2a34[_0xe765('0x26')]()[_0xe765('0x25')](function(){_0x50cfcb[_0xe765('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1aacbc,_0x5464b4){return function(_0x2b1f66){if(!_0x2b1f66){_0x1aacbc[_0xe765('0x1a')](0x194);}return _0x2b1f66;};}function handleError(_0xd877f3,_0x357f4e){_0x357f4e=_0x357f4e||0x1f4;return function(_0x40492d){logger[_0xe765('0x27')](_0x40492d[_0xe765('0x28')]);if(_0x40492d['name']){delete _0x40492d['name'];}_0xd877f3[_0xe765('0x1c')](_0x357f4e)['send'](_0x40492d);};}exports[_0xe765('0x29')]=function(_0x3f7493,_0x2fcbc9){var _0x64ffd4={},_0x1a8c01={},_0x4fce2c={'count':0x0,'rows':[]};var _0x43349b=_[_0xe765('0x2a')](db[_0xe765('0x2b')]['rawAttributes'],function(_0x5947c1){return{'name':_0x5947c1[_0xe765('0x2c')],'type':_0x5947c1['type'][_0xe765('0x2d')]};});_0x1a8c01[_0xe765('0x2e')]=_[_0xe765('0x2a')](_0x43349b,_0xe765('0x2f'));_0x1a8c01[_0xe765('0x30')]=_['keys'](_0x3f7493['query']);_0x1a8c01[_0xe765('0x31')]=_[_0xe765('0x32')](_0x1a8c01[_0xe765('0x2e')],_0x1a8c01[_0xe765('0x30')]);_0x64ffd4[_0xe765('0x33')]=_['intersection'](_0x1a8c01['model'],qs[_0xe765('0x34')](_0x3f7493['query'][_0xe765('0x34')]));_0x64ffd4[_0xe765('0x33')]=_0x64ffd4[_0xe765('0x33')][_0xe765('0x35')]?_0x64ffd4[_0xe765('0x33')]:_0x1a8c01[_0xe765('0x2e')];if(!_0x3f7493[_0xe765('0x30')]['hasOwnProperty']('nolimit')){_0x64ffd4['limit']=qs[_0xe765('0x1e')](_0x3f7493[_0xe765('0x30')][_0xe765('0x1e')]);_0x64ffd4[_0xe765('0x20')]=qs['offset'](_0x3f7493[_0xe765('0x30')][_0xe765('0x20')]);}_0x64ffd4[_0xe765('0x36')]=qs[_0xe765('0x37')](_0x3f7493['query'][_0xe765('0x37')]);_0x64ffd4['where']=qs[_0xe765('0x31')](_[_0xe765('0x38')](_0x3f7493[_0xe765('0x30')],_0x1a8c01[_0xe765('0x31')]),_0x43349b);if(_0x3f7493[_0xe765('0x30')][_0xe765('0x39')]){_0x64ffd4[_0xe765('0x3a')]=_[_0xe765('0x3b')](_0x64ffd4[_0xe765('0x3a')],{'$or':_[_0xe765('0x2a')](_0x43349b,function(_0x5e21ae){if(_0x5e21ae[_0xe765('0x3c')]!==_0xe765('0x3d')){var _0x11b459={};_0x11b459[_0x5e21ae['name']]={'$like':'%'+_0x3f7493['query']['filter']+'%'};return _0x11b459;}})});}_0x64ffd4=_[_0xe765('0x3b')]({},_0x64ffd4,_0x3f7493['options']);var _0x1f0db1={'where':_0x64ffd4[_0xe765('0x3a')]};return db[_0xe765('0x2b')][_0xe765('0x1f')](_0x1f0db1)['then'](function(_0x363f59){_0x4fce2c[_0xe765('0x1f')]=_0x363f59;if(_0x3f7493[_0xe765('0x30')][_0xe765('0x3e')]){_0x64ffd4[_0xe765('0x3f')]=[{'all':!![]}];}return db[_0xe765('0x2b')][_0xe765('0x40')](_0x64ffd4);})[_0xe765('0x25')](function(_0xb92246){_0x4fce2c[_0xe765('0x41')]=_0xb92246;return _0x4fce2c;})['then'](respondWithFilteredResult(_0x2fcbc9,_0x64ffd4))[_0xe765('0x42')](handleError(_0x2fcbc9,null));};exports['show']=function(_0x1248ea,_0x1d2b24){var _0x4d2814={'raw':!![],'where':{'id':_0x1248ea['params']['id']}},_0x3977e5={};_0x3977e5['model']=_['keys'](db[_0xe765('0x2b')][_0xe765('0x43')]);_0x3977e5[_0xe765('0x30')]=_['keys'](_0x1248ea[_0xe765('0x30')]);_0x3977e5[_0xe765('0x31')]=_[_0xe765('0x32')](_0x3977e5[_0xe765('0x2e')],_0x3977e5[_0xe765('0x30')]);_0x4d2814[_0xe765('0x33')]=_[_0xe765('0x32')](_0x3977e5[_0xe765('0x2e')],qs[_0xe765('0x34')](_0x1248ea['query'][_0xe765('0x34')]));_0x4d2814['attributes']=_0x4d2814['attributes'][_0xe765('0x35')]?_0x4d2814['attributes']:_0x3977e5[_0xe765('0x2e')];if(_0x1248ea[_0xe765('0x30')][_0xe765('0x3e')]){_0x4d2814['include']=[{'all':!![]}];}_0x4d2814=_[_0xe765('0x3b')]({},_0x4d2814,_0x1248ea['options']);return db[_0xe765('0x2b')][_0xe765('0x44')](_0x4d2814)[_0xe765('0x25')](handleEntityNotFound(_0x1d2b24,null))['then'](respondWithResult(_0x1d2b24,null))[_0xe765('0x42')](handleError(_0x1d2b24,null));};exports[_0xe765('0x45')]=function(_0x115f16,_0x2d360e){return db['FaxQueueReport']['create'](_0x115f16['body'],{})[_0xe765('0x25')](respondWithResult(_0x2d360e,0xc9))[_0xe765('0x42')](handleError(_0x2d360e,null));};exports[_0xe765('0x24')]=function(_0x58310d,_0x14834c){if(_0x58310d['body']['id']){delete _0x58310d[_0xe765('0x46')]['id'];}return db[_0xe765('0x2b')][_0xe765('0x44')]({'where':{'id':_0x58310d[_0xe765('0x47')]['id']}})[_0xe765('0x25')](handleEntityNotFound(_0x14834c,null))[_0xe765('0x25')](saveUpdates(_0x58310d['body'],null))[_0xe765('0x25')](respondWithResult(_0x14834c,null))[_0xe765('0x42')](handleError(_0x14834c,null));};exports[_0xe765('0x26')]=function(_0x1214a8,_0x14c3b5){return db[_0xe765('0x2b')]['find']({'where':{'id':_0x1214a8['params']['id']}})[_0xe765('0x25')](handleEntityNotFound(_0x14c3b5,null))[_0xe765('0x25')](removeEntity(_0x14c3b5,null))[_0xe765('0x42')](handleError(_0x14c3b5,null));};exports['describe']=function(_0x4e6762,_0x151828){return db[_0xe765('0x2b')][_0xe765('0x48')]()[_0xe765('0x25')](respondWithResult(_0x151828,null))[_0xe765('0x42')](handleError(_0x151828,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index c94b9ee..9f64b17 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 _0xf494=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','define','uniqueid','lodash'];(function(_0x3d2a54,_0x586779){var _0x1f4896=function(_0x2232d0){while(--_0x2232d0){_0x3d2a54['push'](_0x3d2a54['shift']());}};_0x1f4896(++_0x586779);}(_0xf494,0x1c6));var _0x4f49=function(_0x202a23,_0x278d31){_0x202a23=_0x202a23-0x0;var _0x21b280=_0xf494[_0x202a23];return _0x21b280;};'use strict';var _=require(_0x4f49('0x0'));var util=require(_0x4f49('0x1'));var logger=require(_0x4f49('0x2'))('api');var moment=require(_0x4f49('0x3'));var BPromise=require(_0x4f49('0x4'));var rp=require(_0x4f49('0x5'));var fs=require('fs');var path=require(_0x4f49('0x6'));var rimraf=require(_0x4f49('0x7'));var config=require(_0x4f49('0x8'));var attributes=require(_0x4f49('0x9'));module[_0x4f49('0xa')]=function(_0xc5e778,_0x413530){return _0xc5e778[_0x4f49('0xb')]('FaxQueueReport',attributes,{'tableName':'report_fax_queue','paranoid':![],'indexes':[{'name':_0x4f49('0xc'),'fields':[_0x4f49('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5fc3=['util','api','moment','bluebird','request-promise','path','../../config/environment','./faxQueueReport.attributes','exports','define','report_fax_queue','uniqueid','lodash'];(function(_0x51fd1f,_0x453dfb){var _0x4f314b=function(_0x4ae5e5){while(--_0x4ae5e5){_0x51fd1f['push'](_0x51fd1f['shift']());}};_0x4f314b(++_0x453dfb);}(_0x5fc3,0xa8));var _0x35fc=function(_0x3227c1,_0x4318c5){_0x3227c1=_0x3227c1-0x0;var _0x31fd48=_0x5fc3[_0x3227c1];return _0x31fd48;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var logger=require('../../config/logger')(_0x35fc('0x2'));var moment=require(_0x35fc('0x3'));var BPromise=require(_0x35fc('0x4'));var rp=require(_0x35fc('0x5'));var fs=require('fs');var path=require(_0x35fc('0x6'));var rimraf=require('rimraf');var config=require(_0x35fc('0x7'));var attributes=require(_0x35fc('0x8'));module[_0x35fc('0x9')]=function(_0x5b85ad,_0x5754be){return _0x5b85ad[_0x35fc('0xa')]('FaxQueueReport',attributes,{'tableName':_0x35fc('0xb'),'paranoid':![],'indexes':[{'name':_0x35fc('0xc'),'fields':[_0x35fc('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 77d6814..7c6c175 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 _0x4eee=['../../config/utils','../../config/logger','../../config/environment','client','request','then','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','CreateFaxQueueReport','FaxQueueReport','create','body','options','raw','catch','update','limit','UpdateFaxQueueReport','lodash','moment','randomstring','ioredis'];(function(_0x56ec52,_0x35e3c3){var _0x324eb2=function(_0x38a417){while(--_0x38a417){_0x56ec52['push'](_0x56ec52['shift']());}};_0x324eb2(++_0x35e3c3);}(_0x4eee,0x175));var _0xe4ee=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0x4eee[_0x50a0c2];return _0x5ebadd;};'use strict';var _=require(_0xe4ee('0x0'));var util=require('util');var moment=require(_0xe4ee('0x1'));var BPromise=require('bluebird');var rs=require(_0xe4ee('0x2'));var fs=require('fs');var Redis=require(_0xe4ee('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xe4ee('0x4'));var logger=require(_0xe4ee('0x5'))('rpc');var config=require(_0xe4ee('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xe4ee('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5322e5,_0x777f4c,_0x516c99){return new BPromise(function(_0xe7a606,_0x5da82e){return client[_0xe4ee('0x8')](_0x5322e5,_0x516c99)[_0xe4ee('0x9')](function(_0x31221e){logger[_0xe4ee('0xa')](_0xe4ee('0xb'),_0x777f4c,_0xe4ee('0xc'));logger[_0xe4ee('0xd')](_0xe4ee('0xe'),_0x777f4c,_0xe4ee('0xc'),JSON[_0xe4ee('0xf')](_0x31221e));if(_0x31221e[_0xe4ee('0x10')]){if(_0x31221e['error'][_0xe4ee('0x11')]===0x1f4){logger['error'](_0xe4ee('0xb'),_0x777f4c,_0x31221e[_0xe4ee('0x10')][_0xe4ee('0x12')]);return _0x5da82e(_0x31221e[_0xe4ee('0x10')][_0xe4ee('0x12')]);}logger[_0xe4ee('0x10')]('FaxQueueReport,\x20%s,\x20%s',_0x777f4c,_0x31221e[_0xe4ee('0x10')][_0xe4ee('0x12')]);return _0xe7a606(_0x31221e['error'][_0xe4ee('0x12')]);}else{logger[_0xe4ee('0xa')](_0xe4ee('0xb'),_0x777f4c,_0xe4ee('0xc'));_0xe7a606(_0x31221e['result'][_0xe4ee('0x12')]);}})['catch'](function(_0x1e824b){logger[_0xe4ee('0x10')](_0xe4ee('0xb'),_0x777f4c,_0x1e824b);_0x5da82e(_0x1e824b);});});}exports[_0xe4ee('0x13')]=function(_0x3bfd7c){var _0xc4d859=this;return new Promise(function(_0x379060,_0x41c5e7){return db[_0xe4ee('0x14')][_0xe4ee('0x15')](_0x3bfd7c[_0xe4ee('0x16')],{'raw':_0x3bfd7c[_0xe4ee('0x17')]?_0x3bfd7c['options'][_0xe4ee('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x10369b){logger['info']('CreateFaxQueueReport',_0x3bfd7c);logger['debug'](_0xe4ee('0x13'),_0x3bfd7c,JSON[_0xe4ee('0xf')](_0x10369b));_0x379060(_0x10369b);})[_0xe4ee('0x19')](function(_0xdf3c9e){logger[_0xe4ee('0x10')]('CreateFaxQueueReport',_0xdf3c9e['message'],_0x3bfd7c);_0x41c5e7(_0xc4d859[_0xe4ee('0x10')](0x1f4,_0xdf3c9e[_0xe4ee('0x12')]));});});};exports['UpdateFaxQueueReport']=function(_0x4e65f5){var _0x78faa5=this;return new Promise(function(_0x48a3b4,_0x304377){return db[_0xe4ee('0x14')][_0xe4ee('0x1a')](_0x4e65f5[_0xe4ee('0x16')],{'raw':_0x4e65f5[_0xe4ee('0x17')]?_0x4e65f5[_0xe4ee('0x17')][_0xe4ee('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4e65f5[_0xe4ee('0x17')]?_0x4e65f5[_0xe4ee('0x17')]['where']||null:null,'attributes':_0x4e65f5[_0xe4ee('0x17')]?_0x4e65f5[_0xe4ee('0x17')]['attributes']||null:null,'limit':_0x4e65f5['options']?_0x4e65f5[_0xe4ee('0x17')][_0xe4ee('0x1b')]||null:null})[_0xe4ee('0x9')](function(_0x2e1c54){logger['info'](_0xe4ee('0x1c'),_0x4e65f5);logger[_0xe4ee('0xd')](_0xe4ee('0x1c'),_0x4e65f5,JSON[_0xe4ee('0xf')](_0x2e1c54));_0x48a3b4(_0x2e1c54);})[_0xe4ee('0x19')](function(_0x4b2396){logger[_0xe4ee('0x10')](_0xe4ee('0x1c'),_0x4b2396[_0xe4ee('0x12')],_0x4e65f5);_0x304377(_0x78faa5['error'](0x1f4,_0x4b2396[_0xe4ee('0x12')]));});});}; \ No newline at end of file +var _0x70f0=['../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','FaxQueueReport,\x20%s,\x20%s','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch','CreateFaxQueueReport','create','options','raw','stringify','UpdateFaxQueueReport','FaxQueueReport','where','attributes','lodash','util','moment','randomstring','ioredis','../../config/utils'];(function(_0x366413,_0x558eae){var _0x3152da=function(_0x445ffe){while(--_0x445ffe){_0x366413['push'](_0x366413['shift']());}};_0x3152da(++_0x558eae);}(_0x70f0,0xf2));var _0x070f=function(_0x5e28c2,_0x1e48ab){_0x5e28c2=_0x5e28c2-0x0;var _0x1a8cc6=_0x70f0[_0x5e28c2];return _0x1a8cc6;};'use strict';var _=require(_0x070f('0x0'));var util=require(_0x070f('0x1'));var moment=require(_0x070f('0x2'));var BPromise=require('bluebird');var rs=require(_0x070f('0x3'));var fs=require('fs');var Redis=require(_0x070f('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x070f('0x5'));var logger=require(_0x070f('0x6'))('rpc');var config=require(_0x070f('0x7'));var jayson=require(_0x070f('0x8'));var client=jayson[_0x070f('0x9')][_0x070f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x285f7f,_0x123a62,_0x33b436){return new BPromise(function(_0x5380c2,_0x1362f2){return client[_0x070f('0xb')](_0x285f7f,_0x33b436)[_0x070f('0xc')](function(_0x28f99a){logger[_0x070f('0xd')](_0x070f('0xe'),_0x123a62,'request\x20sent');logger[_0x070f('0xf')](_0x070f('0x10'),_0x123a62,_0x070f('0x11'),JSON['stringify'](_0x28f99a));if(_0x28f99a['error']){if(_0x28f99a[_0x070f('0x12')]['code']===0x1f4){logger[_0x070f('0x12')]('FaxQueueReport,\x20%s,\x20%s',_0x123a62,_0x28f99a[_0x070f('0x12')][_0x070f('0x13')]);return _0x1362f2(_0x28f99a[_0x070f('0x12')][_0x070f('0x13')]);}logger[_0x070f('0x12')](_0x070f('0xe'),_0x123a62,_0x28f99a[_0x070f('0x12')][_0x070f('0x13')]);return _0x5380c2(_0x28f99a[_0x070f('0x12')][_0x070f('0x13')]);}else{logger[_0x070f('0xd')]('FaxQueueReport,\x20%s,\x20%s',_0x123a62,_0x070f('0x11'));_0x5380c2(_0x28f99a[_0x070f('0x14')][_0x070f('0x13')]);}})[_0x070f('0x15')](function(_0x5b8215){logger[_0x070f('0x12')]('FaxQueueReport,\x20%s,\x20%s',_0x123a62,_0x5b8215);_0x1362f2(_0x5b8215);});});}exports[_0x070f('0x16')]=function(_0x2d7139){var _0x5e2a96=this;return new Promise(function(_0x29972d,_0x240f22){return db['FaxQueueReport'][_0x070f('0x17')](_0x2d7139['body'],{'raw':_0x2d7139['options']?_0x2d7139[_0x070f('0x18')][_0x070f('0x19')]===undefined?!![]:![]:!![]})[_0x070f('0xc')](function(_0x2434d2){logger[_0x070f('0xd')]('CreateFaxQueueReport',_0x2d7139);logger[_0x070f('0xf')](_0x070f('0x16'),_0x2d7139,JSON[_0x070f('0x1a')](_0x2434d2));_0x29972d(_0x2434d2);})[_0x070f('0x15')](function(_0x4f9068){logger['error'](_0x070f('0x16'),_0x4f9068['message'],_0x2d7139);_0x240f22(_0x5e2a96[_0x070f('0x12')](0x1f4,_0x4f9068[_0x070f('0x13')]));});});};exports[_0x070f('0x1b')]=function(_0x5a9c68){var _0x427154=this;return new Promise(function(_0x583570,_0x8c1c07){return db[_0x070f('0x1c')]['update'](_0x5a9c68['body'],{'raw':_0x5a9c68[_0x070f('0x18')]?_0x5a9c68[_0x070f('0x18')][_0x070f('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5a9c68[_0x070f('0x18')]?_0x5a9c68[_0x070f('0x18')][_0x070f('0x1d')]||null:null,'attributes':_0x5a9c68['options']?_0x5a9c68[_0x070f('0x18')][_0x070f('0x1e')]||null:null,'limit':_0x5a9c68[_0x070f('0x18')]?_0x5a9c68[_0x070f('0x18')]['limit']||null:null})[_0x070f('0xc')](function(_0x186671){logger[_0x070f('0xd')](_0x070f('0x1b'),_0x5a9c68);logger['debug'](_0x070f('0x1b'),_0x5a9c68,JSON[_0x070f('0x1a')](_0x186671));_0x583570(_0x186671);})['catch'](function(_0x3e5983){logger['error']('UpdateFaxQueueReport',_0x3e5983['message'],_0x5a9c68);_0x8c1c07(_0x427154[_0x070f('0x12')](0x1f4,_0x3e5983[_0x070f('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index 8a31b7a..dae3c17 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 _0x727e=['index','/describe','isAuthenticated','describe','/:id','update','delete','exports','multer','path','connect-timeout','Router','fs-extra','../../components/interaction/service','./faxQueueReport.controller','get'];(function(_0x237fc8,_0x1262f7){var _0x2a20b7=function(_0x4820db){while(--_0x4820db){_0x237fc8['push'](_0x237fc8['shift']());}};_0x2a20b7(++_0x1262f7);}(_0x727e,0xa8));var _0xe727=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x727e[_0x138adb];return _0x1b27f2;};'use strict';var multer=require(_0xe727('0x0'));var util=require('util');var path=require(_0xe727('0x1'));var timeout=require(_0xe727('0x2'));var express=require('express');var router=express[_0xe727('0x3')]();var fs_extra=require(_0xe727('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xe727('0x5'));var config=require('../../config/environment');var controller=require(_0xe727('0x6'));router[_0xe727('0x7')]('/',auth['isAuthenticated'](),controller[_0xe727('0x8')]);router[_0xe727('0x7')](_0xe727('0x9'),auth[_0xe727('0xa')](),controller[_0xe727('0xb')]);router[_0xe727('0x7')](_0xe727('0xc'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller['create']);router['put']('/:id',auth[_0xe727('0xa')](),controller[_0xe727('0xd')]);router[_0xe727('0xe')](_0xe727('0xc'),auth[_0xe727('0xa')](),controller['destroy']);module[_0xe727('0xf')]=router; \ No newline at end of file +var _0xbc39=['connect-timeout','express','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','show','post','create','put','/:id','update','destroy','exports','multer','util'];(function(_0x58d7cf,_0x40c07f){var _0x48db5e=function(_0x1b9f61){while(--_0x1b9f61){_0x58d7cf['push'](_0x58d7cf['shift']());}};_0x48db5e(++_0x40c07f);}(_0xbc39,0x8e));var _0x9bc3=function(_0x44913c,_0x754aad){_0x44913c=_0x44913c-0x0;var _0x4b7ca2=_0xbc39[_0x44913c];return _0x4b7ca2;};'use strict';var multer=require(_0x9bc3('0x0'));var util=require(_0x9bc3('0x1'));var path=require('path');var timeout=require(_0x9bc3('0x2'));var express=require(_0x9bc3('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x9bc3('0x4'));var interaction=require(_0x9bc3('0x5'));var config=require('../../config/environment');var controller=require('./faxQueueReport.controller');router[_0x9bc3('0x6')]('/',auth[_0x9bc3('0x7')](),controller['index']);router[_0x9bc3('0x6')]('/describe',auth[_0x9bc3('0x7')](),controller['describe']);router['get']('/:id',auth['isAuthenticated'](),controller[_0x9bc3('0x8')]);router[_0x9bc3('0x9')]('/',auth[_0x9bc3('0x7')](),controller[_0x9bc3('0xa')]);router[_0x9bc3('0xb')](_0x9bc3('0xc'),auth[_0x9bc3('0x7')](),controller[_0x9bc3('0xd')]);router['delete'](_0x9bc3('0xc'),auth[_0x9bc3('0x7')](),controller[_0x9bc3('0xe')]);module[_0x9bc3('0xf')]=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index 72dcef7..631df88 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 _0xcb91=['STRING','ENUM','account','queue','NOW','exports'];(function(_0x12ab7e,_0x30b92c){var _0x3f463c=function(_0xaa19c2){while(--_0xaa19c2){_0x12ab7e['push'](_0x12ab7e['shift']());}};_0x3f463c(++_0x30b92c);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x305c31,_0x466b17){_0x305c31=_0x305c31-0x0;var _0x17f39f=_0xcb91[_0x305c31];return _0x17f39f;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x1cb9('0x0')]={'uniqueid':{'type':Sequelize[_0x1cb9('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x1cb9('0x2')](_0x1cb9('0x3'),'agent',_0x1cb9('0x4')),'allowNull':![],'defaultValue':_0x1cb9('0x4')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x1cb9('0x5')]}}; \ No newline at end of file +var _0xedd9=['account','agent','queue','NOW','sequelize','exports','STRING','ENUM'];(function(_0x4b6a95,_0x4f35d7){var _0x31eda2=function(_0x1b7f58){while(--_0x1b7f58){_0x4b6a95['push'](_0x4b6a95['shift']());}};_0x31eda2(++_0x4f35d7);}(_0xedd9,0xfc));var _0x9edd=function(_0x5687a7,_0x4989e7){_0x5687a7=_0x5687a7-0x0;var _0x12d4f1=_0xedd9[_0x5687a7];return _0x12d4f1;};'use strict';var moment=require('moment');var Sequelize=require(_0x9edd('0x0'));module[_0x9edd('0x1')]={'uniqueid':{'type':Sequelize[_0x9edd('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x9edd('0x3')](_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6')),'allowNull':![],'defaultValue':_0x9edd('0x6')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x9edd('0x7')]}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index 3b20096..b34f265 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 _0x383e=['merge','VIRTUAL','filter','includeAll','FaxTransferReport','findAll','catch','params','keys','options','find','create','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','nolimit','sort','where','pick'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x383e,0xe6));var _0xe383=function(_0x453ff4,_0x498c1f){_0x453ff4=_0x453ff4-0x0;var _0x2d1680=_0x383e[_0x453ff4];return _0x2d1680;};'use strict';var emlformat=require(_0xe383('0x0'));var rimraf=require(_0xe383('0x1'));var zipdir=require(_0xe383('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe383('0x3'));var moment=require(_0xe383('0x4'));var BPromise=require(_0xe383('0x5'));var Mustache=require(_0xe383('0x6'));var util=require(_0xe383('0x7'));var path=require(_0xe383('0x8'));var sox=require(_0xe383('0x9'));var csv=require(_0xe383('0xa'));var ejs=require(_0xe383('0xb'));var fs=require('fs');var fs_extra=require(_0xe383('0xc'));var _=require(_0xe383('0xd'));var squel=require(_0xe383('0xe'));var crypto=require(_0xe383('0xf'));var jsforce=require(_0xe383('0x10'));var deskjs=require(_0xe383('0x11'));var toCsv=require(_0xe383('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xe383('0x12'));var qs=require(_0xe383('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe383('0x14'));var logger=require(_0xe383('0x15'))('api');var utils=require(_0xe383('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xe383('0x17'));var db=require(_0xe383('0x18'))['db'];function respondWithStatusCode(_0x491a9c,_0x11e2aa){_0x11e2aa=_0x11e2aa||0xcc;return function(_0x4e7a0c){if(_0x4e7a0c){return _0x491a9c[_0xe383('0x19')](_0x11e2aa);}return _0x491a9c[_0xe383('0x1a')](_0x11e2aa)[_0xe383('0x1b')]();};}function respondWithResult(_0x18658f,_0x31825c){_0x31825c=_0x31825c||0xc8;return function(_0x4132c5){if(_0x4132c5){return _0x18658f[_0xe383('0x1a')](_0x31825c)[_0xe383('0x1c')](_0x4132c5);}};}function respondWithFilteredResult(_0xf76970,_0x5b01ab){return function(_0x94144a){if(_0x94144a){var _0x51deee=typeof _0x5b01ab[_0xe383('0x1d')]===_0xe383('0x1e')&&typeof _0x5b01ab[_0xe383('0x1f')]===_0xe383('0x1e');var _0x507f82=_0x94144a[_0xe383('0x20')];var _0x14e4f2=_0x51deee?0x0:_0x5b01ab[_0xe383('0x1d')];var _0xefbeb5=_0x51deee?_0x94144a[_0xe383('0x20')]:_0x5b01ab['offset']+_0x5b01ab[_0xe383('0x1f')];var _0x382615;if(_0xefbeb5>=_0x507f82){_0xefbeb5=_0x507f82;_0x382615=0xc8;}else{_0x382615=0xce;}_0xf76970[_0xe383('0x1a')](_0x382615);return _0xf76970['set'](_0xe383('0x21'),_0x14e4f2+'-'+_0xefbeb5+'/'+_0x507f82)['json'](_0x94144a);}return null;};}function patchUpdates(_0x104c58){return function(_0x1967d3){try{jsonpatch[_0xe383('0x22')](_0x1967d3,_0x104c58,!![]);}catch(_0x194e7c){return BPromise[_0xe383('0x23')](_0x194e7c);}return _0x1967d3['save']();};}function saveUpdates(_0x44364d,_0x20dcaa){return function(_0x52098d){if(_0x52098d){return _0x52098d[_0xe383('0x24')](_0x44364d)[_0xe383('0x25')](function(_0xf33a37){return _0xf33a37;});}return null;};}function removeEntity(_0x57f0e5,_0x41900e){return function(_0x3cf723){if(_0x3cf723){return _0x3cf723[_0xe383('0x26')]()[_0xe383('0x25')](function(){_0x57f0e5[_0xe383('0x1a')](0xcc)[_0xe383('0x1b')]();});}};}function handleEntityNotFound(_0xe5fa58,_0x2152af){return function(_0x3592dc){if(!_0x3592dc){_0xe5fa58['sendStatus'](0x194);}return _0x3592dc;};}function handleError(_0x365deb,_0x46e973){_0x46e973=_0x46e973||0x1f4;return function(_0x37d6ad){logger['error'](_0x37d6ad[_0xe383('0x27')]);if(_0x37d6ad[_0xe383('0x28')]){delete _0x37d6ad[_0xe383('0x28')];}_0x365deb[_0xe383('0x1a')](_0x46e973)[_0xe383('0x29')](_0x37d6ad);};}exports[_0xe383('0x2a')]=function(_0x18f55c,_0x551e19){var _0x4b17ca={},_0x20c903={},_0x2f356e={'count':0x0,'rows':[]};var _0x3d6b08=_[_0xe383('0x2b')](db['FaxTransferReport'][_0xe383('0x2c')],function(_0x6ecc2d){return{'name':_0x6ecc2d[_0xe383('0x2d')],'type':_0x6ecc2d[_0xe383('0x2e')]['key']};});_0x20c903[_0xe383('0x2f')]=_['map'](_0x3d6b08,_0xe383('0x28'));_0x20c903[_0xe383('0x30')]=_['keys'](_0x18f55c[_0xe383('0x30')]);_0x20c903[_0xe383('0x31')]=_[_0xe383('0x32')](_0x20c903[_0xe383('0x2f')],_0x20c903[_0xe383('0x30')]);_0x4b17ca[_0xe383('0x33')]=_[_0xe383('0x32')](_0x20c903[_0xe383('0x2f')],qs[_0xe383('0x34')](_0x18f55c['query'][_0xe383('0x34')]));_0x4b17ca[_0xe383('0x33')]=_0x4b17ca[_0xe383('0x33')][_0xe383('0x35')]?_0x4b17ca[_0xe383('0x33')]:_0x20c903[_0xe383('0x2f')];if(!_0x18f55c['query']['hasOwnProperty'](_0xe383('0x36'))){_0x4b17ca[_0xe383('0x1f')]=qs[_0xe383('0x1f')](_0x18f55c[_0xe383('0x30')][_0xe383('0x1f')]);_0x4b17ca[_0xe383('0x1d')]=qs[_0xe383('0x1d')](_0x18f55c[_0xe383('0x30')][_0xe383('0x1d')]);}_0x4b17ca['order']=qs['sort'](_0x18f55c[_0xe383('0x30')][_0xe383('0x37')]);_0x4b17ca[_0xe383('0x38')]=qs[_0xe383('0x31')](_[_0xe383('0x39')](_0x18f55c[_0xe383('0x30')],_0x20c903[_0xe383('0x31')]),_0x3d6b08);if(_0x18f55c[_0xe383('0x30')]['filter']){_0x4b17ca['where']=_[_0xe383('0x3a')](_0x4b17ca[_0xe383('0x38')],{'$or':_[_0xe383('0x2b')](_0x3d6b08,function(_0x424745){if(_0x424745['type']!==_0xe383('0x3b')){var _0x2fb642={};_0x2fb642[_0x424745[_0xe383('0x28')]]={'$like':'%'+_0x18f55c['query'][_0xe383('0x3c')]+'%'};return _0x2fb642;}})});}_0x4b17ca=_[_0xe383('0x3a')]({},_0x4b17ca,_0x18f55c['options']);var _0x2106e6={'where':_0x4b17ca[_0xe383('0x38')]};return db['FaxTransferReport']['count'](_0x2106e6)[_0xe383('0x25')](function(_0x9d43e6){_0x2f356e[_0xe383('0x20')]=_0x9d43e6;if(_0x18f55c[_0xe383('0x30')][_0xe383('0x3d')]){_0x4b17ca['include']=[{'all':!![]}];}return db[_0xe383('0x3e')][_0xe383('0x3f')](_0x4b17ca);})[_0xe383('0x25')](function(_0x426f7b){_0x2f356e['rows']=_0x426f7b;return _0x2f356e;})[_0xe383('0x25')](respondWithFilteredResult(_0x551e19,_0x4b17ca))[_0xe383('0x40')](handleError(_0x551e19,null));};exports['show']=function(_0x295a4f,_0x21949d){var _0x492cb3={'raw':!![],'where':{'id':_0x295a4f[_0xe383('0x41')]['id']}},_0x297bb0={};_0x297bb0[_0xe383('0x2f')]=_[_0xe383('0x42')](db[_0xe383('0x3e')][_0xe383('0x2c')]);_0x297bb0['query']=_[_0xe383('0x42')](_0x295a4f['query']);_0x297bb0[_0xe383('0x31')]=_[_0xe383('0x32')](_0x297bb0['model'],_0x297bb0['query']);_0x492cb3[_0xe383('0x33')]=_[_0xe383('0x32')](_0x297bb0[_0xe383('0x2f')],qs[_0xe383('0x34')](_0x295a4f[_0xe383('0x30')][_0xe383('0x34')]));_0x492cb3[_0xe383('0x33')]=_0x492cb3[_0xe383('0x33')][_0xe383('0x35')]?_0x492cb3[_0xe383('0x33')]:_0x297bb0[_0xe383('0x2f')];if(_0x295a4f[_0xe383('0x30')][_0xe383('0x3d')]){_0x492cb3['include']=[{'all':!![]}];}_0x492cb3=_[_0xe383('0x3a')]({},_0x492cb3,_0x295a4f[_0xe383('0x43')]);return db[_0xe383('0x3e')][_0xe383('0x44')](_0x492cb3)[_0xe383('0x25')](handleEntityNotFound(_0x21949d,null))[_0xe383('0x25')](respondWithResult(_0x21949d,null))['catch'](handleError(_0x21949d,null));};exports[_0xe383('0x45')]=function(_0x42a893,_0x36cdf0){return db[_0xe383('0x3e')][_0xe383('0x45')](_0x42a893[_0xe383('0x46')],{})[_0xe383('0x25')](respondWithResult(_0x36cdf0,0xc9))[_0xe383('0x40')](handleError(_0x36cdf0,null));};exports[_0xe383('0x24')]=function(_0x1bc4f3,_0x33dfa1){if(_0x1bc4f3[_0xe383('0x46')]['id']){delete _0x1bc4f3[_0xe383('0x46')]['id'];}return db['FaxTransferReport'][_0xe383('0x44')]({'where':{'id':_0x1bc4f3[_0xe383('0x41')]['id']}})[_0xe383('0x25')](handleEntityNotFound(_0x33dfa1,null))[_0xe383('0x25')](saveUpdates(_0x1bc4f3[_0xe383('0x46')],null))[_0xe383('0x25')](respondWithResult(_0x33dfa1,null))['catch'](handleError(_0x33dfa1,null));};exports[_0xe383('0x26')]=function(_0x406032,_0x42a6ea){return db[_0xe383('0x3e')]['find']({'where':{'id':_0x406032['params']['id']}})[_0xe383('0x25')](handleEntityNotFound(_0x42a6ea,null))[_0xe383('0x25')](removeEntity(_0x42a6ea,null))[_0xe383('0x40')](handleError(_0x42a6ea,null));};exports[_0xe383('0x47')]=function(_0x23f6f4,_0x2ed395){return db[_0xe383('0x3e')][_0xe383('0x47')]()[_0xe383('0x25')](respondWithResult(_0x2ed395,null))['catch'](handleError(_0x2ed395,null));}; \ No newline at end of file +var _0xd447=['zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','sendStatus','error','stack','name','send','index','map','FaxTransferReport','rawAttributes','fieldName','type','query','keys','filters','model','intersection','fields','attributes','length','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','describe','rimraf'];(function(_0x3f9cba,_0x9d687c){var _0x314ac7=function(_0x337a96){while(--_0x337a96){_0x3f9cba['push'](_0x3f9cba['shift']());}};_0x314ac7(++_0x9d687c);}(_0xd447,0x18a));var _0x7d44=function(_0x2a2c14,_0x399a7b){_0x2a2c14=_0x2a2c14-0x0;var _0x1d3e3c=_0xd447[_0x2a2c14];return _0x1d3e3c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7d44('0x0'));var zipdir=require(_0x7d44('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7d44('0x2'));var moment=require(_0x7d44('0x3'));var BPromise=require(_0x7d44('0x4'));var Mustache=require(_0x7d44('0x5'));var util=require(_0x7d44('0x6'));var path=require(_0x7d44('0x7'));var sox=require(_0x7d44('0x8'));var csv=require(_0x7d44('0x9'));var ejs=require(_0x7d44('0xa'));var fs=require('fs');var fs_extra=require(_0x7d44('0xb'));var _=require(_0x7d44('0xc'));var squel=require('squel');var crypto=require(_0x7d44('0xd'));var jsforce=require(_0x7d44('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x7d44('0x9'));var querystring=require(_0x7d44('0xf'));var Papa=require(_0x7d44('0x10'));var Redis=require(_0x7d44('0x11'));var authService=require(_0x7d44('0x12'));var qs=require(_0x7d44('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7d44('0x14'));var logger=require(_0x7d44('0x15'))(_0x7d44('0x16'));var utils=require(_0x7d44('0x17'));var config=require(_0x7d44('0x18'));var licenseUtil=require(_0x7d44('0x19'));var db=require(_0x7d44('0x1a'))['db'];function respondWithStatusCode(_0x149f38,_0x22f5e9){_0x22f5e9=_0x22f5e9||0xcc;return function(_0x3564aa){if(_0x3564aa){return _0x149f38['sendStatus'](_0x22f5e9);}return _0x149f38[_0x7d44('0x1b')](_0x22f5e9)[_0x7d44('0x1c')]();};}function respondWithResult(_0x56c993,_0x51da31){_0x51da31=_0x51da31||0xc8;return function(_0xf874d5){if(_0xf874d5){return _0x56c993['status'](_0x51da31)[_0x7d44('0x1d')](_0xf874d5);}};}function respondWithFilteredResult(_0x1a07ee,_0x94a529){return function(_0x3c68a2){if(_0x3c68a2){var _0x127469=typeof _0x94a529[_0x7d44('0x1e')]===_0x7d44('0x1f')&&typeof _0x94a529[_0x7d44('0x20')]===_0x7d44('0x1f');var _0x47418f=_0x3c68a2[_0x7d44('0x21')];var _0x5d797f=_0x127469?0x0:_0x94a529[_0x7d44('0x1e')];var _0x36b422=_0x127469?_0x3c68a2[_0x7d44('0x21')]:_0x94a529[_0x7d44('0x1e')]+_0x94a529[_0x7d44('0x20')];var _0x262645;if(_0x36b422>=_0x47418f){_0x36b422=_0x47418f;_0x262645=0xc8;}else{_0x262645=0xce;}_0x1a07ee['status'](_0x262645);return _0x1a07ee[_0x7d44('0x22')](_0x7d44('0x23'),_0x5d797f+'-'+_0x36b422+'/'+_0x47418f)[_0x7d44('0x1d')](_0x3c68a2);}return null;};}function patchUpdates(_0x3b6872){return function(_0x32acdd){try{jsonpatch[_0x7d44('0x24')](_0x32acdd,_0x3b6872,!![]);}catch(_0x4828f1){return BPromise[_0x7d44('0x25')](_0x4828f1);}return _0x32acdd['save']();};}function saveUpdates(_0x33c71b,_0x54cbbf){return function(_0x276027){if(_0x276027){return _0x276027[_0x7d44('0x26')](_0x33c71b)[_0x7d44('0x27')](function(_0x345e25){return _0x345e25;});}return null;};}function removeEntity(_0x33459a,_0x415c8f){return function(_0x3b453b){if(_0x3b453b){return _0x3b453b[_0x7d44('0x28')]()[_0x7d44('0x27')](function(){_0x33459a['status'](0xcc)[_0x7d44('0x1c')]();});}};}function handleEntityNotFound(_0x4d7196,_0x6da39e){return function(_0x490588){if(!_0x490588){_0x4d7196[_0x7d44('0x29')](0x194);}return _0x490588;};}function handleError(_0x5d568b,_0x125ab1){_0x125ab1=_0x125ab1||0x1f4;return function(_0x3edc97){logger[_0x7d44('0x2a')](_0x3edc97[_0x7d44('0x2b')]);if(_0x3edc97['name']){delete _0x3edc97[_0x7d44('0x2c')];}_0x5d568b['status'](_0x125ab1)[_0x7d44('0x2d')](_0x3edc97);};}exports[_0x7d44('0x2e')]=function(_0x5b0452,_0x55f757){var _0x195425={},_0x2009e3={},_0xe6982d={'count':0x0,'rows':[]};var _0x3289a7=_[_0x7d44('0x2f')](db[_0x7d44('0x30')][_0x7d44('0x31')],function(_0x3c17a3){return{'name':_0x3c17a3[_0x7d44('0x32')],'type':_0x3c17a3[_0x7d44('0x33')]['key']};});_0x2009e3['model']=_[_0x7d44('0x2f')](_0x3289a7,_0x7d44('0x2c'));_0x2009e3[_0x7d44('0x34')]=_[_0x7d44('0x35')](_0x5b0452[_0x7d44('0x34')]);_0x2009e3[_0x7d44('0x36')]=_['intersection'](_0x2009e3[_0x7d44('0x37')],_0x2009e3['query']);_0x195425['attributes']=_[_0x7d44('0x38')](_0x2009e3['model'],qs['fields'](_0x5b0452[_0x7d44('0x34')][_0x7d44('0x39')]));_0x195425[_0x7d44('0x3a')]=_0x195425['attributes'][_0x7d44('0x3b')]?_0x195425['attributes']:_0x2009e3[_0x7d44('0x37')];if(!_0x5b0452[_0x7d44('0x34')]['hasOwnProperty']('nolimit')){_0x195425[_0x7d44('0x20')]=qs[_0x7d44('0x20')](_0x5b0452[_0x7d44('0x34')][_0x7d44('0x20')]);_0x195425[_0x7d44('0x1e')]=qs[_0x7d44('0x1e')](_0x5b0452[_0x7d44('0x34')][_0x7d44('0x1e')]);}_0x195425[_0x7d44('0x3c')]=qs[_0x7d44('0x3d')](_0x5b0452[_0x7d44('0x34')][_0x7d44('0x3d')]);_0x195425['where']=qs[_0x7d44('0x36')](_[_0x7d44('0x3e')](_0x5b0452[_0x7d44('0x34')],_0x2009e3[_0x7d44('0x36')]),_0x3289a7);if(_0x5b0452[_0x7d44('0x34')][_0x7d44('0x3f')]){_0x195425[_0x7d44('0x40')]=_[_0x7d44('0x41')](_0x195425[_0x7d44('0x40')],{'$or':_[_0x7d44('0x2f')](_0x3289a7,function(_0x37eeb3){if(_0x37eeb3[_0x7d44('0x33')]!==_0x7d44('0x42')){var _0x3d22c6={};_0x3d22c6[_0x37eeb3[_0x7d44('0x2c')]]={'$like':'%'+_0x5b0452['query'][_0x7d44('0x3f')]+'%'};return _0x3d22c6;}})});}_0x195425=_[_0x7d44('0x41')]({},_0x195425,_0x5b0452[_0x7d44('0x43')]);var _0x22cf33={'where':_0x195425[_0x7d44('0x40')]};return db['FaxTransferReport'][_0x7d44('0x21')](_0x22cf33)[_0x7d44('0x27')](function(_0x4bb6ed){_0xe6982d[_0x7d44('0x21')]=_0x4bb6ed;if(_0x5b0452['query'][_0x7d44('0x44')]){_0x195425['include']=[{'all':!![]}];}return db[_0x7d44('0x30')][_0x7d44('0x45')](_0x195425);})[_0x7d44('0x27')](function(_0x4765d6){_0xe6982d[_0x7d44('0x46')]=_0x4765d6;return _0xe6982d;})[_0x7d44('0x27')](respondWithFilteredResult(_0x55f757,_0x195425))[_0x7d44('0x47')](handleError(_0x55f757,null));};exports[_0x7d44('0x48')]=function(_0x47b086,_0x11df59){var _0x33f83f={'raw':!![],'where':{'id':_0x47b086[_0x7d44('0x49')]['id']}},_0x459e12={};_0x459e12[_0x7d44('0x37')]=_[_0x7d44('0x35')](db['FaxTransferReport']['rawAttributes']);_0x459e12[_0x7d44('0x34')]=_[_0x7d44('0x35')](_0x47b086[_0x7d44('0x34')]);_0x459e12[_0x7d44('0x36')]=_[_0x7d44('0x38')](_0x459e12['model'],_0x459e12[_0x7d44('0x34')]);_0x33f83f[_0x7d44('0x3a')]=_['intersection'](_0x459e12[_0x7d44('0x37')],qs[_0x7d44('0x39')](_0x47b086[_0x7d44('0x34')][_0x7d44('0x39')]));_0x33f83f['attributes']=_0x33f83f['attributes'][_0x7d44('0x3b')]?_0x33f83f[_0x7d44('0x3a')]:_0x459e12[_0x7d44('0x37')];if(_0x47b086[_0x7d44('0x34')]['includeAll']){_0x33f83f[_0x7d44('0x4a')]=[{'all':!![]}];}_0x33f83f=_[_0x7d44('0x41')]({},_0x33f83f,_0x47b086[_0x7d44('0x43')]);return db[_0x7d44('0x30')][_0x7d44('0x4b')](_0x33f83f)[_0x7d44('0x27')](handleEntityNotFound(_0x11df59,null))['then'](respondWithResult(_0x11df59,null))[_0x7d44('0x47')](handleError(_0x11df59,null));};exports[_0x7d44('0x4c')]=function(_0x2fd376,_0x49b42a){return db['FaxTransferReport'][_0x7d44('0x4c')](_0x2fd376[_0x7d44('0x4d')],{})[_0x7d44('0x27')](respondWithResult(_0x49b42a,0xc9))[_0x7d44('0x47')](handleError(_0x49b42a,null));};exports[_0x7d44('0x26')]=function(_0x684ba0,_0x312c89){if(_0x684ba0[_0x7d44('0x4d')]['id']){delete _0x684ba0['body']['id'];}return db['FaxTransferReport'][_0x7d44('0x4b')]({'where':{'id':_0x684ba0[_0x7d44('0x49')]['id']}})[_0x7d44('0x27')](handleEntityNotFound(_0x312c89,null))[_0x7d44('0x27')](saveUpdates(_0x684ba0[_0x7d44('0x4d')],null))[_0x7d44('0x27')](respondWithResult(_0x312c89,null))['catch'](handleError(_0x312c89,null));};exports[_0x7d44('0x28')]=function(_0xeb58f0,_0xbba337){return db[_0x7d44('0x30')][_0x7d44('0x4b')]({'where':{'id':_0xeb58f0[_0x7d44('0x49')]['id']}})[_0x7d44('0x27')](handleEntityNotFound(_0xbba337,null))['then'](removeEntity(_0xbba337,null))[_0x7d44('0x47')](handleError(_0xbba337,null));};exports[_0x7d44('0x4e')]=function(_0x481f64,_0x243354){return db['FaxTransferReport'][_0x7d44('0x4e')]()[_0x7d44('0x27')](respondWithResult(_0x243354,null))[_0x7d44('0x47')](handleError(_0x243354,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index 2876c88..3d7f3a8 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 _0xb01a=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxTransferReport.attributes','exports','define','FaxTransferReport','uniqueid','lodash','util','../../config/logger'];(function(_0x2a7b20,_0x1faf56){var _0x591f38=function(_0x14c3a4){while(--_0x14c3a4){_0x2a7b20['push'](_0x2a7b20['shift']());}};_0x591f38(++_0x1faf56);}(_0xb01a,0x1a1));var _0xab01=function(_0x276cc5,_0xcf0153){_0x276cc5=_0x276cc5-0x0;var _0x546b89=_0xb01a[_0x276cc5];return _0x546b89;};'use strict';var _=require(_0xab01('0x0'));var util=require(_0xab01('0x1'));var logger=require(_0xab01('0x2'))(_0xab01('0x3'));var moment=require(_0xab01('0x4'));var BPromise=require(_0xab01('0x5'));var rp=require(_0xab01('0x6'));var fs=require('fs');var path=require(_0xab01('0x7'));var rimraf=require(_0xab01('0x8'));var config=require(_0xab01('0x9'));var attributes=require(_0xab01('0xa'));module[_0xab01('0xb')]=function(_0x22db85,_0x5d8dd9){return _0x22db85[_0xab01('0xc')](_0xab01('0xd'),attributes,{'tableName':'report_fax_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xab01('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4d5a=['report_fax_transfer','uniqueid','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./faxTransferReport.attributes','define','FaxTransferReport'];(function(_0x397de4,_0x38ac08){var _0x1ace8e=function(_0x4653d1){while(--_0x4653d1){_0x397de4['push'](_0x397de4['shift']());}};_0x1ace8e(++_0x38ac08);}(_0x4d5a,0x15e));var _0xa4d5=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0x4d5a[_0x55f8b4];return _0x2475f9;};'use strict';var _=require('lodash');var util=require(_0xa4d5('0x0'));var logger=require(_0xa4d5('0x1'))(_0xa4d5('0x2'));var moment=require('moment');var BPromise=require(_0xa4d5('0x3'));var rp=require(_0xa4d5('0x4'));var fs=require('fs');var path=require(_0xa4d5('0x5'));var rimraf=require(_0xa4d5('0x6'));var config=require('../../config/environment');var attributes=require(_0xa4d5('0x7'));module['exports']=function(_0x5e25a5,_0x32d194){return _0x5e25a5[_0xa4d5('0x8')](_0xa4d5('0x9'),attributes,{'tableName':_0xa4d5('0xa'),'paranoid':![],'indexes':[{'name':_0xa4d5('0xb'),'fields':[_0xa4d5('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index 9d2d137..223e2e0 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 _0xa6f2=['info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then'];(function(_0x2fe469,_0x731577){var _0x2b1bbb=function(_0x61ffee){while(--_0x61ffee){_0x2fe469['push'](_0x2fe469['shift']());}};_0x2b1bbb(++_0x731577);}(_0xa6f2,0x1ea));var _0x2a6f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa6f2[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x2a6f('0x0'));var util=require(_0x2a6f('0x1'));var moment=require(_0x2a6f('0x2'));var BPromise=require(_0x2a6f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2a6f('0x4'));var db=require(_0x2a6f('0x5'))['db'];var utils=require(_0x2a6f('0x6'));var logger=require(_0x2a6f('0x7'))(_0x2a6f('0x8'));var config=require(_0x2a6f('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x2a6f('0xa')][_0x2a6f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x17420a,_0x36b27f,_0x2b6b63){return new BPromise(function(_0x5558b6,_0x431671){return client[_0x2a6f('0xc')](_0x17420a,_0x2b6b63)[_0x2a6f('0xd')](function(_0x20d47e){logger[_0x2a6f('0xe')](_0x2a6f('0xf'),_0x36b27f,_0x2a6f('0x10'));logger['debug'](_0x2a6f('0x11'),_0x36b27f,_0x2a6f('0x10'),JSON[_0x2a6f('0x12')](_0x20d47e));if(_0x20d47e[_0x2a6f('0x13')]){if(_0x20d47e[_0x2a6f('0x13')][_0x2a6f('0x14')]===0x1f4){logger[_0x2a6f('0x13')](_0x2a6f('0xf'),_0x36b27f,_0x20d47e[_0x2a6f('0x13')][_0x2a6f('0x15')]);return _0x431671(_0x20d47e[_0x2a6f('0x13')]['message']);}logger[_0x2a6f('0x13')](_0x2a6f('0xf'),_0x36b27f,_0x20d47e['error'][_0x2a6f('0x15')]);return _0x5558b6(_0x20d47e[_0x2a6f('0x13')][_0x2a6f('0x15')]);}else{logger[_0x2a6f('0xe')](_0x2a6f('0xf'),_0x36b27f,_0x2a6f('0x10'));_0x5558b6(_0x20d47e[_0x2a6f('0x16')][_0x2a6f('0x15')]);}})[_0x2a6f('0x17')](function(_0x1ce0e8){logger[_0x2a6f('0x13')](_0x2a6f('0xf'),_0x36b27f,_0x1ce0e8);_0x431671(_0x1ce0e8);});});} \ No newline at end of file +var _0x1696=['http','request','then','info','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxTransferReport,\x20%s,\x20%s','message','result','catch','util','moment','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client'];(function(_0x46d9a1,_0x136802){var _0x17c284=function(_0x4c6820){while(--_0x4c6820){_0x46d9a1['push'](_0x46d9a1['shift']());}};_0x17c284(++_0x136802);}(_0x1696,0x10b));var _0x6169=function(_0x3eb431,_0x3bb542){_0x3eb431=_0x3eb431-0x0;var _0x52892d=_0x1696[_0x3eb431];return _0x52892d;};'use strict';var _=require('lodash');var util=require(_0x6169('0x0'));var moment=require(_0x6169('0x1'));var BPromise=require('bluebird');var rs=require(_0x6169('0x2'));var fs=require('fs');var Redis=require(_0x6169('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x6169('0x4'));var logger=require('../../config/logger')(_0x6169('0x5'));var config=require(_0x6169('0x6'));var jayson=require(_0x6169('0x7'));var client=jayson[_0x6169('0x8')][_0x6169('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3f28b5,_0x5e934c,_0x5cb5ba){return new BPromise(function(_0x2464cf,_0x1497ec){return client[_0x6169('0xa')](_0x3f28b5,_0x5cb5ba)[_0x6169('0xb')](function(_0x59876d){logger[_0x6169('0xc')]('FaxTransferReport,\x20%s,\x20%s',_0x5e934c,_0x6169('0xd'));logger[_0x6169('0xe')](_0x6169('0xf'),_0x5e934c,_0x6169('0xd'),JSON[_0x6169('0x10')](_0x59876d));if(_0x59876d[_0x6169('0x11')]){if(_0x59876d[_0x6169('0x11')][_0x6169('0x12')]===0x1f4){logger[_0x6169('0x11')](_0x6169('0x13'),_0x5e934c,_0x59876d[_0x6169('0x11')]['message']);return _0x1497ec(_0x59876d[_0x6169('0x11')][_0x6169('0x14')]);}logger[_0x6169('0x11')](_0x6169('0x13'),_0x5e934c,_0x59876d[_0x6169('0x11')][_0x6169('0x14')]);return _0x2464cf(_0x59876d[_0x6169('0x11')][_0x6169('0x14')]);}else{logger['info']('FaxTransferReport,\x20%s,\x20%s',_0x5e934c,_0x6169('0xd'));_0x2464cf(_0x59876d[_0x6169('0x15')][_0x6169('0x14')]);}})[_0x6169('0x16')](function(_0x125c64){logger['error']('FaxTransferReport,\x20%s,\x20%s',_0x5e934c,_0x125c64);_0x1497ec(_0x125c64);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index c33a982..5e01abd 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 _0xc167=['util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./faxTransferReport.controller','isAuthenticated','index','/describe','get','/:id','post','put','destroy','exports'];(function(_0x2b1f72,_0x14319c){var _0x2138a6=function(_0x3f8dcc){while(--_0x3f8dcc){_0x2b1f72['push'](_0x2b1f72['shift']());}};_0x2138a6(++_0x14319c);}(_0xc167,0x1a9));var _0x7c16=function(_0x41c961,_0x1999bd){_0x41c961=_0x41c961-0x0;var _0x37ac00=_0xc167[_0x41c961];return _0x37ac00;};'use strict';var multer=require('multer');var util=require(_0x7c16('0x0'));var path=require(_0x7c16('0x1'));var timeout=require(_0x7c16('0x2'));var express=require(_0x7c16('0x3'));var router=express['Router']();var fs_extra=require(_0x7c16('0x4'));var auth=require(_0x7c16('0x5'));var interaction=require(_0x7c16('0x6'));var config=require('../../config/environment');var controller=require(_0x7c16('0x7'));router['get']('/',auth[_0x7c16('0x8')](),controller[_0x7c16('0x9')]);router['get'](_0x7c16('0xa'),auth[_0x7c16('0x8')](),controller['describe']);router[_0x7c16('0xb')](_0x7c16('0xc'),auth[_0x7c16('0x8')](),controller['show']);router[_0x7c16('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x7c16('0xe')](_0x7c16('0xc'),auth[_0x7c16('0x8')](),controller['update']);router['delete'](_0x7c16('0xc'),auth[_0x7c16('0x8')](),controller[_0x7c16('0xf')]);module[_0x7c16('0x10')]=router; \ No newline at end of file +var _0xbb9c=['../../components/auth/service','../../config/environment','./faxTransferReport.controller','get','index','isAuthenticated','describe','/:id','show','post','delete','exports','multer','util','path','Router','fs-extra'];(function(_0x3474ac,_0x22d0f7){var _0x5345ec=function(_0x45056e){while(--_0x45056e){_0x3474ac['push'](_0x3474ac['shift']());}};_0x5345ec(++_0x22d0f7);}(_0xbb9c,0x1d7));var _0xcbb9=function(_0x11cd17,_0x489e02){_0x11cd17=_0x11cd17-0x0;var _0x3343ad=_0xbb9c[_0x11cd17];return _0x3343ad;};'use strict';var multer=require(_0xcbb9('0x0'));var util=require(_0xcbb9('0x1'));var path=require(_0xcbb9('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xcbb9('0x3')]();var fs_extra=require(_0xcbb9('0x4'));var auth=require(_0xcbb9('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xcbb9('0x6'));var controller=require(_0xcbb9('0x7'));router[_0xcbb9('0x8')]('/',auth['isAuthenticated'](),controller[_0xcbb9('0x9')]);router['get']('/describe',auth[_0xcbb9('0xa')](),controller[_0xcbb9('0xb')]);router[_0xcbb9('0x8')](_0xcbb9('0xc'),auth[_0xcbb9('0xa')](),controller[_0xcbb9('0xd')]);router[_0xcbb9('0xe')]('/',auth[_0xcbb9('0xa')](),controller['create']);router['put'](_0xcbb9('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xcbb9('0xf')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xcbb9('0x10')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index 2e2d0b4..244b536 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 _0x3c5a=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','put','/:id','update','delete','destroy','multer','util','path'];(function(_0x70fe55,_0x38f47e){var _0x416947=function(_0x3019d5){while(--_0x3019d5){_0x70fe55['push'](_0x70fe55['shift']());}};_0x416947(++_0x38f47e);}(_0x3c5a,0xe4));var _0xa3c5=function(_0x34232c,_0x18e61d){_0x34232c=_0x34232c-0x0;var _0x4d4f4e=_0x3c5a[_0x34232c];return _0x4d4f4e;};'use strict';var multer=require(_0xa3c5('0x0'));var util=require(_0xa3c5('0x1'));var path=require(_0xa3c5('0x2'));var timeout=require('connect-timeout');var express=require(_0xa3c5('0x3'));var router=express[_0xa3c5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xa3c5('0x5'));var interaction=require(_0xa3c5('0x6'));var config=require(_0xa3c5('0x7'));var controller=require('./intDeskAccount.controller');router['get']('/',auth[_0xa3c5('0x8')](),controller['index']);router[_0xa3c5('0x9')]('/:id',auth[_0xa3c5('0x8')](),controller['show']);router[_0xa3c5('0x9')](_0xa3c5('0xa'),auth['isAuthenticated'](),controller[_0xa3c5('0xb')]);router[_0xa3c5('0x9')](_0xa3c5('0xc'),auth[_0xa3c5('0x8')](),controller[_0xa3c5('0xd')]);router[_0xa3c5('0xe')]('/',auth[_0xa3c5('0x8')](),controller[_0xa3c5('0xf')]);router[_0xa3c5('0xe')]('/:id/configurations',auth[_0xa3c5('0x8')](),controller['addConfiguration']);router[_0xa3c5('0x10')](_0xa3c5('0x11'),auth[_0xa3c5('0x8')](),controller[_0xa3c5('0x12')]);router[_0xa3c5('0x13')]('/:id',auth[_0xa3c5('0x8')](),controller[_0xa3c5('0x14')]);module['exports']=router; \ No newline at end of file +var _0x9835=['delete','destroy','exports','multer','util','path','Router','fs-extra','../../components/auth/service','./intDeskAccount.controller','isAuthenticated','index','get','show','getConfigurations','getFields','post','create','/:id/configurations','put','update'];(function(_0x4b1ac6,_0x33c5df){var _0x5c39ab=function(_0x2b77f4){while(--_0x2b77f4){_0x4b1ac6['push'](_0x4b1ac6['shift']());}};_0x5c39ab(++_0x33c5df);}(_0x9835,0x17d));var _0x5983=function(_0x1f54e7,_0x1fb9d3){_0x1f54e7=_0x1f54e7-0x0;var _0x1b2649=_0x9835[_0x1f54e7];return _0x1b2649;};'use strict';var multer=require(_0x5983('0x0'));var util=require(_0x5983('0x1'));var path=require(_0x5983('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x5983('0x3')]();var fs_extra=require(_0x5983('0x4'));var auth=require(_0x5983('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x5983('0x6'));router['get']('/',auth[_0x5983('0x7')](),controller[_0x5983('0x8')]);router[_0x5983('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x5983('0xa')]);router[_0x5983('0x9')]('/:id/configurations',auth[_0x5983('0x7')](),controller[_0x5983('0xb')]);router['get']('/:id/fields',auth[_0x5983('0x7')](),controller[_0x5983('0xc')]);router[_0x5983('0xd')]('/',auth[_0x5983('0x7')](),controller[_0x5983('0xe')]);router[_0x5983('0xd')](_0x5983('0xf'),auth[_0x5983('0x7')](),controller['addConfiguration']);router[_0x5983('0x10')]('/:id',auth[_0x5983('0x7')](),controller[_0x5983('0x11')]);router[_0x5983('0x12')]('/:id',auth[_0x5983('0x7')](),controller[_0x5983('0x13')]);module[_0x5983('0x14')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index 1cb4ee6..4b507fd 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 _0x1f1a=['basic','ENUM','integrationTab','newTab','exports','STRING'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x1f1a,0x17e));var _0xa1f1=function(_0x138f59,_0x1b53fb){_0x138f59=_0x138f59-0x0;var _0x3d114d=_0x1f1a[_0x138f59];return _0x3d114d;};'use strict';var Sequelize=require('sequelize');module[_0xa1f1('0x0')]={'name':{'type':Sequelize[_0xa1f1('0x1')]},'description':{'type':Sequelize[_0xa1f1('0x1')]},'username':{'type':Sequelize[_0xa1f1('0x1')]},'remoteUri':{'type':Sequelize['STRING']},'authType':{'type':Sequelize['ENUM'](_0xa1f1('0x2')),'defaultValue':_0xa1f1('0x2')},'password':{'type':Sequelize[_0xa1f1('0x1')]},'consumerKey':{'type':Sequelize['STRING']},'consumerSecret':{'type':Sequelize[_0xa1f1('0x1')]},'token':{'type':Sequelize[_0xa1f1('0x1')]},'tokenSecret':{'type':Sequelize[_0xa1f1('0x1')]},'serverUrl':{'type':Sequelize[_0xa1f1('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xa1f1('0x3')](_0xa1f1('0x4'),_0xa1f1('0x5')),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0x1fa3=['newTab','sequelize','exports','STRING','basic','integrationTab'];(function(_0x4ee520,_0x1208cf){var _0x2a8d27=function(_0x4e1a66){while(--_0x4e1a66){_0x4ee520['push'](_0x4ee520['shift']());}};_0x2a8d27(++_0x1208cf);}(_0x1fa3,0x14b));var _0x31fa=function(_0x113c0c,_0x2622cc){_0x113c0c=_0x113c0c-0x0;var _0x31e2e3=_0x1fa3[_0x113c0c];return _0x31e2e3;};'use strict';var Sequelize=require(_0x31fa('0x0'));module[_0x31fa('0x1')]={'name':{'type':Sequelize[_0x31fa('0x2')]},'description':{'type':Sequelize[_0x31fa('0x2')]},'username':{'type':Sequelize[_0x31fa('0x2')]},'remoteUri':{'type':Sequelize['STRING']},'authType':{'type':Sequelize['ENUM'](_0x31fa('0x3')),'defaultValue':_0x31fa('0x3')},'password':{'type':Sequelize[_0x31fa('0x2')]},'consumerKey':{'type':Sequelize[_0x31fa('0x2')]},'consumerSecret':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0x31fa('0x2')]},'tokenSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x31fa('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x31fa('0x4'),_0x31fa('0x5')),'defaultValue':_0x31fa('0x4')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index c7c45de..273b4cc 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 _0x1f43=['%s:%s','toString','base64','_embedded','active','label','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','to-csv','ejs','fs-extra','lodash','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','request','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','sendStatus','end','status','json','undefined','limit','count','offset','Content-Range','reject','update','stack','name','send','index','map','fieldName','type','key','query','keys','filters','model','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','DeskAccount','includeAll','rows','show','rawAttributes','intersection','length','include','find','create','body','params','findOne','DeskConfiguration','getConfigurations','addConfiguration','AccountId','Subjects','channel','Descriptions','DeskField','getFields','remoteUri','username','password','consumerKey','tokenSecret','substring','format','%s/custom_fields','application/json','basic','headers','Basic\x20%s'];(function(_0x1573ea,_0x434f02){var _0x51c0e2=function(_0x5c9b28){while(--_0x5c9b28){_0x1573ea['push'](_0x1573ea['shift']());}};_0x51c0e2(++_0x434f02);}(_0x1f43,0x163));var _0x31f4=function(_0x298eb9,_0x3f1cf0){_0x298eb9=_0x298eb9-0x0;var _0xb670d2=_0x1f43[_0x298eb9];return _0xb670d2;};'use strict';var emlformat=require(_0x31f4('0x0'));var rimraf=require(_0x31f4('0x1'));var zipdir=require(_0x31f4('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x31f4('0x3'));var moment=require(_0x31f4('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x31f4('0x5'));var util=require(_0x31f4('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x31f4('0x7'));var ejs=require(_0x31f4('0x8'));var fs=require('fs');var fs_extra=require(_0x31f4('0x9'));var _=require(_0x31f4('0xa'));var squel=require('squel');var crypto=require(_0x31f4('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x31f4('0x7'));var querystring=require(_0x31f4('0xc'));var Papa=require(_0x31f4('0xd'));var Redis=require('ioredis');var authService=require(_0x31f4('0xe'));var qs=require(_0x31f4('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x31f4('0x10'))(_0x31f4('0x11'));var utils=require('../../config/utils');var config=require(_0x31f4('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x31f4('0x13'))['db'];var integrations=require(_0x31f4('0x14'));var jayson=require(_0x31f4('0x15'));var client=jayson[_0x31f4('0x16')]['http']({'port':0x232a});function respondWithRpcPromise(_0x531622,_0x435d9e,_0x456a67,_0x3df229){return new BPromise(function(_0x419c22,_0xed21d9){var _0x45cd50=_0x3df229||client;return _0x45cd50[_0x31f4('0x17')](_0x531622,_0x456a67)[_0x31f4('0x18')](function(_0x486112){logger[_0x31f4('0x19')](_0x31f4('0x1a'),_0x435d9e,_0x31f4('0x1b'));logger[_0x31f4('0x1c')](_0x31f4('0x1d'),_0x435d9e,_0x31f4('0x1b'),JSON[_0x31f4('0x1e')](_0x486112));if(_0x486112['error']){if(_0x486112['error'][_0x31f4('0x1f')]===0x1f4){logger[_0x31f4('0x20')]('DeskAccount,\x20%s,\x20%s',_0x435d9e,_0x486112[_0x31f4('0x20')][_0x31f4('0x21')]);return _0xed21d9(_0x486112[_0x31f4('0x20')][_0x31f4('0x21')]);}logger['error'](_0x31f4('0x1a'),_0x435d9e,_0x486112['error'][_0x31f4('0x21')]);return _0x419c22(_0x486112['error'][_0x31f4('0x21')]);}else{logger['info'](_0x31f4('0x1a'),_0x435d9e,_0x31f4('0x1b'));_0x419c22(_0x486112[_0x31f4('0x22')][_0x31f4('0x21')]);}})[_0x31f4('0x23')](function(_0x2994ea){logger[_0x31f4('0x20')](_0x31f4('0x1a'),_0x435d9e,_0x2994ea);_0xed21d9(_0x2994ea);});});}function respondWithStatusCode(_0x56b488,_0x288676){_0x288676=_0x288676||0xcc;return function(_0x39af50){if(_0x39af50){return _0x56b488[_0x31f4('0x24')](_0x288676);}return _0x56b488['status'](_0x288676)[_0x31f4('0x25')]();};}function respondWithResult(_0x1fcbfd,_0x4affd2){_0x4affd2=_0x4affd2||0xc8;return function(_0x529d50){if(_0x529d50){return _0x1fcbfd[_0x31f4('0x26')](_0x4affd2)[_0x31f4('0x27')](_0x529d50);}};}function respondWithFilteredResult(_0x34122c,_0x336e77){return function(_0x1fc64c){if(_0x1fc64c){var _0x4a5666=typeof _0x336e77['offset']===_0x31f4('0x28')&&typeof _0x336e77[_0x31f4('0x29')]===_0x31f4('0x28');var _0xe80cac=_0x1fc64c[_0x31f4('0x2a')];var _0x3407d6=_0x4a5666?0x0:_0x336e77[_0x31f4('0x2b')];var _0x46b130=_0x4a5666?_0x1fc64c[_0x31f4('0x2a')]:_0x336e77['offset']+_0x336e77['limit'];var _0x1e148e;if(_0x46b130>=_0xe80cac){_0x46b130=_0xe80cac;_0x1e148e=0xc8;}else{_0x1e148e=0xce;}_0x34122c['status'](_0x1e148e);return _0x34122c['set'](_0x31f4('0x2c'),_0x3407d6+'-'+_0x46b130+'/'+_0xe80cac)[_0x31f4('0x27')](_0x1fc64c);}return null;};}function patchUpdates(_0x117d6d){return function(_0x2b8558){try{jsonpatch['apply'](_0x2b8558,_0x117d6d,!![]);}catch(_0x5875b4){return BPromise[_0x31f4('0x2d')](_0x5875b4);}return _0x2b8558['save']();};}function saveUpdates(_0x43f2f3,_0x405faa){return function(_0x556477){if(_0x556477){return _0x556477[_0x31f4('0x2e')](_0x43f2f3)[_0x31f4('0x18')](function(_0x9e12fa){return _0x9e12fa;});}return null;};}function removeEntity(_0x41b08f,_0x168121){return function(_0x3aaf86){if(_0x3aaf86){return _0x3aaf86['destroy']()['then'](function(){_0x41b08f[_0x31f4('0x26')](0xcc)[_0x31f4('0x25')]();});}};}function handleEntityNotFound(_0x1dac67,_0x3e7916){return function(_0x67d02f){if(!_0x67d02f){_0x1dac67['sendStatus'](0x194);}return _0x67d02f;};}function handleError(_0x57034e,_0x2ea10b){_0x2ea10b=_0x2ea10b||0x1f4;return function(_0x47fe25){logger['error'](_0x47fe25[_0x31f4('0x2f')]);if(_0x47fe25[_0x31f4('0x30')]){delete _0x47fe25[_0x31f4('0x30')];}_0x57034e[_0x31f4('0x26')](_0x2ea10b)[_0x31f4('0x31')](_0x47fe25);};}exports[_0x31f4('0x32')]=function(_0x4c9b04,_0x3bb0fc){var _0x3f781a={},_0x2c0c88={},_0x55fbc2={'count':0x0,'rows':[]};var _0x361d06=_[_0x31f4('0x33')](db['DeskAccount']['rawAttributes'],function(_0x273e1b){return{'name':_0x273e1b[_0x31f4('0x34')],'type':_0x273e1b[_0x31f4('0x35')][_0x31f4('0x36')]};});_0x2c0c88['model']=_[_0x31f4('0x33')](_0x361d06,_0x31f4('0x30'));_0x2c0c88[_0x31f4('0x37')]=_[_0x31f4('0x38')](_0x4c9b04[_0x31f4('0x37')]);_0x2c0c88[_0x31f4('0x39')]=_['intersection'](_0x2c0c88[_0x31f4('0x3a')],_0x2c0c88[_0x31f4('0x37')]);_0x3f781a['attributes']=_['intersection'](_0x2c0c88['model'],qs[_0x31f4('0x3b')](_0x4c9b04[_0x31f4('0x37')][_0x31f4('0x3b')]));_0x3f781a[_0x31f4('0x3c')]=_0x3f781a[_0x31f4('0x3c')]['length']?_0x3f781a[_0x31f4('0x3c')]:_0x2c0c88['model'];if(!_0x4c9b04[_0x31f4('0x37')][_0x31f4('0x3d')](_0x31f4('0x3e'))){_0x3f781a['limit']=qs[_0x31f4('0x29')](_0x4c9b04['query'][_0x31f4('0x29')]);_0x3f781a[_0x31f4('0x2b')]=qs[_0x31f4('0x2b')](_0x4c9b04['query'][_0x31f4('0x2b')]);}_0x3f781a[_0x31f4('0x3f')]=qs[_0x31f4('0x40')](_0x4c9b04[_0x31f4('0x37')]['sort']);_0x3f781a['where']=qs['filters'](_[_0x31f4('0x41')](_0x4c9b04[_0x31f4('0x37')],_0x2c0c88[_0x31f4('0x39')]),_0x361d06);if(_0x4c9b04[_0x31f4('0x37')][_0x31f4('0x42')]){_0x3f781a[_0x31f4('0x43')]=_[_0x31f4('0x44')](_0x3f781a[_0x31f4('0x43')],{'$or':_[_0x31f4('0x33')](_0x361d06,function(_0x17b7eb){if(_0x17b7eb[_0x31f4('0x35')]!==_0x31f4('0x45')){var _0x3740ff={};_0x3740ff[_0x17b7eb[_0x31f4('0x30')]]={'$like':'%'+_0x4c9b04['query'][_0x31f4('0x42')]+'%'};return _0x3740ff;}})});}_0x3f781a=_[_0x31f4('0x44')]({},_0x3f781a,_0x4c9b04[_0x31f4('0x46')]);var _0x36ed9f={'where':_0x3f781a[_0x31f4('0x43')]};return db[_0x31f4('0x47')][_0x31f4('0x2a')](_0x36ed9f)[_0x31f4('0x18')](function(_0x5b4412){_0x55fbc2[_0x31f4('0x2a')]=_0x5b4412;if(_0x4c9b04['query'][_0x31f4('0x48')]){_0x3f781a['include']=[{'all':!![]}];}return db[_0x31f4('0x47')]['findAll'](_0x3f781a);})[_0x31f4('0x18')](function(_0x31e689){_0x55fbc2[_0x31f4('0x49')]=_0x31e689;return _0x55fbc2;})[_0x31f4('0x18')](respondWithFilteredResult(_0x3bb0fc,_0x3f781a))[_0x31f4('0x23')](handleError(_0x3bb0fc,null));};exports[_0x31f4('0x4a')]=function(_0xd6b3ec,_0x4dd867){var _0x286d7={'raw':![],'where':{'id':_0xd6b3ec['params']['id']}},_0x51f3cf={};_0x51f3cf[_0x31f4('0x3a')]=_[_0x31f4('0x38')](db['DeskAccount'][_0x31f4('0x4b')]);_0x51f3cf[_0x31f4('0x37')]=_[_0x31f4('0x38')](_0xd6b3ec[_0x31f4('0x37')]);_0x51f3cf[_0x31f4('0x39')]=_[_0x31f4('0x4c')](_0x51f3cf['model'],_0x51f3cf[_0x31f4('0x37')]);_0x286d7[_0x31f4('0x3c')]=_['intersection'](_0x51f3cf['model'],qs[_0x31f4('0x3b')](_0xd6b3ec[_0x31f4('0x37')][_0x31f4('0x3b')]));_0x286d7['attributes']=_0x286d7[_0x31f4('0x3c')][_0x31f4('0x4d')]?_0x286d7[_0x31f4('0x3c')]:_0x51f3cf[_0x31f4('0x3a')];if(_0xd6b3ec[_0x31f4('0x37')]['includeAll']){_0x286d7[_0x31f4('0x4e')]=[{'all':!![]}];}_0x286d7=_[_0x31f4('0x44')]({},_0x286d7,_0xd6b3ec[_0x31f4('0x46')]);return db[_0x31f4('0x47')][_0x31f4('0x4f')](_0x286d7)[_0x31f4('0x18')](handleEntityNotFound(_0x4dd867,null))[_0x31f4('0x18')](respondWithResult(_0x4dd867,null))['catch'](handleError(_0x4dd867,null));};exports[_0x31f4('0x50')]=function(_0x276b7b,_0x423d22){return db[_0x31f4('0x47')]['create'](_0x276b7b[_0x31f4('0x51')],{})[_0x31f4('0x18')](respondWithResult(_0x423d22,0xc9))[_0x31f4('0x23')](handleError(_0x423d22,null));};exports[_0x31f4('0x2e')]=function(_0x521c02,_0x27b70d){if(_0x521c02[_0x31f4('0x51')]['id']){delete _0x521c02[_0x31f4('0x51')]['id'];}return db[_0x31f4('0x47')][_0x31f4('0x4f')]({'where':{'id':_0x521c02[_0x31f4('0x52')]['id']}})[_0x31f4('0x18')](handleEntityNotFound(_0x27b70d,null))['then'](saveUpdates(_0x521c02[_0x31f4('0x51')],null))['then'](respondWithResult(_0x27b70d,null))[_0x31f4('0x23')](handleError(_0x27b70d,null));};exports['destroy']=function(_0x569906,_0x38a684){return db[_0x31f4('0x47')]['find']({'where':{'id':_0x569906['params']['id']}})[_0x31f4('0x18')](handleEntityNotFound(_0x38a684,null))[_0x31f4('0x18')](removeEntity(_0x38a684,null))[_0x31f4('0x23')](handleError(_0x38a684,null));};exports['getConfigurations']=function(_0x92d38c,_0x570ca8,_0x16255f){var _0x1d3bc7={};var _0x29fbfa={};var _0x33db6f;var _0x157075;return db[_0x31f4('0x47')][_0x31f4('0x53')]({'where':{'id':_0x92d38c[_0x31f4('0x52')]['id']}})[_0x31f4('0x18')](handleEntityNotFound(_0x570ca8,null))['then'](function(_0x1f691b){if(_0x1f691b){_0x33db6f=_0x1f691b;_0x29fbfa['model']=_[_0x31f4('0x38')](db[_0x31f4('0x54')][_0x31f4('0x4b')]);_0x29fbfa[_0x31f4('0x37')]=_[_0x31f4('0x38')](_0x92d38c[_0x31f4('0x37')]);_0x29fbfa[_0x31f4('0x39')]=_[_0x31f4('0x4c')](_0x29fbfa['model'],_0x29fbfa[_0x31f4('0x37')]);_0x1d3bc7[_0x31f4('0x3c')]=_['intersection'](_0x29fbfa[_0x31f4('0x3a')],qs[_0x31f4('0x3b')](_0x92d38c['query']['fields']));_0x1d3bc7[_0x31f4('0x3c')]=_0x1d3bc7[_0x31f4('0x3c')][_0x31f4('0x4d')]?_0x1d3bc7['attributes']:_0x29fbfa['model'];_0x1d3bc7[_0x31f4('0x3f')]=qs[_0x31f4('0x40')](_0x92d38c['query'][_0x31f4('0x40')]);_0x1d3bc7[_0x31f4('0x43')]=qs[_0x31f4('0x39')](_[_0x31f4('0x41')](_0x92d38c['query'],_0x29fbfa[_0x31f4('0x39')]));if(_0x92d38c[_0x31f4('0x37')][_0x31f4('0x42')]){_0x1d3bc7[_0x31f4('0x43')]=_[_0x31f4('0x44')](_0x1d3bc7[_0x31f4('0x43')],{'$or':_[_0x31f4('0x33')](_0x1d3bc7[_0x31f4('0x3c')],function(_0x2a1375){var _0x1bdb4f={};_0x1bdb4f[_0x2a1375]={'$like':'%'+_0x92d38c['query'][_0x31f4('0x42')]+'%'};return _0x1bdb4f;})});}_0x1d3bc7=_[_0x31f4('0x44')]({},_0x1d3bc7,_0x92d38c[_0x31f4('0x46')]);return _0x33db6f[_0x31f4('0x55')](_0x1d3bc7);}})[_0x31f4('0x18')](function(_0x1f3c25){if(_0x1f3c25){_0x157075=_0x1f3c25['length'];if(!_0x92d38c[_0x31f4('0x37')][_0x31f4('0x3d')](_0x31f4('0x3e'))){_0x1d3bc7[_0x31f4('0x29')]=qs[_0x31f4('0x29')](_0x92d38c[_0x31f4('0x37')]['limit']);_0x1d3bc7['offset']=qs[_0x31f4('0x2b')](_0x92d38c[_0x31f4('0x37')][_0x31f4('0x2b')]);}return _0x33db6f[_0x31f4('0x55')](_0x1d3bc7);}})['then'](function(_0xf0a6a6){if(_0xf0a6a6){return _0xf0a6a6?{'count':_0x157075,'rows':_0xf0a6a6}:null;}})[_0x31f4('0x18')](respondWithResult(_0x570ca8,null))['catch'](handleError(_0x570ca8,null));};exports[_0x31f4('0x56')]=function(_0x31c4e9,_0x4e431f,_0x30fe16){if(_0x31c4e9[_0x31f4('0x51')]['id']){delete _0x31c4e9[_0x31f4('0x51')]['id'];}return db[_0x31f4('0x47')]['findOne']({'where':{'id':_0x31c4e9[_0x31f4('0x52')]['id']}})['then'](handleEntityNotFound(_0x4e431f,null))[_0x31f4('0x18')](function(_0x5a325b){if(_0x5a325b){_0x31c4e9[_0x31f4('0x51')][_0x31f4('0x57')]=_0x5a325b['id'];_0x31c4e9[_0x31f4('0x51')][_0x31f4('0x58')]=integrations['getSubjects'](_0x31c4e9['body'][_0x31f4('0x59')],_0x31c4e9[_0x31f4('0x51')][_0x31f4('0x35')]);_0x31c4e9['body'][_0x31f4('0x5a')]=integrations['getDescriptions'](_0x31c4e9[_0x31f4('0x51')]['channel'],_0x31c4e9['body'][_0x31f4('0x35')]);return db[_0x31f4('0x54')][_0x31f4('0x50')](_0x31c4e9[_0x31f4('0x51')],{'include':[{'model':db['DeskField'],'as':_0x31f4('0x58')},{'model':db[_0x31f4('0x5b')],'as':_0x31f4('0x5a')}]});}return null;})[_0x31f4('0x18')](respondWithResult(_0x4e431f,null))[_0x31f4('0x23')](handleError(_0x4e431f,null));};exports[_0x31f4('0x5c')]=function(_0x5ad64c,_0x34c0b3,_0x48e851){var _0x280c22=[{'name':'priority','label':'priority','custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x34721d='';return db[_0x31f4('0x47')][_0x31f4('0x53')]({'where':{'id':_0x5ad64c['params']['id']},'attributes':['id',_0x31f4('0x5d'),'authType',_0x31f4('0x5e'),_0x31f4('0x5f'),_0x31f4('0x60'),'consumerSecret','token',_0x31f4('0x61')]})['then'](handleEntityNotFound(_0x34c0b3,null))[_0x31f4('0x18')](function(_0x18b817){if(_0x18b817){_0x34721d=_0x18b817[_0x31f4('0x5d')];var _0xaaec11=_0x34721d['slice'](-0x1);if(_0xaaec11==='/'){_0x34721d=_0x34721d[_0x31f4('0x62')](0x0,_0x34721d['lastIndexOf'](_0xaaec11));}var _0x4b231e={'method':'GET','uri':util[_0x31f4('0x63')](_0x31f4('0x64'),_0x34721d),'headers':{'Content-Type':_0x31f4('0x65'),'Accept':'application/json'},'json':!![]};if(_0x18b817['authType']===_0x31f4('0x66')){_0x4b231e[_0x31f4('0x67')]['Authorization']=util[_0x31f4('0x63')](_0x31f4('0x68'),new Buffer(util[_0x31f4('0x63')](_0x31f4('0x69'),_0x18b817['username'],_0x18b817[_0x31f4('0x5f')]))[_0x31f4('0x6a')](_0x31f4('0x6b')));}return rp(_0x4b231e)[_0x31f4('0x18')](function(_0x43e613){return _0x280c22['concat'](_['map'](_0x43e613[_0x31f4('0x6c')]['entries'],function(_0x3d1311){return{'id':_0x3d1311[_0x31f4('0x30')],'name':_0x3d1311['name'],'type':_0x3d1311[_0x31f4('0x35')],'active':_0x3d1311[_0x31f4('0x6d')],'label':_0x3d1311[_0x31f4('0x6e')],'custom':!![]};}));});}})[_0x31f4('0x18')](function(_0x2b6b4b){return{'count':_0x2b6b4b[_0x31f4('0x4d')],'rows':_0x2b6b4b};})[_0x31f4('0x18')](respondWithResult(_0x34c0b3,null))[_0x31f4('0x23')](function(_0x10bb3e){var _0x34bba0=_0x5ad64c['query'][_0x31f4('0x6f')]?0x1f4:_0x10bb3e[_0x31f4('0x70')]||0x1f4;logger[_0x31f4('0x20')](_0x31f4('0x71'),_0x31f4('0x5c'),_0x34bba0,JSON[_0x31f4('0x1e')](_0x10bb3e));delete _0x10bb3e[_0x31f4('0x30')];if(_0x34bba0===0x191){_0x34bba0=0x190;}_0x34c0b3[_0x31f4('0x26')](_0x34bba0)[_0x31f4('0x31')](_0x5ad64c[_0x31f4('0x37')]['test']?{'message':_0x31f4('0x72'),'statusCode':_0x10bb3e[_0x31f4('0x70')]}:_0x10bb3e);});}; \ No newline at end of file +var _0xec29=['AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','DeskField','getFields','priority','remoteUri','authType','username','password','consumerKey','consumerSecret','token','slice','GET','format','%s/custom_fields','application/json','basic','Authorization','toString','_embedded','entries','active','label','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../components/integrations/configuration','jayson/promise','client','http','request','request\x20sent','stringify','error','code','DeskAccount,\x20%s,\x20%s','message','result','catch','sendStatus','end','status','json','offset','limit','count','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','map','DeskAccount','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','rawAttributes','include','find','create','body','params','getConfigurations','findOne','DeskConfiguration','addConfiguration'];(function(_0x503786,_0x37843b){var _0x22cd39=function(_0x2e003c){while(--_0x2e003c){_0x503786['push'](_0x503786['shift']());}};_0x22cd39(++_0x37843b);}(_0xec29,0x9b));var _0x9ec2=function(_0x3fba37,_0xd25543){_0x3fba37=_0x3fba37-0x0;var _0x58270b=_0xec29[_0x3fba37];return _0x58270b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9ec2('0x0'));var zipdir=require(_0x9ec2('0x1'));var jsonpatch=require(_0x9ec2('0x2'));var rp=require(_0x9ec2('0x3'));var moment=require(_0x9ec2('0x4'));var BPromise=require(_0x9ec2('0x5'));var Mustache=require(_0x9ec2('0x6'));var util=require(_0x9ec2('0x7'));var path=require(_0x9ec2('0x8'));var sox=require(_0x9ec2('0x9'));var csv=require(_0x9ec2('0xa'));var ejs=require(_0x9ec2('0xb'));var fs=require('fs');var fs_extra=require(_0x9ec2('0xc'));var _=require(_0x9ec2('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x9ec2('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x9ec2('0xf'));var Papa=require(_0x9ec2('0x10'));var Redis=require(_0x9ec2('0x11'));var authService=require(_0x9ec2('0x12'));var qs=require(_0x9ec2('0x13'));var as=require(_0x9ec2('0x14'));var hardwareService=require(_0x9ec2('0x15'));var logger=require(_0x9ec2('0x16'))('api');var utils=require('../../config/utils');var config=require(_0x9ec2('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0x9ec2('0x18'));var jayson=require(_0x9ec2('0x19'));var client=jayson[_0x9ec2('0x1a')][_0x9ec2('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x2c6081,_0x4a21e0,_0x1bd582,_0x54b6da){return new BPromise(function(_0x109829,_0x4e3045){var _0x4638c3=_0x54b6da||client;return _0x4638c3[_0x9ec2('0x1c')](_0x2c6081,_0x1bd582)['then'](function(_0x462d06){logger['info']('DeskAccount,\x20%s,\x20%s',_0x4a21e0,'request\x20sent');logger['debug']('DeskAccount,\x20%s,\x20%s,\x20%s',_0x4a21e0,_0x9ec2('0x1d'),JSON[_0x9ec2('0x1e')](_0x462d06));if(_0x462d06[_0x9ec2('0x1f')]){if(_0x462d06['error'][_0x9ec2('0x20')]===0x1f4){logger[_0x9ec2('0x1f')](_0x9ec2('0x21'),_0x4a21e0,_0x462d06[_0x9ec2('0x1f')][_0x9ec2('0x22')]);return _0x4e3045(_0x462d06[_0x9ec2('0x1f')][_0x9ec2('0x22')]);}logger[_0x9ec2('0x1f')](_0x9ec2('0x21'),_0x4a21e0,_0x462d06['error']['message']);return _0x109829(_0x462d06[_0x9ec2('0x1f')][_0x9ec2('0x22')]);}else{logger['info'](_0x9ec2('0x21'),_0x4a21e0,_0x9ec2('0x1d'));_0x109829(_0x462d06[_0x9ec2('0x23')][_0x9ec2('0x22')]);}})[_0x9ec2('0x24')](function(_0x429065){logger[_0x9ec2('0x1f')]('DeskAccount,\x20%s,\x20%s',_0x4a21e0,_0x429065);_0x4e3045(_0x429065);});});}function respondWithStatusCode(_0x46d23f,_0x301629){_0x301629=_0x301629||0xcc;return function(_0x595215){if(_0x595215){return _0x46d23f[_0x9ec2('0x25')](_0x301629);}return _0x46d23f['status'](_0x301629)[_0x9ec2('0x26')]();};}function respondWithResult(_0x5cf619,_0x5530ac){_0x5530ac=_0x5530ac||0xc8;return function(_0x4d0ab8){if(_0x4d0ab8){return _0x5cf619[_0x9ec2('0x27')](_0x5530ac)[_0x9ec2('0x28')](_0x4d0ab8);}};}function respondWithFilteredResult(_0x2eec90,_0x3c95c8){return function(_0x4bd946){if(_0x4bd946){var _0xc018d3=typeof _0x3c95c8[_0x9ec2('0x29')]==='undefined'&&typeof _0x3c95c8[_0x9ec2('0x2a')]==='undefined';var _0x202284=_0x4bd946[_0x9ec2('0x2b')];var _0x1c18b7=_0xc018d3?0x0:_0x3c95c8['offset'];var _0x580c12=_0xc018d3?_0x4bd946['count']:_0x3c95c8['offset']+_0x3c95c8['limit'];var _0x49b015;if(_0x580c12>=_0x202284){_0x580c12=_0x202284;_0x49b015=0xc8;}else{_0x49b015=0xce;}_0x2eec90[_0x9ec2('0x27')](_0x49b015);return _0x2eec90['set'](_0x9ec2('0x2c'),_0x1c18b7+'-'+_0x580c12+'/'+_0x202284)[_0x9ec2('0x28')](_0x4bd946);}return null;};}function patchUpdates(_0x1ea13c){return function(_0x3e4d3f){try{jsonpatch[_0x9ec2('0x2d')](_0x3e4d3f,_0x1ea13c,!![]);}catch(_0x4e3773){return BPromise[_0x9ec2('0x2e')](_0x4e3773);}return _0x3e4d3f[_0x9ec2('0x2f')]();};}function saveUpdates(_0x412f91,_0xf1f2ea){return function(_0x38d59d){if(_0x38d59d){return _0x38d59d[_0x9ec2('0x30')](_0x412f91)[_0x9ec2('0x31')](function(_0x5c34c3){return _0x5c34c3;});}return null;};}function removeEntity(_0xb69fe1,_0x21bb28){return function(_0x3d21dd){if(_0x3d21dd){return _0x3d21dd[_0x9ec2('0x32')]()['then'](function(){_0xb69fe1[_0x9ec2('0x27')](0xcc)[_0x9ec2('0x26')]();});}};}function handleEntityNotFound(_0x2cd143,_0x204bd2){return function(_0x313883){if(!_0x313883){_0x2cd143[_0x9ec2('0x25')](0x194);}return _0x313883;};}function handleError(_0x6c4a46,_0x23027d){_0x23027d=_0x23027d||0x1f4;return function(_0xf2be70){logger[_0x9ec2('0x1f')](_0xf2be70[_0x9ec2('0x33')]);if(_0xf2be70[_0x9ec2('0x34')]){delete _0xf2be70[_0x9ec2('0x34')];}_0x6c4a46[_0x9ec2('0x27')](_0x23027d)[_0x9ec2('0x35')](_0xf2be70);};}exports['index']=function(_0x284141,_0x1bbb25){var _0xfb8934={},_0x2c6c82={},_0x2bdf6e={'count':0x0,'rows':[]};var _0x226078=_[_0x9ec2('0x36')](db[_0x9ec2('0x37')]['rawAttributes'],function(_0x30d840){return{'name':_0x30d840[_0x9ec2('0x38')],'type':_0x30d840[_0x9ec2('0x39')][_0x9ec2('0x3a')]};});_0x2c6c82[_0x9ec2('0x3b')]=_['map'](_0x226078,_0x9ec2('0x34'));_0x2c6c82[_0x9ec2('0x3c')]=_[_0x9ec2('0x3d')](_0x284141[_0x9ec2('0x3c')]);_0x2c6c82[_0x9ec2('0x3e')]=_[_0x9ec2('0x3f')](_0x2c6c82[_0x9ec2('0x3b')],_0x2c6c82[_0x9ec2('0x3c')]);_0xfb8934[_0x9ec2('0x40')]=_[_0x9ec2('0x3f')](_0x2c6c82[_0x9ec2('0x3b')],qs['fields'](_0x284141[_0x9ec2('0x3c')][_0x9ec2('0x41')]));_0xfb8934[_0x9ec2('0x40')]=_0xfb8934[_0x9ec2('0x40')][_0x9ec2('0x42')]?_0xfb8934[_0x9ec2('0x40')]:_0x2c6c82[_0x9ec2('0x3b')];if(!_0x284141[_0x9ec2('0x3c')][_0x9ec2('0x43')](_0x9ec2('0x44'))){_0xfb8934[_0x9ec2('0x2a')]=qs['limit'](_0x284141['query'][_0x9ec2('0x2a')]);_0xfb8934['offset']=qs[_0x9ec2('0x29')](_0x284141['query'][_0x9ec2('0x29')]);}_0xfb8934[_0x9ec2('0x45')]=qs[_0x9ec2('0x46')](_0x284141[_0x9ec2('0x3c')][_0x9ec2('0x46')]);_0xfb8934[_0x9ec2('0x47')]=qs[_0x9ec2('0x3e')](_[_0x9ec2('0x48')](_0x284141[_0x9ec2('0x3c')],_0x2c6c82[_0x9ec2('0x3e')]),_0x226078);if(_0x284141[_0x9ec2('0x3c')][_0x9ec2('0x49')]){_0xfb8934[_0x9ec2('0x47')]=_[_0x9ec2('0x4a')](_0xfb8934[_0x9ec2('0x47')],{'$or':_[_0x9ec2('0x36')](_0x226078,function(_0x2bb01e){if(_0x2bb01e[_0x9ec2('0x39')]!==_0x9ec2('0x4b')){var _0x33d2ec={};_0x33d2ec[_0x2bb01e[_0x9ec2('0x34')]]={'$like':'%'+_0x284141['query']['filter']+'%'};return _0x33d2ec;}})});}_0xfb8934=_[_0x9ec2('0x4a')]({},_0xfb8934,_0x284141[_0x9ec2('0x4c')]);var _0x459894={'where':_0xfb8934[_0x9ec2('0x47')]};return db['DeskAccount'][_0x9ec2('0x2b')](_0x459894)[_0x9ec2('0x31')](function(_0x18c760){_0x2bdf6e['count']=_0x18c760;if(_0x284141['query'][_0x9ec2('0x4d')]){_0xfb8934['include']=[{'all':!![]}];}return db[_0x9ec2('0x37')][_0x9ec2('0x4e')](_0xfb8934);})[_0x9ec2('0x31')](function(_0x237f3e){_0x2bdf6e[_0x9ec2('0x4f')]=_0x237f3e;return _0x2bdf6e;})[_0x9ec2('0x31')](respondWithFilteredResult(_0x1bbb25,_0xfb8934))['catch'](handleError(_0x1bbb25,null));};exports[_0x9ec2('0x50')]=function(_0x1615e7,_0x1ba8ce){var _0x425f93={'raw':![],'where':{'id':_0x1615e7['params']['id']}},_0x4bca9f={};_0x4bca9f[_0x9ec2('0x3b')]=_['keys'](db[_0x9ec2('0x37')][_0x9ec2('0x51')]);_0x4bca9f[_0x9ec2('0x3c')]=_[_0x9ec2('0x3d')](_0x1615e7[_0x9ec2('0x3c')]);_0x4bca9f['filters']=_['intersection'](_0x4bca9f['model'],_0x4bca9f[_0x9ec2('0x3c')]);_0x425f93[_0x9ec2('0x40')]=_[_0x9ec2('0x3f')](_0x4bca9f[_0x9ec2('0x3b')],qs[_0x9ec2('0x41')](_0x1615e7[_0x9ec2('0x3c')][_0x9ec2('0x41')]));_0x425f93['attributes']=_0x425f93[_0x9ec2('0x40')]['length']?_0x425f93[_0x9ec2('0x40')]:_0x4bca9f[_0x9ec2('0x3b')];if(_0x1615e7[_0x9ec2('0x3c')][_0x9ec2('0x4d')]){_0x425f93[_0x9ec2('0x52')]=[{'all':!![]}];}_0x425f93=_[_0x9ec2('0x4a')]({},_0x425f93,_0x1615e7[_0x9ec2('0x4c')]);return db[_0x9ec2('0x37')][_0x9ec2('0x53')](_0x425f93)[_0x9ec2('0x31')](handleEntityNotFound(_0x1ba8ce,null))[_0x9ec2('0x31')](respondWithResult(_0x1ba8ce,null))[_0x9ec2('0x24')](handleError(_0x1ba8ce,null));};exports[_0x9ec2('0x54')]=function(_0x1dae11,_0x4aa2d1){return db[_0x9ec2('0x37')][_0x9ec2('0x54')](_0x1dae11[_0x9ec2('0x55')],{})[_0x9ec2('0x31')](respondWithResult(_0x4aa2d1,0xc9))['catch'](handleError(_0x4aa2d1,null));};exports['update']=function(_0x525e63,_0x3239dc){if(_0x525e63[_0x9ec2('0x55')]['id']){delete _0x525e63[_0x9ec2('0x55')]['id'];}return db[_0x9ec2('0x37')]['find']({'where':{'id':_0x525e63[_0x9ec2('0x56')]['id']}})[_0x9ec2('0x31')](handleEntityNotFound(_0x3239dc,null))[_0x9ec2('0x31')](saveUpdates(_0x525e63[_0x9ec2('0x55')],null))[_0x9ec2('0x31')](respondWithResult(_0x3239dc,null))[_0x9ec2('0x24')](handleError(_0x3239dc,null));};exports[_0x9ec2('0x32')]=function(_0x2b1c57,_0x4f73b2){return db[_0x9ec2('0x37')][_0x9ec2('0x53')]({'where':{'id':_0x2b1c57[_0x9ec2('0x56')]['id']}})[_0x9ec2('0x31')](handleEntityNotFound(_0x4f73b2,null))[_0x9ec2('0x31')](removeEntity(_0x4f73b2,null))[_0x9ec2('0x24')](handleError(_0x4f73b2,null));};exports[_0x9ec2('0x57')]=function(_0x5a36a8,_0x180ef3,_0x29a254){var _0x3274d4={};var _0x2d0ef7={};var _0x541ff6;var _0x1ad224;return db['DeskAccount'][_0x9ec2('0x58')]({'where':{'id':_0x5a36a8[_0x9ec2('0x56')]['id']}})[_0x9ec2('0x31')](handleEntityNotFound(_0x180ef3,null))[_0x9ec2('0x31')](function(_0xbbdabd){if(_0xbbdabd){_0x541ff6=_0xbbdabd;_0x2d0ef7[_0x9ec2('0x3b')]=_['keys'](db[_0x9ec2('0x59')][_0x9ec2('0x51')]);_0x2d0ef7['query']=_[_0x9ec2('0x3d')](_0x5a36a8[_0x9ec2('0x3c')]);_0x2d0ef7[_0x9ec2('0x3e')]=_[_0x9ec2('0x3f')](_0x2d0ef7['model'],_0x2d0ef7[_0x9ec2('0x3c')]);_0x3274d4[_0x9ec2('0x40')]=_[_0x9ec2('0x3f')](_0x2d0ef7[_0x9ec2('0x3b')],qs[_0x9ec2('0x41')](_0x5a36a8[_0x9ec2('0x3c')]['fields']));_0x3274d4['attributes']=_0x3274d4[_0x9ec2('0x40')][_0x9ec2('0x42')]?_0x3274d4['attributes']:_0x2d0ef7[_0x9ec2('0x3b')];_0x3274d4[_0x9ec2('0x45')]=qs[_0x9ec2('0x46')](_0x5a36a8[_0x9ec2('0x3c')][_0x9ec2('0x46')]);_0x3274d4['where']=qs[_0x9ec2('0x3e')](_[_0x9ec2('0x48')](_0x5a36a8[_0x9ec2('0x3c')],_0x2d0ef7['filters']));if(_0x5a36a8[_0x9ec2('0x3c')][_0x9ec2('0x49')]){_0x3274d4['where']=_[_0x9ec2('0x4a')](_0x3274d4[_0x9ec2('0x47')],{'$or':_[_0x9ec2('0x36')](_0x3274d4[_0x9ec2('0x40')],function(_0x358580){var _0x178d53={};_0x178d53[_0x358580]={'$like':'%'+_0x5a36a8[_0x9ec2('0x3c')][_0x9ec2('0x49')]+'%'};return _0x178d53;})});}_0x3274d4=_[_0x9ec2('0x4a')]({},_0x3274d4,_0x5a36a8['options']);return _0x541ff6[_0x9ec2('0x57')](_0x3274d4);}})[_0x9ec2('0x31')](function(_0x31a761){if(_0x31a761){_0x1ad224=_0x31a761[_0x9ec2('0x42')];if(!_0x5a36a8['query'][_0x9ec2('0x43')]('nolimit')){_0x3274d4['limit']=qs[_0x9ec2('0x2a')](_0x5a36a8[_0x9ec2('0x3c')][_0x9ec2('0x2a')]);_0x3274d4[_0x9ec2('0x29')]=qs[_0x9ec2('0x29')](_0x5a36a8[_0x9ec2('0x3c')][_0x9ec2('0x29')]);}return _0x541ff6[_0x9ec2('0x57')](_0x3274d4);}})['then'](function(_0x4795a7){if(_0x4795a7){return _0x4795a7?{'count':_0x1ad224,'rows':_0x4795a7}:null;}})[_0x9ec2('0x31')](respondWithResult(_0x180ef3,null))['catch'](handleError(_0x180ef3,null));};exports[_0x9ec2('0x5a')]=function(_0x4dac7c,_0x3ebcf1,_0x5dfcf4){if(_0x4dac7c[_0x9ec2('0x55')]['id']){delete _0x4dac7c[_0x9ec2('0x55')]['id'];}return db[_0x9ec2('0x37')][_0x9ec2('0x58')]({'where':{'id':_0x4dac7c[_0x9ec2('0x56')]['id']}})[_0x9ec2('0x31')](handleEntityNotFound(_0x3ebcf1,null))[_0x9ec2('0x31')](function(_0xaba9fb){if(_0xaba9fb){_0x4dac7c['body'][_0x9ec2('0x5b')]=_0xaba9fb['id'];_0x4dac7c['body'][_0x9ec2('0x5c')]=integrations[_0x9ec2('0x5d')](_0x4dac7c[_0x9ec2('0x55')][_0x9ec2('0x5e')],_0x4dac7c[_0x9ec2('0x55')][_0x9ec2('0x39')]);_0x4dac7c[_0x9ec2('0x55')][_0x9ec2('0x5f')]=integrations[_0x9ec2('0x60')](_0x4dac7c[_0x9ec2('0x55')][_0x9ec2('0x5e')],_0x4dac7c[_0x9ec2('0x55')]['type']);return db['DeskConfiguration'][_0x9ec2('0x54')](_0x4dac7c[_0x9ec2('0x55')],{'include':[{'model':db['DeskField'],'as':_0x9ec2('0x5c')},{'model':db[_0x9ec2('0x61')],'as':_0x9ec2('0x5f')}]});}return null;})['then'](respondWithResult(_0x3ebcf1,null))[_0x9ec2('0x24')](handleError(_0x3ebcf1,null));};exports[_0x9ec2('0x62')]=function(_0x1294a2,_0x6d8688,_0x556c15){var _0x1866b9=[{'name':_0x9ec2('0x63'),'label':_0x9ec2('0x63'),'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 _0x477d33='';return db[_0x9ec2('0x37')][_0x9ec2('0x58')]({'where':{'id':_0x1294a2[_0x9ec2('0x56')]['id']},'attributes':['id',_0x9ec2('0x64'),_0x9ec2('0x65'),_0x9ec2('0x66'),_0x9ec2('0x67'),_0x9ec2('0x68'),_0x9ec2('0x69'),_0x9ec2('0x6a'),'tokenSecret']})['then'](handleEntityNotFound(_0x6d8688,null))[_0x9ec2('0x31')](function(_0xdd71fb){if(_0xdd71fb){_0x477d33=_0xdd71fb[_0x9ec2('0x64')];var _0x208b30=_0x477d33[_0x9ec2('0x6b')](-0x1);if(_0x208b30==='/'){_0x477d33=_0x477d33['substring'](0x0,_0x477d33['lastIndexOf'](_0x208b30));}var _0x13f7ce={'method':_0x9ec2('0x6c'),'uri':util[_0x9ec2('0x6d')](_0x9ec2('0x6e'),_0x477d33),'headers':{'Content-Type':'application/json','Accept':_0x9ec2('0x6f')},'json':!![]};if(_0xdd71fb['authType']===_0x9ec2('0x70')){_0x13f7ce['headers'][_0x9ec2('0x71')]=util[_0x9ec2('0x6d')]('Basic\x20%s',new Buffer(util['format']('%s:%s',_0xdd71fb['username'],_0xdd71fb[_0x9ec2('0x67')]))[_0x9ec2('0x72')]('base64'));}return rp(_0x13f7ce)[_0x9ec2('0x31')](function(_0x28d938){return _0x1866b9['concat'](_[_0x9ec2('0x36')](_0x28d938[_0x9ec2('0x73')][_0x9ec2('0x74')],function(_0x5ef963){return{'id':_0x5ef963[_0x9ec2('0x34')],'name':_0x5ef963[_0x9ec2('0x34')],'type':_0x5ef963[_0x9ec2('0x39')],'active':_0x5ef963[_0x9ec2('0x75')],'label':_0x5ef963[_0x9ec2('0x76')],'custom':!![]};}));});}})[_0x9ec2('0x31')](function(_0x4b7f63){return{'count':_0x4b7f63[_0x9ec2('0x42')],'rows':_0x4b7f63};})[_0x9ec2('0x31')](respondWithResult(_0x6d8688,null))['catch'](function(_0x5c3be1){var _0x59b9c4=_0x1294a2[_0x9ec2('0x3c')][_0x9ec2('0x77')]?0x1f4:_0x5c3be1[_0x9ec2('0x78')]||0x1f4;logger['error'](_0x9ec2('0x79'),_0x9ec2('0x62'),_0x59b9c4,JSON[_0x9ec2('0x1e')](_0x5c3be1));delete _0x5c3be1[_0x9ec2('0x34')];if(_0x59b9c4===0x191){_0x59b9c4=0x190;}_0x6d8688[_0x9ec2('0x27')](_0x59b9c4)[_0x9ec2('0x35')](_0x1294a2['query']['test']?{'message':_0x9ec2('0x7a'),'statusCode':_0x5c3be1[_0x9ec2('0x78')]}:_0x5c3be1);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index 3e9446e..82f54d6 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 _0xa647=['path','../../config/environment','../../components/integrations/configuration','exports','define','DeskAccount','int_desk_accounts','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x25db42,_0x30a357){var _0x3bba06=function(_0x5dd010){while(--_0x5dd010){_0x25db42['push'](_0x25db42['shift']());}};_0x3bba06(++_0x30a357);}(_0xa647,0xf1));var _0x7a64=function(_0x1e6d93,_0x1459a4){_0x1e6d93=_0x1e6d93-0x0;var _0x1c84e2=_0xa647[_0x1e6d93];return _0x1c84e2;};'use strict';var _=require('lodash');var util=require(_0x7a64('0x0'));var logger=require(_0x7a64('0x1'))(_0x7a64('0x2'));var moment=require(_0x7a64('0x3'));var BPromise=require(_0x7a64('0x4'));var rp=require(_0x7a64('0x5'));var fs=require('fs');var path=require(_0x7a64('0x6'));var rimraf=require('rimraf');var config=require(_0x7a64('0x7'));var attributes=require('./intDeskAccount.attributes');var integrations=require(_0x7a64('0x8'));module[_0x7a64('0x9')]=function(_0x1ab938,_0x4129b5){return _0x1ab938[_0x7a64('0xa')](_0x7a64('0xb'),attributes,{'tableName':_0x7a64('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc271=['request-promise','path','rimraf','../../config/environment','exports','define','DeskAccount','lodash','util','../../config/logger','api','moment'];(function(_0x173a3b,_0x3e83ff){var _0x1bc404=function(_0x1c3d21){while(--_0x1c3d21){_0x173a3b['push'](_0x173a3b['shift']());}};_0x1bc404(++_0x3e83ff);}(_0xc271,0x11b));var _0x1c27=function(_0x18fcb8,_0x46e7e8){_0x18fcb8=_0x18fcb8-0x0;var _0x273f57=_0xc271[_0x18fcb8];return _0x273f57;};'use strict';var _=require(_0x1c27('0x0'));var util=require(_0x1c27('0x1'));var logger=require(_0x1c27('0x2'))(_0x1c27('0x3'));var moment=require(_0x1c27('0x4'));var BPromise=require('bluebird');var rp=require(_0x1c27('0x5'));var fs=require('fs');var path=require(_0x1c27('0x6'));var rimraf=require(_0x1c27('0x7'));var config=require(_0x1c27('0x8'));var attributes=require('./intDeskAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0x1c27('0x9')]=function(_0x1e978e,_0x3f5d11){return _0x1e978e[_0x1c27('0xa')](_0x1c27('0xb'),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 23a9b16..c3d337d 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 _0xc473=['code','message','info','result','GetDeskAccount','findAll','options','raw','where','limit','include','map','model','attributes','DeskAccount','find','ShowDeskAccount','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','http','then','DeskAccount,\x20%s,\x20%s','debug','DeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x1a809b,_0x4c15e3){var _0x5d90e6=function(_0x5dd2e1){while(--_0x5dd2e1){_0x1a809b['push'](_0x1a809b['shift']());}};_0x5d90e6(++_0x4c15e3);}(_0xc473,0x1cc));var _0x3c47=function(_0x497900,_0x185b00){_0x497900=_0x497900-0x0;var _0x17265c=_0xc473[_0x497900];return _0x17265c;};'use strict';var _=require(_0x3c47('0x0'));var util=require('util');var moment=require(_0x3c47('0x1'));var BPromise=require(_0x3c47('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3c47('0x3'));var db=require(_0x3c47('0x4'))['db'];var utils=require(_0x3c47('0x5'));var logger=require('../../config/logger')(_0x3c47('0x6'));var config=require('../../config/environment');var jayson=require(_0x3c47('0x7'));var client=jayson['client'][_0x3c47('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4b8027,_0x1745a6,_0x430ab1){return new BPromise(function(_0x45b59a,_0x3fddee){return client['request'](_0x4b8027,_0x430ab1)[_0x3c47('0x9')](function(_0x323290){logger['info'](_0x3c47('0xa'),_0x1745a6,'request\x20sent');logger[_0x3c47('0xb')](_0x3c47('0xc'),_0x1745a6,_0x3c47('0xd'),JSON[_0x3c47('0xe')](_0x323290));if(_0x323290[_0x3c47('0xf')]){if(_0x323290[_0x3c47('0xf')][_0x3c47('0x10')]===0x1f4){logger[_0x3c47('0xf')]('DeskAccount,\x20%s,\x20%s',_0x1745a6,_0x323290[_0x3c47('0xf')][_0x3c47('0x11')]);return _0x3fddee(_0x323290[_0x3c47('0xf')][_0x3c47('0x11')]);}logger['error'](_0x3c47('0xa'),_0x1745a6,_0x323290['error'][_0x3c47('0x11')]);return _0x45b59a(_0x323290[_0x3c47('0xf')][_0x3c47('0x11')]);}else{logger[_0x3c47('0x12')]('DeskAccount,\x20%s,\x20%s',_0x1745a6,_0x3c47('0xd'));_0x45b59a(_0x323290[_0x3c47('0x13')][_0x3c47('0x11')]);}})['catch'](function(_0x3a5227){logger[_0x3c47('0xf')]('DeskAccount,\x20%s,\x20%s',_0x1745a6,_0x3a5227);_0x3fddee(_0x3a5227);});});}exports[_0x3c47('0x14')]=function(_0x111758){var _0x5a3c3f=this;return new Promise(function(_0x310e87,_0x2035cc){return db['DeskAccount'][_0x3c47('0x15')]({'raw':_0x111758['options']?_0x111758[_0x3c47('0x16')][_0x3c47('0x17')]===undefined?!![]:![]:!![],'where':_0x111758[_0x3c47('0x16')]?_0x111758[_0x3c47('0x16')][_0x3c47('0x18')]||null:null,'attributes':_0x111758['options']?_0x111758[_0x3c47('0x16')]['attributes']||null:null,'limit':_0x111758[_0x3c47('0x16')]?_0x111758[_0x3c47('0x16')][_0x3c47('0x19')]||null:null,'include':_0x111758[_0x3c47('0x16')]?_0x111758[_0x3c47('0x16')][_0x3c47('0x1a')]?_[_0x3c47('0x1b')](_0x111758[_0x3c47('0x16')][_0x3c47('0x1a')],function(_0x521ac6){return{'model':db[_0x521ac6[_0x3c47('0x1c')]],'as':_0x521ac6['as'],'attributes':_0x521ac6[_0x3c47('0x1d')],'include':_0x521ac6[_0x3c47('0x1a')]?_[_0x3c47('0x1b')](_0x521ac6['include'],function(_0x20581e){return{'model':db[_0x20581e[_0x3c47('0x1c')]],'as':_0x20581e['as'],'attributes':_0x20581e[_0x3c47('0x1d')],'include':_0x20581e[_0x3c47('0x1a')]?_['map'](_0x20581e[_0x3c47('0x1a')],function(_0x48e012){return{'model':db[_0x48e012[_0x3c47('0x1c')]],'as':_0x48e012['as'],'attributes':_0x48e012['attributes']};}):[]};}):[]};}):[]:[]})[_0x3c47('0x9')](function(_0x165722){logger[_0x3c47('0x12')](_0x3c47('0x14'),_0x111758);logger['debug'](_0x3c47('0x14'),_0x111758,JSON[_0x3c47('0xe')](_0x165722));_0x310e87(_0x165722);})['catch'](function(_0x15a20f){logger[_0x3c47('0xf')](_0x3c47('0x14'),_0x15a20f[_0x3c47('0x11')],_0x111758);_0x2035cc(_0x5a3c3f[_0x3c47('0xf')](0x1f4,_0x15a20f[_0x3c47('0x11')]));});});};exports['ShowDeskAccount']=function(_0x5d2776){var _0x49664b=this;return new Promise(function(_0x5c4ad5,_0xc9dfb0){return db[_0x3c47('0x1e')][_0x3c47('0x1f')]({'raw':_0x5d2776[_0x3c47('0x16')]?_0x5d2776[_0x3c47('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x5d2776[_0x3c47('0x16')]?_0x5d2776[_0x3c47('0x16')][_0x3c47('0x18')]||null:null,'attributes':_0x5d2776[_0x3c47('0x16')]?_0x5d2776[_0x3c47('0x16')][_0x3c47('0x1d')]||null:null,'include':_0x5d2776[_0x3c47('0x16')]?_0x5d2776[_0x3c47('0x16')][_0x3c47('0x1a')]?_[_0x3c47('0x1b')](_0x5d2776[_0x3c47('0x16')]['include'],function(_0x1941b9){return{'model':db[_0x1941b9['model']],'as':_0x1941b9['as'],'attributes':_0x1941b9[_0x3c47('0x1d')],'include':_0x1941b9['include']?_['map'](_0x1941b9[_0x3c47('0x1a')],function(_0x1f4f0d){return{'model':db[_0x1f4f0d[_0x3c47('0x1c')]],'as':_0x1f4f0d['as'],'attributes':_0x1f4f0d[_0x3c47('0x1d')],'include':_0x1f4f0d[_0x3c47('0x1a')]?_[_0x3c47('0x1b')](_0x1f4f0d['include'],function(_0xcae7a6){return{'model':db[_0xcae7a6[_0x3c47('0x1c')]],'as':_0xcae7a6['as'],'attributes':_0xcae7a6[_0x3c47('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x3c47('0x9')](function(_0x5b61dd){logger['info']('ShowDeskAccount',_0x5d2776);logger[_0x3c47('0xb')](_0x3c47('0x20'),_0x5d2776,JSON['stringify'](_0x5b61dd));_0x5c4ad5(_0x5b61dd);})[_0x3c47('0x21')](function(_0x3adead){logger[_0x3c47('0xf')](_0x3c47('0x20'),_0x3adead[_0x3c47('0x11')],_0x5d2776);_0xc9dfb0(_0x49664b[_0x3c47('0xf')](0x1f4,_0x3adead[_0x3c47('0x11')]));});});}; \ No newline at end of file +var _0x285c=['ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','GetDeskAccount','options','where','attributes','include','map','model','debug','catch','ShowDeskAccount','DeskAccount','find','raw','lodash','moment','randomstring'];(function(_0x535dbe,_0x41fb9a){var _0x419f36=function(_0x47aefa){while(--_0x47aefa){_0x535dbe['push'](_0x535dbe['shift']());}};_0x419f36(++_0x41fb9a);}(_0x285c,0xa7));var _0xc285=function(_0x4945cb,_0x388152){_0x4945cb=_0x4945cb-0x0;var _0x5731e0=_0x285c[_0x4945cb];return _0x5731e0;};'use strict';var _=require(_0xc285('0x0'));var util=require('util');var moment=require(_0xc285('0x1'));var BPromise=require('bluebird');var rs=require(_0xc285('0x2'));var fs=require('fs');var Redis=require(_0xc285('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xc285('0x4'));var logger=require(_0xc285('0x5'))(_0xc285('0x6'));var config=require(_0xc285('0x7'));var jayson=require(_0xc285('0x8'));var client=jayson[_0xc285('0x9')][_0xc285('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xa80177,_0x7c7568,_0x409566){return new BPromise(function(_0x2b75eb,_0x34202f){return client[_0xc285('0xb')](_0xa80177,_0x409566)[_0xc285('0xc')](function(_0x52f38d){logger[_0xc285('0xd')](_0xc285('0xe'),_0x7c7568,_0xc285('0xf'));logger['debug']('DeskAccount,\x20%s,\x20%s,\x20%s',_0x7c7568,_0xc285('0xf'),JSON[_0xc285('0x10')](_0x52f38d));if(_0x52f38d[_0xc285('0x11')]){if(_0x52f38d['error'][_0xc285('0x12')]===0x1f4){logger[_0xc285('0x11')](_0xc285('0xe'),_0x7c7568,_0x52f38d['error']['message']);return _0x34202f(_0x52f38d[_0xc285('0x11')][_0xc285('0x13')]);}logger['error'](_0xc285('0xe'),_0x7c7568,_0x52f38d[_0xc285('0x11')]['message']);return _0x2b75eb(_0x52f38d[_0xc285('0x11')]['message']);}else{logger[_0xc285('0xd')]('DeskAccount,\x20%s,\x20%s',_0x7c7568,'request\x20sent');_0x2b75eb(_0x52f38d[_0xc285('0x14')]['message']);}})['catch'](function(_0x384ac8){logger['error'](_0xc285('0xe'),_0x7c7568,_0x384ac8);_0x34202f(_0x384ac8);});});}exports[_0xc285('0x15')]=function(_0x5a37c9){var _0x10bfa5=this;return new Promise(function(_0x28c3b8,_0xe384b4){return db['DeskAccount']['findAll']({'raw':_0x5a37c9[_0xc285('0x16')]?_0x5a37c9[_0xc285('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x5a37c9[_0xc285('0x16')]?_0x5a37c9['options'][_0xc285('0x17')]||null:null,'attributes':_0x5a37c9[_0xc285('0x16')]?_0x5a37c9[_0xc285('0x16')][_0xc285('0x18')]||null:null,'limit':_0x5a37c9[_0xc285('0x16')]?_0x5a37c9[_0xc285('0x16')]['limit']||null:null,'include':_0x5a37c9[_0xc285('0x16')]?_0x5a37c9[_0xc285('0x16')][_0xc285('0x19')]?_[_0xc285('0x1a')](_0x5a37c9[_0xc285('0x16')]['include'],function(_0x3ad1ec){return{'model':db[_0x3ad1ec[_0xc285('0x1b')]],'as':_0x3ad1ec['as'],'attributes':_0x3ad1ec[_0xc285('0x18')],'include':_0x3ad1ec[_0xc285('0x19')]?_[_0xc285('0x1a')](_0x3ad1ec[_0xc285('0x19')],function(_0x254c27){return{'model':db[_0x254c27['model']],'as':_0x254c27['as'],'attributes':_0x254c27[_0xc285('0x18')],'include':_0x254c27[_0xc285('0x19')]?_[_0xc285('0x1a')](_0x254c27[_0xc285('0x19')],function(_0xe7fa5f){return{'model':db[_0xe7fa5f[_0xc285('0x1b')]],'as':_0xe7fa5f['as'],'attributes':_0xe7fa5f[_0xc285('0x18')]};}):[]};}):[]};}):[]:[]})[_0xc285('0xc')](function(_0x36c00f){logger[_0xc285('0xd')](_0xc285('0x15'),_0x5a37c9);logger[_0xc285('0x1c')](_0xc285('0x15'),_0x5a37c9,JSON['stringify'](_0x36c00f));_0x28c3b8(_0x36c00f);})[_0xc285('0x1d')](function(_0x31785b){logger[_0xc285('0x11')](_0xc285('0x15'),_0x31785b[_0xc285('0x13')],_0x5a37c9);_0xe384b4(_0x10bfa5[_0xc285('0x11')](0x1f4,_0x31785b[_0xc285('0x13')]));});});};exports[_0xc285('0x1e')]=function(_0x1b9403){var _0x1eb2f9=this;return new Promise(function(_0xe39fa3,_0x1cf125){return db[_0xc285('0x1f')][_0xc285('0x20')]({'raw':_0x1b9403[_0xc285('0x16')]?_0x1b9403[_0xc285('0x16')][_0xc285('0x21')]===undefined?!![]:![]:!![],'where':_0x1b9403[_0xc285('0x16')]?_0x1b9403[_0xc285('0x16')][_0xc285('0x17')]||null:null,'attributes':_0x1b9403[_0xc285('0x16')]?_0x1b9403[_0xc285('0x16')][_0xc285('0x18')]||null:null,'include':_0x1b9403[_0xc285('0x16')]?_0x1b9403['options'][_0xc285('0x19')]?_['map'](_0x1b9403[_0xc285('0x16')]['include'],function(_0x2498a4){return{'model':db[_0x2498a4[_0xc285('0x1b')]],'as':_0x2498a4['as'],'attributes':_0x2498a4[_0xc285('0x18')],'include':_0x2498a4['include']?_[_0xc285('0x1a')](_0x2498a4[_0xc285('0x19')],function(_0x54e834){return{'model':db[_0x54e834[_0xc285('0x1b')]],'as':_0x54e834['as'],'attributes':_0x54e834[_0xc285('0x18')],'include':_0x54e834['include']?_[_0xc285('0x1a')](_0x54e834['include'],function(_0xf27432){return{'model':db[_0xf27432[_0xc285('0x1b')]],'as':_0xf27432['as'],'attributes':_0xf27432['attributes']};}):[]};}):[]};}):[]:[]})[_0xc285('0xc')](function(_0xd7aa85){logger[_0xc285('0xd')](_0xc285('0x1e'),_0x1b9403);logger['debug'](_0xc285('0x1e'),_0x1b9403,JSON[_0xc285('0x10')](_0xd7aa85));_0xe39fa3(_0xd7aa85);})[_0xc285('0x1d')](function(_0x3b7f0e){logger[_0xc285('0x11')](_0xc285('0x1e'),_0x3b7f0e[_0xc285('0x13')],_0x1b9403);_0x1cf125(_0x1eb2f9[_0xc285('0x11')](0x1f4,_0x3b7f0e[_0xc285('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index d1fd065..b6501bc 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 _0x3e74=['show','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','getTags','post','/:id/tags','setTags','update','delete','exports','multer','path','connect-timeout','express','../../components/auth/service','../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','/:id'];(function(_0x1e3638,_0x29ae62){var _0x48430e=function(_0x1a3517){while(--_0x1a3517){_0x1e3638['push'](_0x1e3638['shift']());}};_0x48430e(++_0x29ae62);}(_0x3e74,0x175));var _0x43e7=function(_0x18f2d6,_0x2fd688){_0x18f2d6=_0x18f2d6-0x0;var _0x133a18=_0x3e74[_0x18f2d6];return _0x133a18;};'use strict';var multer=require(_0x43e7('0x0'));var util=require('util');var path=require(_0x43e7('0x1'));var timeout=require(_0x43e7('0x2'));var express=require(_0x43e7('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x43e7('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x43e7('0x5'));var controller=require(_0x43e7('0x6'));router[_0x43e7('0x7')]('/',auth[_0x43e7('0x8')](),controller[_0x43e7('0x9')]);router['get'](_0x43e7('0xa'),auth[_0x43e7('0x8')](),controller[_0x43e7('0xb')]);router[_0x43e7('0x7')](_0x43e7('0xc'),auth['isAuthenticated'](),controller[_0x43e7('0xd')]);router['get']('/:id/subjects',auth[_0x43e7('0x8')](),controller[_0x43e7('0xe')]);router['get'](_0x43e7('0xf'),auth['isAuthenticated'](),controller[_0x43e7('0x10')]);router[_0x43e7('0x7')]('/:id/tags',auth[_0x43e7('0x8')](),controller[_0x43e7('0x11')]);router[_0x43e7('0x12')]('/',auth[_0x43e7('0x8')](),controller['create']);router['post'](_0x43e7('0x13'),auth[_0x43e7('0x8')](),controller[_0x43e7('0x14')]);router['put']('/:id',auth[_0x43e7('0x8')](),controller[_0x43e7('0x15')]);router[_0x43e7('0x16')](_0x43e7('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x43e7('0x17')]=router; \ No newline at end of file +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(_0x46ae5a,_0x2a38d0){var _0x434986=function(_0x22735d){while(--_0x22735d){_0x46ae5a['push'](_0x46ae5a['shift']());}};_0x434986(++_0x2a38d0);}(_0x55ca,0x126));var _0xa55c=function(_0x33f0e4,_0x2d414a){_0x33f0e4=_0x33f0e4-0x0;var _0x543c2e=_0x55ca[_0x33f0e4];return _0x543c2e;};'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 diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index a26c726..c898101 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 _0x3cb2=['sequelize','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3cb2,0xa8));var _0x23cb=function(_0x547add,_0x387042){_0x547add=_0x547add-0x0;var _0x2ed1f3=_0x3cb2[_0x547add];return _0x2ed1f3;};'use strict';var Sequelize=require(_0x23cb('0x0'));module['exports']={'name':{'type':Sequelize[_0x23cb('0x1')]},'description':{'type':Sequelize[_0x23cb('0x1')]}}; \ No newline at end of file +var _0x32bc=['exports','STRING','sequelize'];(function(_0x11b475,_0xcc2d9b){var _0x296895=function(_0x4e1136){while(--_0x4e1136){_0x11b475['push'](_0x11b475['shift']());}};_0x296895(++_0xcc2d9b);}(_0x32bc,0xe0));var _0xc32b=function(_0x213c40,_0x2f3971){_0x213c40=_0x213c40-0x0;var _0x2bd935=_0x32bc[_0x213c40];return _0x2bd935;};'use strict';var Sequelize=require(_0xc32b('0x0'));module[_0xc32b('0x1')]={'name':{'type':Sequelize[_0xc32b('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index 99984b8..4b12e7c 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 _0xf0a9=['includeAll','include','findAll','rows','catch','params','keys','find','create','body','getFields','DeskField','getSubjects','findOne','getDescriptions','getTags','Tag','ids','eml-format','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','jayson/promise','client','http','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save','update','destroy','name','map','DeskConfiguration','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options'];(function(_0x6a967f,_0xfad350){var _0x53adee=function(_0x11400b){while(--_0x11400b){_0x6a967f['push'](_0x6a967f['shift']());}};_0x53adee(++_0xfad350);}(_0xf0a9,0x182));var _0x9f0a=function(_0x31b654,_0x150623){_0x31b654=_0x31b654-0x0;var _0x9ab0ab=_0xf0a9[_0x31b654];return _0x9ab0ab;};'use strict';var emlformat=require(_0x9f0a('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x9f0a('0x1'));var rp=require('request-promise');var moment=require(_0x9f0a('0x2'));var BPromise=require(_0x9f0a('0x3'));var Mustache=require(_0x9f0a('0x4'));var util=require(_0x9f0a('0x5'));var path=require(_0x9f0a('0x6'));var sox=require('sox');var csv=require(_0x9f0a('0x7'));var ejs=require(_0x9f0a('0x8'));var fs=require('fs');var fs_extra=require(_0x9f0a('0x9'));var _=require(_0x9f0a('0xa'));var squel=require(_0x9f0a('0xb'));var crypto=require('crypto');var jsforce=require(_0x9f0a('0xc'));var deskjs=require(_0x9f0a('0xd'));var toCsv=require('to-csv');var querystring=require(_0x9f0a('0xe'));var Papa=require('papaparse');var Redis=require(_0x9f0a('0xf'));var authService=require(_0x9f0a('0x10'));var qs=require(_0x9f0a('0x11'));var as=require(_0x9f0a('0x12'));var hardwareService=require(_0x9f0a('0x13'));var logger=require(_0x9f0a('0x14'))(_0x9f0a('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x9f0a('0x16'));var db=require(_0x9f0a('0x17'))['db'];var jayson=require(_0x9f0a('0x18'));var client=jayson[_0x9f0a('0x19')][_0x9f0a('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x425a04,_0x4cb083,_0x2ee408,_0x29ce47){return new BPromise(function(_0xbed7d9,_0x3046d1){var _0x34e9b5=_0x29ce47||client;return _0x34e9b5['request'](_0x425a04,_0x2ee408)[_0x9f0a('0x1b')](function(_0x2449fe){logger[_0x9f0a('0x1c')](_0x9f0a('0x1d'),_0x4cb083,_0x9f0a('0x1e'));logger[_0x9f0a('0x1f')](_0x9f0a('0x20'),_0x4cb083,_0x9f0a('0x1e'),JSON[_0x9f0a('0x21')](_0x2449fe));if(_0x2449fe['error']){if(_0x2449fe[_0x9f0a('0x22')][_0x9f0a('0x23')]===0x1f4){logger[_0x9f0a('0x22')](_0x9f0a('0x1d'),_0x4cb083,_0x2449fe['error']['message']);return _0x3046d1(_0x2449fe['error'][_0x9f0a('0x24')]);}logger['error'](_0x9f0a('0x1d'),_0x4cb083,_0x2449fe[_0x9f0a('0x22')]['message']);return _0xbed7d9(_0x2449fe[_0x9f0a('0x22')][_0x9f0a('0x24')]);}else{logger[_0x9f0a('0x1c')](_0x9f0a('0x1d'),_0x4cb083,_0x9f0a('0x1e'));_0xbed7d9(_0x2449fe[_0x9f0a('0x25')][_0x9f0a('0x24')]);}})['catch'](function(_0x802234){logger[_0x9f0a('0x22')]('DeskConfiguration,\x20%s,\x20%s',_0x4cb083,_0x802234);_0x3046d1(_0x802234);});});}function respondWithStatusCode(_0x4deb13,_0x5501ce){_0x5501ce=_0x5501ce||0xcc;return function(_0x39e4de){if(_0x39e4de){return _0x4deb13[_0x9f0a('0x26')](_0x5501ce);}return _0x4deb13[_0x9f0a('0x27')](_0x5501ce)[_0x9f0a('0x28')]();};}function respondWithResult(_0x35042e,_0x59f0fa){_0x59f0fa=_0x59f0fa||0xc8;return function(_0x56489c){if(_0x56489c){return _0x35042e[_0x9f0a('0x27')](_0x59f0fa)[_0x9f0a('0x29')](_0x56489c);}};}function respondWithFilteredResult(_0x2e2042,_0x5d482d){return function(_0x3faf99){if(_0x3faf99){var _0x51986b=typeof _0x5d482d[_0x9f0a('0x2a')]===_0x9f0a('0x2b')&&typeof _0x5d482d[_0x9f0a('0x2c')]==='undefined';var _0x512798=_0x3faf99[_0x9f0a('0x2d')];var _0x327567=_0x51986b?0x0:_0x5d482d[_0x9f0a('0x2a')];var _0x2067f8=_0x51986b?_0x3faf99[_0x9f0a('0x2d')]:_0x5d482d[_0x9f0a('0x2a')]+_0x5d482d['limit'];var _0x33c255;if(_0x2067f8>=_0x512798){_0x2067f8=_0x512798;_0x33c255=0xc8;}else{_0x33c255=0xce;}_0x2e2042['status'](_0x33c255);return _0x2e2042[_0x9f0a('0x2e')]('Content-Range',_0x327567+'-'+_0x2067f8+'/'+_0x512798)[_0x9f0a('0x29')](_0x3faf99);}return null;};}function patchUpdates(_0x2bc876){return function(_0x2e24bc){try{jsonpatch[_0x9f0a('0x2f')](_0x2e24bc,_0x2bc876,!![]);}catch(_0x54617f){return BPromise['reject'](_0x54617f);}return _0x2e24bc[_0x9f0a('0x30')]();};}function saveUpdates(_0x3838cd,_0x24b53b){return function(_0x54bfe7){if(_0x54bfe7){return _0x54bfe7[_0x9f0a('0x31')](_0x3838cd)[_0x9f0a('0x1b')](function(_0xa353c2){return _0xa353c2;});}return null;};}function removeEntity(_0xf5fee0,_0x5df7b2){return function(_0x1b6d36){if(_0x1b6d36){return _0x1b6d36[_0x9f0a('0x32')]()[_0x9f0a('0x1b')](function(){_0xf5fee0['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1e9204,_0x4dcf79){return function(_0x21c589){if(!_0x21c589){_0x1e9204['sendStatus'](0x194);}return _0x21c589;};}function handleError(_0x3e3555,_0x36f656){_0x36f656=_0x36f656||0x1f4;return function(_0x2c7d45){logger['error'](_0x2c7d45['stack']);if(_0x2c7d45['name']){delete _0x2c7d45[_0x9f0a('0x33')];}_0x3e3555['status'](_0x36f656)['send'](_0x2c7d45);};}exports['index']=function(_0x3b9d51,_0x5ea336){var _0x54ebcf={},_0x440bcd={},_0x5eb650={'count':0x0,'rows':[]};var _0x61d6c8=_[_0x9f0a('0x34')](db[_0x9f0a('0x35')][_0x9f0a('0x36')],function(_0x32fdf5){return{'name':_0x32fdf5[_0x9f0a('0x37')],'type':_0x32fdf5[_0x9f0a('0x38')][_0x9f0a('0x39')]};});_0x440bcd[_0x9f0a('0x3a')]=_['map'](_0x61d6c8,'name');_0x440bcd[_0x9f0a('0x3b')]=_['keys'](_0x3b9d51[_0x9f0a('0x3b')]);_0x440bcd['filters']=_[_0x9f0a('0x3c')](_0x440bcd[_0x9f0a('0x3a')],_0x440bcd[_0x9f0a('0x3b')]);_0x54ebcf[_0x9f0a('0x3d')]=_['intersection'](_0x440bcd[_0x9f0a('0x3a')],qs['fields'](_0x3b9d51[_0x9f0a('0x3b')][_0x9f0a('0x3e')]));_0x54ebcf[_0x9f0a('0x3d')]=_0x54ebcf[_0x9f0a('0x3d')][_0x9f0a('0x3f')]?_0x54ebcf[_0x9f0a('0x3d')]:_0x440bcd['model'];if(!_0x3b9d51[_0x9f0a('0x3b')][_0x9f0a('0x40')](_0x9f0a('0x41'))){_0x54ebcf[_0x9f0a('0x2c')]=qs[_0x9f0a('0x2c')](_0x3b9d51[_0x9f0a('0x3b')][_0x9f0a('0x2c')]);_0x54ebcf[_0x9f0a('0x2a')]=qs['offset'](_0x3b9d51[_0x9f0a('0x3b')]['offset']);}_0x54ebcf[_0x9f0a('0x42')]=qs[_0x9f0a('0x43')](_0x3b9d51[_0x9f0a('0x3b')][_0x9f0a('0x43')]);_0x54ebcf[_0x9f0a('0x44')]=qs[_0x9f0a('0x45')](_[_0x9f0a('0x46')](_0x3b9d51['query'],_0x440bcd['filters']),_0x61d6c8);if(_0x3b9d51[_0x9f0a('0x3b')][_0x9f0a('0x47')]){_0x54ebcf[_0x9f0a('0x44')]=_[_0x9f0a('0x48')](_0x54ebcf[_0x9f0a('0x44')],{'$or':_[_0x9f0a('0x34')](_0x61d6c8,function(_0x1de401){if(_0x1de401[_0x9f0a('0x38')]!=='VIRTUAL'){var _0x3094f6={};_0x3094f6[_0x1de401[_0x9f0a('0x33')]]={'$like':'%'+_0x3b9d51[_0x9f0a('0x3b')]['filter']+'%'};return _0x3094f6;}})});}_0x54ebcf=_[_0x9f0a('0x48')]({},_0x54ebcf,_0x3b9d51[_0x9f0a('0x49')]);var _0xa574f6={'where':_0x54ebcf[_0x9f0a('0x44')]};return db['DeskConfiguration']['count'](_0xa574f6)[_0x9f0a('0x1b')](function(_0x362851){_0x5eb650[_0x9f0a('0x2d')]=_0x362851;if(_0x3b9d51[_0x9f0a('0x3b')][_0x9f0a('0x4a')]){_0x54ebcf[_0x9f0a('0x4b')]=[{'all':!![]}];}return db['DeskConfiguration'][_0x9f0a('0x4c')](_0x54ebcf);})[_0x9f0a('0x1b')](function(_0x578394){_0x5eb650[_0x9f0a('0x4d')]=_0x578394;return _0x5eb650;})['then'](respondWithFilteredResult(_0x5ea336,_0x54ebcf))[_0x9f0a('0x4e')](handleError(_0x5ea336,null));};exports['show']=function(_0x45912e,_0x510261){var _0x5964dd={'raw':![],'where':{'id':_0x45912e[_0x9f0a('0x4f')]['id']}},_0x3d481b={};_0x3d481b[_0x9f0a('0x3a')]=_[_0x9f0a('0x50')](db[_0x9f0a('0x35')][_0x9f0a('0x36')]);_0x3d481b['query']=_[_0x9f0a('0x50')](_0x45912e[_0x9f0a('0x3b')]);_0x3d481b[_0x9f0a('0x45')]=_[_0x9f0a('0x3c')](_0x3d481b[_0x9f0a('0x3a')],_0x3d481b[_0x9f0a('0x3b')]);_0x5964dd[_0x9f0a('0x3d')]=_['intersection'](_0x3d481b[_0x9f0a('0x3a')],qs['fields'](_0x45912e[_0x9f0a('0x3b')][_0x9f0a('0x3e')]));_0x5964dd['attributes']=_0x5964dd['attributes'][_0x9f0a('0x3f')]?_0x5964dd[_0x9f0a('0x3d')]:_0x3d481b['model'];if(_0x45912e['query']['includeAll']){_0x5964dd[_0x9f0a('0x4b')]=[{'all':!![]}];}_0x5964dd=_[_0x9f0a('0x48')]({},_0x5964dd,_0x45912e[_0x9f0a('0x49')]);return db[_0x9f0a('0x35')][_0x9f0a('0x51')](_0x5964dd)[_0x9f0a('0x1b')](handleEntityNotFound(_0x510261,null))[_0x9f0a('0x1b')](respondWithResult(_0x510261,null))[_0x9f0a('0x4e')](handleError(_0x510261,null));};exports[_0x9f0a('0x52')]=function(_0x2e5698,_0x387aa0){return db['DeskConfiguration'][_0x9f0a('0x52')](_0x2e5698[_0x9f0a('0x53')],{})[_0x9f0a('0x1b')](respondWithResult(_0x387aa0,0xc9))['catch'](handleError(_0x387aa0,null));};exports[_0x9f0a('0x31')]=function(_0x2242b1,_0x5ea467){if(_0x2242b1[_0x9f0a('0x53')]['id']){delete _0x2242b1['body']['id'];}return db['DeskConfiguration'][_0x9f0a('0x51')]({'where':{'id':_0x2242b1[_0x9f0a('0x4f')]['id']}})[_0x9f0a('0x1b')](handleEntityNotFound(_0x5ea467,null))[_0x9f0a('0x1b')](saveUpdates(_0x2242b1[_0x9f0a('0x53')],null))[_0x9f0a('0x1b')](respondWithResult(_0x5ea467,null))['catch'](handleError(_0x5ea467,null));};exports[_0x9f0a('0x32')]=function(_0x1cb01f,_0x5e0245){return db['DeskConfiguration']['find']({'where':{'id':_0x1cb01f[_0x9f0a('0x4f')]['id']}})[_0x9f0a('0x1b')](handleEntityNotFound(_0x5e0245,null))[_0x9f0a('0x1b')](removeEntity(_0x5e0245,null))[_0x9f0a('0x4e')](handleError(_0x5e0245,null));};exports[_0x9f0a('0x54')]=function(_0x21b410,_0x227ad1,_0x53a895){var _0x3abaed={};var _0x214a49={};var _0x211913;var _0x8f1ae9;return db[_0x9f0a('0x35')]['findOne']({'where':{'id':_0x21b410[_0x9f0a('0x4f')]['id']}})[_0x9f0a('0x1b')](handleEntityNotFound(_0x227ad1,null))['then'](function(_0x551197){if(_0x551197){_0x211913=_0x551197;_0x214a49['model']=_[_0x9f0a('0x50')](db[_0x9f0a('0x55')][_0x9f0a('0x36')]);_0x214a49[_0x9f0a('0x3b')]=_[_0x9f0a('0x50')](_0x21b410[_0x9f0a('0x3b')]);_0x214a49[_0x9f0a('0x45')]=_[_0x9f0a('0x3c')](_0x214a49[_0x9f0a('0x3a')],_0x214a49[_0x9f0a('0x3b')]);_0x3abaed[_0x9f0a('0x3d')]=_[_0x9f0a('0x3c')](_0x214a49[_0x9f0a('0x3a')],qs[_0x9f0a('0x3e')](_0x21b410[_0x9f0a('0x3b')][_0x9f0a('0x3e')]));_0x3abaed[_0x9f0a('0x3d')]=_0x3abaed[_0x9f0a('0x3d')][_0x9f0a('0x3f')]?_0x3abaed[_0x9f0a('0x3d')]:_0x214a49[_0x9f0a('0x3a')];_0x3abaed[_0x9f0a('0x42')]=qs[_0x9f0a('0x43')](_0x21b410[_0x9f0a('0x3b')][_0x9f0a('0x43')]);_0x3abaed[_0x9f0a('0x44')]=qs[_0x9f0a('0x45')](_[_0x9f0a('0x46')](_0x21b410['query'],_0x214a49[_0x9f0a('0x45')]));if(_0x21b410[_0x9f0a('0x3b')][_0x9f0a('0x47')]){_0x3abaed[_0x9f0a('0x44')]=_[_0x9f0a('0x48')](_0x3abaed[_0x9f0a('0x44')],{'$or':_['map'](_0x3abaed['attributes'],function(_0x1df808){var _0x20a294={};_0x20a294[_0x1df808]={'$like':'%'+_0x21b410['query'][_0x9f0a('0x47')]+'%'};return _0x20a294;})});}_0x3abaed=_[_0x9f0a('0x48')]({},_0x3abaed,_0x21b410[_0x9f0a('0x49')]);return _0x211913[_0x9f0a('0x54')](_0x3abaed);}})[_0x9f0a('0x1b')](function(_0x40f6c4){if(_0x40f6c4){_0x8f1ae9=_0x40f6c4[_0x9f0a('0x3f')];if(!_0x21b410[_0x9f0a('0x3b')][_0x9f0a('0x40')](_0x9f0a('0x41'))){_0x3abaed[_0x9f0a('0x2c')]=qs[_0x9f0a('0x2c')](_0x21b410[_0x9f0a('0x3b')][_0x9f0a('0x2c')]);_0x3abaed[_0x9f0a('0x2a')]=qs[_0x9f0a('0x2a')](_0x21b410['query']['offset']);}return _0x211913['getFields'](_0x3abaed);}})[_0x9f0a('0x1b')](function(_0x456fdf){if(_0x456fdf){return _0x456fdf?{'count':_0x8f1ae9,'rows':_0x456fdf}:null;}})[_0x9f0a('0x1b')](respondWithResult(_0x227ad1,null))['catch'](handleError(_0x227ad1,null));};exports[_0x9f0a('0x56')]=function(_0x453b33,_0x41b7ff,_0x48e333){var _0x1604ad={};var _0x5177bb={};var _0xf559cd;var _0x2c7fa6;return db[_0x9f0a('0x35')][_0x9f0a('0x57')]({'where':{'id':_0x453b33[_0x9f0a('0x4f')]['id']}})[_0x9f0a('0x1b')](handleEntityNotFound(_0x41b7ff,null))[_0x9f0a('0x1b')](function(_0x3e50d1){if(_0x3e50d1){_0xf559cd=_0x3e50d1;_0x5177bb[_0x9f0a('0x3a')]=_[_0x9f0a('0x50')](db['DeskField']['rawAttributes']);_0x5177bb[_0x9f0a('0x3b')]=_[_0x9f0a('0x50')](_0x453b33['query']);_0x5177bb[_0x9f0a('0x45')]=_[_0x9f0a('0x3c')](_0x5177bb[_0x9f0a('0x3a')],_0x5177bb[_0x9f0a('0x3b')]);_0x1604ad[_0x9f0a('0x3d')]=_[_0x9f0a('0x3c')](_0x5177bb[_0x9f0a('0x3a')],qs[_0x9f0a('0x3e')](_0x453b33['query'][_0x9f0a('0x3e')]));_0x1604ad[_0x9f0a('0x3d')]=_0x1604ad[_0x9f0a('0x3d')][_0x9f0a('0x3f')]?_0x1604ad[_0x9f0a('0x3d')]:_0x5177bb[_0x9f0a('0x3a')];_0x1604ad[_0x9f0a('0x42')]=qs[_0x9f0a('0x43')](_0x453b33[_0x9f0a('0x3b')][_0x9f0a('0x43')]);_0x1604ad[_0x9f0a('0x44')]=qs[_0x9f0a('0x45')](_[_0x9f0a('0x46')](_0x453b33[_0x9f0a('0x3b')],_0x5177bb[_0x9f0a('0x45')]));if(_0x453b33[_0x9f0a('0x3b')][_0x9f0a('0x47')]){_0x1604ad[_0x9f0a('0x44')]=_[_0x9f0a('0x48')](_0x1604ad[_0x9f0a('0x44')],{'$or':_['map'](_0x1604ad[_0x9f0a('0x3d')],function(_0x32438c){var _0x3757d4={};_0x3757d4[_0x32438c]={'$like':'%'+_0x453b33[_0x9f0a('0x3b')][_0x9f0a('0x47')]+'%'};return _0x3757d4;})});}_0x1604ad=_[_0x9f0a('0x48')]({},_0x1604ad,_0x453b33[_0x9f0a('0x49')]);return _0xf559cd[_0x9f0a('0x56')](_0x1604ad);}})[_0x9f0a('0x1b')](function(_0x375bce){if(_0x375bce){_0x2c7fa6=_0x375bce[_0x9f0a('0x3f')];if(!_0x453b33[_0x9f0a('0x3b')]['hasOwnProperty'](_0x9f0a('0x41'))){_0x1604ad[_0x9f0a('0x2c')]=qs[_0x9f0a('0x2c')](_0x453b33[_0x9f0a('0x3b')]['limit']);_0x1604ad[_0x9f0a('0x2a')]=qs[_0x9f0a('0x2a')](_0x453b33['query'][_0x9f0a('0x2a')]);}return _0xf559cd[_0x9f0a('0x56')](_0x1604ad);}})[_0x9f0a('0x1b')](function(_0x5311c1){if(_0x5311c1){return _0x5311c1?{'count':_0x2c7fa6,'rows':_0x5311c1}:null;}})[_0x9f0a('0x1b')](respondWithResult(_0x41b7ff,null))[_0x9f0a('0x4e')](handleError(_0x41b7ff,null));};exports[_0x9f0a('0x58')]=function(_0x5a3e81,_0x5beb0a,_0x1e60e4){var _0x3191c7={};var _0x33ac83={};var _0x4d3ecd;var _0x17f46b;return db[_0x9f0a('0x35')]['findOne']({'where':{'id':_0x5a3e81[_0x9f0a('0x4f')]['id']}})['then'](handleEntityNotFound(_0x5beb0a,null))[_0x9f0a('0x1b')](function(_0xd30a69){if(_0xd30a69){_0x4d3ecd=_0xd30a69;_0x33ac83[_0x9f0a('0x3a')]=_['keys'](db['DeskField'][_0x9f0a('0x36')]);_0x33ac83[_0x9f0a('0x3b')]=_['keys'](_0x5a3e81['query']);_0x33ac83[_0x9f0a('0x45')]=_[_0x9f0a('0x3c')](_0x33ac83[_0x9f0a('0x3a')],_0x33ac83['query']);_0x3191c7[_0x9f0a('0x3d')]=_['intersection'](_0x33ac83[_0x9f0a('0x3a')],qs[_0x9f0a('0x3e')](_0x5a3e81[_0x9f0a('0x3b')][_0x9f0a('0x3e')]));_0x3191c7[_0x9f0a('0x3d')]=_0x3191c7[_0x9f0a('0x3d')][_0x9f0a('0x3f')]?_0x3191c7[_0x9f0a('0x3d')]:_0x33ac83[_0x9f0a('0x3a')];_0x3191c7['order']=qs[_0x9f0a('0x43')](_0x5a3e81[_0x9f0a('0x3b')][_0x9f0a('0x43')]);_0x3191c7[_0x9f0a('0x44')]=qs['filters'](_[_0x9f0a('0x46')](_0x5a3e81[_0x9f0a('0x3b')],_0x33ac83[_0x9f0a('0x45')]));if(_0x5a3e81[_0x9f0a('0x3b')][_0x9f0a('0x47')]){_0x3191c7[_0x9f0a('0x44')]=_[_0x9f0a('0x48')](_0x3191c7[_0x9f0a('0x44')],{'$or':_[_0x9f0a('0x34')](_0x3191c7['attributes'],function(_0x3abff6){var _0xc33db7={};_0xc33db7[_0x3abff6]={'$like':'%'+_0x5a3e81[_0x9f0a('0x3b')][_0x9f0a('0x47')]+'%'};return _0xc33db7;})});}_0x3191c7=_[_0x9f0a('0x48')]({},_0x3191c7,_0x5a3e81['options']);return _0x4d3ecd[_0x9f0a('0x58')](_0x3191c7);}})[_0x9f0a('0x1b')](function(_0x1040db){if(_0x1040db){_0x17f46b=_0x1040db['length'];if(!_0x5a3e81[_0x9f0a('0x3b')][_0x9f0a('0x40')](_0x9f0a('0x41'))){_0x3191c7[_0x9f0a('0x2c')]=qs[_0x9f0a('0x2c')](_0x5a3e81[_0x9f0a('0x3b')][_0x9f0a('0x2c')]);_0x3191c7[_0x9f0a('0x2a')]=qs[_0x9f0a('0x2a')](_0x5a3e81['query'][_0x9f0a('0x2a')]);}return _0x4d3ecd[_0x9f0a('0x58')](_0x3191c7);}})['then'](function(_0x3653db){if(_0x3653db){return _0x3653db?{'count':_0x17f46b,'rows':_0x3653db}:null;}})[_0x9f0a('0x1b')](respondWithResult(_0x5beb0a,null))[_0x9f0a('0x4e')](handleError(_0x5beb0a,null));};exports[_0x9f0a('0x59')]=function(_0x2141ba,_0x3de167,_0x121aca){var _0x16359b={};var _0x4e9563={};var _0x1dfd14;var _0x4dd1e3;return db['DeskConfiguration'][_0x9f0a('0x57')]({'where':{'id':_0x2141ba[_0x9f0a('0x4f')]['id']}})[_0x9f0a('0x1b')](handleEntityNotFound(_0x3de167,null))[_0x9f0a('0x1b')](function(_0xac284d){if(_0xac284d){_0x1dfd14=_0xac284d;_0x4e9563[_0x9f0a('0x3a')]=_[_0x9f0a('0x50')](db[_0x9f0a('0x5a')][_0x9f0a('0x36')]);_0x4e9563['query']=_[_0x9f0a('0x50')](_0x2141ba[_0x9f0a('0x3b')]);_0x4e9563[_0x9f0a('0x45')]=_['intersection'](_0x4e9563['model'],_0x4e9563['query']);_0x16359b[_0x9f0a('0x3d')]=_[_0x9f0a('0x3c')](_0x4e9563[_0x9f0a('0x3a')],qs[_0x9f0a('0x3e')](_0x2141ba[_0x9f0a('0x3b')][_0x9f0a('0x3e')]));_0x16359b[_0x9f0a('0x3d')]=_0x16359b[_0x9f0a('0x3d')]['length']?_0x16359b[_0x9f0a('0x3d')]:_0x4e9563[_0x9f0a('0x3a')];_0x16359b[_0x9f0a('0x42')]=qs[_0x9f0a('0x43')](_0x2141ba[_0x9f0a('0x3b')][_0x9f0a('0x43')]);_0x16359b[_0x9f0a('0x44')]=qs[_0x9f0a('0x45')](_[_0x9f0a('0x46')](_0x2141ba[_0x9f0a('0x3b')],_0x4e9563['filters']));if(_0x2141ba[_0x9f0a('0x3b')][_0x9f0a('0x47')]){_0x16359b[_0x9f0a('0x44')]=_[_0x9f0a('0x48')](_0x16359b['where'],{'$or':_[_0x9f0a('0x34')](_0x16359b['attributes'],function(_0x2dc2a2){var _0x1b5061={};_0x1b5061[_0x2dc2a2]={'$like':'%'+_0x2141ba[_0x9f0a('0x3b')][_0x9f0a('0x47')]+'%'};return _0x1b5061;})});}_0x16359b=_[_0x9f0a('0x48')]({},_0x16359b,_0x2141ba['options']);return _0x1dfd14[_0x9f0a('0x59')](_0x16359b);}})[_0x9f0a('0x1b')](function(_0x4cce7e){if(_0x4cce7e){_0x4dd1e3=_0x4cce7e['length'];if(!_0x2141ba[_0x9f0a('0x3b')][_0x9f0a('0x40')](_0x9f0a('0x41'))){_0x16359b['limit']=qs[_0x9f0a('0x2c')](_0x2141ba['query'][_0x9f0a('0x2c')]);_0x16359b[_0x9f0a('0x2a')]=qs['offset'](_0x2141ba[_0x9f0a('0x3b')][_0x9f0a('0x2a')]);}return _0x1dfd14['getTags'](_0x16359b);}})[_0x9f0a('0x1b')](function(_0x2c8598){if(_0x2c8598){return _0x2c8598?{'count':_0x4dd1e3,'rows':_0x2c8598}:null;}})[_0x9f0a('0x1b')](respondWithResult(_0x3de167,null))[_0x9f0a('0x4e')](handleError(_0x3de167,null));};exports['setTags']=function(_0x2c8f33,_0x16bb9f,_0x28d4e7){if(_0x2c8f33[_0x9f0a('0x53')]['id']){delete _0x2c8f33['body']['id'];}return db['DeskConfiguration'][_0x9f0a('0x57')]({'where':{'id':_0x2c8f33[_0x9f0a('0x4f')]['id']}})[_0x9f0a('0x1b')](handleEntityNotFound(_0x16bb9f,null))[_0x9f0a('0x1b')](function(_0x434166){if(_0x434166){return _0x434166['setTags'](_0x2c8f33[_0x9f0a('0x53')][_0x9f0a('0x5b')]||[]);}return null;})[_0x9f0a('0x1b')](respondWithResult(_0x16bb9f,null))[_0x9f0a('0x4e')](handleError(_0x16bb9f,null));}; \ No newline at end of file +var _0x52c4=['mustache','path','sox','to-csv','fs-extra','lodash','squel','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','client','request','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','error','code','message','catch','status','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','stack','name','send','DeskConfiguration','rawAttributes','fieldName','type','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','map','VIRTUAL','merge','includeAll','include','findAll','rows','show','params','keys','options','find','create','body','findOne','getFields','getSubjects','DeskField','order','pick','getDescriptions','getTags','Tag','setTags','eml-format','rimraf','fast-json-patch','request-promise','moment'];(function(_0x21f39d,_0x4ea5c7){var _0x37f01c=function(_0x392625){while(--_0x392625){_0x21f39d['push'](_0x21f39d['shift']());}};_0x37f01c(++_0x4ea5c7);}(_0x52c4,0xad));var _0x452c=function(_0x46f58a,_0x3a7d17){_0x46f58a=_0x46f58a-0x0;var _0x5e56ec=_0x52c4[_0x46f58a];return _0x5e56ec;};'use strict';var emlformat=require(_0x452c('0x0'));var rimraf=require(_0x452c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x452c('0x2'));var rp=require(_0x452c('0x3'));var moment=require(_0x452c('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x452c('0x5'));var util=require('util');var path=require(_0x452c('0x6'));var sox=require(_0x452c('0x7'));var csv=require(_0x452c('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x452c('0x9'));var _=require(_0x452c('0xa'));var squel=require(_0x452c('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x452c('0xc'));var toCsv=require(_0x452c('0x8'));var querystring=require('querystring');var Papa=require(_0x452c('0xd'));var Redis=require('ioredis');var authService=require(_0x452c('0xe'));var qs=require(_0x452c('0xf'));var as=require(_0x452c('0x10'));var hardwareService=require(_0x452c('0x11'));var logger=require(_0x452c('0x12'))(_0x452c('0x13'));var utils=require(_0x452c('0x14'));var config=require(_0x452c('0x15'));var licenseUtil=require(_0x452c('0x16'));var db=require(_0x452c('0x17'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x452c('0x18')]['http']({'port':0x232a});function respondWithRpcPromise(_0x502647,_0x59b23a,_0x40d646,_0x294af6){return new BPromise(function(_0x4d5a22,_0x5a7044){var _0x371504=_0x294af6||client;return _0x371504[_0x452c('0x19')](_0x502647,_0x40d646)['then'](function(_0x4d278b){logger[_0x452c('0x1a')](_0x452c('0x1b'),_0x59b23a,_0x452c('0x1c'));logger[_0x452c('0x1d')]('DeskConfiguration,\x20%s,\x20%s,\x20%s',_0x59b23a,_0x452c('0x1c'),JSON['stringify'](_0x4d278b));if(_0x4d278b[_0x452c('0x1e')]){if(_0x4d278b[_0x452c('0x1e')][_0x452c('0x1f')]===0x1f4){logger['error']('DeskConfiguration,\x20%s,\x20%s',_0x59b23a,_0x4d278b[_0x452c('0x1e')][_0x452c('0x20')]);return _0x5a7044(_0x4d278b[_0x452c('0x1e')][_0x452c('0x20')]);}logger[_0x452c('0x1e')](_0x452c('0x1b'),_0x59b23a,_0x4d278b[_0x452c('0x1e')][_0x452c('0x20')]);return _0x4d5a22(_0x4d278b[_0x452c('0x1e')][_0x452c('0x20')]);}else{logger['info']('DeskConfiguration,\x20%s,\x20%s',_0x59b23a,_0x452c('0x1c'));_0x4d5a22(_0x4d278b['result'][_0x452c('0x20')]);}})[_0x452c('0x21')](function(_0x3b29b2){logger[_0x452c('0x1e')](_0x452c('0x1b'),_0x59b23a,_0x3b29b2);_0x5a7044(_0x3b29b2);});});}function respondWithStatusCode(_0x5948d8,_0x214082){_0x214082=_0x214082||0xcc;return function(_0x35178e){if(_0x35178e){return _0x5948d8['sendStatus'](_0x214082);}return _0x5948d8['status'](_0x214082)['end']();};}function respondWithResult(_0x104c6a,_0x2f9188){_0x2f9188=_0x2f9188||0xc8;return function(_0x245ce9){if(_0x245ce9){return _0x104c6a[_0x452c('0x22')](_0x2f9188)['json'](_0x245ce9);}};}function respondWithFilteredResult(_0x298c89,_0x4c8b70){return function(_0x407505){if(_0x407505){var _0x410747=typeof _0x4c8b70[_0x452c('0x23')]===_0x452c('0x24')&&typeof _0x4c8b70[_0x452c('0x25')]===_0x452c('0x24');var _0x116f5d=_0x407505['count'];var _0x192aba=_0x410747?0x0:_0x4c8b70[_0x452c('0x23')];var _0x4ca88f=_0x410747?_0x407505[_0x452c('0x26')]:_0x4c8b70[_0x452c('0x23')]+_0x4c8b70[_0x452c('0x25')];var _0x3479c3;if(_0x4ca88f>=_0x116f5d){_0x4ca88f=_0x116f5d;_0x3479c3=0xc8;}else{_0x3479c3=0xce;}_0x298c89[_0x452c('0x22')](_0x3479c3);return _0x298c89[_0x452c('0x27')](_0x452c('0x28'),_0x192aba+'-'+_0x4ca88f+'/'+_0x116f5d)['json'](_0x407505);}return null;};}function patchUpdates(_0x3c6b47){return function(_0x586c90){try{jsonpatch[_0x452c('0x29')](_0x586c90,_0x3c6b47,!![]);}catch(_0x35c957){return BPromise['reject'](_0x35c957);}return _0x586c90[_0x452c('0x2a')]();};}function saveUpdates(_0x285d5e,_0x5cb6ad){return function(_0x11c019){if(_0x11c019){return _0x11c019[_0x452c('0x2b')](_0x285d5e)[_0x452c('0x2c')](function(_0x65914){return _0x65914;});}return null;};}function removeEntity(_0x10a3fb,_0x1206d6){return function(_0x354704){if(_0x354704){return _0x354704['destroy']()[_0x452c('0x2c')](function(){_0x10a3fb[_0x452c('0x22')](0xcc)['end']();});}};}function handleEntityNotFound(_0x15f871,_0x3cab25){return function(_0x3975e9){if(!_0x3975e9){_0x15f871['sendStatus'](0x194);}return _0x3975e9;};}function handleError(_0x595221,_0x1e5182){_0x1e5182=_0x1e5182||0x1f4;return function(_0x3c924b){logger[_0x452c('0x1e')](_0x3c924b[_0x452c('0x2d')]);if(_0x3c924b[_0x452c('0x2e')]){delete _0x3c924b[_0x452c('0x2e')];}_0x595221['status'](_0x1e5182)[_0x452c('0x2f')](_0x3c924b);};}exports['index']=function(_0x273b38,_0x56ac33){var _0x416dc0={},_0x4f7b96={},_0x17bb0d={'count':0x0,'rows':[]};var _0x494e59=_['map'](db[_0x452c('0x30')][_0x452c('0x31')],function(_0x38f5bc){return{'name':_0x38f5bc[_0x452c('0x32')],'type':_0x38f5bc[_0x452c('0x33')][_0x452c('0x34')]};});_0x4f7b96['model']=_['map'](_0x494e59,_0x452c('0x2e'));_0x4f7b96[_0x452c('0x35')]=_['keys'](_0x273b38[_0x452c('0x35')]);_0x4f7b96[_0x452c('0x36')]=_[_0x452c('0x37')](_0x4f7b96[_0x452c('0x38')],_0x4f7b96[_0x452c('0x35')]);_0x416dc0['attributes']=_['intersection'](_0x4f7b96[_0x452c('0x38')],qs[_0x452c('0x39')](_0x273b38[_0x452c('0x35')][_0x452c('0x39')]));_0x416dc0['attributes']=_0x416dc0[_0x452c('0x3a')][_0x452c('0x3b')]?_0x416dc0[_0x452c('0x3a')]:_0x4f7b96[_0x452c('0x38')];if(!_0x273b38[_0x452c('0x35')][_0x452c('0x3c')](_0x452c('0x3d'))){_0x416dc0[_0x452c('0x25')]=qs['limit'](_0x273b38[_0x452c('0x35')][_0x452c('0x25')]);_0x416dc0[_0x452c('0x23')]=qs['offset'](_0x273b38[_0x452c('0x35')][_0x452c('0x23')]);}_0x416dc0['order']=qs[_0x452c('0x3e')](_0x273b38[_0x452c('0x35')][_0x452c('0x3e')]);_0x416dc0[_0x452c('0x3f')]=qs[_0x452c('0x36')](_['pick'](_0x273b38[_0x452c('0x35')],_0x4f7b96[_0x452c('0x36')]),_0x494e59);if(_0x273b38[_0x452c('0x35')][_0x452c('0x40')]){_0x416dc0[_0x452c('0x3f')]=_['merge'](_0x416dc0[_0x452c('0x3f')],{'$or':_[_0x452c('0x41')](_0x494e59,function(_0x5ed981){if(_0x5ed981['type']!==_0x452c('0x42')){var _0x20683b={};_0x20683b[_0x5ed981[_0x452c('0x2e')]]={'$like':'%'+_0x273b38[_0x452c('0x35')][_0x452c('0x40')]+'%'};return _0x20683b;}})});}_0x416dc0=_[_0x452c('0x43')]({},_0x416dc0,_0x273b38['options']);var _0x2a47f4={'where':_0x416dc0[_0x452c('0x3f')]};return db[_0x452c('0x30')][_0x452c('0x26')](_0x2a47f4)['then'](function(_0x48b1ac){_0x17bb0d[_0x452c('0x26')]=_0x48b1ac;if(_0x273b38[_0x452c('0x35')][_0x452c('0x44')]){_0x416dc0[_0x452c('0x45')]=[{'all':!![]}];}return db['DeskConfiguration'][_0x452c('0x46')](_0x416dc0);})[_0x452c('0x2c')](function(_0xd1d72a){_0x17bb0d[_0x452c('0x47')]=_0xd1d72a;return _0x17bb0d;})[_0x452c('0x2c')](respondWithFilteredResult(_0x56ac33,_0x416dc0))[_0x452c('0x21')](handleError(_0x56ac33,null));};exports[_0x452c('0x48')]=function(_0x274074,_0x3e94a6){var _0x5c8bd3={'raw':![],'where':{'id':_0x274074[_0x452c('0x49')]['id']}},_0xb6b35={};_0xb6b35[_0x452c('0x38')]=_[_0x452c('0x4a')](db[_0x452c('0x30')]['rawAttributes']);_0xb6b35['query']=_[_0x452c('0x4a')](_0x274074[_0x452c('0x35')]);_0xb6b35['filters']=_[_0x452c('0x37')](_0xb6b35[_0x452c('0x38')],_0xb6b35['query']);_0x5c8bd3[_0x452c('0x3a')]=_[_0x452c('0x37')](_0xb6b35['model'],qs[_0x452c('0x39')](_0x274074['query'][_0x452c('0x39')]));_0x5c8bd3[_0x452c('0x3a')]=_0x5c8bd3[_0x452c('0x3a')][_0x452c('0x3b')]?_0x5c8bd3['attributes']:_0xb6b35[_0x452c('0x38')];if(_0x274074[_0x452c('0x35')]['includeAll']){_0x5c8bd3[_0x452c('0x45')]=[{'all':!![]}];}_0x5c8bd3=_[_0x452c('0x43')]({},_0x5c8bd3,_0x274074[_0x452c('0x4b')]);return db[_0x452c('0x30')][_0x452c('0x4c')](_0x5c8bd3)[_0x452c('0x2c')](handleEntityNotFound(_0x3e94a6,null))['then'](respondWithResult(_0x3e94a6,null))[_0x452c('0x21')](handleError(_0x3e94a6,null));};exports['create']=function(_0x1d3afe,_0x54e1cd){return db[_0x452c('0x30')][_0x452c('0x4d')](_0x1d3afe[_0x452c('0x4e')],{})[_0x452c('0x2c')](respondWithResult(_0x54e1cd,0xc9))[_0x452c('0x21')](handleError(_0x54e1cd,null));};exports['update']=function(_0x322674,_0x2c5e77){if(_0x322674[_0x452c('0x4e')]['id']){delete _0x322674[_0x452c('0x4e')]['id'];}return db[_0x452c('0x30')][_0x452c('0x4c')]({'where':{'id':_0x322674['params']['id']}})['then'](handleEntityNotFound(_0x2c5e77,null))[_0x452c('0x2c')](saveUpdates(_0x322674['body'],null))[_0x452c('0x2c')](respondWithResult(_0x2c5e77,null))[_0x452c('0x21')](handleError(_0x2c5e77,null));};exports['destroy']=function(_0x1379c4,_0x260cd2){return db[_0x452c('0x30')]['find']({'where':{'id':_0x1379c4[_0x452c('0x49')]['id']}})[_0x452c('0x2c')](handleEntityNotFound(_0x260cd2,null))[_0x452c('0x2c')](removeEntity(_0x260cd2,null))[_0x452c('0x21')](handleError(_0x260cd2,null));};exports['getFields']=function(_0x2e5c19,_0x52870f,_0x3fb570){var _0xee4bf6={};var _0x2bcea6={};var _0x515580;var _0x502a7f;return db[_0x452c('0x30')][_0x452c('0x4f')]({'where':{'id':_0x2e5c19[_0x452c('0x49')]['id']}})['then'](handleEntityNotFound(_0x52870f,null))[_0x452c('0x2c')](function(_0x5c30a4){if(_0x5c30a4){_0x515580=_0x5c30a4;_0x2bcea6[_0x452c('0x38')]=_[_0x452c('0x4a')](db['DeskField']['rawAttributes']);_0x2bcea6[_0x452c('0x35')]=_[_0x452c('0x4a')](_0x2e5c19[_0x452c('0x35')]);_0x2bcea6[_0x452c('0x36')]=_[_0x452c('0x37')](_0x2bcea6[_0x452c('0x38')],_0x2bcea6['query']);_0xee4bf6[_0x452c('0x3a')]=_[_0x452c('0x37')](_0x2bcea6[_0x452c('0x38')],qs[_0x452c('0x39')](_0x2e5c19[_0x452c('0x35')][_0x452c('0x39')]));_0xee4bf6['attributes']=_0xee4bf6[_0x452c('0x3a')][_0x452c('0x3b')]?_0xee4bf6['attributes']:_0x2bcea6['model'];_0xee4bf6['order']=qs['sort'](_0x2e5c19[_0x452c('0x35')][_0x452c('0x3e')]);_0xee4bf6[_0x452c('0x3f')]=qs[_0x452c('0x36')](_['pick'](_0x2e5c19[_0x452c('0x35')],_0x2bcea6[_0x452c('0x36')]));if(_0x2e5c19[_0x452c('0x35')][_0x452c('0x40')]){_0xee4bf6[_0x452c('0x3f')]=_[_0x452c('0x43')](_0xee4bf6[_0x452c('0x3f')],{'$or':_[_0x452c('0x41')](_0xee4bf6[_0x452c('0x3a')],function(_0x4f9dcd){var _0x567ecd={};_0x567ecd[_0x4f9dcd]={'$like':'%'+_0x2e5c19['query'][_0x452c('0x40')]+'%'};return _0x567ecd;})});}_0xee4bf6=_[_0x452c('0x43')]({},_0xee4bf6,_0x2e5c19[_0x452c('0x4b')]);return _0x515580[_0x452c('0x50')](_0xee4bf6);}})['then'](function(_0x42d1ec){if(_0x42d1ec){_0x502a7f=_0x42d1ec['length'];if(!_0x2e5c19['query'][_0x452c('0x3c')](_0x452c('0x3d'))){_0xee4bf6[_0x452c('0x25')]=qs[_0x452c('0x25')](_0x2e5c19[_0x452c('0x35')][_0x452c('0x25')]);_0xee4bf6[_0x452c('0x23')]=qs[_0x452c('0x23')](_0x2e5c19['query'][_0x452c('0x23')]);}return _0x515580[_0x452c('0x50')](_0xee4bf6);}})[_0x452c('0x2c')](function(_0x35c0b0){if(_0x35c0b0){return _0x35c0b0?{'count':_0x502a7f,'rows':_0x35c0b0}:null;}})['then'](respondWithResult(_0x52870f,null))[_0x452c('0x21')](handleError(_0x52870f,null));};exports[_0x452c('0x51')]=function(_0x232343,_0x430716,_0x4949fd){var _0x244cd8={};var _0x2fdce6={};var _0x293290;var _0x1f5f09;return db['DeskConfiguration'][_0x452c('0x4f')]({'where':{'id':_0x232343[_0x452c('0x49')]['id']}})[_0x452c('0x2c')](handleEntityNotFound(_0x430716,null))[_0x452c('0x2c')](function(_0x54222d){if(_0x54222d){_0x293290=_0x54222d;_0x2fdce6[_0x452c('0x38')]=_[_0x452c('0x4a')](db[_0x452c('0x52')]['rawAttributes']);_0x2fdce6['query']=_[_0x452c('0x4a')](_0x232343[_0x452c('0x35')]);_0x2fdce6[_0x452c('0x36')]=_['intersection'](_0x2fdce6[_0x452c('0x38')],_0x2fdce6[_0x452c('0x35')]);_0x244cd8[_0x452c('0x3a')]=_[_0x452c('0x37')](_0x2fdce6[_0x452c('0x38')],qs[_0x452c('0x39')](_0x232343[_0x452c('0x35')]['fields']));_0x244cd8[_0x452c('0x3a')]=_0x244cd8[_0x452c('0x3a')]['length']?_0x244cd8[_0x452c('0x3a')]:_0x2fdce6[_0x452c('0x38')];_0x244cd8[_0x452c('0x53')]=qs['sort'](_0x232343['query'][_0x452c('0x3e')]);_0x244cd8[_0x452c('0x3f')]=qs[_0x452c('0x36')](_[_0x452c('0x54')](_0x232343['query'],_0x2fdce6['filters']));if(_0x232343['query'][_0x452c('0x40')]){_0x244cd8[_0x452c('0x3f')]=_[_0x452c('0x43')](_0x244cd8[_0x452c('0x3f')],{'$or':_['map'](_0x244cd8[_0x452c('0x3a')],function(_0x3e51a3){var _0x46fc5f={};_0x46fc5f[_0x3e51a3]={'$like':'%'+_0x232343[_0x452c('0x35')][_0x452c('0x40')]+'%'};return _0x46fc5f;})});}_0x244cd8=_[_0x452c('0x43')]({},_0x244cd8,_0x232343['options']);return _0x293290[_0x452c('0x51')](_0x244cd8);}})[_0x452c('0x2c')](function(_0x16e57a){if(_0x16e57a){_0x1f5f09=_0x16e57a[_0x452c('0x3b')];if(!_0x232343[_0x452c('0x35')]['hasOwnProperty'](_0x452c('0x3d'))){_0x244cd8['limit']=qs[_0x452c('0x25')](_0x232343[_0x452c('0x35')][_0x452c('0x25')]);_0x244cd8[_0x452c('0x23')]=qs['offset'](_0x232343[_0x452c('0x35')][_0x452c('0x23')]);}return _0x293290[_0x452c('0x51')](_0x244cd8);}})[_0x452c('0x2c')](function(_0x5ad6e1){if(_0x5ad6e1){return _0x5ad6e1?{'count':_0x1f5f09,'rows':_0x5ad6e1}:null;}})['then'](respondWithResult(_0x430716,null))['catch'](handleError(_0x430716,null));};exports[_0x452c('0x55')]=function(_0x2d453e,_0x2c5440,_0x5e869){var _0x27522d={};var _0x45a562={};var _0x204897;var _0x131090;return db[_0x452c('0x30')][_0x452c('0x4f')]({'where':{'id':_0x2d453e[_0x452c('0x49')]['id']}})['then'](handleEntityNotFound(_0x2c5440,null))[_0x452c('0x2c')](function(_0x2f9883){if(_0x2f9883){_0x204897=_0x2f9883;_0x45a562['model']=_[_0x452c('0x4a')](db[_0x452c('0x52')][_0x452c('0x31')]);_0x45a562[_0x452c('0x35')]=_[_0x452c('0x4a')](_0x2d453e[_0x452c('0x35')]);_0x45a562[_0x452c('0x36')]=_[_0x452c('0x37')](_0x45a562[_0x452c('0x38')],_0x45a562['query']);_0x27522d[_0x452c('0x3a')]=_[_0x452c('0x37')](_0x45a562[_0x452c('0x38')],qs[_0x452c('0x39')](_0x2d453e[_0x452c('0x35')][_0x452c('0x39')]));_0x27522d[_0x452c('0x3a')]=_0x27522d['attributes'][_0x452c('0x3b')]?_0x27522d[_0x452c('0x3a')]:_0x45a562['model'];_0x27522d[_0x452c('0x53')]=qs[_0x452c('0x3e')](_0x2d453e['query'][_0x452c('0x3e')]);_0x27522d['where']=qs[_0x452c('0x36')](_[_0x452c('0x54')](_0x2d453e[_0x452c('0x35')],_0x45a562[_0x452c('0x36')]));if(_0x2d453e[_0x452c('0x35')][_0x452c('0x40')]){_0x27522d['where']=_['merge'](_0x27522d[_0x452c('0x3f')],{'$or':_[_0x452c('0x41')](_0x27522d['attributes'],function(_0x523a85){var _0x334a91={};_0x334a91[_0x523a85]={'$like':'%'+_0x2d453e[_0x452c('0x35')][_0x452c('0x40')]+'%'};return _0x334a91;})});}_0x27522d=_[_0x452c('0x43')]({},_0x27522d,_0x2d453e[_0x452c('0x4b')]);return _0x204897[_0x452c('0x55')](_0x27522d);}})['then'](function(_0x4872dc){if(_0x4872dc){_0x131090=_0x4872dc[_0x452c('0x3b')];if(!_0x2d453e[_0x452c('0x35')][_0x452c('0x3c')](_0x452c('0x3d'))){_0x27522d[_0x452c('0x25')]=qs[_0x452c('0x25')](_0x2d453e[_0x452c('0x35')][_0x452c('0x25')]);_0x27522d[_0x452c('0x23')]=qs[_0x452c('0x23')](_0x2d453e[_0x452c('0x35')][_0x452c('0x23')]);}return _0x204897[_0x452c('0x55')](_0x27522d);}})[_0x452c('0x2c')](function(_0x2323f4){if(_0x2323f4){return _0x2323f4?{'count':_0x131090,'rows':_0x2323f4}:null;}})[_0x452c('0x2c')](respondWithResult(_0x2c5440,null))['catch'](handleError(_0x2c5440,null));};exports[_0x452c('0x56')]=function(_0x1597b7,_0x4b5a98,_0x9e2955){var _0x268020={};var _0x48181c={};var _0x5ac5ec;var _0x16d244;return db[_0x452c('0x30')][_0x452c('0x4f')]({'where':{'id':_0x1597b7[_0x452c('0x49')]['id']}})['then'](handleEntityNotFound(_0x4b5a98,null))[_0x452c('0x2c')](function(_0x1cfc20){if(_0x1cfc20){_0x5ac5ec=_0x1cfc20;_0x48181c['model']=_[_0x452c('0x4a')](db[_0x452c('0x57')][_0x452c('0x31')]);_0x48181c[_0x452c('0x35')]=_[_0x452c('0x4a')](_0x1597b7[_0x452c('0x35')]);_0x48181c[_0x452c('0x36')]=_['intersection'](_0x48181c[_0x452c('0x38')],_0x48181c[_0x452c('0x35')]);_0x268020[_0x452c('0x3a')]=_['intersection'](_0x48181c[_0x452c('0x38')],qs[_0x452c('0x39')](_0x1597b7[_0x452c('0x35')]['fields']));_0x268020[_0x452c('0x3a')]=_0x268020['attributes'][_0x452c('0x3b')]?_0x268020[_0x452c('0x3a')]:_0x48181c[_0x452c('0x38')];_0x268020[_0x452c('0x53')]=qs[_0x452c('0x3e')](_0x1597b7[_0x452c('0x35')][_0x452c('0x3e')]);_0x268020['where']=qs[_0x452c('0x36')](_[_0x452c('0x54')](_0x1597b7['query'],_0x48181c['filters']));if(_0x1597b7[_0x452c('0x35')][_0x452c('0x40')]){_0x268020[_0x452c('0x3f')]=_['merge'](_0x268020[_0x452c('0x3f')],{'$or':_[_0x452c('0x41')](_0x268020[_0x452c('0x3a')],function(_0x4c054c){var _0x37d08f={};_0x37d08f[_0x4c054c]={'$like':'%'+_0x1597b7[_0x452c('0x35')][_0x452c('0x40')]+'%'};return _0x37d08f;})});}_0x268020=_[_0x452c('0x43')]({},_0x268020,_0x1597b7[_0x452c('0x4b')]);return _0x5ac5ec[_0x452c('0x56')](_0x268020);}})['then'](function(_0x1791b7){if(_0x1791b7){_0x16d244=_0x1791b7[_0x452c('0x3b')];if(!_0x1597b7['query'][_0x452c('0x3c')](_0x452c('0x3d'))){_0x268020['limit']=qs[_0x452c('0x25')](_0x1597b7['query'][_0x452c('0x25')]);_0x268020[_0x452c('0x23')]=qs['offset'](_0x1597b7[_0x452c('0x35')][_0x452c('0x23')]);}return _0x5ac5ec[_0x452c('0x56')](_0x268020);}})[_0x452c('0x2c')](function(_0x5022e0){if(_0x5022e0){return _0x5022e0?{'count':_0x16d244,'rows':_0x5022e0}:null;}})[_0x452c('0x2c')](respondWithResult(_0x4b5a98,null))[_0x452c('0x21')](handleError(_0x4b5a98,null));};exports[_0x452c('0x58')]=function(_0x16c6de,_0x4eea8c,_0x1adb64){if(_0x16c6de[_0x452c('0x4e')]['id']){delete _0x16c6de['body']['id'];}return db[_0x452c('0x30')]['findOne']({'where':{'id':_0x16c6de['params']['id']}})['then'](handleEntityNotFound(_0x4eea8c,null))[_0x452c('0x2c')](function(_0x19e794){if(_0x19e794){return _0x19e794['setTags'](_0x16c6de[_0x452c('0x4e')]['ids']||[]);}return null;})['then'](respondWithResult(_0x4eea8c,null))['catch'](handleError(_0x4eea8c,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index e2bc0b0..89cd74d 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 _0x2a1c=['./intDeskConfiguration.attributes','exports','define','DeskConfiguration','int_desk_configurations','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment'];(function(_0x4fde08,_0x463a36){var _0x12e725=function(_0x2670c5){while(--_0x2670c5){_0x4fde08['push'](_0x4fde08['shift']());}};_0x12e725(++_0x463a36);}(_0x2a1c,0x10d));var _0xc2a1=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0x2a1c[_0x3ab9ee];return _0x82ee88;};'use strict';var _=require('lodash');var util=require(_0xc2a1('0x0'));var logger=require(_0xc2a1('0x1'))(_0xc2a1('0x2'));var moment=require('moment');var BPromise=require(_0xc2a1('0x3'));var rp=require(_0xc2a1('0x4'));var fs=require('fs');var path=require(_0xc2a1('0x5'));var rimraf=require('rimraf');var config=require(_0xc2a1('0x6'));var attributes=require(_0xc2a1('0x7'));module[_0xc2a1('0x8')]=function(_0x375b13,_0x28afd8){return _0x375b13[_0xc2a1('0x9')](_0xc2a1('0xa'),attributes,{'tableName':_0xc2a1('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2cc9=['exports','define','DeskConfiguration','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x5ce3c8,_0x2503bd){var _0xa76867=function(_0x52815e){while(--_0x52815e){_0x5ce3c8['push'](_0x5ce3c8['shift']());}};_0xa76867(++_0x2503bd);}(_0x2cc9,0x1f2));var _0x92cc=function(_0x4f7525,_0x4ac381){_0x4f7525=_0x4f7525-0x0;var _0x58209c=_0x2cc9[_0x4f7525];return _0x58209c;};'use strict';var _=require('lodash');var util=require(_0x92cc('0x0'));var logger=require(_0x92cc('0x1'))(_0x92cc('0x2'));var moment=require(_0x92cc('0x3'));var BPromise=require(_0x92cc('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x92cc('0x5'));var rimraf=require(_0x92cc('0x6'));var config=require(_0x92cc('0x7'));var attributes=require('./intDeskConfiguration.attributes');module[_0x92cc('0x8')]=function(_0x5e57d1,_0x802e7a){return _0x5e57d1[_0x92cc('0x9')](_0x92cc('0xa'),attributes,{'tableName':'int_desk_configurations','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 1afa844..8f46366 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 _0xda20=['http','request','then','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','lodash','moment','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xda20,0x1d9));var _0x0da2=function(_0xac4731,_0x11554c){_0xac4731=_0xac4731-0x0;var _0x3abf0b=_0xda20[_0xac4731];return _0x3abf0b;};'use strict';var _=require(_0x0da2('0x0'));var util=require('util');var moment=require(_0x0da2('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0da2('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x0da2('0x3'));var logger=require(_0x0da2('0x4'))('rpc');var config=require(_0x0da2('0x5'));var jayson=require(_0x0da2('0x6'));var client=jayson['client'][_0x0da2('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x292ede,_0x166a32,_0x3aa0c5){return new BPromise(function(_0x1e5150,_0x1069a6){return client[_0x0da2('0x8')](_0x292ede,_0x3aa0c5)[_0x0da2('0x9')](function(_0x248bce){logger['info'](_0x0da2('0xa'),_0x166a32,_0x0da2('0xb'));logger[_0x0da2('0xc')](_0x0da2('0xd'),_0x166a32,'request\x20sent',JSON['stringify'](_0x248bce));if(_0x248bce[_0x0da2('0xe')]){if(_0x248bce[_0x0da2('0xe')][_0x0da2('0xf')]===0x1f4){logger[_0x0da2('0xe')](_0x0da2('0xa'),_0x166a32,_0x248bce[_0x0da2('0xe')][_0x0da2('0x10')]);return _0x1069a6(_0x248bce['error'][_0x0da2('0x10')]);}logger['error']('DeskConfiguration,\x20%s,\x20%s',_0x166a32,_0x248bce['error'][_0x0da2('0x10')]);return _0x1e5150(_0x248bce['error'][_0x0da2('0x10')]);}else{logger[_0x0da2('0x11')]('DeskConfiguration,\x20%s,\x20%s',_0x166a32,_0x0da2('0xb'));_0x1e5150(_0x248bce[_0x0da2('0x12')]['message']);}})[_0x0da2('0x13')](function(_0x192772){logger[_0x0da2('0xe')]('DeskConfiguration,\x20%s,\x20%s',_0x166a32,_0x192772);_0x1069a6(_0x192772);});});} \ No newline at end of file +var _0x627e=['request','info','DeskConfiguration,\x20%s,\x20%s','DeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','client','http'];(function(_0x2fd587,_0x2099dd){var _0x304dc5=function(_0x1ef584){while(--_0x1ef584){_0x2fd587['push'](_0x2fd587['shift']());}};_0x304dc5(++_0x2099dd);}(_0x627e,0x14a));var _0xe627=function(_0x3920b0,_0x41c05f){_0x3920b0=_0x3920b0-0x0;var _0x1121d0=_0x627e[_0x3920b0];return _0x1121d0;};'use strict';var _=require(_0xe627('0x0'));var util=require(_0xe627('0x1'));var moment=require(_0xe627('0x2'));var BPromise=require(_0xe627('0x3'));var rs=require(_0xe627('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe627('0x5'))['db'];var utils=require(_0xe627('0x6'));var logger=require(_0xe627('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xe627('0x8')][_0xe627('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x45e49a,_0x2d4f63,_0xd5016e){return new BPromise(function(_0xe065b,_0x4bae52){return client[_0xe627('0xa')](_0x45e49a,_0xd5016e)['then'](function(_0x56549e){logger[_0xe627('0xb')](_0xe627('0xc'),_0x2d4f63,'request\x20sent');logger['debug'](_0xe627('0xd'),_0x2d4f63,_0xe627('0xe'),JSON[_0xe627('0xf')](_0x56549e));if(_0x56549e[_0xe627('0x10')]){if(_0x56549e[_0xe627('0x10')][_0xe627('0x11')]===0x1f4){logger[_0xe627('0x10')](_0xe627('0xc'),_0x2d4f63,_0x56549e[_0xe627('0x10')]['message']);return _0x4bae52(_0x56549e[_0xe627('0x10')][_0xe627('0x12')]);}logger[_0xe627('0x10')]('DeskConfiguration,\x20%s,\x20%s',_0x2d4f63,_0x56549e[_0xe627('0x10')][_0xe627('0x12')]);return _0xe065b(_0x56549e[_0xe627('0x10')][_0xe627('0x12')]);}else{logger[_0xe627('0xb')](_0xe627('0xc'),_0x2d4f63,_0xe627('0xe'));_0xe065b(_0x56549e['result'][_0xe627('0x12')]);}})[_0xe627('0x13')](function(_0x16c2d7){logger[_0xe627('0x10')](_0xe627('0xc'),_0x2d4f63,_0x16c2d7);_0x4bae52(_0x16c2d7);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index 043e97a..b54e499 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 _0x85c5=['/:id','isAuthenticated','show','create','update','delete','destroy','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskField.controller','index'];(function(_0x3fc110,_0x9e7f2f){var _0x31701c=function(_0x21c31a){while(--_0x21c31a){_0x3fc110['push'](_0x3fc110['shift']());}};_0x31701c(++_0x9e7f2f);}(_0x85c5,0xe0));var _0x585c=function(_0x4945f2,_0x3c2a5c){_0x4945f2=_0x4945f2-0x0;var _0x25f436=_0x85c5[_0x4945f2];return _0x25f436;};'use strict';var multer=require(_0x585c('0x0'));var util=require(_0x585c('0x1'));var path=require(_0x585c('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x585c('0x3')]();var fs_extra=require(_0x585c('0x4'));var auth=require(_0x585c('0x5'));var interaction=require(_0x585c('0x6'));var config=require(_0x585c('0x7'));var controller=require(_0x585c('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x585c('0x9')]);router['get'](_0x585c('0xa'),auth[_0x585c('0xb')](),controller[_0x585c('0xc')]);router['post']('/',auth[_0x585c('0xb')](),controller[_0x585c('0xd')]);router['put']('/:id',auth[_0x585c('0xb')](),controller[_0x585c('0xe')]);router[_0x585c('0xf')](_0x585c('0xa'),auth[_0x585c('0xb')](),controller[_0x585c('0x10')]);module[_0x585c('0x11')]=router; \ No newline at end of file +var _0xa321=['fs-extra','../../components/interaction/service','../../config/environment','index','/:id','isAuthenticated','show','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router'];(function(_0xf42fce,_0x570ca5){var _0x5c33b5=function(_0x2a23cc){while(--_0x2a23cc){_0xf42fce['push'](_0xf42fce['shift']());}};_0x5c33b5(++_0x570ca5);}(_0xa321,0x9d));var _0x1a32=function(_0x387dc1,_0x3ba649){_0x387dc1=_0x387dc1-0x0;var _0x17567c=_0xa321[_0x387dc1];return _0x17567c;};'use strict';var multer=require(_0x1a32('0x0'));var util=require(_0x1a32('0x1'));var path=require(_0x1a32('0x2'));var timeout=require(_0x1a32('0x3'));var express=require('express');var router=express[_0x1a32('0x4')]();var fs_extra=require(_0x1a32('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x1a32('0x6'));var config=require(_0x1a32('0x7'));var controller=require('./intDeskField.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x1a32('0x8')]);router['get'](_0x1a32('0x9'),auth[_0x1a32('0xa')](),controller[_0x1a32('0xb')]);router[_0x1a32('0xc')]('/',auth[_0x1a32('0xa')](),controller['create']);router[_0x1a32('0xd')](_0x1a32('0x9'),auth['isAuthenticated'](),controller[_0x1a32('0xe')]);router[_0x1a32('0xf')](_0x1a32('0x9'),auth[_0x1a32('0xa')](),controller[_0x1a32('0x10')]);module[_0x1a32('0x11')]=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index 1908ec8..ee0def3 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 _0xa205=['BOOLEAN','exports','string','variable','customVariable','keyValue','STRING'];(function(_0x3ab4ad,_0x5b2ec8){var _0x15aff7=function(_0x3e0067){while(--_0x3e0067){_0x3ab4ad['push'](_0x3ab4ad['shift']());}};_0x15aff7(++_0x5b2ec8);}(_0xa205,0x17b));var _0x5a20=function(_0x32f6b9,_0x2d4aa9){_0x32f6b9=_0x32f6b9-0x0;var _0x267d52=_0xa205[_0x32f6b9];return _0x267d52;};'use strict';var Sequelize=require('sequelize');module[_0x5a20('0x0')]={'type':{'type':Sequelize['ENUM'](_0x5a20('0x1'),_0x5a20('0x2'),_0x5a20('0x3'),_0x5a20('0x4'),'picklist'),'defaultValue':_0x5a20('0x1')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x5a20('0x5')]},'keyType':{'type':Sequelize['ENUM']('string',_0x5a20('0x2'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x5a20('0x5')]},'nameField':{'type':Sequelize[_0x5a20('0x5')]},'customField':{'type':Sequelize[_0x5a20('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x5a20('0x5')]}}; \ No newline at end of file +var _0xa2aa=['variable','keyValue','picklist','STRING','customVariable','BOOLEAN','exports','ENUM','string'];(function(_0x2e7704,_0xe71a0e){var _0x352b27=function(_0x123e3e){while(--_0x123e3e){_0x2e7704['push'](_0x2e7704['shift']());}};_0x352b27(++_0xe71a0e);}(_0xa2aa,0x16e));var _0xaa2a=function(_0x9d24f1,_0x38c2c1){_0x9d24f1=_0x9d24f1-0x0;var _0x121ce1=_0xa2aa[_0x9d24f1];return _0x121ce1;};'use strict';var Sequelize=require('sequelize');module[_0xaa2a('0x0')]={'type':{'type':Sequelize[_0xaa2a('0x1')](_0xaa2a('0x2'),_0xaa2a('0x3'),'customVariable',_0xaa2a('0x4'),_0xaa2a('0x5')),'defaultValue':_0xaa2a('0x2')},'content':{'type':Sequelize[_0xaa2a('0x6')]},'key':{'type':Sequelize[_0xaa2a('0x6')]},'keyType':{'type':Sequelize[_0xaa2a('0x1')](_0xaa2a('0x2'),'variable',_0xaa2a('0x7'))},'keyContent':{'type':Sequelize[_0xaa2a('0x6')]},'idField':{'type':Sequelize[_0xaa2a('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xaa2a('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xaa2a('0x6')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index 95b9e6b..38c4fce 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 _0x46aa=['end','json','offset','undefined','limit','count','set','apply','reject','save','destroy','then','stack','name','send','index','DeskField','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','map','VIRTUAL','options','where','includeAll','include','findAll','rows','catch','show','params','find','create','update','body','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status'];(function(_0x27ca42,_0x1c09c8){var _0x5e610b=function(_0x3d6ccd){while(--_0x3d6ccd){_0x27ca42['push'](_0x27ca42['shift']());}};_0x5e610b(++_0x1c09c8);}(_0x46aa,0xcb));var _0xa46a=function(_0x5f3f88,_0x562baf){_0x5f3f88=_0x5f3f88-0x0;var _0xd08119=_0x46aa[_0x5f3f88];return _0xd08119;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa46a('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa46a('0x1'));var rp=require(_0xa46a('0x2'));var moment=require(_0xa46a('0x3'));var BPromise=require(_0xa46a('0x4'));var Mustache=require(_0xa46a('0x5'));var util=require(_0xa46a('0x6'));var path=require(_0xa46a('0x7'));var sox=require(_0xa46a('0x8'));var csv=require(_0xa46a('0x9'));var ejs=require(_0xa46a('0xa'));var fs=require('fs');var fs_extra=require(_0xa46a('0xb'));var _=require(_0xa46a('0xc'));var squel=require('squel');var crypto=require(_0xa46a('0xd'));var jsforce=require(_0xa46a('0xe'));var deskjs=require(_0xa46a('0xf'));var toCsv=require(_0xa46a('0x9'));var querystring=require('querystring');var Papa=require(_0xa46a('0x10'));var Redis=require(_0xa46a('0x11'));var authService=require(_0xa46a('0x12'));var qs=require(_0xa46a('0x13'));var as=require(_0xa46a('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa46a('0x15'))(_0xa46a('0x16'));var utils=require('../../config/utils');var config=require(_0xa46a('0x17'));var licenseUtil=require(_0xa46a('0x18'));var db=require(_0xa46a('0x19'))['db'];function respondWithStatusCode(_0x3f9fe1,_0x2720c4){_0x2720c4=_0x2720c4||0xcc;return function(_0x2eda0b){if(_0x2eda0b){return _0x3f9fe1[_0xa46a('0x1a')](_0x2720c4);}return _0x3f9fe1[_0xa46a('0x1b')](_0x2720c4)[_0xa46a('0x1c')]();};}function respondWithResult(_0x35d9ef,_0x447e77){_0x447e77=_0x447e77||0xc8;return function(_0x29577b){if(_0x29577b){return _0x35d9ef[_0xa46a('0x1b')](_0x447e77)[_0xa46a('0x1d')](_0x29577b);}};}function respondWithFilteredResult(_0x43626e,_0x16bff4){return function(_0x362b80){if(_0x362b80){var _0x1bdd55=typeof _0x16bff4[_0xa46a('0x1e')]===_0xa46a('0x1f')&&typeof _0x16bff4[_0xa46a('0x20')]===_0xa46a('0x1f');var _0x4867c1=_0x362b80[_0xa46a('0x21')];var _0x4fdc40=_0x1bdd55?0x0:_0x16bff4[_0xa46a('0x1e')];var _0x529921=_0x1bdd55?_0x362b80[_0xa46a('0x21')]:_0x16bff4['offset']+_0x16bff4[_0xa46a('0x20')];var _0x56bd73;if(_0x529921>=_0x4867c1){_0x529921=_0x4867c1;_0x56bd73=0xc8;}else{_0x56bd73=0xce;}_0x43626e[_0xa46a('0x1b')](_0x56bd73);return _0x43626e[_0xa46a('0x22')]('Content-Range',_0x4fdc40+'-'+_0x529921+'/'+_0x4867c1)[_0xa46a('0x1d')](_0x362b80);}return null;};}function patchUpdates(_0x379a08){return function(_0x5d1dfc){try{jsonpatch[_0xa46a('0x23')](_0x5d1dfc,_0x379a08,!![]);}catch(_0x1c6c8f){return BPromise[_0xa46a('0x24')](_0x1c6c8f);}return _0x5d1dfc[_0xa46a('0x25')]();};}function saveUpdates(_0x441837,_0x3d491e){return function(_0x24bc6a){if(_0x24bc6a){return _0x24bc6a['update'](_0x441837)['then'](function(_0x4c0500){return _0x4c0500;});}return null;};}function removeEntity(_0x668e0f,_0xe2f0b5){return function(_0x437dee){if(_0x437dee){return _0x437dee[_0xa46a('0x26')]()[_0xa46a('0x27')](function(){_0x668e0f[_0xa46a('0x1b')](0xcc)[_0xa46a('0x1c')]();});}};}function handleEntityNotFound(_0x202f91,_0x2fc145){return function(_0x24fccd){if(!_0x24fccd){_0x202f91[_0xa46a('0x1a')](0x194);}return _0x24fccd;};}function handleError(_0x5ed3df,_0x18d4af){_0x18d4af=_0x18d4af||0x1f4;return function(_0x5df4e7){logger['error'](_0x5df4e7[_0xa46a('0x28')]);if(_0x5df4e7[_0xa46a('0x29')]){delete _0x5df4e7[_0xa46a('0x29')];}_0x5ed3df[_0xa46a('0x1b')](_0x18d4af)[_0xa46a('0x2a')](_0x5df4e7);};}exports[_0xa46a('0x2b')]=function(_0xfeb33d,_0x1936fb){var _0x4b2e0b={},_0x59610f={},_0x3a1c4c={'count':0x0,'rows':[]};var _0x163f8b=_['map'](db[_0xa46a('0x2c')]['rawAttributes'],function(_0x28780c){return{'name':_0x28780c['fieldName'],'type':_0x28780c[_0xa46a('0x2d')][_0xa46a('0x2e')]};});_0x59610f[_0xa46a('0x2f')]=_['map'](_0x163f8b,_0xa46a('0x29'));_0x59610f[_0xa46a('0x30')]=_[_0xa46a('0x31')](_0xfeb33d[_0xa46a('0x30')]);_0x59610f[_0xa46a('0x32')]=_['intersection'](_0x59610f['model'],_0x59610f['query']);_0x4b2e0b[_0xa46a('0x33')]=_[_0xa46a('0x34')](_0x59610f[_0xa46a('0x2f')],qs[_0xa46a('0x35')](_0xfeb33d[_0xa46a('0x30')][_0xa46a('0x35')]));_0x4b2e0b[_0xa46a('0x33')]=_0x4b2e0b[_0xa46a('0x33')][_0xa46a('0x36')]?_0x4b2e0b[_0xa46a('0x33')]:_0x59610f[_0xa46a('0x2f')];if(!_0xfeb33d[_0xa46a('0x30')][_0xa46a('0x37')](_0xa46a('0x38'))){_0x4b2e0b[_0xa46a('0x20')]=qs[_0xa46a('0x20')](_0xfeb33d['query'][_0xa46a('0x20')]);_0x4b2e0b['offset']=qs[_0xa46a('0x1e')](_0xfeb33d[_0xa46a('0x30')][_0xa46a('0x1e')]);}_0x4b2e0b[_0xa46a('0x39')]=qs[_0xa46a('0x3a')](_0xfeb33d['query'][_0xa46a('0x3a')]);_0x4b2e0b['where']=qs[_0xa46a('0x32')](_[_0xa46a('0x3b')](_0xfeb33d[_0xa46a('0x30')],_0x59610f['filters']),_0x163f8b);if(_0xfeb33d[_0xa46a('0x30')][_0xa46a('0x3c')]){_0x4b2e0b['where']=_[_0xa46a('0x3d')](_0x4b2e0b['where'],{'$or':_[_0xa46a('0x3e')](_0x163f8b,function(_0x5cc962){if(_0x5cc962[_0xa46a('0x2d')]!==_0xa46a('0x3f')){var _0x507884={};_0x507884[_0x5cc962[_0xa46a('0x29')]]={'$like':'%'+_0xfeb33d[_0xa46a('0x30')]['filter']+'%'};return _0x507884;}})});}_0x4b2e0b=_[_0xa46a('0x3d')]({},_0x4b2e0b,_0xfeb33d[_0xa46a('0x40')]);var _0x55e060={'where':_0x4b2e0b[_0xa46a('0x41')]};return db['DeskField'][_0xa46a('0x21')](_0x55e060)[_0xa46a('0x27')](function(_0x5c483a){_0x3a1c4c[_0xa46a('0x21')]=_0x5c483a;if(_0xfeb33d[_0xa46a('0x30')][_0xa46a('0x42')]){_0x4b2e0b[_0xa46a('0x43')]=[{'all':!![]}];}return db['DeskField'][_0xa46a('0x44')](_0x4b2e0b);})['then'](function(_0x2ef5ef){_0x3a1c4c[_0xa46a('0x45')]=_0x2ef5ef;return _0x3a1c4c;})[_0xa46a('0x27')](respondWithFilteredResult(_0x1936fb,_0x4b2e0b))[_0xa46a('0x46')](handleError(_0x1936fb,null));};exports[_0xa46a('0x47')]=function(_0x2ba1ce,_0x131c6d){var _0x2aeacf={'raw':!![],'where':{'id':_0x2ba1ce[_0xa46a('0x48')]['id']}},_0x27aca7={};_0x27aca7[_0xa46a('0x2f')]=_[_0xa46a('0x31')](db[_0xa46a('0x2c')]['rawAttributes']);_0x27aca7[_0xa46a('0x30')]=_[_0xa46a('0x31')](_0x2ba1ce[_0xa46a('0x30')]);_0x27aca7['filters']=_[_0xa46a('0x34')](_0x27aca7[_0xa46a('0x2f')],_0x27aca7[_0xa46a('0x30')]);_0x2aeacf['attributes']=_[_0xa46a('0x34')](_0x27aca7['model'],qs[_0xa46a('0x35')](_0x2ba1ce[_0xa46a('0x30')][_0xa46a('0x35')]));_0x2aeacf[_0xa46a('0x33')]=_0x2aeacf['attributes']['length']?_0x2aeacf[_0xa46a('0x33')]:_0x27aca7['model'];if(_0x2ba1ce[_0xa46a('0x30')][_0xa46a('0x42')]){_0x2aeacf[_0xa46a('0x43')]=[{'all':!![]}];}_0x2aeacf=_[_0xa46a('0x3d')]({},_0x2aeacf,_0x2ba1ce['options']);return db[_0xa46a('0x2c')][_0xa46a('0x49')](_0x2aeacf)[_0xa46a('0x27')](handleEntityNotFound(_0x131c6d,null))['then'](respondWithResult(_0x131c6d,null))[_0xa46a('0x46')](handleError(_0x131c6d,null));};exports[_0xa46a('0x4a')]=function(_0xfb54cc,_0x566f7c){return db[_0xa46a('0x2c')][_0xa46a('0x4a')](_0xfb54cc['body'],{})[_0xa46a('0x27')](respondWithResult(_0x566f7c,0xc9))[_0xa46a('0x46')](handleError(_0x566f7c,null));};exports[_0xa46a('0x4b')]=function(_0x1d0265,_0x2ba18a){if(_0x1d0265[_0xa46a('0x4c')]['id']){delete _0x1d0265[_0xa46a('0x4c')]['id'];}return db['DeskField'][_0xa46a('0x49')]({'where':{'id':_0x1d0265[_0xa46a('0x48')]['id']}})[_0xa46a('0x27')](handleEntityNotFound(_0x2ba18a,null))[_0xa46a('0x27')](saveUpdates(_0x1d0265[_0xa46a('0x4c')],null))['then'](respondWithResult(_0x2ba18a,null))[_0xa46a('0x46')](handleError(_0x2ba18a,null));};exports[_0xa46a('0x26')]=function(_0x2688b8,_0x831130){return db[_0xa46a('0x2c')][_0xa46a('0x49')]({'where':{'id':_0x2688b8[_0xa46a('0x48')]['id']}})[_0xa46a('0x27')](handleEntityNotFound(_0x831130,null))[_0xa46a('0x27')](removeEntity(_0x831130,null))[_0xa46a('0x46')](handleError(_0x831130,null));}; \ No newline at end of file +var _0x0fcd=['merge','VIRTUAL','filter','options','DeskField','includeAll','findAll','catch','params','include','find','create','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','undefined','count','offset','set','Content-Range','json','apply','save','update','then','destroy','end','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','filters','where'];(function(_0x14fc6d,_0x279394){var _0x581145=function(_0x173124){while(--_0x173124){_0x14fc6d['push'](_0x14fc6d['shift']());}};_0x581145(++_0x279394);}(_0x0fcd,0x129));var _0xd0fc=function(_0x1deb1f,_0x20d0ce){_0x1deb1f=_0x1deb1f-0x0;var _0x2d8027=_0x0fcd[_0x1deb1f];return _0x2d8027;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd0fc('0x0'));var zipdir=require(_0xd0fc('0x1'));var jsonpatch=require(_0xd0fc('0x2'));var rp=require(_0xd0fc('0x3'));var moment=require(_0xd0fc('0x4'));var BPromise=require(_0xd0fc('0x5'));var Mustache=require('mustache');var util=require(_0xd0fc('0x6'));var path=require(_0xd0fc('0x7'));var sox=require(_0xd0fc('0x8'));var csv=require(_0xd0fc('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd0fc('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xd0fc('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xd0fc('0xc'));var toCsv=require(_0xd0fc('0x9'));var querystring=require(_0xd0fc('0xd'));var Papa=require('papaparse');var Redis=require(_0xd0fc('0xe'));var authService=require(_0xd0fc('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd0fc('0x10'));var logger=require(_0xd0fc('0x11'))(_0xd0fc('0x12'));var utils=require('../../config/utils');var config=require(_0xd0fc('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xd0fc('0x14'))['db'];function respondWithStatusCode(_0xe6df1f,_0x478b90){_0x478b90=_0x478b90||0xcc;return function(_0x2ccc68){if(_0x2ccc68){return _0xe6df1f[_0xd0fc('0x15')](_0x478b90);}return _0xe6df1f[_0xd0fc('0x16')](_0x478b90)['end']();};}function respondWithResult(_0x2f5405,_0x3f2e1f){_0x3f2e1f=_0x3f2e1f||0xc8;return function(_0x34492c){if(_0x34492c){return _0x2f5405['status'](_0x3f2e1f)['json'](_0x34492c);}};}function respondWithFilteredResult(_0x3f7fde,_0xd4f6a1){return function(_0x4304b0){if(_0x4304b0){var _0x4f7fe1=typeof _0xd4f6a1['offset']==='undefined'&&typeof _0xd4f6a1['limit']===_0xd0fc('0x17');var _0x4ced92=_0x4304b0[_0xd0fc('0x18')];var _0x5703f1=_0x4f7fe1?0x0:_0xd4f6a1[_0xd0fc('0x19')];var _0x20849d=_0x4f7fe1?_0x4304b0[_0xd0fc('0x18')]:_0xd4f6a1['offset']+_0xd4f6a1['limit'];var _0x53ac93;if(_0x20849d>=_0x4ced92){_0x20849d=_0x4ced92;_0x53ac93=0xc8;}else{_0x53ac93=0xce;}_0x3f7fde['status'](_0x53ac93);return _0x3f7fde[_0xd0fc('0x1a')](_0xd0fc('0x1b'),_0x5703f1+'-'+_0x20849d+'/'+_0x4ced92)[_0xd0fc('0x1c')](_0x4304b0);}return null;};}function patchUpdates(_0xb5c2fc){return function(_0x43d092){try{jsonpatch[_0xd0fc('0x1d')](_0x43d092,_0xb5c2fc,!![]);}catch(_0x10e8bd){return BPromise['reject'](_0x10e8bd);}return _0x43d092[_0xd0fc('0x1e')]();};}function saveUpdates(_0x25eb91,_0x4e914c){return function(_0x57d302){if(_0x57d302){return _0x57d302[_0xd0fc('0x1f')](_0x25eb91)[_0xd0fc('0x20')](function(_0x3b5491){return _0x3b5491;});}return null;};}function removeEntity(_0x2633f0,_0x1cdb25){return function(_0x3c24ae){if(_0x3c24ae){return _0x3c24ae[_0xd0fc('0x21')]()[_0xd0fc('0x20')](function(){_0x2633f0[_0xd0fc('0x16')](0xcc)[_0xd0fc('0x22')]();});}};}function handleEntityNotFound(_0x57d598,_0x305e0f){return function(_0x380635){if(!_0x380635){_0x57d598[_0xd0fc('0x15')](0x194);}return _0x380635;};}function handleError(_0x1af5a7,_0x3ebaad){_0x3ebaad=_0x3ebaad||0x1f4;return function(_0x94cbd){logger[_0xd0fc('0x23')](_0x94cbd[_0xd0fc('0x24')]);if(_0x94cbd[_0xd0fc('0x25')]){delete _0x94cbd[_0xd0fc('0x25')];}_0x1af5a7[_0xd0fc('0x16')](_0x3ebaad)[_0xd0fc('0x26')](_0x94cbd);};}exports[_0xd0fc('0x27')]=function(_0x739792,_0x2fcd27){var _0x758d5d={},_0x131fdc={},_0x31f367={'count':0x0,'rows':[]};var _0x1806f1=_[_0xd0fc('0x28')](db['DeskField'][_0xd0fc('0x29')],function(_0x22e91b){return{'name':_0x22e91b[_0xd0fc('0x2a')],'type':_0x22e91b[_0xd0fc('0x2b')][_0xd0fc('0x2c')]};});_0x131fdc[_0xd0fc('0x2d')]=_[_0xd0fc('0x28')](_0x1806f1,'name');_0x131fdc[_0xd0fc('0x2e')]=_[_0xd0fc('0x2f')](_0x739792['query']);_0x131fdc['filters']=_[_0xd0fc('0x30')](_0x131fdc[_0xd0fc('0x2d')],_0x131fdc[_0xd0fc('0x2e')]);_0x758d5d[_0xd0fc('0x31')]=_[_0xd0fc('0x30')](_0x131fdc['model'],qs[_0xd0fc('0x32')](_0x739792[_0xd0fc('0x2e')][_0xd0fc('0x32')]));_0x758d5d[_0xd0fc('0x31')]=_0x758d5d[_0xd0fc('0x31')][_0xd0fc('0x33')]?_0x758d5d[_0xd0fc('0x31')]:_0x131fdc[_0xd0fc('0x2d')];if(!_0x739792['query'][_0xd0fc('0x34')]('nolimit')){_0x758d5d['limit']=qs['limit'](_0x739792['query'][_0xd0fc('0x35')]);_0x758d5d[_0xd0fc('0x19')]=qs[_0xd0fc('0x19')](_0x739792[_0xd0fc('0x2e')][_0xd0fc('0x19')]);}_0x758d5d[_0xd0fc('0x36')]=qs[_0xd0fc('0x37')](_0x739792[_0xd0fc('0x2e')][_0xd0fc('0x37')]);_0x758d5d['where']=qs[_0xd0fc('0x38')](_['pick'](_0x739792['query'],_0x131fdc[_0xd0fc('0x38')]),_0x1806f1);if(_0x739792[_0xd0fc('0x2e')]['filter']){_0x758d5d[_0xd0fc('0x39')]=_[_0xd0fc('0x3a')](_0x758d5d[_0xd0fc('0x39')],{'$or':_[_0xd0fc('0x28')](_0x1806f1,function(_0x2d3834){if(_0x2d3834[_0xd0fc('0x2b')]!==_0xd0fc('0x3b')){var _0x3baa50={};_0x3baa50[_0x2d3834[_0xd0fc('0x25')]]={'$like':'%'+_0x739792[_0xd0fc('0x2e')][_0xd0fc('0x3c')]+'%'};return _0x3baa50;}})});}_0x758d5d=_[_0xd0fc('0x3a')]({},_0x758d5d,_0x739792[_0xd0fc('0x3d')]);var _0x22296d={'where':_0x758d5d['where']};return db[_0xd0fc('0x3e')][_0xd0fc('0x18')](_0x22296d)[_0xd0fc('0x20')](function(_0x2938f7){_0x31f367['count']=_0x2938f7;if(_0x739792[_0xd0fc('0x2e')][_0xd0fc('0x3f')]){_0x758d5d['include']=[{'all':!![]}];}return db[_0xd0fc('0x3e')][_0xd0fc('0x40')](_0x758d5d);})[_0xd0fc('0x20')](function(_0x3beb02){_0x31f367['rows']=_0x3beb02;return _0x31f367;})[_0xd0fc('0x20')](respondWithFilteredResult(_0x2fcd27,_0x758d5d))[_0xd0fc('0x41')](handleError(_0x2fcd27,null));};exports['show']=function(_0x1f23a7,_0x544cc0){var _0x5db365={'raw':!![],'where':{'id':_0x1f23a7[_0xd0fc('0x42')]['id']}},_0xa4b6d6={};_0xa4b6d6[_0xd0fc('0x2d')]=_[_0xd0fc('0x2f')](db[_0xd0fc('0x3e')]['rawAttributes']);_0xa4b6d6[_0xd0fc('0x2e')]=_['keys'](_0x1f23a7['query']);_0xa4b6d6[_0xd0fc('0x38')]=_[_0xd0fc('0x30')](_0xa4b6d6[_0xd0fc('0x2d')],_0xa4b6d6['query']);_0x5db365[_0xd0fc('0x31')]=_[_0xd0fc('0x30')](_0xa4b6d6[_0xd0fc('0x2d')],qs['fields'](_0x1f23a7['query'][_0xd0fc('0x32')]));_0x5db365[_0xd0fc('0x31')]=_0x5db365[_0xd0fc('0x31')]['length']?_0x5db365[_0xd0fc('0x31')]:_0xa4b6d6[_0xd0fc('0x2d')];if(_0x1f23a7[_0xd0fc('0x2e')][_0xd0fc('0x3f')]){_0x5db365[_0xd0fc('0x43')]=[{'all':!![]}];}_0x5db365=_['merge']({},_0x5db365,_0x1f23a7['options']);return db['DeskField'][_0xd0fc('0x44')](_0x5db365)[_0xd0fc('0x20')](handleEntityNotFound(_0x544cc0,null))[_0xd0fc('0x20')](respondWithResult(_0x544cc0,null))[_0xd0fc('0x41')](handleError(_0x544cc0,null));};exports[_0xd0fc('0x45')]=function(_0x50a2eb,_0x404a8a){return db['DeskField']['create'](_0x50a2eb[_0xd0fc('0x46')],{})[_0xd0fc('0x20')](respondWithResult(_0x404a8a,0xc9))['catch'](handleError(_0x404a8a,null));};exports[_0xd0fc('0x1f')]=function(_0x4fad30,_0x14564f){if(_0x4fad30[_0xd0fc('0x46')]['id']){delete _0x4fad30[_0xd0fc('0x46')]['id'];}return db[_0xd0fc('0x3e')][_0xd0fc('0x44')]({'where':{'id':_0x4fad30[_0xd0fc('0x42')]['id']}})['then'](handleEntityNotFound(_0x14564f,null))[_0xd0fc('0x20')](saveUpdates(_0x4fad30[_0xd0fc('0x46')],null))[_0xd0fc('0x20')](respondWithResult(_0x14564f,null))[_0xd0fc('0x41')](handleError(_0x14564f,null));};exports[_0xd0fc('0x21')]=function(_0x5c8cc8,_0x5852b0){return db[_0xd0fc('0x3e')][_0xd0fc('0x44')]({'where':{'id':_0x5c8cc8[_0xd0fc('0x42')]['id']}})[_0xd0fc('0x20')](handleEntityNotFound(_0x5852b0,null))[_0xd0fc('0x20')](removeEntity(_0x5852b0,null))[_0xd0fc('0x41')](handleError(_0x5852b0,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index 7447ae2..6da7ff3 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 _0x17d6=['desk_unique_index','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intDeskField.attributes','define','DeskField','int_desk_fields'];(function(_0x3f3f0b,_0x22049b){var _0x18da3b=function(_0x1a30f1){while(--_0x1a30f1){_0x3f3f0b['push'](_0x3f3f0b['shift']());}};_0x18da3b(++_0x22049b);}(_0x17d6,0xa7));var _0x617d=function(_0x4dd9c7,_0xf227){_0x4dd9c7=_0x4dd9c7-0x0;var _0x27d23f=_0x17d6[_0x4dd9c7];return _0x27d23f;};'use strict';var _=require(_0x617d('0x0'));var util=require(_0x617d('0x1'));var logger=require(_0x617d('0x2'))(_0x617d('0x3'));var moment=require(_0x617d('0x4'));var BPromise=require(_0x617d('0x5'));var rp=require(_0x617d('0x6'));var fs=require('fs');var path=require(_0x617d('0x7'));var rimraf=require(_0x617d('0x8'));var config=require('../../config/environment');var attributes=require(_0x617d('0x9'));module['exports']=function(_0x4a5e5a,_0x5acc01){return _0x4a5e5a[_0x617d('0xa')](_0x617d('0xb'),attributes,{'tableName':_0x617d('0xc'),'paranoid':![],'indexes':[{'name':_0x617d('0xd'),'fields':['idField',_0x617d('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf270=['./intDeskField.attributes','exports','define','DeskField','int_desk_fields','desk_unique_index','FieldId','lodash','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x3cb967,_0x1e43fd){var _0xa3ebc=function(_0x2fe047){while(--_0x2fe047){_0x3cb967['push'](_0x3cb967['shift']());}};_0xa3ebc(++_0x1e43fd);}(_0xf270,0x93));var _0x0f27=function(_0xdaab62,_0x2728ab){_0xdaab62=_0xdaab62-0x0;var _0x13d767=_0xf270[_0xdaab62];return _0x13d767;};'use strict';var _=require(_0x0f27('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x0f27('0x1'));var moment=require('moment');var BPromise=require(_0x0f27('0x2'));var rp=require(_0x0f27('0x3'));var fs=require('fs');var path=require(_0x0f27('0x4'));var rimraf=require(_0x0f27('0x5'));var config=require(_0x0f27('0x6'));var attributes=require(_0x0f27('0x7'));module[_0x0f27('0x8')]=function(_0x535735,_0x48796e){return _0x535735[_0x0f27('0x9')](_0x0f27('0xa'),attributes,{'tableName':_0x0f27('0xb'),'paranoid':![],'indexes':[{'name':_0x0f27('0xc'),'fields':['idField',_0x0f27('0xd')],'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 9a3d4ef..0bc742d 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 _0x7aad=['request','then','DeskField,\x20%s,\x20%s','request\x20sent','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','client','http'];(function(_0x396466,_0xe9857b){var _0x5e9ab4=function(_0x362f66){while(--_0x362f66){_0x396466['push'](_0x396466['shift']());}};_0x5e9ab4(++_0xe9857b);}(_0x7aad,0x197));var _0xd7aa=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0x7aad[_0x4bfac3];return _0x15f0f2;};'use strict';var _=require(_0xd7aa('0x0'));var util=require(_0xd7aa('0x1'));var moment=require(_0xd7aa('0x2'));var BPromise=require(_0xd7aa('0x3'));var rs=require(_0xd7aa('0x4'));var fs=require('fs');var Redis=require(_0xd7aa('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xd7aa('0x6'));var logger=require(_0xd7aa('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xd7aa('0x8'));var client=jayson[_0xd7aa('0x9')][_0xd7aa('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1a2ccd,_0x326ce9,_0x3b0734){return new BPromise(function(_0x4429de,_0x15c58f){return client[_0xd7aa('0xb')](_0x1a2ccd,_0x3b0734)[_0xd7aa('0xc')](function(_0x579195){logger['info'](_0xd7aa('0xd'),_0x326ce9,_0xd7aa('0xe'));logger['debug'](_0xd7aa('0xf'),_0x326ce9,_0xd7aa('0xe'),JSON[_0xd7aa('0x10')](_0x579195));if(_0x579195[_0xd7aa('0x11')]){if(_0x579195[_0xd7aa('0x11')][_0xd7aa('0x12')]===0x1f4){logger[_0xd7aa('0x11')](_0xd7aa('0xd'),_0x326ce9,_0x579195[_0xd7aa('0x11')][_0xd7aa('0x13')]);return _0x15c58f(_0x579195[_0xd7aa('0x11')][_0xd7aa('0x13')]);}logger[_0xd7aa('0x11')]('DeskField,\x20%s,\x20%s',_0x326ce9,_0x579195[_0xd7aa('0x11')][_0xd7aa('0x13')]);return _0x4429de(_0x579195[_0xd7aa('0x11')][_0xd7aa('0x13')]);}else{logger['info'](_0xd7aa('0xd'),_0x326ce9,_0xd7aa('0xe'));_0x4429de(_0x579195[_0xd7aa('0x14')]['message']);}})[_0xd7aa('0x15')](function(_0xd36c0d){logger[_0xd7aa('0x11')](_0xd7aa('0xd'),_0x326ce9,_0xd36c0d);_0x15c58f(_0xd36c0d);});});} \ No newline at end of file +var _0x4e8f=['DeskField,\x20%s,\x20%s,\x20%s','error','code','message','lodash','util','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','DeskField,\x20%s,\x20%s','request\x20sent','debug'];(function(_0xf7200b,_0x50f7a2){var _0x546a2a=function(_0xe7bfc0){while(--_0xe7bfc0){_0xf7200b['push'](_0xf7200b['shift']());}};_0x546a2a(++_0x50f7a2);}(_0x4e8f,0x134));var _0xf4e8=function(_0x17dd51,_0x352e2a){_0x17dd51=_0x17dd51-0x0;var _0x455363=_0x4e8f[_0x17dd51];return _0x455363;};'use strict';var _=require(_0xf4e8('0x0'));var util=require(_0xf4e8('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xf4e8('0x2'));var fs=require('fs');var Redis=require(_0xf4e8('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xf4e8('0x4'))(_0xf4e8('0x5'));var config=require(_0xf4e8('0x6'));var jayson=require(_0xf4e8('0x7'));var client=jayson[_0xf4e8('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x314016,_0xea3767,_0x1dbca4){return new BPromise(function(_0x5759f8,_0x7e1daf){return client[_0xf4e8('0x9')](_0x314016,_0x1dbca4)[_0xf4e8('0xa')](function(_0x57dce7){logger[_0xf4e8('0xb')](_0xf4e8('0xc'),_0xea3767,_0xf4e8('0xd'));logger[_0xf4e8('0xe')](_0xf4e8('0xf'),_0xea3767,'request\x20sent',JSON['stringify'](_0x57dce7));if(_0x57dce7[_0xf4e8('0x10')]){if(_0x57dce7[_0xf4e8('0x10')][_0xf4e8('0x11')]===0x1f4){logger['error']('DeskField,\x20%s,\x20%s',_0xea3767,_0x57dce7[_0xf4e8('0x10')]['message']);return _0x7e1daf(_0x57dce7[_0xf4e8('0x10')][_0xf4e8('0x12')]);}logger[_0xf4e8('0x10')](_0xf4e8('0xc'),_0xea3767,_0x57dce7[_0xf4e8('0x10')][_0xf4e8('0x12')]);return _0x5759f8(_0x57dce7['error'][_0xf4e8('0x12')]);}else{logger[_0xf4e8('0xb')](_0xf4e8('0xc'),_0xea3767,_0xf4e8('0xd'));_0x5759f8(_0x57dce7['result']['message']);}})['catch'](function(_0x4b744e){logger[_0xf4e8('0x10')](_0xf4e8('0xc'),_0xea3767,_0x4b744e);_0x7e1daf(_0x4b744e);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index 7033bcd..c41187f 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 _0x4be2=['destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/interaction/service','./intDynamics365Account.controller','get','isAuthenticated','index','show','/:id/configurations','/:id/fields','getFields','post','addConfiguration','put','/:id','update','delete'];(function(_0x23b001,_0x236139){var _0x20d458=function(_0x323850){while(--_0x323850){_0x23b001['push'](_0x23b001['shift']());}};_0x20d458(++_0x236139);}(_0x4be2,0x14c));var _0x24be=function(_0x16fe4c,_0x2421e8){_0x16fe4c=_0x16fe4c-0x0;var _0x9999d=_0x4be2[_0x16fe4c];return _0x9999d;};'use strict';var multer=require(_0x24be('0x0'));var util=require(_0x24be('0x1'));var path=require('path');var timeout=require(_0x24be('0x2'));var express=require(_0x24be('0x3'));var router=express['Router']();var fs_extra=require(_0x24be('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x24be('0x5'));var config=require('../../config/environment');var controller=require(_0x24be('0x6'));router[_0x24be('0x7')]('/',auth[_0x24be('0x8')](),controller[_0x24be('0x9')]);router[_0x24be('0x7')]('/:id',auth[_0x24be('0x8')](),controller[_0x24be('0xa')]);router[_0x24be('0x7')](_0x24be('0xb'),auth['isAuthenticated'](),controller['getConfigurations']);router['get'](_0x24be('0xc'),auth['isAuthenticated'](),controller[_0x24be('0xd')]);router[_0x24be('0xe')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0x24be('0xb'),auth[_0x24be('0x8')](),controller[_0x24be('0xf')]);router[_0x24be('0x10')](_0x24be('0x11'),auth[_0x24be('0x8')](),controller[_0x24be('0x12')]);router[_0x24be('0x13')](_0x24be('0x11'),auth['isAuthenticated'](),controller[_0x24be('0x14')]);module[_0x24be('0x15')]=router; \ No newline at end of file +var _0x84b7=['get','isAuthenticated','index','/:id','/:id/configurations','getConfigurations','/:id/fields','getFields','create','post','addConfiguration','put','delete','destroy','exports','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller'];(function(_0x1b4ab2,_0x1db586){var _0x3d9a6e=function(_0x175f1a){while(--_0x175f1a){_0x1b4ab2['push'](_0x1b4ab2['shift']());}};_0x3d9a6e(++_0x1db586);}(_0x84b7,0x1c4));var _0x784b=function(_0x238671,_0x34aea0){_0x238671=_0x238671-0x0;var _0x474844=_0x84b7[_0x238671];return _0x474844;};'use strict';var multer=require('multer');var util=require(_0x784b('0x0'));var path=require('path');var timeout=require(_0x784b('0x1'));var express=require('express');var router=express[_0x784b('0x2')]();var fs_extra=require(_0x784b('0x3'));var auth=require(_0x784b('0x4'));var interaction=require(_0x784b('0x5'));var config=require(_0x784b('0x6'));var controller=require(_0x784b('0x7'));router[_0x784b('0x8')]('/',auth[_0x784b('0x9')](),controller[_0x784b('0xa')]);router[_0x784b('0x8')](_0x784b('0xb'),auth[_0x784b('0x9')](),controller['show']);router[_0x784b('0x8')](_0x784b('0xc'),auth[_0x784b('0x9')](),controller[_0x784b('0xd')]);router[_0x784b('0x8')](_0x784b('0xe'),auth[_0x784b('0x9')](),controller[_0x784b('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0x784b('0x10')]);router[_0x784b('0x11')](_0x784b('0xc'),auth[_0x784b('0x9')](),controller[_0x784b('0x12')]);router[_0x784b('0x13')](_0x784b('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x784b('0x14')](_0x784b('0xb'),auth[_0x784b('0x9')](),controller[_0x784b('0x15')]);module[_0x784b('0x16')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index 424689c..0bd5be7 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 _0x32f3=['exports','STRING'];(function(_0x55c948,_0x5cd6e4){var _0x7f7b5e=function(_0x1537df){while(--_0x1537df){_0x55c948['push'](_0x55c948['shift']());}};_0x7f7b5e(++_0x5cd6e4);}(_0x32f3,0xd4));var _0x332f=function(_0x11502a,_0x4f81b0){_0x11502a=_0x11502a-0x0;var _0x41d7e3=_0x32f3[_0x11502a];return _0x41d7e3;};'use strict';var Sequelize=require('sequelize');module[_0x332f('0x0')]={'name':{'type':Sequelize[_0x332f('0x1')]},'username':{'type':Sequelize[_0x332f('0x1')]},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x332f('0x1')]},'tenantId':{'type':Sequelize[_0x332f('0x1')]},'clientId':{'type':Sequelize[_0x332f('0x1')]},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x332f('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x332f('0x1')]}}; \ No newline at end of file +var _0xb591=['STRING','sequelize'];(function(_0x31bf96,_0x32f5ba){var _0x6e1a8c=function(_0x3168f8){while(--_0x3168f8){_0x31bf96['push'](_0x31bf96['shift']());}};_0x6e1a8c(++_0x32f5ba);}(_0xb591,0x151));var _0x1b59=function(_0x2827c4,_0x3c37e4){_0x2827c4=_0x2827c4-0x0;var _0xa1160b=_0xb591[_0x2827c4];return _0xa1160b;};'use strict';var Sequelize=require(_0x1b59('0x0'));module['exports']={'name':{'type':Sequelize[_0x1b59('0x1')]},'username':{'type':Sequelize[_0x1b59('0x1')]},'password':{'type':Sequelize[_0x1b59('0x1')]},'remoteUri':{'type':Sequelize[_0x1b59('0x1')]},'tenantId':{'type':Sequelize[_0x1b59('0x1')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0x1b59('0x1')]},'serverUrl':{'type':Sequelize[_0x1b59('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x1b59('0x1')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index 22be096..82e9b6f 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 _0x85e5=['status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','stack','name','send','map','Dynamics365Account','rawAttributes','fieldName','type','query','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','filters','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','params','keys','find','create','body','destroy','getConfigurations','findOne','pick','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','Dynamics365Configuration','Dynamics365Field','getFields','ticketType','incident','Incident','PhoneCall','title','description','ownerid','caseorigincode','phonenumber','regardingobjectid','directioncode','phonecall_activity_parties','accountidname','actualserviceunits','billedserviceunits','contactidname','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyname','createdbyyominame','createdon','createdonbehalfbyname','customeridyominame','entitlementidname','entityimage_timestamp','escalatedon','exchangerate','firstresponsebykpiidname','followupby','importsequencenumber','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','msdyn_iotalertname','numberofchildincidents','onholdtime','overriddencreatedon','owneridyominame','parentcaseidname','primarycontactidname','primarycontactidyominame','prioritycodename','productidname','resolvebykpiidname','responseby','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slainvokedidname','socialprofileidname','subjectidname','ticketnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','versionnumber','username','tenantId','slice','substring','POST','https://login.microsoftonline.com/','clientId','password','clientSecret','access_token','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','value','MetadataId','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Attributes','remove','LogicalName','forEach','@odata.type','lastIndexOf','PicklistAttributeMetadata','push','all','isNil','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','DecimalAttributeMetadata','concat','test','statusCode','Wrong\x20credentials',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Label','UserLocalizedLabel','Value',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','FalseOption','false','DisplayName','?$select=DisplayName,LogicalName','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','fs-extra','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','http','request','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x5a289d,_0x20a8d4){var _0x2cc6cf=function(_0x463612){while(--_0x463612){_0x5a289d['push'](_0x5a289d['shift']());}};_0x2cc6cf(++_0x20a8d4);}(_0x85e5,0x182));var _0x585e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x85e5[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0x585e('0x0'));var rimraf=require(_0x585e('0x1'));var zipdir=require(_0x585e('0x2'));var jsonpatch=require(_0x585e('0x3'));var rp=require(_0x585e('0x4'));var moment=require('moment');var BPromise=require(_0x585e('0x5'));var Mustache=require('mustache');var util=require(_0x585e('0x6'));var path=require(_0x585e('0x7'));var sox=require(_0x585e('0x8'));var csv=require(_0x585e('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x585e('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x585e('0xb'));var deskjs=require(_0x585e('0xc'));var toCsv=require(_0x585e('0x9'));var querystring=require(_0x585e('0xd'));var Papa=require(_0x585e('0xe'));var Redis=require(_0x585e('0xf'));var authService=require(_0x585e('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x585e('0x11'));var hardwareService=require(_0x585e('0x12'));var logger=require(_0x585e('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x585e('0x14'));var licenseUtil=require(_0x585e('0x15'));var db=require(_0x585e('0x16'))['db'];var integrations=require(_0x585e('0x17'));var jayson=require(_0x585e('0x18'));var client=jayson['client'][_0x585e('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x343f38,_0x4e0a17,_0x1e569e,_0x4cb454){return new BPromise(function(_0x15f386,_0x1e9b5e){var _0x23cf37=_0x4cb454||client;return _0x23cf37[_0x585e('0x1a')](_0x343f38,_0x1e569e)[_0x585e('0x1b')](function(_0x47df54){logger[_0x585e('0x1c')](_0x585e('0x1d'),_0x4e0a17,_0x585e('0x1e'));logger['debug'](_0x585e('0x1f'),_0x4e0a17,_0x585e('0x1e'),JSON[_0x585e('0x20')](_0x47df54));if(_0x47df54[_0x585e('0x21')]){if(_0x47df54[_0x585e('0x21')][_0x585e('0x22')]===0x1f4){logger[_0x585e('0x21')](_0x585e('0x1d'),_0x4e0a17,_0x47df54[_0x585e('0x21')][_0x585e('0x23')]);return _0x1e9b5e(_0x47df54[_0x585e('0x21')][_0x585e('0x23')]);}logger[_0x585e('0x21')](_0x585e('0x1d'),_0x4e0a17,_0x47df54['error'][_0x585e('0x23')]);return _0x15f386(_0x47df54[_0x585e('0x21')][_0x585e('0x23')]);}else{logger[_0x585e('0x1c')]('Dynamics365Account,\x20%s,\x20%s',_0x4e0a17,_0x585e('0x1e'));_0x15f386(_0x47df54['result']['message']);}})['catch'](function(_0xe3f9e){logger['error'](_0x585e('0x1d'),_0x4e0a17,_0xe3f9e);_0x1e9b5e(_0xe3f9e);});});}function respondWithStatusCode(_0xbd41e8,_0x2ab72e){_0x2ab72e=_0x2ab72e||0xcc;return function(_0x5e831d){if(_0x5e831d){return _0xbd41e8['sendStatus'](_0x2ab72e);}return _0xbd41e8[_0x585e('0x24')](_0x2ab72e)[_0x585e('0x25')]();};}function respondWithResult(_0x668424,_0x907197){_0x907197=_0x907197||0xc8;return function(_0x1383b9){if(_0x1383b9){return _0x668424['status'](_0x907197)[_0x585e('0x26')](_0x1383b9);}};}function respondWithFilteredResult(_0x3043c1,_0x57b976){return function(_0x4575af){if(_0x4575af){var _0x13962d=typeof _0x57b976[_0x585e('0x27')]===_0x585e('0x28')&&typeof _0x57b976[_0x585e('0x29')]===_0x585e('0x28');var _0x11ee51=_0x4575af[_0x585e('0x2a')];var _0x31b3c4=_0x13962d?0x0:_0x57b976[_0x585e('0x27')];var _0x223aa8=_0x13962d?_0x4575af[_0x585e('0x2a')]:_0x57b976[_0x585e('0x27')]+_0x57b976[_0x585e('0x29')];var _0x3e3eb5;if(_0x223aa8>=_0x11ee51){_0x223aa8=_0x11ee51;_0x3e3eb5=0xc8;}else{_0x3e3eb5=0xce;}_0x3043c1[_0x585e('0x24')](_0x3e3eb5);return _0x3043c1[_0x585e('0x2b')](_0x585e('0x2c'),_0x31b3c4+'-'+_0x223aa8+'/'+_0x11ee51)[_0x585e('0x26')](_0x4575af);}return null;};}function patchUpdates(_0x4302e6){return function(_0x307b71){try{jsonpatch['apply'](_0x307b71,_0x4302e6,!![]);}catch(_0xd5627a){return BPromise[_0x585e('0x2d')](_0xd5627a);}return _0x307b71[_0x585e('0x2e')]();};}function saveUpdates(_0x424e11,_0x54f499){return function(_0x32fa09){if(_0x32fa09){return _0x32fa09[_0x585e('0x2f')](_0x424e11)[_0x585e('0x1b')](function(_0x4c405c){return _0x4c405c;});}return null;};}function removeEntity(_0x3f868e,_0x322c37){return function(_0x30e917){if(_0x30e917){return _0x30e917['destroy']()[_0x585e('0x1b')](function(){_0x3f868e[_0x585e('0x24')](0xcc)[_0x585e('0x25')]();});}};}function handleEntityNotFound(_0x4159b9,_0x2b355d){return function(_0x48c56c){if(!_0x48c56c){_0x4159b9['sendStatus'](0x194);}return _0x48c56c;};}function handleError(_0x1985ec,_0x5f2d59){_0x5f2d59=_0x5f2d59||0x1f4;return function(_0x19ba5a){logger[_0x585e('0x21')](_0x19ba5a[_0x585e('0x30')]);if(_0x19ba5a[_0x585e('0x31')]){delete _0x19ba5a[_0x585e('0x31')];}_0x1985ec[_0x585e('0x24')](_0x5f2d59)[_0x585e('0x32')](_0x19ba5a);};}exports['index']=function(_0x5e2e52,_0x16102e){var _0x5a3872={},_0x405550={},_0x4ab44d={'count':0x0,'rows':[]};var _0x5dbd79=_[_0x585e('0x33')](db[_0x585e('0x34')][_0x585e('0x35')],function(_0x1e7403){return{'name':_0x1e7403[_0x585e('0x36')],'type':_0x1e7403[_0x585e('0x37')]['key']};});_0x405550['model']=_[_0x585e('0x33')](_0x5dbd79,'name');_0x405550[_0x585e('0x38')]=_['keys'](_0x5e2e52['query']);_0x405550['filters']=_[_0x585e('0x39')](_0x405550[_0x585e('0x3a')],_0x405550[_0x585e('0x38')]);_0x5a3872[_0x585e('0x3b')]=_[_0x585e('0x39')](_0x405550[_0x585e('0x3a')],qs[_0x585e('0x3c')](_0x5e2e52[_0x585e('0x38')]['fields']));_0x5a3872[_0x585e('0x3b')]=_0x5a3872[_0x585e('0x3b')][_0x585e('0x3d')]?_0x5a3872[_0x585e('0x3b')]:_0x405550['model'];if(!_0x5e2e52[_0x585e('0x38')][_0x585e('0x3e')]('nolimit')){_0x5a3872[_0x585e('0x29')]=qs['limit'](_0x5e2e52[_0x585e('0x38')]['limit']);_0x5a3872['offset']=qs[_0x585e('0x27')](_0x5e2e52[_0x585e('0x38')]['offset']);}_0x5a3872[_0x585e('0x3f')]=qs[_0x585e('0x40')](_0x5e2e52[_0x585e('0x38')][_0x585e('0x40')]);_0x5a3872[_0x585e('0x41')]=qs['filters'](_['pick'](_0x5e2e52['query'],_0x405550[_0x585e('0x42')]),_0x5dbd79);if(_0x5e2e52[_0x585e('0x38')]['filter']){_0x5a3872['where']=_[_0x585e('0x43')](_0x5a3872[_0x585e('0x41')],{'$or':_[_0x585e('0x33')](_0x5dbd79,function(_0xabe3f7){if(_0xabe3f7[_0x585e('0x37')]!==_0x585e('0x44')){var _0x427613={};_0x427613[_0xabe3f7['name']]={'$like':'%'+_0x5e2e52[_0x585e('0x38')][_0x585e('0x45')]+'%'};return _0x427613;}})});}_0x5a3872=_[_0x585e('0x43')]({},_0x5a3872,_0x5e2e52[_0x585e('0x46')]);var _0x1ced2c={'where':_0x5a3872[_0x585e('0x41')]};return db[_0x585e('0x34')][_0x585e('0x2a')](_0x1ced2c)[_0x585e('0x1b')](function(_0x41a4f5){_0x4ab44d[_0x585e('0x2a')]=_0x41a4f5;if(_0x5e2e52['query'][_0x585e('0x47')]){_0x5a3872[_0x585e('0x48')]=[{'all':!![]}];}return db['Dynamics365Account'][_0x585e('0x49')](_0x5a3872);})[_0x585e('0x1b')](function(_0x5cef7c){_0x4ab44d[_0x585e('0x4a')]=_0x5cef7c;return _0x4ab44d;})['then'](respondWithFilteredResult(_0x16102e,_0x5a3872))[_0x585e('0x4b')](handleError(_0x16102e,null));};exports['show']=function(_0x3a7bb8,_0x3a5143){var _0x4cb550={'raw':![],'where':{'id':_0x3a7bb8[_0x585e('0x4c')]['id']}},_0xcdb1dd={};_0xcdb1dd[_0x585e('0x3a')]=_[_0x585e('0x4d')](db[_0x585e('0x34')][_0x585e('0x35')]);_0xcdb1dd[_0x585e('0x38')]=_[_0x585e('0x4d')](_0x3a7bb8[_0x585e('0x38')]);_0xcdb1dd['filters']=_['intersection'](_0xcdb1dd[_0x585e('0x3a')],_0xcdb1dd[_0x585e('0x38')]);_0x4cb550[_0x585e('0x3b')]=_[_0x585e('0x39')](_0xcdb1dd['model'],qs[_0x585e('0x3c')](_0x3a7bb8[_0x585e('0x38')][_0x585e('0x3c')]));_0x4cb550['attributes']=_0x4cb550[_0x585e('0x3b')][_0x585e('0x3d')]?_0x4cb550[_0x585e('0x3b')]:_0xcdb1dd['model'];if(_0x3a7bb8[_0x585e('0x38')]['includeAll']){_0x4cb550['include']=[{'all':!![]}];}_0x4cb550=_['merge']({},_0x4cb550,_0x3a7bb8[_0x585e('0x46')]);return db[_0x585e('0x34')][_0x585e('0x4e')](_0x4cb550)[_0x585e('0x1b')](handleEntityNotFound(_0x3a5143,null))[_0x585e('0x1b')](respondWithResult(_0x3a5143,null))[_0x585e('0x4b')](handleError(_0x3a5143,null));};exports[_0x585e('0x4f')]=function(_0x492502,_0x1a7695){return db[_0x585e('0x34')][_0x585e('0x4f')](_0x492502['body'],{})['then'](respondWithResult(_0x1a7695,0xc9))['catch'](handleError(_0x1a7695,null));};exports[_0x585e('0x2f')]=function(_0x3831c4,_0x2ba234){if(_0x3831c4[_0x585e('0x50')]['id']){delete _0x3831c4[_0x585e('0x50')]['id'];}return db[_0x585e('0x34')]['find']({'where':{'id':_0x3831c4[_0x585e('0x4c')]['id']}})[_0x585e('0x1b')](handleEntityNotFound(_0x2ba234,null))[_0x585e('0x1b')](saveUpdates(_0x3831c4[_0x585e('0x50')],null))['then'](respondWithResult(_0x2ba234,null))['catch'](handleError(_0x2ba234,null));};exports[_0x585e('0x51')]=function(_0x3bd7bf,_0x3c477d){return db[_0x585e('0x34')]['find']({'where':{'id':_0x3bd7bf['params']['id']}})[_0x585e('0x1b')](handleEntityNotFound(_0x3c477d,null))[_0x585e('0x1b')](removeEntity(_0x3c477d,null))[_0x585e('0x4b')](handleError(_0x3c477d,null));};exports[_0x585e('0x52')]=function(_0x511f85,_0x4154e4,_0x37d21c){var _0x41a319={};var _0x397c4e={};var _0x573f2d;var _0x5b6ba4;return db['Dynamics365Account'][_0x585e('0x53')]({'where':{'id':_0x511f85['params']['id']}})['then'](handleEntityNotFound(_0x4154e4,null))[_0x585e('0x1b')](function(_0x5870d5){if(_0x5870d5){_0x573f2d=_0x5870d5;_0x397c4e[_0x585e('0x3a')]=_[_0x585e('0x4d')](db['Dynamics365Configuration'][_0x585e('0x35')]);_0x397c4e[_0x585e('0x38')]=_[_0x585e('0x4d')](_0x511f85['query']);_0x397c4e[_0x585e('0x42')]=_[_0x585e('0x39')](_0x397c4e[_0x585e('0x3a')],_0x397c4e[_0x585e('0x38')]);_0x41a319[_0x585e('0x3b')]=_[_0x585e('0x39')](_0x397c4e[_0x585e('0x3a')],qs['fields'](_0x511f85[_0x585e('0x38')][_0x585e('0x3c')]));_0x41a319[_0x585e('0x3b')]=_0x41a319[_0x585e('0x3b')][_0x585e('0x3d')]?_0x41a319['attributes']:_0x397c4e[_0x585e('0x3a')];_0x41a319['order']=qs[_0x585e('0x40')](_0x511f85[_0x585e('0x38')][_0x585e('0x40')]);_0x41a319[_0x585e('0x41')]=qs[_0x585e('0x42')](_[_0x585e('0x54')](_0x511f85[_0x585e('0x38')],_0x397c4e[_0x585e('0x42')]));if(_0x511f85[_0x585e('0x38')]['filter']){_0x41a319[_0x585e('0x41')]=_[_0x585e('0x43')](_0x41a319['where'],{'$or':_[_0x585e('0x33')](_0x41a319[_0x585e('0x3b')],function(_0x4e748a){var _0x26243e={};_0x26243e[_0x4e748a]={'$like':'%'+_0x511f85['query'][_0x585e('0x45')]+'%'};return _0x26243e;})});}_0x41a319=_[_0x585e('0x43')]({},_0x41a319,_0x511f85[_0x585e('0x46')]);return _0x573f2d[_0x585e('0x52')](_0x41a319);}})[_0x585e('0x1b')](function(_0x1a6ee1){if(_0x1a6ee1){_0x5b6ba4=_0x1a6ee1[_0x585e('0x3d')];if(!_0x511f85[_0x585e('0x38')][_0x585e('0x3e')]('nolimit')){_0x41a319[_0x585e('0x29')]=qs[_0x585e('0x29')](_0x511f85[_0x585e('0x38')][_0x585e('0x29')]);_0x41a319['offset']=qs[_0x585e('0x27')](_0x511f85[_0x585e('0x38')]['offset']);}return _0x573f2d[_0x585e('0x52')](_0x41a319);}})[_0x585e('0x1b')](function(_0x2bd7c6){if(_0x2bd7c6){return _0x2bd7c6?{'count':_0x5b6ba4,'rows':_0x2bd7c6}:null;}})[_0x585e('0x1b')](respondWithResult(_0x4154e4,null))[_0x585e('0x4b')](handleError(_0x4154e4,null));};exports[_0x585e('0x55')]=function(_0x4651ef,_0x3709dc,_0x59f8f6){if(_0x4651ef[_0x585e('0x50')]['id']){delete _0x4651ef[_0x585e('0x50')]['id'];}return db[_0x585e('0x34')]['findOne']({'where':{'id':_0x4651ef['params']['id']}})[_0x585e('0x1b')](handleEntityNotFound(_0x3709dc,null))[_0x585e('0x1b')](function(_0x461138){if(_0x461138){_0x4651ef['body'][_0x585e('0x56')]=_0x461138['id'];_0x4651ef[_0x585e('0x50')][_0x585e('0x57')]=integrations[_0x585e('0x58')](_0x4651ef[_0x585e('0x50')][_0x585e('0x59')],_0x4651ef[_0x585e('0x50')][_0x585e('0x37')]);_0x4651ef[_0x585e('0x50')][_0x585e('0x5a')]=integrations['getDescriptions'](_0x4651ef[_0x585e('0x50')][_0x585e('0x59')],_0x4651ef[_0x585e('0x50')]['type']);return db[_0x585e('0x5b')]['create'](_0x4651ef[_0x585e('0x50')],{'include':[{'model':db['Dynamics365Field'],'as':_0x585e('0x57')},{'model':db[_0x585e('0x5c')],'as':_0x585e('0x5a')}]});}return null;})[_0x585e('0x1b')](respondWithResult(_0x3709dc,null))['catch'](handleError(_0x3709dc,null));};exports[_0x585e('0x5d')]=function(_0x1ad8e2,_0x4872e4,_0x4a6599){var _0x2db381=_0x1ad8e2[_0x585e('0x38')][_0x585e('0x5e')];var _0x455ecf=_0x2db381===_0x585e('0x5f')?_0x585e('0x60'):_0x585e('0x61');var _0x50331b='';var _0xb0807b='';var _0x113a65='';var _0x45062c='';var _0x194cfc='';var _0x19714a='';var _0xfb82e9='';var _0x3799b7='';var _0x4de2d7=[_0x585e('0x62'),_0x585e('0x63'),'customerid',_0x585e('0x64'),_0x585e('0x65'),'subject',_0x585e('0x66'),_0x585e('0x67'),_0x585e('0x68'),_0x585e('0x69')];var _0x3332f7=[_0x585e('0x6a'),'accountidyominame',_0x585e('0x6b'),_0x585e('0x6c'),_0x585e('0x6d'),'contactidyominame',_0x585e('0x6e'),_0x585e('0x6f'),_0x585e('0x70'),'createdbyexternalpartyyominame',_0x585e('0x71'),_0x585e('0x72'),_0x585e('0x73'),_0x585e('0x74'),'createdonbehalfbyyominame','customeridname','customeridtype',_0x585e('0x75'),'emailaddress',_0x585e('0x76'),_0x585e('0x77'),'entityimage_url',_0x585e('0x78'),_0x585e('0x79'),_0x585e('0x7a'),_0x585e('0x7b'),_0x585e('0x7c'),'influencescore',_0x585e('0x7d'),_0x585e('0x7e'),_0x585e('0x7f'),_0x585e('0x80'),_0x585e('0x81'),_0x585e('0x82'),_0x585e('0x83'),_0x585e('0x84'),_0x585e('0x85'),'modifiedonbehalfbyyominame','msdyn_incidenttypename',_0x585e('0x86'),_0x585e('0x87'),_0x585e('0x88'),_0x585e('0x89'),'owneridname','owneridtype',_0x585e('0x8a'),_0x585e('0x8b'),_0x585e('0x8c'),_0x585e('0x8d'),_0x585e('0x8e'),_0x585e('0x8f'),'productserialnumber','resolveby',_0x585e('0x90'),_0x585e('0x91'),_0x585e('0x92'),_0x585e('0x93'),_0x585e('0x94'),_0x585e('0x95'),'slaname',_0x585e('0x96'),'statecode','statuscode',_0x585e('0x97'),_0x585e('0x98'),'timezoneruleversionnumber',_0x585e('0x99'),_0x585e('0x9a'),_0x585e('0x9b'),_0x585e('0x9c')];var _0x43aa02=_0x4de2d7['concat'](_0x3332f7);return db[_0x585e('0x34')][_0x585e('0x53')]({'where':{'id':_0x1ad8e2[_0x585e('0x4c')]['id']},'attributes':['id',_0x585e('0x9d'),'password','remoteUri',_0x585e('0x9e'),'clientId','clientSecret']})[_0x585e('0x1b')](handleEntityNotFound(_0x4872e4,null))[_0x585e('0x1b')](function(_0x159f57){if(_0x159f57){_0x3799b7=_0x159f57['remoteUri'];var _0x39ca59=_0x3799b7[_0x585e('0x9f')](-0x1);if(_0x39ca59==='/'){_0x3799b7=_0x3799b7[_0x585e('0xa0')](0x0,_0x3799b7['lastIndexOf'](_0x39ca59));}_0xfb82e9=util['format']('%s/api/data/v9.0/',_0x3799b7);var _0x41b09e={'method':_0x585e('0xa1'),'uri':_0x585e('0xa2')+_0x159f57[_0x585e('0x9e')]+'/oauth2/token','form':{'client_id':_0x159f57[_0x585e('0xa3')],'resource':_0x3799b7,'username':_0x159f57[_0x585e('0x9d')],'password':_0x159f57[_0x585e('0xa4')],'grant_type':'password','client_secret':_0x159f57[_0x585e('0xa5')]},'json':!![]};return rp(_0x41b09e);}})['then'](function(_0xd94448){_0x19714a=_0xd94448[_0x585e('0xa6')];var _0x5c9e7e={'method':_0x585e('0xa7'),'uri':encodeURI(_0xfb82e9+_0x585e('0xa8')+_0x455ecf+'\x27'),'headers':{'Authorization':_0x585e('0xa9')+_0x19714a,'If-None-Match':null,'OData-Version':_0x585e('0xaa')},'json':!![]};return rp(_0x5c9e7e);})[_0x585e('0x1b')](function(_0x2f6505){var _0x211c8f=_0x2f6505[_0x585e('0xab')][0x0];var _0x39d53=_0x211c8f[_0x585e('0xac')];var _0x56905a={'method':'GET','uri':_0xfb82e9+_0x585e('0xad')+_0x39d53+_0x585e('0xae'),'headers':{'Authorization':_0x585e('0xa9')+_0x19714a,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x56905a);})[_0x585e('0x1b')](function(_0x593bc0){_0x50331b=_0x593bc0;_0xb0807b=_0x50331b[_0x585e('0xaf')];_0xb0807b=_[_0x585e('0xb0')](_0xb0807b,function(_0xfdfd1a){return!_0x43aa02['includes'](_0xfdfd1a[_0x585e('0xb1')]);});var _0x745d22=[];var _0x4de164=[];_0xb0807b[_0x585e('0xb2')](function(_0x5697be){if(_0x5697be[_0x585e('0xb3')]){var _0x13ef2d=_0x5697be[_0x585e('0xb3')][_0x585e('0xa0')](_0x5697be[_0x585e('0xb3')][_0x585e('0xb4')]('.')+0x1);if(_0x13ef2d===_0x585e('0xb5')){_0x745d22[_0x585e('0xb6')](getSelectList(_0xfb82e9,_0x2db381,_0x4de164,_0x50331b['MetadataId'],_0x5697be['MetadataId'],_0x19714a));}}});return Promise[_0x585e('0xb7')](_0x745d22);})['then'](function(_0x5ec3dd){_0x113a65=_0x5ec3dd[0x0];var _0xa0867c=[];var _0x509da7=[];_0xb0807b[_0x585e('0xb2')](function(_0x8f422a){if(!_[_0x585e('0xb8')](_0x8f422a[_0x585e('0xb3')])){var _0xa77d1e=_0x8f422a[_0x585e('0xb3')]['substring'](_0x8f422a[_0x585e('0xb3')][_0x585e('0xb4')]('.')+0x1);if(_0xa77d1e==='BooleanAttributeMetadata'){_0xa0867c['push'](getBooleanList(_0xfb82e9,_0x2db381,_0x509da7,_0x50331b[_0x585e('0xac')],_0x8f422a['MetadataId'],_0x19714a));}}});return Promise[_0x585e('0xb7')](_0xa0867c);})[_0x585e('0x1b')](function(_0x245811){_0x45062c=_0x245811[0x0];var _0x5c606c=[];var _0x482fde=[];_0xb0807b['forEach'](function(_0x547c2e){if(_0x547c2e['@odata.type']){var _0xb20483=_0x547c2e[_0x585e('0xb3')]['substring'](_0x547c2e[_0x585e('0xb3')][_0x585e('0xb4')]('.')+0x1);if(_0xb20483===_0x585e('0xb9')||_0xb20483===_0x585e('0xba')||_0xb20483===_0x585e('0xbb')||_0xb20483===_0x585e('0xbc')||_0xb20483===_0x585e('0xbd')||_0xb20483===_0x585e('0xbe')||_0xb20483===_0x585e('0xbf')||_0xb20483===_0x585e('0xc0')||_0xb20483==='StateAttributeMetadata'||_0xb20483===_0x585e('0xc1')){_0x5c606c['push'](getInputList(_0xfb82e9,_0x2db381,_0xb20483,_0x482fde,_0x50331b['MetadataId'],_0x547c2e['MetadataId'],_0x19714a));}}});return Promise[_0x585e('0xb7')](_0x5c606c);})[_0x585e('0x1b')](function(_0x578f80){_0x194cfc=_0x578f80[0x0];var _0x45ae15=_0x113a65[_0x585e('0xc2')](_0x45062c)[_0x585e('0xc2')](_0x194cfc);var _0x512b94={'count':_0x45ae15[_0x585e('0x3d')],'rows':_0x45ae15};return _0x512b94;})['then'](respondWithResult(_0x4872e4,null))['catch'](function(_0x4fae4d){var _0x5f4aed=_0x1ad8e2['query'][_0x585e('0xc3')]?0x1f4:_0x4fae4d[_0x585e('0xc4')]||0x1f4;logger[_0x585e('0x21')](_0x4fae4d[_0x585e('0x30')]);delete _0x4fae4d[_0x585e('0x31')];if(_0x5f4aed===0x191){_0x5f4aed=0x190;}_0x4872e4[_0x585e('0x24')](_0x5f4aed)[_0x585e('0x32')](_0x1ad8e2['query'][_0x585e('0xc3')]?{'message':_0x585e('0xc5'),'statusCode':_0x4fae4d[_0x585e('0xc4')]}:_0x4fae4d);});};function getSelectList(_0x538863,_0x4e55f3,_0x43f239,_0x4819e6,_0x4c6e35,_0x5484a7){var _0x343eda={'method':_0x585e('0xa7'),'uri':_0x538863+_0x585e('0xad')+_0x4819e6+_0x585e('0xc6')+_0x4c6e35+_0x585e('0xc7')+_0x585e('0xc8'),'headers':{'Authorization':_0x585e('0xa9')+_0x5484a7,'If-None-Match':null,'OData-Version':_0x585e('0xaa')},'json':!![]};return rp(_0x343eda)[_0x585e('0x1b')](function(_0x53b337){var _0x140806=[];var _0x517ab1=_0x53b337[_0x585e('0xc9')]['Options'];_0x517ab1[_0x585e('0xb2')](function(_0x3c7912){_0x140806[_0x585e('0xb6')]({'name':_0x3c7912[_0x585e('0xca')][_0x585e('0xcb')][_0x585e('0xca')],'value':String(_0x3c7912[_0x585e('0xcc')])});});var _0xaf6b0={'id':_0x4e55f3+'_'+_0x53b337[_0x585e('0xb1')],'name':_0x53b337['DisplayName']['UserLocalizedLabel'][_0x585e('0xca')],'custom':![],'options':_0x140806};_0x43f239[_0x585e('0xb6')](_0xaf6b0);return _0x43f239;});}function getBooleanList(_0x245da5,_0x4aa92a,_0x1b30e6,_0x4d0b67,_0xdbb70e,_0x47f73c){var _0xaf38a4={'method':_0x585e('0xa7'),'uri':_0x245da5+_0x585e('0xad')+_0x4d0b67+_0x585e('0xc6')+_0xdbb70e+_0x585e('0xcd'),'headers':{'Authorization':'Bearer\x20'+_0x47f73c,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0xaf38a4)['then'](function(_0x2ec60d){var _0x25f74f=[];_0x25f74f[_0x585e('0xb6')]({'name':_0x2ec60d[_0x585e('0xc9')][_0x585e('0xce')][_0x585e('0xca')][_0x585e('0xcb')][_0x585e('0xca')],'value':'true'},{'name':_0x2ec60d[_0x585e('0xc9')][_0x585e('0xcf')]['Label'][_0x585e('0xcb')][_0x585e('0xca')],'value':_0x585e('0xd0')});var _0x8a9945={'id':_0x4aa92a+'_'+_0x2ec60d[_0x585e('0xb1')],'name':_0x2ec60d[_0x585e('0xd1')][_0x585e('0xcb')]['Label'],'custom':![],'options':_0x25f74f};_0x1b30e6['push'](_0x8a9945);return _0x1b30e6;});}function getInputList(_0x3c27d3,_0x508f52,_0x1f2ede,_0x376d0a,_0x39acb4,_0x789b2,_0x114607){var _0x524279={'method':'GET','uri':_0x3c27d3+_0x585e('0xad')+_0x39acb4+_0x585e('0xc6')+_0x789b2+')/Microsoft.Dynamics.CRM.'+_0x1f2ede+_0x585e('0xd2'),'headers':{'Authorization':_0x585e('0xa9')+_0x114607,'If-None-Match':null,'OData-Version':_0x585e('0xaa')},'json':!![]};return rp(_0x524279)[_0x585e('0x1b')](function(_0x15d2ae){var _0x12e690={'id':_0x508f52+'_'+_0x15d2ae[_0x585e('0xb1')],'name':_0x15d2ae[_0x585e('0xd1')]['UserLocalizedLabel']?_0x15d2ae[_0x585e('0xd1')][_0x585e('0xcb')][_0x585e('0xca')]:_0x15d2ae['LogicalName'],'custom':![],'options':[]};_0x376d0a[_0x585e('0xb6')](_0x12e690);return _0x376d0a;});} \ No newline at end of file +var _0x4030=['undefined','limit','count','Content-Range','json','apply','reject','save','update','destroy','name','send','index','map','Dynamics365Account','fieldName','type','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','show','params','rawAttributes','create','body','getConfigurations','findOne','Dynamics365Configuration','nolimit','addConfiguration','AccountId','Subjects','getDescriptions','channel','Dynamics365Field','Descriptions','getFields','ticketType','incident','Incident','PhoneCall','title','description','caseorigincode','subject','phonenumber','regardingobjectid','directioncode','phonecall_activity_parties','accountidyominame','actualserviceunits','billedserviceunits','contactidname','contactidyominame','contractidname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridtype','customeridyominame','entitlementidname','entityimage_timestamp','entityimage_url','escalatedon','exchangerate','firstresponsebykpiidname','importsequencenumber','influencescore','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','onholdtime','overriddencreatedon','owneridtype','owneridyominame','parentcaseidname','primarycontactidname','primarycontactidyominame','productidname','productserialnumber','resolveby','responseby','responsiblecontactidname','sentimentvalue','slainvokedidname','slaname','socialprofileidname','statecode','statuscode','ticketnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','versionnumber','username','password','tenantId','clientId','clientSecret','substring','lastIndexOf','format','%s/api/data/v9.0/','POST','https://login.microsoftonline.com/','/oauth2/token','access_token','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','value','MetadataId','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','4.0','Attributes','forEach','@odata.type','PicklistAttributeMetadata','push','all','BooleanAttributeMetadata','StringAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','concat','stack','test','statusCode',')/Attributes(','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','Label','UserLocalizedLabel','DisplayName','TrueOption','true','FalseOption','false','LogicalName',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','ejs','fs-extra','squel','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','request','then','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end','status','offset'];(function(_0x4bc78d,_0x314c50){var _0x43fd41=function(_0x5a7d25){while(--_0x5a7d25){_0x4bc78d['push'](_0x4bc78d['shift']());}};_0x43fd41(++_0x314c50);}(_0x4030,0x189));var _0x0403=function(_0x1d69e5,_0x2a29af){_0x1d69e5=_0x1d69e5-0x0;var _0x17da11=_0x4030[_0x1d69e5];return _0x17da11;};'use strict';var emlformat=require(_0x0403('0x0'));var rimraf=require(_0x0403('0x1'));var zipdir=require(_0x0403('0x2'));var jsonpatch=require(_0x0403('0x3'));var rp=require(_0x0403('0x4'));var moment=require('moment');var BPromise=require(_0x0403('0x5'));var Mustache=require('mustache');var util=require(_0x0403('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x0403('0x7'));var fs=require('fs');var fs_extra=require(_0x0403('0x8'));var _=require('lodash');var squel=require(_0x0403('0x9'));var crypto=require('crypto');var jsforce=require(_0x0403('0xa'));var deskjs=require(_0x0403('0xb'));var toCsv=require(_0x0403('0xc'));var querystring=require('querystring');var Papa=require(_0x0403('0xd'));var Redis=require(_0x0403('0xe'));var authService=require(_0x0403('0xf'));var qs=require(_0x0403('0x10'));var as=require(_0x0403('0x11'));var hardwareService=require(_0x0403('0x12'));var logger=require(_0x0403('0x13'))('api');var utils=require(_0x0403('0x14'));var config=require(_0x0403('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x0403('0x16'))['db'];var integrations=require(_0x0403('0x17'));var jayson=require(_0x0403('0x18'));var client=jayson[_0x0403('0x19')][_0x0403('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x4c687d,_0x5f05db,_0x48aea4,_0x481c6a){return new BPromise(function(_0xd32ea5,_0x498c3e){var _0xe22a2a=_0x481c6a||client;return _0xe22a2a[_0x0403('0x1b')](_0x4c687d,_0x48aea4)[_0x0403('0x1c')](function(_0x1b47c4){logger['info'](_0x0403('0x1d'),_0x5f05db,_0x0403('0x1e'));logger[_0x0403('0x1f')](_0x0403('0x20'),_0x5f05db,_0x0403('0x1e'),JSON[_0x0403('0x21')](_0x1b47c4));if(_0x1b47c4['error']){if(_0x1b47c4[_0x0403('0x22')][_0x0403('0x23')]===0x1f4){logger[_0x0403('0x22')]('Dynamics365Account,\x20%s,\x20%s',_0x5f05db,_0x1b47c4[_0x0403('0x22')][_0x0403('0x24')]);return _0x498c3e(_0x1b47c4['error'][_0x0403('0x24')]);}logger[_0x0403('0x22')](_0x0403('0x1d'),_0x5f05db,_0x1b47c4['error'][_0x0403('0x24')]);return _0xd32ea5(_0x1b47c4[_0x0403('0x22')][_0x0403('0x24')]);}else{logger['info'](_0x0403('0x1d'),_0x5f05db,_0x0403('0x1e'));_0xd32ea5(_0x1b47c4[_0x0403('0x25')][_0x0403('0x24')]);}})[_0x0403('0x26')](function(_0x31461c){logger[_0x0403('0x22')](_0x0403('0x1d'),_0x5f05db,_0x31461c);_0x498c3e(_0x31461c);});});}function respondWithStatusCode(_0x2de12d,_0x134b19){_0x134b19=_0x134b19||0xcc;return function(_0x3f56bf){if(_0x3f56bf){return _0x2de12d[_0x0403('0x27')](_0x134b19);}return _0x2de12d['status'](_0x134b19)[_0x0403('0x28')]();};}function respondWithResult(_0x50a1b0,_0x51e441){_0x51e441=_0x51e441||0xc8;return function(_0x17d01d){if(_0x17d01d){return _0x50a1b0[_0x0403('0x29')](_0x51e441)['json'](_0x17d01d);}};}function respondWithFilteredResult(_0x454309,_0x596562){return function(_0x52bd21){if(_0x52bd21){var _0x39754a=typeof _0x596562[_0x0403('0x2a')]===_0x0403('0x2b')&&typeof _0x596562[_0x0403('0x2c')]==='undefined';var _0x4f7d75=_0x52bd21[_0x0403('0x2d')];var _0xfadb26=_0x39754a?0x0:_0x596562[_0x0403('0x2a')];var _0x3f40b3=_0x39754a?_0x52bd21[_0x0403('0x2d')]:_0x596562[_0x0403('0x2a')]+_0x596562['limit'];var _0x33c623;if(_0x3f40b3>=_0x4f7d75){_0x3f40b3=_0x4f7d75;_0x33c623=0xc8;}else{_0x33c623=0xce;}_0x454309[_0x0403('0x29')](_0x33c623);return _0x454309['set'](_0x0403('0x2e'),_0xfadb26+'-'+_0x3f40b3+'/'+_0x4f7d75)[_0x0403('0x2f')](_0x52bd21);}return null;};}function patchUpdates(_0x44c4fb){return function(_0x339407){try{jsonpatch[_0x0403('0x30')](_0x339407,_0x44c4fb,!![]);}catch(_0x2178a8){return BPromise[_0x0403('0x31')](_0x2178a8);}return _0x339407[_0x0403('0x32')]();};}function saveUpdates(_0xeffba4,_0x1016ce){return function(_0x88af51){if(_0x88af51){return _0x88af51[_0x0403('0x33')](_0xeffba4)['then'](function(_0x50566b){return _0x50566b;});}return null;};}function removeEntity(_0x4aa32b,_0x4da1fc){return function(_0x16c040){if(_0x16c040){return _0x16c040[_0x0403('0x34')]()[_0x0403('0x1c')](function(){_0x4aa32b[_0x0403('0x29')](0xcc)[_0x0403('0x28')]();});}};}function handleEntityNotFound(_0x4b2ac9,_0xe17f81){return function(_0x284f08){if(!_0x284f08){_0x4b2ac9[_0x0403('0x27')](0x194);}return _0x284f08;};}function handleError(_0x3ace26,_0x12d14a){_0x12d14a=_0x12d14a||0x1f4;return function(_0x2ee577){logger[_0x0403('0x22')](_0x2ee577['stack']);if(_0x2ee577[_0x0403('0x35')]){delete _0x2ee577[_0x0403('0x35')];}_0x3ace26[_0x0403('0x29')](_0x12d14a)[_0x0403('0x36')](_0x2ee577);};}exports[_0x0403('0x37')]=function(_0x3af8d6,_0xa672eb){var _0x3d904f={},_0x393f6f={},_0x3f1b74={'count':0x0,'rows':[]};var _0x5aa02f=_[_0x0403('0x38')](db[_0x0403('0x39')]['rawAttributes'],function(_0x1008e8){return{'name':_0x1008e8[_0x0403('0x3a')],'type':_0x1008e8[_0x0403('0x3b')]['key']};});_0x393f6f['model']=_['map'](_0x5aa02f,_0x0403('0x35'));_0x393f6f[_0x0403('0x3c')]=_[_0x0403('0x3d')](_0x3af8d6['query']);_0x393f6f['filters']=_[_0x0403('0x3e')](_0x393f6f[_0x0403('0x3f')],_0x393f6f[_0x0403('0x3c')]);_0x3d904f[_0x0403('0x40')]=_[_0x0403('0x3e')](_0x393f6f[_0x0403('0x3f')],qs[_0x0403('0x41')](_0x3af8d6['query'][_0x0403('0x41')]));_0x3d904f['attributes']=_0x3d904f[_0x0403('0x40')][_0x0403('0x42')]?_0x3d904f['attributes']:_0x393f6f[_0x0403('0x3f')];if(!_0x3af8d6[_0x0403('0x3c')][_0x0403('0x43')]('nolimit')){_0x3d904f[_0x0403('0x2c')]=qs['limit'](_0x3af8d6['query']['limit']);_0x3d904f[_0x0403('0x2a')]=qs[_0x0403('0x2a')](_0x3af8d6[_0x0403('0x3c')][_0x0403('0x2a')]);}_0x3d904f[_0x0403('0x44')]=qs[_0x0403('0x45')](_0x3af8d6[_0x0403('0x3c')][_0x0403('0x45')]);_0x3d904f[_0x0403('0x46')]=qs[_0x0403('0x47')](_[_0x0403('0x48')](_0x3af8d6[_0x0403('0x3c')],_0x393f6f[_0x0403('0x47')]),_0x5aa02f);if(_0x3af8d6['query'][_0x0403('0x49')]){_0x3d904f[_0x0403('0x46')]=_[_0x0403('0x4a')](_0x3d904f['where'],{'$or':_[_0x0403('0x38')](_0x5aa02f,function(_0x85389f){if(_0x85389f[_0x0403('0x3b')]!==_0x0403('0x4b')){var _0x49d92d={};_0x49d92d[_0x85389f['name']]={'$like':'%'+_0x3af8d6[_0x0403('0x3c')][_0x0403('0x49')]+'%'};return _0x49d92d;}})});}_0x3d904f=_[_0x0403('0x4a')]({},_0x3d904f,_0x3af8d6[_0x0403('0x4c')]);var _0x3aa988={'where':_0x3d904f['where']};return db['Dynamics365Account']['count'](_0x3aa988)[_0x0403('0x1c')](function(_0x53baa5){_0x3f1b74[_0x0403('0x2d')]=_0x53baa5;if(_0x3af8d6[_0x0403('0x3c')][_0x0403('0x4d')]){_0x3d904f[_0x0403('0x4e')]=[{'all':!![]}];}return db[_0x0403('0x39')]['findAll'](_0x3d904f);})[_0x0403('0x1c')](function(_0x5080d0){_0x3f1b74[_0x0403('0x4f')]=_0x5080d0;return _0x3f1b74;})[_0x0403('0x1c')](respondWithFilteredResult(_0xa672eb,_0x3d904f))['catch'](handleError(_0xa672eb,null));};exports[_0x0403('0x50')]=function(_0x2f795a,_0x20cf16){var _0x40f4ea={'raw':![],'where':{'id':_0x2f795a[_0x0403('0x51')]['id']}},_0x53aa5d={};_0x53aa5d['model']=_[_0x0403('0x3d')](db[_0x0403('0x39')][_0x0403('0x52')]);_0x53aa5d[_0x0403('0x3c')]=_[_0x0403('0x3d')](_0x2f795a[_0x0403('0x3c')]);_0x53aa5d[_0x0403('0x47')]=_[_0x0403('0x3e')](_0x53aa5d[_0x0403('0x3f')],_0x53aa5d[_0x0403('0x3c')]);_0x40f4ea[_0x0403('0x40')]=_[_0x0403('0x3e')](_0x53aa5d[_0x0403('0x3f')],qs['fields'](_0x2f795a[_0x0403('0x3c')][_0x0403('0x41')]));_0x40f4ea[_0x0403('0x40')]=_0x40f4ea[_0x0403('0x40')][_0x0403('0x42')]?_0x40f4ea[_0x0403('0x40')]:_0x53aa5d[_0x0403('0x3f')];if(_0x2f795a[_0x0403('0x3c')][_0x0403('0x4d')]){_0x40f4ea['include']=[{'all':!![]}];}_0x40f4ea=_[_0x0403('0x4a')]({},_0x40f4ea,_0x2f795a['options']);return db[_0x0403('0x39')]['find'](_0x40f4ea)[_0x0403('0x1c')](handleEntityNotFound(_0x20cf16,null))[_0x0403('0x1c')](respondWithResult(_0x20cf16,null))[_0x0403('0x26')](handleError(_0x20cf16,null));};exports[_0x0403('0x53')]=function(_0x1b47e1,_0x5b9aa4){return db[_0x0403('0x39')][_0x0403('0x53')](_0x1b47e1['body'],{})[_0x0403('0x1c')](respondWithResult(_0x5b9aa4,0xc9))[_0x0403('0x26')](handleError(_0x5b9aa4,null));};exports[_0x0403('0x33')]=function(_0xa3c881,_0x2b2021){if(_0xa3c881['body']['id']){delete _0xa3c881[_0x0403('0x54')]['id'];}return db[_0x0403('0x39')]['find']({'where':{'id':_0xa3c881[_0x0403('0x51')]['id']}})[_0x0403('0x1c')](handleEntityNotFound(_0x2b2021,null))[_0x0403('0x1c')](saveUpdates(_0xa3c881[_0x0403('0x54')],null))['then'](respondWithResult(_0x2b2021,null))['catch'](handleError(_0x2b2021,null));};exports[_0x0403('0x34')]=function(_0x43dccf,_0x4befa4){return db[_0x0403('0x39')]['find']({'where':{'id':_0x43dccf[_0x0403('0x51')]['id']}})[_0x0403('0x1c')](handleEntityNotFound(_0x4befa4,null))[_0x0403('0x1c')](removeEntity(_0x4befa4,null))['catch'](handleError(_0x4befa4,null));};exports[_0x0403('0x55')]=function(_0x2c1541,_0x5a0456,_0x427a33){var _0x1540bd={};var _0x3d8734={};var _0x36f54f;var _0x5aa6a4;return db['Dynamics365Account'][_0x0403('0x56')]({'where':{'id':_0x2c1541[_0x0403('0x51')]['id']}})['then'](handleEntityNotFound(_0x5a0456,null))[_0x0403('0x1c')](function(_0x43c2ef){if(_0x43c2ef){_0x36f54f=_0x43c2ef;_0x3d8734['model']=_[_0x0403('0x3d')](db[_0x0403('0x57')][_0x0403('0x52')]);_0x3d8734[_0x0403('0x3c')]=_[_0x0403('0x3d')](_0x2c1541[_0x0403('0x3c')]);_0x3d8734[_0x0403('0x47')]=_['intersection'](_0x3d8734[_0x0403('0x3f')],_0x3d8734['query']);_0x1540bd[_0x0403('0x40')]=_[_0x0403('0x3e')](_0x3d8734[_0x0403('0x3f')],qs[_0x0403('0x41')](_0x2c1541[_0x0403('0x3c')][_0x0403('0x41')]));_0x1540bd[_0x0403('0x40')]=_0x1540bd[_0x0403('0x40')]['length']?_0x1540bd[_0x0403('0x40')]:_0x3d8734[_0x0403('0x3f')];_0x1540bd[_0x0403('0x44')]=qs[_0x0403('0x45')](_0x2c1541['query'][_0x0403('0x45')]);_0x1540bd[_0x0403('0x46')]=qs['filters'](_[_0x0403('0x48')](_0x2c1541[_0x0403('0x3c')],_0x3d8734[_0x0403('0x47')]));if(_0x2c1541[_0x0403('0x3c')][_0x0403('0x49')]){_0x1540bd[_0x0403('0x46')]=_[_0x0403('0x4a')](_0x1540bd[_0x0403('0x46')],{'$or':_[_0x0403('0x38')](_0x1540bd[_0x0403('0x40')],function(_0x32a1cd){var _0x5cc751={};_0x5cc751[_0x32a1cd]={'$like':'%'+_0x2c1541[_0x0403('0x3c')][_0x0403('0x49')]+'%'};return _0x5cc751;})});}_0x1540bd=_[_0x0403('0x4a')]({},_0x1540bd,_0x2c1541[_0x0403('0x4c')]);return _0x36f54f[_0x0403('0x55')](_0x1540bd);}})[_0x0403('0x1c')](function(_0x5de544){if(_0x5de544){_0x5aa6a4=_0x5de544['length'];if(!_0x2c1541['query'][_0x0403('0x43')](_0x0403('0x58'))){_0x1540bd[_0x0403('0x2c')]=qs[_0x0403('0x2c')](_0x2c1541[_0x0403('0x3c')][_0x0403('0x2c')]);_0x1540bd[_0x0403('0x2a')]=qs[_0x0403('0x2a')](_0x2c1541['query']['offset']);}return _0x36f54f[_0x0403('0x55')](_0x1540bd);}})[_0x0403('0x1c')](function(_0x2607ea){if(_0x2607ea){return _0x2607ea?{'count':_0x5aa6a4,'rows':_0x2607ea}:null;}})[_0x0403('0x1c')](respondWithResult(_0x5a0456,null))[_0x0403('0x26')](handleError(_0x5a0456,null));};exports[_0x0403('0x59')]=function(_0x54b1a4,_0x135a6b,_0x4367ac){if(_0x54b1a4['body']['id']){delete _0x54b1a4[_0x0403('0x54')]['id'];}return db[_0x0403('0x39')]['findOne']({'where':{'id':_0x54b1a4[_0x0403('0x51')]['id']}})[_0x0403('0x1c')](handleEntityNotFound(_0x135a6b,null))[_0x0403('0x1c')](function(_0x31d27a){if(_0x31d27a){_0x54b1a4['body'][_0x0403('0x5a')]=_0x31d27a['id'];_0x54b1a4['body'][_0x0403('0x5b')]=integrations['getSubjects'](_0x54b1a4[_0x0403('0x54')]['channel'],_0x54b1a4[_0x0403('0x54')]['type']);_0x54b1a4[_0x0403('0x54')]['Descriptions']=integrations[_0x0403('0x5c')](_0x54b1a4[_0x0403('0x54')][_0x0403('0x5d')],_0x54b1a4[_0x0403('0x54')][_0x0403('0x3b')]);return db[_0x0403('0x57')][_0x0403('0x53')](_0x54b1a4['body'],{'include':[{'model':db[_0x0403('0x5e')],'as':_0x0403('0x5b')},{'model':db[_0x0403('0x5e')],'as':_0x0403('0x5f')}]});}return null;})[_0x0403('0x1c')](respondWithResult(_0x135a6b,null))[_0x0403('0x26')](handleError(_0x135a6b,null));};exports[_0x0403('0x60')]=function(_0x272a6d,_0x1ebd6b,_0x34f9d1){var _0x7fc9aa=_0x272a6d[_0x0403('0x3c')][_0x0403('0x61')];var _0x15a8e5=_0x7fc9aa===_0x0403('0x62')?_0x0403('0x63'):_0x0403('0x64');var _0x4d8765='';var _0x1f2ce3='';var _0xa4f991='';var _0x3c8ca1='';var _0x11a6e7='';var _0x227c3f='';var _0x497fc1='';var _0x4fa492='';var _0x1495c2=[_0x0403('0x65'),_0x0403('0x66'),'customerid','ownerid',_0x0403('0x67'),_0x0403('0x68'),_0x0403('0x69'),_0x0403('0x6a'),_0x0403('0x6b'),_0x0403('0x6c')];var _0x58f211=['accountidname',_0x0403('0x6d'),_0x0403('0x6e'),_0x0403('0x6f'),_0x0403('0x70'),_0x0403('0x71'),'contractdetailidname',_0x0403('0x72'),'createdbyexternalpartyname',_0x0403('0x73'),_0x0403('0x74'),_0x0403('0x75'),_0x0403('0x76'),_0x0403('0x77'),_0x0403('0x78'),'customeridname',_0x0403('0x79'),_0x0403('0x7a'),'emailaddress',_0x0403('0x7b'),_0x0403('0x7c'),_0x0403('0x7d'),_0x0403('0x7e'),_0x0403('0x7f'),_0x0403('0x80'),'followupby',_0x0403('0x81'),_0x0403('0x82'),_0x0403('0x83'),_0x0403('0x84'),_0x0403('0x85'),_0x0403('0x86'),_0x0403('0x87'),_0x0403('0x88'),_0x0403('0x89'),_0x0403('0x8a'),_0x0403('0x8b'),'modifiedonbehalfbyyominame',_0x0403('0x8c'),_0x0403('0x8d'),_0x0403('0x8e'),_0x0403('0x8f'),_0x0403('0x90'),'owneridname',_0x0403('0x91'),_0x0403('0x92'),_0x0403('0x93'),_0x0403('0x94'),_0x0403('0x95'),'prioritycodename',_0x0403('0x96'),_0x0403('0x97'),_0x0403('0x98'),'resolvebykpiidname',_0x0403('0x99'),_0x0403('0x9a'),'responsiblecontactidyominame',_0x0403('0x9b'),_0x0403('0x9c'),_0x0403('0x9d'),_0x0403('0x9e'),_0x0403('0x9f'),_0x0403('0xa0'),'subjectidname',_0x0403('0xa1'),'timezoneruleversionnumber',_0x0403('0xa2'),_0x0403('0xa3'),_0x0403('0xa4'),_0x0403('0xa5')];var _0x3bdab2=_0x1495c2['concat'](_0x58f211);return db[_0x0403('0x39')][_0x0403('0x56')]({'where':{'id':_0x272a6d[_0x0403('0x51')]['id']},'attributes':['id',_0x0403('0xa6'),_0x0403('0xa7'),'remoteUri',_0x0403('0xa8'),_0x0403('0xa9'),_0x0403('0xaa')]})[_0x0403('0x1c')](handleEntityNotFound(_0x1ebd6b,null))[_0x0403('0x1c')](function(_0x586094){if(_0x586094){_0x4fa492=_0x586094['remoteUri'];var _0x443162=_0x4fa492['slice'](-0x1);if(_0x443162==='/'){_0x4fa492=_0x4fa492[_0x0403('0xab')](0x0,_0x4fa492[_0x0403('0xac')](_0x443162));}_0x497fc1=util[_0x0403('0xad')](_0x0403('0xae'),_0x4fa492);var _0x58864f={'method':_0x0403('0xaf'),'uri':_0x0403('0xb0')+_0x586094[_0x0403('0xa8')]+_0x0403('0xb1'),'form':{'client_id':_0x586094[_0x0403('0xa9')],'resource':_0x4fa492,'username':_0x586094[_0x0403('0xa6')],'password':_0x586094['password'],'grant_type':_0x0403('0xa7'),'client_secret':_0x586094[_0x0403('0xaa')]},'json':!![]};return rp(_0x58864f);}})['then'](function(_0x536f2e){_0x227c3f=_0x536f2e[_0x0403('0xb2')];var _0x3324f6={'method':_0x0403('0xb3'),'uri':encodeURI(_0x497fc1+_0x0403('0xb4')+_0x15a8e5+'\x27'),'headers':{'Authorization':_0x0403('0xb5')+_0x227c3f,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x3324f6);})[_0x0403('0x1c')](function(_0x53397c){var _0x16c352=_0x53397c[_0x0403('0xb6')][0x0];var _0x4b609d=_0x16c352[_0x0403('0xb7')];var _0x27f1b7={'method':'GET','uri':_0x497fc1+_0x0403('0xb8')+_0x4b609d+_0x0403('0xb9'),'headers':{'Authorization':'Bearer\x20'+_0x227c3f,'If-None-Match':null,'OData-Version':_0x0403('0xba')},'json':!![]};return rp(_0x27f1b7);})[_0x0403('0x1c')](function(_0x3c7151){_0x4d8765=_0x3c7151;_0x1f2ce3=_0x4d8765[_0x0403('0xbb')];_0x1f2ce3=_['remove'](_0x1f2ce3,function(_0xf4978){return!_0x3bdab2['includes'](_0xf4978['LogicalName']);});var _0x2a6de7=[];var _0x10f254=[];_0x1f2ce3[_0x0403('0xbc')](function(_0x179030){if(_0x179030['@odata.type']){var _0x385225=_0x179030[_0x0403('0xbd')]['substring'](_0x179030['@odata.type']['lastIndexOf']('.')+0x1);if(_0x385225===_0x0403('0xbe')){_0x2a6de7[_0x0403('0xbf')](getSelectList(_0x497fc1,_0x7fc9aa,_0x10f254,_0x4d8765['MetadataId'],_0x179030[_0x0403('0xb7')],_0x227c3f));}}});return Promise[_0x0403('0xc0')](_0x2a6de7);})[_0x0403('0x1c')](function(_0x1f6e93){_0xa4f991=_0x1f6e93[0x0];var _0x1f8a35=[];var _0xfbfee2=[];_0x1f2ce3[_0x0403('0xbc')](function(_0x394eea){if(!_['isNil'](_0x394eea['@odata.type'])){var _0x2cf40d=_0x394eea[_0x0403('0xbd')][_0x0403('0xab')](_0x394eea['@odata.type'][_0x0403('0xac')]('.')+0x1);if(_0x2cf40d===_0x0403('0xc1')){_0x1f8a35[_0x0403('0xbf')](getBooleanList(_0x497fc1,_0x7fc9aa,_0xfbfee2,_0x4d8765[_0x0403('0xb7')],_0x394eea['MetadataId'],_0x227c3f));}}});return Promise[_0x0403('0xc0')](_0x1f8a35);})['then'](function(_0x47271e){_0x3c8ca1=_0x47271e[0x0];var _0x5155a8=[];var _0x10187a=[];_0x1f2ce3[_0x0403('0xbc')](function(_0x5b83a8){if(_0x5b83a8[_0x0403('0xbd')]){var _0x7bd95e=_0x5b83a8[_0x0403('0xbd')][_0x0403('0xab')](_0x5b83a8[_0x0403('0xbd')][_0x0403('0xac')]('.')+0x1);if(_0x7bd95e===_0x0403('0xc2')||_0x7bd95e==='DoubleAttributeMetadata'||_0x7bd95e==='BigIntAttributeMetadata'||_0x7bd95e===_0x0403('0xc3')||_0x7bd95e===_0x0403('0xc4')||_0x7bd95e==='DateTimeAttributeMetadata'||_0x7bd95e===_0x0403('0xc5')||_0x7bd95e===_0x0403('0xc6')||_0x7bd95e===_0x0403('0xc7')||_0x7bd95e==='DecimalAttributeMetadata'){_0x5155a8[_0x0403('0xbf')](getInputList(_0x497fc1,_0x7fc9aa,_0x7bd95e,_0x10187a,_0x4d8765['MetadataId'],_0x5b83a8['MetadataId'],_0x227c3f));}}});return Promise['all'](_0x5155a8);})[_0x0403('0x1c')](function(_0x3f7bb1){_0x11a6e7=_0x3f7bb1[0x0];var _0x250b12=_0xa4f991[_0x0403('0xc8')](_0x3c8ca1)['concat'](_0x11a6e7);var _0x1bd872={'count':_0x250b12[_0x0403('0x42')],'rows':_0x250b12};return _0x1bd872;})['then'](respondWithResult(_0x1ebd6b,null))[_0x0403('0x26')](function(_0xf9b56b){var _0x48aa84=_0x272a6d[_0x0403('0x3c')]['test']?0x1f4:_0xf9b56b['statusCode']||0x1f4;logger[_0x0403('0x22')](_0xf9b56b[_0x0403('0xc9')]);delete _0xf9b56b[_0x0403('0x35')];if(_0x48aa84===0x191){_0x48aa84=0x190;}_0x1ebd6b[_0x0403('0x29')](_0x48aa84)[_0x0403('0x36')](_0x272a6d[_0x0403('0x3c')][_0x0403('0xca')]?{'message':'Wrong\x20credentials','statusCode':_0xf9b56b[_0x0403('0xcb')]}:_0xf9b56b);});};function getSelectList(_0x1f068b,_0x3f0497,_0x1eee81,_0x3f34a4,_0xe7b758,_0x35a2c2){var _0x321005={'method':_0x0403('0xb3'),'uri':_0x1f068b+_0x0403('0xb8')+_0x3f34a4+_0x0403('0xcc')+_0xe7b758+')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?'+_0x0403('0xcd'),'headers':{'Authorization':_0x0403('0xb5')+_0x35a2c2,'If-None-Match':null,'OData-Version':_0x0403('0xba')},'json':!![]};return rp(_0x321005)['then'](function(_0x5bdf50){var _0x4542d3=[];var _0x539abf=_0x5bdf50[_0x0403('0xce')][_0x0403('0xcf')];_0x539abf[_0x0403('0xbc')](function(_0x1d65d2){_0x4542d3[_0x0403('0xbf')]({'name':_0x1d65d2[_0x0403('0xd0')][_0x0403('0xd1')][_0x0403('0xd0')],'value':String(_0x1d65d2['Value'])});});var _0x32c04f={'id':_0x3f0497+'_'+_0x5bdf50['LogicalName'],'name':_0x5bdf50[_0x0403('0xd2')]['UserLocalizedLabel'][_0x0403('0xd0')],'custom':![],'options':_0x4542d3};_0x1eee81[_0x0403('0xbf')](_0x32c04f);return _0x1eee81;});}function getBooleanList(_0x30adbd,_0x24390a,_0x46ee86,_0x1cc4e3,_0x13f556,_0xd8cbbf){var _0x37d8c5={'method':_0x0403('0xb3'),'uri':_0x30adbd+_0x0403('0xb8')+_0x1cc4e3+')/Attributes('+_0x13f556+')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','headers':{'Authorization':'Bearer\x20'+_0xd8cbbf,'If-None-Match':null,'OData-Version':_0x0403('0xba')},'json':!![]};return rp(_0x37d8c5)['then'](function(_0x4d181c){var _0x1831ba=[];_0x1831ba[_0x0403('0xbf')]({'name':_0x4d181c[_0x0403('0xce')][_0x0403('0xd3')]['Label'][_0x0403('0xd1')][_0x0403('0xd0')],'value':_0x0403('0xd4')},{'name':_0x4d181c['OptionSet'][_0x0403('0xd5')][_0x0403('0xd0')][_0x0403('0xd1')][_0x0403('0xd0')],'value':_0x0403('0xd6')});var _0x529f7a={'id':_0x24390a+'_'+_0x4d181c[_0x0403('0xd7')],'name':_0x4d181c[_0x0403('0xd2')][_0x0403('0xd1')][_0x0403('0xd0')],'custom':![],'options':_0x1831ba};_0x46ee86[_0x0403('0xbf')](_0x529f7a);return _0x46ee86;});}function getInputList(_0x36a35c,_0x3fd78c,_0x158adb,_0x14dc28,_0x330448,_0x218644,_0x452ef7){var _0x23f62d={'method':_0x0403('0xb3'),'uri':_0x36a35c+_0x0403('0xb8')+_0x330448+_0x0403('0xcc')+_0x218644+_0x0403('0xd8')+_0x158adb+_0x0403('0xd9'),'headers':{'Authorization':_0x0403('0xb5')+_0x452ef7,'If-None-Match':null,'OData-Version':_0x0403('0xba')},'json':!![]};return rp(_0x23f62d)[_0x0403('0x1c')](function(_0x4faf39){var _0x572980={'id':_0x3fd78c+'_'+_0x4faf39[_0x0403('0xd7')],'name':_0x4faf39[_0x0403('0xd2')][_0x0403('0xd1')]?_0x4faf39[_0x0403('0xd2')][_0x0403('0xd1')]['Label']:_0x4faf39['LogicalName'],'custom':![],'options':[]};_0x14dc28['push'](_0x572980);return _0x14dc28;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index e5f38b4..71d3a30 100644 --- a/server/api/intDynamics365Account/intDynamics365Account.model.js +++ b/server/api/intDynamics365Account/intDynamics365Account.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb7e7=['int_dynamics365_accounts','lodash','../../config/logger','moment','request-promise','rimraf','../../config/environment','./intDynamics365Account.attributes','define'];(function(_0x2aecac,_0x2fa831){var _0x369b50=function(_0x57c92e){while(--_0x57c92e){_0x2aecac['push'](_0x2aecac['shift']());}};_0x369b50(++_0x2fa831);}(_0xb7e7,0x121));var _0x7b7e=function(_0x1b5aea,_0x3f04b7){_0x1b5aea=_0x1b5aea-0x0;var _0x15cfc6=_0xb7e7[_0x1b5aea];return _0x15cfc6;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var logger=require(_0x7b7e('0x1'))('api');var moment=require(_0x7b7e('0x2'));var BPromise=require('bluebird');var rp=require(_0x7b7e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7b7e('0x4'));var config=require(_0x7b7e('0x5'));var attributes=require(_0x7b7e('0x6'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x333fa4,_0x372bde){return _0x333fa4[_0x7b7e('0x7')]('Dynamics365Account',attributes,{'tableName':_0x7b7e('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbaf0=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','define','Dynamics365Account','util'];(function(_0x2b4bc4,_0x34dae6){var _0x634ed7=function(_0x293ed3){while(--_0x293ed3){_0x2b4bc4['push'](_0x2b4bc4['shift']());}};_0x634ed7(++_0x34dae6);}(_0xbaf0,0x12a));var _0x0baf=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xbaf0[_0x5b644e];return _0x49c6bf;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var logger=require(_0x0baf('0x1'))(_0x0baf('0x2'));var moment=require(_0x0baf('0x3'));var BPromise=require(_0x0baf('0x4'));var rp=require(_0x0baf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var attributes=require(_0x0baf('0x8'));var integrations=require(_0x0baf('0x9'));module[_0x0baf('0xa')]=function(_0x335e24,_0x1a10b1){return _0x335e24[_0x0baf('0xb')](_0x0baf('0xc'),attributes,{'tableName':'int_dynamics365_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.rpc.js b/server/api/intDynamics365Account/intDynamics365Account.rpc.js index 93b9a53..bcbab1e 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 _0xc24b=['where','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','Dynamics365Account','options','raw','limit','include','model','attributes','map','GetDynamics365Account','stringify','ShowDynamics365Account','find'];(function(_0x2c753c,_0x3378e7){var _0x23ba20=function(_0xac82d){while(--_0xac82d){_0x2c753c['push'](_0x2c753c['shift']());}};_0x23ba20(++_0x3378e7);}(_0xc24b,0x14e));var _0xbc24=function(_0xc0638b,_0x2fccf4){_0xc0638b=_0xc0638b-0x0;var _0xd57dfa=_0xc24b[_0xc0638b];return _0xd57dfa;};'use strict';var _=require('lodash');var util=require(_0xbc24('0x0'));var moment=require(_0xbc24('0x1'));var BPromise=require(_0xbc24('0x2'));var rs=require(_0xbc24('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbc24('0x4'))['db'];var utils=require(_0xbc24('0x5'));var logger=require(_0xbc24('0x6'))(_0xbc24('0x7'));var config=require(_0xbc24('0x8'));var jayson=require(_0xbc24('0x9'));var client=jayson[_0xbc24('0xa')][_0xbc24('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x32e436,_0x458a8e,_0x218e60){return new BPromise(function(_0x15a04e,_0xdca307){return client[_0xbc24('0xc')](_0x32e436,_0x218e60)[_0xbc24('0xd')](function(_0x5e140a){logger[_0xbc24('0xe')](_0xbc24('0xf'),_0x458a8e,_0xbc24('0x10'));logger[_0xbc24('0x11')](_0xbc24('0x12'),_0x458a8e,'request\x20sent',JSON['stringify'](_0x5e140a));if(_0x5e140a['error']){if(_0x5e140a[_0xbc24('0x13')][_0xbc24('0x14')]===0x1f4){logger[_0xbc24('0x13')](_0xbc24('0xf'),_0x458a8e,_0x5e140a[_0xbc24('0x13')][_0xbc24('0x15')]);return _0xdca307(_0x5e140a[_0xbc24('0x13')]['message']);}logger['error']('Dynamics365Account,\x20%s,\x20%s',_0x458a8e,_0x5e140a['error'][_0xbc24('0x15')]);return _0x15a04e(_0x5e140a['error'][_0xbc24('0x15')]);}else{logger[_0xbc24('0xe')](_0xbc24('0xf'),_0x458a8e,_0xbc24('0x10'));_0x15a04e(_0x5e140a[_0xbc24('0x16')][_0xbc24('0x15')]);}})[_0xbc24('0x17')](function(_0x360ed4){logger[_0xbc24('0x13')](_0xbc24('0xf'),_0x458a8e,_0x360ed4);_0xdca307(_0x360ed4);});});}exports['GetDynamics365Account']=function(_0x2cb007){var _0x2432cd=this;return new Promise(function(_0x3b219b,_0x2150f5){return db[_0xbc24('0x18')]['findAll']({'raw':_0x2cb007[_0xbc24('0x19')]?_0x2cb007[_0xbc24('0x19')][_0xbc24('0x1a')]===undefined?!![]:![]:!![],'where':_0x2cb007[_0xbc24('0x19')]?_0x2cb007[_0xbc24('0x19')]['where']||null:null,'attributes':_0x2cb007[_0xbc24('0x19')]?_0x2cb007[_0xbc24('0x19')]['attributes']||null:null,'limit':_0x2cb007[_0xbc24('0x19')]?_0x2cb007['options'][_0xbc24('0x1b')]||null:null,'include':_0x2cb007['options']?_0x2cb007[_0xbc24('0x19')][_0xbc24('0x1c')]?_['map'](_0x2cb007['options'][_0xbc24('0x1c')],function(_0x382f3c){return{'model':db[_0x382f3c[_0xbc24('0x1d')]],'as':_0x382f3c['as'],'attributes':_0x382f3c[_0xbc24('0x1e')],'include':_0x382f3c[_0xbc24('0x1c')]?_[_0xbc24('0x1f')](_0x382f3c[_0xbc24('0x1c')],function(_0x3d7d4e){return{'model':db[_0x3d7d4e[_0xbc24('0x1d')]],'as':_0x3d7d4e['as'],'attributes':_0x3d7d4e[_0xbc24('0x1e')],'include':_0x3d7d4e[_0xbc24('0x1c')]?_['map'](_0x3d7d4e[_0xbc24('0x1c')],function(_0x44320f){return{'model':db[_0x44320f[_0xbc24('0x1d')]],'as':_0x44320f['as'],'attributes':_0x44320f[_0xbc24('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4d6f40){logger[_0xbc24('0xe')](_0xbc24('0x20'),_0x2cb007);logger[_0xbc24('0x11')](_0xbc24('0x20'),_0x2cb007,JSON[_0xbc24('0x21')](_0x4d6f40));_0x3b219b(_0x4d6f40);})[_0xbc24('0x17')](function(_0x2066c1){logger[_0xbc24('0x13')](_0xbc24('0x20'),_0x2066c1['message'],_0x2cb007);_0x2150f5(_0x2432cd[_0xbc24('0x13')](0x1f4,_0x2066c1[_0xbc24('0x15')]));});});};exports[_0xbc24('0x22')]=function(_0x6e481e){var _0x2227ca=this;return new Promise(function(_0x37e089,_0x4333d3){return db['Dynamics365Account'][_0xbc24('0x23')]({'raw':_0x6e481e[_0xbc24('0x19')]?_0x6e481e[_0xbc24('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x6e481e[_0xbc24('0x19')]?_0x6e481e['options'][_0xbc24('0x24')]||null:null,'attributes':_0x6e481e[_0xbc24('0x19')]?_0x6e481e[_0xbc24('0x19')][_0xbc24('0x1e')]||null:null,'include':_0x6e481e[_0xbc24('0x19')]?_0x6e481e[_0xbc24('0x19')][_0xbc24('0x1c')]?_[_0xbc24('0x1f')](_0x6e481e['options'][_0xbc24('0x1c')],function(_0x9b1479){return{'model':db[_0x9b1479[_0xbc24('0x1d')]],'as':_0x9b1479['as'],'attributes':_0x9b1479[_0xbc24('0x1e')],'include':_0x9b1479[_0xbc24('0x1c')]?_[_0xbc24('0x1f')](_0x9b1479['include'],function(_0x126dca){return{'model':db[_0x126dca[_0xbc24('0x1d')]],'as':_0x126dca['as'],'attributes':_0x126dca['attributes'],'include':_0x126dca[_0xbc24('0x1c')]?_[_0xbc24('0x1f')](_0x126dca[_0xbc24('0x1c')],function(_0x38c237){return{'model':db[_0x38c237[_0xbc24('0x1d')]],'as':_0x38c237['as'],'attributes':_0x38c237['attributes']};}):[]};}):[]};}):[]:[]})[_0xbc24('0xd')](function(_0x3dbb0a){logger[_0xbc24('0xe')](_0xbc24('0x22'),_0x6e481e);logger[_0xbc24('0x11')](_0xbc24('0x22'),_0x6e481e,JSON[_0xbc24('0x21')](_0x3dbb0a));_0x37e089(_0x3dbb0a);})[_0xbc24('0x17')](function(_0xd40059){logger['error'](_0xbc24('0x22'),_0xd40059[_0xbc24('0x15')],_0x6e481e);_0x4333d3(_0x2227ca[_0xbc24('0x13')](0x1f4,_0xd40059[_0xbc24('0x15')]));});});}; \ No newline at end of file +var _0x7635=['debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetDynamics365Account','Dynamics365Account','findAll','options','raw','where','attributes','include','map','model','then','ShowDynamics365Account','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent'];(function(_0x243b2f,_0x30aa15){var _0xcb3c2d=function(_0x213bb2){while(--_0x213bb2){_0x243b2f['push'](_0x243b2f['shift']());}};_0xcb3c2d(++_0x30aa15);}(_0x7635,0x14d));var _0x5763=function(_0x3b3e67,_0x43fdc2){_0x3b3e67=_0x3b3e67-0x0;var _0x29d3b8=_0x7635[_0x3b3e67];return _0x29d3b8;};'use strict';var _=require(_0x5763('0x0'));var util=require(_0x5763('0x1'));var moment=require(_0x5763('0x2'));var BPromise=require(_0x5763('0x3'));var rs=require(_0x5763('0x4'));var fs=require('fs');var Redis=require(_0x5763('0x5'));var db=require(_0x5763('0x6'))['db'];var utils=require(_0x5763('0x7'));var logger=require(_0x5763('0x8'))(_0x5763('0x9'));var config=require(_0x5763('0xa'));var jayson=require(_0x5763('0xb'));var client=jayson[_0x5763('0xc')][_0x5763('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x18ad36,_0x28ba8b,_0x510011){return new BPromise(function(_0x487c83,_0x4bda2c){return client[_0x5763('0xe')](_0x18ad36,_0x510011)['then'](function(_0x4d63f8){logger[_0x5763('0xf')](_0x5763('0x10'),_0x28ba8b,_0x5763('0x11'));logger[_0x5763('0x12')](_0x5763('0x13'),_0x28ba8b,'request\x20sent',JSON[_0x5763('0x14')](_0x4d63f8));if(_0x4d63f8[_0x5763('0x15')]){if(_0x4d63f8['error'][_0x5763('0x16')]===0x1f4){logger[_0x5763('0x15')]('Dynamics365Account,\x20%s,\x20%s',_0x28ba8b,_0x4d63f8['error'][_0x5763('0x17')]);return _0x4bda2c(_0x4d63f8[_0x5763('0x15')]['message']);}logger[_0x5763('0x15')]('Dynamics365Account,\x20%s,\x20%s',_0x28ba8b,_0x4d63f8[_0x5763('0x15')]['message']);return _0x487c83(_0x4d63f8[_0x5763('0x15')][_0x5763('0x17')]);}else{logger[_0x5763('0xf')]('Dynamics365Account,\x20%s,\x20%s',_0x28ba8b,_0x5763('0x11'));_0x487c83(_0x4d63f8[_0x5763('0x18')][_0x5763('0x17')]);}})[_0x5763('0x19')](function(_0x3adb41){logger[_0x5763('0x15')]('Dynamics365Account,\x20%s,\x20%s',_0x28ba8b,_0x3adb41);_0x4bda2c(_0x3adb41);});});}exports[_0x5763('0x1a')]=function(_0x45df30){var _0x153adb=this;return new Promise(function(_0x96fb0c,_0x21459b){return db[_0x5763('0x1b')][_0x5763('0x1c')]({'raw':_0x45df30['options']?_0x45df30[_0x5763('0x1d')][_0x5763('0x1e')]===undefined?!![]:![]:!![],'where':_0x45df30['options']?_0x45df30[_0x5763('0x1d')][_0x5763('0x1f')]||null:null,'attributes':_0x45df30[_0x5763('0x1d')]?_0x45df30[_0x5763('0x1d')][_0x5763('0x20')]||null:null,'limit':_0x45df30[_0x5763('0x1d')]?_0x45df30['options']['limit']||null:null,'include':_0x45df30[_0x5763('0x1d')]?_0x45df30[_0x5763('0x1d')][_0x5763('0x21')]?_[_0x5763('0x22')](_0x45df30[_0x5763('0x1d')][_0x5763('0x21')],function(_0x5f522e){return{'model':db[_0x5f522e[_0x5763('0x23')]],'as':_0x5f522e['as'],'attributes':_0x5f522e[_0x5763('0x20')],'include':_0x5f522e['include']?_[_0x5763('0x22')](_0x5f522e[_0x5763('0x21')],function(_0x1c2bd1){return{'model':db[_0x1c2bd1[_0x5763('0x23')]],'as':_0x1c2bd1['as'],'attributes':_0x1c2bd1['attributes'],'include':_0x1c2bd1[_0x5763('0x21')]?_[_0x5763('0x22')](_0x1c2bd1[_0x5763('0x21')],function(_0x3131a2){return{'model':db[_0x3131a2[_0x5763('0x23')]],'as':_0x3131a2['as'],'attributes':_0x3131a2[_0x5763('0x20')]};}):[]};}):[]};}):[]:[]})[_0x5763('0x24')](function(_0x4ec4e3){logger[_0x5763('0xf')](_0x5763('0x1a'),_0x45df30);logger[_0x5763('0x12')](_0x5763('0x1a'),_0x45df30,JSON[_0x5763('0x14')](_0x4ec4e3));_0x96fb0c(_0x4ec4e3);})[_0x5763('0x19')](function(_0x11dc31){logger[_0x5763('0x15')](_0x5763('0x1a'),_0x11dc31[_0x5763('0x17')],_0x45df30);_0x21459b(_0x153adb[_0x5763('0x15')](0x1f4,_0x11dc31[_0x5763('0x17')]));});});};exports[_0x5763('0x25')]=function(_0x1f5d3b){var _0x40831d=this;return new Promise(function(_0x5bbf79,_0x56a902){return db[_0x5763('0x1b')][_0x5763('0x26')]({'raw':_0x1f5d3b['options']?_0x1f5d3b[_0x5763('0x1d')][_0x5763('0x1e')]===undefined?!![]:![]:!![],'where':_0x1f5d3b[_0x5763('0x1d')]?_0x1f5d3b['options'][_0x5763('0x1f')]||null:null,'attributes':_0x1f5d3b[_0x5763('0x1d')]?_0x1f5d3b[_0x5763('0x1d')][_0x5763('0x20')]||null:null,'include':_0x1f5d3b[_0x5763('0x1d')]?_0x1f5d3b[_0x5763('0x1d')][_0x5763('0x21')]?_['map'](_0x1f5d3b['options'][_0x5763('0x21')],function(_0x1c6605){return{'model':db[_0x1c6605['model']],'as':_0x1c6605['as'],'attributes':_0x1c6605[_0x5763('0x20')],'include':_0x1c6605[_0x5763('0x21')]?_['map'](_0x1c6605[_0x5763('0x21')],function(_0x342dae){return{'model':db[_0x342dae[_0x5763('0x23')]],'as':_0x342dae['as'],'attributes':_0x342dae[_0x5763('0x20')],'include':_0x342dae[_0x5763('0x21')]?_[_0x5763('0x22')](_0x342dae[_0x5763('0x21')],function(_0x5c4586){return{'model':db[_0x5c4586['model']],'as':_0x5c4586['as'],'attributes':_0x5c4586['attributes']};}):[]};}):[]};}):[]:[]})[_0x5763('0x24')](function(_0x215a0b){logger[_0x5763('0xf')](_0x5763('0x25'),_0x1f5d3b);logger['debug'](_0x5763('0x25'),_0x1f5d3b,JSON[_0x5763('0x14')](_0x215a0b));_0x5bbf79(_0x215a0b);})[_0x5763('0x19')](function(_0x107df4){logger[_0x5763('0x15')](_0x5763('0x25'),_0x107df4[_0x5763('0x17')],_0x1f5d3b);_0x56a902(_0x40831d[_0x5763('0x15')](0x1f4,_0x107df4['message']));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index 0bf9c1b..3ec38f2 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 _0xe2cf=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intDynamics365Configuration.controller','get','/:id','/:id/fields','isAuthenticated','/:id/subjects','/:id/descriptions','getDescriptions','post','create','delete','destroy','exports','util'];(function(_0x366653,_0x4ec323){var _0x2a5739=function(_0x23d26f){while(--_0x23d26f){_0x366653['push'](_0x366653['shift']());}};_0x2a5739(++_0x4ec323);}(_0xe2cf,0x1a1));var _0xfe2c=function(_0x223c0d,_0x3ec04d){_0x223c0d=_0x223c0d-0x0;var _0x207827=_0xe2cf[_0x223c0d];return _0x207827;};'use strict';var multer=require('multer');var util=require(_0xfe2c('0x0'));var path=require('path');var timeout=require(_0xfe2c('0x1'));var express=require('express');var router=express[_0xfe2c('0x2')]();var fs_extra=require(_0xfe2c('0x3'));var auth=require(_0xfe2c('0x4'));var interaction=require(_0xfe2c('0x5'));var config=require('../../config/environment');var controller=require(_0xfe2c('0x6'));router[_0xfe2c('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0xfe2c('0x7')](_0xfe2c('0x8'),auth['isAuthenticated'](),controller['show']);router[_0xfe2c('0x7')](_0xfe2c('0x9'),auth[_0xfe2c('0xa')](),controller['getFields']);router['get'](_0xfe2c('0xb'),auth[_0xfe2c('0xa')](),controller['getSubjects']);router[_0xfe2c('0x7')](_0xfe2c('0xc'),auth[_0xfe2c('0xa')](),controller[_0xfe2c('0xd')]);router[_0xfe2c('0xe')]('/',auth[_0xfe2c('0xa')](),controller[_0xfe2c('0xf')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0xfe2c('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xfe2c('0x11')]);module[_0xfe2c('0x12')]=router; \ No newline at end of file +var _0x9977=['connect-timeout','Router','../../config/environment','./intDynamics365Configuration.controller','get','isAuthenticated','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','create','put','/:id','update','delete','destroy','util','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9977,0x9e));var _0x7997=function(_0x87b0ff,_0x314389){_0x87b0ff=_0x87b0ff-0x0;var _0x3bc0b2=_0x9977[_0x87b0ff];return _0x3bc0b2;};'use strict';var multer=require('multer');var util=require(_0x7997('0x0'));var path=require(_0x7997('0x1'));var timeout=require(_0x7997('0x2'));var express=require('express');var router=express[_0x7997('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7997('0x4'));var controller=require(_0x7997('0x5'));router[_0x7997('0x6')]('/',auth[_0x7997('0x7')](),controller['index']);router[_0x7997('0x6')]('/:id',auth[_0x7997('0x7')](),controller['show']);router[_0x7997('0x6')](_0x7997('0x8'),auth['isAuthenticated'](),controller[_0x7997('0x9')]);router['get'](_0x7997('0xa'),auth[_0x7997('0x7')](),controller[_0x7997('0xb')]);router['get'](_0x7997('0xc'),auth['isAuthenticated'](),controller[_0x7997('0xd')]);router['post']('/',auth[_0x7997('0x7')](),controller[_0x7997('0xe')]);router[_0x7997('0xf')](_0x7997('0x10'),auth['isAuthenticated'](),controller[_0x7997('0x11')]);router[_0x7997('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x7997('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index e34f1ed..63b9d94 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 _0x7810=['incident','phonecall','sequelize','STRING'];(function(_0x30850f,_0x39b349){var _0x2f9688=function(_0x5b48e0){while(--_0x5b48e0){_0x30850f['push'](_0x30850f['shift']());}};_0x2f9688(++_0x39b349);}(_0x7810,0x82));var _0x0781=function(_0xdea41a,_0x552987){_0xdea41a=_0xdea41a-0x0;var _0x15d0d8=_0x7810[_0xdea41a];return _0x15d0d8;};'use strict';var Sequelize=require(_0x0781('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x0781('0x1')]},'ticketType':{'type':Sequelize['ENUM'](_0x0781('0x2'),_0x0781('0x3')),'defaultValue':_0x0781('0x2')}}; \ No newline at end of file +var _0xe7b2=['sequelize','exports','STRING','ENUM','incident','phonecall'];(function(_0x329664,_0x130748){var _0x4e346e=function(_0x172b0d){while(--_0x172b0d){_0x329664['push'](_0x329664['shift']());}};_0x4e346e(++_0x130748);}(_0xe7b2,0x198));var _0x2e7b=function(_0xf40f67,_0x267393){_0xf40f67=_0xf40f67-0x0;var _0x38351a=_0xe7b2[_0xf40f67];return _0x38351a;};'use strict';var Sequelize=require(_0x2e7b('0x0'));module[_0x2e7b('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x2e7b('0x2')]},'ticketType':{'type':Sequelize[_0x2e7b('0x3')](_0x2e7b('0x4'),_0x2e7b('0x5')),'defaultValue':_0x2e7b('0x4')}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index 3c60266..717d238 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 _0x5897=['reject','update','end','stack','name','send','index','map','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','Dynamics365Configuration','includeAll','include','findAll','rows','catch','params','find','create','body','destroy','findOne','Dynamics365Field','rawAttributes','getFields','hasOwnProperty','getSubjects','getDescriptions','order','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','jayson/promise','client','request','then','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','Dynamics365Configuration,\x20%s,\x20%s','message','result','sendStatus','status','json','offset','undefined','limit','count','set','apply'];(function(_0x48ff1a,_0x158692){var _0x2ca6eb=function(_0x1e1c77){while(--_0x1e1c77){_0x48ff1a['push'](_0x48ff1a['shift']());}};_0x2ca6eb(++_0x158692);}(_0x5897,0x1f4));var _0x7589=function(_0x38a3d6,_0x52e305){_0x38a3d6=_0x38a3d6-0x0;var _0x3768d7=_0x5897[_0x38a3d6];return _0x3768d7;};'use strict';var emlformat=require(_0x7589('0x0'));var rimraf=require(_0x7589('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7589('0x2'));var rp=require(_0x7589('0x3'));var moment=require('moment');var BPromise=require(_0x7589('0x4'));var Mustache=require(_0x7589('0x5'));var util=require(_0x7589('0x6'));var path=require(_0x7589('0x7'));var sox=require(_0x7589('0x8'));var csv=require('to-csv');var ejs=require(_0x7589('0x9'));var fs=require('fs');var fs_extra=require(_0x7589('0xa'));var _=require(_0x7589('0xb'));var squel=require(_0x7589('0xc'));var crypto=require(_0x7589('0xd'));var jsforce=require(_0x7589('0xe'));var deskjs=require(_0x7589('0xf'));var toCsv=require(_0x7589('0x10'));var querystring=require(_0x7589('0x11'));var Papa=require(_0x7589('0x12'));var Redis=require(_0x7589('0x13'));var authService=require(_0x7589('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x7589('0x15'));var hardwareService=require(_0x7589('0x16'));var logger=require('../../config/logger')(_0x7589('0x17'));var utils=require(_0x7589('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var jayson=require(_0x7589('0x19'));var client=jayson[_0x7589('0x1a')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4adb2b,_0x3deca6,_0x48b6b3,_0x5eeef2){return new BPromise(function(_0x3f5be2,_0x2b7616){var _0x2592cd=_0x5eeef2||client;return _0x2592cd[_0x7589('0x1b')](_0x4adb2b,_0x48b6b3)[_0x7589('0x1c')](function(_0x53c04a){logger['info']('Dynamics365Configuration,\x20%s,\x20%s',_0x3deca6,'request\x20sent');logger['debug'](_0x7589('0x1d'),_0x3deca6,_0x7589('0x1e'),JSON[_0x7589('0x1f')](_0x53c04a));if(_0x53c04a[_0x7589('0x20')]){if(_0x53c04a[_0x7589('0x20')][_0x7589('0x21')]===0x1f4){logger[_0x7589('0x20')](_0x7589('0x22'),_0x3deca6,_0x53c04a[_0x7589('0x20')][_0x7589('0x23')]);return _0x2b7616(_0x53c04a['error'][_0x7589('0x23')]);}logger[_0x7589('0x20')](_0x7589('0x22'),_0x3deca6,_0x53c04a[_0x7589('0x20')][_0x7589('0x23')]);return _0x3f5be2(_0x53c04a[_0x7589('0x20')][_0x7589('0x23')]);}else{logger['info'](_0x7589('0x22'),_0x3deca6,'request\x20sent');_0x3f5be2(_0x53c04a[_0x7589('0x24')]['message']);}})['catch'](function(_0x2c21a9){logger[_0x7589('0x20')](_0x7589('0x22'),_0x3deca6,_0x2c21a9);_0x2b7616(_0x2c21a9);});});}function respondWithStatusCode(_0x26a868,_0x2fcbc0){_0x2fcbc0=_0x2fcbc0||0xcc;return function(_0x363b30){if(_0x363b30){return _0x26a868[_0x7589('0x25')](_0x2fcbc0);}return _0x26a868['status'](_0x2fcbc0)['end']();};}function respondWithResult(_0x4a9b7d,_0x551ada){_0x551ada=_0x551ada||0xc8;return function(_0x319f26){if(_0x319f26){return _0x4a9b7d[_0x7589('0x26')](_0x551ada)[_0x7589('0x27')](_0x319f26);}};}function respondWithFilteredResult(_0x30aea7,_0x331d1e){return function(_0x41e3a5){if(_0x41e3a5){var _0x27f583=typeof _0x331d1e[_0x7589('0x28')]===_0x7589('0x29')&&typeof _0x331d1e[_0x7589('0x2a')]===_0x7589('0x29');var _0x5e8c8d=_0x41e3a5[_0x7589('0x2b')];var _0x457ba0=_0x27f583?0x0:_0x331d1e[_0x7589('0x28')];var _0x48ca29=_0x27f583?_0x41e3a5[_0x7589('0x2b')]:_0x331d1e[_0x7589('0x28')]+_0x331d1e['limit'];var _0x4e98ff;if(_0x48ca29>=_0x5e8c8d){_0x48ca29=_0x5e8c8d;_0x4e98ff=0xc8;}else{_0x4e98ff=0xce;}_0x30aea7['status'](_0x4e98ff);return _0x30aea7[_0x7589('0x2c')]('Content-Range',_0x457ba0+'-'+_0x48ca29+'/'+_0x5e8c8d)[_0x7589('0x27')](_0x41e3a5);}return null;};}function patchUpdates(_0x57861f){return function(_0x75bd9b){try{jsonpatch[_0x7589('0x2d')](_0x75bd9b,_0x57861f,!![]);}catch(_0x2327bc){return BPromise[_0x7589('0x2e')](_0x2327bc);}return _0x75bd9b['save']();};}function saveUpdates(_0x5f1ebc,_0x27c3ea){return function(_0x39a687){if(_0x39a687){return _0x39a687[_0x7589('0x2f')](_0x5f1ebc)[_0x7589('0x1c')](function(_0x3eeb5f){return _0x3eeb5f;});}return null;};}function removeEntity(_0x22f74a,_0x47e895){return function(_0x569888){if(_0x569888){return _0x569888['destroy']()[_0x7589('0x1c')](function(){_0x22f74a[_0x7589('0x26')](0xcc)[_0x7589('0x30')]();});}};}function handleEntityNotFound(_0x2ff3cb,_0x333473){return function(_0x4b5472){if(!_0x4b5472){_0x2ff3cb[_0x7589('0x25')](0x194);}return _0x4b5472;};}function handleError(_0x1466ad,_0x290dff){_0x290dff=_0x290dff||0x1f4;return function(_0x5b9798){logger[_0x7589('0x20')](_0x5b9798[_0x7589('0x31')]);if(_0x5b9798[_0x7589('0x32')]){delete _0x5b9798['name'];}_0x1466ad[_0x7589('0x26')](_0x290dff)[_0x7589('0x33')](_0x5b9798);};}exports[_0x7589('0x34')]=function(_0x4e806f,_0x1f6bbd){var _0x2d896d={},_0x387009={},_0x41e772={'count':0x0,'rows':[]};var _0x466456=_[_0x7589('0x35')](db['Dynamics365Configuration']['rawAttributes'],function(_0xade064){return{'name':_0xade064['fieldName'],'type':_0xade064[_0x7589('0x36')][_0x7589('0x37')]};});_0x387009[_0x7589('0x38')]=_['map'](_0x466456,_0x7589('0x32'));_0x387009[_0x7589('0x39')]=_[_0x7589('0x3a')](_0x4e806f[_0x7589('0x39')]);_0x387009[_0x7589('0x3b')]=_[_0x7589('0x3c')](_0x387009[_0x7589('0x38')],_0x387009[_0x7589('0x39')]);_0x2d896d[_0x7589('0x3d')]=_[_0x7589('0x3c')](_0x387009[_0x7589('0x38')],qs['fields'](_0x4e806f[_0x7589('0x39')][_0x7589('0x3e')]));_0x2d896d['attributes']=_0x2d896d[_0x7589('0x3d')][_0x7589('0x3f')]?_0x2d896d['attributes']:_0x387009[_0x7589('0x38')];if(!_0x4e806f[_0x7589('0x39')]['hasOwnProperty'](_0x7589('0x40'))){_0x2d896d['limit']=qs['limit'](_0x4e806f['query']['limit']);_0x2d896d['offset']=qs['offset'](_0x4e806f[_0x7589('0x39')][_0x7589('0x28')]);}_0x2d896d['order']=qs[_0x7589('0x41')](_0x4e806f[_0x7589('0x39')][_0x7589('0x41')]);_0x2d896d[_0x7589('0x42')]=qs[_0x7589('0x3b')](_[_0x7589('0x43')](_0x4e806f['query'],_0x387009[_0x7589('0x3b')]),_0x466456);if(_0x4e806f['query']['filter']){_0x2d896d[_0x7589('0x42')]=_[_0x7589('0x44')](_0x2d896d['where'],{'$or':_[_0x7589('0x35')](_0x466456,function(_0x4d565b){if(_0x4d565b[_0x7589('0x36')]!==_0x7589('0x45')){var _0x569145={};_0x569145[_0x4d565b[_0x7589('0x32')]]={'$like':'%'+_0x4e806f[_0x7589('0x39')][_0x7589('0x46')]+'%'};return _0x569145;}})});}_0x2d896d=_[_0x7589('0x44')]({},_0x2d896d,_0x4e806f[_0x7589('0x47')]);var _0x1f487f={'where':_0x2d896d[_0x7589('0x42')]};return db[_0x7589('0x48')]['count'](_0x1f487f)[_0x7589('0x1c')](function(_0x316c98){_0x41e772[_0x7589('0x2b')]=_0x316c98;if(_0x4e806f[_0x7589('0x39')][_0x7589('0x49')]){_0x2d896d[_0x7589('0x4a')]=[{'all':!![]}];}return db['Dynamics365Configuration'][_0x7589('0x4b')](_0x2d896d);})[_0x7589('0x1c')](function(_0x47a879){_0x41e772[_0x7589('0x4c')]=_0x47a879;return _0x41e772;})[_0x7589('0x1c')](respondWithFilteredResult(_0x1f6bbd,_0x2d896d))[_0x7589('0x4d')](handleError(_0x1f6bbd,null));};exports['show']=function(_0x10b037,_0x16e5e4){var _0x1af5da={'raw':![],'where':{'id':_0x10b037[_0x7589('0x4e')]['id']}},_0x5c6f76={};_0x5c6f76[_0x7589('0x38')]=_[_0x7589('0x3a')](db[_0x7589('0x48')]['rawAttributes']);_0x5c6f76['query']=_[_0x7589('0x3a')](_0x10b037['query']);_0x5c6f76[_0x7589('0x3b')]=_[_0x7589('0x3c')](_0x5c6f76[_0x7589('0x38')],_0x5c6f76[_0x7589('0x39')]);_0x1af5da[_0x7589('0x3d')]=_[_0x7589('0x3c')](_0x5c6f76[_0x7589('0x38')],qs[_0x7589('0x3e')](_0x10b037[_0x7589('0x39')][_0x7589('0x3e')]));_0x1af5da[_0x7589('0x3d')]=_0x1af5da[_0x7589('0x3d')][_0x7589('0x3f')]?_0x1af5da[_0x7589('0x3d')]:_0x5c6f76[_0x7589('0x38')];if(_0x10b037[_0x7589('0x39')][_0x7589('0x49')]){_0x1af5da[_0x7589('0x4a')]=[{'all':!![]}];}_0x1af5da=_[_0x7589('0x44')]({},_0x1af5da,_0x10b037[_0x7589('0x47')]);return db[_0x7589('0x48')][_0x7589('0x4f')](_0x1af5da)[_0x7589('0x1c')](handleEntityNotFound(_0x16e5e4,null))['then'](respondWithResult(_0x16e5e4,null))['catch'](handleError(_0x16e5e4,null));};exports[_0x7589('0x50')]=function(_0x11cee8,_0x56e4e8){return db[_0x7589('0x48')][_0x7589('0x50')](_0x11cee8[_0x7589('0x51')],{})[_0x7589('0x1c')](respondWithResult(_0x56e4e8,0xc9))[_0x7589('0x4d')](handleError(_0x56e4e8,null));};exports[_0x7589('0x2f')]=function(_0x29c23d,_0x36ccfe){if(_0x29c23d[_0x7589('0x51')]['id']){delete _0x29c23d[_0x7589('0x51')]['id'];}return db[_0x7589('0x48')][_0x7589('0x4f')]({'where':{'id':_0x29c23d[_0x7589('0x4e')]['id']}})[_0x7589('0x1c')](handleEntityNotFound(_0x36ccfe,null))[_0x7589('0x1c')](saveUpdates(_0x29c23d[_0x7589('0x51')],null))[_0x7589('0x1c')](respondWithResult(_0x36ccfe,null))[_0x7589('0x4d')](handleError(_0x36ccfe,null));};exports[_0x7589('0x52')]=function(_0x59f834,_0x42cc1a){return db['Dynamics365Configuration'][_0x7589('0x4f')]({'where':{'id':_0x59f834[_0x7589('0x4e')]['id']}})['then'](handleEntityNotFound(_0x42cc1a,null))['then'](removeEntity(_0x42cc1a,null))['catch'](handleError(_0x42cc1a,null));};exports['getFields']=function(_0x47c687,_0x57feb6,_0x9f2ca0){var _0x501e={};var _0xb80c6a={};var _0x55735c;var _0x17b123;return db[_0x7589('0x48')][_0x7589('0x53')]({'where':{'id':_0x47c687[_0x7589('0x4e')]['id']}})[_0x7589('0x1c')](handleEntityNotFound(_0x57feb6,null))[_0x7589('0x1c')](function(_0x5f0e72){if(_0x5f0e72){_0x55735c=_0x5f0e72;_0xb80c6a['model']=_[_0x7589('0x3a')](db[_0x7589('0x54')][_0x7589('0x55')]);_0xb80c6a['query']=_['keys'](_0x47c687[_0x7589('0x39')]);_0xb80c6a[_0x7589('0x3b')]=_['intersection'](_0xb80c6a['model'],_0xb80c6a['query']);_0x501e[_0x7589('0x3d')]=_[_0x7589('0x3c')](_0xb80c6a[_0x7589('0x38')],qs[_0x7589('0x3e')](_0x47c687[_0x7589('0x39')][_0x7589('0x3e')]));_0x501e[_0x7589('0x3d')]=_0x501e[_0x7589('0x3d')]['length']?_0x501e[_0x7589('0x3d')]:_0xb80c6a[_0x7589('0x38')];_0x501e['order']=qs[_0x7589('0x41')](_0x47c687[_0x7589('0x39')]['sort']);_0x501e['where']=qs[_0x7589('0x3b')](_[_0x7589('0x43')](_0x47c687[_0x7589('0x39')],_0xb80c6a[_0x7589('0x3b')]));if(_0x47c687[_0x7589('0x39')][_0x7589('0x46')]){_0x501e['where']=_[_0x7589('0x44')](_0x501e['where'],{'$or':_[_0x7589('0x35')](_0x501e[_0x7589('0x3d')],function(_0x33c5cf){var _0x2455a1={};_0x2455a1[_0x33c5cf]={'$like':'%'+_0x47c687[_0x7589('0x39')][_0x7589('0x46')]+'%'};return _0x2455a1;})});}_0x501e=_[_0x7589('0x44')]({},_0x501e,_0x47c687[_0x7589('0x47')]);return _0x55735c[_0x7589('0x56')](_0x501e);}})[_0x7589('0x1c')](function(_0x58449c){if(_0x58449c){_0x17b123=_0x58449c[_0x7589('0x3f')];if(!_0x47c687['query'][_0x7589('0x57')](_0x7589('0x40'))){_0x501e[_0x7589('0x2a')]=qs[_0x7589('0x2a')](_0x47c687[_0x7589('0x39')][_0x7589('0x2a')]);_0x501e[_0x7589('0x28')]=qs['offset'](_0x47c687['query'][_0x7589('0x28')]);}return _0x55735c[_0x7589('0x56')](_0x501e);}})['then'](function(_0x18073c){if(_0x18073c){return _0x18073c?{'count':_0x17b123,'rows':_0x18073c}:null;}})[_0x7589('0x1c')](respondWithResult(_0x57feb6,null))[_0x7589('0x4d')](handleError(_0x57feb6,null));};exports[_0x7589('0x58')]=function(_0x106d96,_0x2c89d7,_0x1edceb){var _0x472d67={};var _0x424c62={};var _0xcb69a8;var _0x4dbfa8;return db['Dynamics365Configuration'][_0x7589('0x53')]({'where':{'id':_0x106d96[_0x7589('0x4e')]['id']}})['then'](handleEntityNotFound(_0x2c89d7,null))['then'](function(_0x10f5b6){if(_0x10f5b6){_0xcb69a8=_0x10f5b6;_0x424c62[_0x7589('0x38')]=_[_0x7589('0x3a')](db[_0x7589('0x54')][_0x7589('0x55')]);_0x424c62[_0x7589('0x39')]=_[_0x7589('0x3a')](_0x106d96[_0x7589('0x39')]);_0x424c62[_0x7589('0x3b')]=_[_0x7589('0x3c')](_0x424c62[_0x7589('0x38')],_0x424c62[_0x7589('0x39')]);_0x472d67['attributes']=_['intersection'](_0x424c62[_0x7589('0x38')],qs[_0x7589('0x3e')](_0x106d96[_0x7589('0x39')][_0x7589('0x3e')]));_0x472d67[_0x7589('0x3d')]=_0x472d67[_0x7589('0x3d')][_0x7589('0x3f')]?_0x472d67[_0x7589('0x3d')]:_0x424c62['model'];_0x472d67['order']=qs['sort'](_0x106d96[_0x7589('0x39')][_0x7589('0x41')]);_0x472d67[_0x7589('0x42')]=qs['filters'](_[_0x7589('0x43')](_0x106d96['query'],_0x424c62[_0x7589('0x3b')]));if(_0x106d96['query'][_0x7589('0x46')]){_0x472d67[_0x7589('0x42')]=_['merge'](_0x472d67[_0x7589('0x42')],{'$or':_['map'](_0x472d67['attributes'],function(_0x11304a){var _0x327773={};_0x327773[_0x11304a]={'$like':'%'+_0x106d96[_0x7589('0x39')][_0x7589('0x46')]+'%'};return _0x327773;})});}_0x472d67=_[_0x7589('0x44')]({},_0x472d67,_0x106d96[_0x7589('0x47')]);return _0xcb69a8[_0x7589('0x58')](_0x472d67);}})[_0x7589('0x1c')](function(_0x1b9444){if(_0x1b9444){_0x4dbfa8=_0x1b9444['length'];if(!_0x106d96['query'][_0x7589('0x57')](_0x7589('0x40'))){_0x472d67[_0x7589('0x2a')]=qs['limit'](_0x106d96[_0x7589('0x39')][_0x7589('0x2a')]);_0x472d67[_0x7589('0x28')]=qs[_0x7589('0x28')](_0x106d96['query'][_0x7589('0x28')]);}return _0xcb69a8[_0x7589('0x58')](_0x472d67);}})[_0x7589('0x1c')](function(_0x5d5014){if(_0x5d5014){return _0x5d5014?{'count':_0x4dbfa8,'rows':_0x5d5014}:null;}})['then'](respondWithResult(_0x2c89d7,null))[_0x7589('0x4d')](handleError(_0x2c89d7,null));};exports[_0x7589('0x59')]=function(_0x2ebc98,_0x39747f,_0x270e92){var _0x1f68b8={};var _0x2f82dd={};var _0x2626b6;var _0x324e6c;return db[_0x7589('0x48')]['findOne']({'where':{'id':_0x2ebc98[_0x7589('0x4e')]['id']}})['then'](handleEntityNotFound(_0x39747f,null))[_0x7589('0x1c')](function(_0x2b1437){if(_0x2b1437){_0x2626b6=_0x2b1437;_0x2f82dd[_0x7589('0x38')]=_[_0x7589('0x3a')](db[_0x7589('0x54')][_0x7589('0x55')]);_0x2f82dd['query']=_[_0x7589('0x3a')](_0x2ebc98['query']);_0x2f82dd[_0x7589('0x3b')]=_[_0x7589('0x3c')](_0x2f82dd[_0x7589('0x38')],_0x2f82dd[_0x7589('0x39')]);_0x1f68b8[_0x7589('0x3d')]=_['intersection'](_0x2f82dd[_0x7589('0x38')],qs[_0x7589('0x3e')](_0x2ebc98[_0x7589('0x39')]['fields']));_0x1f68b8[_0x7589('0x3d')]=_0x1f68b8[_0x7589('0x3d')][_0x7589('0x3f')]?_0x1f68b8[_0x7589('0x3d')]:_0x2f82dd[_0x7589('0x38')];_0x1f68b8[_0x7589('0x5a')]=qs['sort'](_0x2ebc98[_0x7589('0x39')]['sort']);_0x1f68b8[_0x7589('0x42')]=qs[_0x7589('0x3b')](_[_0x7589('0x43')](_0x2ebc98[_0x7589('0x39')],_0x2f82dd[_0x7589('0x3b')]));if(_0x2ebc98[_0x7589('0x39')][_0x7589('0x46')]){_0x1f68b8[_0x7589('0x42')]=_[_0x7589('0x44')](_0x1f68b8[_0x7589('0x42')],{'$or':_[_0x7589('0x35')](_0x1f68b8[_0x7589('0x3d')],function(_0x55f70a){var _0x2a6faa={};_0x2a6faa[_0x55f70a]={'$like':'%'+_0x2ebc98[_0x7589('0x39')][_0x7589('0x46')]+'%'};return _0x2a6faa;})});}_0x1f68b8=_[_0x7589('0x44')]({},_0x1f68b8,_0x2ebc98['options']);return _0x2626b6[_0x7589('0x59')](_0x1f68b8);}})[_0x7589('0x1c')](function(_0x136904){if(_0x136904){_0x324e6c=_0x136904['length'];if(!_0x2ebc98[_0x7589('0x39')]['hasOwnProperty'](_0x7589('0x40'))){_0x1f68b8[_0x7589('0x2a')]=qs['limit'](_0x2ebc98[_0x7589('0x39')][_0x7589('0x2a')]);_0x1f68b8['offset']=qs['offset'](_0x2ebc98[_0x7589('0x39')][_0x7589('0x28')]);}return _0x2626b6['getDescriptions'](_0x1f68b8);}})['then'](function(_0x4703bc){if(_0x4703bc){return _0x4703bc?{'count':_0x324e6c,'rows':_0x4703bc}:null;}})[_0x7589('0x1c')](respondWithResult(_0x39747f,null))[_0x7589('0x4d')](handleError(_0x39747f,null));}; \ No newline at end of file +var _0x7691=['fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','jayson/promise','request','info','Dynamics365Configuration,\x20%s,\x20%s','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','apply','reject','save','then','name','send','index','rawAttributes','type','model','map','query','keys','filters','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','includeAll','include','Dynamics365Configuration','findAll','rows','show','intersection','length','find','catch','create','body','update','params','getFields','findOne','getSubjects','getDescriptions','Dynamics365Field','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x7691,0xa9));var _0x1769=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x7691[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0x1769('0x0'));var rimraf=require(_0x1769('0x1'));var zipdir=require(_0x1769('0x2'));var jsonpatch=require(_0x1769('0x3'));var rp=require(_0x1769('0x4'));var moment=require(_0x1769('0x5'));var BPromise=require(_0x1769('0x6'));var Mustache=require(_0x1769('0x7'));var util=require(_0x1769('0x8'));var path=require(_0x1769('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x1769('0xa'));var fs=require('fs');var fs_extra=require(_0x1769('0xb'));var _=require(_0x1769('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x1769('0xd'));var deskjs=require(_0x1769('0xe'));var toCsv=require('to-csv');var querystring=require(_0x1769('0xf'));var Papa=require(_0x1769('0x10'));var Redis=require(_0x1769('0x11'));var authService=require(_0x1769('0x12'));var qs=require(_0x1769('0x13'));var as=require(_0x1769('0x14'));var hardwareService=require(_0x1769('0x15'));var logger=require(_0x1769('0x16'))('api');var utils=require(_0x1769('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x1769('0x18'))['db'];var jayson=require(_0x1769('0x19'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x532adc,_0x4be0c1,_0xa8c805,_0xc61d6f){return new BPromise(function(_0x297ba5,_0x2edd6a){var _0x848804=_0xc61d6f||client;return _0x848804[_0x1769('0x1a')](_0x532adc,_0xa8c805)['then'](function(_0x1e3878){logger[_0x1769('0x1b')](_0x1769('0x1c'),_0x4be0c1,'request\x20sent');logger[_0x1769('0x1d')](_0x1769('0x1e'),_0x4be0c1,_0x1769('0x1f'),JSON[_0x1769('0x20')](_0x1e3878));if(_0x1e3878[_0x1769('0x21')]){if(_0x1e3878[_0x1769('0x21')][_0x1769('0x22')]===0x1f4){logger['error'](_0x1769('0x1c'),_0x4be0c1,_0x1e3878[_0x1769('0x21')][_0x1769('0x23')]);return _0x2edd6a(_0x1e3878['error'][_0x1769('0x23')]);}logger[_0x1769('0x21')](_0x1769('0x1c'),_0x4be0c1,_0x1e3878[_0x1769('0x21')][_0x1769('0x23')]);return _0x297ba5(_0x1e3878[_0x1769('0x21')][_0x1769('0x23')]);}else{logger[_0x1769('0x1b')]('Dynamics365Configuration,\x20%s,\x20%s',_0x4be0c1,_0x1769('0x1f'));_0x297ba5(_0x1e3878[_0x1769('0x24')][_0x1769('0x23')]);}})['catch'](function(_0x109b49){logger[_0x1769('0x21')](_0x1769('0x1c'),_0x4be0c1,_0x109b49);_0x2edd6a(_0x109b49);});});}function respondWithStatusCode(_0x332ca5,_0x571f86){_0x571f86=_0x571f86||0xcc;return function(_0x4e63ae){if(_0x4e63ae){return _0x332ca5[_0x1769('0x25')](_0x571f86);}return _0x332ca5[_0x1769('0x26')](_0x571f86)[_0x1769('0x27')]();};}function respondWithResult(_0x2387e3,_0x286464){_0x286464=_0x286464||0xc8;return function(_0x3b45a7){if(_0x3b45a7){return _0x2387e3['status'](_0x286464)['json'](_0x3b45a7);}};}function respondWithFilteredResult(_0x504b1e,_0x24c1ea){return function(_0x1b65ef){if(_0x1b65ef){var _0x57735b=typeof _0x24c1ea['offset']===_0x1769('0x28')&&typeof _0x24c1ea[_0x1769('0x29')]===_0x1769('0x28');var _0x379b8f=_0x1b65ef[_0x1769('0x2a')];var _0x10e5fd=_0x57735b?0x0:_0x24c1ea[_0x1769('0x2b')];var _0x260357=_0x57735b?_0x1b65ef[_0x1769('0x2a')]:_0x24c1ea[_0x1769('0x2b')]+_0x24c1ea['limit'];var _0x9e43d5;if(_0x260357>=_0x379b8f){_0x260357=_0x379b8f;_0x9e43d5=0xc8;}else{_0x9e43d5=0xce;}_0x504b1e[_0x1769('0x26')](_0x9e43d5);return _0x504b1e[_0x1769('0x2c')](_0x1769('0x2d'),_0x10e5fd+'-'+_0x260357+'/'+_0x379b8f)['json'](_0x1b65ef);}return null;};}function patchUpdates(_0x52eb3c){return function(_0x4b58fe){try{jsonpatch[_0x1769('0x2e')](_0x4b58fe,_0x52eb3c,!![]);}catch(_0xa798f){return BPromise[_0x1769('0x2f')](_0xa798f);}return _0x4b58fe[_0x1769('0x30')]();};}function saveUpdates(_0xf32c3f,_0x573567){return function(_0x3dbb9b){if(_0x3dbb9b){return _0x3dbb9b['update'](_0xf32c3f)[_0x1769('0x31')](function(_0x4fde87){return _0x4fde87;});}return null;};}function removeEntity(_0x59bba5,_0x135537){return function(_0x385d5a){if(_0x385d5a){return _0x385d5a['destroy']()[_0x1769('0x31')](function(){_0x59bba5[_0x1769('0x26')](0xcc)[_0x1769('0x27')]();});}};}function handleEntityNotFound(_0x2c634e,_0x247f53){return function(_0x381101){if(!_0x381101){_0x2c634e[_0x1769('0x25')](0x194);}return _0x381101;};}function handleError(_0x51313a,_0x317d5a){_0x317d5a=_0x317d5a||0x1f4;return function(_0x276132){logger[_0x1769('0x21')](_0x276132['stack']);if(_0x276132[_0x1769('0x32')]){delete _0x276132[_0x1769('0x32')];}_0x51313a[_0x1769('0x26')](_0x317d5a)[_0x1769('0x33')](_0x276132);};}exports[_0x1769('0x34')]=function(_0x20ef40,_0x4b84dd){var _0x3a57ef={},_0x53b0b4={},_0x48367d={'count':0x0,'rows':[]};var _0x122487=_['map'](db['Dynamics365Configuration'][_0x1769('0x35')],function(_0x378009){return{'name':_0x378009['fieldName'],'type':_0x378009[_0x1769('0x36')]['key']};});_0x53b0b4[_0x1769('0x37')]=_[_0x1769('0x38')](_0x122487,'name');_0x53b0b4[_0x1769('0x39')]=_[_0x1769('0x3a')](_0x20ef40['query']);_0x53b0b4[_0x1769('0x3b')]=_['intersection'](_0x53b0b4[_0x1769('0x37')],_0x53b0b4['query']);_0x3a57ef[_0x1769('0x3c')]=_['intersection'](_0x53b0b4[_0x1769('0x37')],qs[_0x1769('0x3d')](_0x20ef40[_0x1769('0x39')]['fields']));_0x3a57ef[_0x1769('0x3c')]=_0x3a57ef[_0x1769('0x3c')]['length']?_0x3a57ef['attributes']:_0x53b0b4[_0x1769('0x37')];if(!_0x20ef40['query'][_0x1769('0x3e')](_0x1769('0x3f'))){_0x3a57ef[_0x1769('0x29')]=qs[_0x1769('0x29')](_0x20ef40[_0x1769('0x39')][_0x1769('0x29')]);_0x3a57ef['offset']=qs['offset'](_0x20ef40[_0x1769('0x39')]['offset']);}_0x3a57ef[_0x1769('0x40')]=qs[_0x1769('0x41')](_0x20ef40['query'][_0x1769('0x41')]);_0x3a57ef['where']=qs[_0x1769('0x3b')](_[_0x1769('0x42')](_0x20ef40[_0x1769('0x39')],_0x53b0b4[_0x1769('0x3b')]),_0x122487);if(_0x20ef40[_0x1769('0x39')][_0x1769('0x43')]){_0x3a57ef[_0x1769('0x44')]=_[_0x1769('0x45')](_0x3a57ef[_0x1769('0x44')],{'$or':_[_0x1769('0x38')](_0x122487,function(_0x2d6f56){if(_0x2d6f56[_0x1769('0x36')]!=='VIRTUAL'){var _0xeaf2fb={};_0xeaf2fb[_0x2d6f56[_0x1769('0x32')]]={'$like':'%'+_0x20ef40[_0x1769('0x39')][_0x1769('0x43')]+'%'};return _0xeaf2fb;}})});}_0x3a57ef=_['merge']({},_0x3a57ef,_0x20ef40[_0x1769('0x46')]);var _0x2eab06={'where':_0x3a57ef['where']};return db['Dynamics365Configuration']['count'](_0x2eab06)[_0x1769('0x31')](function(_0x476df8){_0x48367d[_0x1769('0x2a')]=_0x476df8;if(_0x20ef40[_0x1769('0x39')][_0x1769('0x47')]){_0x3a57ef[_0x1769('0x48')]=[{'all':!![]}];}return db[_0x1769('0x49')][_0x1769('0x4a')](_0x3a57ef);})[_0x1769('0x31')](function(_0x36b33a){_0x48367d[_0x1769('0x4b')]=_0x36b33a;return _0x48367d;})[_0x1769('0x31')](respondWithFilteredResult(_0x4b84dd,_0x3a57ef))['catch'](handleError(_0x4b84dd,null));};exports[_0x1769('0x4c')]=function(_0x55afd2,_0xe91717){var _0x8beeec={'raw':![],'where':{'id':_0x55afd2['params']['id']}},_0x49ae40={};_0x49ae40[_0x1769('0x37')]=_[_0x1769('0x3a')](db['Dynamics365Configuration']['rawAttributes']);_0x49ae40[_0x1769('0x39')]=_[_0x1769('0x3a')](_0x55afd2[_0x1769('0x39')]);_0x49ae40['filters']=_[_0x1769('0x4d')](_0x49ae40[_0x1769('0x37')],_0x49ae40[_0x1769('0x39')]);_0x8beeec[_0x1769('0x3c')]=_[_0x1769('0x4d')](_0x49ae40[_0x1769('0x37')],qs[_0x1769('0x3d')](_0x55afd2[_0x1769('0x39')][_0x1769('0x3d')]));_0x8beeec['attributes']=_0x8beeec['attributes'][_0x1769('0x4e')]?_0x8beeec[_0x1769('0x3c')]:_0x49ae40[_0x1769('0x37')];if(_0x55afd2[_0x1769('0x39')][_0x1769('0x47')]){_0x8beeec[_0x1769('0x48')]=[{'all':!![]}];}_0x8beeec=_['merge']({},_0x8beeec,_0x55afd2[_0x1769('0x46')]);return db[_0x1769('0x49')][_0x1769('0x4f')](_0x8beeec)[_0x1769('0x31')](handleEntityNotFound(_0xe91717,null))[_0x1769('0x31')](respondWithResult(_0xe91717,null))[_0x1769('0x50')](handleError(_0xe91717,null));};exports[_0x1769('0x51')]=function(_0x53ae67,_0x3254b4){return db[_0x1769('0x49')][_0x1769('0x51')](_0x53ae67[_0x1769('0x52')],{})[_0x1769('0x31')](respondWithResult(_0x3254b4,0xc9))[_0x1769('0x50')](handleError(_0x3254b4,null));};exports[_0x1769('0x53')]=function(_0x39e0e4,_0x1283e0){if(_0x39e0e4[_0x1769('0x52')]['id']){delete _0x39e0e4[_0x1769('0x52')]['id'];}return db[_0x1769('0x49')][_0x1769('0x4f')]({'where':{'id':_0x39e0e4['params']['id']}})[_0x1769('0x31')](handleEntityNotFound(_0x1283e0,null))['then'](saveUpdates(_0x39e0e4[_0x1769('0x52')],null))[_0x1769('0x31')](respondWithResult(_0x1283e0,null))[_0x1769('0x50')](handleError(_0x1283e0,null));};exports['destroy']=function(_0x48cc91,_0x24008a){return db[_0x1769('0x49')][_0x1769('0x4f')]({'where':{'id':_0x48cc91[_0x1769('0x54')]['id']}})[_0x1769('0x31')](handleEntityNotFound(_0x24008a,null))[_0x1769('0x31')](removeEntity(_0x24008a,null))[_0x1769('0x50')](handleError(_0x24008a,null));};exports[_0x1769('0x55')]=function(_0x2afede,_0x811715,_0x4a0fb6){var _0x762ed2={};var _0x5af172={};var _0x3dbe94;var _0x3e9d3a;return db[_0x1769('0x49')][_0x1769('0x56')]({'where':{'id':_0x2afede[_0x1769('0x54')]['id']}})[_0x1769('0x31')](handleEntityNotFound(_0x811715,null))[_0x1769('0x31')](function(_0x3bef30){if(_0x3bef30){_0x3dbe94=_0x3bef30;_0x5af172['model']=_[_0x1769('0x3a')](db['Dynamics365Field']['rawAttributes']);_0x5af172[_0x1769('0x39')]=_['keys'](_0x2afede['query']);_0x5af172[_0x1769('0x3b')]=_[_0x1769('0x4d')](_0x5af172[_0x1769('0x37')],_0x5af172['query']);_0x762ed2[_0x1769('0x3c')]=_[_0x1769('0x4d')](_0x5af172['model'],qs['fields'](_0x2afede['query'][_0x1769('0x3d')]));_0x762ed2['attributes']=_0x762ed2[_0x1769('0x3c')][_0x1769('0x4e')]?_0x762ed2[_0x1769('0x3c')]:_0x5af172[_0x1769('0x37')];_0x762ed2['order']=qs[_0x1769('0x41')](_0x2afede[_0x1769('0x39')][_0x1769('0x41')]);_0x762ed2['where']=qs[_0x1769('0x3b')](_['pick'](_0x2afede[_0x1769('0x39')],_0x5af172['filters']));if(_0x2afede[_0x1769('0x39')][_0x1769('0x43')]){_0x762ed2[_0x1769('0x44')]=_[_0x1769('0x45')](_0x762ed2[_0x1769('0x44')],{'$or':_['map'](_0x762ed2[_0x1769('0x3c')],function(_0x49232f){var _0x1e2871={};_0x1e2871[_0x49232f]={'$like':'%'+_0x2afede[_0x1769('0x39')][_0x1769('0x43')]+'%'};return _0x1e2871;})});}_0x762ed2=_[_0x1769('0x45')]({},_0x762ed2,_0x2afede[_0x1769('0x46')]);return _0x3dbe94['getFields'](_0x762ed2);}})[_0x1769('0x31')](function(_0x186e19){if(_0x186e19){_0x3e9d3a=_0x186e19[_0x1769('0x4e')];if(!_0x2afede[_0x1769('0x39')][_0x1769('0x3e')](_0x1769('0x3f'))){_0x762ed2[_0x1769('0x29')]=qs[_0x1769('0x29')](_0x2afede[_0x1769('0x39')][_0x1769('0x29')]);_0x762ed2['offset']=qs[_0x1769('0x2b')](_0x2afede['query'][_0x1769('0x2b')]);}return _0x3dbe94[_0x1769('0x55')](_0x762ed2);}})[_0x1769('0x31')](function(_0x575fe2){if(_0x575fe2){return _0x575fe2?{'count':_0x3e9d3a,'rows':_0x575fe2}:null;}})['then'](respondWithResult(_0x811715,null))[_0x1769('0x50')](handleError(_0x811715,null));};exports[_0x1769('0x57')]=function(_0x19656e,_0x3eff37,_0x2175fd){var _0x1cdda6={};var _0x2a4cda={};var _0x271b0b;var _0xdb887b;return db[_0x1769('0x49')][_0x1769('0x56')]({'where':{'id':_0x19656e['params']['id']}})['then'](handleEntityNotFound(_0x3eff37,null))[_0x1769('0x31')](function(_0x295371){if(_0x295371){_0x271b0b=_0x295371;_0x2a4cda[_0x1769('0x37')]=_[_0x1769('0x3a')](db['Dynamics365Field'][_0x1769('0x35')]);_0x2a4cda[_0x1769('0x39')]=_[_0x1769('0x3a')](_0x19656e['query']);_0x2a4cda[_0x1769('0x3b')]=_[_0x1769('0x4d')](_0x2a4cda[_0x1769('0x37')],_0x2a4cda[_0x1769('0x39')]);_0x1cdda6[_0x1769('0x3c')]=_['intersection'](_0x2a4cda[_0x1769('0x37')],qs[_0x1769('0x3d')](_0x19656e[_0x1769('0x39')]['fields']));_0x1cdda6[_0x1769('0x3c')]=_0x1cdda6[_0x1769('0x3c')][_0x1769('0x4e')]?_0x1cdda6[_0x1769('0x3c')]:_0x2a4cda[_0x1769('0x37')];_0x1cdda6['order']=qs[_0x1769('0x41')](_0x19656e[_0x1769('0x39')][_0x1769('0x41')]);_0x1cdda6[_0x1769('0x44')]=qs[_0x1769('0x3b')](_[_0x1769('0x42')](_0x19656e['query'],_0x2a4cda[_0x1769('0x3b')]));if(_0x19656e[_0x1769('0x39')][_0x1769('0x43')]){_0x1cdda6['where']=_[_0x1769('0x45')](_0x1cdda6[_0x1769('0x44')],{'$or':_[_0x1769('0x38')](_0x1cdda6['attributes'],function(_0x586eab){var _0x2998e5={};_0x2998e5[_0x586eab]={'$like':'%'+_0x19656e[_0x1769('0x39')][_0x1769('0x43')]+'%'};return _0x2998e5;})});}_0x1cdda6=_[_0x1769('0x45')]({},_0x1cdda6,_0x19656e[_0x1769('0x46')]);return _0x271b0b[_0x1769('0x57')](_0x1cdda6);}})[_0x1769('0x31')](function(_0x2ff6bf){if(_0x2ff6bf){_0xdb887b=_0x2ff6bf[_0x1769('0x4e')];if(!_0x19656e[_0x1769('0x39')][_0x1769('0x3e')]('nolimit')){_0x1cdda6[_0x1769('0x29')]=qs[_0x1769('0x29')](_0x19656e[_0x1769('0x39')]['limit']);_0x1cdda6[_0x1769('0x2b')]=qs['offset'](_0x19656e[_0x1769('0x39')][_0x1769('0x2b')]);}return _0x271b0b['getSubjects'](_0x1cdda6);}})[_0x1769('0x31')](function(_0x2d5505){if(_0x2d5505){return _0x2d5505?{'count':_0xdb887b,'rows':_0x2d5505}:null;}})[_0x1769('0x31')](respondWithResult(_0x3eff37,null))['catch'](handleError(_0x3eff37,null));};exports[_0x1769('0x58')]=function(_0x2a2086,_0x45e352,_0x5d0fab){var _0x2f898d={};var _0x530bd1={};var _0x38124c;var _0x179f2a;return db['Dynamics365Configuration'][_0x1769('0x56')]({'where':{'id':_0x2a2086[_0x1769('0x54')]['id']}})[_0x1769('0x31')](handleEntityNotFound(_0x45e352,null))[_0x1769('0x31')](function(_0x14a68e){if(_0x14a68e){_0x38124c=_0x14a68e;_0x530bd1[_0x1769('0x37')]=_[_0x1769('0x3a')](db[_0x1769('0x59')][_0x1769('0x35')]);_0x530bd1[_0x1769('0x39')]=_[_0x1769('0x3a')](_0x2a2086[_0x1769('0x39')]);_0x530bd1[_0x1769('0x3b')]=_[_0x1769('0x4d')](_0x530bd1[_0x1769('0x37')],_0x530bd1[_0x1769('0x39')]);_0x2f898d[_0x1769('0x3c')]=_[_0x1769('0x4d')](_0x530bd1[_0x1769('0x37')],qs[_0x1769('0x3d')](_0x2a2086[_0x1769('0x39')]['fields']));_0x2f898d[_0x1769('0x3c')]=_0x2f898d[_0x1769('0x3c')][_0x1769('0x4e')]?_0x2f898d['attributes']:_0x530bd1[_0x1769('0x37')];_0x2f898d[_0x1769('0x40')]=qs[_0x1769('0x41')](_0x2a2086[_0x1769('0x39')][_0x1769('0x41')]);_0x2f898d[_0x1769('0x44')]=qs[_0x1769('0x3b')](_[_0x1769('0x42')](_0x2a2086[_0x1769('0x39')],_0x530bd1[_0x1769('0x3b')]));if(_0x2a2086['query'][_0x1769('0x43')]){_0x2f898d[_0x1769('0x44')]=_['merge'](_0x2f898d[_0x1769('0x44')],{'$or':_[_0x1769('0x38')](_0x2f898d[_0x1769('0x3c')],function(_0x57469e){var _0x3d3b24={};_0x3d3b24[_0x57469e]={'$like':'%'+_0x2a2086[_0x1769('0x39')]['filter']+'%'};return _0x3d3b24;})});}_0x2f898d=_[_0x1769('0x45')]({},_0x2f898d,_0x2a2086[_0x1769('0x46')]);return _0x38124c[_0x1769('0x58')](_0x2f898d);}})[_0x1769('0x31')](function(_0x34144d){if(_0x34144d){_0x179f2a=_0x34144d[_0x1769('0x4e')];if(!_0x2a2086[_0x1769('0x39')]['hasOwnProperty'](_0x1769('0x3f'))){_0x2f898d[_0x1769('0x29')]=qs[_0x1769('0x29')](_0x2a2086[_0x1769('0x39')]['limit']);_0x2f898d['offset']=qs[_0x1769('0x2b')](_0x2a2086[_0x1769('0x39')][_0x1769('0x2b')]);}return _0x38124c[_0x1769('0x58')](_0x2f898d);}})[_0x1769('0x31')](function(_0x33f612){if(_0x33f612){return _0x33f612?{'count':_0x179f2a,'rows':_0x33f612}:null;}})[_0x1769('0x31')](respondWithResult(_0x45e352,null))['catch'](handleError(_0x45e352,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index 799c61f..079237a 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 _0xf3cd=['path','rimraf','../../config/environment','exports','define','Dynamics365Configuration','int_dynamics365_configurations','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x425bb9,_0x184b7f){var _0x16c925=function(_0x366eec){while(--_0x366eec){_0x425bb9['push'](_0x425bb9['shift']());}};_0x16c925(++_0x184b7f);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x5b0741,_0x438df7){_0x5b0741=_0x5b0741-0x0;var _0x3ee9c9=_0xf3cd[_0x5b0741];return _0x3ee9c9;};'use strict';var _=require(_0xdf3c('0x0'));var util=require(_0xdf3c('0x1'));var logger=require(_0xdf3c('0x2'))(_0xdf3c('0x3'));var moment=require(_0xdf3c('0x4'));var BPromise=require(_0xdf3c('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdf3c('0x6'));var rimraf=require(_0xdf3c('0x7'));var config=require(_0xdf3c('0x8'));var attributes=require('./intDynamics365Configuration.attributes');module[_0xdf3c('0x9')]=function(_0x17d42a,_0x1313d5){return _0x17d42a[_0xdf3c('0xa')](_0xdf3c('0xb'),attributes,{'tableName':_0xdf3c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6f0d=['./intDynamics365Configuration.attributes','define','Dynamics365Configuration','int_dynamics365_configurations','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0xef8146,_0x459c34){var _0x5a6cb0=function(_0x2f84ec){while(--_0x2f84ec){_0xef8146['push'](_0xef8146['shift']());}};_0x5a6cb0(++_0x459c34);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x3ee46c,_0x157980){_0x3ee46c=_0x3ee46c-0x0;var _0x2dd087=_0x6f0d[_0x3ee46c];return _0x2dd087;};'use strict';var _=require('lodash');var util=require(_0xd6f0('0x0'));var logger=require(_0xd6f0('0x1'))(_0xd6f0('0x2'));var moment=require(_0xd6f0('0x3'));var BPromise=require('bluebird');var rp=require(_0xd6f0('0x4'));var fs=require('fs');var path=require(_0xd6f0('0x5'));var rimraf=require(_0xd6f0('0x6'));var config=require(_0xd6f0('0x7'));var attributes=require(_0xd6f0('0x8'));module['exports']=function(_0x2d2ce6,_0x4a8b0c){return _0x2d2ce6[_0xd6f0('0x9')](_0xd6f0('0xa'),attributes,{'tableName':_0xd6f0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js index 1ddae68..844e237 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 _0xb8d2=['bluebird','randomstring','../../config/utils','../../config/logger','rpc','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','moment'];(function(_0x1abdef,_0x53f2e9){var _0xd5f5bb=function(_0x587875){while(--_0x587875){_0x1abdef['push'](_0x1abdef['shift']());}};_0xd5f5bb(++_0x53f2e9);}(_0xb8d2,0x6b));var _0x2b8d=function(_0x103762,_0x39d529){_0x103762=_0x103762-0x0;var _0x24844e=_0xb8d2[_0x103762];return _0x24844e;};'use strict';var _=require(_0x2b8d('0x0'));var util=require(_0x2b8d('0x1'));var moment=require(_0x2b8d('0x2'));var BPromise=require(_0x2b8d('0x3'));var rs=require(_0x2b8d('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x2b8d('0x5'));var logger=require(_0x2b8d('0x6'))(_0x2b8d('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x2b8d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1f0af5,_0x41e962,_0x5d85be){return new BPromise(function(_0x3e0e71,_0x5464e2){return client[_0x2b8d('0x9')](_0x1f0af5,_0x5d85be)[_0x2b8d('0xa')](function(_0x59f662){logger[_0x2b8d('0xb')](_0x2b8d('0xc'),_0x41e962,_0x2b8d('0xd'));logger[_0x2b8d('0xe')](_0x2b8d('0xf'),_0x41e962,'request\x20sent',JSON[_0x2b8d('0x10')](_0x59f662));if(_0x59f662[_0x2b8d('0x11')]){if(_0x59f662[_0x2b8d('0x11')][_0x2b8d('0x12')]===0x1f4){logger['error'](_0x2b8d('0xc'),_0x41e962,_0x59f662[_0x2b8d('0x11')][_0x2b8d('0x13')]);return _0x5464e2(_0x59f662['error'][_0x2b8d('0x13')]);}logger[_0x2b8d('0x11')](_0x2b8d('0xc'),_0x41e962,_0x59f662[_0x2b8d('0x11')][_0x2b8d('0x13')]);return _0x3e0e71(_0x59f662['error']['message']);}else{logger[_0x2b8d('0xb')]('Dynamics365Configuration,\x20%s,\x20%s',_0x41e962,'request\x20sent');_0x3e0e71(_0x59f662[_0x2b8d('0x14')][_0x2b8d('0x13')]);}})[_0x2b8d('0x15')](function(_0x4a0f4c){logger[_0x2b8d('0x11')](_0x2b8d('0xc'),_0x41e962,_0x4a0f4c);_0x5464e2(_0x4a0f4c);});});} \ No newline at end of file +var _0x4a4a=['request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','info','Dynamics365Configuration,\x20%s,\x20%s'];(function(_0x6d91a,_0x3c06dc){var _0x405faf=function(_0x4b157a){while(--_0x4b157a){_0x6d91a['push'](_0x6d91a['shift']());}};_0x405faf(++_0x3c06dc);}(_0x4a4a,0x1ec));var _0xa4a4=function(_0x1d4186,_0x5086b6){_0x1d4186=_0x1d4186-0x0;var _0x3c9879=_0x4a4a[_0x1d4186];return _0x3c9879;};'use strict';var _=require(_0xa4a4('0x0'));var util=require(_0xa4a4('0x1'));var moment=require(_0xa4a4('0x2'));var BPromise=require('bluebird');var rs=require(_0xa4a4('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa4a4('0x4'))['db'];var utils=require(_0xa4a4('0x5'));var logger=require('../../config/logger')(_0xa4a4('0x6'));var config=require(_0xa4a4('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xa4a4('0x8')][_0xa4a4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x33dc6b,_0x253aef,_0x18e72d){return new BPromise(function(_0x132d21,_0x1850cf){return client[_0xa4a4('0xa')](_0x33dc6b,_0x18e72d)[_0xa4a4('0xb')](function(_0x2aa5e0){logger[_0xa4a4('0xc')](_0xa4a4('0xd'),_0x253aef,_0xa4a4('0xe'));logger[_0xa4a4('0xf')](_0xa4a4('0x10'),_0x253aef,_0xa4a4('0xe'),JSON[_0xa4a4('0x11')](_0x2aa5e0));if(_0x2aa5e0[_0xa4a4('0x12')]){if(_0x2aa5e0['error'][_0xa4a4('0x13')]===0x1f4){logger[_0xa4a4('0x12')]('Dynamics365Configuration,\x20%s,\x20%s',_0x253aef,_0x2aa5e0[_0xa4a4('0x12')][_0xa4a4('0x14')]);return _0x1850cf(_0x2aa5e0[_0xa4a4('0x12')][_0xa4a4('0x14')]);}logger[_0xa4a4('0x12')](_0xa4a4('0xd'),_0x253aef,_0x2aa5e0['error'][_0xa4a4('0x14')]);return _0x132d21(_0x2aa5e0[_0xa4a4('0x12')][_0xa4a4('0x14')]);}else{logger['info'](_0xa4a4('0xd'),_0x253aef,'request\x20sent');_0x132d21(_0x2aa5e0[_0xa4a4('0x15')][_0xa4a4('0x14')]);}})[_0xa4a4('0x16')](function(_0x4691c0){logger[_0xa4a4('0x12')]('Dynamics365Configuration,\x20%s,\x20%s',_0x253aef,_0x4691c0);_0x1850cf(_0x4691c0);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index ff58d62..04a34b0 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 _0x739d=['show','post','create','put','/:id','delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated'];(function(_0x6eb833,_0x2bb5e5){var _0xdfc38c=function(_0x13c4a4){while(--_0x13c4a4){_0x6eb833['push'](_0x6eb833['shift']());}};_0xdfc38c(++_0x2bb5e5);}(_0x739d,0x1e4));var _0xd739=function(_0x4b5a0c,_0x4035f9){_0x4b5a0c=_0x4b5a0c-0x0;var _0x36244b=_0x739d[_0x4b5a0c];return _0x36244b;};'use strict';var multer=require(_0xd739('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xd739('0x1'));var express=require(_0xd739('0x2'));var router=express[_0xd739('0x3')]();var fs_extra=require(_0xd739('0x4'));var auth=require(_0xd739('0x5'));var interaction=require(_0xd739('0x6'));var config=require('../../config/environment');var controller=require('./intDynamics365Field.controller');router[_0xd739('0x7')]('/',auth[_0xd739('0x8')](),controller['index']);router[_0xd739('0x7')]('/:id',auth['isAuthenticated'](),controller[_0xd739('0x9')]);router[_0xd739('0xa')]('/',auth[_0xd739('0x8')](),controller[_0xd739('0xb')]);router[_0xd739('0xc')](_0xd739('0xd'),auth['isAuthenticated'](),controller['update']);router[_0xd739('0xe')](_0xd739('0xd'),auth[_0xd739('0x8')](),controller[_0xd739('0xf')]);module[_0xd739('0x10')]=router; \ No newline at end of file +var _0xd269=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Field.controller','isAuthenticated','index','get','/:id','show','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd269,0x1b2));var _0x9d26=function(_0x2c3fce,_0x1171dc){_0x2c3fce=_0x2c3fce-0x0;var _0xedc4a5=_0xd269[_0x2c3fce];return _0xedc4a5;};'use strict';var multer=require(_0x9d26('0x0'));var util=require(_0x9d26('0x1'));var path=require(_0x9d26('0x2'));var timeout=require(_0x9d26('0x3'));var express=require(_0x9d26('0x4'));var router=express[_0x9d26('0x5')]();var fs_extra=require(_0x9d26('0x6'));var auth=require(_0x9d26('0x7'));var interaction=require(_0x9d26('0x8'));var config=require(_0x9d26('0x9'));var controller=require(_0x9d26('0xa'));router['get']('/',auth[_0x9d26('0xb')](),controller[_0x9d26('0xc')]);router[_0x9d26('0xd')](_0x9d26('0xe'),auth[_0x9d26('0xb')](),controller[_0x9d26('0xf')]);router['post']('/',auth[_0x9d26('0xb')](),controller[_0x9d26('0x10')]);router[_0x9d26('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x9d26('0x12')]);router['delete'](_0x9d26('0xe'),auth[_0x9d26('0xb')](),controller[_0x9d26('0x13')]);module[_0x9d26('0x14')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index 6929edb..7bcf7fe 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 _0x8c7d=['variable','customVariable','keyValue','picklist','STRING','ENUM','BOOLEAN','sequelize','exports','string'];(function(_0x4791a9,_0x9a9a48){var _0x2664f6=function(_0x181704){while(--_0x181704){_0x4791a9['push'](_0x4791a9['shift']());}};_0x2664f6(++_0x9a9a48);}(_0x8c7d,0xf7));var _0xd8c7=function(_0x4455b7,_0x5762ee){_0x4455b7=_0x4455b7-0x0;var _0x45ab75=_0x8c7d[_0x4455b7];return _0x45ab75;};'use strict';var Sequelize=require(_0xd8c7('0x0'));module[_0xd8c7('0x1')]={'type':{'type':Sequelize['ENUM'](_0xd8c7('0x2'),_0xd8c7('0x3'),_0xd8c7('0x4'),_0xd8c7('0x5'),_0xd8c7('0x6')),'defaultValue':_0xd8c7('0x2')},'content':{'type':Sequelize[_0xd8c7('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xd8c7('0x8')](_0xd8c7('0x2'),_0xd8c7('0x3'),_0xd8c7('0x4'))},'keyContent':{'type':Sequelize[_0xd8c7('0x7')]},'idField':{'type':Sequelize[_0xd8c7('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xd8c7('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xd8c7('0x7')]}}; \ No newline at end of file +var _0x876c=['STRING','BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable','keyValue','picklist'];(function(_0x453fbf,_0x5c1c2a){var _0x2f7922=function(_0x19e44c){while(--_0x19e44c){_0x453fbf['push'](_0x453fbf['shift']());}};_0x2f7922(++_0x5c1c2a);}(_0x876c,0x98));var _0xc876=function(_0x29a591,_0x27ff3c){_0x29a591=_0x29a591-0x0;var _0x2e1900=_0x876c[_0x29a591];return _0x2e1900;};'use strict';var Sequelize=require(_0xc876('0x0'));module[_0xc876('0x1')]={'type':{'type':Sequelize[_0xc876('0x2')](_0xc876('0x3'),_0xc876('0x4'),_0xc876('0x5'),_0xc876('0x6'),_0xc876('0x7')),'defaultValue':_0xc876('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xc876('0x8')]},'keyType':{'type':Sequelize['ENUM'](_0xc876('0x3'),_0xc876('0x4'),_0xc876('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xc876('0x8')]},'nameField':{'type':Sequelize[_0xc876('0x8')]},'customField':{'type':Sequelize[_0xc876('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xc876('0x8')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index c2f42a7..5557844 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 _0x62cf=['attributes','fields','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','map','VIRTUAL','merge','Dynamics365Field','includeAll','include','findAll','rows','catch','show','params','rawAttributes','length','find','create','body','rimraf','moment','bluebird','sox','to-csv','ejs','fs-extra','lodash','squel','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','error','stack','name','index','type','key','model','query','keys','intersection'];(function(_0x70842e,_0x14b00b){var _0x3a828d=function(_0x4fa921){while(--_0x4fa921){_0x70842e['push'](_0x70842e['shift']());}};_0x3a828d(++_0x14b00b);}(_0x62cf,0xa6));var _0xf62c=function(_0x3d7e79,_0x44f087){_0x3d7e79=_0x3d7e79-0x0;var _0x33809f=_0x62cf[_0x3d7e79];return _0x33809f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf62c('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xf62c('0x1'));var BPromise=require(_0xf62c('0x2'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xf62c('0x3'));var csv=require(_0xf62c('0x4'));var ejs=require(_0xf62c('0x5'));var fs=require('fs');var fs_extra=require(_0xf62c('0x6'));var _=require(_0xf62c('0x7'));var squel=require(_0xf62c('0x8'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xf62c('0x4'));var querystring=require(_0xf62c('0x9'));var Papa=require(_0xf62c('0xa'));var Redis=require(_0xf62c('0xb'));var authService=require(_0xf62c('0xc'));var qs=require('../../components/parsers/qs');var as=require(_0xf62c('0xd'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf62c('0xe'))(_0xf62c('0xf'));var utils=require(_0xf62c('0x10'));var config=require(_0xf62c('0x11'));var licenseUtil=require('../../config/license/util');var db=require(_0xf62c('0x12'))['db'];function respondWithStatusCode(_0x58f5b4,_0x5bcbb7){_0x5bcbb7=_0x5bcbb7||0xcc;return function(_0xcd218c){if(_0xcd218c){return _0x58f5b4[_0xf62c('0x13')](_0x5bcbb7);}return _0x58f5b4['status'](_0x5bcbb7)[_0xf62c('0x14')]();};}function respondWithResult(_0x11fe56,_0x3ec1ff){_0x3ec1ff=_0x3ec1ff||0xc8;return function(_0xc1fc94){if(_0xc1fc94){return _0x11fe56[_0xf62c('0x15')](_0x3ec1ff)[_0xf62c('0x16')](_0xc1fc94);}};}function respondWithFilteredResult(_0x2e4411,_0x53d215){return function(_0x4b212c){if(_0x4b212c){var _0x2177f1=typeof _0x53d215[_0xf62c('0x17')]===_0xf62c('0x18')&&typeof _0x53d215[_0xf62c('0x19')]===_0xf62c('0x18');var _0x5aff2d=_0x4b212c['count'];var _0x4cde32=_0x2177f1?0x0:_0x53d215[_0xf62c('0x17')];var _0x329c70=_0x2177f1?_0x4b212c[_0xf62c('0x1a')]:_0x53d215[_0xf62c('0x17')]+_0x53d215[_0xf62c('0x19')];var _0x54a470;if(_0x329c70>=_0x5aff2d){_0x329c70=_0x5aff2d;_0x54a470=0xc8;}else{_0x54a470=0xce;}_0x2e4411[_0xf62c('0x15')](_0x54a470);return _0x2e4411[_0xf62c('0x1b')]('Content-Range',_0x4cde32+'-'+_0x329c70+'/'+_0x5aff2d)[_0xf62c('0x16')](_0x4b212c);}return null;};}function patchUpdates(_0xb0d4d8){return function(_0x57d63f){try{jsonpatch[_0xf62c('0x1c')](_0x57d63f,_0xb0d4d8,!![]);}catch(_0x51fed7){return BPromise[_0xf62c('0x1d')](_0x51fed7);}return _0x57d63f[_0xf62c('0x1e')]();};}function saveUpdates(_0x1f07f4,_0xadaf62){return function(_0x33a1ef){if(_0x33a1ef){return _0x33a1ef[_0xf62c('0x1f')](_0x1f07f4)[_0xf62c('0x20')](function(_0x11c16d){return _0x11c16d;});}return null;};}function removeEntity(_0x227339,_0xe7e55a){return function(_0x155573){if(_0x155573){return _0x155573[_0xf62c('0x21')]()[_0xf62c('0x20')](function(){_0x227339[_0xf62c('0x15')](0xcc)[_0xf62c('0x14')]();});}};}function handleEntityNotFound(_0x23e99f,_0x3e59c1){return function(_0x5ed254){if(!_0x5ed254){_0x23e99f[_0xf62c('0x13')](0x194);}return _0x5ed254;};}function handleError(_0x396cad,_0x5a84af){_0x5a84af=_0x5a84af||0x1f4;return function(_0x2f9a61){logger[_0xf62c('0x22')](_0x2f9a61[_0xf62c('0x23')]);if(_0x2f9a61[_0xf62c('0x24')]){delete _0x2f9a61[_0xf62c('0x24')];}_0x396cad[_0xf62c('0x15')](_0x5a84af)['send'](_0x2f9a61);};}exports[_0xf62c('0x25')]=function(_0x586ab3,_0x1f25ed){var _0x8917f4={},_0x178435={},_0x35daf3={'count':0x0,'rows':[]};var _0xd4177d=_['map'](db['Dynamics365Field']['rawAttributes'],function(_0x4ae2a0){return{'name':_0x4ae2a0['fieldName'],'type':_0x4ae2a0[_0xf62c('0x26')][_0xf62c('0x27')]};});_0x178435[_0xf62c('0x28')]=_['map'](_0xd4177d,'name');_0x178435[_0xf62c('0x29')]=_[_0xf62c('0x2a')](_0x586ab3[_0xf62c('0x29')]);_0x178435['filters']=_[_0xf62c('0x2b')](_0x178435[_0xf62c('0x28')],_0x178435['query']);_0x8917f4[_0xf62c('0x2c')]=_['intersection'](_0x178435[_0xf62c('0x28')],qs['fields'](_0x586ab3[_0xf62c('0x29')][_0xf62c('0x2d')]));_0x8917f4[_0xf62c('0x2c')]=_0x8917f4[_0xf62c('0x2c')]['length']?_0x8917f4[_0xf62c('0x2c')]:_0x178435['model'];if(!_0x586ab3[_0xf62c('0x29')][_0xf62c('0x2e')](_0xf62c('0x2f'))){_0x8917f4[_0xf62c('0x19')]=qs[_0xf62c('0x19')](_0x586ab3['query'][_0xf62c('0x19')]);_0x8917f4[_0xf62c('0x17')]=qs[_0xf62c('0x17')](_0x586ab3['query'][_0xf62c('0x17')]);}_0x8917f4[_0xf62c('0x30')]=qs[_0xf62c('0x31')](_0x586ab3[_0xf62c('0x29')][_0xf62c('0x31')]);_0x8917f4['where']=qs[_0xf62c('0x32')](_[_0xf62c('0x33')](_0x586ab3[_0xf62c('0x29')],_0x178435[_0xf62c('0x32')]),_0xd4177d);if(_0x586ab3[_0xf62c('0x29')][_0xf62c('0x34')]){_0x8917f4[_0xf62c('0x35')]=_['merge'](_0x8917f4[_0xf62c('0x35')],{'$or':_[_0xf62c('0x36')](_0xd4177d,function(_0x310b6f){if(_0x310b6f['type']!==_0xf62c('0x37')){var _0xf8147f={};_0xf8147f[_0x310b6f[_0xf62c('0x24')]]={'$like':'%'+_0x586ab3[_0xf62c('0x29')]['filter']+'%'};return _0xf8147f;}})});}_0x8917f4=_[_0xf62c('0x38')]({},_0x8917f4,_0x586ab3['options']);var _0x210e6b={'where':_0x8917f4[_0xf62c('0x35')]};return db[_0xf62c('0x39')]['count'](_0x210e6b)['then'](function(_0x2a5f94){_0x35daf3[_0xf62c('0x1a')]=_0x2a5f94;if(_0x586ab3[_0xf62c('0x29')][_0xf62c('0x3a')]){_0x8917f4[_0xf62c('0x3b')]=[{'all':!![]}];}return db[_0xf62c('0x39')][_0xf62c('0x3c')](_0x8917f4);})[_0xf62c('0x20')](function(_0x876b5d){_0x35daf3[_0xf62c('0x3d')]=_0x876b5d;return _0x35daf3;})[_0xf62c('0x20')](respondWithFilteredResult(_0x1f25ed,_0x8917f4))[_0xf62c('0x3e')](handleError(_0x1f25ed,null));};exports[_0xf62c('0x3f')]=function(_0x595b21,_0x2af3c2){var _0x153e28={'raw':!![],'where':{'id':_0x595b21[_0xf62c('0x40')]['id']}},_0x4042d6={};_0x4042d6['model']=_['keys'](db[_0xf62c('0x39')][_0xf62c('0x41')]);_0x4042d6[_0xf62c('0x29')]=_['keys'](_0x595b21[_0xf62c('0x29')]);_0x4042d6[_0xf62c('0x32')]=_[_0xf62c('0x2b')](_0x4042d6[_0xf62c('0x28')],_0x4042d6['query']);_0x153e28[_0xf62c('0x2c')]=_[_0xf62c('0x2b')](_0x4042d6['model'],qs[_0xf62c('0x2d')](_0x595b21['query'][_0xf62c('0x2d')]));_0x153e28[_0xf62c('0x2c')]=_0x153e28[_0xf62c('0x2c')][_0xf62c('0x42')]?_0x153e28[_0xf62c('0x2c')]:_0x4042d6[_0xf62c('0x28')];if(_0x595b21[_0xf62c('0x29')][_0xf62c('0x3a')]){_0x153e28[_0xf62c('0x3b')]=[{'all':!![]}];}_0x153e28=_[_0xf62c('0x38')]({},_0x153e28,_0x595b21['options']);return db[_0xf62c('0x39')][_0xf62c('0x43')](_0x153e28)[_0xf62c('0x20')](handleEntityNotFound(_0x2af3c2,null))[_0xf62c('0x20')](respondWithResult(_0x2af3c2,null))[_0xf62c('0x3e')](handleError(_0x2af3c2,null));};exports[_0xf62c('0x44')]=function(_0x309602,_0x582e69){return db[_0xf62c('0x39')]['create'](_0x309602[_0xf62c('0x45')],{})[_0xf62c('0x20')](respondWithResult(_0x582e69,0xc9))['catch'](handleError(_0x582e69,null));};exports[_0xf62c('0x1f')]=function(_0x2db925,_0x4fff1f){if(_0x2db925[_0xf62c('0x45')]['id']){delete _0x2db925[_0xf62c('0x45')]['id'];}return db['Dynamics365Field'][_0xf62c('0x43')]({'where':{'id':_0x2db925['params']['id']}})[_0xf62c('0x20')](handleEntityNotFound(_0x4fff1f,null))['then'](saveUpdates(_0x2db925[_0xf62c('0x45')],null))[_0xf62c('0x20')](respondWithResult(_0x4fff1f,null))[_0xf62c('0x3e')](handleError(_0x4fff1f,null));};exports[_0xf62c('0x21')]=function(_0x2f7894,_0x196437){return db['Dynamics365Field']['find']({'where':{'id':_0x2f7894[_0xf62c('0x40')]['id']}})[_0xf62c('0x20')](handleEntityNotFound(_0x196437,null))['then'](removeEntity(_0x196437,null))[_0xf62c('0x3e')](handleError(_0x196437,null));}; \ No newline at end of file +var _0xfee3=['sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','save','then','error','stack','name','Dynamics365Field','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','keys','find','create','body','update','destroy','params','eml-format','fast-json-patch','request-promise','moment','mustache','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x1e6db3,_0x5643ac){var _0x1de886=function(_0x351318){while(--_0x351318){_0x1e6db3['push'](_0x1e6db3['shift']());}};_0x1de886(++_0x5643ac);}(_0xfee3,0x152));var _0x3fee=function(_0x287a47,_0x2f731c){_0x287a47=_0x287a47-0x0;var _0x3fb726=_0xfee3[_0x287a47];return _0x3fb726;};'use strict';var emlformat=require(_0x3fee('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x3fee('0x1'));var rp=require(_0x3fee('0x2'));var moment=require(_0x3fee('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x3fee('0x4'));var util=require('util');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(_0x3fee('0x5'));var _=require(_0x3fee('0x6'));var squel=require(_0x3fee('0x7'));var crypto=require('crypto');var jsforce=require(_0x3fee('0x8'));var deskjs=require(_0x3fee('0x9'));var toCsv=require(_0x3fee('0xa'));var querystring=require(_0x3fee('0xb'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x3fee('0xc'));var qs=require(_0x3fee('0xd'));var as=require(_0x3fee('0xe'));var hardwareService=require(_0x3fee('0xf'));var logger=require(_0x3fee('0x10'))(_0x3fee('0x11'));var utils=require(_0x3fee('0x12'));var config=require(_0x3fee('0x13'));var licenseUtil=require(_0x3fee('0x14'));var db=require(_0x3fee('0x15'))['db'];function respondWithStatusCode(_0xaa11ca,_0x4eae02){_0x4eae02=_0x4eae02||0xcc;return function(_0x366fd5){if(_0x366fd5){return _0xaa11ca[_0x3fee('0x16')](_0x4eae02);}return _0xaa11ca[_0x3fee('0x17')](_0x4eae02)[_0x3fee('0x18')]();};}function respondWithResult(_0x4b28c2,_0x1b7ad7){_0x1b7ad7=_0x1b7ad7||0xc8;return function(_0xf344d5){if(_0xf344d5){return _0x4b28c2['status'](_0x1b7ad7)[_0x3fee('0x19')](_0xf344d5);}};}function respondWithFilteredResult(_0x426c3f,_0x25c6a3){return function(_0x4f5a5f){if(_0x4f5a5f){var _0x5c5504=typeof _0x25c6a3[_0x3fee('0x1a')]===_0x3fee('0x1b')&&typeof _0x25c6a3['limit']==='undefined';var _0x542404=_0x4f5a5f[_0x3fee('0x1c')];var _0x30b344=_0x5c5504?0x0:_0x25c6a3[_0x3fee('0x1a')];var _0x24844f=_0x5c5504?_0x4f5a5f[_0x3fee('0x1c')]:_0x25c6a3[_0x3fee('0x1a')]+_0x25c6a3['limit'];var _0x510853;if(_0x24844f>=_0x542404){_0x24844f=_0x542404;_0x510853=0xc8;}else{_0x510853=0xce;}_0x426c3f['status'](_0x510853);return _0x426c3f[_0x3fee('0x1d')](_0x3fee('0x1e'),_0x30b344+'-'+_0x24844f+'/'+_0x542404)[_0x3fee('0x19')](_0x4f5a5f);}return null;};}function patchUpdates(_0x5cc78c){return function(_0x38f8b8){try{jsonpatch[_0x3fee('0x1f')](_0x38f8b8,_0x5cc78c,!![]);}catch(_0x180380){return BPromise['reject'](_0x180380);}return _0x38f8b8[_0x3fee('0x20')]();};}function saveUpdates(_0x2f0165,_0x344db6){return function(_0x4a092c){if(_0x4a092c){return _0x4a092c['update'](_0x2f0165)[_0x3fee('0x21')](function(_0x2c1764){return _0x2c1764;});}return null;};}function removeEntity(_0xc6cb51,_0x1b2c5b){return function(_0x7ada10){if(_0x7ada10){return _0x7ada10['destroy']()[_0x3fee('0x21')](function(){_0xc6cb51[_0x3fee('0x17')](0xcc)[_0x3fee('0x18')]();});}};}function handleEntityNotFound(_0x2609eb,_0x92f79b){return function(_0x4b65d8){if(!_0x4b65d8){_0x2609eb[_0x3fee('0x16')](0x194);}return _0x4b65d8;};}function handleError(_0x5d409c,_0x1a0037){_0x1a0037=_0x1a0037||0x1f4;return function(_0xb41874){logger[_0x3fee('0x22')](_0xb41874[_0x3fee('0x23')]);if(_0xb41874[_0x3fee('0x24')]){delete _0xb41874['name'];}_0x5d409c[_0x3fee('0x17')](_0x1a0037)['send'](_0xb41874);};}exports['index']=function(_0x2c21a6,_0x546233){var _0x5cd2b0={},_0x325dce={},_0x42c78a={'count':0x0,'rows':[]};var _0x5973b2=_['map'](db[_0x3fee('0x25')][_0x3fee('0x26')],function(_0x1f4a79){return{'name':_0x1f4a79[_0x3fee('0x27')],'type':_0x1f4a79[_0x3fee('0x28')][_0x3fee('0x29')]};});_0x325dce[_0x3fee('0x2a')]=_[_0x3fee('0x2b')](_0x5973b2,_0x3fee('0x24'));_0x325dce[_0x3fee('0x2c')]=_['keys'](_0x2c21a6[_0x3fee('0x2c')]);_0x325dce[_0x3fee('0x2d')]=_[_0x3fee('0x2e')](_0x325dce[_0x3fee('0x2a')],_0x325dce['query']);_0x5cd2b0[_0x3fee('0x2f')]=_[_0x3fee('0x2e')](_0x325dce[_0x3fee('0x2a')],qs[_0x3fee('0x30')](_0x2c21a6['query'][_0x3fee('0x30')]));_0x5cd2b0[_0x3fee('0x2f')]=_0x5cd2b0[_0x3fee('0x2f')][_0x3fee('0x31')]?_0x5cd2b0['attributes']:_0x325dce['model'];if(!_0x2c21a6['query']['hasOwnProperty'](_0x3fee('0x32'))){_0x5cd2b0[_0x3fee('0x33')]=qs[_0x3fee('0x33')](_0x2c21a6[_0x3fee('0x2c')][_0x3fee('0x33')]);_0x5cd2b0[_0x3fee('0x1a')]=qs[_0x3fee('0x1a')](_0x2c21a6[_0x3fee('0x2c')]['offset']);}_0x5cd2b0[_0x3fee('0x34')]=qs[_0x3fee('0x35')](_0x2c21a6['query'][_0x3fee('0x35')]);_0x5cd2b0['where']=qs[_0x3fee('0x2d')](_[_0x3fee('0x36')](_0x2c21a6[_0x3fee('0x2c')],_0x325dce[_0x3fee('0x2d')]),_0x5973b2);if(_0x2c21a6['query'][_0x3fee('0x37')]){_0x5cd2b0[_0x3fee('0x38')]=_['merge'](_0x5cd2b0[_0x3fee('0x38')],{'$or':_['map'](_0x5973b2,function(_0x19f150){if(_0x19f150[_0x3fee('0x28')]!==_0x3fee('0x39')){var _0x403cf1={};_0x403cf1[_0x19f150[_0x3fee('0x24')]]={'$like':'%'+_0x2c21a6[_0x3fee('0x2c')][_0x3fee('0x37')]+'%'};return _0x403cf1;}})});}_0x5cd2b0=_[_0x3fee('0x3a')]({},_0x5cd2b0,_0x2c21a6[_0x3fee('0x3b')]);var _0x26d056={'where':_0x5cd2b0[_0x3fee('0x38')]};return db['Dynamics365Field'][_0x3fee('0x1c')](_0x26d056)[_0x3fee('0x21')](function(_0x35168b){_0x42c78a[_0x3fee('0x1c')]=_0x35168b;if(_0x2c21a6['query'][_0x3fee('0x3c')]){_0x5cd2b0[_0x3fee('0x3d')]=[{'all':!![]}];}return db[_0x3fee('0x25')][_0x3fee('0x3e')](_0x5cd2b0);})[_0x3fee('0x21')](function(_0x10612f){_0x42c78a[_0x3fee('0x3f')]=_0x10612f;return _0x42c78a;})[_0x3fee('0x21')](respondWithFilteredResult(_0x546233,_0x5cd2b0))[_0x3fee('0x40')](handleError(_0x546233,null));};exports['show']=function(_0x281f73,_0x3f03bd){var _0x23e571={'raw':!![],'where':{'id':_0x281f73['params']['id']}},_0x501ce9={};_0x501ce9[_0x3fee('0x2a')]=_[_0x3fee('0x41')](db[_0x3fee('0x25')][_0x3fee('0x26')]);_0x501ce9[_0x3fee('0x2c')]=_[_0x3fee('0x41')](_0x281f73[_0x3fee('0x2c')]);_0x501ce9[_0x3fee('0x2d')]=_[_0x3fee('0x2e')](_0x501ce9[_0x3fee('0x2a')],_0x501ce9['query']);_0x23e571[_0x3fee('0x2f')]=_[_0x3fee('0x2e')](_0x501ce9[_0x3fee('0x2a')],qs[_0x3fee('0x30')](_0x281f73[_0x3fee('0x2c')][_0x3fee('0x30')]));_0x23e571[_0x3fee('0x2f')]=_0x23e571[_0x3fee('0x2f')]['length']?_0x23e571[_0x3fee('0x2f')]:_0x501ce9['model'];if(_0x281f73[_0x3fee('0x2c')][_0x3fee('0x3c')]){_0x23e571[_0x3fee('0x3d')]=[{'all':!![]}];}_0x23e571=_[_0x3fee('0x3a')]({},_0x23e571,_0x281f73[_0x3fee('0x3b')]);return db[_0x3fee('0x25')][_0x3fee('0x42')](_0x23e571)[_0x3fee('0x21')](handleEntityNotFound(_0x3f03bd,null))[_0x3fee('0x21')](respondWithResult(_0x3f03bd,null))[_0x3fee('0x40')](handleError(_0x3f03bd,null));};exports[_0x3fee('0x43')]=function(_0x32ea81,_0x36f30e){return db['Dynamics365Field'][_0x3fee('0x43')](_0x32ea81[_0x3fee('0x44')],{})['then'](respondWithResult(_0x36f30e,0xc9))[_0x3fee('0x40')](handleError(_0x36f30e,null));};exports[_0x3fee('0x45')]=function(_0x42bada,_0x464ddb){if(_0x42bada[_0x3fee('0x44')]['id']){delete _0x42bada['body']['id'];}return db[_0x3fee('0x25')][_0x3fee('0x42')]({'where':{'id':_0x42bada['params']['id']}})[_0x3fee('0x21')](handleEntityNotFound(_0x464ddb,null))[_0x3fee('0x21')](saveUpdates(_0x42bada[_0x3fee('0x44')],null))[_0x3fee('0x21')](respondWithResult(_0x464ddb,null))[_0x3fee('0x40')](handleError(_0x464ddb,null));};exports[_0x3fee('0x46')]=function(_0x5ad151,_0xccacd7){return db[_0x3fee('0x25')][_0x3fee('0x42')]({'where':{'id':_0x5ad151[_0x3fee('0x47')]['id']}})[_0x3fee('0x21')](handleEntityNotFound(_0xccacd7,null))[_0x3fee('0x21')](removeEntity(_0xccacd7,null))[_0x3fee('0x40')](handleError(_0xccacd7,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index 8204d34..141805b 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 _0x941c=['./intDynamics365Field.attributes','Dynamics365Field','int_dynamics365_fields','dynamics365_unique_index','FieldId','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x472ee7,_0x302242){var _0x6aa3f3=function(_0x43beda){while(--_0x43beda){_0x472ee7['push'](_0x472ee7['shift']());}};_0x6aa3f3(++_0x302242);}(_0x941c,0x17e));var _0xc941=function(_0x52d821,_0x208cb2){_0x52d821=_0x52d821-0x0;var _0xda4561=_0x941c[_0x52d821];return _0xda4561;};'use strict';var _=require(_0xc941('0x0'));var util=require(_0xc941('0x1'));var logger=require('../../config/logger')(_0xc941('0x2'));var moment=require(_0xc941('0x3'));var BPromise=require(_0xc941('0x4'));var rp=require(_0xc941('0x5'));var fs=require('fs');var path=require(_0xc941('0x6'));var rimraf=require('rimraf');var config=require(_0xc941('0x7'));var attributes=require(_0xc941('0x8'));module['exports']=function(_0x430b21,_0x7f378e){return _0x430b21['define'](_0xc941('0x9'),attributes,{'tableName':_0xc941('0xa'),'paranoid':![],'indexes':[{'name':_0xc941('0xb'),'fields':['idField',_0xc941('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6f07=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDynamics365Field.attributes','exports','define','Dynamics365Field','int_dynamics365_fields','FieldId'];(function(_0x933bc9,_0x5de877){var _0x56c9a7=function(_0x4f87e0){while(--_0x4f87e0){_0x933bc9['push'](_0x933bc9['shift']());}};_0x56c9a7(++_0x5de877);}(_0x6f07,0xb0));var _0x76f0=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x6f07[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0x76f0('0x0'));var util=require(_0x76f0('0x1'));var logger=require(_0x76f0('0x2'))(_0x76f0('0x3'));var moment=require(_0x76f0('0x4'));var BPromise=require(_0x76f0('0x5'));var rp=require(_0x76f0('0x6'));var fs=require('fs');var path=require(_0x76f0('0x7'));var rimraf=require(_0x76f0('0x8'));var config=require(_0x76f0('0x9'));var attributes=require(_0x76f0('0xa'));module[_0x76f0('0xb')]=function(_0x24fa5e,_0x5222d9){return _0x24fa5e[_0x76f0('0xc')](_0x76f0('0xd'),attributes,{'tableName':_0x76f0('0xe'),'paranoid':![],'indexes':[{'name':'dynamics365_unique_index','fields':['idField',_0x76f0('0xf')],'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 34f95cd..f3f213b 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 _0x8a37=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error','code','Dynamics365Field,\x20%s,\x20%s','message','lodash','util'];(function(_0x1fd9e7,_0x24cdbe){var _0x1781f2=function(_0x2bd0a3){while(--_0x2bd0a3){_0x1fd9e7['push'](_0x1fd9e7['shift']());}};_0x1781f2(++_0x24cdbe);}(_0x8a37,0xd6));var _0x78a3=function(_0x2e8807,_0x10c988){_0x2e8807=_0x2e8807-0x0;var _0x49ee72=_0x8a37[_0x2e8807];return _0x49ee72;};'use strict';var _=require(_0x78a3('0x0'));var util=require(_0x78a3('0x1'));var moment=require(_0x78a3('0x2'));var BPromise=require(_0x78a3('0x3'));var rs=require(_0x78a3('0x4'));var fs=require('fs');var Redis=require(_0x78a3('0x5'));var db=require(_0x78a3('0x6'))['db'];var utils=require(_0x78a3('0x7'));var logger=require(_0x78a3('0x8'))(_0x78a3('0x9'));var config=require(_0x78a3('0xa'));var jayson=require(_0x78a3('0xb'));var client=jayson[_0x78a3('0xc')][_0x78a3('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x248199,_0x540a2f,_0x52e923){return new BPromise(function(_0x5a43a2,_0x1b3ba1){return client[_0x78a3('0xe')](_0x248199,_0x52e923)[_0x78a3('0xf')](function(_0x4e4e88){logger[_0x78a3('0x10')]('Dynamics365Field,\x20%s,\x20%s',_0x540a2f,_0x78a3('0x11'));logger['debug'](_0x78a3('0x12'),_0x540a2f,_0x78a3('0x11'),JSON[_0x78a3('0x13')](_0x4e4e88));if(_0x4e4e88[_0x78a3('0x14')]){if(_0x4e4e88[_0x78a3('0x14')][_0x78a3('0x15')]===0x1f4){logger['error'](_0x78a3('0x16'),_0x540a2f,_0x4e4e88[_0x78a3('0x14')][_0x78a3('0x17')]);return _0x1b3ba1(_0x4e4e88[_0x78a3('0x14')][_0x78a3('0x17')]);}logger['error'](_0x78a3('0x16'),_0x540a2f,_0x4e4e88[_0x78a3('0x14')][_0x78a3('0x17')]);return _0x5a43a2(_0x4e4e88[_0x78a3('0x14')][_0x78a3('0x17')]);}else{logger['info'](_0x78a3('0x16'),_0x540a2f,_0x78a3('0x11'));_0x5a43a2(_0x4e4e88['result']['message']);}})['catch'](function(_0x4a6c01){logger[_0x78a3('0x14')](_0x78a3('0x16'),_0x540a2f,_0x4a6c01);_0x1b3ba1(_0x4a6c01);});});} \ No newline at end of file +var _0x0c83=['then','info','Dynamics365Field,\x20%s,\x20%s','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','http'];(function(_0x57071b,_0xbf2c06){var _0x2c428c=function(_0x3ece07){while(--_0x3ece07){_0x57071b['push'](_0x57071b['shift']());}};_0x2c428c(++_0xbf2c06);}(_0x0c83,0x1d9));var _0x30c8=function(_0x23967b,_0x2f448e){_0x23967b=_0x23967b-0x0;var _0x1ade8a=_0x0c83[_0x23967b];return _0x1ade8a;};'use strict';var _=require(_0x30c8('0x0'));var util=require(_0x30c8('0x1'));var moment=require(_0x30c8('0x2'));var BPromise=require(_0x30c8('0x3'));var rs=require(_0x30c8('0x4'));var fs=require('fs');var Redis=require(_0x30c8('0x5'));var db=require(_0x30c8('0x6'))['db'];var utils=require(_0x30c8('0x7'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x30c8('0x8'));var client=jayson[_0x30c8('0x9')][_0x30c8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x265647,_0x5a3baa,_0x4c73c9){return new BPromise(function(_0xcdf078,_0x4eeaf9){return client['request'](_0x265647,_0x4c73c9)[_0x30c8('0xb')](function(_0x427b20){logger[_0x30c8('0xc')](_0x30c8('0xd'),_0x5a3baa,'request\x20sent');logger[_0x30c8('0xe')](_0x30c8('0xf'),_0x5a3baa,'request\x20sent',JSON['stringify'](_0x427b20));if(_0x427b20[_0x30c8('0x10')]){if(_0x427b20[_0x30c8('0x10')][_0x30c8('0x11')]===0x1f4){logger[_0x30c8('0x10')](_0x30c8('0xd'),_0x5a3baa,_0x427b20[_0x30c8('0x10')][_0x30c8('0x12')]);return _0x4eeaf9(_0x427b20['error']['message']);}logger[_0x30c8('0x10')](_0x30c8('0xd'),_0x5a3baa,_0x427b20[_0x30c8('0x10')][_0x30c8('0x12')]);return _0xcdf078(_0x427b20['error'][_0x30c8('0x12')]);}else{logger[_0x30c8('0xc')](_0x30c8('0xd'),_0x5a3baa,_0x30c8('0x13'));_0xcdf078(_0x427b20[_0x30c8('0x14')][_0x30c8('0x12')]);}})[_0x30c8('0x15')](function(_0x291b57){logger[_0x30c8('0x10')](_0x30c8('0xd'),_0x5a3baa,_0x291b57);_0x4eeaf9(_0x291b57);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index 4419ed3..9a386ad 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 _0x9abe=['/:id','show','/:id/configurations','/:id/fields','getFields','post','create','put','update','destroy','exports','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index'];(function(_0x3a3c1e,_0x388b12){var _0x4ba9cf=function(_0x22abfb){while(--_0x22abfb){_0x3a3c1e['push'](_0x3a3c1e['shift']());}};_0x4ba9cf(++_0x388b12);}(_0x9abe,0x1e6));var _0xe9ab=function(_0x322eca,_0x94b217){_0x322eca=_0x322eca-0x0;var _0xd86623=_0x9abe[_0x322eca];return _0xd86623;};'use strict';var multer=require('multer');var util=require(_0xe9ab('0x0'));var path=require(_0xe9ab('0x1'));var timeout=require(_0xe9ab('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xe9ab('0x3'));var interaction=require(_0xe9ab('0x4'));var config=require('../../config/environment');var controller=require('./intFreshdeskAccount.controller');router[_0xe9ab('0x5')]('/',auth[_0xe9ab('0x6')](),controller[_0xe9ab('0x7')]);router['get'](_0xe9ab('0x8'),auth['isAuthenticated'](),controller[_0xe9ab('0x9')]);router[_0xe9ab('0x5')](_0xe9ab('0xa'),auth[_0xe9ab('0x6')](),controller['getConfigurations']);router['get'](_0xe9ab('0xb'),auth[_0xe9ab('0x6')](),controller[_0xe9ab('0xc')]);router[_0xe9ab('0xd')]('/',auth[_0xe9ab('0x6')](),controller[_0xe9ab('0xe')]);router[_0xe9ab('0xd')]('/:id/configurations',auth[_0xe9ab('0x6')](),controller['addConfiguration']);router[_0xe9ab('0xf')](_0xe9ab('0x8'),auth[_0xe9ab('0x6')](),controller[_0xe9ab('0x10')]);router['delete'](_0xe9ab('0x8'),auth[_0xe9ab('0x6')](),controller[_0xe9ab('0x11')]);module[_0xe9ab('0x12')]=router; \ No newline at end of file +var _0x77c2=['create','addConfiguration','put','/:id','update','destroy','exports','multer','util','path','Router','fs-extra','../../components/auth/service','./intFreshdeskAccount.controller','get','index','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x77c2,0x149));var _0x277c=function(_0x6aaa69,_0x4457b5){_0x6aaa69=_0x6aaa69-0x0;var _0x25359f=_0x77c2[_0x6aaa69];return _0x25359f;};'use strict';var multer=require(_0x277c('0x0'));var util=require(_0x277c('0x1'));var path=require(_0x277c('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x277c('0x3')]();var fs_extra=require(_0x277c('0x4'));var auth=require(_0x277c('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x277c('0x6'));router[_0x277c('0x7')]('/',auth['isAuthenticated'](),controller[_0x277c('0x8')]);router['get']('/:id',auth[_0x277c('0x9')](),controller[_0x277c('0xa')]);router['get'](_0x277c('0xb'),auth[_0x277c('0x9')](),controller[_0x277c('0xc')]);router[_0x277c('0x7')](_0x277c('0xd'),auth['isAuthenticated'](),controller[_0x277c('0xe')]);router[_0x277c('0xf')]('/',auth['isAuthenticated'](),controller[_0x277c('0x10')]);router[_0x277c('0xf')](_0x277c('0xb'),auth['isAuthenticated'](),controller[_0x277c('0x11')]);router[_0x277c('0x12')](_0x277c('0x13'),auth['isAuthenticated'](),controller[_0x277c('0x14')]);router['delete'](_0x277c('0x13'),auth[_0x277c('0x9')](),controller[_0x277c('0x15')]);module[_0x277c('0x16')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index 0a52b07..c6f79cb 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 _0x5f2f=['exports','STRING','username','sequelize'];(function(_0x4e75f2,_0xd6ad9d){var _0x3cffa6=function(_0x9eff4a){while(--_0x9eff4a){_0x4e75f2['push'](_0x4e75f2['shift']());}};_0x3cffa6(++_0xd6ad9d);}(_0x5f2f,0x73));var _0xf5f2=function(_0x195948,_0x5dab51){_0x195948=_0x195948-0x0;var _0x20ad68=_0x5f2f[_0x195948];return _0x20ad68;};'use strict';var Sequelize=require(_0xf5f2('0x0'));module[_0xf5f2('0x1')]={'name':{'type':Sequelize[_0xf5f2('0x2')]},'description':{'type':Sequelize[_0xf5f2('0x2')]},'username':{'type':Sequelize[_0xf5f2('0x2')],'unique':_0xf5f2('0x3')},'apiKey':{'type':Sequelize[_0xf5f2('0x2')]},'remoteUri':{'type':Sequelize[_0xf5f2('0x2')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x5b12=['STRING','sequelize','exports'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x5b12,0xa3));var _0x25b1=function(_0x2ec8f1,_0x449219){_0x2ec8f1=_0x2ec8f1-0x0;var _0xbb7943=_0x5b12[_0x2ec8f1];return _0xbb7943;};'use strict';var Sequelize=require(_0x25b1('0x0'));module[_0x25b1('0x1')]={'name':{'type':Sequelize[_0x25b1('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x25b1('0x2')],'unique':'username'},'apiKey':{'type':Sequelize[_0x25b1('0x2')]},'remoteUri':{'type':Sequelize[_0x25b1('0x2')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x25b1('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index 0dbafdc..232a263 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 _0xd398=['getFields,\x20%s,\x20%s,\x20%s','test','Wrong\x20credentials','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','sox','ejs','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','../../components/integrations/configuration','jayson/promise','client','http','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','FreshdeskAccount,\x20%s,\x20%s','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','then','stack','name','send','index','map','FreshdeskAccount','key','model','query','keys','intersection','fields','attributes','hasOwnProperty','order','where','filters','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','create','body','find','getConfigurations','FreshdeskConfiguration','length','sort','pick','nolimit','addConfiguration','findOne','AccountId','getSubjects','channel','Descriptions','getDescriptions','FreshdeskField','getFields','remoteUri','apiKey','slice','substring','lastIndexOf','GET','format','api/v2/ticket_fields','Basic\x20%s','%s:X','toString','base64','requester','agent','description','priority','group','source','ticket_type','company','remove','includes','default','custom_text','custom_dropdown','choices','capitalize','statusCode'];(function(_0x11da75,_0xe7afce){var _0x49d700=function(_0x152d3c){while(--_0x152d3c){_0x11da75['push'](_0x11da75['shift']());}};_0x49d700(++_0xe7afce);}(_0xd398,0x83));var _0x8d39=function(_0x2ca7a6,_0x507a0d){_0x2ca7a6=_0x2ca7a6-0x0;var _0xce535e=_0xd398[_0x2ca7a6];return _0xce535e;};'use strict';var emlformat=require(_0x8d39('0x0'));var rimraf=require(_0x8d39('0x1'));var zipdir=require(_0x8d39('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8d39('0x3'));var moment=require('moment');var BPromise=require(_0x8d39('0x4'));var Mustache=require(_0x8d39('0x5'));var util=require('util');var path=require('path');var sox=require(_0x8d39('0x6'));var csv=require('to-csv');var ejs=require(_0x8d39('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x8d39('0x8'));var crypto=require(_0x8d39('0x9'));var jsforce=require(_0x8d39('0xa'));var deskjs=require(_0x8d39('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x8d39('0xc'));var Redis=require(_0x8d39('0xd'));var authService=require(_0x8d39('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x8d39('0xf'));var hardwareService=require(_0x8d39('0x10'));var logger=require(_0x8d39('0x11'))(_0x8d39('0x12'));var utils=require(_0x8d39('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x8d39('0x14'));var db=require(_0x8d39('0x15'))['db'];var integrations=require(_0x8d39('0x16'));var jayson=require(_0x8d39('0x17'));var client=jayson[_0x8d39('0x18')][_0x8d39('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x441ddb,_0x1e3467,_0x365c36,_0x3b9420){return new BPromise(function(_0x726af8,_0x35ded8){var _0x3966d2=_0x3b9420||client;return _0x3966d2['request'](_0x441ddb,_0x365c36)['then'](function(_0x5b7c5f){logger['info']('FreshdeskAccount,\x20%s,\x20%s',_0x1e3467,_0x8d39('0x1a'));logger[_0x8d39('0x1b')](_0x8d39('0x1c'),_0x1e3467,'request\x20sent',JSON[_0x8d39('0x1d')](_0x5b7c5f));if(_0x5b7c5f[_0x8d39('0x1e')]){if(_0x5b7c5f[_0x8d39('0x1e')][_0x8d39('0x1f')]===0x1f4){logger[_0x8d39('0x1e')]('FreshdeskAccount,\x20%s,\x20%s',_0x1e3467,_0x5b7c5f[_0x8d39('0x1e')][_0x8d39('0x20')]);return _0x35ded8(_0x5b7c5f['error'][_0x8d39('0x20')]);}logger[_0x8d39('0x1e')]('FreshdeskAccount,\x20%s,\x20%s',_0x1e3467,_0x5b7c5f[_0x8d39('0x1e')][_0x8d39('0x20')]);return _0x726af8(_0x5b7c5f['error']['message']);}else{logger['info'](_0x8d39('0x21'),_0x1e3467,'request\x20sent');_0x726af8(_0x5b7c5f[_0x8d39('0x22')]['message']);}})[_0x8d39('0x23')](function(_0x534281){logger[_0x8d39('0x1e')](_0x8d39('0x21'),_0x1e3467,_0x534281);_0x35ded8(_0x534281);});});}function respondWithStatusCode(_0x3d467c,_0x35a2d1){_0x35a2d1=_0x35a2d1||0xcc;return function(_0x993f54){if(_0x993f54){return _0x3d467c[_0x8d39('0x24')](_0x35a2d1);}return _0x3d467c[_0x8d39('0x25')](_0x35a2d1)[_0x8d39('0x26')]();};}function respondWithResult(_0x3d49cf,_0x1c3185){_0x1c3185=_0x1c3185||0xc8;return function(_0x14a326){if(_0x14a326){return _0x3d49cf[_0x8d39('0x25')](_0x1c3185)[_0x8d39('0x27')](_0x14a326);}};}function respondWithFilteredResult(_0x4bdcfa,_0x310778){return function(_0x1bb11c){if(_0x1bb11c){var _0x270bec=typeof _0x310778[_0x8d39('0x28')]===_0x8d39('0x29')&&typeof _0x310778[_0x8d39('0x2a')]===_0x8d39('0x29');var _0x29635e=_0x1bb11c[_0x8d39('0x2b')];var _0xf471ec=_0x270bec?0x0:_0x310778[_0x8d39('0x28')];var _0xdb62bd=_0x270bec?_0x1bb11c[_0x8d39('0x2b')]:_0x310778[_0x8d39('0x28')]+_0x310778[_0x8d39('0x2a')];var _0x2b6344;if(_0xdb62bd>=_0x29635e){_0xdb62bd=_0x29635e;_0x2b6344=0xc8;}else{_0x2b6344=0xce;}_0x4bdcfa[_0x8d39('0x25')](_0x2b6344);return _0x4bdcfa[_0x8d39('0x2c')](_0x8d39('0x2d'),_0xf471ec+'-'+_0xdb62bd+'/'+_0x29635e)[_0x8d39('0x27')](_0x1bb11c);}return null;};}function patchUpdates(_0x133549){return function(_0x1cf08e){try{jsonpatch[_0x8d39('0x2e')](_0x1cf08e,_0x133549,!![]);}catch(_0x580b49){return BPromise[_0x8d39('0x2f')](_0x580b49);}return _0x1cf08e['save']();};}function saveUpdates(_0x38a6ff,_0x152a47){return function(_0x19afe5){if(_0x19afe5){return _0x19afe5[_0x8d39('0x30')](_0x38a6ff)['then'](function(_0x5d4d2c){return _0x5d4d2c;});}return null;};}function removeEntity(_0x53ea39,_0x329fa9){return function(_0x3aa975){if(_0x3aa975){return _0x3aa975[_0x8d39('0x31')]()[_0x8d39('0x32')](function(){_0x53ea39[_0x8d39('0x25')](0xcc)[_0x8d39('0x26')]();});}};}function handleEntityNotFound(_0x53790b,_0x22a28b){return function(_0x2cbdbe){if(!_0x2cbdbe){_0x53790b['sendStatus'](0x194);}return _0x2cbdbe;};}function handleError(_0x5bd534,_0xdf2351){_0xdf2351=_0xdf2351||0x1f4;return function(_0x18f5a8){logger[_0x8d39('0x1e')](_0x18f5a8[_0x8d39('0x33')]);if(_0x18f5a8[_0x8d39('0x34')]){delete _0x18f5a8['name'];}_0x5bd534[_0x8d39('0x25')](_0xdf2351)[_0x8d39('0x35')](_0x18f5a8);};}exports[_0x8d39('0x36')]=function(_0x3e69a8,_0x2d4ef8){var _0xbe3d4a={},_0x499bc5={},_0xedca51={'count':0x0,'rows':[]};var _0x11d480=_[_0x8d39('0x37')](db[_0x8d39('0x38')]['rawAttributes'],function(_0x35bac9){return{'name':_0x35bac9['fieldName'],'type':_0x35bac9['type'][_0x8d39('0x39')]};});_0x499bc5[_0x8d39('0x3a')]=_[_0x8d39('0x37')](_0x11d480,'name');_0x499bc5[_0x8d39('0x3b')]=_[_0x8d39('0x3c')](_0x3e69a8[_0x8d39('0x3b')]);_0x499bc5['filters']=_[_0x8d39('0x3d')](_0x499bc5[_0x8d39('0x3a')],_0x499bc5[_0x8d39('0x3b')]);_0xbe3d4a['attributes']=_[_0x8d39('0x3d')](_0x499bc5['model'],qs[_0x8d39('0x3e')](_0x3e69a8[_0x8d39('0x3b')][_0x8d39('0x3e')]));_0xbe3d4a[_0x8d39('0x3f')]=_0xbe3d4a[_0x8d39('0x3f')]['length']?_0xbe3d4a['attributes']:_0x499bc5['model'];if(!_0x3e69a8['query'][_0x8d39('0x40')]('nolimit')){_0xbe3d4a[_0x8d39('0x2a')]=qs[_0x8d39('0x2a')](_0x3e69a8[_0x8d39('0x3b')][_0x8d39('0x2a')]);_0xbe3d4a['offset']=qs['offset'](_0x3e69a8[_0x8d39('0x3b')][_0x8d39('0x28')]);}_0xbe3d4a[_0x8d39('0x41')]=qs['sort'](_0x3e69a8[_0x8d39('0x3b')]['sort']);_0xbe3d4a[_0x8d39('0x42')]=qs[_0x8d39('0x43')](_['pick'](_0x3e69a8[_0x8d39('0x3b')],_0x499bc5['filters']),_0x11d480);if(_0x3e69a8[_0x8d39('0x3b')]['filter']){_0xbe3d4a['where']=_[_0x8d39('0x44')](_0xbe3d4a[_0x8d39('0x42')],{'$or':_['map'](_0x11d480,function(_0x1eaecf){if(_0x1eaecf[_0x8d39('0x45')]!==_0x8d39('0x46')){var _0x4bd6d4={};_0x4bd6d4[_0x1eaecf[_0x8d39('0x34')]]={'$like':'%'+_0x3e69a8[_0x8d39('0x3b')][_0x8d39('0x47')]+'%'};return _0x4bd6d4;}})});}_0xbe3d4a=_[_0x8d39('0x44')]({},_0xbe3d4a,_0x3e69a8[_0x8d39('0x48')]);var _0x28cc07={'where':_0xbe3d4a['where']};return db[_0x8d39('0x38')]['count'](_0x28cc07)[_0x8d39('0x32')](function(_0x1cd6cb){_0xedca51[_0x8d39('0x2b')]=_0x1cd6cb;if(_0x3e69a8['query'][_0x8d39('0x49')]){_0xbe3d4a[_0x8d39('0x4a')]=[{'all':!![]}];}return db[_0x8d39('0x38')][_0x8d39('0x4b')](_0xbe3d4a);})['then'](function(_0x40d5db){_0xedca51[_0x8d39('0x4c')]=_0x40d5db;return _0xedca51;})['then'](respondWithFilteredResult(_0x2d4ef8,_0xbe3d4a))[_0x8d39('0x23')](handleError(_0x2d4ef8,null));};exports[_0x8d39('0x4d')]=function(_0x32c9f3,_0x37b036){var _0x1355b4={'raw':![],'where':{'id':_0x32c9f3[_0x8d39('0x4e')]['id']}},_0x32d13e={};_0x32d13e[_0x8d39('0x3a')]=_['keys'](db['FreshdeskAccount']['rawAttributes']);_0x32d13e[_0x8d39('0x3b')]=_[_0x8d39('0x3c')](_0x32c9f3['query']);_0x32d13e[_0x8d39('0x43')]=_[_0x8d39('0x3d')](_0x32d13e[_0x8d39('0x3a')],_0x32d13e[_0x8d39('0x3b')]);_0x1355b4[_0x8d39('0x3f')]=_[_0x8d39('0x3d')](_0x32d13e[_0x8d39('0x3a')],qs[_0x8d39('0x3e')](_0x32c9f3['query'][_0x8d39('0x3e')]));_0x1355b4[_0x8d39('0x3f')]=_0x1355b4[_0x8d39('0x3f')]['length']?_0x1355b4['attributes']:_0x32d13e[_0x8d39('0x3a')];if(_0x32c9f3[_0x8d39('0x3b')]['includeAll']){_0x1355b4['include']=[{'all':!![]}];}_0x1355b4=_[_0x8d39('0x44')]({},_0x1355b4,_0x32c9f3['options']);return db[_0x8d39('0x38')]['find'](_0x1355b4)[_0x8d39('0x32')](handleEntityNotFound(_0x37b036,null))[_0x8d39('0x32')](respondWithResult(_0x37b036,null))[_0x8d39('0x23')](handleError(_0x37b036,null));};exports[_0x8d39('0x4f')]=function(_0x3a6a33,_0x530d2b){return db['FreshdeskAccount'][_0x8d39('0x4f')](_0x3a6a33[_0x8d39('0x50')],{})[_0x8d39('0x32')](respondWithResult(_0x530d2b,0xc9))['catch'](handleError(_0x530d2b,null));};exports['update']=function(_0x458737,_0x583445){if(_0x458737[_0x8d39('0x50')]['id']){delete _0x458737[_0x8d39('0x50')]['id'];}return db['FreshdeskAccount'][_0x8d39('0x51')]({'where':{'id':_0x458737[_0x8d39('0x4e')]['id']}})[_0x8d39('0x32')](handleEntityNotFound(_0x583445,null))[_0x8d39('0x32')](saveUpdates(_0x458737[_0x8d39('0x50')],null))['then'](respondWithResult(_0x583445,null))[_0x8d39('0x23')](handleError(_0x583445,null));};exports[_0x8d39('0x31')]=function(_0x337636,_0x47be18){return db['FreshdeskAccount']['find']({'where':{'id':_0x337636[_0x8d39('0x4e')]['id']}})[_0x8d39('0x32')](handleEntityNotFound(_0x47be18,null))[_0x8d39('0x32')](removeEntity(_0x47be18,null))[_0x8d39('0x23')](handleError(_0x47be18,null));};exports[_0x8d39('0x52')]=function(_0x3fb3a2,_0x236628,_0x108952){var _0x203a8e={};var _0x192b5a={};var _0x5b88f8;var _0x135f6e;return db['FreshdeskAccount']['findOne']({'where':{'id':_0x3fb3a2[_0x8d39('0x4e')]['id']}})[_0x8d39('0x32')](handleEntityNotFound(_0x236628,null))[_0x8d39('0x32')](function(_0x370042){if(_0x370042){_0x5b88f8=_0x370042;_0x192b5a[_0x8d39('0x3a')]=_[_0x8d39('0x3c')](db[_0x8d39('0x53')]['rawAttributes']);_0x192b5a[_0x8d39('0x3b')]=_[_0x8d39('0x3c')](_0x3fb3a2[_0x8d39('0x3b')]);_0x192b5a[_0x8d39('0x43')]=_[_0x8d39('0x3d')](_0x192b5a[_0x8d39('0x3a')],_0x192b5a[_0x8d39('0x3b')]);_0x203a8e[_0x8d39('0x3f')]=_[_0x8d39('0x3d')](_0x192b5a[_0x8d39('0x3a')],qs[_0x8d39('0x3e')](_0x3fb3a2[_0x8d39('0x3b')][_0x8d39('0x3e')]));_0x203a8e['attributes']=_0x203a8e[_0x8d39('0x3f')][_0x8d39('0x54')]?_0x203a8e[_0x8d39('0x3f')]:_0x192b5a[_0x8d39('0x3a')];_0x203a8e['order']=qs[_0x8d39('0x55')](_0x3fb3a2[_0x8d39('0x3b')][_0x8d39('0x55')]);_0x203a8e[_0x8d39('0x42')]=qs['filters'](_[_0x8d39('0x56')](_0x3fb3a2[_0x8d39('0x3b')],_0x192b5a[_0x8d39('0x43')]));if(_0x3fb3a2['query'][_0x8d39('0x47')]){_0x203a8e[_0x8d39('0x42')]=_[_0x8d39('0x44')](_0x203a8e[_0x8d39('0x42')],{'$or':_[_0x8d39('0x37')](_0x203a8e['attributes'],function(_0xd0b0cb){var _0x38f138={};_0x38f138[_0xd0b0cb]={'$like':'%'+_0x3fb3a2[_0x8d39('0x3b')][_0x8d39('0x47')]+'%'};return _0x38f138;})});}_0x203a8e=_['merge']({},_0x203a8e,_0x3fb3a2[_0x8d39('0x48')]);return _0x5b88f8['getConfigurations'](_0x203a8e);}})[_0x8d39('0x32')](function(_0x6d2db4){if(_0x6d2db4){_0x135f6e=_0x6d2db4['length'];if(!_0x3fb3a2[_0x8d39('0x3b')][_0x8d39('0x40')](_0x8d39('0x57'))){_0x203a8e[_0x8d39('0x2a')]=qs['limit'](_0x3fb3a2['query'][_0x8d39('0x2a')]);_0x203a8e[_0x8d39('0x28')]=qs[_0x8d39('0x28')](_0x3fb3a2[_0x8d39('0x3b')]['offset']);}return _0x5b88f8[_0x8d39('0x52')](_0x203a8e);}})['then'](function(_0x3383b9){if(_0x3383b9){return _0x3383b9?{'count':_0x135f6e,'rows':_0x3383b9}:null;}})['then'](respondWithResult(_0x236628,null))[_0x8d39('0x23')](handleError(_0x236628,null));};exports[_0x8d39('0x58')]=function(_0x366f86,_0x38e9a5,_0x49309f){if(_0x366f86[_0x8d39('0x50')]['id']){delete _0x366f86[_0x8d39('0x50')]['id'];}return db['FreshdeskAccount'][_0x8d39('0x59')]({'where':{'id':_0x366f86[_0x8d39('0x4e')]['id']}})[_0x8d39('0x32')](handleEntityNotFound(_0x38e9a5,null))['then'](function(_0xfdcad1){if(_0xfdcad1){_0x366f86['body'][_0x8d39('0x5a')]=_0xfdcad1['id'];_0x366f86['body']['Subjects']=integrations[_0x8d39('0x5b')](_0x366f86[_0x8d39('0x50')][_0x8d39('0x5c')],_0x366f86[_0x8d39('0x50')][_0x8d39('0x45')]);_0x366f86[_0x8d39('0x50')][_0x8d39('0x5d')]=integrations[_0x8d39('0x5e')](_0x366f86[_0x8d39('0x50')][_0x8d39('0x5c')],_0x366f86[_0x8d39('0x50')][_0x8d39('0x45')]);return db[_0x8d39('0x53')][_0x8d39('0x4f')](_0x366f86[_0x8d39('0x50')],{'include':[{'model':db[_0x8d39('0x5f')],'as':'Subjects'},{'model':db[_0x8d39('0x5f')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x38e9a5,null))[_0x8d39('0x23')](handleError(_0x38e9a5,null));};exports[_0x8d39('0x60')]=function(_0x351716,_0x24ff0e,_0x35b9a8){var _0x346736='';return db[_0x8d39('0x38')]['findOne']({'where':{'id':_0x351716[_0x8d39('0x4e')]['id']},'attributes':['id',_0x8d39('0x61'),_0x8d39('0x62')]})[_0x8d39('0x32')](handleEntityNotFound(_0x24ff0e,null))[_0x8d39('0x32')](function(_0x295345){if(_0x295345){_0x346736=_0x295345[_0x8d39('0x61')];var _0x5cee8b=_0x346736[_0x8d39('0x63')](-0x1);if(_0x5cee8b==='/'){_0x346736=_0x346736[_0x8d39('0x64')](0x0,_0x346736[_0x8d39('0x65')](_0x5cee8b));}return rp({'method':_0x8d39('0x66'),'uri':util[_0x8d39('0x67')]('%s/%s',_0x346736,_0x8d39('0x68')),'headers':{'Authorization':util[_0x8d39('0x67')](_0x8d39('0x69'),new Buffer(util[_0x8d39('0x67')](_0x8d39('0x6a'),_0x295345[_0x8d39('0x62')]))[_0x8d39('0x6b')](_0x8d39('0x6c')))},'json':!![]});}})[_0x8d39('0x32')](function(_0x55975f){if(_0x55975f){var _0xd3a6a5=[_0x8d39('0x6d'),'subject',_0x8d39('0x6e'),_0x8d39('0x6f'),'status',_0x8d39('0x70'),_0x8d39('0x71'),_0x8d39('0x72'),_0x8d39('0x73'),_0x8d39('0x71'),_0x8d39('0x74')];_[_0x8d39('0x75')](_0x55975f,function(_0x3931b9){return _0xd3a6a5[_0x8d39('0x76')](_0x3931b9[_0x8d39('0x34')])||!_0x3931b9[_0x8d39('0x77')]&&_0x3931b9[_0x8d39('0x45')]!==_0x8d39('0x78')&&_0x3931b9[_0x8d39('0x45')]!==_0x8d39('0x79');});return{'count':_0x55975f[_0x8d39('0x54')],'rows':_[_0x8d39('0x37')](_0x55975f,function(_0x40fc19){return{'id':_0x40fc19['name'],'name':_0x40fc19['label'],'custom':!_0x40fc19[_0x8d39('0x77')],'options':_0x40fc19['choices']?_['map'](_0x40fc19[_0x8d39('0x7a')],function(_0x2fa5c7){return{'name':_[_0x8d39('0x7b')](_0x2fa5c7),'value':_0x2fa5c7};}):[]};})};}})[_0x8d39('0x32')](respondWithResult(_0x24ff0e,null))['catch'](function(_0x1d8f71){var _0x4f35d2=_0x351716['query']['test']?0x1f4:_0x1d8f71[_0x8d39('0x7c')]||0x1f4;logger[_0x8d39('0x1e')](_0x8d39('0x7d'),'getFields',_0x4f35d2,JSON[_0x8d39('0x1d')](_0x1d8f71));delete _0x1d8f71[_0x8d39('0x34')];if(_0x4f35d2===0x191){_0x4f35d2=0x190;}_0x24ff0e['status'](_0x4f35d2)['send'](_0x351716[_0x8d39('0x3b')][_0x8d39('0x7e')]?{'message':_0x8d39('0x7f'),'statusCode':_0x1d8f71[_0x8d39('0x7c')]}:_0x1d8f71);});}; \ No newline at end of file +var _0x18ca=['crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','request','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','update','destroy','name','send','index','map','FreshdeskAccount','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','find','create','body','params','getConfigurations','addConfiguration','Subjects','channel','Descriptions','getDescriptions','FreshdeskConfiguration','FreshdeskField','getFields','findOne','remoteUri','apiKey','slice','lastIndexOf','GET','format','%s/%s','api/v2/ticket_fields','Basic\x20%s','%s:X','toString','requester','group','source','company','remove','custom_text','custom_dropdown','label','default','choices','capitalize','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel'];(function(_0x589b65,_0x8e8f8b){var _0x25e1f7=function(_0x546b62){while(--_0x546b62){_0x589b65['push'](_0x589b65['shift']());}};_0x25e1f7(++_0x8e8f8b);}(_0x18ca,0x6e));var _0xa18c=function(_0x2319ea,_0x27b3a5){_0x2319ea=_0x2319ea-0x0;var _0x526c28=_0x18ca[_0x2319ea];return _0x526c28;};'use strict';var emlformat=require(_0xa18c('0x0'));var rimraf=require(_0xa18c('0x1'));var zipdir=require(_0xa18c('0x2'));var jsonpatch=require(_0xa18c('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xa18c('0x4'));var Mustache=require(_0xa18c('0x5'));var util=require(_0xa18c('0x6'));var path=require(_0xa18c('0x7'));var sox=require(_0xa18c('0x8'));var csv=require(_0xa18c('0x9'));var ejs=require(_0xa18c('0xa'));var fs=require('fs');var fs_extra=require(_0xa18c('0xb'));var _=require(_0xa18c('0xc'));var squel=require(_0xa18c('0xd'));var crypto=require(_0xa18c('0xe'));var jsforce=require(_0xa18c('0xf'));var deskjs=require(_0xa18c('0x10'));var toCsv=require(_0xa18c('0x9'));var querystring=require('querystring');var Papa=require(_0xa18c('0x11'));var Redis=require('ioredis');var authService=require(_0xa18c('0x12'));var qs=require(_0xa18c('0x13'));var as=require(_0xa18c('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xa18c('0x15'));var utils=require(_0xa18c('0x16'));var config=require(_0xa18c('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xa18c('0x18'))['db'];var integrations=require(_0xa18c('0x19'));var jayson=require(_0xa18c('0x1a'));var client=jayson[_0xa18c('0x1b')][_0xa18c('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x17f6b4,_0x2afd3f,_0x5f3fc0,_0x42b661){return new BPromise(function(_0x5c2003,_0x4b433b){var _0x5c983d=_0x42b661||client;return _0x5c983d[_0xa18c('0x1d')](_0x17f6b4,_0x5f3fc0)[_0xa18c('0x1e')](function(_0x431aea){logger[_0xa18c('0x1f')](_0xa18c('0x20'),_0x2afd3f,_0xa18c('0x21'));logger[_0xa18c('0x22')]('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0x2afd3f,'request\x20sent',JSON[_0xa18c('0x23')](_0x431aea));if(_0x431aea[_0xa18c('0x24')]){if(_0x431aea['error']['code']===0x1f4){logger[_0xa18c('0x24')](_0xa18c('0x20'),_0x2afd3f,_0x431aea[_0xa18c('0x24')]['message']);return _0x4b433b(_0x431aea[_0xa18c('0x24')][_0xa18c('0x25')]);}logger[_0xa18c('0x24')](_0xa18c('0x20'),_0x2afd3f,_0x431aea['error'][_0xa18c('0x25')]);return _0x5c2003(_0x431aea[_0xa18c('0x24')][_0xa18c('0x25')]);}else{logger['info'](_0xa18c('0x20'),_0x2afd3f,_0xa18c('0x21'));_0x5c2003(_0x431aea[_0xa18c('0x26')][_0xa18c('0x25')]);}})['catch'](function(_0x2ec32e){logger['error'](_0xa18c('0x20'),_0x2afd3f,_0x2ec32e);_0x4b433b(_0x2ec32e);});});}function respondWithStatusCode(_0x1cd6f6,_0x52f0c8){_0x52f0c8=_0x52f0c8||0xcc;return function(_0x4782f1){if(_0x4782f1){return _0x1cd6f6[_0xa18c('0x27')](_0x52f0c8);}return _0x1cd6f6[_0xa18c('0x28')](_0x52f0c8)[_0xa18c('0x29')]();};}function respondWithResult(_0x14a5d7,_0x84944c){_0x84944c=_0x84944c||0xc8;return function(_0x12d563){if(_0x12d563){return _0x14a5d7['status'](_0x84944c)[_0xa18c('0x2a')](_0x12d563);}};}function respondWithFilteredResult(_0x49a4ff,_0x22a816){return function(_0x22d2c2){if(_0x22d2c2){var _0xc0916f=typeof _0x22a816[_0xa18c('0x2b')]===_0xa18c('0x2c')&&typeof _0x22a816[_0xa18c('0x2d')]===_0xa18c('0x2c');var _0xc17f0f=_0x22d2c2[_0xa18c('0x2e')];var _0x57616e=_0xc0916f?0x0:_0x22a816['offset'];var _0xd2fbbe=_0xc0916f?_0x22d2c2[_0xa18c('0x2e')]:_0x22a816[_0xa18c('0x2b')]+_0x22a816[_0xa18c('0x2d')];var _0x123dd6;if(_0xd2fbbe>=_0xc17f0f){_0xd2fbbe=_0xc17f0f;_0x123dd6=0xc8;}else{_0x123dd6=0xce;}_0x49a4ff['status'](_0x123dd6);return _0x49a4ff[_0xa18c('0x2f')](_0xa18c('0x30'),_0x57616e+'-'+_0xd2fbbe+'/'+_0xc17f0f)[_0xa18c('0x2a')](_0x22d2c2);}return null;};}function patchUpdates(_0x31367e){return function(_0x5c64fc){try{jsonpatch[_0xa18c('0x31')](_0x5c64fc,_0x31367e,!![]);}catch(_0x3ef6c0){return BPromise['reject'](_0x3ef6c0);}return _0x5c64fc['save']();};}function saveUpdates(_0x3c3519,_0x3cae57){return function(_0x577572){if(_0x577572){return _0x577572[_0xa18c('0x32')](_0x3c3519)[_0xa18c('0x1e')](function(_0x506904){return _0x506904;});}return null;};}function removeEntity(_0x556863,_0x21ef3b){return function(_0x2f4c53){if(_0x2f4c53){return _0x2f4c53[_0xa18c('0x33')]()[_0xa18c('0x1e')](function(){_0x556863[_0xa18c('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2f92bb,_0x543bf1){return function(_0x185efc){if(!_0x185efc){_0x2f92bb[_0xa18c('0x27')](0x194);}return _0x185efc;};}function handleError(_0x4b793c,_0x20ab16){_0x20ab16=_0x20ab16||0x1f4;return function(_0x386bc3){logger['error'](_0x386bc3['stack']);if(_0x386bc3[_0xa18c('0x34')]){delete _0x386bc3[_0xa18c('0x34')];}_0x4b793c[_0xa18c('0x28')](_0x20ab16)[_0xa18c('0x35')](_0x386bc3);};}exports[_0xa18c('0x36')]=function(_0x241e1b,_0x4c5592){var _0x9fad6e={},_0x3aa218={},_0x4e1eea={'count':0x0,'rows':[]};var _0x393bfd=_[_0xa18c('0x37')](db[_0xa18c('0x38')][_0xa18c('0x39')],function(_0x112602){return{'name':_0x112602[_0xa18c('0x3a')],'type':_0x112602[_0xa18c('0x3b')]['key']};});_0x3aa218['model']=_[_0xa18c('0x37')](_0x393bfd,_0xa18c('0x34'));_0x3aa218[_0xa18c('0x3c')]=_[_0xa18c('0x3d')](_0x241e1b[_0xa18c('0x3c')]);_0x3aa218[_0xa18c('0x3e')]=_[_0xa18c('0x3f')](_0x3aa218[_0xa18c('0x40')],_0x3aa218[_0xa18c('0x3c')]);_0x9fad6e[_0xa18c('0x41')]=_[_0xa18c('0x3f')](_0x3aa218['model'],qs[_0xa18c('0x42')](_0x241e1b[_0xa18c('0x3c')]['fields']));_0x9fad6e[_0xa18c('0x41')]=_0x9fad6e['attributes'][_0xa18c('0x43')]?_0x9fad6e[_0xa18c('0x41')]:_0x3aa218[_0xa18c('0x40')];if(!_0x241e1b[_0xa18c('0x3c')][_0xa18c('0x44')](_0xa18c('0x45'))){_0x9fad6e['limit']=qs[_0xa18c('0x2d')](_0x241e1b[_0xa18c('0x3c')][_0xa18c('0x2d')]);_0x9fad6e['offset']=qs[_0xa18c('0x2b')](_0x241e1b[_0xa18c('0x3c')][_0xa18c('0x2b')]);}_0x9fad6e[_0xa18c('0x46')]=qs[_0xa18c('0x47')](_0x241e1b[_0xa18c('0x3c')]['sort']);_0x9fad6e[_0xa18c('0x48')]=qs[_0xa18c('0x3e')](_[_0xa18c('0x49')](_0x241e1b[_0xa18c('0x3c')],_0x3aa218[_0xa18c('0x3e')]),_0x393bfd);if(_0x241e1b[_0xa18c('0x3c')][_0xa18c('0x4a')]){_0x9fad6e[_0xa18c('0x48')]=_[_0xa18c('0x4b')](_0x9fad6e['where'],{'$or':_[_0xa18c('0x37')](_0x393bfd,function(_0x6ff745){if(_0x6ff745[_0xa18c('0x3b')]!==_0xa18c('0x4c')){var _0x2c35bb={};_0x2c35bb[_0x6ff745[_0xa18c('0x34')]]={'$like':'%'+_0x241e1b[_0xa18c('0x3c')][_0xa18c('0x4a')]+'%'};return _0x2c35bb;}})});}_0x9fad6e=_[_0xa18c('0x4b')]({},_0x9fad6e,_0x241e1b[_0xa18c('0x4d')]);var _0x209c53={'where':_0x9fad6e[_0xa18c('0x48')]};return db[_0xa18c('0x38')][_0xa18c('0x2e')](_0x209c53)[_0xa18c('0x1e')](function(_0x5e40c6){_0x4e1eea[_0xa18c('0x2e')]=_0x5e40c6;if(_0x241e1b[_0xa18c('0x3c')][_0xa18c('0x4e')]){_0x9fad6e[_0xa18c('0x4f')]=[{'all':!![]}];}return db[_0xa18c('0x38')][_0xa18c('0x50')](_0x9fad6e);})[_0xa18c('0x1e')](function(_0x5d510c){_0x4e1eea[_0xa18c('0x51')]=_0x5d510c;return _0x4e1eea;})[_0xa18c('0x1e')](respondWithFilteredResult(_0x4c5592,_0x9fad6e))[_0xa18c('0x52')](handleError(_0x4c5592,null));};exports[_0xa18c('0x53')]=function(_0x1c5d2e,_0x1d8884){var _0x1d4cc9={'raw':![],'where':{'id':_0x1c5d2e['params']['id']}},_0xc47b35={};_0xc47b35[_0xa18c('0x40')]=_[_0xa18c('0x3d')](db[_0xa18c('0x38')][_0xa18c('0x39')]);_0xc47b35['query']=_['keys'](_0x1c5d2e['query']);_0xc47b35[_0xa18c('0x3e')]=_[_0xa18c('0x3f')](_0xc47b35[_0xa18c('0x40')],_0xc47b35[_0xa18c('0x3c')]);_0x1d4cc9[_0xa18c('0x41')]=_[_0xa18c('0x3f')](_0xc47b35[_0xa18c('0x40')],qs['fields'](_0x1c5d2e[_0xa18c('0x3c')]['fields']));_0x1d4cc9[_0xa18c('0x41')]=_0x1d4cc9['attributes'][_0xa18c('0x43')]?_0x1d4cc9['attributes']:_0xc47b35[_0xa18c('0x40')];if(_0x1c5d2e[_0xa18c('0x3c')][_0xa18c('0x4e')]){_0x1d4cc9[_0xa18c('0x4f')]=[{'all':!![]}];}_0x1d4cc9=_[_0xa18c('0x4b')]({},_0x1d4cc9,_0x1c5d2e[_0xa18c('0x4d')]);return db[_0xa18c('0x38')][_0xa18c('0x54')](_0x1d4cc9)['then'](handleEntityNotFound(_0x1d8884,null))[_0xa18c('0x1e')](respondWithResult(_0x1d8884,null))[_0xa18c('0x52')](handleError(_0x1d8884,null));};exports[_0xa18c('0x55')]=function(_0x4335f5,_0x138aa5){return db[_0xa18c('0x38')][_0xa18c('0x55')](_0x4335f5['body'],{})[_0xa18c('0x1e')](respondWithResult(_0x138aa5,0xc9))[_0xa18c('0x52')](handleError(_0x138aa5,null));};exports['update']=function(_0x5e0156,_0x825c99){if(_0x5e0156['body']['id']){delete _0x5e0156[_0xa18c('0x56')]['id'];}return db[_0xa18c('0x38')][_0xa18c('0x54')]({'where':{'id':_0x5e0156[_0xa18c('0x57')]['id']}})[_0xa18c('0x1e')](handleEntityNotFound(_0x825c99,null))['then'](saveUpdates(_0x5e0156[_0xa18c('0x56')],null))[_0xa18c('0x1e')](respondWithResult(_0x825c99,null))['catch'](handleError(_0x825c99,null));};exports[_0xa18c('0x33')]=function(_0x1a827e,_0x42ab1d){return db[_0xa18c('0x38')]['find']({'where':{'id':_0x1a827e[_0xa18c('0x57')]['id']}})[_0xa18c('0x1e')](handleEntityNotFound(_0x42ab1d,null))[_0xa18c('0x1e')](removeEntity(_0x42ab1d,null))[_0xa18c('0x52')](handleError(_0x42ab1d,null));};exports[_0xa18c('0x58')]=function(_0x441b45,_0x5b48e3,_0x977c13){var _0x597d40={};var _0x322796={};var _0x54d5ef;var _0x47a7eb;return db['FreshdeskAccount']['findOne']({'where':{'id':_0x441b45[_0xa18c('0x57')]['id']}})['then'](handleEntityNotFound(_0x5b48e3,null))[_0xa18c('0x1e')](function(_0xc686aa){if(_0xc686aa){_0x54d5ef=_0xc686aa;_0x322796[_0xa18c('0x40')]=_[_0xa18c('0x3d')](db['FreshdeskConfiguration']['rawAttributes']);_0x322796[_0xa18c('0x3c')]=_[_0xa18c('0x3d')](_0x441b45[_0xa18c('0x3c')]);_0x322796['filters']=_[_0xa18c('0x3f')](_0x322796[_0xa18c('0x40')],_0x322796[_0xa18c('0x3c')]);_0x597d40[_0xa18c('0x41')]=_[_0xa18c('0x3f')](_0x322796[_0xa18c('0x40')],qs[_0xa18c('0x42')](_0x441b45[_0xa18c('0x3c')]['fields']));_0x597d40[_0xa18c('0x41')]=_0x597d40[_0xa18c('0x41')][_0xa18c('0x43')]?_0x597d40[_0xa18c('0x41')]:_0x322796[_0xa18c('0x40')];_0x597d40['order']=qs[_0xa18c('0x47')](_0x441b45['query'][_0xa18c('0x47')]);_0x597d40[_0xa18c('0x48')]=qs[_0xa18c('0x3e')](_['pick'](_0x441b45['query'],_0x322796[_0xa18c('0x3e')]));if(_0x441b45[_0xa18c('0x3c')]['filter']){_0x597d40[_0xa18c('0x48')]=_[_0xa18c('0x4b')](_0x597d40[_0xa18c('0x48')],{'$or':_[_0xa18c('0x37')](_0x597d40[_0xa18c('0x41')],function(_0x3c80a6){var _0x4057da={};_0x4057da[_0x3c80a6]={'$like':'%'+_0x441b45[_0xa18c('0x3c')]['filter']+'%'};return _0x4057da;})});}_0x597d40=_[_0xa18c('0x4b')]({},_0x597d40,_0x441b45[_0xa18c('0x4d')]);return _0x54d5ef[_0xa18c('0x58')](_0x597d40);}})[_0xa18c('0x1e')](function(_0x58a3fb){if(_0x58a3fb){_0x47a7eb=_0x58a3fb[_0xa18c('0x43')];if(!_0x441b45[_0xa18c('0x3c')]['hasOwnProperty'](_0xa18c('0x45'))){_0x597d40[_0xa18c('0x2d')]=qs[_0xa18c('0x2d')](_0x441b45['query'][_0xa18c('0x2d')]);_0x597d40[_0xa18c('0x2b')]=qs['offset'](_0x441b45[_0xa18c('0x3c')][_0xa18c('0x2b')]);}return _0x54d5ef['getConfigurations'](_0x597d40);}})[_0xa18c('0x1e')](function(_0x34e1ee){if(_0x34e1ee){return _0x34e1ee?{'count':_0x47a7eb,'rows':_0x34e1ee}:null;}})[_0xa18c('0x1e')](respondWithResult(_0x5b48e3,null))['catch'](handleError(_0x5b48e3,null));};exports[_0xa18c('0x59')]=function(_0x3fbb21,_0x572d97,_0x2604f7){if(_0x3fbb21['body']['id']){delete _0x3fbb21[_0xa18c('0x56')]['id'];}return db[_0xa18c('0x38')]['findOne']({'where':{'id':_0x3fbb21[_0xa18c('0x57')]['id']}})[_0xa18c('0x1e')](handleEntityNotFound(_0x572d97,null))[_0xa18c('0x1e')](function(_0x4a9479){if(_0x4a9479){_0x3fbb21[_0xa18c('0x56')]['AccountId']=_0x4a9479['id'];_0x3fbb21[_0xa18c('0x56')][_0xa18c('0x5a')]=integrations['getSubjects'](_0x3fbb21[_0xa18c('0x56')][_0xa18c('0x5b')],_0x3fbb21[_0xa18c('0x56')][_0xa18c('0x3b')]);_0x3fbb21[_0xa18c('0x56')][_0xa18c('0x5c')]=integrations[_0xa18c('0x5d')](_0x3fbb21[_0xa18c('0x56')]['channel'],_0x3fbb21[_0xa18c('0x56')][_0xa18c('0x3b')]);return db[_0xa18c('0x5e')][_0xa18c('0x55')](_0x3fbb21[_0xa18c('0x56')],{'include':[{'model':db[_0xa18c('0x5f')],'as':'Subjects'},{'model':db[_0xa18c('0x5f')],'as':_0xa18c('0x5c')}]});}return null;})[_0xa18c('0x1e')](respondWithResult(_0x572d97,null))[_0xa18c('0x52')](handleError(_0x572d97,null));};exports[_0xa18c('0x60')]=function(_0x5e1537,_0x537660,_0x440a82){var _0x17da8e='';return db['FreshdeskAccount'][_0xa18c('0x61')]({'where':{'id':_0x5e1537['params']['id']},'attributes':['id',_0xa18c('0x62'),_0xa18c('0x63')]})[_0xa18c('0x1e')](handleEntityNotFound(_0x537660,null))[_0xa18c('0x1e')](function(_0x3d8e74){if(_0x3d8e74){_0x17da8e=_0x3d8e74[_0xa18c('0x62')];var _0x254472=_0x17da8e[_0xa18c('0x64')](-0x1);if(_0x254472==='/'){_0x17da8e=_0x17da8e['substring'](0x0,_0x17da8e[_0xa18c('0x65')](_0x254472));}return rp({'method':_0xa18c('0x66'),'uri':util[_0xa18c('0x67')](_0xa18c('0x68'),_0x17da8e,_0xa18c('0x69')),'headers':{'Authorization':util[_0xa18c('0x67')](_0xa18c('0x6a'),new Buffer(util['format'](_0xa18c('0x6b'),_0x3d8e74['apiKey']))[_0xa18c('0x6c')]('base64'))},'json':!![]});}})[_0xa18c('0x1e')](function(_0x13202b){if(_0x13202b){var _0x3f5c80=[_0xa18c('0x6d'),'subject','agent','description',_0xa18c('0x28'),'priority',_0xa18c('0x6e'),_0xa18c('0x6f'),'ticket_type',_0xa18c('0x6e'),_0xa18c('0x70')];_[_0xa18c('0x71')](_0x13202b,function(_0x39ebb7){return _0x3f5c80['includes'](_0x39ebb7[_0xa18c('0x34')])||!_0x39ebb7['default']&&_0x39ebb7[_0xa18c('0x3b')]!==_0xa18c('0x72')&&_0x39ebb7[_0xa18c('0x3b')]!==_0xa18c('0x73');});return{'count':_0x13202b['length'],'rows':_[_0xa18c('0x37')](_0x13202b,function(_0x129c54){return{'id':_0x129c54[_0xa18c('0x34')],'name':_0x129c54[_0xa18c('0x74')],'custom':!_0x129c54[_0xa18c('0x75')],'options':_0x129c54[_0xa18c('0x76')]?_[_0xa18c('0x37')](_0x129c54[_0xa18c('0x76')],function(_0x345749){return{'name':_[_0xa18c('0x77')](_0x345749),'value':_0x345749};}):[]};})};}})[_0xa18c('0x1e')](respondWithResult(_0x537660,null))[_0xa18c('0x52')](function(_0x1f5b5b){var _0x37282c=_0x5e1537[_0xa18c('0x3c')][_0xa18c('0x78')]?0x1f4:_0x1f5b5b[_0xa18c('0x79')]||0x1f4;logger['error'](_0xa18c('0x7a'),_0xa18c('0x60'),_0x37282c,JSON[_0xa18c('0x23')](_0x1f5b5b));delete _0x1f5b5b[_0xa18c('0x34')];if(_0x37282c===0x191){_0x37282c=0x190;}_0x537660[_0xa18c('0x28')](_0x37282c)[_0xa18c('0x35')](_0x5e1537[_0xa18c('0x3c')][_0xa18c('0x78')]?{'message':_0xa18c('0x7b'),'statusCode':_0x1f5b5b['statusCode']}:_0x1f5b5b);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index c1b5b93..8af4bc3 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 _0x4228=['../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports','define','FreshdeskAccount','int_freshdesk_accounts','util','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0xd546c5,_0x170bf1){var _0x19bcfd=function(_0x541edd){while(--_0x541edd){_0xd546c5['push'](_0xd546c5['shift']());}};_0x19bcfd(++_0x170bf1);}(_0x4228,0x19d));var _0x8422=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4228[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x8422('0x0'));var logger=require(_0x8422('0x1'))(_0x8422('0x2'));var moment=require(_0x8422('0x3'));var BPromise=require(_0x8422('0x4'));var rp=require(_0x8422('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8422('0x6'));var config=require(_0x8422('0x7'));var attributes=require(_0x8422('0x8'));var integrations=require(_0x8422('0x9'));module[_0x8422('0xa')]=function(_0x4b5192,_0x4d5e62){return _0x4b5192[_0x8422('0xb')](_0x8422('0xc'),attributes,{'tableName':_0x8422('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4d28=['../../components/integrations/configuration','exports','FreshdeskAccount','int_freshdesk_accounts','lodash','util','../../config/logger','bluebird','request-promise','rimraf','../../config/environment','./intFreshdeskAccount.attributes'];(function(_0x1c91da,_0x1de3ed){var _0x4cedfd=function(_0x536701){while(--_0x536701){_0x1c91da['push'](_0x1c91da['shift']());}};_0x4cedfd(++_0x1de3ed);}(_0x4d28,0xb8));var _0x84d2=function(_0x4df58e,_0xf2d8dd){_0x4df58e=_0x4df58e-0x0;var _0x16ac17=_0x4d28[_0x4df58e];return _0x16ac17;};'use strict';var _=require(_0x84d2('0x0'));var util=require(_0x84d2('0x1'));var logger=require(_0x84d2('0x2'))('api');var moment=require('moment');var BPromise=require(_0x84d2('0x3'));var rp=require(_0x84d2('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x84d2('0x5'));var config=require(_0x84d2('0x6'));var attributes=require(_0x84d2('0x7'));var integrations=require(_0x84d2('0x8'));module[_0x84d2('0x9')]=function(_0x283b52,_0x2e5ec8){return _0x283b52['define'](_0x84d2('0xa'),attributes,{'tableName':_0x84d2('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js index e41317e..479d7c5 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 _0x261b=['info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','FreshdeskAccount','options','raw','where','limit','map','model','attributes','include','GetFreshdeskAccount','find','ShowFreshdeskAccount','lodash','util','moment','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then'];(function(_0x5ba99c,_0x1805c3){var _0x2d354f=function(_0x5e68a0){while(--_0x5e68a0){_0x5ba99c['push'](_0x5ba99c['shift']());}};_0x2d354f(++_0x1805c3);}(_0x261b,0x195));var _0xb261=function(_0x46d837,_0x4ef27c){_0x46d837=_0x46d837-0x0;var _0x21d99a=_0x261b[_0x46d837];return _0x21d99a;};'use strict';var _=require(_0xb261('0x0'));var util=require(_0xb261('0x1'));var moment=require(_0xb261('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb261('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xb261('0x4'))(_0xb261('0x5'));var config=require(_0xb261('0x6'));var jayson=require(_0xb261('0x7'));var client=jayson['client'][_0xb261('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x57383f,_0x203068,_0x54b9da){return new BPromise(function(_0x293cc5,_0x38d63c){return client[_0xb261('0x9')](_0x57383f,_0x54b9da)[_0xb261('0xa')](function(_0x321eec){logger[_0xb261('0xb')](_0xb261('0xc'),_0x203068,_0xb261('0xd'));logger[_0xb261('0xe')]('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0x203068,_0xb261('0xd'),JSON[_0xb261('0xf')](_0x321eec));if(_0x321eec[_0xb261('0x10')]){if(_0x321eec[_0xb261('0x10')]['code']===0x1f4){logger['error'](_0xb261('0xc'),_0x203068,_0x321eec[_0xb261('0x10')][_0xb261('0x11')]);return _0x38d63c(_0x321eec[_0xb261('0x10')][_0xb261('0x11')]);}logger[_0xb261('0x10')](_0xb261('0xc'),_0x203068,_0x321eec[_0xb261('0x10')][_0xb261('0x11')]);return _0x293cc5(_0x321eec[_0xb261('0x10')][_0xb261('0x11')]);}else{logger[_0xb261('0xb')]('FreshdeskAccount,\x20%s,\x20%s',_0x203068,'request\x20sent');_0x293cc5(_0x321eec[_0xb261('0x12')][_0xb261('0x11')]);}})[_0xb261('0x13')](function(_0x566ae9){logger[_0xb261('0x10')]('FreshdeskAccount,\x20%s,\x20%s',_0x203068,_0x566ae9);_0x38d63c(_0x566ae9);});});}exports['GetFreshdeskAccount']=function(_0x1def7a){var _0x466ed9=this;return new Promise(function(_0x2a0bc3,_0xfe6e31){return db[_0xb261('0x14')]['findAll']({'raw':_0x1def7a[_0xb261('0x15')]?_0x1def7a[_0xb261('0x15')][_0xb261('0x16')]===undefined?!![]:![]:!![],'where':_0x1def7a[_0xb261('0x15')]?_0x1def7a[_0xb261('0x15')][_0xb261('0x17')]||null:null,'attributes':_0x1def7a['options']?_0x1def7a['options']['attributes']||null:null,'limit':_0x1def7a[_0xb261('0x15')]?_0x1def7a[_0xb261('0x15')][_0xb261('0x18')]||null:null,'include':_0x1def7a[_0xb261('0x15')]?_0x1def7a[_0xb261('0x15')]['include']?_[_0xb261('0x19')](_0x1def7a[_0xb261('0x15')]['include'],function(_0x410e01){return{'model':db[_0x410e01[_0xb261('0x1a')]],'as':_0x410e01['as'],'attributes':_0x410e01[_0xb261('0x1b')],'include':_0x410e01[_0xb261('0x1c')]?_[_0xb261('0x19')](_0x410e01[_0xb261('0x1c')],function(_0x258b99){return{'model':db[_0x258b99[_0xb261('0x1a')]],'as':_0x258b99['as'],'attributes':_0x258b99[_0xb261('0x1b')],'include':_0x258b99['include']?_[_0xb261('0x19')](_0x258b99[_0xb261('0x1c')],function(_0x3e08d3){return{'model':db[_0x3e08d3[_0xb261('0x1a')]],'as':_0x3e08d3['as'],'attributes':_0x3e08d3[_0xb261('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xb261('0xa')](function(_0x3803b7){logger[_0xb261('0xb')](_0xb261('0x1d'),_0x1def7a);logger[_0xb261('0xe')](_0xb261('0x1d'),_0x1def7a,JSON[_0xb261('0xf')](_0x3803b7));_0x2a0bc3(_0x3803b7);})[_0xb261('0x13')](function(_0xbbfbd8){logger['error']('GetFreshdeskAccount',_0xbbfbd8['message'],_0x1def7a);_0xfe6e31(_0x466ed9[_0xb261('0x10')](0x1f4,_0xbbfbd8['message']));});});};exports['ShowFreshdeskAccount']=function(_0x2cc77f){var _0x3a9556=this;return new Promise(function(_0x3008f5,_0x1c7d42){return db[_0xb261('0x14')][_0xb261('0x1e')]({'raw':_0x2cc77f[_0xb261('0x15')]?_0x2cc77f['options']['raw']===undefined?!![]:![]:!![],'where':_0x2cc77f[_0xb261('0x15')]?_0x2cc77f[_0xb261('0x15')][_0xb261('0x17')]||null:null,'attributes':_0x2cc77f[_0xb261('0x15')]?_0x2cc77f[_0xb261('0x15')]['attributes']||null:null,'include':_0x2cc77f[_0xb261('0x15')]?_0x2cc77f['options'][_0xb261('0x1c')]?_[_0xb261('0x19')](_0x2cc77f['options'][_0xb261('0x1c')],function(_0x560567){return{'model':db[_0x560567[_0xb261('0x1a')]],'as':_0x560567['as'],'attributes':_0x560567[_0xb261('0x1b')],'include':_0x560567['include']?_[_0xb261('0x19')](_0x560567[_0xb261('0x1c')],function(_0x1b3740){return{'model':db[_0x1b3740[_0xb261('0x1a')]],'as':_0x1b3740['as'],'attributes':_0x1b3740['attributes'],'include':_0x1b3740[_0xb261('0x1c')]?_[_0xb261('0x19')](_0x1b3740[_0xb261('0x1c')],function(_0x152dee){return{'model':db[_0x152dee[_0xb261('0x1a')]],'as':_0x152dee['as'],'attributes':_0x152dee[_0xb261('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xb261('0xa')](function(_0xa065){logger[_0xb261('0xb')](_0xb261('0x1f'),_0x2cc77f);logger[_0xb261('0xe')]('ShowFreshdeskAccount',_0x2cc77f,JSON['stringify'](_0xa065));_0x3008f5(_0xa065);})['catch'](function(_0x49135d){logger[_0xb261('0x10')](_0xb261('0x1f'),_0x49135d[_0xb261('0x11')],_0x2cc77f);_0x1c7d42(_0x3a9556[_0xb261('0x10')](0x1f4,_0x49135d[_0xb261('0x11')]));});});}; \ No newline at end of file +var _0xd19d=['where','lodash','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','error','code','message','info','catch','GetFreshdeskAccount','options','raw','attributes','limit','include','map','model','debug','stringify','ShowFreshdeskAccount','find'];(function(_0x3fd275,_0xf0cd7){var _0xe4f14f=function(_0x23971d){while(--_0x23971d){_0x3fd275['push'](_0x3fd275['shift']());}};_0xe4f14f(++_0xf0cd7);}(_0xd19d,0x79));var _0xdd19=function(_0x1a86ae,_0x3979cb){_0x1a86ae=_0x1a86ae-0x0;var _0x462f27=_0xd19d[_0x1a86ae];return _0x462f27;};'use strict';var _=require(_0xdd19('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdd19('0x1'));var db=require(_0xdd19('0x2'))['db'];var utils=require(_0xdd19('0x3'));var logger=require('../../config/logger')(_0xdd19('0x4'));var config=require('../../config/environment');var jayson=require(_0xdd19('0x5'));var client=jayson[_0xdd19('0x6')][_0xdd19('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2bfc84,_0x3109b2,_0x286fd4){return new BPromise(function(_0x3b6674,_0x56cdf9){return client[_0xdd19('0x8')](_0x2bfc84,_0x286fd4)[_0xdd19('0x9')](function(_0x29990b){logger['info'](_0xdd19('0xa'),_0x3109b2,_0xdd19('0xb'));logger['debug']('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0x3109b2,_0xdd19('0xb'),JSON['stringify'](_0x29990b));if(_0x29990b[_0xdd19('0xc')]){if(_0x29990b[_0xdd19('0xc')][_0xdd19('0xd')]===0x1f4){logger[_0xdd19('0xc')]('FreshdeskAccount,\x20%s,\x20%s',_0x3109b2,_0x29990b[_0xdd19('0xc')][_0xdd19('0xe')]);return _0x56cdf9(_0x29990b['error']['message']);}logger[_0xdd19('0xc')]('FreshdeskAccount,\x20%s,\x20%s',_0x3109b2,_0x29990b[_0xdd19('0xc')]['message']);return _0x3b6674(_0x29990b['error'][_0xdd19('0xe')]);}else{logger[_0xdd19('0xf')](_0xdd19('0xa'),_0x3109b2,'request\x20sent');_0x3b6674(_0x29990b['result']['message']);}})[_0xdd19('0x10')](function(_0x229a56){logger[_0xdd19('0xc')](_0xdd19('0xa'),_0x3109b2,_0x229a56);_0x56cdf9(_0x229a56);});});}exports[_0xdd19('0x11')]=function(_0xe3207a){var _0x5e2cc4=this;return new Promise(function(_0x46d9cb,_0x534e28){return db['FreshdeskAccount']['findAll']({'raw':_0xe3207a[_0xdd19('0x12')]?_0xe3207a[_0xdd19('0x12')][_0xdd19('0x13')]===undefined?!![]:![]:!![],'where':_0xe3207a[_0xdd19('0x12')]?_0xe3207a[_0xdd19('0x12')]['where']||null:null,'attributes':_0xe3207a[_0xdd19('0x12')]?_0xe3207a['options'][_0xdd19('0x14')]||null:null,'limit':_0xe3207a[_0xdd19('0x12')]?_0xe3207a[_0xdd19('0x12')][_0xdd19('0x15')]||null:null,'include':_0xe3207a['options']?_0xe3207a['options'][_0xdd19('0x16')]?_[_0xdd19('0x17')](_0xe3207a[_0xdd19('0x12')][_0xdd19('0x16')],function(_0x329c93){return{'model':db[_0x329c93[_0xdd19('0x18')]],'as':_0x329c93['as'],'attributes':_0x329c93['attributes'],'include':_0x329c93[_0xdd19('0x16')]?_[_0xdd19('0x17')](_0x329c93[_0xdd19('0x16')],function(_0x4f83be){return{'model':db[_0x4f83be['model']],'as':_0x4f83be['as'],'attributes':_0x4f83be[_0xdd19('0x14')],'include':_0x4f83be[_0xdd19('0x16')]?_[_0xdd19('0x17')](_0x4f83be['include'],function(_0x5569ec){return{'model':db[_0x5569ec['model']],'as':_0x5569ec['as'],'attributes':_0x5569ec['attributes']};}):[]};}):[]};}):[]:[]})[_0xdd19('0x9')](function(_0xbfe72b){logger[_0xdd19('0xf')](_0xdd19('0x11'),_0xe3207a);logger[_0xdd19('0x19')](_0xdd19('0x11'),_0xe3207a,JSON[_0xdd19('0x1a')](_0xbfe72b));_0x46d9cb(_0xbfe72b);})['catch'](function(_0x4d91f8){logger[_0xdd19('0xc')](_0xdd19('0x11'),_0x4d91f8[_0xdd19('0xe')],_0xe3207a);_0x534e28(_0x5e2cc4['error'](0x1f4,_0x4d91f8['message']));});});};exports[_0xdd19('0x1b')]=function(_0x17371b){var _0x50ff06=this;return new Promise(function(_0x2a8747,_0x1505ea){return db['FreshdeskAccount'][_0xdd19('0x1c')]({'raw':_0x17371b['options']?_0x17371b[_0xdd19('0x12')]['raw']===undefined?!![]:![]:!![],'where':_0x17371b[_0xdd19('0x12')]?_0x17371b[_0xdd19('0x12')][_0xdd19('0x1d')]||null:null,'attributes':_0x17371b[_0xdd19('0x12')]?_0x17371b['options'][_0xdd19('0x14')]||null:null,'include':_0x17371b['options']?_0x17371b[_0xdd19('0x12')][_0xdd19('0x16')]?_[_0xdd19('0x17')](_0x17371b[_0xdd19('0x12')][_0xdd19('0x16')],function(_0x118b6e){return{'model':db[_0x118b6e[_0xdd19('0x18')]],'as':_0x118b6e['as'],'attributes':_0x118b6e[_0xdd19('0x14')],'include':_0x118b6e[_0xdd19('0x16')]?_[_0xdd19('0x17')](_0x118b6e[_0xdd19('0x16')],function(_0x3451c8){return{'model':db[_0x3451c8['model']],'as':_0x3451c8['as'],'attributes':_0x3451c8[_0xdd19('0x14')],'include':_0x3451c8[_0xdd19('0x16')]?_[_0xdd19('0x17')](_0x3451c8['include'],function(_0x52c241){return{'model':db[_0x52c241[_0xdd19('0x18')]],'as':_0x52c241['as'],'attributes':_0x52c241[_0xdd19('0x14')]};}):[]};}):[]};}):[]:[]})[_0xdd19('0x9')](function(_0x20defb){logger[_0xdd19('0xf')](_0xdd19('0x1b'),_0x17371b);logger[_0xdd19('0x19')](_0xdd19('0x1b'),_0x17371b,JSON[_0xdd19('0x1a')](_0x20defb));_0x2a8747(_0x20defb);})[_0xdd19('0x10')](function(_0x5b4f53){logger['error']('ShowFreshdeskAccount',_0x5b4f53[_0xdd19('0xe')],_0x17371b);_0x1505ea(_0x50ff06['error'](0x1f4,_0x5b4f53[_0xdd19('0xe')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index 63cdde1..fbe99a3 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 _0xd30f=['setTags','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intFreshdeskConfiguration.controller','get','index','/:id','isAuthenticated','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','create'];(function(_0x376f09,_0x7e2c0e){var _0x501ff9=function(_0x78fb6f){while(--_0x78fb6f){_0x376f09['push'](_0x376f09['shift']());}};_0x501ff9(++_0x7e2c0e);}(_0xd30f,0x18a));var _0xfd30=function(_0x4fef6a,_0x1c0292){_0x4fef6a=_0x4fef6a-0x0;var _0x2cb433=_0xd30f[_0x4fef6a];return _0x2cb433;};'use strict';var multer=require('multer');var util=require(_0xfd30('0x0'));var path=require(_0xfd30('0x1'));var timeout=require(_0xfd30('0x2'));var express=require(_0xfd30('0x3'));var router=express[_0xfd30('0x4')]();var fs_extra=require(_0xfd30('0x5'));var auth=require(_0xfd30('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xfd30('0x7'));var controller=require(_0xfd30('0x8'));router[_0xfd30('0x9')]('/',auth['isAuthenticated'](),controller[_0xfd30('0xa')]);router[_0xfd30('0x9')](_0xfd30('0xb'),auth[_0xfd30('0xc')](),controller['show']);router[_0xfd30('0x9')](_0xfd30('0xd'),auth['isAuthenticated'](),controller[_0xfd30('0xe')]);router[_0xfd30('0x9')](_0xfd30('0xf'),auth[_0xfd30('0xc')](),controller['getSubjects']);router[_0xfd30('0x9')](_0xfd30('0x10'),auth[_0xfd30('0xc')](),controller[_0xfd30('0x11')]);router[_0xfd30('0x9')](_0xfd30('0x12'),auth[_0xfd30('0xc')](),controller[_0xfd30('0x13')]);router[_0xfd30('0x14')]('/',auth[_0xfd30('0xc')](),controller[_0xfd30('0x15')]);router[_0xfd30('0x14')](_0xfd30('0x12'),auth[_0xfd30('0xc')](),controller[_0xfd30('0x16')]);router['put'](_0xfd30('0xb'),auth['isAuthenticated'](),controller[_0xfd30('0x17')]);router[_0xfd30('0x18')]('/:id',auth[_0xfd30('0xc')](),controller['destroy']);module[_0xfd30('0x19')]=router; \ No newline at end of file +var _0xc14b=['delete','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intFreshdeskConfiguration.controller','isAuthenticated','index','get','show','/:id/subjects','getSubjects','/:id/descriptions','/:id/tags','create','post','setTags','put','/:id','update'];(function(_0x3fb22d,_0x4d997b){var _0x42b188=function(_0x1ee8fc){while(--_0x1ee8fc){_0x3fb22d['push'](_0x3fb22d['shift']());}};_0x42b188(++_0x4d997b);}(_0xc14b,0xc2));var _0xbc14=function(_0x3550e8,_0x424fea){_0x3550e8=_0x3550e8-0x0;var _0x18eb61=_0xc14b[_0x3550e8];return _0x18eb61;};'use strict';var multer=require('multer');var util=require(_0xbc14('0x0'));var path=require(_0xbc14('0x1'));var timeout=require('connect-timeout');var express=require(_0xbc14('0x2'));var router=express[_0xbc14('0x3')]();var fs_extra=require(_0xbc14('0x4'));var auth=require(_0xbc14('0x5'));var interaction=require(_0xbc14('0x6'));var config=require('../../config/environment');var controller=require(_0xbc14('0x7'));router['get']('/',auth[_0xbc14('0x8')](),controller[_0xbc14('0x9')]);router[_0xbc14('0xa')]('/:id',auth[_0xbc14('0x8')](),controller[_0xbc14('0xb')]);router[_0xbc14('0xa')]('/:id/fields',auth[_0xbc14('0x8')](),controller['getFields']);router[_0xbc14('0xa')](_0xbc14('0xc'),auth[_0xbc14('0x8')](),controller[_0xbc14('0xd')]);router['get'](_0xbc14('0xe'),auth[_0xbc14('0x8')](),controller['getDescriptions']);router[_0xbc14('0xa')](_0xbc14('0xf'),auth[_0xbc14('0x8')](),controller['getTags']);router['post']('/',auth['isAuthenticated'](),controller[_0xbc14('0x10')]);router[_0xbc14('0x11')](_0xbc14('0xf'),auth[_0xbc14('0x8')](),controller[_0xbc14('0x12')]);router[_0xbc14('0x13')](_0xbc14('0x14'),auth[_0xbc14('0x8')](),controller[_0xbc14('0x15')]);router[_0xbc14('0x16')]('/:id',auth[_0xbc14('0x8')](),controller['destroy']);module[_0xbc14('0x17')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index b839694..700238a 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 _0x6392=['STRING','sequelize','exports'];(function(_0x38446f,_0x561d69){var _0x2c726b=function(_0x2a8096){while(--_0x2a8096){_0x38446f['push'](_0x38446f['shift']());}};_0x2c726b(++_0x561d69);}(_0x6392,0x166));var _0x2639=function(_0xc5a1a2,_0x49df81){_0xc5a1a2=_0xc5a1a2-0x0;var _0x5d3fe6=_0x6392[_0xc5a1a2];return _0x5d3fe6;};'use strict';var Sequelize=require(_0x2639('0x0'));module[_0x2639('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x2639('0x2')]}}; \ No newline at end of file +var _0x61b3=['exports'];(function(_0x3fb5eb,_0x5947a6){var _0x481291=function(_0x74e4e){while(--_0x74e4e){_0x3fb5eb['push'](_0x3fb5eb['shift']());}};_0x481291(++_0x5947a6);}(_0x61b3,0x65));var _0x361b=function(_0x1df49e,_0x3c1ca2){_0x1df49e=_0x1df49e-0x0;var _0x15a9a2=_0x61b3[_0x1df49e];return _0x15a9a2;};'use strict';var Sequelize=require('sequelize');module[_0x361b('0x0')]={'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 0823962..6c4ba13 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 _0xe8e3=['intersection','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','FreshdeskConfiguration','includeAll','include','findAll','rows','show','rawAttributes','create','body','find','params','getFields','FreshdeskField','hasOwnProperty','findOne','getSubjects','getTags','setTags','ids','rimraf','fast-json-patch','bluebird','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','request','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','offset','undefined','count','limit','set','json','apply','update','then','destroy','stack','name','fieldName','type','key','model','map','query','keys','attributes'];(function(_0x591e93,_0x2cdfb6){var _0x369ab0=function(_0x1bfa65){while(--_0x1bfa65){_0x591e93['push'](_0x591e93['shift']());}};_0x369ab0(++_0x2cdfb6);}(_0xe8e3,0x77));var _0x3e8e=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xe8e3[_0x17d9e3];return _0x14192d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3e8e('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3e8e('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x3e8e('0x2'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x3e8e('0x3'));var csv=require(_0x3e8e('0x4'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3e8e('0x5'));var squel=require(_0x3e8e('0x6'));var crypto=require(_0x3e8e('0x7'));var jsforce=require(_0x3e8e('0x8'));var deskjs=require(_0x3e8e('0x9'));var toCsv=require(_0x3e8e('0x4'));var querystring=require(_0x3e8e('0xa'));var Papa=require(_0x3e8e('0xb'));var Redis=require(_0x3e8e('0xc'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x3e8e('0xd'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3e8e('0xe'))(_0x3e8e('0xf'));var utils=require(_0x3e8e('0x10'));var config=require(_0x3e8e('0x11'));var licenseUtil=require('../../config/license/util');var db=require(_0x3e8e('0x12'))['db'];var jayson=require(_0x3e8e('0x13'));var client=jayson[_0x3e8e('0x14')][_0x3e8e('0x15')]({'port':0x232a});function respondWithRpcPromise(_0xcd87b1,_0x3cbf00,_0x4516ed,_0x412b81){return new BPromise(function(_0x4ddd2e,_0x5d5ef2){var _0x53b2be=_0x412b81||client;return _0x53b2be[_0x3e8e('0x16')](_0xcd87b1,_0x4516ed)['then'](function(_0x444cd2){logger[_0x3e8e('0x17')](_0x3e8e('0x18'),_0x3cbf00,_0x3e8e('0x19'));logger['debug'](_0x3e8e('0x1a'),_0x3cbf00,_0x3e8e('0x19'),JSON['stringify'](_0x444cd2));if(_0x444cd2[_0x3e8e('0x1b')]){if(_0x444cd2[_0x3e8e('0x1b')][_0x3e8e('0x1c')]===0x1f4){logger[_0x3e8e('0x1b')](_0x3e8e('0x18'),_0x3cbf00,_0x444cd2[_0x3e8e('0x1b')][_0x3e8e('0x1d')]);return _0x5d5ef2(_0x444cd2[_0x3e8e('0x1b')]['message']);}logger['error']('FreshdeskConfiguration,\x20%s,\x20%s',_0x3cbf00,_0x444cd2[_0x3e8e('0x1b')][_0x3e8e('0x1d')]);return _0x4ddd2e(_0x444cd2[_0x3e8e('0x1b')][_0x3e8e('0x1d')]);}else{logger[_0x3e8e('0x17')](_0x3e8e('0x18'),_0x3cbf00,_0x3e8e('0x19'));_0x4ddd2e(_0x444cd2[_0x3e8e('0x1e')][_0x3e8e('0x1d')]);}})[_0x3e8e('0x1f')](function(_0x268b6a){logger[_0x3e8e('0x1b')](_0x3e8e('0x18'),_0x3cbf00,_0x268b6a);_0x5d5ef2(_0x268b6a);});});}function respondWithStatusCode(_0x494d2a,_0x2a2f36){_0x2a2f36=_0x2a2f36||0xcc;return function(_0x20f535){if(_0x20f535){return _0x494d2a[_0x3e8e('0x20')](_0x2a2f36);}return _0x494d2a[_0x3e8e('0x21')](_0x2a2f36)[_0x3e8e('0x22')]();};}function respondWithResult(_0x3c7d92,_0x380022){_0x380022=_0x380022||0xc8;return function(_0x5bfe43){if(_0x5bfe43){return _0x3c7d92['status'](_0x380022)['json'](_0x5bfe43);}};}function respondWithFilteredResult(_0x520b2d,_0x2918fb){return function(_0x59ad59){if(_0x59ad59){var _0x5b866a=typeof _0x2918fb[_0x3e8e('0x23')]===_0x3e8e('0x24')&&typeof _0x2918fb['limit']===_0x3e8e('0x24');var _0x580196=_0x59ad59[_0x3e8e('0x25')];var _0x3dd6bc=_0x5b866a?0x0:_0x2918fb['offset'];var _0x4218df=_0x5b866a?_0x59ad59['count']:_0x2918fb[_0x3e8e('0x23')]+_0x2918fb[_0x3e8e('0x26')];var _0x381581;if(_0x4218df>=_0x580196){_0x4218df=_0x580196;_0x381581=0xc8;}else{_0x381581=0xce;}_0x520b2d[_0x3e8e('0x21')](_0x381581);return _0x520b2d[_0x3e8e('0x27')]('Content-Range',_0x3dd6bc+'-'+_0x4218df+'/'+_0x580196)[_0x3e8e('0x28')](_0x59ad59);}return null;};}function patchUpdates(_0x5b658d){return function(_0xf4fc96){try{jsonpatch[_0x3e8e('0x29')](_0xf4fc96,_0x5b658d,!![]);}catch(_0x49cfb6){return BPromise['reject'](_0x49cfb6);}return _0xf4fc96['save']();};}function saveUpdates(_0x441e15,_0x4be891){return function(_0x3fa534){if(_0x3fa534){return _0x3fa534[_0x3e8e('0x2a')](_0x441e15)[_0x3e8e('0x2b')](function(_0x44fbec){return _0x44fbec;});}return null;};}function removeEntity(_0x2464f3,_0x5c4d8c){return function(_0x31b756){if(_0x31b756){return _0x31b756[_0x3e8e('0x2c')]()[_0x3e8e('0x2b')](function(){_0x2464f3[_0x3e8e('0x21')](0xcc)[_0x3e8e('0x22')]();});}};}function handleEntityNotFound(_0x2948cc,_0x8d6703){return function(_0x2b721a){if(!_0x2b721a){_0x2948cc['sendStatus'](0x194);}return _0x2b721a;};}function handleError(_0x429bf9,_0x111006){_0x111006=_0x111006||0x1f4;return function(_0x17cfcc){logger['error'](_0x17cfcc[_0x3e8e('0x2d')]);if(_0x17cfcc[_0x3e8e('0x2e')]){delete _0x17cfcc['name'];}_0x429bf9[_0x3e8e('0x21')](_0x111006)['send'](_0x17cfcc);};}exports['index']=function(_0x1f532f,_0x1ea3e0){var _0x54f175={},_0x56155e={},_0x121a98={'count':0x0,'rows':[]};var _0x2aab05=_['map'](db['FreshdeskConfiguration']['rawAttributes'],function(_0x333067){return{'name':_0x333067[_0x3e8e('0x2f')],'type':_0x333067[_0x3e8e('0x30')][_0x3e8e('0x31')]};});_0x56155e[_0x3e8e('0x32')]=_[_0x3e8e('0x33')](_0x2aab05,'name');_0x56155e[_0x3e8e('0x34')]=_[_0x3e8e('0x35')](_0x1f532f['query']);_0x56155e['filters']=_['intersection'](_0x56155e[_0x3e8e('0x32')],_0x56155e['query']);_0x54f175[_0x3e8e('0x36')]=_[_0x3e8e('0x37')](_0x56155e[_0x3e8e('0x32')],qs[_0x3e8e('0x38')](_0x1f532f[_0x3e8e('0x34')][_0x3e8e('0x38')]));_0x54f175['attributes']=_0x54f175[_0x3e8e('0x36')][_0x3e8e('0x39')]?_0x54f175[_0x3e8e('0x36')]:_0x56155e[_0x3e8e('0x32')];if(!_0x1f532f[_0x3e8e('0x34')]['hasOwnProperty'](_0x3e8e('0x3a'))){_0x54f175[_0x3e8e('0x26')]=qs[_0x3e8e('0x26')](_0x1f532f[_0x3e8e('0x34')][_0x3e8e('0x26')]);_0x54f175[_0x3e8e('0x23')]=qs[_0x3e8e('0x23')](_0x1f532f['query'][_0x3e8e('0x23')]);}_0x54f175[_0x3e8e('0x3b')]=qs['sort'](_0x1f532f[_0x3e8e('0x34')][_0x3e8e('0x3c')]);_0x54f175[_0x3e8e('0x3d')]=qs[_0x3e8e('0x3e')](_[_0x3e8e('0x3f')](_0x1f532f[_0x3e8e('0x34')],_0x56155e[_0x3e8e('0x3e')]),_0x2aab05);if(_0x1f532f[_0x3e8e('0x34')][_0x3e8e('0x40')]){_0x54f175['where']=_[_0x3e8e('0x41')](_0x54f175['where'],{'$or':_[_0x3e8e('0x33')](_0x2aab05,function(_0x49c083){if(_0x49c083[_0x3e8e('0x30')]!==_0x3e8e('0x42')){var _0x5dbb8b={};_0x5dbb8b[_0x49c083[_0x3e8e('0x2e')]]={'$like':'%'+_0x1f532f[_0x3e8e('0x34')][_0x3e8e('0x40')]+'%'};return _0x5dbb8b;}})});}_0x54f175=_[_0x3e8e('0x41')]({},_0x54f175,_0x1f532f[_0x3e8e('0x43')]);var _0x53f94d={'where':_0x54f175[_0x3e8e('0x3d')]};return db[_0x3e8e('0x44')][_0x3e8e('0x25')](_0x53f94d)[_0x3e8e('0x2b')](function(_0x61edb9){_0x121a98[_0x3e8e('0x25')]=_0x61edb9;if(_0x1f532f[_0x3e8e('0x34')][_0x3e8e('0x45')]){_0x54f175[_0x3e8e('0x46')]=[{'all':!![]}];}return db[_0x3e8e('0x44')][_0x3e8e('0x47')](_0x54f175);})[_0x3e8e('0x2b')](function(_0x464fc5){_0x121a98[_0x3e8e('0x48')]=_0x464fc5;return _0x121a98;})[_0x3e8e('0x2b')](respondWithFilteredResult(_0x1ea3e0,_0x54f175))[_0x3e8e('0x1f')](handleError(_0x1ea3e0,null));};exports[_0x3e8e('0x49')]=function(_0x22cc7a,_0x28795e){var _0x1b15cf={'raw':![],'where':{'id':_0x22cc7a['params']['id']}},_0x2a2577={};_0x2a2577['model']=_[_0x3e8e('0x35')](db['FreshdeskConfiguration'][_0x3e8e('0x4a')]);_0x2a2577['query']=_[_0x3e8e('0x35')](_0x22cc7a['query']);_0x2a2577[_0x3e8e('0x3e')]=_['intersection'](_0x2a2577[_0x3e8e('0x32')],_0x2a2577[_0x3e8e('0x34')]);_0x1b15cf[_0x3e8e('0x36')]=_[_0x3e8e('0x37')](_0x2a2577['model'],qs[_0x3e8e('0x38')](_0x22cc7a[_0x3e8e('0x34')][_0x3e8e('0x38')]));_0x1b15cf[_0x3e8e('0x36')]=_0x1b15cf[_0x3e8e('0x36')]['length']?_0x1b15cf[_0x3e8e('0x36')]:_0x2a2577[_0x3e8e('0x32')];if(_0x22cc7a[_0x3e8e('0x34')][_0x3e8e('0x45')]){_0x1b15cf[_0x3e8e('0x46')]=[{'all':!![]}];}_0x1b15cf=_['merge']({},_0x1b15cf,_0x22cc7a['options']);return db[_0x3e8e('0x44')]['find'](_0x1b15cf)[_0x3e8e('0x2b')](handleEntityNotFound(_0x28795e,null))[_0x3e8e('0x2b')](respondWithResult(_0x28795e,null))[_0x3e8e('0x1f')](handleError(_0x28795e,null));};exports[_0x3e8e('0x4b')]=function(_0x179db9,_0x9bc58c){return db['FreshdeskConfiguration'][_0x3e8e('0x4b')](_0x179db9[_0x3e8e('0x4c')],{})[_0x3e8e('0x2b')](respondWithResult(_0x9bc58c,0xc9))['catch'](handleError(_0x9bc58c,null));};exports[_0x3e8e('0x2a')]=function(_0x15241d,_0x4d8caa){if(_0x15241d[_0x3e8e('0x4c')]['id']){delete _0x15241d['body']['id'];}return db[_0x3e8e('0x44')][_0x3e8e('0x4d')]({'where':{'id':_0x15241d['params']['id']}})[_0x3e8e('0x2b')](handleEntityNotFound(_0x4d8caa,null))['then'](saveUpdates(_0x15241d['body'],null))[_0x3e8e('0x2b')](respondWithResult(_0x4d8caa,null))[_0x3e8e('0x1f')](handleError(_0x4d8caa,null));};exports['destroy']=function(_0x5e7d96,_0x3c2e56){return db['FreshdeskConfiguration'][_0x3e8e('0x4d')]({'where':{'id':_0x5e7d96[_0x3e8e('0x4e')]['id']}})[_0x3e8e('0x2b')](handleEntityNotFound(_0x3c2e56,null))['then'](removeEntity(_0x3c2e56,null))[_0x3e8e('0x1f')](handleError(_0x3c2e56,null));};exports[_0x3e8e('0x4f')]=function(_0xc1fc37,_0x206aa5,_0x1ecc07){var _0x5119da={};var _0x1d46e7={};var _0x39f023;var _0x159cf1;return db['FreshdeskConfiguration']['findOne']({'where':{'id':_0xc1fc37[_0x3e8e('0x4e')]['id']}})[_0x3e8e('0x2b')](handleEntityNotFound(_0x206aa5,null))[_0x3e8e('0x2b')](function(_0x11e96f){if(_0x11e96f){_0x39f023=_0x11e96f;_0x1d46e7['model']=_['keys'](db[_0x3e8e('0x50')][_0x3e8e('0x4a')]);_0x1d46e7[_0x3e8e('0x34')]=_['keys'](_0xc1fc37['query']);_0x1d46e7[_0x3e8e('0x3e')]=_[_0x3e8e('0x37')](_0x1d46e7[_0x3e8e('0x32')],_0x1d46e7[_0x3e8e('0x34')]);_0x5119da[_0x3e8e('0x36')]=_[_0x3e8e('0x37')](_0x1d46e7[_0x3e8e('0x32')],qs['fields'](_0xc1fc37[_0x3e8e('0x34')][_0x3e8e('0x38')]));_0x5119da[_0x3e8e('0x36')]=_0x5119da[_0x3e8e('0x36')]['length']?_0x5119da[_0x3e8e('0x36')]:_0x1d46e7[_0x3e8e('0x32')];_0x5119da[_0x3e8e('0x3b')]=qs['sort'](_0xc1fc37[_0x3e8e('0x34')][_0x3e8e('0x3c')]);_0x5119da['where']=qs[_0x3e8e('0x3e')](_[_0x3e8e('0x3f')](_0xc1fc37[_0x3e8e('0x34')],_0x1d46e7[_0x3e8e('0x3e')]));if(_0xc1fc37['query'][_0x3e8e('0x40')]){_0x5119da['where']=_[_0x3e8e('0x41')](_0x5119da[_0x3e8e('0x3d')],{'$or':_[_0x3e8e('0x33')](_0x5119da[_0x3e8e('0x36')],function(_0x542e3f){var _0x458156={};_0x458156[_0x542e3f]={'$like':'%'+_0xc1fc37[_0x3e8e('0x34')][_0x3e8e('0x40')]+'%'};return _0x458156;})});}_0x5119da=_[_0x3e8e('0x41')]({},_0x5119da,_0xc1fc37[_0x3e8e('0x43')]);return _0x39f023[_0x3e8e('0x4f')](_0x5119da);}})[_0x3e8e('0x2b')](function(_0x18f00a){if(_0x18f00a){_0x159cf1=_0x18f00a[_0x3e8e('0x39')];if(!_0xc1fc37[_0x3e8e('0x34')][_0x3e8e('0x51')](_0x3e8e('0x3a'))){_0x5119da['limit']=qs['limit'](_0xc1fc37[_0x3e8e('0x34')][_0x3e8e('0x26')]);_0x5119da[_0x3e8e('0x23')]=qs['offset'](_0xc1fc37['query'][_0x3e8e('0x23')]);}return _0x39f023[_0x3e8e('0x4f')](_0x5119da);}})['then'](function(_0x4ca8f4){if(_0x4ca8f4){return _0x4ca8f4?{'count':_0x159cf1,'rows':_0x4ca8f4}:null;}})[_0x3e8e('0x2b')](respondWithResult(_0x206aa5,null))[_0x3e8e('0x1f')](handleError(_0x206aa5,null));};exports['getSubjects']=function(_0x2529ba,_0x3bf753,_0xf7b145){var _0x4394d0={};var _0x3aa414={};var _0x3b1747;var _0x2f49c3;return db[_0x3e8e('0x44')][_0x3e8e('0x52')]({'where':{'id':_0x2529ba[_0x3e8e('0x4e')]['id']}})['then'](handleEntityNotFound(_0x3bf753,null))[_0x3e8e('0x2b')](function(_0xa3d95d){if(_0xa3d95d){_0x3b1747=_0xa3d95d;_0x3aa414[_0x3e8e('0x32')]=_[_0x3e8e('0x35')](db[_0x3e8e('0x50')][_0x3e8e('0x4a')]);_0x3aa414[_0x3e8e('0x34')]=_[_0x3e8e('0x35')](_0x2529ba[_0x3e8e('0x34')]);_0x3aa414[_0x3e8e('0x3e')]=_[_0x3e8e('0x37')](_0x3aa414[_0x3e8e('0x32')],_0x3aa414[_0x3e8e('0x34')]);_0x4394d0[_0x3e8e('0x36')]=_[_0x3e8e('0x37')](_0x3aa414[_0x3e8e('0x32')],qs['fields'](_0x2529ba[_0x3e8e('0x34')][_0x3e8e('0x38')]));_0x4394d0[_0x3e8e('0x36')]=_0x4394d0[_0x3e8e('0x36')][_0x3e8e('0x39')]?_0x4394d0[_0x3e8e('0x36')]:_0x3aa414[_0x3e8e('0x32')];_0x4394d0[_0x3e8e('0x3b')]=qs[_0x3e8e('0x3c')](_0x2529ba[_0x3e8e('0x34')][_0x3e8e('0x3c')]);_0x4394d0[_0x3e8e('0x3d')]=qs[_0x3e8e('0x3e')](_[_0x3e8e('0x3f')](_0x2529ba[_0x3e8e('0x34')],_0x3aa414[_0x3e8e('0x3e')]));if(_0x2529ba['query']['filter']){_0x4394d0[_0x3e8e('0x3d')]=_[_0x3e8e('0x41')](_0x4394d0['where'],{'$or':_[_0x3e8e('0x33')](_0x4394d0[_0x3e8e('0x36')],function(_0xae56e1){var _0x51f431={};_0x51f431[_0xae56e1]={'$like':'%'+_0x2529ba[_0x3e8e('0x34')]['filter']+'%'};return _0x51f431;})});}_0x4394d0=_['merge']({},_0x4394d0,_0x2529ba['options']);return _0x3b1747[_0x3e8e('0x53')](_0x4394d0);}})[_0x3e8e('0x2b')](function(_0x59fb4c){if(_0x59fb4c){_0x2f49c3=_0x59fb4c[_0x3e8e('0x39')];if(!_0x2529ba[_0x3e8e('0x34')][_0x3e8e('0x51')](_0x3e8e('0x3a'))){_0x4394d0['limit']=qs[_0x3e8e('0x26')](_0x2529ba['query']['limit']);_0x4394d0[_0x3e8e('0x23')]=qs[_0x3e8e('0x23')](_0x2529ba[_0x3e8e('0x34')]['offset']);}return _0x3b1747['getSubjects'](_0x4394d0);}})[_0x3e8e('0x2b')](function(_0x32121c){if(_0x32121c){return _0x32121c?{'count':_0x2f49c3,'rows':_0x32121c}:null;}})[_0x3e8e('0x2b')](respondWithResult(_0x3bf753,null))[_0x3e8e('0x1f')](handleError(_0x3bf753,null));};exports['getDescriptions']=function(_0x5e353a,_0x2a989b,_0x521bf4){var _0x784ea9={};var _0x2cdf2b={};var _0x26ec30;var _0x2468b0;return db[_0x3e8e('0x44')][_0x3e8e('0x52')]({'where':{'id':_0x5e353a['params']['id']}})[_0x3e8e('0x2b')](handleEntityNotFound(_0x2a989b,null))[_0x3e8e('0x2b')](function(_0x19be74){if(_0x19be74){_0x26ec30=_0x19be74;_0x2cdf2b[_0x3e8e('0x32')]=_[_0x3e8e('0x35')](db[_0x3e8e('0x50')][_0x3e8e('0x4a')]);_0x2cdf2b['query']=_[_0x3e8e('0x35')](_0x5e353a[_0x3e8e('0x34')]);_0x2cdf2b[_0x3e8e('0x3e')]=_[_0x3e8e('0x37')](_0x2cdf2b['model'],_0x2cdf2b['query']);_0x784ea9[_0x3e8e('0x36')]=_[_0x3e8e('0x37')](_0x2cdf2b['model'],qs[_0x3e8e('0x38')](_0x5e353a[_0x3e8e('0x34')]['fields']));_0x784ea9['attributes']=_0x784ea9[_0x3e8e('0x36')][_0x3e8e('0x39')]?_0x784ea9[_0x3e8e('0x36')]:_0x2cdf2b['model'];_0x784ea9[_0x3e8e('0x3b')]=qs[_0x3e8e('0x3c')](_0x5e353a[_0x3e8e('0x34')]['sort']);_0x784ea9['where']=qs['filters'](_[_0x3e8e('0x3f')](_0x5e353a[_0x3e8e('0x34')],_0x2cdf2b[_0x3e8e('0x3e')]));if(_0x5e353a[_0x3e8e('0x34')][_0x3e8e('0x40')]){_0x784ea9['where']=_[_0x3e8e('0x41')](_0x784ea9[_0x3e8e('0x3d')],{'$or':_[_0x3e8e('0x33')](_0x784ea9['attributes'],function(_0x5f24dd){var _0x3f68aa={};_0x3f68aa[_0x5f24dd]={'$like':'%'+_0x5e353a[_0x3e8e('0x34')]['filter']+'%'};return _0x3f68aa;})});}_0x784ea9=_[_0x3e8e('0x41')]({},_0x784ea9,_0x5e353a[_0x3e8e('0x43')]);return _0x26ec30['getDescriptions'](_0x784ea9);}})[_0x3e8e('0x2b')](function(_0x483154){if(_0x483154){_0x2468b0=_0x483154[_0x3e8e('0x39')];if(!_0x5e353a[_0x3e8e('0x34')]['hasOwnProperty'](_0x3e8e('0x3a'))){_0x784ea9['limit']=qs[_0x3e8e('0x26')](_0x5e353a[_0x3e8e('0x34')][_0x3e8e('0x26')]);_0x784ea9[_0x3e8e('0x23')]=qs[_0x3e8e('0x23')](_0x5e353a['query'][_0x3e8e('0x23')]);}return _0x26ec30['getDescriptions'](_0x784ea9);}})[_0x3e8e('0x2b')](function(_0x168f58){if(_0x168f58){return _0x168f58?{'count':_0x2468b0,'rows':_0x168f58}:null;}})[_0x3e8e('0x2b')](respondWithResult(_0x2a989b,null))[_0x3e8e('0x1f')](handleError(_0x2a989b,null));};exports[_0x3e8e('0x54')]=function(_0x50eb8b,_0x100a0a,_0x4fa6b1){var _0x3a20dc={};var _0x28d979={};var _0x300097;var _0x350b7d;return db[_0x3e8e('0x44')][_0x3e8e('0x52')]({'where':{'id':_0x50eb8b['params']['id']}})[_0x3e8e('0x2b')](handleEntityNotFound(_0x100a0a,null))[_0x3e8e('0x2b')](function(_0x5a3f53){if(_0x5a3f53){_0x300097=_0x5a3f53;_0x28d979['model']=_[_0x3e8e('0x35')](db['Tag'][_0x3e8e('0x4a')]);_0x28d979[_0x3e8e('0x34')]=_[_0x3e8e('0x35')](_0x50eb8b[_0x3e8e('0x34')]);_0x28d979[_0x3e8e('0x3e')]=_[_0x3e8e('0x37')](_0x28d979[_0x3e8e('0x32')],_0x28d979['query']);_0x3a20dc[_0x3e8e('0x36')]=_[_0x3e8e('0x37')](_0x28d979['model'],qs[_0x3e8e('0x38')](_0x50eb8b[_0x3e8e('0x34')][_0x3e8e('0x38')]));_0x3a20dc['attributes']=_0x3a20dc['attributes'][_0x3e8e('0x39')]?_0x3a20dc[_0x3e8e('0x36')]:_0x28d979['model'];_0x3a20dc[_0x3e8e('0x3b')]=qs['sort'](_0x50eb8b[_0x3e8e('0x34')][_0x3e8e('0x3c')]);_0x3a20dc[_0x3e8e('0x3d')]=qs[_0x3e8e('0x3e')](_[_0x3e8e('0x3f')](_0x50eb8b[_0x3e8e('0x34')],_0x28d979['filters']));if(_0x50eb8b[_0x3e8e('0x34')][_0x3e8e('0x40')]){_0x3a20dc[_0x3e8e('0x3d')]=_[_0x3e8e('0x41')](_0x3a20dc[_0x3e8e('0x3d')],{'$or':_[_0x3e8e('0x33')](_0x3a20dc['attributes'],function(_0x2522fb){var _0x5efde0={};_0x5efde0[_0x2522fb]={'$like':'%'+_0x50eb8b[_0x3e8e('0x34')][_0x3e8e('0x40')]+'%'};return _0x5efde0;})});}_0x3a20dc=_['merge']({},_0x3a20dc,_0x50eb8b['options']);return _0x300097[_0x3e8e('0x54')](_0x3a20dc);}})[_0x3e8e('0x2b')](function(_0x45295c){if(_0x45295c){_0x350b7d=_0x45295c[_0x3e8e('0x39')];if(!_0x50eb8b['query'][_0x3e8e('0x51')]('nolimit')){_0x3a20dc['limit']=qs[_0x3e8e('0x26')](_0x50eb8b[_0x3e8e('0x34')][_0x3e8e('0x26')]);_0x3a20dc[_0x3e8e('0x23')]=qs[_0x3e8e('0x23')](_0x50eb8b['query'][_0x3e8e('0x23')]);}return _0x300097[_0x3e8e('0x54')](_0x3a20dc);}})[_0x3e8e('0x2b')](function(_0x7fcc12){if(_0x7fcc12){return _0x7fcc12?{'count':_0x350b7d,'rows':_0x7fcc12}:null;}})[_0x3e8e('0x2b')](respondWithResult(_0x100a0a,null))['catch'](handleError(_0x100a0a,null));};exports[_0x3e8e('0x55')]=function(_0x3b7616,_0x55be5a,_0xb9e01){if(_0x3b7616[_0x3e8e('0x4c')]['id']){delete _0x3b7616[_0x3e8e('0x4c')]['id'];}return db[_0x3e8e('0x44')][_0x3e8e('0x52')]({'where':{'id':_0x3b7616[_0x3e8e('0x4e')]['id']}})[_0x3e8e('0x2b')](handleEntityNotFound(_0x55be5a,null))[_0x3e8e('0x2b')](function(_0x2c1e71){if(_0x2c1e71){return _0x2c1e71['setTags'](_0x3b7616[_0x3e8e('0x4c')][_0x3e8e('0x56')]||[]);}return null;})['then'](respondWithResult(_0x55be5a,null))[_0x3e8e('0x1f')](handleError(_0x55be5a,null));}; \ No newline at end of file +var _0xbd09=['map','FreshdeskConfiguration','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','findAll','show','params','length','includeAll','include','options','find','create','body','getFields','findOne','FreshdeskField','pick','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','client','http','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','catch','sendStatus','status','undefined','limit','count','offset','set','json','apply','save','update','destroy','end','stack','name','index'];(function(_0x26f7ea,_0x53d492){var _0x26f7d4=function(_0x5d9bbf){while(--_0x5d9bbf){_0x26f7ea['push'](_0x26f7ea['shift']());}};_0x26f7d4(++_0x53d492);}(_0xbd09,0x146));var _0x9bd0=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xbd09[_0x1facfa];return _0x9ec701;};'use strict';var emlformat=require(_0x9bd0('0x0'));var rimraf=require(_0x9bd0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9bd0('0x2'));var rp=require(_0x9bd0('0x3'));var moment=require(_0x9bd0('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x9bd0('0x5'));var util=require(_0x9bd0('0x6'));var path=require(_0x9bd0('0x7'));var sox=require(_0x9bd0('0x8'));var csv=require(_0x9bd0('0x9'));var ejs=require(_0x9bd0('0xa'));var fs=require('fs');var fs_extra=require(_0x9bd0('0xb'));var _=require(_0x9bd0('0xc'));var squel=require(_0x9bd0('0xd'));var crypto=require('crypto');var jsforce=require(_0x9bd0('0xe'));var deskjs=require(_0x9bd0('0xf'));var toCsv=require(_0x9bd0('0x9'));var querystring=require(_0x9bd0('0x10'));var Papa=require(_0x9bd0('0x11'));var Redis=require(_0x9bd0('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x9bd0('0x13'));var as=require(_0x9bd0('0x14'));var hardwareService=require(_0x9bd0('0x15'));var logger=require(_0x9bd0('0x16'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x9bd0('0x17'));var db=require(_0x9bd0('0x18'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x9bd0('0x19')][_0x9bd0('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x51ae01,_0x202b2c,_0x1068f3,_0x22947e){return new BPromise(function(_0x2490b8,_0x114a6e){var _0x30cee8=_0x22947e||client;return _0x30cee8[_0x9bd0('0x1b')](_0x51ae01,_0x1068f3)[_0x9bd0('0x1c')](function(_0x1766e3){logger[_0x9bd0('0x1d')](_0x9bd0('0x1e'),_0x202b2c,'request\x20sent');logger[_0x9bd0('0x1f')]('FreshdeskConfiguration,\x20%s,\x20%s,\x20%s',_0x202b2c,_0x9bd0('0x20'),JSON[_0x9bd0('0x21')](_0x1766e3));if(_0x1766e3[_0x9bd0('0x22')]){if(_0x1766e3[_0x9bd0('0x22')][_0x9bd0('0x23')]===0x1f4){logger[_0x9bd0('0x22')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x202b2c,_0x1766e3[_0x9bd0('0x22')][_0x9bd0('0x24')]);return _0x114a6e(_0x1766e3[_0x9bd0('0x22')][_0x9bd0('0x24')]);}logger['error'](_0x9bd0('0x1e'),_0x202b2c,_0x1766e3[_0x9bd0('0x22')][_0x9bd0('0x24')]);return _0x2490b8(_0x1766e3['error']['message']);}else{logger[_0x9bd0('0x1d')](_0x9bd0('0x1e'),_0x202b2c,_0x9bd0('0x20'));_0x2490b8(_0x1766e3['result'][_0x9bd0('0x24')]);}})[_0x9bd0('0x25')](function(_0x437c7f){logger[_0x9bd0('0x22')](_0x9bd0('0x1e'),_0x202b2c,_0x437c7f);_0x114a6e(_0x437c7f);});});}function respondWithStatusCode(_0x5375e6,_0xa61ab2){_0xa61ab2=_0xa61ab2||0xcc;return function(_0x1390dc){if(_0x1390dc){return _0x5375e6[_0x9bd0('0x26')](_0xa61ab2);}return _0x5375e6[_0x9bd0('0x27')](_0xa61ab2)['end']();};}function respondWithResult(_0x25f772,_0xfc9a0e){_0xfc9a0e=_0xfc9a0e||0xc8;return function(_0xaa88e5){if(_0xaa88e5){return _0x25f772['status'](_0xfc9a0e)['json'](_0xaa88e5);}};}function respondWithFilteredResult(_0x2295ed,_0x2ed55b){return function(_0x28962f){if(_0x28962f){var _0x1e271b=typeof _0x2ed55b['offset']===_0x9bd0('0x28')&&typeof _0x2ed55b[_0x9bd0('0x29')]===_0x9bd0('0x28');var _0x55ec8d=_0x28962f[_0x9bd0('0x2a')];var _0x27a2c1=_0x1e271b?0x0:_0x2ed55b['offset'];var _0x52b9b5=_0x1e271b?_0x28962f[_0x9bd0('0x2a')]:_0x2ed55b[_0x9bd0('0x2b')]+_0x2ed55b[_0x9bd0('0x29')];var _0x362d44;if(_0x52b9b5>=_0x55ec8d){_0x52b9b5=_0x55ec8d;_0x362d44=0xc8;}else{_0x362d44=0xce;}_0x2295ed['status'](_0x362d44);return _0x2295ed[_0x9bd0('0x2c')]('Content-Range',_0x27a2c1+'-'+_0x52b9b5+'/'+_0x55ec8d)[_0x9bd0('0x2d')](_0x28962f);}return null;};}function patchUpdates(_0x4ec39b){return function(_0x4ef255){try{jsonpatch[_0x9bd0('0x2e')](_0x4ef255,_0x4ec39b,!![]);}catch(_0x1a8cea){return BPromise['reject'](_0x1a8cea);}return _0x4ef255[_0x9bd0('0x2f')]();};}function saveUpdates(_0x53aa5e,_0x5f41d5){return function(_0x37fc09){if(_0x37fc09){return _0x37fc09[_0x9bd0('0x30')](_0x53aa5e)['then'](function(_0x583930){return _0x583930;});}return null;};}function removeEntity(_0x5042b9,_0x5253b7){return function(_0x3b0ce6){if(_0x3b0ce6){return _0x3b0ce6[_0x9bd0('0x31')]()[_0x9bd0('0x1c')](function(){_0x5042b9[_0x9bd0('0x27')](0xcc)[_0x9bd0('0x32')]();});}};}function handleEntityNotFound(_0x37d340,_0x45b11f){return function(_0x4c95e1){if(!_0x4c95e1){_0x37d340['sendStatus'](0x194);}return _0x4c95e1;};}function handleError(_0x182c2e,_0x5e06f7){_0x5e06f7=_0x5e06f7||0x1f4;return function(_0x386c0a){logger['error'](_0x386c0a[_0x9bd0('0x33')]);if(_0x386c0a[_0x9bd0('0x34')]){delete _0x386c0a[_0x9bd0('0x34')];}_0x182c2e['status'](_0x5e06f7)['send'](_0x386c0a);};}exports[_0x9bd0('0x35')]=function(_0x17da3c,_0x33d484){var _0xab1bb1={},_0x5caf2e={},_0xdf07a7={'count':0x0,'rows':[]};var _0x4ffaba=_[_0x9bd0('0x36')](db[_0x9bd0('0x37')][_0x9bd0('0x38')],function(_0x44206c){return{'name':_0x44206c[_0x9bd0('0x39')],'type':_0x44206c[_0x9bd0('0x3a')][_0x9bd0('0x3b')]};});_0x5caf2e['model']=_[_0x9bd0('0x36')](_0x4ffaba,'name');_0x5caf2e[_0x9bd0('0x3c')]=_[_0x9bd0('0x3d')](_0x17da3c['query']);_0x5caf2e[_0x9bd0('0x3e')]=_[_0x9bd0('0x3f')](_0x5caf2e[_0x9bd0('0x40')],_0x5caf2e[_0x9bd0('0x3c')]);_0xab1bb1[_0x9bd0('0x41')]=_['intersection'](_0x5caf2e[_0x9bd0('0x40')],qs[_0x9bd0('0x42')](_0x17da3c[_0x9bd0('0x3c')][_0x9bd0('0x42')]));_0xab1bb1['attributes']=_0xab1bb1[_0x9bd0('0x41')]['length']?_0xab1bb1[_0x9bd0('0x41')]:_0x5caf2e[_0x9bd0('0x40')];if(!_0x17da3c[_0x9bd0('0x3c')][_0x9bd0('0x43')](_0x9bd0('0x44'))){_0xab1bb1['limit']=qs['limit'](_0x17da3c[_0x9bd0('0x3c')]['limit']);_0xab1bb1[_0x9bd0('0x2b')]=qs['offset'](_0x17da3c[_0x9bd0('0x3c')][_0x9bd0('0x2b')]);}_0xab1bb1[_0x9bd0('0x45')]=qs[_0x9bd0('0x46')](_0x17da3c[_0x9bd0('0x3c')][_0x9bd0('0x46')]);_0xab1bb1[_0x9bd0('0x47')]=qs[_0x9bd0('0x3e')](_['pick'](_0x17da3c[_0x9bd0('0x3c')],_0x5caf2e[_0x9bd0('0x3e')]),_0x4ffaba);if(_0x17da3c[_0x9bd0('0x3c')]['filter']){_0xab1bb1[_0x9bd0('0x47')]=_[_0x9bd0('0x48')](_0xab1bb1['where'],{'$or':_[_0x9bd0('0x36')](_0x4ffaba,function(_0x4501a6){if(_0x4501a6['type']!==_0x9bd0('0x49')){var _0x135695={};_0x135695[_0x4501a6[_0x9bd0('0x34')]]={'$like':'%'+_0x17da3c[_0x9bd0('0x3c')][_0x9bd0('0x4a')]+'%'};return _0x135695;}})});}_0xab1bb1=_[_0x9bd0('0x48')]({},_0xab1bb1,_0x17da3c['options']);var _0x4a6c79={'where':_0xab1bb1[_0x9bd0('0x47')]};return db[_0x9bd0('0x37')][_0x9bd0('0x2a')](_0x4a6c79)[_0x9bd0('0x1c')](function(_0x1b8576){_0xdf07a7[_0x9bd0('0x2a')]=_0x1b8576;if(_0x17da3c['query']['includeAll']){_0xab1bb1['include']=[{'all':!![]}];}return db[_0x9bd0('0x37')][_0x9bd0('0x4b')](_0xab1bb1);})[_0x9bd0('0x1c')](function(_0x33931b){_0xdf07a7['rows']=_0x33931b;return _0xdf07a7;})[_0x9bd0('0x1c')](respondWithFilteredResult(_0x33d484,_0xab1bb1))[_0x9bd0('0x25')](handleError(_0x33d484,null));};exports[_0x9bd0('0x4c')]=function(_0x14aaef,_0x2f9960){var _0x2d8af5={'raw':![],'where':{'id':_0x14aaef[_0x9bd0('0x4d')]['id']}},_0x2854ce={};_0x2854ce[_0x9bd0('0x40')]=_['keys'](db['FreshdeskConfiguration'][_0x9bd0('0x38')]);_0x2854ce[_0x9bd0('0x3c')]=_[_0x9bd0('0x3d')](_0x14aaef[_0x9bd0('0x3c')]);_0x2854ce[_0x9bd0('0x3e')]=_['intersection'](_0x2854ce[_0x9bd0('0x40')],_0x2854ce[_0x9bd0('0x3c')]);_0x2d8af5[_0x9bd0('0x41')]=_[_0x9bd0('0x3f')](_0x2854ce[_0x9bd0('0x40')],qs[_0x9bd0('0x42')](_0x14aaef[_0x9bd0('0x3c')][_0x9bd0('0x42')]));_0x2d8af5[_0x9bd0('0x41')]=_0x2d8af5[_0x9bd0('0x41')][_0x9bd0('0x4e')]?_0x2d8af5[_0x9bd0('0x41')]:_0x2854ce[_0x9bd0('0x40')];if(_0x14aaef[_0x9bd0('0x3c')][_0x9bd0('0x4f')]){_0x2d8af5[_0x9bd0('0x50')]=[{'all':!![]}];}_0x2d8af5=_[_0x9bd0('0x48')]({},_0x2d8af5,_0x14aaef[_0x9bd0('0x51')]);return db[_0x9bd0('0x37')][_0x9bd0('0x52')](_0x2d8af5)[_0x9bd0('0x1c')](handleEntityNotFound(_0x2f9960,null))[_0x9bd0('0x1c')](respondWithResult(_0x2f9960,null))[_0x9bd0('0x25')](handleError(_0x2f9960,null));};exports[_0x9bd0('0x53')]=function(_0x4d7a7e,_0x18a0d6){return db[_0x9bd0('0x37')][_0x9bd0('0x53')](_0x4d7a7e['body'],{})[_0x9bd0('0x1c')](respondWithResult(_0x18a0d6,0xc9))[_0x9bd0('0x25')](handleError(_0x18a0d6,null));};exports[_0x9bd0('0x30')]=function(_0x31af06,_0x7a032b){if(_0x31af06[_0x9bd0('0x54')]['id']){delete _0x31af06[_0x9bd0('0x54')]['id'];}return db['FreshdeskConfiguration'][_0x9bd0('0x52')]({'where':{'id':_0x31af06[_0x9bd0('0x4d')]['id']}})['then'](handleEntityNotFound(_0x7a032b,null))[_0x9bd0('0x1c')](saveUpdates(_0x31af06['body'],null))[_0x9bd0('0x1c')](respondWithResult(_0x7a032b,null))[_0x9bd0('0x25')](handleError(_0x7a032b,null));};exports[_0x9bd0('0x31')]=function(_0x4a4315,_0xdd6f07){return db[_0x9bd0('0x37')][_0x9bd0('0x52')]({'where':{'id':_0x4a4315['params']['id']}})[_0x9bd0('0x1c')](handleEntityNotFound(_0xdd6f07,null))['then'](removeEntity(_0xdd6f07,null))[_0x9bd0('0x25')](handleError(_0xdd6f07,null));};exports[_0x9bd0('0x55')]=function(_0x189da0,_0x572d57,_0xb5d787){var _0x60783={};var _0x22b07c={};var _0x5f5058;var _0x3bffce;return db[_0x9bd0('0x37')][_0x9bd0('0x56')]({'where':{'id':_0x189da0[_0x9bd0('0x4d')]['id']}})[_0x9bd0('0x1c')](handleEntityNotFound(_0x572d57,null))[_0x9bd0('0x1c')](function(_0x1dc03a){if(_0x1dc03a){_0x5f5058=_0x1dc03a;_0x22b07c['model']=_[_0x9bd0('0x3d')](db[_0x9bd0('0x57')][_0x9bd0('0x38')]);_0x22b07c[_0x9bd0('0x3c')]=_['keys'](_0x189da0['query']);_0x22b07c[_0x9bd0('0x3e')]=_[_0x9bd0('0x3f')](_0x22b07c[_0x9bd0('0x40')],_0x22b07c[_0x9bd0('0x3c')]);_0x60783[_0x9bd0('0x41')]=_[_0x9bd0('0x3f')](_0x22b07c['model'],qs[_0x9bd0('0x42')](_0x189da0[_0x9bd0('0x3c')]['fields']));_0x60783[_0x9bd0('0x41')]=_0x60783[_0x9bd0('0x41')]['length']?_0x60783['attributes']:_0x22b07c['model'];_0x60783[_0x9bd0('0x45')]=qs[_0x9bd0('0x46')](_0x189da0[_0x9bd0('0x3c')]['sort']);_0x60783[_0x9bd0('0x47')]=qs[_0x9bd0('0x3e')](_[_0x9bd0('0x58')](_0x189da0[_0x9bd0('0x3c')],_0x22b07c['filters']));if(_0x189da0[_0x9bd0('0x3c')][_0x9bd0('0x4a')]){_0x60783[_0x9bd0('0x47')]=_[_0x9bd0('0x48')](_0x60783['where'],{'$or':_[_0x9bd0('0x36')](_0x60783[_0x9bd0('0x41')],function(_0x23fd60){var _0x2599d2={};_0x2599d2[_0x23fd60]={'$like':'%'+_0x189da0[_0x9bd0('0x3c')][_0x9bd0('0x4a')]+'%'};return _0x2599d2;})});}_0x60783=_['merge']({},_0x60783,_0x189da0[_0x9bd0('0x51')]);return _0x5f5058[_0x9bd0('0x55')](_0x60783);}})[_0x9bd0('0x1c')](function(_0x4d7bed){if(_0x4d7bed){_0x3bffce=_0x4d7bed['length'];if(!_0x189da0['query'][_0x9bd0('0x43')](_0x9bd0('0x44'))){_0x60783[_0x9bd0('0x29')]=qs['limit'](_0x189da0[_0x9bd0('0x3c')]['limit']);_0x60783[_0x9bd0('0x2b')]=qs[_0x9bd0('0x2b')](_0x189da0['query'][_0x9bd0('0x2b')]);}return _0x5f5058[_0x9bd0('0x55')](_0x60783);}})[_0x9bd0('0x1c')](function(_0x50d52c){if(_0x50d52c){return _0x50d52c?{'count':_0x3bffce,'rows':_0x50d52c}:null;}})[_0x9bd0('0x1c')](respondWithResult(_0x572d57,null))['catch'](handleError(_0x572d57,null));};exports['getSubjects']=function(_0x5d45c2,_0x19fab5,_0x40dbef){var _0x3f3eef={};var _0x5ee7d1={};var _0x2dcb5b;var _0x4d3a2b;return db[_0x9bd0('0x37')][_0x9bd0('0x56')]({'where':{'id':_0x5d45c2['params']['id']}})[_0x9bd0('0x1c')](handleEntityNotFound(_0x19fab5,null))[_0x9bd0('0x1c')](function(_0x44f249){if(_0x44f249){_0x2dcb5b=_0x44f249;_0x5ee7d1['model']=_[_0x9bd0('0x3d')](db[_0x9bd0('0x57')][_0x9bd0('0x38')]);_0x5ee7d1[_0x9bd0('0x3c')]=_[_0x9bd0('0x3d')](_0x5d45c2[_0x9bd0('0x3c')]);_0x5ee7d1[_0x9bd0('0x3e')]=_[_0x9bd0('0x3f')](_0x5ee7d1['model'],_0x5ee7d1[_0x9bd0('0x3c')]);_0x3f3eef[_0x9bd0('0x41')]=_[_0x9bd0('0x3f')](_0x5ee7d1['model'],qs[_0x9bd0('0x42')](_0x5d45c2[_0x9bd0('0x3c')]['fields']));_0x3f3eef[_0x9bd0('0x41')]=_0x3f3eef['attributes']['length']?_0x3f3eef['attributes']:_0x5ee7d1[_0x9bd0('0x40')];_0x3f3eef[_0x9bd0('0x45')]=qs[_0x9bd0('0x46')](_0x5d45c2[_0x9bd0('0x3c')][_0x9bd0('0x46')]);_0x3f3eef['where']=qs[_0x9bd0('0x3e')](_[_0x9bd0('0x58')](_0x5d45c2[_0x9bd0('0x3c')],_0x5ee7d1[_0x9bd0('0x3e')]));if(_0x5d45c2[_0x9bd0('0x3c')][_0x9bd0('0x4a')]){_0x3f3eef[_0x9bd0('0x47')]=_[_0x9bd0('0x48')](_0x3f3eef[_0x9bd0('0x47')],{'$or':_[_0x9bd0('0x36')](_0x3f3eef[_0x9bd0('0x41')],function(_0x2575af){var _0x482373={};_0x482373[_0x2575af]={'$like':'%'+_0x5d45c2[_0x9bd0('0x3c')][_0x9bd0('0x4a')]+'%'};return _0x482373;})});}_0x3f3eef=_[_0x9bd0('0x48')]({},_0x3f3eef,_0x5d45c2[_0x9bd0('0x51')]);return _0x2dcb5b[_0x9bd0('0x59')](_0x3f3eef);}})[_0x9bd0('0x1c')](function(_0x36c612){if(_0x36c612){_0x4d3a2b=_0x36c612[_0x9bd0('0x4e')];if(!_0x5d45c2[_0x9bd0('0x3c')][_0x9bd0('0x43')](_0x9bd0('0x44'))){_0x3f3eef[_0x9bd0('0x29')]=qs['limit'](_0x5d45c2[_0x9bd0('0x3c')][_0x9bd0('0x29')]);_0x3f3eef[_0x9bd0('0x2b')]=qs['offset'](_0x5d45c2[_0x9bd0('0x3c')][_0x9bd0('0x2b')]);}return _0x2dcb5b[_0x9bd0('0x59')](_0x3f3eef);}})['then'](function(_0x93bf12){if(_0x93bf12){return _0x93bf12?{'count':_0x4d3a2b,'rows':_0x93bf12}:null;}})['then'](respondWithResult(_0x19fab5,null))[_0x9bd0('0x25')](handleError(_0x19fab5,null));};exports[_0x9bd0('0x5a')]=function(_0xcc1db2,_0x5bf758,_0x180e36){var _0x4bd001={};var _0x424192={};var _0x509ede;var _0x31491a;return db['FreshdeskConfiguration']['findOne']({'where':{'id':_0xcc1db2[_0x9bd0('0x4d')]['id']}})[_0x9bd0('0x1c')](handleEntityNotFound(_0x5bf758,null))['then'](function(_0x546849){if(_0x546849){_0x509ede=_0x546849;_0x424192['model']=_[_0x9bd0('0x3d')](db[_0x9bd0('0x57')][_0x9bd0('0x38')]);_0x424192[_0x9bd0('0x3c')]=_[_0x9bd0('0x3d')](_0xcc1db2['query']);_0x424192[_0x9bd0('0x3e')]=_[_0x9bd0('0x3f')](_0x424192[_0x9bd0('0x40')],_0x424192[_0x9bd0('0x3c')]);_0x4bd001[_0x9bd0('0x41')]=_[_0x9bd0('0x3f')](_0x424192['model'],qs[_0x9bd0('0x42')](_0xcc1db2[_0x9bd0('0x3c')][_0x9bd0('0x42')]));_0x4bd001['attributes']=_0x4bd001[_0x9bd0('0x41')]['length']?_0x4bd001[_0x9bd0('0x41')]:_0x424192[_0x9bd0('0x40')];_0x4bd001['order']=qs[_0x9bd0('0x46')](_0xcc1db2['query'][_0x9bd0('0x46')]);_0x4bd001[_0x9bd0('0x47')]=qs[_0x9bd0('0x3e')](_[_0x9bd0('0x58')](_0xcc1db2[_0x9bd0('0x3c')],_0x424192['filters']));if(_0xcc1db2['query'][_0x9bd0('0x4a')]){_0x4bd001[_0x9bd0('0x47')]=_['merge'](_0x4bd001[_0x9bd0('0x47')],{'$or':_[_0x9bd0('0x36')](_0x4bd001[_0x9bd0('0x41')],function(_0x4acc6b){var _0x29f035={};_0x29f035[_0x4acc6b]={'$like':'%'+_0xcc1db2[_0x9bd0('0x3c')]['filter']+'%'};return _0x29f035;})});}_0x4bd001=_[_0x9bd0('0x48')]({},_0x4bd001,_0xcc1db2[_0x9bd0('0x51')]);return _0x509ede['getDescriptions'](_0x4bd001);}})[_0x9bd0('0x1c')](function(_0x24c428){if(_0x24c428){_0x31491a=_0x24c428[_0x9bd0('0x4e')];if(!_0xcc1db2[_0x9bd0('0x3c')][_0x9bd0('0x43')](_0x9bd0('0x44'))){_0x4bd001[_0x9bd0('0x29')]=qs['limit'](_0xcc1db2[_0x9bd0('0x3c')]['limit']);_0x4bd001[_0x9bd0('0x2b')]=qs[_0x9bd0('0x2b')](_0xcc1db2[_0x9bd0('0x3c')][_0x9bd0('0x2b')]);}return _0x509ede[_0x9bd0('0x5a')](_0x4bd001);}})[_0x9bd0('0x1c')](function(_0x51bfa2){if(_0x51bfa2){return _0x51bfa2?{'count':_0x31491a,'rows':_0x51bfa2}:null;}})[_0x9bd0('0x1c')](respondWithResult(_0x5bf758,null))[_0x9bd0('0x25')](handleError(_0x5bf758,null));};exports[_0x9bd0('0x5b')]=function(_0x291fc5,_0xf82c6,_0x2463e4){var _0x4f6c78={};var _0x3fdf1d={};var _0x38f710;var _0x1300b0;return db[_0x9bd0('0x37')][_0x9bd0('0x56')]({'where':{'id':_0x291fc5[_0x9bd0('0x4d')]['id']}})['then'](handleEntityNotFound(_0xf82c6,null))[_0x9bd0('0x1c')](function(_0x3dd670){if(_0x3dd670){_0x38f710=_0x3dd670;_0x3fdf1d[_0x9bd0('0x40')]=_[_0x9bd0('0x3d')](db[_0x9bd0('0x5c')][_0x9bd0('0x38')]);_0x3fdf1d['query']=_[_0x9bd0('0x3d')](_0x291fc5[_0x9bd0('0x3c')]);_0x3fdf1d[_0x9bd0('0x3e')]=_['intersection'](_0x3fdf1d[_0x9bd0('0x40')],_0x3fdf1d['query']);_0x4f6c78[_0x9bd0('0x41')]=_[_0x9bd0('0x3f')](_0x3fdf1d[_0x9bd0('0x40')],qs['fields'](_0x291fc5[_0x9bd0('0x3c')][_0x9bd0('0x42')]));_0x4f6c78[_0x9bd0('0x41')]=_0x4f6c78[_0x9bd0('0x41')][_0x9bd0('0x4e')]?_0x4f6c78['attributes']:_0x3fdf1d[_0x9bd0('0x40')];_0x4f6c78['order']=qs['sort'](_0x291fc5[_0x9bd0('0x3c')]['sort']);_0x4f6c78[_0x9bd0('0x47')]=qs[_0x9bd0('0x3e')](_[_0x9bd0('0x58')](_0x291fc5[_0x9bd0('0x3c')],_0x3fdf1d[_0x9bd0('0x3e')]));if(_0x291fc5[_0x9bd0('0x3c')][_0x9bd0('0x4a')]){_0x4f6c78[_0x9bd0('0x47')]=_['merge'](_0x4f6c78[_0x9bd0('0x47')],{'$or':_[_0x9bd0('0x36')](_0x4f6c78[_0x9bd0('0x41')],function(_0x2a9592){var _0xf625a6={};_0xf625a6[_0x2a9592]={'$like':'%'+_0x291fc5[_0x9bd0('0x3c')]['filter']+'%'};return _0xf625a6;})});}_0x4f6c78=_[_0x9bd0('0x48')]({},_0x4f6c78,_0x291fc5['options']);return _0x38f710[_0x9bd0('0x5b')](_0x4f6c78);}})[_0x9bd0('0x1c')](function(_0x19f3ce){if(_0x19f3ce){_0x1300b0=_0x19f3ce['length'];if(!_0x291fc5['query'][_0x9bd0('0x43')]('nolimit')){_0x4f6c78[_0x9bd0('0x29')]=qs[_0x9bd0('0x29')](_0x291fc5[_0x9bd0('0x3c')][_0x9bd0('0x29')]);_0x4f6c78['offset']=qs[_0x9bd0('0x2b')](_0x291fc5[_0x9bd0('0x3c')][_0x9bd0('0x2b')]);}return _0x38f710['getTags'](_0x4f6c78);}})[_0x9bd0('0x1c')](function(_0x2adb02){if(_0x2adb02){return _0x2adb02?{'count':_0x1300b0,'rows':_0x2adb02}:null;}})[_0x9bd0('0x1c')](respondWithResult(_0xf82c6,null))[_0x9bd0('0x25')](handleError(_0xf82c6,null));};exports[_0x9bd0('0x5d')]=function(_0x418e74,_0x3ceddc,_0x3f4257){if(_0x418e74[_0x9bd0('0x54')]['id']){delete _0x418e74[_0x9bd0('0x54')]['id'];}return db['FreshdeskConfiguration'][_0x9bd0('0x56')]({'where':{'id':_0x418e74['params']['id']}})[_0x9bd0('0x1c')](handleEntityNotFound(_0x3ceddc,null))['then'](function(_0xab9108){if(_0xab9108){return _0xab9108[_0x9bd0('0x5d')](_0x418e74[_0x9bd0('0x54')][_0x9bd0('0x5e')]||[]);}return null;})[_0x9bd0('0x1c')](respondWithResult(_0x3ceddc,null))[_0x9bd0('0x25')](handleError(_0x3ceddc,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index 61e27bd..655e60d 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 _0x54fe=['../../config/logger','request-promise','path','rimraf','../../config/environment','./intFreshdeskConfiguration.attributes','exports','define','FreshdeskConfiguration','int_freshdesk_configurations','util'];(function(_0x497607,_0x55ffa3){var _0x404ba8=function(_0x356045){while(--_0x356045){_0x497607['push'](_0x497607['shift']());}};_0x404ba8(++_0x55ffa3);}(_0x54fe,0x149));var _0xe54f=function(_0x4db4d0,_0x43c2e2){_0x4db4d0=_0x4db4d0-0x0;var _0xe758ed=_0x54fe[_0x4db4d0];return _0xe758ed;};'use strict';var _=require('lodash');var util=require(_0xe54f('0x0'));var logger=require(_0xe54f('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xe54f('0x2'));var fs=require('fs');var path=require(_0xe54f('0x3'));var rimraf=require(_0xe54f('0x4'));var config=require(_0xe54f('0x5'));var attributes=require(_0xe54f('0x6'));module[_0xe54f('0x7')]=function(_0xb78825,_0x4e7a07){return _0xb78825[_0xe54f('0x8')](_0xe54f('0x9'),attributes,{'tableName':_0xe54f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x957d=['int_freshdesk_configurations','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskConfiguration.attributes','exports','define','FreshdeskConfiguration'];(function(_0x204fb4,_0x2523d8){var _0x442279=function(_0x5f7aae){while(--_0x5f7aae){_0x204fb4['push'](_0x204fb4['shift']());}};_0x442279(++_0x2523d8);}(_0x957d,0x1cf));var _0xd957=function(_0x488339,_0x40a104){_0x488339=_0x488339-0x0;var _0x3f17ea=_0x957d[_0x488339];return _0x3f17ea;};'use strict';var _=require('lodash');var util=require(_0xd957('0x0'));var logger=require(_0xd957('0x1'))(_0xd957('0x2'));var moment=require(_0xd957('0x3'));var BPromise=require(_0xd957('0x4'));var rp=require(_0xd957('0x5'));var fs=require('fs');var path=require(_0xd957('0x6'));var rimraf=require(_0xd957('0x7'));var config=require(_0xd957('0x8'));var attributes=require(_0xd957('0x9'));module[_0xd957('0xa')]=function(_0x535a43,_0x4961d3){return _0x535a43[_0xd957('0xb')](_0xd957('0xc'),attributes,{'tableName':_0xd957('0xd'),'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 ed152b4..10ba9c5 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 _0x35cc=['error','code','FreshdeskConfiguration,\x20%s,\x20%s','message','info','result','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x416999,_0x368330){var _0x19eeb3=function(_0x267071){while(--_0x267071){_0x416999['push'](_0x416999['shift']());}};_0x19eeb3(++_0x368330);}(_0x35cc,0x15f));var _0xc35c=function(_0xa08938,_0x2e2512){_0xa08938=_0xa08938-0x0;var _0x3c03da=_0x35cc[_0xa08938];return _0x3c03da;};'use strict';var _=require(_0xc35c('0x0'));var util=require('util');var moment=require(_0xc35c('0x1'));var BPromise=require(_0xc35c('0x2'));var rs=require(_0xc35c('0x3'));var fs=require('fs');var Redis=require(_0xc35c('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xc35c('0x5'));var logger=require('../../config/logger')(_0xc35c('0x6'));var config=require(_0xc35c('0x7'));var jayson=require(_0xc35c('0x8'));var client=jayson[_0xc35c('0x9')][_0xc35c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x35820e,_0x363996,_0x6525ec){return new BPromise(function(_0x2fae66,_0x5d8674){return client[_0xc35c('0xb')](_0x35820e,_0x6525ec)[_0xc35c('0xc')](function(_0x5795f1){logger['info']('FreshdeskConfiguration,\x20%s,\x20%s',_0x363996,'request\x20sent');logger[_0xc35c('0xd')](_0xc35c('0xe'),_0x363996,_0xc35c('0xf'),JSON[_0xc35c('0x10')](_0x5795f1));if(_0x5795f1[_0xc35c('0x11')]){if(_0x5795f1['error'][_0xc35c('0x12')]===0x1f4){logger[_0xc35c('0x11')](_0xc35c('0x13'),_0x363996,_0x5795f1['error'][_0xc35c('0x14')]);return _0x5d8674(_0x5795f1[_0xc35c('0x11')]['message']);}logger[_0xc35c('0x11')](_0xc35c('0x13'),_0x363996,_0x5795f1[_0xc35c('0x11')][_0xc35c('0x14')]);return _0x2fae66(_0x5795f1[_0xc35c('0x11')][_0xc35c('0x14')]);}else{logger[_0xc35c('0x15')](_0xc35c('0x13'),_0x363996,'request\x20sent');_0x2fae66(_0x5795f1[_0xc35c('0x16')][_0xc35c('0x14')]);}})['catch'](function(_0x1b6d9f){logger[_0xc35c('0x11')](_0xc35c('0x13'),_0x363996,_0x1b6d9f);_0x5d8674(_0x1b6d9f);});});} \ No newline at end of file +var _0x1279=['bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','request\x20sent','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshdeskConfiguration,\x20%s,\x20%s','message','result','catch','lodash','util','moment'];(function(_0x555e89,_0x116bce){var _0xdee237=function(_0x41a889){while(--_0x41a889){_0x555e89['push'](_0x555e89['shift']());}};_0xdee237(++_0x116bce);}(_0x1279,0x1e0));var _0x9127=function(_0x23fcf0,_0x15d674){_0x23fcf0=_0x23fcf0-0x0;var _0x2df8f6=_0x1279[_0x23fcf0];return _0x2df8f6;};'use strict';var _=require(_0x9127('0x0'));var util=require(_0x9127('0x1'));var moment=require(_0x9127('0x2'));var BPromise=require(_0x9127('0x3'));var rs=require(_0x9127('0x4'));var fs=require('fs');var Redis=require(_0x9127('0x5'));var db=require(_0x9127('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x9127('0x7'))(_0x9127('0x8'));var config=require(_0x9127('0x9'));var jayson=require(_0x9127('0xa'));var client=jayson[_0x9127('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1ddbd2,_0x439bf6,_0x510094){return new BPromise(function(_0x1785d3,_0x5e05a5){return client['request'](_0x1ddbd2,_0x510094)[_0x9127('0xc')](function(_0x28d18d){logger[_0x9127('0xd')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x439bf6,_0x9127('0xe'));logger['debug'](_0x9127('0xf'),_0x439bf6,'request\x20sent',JSON[_0x9127('0x10')](_0x28d18d));if(_0x28d18d[_0x9127('0x11')]){if(_0x28d18d['error'][_0x9127('0x12')]===0x1f4){logger[_0x9127('0x11')](_0x9127('0x13'),_0x439bf6,_0x28d18d[_0x9127('0x11')][_0x9127('0x14')]);return _0x5e05a5(_0x28d18d[_0x9127('0x11')][_0x9127('0x14')]);}logger[_0x9127('0x11')](_0x9127('0x13'),_0x439bf6,_0x28d18d[_0x9127('0x11')]['message']);return _0x1785d3(_0x28d18d[_0x9127('0x11')][_0x9127('0x14')]);}else{logger[_0x9127('0xd')](_0x9127('0x13'),_0x439bf6,_0x9127('0xe'));_0x1785d3(_0x28d18d[_0x9127('0x15')]['message']);}})[_0x9127('0x16')](function(_0x67459c){logger[_0x9127('0x11')](_0x9127('0x13'),_0x439bf6,_0x67459c);_0x5e05a5(_0x67459c);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index 3e7e089..4401a24 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 _0xa3e6=['delete','destroy','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','post','create','put','update'];(function(_0x3fe308,_0x5242fb){var _0x593a57=function(_0x2ae303){while(--_0x2ae303){_0x3fe308['push'](_0x3fe308['shift']());}};_0x593a57(++_0x5242fb);}(_0xa3e6,0x16a));var _0x6a3e=function(_0x4d694d,_0x923a18){_0x4d694d=_0x4d694d-0x0;var _0x4ccf38=_0xa3e6[_0x4d694d];return _0x4ccf38;};'use strict';var multer=require(_0x6a3e('0x0'));var util=require(_0x6a3e('0x1'));var path=require(_0x6a3e('0x2'));var timeout=require(_0x6a3e('0x3'));var express=require('express');var router=express[_0x6a3e('0x4')]();var fs_extra=require(_0x6a3e('0x5'));var auth=require(_0x6a3e('0x6'));var interaction=require(_0x6a3e('0x7'));var config=require(_0x6a3e('0x8'));var controller=require('./intFreshdeskField.controller');router['get']('/',auth[_0x6a3e('0x9')](),controller[_0x6a3e('0xa')]);router[_0x6a3e('0xb')](_0x6a3e('0xc'),auth[_0x6a3e('0x9')](),controller[_0x6a3e('0xd')]);router[_0x6a3e('0xe')]('/',auth[_0x6a3e('0x9')](),controller[_0x6a3e('0xf')]);router[_0x6a3e('0x10')](_0x6a3e('0xc'),auth[_0x6a3e('0x9')](),controller[_0x6a3e('0x11')]);router[_0x6a3e('0x12')](_0x6a3e('0xc'),auth['isAuthenticated'](),controller[_0x6a3e('0x13')]);module['exports']=router; \ No newline at end of file +var _0x9edc=['Router','fs-extra','../../components/interaction/service','../../config/environment','get','index','show','post','isAuthenticated','create','put','/:id','update','delete','destroy','multer','util','path','connect-timeout','express'];(function(_0x554d9b,_0x2ff157){var _0x24c6dd=function(_0x5f1070){while(--_0x5f1070){_0x554d9b['push'](_0x554d9b['shift']());}};_0x24c6dd(++_0x2ff157);}(_0x9edc,0xff));var _0xc9ed=function(_0x4ec9e3,_0x15fbf4){_0x4ec9e3=_0x4ec9e3-0x0;var _0x2883ce=_0x9edc[_0x4ec9e3];return _0x2883ce;};'use strict';var multer=require(_0xc9ed('0x0'));var util=require(_0xc9ed('0x1'));var path=require(_0xc9ed('0x2'));var timeout=require(_0xc9ed('0x3'));var express=require(_0xc9ed('0x4'));var router=express[_0xc9ed('0x5')]();var fs_extra=require(_0xc9ed('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xc9ed('0x7'));var config=require(_0xc9ed('0x8'));var controller=require('./intFreshdeskField.controller');router[_0xc9ed('0x9')]('/',auth['isAuthenticated'](),controller[_0xc9ed('0xa')]);router[_0xc9ed('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xc9ed('0xb')]);router[_0xc9ed('0xc')]('/',auth[_0xc9ed('0xd')](),controller[_0xc9ed('0xe')]);router[_0xc9ed('0xf')](_0xc9ed('0x10'),auth[_0xc9ed('0xd')](),controller[_0xc9ed('0x11')]);router[_0xc9ed('0x12')](_0xc9ed('0x10'),auth[_0xc9ed('0xd')](),controller[_0xc9ed('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index 169aad9..ba85d8a 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 _0xfc55=['sequelize','exports','string','customVariable','keyValue','picklist','STRING','ENUM','variable','BOOLEAN'];(function(_0x3aa523,_0xa038b3){var _0x1f8a4a=function(_0x2e9642){while(--_0x2e9642){_0x3aa523['push'](_0x3aa523['shift']());}};_0x1f8a4a(++_0xa038b3);}(_0xfc55,0xe6));var _0x5fc5=function(_0xc8eead,_0x4f9461){_0xc8eead=_0xc8eead-0x0;var _0x46daca=_0xfc55[_0xc8eead];return _0x46daca;};'use strict';var Sequelize=require(_0x5fc5('0x0'));module[_0x5fc5('0x1')]={'type':{'type':Sequelize['ENUM'](_0x5fc5('0x2'),'variable',_0x5fc5('0x3'),_0x5fc5('0x4'),_0x5fc5('0x5')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x5fc5('0x6')]},'keyType':{'type':Sequelize[_0x5fc5('0x7')](_0x5fc5('0x2'),_0x5fc5('0x8'),_0x5fc5('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x5fc5('0x6')]},'customField':{'type':Sequelize[_0x5fc5('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x5fc5('0x6')]}}; \ No newline at end of file +var _0x1bdc=['ENUM','string','variable','customVariable','keyValue','STRING','sequelize','exports'];(function(_0x15fb19,_0x3f9d71){var _0x5b1b67=function(_0x1b51f7){while(--_0x1b51f7){_0x15fb19['push'](_0x15fb19['shift']());}};_0x5b1b67(++_0x3f9d71);}(_0x1bdc,0x156));var _0xc1bd=function(_0x96d8bb,_0x59e193){_0x96d8bb=_0x96d8bb-0x0;var _0x296ef2=_0x1bdc[_0x96d8bb];return _0x296ef2;};'use strict';var Sequelize=require(_0xc1bd('0x0'));module[_0xc1bd('0x1')]={'type':{'type':Sequelize[_0xc1bd('0x2')](_0xc1bd('0x3'),_0xc1bd('0x4'),_0xc1bd('0x5'),_0xc1bd('0x6'),'picklist'),'defaultValue':_0xc1bd('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xc1bd('0x2')]('string',_0xc1bd('0x4'),_0xc1bd('0x5'))},'keyContent':{'type':Sequelize[_0xc1bd('0x7')]},'idField':{'type':Sequelize[_0xc1bd('0x7')]},'nameField':{'type':Sequelize[_0xc1bd('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index 50cb2da..6603337 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 _0xd8b0=['type','keys','intersection','model','query','attributes','fields','nolimit','limit','order','sort','where','filter','merge','map','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','filters','length','find','create','body','params','eml-format','rimraf','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','save','update','then','destroy','error','name','index','FreshdeskField','fieldName'];(function(_0x4af825,_0x25d906){var _0x33ff22=function(_0x5be8fd){while(--_0x5be8fd){_0x4af825['push'](_0x4af825['shift']());}};_0x33ff22(++_0x25d906);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var emlformat=require(_0x0d8b('0x0'));var rimraf=require(_0x0d8b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0d8b('0x2'));var BPromise=require(_0x0d8b('0x3'));var Mustache=require(_0x0d8b('0x4'));var util=require(_0x0d8b('0x5'));var path=require(_0x0d8b('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x0d8b('0x7'));var fs=require('fs');var fs_extra=require(_0x0d8b('0x8'));var _=require(_0x0d8b('0x9'));var squel=require('squel');var crypto=require(_0x0d8b('0xa'));var jsforce=require(_0x0d8b('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x0d8b('0xc'));var querystring=require(_0x0d8b('0xd'));var Papa=require(_0x0d8b('0xe'));var Redis=require(_0x0d8b('0xf'));var authService=require(_0x0d8b('0x10'));var qs=require(_0x0d8b('0x11'));var as=require(_0x0d8b('0x12'));var hardwareService=require(_0x0d8b('0x13'));var logger=require('../../config/logger')(_0x0d8b('0x14'));var utils=require('../../config/utils');var config=require(_0x0d8b('0x15'));var licenseUtil=require(_0x0d8b('0x16'));var db=require(_0x0d8b('0x17'))['db'];function respondWithStatusCode(_0x92cdd8,_0x35a07b){_0x35a07b=_0x35a07b||0xcc;return function(_0x32bb1a){if(_0x32bb1a){return _0x92cdd8[_0x0d8b('0x18')](_0x35a07b);}return _0x92cdd8[_0x0d8b('0x19')](_0x35a07b)[_0x0d8b('0x1a')]();};}function respondWithResult(_0x2ce75e,_0x5ad086){_0x5ad086=_0x5ad086||0xc8;return function(_0xe65334){if(_0xe65334){return _0x2ce75e[_0x0d8b('0x19')](_0x5ad086)[_0x0d8b('0x1b')](_0xe65334);}};}function respondWithFilteredResult(_0x4f6f21,_0x23eb7b){return function(_0xa86349){if(_0xa86349){var _0x17f7df=typeof _0x23eb7b[_0x0d8b('0x1c')]===_0x0d8b('0x1d')&&typeof _0x23eb7b['limit']===_0x0d8b('0x1d');var _0x4586c2=_0xa86349[_0x0d8b('0x1e')];var _0x5fecbd=_0x17f7df?0x0:_0x23eb7b[_0x0d8b('0x1c')];var _0x18dd2d=_0x17f7df?_0xa86349[_0x0d8b('0x1e')]:_0x23eb7b[_0x0d8b('0x1c')]+_0x23eb7b['limit'];var _0x27512e;if(_0x18dd2d>=_0x4586c2){_0x18dd2d=_0x4586c2;_0x27512e=0xc8;}else{_0x27512e=0xce;}_0x4f6f21[_0x0d8b('0x19')](_0x27512e);return _0x4f6f21[_0x0d8b('0x1f')](_0x0d8b('0x20'),_0x5fecbd+'-'+_0x18dd2d+'/'+_0x4586c2)[_0x0d8b('0x1b')](_0xa86349);}return null;};}function patchUpdates(_0x5b709c){return function(_0x393beb){try{jsonpatch[_0x0d8b('0x21')](_0x393beb,_0x5b709c,!![]);}catch(_0x50ec1e){return BPromise['reject'](_0x50ec1e);}return _0x393beb[_0x0d8b('0x22')]();};}function saveUpdates(_0x54a9a7,_0x56c729){return function(_0x5527d8){if(_0x5527d8){return _0x5527d8[_0x0d8b('0x23')](_0x54a9a7)[_0x0d8b('0x24')](function(_0x214778){return _0x214778;});}return null;};}function removeEntity(_0x38efc8,_0x221071){return function(_0x2c64e2){if(_0x2c64e2){return _0x2c64e2[_0x0d8b('0x25')]()[_0x0d8b('0x24')](function(){_0x38efc8[_0x0d8b('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0xe8bbee,_0x4463ee){return function(_0x5363e3){if(!_0x5363e3){_0xe8bbee[_0x0d8b('0x18')](0x194);}return _0x5363e3;};}function handleError(_0x4a0ae4,_0x3dd149){_0x3dd149=_0x3dd149||0x1f4;return function(_0x234bdd){logger[_0x0d8b('0x26')](_0x234bdd['stack']);if(_0x234bdd['name']){delete _0x234bdd[_0x0d8b('0x27')];}_0x4a0ae4[_0x0d8b('0x19')](_0x3dd149)['send'](_0x234bdd);};}exports[_0x0d8b('0x28')]=function(_0x59aa83,_0x1b2b59){var _0x4b59e5={},_0x97050a={},_0x48f24f={'count':0x0,'rows':[]};var _0x2ab00d=_['map'](db[_0x0d8b('0x29')]['rawAttributes'],function(_0x3c8887){return{'name':_0x3c8887[_0x0d8b('0x2a')],'type':_0x3c8887[_0x0d8b('0x2b')]['key']};});_0x97050a['model']=_['map'](_0x2ab00d,_0x0d8b('0x27'));_0x97050a['query']=_[_0x0d8b('0x2c')](_0x59aa83['query']);_0x97050a['filters']=_[_0x0d8b('0x2d')](_0x97050a[_0x0d8b('0x2e')],_0x97050a[_0x0d8b('0x2f')]);_0x4b59e5[_0x0d8b('0x30')]=_[_0x0d8b('0x2d')](_0x97050a[_0x0d8b('0x2e')],qs[_0x0d8b('0x31')](_0x59aa83[_0x0d8b('0x2f')]['fields']));_0x4b59e5[_0x0d8b('0x30')]=_0x4b59e5[_0x0d8b('0x30')]['length']?_0x4b59e5[_0x0d8b('0x30')]:_0x97050a[_0x0d8b('0x2e')];if(!_0x59aa83[_0x0d8b('0x2f')]['hasOwnProperty'](_0x0d8b('0x32'))){_0x4b59e5[_0x0d8b('0x33')]=qs[_0x0d8b('0x33')](_0x59aa83[_0x0d8b('0x2f')][_0x0d8b('0x33')]);_0x4b59e5['offset']=qs[_0x0d8b('0x1c')](_0x59aa83[_0x0d8b('0x2f')]['offset']);}_0x4b59e5[_0x0d8b('0x34')]=qs[_0x0d8b('0x35')](_0x59aa83[_0x0d8b('0x2f')][_0x0d8b('0x35')]);_0x4b59e5[_0x0d8b('0x36')]=qs['filters'](_['pick'](_0x59aa83[_0x0d8b('0x2f')],_0x97050a['filters']),_0x2ab00d);if(_0x59aa83['query'][_0x0d8b('0x37')]){_0x4b59e5[_0x0d8b('0x36')]=_[_0x0d8b('0x38')](_0x4b59e5[_0x0d8b('0x36')],{'$or':_[_0x0d8b('0x39')](_0x2ab00d,function(_0x24c789){if(_0x24c789['type']!==_0x0d8b('0x3a')){var _0x6a02ad={};_0x6a02ad[_0x24c789[_0x0d8b('0x27')]]={'$like':'%'+_0x59aa83[_0x0d8b('0x2f')][_0x0d8b('0x37')]+'%'};return _0x6a02ad;}})});}_0x4b59e5=_[_0x0d8b('0x38')]({},_0x4b59e5,_0x59aa83[_0x0d8b('0x3b')]);var _0x5c980b={'where':_0x4b59e5[_0x0d8b('0x36')]};return db[_0x0d8b('0x29')][_0x0d8b('0x1e')](_0x5c980b)[_0x0d8b('0x24')](function(_0x59d3ad){_0x48f24f[_0x0d8b('0x1e')]=_0x59d3ad;if(_0x59aa83['query'][_0x0d8b('0x3c')]){_0x4b59e5[_0x0d8b('0x3d')]=[{'all':!![]}];}return db[_0x0d8b('0x29')][_0x0d8b('0x3e')](_0x4b59e5);})[_0x0d8b('0x24')](function(_0x3e632e){_0x48f24f[_0x0d8b('0x3f')]=_0x3e632e;return _0x48f24f;})[_0x0d8b('0x24')](respondWithFilteredResult(_0x1b2b59,_0x4b59e5))[_0x0d8b('0x40')](handleError(_0x1b2b59,null));};exports[_0x0d8b('0x41')]=function(_0x482069,_0x571acf){var _0x576050={'raw':!![],'where':{'id':_0x482069['params']['id']}},_0x4d0811={};_0x4d0811[_0x0d8b('0x2e')]=_[_0x0d8b('0x2c')](db[_0x0d8b('0x29')]['rawAttributes']);_0x4d0811['query']=_[_0x0d8b('0x2c')](_0x482069[_0x0d8b('0x2f')]);_0x4d0811[_0x0d8b('0x42')]=_['intersection'](_0x4d0811[_0x0d8b('0x2e')],_0x4d0811[_0x0d8b('0x2f')]);_0x576050['attributes']=_['intersection'](_0x4d0811[_0x0d8b('0x2e')],qs['fields'](_0x482069[_0x0d8b('0x2f')]['fields']));_0x576050['attributes']=_0x576050[_0x0d8b('0x30')][_0x0d8b('0x43')]?_0x576050['attributes']:_0x4d0811['model'];if(_0x482069['query']['includeAll']){_0x576050[_0x0d8b('0x3d')]=[{'all':!![]}];}_0x576050=_[_0x0d8b('0x38')]({},_0x576050,_0x482069[_0x0d8b('0x3b')]);return db['FreshdeskField'][_0x0d8b('0x44')](_0x576050)[_0x0d8b('0x24')](handleEntityNotFound(_0x571acf,null))[_0x0d8b('0x24')](respondWithResult(_0x571acf,null))[_0x0d8b('0x40')](handleError(_0x571acf,null));};exports[_0x0d8b('0x45')]=function(_0x2d5246,_0x11d22b){return db[_0x0d8b('0x29')][_0x0d8b('0x45')](_0x2d5246[_0x0d8b('0x46')],{})[_0x0d8b('0x24')](respondWithResult(_0x11d22b,0xc9))[_0x0d8b('0x40')](handleError(_0x11d22b,null));};exports[_0x0d8b('0x23')]=function(_0x3e569b,_0x570af8){if(_0x3e569b[_0x0d8b('0x46')]['id']){delete _0x3e569b[_0x0d8b('0x46')]['id'];}return db[_0x0d8b('0x29')][_0x0d8b('0x44')]({'where':{'id':_0x3e569b['params']['id']}})[_0x0d8b('0x24')](handleEntityNotFound(_0x570af8,null))['then'](saveUpdates(_0x3e569b['body'],null))[_0x0d8b('0x24')](respondWithResult(_0x570af8,null))[_0x0d8b('0x40')](handleError(_0x570af8,null));};exports[_0x0d8b('0x25')]=function(_0x4396b5,_0x505d22){return db[_0x0d8b('0x29')][_0x0d8b('0x44')]({'where':{'id':_0x4396b5[_0x0d8b('0x47')]['id']}})[_0x0d8b('0x24')](handleEntityNotFound(_0x505d22,null))[_0x0d8b('0x24')](removeEntity(_0x505d22,null))['catch'](handleError(_0x505d22,null));}; \ No newline at end of file +var _0x9f4d=['fieldName','type','key','model','map','query','keys','intersection','attributes','fields','length','order','sort','pick','filters','filter','where','merge','VIRTUAL','options','count','include','findAll','rows','catch','includeAll','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','set','reject','update','then','destroy','sendStatus','stack','name','FreshdeskField','rawAttributes'];(function(_0x41d02a,_0x355e19){var _0x4c3983=function(_0x4802a7){while(--_0x4802a7){_0x41d02a['push'](_0x41d02a['shift']());}};_0x4c3983(++_0x355e19);}(_0x9f4d,0xb0));var _0xd9f4=function(_0x321421,_0x555332){_0x321421=_0x321421-0x0;var _0x5374a4=_0x9f4d[_0x321421];return _0x5374a4;};'use strict';var emlformat=require(_0xd9f4('0x0'));var rimraf=require(_0xd9f4('0x1'));var zipdir=require(_0xd9f4('0x2'));var jsonpatch=require(_0xd9f4('0x3'));var rp=require(_0xd9f4('0x4'));var moment=require(_0xd9f4('0x5'));var BPromise=require(_0xd9f4('0x6'));var Mustache=require(_0xd9f4('0x7'));var util=require(_0xd9f4('0x8'));var path=require('path');var sox=require(_0xd9f4('0x9'));var csv=require('to-csv');var ejs=require(_0xd9f4('0xa'));var fs=require('fs');var fs_extra=require(_0xd9f4('0xb'));var _=require(_0xd9f4('0xc'));var squel=require(_0xd9f4('0xd'));var crypto=require('crypto');var jsforce=require(_0xd9f4('0xe'));var deskjs=require(_0xd9f4('0xf'));var toCsv=require('to-csv');var querystring=require(_0xd9f4('0x10'));var Papa=require('papaparse');var Redis=require(_0xd9f4('0x11'));var authService=require(_0xd9f4('0x12'));var qs=require(_0xd9f4('0x13'));var as=require(_0xd9f4('0x14'));var hardwareService=require(_0xd9f4('0x15'));var logger=require('../../config/logger')(_0xd9f4('0x16'));var utils=require(_0xd9f4('0x17'));var config=require(_0xd9f4('0x18'));var licenseUtil=require(_0xd9f4('0x19'));var db=require(_0xd9f4('0x1a'))['db'];function respondWithStatusCode(_0x104834,_0x26383d){_0x26383d=_0x26383d||0xcc;return function(_0x131804){if(_0x131804){return _0x104834['sendStatus'](_0x26383d);}return _0x104834[_0xd9f4('0x1b')](_0x26383d)[_0xd9f4('0x1c')]();};}function respondWithResult(_0x158cdd,_0xef7729){_0xef7729=_0xef7729||0xc8;return function(_0x8a035d){if(_0x8a035d){return _0x158cdd[_0xd9f4('0x1b')](_0xef7729)[_0xd9f4('0x1d')](_0x8a035d);}};}function respondWithFilteredResult(_0x12dcfb,_0x35f71c){return function(_0x2ca827){if(_0x2ca827){var _0xfd15a4=typeof _0x35f71c[_0xd9f4('0x1e')]===_0xd9f4('0x1f')&&typeof _0x35f71c['limit']==='undefined';var _0x48ecd3=_0x2ca827['count'];var _0x25a7fe=_0xfd15a4?0x0:_0x35f71c[_0xd9f4('0x1e')];var _0xc01934=_0xfd15a4?_0x2ca827['count']:_0x35f71c[_0xd9f4('0x1e')]+_0x35f71c[_0xd9f4('0x20')];var _0x17d097;if(_0xc01934>=_0x48ecd3){_0xc01934=_0x48ecd3;_0x17d097=0xc8;}else{_0x17d097=0xce;}_0x12dcfb['status'](_0x17d097);return _0x12dcfb[_0xd9f4('0x21')]('Content-Range',_0x25a7fe+'-'+_0xc01934+'/'+_0x48ecd3)[_0xd9f4('0x1d')](_0x2ca827);}return null;};}function patchUpdates(_0x93e8df){return function(_0x7ec2ce){try{jsonpatch['apply'](_0x7ec2ce,_0x93e8df,!![]);}catch(_0x138ca7){return BPromise[_0xd9f4('0x22')](_0x138ca7);}return _0x7ec2ce['save']();};}function saveUpdates(_0x4ec0b3,_0x7196ab){return function(_0x59c8f6){if(_0x59c8f6){return _0x59c8f6[_0xd9f4('0x23')](_0x4ec0b3)[_0xd9f4('0x24')](function(_0x818cd5){return _0x818cd5;});}return null;};}function removeEntity(_0x2a89b6,_0x101e86){return function(_0x33ddd6){if(_0x33ddd6){return _0x33ddd6[_0xd9f4('0x25')]()[_0xd9f4('0x24')](function(){_0x2a89b6[_0xd9f4('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x770a2c,_0x1814eb){return function(_0x1fe43b){if(!_0x1fe43b){_0x770a2c[_0xd9f4('0x26')](0x194);}return _0x1fe43b;};}function handleError(_0x3a82dd,_0x2ed32c){_0x2ed32c=_0x2ed32c||0x1f4;return function(_0x12958b){logger['error'](_0x12958b[_0xd9f4('0x27')]);if(_0x12958b[_0xd9f4('0x28')]){delete _0x12958b[_0xd9f4('0x28')];}_0x3a82dd[_0xd9f4('0x1b')](_0x2ed32c)['send'](_0x12958b);};}exports['index']=function(_0x478bc6,_0x261903){var _0x4b453b={},_0x2ca69a={},_0x453a08={'count':0x0,'rows':[]};var _0x5c9ec7=_['map'](db[_0xd9f4('0x29')][_0xd9f4('0x2a')],function(_0x5f6cb9){return{'name':_0x5f6cb9[_0xd9f4('0x2b')],'type':_0x5f6cb9[_0xd9f4('0x2c')][_0xd9f4('0x2d')]};});_0x2ca69a[_0xd9f4('0x2e')]=_[_0xd9f4('0x2f')](_0x5c9ec7,_0xd9f4('0x28'));_0x2ca69a[_0xd9f4('0x30')]=_[_0xd9f4('0x31')](_0x478bc6[_0xd9f4('0x30')]);_0x2ca69a['filters']=_[_0xd9f4('0x32')](_0x2ca69a['model'],_0x2ca69a[_0xd9f4('0x30')]);_0x4b453b[_0xd9f4('0x33')]=_[_0xd9f4('0x32')](_0x2ca69a[_0xd9f4('0x2e')],qs[_0xd9f4('0x34')](_0x478bc6[_0xd9f4('0x30')][_0xd9f4('0x34')]));_0x4b453b[_0xd9f4('0x33')]=_0x4b453b[_0xd9f4('0x33')][_0xd9f4('0x35')]?_0x4b453b[_0xd9f4('0x33')]:_0x2ca69a[_0xd9f4('0x2e')];if(!_0x478bc6[_0xd9f4('0x30')]['hasOwnProperty']('nolimit')){_0x4b453b['limit']=qs[_0xd9f4('0x20')](_0x478bc6[_0xd9f4('0x30')][_0xd9f4('0x20')]);_0x4b453b[_0xd9f4('0x1e')]=qs[_0xd9f4('0x1e')](_0x478bc6[_0xd9f4('0x30')][_0xd9f4('0x1e')]);}_0x4b453b[_0xd9f4('0x36')]=qs[_0xd9f4('0x37')](_0x478bc6[_0xd9f4('0x30')][_0xd9f4('0x37')]);_0x4b453b['where']=qs['filters'](_[_0xd9f4('0x38')](_0x478bc6[_0xd9f4('0x30')],_0x2ca69a[_0xd9f4('0x39')]),_0x5c9ec7);if(_0x478bc6[_0xd9f4('0x30')][_0xd9f4('0x3a')]){_0x4b453b[_0xd9f4('0x3b')]=_[_0xd9f4('0x3c')](_0x4b453b[_0xd9f4('0x3b')],{'$or':_[_0xd9f4('0x2f')](_0x5c9ec7,function(_0x1ce168){if(_0x1ce168[_0xd9f4('0x2c')]!==_0xd9f4('0x3d')){var _0x60feec={};_0x60feec[_0x1ce168['name']]={'$like':'%'+_0x478bc6['query'][_0xd9f4('0x3a')]+'%'};return _0x60feec;}})});}_0x4b453b=_[_0xd9f4('0x3c')]({},_0x4b453b,_0x478bc6[_0xd9f4('0x3e')]);var _0xc8c7a3={'where':_0x4b453b[_0xd9f4('0x3b')]};return db['FreshdeskField'][_0xd9f4('0x3f')](_0xc8c7a3)[_0xd9f4('0x24')](function(_0x522393){_0x453a08[_0xd9f4('0x3f')]=_0x522393;if(_0x478bc6[_0xd9f4('0x30')]['includeAll']){_0x4b453b[_0xd9f4('0x40')]=[{'all':!![]}];}return db[_0xd9f4('0x29')][_0xd9f4('0x41')](_0x4b453b);})[_0xd9f4('0x24')](function(_0xfc7b6c){_0x453a08[_0xd9f4('0x42')]=_0xfc7b6c;return _0x453a08;})[_0xd9f4('0x24')](respondWithFilteredResult(_0x261903,_0x4b453b))[_0xd9f4('0x43')](handleError(_0x261903,null));};exports['show']=function(_0x14aa9e,_0x4ab27a){var _0x48e236={'raw':!![],'where':{'id':_0x14aa9e['params']['id']}},_0x353a01={};_0x353a01[_0xd9f4('0x2e')]=_[_0xd9f4('0x31')](db[_0xd9f4('0x29')][_0xd9f4('0x2a')]);_0x353a01[_0xd9f4('0x30')]=_[_0xd9f4('0x31')](_0x14aa9e[_0xd9f4('0x30')]);_0x353a01['filters']=_[_0xd9f4('0x32')](_0x353a01[_0xd9f4('0x2e')],_0x353a01['query']);_0x48e236[_0xd9f4('0x33')]=_[_0xd9f4('0x32')](_0x353a01[_0xd9f4('0x2e')],qs[_0xd9f4('0x34')](_0x14aa9e['query'][_0xd9f4('0x34')]));_0x48e236[_0xd9f4('0x33')]=_0x48e236[_0xd9f4('0x33')][_0xd9f4('0x35')]?_0x48e236[_0xd9f4('0x33')]:_0x353a01['model'];if(_0x14aa9e[_0xd9f4('0x30')][_0xd9f4('0x44')]){_0x48e236[_0xd9f4('0x40')]=[{'all':!![]}];}_0x48e236=_[_0xd9f4('0x3c')]({},_0x48e236,_0x14aa9e['options']);return db[_0xd9f4('0x29')][_0xd9f4('0x45')](_0x48e236)['then'](handleEntityNotFound(_0x4ab27a,null))[_0xd9f4('0x24')](respondWithResult(_0x4ab27a,null))[_0xd9f4('0x43')](handleError(_0x4ab27a,null));};exports[_0xd9f4('0x46')]=function(_0x4c7d99,_0xbedc3){return db[_0xd9f4('0x29')][_0xd9f4('0x46')](_0x4c7d99[_0xd9f4('0x47')],{})[_0xd9f4('0x24')](respondWithResult(_0xbedc3,0xc9))[_0xd9f4('0x43')](handleError(_0xbedc3,null));};exports[_0xd9f4('0x23')]=function(_0x254af2,_0x360248){if(_0x254af2[_0xd9f4('0x47')]['id']){delete _0x254af2[_0xd9f4('0x47')]['id'];}return db['FreshdeskField'][_0xd9f4('0x45')]({'where':{'id':_0x254af2[_0xd9f4('0x48')]['id']}})['then'](handleEntityNotFound(_0x360248,null))[_0xd9f4('0x24')](saveUpdates(_0x254af2[_0xd9f4('0x47')],null))[_0xd9f4('0x24')](respondWithResult(_0x360248,null))[_0xd9f4('0x43')](handleError(_0x360248,null));};exports[_0xd9f4('0x25')]=function(_0x37c1d9,_0x215df5){return db[_0xd9f4('0x29')][_0xd9f4('0x45')]({'where':{'id':_0x37c1d9['params']['id']}})['then'](handleEntityNotFound(_0x215df5,null))[_0xd9f4('0x24')](removeEntity(_0x215df5,null))[_0xd9f4('0x43')](handleError(_0x215df5,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index e3bb486..1df577f 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 _0x0fd4=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskField.attributes','FreshdeskField','freshdesk_unique_index','idField','FieldId','lodash','util','../../config/logger','api'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x0fd4,0xa1));var _0x40fd=function(_0x454018,_0x46e33a){_0x454018=_0x454018-0x0;var _0x24697d=_0x0fd4[_0x454018];return _0x24697d;};'use strict';var _=require(_0x40fd('0x0'));var util=require(_0x40fd('0x1'));var logger=require(_0x40fd('0x2'))(_0x40fd('0x3'));var moment=require(_0x40fd('0x4'));var BPromise=require(_0x40fd('0x5'));var rp=require(_0x40fd('0x6'));var fs=require('fs');var path=require(_0x40fd('0x7'));var rimraf=require(_0x40fd('0x8'));var config=require(_0x40fd('0x9'));var attributes=require(_0x40fd('0xa'));module['exports']=function(_0x49d4c6,_0x216f33){return _0x49d4c6['define'](_0x40fd('0xb'),attributes,{'tableName':'int_freshdesk_fields','paranoid':![],'indexes':[{'name':_0x40fd('0xc'),'fields':[_0x40fd('0xd'),_0x40fd('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3eec=['rimraf','../../config/environment','./intFreshdeskField.attributes','define','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','idField','FieldId','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x2b9beb,_0x291916){var _0x2df9da=function(_0x31df3e){while(--_0x31df3e){_0x2b9beb['push'](_0x2b9beb['shift']());}};_0x2df9da(++_0x291916);}(_0x3eec,0x1e9));var _0xc3ee=function(_0x5453f7,_0x5a7c93){_0x5453f7=_0x5453f7-0x0;var _0x235d35=_0x3eec[_0x5453f7];return _0x235d35;};'use strict';var _=require(_0xc3ee('0x0'));var util=require(_0xc3ee('0x1'));var logger=require(_0xc3ee('0x2'))(_0xc3ee('0x3'));var moment=require('moment');var BPromise=require(_0xc3ee('0x4'));var rp=require(_0xc3ee('0x5'));var fs=require('fs');var path=require(_0xc3ee('0x6'));var rimraf=require(_0xc3ee('0x7'));var config=require(_0xc3ee('0x8'));var attributes=require(_0xc3ee('0x9'));module['exports']=function(_0x471de7,_0xbd5b6){return _0x471de7[_0xc3ee('0xa')](_0xc3ee('0xb'),attributes,{'tableName':_0xc3ee('0xc'),'paranoid':![],'indexes':[{'name':_0xc3ee('0xd'),'fields':[_0xc3ee('0xe'),_0xc3ee('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.rpc.js b/server/api/intFreshdeskField/intFreshdeskField.rpc.js index b1f5c56..017b827 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 _0x19a4=['request\x20sent','stringify','error','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','http','request','then','info','FreshdeskField,\x20%s,\x20%s'];(function(_0x2367aa,_0xc46b0e){var _0x15898a=function(_0x382e7e){while(--_0x382e7e){_0x2367aa['push'](_0x2367aa['shift']());}};_0x15898a(++_0xc46b0e);}(_0x19a4,0x1d2));var _0x419a=function(_0x43b065,_0x1c8e90){_0x43b065=_0x43b065-0x0;var _0x1245f0=_0x19a4[_0x43b065];return _0x1245f0;};'use strict';var _=require(_0x419a('0x0'));var util=require(_0x419a('0x1'));var moment=require(_0x419a('0x2'));var BPromise=require('bluebird');var rs=require(_0x419a('0x3'));var fs=require('fs');var Redis=require(_0x419a('0x4'));var db=require(_0x419a('0x5'))['db'];var utils=require(_0x419a('0x6'));var logger=require('../../config/logger')(_0x419a('0x7'));var config=require('../../config/environment');var jayson=require(_0x419a('0x8'));var client=jayson['client'][_0x419a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2ac4dc,_0x53f427,_0x1e6237){return new BPromise(function(_0x5aec59,_0x1eace8){return client[_0x419a('0xa')](_0x2ac4dc,_0x1e6237)[_0x419a('0xb')](function(_0x1dc8fb){logger[_0x419a('0xc')](_0x419a('0xd'),_0x53f427,_0x419a('0xe'));logger['debug']('FreshdeskField,\x20%s,\x20%s,\x20%s',_0x53f427,_0x419a('0xe'),JSON[_0x419a('0xf')](_0x1dc8fb));if(_0x1dc8fb['error']){if(_0x1dc8fb['error']['code']===0x1f4){logger[_0x419a('0x10')](_0x419a('0xd'),_0x53f427,_0x1dc8fb[_0x419a('0x10')][_0x419a('0x11')]);return _0x1eace8(_0x1dc8fb['error']['message']);}logger[_0x419a('0x10')]('FreshdeskField,\x20%s,\x20%s',_0x53f427,_0x1dc8fb[_0x419a('0x10')]['message']);return _0x5aec59(_0x1dc8fb['error'][_0x419a('0x11')]);}else{logger[_0x419a('0xc')]('FreshdeskField,\x20%s,\x20%s',_0x53f427,_0x419a('0xe'));_0x5aec59(_0x1dc8fb[_0x419a('0x12')][_0x419a('0x11')]);}})[_0x419a('0x13')](function(_0x3709f9){logger[_0x419a('0x10')](_0x419a('0xd'),_0x53f427,_0x3709f9);_0x1eace8(_0x3709f9);});});} \ No newline at end of file +var _0x0782=['debug','FreshdeskField,\x20%s,\x20%s,\x20%s','error','code','FreshdeskField,\x20%s,\x20%s','message','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','request\x20sent'];(function(_0x189084,_0x5ddb86){var _0x495cf9=function(_0x533b4e){while(--_0x533b4e){_0x189084['push'](_0x189084['shift']());}};_0x495cf9(++_0x5ddb86);}(_0x0782,0xaf));var _0x2078=function(_0xabfec4,_0x35076e){_0xabfec4=_0xabfec4-0x0;var _0x7bafa2=_0x0782[_0xabfec4];return _0x7bafa2;};'use strict';var _=require(_0x2078('0x0'));var util=require(_0x2078('0x1'));var moment=require('moment');var BPromise=require(_0x2078('0x2'));var rs=require(_0x2078('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2078('0x4'))['db'];var utils=require(_0x2078('0x5'));var logger=require(_0x2078('0x6'))('rpc');var config=require(_0x2078('0x7'));var jayson=require(_0x2078('0x8'));var client=jayson[_0x2078('0x9')][_0x2078('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5551a9,_0x5e23f4,_0x39d63e){return new BPromise(function(_0x3f74a5,_0x193179){return client['request'](_0x5551a9,_0x39d63e)[_0x2078('0xb')](function(_0x1d706a){logger[_0x2078('0xc')]('FreshdeskField,\x20%s,\x20%s',_0x5e23f4,_0x2078('0xd'));logger[_0x2078('0xe')](_0x2078('0xf'),_0x5e23f4,'request\x20sent',JSON['stringify'](_0x1d706a));if(_0x1d706a[_0x2078('0x10')]){if(_0x1d706a[_0x2078('0x10')][_0x2078('0x11')]===0x1f4){logger[_0x2078('0x10')](_0x2078('0x12'),_0x5e23f4,_0x1d706a[_0x2078('0x10')][_0x2078('0x13')]);return _0x193179(_0x1d706a[_0x2078('0x10')][_0x2078('0x13')]);}logger[_0x2078('0x10')]('FreshdeskField,\x20%s,\x20%s',_0x5e23f4,_0x1d706a[_0x2078('0x10')][_0x2078('0x13')]);return _0x3f74a5(_0x1d706a['error']['message']);}else{logger[_0x2078('0xc')](_0x2078('0x12'),_0x5e23f4,_0x2078('0xd'));_0x3f74a5(_0x1d706a['result'][_0x2078('0x13')]);}})[_0x2078('0x14')](function(_0xb943a0){logger[_0x2078('0x10')](_0x2078('0x12'),_0x5e23f4,_0xb943a0);_0x193179(_0xb943a0);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index b3edac3..e9f576b 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 _0xc900=['../../config/environment','./intFreshsalesAccount.controller','get','isAuthenticated','index','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','/:id','update','delete','destroy','exports','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x580273,_0x1609da){var _0x4db265=function(_0x50088d){while(--_0x50088d){_0x580273['push'](_0x580273['shift']());}};_0x4db265(++_0x1609da);}(_0xc900,0xb3));var _0x0c90=function(_0x2dc409,_0x5bab66){_0x2dc409=_0x2dc409-0x0;var _0x257f29=_0xc900[_0x2dc409];return _0x257f29;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x0c90('0x0'));var timeout=require(_0x0c90('0x1'));var express=require(_0x0c90('0x2'));var router=express['Router']();var fs_extra=require(_0x0c90('0x3'));var auth=require(_0x0c90('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x0c90('0x5'));var controller=require(_0x0c90('0x6'));router[_0x0c90('0x7')]('/',auth[_0x0c90('0x8')](),controller[_0x0c90('0x9')]);router[_0x0c90('0x7')]('/:id',auth[_0x0c90('0x8')](),controller[_0x0c90('0xa')]);router[_0x0c90('0x7')](_0x0c90('0xb'),auth[_0x0c90('0x8')](),controller[_0x0c90('0xc')]);router[_0x0c90('0x7')](_0x0c90('0xd'),auth[_0x0c90('0x8')](),controller[_0x0c90('0xe')]);router[_0x0c90('0xf')]('/',auth[_0x0c90('0x8')](),controller[_0x0c90('0x10')]);router['post'](_0x0c90('0xb'),auth['isAuthenticated'](),controller[_0x0c90('0x11')]);router['put'](_0x0c90('0x12'),auth[_0x0c90('0x8')](),controller[_0x0c90('0x13')]);router[_0x0c90('0x14')](_0x0c90('0x12'),auth['isAuthenticated'](),controller[_0x0c90('0x15')]);module[_0x0c90('0x16')]=router; \ No newline at end of file +var _0x16d2=['./intFreshsalesAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','post','create','addConfiguration','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x1c0991,_0x4f22d2){var _0x5034de=function(_0x520f49){while(--_0x520f49){_0x1c0991['push'](_0x1c0991['shift']());}};_0x5034de(++_0x4f22d2);}(_0x16d2,0x123));var _0x216d=function(_0x528651,_0x85fecd){_0x528651=_0x528651-0x0;var _0x425450=_0x16d2[_0x528651];return _0x425450;};'use strict';var multer=require(_0x216d('0x0'));var util=require(_0x216d('0x1'));var path=require(_0x216d('0x2'));var timeout=require(_0x216d('0x3'));var express=require(_0x216d('0x4'));var router=express[_0x216d('0x5')]();var fs_extra=require(_0x216d('0x6'));var auth=require(_0x216d('0x7'));var interaction=require(_0x216d('0x8'));var config=require('../../config/environment');var controller=require(_0x216d('0x9'));router[_0x216d('0xa')]('/',auth[_0x216d('0xb')](),controller[_0x216d('0xc')]);router[_0x216d('0xa')](_0x216d('0xd'),auth[_0x216d('0xb')](),controller[_0x216d('0xe')]);router['get'](_0x216d('0xf'),auth[_0x216d('0xb')](),controller[_0x216d('0x10')]);router[_0x216d('0xa')](_0x216d('0x11'),auth[_0x216d('0xb')](),controller['getFields']);router[_0x216d('0x12')]('/',auth['isAuthenticated'](),controller[_0x216d('0x13')]);router[_0x216d('0x12')](_0x216d('0xf'),auth[_0x216d('0xb')](),controller[_0x216d('0x14')]);router[_0x216d('0x15')]('/:id',auth[_0x216d('0xb')](),controller['update']);router[_0x216d('0x16')](_0x216d('0xd'),auth['isAuthenticated'](),controller[_0x216d('0x17')]);module[_0x216d('0x18')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index 485c4e2..c0337d1 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 _0x1893=['STRING','username','remoteUri'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x1893,0xa2));var _0x3189=function(_0x35c97a,_0x513aba){_0x35c97a=_0x35c97a-0x0;var _0x388917=_0x1893[_0x35c97a];return _0x388917;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x3189('0x0')]},'description':{'type':Sequelize[_0x3189('0x0')]},'username':{'type':Sequelize[_0x3189('0x0')],'unique':_0x3189('0x1')},'apiKey':{'type':Sequelize[_0x3189('0x0')]},'remoteUri':{'type':Sequelize[_0x3189('0x0')],'unique':_0x3189('0x2')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x5464=['remoteUri','sequelize','exports','STRING'];(function(_0x57657f,_0x3ef3c0){var _0x3f4aa6=function(_0x4436b3){while(--_0x4436b3){_0x57657f['push'](_0x57657f['shift']());}};_0x3f4aa6(++_0x3ef3c0);}(_0x5464,0x15d));var _0x4546=function(_0x507255,_0x4f05b0){_0x507255=_0x507255-0x0;var _0x2430bb=_0x5464[_0x507255];return _0x2430bb;};'use strict';var Sequelize=require(_0x4546('0x0'));module[_0x4546('0x1')]={'name':{'type':Sequelize[_0x4546('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x4546('0x2')],'unique':'username'},'apiKey':{'type':Sequelize[_0x4546('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x4546('0x3')},'serverUrl':{'type':Sequelize[_0x4546('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 fc45a43..0a8b1f6 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 _0x8f2d=['util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','request','then','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','name','send','index','map','FreshsalesAccount','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','params','length','create','body','find','getConfigurations','findOne','FreshsalesConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshsalesField','username','remoteUri','slice','lastIndexOf','GET','format','Token\x20token=','users','test','statusCode','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','request-promise','moment'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x8f2d,0xd5));var _0xd8f2=function(_0x13ca81,_0x22cd6d){_0x13ca81=_0x13ca81-0x0;var _0x3a8935=_0x8f2d[_0x13ca81];return _0x3a8935;};'use strict';var emlformat=require(_0xd8f2('0x0'));var rimraf=require(_0xd8f2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd8f2('0x2'));var rp=require(_0xd8f2('0x3'));var moment=require(_0xd8f2('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xd8f2('0x5'));var path=require(_0xd8f2('0x6'));var sox=require(_0xd8f2('0x7'));var csv=require(_0xd8f2('0x8'));var ejs=require(_0xd8f2('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd8f2('0xa'));var squel=require(_0xd8f2('0xb'));var crypto=require(_0xd8f2('0xc'));var jsforce=require(_0xd8f2('0xd'));var deskjs=require(_0xd8f2('0xe'));var toCsv=require(_0xd8f2('0x8'));var querystring=require('querystring');var Papa=require(_0xd8f2('0xf'));var Redis=require(_0xd8f2('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xd8f2('0x11'));var as=require(_0xd8f2('0x12'));var hardwareService=require(_0xd8f2('0x13'));var logger=require(_0xd8f2('0x14'))(_0xd8f2('0x15'));var utils=require(_0xd8f2('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xd8f2('0x17'));var db=require(_0xd8f2('0x18'))['db'];var integrations=require(_0xd8f2('0x19'));var jayson=require(_0xd8f2('0x1a'));var client=jayson[_0xd8f2('0x1b')][_0xd8f2('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x4ec81d,_0x3d5048,_0x30d8fd,_0x161e5f){return new BPromise(function(_0x19257f,_0x282338){var _0x48fec3=_0x161e5f||client;return _0x48fec3[_0xd8f2('0x1d')](_0x4ec81d,_0x30d8fd)[_0xd8f2('0x1e')](function(_0x495feb){logger[_0xd8f2('0x1f')](_0xd8f2('0x20'),_0x3d5048,_0xd8f2('0x21'));logger[_0xd8f2('0x22')](_0xd8f2('0x23'),_0x3d5048,_0xd8f2('0x21'),JSON[_0xd8f2('0x24')](_0x495feb));if(_0x495feb['error']){if(_0x495feb[_0xd8f2('0x25')][_0xd8f2('0x26')]===0x1f4){logger[_0xd8f2('0x25')](_0xd8f2('0x20'),_0x3d5048,_0x495feb[_0xd8f2('0x25')]['message']);return _0x282338(_0x495feb['error']['message']);}logger[_0xd8f2('0x25')](_0xd8f2('0x20'),_0x3d5048,_0x495feb['error']['message']);return _0x19257f(_0x495feb[_0xd8f2('0x25')][_0xd8f2('0x27')]);}else{logger[_0xd8f2('0x1f')]('FreshsalesAccount,\x20%s,\x20%s',_0x3d5048,'request\x20sent');_0x19257f(_0x495feb[_0xd8f2('0x28')][_0xd8f2('0x27')]);}})[_0xd8f2('0x29')](function(_0x1f77ab){logger['error'](_0xd8f2('0x20'),_0x3d5048,_0x1f77ab);_0x282338(_0x1f77ab);});});}function respondWithStatusCode(_0x5f5211,_0x3eeb92){_0x3eeb92=_0x3eeb92||0xcc;return function(_0x1728d9){if(_0x1728d9){return _0x5f5211['sendStatus'](_0x3eeb92);}return _0x5f5211[_0xd8f2('0x2a')](_0x3eeb92)[_0xd8f2('0x2b')]();};}function respondWithResult(_0x216cf2,_0x2c562e){_0x2c562e=_0x2c562e||0xc8;return function(_0x39a682){if(_0x39a682){return _0x216cf2[_0xd8f2('0x2a')](_0x2c562e)[_0xd8f2('0x2c')](_0x39a682);}};}function respondWithFilteredResult(_0x1c6c7b,_0x3a7195){return function(_0x19f0e9){if(_0x19f0e9){var _0x517f7d=typeof _0x3a7195[_0xd8f2('0x2d')]===_0xd8f2('0x2e')&&typeof _0x3a7195[_0xd8f2('0x2f')]===_0xd8f2('0x2e');var _0x3410ae=_0x19f0e9[_0xd8f2('0x30')];var _0x138766=_0x517f7d?0x0:_0x3a7195[_0xd8f2('0x2d')];var _0xf5ac2b=_0x517f7d?_0x19f0e9['count']:_0x3a7195[_0xd8f2('0x2d')]+_0x3a7195[_0xd8f2('0x2f')];var _0x4a0627;if(_0xf5ac2b>=_0x3410ae){_0xf5ac2b=_0x3410ae;_0x4a0627=0xc8;}else{_0x4a0627=0xce;}_0x1c6c7b['status'](_0x4a0627);return _0x1c6c7b[_0xd8f2('0x31')](_0xd8f2('0x32'),_0x138766+'-'+_0xf5ac2b+'/'+_0x3410ae)[_0xd8f2('0x2c')](_0x19f0e9);}return null;};}function patchUpdates(_0x46c114){return function(_0x467125){try{jsonpatch['apply'](_0x467125,_0x46c114,!![]);}catch(_0x37be72){return BPromise[_0xd8f2('0x33')](_0x37be72);}return _0x467125[_0xd8f2('0x34')]();};}function saveUpdates(_0x41eb23,_0x457741){return function(_0x331fe4){if(_0x331fe4){return _0x331fe4[_0xd8f2('0x35')](_0x41eb23)[_0xd8f2('0x1e')](function(_0x12e563){return _0x12e563;});}return null;};}function removeEntity(_0x161a51,_0x498b0f){return function(_0x307275){if(_0x307275){return _0x307275[_0xd8f2('0x36')]()['then'](function(){_0x161a51[_0xd8f2('0x2a')](0xcc)[_0xd8f2('0x2b')]();});}};}function handleEntityNotFound(_0x1d780b,_0xff133f){return function(_0x49a46e){if(!_0x49a46e){_0x1d780b['sendStatus'](0x194);}return _0x49a46e;};}function handleError(_0xe5590b,_0x5289af){_0x5289af=_0x5289af||0x1f4;return function(_0x504ef5){logger[_0xd8f2('0x25')](_0x504ef5['stack']);if(_0x504ef5[_0xd8f2('0x37')]){delete _0x504ef5['name'];}_0xe5590b[_0xd8f2('0x2a')](_0x5289af)[_0xd8f2('0x38')](_0x504ef5);};}exports[_0xd8f2('0x39')]=function(_0x82779c,_0x33af80){var _0x40830c={},_0x59558a={},_0x2ec934={'count':0x0,'rows':[]};var _0x1fc74c=_[_0xd8f2('0x3a')](db[_0xd8f2('0x3b')][_0xd8f2('0x3c')],function(_0x611c40){return{'name':_0x611c40[_0xd8f2('0x3d')],'type':_0x611c40[_0xd8f2('0x3e')]['key']};});_0x59558a[_0xd8f2('0x3f')]=_[_0xd8f2('0x3a')](_0x1fc74c,'name');_0x59558a[_0xd8f2('0x40')]=_[_0xd8f2('0x41')](_0x82779c[_0xd8f2('0x40')]);_0x59558a[_0xd8f2('0x42')]=_[_0xd8f2('0x43')](_0x59558a[_0xd8f2('0x3f')],_0x59558a[_0xd8f2('0x40')]);_0x40830c[_0xd8f2('0x44')]=_[_0xd8f2('0x43')](_0x59558a[_0xd8f2('0x3f')],qs[_0xd8f2('0x45')](_0x82779c[_0xd8f2('0x40')][_0xd8f2('0x45')]));_0x40830c[_0xd8f2('0x44')]=_0x40830c[_0xd8f2('0x44')]['length']?_0x40830c[_0xd8f2('0x44')]:_0x59558a[_0xd8f2('0x3f')];if(!_0x82779c[_0xd8f2('0x40')][_0xd8f2('0x46')](_0xd8f2('0x47'))){_0x40830c[_0xd8f2('0x2f')]=qs[_0xd8f2('0x2f')](_0x82779c[_0xd8f2('0x40')][_0xd8f2('0x2f')]);_0x40830c[_0xd8f2('0x2d')]=qs[_0xd8f2('0x2d')](_0x82779c[_0xd8f2('0x40')]['offset']);}_0x40830c[_0xd8f2('0x48')]=qs[_0xd8f2('0x49')](_0x82779c[_0xd8f2('0x40')]['sort']);_0x40830c[_0xd8f2('0x4a')]=qs['filters'](_[_0xd8f2('0x4b')](_0x82779c[_0xd8f2('0x40')],_0x59558a[_0xd8f2('0x42')]),_0x1fc74c);if(_0x82779c[_0xd8f2('0x40')][_0xd8f2('0x4c')]){_0x40830c[_0xd8f2('0x4a')]=_[_0xd8f2('0x4d')](_0x40830c['where'],{'$or':_[_0xd8f2('0x3a')](_0x1fc74c,function(_0x49acd4){if(_0x49acd4[_0xd8f2('0x3e')]!==_0xd8f2('0x4e')){var _0x2ddd82={};_0x2ddd82[_0x49acd4[_0xd8f2('0x37')]]={'$like':'%'+_0x82779c[_0xd8f2('0x40')][_0xd8f2('0x4c')]+'%'};return _0x2ddd82;}})});}_0x40830c=_[_0xd8f2('0x4d')]({},_0x40830c,_0x82779c[_0xd8f2('0x4f')]);var _0x5e0e7c={'where':_0x40830c[_0xd8f2('0x4a')]};return db[_0xd8f2('0x3b')][_0xd8f2('0x30')](_0x5e0e7c)[_0xd8f2('0x1e')](function(_0x24b87f){_0x2ec934[_0xd8f2('0x30')]=_0x24b87f;if(_0x82779c[_0xd8f2('0x40')][_0xd8f2('0x50')]){_0x40830c[_0xd8f2('0x51')]=[{'all':!![]}];}return db[_0xd8f2('0x3b')]['findAll'](_0x40830c);})[_0xd8f2('0x1e')](function(_0x1309e8){_0x2ec934[_0xd8f2('0x52')]=_0x1309e8;return _0x2ec934;})[_0xd8f2('0x1e')](respondWithFilteredResult(_0x33af80,_0x40830c))[_0xd8f2('0x29')](handleError(_0x33af80,null));};exports['show']=function(_0x52458e,_0x3c0321){var _0x146111={'raw':![],'where':{'id':_0x52458e[_0xd8f2('0x53')]['id']}},_0x28bc2c={};_0x28bc2c['model']=_[_0xd8f2('0x41')](db[_0xd8f2('0x3b')][_0xd8f2('0x3c')]);_0x28bc2c[_0xd8f2('0x40')]=_[_0xd8f2('0x41')](_0x52458e[_0xd8f2('0x40')]);_0x28bc2c[_0xd8f2('0x42')]=_[_0xd8f2('0x43')](_0x28bc2c[_0xd8f2('0x3f')],_0x28bc2c[_0xd8f2('0x40')]);_0x146111['attributes']=_[_0xd8f2('0x43')](_0x28bc2c['model'],qs['fields'](_0x52458e['query'][_0xd8f2('0x45')]));_0x146111[_0xd8f2('0x44')]=_0x146111[_0xd8f2('0x44')][_0xd8f2('0x54')]?_0x146111[_0xd8f2('0x44')]:_0x28bc2c[_0xd8f2('0x3f')];if(_0x52458e[_0xd8f2('0x40')][_0xd8f2('0x50')]){_0x146111[_0xd8f2('0x51')]=[{'all':!![]}];}_0x146111=_[_0xd8f2('0x4d')]({},_0x146111,_0x52458e[_0xd8f2('0x4f')]);return db[_0xd8f2('0x3b')]['find'](_0x146111)[_0xd8f2('0x1e')](handleEntityNotFound(_0x3c0321,null))[_0xd8f2('0x1e')](respondWithResult(_0x3c0321,null))[_0xd8f2('0x29')](handleError(_0x3c0321,null));};exports[_0xd8f2('0x55')]=function(_0x5bf3b1,_0x332989){return db['FreshsalesAccount'][_0xd8f2('0x55')](_0x5bf3b1['body'],{})[_0xd8f2('0x1e')](respondWithResult(_0x332989,0xc9))[_0xd8f2('0x29')](handleError(_0x332989,null));};exports['update']=function(_0x9ab4cc,_0x6f9397){if(_0x9ab4cc['body']['id']){delete _0x9ab4cc[_0xd8f2('0x56')]['id'];}return db[_0xd8f2('0x3b')][_0xd8f2('0x57')]({'where':{'id':_0x9ab4cc[_0xd8f2('0x53')]['id']}})['then'](handleEntityNotFound(_0x6f9397,null))[_0xd8f2('0x1e')](saveUpdates(_0x9ab4cc[_0xd8f2('0x56')],null))[_0xd8f2('0x1e')](respondWithResult(_0x6f9397,null))[_0xd8f2('0x29')](handleError(_0x6f9397,null));};exports[_0xd8f2('0x36')]=function(_0x205ea0,_0x116518){return db['FreshsalesAccount']['find']({'where':{'id':_0x205ea0[_0xd8f2('0x53')]['id']}})[_0xd8f2('0x1e')](handleEntityNotFound(_0x116518,null))[_0xd8f2('0x1e')](removeEntity(_0x116518,null))['catch'](handleError(_0x116518,null));};exports[_0xd8f2('0x58')]=function(_0x57abe3,_0x10f7e3,_0x1fb032){var _0x386938={};var _0x48d923={};var _0x9fe867;var _0x497d72;return db[_0xd8f2('0x3b')][_0xd8f2('0x59')]({'where':{'id':_0x57abe3[_0xd8f2('0x53')]['id']}})[_0xd8f2('0x1e')](handleEntityNotFound(_0x10f7e3,null))[_0xd8f2('0x1e')](function(_0x27a33f){if(_0x27a33f){_0x9fe867=_0x27a33f;_0x48d923['model']=_[_0xd8f2('0x41')](db[_0xd8f2('0x5a')][_0xd8f2('0x3c')]);_0x48d923[_0xd8f2('0x40')]=_[_0xd8f2('0x41')](_0x57abe3[_0xd8f2('0x40')]);_0x48d923['filters']=_[_0xd8f2('0x43')](_0x48d923[_0xd8f2('0x3f')],_0x48d923[_0xd8f2('0x40')]);_0x386938[_0xd8f2('0x44')]=_[_0xd8f2('0x43')](_0x48d923[_0xd8f2('0x3f')],qs['fields'](_0x57abe3['query'][_0xd8f2('0x45')]));_0x386938['attributes']=_0x386938[_0xd8f2('0x44')][_0xd8f2('0x54')]?_0x386938['attributes']:_0x48d923[_0xd8f2('0x3f')];_0x386938['order']=qs[_0xd8f2('0x49')](_0x57abe3['query']['sort']);_0x386938[_0xd8f2('0x4a')]=qs[_0xd8f2('0x42')](_[_0xd8f2('0x4b')](_0x57abe3[_0xd8f2('0x40')],_0x48d923['filters']));if(_0x57abe3[_0xd8f2('0x40')]['filter']){_0x386938[_0xd8f2('0x4a')]=_[_0xd8f2('0x4d')](_0x386938[_0xd8f2('0x4a')],{'$or':_['map'](_0x386938[_0xd8f2('0x44')],function(_0x3b740d){var _0x3e6ec4={};_0x3e6ec4[_0x3b740d]={'$like':'%'+_0x57abe3[_0xd8f2('0x40')]['filter']+'%'};return _0x3e6ec4;})});}_0x386938=_[_0xd8f2('0x4d')]({},_0x386938,_0x57abe3[_0xd8f2('0x4f')]);return _0x9fe867[_0xd8f2('0x58')](_0x386938);}})[_0xd8f2('0x1e')](function(_0x176681){if(_0x176681){_0x497d72=_0x176681[_0xd8f2('0x54')];if(!_0x57abe3[_0xd8f2('0x40')][_0xd8f2('0x46')](_0xd8f2('0x47'))){_0x386938[_0xd8f2('0x2f')]=qs[_0xd8f2('0x2f')](_0x57abe3['query'][_0xd8f2('0x2f')]);_0x386938['offset']=qs[_0xd8f2('0x2d')](_0x57abe3[_0xd8f2('0x40')][_0xd8f2('0x2d')]);}return _0x9fe867['getConfigurations'](_0x386938);}})['then'](function(_0x360eef){if(_0x360eef){return _0x360eef?{'count':_0x497d72,'rows':_0x360eef}:null;}})[_0xd8f2('0x1e')](respondWithResult(_0x10f7e3,null))[_0xd8f2('0x29')](handleError(_0x10f7e3,null));};exports['addConfiguration']=function(_0x1328ce,_0x30d3c4,_0x354835){if(_0x1328ce[_0xd8f2('0x56')]['id']){delete _0x1328ce['body']['id'];}return db[_0xd8f2('0x3b')][_0xd8f2('0x59')]({'where':{'id':_0x1328ce[_0xd8f2('0x53')]['id']}})[_0xd8f2('0x1e')](handleEntityNotFound(_0x30d3c4,null))['then'](function(_0x4ecdca){if(_0x4ecdca){_0x1328ce[_0xd8f2('0x56')][_0xd8f2('0x5b')]=_0x4ecdca['id'];_0x1328ce[_0xd8f2('0x56')][_0xd8f2('0x5c')]=integrations[_0xd8f2('0x5d')](_0x1328ce['body'][_0xd8f2('0x5e')],_0x1328ce[_0xd8f2('0x56')][_0xd8f2('0x3e')]);_0x1328ce['body'][_0xd8f2('0x5f')]=integrations[_0xd8f2('0x60')](_0x1328ce[_0xd8f2('0x56')][_0xd8f2('0x5e')],_0x1328ce['body'][_0xd8f2('0x3e')]);return db[_0xd8f2('0x5a')][_0xd8f2('0x55')](_0x1328ce[_0xd8f2('0x56')],{'include':[{'model':db[_0xd8f2('0x61')],'as':_0xd8f2('0x5c')},{'model':db[_0xd8f2('0x61')],'as':_0xd8f2('0x5f')}]});}return null;})[_0xd8f2('0x1e')](respondWithResult(_0x30d3c4,null))[_0xd8f2('0x29')](handleError(_0x30d3c4,null));};exports['getFields']=function(_0x8cddfa,_0x416128,_0x2ac4e4){var _0x56da7b='';var _0x3fc4ac='';return db[_0xd8f2('0x3b')][_0xd8f2('0x59')]({'where':{'id':_0x8cddfa[_0xd8f2('0x53')]['id']},'attributes':['id',_0xd8f2('0x62'),_0xd8f2('0x63'),'apiKey']})[_0xd8f2('0x1e')](handleEntityNotFound(_0x416128,null))['then'](function(_0x12f1c1){if(_0x12f1c1){_0x3fc4ac=_0x12f1c1[_0xd8f2('0x62')];_0x56da7b=_0x12f1c1[_0xd8f2('0x63')];var _0x57df30=_0x12f1c1[_0xd8f2('0x63')][_0xd8f2('0x64')](-0x1);if(_0x57df30==='/'){_0x56da7b=_0x56da7b['substring'](0x0,_0x56da7b[_0xd8f2('0x65')](_0x57df30));}return rp({'method':_0xd8f2('0x66'),'uri':util[_0xd8f2('0x67')]('%s%s',_0x56da7b,'/api/selector/owners'),'headers':{'Authorization':_0xd8f2('0x68')+_0x12f1c1['apiKey']},'json':!![]});}})['then'](function(_0x2c0f2c){if(_0x2c0f2c){var _0x307374=_0x2c0f2c[_0xd8f2('0x69')];var _0x45f8e6=![];var _0x24e51d=null;for(_0x24e51d=0x0;_0x24e51d<_0x307374[_0xd8f2('0x54')];_0x24e51d++){if(_0x307374[_0x24e51d]['email']===_0x3fc4ac){_0x45f8e6=!![];}}if(_0x45f8e6){return!![];}else{throw new Error({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}})[_0xd8f2('0x1e')](respondWithResult(_0x416128,null))[_0xd8f2('0x29')](function(_0x2347d6){var _0x1d98ff=_0x8cddfa[_0xd8f2('0x40')][_0xd8f2('0x6a')]?0x1f4:_0x2347d6[_0xd8f2('0x6b')]||0x1f4;logger[_0xd8f2('0x25')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x1d98ff,JSON[_0xd8f2('0x24')](_0x2347d6));delete _0x2347d6[_0xd8f2('0x37')];if(_0x1d98ff===0x191){_0x1d98ff=0x190;}_0x416128[_0xd8f2('0x2a')](_0x1d98ff)[_0xd8f2('0x38')](_0x8cddfa['query'][_0xd8f2('0x6a')]?{'message':_0xd8f2('0x6c'),'statusCode':_0x2347d6[_0xd8f2('0x6b')]}:_0x2347d6);});}; \ No newline at end of file +var _0x0588=['lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','request','then','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','name','send','index','rawAttributes','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','options','FreshsalesAccount','includeAll','rows','catch','show','params','keys','include','create','body','find','findOne','FreshsalesConfiguration','getConfigurations','addConfiguration','Subjects','getSubjects','channel','FreshsalesField','Descriptions','getFields','username','apiKey','remoteUri','slice','substring','lastIndexOf','GET','%s%s','/api/selector/owners','Token\x20token=','users','Requested\x20Resource\x20not\x20Found','test','statusCode','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x0588,0xd8));var _0x8058=function(_0x4782c1,_0xfbb908){_0x4782c1=_0x4782c1-0x0;var _0x17806e=_0x0588[_0x4782c1];return _0x17806e;};'use strict';var emlformat=require(_0x8058('0x0'));var rimraf=require(_0x8058('0x1'));var zipdir=require(_0x8058('0x2'));var jsonpatch=require(_0x8058('0x3'));var rp=require(_0x8058('0x4'));var moment=require(_0x8058('0x5'));var BPromise=require(_0x8058('0x6'));var Mustache=require(_0x8058('0x7'));var util=require('util');var path=require('path');var sox=require(_0x8058('0x8'));var csv=require(_0x8058('0x9'));var ejs=require(_0x8058('0xa'));var fs=require('fs');var fs_extra=require(_0x8058('0xb'));var _=require(_0x8058('0xc'));var squel=require('squel');var crypto=require(_0x8058('0xd'));var jsforce=require(_0x8058('0xe'));var deskjs=require(_0x8058('0xf'));var toCsv=require(_0x8058('0x9'));var querystring=require('querystring');var Papa=require(_0x8058('0x10'));var Redis=require(_0x8058('0x11'));var authService=require(_0x8058('0x12'));var qs=require(_0x8058('0x13'));var as=require(_0x8058('0x14'));var hardwareService=require(_0x8058('0x15'));var logger=require('../../config/logger')(_0x8058('0x16'));var utils=require('../../config/utils');var config=require(_0x8058('0x17'));var licenseUtil=require(_0x8058('0x18'));var db=require(_0x8058('0x19'))['db'];var integrations=require(_0x8058('0x1a'));var jayson=require(_0x8058('0x1b'));var client=jayson[_0x8058('0x1c')][_0x8058('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x3ee580,_0x5bc037,_0xd732c3,_0x1e85f7){return new BPromise(function(_0x560cd7,_0x512e54){var _0x1f77ee=_0x1e85f7||client;return _0x1f77ee[_0x8058('0x1e')](_0x3ee580,_0xd732c3)[_0x8058('0x1f')](function(_0x2b092a){logger[_0x8058('0x20')](_0x8058('0x21'),_0x5bc037,_0x8058('0x22'));logger[_0x8058('0x23')](_0x8058('0x24'),_0x5bc037,_0x8058('0x22'),JSON[_0x8058('0x25')](_0x2b092a));if(_0x2b092a[_0x8058('0x26')]){if(_0x2b092a[_0x8058('0x26')]['code']===0x1f4){logger[_0x8058('0x26')](_0x8058('0x21'),_0x5bc037,_0x2b092a['error'][_0x8058('0x27')]);return _0x512e54(_0x2b092a[_0x8058('0x26')][_0x8058('0x27')]);}logger[_0x8058('0x26')](_0x8058('0x21'),_0x5bc037,_0x2b092a[_0x8058('0x26')]['message']);return _0x560cd7(_0x2b092a[_0x8058('0x26')]['message']);}else{logger[_0x8058('0x20')](_0x8058('0x21'),_0x5bc037,_0x8058('0x22'));_0x560cd7(_0x2b092a[_0x8058('0x28')][_0x8058('0x27')]);}})['catch'](function(_0x4c180f){logger['error'](_0x8058('0x21'),_0x5bc037,_0x4c180f);_0x512e54(_0x4c180f);});});}function respondWithStatusCode(_0x35cbaa,_0x30029c){_0x30029c=_0x30029c||0xcc;return function(_0x41a31b){if(_0x41a31b){return _0x35cbaa[_0x8058('0x29')](_0x30029c);}return _0x35cbaa[_0x8058('0x2a')](_0x30029c)[_0x8058('0x2b')]();};}function respondWithResult(_0x26e5ea,_0x1e95ba){_0x1e95ba=_0x1e95ba||0xc8;return function(_0x16b53d){if(_0x16b53d){return _0x26e5ea[_0x8058('0x2a')](_0x1e95ba)[_0x8058('0x2c')](_0x16b53d);}};}function respondWithFilteredResult(_0x2b9c5e,_0xf737d3){return function(_0x18e991){if(_0x18e991){var _0x2bf7bb=typeof _0xf737d3[_0x8058('0x2d')]===_0x8058('0x2e')&&typeof _0xf737d3[_0x8058('0x2f')]===_0x8058('0x2e');var _0x2c5349=_0x18e991[_0x8058('0x30')];var _0x2d166b=_0x2bf7bb?0x0:_0xf737d3[_0x8058('0x2d')];var _0x11b20c=_0x2bf7bb?_0x18e991[_0x8058('0x30')]:_0xf737d3[_0x8058('0x2d')]+_0xf737d3[_0x8058('0x2f')];var _0x67f2a4;if(_0x11b20c>=_0x2c5349){_0x11b20c=_0x2c5349;_0x67f2a4=0xc8;}else{_0x67f2a4=0xce;}_0x2b9c5e[_0x8058('0x2a')](_0x67f2a4);return _0x2b9c5e[_0x8058('0x31')](_0x8058('0x32'),_0x2d166b+'-'+_0x11b20c+'/'+_0x2c5349)[_0x8058('0x2c')](_0x18e991);}return null;};}function patchUpdates(_0x13b4b1){return function(_0x2611b5){try{jsonpatch[_0x8058('0x33')](_0x2611b5,_0x13b4b1,!![]);}catch(_0x491962){return BPromise[_0x8058('0x34')](_0x491962);}return _0x2611b5['save']();};}function saveUpdates(_0x4bc6a9,_0x17c4df){return function(_0x23ce0b){if(_0x23ce0b){return _0x23ce0b[_0x8058('0x35')](_0x4bc6a9)['then'](function(_0x4e8ca1){return _0x4e8ca1;});}return null;};}function removeEntity(_0x486abc,_0xb249b9){return function(_0x409674){if(_0x409674){return _0x409674[_0x8058('0x36')]()[_0x8058('0x1f')](function(){_0x486abc[_0x8058('0x2a')](0xcc)[_0x8058('0x2b')]();});}};}function handleEntityNotFound(_0x32eeb0,_0x5d645b){return function(_0x319543){if(!_0x319543){_0x32eeb0[_0x8058('0x29')](0x194);}return _0x319543;};}function handleError(_0x4247bd,_0x269a9a){_0x269a9a=_0x269a9a||0x1f4;return function(_0x5b4518){logger[_0x8058('0x26')](_0x5b4518['stack']);if(_0x5b4518[_0x8058('0x37')]){delete _0x5b4518[_0x8058('0x37')];}_0x4247bd[_0x8058('0x2a')](_0x269a9a)[_0x8058('0x38')](_0x5b4518);};}exports[_0x8058('0x39')]=function(_0x362d9a,_0x105287){var _0x13f3a3={},_0x28b35f={},_0x44187c={'count':0x0,'rows':[]};var _0x3744d4=_['map'](db['FreshsalesAccount'][_0x8058('0x3a')],function(_0x5ca5dd){return{'name':_0x5ca5dd['fieldName'],'type':_0x5ca5dd['type'][_0x8058('0x3b')]};});_0x28b35f[_0x8058('0x3c')]=_[_0x8058('0x3d')](_0x3744d4,_0x8058('0x37'));_0x28b35f[_0x8058('0x3e')]=_['keys'](_0x362d9a[_0x8058('0x3e')]);_0x28b35f[_0x8058('0x3f')]=_[_0x8058('0x40')](_0x28b35f['model'],_0x28b35f[_0x8058('0x3e')]);_0x13f3a3[_0x8058('0x41')]=_[_0x8058('0x40')](_0x28b35f['model'],qs[_0x8058('0x42')](_0x362d9a[_0x8058('0x3e')][_0x8058('0x42')]));_0x13f3a3[_0x8058('0x41')]=_0x13f3a3[_0x8058('0x41')][_0x8058('0x43')]?_0x13f3a3[_0x8058('0x41')]:_0x28b35f['model'];if(!_0x362d9a[_0x8058('0x3e')][_0x8058('0x44')](_0x8058('0x45'))){_0x13f3a3[_0x8058('0x2f')]=qs['limit'](_0x362d9a[_0x8058('0x3e')][_0x8058('0x2f')]);_0x13f3a3[_0x8058('0x2d')]=qs[_0x8058('0x2d')](_0x362d9a[_0x8058('0x3e')][_0x8058('0x2d')]);}_0x13f3a3[_0x8058('0x46')]=qs[_0x8058('0x47')](_0x362d9a[_0x8058('0x3e')]['sort']);_0x13f3a3[_0x8058('0x48')]=qs[_0x8058('0x3f')](_[_0x8058('0x49')](_0x362d9a[_0x8058('0x3e')],_0x28b35f[_0x8058('0x3f')]),_0x3744d4);if(_0x362d9a[_0x8058('0x3e')]['filter']){_0x13f3a3[_0x8058('0x48')]=_[_0x8058('0x4a')](_0x13f3a3[_0x8058('0x48')],{'$or':_[_0x8058('0x3d')](_0x3744d4,function(_0x4062d4){if(_0x4062d4[_0x8058('0x4b')]!==_0x8058('0x4c')){var _0x382416={};_0x382416[_0x4062d4['name']]={'$like':'%'+_0x362d9a['query'][_0x8058('0x4d')]+'%'};return _0x382416;}})});}_0x13f3a3=_[_0x8058('0x4a')]({},_0x13f3a3,_0x362d9a[_0x8058('0x4e')]);var _0x2c964d={'where':_0x13f3a3[_0x8058('0x48')]};return db[_0x8058('0x4f')][_0x8058('0x30')](_0x2c964d)['then'](function(_0x7d5525){_0x44187c[_0x8058('0x30')]=_0x7d5525;if(_0x362d9a['query'][_0x8058('0x50')]){_0x13f3a3['include']=[{'all':!![]}];}return db[_0x8058('0x4f')]['findAll'](_0x13f3a3);})[_0x8058('0x1f')](function(_0x55b62c){_0x44187c[_0x8058('0x51')]=_0x55b62c;return _0x44187c;})['then'](respondWithFilteredResult(_0x105287,_0x13f3a3))[_0x8058('0x52')](handleError(_0x105287,null));};exports[_0x8058('0x53')]=function(_0x35a906,_0x5b34fe){var _0x46d029={'raw':![],'where':{'id':_0x35a906[_0x8058('0x54')]['id']}},_0x28865b={};_0x28865b['model']=_[_0x8058('0x55')](db[_0x8058('0x4f')][_0x8058('0x3a')]);_0x28865b['query']=_['keys'](_0x35a906['query']);_0x28865b[_0x8058('0x3f')]=_[_0x8058('0x40')](_0x28865b[_0x8058('0x3c')],_0x28865b[_0x8058('0x3e')]);_0x46d029[_0x8058('0x41')]=_[_0x8058('0x40')](_0x28865b[_0x8058('0x3c')],qs[_0x8058('0x42')](_0x35a906[_0x8058('0x3e')]['fields']));_0x46d029[_0x8058('0x41')]=_0x46d029[_0x8058('0x41')][_0x8058('0x43')]?_0x46d029[_0x8058('0x41')]:_0x28865b[_0x8058('0x3c')];if(_0x35a906['query'][_0x8058('0x50')]){_0x46d029[_0x8058('0x56')]=[{'all':!![]}];}_0x46d029=_[_0x8058('0x4a')]({},_0x46d029,_0x35a906[_0x8058('0x4e')]);return db[_0x8058('0x4f')]['find'](_0x46d029)['then'](handleEntityNotFound(_0x5b34fe,null))[_0x8058('0x1f')](respondWithResult(_0x5b34fe,null))['catch'](handleError(_0x5b34fe,null));};exports[_0x8058('0x57')]=function(_0x446c2f,_0x585817){return db['FreshsalesAccount'][_0x8058('0x57')](_0x446c2f['body'],{})[_0x8058('0x1f')](respondWithResult(_0x585817,0xc9))[_0x8058('0x52')](handleError(_0x585817,null));};exports[_0x8058('0x35')]=function(_0x4b8515,_0x3d4f0f){if(_0x4b8515[_0x8058('0x58')]['id']){delete _0x4b8515[_0x8058('0x58')]['id'];}return db[_0x8058('0x4f')]['find']({'where':{'id':_0x4b8515[_0x8058('0x54')]['id']}})[_0x8058('0x1f')](handleEntityNotFound(_0x3d4f0f,null))[_0x8058('0x1f')](saveUpdates(_0x4b8515[_0x8058('0x58')],null))[_0x8058('0x1f')](respondWithResult(_0x3d4f0f,null))[_0x8058('0x52')](handleError(_0x3d4f0f,null));};exports[_0x8058('0x36')]=function(_0x4640f5,_0x4ef68c){return db[_0x8058('0x4f')][_0x8058('0x59')]({'where':{'id':_0x4640f5['params']['id']}})['then'](handleEntityNotFound(_0x4ef68c,null))[_0x8058('0x1f')](removeEntity(_0x4ef68c,null))['catch'](handleError(_0x4ef68c,null));};exports['getConfigurations']=function(_0x7c7f75,_0x2c0340,_0x4ebc6e){var _0x2e96b5={};var _0x36f7f3={};var _0x2dce10;var _0x1b7740;return db[_0x8058('0x4f')][_0x8058('0x5a')]({'where':{'id':_0x7c7f75['params']['id']}})[_0x8058('0x1f')](handleEntityNotFound(_0x2c0340,null))[_0x8058('0x1f')](function(_0x54f5ed){if(_0x54f5ed){_0x2dce10=_0x54f5ed;_0x36f7f3[_0x8058('0x3c')]=_[_0x8058('0x55')](db[_0x8058('0x5b')][_0x8058('0x3a')]);_0x36f7f3[_0x8058('0x3e')]=_[_0x8058('0x55')](_0x7c7f75['query']);_0x36f7f3[_0x8058('0x3f')]=_[_0x8058('0x40')](_0x36f7f3[_0x8058('0x3c')],_0x36f7f3[_0x8058('0x3e')]);_0x2e96b5[_0x8058('0x41')]=_[_0x8058('0x40')](_0x36f7f3[_0x8058('0x3c')],qs[_0x8058('0x42')](_0x7c7f75[_0x8058('0x3e')][_0x8058('0x42')]));_0x2e96b5['attributes']=_0x2e96b5[_0x8058('0x41')][_0x8058('0x43')]?_0x2e96b5[_0x8058('0x41')]:_0x36f7f3['model'];_0x2e96b5[_0x8058('0x46')]=qs['sort'](_0x7c7f75[_0x8058('0x3e')][_0x8058('0x47')]);_0x2e96b5[_0x8058('0x48')]=qs[_0x8058('0x3f')](_[_0x8058('0x49')](_0x7c7f75[_0x8058('0x3e')],_0x36f7f3[_0x8058('0x3f')]));if(_0x7c7f75[_0x8058('0x3e')]['filter']){_0x2e96b5[_0x8058('0x48')]=_[_0x8058('0x4a')](_0x2e96b5[_0x8058('0x48')],{'$or':_[_0x8058('0x3d')](_0x2e96b5[_0x8058('0x41')],function(_0x187d76){var _0x4a39f8={};_0x4a39f8[_0x187d76]={'$like':'%'+_0x7c7f75['query']['filter']+'%'};return _0x4a39f8;})});}_0x2e96b5=_[_0x8058('0x4a')]({},_0x2e96b5,_0x7c7f75[_0x8058('0x4e')]);return _0x2dce10['getConfigurations'](_0x2e96b5);}})[_0x8058('0x1f')](function(_0x2381dc){if(_0x2381dc){_0x1b7740=_0x2381dc[_0x8058('0x43')];if(!_0x7c7f75['query'][_0x8058('0x44')](_0x8058('0x45'))){_0x2e96b5[_0x8058('0x2f')]=qs[_0x8058('0x2f')](_0x7c7f75[_0x8058('0x3e')]['limit']);_0x2e96b5[_0x8058('0x2d')]=qs[_0x8058('0x2d')](_0x7c7f75['query']['offset']);}return _0x2dce10[_0x8058('0x5c')](_0x2e96b5);}})[_0x8058('0x1f')](function(_0x52b5a9){if(_0x52b5a9){return _0x52b5a9?{'count':_0x1b7740,'rows':_0x52b5a9}:null;}})[_0x8058('0x1f')](respondWithResult(_0x2c0340,null))[_0x8058('0x52')](handleError(_0x2c0340,null));};exports[_0x8058('0x5d')]=function(_0x2b801c,_0x25f5bb,_0x344283){if(_0x2b801c['body']['id']){delete _0x2b801c[_0x8058('0x58')]['id'];}return db[_0x8058('0x4f')]['findOne']({'where':{'id':_0x2b801c[_0x8058('0x54')]['id']}})[_0x8058('0x1f')](handleEntityNotFound(_0x25f5bb,null))[_0x8058('0x1f')](function(_0x20cda0){if(_0x20cda0){_0x2b801c['body']['AccountId']=_0x20cda0['id'];_0x2b801c[_0x8058('0x58')][_0x8058('0x5e')]=integrations[_0x8058('0x5f')](_0x2b801c[_0x8058('0x58')][_0x8058('0x60')],_0x2b801c[_0x8058('0x58')][_0x8058('0x4b')]);_0x2b801c[_0x8058('0x58')]['Descriptions']=integrations['getDescriptions'](_0x2b801c[_0x8058('0x58')][_0x8058('0x60')],_0x2b801c[_0x8058('0x58')]['type']);return db[_0x8058('0x5b')][_0x8058('0x57')](_0x2b801c[_0x8058('0x58')],{'include':[{'model':db[_0x8058('0x61')],'as':_0x8058('0x5e')},{'model':db[_0x8058('0x61')],'as':_0x8058('0x62')}]});}return null;})[_0x8058('0x1f')](respondWithResult(_0x25f5bb,null))[_0x8058('0x52')](handleError(_0x25f5bb,null));};exports[_0x8058('0x63')]=function(_0x3e0e4c,_0x872cc5,_0x539899){var _0x1d71f9='';var _0x1f5b1f='';return db[_0x8058('0x4f')][_0x8058('0x5a')]({'where':{'id':_0x3e0e4c['params']['id']},'attributes':['id',_0x8058('0x64'),'remoteUri',_0x8058('0x65')]})[_0x8058('0x1f')](handleEntityNotFound(_0x872cc5,null))['then'](function(_0x262f00){if(_0x262f00){_0x1f5b1f=_0x262f00[_0x8058('0x64')];_0x1d71f9=_0x262f00[_0x8058('0x66')];var _0x26ffa1=_0x262f00[_0x8058('0x66')][_0x8058('0x67')](-0x1);if(_0x26ffa1==='/'){_0x1d71f9=_0x1d71f9[_0x8058('0x68')](0x0,_0x1d71f9[_0x8058('0x69')](_0x26ffa1));}return rp({'method':_0x8058('0x6a'),'uri':util['format'](_0x8058('0x6b'),_0x1d71f9,_0x8058('0x6c')),'headers':{'Authorization':_0x8058('0x6d')+_0x262f00[_0x8058('0x65')]},'json':!![]});}})['then'](function(_0x4284f4){if(_0x4284f4){var _0x19bd04=_0x4284f4[_0x8058('0x6e')];var _0xf8d5bd=![];var _0x506513=null;for(_0x506513=0x0;_0x506513<_0x19bd04[_0x8058('0x43')];_0x506513++){if(_0x19bd04[_0x506513]['email']===_0x1f5b1f){_0xf8d5bd=!![];}}if(_0xf8d5bd){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x8058('0x6f')});}}})['then'](respondWithResult(_0x872cc5,null))['catch'](function(_0x7dd16d){var _0x10066b=_0x3e0e4c[_0x8058('0x3e')][_0x8058('0x70')]?0x1f4:_0x7dd16d['statusCode']||0x1f4;logger[_0x8058('0x26')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x10066b,JSON[_0x8058('0x25')](_0x7dd16d));delete _0x7dd16d[_0x8058('0x37')];if(_0x10066b===0x191){_0x10066b=0x190;}_0x872cc5[_0x8058('0x2a')](_0x10066b)[_0x8058('0x38')](_0x3e0e4c['query'][_0x8058('0x70')]?{'message':'Wrong\x20credentials','statusCode':_0x7dd16d[_0x8058('0x71')]}:_0x7dd16d);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index 88af95c..56683db 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 _0x2a07=['moment','request-promise','path','rimraf','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration','exports','define','FreshsalesAccount','int_freshsales_accounts','lodash','util','../../config/logger','api'];(function(_0x4d09d3,_0x57b3fb){var _0x3452f9=function(_0x2c77fa){while(--_0x2c77fa){_0x4d09d3['push'](_0x4d09d3['shift']());}};_0x3452f9(++_0x57b3fb);}(_0x2a07,0x74));var _0x72a0=function(_0x3b8139,_0x459b80){_0x3b8139=_0x3b8139-0x0;var _0x5143a4=_0x2a07[_0x3b8139];return _0x5143a4;};'use strict';var _=require(_0x72a0('0x0'));var util=require(_0x72a0('0x1'));var logger=require(_0x72a0('0x2'))(_0x72a0('0x3'));var moment=require(_0x72a0('0x4'));var BPromise=require('bluebird');var rp=require(_0x72a0('0x5'));var fs=require('fs');var path=require(_0x72a0('0x6'));var rimraf=require(_0x72a0('0x7'));var config=require(_0x72a0('0x8'));var attributes=require(_0x72a0('0x9'));var integrations=require(_0x72a0('0xa'));module[_0x72a0('0xb')]=function(_0x20dab9,_0x193e3b){return _0x20dab9[_0x72a0('0xc')](_0x72a0('0xd'),attributes,{'tableName':_0x72a0('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfcf0=['lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration','exports','define','int_freshsales_accounts'];(function(_0xa148b7,_0x2f3eb2){var _0x51efd3=function(_0x34bcec){while(--_0x34bcec){_0xa148b7['push'](_0xa148b7['shift']());}};_0x51efd3(++_0x2f3eb2);}(_0xfcf0,0x138));var _0x0fcf=function(_0x32d414,_0x4d23da){_0x32d414=_0x32d414-0x0;var _0x4e0bca=_0xfcf0[_0x32d414];return _0x4e0bca;};'use strict';var _=require(_0x0fcf('0x0'));var util=require(_0x0fcf('0x1'));var logger=require('../../config/logger')(_0x0fcf('0x2'));var moment=require(_0x0fcf('0x3'));var BPromise=require(_0x0fcf('0x4'));var rp=require(_0x0fcf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0fcf('0x6'));var config=require(_0x0fcf('0x7'));var attributes=require(_0x0fcf('0x8'));var integrations=require(_0x0fcf('0x9'));module[_0x0fcf('0xa')]=function(_0x1a7b03,_0x61bbb9){return _0x1a7b03[_0x0fcf('0xb')]('FreshsalesAccount',attributes,{'tableName':_0x0fcf('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js index 16dd13e..d6d760c 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 _0xc6ac=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FreshsalesAccount,\x20%s,\x20%s','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','GetFreshsalesAccount','FreshsalesAccount','findAll','options','raw','where','attributes','limit','map','include','model','stringify','catch','ShowFreshsalesAccount','find','lodash','util','moment','bluebird'];(function(_0x4629ed,_0x59ef85){var _0x52ca04=function(_0x59dc63){while(--_0x59dc63){_0x4629ed['push'](_0x4629ed['shift']());}};_0x52ca04(++_0x59ef85);}(_0xc6ac,0x15b));var _0xcc6a=function(_0x397b07,_0x7834b){_0x397b07=_0x397b07-0x0;var _0xb90a5c=_0xc6ac[_0x397b07];return _0xb90a5c;};'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']('FreshsalesAccount,\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);});});}exports[_0xcc6a('0x18')]=function(_0x33079c){var _0x12ef33=this;return new Promise(function(_0x2d9585,_0x412bc7){return db[_0xcc6a('0x19')][_0xcc6a('0x1a')]({'raw':_0x33079c[_0xcc6a('0x1b')]?_0x33079c['options'][_0xcc6a('0x1c')]===undefined?!![]:![]:!![],'where':_0x33079c[_0xcc6a('0x1b')]?_0x33079c[_0xcc6a('0x1b')][_0xcc6a('0x1d')]||null:null,'attributes':_0x33079c[_0xcc6a('0x1b')]?_0x33079c[_0xcc6a('0x1b')][_0xcc6a('0x1e')]||null:null,'limit':_0x33079c[_0xcc6a('0x1b')]?_0x33079c[_0xcc6a('0x1b')][_0xcc6a('0x1f')]||null:null,'include':_0x33079c[_0xcc6a('0x1b')]?_0x33079c[_0xcc6a('0x1b')]['include']?_[_0xcc6a('0x20')](_0x33079c[_0xcc6a('0x1b')][_0xcc6a('0x21')],function(_0x581aae){return{'model':db[_0x581aae[_0xcc6a('0x22')]],'as':_0x581aae['as'],'attributes':_0x581aae[_0xcc6a('0x1e')],'include':_0x581aae[_0xcc6a('0x21')]?_[_0xcc6a('0x20')](_0x581aae[_0xcc6a('0x21')],function(_0x5fc697){return{'model':db[_0x5fc697['model']],'as':_0x5fc697['as'],'attributes':_0x5fc697[_0xcc6a('0x1e')],'include':_0x5fc697[_0xcc6a('0x21')]?_[_0xcc6a('0x20')](_0x5fc697['include'],function(_0x3afb3a){return{'model':db[_0x3afb3a[_0xcc6a('0x22')]],'as':_0x3afb3a['as'],'attributes':_0x3afb3a['attributes']};}):[]};}):[]};}):[]:[]})[_0xcc6a('0xf')](function(_0x8b1b2b){logger[_0xcc6a('0x10')](_0xcc6a('0x18'),_0x33079c);logger['debug'](_0xcc6a('0x18'),_0x33079c,JSON[_0xcc6a('0x23')](_0x8b1b2b));_0x2d9585(_0x8b1b2b);})[_0xcc6a('0x24')](function(_0x4f176b){logger[_0xcc6a('0x15')]('GetFreshsalesAccount',_0x4f176b['message'],_0x33079c);_0x412bc7(_0x12ef33[_0xcc6a('0x15')](0x1f4,_0x4f176b[_0xcc6a('0x17')]));});});};exports[_0xcc6a('0x25')]=function(_0x11b481){var _0x2b575d=this;return new Promise(function(_0x131138,_0x4e2de4){return db[_0xcc6a('0x19')][_0xcc6a('0x26')]({'raw':_0x11b481[_0xcc6a('0x1b')]?_0x11b481[_0xcc6a('0x1b')][_0xcc6a('0x1c')]===undefined?!![]:![]:!![],'where':_0x11b481[_0xcc6a('0x1b')]?_0x11b481[_0xcc6a('0x1b')][_0xcc6a('0x1d')]||null:null,'attributes':_0x11b481['options']?_0x11b481[_0xcc6a('0x1b')][_0xcc6a('0x1e')]||null:null,'include':_0x11b481[_0xcc6a('0x1b')]?_0x11b481[_0xcc6a('0x1b')][_0xcc6a('0x21')]?_[_0xcc6a('0x20')](_0x11b481[_0xcc6a('0x1b')]['include'],function(_0x5d2287){return{'model':db[_0x5d2287['model']],'as':_0x5d2287['as'],'attributes':_0x5d2287['attributes'],'include':_0x5d2287['include']?_[_0xcc6a('0x20')](_0x5d2287[_0xcc6a('0x21')],function(_0x1101ec){return{'model':db[_0x1101ec[_0xcc6a('0x22')]],'as':_0x1101ec['as'],'attributes':_0x1101ec[_0xcc6a('0x1e')],'include':_0x1101ec['include']?_['map'](_0x1101ec[_0xcc6a('0x21')],function(_0x11173a){return{'model':db[_0x11173a[_0xcc6a('0x22')]],'as':_0x11173a['as'],'attributes':_0x11173a['attributes']};}):[]};}):[]};}):[]:[]})[_0xcc6a('0xf')](function(_0x2207df){logger[_0xcc6a('0x10')](_0xcc6a('0x25'),_0x11b481);logger[_0xcc6a('0x12')](_0xcc6a('0x25'),_0x11b481,JSON[_0xcc6a('0x23')](_0x2207df));_0x131138(_0x2207df);})[_0xcc6a('0x24')](function(_0x2a1cd2){logger[_0xcc6a('0x15')](_0xcc6a('0x25'),_0x2a1cd2[_0xcc6a('0x17')],_0x11b481);_0x4e2de4(_0x2b575d[_0xcc6a('0x15')](0x1f4,_0x2a1cd2[_0xcc6a('0x17')]));});});}; \ No newline at end of file +var _0xe5af=['ShowFreshsalesAccount','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','then','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','GetFreshsalesAccount','FreshsalesAccount','findAll','options','where','attributes','include','model','map','find','raw','debug'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0xe5af,0x9c));var _0xfe5a=function(_0x31f2e4,_0x5ad5ac){_0x31f2e4=_0x31f2e4-0x0;var _0x44e761=_0xe5af[_0x31f2e4];return _0x44e761;};'use strict';var _=require('lodash');var util=require(_0xfe5a('0x0'));var moment=require(_0xfe5a('0x1'));var BPromise=require('bluebird');var rs=require(_0xfe5a('0x2'));var fs=require('fs');var Redis=require(_0xfe5a('0x3'));var db=require(_0xfe5a('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xfe5a('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xfe5a('0x6'));var client=jayson[_0xfe5a('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5eea2e,_0x356c69,_0x106492){return new BPromise(function(_0xfb4357,_0x3e683c){return client['request'](_0x5eea2e,_0x106492)[_0xfe5a('0x8')](function(_0x5a48ff){logger['info'](_0xfe5a('0x9'),_0x356c69,_0xfe5a('0xa'));logger['debug'](_0xfe5a('0xb'),_0x356c69,_0xfe5a('0xa'),JSON[_0xfe5a('0xc')](_0x5a48ff));if(_0x5a48ff[_0xfe5a('0xd')]){if(_0x5a48ff[_0xfe5a('0xd')]['code']===0x1f4){logger[_0xfe5a('0xd')](_0xfe5a('0x9'),_0x356c69,_0x5a48ff[_0xfe5a('0xd')][_0xfe5a('0xe')]);return _0x3e683c(_0x5a48ff[_0xfe5a('0xd')]['message']);}logger[_0xfe5a('0xd')](_0xfe5a('0x9'),_0x356c69,_0x5a48ff[_0xfe5a('0xd')][_0xfe5a('0xe')]);return _0xfb4357(_0x5a48ff[_0xfe5a('0xd')][_0xfe5a('0xe')]);}else{logger[_0xfe5a('0xf')](_0xfe5a('0x9'),_0x356c69,_0xfe5a('0xa'));_0xfb4357(_0x5a48ff[_0xfe5a('0x10')][_0xfe5a('0xe')]);}})[_0xfe5a('0x11')](function(_0x22afa7){logger[_0xfe5a('0xd')](_0xfe5a('0x9'),_0x356c69,_0x22afa7);_0x3e683c(_0x22afa7);});});}exports[_0xfe5a('0x12')]=function(_0x5bf597){var _0x20620b=this;return new Promise(function(_0x456707,_0x54d5fb){return db[_0xfe5a('0x13')][_0xfe5a('0x14')]({'raw':_0x5bf597[_0xfe5a('0x15')]?_0x5bf597['options']['raw']===undefined?!![]:![]:!![],'where':_0x5bf597[_0xfe5a('0x15')]?_0x5bf597[_0xfe5a('0x15')][_0xfe5a('0x16')]||null:null,'attributes':_0x5bf597[_0xfe5a('0x15')]?_0x5bf597[_0xfe5a('0x15')][_0xfe5a('0x17')]||null:null,'limit':_0x5bf597['options']?_0x5bf597[_0xfe5a('0x15')]['limit']||null:null,'include':_0x5bf597[_0xfe5a('0x15')]?_0x5bf597[_0xfe5a('0x15')][_0xfe5a('0x18')]?_['map'](_0x5bf597['options'][_0xfe5a('0x18')],function(_0x3e55fd){return{'model':db[_0x3e55fd['model']],'as':_0x3e55fd['as'],'attributes':_0x3e55fd[_0xfe5a('0x17')],'include':_0x3e55fd[_0xfe5a('0x18')]?_['map'](_0x3e55fd[_0xfe5a('0x18')],function(_0x3a4f3c){return{'model':db[_0x3a4f3c[_0xfe5a('0x19')]],'as':_0x3a4f3c['as'],'attributes':_0x3a4f3c[_0xfe5a('0x17')],'include':_0x3a4f3c['include']?_[_0xfe5a('0x1a')](_0x3a4f3c[_0xfe5a('0x18')],function(_0x24481f){return{'model':db[_0x24481f[_0xfe5a('0x19')]],'as':_0x24481f['as'],'attributes':_0x24481f[_0xfe5a('0x17')]};}):[]};}):[]};}):[]:[]})[_0xfe5a('0x8')](function(_0xdbf1e0){logger[_0xfe5a('0xf')]('GetFreshsalesAccount',_0x5bf597);logger['debug'](_0xfe5a('0x12'),_0x5bf597,JSON['stringify'](_0xdbf1e0));_0x456707(_0xdbf1e0);})[_0xfe5a('0x11')](function(_0xfcb05b){logger[_0xfe5a('0xd')]('GetFreshsalesAccount',_0xfcb05b['message'],_0x5bf597);_0x54d5fb(_0x20620b['error'](0x1f4,_0xfcb05b[_0xfe5a('0xe')]));});});};exports['ShowFreshsalesAccount']=function(_0x51d1f4){var _0x498b64=this;return new Promise(function(_0x3b6e4d,_0x14c66d){return db[_0xfe5a('0x13')][_0xfe5a('0x1b')]({'raw':_0x51d1f4[_0xfe5a('0x15')]?_0x51d1f4[_0xfe5a('0x15')][_0xfe5a('0x1c')]===undefined?!![]:![]:!![],'where':_0x51d1f4[_0xfe5a('0x15')]?_0x51d1f4[_0xfe5a('0x15')][_0xfe5a('0x16')]||null:null,'attributes':_0x51d1f4[_0xfe5a('0x15')]?_0x51d1f4['options'][_0xfe5a('0x17')]||null:null,'include':_0x51d1f4[_0xfe5a('0x15')]?_0x51d1f4['options'][_0xfe5a('0x18')]?_[_0xfe5a('0x1a')](_0x51d1f4[_0xfe5a('0x15')][_0xfe5a('0x18')],function(_0xe5a992){return{'model':db[_0xe5a992['model']],'as':_0xe5a992['as'],'attributes':_0xe5a992['attributes'],'include':_0xe5a992[_0xfe5a('0x18')]?_['map'](_0xe5a992[_0xfe5a('0x18')],function(_0xb31d0){return{'model':db[_0xb31d0[_0xfe5a('0x19')]],'as':_0xb31d0['as'],'attributes':_0xb31d0[_0xfe5a('0x17')],'include':_0xb31d0['include']?_[_0xfe5a('0x1a')](_0xb31d0[_0xfe5a('0x18')],function(_0x2e3a36){return{'model':db[_0x2e3a36['model']],'as':_0x2e3a36['as'],'attributes':_0x2e3a36[_0xfe5a('0x17')]};}):[]};}):[]};}):[]:[]})[_0xfe5a('0x8')](function(_0x4617f0){logger[_0xfe5a('0xf')]('ShowFreshsalesAccount',_0x51d1f4);logger[_0xfe5a('0x1d')]('ShowFreshsalesAccount',_0x51d1f4,JSON[_0xfe5a('0xc')](_0x4617f0));_0x3b6e4d(_0x4617f0);})[_0xfe5a('0x11')](function(_0x576189){logger[_0xfe5a('0xd')](_0xfe5a('0x1e'),_0x576189[_0xfe5a('0xe')],_0x51d1f4);_0x14c66d(_0x498b64[_0xfe5a('0xd')](0x1f4,_0x576189['message']));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index 552cb79..cde83fd 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 _0xaf95=['express','Router','../../config/environment','./intFreshsalesConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/subjects','/:id/fields','getFields','post','create','put','update','exports','util','path'];(function(_0x1b5a5a,_0x1c3b75){var _0x42b32d=function(_0x3d35ab){while(--_0x3d35ab){_0x1b5a5a['push'](_0x1b5a5a['shift']());}};_0x42b32d(++_0x1c3b75);}(_0xaf95,0xf5));var _0x5af9=function(_0x2f6893,_0x5b1fd2){_0x2f6893=_0x2f6893-0x0;var _0x5437de=_0xaf95[_0x2f6893];return _0x5437de;};'use strict';var multer=require('multer');var util=require(_0x5af9('0x0'));var path=require(_0x5af9('0x1'));var timeout=require('connect-timeout');var express=require(_0x5af9('0x2'));var router=express[_0x5af9('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x5af9('0x4'));var controller=require(_0x5af9('0x5'));router[_0x5af9('0x6')]('/',auth[_0x5af9('0x7')](),controller[_0x5af9('0x8')]);router[_0x5af9('0x6')](_0x5af9('0x9'),auth[_0x5af9('0x7')](),controller[_0x5af9('0xa')]);router[_0x5af9('0x6')](_0x5af9('0xb'),auth[_0x5af9('0x7')](),controller['getSubjects']);router[_0x5af9('0x6')]('/:id/descriptions',auth[_0x5af9('0x7')](),controller['getDescriptions']);router[_0x5af9('0x6')](_0x5af9('0xc'),auth[_0x5af9('0x7')](),controller[_0x5af9('0xd')]);router[_0x5af9('0xe')]('/',auth[_0x5af9('0x7')](),controller[_0x5af9('0xf')]);router[_0x5af9('0x10')](_0x5af9('0x9'),auth[_0x5af9('0x7')](),controller[_0x5af9('0x11')]);router['delete'](_0x5af9('0x9'),auth['isAuthenticated'](),controller['destroy']);module[_0x5af9('0x12')]=router; \ No newline at end of file +var _0x6900=['get','isAuthenticated','index','/:id','show','/:id/subjects','getSubjects','/:id/descriptions','getFields','post','update','delete','exports','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intFreshsalesConfiguration.controller'];(function(_0x304cba,_0x13fb26){var _0x125424=function(_0x5993ed){while(--_0x5993ed){_0x304cba['push'](_0x304cba['shift']());}};_0x125424(++_0x13fb26);}(_0x6900,0x12a));var _0x0690=function(_0x2235bf,_0x3a06a7){_0x2235bf=_0x2235bf-0x0;var _0x4c3a64=_0x6900[_0x2235bf];return _0x4c3a64;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x0690('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0690('0x1')]();var fs_extra=require(_0x0690('0x2'));var auth=require(_0x0690('0x3'));var interaction=require(_0x0690('0x4'));var config=require('../../config/environment');var controller=require(_0x0690('0x5'));router[_0x0690('0x6')]('/',auth[_0x0690('0x7')](),controller[_0x0690('0x8')]);router['get'](_0x0690('0x9'),auth['isAuthenticated'](),controller[_0x0690('0xa')]);router['get'](_0x0690('0xb'),auth[_0x0690('0x7')](),controller[_0x0690('0xc')]);router[_0x0690('0x6')](_0x0690('0xd'),auth[_0x0690('0x7')](),controller['getDescriptions']);router[_0x0690('0x6')]('/:id/fields',auth[_0x0690('0x7')](),controller[_0x0690('0xe')]);router[_0x0690('0xf')]('/',auth[_0x0690('0x7')](),controller['create']);router['put'](_0x0690('0x9'),auth['isAuthenticated'](),controller[_0x0690('0x10')]);router[_0x0690('0x11')](_0x0690('0x9'),auth[_0x0690('0x7')](),controller['destroy']);module[_0x0690('0x12')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index 491235f..bd06d24 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 _0x7ead=['exports','STRING','sequelize'];(function(_0x28f922,_0x1302f8){var _0x4eceac=function(_0x2ce5a0){while(--_0x2ce5a0){_0x28f922['push'](_0x28f922['shift']());}};_0x4eceac(++_0x1302f8);}(_0x7ead,0xc2));var _0xd7ea=function(_0x4e1437,_0x4293f8){_0x4e1437=_0x4e1437-0x0;var _0x4614aa=_0x7ead[_0x4e1437];return _0x4614aa;};'use strict';var Sequelize=require(_0xd7ea('0x0'));module[_0xd7ea('0x1')]={'name':{'type':Sequelize[_0xd7ea('0x2')]},'description':{'type':Sequelize[_0xd7ea('0x2')]}}; \ No newline at end of file +var _0xcaad=['sequelize','STRING'];(function(_0x251b02,_0x38c0f7){var _0x14017c=function(_0x7a976a){while(--_0x7a976a){_0x251b02['push'](_0x251b02['shift']());}};_0x14017c(++_0x38c0f7);}(_0xcaad,0x164));var _0xdcaa=function(_0x19ca6f,_0x15227a){_0x19ca6f=_0x19ca6f-0x0;var _0x3eb84d=_0xcaad[_0x19ca6f];return _0x3eb84d;};'use strict';var Sequelize=require(_0xdcaa('0x0'));module['exports']={'name':{'type':Sequelize[_0xdcaa('0x1')]},'description':{'type':Sequelize[_0xdcaa('0x1')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index c53a295..1425809 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 _0x1da6=['query','keys','filters','attributes','intersection','fields','length','order','sort','merge','where','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','findOne','FreshsalesField','pick','getSubjects','hasOwnProperty','getDescriptions','nolimit','getFields','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','sox','to-csv','ejs','fs-extra','squel','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','client','request','then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','sendStatus','end','status','json','undefined','limit','offset','count','Content-Range','reject','update','destroy','stack','name','send','FreshsalesConfiguration','rawAttributes','fieldName','type','key','model','map'];(function(_0x6db6d6,_0x2fdb2e){var _0xdf0abe=function(_0x462807){while(--_0x462807){_0x6db6d6['push'](_0x6db6d6['shift']());}};_0xdf0abe(++_0x2fdb2e);}(_0x1da6,0x128));var _0x61da=function(_0x40b66c,_0x5c1d58){_0x40b66c=_0x40b66c-0x0;var _0x159671=_0x1da6[_0x40b66c];return _0x159671;};'use strict';var emlformat=require(_0x61da('0x0'));var rimraf=require(_0x61da('0x1'));var zipdir=require(_0x61da('0x2'));var jsonpatch=require(_0x61da('0x3'));var rp=require(_0x61da('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x61da('0x5'));var path=require('path');var sox=require(_0x61da('0x6'));var csv=require(_0x61da('0x7'));var ejs=require(_0x61da('0x8'));var fs=require('fs');var fs_extra=require(_0x61da('0x9'));var _=require('lodash');var squel=require(_0x61da('0xa'));var crypto=require('crypto');var jsforce=require(_0x61da('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x61da('0x7'));var querystring=require(_0x61da('0xc'));var Papa=require('papaparse');var Redis=require(_0x61da('0xd'));var authService=require(_0x61da('0xe'));var qs=require(_0x61da('0xf'));var as=require(_0x61da('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x61da('0x11'))(_0x61da('0x12'));var utils=require(_0x61da('0x13'));var config=require(_0x61da('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x61da('0x15'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x61da('0x16')]['http']({'port':0x232a});function respondWithRpcPromise(_0x577f01,_0x5a5630,_0x3082a0,_0x3e317c){return new BPromise(function(_0x5674b4,_0xaab90a){var _0x26c1aa=_0x3e317c||client;return _0x26c1aa[_0x61da('0x17')](_0x577f01,_0x3082a0)[_0x61da('0x18')](function(_0x32a0c8){logger[_0x61da('0x19')](_0x61da('0x1a'),_0x5a5630,_0x61da('0x1b'));logger[_0x61da('0x1c')]('FreshsalesConfiguration,\x20%s,\x20%s,\x20%s',_0x5a5630,_0x61da('0x1b'),JSON[_0x61da('0x1d')](_0x32a0c8));if(_0x32a0c8['error']){if(_0x32a0c8[_0x61da('0x1e')][_0x61da('0x1f')]===0x1f4){logger[_0x61da('0x1e')](_0x61da('0x1a'),_0x5a5630,_0x32a0c8[_0x61da('0x1e')][_0x61da('0x20')]);return _0xaab90a(_0x32a0c8[_0x61da('0x1e')]['message']);}logger[_0x61da('0x1e')](_0x61da('0x1a'),_0x5a5630,_0x32a0c8[_0x61da('0x1e')]['message']);return _0x5674b4(_0x32a0c8[_0x61da('0x1e')]['message']);}else{logger['info'](_0x61da('0x1a'),_0x5a5630,_0x61da('0x1b'));_0x5674b4(_0x32a0c8[_0x61da('0x21')]['message']);}})['catch'](function(_0x309be4){logger[_0x61da('0x1e')](_0x61da('0x1a'),_0x5a5630,_0x309be4);_0xaab90a(_0x309be4);});});}function respondWithStatusCode(_0x4b7784,_0x24dd4f){_0x24dd4f=_0x24dd4f||0xcc;return function(_0x41078e){if(_0x41078e){return _0x4b7784[_0x61da('0x22')](_0x24dd4f);}return _0x4b7784['status'](_0x24dd4f)[_0x61da('0x23')]();};}function respondWithResult(_0x51de7c,_0x282b64){_0x282b64=_0x282b64||0xc8;return function(_0x4d4073){if(_0x4d4073){return _0x51de7c[_0x61da('0x24')](_0x282b64)[_0x61da('0x25')](_0x4d4073);}};}function respondWithFilteredResult(_0x4ee017,_0x4ae37b){return function(_0x3dd2c1){if(_0x3dd2c1){var _0x229b85=typeof _0x4ae37b['offset']===_0x61da('0x26')&&typeof _0x4ae37b[_0x61da('0x27')]===_0x61da('0x26');var _0x328f42=_0x3dd2c1['count'];var _0x96e664=_0x229b85?0x0:_0x4ae37b[_0x61da('0x28')];var _0x36f41a=_0x229b85?_0x3dd2c1[_0x61da('0x29')]:_0x4ae37b[_0x61da('0x28')]+_0x4ae37b[_0x61da('0x27')];var _0x68046f;if(_0x36f41a>=_0x328f42){_0x36f41a=_0x328f42;_0x68046f=0xc8;}else{_0x68046f=0xce;}_0x4ee017[_0x61da('0x24')](_0x68046f);return _0x4ee017['set'](_0x61da('0x2a'),_0x96e664+'-'+_0x36f41a+'/'+_0x328f42)['json'](_0x3dd2c1);}return null;};}function patchUpdates(_0xdcd103){return function(_0x4288a0){try{jsonpatch['apply'](_0x4288a0,_0xdcd103,!![]);}catch(_0x40582d){return BPromise[_0x61da('0x2b')](_0x40582d);}return _0x4288a0['save']();};}function saveUpdates(_0x1ffadf,_0x1c1945){return function(_0x4e9bd7){if(_0x4e9bd7){return _0x4e9bd7[_0x61da('0x2c')](_0x1ffadf)[_0x61da('0x18')](function(_0x12e9b5){return _0x12e9b5;});}return null;};}function removeEntity(_0x2865f1,_0x1f72e8){return function(_0x3b1d45){if(_0x3b1d45){return _0x3b1d45[_0x61da('0x2d')]()[_0x61da('0x18')](function(){_0x2865f1[_0x61da('0x24')](0xcc)[_0x61da('0x23')]();});}};}function handleEntityNotFound(_0x5a2560,_0x5cf5cb){return function(_0x19a47f){if(!_0x19a47f){_0x5a2560['sendStatus'](0x194);}return _0x19a47f;};}function handleError(_0x356d15,_0x41a89c){_0x41a89c=_0x41a89c||0x1f4;return function(_0xba8115){logger[_0x61da('0x1e')](_0xba8115[_0x61da('0x2e')]);if(_0xba8115[_0x61da('0x2f')]){delete _0xba8115[_0x61da('0x2f')];}_0x356d15[_0x61da('0x24')](_0x41a89c)[_0x61da('0x30')](_0xba8115);};}exports['index']=function(_0x4f6908,_0x2e6670){var _0x269f7={},_0x1d2f6d={},_0x5b9179={'count':0x0,'rows':[]};var _0x198f8f=_['map'](db[_0x61da('0x31')][_0x61da('0x32')],function(_0x85371a){return{'name':_0x85371a[_0x61da('0x33')],'type':_0x85371a[_0x61da('0x34')][_0x61da('0x35')]};});_0x1d2f6d[_0x61da('0x36')]=_[_0x61da('0x37')](_0x198f8f,_0x61da('0x2f'));_0x1d2f6d[_0x61da('0x38')]=_[_0x61da('0x39')](_0x4f6908[_0x61da('0x38')]);_0x1d2f6d[_0x61da('0x3a')]=_['intersection'](_0x1d2f6d[_0x61da('0x36')],_0x1d2f6d[_0x61da('0x38')]);_0x269f7[_0x61da('0x3b')]=_[_0x61da('0x3c')](_0x1d2f6d[_0x61da('0x36')],qs[_0x61da('0x3d')](_0x4f6908['query'][_0x61da('0x3d')]));_0x269f7[_0x61da('0x3b')]=_0x269f7['attributes'][_0x61da('0x3e')]?_0x269f7[_0x61da('0x3b')]:_0x1d2f6d['model'];if(!_0x4f6908['query']['hasOwnProperty']('nolimit')){_0x269f7[_0x61da('0x27')]=qs[_0x61da('0x27')](_0x4f6908[_0x61da('0x38')][_0x61da('0x27')]);_0x269f7['offset']=qs[_0x61da('0x28')](_0x4f6908[_0x61da('0x38')][_0x61da('0x28')]);}_0x269f7[_0x61da('0x3f')]=qs[_0x61da('0x40')](_0x4f6908[_0x61da('0x38')][_0x61da('0x40')]);_0x269f7['where']=qs[_0x61da('0x3a')](_['pick'](_0x4f6908[_0x61da('0x38')],_0x1d2f6d[_0x61da('0x3a')]),_0x198f8f);if(_0x4f6908[_0x61da('0x38')]['filter']){_0x269f7['where']=_[_0x61da('0x41')](_0x269f7[_0x61da('0x42')],{'$or':_[_0x61da('0x37')](_0x198f8f,function(_0x590122){if(_0x590122['type']!==_0x61da('0x43')){var _0x45d6af={};_0x45d6af[_0x590122['name']]={'$like':'%'+_0x4f6908[_0x61da('0x38')][_0x61da('0x44')]+'%'};return _0x45d6af;}})});}_0x269f7=_[_0x61da('0x41')]({},_0x269f7,_0x4f6908[_0x61da('0x45')]);var _0x1c3e6d={'where':_0x269f7[_0x61da('0x42')]};return db[_0x61da('0x31')][_0x61da('0x29')](_0x1c3e6d)[_0x61da('0x18')](function(_0xd6743){_0x5b9179[_0x61da('0x29')]=_0xd6743;if(_0x4f6908[_0x61da('0x38')][_0x61da('0x46')]){_0x269f7[_0x61da('0x47')]=[{'all':!![]}];}return db['FreshsalesConfiguration'][_0x61da('0x48')](_0x269f7);})[_0x61da('0x18')](function(_0x16a56f){_0x5b9179[_0x61da('0x49')]=_0x16a56f;return _0x5b9179;})['then'](respondWithFilteredResult(_0x2e6670,_0x269f7))[_0x61da('0x4a')](handleError(_0x2e6670,null));};exports[_0x61da('0x4b')]=function(_0x53a93a,_0x243273){var _0x510d3b={'raw':![],'where':{'id':_0x53a93a[_0x61da('0x4c')]['id']}},_0x1f4593={};_0x1f4593[_0x61da('0x36')]=_[_0x61da('0x39')](db['FreshsalesConfiguration']['rawAttributes']);_0x1f4593[_0x61da('0x38')]=_['keys'](_0x53a93a[_0x61da('0x38')]);_0x1f4593[_0x61da('0x3a')]=_[_0x61da('0x3c')](_0x1f4593[_0x61da('0x36')],_0x1f4593[_0x61da('0x38')]);_0x510d3b[_0x61da('0x3b')]=_['intersection'](_0x1f4593[_0x61da('0x36')],qs[_0x61da('0x3d')](_0x53a93a[_0x61da('0x38')][_0x61da('0x3d')]));_0x510d3b[_0x61da('0x3b')]=_0x510d3b[_0x61da('0x3b')][_0x61da('0x3e')]?_0x510d3b[_0x61da('0x3b')]:_0x1f4593['model'];if(_0x53a93a[_0x61da('0x38')]['includeAll']){_0x510d3b[_0x61da('0x47')]=[{'all':!![]}];}_0x510d3b=_[_0x61da('0x41')]({},_0x510d3b,_0x53a93a['options']);return db[_0x61da('0x31')][_0x61da('0x4d')](_0x510d3b)[_0x61da('0x18')](handleEntityNotFound(_0x243273,null))[_0x61da('0x18')](respondWithResult(_0x243273,null))['catch'](handleError(_0x243273,null));};exports[_0x61da('0x4e')]=function(_0x555289,_0xb20415){return db['FreshsalesConfiguration']['create'](_0x555289[_0x61da('0x4f')],{})[_0x61da('0x18')](respondWithResult(_0xb20415,0xc9))[_0x61da('0x4a')](handleError(_0xb20415,null));};exports[_0x61da('0x2c')]=function(_0x5cc9c5,_0x160068){if(_0x5cc9c5[_0x61da('0x4f')]['id']){delete _0x5cc9c5[_0x61da('0x4f')]['id'];}return db['FreshsalesConfiguration'][_0x61da('0x4d')]({'where':{'id':_0x5cc9c5[_0x61da('0x4c')]['id']}})[_0x61da('0x18')](handleEntityNotFound(_0x160068,null))[_0x61da('0x18')](saveUpdates(_0x5cc9c5[_0x61da('0x4f')],null))[_0x61da('0x18')](respondWithResult(_0x160068,null))[_0x61da('0x4a')](handleError(_0x160068,null));};exports[_0x61da('0x2d')]=function(_0x444718,_0x48f6f8){return db[_0x61da('0x31')]['find']({'where':{'id':_0x444718['params']['id']}})['then'](handleEntityNotFound(_0x48f6f8,null))['then'](removeEntity(_0x48f6f8,null))[_0x61da('0x4a')](handleError(_0x48f6f8,null));};exports['getSubjects']=function(_0x19a96a,_0x68cb19,_0x29d786){var _0x5f3b83={};var _0x2de02e={};var _0x2136ac;var _0x272ce9;return db[_0x61da('0x31')][_0x61da('0x50')]({'where':{'id':_0x19a96a['params']['id']}})['then'](handleEntityNotFound(_0x68cb19,null))['then'](function(_0x4fb8c2){if(_0x4fb8c2){_0x2136ac=_0x4fb8c2;_0x2de02e[_0x61da('0x36')]=_['keys'](db[_0x61da('0x51')][_0x61da('0x32')]);_0x2de02e[_0x61da('0x38')]=_[_0x61da('0x39')](_0x19a96a[_0x61da('0x38')]);_0x2de02e[_0x61da('0x3a')]=_[_0x61da('0x3c')](_0x2de02e[_0x61da('0x36')],_0x2de02e[_0x61da('0x38')]);_0x5f3b83[_0x61da('0x3b')]=_['intersection'](_0x2de02e[_0x61da('0x36')],qs[_0x61da('0x3d')](_0x19a96a[_0x61da('0x38')][_0x61da('0x3d')]));_0x5f3b83['attributes']=_0x5f3b83[_0x61da('0x3b')]['length']?_0x5f3b83['attributes']:_0x2de02e['model'];_0x5f3b83['order']=qs[_0x61da('0x40')](_0x19a96a[_0x61da('0x38')][_0x61da('0x40')]);_0x5f3b83[_0x61da('0x42')]=qs[_0x61da('0x3a')](_[_0x61da('0x52')](_0x19a96a[_0x61da('0x38')],_0x2de02e[_0x61da('0x3a')]));if(_0x19a96a['query']['filter']){_0x5f3b83['where']=_[_0x61da('0x41')](_0x5f3b83[_0x61da('0x42')],{'$or':_[_0x61da('0x37')](_0x5f3b83[_0x61da('0x3b')],function(_0x8f26f6){var _0x3efe36={};_0x3efe36[_0x8f26f6]={'$like':'%'+_0x19a96a[_0x61da('0x38')][_0x61da('0x44')]+'%'};return _0x3efe36;})});}_0x5f3b83=_[_0x61da('0x41')]({},_0x5f3b83,_0x19a96a[_0x61da('0x45')]);return _0x2136ac[_0x61da('0x53')](_0x5f3b83);}})['then'](function(_0x32be37){if(_0x32be37){_0x272ce9=_0x32be37[_0x61da('0x3e')];if(!_0x19a96a[_0x61da('0x38')][_0x61da('0x54')]('nolimit')){_0x5f3b83[_0x61da('0x27')]=qs[_0x61da('0x27')](_0x19a96a[_0x61da('0x38')][_0x61da('0x27')]);_0x5f3b83[_0x61da('0x28')]=qs['offset'](_0x19a96a[_0x61da('0x38')]['offset']);}return _0x2136ac[_0x61da('0x53')](_0x5f3b83);}})[_0x61da('0x18')](function(_0x1cd0b0){if(_0x1cd0b0){return _0x1cd0b0?{'count':_0x272ce9,'rows':_0x1cd0b0}:null;}})[_0x61da('0x18')](respondWithResult(_0x68cb19,null))[_0x61da('0x4a')](handleError(_0x68cb19,null));};exports['getDescriptions']=function(_0x415f72,_0x973a22,_0x41a38b){var _0x315c6a={};var _0x2cf0bc={};var _0x3708cd;var _0xb6e727;return db[_0x61da('0x31')][_0x61da('0x50')]({'where':{'id':_0x415f72[_0x61da('0x4c')]['id']}})[_0x61da('0x18')](handleEntityNotFound(_0x973a22,null))[_0x61da('0x18')](function(_0x347d6d){if(_0x347d6d){_0x3708cd=_0x347d6d;_0x2cf0bc[_0x61da('0x36')]=_[_0x61da('0x39')](db['FreshsalesField']['rawAttributes']);_0x2cf0bc['query']=_[_0x61da('0x39')](_0x415f72[_0x61da('0x38')]);_0x2cf0bc[_0x61da('0x3a')]=_[_0x61da('0x3c')](_0x2cf0bc[_0x61da('0x36')],_0x2cf0bc[_0x61da('0x38')]);_0x315c6a[_0x61da('0x3b')]=_['intersection'](_0x2cf0bc['model'],qs[_0x61da('0x3d')](_0x415f72[_0x61da('0x38')][_0x61da('0x3d')]));_0x315c6a[_0x61da('0x3b')]=_0x315c6a[_0x61da('0x3b')][_0x61da('0x3e')]?_0x315c6a['attributes']:_0x2cf0bc['model'];_0x315c6a['order']=qs['sort'](_0x415f72['query'][_0x61da('0x40')]);_0x315c6a[_0x61da('0x42')]=qs['filters'](_[_0x61da('0x52')](_0x415f72[_0x61da('0x38')],_0x2cf0bc[_0x61da('0x3a')]));if(_0x415f72[_0x61da('0x38')][_0x61da('0x44')]){_0x315c6a[_0x61da('0x42')]=_[_0x61da('0x41')](_0x315c6a[_0x61da('0x42')],{'$or':_['map'](_0x315c6a[_0x61da('0x3b')],function(_0x2df5a7){var _0x50db09={};_0x50db09[_0x2df5a7]={'$like':'%'+_0x415f72[_0x61da('0x38')]['filter']+'%'};return _0x50db09;})});}_0x315c6a=_[_0x61da('0x41')]({},_0x315c6a,_0x415f72[_0x61da('0x45')]);return _0x3708cd[_0x61da('0x55')](_0x315c6a);}})['then'](function(_0x1b7d73){if(_0x1b7d73){_0xb6e727=_0x1b7d73[_0x61da('0x3e')];if(!_0x415f72[_0x61da('0x38')][_0x61da('0x54')](_0x61da('0x56'))){_0x315c6a[_0x61da('0x27')]=qs[_0x61da('0x27')](_0x415f72[_0x61da('0x38')]['limit']);_0x315c6a[_0x61da('0x28')]=qs['offset'](_0x415f72[_0x61da('0x38')][_0x61da('0x28')]);}return _0x3708cd[_0x61da('0x55')](_0x315c6a);}})[_0x61da('0x18')](function(_0x5960f2){if(_0x5960f2){return _0x5960f2?{'count':_0xb6e727,'rows':_0x5960f2}:null;}})[_0x61da('0x18')](respondWithResult(_0x973a22,null))[_0x61da('0x4a')](handleError(_0x973a22,null));};exports['getFields']=function(_0x293730,_0x225c59,_0x272326){var _0x13ad5f={};var _0x588935={};var _0x534f14;var _0x5be818;return db[_0x61da('0x31')][_0x61da('0x50')]({'where':{'id':_0x293730[_0x61da('0x4c')]['id']}})[_0x61da('0x18')](handleEntityNotFound(_0x225c59,null))[_0x61da('0x18')](function(_0x1acf00){if(_0x1acf00){_0x534f14=_0x1acf00;_0x588935[_0x61da('0x36')]=_[_0x61da('0x39')](db[_0x61da('0x51')]['rawAttributes']);_0x588935[_0x61da('0x38')]=_[_0x61da('0x39')](_0x293730[_0x61da('0x38')]);_0x588935[_0x61da('0x3a')]=_['intersection'](_0x588935[_0x61da('0x36')],_0x588935[_0x61da('0x38')]);_0x13ad5f[_0x61da('0x3b')]=_[_0x61da('0x3c')](_0x588935[_0x61da('0x36')],qs[_0x61da('0x3d')](_0x293730[_0x61da('0x38')][_0x61da('0x3d')]));_0x13ad5f[_0x61da('0x3b')]=_0x13ad5f['attributes'][_0x61da('0x3e')]?_0x13ad5f['attributes']:_0x588935[_0x61da('0x36')];_0x13ad5f[_0x61da('0x3f')]=qs['sort'](_0x293730['query'][_0x61da('0x40')]);_0x13ad5f[_0x61da('0x42')]=qs[_0x61da('0x3a')](_[_0x61da('0x52')](_0x293730['query'],_0x588935[_0x61da('0x3a')]));if(_0x293730[_0x61da('0x38')]['filter']){_0x13ad5f[_0x61da('0x42')]=_[_0x61da('0x41')](_0x13ad5f['where'],{'$or':_[_0x61da('0x37')](_0x13ad5f[_0x61da('0x3b')],function(_0x4d4f1b){var _0xacca26={};_0xacca26[_0x4d4f1b]={'$like':'%'+_0x293730['query'][_0x61da('0x44')]+'%'};return _0xacca26;})});}_0x13ad5f=_[_0x61da('0x41')]({},_0x13ad5f,_0x293730[_0x61da('0x45')]);return _0x534f14['getFields'](_0x13ad5f);}})['then'](function(_0x16d7ed){if(_0x16d7ed){_0x5be818=_0x16d7ed[_0x61da('0x3e')];if(!_0x293730[_0x61da('0x38')][_0x61da('0x54')](_0x61da('0x56'))){_0x13ad5f[_0x61da('0x27')]=qs[_0x61da('0x27')](_0x293730[_0x61da('0x38')][_0x61da('0x27')]);_0x13ad5f[_0x61da('0x28')]=qs[_0x61da('0x28')](_0x293730[_0x61da('0x38')]['offset']);}return _0x534f14[_0x61da('0x57')](_0x13ad5f);}})[_0x61da('0x18')](function(_0x28af87){if(_0x28af87){return _0x28af87?{'count':_0x5be818,'rows':_0x28af87}:null;}})[_0x61da('0x18')](respondWithResult(_0x225c59,null))['catch'](handleError(_0x225c59,null));}; \ No newline at end of file +var _0xd600=['../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','then','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','status','end','json','offset','undefined','limit','count','set','apply','update','destroy','sendStatus','stack','name','send','index','map','FreshsalesConfiguration','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','include','findAll','show','params','rawAttributes','includeAll','create','body','find','getSubjects','findOne','FreshsalesField','getDescriptions','getFields','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','squel','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd600,0xf2));var _0x0d60=function(_0x33c85d,_0x1e52d9){_0x33c85d=_0x33c85d-0x0;var _0x162d9a=_0xd600[_0x33c85d];return _0x162d9a;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x0d60('0x0'));var rp=require(_0x0d60('0x1'));var moment=require(_0x0d60('0x2'));var BPromise=require(_0x0d60('0x3'));var Mustache=require(_0x0d60('0x4'));var util=require(_0x0d60('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x0d60('0x6'));var ejs=require(_0x0d60('0x7'));var fs=require('fs');var fs_extra=require(_0x0d60('0x8'));var _=require('lodash');var squel=require(_0x0d60('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0d60('0xa'));var toCsv=require(_0x0d60('0x6'));var querystring=require(_0x0d60('0xb'));var Papa=require(_0x0d60('0xc'));var Redis=require('ioredis');var authService=require(_0x0d60('0xd'));var qs=require(_0x0d60('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0d60('0xf'));var logger=require(_0x0d60('0x10'))(_0x0d60('0x11'));var utils=require(_0x0d60('0x12'));var config=require(_0x0d60('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x0d60('0x14'))['db'];var jayson=require(_0x0d60('0x15'));var client=jayson[_0x0d60('0x16')][_0x0d60('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x5f28cd,_0x312203,_0x26233f,_0x54f8e6){return new BPromise(function(_0x1c72bd,_0x5374e0){var _0x2548bc=_0x54f8e6||client;return _0x2548bc['request'](_0x5f28cd,_0x26233f)[_0x0d60('0x18')](function(_0x595c7b){logger['info'](_0x0d60('0x19'),_0x312203,_0x0d60('0x1a'));logger[_0x0d60('0x1b')](_0x0d60('0x1c'),_0x312203,_0x0d60('0x1a'),JSON['stringify'](_0x595c7b));if(_0x595c7b['error']){if(_0x595c7b[_0x0d60('0x1d')][_0x0d60('0x1e')]===0x1f4){logger[_0x0d60('0x1d')](_0x0d60('0x19'),_0x312203,_0x595c7b['error']['message']);return _0x5374e0(_0x595c7b[_0x0d60('0x1d')][_0x0d60('0x1f')]);}logger[_0x0d60('0x1d')](_0x0d60('0x19'),_0x312203,_0x595c7b['error'][_0x0d60('0x1f')]);return _0x1c72bd(_0x595c7b[_0x0d60('0x1d')][_0x0d60('0x1f')]);}else{logger[_0x0d60('0x20')](_0x0d60('0x19'),_0x312203,'request\x20sent');_0x1c72bd(_0x595c7b['result'][_0x0d60('0x1f')]);}})[_0x0d60('0x21')](function(_0x1d43ee){logger['error'](_0x0d60('0x19'),_0x312203,_0x1d43ee);_0x5374e0(_0x1d43ee);});});}function respondWithStatusCode(_0x11a285,_0x4f598b){_0x4f598b=_0x4f598b||0xcc;return function(_0x55bad8){if(_0x55bad8){return _0x11a285['sendStatus'](_0x4f598b);}return _0x11a285[_0x0d60('0x22')](_0x4f598b)[_0x0d60('0x23')]();};}function respondWithResult(_0x548fc,_0x216197){_0x216197=_0x216197||0xc8;return function(_0x37943a){if(_0x37943a){return _0x548fc['status'](_0x216197)[_0x0d60('0x24')](_0x37943a);}};}function respondWithFilteredResult(_0x3f4a4d,_0x520d9c){return function(_0x43722b){if(_0x43722b){var _0x464e69=typeof _0x520d9c[_0x0d60('0x25')]===_0x0d60('0x26')&&typeof _0x520d9c[_0x0d60('0x27')]===_0x0d60('0x26');var _0x3215cf=_0x43722b[_0x0d60('0x28')];var _0x42ec5f=_0x464e69?0x0:_0x520d9c[_0x0d60('0x25')];var _0x358343=_0x464e69?_0x43722b[_0x0d60('0x28')]:_0x520d9c[_0x0d60('0x25')]+_0x520d9c[_0x0d60('0x27')];var _0x13cc64;if(_0x358343>=_0x3215cf){_0x358343=_0x3215cf;_0x13cc64=0xc8;}else{_0x13cc64=0xce;}_0x3f4a4d[_0x0d60('0x22')](_0x13cc64);return _0x3f4a4d[_0x0d60('0x29')]('Content-Range',_0x42ec5f+'-'+_0x358343+'/'+_0x3215cf)['json'](_0x43722b);}return null;};}function patchUpdates(_0x48345b){return function(_0x4cbecc){try{jsonpatch[_0x0d60('0x2a')](_0x4cbecc,_0x48345b,!![]);}catch(_0x1b9811){return BPromise['reject'](_0x1b9811);}return _0x4cbecc['save']();};}function saveUpdates(_0x2562d3,_0x524e54){return function(_0x4ebcdb){if(_0x4ebcdb){return _0x4ebcdb[_0x0d60('0x2b')](_0x2562d3)[_0x0d60('0x18')](function(_0x378e7f){return _0x378e7f;});}return null;};}function removeEntity(_0x37aa4b,_0x39b7c0){return function(_0x31952e){if(_0x31952e){return _0x31952e[_0x0d60('0x2c')]()[_0x0d60('0x18')](function(){_0x37aa4b[_0x0d60('0x22')](0xcc)[_0x0d60('0x23')]();});}};}function handleEntityNotFound(_0x3c3880,_0x49e861){return function(_0x3096de){if(!_0x3096de){_0x3c3880[_0x0d60('0x2d')](0x194);}return _0x3096de;};}function handleError(_0x2b91ff,_0x567285){_0x567285=_0x567285||0x1f4;return function(_0xae605c){logger[_0x0d60('0x1d')](_0xae605c[_0x0d60('0x2e')]);if(_0xae605c[_0x0d60('0x2f')]){delete _0xae605c['name'];}_0x2b91ff[_0x0d60('0x22')](_0x567285)[_0x0d60('0x30')](_0xae605c);};}exports[_0x0d60('0x31')]=function(_0x2c8547,_0x39cc73){var _0x267c8c={},_0x478bd4={},_0x1c2ca5={'count':0x0,'rows':[]};var _0x2b663d=_[_0x0d60('0x32')](db[_0x0d60('0x33')]['rawAttributes'],function(_0x3a92c9){return{'name':_0x3a92c9['fieldName'],'type':_0x3a92c9['type'][_0x0d60('0x34')]};});_0x478bd4[_0x0d60('0x35')]=_[_0x0d60('0x32')](_0x2b663d,_0x0d60('0x2f'));_0x478bd4['query']=_[_0x0d60('0x36')](_0x2c8547[_0x0d60('0x37')]);_0x478bd4[_0x0d60('0x38')]=_[_0x0d60('0x39')](_0x478bd4[_0x0d60('0x35')],_0x478bd4[_0x0d60('0x37')]);_0x267c8c['attributes']=_[_0x0d60('0x39')](_0x478bd4[_0x0d60('0x35')],qs[_0x0d60('0x3a')](_0x2c8547['query'][_0x0d60('0x3a')]));_0x267c8c[_0x0d60('0x3b')]=_0x267c8c['attributes'][_0x0d60('0x3c')]?_0x267c8c[_0x0d60('0x3b')]:_0x478bd4[_0x0d60('0x35')];if(!_0x2c8547[_0x0d60('0x37')][_0x0d60('0x3d')](_0x0d60('0x3e'))){_0x267c8c[_0x0d60('0x27')]=qs['limit'](_0x2c8547[_0x0d60('0x37')][_0x0d60('0x27')]);_0x267c8c[_0x0d60('0x25')]=qs[_0x0d60('0x25')](_0x2c8547[_0x0d60('0x37')]['offset']);}_0x267c8c[_0x0d60('0x3f')]=qs['sort'](_0x2c8547[_0x0d60('0x37')][_0x0d60('0x40')]);_0x267c8c[_0x0d60('0x41')]=qs[_0x0d60('0x38')](_[_0x0d60('0x42')](_0x2c8547[_0x0d60('0x37')],_0x478bd4[_0x0d60('0x38')]),_0x2b663d);if(_0x2c8547['query'][_0x0d60('0x43')]){_0x267c8c[_0x0d60('0x41')]=_[_0x0d60('0x44')](_0x267c8c[_0x0d60('0x41')],{'$or':_[_0x0d60('0x32')](_0x2b663d,function(_0x351d91){if(_0x351d91[_0x0d60('0x45')]!==_0x0d60('0x46')){var _0x4100f4={};_0x4100f4[_0x351d91[_0x0d60('0x2f')]]={'$like':'%'+_0x2c8547[_0x0d60('0x37')]['filter']+'%'};return _0x4100f4;}})});}_0x267c8c=_[_0x0d60('0x44')]({},_0x267c8c,_0x2c8547[_0x0d60('0x47')]);var _0x541294={'where':_0x267c8c['where']};return db[_0x0d60('0x33')]['count'](_0x541294)[_0x0d60('0x18')](function(_0x5e3e8f){_0x1c2ca5[_0x0d60('0x28')]=_0x5e3e8f;if(_0x2c8547[_0x0d60('0x37')]['includeAll']){_0x267c8c[_0x0d60('0x48')]=[{'all':!![]}];}return db[_0x0d60('0x33')][_0x0d60('0x49')](_0x267c8c);})['then'](function(_0x45cf01){_0x1c2ca5['rows']=_0x45cf01;return _0x1c2ca5;})[_0x0d60('0x18')](respondWithFilteredResult(_0x39cc73,_0x267c8c))[_0x0d60('0x21')](handleError(_0x39cc73,null));};exports[_0x0d60('0x4a')]=function(_0xcc3e05,_0x1a9889){var _0x94da72={'raw':![],'where':{'id':_0xcc3e05[_0x0d60('0x4b')]['id']}},_0x4f3169={};_0x4f3169[_0x0d60('0x35')]=_[_0x0d60('0x36')](db[_0x0d60('0x33')][_0x0d60('0x4c')]);_0x4f3169[_0x0d60('0x37')]=_['keys'](_0xcc3e05[_0x0d60('0x37')]);_0x4f3169['filters']=_[_0x0d60('0x39')](_0x4f3169[_0x0d60('0x35')],_0x4f3169['query']);_0x94da72['attributes']=_[_0x0d60('0x39')](_0x4f3169[_0x0d60('0x35')],qs[_0x0d60('0x3a')](_0xcc3e05[_0x0d60('0x37')][_0x0d60('0x3a')]));_0x94da72['attributes']=_0x94da72[_0x0d60('0x3b')][_0x0d60('0x3c')]?_0x94da72['attributes']:_0x4f3169['model'];if(_0xcc3e05[_0x0d60('0x37')][_0x0d60('0x4d')]){_0x94da72[_0x0d60('0x48')]=[{'all':!![]}];}_0x94da72=_[_0x0d60('0x44')]({},_0x94da72,_0xcc3e05['options']);return db['FreshsalesConfiguration']['find'](_0x94da72)['then'](handleEntityNotFound(_0x1a9889,null))['then'](respondWithResult(_0x1a9889,null))['catch'](handleError(_0x1a9889,null));};exports[_0x0d60('0x4e')]=function(_0xbb442c,_0x5a8498){return db[_0x0d60('0x33')][_0x0d60('0x4e')](_0xbb442c[_0x0d60('0x4f')],{})[_0x0d60('0x18')](respondWithResult(_0x5a8498,0xc9))[_0x0d60('0x21')](handleError(_0x5a8498,null));};exports['update']=function(_0x282a44,_0x4fad70){if(_0x282a44[_0x0d60('0x4f')]['id']){delete _0x282a44['body']['id'];}return db[_0x0d60('0x33')][_0x0d60('0x50')]({'where':{'id':_0x282a44[_0x0d60('0x4b')]['id']}})['then'](handleEntityNotFound(_0x4fad70,null))['then'](saveUpdates(_0x282a44[_0x0d60('0x4f')],null))['then'](respondWithResult(_0x4fad70,null))[_0x0d60('0x21')](handleError(_0x4fad70,null));};exports['destroy']=function(_0x4c2225,_0x2302e7){return db['FreshsalesConfiguration'][_0x0d60('0x50')]({'where':{'id':_0x4c2225[_0x0d60('0x4b')]['id']}})['then'](handleEntityNotFound(_0x2302e7,null))[_0x0d60('0x18')](removeEntity(_0x2302e7,null))['catch'](handleError(_0x2302e7,null));};exports[_0x0d60('0x51')]=function(_0x40c12c,_0x5c2630,_0x5085f9){var _0x4f767e={};var _0x3683d3={};var _0x2f8a0a;var _0xdc70f7;return db['FreshsalesConfiguration'][_0x0d60('0x52')]({'where':{'id':_0x40c12c[_0x0d60('0x4b')]['id']}})[_0x0d60('0x18')](handleEntityNotFound(_0x5c2630,null))[_0x0d60('0x18')](function(_0x43a356){if(_0x43a356){_0x2f8a0a=_0x43a356;_0x3683d3[_0x0d60('0x35')]=_[_0x0d60('0x36')](db[_0x0d60('0x53')][_0x0d60('0x4c')]);_0x3683d3[_0x0d60('0x37')]=_[_0x0d60('0x36')](_0x40c12c[_0x0d60('0x37')]);_0x3683d3[_0x0d60('0x38')]=_[_0x0d60('0x39')](_0x3683d3[_0x0d60('0x35')],_0x3683d3[_0x0d60('0x37')]);_0x4f767e[_0x0d60('0x3b')]=_[_0x0d60('0x39')](_0x3683d3[_0x0d60('0x35')],qs[_0x0d60('0x3a')](_0x40c12c[_0x0d60('0x37')][_0x0d60('0x3a')]));_0x4f767e['attributes']=_0x4f767e['attributes'][_0x0d60('0x3c')]?_0x4f767e['attributes']:_0x3683d3[_0x0d60('0x35')];_0x4f767e[_0x0d60('0x3f')]=qs['sort'](_0x40c12c[_0x0d60('0x37')][_0x0d60('0x40')]);_0x4f767e[_0x0d60('0x41')]=qs[_0x0d60('0x38')](_['pick'](_0x40c12c[_0x0d60('0x37')],_0x3683d3['filters']));if(_0x40c12c[_0x0d60('0x37')][_0x0d60('0x43')]){_0x4f767e[_0x0d60('0x41')]=_[_0x0d60('0x44')](_0x4f767e['where'],{'$or':_['map'](_0x4f767e['attributes'],function(_0x30e898){var _0x32df13={};_0x32df13[_0x30e898]={'$like':'%'+_0x40c12c[_0x0d60('0x37')][_0x0d60('0x43')]+'%'};return _0x32df13;})});}_0x4f767e=_['merge']({},_0x4f767e,_0x40c12c['options']);return _0x2f8a0a[_0x0d60('0x51')](_0x4f767e);}})[_0x0d60('0x18')](function(_0xd3fda){if(_0xd3fda){_0xdc70f7=_0xd3fda[_0x0d60('0x3c')];if(!_0x40c12c[_0x0d60('0x37')]['hasOwnProperty'](_0x0d60('0x3e'))){_0x4f767e['limit']=qs[_0x0d60('0x27')](_0x40c12c[_0x0d60('0x37')][_0x0d60('0x27')]);_0x4f767e[_0x0d60('0x25')]=qs['offset'](_0x40c12c[_0x0d60('0x37')][_0x0d60('0x25')]);}return _0x2f8a0a[_0x0d60('0x51')](_0x4f767e);}})[_0x0d60('0x18')](function(_0x187b9c){if(_0x187b9c){return _0x187b9c?{'count':_0xdc70f7,'rows':_0x187b9c}:null;}})[_0x0d60('0x18')](respondWithResult(_0x5c2630,null))[_0x0d60('0x21')](handleError(_0x5c2630,null));};exports['getDescriptions']=function(_0x5a63cd,_0x532f23,_0xaeb62){var _0x3c6694={};var _0x1c1ef8={};var _0xf60b1b;var _0x3a72f1;return db[_0x0d60('0x33')][_0x0d60('0x52')]({'where':{'id':_0x5a63cd[_0x0d60('0x4b')]['id']}})['then'](handleEntityNotFound(_0x532f23,null))[_0x0d60('0x18')](function(_0x44b8c1){if(_0x44b8c1){_0xf60b1b=_0x44b8c1;_0x1c1ef8[_0x0d60('0x35')]=_[_0x0d60('0x36')](db[_0x0d60('0x53')]['rawAttributes']);_0x1c1ef8[_0x0d60('0x37')]=_['keys'](_0x5a63cd[_0x0d60('0x37')]);_0x1c1ef8[_0x0d60('0x38')]=_[_0x0d60('0x39')](_0x1c1ef8[_0x0d60('0x35')],_0x1c1ef8['query']);_0x3c6694[_0x0d60('0x3b')]=_[_0x0d60('0x39')](_0x1c1ef8[_0x0d60('0x35')],qs['fields'](_0x5a63cd[_0x0d60('0x37')]['fields']));_0x3c6694[_0x0d60('0x3b')]=_0x3c6694[_0x0d60('0x3b')][_0x0d60('0x3c')]?_0x3c6694['attributes']:_0x1c1ef8[_0x0d60('0x35')];_0x3c6694[_0x0d60('0x3f')]=qs[_0x0d60('0x40')](_0x5a63cd[_0x0d60('0x37')][_0x0d60('0x40')]);_0x3c6694[_0x0d60('0x41')]=qs['filters'](_[_0x0d60('0x42')](_0x5a63cd[_0x0d60('0x37')],_0x1c1ef8['filters']));if(_0x5a63cd[_0x0d60('0x37')][_0x0d60('0x43')]){_0x3c6694['where']=_[_0x0d60('0x44')](_0x3c6694[_0x0d60('0x41')],{'$or':_[_0x0d60('0x32')](_0x3c6694[_0x0d60('0x3b')],function(_0x3fc98a){var _0x4acf6f={};_0x4acf6f[_0x3fc98a]={'$like':'%'+_0x5a63cd[_0x0d60('0x37')][_0x0d60('0x43')]+'%'};return _0x4acf6f;})});}_0x3c6694=_['merge']({},_0x3c6694,_0x5a63cd[_0x0d60('0x47')]);return _0xf60b1b['getDescriptions'](_0x3c6694);}})[_0x0d60('0x18')](function(_0x3b46ff){if(_0x3b46ff){_0x3a72f1=_0x3b46ff[_0x0d60('0x3c')];if(!_0x5a63cd[_0x0d60('0x37')][_0x0d60('0x3d')](_0x0d60('0x3e'))){_0x3c6694[_0x0d60('0x27')]=qs[_0x0d60('0x27')](_0x5a63cd[_0x0d60('0x37')][_0x0d60('0x27')]);_0x3c6694[_0x0d60('0x25')]=qs[_0x0d60('0x25')](_0x5a63cd[_0x0d60('0x37')]['offset']);}return _0xf60b1b[_0x0d60('0x54')](_0x3c6694);}})['then'](function(_0x4f2e98){if(_0x4f2e98){return _0x4f2e98?{'count':_0x3a72f1,'rows':_0x4f2e98}:null;}})['then'](respondWithResult(_0x532f23,null))[_0x0d60('0x21')](handleError(_0x532f23,null));};exports[_0x0d60('0x55')]=function(_0x50d687,_0x4ecfcc,_0x5d2d70){var _0x312093={};var _0x33f55b={};var _0x16916f;var _0x51d5fb;return db['FreshsalesConfiguration']['findOne']({'where':{'id':_0x50d687[_0x0d60('0x4b')]['id']}})[_0x0d60('0x18')](handleEntityNotFound(_0x4ecfcc,null))[_0x0d60('0x18')](function(_0x4f03e5){if(_0x4f03e5){_0x16916f=_0x4f03e5;_0x33f55b[_0x0d60('0x35')]=_['keys'](db[_0x0d60('0x53')][_0x0d60('0x4c')]);_0x33f55b[_0x0d60('0x37')]=_[_0x0d60('0x36')](_0x50d687[_0x0d60('0x37')]);_0x33f55b[_0x0d60('0x38')]=_[_0x0d60('0x39')](_0x33f55b[_0x0d60('0x35')],_0x33f55b[_0x0d60('0x37')]);_0x312093[_0x0d60('0x3b')]=_[_0x0d60('0x39')](_0x33f55b[_0x0d60('0x35')],qs['fields'](_0x50d687[_0x0d60('0x37')]['fields']));_0x312093[_0x0d60('0x3b')]=_0x312093[_0x0d60('0x3b')][_0x0d60('0x3c')]?_0x312093[_0x0d60('0x3b')]:_0x33f55b['model'];_0x312093[_0x0d60('0x3f')]=qs['sort'](_0x50d687[_0x0d60('0x37')]['sort']);_0x312093[_0x0d60('0x41')]=qs[_0x0d60('0x38')](_[_0x0d60('0x42')](_0x50d687[_0x0d60('0x37')],_0x33f55b[_0x0d60('0x38')]));if(_0x50d687[_0x0d60('0x37')][_0x0d60('0x43')]){_0x312093[_0x0d60('0x41')]=_[_0x0d60('0x44')](_0x312093[_0x0d60('0x41')],{'$or':_[_0x0d60('0x32')](_0x312093[_0x0d60('0x3b')],function(_0x21e771){var _0x56fa8e={};_0x56fa8e[_0x21e771]={'$like':'%'+_0x50d687[_0x0d60('0x37')][_0x0d60('0x43')]+'%'};return _0x56fa8e;})});}_0x312093=_['merge']({},_0x312093,_0x50d687[_0x0d60('0x47')]);return _0x16916f['getFields'](_0x312093);}})[_0x0d60('0x18')](function(_0x28ee1c){if(_0x28ee1c){_0x51d5fb=_0x28ee1c[_0x0d60('0x3c')];if(!_0x50d687[_0x0d60('0x37')][_0x0d60('0x3d')](_0x0d60('0x3e'))){_0x312093[_0x0d60('0x27')]=qs[_0x0d60('0x27')](_0x50d687[_0x0d60('0x37')][_0x0d60('0x27')]);_0x312093[_0x0d60('0x25')]=qs[_0x0d60('0x25')](_0x50d687['query'][_0x0d60('0x25')]);}return _0x16916f['getFields'](_0x312093);}})[_0x0d60('0x18')](function(_0x543ebb){if(_0x543ebb){return _0x543ebb?{'count':_0x51d5fb,'rows':_0x543ebb}:null;}})['then'](respondWithResult(_0x4ecfcc,null))[_0x0d60('0x21')](handleError(_0x4ecfcc,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index c48d7db..30da154 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 _0x7b85=['moment','path','rimraf','./intFreshsalesConfiguration.attributes','define','lodash','util','../../config/logger','api'];(function(_0x252e2d,_0x13f78a){var _0x49fd40=function(_0x403b7e){while(--_0x403b7e){_0x252e2d['push'](_0x252e2d['shift']());}};_0x49fd40(++_0x13f78a);}(_0x7b85,0x17f));var _0x57b8=function(_0x2d126e,_0x1e8257){_0x2d126e=_0x2d126e-0x0;var _0xcb04d3=_0x7b85[_0x2d126e];return _0xcb04d3;};'use strict';var _=require(_0x57b8('0x0'));var util=require(_0x57b8('0x1'));var logger=require(_0x57b8('0x2'))(_0x57b8('0x3'));var moment=require(_0x57b8('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x57b8('0x5'));var rimraf=require(_0x57b8('0x6'));var config=require('../../config/environment');var attributes=require(_0x57b8('0x7'));module['exports']=function(_0x190487,_0x3040c5){return _0x190487[_0x57b8('0x8')]('FreshsalesConfiguration',attributes,{'tableName':'int_freshsales_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xeb72=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intFreshsalesConfiguration.attributes','exports','define','FreshsalesConfiguration','int_freshsales_configurations'];(function(_0x4e5068,_0x526196){var _0x562b3b=function(_0x4b34f6){while(--_0x4b34f6){_0x4e5068['push'](_0x4e5068['shift']());}};_0x562b3b(++_0x526196);}(_0xeb72,0x12b));var _0x2eb7=function(_0x29a4fb,_0x537211){_0x29a4fb=_0x29a4fb-0x0;var _0x20d5cf=_0xeb72[_0x29a4fb];return _0x20d5cf;};'use strict';var _=require('lodash');var util=require(_0x2eb7('0x0'));var logger=require(_0x2eb7('0x1'))(_0x2eb7('0x2'));var moment=require(_0x2eb7('0x3'));var BPromise=require(_0x2eb7('0x4'));var rp=require(_0x2eb7('0x5'));var fs=require('fs');var path=require(_0x2eb7('0x6'));var rimraf=require(_0x2eb7('0x7'));var config=require('../../config/environment');var attributes=require(_0x2eb7('0x8'));module[_0x2eb7('0x9')]=function(_0x1e3130,_0x34aea0){return _0x1e3130[_0x2eb7('0xa')](_0x2eb7('0xb'),attributes,{'tableName':_0x2eb7('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 3af1bab..6fad60d 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 _0x6b98=['request','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x220f3f,_0x11c540){var _0x1f170e=function(_0x2c0ec9){while(--_0x2c0ec9){_0x220f3f['push'](_0x220f3f['shift']());}};_0x1f170e(++_0x11c540);}(_0x6b98,0x136));var _0x86b9=function(_0x466bfd,_0x56f4bb){_0x466bfd=_0x466bfd-0x0;var _0x29293d=_0x6b98[_0x466bfd];return _0x29293d;};'use strict';var _=require(_0x86b9('0x0'));var util=require(_0x86b9('0x1'));var moment=require(_0x86b9('0x2'));var BPromise=require(_0x86b9('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x86b9('0x4'));var db=require(_0x86b9('0x5'))['db'];var utils=require(_0x86b9('0x6'));var logger=require('../../config/logger')(_0x86b9('0x7'));var config=require(_0x86b9('0x8'));var jayson=require(_0x86b9('0x9'));var client=jayson[_0x86b9('0xa')][_0x86b9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2800eb,_0x4137bb,_0x5d959b){return new BPromise(function(_0x50e664,_0x2f9f01){return client[_0x86b9('0xc')](_0x2800eb,_0x5d959b)['then'](function(_0xbb2101){logger[_0x86b9('0xd')](_0x86b9('0xe'),_0x4137bb,_0x86b9('0xf'));logger[_0x86b9('0x10')](_0x86b9('0x11'),_0x4137bb,_0x86b9('0xf'),JSON[_0x86b9('0x12')](_0xbb2101));if(_0xbb2101['error']){if(_0xbb2101[_0x86b9('0x13')]['code']===0x1f4){logger['error']('FreshsalesConfiguration,\x20%s,\x20%s',_0x4137bb,_0xbb2101[_0x86b9('0x13')][_0x86b9('0x14')]);return _0x2f9f01(_0xbb2101[_0x86b9('0x13')]['message']);}logger[_0x86b9('0x13')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x4137bb,_0xbb2101['error'][_0x86b9('0x14')]);return _0x50e664(_0xbb2101[_0x86b9('0x13')][_0x86b9('0x14')]);}else{logger['info'](_0x86b9('0xe'),_0x4137bb,_0x86b9('0xf'));_0x50e664(_0xbb2101[_0x86b9('0x15')][_0x86b9('0x14')]);}})[_0x86b9('0x16')](function(_0x4e37b3){logger[_0x86b9('0x13')](_0x86b9('0xe'),_0x4137bb,_0x4e37b3);_0x2f9f01(_0x4e37b3);});});} \ No newline at end of file +var _0x477b=['jayson/promise','client','http','request','then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','lodash','util','ioredis','../../mysqldb','../../config/logger','../../config/environment'];(function(_0x5ba5e2,_0x5e8b2d){var _0x59fd1d=function(_0x42168c){while(--_0x42168c){_0x5ba5e2['push'](_0x5ba5e2['shift']());}};_0x59fd1d(++_0x5e8b2d);}(_0x477b,0x19c));var _0xb477=function(_0x913bb7,_0x2cc170){_0x913bb7=_0x913bb7-0x0;var _0x39675a=_0x477b[_0x913bb7];return _0x39675a;};'use strict';var _=require(_0xb477('0x0'));var util=require(_0xb477('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb477('0x2'));var db=require(_0xb477('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xb477('0x4'))('rpc');var config=require(_0xb477('0x5'));var jayson=require(_0xb477('0x6'));var client=jayson[_0xb477('0x7')][_0xb477('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2a9664,_0x21c3b8,_0x184c08){return new BPromise(function(_0x28355f,_0x2c7800){return client[_0xb477('0x9')](_0x2a9664,_0x184c08)[_0xb477('0xa')](function(_0x2d7004){logger[_0xb477('0xb')](_0xb477('0xc'),_0x21c3b8,_0xb477('0xd'));logger[_0xb477('0xe')](_0xb477('0xf'),_0x21c3b8,_0xb477('0xd'),JSON[_0xb477('0x10')](_0x2d7004));if(_0x2d7004[_0xb477('0x11')]){if(_0x2d7004[_0xb477('0x11')]['code']===0x1f4){logger[_0xb477('0x11')](_0xb477('0xc'),_0x21c3b8,_0x2d7004['error'][_0xb477('0x12')]);return _0x2c7800(_0x2d7004[_0xb477('0x11')][_0xb477('0x12')]);}logger[_0xb477('0x11')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x21c3b8,_0x2d7004[_0xb477('0x11')]['message']);return _0x28355f(_0x2d7004[_0xb477('0x11')][_0xb477('0x12')]);}else{logger[_0xb477('0xb')](_0xb477('0xc'),_0x21c3b8,_0xb477('0xd'));_0x28355f(_0x2d7004['result'][_0xb477('0x12')]);}})['catch'](function(_0x18b4e1){logger['error']('FreshsalesConfiguration,\x20%s,\x20%s',_0x21c3b8,_0x18b4e1);_0x2c7800(_0x18b4e1);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index 5653521..013a69b 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 _0xd847=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','isAuthenticated','get','/:id','show','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','fs-extra'];(function(_0x11db76,_0x42c6e0){var _0x4fac88=function(_0x35d47f){while(--_0x35d47f){_0x11db76['push'](_0x11db76['shift']());}};_0x4fac88(++_0x42c6e0);}(_0xd847,0x18a));var _0x7d84=function(_0x415437,_0x4041c5){_0x415437=_0x415437-0x0;var _0x5f429b=_0xd847[_0x415437];return _0x5f429b;};'use strict';var multer=require(_0x7d84('0x0'));var util=require(_0x7d84('0x1'));var path=require(_0x7d84('0x2'));var timeout=require(_0x7d84('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x7d84('0x4'));var auth=require(_0x7d84('0x5'));var interaction=require(_0x7d84('0x6'));var config=require(_0x7d84('0x7'));var controller=require(_0x7d84('0x8'));router['get']('/',auth[_0x7d84('0x9')](),controller['index']);router[_0x7d84('0xa')](_0x7d84('0xb'),auth[_0x7d84('0x9')](),controller[_0x7d84('0xc')]);router[_0x7d84('0xd')]('/',auth[_0x7d84('0x9')](),controller['create']);router[_0x7d84('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x7d84('0xf')]);router[_0x7d84('0x10')](_0x7d84('0xb'),auth[_0x7d84('0x9')](),controller[_0x7d84('0x11')]);module[_0x7d84('0x12')]=router; \ No newline at end of file +var _0x0c6d=['index','get','post','create','put','/:id','update','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','isAuthenticated'];(function(_0x49551e,_0x583155){var _0x52d8f8=function(_0xf1ef90){while(--_0xf1ef90){_0x49551e['push'](_0x49551e['shift']());}};_0x52d8f8(++_0x583155);}(_0x0c6d,0xf7));var _0xd0c6=function(_0x5e03a4,_0x1ed8f1){_0x5e03a4=_0x5e03a4-0x0;var _0x6555f5=_0x0c6d[_0x5e03a4];return _0x6555f5;};'use strict';var multer=require('multer');var util=require(_0xd0c6('0x0'));var path=require(_0xd0c6('0x1'));var timeout=require(_0xd0c6('0x2'));var express=require(_0xd0c6('0x3'));var router=express[_0xd0c6('0x4')]();var fs_extra=require(_0xd0c6('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xd0c6('0x6'));var config=require('../../config/environment');var controller=require('./intFreshsalesField.controller');router['get']('/',auth[_0xd0c6('0x7')](),controller[_0xd0c6('0x8')]);router[_0xd0c6('0x9')]('/:id',auth[_0xd0c6('0x7')](),controller['show']);router[_0xd0c6('0xa')]('/',auth[_0xd0c6('0x7')](),controller[_0xd0c6('0xb')]);router[_0xd0c6('0xc')](_0xd0c6('0xd'),auth[_0xd0c6('0x7')](),controller[_0xd0c6('0xe')]);router[_0xd0c6('0xf')](_0xd0c6('0xd'),auth['isAuthenticated'](),controller[_0xd0c6('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index 17b34bc..360126d 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 _0x0658=['ENUM','BOOLEAN','sequelize','exports','string','customVariable','picklist','STRING'];(function(_0x2d2258,_0x2ce510){var _0x18e155=function(_0x11949e){while(--_0x11949e){_0x2d2258['push'](_0x2d2258['shift']());}};_0x18e155(++_0x2ce510);}(_0x0658,0xd2));var _0x8065=function(_0x3d659b,_0x5040e2){_0x3d659b=_0x3d659b-0x0;var _0x39d0ec=_0x0658[_0x3d659b];return _0x39d0ec;};'use strict';var Sequelize=require(_0x8065('0x0'));module[_0x8065('0x1')]={'type':{'type':Sequelize['ENUM'](_0x8065('0x2'),'variable',_0x8065('0x3'),'keyValue',_0x8065('0x4')),'defaultValue':_0x8065('0x2')},'content':{'type':Sequelize[_0x8065('0x5')]},'key':{'type':Sequelize[_0x8065('0x5')]},'keyType':{'type':Sequelize[_0x8065('0x6')](_0x8065('0x2'),'variable',_0x8065('0x3'))},'keyContent':{'type':Sequelize[_0x8065('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x8065('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x8065('0x5')]}}; \ No newline at end of file +var _0x50b2=['ENUM','BOOLEAN','exports','customVariable','keyValue','picklist','string','STRING'];(function(_0x143585,_0x19e087){var _0x332cfc=function(_0x28fa5e){while(--_0x28fa5e){_0x143585['push'](_0x143585['shift']());}};_0x332cfc(++_0x19e087);}(_0x50b2,0x1ea));var _0x250b=function(_0x50c7e5,_0x380f0f){_0x50c7e5=_0x50c7e5-0x0;var _0x108f56=_0x50b2[_0x50c7e5];return _0x108f56;};'use strict';var Sequelize=require('sequelize');module[_0x250b('0x0')]={'type':{'type':Sequelize['ENUM']('string','variable',_0x250b('0x1'),_0x250b('0x2'),_0x250b('0x3')),'defaultValue':_0x250b('0x4')},'content':{'type':Sequelize[_0x250b('0x5')]},'key':{'type':Sequelize[_0x250b('0x5')]},'keyType':{'type':Sequelize[_0x250b('0x6')]('string','variable',_0x250b('0x1'))},'keyContent':{'type':Sequelize[_0x250b('0x5')]},'idField':{'type':Sequelize[_0x250b('0x5')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x250b('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x250b('0x5')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index 7207705..0494344 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 _0x6bc3=['../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','then','sendStatus','error','stack','name','index','FreshsalesField','rawAttributes','fieldName','type','query','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','merge','map','where','includeAll','findAll','catch','show','params','keys','include','options','find','body','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment'];(function(_0x49ca18,_0x5e6d05){var _0x145d54=function(_0x30b9be){while(--_0x30b9be){_0x49ca18['push'](_0x49ca18['shift']());}};_0x145d54(++_0x5e6d05);}(_0x6bc3,0x1ef));var _0x36bc=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x6bc3[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0x36bc('0x0'));var rimraf=require(_0x36bc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x36bc('0x2'));var rp=require('request-promise');var moment=require(_0x36bc('0x3'));var BPromise=require(_0x36bc('0x4'));var Mustache=require(_0x36bc('0x5'));var util=require(_0x36bc('0x6'));var path=require(_0x36bc('0x7'));var sox=require('sox');var csv=require(_0x36bc('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x36bc('0x9'));var _=require(_0x36bc('0xa'));var squel=require(_0x36bc('0xb'));var crypto=require(_0x36bc('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x36bc('0xd'));var toCsv=require('to-csv');var querystring=require(_0x36bc('0xe'));var Papa=require('papaparse');var Redis=require(_0x36bc('0xf'));var authService=require(_0x36bc('0x10'));var qs=require(_0x36bc('0x11'));var as=require(_0x36bc('0x12'));var hardwareService=require(_0x36bc('0x13'));var logger=require(_0x36bc('0x14'))('api');var utils=require(_0x36bc('0x15'));var config=require(_0x36bc('0x16'));var licenseUtil=require(_0x36bc('0x17'));var db=require(_0x36bc('0x18'))['db'];function respondWithStatusCode(_0x502e8e,_0x58f523){_0x58f523=_0x58f523||0xcc;return function(_0x440d10){if(_0x440d10){return _0x502e8e['sendStatus'](_0x58f523);}return _0x502e8e['status'](_0x58f523)[_0x36bc('0x19')]();};}function respondWithResult(_0x34cd4a,_0xce5157){_0xce5157=_0xce5157||0xc8;return function(_0x12c174){if(_0x12c174){return _0x34cd4a[_0x36bc('0x1a')](_0xce5157)[_0x36bc('0x1b')](_0x12c174);}};}function respondWithFilteredResult(_0x18805c,_0x1c1ec7){return function(_0x231e65){if(_0x231e65){var _0x375851=typeof _0x1c1ec7[_0x36bc('0x1c')]===_0x36bc('0x1d')&&typeof _0x1c1ec7[_0x36bc('0x1e')]===_0x36bc('0x1d');var _0x3e7cca=_0x231e65['count'];var _0x27607e=_0x375851?0x0:_0x1c1ec7[_0x36bc('0x1c')];var _0x11d31f=_0x375851?_0x231e65[_0x36bc('0x1f')]:_0x1c1ec7[_0x36bc('0x1c')]+_0x1c1ec7['limit'];var _0x3c8789;if(_0x11d31f>=_0x3e7cca){_0x11d31f=_0x3e7cca;_0x3c8789=0xc8;}else{_0x3c8789=0xce;}_0x18805c['status'](_0x3c8789);return _0x18805c[_0x36bc('0x20')]('Content-Range',_0x27607e+'-'+_0x11d31f+'/'+_0x3e7cca)[_0x36bc('0x1b')](_0x231e65);}return null;};}function patchUpdates(_0x10b75a){return function(_0x3bb11e){try{jsonpatch[_0x36bc('0x21')](_0x3bb11e,_0x10b75a,!![]);}catch(_0x413acf){return BPromise[_0x36bc('0x22')](_0x413acf);}return _0x3bb11e[_0x36bc('0x23')]();};}function saveUpdates(_0x33be05,_0x561d7d){return function(_0xa5397a){if(_0xa5397a){return _0xa5397a[_0x36bc('0x24')](_0x33be05)['then'](function(_0x5bbdfa){return _0x5bbdfa;});}return null;};}function removeEntity(_0x153ae2,_0xf7d7f7){return function(_0x24a110){if(_0x24a110){return _0x24a110[_0x36bc('0x25')]()[_0x36bc('0x26')](function(){_0x153ae2['status'](0xcc)[_0x36bc('0x19')]();});}};}function handleEntityNotFound(_0x12a789,_0x31b8f2){return function(_0x125078){if(!_0x125078){_0x12a789[_0x36bc('0x27')](0x194);}return _0x125078;};}function handleError(_0x27f5f7,_0x6a2361){_0x6a2361=_0x6a2361||0x1f4;return function(_0x149921){logger[_0x36bc('0x28')](_0x149921[_0x36bc('0x29')]);if(_0x149921[_0x36bc('0x2a')]){delete _0x149921['name'];}_0x27f5f7[_0x36bc('0x1a')](_0x6a2361)['send'](_0x149921);};}exports[_0x36bc('0x2b')]=function(_0x8921bc,_0x365de5){var _0x1106ec={},_0x141737={},_0x3c77bc={'count':0x0,'rows':[]};var _0x39e220=_['map'](db[_0x36bc('0x2c')][_0x36bc('0x2d')],function(_0x37ac31){return{'name':_0x37ac31[_0x36bc('0x2e')],'type':_0x37ac31[_0x36bc('0x2f')]['key']};});_0x141737['model']=_['map'](_0x39e220,_0x36bc('0x2a'));_0x141737[_0x36bc('0x30')]=_['keys'](_0x8921bc[_0x36bc('0x30')]);_0x141737['filters']=_[_0x36bc('0x31')](_0x141737['model'],_0x141737[_0x36bc('0x30')]);_0x1106ec[_0x36bc('0x32')]=_[_0x36bc('0x31')](_0x141737[_0x36bc('0x33')],qs[_0x36bc('0x34')](_0x8921bc[_0x36bc('0x30')]['fields']));_0x1106ec[_0x36bc('0x32')]=_0x1106ec['attributes'][_0x36bc('0x35')]?_0x1106ec[_0x36bc('0x32')]:_0x141737['model'];if(!_0x8921bc[_0x36bc('0x30')][_0x36bc('0x36')](_0x36bc('0x37'))){_0x1106ec[_0x36bc('0x1e')]=qs[_0x36bc('0x1e')](_0x8921bc['query']['limit']);_0x1106ec[_0x36bc('0x1c')]=qs[_0x36bc('0x1c')](_0x8921bc[_0x36bc('0x30')][_0x36bc('0x1c')]);}_0x1106ec[_0x36bc('0x38')]=qs['sort'](_0x8921bc[_0x36bc('0x30')][_0x36bc('0x39')]);_0x1106ec['where']=qs[_0x36bc('0x3a')](_[_0x36bc('0x3b')](_0x8921bc['query'],_0x141737['filters']),_0x39e220);if(_0x8921bc[_0x36bc('0x30')][_0x36bc('0x3c')]){_0x1106ec['where']=_[_0x36bc('0x3d')](_0x1106ec['where'],{'$or':_[_0x36bc('0x3e')](_0x39e220,function(_0x1ef41c){if(_0x1ef41c['type']!=='VIRTUAL'){var _0x5a21cc={};_0x5a21cc[_0x1ef41c[_0x36bc('0x2a')]]={'$like':'%'+_0x8921bc[_0x36bc('0x30')][_0x36bc('0x3c')]+'%'};return _0x5a21cc;}})});}_0x1106ec=_['merge']({},_0x1106ec,_0x8921bc['options']);var _0x2b6365={'where':_0x1106ec[_0x36bc('0x3f')]};return db[_0x36bc('0x2c')][_0x36bc('0x1f')](_0x2b6365)[_0x36bc('0x26')](function(_0x467f2d){_0x3c77bc['count']=_0x467f2d;if(_0x8921bc[_0x36bc('0x30')][_0x36bc('0x40')]){_0x1106ec['include']=[{'all':!![]}];}return db[_0x36bc('0x2c')][_0x36bc('0x41')](_0x1106ec);})[_0x36bc('0x26')](function(_0x11945d){_0x3c77bc['rows']=_0x11945d;return _0x3c77bc;})['then'](respondWithFilteredResult(_0x365de5,_0x1106ec))[_0x36bc('0x42')](handleError(_0x365de5,null));};exports[_0x36bc('0x43')]=function(_0x20495f,_0x24f793){var _0x270794={'raw':!![],'where':{'id':_0x20495f[_0x36bc('0x44')]['id']}},_0x4b3bfb={};_0x4b3bfb[_0x36bc('0x33')]=_[_0x36bc('0x45')](db[_0x36bc('0x2c')]['rawAttributes']);_0x4b3bfb[_0x36bc('0x30')]=_[_0x36bc('0x45')](_0x20495f[_0x36bc('0x30')]);_0x4b3bfb[_0x36bc('0x3a')]=_[_0x36bc('0x31')](_0x4b3bfb[_0x36bc('0x33')],_0x4b3bfb[_0x36bc('0x30')]);_0x270794['attributes']=_[_0x36bc('0x31')](_0x4b3bfb['model'],qs[_0x36bc('0x34')](_0x20495f['query'][_0x36bc('0x34')]));_0x270794[_0x36bc('0x32')]=_0x270794[_0x36bc('0x32')][_0x36bc('0x35')]?_0x270794[_0x36bc('0x32')]:_0x4b3bfb['model'];if(_0x20495f[_0x36bc('0x30')][_0x36bc('0x40')]){_0x270794[_0x36bc('0x46')]=[{'all':!![]}];}_0x270794=_[_0x36bc('0x3d')]({},_0x270794,_0x20495f[_0x36bc('0x47')]);return db['FreshsalesField'][_0x36bc('0x48')](_0x270794)[_0x36bc('0x26')](handleEntityNotFound(_0x24f793,null))[_0x36bc('0x26')](respondWithResult(_0x24f793,null))[_0x36bc('0x42')](handleError(_0x24f793,null));};exports['create']=function(_0x4a5e2b,_0x5a52b6){return db[_0x36bc('0x2c')]['create'](_0x4a5e2b[_0x36bc('0x49')],{})[_0x36bc('0x26')](respondWithResult(_0x5a52b6,0xc9))[_0x36bc('0x42')](handleError(_0x5a52b6,null));};exports[_0x36bc('0x24')]=function(_0x2ee77f,_0x27e5f3){if(_0x2ee77f['body']['id']){delete _0x2ee77f['body']['id'];}return db[_0x36bc('0x2c')][_0x36bc('0x48')]({'where':{'id':_0x2ee77f[_0x36bc('0x44')]['id']}})['then'](handleEntityNotFound(_0x27e5f3,null))[_0x36bc('0x26')](saveUpdates(_0x2ee77f[_0x36bc('0x49')],null))['then'](respondWithResult(_0x27e5f3,null))[_0x36bc('0x42')](handleError(_0x27e5f3,null));};exports[_0x36bc('0x25')]=function(_0x1c7a9b,_0x213d31){return db[_0x36bc('0x2c')][_0x36bc('0x48')]({'where':{'id':_0x1c7a9b['params']['id']}})['then'](handleEntityNotFound(_0x213d31,null))['then'](removeEntity(_0x213d31,null))[_0x36bc('0x42')](handleError(_0x213d31,null));}; \ No newline at end of file +var _0x7e3f=['eml-format','zip-dir','fast-json-patch','bluebird','util','path','sox','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','then','error','stack','name','send','index','map','FreshsalesField','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','fields','length','model','hasOwnProperty','order','sort','pick','filter','merge','where','include','findAll','rows','catch','show','params','find','create','body'];(function(_0x8d7eb7,_0x18ba52){var _0x5d2334=function(_0x2d04ce){while(--_0x2d04ce){_0x8d7eb7['push'](_0x8d7eb7['shift']());}};_0x5d2334(++_0x18ba52);}(_0x7e3f,0x120));var _0xf7e3=function(_0xa0b270,_0x3bb5ef){_0xa0b270=_0xa0b270-0x0;var _0xcb9d36=_0x7e3f[_0xa0b270];return _0xcb9d36;};'use strict';var emlformat=require(_0xf7e3('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf7e3('0x1'));var jsonpatch=require(_0xf7e3('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xf7e3('0x3'));var Mustache=require('mustache');var util=require(_0xf7e3('0x4'));var path=require(_0xf7e3('0x5'));var sox=require(_0xf7e3('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf7e3('0x7'));var _=require(_0xf7e3('0x8'));var squel=require(_0xf7e3('0x9'));var crypto=require(_0xf7e3('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xf7e3('0xb'));var toCsv=require(_0xf7e3('0xc'));var querystring=require(_0xf7e3('0xd'));var Papa=require(_0xf7e3('0xe'));var Redis=require('ioredis');var authService=require(_0xf7e3('0xf'));var qs=require(_0xf7e3('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf7e3('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0xf7e3('0x12'));var config=require(_0xf7e3('0x13'));var licenseUtil=require(_0xf7e3('0x14'));var db=require(_0xf7e3('0x15'))['db'];function respondWithStatusCode(_0x59a95a,_0xd500f7){_0xd500f7=_0xd500f7||0xcc;return function(_0x9ad04f){if(_0x9ad04f){return _0x59a95a[_0xf7e3('0x16')](_0xd500f7);}return _0x59a95a[_0xf7e3('0x17')](_0xd500f7)[_0xf7e3('0x18')]();};}function respondWithResult(_0x28a66c,_0x3e6ee7){_0x3e6ee7=_0x3e6ee7||0xc8;return function(_0xc356cb){if(_0xc356cb){return _0x28a66c[_0xf7e3('0x17')](_0x3e6ee7)[_0xf7e3('0x19')](_0xc356cb);}};}function respondWithFilteredResult(_0x43d7c5,_0x30b627){return function(_0x3eb91b){if(_0x3eb91b){var _0x515abf=typeof _0x30b627[_0xf7e3('0x1a')]===_0xf7e3('0x1b')&&typeof _0x30b627[_0xf7e3('0x1c')]==='undefined';var _0x8b07d9=_0x3eb91b[_0xf7e3('0x1d')];var _0x5a2b3d=_0x515abf?0x0:_0x30b627[_0xf7e3('0x1a')];var _0x197f6a=_0x515abf?_0x3eb91b[_0xf7e3('0x1d')]:_0x30b627[_0xf7e3('0x1a')]+_0x30b627[_0xf7e3('0x1c')];var _0x317157;if(_0x197f6a>=_0x8b07d9){_0x197f6a=_0x8b07d9;_0x317157=0xc8;}else{_0x317157=0xce;}_0x43d7c5['status'](_0x317157);return _0x43d7c5[_0xf7e3('0x1e')]('Content-Range',_0x5a2b3d+'-'+_0x197f6a+'/'+_0x8b07d9)[_0xf7e3('0x19')](_0x3eb91b);}return null;};}function patchUpdates(_0x4eda08){return function(_0x4892af){try{jsonpatch[_0xf7e3('0x1f')](_0x4892af,_0x4eda08,!![]);}catch(_0x4e818c){return BPromise[_0xf7e3('0x20')](_0x4e818c);}return _0x4892af[_0xf7e3('0x21')]();};}function saveUpdates(_0x5920d3,_0x225f73){return function(_0x27a7ad){if(_0x27a7ad){return _0x27a7ad[_0xf7e3('0x22')](_0x5920d3)['then'](function(_0x291e8b){return _0x291e8b;});}return null;};}function removeEntity(_0x16acd4,_0x373bae){return function(_0x5533f8){if(_0x5533f8){return _0x5533f8[_0xf7e3('0x23')]()[_0xf7e3('0x24')](function(){_0x16acd4[_0xf7e3('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0xe8f540,_0x2762e3){return function(_0x3e51c8){if(!_0x3e51c8){_0xe8f540[_0xf7e3('0x16')](0x194);}return _0x3e51c8;};}function handleError(_0x57739d,_0x1f52d3){_0x1f52d3=_0x1f52d3||0x1f4;return function(_0x21e57a){logger[_0xf7e3('0x25')](_0x21e57a[_0xf7e3('0x26')]);if(_0x21e57a[_0xf7e3('0x27')]){delete _0x21e57a['name'];}_0x57739d[_0xf7e3('0x17')](_0x1f52d3)[_0xf7e3('0x28')](_0x21e57a);};}exports[_0xf7e3('0x29')]=function(_0x80a7de,_0x225241){var _0x36072e={},_0x2e5589={},_0x12eb74={'count':0x0,'rows':[]};var _0x56c76c=_[_0xf7e3('0x2a')](db[_0xf7e3('0x2b')][_0xf7e3('0x2c')],function(_0x237f98){return{'name':_0x237f98[_0xf7e3('0x2d')],'type':_0x237f98[_0xf7e3('0x2e')][_0xf7e3('0x2f')]};});_0x2e5589['model']=_[_0xf7e3('0x2a')](_0x56c76c,'name');_0x2e5589[_0xf7e3('0x30')]=_[_0xf7e3('0x31')](_0x80a7de['query']);_0x2e5589[_0xf7e3('0x32')]=_[_0xf7e3('0x33')](_0x2e5589['model'],_0x2e5589['query']);_0x36072e[_0xf7e3('0x34')]=_[_0xf7e3('0x33')](_0x2e5589['model'],qs['fields'](_0x80a7de[_0xf7e3('0x30')][_0xf7e3('0x35')]));_0x36072e[_0xf7e3('0x34')]=_0x36072e[_0xf7e3('0x34')][_0xf7e3('0x36')]?_0x36072e[_0xf7e3('0x34')]:_0x2e5589[_0xf7e3('0x37')];if(!_0x80a7de[_0xf7e3('0x30')][_0xf7e3('0x38')]('nolimit')){_0x36072e[_0xf7e3('0x1c')]=qs[_0xf7e3('0x1c')](_0x80a7de['query'][_0xf7e3('0x1c')]);_0x36072e[_0xf7e3('0x1a')]=qs['offset'](_0x80a7de['query'][_0xf7e3('0x1a')]);}_0x36072e[_0xf7e3('0x39')]=qs[_0xf7e3('0x3a')](_0x80a7de['query'][_0xf7e3('0x3a')]);_0x36072e['where']=qs['filters'](_[_0xf7e3('0x3b')](_0x80a7de['query'],_0x2e5589[_0xf7e3('0x32')]),_0x56c76c);if(_0x80a7de[_0xf7e3('0x30')][_0xf7e3('0x3c')]){_0x36072e['where']=_[_0xf7e3('0x3d')](_0x36072e[_0xf7e3('0x3e')],{'$or':_[_0xf7e3('0x2a')](_0x56c76c,function(_0x1b8ef4){if(_0x1b8ef4[_0xf7e3('0x2e')]!=='VIRTUAL'){var _0x369f1c={};_0x369f1c[_0x1b8ef4[_0xf7e3('0x27')]]={'$like':'%'+_0x80a7de['query'][_0xf7e3('0x3c')]+'%'};return _0x369f1c;}})});}_0x36072e=_[_0xf7e3('0x3d')]({},_0x36072e,_0x80a7de['options']);var _0xb18dba={'where':_0x36072e['where']};return db[_0xf7e3('0x2b')][_0xf7e3('0x1d')](_0xb18dba)[_0xf7e3('0x24')](function(_0x7fb93c){_0x12eb74[_0xf7e3('0x1d')]=_0x7fb93c;if(_0x80a7de[_0xf7e3('0x30')]['includeAll']){_0x36072e[_0xf7e3('0x3f')]=[{'all':!![]}];}return db[_0xf7e3('0x2b')][_0xf7e3('0x40')](_0x36072e);})['then'](function(_0x483bb6){_0x12eb74[_0xf7e3('0x41')]=_0x483bb6;return _0x12eb74;})[_0xf7e3('0x24')](respondWithFilteredResult(_0x225241,_0x36072e))[_0xf7e3('0x42')](handleError(_0x225241,null));};exports[_0xf7e3('0x43')]=function(_0x4addac,_0x5a98c6){var _0x3610e2={'raw':!![],'where':{'id':_0x4addac[_0xf7e3('0x44')]['id']}},_0x1f2822={};_0x1f2822[_0xf7e3('0x37')]=_['keys'](db[_0xf7e3('0x2b')][_0xf7e3('0x2c')]);_0x1f2822[_0xf7e3('0x30')]=_['keys'](_0x4addac[_0xf7e3('0x30')]);_0x1f2822['filters']=_[_0xf7e3('0x33')](_0x1f2822[_0xf7e3('0x37')],_0x1f2822[_0xf7e3('0x30')]);_0x3610e2['attributes']=_[_0xf7e3('0x33')](_0x1f2822[_0xf7e3('0x37')],qs[_0xf7e3('0x35')](_0x4addac[_0xf7e3('0x30')]['fields']));_0x3610e2[_0xf7e3('0x34')]=_0x3610e2[_0xf7e3('0x34')][_0xf7e3('0x36')]?_0x3610e2[_0xf7e3('0x34')]:_0x1f2822[_0xf7e3('0x37')];if(_0x4addac['query']['includeAll']){_0x3610e2[_0xf7e3('0x3f')]=[{'all':!![]}];}_0x3610e2=_['merge']({},_0x3610e2,_0x4addac['options']);return db['FreshsalesField'][_0xf7e3('0x45')](_0x3610e2)[_0xf7e3('0x24')](handleEntityNotFound(_0x5a98c6,null))[_0xf7e3('0x24')](respondWithResult(_0x5a98c6,null))[_0xf7e3('0x42')](handleError(_0x5a98c6,null));};exports['create']=function(_0x232bdd,_0xdedf45){return db['FreshsalesField'][_0xf7e3('0x46')](_0x232bdd[_0xf7e3('0x47')],{})[_0xf7e3('0x24')](respondWithResult(_0xdedf45,0xc9))[_0xf7e3('0x42')](handleError(_0xdedf45,null));};exports[_0xf7e3('0x22')]=function(_0x1e86cf,_0x5b97c1){if(_0x1e86cf[_0xf7e3('0x47')]['id']){delete _0x1e86cf['body']['id'];}return db[_0xf7e3('0x2b')]['find']({'where':{'id':_0x1e86cf[_0xf7e3('0x44')]['id']}})[_0xf7e3('0x24')](handleEntityNotFound(_0x5b97c1,null))[_0xf7e3('0x24')](saveUpdates(_0x1e86cf[_0xf7e3('0x47')],null))[_0xf7e3('0x24')](respondWithResult(_0x5b97c1,null))[_0xf7e3('0x42')](handleError(_0x5b97c1,null));};exports[_0xf7e3('0x23')]=function(_0x1780ca,_0x2cb8f7){return db[_0xf7e3('0x2b')][_0xf7e3('0x45')]({'where':{'id':_0x1780ca[_0xf7e3('0x44')]['id']}})[_0xf7e3('0x24')](handleEntityNotFound(_0x2cb8f7,null))[_0xf7e3('0x24')](removeEntity(_0x2cb8f7,null))[_0xf7e3('0x42')](handleError(_0x2cb8f7,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index c6bc615..8f3e68a 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 _0x0b70=['define','int_freshsales_fields','idField','FieldId','util','api','moment','request-promise','path','rimraf','./intFreshsalesField.attributes'];(function(_0x302e2b,_0x15e810){var _0x21cef3=function(_0x4c2d82){while(--_0x4c2d82){_0x302e2b['push'](_0x302e2b['shift']());}};_0x21cef3(++_0x15e810);}(_0x0b70,0x159));var _0x00b7=function(_0x5885b6,_0x57ea11){_0x5885b6=_0x5885b6-0x0;var _0x201930=_0x0b70[_0x5885b6];return _0x201930;};'use strict';var _=require('lodash');var util=require(_0x00b7('0x0'));var logger=require('../../config/logger')(_0x00b7('0x1'));var moment=require(_0x00b7('0x2'));var BPromise=require('bluebird');var rp=require(_0x00b7('0x3'));var fs=require('fs');var path=require(_0x00b7('0x4'));var rimraf=require(_0x00b7('0x5'));var config=require('../../config/environment');var attributes=require(_0x00b7('0x6'));module['exports']=function(_0x81e64,_0x54332d){return _0x81e64[_0x00b7('0x7')]('FreshsalesField',attributes,{'tableName':_0x00b7('0x8'),'paranoid':![],'indexes':[{'name':'freshsales_unique_index','fields':[_0x00b7('0x9'),_0x00b7('0xa')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x288a=['idField','FieldId','util','../../config/logger','api','moment','path','../../config/environment','./intFreshsalesField.attributes','exports','define','FreshsalesField','freshsales_unique_index'];(function(_0x100295,_0x5a0834){var _0x5d0abc=function(_0x3ec2e1){while(--_0x3ec2e1){_0x100295['push'](_0x100295['shift']());}};_0x5d0abc(++_0x5a0834);}(_0x288a,0x188));var _0xa288=function(_0x30f5c,_0x45f5ce){_0x30f5c=_0x30f5c-0x0;var _0x4c9880=_0x288a[_0x30f5c];return _0x4c9880;};'use strict';var _=require('lodash');var util=require(_0xa288('0x0'));var logger=require(_0xa288('0x1'))(_0xa288('0x2'));var moment=require(_0xa288('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xa288('0x4'));var rimraf=require('rimraf');var config=require(_0xa288('0x5'));var attributes=require(_0xa288('0x6'));module[_0xa288('0x7')]=function(_0x4ad8fb,_0x1e2c4b){return _0x4ad8fb[_0xa288('0x8')](_0xa288('0x9'),attributes,{'tableName':'int_freshsales_fields','paranoid':![],'indexes':[{'name':_0xa288('0xa'),'fields':[_0xa288('0xb'),_0xa288('0xc')],'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 5ba83d5..0771bdf 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 _0x0295=['client','http','then','info','request\x20sent','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','error','FreshsalesField,\x20%s,\x20%s','message','result','catch','lodash','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x7d4979,_0x99fbdd){var _0x1133ae=function(_0x34e9b8){while(--_0x34e9b8){_0x7d4979['push'](_0x7d4979['shift']());}};_0x1133ae(++_0x99fbdd);}(_0x0295,0x1f0));var _0x5029=function(_0x1168a1,_0xa0d8c9){_0x1168a1=_0x1168a1-0x0;var _0xcc5ad8=_0x0295[_0x1168a1];return _0xcc5ad8;};'use strict';var _=require(_0x5029('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x5029('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5029('0x2'))['db'];var utils=require(_0x5029('0x3'));var logger=require(_0x5029('0x4'))(_0x5029('0x5'));var config=require(_0x5029('0x6'));var jayson=require(_0x5029('0x7'));var client=jayson[_0x5029('0x8')][_0x5029('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5b3cd,_0x502a62,_0x54978f){return new BPromise(function(_0x4ee867,_0xf4459b){return client['request'](_0x5b3cd,_0x54978f)[_0x5029('0xa')](function(_0x5bccfc){logger[_0x5029('0xb')]('FreshsalesField,\x20%s,\x20%s',_0x502a62,_0x5029('0xc'));logger[_0x5029('0xd')](_0x5029('0xe'),_0x502a62,'request\x20sent',JSON[_0x5029('0xf')](_0x5bccfc));if(_0x5bccfc[_0x5029('0x10')]){if(_0x5bccfc[_0x5029('0x10')]['code']===0x1f4){logger[_0x5029('0x10')](_0x5029('0x11'),_0x502a62,_0x5bccfc['error']['message']);return _0xf4459b(_0x5bccfc['error']['message']);}logger[_0x5029('0x10')](_0x5029('0x11'),_0x502a62,_0x5bccfc[_0x5029('0x10')][_0x5029('0x12')]);return _0x4ee867(_0x5bccfc[_0x5029('0x10')][_0x5029('0x12')]);}else{logger[_0x5029('0xb')](_0x5029('0x11'),_0x502a62,_0x5029('0xc'));_0x4ee867(_0x5bccfc[_0x5029('0x13')][_0x5029('0x12')]);}})[_0x5029('0x14')](function(_0x3786b5){logger[_0x5029('0x10')](_0x5029('0x11'),_0x502a62,_0x3786b5);_0xf4459b(_0x3786b5);});});} \ No newline at end of file +var _0x46ed=['FreshsalesField,\x20%s,\x20%s','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x46ed,0x168));var _0xd46e=function(_0x49b207,_0x408ade){_0x49b207=_0x49b207-0x0;var _0x2dc8fa=_0x46ed[_0x49b207];return _0x2dc8fa;};'use strict';var _=require(_0xd46e('0x0'));var util=require(_0xd46e('0x1'));var moment=require('moment');var BPromise=require(_0xd46e('0x2'));var rs=require(_0xd46e('0x3'));var fs=require('fs');var Redis=require(_0xd46e('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xd46e('0x5'));var logger=require(_0xd46e('0x6'))('rpc');var config=require(_0xd46e('0x7'));var jayson=require(_0xd46e('0x8'));var client=jayson[_0xd46e('0x9')][_0xd46e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x45e680,_0x855f24,_0x437ea0){return new BPromise(function(_0x144687,_0x31259b){return client[_0xd46e('0xb')](_0x45e680,_0x437ea0)[_0xd46e('0xc')](function(_0x59c88d){logger[_0xd46e('0xd')](_0xd46e('0xe'),_0x855f24,'request\x20sent');logger[_0xd46e('0xf')](_0xd46e('0x10'),_0x855f24,_0xd46e('0x11'),JSON[_0xd46e('0x12')](_0x59c88d));if(_0x59c88d[_0xd46e('0x13')]){if(_0x59c88d[_0xd46e('0x13')]['code']===0x1f4){logger[_0xd46e('0x13')]('FreshsalesField,\x20%s,\x20%s',_0x855f24,_0x59c88d['error'][_0xd46e('0x14')]);return _0x31259b(_0x59c88d[_0xd46e('0x13')]['message']);}logger['error'](_0xd46e('0xe'),_0x855f24,_0x59c88d[_0xd46e('0x13')][_0xd46e('0x14')]);return _0x144687(_0x59c88d[_0xd46e('0x13')]['message']);}else{logger[_0xd46e('0xd')](_0xd46e('0xe'),_0x855f24,_0xd46e('0x11'));_0x144687(_0x59c88d[_0xd46e('0x15')][_0xd46e('0x14')]);}})['catch'](function(_0x1d50a5){logger[_0xd46e('0x13')](_0xd46e('0xe'),_0x855f24,_0x1d50a5);_0x31259b(_0x1d50a5);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index 1c484a0..4c7ae24 100644 --- a/server/api/intSalesforceAccount/index.js +++ b/server/api/intSalesforceAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSalesforceAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x55f396,_0x49013e){var _0x545181=function(_0x57fc7b){while(--_0x57fc7b){_0x55f396['push'](_0x55f396['shift']());}};_0x545181(++_0x49013e);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file +var _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(_0x254677,_0x1a0d7c){var _0x25e189=function(_0xef5a80){while(--_0xef5a80){_0x254677['push'](_0x254677['shift']());}};_0x25e189(++_0x1a0d7c);}(_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['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 dfad2f8..bcafeff 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 _0xae59=['ENUM','integrationTab','newTab','sequelize','STRING','username'];(function(_0x125aab,_0x33b113){var _0x5857e1=function(_0x32b324){while(--_0x32b324){_0x125aab['push'](_0x125aab['shift']());}};_0x5857e1(++_0x33b113);}(_0xae59,0x8d));var _0x9ae5=function(_0x410d6b,_0x16e343){_0x410d6b=_0x410d6b-0x0;var _0x48ee53=_0xae59[_0x410d6b];return _0x48ee53;};'use strict';var Sequelize=require(_0x9ae5('0x0'));module['exports']={'name':{'type':Sequelize[_0x9ae5('0x1')]},'description':{'type':Sequelize[_0x9ae5('0x1')]},'username':{'type':Sequelize['STRING'],'unique':_0x9ae5('0x2')},'remoteUri':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x9ae5('0x1')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0x9ae5('0x1')]},'securityToken':{'type':Sequelize[_0x9ae5('0x1')]},'serverUrl':{'type':Sequelize[_0x9ae5('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x9ae5('0x3')](_0x9ae5('0x4'),_0x9ae5('0x5')),'defaultValue':_0x9ae5('0x4')}}; \ No newline at end of file +var _0xc43c=['newTab','integrationTab','sequelize','exports','STRING','ENUM'];(function(_0x221b8c,_0x2c7afc){var _0x3fab9f=function(_0x28bab0){while(--_0x28bab0){_0x221b8c['push'](_0x221b8c['shift']());}};_0x3fab9f(++_0x2c7afc);}(_0xc43c,0xd4));var _0xcc43=function(_0x1da667,_0xf112ea){_0x1da667=_0x1da667-0x0;var _0x10aad0=_0xc43c[_0x1da667];return _0x10aad0;};'use strict';var Sequelize=require(_0xcc43('0x0'));module[_0xcc43('0x1')]={'name':{'type':Sequelize[_0xcc43('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':'username'},'remoteUri':{'type':Sequelize[_0xcc43('0x2')]},'password':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize['STRING']},'securityToken':{'type':Sequelize[_0xcc43('0x2')]},'serverUrl':{'type':Sequelize[_0xcc43('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xcc43('0x3')]('integrationTab',_0xcc43('0x4')),'defaultValue':_0xcc43('0x5')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index bad65df..3797d20 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 _0x6ea7=['username','password','securityToken','slice','substring','login','concat','ticketType','sobject','describe','OwnerId','ActivityDate','IsReminderSet','IsRecurrence','Subject','Description','string','int','picklist','boolean','email','textarea','phone','remove','includes','label','custom','picklistValues','value','true','False','false','test','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','http','request','then','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','status','json','offset','undefined','count','limit','set','Content-Range','reject','save','destroy','stack','name','send','index','map','SalesforceAccount','fieldName','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','include','findAll','show','params','rawAttributes','intersection','includeAll','merge','update','body','find','getConfigurations','findOne','addConfiguration','AccountId','getSubjects','channel','Descriptions','SalesforceConfiguration','create','SalesforceField','Subjects','getFields','remoteUri','clientId','clientSecret'];(function(_0x38ce8d,_0x4b59eb){var _0x3381ad=function(_0x501e32){while(--_0x501e32){_0x38ce8d['push'](_0x38ce8d['shift']());}};_0x3381ad(++_0x4b59eb);}(_0x6ea7,0x135));var _0x76ea=function(_0x13b8f3,_0x442821){_0x13b8f3=_0x13b8f3-0x0;var _0x1a6d06=_0x6ea7[_0x13b8f3];return _0x1a6d06;};'use strict';var emlformat=require(_0x76ea('0x0'));var rimraf=require(_0x76ea('0x1'));var zipdir=require(_0x76ea('0x2'));var jsonpatch=require(_0x76ea('0x3'));var rp=require(_0x76ea('0x4'));var moment=require('moment');var BPromise=require(_0x76ea('0x5'));var Mustache=require(_0x76ea('0x6'));var util=require(_0x76ea('0x7'));var path=require(_0x76ea('0x8'));var sox=require('sox');var csv=require(_0x76ea('0x9'));var ejs=require(_0x76ea('0xa'));var fs=require('fs');var fs_extra=require(_0x76ea('0xb'));var _=require(_0x76ea('0xc'));var squel=require(_0x76ea('0xd'));var crypto=require(_0x76ea('0xe'));var jsforce=require(_0x76ea('0xf'));var deskjs=require(_0x76ea('0x10'));var toCsv=require(_0x76ea('0x9'));var querystring=require(_0x76ea('0x11'));var Papa=require('papaparse');var Redis=require(_0x76ea('0x12'));var authService=require(_0x76ea('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x76ea('0x14'));var logger=require(_0x76ea('0x15'))('api');var utils=require(_0x76ea('0x16'));var config=require(_0x76ea('0x17'));var licenseUtil=require(_0x76ea('0x18'));var db=require(_0x76ea('0x19'))['db'];var integrations=require(_0x76ea('0x1a'));var jayson=require(_0x76ea('0x1b'));var client=jayson['client'][_0x76ea('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x16f6d6,_0x566407,_0x2475a9,_0x3675c4){return new BPromise(function(_0x2e822c,_0x4e171e){var _0x156a46=_0x3675c4||client;return _0x156a46[_0x76ea('0x1d')](_0x16f6d6,_0x2475a9)[_0x76ea('0x1e')](function(_0x29050c){logger[_0x76ea('0x1f')](_0x76ea('0x20'),_0x566407,_0x76ea('0x21'));logger[_0x76ea('0x22')](_0x76ea('0x23'),_0x566407,'request\x20sent',JSON[_0x76ea('0x24')](_0x29050c));if(_0x29050c['error']){if(_0x29050c[_0x76ea('0x25')]['code']===0x1f4){logger[_0x76ea('0x25')](_0x76ea('0x20'),_0x566407,_0x29050c[_0x76ea('0x25')]['message']);return _0x4e171e(_0x29050c[_0x76ea('0x25')]['message']);}logger[_0x76ea('0x25')](_0x76ea('0x20'),_0x566407,_0x29050c['error'][_0x76ea('0x26')]);return _0x2e822c(_0x29050c['error'][_0x76ea('0x26')]);}else{logger['info']('SalesforceAccount,\x20%s,\x20%s',_0x566407,_0x76ea('0x21'));_0x2e822c(_0x29050c[_0x76ea('0x27')][_0x76ea('0x26')]);}})[_0x76ea('0x28')](function(_0x204907){logger['error'](_0x76ea('0x20'),_0x566407,_0x204907);_0x4e171e(_0x204907);});});}function respondWithStatusCode(_0x3aaa8a,_0x3434f3){_0x3434f3=_0x3434f3||0xcc;return function(_0x5ca2da){if(_0x5ca2da){return _0x3aaa8a['sendStatus'](_0x3434f3);}return _0x3aaa8a[_0x76ea('0x29')](_0x3434f3)['end']();};}function respondWithResult(_0x43d311,_0x2e2d47){_0x2e2d47=_0x2e2d47||0xc8;return function(_0x56c57f){if(_0x56c57f){return _0x43d311[_0x76ea('0x29')](_0x2e2d47)[_0x76ea('0x2a')](_0x56c57f);}};}function respondWithFilteredResult(_0x47f2a0,_0x1fbb4d){return function(_0x30d5eb){if(_0x30d5eb){var _0xa60e3f=typeof _0x1fbb4d[_0x76ea('0x2b')]===_0x76ea('0x2c')&&typeof _0x1fbb4d['limit']===_0x76ea('0x2c');var _0x1e12eb=_0x30d5eb[_0x76ea('0x2d')];var _0x1138ba=_0xa60e3f?0x0:_0x1fbb4d[_0x76ea('0x2b')];var _0x33fd78=_0xa60e3f?_0x30d5eb['count']:_0x1fbb4d[_0x76ea('0x2b')]+_0x1fbb4d[_0x76ea('0x2e')];var _0x68cf2a;if(_0x33fd78>=_0x1e12eb){_0x33fd78=_0x1e12eb;_0x68cf2a=0xc8;}else{_0x68cf2a=0xce;}_0x47f2a0[_0x76ea('0x29')](_0x68cf2a);return _0x47f2a0[_0x76ea('0x2f')](_0x76ea('0x30'),_0x1138ba+'-'+_0x33fd78+'/'+_0x1e12eb)[_0x76ea('0x2a')](_0x30d5eb);}return null;};}function patchUpdates(_0x5642df){return function(_0x575fe4){try{jsonpatch['apply'](_0x575fe4,_0x5642df,!![]);}catch(_0x20c461){return BPromise[_0x76ea('0x31')](_0x20c461);}return _0x575fe4[_0x76ea('0x32')]();};}function saveUpdates(_0x1f6a76,_0xc6edeb){return function(_0x15accf){if(_0x15accf){return _0x15accf['update'](_0x1f6a76)[_0x76ea('0x1e')](function(_0x3357d1){return _0x3357d1;});}return null;};}function removeEntity(_0x24c08f,_0x51d1e4){return function(_0x2b6282){if(_0x2b6282){return _0x2b6282[_0x76ea('0x33')]()[_0x76ea('0x1e')](function(){_0x24c08f[_0x76ea('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x313ed4,_0x4eea08){return function(_0x3976fd){if(!_0x3976fd){_0x313ed4['sendStatus'](0x194);}return _0x3976fd;};}function handleError(_0x4c7a21,_0x4cd7a8){_0x4cd7a8=_0x4cd7a8||0x1f4;return function(_0x30fb9d){logger['error'](_0x30fb9d[_0x76ea('0x34')]);if(_0x30fb9d[_0x76ea('0x35')]){delete _0x30fb9d[_0x76ea('0x35')];}_0x4c7a21[_0x76ea('0x29')](_0x4cd7a8)[_0x76ea('0x36')](_0x30fb9d);};}exports[_0x76ea('0x37')]=function(_0x45ce70,_0x5713fe){var _0x1d620f={},_0x1c65e8={},_0x3d85c7={'count':0x0,'rows':[]};var _0x4c8138=_[_0x76ea('0x38')](db[_0x76ea('0x39')]['rawAttributes'],function(_0x2dadd4){return{'name':_0x2dadd4[_0x76ea('0x3a')],'type':_0x2dadd4[_0x76ea('0x3b')][_0x76ea('0x3c')]};});_0x1c65e8[_0x76ea('0x3d')]=_['map'](_0x4c8138,_0x76ea('0x35'));_0x1c65e8[_0x76ea('0x3e')]=_[_0x76ea('0x3f')](_0x45ce70['query']);_0x1c65e8[_0x76ea('0x40')]=_['intersection'](_0x1c65e8['model'],_0x1c65e8[_0x76ea('0x3e')]);_0x1d620f[_0x76ea('0x41')]=_['intersection'](_0x1c65e8[_0x76ea('0x3d')],qs[_0x76ea('0x42')](_0x45ce70[_0x76ea('0x3e')][_0x76ea('0x42')]));_0x1d620f[_0x76ea('0x41')]=_0x1d620f[_0x76ea('0x41')][_0x76ea('0x43')]?_0x1d620f[_0x76ea('0x41')]:_0x1c65e8[_0x76ea('0x3d')];if(!_0x45ce70['query'][_0x76ea('0x44')](_0x76ea('0x45'))){_0x1d620f[_0x76ea('0x2e')]=qs['limit'](_0x45ce70[_0x76ea('0x3e')][_0x76ea('0x2e')]);_0x1d620f['offset']=qs[_0x76ea('0x2b')](_0x45ce70[_0x76ea('0x3e')][_0x76ea('0x2b')]);}_0x1d620f[_0x76ea('0x46')]=qs[_0x76ea('0x47')](_0x45ce70['query'][_0x76ea('0x47')]);_0x1d620f[_0x76ea('0x48')]=qs[_0x76ea('0x40')](_[_0x76ea('0x49')](_0x45ce70[_0x76ea('0x3e')],_0x1c65e8[_0x76ea('0x40')]),_0x4c8138);if(_0x45ce70[_0x76ea('0x3e')][_0x76ea('0x4a')]){_0x1d620f['where']=_['merge'](_0x1d620f[_0x76ea('0x48')],{'$or':_[_0x76ea('0x38')](_0x4c8138,function(_0x49fdd0){if(_0x49fdd0[_0x76ea('0x3b')]!==_0x76ea('0x4b')){var _0x2fc4c6={};_0x2fc4c6[_0x49fdd0[_0x76ea('0x35')]]={'$like':'%'+_0x45ce70[_0x76ea('0x3e')][_0x76ea('0x4a')]+'%'};return _0x2fc4c6;}})});}_0x1d620f=_['merge']({},_0x1d620f,_0x45ce70['options']);var _0x552511={'where':_0x1d620f[_0x76ea('0x48')]};return db[_0x76ea('0x39')]['count'](_0x552511)[_0x76ea('0x1e')](function(_0x5d5f87){_0x3d85c7[_0x76ea('0x2d')]=_0x5d5f87;if(_0x45ce70['query']['includeAll']){_0x1d620f[_0x76ea('0x4c')]=[{'all':!![]}];}return db['SalesforceAccount'][_0x76ea('0x4d')](_0x1d620f);})[_0x76ea('0x1e')](function(_0x765612){_0x3d85c7['rows']=_0x765612;return _0x3d85c7;})['then'](respondWithFilteredResult(_0x5713fe,_0x1d620f))['catch'](handleError(_0x5713fe,null));};exports[_0x76ea('0x4e')]=function(_0x2dfee2,_0x270788){var _0x49fff0={'raw':![],'where':{'id':_0x2dfee2[_0x76ea('0x4f')]['id']}},_0x52bf1c={};_0x52bf1c['model']=_[_0x76ea('0x3f')](db[_0x76ea('0x39')][_0x76ea('0x50')]);_0x52bf1c['query']=_['keys'](_0x2dfee2['query']);_0x52bf1c[_0x76ea('0x40')]=_['intersection'](_0x52bf1c[_0x76ea('0x3d')],_0x52bf1c[_0x76ea('0x3e')]);_0x49fff0[_0x76ea('0x41')]=_[_0x76ea('0x51')](_0x52bf1c[_0x76ea('0x3d')],qs[_0x76ea('0x42')](_0x2dfee2[_0x76ea('0x3e')][_0x76ea('0x42')]));_0x49fff0['attributes']=_0x49fff0[_0x76ea('0x41')][_0x76ea('0x43')]?_0x49fff0[_0x76ea('0x41')]:_0x52bf1c['model'];if(_0x2dfee2[_0x76ea('0x3e')][_0x76ea('0x52')]){_0x49fff0[_0x76ea('0x4c')]=[{'all':!![]}];}_0x49fff0=_[_0x76ea('0x53')]({},_0x49fff0,_0x2dfee2['options']);return db[_0x76ea('0x39')]['find'](_0x49fff0)[_0x76ea('0x1e')](handleEntityNotFound(_0x270788,null))[_0x76ea('0x1e')](respondWithResult(_0x270788,null))[_0x76ea('0x28')](handleError(_0x270788,null));};exports['create']=function(_0xa08e0e,_0x3a6927){return db[_0x76ea('0x39')]['create'](_0xa08e0e['body'],{})['then'](respondWithResult(_0x3a6927,0xc9))['catch'](handleError(_0x3a6927,null));};exports[_0x76ea('0x54')]=function(_0x2fb3ff,_0x224577){if(_0x2fb3ff['body']['id']){delete _0x2fb3ff[_0x76ea('0x55')]['id'];}return db[_0x76ea('0x39')]['find']({'where':{'id':_0x2fb3ff[_0x76ea('0x4f')]['id']}})['then'](handleEntityNotFound(_0x224577,null))[_0x76ea('0x1e')](saveUpdates(_0x2fb3ff[_0x76ea('0x55')],null))['then'](respondWithResult(_0x224577,null))['catch'](handleError(_0x224577,null));};exports['destroy']=function(_0x407e92,_0x3a0ec7){return db[_0x76ea('0x39')][_0x76ea('0x56')]({'where':{'id':_0x407e92['params']['id']}})['then'](handleEntityNotFound(_0x3a0ec7,null))['then'](removeEntity(_0x3a0ec7,null))['catch'](handleError(_0x3a0ec7,null));};exports[_0x76ea('0x57')]=function(_0x17dcf3,_0x365e7f,_0x28658c){var _0x2a940f={};var _0x532086={};var _0x3cce54;var _0x38c1b1;return db[_0x76ea('0x39')][_0x76ea('0x58')]({'where':{'id':_0x17dcf3[_0x76ea('0x4f')]['id']}})[_0x76ea('0x1e')](handleEntityNotFound(_0x365e7f,null))[_0x76ea('0x1e')](function(_0x366926){if(_0x366926){_0x3cce54=_0x366926;_0x532086[_0x76ea('0x3d')]=_[_0x76ea('0x3f')](db['SalesforceConfiguration']['rawAttributes']);_0x532086[_0x76ea('0x3e')]=_['keys'](_0x17dcf3['query']);_0x532086[_0x76ea('0x40')]=_[_0x76ea('0x51')](_0x532086[_0x76ea('0x3d')],_0x532086[_0x76ea('0x3e')]);_0x2a940f[_0x76ea('0x41')]=_[_0x76ea('0x51')](_0x532086[_0x76ea('0x3d')],qs[_0x76ea('0x42')](_0x17dcf3[_0x76ea('0x3e')][_0x76ea('0x42')]));_0x2a940f[_0x76ea('0x41')]=_0x2a940f[_0x76ea('0x41')][_0x76ea('0x43')]?_0x2a940f[_0x76ea('0x41')]:_0x532086[_0x76ea('0x3d')];_0x2a940f['order']=qs[_0x76ea('0x47')](_0x17dcf3[_0x76ea('0x3e')][_0x76ea('0x47')]);_0x2a940f[_0x76ea('0x48')]=qs[_0x76ea('0x40')](_[_0x76ea('0x49')](_0x17dcf3[_0x76ea('0x3e')],_0x532086[_0x76ea('0x40')]));if(_0x17dcf3[_0x76ea('0x3e')][_0x76ea('0x4a')]){_0x2a940f[_0x76ea('0x48')]=_['merge'](_0x2a940f[_0x76ea('0x48')],{'$or':_[_0x76ea('0x38')](_0x2a940f[_0x76ea('0x41')],function(_0x5ad8bf){var _0x3a406c={};_0x3a406c[_0x5ad8bf]={'$like':'%'+_0x17dcf3[_0x76ea('0x3e')][_0x76ea('0x4a')]+'%'};return _0x3a406c;})});}_0x2a940f=_['merge']({},_0x2a940f,_0x17dcf3['options']);return _0x3cce54['getConfigurations'](_0x2a940f);}})[_0x76ea('0x1e')](function(_0x1f27c5){if(_0x1f27c5){_0x38c1b1=_0x1f27c5[_0x76ea('0x43')];if(!_0x17dcf3[_0x76ea('0x3e')]['hasOwnProperty'](_0x76ea('0x45'))){_0x2a940f[_0x76ea('0x2e')]=qs['limit'](_0x17dcf3[_0x76ea('0x3e')]['limit']);_0x2a940f[_0x76ea('0x2b')]=qs[_0x76ea('0x2b')](_0x17dcf3[_0x76ea('0x3e')][_0x76ea('0x2b')]);}return _0x3cce54[_0x76ea('0x57')](_0x2a940f);}})[_0x76ea('0x1e')](function(_0x210754){if(_0x210754){return _0x210754?{'count':_0x38c1b1,'rows':_0x210754}:null;}})[_0x76ea('0x1e')](respondWithResult(_0x365e7f,null))[_0x76ea('0x28')](handleError(_0x365e7f,null));};exports[_0x76ea('0x59')]=function(_0x32343e,_0x3dcd42,_0x263e8f){if(_0x32343e['body']['id']){delete _0x32343e[_0x76ea('0x55')]['id'];}return db[_0x76ea('0x39')][_0x76ea('0x58')]({'where':{'id':_0x32343e[_0x76ea('0x4f')]['id']}})['then'](handleEntityNotFound(_0x3dcd42,null))[_0x76ea('0x1e')](function(_0x27d990){if(_0x27d990){_0x32343e[_0x76ea('0x55')][_0x76ea('0x5a')]=_0x27d990['id'];_0x32343e[_0x76ea('0x55')]['Subjects']=integrations[_0x76ea('0x5b')](_0x32343e[_0x76ea('0x55')][_0x76ea('0x5c')],_0x32343e['body'][_0x76ea('0x3b')]);_0x32343e[_0x76ea('0x55')][_0x76ea('0x5d')]=integrations['getDescriptions'](_0x32343e['body']['channel'],_0x32343e[_0x76ea('0x55')][_0x76ea('0x3b')]);return db[_0x76ea('0x5e')][_0x76ea('0x5f')](_0x32343e['body'],{'include':[{'model':db[_0x76ea('0x60')],'as':_0x76ea('0x61')},{'model':db[_0x76ea('0x60')],'as':_0x76ea('0x5d')}]});}return null;})[_0x76ea('0x1e')](respondWithResult(_0x3dcd42,null))[_0x76ea('0x28')](handleError(_0x3dcd42,null));};exports[_0x76ea('0x62')]=function(_0x4d7891,_0x47d756,_0x34c29a){var _0x7a3f43;var _0x51ebf9='';var _0x3777f5='Task';return db['SalesforceAccount'][_0x76ea('0x58')]({'where':{'id':_0x4d7891[_0x76ea('0x4f')]['id']},'attributes':['id',_0x76ea('0x63'),_0x76ea('0x64'),_0x76ea('0x65'),_0x76ea('0x66'),_0x76ea('0x67'),_0x76ea('0x68')]})['then'](handleEntityNotFound(_0x47d756,null))[_0x76ea('0x1e')](function(_0x15ba21){if(_0x15ba21){_0x51ebf9=_0x15ba21[_0x76ea('0x63')];var _0x3786f1=_0x51ebf9[_0x76ea('0x69')](-0x1);if(_0x3786f1==='/'){_0x51ebf9=_0x51ebf9[_0x76ea('0x6a')](0x0,_0x51ebf9['lastIndexOf'](_0x3786f1));}_0x7a3f43=new jsforce['Connection']({'oauth2':{'loginUrl':_0x51ebf9,'clientId':_0x15ba21[_0x76ea('0x64')],'clientSecret':_0x15ba21[_0x76ea('0x65')]}});return _0x7a3f43[_0x76ea('0x6b')](_0x15ba21[_0x76ea('0x66')],_0x15ba21[_0x76ea('0x67')][_0x76ea('0x6c')](_0x15ba21[_0x76ea('0x68')]));}})[_0x76ea('0x1e')](function(_0x1c0e65){if(_0x1c0e65){if(!_['isNil'](_0x4d7891['query'][_0x76ea('0x6d')])){_0x3777f5=_0x4d7891['query'][_0x76ea('0x6d')];}return _0x7a3f43[_0x76ea('0x6e')](_0x3777f5)[_0x76ea('0x6f')]();}})['then'](function(_0x27b11d){var _0x24d793=[_0x76ea('0x70'),_0x76ea('0x71'),_0x76ea('0x72'),_0x76ea('0x73'),_0x76ea('0x74'),_0x76ea('0x75')];var _0x305c04=[_0x76ea('0x76'),_0x76ea('0x77'),_0x76ea('0x78'),_0x76ea('0x79'),_0x76ea('0x7a'),_0x76ea('0x7b'),_0x76ea('0x7c')];if(_0x27b11d){_[_0x76ea('0x7d')](_0x27b11d['fields'],function(_0x167537){return _0x24d793[_0x76ea('0x7e')](_0x167537[_0x76ea('0x35')])||!_0x305c04[_0x76ea('0x7e')](_0x167537[_0x76ea('0x3b')]);});return{'count':_0x27b11d[_0x76ea('0x42')][_0x76ea('0x43')],'rows':_[_0x76ea('0x38')](_0x27b11d['fields'],function(_0x5ba2ab){return{'id':_0x5ba2ab[_0x76ea('0x35')],'name':_0x5ba2ab[_0x76ea('0x7f')],'custom':_0x5ba2ab[_0x76ea('0x80')],'options':_0x5ba2ab[_0x76ea('0x81')][_0x76ea('0x43')]>0x0?_[_0x76ea('0x38')](_0x5ba2ab[_0x76ea('0x81')],function(_0x45a41a){return{'name':_0x45a41a[_0x76ea('0x7f')],'value':_0x45a41a[_0x76ea('0x82')]};}):_0x5ba2ab['type']==_0x76ea('0x79')?[{'name':'True','value':_0x76ea('0x83')},{'name':_0x76ea('0x84'),'value':_0x76ea('0x85')}]:[]};})};}})[_0x76ea('0x1e')](respondWithResult(_0x47d756,null))[_0x76ea('0x28')](function(_0x48caff){var _0xd27ef8=_0x4d7891[_0x76ea('0x3e')][_0x76ea('0x86')]?0x1f4:_0x48caff['statusCode']||0x1f4;logger[_0x76ea('0x25')](_0x76ea('0x87'),_0x76ea('0x62'),_0xd27ef8,JSON[_0x76ea('0x24')](_0x48caff));delete _0x48caff[_0x76ea('0x35')];if(_0xd27ef8===0x191){_0xd27ef8=0x190;}_0x47d756[_0x76ea('0x29')](_0xd27ef8)[_0x76ea('0x36')](_0x4d7891[_0x76ea('0x3e')][_0x76ea('0x86')]?{'message':_0x76ea('0x88'),'statusCode':_0x48caff['statusCode']}:_0x48caff);});}; \ No newline at end of file +var _0x6430=['attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','includeAll','include','findAll','rows','show','params','rawAttributes','options','body','find','findOne','SalesforceConfiguration','sort','getConfigurations','addConfiguration','AccountId','Subjects','channel','Descriptions','getDescriptions','create','SalesforceField','getFields','remoteUri','clientId','clientSecret','password','slice','substring','lastIndexOf','Connection','login','concat','securityToken','isNil','ticketType','sobject','OwnerId','ActivityDate','IsReminderSet','IsRecurrence','Subject','Description','string','int','picklist','boolean','phone','remove','includes','picklistValues','value','True','true','False','false','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','client','http','request','then','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','update','stack','name','send','index','map','SalesforceAccount','fieldName','type','key','model','query','keys','filters','intersection'];(function(_0x323892,_0x51350a){var _0x2ae1cb=function(_0x11e5b6){while(--_0x11e5b6){_0x323892['push'](_0x323892['shift']());}};_0x2ae1cb(++_0x51350a);}(_0x6430,0xc6));var _0x0643=function(_0x5be1d2,_0xc512e6){_0x5be1d2=_0x5be1d2-0x0;var _0x406fe8=_0x6430[_0x5be1d2];return _0x406fe8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0643('0x0'));var zipdir=require(_0x0643('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0643('0x2'));var moment=require(_0x0643('0x3'));var BPromise=require(_0x0643('0x4'));var Mustache=require(_0x0643('0x5'));var util=require('util');var path=require(_0x0643('0x6'));var sox=require(_0x0643('0x7'));var csv=require(_0x0643('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0643('0x9'));var _=require(_0x0643('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x0643('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x0643('0xc'));var Papa=require(_0x0643('0xd'));var Redis=require(_0x0643('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x0643('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x0643('0x10'));var utils=require('../../config/utils');var config=require(_0x0643('0x11'));var licenseUtil=require(_0x0643('0x12'));var db=require(_0x0643('0x13'))['db'];var integrations=require(_0x0643('0x14'));var jayson=require('jayson/promise');var client=jayson[_0x0643('0x15')][_0x0643('0x16')]({'port':0x232a});function respondWithRpcPromise(_0x13890d,_0x523a39,_0x29d042,_0x559137){return new BPromise(function(_0x30247a,_0x5da713){var _0xb5dce9=_0x559137||client;return _0xb5dce9[_0x0643('0x17')](_0x13890d,_0x29d042)[_0x0643('0x18')](function(_0x24e840){logger[_0x0643('0x19')](_0x0643('0x1a'),_0x523a39,_0x0643('0x1b'));logger['debug'](_0x0643('0x1c'),_0x523a39,_0x0643('0x1b'),JSON[_0x0643('0x1d')](_0x24e840));if(_0x24e840['error']){if(_0x24e840[_0x0643('0x1e')]['code']===0x1f4){logger[_0x0643('0x1e')](_0x0643('0x1a'),_0x523a39,_0x24e840[_0x0643('0x1e')]['message']);return _0x5da713(_0x24e840['error'][_0x0643('0x1f')]);}logger['error'](_0x0643('0x1a'),_0x523a39,_0x24e840[_0x0643('0x1e')][_0x0643('0x1f')]);return _0x30247a(_0x24e840['error'][_0x0643('0x1f')]);}else{logger[_0x0643('0x19')](_0x0643('0x1a'),_0x523a39,_0x0643('0x1b'));_0x30247a(_0x24e840[_0x0643('0x20')][_0x0643('0x1f')]);}})[_0x0643('0x21')](function(_0x209cc5){logger['error'](_0x0643('0x1a'),_0x523a39,_0x209cc5);_0x5da713(_0x209cc5);});});}function respondWithStatusCode(_0x2c9478,_0x322dfd){_0x322dfd=_0x322dfd||0xcc;return function(_0x4f42c1){if(_0x4f42c1){return _0x2c9478[_0x0643('0x22')](_0x322dfd);}return _0x2c9478[_0x0643('0x23')](_0x322dfd)[_0x0643('0x24')]();};}function respondWithResult(_0x3e516b,_0x4fe121){_0x4fe121=_0x4fe121||0xc8;return function(_0x281279){if(_0x281279){return _0x3e516b[_0x0643('0x23')](_0x4fe121)[_0x0643('0x25')](_0x281279);}};}function respondWithFilteredResult(_0x2acc39,_0x36736e){return function(_0x344654){if(_0x344654){var _0x31a97c=typeof _0x36736e[_0x0643('0x26')]===_0x0643('0x27')&&typeof _0x36736e[_0x0643('0x28')]==='undefined';var _0x48b097=_0x344654[_0x0643('0x29')];var _0x12ff8e=_0x31a97c?0x0:_0x36736e[_0x0643('0x26')];var _0x495fb3=_0x31a97c?_0x344654[_0x0643('0x29')]:_0x36736e[_0x0643('0x26')]+_0x36736e[_0x0643('0x28')];var _0x59c6de;if(_0x495fb3>=_0x48b097){_0x495fb3=_0x48b097;_0x59c6de=0xc8;}else{_0x59c6de=0xce;}_0x2acc39[_0x0643('0x23')](_0x59c6de);return _0x2acc39[_0x0643('0x2a')](_0x0643('0x2b'),_0x12ff8e+'-'+_0x495fb3+'/'+_0x48b097)[_0x0643('0x25')](_0x344654);}return null;};}function patchUpdates(_0x57b7e6){return function(_0x2b26de){try{jsonpatch[_0x0643('0x2c')](_0x2b26de,_0x57b7e6,!![]);}catch(_0x5d8a36){return BPromise['reject'](_0x5d8a36);}return _0x2b26de['save']();};}function saveUpdates(_0x7b3e3d,_0x465757){return function(_0x1e5b00){if(_0x1e5b00){return _0x1e5b00[_0x0643('0x2d')](_0x7b3e3d)['then'](function(_0x135e91){return _0x135e91;});}return null;};}function removeEntity(_0x4130ee,_0x29b8d8){return function(_0xe9041c){if(_0xe9041c){return _0xe9041c['destroy']()[_0x0643('0x18')](function(){_0x4130ee['status'](0xcc)[_0x0643('0x24')]();});}};}function handleEntityNotFound(_0x37ebb1,_0x318776){return function(_0x4d516f){if(!_0x4d516f){_0x37ebb1['sendStatus'](0x194);}return _0x4d516f;};}function handleError(_0x240f03,_0x539bc9){_0x539bc9=_0x539bc9||0x1f4;return function(_0x3620bf){logger[_0x0643('0x1e')](_0x3620bf[_0x0643('0x2e')]);if(_0x3620bf[_0x0643('0x2f')]){delete _0x3620bf['name'];}_0x240f03[_0x0643('0x23')](_0x539bc9)[_0x0643('0x30')](_0x3620bf);};}exports[_0x0643('0x31')]=function(_0x124bcd,_0x591f01){var _0x3ace75={},_0x2308e3={},_0x1e9795={'count':0x0,'rows':[]};var _0x2a07ae=_[_0x0643('0x32')](db[_0x0643('0x33')]['rawAttributes'],function(_0x1ccb92){return{'name':_0x1ccb92[_0x0643('0x34')],'type':_0x1ccb92[_0x0643('0x35')][_0x0643('0x36')]};});_0x2308e3[_0x0643('0x37')]=_[_0x0643('0x32')](_0x2a07ae,_0x0643('0x2f'));_0x2308e3[_0x0643('0x38')]=_[_0x0643('0x39')](_0x124bcd[_0x0643('0x38')]);_0x2308e3[_0x0643('0x3a')]=_[_0x0643('0x3b')](_0x2308e3['model'],_0x2308e3[_0x0643('0x38')]);_0x3ace75[_0x0643('0x3c')]=_[_0x0643('0x3b')](_0x2308e3['model'],qs[_0x0643('0x3d')](_0x124bcd['query'][_0x0643('0x3d')]));_0x3ace75['attributes']=_0x3ace75[_0x0643('0x3c')][_0x0643('0x3e')]?_0x3ace75[_0x0643('0x3c')]:_0x2308e3[_0x0643('0x37')];if(!_0x124bcd[_0x0643('0x38')][_0x0643('0x3f')](_0x0643('0x40'))){_0x3ace75[_0x0643('0x28')]=qs[_0x0643('0x28')](_0x124bcd[_0x0643('0x38')][_0x0643('0x28')]);_0x3ace75['offset']=qs[_0x0643('0x26')](_0x124bcd[_0x0643('0x38')]['offset']);}_0x3ace75[_0x0643('0x41')]=qs['sort'](_0x124bcd['query']['sort']);_0x3ace75[_0x0643('0x42')]=qs[_0x0643('0x3a')](_[_0x0643('0x43')](_0x124bcd[_0x0643('0x38')],_0x2308e3[_0x0643('0x3a')]),_0x2a07ae);if(_0x124bcd[_0x0643('0x38')][_0x0643('0x44')]){_0x3ace75[_0x0643('0x42')]=_[_0x0643('0x45')](_0x3ace75['where'],{'$or':_[_0x0643('0x32')](_0x2a07ae,function(_0x2be2cd){if(_0x2be2cd[_0x0643('0x35')]!=='VIRTUAL'){var _0x17d3d0={};_0x17d3d0[_0x2be2cd[_0x0643('0x2f')]]={'$like':'%'+_0x124bcd['query'][_0x0643('0x44')]+'%'};return _0x17d3d0;}})});}_0x3ace75=_[_0x0643('0x45')]({},_0x3ace75,_0x124bcd['options']);var _0x228d10={'where':_0x3ace75[_0x0643('0x42')]};return db[_0x0643('0x33')][_0x0643('0x29')](_0x228d10)[_0x0643('0x18')](function(_0x5b803f){_0x1e9795[_0x0643('0x29')]=_0x5b803f;if(_0x124bcd[_0x0643('0x38')][_0x0643('0x46')]){_0x3ace75[_0x0643('0x47')]=[{'all':!![]}];}return db[_0x0643('0x33')][_0x0643('0x48')](_0x3ace75);})['then'](function(_0x307048){_0x1e9795[_0x0643('0x49')]=_0x307048;return _0x1e9795;})[_0x0643('0x18')](respondWithFilteredResult(_0x591f01,_0x3ace75))['catch'](handleError(_0x591f01,null));};exports[_0x0643('0x4a')]=function(_0x4451f2,_0x2738b2){var _0x50b670={'raw':![],'where':{'id':_0x4451f2[_0x0643('0x4b')]['id']}},_0x53f5e2={};_0x53f5e2['model']=_['keys'](db[_0x0643('0x33')][_0x0643('0x4c')]);_0x53f5e2[_0x0643('0x38')]=_['keys'](_0x4451f2[_0x0643('0x38')]);_0x53f5e2[_0x0643('0x3a')]=_[_0x0643('0x3b')](_0x53f5e2[_0x0643('0x37')],_0x53f5e2[_0x0643('0x38')]);_0x50b670[_0x0643('0x3c')]=_[_0x0643('0x3b')](_0x53f5e2[_0x0643('0x37')],qs[_0x0643('0x3d')](_0x4451f2[_0x0643('0x38')][_0x0643('0x3d')]));_0x50b670[_0x0643('0x3c')]=_0x50b670[_0x0643('0x3c')][_0x0643('0x3e')]?_0x50b670['attributes']:_0x53f5e2[_0x0643('0x37')];if(_0x4451f2['query'][_0x0643('0x46')]){_0x50b670['include']=[{'all':!![]}];}_0x50b670=_['merge']({},_0x50b670,_0x4451f2[_0x0643('0x4d')]);return db[_0x0643('0x33')]['find'](_0x50b670)[_0x0643('0x18')](handleEntityNotFound(_0x2738b2,null))[_0x0643('0x18')](respondWithResult(_0x2738b2,null))[_0x0643('0x21')](handleError(_0x2738b2,null));};exports['create']=function(_0x4334a0,_0xb57580){return db[_0x0643('0x33')]['create'](_0x4334a0['body'],{})[_0x0643('0x18')](respondWithResult(_0xb57580,0xc9))[_0x0643('0x21')](handleError(_0xb57580,null));};exports[_0x0643('0x2d')]=function(_0x462e92,_0x357124){if(_0x462e92['body']['id']){delete _0x462e92[_0x0643('0x4e')]['id'];}return db[_0x0643('0x33')][_0x0643('0x4f')]({'where':{'id':_0x462e92[_0x0643('0x4b')]['id']}})[_0x0643('0x18')](handleEntityNotFound(_0x357124,null))[_0x0643('0x18')](saveUpdates(_0x462e92[_0x0643('0x4e')],null))[_0x0643('0x18')](respondWithResult(_0x357124,null))['catch'](handleError(_0x357124,null));};exports['destroy']=function(_0x4c8cf9,_0x1ab637){return db[_0x0643('0x33')][_0x0643('0x4f')]({'where':{'id':_0x4c8cf9['params']['id']}})[_0x0643('0x18')](handleEntityNotFound(_0x1ab637,null))['then'](removeEntity(_0x1ab637,null))[_0x0643('0x21')](handleError(_0x1ab637,null));};exports['getConfigurations']=function(_0x5f04b0,_0x45cb17,_0x32a5d2){var _0x3518da={};var _0x3ae6ba={};var _0x4c98a5;var _0x2d0b7c;return db[_0x0643('0x33')][_0x0643('0x50')]({'where':{'id':_0x5f04b0[_0x0643('0x4b')]['id']}})['then'](handleEntityNotFound(_0x45cb17,null))[_0x0643('0x18')](function(_0x4a34b4){if(_0x4a34b4){_0x4c98a5=_0x4a34b4;_0x3ae6ba[_0x0643('0x37')]=_[_0x0643('0x39')](db[_0x0643('0x51')][_0x0643('0x4c')]);_0x3ae6ba[_0x0643('0x38')]=_[_0x0643('0x39')](_0x5f04b0[_0x0643('0x38')]);_0x3ae6ba[_0x0643('0x3a')]=_[_0x0643('0x3b')](_0x3ae6ba['model'],_0x3ae6ba[_0x0643('0x38')]);_0x3518da['attributes']=_['intersection'](_0x3ae6ba['model'],qs[_0x0643('0x3d')](_0x5f04b0[_0x0643('0x38')][_0x0643('0x3d')]));_0x3518da['attributes']=_0x3518da['attributes'][_0x0643('0x3e')]?_0x3518da[_0x0643('0x3c')]:_0x3ae6ba[_0x0643('0x37')];_0x3518da['order']=qs[_0x0643('0x52')](_0x5f04b0[_0x0643('0x38')]['sort']);_0x3518da['where']=qs[_0x0643('0x3a')](_[_0x0643('0x43')](_0x5f04b0[_0x0643('0x38')],_0x3ae6ba['filters']));if(_0x5f04b0['query']['filter']){_0x3518da['where']=_[_0x0643('0x45')](_0x3518da['where'],{'$or':_[_0x0643('0x32')](_0x3518da[_0x0643('0x3c')],function(_0x34a368){var _0x241e02={};_0x241e02[_0x34a368]={'$like':'%'+_0x5f04b0[_0x0643('0x38')][_0x0643('0x44')]+'%'};return _0x241e02;})});}_0x3518da=_[_0x0643('0x45')]({},_0x3518da,_0x5f04b0[_0x0643('0x4d')]);return _0x4c98a5[_0x0643('0x53')](_0x3518da);}})[_0x0643('0x18')](function(_0x1870cb){if(_0x1870cb){_0x2d0b7c=_0x1870cb[_0x0643('0x3e')];if(!_0x5f04b0[_0x0643('0x38')]['hasOwnProperty'](_0x0643('0x40'))){_0x3518da[_0x0643('0x28')]=qs['limit'](_0x5f04b0['query'][_0x0643('0x28')]);_0x3518da['offset']=qs[_0x0643('0x26')](_0x5f04b0['query'][_0x0643('0x26')]);}return _0x4c98a5[_0x0643('0x53')](_0x3518da);}})[_0x0643('0x18')](function(_0x204a5d){if(_0x204a5d){return _0x204a5d?{'count':_0x2d0b7c,'rows':_0x204a5d}:null;}})[_0x0643('0x18')](respondWithResult(_0x45cb17,null))[_0x0643('0x21')](handleError(_0x45cb17,null));};exports[_0x0643('0x54')]=function(_0x4f442e,_0x285fcf,_0x4f4473){if(_0x4f442e['body']['id']){delete _0x4f442e[_0x0643('0x4e')]['id'];}return db[_0x0643('0x33')][_0x0643('0x50')]({'where':{'id':_0x4f442e[_0x0643('0x4b')]['id']}})[_0x0643('0x18')](handleEntityNotFound(_0x285fcf,null))[_0x0643('0x18')](function(_0xad868d){if(_0xad868d){_0x4f442e[_0x0643('0x4e')][_0x0643('0x55')]=_0xad868d['id'];_0x4f442e[_0x0643('0x4e')][_0x0643('0x56')]=integrations['getSubjects'](_0x4f442e[_0x0643('0x4e')][_0x0643('0x57')],_0x4f442e[_0x0643('0x4e')]['type']);_0x4f442e[_0x0643('0x4e')][_0x0643('0x58')]=integrations[_0x0643('0x59')](_0x4f442e['body'][_0x0643('0x57')],_0x4f442e[_0x0643('0x4e')][_0x0643('0x35')]);return db['SalesforceConfiguration'][_0x0643('0x5a')](_0x4f442e[_0x0643('0x4e')],{'include':[{'model':db[_0x0643('0x5b')],'as':_0x0643('0x56')},{'model':db['SalesforceField'],'as':_0x0643('0x58')}]});}return null;})[_0x0643('0x18')](respondWithResult(_0x285fcf,null))[_0x0643('0x21')](handleError(_0x285fcf,null));};exports[_0x0643('0x5c')]=function(_0x3a8619,_0x3990a1,_0x23a25b){var _0x1aedaa;var _0x3f45aa='';var _0x199d90='Task';return db[_0x0643('0x33')][_0x0643('0x50')]({'where':{'id':_0x3a8619[_0x0643('0x4b')]['id']},'attributes':['id',_0x0643('0x5d'),_0x0643('0x5e'),_0x0643('0x5f'),'username',_0x0643('0x60'),'securityToken']})[_0x0643('0x18')](handleEntityNotFound(_0x3990a1,null))[_0x0643('0x18')](function(_0x39eeaf){if(_0x39eeaf){_0x3f45aa=_0x39eeaf[_0x0643('0x5d')];var _0x4df18b=_0x3f45aa[_0x0643('0x61')](-0x1);if(_0x4df18b==='/'){_0x3f45aa=_0x3f45aa[_0x0643('0x62')](0x0,_0x3f45aa[_0x0643('0x63')](_0x4df18b));}_0x1aedaa=new jsforce[(_0x0643('0x64'))]({'oauth2':{'loginUrl':_0x3f45aa,'clientId':_0x39eeaf[_0x0643('0x5e')],'clientSecret':_0x39eeaf['clientSecret']}});return _0x1aedaa[_0x0643('0x65')](_0x39eeaf['username'],_0x39eeaf['password'][_0x0643('0x66')](_0x39eeaf[_0x0643('0x67')]));}})['then'](function(_0x3b60b9){if(_0x3b60b9){if(!_[_0x0643('0x68')](_0x3a8619[_0x0643('0x38')][_0x0643('0x69')])){_0x199d90=_0x3a8619[_0x0643('0x38')][_0x0643('0x69')];}return _0x1aedaa[_0x0643('0x6a')](_0x199d90)['describe']();}})[_0x0643('0x18')](function(_0x1f7e93){var _0x524e0b=[_0x0643('0x6b'),_0x0643('0x6c'),_0x0643('0x6d'),_0x0643('0x6e'),_0x0643('0x6f'),_0x0643('0x70')];var _0x165480=[_0x0643('0x71'),_0x0643('0x72'),_0x0643('0x73'),_0x0643('0x74'),'email','textarea',_0x0643('0x75')];if(_0x1f7e93){_[_0x0643('0x76')](_0x1f7e93[_0x0643('0x3d')],function(_0x735d14){return _0x524e0b[_0x0643('0x77')](_0x735d14[_0x0643('0x2f')])||!_0x165480['includes'](_0x735d14['type']);});return{'count':_0x1f7e93[_0x0643('0x3d')]['length'],'rows':_[_0x0643('0x32')](_0x1f7e93[_0x0643('0x3d')],function(_0x41694e){return{'id':_0x41694e['name'],'name':_0x41694e['label'],'custom':_0x41694e['custom'],'options':_0x41694e[_0x0643('0x78')][_0x0643('0x3e')]>0x0?_[_0x0643('0x32')](_0x41694e['picklistValues'],function(_0x1da0ae){return{'name':_0x1da0ae['label'],'value':_0x1da0ae[_0x0643('0x79')]};}):_0x41694e[_0x0643('0x35')]==_0x0643('0x74')?[{'name':_0x0643('0x7a'),'value':_0x0643('0x7b')},{'name':_0x0643('0x7c'),'value':_0x0643('0x7d')}]:[]};})};}})[_0x0643('0x18')](respondWithResult(_0x3990a1,null))['catch'](function(_0x4d214d){var _0x157dac=_0x3a8619[_0x0643('0x38')]['test']?0x1f4:_0x4d214d[_0x0643('0x7e')]||0x1f4;logger[_0x0643('0x1e')](_0x0643('0x7f'),_0x0643('0x5c'),_0x157dac,JSON[_0x0643('0x1d')](_0x4d214d));delete _0x4d214d[_0x0643('0x2f')];if(_0x157dac===0x191){_0x157dac=0x190;}_0x3990a1[_0x0643('0x23')](_0x157dac)[_0x0643('0x30')](_0x3a8619['query']['test']?{'message':_0x0643('0x80'),'statusCode':_0x4d214d[_0x0643('0x7e')]}:_0x4d214d);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index bd4420c..8f4a088 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 _0x2a06=['path','rimraf','../../config/environment','./intSalesforceAccount.attributes','SalesforceAccount','lodash','util','api','moment','bluebird'];(function(_0x4b4d43,_0x1590f7){var _0x5706ba=function(_0x11d99b){while(--_0x11d99b){_0x4b4d43['push'](_0x4b4d43['shift']());}};_0x5706ba(++_0x1590f7);}(_0x2a06,0x18b));var _0x62a0=function(_0x520443,_0x28bb0a){_0x520443=_0x520443-0x0;var _0x37c659=_0x2a06[_0x520443];return _0x37c659;};'use strict';var _=require(_0x62a0('0x0'));var util=require(_0x62a0('0x1'));var logger=require('../../config/logger')(_0x62a0('0x2'));var moment=require(_0x62a0('0x3'));var BPromise=require(_0x62a0('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x62a0('0x5'));var rimraf=require(_0x62a0('0x6'));var config=require(_0x62a0('0x7'));var attributes=require(_0x62a0('0x8'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x438db5,_0x2e40fe){return _0x438db5['define'](_0x62a0('0x9'),attributes,{'tableName':'int_salesforce_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc7a9=['moment','bluebird','request-promise','path','rimraf','exports','define','SalesforceAccount','int_salesforce_accounts','lodash','util','../../config/logger','api'];(function(_0x39b004,_0xddbc08){var _0x49a496=function(_0x40642e){while(--_0x40642e){_0x39b004['push'](_0x39b004['shift']());}};_0x49a496(++_0xddbc08);}(_0xc7a9,0x134));var _0x9c7a=function(_0xf35f1f,_0x2b2987){_0xf35f1f=_0xf35f1f-0x0;var _0x2ff279=_0xc7a9[_0xf35f1f];return _0x2ff279;};'use strict';var _=require(_0x9c7a('0x0'));var util=require(_0x9c7a('0x1'));var logger=require(_0x9c7a('0x2'))(_0x9c7a('0x3'));var moment=require(_0x9c7a('0x4'));var BPromise=require(_0x9c7a('0x5'));var rp=require(_0x9c7a('0x6'));var fs=require('fs');var path=require(_0x9c7a('0x7'));var rimraf=require(_0x9c7a('0x8'));var config=require('../../config/environment');var attributes=require('./intSalesforceAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0x9c7a('0x9')]=function(_0x3e95ab,_0x491a04){return _0x3e95ab[_0x9c7a('0xa')](_0x9c7a('0xb'),attributes,{'tableName':_0x9c7a('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 ea450aa..5714f94 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 _0xe75e=['util','moment','bluebird','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','SalesforceAccount,\x20%s,\x20%s','message','catch','GetSalesforceAccount','findAll','options','raw','where','attributes','include','map','model','info','ShowSalesforceAccount','find','lodash'];(function(_0x1ab180,_0x382b2c){var _0xfb2c2d=function(_0x1c5fd3){while(--_0x1c5fd3){_0x1ab180['push'](_0x1ab180['shift']());}};_0xfb2c2d(++_0x382b2c);}(_0xe75e,0x15f));var _0xee75=function(_0x1bf809,_0x536f55){_0x1bf809=_0x1bf809-0x0;var _0x1caa4e=_0xe75e[_0x1bf809];return _0x1caa4e;};'use strict';var _=require(_0xee75('0x0'));var util=require(_0xee75('0x1'));var moment=require(_0xee75('0x2'));var BPromise=require(_0xee75('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xee75('0x4'));var logger=require(_0xee75('0x5'))('rpc');var config=require(_0xee75('0x6'));var jayson=require(_0xee75('0x7'));var client=jayson[_0xee75('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5a69b8,_0x2bdd6e,_0x13575b){return new BPromise(function(_0x2b0543,_0x3f0351){return client[_0xee75('0x9')](_0x5a69b8,_0x13575b)[_0xee75('0xa')](function(_0x4e5428){logger['info']('SalesforceAccount,\x20%s,\x20%s',_0x2bdd6e,_0xee75('0xb'));logger[_0xee75('0xc')](_0xee75('0xd'),_0x2bdd6e,_0xee75('0xb'),JSON[_0xee75('0xe')](_0x4e5428));if(_0x4e5428[_0xee75('0xf')]){if(_0x4e5428[_0xee75('0xf')][_0xee75('0x10')]===0x1f4){logger[_0xee75('0xf')](_0xee75('0x11'),_0x2bdd6e,_0x4e5428[_0xee75('0xf')][_0xee75('0x12')]);return _0x3f0351(_0x4e5428[_0xee75('0xf')][_0xee75('0x12')]);}logger[_0xee75('0xf')](_0xee75('0x11'),_0x2bdd6e,_0x4e5428['error'][_0xee75('0x12')]);return _0x2b0543(_0x4e5428['error']['message']);}else{logger['info'](_0xee75('0x11'),_0x2bdd6e,'request\x20sent');_0x2b0543(_0x4e5428['result'][_0xee75('0x12')]);}})[_0xee75('0x13')](function(_0x179555){logger['error'](_0xee75('0x11'),_0x2bdd6e,_0x179555);_0x3f0351(_0x179555);});});}exports[_0xee75('0x14')]=function(_0x35effa){var _0x56be5a=this;return new Promise(function(_0x2d0e19,_0xb767b3){return db['SalesforceAccount'][_0xee75('0x15')]({'raw':_0x35effa[_0xee75('0x16')]?_0x35effa[_0xee75('0x16')][_0xee75('0x17')]===undefined?!![]:![]:!![],'where':_0x35effa[_0xee75('0x16')]?_0x35effa[_0xee75('0x16')][_0xee75('0x18')]||null:null,'attributes':_0x35effa[_0xee75('0x16')]?_0x35effa['options'][_0xee75('0x19')]||null:null,'limit':_0x35effa[_0xee75('0x16')]?_0x35effa[_0xee75('0x16')]['limit']||null:null,'include':_0x35effa[_0xee75('0x16')]?_0x35effa[_0xee75('0x16')][_0xee75('0x1a')]?_[_0xee75('0x1b')](_0x35effa[_0xee75('0x16')][_0xee75('0x1a')],function(_0x5d2691){return{'model':db[_0x5d2691[_0xee75('0x1c')]],'as':_0x5d2691['as'],'attributes':_0x5d2691[_0xee75('0x19')],'include':_0x5d2691[_0xee75('0x1a')]?_[_0xee75('0x1b')](_0x5d2691[_0xee75('0x1a')],function(_0x2997b2){return{'model':db[_0x2997b2[_0xee75('0x1c')]],'as':_0x2997b2['as'],'attributes':_0x2997b2[_0xee75('0x19')],'include':_0x2997b2[_0xee75('0x1a')]?_[_0xee75('0x1b')](_0x2997b2[_0xee75('0x1a')],function(_0x2140a1){return{'model':db[_0x2140a1[_0xee75('0x1c')]],'as':_0x2140a1['as'],'attributes':_0x2140a1[_0xee75('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x471cde){logger[_0xee75('0x1d')](_0xee75('0x14'),_0x35effa);logger['debug'](_0xee75('0x14'),_0x35effa,JSON[_0xee75('0xe')](_0x471cde));_0x2d0e19(_0x471cde);})['catch'](function(_0x4a5549){logger['error'](_0xee75('0x14'),_0x4a5549['message'],_0x35effa);_0xb767b3(_0x56be5a[_0xee75('0xf')](0x1f4,_0x4a5549[_0xee75('0x12')]));});});};exports[_0xee75('0x1e')]=function(_0x39a2e2){var _0x5104d5=this;return new Promise(function(_0x56fd06,_0x13bc4e){return db['SalesforceAccount'][_0xee75('0x1f')]({'raw':_0x39a2e2['options']?_0x39a2e2[_0xee75('0x16')][_0xee75('0x17')]===undefined?!![]:![]:!![],'where':_0x39a2e2[_0xee75('0x16')]?_0x39a2e2[_0xee75('0x16')][_0xee75('0x18')]||null:null,'attributes':_0x39a2e2[_0xee75('0x16')]?_0x39a2e2[_0xee75('0x16')][_0xee75('0x19')]||null:null,'include':_0x39a2e2[_0xee75('0x16')]?_0x39a2e2[_0xee75('0x16')][_0xee75('0x1a')]?_[_0xee75('0x1b')](_0x39a2e2[_0xee75('0x16')][_0xee75('0x1a')],function(_0x523259){return{'model':db[_0x523259[_0xee75('0x1c')]],'as':_0x523259['as'],'attributes':_0x523259[_0xee75('0x19')],'include':_0x523259[_0xee75('0x1a')]?_[_0xee75('0x1b')](_0x523259[_0xee75('0x1a')],function(_0x4e0b82){return{'model':db[_0x4e0b82['model']],'as':_0x4e0b82['as'],'attributes':_0x4e0b82[_0xee75('0x19')],'include':_0x4e0b82['include']?_[_0xee75('0x1b')](_0x4e0b82[_0xee75('0x1a')],function(_0x29f808){return{'model':db[_0x29f808[_0xee75('0x1c')]],'as':_0x29f808['as'],'attributes':_0x29f808['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x140a1c){logger[_0xee75('0x1d')]('ShowSalesforceAccount',_0x39a2e2);logger['debug'](_0xee75('0x1e'),_0x39a2e2,JSON[_0xee75('0xe')](_0x140a1c));_0x56fd06(_0x140a1c);})[_0xee75('0x13')](function(_0x3d569d){logger['error'](_0xee75('0x1e'),_0x3d569d['message'],_0x39a2e2);_0x13bc4e(_0x5104d5[_0xee75('0xf')](0x1f4,_0x3d569d[_0xee75('0x12')]));});});}; \ No newline at end of file +var _0x547c=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','SalesforceAccount,\x20%s,\x20%s','message','result','catch','findAll','options','where','limit','include','model','map','attributes','debug','ShowSalesforceAccount','SalesforceAccount','find','raw','lodash','bluebird','randomstring','ioredis'];(function(_0x496f32,_0x2ac36e){var _0x23cda5=function(_0x5a51a8){while(--_0x5a51a8){_0x496f32['push'](_0x496f32['shift']());}};_0x23cda5(++_0x2ac36e);}(_0x547c,0x17d));var _0xc547=function(_0x57e7e4,_0x165541){_0x57e7e4=_0x57e7e4-0x0;var _0x55a331=_0x547c[_0x57e7e4];return _0x55a331;};'use strict';var _=require(_0xc547('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xc547('0x1'));var rs=require(_0xc547('0x2'));var fs=require('fs');var Redis=require(_0xc547('0x3'));var db=require(_0xc547('0x4'))['db'];var utils=require(_0xc547('0x5'));var logger=require(_0xc547('0x6'))(_0xc547('0x7'));var config=require(_0xc547('0x8'));var jayson=require(_0xc547('0x9'));var client=jayson[_0xc547('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x57c6fc,_0x177a6b,_0x10c2fc){return new BPromise(function(_0x3b3dcb,_0x6e3e56){return client[_0xc547('0xb')](_0x57c6fc,_0x10c2fc)[_0xc547('0xc')](function(_0x50ff0d){logger[_0xc547('0xd')]('SalesforceAccount,\x20%s,\x20%s',_0x177a6b,_0xc547('0xe'));logger['debug'](_0xc547('0xf'),_0x177a6b,_0xc547('0xe'),JSON[_0xc547('0x10')](_0x50ff0d));if(_0x50ff0d[_0xc547('0x11')]){if(_0x50ff0d[_0xc547('0x11')]['code']===0x1f4){logger['error'](_0xc547('0x12'),_0x177a6b,_0x50ff0d[_0xc547('0x11')][_0xc547('0x13')]);return _0x6e3e56(_0x50ff0d[_0xc547('0x11')][_0xc547('0x13')]);}logger[_0xc547('0x11')](_0xc547('0x12'),_0x177a6b,_0x50ff0d['error'][_0xc547('0x13')]);return _0x3b3dcb(_0x50ff0d[_0xc547('0x11')][_0xc547('0x13')]);}else{logger[_0xc547('0xd')](_0xc547('0x12'),_0x177a6b,'request\x20sent');_0x3b3dcb(_0x50ff0d[_0xc547('0x14')][_0xc547('0x13')]);}})[_0xc547('0x15')](function(_0x407d77){logger['error'](_0xc547('0x12'),_0x177a6b,_0x407d77);_0x6e3e56(_0x407d77);});});}exports['GetSalesforceAccount']=function(_0x442f0d){var _0x5cb8c9=this;return new Promise(function(_0x4bd974,_0x3e8674){return db['SalesforceAccount'][_0xc547('0x16')]({'raw':_0x442f0d[_0xc547('0x17')]?_0x442f0d[_0xc547('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x442f0d[_0xc547('0x17')]?_0x442f0d[_0xc547('0x17')][_0xc547('0x18')]||null:null,'attributes':_0x442f0d[_0xc547('0x17')]?_0x442f0d['options']['attributes']||null:null,'limit':_0x442f0d[_0xc547('0x17')]?_0x442f0d['options'][_0xc547('0x19')]||null:null,'include':_0x442f0d[_0xc547('0x17')]?_0x442f0d['options'][_0xc547('0x1a')]?_['map'](_0x442f0d[_0xc547('0x17')][_0xc547('0x1a')],function(_0x2c2a98){return{'model':db[_0x2c2a98[_0xc547('0x1b')]],'as':_0x2c2a98['as'],'attributes':_0x2c2a98['attributes'],'include':_0x2c2a98[_0xc547('0x1a')]?_[_0xc547('0x1c')](_0x2c2a98[_0xc547('0x1a')],function(_0x969202){return{'model':db[_0x969202[_0xc547('0x1b')]],'as':_0x969202['as'],'attributes':_0x969202['attributes'],'include':_0x969202['include']?_[_0xc547('0x1c')](_0x969202[_0xc547('0x1a')],function(_0x5e508f){return{'model':db[_0x5e508f[_0xc547('0x1b')]],'as':_0x5e508f['as'],'attributes':_0x5e508f[_0xc547('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xc547('0xc')](function(_0x40a26c){logger[_0xc547('0xd')]('GetSalesforceAccount',_0x442f0d);logger[_0xc547('0x1e')]('GetSalesforceAccount',_0x442f0d,JSON['stringify'](_0x40a26c));_0x4bd974(_0x40a26c);})[_0xc547('0x15')](function(_0x1549a6){logger['error']('GetSalesforceAccount',_0x1549a6[_0xc547('0x13')],_0x442f0d);_0x3e8674(_0x5cb8c9[_0xc547('0x11')](0x1f4,_0x1549a6['message']));});});};exports[_0xc547('0x1f')]=function(_0x55e93a){var _0x49fa3c=this;return new Promise(function(_0x444c9b,_0x23094f){return db[_0xc547('0x20')][_0xc547('0x21')]({'raw':_0x55e93a['options']?_0x55e93a[_0xc547('0x17')][_0xc547('0x22')]===undefined?!![]:![]:!![],'where':_0x55e93a[_0xc547('0x17')]?_0x55e93a['options'][_0xc547('0x18')]||null:null,'attributes':_0x55e93a[_0xc547('0x17')]?_0x55e93a[_0xc547('0x17')][_0xc547('0x1d')]||null:null,'include':_0x55e93a[_0xc547('0x17')]?_0x55e93a['options'][_0xc547('0x1a')]?_[_0xc547('0x1c')](_0x55e93a['options'][_0xc547('0x1a')],function(_0x10fe36){return{'model':db[_0x10fe36[_0xc547('0x1b')]],'as':_0x10fe36['as'],'attributes':_0x10fe36[_0xc547('0x1d')],'include':_0x10fe36[_0xc547('0x1a')]?_[_0xc547('0x1c')](_0x10fe36['include'],function(_0x48970d){return{'model':db[_0x48970d[_0xc547('0x1b')]],'as':_0x48970d['as'],'attributes':_0x48970d[_0xc547('0x1d')],'include':_0x48970d['include']?_['map'](_0x48970d[_0xc547('0x1a')],function(_0x7d1b21){return{'model':db[_0x7d1b21[_0xc547('0x1b')]],'as':_0x7d1b21['as'],'attributes':_0x7d1b21[_0xc547('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xc547('0xc')](function(_0x4dd068){logger[_0xc547('0xd')](_0xc547('0x1f'),_0x55e93a);logger['debug']('ShowSalesforceAccount',_0x55e93a,JSON[_0xc547('0x10')](_0x4dd068));_0x444c9b(_0x4dd068);})[_0xc547('0x15')](function(_0x20ffe0){logger[_0xc547('0x11')]('ShowSalesforceAccount',_0x20ffe0['message'],_0x55e93a);_0x23094f(_0x49fa3c[_0xc547('0x11')](0x1f4,_0x20ffe0['message']));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index cf8eeaf..ee0d6b0 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 _0xdb28=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','post','create','put','delete','destroy','exports','multer','util'];(function(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0xdb28,0x106));var _0x8db2=function(_0x3ad382,_0x3d66be){_0x3ad382=_0x3ad382-0x0;var _0x4e52f6=_0xdb28[_0x3ad382];return _0x4e52f6;};'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('./intSalesforceConfiguration.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['get'](_0x8db2('0xf'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x10')]);router['get'](_0x8db2('0x11'),auth[_0x8db2('0xa')](),controller['getDescriptions']);router[_0x8db2('0x12')]('/',auth[_0x8db2('0xa')](),controller[_0x8db2('0x13')]);router[_0x8db2('0x14')](_0x8db2('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x8db2('0x15')](_0x8db2('0xb'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x16')]);module[_0x8db2('0x17')]=router; \ No newline at end of file +var _0xdb28=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','post','create','put','delete','destroy','exports','multer','util'];(function(_0x39096d,_0x51f8a0){var _0x13da4f=function(_0x11e6b2){while(--_0x11e6b2){_0x39096d['push'](_0x39096d['shift']());}};_0x13da4f(++_0x51f8a0);}(_0xdb28,0x106));var _0x8db2=function(_0x114067,_0x505a34){_0x114067=_0x114067-0x0;var _0x1c5443=_0xdb28[_0x114067];return _0x1c5443;};'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('./intSalesforceConfiguration.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['get'](_0x8db2('0xf'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x10')]);router['get'](_0x8db2('0x11'),auth[_0x8db2('0xa')](),controller['getDescriptions']);router[_0x8db2('0x12')]('/',auth[_0x8db2('0xa')](),controller[_0x8db2('0x13')]);router[_0x8db2('0x14')](_0x8db2('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x8db2('0x15')](_0x8db2('0xb'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x16')]);module[_0x8db2('0x17')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index 2b17302..30747e4 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 _0xc8ae=['sequelize','exports','STRING','ENUM','Case','contact_lead','contact','lead','account_contact_lead','account'];(function(_0x2a9ec5,_0x443383){var _0x2a6113=function(_0x1ee453){while(--_0x1ee453){_0x2a9ec5['push'](_0x2a9ec5['shift']());}};_0x2a6113(++_0x443383);}(_0xc8ae,0x1c2));var _0xec8a=function(_0x1b02eb,_0x2a57f7){_0x1b02eb=_0x1b02eb-0x0;var _0x359d83=_0xc8ae[_0x1b02eb];return _0x359d83;};'use strict';var Sequelize=require(_0xec8a('0x0'));module[_0xec8a('0x1')]={'name':{'type':Sequelize[_0xec8a('0x2')]},'description':{'type':Sequelize[_0xec8a('0x2')]},'ticketType':{'type':Sequelize[_0xec8a('0x3')]('Task',_0xec8a('0x4')),'defaultValue':'Task'},'moduleSearch':{'type':Sequelize[_0xec8a('0x3')](_0xec8a('0x5'),_0xec8a('0x6'),_0xec8a('0x7'),_0xec8a('0x8'),_0xec8a('0x9')),'defaultValue':_0xec8a('0x5')},'moduleCreate':{'type':Sequelize['ENUM']('nothing',_0xec8a('0x6'),_0xec8a('0x7'),'account'),'defaultValue':'lead'},'leadId':{'type':Sequelize[_0xec8a('0x2')]},'additionalSearchAccount':{'type':Sequelize[_0xec8a('0x2')]},'additionalSearchContact':{'type':Sequelize[_0xec8a('0x2')]},'additionalSearchLead':{'type':Sequelize[_0xec8a('0x2')]}}; \ No newline at end of file +var _0xaf1c=['contact','account_contact_lead','account','nothing','lead','exports','STRING','ENUM','Task','Case','contact_lead'];(function(_0x5027a7,_0x37ad14){var _0x3aedf7=function(_0x4d2bb3){while(--_0x4d2bb3){_0x5027a7['push'](_0x5027a7['shift']());}};_0x3aedf7(++_0x37ad14);}(_0xaf1c,0x1de));var _0xcaf1=function(_0x273db1,_0x1dfc0f){_0x273db1=_0x273db1-0x0;var _0x4750fe=_0xaf1c[_0x273db1];return _0x4750fe;};'use strict';var Sequelize=require('sequelize');module[_0xcaf1('0x0')]={'name':{'type':Sequelize[_0xcaf1('0x1')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0xcaf1('0x2')](_0xcaf1('0x3'),_0xcaf1('0x4')),'defaultValue':_0xcaf1('0x3')},'moduleSearch':{'type':Sequelize[_0xcaf1('0x2')](_0xcaf1('0x5'),_0xcaf1('0x6'),'lead',_0xcaf1('0x7'),_0xcaf1('0x8')),'defaultValue':_0xcaf1('0x5')},'moduleCreate':{'type':Sequelize[_0xcaf1('0x2')](_0xcaf1('0x9'),_0xcaf1('0x6'),_0xcaf1('0xa'),_0xcaf1('0x8')),'defaultValue':_0xcaf1('0xa')},'leadId':{'type':Sequelize['STRING']},'additionalSearchAccount':{'type':Sequelize[_0xcaf1('0x1')]},'additionalSearchContact':{'type':Sequelize['STRING']},'additionalSearchLead':{'type':Sequelize[_0xcaf1('0x1')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index f9d0e9c..05e74a8 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 _0x1115=['crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','SalesforceConfiguration,\x20%s,\x20%s','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','sendStatus','status','end','offset','undefined','limit','count','Content-Range','reject','save','update','destroy','stack','name','send','index','map','SalesforceConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','include','findAll','params','includeAll','options','find','create','body','getFields','findOne','SalesforceField','length','getSubjects','order','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','squel'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x1115,0x1b6));var _0x5111=function(_0x180fae,_0x5e6dfc){_0x180fae=_0x180fae-0x0;var _0x6e0b5a=_0x1115[_0x180fae];return _0x6e0b5a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5111('0x0'));var zipdir=require(_0x5111('0x1'));var jsonpatch=require(_0x5111('0x2'));var rp=require(_0x5111('0x3'));var moment=require(_0x5111('0x4'));var BPromise=require(_0x5111('0x5'));var Mustache=require(_0x5111('0x6'));var util=require(_0x5111('0x7'));var path=require(_0x5111('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x5111('0x9'));var fs=require('fs');var fs_extra=require(_0x5111('0xa'));var _=require('lodash');var squel=require(_0x5111('0xb'));var crypto=require(_0x5111('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x5111('0xd'));var toCsv=require('to-csv');var querystring=require(_0x5111('0xe'));var Papa=require(_0x5111('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x5111('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5111('0x11'));var logger=require('../../config/logger')(_0x5111('0x12'));var utils=require(_0x5111('0x13'));var config=require(_0x5111('0x14'));var licenseUtil=require(_0x5111('0x15'));var db=require(_0x5111('0x16'))['db'];var jayson=require(_0x5111('0x17'));var client=jayson[_0x5111('0x18')][_0x5111('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x1e335f,_0x10e3c4,_0x38af76,_0x62ce44){return new BPromise(function(_0x264703,_0x3e60b5){var _0x3721d5=_0x62ce44||client;return _0x3721d5[_0x5111('0x1a')](_0x1e335f,_0x38af76)[_0x5111('0x1b')](function(_0x45052e){logger['info'](_0x5111('0x1c'),_0x10e3c4,'request\x20sent');logger['debug'](_0x5111('0x1d'),_0x10e3c4,_0x5111('0x1e'),JSON[_0x5111('0x1f')](_0x45052e));if(_0x45052e['error']){if(_0x45052e[_0x5111('0x20')][_0x5111('0x21')]===0x1f4){logger['error'](_0x5111('0x1c'),_0x10e3c4,_0x45052e[_0x5111('0x20')][_0x5111('0x22')]);return _0x3e60b5(_0x45052e[_0x5111('0x20')]['message']);}logger[_0x5111('0x20')](_0x5111('0x1c'),_0x10e3c4,_0x45052e[_0x5111('0x20')][_0x5111('0x22')]);return _0x264703(_0x45052e[_0x5111('0x20')][_0x5111('0x22')]);}else{logger[_0x5111('0x23')](_0x5111('0x1c'),_0x10e3c4,_0x5111('0x1e'));_0x264703(_0x45052e[_0x5111('0x24')]['message']);}})[_0x5111('0x25')](function(_0x162ff9){logger[_0x5111('0x20')]('SalesforceConfiguration,\x20%s,\x20%s',_0x10e3c4,_0x162ff9);_0x3e60b5(_0x162ff9);});});}function respondWithStatusCode(_0x28cc87,_0x20a4f7){_0x20a4f7=_0x20a4f7||0xcc;return function(_0x2d9446){if(_0x2d9446){return _0x28cc87[_0x5111('0x26')](_0x20a4f7);}return _0x28cc87[_0x5111('0x27')](_0x20a4f7)[_0x5111('0x28')]();};}function respondWithResult(_0x5990,_0x316b39){_0x316b39=_0x316b39||0xc8;return function(_0x382bd0){if(_0x382bd0){return _0x5990[_0x5111('0x27')](_0x316b39)['json'](_0x382bd0);}};}function respondWithFilteredResult(_0x1bdd54,_0x3d6825){return function(_0x151b67){if(_0x151b67){var _0x3e7e59=typeof _0x3d6825[_0x5111('0x29')]===_0x5111('0x2a')&&typeof _0x3d6825[_0x5111('0x2b')]==='undefined';var _0x1ce17f=_0x151b67[_0x5111('0x2c')];var _0x25a75a=_0x3e7e59?0x0:_0x3d6825['offset'];var _0xdf9031=_0x3e7e59?_0x151b67[_0x5111('0x2c')]:_0x3d6825[_0x5111('0x29')]+_0x3d6825['limit'];var _0x491a4c;if(_0xdf9031>=_0x1ce17f){_0xdf9031=_0x1ce17f;_0x491a4c=0xc8;}else{_0x491a4c=0xce;}_0x1bdd54[_0x5111('0x27')](_0x491a4c);return _0x1bdd54['set'](_0x5111('0x2d'),_0x25a75a+'-'+_0xdf9031+'/'+_0x1ce17f)['json'](_0x151b67);}return null;};}function patchUpdates(_0x35ed41){return function(_0x5a433c){try{jsonpatch['apply'](_0x5a433c,_0x35ed41,!![]);}catch(_0x5315ed){return BPromise[_0x5111('0x2e')](_0x5315ed);}return _0x5a433c[_0x5111('0x2f')]();};}function saveUpdates(_0xe0839e,_0x3763f4){return function(_0x13fafe){if(_0x13fafe){return _0x13fafe[_0x5111('0x30')](_0xe0839e)[_0x5111('0x1b')](function(_0x5ce117){return _0x5ce117;});}return null;};}function removeEntity(_0x202897,_0x37c981){return function(_0x1c90e6){if(_0x1c90e6){return _0x1c90e6[_0x5111('0x31')]()['then'](function(){_0x202897['status'](0xcc)[_0x5111('0x28')]();});}};}function handleEntityNotFound(_0x769be3,_0x22fd07){return function(_0x44b9d9){if(!_0x44b9d9){_0x769be3[_0x5111('0x26')](0x194);}return _0x44b9d9;};}function handleError(_0x35ec88,_0x1d8f81){_0x1d8f81=_0x1d8f81||0x1f4;return function(_0x21f248){logger['error'](_0x21f248[_0x5111('0x32')]);if(_0x21f248[_0x5111('0x33')]){delete _0x21f248[_0x5111('0x33')];}_0x35ec88['status'](_0x1d8f81)[_0x5111('0x34')](_0x21f248);};}exports[_0x5111('0x35')]=function(_0x2e407e,_0x5b76f8){var _0x4ecbc9={},_0x4c26b1={},_0x5f49ee={'count':0x0,'rows':[]};var _0x187cab=_[_0x5111('0x36')](db[_0x5111('0x37')][_0x5111('0x38')],function(_0x570126){return{'name':_0x570126[_0x5111('0x39')],'type':_0x570126[_0x5111('0x3a')][_0x5111('0x3b')]};});_0x4c26b1[_0x5111('0x3c')]=_['map'](_0x187cab,_0x5111('0x33'));_0x4c26b1[_0x5111('0x3d')]=_[_0x5111('0x3e')](_0x2e407e[_0x5111('0x3d')]);_0x4c26b1[_0x5111('0x3f')]=_[_0x5111('0x40')](_0x4c26b1[_0x5111('0x3c')],_0x4c26b1[_0x5111('0x3d')]);_0x4ecbc9[_0x5111('0x41')]=_[_0x5111('0x40')](_0x4c26b1[_0x5111('0x3c')],qs[_0x5111('0x42')](_0x2e407e[_0x5111('0x3d')]['fields']));_0x4ecbc9[_0x5111('0x41')]=_0x4ecbc9[_0x5111('0x41')]['length']?_0x4ecbc9[_0x5111('0x41')]:_0x4c26b1[_0x5111('0x3c')];if(!_0x2e407e[_0x5111('0x3d')][_0x5111('0x43')](_0x5111('0x44'))){_0x4ecbc9[_0x5111('0x2b')]=qs[_0x5111('0x2b')](_0x2e407e['query'][_0x5111('0x2b')]);_0x4ecbc9[_0x5111('0x29')]=qs[_0x5111('0x29')](_0x2e407e[_0x5111('0x3d')][_0x5111('0x29')]);}_0x4ecbc9['order']=qs['sort'](_0x2e407e[_0x5111('0x3d')][_0x5111('0x45')]);_0x4ecbc9['where']=qs[_0x5111('0x3f')](_[_0x5111('0x46')](_0x2e407e[_0x5111('0x3d')],_0x4c26b1[_0x5111('0x3f')]),_0x187cab);if(_0x2e407e[_0x5111('0x3d')][_0x5111('0x47')]){_0x4ecbc9[_0x5111('0x48')]=_[_0x5111('0x49')](_0x4ecbc9[_0x5111('0x48')],{'$or':_[_0x5111('0x36')](_0x187cab,function(_0x4a8a42){if(_0x4a8a42['type']!==_0x5111('0x4a')){var _0x306d05={};_0x306d05[_0x4a8a42[_0x5111('0x33')]]={'$like':'%'+_0x2e407e[_0x5111('0x3d')][_0x5111('0x47')]+'%'};return _0x306d05;}})});}_0x4ecbc9=_[_0x5111('0x49')]({},_0x4ecbc9,_0x2e407e['options']);var _0x1b9a74={'where':_0x4ecbc9[_0x5111('0x48')]};return db[_0x5111('0x37')][_0x5111('0x2c')](_0x1b9a74)['then'](function(_0x2242b7){_0x5f49ee[_0x5111('0x2c')]=_0x2242b7;if(_0x2e407e[_0x5111('0x3d')]['includeAll']){_0x4ecbc9[_0x5111('0x4b')]=[{'all':!![]}];}return db[_0x5111('0x37')][_0x5111('0x4c')](_0x4ecbc9);})[_0x5111('0x1b')](function(_0x5cd7a5){_0x5f49ee['rows']=_0x5cd7a5;return _0x5f49ee;})[_0x5111('0x1b')](respondWithFilteredResult(_0x5b76f8,_0x4ecbc9))['catch'](handleError(_0x5b76f8,null));};exports['show']=function(_0x333e5a,_0x1ef508){var _0x4aa934={'raw':![],'where':{'id':_0x333e5a[_0x5111('0x4d')]['id']}},_0x296f87={};_0x296f87[_0x5111('0x3c')]=_[_0x5111('0x3e')](db[_0x5111('0x37')][_0x5111('0x38')]);_0x296f87[_0x5111('0x3d')]=_[_0x5111('0x3e')](_0x333e5a[_0x5111('0x3d')]);_0x296f87[_0x5111('0x3f')]=_[_0x5111('0x40')](_0x296f87[_0x5111('0x3c')],_0x296f87['query']);_0x4aa934[_0x5111('0x41')]=_[_0x5111('0x40')](_0x296f87[_0x5111('0x3c')],qs[_0x5111('0x42')](_0x333e5a[_0x5111('0x3d')][_0x5111('0x42')]));_0x4aa934[_0x5111('0x41')]=_0x4aa934['attributes']['length']?_0x4aa934[_0x5111('0x41')]:_0x296f87['model'];if(_0x333e5a[_0x5111('0x3d')][_0x5111('0x4e')]){_0x4aa934[_0x5111('0x4b')]=[{'all':!![]}];}_0x4aa934=_[_0x5111('0x49')]({},_0x4aa934,_0x333e5a[_0x5111('0x4f')]);return db[_0x5111('0x37')][_0x5111('0x50')](_0x4aa934)['then'](handleEntityNotFound(_0x1ef508,null))[_0x5111('0x1b')](respondWithResult(_0x1ef508,null))[_0x5111('0x25')](handleError(_0x1ef508,null));};exports['create']=function(_0x408397,_0x46fb15){return db['SalesforceConfiguration'][_0x5111('0x51')](_0x408397['body'],{})['then'](respondWithResult(_0x46fb15,0xc9))['catch'](handleError(_0x46fb15,null));};exports[_0x5111('0x30')]=function(_0x30fb6d,_0xb45212){if(_0x30fb6d[_0x5111('0x52')]['id']){delete _0x30fb6d['body']['id'];}return db[_0x5111('0x37')][_0x5111('0x50')]({'where':{'id':_0x30fb6d[_0x5111('0x4d')]['id']}})['then'](handleEntityNotFound(_0xb45212,null))[_0x5111('0x1b')](saveUpdates(_0x30fb6d[_0x5111('0x52')],null))[_0x5111('0x1b')](respondWithResult(_0xb45212,null))['catch'](handleError(_0xb45212,null));};exports[_0x5111('0x31')]=function(_0x555d63,_0x3bf42d){return db[_0x5111('0x37')][_0x5111('0x50')]({'where':{'id':_0x555d63[_0x5111('0x4d')]['id']}})['then'](handleEntityNotFound(_0x3bf42d,null))[_0x5111('0x1b')](removeEntity(_0x3bf42d,null))[_0x5111('0x25')](handleError(_0x3bf42d,null));};exports[_0x5111('0x53')]=function(_0x3b3e75,_0x2b07ae,_0x438db3){var _0x433918={};var _0x54c415={};var _0x27edea;var _0x4e730c;return db[_0x5111('0x37')][_0x5111('0x54')]({'where':{'id':_0x3b3e75[_0x5111('0x4d')]['id']}})[_0x5111('0x1b')](handleEntityNotFound(_0x2b07ae,null))[_0x5111('0x1b')](function(_0x3a7d48){if(_0x3a7d48){_0x27edea=_0x3a7d48;_0x54c415['model']=_[_0x5111('0x3e')](db[_0x5111('0x55')][_0x5111('0x38')]);_0x54c415[_0x5111('0x3d')]=_[_0x5111('0x3e')](_0x3b3e75[_0x5111('0x3d')]);_0x54c415['filters']=_[_0x5111('0x40')](_0x54c415[_0x5111('0x3c')],_0x54c415[_0x5111('0x3d')]);_0x433918[_0x5111('0x41')]=_[_0x5111('0x40')](_0x54c415['model'],qs[_0x5111('0x42')](_0x3b3e75[_0x5111('0x3d')][_0x5111('0x42')]));_0x433918[_0x5111('0x41')]=_0x433918[_0x5111('0x41')][_0x5111('0x56')]?_0x433918[_0x5111('0x41')]:_0x54c415['model'];_0x433918['order']=qs['sort'](_0x3b3e75[_0x5111('0x3d')][_0x5111('0x45')]);_0x433918[_0x5111('0x48')]=qs[_0x5111('0x3f')](_[_0x5111('0x46')](_0x3b3e75['query'],_0x54c415[_0x5111('0x3f')]));if(_0x3b3e75[_0x5111('0x3d')][_0x5111('0x47')]){_0x433918[_0x5111('0x48')]=_[_0x5111('0x49')](_0x433918[_0x5111('0x48')],{'$or':_[_0x5111('0x36')](_0x433918[_0x5111('0x41')],function(_0x3f744e){var _0x7c16eb={};_0x7c16eb[_0x3f744e]={'$like':'%'+_0x3b3e75['query'][_0x5111('0x47')]+'%'};return _0x7c16eb;})});}_0x433918=_[_0x5111('0x49')]({},_0x433918,_0x3b3e75['options']);return _0x27edea[_0x5111('0x53')](_0x433918);}})[_0x5111('0x1b')](function(_0x578048){if(_0x578048){_0x4e730c=_0x578048[_0x5111('0x56')];if(!_0x3b3e75[_0x5111('0x3d')][_0x5111('0x43')](_0x5111('0x44'))){_0x433918[_0x5111('0x2b')]=qs[_0x5111('0x2b')](_0x3b3e75[_0x5111('0x3d')]['limit']);_0x433918[_0x5111('0x29')]=qs['offset'](_0x3b3e75['query'][_0x5111('0x29')]);}return _0x27edea['getFields'](_0x433918);}})[_0x5111('0x1b')](function(_0x484ee0){if(_0x484ee0){return _0x484ee0?{'count':_0x4e730c,'rows':_0x484ee0}:null;}})[_0x5111('0x1b')](respondWithResult(_0x2b07ae,null))[_0x5111('0x25')](handleError(_0x2b07ae,null));};exports[_0x5111('0x57')]=function(_0x2fa175,_0x43b9ae,_0x12114e){var _0xf37543={};var _0xf39b30={};var _0x3ad8f7;var _0x1da35e;return db[_0x5111('0x37')][_0x5111('0x54')]({'where':{'id':_0x2fa175[_0x5111('0x4d')]['id']}})['then'](handleEntityNotFound(_0x43b9ae,null))[_0x5111('0x1b')](function(_0x4d03bc){if(_0x4d03bc){_0x3ad8f7=_0x4d03bc;_0xf39b30[_0x5111('0x3c')]=_['keys'](db[_0x5111('0x55')][_0x5111('0x38')]);_0xf39b30[_0x5111('0x3d')]=_[_0x5111('0x3e')](_0x2fa175[_0x5111('0x3d')]);_0xf39b30['filters']=_['intersection'](_0xf39b30[_0x5111('0x3c')],_0xf39b30['query']);_0xf37543['attributes']=_[_0x5111('0x40')](_0xf39b30[_0x5111('0x3c')],qs[_0x5111('0x42')](_0x2fa175[_0x5111('0x3d')][_0x5111('0x42')]));_0xf37543[_0x5111('0x41')]=_0xf37543['attributes'][_0x5111('0x56')]?_0xf37543[_0x5111('0x41')]:_0xf39b30['model'];_0xf37543[_0x5111('0x58')]=qs['sort'](_0x2fa175[_0x5111('0x3d')][_0x5111('0x45')]);_0xf37543[_0x5111('0x48')]=qs[_0x5111('0x3f')](_['pick'](_0x2fa175[_0x5111('0x3d')],_0xf39b30['filters']));if(_0x2fa175[_0x5111('0x3d')]['filter']){_0xf37543[_0x5111('0x48')]=_[_0x5111('0x49')](_0xf37543[_0x5111('0x48')],{'$or':_[_0x5111('0x36')](_0xf37543[_0x5111('0x41')],function(_0x411e36){var _0x4ecafb={};_0x4ecafb[_0x411e36]={'$like':'%'+_0x2fa175[_0x5111('0x3d')]['filter']+'%'};return _0x4ecafb;})});}_0xf37543=_[_0x5111('0x49')]({},_0xf37543,_0x2fa175[_0x5111('0x4f')]);return _0x3ad8f7[_0x5111('0x57')](_0xf37543);}})[_0x5111('0x1b')](function(_0x391ec3){if(_0x391ec3){_0x1da35e=_0x391ec3['length'];if(!_0x2fa175[_0x5111('0x3d')][_0x5111('0x43')]('nolimit')){_0xf37543[_0x5111('0x2b')]=qs[_0x5111('0x2b')](_0x2fa175[_0x5111('0x3d')]['limit']);_0xf37543[_0x5111('0x29')]=qs[_0x5111('0x29')](_0x2fa175['query'][_0x5111('0x29')]);}return _0x3ad8f7['getSubjects'](_0xf37543);}})[_0x5111('0x1b')](function(_0x5dcc50){if(_0x5dcc50){return _0x5dcc50?{'count':_0x1da35e,'rows':_0x5dcc50}:null;}})[_0x5111('0x1b')](respondWithResult(_0x43b9ae,null))[_0x5111('0x25')](handleError(_0x43b9ae,null));};exports[_0x5111('0x59')]=function(_0x17acc9,_0x579c07,_0x235426){var _0x1062a2={};var _0x1438f0={};var _0x3c9759;var _0x1c0e60;return db[_0x5111('0x37')][_0x5111('0x54')]({'where':{'id':_0x17acc9[_0x5111('0x4d')]['id']}})[_0x5111('0x1b')](handleEntityNotFound(_0x579c07,null))[_0x5111('0x1b')](function(_0x4be0f0){if(_0x4be0f0){_0x3c9759=_0x4be0f0;_0x1438f0[_0x5111('0x3c')]=_[_0x5111('0x3e')](db['SalesforceField'][_0x5111('0x38')]);_0x1438f0[_0x5111('0x3d')]=_['keys'](_0x17acc9['query']);_0x1438f0['filters']=_[_0x5111('0x40')](_0x1438f0[_0x5111('0x3c')],_0x1438f0['query']);_0x1062a2[_0x5111('0x41')]=_[_0x5111('0x40')](_0x1438f0['model'],qs[_0x5111('0x42')](_0x17acc9[_0x5111('0x3d')][_0x5111('0x42')]));_0x1062a2[_0x5111('0x41')]=_0x1062a2[_0x5111('0x41')][_0x5111('0x56')]?_0x1062a2['attributes']:_0x1438f0[_0x5111('0x3c')];_0x1062a2[_0x5111('0x58')]=qs[_0x5111('0x45')](_0x17acc9[_0x5111('0x3d')][_0x5111('0x45')]);_0x1062a2['where']=qs[_0x5111('0x3f')](_[_0x5111('0x46')](_0x17acc9[_0x5111('0x3d')],_0x1438f0[_0x5111('0x3f')]));if(_0x17acc9[_0x5111('0x3d')][_0x5111('0x47')]){_0x1062a2[_0x5111('0x48')]=_['merge'](_0x1062a2['where'],{'$or':_[_0x5111('0x36')](_0x1062a2[_0x5111('0x41')],function(_0x2e4783){var _0x27c950={};_0x27c950[_0x2e4783]={'$like':'%'+_0x17acc9[_0x5111('0x3d')][_0x5111('0x47')]+'%'};return _0x27c950;})});}_0x1062a2=_[_0x5111('0x49')]({},_0x1062a2,_0x17acc9[_0x5111('0x4f')]);return _0x3c9759[_0x5111('0x59')](_0x1062a2);}})[_0x5111('0x1b')](function(_0x1e5d84){if(_0x1e5d84){_0x1c0e60=_0x1e5d84['length'];if(!_0x17acc9[_0x5111('0x3d')][_0x5111('0x43')]('nolimit')){_0x1062a2[_0x5111('0x2b')]=qs[_0x5111('0x2b')](_0x17acc9[_0x5111('0x3d')][_0x5111('0x2b')]);_0x1062a2['offset']=qs[_0x5111('0x29')](_0x17acc9[_0x5111('0x3d')]['offset']);}return _0x3c9759['getDescriptions'](_0x1062a2);}})[_0x5111('0x1b')](function(_0x26031b){if(_0x26031b){return _0x26031b?{'count':_0x1c0e60,'rows':_0x26031b}:null;}})[_0x5111('0x1b')](respondWithResult(_0x579c07,null))[_0x5111('0x25')](handleError(_0x579c07,null));}; \ No newline at end of file +var _0xfb8f=['request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','error','message','catch','sendStatus','end','status','json','offset','undefined','count','limit','Content-Range','reject','save','destroy','name','index','map','SalesforceConfiguration','rawAttributes','fieldName','type','query','filters','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','includeAll','include','findAll','rows','params','keys','intersection','find','create','body','update','getFields','findOne','SalesforceField','pick','getSubjects','getDescriptions','rimraf','request-promise','moment','bluebird','mustache','util','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','jayson/promise','http','request','then','info','SalesforceConfiguration,\x20%s,\x20%s'];(function(_0x2f458d,_0x53e762){var _0x5e47a7=function(_0x5dd46a){while(--_0x5dd46a){_0x2f458d['push'](_0x2f458d['shift']());}};_0x5e47a7(++_0x53e762);}(_0xfb8f,0x18c));var _0xffb8=function(_0x1aff80,_0x215c29){_0x1aff80=_0x1aff80-0x0;var _0x3523c7=_0xfb8f[_0x1aff80];return _0x3523c7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xffb8('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xffb8('0x1'));var moment=require(_0xffb8('0x2'));var BPromise=require(_0xffb8('0x3'));var Mustache=require(_0xffb8('0x4'));var util=require(_0xffb8('0x5'));var path=require('path');var sox=require(_0xffb8('0x6'));var csv=require(_0xffb8('0x7'));var ejs=require(_0xffb8('0x8'));var fs=require('fs');var fs_extra=require(_0xffb8('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xffb8('0xa'));var jsforce=require(_0xffb8('0xb'));var deskjs=require(_0xffb8('0xc'));var toCsv=require(_0xffb8('0x7'));var querystring=require(_0xffb8('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xffb8('0xe'));var qs=require(_0xffb8('0xf'));var as=require(_0xffb8('0x10'));var hardwareService=require(_0xffb8('0x11'));var logger=require(_0xffb8('0x12'))('api');var utils=require(_0xffb8('0x13'));var config=require(_0xffb8('0x14'));var licenseUtil=require(_0xffb8('0x15'));var db=require(_0xffb8('0x16'))['db'];var jayson=require(_0xffb8('0x17'));var client=jayson['client'][_0xffb8('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x382210,_0x321c6d,_0x4a38c4,_0x79b08b){return new BPromise(function(_0x5187a3,_0x4a2121){var _0x41b182=_0x79b08b||client;return _0x41b182[_0xffb8('0x19')](_0x382210,_0x4a38c4)[_0xffb8('0x1a')](function(_0xbcc782){logger[_0xffb8('0x1b')](_0xffb8('0x1c'),_0x321c6d,_0xffb8('0x1d'));logger[_0xffb8('0x1e')](_0xffb8('0x1f'),_0x321c6d,'request\x20sent',JSON['stringify'](_0xbcc782));if(_0xbcc782[_0xffb8('0x20')]){if(_0xbcc782['error']['code']===0x1f4){logger['error']('SalesforceConfiguration,\x20%s,\x20%s',_0x321c6d,_0xbcc782[_0xffb8('0x20')][_0xffb8('0x21')]);return _0x4a2121(_0xbcc782[_0xffb8('0x20')][_0xffb8('0x21')]);}logger['error'](_0xffb8('0x1c'),_0x321c6d,_0xbcc782[_0xffb8('0x20')][_0xffb8('0x21')]);return _0x5187a3(_0xbcc782['error'][_0xffb8('0x21')]);}else{logger['info'](_0xffb8('0x1c'),_0x321c6d,_0xffb8('0x1d'));_0x5187a3(_0xbcc782['result'][_0xffb8('0x21')]);}})[_0xffb8('0x22')](function(_0x83695e){logger[_0xffb8('0x20')](_0xffb8('0x1c'),_0x321c6d,_0x83695e);_0x4a2121(_0x83695e);});});}function respondWithStatusCode(_0x1813a0,_0x237726){_0x237726=_0x237726||0xcc;return function(_0x570582){if(_0x570582){return _0x1813a0[_0xffb8('0x23')](_0x237726);}return _0x1813a0['status'](_0x237726)[_0xffb8('0x24')]();};}function respondWithResult(_0x383a66,_0x59fa17){_0x59fa17=_0x59fa17||0xc8;return function(_0x4b3a25){if(_0x4b3a25){return _0x383a66[_0xffb8('0x25')](_0x59fa17)[_0xffb8('0x26')](_0x4b3a25);}};}function respondWithFilteredResult(_0x4d85e1,_0x42f01f){return function(_0x457bfa){if(_0x457bfa){var _0x5a1e26=typeof _0x42f01f[_0xffb8('0x27')]==='undefined'&&typeof _0x42f01f['limit']===_0xffb8('0x28');var _0x366f87=_0x457bfa[_0xffb8('0x29')];var _0x52e150=_0x5a1e26?0x0:_0x42f01f['offset'];var _0x3dd2d1=_0x5a1e26?_0x457bfa[_0xffb8('0x29')]:_0x42f01f[_0xffb8('0x27')]+_0x42f01f[_0xffb8('0x2a')];var _0x154b9a;if(_0x3dd2d1>=_0x366f87){_0x3dd2d1=_0x366f87;_0x154b9a=0xc8;}else{_0x154b9a=0xce;}_0x4d85e1[_0xffb8('0x25')](_0x154b9a);return _0x4d85e1['set'](_0xffb8('0x2b'),_0x52e150+'-'+_0x3dd2d1+'/'+_0x366f87)['json'](_0x457bfa);}return null;};}function patchUpdates(_0x14680d){return function(_0x20986b){try{jsonpatch['apply'](_0x20986b,_0x14680d,!![]);}catch(_0x2291fb){return BPromise[_0xffb8('0x2c')](_0x2291fb);}return _0x20986b[_0xffb8('0x2d')]();};}function saveUpdates(_0x2f9fda,_0x2097a8){return function(_0x1c3b78){if(_0x1c3b78){return _0x1c3b78['update'](_0x2f9fda)[_0xffb8('0x1a')](function(_0x36f962){return _0x36f962;});}return null;};}function removeEntity(_0x2e5035,_0x92e684){return function(_0x37d179){if(_0x37d179){return _0x37d179[_0xffb8('0x2e')]()[_0xffb8('0x1a')](function(){_0x2e5035[_0xffb8('0x25')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5aa8a6,_0x5abddf){return function(_0x2a6f3d){if(!_0x2a6f3d){_0x5aa8a6[_0xffb8('0x23')](0x194);}return _0x2a6f3d;};}function handleError(_0x358e9c,_0x4828e4){_0x4828e4=_0x4828e4||0x1f4;return function(_0x3461fc){logger[_0xffb8('0x20')](_0x3461fc['stack']);if(_0x3461fc[_0xffb8('0x2f')]){delete _0x3461fc[_0xffb8('0x2f')];}_0x358e9c['status'](_0x4828e4)['send'](_0x3461fc);};}exports[_0xffb8('0x30')]=function(_0x15446a,_0x5e4beb){var _0x2f58e1={},_0x385a38={},_0x4d2ed4={'count':0x0,'rows':[]};var _0x35fbc0=_[_0xffb8('0x31')](db[_0xffb8('0x32')][_0xffb8('0x33')],function(_0x1185ed){return{'name':_0x1185ed[_0xffb8('0x34')],'type':_0x1185ed[_0xffb8('0x35')]['key']};});_0x385a38['model']=_[_0xffb8('0x31')](_0x35fbc0,_0xffb8('0x2f'));_0x385a38['query']=_['keys'](_0x15446a[_0xffb8('0x36')]);_0x385a38[_0xffb8('0x37')]=_['intersection'](_0x385a38[_0xffb8('0x38')],_0x385a38[_0xffb8('0x36')]);_0x2f58e1[_0xffb8('0x39')]=_['intersection'](_0x385a38[_0xffb8('0x38')],qs[_0xffb8('0x3a')](_0x15446a[_0xffb8('0x36')][_0xffb8('0x3a')]));_0x2f58e1[_0xffb8('0x39')]=_0x2f58e1['attributes'][_0xffb8('0x3b')]?_0x2f58e1[_0xffb8('0x39')]:_0x385a38[_0xffb8('0x38')];if(!_0x15446a[_0xffb8('0x36')][_0xffb8('0x3c')](_0xffb8('0x3d'))){_0x2f58e1[_0xffb8('0x2a')]=qs[_0xffb8('0x2a')](_0x15446a[_0xffb8('0x36')][_0xffb8('0x2a')]);_0x2f58e1[_0xffb8('0x27')]=qs[_0xffb8('0x27')](_0x15446a[_0xffb8('0x36')][_0xffb8('0x27')]);}_0x2f58e1[_0xffb8('0x3e')]=qs[_0xffb8('0x3f')](_0x15446a[_0xffb8('0x36')][_0xffb8('0x3f')]);_0x2f58e1[_0xffb8('0x40')]=qs[_0xffb8('0x37')](_['pick'](_0x15446a[_0xffb8('0x36')],_0x385a38[_0xffb8('0x37')]),_0x35fbc0);if(_0x15446a[_0xffb8('0x36')][_0xffb8('0x41')]){_0x2f58e1['where']=_['merge'](_0x2f58e1[_0xffb8('0x40')],{'$or':_[_0xffb8('0x31')](_0x35fbc0,function(_0x44759b){if(_0x44759b[_0xffb8('0x35')]!=='VIRTUAL'){var _0x31cd7d={};_0x31cd7d[_0x44759b['name']]={'$like':'%'+_0x15446a[_0xffb8('0x36')]['filter']+'%'};return _0x31cd7d;}})});}_0x2f58e1=_[_0xffb8('0x42')]({},_0x2f58e1,_0x15446a[_0xffb8('0x43')]);var _0x22162e={'where':_0x2f58e1[_0xffb8('0x40')]};return db['SalesforceConfiguration']['count'](_0x22162e)['then'](function(_0x27ef30){_0x4d2ed4['count']=_0x27ef30;if(_0x15446a[_0xffb8('0x36')][_0xffb8('0x44')]){_0x2f58e1[_0xffb8('0x45')]=[{'all':!![]}];}return db['SalesforceConfiguration'][_0xffb8('0x46')](_0x2f58e1);})[_0xffb8('0x1a')](function(_0x3a5edd){_0x4d2ed4[_0xffb8('0x47')]=_0x3a5edd;return _0x4d2ed4;})['then'](respondWithFilteredResult(_0x5e4beb,_0x2f58e1))['catch'](handleError(_0x5e4beb,null));};exports['show']=function(_0xe45545,_0x22b1e0){var _0x5a1eb5={'raw':![],'where':{'id':_0xe45545[_0xffb8('0x48')]['id']}},_0x298b3d={};_0x298b3d[_0xffb8('0x38')]=_[_0xffb8('0x49')](db[_0xffb8('0x32')][_0xffb8('0x33')]);_0x298b3d[_0xffb8('0x36')]=_['keys'](_0xe45545[_0xffb8('0x36')]);_0x298b3d[_0xffb8('0x37')]=_['intersection'](_0x298b3d[_0xffb8('0x38')],_0x298b3d[_0xffb8('0x36')]);_0x5a1eb5[_0xffb8('0x39')]=_[_0xffb8('0x4a')](_0x298b3d['model'],qs[_0xffb8('0x3a')](_0xe45545[_0xffb8('0x36')][_0xffb8('0x3a')]));_0x5a1eb5[_0xffb8('0x39')]=_0x5a1eb5[_0xffb8('0x39')][_0xffb8('0x3b')]?_0x5a1eb5[_0xffb8('0x39')]:_0x298b3d[_0xffb8('0x38')];if(_0xe45545[_0xffb8('0x36')]['includeAll']){_0x5a1eb5['include']=[{'all':!![]}];}_0x5a1eb5=_[_0xffb8('0x42')]({},_0x5a1eb5,_0xe45545[_0xffb8('0x43')]);return db[_0xffb8('0x32')][_0xffb8('0x4b')](_0x5a1eb5)[_0xffb8('0x1a')](handleEntityNotFound(_0x22b1e0,null))['then'](respondWithResult(_0x22b1e0,null))[_0xffb8('0x22')](handleError(_0x22b1e0,null));};exports[_0xffb8('0x4c')]=function(_0xa4a501,_0x264935){return db[_0xffb8('0x32')]['create'](_0xa4a501[_0xffb8('0x4d')],{})[_0xffb8('0x1a')](respondWithResult(_0x264935,0xc9))[_0xffb8('0x22')](handleError(_0x264935,null));};exports[_0xffb8('0x4e')]=function(_0x20c359,_0x3e15fa){if(_0x20c359['body']['id']){delete _0x20c359[_0xffb8('0x4d')]['id'];}return db[_0xffb8('0x32')]['find']({'where':{'id':_0x20c359['params']['id']}})[_0xffb8('0x1a')](handleEntityNotFound(_0x3e15fa,null))['then'](saveUpdates(_0x20c359[_0xffb8('0x4d')],null))[_0xffb8('0x1a')](respondWithResult(_0x3e15fa,null))[_0xffb8('0x22')](handleError(_0x3e15fa,null));};exports['destroy']=function(_0x49d666,_0xa6a6dc){return db['SalesforceConfiguration'][_0xffb8('0x4b')]({'where':{'id':_0x49d666[_0xffb8('0x48')]['id']}})[_0xffb8('0x1a')](handleEntityNotFound(_0xa6a6dc,null))[_0xffb8('0x1a')](removeEntity(_0xa6a6dc,null))[_0xffb8('0x22')](handleError(_0xa6a6dc,null));};exports[_0xffb8('0x4f')]=function(_0x3c4f99,_0x3788af,_0x474591){var _0x1e1fee={};var _0x28c486={};var _0x5a4cec;var _0x13cf0f;return db[_0xffb8('0x32')][_0xffb8('0x50')]({'where':{'id':_0x3c4f99['params']['id']}})['then'](handleEntityNotFound(_0x3788af,null))[_0xffb8('0x1a')](function(_0x2dba92){if(_0x2dba92){_0x5a4cec=_0x2dba92;_0x28c486[_0xffb8('0x38')]=_[_0xffb8('0x49')](db[_0xffb8('0x51')][_0xffb8('0x33')]);_0x28c486['query']=_['keys'](_0x3c4f99[_0xffb8('0x36')]);_0x28c486['filters']=_['intersection'](_0x28c486[_0xffb8('0x38')],_0x28c486[_0xffb8('0x36')]);_0x1e1fee[_0xffb8('0x39')]=_['intersection'](_0x28c486[_0xffb8('0x38')],qs[_0xffb8('0x3a')](_0x3c4f99['query'][_0xffb8('0x3a')]));_0x1e1fee[_0xffb8('0x39')]=_0x1e1fee[_0xffb8('0x39')][_0xffb8('0x3b')]?_0x1e1fee[_0xffb8('0x39')]:_0x28c486[_0xffb8('0x38')];_0x1e1fee[_0xffb8('0x3e')]=qs[_0xffb8('0x3f')](_0x3c4f99[_0xffb8('0x36')][_0xffb8('0x3f')]);_0x1e1fee['where']=qs[_0xffb8('0x37')](_[_0xffb8('0x52')](_0x3c4f99[_0xffb8('0x36')],_0x28c486['filters']));if(_0x3c4f99[_0xffb8('0x36')][_0xffb8('0x41')]){_0x1e1fee[_0xffb8('0x40')]=_['merge'](_0x1e1fee[_0xffb8('0x40')],{'$or':_[_0xffb8('0x31')](_0x1e1fee['attributes'],function(_0x269435){var _0x5e35cb={};_0x5e35cb[_0x269435]={'$like':'%'+_0x3c4f99['query'][_0xffb8('0x41')]+'%'};return _0x5e35cb;})});}_0x1e1fee=_[_0xffb8('0x42')]({},_0x1e1fee,_0x3c4f99[_0xffb8('0x43')]);return _0x5a4cec[_0xffb8('0x4f')](_0x1e1fee);}})[_0xffb8('0x1a')](function(_0x43a9a2){if(_0x43a9a2){_0x13cf0f=_0x43a9a2[_0xffb8('0x3b')];if(!_0x3c4f99[_0xffb8('0x36')]['hasOwnProperty'](_0xffb8('0x3d'))){_0x1e1fee['limit']=qs[_0xffb8('0x2a')](_0x3c4f99[_0xffb8('0x36')]['limit']);_0x1e1fee[_0xffb8('0x27')]=qs[_0xffb8('0x27')](_0x3c4f99[_0xffb8('0x36')]['offset']);}return _0x5a4cec[_0xffb8('0x4f')](_0x1e1fee);}})[_0xffb8('0x1a')](function(_0x261fd6){if(_0x261fd6){return _0x261fd6?{'count':_0x13cf0f,'rows':_0x261fd6}:null;}})[_0xffb8('0x1a')](respondWithResult(_0x3788af,null))[_0xffb8('0x22')](handleError(_0x3788af,null));};exports[_0xffb8('0x53')]=function(_0x440b02,_0x56c2d9,_0x457cb5){var _0xabb2ac={};var _0x22e39e={};var _0x14e724;var _0x2aee32;return db[_0xffb8('0x32')]['findOne']({'where':{'id':_0x440b02[_0xffb8('0x48')]['id']}})[_0xffb8('0x1a')](handleEntityNotFound(_0x56c2d9,null))['then'](function(_0x17e388){if(_0x17e388){_0x14e724=_0x17e388;_0x22e39e['model']=_[_0xffb8('0x49')](db[_0xffb8('0x51')][_0xffb8('0x33')]);_0x22e39e[_0xffb8('0x36')]=_[_0xffb8('0x49')](_0x440b02['query']);_0x22e39e[_0xffb8('0x37')]=_[_0xffb8('0x4a')](_0x22e39e['model'],_0x22e39e['query']);_0xabb2ac[_0xffb8('0x39')]=_[_0xffb8('0x4a')](_0x22e39e['model'],qs[_0xffb8('0x3a')](_0x440b02['query']['fields']));_0xabb2ac[_0xffb8('0x39')]=_0xabb2ac[_0xffb8('0x39')][_0xffb8('0x3b')]?_0xabb2ac[_0xffb8('0x39')]:_0x22e39e['model'];_0xabb2ac['order']=qs[_0xffb8('0x3f')](_0x440b02[_0xffb8('0x36')]['sort']);_0xabb2ac['where']=qs[_0xffb8('0x37')](_[_0xffb8('0x52')](_0x440b02[_0xffb8('0x36')],_0x22e39e['filters']));if(_0x440b02['query'][_0xffb8('0x41')]){_0xabb2ac['where']=_[_0xffb8('0x42')](_0xabb2ac[_0xffb8('0x40')],{'$or':_[_0xffb8('0x31')](_0xabb2ac[_0xffb8('0x39')],function(_0x522119){var _0x5ba8ca={};_0x5ba8ca[_0x522119]={'$like':'%'+_0x440b02[_0xffb8('0x36')][_0xffb8('0x41')]+'%'};return _0x5ba8ca;})});}_0xabb2ac=_['merge']({},_0xabb2ac,_0x440b02['options']);return _0x14e724[_0xffb8('0x53')](_0xabb2ac);}})[_0xffb8('0x1a')](function(_0x1a5f57){if(_0x1a5f57){_0x2aee32=_0x1a5f57[_0xffb8('0x3b')];if(!_0x440b02[_0xffb8('0x36')][_0xffb8('0x3c')]('nolimit')){_0xabb2ac[_0xffb8('0x2a')]=qs['limit'](_0x440b02['query'][_0xffb8('0x2a')]);_0xabb2ac['offset']=qs['offset'](_0x440b02[_0xffb8('0x36')][_0xffb8('0x27')]);}return _0x14e724[_0xffb8('0x53')](_0xabb2ac);}})[_0xffb8('0x1a')](function(_0xc15b7a){if(_0xc15b7a){return _0xc15b7a?{'count':_0x2aee32,'rows':_0xc15b7a}:null;}})['then'](respondWithResult(_0x56c2d9,null))['catch'](handleError(_0x56c2d9,null));};exports[_0xffb8('0x54')]=function(_0x4db0ad,_0x4ec2b5,_0x28528c){var _0x3d4b09={};var _0x4e7663={};var _0x1c1893;var _0x4f1128;return db[_0xffb8('0x32')][_0xffb8('0x50')]({'where':{'id':_0x4db0ad['params']['id']}})[_0xffb8('0x1a')](handleEntityNotFound(_0x4ec2b5,null))['then'](function(_0x474ebe){if(_0x474ebe){_0x1c1893=_0x474ebe;_0x4e7663[_0xffb8('0x38')]=_[_0xffb8('0x49')](db[_0xffb8('0x51')][_0xffb8('0x33')]);_0x4e7663[_0xffb8('0x36')]=_[_0xffb8('0x49')](_0x4db0ad[_0xffb8('0x36')]);_0x4e7663[_0xffb8('0x37')]=_[_0xffb8('0x4a')](_0x4e7663[_0xffb8('0x38')],_0x4e7663[_0xffb8('0x36')]);_0x3d4b09[_0xffb8('0x39')]=_['intersection'](_0x4e7663[_0xffb8('0x38')],qs[_0xffb8('0x3a')](_0x4db0ad[_0xffb8('0x36')]['fields']));_0x3d4b09['attributes']=_0x3d4b09[_0xffb8('0x39')][_0xffb8('0x3b')]?_0x3d4b09[_0xffb8('0x39')]:_0x4e7663[_0xffb8('0x38')];_0x3d4b09[_0xffb8('0x3e')]=qs['sort'](_0x4db0ad[_0xffb8('0x36')][_0xffb8('0x3f')]);_0x3d4b09[_0xffb8('0x40')]=qs[_0xffb8('0x37')](_[_0xffb8('0x52')](_0x4db0ad[_0xffb8('0x36')],_0x4e7663[_0xffb8('0x37')]));if(_0x4db0ad[_0xffb8('0x36')]['filter']){_0x3d4b09[_0xffb8('0x40')]=_[_0xffb8('0x42')](_0x3d4b09[_0xffb8('0x40')],{'$or':_[_0xffb8('0x31')](_0x3d4b09[_0xffb8('0x39')],function(_0x1ec8dd){var _0x37c662={};_0x37c662[_0x1ec8dd]={'$like':'%'+_0x4db0ad[_0xffb8('0x36')][_0xffb8('0x41')]+'%'};return _0x37c662;})});}_0x3d4b09=_[_0xffb8('0x42')]({},_0x3d4b09,_0x4db0ad[_0xffb8('0x43')]);return _0x1c1893['getDescriptions'](_0x3d4b09);}})[_0xffb8('0x1a')](function(_0x352a47){if(_0x352a47){_0x4f1128=_0x352a47[_0xffb8('0x3b')];if(!_0x4db0ad['query'][_0xffb8('0x3c')]('nolimit')){_0x3d4b09[_0xffb8('0x2a')]=qs['limit'](_0x4db0ad[_0xffb8('0x36')][_0xffb8('0x2a')]);_0x3d4b09[_0xffb8('0x27')]=qs[_0xffb8('0x27')](_0x4db0ad[_0xffb8('0x36')][_0xffb8('0x27')]);}return _0x1c1893[_0xffb8('0x54')](_0x3d4b09);}})['then'](function(_0x2aadab){if(_0x2aadab){return _0x2aadab?{'count':_0x4f1128,'rows':_0x2aadab}:null;}})['then'](respondWithResult(_0x4ec2b5,null))[_0xffb8('0x22')](handleError(_0x4ec2b5,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index 0d9609a..e193f8b 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 _0x95a5=['moment','bluebird','request-promise','path','./intSalesforceConfiguration.attributes','exports','int_salesforce_configurations','util','../../config/logger','api'];(function(_0x4e8286,_0x4eaeb4){var _0x44a440=function(_0x5e0907){while(--_0x5e0907){_0x4e8286['push'](_0x4e8286['shift']());}};_0x44a440(++_0x4eaeb4);}(_0x95a5,0x1bf));var _0x595a=function(_0xe73cfc,_0x2db35f){_0xe73cfc=_0xe73cfc-0x0;var _0x569edf=_0x95a5[_0xe73cfc];return _0x569edf;};'use strict';var _=require('lodash');var util=require(_0x595a('0x0'));var logger=require(_0x595a('0x1'))(_0x595a('0x2'));var moment=require(_0x595a('0x3'));var BPromise=require(_0x595a('0x4'));var rp=require(_0x595a('0x5'));var fs=require('fs');var path=require(_0x595a('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x595a('0x7'));module[_0x595a('0x8')]=function(_0x5a95ee,_0x4d7f7b){return _0x5a95ee['define']('SalesforceConfiguration',attributes,{'tableName':_0x595a('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa75a=['../../config/logger','api','bluebird','request-promise','../../config/environment','./intSalesforceConfiguration.attributes','exports','SalesforceConfiguration','util'];(function(_0x2c1e7a,_0x155f86){var _0xcacb4f=function(_0x2b2eb3){while(--_0x2b2eb3){_0x2c1e7a['push'](_0x2c1e7a['shift']());}};_0xcacb4f(++_0x155f86);}(_0xa75a,0xe9));var _0xaa75=function(_0x171a8a,_0x2c6407){_0x171a8a=_0x171a8a-0x0;var _0x178cbc=_0xa75a[_0x171a8a];return _0x178cbc;};'use strict';var _=require('lodash');var util=require(_0xaa75('0x0'));var logger=require(_0xaa75('0x1'))(_0xaa75('0x2'));var moment=require('moment');var BPromise=require(_0xaa75('0x3'));var rp=require(_0xaa75('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xaa75('0x5'));var attributes=require(_0xaa75('0x6'));module[_0xaa75('0x7')]=function(_0x308351,_0x776d26){return _0x308351['define'](_0xaa75('0x8'),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 d998600..538d222 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 _0x9e3e=['rpc','../../config/environment','jayson/promise','client','then','info','debug','request\x20sent','error','code','message','SalesforceConfiguration,\x20%s,\x20%s','result','catch','moment','ioredis','../../mysqldb','../../config/logger'];(function(_0x35f7f5,_0x4e2ee1){var _0x5567a4=function(_0x3e5df0){while(--_0x3e5df0){_0x35f7f5['push'](_0x35f7f5['shift']());}};_0x5567a4(++_0x4e2ee1);}(_0x9e3e,0x68));var _0xe9e3=function(_0x437808,_0x5d54e4){_0x437808=_0x437808-0x0;var _0x3752ac=_0x9e3e[_0x437808];return _0x3752ac;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe9e3('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe9e3('0x1'));var db=require(_0xe9e3('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xe9e3('0x3'))(_0xe9e3('0x4'));var config=require(_0xe9e3('0x5'));var jayson=require(_0xe9e3('0x6'));var client=jayson[_0xe9e3('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x58aa0a,_0x2cddd5,_0x1590ee){return new BPromise(function(_0x2999a0,_0x494db5){return client['request'](_0x58aa0a,_0x1590ee)[_0xe9e3('0x8')](function(_0x360ce2){logger[_0xe9e3('0x9')]('SalesforceConfiguration,\x20%s,\x20%s',_0x2cddd5,'request\x20sent');logger[_0xe9e3('0xa')]('SalesforceConfiguration,\x20%s,\x20%s,\x20%s',_0x2cddd5,_0xe9e3('0xb'),JSON['stringify'](_0x360ce2));if(_0x360ce2['error']){if(_0x360ce2[_0xe9e3('0xc')][_0xe9e3('0xd')]===0x1f4){logger['error']('SalesforceConfiguration,\x20%s,\x20%s',_0x2cddd5,_0x360ce2['error'][_0xe9e3('0xe')]);return _0x494db5(_0x360ce2[_0xe9e3('0xc')][_0xe9e3('0xe')]);}logger['error']('SalesforceConfiguration,\x20%s,\x20%s',_0x2cddd5,_0x360ce2[_0xe9e3('0xc')][_0xe9e3('0xe')]);return _0x2999a0(_0x360ce2[_0xe9e3('0xc')][_0xe9e3('0xe')]);}else{logger[_0xe9e3('0x9')](_0xe9e3('0xf'),_0x2cddd5,_0xe9e3('0xb'));_0x2999a0(_0x360ce2[_0xe9e3('0x10')]['message']);}})[_0xe9e3('0x11')](function(_0x69e3cb){logger[_0xe9e3('0xc')](_0xe9e3('0xf'),_0x2cddd5,_0x69e3cb);_0x494db5(_0x69e3cb);});});} \ No newline at end of file +var _0xbeb3=['../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','randomstring','ioredis'];(function(_0x1f194e,_0x197a04){var _0x4c62bd=function(_0x21a2db){while(--_0x21a2db){_0x1f194e['push'](_0x1f194e['shift']());}};_0x4c62bd(++_0x197a04);}(_0xbeb3,0x69));var _0x3beb=function(_0x3f3f06,_0x581e5b){_0x3f3f06=_0x3f3f06-0x0;var _0x140feb=_0xbeb3[_0x3f3f06];return _0x140feb;};'use strict';var _=require(_0x3beb('0x0'));var util=require(_0x3beb('0x1'));var moment=require(_0x3beb('0x2'));var BPromise=require('bluebird');var rs=require(_0x3beb('0x3'));var fs=require('fs');var Redis=require(_0x3beb('0x4'));var db=require(_0x3beb('0x5'))['db'];var utils=require(_0x3beb('0x6'));var logger=require(_0x3beb('0x7'))(_0x3beb('0x8'));var config=require('../../config/environment');var jayson=require(_0x3beb('0x9'));var client=jayson[_0x3beb('0xa')][_0x3beb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2f2a1b,_0x68994c,_0x3d3f50){return new BPromise(function(_0x1688f1,_0x54d761){return client[_0x3beb('0xc')](_0x2f2a1b,_0x3d3f50)['then'](function(_0x3501be){logger[_0x3beb('0xd')](_0x3beb('0xe'),_0x68994c,_0x3beb('0xf'));logger['debug'](_0x3beb('0x10'),_0x68994c,_0x3beb('0xf'),JSON[_0x3beb('0x11')](_0x3501be));if(_0x3501be[_0x3beb('0x12')]){if(_0x3501be[_0x3beb('0x12')][_0x3beb('0x13')]===0x1f4){logger[_0x3beb('0x12')](_0x3beb('0xe'),_0x68994c,_0x3501be[_0x3beb('0x12')][_0x3beb('0x14')]);return _0x54d761(_0x3501be[_0x3beb('0x12')][_0x3beb('0x14')]);}logger['error']('SalesforceConfiguration,\x20%s,\x20%s',_0x68994c,_0x3501be[_0x3beb('0x12')][_0x3beb('0x14')]);return _0x1688f1(_0x3501be[_0x3beb('0x12')][_0x3beb('0x14')]);}else{logger[_0x3beb('0xd')](_0x3beb('0xe'),_0x68994c,_0x3beb('0xf'));_0x1688f1(_0x3501be[_0x3beb('0x15')]['message']);}})['catch'](function(_0x8b00fa){logger['error'](_0x3beb('0xe'),_0x68994c,_0x8b00fa);_0x54d761(_0x8b00fa);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index a7f7523..169d7e4 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 _0xc4b5=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceField.controller','get','isAuthenticated','/:id','show','post','put','update','delete','destroy','multer','util'];(function(_0x14e10d,_0x5e311c){var _0x34af1c=function(_0x2a8ac6){while(--_0x2a8ac6){_0x14e10d['push'](_0x14e10d['shift']());}};_0x34af1c(++_0x5e311c);}(_0xc4b5,0x18a));var _0x5c4b=function(_0x3c26c4,_0x5a8577){_0x3c26c4=_0x3c26c4-0x0;var _0x57bcb4=_0xc4b5[_0x3c26c4];return _0x57bcb4;};'use strict';var multer=require(_0x5c4b('0x0'));var util=require(_0x5c4b('0x1'));var path=require('path');var timeout=require(_0x5c4b('0x2'));var express=require('express');var router=express[_0x5c4b('0x3')]();var fs_extra=require(_0x5c4b('0x4'));var auth=require(_0x5c4b('0x5'));var interaction=require(_0x5c4b('0x6'));var config=require(_0x5c4b('0x7'));var controller=require(_0x5c4b('0x8'));router[_0x5c4b('0x9')]('/',auth[_0x5c4b('0xa')](),controller['index']);router[_0x5c4b('0x9')](_0x5c4b('0xb'),auth['isAuthenticated'](),controller[_0x5c4b('0xc')]);router[_0x5c4b('0xd')]('/',auth[_0x5c4b('0xa')](),controller['create']);router[_0x5c4b('0xe')]('/:id',auth[_0x5c4b('0xa')](),controller[_0x5c4b('0xf')]);router[_0x5c4b('0x10')](_0x5c4b('0xb'),auth[_0x5c4b('0xa')](),controller[_0x5c4b('0x11')]);module['exports']=router; \ No newline at end of file +var _0x842f=['create','update','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../config/environment','./intSalesforceField.controller','get','isAuthenticated','index','/:id','post'];(function(_0x172747,_0x1732bd){var _0x509692=function(_0x448c56){while(--_0x448c56){_0x172747['push'](_0x172747['shift']());}};_0x509692(++_0x1732bd);}(_0x842f,0x8c));var _0xf842=function(_0x336264,_0x32e1d9){_0x336264=_0x336264-0x0;var _0x53cf91=_0x842f[_0x336264];return _0x53cf91;};'use strict';var multer=require(_0xf842('0x0'));var util=require(_0xf842('0x1'));var path=require(_0xf842('0x2'));var timeout=require(_0xf842('0x3'));var express=require('express');var router=express[_0xf842('0x4')]();var fs_extra=require(_0xf842('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xf842('0x6'));var controller=require(_0xf842('0x7'));router[_0xf842('0x8')]('/',auth[_0xf842('0x9')](),controller[_0xf842('0xa')]);router['get'](_0xf842('0xb'),auth[_0xf842('0x9')](),controller['show']);router[_0xf842('0xc')]('/',auth[_0xf842('0x9')](),controller[_0xf842('0xd')]);router['put'](_0xf842('0xb'),auth[_0xf842('0x9')](),controller[_0xf842('0xe')]);router[_0xf842('0xf')]('/:id',auth[_0xf842('0x9')](),controller['destroy']);module[_0xf842('0x10')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index 3c2d6b4..1c33d6e 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 _0x169b=['STRING','variable','sequelize','ENUM','string','customVariable','keyValue','picklist'];(function(_0x286e23,_0x389e1b){var _0x293b5c=function(_0x1f105a){while(--_0x1f105a){_0x286e23['push'](_0x286e23['shift']());}};_0x293b5c(++_0x389e1b);}(_0x169b,0x1aa));var _0xb169=function(_0x4081f7,_0x5b2d46){_0x4081f7=_0x4081f7-0x0;var _0x37cbd1=_0x169b[_0x4081f7];return _0x37cbd1;};'use strict';var Sequelize=require(_0xb169('0x0'));module['exports']={'type':{'type':Sequelize[_0xb169('0x1')](_0xb169('0x2'),'variable',_0xb169('0x3'),_0xb169('0x4'),_0xb169('0x5')),'defaultValue':_0xb169('0x2')},'content':{'type':Sequelize[_0xb169('0x6')]},'key':{'type':Sequelize[_0xb169('0x6')]},'keyType':{'type':Sequelize[_0xb169('0x1')](_0xb169('0x2'),_0xb169('0x7'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xb169('0x6')]},'variableName':{'type':Sequelize[_0xb169('0x6')]}}; \ No newline at end of file +var _0xdc28=['customVariable','keyValue','picklist','STRING','exports','ENUM','string','variable'];(function(_0x2ce34e,_0x2d2925){var _0x5be93d=function(_0xeae093){while(--_0xeae093){_0x2ce34e['push'](_0x2ce34e['shift']());}};_0x5be93d(++_0x2d2925);}(_0xdc28,0x114));var _0x8dc2=function(_0x3aa58c,_0x188e40){_0x3aa58c=_0x3aa58c-0x0;var _0x45b783=_0xdc28[_0x3aa58c];return _0x45b783;};'use strict';var Sequelize=require('sequelize');module[_0x8dc2('0x0')]={'type':{'type':Sequelize[_0x8dc2('0x1')](_0x8dc2('0x2'),_0x8dc2('0x3'),_0x8dc2('0x4'),_0x8dc2('0x5'),_0x8dc2('0x6')),'defaultValue':_0x8dc2('0x2')},'content':{'type':Sequelize[_0x8dc2('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x8dc2('0x1')](_0x8dc2('0x2'),_0x8dc2('0x3'),_0x8dc2('0x4'))},'keyContent':{'type':Sequelize[_0x8dc2('0x7')]},'idField':{'type':Sequelize['STRING']},'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 ed6b7a2..cdfba79 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 _0x37d9=['where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','squel','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','undefined','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','end','name','index','map','SalesforceField','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','nolimit','order','sort'];(function(_0x25655f,_0x44fcc0){var _0x40d1af=function(_0x18254b){while(--_0x18254b){_0x25655f['push'](_0x25655f['shift']());}};_0x40d1af(++_0x44fcc0);}(_0x37d9,0xee));var _0x937d=function(_0x25e634,_0x214a83){_0x25e634=_0x25e634-0x0;var _0x1949a4=_0x37d9[_0x25e634];return _0x1949a4;};'use strict';var emlformat=require(_0x937d('0x0'));var rimraf=require(_0x937d('0x1'));var zipdir=require(_0x937d('0x2'));var jsonpatch=require(_0x937d('0x3'));var rp=require(_0x937d('0x4'));var moment=require('moment');var BPromise=require(_0x937d('0x5'));var Mustache=require(_0x937d('0x6'));var util=require(_0x937d('0x7'));var path=require(_0x937d('0x8'));var sox=require(_0x937d('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x937d('0xa'));var crypto=require('crypto');var jsforce=require(_0x937d('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x937d('0xc'));var querystring=require(_0x937d('0xd'));var Papa=require(_0x937d('0xe'));var Redis=require(_0x937d('0xf'));var authService=require(_0x937d('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x937d('0x11'));var logger=require(_0x937d('0x12'))(_0x937d('0x13'));var utils=require(_0x937d('0x14'));var config=require(_0x937d('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x937d('0x16'))['db'];function respondWithStatusCode(_0x35b846,_0x2ac079){_0x2ac079=_0x2ac079||0xcc;return function(_0x25857f){if(_0x25857f){return _0x35b846[_0x937d('0x17')](_0x2ac079);}return _0x35b846[_0x937d('0x18')](_0x2ac079)['end']();};}function respondWithResult(_0x32155c,_0x2dc3a7){_0x2dc3a7=_0x2dc3a7||0xc8;return function(_0x2d8a57){if(_0x2d8a57){return _0x32155c[_0x937d('0x18')](_0x2dc3a7)['json'](_0x2d8a57);}};}function respondWithFilteredResult(_0x4f3656,_0x2be648){return function(_0x420f2b){if(_0x420f2b){var _0x17661b=typeof _0x2be648['offset']===_0x937d('0x19')&&typeof _0x2be648['limit']===_0x937d('0x19');var _0xafff=_0x420f2b[_0x937d('0x1a')];var _0x18f854=_0x17661b?0x0:_0x2be648['offset'];var _0x54d1f0=_0x17661b?_0x420f2b['count']:_0x2be648[_0x937d('0x1b')]+_0x2be648[_0x937d('0x1c')];var _0x43a4c5;if(_0x54d1f0>=_0xafff){_0x54d1f0=_0xafff;_0x43a4c5=0xc8;}else{_0x43a4c5=0xce;}_0x4f3656[_0x937d('0x18')](_0x43a4c5);return _0x4f3656[_0x937d('0x1d')](_0x937d('0x1e'),_0x18f854+'-'+_0x54d1f0+'/'+_0xafff)[_0x937d('0x1f')](_0x420f2b);}return null;};}function patchUpdates(_0x1a1445){return function(_0x3679e3){try{jsonpatch[_0x937d('0x20')](_0x3679e3,_0x1a1445,!![]);}catch(_0x3b6871){return BPromise[_0x937d('0x21')](_0x3b6871);}return _0x3679e3[_0x937d('0x22')]();};}function saveUpdates(_0x25ca27,_0xeaff79){return function(_0x56aff7){if(_0x56aff7){return _0x56aff7[_0x937d('0x23')](_0x25ca27)[_0x937d('0x24')](function(_0x3d74a5){return _0x3d74a5;});}return null;};}function removeEntity(_0x5d2fab,_0x13b1fa){return function(_0x2da2f7){if(_0x2da2f7){return _0x2da2f7[_0x937d('0x25')]()[_0x937d('0x24')](function(){_0x5d2fab['status'](0xcc)[_0x937d('0x26')]();});}};}function handleEntityNotFound(_0x788474,_0x9c3eb){return function(_0x28888b){if(!_0x28888b){_0x788474[_0x937d('0x17')](0x194);}return _0x28888b;};}function handleError(_0x95e8ba,_0x579722){_0x579722=_0x579722||0x1f4;return function(_0x44d9d9){logger['error'](_0x44d9d9['stack']);if(_0x44d9d9[_0x937d('0x27')]){delete _0x44d9d9[_0x937d('0x27')];}_0x95e8ba[_0x937d('0x18')](_0x579722)['send'](_0x44d9d9);};}exports[_0x937d('0x28')]=function(_0x20ef99,_0x30d294){var _0x3b53bb={},_0x4e002c={},_0x576864={'count':0x0,'rows':[]};var _0x4dee10=_[_0x937d('0x29')](db[_0x937d('0x2a')][_0x937d('0x2b')],function(_0x500709){return{'name':_0x500709[_0x937d('0x2c')],'type':_0x500709[_0x937d('0x2d')][_0x937d('0x2e')]};});_0x4e002c['model']=_[_0x937d('0x29')](_0x4dee10,'name');_0x4e002c[_0x937d('0x2f')]=_[_0x937d('0x30')](_0x20ef99[_0x937d('0x2f')]);_0x4e002c[_0x937d('0x31')]=_[_0x937d('0x32')](_0x4e002c['model'],_0x4e002c[_0x937d('0x2f')]);_0x3b53bb['attributes']=_[_0x937d('0x32')](_0x4e002c[_0x937d('0x33')],qs[_0x937d('0x34')](_0x20ef99['query']['fields']));_0x3b53bb[_0x937d('0x35')]=_0x3b53bb[_0x937d('0x35')][_0x937d('0x36')]?_0x3b53bb[_0x937d('0x35')]:_0x4e002c['model'];if(!_0x20ef99[_0x937d('0x2f')]['hasOwnProperty'](_0x937d('0x37'))){_0x3b53bb['limit']=qs['limit'](_0x20ef99[_0x937d('0x2f')]['limit']);_0x3b53bb['offset']=qs['offset'](_0x20ef99[_0x937d('0x2f')][_0x937d('0x1b')]);}_0x3b53bb[_0x937d('0x38')]=qs[_0x937d('0x39')](_0x20ef99[_0x937d('0x2f')][_0x937d('0x39')]);_0x3b53bb[_0x937d('0x3a')]=qs['filters'](_[_0x937d('0x3b')](_0x20ef99[_0x937d('0x2f')],_0x4e002c['filters']),_0x4dee10);if(_0x20ef99[_0x937d('0x2f')][_0x937d('0x3c')]){_0x3b53bb[_0x937d('0x3a')]=_['merge'](_0x3b53bb[_0x937d('0x3a')],{'$or':_[_0x937d('0x29')](_0x4dee10,function(_0x3aa06a){if(_0x3aa06a['type']!==_0x937d('0x3d')){var _0x1aaee6={};_0x1aaee6[_0x3aa06a['name']]={'$like':'%'+_0x20ef99['query'][_0x937d('0x3c')]+'%'};return _0x1aaee6;}})});}_0x3b53bb=_[_0x937d('0x3e')]({},_0x3b53bb,_0x20ef99[_0x937d('0x3f')]);var _0x33d82a={'where':_0x3b53bb[_0x937d('0x3a')]};return db[_0x937d('0x2a')]['count'](_0x33d82a)['then'](function(_0x56cbe7){_0x576864['count']=_0x56cbe7;if(_0x20ef99[_0x937d('0x2f')][_0x937d('0x40')]){_0x3b53bb[_0x937d('0x41')]=[{'all':!![]}];}return db['SalesforceField'][_0x937d('0x42')](_0x3b53bb);})['then'](function(_0x1a10b0){_0x576864[_0x937d('0x43')]=_0x1a10b0;return _0x576864;})[_0x937d('0x24')](respondWithFilteredResult(_0x30d294,_0x3b53bb))[_0x937d('0x44')](handleError(_0x30d294,null));};exports[_0x937d('0x45')]=function(_0x276d60,_0x5cde8f){var _0x5b3d98={'raw':!![],'where':{'id':_0x276d60[_0x937d('0x46')]['id']}},_0x2a49b4={};_0x2a49b4[_0x937d('0x33')]=_[_0x937d('0x30')](db['SalesforceField']['rawAttributes']);_0x2a49b4[_0x937d('0x2f')]=_['keys'](_0x276d60[_0x937d('0x2f')]);_0x2a49b4[_0x937d('0x31')]=_['intersection'](_0x2a49b4[_0x937d('0x33')],_0x2a49b4[_0x937d('0x2f')]);_0x5b3d98[_0x937d('0x35')]=_['intersection'](_0x2a49b4['model'],qs[_0x937d('0x34')](_0x276d60[_0x937d('0x2f')]['fields']));_0x5b3d98[_0x937d('0x35')]=_0x5b3d98['attributes']['length']?_0x5b3d98['attributes']:_0x2a49b4[_0x937d('0x33')];if(_0x276d60[_0x937d('0x2f')][_0x937d('0x40')]){_0x5b3d98[_0x937d('0x41')]=[{'all':!![]}];}_0x5b3d98=_[_0x937d('0x3e')]({},_0x5b3d98,_0x276d60['options']);return db[_0x937d('0x2a')]['find'](_0x5b3d98)[_0x937d('0x24')](handleEntityNotFound(_0x5cde8f,null))[_0x937d('0x24')](respondWithResult(_0x5cde8f,null))['catch'](handleError(_0x5cde8f,null));};exports[_0x937d('0x47')]=function(_0x1e803c,_0x8eec0c){return db[_0x937d('0x2a')][_0x937d('0x47')](_0x1e803c[_0x937d('0x48')],{})[_0x937d('0x24')](respondWithResult(_0x8eec0c,0xc9))[_0x937d('0x44')](handleError(_0x8eec0c,null));};exports[_0x937d('0x23')]=function(_0xfc14fa,_0x269dca){if(_0xfc14fa['body']['id']){delete _0xfc14fa[_0x937d('0x48')]['id'];}return db[_0x937d('0x2a')][_0x937d('0x49')]({'where':{'id':_0xfc14fa[_0x937d('0x46')]['id']}})[_0x937d('0x24')](handleEntityNotFound(_0x269dca,null))[_0x937d('0x24')](saveUpdates(_0xfc14fa['body'],null))[_0x937d('0x24')](respondWithResult(_0x269dca,null))[_0x937d('0x44')](handleError(_0x269dca,null));};exports[_0x937d('0x25')]=function(_0x42bbfd,_0xe28fa3){return db[_0x937d('0x2a')]['find']({'where':{'id':_0x42bbfd['params']['id']}})[_0x937d('0x24')](handleEntityNotFound(_0xe28fa3,null))['then'](removeEntity(_0xe28fa3,null))[_0x937d('0x44')](handleError(_0xe28fa3,null));}; \ No newline at end of file +var _0xadbd=['jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','json','apply','save','then','error','name','send','index','map','SalesforceField','rawAttributes','type','model','query','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','options','include','findAll','catch','show','params','keys','length','includeAll','find','create','body','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto'];(function(_0x3c9a79,_0x3795f8){var _0x4f7647=function(_0x312d28){while(--_0x312d28){_0x3c9a79['push'](_0x3c9a79['shift']());}};_0x4f7647(++_0x3795f8);}(_0xadbd,0x1a7));var _0xdadb=function(_0x3b6487,_0x5df255){_0x3b6487=_0x3b6487-0x0;var _0xf60189=_0xadbd[_0x3b6487];return _0xf60189;};'use strict';var emlformat=require(_0xdadb('0x0'));var rimraf=require(_0xdadb('0x1'));var zipdir=require(_0xdadb('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xdadb('0x3'));var moment=require(_0xdadb('0x4'));var BPromise=require(_0xdadb('0x5'));var Mustache=require(_0xdadb('0x6'));var util=require('util');var path=require(_0xdadb('0x7'));var sox=require(_0xdadb('0x8'));var csv=require(_0xdadb('0x9'));var ejs=require(_0xdadb('0xa'));var fs=require('fs');var fs_extra=require(_0xdadb('0xb'));var _=require(_0xdadb('0xc'));var squel=require(_0xdadb('0xd'));var crypto=require(_0xdadb('0xe'));var jsforce=require(_0xdadb('0xf'));var deskjs=require(_0xdadb('0x10'));var toCsv=require('to-csv');var querystring=require(_0xdadb('0x11'));var Papa=require(_0xdadb('0x12'));var Redis=require(_0xdadb('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xdadb('0x14'));var hardwareService=require(_0xdadb('0x15'));var logger=require(_0xdadb('0x16'))(_0xdadb('0x17'));var utils=require(_0xdadb('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xdadb('0x19'));var db=require(_0xdadb('0x1a'))['db'];function respondWithStatusCode(_0x33b128,_0x2b3c1f){_0x2b3c1f=_0x2b3c1f||0xcc;return function(_0x552c34){if(_0x552c34){return _0x33b128[_0xdadb('0x1b')](_0x2b3c1f);}return _0x33b128[_0xdadb('0x1c')](_0x2b3c1f)[_0xdadb('0x1d')]();};}function respondWithResult(_0x1ab232,_0x512056){_0x512056=_0x512056||0xc8;return function(_0x37945a){if(_0x37945a){return _0x1ab232[_0xdadb('0x1c')](_0x512056)['json'](_0x37945a);}};}function respondWithFilteredResult(_0x42527e,_0x3af4d6){return function(_0x5cbc8c){if(_0x5cbc8c){var _0x34f8bd=typeof _0x3af4d6[_0xdadb('0x1e')]===_0xdadb('0x1f')&&typeof _0x3af4d6[_0xdadb('0x20')]===_0xdadb('0x1f');var _0x436bee=_0x5cbc8c['count'];var _0x5a6638=_0x34f8bd?0x0:_0x3af4d6[_0xdadb('0x1e')];var _0x2f0bbd=_0x34f8bd?_0x5cbc8c[_0xdadb('0x21')]:_0x3af4d6[_0xdadb('0x1e')]+_0x3af4d6['limit'];var _0x561d8e;if(_0x2f0bbd>=_0x436bee){_0x2f0bbd=_0x436bee;_0x561d8e=0xc8;}else{_0x561d8e=0xce;}_0x42527e[_0xdadb('0x1c')](_0x561d8e);return _0x42527e[_0xdadb('0x22')]('Content-Range',_0x5a6638+'-'+_0x2f0bbd+'/'+_0x436bee)[_0xdadb('0x23')](_0x5cbc8c);}return null;};}function patchUpdates(_0x4e849b){return function(_0x4897c4){try{jsonpatch[_0xdadb('0x24')](_0x4897c4,_0x4e849b,!![]);}catch(_0xc0d8e4){return BPromise['reject'](_0xc0d8e4);}return _0x4897c4[_0xdadb('0x25')]();};}function saveUpdates(_0x189939,_0x4314cc){return function(_0x15c67d){if(_0x15c67d){return _0x15c67d['update'](_0x189939)[_0xdadb('0x26')](function(_0x27d0c0){return _0x27d0c0;});}return null;};}function removeEntity(_0x344304,_0x1318bd){return function(_0x5f2370){if(_0x5f2370){return _0x5f2370['destroy']()[_0xdadb('0x26')](function(){_0x344304[_0xdadb('0x1c')](0xcc)[_0xdadb('0x1d')]();});}};}function handleEntityNotFound(_0x5907c8,_0x67f237){return function(_0x5556d7){if(!_0x5556d7){_0x5907c8['sendStatus'](0x194);}return _0x5556d7;};}function handleError(_0x31f8a9,_0xb65310){_0xb65310=_0xb65310||0x1f4;return function(_0x4ecff7){logger[_0xdadb('0x27')](_0x4ecff7['stack']);if(_0x4ecff7[_0xdadb('0x28')]){delete _0x4ecff7['name'];}_0x31f8a9[_0xdadb('0x1c')](_0xb65310)[_0xdadb('0x29')](_0x4ecff7);};}exports[_0xdadb('0x2a')]=function(_0x55e726,_0x37394a){var _0xdccaf6={},_0x1f3e21={},_0x100eaa={'count':0x0,'rows':[]};var _0x497cdf=_[_0xdadb('0x2b')](db[_0xdadb('0x2c')][_0xdadb('0x2d')],function(_0x34fd45){return{'name':_0x34fd45['fieldName'],'type':_0x34fd45[_0xdadb('0x2e')]['key']};});_0x1f3e21['model']=_[_0xdadb('0x2b')](_0x497cdf,_0xdadb('0x28'));_0x1f3e21['query']=_['keys'](_0x55e726['query']);_0x1f3e21['filters']=_['intersection'](_0x1f3e21[_0xdadb('0x2f')],_0x1f3e21[_0xdadb('0x30')]);_0xdccaf6[_0xdadb('0x31')]=_[_0xdadb('0x32')](_0x1f3e21[_0xdadb('0x2f')],qs[_0xdadb('0x33')](_0x55e726['query'][_0xdadb('0x33')]));_0xdccaf6[_0xdadb('0x31')]=_0xdccaf6[_0xdadb('0x31')]['length']?_0xdccaf6[_0xdadb('0x31')]:_0x1f3e21[_0xdadb('0x2f')];if(!_0x55e726['query'][_0xdadb('0x34')](_0xdadb('0x35'))){_0xdccaf6['limit']=qs[_0xdadb('0x20')](_0x55e726[_0xdadb('0x30')]['limit']);_0xdccaf6[_0xdadb('0x1e')]=qs[_0xdadb('0x1e')](_0x55e726['query'][_0xdadb('0x1e')]);}_0xdccaf6[_0xdadb('0x36')]=qs[_0xdadb('0x37')](_0x55e726['query'][_0xdadb('0x37')]);_0xdccaf6[_0xdadb('0x38')]=qs['filters'](_[_0xdadb('0x39')](_0x55e726[_0xdadb('0x30')],_0x1f3e21[_0xdadb('0x3a')]),_0x497cdf);if(_0x55e726[_0xdadb('0x30')][_0xdadb('0x3b')]){_0xdccaf6[_0xdadb('0x38')]=_[_0xdadb('0x3c')](_0xdccaf6['where'],{'$or':_['map'](_0x497cdf,function(_0x59883b){if(_0x59883b['type']!=='VIRTUAL'){var _0x232417={};_0x232417[_0x59883b[_0xdadb('0x28')]]={'$like':'%'+_0x55e726['query'][_0xdadb('0x3b')]+'%'};return _0x232417;}})});}_0xdccaf6=_[_0xdadb('0x3c')]({},_0xdccaf6,_0x55e726[_0xdadb('0x3d')]);var _0x406e04={'where':_0xdccaf6[_0xdadb('0x38')]};return db[_0xdadb('0x2c')][_0xdadb('0x21')](_0x406e04)[_0xdadb('0x26')](function(_0x4b5c28){_0x100eaa[_0xdadb('0x21')]=_0x4b5c28;if(_0x55e726[_0xdadb('0x30')]['includeAll']){_0xdccaf6[_0xdadb('0x3e')]=[{'all':!![]}];}return db['SalesforceField'][_0xdadb('0x3f')](_0xdccaf6);})[_0xdadb('0x26')](function(_0x4b0513){_0x100eaa['rows']=_0x4b0513;return _0x100eaa;})[_0xdadb('0x26')](respondWithFilteredResult(_0x37394a,_0xdccaf6))[_0xdadb('0x40')](handleError(_0x37394a,null));};exports[_0xdadb('0x41')]=function(_0x1a284b,_0x1719df){var _0x1a8076={'raw':!![],'where':{'id':_0x1a284b[_0xdadb('0x42')]['id']}},_0x1b47a5={};_0x1b47a5[_0xdadb('0x2f')]=_[_0xdadb('0x43')](db['SalesforceField']['rawAttributes']);_0x1b47a5[_0xdadb('0x30')]=_[_0xdadb('0x43')](_0x1a284b[_0xdadb('0x30')]);_0x1b47a5[_0xdadb('0x3a')]=_[_0xdadb('0x32')](_0x1b47a5[_0xdadb('0x2f')],_0x1b47a5[_0xdadb('0x30')]);_0x1a8076[_0xdadb('0x31')]=_[_0xdadb('0x32')](_0x1b47a5['model'],qs[_0xdadb('0x33')](_0x1a284b['query'][_0xdadb('0x33')]));_0x1a8076[_0xdadb('0x31')]=_0x1a8076['attributes'][_0xdadb('0x44')]?_0x1a8076[_0xdadb('0x31')]:_0x1b47a5['model'];if(_0x1a284b[_0xdadb('0x30')][_0xdadb('0x45')]){_0x1a8076[_0xdadb('0x3e')]=[{'all':!![]}];}_0x1a8076=_[_0xdadb('0x3c')]({},_0x1a8076,_0x1a284b['options']);return db[_0xdadb('0x2c')][_0xdadb('0x46')](_0x1a8076)[_0xdadb('0x26')](handleEntityNotFound(_0x1719df,null))['then'](respondWithResult(_0x1719df,null))[_0xdadb('0x40')](handleError(_0x1719df,null));};exports[_0xdadb('0x47')]=function(_0x545175,_0x29e4ce){return db[_0xdadb('0x2c')][_0xdadb('0x47')](_0x545175['body'],{})[_0xdadb('0x26')](respondWithResult(_0x29e4ce,0xc9))[_0xdadb('0x40')](handleError(_0x29e4ce,null));};exports['update']=function(_0x38c6b8,_0x55394c){if(_0x38c6b8[_0xdadb('0x48')]['id']){delete _0x38c6b8[_0xdadb('0x48')]['id'];}return db[_0xdadb('0x2c')][_0xdadb('0x46')]({'where':{'id':_0x38c6b8[_0xdadb('0x42')]['id']}})[_0xdadb('0x26')](handleEntityNotFound(_0x55394c,null))['then'](saveUpdates(_0x38c6b8[_0xdadb('0x48')],null))[_0xdadb('0x26')](respondWithResult(_0x55394c,null))[_0xdadb('0x40')](handleError(_0x55394c,null));};exports['destroy']=function(_0x4096c7,_0x594542){return db[_0xdadb('0x2c')][_0xdadb('0x46')]({'where':{'id':_0x4096c7['params']['id']}})[_0xdadb('0x26')](handleEntityNotFound(_0x594542,null))[_0xdadb('0x26')](removeEntity(_0x594542,null))['catch'](handleError(_0x594542,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index f30c690..ac631d8 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 _0x4849=['salesforce_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','rimraf','./intSalesforceField.attributes','exports','define','SalesforceField'];(function(_0x4c6b13,_0x113c8d){var _0xd92c12=function(_0x255af5){while(--_0x255af5){_0x4c6b13['push'](_0x4c6b13['shift']());}};_0xd92c12(++_0x113c8d);}(_0x4849,0x18b));var _0x9484=function(_0x5e9dcc,_0x278ccd){_0x5e9dcc=_0x5e9dcc-0x0;var _0x425b51=_0x4849[_0x5e9dcc];return _0x425b51;};'use strict';var _=require(_0x9484('0x0'));var util=require(_0x9484('0x1'));var logger=require(_0x9484('0x2'))(_0x9484('0x3'));var moment=require(_0x9484('0x4'));var BPromise=require(_0x9484('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x9484('0x6'));var config=require('../../config/environment');var attributes=require(_0x9484('0x7'));module[_0x9484('0x8')]=function(_0x26862d,_0xd2f6a6){return _0x26862d[_0x9484('0x9')](_0x9484('0xa'),attributes,{'tableName':'int_salesforce_fields','paranoid':![],'indexes':[{'name':_0x9484('0xb'),'fields':[_0x9484('0xc'),_0x9484('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x05d9=['moment','bluebird','request-promise','path','rimraf','./intSalesforceField.attributes','exports','define','SalesforceField','salesforce_unique_index','idField','FieldId','lodash','util','../../config/logger'];(function(_0x109594,_0xfb50dc){var _0x4334ff=function(_0xc6ea97){while(--_0xc6ea97){_0x109594['push'](_0x109594['shift']());}};_0x4334ff(++_0xfb50dc);}(_0x05d9,0x93));var _0x905d=function(_0x3f937a,_0x5958c0){_0x3f937a=_0x3f937a-0x0;var _0x4546f5=_0x05d9[_0x3f937a];return _0x4546f5;};'use strict';var _=require(_0x905d('0x0'));var util=require(_0x905d('0x1'));var logger=require(_0x905d('0x2'))('api');var moment=require(_0x905d('0x3'));var BPromise=require(_0x905d('0x4'));var rp=require(_0x905d('0x5'));var fs=require('fs');var path=require(_0x905d('0x6'));var rimraf=require(_0x905d('0x7'));var config=require('../../config/environment');var attributes=require(_0x905d('0x8'));module[_0x905d('0x9')]=function(_0x24206f,_0xeadc60){return _0x24206f[_0x905d('0xa')](_0x905d('0xb'),attributes,{'tableName':'int_salesforce_fields','paranoid':![],'indexes':[{'name':_0x905d('0xc'),'fields':[_0x905d('0xd'),_0x905d('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.rpc.js b/server/api/intSalesforceField/intSalesforceField.rpc.js index d629583..1f82d37 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 _0x0181=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','SalesforceField,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','moment'];(function(_0x113816,_0x8f81dd){var _0x2d0a50=function(_0x106e05){while(--_0x106e05){_0x113816['push'](_0x113816['shift']());}};_0x2d0a50(++_0x8f81dd);}(_0x0181,0x9e));var _0x1018=function(_0x580647,_0x43d2c3){_0x580647=_0x580647-0x0;var _0x5f0792=_0x0181[_0x580647];return _0x5f0792;};'use strict';var _=require(_0x1018('0x0'));var util=require('util');var moment=require(_0x1018('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1018('0x2'));var db=require(_0x1018('0x3'))['db'];var utils=require(_0x1018('0x4'));var logger=require(_0x1018('0x5'))(_0x1018('0x6'));var config=require(_0x1018('0x7'));var jayson=require(_0x1018('0x8'));var client=jayson[_0x1018('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x264490,_0x4e18ea,_0x535c28){return new BPromise(function(_0x13493e,_0x63b95c){return client[_0x1018('0xa')](_0x264490,_0x535c28)[_0x1018('0xb')](function(_0x1857b9){logger[_0x1018('0xc')](_0x1018('0xd'),_0x4e18ea,'request\x20sent');logger['debug']('SalesforceField,\x20%s,\x20%s,\x20%s',_0x4e18ea,_0x1018('0xe'),JSON['stringify'](_0x1857b9));if(_0x1857b9[_0x1018('0xf')]){if(_0x1857b9[_0x1018('0xf')][_0x1018('0x10')]===0x1f4){logger['error'](_0x1018('0xd'),_0x4e18ea,_0x1857b9[_0x1018('0xf')]['message']);return _0x63b95c(_0x1857b9[_0x1018('0xf')]['message']);}logger[_0x1018('0xf')](_0x1018('0xd'),_0x4e18ea,_0x1857b9['error'][_0x1018('0x11')]);return _0x13493e(_0x1857b9['error'][_0x1018('0x11')]);}else{logger[_0x1018('0xc')](_0x1018('0xd'),_0x4e18ea,_0x1018('0xe'));_0x13493e(_0x1857b9[_0x1018('0x12')][_0x1018('0x11')]);}})[_0x1018('0x13')](function(_0x3c6192){logger[_0x1018('0xf')](_0x1018('0xd'),_0x4e18ea,_0x3c6192);_0x63b95c(_0x3c6192);});});} \ No newline at end of file +var _0x15d6=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','SalesforceField,\x20%s,\x20%s','request\x20sent','SalesforceField,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment'];(function(_0x4f7234,_0xfa45a){var _0x1c11fa=function(_0x3b32b7){while(--_0x3b32b7){_0x4f7234['push'](_0x4f7234['shift']());}};_0x1c11fa(++_0xfa45a);}(_0x15d6,0x105));var _0x615d=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x15d6[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x615d('0x0'));var util=require(_0x615d('0x1'));var moment=require(_0x615d('0x2'));var BPromise=require(_0x615d('0x3'));var rs=require(_0x615d('0x4'));var fs=require('fs');var Redis=require(_0x615d('0x5'));var db=require(_0x615d('0x6'))['db'];var utils=require(_0x615d('0x7'));var logger=require(_0x615d('0x8'))('rpc');var config=require(_0x615d('0x9'));var jayson=require(_0x615d('0xa'));var client=jayson['client'][_0x615d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4e9601,_0x5a81fc,_0x270e59){return new BPromise(function(_0x373834,_0x200f11){return client[_0x615d('0xc')](_0x4e9601,_0x270e59)['then'](function(_0x24cb9e){logger[_0x615d('0xd')](_0x615d('0xe'),_0x5a81fc,_0x615d('0xf'));logger['debug'](_0x615d('0x10'),_0x5a81fc,_0x615d('0xf'),JSON['stringify'](_0x24cb9e));if(_0x24cb9e[_0x615d('0x11')]){if(_0x24cb9e['error'][_0x615d('0x12')]===0x1f4){logger[_0x615d('0x11')](_0x615d('0xe'),_0x5a81fc,_0x24cb9e[_0x615d('0x11')][_0x615d('0x13')]);return _0x200f11(_0x24cb9e[_0x615d('0x11')]['message']);}logger[_0x615d('0x11')](_0x615d('0xe'),_0x5a81fc,_0x24cb9e['error'][_0x615d('0x13')]);return _0x373834(_0x24cb9e[_0x615d('0x11')][_0x615d('0x13')]);}else{logger[_0x615d('0xd')](_0x615d('0xe'),_0x5a81fc,'request\x20sent');_0x373834(_0x24cb9e[_0x615d('0x14')][_0x615d('0x13')]);}})[_0x615d('0x15')](function(_0x176738){logger['error']('SalesforceField,\x20%s,\x20%s',_0x5a81fc,_0x176738);_0x200f11(_0x176738);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index 6111a28..9ce562d 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 _0xaec9=['/:id/configurations','/:id/fields','getFields','post','create','addConfiguration','/:id','update','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','get','isAuthenticated','index','show'];(function(_0x53c2f9,_0x588738){var _0x2a5dd4=function(_0x1f993a){while(--_0x1f993a){_0x53c2f9['push'](_0x53c2f9['shift']());}};_0x2a5dd4(++_0x588738);}(_0xaec9,0x112));var _0x9aec=function(_0x4cfc1d,_0x2c0927){_0x4cfc1d=_0x4cfc1d-0x0;var _0x1c01a0=_0xaec9[_0x4cfc1d];return _0x1c01a0;};'use strict';var multer=require('multer');var util=require(_0x9aec('0x0'));var path=require(_0x9aec('0x1'));var timeout=require(_0x9aec('0x2'));var express=require(_0x9aec('0x3'));var router=express[_0x9aec('0x4')]();var fs_extra=require(_0x9aec('0x5'));var auth=require(_0x9aec('0x6'));var interaction=require(_0x9aec('0x7'));var config=require(_0x9aec('0x8'));var controller=require(_0x9aec('0x9'));router[_0x9aec('0xa')]('/',auth[_0x9aec('0xb')](),controller[_0x9aec('0xc')]);router[_0x9aec('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x9aec('0xd')]);router['get'](_0x9aec('0xe'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0x9aec('0xa')](_0x9aec('0xf'),auth['isAuthenticated'](),controller[_0x9aec('0x10')]);router[_0x9aec('0x11')]('/',auth['isAuthenticated'](),controller[_0x9aec('0x12')]);router[_0x9aec('0x11')]('/:id/configurations',auth[_0x9aec('0xb')](),controller[_0x9aec('0x13')]);router['put'](_0x9aec('0x14'),auth[_0x9aec('0xb')](),controller[_0x9aec('0x15')]);router[_0x9aec('0x16')](_0x9aec('0x14'),auth['isAuthenticated'](),controller[_0x9aec('0x17')]);module['exports']=router; \ No newline at end of file +var _0x836e=['destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','get','index','/:id','isAuthenticated','/:id/configurations','getFields','post','create','addConfiguration','put','update','delete'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x836e,0x181));var _0xe836=function(_0x27250c,_0x3e6637){_0x27250c=_0x27250c-0x0;var _0x7e3095=_0x836e[_0x27250c];return _0x7e3095;};'use strict';var multer=require(_0xe836('0x0'));var util=require(_0xe836('0x1'));var path=require(_0xe836('0x2'));var timeout=require(_0xe836('0x3'));var express=require(_0xe836('0x4'));var router=express[_0xe836('0x5')]();var fs_extra=require(_0xe836('0x6'));var auth=require(_0xe836('0x7'));var interaction=require(_0xe836('0x8'));var config=require(_0xe836('0x9'));var controller=require(_0xe836('0xa'));router[_0xe836('0xb')]('/',auth['isAuthenticated'](),controller[_0xe836('0xc')]);router['get'](_0xe836('0xd'),auth[_0xe836('0xe')](),controller['show']);router['get'](_0xe836('0xf'),auth[_0xe836('0xe')](),controller['getConfigurations']);router[_0xe836('0xb')]('/:id/fields',auth[_0xe836('0xe')](),controller[_0xe836('0x10')]);router[_0xe836('0x11')]('/',auth[_0xe836('0xe')](),controller[_0xe836('0x12')]);router[_0xe836('0x11')](_0xe836('0xf'),auth['isAuthenticated'](),controller[_0xe836('0x13')]);router[_0xe836('0x14')](_0xe836('0xd'),auth[_0xe836('0xe')](),controller[_0xe836('0x15')]);router[_0xe836('0x16')](_0xe836('0xd'),auth[_0xe836('0xe')](),controller[_0xe836('0x17')]);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 62748a9..7f4585f 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 _0xe362=['STRING','username','sequelize'];(function(_0x94cd05,_0x2e454f){var _0x1bbb66=function(_0x18bf7f){while(--_0x18bf7f){_0x94cd05['push'](_0x94cd05['shift']());}};_0x1bbb66(++_0x2e454f);}(_0xe362,0x194));var _0x2e36=function(_0x134832,_0x4ec0f2){_0x134832=_0x134832-0x0;var _0x603c62=_0xe362[_0x134832];return _0x603c62;};'use strict';var Sequelize=require(_0x2e36('0x0'));module['exports']={'name':{'type':Sequelize[_0x2e36('0x1')]},'description':{'type':Sequelize[_0x2e36('0x1')]},'username':{'type':Sequelize['STRING'],'unique':_0x2e36('0x2')},'password':{'type':Sequelize[_0x2e36('0x1')]},'email':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING'],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x2e36('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x5a54=['STRING','remoteUri'];(function(_0x40cd68,_0x31bd67){var _0x75c915=function(_0x2f38f6){while(--_0x2f38f6){_0x40cd68['push'](_0x40cd68['shift']());}};_0x75c915(++_0x31bd67);}(_0x5a54,0x196));var _0x45a5=function(_0x39d641,_0x11e3e8){_0x39d641=_0x39d641-0x0;var _0x3f86b8=_0x5a54[_0x39d641];return _0x3f86b8;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x45a5('0x0')]},'description':{'type':Sequelize[_0x45a5('0x0')]},'username':{'type':Sequelize[_0x45a5('0x0')],'unique':'username'},'password':{'type':Sequelize[_0x45a5('0x0')]},'email':{'type':Sequelize[_0x45a5('0x0')]},'remoteUri':{'type':Sequelize[_0x45a5('0x0')],'unique':_0x45a5('0x1')},'serverUrl':{'type':Sequelize[_0x45a5('0x0')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index 27c99a8..45d8a64 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 _0x2f2b=['AccountId','channel','getDescriptions','ServicenowField','Subjects','hold_reason','subcategory','close_code','notify','severity','category','parent','made_sla','caused_by','watch_list','upon_reject','sys_updated_on','child_incidents','approval_history','number','resolved_by','sys_updated_by','user_input','sys_domain','sys_created_by','knowledge','closed_at','cmdb_ci','delivery_plan','impact','active','work_notes_list','business_service','priority','sys_domain_path','time_worked','expected_start','opened_at','business_duration','group_list','work_end','resolved_at','caller_id','approval_set','work_notes','short_description','correlation_display','assignment_group','business_stc','additional_assignee_list','description','sys_class_name','close_notes','closed_by','follow_up','parent_incident','sys_id','contact_type','incident_state','problem_id','reassignment_count','activity_due','assigned_to','sla_due','approval','comments_and_work_notes','due_date','sys_mod_count','reopen_count','sys_tags','escalation','correlation_id','location','username','password','remoteUri','serverUrl','lastIndexOf','format','%s/api/now/doc/table/schema/','incident?sysparm_display_value=all','log','incident\x20table\x20objects','assign','remove','includes','internalType','label','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','forEach','all','concat','test','statusCode','stack','Wrong\x20credentials','boolean','true','False','false','GET','sys_choice?sysparm_query=name=incident^element=','inactive','push','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','client','request','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','save','update','destroy','then','name','send','index','map','ServicenowAccount','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','options','includeAll','findAll','rows','catch','show','params','keys','include','find','create','body','findOne','ServicenowConfiguration','getConfigurations','hasOwnProperty','addConfiguration'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x2f2b,0x69));var _0xb2f2=function(_0x29df2c,_0x3517fd){_0x29df2c=_0x29df2c-0x0;var _0x31be58=_0x2f2b[_0x29df2c];return _0x31be58;};'use strict';var emlformat=require(_0xb2f2('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xb2f2('0x1'));var rp=require(_0xb2f2('0x2'));var moment=require(_0xb2f2('0x3'));var BPromise=require(_0xb2f2('0x4'));var Mustache=require(_0xb2f2('0x5'));var util=require(_0xb2f2('0x6'));var path=require('path');var sox=require(_0xb2f2('0x7'));var csv=require(_0xb2f2('0x8'));var ejs=require(_0xb2f2('0x9'));var fs=require('fs');var fs_extra=require(_0xb2f2('0xa'));var _=require(_0xb2f2('0xb'));var squel=require(_0xb2f2('0xc'));var crypto=require('crypto');var jsforce=require(_0xb2f2('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xb2f2('0x8'));var querystring=require(_0xb2f2('0xe'));var Papa=require(_0xb2f2('0xf'));var Redis=require('ioredis');var authService=require(_0xb2f2('0x10'));var qs=require(_0xb2f2('0x11'));var as=require(_0xb2f2('0x12'));var hardwareService=require(_0xb2f2('0x13'));var logger=require('../../config/logger')(_0xb2f2('0x14'));var utils=require(_0xb2f2('0x15'));var config=require(_0xb2f2('0x16'));var licenseUtil=require(_0xb2f2('0x17'));var db=require(_0xb2f2('0x18'))['db'];var integrations=require(_0xb2f2('0x19'));var jayson=require('jayson/promise');var client=jayson[_0xb2f2('0x1a')]['http']({'port':0x232a});function respondWithRpcPromise(_0xe43121,_0x2d66b4,_0x22f7ae,_0x1143f6){return new BPromise(function(_0x1425a0,_0x5379e1){var _0x1bfc22=_0x1143f6||client;return _0x1bfc22[_0xb2f2('0x1b')](_0xe43121,_0x22f7ae)['then'](function(_0x341af3){logger[_0xb2f2('0x1c')](_0xb2f2('0x1d'),_0x2d66b4,_0xb2f2('0x1e'));logger[_0xb2f2('0x1f')](_0xb2f2('0x20'),_0x2d66b4,'request\x20sent',JSON[_0xb2f2('0x21')](_0x341af3));if(_0x341af3[_0xb2f2('0x22')]){if(_0x341af3[_0xb2f2('0x22')]['code']===0x1f4){logger[_0xb2f2('0x22')]('ServicenowAccount,\x20%s,\x20%s',_0x2d66b4,_0x341af3['error'][_0xb2f2('0x23')]);return _0x5379e1(_0x341af3[_0xb2f2('0x22')][_0xb2f2('0x23')]);}logger['error']('ServicenowAccount,\x20%s,\x20%s',_0x2d66b4,_0x341af3['error'][_0xb2f2('0x23')]);return _0x1425a0(_0x341af3[_0xb2f2('0x22')][_0xb2f2('0x23')]);}else{logger[_0xb2f2('0x1c')]('ServicenowAccount,\x20%s,\x20%s',_0x2d66b4,'request\x20sent');_0x1425a0(_0x341af3[_0xb2f2('0x24')][_0xb2f2('0x23')]);}})['catch'](function(_0x526a21){logger['error'](_0xb2f2('0x1d'),_0x2d66b4,_0x526a21);_0x5379e1(_0x526a21);});});}function respondWithStatusCode(_0x3efb1d,_0x220f25){_0x220f25=_0x220f25||0xcc;return function(_0x1f62ca){if(_0x1f62ca){return _0x3efb1d[_0xb2f2('0x25')](_0x220f25);}return _0x3efb1d[_0xb2f2('0x26')](_0x220f25)[_0xb2f2('0x27')]();};}function respondWithResult(_0x62a5ed,_0x1ebad7){_0x1ebad7=_0x1ebad7||0xc8;return function(_0x591ed4){if(_0x591ed4){return _0x62a5ed['status'](_0x1ebad7)['json'](_0x591ed4);}};}function respondWithFilteredResult(_0x4cb5d8,_0x46deea){return function(_0x17c90b){if(_0x17c90b){var _0x7833fd=typeof _0x46deea[_0xb2f2('0x28')]==='undefined'&&typeof _0x46deea[_0xb2f2('0x29')]===_0xb2f2('0x2a');var _0x87a4b5=_0x17c90b[_0xb2f2('0x2b')];var _0x8863fa=_0x7833fd?0x0:_0x46deea['offset'];var _0x57dbee=_0x7833fd?_0x17c90b['count']:_0x46deea[_0xb2f2('0x28')]+_0x46deea[_0xb2f2('0x29')];var _0x3e883c;if(_0x57dbee>=_0x87a4b5){_0x57dbee=_0x87a4b5;_0x3e883c=0xc8;}else{_0x3e883c=0xce;}_0x4cb5d8[_0xb2f2('0x26')](_0x3e883c);return _0x4cb5d8[_0xb2f2('0x2c')](_0xb2f2('0x2d'),_0x8863fa+'-'+_0x57dbee+'/'+_0x87a4b5)[_0xb2f2('0x2e')](_0x17c90b);}return null;};}function patchUpdates(_0x4be141){return function(_0x31092a){try{jsonpatch[_0xb2f2('0x2f')](_0x31092a,_0x4be141,!![]);}catch(_0x2214d5){return BPromise['reject'](_0x2214d5);}return _0x31092a[_0xb2f2('0x30')]();};}function saveUpdates(_0x5b1186,_0x898e0){return function(_0x3ed3b4){if(_0x3ed3b4){return _0x3ed3b4[_0xb2f2('0x31')](_0x5b1186)['then'](function(_0x587d11){return _0x587d11;});}return null;};}function removeEntity(_0xf5f334,_0x5c9c13){return function(_0x3487b5){if(_0x3487b5){return _0x3487b5[_0xb2f2('0x32')]()[_0xb2f2('0x33')](function(){_0xf5f334[_0xb2f2('0x26')](0xcc)[_0xb2f2('0x27')]();});}};}function handleEntityNotFound(_0x5f46ef,_0x4376d1){return function(_0x4ac1e8){if(!_0x4ac1e8){_0x5f46ef[_0xb2f2('0x25')](0x194);}return _0x4ac1e8;};}function handleError(_0x47a16d,_0x583627){_0x583627=_0x583627||0x1f4;return function(_0x3253f6){logger['error'](_0x3253f6['stack']);if(_0x3253f6[_0xb2f2('0x34')]){delete _0x3253f6[_0xb2f2('0x34')];}_0x47a16d[_0xb2f2('0x26')](_0x583627)[_0xb2f2('0x35')](_0x3253f6);};}exports[_0xb2f2('0x36')]=function(_0x7d475f,_0x3373b8){var _0x2e33af={},_0x2bbeda={},_0x2333a9={'count':0x0,'rows':[]};var _0xc663ad=_[_0xb2f2('0x37')](db[_0xb2f2('0x38')][_0xb2f2('0x39')],function(_0x43637f){return{'name':_0x43637f[_0xb2f2('0x3a')],'type':_0x43637f[_0xb2f2('0x3b')][_0xb2f2('0x3c')]};});_0x2bbeda[_0xb2f2('0x3d')]=_[_0xb2f2('0x37')](_0xc663ad,_0xb2f2('0x34'));_0x2bbeda[_0xb2f2('0x3e')]=_['keys'](_0x7d475f['query']);_0x2bbeda[_0xb2f2('0x3f')]=_[_0xb2f2('0x40')](_0x2bbeda[_0xb2f2('0x3d')],_0x2bbeda[_0xb2f2('0x3e')]);_0x2e33af[_0xb2f2('0x41')]=_[_0xb2f2('0x40')](_0x2bbeda[_0xb2f2('0x3d')],qs['fields'](_0x7d475f['query'][_0xb2f2('0x42')]));_0x2e33af[_0xb2f2('0x41')]=_0x2e33af[_0xb2f2('0x41')][_0xb2f2('0x43')]?_0x2e33af[_0xb2f2('0x41')]:_0x2bbeda[_0xb2f2('0x3d')];if(!_0x7d475f['query']['hasOwnProperty'](_0xb2f2('0x44'))){_0x2e33af[_0xb2f2('0x29')]=qs['limit'](_0x7d475f[_0xb2f2('0x3e')][_0xb2f2('0x29')]);_0x2e33af['offset']=qs[_0xb2f2('0x28')](_0x7d475f[_0xb2f2('0x3e')][_0xb2f2('0x28')]);}_0x2e33af[_0xb2f2('0x45')]=qs[_0xb2f2('0x46')](_0x7d475f['query'][_0xb2f2('0x46')]);_0x2e33af[_0xb2f2('0x47')]=qs['filters'](_[_0xb2f2('0x48')](_0x7d475f[_0xb2f2('0x3e')],_0x2bbeda[_0xb2f2('0x3f')]),_0xc663ad);if(_0x7d475f['query']['filter']){_0x2e33af[_0xb2f2('0x47')]=_['merge'](_0x2e33af['where'],{'$or':_[_0xb2f2('0x37')](_0xc663ad,function(_0x12c717){if(_0x12c717[_0xb2f2('0x3b')]!=='VIRTUAL'){var _0x57e193={};_0x57e193[_0x12c717[_0xb2f2('0x34')]]={'$like':'%'+_0x7d475f[_0xb2f2('0x3e')][_0xb2f2('0x49')]+'%'};return _0x57e193;}})});}_0x2e33af=_[_0xb2f2('0x4a')]({},_0x2e33af,_0x7d475f[_0xb2f2('0x4b')]);var _0x3d612d={'where':_0x2e33af[_0xb2f2('0x47')]};return db[_0xb2f2('0x38')][_0xb2f2('0x2b')](_0x3d612d)[_0xb2f2('0x33')](function(_0xac08b9){_0x2333a9[_0xb2f2('0x2b')]=_0xac08b9;if(_0x7d475f['query'][_0xb2f2('0x4c')]){_0x2e33af['include']=[{'all':!![]}];}return db['ServicenowAccount'][_0xb2f2('0x4d')](_0x2e33af);})[_0xb2f2('0x33')](function(_0x434ebb){_0x2333a9[_0xb2f2('0x4e')]=_0x434ebb;return _0x2333a9;})[_0xb2f2('0x33')](respondWithFilteredResult(_0x3373b8,_0x2e33af))[_0xb2f2('0x4f')](handleError(_0x3373b8,null));};exports[_0xb2f2('0x50')]=function(_0x232ca4,_0xaf5e3c){var _0x39e204={'raw':![],'where':{'id':_0x232ca4[_0xb2f2('0x51')]['id']}},_0x1f2299={};_0x1f2299[_0xb2f2('0x3d')]=_[_0xb2f2('0x52')](db[_0xb2f2('0x38')][_0xb2f2('0x39')]);_0x1f2299['query']=_[_0xb2f2('0x52')](_0x232ca4[_0xb2f2('0x3e')]);_0x1f2299[_0xb2f2('0x3f')]=_[_0xb2f2('0x40')](_0x1f2299['model'],_0x1f2299[_0xb2f2('0x3e')]);_0x39e204[_0xb2f2('0x41')]=_[_0xb2f2('0x40')](_0x1f2299[_0xb2f2('0x3d')],qs[_0xb2f2('0x42')](_0x232ca4['query']['fields']));_0x39e204[_0xb2f2('0x41')]=_0x39e204[_0xb2f2('0x41')][_0xb2f2('0x43')]?_0x39e204[_0xb2f2('0x41')]:_0x1f2299['model'];if(_0x232ca4[_0xb2f2('0x3e')]['includeAll']){_0x39e204[_0xb2f2('0x53')]=[{'all':!![]}];}_0x39e204=_[_0xb2f2('0x4a')]({},_0x39e204,_0x232ca4['options']);return db[_0xb2f2('0x38')][_0xb2f2('0x54')](_0x39e204)[_0xb2f2('0x33')](handleEntityNotFound(_0xaf5e3c,null))[_0xb2f2('0x33')](respondWithResult(_0xaf5e3c,null))[_0xb2f2('0x4f')](handleError(_0xaf5e3c,null));};exports['create']=function(_0x3cdd3b,_0x914a9){return db[_0xb2f2('0x38')][_0xb2f2('0x55')](_0x3cdd3b[_0xb2f2('0x56')],{})[_0xb2f2('0x33')](respondWithResult(_0x914a9,0xc9))[_0xb2f2('0x4f')](handleError(_0x914a9,null));};exports[_0xb2f2('0x31')]=function(_0x1e7a2a,_0x4c62bc){if(_0x1e7a2a[_0xb2f2('0x56')]['id']){delete _0x1e7a2a['body']['id'];}return db['ServicenowAccount'][_0xb2f2('0x54')]({'where':{'id':_0x1e7a2a[_0xb2f2('0x51')]['id']}})[_0xb2f2('0x33')](handleEntityNotFound(_0x4c62bc,null))[_0xb2f2('0x33')](saveUpdates(_0x1e7a2a[_0xb2f2('0x56')],null))[_0xb2f2('0x33')](respondWithResult(_0x4c62bc,null))[_0xb2f2('0x4f')](handleError(_0x4c62bc,null));};exports['destroy']=function(_0xcfde27,_0x3d4af4){return db['ServicenowAccount'][_0xb2f2('0x54')]({'where':{'id':_0xcfde27[_0xb2f2('0x51')]['id']}})[_0xb2f2('0x33')](handleEntityNotFound(_0x3d4af4,null))[_0xb2f2('0x33')](removeEntity(_0x3d4af4,null))[_0xb2f2('0x4f')](handleError(_0x3d4af4,null));};exports['getConfigurations']=function(_0x1b61ab,_0x4f99b9,_0x2455e3){var _0x4ddc88={};var _0x23bb0e={};var _0x49a6e8;var _0x5d37c0;return db[_0xb2f2('0x38')][_0xb2f2('0x57')]({'where':{'id':_0x1b61ab[_0xb2f2('0x51')]['id']}})[_0xb2f2('0x33')](handleEntityNotFound(_0x4f99b9,null))['then'](function(_0x5a4bd3){if(_0x5a4bd3){_0x49a6e8=_0x5a4bd3;_0x23bb0e[_0xb2f2('0x3d')]=_[_0xb2f2('0x52')](db[_0xb2f2('0x58')][_0xb2f2('0x39')]);_0x23bb0e[_0xb2f2('0x3e')]=_[_0xb2f2('0x52')](_0x1b61ab['query']);_0x23bb0e['filters']=_[_0xb2f2('0x40')](_0x23bb0e[_0xb2f2('0x3d')],_0x23bb0e[_0xb2f2('0x3e')]);_0x4ddc88['attributes']=_['intersection'](_0x23bb0e[_0xb2f2('0x3d')],qs['fields'](_0x1b61ab[_0xb2f2('0x3e')][_0xb2f2('0x42')]));_0x4ddc88[_0xb2f2('0x41')]=_0x4ddc88[_0xb2f2('0x41')]['length']?_0x4ddc88['attributes']:_0x23bb0e[_0xb2f2('0x3d')];_0x4ddc88[_0xb2f2('0x45')]=qs[_0xb2f2('0x46')](_0x1b61ab[_0xb2f2('0x3e')]['sort']);_0x4ddc88[_0xb2f2('0x47')]=qs[_0xb2f2('0x3f')](_[_0xb2f2('0x48')](_0x1b61ab['query'],_0x23bb0e[_0xb2f2('0x3f')]));if(_0x1b61ab['query'][_0xb2f2('0x49')]){_0x4ddc88[_0xb2f2('0x47')]=_[_0xb2f2('0x4a')](_0x4ddc88[_0xb2f2('0x47')],{'$or':_[_0xb2f2('0x37')](_0x4ddc88[_0xb2f2('0x41')],function(_0x6356a1){var _0x4411b6={};_0x4411b6[_0x6356a1]={'$like':'%'+_0x1b61ab['query'][_0xb2f2('0x49')]+'%'};return _0x4411b6;})});}_0x4ddc88=_['merge']({},_0x4ddc88,_0x1b61ab[_0xb2f2('0x4b')]);return _0x49a6e8[_0xb2f2('0x59')](_0x4ddc88);}})[_0xb2f2('0x33')](function(_0x226b9b){if(_0x226b9b){_0x5d37c0=_0x226b9b['length'];if(!_0x1b61ab['query'][_0xb2f2('0x5a')](_0xb2f2('0x44'))){_0x4ddc88[_0xb2f2('0x29')]=qs[_0xb2f2('0x29')](_0x1b61ab[_0xb2f2('0x3e')][_0xb2f2('0x29')]);_0x4ddc88[_0xb2f2('0x28')]=qs[_0xb2f2('0x28')](_0x1b61ab[_0xb2f2('0x3e')][_0xb2f2('0x28')]);}return _0x49a6e8[_0xb2f2('0x59')](_0x4ddc88);}})[_0xb2f2('0x33')](function(_0x527f38){if(_0x527f38){return _0x527f38?{'count':_0x5d37c0,'rows':_0x527f38}:null;}})[_0xb2f2('0x33')](respondWithResult(_0x4f99b9,null))[_0xb2f2('0x4f')](handleError(_0x4f99b9,null));};exports[_0xb2f2('0x5b')]=function(_0x1cc409,_0x35e3bb,_0x3e56b6){if(_0x1cc409[_0xb2f2('0x56')]['id']){delete _0x1cc409[_0xb2f2('0x56')]['id'];}return db['ServicenowAccount']['findOne']({'where':{'id':_0x1cc409[_0xb2f2('0x51')]['id']}})[_0xb2f2('0x33')](handleEntityNotFound(_0x35e3bb,null))[_0xb2f2('0x33')](function(_0x4bfdc0){if(_0x4bfdc0){_0x1cc409['body'][_0xb2f2('0x5c')]=_0x4bfdc0['id'];_0x1cc409[_0xb2f2('0x56')]['Subjects']=integrations['getSubjects'](_0x1cc409[_0xb2f2('0x56')][_0xb2f2('0x5d')],_0x1cc409[_0xb2f2('0x56')][_0xb2f2('0x3b')]);_0x1cc409[_0xb2f2('0x56')]['Descriptions']=integrations[_0xb2f2('0x5e')](_0x1cc409['body'][_0xb2f2('0x5d')],_0x1cc409[_0xb2f2('0x56')][_0xb2f2('0x3b')]);return db[_0xb2f2('0x58')]['create'](_0x1cc409[_0xb2f2('0x56')],{'include':[{'model':db[_0xb2f2('0x5f')],'as':_0xb2f2('0x60')},{'model':db['ServicenowField'],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x35e3bb,null))['catch'](handleError(_0x35e3bb,null));};exports['getFields']=function(_0x3b2bdb,_0x2e6c03,_0x17c91f){var _0x485839=['made_sla',_0xb2f2('0x61'),'knowledge',_0xb2f2('0x62'),_0xb2f2('0x63'),_0xb2f2('0x64'),'incident_state',_0xb2f2('0x65'),_0xb2f2('0x66')];var _0x921a60=[_0xb2f2('0x67'),_0xb2f2('0x68'),_0xb2f2('0x69'),_0xb2f2('0x6a'),_0xb2f2('0x6b'),_0xb2f2('0x6c'),_0xb2f2('0x6d'),_0xb2f2('0x61'),_0xb2f2('0x6e'),_0xb2f2('0x6f'),_0xb2f2('0x70'),_0xb2f2('0x71'),'opened_by',_0xb2f2('0x72'),'sys_created_on',_0xb2f2('0x73'),'state',_0xb2f2('0x74'),_0xb2f2('0x75'),_0xb2f2('0x45'),'calendar_stc',_0xb2f2('0x76'),_0xb2f2('0x77'),_0xb2f2('0x78'),_0xb2f2('0x79'),_0xb2f2('0x7a'),_0xb2f2('0x7b'),_0xb2f2('0x7c'),_0xb2f2('0x7d'),_0xb2f2('0x7e'),'rfc',_0xb2f2('0x7f'),_0xb2f2('0x80'),_0xb2f2('0x81'),_0xb2f2('0x82'),_0xb2f2('0x83'),_0xb2f2('0x84'),'reopened_time',_0xb2f2('0x85'),_0xb2f2('0x86'),_0xb2f2('0x87'),_0xb2f2('0x62'),_0xb2f2('0x88'),_0xb2f2('0x89'),'close_code',_0xb2f2('0x8a'),'delivery_task','work_start',_0xb2f2('0x8b'),_0xb2f2('0x8c'),_0xb2f2('0x8d'),_0xb2f2('0x8e'),'calendar_duration',_0xb2f2('0x64'),_0xb2f2('0x8f'),_0xb2f2('0x90'),_0xb2f2('0x91'),_0xb2f2('0x92'),_0xb2f2('0x93'),_0xb2f2('0x94'),_0xb2f2('0x95'),'reopened_by',_0xb2f2('0x96'),'urgency',_0xb2f2('0x97'),'company',_0xb2f2('0x98'),_0xb2f2('0x99'),_0xb2f2('0x9a'),_0xb2f2('0x65'),'comments',_0xb2f2('0x9b'),_0xb2f2('0x9c'),_0xb2f2('0x9d'),_0xb2f2('0x9e'),_0xb2f2('0x9f'),_0xb2f2('0xa0'),_0xb2f2('0xa1'),_0xb2f2('0xa2'),'upon_approval',_0xb2f2('0xa3'),_0xb2f2('0xa4'),_0xb2f2('0x66')];var _0x117398='';var _0xe0ac5d='';var _0x2ad01a=[];var _0x35ea86='';var _0x5cf499='';var _0x3b8fa7=[];var _0x2957ac='';var _0x4b88ca='';var _0x4aafa4={};var _0xbf17e1='';return db[_0xb2f2('0x38')][_0xb2f2('0x57')]({'where':{'id':_0x3b2bdb[_0xb2f2('0x51')]['id']},'attributes':['id',_0xb2f2('0xa5'),_0xb2f2('0xa6'),'email',_0xb2f2('0xa7'),_0xb2f2('0xa8')]})['then'](handleEntityNotFound(_0x2e6c03,null))['then'](function(_0x3e211a){if(_0x3e211a){_0xbf17e1=_0x3e211a[_0xb2f2('0xa7')];var _0x4a9486=_0xbf17e1['slice'](-0x1);if(_0x4a9486==='/'){_0xbf17e1=_0xbf17e1['substring'](0x0,_0xbf17e1[_0xb2f2('0xa9')](_0x4a9486));}_0x4b88ca=util[_0xb2f2('0xaa')](_0xb2f2('0xab'),_0xbf17e1);_0x2957ac=util[_0xb2f2('0xaa')]('%s/api/now/table/',_0xbf17e1);_0x4aafa4={'user':_0x3e211a[_0xb2f2('0xa5')],'pass':_0x3e211a[_0xb2f2('0xa6')]};var _0x4dd1c6={'method':'GET','uri':_0x4b88ca+_0xb2f2('0xac'),'auth':_0x4aafa4,'json':!![]};return rp(_0x4dd1c6);}})['then'](function(_0x5839bb){if(_0x5839bb[_0xb2f2('0x24')]['length']>0x0){_0x117398=_0x5839bb[_0xb2f2('0x24')];}console[_0xb2f2('0xad')](_0xb2f2('0xae'),_0x117398);_0x3b8fa7=[];_0xe0ac5d=Object[_0xb2f2('0xaf')]([],_0x117398);_[_0xb2f2('0xb0')](_0xe0ac5d,function(_0xf50549){return!_0x485839[_0xb2f2('0xb1')](_0xf50549[_0xb2f2('0x34')]);});_0xe0ac5d['forEach'](function(_0x50ee53){var _0x3daccb=createFieldObject(_0x2957ac,_0x4aafa4,_0x50ee53[_0xb2f2('0xb2')],_0x50ee53['name'],_0x50ee53[_0xb2f2('0xb3')],![]);_0x3b8fa7['push'](_0x3daccb);});return Promise['all'](_0x3b8fa7);})[_0xb2f2('0x33')](function(_0x5357bb){_0x2ad01a=_0x5357bb;_0x35ea86=Object['assign']([],_0x117398);console['log'](_0xb2f2('0xb4'),_0x117398);_['remove'](_0x35ea86,function(_0x50e747){return _0x921a60[_0xb2f2('0xb1')](_0x50e747[_0xb2f2('0x34')]);});console['log'](_0xb2f2('0xb5'),_0x35ea86);_0x3b8fa7=[];_0x35ea86[_0xb2f2('0xb6')](function(_0x18a996){var _0x1912f6=createFieldObject(_0x2957ac,_0x4aafa4,_0x18a996['internalType'],_0x18a996['name'],_0x18a996[_0xb2f2('0xb3')],!![]);_0x3b8fa7['push'](_0x1912f6);});return Promise[_0xb2f2('0xb7')](_0x3b8fa7);})['then'](function(_0x431e47){_0x5cf499=_0x431e47;var _0xcb7fa2=_0x2ad01a[_0xb2f2('0xb8')](_0x5cf499);return{'count':_0xcb7fa2[_0xb2f2('0x43')],'rows':_0xcb7fa2};})[_0xb2f2('0x33')](respondWithResult(_0x2e6c03,null))['catch'](function(_0x4ea0cc){console[_0xb2f2('0xad')]('ServiceNow\x20error:\x20'+_0x4ea0cc);var _0x1dbb05=_0x3b2bdb['query'][_0xb2f2('0xb9')]?0x1f4:_0x4ea0cc[_0xb2f2('0xba')]||0x1f4;logger[_0xb2f2('0x22')](_0x4ea0cc[_0xb2f2('0xbb')]);delete _0x4ea0cc['name'];if(_0x1dbb05===0x191){_0x1dbb05=0x190;}_0x2e6c03[_0xb2f2('0x26')](_0x1dbb05)[_0xb2f2('0x35')](_0x3b2bdb[_0xb2f2('0x3e')][_0xb2f2('0xb9')]?{'message':_0xb2f2('0xbc'),'statusCode':_0x4ea0cc['statusCode']}:_0x4ea0cc);});};function createFieldObject(_0x3942c2,_0x412177,_0x4c810f,_0x13fc82,_0x5f4e3c,_0x38379d){return new Promise(function(_0x132adb,_0x3caa1f){var _0xf4c5d4={'id':_0x13fc82,'name':_0x5f4e3c,'custom':_0x38379d};if(_0x4c810f===_0xb2f2('0xbd')){_0xf4c5d4[_0xb2f2('0x4b')]=[{'name':'True','value':_0xb2f2('0xbe')},{'name':_0xb2f2('0xbf'),'value':_0xb2f2('0xc0')}];_0x132adb(_0xf4c5d4);}else{var _0x224a22={'method':_0xb2f2('0xc1'),'uri':_0x3942c2+_0xb2f2('0xc2')+_0x13fc82,'auth':_0x412177,'json':!![]};return rp(_0x224a22)['then'](function(_0x4e5616){var _0x558821=[];if(_0x4e5616['result'][_0xb2f2('0x43')]>0x0){_0x4e5616[_0xb2f2('0x24')][_0xb2f2('0xb6')](function(_0x5da955){if(_0x5da955[_0xb2f2('0xc3')]===_0xb2f2('0xc0')){var _0x196d0f={'name':_0x5da955[_0xb2f2('0xb3')],'value':_0x5da955['value']};_0x558821[_0xb2f2('0xc4')](_0x196d0f);}});}_0xf4c5d4[_0xb2f2('0x4b')]=_0x558821;if(_0xf4c5d4[_0xb2f2('0x4b')][_0xb2f2('0x43')]>0x0){_0x132adb(_0xf4c5d4);}else{if(_0x38379d==![]){_0x132adb();}else{_0x132adb(_0xf4c5d4);}}});}});} \ No newline at end of file +var _0xa8d6=['offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','then','stack','name','index','map','ServicenowAccount','rawAttributes','fieldName','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','filters','where','type','VIRTUAL','merge','includeAll','include','findAll','show','params','options','create','body','find','getConfigurations','findOne','ServicenowConfiguration','pick','filter','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ServicenowField','getFields','made_sla','hold_reason','knowledge','subcategory','close_code','notify','category','parent','upon_reject','sys_updated_on','child_incidents','approval_history','number','resolved_by','sys_updated_by','user_input','sys_created_on','sys_domain','state','sys_created_by','closed_at','cmdb_ci','delivery_plan','impact','active','business_service','priority','sys_domain_path','time_worked','expected_start','business_duration','work_end','reopened_time','resolved_at','caller_id','delivery_task','work_start','assignment_group','additional_assignee_list','description','calendar_duration','sys_class_name','close_notes','follow_up','sys_id','contact_type','reopened_by','incident_state','urgency','company','activity_due','assigned_to','comments','sla_due','approval','comments_and_work_notes','due_date','sys_tags','escalation','upon_approval','location','password','email','remoteUri','slice','substring','lastIndexOf','format','username','incident?sysparm_display_value=all','result','log','incident\x20table\x20objects','remove','internalType','label','push','all','assign','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','forEach','ServiceNow\x20error:\x20','statusCode','send','test','Wrong\x20credentials','boolean','true','False','false','GET','sys_choice?sysparm_query=name=incident^element=','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','client','http','request','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','sendStatus','status','json'];(function(_0x96198e,_0x49070b){var _0x564cb6=function(_0x15732e){while(--_0x15732e){_0x96198e['push'](_0x96198e['shift']());}};_0x564cb6(++_0x49070b);}(_0xa8d6,0x156));var _0x6a8d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa8d6[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x6a8d('0x0'));var rimraf=require(_0x6a8d('0x1'));var zipdir=require(_0x6a8d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6a8d('0x3'));var moment=require(_0x6a8d('0x4'));var BPromise=require(_0x6a8d('0x5'));var Mustache=require(_0x6a8d('0x6'));var util=require(_0x6a8d('0x7'));var path=require(_0x6a8d('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x6a8d('0x9'));var fs=require('fs');var fs_extra=require(_0x6a8d('0xa'));var _=require(_0x6a8d('0xb'));var squel=require(_0x6a8d('0xc'));var crypto=require(_0x6a8d('0xd'));var jsforce=require(_0x6a8d('0xe'));var deskjs=require(_0x6a8d('0xf'));var toCsv=require(_0x6a8d('0x10'));var querystring=require(_0x6a8d('0x11'));var Papa=require(_0x6a8d('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6a8d('0x13'));var logger=require(_0x6a8d('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x6a8d('0x15'));var licenseUtil=require(_0x6a8d('0x16'));var db=require(_0x6a8d('0x17'))['db'];var integrations=require(_0x6a8d('0x18'));var jayson=require('jayson/promise');var client=jayson[_0x6a8d('0x19')][_0x6a8d('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x24aa24,_0x11a29d,_0x5ce50c,_0x2a7ff1){return new BPromise(function(_0x772a84,_0x1428be){var _0x585708=_0x2a7ff1||client;return _0x585708[_0x6a8d('0x1b')](_0x24aa24,_0x5ce50c)['then'](function(_0x1fdaee){logger[_0x6a8d('0x1c')](_0x6a8d('0x1d'),_0x11a29d,_0x6a8d('0x1e'));logger[_0x6a8d('0x1f')]('ServicenowAccount,\x20%s,\x20%s,\x20%s',_0x11a29d,_0x6a8d('0x1e'),JSON[_0x6a8d('0x20')](_0x1fdaee));if(_0x1fdaee[_0x6a8d('0x21')]){if(_0x1fdaee[_0x6a8d('0x21')][_0x6a8d('0x22')]===0x1f4){logger[_0x6a8d('0x21')]('ServicenowAccount,\x20%s,\x20%s',_0x11a29d,_0x1fdaee[_0x6a8d('0x21')][_0x6a8d('0x23')]);return _0x1428be(_0x1fdaee['error']['message']);}logger[_0x6a8d('0x21')](_0x6a8d('0x1d'),_0x11a29d,_0x1fdaee['error'][_0x6a8d('0x23')]);return _0x772a84(_0x1fdaee['error'][_0x6a8d('0x23')]);}else{logger[_0x6a8d('0x1c')](_0x6a8d('0x1d'),_0x11a29d,_0x6a8d('0x1e'));_0x772a84(_0x1fdaee['result'][_0x6a8d('0x23')]);}})[_0x6a8d('0x24')](function(_0x47d216){logger[_0x6a8d('0x21')](_0x6a8d('0x1d'),_0x11a29d,_0x47d216);_0x1428be(_0x47d216);});});}function respondWithStatusCode(_0x540b76,_0x3385dd){_0x3385dd=_0x3385dd||0xcc;return function(_0x4184ca){if(_0x4184ca){return _0x540b76[_0x6a8d('0x25')](_0x3385dd);}return _0x540b76[_0x6a8d('0x26')](_0x3385dd)['end']();};}function respondWithResult(_0x4e4750,_0x389bb4){_0x389bb4=_0x389bb4||0xc8;return function(_0x2bfcfb){if(_0x2bfcfb){return _0x4e4750['status'](_0x389bb4)[_0x6a8d('0x27')](_0x2bfcfb);}};}function respondWithFilteredResult(_0x269d2e,_0x38ee9c){return function(_0x1f8a3e){if(_0x1f8a3e){var _0x52f0e8=typeof _0x38ee9c[_0x6a8d('0x28')]===_0x6a8d('0x29')&&typeof _0x38ee9c['limit']===_0x6a8d('0x29');var _0x246ad4=_0x1f8a3e[_0x6a8d('0x2a')];var _0x213b3d=_0x52f0e8?0x0:_0x38ee9c[_0x6a8d('0x28')];var _0x7d3075=_0x52f0e8?_0x1f8a3e['count']:_0x38ee9c[_0x6a8d('0x28')]+_0x38ee9c[_0x6a8d('0x2b')];var _0x45afdd;if(_0x7d3075>=_0x246ad4){_0x7d3075=_0x246ad4;_0x45afdd=0xc8;}else{_0x45afdd=0xce;}_0x269d2e[_0x6a8d('0x26')](_0x45afdd);return _0x269d2e[_0x6a8d('0x2c')](_0x6a8d('0x2d'),_0x213b3d+'-'+_0x7d3075+'/'+_0x246ad4)[_0x6a8d('0x27')](_0x1f8a3e);}return null;};}function patchUpdates(_0x297fce){return function(_0xbabf72){try{jsonpatch[_0x6a8d('0x2e')](_0xbabf72,_0x297fce,!![]);}catch(_0x2a25dd){return BPromise[_0x6a8d('0x2f')](_0x2a25dd);}return _0xbabf72[_0x6a8d('0x30')]();};}function saveUpdates(_0x4c92ca,_0x59fde7){return function(_0x358a3e){if(_0x358a3e){return _0x358a3e[_0x6a8d('0x31')](_0x4c92ca)['then'](function(_0x28838c){return _0x28838c;});}return null;};}function removeEntity(_0x58236d,_0xdb91b0){return function(_0xf6353d){if(_0xf6353d){return _0xf6353d[_0x6a8d('0x32')]()[_0x6a8d('0x33')](function(){_0x58236d[_0x6a8d('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2f3b64,_0x2e80d6){return function(_0x4386bf){if(!_0x4386bf){_0x2f3b64['sendStatus'](0x194);}return _0x4386bf;};}function handleError(_0x112d0a,_0x5d96d3){_0x5d96d3=_0x5d96d3||0x1f4;return function(_0x4d9cec){logger[_0x6a8d('0x21')](_0x4d9cec[_0x6a8d('0x34')]);if(_0x4d9cec['name']){delete _0x4d9cec[_0x6a8d('0x35')];}_0x112d0a[_0x6a8d('0x26')](_0x5d96d3)['send'](_0x4d9cec);};}exports[_0x6a8d('0x36')]=function(_0x5e4c05,_0x3cb89e){var _0x5a040b={},_0x109887={},_0x4d4fb9={'count':0x0,'rows':[]};var _0x12c079=_[_0x6a8d('0x37')](db[_0x6a8d('0x38')][_0x6a8d('0x39')],function(_0x40de27){return{'name':_0x40de27[_0x6a8d('0x3a')],'type':_0x40de27['type']['key']};});_0x109887[_0x6a8d('0x3b')]=_['map'](_0x12c079,_0x6a8d('0x35'));_0x109887[_0x6a8d('0x3c')]=_[_0x6a8d('0x3d')](_0x5e4c05[_0x6a8d('0x3c')]);_0x109887['filters']=_[_0x6a8d('0x3e')](_0x109887['model'],_0x109887[_0x6a8d('0x3c')]);_0x5a040b[_0x6a8d('0x3f')]=_[_0x6a8d('0x3e')](_0x109887[_0x6a8d('0x3b')],qs[_0x6a8d('0x40')](_0x5e4c05[_0x6a8d('0x3c')]['fields']));_0x5a040b[_0x6a8d('0x3f')]=_0x5a040b['attributes'][_0x6a8d('0x41')]?_0x5a040b[_0x6a8d('0x3f')]:_0x109887[_0x6a8d('0x3b')];if(!_0x5e4c05[_0x6a8d('0x3c')][_0x6a8d('0x42')]('nolimit')){_0x5a040b[_0x6a8d('0x2b')]=qs['limit'](_0x5e4c05[_0x6a8d('0x3c')][_0x6a8d('0x2b')]);_0x5a040b['offset']=qs[_0x6a8d('0x28')](_0x5e4c05[_0x6a8d('0x3c')]['offset']);}_0x5a040b[_0x6a8d('0x43')]=qs[_0x6a8d('0x44')](_0x5e4c05[_0x6a8d('0x3c')][_0x6a8d('0x44')]);_0x5a040b['where']=qs[_0x6a8d('0x45')](_['pick'](_0x5e4c05[_0x6a8d('0x3c')],_0x109887[_0x6a8d('0x45')]),_0x12c079);if(_0x5e4c05[_0x6a8d('0x3c')]['filter']){_0x5a040b[_0x6a8d('0x46')]=_['merge'](_0x5a040b['where'],{'$or':_[_0x6a8d('0x37')](_0x12c079,function(_0x20f72b){if(_0x20f72b[_0x6a8d('0x47')]!==_0x6a8d('0x48')){var _0x4b7fe9={};_0x4b7fe9[_0x20f72b[_0x6a8d('0x35')]]={'$like':'%'+_0x5e4c05[_0x6a8d('0x3c')]['filter']+'%'};return _0x4b7fe9;}})});}_0x5a040b=_[_0x6a8d('0x49')]({},_0x5a040b,_0x5e4c05['options']);var _0x3d5890={'where':_0x5a040b['where']};return db[_0x6a8d('0x38')]['count'](_0x3d5890)[_0x6a8d('0x33')](function(_0x591d7e){_0x4d4fb9['count']=_0x591d7e;if(_0x5e4c05[_0x6a8d('0x3c')][_0x6a8d('0x4a')]){_0x5a040b[_0x6a8d('0x4b')]=[{'all':!![]}];}return db['ServicenowAccount'][_0x6a8d('0x4c')](_0x5a040b);})['then'](function(_0x4dfb8d){_0x4d4fb9['rows']=_0x4dfb8d;return _0x4d4fb9;})['then'](respondWithFilteredResult(_0x3cb89e,_0x5a040b))[_0x6a8d('0x24')](handleError(_0x3cb89e,null));};exports[_0x6a8d('0x4d')]=function(_0x29496a,_0x226239){var _0x20bfcb={'raw':![],'where':{'id':_0x29496a[_0x6a8d('0x4e')]['id']}},_0x70389e={};_0x70389e[_0x6a8d('0x3b')]=_[_0x6a8d('0x3d')](db['ServicenowAccount'][_0x6a8d('0x39')]);_0x70389e['query']=_[_0x6a8d('0x3d')](_0x29496a[_0x6a8d('0x3c')]);_0x70389e[_0x6a8d('0x45')]=_[_0x6a8d('0x3e')](_0x70389e[_0x6a8d('0x3b')],_0x70389e[_0x6a8d('0x3c')]);_0x20bfcb[_0x6a8d('0x3f')]=_['intersection'](_0x70389e[_0x6a8d('0x3b')],qs[_0x6a8d('0x40')](_0x29496a['query']['fields']));_0x20bfcb[_0x6a8d('0x3f')]=_0x20bfcb[_0x6a8d('0x3f')][_0x6a8d('0x41')]?_0x20bfcb[_0x6a8d('0x3f')]:_0x70389e[_0x6a8d('0x3b')];if(_0x29496a['query'][_0x6a8d('0x4a')]){_0x20bfcb[_0x6a8d('0x4b')]=[{'all':!![]}];}_0x20bfcb=_[_0x6a8d('0x49')]({},_0x20bfcb,_0x29496a[_0x6a8d('0x4f')]);return db[_0x6a8d('0x38')]['find'](_0x20bfcb)[_0x6a8d('0x33')](handleEntityNotFound(_0x226239,null))[_0x6a8d('0x33')](respondWithResult(_0x226239,null))['catch'](handleError(_0x226239,null));};exports[_0x6a8d('0x50')]=function(_0xffcd43,_0x28dcb4){return db[_0x6a8d('0x38')][_0x6a8d('0x50')](_0xffcd43[_0x6a8d('0x51')],{})['then'](respondWithResult(_0x28dcb4,0xc9))[_0x6a8d('0x24')](handleError(_0x28dcb4,null));};exports['update']=function(_0x3a48fe,_0x579366){if(_0x3a48fe[_0x6a8d('0x51')]['id']){delete _0x3a48fe['body']['id'];}return db[_0x6a8d('0x38')]['find']({'where':{'id':_0x3a48fe[_0x6a8d('0x4e')]['id']}})[_0x6a8d('0x33')](handleEntityNotFound(_0x579366,null))[_0x6a8d('0x33')](saveUpdates(_0x3a48fe[_0x6a8d('0x51')],null))['then'](respondWithResult(_0x579366,null))[_0x6a8d('0x24')](handleError(_0x579366,null));};exports[_0x6a8d('0x32')]=function(_0x1e4bbe,_0x295eda){return db[_0x6a8d('0x38')][_0x6a8d('0x52')]({'where':{'id':_0x1e4bbe[_0x6a8d('0x4e')]['id']}})[_0x6a8d('0x33')](handleEntityNotFound(_0x295eda,null))['then'](removeEntity(_0x295eda,null))[_0x6a8d('0x24')](handleError(_0x295eda,null));};exports[_0x6a8d('0x53')]=function(_0x43fa33,_0x2af532,_0x3e4c3f){var _0xd996b4={};var _0x407917={};var _0x50111a;var _0x3de43d;return db['ServicenowAccount'][_0x6a8d('0x54')]({'where':{'id':_0x43fa33['params']['id']}})[_0x6a8d('0x33')](handleEntityNotFound(_0x2af532,null))[_0x6a8d('0x33')](function(_0x2990b7){if(_0x2990b7){_0x50111a=_0x2990b7;_0x407917[_0x6a8d('0x3b')]=_[_0x6a8d('0x3d')](db[_0x6a8d('0x55')][_0x6a8d('0x39')]);_0x407917[_0x6a8d('0x3c')]=_[_0x6a8d('0x3d')](_0x43fa33[_0x6a8d('0x3c')]);_0x407917[_0x6a8d('0x45')]=_[_0x6a8d('0x3e')](_0x407917[_0x6a8d('0x3b')],_0x407917[_0x6a8d('0x3c')]);_0xd996b4[_0x6a8d('0x3f')]=_[_0x6a8d('0x3e')](_0x407917[_0x6a8d('0x3b')],qs[_0x6a8d('0x40')](_0x43fa33[_0x6a8d('0x3c')]['fields']));_0xd996b4['attributes']=_0xd996b4['attributes'][_0x6a8d('0x41')]?_0xd996b4[_0x6a8d('0x3f')]:_0x407917['model'];_0xd996b4[_0x6a8d('0x43')]=qs['sort'](_0x43fa33['query']['sort']);_0xd996b4['where']=qs[_0x6a8d('0x45')](_[_0x6a8d('0x56')](_0x43fa33[_0x6a8d('0x3c')],_0x407917[_0x6a8d('0x45')]));if(_0x43fa33['query'][_0x6a8d('0x57')]){_0xd996b4[_0x6a8d('0x46')]=_['merge'](_0xd996b4[_0x6a8d('0x46')],{'$or':_[_0x6a8d('0x37')](_0xd996b4['attributes'],function(_0x38e41e){var _0x48b17d={};_0x48b17d[_0x38e41e]={'$like':'%'+_0x43fa33[_0x6a8d('0x3c')][_0x6a8d('0x57')]+'%'};return _0x48b17d;})});}_0xd996b4=_['merge']({},_0xd996b4,_0x43fa33[_0x6a8d('0x4f')]);return _0x50111a[_0x6a8d('0x53')](_0xd996b4);}})[_0x6a8d('0x33')](function(_0x33875d){if(_0x33875d){_0x3de43d=_0x33875d[_0x6a8d('0x41')];if(!_0x43fa33[_0x6a8d('0x3c')][_0x6a8d('0x42')](_0x6a8d('0x58'))){_0xd996b4[_0x6a8d('0x2b')]=qs[_0x6a8d('0x2b')](_0x43fa33[_0x6a8d('0x3c')][_0x6a8d('0x2b')]);_0xd996b4[_0x6a8d('0x28')]=qs[_0x6a8d('0x28')](_0x43fa33['query'][_0x6a8d('0x28')]);}return _0x50111a['getConfigurations'](_0xd996b4);}})[_0x6a8d('0x33')](function(_0x1c1f7e){if(_0x1c1f7e){return _0x1c1f7e?{'count':_0x3de43d,'rows':_0x1c1f7e}:null;}})['then'](respondWithResult(_0x2af532,null))[_0x6a8d('0x24')](handleError(_0x2af532,null));};exports[_0x6a8d('0x59')]=function(_0x339d89,_0x2e8497,_0x3dc3ea){if(_0x339d89[_0x6a8d('0x51')]['id']){delete _0x339d89[_0x6a8d('0x51')]['id'];}return db[_0x6a8d('0x38')]['findOne']({'where':{'id':_0x339d89['params']['id']}})[_0x6a8d('0x33')](handleEntityNotFound(_0x2e8497,null))[_0x6a8d('0x33')](function(_0x2ba348){if(_0x2ba348){_0x339d89['body'][_0x6a8d('0x5a')]=_0x2ba348['id'];_0x339d89[_0x6a8d('0x51')][_0x6a8d('0x5b')]=integrations[_0x6a8d('0x5c')](_0x339d89[_0x6a8d('0x51')][_0x6a8d('0x5d')],_0x339d89[_0x6a8d('0x51')]['type']);_0x339d89['body'][_0x6a8d('0x5e')]=integrations[_0x6a8d('0x5f')](_0x339d89['body'][_0x6a8d('0x5d')],_0x339d89[_0x6a8d('0x51')]['type']);return db[_0x6a8d('0x55')][_0x6a8d('0x50')](_0x339d89[_0x6a8d('0x51')],{'include':[{'model':db[_0x6a8d('0x60')],'as':'Subjects'},{'model':db[_0x6a8d('0x60')],'as':'Descriptions'}]});}return null;})[_0x6a8d('0x33')](respondWithResult(_0x2e8497,null))[_0x6a8d('0x24')](handleError(_0x2e8497,null));};exports[_0x6a8d('0x61')]=function(_0x244c3e,_0x580292,_0x4cfba1){var _0xce7967=[_0x6a8d('0x62'),_0x6a8d('0x63'),_0x6a8d('0x64'),_0x6a8d('0x65'),_0x6a8d('0x66'),_0x6a8d('0x67'),'incident_state','severity',_0x6a8d('0x68')];var _0x4e1cd1=[_0x6a8d('0x69'),_0x6a8d('0x62'),'caused_by','watch_list',_0x6a8d('0x6a'),_0x6a8d('0x6b'),_0x6a8d('0x6c'),_0x6a8d('0x63'),_0x6a8d('0x6d'),_0x6a8d('0x6e'),_0x6a8d('0x6f'),_0x6a8d('0x70'),'opened_by',_0x6a8d('0x71'),_0x6a8d('0x72'),_0x6a8d('0x73'),_0x6a8d('0x74'),_0x6a8d('0x75'),_0x6a8d('0x64'),_0x6a8d('0x43'),'calendar_stc',_0x6a8d('0x76'),_0x6a8d('0x77'),_0x6a8d('0x78'),_0x6a8d('0x79'),_0x6a8d('0x7a'),'work_notes_list',_0x6a8d('0x7b'),_0x6a8d('0x7c'),_0x6a8d('0x7d'),'rfc',_0x6a8d('0x7e'),_0x6a8d('0x7f'),'opened_at',_0x6a8d('0x80'),'group_list',_0x6a8d('0x81'),_0x6a8d('0x82'),_0x6a8d('0x83'),_0x6a8d('0x84'),'approval_set','subcategory','work_notes','short_description','close_code','correlation_display',_0x6a8d('0x85'),_0x6a8d('0x86'),_0x6a8d('0x87'),'business_stc',_0x6a8d('0x88'),_0x6a8d('0x89'),_0x6a8d('0x8a'),_0x6a8d('0x67'),_0x6a8d('0x8b'),_0x6a8d('0x8c'),'closed_by',_0x6a8d('0x8d'),'parent_incident',_0x6a8d('0x8e'),_0x6a8d('0x8f'),_0x6a8d('0x90'),_0x6a8d('0x91'),_0x6a8d('0x92'),'problem_id',_0x6a8d('0x93'),'reassignment_count',_0x6a8d('0x94'),_0x6a8d('0x95'),'severity',_0x6a8d('0x96'),_0x6a8d('0x97'),_0x6a8d('0x98'),_0x6a8d('0x99'),_0x6a8d('0x9a'),'sys_mod_count','reopen_count',_0x6a8d('0x9b'),_0x6a8d('0x9c'),_0x6a8d('0x9d'),'correlation_id',_0x6a8d('0x9e'),'category'];var _0x35ccec='';var _0xb5ba00='';var _0x379149=[];var _0x4107f5='';var _0x540fa3='';var _0x3a74f3=[];var _0xddaa12='';var _0x4750c2='';var _0x58a4f4={};var _0x18dff2='';return db['ServicenowAccount']['findOne']({'where':{'id':_0x244c3e[_0x6a8d('0x4e')]['id']},'attributes':['id','username',_0x6a8d('0x9f'),_0x6a8d('0xa0'),_0x6a8d('0xa1'),'serverUrl']})[_0x6a8d('0x33')](handleEntityNotFound(_0x580292,null))[_0x6a8d('0x33')](function(_0x174f7d){if(_0x174f7d){_0x18dff2=_0x174f7d[_0x6a8d('0xa1')];var _0x3d853a=_0x18dff2[_0x6a8d('0xa2')](-0x1);if(_0x3d853a==='/'){_0x18dff2=_0x18dff2[_0x6a8d('0xa3')](0x0,_0x18dff2[_0x6a8d('0xa4')](_0x3d853a));}_0x4750c2=util[_0x6a8d('0xa5')]('%s/api/now/doc/table/schema/',_0x18dff2);_0xddaa12=util[_0x6a8d('0xa5')]('%s/api/now/table/',_0x18dff2);_0x58a4f4={'user':_0x174f7d[_0x6a8d('0xa6')],'pass':_0x174f7d['password']};var _0x19e21e={'method':'GET','uri':_0x4750c2+_0x6a8d('0xa7'),'auth':_0x58a4f4,'json':!![]};return rp(_0x19e21e);}})['then'](function(_0x161699){if(_0x161699[_0x6a8d('0xa8')][_0x6a8d('0x41')]>0x0){_0x35ccec=_0x161699[_0x6a8d('0xa8')];}console[_0x6a8d('0xa9')](_0x6a8d('0xaa'),_0x35ccec);_0x3a74f3=[];_0xb5ba00=Object['assign']([],_0x35ccec);_[_0x6a8d('0xab')](_0xb5ba00,function(_0xd7693e){return!_0xce7967['includes'](_0xd7693e[_0x6a8d('0x35')]);});_0xb5ba00['forEach'](function(_0x97e2f4){var _0x52df4f=createFieldObject(_0xddaa12,_0x58a4f4,_0x97e2f4[_0x6a8d('0xac')],_0x97e2f4[_0x6a8d('0x35')],_0x97e2f4[_0x6a8d('0xad')],![]);_0x3a74f3[_0x6a8d('0xae')](_0x52df4f);});return Promise[_0x6a8d('0xaf')](_0x3a74f3);})[_0x6a8d('0x33')](function(_0x1f5043){_0x379149=_0x1f5043;_0x4107f5=Object[_0x6a8d('0xb0')]([],_0x35ccec);console[_0x6a8d('0xa9')](_0x6a8d('0xb1'),_0x35ccec);_[_0x6a8d('0xab')](_0x4107f5,function(_0x5cb023){return _0x4e1cd1['includes'](_0x5cb023[_0x6a8d('0x35')]);});console[_0x6a8d('0xa9')](_0x6a8d('0xb2'),_0x4107f5);_0x3a74f3=[];_0x4107f5[_0x6a8d('0xb3')](function(_0x38ca37){var _0x3d9b02=createFieldObject(_0xddaa12,_0x58a4f4,_0x38ca37[_0x6a8d('0xac')],_0x38ca37[_0x6a8d('0x35')],_0x38ca37[_0x6a8d('0xad')],!![]);_0x3a74f3['push'](_0x3d9b02);});return Promise[_0x6a8d('0xaf')](_0x3a74f3);})[_0x6a8d('0x33')](function(_0x53cfa6){_0x540fa3=_0x53cfa6;var _0x53800e=_0x379149['concat'](_0x540fa3);return{'count':_0x53800e[_0x6a8d('0x41')],'rows':_0x53800e};})[_0x6a8d('0x33')](respondWithResult(_0x580292,null))[_0x6a8d('0x24')](function(_0x1d6b04){console[_0x6a8d('0xa9')](_0x6a8d('0xb4')+_0x1d6b04);var _0x108974=_0x244c3e['query']['test']?0x1f4:_0x1d6b04[_0x6a8d('0xb5')]||0x1f4;logger[_0x6a8d('0x21')](_0x1d6b04[_0x6a8d('0x34')]);delete _0x1d6b04[_0x6a8d('0x35')];if(_0x108974===0x191){_0x108974=0x190;}_0x580292['status'](_0x108974)[_0x6a8d('0xb6')](_0x244c3e[_0x6a8d('0x3c')][_0x6a8d('0xb7')]?{'message':_0x6a8d('0xb8'),'statusCode':_0x1d6b04[_0x6a8d('0xb5')]}:_0x1d6b04);});};function createFieldObject(_0x5820e0,_0x4375bc,_0x30a404,_0x3290f8,_0x4e1e05,_0x3177d4){return new Promise(function(_0x292d73,_0x44f694){var _0x44f530={'id':_0x3290f8,'name':_0x4e1e05,'custom':_0x3177d4};if(_0x30a404===_0x6a8d('0xb9')){_0x44f530[_0x6a8d('0x4f')]=[{'name':'True','value':_0x6a8d('0xba')},{'name':_0x6a8d('0xbb'),'value':_0x6a8d('0xbc')}];_0x292d73(_0x44f530);}else{var _0x37ad44={'method':_0x6a8d('0xbd'),'uri':_0x5820e0+_0x6a8d('0xbe')+_0x3290f8,'auth':_0x4375bc,'json':!![]};return rp(_0x37ad44)['then'](function(_0x5e671f){var _0x4ca273=[];if(_0x5e671f[_0x6a8d('0xa8')][_0x6a8d('0x41')]>0x0){_0x5e671f[_0x6a8d('0xa8')][_0x6a8d('0xb3')](function(_0x46cdf8){if(_0x46cdf8['inactive']===_0x6a8d('0xbc')){var _0x2a4f05={'name':_0x46cdf8[_0x6a8d('0xad')],'value':_0x46cdf8['value']};_0x4ca273[_0x6a8d('0xae')](_0x2a4f05);}});}_0x44f530['options']=_0x4ca273;if(_0x44f530[_0x6a8d('0x4f')][_0x6a8d('0x41')]>0x0){_0x292d73(_0x44f530);}else{if(_0x3177d4==![]){_0x292d73();}else{_0x292d73(_0x44f530);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index 8c635af..b88d00d 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 _0x7c09=['rimraf','../../config/environment','./intServicenowAccount.attributes','define','ServicenowAccount','int_servicenow_accounts','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x2cb58b,_0x5a879d){var _0xe9dd9c=function(_0x11e835){while(--_0x11e835){_0x2cb58b['push'](_0x2cb58b['shift']());}};_0xe9dd9c(++_0x5a879d);}(_0x7c09,0x102));var _0x97c0=function(_0x292d41,_0x5ab8e3){_0x292d41=_0x292d41-0x0;var _0xc6af30=_0x7c09[_0x292d41];return _0xc6af30;};'use strict';var _=require('lodash');var util=require(_0x97c0('0x0'));var logger=require(_0x97c0('0x1'))('api');var moment=require(_0x97c0('0x2'));var BPromise=require(_0x97c0('0x3'));var rp=require(_0x97c0('0x4'));var fs=require('fs');var path=require(_0x97c0('0x5'));var rimraf=require(_0x97c0('0x6'));var config=require(_0x97c0('0x7'));var attributes=require(_0x97c0('0x8'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x590368,_0x46fdd9){return _0x590368[_0x97c0('0x9')](_0x97c0('0xa'),attributes,{'tableName':_0x97c0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7217=['api','moment','bluebird','request-promise','../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration','exports','define','ServicenowAccount','int_servicenow_accounts','lodash','../../config/logger'];(function(_0x366776,_0x461d68){var _0x2447f6=function(_0x5be437){while(--_0x5be437){_0x366776['push'](_0x366776['shift']());}};_0x2447f6(++_0x461d68);}(_0x7217,0x19e));var _0x7721=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0x7217[_0x25bea7];return _0x175952;};'use strict';var _=require(_0x7721('0x0'));var util=require('util');var logger=require(_0x7721('0x1'))(_0x7721('0x2'));var moment=require(_0x7721('0x3'));var BPromise=require(_0x7721('0x4'));var rp=require(_0x7721('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7721('0x6'));var attributes=require(_0x7721('0x7'));var integrations=require(_0x7721('0x8'));module[_0x7721('0x9')]=function(_0xb239e0,_0xf7ff37){return _0xb239e0[_0x7721('0xa')](_0x7721('0xb'),attributes,{'tableName':_0x7721('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.rpc.js b/server/api/intServicenowAccount/intServicenowAccount.rpc.js index deeb4bc..d9917a2 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 _0x3876=['ShowServicenowAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','ServicenowAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','catch','GetServicenowAccount','findAll','options','raw','where','attributes','limit','include','map','model','then'];(function(_0x26f9d0,_0x3f1281){var _0x5a43f4=function(_0x1708e1){while(--_0x1708e1){_0x26f9d0['push'](_0x26f9d0['shift']());}};_0x5a43f4(++_0x3f1281);}(_0x3876,0x92));var _0x6387=function(_0x42e24a,_0x50f460){_0x42e24a=_0x42e24a-0x0;var _0x331ad2=_0x3876[_0x42e24a];return _0x331ad2;};'use strict';var _=require(_0x6387('0x0'));var util=require(_0x6387('0x1'));var moment=require(_0x6387('0x2'));var BPromise=require(_0x6387('0x3'));var rs=require(_0x6387('0x4'));var fs=require('fs');var Redis=require(_0x6387('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x6387('0x6'));var logger=require(_0x6387('0x7'))(_0x6387('0x8'));var config=require(_0x6387('0x9'));var jayson=require(_0x6387('0xa'));var client=jayson[_0x6387('0xb')][_0x6387('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4ae53c,_0x3e816e,_0xfad839){return new BPromise(function(_0x1a08db,_0x4fd4a0){return client[_0x6387('0xd')](_0x4ae53c,_0xfad839)['then'](function(_0x4898fa){logger[_0x6387('0xe')](_0x6387('0xf'),_0x3e816e,'request\x20sent');logger[_0x6387('0x10')]('ServicenowAccount,\x20%s,\x20%s,\x20%s',_0x3e816e,_0x6387('0x11'),JSON[_0x6387('0x12')](_0x4898fa));if(_0x4898fa[_0x6387('0x13')]){if(_0x4898fa[_0x6387('0x13')][_0x6387('0x14')]===0x1f4){logger[_0x6387('0x13')]('ServicenowAccount,\x20%s,\x20%s',_0x3e816e,_0x4898fa[_0x6387('0x13')][_0x6387('0x15')]);return _0x4fd4a0(_0x4898fa[_0x6387('0x13')][_0x6387('0x15')]);}logger['error'](_0x6387('0xf'),_0x3e816e,_0x4898fa[_0x6387('0x13')][_0x6387('0x15')]);return _0x1a08db(_0x4898fa[_0x6387('0x13')][_0x6387('0x15')]);}else{logger[_0x6387('0xe')]('ServicenowAccount,\x20%s,\x20%s',_0x3e816e,_0x6387('0x11'));_0x1a08db(_0x4898fa['result'][_0x6387('0x15')]);}})[_0x6387('0x16')](function(_0x21ab2c){logger[_0x6387('0x13')]('ServicenowAccount,\x20%s,\x20%s',_0x3e816e,_0x21ab2c);_0x4fd4a0(_0x21ab2c);});});}exports[_0x6387('0x17')]=function(_0x11742f){var _0xb999af=this;return new Promise(function(_0x2fe80d,_0x4d2774){return db['ServicenowAccount'][_0x6387('0x18')]({'raw':_0x11742f[_0x6387('0x19')]?_0x11742f['options'][_0x6387('0x1a')]===undefined?!![]:![]:!![],'where':_0x11742f[_0x6387('0x19')]?_0x11742f[_0x6387('0x19')][_0x6387('0x1b')]||null:null,'attributes':_0x11742f[_0x6387('0x19')]?_0x11742f[_0x6387('0x19')][_0x6387('0x1c')]||null:null,'limit':_0x11742f[_0x6387('0x19')]?_0x11742f[_0x6387('0x19')][_0x6387('0x1d')]||null:null,'include':_0x11742f['options']?_0x11742f[_0x6387('0x19')][_0x6387('0x1e')]?_['map'](_0x11742f['options'][_0x6387('0x1e')],function(_0x322a1b){return{'model':db[_0x322a1b['model']],'as':_0x322a1b['as'],'attributes':_0x322a1b[_0x6387('0x1c')],'include':_0x322a1b[_0x6387('0x1e')]?_[_0x6387('0x1f')](_0x322a1b[_0x6387('0x1e')],function(_0x24d979){return{'model':db[_0x24d979[_0x6387('0x20')]],'as':_0x24d979['as'],'attributes':_0x24d979[_0x6387('0x1c')],'include':_0x24d979[_0x6387('0x1e')]?_[_0x6387('0x1f')](_0x24d979['include'],function(_0xe409c5){return{'model':db[_0xe409c5[_0x6387('0x20')]],'as':_0xe409c5['as'],'attributes':_0xe409c5[_0x6387('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x6387('0x21')](function(_0x2192b3){logger[_0x6387('0xe')](_0x6387('0x17'),_0x11742f);logger[_0x6387('0x10')](_0x6387('0x17'),_0x11742f,JSON[_0x6387('0x12')](_0x2192b3));_0x2fe80d(_0x2192b3);})[_0x6387('0x16')](function(_0x227ad8){logger[_0x6387('0x13')]('GetServicenowAccount',_0x227ad8['message'],_0x11742f);_0x4d2774(_0xb999af[_0x6387('0x13')](0x1f4,_0x227ad8[_0x6387('0x15')]));});});};exports[_0x6387('0x22')]=function(_0x268f9e){var _0x180285=this;return new Promise(function(_0x968519,_0xd70b0){return db['ServicenowAccount'][_0x6387('0x23')]({'raw':_0x268f9e[_0x6387('0x19')]?_0x268f9e[_0x6387('0x19')][_0x6387('0x1a')]===undefined?!![]:![]:!![],'where':_0x268f9e[_0x6387('0x19')]?_0x268f9e[_0x6387('0x19')][_0x6387('0x1b')]||null:null,'attributes':_0x268f9e['options']?_0x268f9e[_0x6387('0x19')][_0x6387('0x1c')]||null:null,'include':_0x268f9e[_0x6387('0x19')]?_0x268f9e['options']['include']?_[_0x6387('0x1f')](_0x268f9e[_0x6387('0x19')]['include'],function(_0x58b1e5){return{'model':db[_0x58b1e5[_0x6387('0x20')]],'as':_0x58b1e5['as'],'attributes':_0x58b1e5[_0x6387('0x1c')],'include':_0x58b1e5[_0x6387('0x1e')]?_['map'](_0x58b1e5[_0x6387('0x1e')],function(_0x211e15){return{'model':db[_0x211e15[_0x6387('0x20')]],'as':_0x211e15['as'],'attributes':_0x211e15[_0x6387('0x1c')],'include':_0x211e15[_0x6387('0x1e')]?_[_0x6387('0x1f')](_0x211e15[_0x6387('0x1e')],function(_0x5dc850){return{'model':db[_0x5dc850[_0x6387('0x20')]],'as':_0x5dc850['as'],'attributes':_0x5dc850[_0x6387('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x120f10){logger[_0x6387('0xe')](_0x6387('0x22'),_0x268f9e);logger['debug']('ShowServicenowAccount',_0x268f9e,JSON[_0x6387('0x12')](_0x120f10));_0x968519(_0x120f10);})[_0x6387('0x16')](function(_0x1e9a31){logger['error'](_0x6387('0x22'),_0x1e9a31[_0x6387('0x15')],_0x268f9e);_0xd70b0(_0x180285[_0x6387('0x13')](0x1f4,_0x1e9a31[_0x6387('0x15')]));});});}; \ No newline at end of file +var _0x0c7b=['catch','find','ShowServicenowAccount','stringify','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','request','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','code','error','message','GetServicenowAccount','ServicenowAccount','findAll','options','raw','where','attributes','limit','model','include','map'];(function(_0x51b0dc,_0x5307b7){var _0x13fa89=function(_0x2c880f){while(--_0x2c880f){_0x51b0dc['push'](_0x51b0dc['shift']());}};_0x13fa89(++_0x5307b7);}(_0x0c7b,0x136));var _0xb0c7=function(_0x218fd8,_0x47de97){_0x218fd8=_0x218fd8-0x0;var _0x22a825=_0x0c7b[_0x218fd8];return _0x22a825;};'use strict';var _=require(_0xb0c7('0x0'));var util=require(_0xb0c7('0x1'));var moment=require(_0xb0c7('0x2'));var BPromise=require('bluebird');var rs=require(_0xb0c7('0x3'));var fs=require('fs');var Redis=require(_0xb0c7('0x4'));var db=require(_0xb0c7('0x5'))['db'];var utils=require(_0xb0c7('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xb0c7('0x7'));var client=jayson[_0xb0c7('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4652a7,_0x3c2acd,_0x4087f3){return new BPromise(function(_0x14df87,_0x589525){return client[_0xb0c7('0x9')](_0x4652a7,_0x4087f3)[_0xb0c7('0xa')](function(_0x55ed24){logger[_0xb0c7('0xb')](_0xb0c7('0xc'),_0x3c2acd,_0xb0c7('0xd'));logger[_0xb0c7('0xe')](_0xb0c7('0xf'),_0x3c2acd,_0xb0c7('0xd'),JSON['stringify'](_0x55ed24));if(_0x55ed24['error']){if(_0x55ed24['error'][_0xb0c7('0x10')]===0x1f4){logger['error'](_0xb0c7('0xc'),_0x3c2acd,_0x55ed24[_0xb0c7('0x11')]['message']);return _0x589525(_0x55ed24[_0xb0c7('0x11')][_0xb0c7('0x12')]);}logger[_0xb0c7('0x11')]('ServicenowAccount,\x20%s,\x20%s',_0x3c2acd,_0x55ed24[_0xb0c7('0x11')][_0xb0c7('0x12')]);return _0x14df87(_0x55ed24[_0xb0c7('0x11')][_0xb0c7('0x12')]);}else{logger['info']('ServicenowAccount,\x20%s,\x20%s',_0x3c2acd,'request\x20sent');_0x14df87(_0x55ed24['result'][_0xb0c7('0x12')]);}})['catch'](function(_0x74fcd4){logger[_0xb0c7('0x11')](_0xb0c7('0xc'),_0x3c2acd,_0x74fcd4);_0x589525(_0x74fcd4);});});}exports[_0xb0c7('0x13')]=function(_0xe3675f){var _0x4aae38=this;return new Promise(function(_0x53f8bb,_0x20e2f4){return db[_0xb0c7('0x14')][_0xb0c7('0x15')]({'raw':_0xe3675f[_0xb0c7('0x16')]?_0xe3675f['options'][_0xb0c7('0x17')]===undefined?!![]:![]:!![],'where':_0xe3675f[_0xb0c7('0x16')]?_0xe3675f[_0xb0c7('0x16')][_0xb0c7('0x18')]||null:null,'attributes':_0xe3675f['options']?_0xe3675f[_0xb0c7('0x16')][_0xb0c7('0x19')]||null:null,'limit':_0xe3675f[_0xb0c7('0x16')]?_0xe3675f[_0xb0c7('0x16')][_0xb0c7('0x1a')]||null:null,'include':_0xe3675f[_0xb0c7('0x16')]?_0xe3675f[_0xb0c7('0x16')]['include']?_['map'](_0xe3675f[_0xb0c7('0x16')]['include'],function(_0x31b56e){return{'model':db[_0x31b56e[_0xb0c7('0x1b')]],'as':_0x31b56e['as'],'attributes':_0x31b56e[_0xb0c7('0x19')],'include':_0x31b56e[_0xb0c7('0x1c')]?_[_0xb0c7('0x1d')](_0x31b56e[_0xb0c7('0x1c')],function(_0x3e2702){return{'model':db[_0x3e2702[_0xb0c7('0x1b')]],'as':_0x3e2702['as'],'attributes':_0x3e2702[_0xb0c7('0x19')],'include':_0x3e2702['include']?_[_0xb0c7('0x1d')](_0x3e2702[_0xb0c7('0x1c')],function(_0x40f769){return{'model':db[_0x40f769['model']],'as':_0x40f769['as'],'attributes':_0x40f769['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x11ee58){logger[_0xb0c7('0xb')]('GetServicenowAccount',_0xe3675f);logger[_0xb0c7('0xe')](_0xb0c7('0x13'),_0xe3675f,JSON['stringify'](_0x11ee58));_0x53f8bb(_0x11ee58);})[_0xb0c7('0x1e')](function(_0xeb3f67){logger['error']('GetServicenowAccount',_0xeb3f67[_0xb0c7('0x12')],_0xe3675f);_0x20e2f4(_0x4aae38['error'](0x1f4,_0xeb3f67[_0xb0c7('0x12')]));});});};exports['ShowServicenowAccount']=function(_0x529cbe){var _0x5acb9b=this;return new Promise(function(_0x5a19a8,_0x3fbc6){return db['ServicenowAccount'][_0xb0c7('0x1f')]({'raw':_0x529cbe[_0xb0c7('0x16')]?_0x529cbe[_0xb0c7('0x16')][_0xb0c7('0x17')]===undefined?!![]:![]:!![],'where':_0x529cbe[_0xb0c7('0x16')]?_0x529cbe[_0xb0c7('0x16')][_0xb0c7('0x18')]||null:null,'attributes':_0x529cbe[_0xb0c7('0x16')]?_0x529cbe[_0xb0c7('0x16')][_0xb0c7('0x19')]||null:null,'include':_0x529cbe[_0xb0c7('0x16')]?_0x529cbe['options']['include']?_[_0xb0c7('0x1d')](_0x529cbe[_0xb0c7('0x16')]['include'],function(_0x2e12a9){return{'model':db[_0x2e12a9['model']],'as':_0x2e12a9['as'],'attributes':_0x2e12a9[_0xb0c7('0x19')],'include':_0x2e12a9[_0xb0c7('0x1c')]?_[_0xb0c7('0x1d')](_0x2e12a9[_0xb0c7('0x1c')],function(_0x37efd7){return{'model':db[_0x37efd7['model']],'as':_0x37efd7['as'],'attributes':_0x37efd7[_0xb0c7('0x19')],'include':_0x37efd7[_0xb0c7('0x1c')]?_[_0xb0c7('0x1d')](_0x37efd7['include'],function(_0x66358){return{'model':db[_0x66358[_0xb0c7('0x1b')]],'as':_0x66358['as'],'attributes':_0x66358[_0xb0c7('0x19')]};}):[]};}):[]};}):[]:[]})[_0xb0c7('0xa')](function(_0x18601c){logger[_0xb0c7('0xb')](_0xb0c7('0x20'),_0x529cbe);logger[_0xb0c7('0xe')](_0xb0c7('0x20'),_0x529cbe,JSON[_0xb0c7('0x21')](_0x18601c));_0x5a19a8(_0x18601c);})[_0xb0c7('0x1e')](function(_0x14b464){logger[_0xb0c7('0x11')]('ShowServicenowAccount',_0x14b464[_0xb0c7('0x12')],_0x529cbe);_0x3fbc6(_0x5acb9b[_0xb0c7('0x11')](0x1f4,_0x14b464[_0xb0c7('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index e618062..ce002de 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 _0x5de1=['index','getFields','/:id/subjects','isAuthenticated','getSubjects','/:id/descriptions','getDescriptions','post','create','/:id','update','delete','destroy','exports','multer','util','path','Router','../../components/auth/service','../../config/environment','./intServicenowConfiguration.controller','get'];(function(_0x4dcaf4,_0x59ff4d){var _0x3c68e6=function(_0x5764a0){while(--_0x5764a0){_0x4dcaf4['push'](_0x4dcaf4['shift']());}};_0x3c68e6(++_0x59ff4d);}(_0x5de1,0x158));var _0x15de=function(_0x1ad360,_0x3f9682){_0x1ad360=_0x1ad360-0x0;var _0x3c7731=_0x5de1[_0x1ad360];return _0x3c7731;};'use strict';var multer=require(_0x15de('0x0'));var util=require(_0x15de('0x1'));var path=require(_0x15de('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x15de('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x15de('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x15de('0x5'));var controller=require(_0x15de('0x6'));router[_0x15de('0x7')]('/',auth['isAuthenticated'](),controller[_0x15de('0x8')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0x15de('0x7')]('/:id/fields',auth['isAuthenticated'](),controller[_0x15de('0x9')]);router[_0x15de('0x7')](_0x15de('0xa'),auth[_0x15de('0xb')](),controller[_0x15de('0xc')]);router[_0x15de('0x7')](_0x15de('0xd'),auth[_0x15de('0xb')](),controller[_0x15de('0xe')]);router[_0x15de('0xf')]('/',auth[_0x15de('0xb')](),controller[_0x15de('0x10')]);router['put'](_0x15de('0x11'),auth[_0x15de('0xb')](),controller[_0x15de('0x12')]);router[_0x15de('0x13')](_0x15de('0x11'),auth[_0x15de('0xb')](),controller[_0x15de('0x14')]);module[_0x15de('0x15')]=router; \ No newline at end of file +var _0x9051=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intServicenowConfiguration.controller','get','isAuthenticated','index','/:id','show','getFields','getSubjects','/:id/descriptions','getDescriptions','post','create','put','delete','destroy','multer','util','connect-timeout'];(function(_0x4c3174,_0x5f05b3){var _0x5eff20=function(_0x4038c5){while(--_0x4038c5){_0x4c3174['push'](_0x4c3174['shift']());}};_0x5eff20(++_0x5f05b3);}(_0x9051,0x9e));var _0x1905=function(_0x150eb9,_0x47b0e1){_0x150eb9=_0x150eb9-0x0;var _0x2f0feb=_0x9051[_0x150eb9];return _0x2f0feb;};'use strict';var multer=require(_0x1905('0x0'));var util=require(_0x1905('0x1'));var path=require('path');var timeout=require(_0x1905('0x2'));var express=require(_0x1905('0x3'));var router=express[_0x1905('0x4')]();var fs_extra=require(_0x1905('0x5'));var auth=require(_0x1905('0x6'));var interaction=require(_0x1905('0x7'));var config=require('../../config/environment');var controller=require(_0x1905('0x8'));router[_0x1905('0x9')]('/',auth[_0x1905('0xa')](),controller[_0x1905('0xb')]);router[_0x1905('0x9')](_0x1905('0xc'),auth[_0x1905('0xa')](),controller[_0x1905('0xd')]);router['get']('/:id/fields',auth['isAuthenticated'](),controller[_0x1905('0xe')]);router['get']('/:id/subjects',auth['isAuthenticated'](),controller[_0x1905('0xf')]);router[_0x1905('0x9')](_0x1905('0x10'),auth[_0x1905('0xa')](),controller[_0x1905('0x11')]);router[_0x1905('0x12')]('/',auth[_0x1905('0xa')](),controller[_0x1905('0x13')]);router[_0x1905('0x14')](_0x1905('0xc'),auth[_0x1905('0xa')](),controller['update']);router[_0x1905('0x15')]('/:id',auth[_0x1905('0xa')](),controller[_0x1905('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index 6427061..e1b573e 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 _0xc4dd=['exports','STRING','sequelize'];(function(_0x362341,_0x3d1d61){var _0x584946=function(_0x4a85bc){while(--_0x4a85bc){_0x362341['push'](_0x362341['shift']());}};_0x584946(++_0x3d1d61);}(_0xc4dd,0x18e));var _0xdc4d=function(_0x1d6440,_0x540141){_0x1d6440=_0x1d6440-0x0;var _0x347f1a=_0xc4dd[_0x1d6440];return _0x347f1a;};'use strict';var Sequelize=require(_0xdc4d('0x0'));module[_0xdc4d('0x1')]={'name':{'type':Sequelize[_0xdc4d('0x2')]},'description':{'type':Sequelize[_0xdc4d('0x2')]}}; \ No newline at end of file +var _0xb821=['exports','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb821,0xac));var _0x1b82=function(_0x4b84b0,_0x2f80a4){_0x4b84b0=_0x4b84b0-0x0;var _0xe925b4=_0xb821[_0x4b84b0];return _0xe925b4;};'use strict';var Sequelize=require('sequelize');module[_0x1b82('0x0')]={'name':{'type':Sequelize[_0x1b82('0x1')]},'description':{'type':Sequelize[_0x1b82('0x1')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index 508fe21..bed5105 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 _0x155b=['util','path','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','http','request','then','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','status','end','undefined','limit','offset','count','Content-Range','json','save','stack','name','send','index','map','ServicenowConfiguration','rawAttributes','key','model','query','intersection','attributes','fields','length','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','findAll','show','params','keys','include','find','create','body','destroy','getFields','ServicenowField','order','nolimit','findOne','hasOwnProperty','getSubjects','getDescriptions','rimraf','fast-json-patch','moment','bluebird','mustache'];(function(_0xf1b29b,_0xc7f459){var _0x2de436=function(_0x43da76){while(--_0x43da76){_0xf1b29b['push'](_0xf1b29b['shift']());}};_0x2de436(++_0xc7f459);}(_0x155b,0xa3));var _0xb155=function(_0x33ac75,_0x4953e3){_0x33ac75=_0x33ac75-0x0;var _0x34d5f2=_0x155b[_0x33ac75];return _0x34d5f2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb155('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb155('0x1'));var rp=require('request-promise');var moment=require(_0xb155('0x2'));var BPromise=require(_0xb155('0x3'));var Mustache=require(_0xb155('0x4'));var util=require(_0xb155('0x5'));var path=require(_0xb155('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb155('0x7'));var squel=require(_0xb155('0x8'));var crypto=require(_0xb155('0x9'));var jsforce=require(_0xb155('0xa'));var deskjs=require(_0xb155('0xb'));var toCsv=require(_0xb155('0xc'));var querystring=require(_0xb155('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xb155('0xe'));var qs=require(_0xb155('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb155('0x10'));var logger=require(_0xb155('0x11'))(_0xb155('0x12'));var utils=require('../../config/utils');var config=require(_0xb155('0x13'));var licenseUtil=require(_0xb155('0x14'));var db=require(_0xb155('0x15'))['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0xb155('0x16')]({'port':0x232a});function respondWithRpcPromise(_0x1d39f3,_0x3cd230,_0x20d749,_0x244492){return new BPromise(function(_0x56414c,_0x403fb5){var _0x201c21=_0x244492||client;return _0x201c21[_0xb155('0x17')](_0x1d39f3,_0x20d749)[_0xb155('0x18')](function(_0x4b53c1){logger[_0xb155('0x19')](_0xb155('0x1a'),_0x3cd230,_0xb155('0x1b'));logger[_0xb155('0x1c')](_0xb155('0x1d'),_0x3cd230,_0xb155('0x1b'),JSON[_0xb155('0x1e')](_0x4b53c1));if(_0x4b53c1[_0xb155('0x1f')]){if(_0x4b53c1[_0xb155('0x1f')]['code']===0x1f4){logger[_0xb155('0x1f')](_0xb155('0x1a'),_0x3cd230,_0x4b53c1[_0xb155('0x1f')][_0xb155('0x20')]);return _0x403fb5(_0x4b53c1[_0xb155('0x1f')][_0xb155('0x20')]);}logger[_0xb155('0x1f')](_0xb155('0x1a'),_0x3cd230,_0x4b53c1[_0xb155('0x1f')][_0xb155('0x20')]);return _0x56414c(_0x4b53c1[_0xb155('0x1f')][_0xb155('0x20')]);}else{logger[_0xb155('0x19')](_0xb155('0x1a'),_0x3cd230,'request\x20sent');_0x56414c(_0x4b53c1['result']['message']);}})[_0xb155('0x21')](function(_0x36e178){logger[_0xb155('0x1f')](_0xb155('0x1a'),_0x3cd230,_0x36e178);_0x403fb5(_0x36e178);});});}function respondWithStatusCode(_0x491193,_0x58b2f2){_0x58b2f2=_0x58b2f2||0xcc;return function(_0x429a9a){if(_0x429a9a){return _0x491193['sendStatus'](_0x58b2f2);}return _0x491193[_0xb155('0x22')](_0x58b2f2)[_0xb155('0x23')]();};}function respondWithResult(_0x4c76de,_0xa2c41f){_0xa2c41f=_0xa2c41f||0xc8;return function(_0x2c230a){if(_0x2c230a){return _0x4c76de[_0xb155('0x22')](_0xa2c41f)['json'](_0x2c230a);}};}function respondWithFilteredResult(_0x35c6bd,_0xa2c4d2){return function(_0x413361){if(_0x413361){var _0x1551d5=typeof _0xa2c4d2['offset']===_0xb155('0x24')&&typeof _0xa2c4d2[_0xb155('0x25')]===_0xb155('0x24');var _0x3f9cc9=_0x413361['count'];var _0x3333be=_0x1551d5?0x0:_0xa2c4d2[_0xb155('0x26')];var _0x5b00bb=_0x1551d5?_0x413361[_0xb155('0x27')]:_0xa2c4d2[_0xb155('0x26')]+_0xa2c4d2[_0xb155('0x25')];var _0xfced90;if(_0x5b00bb>=_0x3f9cc9){_0x5b00bb=_0x3f9cc9;_0xfced90=0xc8;}else{_0xfced90=0xce;}_0x35c6bd[_0xb155('0x22')](_0xfced90);return _0x35c6bd['set'](_0xb155('0x28'),_0x3333be+'-'+_0x5b00bb+'/'+_0x3f9cc9)[_0xb155('0x29')](_0x413361);}return null;};}function patchUpdates(_0x3fdaac){return function(_0x228bd0){try{jsonpatch['apply'](_0x228bd0,_0x3fdaac,!![]);}catch(_0x2015e5){return BPromise['reject'](_0x2015e5);}return _0x228bd0[_0xb155('0x2a')]();};}function saveUpdates(_0x15ad7b,_0x9ce93d){return function(_0x48e013){if(_0x48e013){return _0x48e013['update'](_0x15ad7b)[_0xb155('0x18')](function(_0x56d997){return _0x56d997;});}return null;};}function removeEntity(_0x16097d,_0x3bcd20){return function(_0x239ba9){if(_0x239ba9){return _0x239ba9['destroy']()[_0xb155('0x18')](function(){_0x16097d[_0xb155('0x22')](0xcc)[_0xb155('0x23')]();});}};}function handleEntityNotFound(_0xdb778f,_0x1fbe98){return function(_0xdf1a52){if(!_0xdf1a52){_0xdb778f['sendStatus'](0x194);}return _0xdf1a52;};}function handleError(_0x3bb602,_0x59010d){_0x59010d=_0x59010d||0x1f4;return function(_0x4b8d02){logger[_0xb155('0x1f')](_0x4b8d02[_0xb155('0x2b')]);if(_0x4b8d02[_0xb155('0x2c')]){delete _0x4b8d02[_0xb155('0x2c')];}_0x3bb602['status'](_0x59010d)[_0xb155('0x2d')](_0x4b8d02);};}exports[_0xb155('0x2e')]=function(_0x133087,_0x1b226d){var _0x39a6ce={},_0x4fdcd5={},_0x147abc={'count':0x0,'rows':[]};var _0x49074c=_[_0xb155('0x2f')](db[_0xb155('0x30')][_0xb155('0x31')],function(_0x2156c7){return{'name':_0x2156c7['fieldName'],'type':_0x2156c7['type'][_0xb155('0x32')]};});_0x4fdcd5[_0xb155('0x33')]=_[_0xb155('0x2f')](_0x49074c,'name');_0x4fdcd5['query']=_['keys'](_0x133087[_0xb155('0x34')]);_0x4fdcd5['filters']=_[_0xb155('0x35')](_0x4fdcd5[_0xb155('0x33')],_0x4fdcd5['query']);_0x39a6ce[_0xb155('0x36')]=_[_0xb155('0x35')](_0x4fdcd5[_0xb155('0x33')],qs[_0xb155('0x37')](_0x133087[_0xb155('0x34')][_0xb155('0x37')]));_0x39a6ce[_0xb155('0x36')]=_0x39a6ce['attributes'][_0xb155('0x38')]?_0x39a6ce['attributes']:_0x4fdcd5[_0xb155('0x33')];if(!_0x133087[_0xb155('0x34')]['hasOwnProperty']('nolimit')){_0x39a6ce[_0xb155('0x25')]=qs[_0xb155('0x25')](_0x133087[_0xb155('0x34')]['limit']);_0x39a6ce[_0xb155('0x26')]=qs[_0xb155('0x26')](_0x133087['query']['offset']);}_0x39a6ce['order']=qs[_0xb155('0x39')](_0x133087[_0xb155('0x34')][_0xb155('0x39')]);_0x39a6ce[_0xb155('0x3a')]=qs[_0xb155('0x3b')](_[_0xb155('0x3c')](_0x133087[_0xb155('0x34')],_0x4fdcd5[_0xb155('0x3b')]),_0x49074c);if(_0x133087['query'][_0xb155('0x3d')]){_0x39a6ce['where']=_[_0xb155('0x3e')](_0x39a6ce[_0xb155('0x3a')],{'$or':_[_0xb155('0x2f')](_0x49074c,function(_0x15f54e){if(_0x15f54e[_0xb155('0x3f')]!==_0xb155('0x40')){var _0x58df24={};_0x58df24[_0x15f54e['name']]={'$like':'%'+_0x133087[_0xb155('0x34')][_0xb155('0x3d')]+'%'};return _0x58df24;}})});}_0x39a6ce=_[_0xb155('0x3e')]({},_0x39a6ce,_0x133087[_0xb155('0x41')]);var _0x44b374={'where':_0x39a6ce[_0xb155('0x3a')]};return db[_0xb155('0x30')][_0xb155('0x27')](_0x44b374)[_0xb155('0x18')](function(_0x37d0be){_0x147abc[_0xb155('0x27')]=_0x37d0be;if(_0x133087[_0xb155('0x34')][_0xb155('0x42')]){_0x39a6ce['include']=[{'all':!![]}];}return db[_0xb155('0x30')][_0xb155('0x43')](_0x39a6ce);})['then'](function(_0x46c8f2){_0x147abc['rows']=_0x46c8f2;return _0x147abc;})['then'](respondWithFilteredResult(_0x1b226d,_0x39a6ce))[_0xb155('0x21')](handleError(_0x1b226d,null));};exports[_0xb155('0x44')]=function(_0x15d1d2,_0x408e95){var _0x3c5e74={'raw':![],'where':{'id':_0x15d1d2[_0xb155('0x45')]['id']}},_0x4ae369={};_0x4ae369['model']=_['keys'](db[_0xb155('0x30')][_0xb155('0x31')]);_0x4ae369[_0xb155('0x34')]=_[_0xb155('0x46')](_0x15d1d2['query']);_0x4ae369['filters']=_[_0xb155('0x35')](_0x4ae369[_0xb155('0x33')],_0x4ae369['query']);_0x3c5e74['attributes']=_['intersection'](_0x4ae369[_0xb155('0x33')],qs[_0xb155('0x37')](_0x15d1d2[_0xb155('0x34')][_0xb155('0x37')]));_0x3c5e74[_0xb155('0x36')]=_0x3c5e74[_0xb155('0x36')][_0xb155('0x38')]?_0x3c5e74[_0xb155('0x36')]:_0x4ae369[_0xb155('0x33')];if(_0x15d1d2[_0xb155('0x34')]['includeAll']){_0x3c5e74[_0xb155('0x47')]=[{'all':!![]}];}_0x3c5e74=_[_0xb155('0x3e')]({},_0x3c5e74,_0x15d1d2['options']);return db[_0xb155('0x30')][_0xb155('0x48')](_0x3c5e74)['then'](handleEntityNotFound(_0x408e95,null))[_0xb155('0x18')](respondWithResult(_0x408e95,null))[_0xb155('0x21')](handleError(_0x408e95,null));};exports[_0xb155('0x49')]=function(_0x1789e3,_0x1315b9){return db[_0xb155('0x30')][_0xb155('0x49')](_0x1789e3[_0xb155('0x4a')],{})['then'](respondWithResult(_0x1315b9,0xc9))[_0xb155('0x21')](handleError(_0x1315b9,null));};exports['update']=function(_0x3a4b2b,_0x267bb4){if(_0x3a4b2b[_0xb155('0x4a')]['id']){delete _0x3a4b2b[_0xb155('0x4a')]['id'];}return db[_0xb155('0x30')]['find']({'where':{'id':_0x3a4b2b['params']['id']}})[_0xb155('0x18')](handleEntityNotFound(_0x267bb4,null))[_0xb155('0x18')](saveUpdates(_0x3a4b2b['body'],null))[_0xb155('0x18')](respondWithResult(_0x267bb4,null))['catch'](handleError(_0x267bb4,null));};exports[_0xb155('0x4b')]=function(_0x4e3b15,_0x3eae3f){return db[_0xb155('0x30')][_0xb155('0x48')]({'where':{'id':_0x4e3b15[_0xb155('0x45')]['id']}})[_0xb155('0x18')](handleEntityNotFound(_0x3eae3f,null))[_0xb155('0x18')](removeEntity(_0x3eae3f,null))['catch'](handleError(_0x3eae3f,null));};exports[_0xb155('0x4c')]=function(_0x3ddea3,_0x3e85f6,_0x5c0975){var _0xa1859f={};var _0x311a12={};var _0x299ed2;var _0x2d1637;return db['ServicenowConfiguration']['findOne']({'where':{'id':_0x3ddea3['params']['id']}})['then'](handleEntityNotFound(_0x3e85f6,null))[_0xb155('0x18')](function(_0x1c4704){if(_0x1c4704){_0x299ed2=_0x1c4704;_0x311a12[_0xb155('0x33')]=_['keys'](db[_0xb155('0x4d')][_0xb155('0x31')]);_0x311a12[_0xb155('0x34')]=_['keys'](_0x3ddea3['query']);_0x311a12['filters']=_[_0xb155('0x35')](_0x311a12[_0xb155('0x33')],_0x311a12[_0xb155('0x34')]);_0xa1859f[_0xb155('0x36')]=_[_0xb155('0x35')](_0x311a12[_0xb155('0x33')],qs[_0xb155('0x37')](_0x3ddea3['query'][_0xb155('0x37')]));_0xa1859f['attributes']=_0xa1859f[_0xb155('0x36')][_0xb155('0x38')]?_0xa1859f['attributes']:_0x311a12[_0xb155('0x33')];_0xa1859f[_0xb155('0x4e')]=qs[_0xb155('0x39')](_0x3ddea3[_0xb155('0x34')][_0xb155('0x39')]);_0xa1859f[_0xb155('0x3a')]=qs[_0xb155('0x3b')](_['pick'](_0x3ddea3[_0xb155('0x34')],_0x311a12[_0xb155('0x3b')]));if(_0x3ddea3[_0xb155('0x34')][_0xb155('0x3d')]){_0xa1859f[_0xb155('0x3a')]=_[_0xb155('0x3e')](_0xa1859f[_0xb155('0x3a')],{'$or':_[_0xb155('0x2f')](_0xa1859f[_0xb155('0x36')],function(_0x2e9926){var _0x5a8fe8={};_0x5a8fe8[_0x2e9926]={'$like':'%'+_0x3ddea3['query'][_0xb155('0x3d')]+'%'};return _0x5a8fe8;})});}_0xa1859f=_[_0xb155('0x3e')]({},_0xa1859f,_0x3ddea3[_0xb155('0x41')]);return _0x299ed2['getFields'](_0xa1859f);}})[_0xb155('0x18')](function(_0x4d81a9){if(_0x4d81a9){_0x2d1637=_0x4d81a9[_0xb155('0x38')];if(!_0x3ddea3[_0xb155('0x34')]['hasOwnProperty'](_0xb155('0x4f'))){_0xa1859f[_0xb155('0x25')]=qs[_0xb155('0x25')](_0x3ddea3['query'][_0xb155('0x25')]);_0xa1859f[_0xb155('0x26')]=qs[_0xb155('0x26')](_0x3ddea3['query']['offset']);}return _0x299ed2[_0xb155('0x4c')](_0xa1859f);}})[_0xb155('0x18')](function(_0x4f8388){if(_0x4f8388){return _0x4f8388?{'count':_0x2d1637,'rows':_0x4f8388}:null;}})[_0xb155('0x18')](respondWithResult(_0x3e85f6,null))['catch'](handleError(_0x3e85f6,null));};exports['getSubjects']=function(_0x495a48,_0x5f348e,_0x47f933){var _0x28fc8d={};var _0x2a39bb={};var _0x5d0050;var _0x44b731;return db[_0xb155('0x30')][_0xb155('0x50')]({'where':{'id':_0x495a48[_0xb155('0x45')]['id']}})[_0xb155('0x18')](handleEntityNotFound(_0x5f348e,null))[_0xb155('0x18')](function(_0x4128f2){if(_0x4128f2){_0x5d0050=_0x4128f2;_0x2a39bb['model']=_[_0xb155('0x46')](db['ServicenowField'][_0xb155('0x31')]);_0x2a39bb[_0xb155('0x34')]=_['keys'](_0x495a48[_0xb155('0x34')]);_0x2a39bb['filters']=_[_0xb155('0x35')](_0x2a39bb[_0xb155('0x33')],_0x2a39bb['query']);_0x28fc8d['attributes']=_[_0xb155('0x35')](_0x2a39bb['model'],qs[_0xb155('0x37')](_0x495a48[_0xb155('0x34')][_0xb155('0x37')]));_0x28fc8d['attributes']=_0x28fc8d[_0xb155('0x36')][_0xb155('0x38')]?_0x28fc8d[_0xb155('0x36')]:_0x2a39bb[_0xb155('0x33')];_0x28fc8d['order']=qs[_0xb155('0x39')](_0x495a48[_0xb155('0x34')][_0xb155('0x39')]);_0x28fc8d['where']=qs[_0xb155('0x3b')](_['pick'](_0x495a48[_0xb155('0x34')],_0x2a39bb[_0xb155('0x3b')]));if(_0x495a48[_0xb155('0x34')][_0xb155('0x3d')]){_0x28fc8d[_0xb155('0x3a')]=_[_0xb155('0x3e')](_0x28fc8d[_0xb155('0x3a')],{'$or':_[_0xb155('0x2f')](_0x28fc8d[_0xb155('0x36')],function(_0x4f58e8){var _0x829009={};_0x829009[_0x4f58e8]={'$like':'%'+_0x495a48[_0xb155('0x34')][_0xb155('0x3d')]+'%'};return _0x829009;})});}_0x28fc8d=_[_0xb155('0x3e')]({},_0x28fc8d,_0x495a48[_0xb155('0x41')]);return _0x5d0050['getSubjects'](_0x28fc8d);}})[_0xb155('0x18')](function(_0x176494){if(_0x176494){_0x44b731=_0x176494[_0xb155('0x38')];if(!_0x495a48[_0xb155('0x34')][_0xb155('0x51')](_0xb155('0x4f'))){_0x28fc8d[_0xb155('0x25')]=qs[_0xb155('0x25')](_0x495a48[_0xb155('0x34')][_0xb155('0x25')]);_0x28fc8d[_0xb155('0x26')]=qs[_0xb155('0x26')](_0x495a48['query'][_0xb155('0x26')]);}return _0x5d0050[_0xb155('0x52')](_0x28fc8d);}})[_0xb155('0x18')](function(_0x3bb890){if(_0x3bb890){return _0x3bb890?{'count':_0x44b731,'rows':_0x3bb890}:null;}})[_0xb155('0x18')](respondWithResult(_0x5f348e,null))[_0xb155('0x21')](handleError(_0x5f348e,null));};exports[_0xb155('0x53')]=function(_0x119f37,_0x246fc9,_0x43aa4d){var _0xf13f6d={};var _0xa76085={};var _0x3ea840;var _0x523da8;return db[_0xb155('0x30')]['findOne']({'where':{'id':_0x119f37[_0xb155('0x45')]['id']}})[_0xb155('0x18')](handleEntityNotFound(_0x246fc9,null))[_0xb155('0x18')](function(_0x56202e){if(_0x56202e){_0x3ea840=_0x56202e;_0xa76085[_0xb155('0x33')]=_[_0xb155('0x46')](db[_0xb155('0x4d')][_0xb155('0x31')]);_0xa76085['query']=_[_0xb155('0x46')](_0x119f37[_0xb155('0x34')]);_0xa76085['filters']=_['intersection'](_0xa76085[_0xb155('0x33')],_0xa76085['query']);_0xf13f6d['attributes']=_['intersection'](_0xa76085[_0xb155('0x33')],qs[_0xb155('0x37')](_0x119f37[_0xb155('0x34')][_0xb155('0x37')]));_0xf13f6d[_0xb155('0x36')]=_0xf13f6d[_0xb155('0x36')][_0xb155('0x38')]?_0xf13f6d[_0xb155('0x36')]:_0xa76085[_0xb155('0x33')];_0xf13f6d[_0xb155('0x4e')]=qs['sort'](_0x119f37[_0xb155('0x34')][_0xb155('0x39')]);_0xf13f6d[_0xb155('0x3a')]=qs[_0xb155('0x3b')](_[_0xb155('0x3c')](_0x119f37[_0xb155('0x34')],_0xa76085[_0xb155('0x3b')]));if(_0x119f37[_0xb155('0x34')]['filter']){_0xf13f6d['where']=_[_0xb155('0x3e')](_0xf13f6d[_0xb155('0x3a')],{'$or':_['map'](_0xf13f6d['attributes'],function(_0x128ce9){var _0x194693={};_0x194693[_0x128ce9]={'$like':'%'+_0x119f37['query']['filter']+'%'};return _0x194693;})});}_0xf13f6d=_[_0xb155('0x3e')]({},_0xf13f6d,_0x119f37[_0xb155('0x41')]);return _0x3ea840[_0xb155('0x53')](_0xf13f6d);}})[_0xb155('0x18')](function(_0x50f723){if(_0x50f723){_0x523da8=_0x50f723['length'];if(!_0x119f37[_0xb155('0x34')][_0xb155('0x51')]('nolimit')){_0xf13f6d[_0xb155('0x25')]=qs[_0xb155('0x25')](_0x119f37[_0xb155('0x34')][_0xb155('0x25')]);_0xf13f6d[_0xb155('0x26')]=qs[_0xb155('0x26')](_0x119f37[_0xb155('0x34')][_0xb155('0x26')]);}return _0x3ea840[_0xb155('0x53')](_0xf13f6d);}})[_0xb155('0x18')](function(_0x39e603){if(_0x39e603){return _0x39e603?{'count':_0x523da8,'rows':_0x39e603}:null;}})[_0xb155('0x18')](respondWithResult(_0x246fc9,null))[_0xb155('0x21')](handleError(_0x246fc9,null));}; \ No newline at end of file +var _0x237a=['merge','options','include','catch','show','keys','find','create','body','params','getFields','findOne','ServicenowField','order','hasOwnProperty','getSubjects','getDescriptions','eml-format','rimraf','fast-json-patch','moment','bluebird','util','path','to-csv','ejs','fs-extra','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','http','request','then','ServicenowConfiguration,\x20%s,\x20%s','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','reject','update','destroy','stack','name','send','index','map','ServicenowConfiguration','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','VIRTUAL'];(function(_0x587693,_0x27fe90){var _0x510a1a=function(_0x290f71){while(--_0x290f71){_0x587693['push'](_0x587693['shift']());}};_0x510a1a(++_0x27fe90);}(_0x237a,0x119));var _0xa237=function(_0x487890,_0x4a60f9){_0x487890=_0x487890-0x0;var _0x5c5be9=_0x237a[_0x487890];return _0x5c5be9;};'use strict';var emlformat=require(_0xa237('0x0'));var rimraf=require(_0xa237('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa237('0x2'));var rp=require('request-promise');var moment=require(_0xa237('0x3'));var BPromise=require(_0xa237('0x4'));var Mustache=require('mustache');var util=require(_0xa237('0x5'));var path=require(_0xa237('0x6'));var sox=require('sox');var csv=require(_0xa237('0x7'));var ejs=require(_0xa237('0x8'));var fs=require('fs');var fs_extra=require(_0xa237('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xa237('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xa237('0x7'));var querystring=require('querystring');var Papa=require(_0xa237('0xb'));var Redis=require(_0xa237('0xc'));var authService=require(_0xa237('0xd'));var qs=require(_0xa237('0xe'));var as=require(_0xa237('0xf'));var hardwareService=require(_0xa237('0x10'));var logger=require(_0xa237('0x11'))(_0xa237('0x12'));var utils=require('../../config/utils');var config=require(_0xa237('0x13'));var licenseUtil=require(_0xa237('0x14'));var db=require(_0xa237('0x15'))['db'];var jayson=require(_0xa237('0x16'));var client=jayson['client'][_0xa237('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x5be39b,_0x145ff8,_0x2abdc8,_0x1bb9c5){return new BPromise(function(_0x196308,_0x298a86){var _0x371b6b=_0x1bb9c5||client;return _0x371b6b[_0xa237('0x18')](_0x5be39b,_0x2abdc8)[_0xa237('0x19')](function(_0x1b46f1){logger['info'](_0xa237('0x1a'),_0x145ff8,'request\x20sent');logger['debug'](_0xa237('0x1b'),_0x145ff8,_0xa237('0x1c'),JSON[_0xa237('0x1d')](_0x1b46f1));if(_0x1b46f1[_0xa237('0x1e')]){if(_0x1b46f1[_0xa237('0x1e')][_0xa237('0x1f')]===0x1f4){logger[_0xa237('0x1e')](_0xa237('0x1a'),_0x145ff8,_0x1b46f1[_0xa237('0x1e')]['message']);return _0x298a86(_0x1b46f1[_0xa237('0x1e')][_0xa237('0x20')]);}logger[_0xa237('0x1e')](_0xa237('0x1a'),_0x145ff8,_0x1b46f1['error'][_0xa237('0x20')]);return _0x196308(_0x1b46f1[_0xa237('0x1e')][_0xa237('0x20')]);}else{logger[_0xa237('0x21')]('ServicenowConfiguration,\x20%s,\x20%s',_0x145ff8,'request\x20sent');_0x196308(_0x1b46f1[_0xa237('0x22')][_0xa237('0x20')]);}})['catch'](function(_0x19366f){logger[_0xa237('0x1e')](_0xa237('0x1a'),_0x145ff8,_0x19366f);_0x298a86(_0x19366f);});});}function respondWithStatusCode(_0x5a0ed2,_0x30aa2f){_0x30aa2f=_0x30aa2f||0xcc;return function(_0xf6bd0b){if(_0xf6bd0b){return _0x5a0ed2[_0xa237('0x23')](_0x30aa2f);}return _0x5a0ed2[_0xa237('0x24')](_0x30aa2f)[_0xa237('0x25')]();};}function respondWithResult(_0x14f777,_0x5d6983){_0x5d6983=_0x5d6983||0xc8;return function(_0x399ad6){if(_0x399ad6){return _0x14f777[_0xa237('0x24')](_0x5d6983)[_0xa237('0x26')](_0x399ad6);}};}function respondWithFilteredResult(_0x513c8c,_0x58f739){return function(_0x44389b){if(_0x44389b){var _0x363fb7=typeof _0x58f739[_0xa237('0x27')]==='undefined'&&typeof _0x58f739['limit']===_0xa237('0x28');var _0x251b3f=_0x44389b[_0xa237('0x29')];var _0x286cc1=_0x363fb7?0x0:_0x58f739[_0xa237('0x27')];var _0x4d09c0=_0x363fb7?_0x44389b[_0xa237('0x29')]:_0x58f739[_0xa237('0x27')]+_0x58f739[_0xa237('0x2a')];var _0x255e5f;if(_0x4d09c0>=_0x251b3f){_0x4d09c0=_0x251b3f;_0x255e5f=0xc8;}else{_0x255e5f=0xce;}_0x513c8c[_0xa237('0x24')](_0x255e5f);return _0x513c8c[_0xa237('0x2b')]('Content-Range',_0x286cc1+'-'+_0x4d09c0+'/'+_0x251b3f)['json'](_0x44389b);}return null;};}function patchUpdates(_0x2ceb63){return function(_0x505137){try{jsonpatch[_0xa237('0x2c')](_0x505137,_0x2ceb63,!![]);}catch(_0x50b6fe){return BPromise[_0xa237('0x2d')](_0x50b6fe);}return _0x505137['save']();};}function saveUpdates(_0x4d9736,_0x282177){return function(_0x5a6ffe){if(_0x5a6ffe){return _0x5a6ffe[_0xa237('0x2e')](_0x4d9736)['then'](function(_0x261259){return _0x261259;});}return null;};}function removeEntity(_0x5859a4,_0x1f3f93){return function(_0x311b10){if(_0x311b10){return _0x311b10[_0xa237('0x2f')]()['then'](function(){_0x5859a4[_0xa237('0x24')](0xcc)[_0xa237('0x25')]();});}};}function handleEntityNotFound(_0x3db215,_0xbc7ff3){return function(_0x590924){if(!_0x590924){_0x3db215[_0xa237('0x23')](0x194);}return _0x590924;};}function handleError(_0x43c57d,_0x5d3c25){_0x5d3c25=_0x5d3c25||0x1f4;return function(_0x206a24){logger[_0xa237('0x1e')](_0x206a24[_0xa237('0x30')]);if(_0x206a24[_0xa237('0x31')]){delete _0x206a24[_0xa237('0x31')];}_0x43c57d['status'](_0x5d3c25)[_0xa237('0x32')](_0x206a24);};}exports[_0xa237('0x33')]=function(_0x949d22,_0x5569f8){var _0x1633c2={},_0x415ff1={},_0x20041f={'count':0x0,'rows':[]};var _0x462a70=_[_0xa237('0x34')](db[_0xa237('0x35')][_0xa237('0x36')],function(_0x21e6b4){return{'name':_0x21e6b4[_0xa237('0x37')],'type':_0x21e6b4[_0xa237('0x38')][_0xa237('0x39')]};});_0x415ff1[_0xa237('0x3a')]=_[_0xa237('0x34')](_0x462a70,'name');_0x415ff1[_0xa237('0x3b')]=_['keys'](_0x949d22[_0xa237('0x3b')]);_0x415ff1[_0xa237('0x3c')]=_[_0xa237('0x3d')](_0x415ff1[_0xa237('0x3a')],_0x415ff1[_0xa237('0x3b')]);_0x1633c2[_0xa237('0x3e')]=_['intersection'](_0x415ff1[_0xa237('0x3a')],qs['fields'](_0x949d22[_0xa237('0x3b')][_0xa237('0x3f')]));_0x1633c2[_0xa237('0x3e')]=_0x1633c2[_0xa237('0x3e')][_0xa237('0x40')]?_0x1633c2[_0xa237('0x3e')]:_0x415ff1[_0xa237('0x3a')];if(!_0x949d22[_0xa237('0x3b')]['hasOwnProperty'](_0xa237('0x41'))){_0x1633c2[_0xa237('0x2a')]=qs[_0xa237('0x2a')](_0x949d22['query'][_0xa237('0x2a')]);_0x1633c2[_0xa237('0x27')]=qs[_0xa237('0x27')](_0x949d22[_0xa237('0x3b')][_0xa237('0x27')]);}_0x1633c2['order']=qs['sort'](_0x949d22[_0xa237('0x3b')][_0xa237('0x42')]);_0x1633c2[_0xa237('0x43')]=qs[_0xa237('0x3c')](_[_0xa237('0x44')](_0x949d22['query'],_0x415ff1[_0xa237('0x3c')]),_0x462a70);if(_0x949d22[_0xa237('0x3b')][_0xa237('0x45')]){_0x1633c2[_0xa237('0x43')]=_['merge'](_0x1633c2[_0xa237('0x43')],{'$or':_[_0xa237('0x34')](_0x462a70,function(_0x494de4){if(_0x494de4[_0xa237('0x38')]!==_0xa237('0x46')){var _0x120a82={};_0x120a82[_0x494de4[_0xa237('0x31')]]={'$like':'%'+_0x949d22[_0xa237('0x3b')]['filter']+'%'};return _0x120a82;}})});}_0x1633c2=_[_0xa237('0x47')]({},_0x1633c2,_0x949d22[_0xa237('0x48')]);var _0x451c7a={'where':_0x1633c2[_0xa237('0x43')]};return db['ServicenowConfiguration']['count'](_0x451c7a)[_0xa237('0x19')](function(_0x1358cb){_0x20041f[_0xa237('0x29')]=_0x1358cb;if(_0x949d22[_0xa237('0x3b')]['includeAll']){_0x1633c2[_0xa237('0x49')]=[{'all':!![]}];}return db[_0xa237('0x35')]['findAll'](_0x1633c2);})[_0xa237('0x19')](function(_0xfd1849){_0x20041f['rows']=_0xfd1849;return _0x20041f;})[_0xa237('0x19')](respondWithFilteredResult(_0x5569f8,_0x1633c2))[_0xa237('0x4a')](handleError(_0x5569f8,null));};exports[_0xa237('0x4b')]=function(_0x209e69,_0x459ec5){var _0x17edfd={'raw':![],'where':{'id':_0x209e69['params']['id']}},_0x12c1c2={};_0x12c1c2[_0xa237('0x3a')]=_[_0xa237('0x4c')](db[_0xa237('0x35')][_0xa237('0x36')]);_0x12c1c2[_0xa237('0x3b')]=_['keys'](_0x209e69['query']);_0x12c1c2[_0xa237('0x3c')]=_['intersection'](_0x12c1c2[_0xa237('0x3a')],_0x12c1c2['query']);_0x17edfd[_0xa237('0x3e')]=_[_0xa237('0x3d')](_0x12c1c2[_0xa237('0x3a')],qs[_0xa237('0x3f')](_0x209e69[_0xa237('0x3b')][_0xa237('0x3f')]));_0x17edfd[_0xa237('0x3e')]=_0x17edfd[_0xa237('0x3e')]['length']?_0x17edfd['attributes']:_0x12c1c2[_0xa237('0x3a')];if(_0x209e69['query']['includeAll']){_0x17edfd[_0xa237('0x49')]=[{'all':!![]}];}_0x17edfd=_[_0xa237('0x47')]({},_0x17edfd,_0x209e69['options']);return db[_0xa237('0x35')][_0xa237('0x4d')](_0x17edfd)['then'](handleEntityNotFound(_0x459ec5,null))[_0xa237('0x19')](respondWithResult(_0x459ec5,null))[_0xa237('0x4a')](handleError(_0x459ec5,null));};exports['create']=function(_0xeabdcd,_0x176381){return db[_0xa237('0x35')][_0xa237('0x4e')](_0xeabdcd[_0xa237('0x4f')],{})['then'](respondWithResult(_0x176381,0xc9))[_0xa237('0x4a')](handleError(_0x176381,null));};exports[_0xa237('0x2e')]=function(_0xd58ecb,_0x5c5a15){if(_0xd58ecb[_0xa237('0x4f')]['id']){delete _0xd58ecb['body']['id'];}return db[_0xa237('0x35')][_0xa237('0x4d')]({'where':{'id':_0xd58ecb[_0xa237('0x50')]['id']}})[_0xa237('0x19')](handleEntityNotFound(_0x5c5a15,null))[_0xa237('0x19')](saveUpdates(_0xd58ecb[_0xa237('0x4f')],null))[_0xa237('0x19')](respondWithResult(_0x5c5a15,null))[_0xa237('0x4a')](handleError(_0x5c5a15,null));};exports[_0xa237('0x2f')]=function(_0x4d04f3,_0x16bf1b){return db[_0xa237('0x35')][_0xa237('0x4d')]({'where':{'id':_0x4d04f3['params']['id']}})[_0xa237('0x19')](handleEntityNotFound(_0x16bf1b,null))[_0xa237('0x19')](removeEntity(_0x16bf1b,null))[_0xa237('0x4a')](handleError(_0x16bf1b,null));};exports[_0xa237('0x51')]=function(_0x5bbad2,_0x4c669d,_0xcb84a3){var _0x19d2d8={};var _0x531040={};var _0x525854;var _0x56921b;return db[_0xa237('0x35')][_0xa237('0x52')]({'where':{'id':_0x5bbad2[_0xa237('0x50')]['id']}})['then'](handleEntityNotFound(_0x4c669d,null))[_0xa237('0x19')](function(_0x538694){if(_0x538694){_0x525854=_0x538694;_0x531040[_0xa237('0x3a')]=_[_0xa237('0x4c')](db[_0xa237('0x53')][_0xa237('0x36')]);_0x531040[_0xa237('0x3b')]=_[_0xa237('0x4c')](_0x5bbad2[_0xa237('0x3b')]);_0x531040[_0xa237('0x3c')]=_[_0xa237('0x3d')](_0x531040['model'],_0x531040[_0xa237('0x3b')]);_0x19d2d8[_0xa237('0x3e')]=_[_0xa237('0x3d')](_0x531040['model'],qs[_0xa237('0x3f')](_0x5bbad2[_0xa237('0x3b')]['fields']));_0x19d2d8['attributes']=_0x19d2d8['attributes'][_0xa237('0x40')]?_0x19d2d8[_0xa237('0x3e')]:_0x531040['model'];_0x19d2d8[_0xa237('0x54')]=qs[_0xa237('0x42')](_0x5bbad2[_0xa237('0x3b')]['sort']);_0x19d2d8['where']=qs['filters'](_[_0xa237('0x44')](_0x5bbad2[_0xa237('0x3b')],_0x531040[_0xa237('0x3c')]));if(_0x5bbad2[_0xa237('0x3b')][_0xa237('0x45')]){_0x19d2d8[_0xa237('0x43')]=_[_0xa237('0x47')](_0x19d2d8[_0xa237('0x43')],{'$or':_['map'](_0x19d2d8[_0xa237('0x3e')],function(_0x256ecf){var _0x4363b9={};_0x4363b9[_0x256ecf]={'$like':'%'+_0x5bbad2[_0xa237('0x3b')]['filter']+'%'};return _0x4363b9;})});}_0x19d2d8=_[_0xa237('0x47')]({},_0x19d2d8,_0x5bbad2[_0xa237('0x48')]);return _0x525854[_0xa237('0x51')](_0x19d2d8);}})['then'](function(_0x5c869f){if(_0x5c869f){_0x56921b=_0x5c869f[_0xa237('0x40')];if(!_0x5bbad2[_0xa237('0x3b')][_0xa237('0x55')]('nolimit')){_0x19d2d8[_0xa237('0x2a')]=qs[_0xa237('0x2a')](_0x5bbad2['query'][_0xa237('0x2a')]);_0x19d2d8['offset']=qs[_0xa237('0x27')](_0x5bbad2['query'][_0xa237('0x27')]);}return _0x525854[_0xa237('0x51')](_0x19d2d8);}})[_0xa237('0x19')](function(_0x2d20f4){if(_0x2d20f4){return _0x2d20f4?{'count':_0x56921b,'rows':_0x2d20f4}:null;}})[_0xa237('0x19')](respondWithResult(_0x4c669d,null))[_0xa237('0x4a')](handleError(_0x4c669d,null));};exports[_0xa237('0x56')]=function(_0x50aaae,_0x422bbe,_0x6104bd){var _0x333c92={};var _0x53ce43={};var _0x4c1fc2;var _0x4e7798;return db[_0xa237('0x35')]['findOne']({'where':{'id':_0x50aaae[_0xa237('0x50')]['id']}})[_0xa237('0x19')](handleEntityNotFound(_0x422bbe,null))[_0xa237('0x19')](function(_0x5559ef){if(_0x5559ef){_0x4c1fc2=_0x5559ef;_0x53ce43['model']=_[_0xa237('0x4c')](db[_0xa237('0x53')][_0xa237('0x36')]);_0x53ce43['query']=_['keys'](_0x50aaae[_0xa237('0x3b')]);_0x53ce43[_0xa237('0x3c')]=_[_0xa237('0x3d')](_0x53ce43[_0xa237('0x3a')],_0x53ce43[_0xa237('0x3b')]);_0x333c92[_0xa237('0x3e')]=_[_0xa237('0x3d')](_0x53ce43[_0xa237('0x3a')],qs['fields'](_0x50aaae[_0xa237('0x3b')][_0xa237('0x3f')]));_0x333c92['attributes']=_0x333c92['attributes'][_0xa237('0x40')]?_0x333c92[_0xa237('0x3e')]:_0x53ce43[_0xa237('0x3a')];_0x333c92[_0xa237('0x54')]=qs['sort'](_0x50aaae[_0xa237('0x3b')][_0xa237('0x42')]);_0x333c92[_0xa237('0x43')]=qs[_0xa237('0x3c')](_[_0xa237('0x44')](_0x50aaae[_0xa237('0x3b')],_0x53ce43[_0xa237('0x3c')]));if(_0x50aaae['query'][_0xa237('0x45')]){_0x333c92[_0xa237('0x43')]=_[_0xa237('0x47')](_0x333c92[_0xa237('0x43')],{'$or':_[_0xa237('0x34')](_0x333c92[_0xa237('0x3e')],function(_0x4418b9){var _0xc76c6c={};_0xc76c6c[_0x4418b9]={'$like':'%'+_0x50aaae[_0xa237('0x3b')]['filter']+'%'};return _0xc76c6c;})});}_0x333c92=_[_0xa237('0x47')]({},_0x333c92,_0x50aaae['options']);return _0x4c1fc2[_0xa237('0x56')](_0x333c92);}})[_0xa237('0x19')](function(_0x194410){if(_0x194410){_0x4e7798=_0x194410['length'];if(!_0x50aaae[_0xa237('0x3b')][_0xa237('0x55')](_0xa237('0x41'))){_0x333c92[_0xa237('0x2a')]=qs[_0xa237('0x2a')](_0x50aaae[_0xa237('0x3b')][_0xa237('0x2a')]);_0x333c92[_0xa237('0x27')]=qs[_0xa237('0x27')](_0x50aaae[_0xa237('0x3b')][_0xa237('0x27')]);}return _0x4c1fc2[_0xa237('0x56')](_0x333c92);}})[_0xa237('0x19')](function(_0x4b7f80){if(_0x4b7f80){return _0x4b7f80?{'count':_0x4e7798,'rows':_0x4b7f80}:null;}})[_0xa237('0x19')](respondWithResult(_0x422bbe,null))[_0xa237('0x4a')](handleError(_0x422bbe,null));};exports[_0xa237('0x57')]=function(_0x302d4b,_0x5753e0,_0x4661ac){var _0x514352={};var _0xe76951={};var _0x544246;var _0x33c8ba;return db[_0xa237('0x35')][_0xa237('0x52')]({'where':{'id':_0x302d4b[_0xa237('0x50')]['id']}})[_0xa237('0x19')](handleEntityNotFound(_0x5753e0,null))[_0xa237('0x19')](function(_0x534477){if(_0x534477){_0x544246=_0x534477;_0xe76951[_0xa237('0x3a')]=_[_0xa237('0x4c')](db['ServicenowField'][_0xa237('0x36')]);_0xe76951[_0xa237('0x3b')]=_[_0xa237('0x4c')](_0x302d4b[_0xa237('0x3b')]);_0xe76951[_0xa237('0x3c')]=_[_0xa237('0x3d')](_0xe76951[_0xa237('0x3a')],_0xe76951[_0xa237('0x3b')]);_0x514352[_0xa237('0x3e')]=_[_0xa237('0x3d')](_0xe76951['model'],qs['fields'](_0x302d4b[_0xa237('0x3b')][_0xa237('0x3f')]));_0x514352[_0xa237('0x3e')]=_0x514352['attributes'][_0xa237('0x40')]?_0x514352[_0xa237('0x3e')]:_0xe76951[_0xa237('0x3a')];_0x514352[_0xa237('0x54')]=qs[_0xa237('0x42')](_0x302d4b[_0xa237('0x3b')][_0xa237('0x42')]);_0x514352[_0xa237('0x43')]=qs[_0xa237('0x3c')](_[_0xa237('0x44')](_0x302d4b[_0xa237('0x3b')],_0xe76951[_0xa237('0x3c')]));if(_0x302d4b['query'][_0xa237('0x45')]){_0x514352[_0xa237('0x43')]=_[_0xa237('0x47')](_0x514352[_0xa237('0x43')],{'$or':_[_0xa237('0x34')](_0x514352['attributes'],function(_0x2a9f0f){var _0x4553a6={};_0x4553a6[_0x2a9f0f]={'$like':'%'+_0x302d4b[_0xa237('0x3b')][_0xa237('0x45')]+'%'};return _0x4553a6;})});}_0x514352=_[_0xa237('0x47')]({},_0x514352,_0x302d4b[_0xa237('0x48')]);return _0x544246[_0xa237('0x57')](_0x514352);}})[_0xa237('0x19')](function(_0x413abf){if(_0x413abf){_0x33c8ba=_0x413abf['length'];if(!_0x302d4b[_0xa237('0x3b')]['hasOwnProperty']('nolimit')){_0x514352[_0xa237('0x2a')]=qs[_0xa237('0x2a')](_0x302d4b['query']['limit']);_0x514352[_0xa237('0x27')]=qs[_0xa237('0x27')](_0x302d4b[_0xa237('0x3b')]['offset']);}return _0x544246[_0xa237('0x57')](_0x514352);}})['then'](function(_0x94571c){if(_0x94571c){return _0x94571c?{'count':_0x33c8ba,'rows':_0x94571c}:null;}})[_0xa237('0x19')](respondWithResult(_0x5753e0,null))['catch'](handleError(_0x5753e0,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index 3500e27..494b68d 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 _0x659c=['exports','define','ServicenowConfiguration','lodash','api','moment','request-promise','path','./intServicenowConfiguration.attributes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x659c,0x1aa));var _0xc659=function(_0x5ad0d7,_0x2645f8){_0x5ad0d7=_0x5ad0d7-0x0;var _0xd83bd=_0x659c[_0x5ad0d7];return _0xd83bd;};'use strict';var _=require(_0xc659('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xc659('0x1'));var moment=require(_0xc659('0x2'));var BPromise=require('bluebird');var rp=require(_0xc659('0x3'));var fs=require('fs');var path=require(_0xc659('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xc659('0x5'));module[_0xc659('0x6')]=function(_0x369dc0,_0x312440){return _0x369dc0[_0xc659('0x7')](_0xc659('0x8'),attributes,{'tableName':'int_servicenow_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xea5b=['bluebird','request-promise','path','rimraf','./intServicenowConfiguration.attributes','define','ServicenowConfiguration','int_servicenow_configurations','lodash','util','../../config/logger'];(function(_0x37b7b6,_0x165a5c){var _0x10c4c3=function(_0x16d71e){while(--_0x16d71e){_0x37b7b6['push'](_0x37b7b6['shift']());}};_0x10c4c3(++_0x165a5c);}(_0xea5b,0x152));var _0xbea5=function(_0x2aea9e,_0x1f587f){_0x2aea9e=_0x2aea9e-0x0;var _0x430b92=_0xea5b[_0x2aea9e];return _0x430b92;};'use strict';var _=require(_0xbea5('0x0'));var util=require(_0xbea5('0x1'));var logger=require(_0xbea5('0x2'))('api');var moment=require('moment');var BPromise=require(_0xbea5('0x3'));var rp=require(_0xbea5('0x4'));var fs=require('fs');var path=require(_0xbea5('0x5'));var rimraf=require(_0xbea5('0x6'));var config=require('../../config/environment');var attributes=require(_0xbea5('0x7'));module['exports']=function(_0x2db67a,_0x3d9263){return _0x2db67a[_0xbea5('0x8')](_0xbea5('0x9'),attributes,{'tableName':_0xbea5('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js index fae34f3..f5373dc 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 _0x14c5=['moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x14c5,0x1de));var _0x514c=function(_0x156fe1,_0x3a9160){_0x156fe1=_0x156fe1-0x0;var _0x1ad839=_0x14c5[_0x156fe1];return _0x1ad839;};'use strict';var _=require(_0x514c('0x0'));var util=require(_0x514c('0x1'));var moment=require(_0x514c('0x2'));var BPromise=require('bluebird');var rs=require(_0x514c('0x3'));var fs=require('fs');var Redis=require(_0x514c('0x4'));var db=require(_0x514c('0x5'))['db'];var utils=require(_0x514c('0x6'));var logger=require(_0x514c('0x7'))(_0x514c('0x8'));var config=require(_0x514c('0x9'));var jayson=require(_0x514c('0xa'));var client=jayson[_0x514c('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x72fd4c,_0x308760,_0x2cb9fc){return new BPromise(function(_0x1468ee,_0x232143){return client[_0x514c('0xc')](_0x72fd4c,_0x2cb9fc)[_0x514c('0xd')](function(_0x11895f){logger['info'](_0x514c('0xe'),_0x308760,_0x514c('0xf'));logger[_0x514c('0x10')](_0x514c('0x11'),_0x308760,_0x514c('0xf'),JSON[_0x514c('0x12')](_0x11895f));if(_0x11895f[_0x514c('0x13')]){if(_0x11895f[_0x514c('0x13')][_0x514c('0x14')]===0x1f4){logger[_0x514c('0x13')]('ServicenowConfiguration,\x20%s,\x20%s',_0x308760,_0x11895f[_0x514c('0x13')]['message']);return _0x232143(_0x11895f[_0x514c('0x13')][_0x514c('0x15')]);}logger[_0x514c('0x13')]('ServicenowConfiguration,\x20%s,\x20%s',_0x308760,_0x11895f[_0x514c('0x13')][_0x514c('0x15')]);return _0x1468ee(_0x11895f[_0x514c('0x13')][_0x514c('0x15')]);}else{logger['info'](_0x514c('0xe'),_0x308760,_0x514c('0xf'));_0x1468ee(_0x11895f[_0x514c('0x16')][_0x514c('0x15')]);}})[_0x514c('0x17')](function(_0x3b246d){logger[_0x514c('0x13')]('ServicenowConfiguration,\x20%s,\x20%s',_0x308760,_0x3b246d);_0x232143(_0x3b246d);});});} \ No newline at end of file +var _0xc718=['stringify','error','code','message','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x2c50c6,_0x157ef0){var _0x179b39=function(_0x4a21b2){while(--_0x4a21b2){_0x2c50c6['push'](_0x2c50c6['shift']());}};_0x179b39(++_0x157ef0);}(_0xc718,0x1e9));var _0x8c71=function(_0x8575a1,_0x3b2755){_0x8575a1=_0x8575a1-0x0;var _0x2e5e71=_0xc718[_0x8575a1];return _0x2e5e71;};'use strict';var _=require(_0x8c71('0x0'));var util=require(_0x8c71('0x1'));var moment=require(_0x8c71('0x2'));var BPromise=require(_0x8c71('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8c71('0x4'));var db=require(_0x8c71('0x5'))['db'];var utils=require(_0x8c71('0x6'));var logger=require(_0x8c71('0x7'))(_0x8c71('0x8'));var config=require('../../config/environment');var jayson=require(_0x8c71('0x9'));var client=jayson[_0x8c71('0xa')][_0x8c71('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5e8483,_0x35a462,_0x4b52fb){return new BPromise(function(_0xd80cd3,_0x2ff955){return client[_0x8c71('0xc')](_0x5e8483,_0x4b52fb)['then'](function(_0x2a9317){logger[_0x8c71('0xd')](_0x8c71('0xe'),_0x35a462,_0x8c71('0xf'));logger[_0x8c71('0x10')]('ServicenowConfiguration,\x20%s,\x20%s,\x20%s',_0x35a462,_0x8c71('0xf'),JSON[_0x8c71('0x11')](_0x2a9317));if(_0x2a9317[_0x8c71('0x12')]){if(_0x2a9317['error'][_0x8c71('0x13')]===0x1f4){logger[_0x8c71('0x12')](_0x8c71('0xe'),_0x35a462,_0x2a9317[_0x8c71('0x12')][_0x8c71('0x14')]);return _0x2ff955(_0x2a9317['error'][_0x8c71('0x14')]);}logger['error'](_0x8c71('0xe'),_0x35a462,_0x2a9317[_0x8c71('0x12')]['message']);return _0xd80cd3(_0x2a9317[_0x8c71('0x12')]['message']);}else{logger['info'](_0x8c71('0xe'),_0x35a462,_0x8c71('0xf'));_0xd80cd3(_0x2a9317['result'][_0x8c71('0x14')]);}})[_0x8c71('0x15')](function(_0x1949b4){logger[_0x8c71('0x12')](_0x8c71('0xe'),_0x35a462,_0x1949b4);_0x2ff955(_0x1949b4);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index a1c0d89..5b739c3 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 _0xdddd=['connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowField.controller','get','isAuthenticated','/:id','show','post','create','delete','destroy','exports','multer','path'];(function(_0x49c640,_0x548ccf){var _0xb21b73=function(_0x6e86f4){while(--_0x6e86f4){_0x49c640['push'](_0x49c640['shift']());}};_0xb21b73(++_0x548ccf);}(_0xdddd,0xec));var _0xdddd=function(_0x329437,_0x1de73a){_0x329437=_0x329437-0x0;var _0x3789d9=_0xdddd[_0x329437];return _0x3789d9;};'use strict';var multer=require(_0xdddd('0x0'));var util=require('util');var path=require(_0xdddd('0x1'));var timeout=require(_0xdddd('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xdddd('0x3'));var auth=require(_0xdddd('0x4'));var interaction=require(_0xdddd('0x5'));var config=require(_0xdddd('0x6'));var controller=require(_0xdddd('0x7'));router[_0xdddd('0x8')]('/',auth[_0xdddd('0x9')](),controller['index']);router[_0xdddd('0x8')](_0xdddd('0xa'),auth[_0xdddd('0x9')](),controller[_0xdddd('0xb')]);router[_0xdddd('0xc')]('/',auth[_0xdddd('0x9')](),controller[_0xdddd('0xd')]);router['put'](_0xdddd('0xa'),auth[_0xdddd('0x9')](),controller['update']);router[_0xdddd('0xe')](_0xdddd('0xa'),auth[_0xdddd('0x9')](),controller[_0xdddd('0xf')]);module[_0xdddd('0x10')]=router; \ No newline at end of file +var _0xe38b=['get','/:id','isAuthenticated','show','post','create','put','update','delete','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x1a0703,_0x39b007){var _0x39eed8=function(_0x30fda9){while(--_0x30fda9){_0x1a0703['push'](_0x1a0703['shift']());}};_0x39eed8(++_0x39b007);}(_0xe38b,0x16f));var _0xbe38=function(_0x3897ea,_0x1116ec){_0x3897ea=_0x3897ea-0x0;var _0x2dd820=_0xe38b[_0x3897ea];return _0x2dd820;};'use strict';var multer=require('multer');var util=require(_0xbe38('0x0'));var path=require('path');var timeout=require(_0xbe38('0x1'));var express=require(_0xbe38('0x2'));var router=express[_0xbe38('0x3')]();var fs_extra=require(_0xbe38('0x4'));var auth=require(_0xbe38('0x5'));var interaction=require(_0xbe38('0x6'));var config=require('../../config/environment');var controller=require('./intServicenowField.controller');router[_0xbe38('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0xbe38('0x7')](_0xbe38('0x8'),auth[_0xbe38('0x9')](),controller[_0xbe38('0xa')]);router[_0xbe38('0xb')]('/',auth[_0xbe38('0x9')](),controller[_0xbe38('0xc')]);router[_0xbe38('0xd')](_0xbe38('0x8'),auth[_0xbe38('0x9')](),controller[_0xbe38('0xe')]);router[_0xbe38('0xf')](_0xbe38('0x8'),auth[_0xbe38('0x9')](),controller['destroy']);module[_0xbe38('0x10')]=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index 55b590a..aa1c0fc 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 _0x70c8=['BOOLEAN','sequelize','exports','ENUM','variable','customVariable','keyValue','picklist','string','STRING'];(function(_0x5e7d5f,_0x2357c6){var _0x20c5eb=function(_0x1a7834){while(--_0x1a7834){_0x5e7d5f['push'](_0x5e7d5f['shift']());}};_0x20c5eb(++_0x2357c6);}(_0x70c8,0xe7));var _0x870c=function(_0x513119,_0x7797e3){_0x513119=_0x513119-0x0;var _0x225235=_0x70c8[_0x513119];return _0x225235;};'use strict';var Sequelize=require(_0x870c('0x0'));module[_0x870c('0x1')]={'type':{'type':Sequelize[_0x870c('0x2')]('string',_0x870c('0x3'),_0x870c('0x4'),_0x870c('0x5'),_0x870c('0x6')),'defaultValue':_0x870c('0x7')},'content':{'type':Sequelize[_0x870c('0x8')]},'key':{'type':Sequelize[_0x870c('0x8')]},'keyType':{'type':Sequelize[_0x870c('0x2')](_0x870c('0x7'),_0x870c('0x3'),_0x870c('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x870c('0x8')]},'nameField':{'type':Sequelize[_0x870c('0x8')]},'customField':{'type':Sequelize[_0x870c('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x870c('0x8')]}}; \ No newline at end of file +var _0x53b8=['picklist','string','STRING','BOOLEAN','sequelize','exports','ENUM','variable','customVariable','keyValue'];(function(_0xee3051,_0xbe4f18){var _0x139e81=function(_0xac81c3){while(--_0xac81c3){_0xee3051['push'](_0xee3051['shift']());}};_0x139e81(++_0xbe4f18);}(_0x53b8,0x194));var _0x853b=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x53b8[_0x167cc1];return _0x10bc4b;};'use strict';var Sequelize=require(_0x853b('0x0'));module[_0x853b('0x1')]={'type':{'type':Sequelize[_0x853b('0x2')]('string',_0x853b('0x3'),_0x853b('0x4'),_0x853b('0x5'),_0x853b('0x6')),'defaultValue':_0x853b('0x7')},'content':{'type':Sequelize[_0x853b('0x8')]},'key':{'type':Sequelize[_0x853b('0x8')]},'keyType':{'type':Sequelize['ENUM'](_0x853b('0x7'),'variable',_0x853b('0x4'))},'keyContent':{'type':Sequelize[_0x853b('0x8')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x853b('0x8')]},'customField':{'type':Sequelize[_0x853b('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x853b('0x8')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index aeafd6b..4844822 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 _0x1020=['attributes','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','count','then','include','findAll','rows','catch','show','params','keys','fields','length','includeAll','find','create','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','Content-Range','reject','save','update','destroy','stack','name','ServicenowField','rawAttributes','type','key','model','map','filters','intersection','query'];(function(_0xcbbe45,_0xdb31db){var _0x4e7bc6=function(_0x55b34c){while(--_0x55b34c){_0xcbbe45['push'](_0xcbbe45['shift']());}};_0x4e7bc6(++_0xdb31db);}(_0x1020,0x191));var _0x0102=function(_0x28578d,_0xcf5cf0){_0x28578d=_0x28578d-0x0;var _0x524826=_0x1020[_0x28578d];return _0x524826;};'use strict';var emlformat=require(_0x0102('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0102('0x1'));var jsonpatch=require(_0x0102('0x2'));var rp=require(_0x0102('0x3'));var moment=require(_0x0102('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x0102('0x5'));var path=require('path');var sox=require(_0x0102('0x6'));var csv=require('to-csv');var ejs=require(_0x0102('0x7'));var fs=require('fs');var fs_extra=require(_0x0102('0x8'));var _=require(_0x0102('0x9'));var squel=require(_0x0102('0xa'));var crypto=require(_0x0102('0xb'));var jsforce=require(_0x0102('0xc'));var deskjs=require(_0x0102('0xd'));var toCsv=require(_0x0102('0xe'));var querystring=require(_0x0102('0xf'));var Papa=require(_0x0102('0x10'));var Redis=require(_0x0102('0x11'));var authService=require(_0x0102('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0102('0x13'));var logger=require(_0x0102('0x14'))(_0x0102('0x15'));var utils=require(_0x0102('0x16'));var config=require(_0x0102('0x17'));var licenseUtil=require(_0x0102('0x18'));var db=require(_0x0102('0x19'))['db'];function respondWithStatusCode(_0x42a928,_0x266a8d){_0x266a8d=_0x266a8d||0xcc;return function(_0xa0fe86){if(_0xa0fe86){return _0x42a928[_0x0102('0x1a')](_0x266a8d);}return _0x42a928[_0x0102('0x1b')](_0x266a8d)[_0x0102('0x1c')]();};}function respondWithResult(_0x30747e,_0x360fb7){_0x360fb7=_0x360fb7||0xc8;return function(_0x24e5fe){if(_0x24e5fe){return _0x30747e['status'](_0x360fb7)[_0x0102('0x1d')](_0x24e5fe);}};}function respondWithFilteredResult(_0x2115df,_0x5c194d){return function(_0x3cbbb2){if(_0x3cbbb2){var _0x20f8d0=typeof _0x5c194d[_0x0102('0x1e')]===_0x0102('0x1f')&&typeof _0x5c194d['limit']==='undefined';var _0x4a560c=_0x3cbbb2['count'];var _0x3f06bf=_0x20f8d0?0x0:_0x5c194d[_0x0102('0x1e')];var _0x290438=_0x20f8d0?_0x3cbbb2['count']:_0x5c194d['offset']+_0x5c194d[_0x0102('0x20')];var _0x43dda4;if(_0x290438>=_0x4a560c){_0x290438=_0x4a560c;_0x43dda4=0xc8;}else{_0x43dda4=0xce;}_0x2115df[_0x0102('0x1b')](_0x43dda4);return _0x2115df['set'](_0x0102('0x21'),_0x3f06bf+'-'+_0x290438+'/'+_0x4a560c)[_0x0102('0x1d')](_0x3cbbb2);}return null;};}function patchUpdates(_0x1ee01b){return function(_0x12e2b1){try{jsonpatch['apply'](_0x12e2b1,_0x1ee01b,!![]);}catch(_0x32fbc7){return BPromise[_0x0102('0x22')](_0x32fbc7);}return _0x12e2b1[_0x0102('0x23')]();};}function saveUpdates(_0x3edfbf,_0x2d9460){return function(_0x32f5bb){if(_0x32f5bb){return _0x32f5bb[_0x0102('0x24')](_0x3edfbf)['then'](function(_0x496e45){return _0x496e45;});}return null;};}function removeEntity(_0x1338ee,_0x4f45da){return function(_0x899841){if(_0x899841){return _0x899841[_0x0102('0x25')]()['then'](function(){_0x1338ee[_0x0102('0x1b')](0xcc)[_0x0102('0x1c')]();});}};}function handleEntityNotFound(_0x3b17ba,_0x403a09){return function(_0x391800){if(!_0x391800){_0x3b17ba[_0x0102('0x1a')](0x194);}return _0x391800;};}function handleError(_0x49e430,_0x4a4e65){_0x4a4e65=_0x4a4e65||0x1f4;return function(_0x347f71){logger['error'](_0x347f71[_0x0102('0x26')]);if(_0x347f71[_0x0102('0x27')]){delete _0x347f71[_0x0102('0x27')];}_0x49e430[_0x0102('0x1b')](_0x4a4e65)['send'](_0x347f71);};}exports['index']=function(_0x41476f,_0x46459b){var _0x4ffb12={},_0x3d7bea={},_0x2a6fd0={'count':0x0,'rows':[]};var _0x35d6ff=_['map'](db[_0x0102('0x28')][_0x0102('0x29')],function(_0x93e40){return{'name':_0x93e40['fieldName'],'type':_0x93e40[_0x0102('0x2a')][_0x0102('0x2b')]};});_0x3d7bea[_0x0102('0x2c')]=_[_0x0102('0x2d')](_0x35d6ff,_0x0102('0x27'));_0x3d7bea['query']=_['keys'](_0x41476f['query']);_0x3d7bea[_0x0102('0x2e')]=_[_0x0102('0x2f')](_0x3d7bea['model'],_0x3d7bea[_0x0102('0x30')]);_0x4ffb12[_0x0102('0x31')]=_[_0x0102('0x2f')](_0x3d7bea[_0x0102('0x2c')],qs['fields'](_0x41476f[_0x0102('0x30')]['fields']));_0x4ffb12['attributes']=_0x4ffb12['attributes']['length']?_0x4ffb12[_0x0102('0x31')]:_0x3d7bea[_0x0102('0x2c')];if(!_0x41476f[_0x0102('0x30')][_0x0102('0x32')](_0x0102('0x33'))){_0x4ffb12['limit']=qs['limit'](_0x41476f[_0x0102('0x30')][_0x0102('0x20')]);_0x4ffb12[_0x0102('0x1e')]=qs[_0x0102('0x1e')](_0x41476f[_0x0102('0x30')][_0x0102('0x1e')]);}_0x4ffb12[_0x0102('0x34')]=qs['sort'](_0x41476f[_0x0102('0x30')][_0x0102('0x35')]);_0x4ffb12['where']=qs[_0x0102('0x2e')](_[_0x0102('0x36')](_0x41476f[_0x0102('0x30')],_0x3d7bea['filters']),_0x35d6ff);if(_0x41476f[_0x0102('0x30')][_0x0102('0x37')]){_0x4ffb12[_0x0102('0x38')]=_['merge'](_0x4ffb12[_0x0102('0x38')],{'$or':_[_0x0102('0x2d')](_0x35d6ff,function(_0x39c334){if(_0x39c334['type']!==_0x0102('0x39')){var _0x1bacf3={};_0x1bacf3[_0x39c334['name']]={'$like':'%'+_0x41476f[_0x0102('0x30')][_0x0102('0x37')]+'%'};return _0x1bacf3;}})});}_0x4ffb12=_[_0x0102('0x3a')]({},_0x4ffb12,_0x41476f[_0x0102('0x3b')]);var _0x25c988={'where':_0x4ffb12['where']};return db['ServicenowField'][_0x0102('0x3c')](_0x25c988)[_0x0102('0x3d')](function(_0x3bc314){_0x2a6fd0[_0x0102('0x3c')]=_0x3bc314;if(_0x41476f[_0x0102('0x30')]['includeAll']){_0x4ffb12[_0x0102('0x3e')]=[{'all':!![]}];}return db[_0x0102('0x28')][_0x0102('0x3f')](_0x4ffb12);})[_0x0102('0x3d')](function(_0x4017aa){_0x2a6fd0[_0x0102('0x40')]=_0x4017aa;return _0x2a6fd0;})['then'](respondWithFilteredResult(_0x46459b,_0x4ffb12))[_0x0102('0x41')](handleError(_0x46459b,null));};exports[_0x0102('0x42')]=function(_0x3e5a68,_0x531ac6){var _0x593889={'raw':!![],'where':{'id':_0x3e5a68[_0x0102('0x43')]['id']}},_0x56c8dd={};_0x56c8dd[_0x0102('0x2c')]=_[_0x0102('0x44')](db[_0x0102('0x28')]['rawAttributes']);_0x56c8dd[_0x0102('0x30')]=_[_0x0102('0x44')](_0x3e5a68['query']);_0x56c8dd[_0x0102('0x2e')]=_[_0x0102('0x2f')](_0x56c8dd['model'],_0x56c8dd['query']);_0x593889['attributes']=_[_0x0102('0x2f')](_0x56c8dd[_0x0102('0x2c')],qs[_0x0102('0x45')](_0x3e5a68['query'][_0x0102('0x45')]));_0x593889[_0x0102('0x31')]=_0x593889[_0x0102('0x31')][_0x0102('0x46')]?_0x593889[_0x0102('0x31')]:_0x56c8dd['model'];if(_0x3e5a68[_0x0102('0x30')][_0x0102('0x47')]){_0x593889[_0x0102('0x3e')]=[{'all':!![]}];}_0x593889=_['merge']({},_0x593889,_0x3e5a68[_0x0102('0x3b')]);return db[_0x0102('0x28')][_0x0102('0x48')](_0x593889)[_0x0102('0x3d')](handleEntityNotFound(_0x531ac6,null))['then'](respondWithResult(_0x531ac6,null))[_0x0102('0x41')](handleError(_0x531ac6,null));};exports[_0x0102('0x49')]=function(_0x36b7bf,_0x15989f){return db[_0x0102('0x28')][_0x0102('0x49')](_0x36b7bf[_0x0102('0x4a')],{})[_0x0102('0x3d')](respondWithResult(_0x15989f,0xc9))[_0x0102('0x41')](handleError(_0x15989f,null));};exports[_0x0102('0x24')]=function(_0x27f41d,_0x40fc09){if(_0x27f41d[_0x0102('0x4a')]['id']){delete _0x27f41d['body']['id'];}return db[_0x0102('0x28')]['find']({'where':{'id':_0x27f41d[_0x0102('0x43')]['id']}})['then'](handleEntityNotFound(_0x40fc09,null))['then'](saveUpdates(_0x27f41d['body'],null))['then'](respondWithResult(_0x40fc09,null))[_0x0102('0x41')](handleError(_0x40fc09,null));};exports[_0x0102('0x25')]=function(_0x83de10,_0x4b5328){return db[_0x0102('0x28')][_0x0102('0x48')]({'where':{'id':_0x83de10[_0x0102('0x43')]['id']}})[_0x0102('0x3d')](handleEntityNotFound(_0x4b5328,null))['then'](removeEntity(_0x4b5328,null))[_0x0102('0x41')](handleError(_0x4b5328,null));}; \ No newline at end of file +var _0x8b88=['apply','reject','save','update','then','sendStatus','error','stack','name','send','index','map','ServicenowField','rawAttributes','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','destroy','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','Content-Range','json'];(function(_0x3c3ce0,_0x5ab4ea){var _0x4b3d00=function(_0x3c4395){while(--_0x3c4395){_0x3c3ce0['push'](_0x3c3ce0['shift']());}};_0x4b3d00(++_0x5ab4ea);}(_0x8b88,0x1f4));var _0x88b8=function(_0x4d4a99,_0x18a284){_0x4d4a99=_0x4d4a99-0x0;var _0x1464e5=_0x8b88[_0x4d4a99];return _0x1464e5;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x88b8('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x88b8('0x1'));var moment=require(_0x88b8('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x88b8('0x3'));var util=require(_0x88b8('0x4'));var path=require(_0x88b8('0x5'));var sox=require(_0x88b8('0x6'));var csv=require(_0x88b8('0x7'));var ejs=require(_0x88b8('0x8'));var fs=require('fs');var fs_extra=require(_0x88b8('0x9'));var _=require('lodash');var squel=require(_0x88b8('0xa'));var crypto=require(_0x88b8('0xb'));var jsforce=require(_0x88b8('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x88b8('0xd'));var Papa=require(_0x88b8('0xe'));var Redis=require('ioredis');var authService=require(_0x88b8('0xf'));var qs=require(_0x88b8('0x10'));var as=require(_0x88b8('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x88b8('0x12'))(_0x88b8('0x13'));var utils=require(_0x88b8('0x14'));var config=require(_0x88b8('0x15'));var licenseUtil=require(_0x88b8('0x16'));var db=require(_0x88b8('0x17'))['db'];function respondWithStatusCode(_0x4091a0,_0xb721a7){_0xb721a7=_0xb721a7||0xcc;return function(_0x55b1de){if(_0x55b1de){return _0x4091a0['sendStatus'](_0xb721a7);}return _0x4091a0[_0x88b8('0x18')](_0xb721a7)[_0x88b8('0x19')]();};}function respondWithResult(_0x4d3558,_0x316c0a){_0x316c0a=_0x316c0a||0xc8;return function(_0x14c5ac){if(_0x14c5ac){return _0x4d3558[_0x88b8('0x18')](_0x316c0a)['json'](_0x14c5ac);}};}function respondWithFilteredResult(_0x1f2733,_0x5869a3){return function(_0x3439d8){if(_0x3439d8){var _0x16c3b9=typeof _0x5869a3[_0x88b8('0x1a')]===_0x88b8('0x1b')&&typeof _0x5869a3[_0x88b8('0x1c')]===_0x88b8('0x1b');var _0x4185f8=_0x3439d8[_0x88b8('0x1d')];var _0x414f26=_0x16c3b9?0x0:_0x5869a3[_0x88b8('0x1a')];var _0x34120f=_0x16c3b9?_0x3439d8[_0x88b8('0x1d')]:_0x5869a3[_0x88b8('0x1a')]+_0x5869a3[_0x88b8('0x1c')];var _0x375291;if(_0x34120f>=_0x4185f8){_0x34120f=_0x4185f8;_0x375291=0xc8;}else{_0x375291=0xce;}_0x1f2733[_0x88b8('0x18')](_0x375291);return _0x1f2733['set'](_0x88b8('0x1e'),_0x414f26+'-'+_0x34120f+'/'+_0x4185f8)[_0x88b8('0x1f')](_0x3439d8);}return null;};}function patchUpdates(_0x1c83cd){return function(_0x465ca2){try{jsonpatch[_0x88b8('0x20')](_0x465ca2,_0x1c83cd,!![]);}catch(_0x265b62){return BPromise[_0x88b8('0x21')](_0x265b62);}return _0x465ca2[_0x88b8('0x22')]();};}function saveUpdates(_0x7c3f3f,_0x305b2e){return function(_0x1dcd94){if(_0x1dcd94){return _0x1dcd94[_0x88b8('0x23')](_0x7c3f3f)[_0x88b8('0x24')](function(_0x38aadd){return _0x38aadd;});}return null;};}function removeEntity(_0xb86407,_0x251cad){return function(_0x3fa2e7){if(_0x3fa2e7){return _0x3fa2e7['destroy']()[_0x88b8('0x24')](function(){_0xb86407['status'](0xcc)[_0x88b8('0x19')]();});}};}function handleEntityNotFound(_0x394fb1,_0x1babf5){return function(_0x35e8b6){if(!_0x35e8b6){_0x394fb1[_0x88b8('0x25')](0x194);}return _0x35e8b6;};}function handleError(_0x30d9fa,_0x2dbbb9){_0x2dbbb9=_0x2dbbb9||0x1f4;return function(_0x57371c){logger[_0x88b8('0x26')](_0x57371c[_0x88b8('0x27')]);if(_0x57371c[_0x88b8('0x28')]){delete _0x57371c[_0x88b8('0x28')];}_0x30d9fa[_0x88b8('0x18')](_0x2dbbb9)[_0x88b8('0x29')](_0x57371c);};}exports[_0x88b8('0x2a')]=function(_0x5ad99d,_0x6642e4){var _0x1299ca={},_0x5a9bbc={},_0x1de500={'count':0x0,'rows':[]};var _0xb00ff9=_[_0x88b8('0x2b')](db[_0x88b8('0x2c')][_0x88b8('0x2d')],function(_0x1dca2f){return{'name':_0x1dca2f['fieldName'],'type':_0x1dca2f[_0x88b8('0x2e')]['key']};});_0x5a9bbc['model']=_[_0x88b8('0x2b')](_0xb00ff9,_0x88b8('0x28'));_0x5a9bbc[_0x88b8('0x2f')]=_[_0x88b8('0x30')](_0x5ad99d[_0x88b8('0x2f')]);_0x5a9bbc[_0x88b8('0x31')]=_[_0x88b8('0x32')](_0x5a9bbc[_0x88b8('0x33')],_0x5a9bbc['query']);_0x1299ca[_0x88b8('0x34')]=_[_0x88b8('0x32')](_0x5a9bbc[_0x88b8('0x33')],qs[_0x88b8('0x35')](_0x5ad99d[_0x88b8('0x2f')]['fields']));_0x1299ca[_0x88b8('0x34')]=_0x1299ca[_0x88b8('0x34')][_0x88b8('0x36')]?_0x1299ca[_0x88b8('0x34')]:_0x5a9bbc['model'];if(!_0x5ad99d[_0x88b8('0x2f')][_0x88b8('0x37')](_0x88b8('0x38'))){_0x1299ca[_0x88b8('0x1c')]=qs['limit'](_0x5ad99d[_0x88b8('0x2f')][_0x88b8('0x1c')]);_0x1299ca[_0x88b8('0x1a')]=qs[_0x88b8('0x1a')](_0x5ad99d[_0x88b8('0x2f')][_0x88b8('0x1a')]);}_0x1299ca[_0x88b8('0x39')]=qs[_0x88b8('0x3a')](_0x5ad99d[_0x88b8('0x2f')][_0x88b8('0x3a')]);_0x1299ca['where']=qs['filters'](_[_0x88b8('0x3b')](_0x5ad99d[_0x88b8('0x2f')],_0x5a9bbc[_0x88b8('0x31')]),_0xb00ff9);if(_0x5ad99d['query'][_0x88b8('0x3c')]){_0x1299ca['where']=_[_0x88b8('0x3d')](_0x1299ca[_0x88b8('0x3e')],{'$or':_[_0x88b8('0x2b')](_0xb00ff9,function(_0x48f9b9){if(_0x48f9b9[_0x88b8('0x2e')]!==_0x88b8('0x3f')){var _0x8fdedb={};_0x8fdedb[_0x48f9b9[_0x88b8('0x28')]]={'$like':'%'+_0x5ad99d['query'][_0x88b8('0x3c')]+'%'};return _0x8fdedb;}})});}_0x1299ca=_[_0x88b8('0x3d')]({},_0x1299ca,_0x5ad99d[_0x88b8('0x40')]);var _0x4a5f29={'where':_0x1299ca[_0x88b8('0x3e')]};return db[_0x88b8('0x2c')][_0x88b8('0x1d')](_0x4a5f29)[_0x88b8('0x24')](function(_0x2763f8){_0x1de500[_0x88b8('0x1d')]=_0x2763f8;if(_0x5ad99d[_0x88b8('0x2f')][_0x88b8('0x41')]){_0x1299ca[_0x88b8('0x42')]=[{'all':!![]}];}return db[_0x88b8('0x2c')][_0x88b8('0x43')](_0x1299ca);})[_0x88b8('0x24')](function(_0x6dbc43){_0x1de500[_0x88b8('0x44')]=_0x6dbc43;return _0x1de500;})[_0x88b8('0x24')](respondWithFilteredResult(_0x6642e4,_0x1299ca))[_0x88b8('0x45')](handleError(_0x6642e4,null));};exports[_0x88b8('0x46')]=function(_0x167197,_0x1108df){var _0x4d73a6={'raw':!![],'where':{'id':_0x167197[_0x88b8('0x47')]['id']}},_0x11b400={};_0x11b400[_0x88b8('0x33')]=_['keys'](db[_0x88b8('0x2c')][_0x88b8('0x2d')]);_0x11b400[_0x88b8('0x2f')]=_[_0x88b8('0x30')](_0x167197[_0x88b8('0x2f')]);_0x11b400['filters']=_[_0x88b8('0x32')](_0x11b400[_0x88b8('0x33')],_0x11b400[_0x88b8('0x2f')]);_0x4d73a6[_0x88b8('0x34')]=_['intersection'](_0x11b400['model'],qs[_0x88b8('0x35')](_0x167197[_0x88b8('0x2f')][_0x88b8('0x35')]));_0x4d73a6[_0x88b8('0x34')]=_0x4d73a6[_0x88b8('0x34')]['length']?_0x4d73a6[_0x88b8('0x34')]:_0x11b400[_0x88b8('0x33')];if(_0x167197[_0x88b8('0x2f')][_0x88b8('0x41')]){_0x4d73a6[_0x88b8('0x42')]=[{'all':!![]}];}_0x4d73a6=_['merge']({},_0x4d73a6,_0x167197['options']);return db['ServicenowField'][_0x88b8('0x48')](_0x4d73a6)[_0x88b8('0x24')](handleEntityNotFound(_0x1108df,null))[_0x88b8('0x24')](respondWithResult(_0x1108df,null))[_0x88b8('0x45')](handleError(_0x1108df,null));};exports[_0x88b8('0x49')]=function(_0x5022ae,_0x183caf){return db[_0x88b8('0x2c')]['create'](_0x5022ae[_0x88b8('0x4a')],{})['then'](respondWithResult(_0x183caf,0xc9))['catch'](handleError(_0x183caf,null));};exports[_0x88b8('0x23')]=function(_0x15cb39,_0xfa939d){if(_0x15cb39[_0x88b8('0x4a')]['id']){delete _0x15cb39[_0x88b8('0x4a')]['id'];}return db[_0x88b8('0x2c')][_0x88b8('0x48')]({'where':{'id':_0x15cb39[_0x88b8('0x47')]['id']}})['then'](handleEntityNotFound(_0xfa939d,null))[_0x88b8('0x24')](saveUpdates(_0x15cb39[_0x88b8('0x4a')],null))[_0x88b8('0x24')](respondWithResult(_0xfa939d,null))[_0x88b8('0x45')](handleError(_0xfa939d,null));};exports[_0x88b8('0x4b')]=function(_0xf2a85d,_0x586877){return db[_0x88b8('0x2c')][_0x88b8('0x48')]({'where':{'id':_0xf2a85d[_0x88b8('0x47')]['id']}})[_0x88b8('0x24')](handleEntityNotFound(_0x586877,null))[_0x88b8('0x24')](removeEntity(_0x586877,null))[_0x88b8('0x45')](handleError(_0x586877,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index 089e7f0..06b0d5b 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 _0xb052=['bluebird','request-promise','path','rimraf','../../config/environment','define','int_servicenow_fields','servicenow_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment'];(function(_0x1c969e,_0x3161d6){var _0x9a483f=function(_0x119e5e){while(--_0x119e5e){_0x1c969e['push'](_0x1c969e['shift']());}};_0x9a483f(++_0x3161d6);}(_0xb052,0x1bd));var _0x2b05=function(_0x1e4f2d,_0x22e2bb){_0x1e4f2d=_0x1e4f2d-0x0;var _0xd05ce5=_0xb052[_0x1e4f2d];return _0xd05ce5;};'use strict';var _=require(_0x2b05('0x0'));var util=require(_0x2b05('0x1'));var logger=require(_0x2b05('0x2'))(_0x2b05('0x3'));var moment=require(_0x2b05('0x4'));var BPromise=require(_0x2b05('0x5'));var rp=require(_0x2b05('0x6'));var fs=require('fs');var path=require(_0x2b05('0x7'));var rimraf=require(_0x2b05('0x8'));var config=require(_0x2b05('0x9'));var attributes=require('./intServicenowField.attributes');module['exports']=function(_0x1322e0,_0x7e041a){return _0x1322e0[_0x2b05('0xa')]('ServicenowField',attributes,{'tableName':_0x2b05('0xb'),'paranoid':![],'indexes':[{'name':_0x2b05('0xc'),'fields':[_0x2b05('0xd'),_0x2b05('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xcb95=['ServicenowField','int_servicenow_fields','servicenow_unique_index','idField','FieldId','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x19c670,_0x384921){var _0x3e3701=function(_0x3a2465){while(--_0x3a2465){_0x19c670['push'](_0x19c670['shift']());}};_0x3e3701(++_0x384921);}(_0xcb95,0xb5));var _0x5cb9=function(_0x47a349,_0x4699d9){_0x47a349=_0x47a349-0x0;var _0x18ab75=_0xcb95[_0x47a349];return _0x18ab75;};'use strict';var _=require(_0x5cb9('0x0'));var util=require(_0x5cb9('0x1'));var logger=require(_0x5cb9('0x2'))('api');var moment=require(_0x5cb9('0x3'));var BPromise=require(_0x5cb9('0x4'));var rp=require(_0x5cb9('0x5'));var fs=require('fs');var path=require(_0x5cb9('0x6'));var rimraf=require(_0x5cb9('0x7'));var config=require(_0x5cb9('0x8'));var attributes=require('./intServicenowField.attributes');module[_0x5cb9('0x9')]=function(_0x1bdedb,_0x4991ed){return _0x1bdedb[_0x5cb9('0xa')](_0x5cb9('0xb'),attributes,{'tableName':_0x5cb9('0xc'),'paranoid':![],'indexes':[{'name':_0x5cb9('0xd'),'fields':[_0x5cb9('0xe'),_0x5cb9('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.rpc.js b/server/api/intServicenowField/intServicenowField.rpc.js index c08a2b7..34306cd 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 _0xb7e7=['ServicenowField,\x20%s,\x20%s','debug','ServicenowField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','http','request','then','info'];(function(_0x1302d7,_0x4bfbcc){var _0x1481fe=function(_0xe46d76){while(--_0xe46d76){_0x1302d7['push'](_0x1302d7['shift']());}};_0x1481fe(++_0x4bfbcc);}(_0xb7e7,0x121));var _0x7b7e=function(_0x3c4737,_0x2329ec){_0x3c4737=_0x3c4737-0x0;var _0x2bb926=_0xb7e7[_0x3c4737];return _0x2bb926;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var moment=require(_0x7b7e('0x1'));var BPromise=require('bluebird');var rs=require(_0x7b7e('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7b7e('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x7b7e('0x4'))(_0x7b7e('0x5'));var config=require(_0x7b7e('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7b7e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x372bde,_0x7f87e0,_0x55ce81){return new BPromise(function(_0x42b871,_0x223587){return client[_0x7b7e('0x8')](_0x372bde,_0x55ce81)[_0x7b7e('0x9')](function(_0x148964){logger[_0x7b7e('0xa')](_0x7b7e('0xb'),_0x7f87e0,'request\x20sent');logger[_0x7b7e('0xc')](_0x7b7e('0xd'),_0x7f87e0,_0x7b7e('0xe'),JSON[_0x7b7e('0xf')](_0x148964));if(_0x148964[_0x7b7e('0x10')]){if(_0x148964[_0x7b7e('0x10')][_0x7b7e('0x11')]===0x1f4){logger[_0x7b7e('0x10')](_0x7b7e('0xb'),_0x7f87e0,_0x148964['error'][_0x7b7e('0x12')]);return _0x223587(_0x148964[_0x7b7e('0x10')]['message']);}logger[_0x7b7e('0x10')]('ServicenowField,\x20%s,\x20%s',_0x7f87e0,_0x148964['error'][_0x7b7e('0x12')]);return _0x42b871(_0x148964[_0x7b7e('0x10')][_0x7b7e('0x12')]);}else{logger[_0x7b7e('0xa')](_0x7b7e('0xb'),_0x7f87e0,'request\x20sent');_0x42b871(_0x148964['result'][_0x7b7e('0x12')]);}})[_0x7b7e('0x13')](function(_0x27f999){logger[_0x7b7e('0x10')](_0x7b7e('0xb'),_0x7f87e0,_0x27f999);_0x223587(_0x27f999);});});} \ No newline at end of file +var _0x0713=['ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x5d58cc,_0x2d6c99){var _0x643475=function(_0xf0d6f){while(--_0xf0d6f){_0x5d58cc['push'](_0x5d58cc['shift']());}};_0x643475(++_0x2d6c99);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3071('0x0'));var BPromise=require(_0x3071('0x1'));var rs=require(_0x3071('0x2'));var fs=require('fs');var Redis=require(_0x3071('0x3'));var db=require(_0x3071('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3071('0x5'))(_0x3071('0x6'));var config=require(_0x3071('0x7'));var jayson=require(_0x3071('0x8'));var client=jayson[_0x3071('0x9')][_0x3071('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1d3dd6,_0x2f1e87,_0xbd737f){return new BPromise(function(_0x22274c,_0x3e9a5e){return client[_0x3071('0xb')](_0x1d3dd6,_0xbd737f)[_0x3071('0xc')](function(_0x4a36ec){logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));logger[_0x3071('0x10')](_0x3071('0x11'),_0x2f1e87,'request\x20sent',JSON[_0x3071('0x12')](_0x4a36ec));if(_0x4a36ec[_0x3071('0x13')]){if(_0x4a36ec[_0x3071('0x13')][_0x3071('0x14')]===0x1f4){logger[_0x3071('0x13')]('ServicenowField,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec['error'][_0x3071('0x15')]);return _0x3e9a5e(_0x4a36ec['error'][_0x3071('0x15')]);}logger[_0x3071('0x13')]('ServicenowField,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec[_0x3071('0x13')]['message']);return _0x22274c(_0x4a36ec[_0x3071('0x13')][_0x3071('0x15')]);}else{logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));_0x22274c(_0x4a36ec[_0x3071('0x16')][_0x3071('0x15')]);}})[_0x3071('0x17')](function(_0x21aad3){logger[_0x3071('0x13')]('ServicenowField,\x20%s,\x20%s',_0x2f1e87,_0x21aad3);_0x3e9a5e(_0x21aad3);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index 9febec2..e9c3b08 100644 --- a/server/api/intSugarcrmAccount/index.js +++ b/server/api/intSugarcrmAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSugarcrmAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x82e8a4,_0x120513){var _0xb3e85b=function(_0x484436){while(--_0x484436){_0x82e8a4['push'](_0x82e8a4['shift']());}};_0xb3e85b(++_0x120513);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file +var _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(_0x275c64,_0x1c1601){var _0xe4a161=function(_0x58215c){while(--_0x58215c){_0x275c64['push'](_0x275c64['shift']());}};_0xe4a161(++_0x1c1601);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0xa9e0[_0x4ea69d];return _0x5318e0;};'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 4d7fc3b..5dfe8a0 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(_0xfc40f1,_0x1c4ca5){var _0x34b1d7=function(_0x5d4f33){while(--_0x5d4f33){_0xfc40f1['push'](_0xfc40f1['shift']());}};_0x34b1d7(++_0x1c4ca5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x32d457,_0x1a39c9){_0x32d457=_0x32d457-0x0;var _0x338386=_0xa9e0[_0x32d457];return _0x338386;};'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(_0x5f1893,_0x567bea){var _0x3e3bf5=function(_0x15dabd){while(--_0x15dabd){_0x5f1893['push'](_0x5f1893['shift']());}};_0x3e3bf5(++_0x567bea);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xa9e0[_0x2dafbe];return _0x58a45a;};'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 e1f23ae..bc59d4c 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 _0xa011=['result','catch','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','destroy','stack','index','map','SugarcrmAccount','rawAttributes','key','model','name','query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick','merge','type','VIRTUAL','include','findAll','rows','show','options','find','create','body','update','params','getConfigurations','findOne','SugarcrmConfiguration','filter','hasOwnProperty','nolimit','AccountId','Subjects','getSubjects','channel','getDescriptions','SugarcrmField','Descriptions','getFields','assigned_user_id','description','date_start','duration_hours','duration_minutes','parent_id','parent_type','parent_name','direction','username','password','remoteUri','lastIndexOf','POST','%s%s','/service/v4_1/rest.php','login','JSON','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','get_module_fields','Calls','module_fields','remove','endsWith','values','value','getFields,\x20%s,\x20%s,\x20%s','send','test','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','client','http','request','then','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info'];(function(_0x100d2c,_0x53ef05){var _0x46df59=function(_0x353b63){while(--_0x353b63){_0x100d2c['push'](_0x100d2c['shift']());}};_0x46df59(++_0x53ef05);}(_0xa011,0xe6));var _0x1a01=function(_0x3b341a,_0x372933){_0x3b341a=_0x3b341a-0x0;var _0x2d1b62=_0xa011[_0x3b341a];return _0x2d1b62;};'use strict';var emlformat=require(_0x1a01('0x0'));var rimraf=require(_0x1a01('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1a01('0x2'));var rp=require(_0x1a01('0x3'));var moment=require(_0x1a01('0x4'));var BPromise=require(_0x1a01('0x5'));var Mustache=require(_0x1a01('0x6'));var util=require(_0x1a01('0x7'));var path=require(_0x1a01('0x8'));var sox=require('sox');var csv=require(_0x1a01('0x9'));var ejs=require(_0x1a01('0xa'));var fs=require('fs');var fs_extra=require(_0x1a01('0xb'));var _=require('lodash');var squel=require(_0x1a01('0xc'));var crypto=require(_0x1a01('0xd'));var jsforce=require(_0x1a01('0xe'));var deskjs=require(_0x1a01('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x1a01('0x10'));var authService=require(_0x1a01('0x11'));var qs=require(_0x1a01('0x12'));var as=require(_0x1a01('0x13'));var hardwareService=require(_0x1a01('0x14'));var logger=require(_0x1a01('0x15'))(_0x1a01('0x16'));var utils=require(_0x1a01('0x17'));var config=require(_0x1a01('0x18'));var licenseUtil=require(_0x1a01('0x19'));var db=require(_0x1a01('0x1a'))['db'];var integrations=require(_0x1a01('0x1b'));var jayson=require('jayson/promise');var client=jayson[_0x1a01('0x1c')][_0x1a01('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x3bf65f,_0x5eca78,_0x4fd98a,_0xceb167){return new BPromise(function(_0x4d21da,_0x45c9d1){var _0xbafb3b=_0xceb167||client;return _0xbafb3b[_0x1a01('0x1e')](_0x3bf65f,_0x4fd98a)[_0x1a01('0x1f')](function(_0x543d64){logger['info'](_0x1a01('0x20'),_0x5eca78,_0x1a01('0x21'));logger[_0x1a01('0x22')]('SugarcrmAccount,\x20%s,\x20%s,\x20%s',_0x5eca78,_0x1a01('0x21'),JSON[_0x1a01('0x23')](_0x543d64));if(_0x543d64[_0x1a01('0x24')]){if(_0x543d64[_0x1a01('0x24')][_0x1a01('0x25')]===0x1f4){logger[_0x1a01('0x24')](_0x1a01('0x20'),_0x5eca78,_0x543d64[_0x1a01('0x24')]['message']);return _0x45c9d1(_0x543d64[_0x1a01('0x24')][_0x1a01('0x26')]);}logger['error'](_0x1a01('0x20'),_0x5eca78,_0x543d64[_0x1a01('0x24')][_0x1a01('0x26')]);return _0x4d21da(_0x543d64['error']['message']);}else{logger[_0x1a01('0x27')](_0x1a01('0x20'),_0x5eca78,'request\x20sent');_0x4d21da(_0x543d64[_0x1a01('0x28')]['message']);}})[_0x1a01('0x29')](function(_0x3334b5){logger['error'](_0x1a01('0x20'),_0x5eca78,_0x3334b5);_0x45c9d1(_0x3334b5);});});}function respondWithStatusCode(_0x1feea2,_0x3a8320){_0x3a8320=_0x3a8320||0xcc;return function(_0x3b5ace){if(_0x3b5ace){return _0x1feea2[_0x1a01('0x2a')](_0x3a8320);}return _0x1feea2[_0x1a01('0x2b')](_0x3a8320)[_0x1a01('0x2c')]();};}function respondWithResult(_0x6f10ee,_0x5e9296){_0x5e9296=_0x5e9296||0xc8;return function(_0x23b102){if(_0x23b102){return _0x6f10ee[_0x1a01('0x2b')](_0x5e9296)[_0x1a01('0x2d')](_0x23b102);}};}function respondWithFilteredResult(_0x52b9b2,_0x30c196){return function(_0x4e3a2d){if(_0x4e3a2d){var _0xa7b6ef=typeof _0x30c196[_0x1a01('0x2e')]===_0x1a01('0x2f')&&typeof _0x30c196['limit']===_0x1a01('0x2f');var _0x2529a8=_0x4e3a2d[_0x1a01('0x30')];var _0x82a901=_0xa7b6ef?0x0:_0x30c196['offset'];var _0x7a3e88=_0xa7b6ef?_0x4e3a2d[_0x1a01('0x30')]:_0x30c196[_0x1a01('0x2e')]+_0x30c196[_0x1a01('0x31')];var _0x4c079d;if(_0x7a3e88>=_0x2529a8){_0x7a3e88=_0x2529a8;_0x4c079d=0xc8;}else{_0x4c079d=0xce;}_0x52b9b2[_0x1a01('0x2b')](_0x4c079d);return _0x52b9b2[_0x1a01('0x32')](_0x1a01('0x33'),_0x82a901+'-'+_0x7a3e88+'/'+_0x2529a8)[_0x1a01('0x2d')](_0x4e3a2d);}return null;};}function patchUpdates(_0x244521){return function(_0x58a256){try{jsonpatch[_0x1a01('0x34')](_0x58a256,_0x244521,!![]);}catch(_0x3ff8ae){return BPromise[_0x1a01('0x35')](_0x3ff8ae);}return _0x58a256[_0x1a01('0x36')]();};}function saveUpdates(_0x37366d,_0x51d0be){return function(_0x2dbf99){if(_0x2dbf99){return _0x2dbf99['update'](_0x37366d)[_0x1a01('0x1f')](function(_0x553b6a){return _0x553b6a;});}return null;};}function removeEntity(_0xc0230a,_0x27421e){return function(_0x28acce){if(_0x28acce){return _0x28acce[_0x1a01('0x37')]()[_0x1a01('0x1f')](function(){_0xc0230a[_0x1a01('0x2b')](0xcc)[_0x1a01('0x2c')]();});}};}function handleEntityNotFound(_0x4f2bf5,_0x2d1156){return function(_0x2c6d09){if(!_0x2c6d09){_0x4f2bf5[_0x1a01('0x2a')](0x194);}return _0x2c6d09;};}function handleError(_0x54c458,_0xd2b20){_0xd2b20=_0xd2b20||0x1f4;return function(_0x13a1e5){logger[_0x1a01('0x24')](_0x13a1e5[_0x1a01('0x38')]);if(_0x13a1e5['name']){delete _0x13a1e5['name'];}_0x54c458[_0x1a01('0x2b')](_0xd2b20)['send'](_0x13a1e5);};}exports[_0x1a01('0x39')]=function(_0x1d27f7,_0x4ab4f7){var _0x164c2f={},_0x474c56={},_0x26ed26={'count':0x0,'rows':[]};var _0x1a651d=_[_0x1a01('0x3a')](db[_0x1a01('0x3b')][_0x1a01('0x3c')],function(_0x5afc58){return{'name':_0x5afc58['fieldName'],'type':_0x5afc58['type'][_0x1a01('0x3d')]};});_0x474c56[_0x1a01('0x3e')]=_[_0x1a01('0x3a')](_0x1a651d,_0x1a01('0x3f'));_0x474c56[_0x1a01('0x40')]=_[_0x1a01('0x41')](_0x1d27f7['query']);_0x474c56[_0x1a01('0x42')]=_[_0x1a01('0x43')](_0x474c56[_0x1a01('0x3e')],_0x474c56[_0x1a01('0x40')]);_0x164c2f[_0x1a01('0x44')]=_[_0x1a01('0x43')](_0x474c56['model'],qs[_0x1a01('0x45')](_0x1d27f7['query'][_0x1a01('0x45')]));_0x164c2f['attributes']=_0x164c2f[_0x1a01('0x44')][_0x1a01('0x46')]?_0x164c2f[_0x1a01('0x44')]:_0x474c56[_0x1a01('0x3e')];if(!_0x1d27f7[_0x1a01('0x40')]['hasOwnProperty']('nolimit')){_0x164c2f[_0x1a01('0x31')]=qs['limit'](_0x1d27f7[_0x1a01('0x40')][_0x1a01('0x31')]);_0x164c2f['offset']=qs[_0x1a01('0x2e')](_0x1d27f7['query'][_0x1a01('0x2e')]);}_0x164c2f[_0x1a01('0x47')]=qs[_0x1a01('0x48')](_0x1d27f7['query'][_0x1a01('0x48')]);_0x164c2f[_0x1a01('0x49')]=qs['filters'](_[_0x1a01('0x4a')](_0x1d27f7[_0x1a01('0x40')],_0x474c56[_0x1a01('0x42')]),_0x1a651d);if(_0x1d27f7['query']['filter']){_0x164c2f[_0x1a01('0x49')]=_[_0x1a01('0x4b')](_0x164c2f[_0x1a01('0x49')],{'$or':_[_0x1a01('0x3a')](_0x1a651d,function(_0x574e9c){if(_0x574e9c[_0x1a01('0x4c')]!==_0x1a01('0x4d')){var _0x36599f={};_0x36599f[_0x574e9c[_0x1a01('0x3f')]]={'$like':'%'+_0x1d27f7[_0x1a01('0x40')]['filter']+'%'};return _0x36599f;}})});}_0x164c2f=_['merge']({},_0x164c2f,_0x1d27f7['options']);var _0x15a54c={'where':_0x164c2f[_0x1a01('0x49')]};return db[_0x1a01('0x3b')]['count'](_0x15a54c)[_0x1a01('0x1f')](function(_0x5d6a74){_0x26ed26[_0x1a01('0x30')]=_0x5d6a74;if(_0x1d27f7[_0x1a01('0x40')]['includeAll']){_0x164c2f[_0x1a01('0x4e')]=[{'all':!![]}];}return db[_0x1a01('0x3b')][_0x1a01('0x4f')](_0x164c2f);})[_0x1a01('0x1f')](function(_0x532500){_0x26ed26[_0x1a01('0x50')]=_0x532500;return _0x26ed26;})['then'](respondWithFilteredResult(_0x4ab4f7,_0x164c2f))['catch'](handleError(_0x4ab4f7,null));};exports[_0x1a01('0x51')]=function(_0x1be24d,_0x41463f){var _0x1e0745={'raw':![],'where':{'id':_0x1be24d['params']['id']}},_0x4810b9={};_0x4810b9[_0x1a01('0x3e')]=_[_0x1a01('0x41')](db[_0x1a01('0x3b')]['rawAttributes']);_0x4810b9['query']=_[_0x1a01('0x41')](_0x1be24d['query']);_0x4810b9[_0x1a01('0x42')]=_[_0x1a01('0x43')](_0x4810b9[_0x1a01('0x3e')],_0x4810b9['query']);_0x1e0745[_0x1a01('0x44')]=_[_0x1a01('0x43')](_0x4810b9[_0x1a01('0x3e')],qs[_0x1a01('0x45')](_0x1be24d[_0x1a01('0x40')][_0x1a01('0x45')]));_0x1e0745[_0x1a01('0x44')]=_0x1e0745[_0x1a01('0x44')][_0x1a01('0x46')]?_0x1e0745[_0x1a01('0x44')]:_0x4810b9['model'];if(_0x1be24d[_0x1a01('0x40')]['includeAll']){_0x1e0745[_0x1a01('0x4e')]=[{'all':!![]}];}_0x1e0745=_[_0x1a01('0x4b')]({},_0x1e0745,_0x1be24d[_0x1a01('0x52')]);return db[_0x1a01('0x3b')][_0x1a01('0x53')](_0x1e0745)[_0x1a01('0x1f')](handleEntityNotFound(_0x41463f,null))[_0x1a01('0x1f')](respondWithResult(_0x41463f,null))[_0x1a01('0x29')](handleError(_0x41463f,null));};exports[_0x1a01('0x54')]=function(_0x2066d5,_0x3a08e2){return db['SugarcrmAccount'][_0x1a01('0x54')](_0x2066d5[_0x1a01('0x55')],{})['then'](respondWithResult(_0x3a08e2,0xc9))[_0x1a01('0x29')](handleError(_0x3a08e2,null));};exports[_0x1a01('0x56')]=function(_0x48addc,_0x2c14d8){if(_0x48addc[_0x1a01('0x55')]['id']){delete _0x48addc[_0x1a01('0x55')]['id'];}return db[_0x1a01('0x3b')]['find']({'where':{'id':_0x48addc[_0x1a01('0x57')]['id']}})['then'](handleEntityNotFound(_0x2c14d8,null))['then'](saveUpdates(_0x48addc['body'],null))[_0x1a01('0x1f')](respondWithResult(_0x2c14d8,null))[_0x1a01('0x29')](handleError(_0x2c14d8,null));};exports['destroy']=function(_0x27a876,_0x248a49){return db[_0x1a01('0x3b')][_0x1a01('0x53')]({'where':{'id':_0x27a876[_0x1a01('0x57')]['id']}})[_0x1a01('0x1f')](handleEntityNotFound(_0x248a49,null))[_0x1a01('0x1f')](removeEntity(_0x248a49,null))[_0x1a01('0x29')](handleError(_0x248a49,null));};exports[_0x1a01('0x58')]=function(_0x4d3bf4,_0x2d214d,_0x3873d2){var _0x148480={};var _0x36d5e5={};var _0x428697;var _0xe11cb3;return db[_0x1a01('0x3b')][_0x1a01('0x59')]({'where':{'id':_0x4d3bf4['params']['id']}})['then'](handleEntityNotFound(_0x2d214d,null))['then'](function(_0x2a7ae1){if(_0x2a7ae1){_0x428697=_0x2a7ae1;_0x36d5e5[_0x1a01('0x3e')]=_[_0x1a01('0x41')](db[_0x1a01('0x5a')][_0x1a01('0x3c')]);_0x36d5e5[_0x1a01('0x40')]=_[_0x1a01('0x41')](_0x4d3bf4['query']);_0x36d5e5[_0x1a01('0x42')]=_[_0x1a01('0x43')](_0x36d5e5['model'],_0x36d5e5[_0x1a01('0x40')]);_0x148480[_0x1a01('0x44')]=_[_0x1a01('0x43')](_0x36d5e5[_0x1a01('0x3e')],qs[_0x1a01('0x45')](_0x4d3bf4[_0x1a01('0x40')]['fields']));_0x148480[_0x1a01('0x44')]=_0x148480[_0x1a01('0x44')][_0x1a01('0x46')]?_0x148480[_0x1a01('0x44')]:_0x36d5e5[_0x1a01('0x3e')];_0x148480[_0x1a01('0x47')]=qs[_0x1a01('0x48')](_0x4d3bf4[_0x1a01('0x40')][_0x1a01('0x48')]);_0x148480['where']=qs[_0x1a01('0x42')](_[_0x1a01('0x4a')](_0x4d3bf4['query'],_0x36d5e5[_0x1a01('0x42')]));if(_0x4d3bf4[_0x1a01('0x40')]['filter']){_0x148480[_0x1a01('0x49')]=_[_0x1a01('0x4b')](_0x148480[_0x1a01('0x49')],{'$or':_[_0x1a01('0x3a')](_0x148480['attributes'],function(_0x2f7a09){var _0x17671a={};_0x17671a[_0x2f7a09]={'$like':'%'+_0x4d3bf4[_0x1a01('0x40')][_0x1a01('0x5b')]+'%'};return _0x17671a;})});}_0x148480=_['merge']({},_0x148480,_0x4d3bf4[_0x1a01('0x52')]);return _0x428697[_0x1a01('0x58')](_0x148480);}})['then'](function(_0x43eec2){if(_0x43eec2){_0xe11cb3=_0x43eec2[_0x1a01('0x46')];if(!_0x4d3bf4['query'][_0x1a01('0x5c')](_0x1a01('0x5d'))){_0x148480[_0x1a01('0x31')]=qs[_0x1a01('0x31')](_0x4d3bf4['query']['limit']);_0x148480[_0x1a01('0x2e')]=qs['offset'](_0x4d3bf4[_0x1a01('0x40')]['offset']);}return _0x428697['getConfigurations'](_0x148480);}})['then'](function(_0x559550){if(_0x559550){return _0x559550?{'count':_0xe11cb3,'rows':_0x559550}:null;}})['then'](respondWithResult(_0x2d214d,null))[_0x1a01('0x29')](handleError(_0x2d214d,null));};exports['addConfiguration']=function(_0x129c7d,_0x221ae0,_0x40d837){if(_0x129c7d[_0x1a01('0x55')]['id']){delete _0x129c7d['body']['id'];}return db[_0x1a01('0x3b')][_0x1a01('0x59')]({'where':{'id':_0x129c7d[_0x1a01('0x57')]['id']}})[_0x1a01('0x1f')](handleEntityNotFound(_0x221ae0,null))[_0x1a01('0x1f')](function(_0x5a7334){if(_0x5a7334){_0x129c7d[_0x1a01('0x55')][_0x1a01('0x5e')]=_0x5a7334['id'];_0x129c7d[_0x1a01('0x55')][_0x1a01('0x5f')]=integrations[_0x1a01('0x60')](_0x129c7d[_0x1a01('0x55')][_0x1a01('0x61')],_0x129c7d['body']['type']);_0x129c7d[_0x1a01('0x55')]['Descriptions']=integrations[_0x1a01('0x62')](_0x129c7d[_0x1a01('0x55')]['channel'],_0x129c7d[_0x1a01('0x55')][_0x1a01('0x4c')]);return db[_0x1a01('0x5a')]['create'](_0x129c7d[_0x1a01('0x55')],{'include':[{'model':db[_0x1a01('0x63')],'as':_0x1a01('0x5f')},{'model':db['SugarcrmField'],'as':_0x1a01('0x64')}]});}return null;})['then'](respondWithResult(_0x221ae0,null))[_0x1a01('0x29')](handleError(_0x221ae0,null));};exports[_0x1a01('0x65')]=function(_0x39f656,_0x320e77,_0x11492e){var _0x47ba1c='';var _0xf4eaf5=['id','name',_0x1a01('0x66'),'created_by',_0x1a01('0x67'),_0x1a01('0x68'),_0x1a01('0x69'),_0x1a01('0x6a'),_0x1a01('0x6b'),_0x1a01('0x6c'),_0x1a01('0x6d'),_0x1a01('0x6e')];return db[_0x1a01('0x3b')][_0x1a01('0x59')]({'where':{'id':_0x39f656[_0x1a01('0x57')]['id']},'attributes':['id',_0x1a01('0x6f'),_0x1a01('0x70'),_0x1a01('0x71')]})[_0x1a01('0x1f')](handleEntityNotFound(_0x320e77,null))[_0x1a01('0x1f')](function(_0x29afda){if(_0x29afda){_0x47ba1c=_0x29afda[_0x1a01('0x71')];var _0x4dc492=_0x47ba1c['slice'](-0x1);if(_0x4dc492==='/'){_0x47ba1c=_0x47ba1c['substring'](0x0,_0x47ba1c[_0x1a01('0x72')](_0x4dc492));}return rp({'method':_0x1a01('0x73'),'uri':util['format'](_0x1a01('0x74'),_0x47ba1c,_0x1a01('0x75')),'json':!![],'form':{'method':_0x1a01('0x76'),'input_type':_0x1a01('0x77'),'response_type':'JSON','rest_data':JSON[_0x1a01('0x23')]({'user_auth':{'user_name':_0x29afda[_0x1a01('0x6f')],'password':_0x29afda['password'],'encryption':_0x1a01('0x78')},'application':_0x1a01('0x79')})}});}})[_0x1a01('0x1f')](function(_0x54ab18){if(_0x54ab18&&_0x54ab18[_0x1a01('0x3f')]!==_0x1a01('0x7a')&&_0x54ab18[_0x1a01('0x3f')]!==_0x1a01('0x7b')){return rp({'method':_0x1a01('0x73'),'uri':util['format'](_0x1a01('0x74'),_0x47ba1c,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0x1a01('0x7c'),'input_type':_0x1a01('0x77'),'response_type':_0x1a01('0x77'),'rest_data':JSON[_0x1a01('0x23')]({'session':_0x54ab18['id'],'module_name':_0x1a01('0x7d')})}})[_0x1a01('0x1f')](function(_0x4a6c4f){if(_0x4a6c4f){var _0x1d2358=_['values'](_0x4a6c4f[_0x1a01('0x7e')]);_[_0x1a01('0x7f')](_0x1d2358,function(_0x14862d){return _0xf4eaf5['includes'](_0x14862d[_0x1a01('0x3f')]);});return{'count':_0x1d2358[_0x1a01('0x46')],'rows':_[_0x1a01('0x3a')](_0x1d2358,function(_0x1f351f){return{'id':_0x1f351f[_0x1a01('0x3f')],'name':_0x1f351f['label'],'custom':_[_0x1a01('0x80')](_0x1f351f['name'],'_c')?!![]:![],'options':_0x1f351f[_0x1a01('0x52')]?_[_0x1a01('0x3a')](_[_0x1a01('0x81')](_0x1f351f['options']),function(_0x29fc16){return{'name':_0x29fc16[_0x1a01('0x82')],'value':_0x29fc16[_0x1a01('0x3f')]};}):[]};})};}})['then'](respondWithResult(_0x320e77,null))[_0x1a01('0x29')](function(_0x520ca6){var _0x196a9a=_0x39f656['query']['test']?0x1f4:_0x520ca6['statusCode']||0x1f4;logger[_0x1a01('0x24')](_0x1a01('0x83'),_0x1a01('0x65'),_0x196a9a,JSON[_0x1a01('0x23')](_0x520ca6));delete _0x520ca6[_0x1a01('0x3f')];if(_0x196a9a===0x191){_0x196a9a=0x190;}_0x320e77[_0x1a01('0x2b')](_0x196a9a)[_0x1a01('0x84')](_0x39f656[_0x1a01('0x40')][_0x1a01('0x85')]?{'message':_0x1a01('0x86'),'statusCode':_0x520ca6['statusCode']}:_0x520ca6);});}else{var _0x4364fd=0x1f4;_0x320e77['status'](_0x4364fd)[_0x1a01('0x84')]({'message':_0x1a01('0x86'),'statusCode':0x190});}});}; \ No newline at end of file +var _0x6b45=['parent_type','direction','username','password','remoteUri','slice','substring','lastIndexOf','POST','format','%s%s','/service/v4_1/rest.php','login','JSON','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','Calls','values','module_fields','includes','label','endsWith','value','getFields,\x20%s,\x20%s,\x20%s','test','statusCode','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','request','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','reject','update','destroy','stack','name','send','map','rawAttributes','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','SugarcrmAccount','include','findAll','rows','show','params','merge','options','find','create','body','getConfigurations','findOne','AccountId','channel','getDescriptions','SugarcrmConfiguration','SugarcrmField','Subjects','Descriptions','getFields','assigned_user_id','created_by','description','date_start','duration_minutes','parent_id'];(function(_0x102e37,_0x14a181){var _0x35a07c=function(_0x16577f){while(--_0x16577f){_0x102e37['push'](_0x102e37['shift']());}};_0x35a07c(++_0x14a181);}(_0x6b45,0x1af));var _0x56b4=function(_0x15f6f7,_0x305040){_0x15f6f7=_0x15f6f7-0x0;var _0x37c435=_0x6b45[_0x15f6f7];return _0x37c435;};'use strict';var emlformat=require(_0x56b4('0x0'));var rimraf=require(_0x56b4('0x1'));var zipdir=require(_0x56b4('0x2'));var jsonpatch=require(_0x56b4('0x3'));var rp=require(_0x56b4('0x4'));var moment=require(_0x56b4('0x5'));var BPromise=require(_0x56b4('0x6'));var Mustache=require(_0x56b4('0x7'));var util=require('util');var path=require(_0x56b4('0x8'));var sox=require('sox');var csv=require(_0x56b4('0x9'));var ejs=require(_0x56b4('0xa'));var fs=require('fs');var fs_extra=require(_0x56b4('0xb'));var _=require(_0x56b4('0xc'));var squel=require(_0x56b4('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x56b4('0xe'));var toCsv=require('to-csv');var querystring=require(_0x56b4('0xf'));var Papa=require(_0x56b4('0x10'));var Redis=require(_0x56b4('0x11'));var authService=require(_0x56b4('0x12'));var qs=require(_0x56b4('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x56b4('0x14'));var logger=require(_0x56b4('0x15'))(_0x56b4('0x16'));var utils=require(_0x56b4('0x17'));var config=require(_0x56b4('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x56b4('0x19'))['db'];var integrations=require(_0x56b4('0x1a'));var jayson=require(_0x56b4('0x1b'));var client=jayson[_0x56b4('0x1c')][_0x56b4('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x1706d3,_0x5d56f4,_0x494375,_0xcd2782){return new BPromise(function(_0x4eb28b,_0x510313){var _0x4bc72a=_0xcd2782||client;return _0x4bc72a[_0x56b4('0x1e')](_0x1706d3,_0x494375)[_0x56b4('0x1f')](function(_0x46aef1){logger[_0x56b4('0x20')](_0x56b4('0x21'),_0x5d56f4,_0x56b4('0x22'));logger[_0x56b4('0x23')](_0x56b4('0x24'),_0x5d56f4,_0x56b4('0x22'),JSON[_0x56b4('0x25')](_0x46aef1));if(_0x46aef1['error']){if(_0x46aef1[_0x56b4('0x26')][_0x56b4('0x27')]===0x1f4){logger[_0x56b4('0x26')](_0x56b4('0x21'),_0x5d56f4,_0x46aef1[_0x56b4('0x26')][_0x56b4('0x28')]);return _0x510313(_0x46aef1[_0x56b4('0x26')]['message']);}logger['error']('SugarcrmAccount,\x20%s,\x20%s',_0x5d56f4,_0x46aef1[_0x56b4('0x26')][_0x56b4('0x28')]);return _0x4eb28b(_0x46aef1['error']['message']);}else{logger[_0x56b4('0x20')](_0x56b4('0x21'),_0x5d56f4,_0x56b4('0x22'));_0x4eb28b(_0x46aef1[_0x56b4('0x29')][_0x56b4('0x28')]);}})[_0x56b4('0x2a')](function(_0x4b3752){logger['error']('SugarcrmAccount,\x20%s,\x20%s',_0x5d56f4,_0x4b3752);_0x510313(_0x4b3752);});});}function respondWithStatusCode(_0x638a2b,_0x1c97e9){_0x1c97e9=_0x1c97e9||0xcc;return function(_0x28a358){if(_0x28a358){return _0x638a2b[_0x56b4('0x2b')](_0x1c97e9);}return _0x638a2b[_0x56b4('0x2c')](_0x1c97e9)[_0x56b4('0x2d')]();};}function respondWithResult(_0x16ef7d,_0x5d1a26){_0x5d1a26=_0x5d1a26||0xc8;return function(_0x2888f9){if(_0x2888f9){return _0x16ef7d[_0x56b4('0x2c')](_0x5d1a26)[_0x56b4('0x2e')](_0x2888f9);}};}function respondWithFilteredResult(_0x4d68de,_0x3a1c57){return function(_0x33adea){if(_0x33adea){var _0x237672=typeof _0x3a1c57[_0x56b4('0x2f')]===_0x56b4('0x30')&&typeof _0x3a1c57['limit']===_0x56b4('0x30');var _0x13a40e=_0x33adea[_0x56b4('0x31')];var _0x38ce0b=_0x237672?0x0:_0x3a1c57[_0x56b4('0x2f')];var _0xbe45e0=_0x237672?_0x33adea[_0x56b4('0x31')]:_0x3a1c57['offset']+_0x3a1c57[_0x56b4('0x32')];var _0x5ab3ae;if(_0xbe45e0>=_0x13a40e){_0xbe45e0=_0x13a40e;_0x5ab3ae=0xc8;}else{_0x5ab3ae=0xce;}_0x4d68de[_0x56b4('0x2c')](_0x5ab3ae);return _0x4d68de[_0x56b4('0x33')]('Content-Range',_0x38ce0b+'-'+_0xbe45e0+'/'+_0x13a40e)[_0x56b4('0x2e')](_0x33adea);}return null;};}function patchUpdates(_0x41b5bf){return function(_0x3e6497){try{jsonpatch[_0x56b4('0x34')](_0x3e6497,_0x41b5bf,!![]);}catch(_0x290eb4){return BPromise[_0x56b4('0x35')](_0x290eb4);}return _0x3e6497['save']();};}function saveUpdates(_0x1121f8,_0x587d92){return function(_0x5c4237){if(_0x5c4237){return _0x5c4237[_0x56b4('0x36')](_0x1121f8)['then'](function(_0x5b1dc6){return _0x5b1dc6;});}return null;};}function removeEntity(_0x23b09f,_0x56583c){return function(_0x4af24f){if(_0x4af24f){return _0x4af24f[_0x56b4('0x37')]()['then'](function(){_0x23b09f[_0x56b4('0x2c')](0xcc)[_0x56b4('0x2d')]();});}};}function handleEntityNotFound(_0x5256c7,_0x4098f9){return function(_0x16c16c){if(!_0x16c16c){_0x5256c7[_0x56b4('0x2b')](0x194);}return _0x16c16c;};}function handleError(_0x31dc96,_0x542708){_0x542708=_0x542708||0x1f4;return function(_0x49bd28){logger[_0x56b4('0x26')](_0x49bd28[_0x56b4('0x38')]);if(_0x49bd28[_0x56b4('0x39')]){delete _0x49bd28[_0x56b4('0x39')];}_0x31dc96[_0x56b4('0x2c')](_0x542708)[_0x56b4('0x3a')](_0x49bd28);};}exports['index']=function(_0x301af8,_0x30e600){var _0x50ccdf={},_0xa9e459={},_0x49877f={'count':0x0,'rows':[]};var _0x5d22c6=_[_0x56b4('0x3b')](db['SugarcrmAccount'][_0x56b4('0x3c')],function(_0x57d3d5){return{'name':_0x57d3d5['fieldName'],'type':_0x57d3d5[_0x56b4('0x3d')][_0x56b4('0x3e')]};});_0xa9e459[_0x56b4('0x3f')]=_['map'](_0x5d22c6,_0x56b4('0x39'));_0xa9e459[_0x56b4('0x40')]=_[_0x56b4('0x41')](_0x301af8[_0x56b4('0x40')]);_0xa9e459[_0x56b4('0x42')]=_['intersection'](_0xa9e459[_0x56b4('0x3f')],_0xa9e459[_0x56b4('0x40')]);_0x50ccdf[_0x56b4('0x43')]=_[_0x56b4('0x44')](_0xa9e459[_0x56b4('0x3f')],qs[_0x56b4('0x45')](_0x301af8[_0x56b4('0x40')]['fields']));_0x50ccdf[_0x56b4('0x43')]=_0x50ccdf[_0x56b4('0x43')][_0x56b4('0x46')]?_0x50ccdf['attributes']:_0xa9e459[_0x56b4('0x3f')];if(!_0x301af8[_0x56b4('0x40')][_0x56b4('0x47')](_0x56b4('0x48'))){_0x50ccdf['limit']=qs[_0x56b4('0x32')](_0x301af8[_0x56b4('0x40')][_0x56b4('0x32')]);_0x50ccdf[_0x56b4('0x2f')]=qs[_0x56b4('0x2f')](_0x301af8['query'][_0x56b4('0x2f')]);}_0x50ccdf['order']=qs[_0x56b4('0x49')](_0x301af8[_0x56b4('0x40')][_0x56b4('0x49')]);_0x50ccdf[_0x56b4('0x4a')]=qs[_0x56b4('0x42')](_[_0x56b4('0x4b')](_0x301af8[_0x56b4('0x40')],_0xa9e459[_0x56b4('0x42')]),_0x5d22c6);if(_0x301af8[_0x56b4('0x40')][_0x56b4('0x4c')]){_0x50ccdf[_0x56b4('0x4a')]=_['merge'](_0x50ccdf[_0x56b4('0x4a')],{'$or':_[_0x56b4('0x3b')](_0x5d22c6,function(_0x37bf4b){if(_0x37bf4b[_0x56b4('0x3d')]!==_0x56b4('0x4d')){var _0x447c15={};_0x447c15[_0x37bf4b[_0x56b4('0x39')]]={'$like':'%'+_0x301af8[_0x56b4('0x40')][_0x56b4('0x4c')]+'%'};return _0x447c15;}})});}_0x50ccdf=_['merge']({},_0x50ccdf,_0x301af8['options']);var _0x2af6fc={'where':_0x50ccdf['where']};return db[_0x56b4('0x4e')][_0x56b4('0x31')](_0x2af6fc)[_0x56b4('0x1f')](function(_0x426781){_0x49877f[_0x56b4('0x31')]=_0x426781;if(_0x301af8[_0x56b4('0x40')]['includeAll']){_0x50ccdf[_0x56b4('0x4f')]=[{'all':!![]}];}return db['SugarcrmAccount'][_0x56b4('0x50')](_0x50ccdf);})['then'](function(_0x3a7006){_0x49877f[_0x56b4('0x51')]=_0x3a7006;return _0x49877f;})[_0x56b4('0x1f')](respondWithFilteredResult(_0x30e600,_0x50ccdf))['catch'](handleError(_0x30e600,null));};exports[_0x56b4('0x52')]=function(_0x5a0a2e,_0x5a25d4){var _0x1fefb9={'raw':![],'where':{'id':_0x5a0a2e[_0x56b4('0x53')]['id']}},_0xc5ae0e={};_0xc5ae0e[_0x56b4('0x3f')]=_[_0x56b4('0x41')](db[_0x56b4('0x4e')]['rawAttributes']);_0xc5ae0e['query']=_['keys'](_0x5a0a2e['query']);_0xc5ae0e[_0x56b4('0x42')]=_[_0x56b4('0x44')](_0xc5ae0e[_0x56b4('0x3f')],_0xc5ae0e[_0x56b4('0x40')]);_0x1fefb9['attributes']=_[_0x56b4('0x44')](_0xc5ae0e[_0x56b4('0x3f')],qs['fields'](_0x5a0a2e[_0x56b4('0x40')][_0x56b4('0x45')]));_0x1fefb9['attributes']=_0x1fefb9[_0x56b4('0x43')]['length']?_0x1fefb9[_0x56b4('0x43')]:_0xc5ae0e[_0x56b4('0x3f')];if(_0x5a0a2e['query']['includeAll']){_0x1fefb9[_0x56b4('0x4f')]=[{'all':!![]}];}_0x1fefb9=_[_0x56b4('0x54')]({},_0x1fefb9,_0x5a0a2e[_0x56b4('0x55')]);return db[_0x56b4('0x4e')][_0x56b4('0x56')](_0x1fefb9)['then'](handleEntityNotFound(_0x5a25d4,null))[_0x56b4('0x1f')](respondWithResult(_0x5a25d4,null))['catch'](handleError(_0x5a25d4,null));};exports[_0x56b4('0x57')]=function(_0x34e1bc,_0x42aa4b){return db['SugarcrmAccount'][_0x56b4('0x57')](_0x34e1bc['body'],{})['then'](respondWithResult(_0x42aa4b,0xc9))[_0x56b4('0x2a')](handleError(_0x42aa4b,null));};exports['update']=function(_0x2831da,_0x758767){if(_0x2831da[_0x56b4('0x58')]['id']){delete _0x2831da[_0x56b4('0x58')]['id'];}return db[_0x56b4('0x4e')][_0x56b4('0x56')]({'where':{'id':_0x2831da['params']['id']}})[_0x56b4('0x1f')](handleEntityNotFound(_0x758767,null))[_0x56b4('0x1f')](saveUpdates(_0x2831da['body'],null))[_0x56b4('0x1f')](respondWithResult(_0x758767,null))[_0x56b4('0x2a')](handleError(_0x758767,null));};exports[_0x56b4('0x37')]=function(_0x5dcdeb,_0x5da498){return db[_0x56b4('0x4e')][_0x56b4('0x56')]({'where':{'id':_0x5dcdeb['params']['id']}})[_0x56b4('0x1f')](handleEntityNotFound(_0x5da498,null))['then'](removeEntity(_0x5da498,null))[_0x56b4('0x2a')](handleError(_0x5da498,null));};exports[_0x56b4('0x59')]=function(_0x5f31a2,_0x44f678,_0x431375){var _0x1499f5={};var _0x13b39b={};var _0x517c96;var _0x167245;return db[_0x56b4('0x4e')][_0x56b4('0x5a')]({'where':{'id':_0x5f31a2[_0x56b4('0x53')]['id']}})['then'](handleEntityNotFound(_0x44f678,null))[_0x56b4('0x1f')](function(_0x367c26){if(_0x367c26){_0x517c96=_0x367c26;_0x13b39b[_0x56b4('0x3f')]=_['keys'](db['SugarcrmConfiguration'][_0x56b4('0x3c')]);_0x13b39b[_0x56b4('0x40')]=_['keys'](_0x5f31a2['query']);_0x13b39b[_0x56b4('0x42')]=_[_0x56b4('0x44')](_0x13b39b[_0x56b4('0x3f')],_0x13b39b['query']);_0x1499f5[_0x56b4('0x43')]=_[_0x56b4('0x44')](_0x13b39b[_0x56b4('0x3f')],qs[_0x56b4('0x45')](_0x5f31a2['query'][_0x56b4('0x45')]));_0x1499f5[_0x56b4('0x43')]=_0x1499f5[_0x56b4('0x43')][_0x56b4('0x46')]?_0x1499f5[_0x56b4('0x43')]:_0x13b39b[_0x56b4('0x3f')];_0x1499f5['order']=qs[_0x56b4('0x49')](_0x5f31a2[_0x56b4('0x40')][_0x56b4('0x49')]);_0x1499f5[_0x56b4('0x4a')]=qs['filters'](_[_0x56b4('0x4b')](_0x5f31a2[_0x56b4('0x40')],_0x13b39b[_0x56b4('0x42')]));if(_0x5f31a2[_0x56b4('0x40')][_0x56b4('0x4c')]){_0x1499f5['where']=_[_0x56b4('0x54')](_0x1499f5[_0x56b4('0x4a')],{'$or':_['map'](_0x1499f5[_0x56b4('0x43')],function(_0x15b5ba){var _0x362009={};_0x362009[_0x15b5ba]={'$like':'%'+_0x5f31a2[_0x56b4('0x40')]['filter']+'%'};return _0x362009;})});}_0x1499f5=_['merge']({},_0x1499f5,_0x5f31a2[_0x56b4('0x55')]);return _0x517c96[_0x56b4('0x59')](_0x1499f5);}})[_0x56b4('0x1f')](function(_0x2b8019){if(_0x2b8019){_0x167245=_0x2b8019[_0x56b4('0x46')];if(!_0x5f31a2['query']['hasOwnProperty']('nolimit')){_0x1499f5['limit']=qs[_0x56b4('0x32')](_0x5f31a2[_0x56b4('0x40')][_0x56b4('0x32')]);_0x1499f5[_0x56b4('0x2f')]=qs[_0x56b4('0x2f')](_0x5f31a2[_0x56b4('0x40')][_0x56b4('0x2f')]);}return _0x517c96['getConfigurations'](_0x1499f5);}})[_0x56b4('0x1f')](function(_0x53b94c){if(_0x53b94c){return _0x53b94c?{'count':_0x167245,'rows':_0x53b94c}:null;}})['then'](respondWithResult(_0x44f678,null))[_0x56b4('0x2a')](handleError(_0x44f678,null));};exports['addConfiguration']=function(_0x4f6a24,_0xced549,_0x23be5a){if(_0x4f6a24[_0x56b4('0x58')]['id']){delete _0x4f6a24[_0x56b4('0x58')]['id'];}return db[_0x56b4('0x4e')][_0x56b4('0x5a')]({'where':{'id':_0x4f6a24[_0x56b4('0x53')]['id']}})[_0x56b4('0x1f')](handleEntityNotFound(_0xced549,null))[_0x56b4('0x1f')](function(_0x5e3639){if(_0x5e3639){_0x4f6a24['body'][_0x56b4('0x5b')]=_0x5e3639['id'];_0x4f6a24[_0x56b4('0x58')]['Subjects']=integrations['getSubjects'](_0x4f6a24['body'][_0x56b4('0x5c')],_0x4f6a24[_0x56b4('0x58')][_0x56b4('0x3d')]);_0x4f6a24[_0x56b4('0x58')]['Descriptions']=integrations[_0x56b4('0x5d')](_0x4f6a24['body'][_0x56b4('0x5c')],_0x4f6a24[_0x56b4('0x58')]['type']);return db[_0x56b4('0x5e')][_0x56b4('0x57')](_0x4f6a24[_0x56b4('0x58')],{'include':[{'model':db[_0x56b4('0x5f')],'as':_0x56b4('0x60')},{'model':db[_0x56b4('0x5f')],'as':_0x56b4('0x61')}]});}return null;})[_0x56b4('0x1f')](respondWithResult(_0xced549,null))[_0x56b4('0x2a')](handleError(_0xced549,null));};exports[_0x56b4('0x62')]=function(_0x2f54d,_0x2bbb1d,_0x5dcb6a){var _0x26ea75='';var _0x27025d=['id','name',_0x56b4('0x63'),_0x56b4('0x64'),_0x56b4('0x65'),_0x56b4('0x66'),'duration_hours',_0x56b4('0x67'),_0x56b4('0x68'),_0x56b4('0x69'),'parent_name',_0x56b4('0x6a')];return db[_0x56b4('0x4e')][_0x56b4('0x5a')]({'where':{'id':_0x2f54d[_0x56b4('0x53')]['id']},'attributes':['id',_0x56b4('0x6b'),_0x56b4('0x6c'),_0x56b4('0x6d')]})['then'](handleEntityNotFound(_0x2bbb1d,null))[_0x56b4('0x1f')](function(_0x3ddf13){if(_0x3ddf13){_0x26ea75=_0x3ddf13['remoteUri'];var _0xdab640=_0x26ea75[_0x56b4('0x6e')](-0x1);if(_0xdab640==='/'){_0x26ea75=_0x26ea75[_0x56b4('0x6f')](0x0,_0x26ea75[_0x56b4('0x70')](_0xdab640));}return rp({'method':_0x56b4('0x71'),'uri':util[_0x56b4('0x72')](_0x56b4('0x73'),_0x26ea75,_0x56b4('0x74')),'json':!![],'form':{'method':_0x56b4('0x75'),'input_type':_0x56b4('0x76'),'response_type':'JSON','rest_data':JSON[_0x56b4('0x25')]({'user_auth':{'user_name':_0x3ddf13[_0x56b4('0x6b')],'password':_0x3ddf13[_0x56b4('0x6c')],'encryption':_0x56b4('0x77')},'application':_0x56b4('0x78')})}});}})['then'](function(_0x3e875a){if(_0x3e875a&&_0x3e875a[_0x56b4('0x39')]!==_0x56b4('0x79')&&_0x3e875a[_0x56b4('0x39')]!==_0x56b4('0x7a')){return rp({'method':_0x56b4('0x71'),'uri':util['format'](_0x56b4('0x73'),_0x26ea75,'/service/v4_1/rest.php'),'json':!![],'form':{'method':'get_module_fields','input_type':_0x56b4('0x76'),'response_type':_0x56b4('0x76'),'rest_data':JSON[_0x56b4('0x25')]({'session':_0x3e875a['id'],'module_name':_0x56b4('0x7b')})}})[_0x56b4('0x1f')](function(_0x5d3319){if(_0x5d3319){var _0xd6cda6=_[_0x56b4('0x7c')](_0x5d3319[_0x56b4('0x7d')]);_['remove'](_0xd6cda6,function(_0xcaeda){return _0x27025d[_0x56b4('0x7e')](_0xcaeda[_0x56b4('0x39')]);});return{'count':_0xd6cda6[_0x56b4('0x46')],'rows':_['map'](_0xd6cda6,function(_0x3879ee){return{'id':_0x3879ee['name'],'name':_0x3879ee[_0x56b4('0x7f')],'custom':_[_0x56b4('0x80')](_0x3879ee['name'],'_c')?!![]:![],'options':_0x3879ee[_0x56b4('0x55')]?_[_0x56b4('0x3b')](_['values'](_0x3879ee[_0x56b4('0x55')]),function(_0x53c06c){return{'name':_0x53c06c[_0x56b4('0x81')],'value':_0x53c06c[_0x56b4('0x39')]};}):[]};})};}})['then'](respondWithResult(_0x2bbb1d,null))[_0x56b4('0x2a')](function(_0x5e7295){var _0x59b585=_0x2f54d[_0x56b4('0x40')]['test']?0x1f4:_0x5e7295['statusCode']||0x1f4;logger[_0x56b4('0x26')](_0x56b4('0x82'),_0x56b4('0x62'),_0x59b585,JSON[_0x56b4('0x25')](_0x5e7295));delete _0x5e7295[_0x56b4('0x39')];if(_0x59b585===0x191){_0x59b585=0x190;}_0x2bbb1d[_0x56b4('0x2c')](_0x59b585)[_0x56b4('0x3a')](_0x2f54d[_0x56b4('0x40')][_0x56b4('0x83')]?{'message':'Wrong\x20credentials','statusCode':_0x5e7295[_0x56b4('0x84')]}:_0x5e7295);});}else{var _0x1827b3=0x1f4;_0x2bbb1d[_0x56b4('0x2c')](_0x1827b3)[_0x56b4('0x3a')]({'message':_0x56b4('0x85'),'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 49b9497..8ecd346 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 _0x8f25=['bluebird','../../config/environment','./intSugarcrmAccount.attributes','../../components/integrations/configuration','define','SugarcrmAccount','int_sugarcrm_accounts','lodash','util','../../config/logger','api','moment'];(function(_0x4dde73,_0x281a14){var _0x100b55=function(_0x13c96c){while(--_0x13c96c){_0x4dde73['push'](_0x4dde73['shift']());}};_0x100b55(++_0x281a14);}(_0x8f25,0x14b));var _0x58f2=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x8f25[_0x6131cd];return _0x47e916;};'use strict';var _=require(_0x58f2('0x0'));var util=require(_0x58f2('0x1'));var logger=require(_0x58f2('0x2'))(_0x58f2('0x3'));var moment=require(_0x58f2('0x4'));var BPromise=require(_0x58f2('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x58f2('0x6'));var attributes=require(_0x58f2('0x7'));var integrations=require(_0x58f2('0x8'));module['exports']=function(_0x415a68,_0x26f94f){return _0x415a68[_0x58f2('0x9')](_0x58f2('0xa'),attributes,{'tableName':_0x58f2('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x78a4=['exports','SugarcrmAccount','int_sugarcrm_accounts','lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment'];(function(_0x8aaf04,_0x1c8541){var _0x2c638f=function(_0x2a5012){while(--_0x2a5012){_0x8aaf04['push'](_0x8aaf04['shift']());}};_0x2c638f(++_0x1c8541);}(_0x78a4,0x12c));var _0x478a=function(_0x455893,_0x909838){_0x455893=_0x455893-0x0;var _0x3851e8=_0x78a4[_0x455893];return _0x3851e8;};'use strict';var _=require(_0x478a('0x0'));var util=require(_0x478a('0x1'));var logger=require(_0x478a('0x2'))(_0x478a('0x3'));var moment=require(_0x478a('0x4'));var BPromise=require(_0x478a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x478a('0x6'));var config=require(_0x478a('0x7'));var attributes=require('./intSugarcrmAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0x478a('0x8')]=function(_0x666449,_0x3e41ae){return _0x666449['define'](_0x478a('0x9'),attributes,{'tableName':_0x478a('0xa'),'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 892e40a..9e10b12 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 _0x3323=['ShowSugarcrmAccount','lodash','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','SugarcrmAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','SugarcrmAccount,\x20%s,\x20%s','message','info','result','GetSugarcrmAccount','SugarcrmAccount','findAll','options','raw','where','attributes','limit','map','include','model','debug','stringify','catch','find'];(function(_0x418979,_0x26b641){var _0x1bbfd8=function(_0xe290f9){while(--_0xe290f9){_0x418979['push'](_0x418979['shift']());}};_0x1bbfd8(++_0x26b641);}(_0x3323,0x13c));var _0x3332=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0x3323[_0x51020b];return _0x371e47;};'use strict';var _=require(_0x3332('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x3332('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3332('0x2'))['db'];var utils=require(_0x3332('0x3'));var logger=require(_0x3332('0x4'))('rpc');var config=require(_0x3332('0x5'));var jayson=require(_0x3332('0x6'));var client=jayson[_0x3332('0x7')][_0x3332('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x47c21a,_0x329526,_0x3ef0d5){return new BPromise(function(_0x4df671,_0x3fa5e4){return client[_0x3332('0x9')](_0x47c21a,_0x3ef0d5)[_0x3332('0xa')](function(_0x99d082){logger['info']('SugarcrmAccount,\x20%s,\x20%s',_0x329526,'request\x20sent');logger['debug'](_0x3332('0xb'),_0x329526,_0x3332('0xc'),JSON['stringify'](_0x99d082));if(_0x99d082['error']){if(_0x99d082[_0x3332('0xd')][_0x3332('0xe')]===0x1f4){logger[_0x3332('0xd')](_0x3332('0xf'),_0x329526,_0x99d082['error']['message']);return _0x3fa5e4(_0x99d082[_0x3332('0xd')][_0x3332('0x10')]);}logger[_0x3332('0xd')](_0x3332('0xf'),_0x329526,_0x99d082[_0x3332('0xd')][_0x3332('0x10')]);return _0x4df671(_0x99d082[_0x3332('0xd')][_0x3332('0x10')]);}else{logger[_0x3332('0x11')](_0x3332('0xf'),_0x329526,'request\x20sent');_0x4df671(_0x99d082[_0x3332('0x12')][_0x3332('0x10')]);}})['catch'](function(_0x44d3d3){logger['error'](_0x3332('0xf'),_0x329526,_0x44d3d3);_0x3fa5e4(_0x44d3d3);});});}exports[_0x3332('0x13')]=function(_0x196900){var _0x34a762=this;return new Promise(function(_0x13e42a,_0x11a9b1){return db[_0x3332('0x14')][_0x3332('0x15')]({'raw':_0x196900[_0x3332('0x16')]?_0x196900['options'][_0x3332('0x17')]===undefined?!![]:![]:!![],'where':_0x196900['options']?_0x196900[_0x3332('0x16')][_0x3332('0x18')]||null:null,'attributes':_0x196900['options']?_0x196900['options'][_0x3332('0x19')]||null:null,'limit':_0x196900[_0x3332('0x16')]?_0x196900[_0x3332('0x16')][_0x3332('0x1a')]||null:null,'include':_0x196900[_0x3332('0x16')]?_0x196900['options']['include']?_[_0x3332('0x1b')](_0x196900[_0x3332('0x16')][_0x3332('0x1c')],function(_0x3caf9e){return{'model':db[_0x3caf9e[_0x3332('0x1d')]],'as':_0x3caf9e['as'],'attributes':_0x3caf9e[_0x3332('0x19')],'include':_0x3caf9e[_0x3332('0x1c')]?_['map'](_0x3caf9e[_0x3332('0x1c')],function(_0x2bf50c){return{'model':db[_0x2bf50c[_0x3332('0x1d')]],'as':_0x2bf50c['as'],'attributes':_0x2bf50c[_0x3332('0x19')],'include':_0x2bf50c[_0x3332('0x1c')]?_[_0x3332('0x1b')](_0x2bf50c[_0x3332('0x1c')],function(_0x5f36bf){return{'model':db[_0x5f36bf[_0x3332('0x1d')]],'as':_0x5f36bf['as'],'attributes':_0x5f36bf[_0x3332('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x25de20){logger['info']('GetSugarcrmAccount',_0x196900);logger[_0x3332('0x1e')](_0x3332('0x13'),_0x196900,JSON[_0x3332('0x1f')](_0x25de20));_0x13e42a(_0x25de20);})[_0x3332('0x20')](function(_0x177daf){logger[_0x3332('0xd')]('GetSugarcrmAccount',_0x177daf[_0x3332('0x10')],_0x196900);_0x11a9b1(_0x34a762[_0x3332('0xd')](0x1f4,_0x177daf[_0x3332('0x10')]));});});};exports['ShowSugarcrmAccount']=function(_0x1a0589){var _0x354b6d=this;return new Promise(function(_0x631f8b,_0x32e324){return db[_0x3332('0x14')][_0x3332('0x21')]({'raw':_0x1a0589[_0x3332('0x16')]?_0x1a0589['options'][_0x3332('0x17')]===undefined?!![]:![]:!![],'where':_0x1a0589[_0x3332('0x16')]?_0x1a0589[_0x3332('0x16')]['where']||null:null,'attributes':_0x1a0589[_0x3332('0x16')]?_0x1a0589['options'][_0x3332('0x19')]||null:null,'include':_0x1a0589['options']?_0x1a0589[_0x3332('0x16')][_0x3332('0x1c')]?_['map'](_0x1a0589['options'][_0x3332('0x1c')],function(_0x1ffd52){return{'model':db[_0x1ffd52[_0x3332('0x1d')]],'as':_0x1ffd52['as'],'attributes':_0x1ffd52[_0x3332('0x19')],'include':_0x1ffd52[_0x3332('0x1c')]?_[_0x3332('0x1b')](_0x1ffd52['include'],function(_0x24f7e9){return{'model':db[_0x24f7e9[_0x3332('0x1d')]],'as':_0x24f7e9['as'],'attributes':_0x24f7e9[_0x3332('0x19')],'include':_0x24f7e9[_0x3332('0x1c')]?_['map'](_0x24f7e9[_0x3332('0x1c')],function(_0x47528e){return{'model':db[_0x47528e[_0x3332('0x1d')]],'as':_0x47528e['as'],'attributes':_0x47528e[_0x3332('0x19')]};}):[]};}):[]};}):[]:[]})[_0x3332('0xa')](function(_0x3ab12b){logger['info'](_0x3332('0x22'),_0x1a0589);logger[_0x3332('0x1e')]('ShowSugarcrmAccount',_0x1a0589,JSON[_0x3332('0x1f')](_0x3ab12b));_0x631f8b(_0x3ab12b);})[_0x3332('0x20')](function(_0x5cb600){logger[_0x3332('0xd')]('ShowSugarcrmAccount',_0x5cb600[_0x3332('0x10')],_0x1a0589);_0x32e324(_0x354b6d[_0x3332('0xd')](0x1f4,_0x5cb600[_0x3332('0x10')]));});});}; \ No newline at end of file +var _0x6a9a=['rpc','../../config/environment','jayson/promise','client','request','then','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','SugarcrmAccount,\x20%s,\x20%s','message','info','request\x20sent','result','catch','GetSugarcrmAccount','SugarcrmAccount','findAll','options','raw','where','attributes','limit','include','model','map','ShowSugarcrmAccount','find','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x417671,_0x85ccdd){var _0x11f9e6=function(_0x180b15){while(--_0x180b15){_0x417671['push'](_0x417671['shift']());}};_0x11f9e6(++_0x85ccdd);}(_0x6a9a,0x146));var _0xa6a9=function(_0x529f1c,_0x437ed1){_0x529f1c=_0x529f1c-0x0;var _0x4d57ab=_0x6a9a[_0x529f1c];return _0x4d57ab;};'use strict';var _=require('lodash');var util=require(_0xa6a9('0x0'));var moment=require('moment');var BPromise=require(_0xa6a9('0x1'));var rs=require(_0xa6a9('0x2'));var fs=require('fs');var Redis=require(_0xa6a9('0x3'));var db=require(_0xa6a9('0x4'))['db'];var utils=require(_0xa6a9('0x5'));var logger=require(_0xa6a9('0x6'))(_0xa6a9('0x7'));var config=require(_0xa6a9('0x8'));var jayson=require(_0xa6a9('0x9'));var client=jayson[_0xa6a9('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x53d5e4,_0x5b4759,_0x35bc96){return new BPromise(function(_0x224d6c,_0x5927de){return client[_0xa6a9('0xb')](_0x53d5e4,_0x35bc96)[_0xa6a9('0xc')](function(_0x563f61){logger['info']('SugarcrmAccount,\x20%s,\x20%s',_0x5b4759,'request\x20sent');logger[_0xa6a9('0xd')](_0xa6a9('0xe'),_0x5b4759,'request\x20sent',JSON[_0xa6a9('0xf')](_0x563f61));if(_0x563f61[_0xa6a9('0x10')]){if(_0x563f61[_0xa6a9('0x10')][_0xa6a9('0x11')]===0x1f4){logger[_0xa6a9('0x10')](_0xa6a9('0x12'),_0x5b4759,_0x563f61[_0xa6a9('0x10')][_0xa6a9('0x13')]);return _0x5927de(_0x563f61[_0xa6a9('0x10')][_0xa6a9('0x13')]);}logger[_0xa6a9('0x10')](_0xa6a9('0x12'),_0x5b4759,_0x563f61[_0xa6a9('0x10')]['message']);return _0x224d6c(_0x563f61[_0xa6a9('0x10')][_0xa6a9('0x13')]);}else{logger[_0xa6a9('0x14')](_0xa6a9('0x12'),_0x5b4759,_0xa6a9('0x15'));_0x224d6c(_0x563f61[_0xa6a9('0x16')][_0xa6a9('0x13')]);}})[_0xa6a9('0x17')](function(_0x50af01){logger[_0xa6a9('0x10')]('SugarcrmAccount,\x20%s,\x20%s',_0x5b4759,_0x50af01);_0x5927de(_0x50af01);});});}exports[_0xa6a9('0x18')]=function(_0x5debdd){var _0x4ccf83=this;return new Promise(function(_0x417943,_0x3ed475){return db[_0xa6a9('0x19')][_0xa6a9('0x1a')]({'raw':_0x5debdd[_0xa6a9('0x1b')]?_0x5debdd[_0xa6a9('0x1b')][_0xa6a9('0x1c')]===undefined?!![]:![]:!![],'where':_0x5debdd[_0xa6a9('0x1b')]?_0x5debdd[_0xa6a9('0x1b')][_0xa6a9('0x1d')]||null:null,'attributes':_0x5debdd[_0xa6a9('0x1b')]?_0x5debdd[_0xa6a9('0x1b')][_0xa6a9('0x1e')]||null:null,'limit':_0x5debdd[_0xa6a9('0x1b')]?_0x5debdd[_0xa6a9('0x1b')][_0xa6a9('0x1f')]||null:null,'include':_0x5debdd['options']?_0x5debdd[_0xa6a9('0x1b')][_0xa6a9('0x20')]?_['map'](_0x5debdd[_0xa6a9('0x1b')][_0xa6a9('0x20')],function(_0x109702){return{'model':db[_0x109702[_0xa6a9('0x21')]],'as':_0x109702['as'],'attributes':_0x109702[_0xa6a9('0x1e')],'include':_0x109702['include']?_[_0xa6a9('0x22')](_0x109702[_0xa6a9('0x20')],function(_0x2a98c2){return{'model':db[_0x2a98c2[_0xa6a9('0x21')]],'as':_0x2a98c2['as'],'attributes':_0x2a98c2['attributes'],'include':_0x2a98c2['include']?_['map'](_0x2a98c2[_0xa6a9('0x20')],function(_0x4cbce6){return{'model':db[_0x4cbce6[_0xa6a9('0x21')]],'as':_0x4cbce6['as'],'attributes':_0x4cbce6[_0xa6a9('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xa6a9('0xc')](function(_0x1ff0eb){logger[_0xa6a9('0x14')](_0xa6a9('0x18'),_0x5debdd);logger[_0xa6a9('0xd')](_0xa6a9('0x18'),_0x5debdd,JSON['stringify'](_0x1ff0eb));_0x417943(_0x1ff0eb);})[_0xa6a9('0x17')](function(_0xc09b40){logger[_0xa6a9('0x10')](_0xa6a9('0x18'),_0xc09b40['message'],_0x5debdd);_0x3ed475(_0x4ccf83['error'](0x1f4,_0xc09b40[_0xa6a9('0x13')]));});});};exports[_0xa6a9('0x23')]=function(_0x4c6f24){var _0x1ee387=this;return new Promise(function(_0xb8d8ad,_0xdd9689){return db[_0xa6a9('0x19')][_0xa6a9('0x24')]({'raw':_0x4c6f24[_0xa6a9('0x1b')]?_0x4c6f24[_0xa6a9('0x1b')][_0xa6a9('0x1c')]===undefined?!![]:![]:!![],'where':_0x4c6f24[_0xa6a9('0x1b')]?_0x4c6f24[_0xa6a9('0x1b')]['where']||null:null,'attributes':_0x4c6f24['options']?_0x4c6f24[_0xa6a9('0x1b')][_0xa6a9('0x1e')]||null:null,'include':_0x4c6f24[_0xa6a9('0x1b')]?_0x4c6f24[_0xa6a9('0x1b')]['include']?_[_0xa6a9('0x22')](_0x4c6f24[_0xa6a9('0x1b')]['include'],function(_0x31daee){return{'model':db[_0x31daee[_0xa6a9('0x21')]],'as':_0x31daee['as'],'attributes':_0x31daee['attributes'],'include':_0x31daee[_0xa6a9('0x20')]?_['map'](_0x31daee[_0xa6a9('0x20')],function(_0x3a3f8a){return{'model':db[_0x3a3f8a[_0xa6a9('0x21')]],'as':_0x3a3f8a['as'],'attributes':_0x3a3f8a['attributes'],'include':_0x3a3f8a[_0xa6a9('0x20')]?_[_0xa6a9('0x22')](_0x3a3f8a[_0xa6a9('0x20')],function(_0x1b8054){return{'model':db[_0x1b8054[_0xa6a9('0x21')]],'as':_0x1b8054['as'],'attributes':_0x1b8054[_0xa6a9('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xa6a9('0xc')](function(_0x349d4c){logger[_0xa6a9('0x14')](_0xa6a9('0x23'),_0x4c6f24);logger[_0xa6a9('0xd')]('ShowSugarcrmAccount',_0x4c6f24,JSON[_0xa6a9('0xf')](_0x349d4c));_0xb8d8ad(_0x349d4c);})[_0xa6a9('0x17')](function(_0x2e504f){logger[_0xa6a9('0x10')]('ShowSugarcrmAccount',_0x2e504f[_0xa6a9('0x13')],_0x4c6f24);_0xdd9689(_0x1ee387['error'](0x1f4,_0x2e504f['message']));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index 29b4531..6d542c2 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 _0x7f29=['multer','util','path','express','Router','fs-extra','../../config/environment','./intSugarcrmConfiguration.controller','get','isAuthenticated','/:id','getFields','/:id/subjects','getSubjects','getDescriptions','post','create','put','update','delete','destroy','exports'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x7f29,0x84));var _0x97f2=function(_0x33fedc,_0x3a368e){_0x33fedc=_0x33fedc-0x0;var _0x488fee=_0x7f29[_0x33fedc];return _0x488fee;};'use strict';var multer=require(_0x97f2('0x0'));var util=require(_0x97f2('0x1'));var path=require(_0x97f2('0x2'));var timeout=require('connect-timeout');var express=require(_0x97f2('0x3'));var router=express[_0x97f2('0x4')]();var fs_extra=require(_0x97f2('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x97f2('0x6'));var controller=require(_0x97f2('0x7'));router[_0x97f2('0x8')]('/',auth[_0x97f2('0x9')](),controller['index']);router[_0x97f2('0x8')](_0x97f2('0xa'),auth['isAuthenticated'](),controller['show']);router['get']('/:id/fields',auth['isAuthenticated'](),controller[_0x97f2('0xb')]);router[_0x97f2('0x8')](_0x97f2('0xc'),auth[_0x97f2('0x9')](),controller[_0x97f2('0xd')]);router[_0x97f2('0x8')]('/:id/descriptions',auth[_0x97f2('0x9')](),controller[_0x97f2('0xe')]);router[_0x97f2('0xf')]('/',auth[_0x97f2('0x9')](),controller[_0x97f2('0x10')]);router[_0x97f2('0x11')](_0x97f2('0xa'),auth[_0x97f2('0x9')](),controller[_0x97f2('0x12')]);router[_0x97f2('0x13')]('/:id',auth[_0x97f2('0x9')](),controller[_0x97f2('0x14')]);module[_0x97f2('0x15')]=router; \ No newline at end of file +var _0x1e5e=['express','Router','../../components/interaction/service','get','index','/:id','show','/:id/fields','getFields','/:id/subjects','isAuthenticated','getDescriptions','put','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x3dea84,_0x1aeecb){var _0x4e3a5e=function(_0x7037dc){while(--_0x7037dc){_0x3dea84['push'](_0x3dea84['shift']());}};_0x4e3a5e(++_0x1aeecb);}(_0x1e5e,0x88));var _0xe1e5=function(_0xbe6d5d,_0x308a41){_0xbe6d5d=_0xbe6d5d-0x0;var _0x2cb584=_0x1e5e[_0xbe6d5d];return _0x2cb584;};'use strict';var multer=require(_0xe1e5('0x0'));var util=require(_0xe1e5('0x1'));var path=require(_0xe1e5('0x2'));var timeout=require(_0xe1e5('0x3'));var express=require(_0xe1e5('0x4'));var router=express[_0xe1e5('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xe1e5('0x6'));var config=require('../../config/environment');var controller=require('./intSugarcrmConfiguration.controller');router[_0xe1e5('0x7')]('/',auth['isAuthenticated'](),controller[_0xe1e5('0x8')]);router[_0xe1e5('0x7')](_0xe1e5('0x9'),auth['isAuthenticated'](),controller[_0xe1e5('0xa')]);router[_0xe1e5('0x7')](_0xe1e5('0xb'),auth['isAuthenticated'](),controller[_0xe1e5('0xc')]);router[_0xe1e5('0x7')](_0xe1e5('0xd'),auth[_0xe1e5('0xe')](),controller['getSubjects']);router[_0xe1e5('0x7')]('/:id/descriptions',auth['isAuthenticated'](),controller[_0xe1e5('0xf')]);router['post']('/',auth[_0xe1e5('0xe')](),controller['create']);router[_0xe1e5('0x10')](_0xe1e5('0x9'),auth[_0xe1e5('0xe')](),controller['update']);router[_0xe1e5('0x11')]('/:id',auth[_0xe1e5('0xe')](),controller[_0xe1e5('0x12')]);module[_0xe1e5('0x13')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index 31f3734..06fbe1a 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 _0x792f=['sequelize','exports','STRING'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x792f,0x8a));var _0xf792=function(_0x2f87cd,_0xcaf299){_0x2f87cd=_0x2f87cd-0x0;var _0x5d7eda=_0x792f[_0x2f87cd];return _0x5d7eda;};'use strict';var Sequelize=require(_0xf792('0x0'));module[_0xf792('0x1')]={'name':{'type':Sequelize[_0xf792('0x2')]},'description':{'type':Sequelize[_0xf792('0x2')]}}; \ No newline at end of file +var _0x1b8d=['exports','sequelize'];(function(_0x592ea5,_0x1152fa){var _0x1cdbc7=function(_0x49f2a4){while(--_0x49f2a4){_0x592ea5['push'](_0x592ea5['shift']());}};_0x1cdbc7(++_0x1152fa);}(_0x1b8d,0x11d));var _0xd1b8=function(_0x22f75e,_0x4a9e06){_0x22f75e=_0x22f75e-0x0;var _0x1f6ab3=_0x1b8d[_0x22f75e];return _0x1f6ab3;};'use strict';var Sequelize=require(_0xd1b8('0x0'));module[_0xd1b8('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 c753011..c6cb206 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 _0xc332=['body','params','getFields','SugarcrmField','findOne','getDescriptions','eml-format','rimraf','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','api','../../config/utils','../../config/environment','../../config/license/util','jayson/promise','client','http','request','then','info','request\x20sent','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','error','code','SugarcrmConfiguration,\x20%s,\x20%s','message','catch','sendStatus','status','end','undefined','limit','offset','count','set','Content-Range','apply','reject','update','destroy','stack','name','index','map','SugarcrmConfiguration','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','includeAll','findAll','rows','show','rawAttributes','length','options','find','create'];(function(_0x3f4315,_0xd6ec89){var _0x5842e3=function(_0x4b12f5){while(--_0x4b12f5){_0x3f4315['push'](_0x3f4315['shift']());}};_0x5842e3(++_0xd6ec89);}(_0xc332,0x117));var _0x2c33=function(_0x5da7a3,_0x6c451c){_0x5da7a3=_0x5da7a3-0x0;var _0x52b7f1=_0xc332[_0x5da7a3];return _0x52b7f1;};'use strict';var emlformat=require(_0x2c33('0x0'));var rimraf=require(_0x2c33('0x1'));var zipdir=require(_0x2c33('0x2'));var jsonpatch=require(_0x2c33('0x3'));var rp=require(_0x2c33('0x4'));var moment=require(_0x2c33('0x5'));var BPromise=require(_0x2c33('0x6'));var Mustache=require(_0x2c33('0x7'));var util=require(_0x2c33('0x8'));var path=require(_0x2c33('0x9'));var sox=require(_0x2c33('0xa'));var csv=require(_0x2c33('0xb'));var ejs=require(_0x2c33('0xc'));var fs=require('fs');var fs_extra=require(_0x2c33('0xd'));var _=require('lodash');var squel=require(_0x2c33('0xe'));var crypto=require(_0x2c33('0xf'));var jsforce=require(_0x2c33('0x10'));var deskjs=require(_0x2c33('0x11'));var toCsv=require(_0x2c33('0xb'));var querystring=require(_0x2c33('0x12'));var Papa=require(_0x2c33('0x13'));var Redis=require(_0x2c33('0x14'));var authService=require(_0x2c33('0x15'));var qs=require(_0x2c33('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2c33('0x17'));var logger=require(_0x2c33('0x18'))(_0x2c33('0x19'));var utils=require(_0x2c33('0x1a'));var config=require(_0x2c33('0x1b'));var licenseUtil=require(_0x2c33('0x1c'));var db=require('../../mysqldb')['db'];var jayson=require(_0x2c33('0x1d'));var client=jayson[_0x2c33('0x1e')][_0x2c33('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x2fe35d,_0x1ff2d5,_0x2d0391,_0x5661ee){return new BPromise(function(_0xa1fd7f,_0x4c601a){var _0x4b8fc0=_0x5661ee||client;return _0x4b8fc0[_0x2c33('0x20')](_0x2fe35d,_0x2d0391)[_0x2c33('0x21')](function(_0x279d99){logger[_0x2c33('0x22')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x1ff2d5,_0x2c33('0x23'));logger['debug'](_0x2c33('0x24'),_0x1ff2d5,'request\x20sent',JSON['stringify'](_0x279d99));if(_0x279d99[_0x2c33('0x25')]){if(_0x279d99[_0x2c33('0x25')][_0x2c33('0x26')]===0x1f4){logger[_0x2c33('0x25')](_0x2c33('0x27'),_0x1ff2d5,_0x279d99[_0x2c33('0x25')][_0x2c33('0x28')]);return _0x4c601a(_0x279d99['error'][_0x2c33('0x28')]);}logger[_0x2c33('0x25')](_0x2c33('0x27'),_0x1ff2d5,_0x279d99[_0x2c33('0x25')][_0x2c33('0x28')]);return _0xa1fd7f(_0x279d99[_0x2c33('0x25')][_0x2c33('0x28')]);}else{logger['info'](_0x2c33('0x27'),_0x1ff2d5,_0x2c33('0x23'));_0xa1fd7f(_0x279d99['result'][_0x2c33('0x28')]);}})[_0x2c33('0x29')](function(_0x2c4b03){logger[_0x2c33('0x25')](_0x2c33('0x27'),_0x1ff2d5,_0x2c4b03);_0x4c601a(_0x2c4b03);});});}function respondWithStatusCode(_0x35105f,_0x5f0306){_0x5f0306=_0x5f0306||0xcc;return function(_0x4c3186){if(_0x4c3186){return _0x35105f[_0x2c33('0x2a')](_0x5f0306);}return _0x35105f[_0x2c33('0x2b')](_0x5f0306)[_0x2c33('0x2c')]();};}function respondWithResult(_0x204a7c,_0x586887){_0x586887=_0x586887||0xc8;return function(_0x2d6f95){if(_0x2d6f95){return _0x204a7c[_0x2c33('0x2b')](_0x586887)['json'](_0x2d6f95);}};}function respondWithFilteredResult(_0x3e1de7,_0x41c972){return function(_0x129fa5){if(_0x129fa5){var _0x3557ef=typeof _0x41c972['offset']===_0x2c33('0x2d')&&typeof _0x41c972[_0x2c33('0x2e')]==='undefined';var _0x3708b3=_0x129fa5['count'];var _0xe5be63=_0x3557ef?0x0:_0x41c972[_0x2c33('0x2f')];var _0x22ba85=_0x3557ef?_0x129fa5[_0x2c33('0x30')]:_0x41c972['offset']+_0x41c972[_0x2c33('0x2e')];var _0x16a682;if(_0x22ba85>=_0x3708b3){_0x22ba85=_0x3708b3;_0x16a682=0xc8;}else{_0x16a682=0xce;}_0x3e1de7[_0x2c33('0x2b')](_0x16a682);return _0x3e1de7[_0x2c33('0x31')](_0x2c33('0x32'),_0xe5be63+'-'+_0x22ba85+'/'+_0x3708b3)['json'](_0x129fa5);}return null;};}function patchUpdates(_0x249832){return function(_0x5a907e){try{jsonpatch[_0x2c33('0x33')](_0x5a907e,_0x249832,!![]);}catch(_0x961e2a){return BPromise[_0x2c33('0x34')](_0x961e2a);}return _0x5a907e['save']();};}function saveUpdates(_0x417f87,_0x5b663a){return function(_0x14d2a2){if(_0x14d2a2){return _0x14d2a2[_0x2c33('0x35')](_0x417f87)[_0x2c33('0x21')](function(_0x5cae83){return _0x5cae83;});}return null;};}function removeEntity(_0x346cf8,_0x1a8f84){return function(_0x42dce1){if(_0x42dce1){return _0x42dce1[_0x2c33('0x36')]()[_0x2c33('0x21')](function(){_0x346cf8[_0x2c33('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4287d6,_0x127d17){return function(_0x3b6fba){if(!_0x3b6fba){_0x4287d6[_0x2c33('0x2a')](0x194);}return _0x3b6fba;};}function handleError(_0x374ae8,_0x548e0d){_0x548e0d=_0x548e0d||0x1f4;return function(_0x3530df){logger[_0x2c33('0x25')](_0x3530df[_0x2c33('0x37')]);if(_0x3530df['name']){delete _0x3530df[_0x2c33('0x38')];}_0x374ae8['status'](_0x548e0d)['send'](_0x3530df);};}exports[_0x2c33('0x39')]=function(_0x1ac3a3,_0x28e1de){var _0x40168b={},_0x3a188d={},_0x492908={'count':0x0,'rows':[]};var _0x25cdfd=_[_0x2c33('0x3a')](db[_0x2c33('0x3b')]['rawAttributes'],function(_0x409b36){return{'name':_0x409b36['fieldName'],'type':_0x409b36[_0x2c33('0x3c')]['key']};});_0x3a188d[_0x2c33('0x3d')]=_['map'](_0x25cdfd,_0x2c33('0x38'));_0x3a188d[_0x2c33('0x3e')]=_[_0x2c33('0x3f')](_0x1ac3a3['query']);_0x3a188d[_0x2c33('0x40')]=_[_0x2c33('0x41')](_0x3a188d[_0x2c33('0x3d')],_0x3a188d['query']);_0x40168b[_0x2c33('0x42')]=_['intersection'](_0x3a188d[_0x2c33('0x3d')],qs[_0x2c33('0x43')](_0x1ac3a3[_0x2c33('0x3e')][_0x2c33('0x43')]));_0x40168b[_0x2c33('0x42')]=_0x40168b[_0x2c33('0x42')]['length']?_0x40168b[_0x2c33('0x42')]:_0x3a188d[_0x2c33('0x3d')];if(!_0x1ac3a3[_0x2c33('0x3e')][_0x2c33('0x44')](_0x2c33('0x45'))){_0x40168b[_0x2c33('0x2e')]=qs[_0x2c33('0x2e')](_0x1ac3a3[_0x2c33('0x3e')][_0x2c33('0x2e')]);_0x40168b[_0x2c33('0x2f')]=qs[_0x2c33('0x2f')](_0x1ac3a3[_0x2c33('0x3e')][_0x2c33('0x2f')]);}_0x40168b[_0x2c33('0x46')]=qs[_0x2c33('0x47')](_0x1ac3a3[_0x2c33('0x3e')][_0x2c33('0x47')]);_0x40168b[_0x2c33('0x48')]=qs[_0x2c33('0x40')](_[_0x2c33('0x49')](_0x1ac3a3[_0x2c33('0x3e')],_0x3a188d['filters']),_0x25cdfd);if(_0x1ac3a3[_0x2c33('0x3e')][_0x2c33('0x4a')]){_0x40168b[_0x2c33('0x48')]=_[_0x2c33('0x4b')](_0x40168b[_0x2c33('0x48')],{'$or':_[_0x2c33('0x3a')](_0x25cdfd,function(_0x296af7){if(_0x296af7[_0x2c33('0x3c')]!=='VIRTUAL'){var _0x439f7a={};_0x439f7a[_0x296af7[_0x2c33('0x38')]]={'$like':'%'+_0x1ac3a3[_0x2c33('0x3e')][_0x2c33('0x4a')]+'%'};return _0x439f7a;}})});}_0x40168b=_[_0x2c33('0x4b')]({},_0x40168b,_0x1ac3a3['options']);var _0x4a13b2={'where':_0x40168b['where']};return db['SugarcrmConfiguration']['count'](_0x4a13b2)[_0x2c33('0x21')](function(_0x2fbc64){_0x492908['count']=_0x2fbc64;if(_0x1ac3a3[_0x2c33('0x3e')][_0x2c33('0x4c')]){_0x40168b['include']=[{'all':!![]}];}return db[_0x2c33('0x3b')][_0x2c33('0x4d')](_0x40168b);})[_0x2c33('0x21')](function(_0xbad93){_0x492908[_0x2c33('0x4e')]=_0xbad93;return _0x492908;})['then'](respondWithFilteredResult(_0x28e1de,_0x40168b))[_0x2c33('0x29')](handleError(_0x28e1de,null));};exports[_0x2c33('0x4f')]=function(_0x20f461,_0x48da3a){var _0x214980={'raw':![],'where':{'id':_0x20f461['params']['id']}},_0x28bc69={};_0x28bc69[_0x2c33('0x3d')]=_[_0x2c33('0x3f')](db[_0x2c33('0x3b')][_0x2c33('0x50')]);_0x28bc69[_0x2c33('0x3e')]=_[_0x2c33('0x3f')](_0x20f461[_0x2c33('0x3e')]);_0x28bc69[_0x2c33('0x40')]=_[_0x2c33('0x41')](_0x28bc69[_0x2c33('0x3d')],_0x28bc69[_0x2c33('0x3e')]);_0x214980[_0x2c33('0x42')]=_[_0x2c33('0x41')](_0x28bc69['model'],qs[_0x2c33('0x43')](_0x20f461['query'][_0x2c33('0x43')]));_0x214980['attributes']=_0x214980[_0x2c33('0x42')][_0x2c33('0x51')]?_0x214980[_0x2c33('0x42')]:_0x28bc69[_0x2c33('0x3d')];if(_0x20f461['query'][_0x2c33('0x4c')]){_0x214980['include']=[{'all':!![]}];}_0x214980=_[_0x2c33('0x4b')]({},_0x214980,_0x20f461[_0x2c33('0x52')]);return db[_0x2c33('0x3b')][_0x2c33('0x53')](_0x214980)['then'](handleEntityNotFound(_0x48da3a,null))[_0x2c33('0x21')](respondWithResult(_0x48da3a,null))[_0x2c33('0x29')](handleError(_0x48da3a,null));};exports[_0x2c33('0x54')]=function(_0x523637,_0x13531e){return db['SugarcrmConfiguration'][_0x2c33('0x54')](_0x523637[_0x2c33('0x55')],{})['then'](respondWithResult(_0x13531e,0xc9))['catch'](handleError(_0x13531e,null));};exports['update']=function(_0x49e111,_0x1cdb40){if(_0x49e111['body']['id']){delete _0x49e111[_0x2c33('0x55')]['id'];}return db[_0x2c33('0x3b')][_0x2c33('0x53')]({'where':{'id':_0x49e111['params']['id']}})['then'](handleEntityNotFound(_0x1cdb40,null))[_0x2c33('0x21')](saveUpdates(_0x49e111[_0x2c33('0x55')],null))[_0x2c33('0x21')](respondWithResult(_0x1cdb40,null))[_0x2c33('0x29')](handleError(_0x1cdb40,null));};exports[_0x2c33('0x36')]=function(_0x28dd9b,_0x26be08){return db['SugarcrmConfiguration'][_0x2c33('0x53')]({'where':{'id':_0x28dd9b[_0x2c33('0x56')]['id']}})['then'](handleEntityNotFound(_0x26be08,null))[_0x2c33('0x21')](removeEntity(_0x26be08,null))['catch'](handleError(_0x26be08,null));};exports[_0x2c33('0x57')]=function(_0x30278c,_0x13cb7d,_0x3cb179){var _0x4330f4={};var _0x378c2e={};var _0x564c82;var _0x422a5d;return db[_0x2c33('0x3b')]['findOne']({'where':{'id':_0x30278c[_0x2c33('0x56')]['id']}})[_0x2c33('0x21')](handleEntityNotFound(_0x13cb7d,null))[_0x2c33('0x21')](function(_0x1fb4e7){if(_0x1fb4e7){_0x564c82=_0x1fb4e7;_0x378c2e['model']=_[_0x2c33('0x3f')](db[_0x2c33('0x58')][_0x2c33('0x50')]);_0x378c2e[_0x2c33('0x3e')]=_['keys'](_0x30278c[_0x2c33('0x3e')]);_0x378c2e[_0x2c33('0x40')]=_[_0x2c33('0x41')](_0x378c2e['model'],_0x378c2e[_0x2c33('0x3e')]);_0x4330f4[_0x2c33('0x42')]=_[_0x2c33('0x41')](_0x378c2e[_0x2c33('0x3d')],qs[_0x2c33('0x43')](_0x30278c[_0x2c33('0x3e')][_0x2c33('0x43')]));_0x4330f4[_0x2c33('0x42')]=_0x4330f4['attributes'][_0x2c33('0x51')]?_0x4330f4[_0x2c33('0x42')]:_0x378c2e[_0x2c33('0x3d')];_0x4330f4[_0x2c33('0x46')]=qs[_0x2c33('0x47')](_0x30278c[_0x2c33('0x3e')][_0x2c33('0x47')]);_0x4330f4['where']=qs[_0x2c33('0x40')](_[_0x2c33('0x49')](_0x30278c[_0x2c33('0x3e')],_0x378c2e['filters']));if(_0x30278c[_0x2c33('0x3e')]['filter']){_0x4330f4[_0x2c33('0x48')]=_[_0x2c33('0x4b')](_0x4330f4['where'],{'$or':_['map'](_0x4330f4[_0x2c33('0x42')],function(_0xce9558){var _0x6eb589={};_0x6eb589[_0xce9558]={'$like':'%'+_0x30278c['query'][_0x2c33('0x4a')]+'%'};return _0x6eb589;})});}_0x4330f4=_[_0x2c33('0x4b')]({},_0x4330f4,_0x30278c['options']);return _0x564c82['getFields'](_0x4330f4);}})['then'](function(_0x69d9da){if(_0x69d9da){_0x422a5d=_0x69d9da['length'];if(!_0x30278c[_0x2c33('0x3e')][_0x2c33('0x44')](_0x2c33('0x45'))){_0x4330f4[_0x2c33('0x2e')]=qs[_0x2c33('0x2e')](_0x30278c['query']['limit']);_0x4330f4[_0x2c33('0x2f')]=qs[_0x2c33('0x2f')](_0x30278c[_0x2c33('0x3e')][_0x2c33('0x2f')]);}return _0x564c82['getFields'](_0x4330f4);}})['then'](function(_0x3885d9){if(_0x3885d9){return _0x3885d9?{'count':_0x422a5d,'rows':_0x3885d9}:null;}})[_0x2c33('0x21')](respondWithResult(_0x13cb7d,null))['catch'](handleError(_0x13cb7d,null));};exports['getSubjects']=function(_0x1bb5e6,_0x17812e,_0x21fd16){var _0x10771d={};var _0x56b07a={};var _0x45e071;var _0x3a8f8e;return db['SugarcrmConfiguration'][_0x2c33('0x59')]({'where':{'id':_0x1bb5e6['params']['id']}})[_0x2c33('0x21')](handleEntityNotFound(_0x17812e,null))[_0x2c33('0x21')](function(_0x422309){if(_0x422309){_0x45e071=_0x422309;_0x56b07a['model']=_[_0x2c33('0x3f')](db[_0x2c33('0x58')][_0x2c33('0x50')]);_0x56b07a[_0x2c33('0x3e')]=_['keys'](_0x1bb5e6['query']);_0x56b07a['filters']=_[_0x2c33('0x41')](_0x56b07a[_0x2c33('0x3d')],_0x56b07a['query']);_0x10771d['attributes']=_[_0x2c33('0x41')](_0x56b07a[_0x2c33('0x3d')],qs[_0x2c33('0x43')](_0x1bb5e6['query'][_0x2c33('0x43')]));_0x10771d['attributes']=_0x10771d['attributes'][_0x2c33('0x51')]?_0x10771d['attributes']:_0x56b07a[_0x2c33('0x3d')];_0x10771d[_0x2c33('0x46')]=qs[_0x2c33('0x47')](_0x1bb5e6[_0x2c33('0x3e')]['sort']);_0x10771d[_0x2c33('0x48')]=qs[_0x2c33('0x40')](_[_0x2c33('0x49')](_0x1bb5e6[_0x2c33('0x3e')],_0x56b07a[_0x2c33('0x40')]));if(_0x1bb5e6[_0x2c33('0x3e')]['filter']){_0x10771d[_0x2c33('0x48')]=_['merge'](_0x10771d[_0x2c33('0x48')],{'$or':_['map'](_0x10771d['attributes'],function(_0x1953ea){var _0x3ac8d4={};_0x3ac8d4[_0x1953ea]={'$like':'%'+_0x1bb5e6['query'][_0x2c33('0x4a')]+'%'};return _0x3ac8d4;})});}_0x10771d=_[_0x2c33('0x4b')]({},_0x10771d,_0x1bb5e6[_0x2c33('0x52')]);return _0x45e071['getSubjects'](_0x10771d);}})[_0x2c33('0x21')](function(_0x3374f6){if(_0x3374f6){_0x3a8f8e=_0x3374f6[_0x2c33('0x51')];if(!_0x1bb5e6[_0x2c33('0x3e')][_0x2c33('0x44')]('nolimit')){_0x10771d[_0x2c33('0x2e')]=qs[_0x2c33('0x2e')](_0x1bb5e6[_0x2c33('0x3e')][_0x2c33('0x2e')]);_0x10771d[_0x2c33('0x2f')]=qs[_0x2c33('0x2f')](_0x1bb5e6[_0x2c33('0x3e')][_0x2c33('0x2f')]);}return _0x45e071['getSubjects'](_0x10771d);}})[_0x2c33('0x21')](function(_0x308b1e){if(_0x308b1e){return _0x308b1e?{'count':_0x3a8f8e,'rows':_0x308b1e}:null;}})[_0x2c33('0x21')](respondWithResult(_0x17812e,null))[_0x2c33('0x29')](handleError(_0x17812e,null));};exports['getDescriptions']=function(_0x3c8b65,_0x13eac9,_0x53ffdd){var _0x355985={};var _0x3514d0={};var _0x5cb6bf;var _0x2ed41d;return db[_0x2c33('0x3b')][_0x2c33('0x59')]({'where':{'id':_0x3c8b65['params']['id']}})[_0x2c33('0x21')](handleEntityNotFound(_0x13eac9,null))[_0x2c33('0x21')](function(_0x4ba6f8){if(_0x4ba6f8){_0x5cb6bf=_0x4ba6f8;_0x3514d0[_0x2c33('0x3d')]=_[_0x2c33('0x3f')](db[_0x2c33('0x58')][_0x2c33('0x50')]);_0x3514d0[_0x2c33('0x3e')]=_['keys'](_0x3c8b65[_0x2c33('0x3e')]);_0x3514d0['filters']=_[_0x2c33('0x41')](_0x3514d0[_0x2c33('0x3d')],_0x3514d0[_0x2c33('0x3e')]);_0x355985[_0x2c33('0x42')]=_[_0x2c33('0x41')](_0x3514d0[_0x2c33('0x3d')],qs['fields'](_0x3c8b65['query'][_0x2c33('0x43')]));_0x355985[_0x2c33('0x42')]=_0x355985[_0x2c33('0x42')][_0x2c33('0x51')]?_0x355985[_0x2c33('0x42')]:_0x3514d0[_0x2c33('0x3d')];_0x355985['order']=qs[_0x2c33('0x47')](_0x3c8b65[_0x2c33('0x3e')][_0x2c33('0x47')]);_0x355985[_0x2c33('0x48')]=qs['filters'](_['pick'](_0x3c8b65[_0x2c33('0x3e')],_0x3514d0['filters']));if(_0x3c8b65['query']['filter']){_0x355985[_0x2c33('0x48')]=_[_0x2c33('0x4b')](_0x355985['where'],{'$or':_[_0x2c33('0x3a')](_0x355985[_0x2c33('0x42')],function(_0x1e8628){var _0x29e87e={};_0x29e87e[_0x1e8628]={'$like':'%'+_0x3c8b65[_0x2c33('0x3e')]['filter']+'%'};return _0x29e87e;})});}_0x355985=_[_0x2c33('0x4b')]({},_0x355985,_0x3c8b65[_0x2c33('0x52')]);return _0x5cb6bf[_0x2c33('0x5a')](_0x355985);}})[_0x2c33('0x21')](function(_0x3da6fd){if(_0x3da6fd){_0x2ed41d=_0x3da6fd['length'];if(!_0x3c8b65['query'][_0x2c33('0x44')](_0x2c33('0x45'))){_0x355985[_0x2c33('0x2e')]=qs['limit'](_0x3c8b65[_0x2c33('0x3e')][_0x2c33('0x2e')]);_0x355985['offset']=qs[_0x2c33('0x2f')](_0x3c8b65[_0x2c33('0x3e')][_0x2c33('0x2f')]);}return _0x5cb6bf[_0x2c33('0x5a')](_0x355985);}})[_0x2c33('0x21')](function(_0x4da663){if(_0x4da663){return _0x4da663?{'count':_0x2ed41d,'rows':_0x4da663}:null;}})['then'](respondWithResult(_0x13eac9,null))[_0x2c33('0x29')](handleError(_0x13eac9,null));}; \ No newline at end of file +var _0x6ba8=['getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','destroy','stack','name','send','index','rawAttributes','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filters','pick','where','merge','map','VIRTUAL','filter','options','SugarcrmConfiguration','count','includeAll','include','findAll','rows','show','params','find','body','update','getFields','findOne','SugarcrmField','order','getSubjects'];(function(_0x2d2102,_0x499ed9){var _0x27bdc7=function(_0x132941){while(--_0x132941){_0x2d2102['push'](_0x2d2102['shift']());}};_0x27bdc7(++_0x499ed9);}(_0x6ba8,0x11e));var _0x86ba=function(_0x60ff1b,_0x520325){_0x60ff1b=_0x60ff1b-0x0;var _0x2e0c47=_0x6ba8[_0x60ff1b];return _0x2e0c47;};'use strict';var emlformat=require(_0x86ba('0x0'));var rimraf=require(_0x86ba('0x1'));var zipdir=require(_0x86ba('0x2'));var jsonpatch=require(_0x86ba('0x3'));var rp=require(_0x86ba('0x4'));var moment=require(_0x86ba('0x5'));var BPromise=require(_0x86ba('0x6'));var Mustache=require(_0x86ba('0x7'));var util=require(_0x86ba('0x8'));var path=require('path');var sox=require(_0x86ba('0x9'));var csv=require(_0x86ba('0xa'));var ejs=require(_0x86ba('0xb'));var fs=require('fs');var fs_extra=require(_0x86ba('0xc'));var _=require(_0x86ba('0xd'));var squel=require(_0x86ba('0xe'));var crypto=require(_0x86ba('0xf'));var jsforce=require(_0x86ba('0x10'));var deskjs=require(_0x86ba('0x11'));var toCsv=require(_0x86ba('0xa'));var querystring=require(_0x86ba('0x12'));var Papa=require(_0x86ba('0x13'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x86ba('0x14'));var as=require(_0x86ba('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x86ba('0x16'))(_0x86ba('0x17'));var utils=require(_0x86ba('0x18'));var config=require(_0x86ba('0x19'));var licenseUtil=require(_0x86ba('0x1a'));var db=require(_0x86ba('0x1b'))['db'];var jayson=require(_0x86ba('0x1c'));var client=jayson[_0x86ba('0x1d')][_0x86ba('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0xdd18c9,_0x47f9d7,_0x1f515d,_0x203f9d){return new BPromise(function(_0x255d8f,_0x4bfc5c){var _0x563d03=_0x203f9d||client;return _0x563d03[_0x86ba('0x1f')](_0xdd18c9,_0x1f515d)[_0x86ba('0x20')](function(_0x46dc83){logger[_0x86ba('0x21')](_0x86ba('0x22'),_0x47f9d7,_0x86ba('0x23'));logger[_0x86ba('0x24')]('SugarcrmConfiguration,\x20%s,\x20%s,\x20%s',_0x47f9d7,_0x86ba('0x23'),JSON['stringify'](_0x46dc83));if(_0x46dc83['error']){if(_0x46dc83[_0x86ba('0x25')][_0x86ba('0x26')]===0x1f4){logger[_0x86ba('0x25')](_0x86ba('0x22'),_0x47f9d7,_0x46dc83[_0x86ba('0x25')][_0x86ba('0x27')]);return _0x4bfc5c(_0x46dc83[_0x86ba('0x25')][_0x86ba('0x27')]);}logger[_0x86ba('0x25')](_0x86ba('0x22'),_0x47f9d7,_0x46dc83[_0x86ba('0x25')]['message']);return _0x255d8f(_0x46dc83[_0x86ba('0x25')][_0x86ba('0x27')]);}else{logger[_0x86ba('0x21')](_0x86ba('0x22'),_0x47f9d7,_0x86ba('0x23'));_0x255d8f(_0x46dc83[_0x86ba('0x28')][_0x86ba('0x27')]);}})[_0x86ba('0x29')](function(_0x578dae){logger[_0x86ba('0x25')](_0x86ba('0x22'),_0x47f9d7,_0x578dae);_0x4bfc5c(_0x578dae);});});}function respondWithStatusCode(_0x544627,_0x7d77bb){_0x7d77bb=_0x7d77bb||0xcc;return function(_0x50d724){if(_0x50d724){return _0x544627[_0x86ba('0x2a')](_0x7d77bb);}return _0x544627[_0x86ba('0x2b')](_0x7d77bb)[_0x86ba('0x2c')]();};}function respondWithResult(_0x1120ec,_0x1b8d4d){_0x1b8d4d=_0x1b8d4d||0xc8;return function(_0x209192){if(_0x209192){return _0x1120ec[_0x86ba('0x2b')](_0x1b8d4d)[_0x86ba('0x2d')](_0x209192);}};}function respondWithFilteredResult(_0x187177,_0x4d384d){return function(_0x2f67c4){if(_0x2f67c4){var _0xfbee94=typeof _0x4d384d[_0x86ba('0x2e')]==='undefined'&&typeof _0x4d384d['limit']==='undefined';var _0x5bbbe0=_0x2f67c4['count'];var _0x48e3f9=_0xfbee94?0x0:_0x4d384d['offset'];var _0x38092=_0xfbee94?_0x2f67c4['count']:_0x4d384d[_0x86ba('0x2e')]+_0x4d384d[_0x86ba('0x2f')];var _0x3d638e;if(_0x38092>=_0x5bbbe0){_0x38092=_0x5bbbe0;_0x3d638e=0xc8;}else{_0x3d638e=0xce;}_0x187177['status'](_0x3d638e);return _0x187177[_0x86ba('0x30')](_0x86ba('0x31'),_0x48e3f9+'-'+_0x38092+'/'+_0x5bbbe0)['json'](_0x2f67c4);}return null;};}function patchUpdates(_0x4fffce){return function(_0x5ab794){try{jsonpatch[_0x86ba('0x32')](_0x5ab794,_0x4fffce,!![]);}catch(_0x34c418){return BPromise[_0x86ba('0x33')](_0x34c418);}return _0x5ab794[_0x86ba('0x34')]();};}function saveUpdates(_0x47cec6,_0x212a55){return function(_0x2fe143){if(_0x2fe143){return _0x2fe143['update'](_0x47cec6)[_0x86ba('0x20')](function(_0x5e51ae){return _0x5e51ae;});}return null;};}function removeEntity(_0x4bcbe5,_0x162d7a){return function(_0xd0916e){if(_0xd0916e){return _0xd0916e[_0x86ba('0x35')]()[_0x86ba('0x20')](function(){_0x4bcbe5[_0x86ba('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x86b3fe,_0x407e2e){return function(_0xa19695){if(!_0xa19695){_0x86b3fe[_0x86ba('0x2a')](0x194);}return _0xa19695;};}function handleError(_0x4038ca,_0x2f3d44){_0x2f3d44=_0x2f3d44||0x1f4;return function(_0x28a9b0){logger[_0x86ba('0x25')](_0x28a9b0[_0x86ba('0x36')]);if(_0x28a9b0[_0x86ba('0x37')]){delete _0x28a9b0['name'];}_0x4038ca[_0x86ba('0x2b')](_0x2f3d44)[_0x86ba('0x38')](_0x28a9b0);};}exports[_0x86ba('0x39')]=function(_0x117b9e,_0x506ac7){var _0x13c2b4={},_0xd03b1={},_0x313d8e={'count':0x0,'rows':[]};var _0x3e2030=_['map'](db['SugarcrmConfiguration'][_0x86ba('0x3a')],function(_0x56da49){return{'name':_0x56da49['fieldName'],'type':_0x56da49[_0x86ba('0x3b')]['key']};});_0xd03b1[_0x86ba('0x3c')]=_['map'](_0x3e2030,_0x86ba('0x37'));_0xd03b1[_0x86ba('0x3d')]=_[_0x86ba('0x3e')](_0x117b9e[_0x86ba('0x3d')]);_0xd03b1['filters']=_[_0x86ba('0x3f')](_0xd03b1[_0x86ba('0x3c')],_0xd03b1['query']);_0x13c2b4[_0x86ba('0x40')]=_[_0x86ba('0x3f')](_0xd03b1[_0x86ba('0x3c')],qs['fields'](_0x117b9e[_0x86ba('0x3d')][_0x86ba('0x41')]));_0x13c2b4[_0x86ba('0x40')]=_0x13c2b4[_0x86ba('0x40')][_0x86ba('0x42')]?_0x13c2b4[_0x86ba('0x40')]:_0xd03b1['model'];if(!_0x117b9e[_0x86ba('0x3d')][_0x86ba('0x43')](_0x86ba('0x44'))){_0x13c2b4[_0x86ba('0x2f')]=qs[_0x86ba('0x2f')](_0x117b9e[_0x86ba('0x3d')][_0x86ba('0x2f')]);_0x13c2b4['offset']=qs[_0x86ba('0x2e')](_0x117b9e[_0x86ba('0x3d')][_0x86ba('0x2e')]);}_0x13c2b4['order']=qs[_0x86ba('0x45')](_0x117b9e[_0x86ba('0x3d')][_0x86ba('0x45')]);_0x13c2b4['where']=qs[_0x86ba('0x46')](_[_0x86ba('0x47')](_0x117b9e[_0x86ba('0x3d')],_0xd03b1[_0x86ba('0x46')]),_0x3e2030);if(_0x117b9e['query']['filter']){_0x13c2b4[_0x86ba('0x48')]=_[_0x86ba('0x49')](_0x13c2b4[_0x86ba('0x48')],{'$or':_[_0x86ba('0x4a')](_0x3e2030,function(_0x3fd6ab){if(_0x3fd6ab[_0x86ba('0x3b')]!==_0x86ba('0x4b')){var _0x2a691e={};_0x2a691e[_0x3fd6ab['name']]={'$like':'%'+_0x117b9e[_0x86ba('0x3d')][_0x86ba('0x4c')]+'%'};return _0x2a691e;}})});}_0x13c2b4=_[_0x86ba('0x49')]({},_0x13c2b4,_0x117b9e[_0x86ba('0x4d')]);var _0x5ac5a6={'where':_0x13c2b4['where']};return db[_0x86ba('0x4e')][_0x86ba('0x4f')](_0x5ac5a6)['then'](function(_0x989f67){_0x313d8e[_0x86ba('0x4f')]=_0x989f67;if(_0x117b9e[_0x86ba('0x3d')][_0x86ba('0x50')]){_0x13c2b4[_0x86ba('0x51')]=[{'all':!![]}];}return db[_0x86ba('0x4e')][_0x86ba('0x52')](_0x13c2b4);})[_0x86ba('0x20')](function(_0xbd9dfa){_0x313d8e[_0x86ba('0x53')]=_0xbd9dfa;return _0x313d8e;})['then'](respondWithFilteredResult(_0x506ac7,_0x13c2b4))[_0x86ba('0x29')](handleError(_0x506ac7,null));};exports[_0x86ba('0x54')]=function(_0x9a0c2e,_0x1be99d){var _0x5ebc5e={'raw':![],'where':{'id':_0x9a0c2e[_0x86ba('0x55')]['id']}},_0xf1781c={};_0xf1781c[_0x86ba('0x3c')]=_[_0x86ba('0x3e')](db[_0x86ba('0x4e')][_0x86ba('0x3a')]);_0xf1781c[_0x86ba('0x3d')]=_['keys'](_0x9a0c2e[_0x86ba('0x3d')]);_0xf1781c[_0x86ba('0x46')]=_[_0x86ba('0x3f')](_0xf1781c['model'],_0xf1781c[_0x86ba('0x3d')]);_0x5ebc5e[_0x86ba('0x40')]=_[_0x86ba('0x3f')](_0xf1781c[_0x86ba('0x3c')],qs[_0x86ba('0x41')](_0x9a0c2e[_0x86ba('0x3d')][_0x86ba('0x41')]));_0x5ebc5e['attributes']=_0x5ebc5e[_0x86ba('0x40')][_0x86ba('0x42')]?_0x5ebc5e[_0x86ba('0x40')]:_0xf1781c['model'];if(_0x9a0c2e[_0x86ba('0x3d')][_0x86ba('0x50')]){_0x5ebc5e[_0x86ba('0x51')]=[{'all':!![]}];}_0x5ebc5e=_[_0x86ba('0x49')]({},_0x5ebc5e,_0x9a0c2e['options']);return db['SugarcrmConfiguration'][_0x86ba('0x56')](_0x5ebc5e)[_0x86ba('0x20')](handleEntityNotFound(_0x1be99d,null))[_0x86ba('0x20')](respondWithResult(_0x1be99d,null))['catch'](handleError(_0x1be99d,null));};exports['create']=function(_0x3a9852,_0x2b9554){return db[_0x86ba('0x4e')]['create'](_0x3a9852[_0x86ba('0x57')],{})[_0x86ba('0x20')](respondWithResult(_0x2b9554,0xc9))[_0x86ba('0x29')](handleError(_0x2b9554,null));};exports[_0x86ba('0x58')]=function(_0x4bf06f,_0x3810cc){if(_0x4bf06f[_0x86ba('0x57')]['id']){delete _0x4bf06f['body']['id'];}return db[_0x86ba('0x4e')][_0x86ba('0x56')]({'where':{'id':_0x4bf06f['params']['id']}})[_0x86ba('0x20')](handleEntityNotFound(_0x3810cc,null))[_0x86ba('0x20')](saveUpdates(_0x4bf06f['body'],null))[_0x86ba('0x20')](respondWithResult(_0x3810cc,null))['catch'](handleError(_0x3810cc,null));};exports[_0x86ba('0x35')]=function(_0x445cf8,_0xc27e03){return db['SugarcrmConfiguration'][_0x86ba('0x56')]({'where':{'id':_0x445cf8[_0x86ba('0x55')]['id']}})[_0x86ba('0x20')](handleEntityNotFound(_0xc27e03,null))[_0x86ba('0x20')](removeEntity(_0xc27e03,null))['catch'](handleError(_0xc27e03,null));};exports[_0x86ba('0x59')]=function(_0x157e57,_0x54870e,_0x2ff68a){var _0x4d4540={};var _0x2245f9={};var _0x102b92;var _0x378976;return db['SugarcrmConfiguration'][_0x86ba('0x5a')]({'where':{'id':_0x157e57['params']['id']}})[_0x86ba('0x20')](handleEntityNotFound(_0x54870e,null))['then'](function(_0x1e6f51){if(_0x1e6f51){_0x102b92=_0x1e6f51;_0x2245f9[_0x86ba('0x3c')]=_[_0x86ba('0x3e')](db[_0x86ba('0x5b')][_0x86ba('0x3a')]);_0x2245f9[_0x86ba('0x3d')]=_[_0x86ba('0x3e')](_0x157e57[_0x86ba('0x3d')]);_0x2245f9['filters']=_[_0x86ba('0x3f')](_0x2245f9[_0x86ba('0x3c')],_0x2245f9[_0x86ba('0x3d')]);_0x4d4540[_0x86ba('0x40')]=_[_0x86ba('0x3f')](_0x2245f9[_0x86ba('0x3c')],qs['fields'](_0x157e57[_0x86ba('0x3d')][_0x86ba('0x41')]));_0x4d4540[_0x86ba('0x40')]=_0x4d4540[_0x86ba('0x40')][_0x86ba('0x42')]?_0x4d4540[_0x86ba('0x40')]:_0x2245f9['model'];_0x4d4540[_0x86ba('0x5c')]=qs['sort'](_0x157e57[_0x86ba('0x3d')][_0x86ba('0x45')]);_0x4d4540[_0x86ba('0x48')]=qs[_0x86ba('0x46')](_[_0x86ba('0x47')](_0x157e57[_0x86ba('0x3d')],_0x2245f9['filters']));if(_0x157e57['query'][_0x86ba('0x4c')]){_0x4d4540[_0x86ba('0x48')]=_['merge'](_0x4d4540[_0x86ba('0x48')],{'$or':_[_0x86ba('0x4a')](_0x4d4540[_0x86ba('0x40')],function(_0x3f1b6d){var _0x3486fd={};_0x3486fd[_0x3f1b6d]={'$like':'%'+_0x157e57['query'][_0x86ba('0x4c')]+'%'};return _0x3486fd;})});}_0x4d4540=_[_0x86ba('0x49')]({},_0x4d4540,_0x157e57[_0x86ba('0x4d')]);return _0x102b92[_0x86ba('0x59')](_0x4d4540);}})[_0x86ba('0x20')](function(_0x562acc){if(_0x562acc){_0x378976=_0x562acc[_0x86ba('0x42')];if(!_0x157e57[_0x86ba('0x3d')][_0x86ba('0x43')](_0x86ba('0x44'))){_0x4d4540[_0x86ba('0x2f')]=qs[_0x86ba('0x2f')](_0x157e57[_0x86ba('0x3d')][_0x86ba('0x2f')]);_0x4d4540[_0x86ba('0x2e')]=qs['offset'](_0x157e57[_0x86ba('0x3d')][_0x86ba('0x2e')]);}return _0x102b92[_0x86ba('0x59')](_0x4d4540);}})[_0x86ba('0x20')](function(_0x315d39){if(_0x315d39){return _0x315d39?{'count':_0x378976,'rows':_0x315d39}:null;}})[_0x86ba('0x20')](respondWithResult(_0x54870e,null))[_0x86ba('0x29')](handleError(_0x54870e,null));};exports[_0x86ba('0x5d')]=function(_0x4935b1,_0x5069d0,_0x43e4c7){var _0x2c33db={};var _0x59a3d0={};var _0x28e1a6;var _0x2f2587;return db[_0x86ba('0x4e')][_0x86ba('0x5a')]({'where':{'id':_0x4935b1['params']['id']}})[_0x86ba('0x20')](handleEntityNotFound(_0x5069d0,null))[_0x86ba('0x20')](function(_0x3e04bf){if(_0x3e04bf){_0x28e1a6=_0x3e04bf;_0x59a3d0[_0x86ba('0x3c')]=_['keys'](db['SugarcrmField'][_0x86ba('0x3a')]);_0x59a3d0[_0x86ba('0x3d')]=_[_0x86ba('0x3e')](_0x4935b1['query']);_0x59a3d0[_0x86ba('0x46')]=_[_0x86ba('0x3f')](_0x59a3d0[_0x86ba('0x3c')],_0x59a3d0[_0x86ba('0x3d')]);_0x2c33db['attributes']=_['intersection'](_0x59a3d0[_0x86ba('0x3c')],qs[_0x86ba('0x41')](_0x4935b1[_0x86ba('0x3d')][_0x86ba('0x41')]));_0x2c33db[_0x86ba('0x40')]=_0x2c33db['attributes'][_0x86ba('0x42')]?_0x2c33db[_0x86ba('0x40')]:_0x59a3d0[_0x86ba('0x3c')];_0x2c33db[_0x86ba('0x5c')]=qs[_0x86ba('0x45')](_0x4935b1['query'][_0x86ba('0x45')]);_0x2c33db[_0x86ba('0x48')]=qs[_0x86ba('0x46')](_[_0x86ba('0x47')](_0x4935b1[_0x86ba('0x3d')],_0x59a3d0['filters']));if(_0x4935b1[_0x86ba('0x3d')][_0x86ba('0x4c')]){_0x2c33db['where']=_['merge'](_0x2c33db[_0x86ba('0x48')],{'$or':_['map'](_0x2c33db[_0x86ba('0x40')],function(_0x246390){var _0x50ae43={};_0x50ae43[_0x246390]={'$like':'%'+_0x4935b1['query'][_0x86ba('0x4c')]+'%'};return _0x50ae43;})});}_0x2c33db=_['merge']({},_0x2c33db,_0x4935b1[_0x86ba('0x4d')]);return _0x28e1a6['getSubjects'](_0x2c33db);}})[_0x86ba('0x20')](function(_0x3da81c){if(_0x3da81c){_0x2f2587=_0x3da81c[_0x86ba('0x42')];if(!_0x4935b1[_0x86ba('0x3d')][_0x86ba('0x43')](_0x86ba('0x44'))){_0x2c33db[_0x86ba('0x2f')]=qs['limit'](_0x4935b1['query'][_0x86ba('0x2f')]);_0x2c33db[_0x86ba('0x2e')]=qs[_0x86ba('0x2e')](_0x4935b1[_0x86ba('0x3d')][_0x86ba('0x2e')]);}return _0x28e1a6[_0x86ba('0x5d')](_0x2c33db);}})[_0x86ba('0x20')](function(_0x254c0a){if(_0x254c0a){return _0x254c0a?{'count':_0x2f2587,'rows':_0x254c0a}:null;}})[_0x86ba('0x20')](respondWithResult(_0x5069d0,null))[_0x86ba('0x29')](handleError(_0x5069d0,null));};exports[_0x86ba('0x5e')]=function(_0xa8a8df,_0x4b0400,_0x2bc14b){var _0x572281={};var _0x174ca6={};var _0x4eea0c;var _0x414930;return db[_0x86ba('0x4e')][_0x86ba('0x5a')]({'where':{'id':_0xa8a8df[_0x86ba('0x55')]['id']}})[_0x86ba('0x20')](handleEntityNotFound(_0x4b0400,null))[_0x86ba('0x20')](function(_0x50f06e){if(_0x50f06e){_0x4eea0c=_0x50f06e;_0x174ca6[_0x86ba('0x3c')]=_['keys'](db[_0x86ba('0x5b')][_0x86ba('0x3a')]);_0x174ca6['query']=_[_0x86ba('0x3e')](_0xa8a8df[_0x86ba('0x3d')]);_0x174ca6[_0x86ba('0x46')]=_[_0x86ba('0x3f')](_0x174ca6[_0x86ba('0x3c')],_0x174ca6[_0x86ba('0x3d')]);_0x572281[_0x86ba('0x40')]=_[_0x86ba('0x3f')](_0x174ca6[_0x86ba('0x3c')],qs[_0x86ba('0x41')](_0xa8a8df[_0x86ba('0x3d')][_0x86ba('0x41')]));_0x572281[_0x86ba('0x40')]=_0x572281[_0x86ba('0x40')][_0x86ba('0x42')]?_0x572281[_0x86ba('0x40')]:_0x174ca6[_0x86ba('0x3c')];_0x572281[_0x86ba('0x5c')]=qs[_0x86ba('0x45')](_0xa8a8df[_0x86ba('0x3d')][_0x86ba('0x45')]);_0x572281[_0x86ba('0x48')]=qs[_0x86ba('0x46')](_['pick'](_0xa8a8df['query'],_0x174ca6[_0x86ba('0x46')]));if(_0xa8a8df[_0x86ba('0x3d')][_0x86ba('0x4c')]){_0x572281['where']=_[_0x86ba('0x49')](_0x572281[_0x86ba('0x48')],{'$or':_[_0x86ba('0x4a')](_0x572281[_0x86ba('0x40')],function(_0x2ea52d){var _0x4c6a3c={};_0x4c6a3c[_0x2ea52d]={'$like':'%'+_0xa8a8df['query']['filter']+'%'};return _0x4c6a3c;})});}_0x572281=_['merge']({},_0x572281,_0xa8a8df[_0x86ba('0x4d')]);return _0x4eea0c[_0x86ba('0x5e')](_0x572281);}})[_0x86ba('0x20')](function(_0x26082b){if(_0x26082b){_0x414930=_0x26082b[_0x86ba('0x42')];if(!_0xa8a8df[_0x86ba('0x3d')]['hasOwnProperty'](_0x86ba('0x44'))){_0x572281['limit']=qs['limit'](_0xa8a8df[_0x86ba('0x3d')][_0x86ba('0x2f')]);_0x572281[_0x86ba('0x2e')]=qs[_0x86ba('0x2e')](_0xa8a8df[_0x86ba('0x3d')][_0x86ba('0x2e')]);}return _0x4eea0c[_0x86ba('0x5e')](_0x572281);}})['then'](function(_0x45ddd0){if(_0x45ddd0){return _0x45ddd0?{'count':_0x414930,'rows':_0x45ddd0}:null;}})[_0x86ba('0x20')](respondWithResult(_0x4b0400,null))[_0x86ba('0x29')](handleError(_0x4b0400,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index c595b46..566671e 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 _0x33ce=['moment','bluebird','../../config/environment','./intSugarcrmConfiguration.attributes','define','SugarcrmConfiguration','int_sugarcrm_configurations','util','../../config/logger'];(function(_0x56bd76,_0x2ecfbf){var _0x511a71=function(_0x1ecc0f){while(--_0x1ecc0f){_0x56bd76['push'](_0x56bd76['shift']());}};_0x511a71(++_0x2ecfbf);}(_0x33ce,0x139));var _0xe33c=function(_0x5591b4,_0x3b891b){_0x5591b4=_0x5591b4-0x0;var _0x4e6e82=_0x33ce[_0x5591b4];return _0x4e6e82;};'use strict';var _=require('lodash');var util=require(_0xe33c('0x0'));var logger=require(_0xe33c('0x1'))('api');var moment=require(_0xe33c('0x2'));var BPromise=require(_0xe33c('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xe33c('0x4'));var attributes=require(_0xe33c('0x5'));module['exports']=function(_0x88182f,_0x15c441){return _0x88182f[_0xe33c('0x6')](_0xe33c('0x7'),attributes,{'tableName':_0xe33c('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xea02=['exports','define','int_sugarcrm_configurations','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xea02,0x87));var _0x2ea0=function(_0x44a26c,_0x24b457){_0x44a26c=_0x44a26c-0x0;var _0x3d0dd5=_0xea02[_0x44a26c];return _0x3d0dd5;};'use strict';var _=require(_0x2ea0('0x0'));var util=require('util');var logger=require(_0x2ea0('0x1'))(_0x2ea0('0x2'));var moment=require('moment');var BPromise=require(_0x2ea0('0x3'));var rp=require(_0x2ea0('0x4'));var fs=require('fs');var path=require(_0x2ea0('0x5'));var rimraf=require(_0x2ea0('0x6'));var config=require(_0x2ea0('0x7'));var attributes=require('./intSugarcrmConfiguration.attributes');module[_0x2ea0('0x8')]=function(_0x287c87,_0x588b5b){return _0x287c87[_0x2ea0('0x9')]('SugarcrmConfiguration',attributes,{'tableName':_0x2ea0('0xa'),'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 605d08d..c2f6b00 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 _0x4379=['message','catch','lodash','util','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','debug','request\x20sent','error','SugarcrmConfiguration,\x20%s,\x20%s'];(function(_0x2f6816,_0x3b76fe){var _0x275636=function(_0x421038){while(--_0x421038){_0x2f6816['push'](_0x2f6816['shift']());}};_0x275636(++_0x3b76fe);}(_0x4379,0xd3));var _0x9437=function(_0x45d6af,_0x50a63f){_0x45d6af=_0x45d6af-0x0;var _0x107bdc=_0x4379[_0x45d6af];return _0x107bdc;};'use strict';var _=require(_0x9437('0x0'));var util=require(_0x9437('0x1'));var moment=require('moment');var BPromise=require(_0x9437('0x2'));var rs=require(_0x9437('0x3'));var fs=require('fs');var Redis=require(_0x9437('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x9437('0x5'))(_0x9437('0x6'));var config=require(_0x9437('0x7'));var jayson=require(_0x9437('0x8'));var client=jayson[_0x9437('0x9')][_0x9437('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2f5e4c,_0x5ac6a1,_0x294aec){return new BPromise(function(_0x4e1d79,_0x5a647b){return client[_0x9437('0xb')](_0x2f5e4c,_0x294aec)['then'](function(_0x441be3){logger[_0x9437('0xc')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x5ac6a1,'request\x20sent');logger[_0x9437('0xd')]('SugarcrmConfiguration,\x20%s,\x20%s,\x20%s',_0x5ac6a1,_0x9437('0xe'),JSON['stringify'](_0x441be3));if(_0x441be3[_0x9437('0xf')]){if(_0x441be3[_0x9437('0xf')]['code']===0x1f4){logger[_0x9437('0xf')](_0x9437('0x10'),_0x5ac6a1,_0x441be3['error'][_0x9437('0x11')]);return _0x5a647b(_0x441be3['error']['message']);}logger[_0x9437('0xf')](_0x9437('0x10'),_0x5ac6a1,_0x441be3[_0x9437('0xf')]['message']);return _0x4e1d79(_0x441be3[_0x9437('0xf')]['message']);}else{logger[_0x9437('0xc')](_0x9437('0x10'),_0x5ac6a1,_0x9437('0xe'));_0x4e1d79(_0x441be3['result'][_0x9437('0x11')]);}})[_0x9437('0x12')](function(_0x5f4a22){logger[_0x9437('0xf')](_0x9437('0x10'),_0x5ac6a1,_0x5f4a22);_0x5a647b(_0x5f4a22);});});} \ No newline at end of file +var _0x40e7=['stringify','code','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','http','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0xace330,_0x1eac84){var _0x5c7e5e=function(_0x4a9391){while(--_0x4a9391){_0xace330['push'](_0xace330['shift']());}};_0x5c7e5e(++_0x1eac84);}(_0x40e7,0x1e9));var _0x740e=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x40e7[_0x6131cd];return _0x47e916;};'use strict';var _=require(_0x740e('0x0'));var util=require(_0x740e('0x1'));var moment=require(_0x740e('0x2'));var BPromise=require(_0x740e('0x3'));var rs=require(_0x740e('0x4'));var fs=require('fs');var Redis=require(_0x740e('0x5'));var db=require(_0x740e('0x6'))['db'];var utils=require(_0x740e('0x7'));var logger=require('../../config/logger')(_0x740e('0x8'));var config=require('../../config/environment');var jayson=require(_0x740e('0x9'));var client=jayson['client'][_0x740e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x26b04d,_0xa9af1b,_0x4b448a){return new BPromise(function(_0x223075,_0x2b4fd6){return client[_0x740e('0xb')](_0x26b04d,_0x4b448a)[_0x740e('0xc')](function(_0x56cfd2){logger[_0x740e('0xd')](_0x740e('0xe'),_0xa9af1b,'request\x20sent');logger[_0x740e('0xf')](_0x740e('0x10'),_0xa9af1b,'request\x20sent',JSON[_0x740e('0x11')](_0x56cfd2));if(_0x56cfd2['error']){if(_0x56cfd2['error'][_0x740e('0x12')]===0x1f4){logger[_0x740e('0x13')](_0x740e('0xe'),_0xa9af1b,_0x56cfd2[_0x740e('0x13')][_0x740e('0x14')]);return _0x2b4fd6(_0x56cfd2['error'][_0x740e('0x14')]);}logger[_0x740e('0x13')](_0x740e('0xe'),_0xa9af1b,_0x56cfd2[_0x740e('0x13')][_0x740e('0x14')]);return _0x223075(_0x56cfd2[_0x740e('0x13')][_0x740e('0x14')]);}else{logger[_0x740e('0xd')](_0x740e('0xe'),_0xa9af1b,'request\x20sent');_0x223075(_0x56cfd2[_0x740e('0x15')]['message']);}})[_0x740e('0x16')](function(_0x587c3a){logger[_0x740e('0x13')](_0x740e('0xe'),_0xa9af1b,_0x587c3a);_0x2b4fd6(_0x587c3a);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index c7d68f5..3e554a4 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 _0x3f60=['destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmField.controller','get','isAuthenticated','index','/:id','show','put','delete'];(function(_0x431da5,_0x52decd){var _0x268ccc=function(_0xafc420){while(--_0xafc420){_0x431da5['push'](_0x431da5['shift']());}};_0x268ccc(++_0x52decd);}(_0x3f60,0x158));var _0x03f6=function(_0x26b80e,_0x5c9333){_0x26b80e=_0x26b80e-0x0;var _0x84a8a8=_0x3f60[_0x26b80e];return _0x84a8a8;};'use strict';var multer=require('multer');var util=require(_0x03f6('0x0'));var path=require(_0x03f6('0x1'));var timeout=require(_0x03f6('0x2'));var express=require(_0x03f6('0x3'));var router=express[_0x03f6('0x4')]();var fs_extra=require(_0x03f6('0x5'));var auth=require(_0x03f6('0x6'));var interaction=require(_0x03f6('0x7'));var config=require(_0x03f6('0x8'));var controller=require(_0x03f6('0x9'));router[_0x03f6('0xa')]('/',auth[_0x03f6('0xb')](),controller[_0x03f6('0xc')]);router['get'](_0x03f6('0xd'),auth[_0x03f6('0xb')](),controller[_0x03f6('0xe')]);router['post']('/',auth[_0x03f6('0xb')](),controller['create']);router[_0x03f6('0xf')](_0x03f6('0xd'),auth[_0x03f6('0xb')](),controller['update']);router[_0x03f6('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x03f6('0x11')]);module[_0x03f6('0x12')]=router; \ No newline at end of file +var _0xc3ea=['util','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','./intSugarcrmField.controller','get','isAuthenticated','/:id','show','post','create','put','update','delete','exports'];(function(_0x4a5d6e,_0x3b3934){var _0x3facc4=function(_0x51b54a){while(--_0x51b54a){_0x4a5d6e['push'](_0x4a5d6e['shift']());}};_0x3facc4(++_0x3b3934);}(_0xc3ea,0x1b0));var _0xac3e=function(_0xcaf223,_0xd39f07){_0xcaf223=_0xcaf223-0x0;var _0x17e00d=_0xc3ea[_0xcaf223];return _0x17e00d;};'use strict';var multer=require('multer');var util=require(_0xac3e('0x0'));var path=require('path');var timeout=require(_0xac3e('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xac3e('0x2'));var auth=require(_0xac3e('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xac3e('0x4'));var controller=require(_0xac3e('0x5'));router[_0xac3e('0x6')]('/',auth[_0xac3e('0x7')](),controller['index']);router[_0xac3e('0x6')](_0xac3e('0x8'),auth[_0xac3e('0x7')](),controller[_0xac3e('0x9')]);router[_0xac3e('0xa')]('/',auth[_0xac3e('0x7')](),controller[_0xac3e('0xb')]);router[_0xac3e('0xc')](_0xac3e('0x8'),auth[_0xac3e('0x7')](),controller[_0xac3e('0xd')]);router[_0xac3e('0xe')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xac3e('0xf')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index 7ef7f62..3662078 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 _0xe321=['STRING','BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable','keyValue','picklist'];(function(_0x83b0d8,_0x3c9ade){var _0x4ae716=function(_0x1e2541){while(--_0x1e2541){_0x83b0d8['push'](_0x83b0d8['shift']());}};_0x4ae716(++_0x3c9ade);}(_0xe321,0x70));var _0x1e32=function(_0xdefbc3,_0x1ea49a){_0xdefbc3=_0xdefbc3-0x0;var _0x367798=_0xe321[_0xdefbc3];return _0x367798;};'use strict';var Sequelize=require(_0x1e32('0x0'));module[_0x1e32('0x1')]={'type':{'type':Sequelize[_0x1e32('0x2')](_0x1e32('0x3'),_0x1e32('0x4'),_0x1e32('0x5'),_0x1e32('0x6'),_0x1e32('0x7')),'defaultValue':_0x1e32('0x3')},'content':{'type':Sequelize[_0x1e32('0x8')]},'key':{'type':Sequelize[_0x1e32('0x8')]},'keyType':{'type':Sequelize['ENUM'](_0x1e32('0x3'),_0x1e32('0x4'),_0x1e32('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x1e32('0x8')]},'nameField':{'type':Sequelize[_0x1e32('0x8')]},'customField':{'type':Sequelize[_0x1e32('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x1e32('0x8')]}}; \ No newline at end of file +var _0x7731=['ENUM','string','customVariable','picklist','variable','STRING','sequelize','exports'];(function(_0x4de6fe,_0x13b03b){var _0x40812c=function(_0x34adb9){while(--_0x34adb9){_0x4de6fe['push'](_0x4de6fe['shift']());}};_0x40812c(++_0x13b03b);}(_0x7731,0x14e));var _0x1773=function(_0x4d2aa2,_0x5578b2){_0x4d2aa2=_0x4d2aa2-0x0;var _0x4d5f31=_0x7731[_0x4d2aa2];return _0x4d5f31;};'use strict';var Sequelize=require(_0x1773('0x0'));module[_0x1773('0x1')]={'type':{'type':Sequelize[_0x1773('0x2')](_0x1773('0x3'),'variable',_0x1773('0x4'),'keyValue',_0x1773('0x5')),'defaultValue':_0x1773('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM']('string',_0x1773('0x6'),'customVariable')},'keyContent':{'type':Sequelize[_0x1773('0x7')]},'idField':{'type':Sequelize[_0x1773('0x7')]},'nameField':{'type':Sequelize[_0x1773('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x1773('0x7')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index 94c4886..7bafeab 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 _0xeca7=['type','VIRTUAL','includeAll','include','findAll','rows','show','params','options','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','to-csv','fs-extra','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','end','json','offset','undefined','limit','count','reject','save','destroy','then','stack','name','send','index','SugarcrmField','rawAttributes','fieldName','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge'];(function(_0x4b1f9c,_0x422fc9){var _0x3e0632=function(_0x480a6f){while(--_0x480a6f){_0x4b1f9c['push'](_0x4b1f9c['shift']());}};_0x3e0632(++_0x422fc9);}(_0xeca7,0x1f0));var _0x7eca=function(_0x58e8eb,_0x2ac0c7){_0x58e8eb=_0x58e8eb-0x0;var _0x168540=_0xeca7[_0x58e8eb];return _0x168540;};'use strict';var emlformat=require(_0x7eca('0x0'));var rimraf=require(_0x7eca('0x1'));var zipdir=require(_0x7eca('0x2'));var jsonpatch=require(_0x7eca('0x3'));var rp=require(_0x7eca('0x4'));var moment=require('moment');var BPromise=require(_0x7eca('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x7eca('0x6'));var sox=require(_0x7eca('0x7'));var csv=require(_0x7eca('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7eca('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x7eca('0xa'));var jsforce=require(_0x7eca('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x7eca('0x8'));var querystring=require(_0x7eca('0xc'));var Papa=require('papaparse');var Redis=require(_0x7eca('0xd'));var authService=require(_0x7eca('0xe'));var qs=require(_0x7eca('0xf'));var as=require(_0x7eca('0x10'));var hardwareService=require(_0x7eca('0x11'));var logger=require('../../config/logger')(_0x7eca('0x12'));var utils=require('../../config/utils');var config=require(_0x7eca('0x13'));var licenseUtil=require(_0x7eca('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3ff9ce,_0x5a2ce4){_0x5a2ce4=_0x5a2ce4||0xcc;return function(_0x4ba6c7){if(_0x4ba6c7){return _0x3ff9ce['sendStatus'](_0x5a2ce4);}return _0x3ff9ce['status'](_0x5a2ce4)[_0x7eca('0x15')]();};}function respondWithResult(_0x2328ab,_0x17fe1f){_0x17fe1f=_0x17fe1f||0xc8;return function(_0x18ce60){if(_0x18ce60){return _0x2328ab['status'](_0x17fe1f)[_0x7eca('0x16')](_0x18ce60);}};}function respondWithFilteredResult(_0x383f1f,_0xfbfa39){return function(_0x484ad7){if(_0x484ad7){var _0x1f4cc6=typeof _0xfbfa39[_0x7eca('0x17')]===_0x7eca('0x18')&&typeof _0xfbfa39[_0x7eca('0x19')]===_0x7eca('0x18');var _0x137c18=_0x484ad7[_0x7eca('0x1a')];var _0x158ed2=_0x1f4cc6?0x0:_0xfbfa39[_0x7eca('0x17')];var _0xd55411=_0x1f4cc6?_0x484ad7[_0x7eca('0x1a')]:_0xfbfa39[_0x7eca('0x17')]+_0xfbfa39[_0x7eca('0x19')];var _0x54eeec;if(_0xd55411>=_0x137c18){_0xd55411=_0x137c18;_0x54eeec=0xc8;}else{_0x54eeec=0xce;}_0x383f1f['status'](_0x54eeec);return _0x383f1f['set']('Content-Range',_0x158ed2+'-'+_0xd55411+'/'+_0x137c18)['json'](_0x484ad7);}return null;};}function patchUpdates(_0x5b1e04){return function(_0x538301){try{jsonpatch['apply'](_0x538301,_0x5b1e04,!![]);}catch(_0x197820){return BPromise[_0x7eca('0x1b')](_0x197820);}return _0x538301[_0x7eca('0x1c')]();};}function saveUpdates(_0x620d1d,_0x4e0525){return function(_0x4d141c){if(_0x4d141c){return _0x4d141c['update'](_0x620d1d)['then'](function(_0x1341b4){return _0x1341b4;});}return null;};}function removeEntity(_0x381b58,_0x4a7acc){return function(_0x27f59c){if(_0x27f59c){return _0x27f59c[_0x7eca('0x1d')]()[_0x7eca('0x1e')](function(){_0x381b58['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x101188,_0x286f6a){return function(_0x357167){if(!_0x357167){_0x101188['sendStatus'](0x194);}return _0x357167;};}function handleError(_0xfa04c,_0x3c0438){_0x3c0438=_0x3c0438||0x1f4;return function(_0x513221){logger['error'](_0x513221[_0x7eca('0x1f')]);if(_0x513221['name']){delete _0x513221[_0x7eca('0x20')];}_0xfa04c['status'](_0x3c0438)[_0x7eca('0x21')](_0x513221);};}exports[_0x7eca('0x22')]=function(_0x759988,_0x8536b3){var _0x45a9f0={},_0x41464f={},_0x296608={'count':0x0,'rows':[]};var _0x3e9176=_['map'](db[_0x7eca('0x23')][_0x7eca('0x24')],function(_0x47dddf){return{'name':_0x47dddf[_0x7eca('0x25')],'type':_0x47dddf['type'][_0x7eca('0x26')]};});_0x41464f['model']=_[_0x7eca('0x27')](_0x3e9176,_0x7eca('0x20'));_0x41464f[_0x7eca('0x28')]=_[_0x7eca('0x29')](_0x759988[_0x7eca('0x28')]);_0x41464f[_0x7eca('0x2a')]=_[_0x7eca('0x2b')](_0x41464f[_0x7eca('0x2c')],_0x41464f[_0x7eca('0x28')]);_0x45a9f0[_0x7eca('0x2d')]=_[_0x7eca('0x2b')](_0x41464f['model'],qs[_0x7eca('0x2e')](_0x759988[_0x7eca('0x28')][_0x7eca('0x2e')]));_0x45a9f0[_0x7eca('0x2d')]=_0x45a9f0['attributes'][_0x7eca('0x2f')]?_0x45a9f0[_0x7eca('0x2d')]:_0x41464f[_0x7eca('0x2c')];if(!_0x759988[_0x7eca('0x28')][_0x7eca('0x30')](_0x7eca('0x31'))){_0x45a9f0[_0x7eca('0x19')]=qs[_0x7eca('0x19')](_0x759988[_0x7eca('0x28')]['limit']);_0x45a9f0['offset']=qs['offset'](_0x759988[_0x7eca('0x28')][_0x7eca('0x17')]);}_0x45a9f0[_0x7eca('0x32')]=qs[_0x7eca('0x33')](_0x759988[_0x7eca('0x28')][_0x7eca('0x33')]);_0x45a9f0[_0x7eca('0x34')]=qs[_0x7eca('0x2a')](_[_0x7eca('0x35')](_0x759988['query'],_0x41464f[_0x7eca('0x2a')]),_0x3e9176);if(_0x759988[_0x7eca('0x28')][_0x7eca('0x36')]){_0x45a9f0[_0x7eca('0x34')]=_[_0x7eca('0x37')](_0x45a9f0[_0x7eca('0x34')],{'$or':_['map'](_0x3e9176,function(_0x3c275a){if(_0x3c275a[_0x7eca('0x38')]!==_0x7eca('0x39')){var _0x8db813={};_0x8db813[_0x3c275a[_0x7eca('0x20')]]={'$like':'%'+_0x759988['query'][_0x7eca('0x36')]+'%'};return _0x8db813;}})});}_0x45a9f0=_[_0x7eca('0x37')]({},_0x45a9f0,_0x759988['options']);var _0x1a2f36={'where':_0x45a9f0['where']};return db[_0x7eca('0x23')][_0x7eca('0x1a')](_0x1a2f36)[_0x7eca('0x1e')](function(_0x176527){_0x296608[_0x7eca('0x1a')]=_0x176527;if(_0x759988[_0x7eca('0x28')][_0x7eca('0x3a')]){_0x45a9f0[_0x7eca('0x3b')]=[{'all':!![]}];}return db[_0x7eca('0x23')][_0x7eca('0x3c')](_0x45a9f0);})[_0x7eca('0x1e')](function(_0x1edba6){_0x296608[_0x7eca('0x3d')]=_0x1edba6;return _0x296608;})[_0x7eca('0x1e')](respondWithFilteredResult(_0x8536b3,_0x45a9f0))['catch'](handleError(_0x8536b3,null));};exports[_0x7eca('0x3e')]=function(_0x55332b,_0x120e6e){var _0x120c5b={'raw':!![],'where':{'id':_0x55332b[_0x7eca('0x3f')]['id']}},_0x23def2={};_0x23def2['model']=_[_0x7eca('0x29')](db[_0x7eca('0x23')][_0x7eca('0x24')]);_0x23def2[_0x7eca('0x28')]=_[_0x7eca('0x29')](_0x55332b['query']);_0x23def2[_0x7eca('0x2a')]=_['intersection'](_0x23def2[_0x7eca('0x2c')],_0x23def2[_0x7eca('0x28')]);_0x120c5b[_0x7eca('0x2d')]=_[_0x7eca('0x2b')](_0x23def2[_0x7eca('0x2c')],qs[_0x7eca('0x2e')](_0x55332b[_0x7eca('0x28')][_0x7eca('0x2e')]));_0x120c5b['attributes']=_0x120c5b['attributes'][_0x7eca('0x2f')]?_0x120c5b[_0x7eca('0x2d')]:_0x23def2[_0x7eca('0x2c')];if(_0x55332b[_0x7eca('0x28')]['includeAll']){_0x120c5b['include']=[{'all':!![]}];}_0x120c5b=_[_0x7eca('0x37')]({},_0x120c5b,_0x55332b[_0x7eca('0x40')]);return db['SugarcrmField'][_0x7eca('0x41')](_0x120c5b)[_0x7eca('0x1e')](handleEntityNotFound(_0x120e6e,null))[_0x7eca('0x1e')](respondWithResult(_0x120e6e,null))[_0x7eca('0x42')](handleError(_0x120e6e,null));};exports[_0x7eca('0x43')]=function(_0x25ba51,_0x57de01){return db[_0x7eca('0x23')]['create'](_0x25ba51[_0x7eca('0x44')],{})['then'](respondWithResult(_0x57de01,0xc9))[_0x7eca('0x42')](handleError(_0x57de01,null));};exports['update']=function(_0x4e0648,_0x28b34e){if(_0x4e0648[_0x7eca('0x44')]['id']){delete _0x4e0648[_0x7eca('0x44')]['id'];}return db[_0x7eca('0x23')]['find']({'where':{'id':_0x4e0648[_0x7eca('0x3f')]['id']}})[_0x7eca('0x1e')](handleEntityNotFound(_0x28b34e,null))[_0x7eca('0x1e')](saveUpdates(_0x4e0648['body'],null))['then'](respondWithResult(_0x28b34e,null))[_0x7eca('0x42')](handleError(_0x28b34e,null));};exports[_0x7eca('0x1d')]=function(_0x591d33,_0xd22cc7){return db['SugarcrmField'][_0x7eca('0x41')]({'where':{'id':_0x591d33[_0x7eca('0x3f')]['id']}})[_0x7eca('0x1e')](handleEntityNotFound(_0xd22cc7,null))[_0x7eca('0x1e')](removeEntity(_0xd22cc7,null))[_0x7eca('0x42')](handleError(_0xd22cc7,null));}; \ No newline at end of file +var _0x7f2a=['squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','end','error','name','send','map','SugarcrmField','type','key','model','query','keys','filters','intersection','attributes','fields','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','show','params','rawAttributes','length','create','body','catch','find','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra'];(function(_0x348493,_0x24cab1){var _0x4b1f0f=function(_0x5d9164){while(--_0x5d9164){_0x348493['push'](_0x348493['shift']());}};_0x4b1f0f(++_0x24cab1);}(_0x7f2a,0x82));var _0xa7f2=function(_0x18ceea,_0x2a907e){_0x18ceea=_0x18ceea-0x0;var _0x3fff5d=_0x7f2a[_0x18ceea];return _0x3fff5d;};'use strict';var emlformat=require(_0xa7f2('0x0'));var rimraf=require(_0xa7f2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xa7f2('0x2'));var moment=require(_0xa7f2('0x3'));var BPromise=require(_0xa7f2('0x4'));var Mustache=require(_0xa7f2('0x5'));var util=require(_0xa7f2('0x6'));var path=require(_0xa7f2('0x7'));var sox=require(_0xa7f2('0x8'));var csv=require(_0xa7f2('0x9'));var ejs=require(_0xa7f2('0xa'));var fs=require('fs');var fs_extra=require(_0xa7f2('0xb'));var _=require('lodash');var squel=require(_0xa7f2('0xc'));var crypto=require(_0xa7f2('0xd'));var jsforce=require(_0xa7f2('0xe'));var deskjs=require(_0xa7f2('0xf'));var toCsv=require(_0xa7f2('0x9'));var querystring=require(_0xa7f2('0x10'));var Papa=require('papaparse');var Redis=require(_0xa7f2('0x11'));var authService=require(_0xa7f2('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xa7f2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa7f2('0x14'))(_0xa7f2('0x15'));var utils=require('../../config/utils');var config=require(_0xa7f2('0x16'));var licenseUtil=require(_0xa7f2('0x17'));var db=require(_0xa7f2('0x18'))['db'];function respondWithStatusCode(_0x50cde9,_0x3c15e7){_0x3c15e7=_0x3c15e7||0xcc;return function(_0x1ad818){if(_0x1ad818){return _0x50cde9[_0xa7f2('0x19')](_0x3c15e7);}return _0x50cde9[_0xa7f2('0x1a')](_0x3c15e7)['end']();};}function respondWithResult(_0x3ef70a,_0x155e6){_0x155e6=_0x155e6||0xc8;return function(_0x1b9f5d){if(_0x1b9f5d){return _0x3ef70a['status'](_0x155e6)[_0xa7f2('0x1b')](_0x1b9f5d);}};}function respondWithFilteredResult(_0x24a693,_0x4fdb25){return function(_0x561460){if(_0x561460){var _0x3b77f3=typeof _0x4fdb25[_0xa7f2('0x1c')]===_0xa7f2('0x1d')&&typeof _0x4fdb25[_0xa7f2('0x1e')]===_0xa7f2('0x1d');var _0x33ea0b=_0x561460[_0xa7f2('0x1f')];var _0x32bbbb=_0x3b77f3?0x0:_0x4fdb25[_0xa7f2('0x1c')];var _0x4558bc=_0x3b77f3?_0x561460[_0xa7f2('0x1f')]:_0x4fdb25[_0xa7f2('0x1c')]+_0x4fdb25['limit'];var _0x505b50;if(_0x4558bc>=_0x33ea0b){_0x4558bc=_0x33ea0b;_0x505b50=0xc8;}else{_0x505b50=0xce;}_0x24a693[_0xa7f2('0x1a')](_0x505b50);return _0x24a693[_0xa7f2('0x20')](_0xa7f2('0x21'),_0x32bbbb+'-'+_0x4558bc+'/'+_0x33ea0b)[_0xa7f2('0x1b')](_0x561460);}return null;};}function patchUpdates(_0x253ed6){return function(_0x3221c3){try{jsonpatch[_0xa7f2('0x22')](_0x3221c3,_0x253ed6,!![]);}catch(_0x31e9e9){return BPromise[_0xa7f2('0x23')](_0x31e9e9);}return _0x3221c3['save']();};}function saveUpdates(_0x17a7dc,_0x5493d6){return function(_0x55b692){if(_0x55b692){return _0x55b692[_0xa7f2('0x24')](_0x17a7dc)[_0xa7f2('0x25')](function(_0x32b9f0){return _0x32b9f0;});}return null;};}function removeEntity(_0x3519e0,_0x3f21ca){return function(_0x7b5c5f){if(_0x7b5c5f){return _0x7b5c5f['destroy']()[_0xa7f2('0x25')](function(){_0x3519e0[_0xa7f2('0x1a')](0xcc)[_0xa7f2('0x26')]();});}};}function handleEntityNotFound(_0x2e07d7,_0x2c3608){return function(_0x7db6e0){if(!_0x7db6e0){_0x2e07d7['sendStatus'](0x194);}return _0x7db6e0;};}function handleError(_0x399f88,_0x254476){_0x254476=_0x254476||0x1f4;return function(_0x5ee195){logger[_0xa7f2('0x27')](_0x5ee195['stack']);if(_0x5ee195['name']){delete _0x5ee195[_0xa7f2('0x28')];}_0x399f88[_0xa7f2('0x1a')](_0x254476)[_0xa7f2('0x29')](_0x5ee195);};}exports['index']=function(_0x1e8ba0,_0x116260){var _0x4cb384={},_0x4d2255={},_0x4a504e={'count':0x0,'rows':[]};var _0x4bd4f9=_[_0xa7f2('0x2a')](db[_0xa7f2('0x2b')]['rawAttributes'],function(_0x5312ae){return{'name':_0x5312ae['fieldName'],'type':_0x5312ae[_0xa7f2('0x2c')][_0xa7f2('0x2d')]};});_0x4d2255[_0xa7f2('0x2e')]=_[_0xa7f2('0x2a')](_0x4bd4f9,_0xa7f2('0x28'));_0x4d2255[_0xa7f2('0x2f')]=_[_0xa7f2('0x30')](_0x1e8ba0['query']);_0x4d2255[_0xa7f2('0x31')]=_[_0xa7f2('0x32')](_0x4d2255[_0xa7f2('0x2e')],_0x4d2255[_0xa7f2('0x2f')]);_0x4cb384[_0xa7f2('0x33')]=_[_0xa7f2('0x32')](_0x4d2255[_0xa7f2('0x2e')],qs[_0xa7f2('0x34')](_0x1e8ba0[_0xa7f2('0x2f')]['fields']));_0x4cb384[_0xa7f2('0x33')]=_0x4cb384[_0xa7f2('0x33')]['length']?_0x4cb384[_0xa7f2('0x33')]:_0x4d2255[_0xa7f2('0x2e')];if(!_0x1e8ba0[_0xa7f2('0x2f')]['hasOwnProperty']('nolimit')){_0x4cb384[_0xa7f2('0x1e')]=qs[_0xa7f2('0x1e')](_0x1e8ba0['query'][_0xa7f2('0x1e')]);_0x4cb384[_0xa7f2('0x1c')]=qs[_0xa7f2('0x1c')](_0x1e8ba0['query'][_0xa7f2('0x1c')]);}_0x4cb384[_0xa7f2('0x35')]=qs['sort'](_0x1e8ba0[_0xa7f2('0x2f')][_0xa7f2('0x36')]);_0x4cb384[_0xa7f2('0x37')]=qs[_0xa7f2('0x31')](_[_0xa7f2('0x38')](_0x1e8ba0[_0xa7f2('0x2f')],_0x4d2255[_0xa7f2('0x31')]),_0x4bd4f9);if(_0x1e8ba0[_0xa7f2('0x2f')][_0xa7f2('0x39')]){_0x4cb384[_0xa7f2('0x37')]=_[_0xa7f2('0x3a')](_0x4cb384[_0xa7f2('0x37')],{'$or':_[_0xa7f2('0x2a')](_0x4bd4f9,function(_0xe8bd69){if(_0xe8bd69[_0xa7f2('0x2c')]!==_0xa7f2('0x3b')){var _0x2b08d1={};_0x2b08d1[_0xe8bd69[_0xa7f2('0x28')]]={'$like':'%'+_0x1e8ba0[_0xa7f2('0x2f')][_0xa7f2('0x39')]+'%'};return _0x2b08d1;}})});}_0x4cb384=_['merge']({},_0x4cb384,_0x1e8ba0['options']);var _0x1a7a63={'where':_0x4cb384[_0xa7f2('0x37')]};return db[_0xa7f2('0x2b')][_0xa7f2('0x1f')](_0x1a7a63)[_0xa7f2('0x25')](function(_0x2b76a0){_0x4a504e[_0xa7f2('0x1f')]=_0x2b76a0;if(_0x1e8ba0[_0xa7f2('0x2f')][_0xa7f2('0x3c')]){_0x4cb384[_0xa7f2('0x3d')]=[{'all':!![]}];}return db[_0xa7f2('0x2b')][_0xa7f2('0x3e')](_0x4cb384);})['then'](function(_0x4853a4){_0x4a504e['rows']=_0x4853a4;return _0x4a504e;})[_0xa7f2('0x25')](respondWithFilteredResult(_0x116260,_0x4cb384))['catch'](handleError(_0x116260,null));};exports[_0xa7f2('0x3f')]=function(_0x1ddc5f,_0x58f5b0){var _0x252049={'raw':!![],'where':{'id':_0x1ddc5f[_0xa7f2('0x40')]['id']}},_0x3f539c={};_0x3f539c[_0xa7f2('0x2e')]=_[_0xa7f2('0x30')](db[_0xa7f2('0x2b')][_0xa7f2('0x41')]);_0x3f539c[_0xa7f2('0x2f')]=_['keys'](_0x1ddc5f[_0xa7f2('0x2f')]);_0x3f539c[_0xa7f2('0x31')]=_[_0xa7f2('0x32')](_0x3f539c[_0xa7f2('0x2e')],_0x3f539c[_0xa7f2('0x2f')]);_0x252049[_0xa7f2('0x33')]=_['intersection'](_0x3f539c[_0xa7f2('0x2e')],qs[_0xa7f2('0x34')](_0x1ddc5f[_0xa7f2('0x2f')][_0xa7f2('0x34')]));_0x252049[_0xa7f2('0x33')]=_0x252049[_0xa7f2('0x33')][_0xa7f2('0x42')]?_0x252049[_0xa7f2('0x33')]:_0x3f539c[_0xa7f2('0x2e')];if(_0x1ddc5f['query'][_0xa7f2('0x3c')]){_0x252049[_0xa7f2('0x3d')]=[{'all':!![]}];}_0x252049=_[_0xa7f2('0x3a')]({},_0x252049,_0x1ddc5f['options']);return db[_0xa7f2('0x2b')]['find'](_0x252049)[_0xa7f2('0x25')](handleEntityNotFound(_0x58f5b0,null))[_0xa7f2('0x25')](respondWithResult(_0x58f5b0,null))['catch'](handleError(_0x58f5b0,null));};exports['create']=function(_0x58591b,_0x11407a){return db['SugarcrmField'][_0xa7f2('0x43')](_0x58591b[_0xa7f2('0x44')],{})[_0xa7f2('0x25')](respondWithResult(_0x11407a,0xc9))[_0xa7f2('0x45')](handleError(_0x11407a,null));};exports[_0xa7f2('0x24')]=function(_0x141688,_0x593ca5){if(_0x141688['body']['id']){delete _0x141688[_0xa7f2('0x44')]['id'];}return db[_0xa7f2('0x2b')][_0xa7f2('0x46')]({'where':{'id':_0x141688[_0xa7f2('0x40')]['id']}})[_0xa7f2('0x25')](handleEntityNotFound(_0x593ca5,null))[_0xa7f2('0x25')](saveUpdates(_0x141688[_0xa7f2('0x44')],null))['then'](respondWithResult(_0x593ca5,null))['catch'](handleError(_0x593ca5,null));};exports['destroy']=function(_0x49af50,_0x2e4464){return db[_0xa7f2('0x2b')][_0xa7f2('0x46')]({'where':{'id':_0x49af50[_0xa7f2('0x40')]['id']}})[_0xa7f2('0x25')](handleEntityNotFound(_0x2e4464,null))[_0xa7f2('0x25')](removeEntity(_0x2e4464,null))['catch'](handleError(_0x2e4464,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index 43d13a9..f793e97 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 _0x3434=['path','rimraf','../../config/environment','./intSugarcrmField.attributes','exports','SugarcrmField','int_sugarcrm_fields','sugarcrm_unique_index','FieldId','util','api','moment','bluebird','request-promise'];(function(_0x2d2caf,_0x4ffb32){var _0x16435e=function(_0x415008){while(--_0x415008){_0x2d2caf['push'](_0x2d2caf['shift']());}};_0x16435e(++_0x4ffb32);}(_0x3434,0x113));var _0x4343=function(_0x551af4,_0x1a6f71){_0x551af4=_0x551af4-0x0;var _0x576e5=_0x3434[_0x551af4];return _0x576e5;};'use strict';var _=require('lodash');var util=require(_0x4343('0x0'));var logger=require('../../config/logger')(_0x4343('0x1'));var moment=require(_0x4343('0x2'));var BPromise=require(_0x4343('0x3'));var rp=require(_0x4343('0x4'));var fs=require('fs');var path=require(_0x4343('0x5'));var rimraf=require(_0x4343('0x6'));var config=require(_0x4343('0x7'));var attributes=require(_0x4343('0x8'));module[_0x4343('0x9')]=function(_0x32d12e,_0xdc7034){return _0x32d12e['define'](_0x4343('0xa'),attributes,{'tableName':_0x4343('0xb'),'paranoid':![],'indexes':[{'name':_0x4343('0xc'),'fields':['idField',_0x4343('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6041=['util','moment','bluebird','request-promise','path','../../config/environment','./intSugarcrmField.attributes','exports','define','SugarcrmField','int_sugarcrm_fields','sugarcrm_unique_index','idField'];(function(_0x31c3d5,_0x40a38c){var _0x5424ba=function(_0x15b7fa){while(--_0x15b7fa){_0x31c3d5['push'](_0x31c3d5['shift']());}};_0x5424ba(++_0x40a38c);}(_0x6041,0x15f));var _0x1604=function(_0x1d826b,_0x241007){_0x1d826b=_0x1d826b-0x0;var _0x466eab=_0x6041[_0x1d826b];return _0x466eab;};'use strict';var _=require('lodash');var util=require(_0x1604('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x1604('0x1'));var BPromise=require(_0x1604('0x2'));var rp=require(_0x1604('0x3'));var fs=require('fs');var path=require(_0x1604('0x4'));var rimraf=require('rimraf');var config=require(_0x1604('0x5'));var attributes=require(_0x1604('0x6'));module[_0x1604('0x7')]=function(_0x31588e,_0x3641a8){return _0x31588e[_0x1604('0x8')](_0x1604('0x9'),attributes,{'tableName':_0x1604('0xa'),'paranoid':![],'indexes':[{'name':_0x1604('0xb'),'fields':[_0x1604('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.rpc.js b/server/api/intSugarcrmField/intSugarcrmField.rpc.js index 18b4ac2..8eef6e1 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 _0xfce6=['moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','request','then','info','SugarcrmField,\x20%s,\x20%s','debug','error','code','message','request\x20sent','result','catch','util'];(function(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0xfce6,0x13f));var _0x6fce=function(_0x324907,_0x4d23c1){_0x324907=_0x324907-0x0;var _0x464abc=_0xfce6[_0x324907];return _0x464abc;};'use strict';var _=require('lodash');var util=require(_0x6fce('0x0'));var moment=require(_0x6fce('0x1'));var BPromise=require(_0x6fce('0x2'));var rs=require(_0x6fce('0x3'));var fs=require('fs');var Redis=require(_0x6fce('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x6fce('0x5'));var config=require(_0x6fce('0x6'));var jayson=require(_0x6fce('0x7'));var client=jayson[_0x6fce('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x231058,_0x28e407,_0x1f54ef){return new BPromise(function(_0x331a48,_0x289c24){return client[_0x6fce('0x9')](_0x231058,_0x1f54ef)[_0x6fce('0xa')](function(_0x2a962a){logger[_0x6fce('0xb')](_0x6fce('0xc'),_0x28e407,'request\x20sent');logger[_0x6fce('0xd')]('SugarcrmField,\x20%s,\x20%s,\x20%s',_0x28e407,'request\x20sent',JSON['stringify'](_0x2a962a));if(_0x2a962a[_0x6fce('0xe')]){if(_0x2a962a['error'][_0x6fce('0xf')]===0x1f4){logger[_0x6fce('0xe')](_0x6fce('0xc'),_0x28e407,_0x2a962a[_0x6fce('0xe')]['message']);return _0x289c24(_0x2a962a[_0x6fce('0xe')][_0x6fce('0x10')]);}logger['error'](_0x6fce('0xc'),_0x28e407,_0x2a962a['error'][_0x6fce('0x10')]);return _0x331a48(_0x2a962a[_0x6fce('0xe')][_0x6fce('0x10')]);}else{logger['info'](_0x6fce('0xc'),_0x28e407,_0x6fce('0x11'));_0x331a48(_0x2a962a[_0x6fce('0x12')][_0x6fce('0x10')]);}})[_0x6fce('0x13')](function(_0x3bb24a){logger['error'](_0x6fce('0xc'),_0x28e407,_0x3bb24a);_0x289c24(_0x3bb24a);});});} \ No newline at end of file +var _0x2bd0=['result','catch','lodash','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','client','http','request','info','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2bd0,0x1ce));var _0x02bd=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0x2bd0[_0x5bd426];return _0x23a7eb;};'use strict';var _=require(_0x02bd('0x0'));var util=require('util');var moment=require(_0x02bd('0x1'));var BPromise=require(_0x02bd('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x02bd('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x02bd('0x4'));var logger=require(_0x02bd('0x5'))(_0x02bd('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x02bd('0x7')][_0x02bd('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x7f4d5f,_0x3327b2,_0x2f9b0b){return new BPromise(function(_0x52d661,_0x10c548){return client[_0x02bd('0x9')](_0x7f4d5f,_0x2f9b0b)['then'](function(_0x4ccaa6){logger[_0x02bd('0xa')](_0x02bd('0xb'),_0x3327b2,_0x02bd('0xc'));logger[_0x02bd('0xd')]('SugarcrmField,\x20%s,\x20%s,\x20%s',_0x3327b2,_0x02bd('0xc'),JSON[_0x02bd('0xe')](_0x4ccaa6));if(_0x4ccaa6[_0x02bd('0xf')]){if(_0x4ccaa6[_0x02bd('0xf')][_0x02bd('0x10')]===0x1f4){logger[_0x02bd('0xf')](_0x02bd('0xb'),_0x3327b2,_0x4ccaa6[_0x02bd('0xf')][_0x02bd('0x11')]);return _0x10c548(_0x4ccaa6[_0x02bd('0xf')]['message']);}logger['error'](_0x02bd('0xb'),_0x3327b2,_0x4ccaa6[_0x02bd('0xf')][_0x02bd('0x11')]);return _0x52d661(_0x4ccaa6[_0x02bd('0xf')][_0x02bd('0x11')]);}else{logger[_0x02bd('0xa')](_0x02bd('0xb'),_0x3327b2,_0x02bd('0xc'));_0x52d661(_0x4ccaa6[_0x02bd('0x12')][_0x02bd('0x11')]);}})[_0x02bd('0x13')](function(_0x129736){logger[_0x02bd('0xf')](_0x02bd('0xb'),_0x3327b2,_0x129736);_0x10c548(_0x129736);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index c659639..b28ea85 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 _0x46fc=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x38f5f8,_0xefe164){var _0x34e820=function(_0x3a2407){while(--_0x3a2407){_0x38f5f8['push'](_0x38f5f8['shift']());}};_0x34e820(++_0xefe164);}(_0x46fc,0x103));var _0xc46f=function(_0x4a81c3,_0x504a70){_0x4a81c3=_0x4a81c3-0x0;var _0x17a34f=_0x46fc[_0x4a81c3];return _0x17a34f;};'use strict';var multer=require(_0xc46f('0x0'));var util=require(_0xc46f('0x1'));var path=require(_0xc46f('0x2'));var timeout=require(_0xc46f('0x3'));var express=require(_0xc46f('0x4'));var router=express[_0xc46f('0x5')]();var fs_extra=require(_0xc46f('0x6'));var auth=require(_0xc46f('0x7'));var interaction=require(_0xc46f('0x8'));var config=require('../../config/environment');var controller=require('./intVtigerAccount.controller');router[_0xc46f('0x9')]('/',auth[_0xc46f('0xa')](),controller[_0xc46f('0xb')]);router[_0xc46f('0x9')](_0xc46f('0xc'),auth[_0xc46f('0xa')](),controller[_0xc46f('0xd')]);router[_0xc46f('0x9')](_0xc46f('0xe'),auth[_0xc46f('0xa')](),controller[_0xc46f('0xf')]);router[_0xc46f('0x9')](_0xc46f('0x10'),auth[_0xc46f('0xa')](),controller['getFields']);router[_0xc46f('0x11')]('/',auth[_0xc46f('0xa')](),controller[_0xc46f('0x12')]);router[_0xc46f('0x11')]('/:id/configurations',auth['isAuthenticated'](),controller['addConfiguration']);router[_0xc46f('0x13')](_0xc46f('0xc'),auth['isAuthenticated'](),controller[_0xc46f('0x14')]);router[_0xc46f('0x15')]('/:id',auth['isAuthenticated'](),controller[_0xc46f('0x16')]);module[_0xc46f('0x17')]=router; \ No newline at end of file +var _0x9aee=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','/:id','show','get','getConfigurations','getFields','post','create','/:id/configurations','addConfiguration','put','update','delete','destroy','multer','util'];(function(_0x1a9e78,_0x180720){var _0x113e06=function(_0x229c64){while(--_0x229c64){_0x1a9e78['push'](_0x1a9e78['shift']());}};_0x113e06(++_0x180720);}(_0x9aee,0x71));var _0xe9ae=function(_0x24ee05,_0x376f49){_0x24ee05=_0x24ee05-0x0;var _0x43ac48=_0x9aee[_0x24ee05];return _0x43ac48;};'use strict';var multer=require(_0xe9ae('0x0'));var util=require(_0xe9ae('0x1'));var path=require(_0xe9ae('0x2'));var timeout=require(_0xe9ae('0x3'));var express=require(_0xe9ae('0x4'));var router=express[_0xe9ae('0x5')]();var fs_extra=require(_0xe9ae('0x6'));var auth=require(_0xe9ae('0x7'));var interaction=require(_0xe9ae('0x8'));var config=require('../../config/environment');var controller=require('./intVtigerAccount.controller');router['get']('/',auth[_0xe9ae('0x9')](),controller['index']);router['get'](_0xe9ae('0xa'),auth['isAuthenticated'](),controller[_0xe9ae('0xb')]);router[_0xe9ae('0xc')]('/:id/configurations',auth[_0xe9ae('0x9')](),controller[_0xe9ae('0xd')]);router[_0xe9ae('0xc')]('/:id/fields',auth[_0xe9ae('0x9')](),controller[_0xe9ae('0xe')]);router[_0xe9ae('0xf')]('/',auth['isAuthenticated'](),controller[_0xe9ae('0x10')]);router['post'](_0xe9ae('0x11'),auth[_0xe9ae('0x9')](),controller[_0xe9ae('0x12')]);router[_0xe9ae('0x13')](_0xe9ae('0xa'),auth[_0xe9ae('0x9')](),controller[_0xe9ae('0x14')]);router[_0xe9ae('0x15')]('/:id',auth[_0xe9ae('0x9')](),controller[_0xe9ae('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index 9221988..5d1c137 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 _0xed0a=['STRING','HelpDesk','sequelize'];(function(_0x24f174,_0x36f41a){var _0x123ad0=function(_0x9df561){while(--_0x9df561){_0x24f174['push'](_0x24f174['shift']());}};_0x123ad0(++_0x36f41a);}(_0xed0a,0x95));var _0xaed0=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xed0a[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0xaed0('0x0'));module['exports']={'name':{'type':Sequelize[_0xaed0('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xaed0('0x1')],'allowNull':![]},'moduleName':{'type':Sequelize[_0xaed0('0x1')],'allowNull':![],'defaultValue':_0xaed0('0x2')},'remoteUri':{'type':Sequelize[_0xaed0('0x1')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0xaed0('0x1')],'allowNull':![]},'accessKey':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0xf889=['HelpDesk','sequelize','STRING'];(function(_0x4f1064,_0x395eb4){var _0x4b5638=function(_0x382f93){while(--_0x382f93){_0x4f1064['push'](_0x4f1064['shift']());}};_0x4b5638(++_0x395eb4);}(_0xf889,0x82));var _0x9f88=function(_0x10e763,_0x4a693d){_0x10e763=_0x10e763-0x0;var _0x502b44=_0xf889[_0x10e763];return _0x502b44;};'use strict';var Sequelize=require(_0x9f88('0x0'));module['exports']={'name':{'type':Sequelize[_0x9f88('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x9f88('0x1')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x9f88('0x1')],'allowNull':![],'defaultValue':_0x9f88('0x2')},'remoteUri':{'type':Sequelize[_0x9f88('0x1')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x9f88('0x1')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x9f88('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index bbba6bf..f850c63 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 _0xe224=['moduleName','remoteUri','serverUrl','accessKey','username','slice','substring','lastIndexOf','%s/webservice.php','GET','getchallenge','success','POST','login','token','describe','reference','owner','includes','remove','editable','false','label','startsWith','picklist','picklistValues','value','log','vTiger\x20error:\x20','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','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','../../config/license/util','../../mysqldb','jayson/promise','client','request','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','VtigerAccount','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','filter','options','includeAll','rows','show','intersection','include','find','create','body','params','findOne','VtigerConfiguration','pick','getConfigurations','addConfiguration','Subjects','channel','VtigerField','Descriptions','md5','getFields','description'];(function(_0x4dfc38,_0x573777){var _0x81e927=function(_0x28262a){while(--_0x28262a){_0x4dfc38['push'](_0x4dfc38['shift']());}};_0x81e927(++_0x573777);}(_0xe224,0x12e));var _0x4e22=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xe224[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0x4e22('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x4e22('0x1'));var rp=require('request-promise');var moment=require(_0x4e22('0x2'));var BPromise=require(_0x4e22('0x3'));var Mustache=require(_0x4e22('0x4'));var util=require(_0x4e22('0x5'));var path=require(_0x4e22('0x6'));var sox=require(_0x4e22('0x7'));var csv=require(_0x4e22('0x8'));var ejs=require(_0x4e22('0x9'));var fs=require('fs');var fs_extra=require(_0x4e22('0xa'));var _=require('lodash');var squel=require(_0x4e22('0xb'));var crypto=require(_0x4e22('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x4e22('0xd'));var toCsv=require('to-csv');var querystring=require(_0x4e22('0xe'));var Papa=require(_0x4e22('0xf'));var Redis=require(_0x4e22('0x10'));var authService=require(_0x4e22('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x4e22('0x12'));var hardwareService=require(_0x4e22('0x13'));var logger=require(_0x4e22('0x14'))(_0x4e22('0x15'));var utils=require(_0x4e22('0x16'));var config=require(_0x4e22('0x17'));var licenseUtil=require(_0x4e22('0x18'));var db=require(_0x4e22('0x19'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0x4e22('0x1a'));var client=jayson[_0x4e22('0x1b')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3dc800,_0x4b1cc7,_0x4b57b0,_0x27fa62){return new BPromise(function(_0x4190c4,_0x382048){var _0x5babd2=_0x27fa62||client;return _0x5babd2[_0x4e22('0x1c')](_0x3dc800,_0x4b57b0)['then'](function(_0x41b8b1){logger[_0x4e22('0x1d')](_0x4e22('0x1e'),_0x4b1cc7,_0x4e22('0x1f'));logger[_0x4e22('0x20')](_0x4e22('0x21'),_0x4b1cc7,_0x4e22('0x1f'),JSON['stringify'](_0x41b8b1));if(_0x41b8b1[_0x4e22('0x22')]){if(_0x41b8b1[_0x4e22('0x22')][_0x4e22('0x23')]===0x1f4){logger[_0x4e22('0x22')](_0x4e22('0x1e'),_0x4b1cc7,_0x41b8b1[_0x4e22('0x22')][_0x4e22('0x24')]);return _0x382048(_0x41b8b1['error'][_0x4e22('0x24')]);}logger[_0x4e22('0x22')](_0x4e22('0x1e'),_0x4b1cc7,_0x41b8b1[_0x4e22('0x22')]['message']);return _0x4190c4(_0x41b8b1['error'][_0x4e22('0x24')]);}else{logger['info'](_0x4e22('0x1e'),_0x4b1cc7,_0x4e22('0x1f'));_0x4190c4(_0x41b8b1[_0x4e22('0x25')][_0x4e22('0x24')]);}})[_0x4e22('0x26')](function(_0x3deb70){logger[_0x4e22('0x22')](_0x4e22('0x1e'),_0x4b1cc7,_0x3deb70);_0x382048(_0x3deb70);});});}function respondWithStatusCode(_0x393e7a,_0x3bad0f){_0x3bad0f=_0x3bad0f||0xcc;return function(_0x3ef21d){if(_0x3ef21d){return _0x393e7a[_0x4e22('0x27')](_0x3bad0f);}return _0x393e7a[_0x4e22('0x28')](_0x3bad0f)[_0x4e22('0x29')]();};}function respondWithResult(_0x109e68,_0x309349){_0x309349=_0x309349||0xc8;return function(_0x123903){if(_0x123903){return _0x109e68['status'](_0x309349)[_0x4e22('0x2a')](_0x123903);}};}function respondWithFilteredResult(_0x47c9a3,_0x4aa58b){return function(_0x538a7a){if(_0x538a7a){var _0x478f87=typeof _0x4aa58b['offset']===_0x4e22('0x2b')&&typeof _0x4aa58b[_0x4e22('0x2c')]==='undefined';var _0x3b7898=_0x538a7a[_0x4e22('0x2d')];var _0x154cd2=_0x478f87?0x0:_0x4aa58b['offset'];var _0x42164a=_0x478f87?_0x538a7a[_0x4e22('0x2d')]:_0x4aa58b[_0x4e22('0x2e')]+_0x4aa58b[_0x4e22('0x2c')];var _0x1d2b2d;if(_0x42164a>=_0x3b7898){_0x42164a=_0x3b7898;_0x1d2b2d=0xc8;}else{_0x1d2b2d=0xce;}_0x47c9a3[_0x4e22('0x28')](_0x1d2b2d);return _0x47c9a3[_0x4e22('0x2f')](_0x4e22('0x30'),_0x154cd2+'-'+_0x42164a+'/'+_0x3b7898)['json'](_0x538a7a);}return null;};}function patchUpdates(_0x5d2736){return function(_0x261eee){try{jsonpatch[_0x4e22('0x31')](_0x261eee,_0x5d2736,!![]);}catch(_0x4e3c9c){return BPromise[_0x4e22('0x32')](_0x4e3c9c);}return _0x261eee[_0x4e22('0x33')]();};}function saveUpdates(_0x56a9c6,_0x52bb3b){return function(_0x3fbe42){if(_0x3fbe42){return _0x3fbe42[_0x4e22('0x34')](_0x56a9c6)[_0x4e22('0x35')](function(_0x6d3283){return _0x6d3283;});}return null;};}function removeEntity(_0x1ef719,_0x4a9556){return function(_0x1e91a2){if(_0x1e91a2){return _0x1e91a2[_0x4e22('0x36')]()[_0x4e22('0x35')](function(){_0x1ef719[_0x4e22('0x28')](0xcc)[_0x4e22('0x29')]();});}};}function handleEntityNotFound(_0x4b00cd,_0x4f140b){return function(_0x39f5a6){if(!_0x39f5a6){_0x4b00cd['sendStatus'](0x194);}return _0x39f5a6;};}function handleError(_0x10f6b1,_0x37c1c8){_0x37c1c8=_0x37c1c8||0x1f4;return function(_0x26f4f0){logger[_0x4e22('0x22')](_0x26f4f0[_0x4e22('0x37')]);if(_0x26f4f0[_0x4e22('0x38')]){delete _0x26f4f0[_0x4e22('0x38')];}_0x10f6b1[_0x4e22('0x28')](_0x37c1c8)[_0x4e22('0x39')](_0x26f4f0);};}exports['index']=function(_0x517313,_0x3c78a4){var _0x30cca6={},_0x4b901e={},_0x535103={'count':0x0,'rows':[]};var _0x55f742=_['map'](db[_0x4e22('0x3a')][_0x4e22('0x3b')],function(_0x122337){return{'name':_0x122337[_0x4e22('0x3c')],'type':_0x122337[_0x4e22('0x3d')][_0x4e22('0x3e')]};});_0x4b901e[_0x4e22('0x3f')]=_[_0x4e22('0x40')](_0x55f742,'name');_0x4b901e[_0x4e22('0x41')]=_[_0x4e22('0x42')](_0x517313[_0x4e22('0x41')]);_0x4b901e[_0x4e22('0x43')]=_['intersection'](_0x4b901e['model'],_0x4b901e[_0x4e22('0x41')]);_0x30cca6[_0x4e22('0x44')]=_['intersection'](_0x4b901e['model'],qs[_0x4e22('0x45')](_0x517313[_0x4e22('0x41')][_0x4e22('0x45')]));_0x30cca6[_0x4e22('0x44')]=_0x30cca6[_0x4e22('0x44')][_0x4e22('0x46')]?_0x30cca6['attributes']:_0x4b901e[_0x4e22('0x3f')];if(!_0x517313['query'][_0x4e22('0x47')](_0x4e22('0x48'))){_0x30cca6[_0x4e22('0x2c')]=qs[_0x4e22('0x2c')](_0x517313['query'][_0x4e22('0x2c')]);_0x30cca6[_0x4e22('0x2e')]=qs[_0x4e22('0x2e')](_0x517313[_0x4e22('0x41')][_0x4e22('0x2e')]);}_0x30cca6[_0x4e22('0x49')]=qs['sort'](_0x517313[_0x4e22('0x41')][_0x4e22('0x4a')]);_0x30cca6[_0x4e22('0x4b')]=qs[_0x4e22('0x43')](_['pick'](_0x517313[_0x4e22('0x41')],_0x4b901e[_0x4e22('0x43')]),_0x55f742);if(_0x517313['query']['filter']){_0x30cca6[_0x4e22('0x4b')]=_[_0x4e22('0x4c')](_0x30cca6[_0x4e22('0x4b')],{'$or':_[_0x4e22('0x40')](_0x55f742,function(_0x55b443){if(_0x55b443[_0x4e22('0x3d')]!=='VIRTUAL'){var _0x3a00c3={};_0x3a00c3[_0x55b443[_0x4e22('0x38')]]={'$like':'%'+_0x517313['query'][_0x4e22('0x4d')]+'%'};return _0x3a00c3;}})});}_0x30cca6=_['merge']({},_0x30cca6,_0x517313[_0x4e22('0x4e')]);var _0x85625d={'where':_0x30cca6[_0x4e22('0x4b')]};return db[_0x4e22('0x3a')][_0x4e22('0x2d')](_0x85625d)['then'](function(_0x2b2f1b){_0x535103[_0x4e22('0x2d')]=_0x2b2f1b;if(_0x517313[_0x4e22('0x41')][_0x4e22('0x4f')]){_0x30cca6['include']=[{'all':!![]}];}return db[_0x4e22('0x3a')]['findAll'](_0x30cca6);})[_0x4e22('0x35')](function(_0x1ddaaf){_0x535103[_0x4e22('0x50')]=_0x1ddaaf;return _0x535103;})[_0x4e22('0x35')](respondWithFilteredResult(_0x3c78a4,_0x30cca6))[_0x4e22('0x26')](handleError(_0x3c78a4,null));};exports[_0x4e22('0x51')]=function(_0x448478,_0x2365a9){var _0x11fb09={'raw':![],'where':{'id':_0x448478['params']['id']}},_0x45aeab={};_0x45aeab[_0x4e22('0x3f')]=_[_0x4e22('0x42')](db[_0x4e22('0x3a')][_0x4e22('0x3b')]);_0x45aeab[_0x4e22('0x41')]=_[_0x4e22('0x42')](_0x448478['query']);_0x45aeab[_0x4e22('0x43')]=_['intersection'](_0x45aeab[_0x4e22('0x3f')],_0x45aeab[_0x4e22('0x41')]);_0x11fb09[_0x4e22('0x44')]=_[_0x4e22('0x52')](_0x45aeab[_0x4e22('0x3f')],qs[_0x4e22('0x45')](_0x448478[_0x4e22('0x41')][_0x4e22('0x45')]));_0x11fb09[_0x4e22('0x44')]=_0x11fb09[_0x4e22('0x44')]['length']?_0x11fb09[_0x4e22('0x44')]:_0x45aeab['model'];if(_0x448478[_0x4e22('0x41')][_0x4e22('0x4f')]){_0x11fb09[_0x4e22('0x53')]=[{'all':!![]}];}_0x11fb09=_[_0x4e22('0x4c')]({},_0x11fb09,_0x448478['options']);return db[_0x4e22('0x3a')][_0x4e22('0x54')](_0x11fb09)['then'](handleEntityNotFound(_0x2365a9,null))[_0x4e22('0x35')](respondWithResult(_0x2365a9,null))['catch'](handleError(_0x2365a9,null));};exports[_0x4e22('0x55')]=function(_0x576cdb,_0x59d7ff){return db['VtigerAccount'][_0x4e22('0x55')](_0x576cdb[_0x4e22('0x56')],{})['then'](respondWithResult(_0x59d7ff,0xc9))[_0x4e22('0x26')](handleError(_0x59d7ff,null));};exports[_0x4e22('0x34')]=function(_0x2a7b96,_0x13bc7a){if(_0x2a7b96[_0x4e22('0x56')]['id']){delete _0x2a7b96[_0x4e22('0x56')]['id'];}return db[_0x4e22('0x3a')][_0x4e22('0x54')]({'where':{'id':_0x2a7b96[_0x4e22('0x57')]['id']}})[_0x4e22('0x35')](handleEntityNotFound(_0x13bc7a,null))['then'](saveUpdates(_0x2a7b96[_0x4e22('0x56')],null))['then'](respondWithResult(_0x13bc7a,null))['catch'](handleError(_0x13bc7a,null));};exports[_0x4e22('0x36')]=function(_0x5a163b,_0x32a933){return db[_0x4e22('0x3a')]['find']({'where':{'id':_0x5a163b[_0x4e22('0x57')]['id']}})[_0x4e22('0x35')](handleEntityNotFound(_0x32a933,null))['then'](removeEntity(_0x32a933,null))[_0x4e22('0x26')](handleError(_0x32a933,null));};exports['getConfigurations']=function(_0x4b6497,_0x5a1790,_0x146771){var _0x8e73d2={};var _0x358d79={};var _0x71db2b;var _0x1bdb4c;return db[_0x4e22('0x3a')][_0x4e22('0x58')]({'where':{'id':_0x4b6497[_0x4e22('0x57')]['id']}})[_0x4e22('0x35')](handleEntityNotFound(_0x5a1790,null))['then'](function(_0x2a1a86){if(_0x2a1a86){_0x71db2b=_0x2a1a86;_0x358d79[_0x4e22('0x3f')]=_['keys'](db[_0x4e22('0x59')]['rawAttributes']);_0x358d79[_0x4e22('0x41')]=_[_0x4e22('0x42')](_0x4b6497['query']);_0x358d79['filters']=_['intersection'](_0x358d79['model'],_0x358d79[_0x4e22('0x41')]);_0x8e73d2[_0x4e22('0x44')]=_[_0x4e22('0x52')](_0x358d79[_0x4e22('0x3f')],qs[_0x4e22('0x45')](_0x4b6497[_0x4e22('0x41')]['fields']));_0x8e73d2[_0x4e22('0x44')]=_0x8e73d2['attributes'][_0x4e22('0x46')]?_0x8e73d2[_0x4e22('0x44')]:_0x358d79[_0x4e22('0x3f')];_0x8e73d2[_0x4e22('0x49')]=qs[_0x4e22('0x4a')](_0x4b6497[_0x4e22('0x41')]['sort']);_0x8e73d2[_0x4e22('0x4b')]=qs[_0x4e22('0x43')](_[_0x4e22('0x5a')](_0x4b6497['query'],_0x358d79[_0x4e22('0x43')]));if(_0x4b6497[_0x4e22('0x41')][_0x4e22('0x4d')]){_0x8e73d2['where']=_[_0x4e22('0x4c')](_0x8e73d2[_0x4e22('0x4b')],{'$or':_[_0x4e22('0x40')](_0x8e73d2[_0x4e22('0x44')],function(_0x38081a){var _0x2d7f6a={};_0x2d7f6a[_0x38081a]={'$like':'%'+_0x4b6497[_0x4e22('0x41')][_0x4e22('0x4d')]+'%'};return _0x2d7f6a;})});}_0x8e73d2=_['merge']({},_0x8e73d2,_0x4b6497[_0x4e22('0x4e')]);return _0x71db2b['getConfigurations'](_0x8e73d2);}})[_0x4e22('0x35')](function(_0x5a5b3a){if(_0x5a5b3a){_0x1bdb4c=_0x5a5b3a['length'];if(!_0x4b6497['query'][_0x4e22('0x47')]('nolimit')){_0x8e73d2[_0x4e22('0x2c')]=qs[_0x4e22('0x2c')](_0x4b6497[_0x4e22('0x41')][_0x4e22('0x2c')]);_0x8e73d2['offset']=qs['offset'](_0x4b6497[_0x4e22('0x41')][_0x4e22('0x2e')]);}return _0x71db2b[_0x4e22('0x5b')](_0x8e73d2);}})[_0x4e22('0x35')](function(_0x3a03e6){if(_0x3a03e6){return _0x3a03e6?{'count':_0x1bdb4c,'rows':_0x3a03e6}:null;}})[_0x4e22('0x35')](respondWithResult(_0x5a1790,null))[_0x4e22('0x26')](handleError(_0x5a1790,null));};exports[_0x4e22('0x5c')]=function(_0x40b1da,_0x3d0757,_0x137a57){if(_0x40b1da[_0x4e22('0x56')]['id']){delete _0x40b1da[_0x4e22('0x56')]['id'];}return db[_0x4e22('0x3a')]['findOne']({'where':{'id':_0x40b1da[_0x4e22('0x57')]['id']}})[_0x4e22('0x35')](handleEntityNotFound(_0x3d0757,null))[_0x4e22('0x35')](function(_0x492b97){if(_0x492b97){_0x40b1da[_0x4e22('0x56')]['AccountId']=_0x492b97['id'];_0x40b1da[_0x4e22('0x56')][_0x4e22('0x5d')]=integrations['getSubjects'](_0x40b1da[_0x4e22('0x56')][_0x4e22('0x5e')],_0x40b1da[_0x4e22('0x56')][_0x4e22('0x3d')]);_0x40b1da[_0x4e22('0x56')]['Descriptions']=integrations['getDescriptions'](_0x40b1da[_0x4e22('0x56')][_0x4e22('0x5e')],_0x40b1da[_0x4e22('0x56')][_0x4e22('0x3d')]);return db['VtigerConfiguration']['create'](_0x40b1da[_0x4e22('0x56')],{'include':[{'model':db[_0x4e22('0x5f')],'as':'Subjects'},{'model':db['VtigerField'],'as':_0x4e22('0x60')}]});}return null;})[_0x4e22('0x35')](respondWithResult(_0x3d0757,null))[_0x4e22('0x26')](handleError(_0x3d0757,null));};var md5=require(_0x4e22('0x61'));exports[_0x4e22('0x62')]=function(_0x4cfc0d,_0x480926,_0x585b8e){var _0x29be0b=null;var _0x82e7f7=null;var _0x1bcd36=null;var _0x256805=null;var _0x2fb00a='';return db['VtigerAccount'][_0x4e22('0x58')]({'where':{'id':_0x4cfc0d[_0x4e22('0x57')]['id']},'attributes':['id',_0x4e22('0x38'),'username',_0x4e22('0x63'),_0x4e22('0x64'),_0x4e22('0x65'),_0x4e22('0x66'),_0x4e22('0x67')]})[_0x4e22('0x35')](handleEntityNotFound(_0x480926,null))[_0x4e22('0x35')](function(_0x403ee0){if(_0x403ee0){_0x29be0b=_0x403ee0[_0x4e22('0x68')];_0x82e7f7=_0x403ee0[_0x4e22('0x67')];_0x1bcd36=_0x403ee0[_0x4e22('0x64')];_0x2fb00a=_0x403ee0[_0x4e22('0x65')];var _0x4c795b=_0x2fb00a[_0x4e22('0x69')](-0x1);if(_0x4c795b==='/'){_0x2fb00a=_0x2fb00a[_0x4e22('0x6a')](0x0,_0x2fb00a[_0x4e22('0x6b')](_0x4c795b));}_0x256805=util['format'](_0x4e22('0x6c'),_0x2fb00a);var _0x1602d1={'method':_0x4e22('0x6d'),'uri':_0x256805,'qs':{'operation':_0x4e22('0x6e'),'username':_0x403ee0[_0x4e22('0x68')]},'json':!![]};return rp(_0x1602d1);}})['then'](function(_0xfcbcb6){if(_0xfcbcb6[_0x4e22('0x6f')]){var _0x58c050={'method':_0x4e22('0x70'),'uri':_0x256805,'form':{'operation':_0x4e22('0x71'),'username':_0x29be0b,'accessKey':md5(_0xfcbcb6[_0x4e22('0x25')][_0x4e22('0x72')]+_0x82e7f7)},'json':!![]};return rp(_0x58c050);}})['then'](function(_0x397ff7){if(_0x397ff7['success']){var _0x1a38e9={'method':_0x4e22('0x6d'),'uri':_0x256805,'qs':{'operation':_0x4e22('0x73'),'username':_0x29be0b,'sessionName':_0x397ff7['result']['sessionName'],'elementType':_0x1bcd36},'json':!![]};return rp(_0x1a38e9);}})[_0x4e22('0x35')](function(_0x53eaf5){if(_0x53eaf5[_0x4e22('0x6f')]){var _0x113696=['autogenerated',_0x4e22('0x74'),_0x4e22('0x75')];_['remove'](_0x53eaf5['result'][_0x4e22('0x45')],function(_0x2ce4c9){return _0x113696[_0x4e22('0x76')](_0x2ce4c9['type'][_0x4e22('0x38')]);});_[_0x4e22('0x77')](_0x53eaf5['result'][_0x4e22('0x45')],function(_0x4a4d0b){return _0x4a4d0b[_0x4e22('0x78')]===_0x4e22('0x79');});return{'count':_0x53eaf5[_0x4e22('0x25')]['fields'][_0x4e22('0x46')],'rows':_['map'](_0x53eaf5['result'][_0x4e22('0x45')],function(_0x1d976d){return{'id':_0x1d976d['name'],'name':_0x1d976d[_0x4e22('0x7a')],'custom':_[_0x4e22('0x7b')](_0x1d976d['name'],'cf_')?!![]:![],'options':_0x1d976d['type']['name']===_0x4e22('0x7c')&&_0x1d976d[_0x4e22('0x3d')][_0x4e22('0x7d')][_0x4e22('0x46')]>0x0?_[_0x4e22('0x40')](_0x1d976d['type'][_0x4e22('0x7d')],function(_0x1035fe){return{'name':_0x1035fe[_0x4e22('0x7a')],'value':_0x1035fe[_0x4e22('0x7e')]};}):[]};})};}})['then'](respondWithResult(_0x480926,null))[_0x4e22('0x26')](function(_0xba06e5){console[_0x4e22('0x7f')](_0x4e22('0x80')+_0xba06e5);var _0x386ce1=_0x4cfc0d['query'][_0x4e22('0x81')]?0x1f4:_0xba06e5[_0x4e22('0x82')]||0x1f4;logger[_0x4e22('0x22')](_0x4e22('0x83'),_0x4e22('0x62'),_0x386ce1,JSON[_0x4e22('0x84')](_0xba06e5));delete _0xba06e5[_0x4e22('0x38')];if(_0x386ce1===0x191){_0x386ce1=0x190;}_0x480926[_0x4e22('0x28')](_0x386ce1)['send'](_0x4cfc0d['query']['test']?{'message':_0x4e22('0x85'),'statusCode':_0xba06e5['statusCode']}:_0xba06e5);});}; \ No newline at end of file +var _0x2dca=['sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','client','http','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','reject','update','destroy','end','name','VtigerAccount','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','map','filter','merge','options','includeAll','include','findAll','show','params','find','create','body','getConfigurations','findOne','VtigerConfiguration','addConfiguration','AccountId','Subjects','getDescriptions','channel','VtigerField','Descriptions','getFields','username','description','remoteUri','serverUrl','accessKey','slice','format','%s/webservice.php','GET','getchallenge','success','POST','login','describe','autogenerated','reference','owner','remove','includes','editable','false','label','startsWith','picklistValues','vTiger\x20error:\x20','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','send','Wrong\x20credentials','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path'];(function(_0x483102,_0x54e93d){var _0x5cc885=function(_0x54931c){while(--_0x54931c){_0x483102['push'](_0x483102['shift']());}};_0x5cc885(++_0x54e93d);}(_0x2dca,0x173));var _0xa2dc=function(_0x59c301,_0x359c50){_0x59c301=_0x59c301-0x0;var _0x3866b9=_0x2dca[_0x59c301];return _0x3866b9;};'use strict';var emlformat=require(_0xa2dc('0x0'));var rimraf=require(_0xa2dc('0x1'));var zipdir=require(_0xa2dc('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa2dc('0x3'));var moment=require('moment');var BPromise=require(_0xa2dc('0x4'));var Mustache=require(_0xa2dc('0x5'));var util=require('util');var path=require(_0xa2dc('0x6'));var sox=require(_0xa2dc('0x7'));var csv=require(_0xa2dc('0x8'));var ejs=require(_0xa2dc('0x9'));var fs=require('fs');var fs_extra=require(_0xa2dc('0xa'));var _=require(_0xa2dc('0xb'));var squel=require(_0xa2dc('0xc'));var crypto=require(_0xa2dc('0xd'));var jsforce=require(_0xa2dc('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xa2dc('0x8'));var querystring=require(_0xa2dc('0xf'));var Papa=require(_0xa2dc('0x10'));var Redis=require(_0xa2dc('0x11'));var authService=require(_0xa2dc('0x12'));var qs=require(_0xa2dc('0x13'));var as=require(_0xa2dc('0x14'));var hardwareService=require(_0xa2dc('0x15'));var logger=require(_0xa2dc('0x16'))('api');var utils=require(_0xa2dc('0x17'));var config=require(_0xa2dc('0x18'));var licenseUtil=require(_0xa2dc('0x19'));var db=require(_0xa2dc('0x1a'))['db'];var integrations=require(_0xa2dc('0x1b'));var jayson=require('jayson/promise');var client=jayson[_0xa2dc('0x1c')][_0xa2dc('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0xf4b93d,_0x15ef10,_0x6fddd,_0x4b59c3){return new BPromise(function(_0x1af6dc,_0x21418c){var _0x5eedee=_0x4b59c3||client;return _0x5eedee['request'](_0xf4b93d,_0x6fddd)[_0xa2dc('0x1e')](function(_0x2b3538){logger[_0xa2dc('0x1f')](_0xa2dc('0x20'),_0x15ef10,_0xa2dc('0x21'));logger[_0xa2dc('0x22')](_0xa2dc('0x23'),_0x15ef10,_0xa2dc('0x21'),JSON[_0xa2dc('0x24')](_0x2b3538));if(_0x2b3538[_0xa2dc('0x25')]){if(_0x2b3538['error']['code']===0x1f4){logger[_0xa2dc('0x25')]('VtigerAccount,\x20%s,\x20%s',_0x15ef10,_0x2b3538[_0xa2dc('0x25')][_0xa2dc('0x26')]);return _0x21418c(_0x2b3538[_0xa2dc('0x25')][_0xa2dc('0x26')]);}logger[_0xa2dc('0x25')](_0xa2dc('0x20'),_0x15ef10,_0x2b3538[_0xa2dc('0x25')][_0xa2dc('0x26')]);return _0x1af6dc(_0x2b3538[_0xa2dc('0x25')][_0xa2dc('0x26')]);}else{logger['info'](_0xa2dc('0x20'),_0x15ef10,_0xa2dc('0x21'));_0x1af6dc(_0x2b3538[_0xa2dc('0x27')][_0xa2dc('0x26')]);}})[_0xa2dc('0x28')](function(_0x170c43){logger[_0xa2dc('0x25')](_0xa2dc('0x20'),_0x15ef10,_0x170c43);_0x21418c(_0x170c43);});});}function respondWithStatusCode(_0x5e404b,_0x1b6f11){_0x1b6f11=_0x1b6f11||0xcc;return function(_0x320192){if(_0x320192){return _0x5e404b[_0xa2dc('0x29')](_0x1b6f11);}return _0x5e404b[_0xa2dc('0x2a')](_0x1b6f11)['end']();};}function respondWithResult(_0x1ee80e,_0x59644e){_0x59644e=_0x59644e||0xc8;return function(_0x40da9b){if(_0x40da9b){return _0x1ee80e[_0xa2dc('0x2a')](_0x59644e)[_0xa2dc('0x2b')](_0x40da9b);}};}function respondWithFilteredResult(_0x321cc5,_0x44069d){return function(_0x1d28aa){if(_0x1d28aa){var _0x317ad1=typeof _0x44069d['offset']===_0xa2dc('0x2c')&&typeof _0x44069d[_0xa2dc('0x2d')]===_0xa2dc('0x2c');var _0x1d5aba=_0x1d28aa[_0xa2dc('0x2e')];var _0x307b3c=_0x317ad1?0x0:_0x44069d[_0xa2dc('0x2f')];var _0x14d39e=_0x317ad1?_0x1d28aa[_0xa2dc('0x2e')]:_0x44069d[_0xa2dc('0x2f')]+_0x44069d[_0xa2dc('0x2d')];var _0x371f28;if(_0x14d39e>=_0x1d5aba){_0x14d39e=_0x1d5aba;_0x371f28=0xc8;}else{_0x371f28=0xce;}_0x321cc5[_0xa2dc('0x2a')](_0x371f28);return _0x321cc5[_0xa2dc('0x30')](_0xa2dc('0x31'),_0x307b3c+'-'+_0x14d39e+'/'+_0x1d5aba)[_0xa2dc('0x2b')](_0x1d28aa);}return null;};}function patchUpdates(_0x429eb8){return function(_0x8975c4){try{jsonpatch['apply'](_0x8975c4,_0x429eb8,!![]);}catch(_0x3f467e){return BPromise[_0xa2dc('0x32')](_0x3f467e);}return _0x8975c4['save']();};}function saveUpdates(_0xd0fa89,_0x186dd0){return function(_0x4beb90){if(_0x4beb90){return _0x4beb90[_0xa2dc('0x33')](_0xd0fa89)[_0xa2dc('0x1e')](function(_0x26ef99){return _0x26ef99;});}return null;};}function removeEntity(_0x85fe1a,_0x15f464){return function(_0x144da7){if(_0x144da7){return _0x144da7[_0xa2dc('0x34')]()[_0xa2dc('0x1e')](function(){_0x85fe1a[_0xa2dc('0x2a')](0xcc)[_0xa2dc('0x35')]();});}};}function handleEntityNotFound(_0x417700,_0x156710){return function(_0x5b589d){if(!_0x5b589d){_0x417700[_0xa2dc('0x29')](0x194);}return _0x5b589d;};}function handleError(_0xce7343,_0x4d05fb){_0x4d05fb=_0x4d05fb||0x1f4;return function(_0x4421e8){logger['error'](_0x4421e8['stack']);if(_0x4421e8[_0xa2dc('0x36')]){delete _0x4421e8['name'];}_0xce7343[_0xa2dc('0x2a')](_0x4d05fb)['send'](_0x4421e8);};}exports['index']=function(_0x120504,_0x4b2aaf){var _0x11cd3f={},_0x5193d8={},_0xaef3bb={'count':0x0,'rows':[]};var _0xda44=_['map'](db[_0xa2dc('0x37')][_0xa2dc('0x38')],function(_0x44ce2f){return{'name':_0x44ce2f[_0xa2dc('0x39')],'type':_0x44ce2f[_0xa2dc('0x3a')]['key']};});_0x5193d8[_0xa2dc('0x3b')]=_['map'](_0xda44,'name');_0x5193d8[_0xa2dc('0x3c')]=_[_0xa2dc('0x3d')](_0x120504[_0xa2dc('0x3c')]);_0x5193d8[_0xa2dc('0x3e')]=_['intersection'](_0x5193d8[_0xa2dc('0x3b')],_0x5193d8[_0xa2dc('0x3c')]);_0x11cd3f[_0xa2dc('0x3f')]=_[_0xa2dc('0x40')](_0x5193d8[_0xa2dc('0x3b')],qs[_0xa2dc('0x41')](_0x120504['query'][_0xa2dc('0x41')]));_0x11cd3f['attributes']=_0x11cd3f[_0xa2dc('0x3f')][_0xa2dc('0x42')]?_0x11cd3f[_0xa2dc('0x3f')]:_0x5193d8['model'];if(!_0x120504['query'][_0xa2dc('0x43')](_0xa2dc('0x44'))){_0x11cd3f[_0xa2dc('0x2d')]=qs['limit'](_0x120504[_0xa2dc('0x3c')][_0xa2dc('0x2d')]);_0x11cd3f[_0xa2dc('0x2f')]=qs[_0xa2dc('0x2f')](_0x120504[_0xa2dc('0x3c')][_0xa2dc('0x2f')]);}_0x11cd3f[_0xa2dc('0x45')]=qs['sort'](_0x120504[_0xa2dc('0x3c')][_0xa2dc('0x46')]);_0x11cd3f[_0xa2dc('0x47')]=qs[_0xa2dc('0x3e')](_[_0xa2dc('0x48')](_0x120504['query'],_0x5193d8['filters']),_0xda44);if(_0x120504['query']['filter']){_0x11cd3f[_0xa2dc('0x47')]=_['merge'](_0x11cd3f[_0xa2dc('0x47')],{'$or':_[_0xa2dc('0x49')](_0xda44,function(_0x3d3323){if(_0x3d3323[_0xa2dc('0x3a')]!=='VIRTUAL'){var _0x55a4ca={};_0x55a4ca[_0x3d3323[_0xa2dc('0x36')]]={'$like':'%'+_0x120504['query'][_0xa2dc('0x4a')]+'%'};return _0x55a4ca;}})});}_0x11cd3f=_[_0xa2dc('0x4b')]({},_0x11cd3f,_0x120504[_0xa2dc('0x4c')]);var _0x5adc0b={'where':_0x11cd3f[_0xa2dc('0x47')]};return db[_0xa2dc('0x37')]['count'](_0x5adc0b)[_0xa2dc('0x1e')](function(_0x559972){_0xaef3bb[_0xa2dc('0x2e')]=_0x559972;if(_0x120504[_0xa2dc('0x3c')][_0xa2dc('0x4d')]){_0x11cd3f[_0xa2dc('0x4e')]=[{'all':!![]}];}return db['VtigerAccount'][_0xa2dc('0x4f')](_0x11cd3f);})['then'](function(_0x103eb5){_0xaef3bb['rows']=_0x103eb5;return _0xaef3bb;})[_0xa2dc('0x1e')](respondWithFilteredResult(_0x4b2aaf,_0x11cd3f))[_0xa2dc('0x28')](handleError(_0x4b2aaf,null));};exports[_0xa2dc('0x50')]=function(_0x4f8f01,_0x4b3ae9){var _0x347be8={'raw':![],'where':{'id':_0x4f8f01[_0xa2dc('0x51')]['id']}},_0x1e9f7f={};_0x1e9f7f[_0xa2dc('0x3b')]=_['keys'](db[_0xa2dc('0x37')][_0xa2dc('0x38')]);_0x1e9f7f['query']=_[_0xa2dc('0x3d')](_0x4f8f01['query']);_0x1e9f7f[_0xa2dc('0x3e')]=_[_0xa2dc('0x40')](_0x1e9f7f[_0xa2dc('0x3b')],_0x1e9f7f[_0xa2dc('0x3c')]);_0x347be8[_0xa2dc('0x3f')]=_['intersection'](_0x1e9f7f[_0xa2dc('0x3b')],qs[_0xa2dc('0x41')](_0x4f8f01[_0xa2dc('0x3c')][_0xa2dc('0x41')]));_0x347be8[_0xa2dc('0x3f')]=_0x347be8[_0xa2dc('0x3f')][_0xa2dc('0x42')]?_0x347be8[_0xa2dc('0x3f')]:_0x1e9f7f[_0xa2dc('0x3b')];if(_0x4f8f01[_0xa2dc('0x3c')][_0xa2dc('0x4d')]){_0x347be8[_0xa2dc('0x4e')]=[{'all':!![]}];}_0x347be8=_[_0xa2dc('0x4b')]({},_0x347be8,_0x4f8f01['options']);return db[_0xa2dc('0x37')][_0xa2dc('0x52')](_0x347be8)[_0xa2dc('0x1e')](handleEntityNotFound(_0x4b3ae9,null))['then'](respondWithResult(_0x4b3ae9,null))[_0xa2dc('0x28')](handleError(_0x4b3ae9,null));};exports[_0xa2dc('0x53')]=function(_0x332686,_0x1fdb95){return db['VtigerAccount'][_0xa2dc('0x53')](_0x332686['body'],{})[_0xa2dc('0x1e')](respondWithResult(_0x1fdb95,0xc9))[_0xa2dc('0x28')](handleError(_0x1fdb95,null));};exports[_0xa2dc('0x33')]=function(_0x781474,_0x240ba7){if(_0x781474[_0xa2dc('0x54')]['id']){delete _0x781474[_0xa2dc('0x54')]['id'];}return db[_0xa2dc('0x37')][_0xa2dc('0x52')]({'where':{'id':_0x781474[_0xa2dc('0x51')]['id']}})[_0xa2dc('0x1e')](handleEntityNotFound(_0x240ba7,null))['then'](saveUpdates(_0x781474['body'],null))[_0xa2dc('0x1e')](respondWithResult(_0x240ba7,null))[_0xa2dc('0x28')](handleError(_0x240ba7,null));};exports[_0xa2dc('0x34')]=function(_0x111a10,_0xfc134c){return db[_0xa2dc('0x37')][_0xa2dc('0x52')]({'where':{'id':_0x111a10[_0xa2dc('0x51')]['id']}})['then'](handleEntityNotFound(_0xfc134c,null))[_0xa2dc('0x1e')](removeEntity(_0xfc134c,null))[_0xa2dc('0x28')](handleError(_0xfc134c,null));};exports[_0xa2dc('0x55')]=function(_0x45fa67,_0x475be6,_0x3fb858){var _0x5f4a64={};var _0xc240bd={};var _0x4e0499;var _0x5dece6;return db[_0xa2dc('0x37')][_0xa2dc('0x56')]({'where':{'id':_0x45fa67[_0xa2dc('0x51')]['id']}})[_0xa2dc('0x1e')](handleEntityNotFound(_0x475be6,null))[_0xa2dc('0x1e')](function(_0x3aaeec){if(_0x3aaeec){_0x4e0499=_0x3aaeec;_0xc240bd[_0xa2dc('0x3b')]=_[_0xa2dc('0x3d')](db[_0xa2dc('0x57')][_0xa2dc('0x38')]);_0xc240bd[_0xa2dc('0x3c')]=_['keys'](_0x45fa67[_0xa2dc('0x3c')]);_0xc240bd[_0xa2dc('0x3e')]=_[_0xa2dc('0x40')](_0xc240bd['model'],_0xc240bd[_0xa2dc('0x3c')]);_0x5f4a64[_0xa2dc('0x3f')]=_[_0xa2dc('0x40')](_0xc240bd[_0xa2dc('0x3b')],qs[_0xa2dc('0x41')](_0x45fa67[_0xa2dc('0x3c')][_0xa2dc('0x41')]));_0x5f4a64[_0xa2dc('0x3f')]=_0x5f4a64[_0xa2dc('0x3f')][_0xa2dc('0x42')]?_0x5f4a64[_0xa2dc('0x3f')]:_0xc240bd['model'];_0x5f4a64[_0xa2dc('0x45')]=qs['sort'](_0x45fa67['query']['sort']);_0x5f4a64['where']=qs[_0xa2dc('0x3e')](_['pick'](_0x45fa67[_0xa2dc('0x3c')],_0xc240bd[_0xa2dc('0x3e')]));if(_0x45fa67[_0xa2dc('0x3c')][_0xa2dc('0x4a')]){_0x5f4a64[_0xa2dc('0x47')]=_[_0xa2dc('0x4b')](_0x5f4a64[_0xa2dc('0x47')],{'$or':_[_0xa2dc('0x49')](_0x5f4a64[_0xa2dc('0x3f')],function(_0x1fd7b1){var _0x2ebb24={};_0x2ebb24[_0x1fd7b1]={'$like':'%'+_0x45fa67[_0xa2dc('0x3c')]['filter']+'%'};return _0x2ebb24;})});}_0x5f4a64=_[_0xa2dc('0x4b')]({},_0x5f4a64,_0x45fa67[_0xa2dc('0x4c')]);return _0x4e0499[_0xa2dc('0x55')](_0x5f4a64);}})[_0xa2dc('0x1e')](function(_0x443fe6){if(_0x443fe6){_0x5dece6=_0x443fe6[_0xa2dc('0x42')];if(!_0x45fa67[_0xa2dc('0x3c')]['hasOwnProperty'](_0xa2dc('0x44'))){_0x5f4a64['limit']=qs[_0xa2dc('0x2d')](_0x45fa67[_0xa2dc('0x3c')]['limit']);_0x5f4a64[_0xa2dc('0x2f')]=qs['offset'](_0x45fa67[_0xa2dc('0x3c')]['offset']);}return _0x4e0499[_0xa2dc('0x55')](_0x5f4a64);}})[_0xa2dc('0x1e')](function(_0x31e87d){if(_0x31e87d){return _0x31e87d?{'count':_0x5dece6,'rows':_0x31e87d}:null;}})[_0xa2dc('0x1e')](respondWithResult(_0x475be6,null))[_0xa2dc('0x28')](handleError(_0x475be6,null));};exports[_0xa2dc('0x58')]=function(_0x4a4a0c,_0x5e1893,_0x2bb2ff){if(_0x4a4a0c[_0xa2dc('0x54')]['id']){delete _0x4a4a0c[_0xa2dc('0x54')]['id'];}return db[_0xa2dc('0x37')][_0xa2dc('0x56')]({'where':{'id':_0x4a4a0c[_0xa2dc('0x51')]['id']}})[_0xa2dc('0x1e')](handleEntityNotFound(_0x5e1893,null))['then'](function(_0x8be705){if(_0x8be705){_0x4a4a0c['body'][_0xa2dc('0x59')]=_0x8be705['id'];_0x4a4a0c[_0xa2dc('0x54')][_0xa2dc('0x5a')]=integrations['getSubjects'](_0x4a4a0c[_0xa2dc('0x54')]['channel'],_0x4a4a0c['body']['type']);_0x4a4a0c[_0xa2dc('0x54')]['Descriptions']=integrations[_0xa2dc('0x5b')](_0x4a4a0c[_0xa2dc('0x54')][_0xa2dc('0x5c')],_0x4a4a0c[_0xa2dc('0x54')][_0xa2dc('0x3a')]);return db[_0xa2dc('0x57')][_0xa2dc('0x53')](_0x4a4a0c['body'],{'include':[{'model':db[_0xa2dc('0x5d')],'as':_0xa2dc('0x5a')},{'model':db[_0xa2dc('0x5d')],'as':_0xa2dc('0x5e')}]});}return null;})[_0xa2dc('0x1e')](respondWithResult(_0x5e1893,null))[_0xa2dc('0x28')](handleError(_0x5e1893,null));};var md5=require('md5');exports[_0xa2dc('0x5f')]=function(_0x49f777,_0x509b39,_0x46413f){var _0x316c88=null;var _0x2152e8=null;var _0x3f7ae9=null;var _0x1eaa7b=null;var _0x18c8b4='';return db['VtigerAccount']['findOne']({'where':{'id':_0x49f777[_0xa2dc('0x51')]['id']},'attributes':['id',_0xa2dc('0x36'),_0xa2dc('0x60'),_0xa2dc('0x61'),'moduleName',_0xa2dc('0x62'),_0xa2dc('0x63'),'accessKey']})[_0xa2dc('0x1e')](handleEntityNotFound(_0x509b39,null))[_0xa2dc('0x1e')](function(_0x2b9855){if(_0x2b9855){_0x316c88=_0x2b9855[_0xa2dc('0x60')];_0x2152e8=_0x2b9855[_0xa2dc('0x64')];_0x3f7ae9=_0x2b9855['moduleName'];_0x18c8b4=_0x2b9855[_0xa2dc('0x62')];var _0x43367c=_0x18c8b4[_0xa2dc('0x65')](-0x1);if(_0x43367c==='/'){_0x18c8b4=_0x18c8b4['substring'](0x0,_0x18c8b4['lastIndexOf'](_0x43367c));}_0x1eaa7b=util[_0xa2dc('0x66')](_0xa2dc('0x67'),_0x18c8b4);var _0x331327={'method':_0xa2dc('0x68'),'uri':_0x1eaa7b,'qs':{'operation':_0xa2dc('0x69'),'username':_0x2b9855[_0xa2dc('0x60')]},'json':!![]};return rp(_0x331327);}})['then'](function(_0x9809b0){if(_0x9809b0[_0xa2dc('0x6a')]){var _0x5e1d69={'method':_0xa2dc('0x6b'),'uri':_0x1eaa7b,'form':{'operation':_0xa2dc('0x6c'),'username':_0x316c88,'accessKey':md5(_0x9809b0['result']['token']+_0x2152e8)},'json':!![]};return rp(_0x5e1d69);}})[_0xa2dc('0x1e')](function(_0x40f5aa){if(_0x40f5aa[_0xa2dc('0x6a')]){var _0x32ee0e={'method':_0xa2dc('0x68'),'uri':_0x1eaa7b,'qs':{'operation':_0xa2dc('0x6d'),'username':_0x316c88,'sessionName':_0x40f5aa[_0xa2dc('0x27')]['sessionName'],'elementType':_0x3f7ae9},'json':!![]};return rp(_0x32ee0e);}})[_0xa2dc('0x1e')](function(_0x4cadea){if(_0x4cadea[_0xa2dc('0x6a')]){var _0x159b12=[_0xa2dc('0x6e'),_0xa2dc('0x6f'),_0xa2dc('0x70')];_[_0xa2dc('0x71')](_0x4cadea[_0xa2dc('0x27')][_0xa2dc('0x41')],function(_0x254c09){return _0x159b12[_0xa2dc('0x72')](_0x254c09[_0xa2dc('0x3a')][_0xa2dc('0x36')]);});_[_0xa2dc('0x71')](_0x4cadea[_0xa2dc('0x27')]['fields'],function(_0x5d31e9){return _0x5d31e9[_0xa2dc('0x73')]===_0xa2dc('0x74');});return{'count':_0x4cadea[_0xa2dc('0x27')][_0xa2dc('0x41')][_0xa2dc('0x42')],'rows':_[_0xa2dc('0x49')](_0x4cadea[_0xa2dc('0x27')]['fields'],function(_0x3e0496){return{'id':_0x3e0496[_0xa2dc('0x36')],'name':_0x3e0496[_0xa2dc('0x75')],'custom':_[_0xa2dc('0x76')](_0x3e0496[_0xa2dc('0x36')],'cf_')?!![]:![],'options':_0x3e0496['type']['name']==='picklist'&&_0x3e0496[_0xa2dc('0x3a')][_0xa2dc('0x77')]['length']>0x0?_[_0xa2dc('0x49')](_0x3e0496['type'][_0xa2dc('0x77')],function(_0x2c1f0e){return{'name':_0x2c1f0e[_0xa2dc('0x75')],'value':_0x2c1f0e['value']};}):[]};})};}})[_0xa2dc('0x1e')](respondWithResult(_0x509b39,null))['catch'](function(_0x517fa4){console['log'](_0xa2dc('0x78')+_0x517fa4);var _0x2100ed=_0x49f777[_0xa2dc('0x3c')][_0xa2dc('0x79')]?0x1f4:_0x517fa4[_0xa2dc('0x7a')]||0x1f4;logger['error'](_0xa2dc('0x7b'),'getFields',_0x2100ed,JSON[_0xa2dc('0x24')](_0x517fa4));delete _0x517fa4[_0xa2dc('0x36')];if(_0x2100ed===0x191){_0x2100ed=0x190;}_0x509b39['status'](_0x2100ed)[_0xa2dc('0x7c')](_0x49f777[_0xa2dc('0x3c')]['test']?{'message':_0xa2dc('0x7d'),'statusCode':_0x517fa4['statusCode']}:_0x517fa4);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index 3539691..ff005a4 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 _0x6b3b=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','VtigerAccount','int_vtiger_accounts','lodash','util','../../config/logger'];(function(_0x501cee,_0x5aa128){var _0x5c6deb=function(_0xdb515){while(--_0xdb515){_0x501cee['push'](_0x501cee['shift']());}};_0x5c6deb(++_0x5aa128);}(_0x6b3b,0xb3));var _0xb6b3=function(_0xee0d98,_0x1e4d5f){_0xee0d98=_0xee0d98-0x0;var _0xb048b2=_0x6b3b[_0xee0d98];return _0xb048b2;};'use strict';var _=require(_0xb6b3('0x0'));var util=require(_0xb6b3('0x1'));var logger=require(_0xb6b3('0x2'))(_0xb6b3('0x3'));var moment=require(_0xb6b3('0x4'));var BPromise=require(_0xb6b3('0x5'));var rp=require(_0xb6b3('0x6'));var fs=require('fs');var path=require(_0xb6b3('0x7'));var rimraf=require(_0xb6b3('0x8'));var config=require(_0xb6b3('0x9'));var attributes=require('./intVtigerAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0xb6b3('0xa')]=function(_0x49cff7,_0x47ec8f){return _0x49cff7[_0xb6b3('0xb')](_0xb6b3('0xc'),attributes,{'tableName':_0xb6b3('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfe90=['request-promise','path','rimraf','./intVtigerAccount.attributes','exports','define','int_vtiger_accounts','lodash','util','../../config/logger','moment','bluebird'];(function(_0x13e29f,_0x5628f0){var _0x158348=function(_0x30b483){while(--_0x30b483){_0x13e29f['push'](_0x13e29f['shift']());}};_0x158348(++_0x5628f0);}(_0xfe90,0x17b));var _0x0fe9=function(_0x17a065,_0x57dc4d){_0x17a065=_0x17a065-0x0;var _0x222ba0=_0xfe90[_0x17a065];return _0x222ba0;};'use strict';var _=require(_0x0fe9('0x0'));var util=require(_0x0fe9('0x1'));var logger=require(_0x0fe9('0x2'))('api');var moment=require(_0x0fe9('0x3'));var BPromise=require(_0x0fe9('0x4'));var rp=require(_0x0fe9('0x5'));var fs=require('fs');var path=require(_0x0fe9('0x6'));var rimraf=require(_0x0fe9('0x7'));var config=require('../../config/environment');var attributes=require(_0x0fe9('0x8'));var integrations=require('../../components/integrations/configuration');module[_0x0fe9('0x9')]=function(_0x2a9de3,_0x5f3b8f){return _0x2a9de3[_0x0fe9('0xa')]('VtigerAccount',attributes,{'tableName':_0x0fe9('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 95878de..8ac760f 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 _0xbee3=['VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','error','code','message','catch','GetVtigerAccount','VtigerAccount','findAll','options','raw','limit','include','map','model','attributes','stringify','where','ShowVtigerAccount','util','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info'];(function(_0x589f71,_0x212326){var _0x5763bd=function(_0x2cb8e1){while(--_0x2cb8e1){_0x589f71['push'](_0x589f71['shift']());}};_0x5763bd(++_0x212326);}(_0xbee3,0xd5));var _0x3bee=function(_0x2aec7e,_0xc05d83){_0x2aec7e=_0x2aec7e-0x0;var _0x31d282=_0xbee3[_0x2aec7e];return _0x31d282;};'use strict';var _=require('lodash');var util=require(_0x3bee('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x3bee('0x1'));var fs=require('fs');var Redis=require(_0x3bee('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x3bee('0x3'));var logger=require(_0x3bee('0x4'))(_0x3bee('0x5'));var config=require('../../config/environment');var jayson=require(_0x3bee('0x6'));var client=jayson[_0x3bee('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2fdeec,_0x28d912,_0x1b510d){return new BPromise(function(_0x339223,_0xbdd5d5){return client[_0x3bee('0x8')](_0x2fdeec,_0x1b510d)[_0x3bee('0x9')](function(_0x518e2d){logger[_0x3bee('0xa')](_0x3bee('0xb'),_0x28d912,_0x3bee('0xc'));logger[_0x3bee('0xd')](_0x3bee('0xe'),_0x28d912,_0x3bee('0xc'),JSON['stringify'](_0x518e2d));if(_0x518e2d[_0x3bee('0xf')]){if(_0x518e2d['error'][_0x3bee('0x10')]===0x1f4){logger[_0x3bee('0xf')](_0x3bee('0xb'),_0x28d912,_0x518e2d[_0x3bee('0xf')][_0x3bee('0x11')]);return _0xbdd5d5(_0x518e2d[_0x3bee('0xf')][_0x3bee('0x11')]);}logger['error'](_0x3bee('0xb'),_0x28d912,_0x518e2d[_0x3bee('0xf')][_0x3bee('0x11')]);return _0x339223(_0x518e2d[_0x3bee('0xf')][_0x3bee('0x11')]);}else{logger['info']('VtigerAccount,\x20%s,\x20%s',_0x28d912,_0x3bee('0xc'));_0x339223(_0x518e2d['result'][_0x3bee('0x11')]);}})[_0x3bee('0x12')](function(_0x57d42c){logger['error'](_0x3bee('0xb'),_0x28d912,_0x57d42c);_0xbdd5d5(_0x57d42c);});});}exports[_0x3bee('0x13')]=function(_0xfdba3b){var _0x631ff8=this;return new Promise(function(_0x49095a,_0x30a1de){return db[_0x3bee('0x14')][_0x3bee('0x15')]({'raw':_0xfdba3b[_0x3bee('0x16')]?_0xfdba3b[_0x3bee('0x16')][_0x3bee('0x17')]===undefined?!![]:![]:!![],'where':_0xfdba3b[_0x3bee('0x16')]?_0xfdba3b['options']['where']||null:null,'attributes':_0xfdba3b[_0x3bee('0x16')]?_0xfdba3b[_0x3bee('0x16')]['attributes']||null:null,'limit':_0xfdba3b[_0x3bee('0x16')]?_0xfdba3b[_0x3bee('0x16')][_0x3bee('0x18')]||null:null,'include':_0xfdba3b[_0x3bee('0x16')]?_0xfdba3b[_0x3bee('0x16')][_0x3bee('0x19')]?_[_0x3bee('0x1a')](_0xfdba3b['options'][_0x3bee('0x19')],function(_0x1ed0c1){return{'model':db[_0x1ed0c1[_0x3bee('0x1b')]],'as':_0x1ed0c1['as'],'attributes':_0x1ed0c1[_0x3bee('0x1c')],'include':_0x1ed0c1['include']?_[_0x3bee('0x1a')](_0x1ed0c1[_0x3bee('0x19')],function(_0x1e0111){return{'model':db[_0x1e0111['model']],'as':_0x1e0111['as'],'attributes':_0x1e0111['attributes'],'include':_0x1e0111[_0x3bee('0x19')]?_[_0x3bee('0x1a')](_0x1e0111['include'],function(_0x2c0e50){return{'model':db[_0x2c0e50[_0x3bee('0x1b')]],'as':_0x2c0e50['as'],'attributes':_0x2c0e50[_0x3bee('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1984c4){logger[_0x3bee('0xa')](_0x3bee('0x13'),_0xfdba3b);logger['debug'](_0x3bee('0x13'),_0xfdba3b,JSON[_0x3bee('0x1d')](_0x1984c4));_0x49095a(_0x1984c4);})[_0x3bee('0x12')](function(_0x496abd){logger[_0x3bee('0xf')](_0x3bee('0x13'),_0x496abd[_0x3bee('0x11')],_0xfdba3b);_0x30a1de(_0x631ff8[_0x3bee('0xf')](0x1f4,_0x496abd[_0x3bee('0x11')]));});});};exports['ShowVtigerAccount']=function(_0x564e45){var _0x3fbc8c=this;return new Promise(function(_0x1e1529,_0x10bae0){return db[_0x3bee('0x14')]['find']({'raw':_0x564e45['options']?_0x564e45[_0x3bee('0x16')][_0x3bee('0x17')]===undefined?!![]:![]:!![],'where':_0x564e45['options']?_0x564e45['options'][_0x3bee('0x1e')]||null:null,'attributes':_0x564e45[_0x3bee('0x16')]?_0x564e45[_0x3bee('0x16')][_0x3bee('0x1c')]||null:null,'include':_0x564e45[_0x3bee('0x16')]?_0x564e45[_0x3bee('0x16')][_0x3bee('0x19')]?_[_0x3bee('0x1a')](_0x564e45[_0x3bee('0x16')][_0x3bee('0x19')],function(_0x569675){return{'model':db[_0x569675['model']],'as':_0x569675['as'],'attributes':_0x569675[_0x3bee('0x1c')],'include':_0x569675['include']?_['map'](_0x569675[_0x3bee('0x19')],function(_0x1bc332){return{'model':db[_0x1bc332[_0x3bee('0x1b')]],'as':_0x1bc332['as'],'attributes':_0x1bc332[_0x3bee('0x1c')],'include':_0x1bc332[_0x3bee('0x19')]?_[_0x3bee('0x1a')](_0x1bc332[_0x3bee('0x19')],function(_0x10ace5){return{'model':db[_0x10ace5['model']],'as':_0x10ace5['as'],'attributes':_0x10ace5[_0x3bee('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x3bee('0x9')](function(_0x5f046a){logger[_0x3bee('0xa')](_0x3bee('0x1f'),_0x564e45);logger[_0x3bee('0xd')](_0x3bee('0x1f'),_0x564e45,JSON[_0x3bee('0x1d')](_0x5f046a));_0x1e1529(_0x5f046a);})['catch'](function(_0x57a895){logger[_0x3bee('0xf')](_0x3bee('0x1f'),_0x57a895[_0x3bee('0x11')],_0x564e45);_0x10bae0(_0x3fbc8c[_0x3bee('0xf')](0x1f4,_0x57a895[_0x3bee('0x11')]));});});}; \ No newline at end of file +var _0x57f8=['request','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetVtigerAccount','VtigerAccount','options','where','attributes','include','model','map','debug','ShowVtigerAccount','find','raw','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x532b87,_0x42c452){var _0xc24abd=function(_0x3a423f){while(--_0x3a423f){_0x532b87['push'](_0x532b87['shift']());}};_0xc24abd(++_0x42c452);}(_0x57f8,0x198));var _0x857f=function(_0x18c284,_0x1cd679){_0x18c284=_0x18c284-0x0;var _0x2fdf50=_0x57f8[_0x18c284];return _0x2fdf50;};'use strict';var _=require('lodash');var util=require(_0x857f('0x0'));var moment=require(_0x857f('0x1'));var BPromise=require(_0x857f('0x2'));var rs=require(_0x857f('0x3'));var fs=require('fs');var Redis=require(_0x857f('0x4'));var db=require(_0x857f('0x5'))['db'];var utils=require(_0x857f('0x6'));var logger=require(_0x857f('0x7'))(_0x857f('0x8'));var config=require(_0x857f('0x9'));var jayson=require(_0x857f('0xa'));var client=jayson[_0x857f('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x8380e8,_0x197098,_0x1aaeea){return new BPromise(function(_0x577fc3,_0x5f6a66){return client[_0x857f('0xc')](_0x8380e8,_0x1aaeea)[_0x857f('0xd')](function(_0x4f2b09){logger[_0x857f('0xe')](_0x857f('0xf'),_0x197098,_0x857f('0x10'));logger['debug'](_0x857f('0x11'),_0x197098,_0x857f('0x10'),JSON[_0x857f('0x12')](_0x4f2b09));if(_0x4f2b09[_0x857f('0x13')]){if(_0x4f2b09[_0x857f('0x13')][_0x857f('0x14')]===0x1f4){logger[_0x857f('0x13')]('VtigerAccount,\x20%s,\x20%s',_0x197098,_0x4f2b09[_0x857f('0x13')][_0x857f('0x15')]);return _0x5f6a66(_0x4f2b09[_0x857f('0x13')][_0x857f('0x15')]);}logger[_0x857f('0x13')]('VtigerAccount,\x20%s,\x20%s',_0x197098,_0x4f2b09['error'][_0x857f('0x15')]);return _0x577fc3(_0x4f2b09['error'][_0x857f('0x15')]);}else{logger['info'](_0x857f('0xf'),_0x197098,_0x857f('0x10'));_0x577fc3(_0x4f2b09['result'][_0x857f('0x15')]);}})[_0x857f('0x16')](function(_0xdf14fe){logger[_0x857f('0x13')](_0x857f('0xf'),_0x197098,_0xdf14fe);_0x5f6a66(_0xdf14fe);});});}exports[_0x857f('0x17')]=function(_0x1a9ef8){var _0x429e23=this;return new Promise(function(_0x1014ca,_0x38a242){return db[_0x857f('0x18')]['findAll']({'raw':_0x1a9ef8[_0x857f('0x19')]?_0x1a9ef8[_0x857f('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x1a9ef8[_0x857f('0x19')]?_0x1a9ef8[_0x857f('0x19')][_0x857f('0x1a')]||null:null,'attributes':_0x1a9ef8['options']?_0x1a9ef8['options'][_0x857f('0x1b')]||null:null,'limit':_0x1a9ef8[_0x857f('0x19')]?_0x1a9ef8[_0x857f('0x19')]['limit']||null:null,'include':_0x1a9ef8[_0x857f('0x19')]?_0x1a9ef8[_0x857f('0x19')][_0x857f('0x1c')]?_['map'](_0x1a9ef8[_0x857f('0x19')][_0x857f('0x1c')],function(_0x50bfb7){return{'model':db[_0x50bfb7[_0x857f('0x1d')]],'as':_0x50bfb7['as'],'attributes':_0x50bfb7[_0x857f('0x1b')],'include':_0x50bfb7[_0x857f('0x1c')]?_[_0x857f('0x1e')](_0x50bfb7[_0x857f('0x1c')],function(_0x3b23a7){return{'model':db[_0x3b23a7[_0x857f('0x1d')]],'as':_0x3b23a7['as'],'attributes':_0x3b23a7[_0x857f('0x1b')],'include':_0x3b23a7[_0x857f('0x1c')]?_[_0x857f('0x1e')](_0x3b23a7[_0x857f('0x1c')],function(_0x4782ab){return{'model':db[_0x4782ab[_0x857f('0x1d')]],'as':_0x4782ab['as'],'attributes':_0x4782ab[_0x857f('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x17e415){logger[_0x857f('0xe')](_0x857f('0x17'),_0x1a9ef8);logger[_0x857f('0x1f')]('GetVtigerAccount',_0x1a9ef8,JSON[_0x857f('0x12')](_0x17e415));_0x1014ca(_0x17e415);})['catch'](function(_0x1b405a){logger[_0x857f('0x13')](_0x857f('0x17'),_0x1b405a[_0x857f('0x15')],_0x1a9ef8);_0x38a242(_0x429e23[_0x857f('0x13')](0x1f4,_0x1b405a[_0x857f('0x15')]));});});};exports[_0x857f('0x20')]=function(_0xe79241){var _0x17e7b6=this;return new Promise(function(_0x41f832,_0x24adc2){return db[_0x857f('0x18')][_0x857f('0x21')]({'raw':_0xe79241['options']?_0xe79241[_0x857f('0x19')][_0x857f('0x22')]===undefined?!![]:![]:!![],'where':_0xe79241['options']?_0xe79241[_0x857f('0x19')][_0x857f('0x1a')]||null:null,'attributes':_0xe79241['options']?_0xe79241[_0x857f('0x19')][_0x857f('0x1b')]||null:null,'include':_0xe79241['options']?_0xe79241[_0x857f('0x19')][_0x857f('0x1c')]?_[_0x857f('0x1e')](_0xe79241[_0x857f('0x19')]['include'],function(_0x596b2f){return{'model':db[_0x596b2f[_0x857f('0x1d')]],'as':_0x596b2f['as'],'attributes':_0x596b2f[_0x857f('0x1b')],'include':_0x596b2f['include']?_[_0x857f('0x1e')](_0x596b2f['include'],function(_0x1ff000){return{'model':db[_0x1ff000[_0x857f('0x1d')]],'as':_0x1ff000['as'],'attributes':_0x1ff000[_0x857f('0x1b')],'include':_0x1ff000[_0x857f('0x1c')]?_[_0x857f('0x1e')](_0x1ff000['include'],function(_0x47cfed){return{'model':db[_0x47cfed[_0x857f('0x1d')]],'as':_0x47cfed['as'],'attributes':_0x47cfed['attributes']};}):[]};}):[]};}):[]:[]})[_0x857f('0xd')](function(_0x227602){logger[_0x857f('0xe')]('ShowVtigerAccount',_0xe79241);logger[_0x857f('0x1f')](_0x857f('0x20'),_0xe79241,JSON[_0x857f('0x12')](_0x227602));_0x41f832(_0x227602);})[_0x857f('0x16')](function(_0x36e6bd){logger[_0x857f('0x13')](_0x857f('0x20'),_0x36e6bd['message'],_0xe79241);_0x24adc2(_0x17e7b6[_0x857f('0x13')](0x1f4,_0x36e6bd[_0x857f('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index f5265f7..1386ad5 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 _0x9d8e=['exports','multer','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','get','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getDescriptions','post','create','put','update','destroy'];(function(_0x42024,_0x4b0cef){var _0x2b7b0f=function(_0x4558fe){while(--_0x4558fe){_0x42024['push'](_0x42024['shift']());}};_0x2b7b0f(++_0x4b0cef);}(_0x9d8e,0x8d));var _0xe9d8=function(_0x5d69c0,_0x2aadef){_0x5d69c0=_0x5d69c0-0x0;var _0x25dac2=_0x9d8e[_0x5d69c0];return _0x25dac2;};'use strict';var multer=require(_0xe9d8('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xe9d8('0x1'));var express=require(_0xe9d8('0x2'));var router=express['Router']();var fs_extra=require(_0xe9d8('0x3'));var auth=require(_0xe9d8('0x4'));var interaction=require(_0xe9d8('0x5'));var config=require('../../config/environment');var controller=require('./intVtigerConfiguration.controller');router[_0xe9d8('0x6')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xe9d8('0x7'),auth[_0xe9d8('0x8')](),controller[_0xe9d8('0x9')]);router[_0xe9d8('0x6')](_0xe9d8('0xa'),auth['isAuthenticated'](),controller[_0xe9d8('0xb')]);router['get'](_0xe9d8('0xc'),auth['isAuthenticated'](),controller['getSubjects']);router[_0xe9d8('0x6')]('/:id/descriptions',auth[_0xe9d8('0x8')](),controller[_0xe9d8('0xd')]);router[_0xe9d8('0xe')]('/',auth[_0xe9d8('0x8')](),controller[_0xe9d8('0xf')]);router[_0xe9d8('0x10')](_0xe9d8('0x7'),auth[_0xe9d8('0x8')](),controller[_0xe9d8('0x11')]);router['delete'](_0xe9d8('0x7'),auth[_0xe9d8('0x8')](),controller[_0xe9d8('0x12')]);module[_0xe9d8('0x13')]=router; \ No newline at end of file +var _0x03a7=['post','create','put','/:id','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','get','isAuthenticated','show','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x03a7,0x10c));var _0x703a=function(_0xcf40ef,_0x427859){_0xcf40ef=_0xcf40ef-0x0;var _0x49bdd5=_0x03a7[_0xcf40ef];return _0x49bdd5;};'use strict';var multer=require(_0x703a('0x0'));var util=require('util');var path=require(_0x703a('0x1'));var timeout=require(_0x703a('0x2'));var express=require(_0x703a('0x3'));var router=express[_0x703a('0x4')]();var fs_extra=require(_0x703a('0x5'));var auth=require(_0x703a('0x6'));var interaction=require(_0x703a('0x7'));var config=require(_0x703a('0x8'));var controller=require(_0x703a('0x9'));router[_0x703a('0xa')]('/',auth[_0x703a('0xb')](),controller['index']);router[_0x703a('0xa')]('/:id',auth[_0x703a('0xb')](),controller[_0x703a('0xc')]);router[_0x703a('0xa')]('/:id/fields',auth[_0x703a('0xb')](),controller[_0x703a('0xd')]);router[_0x703a('0xa')](_0x703a('0xe'),auth[_0x703a('0xb')](),controller[_0x703a('0xf')]);router[_0x703a('0xa')](_0x703a('0x10'),auth['isAuthenticated'](),controller[_0x703a('0x11')]);router[_0x703a('0x12')]('/',auth[_0x703a('0xb')](),controller[_0x703a('0x13')]);router[_0x703a('0x14')](_0x703a('0x15'),auth[_0x703a('0xb')](),controller[_0x703a('0x16')]);router[_0x703a('0x17')](_0x703a('0x15'),auth[_0x703a('0xb')](),controller[_0x703a('0x18')]);module[_0x703a('0x19')]=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index 876948f..c6e18c1 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 _0xd5fa=['sequelize','exports','STRING'];(function(_0x160d74,_0x248109){var _0x3ff5aa=function(_0x20c36e){while(--_0x20c36e){_0x160d74['push'](_0x160d74['shift']());}};_0x3ff5aa(++_0x248109);}(_0xd5fa,0xc9));var _0xad5f=function(_0x16aa23,_0x1eab3a){_0x16aa23=_0x16aa23-0x0;var _0x49c9d1=_0xd5fa[_0x16aa23];return _0x49c9d1;};'use strict';var Sequelize=require(_0xad5f('0x0'));module[_0xad5f('0x1')]={'name':{'type':Sequelize[_0xad5f('0x2')]},'description':{'type':Sequelize[_0xad5f('0x2')]}}; \ No newline at end of file +var _0x8bda=['sequelize','exports','STRING'];(function(_0x299936,_0x165f06){var _0x46a377=function(_0x21350d){while(--_0x21350d){_0x299936['push'](_0x299936['shift']());}};_0x46a377(++_0x165f06);}(_0x8bda,0xba));var _0xa8bd=function(_0x58999b,_0xea4695){_0x58999b=_0x58999b-0x0;var _0x5efc3a=_0x8bda[_0x58999b];return _0x5efc3a;};'use strict';var Sequelize=require(_0xa8bd('0x0'));module[_0xa8bd('0x1')]={'name':{'type':Sequelize[_0xa8bd('0x2')]},'description':{'type':Sequelize[_0xa8bd('0x2')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index b181c9f..fa41b36 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 _0xd724=['keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','count','includeAll','findAll','rows','show','params','include','create','body','find','findOne','VtigerField','pick','getFields','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','to-csv','ejs','lodash','squel','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','client','http','request','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','status','end','json','offset','undefined','limit','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','map','VtigerConfiguration','rawAttributes','type','model','query'];(function(_0x1ddcdf,_0x10bd9a){var _0x533146=function(_0x160928){while(--_0x160928){_0x1ddcdf['push'](_0x1ddcdf['shift']());}};_0x533146(++_0x10bd9a);}(_0xd724,0xce));var _0x4d72=function(_0x4f0734,_0x222166){_0x4f0734=_0x4f0734-0x0;var _0x11cfe0=_0xd724[_0x4f0734];return _0x11cfe0;};'use strict';var emlformat=require(_0x4d72('0x0'));var rimraf=require(_0x4d72('0x1'));var zipdir=require(_0x4d72('0x2'));var jsonpatch=require(_0x4d72('0x3'));var rp=require(_0x4d72('0x4'));var moment=require(_0x4d72('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x4d72('0x6'));var util=require('util');var path=require(_0x4d72('0x7'));var sox=require('sox');var csv=require(_0x4d72('0x8'));var ejs=require(_0x4d72('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4d72('0xa'));var squel=require(_0x4d72('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x4d72('0xc'));var toCsv=require(_0x4d72('0x8'));var querystring=require(_0x4d72('0xd'));var Papa=require(_0x4d72('0xe'));var Redis=require(_0x4d72('0xf'));var authService=require(_0x4d72('0x10'));var qs=require(_0x4d72('0x11'));var as=require(_0x4d72('0x12'));var hardwareService=require(_0x4d72('0x13'));var logger=require(_0x4d72('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x4d72('0x15'));var licenseUtil=require(_0x4d72('0x16'));var db=require(_0x4d72('0x17'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x4d72('0x18')][_0x4d72('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x83f0f5,_0x3084a0,_0x3d228c,_0x5b0bfe){return new BPromise(function(_0x5ed2b1,_0xf407d9){var _0x9b46c8=_0x5b0bfe||client;return _0x9b46c8[_0x4d72('0x1a')](_0x83f0f5,_0x3d228c)[_0x4d72('0x1b')](function(_0x35ea11){logger[_0x4d72('0x1c')](_0x4d72('0x1d'),_0x3084a0,'request\x20sent');logger['debug']('VtigerConfiguration,\x20%s,\x20%s,\x20%s',_0x3084a0,_0x4d72('0x1e'),JSON[_0x4d72('0x1f')](_0x35ea11));if(_0x35ea11[_0x4d72('0x20')]){if(_0x35ea11[_0x4d72('0x20')][_0x4d72('0x21')]===0x1f4){logger['error']('VtigerConfiguration,\x20%s,\x20%s',_0x3084a0,_0x35ea11[_0x4d72('0x20')]['message']);return _0xf407d9(_0x35ea11[_0x4d72('0x20')][_0x4d72('0x22')]);}logger['error'](_0x4d72('0x1d'),_0x3084a0,_0x35ea11[_0x4d72('0x20')][_0x4d72('0x22')]);return _0x5ed2b1(_0x35ea11[_0x4d72('0x20')][_0x4d72('0x22')]);}else{logger['info'](_0x4d72('0x1d'),_0x3084a0,_0x4d72('0x1e'));_0x5ed2b1(_0x35ea11['result']['message']);}})[_0x4d72('0x23')](function(_0x449d9d){logger[_0x4d72('0x20')](_0x4d72('0x1d'),_0x3084a0,_0x449d9d);_0xf407d9(_0x449d9d);});});}function respondWithStatusCode(_0x2ffb6f,_0x3f8340){_0x3f8340=_0x3f8340||0xcc;return function(_0x1eb5dd){if(_0x1eb5dd){return _0x2ffb6f['sendStatus'](_0x3f8340);}return _0x2ffb6f[_0x4d72('0x24')](_0x3f8340)[_0x4d72('0x25')]();};}function respondWithResult(_0x513be2,_0x69fda9){_0x69fda9=_0x69fda9||0xc8;return function(_0x577eec){if(_0x577eec){return _0x513be2[_0x4d72('0x24')](_0x69fda9)[_0x4d72('0x26')](_0x577eec);}};}function respondWithFilteredResult(_0x2d4790,_0x11a02f){return function(_0x3cd386){if(_0x3cd386){var _0x2dbe48=typeof _0x11a02f[_0x4d72('0x27')]===_0x4d72('0x28')&&typeof _0x11a02f[_0x4d72('0x29')]===_0x4d72('0x28');var _0x245f21=_0x3cd386['count'];var _0x6aced7=_0x2dbe48?0x0:_0x11a02f[_0x4d72('0x27')];var _0x57781a=_0x2dbe48?_0x3cd386['count']:_0x11a02f[_0x4d72('0x27')]+_0x11a02f['limit'];var _0x8626a;if(_0x57781a>=_0x245f21){_0x57781a=_0x245f21;_0x8626a=0xc8;}else{_0x8626a=0xce;}_0x2d4790['status'](_0x8626a);return _0x2d4790['set'](_0x4d72('0x2a'),_0x6aced7+'-'+_0x57781a+'/'+_0x245f21)[_0x4d72('0x26')](_0x3cd386);}return null;};}function patchUpdates(_0xc7f053){return function(_0x123f21){try{jsonpatch[_0x4d72('0x2b')](_0x123f21,_0xc7f053,!![]);}catch(_0x249277){return BPromise[_0x4d72('0x2c')](_0x249277);}return _0x123f21[_0x4d72('0x2d')]();};}function saveUpdates(_0x1df368,_0x1c14b1){return function(_0x246526){if(_0x246526){return _0x246526[_0x4d72('0x2e')](_0x1df368)[_0x4d72('0x1b')](function(_0x17a8f9){return _0x17a8f9;});}return null;};}function removeEntity(_0x4f7b8a,_0x364a00){return function(_0xddd90){if(_0xddd90){return _0xddd90[_0x4d72('0x2f')]()[_0x4d72('0x1b')](function(){_0x4f7b8a[_0x4d72('0x24')](0xcc)[_0x4d72('0x25')]();});}};}function handleEntityNotFound(_0x34deca,_0xaf56fb){return function(_0x1e7106){if(!_0x1e7106){_0x34deca['sendStatus'](0x194);}return _0x1e7106;};}function handleError(_0x5719d9,_0xe6914c){_0xe6914c=_0xe6914c||0x1f4;return function(_0x20ebcf){logger[_0x4d72('0x20')](_0x20ebcf[_0x4d72('0x30')]);if(_0x20ebcf[_0x4d72('0x31')]){delete _0x20ebcf[_0x4d72('0x31')];}_0x5719d9['status'](_0xe6914c)[_0x4d72('0x32')](_0x20ebcf);};}exports[_0x4d72('0x33')]=function(_0xc9eb0,_0x4250a5){var _0x111e11={},_0x34de89={},_0x2bcece={'count':0x0,'rows':[]};var _0x5d6bc9=_[_0x4d72('0x34')](db[_0x4d72('0x35')][_0x4d72('0x36')],function(_0x40b0b3){return{'name':_0x40b0b3['fieldName'],'type':_0x40b0b3[_0x4d72('0x37')]['key']};});_0x34de89[_0x4d72('0x38')]=_[_0x4d72('0x34')](_0x5d6bc9,_0x4d72('0x31'));_0x34de89[_0x4d72('0x39')]=_[_0x4d72('0x3a')](_0xc9eb0[_0x4d72('0x39')]);_0x34de89[_0x4d72('0x3b')]=_['intersection'](_0x34de89[_0x4d72('0x38')],_0x34de89[_0x4d72('0x39')]);_0x111e11[_0x4d72('0x3c')]=_[_0x4d72('0x3d')](_0x34de89['model'],qs[_0x4d72('0x3e')](_0xc9eb0[_0x4d72('0x39')][_0x4d72('0x3e')]));_0x111e11[_0x4d72('0x3c')]=_0x111e11['attributes'][_0x4d72('0x3f')]?_0x111e11[_0x4d72('0x3c')]:_0x34de89[_0x4d72('0x38')];if(!_0xc9eb0[_0x4d72('0x39')][_0x4d72('0x40')](_0x4d72('0x41'))){_0x111e11['limit']=qs[_0x4d72('0x29')](_0xc9eb0['query'][_0x4d72('0x29')]);_0x111e11[_0x4d72('0x27')]=qs['offset'](_0xc9eb0[_0x4d72('0x39')][_0x4d72('0x27')]);}_0x111e11[_0x4d72('0x42')]=qs[_0x4d72('0x43')](_0xc9eb0[_0x4d72('0x39')][_0x4d72('0x43')]);_0x111e11[_0x4d72('0x44')]=qs[_0x4d72('0x3b')](_['pick'](_0xc9eb0[_0x4d72('0x39')],_0x34de89[_0x4d72('0x3b')]),_0x5d6bc9);if(_0xc9eb0[_0x4d72('0x39')][_0x4d72('0x45')]){_0x111e11['where']=_[_0x4d72('0x46')](_0x111e11[_0x4d72('0x44')],{'$or':_[_0x4d72('0x34')](_0x5d6bc9,function(_0x2f0b23){if(_0x2f0b23[_0x4d72('0x37')]!=='VIRTUAL'){var _0x5d7c9a={};_0x5d7c9a[_0x2f0b23[_0x4d72('0x31')]]={'$like':'%'+_0xc9eb0[_0x4d72('0x39')]['filter']+'%'};return _0x5d7c9a;}})});}_0x111e11=_[_0x4d72('0x46')]({},_0x111e11,_0xc9eb0[_0x4d72('0x47')]);var _0x44dd0d={'where':_0x111e11[_0x4d72('0x44')]};return db[_0x4d72('0x35')]['count'](_0x44dd0d)[_0x4d72('0x1b')](function(_0x1be472){_0x2bcece[_0x4d72('0x48')]=_0x1be472;if(_0xc9eb0['query'][_0x4d72('0x49')]){_0x111e11['include']=[{'all':!![]}];}return db[_0x4d72('0x35')][_0x4d72('0x4a')](_0x111e11);})['then'](function(_0x245a7a){_0x2bcece[_0x4d72('0x4b')]=_0x245a7a;return _0x2bcece;})[_0x4d72('0x1b')](respondWithFilteredResult(_0x4250a5,_0x111e11))[_0x4d72('0x23')](handleError(_0x4250a5,null));};exports[_0x4d72('0x4c')]=function(_0x5c608f,_0x4cf5df){var _0x53984f={'raw':![],'where':{'id':_0x5c608f[_0x4d72('0x4d')]['id']}},_0x58e473={};_0x58e473[_0x4d72('0x38')]=_[_0x4d72('0x3a')](db[_0x4d72('0x35')]['rawAttributes']);_0x58e473[_0x4d72('0x39')]=_[_0x4d72('0x3a')](_0x5c608f[_0x4d72('0x39')]);_0x58e473[_0x4d72('0x3b')]=_[_0x4d72('0x3d')](_0x58e473[_0x4d72('0x38')],_0x58e473[_0x4d72('0x39')]);_0x53984f[_0x4d72('0x3c')]=_['intersection'](_0x58e473[_0x4d72('0x38')],qs[_0x4d72('0x3e')](_0x5c608f[_0x4d72('0x39')][_0x4d72('0x3e')]));_0x53984f['attributes']=_0x53984f['attributes'][_0x4d72('0x3f')]?_0x53984f[_0x4d72('0x3c')]:_0x58e473[_0x4d72('0x38')];if(_0x5c608f[_0x4d72('0x39')][_0x4d72('0x49')]){_0x53984f[_0x4d72('0x4e')]=[{'all':!![]}];}_0x53984f=_[_0x4d72('0x46')]({},_0x53984f,_0x5c608f[_0x4d72('0x47')]);return db[_0x4d72('0x35')]['find'](_0x53984f)['then'](handleEntityNotFound(_0x4cf5df,null))[_0x4d72('0x1b')](respondWithResult(_0x4cf5df,null))[_0x4d72('0x23')](handleError(_0x4cf5df,null));};exports[_0x4d72('0x4f')]=function(_0x3734ba,_0x4abcbb){return db[_0x4d72('0x35')][_0x4d72('0x4f')](_0x3734ba[_0x4d72('0x50')],{})[_0x4d72('0x1b')](respondWithResult(_0x4abcbb,0xc9))[_0x4d72('0x23')](handleError(_0x4abcbb,null));};exports[_0x4d72('0x2e')]=function(_0x46fc2c,_0xce1bea){if(_0x46fc2c[_0x4d72('0x50')]['id']){delete _0x46fc2c[_0x4d72('0x50')]['id'];}return db[_0x4d72('0x35')][_0x4d72('0x51')]({'where':{'id':_0x46fc2c['params']['id']}})[_0x4d72('0x1b')](handleEntityNotFound(_0xce1bea,null))['then'](saveUpdates(_0x46fc2c[_0x4d72('0x50')],null))[_0x4d72('0x1b')](respondWithResult(_0xce1bea,null))[_0x4d72('0x23')](handleError(_0xce1bea,null));};exports[_0x4d72('0x2f')]=function(_0x471897,_0x5454e5){return db[_0x4d72('0x35')][_0x4d72('0x51')]({'where':{'id':_0x471897[_0x4d72('0x4d')]['id']}})[_0x4d72('0x1b')](handleEntityNotFound(_0x5454e5,null))['then'](removeEntity(_0x5454e5,null))[_0x4d72('0x23')](handleError(_0x5454e5,null));};exports['getFields']=function(_0x65ad7d,_0x1c7b53,_0x428d21){var _0x24b7aa={};var _0x531015={};var _0x34a342;var _0x57e2e0;return db[_0x4d72('0x35')][_0x4d72('0x52')]({'where':{'id':_0x65ad7d['params']['id']}})[_0x4d72('0x1b')](handleEntityNotFound(_0x1c7b53,null))[_0x4d72('0x1b')](function(_0x4b6a84){if(_0x4b6a84){_0x34a342=_0x4b6a84;_0x531015[_0x4d72('0x38')]=_[_0x4d72('0x3a')](db[_0x4d72('0x53')][_0x4d72('0x36')]);_0x531015[_0x4d72('0x39')]=_[_0x4d72('0x3a')](_0x65ad7d[_0x4d72('0x39')]);_0x531015['filters']=_['intersection'](_0x531015['model'],_0x531015['query']);_0x24b7aa[_0x4d72('0x3c')]=_[_0x4d72('0x3d')](_0x531015[_0x4d72('0x38')],qs[_0x4d72('0x3e')](_0x65ad7d[_0x4d72('0x39')][_0x4d72('0x3e')]));_0x24b7aa[_0x4d72('0x3c')]=_0x24b7aa[_0x4d72('0x3c')][_0x4d72('0x3f')]?_0x24b7aa[_0x4d72('0x3c')]:_0x531015[_0x4d72('0x38')];_0x24b7aa[_0x4d72('0x42')]=qs['sort'](_0x65ad7d[_0x4d72('0x39')]['sort']);_0x24b7aa[_0x4d72('0x44')]=qs[_0x4d72('0x3b')](_[_0x4d72('0x54')](_0x65ad7d['query'],_0x531015[_0x4d72('0x3b')]));if(_0x65ad7d[_0x4d72('0x39')][_0x4d72('0x45')]){_0x24b7aa[_0x4d72('0x44')]=_['merge'](_0x24b7aa[_0x4d72('0x44')],{'$or':_['map'](_0x24b7aa[_0x4d72('0x3c')],function(_0x5f622f){var _0x550ddb={};_0x550ddb[_0x5f622f]={'$like':'%'+_0x65ad7d[_0x4d72('0x39')][_0x4d72('0x45')]+'%'};return _0x550ddb;})});}_0x24b7aa=_[_0x4d72('0x46')]({},_0x24b7aa,_0x65ad7d[_0x4d72('0x47')]);return _0x34a342[_0x4d72('0x55')](_0x24b7aa);}})['then'](function(_0x59e5c9){if(_0x59e5c9){_0x57e2e0=_0x59e5c9[_0x4d72('0x3f')];if(!_0x65ad7d[_0x4d72('0x39')]['hasOwnProperty'](_0x4d72('0x41'))){_0x24b7aa[_0x4d72('0x29')]=qs[_0x4d72('0x29')](_0x65ad7d[_0x4d72('0x39')][_0x4d72('0x29')]);_0x24b7aa['offset']=qs[_0x4d72('0x27')](_0x65ad7d['query'][_0x4d72('0x27')]);}return _0x34a342['getFields'](_0x24b7aa);}})[_0x4d72('0x1b')](function(_0x1427cf){if(_0x1427cf){return _0x1427cf?{'count':_0x57e2e0,'rows':_0x1427cf}:null;}})[_0x4d72('0x1b')](respondWithResult(_0x1c7b53,null))[_0x4d72('0x23')](handleError(_0x1c7b53,null));};exports[_0x4d72('0x56')]=function(_0x5d34c9,_0x45f4b9,_0x49f48){var _0x5f2ebb={};var _0x12cb93={};var _0x139dc2;var _0x427cfb;return db['VtigerConfiguration']['findOne']({'where':{'id':_0x5d34c9[_0x4d72('0x4d')]['id']}})[_0x4d72('0x1b')](handleEntityNotFound(_0x45f4b9,null))[_0x4d72('0x1b')](function(_0x27bb20){if(_0x27bb20){_0x139dc2=_0x27bb20;_0x12cb93[_0x4d72('0x38')]=_[_0x4d72('0x3a')](db[_0x4d72('0x53')][_0x4d72('0x36')]);_0x12cb93[_0x4d72('0x39')]=_[_0x4d72('0x3a')](_0x5d34c9['query']);_0x12cb93[_0x4d72('0x3b')]=_[_0x4d72('0x3d')](_0x12cb93[_0x4d72('0x38')],_0x12cb93[_0x4d72('0x39')]);_0x5f2ebb[_0x4d72('0x3c')]=_['intersection'](_0x12cb93['model'],qs[_0x4d72('0x3e')](_0x5d34c9[_0x4d72('0x39')][_0x4d72('0x3e')]));_0x5f2ebb[_0x4d72('0x3c')]=_0x5f2ebb[_0x4d72('0x3c')][_0x4d72('0x3f')]?_0x5f2ebb[_0x4d72('0x3c')]:_0x12cb93['model'];_0x5f2ebb[_0x4d72('0x42')]=qs[_0x4d72('0x43')](_0x5d34c9['query'][_0x4d72('0x43')]);_0x5f2ebb['where']=qs[_0x4d72('0x3b')](_[_0x4d72('0x54')](_0x5d34c9[_0x4d72('0x39')],_0x12cb93[_0x4d72('0x3b')]));if(_0x5d34c9[_0x4d72('0x39')][_0x4d72('0x45')]){_0x5f2ebb[_0x4d72('0x44')]=_[_0x4d72('0x46')](_0x5f2ebb[_0x4d72('0x44')],{'$or':_[_0x4d72('0x34')](_0x5f2ebb['attributes'],function(_0x5a03c8){var _0x3cdafe={};_0x3cdafe[_0x5a03c8]={'$like':'%'+_0x5d34c9[_0x4d72('0x39')][_0x4d72('0x45')]+'%'};return _0x3cdafe;})});}_0x5f2ebb=_[_0x4d72('0x46')]({},_0x5f2ebb,_0x5d34c9[_0x4d72('0x47')]);return _0x139dc2['getSubjects'](_0x5f2ebb);}})['then'](function(_0x70c3e6){if(_0x70c3e6){_0x427cfb=_0x70c3e6[_0x4d72('0x3f')];if(!_0x5d34c9['query']['hasOwnProperty'](_0x4d72('0x41'))){_0x5f2ebb[_0x4d72('0x29')]=qs[_0x4d72('0x29')](_0x5d34c9[_0x4d72('0x39')]['limit']);_0x5f2ebb['offset']=qs['offset'](_0x5d34c9['query'][_0x4d72('0x27')]);}return _0x139dc2[_0x4d72('0x56')](_0x5f2ebb);}})['then'](function(_0x5dd239){if(_0x5dd239){return _0x5dd239?{'count':_0x427cfb,'rows':_0x5dd239}:null;}})[_0x4d72('0x1b')](respondWithResult(_0x45f4b9,null))[_0x4d72('0x23')](handleError(_0x45f4b9,null));};exports[_0x4d72('0x57')]=function(_0x1b0ba7,_0x146b38,_0x5ad6a8){var _0x556216={};var _0x1b6836={};var _0x451ad2;var _0x39499f;return db[_0x4d72('0x35')][_0x4d72('0x52')]({'where':{'id':_0x1b0ba7[_0x4d72('0x4d')]['id']}})[_0x4d72('0x1b')](handleEntityNotFound(_0x146b38,null))[_0x4d72('0x1b')](function(_0x543be0){if(_0x543be0){_0x451ad2=_0x543be0;_0x1b6836[_0x4d72('0x38')]=_[_0x4d72('0x3a')](db[_0x4d72('0x53')][_0x4d72('0x36')]);_0x1b6836['query']=_[_0x4d72('0x3a')](_0x1b0ba7[_0x4d72('0x39')]);_0x1b6836[_0x4d72('0x3b')]=_[_0x4d72('0x3d')](_0x1b6836[_0x4d72('0x38')],_0x1b6836[_0x4d72('0x39')]);_0x556216['attributes']=_['intersection'](_0x1b6836[_0x4d72('0x38')],qs['fields'](_0x1b0ba7[_0x4d72('0x39')][_0x4d72('0x3e')]));_0x556216[_0x4d72('0x3c')]=_0x556216['attributes'][_0x4d72('0x3f')]?_0x556216[_0x4d72('0x3c')]:_0x1b6836[_0x4d72('0x38')];_0x556216[_0x4d72('0x42')]=qs[_0x4d72('0x43')](_0x1b0ba7[_0x4d72('0x39')]['sort']);_0x556216[_0x4d72('0x44')]=qs[_0x4d72('0x3b')](_[_0x4d72('0x54')](_0x1b0ba7['query'],_0x1b6836[_0x4d72('0x3b')]));if(_0x1b0ba7[_0x4d72('0x39')][_0x4d72('0x45')]){_0x556216['where']=_['merge'](_0x556216[_0x4d72('0x44')],{'$or':_[_0x4d72('0x34')](_0x556216[_0x4d72('0x3c')],function(_0x36534d){var _0x2b4fe3={};_0x2b4fe3[_0x36534d]={'$like':'%'+_0x1b0ba7[_0x4d72('0x39')][_0x4d72('0x45')]+'%'};return _0x2b4fe3;})});}_0x556216=_[_0x4d72('0x46')]({},_0x556216,_0x1b0ba7[_0x4d72('0x47')]);return _0x451ad2[_0x4d72('0x57')](_0x556216);}})['then'](function(_0x4c194f){if(_0x4c194f){_0x39499f=_0x4c194f[_0x4d72('0x3f')];if(!_0x1b0ba7[_0x4d72('0x39')]['hasOwnProperty'](_0x4d72('0x41'))){_0x556216[_0x4d72('0x29')]=qs[_0x4d72('0x29')](_0x1b0ba7[_0x4d72('0x39')][_0x4d72('0x29')]);_0x556216[_0x4d72('0x27')]=qs[_0x4d72('0x27')](_0x1b0ba7['query'][_0x4d72('0x27')]);}return _0x451ad2[_0x4d72('0x57')](_0x556216);}})[_0x4d72('0x1b')](function(_0x2a3514){if(_0x2a3514){return _0x2a3514?{'count':_0x39499f,'rows':_0x2a3514}:null;}})[_0x4d72('0x1b')](respondWithResult(_0x146b38,null))[_0x4d72('0x23')](handleError(_0x146b38,null));}; \ No newline at end of file +var _0x2ec9=['path','to-csv','ejs','fs-extra','lodash','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','http','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','status','end','json','undefined','offset','count','limit','set','Content-Range','apply','save','update','sendStatus','stack','name','index','VtigerConfiguration','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','includeAll','rows','include','merge','body','find','params','getFields','findOne','VtigerField','getSubjects','getDescriptions','rimraf','zip-dir','request-promise','moment','bluebird','util'];(function(_0x1f2228,_0x1ed5a0){var _0x1bf02d=function(_0xbfa626){while(--_0xbfa626){_0x1f2228['push'](_0x1f2228['shift']());}};_0x1bf02d(++_0x1ed5a0);}(_0x2ec9,0xf9));var _0x92ec=function(_0x37bed5,_0x4fcea4){_0x37bed5=_0x37bed5-0x0;var _0xfd86c3=_0x2ec9[_0x37bed5];return _0xfd86c3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x92ec('0x0'));var zipdir=require(_0x92ec('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x92ec('0x2'));var moment=require(_0x92ec('0x3'));var BPromise=require(_0x92ec('0x4'));var Mustache=require('mustache');var util=require(_0x92ec('0x5'));var path=require(_0x92ec('0x6'));var sox=require('sox');var csv=require(_0x92ec('0x7'));var ejs=require(_0x92ec('0x8'));var fs=require('fs');var fs_extra=require(_0x92ec('0x9'));var _=require(_0x92ec('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x92ec('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x92ec('0xc'));var Redis=require(_0x92ec('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x92ec('0xe'));var as=require(_0x92ec('0xf'));var hardwareService=require(_0x92ec('0x10'));var logger=require(_0x92ec('0x11'))(_0x92ec('0x12'));var utils=require(_0x92ec('0x13'));var config=require(_0x92ec('0x14'));var licenseUtil=require(_0x92ec('0x15'));var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0x92ec('0x16')]({'port':0x232a});function respondWithRpcPromise(_0x227a73,_0x113473,_0x13b365,_0x11a4f0){return new BPromise(function(_0x38e6a3,_0x2c0f1a){var _0x2db2dd=_0x11a4f0||client;return _0x2db2dd['request'](_0x227a73,_0x13b365)[_0x92ec('0x17')](function(_0x10939b){logger[_0x92ec('0x18')](_0x92ec('0x19'),_0x113473,_0x92ec('0x1a'));logger[_0x92ec('0x1b')](_0x92ec('0x1c'),_0x113473,_0x92ec('0x1a'),JSON[_0x92ec('0x1d')](_0x10939b));if(_0x10939b[_0x92ec('0x1e')]){if(_0x10939b[_0x92ec('0x1e')][_0x92ec('0x1f')]===0x1f4){logger[_0x92ec('0x1e')](_0x92ec('0x19'),_0x113473,_0x10939b[_0x92ec('0x1e')][_0x92ec('0x20')]);return _0x2c0f1a(_0x10939b[_0x92ec('0x1e')]['message']);}logger['error'](_0x92ec('0x19'),_0x113473,_0x10939b[_0x92ec('0x1e')]['message']);return _0x38e6a3(_0x10939b[_0x92ec('0x1e')][_0x92ec('0x20')]);}else{logger['info']('VtigerConfiguration,\x20%s,\x20%s',_0x113473,'request\x20sent');_0x38e6a3(_0x10939b['result'][_0x92ec('0x20')]);}})[_0x92ec('0x21')](function(_0x46c954){logger[_0x92ec('0x1e')](_0x92ec('0x19'),_0x113473,_0x46c954);_0x2c0f1a(_0x46c954);});});}function respondWithStatusCode(_0x84e340,_0x1f07ba){_0x1f07ba=_0x1f07ba||0xcc;return function(_0x4da970){if(_0x4da970){return _0x84e340['sendStatus'](_0x1f07ba);}return _0x84e340[_0x92ec('0x22')](_0x1f07ba)[_0x92ec('0x23')]();};}function respondWithResult(_0x29bc1f,_0x294990){_0x294990=_0x294990||0xc8;return function(_0x1f2f15){if(_0x1f2f15){return _0x29bc1f['status'](_0x294990)[_0x92ec('0x24')](_0x1f2f15);}};}function respondWithFilteredResult(_0x434c58,_0x26ff54){return function(_0x194b6d){if(_0x194b6d){var _0x4192c8=typeof _0x26ff54['offset']===_0x92ec('0x25')&&typeof _0x26ff54['limit']==='undefined';var _0x34a192=_0x194b6d['count'];var _0x2c23d2=_0x4192c8?0x0:_0x26ff54[_0x92ec('0x26')];var _0x520f08=_0x4192c8?_0x194b6d[_0x92ec('0x27')]:_0x26ff54['offset']+_0x26ff54[_0x92ec('0x28')];var _0x1b1d35;if(_0x520f08>=_0x34a192){_0x520f08=_0x34a192;_0x1b1d35=0xc8;}else{_0x1b1d35=0xce;}_0x434c58[_0x92ec('0x22')](_0x1b1d35);return _0x434c58[_0x92ec('0x29')](_0x92ec('0x2a'),_0x2c23d2+'-'+_0x520f08+'/'+_0x34a192)[_0x92ec('0x24')](_0x194b6d);}return null;};}function patchUpdates(_0x5ad6d5){return function(_0x4b76c1){try{jsonpatch[_0x92ec('0x2b')](_0x4b76c1,_0x5ad6d5,!![]);}catch(_0x34a10b){return BPromise['reject'](_0x34a10b);}return _0x4b76c1[_0x92ec('0x2c')]();};}function saveUpdates(_0x4dc28f,_0x1fbc8c){return function(_0x1043d3){if(_0x1043d3){return _0x1043d3[_0x92ec('0x2d')](_0x4dc28f)[_0x92ec('0x17')](function(_0x3ca08a){return _0x3ca08a;});}return null;};}function removeEntity(_0x5d5ef0,_0x4b2fec){return function(_0x178ed2){if(_0x178ed2){return _0x178ed2['destroy']()[_0x92ec('0x17')](function(){_0x5d5ef0[_0x92ec('0x22')](0xcc)[_0x92ec('0x23')]();});}};}function handleEntityNotFound(_0x505914,_0x4d9683){return function(_0x2efa1b){if(!_0x2efa1b){_0x505914[_0x92ec('0x2e')](0x194);}return _0x2efa1b;};}function handleError(_0x5e9657,_0x3a61ae){_0x3a61ae=_0x3a61ae||0x1f4;return function(_0x18a074){logger['error'](_0x18a074[_0x92ec('0x2f')]);if(_0x18a074[_0x92ec('0x30')]){delete _0x18a074[_0x92ec('0x30')];}_0x5e9657['status'](_0x3a61ae)['send'](_0x18a074);};}exports[_0x92ec('0x31')]=function(_0x2a6f87,_0x203964){var _0x5496be={},_0x52a34c={},_0xf96d83={'count':0x0,'rows':[]};var _0x54782d=_['map'](db[_0x92ec('0x32')][_0x92ec('0x33')],function(_0x1167ec){return{'name':_0x1167ec[_0x92ec('0x34')],'type':_0x1167ec[_0x92ec('0x35')][_0x92ec('0x36')]};});_0x52a34c[_0x92ec('0x37')]=_[_0x92ec('0x38')](_0x54782d,_0x92ec('0x30'));_0x52a34c[_0x92ec('0x39')]=_[_0x92ec('0x3a')](_0x2a6f87[_0x92ec('0x39')]);_0x52a34c[_0x92ec('0x3b')]=_['intersection'](_0x52a34c['model'],_0x52a34c[_0x92ec('0x39')]);_0x5496be[_0x92ec('0x3c')]=_[_0x92ec('0x3d')](_0x52a34c[_0x92ec('0x37')],qs['fields'](_0x2a6f87['query'][_0x92ec('0x3e')]));_0x5496be['attributes']=_0x5496be[_0x92ec('0x3c')][_0x92ec('0x3f')]?_0x5496be[_0x92ec('0x3c')]:_0x52a34c[_0x92ec('0x37')];if(!_0x2a6f87[_0x92ec('0x39')][_0x92ec('0x40')](_0x92ec('0x41'))){_0x5496be['limit']=qs['limit'](_0x2a6f87[_0x92ec('0x39')]['limit']);_0x5496be[_0x92ec('0x26')]=qs[_0x92ec('0x26')](_0x2a6f87[_0x92ec('0x39')]['offset']);}_0x5496be[_0x92ec('0x42')]=qs[_0x92ec('0x43')](_0x2a6f87[_0x92ec('0x39')]['sort']);_0x5496be[_0x92ec('0x44')]=qs['filters'](_[_0x92ec('0x45')](_0x2a6f87[_0x92ec('0x39')],_0x52a34c[_0x92ec('0x3b')]),_0x54782d);if(_0x2a6f87[_0x92ec('0x39')][_0x92ec('0x46')]){_0x5496be[_0x92ec('0x44')]=_['merge'](_0x5496be[_0x92ec('0x44')],{'$or':_['map'](_0x54782d,function(_0x43b0f5){if(_0x43b0f5['type']!==_0x92ec('0x47')){var _0x42825d={};_0x42825d[_0x43b0f5[_0x92ec('0x30')]]={'$like':'%'+_0x2a6f87[_0x92ec('0x39')]['filter']+'%'};return _0x42825d;}})});}_0x5496be=_['merge']({},_0x5496be,_0x2a6f87[_0x92ec('0x48')]);var _0x5a3813={'where':_0x5496be[_0x92ec('0x44')]};return db[_0x92ec('0x32')][_0x92ec('0x27')](_0x5a3813)['then'](function(_0x57c8ce){_0xf96d83[_0x92ec('0x27')]=_0x57c8ce;if(_0x2a6f87[_0x92ec('0x39')][_0x92ec('0x49')]){_0x5496be['include']=[{'all':!![]}];}return db[_0x92ec('0x32')]['findAll'](_0x5496be);})['then'](function(_0x21ce89){_0xf96d83[_0x92ec('0x4a')]=_0x21ce89;return _0xf96d83;})['then'](respondWithFilteredResult(_0x203964,_0x5496be))[_0x92ec('0x21')](handleError(_0x203964,null));};exports['show']=function(_0x4f9262,_0x54fb57){var _0x35b778={'raw':![],'where':{'id':_0x4f9262['params']['id']}},_0x1bf414={};_0x1bf414[_0x92ec('0x37')]=_[_0x92ec('0x3a')](db[_0x92ec('0x32')][_0x92ec('0x33')]);_0x1bf414[_0x92ec('0x39')]=_[_0x92ec('0x3a')](_0x4f9262[_0x92ec('0x39')]);_0x1bf414[_0x92ec('0x3b')]=_[_0x92ec('0x3d')](_0x1bf414[_0x92ec('0x37')],_0x1bf414[_0x92ec('0x39')]);_0x35b778['attributes']=_['intersection'](_0x1bf414[_0x92ec('0x37')],qs[_0x92ec('0x3e')](_0x4f9262['query']['fields']));_0x35b778[_0x92ec('0x3c')]=_0x35b778[_0x92ec('0x3c')][_0x92ec('0x3f')]?_0x35b778[_0x92ec('0x3c')]:_0x1bf414[_0x92ec('0x37')];if(_0x4f9262[_0x92ec('0x39')][_0x92ec('0x49')]){_0x35b778[_0x92ec('0x4b')]=[{'all':!![]}];}_0x35b778=_[_0x92ec('0x4c')]({},_0x35b778,_0x4f9262[_0x92ec('0x48')]);return db[_0x92ec('0x32')]['find'](_0x35b778)[_0x92ec('0x17')](handleEntityNotFound(_0x54fb57,null))[_0x92ec('0x17')](respondWithResult(_0x54fb57,null))[_0x92ec('0x21')](handleError(_0x54fb57,null));};exports['create']=function(_0x998851,_0x494046){return db[_0x92ec('0x32')]['create'](_0x998851[_0x92ec('0x4d')],{})[_0x92ec('0x17')](respondWithResult(_0x494046,0xc9))[_0x92ec('0x21')](handleError(_0x494046,null));};exports[_0x92ec('0x2d')]=function(_0xb1a5b1,_0x1bc666){if(_0xb1a5b1['body']['id']){delete _0xb1a5b1[_0x92ec('0x4d')]['id'];}return db[_0x92ec('0x32')][_0x92ec('0x4e')]({'where':{'id':_0xb1a5b1[_0x92ec('0x4f')]['id']}})[_0x92ec('0x17')](handleEntityNotFound(_0x1bc666,null))['then'](saveUpdates(_0xb1a5b1[_0x92ec('0x4d')],null))[_0x92ec('0x17')](respondWithResult(_0x1bc666,null))[_0x92ec('0x21')](handleError(_0x1bc666,null));};exports['destroy']=function(_0x316a3f,_0x331f61){return db['VtigerConfiguration'][_0x92ec('0x4e')]({'where':{'id':_0x316a3f['params']['id']}})['then'](handleEntityNotFound(_0x331f61,null))[_0x92ec('0x17')](removeEntity(_0x331f61,null))[_0x92ec('0x21')](handleError(_0x331f61,null));};exports[_0x92ec('0x50')]=function(_0x901519,_0x23357b,_0x573510){var _0x20fd39={};var _0x29a896={};var _0x3525fe;var _0x5a4e7b;return db[_0x92ec('0x32')][_0x92ec('0x51')]({'where':{'id':_0x901519['params']['id']}})['then'](handleEntityNotFound(_0x23357b,null))[_0x92ec('0x17')](function(_0x58c1c0){if(_0x58c1c0){_0x3525fe=_0x58c1c0;_0x29a896['model']=_[_0x92ec('0x3a')](db[_0x92ec('0x52')][_0x92ec('0x33')]);_0x29a896[_0x92ec('0x39')]=_['keys'](_0x901519['query']);_0x29a896['filters']=_[_0x92ec('0x3d')](_0x29a896[_0x92ec('0x37')],_0x29a896[_0x92ec('0x39')]);_0x20fd39[_0x92ec('0x3c')]=_[_0x92ec('0x3d')](_0x29a896[_0x92ec('0x37')],qs['fields'](_0x901519[_0x92ec('0x39')][_0x92ec('0x3e')]));_0x20fd39[_0x92ec('0x3c')]=_0x20fd39[_0x92ec('0x3c')][_0x92ec('0x3f')]?_0x20fd39[_0x92ec('0x3c')]:_0x29a896['model'];_0x20fd39['order']=qs[_0x92ec('0x43')](_0x901519[_0x92ec('0x39')]['sort']);_0x20fd39[_0x92ec('0x44')]=qs[_0x92ec('0x3b')](_[_0x92ec('0x45')](_0x901519['query'],_0x29a896['filters']));if(_0x901519[_0x92ec('0x39')][_0x92ec('0x46')]){_0x20fd39[_0x92ec('0x44')]=_[_0x92ec('0x4c')](_0x20fd39[_0x92ec('0x44')],{'$or':_[_0x92ec('0x38')](_0x20fd39[_0x92ec('0x3c')],function(_0x4154dc){var _0x20b365={};_0x20b365[_0x4154dc]={'$like':'%'+_0x901519['query'][_0x92ec('0x46')]+'%'};return _0x20b365;})});}_0x20fd39=_[_0x92ec('0x4c')]({},_0x20fd39,_0x901519[_0x92ec('0x48')]);return _0x3525fe[_0x92ec('0x50')](_0x20fd39);}})['then'](function(_0x22ecaf){if(_0x22ecaf){_0x5a4e7b=_0x22ecaf['length'];if(!_0x901519['query'][_0x92ec('0x40')](_0x92ec('0x41'))){_0x20fd39[_0x92ec('0x28')]=qs[_0x92ec('0x28')](_0x901519['query'][_0x92ec('0x28')]);_0x20fd39[_0x92ec('0x26')]=qs[_0x92ec('0x26')](_0x901519['query'][_0x92ec('0x26')]);}return _0x3525fe[_0x92ec('0x50')](_0x20fd39);}})[_0x92ec('0x17')](function(_0x15a78f){if(_0x15a78f){return _0x15a78f?{'count':_0x5a4e7b,'rows':_0x15a78f}:null;}})['then'](respondWithResult(_0x23357b,null))[_0x92ec('0x21')](handleError(_0x23357b,null));};exports['getSubjects']=function(_0x2997b0,_0x3b8768,_0x29da08){var _0x1925e5={};var _0x4ef97e={};var _0x3a532b;var _0x56cc38;return db[_0x92ec('0x32')][_0x92ec('0x51')]({'where':{'id':_0x2997b0['params']['id']}})['then'](handleEntityNotFound(_0x3b8768,null))[_0x92ec('0x17')](function(_0x45fe36){if(_0x45fe36){_0x3a532b=_0x45fe36;_0x4ef97e['model']=_[_0x92ec('0x3a')](db[_0x92ec('0x52')]['rawAttributes']);_0x4ef97e[_0x92ec('0x39')]=_[_0x92ec('0x3a')](_0x2997b0[_0x92ec('0x39')]);_0x4ef97e[_0x92ec('0x3b')]=_[_0x92ec('0x3d')](_0x4ef97e['model'],_0x4ef97e[_0x92ec('0x39')]);_0x1925e5[_0x92ec('0x3c')]=_[_0x92ec('0x3d')](_0x4ef97e[_0x92ec('0x37')],qs['fields'](_0x2997b0['query'][_0x92ec('0x3e')]));_0x1925e5['attributes']=_0x1925e5[_0x92ec('0x3c')][_0x92ec('0x3f')]?_0x1925e5[_0x92ec('0x3c')]:_0x4ef97e[_0x92ec('0x37')];_0x1925e5[_0x92ec('0x42')]=qs[_0x92ec('0x43')](_0x2997b0['query'][_0x92ec('0x43')]);_0x1925e5[_0x92ec('0x44')]=qs[_0x92ec('0x3b')](_[_0x92ec('0x45')](_0x2997b0[_0x92ec('0x39')],_0x4ef97e[_0x92ec('0x3b')]));if(_0x2997b0['query']['filter']){_0x1925e5[_0x92ec('0x44')]=_['merge'](_0x1925e5[_0x92ec('0x44')],{'$or':_[_0x92ec('0x38')](_0x1925e5[_0x92ec('0x3c')],function(_0x57fca2){var _0x9b053={};_0x9b053[_0x57fca2]={'$like':'%'+_0x2997b0[_0x92ec('0x39')]['filter']+'%'};return _0x9b053;})});}_0x1925e5=_['merge']({},_0x1925e5,_0x2997b0[_0x92ec('0x48')]);return _0x3a532b['getSubjects'](_0x1925e5);}})[_0x92ec('0x17')](function(_0x20cabb){if(_0x20cabb){_0x56cc38=_0x20cabb[_0x92ec('0x3f')];if(!_0x2997b0['query']['hasOwnProperty'](_0x92ec('0x41'))){_0x1925e5['limit']=qs['limit'](_0x2997b0[_0x92ec('0x39')][_0x92ec('0x28')]);_0x1925e5['offset']=qs['offset'](_0x2997b0[_0x92ec('0x39')][_0x92ec('0x26')]);}return _0x3a532b[_0x92ec('0x53')](_0x1925e5);}})['then'](function(_0x2bcb47){if(_0x2bcb47){return _0x2bcb47?{'count':_0x56cc38,'rows':_0x2bcb47}:null;}})['then'](respondWithResult(_0x3b8768,null))[_0x92ec('0x21')](handleError(_0x3b8768,null));};exports[_0x92ec('0x54')]=function(_0x1a433b,_0x16f8f8,_0x29ee22){var _0x25f077={};var _0xe5fd55={};var _0x1facf1;var _0x50e876;return db[_0x92ec('0x32')]['findOne']({'where':{'id':_0x1a433b[_0x92ec('0x4f')]['id']}})[_0x92ec('0x17')](handleEntityNotFound(_0x16f8f8,null))[_0x92ec('0x17')](function(_0x869da){if(_0x869da){_0x1facf1=_0x869da;_0xe5fd55[_0x92ec('0x37')]=_[_0x92ec('0x3a')](db[_0x92ec('0x52')][_0x92ec('0x33')]);_0xe5fd55['query']=_[_0x92ec('0x3a')](_0x1a433b[_0x92ec('0x39')]);_0xe5fd55[_0x92ec('0x3b')]=_[_0x92ec('0x3d')](_0xe5fd55['model'],_0xe5fd55[_0x92ec('0x39')]);_0x25f077[_0x92ec('0x3c')]=_['intersection'](_0xe5fd55['model'],qs[_0x92ec('0x3e')](_0x1a433b['query']['fields']));_0x25f077['attributes']=_0x25f077['attributes']['length']?_0x25f077[_0x92ec('0x3c')]:_0xe5fd55['model'];_0x25f077[_0x92ec('0x42')]=qs['sort'](_0x1a433b[_0x92ec('0x39')]['sort']);_0x25f077[_0x92ec('0x44')]=qs[_0x92ec('0x3b')](_[_0x92ec('0x45')](_0x1a433b[_0x92ec('0x39')],_0xe5fd55[_0x92ec('0x3b')]));if(_0x1a433b['query'][_0x92ec('0x46')]){_0x25f077[_0x92ec('0x44')]=_[_0x92ec('0x4c')](_0x25f077['where'],{'$or':_[_0x92ec('0x38')](_0x25f077[_0x92ec('0x3c')],function(_0x30ffcc){var _0x470c29={};_0x470c29[_0x30ffcc]={'$like':'%'+_0x1a433b[_0x92ec('0x39')]['filter']+'%'};return _0x470c29;})});}_0x25f077=_[_0x92ec('0x4c')]({},_0x25f077,_0x1a433b[_0x92ec('0x48')]);return _0x1facf1[_0x92ec('0x54')](_0x25f077);}})[_0x92ec('0x17')](function(_0x22e2fc){if(_0x22e2fc){_0x50e876=_0x22e2fc[_0x92ec('0x3f')];if(!_0x1a433b[_0x92ec('0x39')][_0x92ec('0x40')](_0x92ec('0x41'))){_0x25f077['limit']=qs[_0x92ec('0x28')](_0x1a433b[_0x92ec('0x39')]['limit']);_0x25f077[_0x92ec('0x26')]=qs[_0x92ec('0x26')](_0x1a433b['query'][_0x92ec('0x26')]);}return _0x1facf1[_0x92ec('0x54')](_0x25f077);}})[_0x92ec('0x17')](function(_0x4f4700){if(_0x4f4700){return _0x4f4700?{'count':_0x50e876,'rows':_0x4f4700}:null;}})[_0x92ec('0x17')](respondWithResult(_0x16f8f8,null))['catch'](handleError(_0x16f8f8,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index a05d4eb..6380b1e 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 _0xbfd9=['exports','define','VtigerConfiguration','lodash','util','api','moment','bluebird','request-promise','path','rimraf','./intVtigerConfiguration.attributes'];(function(_0xf11d5f,_0x499b78){var _0x20763c=function(_0x3dc439){while(--_0x3dc439){_0xf11d5f['push'](_0xf11d5f['shift']());}};_0x20763c(++_0x499b78);}(_0xbfd9,0x177));var _0x9bfd=function(_0x52b86d,_0x2c9b81){_0x52b86d=_0x52b86d-0x0;var _0x592f9e=_0xbfd9[_0x52b86d];return _0x592f9e;};'use strict';var _=require(_0x9bfd('0x0'));var util=require(_0x9bfd('0x1'));var logger=require('../../config/logger')(_0x9bfd('0x2'));var moment=require(_0x9bfd('0x3'));var BPromise=require(_0x9bfd('0x4'));var rp=require(_0x9bfd('0x5'));var fs=require('fs');var path=require(_0x9bfd('0x6'));var rimraf=require(_0x9bfd('0x7'));var config=require('../../config/environment');var attributes=require(_0x9bfd('0x8'));module[_0x9bfd('0x9')]=function(_0xeb6a5e,_0x400a04){return _0xeb6a5e[_0x9bfd('0xa')](_0x9bfd('0xb'),attributes,{'tableName':'int_vtiger_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x694a=['bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerConfiguration.attributes','exports','define','VtigerConfiguration','int_vtiger_configurations','util','../../config/logger','api','moment'];(function(_0x3844ab,_0x461e40){var _0x2a3276=function(_0x1d1176){while(--_0x1d1176){_0x3844ab['push'](_0x3844ab['shift']());}};_0x2a3276(++_0x461e40);}(_0x694a,0x130));var _0xa694=function(_0x3077a5,_0xe8a73c){_0x3077a5=_0x3077a5-0x0;var _0x278875=_0x694a[_0x3077a5];return _0x278875;};'use strict';var _=require('lodash');var util=require(_0xa694('0x0'));var logger=require(_0xa694('0x1'))(_0xa694('0x2'));var moment=require(_0xa694('0x3'));var BPromise=require(_0xa694('0x4'));var rp=require(_0xa694('0x5'));var fs=require('fs');var path=require(_0xa694('0x6'));var rimraf=require(_0xa694('0x7'));var config=require(_0xa694('0x8'));var attributes=require(_0xa694('0x9'));module[_0xa694('0xa')]=function(_0x520f1f,_0x3d023d){return _0x520f1f[_0xa694('0xb')](_0xa694('0xc'),attributes,{'tableName':_0xa694('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 51d031d..9835fc2 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 _0x701b=['bluebird','randomstring','../../mysqldb','../../config/utils','jayson/promise','client','request','then','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','VtigerConfiguration,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment'];(function(_0x16e874,_0x154da0){var _0x5460d4=function(_0x464262){while(--_0x464262){_0x16e874['push'](_0x16e874['shift']());}};_0x5460d4(++_0x154da0);}(_0x701b,0x11b));var _0xb701=function(_0x43b320,_0x4b3cf1){_0x43b320=_0x43b320-0x0;var _0x2d8e34=_0x701b[_0x43b320];return _0x2d8e34;};'use strict';var _=require(_0xb701('0x0'));var util=require(_0xb701('0x1'));var moment=require(_0xb701('0x2'));var BPromise=require(_0xb701('0x3'));var rs=require(_0xb701('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb701('0x5'))['db'];var utils=require(_0xb701('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xb701('0x7'));var client=jayson[_0xb701('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x44fa50,_0x829d6a,_0xa3ec33){return new BPromise(function(_0x2227d4,_0x5b59ed){return client[_0xb701('0x9')](_0x44fa50,_0xa3ec33)[_0xb701('0xa')](function(_0x2d8101){logger['info']('VtigerConfiguration,\x20%s,\x20%s',_0x829d6a,_0xb701('0xb'));logger[_0xb701('0xc')](_0xb701('0xd'),_0x829d6a,'request\x20sent',JSON[_0xb701('0xe')](_0x2d8101));if(_0x2d8101[_0xb701('0xf')]){if(_0x2d8101[_0xb701('0xf')][_0xb701('0x10')]===0x1f4){logger[_0xb701('0xf')](_0xb701('0x11'),_0x829d6a,_0x2d8101[_0xb701('0xf')][_0xb701('0x12')]);return _0x5b59ed(_0x2d8101[_0xb701('0xf')][_0xb701('0x12')]);}logger[_0xb701('0xf')]('VtigerConfiguration,\x20%s,\x20%s',_0x829d6a,_0x2d8101[_0xb701('0xf')][_0xb701('0x12')]);return _0x2227d4(_0x2d8101['error'][_0xb701('0x12')]);}else{logger[_0xb701('0x13')]('VtigerConfiguration,\x20%s,\x20%s',_0x829d6a,_0xb701('0xb'));_0x2227d4(_0x2d8101[_0xb701('0x14')][_0xb701('0x12')]);}})[_0xb701('0x15')](function(_0x578b91){logger['error'](_0xb701('0x11'),_0x829d6a,_0x578b91);_0x5b59ed(_0x578b91);});});} \ No newline at end of file +var _0x6bae=['catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','result'];(function(_0x55425f,_0x5f5a1b){var _0x47886f=function(_0x2d639b){while(--_0x2d639b){_0x55425f['push'](_0x55425f['shift']());}};_0x47886f(++_0x5f5a1b);}(_0x6bae,0xd3));var _0xe6ba=function(_0x22e869,_0x55a633){_0x22e869=_0x22e869-0x0;var _0x39c653=_0x6bae[_0x22e869];return _0x39c653;};'use strict';var _=require(_0xe6ba('0x0'));var util=require(_0xe6ba('0x1'));var moment=require('moment');var BPromise=require(_0xe6ba('0x2'));var rs=require(_0xe6ba('0x3'));var fs=require('fs');var Redis=require(_0xe6ba('0x4'));var db=require(_0xe6ba('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xe6ba('0x6'))('rpc');var config=require(_0xe6ba('0x7'));var jayson=require(_0xe6ba('0x8'));var client=jayson[_0xe6ba('0x9')][_0xe6ba('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5406ef,_0x2d1b0e,_0x3ab2a4){return new BPromise(function(_0x306cc0,_0x20e3a6){return client['request'](_0x5406ef,_0x3ab2a4)['then'](function(_0x2e8654){logger[_0xe6ba('0xb')](_0xe6ba('0xc'),_0x2d1b0e,_0xe6ba('0xd'));logger[_0xe6ba('0xe')]('VtigerConfiguration,\x20%s,\x20%s,\x20%s',_0x2d1b0e,_0xe6ba('0xd'),JSON[_0xe6ba('0xf')](_0x2e8654));if(_0x2e8654['error']){if(_0x2e8654['error'][_0xe6ba('0x10')]===0x1f4){logger[_0xe6ba('0x11')]('VtigerConfiguration,\x20%s,\x20%s',_0x2d1b0e,_0x2e8654[_0xe6ba('0x11')][_0xe6ba('0x12')]);return _0x20e3a6(_0x2e8654['error']['message']);}logger[_0xe6ba('0x11')](_0xe6ba('0xc'),_0x2d1b0e,_0x2e8654[_0xe6ba('0x11')][_0xe6ba('0x12')]);return _0x306cc0(_0x2e8654[_0xe6ba('0x11')][_0xe6ba('0x12')]);}else{logger[_0xe6ba('0xb')](_0xe6ba('0xc'),_0x2d1b0e,_0xe6ba('0xd'));_0x306cc0(_0x2e8654[_0xe6ba('0x13')][_0xe6ba('0x12')]);}})[_0xe6ba('0x14')](function(_0x9c06f6){logger[_0xe6ba('0x11')]('VtigerConfiguration,\x20%s,\x20%s',_0x2d1b0e,_0x9c06f6);_0x20e3a6(_0x9c06f6);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index 2b74426..f85b3f2 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 _0x2f2f=['exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy'];(function(_0x2f8619,_0x195689){var _0x13b303=function(_0x31c236){while(--_0x31c236){_0x2f8619['push'](_0x2f8619['shift']());}};_0x13b303(++_0x195689);}(_0x2f2f,0x1c9));var _0xf2f2=function(_0x34d195,_0x4221fa){_0x34d195=_0x34d195-0x0;var _0x3a76cf=_0x2f2f[_0x34d195];return _0x3a76cf;};'use strict';var multer=require(_0xf2f2('0x0'));var util=require('util');var path=require(_0xf2f2('0x1'));var timeout=require(_0xf2f2('0x2'));var express=require('express');var router=express[_0xf2f2('0x3')]();var fs_extra=require(_0xf2f2('0x4'));var auth=require(_0xf2f2('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xf2f2('0x6'));var controller=require('./intVtigerField.controller');router[_0xf2f2('0x7')]('/',auth[_0xf2f2('0x8')](),controller[_0xf2f2('0x9')]);router[_0xf2f2('0x7')](_0xf2f2('0xa'),auth['isAuthenticated'](),controller[_0xf2f2('0xb')]);router[_0xf2f2('0xc')]('/',auth[_0xf2f2('0x8')](),controller[_0xf2f2('0xd')]);router[_0xf2f2('0xe')](_0xf2f2('0xa'),auth['isAuthenticated'](),controller[_0xf2f2('0xf')]);router[_0xf2f2('0x10')](_0xf2f2('0xa'),auth[_0xf2f2('0x8')](),controller[_0xf2f2('0x11')]);module[_0xf2f2('0x12')]=router; \ No newline at end of file +var _0xbe96=['isAuthenticated','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','index','/:id','show'];(function(_0x1d1963,_0x32cc0e){var _0x3f58bb=function(_0x514823){while(--_0x514823){_0x1d1963['push'](_0x1d1963['shift']());}};_0x3f58bb(++_0x32cc0e);}(_0xbe96,0xf7));var _0x6be9=function(_0x3e82f9,_0x48e65d){_0x3e82f9=_0x3e82f9-0x0;var _0xe6316b=_0xbe96[_0x3e82f9];return _0xe6316b;};'use strict';var multer=require(_0x6be9('0x0'));var util=require(_0x6be9('0x1'));var path=require(_0x6be9('0x2'));var timeout=require(_0x6be9('0x3'));var express=require(_0x6be9('0x4'));var router=express[_0x6be9('0x5')]();var fs_extra=require(_0x6be9('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x6be9('0x7'));var config=require(_0x6be9('0x8'));var controller=require('./intVtigerField.controller');router[_0x6be9('0x9')]('/',auth['isAuthenticated'](),controller[_0x6be9('0xa')]);router[_0x6be9('0x9')](_0x6be9('0xb'),auth['isAuthenticated'](),controller[_0x6be9('0xc')]);router['post']('/',auth[_0x6be9('0xd')](),controller[_0x6be9('0xe')]);router[_0x6be9('0xf')](_0x6be9('0xb'),auth[_0x6be9('0xd')](),controller[_0x6be9('0x10')]);router[_0x6be9('0x11')](_0x6be9('0xb'),auth[_0x6be9('0xd')](),controller[_0x6be9('0x12')]);module[_0x6be9('0x13')]=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index 0005ec4..3d39314 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 _0xf57f=['sequelize','exports','ENUM','string','customVariable','picklist','STRING','variable'];(function(_0x11ff55,_0x313baf){var _0x25afdd=function(_0x386058){while(--_0x386058){_0x11ff55['push'](_0x11ff55['shift']());}};_0x25afdd(++_0x313baf);}(_0xf57f,0x148));var _0xff57=function(_0xa99357,_0x50ffad){_0xa99357=_0xa99357-0x0;var _0x111875=_0xf57f[_0xa99357];return _0x111875;};'use strict';var Sequelize=require(_0xff57('0x0'));module[_0xff57('0x1')]={'type':{'type':Sequelize[_0xff57('0x2')](_0xff57('0x3'),'variable',_0xff57('0x4'),'keyValue',_0xff57('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0xff57('0x6')]},'key':{'type':Sequelize[_0xff57('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0xff57('0x3'),_0xff57('0x7'),_0xff57('0x4'))},'keyContent':{'type':Sequelize[_0xff57('0x6')]},'idField':{'type':Sequelize[_0xff57('0x6')]},'nameField':{'type':Sequelize[_0xff57('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xed09=['string','variable','keyValue','picklist','STRING','customVariable','sequelize','exports','ENUM'];(function(_0x22ce8d,_0x4493d9){var _0x54ef9c=function(_0x23d2dd){while(--_0x23d2dd){_0x22ce8d['push'](_0x22ce8d['shift']());}};_0x54ef9c(++_0x4493d9);}(_0xed09,0xc3));var _0x9ed0=function(_0x252699,_0x134b4e){_0x252699=_0x252699-0x0;var _0x56d0c6=_0xed09[_0x252699];return _0x56d0c6;};'use strict';var Sequelize=require(_0x9ed0('0x0'));module[_0x9ed0('0x1')]={'type':{'type':Sequelize[_0x9ed0('0x2')](_0x9ed0('0x3'),_0x9ed0('0x4'),'customVariable',_0x9ed0('0x5'),_0x9ed0('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0x9ed0('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM']('string',_0x9ed0('0x4'),_0x9ed0('0x8'))},'keyContent':{'type':Sequelize[_0x9ed0('0x7')]},'idField':{'type':Sequelize[_0x9ed0('0x7')]},'nameField':{'type':Sequelize[_0x9ed0('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x9ed0('0x7')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index 6b9485c..c74905a 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 _0x7702=['attributes','length','order','sort','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','catch','show','params','find','create','body','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','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','reject','save','update','then','destroy','name','index','map','VtigerField','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields'];(function(_0x564523,_0x5db1c8){var _0x404d2a=function(_0x346236){while(--_0x346236){_0x564523['push'](_0x564523['shift']());}};_0x404d2a(++_0x5db1c8);}(_0x7702,0xeb));var _0x2770=function(_0x1ecf98,_0xc4065e){_0x1ecf98=_0x1ecf98-0x0;var _0x3f2f10=_0x7702[_0x1ecf98];return _0x3f2f10;};'use strict';var emlformat=require(_0x2770('0x0'));var rimraf=require(_0x2770('0x1'));var zipdir=require(_0x2770('0x2'));var jsonpatch=require(_0x2770('0x3'));var rp=require(_0x2770('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x2770('0x5'));var util=require(_0x2770('0x6'));var path=require(_0x2770('0x7'));var sox=require(_0x2770('0x8'));var csv=require(_0x2770('0x9'));var ejs=require(_0x2770('0xa'));var fs=require('fs');var fs_extra=require(_0x2770('0xb'));var _=require(_0x2770('0xc'));var squel=require(_0x2770('0xd'));var crypto=require(_0x2770('0xe'));var jsforce=require(_0x2770('0xf'));var deskjs=require(_0x2770('0x10'));var toCsv=require(_0x2770('0x9'));var querystring=require(_0x2770('0x11'));var Papa=require(_0x2770('0x12'));var Redis=require('ioredis');var authService=require(_0x2770('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x2770('0x14'));var hardwareService=require(_0x2770('0x15'));var logger=require(_0x2770('0x16'))('api');var utils=require('../../config/utils');var config=require(_0x2770('0x17'));var licenseUtil=require(_0x2770('0x18'));var db=require(_0x2770('0x19'))['db'];function respondWithStatusCode(_0x5a7a2f,_0x2c80a3){_0x2c80a3=_0x2c80a3||0xcc;return function(_0x5ca2e9){if(_0x5ca2e9){return _0x5a7a2f[_0x2770('0x1a')](_0x2c80a3);}return _0x5a7a2f[_0x2770('0x1b')](_0x2c80a3)[_0x2770('0x1c')]();};}function respondWithResult(_0x27fa11,_0x27c3ec){_0x27c3ec=_0x27c3ec||0xc8;return function(_0x3cbbb3){if(_0x3cbbb3){return _0x27fa11['status'](_0x27c3ec)[_0x2770('0x1d')](_0x3cbbb3);}};}function respondWithFilteredResult(_0x5306c5,_0x23f7d4){return function(_0x5d6380){if(_0x5d6380){var _0x4cbf6a=typeof _0x23f7d4[_0x2770('0x1e')]===_0x2770('0x1f')&&typeof _0x23f7d4['limit']===_0x2770('0x1f');var _0xbe42f7=_0x5d6380[_0x2770('0x20')];var _0x19a7bc=_0x4cbf6a?0x0:_0x23f7d4[_0x2770('0x1e')];var _0x365b12=_0x4cbf6a?_0x5d6380[_0x2770('0x20')]:_0x23f7d4[_0x2770('0x1e')]+_0x23f7d4[_0x2770('0x21')];var _0x1a7542;if(_0x365b12>=_0xbe42f7){_0x365b12=_0xbe42f7;_0x1a7542=0xc8;}else{_0x1a7542=0xce;}_0x5306c5[_0x2770('0x1b')](_0x1a7542);return _0x5306c5['set'](_0x2770('0x22'),_0x19a7bc+'-'+_0x365b12+'/'+_0xbe42f7)['json'](_0x5d6380);}return null;};}function patchUpdates(_0x4692fc){return function(_0x210566){try{jsonpatch['apply'](_0x210566,_0x4692fc,!![]);}catch(_0x3a9207){return BPromise[_0x2770('0x23')](_0x3a9207);}return _0x210566[_0x2770('0x24')]();};}function saveUpdates(_0x177ae2,_0x510ef2){return function(_0x2916cc){if(_0x2916cc){return _0x2916cc[_0x2770('0x25')](_0x177ae2)[_0x2770('0x26')](function(_0x5779c9){return _0x5779c9;});}return null;};}function removeEntity(_0x131432,_0x288ba5){return function(_0x5d25e1){if(_0x5d25e1){return _0x5d25e1[_0x2770('0x27')]()[_0x2770('0x26')](function(){_0x131432[_0x2770('0x1b')](0xcc)[_0x2770('0x1c')]();});}};}function handleEntityNotFound(_0x155f2f,_0x38ea2e){return function(_0x5d15af){if(!_0x5d15af){_0x155f2f['sendStatus'](0x194);}return _0x5d15af;};}function handleError(_0x235e01,_0x262077){_0x262077=_0x262077||0x1f4;return function(_0x1588fa){logger['error'](_0x1588fa['stack']);if(_0x1588fa[_0x2770('0x28')]){delete _0x1588fa[_0x2770('0x28')];}_0x235e01[_0x2770('0x1b')](_0x262077)['send'](_0x1588fa);};}exports[_0x2770('0x29')]=function(_0x1718be,_0x1e7737){var _0x27663f={},_0x2109de={},_0x5678f1={'count':0x0,'rows':[]};var _0x18220d=_[_0x2770('0x2a')](db[_0x2770('0x2b')][_0x2770('0x2c')],function(_0x280fa3){return{'name':_0x280fa3[_0x2770('0x2d')],'type':_0x280fa3['type'][_0x2770('0x2e')]};});_0x2109de[_0x2770('0x2f')]=_[_0x2770('0x2a')](_0x18220d,_0x2770('0x28'));_0x2109de[_0x2770('0x30')]=_[_0x2770('0x31')](_0x1718be[_0x2770('0x30')]);_0x2109de[_0x2770('0x32')]=_[_0x2770('0x33')](_0x2109de[_0x2770('0x2f')],_0x2109de[_0x2770('0x30')]);_0x27663f['attributes']=_[_0x2770('0x33')](_0x2109de['model'],qs[_0x2770('0x34')](_0x1718be[_0x2770('0x30')][_0x2770('0x34')]));_0x27663f[_0x2770('0x35')]=_0x27663f[_0x2770('0x35')][_0x2770('0x36')]?_0x27663f[_0x2770('0x35')]:_0x2109de[_0x2770('0x2f')];if(!_0x1718be[_0x2770('0x30')]['hasOwnProperty']('nolimit')){_0x27663f['limit']=qs[_0x2770('0x21')](_0x1718be['query'][_0x2770('0x21')]);_0x27663f['offset']=qs[_0x2770('0x1e')](_0x1718be[_0x2770('0x30')][_0x2770('0x1e')]);}_0x27663f[_0x2770('0x37')]=qs[_0x2770('0x38')](_0x1718be['query'][_0x2770('0x38')]);_0x27663f['where']=qs[_0x2770('0x32')](_['pick'](_0x1718be[_0x2770('0x30')],_0x2109de['filters']),_0x18220d);if(_0x1718be[_0x2770('0x30')][_0x2770('0x39')]){_0x27663f[_0x2770('0x3a')]=_[_0x2770('0x3b')](_0x27663f[_0x2770('0x3a')],{'$or':_[_0x2770('0x2a')](_0x18220d,function(_0xbd8f07){if(_0xbd8f07[_0x2770('0x3c')]!==_0x2770('0x3d')){var _0x3acbd3={};_0x3acbd3[_0xbd8f07[_0x2770('0x28')]]={'$like':'%'+_0x1718be[_0x2770('0x30')][_0x2770('0x39')]+'%'};return _0x3acbd3;}})});}_0x27663f=_[_0x2770('0x3b')]({},_0x27663f,_0x1718be[_0x2770('0x3e')]);var _0x3ec63f={'where':_0x27663f[_0x2770('0x3a')]};return db[_0x2770('0x2b')][_0x2770('0x20')](_0x3ec63f)[_0x2770('0x26')](function(_0x22a2db){_0x5678f1[_0x2770('0x20')]=_0x22a2db;if(_0x1718be[_0x2770('0x30')][_0x2770('0x3f')]){_0x27663f[_0x2770('0x40')]=[{'all':!![]}];}return db[_0x2770('0x2b')][_0x2770('0x41')](_0x27663f);})[_0x2770('0x26')](function(_0x3516ed){_0x5678f1['rows']=_0x3516ed;return _0x5678f1;})[_0x2770('0x26')](respondWithFilteredResult(_0x1e7737,_0x27663f))[_0x2770('0x42')](handleError(_0x1e7737,null));};exports[_0x2770('0x43')]=function(_0x42078d,_0x1482c2){var _0x3925ce={'raw':!![],'where':{'id':_0x42078d[_0x2770('0x44')]['id']}},_0x4f1ff1={};_0x4f1ff1[_0x2770('0x2f')]=_[_0x2770('0x31')](db[_0x2770('0x2b')][_0x2770('0x2c')]);_0x4f1ff1['query']=_[_0x2770('0x31')](_0x42078d[_0x2770('0x30')]);_0x4f1ff1[_0x2770('0x32')]=_[_0x2770('0x33')](_0x4f1ff1[_0x2770('0x2f')],_0x4f1ff1[_0x2770('0x30')]);_0x3925ce['attributes']=_[_0x2770('0x33')](_0x4f1ff1['model'],qs['fields'](_0x42078d[_0x2770('0x30')]['fields']));_0x3925ce[_0x2770('0x35')]=_0x3925ce[_0x2770('0x35')]['length']?_0x3925ce[_0x2770('0x35')]:_0x4f1ff1[_0x2770('0x2f')];if(_0x42078d['query'][_0x2770('0x3f')]){_0x3925ce[_0x2770('0x40')]=[{'all':!![]}];}_0x3925ce=_[_0x2770('0x3b')]({},_0x3925ce,_0x42078d[_0x2770('0x3e')]);return db['VtigerField'][_0x2770('0x45')](_0x3925ce)[_0x2770('0x26')](handleEntityNotFound(_0x1482c2,null))['then'](respondWithResult(_0x1482c2,null))[_0x2770('0x42')](handleError(_0x1482c2,null));};exports[_0x2770('0x46')]=function(_0x2417f1,_0x69a87e){return db[_0x2770('0x2b')][_0x2770('0x46')](_0x2417f1[_0x2770('0x47')],{})[_0x2770('0x26')](respondWithResult(_0x69a87e,0xc9))[_0x2770('0x42')](handleError(_0x69a87e,null));};exports[_0x2770('0x25')]=function(_0x4e31be,_0x5421fa){if(_0x4e31be[_0x2770('0x47')]['id']){delete _0x4e31be['body']['id'];}return db['VtigerField'][_0x2770('0x45')]({'where':{'id':_0x4e31be[_0x2770('0x44')]['id']}})[_0x2770('0x26')](handleEntityNotFound(_0x5421fa,null))[_0x2770('0x26')](saveUpdates(_0x4e31be[_0x2770('0x47')],null))['then'](respondWithResult(_0x5421fa,null))[_0x2770('0x42')](handleError(_0x5421fa,null));};exports[_0x2770('0x27')]=function(_0x503aad,_0x173404){return db['VtigerField'][_0x2770('0x45')]({'where':{'id':_0x503aad[_0x2770('0x44')]['id']}})[_0x2770('0x26')](handleEntityNotFound(_0x173404,null))[_0x2770('0x26')](removeEntity(_0x173404,null))[_0x2770('0x42')](handleError(_0x173404,null));}; \ No newline at end of file +var _0x8c9c=['create','body','find','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/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','destroy','then','error','stack','name','send','map','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','VIRTUAL','filter','merge','options','VtigerField','findAll','rows','catch','show','params','keys','rawAttributes','includeAll','include'];(function(_0x2e9d8e,_0x3a377e){var _0x4dfc9b=function(_0x499ec4){while(--_0x499ec4){_0x2e9d8e['push'](_0x2e9d8e['shift']());}};_0x4dfc9b(++_0x3a377e);}(_0x8c9c,0xa7));var _0xc8c9=function(_0x3564d6,_0x37d1cb){_0x3564d6=_0x3564d6-0x0;var _0x1f2267=_0x8c9c[_0x3564d6];return _0x1f2267;};'use strict';var emlformat=require(_0xc8c9('0x0'));var rimraf=require(_0xc8c9('0x1'));var zipdir=require(_0xc8c9('0x2'));var jsonpatch=require(_0xc8c9('0x3'));var rp=require(_0xc8c9('0x4'));var moment=require(_0xc8c9('0x5'));var BPromise=require(_0xc8c9('0x6'));var Mustache=require(_0xc8c9('0x7'));var util=require(_0xc8c9('0x8'));var path=require(_0xc8c9('0x9'));var sox=require(_0xc8c9('0xa'));var csv=require(_0xc8c9('0xb'));var ejs=require(_0xc8c9('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc8c9('0xd'));var squel=require(_0xc8c9('0xe'));var crypto=require(_0xc8c9('0xf'));var jsforce=require(_0xc8c9('0x10'));var deskjs=require(_0xc8c9('0x11'));var toCsv=require(_0xc8c9('0xb'));var querystring=require(_0xc8c9('0x12'));var Papa=require(_0xc8c9('0x13'));var Redis=require(_0xc8c9('0x14'));var authService=require('../../components/auth/service');var qs=require(_0xc8c9('0x15'));var as=require(_0xc8c9('0x16'));var hardwareService=require(_0xc8c9('0x17'));var logger=require(_0xc8c9('0x18'))(_0xc8c9('0x19'));var utils=require(_0xc8c9('0x1a'));var config=require(_0xc8c9('0x1b'));var licenseUtil=require(_0xc8c9('0x1c'));var db=require(_0xc8c9('0x1d'))['db'];function respondWithStatusCode(_0x514bdd,_0x5a2bab){_0x5a2bab=_0x5a2bab||0xcc;return function(_0xdc966){if(_0xdc966){return _0x514bdd[_0xc8c9('0x1e')](_0x5a2bab);}return _0x514bdd[_0xc8c9('0x1f')](_0x5a2bab)[_0xc8c9('0x20')]();};}function respondWithResult(_0x1aef51,_0x58d33a){_0x58d33a=_0x58d33a||0xc8;return function(_0x22dda2){if(_0x22dda2){return _0x1aef51['status'](_0x58d33a)[_0xc8c9('0x21')](_0x22dda2);}};}function respondWithFilteredResult(_0x5d74ef,_0x21c1ee){return function(_0xceed2b){if(_0xceed2b){var _0x52219b=typeof _0x21c1ee[_0xc8c9('0x22')]===_0xc8c9('0x23')&&typeof _0x21c1ee[_0xc8c9('0x24')]===_0xc8c9('0x23');var _0x4aad66=_0xceed2b[_0xc8c9('0x25')];var _0x3681ee=_0x52219b?0x0:_0x21c1ee[_0xc8c9('0x22')];var _0x591011=_0x52219b?_0xceed2b[_0xc8c9('0x25')]:_0x21c1ee[_0xc8c9('0x22')]+_0x21c1ee[_0xc8c9('0x24')];var _0x38aa97;if(_0x591011>=_0x4aad66){_0x591011=_0x4aad66;_0x38aa97=0xc8;}else{_0x38aa97=0xce;}_0x5d74ef[_0xc8c9('0x1f')](_0x38aa97);return _0x5d74ef[_0xc8c9('0x26')](_0xc8c9('0x27'),_0x3681ee+'-'+_0x591011+'/'+_0x4aad66)['json'](_0xceed2b);}return null;};}function patchUpdates(_0x33d7ff){return function(_0x21cdb6){try{jsonpatch[_0xc8c9('0x28')](_0x21cdb6,_0x33d7ff,!![]);}catch(_0x5efeea){return BPromise['reject'](_0x5efeea);}return _0x21cdb6[_0xc8c9('0x29')]();};}function saveUpdates(_0x350e9f,_0x522abc){return function(_0x31f816){if(_0x31f816){return _0x31f816[_0xc8c9('0x2a')](_0x350e9f)['then'](function(_0xfae16e){return _0xfae16e;});}return null;};}function removeEntity(_0x61ac24,_0x88d26a){return function(_0xca8f79){if(_0xca8f79){return _0xca8f79[_0xc8c9('0x2b')]()[_0xc8c9('0x2c')](function(){_0x61ac24[_0xc8c9('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x15f33c,_0x582607){return function(_0x15bd02){if(!_0x15bd02){_0x15f33c[_0xc8c9('0x1e')](0x194);}return _0x15bd02;};}function handleError(_0x239ce6,_0x2ff39c){_0x2ff39c=_0x2ff39c||0x1f4;return function(_0x559ea1){logger[_0xc8c9('0x2d')](_0x559ea1[_0xc8c9('0x2e')]);if(_0x559ea1[_0xc8c9('0x2f')]){delete _0x559ea1[_0xc8c9('0x2f')];}_0x239ce6[_0xc8c9('0x1f')](_0x2ff39c)[_0xc8c9('0x30')](_0x559ea1);};}exports['index']=function(_0x23a9a4,_0x352472){var _0x3edb95={},_0x2e4ba3={},_0x4bcf58={'count':0x0,'rows':[]};var _0x3d9e0d=_[_0xc8c9('0x31')](db['VtigerField']['rawAttributes'],function(_0x3ee883){return{'name':_0x3ee883[_0xc8c9('0x32')],'type':_0x3ee883[_0xc8c9('0x33')][_0xc8c9('0x34')]};});_0x2e4ba3[_0xc8c9('0x35')]=_['map'](_0x3d9e0d,_0xc8c9('0x2f'));_0x2e4ba3[_0xc8c9('0x36')]=_['keys'](_0x23a9a4[_0xc8c9('0x36')]);_0x2e4ba3[_0xc8c9('0x37')]=_['intersection'](_0x2e4ba3[_0xc8c9('0x35')],_0x2e4ba3[_0xc8c9('0x36')]);_0x3edb95[_0xc8c9('0x38')]=_[_0xc8c9('0x39')](_0x2e4ba3[_0xc8c9('0x35')],qs[_0xc8c9('0x3a')](_0x23a9a4['query'][_0xc8c9('0x3a')]));_0x3edb95[_0xc8c9('0x38')]=_0x3edb95['attributes'][_0xc8c9('0x3b')]?_0x3edb95['attributes']:_0x2e4ba3[_0xc8c9('0x35')];if(!_0x23a9a4[_0xc8c9('0x36')][_0xc8c9('0x3c')](_0xc8c9('0x3d'))){_0x3edb95[_0xc8c9('0x24')]=qs['limit'](_0x23a9a4['query']['limit']);_0x3edb95[_0xc8c9('0x22')]=qs[_0xc8c9('0x22')](_0x23a9a4['query']['offset']);}_0x3edb95[_0xc8c9('0x3e')]=qs[_0xc8c9('0x3f')](_0x23a9a4['query']['sort']);_0x3edb95[_0xc8c9('0x40')]=qs[_0xc8c9('0x37')](_['pick'](_0x23a9a4[_0xc8c9('0x36')],_0x2e4ba3[_0xc8c9('0x37')]),_0x3d9e0d);if(_0x23a9a4[_0xc8c9('0x36')]['filter']){_0x3edb95[_0xc8c9('0x40')]=_['merge'](_0x3edb95[_0xc8c9('0x40')],{'$or':_[_0xc8c9('0x31')](_0x3d9e0d,function(_0x2c1ba5){if(_0x2c1ba5[_0xc8c9('0x33')]!==_0xc8c9('0x41')){var _0x3e7fcf={};_0x3e7fcf[_0x2c1ba5['name']]={'$like':'%'+_0x23a9a4[_0xc8c9('0x36')][_0xc8c9('0x42')]+'%'};return _0x3e7fcf;}})});}_0x3edb95=_[_0xc8c9('0x43')]({},_0x3edb95,_0x23a9a4[_0xc8c9('0x44')]);var _0x7e1d5d={'where':_0x3edb95[_0xc8c9('0x40')]};return db[_0xc8c9('0x45')]['count'](_0x7e1d5d)[_0xc8c9('0x2c')](function(_0x2d9e8b){_0x4bcf58[_0xc8c9('0x25')]=_0x2d9e8b;if(_0x23a9a4[_0xc8c9('0x36')]['includeAll']){_0x3edb95['include']=[{'all':!![]}];}return db[_0xc8c9('0x45')][_0xc8c9('0x46')](_0x3edb95);})[_0xc8c9('0x2c')](function(_0x2b0912){_0x4bcf58[_0xc8c9('0x47')]=_0x2b0912;return _0x4bcf58;})[_0xc8c9('0x2c')](respondWithFilteredResult(_0x352472,_0x3edb95))[_0xc8c9('0x48')](handleError(_0x352472,null));};exports[_0xc8c9('0x49')]=function(_0x6d0ae5,_0x594769){var _0x512072={'raw':!![],'where':{'id':_0x6d0ae5[_0xc8c9('0x4a')]['id']}},_0x25cbb4={};_0x25cbb4['model']=_[_0xc8c9('0x4b')](db[_0xc8c9('0x45')][_0xc8c9('0x4c')]);_0x25cbb4[_0xc8c9('0x36')]=_[_0xc8c9('0x4b')](_0x6d0ae5[_0xc8c9('0x36')]);_0x25cbb4[_0xc8c9('0x37')]=_[_0xc8c9('0x39')](_0x25cbb4['model'],_0x25cbb4[_0xc8c9('0x36')]);_0x512072[_0xc8c9('0x38')]=_['intersection'](_0x25cbb4[_0xc8c9('0x35')],qs[_0xc8c9('0x3a')](_0x6d0ae5[_0xc8c9('0x36')]['fields']));_0x512072[_0xc8c9('0x38')]=_0x512072[_0xc8c9('0x38')][_0xc8c9('0x3b')]?_0x512072['attributes']:_0x25cbb4[_0xc8c9('0x35')];if(_0x6d0ae5[_0xc8c9('0x36')][_0xc8c9('0x4d')]){_0x512072[_0xc8c9('0x4e')]=[{'all':!![]}];}_0x512072=_[_0xc8c9('0x43')]({},_0x512072,_0x6d0ae5[_0xc8c9('0x44')]);return db[_0xc8c9('0x45')]['find'](_0x512072)[_0xc8c9('0x2c')](handleEntityNotFound(_0x594769,null))[_0xc8c9('0x2c')](respondWithResult(_0x594769,null))[_0xc8c9('0x48')](handleError(_0x594769,null));};exports[_0xc8c9('0x4f')]=function(_0x309f64,_0x13f488){return db[_0xc8c9('0x45')][_0xc8c9('0x4f')](_0x309f64['body'],{})[_0xc8c9('0x2c')](respondWithResult(_0x13f488,0xc9))['catch'](handleError(_0x13f488,null));};exports[_0xc8c9('0x2a')]=function(_0x2d0718,_0x1791e1){if(_0x2d0718[_0xc8c9('0x50')]['id']){delete _0x2d0718['body']['id'];}return db[_0xc8c9('0x45')][_0xc8c9('0x51')]({'where':{'id':_0x2d0718['params']['id']}})[_0xc8c9('0x2c')](handleEntityNotFound(_0x1791e1,null))[_0xc8c9('0x2c')](saveUpdates(_0x2d0718['body'],null))[_0xc8c9('0x2c')](respondWithResult(_0x1791e1,null))[_0xc8c9('0x48')](handleError(_0x1791e1,null));};exports[_0xc8c9('0x2b')]=function(_0x26e93b,_0x2c4ee8){return db[_0xc8c9('0x45')][_0xc8c9('0x51')]({'where':{'id':_0x26e93b[_0xc8c9('0x4a')]['id']}})['then'](handleEntityNotFound(_0x2c4ee8,null))['then'](removeEntity(_0x2c4ee8,null))[_0xc8c9('0x48')](handleError(_0x2c4ee8,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index a4820fd..3f8b145 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 _0x0665=['exports','define','VtigerField','int_vtiger_fields','vtiger_unique_index','idField','FieldId','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerField.attributes'];(function(_0x13ea00,_0x12f610){var _0x1f7347=function(_0x34ae63){while(--_0x34ae63){_0x13ea00['push'](_0x13ea00['shift']());}};_0x1f7347(++_0x12f610);}(_0x0665,0x106));var _0x5066=function(_0x47409a,_0x1e4537){_0x47409a=_0x47409a-0x0;var _0x3192bc=_0x0665[_0x47409a];return _0x3192bc;};'use strict';var _=require(_0x5066('0x0'));var util=require(_0x5066('0x1'));var logger=require('../../config/logger')(_0x5066('0x2'));var moment=require(_0x5066('0x3'));var BPromise=require(_0x5066('0x4'));var rp=require(_0x5066('0x5'));var fs=require('fs');var path=require(_0x5066('0x6'));var rimraf=require(_0x5066('0x7'));var config=require(_0x5066('0x8'));var attributes=require(_0x5066('0x9'));module[_0x5066('0xa')]=function(_0x337ebf,_0x2f3178){return _0x337ebf[_0x5066('0xb')](_0x5066('0xc'),attributes,{'tableName':_0x5066('0xd'),'paranoid':![],'indexes':[{'name':_0x5066('0xe'),'fields':[_0x5066('0xf'),_0x5066('0x10')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xda51=['exports','VtigerField','vtiger_unique_index','FieldId','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerField.attributes'];(function(_0x257cb8,_0x1e9503){var _0x254073=function(_0x111f07){while(--_0x111f07){_0x257cb8['push'](_0x257cb8['shift']());}};_0x254073(++_0x1e9503);}(_0xda51,0x17e));var _0x1da5=function(_0x3df223,_0x1740fc){_0x3df223=_0x3df223-0x0;var _0x562d11=_0xda51[_0x3df223];return _0x562d11;};'use strict';var _=require(_0x1da5('0x0'));var util=require('util');var logger=require(_0x1da5('0x1'))(_0x1da5('0x2'));var moment=require(_0x1da5('0x3'));var BPromise=require(_0x1da5('0x4'));var rp=require(_0x1da5('0x5'));var fs=require('fs');var path=require(_0x1da5('0x6'));var rimraf=require(_0x1da5('0x7'));var config=require(_0x1da5('0x8'));var attributes=require(_0x1da5('0x9'));module[_0x1da5('0xa')]=function(_0xcea126,_0x3031f7){return _0xcea126['define'](_0x1da5('0xb'),attributes,{'tableName':'int_vtiger_fields','paranoid':![],'indexes':[{'name':_0x1da5('0xc'),'fields':['idField',_0x1da5('0xd')],'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 54b7f93..1f21cd8 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 _0x3ad3=['moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','VtigerField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash'];(function(_0x15dfa0,_0x1eb065){var _0x299dd2=function(_0x42fef5){while(--_0x42fef5){_0x15dfa0['push'](_0x15dfa0['shift']());}};_0x299dd2(++_0x1eb065);}(_0x3ad3,0x1b8));var _0x33ad=function(_0x5438ab,_0x2a2a99){_0x5438ab=_0x5438ab-0x0;var _0x5a710a=_0x3ad3[_0x5438ab];return _0x5a710a;};'use strict';var _=require(_0x33ad('0x0'));var util=require('util');var moment=require(_0x33ad('0x1'));var BPromise=require(_0x33ad('0x2'));var rs=require(_0x33ad('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x33ad('0x4'))['db'];var utils=require(_0x33ad('0x5'));var logger=require(_0x33ad('0x6'))('rpc');var config=require(_0x33ad('0x7'));var jayson=require(_0x33ad('0x8'));var client=jayson['client'][_0x33ad('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x20c536,_0x5d7473,_0x2f9004){return new BPromise(function(_0x497e40,_0x8a9f9b){return client[_0x33ad('0xa')](_0x20c536,_0x2f9004)[_0x33ad('0xb')](function(_0x5ce4c5){logger[_0x33ad('0xc')](_0x33ad('0xd'),_0x5d7473,_0x33ad('0xe'));logger[_0x33ad('0xf')]('VtigerField,\x20%s,\x20%s,\x20%s',_0x5d7473,_0x33ad('0xe'),JSON[_0x33ad('0x10')](_0x5ce4c5));if(_0x5ce4c5[_0x33ad('0x11')]){if(_0x5ce4c5[_0x33ad('0x11')][_0x33ad('0x12')]===0x1f4){logger[_0x33ad('0x11')]('VtigerField,\x20%s,\x20%s',_0x5d7473,_0x5ce4c5[_0x33ad('0x11')][_0x33ad('0x13')]);return _0x8a9f9b(_0x5ce4c5[_0x33ad('0x11')][_0x33ad('0x13')]);}logger['error'](_0x33ad('0xd'),_0x5d7473,_0x5ce4c5[_0x33ad('0x11')][_0x33ad('0x13')]);return _0x497e40(_0x5ce4c5[_0x33ad('0x11')]['message']);}else{logger[_0x33ad('0xc')](_0x33ad('0xd'),_0x5d7473,'request\x20sent');_0x497e40(_0x5ce4c5[_0x33ad('0x14')][_0x33ad('0x13')]);}})['catch'](function(_0x321fe4){logger[_0x33ad('0x11')](_0x33ad('0xd'),_0x5d7473,_0x321fe4);_0x8a9f9b(_0x321fe4);});});} \ No newline at end of file +var _0xe735=['code','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VtigerField,\x20%s,\x20%s','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x536bf1,_0xcef6ea){var _0x2ef863=function(_0x406540){while(--_0x406540){_0x536bf1['push'](_0x536bf1['shift']());}};_0x2ef863(++_0xcef6ea);}(_0xe735,0xc4));var _0x5e73=function(_0x152fe3,_0x12b0c8){_0x152fe3=_0x152fe3-0x0;var _0xc5bb39=_0xe735[_0x152fe3];return _0xc5bb39;};'use strict';var _=require(_0x5e73('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x5e73('0x1'));var rs=require(_0x5e73('0x2'));var fs=require('fs');var Redis=require(_0x5e73('0x3'));var db=require(_0x5e73('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x5e73('0x5'))(_0x5e73('0x6'));var config=require(_0x5e73('0x7'));var jayson=require(_0x5e73('0x8'));var client=jayson[_0x5e73('0x9')][_0x5e73('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x17e271,_0x3d7356,_0xeeb8ac){return new BPromise(function(_0x4bc989,_0x11856d){return client[_0x5e73('0xb')](_0x17e271,_0xeeb8ac)[_0x5e73('0xc')](function(_0x465402){logger[_0x5e73('0xd')](_0x5e73('0xe'),_0x3d7356,_0x5e73('0xf'));logger[_0x5e73('0x10')](_0x5e73('0x11'),_0x3d7356,_0x5e73('0xf'),JSON[_0x5e73('0x12')](_0x465402));if(_0x465402[_0x5e73('0x13')]){if(_0x465402['error'][_0x5e73('0x14')]===0x1f4){logger[_0x5e73('0x13')](_0x5e73('0xe'),_0x3d7356,_0x465402['error'][_0x5e73('0x15')]);return _0x11856d(_0x465402[_0x5e73('0x13')][_0x5e73('0x15')]);}logger[_0x5e73('0x13')]('VtigerField,\x20%s,\x20%s',_0x3d7356,_0x465402['error']['message']);return _0x4bc989(_0x465402[_0x5e73('0x13')][_0x5e73('0x15')]);}else{logger[_0x5e73('0xd')](_0x5e73('0xe'),_0x3d7356,'request\x20sent');_0x4bc989(_0x465402[_0x5e73('0x16')][_0x5e73('0x15')]);}})[_0x5e73('0x17')](function(_0x2f204c){logger[_0x5e73('0x13')]('VtigerField,\x20%s,\x20%s',_0x3d7356,_0x2f204c);_0x11856d(_0x2f204c);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index ca86184..af13080 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 _0xd4a8=['put','/:id','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intZendeskAccount.controller','get','index','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','getFields','create','post','addConfiguration'];(function(_0x19f5d0,_0x1f1fca){var _0xa44d26=function(_0x404f0d){while(--_0x404f0d){_0x19f5d0['push'](_0x19f5d0['shift']());}};_0xa44d26(++_0x1f1fca);}(_0xd4a8,0x13d));var _0x8d4a=function(_0x5a00e5,_0x18c3ae){_0x5a00e5=_0x5a00e5-0x0;var _0xfd2924=_0xd4a8[_0x5a00e5];return _0xfd2924;};'use strict';var multer=require(_0x8d4a('0x0'));var util=require(_0x8d4a('0x1'));var path=require(_0x8d4a('0x2'));var timeout=require(_0x8d4a('0x3'));var express=require(_0x8d4a('0x4'));var router=express[_0x8d4a('0x5')]();var fs_extra=require(_0x8d4a('0x6'));var auth=require(_0x8d4a('0x7'));var interaction=require(_0x8d4a('0x8'));var config=require('../../config/environment');var controller=require(_0x8d4a('0x9'));router[_0x8d4a('0xa')]('/',auth['isAuthenticated'](),controller[_0x8d4a('0xb')]);router['get']('/:id',auth[_0x8d4a('0xc')](),controller[_0x8d4a('0xd')]);router[_0x8d4a('0xa')](_0x8d4a('0xe'),auth[_0x8d4a('0xc')](),controller[_0x8d4a('0xf')]);router[_0x8d4a('0xa')](_0x8d4a('0x10'),auth[_0x8d4a('0xc')](),controller[_0x8d4a('0x11')]);router['post']('/',auth[_0x8d4a('0xc')](),controller[_0x8d4a('0x12')]);router[_0x8d4a('0x13')](_0x8d4a('0xe'),auth['isAuthenticated'](),controller[_0x8d4a('0x14')]);router[_0x8d4a('0x15')](_0x8d4a('0x16'),auth[_0x8d4a('0xc')](),controller['update']);router[_0x8d4a('0x17')]('/:id',auth[_0x8d4a('0xc')](),controller[_0x8d4a('0x18')]);module[_0x8d4a('0x19')]=router; \ No newline at end of file +var _0x9fee=['addConfiguration','delete','destroy','exports','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskAccount.controller','get','index','/:id','show','/:id/configurations','isAuthenticated','getConfigurations','/:id/fields','post'];(function(_0x199ebc,_0x932210){var _0x399651=function(_0x1a974c){while(--_0x1a974c){_0x199ebc['push'](_0x199ebc['shift']());}};_0x399651(++_0x932210);}(_0x9fee,0x1e7));var _0xe9fe=function(_0x5dc8ae,_0x27ad1e){_0x5dc8ae=_0x5dc8ae-0x0;var _0x31dd0f=_0x9fee[_0x5dc8ae];return _0x31dd0f;};'use strict';var multer=require('multer');var util=require(_0xe9fe('0x0'));var path=require(_0xe9fe('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xe9fe('0x2')]();var fs_extra=require(_0xe9fe('0x3'));var auth=require(_0xe9fe('0x4'));var interaction=require(_0xe9fe('0x5'));var config=require(_0xe9fe('0x6'));var controller=require(_0xe9fe('0x7'));router[_0xe9fe('0x8')]('/',auth['isAuthenticated'](),controller[_0xe9fe('0x9')]);router[_0xe9fe('0x8')](_0xe9fe('0xa'),auth['isAuthenticated'](),controller[_0xe9fe('0xb')]);router[_0xe9fe('0x8')](_0xe9fe('0xc'),auth[_0xe9fe('0xd')](),controller[_0xe9fe('0xe')]);router[_0xe9fe('0x8')](_0xe9fe('0xf'),auth[_0xe9fe('0xd')](),controller['getFields']);router[_0xe9fe('0x10')]('/',auth[_0xe9fe('0xd')](),controller['create']);router['post'](_0xe9fe('0xc'),auth['isAuthenticated'](),controller[_0xe9fe('0x11')]);router['put'](_0xe9fe('0xa'),auth['isAuthenticated'](),controller['update']);router[_0xe9fe('0x12')](_0xe9fe('0xa'),auth[_0xe9fe('0xd')](),controller[_0xe9fe('0x13')]);module[_0xe9fe('0x14')]=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index 1aefdb2..dcba9ad 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 _0xee87=['remoteUri','ENUM','token','integrationTab','newTab','exports','STRING','username'];(function(_0x169f18,_0x420bb9){var _0x3f9427=function(_0x19774e){while(--_0x19774e){_0x169f18['push'](_0x169f18['shift']());}};_0x3f9427(++_0x420bb9);}(_0xee87,0x10d));var _0x7ee8=function(_0x2d8e7f,_0x21fb3c){_0x2d8e7f=_0x2d8e7f-0x0;var _0x29875e=_0xee87[_0x2d8e7f];return _0x29875e;};'use strict';var Sequelize=require('sequelize');module[_0x7ee8('0x0')]={'name':{'type':Sequelize[_0x7ee8('0x1')]},'description':{'type':Sequelize[_0x7ee8('0x1')]},'username':{'type':Sequelize[_0x7ee8('0x1')],'unique':_0x7ee8('0x2')},'password':{'type':Sequelize[_0x7ee8('0x1')]},'token':{'type':Sequelize[_0x7ee8('0x1')]},'remoteUri':{'type':Sequelize[_0x7ee8('0x1')],'unique':_0x7ee8('0x3')},'authType':{'type':Sequelize[_0x7ee8('0x4')]('password',_0x7ee8('0x5')),'defaultValue':'password'},'serverUrl':{'type':Sequelize[_0x7ee8('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x7ee8('0x4')](_0x7ee8('0x6'),_0x7ee8('0x7')),'defaultValue':_0x7ee8('0x6')}}; \ No newline at end of file +var _0xa809=['integrationTab','exports','STRING','remoteUri','ENUM','password'];(function(_0x3d45ab,_0x2ac619){var _0x119a22=function(_0x84909e){while(--_0x84909e){_0x3d45ab['push'](_0x3d45ab['shift']());}};_0x119a22(++_0x2ac619);}(_0xa809,0x1f3));var _0x9a80=function(_0x47d8ca,_0x1b7121){_0x47d8ca=_0x47d8ca-0x0;var _0x318529=_0xa809[_0x47d8ca];return _0x318529;};'use strict';var Sequelize=require('sequelize');module[_0x9a80('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x9a80('0x1')],'unique':'username'},'password':{'type':Sequelize['STRING']},'token':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x9a80('0x1')],'unique':_0x9a80('0x2')},'authType':{'type':Sequelize[_0x9a80('0x3')](_0x9a80('0x4'),'token'),'defaultValue':_0x9a80('0x4')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x9a80('0x3')](_0x9a80('0x5'),'newTab'),'defaultValue':_0x9a80('0x5')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index 848bdf9..0c4685a 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 _0x9751=['Descriptions','getDescriptions','ZendeskField','getFields','username','password','token','remoteUri','substring','lastIndexOf','GET','format','%s/%s','ticket_fields','authType','headers','Basic\x20%s','%s:%s','toString','%s/token:%s','base64','Sequelize','Unknown\x20authentication\x20type','description','assignee','remove','position','title','system_field_options','custom_field_options','statusCode','getFields,\x20%s,\x20%s,\x20%s','test','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','request','then','info','ZendeskAccount,\x20%s,\x20%s','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','destroy','name','send','index','map','ZendeskAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','create','body','findOne','ZendeskConfiguration','length','sort','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','channel'];(function(_0x121886,_0x8cd8e5){var _0x20ca01=function(_0x15e144){while(--_0x15e144){_0x121886['push'](_0x121886['shift']());}};_0x20ca01(++_0x8cd8e5);}(_0x9751,0x1b3));var _0x1975=function(_0x20713e,_0x44f710){_0x20713e=_0x20713e-0x0;var _0x7d998b=_0x9751[_0x20713e];return _0x7d998b;};'use strict';var emlformat=require(_0x1975('0x0'));var rimraf=require(_0x1975('0x1'));var zipdir=require(_0x1975('0x2'));var jsonpatch=require(_0x1975('0x3'));var rp=require(_0x1975('0x4'));var moment=require(_0x1975('0x5'));var BPromise=require(_0x1975('0x6'));var Mustache=require(_0x1975('0x7'));var util=require(_0x1975('0x8'));var path=require(_0x1975('0x9'));var sox=require(_0x1975('0xa'));var csv=require(_0x1975('0xb'));var ejs=require(_0x1975('0xc'));var fs=require('fs');var fs_extra=require(_0x1975('0xd'));var _=require('lodash');var squel=require(_0x1975('0xe'));var crypto=require(_0x1975('0xf'));var jsforce=require(_0x1975('0x10'));var deskjs=require(_0x1975('0x11'));var toCsv=require(_0x1975('0xb'));var querystring=require(_0x1975('0x12'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x1975('0x13'));var qs=require(_0x1975('0x14'));var as=require(_0x1975('0x15'));var hardwareService=require(_0x1975('0x16'));var logger=require(_0x1975('0x17'))(_0x1975('0x18'));var utils=require('../../config/utils');var config=require(_0x1975('0x19'));var licenseUtil=require(_0x1975('0x1a'));var db=require(_0x1975('0x1b'))['db'];var integrations=require(_0x1975('0x1c'));var jayson=require(_0x1975('0x1d'));var client=jayson[_0x1975('0x1e')][_0x1975('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x1ac458,_0x5984e1,_0x3bf6aa,_0x4ebcda){return new BPromise(function(_0x1267bf,_0x1f31a1){var _0x1ee8d0=_0x4ebcda||client;return _0x1ee8d0[_0x1975('0x20')](_0x1ac458,_0x3bf6aa)[_0x1975('0x21')](function(_0x222852){logger[_0x1975('0x22')](_0x1975('0x23'),_0x5984e1,'request\x20sent');logger[_0x1975('0x24')](_0x1975('0x25'),_0x5984e1,'request\x20sent',JSON[_0x1975('0x26')](_0x222852));if(_0x222852[_0x1975('0x27')]){if(_0x222852[_0x1975('0x27')]['code']===0x1f4){logger[_0x1975('0x27')](_0x1975('0x23'),_0x5984e1,_0x222852[_0x1975('0x27')][_0x1975('0x28')]);return _0x1f31a1(_0x222852[_0x1975('0x27')][_0x1975('0x28')]);}logger['error'](_0x1975('0x23'),_0x5984e1,_0x222852[_0x1975('0x27')][_0x1975('0x28')]);return _0x1267bf(_0x222852['error'][_0x1975('0x28')]);}else{logger[_0x1975('0x22')](_0x1975('0x23'),_0x5984e1,_0x1975('0x29'));_0x1267bf(_0x222852[_0x1975('0x2a')][_0x1975('0x28')]);}})[_0x1975('0x2b')](function(_0x3dbcb7){logger[_0x1975('0x27')](_0x1975('0x23'),_0x5984e1,_0x3dbcb7);_0x1f31a1(_0x3dbcb7);});});}function respondWithStatusCode(_0x3c0d86,_0x45e91b){_0x45e91b=_0x45e91b||0xcc;return function(_0x4ce9c7){if(_0x4ce9c7){return _0x3c0d86[_0x1975('0x2c')](_0x45e91b);}return _0x3c0d86[_0x1975('0x2d')](_0x45e91b)[_0x1975('0x2e')]();};}function respondWithResult(_0x459cd3,_0x2e4516){_0x2e4516=_0x2e4516||0xc8;return function(_0x1c9b9e){if(_0x1c9b9e){return _0x459cd3[_0x1975('0x2d')](_0x2e4516)[_0x1975('0x2f')](_0x1c9b9e);}};}function respondWithFilteredResult(_0x5c376f,_0x599f2c){return function(_0x5c526e){if(_0x5c526e){var _0x187ea7=typeof _0x599f2c[_0x1975('0x30')]===_0x1975('0x31')&&typeof _0x599f2c['limit']===_0x1975('0x31');var _0x508416=_0x5c526e[_0x1975('0x32')];var _0x28cb2b=_0x187ea7?0x0:_0x599f2c[_0x1975('0x30')];var _0xf336e2=_0x187ea7?_0x5c526e[_0x1975('0x32')]:_0x599f2c['offset']+_0x599f2c[_0x1975('0x33')];var _0x3c8df3;if(_0xf336e2>=_0x508416){_0xf336e2=_0x508416;_0x3c8df3=0xc8;}else{_0x3c8df3=0xce;}_0x5c376f[_0x1975('0x2d')](_0x3c8df3);return _0x5c376f['set'](_0x1975('0x34'),_0x28cb2b+'-'+_0xf336e2+'/'+_0x508416)[_0x1975('0x2f')](_0x5c526e);}return null;};}function patchUpdates(_0x466811){return function(_0x4cc57a){try{jsonpatch[_0x1975('0x35')](_0x4cc57a,_0x466811,!![]);}catch(_0x5f251d){return BPromise[_0x1975('0x36')](_0x5f251d);}return _0x4cc57a[_0x1975('0x37')]();};}function saveUpdates(_0x783a3,_0x535792){return function(_0x25f07c){if(_0x25f07c){return _0x25f07c[_0x1975('0x38')](_0x783a3)[_0x1975('0x21')](function(_0x38ab22){return _0x38ab22;});}return null;};}function removeEntity(_0xdc163d,_0x31927c){return function(_0x56990b){if(_0x56990b){return _0x56990b[_0x1975('0x39')]()[_0x1975('0x21')](function(){_0xdc163d[_0x1975('0x2d')](0xcc)[_0x1975('0x2e')]();});}};}function handleEntityNotFound(_0x454b82,_0x490694){return function(_0x3dfb42){if(!_0x3dfb42){_0x454b82['sendStatus'](0x194);}return _0x3dfb42;};}function handleError(_0xc914ea,_0x204d30){_0x204d30=_0x204d30||0x1f4;return function(_0xec79f1){logger[_0x1975('0x27')](_0xec79f1['stack']);if(_0xec79f1[_0x1975('0x3a')]){delete _0xec79f1['name'];}_0xc914ea[_0x1975('0x2d')](_0x204d30)[_0x1975('0x3b')](_0xec79f1);};}exports[_0x1975('0x3c')]=function(_0x131411,_0x135fab){var _0x5ef037={},_0x3ebaac={},_0x43a112={'count':0x0,'rows':[]};var _0x5dcc47=_[_0x1975('0x3d')](db[_0x1975('0x3e')][_0x1975('0x3f')],function(_0x204aca){return{'name':_0x204aca[_0x1975('0x40')],'type':_0x204aca[_0x1975('0x41')][_0x1975('0x42')]};});_0x3ebaac[_0x1975('0x43')]=_['map'](_0x5dcc47,_0x1975('0x3a'));_0x3ebaac[_0x1975('0x44')]=_[_0x1975('0x45')](_0x131411[_0x1975('0x44')]);_0x3ebaac[_0x1975('0x46')]=_['intersection'](_0x3ebaac['model'],_0x3ebaac[_0x1975('0x44')]);_0x5ef037['attributes']=_[_0x1975('0x47')](_0x3ebaac[_0x1975('0x43')],qs[_0x1975('0x48')](_0x131411['query'][_0x1975('0x48')]));_0x5ef037[_0x1975('0x49')]=_0x5ef037[_0x1975('0x49')]['length']?_0x5ef037[_0x1975('0x49')]:_0x3ebaac['model'];if(!_0x131411[_0x1975('0x44')][_0x1975('0x4a')](_0x1975('0x4b'))){_0x5ef037[_0x1975('0x33')]=qs[_0x1975('0x33')](_0x131411[_0x1975('0x44')]['limit']);_0x5ef037[_0x1975('0x30')]=qs[_0x1975('0x30')](_0x131411[_0x1975('0x44')]['offset']);}_0x5ef037[_0x1975('0x4c')]=qs['sort'](_0x131411[_0x1975('0x44')]['sort']);_0x5ef037[_0x1975('0x4d')]=qs['filters'](_['pick'](_0x131411[_0x1975('0x44')],_0x3ebaac['filters']),_0x5dcc47);if(_0x131411[_0x1975('0x44')][_0x1975('0x4e')]){_0x5ef037['where']=_[_0x1975('0x4f')](_0x5ef037['where'],{'$or':_['map'](_0x5dcc47,function(_0x34c976){if(_0x34c976[_0x1975('0x41')]!==_0x1975('0x50')){var _0x36614a={};_0x36614a[_0x34c976[_0x1975('0x3a')]]={'$like':'%'+_0x131411['query'][_0x1975('0x4e')]+'%'};return _0x36614a;}})});}_0x5ef037=_[_0x1975('0x4f')]({},_0x5ef037,_0x131411[_0x1975('0x51')]);var _0x40087f={'where':_0x5ef037['where']};return db[_0x1975('0x3e')][_0x1975('0x32')](_0x40087f)[_0x1975('0x21')](function(_0x3dced3){_0x43a112[_0x1975('0x32')]=_0x3dced3;if(_0x131411['query'][_0x1975('0x52')]){_0x5ef037[_0x1975('0x53')]=[{'all':!![]}];}return db[_0x1975('0x3e')][_0x1975('0x54')](_0x5ef037);})['then'](function(_0xe5ab50){_0x43a112[_0x1975('0x55')]=_0xe5ab50;return _0x43a112;})['then'](respondWithFilteredResult(_0x135fab,_0x5ef037))[_0x1975('0x2b')](handleError(_0x135fab,null));};exports[_0x1975('0x56')]=function(_0x340f66,_0x2df196){var _0x439bf1={'raw':![],'where':{'id':_0x340f66[_0x1975('0x57')]['id']}},_0x222f4d={};_0x222f4d[_0x1975('0x43')]=_[_0x1975('0x45')](db[_0x1975('0x3e')][_0x1975('0x3f')]);_0x222f4d['query']=_['keys'](_0x340f66[_0x1975('0x44')]);_0x222f4d[_0x1975('0x46')]=_['intersection'](_0x222f4d[_0x1975('0x43')],_0x222f4d[_0x1975('0x44')]);_0x439bf1[_0x1975('0x49')]=_['intersection'](_0x222f4d['model'],qs[_0x1975('0x48')](_0x340f66[_0x1975('0x44')][_0x1975('0x48')]));_0x439bf1[_0x1975('0x49')]=_0x439bf1[_0x1975('0x49')]['length']?_0x439bf1[_0x1975('0x49')]:_0x222f4d[_0x1975('0x43')];if(_0x340f66[_0x1975('0x44')][_0x1975('0x52')]){_0x439bf1[_0x1975('0x53')]=[{'all':!![]}];}_0x439bf1=_['merge']({},_0x439bf1,_0x340f66['options']);return db[_0x1975('0x3e')][_0x1975('0x58')](_0x439bf1)[_0x1975('0x21')](handleEntityNotFound(_0x2df196,null))['then'](respondWithResult(_0x2df196,null))[_0x1975('0x2b')](handleError(_0x2df196,null));};exports[_0x1975('0x59')]=function(_0x33d83a,_0x54e74d){return db[_0x1975('0x3e')][_0x1975('0x59')](_0x33d83a[_0x1975('0x5a')],{})[_0x1975('0x21')](respondWithResult(_0x54e74d,0xc9))[_0x1975('0x2b')](handleError(_0x54e74d,null));};exports[_0x1975('0x38')]=function(_0x51a557,_0xe17309){if(_0x51a557['body']['id']){delete _0x51a557[_0x1975('0x5a')]['id'];}return db[_0x1975('0x3e')][_0x1975('0x58')]({'where':{'id':_0x51a557[_0x1975('0x57')]['id']}})[_0x1975('0x21')](handleEntityNotFound(_0xe17309,null))[_0x1975('0x21')](saveUpdates(_0x51a557['body'],null))[_0x1975('0x21')](respondWithResult(_0xe17309,null))[_0x1975('0x2b')](handleError(_0xe17309,null));};exports['destroy']=function(_0x5dd66f,_0xadc331){return db['ZendeskAccount'][_0x1975('0x58')]({'where':{'id':_0x5dd66f[_0x1975('0x57')]['id']}})['then'](handleEntityNotFound(_0xadc331,null))[_0x1975('0x21')](removeEntity(_0xadc331,null))[_0x1975('0x2b')](handleError(_0xadc331,null));};exports['getConfigurations']=function(_0x21c5f9,_0x184deb,_0x27bfb0){var _0x5b8df0={};var _0x82aeab={};var _0x190001;var _0x24170e;return db[_0x1975('0x3e')][_0x1975('0x5b')]({'where':{'id':_0x21c5f9[_0x1975('0x57')]['id']}})[_0x1975('0x21')](handleEntityNotFound(_0x184deb,null))[_0x1975('0x21')](function(_0x3cff60){if(_0x3cff60){_0x190001=_0x3cff60;_0x82aeab['model']=_[_0x1975('0x45')](db[_0x1975('0x5c')][_0x1975('0x3f')]);_0x82aeab[_0x1975('0x44')]=_[_0x1975('0x45')](_0x21c5f9[_0x1975('0x44')]);_0x82aeab[_0x1975('0x46')]=_[_0x1975('0x47')](_0x82aeab[_0x1975('0x43')],_0x82aeab[_0x1975('0x44')]);_0x5b8df0[_0x1975('0x49')]=_[_0x1975('0x47')](_0x82aeab[_0x1975('0x43')],qs[_0x1975('0x48')](_0x21c5f9[_0x1975('0x44')][_0x1975('0x48')]));_0x5b8df0[_0x1975('0x49')]=_0x5b8df0['attributes'][_0x1975('0x5d')]?_0x5b8df0[_0x1975('0x49')]:_0x82aeab[_0x1975('0x43')];_0x5b8df0[_0x1975('0x4c')]=qs[_0x1975('0x5e')](_0x21c5f9[_0x1975('0x44')][_0x1975('0x5e')]);_0x5b8df0[_0x1975('0x4d')]=qs[_0x1975('0x46')](_['pick'](_0x21c5f9['query'],_0x82aeab[_0x1975('0x46')]));if(_0x21c5f9[_0x1975('0x44')][_0x1975('0x4e')]){_0x5b8df0[_0x1975('0x4d')]=_['merge'](_0x5b8df0[_0x1975('0x4d')],{'$or':_[_0x1975('0x3d')](_0x5b8df0[_0x1975('0x49')],function(_0x1eb9ed){var _0x304fc8={};_0x304fc8[_0x1eb9ed]={'$like':'%'+_0x21c5f9[_0x1975('0x44')][_0x1975('0x4e')]+'%'};return _0x304fc8;})});}_0x5b8df0=_['merge']({},_0x5b8df0,_0x21c5f9[_0x1975('0x51')]);return _0x190001[_0x1975('0x5f')](_0x5b8df0);}})[_0x1975('0x21')](function(_0x334cd6){if(_0x334cd6){_0x24170e=_0x334cd6[_0x1975('0x5d')];if(!_0x21c5f9[_0x1975('0x44')]['hasOwnProperty']('nolimit')){_0x5b8df0[_0x1975('0x33')]=qs[_0x1975('0x33')](_0x21c5f9[_0x1975('0x44')]['limit']);_0x5b8df0['offset']=qs[_0x1975('0x30')](_0x21c5f9[_0x1975('0x44')][_0x1975('0x30')]);}return _0x190001[_0x1975('0x5f')](_0x5b8df0);}})[_0x1975('0x21')](function(_0x103eb8){if(_0x103eb8){return _0x103eb8?{'count':_0x24170e,'rows':_0x103eb8}:null;}})[_0x1975('0x21')](respondWithResult(_0x184deb,null))[_0x1975('0x2b')](handleError(_0x184deb,null));};exports[_0x1975('0x60')]=function(_0x25dd0d,_0x1952fe,_0x50b7fe){if(_0x25dd0d['body']['id']){delete _0x25dd0d[_0x1975('0x5a')]['id'];}return db[_0x1975('0x3e')][_0x1975('0x5b')]({'where':{'id':_0x25dd0d[_0x1975('0x57')]['id']}})[_0x1975('0x21')](handleEntityNotFound(_0x1952fe,null))[_0x1975('0x21')](function(_0x2f844e){if(_0x2f844e){_0x25dd0d[_0x1975('0x5a')][_0x1975('0x61')]=_0x2f844e['id'];_0x25dd0d['body'][_0x1975('0x62')]=integrations[_0x1975('0x63')](_0x25dd0d[_0x1975('0x5a')][_0x1975('0x64')],_0x25dd0d[_0x1975('0x5a')][_0x1975('0x41')]);_0x25dd0d['body'][_0x1975('0x65')]=integrations[_0x1975('0x66')](_0x25dd0d[_0x1975('0x5a')][_0x1975('0x64')],_0x25dd0d['body'][_0x1975('0x41')]);return db[_0x1975('0x5c')]['create'](_0x25dd0d[_0x1975('0x5a')],{'include':[{'model':db[_0x1975('0x67')],'as':_0x1975('0x62')},{'model':db[_0x1975('0x67')],'as':_0x1975('0x65')}]});}return null;})[_0x1975('0x21')](respondWithResult(_0x1952fe,null))['catch'](handleError(_0x1952fe,null));};exports[_0x1975('0x68')]=function(_0x305463,_0xfe7f19,_0x160c2b){var _0x36fa8b='';return db['ZendeskAccount'][_0x1975('0x5b')]({'where':{'id':_0x305463[_0x1975('0x57')]['id']},'attributes':['id',_0x1975('0x69'),_0x1975('0x6a'),_0x1975('0x6b'),'authType',_0x1975('0x6c')]})[_0x1975('0x21')](handleEntityNotFound(_0xfe7f19,null))[_0x1975('0x21')](function(_0x289ede){if(_0x289ede){_0x36fa8b=_0x289ede[_0x1975('0x6c')];var _0x1a9918=_0x36fa8b['slice'](-0x1);if(_0x1a9918==='/'){_0x36fa8b=_0x36fa8b[_0x1975('0x6d')](0x0,_0x36fa8b[_0x1975('0x6e')](_0x1a9918));}var _0x3ad591={'method':_0x1975('0x6f'),'uri':util[_0x1975('0x70')](_0x1975('0x71'),_0x36fa8b,_0x1975('0x72')),'json':!![]};switch(_0x289ede[_0x1975('0x73')]){case'password':_0x3ad591[_0x1975('0x74')]={'Authorization':util[_0x1975('0x70')](_0x1975('0x75'),new Buffer(util[_0x1975('0x70')](_0x1975('0x76'),_0x289ede[_0x1975('0x69')],_0x289ede[_0x1975('0x6a')]))[_0x1975('0x77')]('base64'))};break;case _0x1975('0x6b'):_0x3ad591[_0x1975('0x74')]={'Authorization':util[_0x1975('0x70')](_0x1975('0x75'),new Buffer(util['format'](_0x1975('0x78'),_0x289ede[_0x1975('0x69')],_0x289ede[_0x1975('0x6b')]))[_0x1975('0x77')](_0x1975('0x79')))};break;default:throw new db[(_0x1975('0x7a'))]['ValidationError'](_0x1975('0x7b'));}return rp(_0x3ad591);}})[_0x1975('0x21')](function(_0x234606){if(_0x234606){var _0x1c0ffe=['subject',_0x1975('0x7c'),'group',_0x1975('0x7d')];_[_0x1975('0x7e')](_0x234606[_0x1975('0x72')],function(_0x308cce){return _0x1c0ffe['includes'](_0x308cce[_0x1975('0x41')]);});return{'count':_0x234606[_0x1975('0x72')]['length'],'rows':_[_0x1975('0x3d')](_0x234606[_0x1975('0x72')],function(_0x1f4573){return{'id':_0x1f4573['id'],'name':_0x1f4573[_0x1975('0x7f')]>0x7?_0x1f4573[_0x1975('0x80')]:_0x1f4573['type'],'custom':_0x1f4573[_0x1975('0x7f')]>0x7?!![]:![],'options':_0x1f4573['system_field_options']?_0x1f4573[_0x1975('0x81')]:_0x1f4573[_0x1975('0x82')]?_0x1f4573[_0x1975('0x82')]:[]};})};}})[_0x1975('0x21')](respondWithResult(_0xfe7f19,null))[_0x1975('0x2b')](function(_0x147fc0){var _0x7d4563=_0x305463['query']['test']?0x1f4:_0x147fc0[_0x1975('0x83')]||0x1f4;logger[_0x1975('0x27')](_0x1975('0x84'),_0x1975('0x68'),_0x7d4563,JSON['stringify'](_0x147fc0));delete _0x147fc0[_0x1975('0x3a')];if(_0x7d4563===0x191){_0x7d4563=0x190;}_0xfe7f19[_0x1975('0x2d')](_0x7d4563)[_0x1975('0x3b')](_0x305463['query'][_0x1975('0x85')]?{'message':'Wrong\x20credentials','statusCode':_0x147fc0[_0x1975('0x83')]}:_0x147fc0);});}; \ No newline at end of file +var _0x0828=['where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','rawAttributes','find','create','body','destroy','getConfigurations','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ZendeskConfiguration','ZendeskField','getFields','remoteUri','slice','substring','lastIndexOf','GET','format','%s/%s','authType','password','headers','Basic\x20%s','username','token','%s/token:%s','toString','base64','ValidationError','Unknown\x20authentication\x20type','subject','description','group','assignee','remove','ticket_fields','includes','position','system_field_options','custom_field_options','test','statusCode','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','http','info','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','ZendeskAccount,\x20%s,\x20%s','message','result','catch','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','end','sendStatus','stack','name','send','ZendeskAccount','fieldName','type','key','map','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort'];(function(_0x5d40f9,_0x412da8){var _0x859408=function(_0x3dd335){while(--_0x3dd335){_0x5d40f9['push'](_0x5d40f9['shift']());}};_0x859408(++_0x412da8);}(_0x0828,0x1cc));var _0x8082=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x0828[_0x618414];return _0x21c19a;};'use strict';var emlformat=require(_0x8082('0x0'));var rimraf=require(_0x8082('0x1'));var zipdir=require(_0x8082('0x2'));var jsonpatch=require(_0x8082('0x3'));var rp=require(_0x8082('0x4'));var moment=require('moment');var BPromise=require(_0x8082('0x5'));var Mustache=require('mustache');var util=require(_0x8082('0x6'));var path=require(_0x8082('0x7'));var sox=require(_0x8082('0x8'));var csv=require(_0x8082('0x9'));var ejs=require(_0x8082('0xa'));var fs=require('fs');var fs_extra=require(_0x8082('0xb'));var _=require(_0x8082('0xc'));var squel=require(_0x8082('0xd'));var crypto=require(_0x8082('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x8082('0xf'));var toCsv=require('to-csv');var querystring=require(_0x8082('0x10'));var Papa=require(_0x8082('0x11'));var Redis=require(_0x8082('0x12'));var authService=require(_0x8082('0x13'));var qs=require(_0x8082('0x14'));var as=require(_0x8082('0x15'));var hardwareService=require(_0x8082('0x16'));var logger=require(_0x8082('0x17'))('api');var utils=require(_0x8082('0x18'));var config=require(_0x8082('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x8082('0x1a'))['db'];var integrations=require(_0x8082('0x1b'));var jayson=require(_0x8082('0x1c'));var client=jayson['client'][_0x8082('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x319c1c,_0x932c9c,_0x175732,_0x22aad8){return new BPromise(function(_0x100f77,_0xed5fa6){var _0x14b992=_0x22aad8||client;return _0x14b992['request'](_0x319c1c,_0x175732)['then'](function(_0xb9865d){logger[_0x8082('0x1e')]('ZendeskAccount,\x20%s,\x20%s',_0x932c9c,_0x8082('0x1f'));logger[_0x8082('0x20')](_0x8082('0x21'),_0x932c9c,'request\x20sent',JSON[_0x8082('0x22')](_0xb9865d));if(_0xb9865d[_0x8082('0x23')]){if(_0xb9865d['error'][_0x8082('0x24')]===0x1f4){logger[_0x8082('0x23')](_0x8082('0x25'),_0x932c9c,_0xb9865d['error'][_0x8082('0x26')]);return _0xed5fa6(_0xb9865d[_0x8082('0x23')][_0x8082('0x26')]);}logger[_0x8082('0x23')](_0x8082('0x25'),_0x932c9c,_0xb9865d[_0x8082('0x23')][_0x8082('0x26')]);return _0x100f77(_0xb9865d['error'][_0x8082('0x26')]);}else{logger[_0x8082('0x1e')](_0x8082('0x25'),_0x932c9c,_0x8082('0x1f'));_0x100f77(_0xb9865d[_0x8082('0x27')][_0x8082('0x26')]);}})[_0x8082('0x28')](function(_0x399fc0){logger['error']('ZendeskAccount,\x20%s,\x20%s',_0x932c9c,_0x399fc0);_0xed5fa6(_0x399fc0);});});}function respondWithStatusCode(_0xa068a,_0x3f447f){_0x3f447f=_0x3f447f||0xcc;return function(_0x30cffc){if(_0x30cffc){return _0xa068a['sendStatus'](_0x3f447f);}return _0xa068a[_0x8082('0x29')](_0x3f447f)['end']();};}function respondWithResult(_0x31d735,_0x309a90){_0x309a90=_0x309a90||0xc8;return function(_0x2025bd){if(_0x2025bd){return _0x31d735['status'](_0x309a90)[_0x8082('0x2a')](_0x2025bd);}};}function respondWithFilteredResult(_0x215c91,_0x2f88b1){return function(_0x5d5132){if(_0x5d5132){var _0xbbf11d=typeof _0x2f88b1[_0x8082('0x2b')]===_0x8082('0x2c')&&typeof _0x2f88b1[_0x8082('0x2d')]===_0x8082('0x2c');var _0x548db1=_0x5d5132[_0x8082('0x2e')];var _0x4df47a=_0xbbf11d?0x0:_0x2f88b1[_0x8082('0x2b')];var _0x19bbcb=_0xbbf11d?_0x5d5132['count']:_0x2f88b1[_0x8082('0x2b')]+_0x2f88b1['limit'];var _0x1a8032;if(_0x19bbcb>=_0x548db1){_0x19bbcb=_0x548db1;_0x1a8032=0xc8;}else{_0x1a8032=0xce;}_0x215c91[_0x8082('0x29')](_0x1a8032);return _0x215c91[_0x8082('0x2f')](_0x8082('0x30'),_0x4df47a+'-'+_0x19bbcb+'/'+_0x548db1)[_0x8082('0x2a')](_0x5d5132);}return null;};}function patchUpdates(_0x478d88){return function(_0x1725e3){try{jsonpatch[_0x8082('0x31')](_0x1725e3,_0x478d88,!![]);}catch(_0x2b0914){return BPromise[_0x8082('0x32')](_0x2b0914);}return _0x1725e3[_0x8082('0x33')]();};}function saveUpdates(_0x5ad282,_0x13520b){return function(_0x23b36d){if(_0x23b36d){return _0x23b36d[_0x8082('0x34')](_0x5ad282)[_0x8082('0x35')](function(_0x102908){return _0x102908;});}return null;};}function removeEntity(_0x301148,_0x374afe){return function(_0x19aba1){if(_0x19aba1){return _0x19aba1['destroy']()['then'](function(){_0x301148['status'](0xcc)[_0x8082('0x36')]();});}};}function handleEntityNotFound(_0xaaeae4,_0x4d6d5e){return function(_0x1c472c){if(!_0x1c472c){_0xaaeae4[_0x8082('0x37')](0x194);}return _0x1c472c;};}function handleError(_0x2b245f,_0x4f2b72){_0x4f2b72=_0x4f2b72||0x1f4;return function(_0x2e2507){logger[_0x8082('0x23')](_0x2e2507[_0x8082('0x38')]);if(_0x2e2507[_0x8082('0x39')]){delete _0x2e2507[_0x8082('0x39')];}_0x2b245f['status'](_0x4f2b72)[_0x8082('0x3a')](_0x2e2507);};}exports['index']=function(_0x52611b,_0x289c77){var _0x2f9546={},_0x392a16={},_0x47e4f3={'count':0x0,'rows':[]};var _0x569c72=_['map'](db[_0x8082('0x3b')]['rawAttributes'],function(_0x5bf5df){return{'name':_0x5bf5df[_0x8082('0x3c')],'type':_0x5bf5df[_0x8082('0x3d')][_0x8082('0x3e')]};});_0x392a16['model']=_[_0x8082('0x3f')](_0x569c72,_0x8082('0x39'));_0x392a16['query']=_[_0x8082('0x40')](_0x52611b[_0x8082('0x41')]);_0x392a16[_0x8082('0x42')]=_[_0x8082('0x43')](_0x392a16[_0x8082('0x44')],_0x392a16[_0x8082('0x41')]);_0x2f9546[_0x8082('0x45')]=_[_0x8082('0x43')](_0x392a16[_0x8082('0x44')],qs['fields'](_0x52611b[_0x8082('0x41')][_0x8082('0x46')]));_0x2f9546[_0x8082('0x45')]=_0x2f9546[_0x8082('0x45')][_0x8082('0x47')]?_0x2f9546['attributes']:_0x392a16['model'];if(!_0x52611b[_0x8082('0x41')][_0x8082('0x48')](_0x8082('0x49'))){_0x2f9546['limit']=qs[_0x8082('0x2d')](_0x52611b['query'][_0x8082('0x2d')]);_0x2f9546[_0x8082('0x2b')]=qs[_0x8082('0x2b')](_0x52611b['query'][_0x8082('0x2b')]);}_0x2f9546[_0x8082('0x4a')]=qs[_0x8082('0x4b')](_0x52611b['query'][_0x8082('0x4b')]);_0x2f9546[_0x8082('0x4c')]=qs[_0x8082('0x42')](_[_0x8082('0x4d')](_0x52611b[_0x8082('0x41')],_0x392a16[_0x8082('0x42')]),_0x569c72);if(_0x52611b[_0x8082('0x41')][_0x8082('0x4e')]){_0x2f9546[_0x8082('0x4c')]=_[_0x8082('0x4f')](_0x2f9546['where'],{'$or':_[_0x8082('0x3f')](_0x569c72,function(_0x253168){if(_0x253168[_0x8082('0x3d')]!==_0x8082('0x50')){var _0xbebd4d={};_0xbebd4d[_0x253168[_0x8082('0x39')]]={'$like':'%'+_0x52611b['query'][_0x8082('0x4e')]+'%'};return _0xbebd4d;}})});}_0x2f9546=_[_0x8082('0x4f')]({},_0x2f9546,_0x52611b['options']);var _0x5890f8={'where':_0x2f9546[_0x8082('0x4c')]};return db['ZendeskAccount'][_0x8082('0x2e')](_0x5890f8)[_0x8082('0x35')](function(_0x38dcfb){_0x47e4f3[_0x8082('0x2e')]=_0x38dcfb;if(_0x52611b['query'][_0x8082('0x51')]){_0x2f9546[_0x8082('0x52')]=[{'all':!![]}];}return db[_0x8082('0x3b')][_0x8082('0x53')](_0x2f9546);})[_0x8082('0x35')](function(_0xaa283c){_0x47e4f3[_0x8082('0x54')]=_0xaa283c;return _0x47e4f3;})[_0x8082('0x35')](respondWithFilteredResult(_0x289c77,_0x2f9546))['catch'](handleError(_0x289c77,null));};exports[_0x8082('0x55')]=function(_0x41710b,_0x145d27){var _0x572bdc={'raw':![],'where':{'id':_0x41710b[_0x8082('0x56')]['id']}},_0x4f0743={};_0x4f0743[_0x8082('0x44')]=_['keys'](db['ZendeskAccount'][_0x8082('0x57')]);_0x4f0743[_0x8082('0x41')]=_[_0x8082('0x40')](_0x41710b[_0x8082('0x41')]);_0x4f0743[_0x8082('0x42')]=_[_0x8082('0x43')](_0x4f0743[_0x8082('0x44')],_0x4f0743[_0x8082('0x41')]);_0x572bdc['attributes']=_[_0x8082('0x43')](_0x4f0743['model'],qs[_0x8082('0x46')](_0x41710b['query']['fields']));_0x572bdc[_0x8082('0x45')]=_0x572bdc[_0x8082('0x45')][_0x8082('0x47')]?_0x572bdc['attributes']:_0x4f0743[_0x8082('0x44')];if(_0x41710b[_0x8082('0x41')][_0x8082('0x51')]){_0x572bdc['include']=[{'all':!![]}];}_0x572bdc=_['merge']({},_0x572bdc,_0x41710b['options']);return db['ZendeskAccount'][_0x8082('0x58')](_0x572bdc)[_0x8082('0x35')](handleEntityNotFound(_0x145d27,null))[_0x8082('0x35')](respondWithResult(_0x145d27,null))[_0x8082('0x28')](handleError(_0x145d27,null));};exports[_0x8082('0x59')]=function(_0x5ac88f,_0x213eee){return db['ZendeskAccount'][_0x8082('0x59')](_0x5ac88f['body'],{})[_0x8082('0x35')](respondWithResult(_0x213eee,0xc9))[_0x8082('0x28')](handleError(_0x213eee,null));};exports[_0x8082('0x34')]=function(_0x9a090a,_0x2d1e9e){if(_0x9a090a['body']['id']){delete _0x9a090a[_0x8082('0x5a')]['id'];}return db['ZendeskAccount']['find']({'where':{'id':_0x9a090a[_0x8082('0x56')]['id']}})['then'](handleEntityNotFound(_0x2d1e9e,null))['then'](saveUpdates(_0x9a090a[_0x8082('0x5a')],null))[_0x8082('0x35')](respondWithResult(_0x2d1e9e,null))[_0x8082('0x28')](handleError(_0x2d1e9e,null));};exports[_0x8082('0x5b')]=function(_0x33e213,_0x12fa45){return db[_0x8082('0x3b')][_0x8082('0x58')]({'where':{'id':_0x33e213[_0x8082('0x56')]['id']}})[_0x8082('0x35')](handleEntityNotFound(_0x12fa45,null))[_0x8082('0x35')](removeEntity(_0x12fa45,null))[_0x8082('0x28')](handleError(_0x12fa45,null));};exports['getConfigurations']=function(_0x1dc9b8,_0x43b89e,_0x1b77fb){var _0x4ac59b={};var _0x1131b2={};var _0x40a317;var _0x478b6b;return db['ZendeskAccount']['findOne']({'where':{'id':_0x1dc9b8[_0x8082('0x56')]['id']}})[_0x8082('0x35')](handleEntityNotFound(_0x43b89e,null))[_0x8082('0x35')](function(_0x3ac889){if(_0x3ac889){_0x40a317=_0x3ac889;_0x1131b2[_0x8082('0x44')]=_[_0x8082('0x40')](db['ZendeskConfiguration'][_0x8082('0x57')]);_0x1131b2[_0x8082('0x41')]=_[_0x8082('0x40')](_0x1dc9b8[_0x8082('0x41')]);_0x1131b2[_0x8082('0x42')]=_[_0x8082('0x43')](_0x1131b2[_0x8082('0x44')],_0x1131b2['query']);_0x4ac59b[_0x8082('0x45')]=_[_0x8082('0x43')](_0x1131b2[_0x8082('0x44')],qs[_0x8082('0x46')](_0x1dc9b8['query'][_0x8082('0x46')]));_0x4ac59b['attributes']=_0x4ac59b[_0x8082('0x45')][_0x8082('0x47')]?_0x4ac59b[_0x8082('0x45')]:_0x1131b2['model'];_0x4ac59b[_0x8082('0x4a')]=qs[_0x8082('0x4b')](_0x1dc9b8[_0x8082('0x41')][_0x8082('0x4b')]);_0x4ac59b[_0x8082('0x4c')]=qs[_0x8082('0x42')](_[_0x8082('0x4d')](_0x1dc9b8['query'],_0x1131b2['filters']));if(_0x1dc9b8[_0x8082('0x41')]['filter']){_0x4ac59b[_0x8082('0x4c')]=_[_0x8082('0x4f')](_0x4ac59b[_0x8082('0x4c')],{'$or':_['map'](_0x4ac59b['attributes'],function(_0x5b7ef6){var _0x264f2f={};_0x264f2f[_0x5b7ef6]={'$like':'%'+_0x1dc9b8[_0x8082('0x41')][_0x8082('0x4e')]+'%'};return _0x264f2f;})});}_0x4ac59b=_[_0x8082('0x4f')]({},_0x4ac59b,_0x1dc9b8['options']);return _0x40a317[_0x8082('0x5c')](_0x4ac59b);}})['then'](function(_0x4d6c3f){if(_0x4d6c3f){_0x478b6b=_0x4d6c3f[_0x8082('0x47')];if(!_0x1dc9b8[_0x8082('0x41')][_0x8082('0x48')]('nolimit')){_0x4ac59b[_0x8082('0x2d')]=qs[_0x8082('0x2d')](_0x1dc9b8[_0x8082('0x41')]['limit']);_0x4ac59b[_0x8082('0x2b')]=qs[_0x8082('0x2b')](_0x1dc9b8[_0x8082('0x41')][_0x8082('0x2b')]);}return _0x40a317['getConfigurations'](_0x4ac59b);}})['then'](function(_0x5044bc){if(_0x5044bc){return _0x5044bc?{'count':_0x478b6b,'rows':_0x5044bc}:null;}})['then'](respondWithResult(_0x43b89e,null))[_0x8082('0x28')](handleError(_0x43b89e,null));};exports['addConfiguration']=function(_0x1b5c13,_0x53370d,_0x349708){if(_0x1b5c13[_0x8082('0x5a')]['id']){delete _0x1b5c13[_0x8082('0x5a')]['id'];}return db[_0x8082('0x3b')][_0x8082('0x5d')]({'where':{'id':_0x1b5c13[_0x8082('0x56')]['id']}})[_0x8082('0x35')](handleEntityNotFound(_0x53370d,null))['then'](function(_0x506fc7){if(_0x506fc7){_0x1b5c13[_0x8082('0x5a')][_0x8082('0x5e')]=_0x506fc7['id'];_0x1b5c13[_0x8082('0x5a')][_0x8082('0x5f')]=integrations[_0x8082('0x60')](_0x1b5c13['body'][_0x8082('0x61')],_0x1b5c13[_0x8082('0x5a')][_0x8082('0x3d')]);_0x1b5c13[_0x8082('0x5a')][_0x8082('0x62')]=integrations[_0x8082('0x63')](_0x1b5c13[_0x8082('0x5a')]['channel'],_0x1b5c13[_0x8082('0x5a')][_0x8082('0x3d')]);return db[_0x8082('0x64')][_0x8082('0x59')](_0x1b5c13[_0x8082('0x5a')],{'include':[{'model':db[_0x8082('0x65')],'as':_0x8082('0x5f')},{'model':db['ZendeskField'],'as':_0x8082('0x62')}]});}return null;})[_0x8082('0x35')](respondWithResult(_0x53370d,null))[_0x8082('0x28')](handleError(_0x53370d,null));};exports[_0x8082('0x66')]=function(_0x385138,_0x29fff2,_0x26941c){var _0x236214='';return db[_0x8082('0x3b')][_0x8082('0x5d')]({'where':{'id':_0x385138[_0x8082('0x56')]['id']},'attributes':['id','username','password','token','authType',_0x8082('0x67')]})[_0x8082('0x35')](handleEntityNotFound(_0x29fff2,null))['then'](function(_0x23893d){if(_0x23893d){_0x236214=_0x23893d[_0x8082('0x67')];var _0x34174c=_0x236214[_0x8082('0x68')](-0x1);if(_0x34174c==='/'){_0x236214=_0x236214[_0x8082('0x69')](0x0,_0x236214[_0x8082('0x6a')](_0x34174c));}var _0x433ccd={'method':_0x8082('0x6b'),'uri':util[_0x8082('0x6c')](_0x8082('0x6d'),_0x236214,'ticket_fields'),'json':!![]};switch(_0x23893d[_0x8082('0x6e')]){case _0x8082('0x6f'):_0x433ccd[_0x8082('0x70')]={'Authorization':util[_0x8082('0x6c')](_0x8082('0x71'),new Buffer(util[_0x8082('0x6c')]('%s:%s',_0x23893d[_0x8082('0x72')],_0x23893d[_0x8082('0x6f')]))['toString']('base64'))};break;case _0x8082('0x73'):_0x433ccd[_0x8082('0x70')]={'Authorization':util[_0x8082('0x6c')](_0x8082('0x71'),new Buffer(util[_0x8082('0x6c')](_0x8082('0x74'),_0x23893d[_0x8082('0x72')],_0x23893d[_0x8082('0x73')]))[_0x8082('0x75')](_0x8082('0x76')))};break;default:throw new db['Sequelize'][(_0x8082('0x77'))](_0x8082('0x78'));}return rp(_0x433ccd);}})[_0x8082('0x35')](function(_0x1e3487){if(_0x1e3487){var _0x1f7f90=[_0x8082('0x79'),_0x8082('0x7a'),_0x8082('0x7b'),_0x8082('0x7c')];_[_0x8082('0x7d')](_0x1e3487[_0x8082('0x7e')],function(_0x23cb34){return _0x1f7f90[_0x8082('0x7f')](_0x23cb34[_0x8082('0x3d')]);});return{'count':_0x1e3487[_0x8082('0x7e')][_0x8082('0x47')],'rows':_[_0x8082('0x3f')](_0x1e3487[_0x8082('0x7e')],function(_0x40d490){return{'id':_0x40d490['id'],'name':_0x40d490[_0x8082('0x80')]>0x7?_0x40d490['title']:_0x40d490[_0x8082('0x3d')],'custom':_0x40d490[_0x8082('0x80')]>0x7?!![]:![],'options':_0x40d490[_0x8082('0x81')]?_0x40d490[_0x8082('0x81')]:_0x40d490[_0x8082('0x82')]?_0x40d490[_0x8082('0x82')]:[]};})};}})[_0x8082('0x35')](respondWithResult(_0x29fff2,null))[_0x8082('0x28')](function(_0x2d0588){var _0x1423ce=_0x385138[_0x8082('0x41')][_0x8082('0x83')]?0x1f4:_0x2d0588[_0x8082('0x84')]||0x1f4;logger[_0x8082('0x23')]('getFields,\x20%s,\x20%s,\x20%s',_0x8082('0x66'),_0x1423ce,JSON[_0x8082('0x22')](_0x2d0588));delete _0x2d0588['name'];if(_0x1423ce===0x191){_0x1423ce=0x190;}_0x29fff2['status'](_0x1423ce)[_0x8082('0x3a')](_0x385138[_0x8082('0x41')][_0x8082('0x83')]?{'message':_0x8082('0x85'),'statusCode':_0x2d0588['statusCode']}:_0x2d0588);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index 8c204fb..8c4befa 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 _0xedea=['util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../components/integrations/configuration','exports','define','ZendeskAccount','int_zendesk_accounts','lodash'];(function(_0xf8d03,_0x47566e){var _0xcc24dc=function(_0x11d2fe){while(--_0x11d2fe){_0xf8d03['push'](_0xf8d03['shift']());}};_0xcc24dc(++_0x47566e);}(_0xedea,0xcf));var _0xaede=function(_0x94dbc1,_0x10c295){_0x94dbc1=_0x94dbc1-0x0;var _0x2b5eb8=_0xedea[_0x94dbc1];return _0x2b5eb8;};'use strict';var _=require(_0xaede('0x0'));var util=require(_0xaede('0x1'));var logger=require(_0xaede('0x2'))(_0xaede('0x3'));var moment=require(_0xaede('0x4'));var BPromise=require(_0xaede('0x5'));var rp=require(_0xaede('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xaede('0x7'));var config=require('../../config/environment');var attributes=require('./intZendeskAccount.attributes');var integrations=require(_0xaede('0x8'));module[_0xaede('0x9')]=function(_0x47927d,_0x5745ef){return _0x47927d[_0xaede('0xa')](_0xaede('0xb'),attributes,{'tableName':_0xaede('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0321=['define','ZendeskAccount','lodash','util','../../config/logger','api','request-promise','rimraf','../../config/environment','../../components/integrations/configuration','exports'];(function(_0x18602f,_0x2abc74){var _0x5606f9=function(_0x107ab4){while(--_0x107ab4){_0x18602f['push'](_0x18602f['shift']());}};_0x5606f9(++_0x2abc74);}(_0x0321,0x86));var _0x1032=function(_0x2f3f12,_0x2dc5cc){_0x2f3f12=_0x2f3f12-0x0;var _0x34e8fb=_0x0321[_0x2f3f12];return _0x34e8fb;};'use strict';var _=require(_0x1032('0x0'));var util=require(_0x1032('0x1'));var logger=require(_0x1032('0x2'))(_0x1032('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x1032('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1032('0x5'));var config=require(_0x1032('0x6'));var attributes=require('./intZendeskAccount.attributes');var integrations=require(_0x1032('0x7'));module[_0x1032('0x8')]=function(_0x304da4,_0x1f0dd2){return _0x304da4[_0x1032('0x9')](_0x1032('0xa'),attributes,{'tableName':'int_zendesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.rpc.js b/server/api/intZendeskAccount/intZendeskAccount.rpc.js index c6231bc..d447a30 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 _0x890f=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','ZendeskAccount,\x20%s,\x20%s','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','GetZendeskAccount','ZendeskAccount','findAll','options','raw','where','limit','include','map','attributes','model','stringify','ShowZendeskAccount','util','moment','randomstring'];(function(_0x12f690,_0x2c7ebb){var _0x9e0166=function(_0x53224b){while(--_0x53224b){_0x12f690['push'](_0x12f690['shift']());}};_0x9e0166(++_0x2c7ebb);}(_0x890f,0x1a1));var _0xf890=function(_0x26b308,_0x397dfc){_0x26b308=_0x26b308-0x0;var _0x59478d=_0x890f[_0x26b308];return _0x59478d;};'use strict';var _=require('lodash');var util=require(_0xf890('0x0'));var moment=require(_0xf890('0x1'));var BPromise=require('bluebird');var rs=require(_0xf890('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf890('0x3'))['db'];var utils=require(_0xf890('0x4'));var logger=require(_0xf890('0x5'))(_0xf890('0x6'));var config=require(_0xf890('0x7'));var jayson=require(_0xf890('0x8'));var client=jayson[_0xf890('0x9')][_0xf890('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4de7bf,_0x4d44d7,_0x28d653){return new BPromise(function(_0x574f40,_0x5643e7){return client['request'](_0x4de7bf,_0x28d653)[_0xf890('0xb')](function(_0x5ab39a){logger[_0xf890('0xc')](_0xf890('0xd'),_0x4d44d7,'request\x20sent');logger[_0xf890('0xe')](_0xf890('0xf'),_0x4d44d7,_0xf890('0x10'),JSON['stringify'](_0x5ab39a));if(_0x5ab39a[_0xf890('0x11')]){if(_0x5ab39a['error'][_0xf890('0x12')]===0x1f4){logger['error'](_0xf890('0xd'),_0x4d44d7,_0x5ab39a['error'][_0xf890('0x13')]);return _0x5643e7(_0x5ab39a[_0xf890('0x11')][_0xf890('0x13')]);}logger[_0xf890('0x11')](_0xf890('0xd'),_0x4d44d7,_0x5ab39a[_0xf890('0x11')][_0xf890('0x13')]);return _0x574f40(_0x5ab39a[_0xf890('0x11')][_0xf890('0x13')]);}else{logger[_0xf890('0xc')]('ZendeskAccount,\x20%s,\x20%s',_0x4d44d7,_0xf890('0x10'));_0x574f40(_0x5ab39a[_0xf890('0x14')][_0xf890('0x13')]);}})[_0xf890('0x15')](function(_0x321355){logger[_0xf890('0x11')](_0xf890('0xd'),_0x4d44d7,_0x321355);_0x5643e7(_0x321355);});});}exports[_0xf890('0x16')]=function(_0x501bd3){var _0x5b2076=this;return new Promise(function(_0x22466d,_0x585864){return db[_0xf890('0x17')][_0xf890('0x18')]({'raw':_0x501bd3[_0xf890('0x19')]?_0x501bd3[_0xf890('0x19')][_0xf890('0x1a')]===undefined?!![]:![]:!![],'where':_0x501bd3[_0xf890('0x19')]?_0x501bd3[_0xf890('0x19')][_0xf890('0x1b')]||null:null,'attributes':_0x501bd3[_0xf890('0x19')]?_0x501bd3[_0xf890('0x19')]['attributes']||null:null,'limit':_0x501bd3['options']?_0x501bd3[_0xf890('0x19')][_0xf890('0x1c')]||null:null,'include':_0x501bd3['options']?_0x501bd3['options'][_0xf890('0x1d')]?_[_0xf890('0x1e')](_0x501bd3[_0xf890('0x19')][_0xf890('0x1d')],function(_0x2de3a0){return{'model':db[_0x2de3a0['model']],'as':_0x2de3a0['as'],'attributes':_0x2de3a0[_0xf890('0x1f')],'include':_0x2de3a0[_0xf890('0x1d')]?_[_0xf890('0x1e')](_0x2de3a0['include'],function(_0x2ed9af){return{'model':db[_0x2ed9af[_0xf890('0x20')]],'as':_0x2ed9af['as'],'attributes':_0x2ed9af[_0xf890('0x1f')],'include':_0x2ed9af[_0xf890('0x1d')]?_[_0xf890('0x1e')](_0x2ed9af[_0xf890('0x1d')],function(_0x1bb3bc){return{'model':db[_0x1bb3bc['model']],'as':_0x1bb3bc['as'],'attributes':_0x1bb3bc[_0xf890('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xce2b19){logger[_0xf890('0xc')](_0xf890('0x16'),_0x501bd3);logger[_0xf890('0xe')](_0xf890('0x16'),_0x501bd3,JSON[_0xf890('0x21')](_0xce2b19));_0x22466d(_0xce2b19);})[_0xf890('0x15')](function(_0x5e9933){logger[_0xf890('0x11')](_0xf890('0x16'),_0x5e9933[_0xf890('0x13')],_0x501bd3);_0x585864(_0x5b2076[_0xf890('0x11')](0x1f4,_0x5e9933[_0xf890('0x13')]));});});};exports[_0xf890('0x22')]=function(_0x312360){var _0x5ed53b=this;return new Promise(function(_0x328208,_0x27540){return db[_0xf890('0x17')]['find']({'raw':_0x312360['options']?_0x312360['options'][_0xf890('0x1a')]===undefined?!![]:![]:!![],'where':_0x312360[_0xf890('0x19')]?_0x312360[_0xf890('0x19')][_0xf890('0x1b')]||null:null,'attributes':_0x312360[_0xf890('0x19')]?_0x312360[_0xf890('0x19')][_0xf890('0x1f')]||null:null,'include':_0x312360[_0xf890('0x19')]?_0x312360[_0xf890('0x19')]['include']?_[_0xf890('0x1e')](_0x312360[_0xf890('0x19')][_0xf890('0x1d')],function(_0x56b010){return{'model':db[_0x56b010[_0xf890('0x20')]],'as':_0x56b010['as'],'attributes':_0x56b010[_0xf890('0x1f')],'include':_0x56b010[_0xf890('0x1d')]?_[_0xf890('0x1e')](_0x56b010[_0xf890('0x1d')],function(_0x21e3f1){return{'model':db[_0x21e3f1['model']],'as':_0x21e3f1['as'],'attributes':_0x21e3f1['attributes'],'include':_0x21e3f1['include']?_[_0xf890('0x1e')](_0x21e3f1[_0xf890('0x1d')],function(_0x427ae5){return{'model':db[_0x427ae5['model']],'as':_0x427ae5['as'],'attributes':_0x427ae5['attributes']};}):[]};}):[]};}):[]:[]})[_0xf890('0xb')](function(_0x5c9096){logger[_0xf890('0xc')](_0xf890('0x22'),_0x312360);logger['debug'](_0xf890('0x22'),_0x312360,JSON[_0xf890('0x21')](_0x5c9096));_0x328208(_0x5c9096);})[_0xf890('0x15')](function(_0x2a8236){logger['error'](_0xf890('0x22'),_0x2a8236['message'],_0x312360);_0x27540(_0x5ed53b[_0xf890('0x11')](0x1f4,_0x2a8236['message']));});});}; \ No newline at end of file +var _0xf230=['randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','ZendeskAccount,\x20%s,\x20%s','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','error','code','message','info','result','GetZendeskAccount','ZendeskAccount','findAll','options','raw','where','attributes','limit','include','model','map','stringify','catch','ShowZendeskAccount','lodash','util','moment','bluebird'];(function(_0x187d0a,_0x280440){var _0x40b361=function(_0xb56f4c){while(--_0xb56f4c){_0x187d0a['push'](_0x187d0a['shift']());}};_0x40b361(++_0x280440);}(_0xf230,0xea));var _0x0f23=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xf230[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0x0f23('0x0'));var util=require(_0x0f23('0x1'));var moment=require(_0x0f23('0x2'));var BPromise=require(_0x0f23('0x3'));var rs=require(_0x0f23('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x0f23('0x5'));var logger=require(_0x0f23('0x6'))(_0x0f23('0x7'));var config=require('../../config/environment');var jayson=require(_0x0f23('0x8'));var client=jayson[_0x0f23('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3eca59,_0x53fcac,_0x4a4b45){return new BPromise(function(_0x5e4eed,_0x3a2bfe){return client[_0x0f23('0xa')](_0x3eca59,_0x4a4b45)[_0x0f23('0xb')](function(_0x21da37){logger['info'](_0x0f23('0xc'),_0x53fcac,'request\x20sent');logger[_0x0f23('0xd')](_0x0f23('0xe'),_0x53fcac,'request\x20sent',JSON['stringify'](_0x21da37));if(_0x21da37[_0x0f23('0xf')]){if(_0x21da37[_0x0f23('0xf')][_0x0f23('0x10')]===0x1f4){logger[_0x0f23('0xf')]('ZendeskAccount,\x20%s,\x20%s',_0x53fcac,_0x21da37[_0x0f23('0xf')][_0x0f23('0x11')]);return _0x3a2bfe(_0x21da37[_0x0f23('0xf')][_0x0f23('0x11')]);}logger[_0x0f23('0xf')](_0x0f23('0xc'),_0x53fcac,_0x21da37[_0x0f23('0xf')][_0x0f23('0x11')]);return _0x5e4eed(_0x21da37[_0x0f23('0xf')][_0x0f23('0x11')]);}else{logger[_0x0f23('0x12')](_0x0f23('0xc'),_0x53fcac,'request\x20sent');_0x5e4eed(_0x21da37[_0x0f23('0x13')][_0x0f23('0x11')]);}})['catch'](function(_0x186863){logger[_0x0f23('0xf')](_0x0f23('0xc'),_0x53fcac,_0x186863);_0x3a2bfe(_0x186863);});});}exports[_0x0f23('0x14')]=function(_0x4cb8b6){var _0x3c68d0=this;return new Promise(function(_0x2bcdb1,_0x2fdbab){return db[_0x0f23('0x15')][_0x0f23('0x16')]({'raw':_0x4cb8b6[_0x0f23('0x17')]?_0x4cb8b6['options'][_0x0f23('0x18')]===undefined?!![]:![]:!![],'where':_0x4cb8b6[_0x0f23('0x17')]?_0x4cb8b6[_0x0f23('0x17')][_0x0f23('0x19')]||null:null,'attributes':_0x4cb8b6['options']?_0x4cb8b6[_0x0f23('0x17')][_0x0f23('0x1a')]||null:null,'limit':_0x4cb8b6[_0x0f23('0x17')]?_0x4cb8b6[_0x0f23('0x17')][_0x0f23('0x1b')]||null:null,'include':_0x4cb8b6[_0x0f23('0x17')]?_0x4cb8b6[_0x0f23('0x17')][_0x0f23('0x1c')]?_['map'](_0x4cb8b6['options'][_0x0f23('0x1c')],function(_0x44217d){return{'model':db[_0x44217d[_0x0f23('0x1d')]],'as':_0x44217d['as'],'attributes':_0x44217d[_0x0f23('0x1a')],'include':_0x44217d[_0x0f23('0x1c')]?_[_0x0f23('0x1e')](_0x44217d[_0x0f23('0x1c')],function(_0x2ebac5){return{'model':db[_0x2ebac5[_0x0f23('0x1d')]],'as':_0x2ebac5['as'],'attributes':_0x2ebac5[_0x0f23('0x1a')],'include':_0x2ebac5[_0x0f23('0x1c')]?_[_0x0f23('0x1e')](_0x2ebac5[_0x0f23('0x1c')],function(_0x343cf4){return{'model':db[_0x343cf4[_0x0f23('0x1d')]],'as':_0x343cf4['as'],'attributes':_0x343cf4[_0x0f23('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x0f23('0xb')](function(_0x579e89){logger[_0x0f23('0x12')]('GetZendeskAccount',_0x4cb8b6);logger[_0x0f23('0xd')](_0x0f23('0x14'),_0x4cb8b6,JSON[_0x0f23('0x1f')](_0x579e89));_0x2bcdb1(_0x579e89);})[_0x0f23('0x20')](function(_0x1b67d7){logger[_0x0f23('0xf')](_0x0f23('0x14'),_0x1b67d7[_0x0f23('0x11')],_0x4cb8b6);_0x2fdbab(_0x3c68d0[_0x0f23('0xf')](0x1f4,_0x1b67d7[_0x0f23('0x11')]));});});};exports['ShowZendeskAccount']=function(_0x2a3541){var _0x1787fd=this;return new Promise(function(_0x1785a2,_0x38ea6a){return db['ZendeskAccount']['find']({'raw':_0x2a3541[_0x0f23('0x17')]?_0x2a3541[_0x0f23('0x17')][_0x0f23('0x18')]===undefined?!![]:![]:!![],'where':_0x2a3541[_0x0f23('0x17')]?_0x2a3541['options']['where']||null:null,'attributes':_0x2a3541[_0x0f23('0x17')]?_0x2a3541['options'][_0x0f23('0x1a')]||null:null,'include':_0x2a3541[_0x0f23('0x17')]?_0x2a3541['options'][_0x0f23('0x1c')]?_[_0x0f23('0x1e')](_0x2a3541[_0x0f23('0x17')][_0x0f23('0x1c')],function(_0x1d4d23){return{'model':db[_0x1d4d23['model']],'as':_0x1d4d23['as'],'attributes':_0x1d4d23['attributes'],'include':_0x1d4d23['include']?_[_0x0f23('0x1e')](_0x1d4d23['include'],function(_0x1c63a8){return{'model':db[_0x1c63a8['model']],'as':_0x1c63a8['as'],'attributes':_0x1c63a8[_0x0f23('0x1a')],'include':_0x1c63a8[_0x0f23('0x1c')]?_[_0x0f23('0x1e')](_0x1c63a8[_0x0f23('0x1c')],function(_0x417efe){return{'model':db[_0x417efe[_0x0f23('0x1d')]],'as':_0x417efe['as'],'attributes':_0x417efe['attributes']};}):[]};}):[]};}):[]:[]})[_0x0f23('0xb')](function(_0x16be3c){logger[_0x0f23('0x12')]('ShowZendeskAccount',_0x2a3541);logger[_0x0f23('0xd')](_0x0f23('0x21'),_0x2a3541,JSON['stringify'](_0x16be3c));_0x1785a2(_0x16be3c);})[_0x0f23('0x20')](function(_0x4b2d6c){logger[_0x0f23('0xf')](_0x0f23('0x21'),_0x4b2d6c[_0x0f23('0x11')],_0x2a3541);_0x38ea6a(_0x1787fd['error'](0x1f4,_0x4b2d6c[_0x0f23('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index 6f80aa6..7f090b0 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 _0x91a7=['util','path','connect-timeout','Router','../../components/auth/service','./intZendeskConfiguration.controller','get','index','/:id','isAuthenticated','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','create','put','update','destroy','exports'];(function(_0x4dcde3,_0x3ef343){var _0xc1aa02=function(_0x53721d){while(--_0x53721d){_0x4dcde3['push'](_0x4dcde3['shift']());}};_0xc1aa02(++_0x3ef343);}(_0x91a7,0xe7));var _0x791a=function(_0x464efa,_0x130e41){_0x464efa=_0x464efa-0x0;var _0x54c772=_0x91a7[_0x464efa];return _0x54c772;};'use strict';var multer=require('multer');var util=require(_0x791a('0x0'));var path=require(_0x791a('0x1'));var timeout=require(_0x791a('0x2'));var express=require('express');var router=express[_0x791a('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x791a('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x791a('0x5'));router[_0x791a('0x6')]('/',auth['isAuthenticated'](),controller[_0x791a('0x7')]);router['get'](_0x791a('0x8'),auth[_0x791a('0x9')](),controller['show']);router[_0x791a('0x6')](_0x791a('0xa'),auth[_0x791a('0x9')](),controller[_0x791a('0xb')]);router[_0x791a('0x6')]('/:id/subjects',auth[_0x791a('0x9')](),controller[_0x791a('0xc')]);router['get'](_0x791a('0xd'),auth[_0x791a('0x9')](),controller[_0x791a('0xe')]);router[_0x791a('0x6')](_0x791a('0xf'),auth[_0x791a('0x9')](),controller['getTags']);router['post']('/',auth[_0x791a('0x9')](),controller[_0x791a('0x10')]);router['post'](_0x791a('0xf'),auth[_0x791a('0x9')](),controller['setTags']);router[_0x791a('0x11')](_0x791a('0x8'),auth[_0x791a('0x9')](),controller[_0x791a('0x12')]);router['delete'](_0x791a('0x8'),auth['isAuthenticated'](),controller[_0x791a('0x13')]);module[_0x791a('0x14')]=router; \ No newline at end of file +var _0xb10b=['getFields','/:id/subjects','/:id/descriptions','getTags','post','create','setTags','put','/:id','update','delete','destroy','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','index','isAuthenticated','show','/:id/fields'];(function(_0x180cfb,_0xfd01e6){var _0x336d8e=function(_0x456296){while(--_0x456296){_0x180cfb['push'](_0x180cfb['shift']());}};_0x336d8e(++_0xfd01e6);}(_0xb10b,0x12a));var _0xbb10=function(_0x1602fb,_0x20b6b3){_0x1602fb=_0x1602fb-0x0;var _0x461831=_0xb10b[_0x1602fb];return _0x461831;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/:id',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0x9')](_0xbb10('0xf'),auth['isAuthenticated'](),controller['getSubjects']);router[_0xbb10('0x9')](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller['getDescriptions']);router[_0xbb10('0x9')]('/:id/tags',auth[_0xbb10('0xb')](),controller[_0xbb10('0x11')]);router[_0xbb10('0x12')]('/',auth[_0xbb10('0xb')](),controller[_0xbb10('0x13')]);router[_0xbb10('0x12')]('/:id/tags',auth[_0xbb10('0xb')](),controller[_0xbb10('0x14')]);router[_0xbb10('0x15')](_0xbb10('0x16'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x17')]);router[_0xbb10('0x18')](_0xbb10('0x16'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x19')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index bf36765..d94eb07 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 _0x90f6=['exports','STRING','sequelize'];(function(_0x528d5d,_0x431c95){var _0x58e6c0=function(_0xc1c0aa){while(--_0xc1c0aa){_0x528d5d['push'](_0x528d5d['shift']());}};_0x58e6c0(++_0x431c95);}(_0x90f6,0xbf));var _0x690f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x90f6[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x690f('0x0'));module[_0x690f('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x690f('0x2')]}}; \ No newline at end of file +var _0xc302=['exports','STRING','sequelize'];(function(_0x26f702,_0x3919bf){var _0x11417d=function(_0x1aa3e8){while(--_0x1aa3e8){_0x26f702['push'](_0x26f702['shift']());}};_0x11417d(++_0x3919bf);}(_0xc302,0x65));var _0x2c30=function(_0x410b84,_0x21f374){_0x410b84=_0x410b84-0x0;var _0x16c866=_0xc302[_0x410b84];return _0x16c866;};'use strict';var Sequelize=require(_0x2c30('0x0'));module[_0x2c30('0x1')]={'name':{'type':Sequelize[_0x2c30('0x2')]},'description':{'type':Sequelize[_0x2c30('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index efad524..43c9ca9 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 _0x9703=['ZendeskConfiguration','fieldName','type','key','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','keys','options','find','body','update','getFields','findOne','ZendeskField','rawAttributes','pick','getSubjects','getDescriptions','getTags','Tag','setTags','eml-format','zip-dir','fast-json-patch','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','client','http','request','then','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','destroy','stack','name','send','index','map'];(function(_0xaea98d,_0x4ebab3){var _0x4ae844=function(_0x46c1b7){while(--_0x46c1b7){_0xaea98d['push'](_0xaea98d['shift']());}};_0x4ae844(++_0x4ebab3);}(_0x9703,0x1a0));var _0x3970=function(_0x3a7c43,_0x43aca0){_0x3a7c43=_0x3a7c43-0x0;var _0x115645=_0x9703[_0x3a7c43];return _0x115645;};'use strict';var emlformat=require(_0x3970('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3970('0x1'));var jsonpatch=require(_0x3970('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x3970('0x3'));var Mustache=require(_0x3970('0x4'));var util=require(_0x3970('0x5'));var path=require(_0x3970('0x6'));var sox=require('sox');var csv=require(_0x3970('0x7'));var ejs=require(_0x3970('0x8'));var fs=require('fs');var fs_extra=require(_0x3970('0x9'));var _=require(_0x3970('0xa'));var squel=require(_0x3970('0xb'));var crypto=require(_0x3970('0xc'));var jsforce=require(_0x3970('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x3970('0x7'));var querystring=require(_0x3970('0xe'));var Papa=require(_0x3970('0xf'));var Redis=require(_0x3970('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x3970('0x11'));var as=require(_0x3970('0x12'));var hardwareService=require(_0x3970('0x13'));var logger=require(_0x3970('0x14'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x3970('0x15'));var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson[_0x3970('0x16')][_0x3970('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x388d7e,_0x3bf4f2,_0x30be16,_0x173e63){return new BPromise(function(_0x105111,_0x3a90ed){var _0x212d1f=_0x173e63||client;return _0x212d1f[_0x3970('0x18')](_0x388d7e,_0x30be16)[_0x3970('0x19')](function(_0x4efc62){logger[_0x3970('0x1a')](_0x3970('0x1b'),_0x3bf4f2,_0x3970('0x1c'));logger['debug'](_0x3970('0x1d'),_0x3bf4f2,'request\x20sent',JSON[_0x3970('0x1e')](_0x4efc62));if(_0x4efc62[_0x3970('0x1f')]){if(_0x4efc62[_0x3970('0x1f')][_0x3970('0x20')]===0x1f4){logger['error'](_0x3970('0x1b'),_0x3bf4f2,_0x4efc62[_0x3970('0x1f')][_0x3970('0x21')]);return _0x3a90ed(_0x4efc62[_0x3970('0x1f')][_0x3970('0x21')]);}logger[_0x3970('0x1f')](_0x3970('0x1b'),_0x3bf4f2,_0x4efc62['error'][_0x3970('0x21')]);return _0x105111(_0x4efc62['error'][_0x3970('0x21')]);}else{logger[_0x3970('0x1a')](_0x3970('0x1b'),_0x3bf4f2,'request\x20sent');_0x105111(_0x4efc62[_0x3970('0x22')][_0x3970('0x21')]);}})[_0x3970('0x23')](function(_0x5f4cce){logger[_0x3970('0x1f')]('ZendeskConfiguration,\x20%s,\x20%s',_0x3bf4f2,_0x5f4cce);_0x3a90ed(_0x5f4cce);});});}function respondWithStatusCode(_0xc0fd2,_0x17b795){_0x17b795=_0x17b795||0xcc;return function(_0x447b71){if(_0x447b71){return _0xc0fd2[_0x3970('0x24')](_0x17b795);}return _0xc0fd2[_0x3970('0x25')](_0x17b795)[_0x3970('0x26')]();};}function respondWithResult(_0x372255,_0x26a11c){_0x26a11c=_0x26a11c||0xc8;return function(_0x399bee){if(_0x399bee){return _0x372255['status'](_0x26a11c)[_0x3970('0x27')](_0x399bee);}};}function respondWithFilteredResult(_0x46a05b,_0x51dfd6){return function(_0xabac65){if(_0xabac65){var _0x3ae87c=typeof _0x51dfd6[_0x3970('0x28')]===_0x3970('0x29')&&typeof _0x51dfd6[_0x3970('0x2a')]==='undefined';var _0x482967=_0xabac65[_0x3970('0x2b')];var _0x3a46aa=_0x3ae87c?0x0:_0x51dfd6[_0x3970('0x28')];var _0x57936b=_0x3ae87c?_0xabac65['count']:_0x51dfd6[_0x3970('0x28')]+_0x51dfd6[_0x3970('0x2a')];var _0x49e68f;if(_0x57936b>=_0x482967){_0x57936b=_0x482967;_0x49e68f=0xc8;}else{_0x49e68f=0xce;}_0x46a05b[_0x3970('0x25')](_0x49e68f);return _0x46a05b[_0x3970('0x2c')](_0x3970('0x2d'),_0x3a46aa+'-'+_0x57936b+'/'+_0x482967)['json'](_0xabac65);}return null;};}function patchUpdates(_0x36b71a){return function(_0x50ffe3){try{jsonpatch[_0x3970('0x2e')](_0x50ffe3,_0x36b71a,!![]);}catch(_0x37634b){return BPromise[_0x3970('0x2f')](_0x37634b);}return _0x50ffe3['save']();};}function saveUpdates(_0x131ba1,_0x675c43){return function(_0x50a3d7){if(_0x50a3d7){return _0x50a3d7['update'](_0x131ba1)[_0x3970('0x19')](function(_0x57b94a){return _0x57b94a;});}return null;};}function removeEntity(_0x27ad60,_0x594eb0){return function(_0xc0ec95){if(_0xc0ec95){return _0xc0ec95[_0x3970('0x30')]()[_0x3970('0x19')](function(){_0x27ad60[_0x3970('0x25')](0xcc)['end']();});}};}function handleEntityNotFound(_0x50fccd,_0x1896f9){return function(_0xe286e5){if(!_0xe286e5){_0x50fccd['sendStatus'](0x194);}return _0xe286e5;};}function handleError(_0x1ec4a0,_0xa6bfb6){_0xa6bfb6=_0xa6bfb6||0x1f4;return function(_0x3fc7a6){logger[_0x3970('0x1f')](_0x3fc7a6[_0x3970('0x31')]);if(_0x3fc7a6[_0x3970('0x32')]){delete _0x3fc7a6[_0x3970('0x32')];}_0x1ec4a0['status'](_0xa6bfb6)[_0x3970('0x33')](_0x3fc7a6);};}exports[_0x3970('0x34')]=function(_0x3ced74,_0x551fe0){var _0x5a71dd={},_0x5768c2={},_0x58f321={'count':0x0,'rows':[]};var _0x1725b4=_[_0x3970('0x35')](db[_0x3970('0x36')]['rawAttributes'],function(_0x3825c5){return{'name':_0x3825c5[_0x3970('0x37')],'type':_0x3825c5[_0x3970('0x38')][_0x3970('0x39')]};});_0x5768c2[_0x3970('0x3a')]=_[_0x3970('0x35')](_0x1725b4,'name');_0x5768c2[_0x3970('0x3b')]=_['keys'](_0x3ced74[_0x3970('0x3b')]);_0x5768c2['filters']=_[_0x3970('0x3c')](_0x5768c2[_0x3970('0x3a')],_0x5768c2[_0x3970('0x3b')]);_0x5a71dd['attributes']=_[_0x3970('0x3c')](_0x5768c2[_0x3970('0x3a')],qs[_0x3970('0x3d')](_0x3ced74['query'][_0x3970('0x3d')]));_0x5a71dd[_0x3970('0x3e')]=_0x5a71dd[_0x3970('0x3e')][_0x3970('0x3f')]?_0x5a71dd[_0x3970('0x3e')]:_0x5768c2[_0x3970('0x3a')];if(!_0x3ced74['query'][_0x3970('0x40')](_0x3970('0x41'))){_0x5a71dd[_0x3970('0x2a')]=qs['limit'](_0x3ced74[_0x3970('0x3b')]['limit']);_0x5a71dd['offset']=qs[_0x3970('0x28')](_0x3ced74[_0x3970('0x3b')][_0x3970('0x28')]);}_0x5a71dd[_0x3970('0x42')]=qs['sort'](_0x3ced74['query'][_0x3970('0x43')]);_0x5a71dd[_0x3970('0x44')]=qs[_0x3970('0x45')](_['pick'](_0x3ced74[_0x3970('0x3b')],_0x5768c2[_0x3970('0x45')]),_0x1725b4);if(_0x3ced74[_0x3970('0x3b')][_0x3970('0x46')]){_0x5a71dd[_0x3970('0x44')]=_[_0x3970('0x47')](_0x5a71dd['where'],{'$or':_[_0x3970('0x35')](_0x1725b4,function(_0x393a36){if(_0x393a36[_0x3970('0x38')]!==_0x3970('0x48')){var _0x114472={};_0x114472[_0x393a36[_0x3970('0x32')]]={'$like':'%'+_0x3ced74[_0x3970('0x3b')][_0x3970('0x46')]+'%'};return _0x114472;}})});}_0x5a71dd=_[_0x3970('0x47')]({},_0x5a71dd,_0x3ced74['options']);var _0x2608a3={'where':_0x5a71dd[_0x3970('0x44')]};return db[_0x3970('0x36')][_0x3970('0x2b')](_0x2608a3)['then'](function(_0x681ef2){_0x58f321[_0x3970('0x2b')]=_0x681ef2;if(_0x3ced74[_0x3970('0x3b')][_0x3970('0x49')]){_0x5a71dd[_0x3970('0x4a')]=[{'all':!![]}];}return db[_0x3970('0x36')][_0x3970('0x4b')](_0x5a71dd);})['then'](function(_0x1d7bdd){_0x58f321[_0x3970('0x4c')]=_0x1d7bdd;return _0x58f321;})[_0x3970('0x19')](respondWithFilteredResult(_0x551fe0,_0x5a71dd))['catch'](handleError(_0x551fe0,null));};exports[_0x3970('0x4d')]=function(_0x10c073,_0x3e2999){var _0x516837={'raw':![],'where':{'id':_0x10c073[_0x3970('0x4e')]['id']}},_0x1c8dbb={};_0x1c8dbb['model']=_[_0x3970('0x4f')](db[_0x3970('0x36')]['rawAttributes']);_0x1c8dbb[_0x3970('0x3b')]=_[_0x3970('0x4f')](_0x10c073[_0x3970('0x3b')]);_0x1c8dbb[_0x3970('0x45')]=_[_0x3970('0x3c')](_0x1c8dbb[_0x3970('0x3a')],_0x1c8dbb['query']);_0x516837[_0x3970('0x3e')]=_[_0x3970('0x3c')](_0x1c8dbb[_0x3970('0x3a')],qs[_0x3970('0x3d')](_0x10c073[_0x3970('0x3b')][_0x3970('0x3d')]));_0x516837['attributes']=_0x516837[_0x3970('0x3e')][_0x3970('0x3f')]?_0x516837[_0x3970('0x3e')]:_0x1c8dbb[_0x3970('0x3a')];if(_0x10c073['query'][_0x3970('0x49')]){_0x516837[_0x3970('0x4a')]=[{'all':!![]}];}_0x516837=_['merge']({},_0x516837,_0x10c073[_0x3970('0x50')]);return db['ZendeskConfiguration'][_0x3970('0x51')](_0x516837)[_0x3970('0x19')](handleEntityNotFound(_0x3e2999,null))[_0x3970('0x19')](respondWithResult(_0x3e2999,null))[_0x3970('0x23')](handleError(_0x3e2999,null));};exports['create']=function(_0x47d57e,_0x451a61){return db[_0x3970('0x36')]['create'](_0x47d57e[_0x3970('0x52')],{})[_0x3970('0x19')](respondWithResult(_0x451a61,0xc9))[_0x3970('0x23')](handleError(_0x451a61,null));};exports[_0x3970('0x53')]=function(_0x35b558,_0x1826d2){if(_0x35b558['body']['id']){delete _0x35b558['body']['id'];}return db[_0x3970('0x36')][_0x3970('0x51')]({'where':{'id':_0x35b558[_0x3970('0x4e')]['id']}})[_0x3970('0x19')](handleEntityNotFound(_0x1826d2,null))[_0x3970('0x19')](saveUpdates(_0x35b558[_0x3970('0x52')],null))[_0x3970('0x19')](respondWithResult(_0x1826d2,null))[_0x3970('0x23')](handleError(_0x1826d2,null));};exports['destroy']=function(_0x33ffc0,_0xff6ab8){return db[_0x3970('0x36')][_0x3970('0x51')]({'where':{'id':_0x33ffc0[_0x3970('0x4e')]['id']}})[_0x3970('0x19')](handleEntityNotFound(_0xff6ab8,null))[_0x3970('0x19')](removeEntity(_0xff6ab8,null))['catch'](handleError(_0xff6ab8,null));};exports[_0x3970('0x54')]=function(_0x10f011,_0xcfface,_0x349c53){var _0x35160d={};var _0x4360e4={};var _0x419fcd;var _0x5309e6;return db[_0x3970('0x36')][_0x3970('0x55')]({'where':{'id':_0x10f011[_0x3970('0x4e')]['id']}})[_0x3970('0x19')](handleEntityNotFound(_0xcfface,null))['then'](function(_0xb77a6b){if(_0xb77a6b){_0x419fcd=_0xb77a6b;_0x4360e4[_0x3970('0x3a')]=_[_0x3970('0x4f')](db[_0x3970('0x56')][_0x3970('0x57')]);_0x4360e4[_0x3970('0x3b')]=_[_0x3970('0x4f')](_0x10f011['query']);_0x4360e4[_0x3970('0x45')]=_['intersection'](_0x4360e4[_0x3970('0x3a')],_0x4360e4['query']);_0x35160d['attributes']=_[_0x3970('0x3c')](_0x4360e4[_0x3970('0x3a')],qs[_0x3970('0x3d')](_0x10f011['query']['fields']));_0x35160d['attributes']=_0x35160d[_0x3970('0x3e')]['length']?_0x35160d[_0x3970('0x3e')]:_0x4360e4['model'];_0x35160d[_0x3970('0x42')]=qs['sort'](_0x10f011[_0x3970('0x3b')][_0x3970('0x43')]);_0x35160d[_0x3970('0x44')]=qs[_0x3970('0x45')](_[_0x3970('0x58')](_0x10f011[_0x3970('0x3b')],_0x4360e4['filters']));if(_0x10f011['query']['filter']){_0x35160d[_0x3970('0x44')]=_['merge'](_0x35160d['where'],{'$or':_[_0x3970('0x35')](_0x35160d[_0x3970('0x3e')],function(_0x59e712){var _0x1459f1={};_0x1459f1[_0x59e712]={'$like':'%'+_0x10f011[_0x3970('0x3b')]['filter']+'%'};return _0x1459f1;})});}_0x35160d=_[_0x3970('0x47')]({},_0x35160d,_0x10f011['options']);return _0x419fcd[_0x3970('0x54')](_0x35160d);}})[_0x3970('0x19')](function(_0x33289b){if(_0x33289b){_0x5309e6=_0x33289b['length'];if(!_0x10f011['query'][_0x3970('0x40')](_0x3970('0x41'))){_0x35160d[_0x3970('0x2a')]=qs[_0x3970('0x2a')](_0x10f011[_0x3970('0x3b')]['limit']);_0x35160d['offset']=qs[_0x3970('0x28')](_0x10f011[_0x3970('0x3b')][_0x3970('0x28')]);}return _0x419fcd[_0x3970('0x54')](_0x35160d);}})[_0x3970('0x19')](function(_0xcd60ad){if(_0xcd60ad){return _0xcd60ad?{'count':_0x5309e6,'rows':_0xcd60ad}:null;}})[_0x3970('0x19')](respondWithResult(_0xcfface,null))[_0x3970('0x23')](handleError(_0xcfface,null));};exports['getSubjects']=function(_0x4ae5df,_0x322b19,_0x28d8da){var _0x3fb09b={};var _0x166379={};var _0x23b275;var _0x282251;return db[_0x3970('0x36')][_0x3970('0x55')]({'where':{'id':_0x4ae5df[_0x3970('0x4e')]['id']}})[_0x3970('0x19')](handleEntityNotFound(_0x322b19,null))[_0x3970('0x19')](function(_0x53e133){if(_0x53e133){_0x23b275=_0x53e133;_0x166379[_0x3970('0x3a')]=_[_0x3970('0x4f')](db[_0x3970('0x56')]['rawAttributes']);_0x166379[_0x3970('0x3b')]=_[_0x3970('0x4f')](_0x4ae5df[_0x3970('0x3b')]);_0x166379[_0x3970('0x45')]=_[_0x3970('0x3c')](_0x166379['model'],_0x166379['query']);_0x3fb09b[_0x3970('0x3e')]=_[_0x3970('0x3c')](_0x166379[_0x3970('0x3a')],qs['fields'](_0x4ae5df[_0x3970('0x3b')][_0x3970('0x3d')]));_0x3fb09b['attributes']=_0x3fb09b['attributes'][_0x3970('0x3f')]?_0x3fb09b[_0x3970('0x3e')]:_0x166379[_0x3970('0x3a')];_0x3fb09b[_0x3970('0x42')]=qs[_0x3970('0x43')](_0x4ae5df['query']['sort']);_0x3fb09b[_0x3970('0x44')]=qs[_0x3970('0x45')](_[_0x3970('0x58')](_0x4ae5df[_0x3970('0x3b')],_0x166379[_0x3970('0x45')]));if(_0x4ae5df[_0x3970('0x3b')][_0x3970('0x46')]){_0x3fb09b[_0x3970('0x44')]=_[_0x3970('0x47')](_0x3fb09b[_0x3970('0x44')],{'$or':_['map'](_0x3fb09b[_0x3970('0x3e')],function(_0x4455f4){var _0x2d8430={};_0x2d8430[_0x4455f4]={'$like':'%'+_0x4ae5df[_0x3970('0x3b')][_0x3970('0x46')]+'%'};return _0x2d8430;})});}_0x3fb09b=_[_0x3970('0x47')]({},_0x3fb09b,_0x4ae5df[_0x3970('0x50')]);return _0x23b275[_0x3970('0x59')](_0x3fb09b);}})[_0x3970('0x19')](function(_0x2df922){if(_0x2df922){_0x282251=_0x2df922[_0x3970('0x3f')];if(!_0x4ae5df[_0x3970('0x3b')]['hasOwnProperty'](_0x3970('0x41'))){_0x3fb09b[_0x3970('0x2a')]=qs[_0x3970('0x2a')](_0x4ae5df['query']['limit']);_0x3fb09b[_0x3970('0x28')]=qs[_0x3970('0x28')](_0x4ae5df[_0x3970('0x3b')]['offset']);}return _0x23b275[_0x3970('0x59')](_0x3fb09b);}})[_0x3970('0x19')](function(_0x270b13){if(_0x270b13){return _0x270b13?{'count':_0x282251,'rows':_0x270b13}:null;}})[_0x3970('0x19')](respondWithResult(_0x322b19,null))[_0x3970('0x23')](handleError(_0x322b19,null));};exports[_0x3970('0x5a')]=function(_0x58fd0f,_0x501727,_0x23df9a){var _0x19cf22={};var _0x3db4a6={};var _0x121d78;var _0x130354;return db[_0x3970('0x36')][_0x3970('0x55')]({'where':{'id':_0x58fd0f[_0x3970('0x4e')]['id']}})[_0x3970('0x19')](handleEntityNotFound(_0x501727,null))[_0x3970('0x19')](function(_0x5983ce){if(_0x5983ce){_0x121d78=_0x5983ce;_0x3db4a6[_0x3970('0x3a')]=_[_0x3970('0x4f')](db[_0x3970('0x56')][_0x3970('0x57')]);_0x3db4a6[_0x3970('0x3b')]=_[_0x3970('0x4f')](_0x58fd0f[_0x3970('0x3b')]);_0x3db4a6[_0x3970('0x45')]=_[_0x3970('0x3c')](_0x3db4a6[_0x3970('0x3a')],_0x3db4a6[_0x3970('0x3b')]);_0x19cf22[_0x3970('0x3e')]=_[_0x3970('0x3c')](_0x3db4a6[_0x3970('0x3a')],qs[_0x3970('0x3d')](_0x58fd0f['query'][_0x3970('0x3d')]));_0x19cf22[_0x3970('0x3e')]=_0x19cf22[_0x3970('0x3e')][_0x3970('0x3f')]?_0x19cf22[_0x3970('0x3e')]:_0x3db4a6[_0x3970('0x3a')];_0x19cf22[_0x3970('0x42')]=qs[_0x3970('0x43')](_0x58fd0f['query'][_0x3970('0x43')]);_0x19cf22[_0x3970('0x44')]=qs[_0x3970('0x45')](_[_0x3970('0x58')](_0x58fd0f[_0x3970('0x3b')],_0x3db4a6[_0x3970('0x45')]));if(_0x58fd0f['query']['filter']){_0x19cf22[_0x3970('0x44')]=_[_0x3970('0x47')](_0x19cf22[_0x3970('0x44')],{'$or':_[_0x3970('0x35')](_0x19cf22[_0x3970('0x3e')],function(_0x424418){var _0x4eb8dc={};_0x4eb8dc[_0x424418]={'$like':'%'+_0x58fd0f[_0x3970('0x3b')]['filter']+'%'};return _0x4eb8dc;})});}_0x19cf22=_[_0x3970('0x47')]({},_0x19cf22,_0x58fd0f[_0x3970('0x50')]);return _0x121d78[_0x3970('0x5a')](_0x19cf22);}})[_0x3970('0x19')](function(_0xb5f954){if(_0xb5f954){_0x130354=_0xb5f954['length'];if(!_0x58fd0f['query']['hasOwnProperty']('nolimit')){_0x19cf22['limit']=qs[_0x3970('0x2a')](_0x58fd0f['query'][_0x3970('0x2a')]);_0x19cf22['offset']=qs[_0x3970('0x28')](_0x58fd0f[_0x3970('0x3b')][_0x3970('0x28')]);}return _0x121d78[_0x3970('0x5a')](_0x19cf22);}})['then'](function(_0x3791a5){if(_0x3791a5){return _0x3791a5?{'count':_0x130354,'rows':_0x3791a5}:null;}})['then'](respondWithResult(_0x501727,null))[_0x3970('0x23')](handleError(_0x501727,null));};exports[_0x3970('0x5b')]=function(_0x424589,_0x534e8d,_0x269fd4){var _0x1f07bf={};var _0x1c260a={};var _0x2dad7e;var _0x4a6a94;return db[_0x3970('0x36')][_0x3970('0x55')]({'where':{'id':_0x424589[_0x3970('0x4e')]['id']}})[_0x3970('0x19')](handleEntityNotFound(_0x534e8d,null))['then'](function(_0x32d876){if(_0x32d876){_0x2dad7e=_0x32d876;_0x1c260a[_0x3970('0x3a')]=_[_0x3970('0x4f')](db[_0x3970('0x5c')]['rawAttributes']);_0x1c260a[_0x3970('0x3b')]=_['keys'](_0x424589['query']);_0x1c260a[_0x3970('0x45')]=_[_0x3970('0x3c')](_0x1c260a[_0x3970('0x3a')],_0x1c260a[_0x3970('0x3b')]);_0x1f07bf['attributes']=_[_0x3970('0x3c')](_0x1c260a[_0x3970('0x3a')],qs[_0x3970('0x3d')](_0x424589['query'][_0x3970('0x3d')]));_0x1f07bf[_0x3970('0x3e')]=_0x1f07bf[_0x3970('0x3e')][_0x3970('0x3f')]?_0x1f07bf['attributes']:_0x1c260a['model'];_0x1f07bf[_0x3970('0x42')]=qs[_0x3970('0x43')](_0x424589[_0x3970('0x3b')][_0x3970('0x43')]);_0x1f07bf[_0x3970('0x44')]=qs[_0x3970('0x45')](_[_0x3970('0x58')](_0x424589[_0x3970('0x3b')],_0x1c260a[_0x3970('0x45')]));if(_0x424589['query']['filter']){_0x1f07bf[_0x3970('0x44')]=_[_0x3970('0x47')](_0x1f07bf[_0x3970('0x44')],{'$or':_['map'](_0x1f07bf[_0x3970('0x3e')],function(_0x1ebb50){var _0x19da95={};_0x19da95[_0x1ebb50]={'$like':'%'+_0x424589[_0x3970('0x3b')][_0x3970('0x46')]+'%'};return _0x19da95;})});}_0x1f07bf=_[_0x3970('0x47')]({},_0x1f07bf,_0x424589[_0x3970('0x50')]);return _0x2dad7e['getTags'](_0x1f07bf);}})[_0x3970('0x19')](function(_0x15e595){if(_0x15e595){_0x4a6a94=_0x15e595['length'];if(!_0x424589['query'][_0x3970('0x40')](_0x3970('0x41'))){_0x1f07bf[_0x3970('0x2a')]=qs[_0x3970('0x2a')](_0x424589[_0x3970('0x3b')][_0x3970('0x2a')]);_0x1f07bf[_0x3970('0x28')]=qs[_0x3970('0x28')](_0x424589[_0x3970('0x3b')]['offset']);}return _0x2dad7e[_0x3970('0x5b')](_0x1f07bf);}})[_0x3970('0x19')](function(_0x20c5fa){if(_0x20c5fa){return _0x20c5fa?{'count':_0x4a6a94,'rows':_0x20c5fa}:null;}})[_0x3970('0x19')](respondWithResult(_0x534e8d,null))[_0x3970('0x23')](handleError(_0x534e8d,null));};exports[_0x3970('0x5d')]=function(_0x5338e9,_0x3216f6,_0x583d41){if(_0x5338e9[_0x3970('0x52')]['id']){delete _0x5338e9['body']['id'];}return db[_0x3970('0x36')][_0x3970('0x55')]({'where':{'id':_0x5338e9['params']['id']}})[_0x3970('0x19')](handleEntityNotFound(_0x3216f6,null))[_0x3970('0x19')](function(_0x5b949d){if(_0x5b949d){return _0x5b949d[_0x3970('0x5d')](_0x5338e9[_0x3970('0x52')]['ids']||[]);}return null;})['then'](respondWithResult(_0x3216f6,null))['catch'](handleError(_0x3216f6,null));}; \ No newline at end of file +var _0xb515=['fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','findAll','show','length','include','options','find','create','body','params','getFields','getSubjects','findOne','ZendeskField','getDescriptions','getTags','Tag','setTags','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','jayson/promise','http','then','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','catch','sendStatus','end','json','offset','undefined','limit','count','status','apply','reject','update','destroy','stack','name','index','map','ZendeskConfiguration','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes'];(function(_0x1cc6e6,_0x4db729){var _0x511abf=function(_0x2c7299){while(--_0x2c7299){_0x1cc6e6['push'](_0x1cc6e6['shift']());}};_0x511abf(++_0x4db729);}(_0xb515,0x77));var _0x5b51=function(_0x3c81b5,_0x3f5ed7){_0x3c81b5=_0x3c81b5-0x0;var _0x5888c4=_0xb515[_0x3c81b5];return _0x5888c4;};'use strict';var emlformat=require(_0x5b51('0x0'));var rimraf=require(_0x5b51('0x1'));var zipdir=require(_0x5b51('0x2'));var jsonpatch=require(_0x5b51('0x3'));var rp=require(_0x5b51('0x4'));var moment=require(_0x5b51('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x5b51('0x6'));var path=require(_0x5b51('0x7'));var sox=require(_0x5b51('0x8'));var csv=require(_0x5b51('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5b51('0xa'));var squel=require(_0x5b51('0xb'));var crypto=require(_0x5b51('0xc'));var jsforce=require(_0x5b51('0xd'));var deskjs=require(_0x5b51('0xe'));var toCsv=require(_0x5b51('0x9'));var querystring=require(_0x5b51('0xf'));var Papa=require('papaparse');var Redis=require(_0x5b51('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x5b51('0x11'));var as=require(_0x5b51('0x12'));var hardwareService=require(_0x5b51('0x13'));var logger=require('../../config/logger')(_0x5b51('0x14'));var utils=require(_0x5b51('0x15'));var config=require(_0x5b51('0x16'));var licenseUtil=require(_0x5b51('0x17'));var db=require('../../mysqldb')['db'];var jayson=require(_0x5b51('0x18'));var client=jayson['client'][_0x5b51('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x23bd27,_0x3a63a9,_0x483dd1,_0x1de14f){return new BPromise(function(_0x4b4cf8,_0x7cb534){var _0x2efe75=_0x1de14f||client;return _0x2efe75['request'](_0x23bd27,_0x483dd1)[_0x5b51('0x1a')](function(_0xce5553){logger['info'](_0x5b51('0x1b'),_0x3a63a9,_0x5b51('0x1c'));logger[_0x5b51('0x1d')]('ZendeskConfiguration,\x20%s,\x20%s,\x20%s',_0x3a63a9,_0x5b51('0x1c'),JSON['stringify'](_0xce5553));if(_0xce5553[_0x5b51('0x1e')]){if(_0xce5553[_0x5b51('0x1e')][_0x5b51('0x1f')]===0x1f4){logger[_0x5b51('0x1e')](_0x5b51('0x1b'),_0x3a63a9,_0xce5553['error'][_0x5b51('0x20')]);return _0x7cb534(_0xce5553[_0x5b51('0x1e')][_0x5b51('0x20')]);}logger[_0x5b51('0x1e')]('ZendeskConfiguration,\x20%s,\x20%s',_0x3a63a9,_0xce5553[_0x5b51('0x1e')][_0x5b51('0x20')]);return _0x4b4cf8(_0xce5553[_0x5b51('0x1e')][_0x5b51('0x20')]);}else{logger[_0x5b51('0x21')](_0x5b51('0x1b'),_0x3a63a9,_0x5b51('0x1c'));_0x4b4cf8(_0xce5553[_0x5b51('0x22')][_0x5b51('0x20')]);}})[_0x5b51('0x23')](function(_0x1fd553){logger[_0x5b51('0x1e')](_0x5b51('0x1b'),_0x3a63a9,_0x1fd553);_0x7cb534(_0x1fd553);});});}function respondWithStatusCode(_0x24eeda,_0x37f430){_0x37f430=_0x37f430||0xcc;return function(_0x2ef35d){if(_0x2ef35d){return _0x24eeda[_0x5b51('0x24')](_0x37f430);}return _0x24eeda['status'](_0x37f430)[_0x5b51('0x25')]();};}function respondWithResult(_0x52ab1e,_0x4893c1){_0x4893c1=_0x4893c1||0xc8;return function(_0x5e5c97){if(_0x5e5c97){return _0x52ab1e['status'](_0x4893c1)[_0x5b51('0x26')](_0x5e5c97);}};}function respondWithFilteredResult(_0x28ce90,_0x366562){return function(_0x99568){if(_0x99568){var _0x441fd0=typeof _0x366562[_0x5b51('0x27')]===_0x5b51('0x28')&&typeof _0x366562[_0x5b51('0x29')]===_0x5b51('0x28');var _0x2765d4=_0x99568[_0x5b51('0x2a')];var _0x1cfc0a=_0x441fd0?0x0:_0x366562[_0x5b51('0x27')];var _0x14fed0=_0x441fd0?_0x99568[_0x5b51('0x2a')]:_0x366562['offset']+_0x366562[_0x5b51('0x29')];var _0x4c1359;if(_0x14fed0>=_0x2765d4){_0x14fed0=_0x2765d4;_0x4c1359=0xc8;}else{_0x4c1359=0xce;}_0x28ce90[_0x5b51('0x2b')](_0x4c1359);return _0x28ce90['set']('Content-Range',_0x1cfc0a+'-'+_0x14fed0+'/'+_0x2765d4)['json'](_0x99568);}return null;};}function patchUpdates(_0x4cd1b3){return function(_0x16b79f){try{jsonpatch[_0x5b51('0x2c')](_0x16b79f,_0x4cd1b3,!![]);}catch(_0xe4da00){return BPromise[_0x5b51('0x2d')](_0xe4da00);}return _0x16b79f['save']();};}function saveUpdates(_0x45beff,_0x6b26){return function(_0x2390e2){if(_0x2390e2){return _0x2390e2[_0x5b51('0x2e')](_0x45beff)[_0x5b51('0x1a')](function(_0x281b1f){return _0x281b1f;});}return null;};}function removeEntity(_0x245d1b,_0x377588){return function(_0xea74ea){if(_0xea74ea){return _0xea74ea[_0x5b51('0x2f')]()[_0x5b51('0x1a')](function(){_0x245d1b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5111e9,_0x24092){return function(_0xd71635){if(!_0xd71635){_0x5111e9[_0x5b51('0x24')](0x194);}return _0xd71635;};}function handleError(_0x1c583b,_0xbc94bc){_0xbc94bc=_0xbc94bc||0x1f4;return function(_0x488ba0){logger['error'](_0x488ba0[_0x5b51('0x30')]);if(_0x488ba0[_0x5b51('0x31')]){delete _0x488ba0[_0x5b51('0x31')];}_0x1c583b[_0x5b51('0x2b')](_0xbc94bc)['send'](_0x488ba0);};}exports[_0x5b51('0x32')]=function(_0x1e6281,_0x1e5f15){var _0x2aa046={},_0x4b9af3={},_0x4223c4={'count':0x0,'rows':[]};var _0x4c7337=_[_0x5b51('0x33')](db[_0x5b51('0x34')][_0x5b51('0x35')],function(_0x2d4e1){return{'name':_0x2d4e1[_0x5b51('0x36')],'type':_0x2d4e1[_0x5b51('0x37')][_0x5b51('0x38')]};});_0x4b9af3[_0x5b51('0x39')]=_['map'](_0x4c7337,'name');_0x4b9af3['query']=_[_0x5b51('0x3a')](_0x1e6281['query']);_0x4b9af3[_0x5b51('0x3b')]=_[_0x5b51('0x3c')](_0x4b9af3['model'],_0x4b9af3[_0x5b51('0x3d')]);_0x2aa046[_0x5b51('0x3e')]=_['intersection'](_0x4b9af3['model'],qs['fields'](_0x1e6281[_0x5b51('0x3d')][_0x5b51('0x3f')]));_0x2aa046[_0x5b51('0x3e')]=_0x2aa046[_0x5b51('0x3e')]['length']?_0x2aa046['attributes']:_0x4b9af3[_0x5b51('0x39')];if(!_0x1e6281[_0x5b51('0x3d')][_0x5b51('0x40')](_0x5b51('0x41'))){_0x2aa046[_0x5b51('0x29')]=qs['limit'](_0x1e6281[_0x5b51('0x3d')]['limit']);_0x2aa046[_0x5b51('0x27')]=qs[_0x5b51('0x27')](_0x1e6281[_0x5b51('0x3d')][_0x5b51('0x27')]);}_0x2aa046[_0x5b51('0x42')]=qs[_0x5b51('0x43')](_0x1e6281['query'][_0x5b51('0x43')]);_0x2aa046[_0x5b51('0x44')]=qs[_0x5b51('0x3b')](_[_0x5b51('0x45')](_0x1e6281[_0x5b51('0x3d')],_0x4b9af3[_0x5b51('0x3b')]),_0x4c7337);if(_0x1e6281[_0x5b51('0x3d')][_0x5b51('0x46')]){_0x2aa046[_0x5b51('0x44')]=_['merge'](_0x2aa046[_0x5b51('0x44')],{'$or':_['map'](_0x4c7337,function(_0x54748f){if(_0x54748f[_0x5b51('0x37')]!==_0x5b51('0x47')){var _0x47dd84={};_0x47dd84[_0x54748f[_0x5b51('0x31')]]={'$like':'%'+_0x1e6281[_0x5b51('0x3d')][_0x5b51('0x46')]+'%'};return _0x47dd84;}})});}_0x2aa046=_[_0x5b51('0x48')]({},_0x2aa046,_0x1e6281['options']);var _0x5e25b6={'where':_0x2aa046['where']};return db[_0x5b51('0x34')][_0x5b51('0x2a')](_0x5e25b6)[_0x5b51('0x1a')](function(_0x293901){_0x4223c4[_0x5b51('0x2a')]=_0x293901;if(_0x1e6281['query'][_0x5b51('0x49')]){_0x2aa046['include']=[{'all':!![]}];}return db[_0x5b51('0x34')][_0x5b51('0x4a')](_0x2aa046);})[_0x5b51('0x1a')](function(_0x5b025c){_0x4223c4['rows']=_0x5b025c;return _0x4223c4;})[_0x5b51('0x1a')](respondWithFilteredResult(_0x1e5f15,_0x2aa046))['catch'](handleError(_0x1e5f15,null));};exports[_0x5b51('0x4b')]=function(_0x28efc9,_0x5cb379){var _0x3326ec={'raw':![],'where':{'id':_0x28efc9['params']['id']}},_0x4252ee={};_0x4252ee[_0x5b51('0x39')]=_[_0x5b51('0x3a')](db[_0x5b51('0x34')][_0x5b51('0x35')]);_0x4252ee[_0x5b51('0x3d')]=_[_0x5b51('0x3a')](_0x28efc9['query']);_0x4252ee[_0x5b51('0x3b')]=_[_0x5b51('0x3c')](_0x4252ee[_0x5b51('0x39')],_0x4252ee[_0x5b51('0x3d')]);_0x3326ec[_0x5b51('0x3e')]=_[_0x5b51('0x3c')](_0x4252ee[_0x5b51('0x39')],qs[_0x5b51('0x3f')](_0x28efc9['query'][_0x5b51('0x3f')]));_0x3326ec[_0x5b51('0x3e')]=_0x3326ec[_0x5b51('0x3e')][_0x5b51('0x4c')]?_0x3326ec[_0x5b51('0x3e')]:_0x4252ee[_0x5b51('0x39')];if(_0x28efc9['query']['includeAll']){_0x3326ec[_0x5b51('0x4d')]=[{'all':!![]}];}_0x3326ec=_[_0x5b51('0x48')]({},_0x3326ec,_0x28efc9[_0x5b51('0x4e')]);return db[_0x5b51('0x34')][_0x5b51('0x4f')](_0x3326ec)[_0x5b51('0x1a')](handleEntityNotFound(_0x5cb379,null))['then'](respondWithResult(_0x5cb379,null))['catch'](handleError(_0x5cb379,null));};exports[_0x5b51('0x50')]=function(_0x28c88e,_0xee5c9b){return db[_0x5b51('0x34')][_0x5b51('0x50')](_0x28c88e[_0x5b51('0x51')],{})[_0x5b51('0x1a')](respondWithResult(_0xee5c9b,0xc9))['catch'](handleError(_0xee5c9b,null));};exports['update']=function(_0x1eb784,_0x99e40e){if(_0x1eb784[_0x5b51('0x51')]['id']){delete _0x1eb784[_0x5b51('0x51')]['id'];}return db[_0x5b51('0x34')][_0x5b51('0x4f')]({'where':{'id':_0x1eb784[_0x5b51('0x52')]['id']}})[_0x5b51('0x1a')](handleEntityNotFound(_0x99e40e,null))[_0x5b51('0x1a')](saveUpdates(_0x1eb784[_0x5b51('0x51')],null))[_0x5b51('0x1a')](respondWithResult(_0x99e40e,null))[_0x5b51('0x23')](handleError(_0x99e40e,null));};exports[_0x5b51('0x2f')]=function(_0x57f803,_0x25a6dc){return db[_0x5b51('0x34')][_0x5b51('0x4f')]({'where':{'id':_0x57f803[_0x5b51('0x52')]['id']}})[_0x5b51('0x1a')](handleEntityNotFound(_0x25a6dc,null))[_0x5b51('0x1a')](removeEntity(_0x25a6dc,null))[_0x5b51('0x23')](handleError(_0x25a6dc,null));};exports[_0x5b51('0x53')]=function(_0x3d81ab,_0x5e525d,_0x2ba516){var _0x2f3129={};var _0x3601bf={};var _0x1e5d1d;var _0x23a63e;return db[_0x5b51('0x34')]['findOne']({'where':{'id':_0x3d81ab[_0x5b51('0x52')]['id']}})['then'](handleEntityNotFound(_0x5e525d,null))['then'](function(_0x56379d){if(_0x56379d){_0x1e5d1d=_0x56379d;_0x3601bf[_0x5b51('0x39')]=_[_0x5b51('0x3a')](db['ZendeskField'][_0x5b51('0x35')]);_0x3601bf[_0x5b51('0x3d')]=_[_0x5b51('0x3a')](_0x3d81ab[_0x5b51('0x3d')]);_0x3601bf[_0x5b51('0x3b')]=_['intersection'](_0x3601bf[_0x5b51('0x39')],_0x3601bf[_0x5b51('0x3d')]);_0x2f3129[_0x5b51('0x3e')]=_[_0x5b51('0x3c')](_0x3601bf[_0x5b51('0x39')],qs['fields'](_0x3d81ab[_0x5b51('0x3d')]['fields']));_0x2f3129[_0x5b51('0x3e')]=_0x2f3129[_0x5b51('0x3e')][_0x5b51('0x4c')]?_0x2f3129[_0x5b51('0x3e')]:_0x3601bf[_0x5b51('0x39')];_0x2f3129[_0x5b51('0x42')]=qs[_0x5b51('0x43')](_0x3d81ab['query'][_0x5b51('0x43')]);_0x2f3129['where']=qs['filters'](_[_0x5b51('0x45')](_0x3d81ab[_0x5b51('0x3d')],_0x3601bf['filters']));if(_0x3d81ab[_0x5b51('0x3d')][_0x5b51('0x46')]){_0x2f3129[_0x5b51('0x44')]=_[_0x5b51('0x48')](_0x2f3129[_0x5b51('0x44')],{'$or':_[_0x5b51('0x33')](_0x2f3129[_0x5b51('0x3e')],function(_0x3e81e7){var _0x52b2af={};_0x52b2af[_0x3e81e7]={'$like':'%'+_0x3d81ab[_0x5b51('0x3d')]['filter']+'%'};return _0x52b2af;})});}_0x2f3129=_[_0x5b51('0x48')]({},_0x2f3129,_0x3d81ab[_0x5b51('0x4e')]);return _0x1e5d1d[_0x5b51('0x53')](_0x2f3129);}})[_0x5b51('0x1a')](function(_0x24fccb){if(_0x24fccb){_0x23a63e=_0x24fccb[_0x5b51('0x4c')];if(!_0x3d81ab[_0x5b51('0x3d')]['hasOwnProperty'](_0x5b51('0x41'))){_0x2f3129[_0x5b51('0x29')]=qs[_0x5b51('0x29')](_0x3d81ab[_0x5b51('0x3d')][_0x5b51('0x29')]);_0x2f3129[_0x5b51('0x27')]=qs[_0x5b51('0x27')](_0x3d81ab['query'][_0x5b51('0x27')]);}return _0x1e5d1d['getFields'](_0x2f3129);}})['then'](function(_0x417181){if(_0x417181){return _0x417181?{'count':_0x23a63e,'rows':_0x417181}:null;}})['then'](respondWithResult(_0x5e525d,null))[_0x5b51('0x23')](handleError(_0x5e525d,null));};exports[_0x5b51('0x54')]=function(_0x40403b,_0x3ccb71,_0x123d6d){var _0x2091a3={};var _0x10677f={};var _0x1c02c1;var _0x52c518;return db['ZendeskConfiguration'][_0x5b51('0x55')]({'where':{'id':_0x40403b['params']['id']}})['then'](handleEntityNotFound(_0x3ccb71,null))[_0x5b51('0x1a')](function(_0x54e512){if(_0x54e512){_0x1c02c1=_0x54e512;_0x10677f['model']=_['keys'](db[_0x5b51('0x56')][_0x5b51('0x35')]);_0x10677f['query']=_[_0x5b51('0x3a')](_0x40403b['query']);_0x10677f[_0x5b51('0x3b')]=_['intersection'](_0x10677f[_0x5b51('0x39')],_0x10677f[_0x5b51('0x3d')]);_0x2091a3[_0x5b51('0x3e')]=_[_0x5b51('0x3c')](_0x10677f[_0x5b51('0x39')],qs[_0x5b51('0x3f')](_0x40403b[_0x5b51('0x3d')]['fields']));_0x2091a3['attributes']=_0x2091a3['attributes'][_0x5b51('0x4c')]?_0x2091a3['attributes']:_0x10677f[_0x5b51('0x39')];_0x2091a3[_0x5b51('0x42')]=qs[_0x5b51('0x43')](_0x40403b[_0x5b51('0x3d')][_0x5b51('0x43')]);_0x2091a3[_0x5b51('0x44')]=qs['filters'](_[_0x5b51('0x45')](_0x40403b[_0x5b51('0x3d')],_0x10677f[_0x5b51('0x3b')]));if(_0x40403b[_0x5b51('0x3d')][_0x5b51('0x46')]){_0x2091a3[_0x5b51('0x44')]=_[_0x5b51('0x48')](_0x2091a3[_0x5b51('0x44')],{'$or':_[_0x5b51('0x33')](_0x2091a3['attributes'],function(_0x17d0f3){var _0x1d3c45={};_0x1d3c45[_0x17d0f3]={'$like':'%'+_0x40403b[_0x5b51('0x3d')][_0x5b51('0x46')]+'%'};return _0x1d3c45;})});}_0x2091a3=_[_0x5b51('0x48')]({},_0x2091a3,_0x40403b['options']);return _0x1c02c1['getSubjects'](_0x2091a3);}})[_0x5b51('0x1a')](function(_0x203319){if(_0x203319){_0x52c518=_0x203319[_0x5b51('0x4c')];if(!_0x40403b['query'][_0x5b51('0x40')](_0x5b51('0x41'))){_0x2091a3[_0x5b51('0x29')]=qs[_0x5b51('0x29')](_0x40403b[_0x5b51('0x3d')]['limit']);_0x2091a3[_0x5b51('0x27')]=qs[_0x5b51('0x27')](_0x40403b['query'][_0x5b51('0x27')]);}return _0x1c02c1[_0x5b51('0x54')](_0x2091a3);}})[_0x5b51('0x1a')](function(_0x5d156a){if(_0x5d156a){return _0x5d156a?{'count':_0x52c518,'rows':_0x5d156a}:null;}})[_0x5b51('0x1a')](respondWithResult(_0x3ccb71,null))['catch'](handleError(_0x3ccb71,null));};exports[_0x5b51('0x57')]=function(_0xe8b237,_0x265792,_0x43e88f){var _0x42880d={};var _0x815c90={};var _0x5d03ab;var _0x278ea9;return db[_0x5b51('0x34')][_0x5b51('0x55')]({'where':{'id':_0xe8b237[_0x5b51('0x52')]['id']}})['then'](handleEntityNotFound(_0x265792,null))['then'](function(_0x994317){if(_0x994317){_0x5d03ab=_0x994317;_0x815c90[_0x5b51('0x39')]=_[_0x5b51('0x3a')](db[_0x5b51('0x56')][_0x5b51('0x35')]);_0x815c90[_0x5b51('0x3d')]=_[_0x5b51('0x3a')](_0xe8b237[_0x5b51('0x3d')]);_0x815c90[_0x5b51('0x3b')]=_[_0x5b51('0x3c')](_0x815c90[_0x5b51('0x39')],_0x815c90['query']);_0x42880d[_0x5b51('0x3e')]=_[_0x5b51('0x3c')](_0x815c90[_0x5b51('0x39')],qs[_0x5b51('0x3f')](_0xe8b237[_0x5b51('0x3d')][_0x5b51('0x3f')]));_0x42880d[_0x5b51('0x3e')]=_0x42880d[_0x5b51('0x3e')][_0x5b51('0x4c')]?_0x42880d[_0x5b51('0x3e')]:_0x815c90[_0x5b51('0x39')];_0x42880d['order']=qs[_0x5b51('0x43')](_0xe8b237[_0x5b51('0x3d')][_0x5b51('0x43')]);_0x42880d['where']=qs['filters'](_['pick'](_0xe8b237[_0x5b51('0x3d')],_0x815c90[_0x5b51('0x3b')]));if(_0xe8b237[_0x5b51('0x3d')][_0x5b51('0x46')]){_0x42880d[_0x5b51('0x44')]=_[_0x5b51('0x48')](_0x42880d[_0x5b51('0x44')],{'$or':_['map'](_0x42880d[_0x5b51('0x3e')],function(_0x489f7d){var _0x3f0b68={};_0x3f0b68[_0x489f7d]={'$like':'%'+_0xe8b237[_0x5b51('0x3d')]['filter']+'%'};return _0x3f0b68;})});}_0x42880d=_['merge']({},_0x42880d,_0xe8b237[_0x5b51('0x4e')]);return _0x5d03ab[_0x5b51('0x57')](_0x42880d);}})[_0x5b51('0x1a')](function(_0x318024){if(_0x318024){_0x278ea9=_0x318024[_0x5b51('0x4c')];if(!_0xe8b237[_0x5b51('0x3d')][_0x5b51('0x40')]('nolimit')){_0x42880d[_0x5b51('0x29')]=qs[_0x5b51('0x29')](_0xe8b237['query']['limit']);_0x42880d[_0x5b51('0x27')]=qs[_0x5b51('0x27')](_0xe8b237['query'][_0x5b51('0x27')]);}return _0x5d03ab[_0x5b51('0x57')](_0x42880d);}})['then'](function(_0xc5f995){if(_0xc5f995){return _0xc5f995?{'count':_0x278ea9,'rows':_0xc5f995}:null;}})[_0x5b51('0x1a')](respondWithResult(_0x265792,null))[_0x5b51('0x23')](handleError(_0x265792,null));};exports[_0x5b51('0x58')]=function(_0x1a0677,_0x172edc,_0x4bc45c){var _0x40321f={};var _0x212c03={};var _0x1b965a;var _0x18d703;return db[_0x5b51('0x34')][_0x5b51('0x55')]({'where':{'id':_0x1a0677[_0x5b51('0x52')]['id']}})[_0x5b51('0x1a')](handleEntityNotFound(_0x172edc,null))[_0x5b51('0x1a')](function(_0x21f178){if(_0x21f178){_0x1b965a=_0x21f178;_0x212c03[_0x5b51('0x39')]=_[_0x5b51('0x3a')](db[_0x5b51('0x59')][_0x5b51('0x35')]);_0x212c03[_0x5b51('0x3d')]=_[_0x5b51('0x3a')](_0x1a0677[_0x5b51('0x3d')]);_0x212c03[_0x5b51('0x3b')]=_[_0x5b51('0x3c')](_0x212c03[_0x5b51('0x39')],_0x212c03[_0x5b51('0x3d')]);_0x40321f[_0x5b51('0x3e')]=_[_0x5b51('0x3c')](_0x212c03['model'],qs[_0x5b51('0x3f')](_0x1a0677[_0x5b51('0x3d')][_0x5b51('0x3f')]));_0x40321f[_0x5b51('0x3e')]=_0x40321f['attributes'][_0x5b51('0x4c')]?_0x40321f[_0x5b51('0x3e')]:_0x212c03[_0x5b51('0x39')];_0x40321f[_0x5b51('0x42')]=qs[_0x5b51('0x43')](_0x1a0677['query'][_0x5b51('0x43')]);_0x40321f['where']=qs[_0x5b51('0x3b')](_[_0x5b51('0x45')](_0x1a0677[_0x5b51('0x3d')],_0x212c03[_0x5b51('0x3b')]));if(_0x1a0677[_0x5b51('0x3d')][_0x5b51('0x46')]){_0x40321f['where']=_['merge'](_0x40321f[_0x5b51('0x44')],{'$or':_[_0x5b51('0x33')](_0x40321f['attributes'],function(_0x51a5ec){var _0x372ba0={};_0x372ba0[_0x51a5ec]={'$like':'%'+_0x1a0677[_0x5b51('0x3d')][_0x5b51('0x46')]+'%'};return _0x372ba0;})});}_0x40321f=_[_0x5b51('0x48')]({},_0x40321f,_0x1a0677[_0x5b51('0x4e')]);return _0x1b965a[_0x5b51('0x58')](_0x40321f);}})[_0x5b51('0x1a')](function(_0x290a61){if(_0x290a61){_0x18d703=_0x290a61[_0x5b51('0x4c')];if(!_0x1a0677['query'][_0x5b51('0x40')](_0x5b51('0x41'))){_0x40321f['limit']=qs['limit'](_0x1a0677[_0x5b51('0x3d')][_0x5b51('0x29')]);_0x40321f['offset']=qs[_0x5b51('0x27')](_0x1a0677['query']['offset']);}return _0x1b965a['getTags'](_0x40321f);}})[_0x5b51('0x1a')](function(_0x51c9b2){if(_0x51c9b2){return _0x51c9b2?{'count':_0x18d703,'rows':_0x51c9b2}:null;}})[_0x5b51('0x1a')](respondWithResult(_0x172edc,null))[_0x5b51('0x23')](handleError(_0x172edc,null));};exports[_0x5b51('0x5a')]=function(_0x3649df,_0x390f10,_0x59cee0){if(_0x3649df[_0x5b51('0x51')]['id']){delete _0x3649df[_0x5b51('0x51')]['id'];}return db['ZendeskConfiguration'][_0x5b51('0x55')]({'where':{'id':_0x3649df[_0x5b51('0x52')]['id']}})[_0x5b51('0x1a')](handleEntityNotFound(_0x390f10,null))['then'](function(_0x51aaa3){if(_0x51aaa3){return _0x51aaa3[_0x5b51('0x5a')](_0x3649df[_0x5b51('0x51')]['ids']||[]);}return null;})[_0x5b51('0x1a')](respondWithResult(_0x390f10,null))[_0x5b51('0x23')](handleError(_0x390f10,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index 6e181e3..d1a2f26 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 _0x3266=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intZendeskConfiguration.attributes','define','int_zendesk_configurations','lodash','util'];(function(_0x27751c,_0x3d69ea){var _0x12ed13=function(_0x1cd0c4){while(--_0x1cd0c4){_0x27751c['push'](_0x27751c['shift']());}};_0x12ed13(++_0x3d69ea);}(_0x3266,0x6a));var _0x6326=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x3266[_0x53ccf2];return _0x5a2964;};'use strict';var _=require(_0x6326('0x0'));var util=require(_0x6326('0x1'));var logger=require(_0x6326('0x2'))(_0x6326('0x3'));var moment=require(_0x6326('0x4'));var BPromise=require(_0x6326('0x5'));var rp=require(_0x6326('0x6'));var fs=require('fs');var path=require(_0x6326('0x7'));var rimraf=require(_0x6326('0x8'));var config=require('../../config/environment');var attributes=require(_0x6326('0x9'));module['exports']=function(_0x25ecd8,_0x44460c){return _0x25ecd8[_0x6326('0xa')]('ZendeskConfiguration',attributes,{'tableName':_0x6326('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9c00=['path','rimraf','../../config/environment','./intZendeskConfiguration.attributes','exports','define','ZendeskConfiguration','int_zendesk_configurations','lodash','util','moment','bluebird'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x9c00,0x1a0));var _0x09c0=function(_0x487d56,_0x1d4a80){_0x487d56=_0x487d56-0x0;var _0x3f409f=_0x9c00[_0x487d56];return _0x3f409f;};'use strict';var _=require(_0x09c0('0x0'));var util=require(_0x09c0('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x09c0('0x2'));var BPromise=require(_0x09c0('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x09c0('0x4'));var rimraf=require(_0x09c0('0x5'));var config=require(_0x09c0('0x6'));var attributes=require(_0x09c0('0x7'));module[_0x09c0('0x8')]=function(_0x5914eb,_0x4d5fc3){return _0x5914eb[_0x09c0('0x9')](_0x09c0('0xa'),attributes,{'tableName':_0x09c0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js index 95cd556..87aa69f 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 _0xf27b=['ZendeskConfiguration,\x20%s,\x20%s','message','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','request','then','info','request\x20sent','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x9aad68,_0x45377){var _0x281340=function(_0x494ac1){while(--_0x494ac1){_0x9aad68['push'](_0x9aad68['shift']());}};_0x281340(++_0x45377);}(_0xf27b,0x10d));var _0xbf27=function(_0x45ae0d,_0x1ea3b9){_0x45ae0d=_0x45ae0d-0x0;var _0x371826=_0xf27b[_0x45ae0d];return _0x371826;};'use strict';var _=require(_0xbf27('0x0'));var util=require(_0xbf27('0x1'));var moment=require(_0xbf27('0x2'));var BPromise=require('bluebird');var rs=require(_0xbf27('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbf27('0x4'))['db'];var utils=require(_0xbf27('0x5'));var logger=require(_0xbf27('0x6'))('rpc');var config=require(_0xbf27('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xbf27('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x50de37,_0x4c63d4,_0x209eff){return new BPromise(function(_0x2241db,_0x253e03){return client[_0xbf27('0x9')](_0x50de37,_0x209eff)[_0xbf27('0xa')](function(_0x336e05){logger[_0xbf27('0xb')]('ZendeskConfiguration,\x20%s,\x20%s',_0x4c63d4,_0xbf27('0xc'));logger['debug'](_0xbf27('0xd'),_0x4c63d4,'request\x20sent',JSON[_0xbf27('0xe')](_0x336e05));if(_0x336e05[_0xbf27('0xf')]){if(_0x336e05[_0xbf27('0xf')]['code']===0x1f4){logger['error'](_0xbf27('0x10'),_0x4c63d4,_0x336e05[_0xbf27('0xf')][_0xbf27('0x11')]);return _0x253e03(_0x336e05[_0xbf27('0xf')][_0xbf27('0x11')]);}logger[_0xbf27('0xf')]('ZendeskConfiguration,\x20%s,\x20%s',_0x4c63d4,_0x336e05[_0xbf27('0xf')][_0xbf27('0x11')]);return _0x2241db(_0x336e05[_0xbf27('0xf')][_0xbf27('0x11')]);}else{logger[_0xbf27('0xb')](_0xbf27('0x10'),_0x4c63d4,'request\x20sent');_0x2241db(_0x336e05['result'][_0xbf27('0x11')]);}})[_0xbf27('0x12')](function(_0x26041d){logger[_0xbf27('0xf')](_0xbf27('0x10'),_0x4c63d4,_0x26041d);_0x253e03(_0x26041d);});});} \ No newline at end of file +var _0x3bce=['debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ZendeskConfiguration,\x20%s,\x20%s','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','info','request\x20sent'];(function(_0x223248,_0x2d555d){var _0x286608=function(_0x388ddc){while(--_0x388ddc){_0x223248['push'](_0x223248['shift']());}};_0x286608(++_0x2d555d);}(_0x3bce,0x1c1));var _0xe3bc=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0x3bce[_0x46698a];return _0x356db0;};'use strict';var _=require(_0xe3bc('0x0'));var util=require(_0xe3bc('0x1'));var moment=require('moment');var BPromise=require(_0xe3bc('0x2'));var rs=require(_0xe3bc('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe3bc('0x4'))['db'];var utils=require(_0xe3bc('0x5'));var logger=require('../../config/logger')(_0xe3bc('0x6'));var config=require(_0xe3bc('0x7'));var jayson=require(_0xe3bc('0x8'));var client=jayson[_0xe3bc('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3a0209,_0x3b0384,_0x10e6bf){return new BPromise(function(_0x23c066,_0x4f9639){return client[_0xe3bc('0xa')](_0x3a0209,_0x10e6bf)['then'](function(_0x428d57){logger[_0xe3bc('0xb')]('ZendeskConfiguration,\x20%s,\x20%s',_0x3b0384,_0xe3bc('0xc'));logger[_0xe3bc('0xd')](_0xe3bc('0xe'),_0x3b0384,_0xe3bc('0xc'),JSON[_0xe3bc('0xf')](_0x428d57));if(_0x428d57[_0xe3bc('0x10')]){if(_0x428d57[_0xe3bc('0x10')][_0xe3bc('0x11')]===0x1f4){logger[_0xe3bc('0x10')]('ZendeskConfiguration,\x20%s,\x20%s',_0x3b0384,_0x428d57[_0xe3bc('0x10')][_0xe3bc('0x12')]);return _0x4f9639(_0x428d57[_0xe3bc('0x10')]['message']);}logger[_0xe3bc('0x10')]('ZendeskConfiguration,\x20%s,\x20%s',_0x3b0384,_0x428d57[_0xe3bc('0x10')][_0xe3bc('0x12')]);return _0x23c066(_0x428d57['error']['message']);}else{logger[_0xe3bc('0xb')](_0xe3bc('0x13'),_0x3b0384,_0xe3bc('0xc'));_0x23c066(_0x428d57['result'][_0xe3bc('0x12')]);}})[_0xe3bc('0x14')](function(_0x3451ed){logger[_0xe3bc('0x10')]('ZendeskConfiguration,\x20%s,\x20%s',_0x3b0384,_0x3451ed);_0x4f9639(_0x3451ed);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index 23eb0c8..296855d 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 _0x52d1=['post','create','put','/:id','update','delete','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskField.controller','isAuthenticated','get'];(function(_0x13398f,_0x1d2f28){var _0xa6b507=function(_0x2545b4){while(--_0x2545b4){_0x13398f['push'](_0x13398f['shift']());}};_0xa6b507(++_0x1d2f28);}(_0x52d1,0x1e3));var _0x152d=function(_0x597c2f,_0x1c10ea){_0x597c2f=_0x597c2f-0x0;var _0x541464=_0x52d1[_0x597c2f];return _0x541464;};'use strict';var multer=require('multer');var util=require(_0x152d('0x0'));var path=require(_0x152d('0x1'));var timeout=require(_0x152d('0x2'));var express=require('express');var router=express[_0x152d('0x3')]();var fs_extra=require(_0x152d('0x4'));var auth=require(_0x152d('0x5'));var interaction=require(_0x152d('0x6'));var config=require(_0x152d('0x7'));var controller=require(_0x152d('0x8'));router['get']('/',auth[_0x152d('0x9')](),controller['index']);router[_0x152d('0xa')]('/:id',auth[_0x152d('0x9')](),controller['show']);router[_0x152d('0xb')]('/',auth[_0x152d('0x9')](),controller[_0x152d('0xc')]);router[_0x152d('0xd')](_0x152d('0xe'),auth[_0x152d('0x9')](),controller[_0x152d('0xf')]);router[_0x152d('0x10')](_0x152d('0xe'),auth[_0x152d('0x9')](),controller[_0x152d('0x11')]);module[_0x152d('0x12')]=router; \ No newline at end of file +var _0x73f9=['util','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','update','delete','destroy','exports','multer'];(function(_0x27c69b,_0x4cbe55){var _0x198ac4=function(_0x15798b){while(--_0x15798b){_0x27c69b['push'](_0x27c69b['shift']());}};_0x198ac4(++_0x4cbe55);}(_0x73f9,0x1d3));var _0x973f=function(_0x1c6387,_0xe5dd01){_0x1c6387=_0x1c6387-0x0;var _0x1a0a77=_0x73f9[_0x1c6387];return _0x1a0a77;};'use strict';var multer=require(_0x973f('0x0'));var util=require(_0x973f('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x973f('0x2'));var router=express[_0x973f('0x3')]();var fs_extra=require(_0x973f('0x4'));var auth=require(_0x973f('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x973f('0x6'));var controller=require('./intZendeskField.controller');router[_0x973f('0x7')]('/',auth[_0x973f('0x8')](),controller[_0x973f('0x9')]);router[_0x973f('0x7')](_0x973f('0xa'),auth[_0x973f('0x8')](),controller[_0x973f('0xb')]);router[_0x973f('0xc')]('/',auth['isAuthenticated'](),controller[_0x973f('0xd')]);router['put']('/:id',auth[_0x973f('0x8')](),controller[_0x973f('0xe')]);router[_0x973f('0xf')](_0x973f('0xa'),auth[_0x973f('0x8')](),controller[_0x973f('0x10')]);module[_0x973f('0x11')]=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index c9d0641..d55150c 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 _0xdd71=['customVariable','keyValue','picklist','string','STRING','BOOLEAN','sequelize','exports','ENUM','variable'];(function(_0x3ce9d0,_0x489e4b){var _0x5d1047=function(_0x30ff0d){while(--_0x30ff0d){_0x3ce9d0['push'](_0x3ce9d0['shift']());}};_0x5d1047(++_0x489e4b);}(_0xdd71,0x18c));var _0x1dd7=function(_0x17e047,_0x199c8b){_0x17e047=_0x17e047-0x0;var _0x3d40c1=_0xdd71[_0x17e047];return _0x3d40c1;};'use strict';var Sequelize=require(_0x1dd7('0x0'));module[_0x1dd7('0x1')]={'type':{'type':Sequelize[_0x1dd7('0x2')]('string',_0x1dd7('0x3'),_0x1dd7('0x4'),_0x1dd7('0x5'),_0x1dd7('0x6')),'defaultValue':_0x1dd7('0x7')},'content':{'type':Sequelize[_0x1dd7('0x8')]},'key':{'type':Sequelize[_0x1dd7('0x8')]},'keyType':{'type':Sequelize[_0x1dd7('0x2')](_0x1dd7('0x7'),_0x1dd7('0x3'),_0x1dd7('0x4'))},'keyContent':{'type':Sequelize[_0x1dd7('0x8')]},'idField':{'type':Sequelize[_0x1dd7('0x8')]},'nameField':{'type':Sequelize[_0x1dd7('0x8')]},'customField':{'type':Sequelize[_0x1dd7('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x1dd7('0x8')]}}; \ No newline at end of file +var _0x766c=['exports','variable','customVariable','string','ENUM','STRING','sequelize'];(function(_0x23a7d5,_0x4ac51e){var _0x2425de=function(_0x5d1766){while(--_0x5d1766){_0x23a7d5['push'](_0x23a7d5['shift']());}};_0x2425de(++_0x4ac51e);}(_0x766c,0xca));var _0xc766=function(_0x186d7d,_0x462d17){_0x186d7d=_0x186d7d-0x0;var _0x621bc2=_0x766c[_0x186d7d];return _0x621bc2;};'use strict';var Sequelize=require(_0xc766('0x0'));module[_0xc766('0x1')]={'type':{'type':Sequelize['ENUM']('string',_0xc766('0x2'),_0xc766('0x3'),'keyValue','picklist'),'defaultValue':_0xc766('0x4')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xc766('0x5')]('string','variable','customVariable')},'keyContent':{'type':Sequelize[_0xc766('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xc766('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index 07580e4..ba53905 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 _0x98e5=['crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','destroy','then','end','sendStatus','error','name','index','ZendeskField','rawAttributes','fieldName','type','key','map','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','findAll','catch','show','params','filters','find','create','body','fast-json-patch','request-promise','bluebird','mustache','path','ejs','lodash','squel'];(function(_0x18c937,_0x32d230){var _0xc920b3=function(_0x3f8610){while(--_0x3f8610){_0x18c937['push'](_0x18c937['shift']());}};_0xc920b3(++_0x32d230);}(_0x98e5,0x8a));var _0x598e=function(_0x529889,_0x2772bf){_0x529889=_0x529889-0x0;var _0x3f1b05=_0x98e5[_0x529889];return _0x3f1b05;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x598e('0x0'));var rp=require(_0x598e('0x1'));var moment=require('moment');var BPromise=require(_0x598e('0x2'));var Mustache=require(_0x598e('0x3'));var util=require('util');var path=require(_0x598e('0x4'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x598e('0x5'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x598e('0x6'));var squel=require(_0x598e('0x7'));var crypto=require(_0x598e('0x8'));var jsforce=require(_0x598e('0x9'));var deskjs=require(_0x598e('0xa'));var toCsv=require(_0x598e('0xb'));var querystring=require(_0x598e('0xc'));var Papa=require(_0x598e('0xd'));var Redis=require(_0x598e('0xe'));var authService=require(_0x598e('0xf'));var qs=require(_0x598e('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x598e('0x11'));var logger=require(_0x598e('0x12'))('api');var utils=require(_0x598e('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x598e('0x14'));var db=require(_0x598e('0x15'))['db'];function respondWithStatusCode(_0x2e3614,_0xd29d12){_0xd29d12=_0xd29d12||0xcc;return function(_0x3811b2){if(_0x3811b2){return _0x2e3614['sendStatus'](_0xd29d12);}return _0x2e3614[_0x598e('0x16')](_0xd29d12)['end']();};}function respondWithResult(_0x1c3f37,_0x51d7f0){_0x51d7f0=_0x51d7f0||0xc8;return function(_0x4e253a){if(_0x4e253a){return _0x1c3f37[_0x598e('0x16')](_0x51d7f0)[_0x598e('0x17')](_0x4e253a);}};}function respondWithFilteredResult(_0x3d6571,_0x38868b){return function(_0x34c672){if(_0x34c672){var _0x93ba6c=typeof _0x38868b[_0x598e('0x18')]==='undefined'&&typeof _0x38868b[_0x598e('0x19')]===_0x598e('0x1a');var _0x3521bc=_0x34c672[_0x598e('0x1b')];var _0x50ffbb=_0x93ba6c?0x0:_0x38868b[_0x598e('0x18')];var _0x2ecb1e=_0x93ba6c?_0x34c672[_0x598e('0x1b')]:_0x38868b[_0x598e('0x18')]+_0x38868b[_0x598e('0x19')];var _0x1c1085;if(_0x2ecb1e>=_0x3521bc){_0x2ecb1e=_0x3521bc;_0x1c1085=0xc8;}else{_0x1c1085=0xce;}_0x3d6571[_0x598e('0x16')](_0x1c1085);return _0x3d6571[_0x598e('0x1c')](_0x598e('0x1d'),_0x50ffbb+'-'+_0x2ecb1e+'/'+_0x3521bc)[_0x598e('0x17')](_0x34c672);}return null;};}function patchUpdates(_0x17e5f1){return function(_0x2a1a65){try{jsonpatch[_0x598e('0x1e')](_0x2a1a65,_0x17e5f1,!![]);}catch(_0x20c1bb){return BPromise[_0x598e('0x1f')](_0x20c1bb);}return _0x2a1a65[_0x598e('0x20')]();};}function saveUpdates(_0x233f16,_0x5b9c3){return function(_0x4a483b){if(_0x4a483b){return _0x4a483b[_0x598e('0x21')](_0x233f16)['then'](function(_0xdec363){return _0xdec363;});}return null;};}function removeEntity(_0x3cea88,_0x5df3ba){return function(_0x45e7ee){if(_0x45e7ee){return _0x45e7ee[_0x598e('0x22')]()[_0x598e('0x23')](function(){_0x3cea88[_0x598e('0x16')](0xcc)[_0x598e('0x24')]();});}};}function handleEntityNotFound(_0x3e434e,_0x2cb735){return function(_0x2a8fbc){if(!_0x2a8fbc){_0x3e434e[_0x598e('0x25')](0x194);}return _0x2a8fbc;};}function handleError(_0x19d4f8,_0x1a8d85){_0x1a8d85=_0x1a8d85||0x1f4;return function(_0x5d63ce){logger[_0x598e('0x26')](_0x5d63ce['stack']);if(_0x5d63ce[_0x598e('0x27')]){delete _0x5d63ce[_0x598e('0x27')];}_0x19d4f8[_0x598e('0x16')](_0x1a8d85)['send'](_0x5d63ce);};}exports[_0x598e('0x28')]=function(_0xc81d68,_0x158681){var _0x884e0f={},_0x43ddf0={},_0x5ecac3={'count':0x0,'rows':[]};var _0x4fad2d=_['map'](db[_0x598e('0x29')][_0x598e('0x2a')],function(_0x2ee4a5){return{'name':_0x2ee4a5[_0x598e('0x2b')],'type':_0x2ee4a5[_0x598e('0x2c')][_0x598e('0x2d')]};});_0x43ddf0['model']=_[_0x598e('0x2e')](_0x4fad2d,_0x598e('0x27'));_0x43ddf0[_0x598e('0x2f')]=_[_0x598e('0x30')](_0xc81d68[_0x598e('0x2f')]);_0x43ddf0['filters']=_[_0x598e('0x31')](_0x43ddf0[_0x598e('0x32')],_0x43ddf0[_0x598e('0x2f')]);_0x884e0f['attributes']=_[_0x598e('0x31')](_0x43ddf0[_0x598e('0x32')],qs['fields'](_0xc81d68[_0x598e('0x2f')][_0x598e('0x33')]));_0x884e0f[_0x598e('0x34')]=_0x884e0f[_0x598e('0x34')][_0x598e('0x35')]?_0x884e0f[_0x598e('0x34')]:_0x43ddf0['model'];if(!_0xc81d68[_0x598e('0x2f')][_0x598e('0x36')](_0x598e('0x37'))){_0x884e0f['limit']=qs['limit'](_0xc81d68[_0x598e('0x2f')]['limit']);_0x884e0f[_0x598e('0x18')]=qs[_0x598e('0x18')](_0xc81d68['query']['offset']);}_0x884e0f[_0x598e('0x38')]=qs['sort'](_0xc81d68[_0x598e('0x2f')][_0x598e('0x39')]);_0x884e0f[_0x598e('0x3a')]=qs['filters'](_[_0x598e('0x3b')](_0xc81d68['query'],_0x43ddf0['filters']),_0x4fad2d);if(_0xc81d68[_0x598e('0x2f')][_0x598e('0x3c')]){_0x884e0f['where']=_['merge'](_0x884e0f[_0x598e('0x3a')],{'$or':_[_0x598e('0x2e')](_0x4fad2d,function(_0x5254e5){if(_0x5254e5[_0x598e('0x2c')]!==_0x598e('0x3d')){var _0x38142c={};_0x38142c[_0x5254e5[_0x598e('0x27')]]={'$like':'%'+_0xc81d68[_0x598e('0x2f')][_0x598e('0x3c')]+'%'};return _0x38142c;}})});}_0x884e0f=_[_0x598e('0x3e')]({},_0x884e0f,_0xc81d68['options']);var _0x3ee264={'where':_0x884e0f[_0x598e('0x3a')]};return db[_0x598e('0x29')][_0x598e('0x1b')](_0x3ee264)[_0x598e('0x23')](function(_0x25af45){_0x5ecac3[_0x598e('0x1b')]=_0x25af45;if(_0xc81d68[_0x598e('0x2f')][_0x598e('0x3f')]){_0x884e0f[_0x598e('0x40')]=[{'all':!![]}];}return db[_0x598e('0x29')][_0x598e('0x41')](_0x884e0f);})[_0x598e('0x23')](function(_0x5633c9){_0x5ecac3['rows']=_0x5633c9;return _0x5ecac3;})[_0x598e('0x23')](respondWithFilteredResult(_0x158681,_0x884e0f))[_0x598e('0x42')](handleError(_0x158681,null));};exports[_0x598e('0x43')]=function(_0x3c7828,_0x4d3273){var _0x3799c7={'raw':!![],'where':{'id':_0x3c7828[_0x598e('0x44')]['id']}},_0x22f24b={};_0x22f24b['model']=_[_0x598e('0x30')](db[_0x598e('0x29')][_0x598e('0x2a')]);_0x22f24b[_0x598e('0x2f')]=_[_0x598e('0x30')](_0x3c7828[_0x598e('0x2f')]);_0x22f24b[_0x598e('0x45')]=_[_0x598e('0x31')](_0x22f24b[_0x598e('0x32')],_0x22f24b[_0x598e('0x2f')]);_0x3799c7[_0x598e('0x34')]=_['intersection'](_0x22f24b['model'],qs['fields'](_0x3c7828[_0x598e('0x2f')][_0x598e('0x33')]));_0x3799c7[_0x598e('0x34')]=_0x3799c7['attributes'][_0x598e('0x35')]?_0x3799c7[_0x598e('0x34')]:_0x22f24b[_0x598e('0x32')];if(_0x3c7828['query'][_0x598e('0x3f')]){_0x3799c7[_0x598e('0x40')]=[{'all':!![]}];}_0x3799c7=_[_0x598e('0x3e')]({},_0x3799c7,_0x3c7828['options']);return db[_0x598e('0x29')][_0x598e('0x46')](_0x3799c7)[_0x598e('0x23')](handleEntityNotFound(_0x4d3273,null))[_0x598e('0x23')](respondWithResult(_0x4d3273,null))[_0x598e('0x42')](handleError(_0x4d3273,null));};exports[_0x598e('0x47')]=function(_0x5ec8d8,_0x2c7c8f){return db[_0x598e('0x29')]['create'](_0x5ec8d8[_0x598e('0x48')],{})[_0x598e('0x23')](respondWithResult(_0x2c7c8f,0xc9))[_0x598e('0x42')](handleError(_0x2c7c8f,null));};exports['update']=function(_0x59e67b,_0x57b11a){if(_0x59e67b[_0x598e('0x48')]['id']){delete _0x59e67b[_0x598e('0x48')]['id'];}return db['ZendeskField']['find']({'where':{'id':_0x59e67b[_0x598e('0x44')]['id']}})[_0x598e('0x23')](handleEntityNotFound(_0x57b11a,null))['then'](saveUpdates(_0x59e67b['body'],null))[_0x598e('0x23')](respondWithResult(_0x57b11a,null))[_0x598e('0x42')](handleError(_0x57b11a,null));};exports[_0x598e('0x22')]=function(_0x34a43d,_0x5cbe61){return db['ZendeskField'][_0x598e('0x46')]({'where':{'id':_0x34a43d['params']['id']}})[_0x598e('0x23')](handleEntityNotFound(_0x5cbe61,null))['then'](removeEntity(_0x5cbe61,null))[_0x598e('0x42')](handleError(_0x5cbe61,null));}; \ No newline at end of file +var _0x1d81=['attributes','fields','hasOwnProperty','order','sort','where','filters','filter','merge','type','VIRTUAL','options','includeAll','rows','show','params','length','include','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','map','ZendeskField','rawAttributes','fieldName','key','model','keys','query','intersection'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x1d81,0x64));var _0x11d8=function(_0x2fc284,_0x5d271c){_0x2fc284=_0x2fc284-0x0;var _0x221234=_0x1d81[_0x2fc284];return _0x221234;};'use strict';var emlformat=require(_0x11d8('0x0'));var rimraf=require(_0x11d8('0x1'));var zipdir=require(_0x11d8('0x2'));var jsonpatch=require(_0x11d8('0x3'));var rp=require(_0x11d8('0x4'));var moment=require(_0x11d8('0x5'));var BPromise=require(_0x11d8('0x6'));var Mustache=require(_0x11d8('0x7'));var util=require(_0x11d8('0x8'));var path=require(_0x11d8('0x9'));var sox=require(_0x11d8('0xa'));var csv=require(_0x11d8('0xb'));var ejs=require(_0x11d8('0xc'));var fs=require('fs');var fs_extra=require(_0x11d8('0xd'));var _=require(_0x11d8('0xe'));var squel=require(_0x11d8('0xf'));var crypto=require(_0x11d8('0x10'));var jsforce=require(_0x11d8('0x11'));var deskjs=require(_0x11d8('0x12'));var toCsv=require(_0x11d8('0xb'));var querystring=require('querystring');var Papa=require(_0x11d8('0x13'));var Redis=require('ioredis');var authService=require(_0x11d8('0x14'));var qs=require(_0x11d8('0x15'));var as=require(_0x11d8('0x16'));var hardwareService=require(_0x11d8('0x17'));var logger=require(_0x11d8('0x18'))('api');var utils=require('../../config/utils');var config=require(_0x11d8('0x19'));var licenseUtil=require(_0x11d8('0x1a'));var db=require(_0x11d8('0x1b'))['db'];function respondWithStatusCode(_0x8dec2f,_0x38c5f5){_0x38c5f5=_0x38c5f5||0xcc;return function(_0x2650d4){if(_0x2650d4){return _0x8dec2f[_0x11d8('0x1c')](_0x38c5f5);}return _0x8dec2f[_0x11d8('0x1d')](_0x38c5f5)[_0x11d8('0x1e')]();};}function respondWithResult(_0x2cf53a,_0xa4817c){_0xa4817c=_0xa4817c||0xc8;return function(_0x5df468){if(_0x5df468){return _0x2cf53a[_0x11d8('0x1d')](_0xa4817c)['json'](_0x5df468);}};}function respondWithFilteredResult(_0x279811,_0x517881){return function(_0x1a7805){if(_0x1a7805){var _0x2241e8=typeof _0x517881[_0x11d8('0x1f')]==='undefined'&&typeof _0x517881[_0x11d8('0x20')]===_0x11d8('0x21');var _0x48d7e2=_0x1a7805[_0x11d8('0x22')];var _0x46b1f1=_0x2241e8?0x0:_0x517881['offset'];var _0x3c21ac=_0x2241e8?_0x1a7805['count']:_0x517881['offset']+_0x517881[_0x11d8('0x20')];var _0x168f9f;if(_0x3c21ac>=_0x48d7e2){_0x3c21ac=_0x48d7e2;_0x168f9f=0xc8;}else{_0x168f9f=0xce;}_0x279811[_0x11d8('0x1d')](_0x168f9f);return _0x279811[_0x11d8('0x23')](_0x11d8('0x24'),_0x46b1f1+'-'+_0x3c21ac+'/'+_0x48d7e2)['json'](_0x1a7805);}return null;};}function patchUpdates(_0x1a2806){return function(_0x14ef96){try{jsonpatch['apply'](_0x14ef96,_0x1a2806,!![]);}catch(_0x892d8c){return BPromise[_0x11d8('0x25')](_0x892d8c);}return _0x14ef96[_0x11d8('0x26')]();};}function saveUpdates(_0x5cd17b,_0x501b04){return function(_0x5db26d){if(_0x5db26d){return _0x5db26d[_0x11d8('0x27')](_0x5cd17b)[_0x11d8('0x28')](function(_0x21738f){return _0x21738f;});}return null;};}function removeEntity(_0x548304,_0x3e6601){return function(_0x5af5b2){if(_0x5af5b2){return _0x5af5b2[_0x11d8('0x29')]()[_0x11d8('0x28')](function(){_0x548304[_0x11d8('0x1d')](0xcc)[_0x11d8('0x1e')]();});}};}function handleEntityNotFound(_0x5b167f,_0x45c55d){return function(_0x4ac7f6){if(!_0x4ac7f6){_0x5b167f[_0x11d8('0x1c')](0x194);}return _0x4ac7f6;};}function handleError(_0x25d898,_0x2a53ef){_0x2a53ef=_0x2a53ef||0x1f4;return function(_0x4aa457){logger[_0x11d8('0x2a')](_0x4aa457[_0x11d8('0x2b')]);if(_0x4aa457['name']){delete _0x4aa457[_0x11d8('0x2c')];}_0x25d898['status'](_0x2a53ef)[_0x11d8('0x2d')](_0x4aa457);};}exports[_0x11d8('0x2e')]=function(_0x2d0d6d,_0x538b16){var _0x3c26b5={},_0x58777e={},_0x332537={'count':0x0,'rows':[]};var _0x2ca198=_[_0x11d8('0x2f')](db[_0x11d8('0x30')][_0x11d8('0x31')],function(_0x25ab57){return{'name':_0x25ab57[_0x11d8('0x32')],'type':_0x25ab57['type'][_0x11d8('0x33')]};});_0x58777e[_0x11d8('0x34')]=_[_0x11d8('0x2f')](_0x2ca198,_0x11d8('0x2c'));_0x58777e['query']=_[_0x11d8('0x35')](_0x2d0d6d[_0x11d8('0x36')]);_0x58777e['filters']=_[_0x11d8('0x37')](_0x58777e[_0x11d8('0x34')],_0x58777e[_0x11d8('0x36')]);_0x3c26b5[_0x11d8('0x38')]=_[_0x11d8('0x37')](_0x58777e[_0x11d8('0x34')],qs[_0x11d8('0x39')](_0x2d0d6d[_0x11d8('0x36')][_0x11d8('0x39')]));_0x3c26b5[_0x11d8('0x38')]=_0x3c26b5[_0x11d8('0x38')]['length']?_0x3c26b5['attributes']:_0x58777e['model'];if(!_0x2d0d6d[_0x11d8('0x36')][_0x11d8('0x3a')]('nolimit')){_0x3c26b5[_0x11d8('0x20')]=qs['limit'](_0x2d0d6d[_0x11d8('0x36')]['limit']);_0x3c26b5[_0x11d8('0x1f')]=qs[_0x11d8('0x1f')](_0x2d0d6d[_0x11d8('0x36')]['offset']);}_0x3c26b5[_0x11d8('0x3b')]=qs['sort'](_0x2d0d6d[_0x11d8('0x36')][_0x11d8('0x3c')]);_0x3c26b5[_0x11d8('0x3d')]=qs[_0x11d8('0x3e')](_['pick'](_0x2d0d6d['query'],_0x58777e[_0x11d8('0x3e')]),_0x2ca198);if(_0x2d0d6d['query'][_0x11d8('0x3f')]){_0x3c26b5[_0x11d8('0x3d')]=_[_0x11d8('0x40')](_0x3c26b5[_0x11d8('0x3d')],{'$or':_['map'](_0x2ca198,function(_0x39a5a7){if(_0x39a5a7[_0x11d8('0x41')]!==_0x11d8('0x42')){var _0x138923={};_0x138923[_0x39a5a7[_0x11d8('0x2c')]]={'$like':'%'+_0x2d0d6d[_0x11d8('0x36')]['filter']+'%'};return _0x138923;}})});}_0x3c26b5=_[_0x11d8('0x40')]({},_0x3c26b5,_0x2d0d6d[_0x11d8('0x43')]);var _0x2dca7d={'where':_0x3c26b5[_0x11d8('0x3d')]};return db['ZendeskField'][_0x11d8('0x22')](_0x2dca7d)[_0x11d8('0x28')](function(_0x4c8292){_0x332537[_0x11d8('0x22')]=_0x4c8292;if(_0x2d0d6d[_0x11d8('0x36')][_0x11d8('0x44')]){_0x3c26b5['include']=[{'all':!![]}];}return db['ZendeskField']['findAll'](_0x3c26b5);})[_0x11d8('0x28')](function(_0x5f02db){_0x332537[_0x11d8('0x45')]=_0x5f02db;return _0x332537;})[_0x11d8('0x28')](respondWithFilteredResult(_0x538b16,_0x3c26b5))['catch'](handleError(_0x538b16,null));};exports[_0x11d8('0x46')]=function(_0x131dac,_0x1fc145){var _0x2b54b8={'raw':!![],'where':{'id':_0x131dac[_0x11d8('0x47')]['id']}},_0x23cbe1={};_0x23cbe1['model']=_[_0x11d8('0x35')](db[_0x11d8('0x30')][_0x11d8('0x31')]);_0x23cbe1[_0x11d8('0x36')]=_[_0x11d8('0x35')](_0x131dac[_0x11d8('0x36')]);_0x23cbe1[_0x11d8('0x3e')]=_[_0x11d8('0x37')](_0x23cbe1[_0x11d8('0x34')],_0x23cbe1['query']);_0x2b54b8['attributes']=_['intersection'](_0x23cbe1[_0x11d8('0x34')],qs[_0x11d8('0x39')](_0x131dac[_0x11d8('0x36')][_0x11d8('0x39')]));_0x2b54b8[_0x11d8('0x38')]=_0x2b54b8[_0x11d8('0x38')][_0x11d8('0x48')]?_0x2b54b8['attributes']:_0x23cbe1[_0x11d8('0x34')];if(_0x131dac['query'][_0x11d8('0x44')]){_0x2b54b8[_0x11d8('0x49')]=[{'all':!![]}];}_0x2b54b8=_['merge']({},_0x2b54b8,_0x131dac['options']);return db['ZendeskField'][_0x11d8('0x4a')](_0x2b54b8)[_0x11d8('0x28')](handleEntityNotFound(_0x1fc145,null))[_0x11d8('0x28')](respondWithResult(_0x1fc145,null))[_0x11d8('0x4b')](handleError(_0x1fc145,null));};exports[_0x11d8('0x4c')]=function(_0x2278b7,_0x468685){return db['ZendeskField']['create'](_0x2278b7[_0x11d8('0x4d')],{})['then'](respondWithResult(_0x468685,0xc9))[_0x11d8('0x4b')](handleError(_0x468685,null));};exports[_0x11d8('0x27')]=function(_0xfc76d8,_0x5c77c8){if(_0xfc76d8['body']['id']){delete _0xfc76d8['body']['id'];}return db['ZendeskField']['find']({'where':{'id':_0xfc76d8['params']['id']}})['then'](handleEntityNotFound(_0x5c77c8,null))[_0x11d8('0x28')](saveUpdates(_0xfc76d8[_0x11d8('0x4d')],null))[_0x11d8('0x28')](respondWithResult(_0x5c77c8,null))[_0x11d8('0x4b')](handleError(_0x5c77c8,null));};exports[_0x11d8('0x29')]=function(_0x55247b,_0x245d3f){return db[_0x11d8('0x30')][_0x11d8('0x4a')]({'where':{'id':_0x55247b[_0x11d8('0x47')]['id']}})[_0x11d8('0x28')](handleEntityNotFound(_0x245d3f,null))['then'](removeEntity(_0x245d3f,null))[_0x11d8('0x4b')](handleError(_0x245d3f,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index 158bbe6..9284e6f 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 _0x7d73=['moment','bluebird','request-promise','../../config/environment','exports','ZendeskField','int_zendesk_fields','idField','FieldId','util','api'];(function(_0x5a2285,_0x3212d1){var _0x48f6ed=function(_0x322127){while(--_0x322127){_0x5a2285['push'](_0x5a2285['shift']());}};_0x48f6ed(++_0x3212d1);}(_0x7d73,0xda));var _0x37d7=function(_0x4b784d,_0x5efb2f){_0x4b784d=_0x4b784d-0x0;var _0x2cdeaf=_0x7d73[_0x4b784d];return _0x2cdeaf;};'use strict';var _=require('lodash');var util=require(_0x37d7('0x0'));var logger=require('../../config/logger')(_0x37d7('0x1'));var moment=require(_0x37d7('0x2'));var BPromise=require(_0x37d7('0x3'));var rp=require(_0x37d7('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x37d7('0x5'));var attributes=require('./intZendeskField.attributes');module[_0x37d7('0x6')]=function(_0x2e38aa,_0x344c66){return _0x2e38aa['define'](_0x37d7('0x7'),attributes,{'tableName':_0x37d7('0x8'),'paranoid':![],'indexes':[{'name':'zendesk_unique_index','fields':[_0x37d7('0x9'),_0x37d7('0xa')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x476f=['FieldId','util','rimraf','../../config/environment','./intZendeskField.attributes','exports','define','ZendeskField','int_zendesk_fields','zendesk_unique_index','idField'];(function(_0x26889f,_0x419291){var _0x167e53=function(_0x2f58a3){while(--_0x2f58a3){_0x26889f['push'](_0x26889f['shift']());}};_0x167e53(++_0x419291);}(_0x476f,0xfe));var _0xf476=function(_0x12a1f,_0x24fece){_0x12a1f=_0x12a1f-0x0;var _0x41bde4=_0x476f[_0x12a1f];return _0x41bde4;};'use strict';var _=require('lodash');var util=require(_0xf476('0x0'));var logger=require('../../config/logger')('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(_0xf476('0x1'));var config=require(_0xf476('0x2'));var attributes=require(_0xf476('0x3'));module[_0xf476('0x4')]=function(_0x109a07,_0x1e9791){return _0x109a07[_0xf476('0x5')](_0xf476('0x6'),attributes,{'tableName':_0xf476('0x7'),'paranoid':![],'indexes':[{'name':_0xf476('0x8'),'fields':[_0xf476('0x9'),_0xf476('0xa')],'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 c298c2e..767af7b 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 _0x74d7=['client','http','request','info','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x1dbd4c,_0x1a3f39){var _0x215064=function(_0x19bfa5){while(--_0x19bfa5){_0x1dbd4c['push'](_0x1dbd4c['shift']());}};_0x215064(++_0x1a3f39);}(_0x74d7,0x8b));var _0x774d=function(_0x590b63,_0x14debb){_0x590b63=_0x590b63-0x0;var _0x3c9380=_0x74d7[_0x590b63];return _0x3c9380;};'use strict';var _=require(_0x774d('0x0'));var util=require(_0x774d('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x774d('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x774d('0x3'));var logger=require(_0x774d('0x4'))(_0x774d('0x5'));var config=require(_0x774d('0x6'));var jayson=require(_0x774d('0x7'));var client=jayson[_0x774d('0x8')][_0x774d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x30689d,_0x115177,_0x2571cc){return new BPromise(function(_0x3a9880,_0x3f881b){return client[_0x774d('0xa')](_0x30689d,_0x2571cc)['then'](function(_0x4fae58){logger[_0x774d('0xb')](_0x774d('0xc'),_0x115177,_0x774d('0xd'));logger[_0x774d('0xe')](_0x774d('0xf'),_0x115177,_0x774d('0xd'),JSON[_0x774d('0x10')](_0x4fae58));if(_0x4fae58['error']){if(_0x4fae58[_0x774d('0x11')][_0x774d('0x12')]===0x1f4){logger[_0x774d('0x11')](_0x774d('0xc'),_0x115177,_0x4fae58[_0x774d('0x11')][_0x774d('0x13')]);return _0x3f881b(_0x4fae58['error']['message']);}logger[_0x774d('0x11')](_0x774d('0xc'),_0x115177,_0x4fae58['error']['message']);return _0x3a9880(_0x4fae58['error'][_0x774d('0x13')]);}else{logger[_0x774d('0xb')](_0x774d('0xc'),_0x115177,'request\x20sent');_0x3a9880(_0x4fae58['result']['message']);}})[_0x774d('0x14')](function(_0x309566){logger['error'](_0x774d('0xc'),_0x115177,_0x309566);_0x3f881b(_0x309566);});});} \ No newline at end of file +var _0x9ca7=['result','catch','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','ZendeskField,\x20%s,\x20%s','request\x20sent','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','code','error','message'];(function(_0x3e036a,_0x4c7991){var _0x25b29d=function(_0x99781f){while(--_0x99781f){_0x3e036a['push'](_0x3e036a['shift']());}};_0x25b29d(++_0x4c7991);}(_0x9ca7,0x12e));var _0x79ca=function(_0x1cc79f,_0xd7052b){_0x1cc79f=_0x1cc79f-0x0;var _0x28f695=_0x9ca7[_0x1cc79f];return _0x28f695;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x79ca('0x0'));var BPromise=require(_0x79ca('0x1'));var rs=require(_0x79ca('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x79ca('0x3'))['db'];var utils=require(_0x79ca('0x4'));var logger=require(_0x79ca('0x5'))('rpc');var config=require(_0x79ca('0x6'));var jayson=require(_0x79ca('0x7'));var client=jayson['client'][_0x79ca('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1d318d,_0x296202,_0x1941bb){return new BPromise(function(_0x19d530,_0x39f9d9){return client[_0x79ca('0x9')](_0x1d318d,_0x1941bb)[_0x79ca('0xa')](function(_0x548242){logger['info'](_0x79ca('0xb'),_0x296202,_0x79ca('0xc'));logger['debug'](_0x79ca('0xd'),_0x296202,_0x79ca('0xc'),JSON[_0x79ca('0xe')](_0x548242));if(_0x548242['error']){if(_0x548242['error'][_0x79ca('0xf')]===0x1f4){logger[_0x79ca('0x10')](_0x79ca('0xb'),_0x296202,_0x548242[_0x79ca('0x10')]['message']);return _0x39f9d9(_0x548242[_0x79ca('0x10')][_0x79ca('0x11')]);}logger['error'](_0x79ca('0xb'),_0x296202,_0x548242[_0x79ca('0x10')][_0x79ca('0x11')]);return _0x19d530(_0x548242[_0x79ca('0x10')][_0x79ca('0x11')]);}else{logger['info'](_0x79ca('0xb'),_0x296202,_0x79ca('0xc'));_0x19d530(_0x548242[_0x79ca('0x12')]['message']);}})[_0x79ca('0x13')](function(_0x1f1ce9){logger['error']('ZendeskField,\x20%s,\x20%s',_0x296202,_0x1f1ce9);_0x39f9d9(_0x1f1ce9);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index 17bd4ba..3d0a15f 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 _0x2bfb=['express','Router','fs-extra','../../components/interaction/service','./intZohoAccount.controller','get','index','/:id','/:id/configurations','isAuthenticated','getConfigurations','/:id/fields','post','addConfiguration','put','update','delete','destroy','exports','util','path','connect-timeout'];(function(_0x3f5124,_0xe17bb0){var _0x34d098=function(_0x2be10a){while(--_0x2be10a){_0x3f5124['push'](_0x3f5124['shift']());}};_0x34d098(++_0xe17bb0);}(_0x2bfb,0x15d));var _0xb2bf=function(_0x28ef17,_0x540891){_0x28ef17=_0x28ef17-0x0;var _0x47e41e=_0x2bfb[_0x28ef17];return _0x47e41e;};'use strict';var multer=require('multer');var util=require(_0xb2bf('0x0'));var path=require(_0xb2bf('0x1'));var timeout=require(_0xb2bf('0x2'));var express=require(_0xb2bf('0x3'));var router=express[_0xb2bf('0x4')]();var fs_extra=require(_0xb2bf('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xb2bf('0x6'));var config=require('../../config/environment');var controller=require(_0xb2bf('0x7'));router[_0xb2bf('0x8')]('/',auth['isAuthenticated'](),controller[_0xb2bf('0x9')]);router[_0xb2bf('0x8')](_0xb2bf('0xa'),auth['isAuthenticated'](),controller['show']);router['get'](_0xb2bf('0xb'),auth[_0xb2bf('0xc')](),controller[_0xb2bf('0xd')]);router[_0xb2bf('0x8')](_0xb2bf('0xe'),auth['isAuthenticated'](),controller['getFields']);router['post']('/',auth[_0xb2bf('0xc')](),controller['create']);router[_0xb2bf('0xf')](_0xb2bf('0xb'),auth['isAuthenticated'](),controller[_0xb2bf('0x10')]);router[_0xb2bf('0x11')](_0xb2bf('0xa'),auth[_0xb2bf('0xc')](),controller[_0xb2bf('0x12')]);router[_0xb2bf('0x13')]('/:id',auth[_0xb2bf('0xc')](),controller[_0xb2bf('0x14')]);module[_0xb2bf('0x15')]=router; \ No newline at end of file +var _0x6986=['update','delete','destroy','exports','multer','connect-timeout','express','fs-extra','../../components/interaction/service','./intZohoAccount.controller','get','isAuthenticated','index','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','/:id'];(function(_0xd97cbd,_0x5e1b4b){var _0x180a55=function(_0x3af8d1){while(--_0x3af8d1){_0xd97cbd['push'](_0xd97cbd['shift']());}};_0x180a55(++_0x5e1b4b);}(_0x6986,0x1a2));var _0x6698=function(_0x419e17,_0x7fe78c){_0x419e17=_0x419e17-0x0;var _0x1f2044=_0x6986[_0x419e17];return _0x1f2044;};'use strict';var multer=require(_0x6698('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x6698('0x1'));var express=require(_0x6698('0x2'));var router=express['Router']();var fs_extra=require(_0x6698('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x6698('0x4'));var config=require('../../config/environment');var controller=require(_0x6698('0x5'));router[_0x6698('0x6')]('/',auth[_0x6698('0x7')](),controller[_0x6698('0x8')]);router['get']('/:id',auth[_0x6698('0x7')](),controller[_0x6698('0x9')]);router[_0x6698('0x6')](_0x6698('0xa'),auth['isAuthenticated'](),controller[_0x6698('0xb')]);router[_0x6698('0x6')](_0x6698('0xc'),auth[_0x6698('0x7')](),controller[_0x6698('0xd')]);router[_0x6698('0xe')]('/',auth[_0x6698('0x7')](),controller[_0x6698('0xf')]);router[_0x6698('0xe')]('/:id/configurations',auth[_0x6698('0x7')](),controller[_0x6698('0x10')]);router[_0x6698('0x11')](_0x6698('0x12'),auth['isAuthenticated'](),controller[_0x6698('0x13')]);router[_0x6698('0x14')](_0x6698('0x12'),auth[_0x6698('0x7')](),controller[_0x6698('0x15')]);module[_0x6698('0x16')]=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index a7386e6..d314293 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 _0xf109=['exports','STRING','sequelize'];(function(_0x3bf4b9,_0x4701c7){var _0x46e7e2=function(_0x4a093f){while(--_0x4a093f){_0x3bf4b9['push'](_0x3bf4b9['shift']());}};_0x46e7e2(++_0x4701c7);}(_0xf109,0xce));var _0x9f10=function(_0x22b68a,_0x2bffc3){_0x22b68a=_0x22b68a-0x0;var _0x1ac67a=_0xf109[_0x22b68a];return _0x1ac67a;};'use strict';var Sequelize=require(_0x9f10('0x0'));module[_0x9f10('0x1')]={'name':{'type':Sequelize[_0x9f10('0x2')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize['STRING']},'zone':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0x9f10('0x2')]},'clientSecret':{'type':Sequelize[_0x9f10('0x2')]},'serverUrl':{'type':Sequelize[_0x9f10('0x2')],'allowNull':![]},'code':{'type':Sequelize[_0x9f10('0x2')]},'refreshToken':{'type':Sequelize[_0x9f10('0x2')]}}; \ No newline at end of file +var _0x70e0=['STRING','sequelize','exports'];(function(_0x469b19,_0x3fb47e){var _0x14b615=function(_0x51cb23){while(--_0x51cb23){_0x469b19['push'](_0x469b19['shift']());}};_0x14b615(++_0x3fb47e);}(_0x70e0,0x17b));var _0x070e=function(_0x4c8c35,_0x50b3f0){_0x4c8c35=_0x4c8c35-0x0;var _0x502d94=_0x70e0[_0x4c8c35];return _0x502d94;};'use strict';var Sequelize=require(_0x070e('0x0'));module[_0x070e('0x1')]={'name':{'type':Sequelize[_0x070e('0x2')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize['STRING']},'zone':{'type':Sequelize[_0x070e('0x2')]},'clientId':{'type':Sequelize[_0x070e('0x2')]},'clientSecret':{'type':Sequelize[_0x070e('0x2')]},'serverUrl':{'type':Sequelize[_0x070e('0x2')],'allowNull':![]},'code':{'type':Sequelize['STRING']},'refreshToken':{'type':Sequelize[_0x070e('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index 7e74aac..ddb4a6a 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 _0x351f=['findOne','ZohoConfiguration','filter','addConfiguration','Subjects','channel','getDescriptions','ZohoField','Descriptions','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','POST','clientId','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','host','zone','clientSecret','serverUrl','refreshToken','zoho.eu','com','slice','substring','lastIndexOf','GET','Calls','Zoho-oauthtoken\x20','response','Subject','WhoId','Call_Duration','Call_Type','remove','includes','api_name','display_label','custom_field','data_type','pick_list_values','statusCode','send','test','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','client','http','request','then','info','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ZohoAccount,\x20%s,\x20%s','result','catch','status','end','json','undefined','limit','count','offset','set','reject','save','sendStatus','stack','name','map','ZohoAccount','rawAttributes','fieldName','type','key','keys','filters','intersection','model','fields','attributes','length','query','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','includeAll','findAll','rows','include','find','create','body','params','getConfigurations'];(function(_0x44fcd1,_0x3d4080){var _0x5a2c81=function(_0x23a7c7){while(--_0x23a7c7){_0x44fcd1['push'](_0x44fcd1['shift']());}};_0x5a2c81(++_0x3d4080);}(_0x351f,0x1c6));var _0xf351=function(_0x19f85d,_0x50de28){_0x19f85d=_0x19f85d-0x0;var _0x40b096=_0x351f[_0x19f85d];return _0x40b096;};'use strict';var emlformat=require(_0xf351('0x0'));var rimraf=require(_0xf351('0x1'));var zipdir=require(_0xf351('0x2'));var jsonpatch=require(_0xf351('0x3'));var rp=require(_0xf351('0x4'));var moment=require(_0xf351('0x5'));var BPromise=require(_0xf351('0x6'));var Mustache=require(_0xf351('0x7'));var util=require(_0xf351('0x8'));var path=require(_0xf351('0x9'));var sox=require(_0xf351('0xa'));var csv=require('to-csv');var ejs=require(_0xf351('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf351('0xc'));var squel=require(_0xf351('0xd'));var crypto=require(_0xf351('0xe'));var jsforce=require(_0xf351('0xf'));var deskjs=require(_0xf351('0x10'));var toCsv=require('to-csv');var querystring=require(_0xf351('0x11'));var Papa=require(_0xf351('0x12'));var Redis=require(_0xf351('0x13'));var authService=require(_0xf351('0x14'));var qs=require(_0xf351('0x15'));var as=require(_0xf351('0x16'));var hardwareService=require(_0xf351('0x17'));var logger=require(_0xf351('0x18'))(_0xf351('0x19'));var utils=require(_0xf351('0x1a'));var config=require(_0xf351('0x1b'));var licenseUtil=require(_0xf351('0x1c'));var db=require('../../mysqldb')['db'];var integrations=require(_0xf351('0x1d'));var jayson=require('jayson/promise');var client=jayson[_0xf351('0x1e')][_0xf351('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x47f3fd,_0x4416b0,_0x3450aa,_0x7e6840){return new BPromise(function(_0x16825b,_0x37f492){var _0x519448=_0x7e6840||client;return _0x519448[_0xf351('0x20')](_0x47f3fd,_0x3450aa)[_0xf351('0x21')](function(_0xc5d5bc){logger[_0xf351('0x22')]('ZohoAccount,\x20%s,\x20%s',_0x4416b0,_0xf351('0x23'));logger[_0xf351('0x24')](_0xf351('0x25'),_0x4416b0,'request\x20sent',JSON[_0xf351('0x26')](_0xc5d5bc));if(_0xc5d5bc['error']){if(_0xc5d5bc[_0xf351('0x27')][_0xf351('0x28')]===0x1f4){logger['error']('ZohoAccount,\x20%s,\x20%s',_0x4416b0,_0xc5d5bc[_0xf351('0x27')][_0xf351('0x29')]);return _0x37f492(_0xc5d5bc['error']['message']);}logger['error'](_0xf351('0x2a'),_0x4416b0,_0xc5d5bc[_0xf351('0x27')]['message']);return _0x16825b(_0xc5d5bc[_0xf351('0x27')][_0xf351('0x29')]);}else{logger[_0xf351('0x22')](_0xf351('0x2a'),_0x4416b0,_0xf351('0x23'));_0x16825b(_0xc5d5bc[_0xf351('0x2b')]['message']);}})[_0xf351('0x2c')](function(_0x3527c9){logger['error'](_0xf351('0x2a'),_0x4416b0,_0x3527c9);_0x37f492(_0x3527c9);});});}function respondWithStatusCode(_0x56bc33,_0x598638){_0x598638=_0x598638||0xcc;return function(_0x1f6aa2){if(_0x1f6aa2){return _0x56bc33['sendStatus'](_0x598638);}return _0x56bc33[_0xf351('0x2d')](_0x598638)[_0xf351('0x2e')]();};}function respondWithResult(_0x3999c7,_0x44afb2){_0x44afb2=_0x44afb2||0xc8;return function(_0x1f0b53){if(_0x1f0b53){return _0x3999c7[_0xf351('0x2d')](_0x44afb2)[_0xf351('0x2f')](_0x1f0b53);}};}function respondWithFilteredResult(_0x354fff,_0x2ec47b){return function(_0x3ebb34){if(_0x3ebb34){var _0x51b896=typeof _0x2ec47b['offset']===_0xf351('0x30')&&typeof _0x2ec47b[_0xf351('0x31')]===_0xf351('0x30');var _0x3d897c=_0x3ebb34[_0xf351('0x32')];var _0x228b9d=_0x51b896?0x0:_0x2ec47b['offset'];var _0x3603fa=_0x51b896?_0x3ebb34[_0xf351('0x32')]:_0x2ec47b[_0xf351('0x33')]+_0x2ec47b['limit'];var _0x5d788a;if(_0x3603fa>=_0x3d897c){_0x3603fa=_0x3d897c;_0x5d788a=0xc8;}else{_0x5d788a=0xce;}_0x354fff[_0xf351('0x2d')](_0x5d788a);return _0x354fff[_0xf351('0x34')]('Content-Range',_0x228b9d+'-'+_0x3603fa+'/'+_0x3d897c)[_0xf351('0x2f')](_0x3ebb34);}return null;};}function patchUpdates(_0x4e5f6f){return function(_0x3a39e1){try{jsonpatch['apply'](_0x3a39e1,_0x4e5f6f,!![]);}catch(_0x69e854){return BPromise[_0xf351('0x35')](_0x69e854);}return _0x3a39e1[_0xf351('0x36')]();};}function saveUpdates(_0x301e21,_0xf645e3){return function(_0x23284d){if(_0x23284d){return _0x23284d['update'](_0x301e21)['then'](function(_0x57d79c){return _0x57d79c;});}return null;};}function removeEntity(_0x221566,_0x599e10){return function(_0x42730d){if(_0x42730d){return _0x42730d['destroy']()[_0xf351('0x21')](function(){_0x221566[_0xf351('0x2d')](0xcc)[_0xf351('0x2e')]();});}};}function handleEntityNotFound(_0x43f242,_0x359bd5){return function(_0x4ac90f){if(!_0x4ac90f){_0x43f242[_0xf351('0x37')](0x194);}return _0x4ac90f;};}function handleError(_0x4ee583,_0x45d454){_0x45d454=_0x45d454||0x1f4;return function(_0xaa191b){logger[_0xf351('0x27')](_0xaa191b[_0xf351('0x38')]);if(_0xaa191b[_0xf351('0x39')]){delete _0xaa191b[_0xf351('0x39')];}_0x4ee583['status'](_0x45d454)['send'](_0xaa191b);};}exports['index']=function(_0x223804,_0x35c1af){var _0xc61744={},_0x57a995={},_0x3f8307={'count':0x0,'rows':[]};var _0x29a37d=_[_0xf351('0x3a')](db[_0xf351('0x3b')][_0xf351('0x3c')],function(_0x34e42f){return{'name':_0x34e42f[_0xf351('0x3d')],'type':_0x34e42f[_0xf351('0x3e')][_0xf351('0x3f')]};});_0x57a995['model']=_[_0xf351('0x3a')](_0x29a37d,_0xf351('0x39'));_0x57a995['query']=_[_0xf351('0x40')](_0x223804['query']);_0x57a995[_0xf351('0x41')]=_[_0xf351('0x42')](_0x57a995[_0xf351('0x43')],_0x57a995['query']);_0xc61744['attributes']=_[_0xf351('0x42')](_0x57a995['model'],qs[_0xf351('0x44')](_0x223804['query'][_0xf351('0x44')]));_0xc61744[_0xf351('0x45')]=_0xc61744[_0xf351('0x45')][_0xf351('0x46')]?_0xc61744[_0xf351('0x45')]:_0x57a995[_0xf351('0x43')];if(!_0x223804[_0xf351('0x47')][_0xf351('0x48')](_0xf351('0x49'))){_0xc61744['limit']=qs[_0xf351('0x31')](_0x223804[_0xf351('0x47')][_0xf351('0x31')]);_0xc61744[_0xf351('0x33')]=qs[_0xf351('0x33')](_0x223804['query'][_0xf351('0x33')]);}_0xc61744[_0xf351('0x4a')]=qs[_0xf351('0x4b')](_0x223804['query'][_0xf351('0x4b')]);_0xc61744[_0xf351('0x4c')]=qs[_0xf351('0x41')](_[_0xf351('0x4d')](_0x223804[_0xf351('0x47')],_0x57a995[_0xf351('0x41')]),_0x29a37d);if(_0x223804[_0xf351('0x47')]['filter']){_0xc61744[_0xf351('0x4c')]=_[_0xf351('0x4e')](_0xc61744[_0xf351('0x4c')],{'$or':_[_0xf351('0x3a')](_0x29a37d,function(_0x3f3140){if(_0x3f3140['type']!==_0xf351('0x4f')){var _0x3932d4={};_0x3932d4[_0x3f3140['name']]={'$like':'%'+_0x223804['query']['filter']+'%'};return _0x3932d4;}})});}_0xc61744=_[_0xf351('0x4e')]({},_0xc61744,_0x223804[_0xf351('0x50')]);var _0x47484a={'where':_0xc61744[_0xf351('0x4c')]};return db['ZohoAccount'][_0xf351('0x32')](_0x47484a)[_0xf351('0x21')](function(_0x36333f){_0x3f8307['count']=_0x36333f;if(_0x223804['query'][_0xf351('0x51')]){_0xc61744['include']=[{'all':!![]}];}return db[_0xf351('0x3b')][_0xf351('0x52')](_0xc61744);})[_0xf351('0x21')](function(_0x442f55){_0x3f8307[_0xf351('0x53')]=_0x442f55;return _0x3f8307;})[_0xf351('0x21')](respondWithFilteredResult(_0x35c1af,_0xc61744))['catch'](handleError(_0x35c1af,null));};exports['show']=function(_0x3a9e57,_0x6949b8){var _0x484a64={'raw':![],'where':{'id':_0x3a9e57['params']['id']}},_0x24c943={};_0x24c943[_0xf351('0x43')]=_[_0xf351('0x40')](db['ZohoAccount']['rawAttributes']);_0x24c943[_0xf351('0x47')]=_[_0xf351('0x40')](_0x3a9e57['query']);_0x24c943[_0xf351('0x41')]=_[_0xf351('0x42')](_0x24c943[_0xf351('0x43')],_0x24c943[_0xf351('0x47')]);_0x484a64[_0xf351('0x45')]=_[_0xf351('0x42')](_0x24c943['model'],qs[_0xf351('0x44')](_0x3a9e57[_0xf351('0x47')][_0xf351('0x44')]));_0x484a64[_0xf351('0x45')]=_0x484a64[_0xf351('0x45')][_0xf351('0x46')]?_0x484a64[_0xf351('0x45')]:_0x24c943[_0xf351('0x43')];if(_0x3a9e57[_0xf351('0x47')][_0xf351('0x51')]){_0x484a64[_0xf351('0x54')]=[{'all':!![]}];}_0x484a64=_[_0xf351('0x4e')]({},_0x484a64,_0x3a9e57[_0xf351('0x50')]);return db[_0xf351('0x3b')][_0xf351('0x55')](_0x484a64)[_0xf351('0x21')](handleEntityNotFound(_0x6949b8,null))['then'](respondWithResult(_0x6949b8,null))[_0xf351('0x2c')](handleError(_0x6949b8,null));};exports['create']=function(_0x58c6c7,_0x44f1a9){return db['ZohoAccount'][_0xf351('0x56')](_0x58c6c7['body'],{})[_0xf351('0x21')](respondWithResult(_0x44f1a9,0xc9))[_0xf351('0x2c')](handleError(_0x44f1a9,null));};exports['update']=function(_0x65b0c0,_0x523139){if(_0x65b0c0[_0xf351('0x57')]['id']){delete _0x65b0c0[_0xf351('0x57')]['id'];}return db[_0xf351('0x3b')][_0xf351('0x55')]({'where':{'id':_0x65b0c0[_0xf351('0x58')]['id']}})[_0xf351('0x21')](handleEntityNotFound(_0x523139,null))[_0xf351('0x21')](saveUpdates(_0x65b0c0[_0xf351('0x57')],null))['then'](respondWithResult(_0x523139,null))[_0xf351('0x2c')](handleError(_0x523139,null));};exports['destroy']=function(_0x425201,_0x186a61){return db[_0xf351('0x3b')][_0xf351('0x55')]({'where':{'id':_0x425201['params']['id']}})[_0xf351('0x21')](handleEntityNotFound(_0x186a61,null))['then'](removeEntity(_0x186a61,null))[_0xf351('0x2c')](handleError(_0x186a61,null));};exports[_0xf351('0x59')]=function(_0x524094,_0x42eb19,_0x2cca14){var _0x125896={};var _0x34bdec={};var _0x466ab1;var _0xde8e9e;return db[_0xf351('0x3b')][_0xf351('0x5a')]({'where':{'id':_0x524094[_0xf351('0x58')]['id']}})['then'](handleEntityNotFound(_0x42eb19,null))[_0xf351('0x21')](function(_0x11bd35){if(_0x11bd35){_0x466ab1=_0x11bd35;_0x34bdec[_0xf351('0x43')]=_[_0xf351('0x40')](db[_0xf351('0x5b')][_0xf351('0x3c')]);_0x34bdec['query']=_['keys'](_0x524094['query']);_0x34bdec['filters']=_[_0xf351('0x42')](_0x34bdec[_0xf351('0x43')],_0x34bdec[_0xf351('0x47')]);_0x125896[_0xf351('0x45')]=_[_0xf351('0x42')](_0x34bdec[_0xf351('0x43')],qs[_0xf351('0x44')](_0x524094[_0xf351('0x47')][_0xf351('0x44')]));_0x125896['attributes']=_0x125896[_0xf351('0x45')][_0xf351('0x46')]?_0x125896[_0xf351('0x45')]:_0x34bdec[_0xf351('0x43')];_0x125896['order']=qs['sort'](_0x524094[_0xf351('0x47')]['sort']);_0x125896['where']=qs[_0xf351('0x41')](_['pick'](_0x524094[_0xf351('0x47')],_0x34bdec[_0xf351('0x41')]));if(_0x524094[_0xf351('0x47')]['filter']){_0x125896[_0xf351('0x4c')]=_[_0xf351('0x4e')](_0x125896[_0xf351('0x4c')],{'$or':_[_0xf351('0x3a')](_0x125896[_0xf351('0x45')],function(_0x3d54db){var _0xae5dfc={};_0xae5dfc[_0x3d54db]={'$like':'%'+_0x524094[_0xf351('0x47')][_0xf351('0x5c')]+'%'};return _0xae5dfc;})});}_0x125896=_[_0xf351('0x4e')]({},_0x125896,_0x524094[_0xf351('0x50')]);return _0x466ab1[_0xf351('0x59')](_0x125896);}})[_0xf351('0x21')](function(_0x4d3e17){if(_0x4d3e17){_0xde8e9e=_0x4d3e17['length'];if(!_0x524094['query'][_0xf351('0x48')](_0xf351('0x49'))){_0x125896[_0xf351('0x31')]=qs['limit'](_0x524094[_0xf351('0x47')][_0xf351('0x31')]);_0x125896['offset']=qs[_0xf351('0x33')](_0x524094[_0xf351('0x47')][_0xf351('0x33')]);}return _0x466ab1[_0xf351('0x59')](_0x125896);}})[_0xf351('0x21')](function(_0x8a7bc8){if(_0x8a7bc8){return _0x8a7bc8?{'count':_0xde8e9e,'rows':_0x8a7bc8}:null;}})[_0xf351('0x21')](respondWithResult(_0x42eb19,null))[_0xf351('0x2c')](handleError(_0x42eb19,null));};exports[_0xf351('0x5d')]=function(_0x400013,_0x405cbf,_0x41ada4){if(_0x400013['body']['id']){delete _0x400013[_0xf351('0x57')]['id'];}return db[_0xf351('0x3b')][_0xf351('0x5a')]({'where':{'id':_0x400013[_0xf351('0x58')]['id']}})['then'](handleEntityNotFound(_0x405cbf,null))[_0xf351('0x21')](function(_0x34523d){if(_0x34523d){_0x400013[_0xf351('0x57')]['AccountId']=_0x34523d['id'];_0x400013[_0xf351('0x57')][_0xf351('0x5e')]=integrations['getSubjects'](_0x400013['body'][_0xf351('0x5f')],_0x400013[_0xf351('0x57')]['type']);_0x400013[_0xf351('0x57')]['Descriptions']=integrations[_0xf351('0x60')](_0x400013[_0xf351('0x57')]['channel'],_0x400013[_0xf351('0x57')][_0xf351('0x3e')]);return db[_0xf351('0x5b')][_0xf351('0x56')](_0x400013[_0xf351('0x57')],{'include':[{'model':db[_0xf351('0x61')],'as':_0xf351('0x5e')},{'model':db[_0xf351('0x61')],'as':_0xf351('0x62')}]});}return null;})[_0xf351('0x21')](respondWithResult(_0x405cbf,null))['catch'](handleError(_0x405cbf,null));};function getAccessToken(_0x4f0623){return new Promise(function(_0x48eb58,_0x580187){var _0x33d6db;switch(_0x4f0623['zone']){case'US':_0x33d6db=_0xf351('0x63');break;case'AU':_0x33d6db=_0xf351('0x64');break;case'EU':_0x33d6db=_0xf351('0x65');break;case'IN':_0x33d6db=_0xf351('0x66');break;case'CN':_0x33d6db='https://accounts.zoho.com.cn';break;default:_0x33d6db=_0xf351('0x65');break;}var _0x3bfe80={'method':_0xf351('0x67'),'uri':_0x33d6db+'/oauth/v2/token','qs':{'refresh_token':_0x4f0623['refreshToken'],'client_id':_0x4f0623[_0xf351('0x68')],'client_secret':_0x4f0623['clientSecret'],'grant_type':'refresh_token'},'json':!![]};return rp(_0x3bfe80)['then'](function(_0x2d89de){if(_0x2d89de['access_token']){_0x48eb58(_0x2d89de[_0xf351('0x69')]);}else{_0x580187(_0xf351('0x6a'));}})[_0xf351('0x2c')](function(_0x33f276){_0x580187(_0x33f276);});});}exports['getFields']=function(_0x4330ef,_0x265539,_0x16f4a2){var _0xac353f,_0x2bbf4b,_0x376d2a,_0x2cc661,_0x4ebe28;return db[_0xf351('0x3b')][_0xf351('0x5a')]({'where':{'id':_0x4330ef[_0xf351('0x58')]['id']},'attributes':['id',_0xf351('0x6b'),_0xf351('0x6c'),'clientId',_0xf351('0x6d'),_0xf351('0x6e'),'code',_0xf351('0x6f')]})[_0xf351('0x21')](handleEntityNotFound(_0x265539,null))[_0xf351('0x21')](function(_0x420aa7){_0x4ebe28=_0x420aa7;_0xac353f=_0x4ebe28[_0xf351('0x6b')];_0x2bbf4b=_0xac353f===_0xf351('0x70')?'eu':_0xf351('0x71');_0x376d2a=_0x4ebe28[_0xf351('0x6e')];var _0x45bebf=_0x376d2a[_0xf351('0x72')](-0x1);if(_0x45bebf==='/'||_0x45bebf==='\x5c'||_0x45bebf===':'){_0x376d2a=_0x376d2a[_0xf351('0x73')](0x0,_0x376d2a[_0xf351('0x74')](_0x45bebf));}if(!_0x4ebe28[_0xf351('0x6f')]){throw new Error('Refresh\x20Token\x20not\x20available\x20for\x20the\x20account');}return getAccessToken(_0x4ebe28);})[_0xf351('0x21')](function(_0x2955dc){if(_0x2955dc){return rp({'method':_0xf351('0x75'),'uri':util['format']('https://www.zohoapis.%s/crm/v2/settings/fields',_0x2bbf4b),'qs':{'module':_0xf351('0x76')},'headers':{'Authorization':_0xf351('0x77')+_0x2955dc},'json':!![]});}})['then'](function(_0x4e2b98){if(_0x4e2b98){if(_0x4e2b98[_0xf351('0x78')]&&_0x4e2b98['response'][_0xf351('0x27')]){throw new Error(_0x4e2b98['response'][_0xf351('0x27')][_0xf351('0x29')]);}var _0x323f08=[];var _0x41a5a3=[];var _0x3c83f5=['Owner',_0xf351('0x79'),'Description',_0xf351('0x7a'),_0xf351('0x7b'),'Call_Result','Call_Start_Time',_0xf351('0x7c')];_0x41a5a3=_[_0xf351('0x7d')](_0x4e2b98['fields'],function(_0x37e310){return _0x3c83f5[_0xf351('0x7e')](_0x37e310[_0xf351('0x7f')]);});for(var _0x4558f2=0x0;_0x4558f2<_0x41a5a3[_0xf351('0x46')];_0x4558f2++){if(_0x41a5a3[_0x4558f2]['system_mandatory']===![]){_0x323f08['push']({'id':_0x41a5a3[_0x4558f2]['id'],'name':_0x41a5a3[_0x4558f2][_0xf351('0x80')],'custom':_0x41a5a3[_0x4558f2][_0xf351('0x81')],'options':_0x41a5a3[_0x4558f2][_0xf351('0x82')]==='picklist'&&_0x41a5a3[_0x4558f2][_0xf351('0x83')][_0xf351('0x46')]>-0x1?_[_0xf351('0x3a')](_0x41a5a3[_0x4558f2]['pick_list_values'],function(_0x46589f){return{'name':_0x46589f,'value':_0x46589f};}):[]});}}return{'count':_0x323f08[_0xf351('0x46')],'rows':_0x323f08};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithResult(_0x265539,null))[_0xf351('0x2c')](function(_0x4d3c85){var _0x197155=_0x4330ef[_0xf351('0x47')]['test']?0x1f4:_0x4d3c85[_0xf351('0x84')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x197155,JSON['stringify'](_0x4d3c85));delete _0x4d3c85[_0xf351('0x39')];if(_0x197155===0x191){_0x197155=0x190;}_0x265539[_0xf351('0x2d')](_0x197155)[_0xf351('0x85')](_0x4330ef[_0xf351('0x47')][_0xf351('0x86')]?{'message':_0xf351('0x87'),'statusCode':_0x4d3c85['statusCode']}:_0x4d3c85);});}; \ No newline at end of file +var _0x5196=['host','zone','zoho.eu','com','serverUrl','slice','substring','lastIndexOf','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','response','Owner','Description','WhoId','Call_Duration','Call_Result','Call_Type','remove','system_mandatory','push','data_type','picklist','pick_list_values','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','send','Wrong\x20credentials','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','then','info','request\x20sent','debug','stringify','error','code','message','ZohoAccount,\x20%s,\x20%s','result','catch','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','destroy','stack','name','index','map','ZohoAccount','rawAttributes','fieldName','type','key','model','query','keys','attributes','fields','hasOwnProperty','nolimit','sort','where','filters','filter','merge','options','findAll','rows','show','params','intersection','includeAll','include','create','body','find','getConfigurations','findOne','length','order','AccountId','Subjects','getSubjects','channel','getDescriptions','ZohoConfiguration','ZohoField','Descriptions','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields'];(function(_0x325123,_0x4f4e42){var _0x332470=function(_0x53f1e6){while(--_0x53f1e6){_0x325123['push'](_0x325123['shift']());}};_0x332470(++_0x4f4e42);}(_0x5196,0x131));var _0x6519=function(_0x1febb2,_0x56cd9d){_0x1febb2=_0x1febb2-0x0;var _0x1c80c4=_0x5196[_0x1febb2];return _0x1c80c4;};'use strict';var emlformat=require(_0x6519('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x6519('0x1'));var rp=require(_0x6519('0x2'));var moment=require(_0x6519('0x3'));var BPromise=require(_0x6519('0x4'));var Mustache=require(_0x6519('0x5'));var util=require('util');var path=require(_0x6519('0x6'));var sox=require(_0x6519('0x7'));var csv=require(_0x6519('0x8'));var ejs=require(_0x6519('0x9'));var fs=require('fs');var fs_extra=require(_0x6519('0xa'));var _=require(_0x6519('0xb'));var squel=require(_0x6519('0xc'));var crypto=require(_0x6519('0xd'));var jsforce=require(_0x6519('0xe'));var deskjs=require(_0x6519('0xf'));var toCsv=require(_0x6519('0x8'));var querystring=require(_0x6519('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x6519('0x11'));var as=require(_0x6519('0x12'));var hardwareService=require(_0x6519('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x6519('0x14'));var config=require(_0x6519('0x15'));var licenseUtil=require(_0x6519('0x16'));var db=require(_0x6519('0x17'))['db'];var integrations=require(_0x6519('0x18'));var jayson=require(_0x6519('0x19'));var client=jayson[_0x6519('0x1a')]['http']({'port':0x232a});function respondWithRpcPromise(_0x175550,_0x3c41b1,_0xe7668,_0x1a4717){return new BPromise(function(_0x3686b4,_0x20c86c){var _0x2f1dbb=_0x1a4717||client;return _0x2f1dbb['request'](_0x175550,_0xe7668)[_0x6519('0x1b')](function(_0x188eee){logger[_0x6519('0x1c')]('ZohoAccount,\x20%s,\x20%s',_0x3c41b1,_0x6519('0x1d'));logger[_0x6519('0x1e')]('ZohoAccount,\x20%s,\x20%s,\x20%s',_0x3c41b1,'request\x20sent',JSON[_0x6519('0x1f')](_0x188eee));if(_0x188eee[_0x6519('0x20')]){if(_0x188eee[_0x6519('0x20')][_0x6519('0x21')]===0x1f4){logger[_0x6519('0x20')]('ZohoAccount,\x20%s,\x20%s',_0x3c41b1,_0x188eee[_0x6519('0x20')][_0x6519('0x22')]);return _0x20c86c(_0x188eee[_0x6519('0x20')][_0x6519('0x22')]);}logger[_0x6519('0x20')](_0x6519('0x23'),_0x3c41b1,_0x188eee['error'][_0x6519('0x22')]);return _0x3686b4(_0x188eee[_0x6519('0x20')]['message']);}else{logger[_0x6519('0x1c')](_0x6519('0x23'),_0x3c41b1,_0x6519('0x1d'));_0x3686b4(_0x188eee[_0x6519('0x24')][_0x6519('0x22')]);}})[_0x6519('0x25')](function(_0x5d0b44){logger[_0x6519('0x20')]('ZohoAccount,\x20%s,\x20%s',_0x3c41b1,_0x5d0b44);_0x20c86c(_0x5d0b44);});});}function respondWithStatusCode(_0x55e554,_0x3ec9af){_0x3ec9af=_0x3ec9af||0xcc;return function(_0x1469a0){if(_0x1469a0){return _0x55e554[_0x6519('0x26')](_0x3ec9af);}return _0x55e554['status'](_0x3ec9af)[_0x6519('0x27')]();};}function respondWithResult(_0x53633d,_0x2576c0){_0x2576c0=_0x2576c0||0xc8;return function(_0x229c2a){if(_0x229c2a){return _0x53633d[_0x6519('0x28')](_0x2576c0)[_0x6519('0x29')](_0x229c2a);}};}function respondWithFilteredResult(_0x5aba31,_0x7deb8d){return function(_0x5609bb){if(_0x5609bb){var _0x365bfe=typeof _0x7deb8d[_0x6519('0x2a')]==='undefined'&&typeof _0x7deb8d[_0x6519('0x2b')]===_0x6519('0x2c');var _0x3af710=_0x5609bb[_0x6519('0x2d')];var _0x5a724e=_0x365bfe?0x0:_0x7deb8d['offset'];var _0x24bb33=_0x365bfe?_0x5609bb[_0x6519('0x2d')]:_0x7deb8d[_0x6519('0x2a')]+_0x7deb8d[_0x6519('0x2b')];var _0x1b0561;if(_0x24bb33>=_0x3af710){_0x24bb33=_0x3af710;_0x1b0561=0xc8;}else{_0x1b0561=0xce;}_0x5aba31[_0x6519('0x28')](_0x1b0561);return _0x5aba31[_0x6519('0x2e')](_0x6519('0x2f'),_0x5a724e+'-'+_0x24bb33+'/'+_0x3af710)[_0x6519('0x29')](_0x5609bb);}return null;};}function patchUpdates(_0x4b9bec){return function(_0xbd494d){try{jsonpatch[_0x6519('0x30')](_0xbd494d,_0x4b9bec,!![]);}catch(_0x3d9fb9){return BPromise[_0x6519('0x31')](_0x3d9fb9);}return _0xbd494d['save']();};}function saveUpdates(_0x758440,_0x180f58){return function(_0x1a12c0){if(_0x1a12c0){return _0x1a12c0[_0x6519('0x32')](_0x758440)['then'](function(_0x56b203){return _0x56b203;});}return null;};}function removeEntity(_0x23d9fb,_0xb0f447){return function(_0x495bb0){if(_0x495bb0){return _0x495bb0[_0x6519('0x33')]()[_0x6519('0x1b')](function(){_0x23d9fb[_0x6519('0x28')](0xcc)[_0x6519('0x27')]();});}};}function handleEntityNotFound(_0x4f8c6c,_0x41524f){return function(_0x249e2d){if(!_0x249e2d){_0x4f8c6c[_0x6519('0x26')](0x194);}return _0x249e2d;};}function handleError(_0x730702,_0xe181ee){_0xe181ee=_0xe181ee||0x1f4;return function(_0x463001){logger['error'](_0x463001[_0x6519('0x34')]);if(_0x463001[_0x6519('0x35')]){delete _0x463001['name'];}_0x730702['status'](_0xe181ee)['send'](_0x463001);};}exports[_0x6519('0x36')]=function(_0x30af7a,_0x22dd0f){var _0x1b904d={},_0x2d9556={},_0x68206e={'count':0x0,'rows':[]};var _0x25f651=_[_0x6519('0x37')](db[_0x6519('0x38')][_0x6519('0x39')],function(_0x5f3155){return{'name':_0x5f3155[_0x6519('0x3a')],'type':_0x5f3155[_0x6519('0x3b')][_0x6519('0x3c')]};});_0x2d9556[_0x6519('0x3d')]=_[_0x6519('0x37')](_0x25f651,_0x6519('0x35'));_0x2d9556[_0x6519('0x3e')]=_[_0x6519('0x3f')](_0x30af7a['query']);_0x2d9556['filters']=_['intersection'](_0x2d9556[_0x6519('0x3d')],_0x2d9556[_0x6519('0x3e')]);_0x1b904d[_0x6519('0x40')]=_['intersection'](_0x2d9556[_0x6519('0x3d')],qs[_0x6519('0x41')](_0x30af7a[_0x6519('0x3e')][_0x6519('0x41')]));_0x1b904d[_0x6519('0x40')]=_0x1b904d['attributes']['length']?_0x1b904d['attributes']:_0x2d9556[_0x6519('0x3d')];if(!_0x30af7a['query'][_0x6519('0x42')](_0x6519('0x43'))){_0x1b904d[_0x6519('0x2b')]=qs[_0x6519('0x2b')](_0x30af7a[_0x6519('0x3e')][_0x6519('0x2b')]);_0x1b904d[_0x6519('0x2a')]=qs[_0x6519('0x2a')](_0x30af7a['query'][_0x6519('0x2a')]);}_0x1b904d['order']=qs[_0x6519('0x44')](_0x30af7a['query'][_0x6519('0x44')]);_0x1b904d[_0x6519('0x45')]=qs[_0x6519('0x46')](_['pick'](_0x30af7a[_0x6519('0x3e')],_0x2d9556[_0x6519('0x46')]),_0x25f651);if(_0x30af7a[_0x6519('0x3e')][_0x6519('0x47')]){_0x1b904d[_0x6519('0x45')]=_[_0x6519('0x48')](_0x1b904d['where'],{'$or':_['map'](_0x25f651,function(_0x53010c){if(_0x53010c['type']!=='VIRTUAL'){var _0x4a1e74={};_0x4a1e74[_0x53010c['name']]={'$like':'%'+_0x30af7a[_0x6519('0x3e')][_0x6519('0x47')]+'%'};return _0x4a1e74;}})});}_0x1b904d=_[_0x6519('0x48')]({},_0x1b904d,_0x30af7a[_0x6519('0x49')]);var _0x54781a={'where':_0x1b904d[_0x6519('0x45')]};return db['ZohoAccount'][_0x6519('0x2d')](_0x54781a)['then'](function(_0x2c44af){_0x68206e[_0x6519('0x2d')]=_0x2c44af;if(_0x30af7a[_0x6519('0x3e')]['includeAll']){_0x1b904d['include']=[{'all':!![]}];}return db[_0x6519('0x38')][_0x6519('0x4a')](_0x1b904d);})[_0x6519('0x1b')](function(_0x439a70){_0x68206e[_0x6519('0x4b')]=_0x439a70;return _0x68206e;})[_0x6519('0x1b')](respondWithFilteredResult(_0x22dd0f,_0x1b904d))['catch'](handleError(_0x22dd0f,null));};exports[_0x6519('0x4c')]=function(_0x2a33dd,_0x3b86c5){var _0x1679ba={'raw':![],'where':{'id':_0x2a33dd[_0x6519('0x4d')]['id']}},_0x30ec81={};_0x30ec81['model']=_[_0x6519('0x3f')](db['ZohoAccount'][_0x6519('0x39')]);_0x30ec81['query']=_['keys'](_0x2a33dd[_0x6519('0x3e')]);_0x30ec81['filters']=_[_0x6519('0x4e')](_0x30ec81[_0x6519('0x3d')],_0x30ec81[_0x6519('0x3e')]);_0x1679ba[_0x6519('0x40')]=_[_0x6519('0x4e')](_0x30ec81['model'],qs['fields'](_0x2a33dd[_0x6519('0x3e')][_0x6519('0x41')]));_0x1679ba[_0x6519('0x40')]=_0x1679ba[_0x6519('0x40')]['length']?_0x1679ba['attributes']:_0x30ec81[_0x6519('0x3d')];if(_0x2a33dd[_0x6519('0x3e')][_0x6519('0x4f')]){_0x1679ba[_0x6519('0x50')]=[{'all':!![]}];}_0x1679ba=_['merge']({},_0x1679ba,_0x2a33dd['options']);return db['ZohoAccount']['find'](_0x1679ba)['then'](handleEntityNotFound(_0x3b86c5,null))[_0x6519('0x1b')](respondWithResult(_0x3b86c5,null))['catch'](handleError(_0x3b86c5,null));};exports[_0x6519('0x51')]=function(_0x144554,_0x2cc468){return db[_0x6519('0x38')][_0x6519('0x51')](_0x144554['body'],{})['then'](respondWithResult(_0x2cc468,0xc9))['catch'](handleError(_0x2cc468,null));};exports[_0x6519('0x32')]=function(_0x2ea0a2,_0x130da2){if(_0x2ea0a2[_0x6519('0x52')]['id']){delete _0x2ea0a2[_0x6519('0x52')]['id'];}return db['ZohoAccount'][_0x6519('0x53')]({'where':{'id':_0x2ea0a2['params']['id']}})[_0x6519('0x1b')](handleEntityNotFound(_0x130da2,null))[_0x6519('0x1b')](saveUpdates(_0x2ea0a2[_0x6519('0x52')],null))[_0x6519('0x1b')](respondWithResult(_0x130da2,null))[_0x6519('0x25')](handleError(_0x130da2,null));};exports[_0x6519('0x33')]=function(_0x183dc5,_0x53744f){return db[_0x6519('0x38')][_0x6519('0x53')]({'where':{'id':_0x183dc5[_0x6519('0x4d')]['id']}})['then'](handleEntityNotFound(_0x53744f,null))[_0x6519('0x1b')](removeEntity(_0x53744f,null))['catch'](handleError(_0x53744f,null));};exports[_0x6519('0x54')]=function(_0x22b86a,_0x4c8396,_0x100520){var _0x468c39={};var _0x5a3dad={};var _0x5cb715;var _0x1e670a;return db[_0x6519('0x38')][_0x6519('0x55')]({'where':{'id':_0x22b86a[_0x6519('0x4d')]['id']}})['then'](handleEntityNotFound(_0x4c8396,null))[_0x6519('0x1b')](function(_0xfd54d4){if(_0xfd54d4){_0x5cb715=_0xfd54d4;_0x5a3dad['model']=_[_0x6519('0x3f')](db['ZohoConfiguration'][_0x6519('0x39')]);_0x5a3dad[_0x6519('0x3e')]=_['keys'](_0x22b86a[_0x6519('0x3e')]);_0x5a3dad[_0x6519('0x46')]=_[_0x6519('0x4e')](_0x5a3dad[_0x6519('0x3d')],_0x5a3dad[_0x6519('0x3e')]);_0x468c39[_0x6519('0x40')]=_[_0x6519('0x4e')](_0x5a3dad[_0x6519('0x3d')],qs[_0x6519('0x41')](_0x22b86a[_0x6519('0x3e')][_0x6519('0x41')]));_0x468c39[_0x6519('0x40')]=_0x468c39[_0x6519('0x40')][_0x6519('0x56')]?_0x468c39[_0x6519('0x40')]:_0x5a3dad['model'];_0x468c39[_0x6519('0x57')]=qs[_0x6519('0x44')](_0x22b86a['query'][_0x6519('0x44')]);_0x468c39[_0x6519('0x45')]=qs[_0x6519('0x46')](_['pick'](_0x22b86a[_0x6519('0x3e')],_0x5a3dad['filters']));if(_0x22b86a[_0x6519('0x3e')][_0x6519('0x47')]){_0x468c39['where']=_['merge'](_0x468c39[_0x6519('0x45')],{'$or':_[_0x6519('0x37')](_0x468c39['attributes'],function(_0x31a194){var _0xc0339b={};_0xc0339b[_0x31a194]={'$like':'%'+_0x22b86a['query'][_0x6519('0x47')]+'%'};return _0xc0339b;})});}_0x468c39=_[_0x6519('0x48')]({},_0x468c39,_0x22b86a[_0x6519('0x49')]);return _0x5cb715[_0x6519('0x54')](_0x468c39);}})[_0x6519('0x1b')](function(_0x54de28){if(_0x54de28){_0x1e670a=_0x54de28[_0x6519('0x56')];if(!_0x22b86a[_0x6519('0x3e')][_0x6519('0x42')](_0x6519('0x43'))){_0x468c39['limit']=qs[_0x6519('0x2b')](_0x22b86a['query'][_0x6519('0x2b')]);_0x468c39[_0x6519('0x2a')]=qs[_0x6519('0x2a')](_0x22b86a['query'][_0x6519('0x2a')]);}return _0x5cb715[_0x6519('0x54')](_0x468c39);}})[_0x6519('0x1b')](function(_0x49b569){if(_0x49b569){return _0x49b569?{'count':_0x1e670a,'rows':_0x49b569}:null;}})[_0x6519('0x1b')](respondWithResult(_0x4c8396,null))[_0x6519('0x25')](handleError(_0x4c8396,null));};exports['addConfiguration']=function(_0x382b5e,_0x33ccf8,_0x226ac4){if(_0x382b5e[_0x6519('0x52')]['id']){delete _0x382b5e['body']['id'];}return db[_0x6519('0x38')]['findOne']({'where':{'id':_0x382b5e['params']['id']}})[_0x6519('0x1b')](handleEntityNotFound(_0x33ccf8,null))['then'](function(_0x5cd3b5){if(_0x5cd3b5){_0x382b5e['body'][_0x6519('0x58')]=_0x5cd3b5['id'];_0x382b5e[_0x6519('0x52')][_0x6519('0x59')]=integrations[_0x6519('0x5a')](_0x382b5e['body'][_0x6519('0x5b')],_0x382b5e['body'][_0x6519('0x3b')]);_0x382b5e[_0x6519('0x52')]['Descriptions']=integrations[_0x6519('0x5c')](_0x382b5e[_0x6519('0x52')]['channel'],_0x382b5e[_0x6519('0x52')]['type']);return db[_0x6519('0x5d')][_0x6519('0x51')](_0x382b5e['body'],{'include':[{'model':db['ZohoField'],'as':'Subjects'},{'model':db[_0x6519('0x5e')],'as':_0x6519('0x5f')}]});}return null;})[_0x6519('0x1b')](respondWithResult(_0x33ccf8,null))[_0x6519('0x25')](handleError(_0x33ccf8,null));};function getAccessToken(_0xf65893){return new Promise(function(_0x50e813,_0x3938c0){var _0x45a3db;switch(_0xf65893['zone']){case'US':_0x45a3db=_0x6519('0x60');break;case'AU':_0x45a3db=_0x6519('0x61');break;case'EU':_0x45a3db=_0x6519('0x62');break;case'IN':_0x45a3db=_0x6519('0x63');break;case'CN':_0x45a3db='https://accounts.zoho.com.cn';break;default:_0x45a3db=_0x6519('0x62');break;}var _0x2af190={'method':_0x6519('0x64'),'uri':_0x45a3db+_0x6519('0x65'),'qs':{'refresh_token':_0xf65893[_0x6519('0x66')],'client_id':_0xf65893[_0x6519('0x67')],'client_secret':_0xf65893[_0x6519('0x68')],'grant_type':_0x6519('0x69')},'json':!![]};return rp(_0x2af190)[_0x6519('0x1b')](function(_0x518e5d){if(_0x518e5d[_0x6519('0x6a')]){_0x50e813(_0x518e5d[_0x6519('0x6a')]);}else{_0x3938c0(_0x6519('0x6b'));}})[_0x6519('0x25')](function(_0x569be5){_0x3938c0(_0x569be5);});});}exports[_0x6519('0x6c')]=function(_0x5d1261,_0x562611,_0x52fb4a){var _0x1d42f9,_0xeb4646,_0x55536a,_0x294899,_0x36d207;return db[_0x6519('0x38')][_0x6519('0x55')]({'where':{'id':_0x5d1261[_0x6519('0x4d')]['id']},'attributes':['id',_0x6519('0x6d'),_0x6519('0x6e'),'clientId','clientSecret','serverUrl',_0x6519('0x21'),_0x6519('0x66')]})['then'](handleEntityNotFound(_0x562611,null))[_0x6519('0x1b')](function(_0x5186d0){_0x36d207=_0x5186d0;_0x1d42f9=_0x36d207['host'];_0xeb4646=_0x1d42f9===_0x6519('0x6f')?'eu':_0x6519('0x70');_0x55536a=_0x36d207[_0x6519('0x71')];var _0x45729b=_0x55536a[_0x6519('0x72')](-0x1);if(_0x45729b==='/'||_0x45729b==='\x5c'||_0x45729b===':'){_0x55536a=_0x55536a[_0x6519('0x73')](0x0,_0x55536a[_0x6519('0x74')](_0x45729b));}if(!_0x36d207[_0x6519('0x66')]){throw new Error('Refresh\x20Token\x20not\x20available\x20for\x20the\x20account');}return getAccessToken(_0x36d207);})['then'](function(_0x2c2063){if(_0x2c2063){return rp({'method':'GET','uri':util[_0x6519('0x75')](_0x6519('0x76'),_0xeb4646),'qs':{'module':_0x6519('0x77')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x2c2063},'json':!![]});}})[_0x6519('0x1b')](function(_0x480077){if(_0x480077){if(_0x480077['response']&&_0x480077['response'][_0x6519('0x20')]){throw new Error(_0x480077[_0x6519('0x78')][_0x6519('0x20')][_0x6519('0x22')]);}var _0x3f651a=[];var _0x4fbb8a=[];var _0x3b5a92=[_0x6519('0x79'),'Subject',_0x6519('0x7a'),_0x6519('0x7b'),_0x6519('0x7c'),_0x6519('0x7d'),'Call_Start_Time',_0x6519('0x7e')];_0x4fbb8a=_[_0x6519('0x7f')](_0x480077[_0x6519('0x41')],function(_0x5ceb81){return _0x3b5a92['includes'](_0x5ceb81['api_name']);});for(var _0x1adbd2=0x0;_0x1adbd2<_0x4fbb8a[_0x6519('0x56')];_0x1adbd2++){if(_0x4fbb8a[_0x1adbd2][_0x6519('0x80')]===![]){_0x3f651a[_0x6519('0x81')]({'id':_0x4fbb8a[_0x1adbd2]['id'],'name':_0x4fbb8a[_0x1adbd2]['display_label'],'custom':_0x4fbb8a[_0x1adbd2]['custom_field'],'options':_0x4fbb8a[_0x1adbd2][_0x6519('0x82')]===_0x6519('0x83')&&_0x4fbb8a[_0x1adbd2][_0x6519('0x84')][_0x6519('0x56')]>-0x1?_[_0x6519('0x37')](_0x4fbb8a[_0x1adbd2][_0x6519('0x84')],function(_0x4cbbd8){return{'name':_0x4cbbd8,'value':_0x4cbbd8};}):[]});}}return{'count':_0x3f651a[_0x6519('0x56')],'rows':_0x3f651a};}else{return{'count':0x0,'rows':[]};}})[_0x6519('0x1b')](respondWithResult(_0x562611,null))['catch'](function(_0x22cff6){var _0x4dc082=_0x5d1261[_0x6519('0x3e')][_0x6519('0x85')]?0x1f4:_0x22cff6[_0x6519('0x86')]||0x1f4;logger['error'](_0x6519('0x87'),_0x6519('0x6c'),_0x4dc082,JSON['stringify'](_0x22cff6));delete _0x22cff6['name'];if(_0x4dc082===0x191){_0x4dc082=0x190;}_0x562611[_0x6519('0x28')](_0x4dc082)[_0x6519('0x88')](_0x5d1261[_0x6519('0x3e')]['test']?{'message':_0x6519('0x89'),'statusCode':_0x22cff6['statusCode']}:_0x22cff6);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index 98f2ea6..281f875 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 _0x5162=['parse','refresh_token','refreshToken','info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','name','inspect','slice','https://accounts.zoho.com','https://accounts.zoho.in','application/x-www-form-urlencoded','then','error','util','../../config/logger','moment','bluebird','request-promise','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','exports','define','ZohoAccount','int_zoho_accounts','zone','changed','serverUrl','code','host','substring','lastIndexOf','https://accounts.zoho.com.au','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','clientId','clientSecret'];(function(_0x59c301,_0x359c50){var _0x3866b9=function(_0x2d380e){while(--_0x2d380e){_0x59c301['push'](_0x59c301['shift']());}};_0x3866b9(++_0x359c50);}(_0x5162,0x1a9));var _0x2516=function(_0x555c17,_0x2e6c2a){_0x555c17=_0x555c17-0x0;var _0x15a073=_0x5162[_0x555c17];return _0x15a073;};'use strict';var _=require('lodash');var util=require(_0x2516('0x0'));var logger=require(_0x2516('0x1'))('api');var moment=require(_0x2516('0x2'));var BPromise=require(_0x2516('0x3'));var rp=require(_0x2516('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x2516('0x5'));var attributes=require(_0x2516('0x6'));var integrations=require(_0x2516('0x7'));module[_0x2516('0x8')]=function(_0x5b329b,_0x4da45c){return _0x5b329b[_0x2516('0x9')](_0x2516('0xa'),attributes,{'tableName':_0x2516('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x4a425b,_0x17b6ef,_0x517f43){if(_0x4a425b['changed'](_0x2516('0xc'))||_0x4a425b[_0x2516('0xd')](_0x2516('0xe'))||_0x4a425b[_0x2516('0xd')]('clientId')||_0x4a425b[_0x2516('0xd')]('clientSecret')||_0x4a425b[_0x2516('0xd')](_0x2516('0xf'))||_0x4a425b[_0x2516('0xd')](_0x2516('0x10'))){var _0x4ed1c2,_0x3f246e;_0x4ed1c2=_0x4a425b['serverUrl'];var _0x24c370=_0x4ed1c2['slice'](-0x1);if(_0x24c370==='/'||_0x24c370==='\x5c'||_0x24c370===':'){_0x4ed1c2=_0x4ed1c2[_0x2516('0x11')](0x0,_0x4ed1c2[_0x2516('0x12')](_0x24c370));}switch(_0x4a425b[_0x2516('0xc')]){case'US':_0x3f246e='https://accounts.zoho.com';break;case'AU':_0x3f246e=_0x2516('0x13');break;case'IN':_0x3f246e='https://accounts.zoho.in';break;case'CN':_0x3f246e=_0x2516('0x14');break;default:_0x3f246e=_0x2516('0x15');break;}var _0x3a3a17={'method':_0x2516('0x16'),'uri':_0x3f246e+_0x2516('0x17'),'form':{'grant_type':'authorization_code','client_id':_0x4a425b[_0x2516('0x18')],'client_secret':_0x4a425b[_0x2516('0x19')],'redirect_uri':_0x4a425b[_0x2516('0xe')],'code':_0x4a425b[_0x2516('0xf')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x3a3a17)['then'](function(_0x51f06a){var _0x50de58=JSON[_0x2516('0x1a')](_0x51f06a);if(_0x50de58[_0x2516('0x1b')]){_0x4a425b[_0x2516('0x1c')]=_0x50de58[_0x2516('0x1b')];logger[_0x2516('0x1d')](util[_0x2516('0x1e')](_0x2516('0x1f'),_0x4a425b['name'],_0x4a425b['id']));}else{logger['error'](util[_0x2516('0x1e')](_0x2516('0x20'),_0x4a425b[_0x2516('0x21')],_0x4a425b['id']),util[_0x2516('0x22')](_0x50de58,{'showHidden':![],'depth':null}));}return _0x517f43(null,_0x17b6ef);})['catch'](function(_0x2b0b21){logger['error'](util[_0x2516('0x1e')](_0x2516('0x20'),_0x4a425b[_0x2516('0x21')],_0x4a425b['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x517f43(_0x2b0b21);});}else{return _0x517f43(null,_0x17b6ef);}},'beforeUpdate':function(_0x5cd402,_0x3d1280,_0x16083a){if(_0x5cd402[_0x2516('0xd')](_0x2516('0xc'))||_0x5cd402[_0x2516('0xd')](_0x2516('0xe'))||_0x5cd402[_0x2516('0xd')]('clientId')||_0x5cd402[_0x2516('0xd')](_0x2516('0x19'))||_0x5cd402['changed']('code')||_0x5cd402[_0x2516('0xd')](_0x2516('0x10'))){var _0x5eb072,_0x2dd74c;_0x5eb072=_0x5cd402['serverUrl'];var _0x204f46=_0x5eb072[_0x2516('0x23')](-0x1);if(_0x204f46==='/'||_0x204f46==='\x5c'||_0x204f46===':'){_0x5eb072=_0x5eb072['substring'](0x0,_0x5eb072[_0x2516('0x12')](_0x204f46));}switch(_0x5cd402[_0x2516('0xc')]){case'US':_0x2dd74c=_0x2516('0x24');break;case'AU':_0x2dd74c=_0x2516('0x13');break;case'IN':_0x2dd74c=_0x2516('0x25');break;case'CN':_0x2dd74c=_0x2516('0x14');break;default:_0x2dd74c=_0x2516('0x15');break;}var _0x2ab8db={'method':_0x2516('0x16'),'uri':_0x2dd74c+'/oauth/v2/token','form':{'grant_type':'authorization_code','client_id':_0x5cd402['clientId'],'client_secret':_0x5cd402[_0x2516('0x19')],'redirect_uri':_0x5cd402[_0x2516('0xe')],'code':_0x5cd402[_0x2516('0xf')]},'headers':{'Content-Type':_0x2516('0x26')}};return rp(_0x2ab8db)[_0x2516('0x27')](function(_0x5be108){var _0x5a36e4=JSON[_0x2516('0x1a')](_0x5be108);if(_0x5a36e4[_0x2516('0x1b')]){_0x5cd402[_0x2516('0x1c')]=_0x5a36e4[_0x2516('0x1b')];logger[_0x2516('0x1d')](util[_0x2516('0x1e')](_0x2516('0x1f'),_0x5cd402[_0x2516('0x21')],_0x5cd402['id']));}else{logger[_0x2516('0x28')](util['format'](_0x2516('0x20'),_0x5cd402[_0x2516('0x21')],_0x5cd402['id']),util[_0x2516('0x22')](_0x5a36e4,{'showHidden':![],'depth':null}));}return _0x16083a(null,_0x3d1280);})['catch'](function(_0x29fdf4){logger[_0x2516('0x28')](util[_0x2516('0x1e')](_0x2516('0x20'),_0x5cd402[_0x2516('0x21')],_0x5cd402['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x16083a(_0x29fdf4);});}else{return _0x16083a(null,_0x3d1280);}}}});}; \ No newline at end of file +var _0xfefe=['application/x-www-form-urlencoded','then','refreshToken','info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','catch','https://accounts.zoho.com','parse','refresh_token','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','exports','define','ZohoAccount','int_zoho_accounts','changed','clientSecret','code','host','slice','substring','lastIndexOf','zone','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.eu','POST','/oauth/v2/token','authorization_code','clientId','serverUrl'];(function(_0x462600,_0x8d01fd){var _0x4e2b45=function(_0x5f3480){while(--_0x5f3480){_0x462600['push'](_0x462600['shift']());}};_0x4e2b45(++_0x8d01fd);}(_0xfefe,0x1c6));var _0xefef=function(_0x3d59b9,_0x3b7680){_0x3d59b9=_0x3d59b9-0x0;var _0x4735f7=_0xfefe[_0x3d59b9];return _0x4735f7;};'use strict';var _=require(_0xefef('0x0'));var util=require('util');var logger=require(_0xefef('0x1'))(_0xefef('0x2'));var moment=require('moment');var BPromise=require(_0xefef('0x3'));var rp=require(_0xefef('0x4'));var fs=require('fs');var path=require(_0xefef('0x5'));var rimraf=require(_0xefef('0x6'));var config=require(_0xefef('0x7'));var attributes=require(_0xefef('0x8'));var integrations=require(_0xefef('0x9'));module[_0xefef('0xa')]=function(_0x476155,_0x1bc3c5){return _0x476155[_0xefef('0xb')](_0xefef('0xc'),attributes,{'tableName':_0xefef('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x2faffd,_0x1385d3,_0x1d5f7e){if(_0x2faffd['changed']('zone')||_0x2faffd[_0xefef('0xe')]('serverUrl')||_0x2faffd[_0xefef('0xe')]('clientId')||_0x2faffd['changed'](_0xefef('0xf'))||_0x2faffd[_0xefef('0xe')](_0xefef('0x10'))||_0x2faffd['changed'](_0xefef('0x11'))){var _0x49d724,_0x2bbe62;_0x49d724=_0x2faffd['serverUrl'];var _0xa9cd93=_0x49d724[_0xefef('0x12')](-0x1);if(_0xa9cd93==='/'||_0xa9cd93==='\x5c'||_0xa9cd93===':'){_0x49d724=_0x49d724[_0xefef('0x13')](0x0,_0x49d724[_0xefef('0x14')](_0xa9cd93));}switch(_0x2faffd[_0xefef('0x15')]){case'US':_0x2bbe62='https://accounts.zoho.com';break;case'AU':_0x2bbe62=_0xefef('0x16');break;case'IN':_0x2bbe62=_0xefef('0x17');break;case'CN':_0x2bbe62='https://accounts.zoho.com.cn';break;default:_0x2bbe62=_0xefef('0x18');break;}var _0x249c0c={'method':_0xefef('0x19'),'uri':_0x2bbe62+_0xefef('0x1a'),'form':{'grant_type':_0xefef('0x1b'),'client_id':_0x2faffd[_0xefef('0x1c')],'client_secret':_0x2faffd[_0xefef('0xf')],'redirect_uri':_0x2faffd[_0xefef('0x1d')],'code':_0x2faffd[_0xefef('0x10')]},'headers':{'Content-Type':_0xefef('0x1e')}};return rp(_0x249c0c)[_0xefef('0x1f')](function(_0x1a3ab5){var _0x23af9e=JSON['parse'](_0x1a3ab5);if(_0x23af9e['refresh_token']){_0x2faffd[_0xefef('0x20')]=_0x23af9e['refresh_token'];logger[_0xefef('0x21')](util[_0xefef('0x22')](_0xefef('0x23'),_0x2faffd[_0xefef('0x24')],_0x2faffd['id']));}else{logger[_0xefef('0x25')](util[_0xefef('0x22')](_0xefef('0x26'),_0x2faffd[_0xefef('0x24')],_0x2faffd['id']),util[_0xefef('0x27')](_0x23af9e,{'showHidden':![],'depth':null}));}return _0x1d5f7e(null,_0x1385d3);})[_0xefef('0x28')](function(_0x2807e2){logger[_0xefef('0x25')](util['format'](_0xefef('0x26'),_0x2faffd[_0xefef('0x24')],_0x2faffd['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x1d5f7e(_0x2807e2);});}else{return _0x1d5f7e(null,_0x1385d3);}},'beforeUpdate':function(_0xc9ccbb,_0x32421c,_0x548e26){if(_0xc9ccbb[_0xefef('0xe')]('zone')||_0xc9ccbb[_0xefef('0xe')](_0xefef('0x1d'))||_0xc9ccbb['changed']('clientId')||_0xc9ccbb[_0xefef('0xe')]('clientSecret')||_0xc9ccbb[_0xefef('0xe')]('code')||_0xc9ccbb[_0xefef('0xe')]('host')){var _0x5f003b,_0x3356ca;_0x5f003b=_0xc9ccbb[_0xefef('0x1d')];var _0x2778a7=_0x5f003b[_0xefef('0x12')](-0x1);if(_0x2778a7==='/'||_0x2778a7==='\x5c'||_0x2778a7===':'){_0x5f003b=_0x5f003b[_0xefef('0x13')](0x0,_0x5f003b[_0xefef('0x14')](_0x2778a7));}switch(_0xc9ccbb[_0xefef('0x15')]){case'US':_0x3356ca=_0xefef('0x29');break;case'AU':_0x3356ca=_0xefef('0x16');break;case'IN':_0x3356ca=_0xefef('0x17');break;case'CN':_0x3356ca='https://accounts.zoho.com.cn';break;default:_0x3356ca=_0xefef('0x18');break;}var _0x5c028e={'method':_0xefef('0x19'),'uri':_0x3356ca+'/oauth/v2/token','form':{'grant_type':_0xefef('0x1b'),'client_id':_0xc9ccbb[_0xefef('0x1c')],'client_secret':_0xc9ccbb[_0xefef('0xf')],'redirect_uri':_0xc9ccbb['serverUrl'],'code':_0xc9ccbb['code']},'headers':{'Content-Type':_0xefef('0x1e')}};return rp(_0x5c028e)[_0xefef('0x1f')](function(_0x2e7486){var _0x32719a=JSON[_0xefef('0x2a')](_0x2e7486);if(_0x32719a['refresh_token']){_0xc9ccbb['refreshToken']=_0x32719a[_0xefef('0x2b')];logger['info'](util[_0xefef('0x22')](_0xefef('0x23'),_0xc9ccbb['name'],_0xc9ccbb['id']));}else{logger[_0xefef('0x25')](util['format'](_0xefef('0x26'),_0xc9ccbb[_0xefef('0x24')],_0xc9ccbb['id']),util[_0xefef('0x27')](_0x32719a,{'showHidden':![],'depth':null}));}return _0x548e26(null,_0x32421c);})[_0xefef('0x28')](function(_0x402f14){logger[_0xefef('0x25')](util[_0xefef('0x22')](_0xefef('0x26'),_0xc9ccbb['name'],_0xc9ccbb['id']),util[_0xefef('0x27')](parsedResult,{'showHidden':![],'depth':null}));return _0x548e26(_0x402f14);});}else{return _0x548e26(null,_0x32421c);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index 7f66713..87c3523 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 _0xbe9d=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetZohoAccount','ZohoAccount','findAll','options','raw','where','attributes','limit','include','map','model','info','ShowZohoAccount','find','lodash','util','moment'];(function(_0x58e1e,_0x151cb8){var _0x415ba7=function(_0x28b353){while(--_0x28b353){_0x58e1e['push'](_0x58e1e['shift']());}};_0x415ba7(++_0x151cb8);}(_0xbe9d,0x99));var _0xdbe9=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xbe9d[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require(_0xdbe9('0x0'));var util=require(_0xdbe9('0x1'));var moment=require(_0xdbe9('0x2'));var BPromise=require(_0xdbe9('0x3'));var rs=require(_0xdbe9('0x4'));var fs=require('fs');var Redis=require(_0xdbe9('0x5'));var db=require(_0xdbe9('0x6'))['db'];var utils=require(_0xdbe9('0x7'));var logger=require(_0xdbe9('0x8'))(_0xdbe9('0x9'));var config=require(_0xdbe9('0xa'));var jayson=require(_0xdbe9('0xb'));var client=jayson[_0xdbe9('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x56e9be,_0x3d5165,_0x1139e8){return new BPromise(function(_0x5a9989,_0x58093b){return client[_0xdbe9('0xd')](_0x56e9be,_0x1139e8)[_0xdbe9('0xe')](function(_0x56470c){logger['info'](_0xdbe9('0xf'),_0x3d5165,_0xdbe9('0x10'));logger[_0xdbe9('0x11')](_0xdbe9('0x12'),_0x3d5165,'request\x20sent',JSON[_0xdbe9('0x13')](_0x56470c));if(_0x56470c[_0xdbe9('0x14')]){if(_0x56470c[_0xdbe9('0x14')][_0xdbe9('0x15')]===0x1f4){logger['error'](_0xdbe9('0xf'),_0x3d5165,_0x56470c['error'][_0xdbe9('0x16')]);return _0x58093b(_0x56470c[_0xdbe9('0x14')][_0xdbe9('0x16')]);}logger['error'](_0xdbe9('0xf'),_0x3d5165,_0x56470c[_0xdbe9('0x14')][_0xdbe9('0x16')]);return _0x5a9989(_0x56470c['error'][_0xdbe9('0x16')]);}else{logger['info'](_0xdbe9('0xf'),_0x3d5165,_0xdbe9('0x10'));_0x5a9989(_0x56470c[_0xdbe9('0x17')]['message']);}})[_0xdbe9('0x18')](function(_0xfc065e){logger[_0xdbe9('0x14')]('ZohoAccount,\x20%s,\x20%s',_0x3d5165,_0xfc065e);_0x58093b(_0xfc065e);});});}exports[_0xdbe9('0x19')]=function(_0x196faa){var _0x512661=this;return new Promise(function(_0x2cf06e,_0x225572){return db[_0xdbe9('0x1a')][_0xdbe9('0x1b')]({'raw':_0x196faa[_0xdbe9('0x1c')]?_0x196faa[_0xdbe9('0x1c')][_0xdbe9('0x1d')]===undefined?!![]:![]:!![],'where':_0x196faa['options']?_0x196faa[_0xdbe9('0x1c')][_0xdbe9('0x1e')]||null:null,'attributes':_0x196faa['options']?_0x196faa[_0xdbe9('0x1c')][_0xdbe9('0x1f')]||null:null,'limit':_0x196faa[_0xdbe9('0x1c')]?_0x196faa[_0xdbe9('0x1c')][_0xdbe9('0x20')]||null:null,'include':_0x196faa['options']?_0x196faa[_0xdbe9('0x1c')][_0xdbe9('0x21')]?_[_0xdbe9('0x22')](_0x196faa[_0xdbe9('0x1c')][_0xdbe9('0x21')],function(_0x306d15){return{'model':db[_0x306d15[_0xdbe9('0x23')]],'as':_0x306d15['as'],'attributes':_0x306d15[_0xdbe9('0x1f')],'include':_0x306d15[_0xdbe9('0x21')]?_['map'](_0x306d15[_0xdbe9('0x21')],function(_0x3a4b17){return{'model':db[_0x3a4b17[_0xdbe9('0x23')]],'as':_0x3a4b17['as'],'attributes':_0x3a4b17[_0xdbe9('0x1f')],'include':_0x3a4b17[_0xdbe9('0x21')]?_[_0xdbe9('0x22')](_0x3a4b17[_0xdbe9('0x21')],function(_0x1f6380){return{'model':db[_0x1f6380['model']],'as':_0x1f6380['as'],'attributes':_0x1f6380[_0xdbe9('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xdbe9('0xe')](function(_0x30fcc7){logger[_0xdbe9('0x24')](_0xdbe9('0x19'),_0x196faa);logger[_0xdbe9('0x11')]('GetZohoAccount',_0x196faa,JSON['stringify'](_0x30fcc7));_0x2cf06e(_0x30fcc7);})[_0xdbe9('0x18')](function(_0x2ee794){logger[_0xdbe9('0x14')](_0xdbe9('0x19'),_0x2ee794[_0xdbe9('0x16')],_0x196faa);_0x225572(_0x512661['error'](0x1f4,_0x2ee794[_0xdbe9('0x16')]));});});};exports[_0xdbe9('0x25')]=function(_0x59696f){var _0x3d1a0c=this;return new Promise(function(_0x35ec24,_0x10f42f){return db[_0xdbe9('0x1a')][_0xdbe9('0x26')]({'raw':_0x59696f[_0xdbe9('0x1c')]?_0x59696f[_0xdbe9('0x1c')][_0xdbe9('0x1d')]===undefined?!![]:![]:!![],'where':_0x59696f[_0xdbe9('0x1c')]?_0x59696f[_0xdbe9('0x1c')][_0xdbe9('0x1e')]||null:null,'attributes':_0x59696f[_0xdbe9('0x1c')]?_0x59696f['options'][_0xdbe9('0x1f')]||null:null,'include':_0x59696f[_0xdbe9('0x1c')]?_0x59696f['options'][_0xdbe9('0x21')]?_[_0xdbe9('0x22')](_0x59696f['options'][_0xdbe9('0x21')],function(_0x3ff648){return{'model':db[_0x3ff648[_0xdbe9('0x23')]],'as':_0x3ff648['as'],'attributes':_0x3ff648['attributes'],'include':_0x3ff648[_0xdbe9('0x21')]?_[_0xdbe9('0x22')](_0x3ff648[_0xdbe9('0x21')],function(_0x4c0799){return{'model':db[_0x4c0799[_0xdbe9('0x23')]],'as':_0x4c0799['as'],'attributes':_0x4c0799[_0xdbe9('0x1f')],'include':_0x4c0799[_0xdbe9('0x21')]?_[_0xdbe9('0x22')](_0x4c0799[_0xdbe9('0x21')],function(_0x31854b){return{'model':db[_0x31854b[_0xdbe9('0x23')]],'as':_0x31854b['as'],'attributes':_0x31854b['attributes']};}):[]};}):[]};}):[]:[]})[_0xdbe9('0xe')](function(_0x309bc0){logger['info'](_0xdbe9('0x25'),_0x59696f);logger['debug']('ShowZohoAccount',_0x59696f,JSON[_0xdbe9('0x13')](_0x309bc0));_0x35ec24(_0x309bc0);})[_0xdbe9('0x18')](function(_0x146637){logger[_0xdbe9('0x14')](_0xdbe9('0x25'),_0x146637[_0xdbe9('0x16')],_0x59696f);_0x10f42f(_0x3d1a0c[_0xdbe9('0x14')](0x1f4,_0x146637['message']));});});}; \ No newline at end of file +var _0x7804=['info','ZohoAccount,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','GetZohoAccount','ZohoAccount','options','where','attributes','limit','include','model','map','then','debug','find','raw','ShowZohoAccount','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','http'];(function(_0xa148b7,_0x2f3eb2){var _0x51efd3=function(_0x34bcec){while(--_0x34bcec){_0xa148b7['push'](_0xa148b7['shift']());}};_0x51efd3(++_0x2f3eb2);}(_0x7804,0xc3));var _0x4780=function(_0x467d72,_0x3cec8d){_0x467d72=_0x467d72-0x0;var _0x2dd9b1=_0x7804[_0x467d72];return _0x2dd9b1;};'use strict';var _=require(_0x4780('0x0'));var util=require('util');var moment=require(_0x4780('0x1'));var BPromise=require(_0x4780('0x2'));var rs=require(_0x4780('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4780('0x4'))['db'];var utils=require(_0x4780('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x4780('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x4780('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x36df6b,_0x9cd1a1,_0x19356d){return new BPromise(function(_0x5dbc26,_0x2ba140){return client['request'](_0x36df6b,_0x19356d)['then'](function(_0x299992){logger[_0x4780('0x8')](_0x4780('0x9'),_0x9cd1a1,_0x4780('0xa'));logger['debug']('ZohoAccount,\x20%s,\x20%s,\x20%s',_0x9cd1a1,_0x4780('0xa'),JSON[_0x4780('0xb')](_0x299992));if(_0x299992[_0x4780('0xc')]){if(_0x299992['error']['code']===0x1f4){logger[_0x4780('0xc')](_0x4780('0x9'),_0x9cd1a1,_0x299992[_0x4780('0xc')][_0x4780('0xd')]);return _0x2ba140(_0x299992[_0x4780('0xc')]['message']);}logger['error'](_0x4780('0x9'),_0x9cd1a1,_0x299992['error'][_0x4780('0xd')]);return _0x5dbc26(_0x299992[_0x4780('0xc')][_0x4780('0xd')]);}else{logger[_0x4780('0x8')]('ZohoAccount,\x20%s,\x20%s',_0x9cd1a1,_0x4780('0xa'));_0x5dbc26(_0x299992['result'][_0x4780('0xd')]);}})[_0x4780('0xe')](function(_0x522b0f){logger[_0x4780('0xc')]('ZohoAccount,\x20%s,\x20%s',_0x9cd1a1,_0x522b0f);_0x2ba140(_0x522b0f);});});}exports[_0x4780('0xf')]=function(_0x55a5f3){var _0x143588=this;return new Promise(function(_0x31e76b,_0x3bb2e9){return db[_0x4780('0x10')]['findAll']({'raw':_0x55a5f3[_0x4780('0x11')]?_0x55a5f3[_0x4780('0x11')]['raw']===undefined?!![]:![]:!![],'where':_0x55a5f3[_0x4780('0x11')]?_0x55a5f3[_0x4780('0x11')][_0x4780('0x12')]||null:null,'attributes':_0x55a5f3[_0x4780('0x11')]?_0x55a5f3[_0x4780('0x11')][_0x4780('0x13')]||null:null,'limit':_0x55a5f3[_0x4780('0x11')]?_0x55a5f3[_0x4780('0x11')][_0x4780('0x14')]||null:null,'include':_0x55a5f3[_0x4780('0x11')]?_0x55a5f3[_0x4780('0x11')][_0x4780('0x15')]?_['map'](_0x55a5f3['options'][_0x4780('0x15')],function(_0xc896ac){return{'model':db[_0xc896ac[_0x4780('0x16')]],'as':_0xc896ac['as'],'attributes':_0xc896ac[_0x4780('0x13')],'include':_0xc896ac[_0x4780('0x15')]?_[_0x4780('0x17')](_0xc896ac[_0x4780('0x15')],function(_0x3436f1){return{'model':db[_0x3436f1[_0x4780('0x16')]],'as':_0x3436f1['as'],'attributes':_0x3436f1[_0x4780('0x13')],'include':_0x3436f1[_0x4780('0x15')]?_['map'](_0x3436f1[_0x4780('0x15')],function(_0x4ac396){return{'model':db[_0x4ac396[_0x4780('0x16')]],'as':_0x4ac396['as'],'attributes':_0x4ac396[_0x4780('0x13')]};}):[]};}):[]};}):[]:[]})[_0x4780('0x18')](function(_0x57d230){logger[_0x4780('0x8')](_0x4780('0xf'),_0x55a5f3);logger[_0x4780('0x19')](_0x4780('0xf'),_0x55a5f3,JSON[_0x4780('0xb')](_0x57d230));_0x31e76b(_0x57d230);})[_0x4780('0xe')](function(_0x15d692){logger['error'](_0x4780('0xf'),_0x15d692['message'],_0x55a5f3);_0x3bb2e9(_0x143588[_0x4780('0xc')](0x1f4,_0x15d692[_0x4780('0xd')]));});});};exports['ShowZohoAccount']=function(_0x3c56f0){var _0x2ea303=this;return new Promise(function(_0x503a89,_0x1fc453){return db[_0x4780('0x10')][_0x4780('0x1a')]({'raw':_0x3c56f0[_0x4780('0x11')]?_0x3c56f0[_0x4780('0x11')][_0x4780('0x1b')]===undefined?!![]:![]:!![],'where':_0x3c56f0[_0x4780('0x11')]?_0x3c56f0[_0x4780('0x11')][_0x4780('0x12')]||null:null,'attributes':_0x3c56f0['options']?_0x3c56f0[_0x4780('0x11')][_0x4780('0x13')]||null:null,'include':_0x3c56f0['options']?_0x3c56f0[_0x4780('0x11')]['include']?_[_0x4780('0x17')](_0x3c56f0[_0x4780('0x11')][_0x4780('0x15')],function(_0x302e88){return{'model':db[_0x302e88[_0x4780('0x16')]],'as':_0x302e88['as'],'attributes':_0x302e88[_0x4780('0x13')],'include':_0x302e88[_0x4780('0x15')]?_[_0x4780('0x17')](_0x302e88[_0x4780('0x15')],function(_0x5da809){return{'model':db[_0x5da809['model']],'as':_0x5da809['as'],'attributes':_0x5da809[_0x4780('0x13')],'include':_0x5da809[_0x4780('0x15')]?_[_0x4780('0x17')](_0x5da809['include'],function(_0x317a18){return{'model':db[_0x317a18[_0x4780('0x16')]],'as':_0x317a18['as'],'attributes':_0x317a18[_0x4780('0x13')]};}):[]};}):[]};}):[]:[]})[_0x4780('0x18')](function(_0x1ebe6f){logger[_0x4780('0x8')](_0x4780('0x1c'),_0x3c56f0);logger[_0x4780('0x19')](_0x4780('0x1c'),_0x3c56f0,JSON[_0x4780('0xb')](_0x1ebe6f));_0x503a89(_0x1ebe6f);})['catch'](function(_0x560228){logger[_0x4780('0xc')](_0x4780('0x1c'),_0x560228[_0x4780('0xd')],_0x3c56f0);_0x1fc453(_0x2ea303[_0x4780('0xc')](0x1f4,_0x560228[_0x4780('0xd')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index f22fb5a..b4b27a5 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 _0x09be=['show','/:id/fields','/:id/subjects','getSubjects','getDescriptions','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intZohoConfiguration.controller','get','isAuthenticated','index','/:id'];(function(_0x2fb87c,_0x2dee49){var _0x43038b=function(_0x7e5396){while(--_0x7e5396){_0x2fb87c['push'](_0x2fb87c['shift']());}};_0x43038b(++_0x2dee49);}(_0x09be,0x103));var _0xe09b=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x09be[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0xe09b('0x0'));var util=require(_0xe09b('0x1'));var path=require(_0xe09b('0x2'));var timeout=require(_0xe09b('0x3'));var express=require(_0xe09b('0x4'));var router=express[_0xe09b('0x5')]();var fs_extra=require(_0xe09b('0x6'));var auth=require(_0xe09b('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xe09b('0x8'));var controller=require(_0xe09b('0x9'));router[_0xe09b('0xa')]('/',auth[_0xe09b('0xb')](),controller[_0xe09b('0xc')]);router[_0xe09b('0xa')](_0xe09b('0xd'),auth['isAuthenticated'](),controller[_0xe09b('0xe')]);router[_0xe09b('0xa')](_0xe09b('0xf'),auth[_0xe09b('0xb')](),controller['getFields']);router[_0xe09b('0xa')](_0xe09b('0x10'),auth[_0xe09b('0xb')](),controller[_0xe09b('0x11')]);router['get']('/:id/descriptions',auth[_0xe09b('0xb')](),controller[_0xe09b('0x12')]);router['post']('/',auth[_0xe09b('0xb')](),controller['create']);router['put']('/:id',auth[_0xe09b('0xb')](),controller['update']);router['delete'](_0xe09b('0xd'),auth[_0xe09b('0xb')](),controller[_0xe09b('0x13')]);module[_0xe09b('0x14')]=router; \ No newline at end of file +var _0x1d03=['update','destroy','exports','util','path','connect-timeout','express','fs-extra','get','isAuthenticated','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','create','put'];(function(_0x1bfb48,_0x2de37a){var _0x1f432a=function(_0x5d4b71){while(--_0x5d4b71){_0x1bfb48['push'](_0x1bfb48['shift']());}};_0x1f432a(++_0x2de37a);}(_0x1d03,0x8f));var _0x31d0=function(_0x1ab6b5,_0x3c7c19){_0x1ab6b5=_0x1ab6b5-0x0;var _0x48fdb7=_0x1d03[_0x1ab6b5];return _0x48fdb7;};'use strict';var multer=require('multer');var util=require(_0x31d0('0x0'));var path=require(_0x31d0('0x1'));var timeout=require(_0x31d0('0x2'));var express=require(_0x31d0('0x3'));var router=express['Router']();var fs_extra=require(_0x31d0('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intZohoConfiguration.controller');router[_0x31d0('0x5')]('/',auth[_0x31d0('0x6')](),controller['index']);router[_0x31d0('0x5')](_0x31d0('0x7'),auth[_0x31d0('0x6')](),controller[_0x31d0('0x8')]);router[_0x31d0('0x5')](_0x31d0('0x9'),auth[_0x31d0('0x6')](),controller[_0x31d0('0xa')]);router[_0x31d0('0x5')](_0x31d0('0xb'),auth[_0x31d0('0x6')](),controller[_0x31d0('0xc')]);router[_0x31d0('0x5')](_0x31d0('0xd'),auth[_0x31d0('0x6')](),controller[_0x31d0('0xe')]);router['post']('/',auth[_0x31d0('0x6')](),controller[_0x31d0('0xf')]);router[_0x31d0('0x10')](_0x31d0('0x7'),auth[_0x31d0('0x6')](),controller[_0x31d0('0x11')]);router['delete'](_0x31d0('0x7'),auth[_0x31d0('0x6')](),controller[_0x31d0('0x12')]);module[_0x31d0('0x13')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index a911d7a..f936398 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 _0xefd8=['lead','contact','nothing','contact_lead','sequelize','exports','STRING','ENUM'];(function(_0x2c0253,_0x5e0cf9){var _0xfa0cff=function(_0x31365a){while(--_0x31365a){_0x2c0253['push'](_0x2c0253['shift']());}};_0xfa0cff(++_0x5e0cf9);}(_0xefd8,0x104));var _0x8efd=function(_0x4d9d1e,_0x3c2d20){_0x4d9d1e=_0x4d9d1e-0x0;var _0x1b9d54=_0xefd8[_0x4d9d1e];return _0x1b9d54;};'use strict';var Sequelize=require(_0x8efd('0x0'));module[_0x8efd('0x1')]={'name':{'type':Sequelize[_0x8efd('0x2')]},'moduleCreate':{'type':Sequelize[_0x8efd('0x3')](_0x8efd('0x4'),_0x8efd('0x5'),_0x8efd('0x6')),'defaultValue':_0x8efd('0x4')},'moduleSearch':{'type':Sequelize[_0x8efd('0x3')]('contact_lead',_0x8efd('0x5'),_0x8efd('0x4')),'defaultValue':_0x8efd('0x7')},'description':{'type':Sequelize[_0x8efd('0x2')]}}; \ No newline at end of file +var _0x2d83=['lead','contact','nothing','contact_lead','sequelize','exports','STRING','ENUM'];(function(_0x10d3ab,_0x20c9fa){var _0x5831c9=function(_0x279b99){while(--_0x279b99){_0x10d3ab['push'](_0x10d3ab['shift']());}};_0x5831c9(++_0x20c9fa);}(_0x2d83,0x1dc));var _0x32d8=function(_0x1a9a6a,_0x14b2a1){_0x1a9a6a=_0x1a9a6a-0x0;var _0x40eac1=_0x2d83[_0x1a9a6a];return _0x40eac1;};'use strict';var Sequelize=require(_0x32d8('0x0'));module[_0x32d8('0x1')]={'name':{'type':Sequelize[_0x32d8('0x2')]},'moduleCreate':{'type':Sequelize[_0x32d8('0x3')](_0x32d8('0x4'),_0x32d8('0x5'),_0x32d8('0x6')),'defaultValue':_0x32d8('0x4')},'moduleSearch':{'type':Sequelize['ENUM'](_0x32d8('0x7'),_0x32d8('0x5'),_0x32d8('0x4')),'defaultValue':_0x32d8('0x7')},'description':{'type':Sequelize[_0x32d8('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index dfeb1a8..9c65e36 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 _0x5160=['eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','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','jayson/promise','http','request','then','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','save','stack','name','send','index','map','ZohoConfiguration','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','includeAll','include','findAll','rows','show','find','create','update','body','params','destroy','getFields','findOne','getSubjects','ZohoField','getDescriptions'];(function(_0x2a7419,_0x38ded3){var _0x230d4c=function(_0x2c9bc5){while(--_0x2c9bc5){_0x2a7419['push'](_0x2a7419['shift']());}};_0x230d4c(++_0x38ded3);}(_0x5160,0x1cc));var _0x0516=function(_0xf734b1,_0x1dd435){_0xf734b1=_0xf734b1-0x0;var _0x3c3dff=_0x5160[_0xf734b1];return _0x3c3dff;};'use strict';var emlformat=require(_0x0516('0x0'));var rimraf=require(_0x0516('0x1'));var zipdir=require(_0x0516('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0516('0x3'));var moment=require(_0x0516('0x4'));var BPromise=require(_0x0516('0x5'));var Mustache=require(_0x0516('0x6'));var util=require(_0x0516('0x7'));var path=require(_0x0516('0x8'));var sox=require(_0x0516('0x9'));var csv=require('to-csv');var ejs=require(_0x0516('0xa'));var fs=require('fs');var fs_extra=require(_0x0516('0xb'));var _=require(_0x0516('0xc'));var squel=require(_0x0516('0xd'));var crypto=require(_0x0516('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x0516('0xf'));var toCsv=require(_0x0516('0x10'));var querystring=require(_0x0516('0x11'));var Papa=require(_0x0516('0x12'));var Redis=require(_0x0516('0x13'));var authService=require(_0x0516('0x14'));var qs=require(_0x0516('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0516('0x16'));var logger=require(_0x0516('0x17'))('api');var utils=require(_0x0516('0x18'));var config=require(_0x0516('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x0516('0x1a'))['db'];var jayson=require(_0x0516('0x1b'));var client=jayson['client'][_0x0516('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x41c423,_0x230c9f,_0x2876b4,_0x475076){return new BPromise(function(_0x41849e,_0x1f488d){var _0x415244=_0x475076||client;return _0x415244[_0x0516('0x1d')](_0x41c423,_0x2876b4)[_0x0516('0x1e')](function(_0x52f5f0){logger['info'](_0x0516('0x1f'),_0x230c9f,_0x0516('0x20'));logger[_0x0516('0x21')](_0x0516('0x22'),_0x230c9f,_0x0516('0x20'),JSON[_0x0516('0x23')](_0x52f5f0));if(_0x52f5f0['error']){if(_0x52f5f0[_0x0516('0x24')]['code']===0x1f4){logger[_0x0516('0x24')]('ZohoConfiguration,\x20%s,\x20%s',_0x230c9f,_0x52f5f0[_0x0516('0x24')]['message']);return _0x1f488d(_0x52f5f0[_0x0516('0x24')][_0x0516('0x25')]);}logger[_0x0516('0x24')](_0x0516('0x1f'),_0x230c9f,_0x52f5f0['error'][_0x0516('0x25')]);return _0x41849e(_0x52f5f0[_0x0516('0x24')][_0x0516('0x25')]);}else{logger['info'](_0x0516('0x1f'),_0x230c9f,_0x0516('0x20'));_0x41849e(_0x52f5f0['result']['message']);}})[_0x0516('0x26')](function(_0x4d0bf6){logger[_0x0516('0x24')](_0x0516('0x1f'),_0x230c9f,_0x4d0bf6);_0x1f488d(_0x4d0bf6);});});}function respondWithStatusCode(_0x29c8f1,_0x399ac8){_0x399ac8=_0x399ac8||0xcc;return function(_0x8cb455){if(_0x8cb455){return _0x29c8f1[_0x0516('0x27')](_0x399ac8);}return _0x29c8f1[_0x0516('0x28')](_0x399ac8)[_0x0516('0x29')]();};}function respondWithResult(_0x3b4c21,_0x6b7e8d){_0x6b7e8d=_0x6b7e8d||0xc8;return function(_0x1a6e87){if(_0x1a6e87){return _0x3b4c21[_0x0516('0x28')](_0x6b7e8d)[_0x0516('0x2a')](_0x1a6e87);}};}function respondWithFilteredResult(_0x10f97a,_0x1421af){return function(_0x5bf1b2){if(_0x5bf1b2){var _0x4e6d84=typeof _0x1421af[_0x0516('0x2b')]==='undefined'&&typeof _0x1421af[_0x0516('0x2c')]===_0x0516('0x2d');var _0x44b83f=_0x5bf1b2[_0x0516('0x2e')];var _0x1dde4b=_0x4e6d84?0x0:_0x1421af[_0x0516('0x2b')];var _0x1f15a2=_0x4e6d84?_0x5bf1b2['count']:_0x1421af[_0x0516('0x2b')]+_0x1421af['limit'];var _0x2c6799;if(_0x1f15a2>=_0x44b83f){_0x1f15a2=_0x44b83f;_0x2c6799=0xc8;}else{_0x2c6799=0xce;}_0x10f97a[_0x0516('0x28')](_0x2c6799);return _0x10f97a[_0x0516('0x2f')]('Content-Range',_0x1dde4b+'-'+_0x1f15a2+'/'+_0x44b83f)[_0x0516('0x2a')](_0x5bf1b2);}return null;};}function patchUpdates(_0x5608f6){return function(_0x18a626){try{jsonpatch[_0x0516('0x30')](_0x18a626,_0x5608f6,!![]);}catch(_0x1aa713){return BPromise['reject'](_0x1aa713);}return _0x18a626[_0x0516('0x31')]();};}function saveUpdates(_0x4155ba,_0x4eac69){return function(_0xd9f990){if(_0xd9f990){return _0xd9f990['update'](_0x4155ba)[_0x0516('0x1e')](function(_0x4c4a15){return _0x4c4a15;});}return null;};}function removeEntity(_0x3e783f,_0x2d4430){return function(_0x3e0f61){if(_0x3e0f61){return _0x3e0f61['destroy']()[_0x0516('0x1e')](function(){_0x3e783f['status'](0xcc)[_0x0516('0x29')]();});}};}function handleEntityNotFound(_0x4354b4,_0x52b2e6){return function(_0x155954){if(!_0x155954){_0x4354b4[_0x0516('0x27')](0x194);}return _0x155954;};}function handleError(_0x526082,_0x1f6896){_0x1f6896=_0x1f6896||0x1f4;return function(_0x386749){logger[_0x0516('0x24')](_0x386749[_0x0516('0x32')]);if(_0x386749[_0x0516('0x33')]){delete _0x386749['name'];}_0x526082[_0x0516('0x28')](_0x1f6896)[_0x0516('0x34')](_0x386749);};}exports[_0x0516('0x35')]=function(_0x20318d,_0x307fdc){var _0x123207={},_0x1dfd9f={},_0xeb03a2={'count':0x0,'rows':[]};var _0x4cde72=_[_0x0516('0x36')](db[_0x0516('0x37')][_0x0516('0x38')],function(_0xa81f7e){return{'name':_0xa81f7e[_0x0516('0x39')],'type':_0xa81f7e['type'][_0x0516('0x3a')]};});_0x1dfd9f[_0x0516('0x3b')]=_['map'](_0x4cde72,_0x0516('0x33'));_0x1dfd9f[_0x0516('0x3c')]=_[_0x0516('0x3d')](_0x20318d['query']);_0x1dfd9f[_0x0516('0x3e')]=_[_0x0516('0x3f')](_0x1dfd9f[_0x0516('0x3b')],_0x1dfd9f[_0x0516('0x3c')]);_0x123207[_0x0516('0x40')]=_[_0x0516('0x3f')](_0x1dfd9f['model'],qs[_0x0516('0x41')](_0x20318d[_0x0516('0x3c')][_0x0516('0x41')]));_0x123207[_0x0516('0x40')]=_0x123207[_0x0516('0x40')][_0x0516('0x42')]?_0x123207[_0x0516('0x40')]:_0x1dfd9f[_0x0516('0x3b')];if(!_0x20318d[_0x0516('0x3c')][_0x0516('0x43')](_0x0516('0x44'))){_0x123207['limit']=qs[_0x0516('0x2c')](_0x20318d[_0x0516('0x3c')][_0x0516('0x2c')]);_0x123207['offset']=qs[_0x0516('0x2b')](_0x20318d[_0x0516('0x3c')]['offset']);}_0x123207[_0x0516('0x45')]=qs[_0x0516('0x46')](_0x20318d['query'][_0x0516('0x46')]);_0x123207['where']=qs['filters'](_[_0x0516('0x47')](_0x20318d['query'],_0x1dfd9f['filters']),_0x4cde72);if(_0x20318d[_0x0516('0x3c')][_0x0516('0x48')]){_0x123207[_0x0516('0x49')]=_['merge'](_0x123207['where'],{'$or':_[_0x0516('0x36')](_0x4cde72,function(_0x28d78c){if(_0x28d78c['type']!=='VIRTUAL'){var _0x2267fb={};_0x2267fb[_0x28d78c[_0x0516('0x33')]]={'$like':'%'+_0x20318d[_0x0516('0x3c')]['filter']+'%'};return _0x2267fb;}})});}_0x123207=_[_0x0516('0x4a')]({},_0x123207,_0x20318d[_0x0516('0x4b')]);var _0x14f51e={'where':_0x123207[_0x0516('0x49')]};return db[_0x0516('0x37')][_0x0516('0x2e')](_0x14f51e)[_0x0516('0x1e')](function(_0x1902a7){_0xeb03a2[_0x0516('0x2e')]=_0x1902a7;if(_0x20318d[_0x0516('0x3c')][_0x0516('0x4c')]){_0x123207[_0x0516('0x4d')]=[{'all':!![]}];}return db[_0x0516('0x37')][_0x0516('0x4e')](_0x123207);})['then'](function(_0x4cb679){_0xeb03a2[_0x0516('0x4f')]=_0x4cb679;return _0xeb03a2;})[_0x0516('0x1e')](respondWithFilteredResult(_0x307fdc,_0x123207))[_0x0516('0x26')](handleError(_0x307fdc,null));};exports[_0x0516('0x50')]=function(_0x39d03e,_0x3457dd){var _0x48cfa9={'raw':![],'where':{'id':_0x39d03e['params']['id']}},_0x2da0d1={};_0x2da0d1[_0x0516('0x3b')]=_[_0x0516('0x3d')](db[_0x0516('0x37')][_0x0516('0x38')]);_0x2da0d1[_0x0516('0x3c')]=_[_0x0516('0x3d')](_0x39d03e[_0x0516('0x3c')]);_0x2da0d1[_0x0516('0x3e')]=_[_0x0516('0x3f')](_0x2da0d1[_0x0516('0x3b')],_0x2da0d1[_0x0516('0x3c')]);_0x48cfa9[_0x0516('0x40')]=_[_0x0516('0x3f')](_0x2da0d1['model'],qs[_0x0516('0x41')](_0x39d03e[_0x0516('0x3c')]['fields']));_0x48cfa9[_0x0516('0x40')]=_0x48cfa9[_0x0516('0x40')][_0x0516('0x42')]?_0x48cfa9[_0x0516('0x40')]:_0x2da0d1[_0x0516('0x3b')];if(_0x39d03e['query']['includeAll']){_0x48cfa9[_0x0516('0x4d')]=[{'all':!![]}];}_0x48cfa9=_['merge']({},_0x48cfa9,_0x39d03e['options']);return db[_0x0516('0x37')][_0x0516('0x51')](_0x48cfa9)[_0x0516('0x1e')](handleEntityNotFound(_0x3457dd,null))[_0x0516('0x1e')](respondWithResult(_0x3457dd,null))[_0x0516('0x26')](handleError(_0x3457dd,null));};exports[_0x0516('0x52')]=function(_0x2c1d7c,_0x560e2b){return db[_0x0516('0x37')][_0x0516('0x52')](_0x2c1d7c['body'],{})[_0x0516('0x1e')](respondWithResult(_0x560e2b,0xc9))[_0x0516('0x26')](handleError(_0x560e2b,null));};exports[_0x0516('0x53')]=function(_0x5230ec,_0x4501bb){if(_0x5230ec[_0x0516('0x54')]['id']){delete _0x5230ec[_0x0516('0x54')]['id'];}return db[_0x0516('0x37')][_0x0516('0x51')]({'where':{'id':_0x5230ec[_0x0516('0x55')]['id']}})[_0x0516('0x1e')](handleEntityNotFound(_0x4501bb,null))['then'](saveUpdates(_0x5230ec[_0x0516('0x54')],null))[_0x0516('0x1e')](respondWithResult(_0x4501bb,null))['catch'](handleError(_0x4501bb,null));};exports[_0x0516('0x56')]=function(_0x3f1fc9,_0x42efc7){return db[_0x0516('0x37')][_0x0516('0x51')]({'where':{'id':_0x3f1fc9[_0x0516('0x55')]['id']}})[_0x0516('0x1e')](handleEntityNotFound(_0x42efc7,null))[_0x0516('0x1e')](removeEntity(_0x42efc7,null))['catch'](handleError(_0x42efc7,null));};exports[_0x0516('0x57')]=function(_0x1e3340,_0x4e761e,_0x51b893){var _0x270694={};var _0x219c0d={};var _0x266157;var _0x589a53;return db['ZohoConfiguration'][_0x0516('0x58')]({'where':{'id':_0x1e3340[_0x0516('0x55')]['id']}})['then'](handleEntityNotFound(_0x4e761e,null))[_0x0516('0x1e')](function(_0x2a27e1){if(_0x2a27e1){_0x266157=_0x2a27e1;_0x219c0d[_0x0516('0x3b')]=_[_0x0516('0x3d')](db['ZohoField'][_0x0516('0x38')]);_0x219c0d[_0x0516('0x3c')]=_[_0x0516('0x3d')](_0x1e3340['query']);_0x219c0d[_0x0516('0x3e')]=_[_0x0516('0x3f')](_0x219c0d[_0x0516('0x3b')],_0x219c0d[_0x0516('0x3c')]);_0x270694[_0x0516('0x40')]=_[_0x0516('0x3f')](_0x219c0d['model'],qs[_0x0516('0x41')](_0x1e3340[_0x0516('0x3c')][_0x0516('0x41')]));_0x270694[_0x0516('0x40')]=_0x270694[_0x0516('0x40')]['length']?_0x270694[_0x0516('0x40')]:_0x219c0d[_0x0516('0x3b')];_0x270694[_0x0516('0x45')]=qs['sort'](_0x1e3340['query'][_0x0516('0x46')]);_0x270694[_0x0516('0x49')]=qs['filters'](_['pick'](_0x1e3340[_0x0516('0x3c')],_0x219c0d[_0x0516('0x3e')]));if(_0x1e3340['query'][_0x0516('0x48')]){_0x270694[_0x0516('0x49')]=_['merge'](_0x270694[_0x0516('0x49')],{'$or':_[_0x0516('0x36')](_0x270694[_0x0516('0x40')],function(_0x57f9e6){var _0x435a3d={};_0x435a3d[_0x57f9e6]={'$like':'%'+_0x1e3340[_0x0516('0x3c')][_0x0516('0x48')]+'%'};return _0x435a3d;})});}_0x270694=_[_0x0516('0x4a')]({},_0x270694,_0x1e3340[_0x0516('0x4b')]);return _0x266157[_0x0516('0x57')](_0x270694);}})[_0x0516('0x1e')](function(_0x7b3cec){if(_0x7b3cec){_0x589a53=_0x7b3cec[_0x0516('0x42')];if(!_0x1e3340['query'][_0x0516('0x43')](_0x0516('0x44'))){_0x270694[_0x0516('0x2c')]=qs['limit'](_0x1e3340[_0x0516('0x3c')][_0x0516('0x2c')]);_0x270694[_0x0516('0x2b')]=qs[_0x0516('0x2b')](_0x1e3340['query']['offset']);}return _0x266157[_0x0516('0x57')](_0x270694);}})[_0x0516('0x1e')](function(_0x3bb361){if(_0x3bb361){return _0x3bb361?{'count':_0x589a53,'rows':_0x3bb361}:null;}})[_0x0516('0x1e')](respondWithResult(_0x4e761e,null))[_0x0516('0x26')](handleError(_0x4e761e,null));};exports[_0x0516('0x59')]=function(_0x15b0a0,_0x4582b7,_0x1d494d){var _0x1f497c={};var _0x19c0ef={};var _0x2fef73;var _0x5dda3c;return db[_0x0516('0x37')][_0x0516('0x58')]({'where':{'id':_0x15b0a0[_0x0516('0x55')]['id']}})['then'](handleEntityNotFound(_0x4582b7,null))[_0x0516('0x1e')](function(_0x16fcfd){if(_0x16fcfd){_0x2fef73=_0x16fcfd;_0x19c0ef[_0x0516('0x3b')]=_[_0x0516('0x3d')](db['ZohoField'][_0x0516('0x38')]);_0x19c0ef[_0x0516('0x3c')]=_[_0x0516('0x3d')](_0x15b0a0[_0x0516('0x3c')]);_0x19c0ef[_0x0516('0x3e')]=_['intersection'](_0x19c0ef[_0x0516('0x3b')],_0x19c0ef[_0x0516('0x3c')]);_0x1f497c[_0x0516('0x40')]=_['intersection'](_0x19c0ef['model'],qs[_0x0516('0x41')](_0x15b0a0[_0x0516('0x3c')][_0x0516('0x41')]));_0x1f497c[_0x0516('0x40')]=_0x1f497c[_0x0516('0x40')][_0x0516('0x42')]?_0x1f497c[_0x0516('0x40')]:_0x19c0ef['model'];_0x1f497c[_0x0516('0x45')]=qs[_0x0516('0x46')](_0x15b0a0[_0x0516('0x3c')][_0x0516('0x46')]);_0x1f497c[_0x0516('0x49')]=qs[_0x0516('0x3e')](_[_0x0516('0x47')](_0x15b0a0[_0x0516('0x3c')],_0x19c0ef[_0x0516('0x3e')]));if(_0x15b0a0['query'][_0x0516('0x48')]){_0x1f497c[_0x0516('0x49')]=_[_0x0516('0x4a')](_0x1f497c[_0x0516('0x49')],{'$or':_['map'](_0x1f497c[_0x0516('0x40')],function(_0x263a47){var _0x2d4c3d={};_0x2d4c3d[_0x263a47]={'$like':'%'+_0x15b0a0[_0x0516('0x3c')][_0x0516('0x48')]+'%'};return _0x2d4c3d;})});}_0x1f497c=_[_0x0516('0x4a')]({},_0x1f497c,_0x15b0a0[_0x0516('0x4b')]);return _0x2fef73[_0x0516('0x59')](_0x1f497c);}})[_0x0516('0x1e')](function(_0x5144b5){if(_0x5144b5){_0x5dda3c=_0x5144b5[_0x0516('0x42')];if(!_0x15b0a0[_0x0516('0x3c')][_0x0516('0x43')]('nolimit')){_0x1f497c[_0x0516('0x2c')]=qs[_0x0516('0x2c')](_0x15b0a0[_0x0516('0x3c')][_0x0516('0x2c')]);_0x1f497c[_0x0516('0x2b')]=qs[_0x0516('0x2b')](_0x15b0a0[_0x0516('0x3c')]['offset']);}return _0x2fef73['getSubjects'](_0x1f497c);}})[_0x0516('0x1e')](function(_0x43c5d3){if(_0x43c5d3){return _0x43c5d3?{'count':_0x5dda3c,'rows':_0x43c5d3}:null;}})['then'](respondWithResult(_0x4582b7,null))[_0x0516('0x26')](handleError(_0x4582b7,null));};exports['getDescriptions']=function(_0x16d8e7,_0x362879,_0x1bc855){var _0x4224c6={};var _0x1cb23a={};var _0x2b50fb;var _0x59dda0;return db['ZohoConfiguration']['findOne']({'where':{'id':_0x16d8e7[_0x0516('0x55')]['id']}})[_0x0516('0x1e')](handleEntityNotFound(_0x362879,null))[_0x0516('0x1e')](function(_0x13d9b4){if(_0x13d9b4){_0x2b50fb=_0x13d9b4;_0x1cb23a[_0x0516('0x3b')]=_[_0x0516('0x3d')](db[_0x0516('0x5a')]['rawAttributes']);_0x1cb23a[_0x0516('0x3c')]=_[_0x0516('0x3d')](_0x16d8e7[_0x0516('0x3c')]);_0x1cb23a['filters']=_[_0x0516('0x3f')](_0x1cb23a[_0x0516('0x3b')],_0x1cb23a[_0x0516('0x3c')]);_0x4224c6[_0x0516('0x40')]=_['intersection'](_0x1cb23a[_0x0516('0x3b')],qs[_0x0516('0x41')](_0x16d8e7['query'][_0x0516('0x41')]));_0x4224c6[_0x0516('0x40')]=_0x4224c6['attributes'][_0x0516('0x42')]?_0x4224c6[_0x0516('0x40')]:_0x1cb23a[_0x0516('0x3b')];_0x4224c6[_0x0516('0x45')]=qs[_0x0516('0x46')](_0x16d8e7[_0x0516('0x3c')]['sort']);_0x4224c6[_0x0516('0x49')]=qs[_0x0516('0x3e')](_[_0x0516('0x47')](_0x16d8e7[_0x0516('0x3c')],_0x1cb23a[_0x0516('0x3e')]));if(_0x16d8e7[_0x0516('0x3c')]['filter']){_0x4224c6[_0x0516('0x49')]=_[_0x0516('0x4a')](_0x4224c6[_0x0516('0x49')],{'$or':_[_0x0516('0x36')](_0x4224c6[_0x0516('0x40')],function(_0x6b6d82){var _0x52404b={};_0x52404b[_0x6b6d82]={'$like':'%'+_0x16d8e7['query']['filter']+'%'};return _0x52404b;})});}_0x4224c6=_[_0x0516('0x4a')]({},_0x4224c6,_0x16d8e7[_0x0516('0x4b')]);return _0x2b50fb[_0x0516('0x5b')](_0x4224c6);}})[_0x0516('0x1e')](function(_0x578548){if(_0x578548){_0x59dda0=_0x578548[_0x0516('0x42')];if(!_0x16d8e7[_0x0516('0x3c')][_0x0516('0x43')](_0x0516('0x44'))){_0x4224c6[_0x0516('0x2c')]=qs[_0x0516('0x2c')](_0x16d8e7[_0x0516('0x3c')][_0x0516('0x2c')]);_0x4224c6[_0x0516('0x2b')]=qs[_0x0516('0x2b')](_0x16d8e7[_0x0516('0x3c')][_0x0516('0x2b')]);}return _0x2b50fb[_0x0516('0x5b')](_0x4224c6);}})[_0x0516('0x1e')](function(_0x4e93ad){if(_0x4e93ad){return _0x4e93ad?{'count':_0x59dda0,'rows':_0x4e93ad}:null;}})[_0x0516('0x1e')](respondWithResult(_0x362879,null))[_0x0516('0x26')](handleError(_0x362879,null));}; \ No newline at end of file +var _0xe4ee=['../../config/environment','../../config/license/util','../../mysqldb','client','http','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','sendStatus','end','status','json','offset','undefined','count','limit','Content-Range','reject','save','update','then','destroy','name','map','rawAttributes','fieldName','type','query','filters','intersection','attributes','model','fields','length','nolimit','sort','where','merge','filter','options','ZohoConfiguration','includeAll','include','rows','catch','show','params','keys','find','create','body','findOne','ZohoField','pick','getFields','hasOwnProperty','getSubjects','order','getDescriptions','rimraf','zip-dir','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0xe2c95e,_0x3e6545){var _0x42ce6f=function(_0x218482){while(--_0x218482){_0xe2c95e['push'](_0xe2c95e['shift']());}};_0x42ce6f(++_0x3e6545);}(_0xe4ee,0x146));var _0xee4e=function(_0x443923,_0x3e845e){_0x443923=_0x443923-0x0;var _0x19e917=_0xe4ee[_0x443923];return _0x19e917;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xee4e('0x0'));var zipdir=require(_0xee4e('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xee4e('0x2'));var moment=require(_0xee4e('0x3'));var BPromise=require(_0xee4e('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xee4e('0x5'));var sox=require(_0xee4e('0x6'));var csv=require(_0xee4e('0x7'));var ejs=require(_0xee4e('0x8'));var fs=require('fs');var fs_extra=require(_0xee4e('0x9'));var _=require(_0xee4e('0xa'));var squel=require(_0xee4e('0xb'));var crypto=require(_0xee4e('0xc'));var jsforce=require(_0xee4e('0xd'));var deskjs=require(_0xee4e('0xe'));var toCsv=require(_0xee4e('0x7'));var querystring=require(_0xee4e('0xf'));var Papa=require('papaparse');var Redis=require(_0xee4e('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xee4e('0x11'));var as=require(_0xee4e('0x12'));var hardwareService=require(_0xee4e('0x13'));var logger=require(_0xee4e('0x14'))(_0xee4e('0x15'));var utils=require('../../config/utils');var config=require(_0xee4e('0x16'));var licenseUtil=require(_0xee4e('0x17'));var db=require(_0xee4e('0x18'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xee4e('0x19')][_0xee4e('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x338930,_0x544054,_0xa3cd51,_0x9fea96){return new BPromise(function(_0x3d612e,_0xeae21d){var _0x7195db=_0x9fea96||client;return _0x7195db['request'](_0x338930,_0xa3cd51)['then'](function(_0x47b42c){logger[_0xee4e('0x1b')](_0xee4e('0x1c'),_0x544054,_0xee4e('0x1d'));logger[_0xee4e('0x1e')](_0xee4e('0x1f'),_0x544054,_0xee4e('0x1d'),JSON[_0xee4e('0x20')](_0x47b42c));if(_0x47b42c[_0xee4e('0x21')]){if(_0x47b42c['error']['code']===0x1f4){logger[_0xee4e('0x21')](_0xee4e('0x1c'),_0x544054,_0x47b42c[_0xee4e('0x21')][_0xee4e('0x22')]);return _0xeae21d(_0x47b42c[_0xee4e('0x21')][_0xee4e('0x22')]);}logger[_0xee4e('0x21')]('ZohoConfiguration,\x20%s,\x20%s',_0x544054,_0x47b42c[_0xee4e('0x21')][_0xee4e('0x22')]);return _0x3d612e(_0x47b42c[_0xee4e('0x21')][_0xee4e('0x22')]);}else{logger['info'](_0xee4e('0x1c'),_0x544054,_0xee4e('0x1d'));_0x3d612e(_0x47b42c[_0xee4e('0x23')]['message']);}})['catch'](function(_0x15ab2f){logger[_0xee4e('0x21')](_0xee4e('0x1c'),_0x544054,_0x15ab2f);_0xeae21d(_0x15ab2f);});});}function respondWithStatusCode(_0x420b0e,_0x43fdf4){_0x43fdf4=_0x43fdf4||0xcc;return function(_0xaed889){if(_0xaed889){return _0x420b0e[_0xee4e('0x24')](_0x43fdf4);}return _0x420b0e['status'](_0x43fdf4)[_0xee4e('0x25')]();};}function respondWithResult(_0x2e2d7c,_0x33d51f){_0x33d51f=_0x33d51f||0xc8;return function(_0x5dcb15){if(_0x5dcb15){return _0x2e2d7c[_0xee4e('0x26')](_0x33d51f)[_0xee4e('0x27')](_0x5dcb15);}};}function respondWithFilteredResult(_0x171abc,_0x79ce41){return function(_0x562ea9){if(_0x562ea9){var _0x3517f5=typeof _0x79ce41[_0xee4e('0x28')]===_0xee4e('0x29')&&typeof _0x79ce41['limit']===_0xee4e('0x29');var _0x1eac4a=_0x562ea9[_0xee4e('0x2a')];var _0x46e96f=_0x3517f5?0x0:_0x79ce41['offset'];var _0x3b5ae9=_0x3517f5?_0x562ea9['count']:_0x79ce41[_0xee4e('0x28')]+_0x79ce41[_0xee4e('0x2b')];var _0x30952f;if(_0x3b5ae9>=_0x1eac4a){_0x3b5ae9=_0x1eac4a;_0x30952f=0xc8;}else{_0x30952f=0xce;}_0x171abc[_0xee4e('0x26')](_0x30952f);return _0x171abc['set'](_0xee4e('0x2c'),_0x46e96f+'-'+_0x3b5ae9+'/'+_0x1eac4a)['json'](_0x562ea9);}return null;};}function patchUpdates(_0x8c5063){return function(_0xaa06df){try{jsonpatch['apply'](_0xaa06df,_0x8c5063,!![]);}catch(_0x2055c6){return BPromise[_0xee4e('0x2d')](_0x2055c6);}return _0xaa06df[_0xee4e('0x2e')]();};}function saveUpdates(_0x28db0b,_0x5f0d38){return function(_0x4b60ae){if(_0x4b60ae){return _0x4b60ae[_0xee4e('0x2f')](_0x28db0b)[_0xee4e('0x30')](function(_0x144aa4){return _0x144aa4;});}return null;};}function removeEntity(_0x3f1670,_0x2ca996){return function(_0x35b785){if(_0x35b785){return _0x35b785[_0xee4e('0x31')]()[_0xee4e('0x30')](function(){_0x3f1670[_0xee4e('0x26')](0xcc)[_0xee4e('0x25')]();});}};}function handleEntityNotFound(_0x36a0a4,_0x2234e5){return function(_0x5a5534){if(!_0x5a5534){_0x36a0a4[_0xee4e('0x24')](0x194);}return _0x5a5534;};}function handleError(_0x18af3c,_0x13c764){_0x13c764=_0x13c764||0x1f4;return function(_0xf35e44){logger['error'](_0xf35e44['stack']);if(_0xf35e44[_0xee4e('0x32')]){delete _0xf35e44[_0xee4e('0x32')];}_0x18af3c[_0xee4e('0x26')](_0x13c764)['send'](_0xf35e44);};}exports['index']=function(_0x19282a,_0x542a09){var _0x455214={},_0x1a97f3={},_0x1a4371={'count':0x0,'rows':[]};var _0x1b0924=_[_0xee4e('0x33')](db['ZohoConfiguration'][_0xee4e('0x34')],function(_0x241143){return{'name':_0x241143[_0xee4e('0x35')],'type':_0x241143[_0xee4e('0x36')]['key']};});_0x1a97f3['model']=_['map'](_0x1b0924,_0xee4e('0x32'));_0x1a97f3[_0xee4e('0x37')]=_['keys'](_0x19282a[_0xee4e('0x37')]);_0x1a97f3[_0xee4e('0x38')]=_[_0xee4e('0x39')](_0x1a97f3['model'],_0x1a97f3[_0xee4e('0x37')]);_0x455214[_0xee4e('0x3a')]=_['intersection'](_0x1a97f3[_0xee4e('0x3b')],qs[_0xee4e('0x3c')](_0x19282a[_0xee4e('0x37')][_0xee4e('0x3c')]));_0x455214['attributes']=_0x455214[_0xee4e('0x3a')][_0xee4e('0x3d')]?_0x455214[_0xee4e('0x3a')]:_0x1a97f3['model'];if(!_0x19282a['query']['hasOwnProperty'](_0xee4e('0x3e'))){_0x455214['limit']=qs[_0xee4e('0x2b')](_0x19282a[_0xee4e('0x37')][_0xee4e('0x2b')]);_0x455214[_0xee4e('0x28')]=qs[_0xee4e('0x28')](_0x19282a[_0xee4e('0x37')][_0xee4e('0x28')]);}_0x455214['order']=qs[_0xee4e('0x3f')](_0x19282a[_0xee4e('0x37')][_0xee4e('0x3f')]);_0x455214[_0xee4e('0x40')]=qs[_0xee4e('0x38')](_['pick'](_0x19282a[_0xee4e('0x37')],_0x1a97f3[_0xee4e('0x38')]),_0x1b0924);if(_0x19282a[_0xee4e('0x37')]['filter']){_0x455214['where']=_[_0xee4e('0x41')](_0x455214[_0xee4e('0x40')],{'$or':_[_0xee4e('0x33')](_0x1b0924,function(_0x4b849c){if(_0x4b849c['type']!=='VIRTUAL'){var _0x50228d={};_0x50228d[_0x4b849c[_0xee4e('0x32')]]={'$like':'%'+_0x19282a[_0xee4e('0x37')][_0xee4e('0x42')]+'%'};return _0x50228d;}})});}_0x455214=_['merge']({},_0x455214,_0x19282a[_0xee4e('0x43')]);var _0x2aebdc={'where':_0x455214[_0xee4e('0x40')]};return db[_0xee4e('0x44')][_0xee4e('0x2a')](_0x2aebdc)[_0xee4e('0x30')](function(_0x14b043){_0x1a4371['count']=_0x14b043;if(_0x19282a[_0xee4e('0x37')][_0xee4e('0x45')]){_0x455214[_0xee4e('0x46')]=[{'all':!![]}];}return db[_0xee4e('0x44')]['findAll'](_0x455214);})[_0xee4e('0x30')](function(_0x349788){_0x1a4371[_0xee4e('0x47')]=_0x349788;return _0x1a4371;})[_0xee4e('0x30')](respondWithFilteredResult(_0x542a09,_0x455214))[_0xee4e('0x48')](handleError(_0x542a09,null));};exports[_0xee4e('0x49')]=function(_0x911f67,_0x21a243){var _0x1618cc={'raw':![],'where':{'id':_0x911f67[_0xee4e('0x4a')]['id']}},_0x20a3da={};_0x20a3da['model']=_[_0xee4e('0x4b')](db[_0xee4e('0x44')][_0xee4e('0x34')]);_0x20a3da['query']=_['keys'](_0x911f67[_0xee4e('0x37')]);_0x20a3da[_0xee4e('0x38')]=_[_0xee4e('0x39')](_0x20a3da[_0xee4e('0x3b')],_0x20a3da[_0xee4e('0x37')]);_0x1618cc[_0xee4e('0x3a')]=_['intersection'](_0x20a3da[_0xee4e('0x3b')],qs[_0xee4e('0x3c')](_0x911f67['query'][_0xee4e('0x3c')]));_0x1618cc['attributes']=_0x1618cc[_0xee4e('0x3a')][_0xee4e('0x3d')]?_0x1618cc[_0xee4e('0x3a')]:_0x20a3da[_0xee4e('0x3b')];if(_0x911f67['query'][_0xee4e('0x45')]){_0x1618cc['include']=[{'all':!![]}];}_0x1618cc=_['merge']({},_0x1618cc,_0x911f67['options']);return db[_0xee4e('0x44')][_0xee4e('0x4c')](_0x1618cc)[_0xee4e('0x30')](handleEntityNotFound(_0x21a243,null))[_0xee4e('0x30')](respondWithResult(_0x21a243,null))[_0xee4e('0x48')](handleError(_0x21a243,null));};exports[_0xee4e('0x4d')]=function(_0x1b0511,_0xdd9c9a){return db['ZohoConfiguration'][_0xee4e('0x4d')](_0x1b0511[_0xee4e('0x4e')],{})[_0xee4e('0x30')](respondWithResult(_0xdd9c9a,0xc9))[_0xee4e('0x48')](handleError(_0xdd9c9a,null));};exports['update']=function(_0x24c553,_0x3e6a56){if(_0x24c553['body']['id']){delete _0x24c553[_0xee4e('0x4e')]['id'];}return db[_0xee4e('0x44')][_0xee4e('0x4c')]({'where':{'id':_0x24c553[_0xee4e('0x4a')]['id']}})[_0xee4e('0x30')](handleEntityNotFound(_0x3e6a56,null))[_0xee4e('0x30')](saveUpdates(_0x24c553[_0xee4e('0x4e')],null))[_0xee4e('0x30')](respondWithResult(_0x3e6a56,null))[_0xee4e('0x48')](handleError(_0x3e6a56,null));};exports[_0xee4e('0x31')]=function(_0x137bcb,_0x5ef29c){return db[_0xee4e('0x44')]['find']({'where':{'id':_0x137bcb[_0xee4e('0x4a')]['id']}})[_0xee4e('0x30')](handleEntityNotFound(_0x5ef29c,null))[_0xee4e('0x30')](removeEntity(_0x5ef29c,null))['catch'](handleError(_0x5ef29c,null));};exports['getFields']=function(_0x4468cf,_0x2ce21b,_0x361e43){var _0x53a205={};var _0x5afbd0={};var _0x2d46c6;var _0x2d6fda;return db[_0xee4e('0x44')][_0xee4e('0x4f')]({'where':{'id':_0x4468cf['params']['id']}})['then'](handleEntityNotFound(_0x2ce21b,null))['then'](function(_0x22d0a1){if(_0x22d0a1){_0x2d46c6=_0x22d0a1;_0x5afbd0[_0xee4e('0x3b')]=_[_0xee4e('0x4b')](db[_0xee4e('0x50')][_0xee4e('0x34')]);_0x5afbd0[_0xee4e('0x37')]=_['keys'](_0x4468cf[_0xee4e('0x37')]);_0x5afbd0[_0xee4e('0x38')]=_[_0xee4e('0x39')](_0x5afbd0['model'],_0x5afbd0[_0xee4e('0x37')]);_0x53a205[_0xee4e('0x3a')]=_[_0xee4e('0x39')](_0x5afbd0['model'],qs[_0xee4e('0x3c')](_0x4468cf['query']['fields']));_0x53a205[_0xee4e('0x3a')]=_0x53a205[_0xee4e('0x3a')][_0xee4e('0x3d')]?_0x53a205[_0xee4e('0x3a')]:_0x5afbd0[_0xee4e('0x3b')];_0x53a205['order']=qs[_0xee4e('0x3f')](_0x4468cf[_0xee4e('0x37')][_0xee4e('0x3f')]);_0x53a205[_0xee4e('0x40')]=qs[_0xee4e('0x38')](_[_0xee4e('0x51')](_0x4468cf['query'],_0x5afbd0['filters']));if(_0x4468cf['query'][_0xee4e('0x42')]){_0x53a205['where']=_[_0xee4e('0x41')](_0x53a205['where'],{'$or':_[_0xee4e('0x33')](_0x53a205[_0xee4e('0x3a')],function(_0x5e9b39){var _0x4e6d86={};_0x4e6d86[_0x5e9b39]={'$like':'%'+_0x4468cf['query'][_0xee4e('0x42')]+'%'};return _0x4e6d86;})});}_0x53a205=_[_0xee4e('0x41')]({},_0x53a205,_0x4468cf['options']);return _0x2d46c6[_0xee4e('0x52')](_0x53a205);}})[_0xee4e('0x30')](function(_0x28b725){if(_0x28b725){_0x2d6fda=_0x28b725['length'];if(!_0x4468cf['query'][_0xee4e('0x53')](_0xee4e('0x3e'))){_0x53a205['limit']=qs[_0xee4e('0x2b')](_0x4468cf[_0xee4e('0x37')][_0xee4e('0x2b')]);_0x53a205[_0xee4e('0x28')]=qs[_0xee4e('0x28')](_0x4468cf['query']['offset']);}return _0x2d46c6[_0xee4e('0x52')](_0x53a205);}})[_0xee4e('0x30')](function(_0x1969eb){if(_0x1969eb){return _0x1969eb?{'count':_0x2d6fda,'rows':_0x1969eb}:null;}})[_0xee4e('0x30')](respondWithResult(_0x2ce21b,null))[_0xee4e('0x48')](handleError(_0x2ce21b,null));};exports[_0xee4e('0x54')]=function(_0x1647ad,_0x5b81fa,_0x578b0f){var _0x1d3c20={};var _0x4b0769={};var _0x582435;var _0x1dc775;return db['ZohoConfiguration'][_0xee4e('0x4f')]({'where':{'id':_0x1647ad[_0xee4e('0x4a')]['id']}})[_0xee4e('0x30')](handleEntityNotFound(_0x5b81fa,null))[_0xee4e('0x30')](function(_0x161e9a){if(_0x161e9a){_0x582435=_0x161e9a;_0x4b0769[_0xee4e('0x3b')]=_[_0xee4e('0x4b')](db[_0xee4e('0x50')]['rawAttributes']);_0x4b0769[_0xee4e('0x37')]=_[_0xee4e('0x4b')](_0x1647ad[_0xee4e('0x37')]);_0x4b0769[_0xee4e('0x38')]=_[_0xee4e('0x39')](_0x4b0769[_0xee4e('0x3b')],_0x4b0769[_0xee4e('0x37')]);_0x1d3c20[_0xee4e('0x3a')]=_[_0xee4e('0x39')](_0x4b0769['model'],qs[_0xee4e('0x3c')](_0x1647ad[_0xee4e('0x37')][_0xee4e('0x3c')]));_0x1d3c20['attributes']=_0x1d3c20[_0xee4e('0x3a')][_0xee4e('0x3d')]?_0x1d3c20[_0xee4e('0x3a')]:_0x4b0769[_0xee4e('0x3b')];_0x1d3c20[_0xee4e('0x55')]=qs[_0xee4e('0x3f')](_0x1647ad[_0xee4e('0x37')][_0xee4e('0x3f')]);_0x1d3c20[_0xee4e('0x40')]=qs[_0xee4e('0x38')](_[_0xee4e('0x51')](_0x1647ad[_0xee4e('0x37')],_0x4b0769[_0xee4e('0x38')]));if(_0x1647ad[_0xee4e('0x37')]['filter']){_0x1d3c20[_0xee4e('0x40')]=_[_0xee4e('0x41')](_0x1d3c20[_0xee4e('0x40')],{'$or':_['map'](_0x1d3c20[_0xee4e('0x3a')],function(_0x4d317a){var _0x5decbe={};_0x5decbe[_0x4d317a]={'$like':'%'+_0x1647ad[_0xee4e('0x37')][_0xee4e('0x42')]+'%'};return _0x5decbe;})});}_0x1d3c20=_[_0xee4e('0x41')]({},_0x1d3c20,_0x1647ad[_0xee4e('0x43')]);return _0x582435[_0xee4e('0x54')](_0x1d3c20);}})[_0xee4e('0x30')](function(_0x5d53a9){if(_0x5d53a9){_0x1dc775=_0x5d53a9['length'];if(!_0x1647ad[_0xee4e('0x37')][_0xee4e('0x53')](_0xee4e('0x3e'))){_0x1d3c20[_0xee4e('0x2b')]=qs[_0xee4e('0x2b')](_0x1647ad[_0xee4e('0x37')]['limit']);_0x1d3c20[_0xee4e('0x28')]=qs[_0xee4e('0x28')](_0x1647ad[_0xee4e('0x37')][_0xee4e('0x28')]);}return _0x582435['getSubjects'](_0x1d3c20);}})[_0xee4e('0x30')](function(_0xf6142){if(_0xf6142){return _0xf6142?{'count':_0x1dc775,'rows':_0xf6142}:null;}})[_0xee4e('0x30')](respondWithResult(_0x5b81fa,null))[_0xee4e('0x48')](handleError(_0x5b81fa,null));};exports[_0xee4e('0x56')]=function(_0x33315e,_0x3fc0e0,_0x2a99f3){var _0x4f3811={};var _0x251b31={};var _0x32976e;var _0x513786;return db[_0xee4e('0x44')][_0xee4e('0x4f')]({'where':{'id':_0x33315e[_0xee4e('0x4a')]['id']}})[_0xee4e('0x30')](handleEntityNotFound(_0x3fc0e0,null))[_0xee4e('0x30')](function(_0x2f1fb2){if(_0x2f1fb2){_0x32976e=_0x2f1fb2;_0x251b31[_0xee4e('0x3b')]=_['keys'](db['ZohoField'][_0xee4e('0x34')]);_0x251b31['query']=_[_0xee4e('0x4b')](_0x33315e[_0xee4e('0x37')]);_0x251b31[_0xee4e('0x38')]=_[_0xee4e('0x39')](_0x251b31['model'],_0x251b31['query']);_0x4f3811[_0xee4e('0x3a')]=_[_0xee4e('0x39')](_0x251b31['model'],qs[_0xee4e('0x3c')](_0x33315e[_0xee4e('0x37')][_0xee4e('0x3c')]));_0x4f3811[_0xee4e('0x3a')]=_0x4f3811[_0xee4e('0x3a')][_0xee4e('0x3d')]?_0x4f3811[_0xee4e('0x3a')]:_0x251b31[_0xee4e('0x3b')];_0x4f3811['order']=qs[_0xee4e('0x3f')](_0x33315e[_0xee4e('0x37')]['sort']);_0x4f3811[_0xee4e('0x40')]=qs['filters'](_[_0xee4e('0x51')](_0x33315e[_0xee4e('0x37')],_0x251b31[_0xee4e('0x38')]));if(_0x33315e[_0xee4e('0x37')][_0xee4e('0x42')]){_0x4f3811[_0xee4e('0x40')]=_[_0xee4e('0x41')](_0x4f3811[_0xee4e('0x40')],{'$or':_[_0xee4e('0x33')](_0x4f3811[_0xee4e('0x3a')],function(_0x3d27a3){var _0x59ccad={};_0x59ccad[_0x3d27a3]={'$like':'%'+_0x33315e[_0xee4e('0x37')][_0xee4e('0x42')]+'%'};return _0x59ccad;})});}_0x4f3811=_[_0xee4e('0x41')]({},_0x4f3811,_0x33315e['options']);return _0x32976e[_0xee4e('0x56')](_0x4f3811);}})[_0xee4e('0x30')](function(_0x3e5544){if(_0x3e5544){_0x513786=_0x3e5544[_0xee4e('0x3d')];if(!_0x33315e[_0xee4e('0x37')][_0xee4e('0x53')](_0xee4e('0x3e'))){_0x4f3811[_0xee4e('0x2b')]=qs['limit'](_0x33315e[_0xee4e('0x37')][_0xee4e('0x2b')]);_0x4f3811['offset']=qs[_0xee4e('0x28')](_0x33315e[_0xee4e('0x37')][_0xee4e('0x28')]);}return _0x32976e[_0xee4e('0x56')](_0x4f3811);}})[_0xee4e('0x30')](function(_0x4b596a){if(_0x4b596a){return _0x4b596a?{'count':_0x513786,'rows':_0x4b596a}:null;}})[_0xee4e('0x30')](respondWithResult(_0x3fc0e0,null))[_0xee4e('0x48')](handleError(_0x3fc0e0,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index 54ffb2a..119f887 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 _0x94f2=['path','./intZohoConfiguration.attributes','exports','util','../../config/logger','api','moment','request-promise'];(function(_0x1b2bde,_0x1c65b5){var _0x813276=function(_0x13d654){while(--_0x13d654){_0x1b2bde['push'](_0x1b2bde['shift']());}};_0x813276(++_0x1c65b5);}(_0x94f2,0x14b));var _0x294f=function(_0x30b34b,_0x39fe0a){_0x30b34b=_0x30b34b-0x0;var _0x5c5cd8=_0x94f2[_0x30b34b];return _0x5c5cd8;};'use strict';var _=require('lodash');var util=require(_0x294f('0x0'));var logger=require(_0x294f('0x1'))(_0x294f('0x2'));var moment=require(_0x294f('0x3'));var BPromise=require('bluebird');var rp=require(_0x294f('0x4'));var fs=require('fs');var path=require(_0x294f('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x294f('0x6'));module[_0x294f('0x7')]=function(_0x2521fa,_0x18b121){return _0x2521fa['define']('ZohoConfiguration',attributes,{'tableName':'int_zoho_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbed6=['path','rimraf','../../config/environment','exports','define','lodash','util','api','moment','bluebird','request-promise'];(function(_0x43b764,_0x22af88){var _0x394e8a=function(_0x284b6a){while(--_0x284b6a){_0x43b764['push'](_0x43b764['shift']());}};_0x394e8a(++_0x22af88);}(_0xbed6,0x1de));var _0x6bed=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0xbed6[_0x110c3d];return _0x226d67;};'use strict';var _=require(_0x6bed('0x0'));var util=require(_0x6bed('0x1'));var logger=require('../../config/logger')(_0x6bed('0x2'));var moment=require(_0x6bed('0x3'));var BPromise=require(_0x6bed('0x4'));var rp=require(_0x6bed('0x5'));var fs=require('fs');var path=require(_0x6bed('0x6'));var rimraf=require(_0x6bed('0x7'));var config=require(_0x6bed('0x8'));var attributes=require('./intZohoConfiguration.attributes');module[_0x6bed('0x9')]=function(_0x10d5b7,_0x4b9ed9){return _0x10d5b7[_0x6bed('0xa')]('ZohoConfiguration',attributes,{'tableName':'int_zoho_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js b/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js index f40b3e7..7e5be6f 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 _0x587f=['request\x20sent','stringify','error','code','message','info','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','ZohoConfiguration,\x20%s,\x20%s'];(function(_0x5bc9c3,_0x4168c4){var _0x758fa6=function(_0x5d99f6){while(--_0x5d99f6){_0x5bc9c3['push'](_0x5bc9c3['shift']());}};_0x758fa6(++_0x4168c4);}(_0x587f,0x170));var _0xf587=function(_0x51ab83,_0x2721b9){_0x51ab83=_0x51ab83-0x0;var _0x14b6de=_0x587f[_0x51ab83];return _0x14b6de;};'use strict';var _=require(_0xf587('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xf587('0x1'));var rs=require(_0xf587('0x2'));var fs=require('fs');var Redis=require(_0xf587('0x3'));var db=require(_0xf587('0x4'))['db'];var utils=require(_0xf587('0x5'));var logger=require(_0xf587('0x6'))(_0xf587('0x7'));var config=require(_0xf587('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x427102,_0x59de86,_0x1a95c2){return new BPromise(function(_0x2aaf77,_0x43153c){return client['request'](_0x427102,_0x1a95c2)['then'](function(_0x1e3220){logger['info'](_0xf587('0x9'),_0x59de86,_0xf587('0xa'));logger['debug']('ZohoConfiguration,\x20%s,\x20%s,\x20%s',_0x59de86,_0xf587('0xa'),JSON[_0xf587('0xb')](_0x1e3220));if(_0x1e3220[_0xf587('0xc')]){if(_0x1e3220['error'][_0xf587('0xd')]===0x1f4){logger[_0xf587('0xc')](_0xf587('0x9'),_0x59de86,_0x1e3220[_0xf587('0xc')]['message']);return _0x43153c(_0x1e3220[_0xf587('0xc')][_0xf587('0xe')]);}logger[_0xf587('0xc')]('ZohoConfiguration,\x20%s,\x20%s',_0x59de86,_0x1e3220[_0xf587('0xc')][_0xf587('0xe')]);return _0x2aaf77(_0x1e3220[_0xf587('0xc')]['message']);}else{logger[_0xf587('0xf')]('ZohoConfiguration,\x20%s,\x20%s',_0x59de86,_0xf587('0xa'));_0x2aaf77(_0x1e3220[_0xf587('0x10')][_0xf587('0xe')]);}})[_0xf587('0x11')](function(_0x1d5652){logger['error'](_0xf587('0x9'),_0x59de86,_0x1d5652);_0x43153c(_0x1d5652);});});} \ No newline at end of file +var _0xc9bc=['util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','ZohoConfiguration,\x20%s,\x20%s','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','lodash'];(function(_0x2a3ed6,_0x8527c6){var _0x546abb=function(_0x29fb0c){while(--_0x29fb0c){_0x2a3ed6['push'](_0x2a3ed6['shift']());}};_0x546abb(++_0x8527c6);}(_0xc9bc,0xfc));var _0xcc9b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc9bc[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xcc9b('0x0'));var util=require(_0xcc9b('0x1'));var moment=require(_0xcc9b('0x2'));var BPromise=require('bluebird');var rs=require(_0xcc9b('0x3'));var fs=require('fs');var Redis=require(_0xcc9b('0x4'));var db=require(_0xcc9b('0x5'))['db'];var utils=require(_0xcc9b('0x6'));var logger=require(_0xcc9b('0x7'))('rpc');var config=require(_0xcc9b('0x8'));var jayson=require(_0xcc9b('0x9'));var client=jayson['client'][_0xcc9b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3930b0,_0x59ebe4,_0xdf61da){return new BPromise(function(_0x3e6894,_0x3c9741){return client[_0xcc9b('0xb')](_0x3930b0,_0xdf61da)[_0xcc9b('0xc')](function(_0x2f0001){logger[_0xcc9b('0xd')](_0xcc9b('0xe'),_0x59ebe4,'request\x20sent');logger[_0xcc9b('0xf')](_0xcc9b('0x10'),_0x59ebe4,'request\x20sent',JSON[_0xcc9b('0x11')](_0x2f0001));if(_0x2f0001[_0xcc9b('0x12')]){if(_0x2f0001['error']['code']===0x1f4){logger[_0xcc9b('0x12')](_0xcc9b('0xe'),_0x59ebe4,_0x2f0001[_0xcc9b('0x12')][_0xcc9b('0x13')]);return _0x3c9741(_0x2f0001[_0xcc9b('0x12')][_0xcc9b('0x13')]);}logger[_0xcc9b('0x12')](_0xcc9b('0xe'),_0x59ebe4,_0x2f0001[_0xcc9b('0x12')]['message']);return _0x3e6894(_0x2f0001[_0xcc9b('0x12')][_0xcc9b('0x13')]);}else{logger[_0xcc9b('0xd')]('ZohoConfiguration,\x20%s,\x20%s',_0x59ebe4,_0xcc9b('0x14'));_0x3e6894(_0x2f0001[_0xcc9b('0x15')][_0xcc9b('0x13')]);}})[_0xcc9b('0x16')](function(_0x28b318){logger['error'](_0xcc9b('0xe'),_0x59ebe4,_0x28b318);_0x3c9741(_0x28b318);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index e650b1f..4078d96 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 _0x9d83=['Router','../../components/auth/service','../../config/environment','./intZohoField.controller','get','isAuthenticated','index','/:id','show','post','put','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x3bab7e,_0x2d9c59){var _0x31d6e7=function(_0x362771){while(--_0x362771){_0x3bab7e['push'](_0x3bab7e['shift']());}};_0x31d6e7(++_0x2d9c59);}(_0x9d83,0x8c));var _0x39d8=function(_0x10d3c2,_0x1f5142){_0x10d3c2=_0x10d3c2-0x0;var _0x4208aa=_0x9d83[_0x10d3c2];return _0x4208aa;};'use strict';var multer=require(_0x39d8('0x0'));var util=require(_0x39d8('0x1'));var path=require(_0x39d8('0x2'));var timeout=require(_0x39d8('0x3'));var express=require('express');var router=express[_0x39d8('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x39d8('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x39d8('0x6'));var controller=require(_0x39d8('0x7'));router[_0x39d8('0x8')]('/',auth[_0x39d8('0x9')](),controller[_0x39d8('0xa')]);router['get'](_0x39d8('0xb'),auth[_0x39d8('0x9')](),controller[_0x39d8('0xc')]);router[_0x39d8('0xd')]('/',auth[_0x39d8('0x9')](),controller['create']);router[_0x39d8('0xe')](_0x39d8('0xb'),auth[_0x39d8('0x9')](),controller['update']);router[_0x39d8('0xf')](_0x39d8('0xb'),auth[_0x39d8('0x9')](),controller[_0x39d8('0x10')]);module[_0x39d8('0x11')]=router; \ No newline at end of file +var _0x97f2=['path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intZohoField.controller','get','isAuthenticated','index','/:id','show','create','update','delete','destroy','exports','multer','util'];(function(_0x192cff,_0x361327){var _0x20d2f6=function(_0x37baf9){while(--_0x37baf9){_0x192cff['push'](_0x192cff['shift']());}};_0x20d2f6(++_0x361327);}(_0x97f2,0xda));var _0x297f=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x97f2[_0x57b54c];return _0x59cc19;};'use strict';var multer=require(_0x297f('0x0'));var util=require(_0x297f('0x1'));var path=require(_0x297f('0x2'));var timeout=require(_0x297f('0x3'));var express=require(_0x297f('0x4'));var router=express[_0x297f('0x5')]();var fs_extra=require(_0x297f('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x297f('0x7'));var config=require(_0x297f('0x8'));var controller=require(_0x297f('0x9'));router[_0x297f('0xa')]('/',auth[_0x297f('0xb')](),controller[_0x297f('0xc')]);router[_0x297f('0xa')](_0x297f('0xd'),auth[_0x297f('0xb')](),controller[_0x297f('0xe')]);router['post']('/',auth[_0x297f('0xb')](),controller[_0x297f('0xf')]);router['put'](_0x297f('0xd'),auth[_0x297f('0xb')](),controller[_0x297f('0x10')]);router[_0x297f('0x11')](_0x297f('0xd'),auth['isAuthenticated'](),controller[_0x297f('0x12')]);module[_0x297f('0x13')]=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index ff07f5b..7536e98 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 _0xf2b4=['string','sequelize','exports','ENUM','variable','customVariable','keyValue','picklist','STRING'];(function(_0x53f04f,_0x419aa8){var _0x16a824=function(_0x5712c9){while(--_0x5712c9){_0x53f04f['push'](_0x53f04f['shift']());}};_0x16a824(++_0x419aa8);}(_0xf2b4,0xac));var _0x4f2b=function(_0xae69f9,_0x5eff17){_0xae69f9=_0xae69f9-0x0;var _0x3ce88a=_0xf2b4[_0xae69f9];return _0x3ce88a;};'use strict';var Sequelize=require(_0x4f2b('0x0'));module[_0x4f2b('0x1')]={'type':{'type':Sequelize[_0x4f2b('0x2')]('string',_0x4f2b('0x3'),_0x4f2b('0x4'),_0x4f2b('0x5'),_0x4f2b('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0x4f2b('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x4f2b('0x2')](_0x4f2b('0x8'),_0x4f2b('0x3'),_0x4f2b('0x4'))},'keyContent':{'type':Sequelize[_0x4f2b('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x4f2b('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x4f2b('0x7')]}}; \ No newline at end of file +var _0x3597=['customVariable','keyValue','picklist','STRING','ENUM','variable','BOOLEAN','sequelize','exports','string'];(function(_0xe6036b,_0x57ced5){var _0x9dd9e=function(_0x413feb){while(--_0x413feb){_0xe6036b['push'](_0xe6036b['shift']());}};_0x9dd9e(++_0x57ced5);}(_0x3597,0xc5));var _0x7359=function(_0x1c0a79,_0x44a85c){_0x1c0a79=_0x1c0a79-0x0;var _0x385de0=_0x3597[_0x1c0a79];return _0x385de0;};'use strict';var Sequelize=require(_0x7359('0x0'));module[_0x7359('0x1')]={'type':{'type':Sequelize['ENUM'](_0x7359('0x2'),'variable',_0x7359('0x3'),_0x7359('0x4'),_0x7359('0x5')),'defaultValue':_0x7359('0x2')},'content':{'type':Sequelize[_0x7359('0x6')]},'key':{'type':Sequelize[_0x7359('0x6')]},'keyType':{'type':Sequelize[_0x7359('0x7')]('string',_0x7359('0x8'),_0x7359('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x7359('0x6')]},'customField':{'type':Sequelize[_0x7359('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x7359('0x6')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index abb4322..11ff000 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 _0xd630=['../../config/utils','../../config/license/util','../../mysqldb','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','name','index','map','ZohoField','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','limit','order','sort','where','pick','filter','merge','VIRTUAL','include','findAll','rows','catch','includeAll','options','create','body','find','params','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','fs-extra','lodash','squel','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api'];(function(_0x31fb0f,_0x4ce59e){var _0x38cb14=function(_0x4b0cfc){while(--_0x4b0cfc){_0x31fb0f['push'](_0x31fb0f['shift']());}};_0x38cb14(++_0x4ce59e);}(_0xd630,0x102));var _0x0d63=function(_0x488905,_0x2958e3){_0x488905=_0x488905-0x0;var _0x44106c=_0xd630[_0x488905];return _0x44106c;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x0d63('0x0'));var jsonpatch=require(_0x0d63('0x1'));var rp=require(_0x0d63('0x2'));var moment=require(_0x0d63('0x3'));var BPromise=require(_0x0d63('0x4'));var Mustache=require('mustache');var util=require(_0x0d63('0x5'));var path=require('path');var sox=require(_0x0d63('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0d63('0x7'));var _=require(_0x0d63('0x8'));var squel=require(_0x0d63('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0d63('0xa'));var toCsv=require(_0x0d63('0xb'));var querystring=require(_0x0d63('0xc'));var Papa=require(_0x0d63('0xd'));var Redis=require('ioredis');var authService=require(_0x0d63('0xe'));var qs=require(_0x0d63('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0d63('0x10'));var logger=require('../../config/logger')(_0x0d63('0x11'));var utils=require(_0x0d63('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x0d63('0x13'));var db=require(_0x0d63('0x14'))['db'];function respondWithStatusCode(_0x476d0a,_0x3f1ff7){_0x3f1ff7=_0x3f1ff7||0xcc;return function(_0x562fee){if(_0x562fee){return _0x476d0a['sendStatus'](_0x3f1ff7);}return _0x476d0a[_0x0d63('0x15')](_0x3f1ff7)[_0x0d63('0x16')]();};}function respondWithResult(_0x472abe,_0x306a7f){_0x306a7f=_0x306a7f||0xc8;return function(_0x122751){if(_0x122751){return _0x472abe['status'](_0x306a7f)[_0x0d63('0x17')](_0x122751);}};}function respondWithFilteredResult(_0x4c8d93,_0x5cd7f9){return function(_0x20c12b){if(_0x20c12b){var _0x74e654=typeof _0x5cd7f9['offset']==='undefined'&&typeof _0x5cd7f9['limit']==='undefined';var _0x1c4833=_0x20c12b[_0x0d63('0x18')];var _0x3bb634=_0x74e654?0x0:_0x5cd7f9[_0x0d63('0x19')];var _0x58c479=_0x74e654?_0x20c12b[_0x0d63('0x18')]:_0x5cd7f9[_0x0d63('0x19')]+_0x5cd7f9['limit'];var _0x1a39ae;if(_0x58c479>=_0x1c4833){_0x58c479=_0x1c4833;_0x1a39ae=0xc8;}else{_0x1a39ae=0xce;}_0x4c8d93[_0x0d63('0x15')](_0x1a39ae);return _0x4c8d93[_0x0d63('0x1a')](_0x0d63('0x1b'),_0x3bb634+'-'+_0x58c479+'/'+_0x1c4833)[_0x0d63('0x17')](_0x20c12b);}return null;};}function patchUpdates(_0x53a5ce){return function(_0x1e70bb){try{jsonpatch[_0x0d63('0x1c')](_0x1e70bb,_0x53a5ce,!![]);}catch(_0xdf7a6e){return BPromise[_0x0d63('0x1d')](_0xdf7a6e);}return _0x1e70bb[_0x0d63('0x1e')]();};}function saveUpdates(_0x58b8b7,_0x17a8a2){return function(_0xd6d184){if(_0xd6d184){return _0xd6d184[_0x0d63('0x1f')](_0x58b8b7)[_0x0d63('0x20')](function(_0x638de6){return _0x638de6;});}return null;};}function removeEntity(_0xbf6489,_0x131478){return function(_0x5b92a0){if(_0x5b92a0){return _0x5b92a0[_0x0d63('0x21')]()[_0x0d63('0x20')](function(){_0xbf6489['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x10821b,_0x55d75f){return function(_0x1e3880){if(!_0x1e3880){_0x10821b[_0x0d63('0x22')](0x194);}return _0x1e3880;};}function handleError(_0x55c522,_0x56b2f9){_0x56b2f9=_0x56b2f9||0x1f4;return function(_0x344b09){logger['error'](_0x344b09[_0x0d63('0x23')]);if(_0x344b09[_0x0d63('0x24')]){delete _0x344b09[_0x0d63('0x24')];}_0x55c522['status'](_0x56b2f9)['send'](_0x344b09);};}exports[_0x0d63('0x25')]=function(_0x7d7c74,_0x12b33e){var _0x1cf0e0={},_0x466d3f={},_0xd29856={'count':0x0,'rows':[]};var _0x2b7ba2=_[_0x0d63('0x26')](db[_0x0d63('0x27')][_0x0d63('0x28')],function(_0x38ab77){return{'name':_0x38ab77['fieldName'],'type':_0x38ab77[_0x0d63('0x29')][_0x0d63('0x2a')]};});_0x466d3f[_0x0d63('0x2b')]=_[_0x0d63('0x26')](_0x2b7ba2,_0x0d63('0x24'));_0x466d3f[_0x0d63('0x2c')]=_[_0x0d63('0x2d')](_0x7d7c74[_0x0d63('0x2c')]);_0x466d3f[_0x0d63('0x2e')]=_[_0x0d63('0x2f')](_0x466d3f[_0x0d63('0x2b')],_0x466d3f[_0x0d63('0x2c')]);_0x1cf0e0['attributes']=_[_0x0d63('0x2f')](_0x466d3f[_0x0d63('0x2b')],qs[_0x0d63('0x30')](_0x7d7c74['query'][_0x0d63('0x30')]));_0x1cf0e0[_0x0d63('0x31')]=_0x1cf0e0[_0x0d63('0x31')][_0x0d63('0x32')]?_0x1cf0e0[_0x0d63('0x31')]:_0x466d3f['model'];if(!_0x7d7c74[_0x0d63('0x2c')]['hasOwnProperty']('nolimit')){_0x1cf0e0[_0x0d63('0x33')]=qs[_0x0d63('0x33')](_0x7d7c74[_0x0d63('0x2c')]['limit']);_0x1cf0e0[_0x0d63('0x19')]=qs['offset'](_0x7d7c74[_0x0d63('0x2c')][_0x0d63('0x19')]);}_0x1cf0e0[_0x0d63('0x34')]=qs[_0x0d63('0x35')](_0x7d7c74[_0x0d63('0x2c')][_0x0d63('0x35')]);_0x1cf0e0[_0x0d63('0x36')]=qs[_0x0d63('0x2e')](_[_0x0d63('0x37')](_0x7d7c74[_0x0d63('0x2c')],_0x466d3f[_0x0d63('0x2e')]),_0x2b7ba2);if(_0x7d7c74[_0x0d63('0x2c')][_0x0d63('0x38')]){_0x1cf0e0[_0x0d63('0x36')]=_[_0x0d63('0x39')](_0x1cf0e0[_0x0d63('0x36')],{'$or':_[_0x0d63('0x26')](_0x2b7ba2,function(_0x200c45){if(_0x200c45[_0x0d63('0x29')]!==_0x0d63('0x3a')){var _0x38f2d4={};_0x38f2d4[_0x200c45[_0x0d63('0x24')]]={'$like':'%'+_0x7d7c74[_0x0d63('0x2c')][_0x0d63('0x38')]+'%'};return _0x38f2d4;}})});}_0x1cf0e0=_[_0x0d63('0x39')]({},_0x1cf0e0,_0x7d7c74['options']);var _0x5c86b1={'where':_0x1cf0e0[_0x0d63('0x36')]};return db[_0x0d63('0x27')][_0x0d63('0x18')](_0x5c86b1)[_0x0d63('0x20')](function(_0x4efec7){_0xd29856[_0x0d63('0x18')]=_0x4efec7;if(_0x7d7c74[_0x0d63('0x2c')]['includeAll']){_0x1cf0e0[_0x0d63('0x3b')]=[{'all':!![]}];}return db[_0x0d63('0x27')][_0x0d63('0x3c')](_0x1cf0e0);})['then'](function(_0x27f68a){_0xd29856[_0x0d63('0x3d')]=_0x27f68a;return _0xd29856;})[_0x0d63('0x20')](respondWithFilteredResult(_0x12b33e,_0x1cf0e0))[_0x0d63('0x3e')](handleError(_0x12b33e,null));};exports['show']=function(_0x24972c,_0x4911ac){var _0x652e8f={'raw':!![],'where':{'id':_0x24972c['params']['id']}},_0x30bb30={};_0x30bb30['model']=_['keys'](db[_0x0d63('0x27')]['rawAttributes']);_0x30bb30[_0x0d63('0x2c')]=_['keys'](_0x24972c[_0x0d63('0x2c')]);_0x30bb30[_0x0d63('0x2e')]=_[_0x0d63('0x2f')](_0x30bb30[_0x0d63('0x2b')],_0x30bb30[_0x0d63('0x2c')]);_0x652e8f[_0x0d63('0x31')]=_[_0x0d63('0x2f')](_0x30bb30['model'],qs[_0x0d63('0x30')](_0x24972c[_0x0d63('0x2c')][_0x0d63('0x30')]));_0x652e8f[_0x0d63('0x31')]=_0x652e8f[_0x0d63('0x31')][_0x0d63('0x32')]?_0x652e8f[_0x0d63('0x31')]:_0x30bb30[_0x0d63('0x2b')];if(_0x24972c['query'][_0x0d63('0x3f')]){_0x652e8f[_0x0d63('0x3b')]=[{'all':!![]}];}_0x652e8f=_[_0x0d63('0x39')]({},_0x652e8f,_0x24972c[_0x0d63('0x40')]);return db[_0x0d63('0x27')]['find'](_0x652e8f)[_0x0d63('0x20')](handleEntityNotFound(_0x4911ac,null))['then'](respondWithResult(_0x4911ac,null))[_0x0d63('0x3e')](handleError(_0x4911ac,null));};exports[_0x0d63('0x41')]=function(_0x27a646,_0x1436dd){return db[_0x0d63('0x27')]['create'](_0x27a646['body'],{})[_0x0d63('0x20')](respondWithResult(_0x1436dd,0xc9))[_0x0d63('0x3e')](handleError(_0x1436dd,null));};exports[_0x0d63('0x1f')]=function(_0x1cf36a,_0x1fdeb1){if(_0x1cf36a[_0x0d63('0x42')]['id']){delete _0x1cf36a[_0x0d63('0x42')]['id'];}return db[_0x0d63('0x27')][_0x0d63('0x43')]({'where':{'id':_0x1cf36a[_0x0d63('0x44')]['id']}})[_0x0d63('0x20')](handleEntityNotFound(_0x1fdeb1,null))[_0x0d63('0x20')](saveUpdates(_0x1cf36a[_0x0d63('0x42')],null))[_0x0d63('0x20')](respondWithResult(_0x1fdeb1,null))[_0x0d63('0x3e')](handleError(_0x1fdeb1,null));};exports[_0x0d63('0x21')]=function(_0x4b9450,_0x55f27a){return db['ZohoField']['find']({'where':{'id':_0x4b9450['params']['id']}})[_0x0d63('0x20')](handleEntityNotFound(_0x55f27a,null))[_0x0d63('0x20')](removeEntity(_0x55f27a,null))[_0x0d63('0x3e')](handleError(_0x55f27a,null));}; \ No newline at end of file +var _0x6554=['moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','offset','order','sort','where','merge','map','filter','options','ZohoField','count','includeAll','findAll','catch','show','params','length','include','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x6def1a,_0x5b55f5){var _0x533d71=function(_0x3da7f6){while(--_0x3da7f6){_0x6def1a['push'](_0x6def1a['shift']());}};_0x533d71(++_0x5b55f5);}(_0x6554,0x181));var _0x4655=function(_0x2b4d37,_0x5d5a18){_0x2b4d37=_0x2b4d37-0x0;var _0x4e50df=_0x6554[_0x2b4d37];return _0x4e50df;};'use strict';var emlformat=require(_0x4655('0x0'));var rimraf=require(_0x4655('0x1'));var zipdir=require(_0x4655('0x2'));var jsonpatch=require(_0x4655('0x3'));var rp=require(_0x4655('0x4'));var moment=require(_0x4655('0x5'));var BPromise=require(_0x4655('0x6'));var Mustache=require(_0x4655('0x7'));var util=require(_0x4655('0x8'));var path=require(_0x4655('0x9'));var sox=require(_0x4655('0xa'));var csv=require(_0x4655('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4655('0xc'));var _=require(_0x4655('0xd'));var squel=require(_0x4655('0xe'));var crypto=require(_0x4655('0xf'));var jsforce=require(_0x4655('0x10'));var deskjs=require(_0x4655('0x11'));var toCsv=require(_0x4655('0xb'));var querystring=require(_0x4655('0x12'));var Papa=require(_0x4655('0x13'));var Redis=require('ioredis');var authService=require(_0x4655('0x14'));var qs=require(_0x4655('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x4655('0x16'));var utils=require(_0x4655('0x17'));var config=require(_0x4655('0x18'));var licenseUtil=require(_0x4655('0x19'));var db=require(_0x4655('0x1a'))['db'];function respondWithStatusCode(_0x17b5ec,_0x593a3d){_0x593a3d=_0x593a3d||0xcc;return function(_0x58254b){if(_0x58254b){return _0x17b5ec[_0x4655('0x1b')](_0x593a3d);}return _0x17b5ec[_0x4655('0x1c')](_0x593a3d)[_0x4655('0x1d')]();};}function respondWithResult(_0x1a0bd3,_0x3414b1){_0x3414b1=_0x3414b1||0xc8;return function(_0x3dc6f4){if(_0x3dc6f4){return _0x1a0bd3[_0x4655('0x1c')](_0x3414b1)[_0x4655('0x1e')](_0x3dc6f4);}};}function respondWithFilteredResult(_0x155345,_0x5bd152){return function(_0x12baa3){if(_0x12baa3){var _0x600fc5=typeof _0x5bd152['offset']===_0x4655('0x1f')&&typeof _0x5bd152[_0x4655('0x20')]==='undefined';var _0x5f50f0=_0x12baa3['count'];var _0x313688=_0x600fc5?0x0:_0x5bd152['offset'];var _0x3dcc5d=_0x600fc5?_0x12baa3['count']:_0x5bd152['offset']+_0x5bd152['limit'];var _0x2c700a;if(_0x3dcc5d>=_0x5f50f0){_0x3dcc5d=_0x5f50f0;_0x2c700a=0xc8;}else{_0x2c700a=0xce;}_0x155345[_0x4655('0x1c')](_0x2c700a);return _0x155345[_0x4655('0x21')](_0x4655('0x22'),_0x313688+'-'+_0x3dcc5d+'/'+_0x5f50f0)['json'](_0x12baa3);}return null;};}function patchUpdates(_0x4013f2){return function(_0x3cd8af){try{jsonpatch[_0x4655('0x23')](_0x3cd8af,_0x4013f2,!![]);}catch(_0x5a2869){return BPromise[_0x4655('0x24')](_0x5a2869);}return _0x3cd8af[_0x4655('0x25')]();};}function saveUpdates(_0x7fdd6e,_0x3ec4b6){return function(_0x27b5ec){if(_0x27b5ec){return _0x27b5ec[_0x4655('0x26')](_0x7fdd6e)[_0x4655('0x27')](function(_0x4af6b6){return _0x4af6b6;});}return null;};}function removeEntity(_0x156ab5,_0x4a8843){return function(_0x49d35e){if(_0x49d35e){return _0x49d35e[_0x4655('0x28')]()[_0x4655('0x27')](function(){_0x156ab5[_0x4655('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x38fb70,_0x277512){return function(_0x12b751){if(!_0x12b751){_0x38fb70[_0x4655('0x1b')](0x194);}return _0x12b751;};}function handleError(_0x2f6a83,_0x139b1b){_0x139b1b=_0x139b1b||0x1f4;return function(_0x311fcf){logger[_0x4655('0x29')](_0x311fcf['stack']);if(_0x311fcf[_0x4655('0x2a')]){delete _0x311fcf[_0x4655('0x2a')];}_0x2f6a83[_0x4655('0x1c')](_0x139b1b)[_0x4655('0x2b')](_0x311fcf);};}exports[_0x4655('0x2c')]=function(_0x2bcc5a,_0x216e0a){var _0x143177={},_0x170640={},_0x1612f={'count':0x0,'rows':[]};var _0x1aefda=_['map'](db['ZohoField'][_0x4655('0x2d')],function(_0x2e6c6b){return{'name':_0x2e6c6b[_0x4655('0x2e')],'type':_0x2e6c6b[_0x4655('0x2f')][_0x4655('0x30')]};});_0x170640[_0x4655('0x31')]=_['map'](_0x1aefda,_0x4655('0x2a'));_0x170640['query']=_[_0x4655('0x32')](_0x2bcc5a[_0x4655('0x33')]);_0x170640[_0x4655('0x34')]=_[_0x4655('0x35')](_0x170640[_0x4655('0x31')],_0x170640[_0x4655('0x33')]);_0x143177[_0x4655('0x36')]=_[_0x4655('0x35')](_0x170640['model'],qs[_0x4655('0x37')](_0x2bcc5a[_0x4655('0x33')][_0x4655('0x37')]));_0x143177[_0x4655('0x36')]=_0x143177[_0x4655('0x36')]['length']?_0x143177[_0x4655('0x36')]:_0x170640[_0x4655('0x31')];if(!_0x2bcc5a[_0x4655('0x33')][_0x4655('0x38')](_0x4655('0x39'))){_0x143177['limit']=qs[_0x4655('0x20')](_0x2bcc5a[_0x4655('0x33')][_0x4655('0x20')]);_0x143177['offset']=qs[_0x4655('0x3a')](_0x2bcc5a[_0x4655('0x33')][_0x4655('0x3a')]);}_0x143177[_0x4655('0x3b')]=qs[_0x4655('0x3c')](_0x2bcc5a[_0x4655('0x33')][_0x4655('0x3c')]);_0x143177[_0x4655('0x3d')]=qs[_0x4655('0x34')](_['pick'](_0x2bcc5a[_0x4655('0x33')],_0x170640[_0x4655('0x34')]),_0x1aefda);if(_0x2bcc5a['query']['filter']){_0x143177[_0x4655('0x3d')]=_[_0x4655('0x3e')](_0x143177[_0x4655('0x3d')],{'$or':_[_0x4655('0x3f')](_0x1aefda,function(_0x5081cb){if(_0x5081cb[_0x4655('0x2f')]!=='VIRTUAL'){var _0x18851a={};_0x18851a[_0x5081cb[_0x4655('0x2a')]]={'$like':'%'+_0x2bcc5a['query'][_0x4655('0x40')]+'%'};return _0x18851a;}})});}_0x143177=_[_0x4655('0x3e')]({},_0x143177,_0x2bcc5a[_0x4655('0x41')]);var _0x559acc={'where':_0x143177[_0x4655('0x3d')]};return db[_0x4655('0x42')][_0x4655('0x43')](_0x559acc)[_0x4655('0x27')](function(_0x3f6da6){_0x1612f['count']=_0x3f6da6;if(_0x2bcc5a[_0x4655('0x33')][_0x4655('0x44')]){_0x143177['include']=[{'all':!![]}];}return db[_0x4655('0x42')][_0x4655('0x45')](_0x143177);})[_0x4655('0x27')](function(_0x2a1be5){_0x1612f['rows']=_0x2a1be5;return _0x1612f;})['then'](respondWithFilteredResult(_0x216e0a,_0x143177))[_0x4655('0x46')](handleError(_0x216e0a,null));};exports[_0x4655('0x47')]=function(_0x51feca,_0x1ee404){var _0x3cfef2={'raw':!![],'where':{'id':_0x51feca[_0x4655('0x48')]['id']}},_0x98c1e1={};_0x98c1e1['model']=_['keys'](db[_0x4655('0x42')]['rawAttributes']);_0x98c1e1['query']=_[_0x4655('0x32')](_0x51feca[_0x4655('0x33')]);_0x98c1e1[_0x4655('0x34')]=_[_0x4655('0x35')](_0x98c1e1[_0x4655('0x31')],_0x98c1e1[_0x4655('0x33')]);_0x3cfef2[_0x4655('0x36')]=_[_0x4655('0x35')](_0x98c1e1[_0x4655('0x31')],qs[_0x4655('0x37')](_0x51feca[_0x4655('0x33')][_0x4655('0x37')]));_0x3cfef2[_0x4655('0x36')]=_0x3cfef2[_0x4655('0x36')][_0x4655('0x49')]?_0x3cfef2['attributes']:_0x98c1e1[_0x4655('0x31')];if(_0x51feca[_0x4655('0x33')][_0x4655('0x44')]){_0x3cfef2[_0x4655('0x4a')]=[{'all':!![]}];}_0x3cfef2=_['merge']({},_0x3cfef2,_0x51feca[_0x4655('0x41')]);return db[_0x4655('0x42')][_0x4655('0x4b')](_0x3cfef2)['then'](handleEntityNotFound(_0x1ee404,null))[_0x4655('0x27')](respondWithResult(_0x1ee404,null))[_0x4655('0x46')](handleError(_0x1ee404,null));};exports[_0x4655('0x4c')]=function(_0x11e9c9,_0x5825eb){return db[_0x4655('0x42')][_0x4655('0x4c')](_0x11e9c9[_0x4655('0x4d')],{})[_0x4655('0x27')](respondWithResult(_0x5825eb,0xc9))[_0x4655('0x46')](handleError(_0x5825eb,null));};exports[_0x4655('0x26')]=function(_0x3d65fb,_0x13057c){if(_0x3d65fb['body']['id']){delete _0x3d65fb[_0x4655('0x4d')]['id'];}return db[_0x4655('0x42')][_0x4655('0x4b')]({'where':{'id':_0x3d65fb[_0x4655('0x48')]['id']}})['then'](handleEntityNotFound(_0x13057c,null))[_0x4655('0x27')](saveUpdates(_0x3d65fb['body'],null))[_0x4655('0x27')](respondWithResult(_0x13057c,null))[_0x4655('0x46')](handleError(_0x13057c,null));};exports['destroy']=function(_0x7c20cc,_0x133d85){return db[_0x4655('0x42')][_0x4655('0x4b')]({'where':{'id':_0x7c20cc[_0x4655('0x48')]['id']}})[_0x4655('0x27')](handleEntityNotFound(_0x133d85,null))['then'](removeEntity(_0x133d85,null))[_0x4655('0x46')](handleError(_0x133d85,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index 1e13342..a2824a1 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 _0x81c6=['../../config/environment','./intZohoField.attributes','exports','define','ZohoField','idField','FieldId','util','bluebird','request-promise','path'];(function(_0x1e3b99,_0x2b6c9b){var _0x50729e=function(_0x4e4913){while(--_0x4e4913){_0x1e3b99['push'](_0x1e3b99['shift']());}};_0x50729e(++_0x2b6c9b);}(_0x81c6,0x1d5));var _0x681c=function(_0x3a27fd,_0x5357ea){_0x3a27fd=_0x3a27fd-0x0;var _0x2e519=_0x81c6[_0x3a27fd];return _0x2e519;};'use strict';var _=require('lodash');var util=require(_0x681c('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x681c('0x1'));var rp=require(_0x681c('0x2'));var fs=require('fs');var path=require(_0x681c('0x3'));var rimraf=require('rimraf');var config=require(_0x681c('0x4'));var attributes=require(_0x681c('0x5'));module[_0x681c('0x6')]=function(_0x1d31c8,_0x4ea522){return _0x1d31c8[_0x681c('0x7')](_0x681c('0x8'),attributes,{'tableName':'int_zoho_fields','paranoid':![],'indexes':[{'name':'zoho_unique_index','fields':[_0x681c('0x9'),_0x681c('0xa')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf2e3=['request-promise','path','rimraf','../../config/environment','./intZohoField.attributes','define','ZohoField','int_zoho_fields','zoho_unique_index','idField','FieldId','lodash','../../config/logger','api','moment','bluebird'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0xf2e3,0x9b));var _0x3f2e=function(_0x24f31b,_0x44b8f3){_0x24f31b=_0x24f31b-0x0;var _0x488401=_0xf2e3[_0x24f31b];return _0x488401;};'use strict';var _=require(_0x3f2e('0x0'));var util=require('util');var logger=require(_0x3f2e('0x1'))(_0x3f2e('0x2'));var moment=require(_0x3f2e('0x3'));var BPromise=require(_0x3f2e('0x4'));var rp=require(_0x3f2e('0x5'));var fs=require('fs');var path=require(_0x3f2e('0x6'));var rimraf=require(_0x3f2e('0x7'));var config=require(_0x3f2e('0x8'));var attributes=require(_0x3f2e('0x9'));module['exports']=function(_0x33a3b7,_0xdd6b3e){return _0x33a3b7[_0x3f2e('0xa')](_0x3f2e('0xb'),attributes,{'tableName':_0x3f2e('0xc'),'paranoid':![],'indexes':[{'name':_0x3f2e('0xd'),'fields':[_0x3f2e('0xe'),_0x3f2e('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.rpc.js b/server/api/intZohoField/intZohoField.rpc.js index 55ed1c7..1101815 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 _0xffc7=['message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','client','http','request','then','ZohoField,\x20%s,\x20%s','request\x20sent','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0xba9855,_0x4b8e99){var _0x31c225=function(_0x16449f){while(--_0x16449f){_0xba9855['push'](_0xba9855['shift']());}};_0x31c225(++_0x4b8e99);}(_0xffc7,0x1cf));var _0x7ffc=function(_0x297386,_0x3514f2){_0x297386=_0x297386-0x0;var _0x39be91=_0xffc7[_0x297386];return _0x39be91;};'use strict';var _=require(_0x7ffc('0x0'));var util=require(_0x7ffc('0x1'));var moment=require(_0x7ffc('0x2'));var BPromise=require(_0x7ffc('0x3'));var rs=require(_0x7ffc('0x4'));var fs=require('fs');var Redis=require(_0x7ffc('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x7ffc('0x6'))(_0x7ffc('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x7ffc('0x8')][_0x7ffc('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x48ce9b,_0x29699b,_0x1a12d8){return new BPromise(function(_0x422233,_0x38c659){return client[_0x7ffc('0xa')](_0x48ce9b,_0x1a12d8)[_0x7ffc('0xb')](function(_0x4a8c21){logger['info'](_0x7ffc('0xc'),_0x29699b,_0x7ffc('0xd'));logger['debug'](_0x7ffc('0xe'),_0x29699b,'request\x20sent',JSON[_0x7ffc('0xf')](_0x4a8c21));if(_0x4a8c21['error']){if(_0x4a8c21['error']['code']===0x1f4){logger[_0x7ffc('0x10')](_0x7ffc('0xc'),_0x29699b,_0x4a8c21[_0x7ffc('0x10')][_0x7ffc('0x11')]);return _0x38c659(_0x4a8c21[_0x7ffc('0x10')]['message']);}logger[_0x7ffc('0x10')]('ZohoField,\x20%s,\x20%s',_0x29699b,_0x4a8c21[_0x7ffc('0x10')][_0x7ffc('0x11')]);return _0x422233(_0x4a8c21[_0x7ffc('0x10')]['message']);}else{logger['info']('ZohoField,\x20%s,\x20%s',_0x29699b,_0x7ffc('0xd'));_0x422233(_0x4a8c21[_0x7ffc('0x12')][_0x7ffc('0x11')]);}})[_0x7ffc('0x13')](function(_0x4892de){logger[_0x7ffc('0x10')](_0x7ffc('0xc'),_0x29699b,_0x4892de);_0x38c659(_0x4892de);});});} \ No newline at end of file +var _0x61b5=['code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','then','info','ZohoField,\x20%s,\x20%s','debug','request\x20sent','stringify','error'];(function(_0x31ced5,_0x5d5415){var _0x10d9e5=function(_0x2e51a5){while(--_0x2e51a5){_0x31ced5['push'](_0x31ced5['shift']());}};_0x10d9e5(++_0x5d5415);}(_0x61b5,0x174));var _0x561b=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x61b5[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x561b('0x0'));var util=require(_0x561b('0x1'));var moment=require(_0x561b('0x2'));var BPromise=require(_0x561b('0x3'));var rs=require(_0x561b('0x4'));var fs=require('fs');var Redis=require(_0x561b('0x5'));var db=require(_0x561b('0x6'))['db'];var utils=require(_0x561b('0x7'));var logger=require('../../config/logger')(_0x561b('0x8'));var config=require(_0x561b('0x9'));var jayson=require(_0x561b('0xa'));var client=jayson['client'][_0x561b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x99040f,_0x37f60f,_0x38f3f7){return new BPromise(function(_0x5e27d0,_0x22abbd){return client['request'](_0x99040f,_0x38f3f7)[_0x561b('0xc')](function(_0x304d16){logger[_0x561b('0xd')](_0x561b('0xe'),_0x37f60f,'request\x20sent');logger[_0x561b('0xf')]('ZohoField,\x20%s,\x20%s,\x20%s',_0x37f60f,_0x561b('0x10'),JSON[_0x561b('0x11')](_0x304d16));if(_0x304d16[_0x561b('0x12')]){if(_0x304d16['error'][_0x561b('0x13')]===0x1f4){logger['error']('ZohoField,\x20%s,\x20%s',_0x37f60f,_0x304d16[_0x561b('0x12')][_0x561b('0x14')]);return _0x22abbd(_0x304d16['error'][_0x561b('0x14')]);}logger[_0x561b('0x12')](_0x561b('0xe'),_0x37f60f,_0x304d16[_0x561b('0x12')][_0x561b('0x14')]);return _0x5e27d0(_0x304d16['error'][_0x561b('0x14')]);}else{logger['info']('ZohoField,\x20%s,\x20%s',_0x37f60f,_0x561b('0x10'));_0x5e27d0(_0x304d16[_0x561b('0x15')][_0x561b('0x14')]);}})[_0x561b('0x16')](function(_0x254719){logger[_0x561b('0x12')](_0x561b('0xe'),_0x37f60f,_0x254719);_0x22abbd(_0x254719);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index a8866c3..c6ac760 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(_0x3666dc,_0x18701a){var _0x31c942=function(_0x315164){while(--_0x315164){_0x3666dc['push'](_0x3666dc['shift']());}};_0x31c942(++_0x18701a);}(_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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x180fda,_0x1af14f){var _0x3bddc9=function(_0x516a35){while(--_0x516a35){_0x180fda['push'](_0x180fda['shift']());}};_0x3bddc9(++_0x1af14f);}(_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 diff --git a/server/api/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index c579a7e..5384fb2 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 _0xcba4=['state','sequelize','exports','STRING','unique_name_and_version','BOOLEAN'];(function(_0x235280,_0x561233){var _0x243960=function(_0x3eba60){while(--_0x3eba60){_0x235280['push'](_0x235280['shift']());}};_0x243960(++_0x561233);}(_0xcba4,0x109));var _0x4cba=function(_0x450f8c,_0x525dc0){_0x450f8c=_0x450f8c-0x0;var _0x2abad5=_0xcba4[_0x450f8c];return _0x2abad5;};'use strict';var Sequelize=require(_0x4cba('0x0'));module[_0x4cba('0x1')]={'name':{'type':Sequelize[_0x4cba('0x2')],'allowNull':![],'unique':_0x4cba('0x3')},'version':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x4cba('0x3')},'main':{'type':Sequelize[_0x4cba('0x2')],'defaultValue':'app.js'},'filename':{'type':Sequelize[_0x4cba('0x2')]},'path':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x4cba('0x2')]},'size':{'type':Sequelize['INTEGER']},'active':{'type':Sequelize[_0x4cba('0x4')],'defaultValue':![]},'author':{'type':Sequelize[_0x4cba('0x2')]},'logo':{'type':Sequelize['STRING']},'state':{'type':Sequelize[_0x4cba('0x2')],'unique':_0x4cba('0x5')},'description':{'type':Sequelize[_0x4cba('0x2')]},'title':{'type':Sequelize[_0x4cba('0x2')]},'remoteUri':{'type':Sequelize[_0x4cba('0x2')]},'link':{'type':Sequelize[_0x4cba('0x2')],'defaultValue':'#'}}; \ No newline at end of file +var _0x85ae=['BOOLEAN','state','sequelize','exports','STRING','unique_name_and_version','app.js'];(function(_0x38066c,_0x5e59c3){var _0x2edf39=function(_0x51a315){while(--_0x51a315){_0x38066c['push'](_0x38066c['shift']());}};_0x2edf39(++_0x5e59c3);}(_0x85ae,0xf7));var _0xe85a=function(_0x5a7c48,_0x563f82){_0x5a7c48=_0x5a7c48-0x0;var _0x4c34e8=_0x85ae[_0x5a7c48];return _0x4c34e8;};'use strict';var Sequelize=require(_0xe85a('0x0'));module[_0xe85a('0x1')]={'name':{'type':Sequelize[_0xe85a('0x2')],'allowNull':![],'unique':_0xe85a('0x3')},'version':{'type':Sequelize[_0xe85a('0x2')],'allowNull':![],'unique':_0xe85a('0x3')},'main':{'type':Sequelize['STRING'],'defaultValue':_0xe85a('0x4')},'filename':{'type':Sequelize[_0xe85a('0x2')]},'path':{'type':Sequelize[_0xe85a('0x2')]},'type':{'type':Sequelize[_0xe85a('0x2')]},'size':{'type':Sequelize['INTEGER']},'active':{'type':Sequelize[_0xe85a('0x5')],'defaultValue':![]},'author':{'type':Sequelize['STRING']},'logo':{'type':Sequelize[_0xe85a('0x2')]},'state':{'type':Sequelize[_0xe85a('0x2')],'unique':_0xe85a('0x6')},'description':{'type':Sequelize[_0xe85a('0x2')]},'title':{'type':Sequelize[_0xe85a('0x2')]},'remoteUri':{'type':Sequelize[_0xe85a('0x2')]},'link':{'type':Sequelize[_0xe85a('0x2')],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index 43c6a5c..fe6c4ba 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 _0x57ca=['bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','status','json','offset','undefined','count','limit','set','apply','save','update','then','destroy','end','sendStatus','error','stack','name','index','map','Integration','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','options','includeAll','include','findAll','params','find','catch','create','body','rimraf','zip-dir','request-promise','moment'];(function(_0x599c65,_0x238677){var _0x55d187=function(_0x2d4f06){while(--_0x2d4f06){_0x599c65['push'](_0x599c65['shift']());}};_0x55d187(++_0x238677);}(_0x57ca,0x108));var _0xa57c=function(_0x447e2a,_0x473b66){_0x447e2a=_0x447e2a-0x0;var _0x54956a=_0x57ca[_0x447e2a];return _0x54956a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa57c('0x0'));var zipdir=require(_0xa57c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa57c('0x2'));var moment=require(_0xa57c('0x3'));var BPromise=require(_0xa57c('0x4'));var Mustache=require(_0xa57c('0x5'));var util=require(_0xa57c('0x6'));var path=require('path');var sox=require(_0xa57c('0x7'));var csv=require(_0xa57c('0x8'));var ejs=require(_0xa57c('0x9'));var fs=require('fs');var fs_extra=require(_0xa57c('0xa'));var _=require(_0xa57c('0xb'));var squel=require(_0xa57c('0xc'));var crypto=require(_0xa57c('0xd'));var jsforce=require(_0xa57c('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xa57c('0x8'));var querystring=require('querystring');var Papa=require(_0xa57c('0xf'));var Redis=require(_0xa57c('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xa57c('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa57c('0x12'));var logger=require(_0xa57c('0x13'))('api');var utils=require(_0xa57c('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xa57c('0x15'));var db=require(_0xa57c('0x16'))['db'];function respondWithStatusCode(_0x1f2bb5,_0x9e25bf){_0x9e25bf=_0x9e25bf||0xcc;return function(_0x205e72){if(_0x205e72){return _0x1f2bb5['sendStatus'](_0x9e25bf);}return _0x1f2bb5[_0xa57c('0x17')](_0x9e25bf)['end']();};}function respondWithResult(_0x30d23d,_0x3d5995){_0x3d5995=_0x3d5995||0xc8;return function(_0x30940d){if(_0x30940d){return _0x30d23d[_0xa57c('0x17')](_0x3d5995)[_0xa57c('0x18')](_0x30940d);}};}function respondWithFilteredResult(_0x37a323,_0x3f900a){return function(_0x4b4bdb){if(_0x4b4bdb){var _0x26607a=typeof _0x3f900a[_0xa57c('0x19')]===_0xa57c('0x1a')&&typeof _0x3f900a['limit']===_0xa57c('0x1a');var _0x5f33f1=_0x4b4bdb[_0xa57c('0x1b')];var _0x3d781d=_0x26607a?0x0:_0x3f900a[_0xa57c('0x19')];var _0xe3d505=_0x26607a?_0x4b4bdb[_0xa57c('0x1b')]:_0x3f900a[_0xa57c('0x19')]+_0x3f900a[_0xa57c('0x1c')];var _0x595c7a;if(_0xe3d505>=_0x5f33f1){_0xe3d505=_0x5f33f1;_0x595c7a=0xc8;}else{_0x595c7a=0xce;}_0x37a323['status'](_0x595c7a);return _0x37a323[_0xa57c('0x1d')]('Content-Range',_0x3d781d+'-'+_0xe3d505+'/'+_0x5f33f1)['json'](_0x4b4bdb);}return null;};}function patchUpdates(_0x418415){return function(_0xa5b314){try{jsonpatch[_0xa57c('0x1e')](_0xa5b314,_0x418415,!![]);}catch(_0x23bec0){return BPromise['reject'](_0x23bec0);}return _0xa5b314[_0xa57c('0x1f')]();};}function saveUpdates(_0x25715f,_0x34d1bc){return function(_0x2213b2){if(_0x2213b2){return _0x2213b2[_0xa57c('0x20')](_0x25715f)[_0xa57c('0x21')](function(_0x1e0192){return _0x1e0192;});}return null;};}function removeEntity(_0x42038e,_0x2e99ed){return function(_0xdf65dd){if(_0xdf65dd){return _0xdf65dd[_0xa57c('0x22')]()[_0xa57c('0x21')](function(){_0x42038e[_0xa57c('0x17')](0xcc)[_0xa57c('0x23')]();});}};}function handleEntityNotFound(_0x431bec,_0x511a26){return function(_0x2db443){if(!_0x2db443){_0x431bec[_0xa57c('0x24')](0x194);}return _0x2db443;};}function handleError(_0x27884d,_0x5228b9){_0x5228b9=_0x5228b9||0x1f4;return function(_0x315ad7){logger[_0xa57c('0x25')](_0x315ad7[_0xa57c('0x26')]);if(_0x315ad7[_0xa57c('0x27')]){delete _0x315ad7[_0xa57c('0x27')];}_0x27884d[_0xa57c('0x17')](_0x5228b9)['send'](_0x315ad7);};}exports[_0xa57c('0x28')]=function(_0x4c1478,_0x54a18b){var _0x257661={},_0x7d10ec={},_0x5a3e03={'count':0x0,'rows':[]};var _0x12898b=_[_0xa57c('0x29')](db[_0xa57c('0x2a')]['rawAttributes'],function(_0xd779f1){return{'name':_0xd779f1['fieldName'],'type':_0xd779f1[_0xa57c('0x2b')]['key']};});_0x7d10ec[_0xa57c('0x2c')]=_['map'](_0x12898b,_0xa57c('0x27'));_0x7d10ec['query']=_[_0xa57c('0x2d')](_0x4c1478[_0xa57c('0x2e')]);_0x7d10ec[_0xa57c('0x2f')]=_[_0xa57c('0x30')](_0x7d10ec[_0xa57c('0x2c')],_0x7d10ec[_0xa57c('0x2e')]);_0x257661[_0xa57c('0x31')]=_['intersection'](_0x7d10ec[_0xa57c('0x2c')],qs['fields'](_0x4c1478[_0xa57c('0x2e')][_0xa57c('0x32')]));_0x257661[_0xa57c('0x31')]=_0x257661['attributes'][_0xa57c('0x33')]?_0x257661['attributes']:_0x7d10ec[_0xa57c('0x2c')];if(!_0x4c1478['query'][_0xa57c('0x34')]('nolimit')){_0x257661[_0xa57c('0x1c')]=qs[_0xa57c('0x1c')](_0x4c1478['query'][_0xa57c('0x1c')]);_0x257661['offset']=qs[_0xa57c('0x19')](_0x4c1478['query'][_0xa57c('0x19')]);}_0x257661[_0xa57c('0x35')]=qs[_0xa57c('0x36')](_0x4c1478[_0xa57c('0x2e')][_0xa57c('0x36')]);_0x257661[_0xa57c('0x37')]=qs['filters'](_['pick'](_0x4c1478[_0xa57c('0x2e')],_0x7d10ec[_0xa57c('0x2f')]),_0x12898b);if(_0x4c1478[_0xa57c('0x2e')]['filter']){_0x257661[_0xa57c('0x37')]=_['merge'](_0x257661[_0xa57c('0x37')],{'$or':_[_0xa57c('0x29')](_0x12898b,function(_0x5c8256){if(_0x5c8256['type']!=='VIRTUAL'){var _0x3be888={};_0x3be888[_0x5c8256[_0xa57c('0x27')]]={'$like':'%'+_0x4c1478[_0xa57c('0x2e')][_0xa57c('0x38')]+'%'};return _0x3be888;}})});}_0x257661=_[_0xa57c('0x39')]({},_0x257661,_0x4c1478[_0xa57c('0x3a')]);var _0x5a444a={'where':_0x257661[_0xa57c('0x37')]};return db[_0xa57c('0x2a')]['count'](_0x5a444a)['then'](function(_0x5e10b){_0x5a3e03[_0xa57c('0x1b')]=_0x5e10b;if(_0x4c1478['query'][_0xa57c('0x3b')]){_0x257661[_0xa57c('0x3c')]=[{'all':!![]}];}return db[_0xa57c('0x2a')][_0xa57c('0x3d')](_0x257661);})[_0xa57c('0x21')](function(_0x43c1d7){_0x5a3e03['rows']=_0x43c1d7;return _0x5a3e03;})[_0xa57c('0x21')](respondWithFilteredResult(_0x54a18b,_0x257661))['catch'](handleError(_0x54a18b,null));};exports['show']=function(_0x5b3300,_0x520383){var _0x588199={'raw':![],'where':{'id':_0x5b3300[_0xa57c('0x3e')]['id']}},_0x39b20f={};_0x39b20f[_0xa57c('0x2c')]=_['keys'](db['Integration']['rawAttributes']);_0x39b20f[_0xa57c('0x2e')]=_[_0xa57c('0x2d')](_0x5b3300[_0xa57c('0x2e')]);_0x39b20f[_0xa57c('0x2f')]=_[_0xa57c('0x30')](_0x39b20f[_0xa57c('0x2c')],_0x39b20f['query']);_0x588199[_0xa57c('0x31')]=_[_0xa57c('0x30')](_0x39b20f[_0xa57c('0x2c')],qs[_0xa57c('0x32')](_0x5b3300[_0xa57c('0x2e')][_0xa57c('0x32')]));_0x588199['attributes']=_0x588199[_0xa57c('0x31')][_0xa57c('0x33')]?_0x588199[_0xa57c('0x31')]:_0x39b20f[_0xa57c('0x2c')];if(_0x5b3300[_0xa57c('0x2e')]['includeAll']){_0x588199[_0xa57c('0x3c')]=[{'all':!![]}];}_0x588199=_[_0xa57c('0x39')]({},_0x588199,_0x5b3300[_0xa57c('0x3a')]);return db[_0xa57c('0x2a')][_0xa57c('0x3f')](_0x588199)[_0xa57c('0x21')](handleEntityNotFound(_0x520383,null))['then'](respondWithResult(_0x520383,null))[_0xa57c('0x40')](handleError(_0x520383,null));};exports[_0xa57c('0x41')]=function(_0x247906,_0x44ea0a){return db[_0xa57c('0x2a')][_0xa57c('0x41')](_0x247906['body'],{})['then'](respondWithResult(_0x44ea0a,0xc9))['catch'](handleError(_0x44ea0a,null));};exports['update']=function(_0x232675,_0x49492f){if(_0x232675[_0xa57c('0x42')]['id']){delete _0x232675[_0xa57c('0x42')]['id'];}return db['Integration'][_0xa57c('0x3f')]({'where':{'id':_0x232675[_0xa57c('0x3e')]['id']}})[_0xa57c('0x21')](handleEntityNotFound(_0x49492f,null))[_0xa57c('0x21')](saveUpdates(_0x232675[_0xa57c('0x42')],null))['then'](respondWithResult(_0x49492f,null))[_0xa57c('0x40')](handleError(_0x49492f,null));};exports[_0xa57c('0x22')]=function(_0x4584e8,_0xd57bac){return db[_0xa57c('0x2a')]['find']({'where':{'id':_0x4584e8[_0xa57c('0x3e')]['id']}})['then'](handleEntityNotFound(_0xd57bac,null))['then'](removeEntity(_0xd57bac,null))[_0xa57c('0x40')](handleError(_0xd57bac,null));}; \ No newline at end of file +var _0xacf4=['VIRTUAL','merge','options','include','findAll','rows','catch','show','params','intersection','length','includeAll','find','create','body','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','update','then','destroy','error','stack','name','send','index','map','Integration','rawAttributes','fieldName','key','model','query','keys','filters','attributes','fields','hasOwnProperty','sort','where','pick','filter','type'];(function(_0x390083,_0x31ba26){var _0x41a4db=function(_0x2346f5){while(--_0x2346f5){_0x390083['push'](_0x390083['shift']());}};_0x41a4db(++_0x31ba26);}(_0xacf4,0xe7));var _0x4acf=function(_0x6051d0,_0x5b5734){_0x6051d0=_0x6051d0-0x0;var _0x14d313=_0xacf4[_0x6051d0];return _0x14d313;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x4acf('0x0'));var jsonpatch=require(_0x4acf('0x1'));var rp=require(_0x4acf('0x2'));var moment=require(_0x4acf('0x3'));var BPromise=require(_0x4acf('0x4'));var Mustache=require(_0x4acf('0x5'));var util=require(_0x4acf('0x6'));var path=require('path');var sox=require(_0x4acf('0x7'));var csv=require(_0x4acf('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4acf('0x9'));var _=require(_0x4acf('0xa'));var squel=require(_0x4acf('0xb'));var crypto=require(_0x4acf('0xc'));var jsforce=require(_0x4acf('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x4acf('0xe'));var Papa=require('papaparse');var Redis=require(_0x4acf('0xf'));var authService=require(_0x4acf('0x10'));var qs=require(_0x4acf('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4acf('0x12'));var logger=require(_0x4acf('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x4acf('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1783d2,_0x979f49){_0x979f49=_0x979f49||0xcc;return function(_0x3734e1){if(_0x3734e1){return _0x1783d2[_0x4acf('0x15')](_0x979f49);}return _0x1783d2[_0x4acf('0x16')](_0x979f49)[_0x4acf('0x17')]();};}function respondWithResult(_0x7ab3ea,_0x15386a){_0x15386a=_0x15386a||0xc8;return function(_0x2025ca){if(_0x2025ca){return _0x7ab3ea[_0x4acf('0x16')](_0x15386a)[_0x4acf('0x18')](_0x2025ca);}};}function respondWithFilteredResult(_0x5f0260,_0x1b584a){return function(_0x57d8e0){if(_0x57d8e0){var _0x34cec1=typeof _0x1b584a[_0x4acf('0x19')]===_0x4acf('0x1a')&&typeof _0x1b584a['limit']==='undefined';var _0x13d10e=_0x57d8e0[_0x4acf('0x1b')];var _0x240c00=_0x34cec1?0x0:_0x1b584a['offset'];var _0x2a678b=_0x34cec1?_0x57d8e0[_0x4acf('0x1b')]:_0x1b584a[_0x4acf('0x19')]+_0x1b584a[_0x4acf('0x1c')];var _0x2f0cec;if(_0x2a678b>=_0x13d10e){_0x2a678b=_0x13d10e;_0x2f0cec=0xc8;}else{_0x2f0cec=0xce;}_0x5f0260[_0x4acf('0x16')](_0x2f0cec);return _0x5f0260[_0x4acf('0x1d')](_0x4acf('0x1e'),_0x240c00+'-'+_0x2a678b+'/'+_0x13d10e)[_0x4acf('0x18')](_0x57d8e0);}return null;};}function patchUpdates(_0x2feb89){return function(_0x1a3118){try{jsonpatch['apply'](_0x1a3118,_0x2feb89,!![]);}catch(_0x28d698){return BPromise[_0x4acf('0x1f')](_0x28d698);}return _0x1a3118['save']();};}function saveUpdates(_0x41e5d2,_0x17775f){return function(_0x569d9e){if(_0x569d9e){return _0x569d9e[_0x4acf('0x20')](_0x41e5d2)[_0x4acf('0x21')](function(_0x433b7a){return _0x433b7a;});}return null;};}function removeEntity(_0x454555,_0x53885f){return function(_0x1a2286){if(_0x1a2286){return _0x1a2286[_0x4acf('0x22')]()['then'](function(){_0x454555[_0x4acf('0x16')](0xcc)[_0x4acf('0x17')]();});}};}function handleEntityNotFound(_0x52a84a,_0x126522){return function(_0x7ebb){if(!_0x7ebb){_0x52a84a[_0x4acf('0x15')](0x194);}return _0x7ebb;};}function handleError(_0x16458f,_0x571a30){_0x571a30=_0x571a30||0x1f4;return function(_0x50236d){logger[_0x4acf('0x23')](_0x50236d[_0x4acf('0x24')]);if(_0x50236d[_0x4acf('0x25')]){delete _0x50236d[_0x4acf('0x25')];}_0x16458f[_0x4acf('0x16')](_0x571a30)[_0x4acf('0x26')](_0x50236d);};}exports[_0x4acf('0x27')]=function(_0x7a1e79,_0x382c41){var _0x2a3830={},_0x57989e={},_0x3521c2={'count':0x0,'rows':[]};var _0x3f5614=_[_0x4acf('0x28')](db[_0x4acf('0x29')][_0x4acf('0x2a')],function(_0x28570f){return{'name':_0x28570f[_0x4acf('0x2b')],'type':_0x28570f['type'][_0x4acf('0x2c')]};});_0x57989e[_0x4acf('0x2d')]=_[_0x4acf('0x28')](_0x3f5614,'name');_0x57989e[_0x4acf('0x2e')]=_[_0x4acf('0x2f')](_0x7a1e79[_0x4acf('0x2e')]);_0x57989e[_0x4acf('0x30')]=_['intersection'](_0x57989e[_0x4acf('0x2d')],_0x57989e[_0x4acf('0x2e')]);_0x2a3830[_0x4acf('0x31')]=_['intersection'](_0x57989e[_0x4acf('0x2d')],qs[_0x4acf('0x32')](_0x7a1e79[_0x4acf('0x2e')][_0x4acf('0x32')]));_0x2a3830[_0x4acf('0x31')]=_0x2a3830[_0x4acf('0x31')]['length']?_0x2a3830[_0x4acf('0x31')]:_0x57989e[_0x4acf('0x2d')];if(!_0x7a1e79['query'][_0x4acf('0x33')]('nolimit')){_0x2a3830['limit']=qs['limit'](_0x7a1e79['query']['limit']);_0x2a3830['offset']=qs['offset'](_0x7a1e79[_0x4acf('0x2e')][_0x4acf('0x19')]);}_0x2a3830['order']=qs[_0x4acf('0x34')](_0x7a1e79[_0x4acf('0x2e')][_0x4acf('0x34')]);_0x2a3830[_0x4acf('0x35')]=qs[_0x4acf('0x30')](_[_0x4acf('0x36')](_0x7a1e79[_0x4acf('0x2e')],_0x57989e[_0x4acf('0x30')]),_0x3f5614);if(_0x7a1e79[_0x4acf('0x2e')][_0x4acf('0x37')]){_0x2a3830['where']=_['merge'](_0x2a3830[_0x4acf('0x35')],{'$or':_[_0x4acf('0x28')](_0x3f5614,function(_0x4859b6){if(_0x4859b6[_0x4acf('0x38')]!==_0x4acf('0x39')){var _0x43a2ea={};_0x43a2ea[_0x4859b6[_0x4acf('0x25')]]={'$like':'%'+_0x7a1e79['query']['filter']+'%'};return _0x43a2ea;}})});}_0x2a3830=_[_0x4acf('0x3a')]({},_0x2a3830,_0x7a1e79[_0x4acf('0x3b')]);var _0x3d5529={'where':_0x2a3830[_0x4acf('0x35')]};return db['Integration'][_0x4acf('0x1b')](_0x3d5529)[_0x4acf('0x21')](function(_0x4e9370){_0x3521c2['count']=_0x4e9370;if(_0x7a1e79['query']['includeAll']){_0x2a3830[_0x4acf('0x3c')]=[{'all':!![]}];}return db[_0x4acf('0x29')][_0x4acf('0x3d')](_0x2a3830);})['then'](function(_0x1015e3){_0x3521c2[_0x4acf('0x3e')]=_0x1015e3;return _0x3521c2;})[_0x4acf('0x21')](respondWithFilteredResult(_0x382c41,_0x2a3830))[_0x4acf('0x3f')](handleError(_0x382c41,null));};exports[_0x4acf('0x40')]=function(_0xea75e4,_0x7cf2a){var _0x17d5e9={'raw':![],'where':{'id':_0xea75e4[_0x4acf('0x41')]['id']}},_0x461547={};_0x461547[_0x4acf('0x2d')]=_['keys'](db[_0x4acf('0x29')][_0x4acf('0x2a')]);_0x461547[_0x4acf('0x2e')]=_[_0x4acf('0x2f')](_0xea75e4[_0x4acf('0x2e')]);_0x461547['filters']=_['intersection'](_0x461547[_0x4acf('0x2d')],_0x461547[_0x4acf('0x2e')]);_0x17d5e9[_0x4acf('0x31')]=_[_0x4acf('0x42')](_0x461547[_0x4acf('0x2d')],qs[_0x4acf('0x32')](_0xea75e4['query'][_0x4acf('0x32')]));_0x17d5e9['attributes']=_0x17d5e9[_0x4acf('0x31')][_0x4acf('0x43')]?_0x17d5e9['attributes']:_0x461547['model'];if(_0xea75e4[_0x4acf('0x2e')][_0x4acf('0x44')]){_0x17d5e9[_0x4acf('0x3c')]=[{'all':!![]}];}_0x17d5e9=_[_0x4acf('0x3a')]({},_0x17d5e9,_0xea75e4['options']);return db[_0x4acf('0x29')][_0x4acf('0x45')](_0x17d5e9)[_0x4acf('0x21')](handleEntityNotFound(_0x7cf2a,null))[_0x4acf('0x21')](respondWithResult(_0x7cf2a,null))[_0x4acf('0x3f')](handleError(_0x7cf2a,null));};exports[_0x4acf('0x46')]=function(_0x1bd7d0,_0x2d946c){return db['Integration']['create'](_0x1bd7d0[_0x4acf('0x47')],{})[_0x4acf('0x21')](respondWithResult(_0x2d946c,0xc9))[_0x4acf('0x3f')](handleError(_0x2d946c,null));};exports[_0x4acf('0x20')]=function(_0x287406,_0x859247){if(_0x287406[_0x4acf('0x47')]['id']){delete _0x287406[_0x4acf('0x47')]['id'];}return db[_0x4acf('0x29')][_0x4acf('0x45')]({'where':{'id':_0x287406[_0x4acf('0x41')]['id']}})[_0x4acf('0x21')](handleEntityNotFound(_0x859247,null))['then'](saveUpdates(_0x287406[_0x4acf('0x47')],null))[_0x4acf('0x21')](respondWithResult(_0x859247,null))[_0x4acf('0x3f')](handleError(_0x859247,null));};exports[_0x4acf('0x22')]=function(_0x392dac,_0x3cf54a){return db[_0x4acf('0x29')][_0x4acf('0x45')]({'where':{'id':_0x392dac[_0x4acf('0x41')]['id']}})[_0x4acf('0x21')](handleEntityNotFound(_0x3cf54a,null))[_0x4acf('0x21')](removeEntity(_0x3cf54a,null))[_0x4acf('0x3f')](handleError(_0x3cf54a,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index 4edff84..9bde972 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 _0x0b45=['util','api','moment','bluebird','request-promise','path','../../config/environment','exports','define','Integration','integrations'];(function(_0x2637ac,_0x377857){var _0x4a5758=function(_0x5d5043){while(--_0x5d5043){_0x2637ac['push'](_0x2637ac['shift']());}};_0x4a5758(++_0x377857);}(_0x0b45,0x1c3));var _0x50b4=function(_0x4956fb,_0x22df10){_0x4956fb=_0x4956fb-0x0;var _0x528127=_0x0b45[_0x4956fb];return _0x528127;};'use strict';var _=require('lodash');var util=require(_0x50b4('0x0'));var logger=require('../../config/logger')(_0x50b4('0x1'));var moment=require(_0x50b4('0x2'));var BPromise=require(_0x50b4('0x3'));var rp=require(_0x50b4('0x4'));var fs=require('fs');var path=require(_0x50b4('0x5'));var rimraf=require('rimraf');var config=require(_0x50b4('0x6'));var attributes=require('./integration.attributes');module[_0x50b4('0x7')]=function(_0x1eb0a3,_0x58d741){return _0x1eb0a3[_0x50b4('0x8')](_0x50b4('0x9'),attributes,{'tableName':_0x50b4('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8693=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./integration.attributes','exports','define','Integration','util','../../config/logger'];(function(_0x3a6151,_0x3c075e){var _0x3b2aab=function(_0x267973){while(--_0x267973){_0x3a6151['push'](_0x3a6151['shift']());}};_0x3b2aab(++_0x3c075e);}(_0x8693,0x191));var _0x3869=function(_0x13d2e2,_0x589178){_0x13d2e2=_0x13d2e2-0x0;var _0x6f50a9=_0x8693[_0x13d2e2];return _0x6f50a9;};'use strict';var _=require('lodash');var util=require(_0x3869('0x0'));var logger=require(_0x3869('0x1'))(_0x3869('0x2'));var moment=require(_0x3869('0x3'));var BPromise=require(_0x3869('0x4'));var rp=require(_0x3869('0x5'));var fs=require('fs');var path=require(_0x3869('0x6'));var rimraf=require(_0x3869('0x7'));var config=require(_0x3869('0x8'));var attributes=require(_0x3869('0x9'));module[_0x3869('0xa')]=function(_0xccde16,_0x148fbd){return _0xccde16[_0x3869('0xb')](_0x3869('0xc'),attributes,{'tableName':'integrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integration/integration.rpc.js b/server/api/integration/integration.rpc.js index fe607d4..07d7072 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 _0x524e=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Integration,\x20%s,\x20%s','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','moment','bluebird'];(function(_0x43b08,_0x15f967){var _0x5e05f4=function(_0x4bb0cb){while(--_0x4bb0cb){_0x43b08['push'](_0x43b08['shift']());}};_0x5e05f4(++_0x15f967);}(_0x524e,0x15e));var _0xe524=function(_0x4d5cce,_0x59b916){_0x4d5cce=_0x4d5cce-0x0;var _0x46fc32=_0x524e[_0x4d5cce];return _0x46fc32;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe524('0x0'));var BPromise=require(_0xe524('0x1'));var rs=require(_0xe524('0x2'));var fs=require('fs');var Redis=require(_0xe524('0x3'));var db=require(_0xe524('0x4'))['db'];var utils=require(_0xe524('0x5'));var logger=require(_0xe524('0x6'))(_0xe524('0x7'));var config=require(_0xe524('0x8'));var jayson=require(_0xe524('0x9'));var client=jayson['client'][_0xe524('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x41e1a3,_0x347bed,_0x533c14){return new BPromise(function(_0x384935,_0x3e4cda){return client[_0xe524('0xb')](_0x41e1a3,_0x533c14)[_0xe524('0xc')](function(_0x991924){logger[_0xe524('0xd')](_0xe524('0xe'),_0x347bed,_0xe524('0xf'));logger[_0xe524('0x10')](_0xe524('0x11'),_0x347bed,_0xe524('0xf'),JSON[_0xe524('0x12')](_0x991924));if(_0x991924[_0xe524('0x13')]){if(_0x991924[_0xe524('0x13')][_0xe524('0x14')]===0x1f4){logger[_0xe524('0x13')]('Integration,\x20%s,\x20%s',_0x347bed,_0x991924['error'][_0xe524('0x15')]);return _0x3e4cda(_0x991924[_0xe524('0x13')][_0xe524('0x15')]);}logger[_0xe524('0x13')](_0xe524('0xe'),_0x347bed,_0x991924['error'][_0xe524('0x15')]);return _0x384935(_0x991924['error'][_0xe524('0x15')]);}else{logger[_0xe524('0xd')]('Integration,\x20%s,\x20%s',_0x347bed,_0xe524('0xf'));_0x384935(_0x991924['result'][_0xe524('0x15')]);}})['catch'](function(_0x29a031){logger['error']('Integration,\x20%s,\x20%s',_0x347bed,_0x29a031);_0x3e4cda(_0x29a031);});});} \ No newline at end of file +var _0x7880=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','Integration,\x20%s,\x20%s','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x5dc82e,_0x3b7da9){var _0x1a7837=function(_0x3511bb){while(--_0x3511bb){_0x5dc82e['push'](_0x5dc82e['shift']());}};_0x1a7837(++_0x3b7da9);}(_0x7880,0x1f4));var _0x0788=function(_0x182394,_0xc13ead){_0x182394=_0x182394-0x0;var _0x23a459=_0x7880[_0x182394];return _0x23a459;};'use strict';var _=require('lodash');var util=require(_0x0788('0x0'));var moment=require(_0x0788('0x1'));var BPromise=require(_0x0788('0x2'));var rs=require(_0x0788('0x3'));var fs=require('fs');var Redis=require(_0x0788('0x4'));var db=require(_0x0788('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0788('0x6'))(_0x0788('0x7'));var config=require(_0x0788('0x8'));var jayson=require(_0x0788('0x9'));var client=jayson[_0x0788('0xa')][_0x0788('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3f9cb8,_0x44bbb5,_0x3c29f3){return new BPromise(function(_0x422f8b,_0x55e48a){return client[_0x0788('0xc')](_0x3f9cb8,_0x3c29f3)['then'](function(_0xabaf81){logger['info'](_0x0788('0xd'),_0x44bbb5,_0x0788('0xe'));logger[_0x0788('0xf')](_0x0788('0x10'),_0x44bbb5,_0x0788('0xe'),JSON['stringify'](_0xabaf81));if(_0xabaf81[_0x0788('0x11')]){if(_0xabaf81[_0x0788('0x11')][_0x0788('0x12')]===0x1f4){logger[_0x0788('0x11')](_0x0788('0xd'),_0x44bbb5,_0xabaf81[_0x0788('0x11')][_0x0788('0x13')]);return _0x55e48a(_0xabaf81['error'][_0x0788('0x13')]);}logger[_0x0788('0x11')](_0x0788('0xd'),_0x44bbb5,_0xabaf81[_0x0788('0x11')]['message']);return _0x422f8b(_0xabaf81[_0x0788('0x11')]['message']);}else{logger[_0x0788('0x14')](_0x0788('0xd'),_0x44bbb5,_0x0788('0xe'));_0x422f8b(_0xabaf81[_0x0788('0x15')][_0x0788('0x13')]);}})[_0x0788('0x16')](function(_0x5e1a29){logger['error'](_0x0788('0xd'),_0x44bbb5,_0x5e1a29);_0x55e48a(_0x5e1a29);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index b66993a..0e96a9f 100644 --- a/server/api/integrationReport/index.js +++ b/server/api/integrationReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2ef3=['express','Router','../../components/auth/service','../../components/interaction/service','./integrationReport.controller','get','/describe','isAuthenticated','describe','/:id','show','post','update','delete','exports','multer','util','path','connect-timeout'];(function(_0x3791c7,_0x232b1e){var _0x459217=function(_0x490aca){while(--_0x490aca){_0x3791c7['push'](_0x3791c7['shift']());}};_0x459217(++_0x232b1e);}(_0x2ef3,0xba));var _0x32ef=function(_0x2fd085,_0x2c0dd8){_0x2fd085=_0x2fd085-0x0;var _0x38661d=_0x2ef3[_0x2fd085];return _0x38661d;};'use strict';var multer=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var path=require(_0x32ef('0x2'));var timeout=require(_0x32ef('0x3'));var express=require(_0x32ef('0x4'));var router=express[_0x32ef('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x32ef('0x6'));var interaction=require(_0x32ef('0x7'));var config=require('../../config/environment');var controller=require(_0x32ef('0x8'));router[_0x32ef('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x32ef('0x9')](_0x32ef('0xa'),auth[_0x32ef('0xb')](),controller[_0x32ef('0xc')]);router[_0x32ef('0x9')](_0x32ef('0xd'),auth[_0x32ef('0xb')](),controller[_0x32ef('0xe')]);router[_0x32ef('0xf')]('/',auth[_0x32ef('0xb')](),controller['create']);router['put'](_0x32ef('0xd'),auth[_0x32ef('0xb')](),controller[_0x32ef('0x10')]);router[_0x32ef('0x11')]('/:id',auth[_0x32ef('0xb')](),controller['destroy']);module[_0x32ef('0x12')]=router; \ No newline at end of file +var _0x5f66=['util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','create','put','update','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5f66,0x1a0));var _0x65f6=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x5f66[_0x3947c9];return _0x2e7871;};'use strict';var multer=require('multer');var util=require(_0x65f6('0x0'));var path=require('path');var timeout=require(_0x65f6('0x1'));var express=require(_0x65f6('0x2'));var router=express[_0x65f6('0x3')]();var fs_extra=require(_0x65f6('0x4'));var auth=require(_0x65f6('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x65f6('0x6'));var controller=require('./integrationReport.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['show']);router['post']('/',auth[_0x65f6('0x8')](),controller[_0x65f6('0xc')]);router[_0x65f6('0xd')](_0x65f6('0xb'),auth['isAuthenticated'](),controller[_0x65f6('0xe')]);router['delete']('/:id',auth[_0x65f6('0x8')](),controller['destroy']);module[_0x65f6('0xf')]=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index f3fb152..9a76060 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 _0xd186=['FAILED','sequelize','exports','STRING','INTEGER','DATE','BOOLEAN','TEXT','ENUM','RECEIVED'];(function(_0x356726,_0x3452ee){var _0x579a4c=function(_0x4aef80){while(--_0x4aef80){_0x356726['push'](_0x356726['shift']());}};_0x579a4c(++_0x3452ee);}(_0xd186,0x79));var _0x6d18=function(_0x20a1f7,_0x494f2b){_0x20a1f7=_0x20a1f7-0x0;var _0x50c7fa=_0xd186[_0x20a1f7];return _0x50c7fa;};'use strict';var Sequelize=require(_0x6d18('0x0'));module[_0x6d18('0x1')]={'integration':{'type':Sequelize['STRING']},'eventChannel':{'type':Sequelize['STRING']},'exitStatus':{'type':Sequelize['STRING']},'ticketId':{'type':Sequelize[_0x6d18('0x2')]},'integrationId':{'type':Sequelize[_0x6d18('0x3')]},'contacts':{'type':Sequelize[_0x6d18('0x2')]},'uniqueid':{'type':Sequelize[_0x6d18('0x2')]},'calleridnum':{'type':Sequelize[_0x6d18('0x2')]},'calleridname':{'type':Sequelize[_0x6d18('0x2')]},'queue':{'type':Sequelize[_0x6d18('0x2')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x6d18('0x2')]},'agentcalledAt':{'type':Sequelize[_0x6d18('0x4')]},'agentconnectAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0x6d18('0x3')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x6d18('0x4')]},'talktime':{'type':Sequelize[_0x6d18('0x3')]},'agentacw':{'type':Sequelize[_0x6d18('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x6d18('0x3')]},'reason':{'type':Sequelize[_0x6d18('0x2')]},'agentringnoanswer':{'type':Sequelize[_0x6d18('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x6d18('0x4')]},'agentdump':{'type':Sequelize[_0x6d18('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize[_0x6d18('0x2')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0x6d18('0x3')]},'channelstatedesc':{'type':Sequelize[_0x6d18('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x6d18('0x2')]},'language':{'type':Sequelize[_0x6d18('0x2')]},'accountcode':{'type':Sequelize[_0x6d18('0x2')]},'context':{'type':Sequelize[_0x6d18('0x2')]},'exten':{'type':Sequelize[_0x6d18('0x2')]},'priority':{'type':Sequelize[_0x6d18('0x2')]},'destchannel':{'type':Sequelize[_0x6d18('0x2')]},'destchannelstate':{'type':Sequelize[_0x6d18('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x6d18('0x2')]},'destcalleridnum':{'type':Sequelize[_0x6d18('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x6d18('0x2')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x6d18('0x2')]},'destaccountcode':{'type':Sequelize[_0x6d18('0x2')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0x6d18('0x2')]},'destpriority':{'type':Sequelize[_0x6d18('0x2')]},'destuniqueid':{'type':Sequelize[_0x6d18('0x2')]},'messageId':{'type':Sequelize[_0x6d18('0x2')]},'inReplyTo':{'type':Sequelize[_0x6d18('0x2')]},'subject':{'type':Sequelize[_0x6d18('0x2')]},'from':{'type':Sequelize[_0x6d18('0x2')]},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x6d18('0x2')]},'attachment':{'type':Sequelize[_0x6d18('0x6')]},'html':{'type':Sequelize[_0x6d18('0x6')]},'text':{'type':Sequelize[_0x6d18('0x6')]},'status':{'type':Sequelize[_0x6d18('0x7')]('SENT','SENDING',_0x6d18('0x8'),_0x6d18('0x9'))},'url':{'type':Sequelize['STRING']},'app':{'type':Sequelize['STRING']},'appdata':{'type':Sequelize[_0x6d18('0x2')]},'projectId':{'type':Sequelize[_0x6d18('0x3')]}}; \ No newline at end of file +var _0x49aa=['RECEIVED','FAILED','exports','STRING','INTEGER','DATE','BOOLEAN','TEXT','ENUM','SENT','SENDING'];(function(_0x5323c3,_0x239b58){var _0x335441=function(_0xd3104b){while(--_0xd3104b){_0x5323c3['push'](_0x5323c3['shift']());}};_0x335441(++_0x239b58);}(_0x49aa,0x162));var _0xa49a=function(_0x402f67,_0x5a4e58){_0x402f67=_0x402f67-0x0;var _0x576ca6=_0x49aa[_0x402f67];return _0x576ca6;};'use strict';var Sequelize=require('sequelize');module[_0xa49a('0x0')]={'integration':{'type':Sequelize[_0xa49a('0x1')]},'eventChannel':{'type':Sequelize['STRING']},'exitStatus':{'type':Sequelize[_0xa49a('0x1')]},'ticketId':{'type':Sequelize[_0xa49a('0x1')]},'integrationId':{'type':Sequelize[_0xa49a('0x2')]},'contacts':{'type':Sequelize[_0xa49a('0x1')]},'uniqueid':{'type':Sequelize[_0xa49a('0x1')]},'calleridnum':{'type':Sequelize[_0xa49a('0x1')]},'calleridname':{'type':Sequelize[_0xa49a('0x1')]},'queue':{'type':Sequelize[_0xa49a('0x1')]},'interface':{'type':Sequelize[_0xa49a('0x1')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0xa49a('0x3')]},'agentconnectAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0xa49a('0x2')]},'agentcomplete':{'type':Sequelize[_0xa49a('0x4')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize['DATE']},'talktime':{'type':Sequelize[_0xa49a('0x2')]},'agentacw':{'type':Sequelize[_0xa49a('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xa49a('0x2')]},'reason':{'type':Sequelize[_0xa49a('0x1')]},'agentringnoanswer':{'type':Sequelize[_0xa49a('0x4')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdump':{'type':Sequelize[_0xa49a('0x4')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0xa49a('0x3')]},'lastevent':{'type':Sequelize[_0xa49a('0x1')]},'channel':{'type':Sequelize[_0xa49a('0x1')]},'channelstate':{'type':Sequelize[_0xa49a('0x2')]},'channelstatedesc':{'type':Sequelize[_0xa49a('0x1')]},'connectedlinenum':{'type':Sequelize[_0xa49a('0x1')]},'connectedlinename':{'type':Sequelize[_0xa49a('0x1')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xa49a('0x1')]},'context':{'type':Sequelize[_0xa49a('0x1')]},'exten':{'type':Sequelize[_0xa49a('0x1')]},'priority':{'type':Sequelize[_0xa49a('0x1')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0xa49a('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0xa49a('0x1')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0xa49a('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0xa49a('0x1')]},'destconnectedlinename':{'type':Sequelize[_0xa49a('0x1')]},'destlanguage':{'type':Sequelize[_0xa49a('0x1')]},'destaccountcode':{'type':Sequelize[_0xa49a('0x1')]},'destcontext':{'type':Sequelize[_0xa49a('0x1')]},'destexten':{'type':Sequelize[_0xa49a('0x1')]},'destpriority':{'type':Sequelize[_0xa49a('0x1')]},'destuniqueid':{'type':Sequelize[_0xa49a('0x1')]},'messageId':{'type':Sequelize[_0xa49a('0x1')]},'inReplyTo':{'type':Sequelize[_0xa49a('0x1')]},'subject':{'type':Sequelize['STRING']},'from':{'type':Sequelize[_0xa49a('0x1')]},'to':{'type':Sequelize[_0xa49a('0x1')]},'cc':{'type':Sequelize[_0xa49a('0x1')]},'attachment':{'type':Sequelize[_0xa49a('0x5')]},'html':{'type':Sequelize[_0xa49a('0x5')]},'text':{'type':Sequelize[_0xa49a('0x5')]},'status':{'type':Sequelize[_0xa49a('0x6')](_0xa49a('0x7'),_0xa49a('0x8'),_0xa49a('0x9'),_0xa49a('0xa'))},'url':{'type':Sequelize['STRING']},'app':{'type':Sequelize['STRING']},'appdata':{'type':Sequelize[_0xa49a('0x1')]},'projectId':{'type':Sequelize[_0xa49a('0x2')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index 58e1d49..70f08db 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 _0xc51e=['to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','update','destroy','then','end','error','stack','name','index','map','IntegrationReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','findAll','rows','catch','show','fields','includeAll','include','options','create','body','find','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','path','sox'];(function(_0x4518c5,_0x1b5f21){var _0x2b5fdf=function(_0x104469){while(--_0x104469){_0x4518c5['push'](_0x4518c5['shift']());}};_0x2b5fdf(++_0x1b5f21);}(_0xc51e,0xe8));var _0xec51=function(_0x264194,_0x48ee77){_0x264194=_0x264194-0x0;var _0x584be0=_0xc51e[_0x264194];return _0x584be0;};'use strict';var emlformat=require(_0xec51('0x0'));var rimraf=require(_0xec51('0x1'));var zipdir=require(_0xec51('0x2'));var jsonpatch=require(_0xec51('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xec51('0x4'));var Mustache=require(_0xec51('0x5'));var util=require('util');var path=require(_0xec51('0x6'));var sox=require(_0xec51('0x7'));var csv=require(_0xec51('0x8'));var ejs=require(_0xec51('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xec51('0xa'));var squel=require('squel');var crypto=require(_0xec51('0xb'));var jsforce=require(_0xec51('0xc'));var deskjs=require(_0xec51('0xd'));var toCsv=require(_0xec51('0x8'));var querystring=require(_0xec51('0xe'));var Papa=require(_0xec51('0xf'));var Redis=require(_0xec51('0x10'));var authService=require(_0xec51('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xec51('0x12'));var hardwareService=require(_0xec51('0x13'));var logger=require(_0xec51('0x14'))(_0xec51('0x15'));var utils=require(_0xec51('0x16'));var config=require(_0xec51('0x17'));var licenseUtil=require(_0xec51('0x18'));var db=require(_0xec51('0x19'))['db'];function respondWithStatusCode(_0x5bf9ff,_0x4f5105){_0x4f5105=_0x4f5105||0xcc;return function(_0x141682){if(_0x141682){return _0x5bf9ff[_0xec51('0x1a')](_0x4f5105);}return _0x5bf9ff['status'](_0x4f5105)['end']();};}function respondWithResult(_0x59d2ab,_0x5ac377){_0x5ac377=_0x5ac377||0xc8;return function(_0x560960){if(_0x560960){return _0x59d2ab[_0xec51('0x1b')](_0x5ac377)['json'](_0x560960);}};}function respondWithFilteredResult(_0x56951e,_0x13d408){return function(_0xf41aa){if(_0xf41aa){var _0x47048b=typeof _0x13d408[_0xec51('0x1c')]===_0xec51('0x1d')&&typeof _0x13d408['limit']===_0xec51('0x1d');var _0x323a1b=_0xf41aa[_0xec51('0x1e')];var _0xc5a087=_0x47048b?0x0:_0x13d408[_0xec51('0x1c')];var _0x420212=_0x47048b?_0xf41aa[_0xec51('0x1e')]:_0x13d408[_0xec51('0x1c')]+_0x13d408[_0xec51('0x1f')];var _0x53ca2d;if(_0x420212>=_0x323a1b){_0x420212=_0x323a1b;_0x53ca2d=0xc8;}else{_0x53ca2d=0xce;}_0x56951e['status'](_0x53ca2d);return _0x56951e[_0xec51('0x20')](_0xec51('0x21'),_0xc5a087+'-'+_0x420212+'/'+_0x323a1b)[_0xec51('0x22')](_0xf41aa);}return null;};}function patchUpdates(_0x5ee0ee){return function(_0xecd17b){try{jsonpatch[_0xec51('0x23')](_0xecd17b,_0x5ee0ee,!![]);}catch(_0x575cd6){return BPromise[_0xec51('0x24')](_0x575cd6);}return _0xecd17b[_0xec51('0x25')]();};}function saveUpdates(_0x213fb2,_0x17872f){return function(_0x300b15){if(_0x300b15){return _0x300b15[_0xec51('0x26')](_0x213fb2)['then'](function(_0x5bcfe0){return _0x5bcfe0;});}return null;};}function removeEntity(_0x1e20ab,_0x252b07){return function(_0x5a6f15){if(_0x5a6f15){return _0x5a6f15[_0xec51('0x27')]()[_0xec51('0x28')](function(){_0x1e20ab[_0xec51('0x1b')](0xcc)[_0xec51('0x29')]();});}};}function handleEntityNotFound(_0x118da8,_0x1be9a6){return function(_0x59e766){if(!_0x59e766){_0x118da8[_0xec51('0x1a')](0x194);}return _0x59e766;};}function handleError(_0xacab1f,_0x367b0a){_0x367b0a=_0x367b0a||0x1f4;return function(_0x2ad384){logger[_0xec51('0x2a')](_0x2ad384[_0xec51('0x2b')]);if(_0x2ad384[_0xec51('0x2c')]){delete _0x2ad384['name'];}_0xacab1f['status'](_0x367b0a)['send'](_0x2ad384);};}exports[_0xec51('0x2d')]=function(_0x37f174,_0x3defa7){var _0x46938d={},_0x355961={},_0x455cb2={'count':0x0,'rows':[]};var _0x55fdad=_[_0xec51('0x2e')](db[_0xec51('0x2f')][_0xec51('0x30')],function(_0x5989b6){return{'name':_0x5989b6[_0xec51('0x31')],'type':_0x5989b6[_0xec51('0x32')][_0xec51('0x33')]};});_0x355961[_0xec51('0x34')]=_[_0xec51('0x2e')](_0x55fdad,_0xec51('0x2c'));_0x355961[_0xec51('0x35')]=_[_0xec51('0x36')](_0x37f174[_0xec51('0x35')]);_0x355961[_0xec51('0x37')]=_[_0xec51('0x38')](_0x355961[_0xec51('0x34')],_0x355961[_0xec51('0x35')]);_0x46938d[_0xec51('0x39')]=_[_0xec51('0x38')](_0x355961[_0xec51('0x34')],qs['fields'](_0x37f174[_0xec51('0x35')]['fields']));_0x46938d[_0xec51('0x39')]=_0x46938d[_0xec51('0x39')][_0xec51('0x3a')]?_0x46938d['attributes']:_0x355961['model'];if(!_0x37f174[_0xec51('0x35')][_0xec51('0x3b')]('nolimit')){_0x46938d[_0xec51('0x1f')]=qs[_0xec51('0x1f')](_0x37f174['query'][_0xec51('0x1f')]);_0x46938d['offset']=qs[_0xec51('0x1c')](_0x37f174[_0xec51('0x35')]['offset']);}_0x46938d[_0xec51('0x3c')]=qs[_0xec51('0x3d')](_0x37f174[_0xec51('0x35')][_0xec51('0x3d')]);_0x46938d[_0xec51('0x3e')]=qs[_0xec51('0x37')](_[_0xec51('0x3f')](_0x37f174[_0xec51('0x35')],_0x355961[_0xec51('0x37')]),_0x55fdad);if(_0x37f174[_0xec51('0x35')][_0xec51('0x40')]){_0x46938d[_0xec51('0x3e')]=_[_0xec51('0x41')](_0x46938d[_0xec51('0x3e')],{'$or':_[_0xec51('0x2e')](_0x55fdad,function(_0x3f294a){if(_0x3f294a[_0xec51('0x32')]!==_0xec51('0x42')){var _0x2860a0={};_0x2860a0[_0x3f294a[_0xec51('0x2c')]]={'$like':'%'+_0x37f174['query'][_0xec51('0x40')]+'%'};return _0x2860a0;}})});}_0x46938d=_[_0xec51('0x41')]({},_0x46938d,_0x37f174['options']);var _0x276e8b={'where':_0x46938d[_0xec51('0x3e')]};return db['IntegrationReport'][_0xec51('0x1e')](_0x276e8b)['then'](function(_0x5e9366){_0x455cb2[_0xec51('0x1e')]=_0x5e9366;if(_0x37f174[_0xec51('0x35')]['includeAll']){_0x46938d['include']=[{'all':!![]}];}return db[_0xec51('0x2f')][_0xec51('0x43')](_0x46938d);})[_0xec51('0x28')](function(_0x1dbff4){_0x455cb2[_0xec51('0x44')]=_0x1dbff4;return _0x455cb2;})[_0xec51('0x28')](respondWithFilteredResult(_0x3defa7,_0x46938d))[_0xec51('0x45')](handleError(_0x3defa7,null));};exports[_0xec51('0x46')]=function(_0x370376,_0x12d874){var _0x549256={'raw':![],'where':{'id':_0x370376['params']['id']}},_0x51ca0c={};_0x51ca0c[_0xec51('0x34')]=_[_0xec51('0x36')](db[_0xec51('0x2f')]['rawAttributes']);_0x51ca0c[_0xec51('0x35')]=_[_0xec51('0x36')](_0x370376[_0xec51('0x35')]);_0x51ca0c[_0xec51('0x37')]=_['intersection'](_0x51ca0c[_0xec51('0x34')],_0x51ca0c[_0xec51('0x35')]);_0x549256[_0xec51('0x39')]=_[_0xec51('0x38')](_0x51ca0c[_0xec51('0x34')],qs[_0xec51('0x47')](_0x370376[_0xec51('0x35')]['fields']));_0x549256[_0xec51('0x39')]=_0x549256['attributes']['length']?_0x549256[_0xec51('0x39')]:_0x51ca0c[_0xec51('0x34')];if(_0x370376[_0xec51('0x35')][_0xec51('0x48')]){_0x549256[_0xec51('0x49')]=[{'all':!![]}];}_0x549256=_[_0xec51('0x41')]({},_0x549256,_0x370376[_0xec51('0x4a')]);return db[_0xec51('0x2f')]['find'](_0x549256)[_0xec51('0x28')](handleEntityNotFound(_0x12d874,null))['then'](respondWithResult(_0x12d874,null))[_0xec51('0x45')](handleError(_0x12d874,null));};exports[_0xec51('0x4b')]=function(_0x12c69a,_0x166595){return db['IntegrationReport'][_0xec51('0x4b')](_0x12c69a[_0xec51('0x4c')],{})['then'](respondWithResult(_0x166595,0xc9))[_0xec51('0x45')](handleError(_0x166595,null));};exports[_0xec51('0x26')]=function(_0x5672b6,_0x57805e){if(_0x5672b6[_0xec51('0x4c')]['id']){delete _0x5672b6[_0xec51('0x4c')]['id'];}return db['IntegrationReport'][_0xec51('0x4d')]({'where':{'id':_0x5672b6[_0xec51('0x4e')]['id']}})[_0xec51('0x28')](handleEntityNotFound(_0x57805e,null))[_0xec51('0x28')](saveUpdates(_0x5672b6[_0xec51('0x4c')],null))[_0xec51('0x28')](respondWithResult(_0x57805e,null))['catch'](handleError(_0x57805e,null));};exports[_0xec51('0x27')]=function(_0x5ebdba,_0x35b809){return db[_0xec51('0x2f')][_0xec51('0x4d')]({'where':{'id':_0x5ebdba[_0xec51('0x4e')]['id']}})[_0xec51('0x28')](handleEntityNotFound(_0x35b809,null))['then'](removeEntity(_0x35b809,null))[_0xec51('0x45')](handleError(_0x35b809,null));};exports[_0xec51('0x4f')]=function(_0x491d16,_0x3a76eb){return db[_0xec51('0x2f')][_0xec51('0x4f')]()[_0xec51('0x28')](respondWithResult(_0x3a76eb,null))[_0xec51('0x45')](handleError(_0x3a76eb,null));}; \ No newline at end of file +var _0xda3b=['sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../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','set','apply','reject','save','destroy','then','stack','name','index','map','IntegrationReport','rawAttributes','fieldName','type','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','update','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path'];(function(_0x430768,_0x4362e8){var _0x1b36a4=function(_0x10d350){while(--_0x10d350){_0x430768['push'](_0x430768['shift']());}};_0x1b36a4(++_0x4362e8);}(_0xda3b,0x1c5));var _0xbda3=function(_0x3ce33a,_0x19e1d0){_0x3ce33a=_0x3ce33a-0x0;var _0x5b61f3=_0xda3b[_0x3ce33a];return _0x5b61f3;};'use strict';var emlformat=require(_0xbda3('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbda3('0x1'));var jsonpatch=require(_0xbda3('0x2'));var rp=require(_0xbda3('0x3'));var moment=require(_0xbda3('0x4'));var BPromise=require(_0xbda3('0x5'));var Mustache=require(_0xbda3('0x6'));var util=require(_0xbda3('0x7'));var path=require(_0xbda3('0x8'));var sox=require(_0xbda3('0x9'));var csv=require(_0xbda3('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbda3('0xb'));var _=require(_0xbda3('0xc'));var squel=require(_0xbda3('0xd'));var crypto=require(_0xbda3('0xe'));var jsforce=require(_0xbda3('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xbda3('0xa'));var querystring=require(_0xbda3('0x10'));var Papa=require(_0xbda3('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xbda3('0x12'));var as=require(_0xbda3('0x13'));var hardwareService=require(_0xbda3('0x14'));var logger=require(_0xbda3('0x15'))(_0xbda3('0x16'));var utils=require(_0xbda3('0x17'));var config=require(_0xbda3('0x18'));var licenseUtil=require(_0xbda3('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x30b5a0,_0x444a7d){_0x444a7d=_0x444a7d||0xcc;return function(_0x580fbd){if(_0x580fbd){return _0x30b5a0['sendStatus'](_0x444a7d);}return _0x30b5a0[_0xbda3('0x1a')](_0x444a7d)[_0xbda3('0x1b')]();};}function respondWithResult(_0x40b4d3,_0x379d0){_0x379d0=_0x379d0||0xc8;return function(_0xcd348d){if(_0xcd348d){return _0x40b4d3[_0xbda3('0x1a')](_0x379d0)[_0xbda3('0x1c')](_0xcd348d);}};}function respondWithFilteredResult(_0x3bdc92,_0x256303){return function(_0x3e7b73){if(_0x3e7b73){var _0x5c7fad=typeof _0x256303[_0xbda3('0x1d')]===_0xbda3('0x1e')&&typeof _0x256303[_0xbda3('0x1f')]==='undefined';var _0x153ae0=_0x3e7b73['count'];var _0x4100c2=_0x5c7fad?0x0:_0x256303[_0xbda3('0x1d')];var _0x169ec6=_0x5c7fad?_0x3e7b73['count']:_0x256303[_0xbda3('0x1d')]+_0x256303[_0xbda3('0x1f')];var _0x791f85;if(_0x169ec6>=_0x153ae0){_0x169ec6=_0x153ae0;_0x791f85=0xc8;}else{_0x791f85=0xce;}_0x3bdc92[_0xbda3('0x1a')](_0x791f85);return _0x3bdc92[_0xbda3('0x20')]('Content-Range',_0x4100c2+'-'+_0x169ec6+'/'+_0x153ae0)['json'](_0x3e7b73);}return null;};}function patchUpdates(_0x2f64e7){return function(_0x31c97d){try{jsonpatch[_0xbda3('0x21')](_0x31c97d,_0x2f64e7,!![]);}catch(_0x2017bd){return BPromise[_0xbda3('0x22')](_0x2017bd);}return _0x31c97d[_0xbda3('0x23')]();};}function saveUpdates(_0x177e90,_0x2b576d){return function(_0x8812c2){if(_0x8812c2){return _0x8812c2['update'](_0x177e90)['then'](function(_0x12a449){return _0x12a449;});}return null;};}function removeEntity(_0x3d89cf,_0x7fa554){return function(_0xad19fe){if(_0xad19fe){return _0xad19fe[_0xbda3('0x24')]()[_0xbda3('0x25')](function(){_0x3d89cf['status'](0xcc)[_0xbda3('0x1b')]();});}};}function handleEntityNotFound(_0x24eda7,_0x368a99){return function(_0x31d2a8){if(!_0x31d2a8){_0x24eda7['sendStatus'](0x194);}return _0x31d2a8;};}function handleError(_0x3bed27,_0x2664ef){_0x2664ef=_0x2664ef||0x1f4;return function(_0x22f95c){logger['error'](_0x22f95c[_0xbda3('0x26')]);if(_0x22f95c['name']){delete _0x22f95c[_0xbda3('0x27')];}_0x3bed27[_0xbda3('0x1a')](_0x2664ef)['send'](_0x22f95c);};}exports[_0xbda3('0x28')]=function(_0x584e40,_0x14e57e){var _0x328cb0={},_0x37d2b3={},_0x2fb58c={'count':0x0,'rows':[]};var _0x1676d0=_[_0xbda3('0x29')](db[_0xbda3('0x2a')][_0xbda3('0x2b')],function(_0x5d8ef9){return{'name':_0x5d8ef9[_0xbda3('0x2c')],'type':_0x5d8ef9[_0xbda3('0x2d')]['key']};});_0x37d2b3[_0xbda3('0x2e')]=_[_0xbda3('0x29')](_0x1676d0,_0xbda3('0x27'));_0x37d2b3[_0xbda3('0x2f')]=_['keys'](_0x584e40[_0xbda3('0x2f')]);_0x37d2b3[_0xbda3('0x30')]=_[_0xbda3('0x31')](_0x37d2b3[_0xbda3('0x2e')],_0x37d2b3[_0xbda3('0x2f')]);_0x328cb0['attributes']=_[_0xbda3('0x31')](_0x37d2b3['model'],qs[_0xbda3('0x32')](_0x584e40[_0xbda3('0x2f')][_0xbda3('0x32')]));_0x328cb0['attributes']=_0x328cb0[_0xbda3('0x33')][_0xbda3('0x34')]?_0x328cb0['attributes']:_0x37d2b3[_0xbda3('0x2e')];if(!_0x584e40[_0xbda3('0x2f')][_0xbda3('0x35')](_0xbda3('0x36'))){_0x328cb0[_0xbda3('0x1f')]=qs[_0xbda3('0x1f')](_0x584e40['query'][_0xbda3('0x1f')]);_0x328cb0['offset']=qs[_0xbda3('0x1d')](_0x584e40['query'][_0xbda3('0x1d')]);}_0x328cb0[_0xbda3('0x37')]=qs[_0xbda3('0x38')](_0x584e40[_0xbda3('0x2f')][_0xbda3('0x38')]);_0x328cb0[_0xbda3('0x39')]=qs['filters'](_[_0xbda3('0x3a')](_0x584e40['query'],_0x37d2b3[_0xbda3('0x30')]),_0x1676d0);if(_0x584e40[_0xbda3('0x2f')][_0xbda3('0x3b')]){_0x328cb0['where']=_[_0xbda3('0x3c')](_0x328cb0[_0xbda3('0x39')],{'$or':_[_0xbda3('0x29')](_0x1676d0,function(_0x485bbd){if(_0x485bbd[_0xbda3('0x2d')]!==_0xbda3('0x3d')){var _0x23c95a={};_0x23c95a[_0x485bbd[_0xbda3('0x27')]]={'$like':'%'+_0x584e40['query'][_0xbda3('0x3b')]+'%'};return _0x23c95a;}})});}_0x328cb0=_[_0xbda3('0x3c')]({},_0x328cb0,_0x584e40[_0xbda3('0x3e')]);var _0x29bb43={'where':_0x328cb0[_0xbda3('0x39')]};return db[_0xbda3('0x2a')]['count'](_0x29bb43)[_0xbda3('0x25')](function(_0x27c991){_0x2fb58c[_0xbda3('0x3f')]=_0x27c991;if(_0x584e40['query'][_0xbda3('0x40')]){_0x328cb0[_0xbda3('0x41')]=[{'all':!![]}];}return db[_0xbda3('0x2a')][_0xbda3('0x42')](_0x328cb0);})[_0xbda3('0x25')](function(_0x11f884){_0x2fb58c[_0xbda3('0x43')]=_0x11f884;return _0x2fb58c;})[_0xbda3('0x25')](respondWithFilteredResult(_0x14e57e,_0x328cb0))[_0xbda3('0x44')](handleError(_0x14e57e,null));};exports[_0xbda3('0x45')]=function(_0x64546f,_0x5063b5){var _0x36394f={'raw':![],'where':{'id':_0x64546f[_0xbda3('0x46')]['id']}},_0x26c2eb={};_0x26c2eb[_0xbda3('0x2e')]=_[_0xbda3('0x47')](db[_0xbda3('0x2a')]['rawAttributes']);_0x26c2eb[_0xbda3('0x2f')]=_[_0xbda3('0x47')](_0x64546f['query']);_0x26c2eb[_0xbda3('0x30')]=_[_0xbda3('0x31')](_0x26c2eb[_0xbda3('0x2e')],_0x26c2eb[_0xbda3('0x2f')]);_0x36394f[_0xbda3('0x33')]=_['intersection'](_0x26c2eb['model'],qs[_0xbda3('0x32')](_0x64546f['query'][_0xbda3('0x32')]));_0x36394f[_0xbda3('0x33')]=_0x36394f['attributes']['length']?_0x36394f[_0xbda3('0x33')]:_0x26c2eb[_0xbda3('0x2e')];if(_0x64546f[_0xbda3('0x2f')][_0xbda3('0x40')]){_0x36394f[_0xbda3('0x41')]=[{'all':!![]}];}_0x36394f=_['merge']({},_0x36394f,_0x64546f[_0xbda3('0x3e')]);return db['IntegrationReport'][_0xbda3('0x48')](_0x36394f)[_0xbda3('0x25')](handleEntityNotFound(_0x5063b5,null))[_0xbda3('0x25')](respondWithResult(_0x5063b5,null))[_0xbda3('0x44')](handleError(_0x5063b5,null));};exports[_0xbda3('0x49')]=function(_0x323537,_0x490d11){return db[_0xbda3('0x2a')][_0xbda3('0x49')](_0x323537[_0xbda3('0x4a')],{})[_0xbda3('0x25')](respondWithResult(_0x490d11,0xc9))[_0xbda3('0x44')](handleError(_0x490d11,null));};exports[_0xbda3('0x4b')]=function(_0x3a7ee8,_0x39e6e2){if(_0x3a7ee8[_0xbda3('0x4a')]['id']){delete _0x3a7ee8[_0xbda3('0x4a')]['id'];}return db[_0xbda3('0x2a')]['find']({'where':{'id':_0x3a7ee8[_0xbda3('0x46')]['id']}})[_0xbda3('0x25')](handleEntityNotFound(_0x39e6e2,null))[_0xbda3('0x25')](saveUpdates(_0x3a7ee8['body'],null))[_0xbda3('0x25')](respondWithResult(_0x39e6e2,null))[_0xbda3('0x44')](handleError(_0x39e6e2,null));};exports[_0xbda3('0x24')]=function(_0x33522d,_0x319984){return db[_0xbda3('0x2a')]['find']({'where':{'id':_0x33522d[_0xbda3('0x46')]['id']}})[_0xbda3('0x25')](handleEntityNotFound(_0x319984,null))[_0xbda3('0x25')](removeEntity(_0x319984,null))[_0xbda3('0x44')](handleError(_0x319984,null));};exports[_0xbda3('0x4c')]=function(_0x41762a,_0x4fad43){return db[_0xbda3('0x2a')][_0xbda3('0x4c')]()[_0xbda3('0x25')](respondWithResult(_0x4fad43,null))['catch'](handleError(_0x4fad43,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 021d036..77d97a1 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 _0x49d6=['../../config/logger','moment','bluebird','path','./integrationReport.attributes','exports','define','report_integration','lodash','util'];(function(_0x4148c9,_0x24a582){var _0x39fbc0=function(_0xae5b5e){while(--_0xae5b5e){_0x4148c9['push'](_0x4148c9['shift']());}};_0x39fbc0(++_0x24a582);}(_0x49d6,0x1de));var _0x649d=function(_0x285e69,_0xad614d){_0x285e69=_0x285e69-0x0;var _0x2b448c=_0x49d6[_0x285e69];return _0x2b448c;};'use strict';var _=require(_0x649d('0x0'));var util=require(_0x649d('0x1'));var logger=require(_0x649d('0x2'))('api');var moment=require(_0x649d('0x3'));var BPromise=require(_0x649d('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x649d('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x649d('0x6'));module[_0x649d('0x7')]=function(_0xf2648,_0x1c35a2){return _0xf2648[_0x649d('0x8')]('IntegrationReport',attributes,{'tableName':_0x649d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8c26=['path','rimraf','../../config/environment','./integrationReport.attributes','exports','report_integration','lodash','util','../../config/logger','request-promise'];(function(_0x4f9ac5,_0xc36855){var _0x431dae=function(_0x53748c){while(--_0x53748c){_0x4f9ac5['push'](_0x4f9ac5['shift']());}};_0x431dae(++_0xc36855);}(_0x8c26,0x6a));var _0x68c2=function(_0x3b2a03,_0x343d9f){_0x3b2a03=_0x3b2a03-0x0;var _0x305ee6=_0x8c26[_0x3b2a03];return _0x305ee6;};'use strict';var _=require(_0x68c2('0x0'));var util=require(_0x68c2('0x1'));var logger=require(_0x68c2('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x68c2('0x3'));var fs=require('fs');var path=require(_0x68c2('0x4'));var rimraf=require(_0x68c2('0x5'));var config=require(_0x68c2('0x6'));var attributes=require(_0x68c2('0x7'));module[_0x68c2('0x8')]=function(_0x3cc968,_0x35440f){return _0x3cc968['define']('IntegrationReport',attributes,{'tableName':_0x68c2('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 151c7f9..e57e6fc 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 _0x814b=['info','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then'];(function(_0x4d07cc,_0x587613){var _0x42de3b=function(_0x201f78){while(--_0x201f78){_0x4d07cc['push'](_0x4d07cc['shift']());}};_0x42de3b(++_0x587613);}(_0x814b,0x1a2));var _0xb814=function(_0x369289,_0xb779d8){_0x369289=_0x369289-0x0;var _0x1c8ba4=_0x814b[_0x369289];return _0x1c8ba4;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var moment=require(_0xb814('0x2'));var BPromise=require(_0xb814('0x3'));var rs=require(_0xb814('0x4'));var fs=require('fs');var Redis=require(_0xb814('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xb814('0x6'));var logger=require(_0xb814('0x7'))(_0xb814('0x8'));var config=require(_0xb814('0x9'));var jayson=require(_0xb814('0xa'));var client=jayson[_0xb814('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3b0829,_0x2e6272,_0x5c8539){return new BPromise(function(_0x271af9,_0x2913a6){return client[_0xb814('0xc')](_0x3b0829,_0x5c8539)[_0xb814('0xd')](function(_0x1fea33){logger[_0xb814('0xe')](_0xb814('0xf'),_0x2e6272,_0xb814('0x10'));logger[_0xb814('0x11')](_0xb814('0x12'),_0x2e6272,_0xb814('0x10'),JSON['stringify'](_0x1fea33));if(_0x1fea33[_0xb814('0x13')]){if(_0x1fea33['error'][_0xb814('0x14')]===0x1f4){logger[_0xb814('0x13')](_0xb814('0xf'),_0x2e6272,_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);return _0x2913a6(_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);}logger[_0xb814('0x13')](_0xb814('0xf'),_0x2e6272,_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);return _0x271af9(_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);}else{logger[_0xb814('0xe')](_0xb814('0xf'),_0x2e6272,_0xb814('0x10'));_0x271af9(_0x1fea33[_0xb814('0x16')][_0xb814('0x15')]);}})[_0xb814('0x17')](function(_0x21b73f){logger[_0xb814('0x13')]('IntegrationReport,\x20%s,\x20%s',_0x2e6272,_0x21b73f);_0x2913a6(_0x21b73f);});});} \ No newline at end of file +var _0x2542=['info','IntegrationReport,\x20%s,\x20%s','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then'];(function(_0x51ad77,_0x545f7f){var _0x256f89=function(_0x145324){while(--_0x145324){_0x51ad77['push'](_0x51ad77['shift']());}};_0x256f89(++_0x545f7f);}(_0x2542,0x169));var _0x2254=function(_0x1f7918,_0x45b77e){_0x1f7918=_0x1f7918-0x0;var _0x2feb76=_0x2542[_0x1f7918];return _0x2feb76;};'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});function respondWithRpcPromise(_0xe8ca50,_0x2ee7ee,_0x3c45ec){return new BPromise(function(_0x1637ad,_0x477b47){return client[_0x2254('0xb')](_0xe8ca50,_0x3c45ec)[_0x2254('0xc')](function(_0xb395da){logger[_0x2254('0xd')](_0x2254('0xe'),_0x2ee7ee,'request\x20sent');logger[_0x2254('0xf')](_0x2254('0x10'),_0x2ee7ee,_0x2254('0x11'),JSON[_0x2254('0x12')](_0xb395da));if(_0xb395da['error']){if(_0xb395da['error'][_0x2254('0x13')]===0x1f4){logger[_0x2254('0x14')](_0x2254('0xe'),_0x2ee7ee,_0xb395da[_0x2254('0x14')][_0x2254('0x15')]);return _0x477b47(_0xb395da[_0x2254('0x14')]['message']);}logger[_0x2254('0x14')](_0x2254('0xe'),_0x2ee7ee,_0xb395da['error'][_0x2254('0x15')]);return _0x1637ad(_0xb395da[_0x2254('0x14')][_0x2254('0x15')]);}else{logger[_0x2254('0xd')](_0x2254('0xe'),_0x2ee7ee,_0x2254('0x11'));_0x1637ad(_0xb395da['result'][_0x2254('0x15')]);}})['catch'](function(_0x327d6d){logger[_0x2254('0x14')](_0x2254('0xe'),_0x2ee7ee,_0x327d6d);_0x477b47(_0x327d6d);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index ffc8255..8a929a7 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 _0x74f3=['/:id','show','/:id/sub_intervals','getIntervals','post','create','addInterval','/:id/sub_intervals/create_many','addIntervals','delete','destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./interval.controller','isAuthenticated','index','get'];(function(_0x30cee,_0x57b5f4){var _0x308a7f=function(_0x2342f1){while(--_0x2342f1){_0x30cee['push'](_0x30cee['shift']());}};_0x308a7f(++_0x57b5f4);}(_0x74f3,0x164));var _0x374f=function(_0x17a07a,_0x4901d6){_0x17a07a=_0x17a07a-0x0;var _0x140571=_0x74f3[_0x17a07a];return _0x140571;};'use strict';var multer=require(_0x374f('0x0'));var util=require(_0x374f('0x1'));var path=require(_0x374f('0x2'));var timeout=require('connect-timeout');var express=require(_0x374f('0x3'));var router=express[_0x374f('0x4')]();var fs_extra=require(_0x374f('0x5'));var auth=require(_0x374f('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x374f('0x7'));var controller=require(_0x374f('0x8'));router['get']('/',auth[_0x374f('0x9')](),controller[_0x374f('0xa')]);router[_0x374f('0xb')](_0x374f('0xc'),auth[_0x374f('0x9')](),controller[_0x374f('0xd')]);router[_0x374f('0xb')](_0x374f('0xe'),auth['isAuthenticated'](),controller[_0x374f('0xf')]);router[_0x374f('0x10')]('/',auth[_0x374f('0x9')](),controller[_0x374f('0x11')]);router[_0x374f('0x10')]('/:id/sub_intervals',auth[_0x374f('0x9')](),controller[_0x374f('0x12')]);router['post'](_0x374f('0x13'),auth[_0x374f('0x9')](),controller[_0x374f('0x14')]);router['put'](_0x374f('0xc'),auth[_0x374f('0x9')](),controller['update']);router[_0x374f('0x15')](_0x374f('0xc'),auth['isAuthenticated'](),controller[_0x374f('0x16')]);module['exports']=router; \ No newline at end of file +var _0x7d10=['destroy','exports','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./interval.controller','get','isAuthenticated','index','/:id','show','/:id/sub_intervals','getIntervals','post','create','addInterval','addIntervals','put','update','delete'];(function(_0x3c9417,_0x11d70b){var _0x97d01=function(_0x48e001){while(--_0x48e001){_0x3c9417['push'](_0x3c9417['shift']());}};_0x97d01(++_0x11d70b);}(_0x7d10,0x1ce));var _0x07d1=function(_0x110374,_0x5c0a54){_0x110374=_0x110374-0x0;var _0x52109d=_0x7d10[_0x110374];return _0x52109d;};'use strict';var multer=require('multer');var util=require(_0x07d1('0x0'));var path=require(_0x07d1('0x1'));var timeout=require('connect-timeout');var express=require(_0x07d1('0x2'));var router=express[_0x07d1('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x07d1('0x4'));var interaction=require(_0x07d1('0x5'));var config=require('../../config/environment');var controller=require(_0x07d1('0x6'));router[_0x07d1('0x7')]('/',auth[_0x07d1('0x8')](),controller[_0x07d1('0x9')]);router['get'](_0x07d1('0xa'),auth[_0x07d1('0x8')](),controller[_0x07d1('0xb')]);router[_0x07d1('0x7')](_0x07d1('0xc'),auth[_0x07d1('0x8')](),controller[_0x07d1('0xd')]);router[_0x07d1('0xe')]('/',auth[_0x07d1('0x8')](),controller[_0x07d1('0xf')]);router[_0x07d1('0xe')](_0x07d1('0xc'),auth[_0x07d1('0x8')](),controller[_0x07d1('0x10')]);router[_0x07d1('0xe')]('/:id/sub_intervals/create_many',auth['isAuthenticated'](),controller[_0x07d1('0x11')]);router[_0x07d1('0x12')](_0x07d1('0xa'),auth[_0x07d1('0x8')](),controller[_0x07d1('0x13')]);router[_0x07d1('0x14')](_0x07d1('0xa'),auth[_0x07d1('0x8')](),controller[_0x07d1('0x15')]);module[_0x07d1('0x16')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index 2c4376c..bee3a53 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 _0x954e=['exports','STRING'];(function(_0x42f009,_0x5e27b1){var _0x22a1e0=function(_0x297993){while(--_0x297993){_0x42f009['push'](_0x42f009['shift']());}};_0x22a1e0(++_0x5e27b1);}(_0x954e,0x176));var _0xe954=function(_0x1385fe,_0x55a7d8){_0x1385fe=_0x1385fe-0x0;var _0x4903e6=_0x954e[_0x1385fe];return _0x4903e6;};'use strict';var Sequelize=require('sequelize');module[_0xe954('0x0')]={'name':{'type':Sequelize[_0xe954('0x1')]},'description':{'type':Sequelize[_0xe954('0x1')]},'interval':{'type':Sequelize[_0xe954('0x1')],'allowNull':!![]}}; \ No newline at end of file +var _0x8e0a=['STRING','sequelize'];(function(_0x525c7b,_0x488fcc){var _0x27b33e=function(_0x56d43b){while(--_0x56d43b){_0x525c7b['push'](_0x525c7b['shift']());}};_0x27b33e(++_0x488fcc);}(_0x8e0a,0xc7));var _0xa8e0=function(_0x5e6606,_0xd6475){_0x5e6606=_0x5e6606-0x0;var _0xc227b8=_0x8e0a[_0x5e6606];return _0xc227b8;};'use strict';var Sequelize=require(_0xa8e0('0x0'));module['exports']={'name':{'type':Sequelize[_0xa8e0('0x1')]},'description':{'type':Sequelize[_0xa8e0('0x1')]},'interval':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/interval/interval.controller.js b/server/api/interval/interval.controller.js index c912565..7939ba3 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 _0xdbe1=['UserProfileSection','find','userProfileId','autoAssociation','destroy','addInterval','IntervalId','getIntervals','keys','order','pick','nolimit','addIntervals','findOne','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','undefined','limit','count','offset','status','set','json','save','update','then','get','Intervals','UserProfileResource','end','sendStatus','error','stack','name','send','index','rawAttributes','fieldName','key','model','map','query','filters','intersection','fields','attributes','length','hasOwnProperty','sort','where','filter','VIRTUAL','merge','options','includeAll','Interval','findAll','rows','catch','show','params','include','create','body','user'];(function(_0x586640,_0x86231e){var _0x440759=function(_0x17bff1){while(--_0x17bff1){_0x586640['push'](_0x586640['shift']());}};_0x440759(++_0x86231e);}(_0xdbe1,0x16e));var _0x1dbe=function(_0x3f55d3,_0x53bfe2){_0x3f55d3=_0x3f55d3-0x0;var _0x4f351b=_0xdbe1[_0x3f55d3];return _0x4f351b;};'use strict';var emlformat=require(_0x1dbe('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1dbe('0x1'));var jsonpatch=require(_0x1dbe('0x2'));var rp=require(_0x1dbe('0x3'));var moment=require(_0x1dbe('0x4'));var BPromise=require(_0x1dbe('0x5'));var Mustache=require('mustache');var util=require(_0x1dbe('0x6'));var path=require(_0x1dbe('0x7'));var sox=require(_0x1dbe('0x8'));var csv=require(_0x1dbe('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1dbe('0xa'));var _=require(_0x1dbe('0xb'));var squel=require(_0x1dbe('0xc'));var crypto=require(_0x1dbe('0xd'));var jsforce=require(_0x1dbe('0xe'));var deskjs=require(_0x1dbe('0xf'));var toCsv=require(_0x1dbe('0x9'));var querystring=require('querystring');var Papa=require(_0x1dbe('0x10'));var Redis=require(_0x1dbe('0x11'));var authService=require(_0x1dbe('0x12'));var qs=require(_0x1dbe('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x1dbe('0x14'))(_0x1dbe('0x15'));var utils=require('../../config/utils');var config=require(_0x1dbe('0x16'));var licenseUtil=require(_0x1dbe('0x17'));var db=require(_0x1dbe('0x18'))['db'];var extensions=require('../../components/extensions/rewrite');function respondWithStatusCode(_0x446f9e,_0x5dcd23){_0x5dcd23=_0x5dcd23||0xcc;return function(_0x254ce9){if(_0x254ce9){return _0x446f9e['sendStatus'](_0x5dcd23);}return _0x446f9e['status'](_0x5dcd23)['end']();};}function respondWithResult(_0x1b7dcc,_0x178ae8){_0x178ae8=_0x178ae8||0xc8;return function(_0x39b8f3){if(_0x39b8f3){return _0x1b7dcc['status'](_0x178ae8)['json'](_0x39b8f3);}};}function respondWithFilteredResult(_0x363d7e,_0x191b1e){return function(_0x4daa4b){if(_0x4daa4b){var _0x24501f=typeof _0x191b1e['offset']===_0x1dbe('0x19')&&typeof _0x191b1e[_0x1dbe('0x1a')]===_0x1dbe('0x19');var _0x1410fd=_0x4daa4b[_0x1dbe('0x1b')];var _0x58fa84=_0x24501f?0x0:_0x191b1e[_0x1dbe('0x1c')];var _0x2fffcb=_0x24501f?_0x4daa4b[_0x1dbe('0x1b')]:_0x191b1e['offset']+_0x191b1e[_0x1dbe('0x1a')];var _0x5f0e9b;if(_0x2fffcb>=_0x1410fd){_0x2fffcb=_0x1410fd;_0x5f0e9b=0xc8;}else{_0x5f0e9b=0xce;}_0x363d7e[_0x1dbe('0x1d')](_0x5f0e9b);return _0x363d7e[_0x1dbe('0x1e')]('Content-Range',_0x58fa84+'-'+_0x2fffcb+'/'+_0x1410fd)[_0x1dbe('0x1f')](_0x4daa4b);}return null;};}function patchUpdates(_0x152728){return function(_0x369007){try{jsonpatch['apply'](_0x369007,_0x152728,!![]);}catch(_0x31594b){return BPromise['reject'](_0x31594b);}return _0x369007[_0x1dbe('0x20')]();};}function saveUpdates(_0x4c2ec6,_0x30a337){return function(_0x55d472){if(_0x55d472){return _0x55d472[_0x1dbe('0x21')](_0x4c2ec6)[_0x1dbe('0x22')](function(_0x2c47b7){return _0x2c47b7;});}return null;};}function removeEntity(_0x361343,_0x18eb2d){return function(_0xaff480){if(_0xaff480){return _0xaff480['destroy']()[_0x1dbe('0x22')](function(){var _0x2246e3=_0xaff480[_0x1dbe('0x23')]({'plain':!![]});var _0x2af252=_0x1dbe('0x24');return db[_0x1dbe('0x25')]['destroy']({'where':{'type':_0x2af252,'resourceId':_0x2246e3['id']}})[_0x1dbe('0x22')](function(){return _0xaff480;});})['then'](function(){_0x361343[_0x1dbe('0x1d')](0xcc)[_0x1dbe('0x26')]();});}};}function handleEntityNotFound(_0x5664d6,_0x5eccbb){return function(_0x13a2e4){if(!_0x13a2e4){_0x5664d6[_0x1dbe('0x27')](0x194);}return _0x13a2e4;};}function handleError(_0x3dc591,_0x516945){_0x516945=_0x516945||0x1f4;return function(_0x27bc5c){logger[_0x1dbe('0x28')](_0x27bc5c[_0x1dbe('0x29')]);if(_0x27bc5c['name']){delete _0x27bc5c[_0x1dbe('0x2a')];}_0x3dc591[_0x1dbe('0x1d')](_0x516945)[_0x1dbe('0x2b')](_0x27bc5c);};}exports[_0x1dbe('0x2c')]=function(_0x2fe9cd,_0x29327b){var _0x4feb31={},_0x1523e4={},_0x1270dd={'count':0x0,'rows':[]};var _0x2c57af=_['map'](db['Interval'][_0x1dbe('0x2d')],function(_0x12907d){return{'name':_0x12907d[_0x1dbe('0x2e')],'type':_0x12907d['type'][_0x1dbe('0x2f')]};});_0x1523e4[_0x1dbe('0x30')]=_[_0x1dbe('0x31')](_0x2c57af,'name');_0x1523e4[_0x1dbe('0x32')]=_['keys'](_0x2fe9cd[_0x1dbe('0x32')]);_0x1523e4[_0x1dbe('0x33')]=_[_0x1dbe('0x34')](_0x1523e4[_0x1dbe('0x30')],_0x1523e4[_0x1dbe('0x32')]);_0x4feb31['attributes']=_['intersection'](_0x1523e4[_0x1dbe('0x30')],qs[_0x1dbe('0x35')](_0x2fe9cd['query'][_0x1dbe('0x35')]));_0x4feb31[_0x1dbe('0x36')]=_0x4feb31[_0x1dbe('0x36')][_0x1dbe('0x37')]?_0x4feb31[_0x1dbe('0x36')]:_0x1523e4['model'];if(!_0x2fe9cd['query'][_0x1dbe('0x38')]('nolimit')){_0x4feb31[_0x1dbe('0x1a')]=qs[_0x1dbe('0x1a')](_0x2fe9cd[_0x1dbe('0x32')][_0x1dbe('0x1a')]);_0x4feb31[_0x1dbe('0x1c')]=qs[_0x1dbe('0x1c')](_0x2fe9cd[_0x1dbe('0x32')][_0x1dbe('0x1c')]);}_0x4feb31['order']=qs[_0x1dbe('0x39')](_0x2fe9cd['query'][_0x1dbe('0x39')]);_0x4feb31[_0x1dbe('0x3a')]=qs[_0x1dbe('0x33')](_['pick'](_0x2fe9cd[_0x1dbe('0x32')],_0x1523e4[_0x1dbe('0x33')]),_0x2c57af);if(_0x2fe9cd['query'][_0x1dbe('0x3b')]){_0x4feb31[_0x1dbe('0x3a')]=_['merge'](_0x4feb31[_0x1dbe('0x3a')],{'$or':_[_0x1dbe('0x31')](_0x2c57af,function(_0x5455b6){if(_0x5455b6['type']!==_0x1dbe('0x3c')){var _0x1de0f3={};_0x1de0f3[_0x5455b6[_0x1dbe('0x2a')]]={'$like':'%'+_0x2fe9cd['query'][_0x1dbe('0x3b')]+'%'};return _0x1de0f3;}})});}_0x4feb31=_[_0x1dbe('0x3d')]({},_0x4feb31,_0x2fe9cd[_0x1dbe('0x3e')]);var _0x45c439={'where':_0x4feb31[_0x1dbe('0x3a')]};return db['Interval'][_0x1dbe('0x1b')](_0x45c439)['then'](function(_0x138a80){_0x1270dd[_0x1dbe('0x1b')]=_0x138a80;if(_0x2fe9cd['query'][_0x1dbe('0x3f')]){_0x4feb31['include']=[{'all':!![]}];}return db[_0x1dbe('0x40')][_0x1dbe('0x41')](_0x4feb31);})[_0x1dbe('0x22')](function(_0x2a237e){_0x1270dd[_0x1dbe('0x42')]=_0x2a237e;return _0x1270dd;})['then'](respondWithFilteredResult(_0x29327b,_0x4feb31))[_0x1dbe('0x43')](handleError(_0x29327b,null));};exports[_0x1dbe('0x44')]=function(_0x4bde93,_0x2ee964){var _0x516523={'raw':!![],'where':{'id':_0x4bde93[_0x1dbe('0x45')]['id']}},_0x43c07b={};_0x43c07b[_0x1dbe('0x30')]=_['keys'](db['Interval'][_0x1dbe('0x2d')]);_0x43c07b[_0x1dbe('0x32')]=_['keys'](_0x4bde93[_0x1dbe('0x32')]);_0x43c07b['filters']=_[_0x1dbe('0x34')](_0x43c07b['model'],_0x43c07b['query']);_0x516523[_0x1dbe('0x36')]=_[_0x1dbe('0x34')](_0x43c07b[_0x1dbe('0x30')],qs[_0x1dbe('0x35')](_0x4bde93[_0x1dbe('0x32')][_0x1dbe('0x35')]));_0x516523[_0x1dbe('0x36')]=_0x516523[_0x1dbe('0x36')][_0x1dbe('0x37')]?_0x516523[_0x1dbe('0x36')]:_0x43c07b[_0x1dbe('0x30')];if(_0x4bde93[_0x1dbe('0x32')][_0x1dbe('0x3f')]){_0x516523[_0x1dbe('0x46')]=[{'all':!![]}];}_0x516523=_[_0x1dbe('0x3d')]({},_0x516523,_0x4bde93[_0x1dbe('0x3e')]);return db[_0x1dbe('0x40')]['find'](_0x516523)[_0x1dbe('0x22')](handleEntityNotFound(_0x2ee964,null))[_0x1dbe('0x22')](respondWithResult(_0x2ee964,null))[_0x1dbe('0x43')](handleError(_0x2ee964,null));};exports[_0x1dbe('0x47')]=function(_0x16e0f2,_0x272d64){return db['Interval'][_0x1dbe('0x47')](_0x16e0f2[_0x1dbe('0x48')],{})['then'](function(_0x54996d){var _0x403183=_0x16e0f2[_0x1dbe('0x49')][_0x1dbe('0x23')]({'plain':!![]});if(!_0x403183)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x403183['role']==='user'){var _0x41f0ce=_0x54996d[_0x1dbe('0x23')]({'plain':!![]});var _0x16d723=_0x1dbe('0x24');return db[_0x1dbe('0x4a')][_0x1dbe('0x4b')]({'where':{'name':_0x16d723,'userProfileId':_0x403183[_0x1dbe('0x4c')]},'raw':!![]})[_0x1dbe('0x22')](function(_0xc346d8){if(_0xc346d8&&_0xc346d8[_0x1dbe('0x4d')]===0x0){return db[_0x1dbe('0x25')][_0x1dbe('0x47')]({'name':_0x41f0ce['name'],'resourceId':_0x41f0ce['id'],'type':_0xc346d8[_0x1dbe('0x2a')],'sectionId':_0xc346d8['id']},{})['then'](function(){return _0x54996d;});}else{return _0x54996d;}})[_0x1dbe('0x43')](function(_0x347ab7){logger[_0x1dbe('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x347ab7);throw _0x347ab7;});}return _0x54996d;})['then'](respondWithResult(_0x272d64,0xc9))[_0x1dbe('0x43')](handleError(_0x272d64,null));};exports[_0x1dbe('0x21')]=function(_0x372be7,_0x5d82c3){if(_0x372be7[_0x1dbe('0x48')]['id']){delete _0x372be7['body']['id'];}return db[_0x1dbe('0x40')]['find']({'where':{'id':_0x372be7[_0x1dbe('0x45')]['id']}})['then'](handleEntityNotFound(_0x5d82c3,null))[_0x1dbe('0x22')](saveUpdates(_0x372be7['body'],null))['then'](respondWithResult(_0x5d82c3,null))['catch'](handleError(_0x5d82c3,null));};exports[_0x1dbe('0x4e')]=function(_0xb7ca0b,_0x1b3ad2){return db[_0x1dbe('0x40')]['find']({'where':{'id':_0xb7ca0b['params']['id']}})['then'](handleEntityNotFound(_0x1b3ad2,null))[_0x1dbe('0x22')](removeEntity(_0x1b3ad2,null))['catch'](handleError(_0x1b3ad2,null));};exports[_0x1dbe('0x4f')]=function(_0x588dcc,_0x3d873e,_0x401910){if(_0x588dcc['body']['id']){delete _0x588dcc[_0x1dbe('0x48')]['id'];}return db[_0x1dbe('0x40')]['find']({'where':{'id':_0x588dcc['params']['id']}})[_0x1dbe('0x22')](handleEntityNotFound(_0x3d873e,null))['then'](function(_0x3b56be){if(_0x3b56be){_0x588dcc[_0x1dbe('0x48')][_0x1dbe('0x50')]=_0x3b56be['id'];return db[_0x1dbe('0x40')][_0x1dbe('0x47')](_0x588dcc[_0x1dbe('0x48')]);}})[_0x1dbe('0x22')](respondWithResult(_0x3d873e,null))['catch'](handleError(_0x3d873e,null));};exports[_0x1dbe('0x51')]=function(_0x45aa7d,_0x123378,_0xc2d185){var _0x282cbb={};var _0x17e77b={};var _0x44679d;var _0xb843ad;return db[_0x1dbe('0x40')]['findOne']({'where':{'id':_0x45aa7d[_0x1dbe('0x45')]['id']}})[_0x1dbe('0x22')](handleEntityNotFound(_0x123378,null))[_0x1dbe('0x22')](function(_0x57c531){if(_0x57c531){_0x44679d=_0x57c531;_0x17e77b[_0x1dbe('0x30')]=_['keys'](db['Interval'][_0x1dbe('0x2d')]);_0x17e77b[_0x1dbe('0x32')]=_[_0x1dbe('0x52')](_0x45aa7d[_0x1dbe('0x32')]);_0x17e77b[_0x1dbe('0x33')]=_[_0x1dbe('0x34')](_0x17e77b[_0x1dbe('0x30')],_0x17e77b[_0x1dbe('0x32')]);_0x282cbb[_0x1dbe('0x36')]=_['intersection'](_0x17e77b['model'],qs[_0x1dbe('0x35')](_0x45aa7d[_0x1dbe('0x32')][_0x1dbe('0x35')]));_0x282cbb[_0x1dbe('0x36')]=_0x282cbb[_0x1dbe('0x36')][_0x1dbe('0x37')]?_0x282cbb[_0x1dbe('0x36')]:_0x17e77b[_0x1dbe('0x30')];_0x282cbb[_0x1dbe('0x53')]=qs['sort'](_0x45aa7d['query'][_0x1dbe('0x39')]);_0x282cbb[_0x1dbe('0x3a')]=qs[_0x1dbe('0x33')](_[_0x1dbe('0x54')](_0x45aa7d[_0x1dbe('0x32')],_0x17e77b[_0x1dbe('0x33')]));if(_0x45aa7d['query'][_0x1dbe('0x3b')]){_0x282cbb[_0x1dbe('0x3a')]=_[_0x1dbe('0x3d')](_0x282cbb[_0x1dbe('0x3a')],{'$or':_[_0x1dbe('0x31')](_0x282cbb[_0x1dbe('0x36')],function(_0x4ab597){var _0x426c7a={};_0x426c7a[_0x4ab597]={'$like':'%'+_0x45aa7d['query'][_0x1dbe('0x3b')]+'%'};return _0x426c7a;})});}_0x282cbb=_[_0x1dbe('0x3d')]({},_0x282cbb,_0x45aa7d['options']);return _0x44679d['getIntervals'](_0x282cbb);}})[_0x1dbe('0x22')](function(_0x4e730c){if(_0x4e730c){_0xb843ad=_0x4e730c[_0x1dbe('0x37')];if(!_0x45aa7d[_0x1dbe('0x32')]['hasOwnProperty'](_0x1dbe('0x55'))){_0x282cbb[_0x1dbe('0x1a')]=qs[_0x1dbe('0x1a')](_0x45aa7d[_0x1dbe('0x32')][_0x1dbe('0x1a')]);_0x282cbb['offset']=qs[_0x1dbe('0x1c')](_0x45aa7d['query'][_0x1dbe('0x1c')]);}return _0x44679d[_0x1dbe('0x51')](_0x282cbb);}})['then'](function(_0x900fd3){if(_0x900fd3){return _0x900fd3?{'count':_0xb843ad,'rows':_0x900fd3}:null;}})[_0x1dbe('0x22')](respondWithResult(_0x123378,null))[_0x1dbe('0x43')](handleError(_0x123378,null));};exports[_0x1dbe('0x56')]=function(_0x2ff377,_0x4f9ea1,_0xa54532){return db['Interval'][_0x1dbe('0x57')]({'where':{'id':_0x2ff377[_0x1dbe('0x45')]['id']}})['then'](handleEntityNotFound(_0x4f9ea1,null))[_0x1dbe('0x22')](function(_0x2ae787){if(_0x2ae787){return db['sequelize']['transaction'](function(_0x173dbc){return db[_0x1dbe('0x40')]['destroy']({'where':{'IntervalId':_0x2ff377[_0x1dbe('0x45')]['id']},'transaction':_0x173dbc})[_0x1dbe('0x22')](function(_0x26f04b){var _0x5a8600=_[_0x1dbe('0x31')](_0x2ff377[_0x1dbe('0x48')],function(_0x45f0db){delete _0x45f0db['id'];_0x45f0db['IntervalId']=_0x2ff377[_0x1dbe('0x45')]['id'];return _0x45f0db;});return db[_0x1dbe('0x40')]['bulkCreate'](_0x5a8600,{'transaction':_0x173dbc});});})[_0x1dbe('0x22')](function(){return db[_0x1dbe('0x40')][_0x1dbe('0x41')]({'where':{'IntervalId':_0x2ff377['params']['id']}});});}})[_0x1dbe('0x22')](respondWithResult(_0x4f9ea1,null))[_0x1dbe('0x43')](handleError(_0x4f9ea1,null));}; \ No newline at end of file +var _0x09c3=['json','offset','undefined','count','limit','apply','update','then','get','Intervals','UserProfileResource','destroy','sendStatus','error','stack','name','send','map','Interval','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','type','VIRTUAL','filter','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addInterval','IntervalId','getIntervals','findOne','merge','options','addIntervals','sequelize','transaction','bulkCreate','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','status','end'];(function(_0x349316,_0x6edd6f){var _0x17d5e9=function(_0x499585){while(--_0x499585){_0x349316['push'](_0x349316['shift']());}};_0x17d5e9(++_0x6edd6f);}(_0x09c3,0x14c));var _0x309c=function(_0x4599b6,_0x40c254){_0x4599b6=_0x4599b6-0x0;var _0x2e014c=_0x09c3[_0x4599b6];return _0x2e014c;};'use strict';var emlformat=require(_0x309c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x309c('0x1'));var jsonpatch=require(_0x309c('0x2'));var rp=require(_0x309c('0x3'));var moment=require(_0x309c('0x4'));var BPromise=require(_0x309c('0x5'));var Mustache=require('mustache');var util=require(_0x309c('0x6'));var path=require('path');var sox=require(_0x309c('0x7'));var csv=require(_0x309c('0x8'));var ejs=require(_0x309c('0x9'));var fs=require('fs');var fs_extra=require(_0x309c('0xa'));var _=require(_0x309c('0xb'));var squel=require('squel');var crypto=require(_0x309c('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x309c('0xd'));var toCsv=require(_0x309c('0x8'));var querystring=require(_0x309c('0xe'));var Papa=require(_0x309c('0xf'));var Redis=require('ioredis');var authService=require(_0x309c('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x309c('0x11'));var hardwareService=require(_0x309c('0x12'));var logger=require(_0x309c('0x13'))(_0x309c('0x14'));var utils=require(_0x309c('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var extensions=require('../../components/extensions/rewrite');function respondWithStatusCode(_0x1ecbf0,_0x26f74c){_0x26f74c=_0x26f74c||0xcc;return function(_0x10f8f7){if(_0x10f8f7){return _0x1ecbf0['sendStatus'](_0x26f74c);}return _0x1ecbf0[_0x309c('0x16')](_0x26f74c)[_0x309c('0x17')]();};}function respondWithResult(_0x28fab7,_0x3a74ee){_0x3a74ee=_0x3a74ee||0xc8;return function(_0x2401a6){if(_0x2401a6){return _0x28fab7[_0x309c('0x16')](_0x3a74ee)[_0x309c('0x18')](_0x2401a6);}};}function respondWithFilteredResult(_0x12955e,_0x4d6d89){return function(_0x174a2c){if(_0x174a2c){var _0x1b8ff6=typeof _0x4d6d89[_0x309c('0x19')]===_0x309c('0x1a')&&typeof _0x4d6d89['limit']===_0x309c('0x1a');var _0x53d4b4=_0x174a2c[_0x309c('0x1b')];var _0x499838=_0x1b8ff6?0x0:_0x4d6d89['offset'];var _0x2d7028=_0x1b8ff6?_0x174a2c['count']:_0x4d6d89['offset']+_0x4d6d89[_0x309c('0x1c')];var _0x2d8878;if(_0x2d7028>=_0x53d4b4){_0x2d7028=_0x53d4b4;_0x2d8878=0xc8;}else{_0x2d8878=0xce;}_0x12955e[_0x309c('0x16')](_0x2d8878);return _0x12955e['set']('Content-Range',_0x499838+'-'+_0x2d7028+'/'+_0x53d4b4)[_0x309c('0x18')](_0x174a2c);}return null;};}function patchUpdates(_0x8fe037){return function(_0x21fc7b){try{jsonpatch[_0x309c('0x1d')](_0x21fc7b,_0x8fe037,!![]);}catch(_0x1b02c8){return BPromise['reject'](_0x1b02c8);}return _0x21fc7b['save']();};}function saveUpdates(_0x5011f7,_0xb514d7){return function(_0x1b865c){if(_0x1b865c){return _0x1b865c[_0x309c('0x1e')](_0x5011f7)[_0x309c('0x1f')](function(_0x833978){return _0x833978;});}return null;};}function removeEntity(_0x1e745c,_0x1d5ca9){return function(_0x44a6f0){if(_0x44a6f0){return _0x44a6f0['destroy']()['then'](function(){var _0x280e53=_0x44a6f0[_0x309c('0x20')]({'plain':!![]});var _0x6818b=_0x309c('0x21');return db[_0x309c('0x22')][_0x309c('0x23')]({'where':{'type':_0x6818b,'resourceId':_0x280e53['id']}})[_0x309c('0x1f')](function(){return _0x44a6f0;});})[_0x309c('0x1f')](function(){_0x1e745c[_0x309c('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x859304,_0x46249b){return function(_0x143cb1){if(!_0x143cb1){_0x859304[_0x309c('0x24')](0x194);}return _0x143cb1;};}function handleError(_0x2bd73a,_0x56106a){_0x56106a=_0x56106a||0x1f4;return function(_0xf90a4e){logger[_0x309c('0x25')](_0xf90a4e[_0x309c('0x26')]);if(_0xf90a4e[_0x309c('0x27')]){delete _0xf90a4e['name'];}_0x2bd73a[_0x309c('0x16')](_0x56106a)[_0x309c('0x28')](_0xf90a4e);};}exports['index']=function(_0xc69023,_0x1e3d67){var _0xbcb376={},_0x3d05e6={},_0x22f572={'count':0x0,'rows':[]};var _0x130c46=_[_0x309c('0x29')](db[_0x309c('0x2a')]['rawAttributes'],function(_0x5e45dd){return{'name':_0x5e45dd[_0x309c('0x2b')],'type':_0x5e45dd['type'][_0x309c('0x2c')]};});_0x3d05e6[_0x309c('0x2d')]=_[_0x309c('0x29')](_0x130c46,_0x309c('0x27'));_0x3d05e6[_0x309c('0x2e')]=_[_0x309c('0x2f')](_0xc69023[_0x309c('0x2e')]);_0x3d05e6[_0x309c('0x30')]=_[_0x309c('0x31')](_0x3d05e6[_0x309c('0x2d')],_0x3d05e6[_0x309c('0x2e')]);_0xbcb376[_0x309c('0x32')]=_[_0x309c('0x31')](_0x3d05e6['model'],qs[_0x309c('0x33')](_0xc69023['query'][_0x309c('0x33')]));_0xbcb376[_0x309c('0x32')]=_0xbcb376[_0x309c('0x32')][_0x309c('0x34')]?_0xbcb376[_0x309c('0x32')]:_0x3d05e6['model'];if(!_0xc69023[_0x309c('0x2e')][_0x309c('0x35')](_0x309c('0x36'))){_0xbcb376[_0x309c('0x1c')]=qs[_0x309c('0x1c')](_0xc69023[_0x309c('0x2e')][_0x309c('0x1c')]);_0xbcb376[_0x309c('0x19')]=qs[_0x309c('0x19')](_0xc69023[_0x309c('0x2e')]['offset']);}_0xbcb376[_0x309c('0x37')]=qs['sort'](_0xc69023['query'][_0x309c('0x38')]);_0xbcb376[_0x309c('0x39')]=qs[_0x309c('0x30')](_[_0x309c('0x3a')](_0xc69023['query'],_0x3d05e6[_0x309c('0x30')]),_0x130c46);if(_0xc69023[_0x309c('0x2e')]['filter']){_0xbcb376[_0x309c('0x39')]=_['merge'](_0xbcb376[_0x309c('0x39')],{'$or':_[_0x309c('0x29')](_0x130c46,function(_0x19c219){if(_0x19c219[_0x309c('0x3b')]!==_0x309c('0x3c')){var _0x1eda2d={};_0x1eda2d[_0x19c219['name']]={'$like':'%'+_0xc69023['query'][_0x309c('0x3d')]+'%'};return _0x1eda2d;}})});}_0xbcb376=_['merge']({},_0xbcb376,_0xc69023['options']);var _0x1d9c6f={'where':_0xbcb376[_0x309c('0x39')]};return db[_0x309c('0x2a')][_0x309c('0x1b')](_0x1d9c6f)['then'](function(_0x25fb61){_0x22f572[_0x309c('0x1b')]=_0x25fb61;if(_0xc69023[_0x309c('0x2e')][_0x309c('0x3e')]){_0xbcb376[_0x309c('0x3f')]=[{'all':!![]}];}return db[_0x309c('0x2a')][_0x309c('0x40')](_0xbcb376);})[_0x309c('0x1f')](function(_0x38e661){_0x22f572[_0x309c('0x41')]=_0x38e661;return _0x22f572;})['then'](respondWithFilteredResult(_0x1e3d67,_0xbcb376))[_0x309c('0x42')](handleError(_0x1e3d67,null));};exports[_0x309c('0x43')]=function(_0x596cfc,_0x342d56){var _0x159835={'raw':!![],'where':{'id':_0x596cfc[_0x309c('0x44')]['id']}},_0x1d1953={};_0x1d1953[_0x309c('0x2d')]=_[_0x309c('0x2f')](db[_0x309c('0x2a')][_0x309c('0x45')]);_0x1d1953[_0x309c('0x2e')]=_['keys'](_0x596cfc[_0x309c('0x2e')]);_0x1d1953[_0x309c('0x30')]=_[_0x309c('0x31')](_0x1d1953[_0x309c('0x2d')],_0x1d1953['query']);_0x159835[_0x309c('0x32')]=_[_0x309c('0x31')](_0x1d1953['model'],qs[_0x309c('0x33')](_0x596cfc['query'][_0x309c('0x33')]));_0x159835[_0x309c('0x32')]=_0x159835[_0x309c('0x32')][_0x309c('0x34')]?_0x159835['attributes']:_0x1d1953[_0x309c('0x2d')];if(_0x596cfc[_0x309c('0x2e')]['includeAll']){_0x159835[_0x309c('0x3f')]=[{'all':!![]}];}_0x159835=_['merge']({},_0x159835,_0x596cfc['options']);return db[_0x309c('0x2a')][_0x309c('0x46')](_0x159835)['then'](handleEntityNotFound(_0x342d56,null))[_0x309c('0x1f')](respondWithResult(_0x342d56,null))[_0x309c('0x42')](handleError(_0x342d56,null));};exports[_0x309c('0x47')]=function(_0xeb93cc,_0x27574e){return db['Interval']['create'](_0xeb93cc[_0x309c('0x48')],{})[_0x309c('0x1f')](function(_0xda4ada){var _0x700664=_0xeb93cc[_0x309c('0x49')][_0x309c('0x20')]({'plain':!![]});if(!_0x700664)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x700664[_0x309c('0x4a')]==='user'){var _0x5c643a=_0xda4ada[_0x309c('0x20')]({'plain':!![]});var _0x2db45b=_0x309c('0x21');return db[_0x309c('0x4b')][_0x309c('0x46')]({'where':{'name':_0x2db45b,'userProfileId':_0x700664[_0x309c('0x4c')]},'raw':!![]})[_0x309c('0x1f')](function(_0x3ef6b5){if(_0x3ef6b5&&_0x3ef6b5[_0x309c('0x4d')]===0x0){return db[_0x309c('0x22')][_0x309c('0x47')]({'name':_0x5c643a['name'],'resourceId':_0x5c643a['id'],'type':_0x3ef6b5[_0x309c('0x27')],'sectionId':_0x3ef6b5['id']},{})['then'](function(){return _0xda4ada;});}else{return _0xda4ada;}})[_0x309c('0x42')](function(_0x52cd30){logger[_0x309c('0x25')](_0x309c('0x4e'),_0x52cd30);throw _0x52cd30;});}return _0xda4ada;})[_0x309c('0x1f')](respondWithResult(_0x27574e,0xc9))[_0x309c('0x42')](handleError(_0x27574e,null));};exports[_0x309c('0x1e')]=function(_0x5645a4,_0x4035b1){if(_0x5645a4['body']['id']){delete _0x5645a4[_0x309c('0x48')]['id'];}return db[_0x309c('0x2a')][_0x309c('0x46')]({'where':{'id':_0x5645a4['params']['id']}})[_0x309c('0x1f')](handleEntityNotFound(_0x4035b1,null))[_0x309c('0x1f')](saveUpdates(_0x5645a4['body'],null))[_0x309c('0x1f')](respondWithResult(_0x4035b1,null))['catch'](handleError(_0x4035b1,null));};exports[_0x309c('0x23')]=function(_0x5bb22e,_0x1dbf0e){return db[_0x309c('0x2a')][_0x309c('0x46')]({'where':{'id':_0x5bb22e[_0x309c('0x44')]['id']}})[_0x309c('0x1f')](handleEntityNotFound(_0x1dbf0e,null))[_0x309c('0x1f')](removeEntity(_0x1dbf0e,null))[_0x309c('0x42')](handleError(_0x1dbf0e,null));};exports[_0x309c('0x4f')]=function(_0x3e87d4,_0x5e3139,_0x324420){if(_0x3e87d4[_0x309c('0x48')]['id']){delete _0x3e87d4[_0x309c('0x48')]['id'];}return db[_0x309c('0x2a')][_0x309c('0x46')]({'where':{'id':_0x3e87d4[_0x309c('0x44')]['id']}})[_0x309c('0x1f')](handleEntityNotFound(_0x5e3139,null))['then'](function(_0x221fbe){if(_0x221fbe){_0x3e87d4['body'][_0x309c('0x50')]=_0x221fbe['id'];return db[_0x309c('0x2a')]['create'](_0x3e87d4[_0x309c('0x48')]);}})[_0x309c('0x1f')](respondWithResult(_0x5e3139,null))['catch'](handleError(_0x5e3139,null));};exports[_0x309c('0x51')]=function(_0x5b9234,_0x451e23,_0x43e299){var _0x5f58d5={};var _0x1186a6={};var _0x5def33;var _0x5a4678;return db['Interval'][_0x309c('0x52')]({'where':{'id':_0x5b9234[_0x309c('0x44')]['id']}})[_0x309c('0x1f')](handleEntityNotFound(_0x451e23,null))['then'](function(_0x1830e6){if(_0x1830e6){_0x5def33=_0x1830e6;_0x1186a6[_0x309c('0x2d')]=_['keys'](db[_0x309c('0x2a')][_0x309c('0x45')]);_0x1186a6[_0x309c('0x2e')]=_[_0x309c('0x2f')](_0x5b9234['query']);_0x1186a6[_0x309c('0x30')]=_[_0x309c('0x31')](_0x1186a6[_0x309c('0x2d')],_0x1186a6[_0x309c('0x2e')]);_0x5f58d5[_0x309c('0x32')]=_['intersection'](_0x1186a6[_0x309c('0x2d')],qs[_0x309c('0x33')](_0x5b9234[_0x309c('0x2e')]['fields']));_0x5f58d5[_0x309c('0x32')]=_0x5f58d5[_0x309c('0x32')][_0x309c('0x34')]?_0x5f58d5['attributes']:_0x1186a6['model'];_0x5f58d5[_0x309c('0x37')]=qs[_0x309c('0x38')](_0x5b9234[_0x309c('0x2e')][_0x309c('0x38')]);_0x5f58d5[_0x309c('0x39')]=qs[_0x309c('0x30')](_[_0x309c('0x3a')](_0x5b9234[_0x309c('0x2e')],_0x1186a6[_0x309c('0x30')]));if(_0x5b9234[_0x309c('0x2e')]['filter']){_0x5f58d5[_0x309c('0x39')]=_[_0x309c('0x53')](_0x5f58d5[_0x309c('0x39')],{'$or':_[_0x309c('0x29')](_0x5f58d5[_0x309c('0x32')],function(_0x48a965){var _0x2132b9={};_0x2132b9[_0x48a965]={'$like':'%'+_0x5b9234[_0x309c('0x2e')]['filter']+'%'};return _0x2132b9;})});}_0x5f58d5=_[_0x309c('0x53')]({},_0x5f58d5,_0x5b9234[_0x309c('0x54')]);return _0x5def33['getIntervals'](_0x5f58d5);}})[_0x309c('0x1f')](function(_0x78e8b8){if(_0x78e8b8){_0x5a4678=_0x78e8b8[_0x309c('0x34')];if(!_0x5b9234[_0x309c('0x2e')][_0x309c('0x35')](_0x309c('0x36'))){_0x5f58d5[_0x309c('0x1c')]=qs['limit'](_0x5b9234[_0x309c('0x2e')][_0x309c('0x1c')]);_0x5f58d5['offset']=qs['offset'](_0x5b9234[_0x309c('0x2e')][_0x309c('0x19')]);}return _0x5def33['getIntervals'](_0x5f58d5);}})[_0x309c('0x1f')](function(_0x172c23){if(_0x172c23){return _0x172c23?{'count':_0x5a4678,'rows':_0x172c23}:null;}})[_0x309c('0x1f')](respondWithResult(_0x451e23,null))['catch'](handleError(_0x451e23,null));};exports[_0x309c('0x55')]=function(_0x1e2095,_0x17ea60,_0x30bf29){return db[_0x309c('0x2a')]['findOne']({'where':{'id':_0x1e2095[_0x309c('0x44')]['id']}})[_0x309c('0x1f')](handleEntityNotFound(_0x17ea60,null))[_0x309c('0x1f')](function(_0x1ed1b5){if(_0x1ed1b5){return db[_0x309c('0x56')][_0x309c('0x57')](function(_0x22bfae){return db[_0x309c('0x2a')]['destroy']({'where':{'IntervalId':_0x1e2095['params']['id']},'transaction':_0x22bfae})['then'](function(_0x2f4840){var _0x41890e=_[_0x309c('0x29')](_0x1e2095['body'],function(_0x43f5e6){delete _0x43f5e6['id'];_0x43f5e6[_0x309c('0x50')]=_0x1e2095[_0x309c('0x44')]['id'];return _0x43f5e6;});return db[_0x309c('0x2a')][_0x309c('0x58')](_0x41890e,{'transaction':_0x22bfae});});})[_0x309c('0x1f')](function(){return db['Interval'][_0x309c('0x40')]({'where':{'IntervalId':_0x1e2095[_0x309c('0x44')]['id']}});});}})[_0x309c('0x1f')](respondWithResult(_0x17ea60,null))[_0x309c('0x42')](handleError(_0x17ea60,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index 5dc3ff6..f7732f2 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 _0xd08b=['./interval.attributes','../../components/extensions/rewrite','exports','define','tools_intervals','rewrite','lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment'];(function(_0x1b45ef,_0x2e512f){var _0x3cd6d3=function(_0x3c28ce){while(--_0x3c28ce){_0x1b45ef['push'](_0x1b45ef['shift']());}};_0x3cd6d3(++_0x2e512f);}(_0xd08b,0x156));var _0xbd08=function(_0x2e53e1,_0x12aed1){_0x2e53e1=_0x2e53e1-0x0;var _0x3a23de=_0xd08b[_0x2e53e1];return _0x3a23de;};'use strict';var _=require(_0xbd08('0x0'));var util=require(_0xbd08('0x1'));var logger=require(_0xbd08('0x2'))(_0xbd08('0x3'));var moment=require('moment');var BPromise=require(_0xbd08('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbd08('0x5'));var rimraf=require(_0xbd08('0x6'));var config=require(_0xbd08('0x7'));var attributes=require(_0xbd08('0x8'));var extensions=require(_0xbd08('0x9'));module[_0xbd08('0xa')]=function(_0x82e3e2,_0x7cdb6f){return _0x82e3e2[_0xbd08('0xb')]('Interval',attributes,{'tableName':_0xbd08('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x1655be,_0x3347f){extensions[_0xbd08('0xd')](_0x82e3e2,_0x1655be);},'afterBulkCreate':function(_0xfbc661,_0x1076ec,_0x48735c){_0x48735c();extensions[_0xbd08('0xd')](_0x82e3e2,_0xfbc661[0x0]);},'afterUpdate':function(_0x7134f,_0x11d964){extensions[_0xbd08('0xd')](_0x82e3e2,_0x7134f);},'afterDestroy':function(_0x3e07b1,_0x2c5de4){extensions[_0xbd08('0xd')](_0x82e3e2,_0x3e07b1);}}});}; \ No newline at end of file +var _0xe640=['path','rimraf','../../config/environment','./interval.attributes','exports','define','Interval','rewrite','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0xc9206b,_0x50b67f){var _0xcd452a=function(_0x39a1b8){while(--_0x39a1b8){_0xc9206b['push'](_0xc9206b['shift']());}};_0xcd452a(++_0x50b67f);}(_0xe640,0x174));var _0x0e64=function(_0x37b6f6,_0x5558b1){_0x37b6f6=_0x37b6f6-0x0;var _0x47a8ed=_0xe640[_0x37b6f6];return _0x47a8ed;};'use strict';var _=require(_0x0e64('0x0'));var util=require(_0x0e64('0x1'));var logger=require(_0x0e64('0x2'))(_0x0e64('0x3'));var moment=require('moment');var BPromise=require(_0x0e64('0x4'));var rp=require(_0x0e64('0x5'));var fs=require('fs');var path=require(_0x0e64('0x6'));var rimraf=require(_0x0e64('0x7'));var config=require(_0x0e64('0x8'));var attributes=require(_0x0e64('0x9'));var extensions=require('../../components/extensions/rewrite');module[_0x0e64('0xa')]=function(_0x34baaf,_0x1f0467){return _0x34baaf[_0x0e64('0xb')](_0x0e64('0xc'),attributes,{'tableName':'tools_intervals','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x598d2e,_0x2ae309){extensions[_0x0e64('0xd')](_0x34baaf,_0x598d2e);},'afterBulkCreate':function(_0x3bfc14,_0x48f8ec,_0x3fc55e){_0x3fc55e();extensions[_0x0e64('0xd')](_0x34baaf,_0x3bfc14[0x0]);},'afterUpdate':function(_0x362d2e,_0x52f6b2){extensions[_0x0e64('0xd')](_0x34baaf,_0x362d2e);},'afterDestroy':function(_0x5a5789,_0x4d8720){extensions[_0x0e64('0xd')](_0x34baaf,_0x5a5789);}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index 63c2df4..ef3839c 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(_0x466bc5,_0x3a0f2a){var _0x138952=function(_0x392fa2){while(--_0x392fa2){_0x466bc5['push'](_0x466bc5['shift']());}};_0x138952(++_0x3a0f2a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0xa9e0[_0x2763f2];return _0x3ef471;};'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(_0x274dd7,_0x2e6051){var _0x148829=function(_0x4cec98){while(--_0x4cec98){_0x274dd7['push'](_0x274dd7['shift']());}};_0x148829(++_0x2e6051);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbe200f,_0x4b50eb){_0xbe200f=_0xbe200f-0x0;var _0x192597=_0xa9e0[_0xbe200f];return _0x192597;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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 2a4529e..fcb2039 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 _0xadb5=['post','isAuthenticated','exports','Router','./jira.controller'];(function(_0x78b704,_0x10c412){var _0x590f16=function(_0x4cbd8b){while(--_0x4cbd8b){_0x78b704['push'](_0x78b704['shift']());}};_0x590f16(++_0x10c412);}(_0xadb5,0xad));var _0x5adb=function(_0x10e3f6,_0x567d65){_0x10e3f6=_0x10e3f6-0x0;var _0x14b52d=_0xadb5[_0x10e3f6];return _0x14b52d;};'use strict';var express=require('express');var router=express[_0x5adb('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0x5adb('0x1'));router[_0x5adb('0x2')]('/',auth[_0x5adb('0x3')](),controller['send']);module[_0x5adb('0x4')]=router; \ No newline at end of file +var _0x0b0e=['exports','express','../../components/auth/service','post','isAuthenticated','send'];(function(_0x4ae6ef,_0xc2af80){var _0x3cbb4e=function(_0x569ad5){while(--_0x569ad5){_0x4ae6ef['push'](_0x4ae6ef['shift']());}};_0x3cbb4e(++_0xc2af80);}(_0x0b0e,0x187));var _0xe0b0=function(_0x57532c,_0x2c75cf){_0x57532c=_0x57532c-0x0;var _0x5cb9a6=_0x0b0e[_0x57532c];return _0x5cb9a6;};'use strict';var express=require(_0xe0b0('0x0'));var router=express['Router']();var auth=require(_0xe0b0('0x1'));var controller=require('./jira.controller');router[_0xe0b0('0x2')]('/',auth[_0xe0b0('0x3')](),controller[_0xe0b0('0x4')]);module[_0xe0b0('0x5')]=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index fd49cac..4a2e54d 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 _0x99f9=['\x20from\x20','description','stringify','customfield_11500','email','fields','oldToken','customfield_11502','newToken','customfield_11503','name','customfield_11504','reason','track.xcallymotion.com','/rest/api/2/issue','POST','application/json','Basic\x20','base64','setEncoding','utf8','data','end','status','statusCode','json','parse','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','write','openIssue','send','body','remoteAddress','socket','bluebird','https','3eAmWpBVP0','key','MOTGUI','summary'];(function(_0xa8d9d6,_0x2b004d){var _0x38ded6=function(_0x40bd56){while(--_0x40bd56){_0xa8d9d6['push'](_0xa8d9d6['shift']());}};_0x38ded6(++_0x2b004d);}(_0x99f9,0xc7));var _0x999f=function(_0x45b087,_0x58b357){_0x45b087=_0x45b087-0x0;var _0x22822a=_0x99f9[_0x45b087];return _0x22822a;};'use strict';var BPromise=require(_0x999f('0x0'));var https=require(_0x999f('0x1'));var logger=require('../../config/logger')('api');var USERNAME='support';var PASSWORD=_0x999f('0x2');function openIssue(_0x128aa8,_0x271d40){var _0xb222ad={'fields':{'project':{'key':_0x128aa8[_0x999f('0x3')]||_0x999f('0x4')},'summary':(_0x128aa8[_0x999f('0x5')]||'Report')+_0x999f('0x6')+_0x128aa8['ip'],'description':_0x128aa8[_0x999f('0x7')]||JSON[_0x999f('0x8')](_0x128aa8),'issuetype':{'name':_0x128aa8['issuetype']||'Bug'}}};_0xb222ad['fields'][_0x999f('0x9')]=_0x128aa8[_0x999f('0xa')];_0xb222ad[_0x999f('0xb')]['customfield_11501']=_0x128aa8[_0x999f('0xc')];_0xb222ad[_0x999f('0xb')][_0x999f('0xd')]=_0x128aa8[_0x999f('0xe')];_0xb222ad[_0x999f('0xb')][_0x999f('0xf')]=_0x128aa8[_0x999f('0x10')];_0xb222ad[_0x999f('0xb')][_0x999f('0x11')]=_0x128aa8[_0x999f('0x12')];_0xb222ad[_0x999f('0xb')]['customfield_10102']=_0x128aa8['ip'];var _0x496229={'host':_0x999f('0x13'),'port':0x1bb,'path':_0x999f('0x14'),'method':_0x999f('0x15'),'timeout':0x4e20,'headers':{'Content-Type':_0x999f('0x16'),'Authorization':_0x999f('0x17')+new Buffer(USERNAME+':'+PASSWORD)['toString'](_0x999f('0x18'))}};var _0x55e5d0=JSON[_0x999f('0x8')](_0xb222ad);var _0x2b6e9c=https['request'](_0x496229,function(_0x460f25){_0x460f25[_0x999f('0x19')](_0x999f('0x1a'));var _0x2b86e3='';_0x460f25['on'](_0x999f('0x1b'),function(_0x46dc20){_0x2b86e3+=_0x46dc20;});_0x460f25['on'](_0x999f('0x1c'),function(){if(_0x271d40){return _0x271d40[_0x999f('0x1d')](_0x460f25[_0x999f('0x1e')])[_0x999f('0x1f')](JSON[_0x999f('0x20')](_0x2b86e3));}});});_0x2b6e9c['on'](_0x999f('0x21'),function(_0x50488e){if(_0x271d40){return _0x271d40[_0x999f('0x1d')](0x1f4)[_0x999f('0x1f')]({'errors':[{'message':_0x999f('0x22'),'type':'api.jira'}]});}});_0x2b6e9c[_0x999f('0x23')](_0x55e5d0);_0x2b6e9c[_0x999f('0x1c')]();}exports[_0x999f('0x24')]=openIssue;exports[_0x999f('0x25')]=function(_0x3b193a,_0xa4bd4c){_0x3b193a[_0x999f('0x26')]['ip']=_0x3b193a['headers']['x-forwarded-for']||_0x3b193a['connection'][_0x999f('0x27')]||_0x3b193a[_0x999f('0x28')][_0x999f('0x27')]||_0x3b193a['connection'][_0x999f('0x28')]['remoteAddress'];return openIssue(_0x3b193a['body'],_0xa4bd4c);}; \ No newline at end of file +var _0x6ee5=['headers','x-forwarded-for','connection','remoteAddress','socket','body','bluebird','https','support','3eAmWpBVP0','key','MOTGUI','summary','stringify','issuetype','Bug','fields','customfield_11500','email','oldToken','customfield_11502','newToken','customfield_11503','name','reason','/rest/api/2/issue','POST','application/json','Basic\x20','toString','base64','request','setEncoding','utf8','data','status','statusCode','json','parse','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','write','end','openIssue','send'];(function(_0x20adae,_0x550074){var _0x556fb4=function(_0x1c482b){while(--_0x1c482b){_0x20adae['push'](_0x20adae['shift']());}};_0x556fb4(++_0x550074);}(_0x6ee5,0x19b));var _0x56ee=function(_0x45e3c7,_0xdaafdb){_0x45e3c7=_0x45e3c7-0x0;var _0x21a2ce=_0x6ee5[_0x45e3c7];return _0x21a2ce;};'use strict';var BPromise=require(_0x56ee('0x0'));var https=require(_0x56ee('0x1'));var logger=require('../../config/logger')('api');var USERNAME=_0x56ee('0x2');var PASSWORD=_0x56ee('0x3');function openIssue(_0x1e9e4a,_0x4c2ed6){var _0x5b3201={'fields':{'project':{'key':_0x1e9e4a[_0x56ee('0x4')]||_0x56ee('0x5')},'summary':(_0x1e9e4a[_0x56ee('0x6')]||'Report')+'\x20from\x20'+_0x1e9e4a['ip'],'description':_0x1e9e4a['description']||JSON[_0x56ee('0x7')](_0x1e9e4a),'issuetype':{'name':_0x1e9e4a[_0x56ee('0x8')]||_0x56ee('0x9')}}};_0x5b3201[_0x56ee('0xa')][_0x56ee('0xb')]=_0x1e9e4a[_0x56ee('0xc')];_0x5b3201[_0x56ee('0xa')]['customfield_11501']=_0x1e9e4a[_0x56ee('0xd')];_0x5b3201[_0x56ee('0xa')][_0x56ee('0xe')]=_0x1e9e4a[_0x56ee('0xf')];_0x5b3201[_0x56ee('0xa')][_0x56ee('0x10')]=_0x1e9e4a[_0x56ee('0x11')];_0x5b3201[_0x56ee('0xa')]['customfield_11504']=_0x1e9e4a[_0x56ee('0x12')];_0x5b3201[_0x56ee('0xa')]['customfield_10102']=_0x1e9e4a['ip'];var _0x45a7e1={'host':'track.xcallymotion.com','port':0x1bb,'path':_0x56ee('0x13'),'method':_0x56ee('0x14'),'timeout':0x4e20,'headers':{'Content-Type':_0x56ee('0x15'),'Authorization':_0x56ee('0x16')+new Buffer(USERNAME+':'+PASSWORD)[_0x56ee('0x17')](_0x56ee('0x18'))}};var _0x4fb662=JSON[_0x56ee('0x7')](_0x5b3201);var _0x16896f=https[_0x56ee('0x19')](_0x45a7e1,function(_0x26bb41){_0x26bb41[_0x56ee('0x1a')](_0x56ee('0x1b'));var _0x2244da='';_0x26bb41['on'](_0x56ee('0x1c'),function(_0x24226b){_0x2244da+=_0x24226b;});_0x26bb41['on']('end',function(){if(_0x4c2ed6){return _0x4c2ed6[_0x56ee('0x1d')](_0x26bb41[_0x56ee('0x1e')])[_0x56ee('0x1f')](JSON[_0x56ee('0x20')](_0x2244da));}});});_0x16896f['on'](_0x56ee('0x21'),function(_0x384906){if(_0x4c2ed6){return _0x4c2ed6[_0x56ee('0x1d')](0x1f4)[_0x56ee('0x1f')]({'errors':[{'message':_0x56ee('0x22'),'type':'api.jira'}]});}});_0x16896f[_0x56ee('0x23')](_0x4fb662);_0x16896f[_0x56ee('0x24')]();}exports[_0x56ee('0x25')]=openIssue;exports[_0x56ee('0x26')]=function(_0x2f23e6,_0x2d584f){_0x2f23e6['body']['ip']=_0x2f23e6[_0x56ee('0x27')][_0x56ee('0x28')]||_0x2f23e6[_0x56ee('0x29')]['remoteAddress']||_0x2f23e6['socket'][_0x56ee('0x2a')]||_0x2f23e6['connection'][_0x56ee('0x2b')][_0x56ee('0x2a')];return openIssue(_0x2f23e6[_0x56ee('0x2c')],_0x2d584f);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index d7679db..46c587c 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 _0xbec5=['describe','/:id','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./jscriptyAnswerReport.controller','get','index','/describe','isAuthenticated'];(function(_0x51fd8f,_0x329f36){var _0x4a19cb=function(_0x31e79b){while(--_0x31e79b){_0x51fd8f['push'](_0x51fd8f['shift']());}};_0x4a19cb(++_0x329f36);}(_0xbec5,0xe5));var _0x5bec=function(_0x34df4a,_0x209d10){_0x34df4a=_0x34df4a-0x0;var _0x145c69=_0xbec5[_0x34df4a];return _0x145c69;};'use strict';var multer=require(_0x5bec('0x0'));var util=require(_0x5bec('0x1'));var path=require('path');var timeout=require(_0x5bec('0x2'));var express=require(_0x5bec('0x3'));var router=express[_0x5bec('0x4')]();var fs_extra=require(_0x5bec('0x5'));var auth=require(_0x5bec('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x5bec('0x7'));var controller=require(_0x5bec('0x8'));router[_0x5bec('0x9')]('/',auth['isAuthenticated'](),controller[_0x5bec('0xa')]);router[_0x5bec('0x9')](_0x5bec('0xb'),auth[_0x5bec('0xc')](),controller[_0x5bec('0xd')]);router[_0x5bec('0x9')](_0x5bec('0xe'),auth[_0x5bec('0xc')](),controller['show']);router[_0x5bec('0xf')]('/',auth['isAuthenticated'](),controller[_0x5bec('0x10')]);router[_0x5bec('0x11')](_0x5bec('0xe'),auth['isAuthenticated'](),controller[_0x5bec('0x12')]);router[_0x5bec('0x13')](_0x5bec('0xe'),auth['isAuthenticated'](),controller[_0x5bec('0x14')]);module[_0x5bec('0x15')]=router; \ No newline at end of file +var _0xe14d=['isAuthenticated','index','describe','/:id','show','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','get'];(function(_0xc14694,_0x2200a4){var _0x4bd75f=function(_0x5e3445){while(--_0x5e3445){_0xc14694['push'](_0xc14694['shift']());}};_0x4bd75f(++_0x2200a4);}(_0xe14d,0x1ee));var _0xde14=function(_0x494d1f,_0x3f72ff){_0x494d1f=_0x494d1f-0x0;var _0x457b6e=_0xe14d[_0x494d1f];return _0x457b6e;};'use strict';var multer=require(_0xde14('0x0'));var util=require(_0xde14('0x1'));var path=require(_0xde14('0x2'));var timeout=require(_0xde14('0x3'));var express=require('express');var router=express[_0xde14('0x4')]();var fs_extra=require(_0xde14('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xde14('0x6'));var config=require(_0xde14('0x7'));var controller=require(_0xde14('0x8'));router[_0xde14('0x9')]('/',auth[_0xde14('0xa')](),controller[_0xde14('0xb')]);router['get']('/describe',auth[_0xde14('0xa')](),controller[_0xde14('0xc')]);router[_0xde14('0x9')](_0xde14('0xd'),auth[_0xde14('0xa')](),controller[_0xde14('0xe')]);router[_0xde14('0xf')]('/',auth[_0xde14('0xa')](),controller['create']);router[_0xde14('0x10')](_0xde14('0xd'),auth[_0xde14('0xa')](),controller[_0xde14('0x11')]);router[_0xde14('0x12')](_0xde14('0xd'),auth[_0xde14('0xa')](),controller[_0xde14('0x13')]);module[_0xde14('0x14')]=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index 7d446d6..b3d1305 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(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0x7a54,0x106));var _0x47a5=function(_0x1bb474,_0x5eae97){_0x1bb474=_0x1bb474-0x0;var _0x2f2a80=_0x7a54[_0x1bb474];return _0x2f2a80;};'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(_0xaa1b3e,_0x47d976){var _0x454d7d=function(_0x575b32){while(--_0x575b32){_0xaa1b3e['push'](_0xaa1b3e['shift']());}};_0x454d7d(++_0x47d976);}(_0x7a54,0x106));var _0x47a5=function(_0x3341e4,_0x2ac5ba){_0x3341e4=_0x3341e4-0x0;var _0x1c602f=_0x7a54[_0x3341e4];return _0x1c602f;};'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 6d58498..fa371d0 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 _0xf52f=['offset','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','map','rawAttributes','fieldName','type','key','query','keys','filters','model','intersection','fields','attributes','length','nolimit','order','pick','filter','where','merge','VIRTUAL','options','JscriptyAnswerReport','includeAll','include','findAll','catch','show','find','create','body','params','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status'];(function(_0x5447fd,_0x52a6b5){var _0x15b28a=function(_0x370d4f){while(--_0x370d4f){_0x5447fd['push'](_0x5447fd['shift']());}};_0x15b28a(++_0x52a6b5);}(_0xf52f,0x113));var _0xff52=function(_0x18c08a,_0x46e340){_0x18c08a=_0x18c08a-0x0;var _0x388429=_0xf52f[_0x18c08a];return _0x388429;};'use strict';var emlformat=require(_0xff52('0x0'));var rimraf=require(_0xff52('0x1'));var zipdir=require(_0xff52('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xff52('0x3'));var moment=require(_0xff52('0x4'));var BPromise=require(_0xff52('0x5'));var Mustache=require('mustache');var util=require(_0xff52('0x6'));var path=require(_0xff52('0x7'));var sox=require('sox');var csv=require(_0xff52('0x8'));var ejs=require(_0xff52('0x9'));var fs=require('fs');var fs_extra=require(_0xff52('0xa'));var _=require(_0xff52('0xb'));var squel=require(_0xff52('0xc'));var crypto=require(_0xff52('0xd'));var jsforce=require(_0xff52('0xe'));var deskjs=require(_0xff52('0xf'));var toCsv=require(_0xff52('0x8'));var querystring=require(_0xff52('0x10'));var Papa=require(_0xff52('0x11'));var Redis=require(_0xff52('0x12'));var authService=require(_0xff52('0x13'));var qs=require(_0xff52('0x14'));var as=require(_0xff52('0x15'));var hardwareService=require(_0xff52('0x16'));var logger=require(_0xff52('0x17'))(_0xff52('0x18'));var utils=require(_0xff52('0x19'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xff52('0x1a'))['db'];function respondWithStatusCode(_0x53f40b,_0x2cd3ca){_0x2cd3ca=_0x2cd3ca||0xcc;return function(_0x1c0f10){if(_0x1c0f10){return _0x53f40b[_0xff52('0x1b')](_0x2cd3ca);}return _0x53f40b[_0xff52('0x1c')](_0x2cd3ca)['end']();};}function respondWithResult(_0x54eccf,_0x5bc4dd){_0x5bc4dd=_0x5bc4dd||0xc8;return function(_0x32f7e5){if(_0x32f7e5){return _0x54eccf['status'](_0x5bc4dd)['json'](_0x32f7e5);}};}function respondWithFilteredResult(_0x219294,_0x1e1818){return function(_0x3fc985){if(_0x3fc985){var _0x440701=typeof _0x1e1818[_0xff52('0x1d')]==='undefined'&&typeof _0x1e1818[_0xff52('0x1e')]==='undefined';var _0xc8d493=_0x3fc985['count'];var _0x568cad=_0x440701?0x0:_0x1e1818[_0xff52('0x1d')];var _0x28601f=_0x440701?_0x3fc985[_0xff52('0x1f')]:_0x1e1818['offset']+_0x1e1818['limit'];var _0x163326;if(_0x28601f>=_0xc8d493){_0x28601f=_0xc8d493;_0x163326=0xc8;}else{_0x163326=0xce;}_0x219294[_0xff52('0x1c')](_0x163326);return _0x219294[_0xff52('0x20')](_0xff52('0x21'),_0x568cad+'-'+_0x28601f+'/'+_0xc8d493)['json'](_0x3fc985);}return null;};}function patchUpdates(_0x147db2){return function(_0x45fe57){try{jsonpatch[_0xff52('0x22')](_0x45fe57,_0x147db2,!![]);}catch(_0x434a9f){return BPromise[_0xff52('0x23')](_0x434a9f);}return _0x45fe57[_0xff52('0x24')]();};}function saveUpdates(_0x78d437,_0x176c10){return function(_0x5eb3f9){if(_0x5eb3f9){return _0x5eb3f9[_0xff52('0x25')](_0x78d437)[_0xff52('0x26')](function(_0x517eb4){return _0x517eb4;});}return null;};}function removeEntity(_0x313ee0,_0x3cf849){return function(_0x4b8157){if(_0x4b8157){return _0x4b8157[_0xff52('0x27')]()['then'](function(){_0x313ee0['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x363857,_0x234516){return function(_0x16b121){if(!_0x16b121){_0x363857[_0xff52('0x1b')](0x194);}return _0x16b121;};}function handleError(_0x18a08e,_0x1fe1cc){_0x1fe1cc=_0x1fe1cc||0x1f4;return function(_0x25225b){logger[_0xff52('0x28')](_0x25225b[_0xff52('0x29')]);if(_0x25225b[_0xff52('0x2a')]){delete _0x25225b['name'];}_0x18a08e[_0xff52('0x1c')](_0x1fe1cc)[_0xff52('0x2b')](_0x25225b);};}exports['index']=function(_0x2822c0,_0x32df90){var _0x208753={},_0x1cb50f={},_0x30fd72={'count':0x0,'rows':[]};var _0x51d708=_[_0xff52('0x2c')](db['JscriptyAnswerReport'][_0xff52('0x2d')],function(_0x35aaf7){return{'name':_0x35aaf7[_0xff52('0x2e')],'type':_0x35aaf7[_0xff52('0x2f')][_0xff52('0x30')]};});_0x1cb50f['model']=_['map'](_0x51d708,_0xff52('0x2a'));_0x1cb50f[_0xff52('0x31')]=_[_0xff52('0x32')](_0x2822c0['query']);_0x1cb50f[_0xff52('0x33')]=_['intersection'](_0x1cb50f[_0xff52('0x34')],_0x1cb50f[_0xff52('0x31')]);_0x208753['attributes']=_[_0xff52('0x35')](_0x1cb50f[_0xff52('0x34')],qs[_0xff52('0x36')](_0x2822c0[_0xff52('0x31')][_0xff52('0x36')]));_0x208753[_0xff52('0x37')]=_0x208753[_0xff52('0x37')][_0xff52('0x38')]?_0x208753[_0xff52('0x37')]:_0x1cb50f[_0xff52('0x34')];if(!_0x2822c0[_0xff52('0x31')]['hasOwnProperty'](_0xff52('0x39'))){_0x208753[_0xff52('0x1e')]=qs['limit'](_0x2822c0[_0xff52('0x31')][_0xff52('0x1e')]);_0x208753[_0xff52('0x1d')]=qs[_0xff52('0x1d')](_0x2822c0[_0xff52('0x31')][_0xff52('0x1d')]);}_0x208753[_0xff52('0x3a')]=qs['sort'](_0x2822c0[_0xff52('0x31')]['sort']);_0x208753['where']=qs[_0xff52('0x33')](_[_0xff52('0x3b')](_0x2822c0['query'],_0x1cb50f[_0xff52('0x33')]),_0x51d708);if(_0x2822c0[_0xff52('0x31')][_0xff52('0x3c')]){_0x208753[_0xff52('0x3d')]=_[_0xff52('0x3e')](_0x208753[_0xff52('0x3d')],{'$or':_[_0xff52('0x2c')](_0x51d708,function(_0xcb2a24){if(_0xcb2a24[_0xff52('0x2f')]!==_0xff52('0x3f')){var _0x5c48fa={};_0x5c48fa[_0xcb2a24[_0xff52('0x2a')]]={'$like':'%'+_0x2822c0[_0xff52('0x31')][_0xff52('0x3c')]+'%'};return _0x5c48fa;}})});}_0x208753=_[_0xff52('0x3e')]({},_0x208753,_0x2822c0[_0xff52('0x40')]);var _0x388613={'where':_0x208753[_0xff52('0x3d')]};return db[_0xff52('0x41')]['count'](_0x388613)[_0xff52('0x26')](function(_0x5937da){_0x30fd72[_0xff52('0x1f')]=_0x5937da;if(_0x2822c0['query'][_0xff52('0x42')]){_0x208753[_0xff52('0x43')]=[{'all':!![]}];}return db[_0xff52('0x41')][_0xff52('0x44')](_0x208753);})[_0xff52('0x26')](function(_0x1d3fc8){_0x30fd72['rows']=_0x1d3fc8;return _0x30fd72;})[_0xff52('0x26')](respondWithFilteredResult(_0x32df90,_0x208753))[_0xff52('0x45')](handleError(_0x32df90,null));};exports[_0xff52('0x46')]=function(_0x194e32,_0x16c2e4){var _0x56f535={'raw':!![],'where':{'id':_0x194e32['params']['id']}},_0x236d4f={};_0x236d4f[_0xff52('0x34')]=_[_0xff52('0x32')](db[_0xff52('0x41')][_0xff52('0x2d')]);_0x236d4f['query']=_[_0xff52('0x32')](_0x194e32[_0xff52('0x31')]);_0x236d4f[_0xff52('0x33')]=_[_0xff52('0x35')](_0x236d4f[_0xff52('0x34')],_0x236d4f[_0xff52('0x31')]);_0x56f535[_0xff52('0x37')]=_[_0xff52('0x35')](_0x236d4f[_0xff52('0x34')],qs[_0xff52('0x36')](_0x194e32[_0xff52('0x31')]['fields']));_0x56f535[_0xff52('0x37')]=_0x56f535[_0xff52('0x37')][_0xff52('0x38')]?_0x56f535['attributes']:_0x236d4f[_0xff52('0x34')];if(_0x194e32[_0xff52('0x31')][_0xff52('0x42')]){_0x56f535[_0xff52('0x43')]=[{'all':!![]}];}_0x56f535=_[_0xff52('0x3e')]({},_0x56f535,_0x194e32['options']);return db['JscriptyAnswerReport'][_0xff52('0x47')](_0x56f535)[_0xff52('0x26')](handleEntityNotFound(_0x16c2e4,null))[_0xff52('0x26')](respondWithResult(_0x16c2e4,null))['catch'](handleError(_0x16c2e4,null));};exports[_0xff52('0x48')]=function(_0x3dfb1a,_0x397a60){return db[_0xff52('0x41')][_0xff52('0x48')](_0x3dfb1a[_0xff52('0x49')],{})['then'](respondWithResult(_0x397a60,0xc9))[_0xff52('0x45')](handleError(_0x397a60,null));};exports[_0xff52('0x25')]=function(_0x314ed0,_0x2874f1){if(_0x314ed0['body']['id']){delete _0x314ed0[_0xff52('0x49')]['id'];}return db[_0xff52('0x41')][_0xff52('0x47')]({'where':{'id':_0x314ed0[_0xff52('0x4a')]['id']}})[_0xff52('0x26')](handleEntityNotFound(_0x2874f1,null))[_0xff52('0x26')](saveUpdates(_0x314ed0[_0xff52('0x49')],null))[_0xff52('0x26')](respondWithResult(_0x2874f1,null))[_0xff52('0x45')](handleError(_0x2874f1,null));};exports[_0xff52('0x27')]=function(_0x208b92,_0x12b43d){return db['JscriptyAnswerReport'][_0xff52('0x47')]({'where':{'id':_0x208b92[_0xff52('0x4a')]['id']}})['then'](handleEntityNotFound(_0x12b43d,null))[_0xff52('0x26')](removeEntity(_0x12b43d,null))[_0xff52('0x45')](handleError(_0x12b43d,null));};exports[_0xff52('0x4b')]=function(_0x11001a,_0x45c3fb){return db[_0xff52('0x41')][_0xff52('0x4b')]()['then'](respondWithResult(_0x45c3fb,null))[_0xff52('0x45')](handleError(_0x45c3fb,null));}; \ No newline at end of file +var _0x304b=['JscriptyAnswerReport','includeAll','findAll','rows','catch','show','params','include','options','find','create','body','destroy','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','sendStatus','error','stack','send','index','map','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','where','pick','merge','VIRTUAL','name','filter'];(function(_0x56c85f,_0x161ef7){var _0x213e0a=function(_0x14e80f){while(--_0x14e80f){_0x56c85f['push'](_0x56c85f['shift']());}};_0x213e0a(++_0x161ef7);}(_0x304b,0xfb));var _0xb304=function(_0x3a2747,_0x4039f2){_0x3a2747=_0x3a2747-0x0;var _0x1d561c=_0x304b[_0x3a2747];return _0x1d561c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb304('0x0'));var zipdir=require(_0xb304('0x1'));var jsonpatch=require(_0xb304('0x2'));var rp=require(_0xb304('0x3'));var moment=require(_0xb304('0x4'));var BPromise=require(_0xb304('0x5'));var Mustache=require(_0xb304('0x6'));var util=require(_0xb304('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xb304('0x8'));var ejs=require(_0xb304('0x9'));var fs=require('fs');var fs_extra=require(_0xb304('0xa'));var _=require(_0xb304('0xb'));var squel=require(_0xb304('0xc'));var crypto=require(_0xb304('0xd'));var jsforce=require(_0xb304('0xe'));var deskjs=require(_0xb304('0xf'));var toCsv=require(_0xb304('0x8'));var querystring=require('querystring');var Papa=require(_0xb304('0x10'));var Redis=require(_0xb304('0x11'));var authService=require(_0xb304('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xb304('0x13'));var hardwareService=require(_0xb304('0x14'));var logger=require(_0xb304('0x15'))(_0xb304('0x16'));var utils=require(_0xb304('0x17'));var config=require(_0xb304('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xb304('0x19'))['db'];function respondWithStatusCode(_0x1f4ddb,_0x2f8cae){_0x2f8cae=_0x2f8cae||0xcc;return function(_0x743f7d){if(_0x743f7d){return _0x1f4ddb['sendStatus'](_0x2f8cae);}return _0x1f4ddb[_0xb304('0x1a')](_0x2f8cae)[_0xb304('0x1b')]();};}function respondWithResult(_0x733030,_0x44b7a7){_0x44b7a7=_0x44b7a7||0xc8;return function(_0x1ba608){if(_0x1ba608){return _0x733030[_0xb304('0x1a')](_0x44b7a7)[_0xb304('0x1c')](_0x1ba608);}};}function respondWithFilteredResult(_0x1a15c9,_0x218d92){return function(_0x22ac4b){if(_0x22ac4b){var _0x3d20b5=typeof _0x218d92[_0xb304('0x1d')]===_0xb304('0x1e')&&typeof _0x218d92['limit']===_0xb304('0x1e');var _0x5166c5=_0x22ac4b['count'];var _0x79ca93=_0x3d20b5?0x0:_0x218d92[_0xb304('0x1d')];var _0x45f368=_0x3d20b5?_0x22ac4b[_0xb304('0x1f')]:_0x218d92[_0xb304('0x1d')]+_0x218d92['limit'];var _0x272b37;if(_0x45f368>=_0x5166c5){_0x45f368=_0x5166c5;_0x272b37=0xc8;}else{_0x272b37=0xce;}_0x1a15c9['status'](_0x272b37);return _0x1a15c9[_0xb304('0x20')](_0xb304('0x21'),_0x79ca93+'-'+_0x45f368+'/'+_0x5166c5)['json'](_0x22ac4b);}return null;};}function patchUpdates(_0x49d49e){return function(_0x586394){try{jsonpatch[_0xb304('0x22')](_0x586394,_0x49d49e,!![]);}catch(_0x1dab9e){return BPromise[_0xb304('0x23')](_0x1dab9e);}return _0x586394[_0xb304('0x24')]();};}function saveUpdates(_0x5cf81a,_0x218b9d){return function(_0x3694c4){if(_0x3694c4){return _0x3694c4[_0xb304('0x25')](_0x5cf81a)[_0xb304('0x26')](function(_0x4f10ab){return _0x4f10ab;});}return null;};}function removeEntity(_0x5802d5,_0x4ab7ed){return function(_0x2fd41b){if(_0x2fd41b){return _0x2fd41b['destroy']()[_0xb304('0x26')](function(){_0x5802d5['status'](0xcc)[_0xb304('0x1b')]();});}};}function handleEntityNotFound(_0x148f48,_0x2b5271){return function(_0x4de541){if(!_0x4de541){_0x148f48[_0xb304('0x27')](0x194);}return _0x4de541;};}function handleError(_0x4fcf90,_0x36444d){_0x36444d=_0x36444d||0x1f4;return function(_0x4f46d2){logger[_0xb304('0x28')](_0x4f46d2[_0xb304('0x29')]);if(_0x4f46d2['name']){delete _0x4f46d2['name'];}_0x4fcf90[_0xb304('0x1a')](_0x36444d)[_0xb304('0x2a')](_0x4f46d2);};}exports[_0xb304('0x2b')]=function(_0xdfe560,_0x1d468d){var _0x19ecc6={},_0x36af11={},_0x10fa7d={'count':0x0,'rows':[]};var _0x57bc7d=_[_0xb304('0x2c')](db['JscriptyAnswerReport'][_0xb304('0x2d')],function(_0xeba658){return{'name':_0xeba658['fieldName'],'type':_0xeba658['type'][_0xb304('0x2e')]};});_0x36af11[_0xb304('0x2f')]=_[_0xb304('0x2c')](_0x57bc7d,'name');_0x36af11[_0xb304('0x30')]=_[_0xb304('0x31')](_0xdfe560['query']);_0x36af11[_0xb304('0x32')]=_[_0xb304('0x33')](_0x36af11[_0xb304('0x2f')],_0x36af11[_0xb304('0x30')]);_0x19ecc6[_0xb304('0x34')]=_['intersection'](_0x36af11[_0xb304('0x2f')],qs[_0xb304('0x35')](_0xdfe560[_0xb304('0x30')][_0xb304('0x35')]));_0x19ecc6[_0xb304('0x34')]=_0x19ecc6[_0xb304('0x34')][_0xb304('0x36')]?_0x19ecc6[_0xb304('0x34')]:_0x36af11[_0xb304('0x2f')];if(!_0xdfe560[_0xb304('0x30')][_0xb304('0x37')](_0xb304('0x38'))){_0x19ecc6[_0xb304('0x39')]=qs[_0xb304('0x39')](_0xdfe560[_0xb304('0x30')][_0xb304('0x39')]);_0x19ecc6[_0xb304('0x1d')]=qs[_0xb304('0x1d')](_0xdfe560['query'][_0xb304('0x1d')]);}_0x19ecc6[_0xb304('0x3a')]=qs['sort'](_0xdfe560[_0xb304('0x30')]['sort']);_0x19ecc6[_0xb304('0x3b')]=qs[_0xb304('0x32')](_[_0xb304('0x3c')](_0xdfe560[_0xb304('0x30')],_0x36af11['filters']),_0x57bc7d);if(_0xdfe560[_0xb304('0x30')]['filter']){_0x19ecc6['where']=_[_0xb304('0x3d')](_0x19ecc6[_0xb304('0x3b')],{'$or':_[_0xb304('0x2c')](_0x57bc7d,function(_0x510748){if(_0x510748['type']!==_0xb304('0x3e')){var _0x470ac3={};_0x470ac3[_0x510748[_0xb304('0x3f')]]={'$like':'%'+_0xdfe560[_0xb304('0x30')][_0xb304('0x40')]+'%'};return _0x470ac3;}})});}_0x19ecc6=_[_0xb304('0x3d')]({},_0x19ecc6,_0xdfe560['options']);var _0x34eae5={'where':_0x19ecc6[_0xb304('0x3b')]};return db[_0xb304('0x41')]['count'](_0x34eae5)['then'](function(_0x49657c){_0x10fa7d['count']=_0x49657c;if(_0xdfe560[_0xb304('0x30')][_0xb304('0x42')]){_0x19ecc6['include']=[{'all':!![]}];}return db[_0xb304('0x41')][_0xb304('0x43')](_0x19ecc6);})[_0xb304('0x26')](function(_0xaf4872){_0x10fa7d[_0xb304('0x44')]=_0xaf4872;return _0x10fa7d;})[_0xb304('0x26')](respondWithFilteredResult(_0x1d468d,_0x19ecc6))[_0xb304('0x45')](handleError(_0x1d468d,null));};exports[_0xb304('0x46')]=function(_0x1a2823,_0x8008a8){var _0x364141={'raw':!![],'where':{'id':_0x1a2823[_0xb304('0x47')]['id']}},_0xd23f35={};_0xd23f35['model']=_[_0xb304('0x31')](db[_0xb304('0x41')]['rawAttributes']);_0xd23f35[_0xb304('0x30')]=_['keys'](_0x1a2823['query']);_0xd23f35[_0xb304('0x32')]=_['intersection'](_0xd23f35[_0xb304('0x2f')],_0xd23f35['query']);_0x364141[_0xb304('0x34')]=_[_0xb304('0x33')](_0xd23f35[_0xb304('0x2f')],qs[_0xb304('0x35')](_0x1a2823['query']['fields']));_0x364141[_0xb304('0x34')]=_0x364141[_0xb304('0x34')]['length']?_0x364141[_0xb304('0x34')]:_0xd23f35['model'];if(_0x1a2823[_0xb304('0x30')][_0xb304('0x42')]){_0x364141[_0xb304('0x48')]=[{'all':!![]}];}_0x364141=_[_0xb304('0x3d')]({},_0x364141,_0x1a2823[_0xb304('0x49')]);return db[_0xb304('0x41')][_0xb304('0x4a')](_0x364141)[_0xb304('0x26')](handleEntityNotFound(_0x8008a8,null))['then'](respondWithResult(_0x8008a8,null))[_0xb304('0x45')](handleError(_0x8008a8,null));};exports[_0xb304('0x4b')]=function(_0x439047,_0xf20d4e){return db['JscriptyAnswerReport'][_0xb304('0x4b')](_0x439047[_0xb304('0x4c')],{})[_0xb304('0x26')](respondWithResult(_0xf20d4e,0xc9))[_0xb304('0x45')](handleError(_0xf20d4e,null));};exports[_0xb304('0x25')]=function(_0x38ec58,_0x3a85a1){if(_0x38ec58[_0xb304('0x4c')]['id']){delete _0x38ec58[_0xb304('0x4c')]['id'];}return db[_0xb304('0x41')][_0xb304('0x4a')]({'where':{'id':_0x38ec58[_0xb304('0x47')]['id']}})[_0xb304('0x26')](handleEntityNotFound(_0x3a85a1,null))[_0xb304('0x26')](saveUpdates(_0x38ec58[_0xb304('0x4c')],null))[_0xb304('0x26')](respondWithResult(_0x3a85a1,null))[_0xb304('0x45')](handleError(_0x3a85a1,null));};exports[_0xb304('0x4d')]=function(_0x471b4d,_0x37efdb){return db[_0xb304('0x41')][_0xb304('0x4a')]({'where':{'id':_0x471b4d[_0xb304('0x47')]['id']}})[_0xb304('0x26')](handleEntityNotFound(_0x37efdb,null))[_0xb304('0x26')](removeEntity(_0x37efdb,null))['catch'](handleError(_0x37efdb,null));};exports[_0xb304('0x4e')]=function(_0x56391f,_0x1056ac){return db[_0xb304('0x41')]['describe']()['then'](respondWithResult(_0x1056ac,null))['catch'](handleError(_0x1056ac,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index 4b88ff1..805060e 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 _0xd761=['rimraf','./jscriptyAnswerReport.attributes','exports','define','JscriptyAnswerReport','report_jscripty_answers','lodash','util','../../config/logger','api','request-promise','path'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xd761,0x1ce));var _0x1d76=function(_0x18a436,_0x1dbe06){_0x18a436=_0x18a436-0x0;var _0x5c2cf8=_0xd761[_0x18a436];return _0x5c2cf8;};'use strict';var _=require(_0x1d76('0x0'));var util=require(_0x1d76('0x1'));var logger=require(_0x1d76('0x2'))(_0x1d76('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x1d76('0x4'));var fs=require('fs');var path=require(_0x1d76('0x5'));var rimraf=require(_0x1d76('0x6'));var config=require('../../config/environment');var attributes=require(_0x1d76('0x7'));module[_0x1d76('0x8')]=function(_0x1ba1c3,_0x2cca6a){return _0x1ba1c3[_0x1d76('0x9')](_0x1d76('0xa'),attributes,{'tableName':_0x1d76('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x706e=['../../config/environment','./jscriptyAnswerReport.attributes','JscriptyAnswerReport','lodash','bluebird','path'];(function(_0x3f2041,_0x38dd20){var _0x42b037=function(_0x36e086){while(--_0x36e086){_0x3f2041['push'](_0x3f2041['shift']());}};_0x42b037(++_0x38dd20);}(_0x706e,0x1b9));var _0xe706=function(_0x10f198,_0x3292b8){_0x10f198=_0x10f198-0x0;var _0x5da379=_0x706e[_0x10f198];return _0x5da379;};'use strict';var _=require(_0xe706('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xe706('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe706('0x2'));var rimraf=require('rimraf');var config=require(_0xe706('0x3'));var attributes=require(_0xe706('0x4'));module['exports']=function(_0x352255,_0x348070){return _0x352255['define'](_0xe706('0x5'),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 872a9ee..a862e31 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 _0xce4e=['JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','error','code','message','result','moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','request','then','info'];(function(_0x58c513,_0x15deec){var _0x4da4c4=function(_0x112a83){while(--_0x112a83){_0x58c513['push'](_0x58c513['shift']());}};_0x4da4c4(++_0x15deec);}(_0xce4e,0x1ca));var _0xece4=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xce4e[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xece4('0x0'));var BPromise=require(_0xece4('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xece4('0x2'));var db=require(_0xece4('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xece4('0x4'))('rpc');var config=require(_0xece4('0x5'));var jayson=require(_0xece4('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4230cd,_0x3de1c8,_0x4237f5){return new BPromise(function(_0xb45e9d,_0x600068){return client[_0xece4('0x7')](_0x4230cd,_0x4237f5)[_0xece4('0x8')](function(_0x3d207d){logger[_0xece4('0x9')](_0xece4('0xa'),_0x3de1c8,_0xece4('0xb'));logger[_0xece4('0xc')](_0xece4('0xd'),_0x3de1c8,'request\x20sent',JSON['stringify'](_0x3d207d));if(_0x3d207d[_0xece4('0xe')]){if(_0x3d207d[_0xece4('0xe')][_0xece4('0xf')]===0x1f4){logger['error'](_0xece4('0xa'),_0x3de1c8,_0x3d207d[_0xece4('0xe')][_0xece4('0x10')]);return _0x600068(_0x3d207d[_0xece4('0xe')][_0xece4('0x10')]);}logger[_0xece4('0xe')](_0xece4('0xa'),_0x3de1c8,_0x3d207d[_0xece4('0xe')][_0xece4('0x10')]);return _0xb45e9d(_0x3d207d['error'][_0xece4('0x10')]);}else{logger[_0xece4('0x9')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x3de1c8,_0xece4('0xb'));_0xb45e9d(_0x3d207d[_0xece4('0x11')][_0xece4('0x10')]);}})['catch'](function(_0x14c12){logger[_0xece4('0xe')](_0xece4('0xa'),_0x3de1c8,_0x14c12);_0x600068(_0x14c12);});});} \ No newline at end of file +var _0x6650=['debug','error','code','JscriptyAnswerReport,\x20%s,\x20%s','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request\x20sent'];(function(_0x41f661,_0x465f86){var _0x12a9b8=function(_0x263d4a){while(--_0x263d4a){_0x41f661['push'](_0x41f661['shift']());}};_0x12a9b8(++_0x465f86);}(_0x6650,0x1db));var _0x0665=function(_0x7455b,_0x24cbd1){_0x7455b=_0x7455b-0x0;var _0x5dbd63=_0x6650[_0x7455b];return _0x5dbd63;};'use strict';var _=require(_0x0665('0x0'));var util=require(_0x0665('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x0665('0x2'));var fs=require('fs');var Redis=require(_0x0665('0x3'));var db=require(_0x0665('0x4'))['db'];var utils=require(_0x0665('0x5'));var logger=require('../../config/logger')(_0x0665('0x6'));var config=require(_0x0665('0x7'));var jayson=require(_0x0665('0x8'));var client=jayson[_0x0665('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3569ed,_0x5224d4,_0xcbd5ee){return new BPromise(function(_0x8b7c9e,_0x3b5420){return client['request'](_0x3569ed,_0xcbd5ee)['then'](function(_0x57ca41){logger['info']('JscriptyAnswerReport,\x20%s,\x20%s',_0x5224d4,_0x0665('0xa'));logger[_0x0665('0xb')]('JscriptyAnswerReport,\x20%s,\x20%s,\x20%s',_0x5224d4,_0x0665('0xa'),JSON['stringify'](_0x57ca41));if(_0x57ca41[_0x0665('0xc')]){if(_0x57ca41[_0x0665('0xc')][_0x0665('0xd')]===0x1f4){logger[_0x0665('0xc')](_0x0665('0xe'),_0x5224d4,_0x57ca41[_0x0665('0xc')]['message']);return _0x3b5420(_0x57ca41['error'][_0x0665('0xf')]);}logger[_0x0665('0xc')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x5224d4,_0x57ca41['error']['message']);return _0x8b7c9e(_0x57ca41[_0x0665('0xc')][_0x0665('0xf')]);}else{logger['info']('JscriptyAnswerReport,\x20%s,\x20%s',_0x5224d4,_0x0665('0xa'));_0x8b7c9e(_0x57ca41[_0x0665('0x10')][_0x0665('0xf')]);}})[_0x0665('0x11')](function(_0xedfd7a){logger['error'](_0x0665('0xe'),_0x5224d4,_0xedfd7a);_0x3b5420(_0xedfd7a);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index df651c8..8505598 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 _0x3f25=['destroy','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','./jscriptyProject.controller','get','/:id','show','/:id/sessions','getSessions','/:id/answers','isAuthenticated','getAnswers','/:id/summary','getSummary','post','clone','put','delete'];(function(_0x386081,_0x490292){var _0x26a92c=function(_0x58f5f3){while(--_0x58f5f3){_0x386081['push'](_0x386081['shift']());}};_0x26a92c(++_0x490292);}(_0x3f25,0x19f));var _0x53f2=function(_0x50351c,_0x33eec4){_0x50351c=_0x50351c-0x0;var _0x5b33e1=_0x3f25[_0x50351c];return _0x5b33e1;};'use strict';var multer=require(_0x53f2('0x0'));var util=require(_0x53f2('0x1'));var path=require(_0x53f2('0x2'));var timeout=require('connect-timeout');var express=require(_0x53f2('0x3'));var router=express['Router']();var fs_extra=require(_0x53f2('0x4'));var auth=require(_0x53f2('0x5'));var interaction=require(_0x53f2('0x6'));var config=require('../../config/environment');var controller=require(_0x53f2('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x53f2('0x8')](_0x53f2('0x9'),auth['isAuthenticated'](),controller[_0x53f2('0xa')]);router[_0x53f2('0x8')](_0x53f2('0xb'),auth['isAuthenticated'](),controller[_0x53f2('0xc')]);router['get'](_0x53f2('0xd'),auth[_0x53f2('0xe')](),controller[_0x53f2('0xf')]);router['get'](_0x53f2('0x10'),auth['isAuthenticated'](),timeout('30s'),controller[_0x53f2('0x11')]);router[_0x53f2('0x12')]('/',auth[_0x53f2('0xe')](),controller['create']);router[_0x53f2('0x12')]('/:id/clone',auth[_0x53f2('0xe')](),controller[_0x53f2('0x13')]);router[_0x53f2('0x14')](_0x53f2('0x9'),auth[_0x53f2('0xe')](),controller['update']);router[_0x53f2('0x15')](_0x53f2('0x9'),auth['isAuthenticated'](),controller[_0x53f2('0x16')]);module['exports']=router; \ No newline at end of file +var _0x5627=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','isAuthenticated','index','show','get','getSessions','/:id/answers','getAnswers','/:id/summary','30s','getSummary','post','create','/:id/clone','clone','put','/:id','update','destroy','multer','util'];(function(_0x2a0183,_0x3fc93c){var _0x158c3a=function(_0x57a903){while(--_0x57a903){_0x2a0183['push'](_0x2a0183['shift']());}};_0x158c3a(++_0x3fc93c);}(_0x5627,0x193));var _0x7562=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x5627[_0x397e5f];return _0x5302b8;};'use strict';var multer=require(_0x7562('0x0'));var util=require(_0x7562('0x1'));var path=require('path');var timeout=require(_0x7562('0x2'));var express=require('express');var router=express[_0x7562('0x3')]();var fs_extra=require(_0x7562('0x4'));var auth=require(_0x7562('0x5'));var interaction=require(_0x7562('0x6'));var config=require(_0x7562('0x7'));var controller=require(_0x7562('0x8'));router['get']('/',auth[_0x7562('0x9')](),controller[_0x7562('0xa')]);router['get']('/:id',auth[_0x7562('0x9')](),controller[_0x7562('0xb')]);router[_0x7562('0xc')]('/:id/sessions',auth[_0x7562('0x9')](),controller[_0x7562('0xd')]);router[_0x7562('0xc')](_0x7562('0xe'),auth['isAuthenticated'](),controller[_0x7562('0xf')]);router[_0x7562('0xc')](_0x7562('0x10'),auth[_0x7562('0x9')](),timeout(_0x7562('0x11')),controller[_0x7562('0x12')]);router[_0x7562('0x13')]('/',auth['isAuthenticated'](),controller[_0x7562('0x14')]);router[_0x7562('0x13')](_0x7562('0x15'),auth[_0x7562('0x9')](),controller[_0x7562('0x16')]);router[_0x7562('0x17')](_0x7562('0x18'),auth['isAuthenticated'](),controller[_0x7562('0x19')]);router['delete'](_0x7562('0x18'),auth[_0x7562('0x9')](),controller[_0x7562('0x1a')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index f6febd8..3c17c4f 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 _0xf7de=['isObjectLike','setDataValue','stringify','formData','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','description','BOOLEAN','sequelize','util','exports','STRING','name','TEXT','long'];(function(_0x3e112d,_0x2bb132){var _0x531c31=function(_0x1954bc){while(--_0x1954bc){_0x3e112d['push'](_0x3e112d['shift']());}};_0x531c31(++_0x2bb132);}(_0xf7de,0xd9));var _0xef7d=function(_0x4ce6aa,_0x261d63){_0x4ce6aa=_0x4ce6aa-0x0;var _0x2e59d2=_0xf7de[_0x4ce6aa];return _0x2e59d2;};'use strict';var Sequelize=require(_0xef7d('0x0'));var _=require('lodash');var util=require(_0xef7d('0x1'));module[_0xef7d('0x2')]={'name':{'type':Sequelize[_0xef7d('0x3')],'unique':_0xef7d('0x4')},'description':{'type':Sequelize[_0xef7d('0x3')]},'formData':{'type':Sequelize[_0xef7d('0x5')](_0xef7d('0x6')),'set':function(_0x329730){if(_[_0xef7d('0x7')](_0x329730)){this[_0xef7d('0x8')]('formData',JSON[_0xef7d('0x9')](_0x329730));}else if(_['isString'](_0x329730)){this[_0xef7d('0x8')]('formData',_0x329730);}else{this[_0xef7d('0x8')](_0xef7d('0xa'),util['format'](_0xef7d('0xb'),this['getDataValue']('name')||'',this['getDataValue'](_0xef7d('0xc'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0xef7d('0xd')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0xef7d('0xd')],'defaultValue':![]}}; \ No newline at end of file +var _0x9f2c=['isString','setDataValue','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description','sequelize','lodash','exports','STRING','name','TEXT','isObjectLike','formData','stringify'];(function(_0x2ec461,_0x5f588a){var _0x28603d=function(_0x21114b){while(--_0x21114b){_0x2ec461['push'](_0x2ec461['shift']());}};_0x28603d(++_0x5f588a);}(_0x9f2c,0x123));var _0xc9f2=function(_0x360739,_0x2ec1b2){_0x360739=_0x360739-0x0;var _0x3e23a1=_0x9f2c[_0x360739];return _0x3e23a1;};'use strict';var Sequelize=require(_0xc9f2('0x0'));var _=require(_0xc9f2('0x1'));var util=require('util');module[_0xc9f2('0x2')]={'name':{'type':Sequelize[_0xc9f2('0x3')],'unique':_0xc9f2('0x4')},'description':{'type':Sequelize[_0xc9f2('0x3')]},'formData':{'type':Sequelize[_0xc9f2('0x5')]('long'),'set':function(_0x5c4e49){if(_[_0xc9f2('0x6')](_0x5c4e49)){this['setDataValue'](_0xc9f2('0x7'),JSON[_0xc9f2('0x8')](_0x5c4e49));}else if(_[_0xc9f2('0x9')](_0x5c4e49)){this[_0xc9f2('0xa')]('formData',_0x5c4e49);}else{this[_0xc9f2('0xa')](_0xc9f2('0x7'),util[_0xc9f2('0xb')](_0xc9f2('0xc'),this[_0xc9f2('0xd')]('name')||'',this[_0xc9f2('0xd')](_0xc9f2('0xe'))||''));}}},'enableUncompleteSave':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index af55aa6..b8f25bc 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 _0xdc15=['findAll','getAnswers','JscriptyAnswerReport','number','fromCharCode','toString','indexOf','replace','getSummary','startTime','parse','JscriptyQuestionReport','-createdAt','questionId','question','starttime','format','answer','push','isEmpty','/tmp/Jscripty_Project_%d_Summary_%s.csv','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-type','text/csv','download','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','limit','undefined','offset','count','Content-Range','apply','save','update','then','destroy','Projects','sendStatus','error','stack','name','send','index','JscriptyProject','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','rows','params','rawAttributes','include','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','catch','clone','createdAt','updatedAt','user','role','UserProfileResource','findOne','JscriptySessionReport','hasOwnProperty','ProjectId'];(function(_0x20589d,_0x55d5bf){var _0x422de9=function(_0x44cbbb){while(--_0x44cbbb){_0x20589d['push'](_0x20589d['shift']());}};_0x422de9(++_0x55d5bf);}(_0xdc15,0x1f3));var _0x5dc1=function(_0x37862a,_0x2bc98e){_0x37862a=_0x37862a-0x0;var _0x5b0104=_0xdc15[_0x37862a];return _0x5b0104;};'use strict';var emlformat=require(_0x5dc1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5dc1('0x1'));var jsonpatch=require(_0x5dc1('0x2'));var rp=require(_0x5dc1('0x3'));var moment=require(_0x5dc1('0x4'));var BPromise=require(_0x5dc1('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x5dc1('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5dc1('0x7'));var _=require(_0x5dc1('0x8'));var squel=require(_0x5dc1('0x9'));var crypto=require(_0x5dc1('0xa'));var jsforce=require(_0x5dc1('0xb'));var deskjs=require(_0x5dc1('0xc'));var toCsv=require(_0x5dc1('0xd'));var querystring=require(_0x5dc1('0xe'));var Papa=require(_0x5dc1('0xf'));var Redis=require(_0x5dc1('0x10'));var authService=require(_0x5dc1('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5dc1('0x12'));var logger=require(_0x5dc1('0x13'))('api');var utils=require(_0x5dc1('0x14'));var config=require(_0x5dc1('0x15'));var licenseUtil=require(_0x5dc1('0x16'));var db=require(_0x5dc1('0x17'))['db'];function respondWithStatusCode(_0x13602a,_0x40080a){_0x40080a=_0x40080a||0xcc;return function(_0x284e2a){if(_0x284e2a){return _0x13602a['sendStatus'](_0x40080a);}return _0x13602a[_0x5dc1('0x18')](_0x40080a)[_0x5dc1('0x19')]();};}function respondWithResult(_0x47a2cb,_0x32b126){_0x32b126=_0x32b126||0xc8;return function(_0x359e88){if(_0x359e88){return _0x47a2cb['status'](_0x32b126)[_0x5dc1('0x1a')](_0x359e88);}};}function respondWithFilteredResult(_0x828819,_0xad5fe0){return function(_0x588327){if(_0x588327){var _0x1424ee=typeof _0xad5fe0['offset']==='undefined'&&typeof _0xad5fe0[_0x5dc1('0x1b')]===_0x5dc1('0x1c');var _0x1f2e4a=_0x588327['count'];var _0x427496=_0x1424ee?0x0:_0xad5fe0[_0x5dc1('0x1d')];var _0x7dad16=_0x1424ee?_0x588327[_0x5dc1('0x1e')]:_0xad5fe0[_0x5dc1('0x1d')]+_0xad5fe0[_0x5dc1('0x1b')];var _0x1ba1fe;if(_0x7dad16>=_0x1f2e4a){_0x7dad16=_0x1f2e4a;_0x1ba1fe=0xc8;}else{_0x1ba1fe=0xce;}_0x828819[_0x5dc1('0x18')](_0x1ba1fe);return _0x828819['set'](_0x5dc1('0x1f'),_0x427496+'-'+_0x7dad16+'/'+_0x1f2e4a)[_0x5dc1('0x1a')](_0x588327);}return null;};}function patchUpdates(_0x41ae80){return function(_0x127a1a){try{jsonpatch[_0x5dc1('0x20')](_0x127a1a,_0x41ae80,!![]);}catch(_0x6ecab3){return BPromise['reject'](_0x6ecab3);}return _0x127a1a[_0x5dc1('0x21')]();};}function saveUpdates(_0xd8c4fa,_0x106385){return function(_0x3ae1f3){if(_0x3ae1f3){return _0x3ae1f3[_0x5dc1('0x22')](_0xd8c4fa)[_0x5dc1('0x23')](function(_0x4610a1){return _0x4610a1;});}return null;};}function removeEntity(_0xfa2846,_0x9c16a1){return function(_0x26ee71){if(_0x26ee71){return _0x26ee71[_0x5dc1('0x24')]()[_0x5dc1('0x23')](function(){var _0x2643b9=_0x26ee71['get']({'plain':!![]});var _0x1a21f2=_0x5dc1('0x25');return db['UserProfileResource'][_0x5dc1('0x24')]({'where':{'type':_0x1a21f2,'resourceId':_0x2643b9['id']}})[_0x5dc1('0x23')](function(){return _0x26ee71;});})[_0x5dc1('0x23')](function(){_0xfa2846[_0x5dc1('0x18')](0xcc)[_0x5dc1('0x19')]();});}};}function handleEntityNotFound(_0x191668,_0x1b2063){return function(_0x2a13f9){if(!_0x2a13f9){_0x191668[_0x5dc1('0x26')](0x194);}return _0x2a13f9;};}function handleError(_0x466667,_0x204b53){_0x204b53=_0x204b53||0x1f4;return function(_0xddba38){logger[_0x5dc1('0x27')](_0xddba38[_0x5dc1('0x28')]);if(_0xddba38[_0x5dc1('0x29')]){delete _0xddba38[_0x5dc1('0x29')];}_0x466667[_0x5dc1('0x18')](_0x204b53)[_0x5dc1('0x2a')](_0xddba38);};}exports[_0x5dc1('0x2b')]=function(_0x4eadf1,_0x225bb6){var _0x3ab569={},_0x1331de={},_0x1dfe74={'count':0x0,'rows':[]};var _0x19cb45=_['map'](db[_0x5dc1('0x2c')]['rawAttributes'],function(_0x553c9f){return{'name':_0x553c9f[_0x5dc1('0x2d')],'type':_0x553c9f[_0x5dc1('0x2e')][_0x5dc1('0x2f')]};});_0x1331de[_0x5dc1('0x30')]=_[_0x5dc1('0x31')](_0x19cb45,'name');_0x1331de[_0x5dc1('0x32')]=_[_0x5dc1('0x33')](_0x4eadf1[_0x5dc1('0x32')]);_0x1331de[_0x5dc1('0x34')]=_[_0x5dc1('0x35')](_0x1331de[_0x5dc1('0x30')],_0x1331de['query']);_0x3ab569[_0x5dc1('0x36')]=_[_0x5dc1('0x35')](_0x1331de[_0x5dc1('0x30')],qs[_0x5dc1('0x37')](_0x4eadf1[_0x5dc1('0x32')][_0x5dc1('0x37')]));_0x3ab569[_0x5dc1('0x36')]=_0x3ab569[_0x5dc1('0x36')][_0x5dc1('0x38')]?_0x3ab569[_0x5dc1('0x36')]:_0x1331de[_0x5dc1('0x30')];if(!_0x4eadf1[_0x5dc1('0x32')]['hasOwnProperty'](_0x5dc1('0x39'))){_0x3ab569[_0x5dc1('0x1b')]=qs[_0x5dc1('0x1b')](_0x4eadf1[_0x5dc1('0x32')]['limit']);_0x3ab569[_0x5dc1('0x1d')]=qs[_0x5dc1('0x1d')](_0x4eadf1[_0x5dc1('0x32')][_0x5dc1('0x1d')]);}_0x3ab569[_0x5dc1('0x3a')]=qs[_0x5dc1('0x3b')](_0x4eadf1[_0x5dc1('0x32')][_0x5dc1('0x3b')]);_0x3ab569[_0x5dc1('0x3c')]=qs[_0x5dc1('0x34')](_[_0x5dc1('0x3d')](_0x4eadf1[_0x5dc1('0x32')],_0x1331de[_0x5dc1('0x34')]),_0x19cb45);if(_0x4eadf1[_0x5dc1('0x32')]['filter']){_0x3ab569[_0x5dc1('0x3c')]=_[_0x5dc1('0x3e')](_0x3ab569[_0x5dc1('0x3c')],{'$or':_[_0x5dc1('0x31')](_0x19cb45,function(_0xdf98aa){if(_0xdf98aa[_0x5dc1('0x2e')]!==_0x5dc1('0x3f')){var _0x2b26ff={};_0x2b26ff[_0xdf98aa['name']]={'$like':'%'+_0x4eadf1[_0x5dc1('0x32')][_0x5dc1('0x40')]+'%'};return _0x2b26ff;}})});}_0x3ab569=_[_0x5dc1('0x3e')]({},_0x3ab569,_0x4eadf1[_0x5dc1('0x41')]);var _0x2ac806={'where':_0x3ab569['where']};return db[_0x5dc1('0x2c')][_0x5dc1('0x1e')](_0x2ac806)[_0x5dc1('0x23')](function(_0x26eb34){_0x1dfe74[_0x5dc1('0x1e')]=_0x26eb34;if(_0x4eadf1[_0x5dc1('0x32')][_0x5dc1('0x42')]){_0x3ab569['include']=[{'all':!![]}];}return db[_0x5dc1('0x2c')]['findAll'](_0x3ab569);})[_0x5dc1('0x23')](function(_0x2d446d){_0x1dfe74[_0x5dc1('0x43')]=_0x2d446d;return _0x1dfe74;})[_0x5dc1('0x23')](respondWithFilteredResult(_0x225bb6,_0x3ab569))['catch'](handleError(_0x225bb6,null));};exports['show']=function(_0x22be79,_0x105a3a){var _0x2b80be={'raw':![],'where':{'id':_0x22be79[_0x5dc1('0x44')]['id']}},_0x25e8c3={};_0x25e8c3[_0x5dc1('0x30')]=_['keys'](db[_0x5dc1('0x2c')][_0x5dc1('0x45')]);_0x25e8c3['query']=_[_0x5dc1('0x33')](_0x22be79[_0x5dc1('0x32')]);_0x25e8c3[_0x5dc1('0x34')]=_[_0x5dc1('0x35')](_0x25e8c3['model'],_0x25e8c3[_0x5dc1('0x32')]);_0x2b80be[_0x5dc1('0x36')]=_[_0x5dc1('0x35')](_0x25e8c3[_0x5dc1('0x30')],qs[_0x5dc1('0x37')](_0x22be79[_0x5dc1('0x32')][_0x5dc1('0x37')]));_0x2b80be[_0x5dc1('0x36')]=_0x2b80be['attributes'][_0x5dc1('0x38')]?_0x2b80be[_0x5dc1('0x36')]:_0x25e8c3['model'];if(_0x22be79['query'][_0x5dc1('0x42')]){_0x2b80be[_0x5dc1('0x46')]=[{'all':!![]}];}_0x2b80be=_['merge']({},_0x2b80be,_0x22be79[_0x5dc1('0x41')]);return db['JscriptyProject'][_0x5dc1('0x47')](_0x2b80be)['then'](handleEntityNotFound(_0x105a3a,null))[_0x5dc1('0x23')](respondWithResult(_0x105a3a,null))['catch'](handleError(_0x105a3a,null));};exports[_0x5dc1('0x48')]=function(_0x2f374d,_0x2c1563){return db[_0x5dc1('0x2c')][_0x5dc1('0x48')](_0x2f374d[_0x5dc1('0x49')],{})['then'](function(_0x1aea15){var _0x241c43=_0x2f374d['user'][_0x5dc1('0x4a')]({'plain':!![]});if(!_0x241c43)throw new Error(_0x5dc1('0x4b'));if(_0x241c43['role']==='user'){var _0x137469=_0x1aea15['get']({'plain':!![]});var _0x1babdf=_0x5dc1('0x25');return db[_0x5dc1('0x4c')][_0x5dc1('0x47')]({'where':{'name':_0x1babdf,'userProfileId':_0x241c43[_0x5dc1('0x4d')]},'raw':!![]})[_0x5dc1('0x23')](function(_0x285ca9){if(_0x285ca9&&_0x285ca9[_0x5dc1('0x4e')]===0x0){return db['UserProfileResource']['create']({'name':_0x137469[_0x5dc1('0x29')],'resourceId':_0x137469['id'],'type':_0x285ca9[_0x5dc1('0x29')],'sectionId':_0x285ca9['id']},{})[_0x5dc1('0x23')](function(){return _0x1aea15;});}else{return _0x1aea15;}})['catch'](function(_0x3b2d05){logger['error'](_0x5dc1('0x4f'),_0x3b2d05);throw _0x3b2d05;});}return _0x1aea15;})[_0x5dc1('0x23')](respondWithResult(_0x2c1563,0xc9))[_0x5dc1('0x50')](handleError(_0x2c1563,null));};exports[_0x5dc1('0x51')]=function(_0x5a7331,_0x16475f){var _0x4f4022={'where':{'id':_0x5a7331[_0x5dc1('0x44')]['id']}},_0x430ea9={};_0x430ea9['model']=_[_0x5dc1('0x33')](db[_0x5dc1('0x2c')][_0x5dc1('0x45')]);_0x4f4022['attributes']=_['intersection'](_0x430ea9['model'],qs['fields'](_0x5a7331[_0x5dc1('0x32')][_0x5dc1('0x37')]));_0x4f4022[_0x5dc1('0x36')]=_0x4f4022['attributes'][_0x5dc1('0x38')]?_0x4f4022[_0x5dc1('0x36')]:_0x430ea9['model'];if(_0x5a7331[_0x5dc1('0x32')][_0x5dc1('0x42')]){_0x4f4022[_0x5dc1('0x46')]=[{'all':!![]}];}_0x4f4022=_[_0x5dc1('0x3e')]({},_0x4f4022,_0x5a7331['options']);return db[_0x5dc1('0x2c')][_0x5dc1('0x47')](_0x4f4022)[_0x5dc1('0x23')](handleEntityNotFound(_0x16475f,null))[_0x5dc1('0x23')](function(_0x5a710c){if(_0x5a710c){var _0x57d019=_0x5a710c['get']({'plain':!![]});_0x57d019=qs['omit'](_0x57d019,['id',_0x5dc1('0x52'),_0x5dc1('0x53')]);_0x5a7331['body']=_['omit'](_0x5a7331[_0x5dc1('0x49')],['id','createdAt',_0x5dc1('0x53')]);return db[_0x5dc1('0x2c')]['create'](_[_0x5dc1('0x3e')](_0x57d019,_0x5a7331[_0x5dc1('0x49')]),{'include':_0x5a7331[_0x5dc1('0x32')][_0x5dc1('0x42')]?[{'all':!![]}]:undefined})[_0x5dc1('0x23')](function(_0xa3f909){var _0x67b696=_0x5a7331[_0x5dc1('0x54')][_0x5dc1('0x4a')]({'plain':!![]});if(!_0x67b696)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x67b696[_0x5dc1('0x55')]==='user'){var _0x3b2474=_0xa3f909[_0x5dc1('0x4a')]({'plain':!![]});var _0xd86c3e='Projects';return db[_0x5dc1('0x4c')][_0x5dc1('0x47')]({'where':{'name':_0xd86c3e,'userProfileId':_0x67b696[_0x5dc1('0x4d')]},'raw':!![]})[_0x5dc1('0x23')](function(_0x693b8a){if(_0x693b8a&&_0x693b8a[_0x5dc1('0x4e')]===0x0){return db[_0x5dc1('0x56')]['create']({'name':_0x3b2474['name'],'resourceId':_0x3b2474['id'],'type':_0x693b8a[_0x5dc1('0x29')],'sectionId':_0x693b8a['id']},{})[_0x5dc1('0x23')](function(){return _0xa3f909;});}else{return _0xa3f909;}})['catch'](function(_0x28062e){logger[_0x5dc1('0x27')](_0x5dc1('0x4f'),_0x28062e);throw _0x28062e;});}return _0xa3f909;});}})['then'](respondWithResult(_0x16475f,0xc9))[_0x5dc1('0x50')](handleError(_0x16475f,null));};exports[_0x5dc1('0x22')]=function(_0x492582,_0x482c2d){if(_0x492582[_0x5dc1('0x49')]['id']){delete _0x492582['body']['id'];}return db[_0x5dc1('0x2c')]['find']({'where':{'id':_0x492582[_0x5dc1('0x44')]['id']}})[_0x5dc1('0x23')](handleEntityNotFound(_0x482c2d,null))[_0x5dc1('0x23')](saveUpdates(_0x492582[_0x5dc1('0x49')],null))[_0x5dc1('0x23')](respondWithResult(_0x482c2d,null))['catch'](handleError(_0x482c2d,null));};exports[_0x5dc1('0x24')]=function(_0x3a6d52,_0x1dfc6a){return db[_0x5dc1('0x2c')][_0x5dc1('0x47')]({'where':{'id':_0x3a6d52[_0x5dc1('0x44')]['id']}})['then'](handleEntityNotFound(_0x1dfc6a,null))[_0x5dc1('0x23')](removeEntity(_0x1dfc6a,null))[_0x5dc1('0x50')](handleError(_0x1dfc6a,null));};exports['getSessions']=function(_0x504b5d,_0x3ede01,_0x31d17f){var _0x438a51={'raw':!![],'where':{}};var _0x25c1df={};var _0x358edf={'count':0x0,'rows':[]};return db[_0x5dc1('0x2c')][_0x5dc1('0x57')]({'where':{'id':_0x504b5d['params']['id']}})['then'](handleEntityNotFound(_0x3ede01,null))[_0x5dc1('0x23')](function(_0x2904c1){if(_0x2904c1){_0x25c1df[_0x5dc1('0x30')]=_[_0x5dc1('0x33')](db[_0x5dc1('0x58')][_0x5dc1('0x45')]);_0x25c1df['query']=_[_0x5dc1('0x33')](_0x504b5d[_0x5dc1('0x32')]);_0x25c1df[_0x5dc1('0x34')]=_[_0x5dc1('0x35')](_0x25c1df['model'],_0x25c1df[_0x5dc1('0x32')]);_0x438a51[_0x5dc1('0x36')]=_['intersection'](_0x25c1df[_0x5dc1('0x30')],qs[_0x5dc1('0x37')](_0x504b5d['query'][_0x5dc1('0x37')]));_0x438a51[_0x5dc1('0x36')]=_0x438a51[_0x5dc1('0x36')][_0x5dc1('0x38')]?_0x438a51['attributes']:_0x25c1df['model'];if(!_0x504b5d['query'][_0x5dc1('0x59')](_0x5dc1('0x39'))){_0x438a51[_0x5dc1('0x1b')]=qs[_0x5dc1('0x1b')](_0x504b5d[_0x5dc1('0x32')][_0x5dc1('0x1b')]);_0x438a51[_0x5dc1('0x1d')]=qs[_0x5dc1('0x1d')](_0x504b5d[_0x5dc1('0x32')][_0x5dc1('0x1d')]);}_0x438a51['order']=qs['sort'](_0x504b5d[_0x5dc1('0x32')][_0x5dc1('0x3b')]);_0x438a51[_0x5dc1('0x3c')]=qs[_0x5dc1('0x34')](_['pick'](_0x504b5d[_0x5dc1('0x32')],_0x25c1df[_0x5dc1('0x34')]));_0x438a51[_0x5dc1('0x3c')][_0x5dc1('0x5a')]=_0x2904c1['id'];if(_0x504b5d[_0x5dc1('0x32')][_0x5dc1('0x40')]){_0x438a51[_0x5dc1('0x3c')]=_[_0x5dc1('0x3e')](_0x438a51[_0x5dc1('0x3c')],{'$or':_[_0x5dc1('0x31')](_0x438a51[_0x5dc1('0x36')],function(_0x3d0deb){var _0x455709={};_0x455709[_0x3d0deb]={'$like':'%'+_0x504b5d[_0x5dc1('0x32')][_0x5dc1('0x40')]+'%'};return _0x455709;})});}_0x438a51=_['merge']({},_0x438a51,_0x504b5d[_0x5dc1('0x41')]);return db[_0x5dc1('0x58')]['count']({'where':_0x438a51[_0x5dc1('0x3c')]})[_0x5dc1('0x23')](function(_0x3c8b56){_0x358edf['count']=_0x3c8b56;if(_0x504b5d[_0x5dc1('0x32')]['includeAll']){_0x438a51[_0x5dc1('0x46')]=[{'all':!![]}];}return db['JscriptySessionReport'][_0x5dc1('0x5b')](_0x438a51);})[_0x5dc1('0x23')](function(_0x516bc8){_0x358edf[_0x5dc1('0x43')]=_0x516bc8;return _0x358edf;});}})[_0x5dc1('0x23')](respondWithFilteredResult(_0x3ede01,_0x438a51))[_0x5dc1('0x50')](handleError(_0x3ede01,null));};exports[_0x5dc1('0x5c')]=function(_0x32f0ac,_0x23f818,_0x2cf10a){var _0x29cbbf={'raw':!![],'where':{}};var _0x17e5ab={};var _0x59bfd3={'count':0x0,'rows':[]};return db[_0x5dc1('0x2c')][_0x5dc1('0x57')]({'where':{'id':_0x32f0ac['params']['id']}})[_0x5dc1('0x23')](handleEntityNotFound(_0x23f818,null))[_0x5dc1('0x23')](function(_0x47f9f7){if(_0x47f9f7){_0x17e5ab['model']=_[_0x5dc1('0x33')](db[_0x5dc1('0x5d')][_0x5dc1('0x45')]);_0x17e5ab[_0x5dc1('0x32')]=_['keys'](_0x32f0ac[_0x5dc1('0x32')]);_0x17e5ab[_0x5dc1('0x34')]=_[_0x5dc1('0x35')](_0x17e5ab[_0x5dc1('0x30')],_0x17e5ab[_0x5dc1('0x32')]);_0x29cbbf['attributes']=_[_0x5dc1('0x35')](_0x17e5ab[_0x5dc1('0x30')],qs['fields'](_0x32f0ac[_0x5dc1('0x32')][_0x5dc1('0x37')]));_0x29cbbf[_0x5dc1('0x36')]=_0x29cbbf[_0x5dc1('0x36')][_0x5dc1('0x38')]?_0x29cbbf[_0x5dc1('0x36')]:_0x17e5ab['model'];if(!_0x32f0ac[_0x5dc1('0x32')]['hasOwnProperty'](_0x5dc1('0x39'))){_0x29cbbf['limit']=qs[_0x5dc1('0x1b')](_0x32f0ac['query']['limit']);_0x29cbbf[_0x5dc1('0x1d')]=qs[_0x5dc1('0x1d')](_0x32f0ac[_0x5dc1('0x32')][_0x5dc1('0x1d')]);}_0x29cbbf[_0x5dc1('0x3a')]=qs[_0x5dc1('0x3b')](_0x32f0ac[_0x5dc1('0x32')][_0x5dc1('0x3b')]);_0x29cbbf[_0x5dc1('0x3c')]=qs['filters'](_[_0x5dc1('0x3d')](_0x32f0ac[_0x5dc1('0x32')],_0x17e5ab[_0x5dc1('0x34')]));_0x29cbbf[_0x5dc1('0x3c')]['ProjectId']=_0x47f9f7['id'];if(_0x32f0ac[_0x5dc1('0x32')][_0x5dc1('0x40')]){_0x29cbbf[_0x5dc1('0x3c')]=_['merge'](_0x29cbbf[_0x5dc1('0x3c')],{'$or':_[_0x5dc1('0x31')](_0x29cbbf['attributes'],function(_0x445e8b){var _0x420541={};_0x420541[_0x445e8b]={'$like':'%'+_0x32f0ac[_0x5dc1('0x32')][_0x5dc1('0x40')]+'%'};return _0x420541;})});}_0x29cbbf=_['merge']({},_0x29cbbf,_0x32f0ac[_0x5dc1('0x41')]);return db[_0x5dc1('0x5d')][_0x5dc1('0x1e')]({'where':_0x29cbbf['where']})['then'](function(_0x38da53){_0x59bfd3[_0x5dc1('0x1e')]=_0x38da53;if(_0x32f0ac[_0x5dc1('0x32')]['includeAll']){_0x29cbbf['include']=[{'all':!![]}];}return db[_0x5dc1('0x5d')]['findAll'](_0x29cbbf);})['then'](function(_0x513610){_0x59bfd3['rows']=_0x513610;return _0x59bfd3;});}})[_0x5dc1('0x23')](respondWithFilteredResult(_0x23f818,_0x29cbbf))[_0x5dc1('0x50')](handleError(_0x23f818,null));};function char(_0x209800){return _0x5dc1('0x5e')===typeof _0x209800?String[_0x5dc1('0x5f')][_0x5dc1('0x20')](null,arguments):_0x209800;}function needsEncapsulation(_0x1963bc){return!!_0x1963bc&&(_0x1963bc[_0x5dc1('0x60')]()['indexOf'](char(0xd))>=0x0||_0x1963bc[_0x5dc1('0x60')]()[_0x5dc1('0x61')](char(0xa))>=0x0||_0x1963bc['toString']()[_0x5dc1('0x61')](char(0x2c))>=0x0||_0x1963bc[_0x5dc1('0x60')]()['indexOf'](char(0x22))>=0x0);}function encapsulate(_0x23f5a4){var _0x4e758e=char(0x22),_0x523ded='\x5c'+char(0x22),_0x2330fe=_0x23f5a4[_0x5dc1('0x60')]()[_0x5dc1('0x62')](new RegExp(_0x4e758e,'g'),_0x523ded);return _0x4e758e+_0x2330fe+_0x4e758e;}exports[_0x5dc1('0x63')]=function(_0x1be24f,_0x5fd8ad,_0x2447e2){var _0x16cdd8,_0x586fea;var _0x198c93={'where':{'ProjectId':_0x1be24f[_0x5dc1('0x44')]['id']}};if(_0x1be24f['query'][_0x5dc1('0x64')]){_0x198c93[_0x5dc1('0x3c')]['starttime']=JSON[_0x5dc1('0x65')](_0x1be24f['query']['startTime']);}return db[_0x5dc1('0x58')][_0x5dc1('0x5b')](_0x198c93)['then'](handleEntityNotFound(_0x5fd8ad,null))[_0x5dc1('0x23')](function(_0x19b1cb){if(_0x19b1cb){_0x16cdd8=_0x19b1cb;return db[_0x5dc1('0x66')][_0x5dc1('0x5b')]({'where':{'SessionId':{'$in':_['map'](_0x16cdd8,'id')},'ProjectId':_0x1be24f['params']['id']},'order':_0x5dc1('0x67')});}})[_0x5dc1('0x23')](handleEntityNotFound(_0x5fd8ad,null))[_0x5dc1('0x23')](function(_0x470556){if(_0x470556){_0x586fea=_0x470556;var _0x2adf48={};for(var _0x2adeed=0x0,_0x149737=_0x586fea['length'];_0x2adeed<_0x149737;_0x2adeed++){if(!_0x2adf48[_0x5dc1('0x59')](_0x586fea[_0x2adeed]['questionId'])){_0x2adf48[_0x586fea[_0x2adeed][_0x5dc1('0x68')]]=needsEncapsulation(_0x586fea[_0x2adeed][_0x5dc1('0x69')])?encapsulate(_0x586fea[_0x2adeed][_0x5dc1('0x69')]):_0x586fea[_0x2adeed]['question'];}}var _0x115183=[],_0x48fd80={};for(var _0xbb40de=0x0,_0x5e134b=_0x16cdd8[_0x5dc1('0x38')];_0xbb40de<_0x5e134b;_0xbb40de++){_0x48fd80={'ProjectId':_0x1be24f[_0x5dc1('0x44')]['id'],'SessionId':_0x16cdd8[_0xbb40de]['id'],'StartTime':moment(_0x16cdd8[_0xbb40de][_0x5dc1('0x6a')])[_0x5dc1('0x6b')]('YYYY-MM-DD\x20HH:mm:ss')};for(var _0x39c7a4=0x0,_0x1f869e=_0x586fea[_0x5dc1('0x38')];_0x39c7a4<_0x1f869e;_0x39c7a4++){if(_0x586fea[_0x39c7a4]['SessionId']==_0x16cdd8[_0xbb40de]['id']&&_0x2adf48[_0x5dc1('0x59')](_0x586fea[_0x39c7a4][_0x5dc1('0x68')])){_0x48fd80[_0x2adf48[_0x586fea[_0x39c7a4][_0x5dc1('0x68')]]]=_0x586fea[_0x39c7a4][_0x5dc1('0x6c')];}}for(var _0x2fc39e in _0x2adf48){if(!_0x48fd80['hasOwnProperty'](_0x2adf48[_0x2fc39e])){_0x48fd80[_0x2adf48[_0x2fc39e]]=null;}}_0x115183[_0x5dc1('0x6d')](_0x48fd80);}return _0x115183;}})[_0x5dc1('0x23')](function(_0x32c389){if(!_[_0x5dc1('0x6e')](_0x32c389)){var _0x4623bc=toCsv(_0x32c389);var _0x56d19a=Date['now']();fs['writeFileSync'](util[_0x5dc1('0x6b')](_0x5dc1('0x6f'),_0x1be24f[_0x5dc1('0x44')]['id'],_0x56d19a),_0x4623bc);_0x5fd8ad['setHeader']('Content-disposition',_0x5dc1('0x70')+util[_0x5dc1('0x6b')](_0x5dc1('0x71'),_0x1be24f[_0x5dc1('0x44')]['id'],_0x56d19a));_0x5fd8ad[_0x5dc1('0x72')](_0x5dc1('0x73'),_0x5dc1('0x74'));return _0x5fd8ad[_0x5dc1('0x75')](util[_0x5dc1('0x6b')](_0x5dc1('0x6f'),_0x1be24f[_0x5dc1('0x44')]['id'],_0x56d19a));}else{return _0x5fd8ad['sendStatus'](0xcc);}})[_0x5dc1('0x50')](handleError(_0x5fd8ad,null));}; \ No newline at end of file +var _0x9660=['startTime','JscriptyQuestionReport','-createdAt','questionId','question','SessionId','answer','push','isEmpty','writeFileSync','format','/tmp/Jscripty_Project_%d_Summary_%s.csv','Content-disposition','attachment;\x20filename=','setHeader','Content-type','download','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','reject','save','update','then','Projects','UserProfileResource','destroy','error','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','order','sort','filters','pick','filter','merge','VIRTUAL','options','where','JscriptyProject','includeAll','rows','show','include','find','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','clone','createdAt','updatedAt','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','getSessions','findOne','JscriptySessionReport','nolimit','ProjectId','findAll','getAnswers','JscriptyAnswerReport','fromCharCode','apply','toString','indexOf','replace','parse'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x9660,0x1f1));var _0x0966=function(_0x5904ef,_0x2bf09b){_0x5904ef=_0x5904ef-0x0;var _0x1b0c23=_0x9660[_0x5904ef];return _0x1b0c23;};'use strict';var emlformat=require(_0x0966('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0966('0x1'));var jsonpatch=require(_0x0966('0x2'));var rp=require(_0x0966('0x3'));var moment=require('moment');var BPromise=require(_0x0966('0x4'));var Mustache=require(_0x0966('0x5'));var util=require(_0x0966('0x6'));var path=require(_0x0966('0x7'));var sox=require(_0x0966('0x8'));var csv=require('to-csv');var ejs=require(_0x0966('0x9'));var fs=require('fs');var fs_extra=require(_0x0966('0xa'));var _=require(_0x0966('0xb'));var squel=require(_0x0966('0xc'));var crypto=require(_0x0966('0xd'));var jsforce=require(_0x0966('0xe'));var deskjs=require(_0x0966('0xf'));var toCsv=require('to-csv');var querystring=require(_0x0966('0x10'));var Papa=require(_0x0966('0x11'));var Redis=require(_0x0966('0x12'));var authService=require(_0x0966('0x13'));var qs=require(_0x0966('0x14'));var as=require(_0x0966('0x15'));var hardwareService=require(_0x0966('0x16'));var logger=require(_0x0966('0x17'))(_0x0966('0x18'));var utils=require(_0x0966('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x0966('0x1a'));var db=require(_0x0966('0x1b'))['db'];function respondWithStatusCode(_0x31717f,_0x4a56de){_0x4a56de=_0x4a56de||0xcc;return function(_0x4a778e){if(_0x4a778e){return _0x31717f[_0x0966('0x1c')](_0x4a56de);}return _0x31717f[_0x0966('0x1d')](_0x4a56de)[_0x0966('0x1e')]();};}function respondWithResult(_0x310bdc,_0x394a46){_0x394a46=_0x394a46||0xc8;return function(_0x275615){if(_0x275615){return _0x310bdc['status'](_0x394a46)[_0x0966('0x1f')](_0x275615);}};}function respondWithFilteredResult(_0x5df356,_0x4f9ad1){return function(_0x30620c){if(_0x30620c){var _0x2c6986=typeof _0x4f9ad1[_0x0966('0x20')]===_0x0966('0x21')&&typeof _0x4f9ad1['limit']===_0x0966('0x21');var _0x12ea6c=_0x30620c[_0x0966('0x22')];var _0x3108c1=_0x2c6986?0x0:_0x4f9ad1[_0x0966('0x20')];var _0x5443ed=_0x2c6986?_0x30620c['count']:_0x4f9ad1[_0x0966('0x20')]+_0x4f9ad1[_0x0966('0x23')];var _0x826319;if(_0x5443ed>=_0x12ea6c){_0x5443ed=_0x12ea6c;_0x826319=0xc8;}else{_0x826319=0xce;}_0x5df356['status'](_0x826319);return _0x5df356['set']('Content-Range',_0x3108c1+'-'+_0x5443ed+'/'+_0x12ea6c)[_0x0966('0x1f')](_0x30620c);}return null;};}function patchUpdates(_0x1ae53c){return function(_0x7643d6){try{jsonpatch['apply'](_0x7643d6,_0x1ae53c,!![]);}catch(_0x1451b6){return BPromise[_0x0966('0x24')](_0x1451b6);}return _0x7643d6[_0x0966('0x25')]();};}function saveUpdates(_0x132c01,_0x726342){return function(_0x29c15b){if(_0x29c15b){return _0x29c15b[_0x0966('0x26')](_0x132c01)[_0x0966('0x27')](function(_0x43c018){return _0x43c018;});}return null;};}function removeEntity(_0x2df406,_0x876013){return function(_0x191945){if(_0x191945){return _0x191945['destroy']()[_0x0966('0x27')](function(){var _0x517669=_0x191945['get']({'plain':!![]});var _0x2074d1=_0x0966('0x28');return db[_0x0966('0x29')][_0x0966('0x2a')]({'where':{'type':_0x2074d1,'resourceId':_0x517669['id']}})[_0x0966('0x27')](function(){return _0x191945;});})['then'](function(){_0x2df406[_0x0966('0x1d')](0xcc)[_0x0966('0x1e')]();});}};}function handleEntityNotFound(_0x43dd51,_0x1b469f){return function(_0x283f48){if(!_0x283f48){_0x43dd51[_0x0966('0x1c')](0x194);}return _0x283f48;};}function handleError(_0x4f117a,_0x3c335e){_0x3c335e=_0x3c335e||0x1f4;return function(_0x499699){logger[_0x0966('0x2b')](_0x499699['stack']);if(_0x499699[_0x0966('0x2c')]){delete _0x499699[_0x0966('0x2c')];}_0x4f117a[_0x0966('0x1d')](_0x3c335e)[_0x0966('0x2d')](_0x499699);};}exports[_0x0966('0x2e')]=function(_0xebb886,_0x5437fa){var _0x52f121={},_0x504075={},_0x55a905={'count':0x0,'rows':[]};var _0x465df1=_[_0x0966('0x2f')](db['JscriptyProject'][_0x0966('0x30')],function(_0x34921e){return{'name':_0x34921e[_0x0966('0x31')],'type':_0x34921e[_0x0966('0x32')]['key']};});_0x504075[_0x0966('0x33')]=_['map'](_0x465df1,'name');_0x504075[_0x0966('0x34')]=_[_0x0966('0x35')](_0xebb886['query']);_0x504075['filters']=_['intersection'](_0x504075[_0x0966('0x33')],_0x504075['query']);_0x52f121[_0x0966('0x36')]=_[_0x0966('0x37')](_0x504075[_0x0966('0x33')],qs[_0x0966('0x38')](_0xebb886['query']['fields']));_0x52f121[_0x0966('0x36')]=_0x52f121[_0x0966('0x36')][_0x0966('0x39')]?_0x52f121[_0x0966('0x36')]:_0x504075[_0x0966('0x33')];if(!_0xebb886['query'][_0x0966('0x3a')]('nolimit')){_0x52f121[_0x0966('0x23')]=qs[_0x0966('0x23')](_0xebb886['query']['limit']);_0x52f121[_0x0966('0x20')]=qs[_0x0966('0x20')](_0xebb886[_0x0966('0x34')][_0x0966('0x20')]);}_0x52f121[_0x0966('0x3b')]=qs[_0x0966('0x3c')](_0xebb886[_0x0966('0x34')][_0x0966('0x3c')]);_0x52f121['where']=qs[_0x0966('0x3d')](_[_0x0966('0x3e')](_0xebb886['query'],_0x504075[_0x0966('0x3d')]),_0x465df1);if(_0xebb886[_0x0966('0x34')][_0x0966('0x3f')]){_0x52f121['where']=_[_0x0966('0x40')](_0x52f121['where'],{'$or':_[_0x0966('0x2f')](_0x465df1,function(_0x49999e){if(_0x49999e[_0x0966('0x32')]!==_0x0966('0x41')){var _0x4f2a65={};_0x4f2a65[_0x49999e[_0x0966('0x2c')]]={'$like':'%'+_0xebb886[_0x0966('0x34')][_0x0966('0x3f')]+'%'};return _0x4f2a65;}})});}_0x52f121=_[_0x0966('0x40')]({},_0x52f121,_0xebb886[_0x0966('0x42')]);var _0x35a883={'where':_0x52f121[_0x0966('0x43')]};return db[_0x0966('0x44')]['count'](_0x35a883)[_0x0966('0x27')](function(_0x1aab28){_0x55a905[_0x0966('0x22')]=_0x1aab28;if(_0xebb886[_0x0966('0x34')][_0x0966('0x45')]){_0x52f121['include']=[{'all':!![]}];}return db[_0x0966('0x44')]['findAll'](_0x52f121);})['then'](function(_0x75fac9){_0x55a905[_0x0966('0x46')]=_0x75fac9;return _0x55a905;})[_0x0966('0x27')](respondWithFilteredResult(_0x5437fa,_0x52f121))['catch'](handleError(_0x5437fa,null));};exports[_0x0966('0x47')]=function(_0x5e37f7,_0x29b792){var _0x23a7e4={'raw':![],'where':{'id':_0x5e37f7['params']['id']}},_0xe84c98={};_0xe84c98[_0x0966('0x33')]=_[_0x0966('0x35')](db[_0x0966('0x44')][_0x0966('0x30')]);_0xe84c98[_0x0966('0x34')]=_[_0x0966('0x35')](_0x5e37f7['query']);_0xe84c98['filters']=_[_0x0966('0x37')](_0xe84c98[_0x0966('0x33')],_0xe84c98[_0x0966('0x34')]);_0x23a7e4[_0x0966('0x36')]=_[_0x0966('0x37')](_0xe84c98[_0x0966('0x33')],qs[_0x0966('0x38')](_0x5e37f7[_0x0966('0x34')]['fields']));_0x23a7e4[_0x0966('0x36')]=_0x23a7e4[_0x0966('0x36')][_0x0966('0x39')]?_0x23a7e4[_0x0966('0x36')]:_0xe84c98[_0x0966('0x33')];if(_0x5e37f7[_0x0966('0x34')][_0x0966('0x45')]){_0x23a7e4[_0x0966('0x48')]=[{'all':!![]}];}_0x23a7e4=_[_0x0966('0x40')]({},_0x23a7e4,_0x5e37f7['options']);return db['JscriptyProject'][_0x0966('0x49')](_0x23a7e4)['then'](handleEntityNotFound(_0x29b792,null))[_0x0966('0x27')](respondWithResult(_0x29b792,null))[_0x0966('0x4a')](handleError(_0x29b792,null));};exports[_0x0966('0x4b')]=function(_0x53a648,_0x51bdd5){return db[_0x0966('0x44')][_0x0966('0x4b')](_0x53a648[_0x0966('0x4c')],{})[_0x0966('0x27')](function(_0x36bea6){var _0x473cd0=_0x53a648[_0x0966('0x4d')][_0x0966('0x4e')]({'plain':!![]});if(!_0x473cd0)throw new Error(_0x0966('0x4f'));if(_0x473cd0['role']===_0x0966('0x4d')){var _0x55e490=_0x36bea6[_0x0966('0x4e')]({'plain':!![]});var _0x2dcdd1=_0x0966('0x28');return db[_0x0966('0x50')][_0x0966('0x49')]({'where':{'name':_0x2dcdd1,'userProfileId':_0x473cd0['userProfileId']},'raw':!![]})[_0x0966('0x27')](function(_0x16f9af){if(_0x16f9af&&_0x16f9af['autoAssociation']===0x0){return db[_0x0966('0x29')][_0x0966('0x4b')]({'name':_0x55e490[_0x0966('0x2c')],'resourceId':_0x55e490['id'],'type':_0x16f9af[_0x0966('0x2c')],'sectionId':_0x16f9af['id']},{})[_0x0966('0x27')](function(){return _0x36bea6;});}else{return _0x36bea6;}})['catch'](function(_0x10844c){logger[_0x0966('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x10844c);throw _0x10844c;});}return _0x36bea6;})[_0x0966('0x27')](respondWithResult(_0x51bdd5,0xc9))['catch'](handleError(_0x51bdd5,null));};exports[_0x0966('0x51')]=function(_0x129efc,_0x6eec41){var _0x1e638a={'where':{'id':_0x129efc['params']['id']}},_0x15b27a={};_0x15b27a[_0x0966('0x33')]=_[_0x0966('0x35')](db[_0x0966('0x44')][_0x0966('0x30')]);_0x1e638a[_0x0966('0x36')]=_['intersection'](_0x15b27a['model'],qs['fields'](_0x129efc['query'][_0x0966('0x38')]));_0x1e638a[_0x0966('0x36')]=_0x1e638a[_0x0966('0x36')][_0x0966('0x39')]?_0x1e638a[_0x0966('0x36')]:_0x15b27a[_0x0966('0x33')];if(_0x129efc[_0x0966('0x34')][_0x0966('0x45')]){_0x1e638a[_0x0966('0x48')]=[{'all':!![]}];}_0x1e638a=_[_0x0966('0x40')]({},_0x1e638a,_0x129efc[_0x0966('0x42')]);return db[_0x0966('0x44')][_0x0966('0x49')](_0x1e638a)[_0x0966('0x27')](handleEntityNotFound(_0x6eec41,null))['then'](function(_0x20426b){if(_0x20426b){var _0x3da8fc=_0x20426b[_0x0966('0x4e')]({'plain':!![]});_0x3da8fc=qs['omit'](_0x3da8fc,['id',_0x0966('0x52'),_0x0966('0x53')]);_0x129efc[_0x0966('0x4c')]=_['omit'](_0x129efc[_0x0966('0x4c')],['id',_0x0966('0x52'),_0x0966('0x53')]);return db[_0x0966('0x44')][_0x0966('0x4b')](_['merge'](_0x3da8fc,_0x129efc[_0x0966('0x4c')]),{'include':_0x129efc['query']['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x5c9c59){var _0x2430c5=_0x129efc[_0x0966('0x4d')][_0x0966('0x4e')]({'plain':!![]});if(!_0x2430c5)throw new Error(_0x0966('0x4f'));if(_0x2430c5[_0x0966('0x54')]===_0x0966('0x4d')){var _0x56e0fc=_0x5c9c59['get']({'plain':!![]});var _0x28d7dc='Projects';return db[_0x0966('0x50')]['find']({'where':{'name':_0x28d7dc,'userProfileId':_0x2430c5[_0x0966('0x55')]},'raw':!![]})[_0x0966('0x27')](function(_0x18aa49){if(_0x18aa49&&_0x18aa49[_0x0966('0x56')]===0x0){return db[_0x0966('0x29')][_0x0966('0x4b')]({'name':_0x56e0fc['name'],'resourceId':_0x56e0fc['id'],'type':_0x18aa49[_0x0966('0x2c')],'sectionId':_0x18aa49['id']},{})['then'](function(){return _0x5c9c59;});}else{return _0x5c9c59;}})[_0x0966('0x4a')](function(_0x553fed){logger[_0x0966('0x2b')](_0x0966('0x57'),_0x553fed);throw _0x553fed;});}return _0x5c9c59;});}})[_0x0966('0x27')](respondWithResult(_0x6eec41,0xc9))['catch'](handleError(_0x6eec41,null));};exports['update']=function(_0x5c0d0c,_0x1afa84){if(_0x5c0d0c['body']['id']){delete _0x5c0d0c[_0x0966('0x4c')]['id'];}return db[_0x0966('0x44')]['find']({'where':{'id':_0x5c0d0c[_0x0966('0x58')]['id']}})[_0x0966('0x27')](handleEntityNotFound(_0x1afa84,null))[_0x0966('0x27')](saveUpdates(_0x5c0d0c['body'],null))[_0x0966('0x27')](respondWithResult(_0x1afa84,null))[_0x0966('0x4a')](handleError(_0x1afa84,null));};exports['destroy']=function(_0x3cc66a,_0xa62235){return db[_0x0966('0x44')][_0x0966('0x49')]({'where':{'id':_0x3cc66a[_0x0966('0x58')]['id']}})[_0x0966('0x27')](handleEntityNotFound(_0xa62235,null))[_0x0966('0x27')](removeEntity(_0xa62235,null))[_0x0966('0x4a')](handleError(_0xa62235,null));};exports[_0x0966('0x59')]=function(_0x42d1ec,_0x14c7f3,_0x1ad3be){var _0x2e1a3f={'raw':!![],'where':{}};var _0x3fea2b={};var _0x2d053a={'count':0x0,'rows':[]};return db['JscriptyProject'][_0x0966('0x5a')]({'where':{'id':_0x42d1ec[_0x0966('0x58')]['id']}})[_0x0966('0x27')](handleEntityNotFound(_0x14c7f3,null))[_0x0966('0x27')](function(_0x420021){if(_0x420021){_0x3fea2b[_0x0966('0x33')]=_[_0x0966('0x35')](db[_0x0966('0x5b')]['rawAttributes']);_0x3fea2b[_0x0966('0x34')]=_[_0x0966('0x35')](_0x42d1ec[_0x0966('0x34')]);_0x3fea2b[_0x0966('0x3d')]=_[_0x0966('0x37')](_0x3fea2b['model'],_0x3fea2b[_0x0966('0x34')]);_0x2e1a3f[_0x0966('0x36')]=_['intersection'](_0x3fea2b['model'],qs[_0x0966('0x38')](_0x42d1ec[_0x0966('0x34')][_0x0966('0x38')]));_0x2e1a3f[_0x0966('0x36')]=_0x2e1a3f[_0x0966('0x36')][_0x0966('0x39')]?_0x2e1a3f[_0x0966('0x36')]:_0x3fea2b['model'];if(!_0x42d1ec[_0x0966('0x34')][_0x0966('0x3a')](_0x0966('0x5c'))){_0x2e1a3f[_0x0966('0x23')]=qs['limit'](_0x42d1ec['query'][_0x0966('0x23')]);_0x2e1a3f[_0x0966('0x20')]=qs[_0x0966('0x20')](_0x42d1ec[_0x0966('0x34')][_0x0966('0x20')]);}_0x2e1a3f['order']=qs[_0x0966('0x3c')](_0x42d1ec['query'][_0x0966('0x3c')]);_0x2e1a3f[_0x0966('0x43')]=qs[_0x0966('0x3d')](_[_0x0966('0x3e')](_0x42d1ec[_0x0966('0x34')],_0x3fea2b[_0x0966('0x3d')]));_0x2e1a3f['where'][_0x0966('0x5d')]=_0x420021['id'];if(_0x42d1ec[_0x0966('0x34')]['filter']){_0x2e1a3f[_0x0966('0x43')]=_[_0x0966('0x40')](_0x2e1a3f['where'],{'$or':_[_0x0966('0x2f')](_0x2e1a3f['attributes'],function(_0x1332d8){var _0x2250b6={};_0x2250b6[_0x1332d8]={'$like':'%'+_0x42d1ec[_0x0966('0x34')][_0x0966('0x3f')]+'%'};return _0x2250b6;})});}_0x2e1a3f=_['merge']({},_0x2e1a3f,_0x42d1ec['options']);return db[_0x0966('0x5b')][_0x0966('0x22')]({'where':_0x2e1a3f[_0x0966('0x43')]})[_0x0966('0x27')](function(_0xb552bc){_0x2d053a[_0x0966('0x22')]=_0xb552bc;if(_0x42d1ec['query'][_0x0966('0x45')]){_0x2e1a3f[_0x0966('0x48')]=[{'all':!![]}];}return db[_0x0966('0x5b')][_0x0966('0x5e')](_0x2e1a3f);})['then'](function(_0x5e587e){_0x2d053a[_0x0966('0x46')]=_0x5e587e;return _0x2d053a;});}})[_0x0966('0x27')](respondWithFilteredResult(_0x14c7f3,_0x2e1a3f))[_0x0966('0x4a')](handleError(_0x14c7f3,null));};exports[_0x0966('0x5f')]=function(_0x162d65,_0x39074e,_0x5c07bb){var _0x23af87={'raw':!![],'where':{}};var _0x303069={};var _0x2c7e88={'count':0x0,'rows':[]};return db['JscriptyProject'][_0x0966('0x5a')]({'where':{'id':_0x162d65[_0x0966('0x58')]['id']}})['then'](handleEntityNotFound(_0x39074e,null))[_0x0966('0x27')](function(_0x4c6750){if(_0x4c6750){_0x303069['model']=_[_0x0966('0x35')](db[_0x0966('0x60')][_0x0966('0x30')]);_0x303069[_0x0966('0x34')]=_['keys'](_0x162d65[_0x0966('0x34')]);_0x303069[_0x0966('0x3d')]=_[_0x0966('0x37')](_0x303069[_0x0966('0x33')],_0x303069[_0x0966('0x34')]);_0x23af87['attributes']=_[_0x0966('0x37')](_0x303069['model'],qs[_0x0966('0x38')](_0x162d65[_0x0966('0x34')][_0x0966('0x38')]));_0x23af87[_0x0966('0x36')]=_0x23af87['attributes'][_0x0966('0x39')]?_0x23af87['attributes']:_0x303069[_0x0966('0x33')];if(!_0x162d65[_0x0966('0x34')]['hasOwnProperty'](_0x0966('0x5c'))){_0x23af87[_0x0966('0x23')]=qs[_0x0966('0x23')](_0x162d65['query'][_0x0966('0x23')]);_0x23af87[_0x0966('0x20')]=qs[_0x0966('0x20')](_0x162d65[_0x0966('0x34')][_0x0966('0x20')]);}_0x23af87['order']=qs[_0x0966('0x3c')](_0x162d65[_0x0966('0x34')][_0x0966('0x3c')]);_0x23af87[_0x0966('0x43')]=qs[_0x0966('0x3d')](_[_0x0966('0x3e')](_0x162d65['query'],_0x303069[_0x0966('0x3d')]));_0x23af87[_0x0966('0x43')][_0x0966('0x5d')]=_0x4c6750['id'];if(_0x162d65['query'][_0x0966('0x3f')]){_0x23af87['where']=_[_0x0966('0x40')](_0x23af87['where'],{'$or':_['map'](_0x23af87[_0x0966('0x36')],function(_0x2f23e0){var _0xd7d61b={};_0xd7d61b[_0x2f23e0]={'$like':'%'+_0x162d65[_0x0966('0x34')][_0x0966('0x3f')]+'%'};return _0xd7d61b;})});}_0x23af87=_[_0x0966('0x40')]({},_0x23af87,_0x162d65[_0x0966('0x42')]);return db[_0x0966('0x60')]['count']({'where':_0x23af87[_0x0966('0x43')]})[_0x0966('0x27')](function(_0x5ee331){_0x2c7e88[_0x0966('0x22')]=_0x5ee331;if(_0x162d65[_0x0966('0x34')][_0x0966('0x45')]){_0x23af87[_0x0966('0x48')]=[{'all':!![]}];}return db[_0x0966('0x60')][_0x0966('0x5e')](_0x23af87);})[_0x0966('0x27')](function(_0x55be6e){_0x2c7e88[_0x0966('0x46')]=_0x55be6e;return _0x2c7e88;});}})[_0x0966('0x27')](respondWithFilteredResult(_0x39074e,_0x23af87))[_0x0966('0x4a')](handleError(_0x39074e,null));};function char(_0x2b5124){return'number'===typeof _0x2b5124?String[_0x0966('0x61')][_0x0966('0x62')](null,arguments):_0x2b5124;}function needsEncapsulation(_0x5e9c0b){return!!_0x5e9c0b&&(_0x5e9c0b[_0x0966('0x63')]()[_0x0966('0x64')](char(0xd))>=0x0||_0x5e9c0b[_0x0966('0x63')]()[_0x0966('0x64')](char(0xa))>=0x0||_0x5e9c0b[_0x0966('0x63')]()[_0x0966('0x64')](char(0x2c))>=0x0||_0x5e9c0b[_0x0966('0x63')]()[_0x0966('0x64')](char(0x22))>=0x0);}function encapsulate(_0xd69d57){var _0x53ab0f=char(0x22),_0x2f7e7c='\x5c'+char(0x22),_0xc18890=_0xd69d57[_0x0966('0x63')]()[_0x0966('0x65')](new RegExp(_0x53ab0f,'g'),_0x2f7e7c);return _0x53ab0f+_0xc18890+_0x53ab0f;}exports['getSummary']=function(_0x2ca519,_0x4935ca,_0x3ab3d6){var _0x4ffcbf,_0x4b66d7;var _0x447592={'where':{'ProjectId':_0x2ca519[_0x0966('0x58')]['id']}};if(_0x2ca519[_0x0966('0x34')]['startTime']){_0x447592[_0x0966('0x43')]['starttime']=JSON[_0x0966('0x66')](_0x2ca519[_0x0966('0x34')][_0x0966('0x67')]);}return db['JscriptySessionReport']['findAll'](_0x447592)['then'](handleEntityNotFound(_0x4935ca,null))[_0x0966('0x27')](function(_0x372967){if(_0x372967){_0x4ffcbf=_0x372967;return db[_0x0966('0x68')][_0x0966('0x5e')]({'where':{'SessionId':{'$in':_[_0x0966('0x2f')](_0x4ffcbf,'id')},'ProjectId':_0x2ca519['params']['id']},'order':_0x0966('0x69')});}})['then'](handleEntityNotFound(_0x4935ca,null))[_0x0966('0x27')](function(_0xe7a174){if(_0xe7a174){_0x4b66d7=_0xe7a174;var _0x26da74={};for(var _0x5c6472=0x0,_0x176d7b=_0x4b66d7[_0x0966('0x39')];_0x5c6472<_0x176d7b;_0x5c6472++){if(!_0x26da74[_0x0966('0x3a')](_0x4b66d7[_0x5c6472][_0x0966('0x6a')])){_0x26da74[_0x4b66d7[_0x5c6472][_0x0966('0x6a')]]=needsEncapsulation(_0x4b66d7[_0x5c6472]['question'])?encapsulate(_0x4b66d7[_0x5c6472][_0x0966('0x6b')]):_0x4b66d7[_0x5c6472][_0x0966('0x6b')];}}var _0x4ba881=[],_0x2eba47={};for(var _0x4adab6=0x0,_0x662ccd=_0x4ffcbf[_0x0966('0x39')];_0x4adab6<_0x662ccd;_0x4adab6++){_0x2eba47={'ProjectId':_0x2ca519[_0x0966('0x58')]['id'],'SessionId':_0x4ffcbf[_0x4adab6]['id'],'StartTime':moment(_0x4ffcbf[_0x4adab6]['starttime'])['format']('YYYY-MM-DD\x20HH:mm:ss')};for(var _0x470af7=0x0,_0x4a215e=_0x4b66d7['length'];_0x470af7<_0x4a215e;_0x470af7++){if(_0x4b66d7[_0x470af7][_0x0966('0x6c')]==_0x4ffcbf[_0x4adab6]['id']&&_0x26da74[_0x0966('0x3a')](_0x4b66d7[_0x470af7]['questionId'])){_0x2eba47[_0x26da74[_0x4b66d7[_0x470af7]['questionId']]]=_0x4b66d7[_0x470af7][_0x0966('0x6d')];}}for(var _0x48848a in _0x26da74){if(!_0x2eba47[_0x0966('0x3a')](_0x26da74[_0x48848a])){_0x2eba47[_0x26da74[_0x48848a]]=null;}}_0x4ba881[_0x0966('0x6e')](_0x2eba47);}return _0x4ba881;}})[_0x0966('0x27')](function(_0x84e97e){if(!_[_0x0966('0x6f')](_0x84e97e)){var _0x25dba9=toCsv(_0x84e97e);var _0x16dfaf=Date['now']();fs[_0x0966('0x70')](util[_0x0966('0x71')](_0x0966('0x72'),_0x2ca519[_0x0966('0x58')]['id'],_0x16dfaf),_0x25dba9);_0x4935ca['setHeader'](_0x0966('0x73'),_0x0966('0x74')+util['format']('Jscripty_Project_%d_Summary_%s.csv',_0x2ca519[_0x0966('0x58')]['id'],_0x16dfaf));_0x4935ca[_0x0966('0x75')](_0x0966('0x76'),'text/csv');return _0x4935ca[_0x0966('0x77')](util['format']('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x2ca519[_0x0966('0x58')]['id'],_0x16dfaf));}else{return _0x4935ca['sendStatus'](0xcc);}})[_0x0966('0x4a')](handleError(_0x4935ca,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index 242a2ca..33e216e 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 _0x9879=['request-promise','path','rimraf','../../config/environment','./jscriptyProject.attributes','exports','define','jscripty_projects','lodash','util','../../config/logger','moment'];(function(_0x1d2f15,_0x1107c6){var _0x19efd2=function(_0x5e7bf7){while(--_0x5e7bf7){_0x1d2f15['push'](_0x1d2f15['shift']());}};_0x19efd2(++_0x1107c6);}(_0x9879,0x98));var _0x9987=function(_0x30fa8d,_0x2c46ed){_0x30fa8d=_0x30fa8d-0x0;var _0x418193=_0x9879[_0x30fa8d];return _0x418193;};'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')]('JscriptyProject',attributes,{'tableName':_0x9987('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x885a=['util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./jscriptyProject.attributes','exports','define','JscriptyProject'];(function(_0x468b0f,_0x408566){var _0x3e74d9=function(_0x27a545){while(--_0x27a545){_0x468b0f['push'](_0x468b0f['shift']());}};_0x3e74d9(++_0x408566);}(_0x885a,0x180));var _0xa885=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x885a[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require('lodash');var util=require(_0xa885('0x0'));var logger=require(_0xa885('0x1'))(_0xa885('0x2'));var moment=require(_0xa885('0x3'));var BPromise=require('bluebird');var rp=require(_0xa885('0x4'));var fs=require('fs');var path=require(_0xa885('0x5'));var rimraf=require(_0xa885('0x6'));var config=require(_0xa885('0x7'));var attributes=require(_0xa885('0x8'));module[_0xa885('0x9')]=function(_0x5dfd7e,_0x7ac6bd){return _0x5dfd7e[_0xa885('0xa')](_0xa885('0xb'),attributes,{'tableName':'jscripty_projects','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 472552e..163776c 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 _0xb43b=['rpc','../../config/environment','http','request','info','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','JscriptyProject,\x20%s,\x20%s','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x560665,_0x106c55){var _0x52fc18=function(_0x26e691){while(--_0x26e691){_0x560665['push'](_0x560665['shift']());}};_0x52fc18(++_0x106c55);}(_0xb43b,0x1b2));var _0xbb43=function(_0x275a7c,_0x311fd9){_0x275a7c=_0x275a7c-0x0;var _0x4b55c1=_0xb43b[_0x275a7c];return _0x4b55c1;};'use strict';var _=require(_0xbb43('0x0'));var util=require(_0xbb43('0x1'));var moment=require('moment');var BPromise=require(_0xbb43('0x2'));var rs=require(_0xbb43('0x3'));var fs=require('fs');var Redis=require(_0xbb43('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xbb43('0x5'));var logger=require(_0xbb43('0x6'))(_0xbb43('0x7'));var config=require(_0xbb43('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xbb43('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x553520,_0x80fe61,_0x1ccd49){return new BPromise(function(_0x2a2f11,_0x29ae1a){return client[_0xbb43('0xa')](_0x553520,_0x1ccd49)['then'](function(_0x208c2b){logger[_0xbb43('0xb')]('JscriptyProject,\x20%s,\x20%s',_0x80fe61,_0xbb43('0xc'));logger[_0xbb43('0xd')](_0xbb43('0xe'),_0x80fe61,_0xbb43('0xc'),JSON[_0xbb43('0xf')](_0x208c2b));if(_0x208c2b[_0xbb43('0x10')]){if(_0x208c2b['error'][_0xbb43('0x11')]===0x1f4){logger[_0xbb43('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x80fe61,_0x208c2b['error'][_0xbb43('0x12')]);return _0x29ae1a(_0x208c2b['error']['message']);}logger[_0xbb43('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x80fe61,_0x208c2b[_0xbb43('0x10')][_0xbb43('0x12')]);return _0x2a2f11(_0x208c2b['error']['message']);}else{logger['info'](_0xbb43('0x13'),_0x80fe61,_0xbb43('0xc'));_0x2a2f11(_0x208c2b['result']['message']);}})[_0xbb43('0x14')](function(_0x563ce1){logger['error'](_0xbb43('0x13'),_0x80fe61,_0x563ce1);_0x29ae1a(_0x563ce1);});});} \ No newline at end of file +var _0xe706=['http','request','then','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\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(_0x5a1c55,_0x282656){var _0x359e0e=function(_0x24d2bc){while(--_0x24d2bc){_0x5a1c55['push'](_0x5a1c55['shift']());}};_0x359e0e(++_0x282656);}(_0xe706,0xa3));var _0x6e70=function(_0x231dda,_0x5b04cc){_0x231dda=_0x231dda-0x0;var _0x3f88cb=_0xe706[_0x231dda];return _0x3f88cb;};'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']('JscriptyProject,\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']('JscriptyProject,\x20%s,\x20%s',_0x293ce7,_0x161f23);_0x3c4843(_0x161f23);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index 6061809..3b8d763 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 _0xd89d=['exports','path','connect-timeout','express','fs-extra','../../components/interaction/service','get','describe','isAuthenticated','show','post','create','put','/:id','update','delete'];(function(_0x1c6ef2,_0x8d926a){var _0x404b8c=function(_0x4fdf1e){while(--_0x4fdf1e){_0x1c6ef2['push'](_0x1c6ef2['shift']());}};_0x404b8c(++_0x8d926a);}(_0xd89d,0x1b1));var _0xdd89=function(_0x13c201,_0x3b8a02){_0x13c201=_0x13c201-0x0;var _0x397fa2=_0xd89d[_0x13c201];return _0x397fa2;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xdd89('0x0'));var timeout=require(_0xdd89('0x1'));var express=require(_0xdd89('0x2'));var router=express['Router']();var fs_extra=require(_0xdd89('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xdd89('0x4'));var config=require('../../config/environment');var controller=require('./jscriptyQuestionReport.controller');router[_0xdd89('0x5')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/describe',auth['isAuthenticated'](),controller[_0xdd89('0x6')]);router['get']('/:id',auth[_0xdd89('0x7')](),controller[_0xdd89('0x8')]);router[_0xdd89('0x9')]('/',auth[_0xdd89('0x7')](),controller[_0xdd89('0xa')]);router[_0xdd89('0xb')](_0xdd89('0xc'),auth[_0xdd89('0x7')](),controller[_0xdd89('0xd')]);router[_0xdd89('0xe')]('/:id',auth[_0xdd89('0x7')](),controller['destroy']);module[_0xdd89('0xf')]=router; \ No newline at end of file +var _0x1da4=['../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','isAuthenticated','index','get','/:id','show','post','put','update','destroy','exports','multer','util','path','connect-timeout','express','fs-extra'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x1da4,0x1da));var _0x41da=function(_0x307ffd,_0x566992){_0x307ffd=_0x307ffd-0x0;var _0x369189=_0x1da4[_0x307ffd];return _0x369189;};'use strict';var multer=require(_0x41da('0x0'));var util=require(_0x41da('0x1'));var path=require(_0x41da('0x2'));var timeout=require(_0x41da('0x3'));var express=require(_0x41da('0x4'));var router=express['Router']();var fs_extra=require(_0x41da('0x5'));var auth=require(_0x41da('0x6'));var interaction=require(_0x41da('0x7'));var config=require(_0x41da('0x8'));var controller=require(_0x41da('0x9'));router['get']('/',auth[_0x41da('0xa')](),controller[_0x41da('0xb')]);router[_0x41da('0xc')]('/describe',auth['isAuthenticated'](),controller['describe']);router['get'](_0x41da('0xd'),auth[_0x41da('0xa')](),controller[_0x41da('0xe')]);router[_0x41da('0xf')]('/',auth[_0x41da('0xa')](),controller['create']);router[_0x41da('0x10')]('/:id',auth[_0x41da('0xa')](),controller[_0x41da('0x11')]);router['delete'](_0x41da('0xd'),auth[_0x41da('0xa')](),controller[_0x41da('0x12')]);module[_0x41da('0x13')]=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index b921815..b558781 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(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x7a54,0x106));var _0x47a5=function(_0x189a4d,_0x1302bc){_0x189a4d=_0x189a4d-0x0;var _0x3ce0be=_0x7a54[_0x189a4d];return _0x3ce0be;};'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(_0x346737,_0x3e6081){var _0x1ade2e=function(_0x15e50e){while(--_0x15e50e){_0x346737['push'](_0x346737['shift']());}};_0x1ade2e(++_0x3e6081);}(_0x7a54,0x106));var _0x47a5=function(_0x3cce50,_0x3ab0d4){_0x3cce50=_0x3cce50-0x0;var _0x287214=_0x7a54[_0x3cce50];return _0x287214;};'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 37bda74..8567378 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 _0x1d63=['merge','VIRTUAL','options','include','findAll','rows','show','params','keys','includeAll','find','catch','create','body','update','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','offset','undefined','limit','count','Content-Range','json','apply','reject','save','destroy','then','end','error','name','send','index','map','JscriptyQuestionReport','rawAttributes','type','model','query','filters','intersection','attributes','fields','length','order','sort','where','filter'];(function(_0x16ad32,_0x4cac16){var _0x35b3d5=function(_0x1d5031){while(--_0x1d5031){_0x16ad32['push'](_0x16ad32['shift']());}};_0x35b3d5(++_0x4cac16);}(_0x1d63,0xa4));var _0x31d6=function(_0x1ed306,_0x43d26e){_0x1ed306=_0x1ed306-0x0;var _0x2128d6=_0x1d63[_0x1ed306];return _0x2128d6;};'use strict';var emlformat=require(_0x31d6('0x0'));var rimraf=require(_0x31d6('0x1'));var zipdir=require(_0x31d6('0x2'));var jsonpatch=require(_0x31d6('0x3'));var rp=require(_0x31d6('0x4'));var moment=require('moment');var BPromise=require(_0x31d6('0x5'));var Mustache=require(_0x31d6('0x6'));var util=require(_0x31d6('0x7'));var path=require(_0x31d6('0x8'));var sox=require(_0x31d6('0x9'));var csv=require(_0x31d6('0xa'));var ejs=require(_0x31d6('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x31d6('0xc'));var squel=require(_0x31d6('0xd'));var crypto=require('crypto');var jsforce=require(_0x31d6('0xe'));var deskjs=require(_0x31d6('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x31d6('0x10'));var authService=require(_0x31d6('0x11'));var qs=require(_0x31d6('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x31d6('0x13'));var logger=require(_0x31d6('0x14'))(_0x31d6('0x15'));var utils=require(_0x31d6('0x16'));var config=require(_0x31d6('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x31d6('0x18'))['db'];function respondWithStatusCode(_0x935b4f,_0x267f2b){_0x267f2b=_0x267f2b||0xcc;return function(_0x4639b8){if(_0x4639b8){return _0x935b4f[_0x31d6('0x19')](_0x267f2b);}return _0x935b4f[_0x31d6('0x1a')](_0x267f2b)['end']();};}function respondWithResult(_0x45dfa1,_0x218463){_0x218463=_0x218463||0xc8;return function(_0x6365a8){if(_0x6365a8){return _0x45dfa1[_0x31d6('0x1a')](_0x218463)['json'](_0x6365a8);}};}function respondWithFilteredResult(_0x3c047b,_0x5614f5){return function(_0x3d1f67){if(_0x3d1f67){var _0x2dc606=typeof _0x5614f5[_0x31d6('0x1b')]===_0x31d6('0x1c')&&typeof _0x5614f5[_0x31d6('0x1d')]===_0x31d6('0x1c');var _0x4c376d=_0x3d1f67[_0x31d6('0x1e')];var _0x403ef4=_0x2dc606?0x0:_0x5614f5[_0x31d6('0x1b')];var _0x2f9f43=_0x2dc606?_0x3d1f67[_0x31d6('0x1e')]:_0x5614f5[_0x31d6('0x1b')]+_0x5614f5['limit'];var _0x3ea416;if(_0x2f9f43>=_0x4c376d){_0x2f9f43=_0x4c376d;_0x3ea416=0xc8;}else{_0x3ea416=0xce;}_0x3c047b['status'](_0x3ea416);return _0x3c047b['set'](_0x31d6('0x1f'),_0x403ef4+'-'+_0x2f9f43+'/'+_0x4c376d)[_0x31d6('0x20')](_0x3d1f67);}return null;};}function patchUpdates(_0x442145){return function(_0x83749e){try{jsonpatch[_0x31d6('0x21')](_0x83749e,_0x442145,!![]);}catch(_0xbb17c5){return BPromise[_0x31d6('0x22')](_0xbb17c5);}return _0x83749e[_0x31d6('0x23')]();};}function saveUpdates(_0x2eef78,_0x5d3e78){return function(_0x468b7d){if(_0x468b7d){return _0x468b7d['update'](_0x2eef78)['then'](function(_0x405ae6){return _0x405ae6;});}return null;};}function removeEntity(_0x348eeb,_0x46b843){return function(_0x4b836f){if(_0x4b836f){return _0x4b836f[_0x31d6('0x24')]()[_0x31d6('0x25')](function(){_0x348eeb[_0x31d6('0x1a')](0xcc)[_0x31d6('0x26')]();});}};}function handleEntityNotFound(_0x2552e0,_0x219169){return function(_0x3caa07){if(!_0x3caa07){_0x2552e0[_0x31d6('0x19')](0x194);}return _0x3caa07;};}function handleError(_0x2c2bc3,_0x17a54f){_0x17a54f=_0x17a54f||0x1f4;return function(_0x496902){logger[_0x31d6('0x27')](_0x496902['stack']);if(_0x496902['name']){delete _0x496902[_0x31d6('0x28')];}_0x2c2bc3['status'](_0x17a54f)[_0x31d6('0x29')](_0x496902);};}exports[_0x31d6('0x2a')]=function(_0x129d12,_0x22f68c){var _0x151679={},_0x1d1539={},_0x2f8087={'count':0x0,'rows':[]};var _0x55b01e=_[_0x31d6('0x2b')](db[_0x31d6('0x2c')][_0x31d6('0x2d')],function(_0x30ec61){return{'name':_0x30ec61['fieldName'],'type':_0x30ec61[_0x31d6('0x2e')]['key']};});_0x1d1539[_0x31d6('0x2f')]=_[_0x31d6('0x2b')](_0x55b01e,_0x31d6('0x28'));_0x1d1539[_0x31d6('0x30')]=_['keys'](_0x129d12['query']);_0x1d1539[_0x31d6('0x31')]=_[_0x31d6('0x32')](_0x1d1539[_0x31d6('0x2f')],_0x1d1539[_0x31d6('0x30')]);_0x151679[_0x31d6('0x33')]=_['intersection'](_0x1d1539['model'],qs[_0x31d6('0x34')](_0x129d12[_0x31d6('0x30')][_0x31d6('0x34')]));_0x151679['attributes']=_0x151679[_0x31d6('0x33')][_0x31d6('0x35')]?_0x151679['attributes']:_0x1d1539[_0x31d6('0x2f')];if(!_0x129d12[_0x31d6('0x30')]['hasOwnProperty']('nolimit')){_0x151679[_0x31d6('0x1d')]=qs[_0x31d6('0x1d')](_0x129d12[_0x31d6('0x30')][_0x31d6('0x1d')]);_0x151679[_0x31d6('0x1b')]=qs[_0x31d6('0x1b')](_0x129d12[_0x31d6('0x30')][_0x31d6('0x1b')]);}_0x151679[_0x31d6('0x36')]=qs['sort'](_0x129d12[_0x31d6('0x30')][_0x31d6('0x37')]);_0x151679[_0x31d6('0x38')]=qs[_0x31d6('0x31')](_['pick'](_0x129d12[_0x31d6('0x30')],_0x1d1539['filters']),_0x55b01e);if(_0x129d12[_0x31d6('0x30')][_0x31d6('0x39')]){_0x151679[_0x31d6('0x38')]=_[_0x31d6('0x3a')](_0x151679[_0x31d6('0x38')],{'$or':_[_0x31d6('0x2b')](_0x55b01e,function(_0x2a8053){if(_0x2a8053[_0x31d6('0x2e')]!==_0x31d6('0x3b')){var _0xed2655={};_0xed2655[_0x2a8053[_0x31d6('0x28')]]={'$like':'%'+_0x129d12[_0x31d6('0x30')][_0x31d6('0x39')]+'%'};return _0xed2655;}})});}_0x151679=_[_0x31d6('0x3a')]({},_0x151679,_0x129d12[_0x31d6('0x3c')]);var _0x13c194={'where':_0x151679['where']};return db[_0x31d6('0x2c')][_0x31d6('0x1e')](_0x13c194)[_0x31d6('0x25')](function(_0x33f62c){_0x2f8087[_0x31d6('0x1e')]=_0x33f62c;if(_0x129d12[_0x31d6('0x30')]['includeAll']){_0x151679[_0x31d6('0x3d')]=[{'all':!![]}];}return db[_0x31d6('0x2c')][_0x31d6('0x3e')](_0x151679);})['then'](function(_0x1e7c20){_0x2f8087[_0x31d6('0x3f')]=_0x1e7c20;return _0x2f8087;})[_0x31d6('0x25')](respondWithFilteredResult(_0x22f68c,_0x151679))['catch'](handleError(_0x22f68c,null));};exports[_0x31d6('0x40')]=function(_0x33db6e,_0x4949d6){var _0x4cda9a={'raw':!![],'where':{'id':_0x33db6e[_0x31d6('0x41')]['id']}},_0x536822={};_0x536822['model']=_['keys'](db['JscriptyQuestionReport']['rawAttributes']);_0x536822[_0x31d6('0x30')]=_[_0x31d6('0x42')](_0x33db6e[_0x31d6('0x30')]);_0x536822[_0x31d6('0x31')]=_[_0x31d6('0x32')](_0x536822[_0x31d6('0x2f')],_0x536822[_0x31d6('0x30')]);_0x4cda9a[_0x31d6('0x33')]=_[_0x31d6('0x32')](_0x536822[_0x31d6('0x2f')],qs[_0x31d6('0x34')](_0x33db6e[_0x31d6('0x30')][_0x31d6('0x34')]));_0x4cda9a[_0x31d6('0x33')]=_0x4cda9a[_0x31d6('0x33')][_0x31d6('0x35')]?_0x4cda9a[_0x31d6('0x33')]:_0x536822[_0x31d6('0x2f')];if(_0x33db6e[_0x31d6('0x30')][_0x31d6('0x43')]){_0x4cda9a[_0x31d6('0x3d')]=[{'all':!![]}];}_0x4cda9a=_['merge']({},_0x4cda9a,_0x33db6e[_0x31d6('0x3c')]);return db[_0x31d6('0x2c')][_0x31d6('0x44')](_0x4cda9a)[_0x31d6('0x25')](handleEntityNotFound(_0x4949d6,null))[_0x31d6('0x25')](respondWithResult(_0x4949d6,null))[_0x31d6('0x45')](handleError(_0x4949d6,null));};exports[_0x31d6('0x46')]=function(_0x3471ff,_0x322d00){return db['JscriptyQuestionReport'][_0x31d6('0x46')](_0x3471ff[_0x31d6('0x47')],{})['then'](respondWithResult(_0x322d00,0xc9))[_0x31d6('0x45')](handleError(_0x322d00,null));};exports[_0x31d6('0x48')]=function(_0x5c584c,_0x501264){if(_0x5c584c['body']['id']){delete _0x5c584c['body']['id'];}return db['JscriptyQuestionReport'][_0x31d6('0x44')]({'where':{'id':_0x5c584c[_0x31d6('0x41')]['id']}})[_0x31d6('0x25')](handleEntityNotFound(_0x501264,null))[_0x31d6('0x25')](saveUpdates(_0x5c584c[_0x31d6('0x47')],null))[_0x31d6('0x25')](respondWithResult(_0x501264,null))['catch'](handleError(_0x501264,null));};exports[_0x31d6('0x24')]=function(_0xb7a938,_0x6cffa3){return db['JscriptyQuestionReport']['find']({'where':{'id':_0xb7a938[_0x31d6('0x41')]['id']}})[_0x31d6('0x25')](handleEntityNotFound(_0x6cffa3,null))['then'](removeEntity(_0x6cffa3,null))['catch'](handleError(_0x6cffa3,null));};exports[_0x31d6('0x49')]=function(_0x2f9138,_0x10eb3b){return db['JscriptyQuestionReport'][_0x31d6('0x49')]()['then'](respondWithResult(_0x10eb3b,null))[_0x31d6('0x45')](handleError(_0x10eb3b,null));}; \ No newline at end of file +var _0xc8d8=['sendStatus','status','end','json','undefined','limit','offset','count','set','reject','update','then','destroy','error','stack','name','index','map','fieldName','type','key','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','keys','JscriptyQuestionReport','rawAttributes','include','find','create','body','params','describe','rimraf','fast-json-patch','moment','bluebird','mustache','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb'];(function(_0x18b544,_0x3b35fd){var _0x294201=function(_0x1c4cbd){while(--_0x1c4cbd){_0x18b544['push'](_0x18b544['shift']());}};_0x294201(++_0x3b35fd);}(_0xc8d8,0x112));var _0x8c8d=function(_0x533db2,_0x5613ba){_0x533db2=_0x533db2-0x0;var _0x9e98f9=_0xc8d8[_0x533db2];return _0x9e98f9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8c8d('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8c8d('0x1'));var rp=require('request-promise');var moment=require(_0x8c8d('0x2'));var BPromise=require(_0x8c8d('0x3'));var Mustache=require(_0x8c8d('0x4'));var util=require('util');var path=require('path');var sox=require(_0x8c8d('0x5'));var csv=require(_0x8c8d('0x6'));var ejs=require(_0x8c8d('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8c8d('0x8'));var squel=require(_0x8c8d('0x9'));var crypto=require('crypto');var jsforce=require(_0x8c8d('0xa'));var deskjs=require(_0x8c8d('0xb'));var toCsv=require('to-csv');var querystring=require(_0x8c8d('0xc'));var Papa=require(_0x8c8d('0xd'));var Redis=require(_0x8c8d('0xe'));var authService=require(_0x8c8d('0xf'));var qs=require(_0x8c8d('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8c8d('0x11'));var logger=require(_0x8c8d('0x12'))('api');var utils=require(_0x8c8d('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x8c8d('0x14'));var db=require(_0x8c8d('0x15'))['db'];function respondWithStatusCode(_0x258db7,_0x558694){_0x558694=_0x558694||0xcc;return function(_0x20fad9){if(_0x20fad9){return _0x258db7[_0x8c8d('0x16')](_0x558694);}return _0x258db7[_0x8c8d('0x17')](_0x558694)[_0x8c8d('0x18')]();};}function respondWithResult(_0x4808a2,_0x6dc588){_0x6dc588=_0x6dc588||0xc8;return function(_0x45ef10){if(_0x45ef10){return _0x4808a2[_0x8c8d('0x17')](_0x6dc588)[_0x8c8d('0x19')](_0x45ef10);}};}function respondWithFilteredResult(_0xfa36e4,_0x3576ab){return function(_0x2ebc87){if(_0x2ebc87){var _0xff5421=typeof _0x3576ab['offset']===_0x8c8d('0x1a')&&typeof _0x3576ab[_0x8c8d('0x1b')]===_0x8c8d('0x1a');var _0x550bb9=_0x2ebc87['count'];var _0x516dee=_0xff5421?0x0:_0x3576ab[_0x8c8d('0x1c')];var _0x557d6e=_0xff5421?_0x2ebc87[_0x8c8d('0x1d')]:_0x3576ab[_0x8c8d('0x1c')]+_0x3576ab[_0x8c8d('0x1b')];var _0xa8f549;if(_0x557d6e>=_0x550bb9){_0x557d6e=_0x550bb9;_0xa8f549=0xc8;}else{_0xa8f549=0xce;}_0xfa36e4[_0x8c8d('0x17')](_0xa8f549);return _0xfa36e4[_0x8c8d('0x1e')]('Content-Range',_0x516dee+'-'+_0x557d6e+'/'+_0x550bb9)[_0x8c8d('0x19')](_0x2ebc87);}return null;};}function patchUpdates(_0x4da330){return function(_0x547a1a){try{jsonpatch['apply'](_0x547a1a,_0x4da330,!![]);}catch(_0x36916c){return BPromise[_0x8c8d('0x1f')](_0x36916c);}return _0x547a1a['save']();};}function saveUpdates(_0x294196,_0x527ad3){return function(_0x2d040f){if(_0x2d040f){return _0x2d040f[_0x8c8d('0x20')](_0x294196)[_0x8c8d('0x21')](function(_0x86378e){return _0x86378e;});}return null;};}function removeEntity(_0x2dbfea,_0x581287){return function(_0x1a6e8a){if(_0x1a6e8a){return _0x1a6e8a[_0x8c8d('0x22')]()[_0x8c8d('0x21')](function(){_0x2dbfea['status'](0xcc)[_0x8c8d('0x18')]();});}};}function handleEntityNotFound(_0x15e5a2,_0x3214e2){return function(_0x193871){if(!_0x193871){_0x15e5a2[_0x8c8d('0x16')](0x194);}return _0x193871;};}function handleError(_0x2b37d2,_0xca9451){_0xca9451=_0xca9451||0x1f4;return function(_0x432228){logger[_0x8c8d('0x23')](_0x432228[_0x8c8d('0x24')]);if(_0x432228[_0x8c8d('0x25')]){delete _0x432228[_0x8c8d('0x25')];}_0x2b37d2[_0x8c8d('0x17')](_0xca9451)['send'](_0x432228);};}exports[_0x8c8d('0x26')]=function(_0x4e181e,_0x2bd0a4){var _0x32d210={},_0x22b437={},_0x14e3b7={'count':0x0,'rows':[]};var _0x3e73b4=_[_0x8c8d('0x27')](db['JscriptyQuestionReport']['rawAttributes'],function(_0x1e86b2){return{'name':_0x1e86b2[_0x8c8d('0x28')],'type':_0x1e86b2[_0x8c8d('0x29')][_0x8c8d('0x2a')]};});_0x22b437[_0x8c8d('0x2b')]=_[_0x8c8d('0x27')](_0x3e73b4,_0x8c8d('0x25'));_0x22b437[_0x8c8d('0x2c')]=_['keys'](_0x4e181e[_0x8c8d('0x2c')]);_0x22b437['filters']=_[_0x8c8d('0x2d')](_0x22b437[_0x8c8d('0x2b')],_0x22b437['query']);_0x32d210['attributes']=_[_0x8c8d('0x2d')](_0x22b437[_0x8c8d('0x2b')],qs['fields'](_0x4e181e[_0x8c8d('0x2c')][_0x8c8d('0x2e')]));_0x32d210[_0x8c8d('0x2f')]=_0x32d210['attributes'][_0x8c8d('0x30')]?_0x32d210[_0x8c8d('0x2f')]:_0x22b437['model'];if(!_0x4e181e['query'][_0x8c8d('0x31')](_0x8c8d('0x32'))){_0x32d210[_0x8c8d('0x1b')]=qs['limit'](_0x4e181e[_0x8c8d('0x2c')][_0x8c8d('0x1b')]);_0x32d210[_0x8c8d('0x1c')]=qs[_0x8c8d('0x1c')](_0x4e181e['query'][_0x8c8d('0x1c')]);}_0x32d210[_0x8c8d('0x33')]=qs[_0x8c8d('0x34')](_0x4e181e['query'][_0x8c8d('0x34')]);_0x32d210[_0x8c8d('0x35')]=qs[_0x8c8d('0x36')](_[_0x8c8d('0x37')](_0x4e181e[_0x8c8d('0x2c')],_0x22b437[_0x8c8d('0x36')]),_0x3e73b4);if(_0x4e181e[_0x8c8d('0x2c')][_0x8c8d('0x38')]){_0x32d210[_0x8c8d('0x35')]=_[_0x8c8d('0x39')](_0x32d210['where'],{'$or':_['map'](_0x3e73b4,function(_0x142b39){if(_0x142b39['type']!==_0x8c8d('0x3a')){var _0x4d24a3={};_0x4d24a3[_0x142b39[_0x8c8d('0x25')]]={'$like':'%'+_0x4e181e[_0x8c8d('0x2c')][_0x8c8d('0x38')]+'%'};return _0x4d24a3;}})});}_0x32d210=_[_0x8c8d('0x39')]({},_0x32d210,_0x4e181e[_0x8c8d('0x3b')]);var _0x4904ac={'where':_0x32d210['where']};return db['JscriptyQuestionReport']['count'](_0x4904ac)[_0x8c8d('0x21')](function(_0x2966b5){_0x14e3b7[_0x8c8d('0x1d')]=_0x2966b5;if(_0x4e181e[_0x8c8d('0x2c')][_0x8c8d('0x3c')]){_0x32d210['include']=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0x8c8d('0x3d')](_0x32d210);})[_0x8c8d('0x21')](function(_0x4a1c2b){_0x14e3b7[_0x8c8d('0x3e')]=_0x4a1c2b;return _0x14e3b7;})[_0x8c8d('0x21')](respondWithFilteredResult(_0x2bd0a4,_0x32d210))[_0x8c8d('0x3f')](handleError(_0x2bd0a4,null));};exports[_0x8c8d('0x40')]=function(_0x5e94d3,_0x3c9916){var _0x2b7551={'raw':!![],'where':{'id':_0x5e94d3['params']['id']}},_0x448a85={};_0x448a85['model']=_[_0x8c8d('0x41')](db[_0x8c8d('0x42')][_0x8c8d('0x43')]);_0x448a85[_0x8c8d('0x2c')]=_[_0x8c8d('0x41')](_0x5e94d3[_0x8c8d('0x2c')]);_0x448a85[_0x8c8d('0x36')]=_[_0x8c8d('0x2d')](_0x448a85['model'],_0x448a85[_0x8c8d('0x2c')]);_0x2b7551['attributes']=_['intersection'](_0x448a85[_0x8c8d('0x2b')],qs['fields'](_0x5e94d3[_0x8c8d('0x2c')][_0x8c8d('0x2e')]));_0x2b7551[_0x8c8d('0x2f')]=_0x2b7551[_0x8c8d('0x2f')]['length']?_0x2b7551[_0x8c8d('0x2f')]:_0x448a85['model'];if(_0x5e94d3[_0x8c8d('0x2c')][_0x8c8d('0x3c')]){_0x2b7551[_0x8c8d('0x44')]=[{'all':!![]}];}_0x2b7551=_[_0x8c8d('0x39')]({},_0x2b7551,_0x5e94d3[_0x8c8d('0x3b')]);return db[_0x8c8d('0x42')][_0x8c8d('0x45')](_0x2b7551)[_0x8c8d('0x21')](handleEntityNotFound(_0x3c9916,null))[_0x8c8d('0x21')](respondWithResult(_0x3c9916,null))['catch'](handleError(_0x3c9916,null));};exports[_0x8c8d('0x46')]=function(_0x5af653,_0x22de3e){return db['JscriptyQuestionReport']['create'](_0x5af653['body'],{})[_0x8c8d('0x21')](respondWithResult(_0x22de3e,0xc9))[_0x8c8d('0x3f')](handleError(_0x22de3e,null));};exports[_0x8c8d('0x20')]=function(_0x2cb20a,_0x4ecdfb){if(_0x2cb20a[_0x8c8d('0x47')]['id']){delete _0x2cb20a[_0x8c8d('0x47')]['id'];}return db['JscriptyQuestionReport'][_0x8c8d('0x45')]({'where':{'id':_0x2cb20a[_0x8c8d('0x48')]['id']}})[_0x8c8d('0x21')](handleEntityNotFound(_0x4ecdfb,null))['then'](saveUpdates(_0x2cb20a['body'],null))[_0x8c8d('0x21')](respondWithResult(_0x4ecdfb,null))['catch'](handleError(_0x4ecdfb,null));};exports[_0x8c8d('0x22')]=function(_0x3f5e78,_0x18155){return db[_0x8c8d('0x42')]['find']({'where':{'id':_0x3f5e78[_0x8c8d('0x48')]['id']}})[_0x8c8d('0x21')](handleEntityNotFound(_0x18155,null))['then'](removeEntity(_0x18155,null))[_0x8c8d('0x3f')](handleError(_0x18155,null));};exports[_0x8c8d('0x49')]=function(_0x192212,_0x20f2a1){return db[_0x8c8d('0x42')][_0x8c8d('0x49')]()['then'](respondWithResult(_0x20f2a1,null))[_0x8c8d('0x3f')](handleError(_0x20f2a1,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index a004386..ece58fa 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 _0xd5ab=['bluebird','request-promise','path','rimraf','../../config/environment','./jscriptyQuestionReport.attributes','define','JscriptyQuestionReport','report_jscripty_questions','lodash','util','../../config/logger','api','moment'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xd5ab,0x167));var _0xbd5a=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd5ab[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0xbd5a('0x0'));var util=require(_0xbd5a('0x1'));var logger=require(_0xbd5a('0x2'))(_0xbd5a('0x3'));var moment=require(_0xbd5a('0x4'));var BPromise=require(_0xbd5a('0x5'));var rp=require(_0xbd5a('0x6'));var fs=require('fs');var path=require(_0xbd5a('0x7'));var rimraf=require(_0xbd5a('0x8'));var config=require(_0xbd5a('0x9'));var attributes=require(_0xbd5a('0xa'));module['exports']=function(_0x3cac53,_0x4e8dc5){return _0x3cac53[_0xbd5a('0xb')](_0xbd5a('0xc'),attributes,{'tableName':_0xbd5a('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2bae=['JscriptyQuestionReport','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptyQuestionReport.attributes','exports','define'];(function(_0x3c90fb,_0x268287){var _0x23533a=function(_0x5ed4c6){while(--_0x5ed4c6){_0x3c90fb['push'](_0x3c90fb['shift']());}};_0x23533a(++_0x268287);}(_0x2bae,0xc4));var _0xe2ba=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2bae[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xe2ba('0x0'));var logger=require(_0xe2ba('0x1'))(_0xe2ba('0x2'));var moment=require(_0xe2ba('0x3'));var BPromise=require(_0xe2ba('0x4'));var rp=require(_0xe2ba('0x5'));var fs=require('fs');var path=require(_0xe2ba('0x6'));var rimraf=require(_0xe2ba('0x7'));var config=require(_0xe2ba('0x8'));var attributes=require(_0xe2ba('0x9'));module[_0xe2ba('0xa')]=function(_0x407341,_0x4be9da){return _0x407341[_0xe2ba('0xb')](_0xe2ba('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 9b3372c..f485173 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 _0x105c=['../../mysqldb','../../config/logger','jayson/promise','client','request','info','JscriptyQuestionReport,\x20%s,\x20%s','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','moment','bluebird','randomstring','ioredis'];(function(_0xc9e256,_0x7834ff){var _0x283a36=function(_0x33e4ae){while(--_0x33e4ae){_0xc9e256['push'](_0xc9e256['shift']());}};_0x283a36(++_0x7834ff);}(_0x105c,0x87));var _0xc105=function(_0x4f3b2d,_0x3bbf46){_0x4f3b2d=_0x4f3b2d-0x0;var _0x3dddfa=_0x105c[_0x4f3b2d];return _0x3dddfa;};'use strict';var _=require(_0xc105('0x0'));var util=require('util');var moment=require(_0xc105('0x1'));var BPromise=require(_0xc105('0x2'));var rs=require(_0xc105('0x3'));var fs=require('fs');var Redis=require(_0xc105('0x4'));var db=require(_0xc105('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc105('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xc105('0x7'));var client=jayson[_0xc105('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x19e8b7,_0x4fff71,_0x55f7d7){return new BPromise(function(_0x42e20d,_0x4d1c6b){return client[_0xc105('0x9')](_0x19e8b7,_0x55f7d7)['then'](function(_0x2a3eb6){logger[_0xc105('0xa')](_0xc105('0xb'),_0x4fff71,'request\x20sent');logger[_0xc105('0xc')](_0xc105('0xd'),_0x4fff71,_0xc105('0xe'),JSON[_0xc105('0xf')](_0x2a3eb6));if(_0x2a3eb6[_0xc105('0x10')]){if(_0x2a3eb6[_0xc105('0x10')][_0xc105('0x11')]===0x1f4){logger[_0xc105('0x10')](_0xc105('0xb'),_0x4fff71,_0x2a3eb6[_0xc105('0x10')][_0xc105('0x12')]);return _0x4d1c6b(_0x2a3eb6[_0xc105('0x10')][_0xc105('0x12')]);}logger[_0xc105('0x10')](_0xc105('0xb'),_0x4fff71,_0x2a3eb6[_0xc105('0x10')]['message']);return _0x42e20d(_0x2a3eb6['error'][_0xc105('0x12')]);}else{logger['info']('JscriptyQuestionReport,\x20%s,\x20%s',_0x4fff71,_0xc105('0xe'));_0x42e20d(_0x2a3eb6[_0xc105('0x13')]['message']);}})['catch'](function(_0x14e193){logger[_0xc105('0x10')](_0xc105('0xb'),_0x4fff71,_0x14e193);_0x4d1c6b(_0x14e193);});});} \ No newline at end of file +var _0xe83e=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','request','then','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch'];(function(_0x515b7a,_0x55d8dd){var _0x475045=function(_0x51f78c){while(--_0x51f78c){_0x515b7a['push'](_0x515b7a['shift']());}};_0x475045(++_0x55d8dd);}(_0xe83e,0x1ce));var _0xee83=function(_0x1d6529,_0x52f976){_0x1d6529=_0x1d6529-0x0;var _0x2bfabe=_0xe83e[_0x1d6529];return _0x2bfabe;};'use strict';var _=require('lodash');var util=require(_0xee83('0x0'));var moment=require(_0xee83('0x1'));var BPromise=require(_0xee83('0x2'));var rs=require(_0xee83('0x3'));var fs=require('fs');var Redis=require(_0xee83('0x4'));var db=require(_0xee83('0x5'))['db'];var utils=require(_0xee83('0x6'));var logger=require('../../config/logger')(_0xee83('0x7'));var config=require(_0xee83('0x8'));var jayson=require(_0xee83('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x7c2954,_0x3ef50c,_0x7228dc){return new BPromise(function(_0x1c4bdb,_0x354542){return client[_0xee83('0xa')](_0x7c2954,_0x7228dc)[_0xee83('0xb')](function(_0x11180f){logger['info'](_0xee83('0xc'),_0x3ef50c,_0xee83('0xd'));logger[_0xee83('0xe')](_0xee83('0xf'),_0x3ef50c,_0xee83('0xd'),JSON[_0xee83('0x10')](_0x11180f));if(_0x11180f[_0xee83('0x11')]){if(_0x11180f[_0xee83('0x11')]['code']===0x1f4){logger[_0xee83('0x11')](_0xee83('0xc'),_0x3ef50c,_0x11180f[_0xee83('0x11')][_0xee83('0x12')]);return _0x354542(_0x11180f['error'][_0xee83('0x12')]);}logger[_0xee83('0x11')](_0xee83('0xc'),_0x3ef50c,_0x11180f[_0xee83('0x11')][_0xee83('0x12')]);return _0x1c4bdb(_0x11180f[_0xee83('0x11')][_0xee83('0x12')]);}else{logger[_0xee83('0x13')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x3ef50c,_0xee83('0xd'));_0x1c4bdb(_0x11180f[_0xee83('0x14')]['message']);}})[_0xee83('0x15')](function(_0x34d09e){logger[_0xee83('0x11')](_0xee83('0xc'),_0x3ef50c,_0x34d09e);_0x354542(_0x34d09e);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index e96dbdf..d6691e0 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 _0xb509=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','isAuthenticated','index','get','/describe','/:id','show','/:id/questions','create','put','update','multer','path'];(function(_0x1d9aa0,_0x272488){var _0x226868=function(_0x17127c){while(--_0x17127c){_0x1d9aa0['push'](_0x1d9aa0['shift']());}};_0x226868(++_0x272488);}(_0xb509,0x75));var _0x9b50=function(_0x1f36bb,_0x8af718){_0x1f36bb=_0x1f36bb-0x0;var _0xaf97fa=_0xb509[_0x1f36bb];return _0xaf97fa;};'use strict';var multer=require(_0x9b50('0x0'));var util=require('util');var path=require(_0x9b50('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x9b50('0x2'));var auth=require(_0x9b50('0x3'));var interaction=require(_0x9b50('0x4'));var config=require(_0x9b50('0x5'));var controller=require(_0x9b50('0x6'));router['get']('/',auth[_0x9b50('0x7')](),controller[_0x9b50('0x8')]);router[_0x9b50('0x9')](_0x9b50('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x9b50('0x9')](_0x9b50('0xb'),auth['isAuthenticated'](),controller[_0x9b50('0xc')]);router[_0x9b50('0x9')](_0x9b50('0xd'),auth[_0x9b50('0x7')](),controller['getQuestions']);router['post']('/',auth['isAuthenticated'](),controller[_0x9b50('0xe')]);router[_0x9b50('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x9b50('0x10')]);router['delete']('/:id',auth[_0x9b50('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xa8e6=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./jscriptySessionReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/questions','getQuestions','post','create','put','update','destroy','exports','multer','connect-timeout'];(function(_0x2953fc,_0x2c95f6){var _0x18992b=function(_0x3a8fa3){while(--_0x3a8fa3){_0x2953fc['push'](_0x2953fc['shift']());}};_0x18992b(++_0x2c95f6);}(_0xa8e6,0x140));var _0x6a8e=function(_0xb95095,_0xad32dd){_0xb95095=_0xb95095-0x0;var _0x38e16b=_0xa8e6[_0xb95095];return _0x38e16b;};'use strict';var multer=require(_0x6a8e('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x6a8e('0x1'));var express=require(_0x6a8e('0x2'));var router=express[_0x6a8e('0x3')]();var fs_extra=require(_0x6a8e('0x4'));var auth=require(_0x6a8e('0x5'));var interaction=require(_0x6a8e('0x6'));var config=require('../../config/environment');var controller=require(_0x6a8e('0x7'));router[_0x6a8e('0x8')]('/',auth[_0x6a8e('0x9')](),controller[_0x6a8e('0xa')]);router[_0x6a8e('0x8')](_0x6a8e('0xb'),auth[_0x6a8e('0x9')](),controller[_0x6a8e('0xc')]);router['get'](_0x6a8e('0xd'),auth[_0x6a8e('0x9')](),controller[_0x6a8e('0xe')]);router[_0x6a8e('0x8')](_0x6a8e('0xf'),auth['isAuthenticated'](),controller[_0x6a8e('0x10')]);router[_0x6a8e('0x11')]('/',auth['isAuthenticated'](),controller[_0x6a8e('0x12')]);router[_0x6a8e('0x13')](_0x6a8e('0xd'),auth['isAuthenticated'](),controller[_0x6a8e('0x14')]);router['delete']('/:id',auth[_0x6a8e('0x9')](),controller[_0x6a8e('0x15')]);module[_0x6a8e('0x16')]=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index 6be7ee1..3443f45 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 _0x1ec2=['BOOLEAN','moment','sequelize','exports','DATE','setDataValue','starttime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','STRING'];(function(_0x296c82,_0x16add7){var _0x59bdf7=function(_0x55da45){while(--_0x55da45){_0x296c82['push'](_0x296c82['shift']());}};_0x59bdf7(++_0x16add7);}(_0x1ec2,0x182));var _0x21ec=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0x1ec2[_0x5783f4];return _0x28e380;};'use strict';var moment=require(_0x21ec('0x0'));var Sequelize=require(_0x21ec('0x1'));module[_0x21ec('0x2')]={'starttime':{'type':Sequelize[_0x21ec('0x3')],'set':function(_0x47ba50){this[_0x21ec('0x4')](_0x21ec('0x5'),_0x47ba50);this[_0x21ec('0x4')](_0x21ec('0x6'),moment()[_0x21ec('0x7')](_0x21ec('0x8')));}},'endtime':{'type':Sequelize[_0x21ec('0x3')]},'membername':{'type':Sequelize[_0x21ec('0x9')]},'projectname':{'type':Sequelize[_0x21ec('0x9')]},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x21ec('0x9')]},'calleridnum':{'type':Sequelize[_0x21ec('0x9')]},'completed':{'type':Sequelize[_0x21ec('0xa')],'defaultValue':![]}}; \ No newline at end of file +var _0x17e8=['moment','sequelize','exports','DATE','setDataValue','starttime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','STRING'];(function(_0x2cc457,_0x15b053){var _0x3359d8=function(_0x124214){while(--_0x124214){_0x2cc457['push'](_0x2cc457['shift']());}};_0x3359d8(++_0x15b053);}(_0x17e8,0x15e));var _0x817e=function(_0x5b801e,_0x3cd517){_0x5b801e=_0x5b801e-0x0;var _0x145d93=_0x17e8[_0x5b801e];return _0x145d93;};'use strict';var moment=require(_0x817e('0x0'));var Sequelize=require(_0x817e('0x1'));module[_0x817e('0x2')]={'starttime':{'type':Sequelize[_0x817e('0x3')],'set':function(_0xc47efe){this[_0x817e('0x4')](_0x817e('0x5'),_0xc47efe);this[_0x817e('0x4')](_0x817e('0x6'),moment()[_0x817e('0x7')](_0x817e('0x8')));}},'endtime':{'type':Sequelize[_0x817e('0x3')]},'membername':{'type':Sequelize[_0x817e('0x9')]},'projectname':{'type':Sequelize[_0x817e('0x9')]},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x817e('0x9')]},'calleridnum':{'type':Sequelize[_0x817e('0x9')]},'completed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index 2a9256f..6c4e5df 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 _0x3eb6=['catch','params','include','create','body','find','describe','getQuestions','findOne','JscriptyQuestionReport','SessionId','eml-format','rimraf','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','../../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','apply','reject','save','update','then','destroy','error','stack','name','index','map','JscriptySessionReport','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','options','count','includeAll','findAll','rows'];(function(_0x5976f8,_0x1265b7){var _0x179715=function(_0x2b2c4b){while(--_0x2b2c4b){_0x5976f8['push'](_0x5976f8['shift']());}};_0x179715(++_0x1265b7);}(_0x3eb6,0xa9));var _0x63eb=function(_0x465ef6,_0x8adf2a){_0x465ef6=_0x465ef6-0x0;var _0x5cf599=_0x3eb6[_0x465ef6];return _0x5cf599;};'use strict';var emlformat=require(_0x63eb('0x0'));var rimraf=require(_0x63eb('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x63eb('0x2'));var Mustache=require(_0x63eb('0x3'));var util=require(_0x63eb('0x4'));var path=require(_0x63eb('0x5'));var sox=require(_0x63eb('0x6'));var csv=require(_0x63eb('0x7'));var ejs=require(_0x63eb('0x8'));var fs=require('fs');var fs_extra=require(_0x63eb('0x9'));var _=require(_0x63eb('0xa'));var squel=require(_0x63eb('0xb'));var crypto=require(_0x63eb('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x63eb('0xd'));var toCsv=require(_0x63eb('0x7'));var querystring=require(_0x63eb('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x63eb('0xf'));var qs=require(_0x63eb('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x63eb('0x11'));var logger=require(_0x63eb('0x12'))(_0x63eb('0x13'));var utils=require(_0x63eb('0x14'));var config=require(_0x63eb('0x15'));var licenseUtil=require(_0x63eb('0x16'));var db=require(_0x63eb('0x17'))['db'];function respondWithStatusCode(_0x446ba6,_0xb96e2a){_0xb96e2a=_0xb96e2a||0xcc;return function(_0x5888da){if(_0x5888da){return _0x446ba6[_0x63eb('0x18')](_0xb96e2a);}return _0x446ba6[_0x63eb('0x19')](_0xb96e2a)[_0x63eb('0x1a')]();};}function respondWithResult(_0x119c6c,_0x13f649){_0x13f649=_0x13f649||0xc8;return function(_0x443114){if(_0x443114){return _0x119c6c[_0x63eb('0x19')](_0x13f649)[_0x63eb('0x1b')](_0x443114);}};}function respondWithFilteredResult(_0x348e54,_0x1e34e2){return function(_0x22af91){if(_0x22af91){var _0x501e86=typeof _0x1e34e2[_0x63eb('0x1c')]===_0x63eb('0x1d')&&typeof _0x1e34e2['limit']===_0x63eb('0x1d');var _0x508f6b=_0x22af91['count'];var _0x4403b6=_0x501e86?0x0:_0x1e34e2[_0x63eb('0x1c')];var _0x436a01=_0x501e86?_0x22af91['count']:_0x1e34e2['offset']+_0x1e34e2[_0x63eb('0x1e')];var _0x40317a;if(_0x436a01>=_0x508f6b){_0x436a01=_0x508f6b;_0x40317a=0xc8;}else{_0x40317a=0xce;}_0x348e54['status'](_0x40317a);return _0x348e54['set']('Content-Range',_0x4403b6+'-'+_0x436a01+'/'+_0x508f6b)[_0x63eb('0x1b')](_0x22af91);}return null;};}function patchUpdates(_0x300b3e){return function(_0x4e7119){try{jsonpatch[_0x63eb('0x1f')](_0x4e7119,_0x300b3e,!![]);}catch(_0x366c57){return BPromise[_0x63eb('0x20')](_0x366c57);}return _0x4e7119[_0x63eb('0x21')]();};}function saveUpdates(_0x1d1c4e,_0x4cedc3){return function(_0x5bba41){if(_0x5bba41){return _0x5bba41[_0x63eb('0x22')](_0x1d1c4e)[_0x63eb('0x23')](function(_0x49295d){return _0x49295d;});}return null;};}function removeEntity(_0x57d9a8,_0x2e20b6){return function(_0x3b842d){if(_0x3b842d){return _0x3b842d[_0x63eb('0x24')]()[_0x63eb('0x23')](function(){_0x57d9a8['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2abdb7,_0x5a4a38){return function(_0x1a4152){if(!_0x1a4152){_0x2abdb7[_0x63eb('0x18')](0x194);}return _0x1a4152;};}function handleError(_0x439c79,_0x15a41c){_0x15a41c=_0x15a41c||0x1f4;return function(_0x11d951){logger[_0x63eb('0x25')](_0x11d951[_0x63eb('0x26')]);if(_0x11d951[_0x63eb('0x27')]){delete _0x11d951['name'];}_0x439c79[_0x63eb('0x19')](_0x15a41c)['send'](_0x11d951);};}exports[_0x63eb('0x28')]=function(_0x2407fb,_0x4507c8){var _0x5af90d={},_0x22a5cb={},_0x729a6f={'count':0x0,'rows':[]};var _0x1ac1e5=_[_0x63eb('0x29')](db[_0x63eb('0x2a')][_0x63eb('0x2b')],function(_0x3ab6b4){return{'name':_0x3ab6b4[_0x63eb('0x2c')],'type':_0x3ab6b4['type'][_0x63eb('0x2d')]};});_0x22a5cb[_0x63eb('0x2e')]=_[_0x63eb('0x29')](_0x1ac1e5,_0x63eb('0x27'));_0x22a5cb[_0x63eb('0x2f')]=_[_0x63eb('0x30')](_0x2407fb['query']);_0x22a5cb['filters']=_[_0x63eb('0x31')](_0x22a5cb['model'],_0x22a5cb[_0x63eb('0x2f')]);_0x5af90d[_0x63eb('0x32')]=_['intersection'](_0x22a5cb[_0x63eb('0x2e')],qs[_0x63eb('0x33')](_0x2407fb['query']['fields']));_0x5af90d['attributes']=_0x5af90d[_0x63eb('0x32')][_0x63eb('0x34')]?_0x5af90d[_0x63eb('0x32')]:_0x22a5cb[_0x63eb('0x2e')];if(!_0x2407fb[_0x63eb('0x2f')][_0x63eb('0x35')](_0x63eb('0x36'))){_0x5af90d[_0x63eb('0x1e')]=qs[_0x63eb('0x1e')](_0x2407fb['query'][_0x63eb('0x1e')]);_0x5af90d[_0x63eb('0x1c')]=qs[_0x63eb('0x1c')](_0x2407fb[_0x63eb('0x2f')][_0x63eb('0x1c')]);}_0x5af90d[_0x63eb('0x37')]=qs[_0x63eb('0x38')](_0x2407fb[_0x63eb('0x2f')][_0x63eb('0x38')]);_0x5af90d[_0x63eb('0x39')]=qs[_0x63eb('0x3a')](_[_0x63eb('0x3b')](_0x2407fb[_0x63eb('0x2f')],_0x22a5cb[_0x63eb('0x3a')]),_0x1ac1e5);if(_0x2407fb[_0x63eb('0x2f')][_0x63eb('0x3c')]){_0x5af90d[_0x63eb('0x39')]=_[_0x63eb('0x3d')](_0x5af90d[_0x63eb('0x39')],{'$or':_[_0x63eb('0x29')](_0x1ac1e5,function(_0xc6fd13){if(_0xc6fd13[_0x63eb('0x3e')]!=='VIRTUAL'){var _0x13f0ce={};_0x13f0ce[_0xc6fd13[_0x63eb('0x27')]]={'$like':'%'+_0x2407fb[_0x63eb('0x2f')]['filter']+'%'};return _0x13f0ce;}})});}_0x5af90d=_[_0x63eb('0x3d')]({},_0x5af90d,_0x2407fb[_0x63eb('0x3f')]);var _0x2e3f22={'where':_0x5af90d['where']};return db[_0x63eb('0x2a')][_0x63eb('0x40')](_0x2e3f22)[_0x63eb('0x23')](function(_0x4efe6a){_0x729a6f[_0x63eb('0x40')]=_0x4efe6a;if(_0x2407fb[_0x63eb('0x2f')][_0x63eb('0x41')]){_0x5af90d['include']=[{'all':!![]}];}return db[_0x63eb('0x2a')][_0x63eb('0x42')](_0x5af90d);})[_0x63eb('0x23')](function(_0x455c9e){_0x729a6f[_0x63eb('0x43')]=_0x455c9e;return _0x729a6f;})[_0x63eb('0x23')](respondWithFilteredResult(_0x4507c8,_0x5af90d))[_0x63eb('0x44')](handleError(_0x4507c8,null));};exports['show']=function(_0x20b817,_0x266b20){var _0x1de88d={'raw':!![],'where':{'id':_0x20b817[_0x63eb('0x45')]['id']}},_0x5d492b={};_0x5d492b[_0x63eb('0x2e')]=_[_0x63eb('0x30')](db['JscriptySessionReport'][_0x63eb('0x2b')]);_0x5d492b[_0x63eb('0x2f')]=_[_0x63eb('0x30')](_0x20b817[_0x63eb('0x2f')]);_0x5d492b[_0x63eb('0x3a')]=_[_0x63eb('0x31')](_0x5d492b[_0x63eb('0x2e')],_0x5d492b['query']);_0x1de88d[_0x63eb('0x32')]=_[_0x63eb('0x31')](_0x5d492b[_0x63eb('0x2e')],qs[_0x63eb('0x33')](_0x20b817[_0x63eb('0x2f')][_0x63eb('0x33')]));_0x1de88d[_0x63eb('0x32')]=_0x1de88d[_0x63eb('0x32')]['length']?_0x1de88d['attributes']:_0x5d492b[_0x63eb('0x2e')];if(_0x20b817[_0x63eb('0x2f')][_0x63eb('0x41')]){_0x1de88d[_0x63eb('0x46')]=[{'all':!![]}];}_0x1de88d=_['merge']({},_0x1de88d,_0x20b817[_0x63eb('0x3f')]);return db['JscriptySessionReport']['find'](_0x1de88d)[_0x63eb('0x23')](handleEntityNotFound(_0x266b20,null))[_0x63eb('0x23')](respondWithResult(_0x266b20,null))['catch'](handleError(_0x266b20,null));};exports[_0x63eb('0x47')]=function(_0x59b02d,_0x322aaa){return db['JscriptySessionReport'][_0x63eb('0x47')](_0x59b02d[_0x63eb('0x48')],{})[_0x63eb('0x23')](respondWithResult(_0x322aaa,0xc9))['catch'](handleError(_0x322aaa,null));};exports[_0x63eb('0x22')]=function(_0x45e2cc,_0x5de522){if(_0x45e2cc[_0x63eb('0x48')]['id']){delete _0x45e2cc['body']['id'];}return db['JscriptySessionReport'][_0x63eb('0x49')]({'where':{'id':_0x45e2cc['params']['id']}})[_0x63eb('0x23')](handleEntityNotFound(_0x5de522,null))[_0x63eb('0x23')](saveUpdates(_0x45e2cc[_0x63eb('0x48')],null))[_0x63eb('0x23')](respondWithResult(_0x5de522,null))[_0x63eb('0x44')](handleError(_0x5de522,null));};exports[_0x63eb('0x24')]=function(_0x47dc4b,_0x332b9d){return db['JscriptySessionReport'][_0x63eb('0x49')]({'where':{'id':_0x47dc4b[_0x63eb('0x45')]['id']}})[_0x63eb('0x23')](handleEntityNotFound(_0x332b9d,null))[_0x63eb('0x23')](removeEntity(_0x332b9d,null))[_0x63eb('0x44')](handleError(_0x332b9d,null));};exports[_0x63eb('0x4a')]=function(_0x744ce5,_0x4dd055){return db[_0x63eb('0x2a')][_0x63eb('0x4a')]()[_0x63eb('0x23')](respondWithResult(_0x4dd055,null))['catch'](handleError(_0x4dd055,null));};exports[_0x63eb('0x4b')]=function(_0x18b67f,_0x47856,_0x1f54b1){var _0x275680={'raw':!![],'where':{}};var _0x4e15f2={};var _0x5dacd7={'count':0x0,'rows':[]};return db['JscriptySessionReport'][_0x63eb('0x4c')]({'where':{'id':_0x18b67f[_0x63eb('0x45')]['id']}})[_0x63eb('0x23')](handleEntityNotFound(_0x47856,null))[_0x63eb('0x23')](function(_0x2f63d5){if(_0x2f63d5){_0x4e15f2[_0x63eb('0x2e')]=_[_0x63eb('0x30')](db[_0x63eb('0x4d')][_0x63eb('0x2b')]);_0x4e15f2['query']=_[_0x63eb('0x30')](_0x18b67f['query']);_0x4e15f2['filters']=_[_0x63eb('0x31')](_0x4e15f2['model'],_0x4e15f2[_0x63eb('0x2f')]);_0x275680[_0x63eb('0x32')]=_[_0x63eb('0x31')](_0x4e15f2[_0x63eb('0x2e')],qs[_0x63eb('0x33')](_0x18b67f[_0x63eb('0x2f')][_0x63eb('0x33')]));_0x275680[_0x63eb('0x32')]=_0x275680[_0x63eb('0x32')][_0x63eb('0x34')]?_0x275680['attributes']:_0x4e15f2[_0x63eb('0x2e')];if(!_0x18b67f[_0x63eb('0x2f')][_0x63eb('0x35')]('nolimit')){_0x275680[_0x63eb('0x1e')]=qs[_0x63eb('0x1e')](_0x18b67f[_0x63eb('0x2f')][_0x63eb('0x1e')]);_0x275680['offset']=qs['offset'](_0x18b67f[_0x63eb('0x2f')][_0x63eb('0x1c')]);}_0x275680[_0x63eb('0x37')]=qs[_0x63eb('0x38')](_0x18b67f[_0x63eb('0x2f')][_0x63eb('0x38')]);_0x275680[_0x63eb('0x39')]=qs[_0x63eb('0x3a')](_[_0x63eb('0x3b')](_0x18b67f[_0x63eb('0x2f')],_0x4e15f2[_0x63eb('0x3a')]));_0x275680[_0x63eb('0x39')][_0x63eb('0x4e')]=_0x2f63d5['id'];if(_0x18b67f[_0x63eb('0x2f')][_0x63eb('0x3c')]){_0x275680[_0x63eb('0x39')]=_['merge'](_0x275680[_0x63eb('0x39')],{'$or':_['map'](_0x275680['attributes'],function(_0x742989){var _0x3a9192={};_0x3a9192[_0x742989]={'$like':'%'+_0x18b67f[_0x63eb('0x2f')][_0x63eb('0x3c')]+'%'};return _0x3a9192;})});}_0x275680=_[_0x63eb('0x3d')]({},_0x275680,_0x18b67f[_0x63eb('0x3f')]);return db[_0x63eb('0x4d')][_0x63eb('0x40')]({'where':_0x275680['where']})[_0x63eb('0x23')](function(_0x16ed21){_0x5dacd7[_0x63eb('0x40')]=_0x16ed21;if(_0x18b67f['query'][_0x63eb('0x41')]){_0x275680[_0x63eb('0x46')]=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0x63eb('0x42')](_0x275680);})[_0x63eb('0x23')](function(_0x5ad3c3){_0x5dacd7['rows']=_0x5ad3c3;return _0x5dacd7;});}})[_0x63eb('0x23')](respondWithFilteredResult(_0x47856,_0x275680))[_0x63eb('0x44')](handleError(_0x47856,null));}; \ No newline at end of file +var _0x27b7=['name','send','index','map','JscriptySessionReport','rawAttributes','key','model','keys','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','include','findAll','rows','catch','show','length','includeAll','create','find','params','body','describe','getQuestions','JscriptyQuestionReport','SessionId','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack'];(function(_0x45aac5,_0x4e4c65){var _0x30aa6a=function(_0x2b21c5){while(--_0x2b21c5){_0x45aac5['push'](_0x45aac5['shift']());}};_0x30aa6a(++_0x4e4c65);}(_0x27b7,0x7c));var _0x727b=function(_0x2c5352,_0x1908d7){_0x2c5352=_0x2c5352-0x0;var _0x3c558d=_0x27b7[_0x2c5352];return _0x3c558d;};'use strict';var emlformat=require(_0x727b('0x0'));var rimraf=require(_0x727b('0x1'));var zipdir=require(_0x727b('0x2'));var jsonpatch=require(_0x727b('0x3'));var rp=require(_0x727b('0x4'));var moment=require(_0x727b('0x5'));var BPromise=require(_0x727b('0x6'));var Mustache=require(_0x727b('0x7'));var util=require(_0x727b('0x8'));var path=require(_0x727b('0x9'));var sox=require(_0x727b('0xa'));var csv=require('to-csv');var ejs=require(_0x727b('0xb'));var fs=require('fs');var fs_extra=require(_0x727b('0xc'));var _=require(_0x727b('0xd'));var squel=require(_0x727b('0xe'));var crypto=require(_0x727b('0xf'));var jsforce=require(_0x727b('0x10'));var deskjs=require(_0x727b('0x11'));var toCsv=require(_0x727b('0x12'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x727b('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x727b('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x727b('0x15'))(_0x727b('0x16'));var utils=require(_0x727b('0x17'));var config=require(_0x727b('0x18'));var licenseUtil=require(_0x727b('0x19'));var db=require(_0x727b('0x1a'))['db'];function respondWithStatusCode(_0x237b48,_0x242123){_0x242123=_0x242123||0xcc;return function(_0x32836a){if(_0x32836a){return _0x237b48['sendStatus'](_0x242123);}return _0x237b48[_0x727b('0x1b')](_0x242123)[_0x727b('0x1c')]();};}function respondWithResult(_0x4a3019,_0x1ef0f2){_0x1ef0f2=_0x1ef0f2||0xc8;return function(_0x203b96){if(_0x203b96){return _0x4a3019[_0x727b('0x1b')](_0x1ef0f2)[_0x727b('0x1d')](_0x203b96);}};}function respondWithFilteredResult(_0x394595,_0x4d9464){return function(_0x53b11b){if(_0x53b11b){var _0x1c5143=typeof _0x4d9464['offset']==='undefined'&&typeof _0x4d9464[_0x727b('0x1e')]==='undefined';var _0x11580f=_0x53b11b[_0x727b('0x1f')];var _0x200a67=_0x1c5143?0x0:_0x4d9464[_0x727b('0x20')];var _0x303d37=_0x1c5143?_0x53b11b[_0x727b('0x1f')]:_0x4d9464['offset']+_0x4d9464['limit'];var _0x4a9c70;if(_0x303d37>=_0x11580f){_0x303d37=_0x11580f;_0x4a9c70=0xc8;}else{_0x4a9c70=0xce;}_0x394595[_0x727b('0x1b')](_0x4a9c70);return _0x394595[_0x727b('0x21')](_0x727b('0x22'),_0x200a67+'-'+_0x303d37+'/'+_0x11580f)[_0x727b('0x1d')](_0x53b11b);}return null;};}function patchUpdates(_0x5c4e4e){return function(_0x5631b4){try{jsonpatch[_0x727b('0x23')](_0x5631b4,_0x5c4e4e,!![]);}catch(_0x171c09){return BPromise[_0x727b('0x24')](_0x171c09);}return _0x5631b4[_0x727b('0x25')]();};}function saveUpdates(_0x429d96,_0xf05f5c){return function(_0x56cb88){if(_0x56cb88){return _0x56cb88[_0x727b('0x26')](_0x429d96)[_0x727b('0x27')](function(_0x442737){return _0x442737;});}return null;};}function removeEntity(_0x1dc827,_0x87b52c){return function(_0x2401a4){if(_0x2401a4){return _0x2401a4[_0x727b('0x28')]()[_0x727b('0x27')](function(){_0x1dc827[_0x727b('0x1b')](0xcc)[_0x727b('0x1c')]();});}};}function handleEntityNotFound(_0x52b562,_0x133fcb){return function(_0x2c25bd){if(!_0x2c25bd){_0x52b562[_0x727b('0x29')](0x194);}return _0x2c25bd;};}function handleError(_0x2f54a9,_0x505eee){_0x505eee=_0x505eee||0x1f4;return function(_0x349f9a){logger[_0x727b('0x2a')](_0x349f9a[_0x727b('0x2b')]);if(_0x349f9a['name']){delete _0x349f9a[_0x727b('0x2c')];}_0x2f54a9[_0x727b('0x1b')](_0x505eee)[_0x727b('0x2d')](_0x349f9a);};}exports[_0x727b('0x2e')]=function(_0x386844,_0x41fe14){var _0x44c84c={},_0x4e0335={},_0x179195={'count':0x0,'rows':[]};var _0xd0447f=_[_0x727b('0x2f')](db[_0x727b('0x30')][_0x727b('0x31')],function(_0x70e354){return{'name':_0x70e354['fieldName'],'type':_0x70e354['type'][_0x727b('0x32')]};});_0x4e0335[_0x727b('0x33')]=_[_0x727b('0x2f')](_0xd0447f,'name');_0x4e0335['query']=_[_0x727b('0x34')](_0x386844[_0x727b('0x35')]);_0x4e0335['filters']=_[_0x727b('0x36')](_0x4e0335[_0x727b('0x33')],_0x4e0335[_0x727b('0x35')]);_0x44c84c[_0x727b('0x37')]=_[_0x727b('0x36')](_0x4e0335['model'],qs[_0x727b('0x38')](_0x386844['query']['fields']));_0x44c84c['attributes']=_0x44c84c[_0x727b('0x37')]['length']?_0x44c84c[_0x727b('0x37')]:_0x4e0335[_0x727b('0x33')];if(!_0x386844[_0x727b('0x35')][_0x727b('0x39')](_0x727b('0x3a'))){_0x44c84c[_0x727b('0x1e')]=qs[_0x727b('0x1e')](_0x386844[_0x727b('0x35')][_0x727b('0x1e')]);_0x44c84c[_0x727b('0x20')]=qs[_0x727b('0x20')](_0x386844['query'][_0x727b('0x20')]);}_0x44c84c[_0x727b('0x3b')]=qs[_0x727b('0x3c')](_0x386844[_0x727b('0x35')]['sort']);_0x44c84c[_0x727b('0x3d')]=qs[_0x727b('0x3e')](_[_0x727b('0x3f')](_0x386844['query'],_0x4e0335['filters']),_0xd0447f);if(_0x386844[_0x727b('0x35')][_0x727b('0x40')]){_0x44c84c[_0x727b('0x3d')]=_[_0x727b('0x41')](_0x44c84c['where'],{'$or':_[_0x727b('0x2f')](_0xd0447f,function(_0x5cd1d5){if(_0x5cd1d5[_0x727b('0x42')]!==_0x727b('0x43')){var _0x7dd672={};_0x7dd672[_0x5cd1d5['name']]={'$like':'%'+_0x386844[_0x727b('0x35')][_0x727b('0x40')]+'%'};return _0x7dd672;}})});}_0x44c84c=_[_0x727b('0x41')]({},_0x44c84c,_0x386844[_0x727b('0x44')]);var _0x529c23={'where':_0x44c84c[_0x727b('0x3d')]};return db[_0x727b('0x30')][_0x727b('0x1f')](_0x529c23)[_0x727b('0x27')](function(_0x5c9f09){_0x179195['count']=_0x5c9f09;if(_0x386844[_0x727b('0x35')]['includeAll']){_0x44c84c[_0x727b('0x45')]=[{'all':!![]}];}return db[_0x727b('0x30')][_0x727b('0x46')](_0x44c84c);})[_0x727b('0x27')](function(_0x83294){_0x179195[_0x727b('0x47')]=_0x83294;return _0x179195;})[_0x727b('0x27')](respondWithFilteredResult(_0x41fe14,_0x44c84c))[_0x727b('0x48')](handleError(_0x41fe14,null));};exports[_0x727b('0x49')]=function(_0x3cedb5,_0x2305f1){var _0x30108f={'raw':!![],'where':{'id':_0x3cedb5['params']['id']}},_0x3911b5={};_0x3911b5[_0x727b('0x33')]=_[_0x727b('0x34')](db[_0x727b('0x30')][_0x727b('0x31')]);_0x3911b5[_0x727b('0x35')]=_[_0x727b('0x34')](_0x3cedb5['query']);_0x3911b5[_0x727b('0x3e')]=_['intersection'](_0x3911b5[_0x727b('0x33')],_0x3911b5[_0x727b('0x35')]);_0x30108f['attributes']=_[_0x727b('0x36')](_0x3911b5[_0x727b('0x33')],qs['fields'](_0x3cedb5[_0x727b('0x35')][_0x727b('0x38')]));_0x30108f['attributes']=_0x30108f[_0x727b('0x37')][_0x727b('0x4a')]?_0x30108f[_0x727b('0x37')]:_0x3911b5['model'];if(_0x3cedb5[_0x727b('0x35')][_0x727b('0x4b')]){_0x30108f['include']=[{'all':!![]}];}_0x30108f=_[_0x727b('0x41')]({},_0x30108f,_0x3cedb5[_0x727b('0x44')]);return db[_0x727b('0x30')]['find'](_0x30108f)['then'](handleEntityNotFound(_0x2305f1,null))[_0x727b('0x27')](respondWithResult(_0x2305f1,null))[_0x727b('0x48')](handleError(_0x2305f1,null));};exports[_0x727b('0x4c')]=function(_0x52c222,_0x151e72){return db['JscriptySessionReport'][_0x727b('0x4c')](_0x52c222['body'],{})['then'](respondWithResult(_0x151e72,0xc9))[_0x727b('0x48')](handleError(_0x151e72,null));};exports[_0x727b('0x26')]=function(_0x33a7bf,_0x1016f2){if(_0x33a7bf['body']['id']){delete _0x33a7bf['body']['id'];}return db[_0x727b('0x30')][_0x727b('0x4d')]({'where':{'id':_0x33a7bf[_0x727b('0x4e')]['id']}})[_0x727b('0x27')](handleEntityNotFound(_0x1016f2,null))['then'](saveUpdates(_0x33a7bf[_0x727b('0x4f')],null))[_0x727b('0x27')](respondWithResult(_0x1016f2,null))[_0x727b('0x48')](handleError(_0x1016f2,null));};exports['destroy']=function(_0x4f6462,_0x17a6d4){return db[_0x727b('0x30')][_0x727b('0x4d')]({'where':{'id':_0x4f6462[_0x727b('0x4e')]['id']}})[_0x727b('0x27')](handleEntityNotFound(_0x17a6d4,null))[_0x727b('0x27')](removeEntity(_0x17a6d4,null))['catch'](handleError(_0x17a6d4,null));};exports[_0x727b('0x50')]=function(_0x5ee9c9,_0x32772b){return db['JscriptySessionReport'][_0x727b('0x50')]()[_0x727b('0x27')](respondWithResult(_0x32772b,null))['catch'](handleError(_0x32772b,null));};exports[_0x727b('0x51')]=function(_0x394cfc,_0x2ca1b4,_0x170b66){var _0x1bf8a2={'raw':!![],'where':{}};var _0x3763cf={};var _0x1df4b0={'count':0x0,'rows':[]};return db[_0x727b('0x30')]['findOne']({'where':{'id':_0x394cfc[_0x727b('0x4e')]['id']}})[_0x727b('0x27')](handleEntityNotFound(_0x2ca1b4,null))[_0x727b('0x27')](function(_0x20117b){if(_0x20117b){_0x3763cf[_0x727b('0x33')]=_[_0x727b('0x34')](db[_0x727b('0x52')][_0x727b('0x31')]);_0x3763cf['query']=_[_0x727b('0x34')](_0x394cfc['query']);_0x3763cf[_0x727b('0x3e')]=_[_0x727b('0x36')](_0x3763cf[_0x727b('0x33')],_0x3763cf[_0x727b('0x35')]);_0x1bf8a2[_0x727b('0x37')]=_[_0x727b('0x36')](_0x3763cf[_0x727b('0x33')],qs[_0x727b('0x38')](_0x394cfc[_0x727b('0x35')][_0x727b('0x38')]));_0x1bf8a2[_0x727b('0x37')]=_0x1bf8a2['attributes'][_0x727b('0x4a')]?_0x1bf8a2[_0x727b('0x37')]:_0x3763cf[_0x727b('0x33')];if(!_0x394cfc[_0x727b('0x35')][_0x727b('0x39')](_0x727b('0x3a'))){_0x1bf8a2[_0x727b('0x1e')]=qs[_0x727b('0x1e')](_0x394cfc[_0x727b('0x35')][_0x727b('0x1e')]);_0x1bf8a2[_0x727b('0x20')]=qs[_0x727b('0x20')](_0x394cfc[_0x727b('0x35')][_0x727b('0x20')]);}_0x1bf8a2[_0x727b('0x3b')]=qs[_0x727b('0x3c')](_0x394cfc[_0x727b('0x35')]['sort']);_0x1bf8a2[_0x727b('0x3d')]=qs['filters'](_[_0x727b('0x3f')](_0x394cfc[_0x727b('0x35')],_0x3763cf[_0x727b('0x3e')]));_0x1bf8a2[_0x727b('0x3d')][_0x727b('0x53')]=_0x20117b['id'];if(_0x394cfc['query']['filter']){_0x1bf8a2[_0x727b('0x3d')]=_['merge'](_0x1bf8a2[_0x727b('0x3d')],{'$or':_[_0x727b('0x2f')](_0x1bf8a2[_0x727b('0x37')],function(_0x16f317){var _0x5283f3={};_0x5283f3[_0x16f317]={'$like':'%'+_0x394cfc['query'][_0x727b('0x40')]+'%'};return _0x5283f3;})});}_0x1bf8a2=_[_0x727b('0x41')]({},_0x1bf8a2,_0x394cfc['options']);return db[_0x727b('0x52')][_0x727b('0x1f')]({'where':_0x1bf8a2['where']})['then'](function(_0x1e4d4e){_0x1df4b0[_0x727b('0x1f')]=_0x1e4d4e;if(_0x394cfc[_0x727b('0x35')][_0x727b('0x4b')]){_0x1bf8a2[_0x727b('0x45')]=[{'all':!![]}];}return db[_0x727b('0x52')][_0x727b('0x46')](_0x1bf8a2);})[_0x727b('0x27')](function(_0x33be70){_0x1df4b0[_0x727b('0x47')]=_0x33be70;return _0x1df4b0;});}})[_0x727b('0x27')](respondWithFilteredResult(_0x2ca1b4,_0x1bf8a2))[_0x727b('0x48')](handleError(_0x2ca1b4,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index 675cee0..7d0f330 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 _0xacf4=['define','JscriptySessionReport','report_jscripty_sessions','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./jscriptySessionReport.attributes','exports'];(function(_0x901852,_0x1d74f6){var _0x18da1d=function(_0x343c3d){while(--_0x343c3d){_0x901852['push'](_0x901852['shift']());}};_0x18da1d(++_0x1d74f6);}(_0xacf4,0xe7));var _0x4acf=function(_0x22658d,_0x328f29){_0x22658d=_0x22658d-0x0;var _0x49a56b=_0xacf4[_0x22658d];return _0x49a56b;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4acf('0x0'))(_0x4acf('0x1'));var moment=require(_0x4acf('0x2'));var BPromise=require(_0x4acf('0x3'));var rp=require(_0x4acf('0x4'));var fs=require('fs');var path=require(_0x4acf('0x5'));var rimraf=require(_0x4acf('0x6'));var config=require('../../config/environment');var attributes=require(_0x4acf('0x7'));module[_0x4acf('0x8')]=function(_0x4e0c43,_0x24bf24){return _0x4e0c43[_0x4acf('0x9')](_0x4acf('0xa'),attributes,{'tableName':_0x4acf('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7278=['define','JscriptySessionReport','report_jscripty_sessions','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./jscriptySessionReport.attributes','exports'];(function(_0x5da42a,_0x1e3b34){var _0x2879d7=function(_0xc7f464){while(--_0xc7f464){_0x5da42a['push'](_0x5da42a['shift']());}};_0x2879d7(++_0x1e3b34);}(_0x7278,0x161));var _0x8727=function(_0x48a9b2,_0x5726df){_0x48a9b2=_0x48a9b2-0x0;var _0x49eeaa=_0x7278[_0x48a9b2];return _0x49eeaa;};'use strict';var _=require(_0x8727('0x0'));var util=require(_0x8727('0x1'));var logger=require(_0x8727('0x2'))(_0x8727('0x3'));var moment=require(_0x8727('0x4'));var BPromise=require('bluebird');var rp=require(_0x8727('0x5'));var fs=require('fs');var path=require(_0x8727('0x6'));var rimraf=require(_0x8727('0x7'));var config=require(_0x8727('0x8'));var attributes=require(_0x8727('0x9'));module[_0x8727('0xa')]=function(_0x180b71,_0x5549d5){return _0x180b71[_0x8727('0xb')](_0x8727('0xc'),attributes,{'tableName':_0x8727('0xd'),'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 cfe3702..7ca95e2 100644 --- a/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js +++ b/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4325=['http','request','then','JscriptySessionReport,\x20%s,\x20%s','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','info','result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client'];(function(_0x1def7a,_0x208fbd){var _0x32076b=function(_0x1cd482){while(--_0x1cd482){_0x1def7a['push'](_0x1def7a['shift']());}};_0x32076b(++_0x208fbd);}(_0x4325,0x1da));var _0x5432=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x4325[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require(_0x5432('0x0'));var util=require(_0x5432('0x1'));var moment=require('moment');var BPromise=require(_0x5432('0x2'));var rs=require(_0x5432('0x3'));var fs=require('fs');var Redis=require(_0x5432('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x5432('0x5'))(_0x5432('0x6'));var config=require(_0x5432('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x5432('0x8')][_0x5432('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4a6e76,_0x106ec9,_0x50394d){return new BPromise(function(_0xc8252e,_0x1c9762){return client[_0x5432('0xa')](_0x4a6e76,_0x50394d)[_0x5432('0xb')](function(_0x263a0c){logger['info'](_0x5432('0xc'),_0x106ec9,'request\x20sent');logger[_0x5432('0xd')](_0x5432('0xe'),_0x106ec9,_0x5432('0xf'),JSON[_0x5432('0x10')](_0x263a0c));if(_0x263a0c['error']){if(_0x263a0c['error'][_0x5432('0x11')]===0x1f4){logger[_0x5432('0x12')]('JscriptySessionReport,\x20%s,\x20%s',_0x106ec9,_0x263a0c[_0x5432('0x12')][_0x5432('0x13')]);return _0x1c9762(_0x263a0c[_0x5432('0x12')][_0x5432('0x13')]);}logger[_0x5432('0x12')](_0x5432('0xc'),_0x106ec9,_0x263a0c['error']['message']);return _0xc8252e(_0x263a0c[_0x5432('0x12')][_0x5432('0x13')]);}else{logger[_0x5432('0x14')](_0x5432('0xc'),_0x106ec9,_0x5432('0xf'));_0xc8252e(_0x263a0c[_0x5432('0x15')]['message']);}})[_0x5432('0x16')](function(_0x49e8fd){logger[_0x5432('0x12')](_0x5432('0xc'),_0x106ec9,_0x49e8fd);_0x1c9762(_0x49e8fd);});});} \ No newline at end of file +var _0xafb9=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','then','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash'];(function(_0x4877b2,_0x278820){var _0x227f3f=function(_0x27f2de){while(--_0x27f2de){_0x4877b2['push'](_0x4877b2['shift']());}};_0x227f3f(++_0x278820);}(_0xafb9,0x68));var _0x9afb=function(_0x3816c2,_0xb221e1){_0x3816c2=_0x3816c2-0x0;var _0x144669=_0xafb9[_0x3816c2];return _0x144669;};'use strict';var _=require(_0x9afb('0x0'));var util=require(_0x9afb('0x1'));var moment=require(_0x9afb('0x2'));var BPromise=require(_0x9afb('0x3'));var rs=require(_0x9afb('0x4'));var fs=require('fs');var Redis=require(_0x9afb('0x5'));var db=require(_0x9afb('0x6'))['db'];var utils=require(_0x9afb('0x7'));var logger=require(_0x9afb('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0x9afb('0x9'));var client=jayson['client'][_0x9afb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x548b24,_0x556880,_0x4c0e9d){return new BPromise(function(_0x1edf77,_0x20b8c1){return client['request'](_0x548b24,_0x4c0e9d)[_0x9afb('0xb')](function(_0x3e0264){logger[_0x9afb('0xc')](_0x9afb('0xd'),_0x556880,_0x9afb('0xe'));logger['debug']('JscriptySessionReport,\x20%s,\x20%s,\x20%s',_0x556880,_0x9afb('0xe'),JSON[_0x9afb('0xf')](_0x3e0264));if(_0x3e0264[_0x9afb('0x10')]){if(_0x3e0264[_0x9afb('0x10')][_0x9afb('0x11')]===0x1f4){logger[_0x9afb('0x10')](_0x9afb('0xd'),_0x556880,_0x3e0264[_0x9afb('0x10')][_0x9afb('0x12')]);return _0x20b8c1(_0x3e0264[_0x9afb('0x10')]['message']);}logger[_0x9afb('0x10')]('JscriptySessionReport,\x20%s,\x20%s',_0x556880,_0x3e0264['error'][_0x9afb('0x12')]);return _0x1edf77(_0x3e0264[_0x9afb('0x10')][_0x9afb('0x12')]);}else{logger[_0x9afb('0xc')](_0x9afb('0xd'),_0x556880,_0x9afb('0xe'));_0x1edf77(_0x3e0264[_0x9afb('0x13')]['message']);}})[_0x9afb('0x14')](function(_0x2145c2){logger[_0x9afb('0x10')](_0x9afb('0xd'),_0x556880,_0x2145c2);_0x20b8c1(_0x2145c2);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index a7d7e90..d90b2da 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 _0x7ec7=['./license.controller','put','isAuthenticated','update','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0xa30766,_0x6f613e){var _0x24e780=function(_0x3d58fb){while(--_0x3d58fb){_0xa30766['push'](_0xa30766['shift']());}};_0x24e780(++_0x6f613e);}(_0x7ec7,0x19b));var _0x77ec=function(_0x342323,_0x2cecdb){_0x342323=_0x342323-0x0;var _0x5e3488=_0x7ec7[_0x342323];return _0x5e3488;};'use strict';var multer=require(_0x77ec('0x0'));var util=require(_0x77ec('0x1'));var path=require(_0x77ec('0x2'));var timeout=require('connect-timeout');var express=require(_0x77ec('0x3'));var router=express['Router']();var fs_extra=require(_0x77ec('0x4'));var auth=require(_0x77ec('0x5'));var interaction=require(_0x77ec('0x6'));var config=require('../../config/environment');var controller=require(_0x77ec('0x7'));router['get']('/',controller['index']);router[_0x77ec('0x8')]('/:id',auth[_0x77ec('0x9')](),controller[_0x77ec('0xa')]);module['exports']=router; \ No newline at end of file +var _0xfb82=['../../config/environment','./license.controller','get','index','put','/:id','isAuthenticated','update','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x12d033,_0x25fa2f){var _0x3b4e80=function(_0x46c1f4){while(--_0x46c1f4){_0x12d033['push'](_0x12d033['shift']());}};_0x3b4e80(++_0x25fa2f);}(_0xfb82,0x17f));var _0x2fb8=function(_0x2bfe3d,_0xa00f85){_0x2bfe3d=_0x2bfe3d-0x0;var _0x14f54c=_0xfb82[_0x2bfe3d];return _0x14f54c;};'use strict';var multer=require(_0x2fb8('0x0'));var util=require(_0x2fb8('0x1'));var path=require(_0x2fb8('0x2'));var timeout=require('connect-timeout');var express=require(_0x2fb8('0x3'));var router=express[_0x2fb8('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x2fb8('0x5'));var interaction=require(_0x2fb8('0x6'));var config=require(_0x2fb8('0x7'));var controller=require(_0x2fb8('0x8'));router[_0x2fb8('0x9')]('/',controller[_0x2fb8('0xa')]);router[_0x2fb8('0xb')](_0x2fb8('0xc'),auth[_0x2fb8('0xd')](),controller[_0x2fb8('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index 8d0ee93..069cf5e 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 _0xa9b9=['INTEGER','sequelize','exports','TEXT'];(function(_0x725a49,_0x51d213){var _0x4999bc=function(_0x3b4393){while(--_0x3b4393){_0x725a49['push'](_0x725a49['shift']());}};_0x4999bc(++_0x51d213);}(_0xa9b9,0xad));var _0x9a9b=function(_0x90f34f,_0x404021){_0x90f34f=_0x90f34f-0x0;var _0x4b18cf=_0xa9b9[_0x90f34f];return _0x4b18cf;};'use strict';var Sequelize=require(_0x9a9b('0x0'));module[_0x9a9b('0x1')]={'license':{'type':Sequelize[_0x9a9b('0x2')]},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize['STRING']},'chatLicenseExceeded':{'type':Sequelize[_0x9a9b('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0xb19b=['INTEGER','sequelize','TEXT','STRING'];(function(_0x5eecfc,_0x3d4574){var _0x121edf=function(_0x553788){while(--_0x553788){_0x5eecfc['push'](_0x5eecfc['shift']());}};_0x121edf(++_0x3d4574);}(_0xb19b,0x1a5));var _0xbb19=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb19b[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xbb19('0x0'));module['exports']={'license':{'type':Sequelize[_0xbb19('0x1')]},'data1':{'type':Sequelize[_0xbb19('0x2')]},'data2':{'type':Sequelize[_0xbb19('0x2')]},'chatLicenseExceeded':{'type':Sequelize[_0xbb19('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/license/license.controller.js b/server/api/license/license.controller.js index b0aca31..ada9ab7 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(_0x369c70,_0x5892f0){var _0xb7e463=function(_0x3822c8){while(--_0x3822c8){_0x369c70['push'](_0x369c70['shift']());}};_0xb7e463(++_0x5892f0);}(_0x7a54,0x106));var _0x47a5=function(_0x337fd1,_0x563e8b){_0x337fd1=_0x337fd1-0x0;var _0x742cc0=_0x7a54[_0x337fd1];return _0x742cc0;};'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 _0xabce=['status','end','json','limit','count','offset','Content-Range','apply','reject','save','update','then','sendStatus','error','name','send','model','keys','License','rawAttributes','query','intersection','attributes','fields','merge','getLicense','catch','find','get','body','demo','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'];(function(_0x3db9f0,_0x382dca){var _0x4a366a=function(_0x39b02d){while(--_0x39b02d){_0x3db9f0['push'](_0x3db9f0['shift']());}};_0x4a366a(++_0x382dca);}(_0xabce,0x103));var _0xeabc=function(_0xdc37a1,_0x53ebb9){_0xdc37a1=_0xdc37a1-0x0;var _0x99b4fe=_0xabce[_0xdc37a1];return _0x99b4fe;};'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'];function respondWithStatusCode(_0x3fd0b5,_0x36a92e){_0x36a92e=_0x36a92e||0xcc;return function(_0xcfbf06){if(_0xcfbf06){return _0x3fd0b5['sendStatus'](_0x36a92e);}return _0x3fd0b5[_0xeabc('0x1a')](_0x36a92e)[_0xeabc('0x1b')]();};}function respondWithResult(_0x3251c6,_0x55f0de){_0x55f0de=_0x55f0de||0xc8;return function(_0x5f4ee8){if(_0x5f4ee8){return _0x3251c6[_0xeabc('0x1a')](_0x55f0de)[_0xeabc('0x1c')](_0x5f4ee8);}};}function respondWithFilteredResult(_0x326bac,_0x53d5cb){return function(_0xf913d7){if(_0xf913d7){var _0x638976=typeof _0x53d5cb['offset']==='undefined'&&typeof _0x53d5cb[_0xeabc('0x1d')]==='undefined';var _0x3d0e21=_0xf913d7[_0xeabc('0x1e')];var _0x58a3c0=_0x638976?0x0:_0x53d5cb[_0xeabc('0x1f')];var _0x31dd53=_0x638976?_0xf913d7[_0xeabc('0x1e')]:_0x53d5cb[_0xeabc('0x1f')]+_0x53d5cb[_0xeabc('0x1d')];var _0x5d92e5;if(_0x31dd53>=_0x3d0e21){_0x31dd53=_0x3d0e21;_0x5d92e5=0xc8;}else{_0x5d92e5=0xce;}_0x326bac[_0xeabc('0x1a')](_0x5d92e5);return _0x326bac['set'](_0xeabc('0x20'),_0x58a3c0+'-'+_0x31dd53+'/'+_0x3d0e21)[_0xeabc('0x1c')](_0xf913d7);}return null;};}function patchUpdates(_0x502947){return function(_0x28063a){try{jsonpatch[_0xeabc('0x21')](_0x28063a,_0x502947,!![]);}catch(_0x254590){return BPromise[_0xeabc('0x22')](_0x254590);}return _0x28063a[_0xeabc('0x23')]();};}function saveUpdates(_0x4e99a4,_0xecdbf){return function(_0x10c675){if(_0x10c675){return _0x10c675[_0xeabc('0x24')](_0x4e99a4)['then'](function(_0x457f27){return _0x457f27;});}return null;};}function removeEntity(_0x3854d2,_0x214953){return function(_0x319119){if(_0x319119){return _0x319119['destroy']()[_0xeabc('0x25')](function(){_0x3854d2['status'](0xcc)[_0xeabc('0x1b')]();});}};}function handleEntityNotFound(_0x4d4e29,_0x811f0d){return function(_0x12acbd){if(!_0x12acbd){_0x4d4e29[_0xeabc('0x26')](0x194);}return _0x12acbd;};}function handleError(_0x3f194e,_0x3a1a04){_0x3a1a04=_0x3a1a04||0x1f4;return function(_0x137293){logger[_0xeabc('0x27')](_0x137293['stack']);if(_0x137293['name']){delete _0x137293[_0xeabc('0x28')];}_0x3f194e['status'](_0x3a1a04)[_0xeabc('0x29')](_0x137293);};}var utilLicense=require(_0xeabc('0x18'));exports['index']=function(_0x2163e6,_0x38572d){var _0x2b568f={'raw':!![],'where':{'id':0x1}},_0x2f8633={};_0x2f8633[_0xeabc('0x2a')]=_[_0xeabc('0x2b')](db[_0xeabc('0x2c')][_0xeabc('0x2d')]);_0x2f8633[_0xeabc('0x2e')]=_['keys'](_0x2163e6[_0xeabc('0x2e')]);_0x2f8633['filters']=_[_0xeabc('0x2f')](_0x2f8633[_0xeabc('0x2a')],_0x2f8633[_0xeabc('0x2e')]);_0x2b568f[_0xeabc('0x30')]=_[_0xeabc('0x2f')](_0x2f8633[_0xeabc('0x2a')],qs[_0xeabc('0x31')](_0x2163e6['query'][_0xeabc('0x31')]));_0x2b568f[_0xeabc('0x30')]=_0x2b568f[_0xeabc('0x30')]['length']?_0x2b568f[_0xeabc('0x30')]:_0x2f8633[_0xeabc('0x2a')];_0x2b568f=_[_0xeabc('0x32')]({},_0x2b568f,_0x2163e6['options']);return utilLicense[_0xeabc('0x33')](_0x2b568f)[_0xeabc('0x25')](respondWithResult(_0x38572d,null))[_0xeabc('0x34')](handleError(_0x38572d,null));};exports['update']=function(_0xf98c7c,_0x286203){if(_0xf98c7c['body']['id']){delete _0xf98c7c['body']['id'];}return db[_0xeabc('0x2c')][_0xeabc('0x35')]({'where':{'id':_0xf98c7c['params']['id']}})[_0xeabc('0x25')](handleEntityNotFound(_0x286203,null))[_0xeabc('0x25')](function(_0x3edee7){var _0x10434e=_0x3edee7[_0xeabc('0x36')]({'plain':!![]});return utilLicense['checkLicense'](_0x10434e,_0xf98c7c[_0xeabc('0x37')]['key']);})[_0xeabc('0x25')](function(_0x2bda29){if(!_0x2bda29[_0xeabc('0x38')]){return saveUpdates(_0xf98c7c['body'],null);}return _0x2bda29;})['then'](respondWithResult(_0x286203,null))[_0xeabc('0x34')](handleError(_0x286203,null));}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index dea63e9..a90f9e9 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 _0x360f=['exports','define','License','lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','./license.attributes'];(function(_0x591e11,_0x363e09){var _0x23a0a=function(_0x43734d){while(--_0x43734d){_0x591e11['push'](_0x591e11['shift']());}};_0x23a0a(++_0x363e09);}(_0x360f,0xc3));var _0xf360=function(_0x3dcd65,_0x4c342e){_0x3dcd65=_0x3dcd65-0x0;var _0x625c3f=_0x360f[_0x3dcd65];return _0x625c3f;};'use strict';var _=require(_0xf360('0x0'));var util=require(_0xf360('0x1'));var logger=require('../../config/logger')(_0xf360('0x2'));var moment=require(_0xf360('0x3'));var BPromise=require(_0xf360('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf360('0x5'));var rimraf=require(_0xf360('0x6'));var config=require(_0xf360('0x7'));var attributes=require(_0xf360('0x8'));module[_0xf360('0x9')]=function(_0x55eb7e,_0x116e4b){return _0x55eb7e[_0xf360('0xa')](_0xf360('0xb'),attributes,{'tableName':'license','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4b9a=['moment','bluebird','request-promise','path','rimraf','./license.attributes','exports','define','license'];(function(_0x20f576,_0xb47c2e){var _0x3fcaa5=function(_0x3eeb68){while(--_0x3eeb68){_0x20f576['push'](_0x20f576['shift']());}};_0x3fcaa5(++_0xb47c2e);}(_0x4b9a,0xc6));var _0xa4b9=function(_0x33258f,_0x1cb2ca){_0x33258f=_0x33258f-0x0;var _0x393595=_0x4b9a[_0x33258f];return _0x393595;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xa4b9('0x0'));var BPromise=require(_0xa4b9('0x1'));var rp=require(_0xa4b9('0x2'));var fs=require('fs');var path=require(_0xa4b9('0x3'));var rimraf=require(_0xa4b9('0x4'));var config=require('../../config/environment');var attributes=require(_0xa4b9('0x5'));module[_0xa4b9('0x6')]=function(_0x2afcc9,_0x1f1753){return _0x2afcc9[_0xa4b9('0x7')]('License',attributes,{'tableName':_0xa4b9('0x8'),'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 46c248d..42e3185 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 _0x14f5=['request','then','info','License,\x20%s,\x20%s','debug','License,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','jayson/promise','client','http'];(function(_0xcdebd2,_0x22ddd1){var _0x9aae00=function(_0x4c5b9b){while(--_0x4c5b9b){_0xcdebd2['push'](_0xcdebd2['shift']());}};_0x9aae00(++_0x22ddd1);}(_0x14f5,0x198));var _0x514f=function(_0x98ecff,_0x1796a5){_0x98ecff=_0x98ecff-0x0;var _0x4695ff=_0x14f5[_0x98ecff];return _0x4695ff;};'use strict';var _=require(_0x514f('0x0'));var util=require('util');var moment=require(_0x514f('0x1'));var BPromise=require(_0x514f('0x2'));var rs=require(_0x514f('0x3'));var fs=require('fs');var Redis=require(_0x514f('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x514f('0x5'));var logger=require('../../config/logger')(_0x514f('0x6'));var config=require('../../config/environment');var jayson=require(_0x514f('0x7'));var client=jayson[_0x514f('0x8')][_0x514f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x49ff80,_0x330658,_0x53f46b){return new BPromise(function(_0x45f3eb,_0x49caef){return client[_0x514f('0xa')](_0x49ff80,_0x53f46b)[_0x514f('0xb')](function(_0x4a2908){logger[_0x514f('0xc')](_0x514f('0xd'),_0x330658,'request\x20sent');logger[_0x514f('0xe')](_0x514f('0xf'),_0x330658,_0x514f('0x10'),JSON[_0x514f('0x11')](_0x4a2908));if(_0x4a2908[_0x514f('0x12')]){if(_0x4a2908['error'][_0x514f('0x13')]===0x1f4){logger['error'](_0x514f('0xd'),_0x330658,_0x4a2908[_0x514f('0x12')][_0x514f('0x14')]);return _0x49caef(_0x4a2908[_0x514f('0x12')][_0x514f('0x14')]);}logger['error'](_0x514f('0xd'),_0x330658,_0x4a2908[_0x514f('0x12')][_0x514f('0x14')]);return _0x45f3eb(_0x4a2908[_0x514f('0x12')][_0x514f('0x14')]);}else{logger[_0x514f('0xc')](_0x514f('0xd'),_0x330658,_0x514f('0x10'));_0x45f3eb(_0x4a2908['result'][_0x514f('0x14')]);}})[_0x514f('0x15')](function(_0x485688){logger['error'](_0x514f('0xd'),_0x330658,_0x485688);_0x49caef(_0x485688);});});} \ No newline at end of file +var _0x9bd4=['info','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','stringify','error','code','message','License,\x20%s,\x20%s','moment','bluebird','ioredis','../../config/logger','rpc','jayson/promise','client','http','then'];(function(_0x5eef05,_0x1be989){var _0x56d4b8=function(_0x57993d){while(--_0x57993d){_0x5eef05['push'](_0x5eef05['shift']());}};_0x56d4b8(++_0x1be989);}(_0x9bd4,0x1a7));var _0x49bd=function(_0x51972f,_0x22cc63){_0x51972f=_0x51972f-0x0;var _0x184ea8=_0x9bd4[_0x51972f];return _0x184ea8;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x49bd('0x0'));var BPromise=require(_0x49bd('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x49bd('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x49bd('0x3'))(_0x49bd('0x4'));var config=require('../../config/environment');var jayson=require(_0x49bd('0x5'));var client=jayson[_0x49bd('0x6')][_0x49bd('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1c575f,_0x55b5b2,_0x5a6a18){return new BPromise(function(_0x413d46,_0x4d974c){return client['request'](_0x1c575f,_0x5a6a18)[_0x49bd('0x8')](function(_0x26fdbc){logger[_0x49bd('0x9')]('License,\x20%s,\x20%s',_0x55b5b2,_0x49bd('0xa'));logger[_0x49bd('0xb')](_0x49bd('0xc'),_0x55b5b2,_0x49bd('0xa'),JSON[_0x49bd('0xd')](_0x26fdbc));if(_0x26fdbc[_0x49bd('0xe')]){if(_0x26fdbc[_0x49bd('0xe')][_0x49bd('0xf')]===0x1f4){logger[_0x49bd('0xe')]('License,\x20%s,\x20%s',_0x55b5b2,_0x26fdbc['error'][_0x49bd('0x10')]);return _0x4d974c(_0x26fdbc[_0x49bd('0xe')][_0x49bd('0x10')]);}logger[_0x49bd('0xe')](_0x49bd('0x11'),_0x55b5b2,_0x26fdbc[_0x49bd('0xe')][_0x49bd('0x10')]);return _0x413d46(_0x26fdbc[_0x49bd('0xe')][_0x49bd('0x10')]);}else{logger[_0x49bd('0x9')](_0x49bd('0x11'),_0x55b5b2,'request\x20sent');_0x413d46(_0x26fdbc['result'][_0x49bd('0x10')]);}})['catch'](function(_0x4cbbb5){logger['error'](_0x49bd('0x11'),_0x55b5b2,_0x4cbbb5);_0x4d974c(_0x4cbbb5);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index 14d94c2..e0af25a 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 _0x4826=['create','/:id/out_servers','addInteraction','addApplications','/:id/send','send','/:id/users','addAgents','update','delete','removeDispositions','removeImap','removeSmtp','destroy','removeAgents','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','./mailAccount.controller','isAuthenticated','index','/describe','describe','get','/:id','show','/:id/dispositions','/:id/canned_answers','getAnswers','/:id/in_servers','getSmtp','/:id/interactions','getInteractions','/:id/applications','/:id/messages','/:id/verify','getAgents','post','addDisposition','addAnswer'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x4826,0xc4));var _0x6482=function(_0x16c4d0,_0x5cb02b){_0x16c4d0=_0x16c4d0-0x0;var _0x360bdd=_0x4826[_0x16c4d0];return _0x360bdd;};'use strict';var multer=require(_0x6482('0x0'));var util=require(_0x6482('0x1'));var path=require(_0x6482('0x2'));var timeout=require(_0x6482('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x6482('0x4'));var auth=require(_0x6482('0x5'));var interaction=require(_0x6482('0x6'));var config=require('../../config/environment');var controller=require(_0x6482('0x7'));router['get']('/',auth[_0x6482('0x8')](),controller[_0x6482('0x9')]);router['get'](_0x6482('0xa'),auth[_0x6482('0x8')](),controller[_0x6482('0xb')]);router[_0x6482('0xc')](_0x6482('0xd'),auth[_0x6482('0x8')](),controller[_0x6482('0xe')]);router['get'](_0x6482('0xf'),auth[_0x6482('0x8')](),controller['getDispositions']);router[_0x6482('0xc')](_0x6482('0x10'),auth[_0x6482('0x8')](),controller[_0x6482('0x11')]);router[_0x6482('0xc')](_0x6482('0x12'),auth[_0x6482('0x8')](),controller['getImap']);router[_0x6482('0xc')]('/:id/out_servers',auth[_0x6482('0x8')](),controller[_0x6482('0x13')]);router['get'](_0x6482('0x14'),auth['isAuthenticated'](),controller[_0x6482('0x15')]);router['get'](_0x6482('0x16'),auth['isAuthenticated'](),controller['getApplications']);router['get'](_0x6482('0x17'),auth[_0x6482('0x8')](),controller['getMessages']);router['get'](_0x6482('0x18'),auth[_0x6482('0x8')](),controller['verifySmtp']);router[_0x6482('0xc')]('/:id/users',auth[_0x6482('0x8')](),controller[_0x6482('0x19')]);router[_0x6482('0x1a')](_0x6482('0xf'),auth[_0x6482('0x8')](),controller[_0x6482('0x1b')]);router[_0x6482('0x1a')](_0x6482('0x10'),auth['isAuthenticated'](),controller[_0x6482('0x1c')]);router['post']('/',auth[_0x6482('0x8')](),controller[_0x6482('0x1d')]);router[_0x6482('0x1a')](_0x6482('0x12'),auth[_0x6482('0x8')](),controller['addImap']);router[_0x6482('0x1a')](_0x6482('0x1e'),auth[_0x6482('0x8')](),controller['addSmtp']);router[_0x6482('0x1a')](_0x6482('0x14'),auth[_0x6482('0x8')](),controller[_0x6482('0x1f')]);router[_0x6482('0x1a')](_0x6482('0x16'),auth[_0x6482('0x8')](),controller[_0x6482('0x20')]);router[_0x6482('0x1a')](_0x6482('0x21'),auth['isAuthenticated'](),controller[_0x6482('0x22')]);router[_0x6482('0x1a')](_0x6482('0x23'),auth[_0x6482('0x8')](),controller[_0x6482('0x24')]);router['put'](_0x6482('0xd'),auth['isAuthenticated'](),controller[_0x6482('0x25')]);router[_0x6482('0x26')](_0x6482('0xf'),auth[_0x6482('0x8')](),controller[_0x6482('0x27')]);router[_0x6482('0x26')](_0x6482('0x10'),auth[_0x6482('0x8')](),controller['removeAnswers']);router[_0x6482('0x26')](_0x6482('0x12'),auth[_0x6482('0x8')](),controller[_0x6482('0x28')]);router[_0x6482('0x26')](_0x6482('0x1e'),auth[_0x6482('0x8')](),controller[_0x6482('0x29')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x6482('0x2a')]);router['delete'](_0x6482('0x23'),auth[_0x6482('0x8')](),controller[_0x6482('0x2b')]);module[_0x6482('0x2c')]=router; \ No newline at end of file +var _0x84c9=['/:id','update','delete','removeDispositions','removeImap','destroy','removeAgents','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/in_servers','getImap','/:id/out_servers','/:id/interactions','/:id/applications','getApplications','/:id/messages','getMessages','verifySmtp','getAgents','post','addDisposition','addAnswer','create','addSmtp','addInteraction','addApplications','/:id/send','/:id/users','addAgents'];(function(_0x96f74c,_0xfc30a4){var _0x379222=function(_0x1bbde9){while(--_0x1bbde9){_0x96f74c['push'](_0x96f74c['shift']());}};_0x379222(++_0xfc30a4);}(_0x84c9,0x1ab));var _0x984c=function(_0x4fa18f,_0x5c455e){_0x4fa18f=_0x4fa18f-0x0;var _0x44ca1c=_0x84c9[_0x4fa18f];return _0x44ca1c;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x984c('0x0'));var timeout=require(_0x984c('0x1'));var express=require(_0x984c('0x2'));var router=express['Router']();var fs_extra=require(_0x984c('0x3'));var auth=require(_0x984c('0x4'));var interaction=require(_0x984c('0x5'));var config=require(_0x984c('0x6'));var controller=require('./mailAccount.controller');router[_0x984c('0x7')]('/',auth[_0x984c('0x8')](),controller['index']);router[_0x984c('0x7')]('/describe',auth[_0x984c('0x8')](),controller[_0x984c('0x9')]);router['get']('/:id',auth[_0x984c('0x8')](),controller[_0x984c('0xa')]);router[_0x984c('0x7')](_0x984c('0xb'),auth[_0x984c('0x8')](),controller[_0x984c('0xc')]);router[_0x984c('0x7')](_0x984c('0xd'),auth[_0x984c('0x8')](),controller[_0x984c('0xe')]);router[_0x984c('0x7')](_0x984c('0xf'),auth[_0x984c('0x8')](),controller[_0x984c('0x10')]);router['get'](_0x984c('0x11'),auth[_0x984c('0x8')](),controller['getSmtp']);router[_0x984c('0x7')](_0x984c('0x12'),auth[_0x984c('0x8')](),controller['getInteractions']);router[_0x984c('0x7')](_0x984c('0x13'),auth[_0x984c('0x8')](),controller[_0x984c('0x14')]);router[_0x984c('0x7')](_0x984c('0x15'),auth[_0x984c('0x8')](),controller[_0x984c('0x16')]);router[_0x984c('0x7')]('/:id/verify',auth[_0x984c('0x8')](),controller[_0x984c('0x17')]);router['get']('/:id/users',auth[_0x984c('0x8')](),controller[_0x984c('0x18')]);router[_0x984c('0x19')](_0x984c('0xb'),auth['isAuthenticated'](),controller[_0x984c('0x1a')]);router[_0x984c('0x19')](_0x984c('0xd'),auth[_0x984c('0x8')](),controller[_0x984c('0x1b')]);router[_0x984c('0x19')]('/',auth[_0x984c('0x8')](),controller[_0x984c('0x1c')]);router[_0x984c('0x19')]('/:id/in_servers',auth[_0x984c('0x8')](),controller['addImap']);router['post'](_0x984c('0x11'),auth[_0x984c('0x8')](),controller[_0x984c('0x1d')]);router[_0x984c('0x19')](_0x984c('0x12'),auth[_0x984c('0x8')](),controller[_0x984c('0x1e')]);router[_0x984c('0x19')](_0x984c('0x13'),auth[_0x984c('0x8')](),controller[_0x984c('0x1f')]);router[_0x984c('0x19')](_0x984c('0x20'),auth[_0x984c('0x8')](),controller['send']);router['post'](_0x984c('0x21'),auth[_0x984c('0x8')](),controller[_0x984c('0x22')]);router['put'](_0x984c('0x23'),auth[_0x984c('0x8')](),controller[_0x984c('0x24')]);router[_0x984c('0x25')](_0x984c('0xb'),auth[_0x984c('0x8')](),controller[_0x984c('0x26')]);router['delete'](_0x984c('0xd'),auth[_0x984c('0x8')](),controller['removeAnswers']);router[_0x984c('0x25')](_0x984c('0xf'),auth['isAuthenticated'](),controller[_0x984c('0x27')]);router[_0x984c('0x25')](_0x984c('0x11'),auth['isAuthenticated'](),controller['removeSmtp']);router[_0x984c('0x25')](_0x984c('0x23'),auth[_0x984c('0x8')](),controller[_0x984c('0x28')]);router[_0x984c('0x25')](_0x984c('0x21'),auth['isAuthenticated'](),controller[_0x984c('0x29')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index d49b8da..989b3a2 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 _0xe009=['Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','sequelize','exports','STRING','TEXT','BOOLEAN','Arial,Helvetica,sans-serif','INTEGER','UNSIGNED','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'];(function(_0x36884e,_0x48008f){var _0x1cc367=function(_0x388a78){while(--_0x388a78){_0x36884e['push'](_0x36884e['shift']());}};_0x1cc367(++_0x48008f);}(_0xe009,0x122));var _0x9e00=function(_0x5b0366,_0x53c194){_0x5b0366=_0x5b0366-0x0;var _0x14d992=_0xe009[_0x5b0366];return _0x14d992;};'use strict';var Sequelize=require(_0x9e00('0x0'));module[_0x9e00('0x1')]={'description':{'type':Sequelize[_0x9e00('0x2')]},'name':{'type':Sequelize[_0x9e00('0x2')],'allowNull':![]},'service':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0x9e00('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'key':{'type':Sequelize[_0x9e00('0x2')],'allowNull':![]},'template':{'type':Sequelize[_0x9e00('0x3')]},'markAsUnread':{'type':Sequelize[_0x9e00('0x4')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x9e00('0x2')],'allowNull':![],'defaultValue':_0x9e00('0x5')},'fontSize':{'type':Sequelize[_0x9e00('0x6')](0x2)[_0x9e00('0x7')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x9e00('0x3')],'defaultValue':function(){return _0x9e00('0x8');}},'notificationSound':{'type':Sequelize[_0x9e00('0x4')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x9e00('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x9e00('0x4')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x9e00('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x9e00('0x6')],'allowNull':!![],'defaultValue':null,'comment':_0x9e00('0x9')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x9e00('0xa'),'set':function(_0x3fdabe){if(!_0x3fdabe)this[_0x9e00('0xb')]('mandatoryDispositionPauseId',null);this[_0x9e00('0xb')]('mandatoryDisposition',_0x3fdabe);}}}; \ No newline at end of file +var _0xcca7=['INTEGER','UNSIGNED','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif'];(function(_0x55e57b,_0x24cbd7){var _0xf0a16=function(_0x28ff4f){while(--_0x28ff4f){_0x55e57b['push'](_0x55e57b['shift']());}};_0xf0a16(++_0x24cbd7);}(_0xcca7,0x1aa));var _0x7cca=function(_0x2bf2e3,_0x3e6a60){_0x2bf2e3=_0x2bf2e3-0x0;var _0x5d303b=_0xcca7[_0x2bf2e3];return _0x5d303b;};'use strict';var Sequelize=require(_0x7cca('0x0'));module[_0x7cca('0x1')]={'description':{'type':Sequelize[_0x7cca('0x2')]},'name':{'type':Sequelize[_0x7cca('0x2')],'allowNull':![]},'service':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x7cca('0x3')],'defaultValue':!![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'template':{'type':Sequelize[_0x7cca('0x4')]},'markAsUnread':{'type':Sequelize[_0x7cca('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x7cca('0x2')],'allowNull':![],'defaultValue':_0x7cca('0x5')},'fontSize':{'type':Sequelize[_0x7cca('0x6')](0x2)[_0x7cca('0x7')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize['TEXT'],'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[_0x7cca('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x7cca('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x7cca('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x7cca('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x7cca('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x7cca('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x7cca('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x7cca('0x6')],'allowNull':!![],'defaultValue':null,'comment':_0x7cca('0x8')},'mandatoryDisposition':{'type':Sequelize[_0x7cca('0x3')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x302367){if(!_0x302367)this[_0x7cca('0x9')](_0x7cca('0xa'),null);this[_0x7cca('0x9')](_0x7cca('0xb'),_0x302367);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index 0b4bcaf..a4ee50b 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 _0x11e5=['save','update','get','MailAccounts','UserProfileResource','stack','name','send','index','MailServerIn','Smtp','map','MailAccount','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','catch','show','params','Imap','mandatoryDispositionPause','length','body','find','MailServerOut','describe','addDisposition','MailAccountId','Disposition','create','findOne','nolimit','findAll','rows','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','email','ListId','isNil','active','description','cservice','cauthentication','user','cuser','password','authentication','host','port','service','pass','role','UserProfileSection','userProfileId','getImap','addImap','removeImap','getSmtp','addSmtp','removeSmtp','setSmtp','MailInteraction','omit','getInteractions','Contact','Owner','internal','Tag','color','tag','addApplications','sequelize','MailApplication','destroy','findAndCountAll','priority','getApplications','getMessages','MailMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','inlineCss','CmList','List','Contacts','DESC','from','attachments','join','root','server/files/attachments','basename','auth','secure','SendMail','sendMail','List\x20not\x20found','messageId','subject','out','Interaction','Messages','verifySmtp','VerifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','emit','removeAgents','isArray','userMailAccount:remove','User','getAgents','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','path','ejs','fs-extra','lodash','jsforce','desk.js','to-csv','querystring','papaparse','html-to-text','juice','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','register','jayson/promise','http','then','info','debug','request\x20sent','stringify','error','code','MailAccount,\x20%s,\x20%s','message','sendStatus','status','end','json','undefined','count','offset','limit','set','apply','reject'];(function(_0x55468a,_0x306604){var _0x2b16c9=function(_0x390c1c){while(--_0x390c1c){_0x55468a['push'](_0x55468a['shift']());}};_0x2b16c9(++_0x306604);}(_0x11e5,0x8b));var _0x511e=function(_0x9cb2b2,_0x4a5879){_0x9cb2b2=_0x9cb2b2-0x0;var _0x168c0c=_0x11e5[_0x9cb2b2];return _0x168c0c;};'use strict';var emlformat=require(_0x511e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x511e('0x1'));var jsonpatch=require(_0x511e('0x2'));var rp=require('request-promise');var moment=require(_0x511e('0x3'));var BPromise=require(_0x511e('0x4'));var Mustache=require(_0x511e('0x5'));var util=require('util');var path=require(_0x511e('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x511e('0x7'));var fs=require('fs');var fs_extra=require(_0x511e('0x8'));var _=require(_0x511e('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x511e('0xa'));var deskjs=require(_0x511e('0xb'));var toCsv=require(_0x511e('0xc'));var querystring=require(_0x511e('0xd'));var Papa=require(_0x511e('0xe'));var htmlToText=require(_0x511e('0xf'));var juice=require(_0x511e('0x10'));var Redis=require(_0x511e('0x11'));var authService=require(_0x511e('0x12'));var qs=require(_0x511e('0x13'));var as=require(_0x511e('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x511e('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x511e('0x16'));var licenseUtil=require(_0x511e('0x17'));var db=require(_0x511e('0x18'))['db'];config[_0x511e('0x19')]=_[_0x511e('0x1a')](config[_0x511e('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x511e('0x1b'))(new Redis(config[_0x511e('0x19')]));require('./mailAccount.socket')[_0x511e('0x1c')](socket);var jayson=require(_0x511e('0x1d'));var client=jayson['client'][_0x511e('0x1e')]({'port':0x232b});function respondWithRpcPromise(_0x162c91,_0x3b990b,_0x17fd4a,_0x5b6cd6){return new BPromise(function(_0x3e0415,_0x2dd346){var _0x2e66b6=_0x5b6cd6||client;return _0x2e66b6['request'](_0x162c91,_0x17fd4a)[_0x511e('0x1f')](function(_0x5bd814){logger[_0x511e('0x20')]('MailAccount,\x20%s,\x20%s',_0x3b990b,'request\x20sent');logger[_0x511e('0x21')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x3b990b,_0x511e('0x22'),JSON[_0x511e('0x23')](_0x5bd814));if(_0x5bd814[_0x511e('0x24')]){if(_0x5bd814[_0x511e('0x24')][_0x511e('0x25')]===0x1f4){logger[_0x511e('0x24')](_0x511e('0x26'),_0x3b990b,_0x5bd814[_0x511e('0x24')]['message']);return _0x2dd346(_0x5bd814[_0x511e('0x24')][_0x511e('0x27')]);}logger[_0x511e('0x24')](_0x511e('0x26'),_0x3b990b,_0x5bd814[_0x511e('0x24')][_0x511e('0x27')]);return _0x3e0415(_0x5bd814[_0x511e('0x24')][_0x511e('0x27')]);}else{logger[_0x511e('0x20')](_0x511e('0x26'),_0x3b990b,'request\x20sent');_0x3e0415(_0x5bd814['result'][_0x511e('0x27')]);}})['catch'](function(_0x1ff5c4){logger['error'](_0x511e('0x26'),_0x3b990b,_0x1ff5c4);_0x2dd346(_0x1ff5c4);});});}function respondWithStatusCode(_0x473f30,_0x406dfb){_0x406dfb=_0x406dfb||0xcc;return function(_0x1f8040){if(_0x1f8040){return _0x473f30[_0x511e('0x28')](_0x406dfb);}return _0x473f30[_0x511e('0x29')](_0x406dfb)[_0x511e('0x2a')]();};}function respondWithResult(_0x4d89a5,_0x309695){_0x309695=_0x309695||0xc8;return function(_0x2451c2){if(_0x2451c2){return _0x4d89a5['status'](_0x309695)[_0x511e('0x2b')](_0x2451c2);}};}function respondWithFilteredResult(_0x1d754d,_0xb563f6){return function(_0x1aaac1){if(_0x1aaac1){var _0x369be6=typeof _0xb563f6['offset']===_0x511e('0x2c')&&typeof _0xb563f6['limit']==='undefined';var _0x262dde=_0x1aaac1[_0x511e('0x2d')];var _0xa3b110=_0x369be6?0x0:_0xb563f6[_0x511e('0x2e')];var _0x432b5d=_0x369be6?_0x1aaac1['count']:_0xb563f6[_0x511e('0x2e')]+_0xb563f6[_0x511e('0x2f')];var _0xf2a22;if(_0x432b5d>=_0x262dde){_0x432b5d=_0x262dde;_0xf2a22=0xc8;}else{_0xf2a22=0xce;}_0x1d754d[_0x511e('0x29')](_0xf2a22);return _0x1d754d[_0x511e('0x30')]('Content-Range',_0xa3b110+'-'+_0x432b5d+'/'+_0x262dde)[_0x511e('0x2b')](_0x1aaac1);}return null;};}function patchUpdates(_0x32a749){return function(_0x1641e3){try{jsonpatch[_0x511e('0x31')](_0x1641e3,_0x32a749,!![]);}catch(_0xc9c9b9){return BPromise[_0x511e('0x32')](_0xc9c9b9);}return _0x1641e3[_0x511e('0x33')]();};}function saveUpdates(_0x1dc822,_0x5a881a){return function(_0x1b9cc8){if(_0x1b9cc8){return _0x1b9cc8[_0x511e('0x34')](_0x1dc822)[_0x511e('0x1f')](function(_0x3958cd){return _0x3958cd;});}return null;};}function removeEntity(_0x4d2bb8,_0x501398){return function(_0x3f6dfc){if(_0x3f6dfc){return _0x3f6dfc['destroy']()['then'](function(){var _0x256fd3=_0x3f6dfc[_0x511e('0x35')]({'plain':!![]});var _0x3d0b5d=_0x511e('0x36');return db[_0x511e('0x37')]['destroy']({'where':{'type':_0x3d0b5d,'resourceId':_0x256fd3['id']}})[_0x511e('0x1f')](function(){return _0x3f6dfc;});})[_0x511e('0x1f')](function(){_0x4d2bb8[_0x511e('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x38841b,_0xbba7ce){return function(_0x345ad3){if(!_0x345ad3){_0x38841b['sendStatus'](0x194);}return _0x345ad3;};}function handleError(_0x2e62d0,_0x2fd83d){_0x2fd83d=_0x2fd83d||0x1f4;return function(_0x4f124f){logger[_0x511e('0x24')](_0x4f124f[_0x511e('0x38')]);if(_0x4f124f[_0x511e('0x39')]){delete _0x4f124f[_0x511e('0x39')];}_0x2e62d0[_0x511e('0x29')](_0x2fd83d)[_0x511e('0x3a')](_0x4f124f);};}exports[_0x511e('0x3b')]=function(_0x8cc26e,_0xde4b8){var _0x217feb={'include':[{'model':db[_0x511e('0x3c')],'as':'Imap'},{'model':db['MailServerOut'],'as':_0x511e('0x3d')},{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x22de4f={},_0x4f1f1d={'count':0x0,'rows':[]};var _0x2ce210=_[_0x511e('0x3e')](db[_0x511e('0x3f')][_0x511e('0x40')],function(_0x474500){return{'name':_0x474500[_0x511e('0x41')],'type':_0x474500[_0x511e('0x42')][_0x511e('0x43')]};});_0x22de4f[_0x511e('0x44')]=_[_0x511e('0x3e')](_0x2ce210,_0x511e('0x39'));_0x22de4f[_0x511e('0x45')]=_[_0x511e('0x46')](_0x8cc26e[_0x511e('0x45')]);_0x22de4f['filters']=_['intersection'](_0x22de4f[_0x511e('0x44')],_0x22de4f[_0x511e('0x45')]);_0x217feb[_0x511e('0x47')]=_[_0x511e('0x48')](_0x22de4f[_0x511e('0x44')],qs['fields'](_0x8cc26e[_0x511e('0x45')][_0x511e('0x49')]));_0x217feb[_0x511e('0x47')]=_0x217feb['attributes']['length']?_0x217feb['attributes']:_0x22de4f[_0x511e('0x44')];if(!_0x8cc26e[_0x511e('0x45')][_0x511e('0x4a')]('nolimit')){_0x217feb['limit']=qs['limit'](_0x8cc26e[_0x511e('0x45')][_0x511e('0x2f')]);_0x217feb[_0x511e('0x2e')]=qs[_0x511e('0x2e')](_0x8cc26e[_0x511e('0x45')][_0x511e('0x2e')]);}_0x217feb[_0x511e('0x4b')]=qs[_0x511e('0x4c')](_0x8cc26e[_0x511e('0x45')][_0x511e('0x4c')]);_0x217feb[_0x511e('0x4d')]=qs[_0x511e('0x4e')](_[_0x511e('0x4f')](_0x8cc26e[_0x511e('0x45')],_0x22de4f[_0x511e('0x4e')]),_0x2ce210);if(_0x8cc26e[_0x511e('0x45')][_0x511e('0x50')]){_0x217feb[_0x511e('0x4d')]=_[_0x511e('0x51')](_0x217feb[_0x511e('0x4d')],{'$or':_[_0x511e('0x3e')](_0x2ce210,function(_0x3269bb){if(_0x3269bb[_0x511e('0x42')]!==_0x511e('0x52')){var _0x37bfdb={};_0x37bfdb[_0x3269bb[_0x511e('0x39')]]={'$like':'%'+_0x8cc26e[_0x511e('0x45')][_0x511e('0x50')]+'%'};return _0x37bfdb;}})});}_0x217feb=_[_0x511e('0x51')]({},_0x217feb,_0x8cc26e[_0x511e('0x53')]);var _0x1c9810={'where':_0x217feb['where']};return db[_0x511e('0x3f')]['count'](_0x1c9810)[_0x511e('0x1f')](function(_0x36c4db){_0x4f1f1d[_0x511e('0x2d')]=_0x36c4db;if(_0x8cc26e['query'][_0x511e('0x54')]){_0x217feb[_0x511e('0x55')]=[{'all':!![]}];}return db[_0x511e('0x3f')]['findAll'](_0x217feb);})[_0x511e('0x1f')](function(_0x32270b){_0x4f1f1d['rows']=_0x32270b;return _0x4f1f1d;})[_0x511e('0x1f')](respondWithFilteredResult(_0xde4b8,_0x217feb))[_0x511e('0x56')](handleError(_0xde4b8,null));};exports[_0x511e('0x57')]=function(_0x32df56,_0x523669){var _0x20c6a2={'raw':![],'where':{'id':_0x32df56[_0x511e('0x58')]['id']},'include':[{'model':db[_0x511e('0x3c')],'as':_0x511e('0x59')},{'model':db['MailServerOut'],'as':_0x511e('0x3d')},{'model':db['Pause'],'as':_0x511e('0x5a')}]},_0x4b9e48={};_0x4b9e48[_0x511e('0x44')]=_[_0x511e('0x46')](db[_0x511e('0x3f')][_0x511e('0x40')]);_0x4b9e48['query']=_[_0x511e('0x46')](_0x32df56[_0x511e('0x45')]);_0x4b9e48[_0x511e('0x4e')]=_[_0x511e('0x48')](_0x4b9e48[_0x511e('0x44')],_0x4b9e48[_0x511e('0x45')]);_0x20c6a2[_0x511e('0x47')]=_[_0x511e('0x48')](_0x4b9e48['model'],qs[_0x511e('0x49')](_0x32df56[_0x511e('0x45')]['fields']));_0x20c6a2[_0x511e('0x47')]=_0x20c6a2[_0x511e('0x47')][_0x511e('0x5b')]?_0x20c6a2[_0x511e('0x47')]:_0x4b9e48[_0x511e('0x44')];if(_0x32df56[_0x511e('0x45')]['includeAll']){_0x20c6a2[_0x511e('0x55')]=[{'all':!![]}];}_0x20c6a2=_[_0x511e('0x51')]({},_0x20c6a2,_0x32df56['options']);return db[_0x511e('0x3f')]['find'](_0x20c6a2)[_0x511e('0x1f')](handleEntityNotFound(_0x523669,null))[_0x511e('0x1f')](respondWithResult(_0x523669,null))['catch'](handleError(_0x523669,null));};exports['update']=function(_0x586931,_0x5a1511){if(_0x586931[_0x511e('0x5c')]['id']){delete _0x586931['body']['id'];}return db['MailAccount'][_0x511e('0x5d')]({'where':{'id':_0x586931[_0x511e('0x58')]['id']},'include':[{'model':db['MailServerIn'],'as':_0x511e('0x59')},{'model':db['MailServerOut'],'as':_0x511e('0x3d')},{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0x5a1511,null))[_0x511e('0x1f')](saveUpdates(_0x586931[_0x511e('0x5c')],null))['then'](function(_0x5983d8){if(_0x5983d8&&_0x586931['body']['Imap']){return db[_0x511e('0x3c')]['update'](_0x586931[_0x511e('0x5c')]['Imap'],{'where':{'MailAccountId':_0x5983d8['id']}})[_0x511e('0x1f')](function(){return _0x5983d8;});}return _0x5983d8;})[_0x511e('0x1f')](function(_0x3db652){if(_0x3db652&&_0x586931[_0x511e('0x5c')]['Smtp']){return db[_0x511e('0x5e')][_0x511e('0x34')](_0x586931[_0x511e('0x5c')][_0x511e('0x3d')],{'where':{'MailAccountId':_0x3db652['id']}})[_0x511e('0x1f')](function(){return _0x3db652;});}return _0x3db652;})['then'](respondWithResult(_0x5a1511,null))['catch'](handleError(_0x5a1511,null));};exports[_0x511e('0x5f')]=function(_0x915a44,_0x42cb48){return db[_0x511e('0x3f')][_0x511e('0x5f')]()[_0x511e('0x1f')](respondWithResult(_0x42cb48,null))[_0x511e('0x56')](handleError(_0x42cb48,null));};exports[_0x511e('0x60')]=function(_0x118582,_0x135ecb,_0x4b1137){if(_0x118582['body']['id']){delete _0x118582['body']['id'];}return db[_0x511e('0x3f')]['find']({'where':{'id':_0x118582[_0x511e('0x58')]['id']}})['then'](handleEntityNotFound(_0x135ecb,null))[_0x511e('0x1f')](function(_0x4a2969){if(_0x4a2969){_0x118582[_0x511e('0x5c')][_0x511e('0x61')]=_0x4a2969['id'];return db[_0x511e('0x62')][_0x511e('0x63')](_0x118582[_0x511e('0x5c')]);}})['then'](respondWithResult(_0x135ecb,null))[_0x511e('0x56')](handleError(_0x135ecb,null));};exports['getDispositions']=function(_0x435b2a,_0xdf5fca,_0x159a45){var _0x515644={'raw':![],'where':{}};var _0x76b6b0={};var _0x45eb71={'count':0x0,'rows':[]};return db[_0x511e('0x3f')][_0x511e('0x64')]({'where':{'id':_0x435b2a['params']['id']}})['then'](handleEntityNotFound(_0xdf5fca,null))[_0x511e('0x1f')](function(_0x657c7f){if(_0x657c7f){_0x76b6b0['model']=_[_0x511e('0x46')](db['Disposition'][_0x511e('0x40')]);_0x76b6b0[_0x511e('0x45')]=_['keys'](_0x435b2a['query']);_0x76b6b0[_0x511e('0x4e')]=_[_0x511e('0x48')](_0x76b6b0[_0x511e('0x44')],_0x76b6b0['query']);_0x515644[_0x511e('0x47')]=_[_0x511e('0x48')](_0x76b6b0[_0x511e('0x44')],qs[_0x511e('0x49')](_0x435b2a[_0x511e('0x45')][_0x511e('0x49')]));_0x515644[_0x511e('0x47')]=_0x515644['attributes'][_0x511e('0x5b')]?_0x515644[_0x511e('0x47')]:_0x76b6b0['model'];if(!_0x435b2a['query'][_0x511e('0x4a')](_0x511e('0x65'))){_0x515644['limit']=qs[_0x511e('0x2f')](_0x435b2a['query'][_0x511e('0x2f')]);_0x515644['offset']=qs['offset'](_0x435b2a[_0x511e('0x45')][_0x511e('0x2e')]);}_0x515644[_0x511e('0x4b')]=qs[_0x511e('0x4c')](_0x435b2a[_0x511e('0x45')]['sort']);_0x515644['where']=qs[_0x511e('0x4e')](_[_0x511e('0x4f')](_0x435b2a[_0x511e('0x45')],_0x76b6b0['filters']));_0x515644[_0x511e('0x4d')][_0x511e('0x61')]=_0x657c7f['id'];if(_0x435b2a['query']['filter']){_0x515644[_0x511e('0x4d')]=_[_0x511e('0x51')](_0x515644[_0x511e('0x4d')],{'$or':_[_0x511e('0x3e')](_0x515644[_0x511e('0x47')],function(_0x2b5de4){var _0x4f6ee9={};_0x4f6ee9[_0x2b5de4]={'$like':'%'+_0x435b2a[_0x511e('0x45')][_0x511e('0x50')]+'%'};return _0x4f6ee9;})});}_0x515644=_['merge']({},_0x515644,_0x435b2a['options']);return db[_0x511e('0x62')]['count']({'where':_0x515644[_0x511e('0x4d')]})['then'](function(_0x4b01e2){_0x45eb71[_0x511e('0x2d')]=_0x4b01e2;if(_0x435b2a[_0x511e('0x45')][_0x511e('0x54')]){_0x515644[_0x511e('0x55')]=[{'all':!![]}];}return db[_0x511e('0x62')][_0x511e('0x66')](_0x515644);})[_0x511e('0x1f')](function(_0x431d94){_0x45eb71[_0x511e('0x67')]=_0x431d94;return _0x45eb71;});}})[_0x511e('0x1f')](respondWithFilteredResult(_0xdf5fca,_0x515644))[_0x511e('0x56')](handleError(_0xdf5fca,null));};exports[_0x511e('0x68')]=function(_0x3b4712,_0x2f35cc,_0x34325f){return db[_0x511e('0x3f')]['find']({'where':{'id':_0x3b4712[_0x511e('0x58')]['id']}})[_0x511e('0x1f')](handleEntityNotFound(_0x2f35cc,null))[_0x511e('0x1f')](function(_0x20e3ee){if(_0x20e3ee){return _0x20e3ee[_0x511e('0x68')](_0x3b4712[_0x511e('0x45')][_0x511e('0x69')]);}})[_0x511e('0x1f')](respondWithStatusCode(_0x2f35cc,null))[_0x511e('0x56')](handleError(_0x2f35cc,null));};exports[_0x511e('0x6a')]=function(_0x277d5c,_0x5e9ad8,_0x200470){if(_0x277d5c[_0x511e('0x5c')]['id']){delete _0x277d5c[_0x511e('0x5c')]['id'];}return db[_0x511e('0x3f')]['find']({'where':{'id':_0x277d5c[_0x511e('0x58')]['id']}})[_0x511e('0x1f')](handleEntityNotFound(_0x5e9ad8,null))[_0x511e('0x1f')](function(_0x2e1750){if(_0x2e1750){_0x277d5c[_0x511e('0x5c')][_0x511e('0x61')]=_0x2e1750['id'];return db[_0x511e('0x6b')][_0x511e('0x63')](_0x277d5c[_0x511e('0x5c')]);}})[_0x511e('0x1f')](respondWithResult(_0x5e9ad8,null))['catch'](handleError(_0x5e9ad8,null));};exports[_0x511e('0x6c')]=function(_0x45014c,_0xe92f94,_0x44fe1a){var _0x2dba35={'raw':![],'where':{}};var _0x3d807a={};var _0x436e65={'count':0x0,'rows':[]};return db['MailAccount']['findOne']({'where':{'id':_0x45014c[_0x511e('0x58')]['id']}})[_0x511e('0x1f')](handleEntityNotFound(_0xe92f94,null))[_0x511e('0x1f')](function(_0x32fd22){if(_0x32fd22){_0x3d807a[_0x511e('0x44')]=_[_0x511e('0x46')](db[_0x511e('0x6b')][_0x511e('0x40')]);_0x3d807a[_0x511e('0x45')]=_[_0x511e('0x46')](_0x45014c['query']);_0x3d807a[_0x511e('0x4e')]=_[_0x511e('0x48')](_0x3d807a[_0x511e('0x44')],_0x3d807a[_0x511e('0x45')]);_0x2dba35[_0x511e('0x47')]=_['intersection'](_0x3d807a['model'],qs[_0x511e('0x49')](_0x45014c[_0x511e('0x45')][_0x511e('0x49')]));_0x2dba35[_0x511e('0x47')]=_0x2dba35['attributes'][_0x511e('0x5b')]?_0x2dba35[_0x511e('0x47')]:_0x3d807a['model'];if(!_0x45014c[_0x511e('0x45')]['hasOwnProperty'](_0x511e('0x65'))){_0x2dba35[_0x511e('0x2f')]=qs[_0x511e('0x2f')](_0x45014c[_0x511e('0x45')][_0x511e('0x2f')]);_0x2dba35[_0x511e('0x2e')]=qs[_0x511e('0x2e')](_0x45014c[_0x511e('0x45')][_0x511e('0x2e')]);}_0x2dba35[_0x511e('0x4b')]=qs[_0x511e('0x4c')](_0x45014c[_0x511e('0x45')][_0x511e('0x4c')]);_0x2dba35[_0x511e('0x4d')]=qs[_0x511e('0x4e')](_[_0x511e('0x4f')](_0x45014c[_0x511e('0x45')],_0x3d807a[_0x511e('0x4e')]));_0x2dba35['where'][_0x511e('0x61')]=_0x32fd22['id'];if(_0x45014c[_0x511e('0x45')][_0x511e('0x50')]){_0x2dba35[_0x511e('0x4d')]=_[_0x511e('0x51')](_0x2dba35['where'],{'$or':_[_0x511e('0x3e')](_0x2dba35[_0x511e('0x47')],function(_0x37ff18){var _0x51350a={};_0x51350a[_0x37ff18]={'$like':'%'+_0x45014c[_0x511e('0x45')][_0x511e('0x50')]+'%'};return _0x51350a;})});}_0x2dba35=_[_0x511e('0x51')]({},_0x2dba35,_0x45014c[_0x511e('0x53')]);return db['CannedAnswer']['count']({'where':_0x2dba35['where']})[_0x511e('0x1f')](function(_0x148871){_0x436e65['count']=_0x148871;if(_0x45014c[_0x511e('0x45')]['includeAll']){_0x2dba35[_0x511e('0x55')]=[{'all':!![]}];}return db['CannedAnswer'][_0x511e('0x66')](_0x2dba35);})[_0x511e('0x1f')](function(_0x507bab){_0x436e65[_0x511e('0x67')]=_0x507bab;return _0x436e65;});}})[_0x511e('0x1f')](respondWithFilteredResult(_0xe92f94,_0x2dba35))[_0x511e('0x56')](handleError(_0xe92f94,null));};exports[_0x511e('0x6d')]=function(_0x3debb7,_0x500557,_0x4a8843){return db['MailAccount']['find']({'where':{'id':_0x3debb7['params']['id']}})[_0x511e('0x1f')](handleEntityNotFound(_0x500557,null))[_0x511e('0x1f')](function(_0x43301c){if(_0x43301c){return _0x43301c['removeAnswers'](_0x3debb7[_0x511e('0x45')][_0x511e('0x69')]);}})[_0x511e('0x1f')](respondWithStatusCode(_0x500557,null))[_0x511e('0x56')](handleError(_0x500557,null));};exports[_0x511e('0x63')]=function(_0x31cdb3,_0x35e894){var _0x5e880f={'name':_0x31cdb3[_0x511e('0x5c')][_0x511e('0x39')],'key':_0x31cdb3[_0x511e('0x5c')]['key'],'email':_0x31cdb3[_0x511e('0x5c')][_0x511e('0x6e')],'ListId':_0x31cdb3['body'][_0x511e('0x6f')],'active':!_[_0x511e('0x70')](_0x31cdb3[_0x511e('0x5c')][_0x511e('0x71')])?_0x31cdb3[_0x511e('0x5c')]['active']:!![],'description':_0x31cdb3['body'][_0x511e('0x72')]||null,'Imap':{},'Smtp':{}};if(_[_0x511e('0x70')](_0x31cdb3[_0x511e('0x5c')][_0x511e('0x73')])){if(_0x31cdb3['body'][_0x511e('0x74')]){_0x5e880f[_0x511e('0x59')][_0x511e('0x75')]=_0x5e880f[_0x511e('0x3d')][_0x511e('0x75')]=_0x31cdb3[_0x511e('0x5c')][_0x511e('0x76')];_0x5e880f[_0x511e('0x59')][_0x511e('0x77')]=_0x5e880f['Smtp']['pass']=_0x31cdb3[_0x511e('0x5c')]['cpassword'];}else{_0x5e880f[_0x511e('0x59')][_0x511e('0x78')]=_0x5e880f[_0x511e('0x3d')][_0x511e('0x78')]=![];}_0x5e880f[_0x511e('0x59')][_0x511e('0x79')]=_0x31cdb3[_0x511e('0x5c')]['Imap'][_0x511e('0x79')];_0x5e880f['Imap'][_0x511e('0x7a')]=_0x31cdb3[_0x511e('0x5c')][_0x511e('0x59')][_0x511e('0x7a')];_0x5e880f[_0x511e('0x3d')][_0x511e('0x79')]=_0x31cdb3[_0x511e('0x5c')][_0x511e('0x3d')][_0x511e('0x79')];_0x5e880f['Smtp'][_0x511e('0x7a')]=_0x31cdb3[_0x511e('0x5c')][_0x511e('0x3d')]['port'];}else{_0x5e880f[_0x511e('0x59')][_0x511e('0x7b')]=_0x5e880f[_0x511e('0x3d')][_0x511e('0x7b')]=_0x31cdb3[_0x511e('0x5c')]['cservice'];_0x5e880f[_0x511e('0x59')][_0x511e('0x75')]=_0x5e880f['Smtp'][_0x511e('0x75')]=_0x31cdb3['body'][_0x511e('0x76')];_0x5e880f[_0x511e('0x59')]['password']=_0x5e880f[_0x511e('0x3d')][_0x511e('0x7c')]=_0x31cdb3['body']['cpassword'];}return db['MailAccount'][_0x511e('0x63')](_0x5e880f,{'include':[{'model':db[_0x511e('0x5e')],'as':'Smtp'},{'model':db[_0x511e('0x3c')],'as':_0x511e('0x59')}]})[_0x511e('0x1f')](function(_0x49cb10){var _0x2a154f=_0x31cdb3[_0x511e('0x75')]['get']({'plain':!![]});if(!_0x2a154f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2a154f[_0x511e('0x7d')]===_0x511e('0x75')){var _0x1822e6=_0x49cb10[_0x511e('0x35')]({'plain':!![]});return db[_0x511e('0x7e')]['find']({'where':{'name':_0x511e('0x36'),'userProfileId':_0x2a154f[_0x511e('0x7f')]},'raw':!![]})[_0x511e('0x1f')](function(_0x2a5c00){if(_0x2a5c00&&_0x2a5c00['autoAssociation']===0x0){return db['UserProfileResource'][_0x511e('0x63')]({'name':_0x1822e6[_0x511e('0x39')],'resourceId':_0x1822e6['id'],'type':_0x2a5c00[_0x511e('0x39')],'sectionId':_0x2a5c00['id']},{})['then'](function(){return _0x49cb10;});}else{return _0x49cb10;}})[_0x511e('0x56')](function(_0x42bd60){logger[_0x511e('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x42bd60);throw _0x42bd60;});}return _0x49cb10;})['then'](respondWithResult(_0x35e894,0xc9))[_0x511e('0x56')](handleError(_0x35e894,null));};exports[_0x511e('0x80')]=function(_0x128713,_0x39ad5e,_0x558d56){return db['MailAccount']['findOne']({'where':{'id':_0x128713['params']['id']}})[_0x511e('0x1f')](handleEntityNotFound(_0x39ad5e,null))[_0x511e('0x1f')](function(_0xa2b3e8){if(_0xa2b3e8){return _0xa2b3e8[_0x511e('0x80')]();}return null;})['then'](respondWithResult(_0x39ad5e,null))['catch'](handleError(_0x39ad5e,null));};exports[_0x511e('0x81')]=function(_0x3ca915,_0x1111df,_0x21e4ad){if(_0x3ca915['body']['id']){delete _0x3ca915[_0x511e('0x5c')]['id'];}return db[_0x511e('0x3f')]['find']({'where':{'id':_0x3ca915[_0x511e('0x58')]['id']}})[_0x511e('0x1f')](handleEntityNotFound(_0x1111df,null))['then'](function(_0x29bc26){if(_0x29bc26){_0x3ca915[_0x511e('0x5c')]['MailAccountId']=_0x29bc26['id'];return db[_0x511e('0x3c')][_0x511e('0x63')](_0x3ca915['body']);}})[_0x511e('0x1f')](respondWithResult(_0x1111df,null))['catch'](handleError(_0x1111df,null));};exports[_0x511e('0x82')]=function(_0x326031,_0x2c85f1,_0x3c2a3a){return db[_0x511e('0x3f')][_0x511e('0x64')]({'where':{'id':_0x326031[_0x511e('0x58')]['id']}})[_0x511e('0x1f')](handleEntityNotFound(_0x2c85f1,null))[_0x511e('0x1f')](function(_0x119d5a){if(_0x119d5a){return _0x119d5a['setImap'](null);}return null;})[_0x511e('0x1f')](respondWithStatusCode(_0x2c85f1,null))[_0x511e('0x56')](handleError(_0x2c85f1,null));};exports[_0x511e('0x83')]=function(_0xd0a5c5,_0x38e1df,_0x4d35b9){return db[_0x511e('0x3f')]['findOne']({'where':{'id':_0xd0a5c5[_0x511e('0x58')]['id']}})['then'](handleEntityNotFound(_0x38e1df,null))[_0x511e('0x1f')](function(_0x42c806){if(_0x42c806){return _0x42c806[_0x511e('0x83')]();}return null;})[_0x511e('0x1f')](respondWithResult(_0x38e1df,null))[_0x511e('0x56')](handleError(_0x38e1df,null));};exports[_0x511e('0x84')]=function(_0x2eb47e,_0x277c45,_0x37e9d0){if(_0x2eb47e['body']['id']){delete _0x2eb47e[_0x511e('0x5c')]['id'];}return db[_0x511e('0x3f')][_0x511e('0x5d')]({'where':{'id':_0x2eb47e[_0x511e('0x58')]['id']}})[_0x511e('0x1f')](handleEntityNotFound(_0x277c45,null))[_0x511e('0x1f')](function(_0x7e456e){if(_0x7e456e){_0x2eb47e[_0x511e('0x5c')]['MailAccountId']=_0x7e456e['id'];return db[_0x511e('0x5e')][_0x511e('0x63')](_0x2eb47e[_0x511e('0x5c')]);}})[_0x511e('0x1f')](respondWithResult(_0x277c45,null))[_0x511e('0x56')](handleError(_0x277c45,null));};exports[_0x511e('0x85')]=function(_0x16a3e8,_0x504541,_0x5c1843){return db[_0x511e('0x3f')][_0x511e('0x64')]({'where':{'id':_0x16a3e8[_0x511e('0x58')]['id']}})['then'](handleEntityNotFound(_0x504541,null))[_0x511e('0x1f')](function(_0x21cb35){if(_0x21cb35){return _0x21cb35[_0x511e('0x86')](null);}return null;})['then'](respondWithStatusCode(_0x504541,null))[_0x511e('0x56')](handleError(_0x504541,null));};exports['addInteraction']=function(_0x139d09,_0x5412fc,_0x3a578b){return db[_0x511e('0x87')][_0x511e('0x5d')]({'where':{'id':_0x139d09[_0x511e('0x58')]['id']}})[_0x511e('0x1f')](handleEntityNotFound(_0x5412fc,null))[_0x511e('0x1f')](function(_0x12ae73){if(_0x12ae73){return _0x12ae73['addInteraction'](_0x139d09['body'][_0x511e('0x69')],_[_0x511e('0x88')](_0x139d09[_0x511e('0x5c')],[_0x511e('0x69'),'id'])||{});}})['then'](respondWithResult(_0x5412fc,null))[_0x511e('0x56')](handleError(_0x5412fc,null));};exports[_0x511e('0x89')]=function(_0x162636,_0xc60f3c,_0x57bbec){var _0x42fb60={'raw':![],'where':{}};var _0x56ea62={};var _0x4fb9cb={'count':0x0,'rows':[]};return db[_0x511e('0x3f')][_0x511e('0x64')]({'where':{'id':_0x162636[_0x511e('0x58')]['id']}})[_0x511e('0x1f')](handleEntityNotFound(_0xc60f3c,null))[_0x511e('0x1f')](function(_0x19f778){if(_0x19f778){_0x56ea62[_0x511e('0x44')]=_['keys'](db[_0x511e('0x87')][_0x511e('0x40')]);_0x56ea62['query']=_['keys'](_0x162636[_0x511e('0x45')]);_0x56ea62[_0x511e('0x4e')]=_[_0x511e('0x48')](_0x56ea62[_0x511e('0x44')],_0x56ea62['query']);_0x42fb60[_0x511e('0x47')]=_[_0x511e('0x48')](_0x56ea62[_0x511e('0x44')],qs['fields'](_0x162636[_0x511e('0x45')]['fields']));_0x42fb60[_0x511e('0x47')]=_0x42fb60[_0x511e('0x47')]['length']?_0x42fb60[_0x511e('0x47')]:_0x56ea62['model'];if(!_0x162636[_0x511e('0x45')]['hasOwnProperty'](_0x511e('0x65'))){_0x42fb60[_0x511e('0x2f')]=qs['limit'](_0x162636[_0x511e('0x45')][_0x511e('0x2f')]);_0x42fb60[_0x511e('0x2e')]=qs[_0x511e('0x2e')](_0x162636[_0x511e('0x45')][_0x511e('0x2e')]);}_0x42fb60['order']=qs['sort'](_0x162636['query'][_0x511e('0x4c')]);_0x42fb60[_0x511e('0x4d')]=qs['filters'](_[_0x511e('0x4f')](_0x162636[_0x511e('0x45')],_0x56ea62[_0x511e('0x4e')]));_0x42fb60[_0x511e('0x4d')][_0x511e('0x61')]=_0x19f778['id'];if(_0x162636[_0x511e('0x45')]['filter']){_0x42fb60[_0x511e('0x4d')]=_['merge'](_0x42fb60['where'],{'$or':_[_0x511e('0x3e')](_0x42fb60[_0x511e('0x47')],function(_0x4ac923){var _0x314d67={};_0x314d67[_0x4ac923]={'$like':'%'+_0x162636[_0x511e('0x45')][_0x511e('0x50')]+'%'};return _0x314d67;})});}_0x42fb60=_[_0x511e('0x51')]({},_0x42fb60,_0x162636['options']);return db[_0x511e('0x87')][_0x511e('0x2d')]({'where':_0x42fb60[_0x511e('0x4d')]})[_0x511e('0x1f')](function(_0x14a1ed){_0x4fb9cb[_0x511e('0x2d')]=_0x14a1ed;if(_0x162636['query'][_0x511e('0x54')]){_0x42fb60[_0x511e('0x55')]=[{'model':db['CmContact'],'as':_0x511e('0x8a'),'required':![]},{'model':db['User'],'as':_0x511e('0x8b'),'attributes':[_0x511e('0x39'),'fullname',_0x511e('0x8c')],'required':![]},{'model':db[_0x511e('0x8d')],'as':'Tags','attributes':['id',_0x511e('0x39'),_0x511e('0x8e')],'where':_0x162636[_0x511e('0x45')][_0x511e('0x8f')]?{'id':_0x162636[_0x511e('0x45')]['tag']}:undefined,'required':_0x162636[_0x511e('0x45')][_0x511e('0x8f')]?!![]:![]}];}return db['MailInteraction'][_0x511e('0x66')](_0x42fb60);})[_0x511e('0x1f')](function(_0x31cb07){_0x4fb9cb['rows']=_0x31cb07;return _0x4fb9cb;});}})[_0x511e('0x1f')](respondWithFilteredResult(_0xc60f3c,_0x42fb60))[_0x511e('0x56')](handleError(_0xc60f3c,null));};exports[_0x511e('0x90')]=function(_0x40fd32,_0x471163,_0x499a57){return db['MailAccount'][_0x511e('0x64')]({'where':{'id':_0x40fd32[_0x511e('0x58')]['id']}})[_0x511e('0x1f')](handleEntityNotFound(_0x471163,null))[_0x511e('0x1f')](function(_0x4aba63){if(_0x4aba63){return db[_0x511e('0x91')]['transaction'](function(_0x32f506){return db[_0x511e('0x92')][_0x511e('0x93')]({'where':{'MailAccountId':_0x40fd32[_0x511e('0x58')]['id']},'transaction':_0x32f506})['then'](function(_0x438659){var _0x17f89d=_[_0x511e('0x3e')](_0x40fd32[_0x511e('0x5c')],function(_0x3ef308){_0x3ef308[_0x511e('0x61')]=_0x40fd32[_0x511e('0x58')]['id'];return _0x3ef308;});return db[_0x511e('0x92')]['bulkCreate'](_0x17f89d,{'transaction':_0x32f506});});})[_0x511e('0x1f')](function(){return db[_0x511e('0x92')][_0x511e('0x94')]({'where':{'MailAccountId':_0x40fd32[_0x511e('0x58')]['id']},'order':_0x511e('0x95')});});}})[_0x511e('0x1f')](respondWithResult(_0x471163,null))[_0x511e('0x56')](handleError(_0x471163,null));};exports[_0x511e('0x96')]=function(_0x346226,_0x132390,_0x3517ad){var _0x483e6c={};var _0x1199be={};var _0x426f38;var _0x4c21e3;return db[_0x511e('0x3f')]['findOne']({'where':{'id':_0x346226[_0x511e('0x58')]['id']}})[_0x511e('0x1f')](handleEntityNotFound(_0x132390,null))['then'](function(_0x24711f){if(_0x24711f){_0x426f38=_0x24711f;_0x1199be[_0x511e('0x44')]=_[_0x511e('0x46')](db[_0x511e('0x92')][_0x511e('0x40')]);_0x1199be[_0x511e('0x45')]=_['keys'](_0x346226[_0x511e('0x45')]);_0x1199be[_0x511e('0x4e')]=_['intersection'](_0x1199be['model'],_0x1199be[_0x511e('0x45')]);_0x483e6c['attributes']=_['intersection'](_0x1199be[_0x511e('0x44')],qs[_0x511e('0x49')](_0x346226[_0x511e('0x45')][_0x511e('0x49')]));_0x483e6c[_0x511e('0x47')]=_0x483e6c['attributes'][_0x511e('0x5b')]?_0x483e6c['attributes']:_0x1199be[_0x511e('0x44')];_0x483e6c[_0x511e('0x4b')]=qs[_0x511e('0x4c')](_0x346226[_0x511e('0x45')][_0x511e('0x4c')]);_0x483e6c[_0x511e('0x4d')]=qs['filters'](_[_0x511e('0x4f')](_0x346226[_0x511e('0x45')],_0x1199be[_0x511e('0x4e')]));if(_0x346226[_0x511e('0x45')][_0x511e('0x50')]){_0x483e6c[_0x511e('0x4d')]=_[_0x511e('0x51')](_0x483e6c[_0x511e('0x4d')],{'$or':_['map'](_0x483e6c['attributes'],function(_0x16832b){var _0x476507={};_0x476507[_0x16832b]={'$like':'%'+_0x346226[_0x511e('0x45')][_0x511e('0x50')]+'%'};return _0x476507;})});}_0x483e6c=_[_0x511e('0x51')]({},_0x483e6c,_0x346226[_0x511e('0x53')]);return _0x426f38[_0x511e('0x96')](_0x483e6c);}})[_0x511e('0x1f')](function(_0xb246ec){if(_0xb246ec){_0x4c21e3=_0xb246ec[_0x511e('0x5b')];if(!_0x346226[_0x511e('0x45')][_0x511e('0x4a')](_0x511e('0x65'))){_0x483e6c[_0x511e('0x2f')]=qs[_0x511e('0x2f')](_0x346226[_0x511e('0x45')]['limit']);_0x483e6c[_0x511e('0x2e')]=qs[_0x511e('0x2e')](_0x346226[_0x511e('0x45')][_0x511e('0x2e')]);}return _0x426f38[_0x511e('0x96')](_0x483e6c);}})[_0x511e('0x1f')](function(_0xbad8fa){if(_0xbad8fa){return _0xbad8fa?{'count':_0x4c21e3,'rows':_0xbad8fa}:null;}})[_0x511e('0x1f')](respondWithResult(_0x132390,null))['catch'](handleError(_0x132390,null));};exports[_0x511e('0x97')]=function(_0x48521b,_0x211ef1,_0x1a0715){var _0x5b48be={'raw':!![],'where':{}};var _0x5650d1={};var _0x44b927={'count':0x0,'rows':[]};return db[_0x511e('0x3f')][_0x511e('0x64')]({'where':{'id':_0x48521b[_0x511e('0x58')]['id']}})[_0x511e('0x1f')](handleEntityNotFound(_0x211ef1,null))['then'](function(_0x5cd920){if(_0x5cd920){_0x5650d1[_0x511e('0x44')]=_['keys'](db[_0x511e('0x98')][_0x511e('0x40')]);_0x5650d1[_0x511e('0x45')]=_['keys'](_0x48521b[_0x511e('0x45')]);_0x5650d1['filters']=_[_0x511e('0x48')](_0x5650d1['model'],_0x5650d1['query']);_0x5b48be[_0x511e('0x47')]=_[_0x511e('0x48')](_0x5650d1['model'],qs['fields'](_0x48521b[_0x511e('0x45')][_0x511e('0x49')]));_0x5b48be[_0x511e('0x47')]=_0x5b48be[_0x511e('0x47')]['length']?_0x5b48be[_0x511e('0x47')]:_0x5650d1[_0x511e('0x44')];if(!_0x48521b[_0x511e('0x45')][_0x511e('0x4a')](_0x511e('0x65'))){_0x5b48be[_0x511e('0x2f')]=qs[_0x511e('0x2f')](_0x48521b[_0x511e('0x45')][_0x511e('0x2f')]);_0x5b48be[_0x511e('0x2e')]=qs[_0x511e('0x2e')](_0x48521b['query']['offset']);}_0x5b48be[_0x511e('0x4b')]=qs[_0x511e('0x4c')](_0x48521b['query'][_0x511e('0x4c')]);_0x5b48be[_0x511e('0x4d')]=qs[_0x511e('0x4e')](_[_0x511e('0x4f')](_0x48521b[_0x511e('0x45')],_0x5650d1[_0x511e('0x4e')]));_0x5b48be[_0x511e('0x4d')][_0x511e('0x61')]=_0x5cd920['id'];if(_0x48521b[_0x511e('0x45')][_0x511e('0x50')]){_0x5b48be['where']=_[_0x511e('0x51')](_0x5b48be[_0x511e('0x4d')],{'$or':_[_0x511e('0x3e')](_0x5b48be['attributes'],function(_0x450777){var _0x555880={};_0x555880[_0x450777]={'$like':'%'+_0x48521b[_0x511e('0x45')][_0x511e('0x50')]+'%'};return _0x555880;})});}if(_0x48521b[_0x511e('0x45')][_0x511e('0x99')]){var _0x90a69c=_0x48521b['query'][_0x511e('0x99')][_0x511e('0x9a')](',');var _0x1e4d32={};_0x1e4d32[_0x90a69c[0x0]]={'$gte':moment(_0x90a69c[0x1])[_0x511e('0x9b')](_0x511e('0x9c'))};_0x5b48be[_0x511e('0x4d')]=_[_0x511e('0x51')](_0x5b48be[_0x511e('0x4d')],_0x1e4d32);}_0x5b48be=_[_0x511e('0x51')]({},_0x5b48be,_0x48521b[_0x511e('0x53')]);return db['MailMessage'][_0x511e('0x2d')]({'where':_0x5b48be[_0x511e('0x4d')]})[_0x511e('0x1f')](function(_0x415a2c){_0x44b927[_0x511e('0x2d')]=_0x415a2c;if(_0x48521b['query'][_0x511e('0x54')]){_0x5b48be['include']=[{'all':!![]}];}return db[_0x511e('0x98')][_0x511e('0x66')](_0x5b48be);})[_0x511e('0x1f')](function(_0x58b87a){if(_0x48521b[_0x511e('0x45')][_0x511e('0x9d')]==='true'){for(var _0x1cfc10=0x0;_0x1cfc10<_0x58b87a['length'];_0x1cfc10++){_0x58b87a[_0x1cfc10][_0x511e('0x5c')]=juice(_0x58b87a[_0x1cfc10][_0x511e('0x5c')]);}}_0x44b927[_0x511e('0x67')]=_0x58b87a;return _0x44b927;});}})[_0x511e('0x1f')](respondWithFilteredResult(_0x211ef1,_0x5b48be))[_0x511e('0x56')](handleError(_0x211ef1,null));};exports[_0x511e('0x3a')]=function(_0x19367e,_0x2ea631,_0x3ce851){var _0xe006a9,_0x59d3ed={},_0x1877dc;if(_0x19367e[_0x511e('0x5c')]['to']){_0x1877dc=_0x19367e[_0x511e('0x5c')]['to'][_0x511e('0x9a')](',')[0x0];}return db[_0x511e('0x3f')]['find']({'where':{'id':_0x19367e[_0x511e('0x58')]['id']},'include':[{'model':db[_0x511e('0x9e')],'as':_0x511e('0x9f'),'include':[{'model':db['CmContact'],'as':_0x511e('0xa0'),'where':{'email':_0x1877dc},'limit':0x1,'order':[['updatedAt',_0x511e('0xa1')]]}]},{'model':db[_0x511e('0x5e')],'as':_0x511e('0x3d'),'raw':!![]}]})[_0x511e('0x1f')](handleEntityNotFound(_0x2ea631,null))['then'](function(_0x4b5952){if(_0x4b5952){_0xe006a9=_0x4b5952;if(_0x4b5952['Smtp']){if(_[_0x511e('0x70')](_0x19367e[_0x511e('0x5c')][_0x511e('0xa2')])){_0x19367e['body'][_0x511e('0xa2')]=util[_0x511e('0x9b')]('%s\x20<%s>',_0x4b5952[_0x511e('0x39')],_0x4b5952[_0x511e('0x6e')]||_0x4b5952[_0x511e('0x3d')][_0x511e('0x75')]);}if(_0x19367e['body'][_0x511e('0xa3')]&&_0x19367e['body'][_0x511e('0xa3')][_0x511e('0x5b')]){for(var _0x2c57fe=0x0;_0x2c57fe<_0x19367e[_0x511e('0x5c')]['attachments'][_0x511e('0x5b')];_0x2c57fe+=0x1){_0x19367e[_0x511e('0x5c')]['attachments'][_0x2c57fe]={'filename':_0x19367e[_0x511e('0x5c')][_0x511e('0xa3')][_0x2c57fe]['name'],'path':path[_0x511e('0xa4')](config[_0x511e('0xa5')],_0x511e('0xa6'),_0x19367e['body']['attachments'][_0x2c57fe][_0x511e('0xa7')])};}}var _0x3aa178={'tls':{'rejectUnauthorized':![]}};if(_[_0x511e('0x70')](_0x4b5952[_0x511e('0x3d')][_0x511e('0x7b')])){if(_0x4b5952['Smtp'][_0x511e('0x78')]){_0x3aa178[_0x511e('0xa8')]={'user':_0x4b5952[_0x511e('0x3d')][_0x511e('0x75')],'pass':_0x4b5952[_0x511e('0x3d')][_0x511e('0x7c')]};}_0x3aa178[_0x511e('0x79')]=_0x4b5952['Smtp']['host'];_0x3aa178[_0x511e('0x7a')]=_0x4b5952['Smtp'][_0x511e('0x7a')];_0x3aa178[_0x511e('0xa9')]=_0x4b5952['Smtp'][_0x511e('0xa9')];}else{_0x3aa178['service']=_0x4b5952[_0x511e('0x3d')][_0x511e('0x7b')];_0x3aa178['auth']={'user':_0x4b5952[_0x511e('0x3d')][_0x511e('0x75')],'pass':_0x4b5952[_0x511e('0x3d')][_0x511e('0x7c')]};}return respondWithRpcPromise(_0x511e('0xaa'),_0x511e('0xab'),{'account':_0x3aa178,'message':_0x19367e[_0x511e('0x5c')]});}else{throw new Error(_0x511e('0xac'));}}})[_0x511e('0x1f')](function(_0x3ded88){if(_0x3ded88){_0x59d3ed=_0x3ded88;if(_0xe006a9['List']){if(_0xe006a9['List'][_0x511e('0xa0')][_0x511e('0x5b')]){return _0xe006a9[_0x511e('0x9f')][_0x511e('0xa0')][0x0];}else{return db['CmContact'][_0x511e('0x63')](_[_0x511e('0x1a')](_0x19367e[_0x511e('0x5c')],{'firstName':_0x19367e[_0x511e('0x5c')]['to'],'email':_0x19367e['body']['to'],'phone':_0x19367e[_0x511e('0x5c')]['to'],'ListId':_0xe006a9[_0x511e('0x6f')]}));}}else{throw new Error('List\x20not\x20found');}}})[_0x511e('0x1f')](function(_0x49e71e){if(_0x49e71e){var _0x98e065={'UserId':_0x19367e['user']['id'],'ContactId':_0x49e71e['id'],'MailAccountId':_0xe006a9['id'],'inReplyTo':_0x59d3ed[_0x511e('0xad')],'to':_0x19367e[_0x511e('0x5c')]['from'],'cc':_0x19367e[_0x511e('0x5c')]['cc'],'subject':_0x19367e['body'][_0x511e('0xae')],'attach':_0x19367e[_0x511e('0x5c')]['attach'],'firstMsgDirection':_0x511e('0xaf'),'lastMsgAt':moment()['format'](_0x511e('0x9c')),'lastMsgDirection':_0x511e('0xaf'),'Messages':[_['merge'](_0x19367e[_0x511e('0x5c')],{'messageId':_0x59d3ed[_0x511e('0xad')],'sentAt':moment()[_0x511e('0x9b')](_0x511e('0x9c')),'read':!![],'MailAccountId':_0xe006a9['id'],'UserId':_0x19367e[_0x511e('0x75')]['id'],'ContactId':_0x49e71e['id']})]};if(_0x19367e[_0x511e('0x5c')]['Interaction']){_0x98e065=_['merge'](_0x98e065,_0x19367e[_0x511e('0x5c')][_0x511e('0xb0')]);}return db[_0x511e('0x87')][_0x511e('0x63')](_0x98e065,{'include':[{'model':db[_0x511e('0x98')],'as':_0x511e('0xb1')}]});}})['then'](respondWithResult(_0x2ea631,null))[_0x511e('0x56')](handleError(_0x2ea631,null));};exports[_0x511e('0xb2')]=function(_0x3431aa,_0x28fccd,_0x439d93){return db['MailAccount'][_0x511e('0x5d')]({'where':{'id':_0x3431aa[_0x511e('0x58')]['id']},'include':[{'model':db[_0x511e('0x5e')],'as':_0x511e('0x3d'),'raw':!![]}]})[_0x511e('0x1f')](handleEntityNotFound(_0x28fccd,null))[_0x511e('0x1f')](function(_0x29b17a){if(_0x29b17a&&_0x29b17a[_0x511e('0x3d')]){var _0x474722={'id':_0x29b17a['id'],'tls':{'rejectUnauthorized':![]}};if(_0x29b17a[_0x511e('0x3d')]['service']){_0x474722[_0x511e('0x7b')]=_0x29b17a[_0x511e('0x3d')]['service'];}else{_0x474722[_0x511e('0x79')]=_0x29b17a[_0x511e('0x3d')][_0x511e('0x79')];_0x474722[_0x511e('0x7a')]=_0x29b17a['Smtp'][_0x511e('0x7a')];_0x474722['secure']=_0x29b17a[_0x511e('0x3d')][_0x511e('0xa9')];}if(_0x29b17a[_0x511e('0x3d')][_0x511e('0x78')]){_0x474722[_0x511e('0xa8')]={'user':_0x29b17a['Smtp'][_0x511e('0x75')],'pass':_0x29b17a[_0x511e('0x3d')][_0x511e('0x7c')]};}return respondWithRpcPromise(_0x511e('0xb3'),_0x511e('0xb2'),{'account':_0x474722});}})[_0x511e('0x1f')](respondWithResult(_0x28fccd,null))[_0x511e('0x56')](handleError(_0x28fccd,null));};exports['destroy']=function(_0x2a55aa,_0x4a48eb){return db[_0x511e('0x3f')][_0x511e('0x5d')]({'where':{'id':_0x2a55aa['params']['id']}})['then'](handleEntityNotFound(_0x4a48eb,null))[_0x511e('0x1f')](function(_0x3a59df){if(_0x3a59df&&_0x3a59df['service']){throw new db[(_0x511e('0xb4'))][(_0x511e('0xb5'))](_0x511e('0xb6'));}return _0x3a59df;})[_0x511e('0x1f')](removeEntity(_0x4a48eb,null))[_0x511e('0x56')](handleError(_0x4a48eb,null));};exports[_0x511e('0xb7')]=function(_0x3a4c6e,_0x4f464e,_0x3d2f3d){return db[_0x511e('0x3f')][_0x511e('0x5d')]({'where':{'id':_0x3a4c6e['params']['id']}})['then'](handleEntityNotFound(_0x4f464e,null))[_0x511e('0x1f')](function(_0x40ed3a){if(_0x40ed3a){return _0x40ed3a[_0x511e('0xb7')](_0x3a4c6e['body'][_0x511e('0x69')],_[_0x511e('0x88')](_0x3a4c6e[_0x511e('0x5c')],[_0x511e('0x69'),'id'])||{})['spread'](function(_0x5861e5){for(var _0x1db11e=0x0;_0x1db11e<_0x3a4c6e[_0x511e('0x5c')][_0x511e('0x69')][_0x511e('0x5b')];_0x1db11e+=0x1){socket[_0x511e('0xb8')]('userMailAccount:save',{'UserId':_0x3a4c6e[_0x511e('0x5c')][_0x511e('0x69')][_0x1db11e],'MailAccountId':_0x3a4c6e[_0x511e('0x58')]['id']});}return _0x5861e5;});}})[_0x511e('0x1f')](respondWithResult(_0x4f464e,null))[_0x511e('0x56')](handleError(_0x4f464e,null));};exports[_0x511e('0xb9')]=function(_0x5e05e7,_0x1ab66a,_0x225705){return db['MailAccount'][_0x511e('0x5d')]({'where':{'id':_0x5e05e7[_0x511e('0x58')]['id']}})[_0x511e('0x1f')](handleEntityNotFound(_0x1ab66a,null))[_0x511e('0x1f')](function(_0xe8b601){if(_0xe8b601){return _0xe8b601['removeAgents'](_0x5e05e7[_0x511e('0x45')][_0x511e('0x69')])[_0x511e('0x1f')](function(){if(_[_0x511e('0xba')](_0x5e05e7[_0x511e('0x45')][_0x511e('0x69')])){for(var _0x31aa19=0x0;_0x31aa19<_0x5e05e7[_0x511e('0x45')][_0x511e('0x69')][_0x511e('0x5b')];_0x31aa19+=0x1){socket['emit'](_0x511e('0xbb'),{'UserId':Number(_0x5e05e7[_0x511e('0x45')][_0x511e('0x69')][_0x31aa19]),'MailAccountId':Number(_0x5e05e7[_0x511e('0x58')]['id'])});}}else{socket['emit']('userMailAccount:remove',{'UserId':Number(_0x5e05e7[_0x511e('0x45')][_0x511e('0x69')]),'MailAccountId':Number(_0x5e05e7[_0x511e('0x58')]['id'])});}});}})[_0x511e('0x1f')](respondWithStatusCode(_0x1ab66a,null))['catch'](handleError(_0x1ab66a,null));};exports['getAgents']=function(_0x389a1d,_0x25dfef,_0x3ee070){var _0x507879={};var _0x143864={};var _0x4562be;var _0x1ac898;return db['MailAccount']['findOne']({'where':{'id':_0x389a1d[_0x511e('0x58')]['id']}})[_0x511e('0x1f')](handleEntityNotFound(_0x25dfef,null))['then'](function(_0x3de4bf){if(_0x3de4bf){_0x4562be=_0x3de4bf;_0x143864['model']=_[_0x511e('0x46')](db[_0x511e('0xbc')][_0x511e('0x40')]);_0x143864[_0x511e('0x45')]=_[_0x511e('0x46')](_0x389a1d[_0x511e('0x45')]);_0x143864[_0x511e('0x4e')]=_[_0x511e('0x48')](_0x143864[_0x511e('0x44')],_0x143864[_0x511e('0x45')]);_0x507879['attributes']=_['intersection'](_0x143864[_0x511e('0x44')],qs[_0x511e('0x49')](_0x389a1d[_0x511e('0x45')][_0x511e('0x49')]));_0x507879[_0x511e('0x47')]=_0x507879[_0x511e('0x47')][_0x511e('0x5b')]?_0x507879[_0x511e('0x47')]:_0x143864[_0x511e('0x44')];_0x507879['order']=qs[_0x511e('0x4c')](_0x389a1d[_0x511e('0x45')]['sort']);_0x507879['where']=qs[_0x511e('0x4e')](_['pick'](_0x389a1d['query'],_0x143864[_0x511e('0x4e')]));if(_0x389a1d[_0x511e('0x45')][_0x511e('0x50')]){_0x507879[_0x511e('0x4d')]=_[_0x511e('0x51')](_0x507879[_0x511e('0x4d')],{'$or':_[_0x511e('0x3e')](_0x507879[_0x511e('0x47')],function(_0xff074e){var _0x3be886={};_0x3be886[_0xff074e]={'$like':'%'+_0x389a1d[_0x511e('0x45')]['filter']+'%'};return _0x3be886;})});}_0x507879=_[_0x511e('0x51')]({},_0x507879,_0x389a1d[_0x511e('0x53')]);return _0x4562be['getAgents'](_0x507879);}})[_0x511e('0x1f')](function(_0x56855b){if(_0x56855b){_0x1ac898=_0x56855b[_0x511e('0x5b')];if(!_0x389a1d[_0x511e('0x45')][_0x511e('0x4a')](_0x511e('0x65'))){_0x507879[_0x511e('0x2f')]=qs[_0x511e('0x2f')](_0x389a1d[_0x511e('0x45')][_0x511e('0x2f')]);_0x507879['offset']=qs[_0x511e('0x2e')](_0x389a1d[_0x511e('0x45')][_0x511e('0x2e')]);}return _0x4562be[_0x511e('0xbd')](_0x507879);}})[_0x511e('0x1f')](function(_0x5e3f7d){if(_0x5e3f7d){return _0x5e3f7d?{'count':_0x1ac898,'rows':_0x5e3f7d}:null;}})['then'](respondWithResult(_0x25dfef,null))[_0x511e('0x56')](handleError(_0x25dfef,null));}; \ No newline at end of file +var _0x46ed=['request\x20sent','stringify','error','code','MailAccount,\x20%s,\x20%s','message','result','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','save','then','destroy','MailAccounts','UserProfileResource','stack','name','send','index','MailServerIn','Imap','MailServerOut','Pause','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','sort','where','filter','VIRTUAL','merge','options','MailAccount','findAll','rows','catch','show','params','mandatoryDispositionPause','fields','includeAll','include','find','update','body','Smtp','addDisposition','MailAccountId','Disposition','create','getDispositions','findOne','order','pick','removeDispositions','CannedAnswer','getAnswers','removeAnswers','ids','email','isNil','active','description','cauthentication','user','cuser','password','authentication','host','port','service','cservice','cpassword','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','userProfileId','autoAssociation','getImap','removeImap','getSmtp','removeSmtp','setSmtp','MailInteraction','omit','CmContact','Contact','User','Owner','internal','Tag','Tags','color','tag','addApplications','sequelize','transaction','MailApplication','bulkCreate','findAndCountAll','priority','getApplications','getMessages','MailMessage','$gte','split','YYYY-MM-DD\x20HH:mm:ss','inlineCss','true','CmList','List','Contacts','updatedAt','from','format','%s\x20<%s>','attachments','join','root','server/files/attachments','basename','auth','pass','secure','SendMail','sendMail','ListId','List\x20not\x20found','messageId','subject','attach','out','Interaction','Messages','verifySmtp','VerifySmtp','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','emit','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','getAgents','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','html-to-text','juice','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','redis','defaults','socket.io-emitter','./mailAccount.socket','register','client','http','info','debug','MailAccount,\x20%s,\x20%s,\x20%s'];(function(_0x3bdbc1,_0xcdcdde){var _0x2e9d8d=function(_0x256fde){while(--_0x256fde){_0x3bdbc1['push'](_0x3bdbc1['shift']());}};_0x2e9d8d(++_0xcdcdde);}(_0x46ed,0x168));var _0xd46e=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0x46ed[_0x51020b];return _0x371e47;};'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 htmlToText=require(_0xd46e('0x11'));var juice=require(_0xd46e('0x12'));var Redis=require('ioredis');var authService=require(_0xd46e('0x13'));var qs=require(_0xd46e('0x14'));var as=require(_0xd46e('0x15'));var hardwareService=require(_0xd46e('0x16'));var logger=require(_0xd46e('0x17'))(_0xd46e('0x18'));var utils=require('../../config/utils');var config=require(_0xd46e('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xd46e('0x1a')]=_[_0xd46e('0x1b')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xd46e('0x1c'))(new Redis(config[_0xd46e('0x1a')]));require(_0xd46e('0x1d'))[_0xd46e('0x1e')](socket);var jayson=require('jayson/promise');var client=jayson[_0xd46e('0x1f')][_0xd46e('0x20')]({'port':0x232b});function respondWithRpcPromise(_0x417402,_0x3d72ce,_0x36a317,_0x47fa8f){return new BPromise(function(_0x1d50a5,_0x305ff1){var _0x3583a5=_0x47fa8f||client;return _0x3583a5['request'](_0x417402,_0x36a317)['then'](function(_0x2e8f6d){logger[_0xd46e('0x21')]('MailAccount,\x20%s,\x20%s',_0x3d72ce,'request\x20sent');logger[_0xd46e('0x22')](_0xd46e('0x23'),_0x3d72ce,_0xd46e('0x24'),JSON[_0xd46e('0x25')](_0x2e8f6d));if(_0x2e8f6d[_0xd46e('0x26')]){if(_0x2e8f6d[_0xd46e('0x26')][_0xd46e('0x27')]===0x1f4){logger[_0xd46e('0x26')](_0xd46e('0x28'),_0x3d72ce,_0x2e8f6d[_0xd46e('0x26')][_0xd46e('0x29')]);return _0x305ff1(_0x2e8f6d['error'][_0xd46e('0x29')]);}logger[_0xd46e('0x26')](_0xd46e('0x28'),_0x3d72ce,_0x2e8f6d[_0xd46e('0x26')][_0xd46e('0x29')]);return _0x1d50a5(_0x2e8f6d[_0xd46e('0x26')][_0xd46e('0x29')]);}else{logger[_0xd46e('0x21')](_0xd46e('0x28'),_0x3d72ce,'request\x20sent');_0x1d50a5(_0x2e8f6d[_0xd46e('0x2a')]['message']);}})['catch'](function(_0x371054){logger[_0xd46e('0x26')](_0xd46e('0x28'),_0x3d72ce,_0x371054);_0x305ff1(_0x371054);});});}function respondWithStatusCode(_0x42afc7,_0x247b9f){_0x247b9f=_0x247b9f||0xcc;return function(_0x180851){if(_0x180851){return _0x42afc7[_0xd46e('0x2b')](_0x247b9f);}return _0x42afc7['status'](_0x247b9f)[_0xd46e('0x2c')]();};}function respondWithResult(_0x3c301a,_0xddbce9){_0xddbce9=_0xddbce9||0xc8;return function(_0x17db79){if(_0x17db79){return _0x3c301a[_0xd46e('0x2d')](_0xddbce9)[_0xd46e('0x2e')](_0x17db79);}};}function respondWithFilteredResult(_0x58aeef,_0x465d54){return function(_0x3a1ced){if(_0x3a1ced){var _0x2d1afe=typeof _0x465d54[_0xd46e('0x2f')]===_0xd46e('0x30')&&typeof _0x465d54[_0xd46e('0x31')]===_0xd46e('0x30');var _0x2c5ec7=_0x3a1ced[_0xd46e('0x32')];var _0x45ea47=_0x2d1afe?0x0:_0x465d54[_0xd46e('0x2f')];var _0x504324=_0x2d1afe?_0x3a1ced[_0xd46e('0x32')]:_0x465d54['offset']+_0x465d54[_0xd46e('0x31')];var _0x1fc7f0;if(_0x504324>=_0x2c5ec7){_0x504324=_0x2c5ec7;_0x1fc7f0=0xc8;}else{_0x1fc7f0=0xce;}_0x58aeef[_0xd46e('0x2d')](_0x1fc7f0);return _0x58aeef[_0xd46e('0x33')]('Content-Range',_0x45ea47+'-'+_0x504324+'/'+_0x2c5ec7)[_0xd46e('0x2e')](_0x3a1ced);}return null;};}function patchUpdates(_0x3e2eca){return function(_0x5ab9df){try{jsonpatch[_0xd46e('0x34')](_0x5ab9df,_0x3e2eca,!![]);}catch(_0x3f6e60){return BPromise['reject'](_0x3f6e60);}return _0x5ab9df[_0xd46e('0x35')]();};}function saveUpdates(_0x1c15c9,_0x1016e2){return function(_0x4b5e50){if(_0x4b5e50){return _0x4b5e50['update'](_0x1c15c9)[_0xd46e('0x36')](function(_0x19e116){return _0x19e116;});}return null;};}function removeEntity(_0x3f1896,_0x1072d6){return function(_0x83526a){if(_0x83526a){return _0x83526a[_0xd46e('0x37')]()[_0xd46e('0x36')](function(){var _0xf8b746=_0x83526a['get']({'plain':!![]});var _0x4fb62e=_0xd46e('0x38');return db[_0xd46e('0x39')][_0xd46e('0x37')]({'where':{'type':_0x4fb62e,'resourceId':_0xf8b746['id']}})[_0xd46e('0x36')](function(){return _0x83526a;});})[_0xd46e('0x36')](function(){_0x3f1896[_0xd46e('0x2d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x163dd0,_0x357212){return function(_0x59bf31){if(!_0x59bf31){_0x163dd0[_0xd46e('0x2b')](0x194);}return _0x59bf31;};}function handleError(_0x96b0f9,_0x12ccf8){_0x12ccf8=_0x12ccf8||0x1f4;return function(_0x3b6e67){logger['error'](_0x3b6e67[_0xd46e('0x3a')]);if(_0x3b6e67[_0xd46e('0x3b')]){delete _0x3b6e67[_0xd46e('0x3b')];}_0x96b0f9[_0xd46e('0x2d')](_0x12ccf8)[_0xd46e('0x3c')](_0x3b6e67);};}exports[_0xd46e('0x3d')]=function(_0x220c57,_0x411318){var _0x56e8d2={'include':[{'model':db[_0xd46e('0x3e')],'as':_0xd46e('0x3f')},{'model':db[_0xd46e('0x40')],'as':'Smtp'},{'model':db[_0xd46e('0x41')],'as':'mandatoryDispositionPause'}]},_0x232e6f={},_0x40aa87={'count':0x0,'rows':[]};var _0x55230d=_['map'](db['MailAccount'][_0xd46e('0x42')],function(_0x54949f){return{'name':_0x54949f[_0xd46e('0x43')],'type':_0x54949f[_0xd46e('0x44')]['key']};});_0x232e6f[_0xd46e('0x45')]=_[_0xd46e('0x46')](_0x55230d,_0xd46e('0x3b'));_0x232e6f[_0xd46e('0x47')]=_[_0xd46e('0x48')](_0x220c57[_0xd46e('0x47')]);_0x232e6f[_0xd46e('0x49')]=_[_0xd46e('0x4a')](_0x232e6f[_0xd46e('0x45')],_0x232e6f[_0xd46e('0x47')]);_0x56e8d2[_0xd46e('0x4b')]=_['intersection'](_0x232e6f['model'],qs['fields'](_0x220c57[_0xd46e('0x47')]['fields']));_0x56e8d2[_0xd46e('0x4b')]=_0x56e8d2[_0xd46e('0x4b')][_0xd46e('0x4c')]?_0x56e8d2[_0xd46e('0x4b')]:_0x232e6f[_0xd46e('0x45')];if(!_0x220c57[_0xd46e('0x47')][_0xd46e('0x4d')](_0xd46e('0x4e'))){_0x56e8d2['limit']=qs[_0xd46e('0x31')](_0x220c57['query'][_0xd46e('0x31')]);_0x56e8d2[_0xd46e('0x2f')]=qs[_0xd46e('0x2f')](_0x220c57[_0xd46e('0x47')][_0xd46e('0x2f')]);}_0x56e8d2['order']=qs[_0xd46e('0x4f')](_0x220c57[_0xd46e('0x47')][_0xd46e('0x4f')]);_0x56e8d2[_0xd46e('0x50')]=qs[_0xd46e('0x49')](_['pick'](_0x220c57[_0xd46e('0x47')],_0x232e6f[_0xd46e('0x49')]),_0x55230d);if(_0x220c57[_0xd46e('0x47')][_0xd46e('0x51')]){_0x56e8d2[_0xd46e('0x50')]=_['merge'](_0x56e8d2[_0xd46e('0x50')],{'$or':_[_0xd46e('0x46')](_0x55230d,function(_0x45baf1){if(_0x45baf1[_0xd46e('0x44')]!==_0xd46e('0x52')){var _0x3ed12f={};_0x3ed12f[_0x45baf1[_0xd46e('0x3b')]]={'$like':'%'+_0x220c57[_0xd46e('0x47')]['filter']+'%'};return _0x3ed12f;}})});}_0x56e8d2=_[_0xd46e('0x53')]({},_0x56e8d2,_0x220c57[_0xd46e('0x54')]);var _0xb65943={'where':_0x56e8d2[_0xd46e('0x50')]};return db[_0xd46e('0x55')]['count'](_0xb65943)['then'](function(_0x3a94cf){_0x40aa87[_0xd46e('0x32')]=_0x3a94cf;if(_0x220c57[_0xd46e('0x47')]['includeAll']){_0x56e8d2['include']=[{'all':!![]}];}return db[_0xd46e('0x55')][_0xd46e('0x56')](_0x56e8d2);})['then'](function(_0x2eee92){_0x40aa87[_0xd46e('0x57')]=_0x2eee92;return _0x40aa87;})[_0xd46e('0x36')](respondWithFilteredResult(_0x411318,_0x56e8d2))[_0xd46e('0x58')](handleError(_0x411318,null));};exports[_0xd46e('0x59')]=function(_0x34d4ca,_0x80ed51){var _0x16ca0e={'raw':![],'where':{'id':_0x34d4ca[_0xd46e('0x5a')]['id']},'include':[{'model':db[_0xd46e('0x3e')],'as':_0xd46e('0x3f')},{'model':db[_0xd46e('0x40')],'as':'Smtp'},{'model':db['Pause'],'as':_0xd46e('0x5b')}]},_0x4788ab={};_0x4788ab['model']=_[_0xd46e('0x48')](db[_0xd46e('0x55')][_0xd46e('0x42')]);_0x4788ab[_0xd46e('0x47')]=_[_0xd46e('0x48')](_0x34d4ca[_0xd46e('0x47')]);_0x4788ab['filters']=_[_0xd46e('0x4a')](_0x4788ab[_0xd46e('0x45')],_0x4788ab[_0xd46e('0x47')]);_0x16ca0e['attributes']=_[_0xd46e('0x4a')](_0x4788ab[_0xd46e('0x45')],qs[_0xd46e('0x5c')](_0x34d4ca[_0xd46e('0x47')][_0xd46e('0x5c')]));_0x16ca0e[_0xd46e('0x4b')]=_0x16ca0e[_0xd46e('0x4b')][_0xd46e('0x4c')]?_0x16ca0e[_0xd46e('0x4b')]:_0x4788ab[_0xd46e('0x45')];if(_0x34d4ca[_0xd46e('0x47')][_0xd46e('0x5d')]){_0x16ca0e[_0xd46e('0x5e')]=[{'all':!![]}];}_0x16ca0e=_[_0xd46e('0x53')]({},_0x16ca0e,_0x34d4ca['options']);return db[_0xd46e('0x55')][_0xd46e('0x5f')](_0x16ca0e)[_0xd46e('0x36')](handleEntityNotFound(_0x80ed51,null))[_0xd46e('0x36')](respondWithResult(_0x80ed51,null))['catch'](handleError(_0x80ed51,null));};exports[_0xd46e('0x60')]=function(_0x36e18a,_0xaf9641){if(_0x36e18a[_0xd46e('0x61')]['id']){delete _0x36e18a['body']['id'];}return db[_0xd46e('0x55')][_0xd46e('0x5f')]({'where':{'id':_0x36e18a['params']['id']},'include':[{'model':db['MailServerIn'],'as':_0xd46e('0x3f')},{'model':db[_0xd46e('0x40')],'as':_0xd46e('0x62')},{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})[_0xd46e('0x36')](handleEntityNotFound(_0xaf9641,null))[_0xd46e('0x36')](saveUpdates(_0x36e18a[_0xd46e('0x61')],null))[_0xd46e('0x36')](function(_0x2dacb4){if(_0x2dacb4&&_0x36e18a[_0xd46e('0x61')][_0xd46e('0x3f')]){return db[_0xd46e('0x3e')][_0xd46e('0x60')](_0x36e18a[_0xd46e('0x61')][_0xd46e('0x3f')],{'where':{'MailAccountId':_0x2dacb4['id']}})[_0xd46e('0x36')](function(){return _0x2dacb4;});}return _0x2dacb4;})[_0xd46e('0x36')](function(_0x329204){if(_0x329204&&_0x36e18a[_0xd46e('0x61')][_0xd46e('0x62')]){return db['MailServerOut'][_0xd46e('0x60')](_0x36e18a[_0xd46e('0x61')][_0xd46e('0x62')],{'where':{'MailAccountId':_0x329204['id']}})['then'](function(){return _0x329204;});}return _0x329204;})[_0xd46e('0x36')](respondWithResult(_0xaf9641,null))[_0xd46e('0x58')](handleError(_0xaf9641,null));};exports['describe']=function(_0x37ce99,_0x2c86fe){return db[_0xd46e('0x55')]['describe']()[_0xd46e('0x36')](respondWithResult(_0x2c86fe,null))[_0xd46e('0x58')](handleError(_0x2c86fe,null));};exports[_0xd46e('0x63')]=function(_0x4c61f2,_0xe5f8cd,_0x516e7d){if(_0x4c61f2[_0xd46e('0x61')]['id']){delete _0x4c61f2[_0xd46e('0x61')]['id'];}return db[_0xd46e('0x55')]['find']({'where':{'id':_0x4c61f2[_0xd46e('0x5a')]['id']}})[_0xd46e('0x36')](handleEntityNotFound(_0xe5f8cd,null))[_0xd46e('0x36')](function(_0xbce76f){if(_0xbce76f){_0x4c61f2[_0xd46e('0x61')][_0xd46e('0x64')]=_0xbce76f['id'];return db[_0xd46e('0x65')][_0xd46e('0x66')](_0x4c61f2[_0xd46e('0x61')]);}})[_0xd46e('0x36')](respondWithResult(_0xe5f8cd,null))[_0xd46e('0x58')](handleError(_0xe5f8cd,null));};exports[_0xd46e('0x67')]=function(_0x41057c,_0x24be84,_0x548cab){var _0x501436={'raw':![],'where':{}};var _0x2d7c30={};var _0x3e0ed5={'count':0x0,'rows':[]};return db[_0xd46e('0x55')][_0xd46e('0x68')]({'where':{'id':_0x41057c[_0xd46e('0x5a')]['id']}})['then'](handleEntityNotFound(_0x24be84,null))[_0xd46e('0x36')](function(_0x9ea442){if(_0x9ea442){_0x2d7c30[_0xd46e('0x45')]=_[_0xd46e('0x48')](db['Disposition'][_0xd46e('0x42')]);_0x2d7c30[_0xd46e('0x47')]=_['keys'](_0x41057c[_0xd46e('0x47')]);_0x2d7c30[_0xd46e('0x49')]=_['intersection'](_0x2d7c30[_0xd46e('0x45')],_0x2d7c30[_0xd46e('0x47')]);_0x501436['attributes']=_[_0xd46e('0x4a')](_0x2d7c30['model'],qs[_0xd46e('0x5c')](_0x41057c[_0xd46e('0x47')]['fields']));_0x501436['attributes']=_0x501436[_0xd46e('0x4b')][_0xd46e('0x4c')]?_0x501436[_0xd46e('0x4b')]:_0x2d7c30[_0xd46e('0x45')];if(!_0x41057c['query'][_0xd46e('0x4d')](_0xd46e('0x4e'))){_0x501436['limit']=qs[_0xd46e('0x31')](_0x41057c[_0xd46e('0x47')][_0xd46e('0x31')]);_0x501436[_0xd46e('0x2f')]=qs[_0xd46e('0x2f')](_0x41057c[_0xd46e('0x47')][_0xd46e('0x2f')]);}_0x501436[_0xd46e('0x69')]=qs[_0xd46e('0x4f')](_0x41057c['query'][_0xd46e('0x4f')]);_0x501436[_0xd46e('0x50')]=qs['filters'](_[_0xd46e('0x6a')](_0x41057c[_0xd46e('0x47')],_0x2d7c30[_0xd46e('0x49')]));_0x501436[_0xd46e('0x50')][_0xd46e('0x64')]=_0x9ea442['id'];if(_0x41057c[_0xd46e('0x47')]['filter']){_0x501436['where']=_[_0xd46e('0x53')](_0x501436[_0xd46e('0x50')],{'$or':_['map'](_0x501436['attributes'],function(_0x484805){var _0x825746={};_0x825746[_0x484805]={'$like':'%'+_0x41057c[_0xd46e('0x47')][_0xd46e('0x51')]+'%'};return _0x825746;})});}_0x501436=_['merge']({},_0x501436,_0x41057c[_0xd46e('0x54')]);return db[_0xd46e('0x65')][_0xd46e('0x32')]({'where':_0x501436['where']})['then'](function(_0x5408b5){_0x3e0ed5['count']=_0x5408b5;if(_0x41057c[_0xd46e('0x47')]['includeAll']){_0x501436[_0xd46e('0x5e')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0x501436);})[_0xd46e('0x36')](function(_0x4550a7){_0x3e0ed5[_0xd46e('0x57')]=_0x4550a7;return _0x3e0ed5;});}})[_0xd46e('0x36')](respondWithFilteredResult(_0x24be84,_0x501436))[_0xd46e('0x58')](handleError(_0x24be84,null));};exports[_0xd46e('0x6b')]=function(_0x57a7cc,_0x586024,_0x157523){return db[_0xd46e('0x55')][_0xd46e('0x5f')]({'where':{'id':_0x57a7cc[_0xd46e('0x5a')]['id']}})['then'](handleEntityNotFound(_0x586024,null))[_0xd46e('0x36')](function(_0xeccb76){if(_0xeccb76){return _0xeccb76['removeDispositions'](_0x57a7cc[_0xd46e('0x47')]['ids']);}})[_0xd46e('0x36')](respondWithStatusCode(_0x586024,null))[_0xd46e('0x58')](handleError(_0x586024,null));};exports['addAnswer']=function(_0x59fb83,_0x1161f8,_0x2c11b8){if(_0x59fb83[_0xd46e('0x61')]['id']){delete _0x59fb83['body']['id'];}return db[_0xd46e('0x55')][_0xd46e('0x5f')]({'where':{'id':_0x59fb83[_0xd46e('0x5a')]['id']}})[_0xd46e('0x36')](handleEntityNotFound(_0x1161f8,null))[_0xd46e('0x36')](function(_0x88460a){if(_0x88460a){_0x59fb83[_0xd46e('0x61')][_0xd46e('0x64')]=_0x88460a['id'];return db[_0xd46e('0x6c')][_0xd46e('0x66')](_0x59fb83[_0xd46e('0x61')]);}})[_0xd46e('0x36')](respondWithResult(_0x1161f8,null))[_0xd46e('0x58')](handleError(_0x1161f8,null));};exports[_0xd46e('0x6d')]=function(_0x3b9221,_0x1aa930,_0x441f73){var _0x1d2738={'raw':![],'where':{}};var _0x5d2511={};var _0x3c9713={'count':0x0,'rows':[]};return db['MailAccount'][_0xd46e('0x68')]({'where':{'id':_0x3b9221[_0xd46e('0x5a')]['id']}})['then'](handleEntityNotFound(_0x1aa930,null))[_0xd46e('0x36')](function(_0x21b837){if(_0x21b837){_0x5d2511[_0xd46e('0x45')]=_[_0xd46e('0x48')](db[_0xd46e('0x6c')][_0xd46e('0x42')]);_0x5d2511[_0xd46e('0x47')]=_[_0xd46e('0x48')](_0x3b9221[_0xd46e('0x47')]);_0x5d2511[_0xd46e('0x49')]=_[_0xd46e('0x4a')](_0x5d2511['model'],_0x5d2511['query']);_0x1d2738[_0xd46e('0x4b')]=_[_0xd46e('0x4a')](_0x5d2511[_0xd46e('0x45')],qs[_0xd46e('0x5c')](_0x3b9221[_0xd46e('0x47')][_0xd46e('0x5c')]));_0x1d2738['attributes']=_0x1d2738[_0xd46e('0x4b')][_0xd46e('0x4c')]?_0x1d2738[_0xd46e('0x4b')]:_0x5d2511[_0xd46e('0x45')];if(!_0x3b9221[_0xd46e('0x47')][_0xd46e('0x4d')]('nolimit')){_0x1d2738[_0xd46e('0x31')]=qs[_0xd46e('0x31')](_0x3b9221['query'][_0xd46e('0x31')]);_0x1d2738[_0xd46e('0x2f')]=qs[_0xd46e('0x2f')](_0x3b9221[_0xd46e('0x47')][_0xd46e('0x2f')]);}_0x1d2738[_0xd46e('0x69')]=qs[_0xd46e('0x4f')](_0x3b9221[_0xd46e('0x47')][_0xd46e('0x4f')]);_0x1d2738[_0xd46e('0x50')]=qs[_0xd46e('0x49')](_[_0xd46e('0x6a')](_0x3b9221[_0xd46e('0x47')],_0x5d2511[_0xd46e('0x49')]));_0x1d2738['where']['MailAccountId']=_0x21b837['id'];if(_0x3b9221[_0xd46e('0x47')][_0xd46e('0x51')]){_0x1d2738[_0xd46e('0x50')]=_[_0xd46e('0x53')](_0x1d2738[_0xd46e('0x50')],{'$or':_[_0xd46e('0x46')](_0x1d2738['attributes'],function(_0x32d6a0){var _0x216143={};_0x216143[_0x32d6a0]={'$like':'%'+_0x3b9221[_0xd46e('0x47')][_0xd46e('0x51')]+'%'};return _0x216143;})});}_0x1d2738=_['merge']({},_0x1d2738,_0x3b9221[_0xd46e('0x54')]);return db[_0xd46e('0x6c')]['count']({'where':_0x1d2738[_0xd46e('0x50')]})['then'](function(_0x5e2956){_0x3c9713[_0xd46e('0x32')]=_0x5e2956;if(_0x3b9221[_0xd46e('0x47')][_0xd46e('0x5d')]){_0x1d2738[_0xd46e('0x5e')]=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x1d2738);})[_0xd46e('0x36')](function(_0x5e59b7){_0x3c9713[_0xd46e('0x57')]=_0x5e59b7;return _0x3c9713;});}})['then'](respondWithFilteredResult(_0x1aa930,_0x1d2738))['catch'](handleError(_0x1aa930,null));};exports[_0xd46e('0x6e')]=function(_0x323aac,_0x5eebd2,_0x573d90){return db[_0xd46e('0x55')][_0xd46e('0x5f')]({'where':{'id':_0x323aac[_0xd46e('0x5a')]['id']}})[_0xd46e('0x36')](handleEntityNotFound(_0x5eebd2,null))['then'](function(_0x27faad){if(_0x27faad){return _0x27faad[_0xd46e('0x6e')](_0x323aac['query'][_0xd46e('0x6f')]);}})[_0xd46e('0x36')](respondWithStatusCode(_0x5eebd2,null))[_0xd46e('0x58')](handleError(_0x5eebd2,null));};exports[_0xd46e('0x66')]=function(_0x263999,_0x2c4a1d){var _0x55739b={'name':_0x263999[_0xd46e('0x61')][_0xd46e('0x3b')],'key':_0x263999['body']['key'],'email':_0x263999[_0xd46e('0x61')][_0xd46e('0x70')],'ListId':_0x263999['body']['ListId'],'active':!_[_0xd46e('0x71')](_0x263999[_0xd46e('0x61')]['active'])?_0x263999[_0xd46e('0x61')][_0xd46e('0x72')]:!![],'description':_0x263999[_0xd46e('0x61')][_0xd46e('0x73')]||null,'Imap':{},'Smtp':{}};if(_[_0xd46e('0x71')](_0x263999[_0xd46e('0x61')]['cservice'])){if(_0x263999[_0xd46e('0x61')][_0xd46e('0x74')]){_0x55739b[_0xd46e('0x3f')][_0xd46e('0x75')]=_0x55739b[_0xd46e('0x62')][_0xd46e('0x75')]=_0x263999[_0xd46e('0x61')][_0xd46e('0x76')];_0x55739b[_0xd46e('0x3f')][_0xd46e('0x77')]=_0x55739b[_0xd46e('0x62')]['pass']=_0x263999[_0xd46e('0x61')]['cpassword'];}else{_0x55739b['Imap'][_0xd46e('0x78')]=_0x55739b[_0xd46e('0x62')][_0xd46e('0x78')]=![];}_0x55739b[_0xd46e('0x3f')][_0xd46e('0x79')]=_0x263999[_0xd46e('0x61')][_0xd46e('0x3f')][_0xd46e('0x79')];_0x55739b['Imap'][_0xd46e('0x7a')]=_0x263999['body'][_0xd46e('0x3f')][_0xd46e('0x7a')];_0x55739b[_0xd46e('0x62')][_0xd46e('0x79')]=_0x263999[_0xd46e('0x61')][_0xd46e('0x62')][_0xd46e('0x79')];_0x55739b[_0xd46e('0x62')]['port']=_0x263999[_0xd46e('0x61')][_0xd46e('0x62')][_0xd46e('0x7a')];}else{_0x55739b['Imap'][_0xd46e('0x7b')]=_0x55739b[_0xd46e('0x62')][_0xd46e('0x7b')]=_0x263999['body'][_0xd46e('0x7c')];_0x55739b[_0xd46e('0x3f')][_0xd46e('0x75')]=_0x55739b[_0xd46e('0x62')][_0xd46e('0x75')]=_0x263999[_0xd46e('0x61')]['cuser'];_0x55739b['Imap'][_0xd46e('0x77')]=_0x55739b[_0xd46e('0x62')]['pass']=_0x263999[_0xd46e('0x61')][_0xd46e('0x7d')];}return db[_0xd46e('0x55')][_0xd46e('0x66')](_0x55739b,{'include':[{'model':db[_0xd46e('0x40')],'as':_0xd46e('0x62')},{'model':db['MailServerIn'],'as':'Imap'}]})[_0xd46e('0x36')](function(_0x52ca5a){var _0xc2eebc=_0x263999[_0xd46e('0x75')]['get']({'plain':!![]});if(!_0xc2eebc)throw new Error(_0xd46e('0x7e'));if(_0xc2eebc[_0xd46e('0x7f')]===_0xd46e('0x75')){var _0x11306e=_0x52ca5a[_0xd46e('0x80')]({'plain':!![]});return db['UserProfileSection'][_0xd46e('0x5f')]({'where':{'name':_0xd46e('0x38'),'userProfileId':_0xc2eebc[_0xd46e('0x81')]},'raw':!![]})[_0xd46e('0x36')](function(_0x105261){if(_0x105261&&_0x105261[_0xd46e('0x82')]===0x0){return db[_0xd46e('0x39')][_0xd46e('0x66')]({'name':_0x11306e[_0xd46e('0x3b')],'resourceId':_0x11306e['id'],'type':_0x105261[_0xd46e('0x3b')],'sectionId':_0x105261['id']},{})[_0xd46e('0x36')](function(){return _0x52ca5a;});}else{return _0x52ca5a;}})[_0xd46e('0x58')](function(_0x3b9664){logger[_0xd46e('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3b9664);throw _0x3b9664;});}return _0x52ca5a;})[_0xd46e('0x36')](respondWithResult(_0x2c4a1d,0xc9))[_0xd46e('0x58')](handleError(_0x2c4a1d,null));};exports['getImap']=function(_0x1abd49,_0x2c7c60,_0x103ee0){return db['MailAccount'][_0xd46e('0x68')]({'where':{'id':_0x1abd49[_0xd46e('0x5a')]['id']}})[_0xd46e('0x36')](handleEntityNotFound(_0x2c7c60,null))[_0xd46e('0x36')](function(_0x5031cf){if(_0x5031cf){return _0x5031cf[_0xd46e('0x83')]();}return null;})[_0xd46e('0x36')](respondWithResult(_0x2c7c60,null))[_0xd46e('0x58')](handleError(_0x2c7c60,null));};exports['addImap']=function(_0x5c6563,_0x30efe6,_0x2094e5){if(_0x5c6563[_0xd46e('0x61')]['id']){delete _0x5c6563[_0xd46e('0x61')]['id'];}return db[_0xd46e('0x55')][_0xd46e('0x5f')]({'where':{'id':_0x5c6563['params']['id']}})[_0xd46e('0x36')](handleEntityNotFound(_0x30efe6,null))['then'](function(_0x4d267b){if(_0x4d267b){_0x5c6563['body'][_0xd46e('0x64')]=_0x4d267b['id'];return db['MailServerIn']['create'](_0x5c6563[_0xd46e('0x61')]);}})[_0xd46e('0x36')](respondWithResult(_0x30efe6,null))[_0xd46e('0x58')](handleError(_0x30efe6,null));};exports[_0xd46e('0x84')]=function(_0x101a29,_0x3a44da,_0x417068){return db['MailAccount'][_0xd46e('0x68')]({'where':{'id':_0x101a29[_0xd46e('0x5a')]['id']}})[_0xd46e('0x36')](handleEntityNotFound(_0x3a44da,null))[_0xd46e('0x36')](function(_0x333f7c){if(_0x333f7c){return _0x333f7c['setImap'](null);}return null;})[_0xd46e('0x36')](respondWithStatusCode(_0x3a44da,null))[_0xd46e('0x58')](handleError(_0x3a44da,null));};exports[_0xd46e('0x85')]=function(_0x516493,_0x187581,_0x8c6ed1){return db['MailAccount']['findOne']({'where':{'id':_0x516493['params']['id']}})[_0xd46e('0x36')](handleEntityNotFound(_0x187581,null))[_0xd46e('0x36')](function(_0x578cc5){if(_0x578cc5){return _0x578cc5[_0xd46e('0x85')]();}return null;})[_0xd46e('0x36')](respondWithResult(_0x187581,null))['catch'](handleError(_0x187581,null));};exports['addSmtp']=function(_0x157fb0,_0x194c07,_0x3139d9){if(_0x157fb0[_0xd46e('0x61')]['id']){delete _0x157fb0['body']['id'];}return db['MailAccount'][_0xd46e('0x5f')]({'where':{'id':_0x157fb0[_0xd46e('0x5a')]['id']}})[_0xd46e('0x36')](handleEntityNotFound(_0x194c07,null))[_0xd46e('0x36')](function(_0x2d3337){if(_0x2d3337){_0x157fb0[_0xd46e('0x61')][_0xd46e('0x64')]=_0x2d3337['id'];return db['MailServerOut'][_0xd46e('0x66')](_0x157fb0[_0xd46e('0x61')]);}})['then'](respondWithResult(_0x194c07,null))[_0xd46e('0x58')](handleError(_0x194c07,null));};exports[_0xd46e('0x86')]=function(_0x45ab2c,_0x1a5097,_0x30f77e){return db[_0xd46e('0x55')][_0xd46e('0x68')]({'where':{'id':_0x45ab2c[_0xd46e('0x5a')]['id']}})['then'](handleEntityNotFound(_0x1a5097,null))[_0xd46e('0x36')](function(_0x3a1241){if(_0x3a1241){return _0x3a1241[_0xd46e('0x87')](null);}return null;})[_0xd46e('0x36')](respondWithStatusCode(_0x1a5097,null))[_0xd46e('0x58')](handleError(_0x1a5097,null));};exports['addInteraction']=function(_0x28158d,_0x40151d,_0x10dedf){return db[_0xd46e('0x88')][_0xd46e('0x5f')]({'where':{'id':_0x28158d[_0xd46e('0x5a')]['id']}})[_0xd46e('0x36')](handleEntityNotFound(_0x40151d,null))[_0xd46e('0x36')](function(_0xa75369){if(_0xa75369){return _0xa75369['addInteraction'](_0x28158d[_0xd46e('0x61')][_0xd46e('0x6f')],_[_0xd46e('0x89')](_0x28158d[_0xd46e('0x61')],['ids','id'])||{});}})['then'](respondWithResult(_0x40151d,null))[_0xd46e('0x58')](handleError(_0x40151d,null));};exports['getInteractions']=function(_0x747145,_0x2581de,_0x1b522b){var _0x19761a={'raw':![],'where':{}};var _0x54991a={};var _0x470406={'count':0x0,'rows':[]};return db[_0xd46e('0x55')][_0xd46e('0x68')]({'where':{'id':_0x747145[_0xd46e('0x5a')]['id']}})[_0xd46e('0x36')](handleEntityNotFound(_0x2581de,null))[_0xd46e('0x36')](function(_0x3cc959){if(_0x3cc959){_0x54991a[_0xd46e('0x45')]=_[_0xd46e('0x48')](db['MailInteraction']['rawAttributes']);_0x54991a[_0xd46e('0x47')]=_['keys'](_0x747145[_0xd46e('0x47')]);_0x54991a[_0xd46e('0x49')]=_[_0xd46e('0x4a')](_0x54991a['model'],_0x54991a[_0xd46e('0x47')]);_0x19761a[_0xd46e('0x4b')]=_[_0xd46e('0x4a')](_0x54991a['model'],qs['fields'](_0x747145[_0xd46e('0x47')][_0xd46e('0x5c')]));_0x19761a[_0xd46e('0x4b')]=_0x19761a[_0xd46e('0x4b')][_0xd46e('0x4c')]?_0x19761a['attributes']:_0x54991a[_0xd46e('0x45')];if(!_0x747145[_0xd46e('0x47')][_0xd46e('0x4d')](_0xd46e('0x4e'))){_0x19761a[_0xd46e('0x31')]=qs['limit'](_0x747145[_0xd46e('0x47')][_0xd46e('0x31')]);_0x19761a[_0xd46e('0x2f')]=qs[_0xd46e('0x2f')](_0x747145['query'][_0xd46e('0x2f')]);}_0x19761a[_0xd46e('0x69')]=qs[_0xd46e('0x4f')](_0x747145[_0xd46e('0x47')][_0xd46e('0x4f')]);_0x19761a[_0xd46e('0x50')]=qs[_0xd46e('0x49')](_[_0xd46e('0x6a')](_0x747145[_0xd46e('0x47')],_0x54991a[_0xd46e('0x49')]));_0x19761a[_0xd46e('0x50')][_0xd46e('0x64')]=_0x3cc959['id'];if(_0x747145[_0xd46e('0x47')][_0xd46e('0x51')]){_0x19761a['where']=_['merge'](_0x19761a['where'],{'$or':_[_0xd46e('0x46')](_0x19761a['attributes'],function(_0xd95860){var _0x182333={};_0x182333[_0xd95860]={'$like':'%'+_0x747145[_0xd46e('0x47')][_0xd46e('0x51')]+'%'};return _0x182333;})});}_0x19761a=_[_0xd46e('0x53')]({},_0x19761a,_0x747145[_0xd46e('0x54')]);return db[_0xd46e('0x88')][_0xd46e('0x32')]({'where':_0x19761a['where']})[_0xd46e('0x36')](function(_0x122f17){_0x470406[_0xd46e('0x32')]=_0x122f17;if(_0x747145['query']['includeAll']){_0x19761a[_0xd46e('0x5e')]=[{'model':db[_0xd46e('0x8a')],'as':_0xd46e('0x8b'),'required':![]},{'model':db[_0xd46e('0x8c')],'as':_0xd46e('0x8d'),'attributes':[_0xd46e('0x3b'),'fullname',_0xd46e('0x8e')],'required':![]},{'model':db[_0xd46e('0x8f')],'as':_0xd46e('0x90'),'attributes':['id','name',_0xd46e('0x91')],'where':_0x747145[_0xd46e('0x47')]['tag']?{'id':_0x747145[_0xd46e('0x47')]['tag']}:undefined,'required':_0x747145[_0xd46e('0x47')][_0xd46e('0x92')]?!![]:![]}];}return db[_0xd46e('0x88')][_0xd46e('0x56')](_0x19761a);})[_0xd46e('0x36')](function(_0xed0763){_0x470406['rows']=_0xed0763;return _0x470406;});}})['then'](respondWithFilteredResult(_0x2581de,_0x19761a))['catch'](handleError(_0x2581de,null));};exports[_0xd46e('0x93')]=function(_0x23b77f,_0x31ec92,_0x189c67){return db['MailAccount'][_0xd46e('0x68')]({'where':{'id':_0x23b77f[_0xd46e('0x5a')]['id']}})[_0xd46e('0x36')](handleEntityNotFound(_0x31ec92,null))[_0xd46e('0x36')](function(_0x140a88){if(_0x140a88){return db[_0xd46e('0x94')][_0xd46e('0x95')](function(_0xecc672){return db[_0xd46e('0x96')][_0xd46e('0x37')]({'where':{'MailAccountId':_0x23b77f['params']['id']},'transaction':_0xecc672})[_0xd46e('0x36')](function(_0x3669b8){var _0x1ac5fa=_['map'](_0x23b77f[_0xd46e('0x61')],function(_0x1fdf44){_0x1fdf44[_0xd46e('0x64')]=_0x23b77f[_0xd46e('0x5a')]['id'];return _0x1fdf44;});return db[_0xd46e('0x96')][_0xd46e('0x97')](_0x1ac5fa,{'transaction':_0xecc672});});})['then'](function(){return db['MailApplication'][_0xd46e('0x98')]({'where':{'MailAccountId':_0x23b77f[_0xd46e('0x5a')]['id']},'order':_0xd46e('0x99')});});}})[_0xd46e('0x36')](respondWithResult(_0x31ec92,null))['catch'](handleError(_0x31ec92,null));};exports[_0xd46e('0x9a')]=function(_0xe30f8e,_0x8dae2e,_0x468004){var _0x2d53e1={};var _0x38a989={};var _0x246f49;var _0x5d4a4b;return db['MailAccount']['findOne']({'where':{'id':_0xe30f8e[_0xd46e('0x5a')]['id']}})['then'](handleEntityNotFound(_0x8dae2e,null))['then'](function(_0x1b590e){if(_0x1b590e){_0x246f49=_0x1b590e;_0x38a989[_0xd46e('0x45')]=_['keys'](db[_0xd46e('0x96')][_0xd46e('0x42')]);_0x38a989['query']=_[_0xd46e('0x48')](_0xe30f8e['query']);_0x38a989[_0xd46e('0x49')]=_[_0xd46e('0x4a')](_0x38a989[_0xd46e('0x45')],_0x38a989['query']);_0x2d53e1[_0xd46e('0x4b')]=_['intersection'](_0x38a989[_0xd46e('0x45')],qs[_0xd46e('0x5c')](_0xe30f8e[_0xd46e('0x47')][_0xd46e('0x5c')]));_0x2d53e1[_0xd46e('0x4b')]=_0x2d53e1[_0xd46e('0x4b')][_0xd46e('0x4c')]?_0x2d53e1[_0xd46e('0x4b')]:_0x38a989['model'];_0x2d53e1['order']=qs['sort'](_0xe30f8e[_0xd46e('0x47')]['sort']);_0x2d53e1[_0xd46e('0x50')]=qs[_0xd46e('0x49')](_[_0xd46e('0x6a')](_0xe30f8e[_0xd46e('0x47')],_0x38a989[_0xd46e('0x49')]));if(_0xe30f8e[_0xd46e('0x47')][_0xd46e('0x51')]){_0x2d53e1[_0xd46e('0x50')]=_[_0xd46e('0x53')](_0x2d53e1['where'],{'$or':_[_0xd46e('0x46')](_0x2d53e1[_0xd46e('0x4b')],function(_0x2aa86f){var _0x29a2dd={};_0x29a2dd[_0x2aa86f]={'$like':'%'+_0xe30f8e[_0xd46e('0x47')][_0xd46e('0x51')]+'%'};return _0x29a2dd;})});}_0x2d53e1=_[_0xd46e('0x53')]({},_0x2d53e1,_0xe30f8e['options']);return _0x246f49[_0xd46e('0x9a')](_0x2d53e1);}})[_0xd46e('0x36')](function(_0xc61d3d){if(_0xc61d3d){_0x5d4a4b=_0xc61d3d[_0xd46e('0x4c')];if(!_0xe30f8e[_0xd46e('0x47')][_0xd46e('0x4d')]('nolimit')){_0x2d53e1[_0xd46e('0x31')]=qs['limit'](_0xe30f8e[_0xd46e('0x47')][_0xd46e('0x31')]);_0x2d53e1[_0xd46e('0x2f')]=qs[_0xd46e('0x2f')](_0xe30f8e[_0xd46e('0x47')][_0xd46e('0x2f')]);}return _0x246f49[_0xd46e('0x9a')](_0x2d53e1);}})[_0xd46e('0x36')](function(_0x1ab398){if(_0x1ab398){return _0x1ab398?{'count':_0x5d4a4b,'rows':_0x1ab398}:null;}})[_0xd46e('0x36')](respondWithResult(_0x8dae2e,null))[_0xd46e('0x58')](handleError(_0x8dae2e,null));};exports[_0xd46e('0x9b')]=function(_0x14f234,_0x5caa15,_0x4a7db0){var _0x2a5507={'raw':!![],'where':{}};var _0x554c45={};var _0x56448e={'count':0x0,'rows':[]};return db['MailAccount'][_0xd46e('0x68')]({'where':{'id':_0x14f234[_0xd46e('0x5a')]['id']}})[_0xd46e('0x36')](handleEntityNotFound(_0x5caa15,null))[_0xd46e('0x36')](function(_0xceff66){if(_0xceff66){_0x554c45[_0xd46e('0x45')]=_[_0xd46e('0x48')](db[_0xd46e('0x9c')][_0xd46e('0x42')]);_0x554c45[_0xd46e('0x47')]=_[_0xd46e('0x48')](_0x14f234[_0xd46e('0x47')]);_0x554c45['filters']=_[_0xd46e('0x4a')](_0x554c45[_0xd46e('0x45')],_0x554c45['query']);_0x2a5507['attributes']=_[_0xd46e('0x4a')](_0x554c45['model'],qs[_0xd46e('0x5c')](_0x14f234[_0xd46e('0x47')]['fields']));_0x2a5507['attributes']=_0x2a5507[_0xd46e('0x4b')]['length']?_0x2a5507[_0xd46e('0x4b')]:_0x554c45['model'];if(!_0x14f234[_0xd46e('0x47')][_0xd46e('0x4d')](_0xd46e('0x4e'))){_0x2a5507[_0xd46e('0x31')]=qs[_0xd46e('0x31')](_0x14f234[_0xd46e('0x47')][_0xd46e('0x31')]);_0x2a5507[_0xd46e('0x2f')]=qs[_0xd46e('0x2f')](_0x14f234[_0xd46e('0x47')][_0xd46e('0x2f')]);}_0x2a5507[_0xd46e('0x69')]=qs[_0xd46e('0x4f')](_0x14f234['query'][_0xd46e('0x4f')]);_0x2a5507[_0xd46e('0x50')]=qs[_0xd46e('0x49')](_[_0xd46e('0x6a')](_0x14f234['query'],_0x554c45[_0xd46e('0x49')]));_0x2a5507[_0xd46e('0x50')][_0xd46e('0x64')]=_0xceff66['id'];if(_0x14f234[_0xd46e('0x47')][_0xd46e('0x51')]){_0x2a5507['where']=_[_0xd46e('0x53')](_0x2a5507[_0xd46e('0x50')],{'$or':_[_0xd46e('0x46')](_0x2a5507[_0xd46e('0x4b')],function(_0xfb687f){var _0x3c9dfc={};_0x3c9dfc[_0xfb687f]={'$like':'%'+_0x14f234[_0xd46e('0x47')][_0xd46e('0x51')]+'%'};return _0x3c9dfc;})});}if(_0x14f234['query'][_0xd46e('0x9d')]){var _0xdb5f71=_0x14f234[_0xd46e('0x47')][_0xd46e('0x9d')][_0xd46e('0x9e')](',');var _0x43c651={};_0x43c651[_0xdb5f71[0x0]]={'$gte':moment(_0xdb5f71[0x1])['format'](_0xd46e('0x9f'))};_0x2a5507[_0xd46e('0x50')]=_[_0xd46e('0x53')](_0x2a5507[_0xd46e('0x50')],_0x43c651);}_0x2a5507=_['merge']({},_0x2a5507,_0x14f234[_0xd46e('0x54')]);return db[_0xd46e('0x9c')][_0xd46e('0x32')]({'where':_0x2a5507[_0xd46e('0x50')]})[_0xd46e('0x36')](function(_0x1bfcfa){_0x56448e[_0xd46e('0x32')]=_0x1bfcfa;if(_0x14f234[_0xd46e('0x47')][_0xd46e('0x5d')]){_0x2a5507['include']=[{'all':!![]}];}return db[_0xd46e('0x9c')][_0xd46e('0x56')](_0x2a5507);})[_0xd46e('0x36')](function(_0xeca9e4){if(_0x14f234[_0xd46e('0x47')][_0xd46e('0xa0')]===_0xd46e('0xa1')){for(var _0x15f827=0x0;_0x15f827<_0xeca9e4[_0xd46e('0x4c')];_0x15f827++){_0xeca9e4[_0x15f827][_0xd46e('0x61')]=juice(_0xeca9e4[_0x15f827]['body']);}}_0x56448e[_0xd46e('0x57')]=_0xeca9e4;return _0x56448e;});}})[_0xd46e('0x36')](respondWithFilteredResult(_0x5caa15,_0x2a5507))[_0xd46e('0x58')](handleError(_0x5caa15,null));};exports[_0xd46e('0x3c')]=function(_0x35bfe9,_0x2f5184,_0x44d83f){var _0x2efe85,_0x4f8134={},_0x5d7dd2;if(_0x35bfe9[_0xd46e('0x61')]['to']){_0x5d7dd2=_0x35bfe9[_0xd46e('0x61')]['to'][_0xd46e('0x9e')](',')[0x0];}return db[_0xd46e('0x55')][_0xd46e('0x5f')]({'where':{'id':_0x35bfe9[_0xd46e('0x5a')]['id']},'include':[{'model':db[_0xd46e('0xa2')],'as':_0xd46e('0xa3'),'include':[{'model':db[_0xd46e('0x8a')],'as':_0xd46e('0xa4'),'where':{'email':_0x5d7dd2},'limit':0x1,'order':[[_0xd46e('0xa5'),'DESC']]}]},{'model':db[_0xd46e('0x40')],'as':'Smtp','raw':!![]}]})[_0xd46e('0x36')](handleEntityNotFound(_0x2f5184,null))[_0xd46e('0x36')](function(_0x1caa70){if(_0x1caa70){_0x2efe85=_0x1caa70;if(_0x1caa70[_0xd46e('0x62')]){if(_['isNil'](_0x35bfe9[_0xd46e('0x61')][_0xd46e('0xa6')])){_0x35bfe9[_0xd46e('0x61')][_0xd46e('0xa6')]=util[_0xd46e('0xa7')](_0xd46e('0xa8'),_0x1caa70[_0xd46e('0x3b')],_0x1caa70[_0xd46e('0x70')]||_0x1caa70[_0xd46e('0x62')][_0xd46e('0x75')]);}if(_0x35bfe9[_0xd46e('0x61')][_0xd46e('0xa9')]&&_0x35bfe9['body'][_0xd46e('0xa9')][_0xd46e('0x4c')]){for(var _0x1f5f73=0x0;_0x1f5f73<_0x35bfe9['body'][_0xd46e('0xa9')][_0xd46e('0x4c')];_0x1f5f73+=0x1){_0x35bfe9[_0xd46e('0x61')][_0xd46e('0xa9')][_0x1f5f73]={'filename':_0x35bfe9[_0xd46e('0x61')]['attachments'][_0x1f5f73]['name'],'path':path[_0xd46e('0xaa')](config[_0xd46e('0xab')],_0xd46e('0xac'),_0x35bfe9['body'][_0xd46e('0xa9')][_0x1f5f73][_0xd46e('0xad')])};}}var _0x168c6c={'tls':{'rejectUnauthorized':![]}};if(_[_0xd46e('0x71')](_0x1caa70['Smtp'][_0xd46e('0x7b')])){if(_0x1caa70['Smtp']['authentication']){_0x168c6c[_0xd46e('0xae')]={'user':_0x1caa70[_0xd46e('0x62')]['user'],'pass':_0x1caa70[_0xd46e('0x62')][_0xd46e('0xaf')]};}_0x168c6c['host']=_0x1caa70['Smtp']['host'];_0x168c6c['port']=_0x1caa70[_0xd46e('0x62')][_0xd46e('0x7a')];_0x168c6c[_0xd46e('0xb0')]=_0x1caa70[_0xd46e('0x62')][_0xd46e('0xb0')];}else{_0x168c6c[_0xd46e('0x7b')]=_0x1caa70['Smtp'][_0xd46e('0x7b')];_0x168c6c[_0xd46e('0xae')]={'user':_0x1caa70[_0xd46e('0x62')][_0xd46e('0x75')],'pass':_0x1caa70[_0xd46e('0x62')]['pass']};}return respondWithRpcPromise(_0xd46e('0xb1'),_0xd46e('0xb2'),{'account':_0x168c6c,'message':_0x35bfe9[_0xd46e('0x61')]});}else{throw new Error('List\x20not\x20found');}}})[_0xd46e('0x36')](function(_0x3559d2){if(_0x3559d2){_0x4f8134=_0x3559d2;if(_0x2efe85[_0xd46e('0xa3')]){if(_0x2efe85[_0xd46e('0xa3')]['Contacts'][_0xd46e('0x4c')]){return _0x2efe85[_0xd46e('0xa3')]['Contacts'][0x0];}else{return db[_0xd46e('0x8a')][_0xd46e('0x66')](_[_0xd46e('0x1b')](_0x35bfe9[_0xd46e('0x61')],{'firstName':_0x35bfe9[_0xd46e('0x61')]['to'],'email':_0x35bfe9[_0xd46e('0x61')]['to'],'phone':_0x35bfe9[_0xd46e('0x61')]['to'],'ListId':_0x2efe85[_0xd46e('0xb3')]}));}}else{throw new Error(_0xd46e('0xb4'));}}})[_0xd46e('0x36')](function(_0x27ec8e){if(_0x27ec8e){var _0xbfe0a9={'UserId':_0x35bfe9[_0xd46e('0x75')]['id'],'ContactId':_0x27ec8e['id'],'MailAccountId':_0x2efe85['id'],'inReplyTo':_0x4f8134[_0xd46e('0xb5')],'to':_0x35bfe9['body'][_0xd46e('0xa6')],'cc':_0x35bfe9[_0xd46e('0x61')]['cc'],'subject':_0x35bfe9[_0xd46e('0x61')][_0xd46e('0xb6')],'attach':_0x35bfe9['body'][_0xd46e('0xb7')],'firstMsgDirection':'out','lastMsgAt':moment()[_0xd46e('0xa7')](_0xd46e('0x9f')),'lastMsgDirection':_0xd46e('0xb8'),'Messages':[_['merge'](_0x35bfe9['body'],{'messageId':_0x4f8134[_0xd46e('0xb5')],'sentAt':moment()[_0xd46e('0xa7')](_0xd46e('0x9f')),'read':!![],'MailAccountId':_0x2efe85['id'],'UserId':_0x35bfe9['user']['id'],'ContactId':_0x27ec8e['id']})]};if(_0x35bfe9['body']['Interaction']){_0xbfe0a9=_['merge'](_0xbfe0a9,_0x35bfe9['body'][_0xd46e('0xb9')]);}return db[_0xd46e('0x88')][_0xd46e('0x66')](_0xbfe0a9,{'include':[{'model':db[_0xd46e('0x9c')],'as':_0xd46e('0xba')}]});}})[_0xd46e('0x36')](respondWithResult(_0x2f5184,null))[_0xd46e('0x58')](handleError(_0x2f5184,null));};exports[_0xd46e('0xbb')]=function(_0x455100,_0x36bb7e,_0x513b46){return db[_0xd46e('0x55')]['find']({'where':{'id':_0x455100[_0xd46e('0x5a')]['id']},'include':[{'model':db[_0xd46e('0x40')],'as':'Smtp','raw':!![]}]})[_0xd46e('0x36')](handleEntityNotFound(_0x36bb7e,null))['then'](function(_0x5888a9){if(_0x5888a9&&_0x5888a9[_0xd46e('0x62')]){var _0xb26125={'id':_0x5888a9['id'],'tls':{'rejectUnauthorized':![]}};if(_0x5888a9['Smtp'][_0xd46e('0x7b')]){_0xb26125[_0xd46e('0x7b')]=_0x5888a9[_0xd46e('0x62')][_0xd46e('0x7b')];}else{_0xb26125[_0xd46e('0x79')]=_0x5888a9['Smtp'][_0xd46e('0x79')];_0xb26125[_0xd46e('0x7a')]=_0x5888a9['Smtp']['port'];_0xb26125[_0xd46e('0xb0')]=_0x5888a9[_0xd46e('0x62')][_0xd46e('0xb0')];}if(_0x5888a9[_0xd46e('0x62')][_0xd46e('0x78')]){_0xb26125[_0xd46e('0xae')]={'user':_0x5888a9['Smtp'][_0xd46e('0x75')],'pass':_0x5888a9[_0xd46e('0x62')][_0xd46e('0xaf')]};}return respondWithRpcPromise(_0xd46e('0xbc'),_0xd46e('0xbb'),{'account':_0xb26125});}})[_0xd46e('0x36')](respondWithResult(_0x36bb7e,null))[_0xd46e('0x58')](handleError(_0x36bb7e,null));};exports['destroy']=function(_0x1f25b6,_0x2ba4f1){return db['MailAccount'][_0xd46e('0x5f')]({'where':{'id':_0x1f25b6[_0xd46e('0x5a')]['id']}})[_0xd46e('0x36')](handleEntityNotFound(_0x2ba4f1,null))[_0xd46e('0x36')](function(_0x199806){if(_0x199806&&_0x199806['service']){throw new db['Sequelize']['ValidationError'](_0xd46e('0xbd'));}return _0x199806;})[_0xd46e('0x36')](removeEntity(_0x2ba4f1,null))['catch'](handleError(_0x2ba4f1,null));};exports[_0xd46e('0xbe')]=function(_0x561b8b,_0x14f285,_0x46b8c4){return db[_0xd46e('0x55')][_0xd46e('0x5f')]({'where':{'id':_0x561b8b[_0xd46e('0x5a')]['id']}})[_0xd46e('0x36')](handleEntityNotFound(_0x14f285,null))['then'](function(_0x14036f){if(_0x14036f){return _0x14036f[_0xd46e('0xbe')](_0x561b8b[_0xd46e('0x61')]['ids'],_[_0xd46e('0x89')](_0x561b8b[_0xd46e('0x61')],[_0xd46e('0x6f'),'id'])||{})[_0xd46e('0xbf')](function(_0x5e50e1){for(var _0x533921=0x0;_0x533921<_0x561b8b[_0xd46e('0x61')][_0xd46e('0x6f')]['length'];_0x533921+=0x1){socket[_0xd46e('0xc0')](_0xd46e('0xc1'),{'UserId':_0x561b8b[_0xd46e('0x61')][_0xd46e('0x6f')][_0x533921],'MailAccountId':_0x561b8b[_0xd46e('0x5a')]['id']});}return _0x5e50e1;});}})['then'](respondWithResult(_0x14f285,null))[_0xd46e('0x58')](handleError(_0x14f285,null));};exports[_0xd46e('0xc2')]=function(_0x39bc86,_0x4618fe,_0x1e505c){return db[_0xd46e('0x55')][_0xd46e('0x5f')]({'where':{'id':_0x39bc86[_0xd46e('0x5a')]['id']}})[_0xd46e('0x36')](handleEntityNotFound(_0x4618fe,null))[_0xd46e('0x36')](function(_0x54130c){if(_0x54130c){return _0x54130c[_0xd46e('0xc2')](_0x39bc86[_0xd46e('0x47')][_0xd46e('0x6f')])[_0xd46e('0x36')](function(){if(_[_0xd46e('0xc3')](_0x39bc86[_0xd46e('0x47')][_0xd46e('0x6f')])){for(var _0x3bbf1c=0x0;_0x3bbf1c<_0x39bc86[_0xd46e('0x47')]['ids'][_0xd46e('0x4c')];_0x3bbf1c+=0x1){socket[_0xd46e('0xc0')]('userMailAccount:remove',{'UserId':Number(_0x39bc86[_0xd46e('0x47')]['ids'][_0x3bbf1c]),'MailAccountId':Number(_0x39bc86['params']['id'])});}}else{socket[_0xd46e('0xc0')](_0xd46e('0xc4'),{'UserId':Number(_0x39bc86[_0xd46e('0x47')][_0xd46e('0x6f')]),'MailAccountId':Number(_0x39bc86[_0xd46e('0x5a')]['id'])});}});}})[_0xd46e('0x36')](respondWithStatusCode(_0x4618fe,null))[_0xd46e('0x58')](handleError(_0x4618fe,null));};exports[_0xd46e('0xc5')]=function(_0x4a7f52,_0x313d20,_0xdc4e33){var _0x1fe7d2={};var _0x26be26={};var _0x14476c;var _0x26b573;return db['MailAccount']['findOne']({'where':{'id':_0x4a7f52[_0xd46e('0x5a')]['id']}})[_0xd46e('0x36')](handleEntityNotFound(_0x313d20,null))['then'](function(_0x5bda89){if(_0x5bda89){_0x14476c=_0x5bda89;_0x26be26[_0xd46e('0x45')]=_['keys'](db[_0xd46e('0x8c')][_0xd46e('0x42')]);_0x26be26[_0xd46e('0x47')]=_[_0xd46e('0x48')](_0x4a7f52[_0xd46e('0x47')]);_0x26be26['filters']=_[_0xd46e('0x4a')](_0x26be26[_0xd46e('0x45')],_0x26be26[_0xd46e('0x47')]);_0x1fe7d2[_0xd46e('0x4b')]=_[_0xd46e('0x4a')](_0x26be26['model'],qs[_0xd46e('0x5c')](_0x4a7f52['query'][_0xd46e('0x5c')]));_0x1fe7d2[_0xd46e('0x4b')]=_0x1fe7d2[_0xd46e('0x4b')][_0xd46e('0x4c')]?_0x1fe7d2[_0xd46e('0x4b')]:_0x26be26[_0xd46e('0x45')];_0x1fe7d2[_0xd46e('0x69')]=qs[_0xd46e('0x4f')](_0x4a7f52[_0xd46e('0x47')]['sort']);_0x1fe7d2[_0xd46e('0x50')]=qs[_0xd46e('0x49')](_['pick'](_0x4a7f52[_0xd46e('0x47')],_0x26be26[_0xd46e('0x49')]));if(_0x4a7f52['query'][_0xd46e('0x51')]){_0x1fe7d2['where']=_[_0xd46e('0x53')](_0x1fe7d2[_0xd46e('0x50')],{'$or':_['map'](_0x1fe7d2['attributes'],function(_0x397190){var _0x59802f={};_0x59802f[_0x397190]={'$like':'%'+_0x4a7f52[_0xd46e('0x47')][_0xd46e('0x51')]+'%'};return _0x59802f;})});}_0x1fe7d2=_[_0xd46e('0x53')]({},_0x1fe7d2,_0x4a7f52['options']);return _0x14476c[_0xd46e('0xc5')](_0x1fe7d2);}})['then'](function(_0x3302d6){if(_0x3302d6){_0x26b573=_0x3302d6['length'];if(!_0x4a7f52[_0xd46e('0x47')][_0xd46e('0x4d')](_0xd46e('0x4e'))){_0x1fe7d2[_0xd46e('0x31')]=qs[_0xd46e('0x31')](_0x4a7f52[_0xd46e('0x47')]['limit']);_0x1fe7d2[_0xd46e('0x2f')]=qs[_0xd46e('0x2f')](_0x4a7f52[_0xd46e('0x47')][_0xd46e('0x2f')]);}return _0x14476c['getAgents'](_0x1fe7d2);}})[_0xd46e('0x36')](function(_0x1dbc07){if(_0x1dbc07){return _0x1dbc07?{'count':_0x26b573,'rows':_0x1dbc07}:null;}})[_0xd46e('0x36')](respondWithResult(_0x313d20,null))[_0xd46e('0x58')](handleError(_0x313d20,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index 3a77560..aa9b5d5 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 _0x7e1d=['hook','exports','events','setMaxListeners','save','update','remove','emit'];(function(_0x5e1f60,_0x1104c5){var _0x5569fb=function(_0x9845ae){while(--_0x9845ae){_0x5e1f60['push'](_0x5e1f60['shift']());}};_0x5569fb(++_0x1104c5);}(_0x7e1d,0x15a));var _0xd7e1=function(_0x43893b,_0x435ac5){_0x43893b=_0x43893b-0x0;var _0x32d519=_0x7e1d[_0x43893b];return _0x32d519;};'use strict';var EventEmitter=require(_0xd7e1('0x0'));var MailAccount=require('../../mysqldb')['db']['MailAccount'];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0xd7e1('0x1')](0x0);var events={'afterCreate':_0xd7e1('0x2'),'afterUpdate':_0xd7e1('0x3'),'afterDestroy':_0xd7e1('0x4')};function emitEvent(_0x11af92){return function(_0x143b3f,_0x51424f,_0x28bddc){MailAccountEvents[_0xd7e1('0x5')](_0x11af92+':'+_0x143b3f['id'],_0x143b3f);MailAccountEvents[_0xd7e1('0x5')](_0x11af92,_0x143b3f);_0x28bddc(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailAccount[_0xd7e1('0x6')](e,emitEvent(event));}}module[_0xd7e1('0x7')]=MailAccountEvents; \ No newline at end of file +var _0x9d01=['hasOwnProperty','exports','events','../../mysqldb','MailAccount','setMaxListeners','save','update','remove','emit'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x9d01,0x1ec));var _0x19d0=function(_0x351e3d,_0x13c1f4){_0x351e3d=_0x351e3d-0x0;var _0x2d1b16=_0x9d01[_0x351e3d];return _0x2d1b16;};'use strict';var EventEmitter=require(_0x19d0('0x0'));var MailAccount=require(_0x19d0('0x1'))['db'][_0x19d0('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x19d0('0x3')](0x0);var events={'afterCreate':_0x19d0('0x4'),'afterUpdate':_0x19d0('0x5'),'afterDestroy':_0x19d0('0x6')};function emitEvent(_0x3ecfe0){return function(_0x53eef3,_0x518cd2,_0x5e8396){MailAccountEvents[_0x19d0('0x7')](_0x3ecfe0+':'+_0x53eef3['id'],_0x53eef3);MailAccountEvents[_0x19d0('0x7')](_0x3ecfe0,_0x53eef3);_0x5e8396(null);};}for(var e in events){if(events[_0x19d0('0x8')](e)){var event=events[e];MailAccount['hook'](e,emitEvent(event));}}module[_0x19d0('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 e14aa01..1183ebd 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 _0xc32b=['../../config/environment','./mailAccount.attributes','exports','define','MailAccount','mail_accounts','lodash','util','../../config/logger','moment','request-promise','path','rimraf'];(function(_0x1a5d26,_0x4db6cc){var _0x2c26ff=function(_0x166336){while(--_0x166336){_0x1a5d26['push'](_0x1a5d26['shift']());}};_0x2c26ff(++_0x4db6cc);}(_0xc32b,0x88));var _0xbc32=function(_0x52984f,_0x4268cb){_0x52984f=_0x52984f-0x0;var _0x19dc2b=_0xc32b[_0x52984f];return _0x19dc2b;};'use strict';var _=require(_0xbc32('0x0'));var util=require(_0xbc32('0x1'));var logger=require(_0xbc32('0x2'))('api');var moment=require(_0xbc32('0x3'));var BPromise=require('bluebird');var rp=require(_0xbc32('0x4'));var fs=require('fs');var path=require(_0xbc32('0x5'));var rimraf=require(_0xbc32('0x6'));var config=require(_0xbc32('0x7'));var attributes=require(_0xbc32('0x8'));module[_0xbc32('0x9')]=function(_0x3e8c71,_0x88770b){return _0x3e8c71[_0xbc32('0xa')](_0xbc32('0xb'),attributes,{'tableName':_0xbc32('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb685=['lodash','../../config/logger','api','moment','bluebird','path','../../config/environment','./mailAccount.attributes','define','MailAccount','mail_accounts'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xb685,0x134));var _0x5b68=function(_0x209213,_0x16a917){_0x209213=_0x209213-0x0;var _0xd194c0=_0xb685[_0x209213];return _0xd194c0;};'use strict';var _=require(_0x5b68('0x0'));var util=require('util');var logger=require(_0x5b68('0x1'))(_0x5b68('0x2'));var moment=require(_0x5b68('0x3'));var BPromise=require(_0x5b68('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5b68('0x5'));var rimraf=require('rimraf');var config=require(_0x5b68('0x6'));var attributes=require(_0x5b68('0x7'));module['exports']=function(_0x36fe5b,_0x5b8a53){return _0x36fe5b[_0x5b68('0x8')](_0x5b68('0x9'),attributes,{'tableName':_0x5b68('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 1f023b3..11c9e87 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 _0x10f1=['MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','error','message','catch','GetMailAccount','MailAccount','options','include','map','attributes','model','stringify','ShowMailAccount','find','where','NotifyMailAccount','body','mail','difference','keys','CmContact','createdAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','account','CmList','List','Contacts','updatedAt','DESC','MailServerOut','Smtp','get','omit','Applications','applications','orderBy','priority','asc','autoclose','push','length','close','defaults','create','List\x20not\x20found','contact','messageId','generate','subject','attach','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','Messages','inReplyTo','Contact\x20not\x20found','update','format','interaction','created','attachments','originTo','originCc','bcc','ChatWebsiteId','originChannel','Attachment','UserId','name','unshift','waitForTheAssignedAgent','*,*,*,*','Start','lodash','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./mailAccount.socket','register','then','info'];(function(_0x3b92e8,_0x375aa8){var _0x4600ba=function(_0x26946e){while(--_0x26946e){_0x3b92e8['push'](_0x3b92e8['shift']());}};_0x4600ba(++_0x375aa8);}(_0x10f1,0x1e7));var _0x110f=function(_0x2ba3c8,_0x2238b0){_0x2ba3c8=_0x2ba3c8-0x0;var _0x372226=_0x10f1[_0x2ba3c8];return _0x372226;};'use strict';var _=require(_0x110f('0x0'));var util=require('util');var moment=require(_0x110f('0x1'));var BPromise=require(_0x110f('0x2'));var rs=require(_0x110f('0x3'));var fs=require('fs');var Redis=require(_0x110f('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x110f('0x5'))(_0x110f('0x6'));var config=require(_0x110f('0x7'));var jayson=require(_0x110f('0x8'));var client=jayson[_0x110f('0x9')][_0x110f('0xa')]({'port':0x232c});config[_0x110f('0xb')]=_['defaults'](config[_0x110f('0xb')],{'host':_0x110f('0xc'),'port':0x18eb});var socket=require(_0x110f('0xd'))(new Redis(config[_0x110f('0xb')]));require(_0x110f('0xe'))[_0x110f('0xf')](socket);function respondWithRpcPromise(_0xc4fdec,_0x280411,_0x14973e){return new BPromise(function(_0x14909d,_0x5d3cd1){return client['request'](_0xc4fdec,_0x14973e)[_0x110f('0x10')](function(_0x7c84b9){logger[_0x110f('0x11')](_0x110f('0x12'),_0x280411,_0x110f('0x13'));logger[_0x110f('0x14')](_0x110f('0x15'),_0x280411,'request\x20sent',JSON['stringify'](_0x7c84b9));if(_0x7c84b9[_0x110f('0x16')]){if(_0x7c84b9[_0x110f('0x16')]['code']===0x1f4){logger['error']('MailAccount,\x20%s,\x20%s',_0x280411,_0x7c84b9['error']['message']);return _0x5d3cd1(_0x7c84b9[_0x110f('0x16')][_0x110f('0x17')]);}logger['error'](_0x110f('0x12'),_0x280411,_0x7c84b9[_0x110f('0x16')]['message']);return _0x14909d(_0x7c84b9['error']['message']);}else{logger[_0x110f('0x11')](_0x110f('0x12'),_0x280411,'request\x20sent');_0x14909d(_0x7c84b9['result']['message']);}})[_0x110f('0x18')](function(_0x18190e){logger[_0x110f('0x16')](_0x110f('0x12'),_0x280411,_0x18190e);_0x5d3cd1(_0x18190e);});});}exports[_0x110f('0x19')]=function(_0x27ba96){var _0x34dc69=this;return new Promise(function(_0x5ef666,_0x1e397e){return db[_0x110f('0x1a')]['findAll']({'raw':_0x27ba96['options']?_0x27ba96[_0x110f('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x27ba96[_0x110f('0x1b')]?_0x27ba96[_0x110f('0x1b')]['where']||null:null,'attributes':_0x27ba96[_0x110f('0x1b')]?_0x27ba96[_0x110f('0x1b')]['attributes']||null:null,'limit':_0x27ba96[_0x110f('0x1b')]?_0x27ba96[_0x110f('0x1b')]['limit']||null:null,'include':_0x27ba96[_0x110f('0x1b')]?_0x27ba96['options'][_0x110f('0x1c')]?_[_0x110f('0x1d')](_0x27ba96['options'][_0x110f('0x1c')],function(_0x96c080){return{'model':db[_0x96c080['model']],'as':_0x96c080['as'],'attributes':_0x96c080[_0x110f('0x1e')],'include':_0x96c080[_0x110f('0x1c')]?_[_0x110f('0x1d')](_0x96c080[_0x110f('0x1c')],function(_0x34eaaa){return{'model':db[_0x34eaaa[_0x110f('0x1f')]],'as':_0x34eaaa['as'],'attributes':_0x34eaaa[_0x110f('0x1e')],'include':_0x34eaaa[_0x110f('0x1c')]?_[_0x110f('0x1d')](_0x34eaaa['include'],function(_0x4db948){return{'model':db[_0x4db948['model']],'as':_0x4db948['as'],'attributes':_0x4db948[_0x110f('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x110f('0x10')](function(_0x19e02c){logger['info'](_0x110f('0x19'),_0x27ba96);logger['debug'](_0x110f('0x19'),_0x27ba96,JSON[_0x110f('0x20')](_0x19e02c));_0x5ef666(_0x19e02c);})[_0x110f('0x18')](function(_0x2b3a48){logger[_0x110f('0x16')](_0x110f('0x19'),_0x2b3a48[_0x110f('0x17')],_0x27ba96);_0x1e397e(_0x34dc69[_0x110f('0x16')](0x1f4,_0x2b3a48[_0x110f('0x17')]));});});};exports[_0x110f('0x21')]=function(_0x27fd5b){var _0x4d057a=this;return new Promise(function(_0x4d395f,_0x252074){return db[_0x110f('0x1a')][_0x110f('0x22')]({'raw':_0x27fd5b[_0x110f('0x1b')]?_0x27fd5b[_0x110f('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x27fd5b['options']?_0x27fd5b[_0x110f('0x1b')][_0x110f('0x23')]||null:null,'attributes':_0x27fd5b[_0x110f('0x1b')]?_0x27fd5b['options']['attributes']||null:null,'include':_0x27fd5b[_0x110f('0x1b')]?_0x27fd5b[_0x110f('0x1b')][_0x110f('0x1c')]?_[_0x110f('0x1d')](_0x27fd5b['options']['include'],function(_0x1c80c0){return{'model':db[_0x1c80c0[_0x110f('0x1f')]],'as':_0x1c80c0['as'],'attributes':_0x1c80c0[_0x110f('0x1e')],'include':_0x1c80c0['include']?_[_0x110f('0x1d')](_0x1c80c0[_0x110f('0x1c')],function(_0x4c65f8){return{'model':db[_0x4c65f8[_0x110f('0x1f')]],'as':_0x4c65f8['as'],'attributes':_0x4c65f8['attributes'],'include':_0x4c65f8['include']?_['map'](_0x4c65f8[_0x110f('0x1c')],function(_0x13a7a0){return{'model':db[_0x13a7a0[_0x110f('0x1f')]],'as':_0x13a7a0['as'],'attributes':_0x13a7a0[_0x110f('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x110f('0x10')](function(_0x1a0a49){logger[_0x110f('0x11')](_0x110f('0x21'),_0x27fd5b);logger['debug']('ShowMailAccount',_0x27fd5b,JSON[_0x110f('0x20')](_0x1a0a49));_0x4d395f(_0x1a0a49);})['catch'](function(_0x358b50){logger[_0x110f('0x16')](_0x110f('0x21'),_0x358b50[_0x110f('0x17')],_0x27fd5b);_0x252074(_0x4d057a[_0x110f('0x16')](0x1f4,_0x358b50[_0x110f('0x17')]));});});};exports[_0x110f('0x24')]=function(_0x2b75ea){var _0xf7a8f6=this;return new Promise(function(_0x43e841,_0x2dab1f){var _0x22f455={'body':_0x2b75ea[_0x110f('0x25')],'channel':_0x110f('0x26')};var _0x29f717=_[_0x110f('0x27')](_[_0x110f('0x28')](db[_0x110f('0x29')]['rawAttributes']),[_0x110f('0x2a'),'updatedAt',_0x110f('0x2b'),_0x110f('0x2c')]);var _0x176062=![];if(_0x2b75ea[_0x110f('0x25')]['id']){delete _0x2b75ea[_0x110f('0x25')]['id'];}if(_[_0x110f('0x2d')](_0x2b75ea[_0x110f('0x25')][_0x110f('0x2e')])){return _0x2dab1f(_0xf7a8f6['error'](0x1f4,_0x110f('0x2f')));}if(_['isNil'](_0x2b75ea[_0x110f('0x25')][_0x110f('0x25')])||_0x2b75ea[_0x110f('0x25')][_0x110f('0x25')]===''){return _0x2dab1f(_0xf7a8f6[_0x110f('0x16')](0x1f4,_0x110f('0x30')));}if(_[_0x110f('0x2d')](_0x2b75ea['body'][_0x110f('0x31')])){return _0x2dab1f(_0xf7a8f6['error'](0x1f4,_0x110f('0x32')+_0x29f717));}if(!_['includes'](_0x29f717,_0x2b75ea['body'][_0x110f('0x31')])){return _0x2dab1f(_0xf7a8f6[_0x110f('0x16')](0x1f4,'mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x29f717));}var _0x5173fb={};_0x5173fb[_0x2b75ea[_0x110f('0x25')][_0x110f('0x31')]]=_0x2b75ea['body'][_0x110f('0x2e')];return db[_0x110f('0x1a')][_0x110f('0x22')]({'where':{'id':_0x2b75ea[_0x110f('0x33')]['id']},'include':[{'model':db[_0x110f('0x34')],'as':_0x110f('0x35'),'include':[{'model':db[_0x110f('0x29')],'as':_0x110f('0x36'),'where':_0x5173fb,'limit':0x1,'order':[[_0x110f('0x37'),_0x110f('0x38')]]}]},{'model':db['MailApplication'],'as':'Applications'},{'model':db[_0x110f('0x39')],'as':_0x110f('0x3a')}]})[_0x110f('0x10')](function(_0x4a0c96){if(_0x4a0c96&&_0x4a0c96['List']){var _0x37da61=_0x4a0c96[_0x110f('0x3b')]({'plain':!![]});_0x22f455[_0x110f('0x33')]=_[_0x110f('0x3c')](_0x37da61,[_0x110f('0x3d'),_0x110f('0x35')]);_0x22f455['applications']=_0x37da61[_0x110f('0x3d')];_0x22f455['list']=_0x37da61['List'];_0x22f455[_0x110f('0x3e')]=_[_0x110f('0x3f')](_0x22f455[_0x110f('0x3e')],[_0x110f('0x40')],[_0x110f('0x41')]);if(_0x22f455[_0x110f('0x33')]&&_0x22f455[_0x110f('0x33')][_0x110f('0x42')]){_0x22f455[_0x110f('0x3e')][_0x110f('0x43')]({'id':0x0,'priority':_0x22f455[_0x110f('0x3e')][_0x110f('0x44')]+0x1,'app':_0x110f('0x45'),'appdata':_0x110f('0x42'),'interval':'*,*,*,*'});}if(_0x22f455[_0x110f('0x33')]['Applications']){delete _0x22f455[_0x110f('0x33')]['Applications'];}if(_0x22f455[_0x110f('0x33')][_0x110f('0x35')]){delete _0x22f455[_0x110f('0x33')][_0x110f('0x35')];}if(_0x37da61[_0x110f('0x35')][_0x110f('0x36')][_0x110f('0x44')]){return _0x37da61[_0x110f('0x35')][_0x110f('0x36')][0x0];}var _0x1937b3=_[_0x110f('0x46')](_0x2b75ea['body'],{'firstName':_0x2b75ea[_0x110f('0x25')][_0x110f('0x2e')],'ListId':_0x37da61['ListId']});_0x1937b3[_0x2b75ea[_0x110f('0x25')]['mapKey']]=_0x2b75ea[_0x110f('0x25')][_0x110f('0x2e')];return db[_0x110f('0x29')][_0x110f('0x47')](_0x1937b3);}else{throw new Error(_0x110f('0x48'));}})[_0x110f('0x10')](function(_0x1c9c7d){_0x22f455[_0x110f('0x49')]=_0x1c9c7d;if(_0x1c9c7d){if(!_0x2b75ea[_0x110f('0x25')][_0x110f('0x17')][_0x110f('0x4a')]){_0x2b75ea['body']['message'][_0x110f('0x4a')]=rs[_0x110f('0x4b')]()+'\x20'+_0x2b75ea[_0x110f('0x25')][_0x110f('0x17')][_0x110f('0x2e')];}var _0x620426={'ContactId':_0x1c9c7d['id'],'MailAccountId':_0x2b75ea[_0x110f('0x33')]['id'],'inReplyTo':_0x2b75ea[_0x110f('0x25')][_0x110f('0x17')]['messageId'],'to':_0x2b75ea[_0x110f('0x25')][_0x110f('0x17')][_0x110f('0x2e')],'cc':_0x2b75ea[_0x110f('0x25')][_0x110f('0x17')]['cc'],'subject':_0x2b75ea[_0x110f('0x25')][_0x110f('0x17')][_0x110f('0x4c')],'attach':_0x2b75ea[_0x110f('0x25')][_0x110f('0x17')][_0x110f('0x4d')],'lastMsgAt':moment()['format'](_0x110f('0x4e')),'lastMsgDirection':'in'};return db[_0x110f('0x4f')][_0x110f('0x22')]({'where':{'closed':![],'MailAccountId':_0x2b75ea['account']['id']},'include':[{'model':db[_0x110f('0x50')],'as':_0x110f('0x51'),'attributes':['messageId'],'where':{'messageId':_0x2b75ea['body'][_0x110f('0x17')][_0x110f('0x52')]}}]})[_0x110f('0x10')](function(_0x291be2){if(_0x291be2){return[_0x291be2,![]];}return db[_0x110f('0x4f')][_0x110f('0x47')](_0x620426)[_0x110f('0x10')](function(_0x138451){return[_0x138451,!![]];});});}else{throw new Error(_0x110f('0x53'));}})['spread'](function(_0x37f467,_0x5e1e08){if(_0x37f467){_0x176062=_0x5e1e08;if(!_0x5e1e08){return _0x37f467[_0x110f('0x54')]({'inReplyTo':_0x2b75ea[_0x110f('0x25')]['message'][_0x110f('0x4a')],'to':_0x2b75ea[_0x110f('0x25')][_0x110f('0x17')]['from'],'cc':_0x2b75ea[_0x110f('0x25')]['message']['cc'],'subject':_0x2b75ea[_0x110f('0x25')][_0x110f('0x17')]['subject'],'attach':_0x37f467[_0x110f('0x4d')]?_0x37f467['attach']:_0x2b75ea[_0x110f('0x25')]['message'][_0x110f('0x4d')],'substatus':null,'substatusAt':moment()[_0x110f('0x55')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgAt':moment()['format'](_0x110f('0x4e')),'lastMsgDirection':'in'});}else{return _0x37f467;}}})[_0x110f('0x10')](function(_0x1d3c2d){_0x22f455[_0x110f('0x56')]=_0x1d3c2d[_0x110f('0x3b')]({'plain':!![]});_0x22f455['interaction'][_0x110f('0x57')]=_0x176062;return db['MailMessage'][_0x110f('0x47')]({'body':_0x2b75ea[_0x110f('0x25')][_0x110f('0x25')],'MailAccountId':_0x2b75ea[_0x110f('0x33')]['id'],'MailInteractionId':_0x1d3c2d['id'],'direction':'in','ContactId':_0x22f455[_0x110f('0x49')]['id'],'messageId':_0x2b75ea[_0x110f('0x25')][_0x110f('0x17')][_0x110f('0x4a')],'from':_0x2b75ea[_0x110f('0x25')][_0x110f('0x17')][_0x110f('0x2e')],'to':_0x2b75ea['body'][_0x110f('0x17')]['to'],'cc':_0x2b75ea[_0x110f('0x25')][_0x110f('0x17')]['cc'],'subject':_0x2b75ea[_0x110f('0x25')][_0x110f('0x17')][_0x110f('0x4c')],'attach':_0x2b75ea[_0x110f('0x25')][_0x110f('0x17')][_0x110f('0x4d')],'Attachments':_0x2b75ea['body']['message'][_0x110f('0x58')],'originTo':_0x2b75ea[_0x110f('0x25')][_0x110f('0x17')][_0x110f('0x59')],'originCc':_0x2b75ea['body'][_0x110f('0x17')][_0x110f('0x5a')],'bcc':_0x2b75ea['body'][_0x110f('0x17')][_0x110f('0x5b')],'ChatWebsiteId':_0x2b75ea[_0x110f('0x25')][_0x110f('0x17')][_0x110f('0x5c')]||null,'originChannel':_0x2b75ea[_0x110f('0x25')]['message'][_0x110f('0x5d')]||'Email','ChatOfflineMessageId':_0x2b75ea[_0x110f('0x25')]['message']['ChatOfflineMessageId']||null},{'include':[{'model':db[_0x110f('0x5e')],'as':'Attachments'}]});})['then'](function(_0x292c2d){_0x22f455['message']=_0x292c2d;if(_0x22f455['interaction'][_0x110f('0x5f')]){return db['User'][_0x110f('0x22')]({'attributes':['id',_0x110f('0x60')],'where':{'id':_0x22f455[_0x110f('0x56')][_0x110f('0x5f')]}})[_0x110f('0x10')](function(_0x44a6d5){if(_0x44a6d5){_0x22f455[_0x110f('0x3e')][_0x110f('0x61')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x44a6d5[_0x110f('0x60')]+','+(_0x22f455[_0x110f('0x33')][_0x110f('0x62')]||0xa),'interval':_0x110f('0x63')});}return respondWithRpcPromise(_0x110f('0x64'),'startRouting',_0x22f455);});}return respondWithRpcPromise(_0x110f('0x64'),'startRouting',_0x22f455);})[_0x110f('0x10')](function(_0xcc5d48){_0x43e841(_0xcc5d48);})[_0x110f('0x18')](function(_0x1f9998){_0x2dab1f(_0xf7a8f6[_0x110f('0x16')](0x1f4,_0x1f9998[_0x110f('0x17')]));});});}; \ No newline at end of file +var _0x240d=['where','attributes','include','map','model','ShowMailAccount','find','NotifyMailAccount','body','mail','difference','keys','CmContact','rawAttributes','createdAt','updatedAt','CompanyId','ListId','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','from','account','List','DESC','MailApplication','Applications','Smtp','list','applications','autoclose','close','*,*,*,*','Contacts','defaults','create','List\x20not\x20found','messageId','generate','subject','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailMessage','Messages','inReplyTo','Contact\x20not\x20found','spread','update','interaction','get','created','attachments','originTo','originCc','bcc','ChatWebsiteId','originChannel','ChatOfflineMessageId','Attachment','Attachments','UserId','User','name','agent','waitForTheAssignedAgent','startRouting','Start','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./mailAccount.socket','register','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetMailAccount','MailAccount','options','raw'];(function(_0x13cdbd,_0x4103ea){var _0x260fc7=function(_0x172338){while(--_0x172338){_0x13cdbd['push'](_0x13cdbd['shift']());}};_0x260fc7(++_0x4103ea);}(_0x240d,0xad));var _0xd240=function(_0x2fafd3,_0x2814bd){_0x2fafd3=_0x2fafd3-0x0;var _0x9ec0fc=_0x240d[_0x2fafd3];return _0x9ec0fc;};'use strict';var _=require(_0xd240('0x0'));var util=require(_0xd240('0x1'));var moment=require(_0xd240('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd240('0x3'));var db=require(_0xd240('0x4'))['db'];var utils=require(_0xd240('0x5'));var logger=require(_0xd240('0x6'))('rpc');var config=require(_0xd240('0x7'));var jayson=require(_0xd240('0x8'));var client=jayson[_0xd240('0x9')][_0xd240('0xa')]({'port':0x232c});config[_0xd240('0xb')]=_['defaults'](config[_0xd240('0xb')],{'host':_0xd240('0xc'),'port':0x18eb});var socket=require(_0xd240('0xd'))(new Redis(config[_0xd240('0xb')]));require(_0xd240('0xe'))[_0xd240('0xf')](socket);function respondWithRpcPromise(_0x42f1dc,_0x4782d0,_0x5bf61b){return new BPromise(function(_0xdc6b59,_0x491c86){return client[_0xd240('0x10')](_0x42f1dc,_0x5bf61b)[_0xd240('0x11')](function(_0x27965b){logger[_0xd240('0x12')](_0xd240('0x13'),_0x4782d0,_0xd240('0x14'));logger[_0xd240('0x15')](_0xd240('0x16'),_0x4782d0,_0xd240('0x14'),JSON[_0xd240('0x17')](_0x27965b));if(_0x27965b[_0xd240('0x18')]){if(_0x27965b[_0xd240('0x18')][_0xd240('0x19')]===0x1f4){logger['error'](_0xd240('0x13'),_0x4782d0,_0x27965b['error'][_0xd240('0x1a')]);return _0x491c86(_0x27965b['error'][_0xd240('0x1a')]);}logger[_0xd240('0x18')]('MailAccount,\x20%s,\x20%s',_0x4782d0,_0x27965b['error'][_0xd240('0x1a')]);return _0xdc6b59(_0x27965b[_0xd240('0x18')][_0xd240('0x1a')]);}else{logger[_0xd240('0x12')](_0xd240('0x13'),_0x4782d0,_0xd240('0x14'));_0xdc6b59(_0x27965b[_0xd240('0x1b')][_0xd240('0x1a')]);}})[_0xd240('0x1c')](function(_0x269839){logger[_0xd240('0x18')]('MailAccount,\x20%s,\x20%s',_0x4782d0,_0x269839);_0x491c86(_0x269839);});});}exports[_0xd240('0x1d')]=function(_0x150b07){var _0x35c5ec=this;return new Promise(function(_0x1b63f4,_0x4b57bb){return db[_0xd240('0x1e')]['findAll']({'raw':_0x150b07[_0xd240('0x1f')]?_0x150b07[_0xd240('0x1f')][_0xd240('0x20')]===undefined?!![]:![]:!![],'where':_0x150b07[_0xd240('0x1f')]?_0x150b07[_0xd240('0x1f')][_0xd240('0x21')]||null:null,'attributes':_0x150b07[_0xd240('0x1f')]?_0x150b07[_0xd240('0x1f')][_0xd240('0x22')]||null:null,'limit':_0x150b07[_0xd240('0x1f')]?_0x150b07[_0xd240('0x1f')]['limit']||null:null,'include':_0x150b07[_0xd240('0x1f')]?_0x150b07[_0xd240('0x1f')][_0xd240('0x23')]?_[_0xd240('0x24')](_0x150b07[_0xd240('0x1f')][_0xd240('0x23')],function(_0x4c4d41){return{'model':db[_0x4c4d41['model']],'as':_0x4c4d41['as'],'attributes':_0x4c4d41[_0xd240('0x22')],'include':_0x4c4d41[_0xd240('0x23')]?_['map'](_0x4c4d41['include'],function(_0x5e101c){return{'model':db[_0x5e101c[_0xd240('0x25')]],'as':_0x5e101c['as'],'attributes':_0x5e101c[_0xd240('0x22')],'include':_0x5e101c[_0xd240('0x23')]?_[_0xd240('0x24')](_0x5e101c['include'],function(_0x58a884){return{'model':db[_0x58a884[_0xd240('0x25')]],'as':_0x58a884['as'],'attributes':_0x58a884[_0xd240('0x22')]};}):[]};}):[]};}):[]:[]})[_0xd240('0x11')](function(_0x5d2528){logger['info'](_0xd240('0x1d'),_0x150b07);logger['debug'](_0xd240('0x1d'),_0x150b07,JSON['stringify'](_0x5d2528));_0x1b63f4(_0x5d2528);})[_0xd240('0x1c')](function(_0x30d336){logger[_0xd240('0x18')](_0xd240('0x1d'),_0x30d336[_0xd240('0x1a')],_0x150b07);_0x4b57bb(_0x35c5ec[_0xd240('0x18')](0x1f4,_0x30d336[_0xd240('0x1a')]));});});};exports[_0xd240('0x26')]=function(_0x2a5b3e){var _0x3f63ce=this;return new Promise(function(_0x48343a,_0x30ac29){return db[_0xd240('0x1e')][_0xd240('0x27')]({'raw':_0x2a5b3e[_0xd240('0x1f')]?_0x2a5b3e[_0xd240('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x2a5b3e[_0xd240('0x1f')]?_0x2a5b3e[_0xd240('0x1f')]['where']||null:null,'attributes':_0x2a5b3e['options']?_0x2a5b3e['options'][_0xd240('0x22')]||null:null,'include':_0x2a5b3e['options']?_0x2a5b3e['options'][_0xd240('0x23')]?_['map'](_0x2a5b3e[_0xd240('0x1f')][_0xd240('0x23')],function(_0x556e0e){return{'model':db[_0x556e0e['model']],'as':_0x556e0e['as'],'attributes':_0x556e0e[_0xd240('0x22')],'include':_0x556e0e[_0xd240('0x23')]?_[_0xd240('0x24')](_0x556e0e['include'],function(_0x216cf3){return{'model':db[_0x216cf3[_0xd240('0x25')]],'as':_0x216cf3['as'],'attributes':_0x216cf3[_0xd240('0x22')],'include':_0x216cf3[_0xd240('0x23')]?_[_0xd240('0x24')](_0x216cf3[_0xd240('0x23')],function(_0x5eafb){return{'model':db[_0x5eafb['model']],'as':_0x5eafb['as'],'attributes':_0x5eafb[_0xd240('0x22')]};}):[]};}):[]};}):[]:[]})[_0xd240('0x11')](function(_0x54fac6){logger[_0xd240('0x12')](_0xd240('0x26'),_0x2a5b3e);logger[_0xd240('0x15')](_0xd240('0x26'),_0x2a5b3e,JSON[_0xd240('0x17')](_0x54fac6));_0x48343a(_0x54fac6);})[_0xd240('0x1c')](function(_0x373c9e){logger[_0xd240('0x18')](_0xd240('0x26'),_0x373c9e['message'],_0x2a5b3e);_0x30ac29(_0x3f63ce['error'](0x1f4,_0x373c9e[_0xd240('0x1a')]));});});};exports[_0xd240('0x28')]=function(_0xef9285){var _0x34e50d=this;return new Promise(function(_0x3a567e,_0x880aa2){var _0x37da71={'body':_0xef9285[_0xd240('0x29')],'channel':_0xd240('0x2a')};var _0x231b0f=_[_0xd240('0x2b')](_[_0xd240('0x2c')](db[_0xd240('0x2d')][_0xd240('0x2e')]),[_0xd240('0x2f'),_0xd240('0x30'),_0xd240('0x31'),_0xd240('0x32')]);var _0x572637=![];if(_0xef9285[_0xd240('0x29')]['id']){delete _0xef9285['body']['id'];}if(_[_0xd240('0x33')](_0xef9285['body']['from'])){return _0x880aa2(_0x34e50d[_0xd240('0x18')](0x1f4,'from\x20is\x20mandatory'));}if(_[_0xd240('0x33')](_0xef9285[_0xd240('0x29')]['body'])||_0xef9285[_0xd240('0x29')][_0xd240('0x29')]===''){return _0x880aa2(_0x34e50d[_0xd240('0x18')](0x1f4,_0xd240('0x34')));}if(_[_0xd240('0x33')](_0xef9285[_0xd240('0x29')]['mapKey'])){return _0x880aa2(_0x34e50d['error'](0x1f4,_0xd240('0x35')+_0x231b0f));}if(!_[_0xd240('0x36')](_0x231b0f,_0xef9285[_0xd240('0x29')][_0xd240('0x37')])){return _0x880aa2(_0x34e50d[_0xd240('0x18')](0x1f4,'mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x231b0f));}var _0x2d786c={};_0x2d786c[_0xef9285[_0xd240('0x29')]['mapKey']]=_0xef9285['body'][_0xd240('0x38')];return db['MailAccount'][_0xd240('0x27')]({'where':{'id':_0xef9285[_0xd240('0x39')]['id']},'include':[{'model':db['CmList'],'as':_0xd240('0x3a'),'include':[{'model':db[_0xd240('0x2d')],'as':'Contacts','where':_0x2d786c,'limit':0x1,'order':[[_0xd240('0x30'),_0xd240('0x3b')]]}]},{'model':db[_0xd240('0x3c')],'as':_0xd240('0x3d')},{'model':db['MailServerOut'],'as':_0xd240('0x3e')}]})['then'](function(_0x12bbda){if(_0x12bbda&&_0x12bbda['List']){var _0xe7813=_0x12bbda['get']({'plain':!![]});_0x37da71[_0xd240('0x39')]=_['omit'](_0xe7813,[_0xd240('0x3d'),_0xd240('0x3a')]);_0x37da71['applications']=_0xe7813['Applications'];_0x37da71[_0xd240('0x3f')]=_0xe7813[_0xd240('0x3a')];_0x37da71[_0xd240('0x40')]=_['orderBy'](_0x37da71[_0xd240('0x40')],['priority'],['asc']);if(_0x37da71[_0xd240('0x39')]&&_0x37da71[_0xd240('0x39')][_0xd240('0x41')]){_0x37da71['applications']['push']({'id':0x0,'priority':_0x37da71[_0xd240('0x40')]['length']+0x1,'app':_0xd240('0x42'),'appdata':_0xd240('0x41'),'interval':_0xd240('0x43')});}if(_0x37da71['account']['Applications']){delete _0x37da71[_0xd240('0x39')][_0xd240('0x3d')];}if(_0x37da71[_0xd240('0x39')]['List']){delete _0x37da71[_0xd240('0x39')]['List'];}if(_0xe7813[_0xd240('0x3a')]['Contacts']['length']){return _0xe7813[_0xd240('0x3a')][_0xd240('0x44')][0x0];}var _0x219fff=_[_0xd240('0x45')](_0xef9285[_0xd240('0x29')],{'firstName':_0xef9285['body']['from'],'ListId':_0xe7813[_0xd240('0x32')]});_0x219fff[_0xef9285[_0xd240('0x29')][_0xd240('0x37')]]=_0xef9285[_0xd240('0x29')][_0xd240('0x38')];return db['CmContact'][_0xd240('0x46')](_0x219fff);}else{throw new Error(_0xd240('0x47'));}})[_0xd240('0x11')](function(_0x380053){_0x37da71['contact']=_0x380053;if(_0x380053){if(!_0xef9285['body'][_0xd240('0x1a')][_0xd240('0x48')]){_0xef9285[_0xd240('0x29')]['message'][_0xd240('0x48')]=rs[_0xd240('0x49')]()+'\x20'+_0xef9285['body'][_0xd240('0x1a')][_0xd240('0x38')];}var _0x56dd22={'ContactId':_0x380053['id'],'MailAccountId':_0xef9285[_0xd240('0x39')]['id'],'inReplyTo':_0xef9285[_0xd240('0x29')][_0xd240('0x1a')][_0xd240('0x48')],'to':_0xef9285['body']['message'][_0xd240('0x38')],'cc':_0xef9285[_0xd240('0x29')][_0xd240('0x1a')]['cc'],'subject':_0xef9285[_0xd240('0x29')][_0xd240('0x1a')][_0xd240('0x4a')],'attach':_0xef9285[_0xd240('0x29')][_0xd240('0x1a')][_0xd240('0x4b')],'lastMsgAt':moment()[_0xd240('0x4c')](_0xd240('0x4d')),'lastMsgDirection':'in'};return db['MailInteraction'][_0xd240('0x27')]({'where':{'closed':![],'MailAccountId':_0xef9285[_0xd240('0x39')]['id']},'include':[{'model':db[_0xd240('0x4e')],'as':_0xd240('0x4f'),'attributes':[_0xd240('0x48')],'where':{'messageId':_0xef9285[_0xd240('0x29')][_0xd240('0x1a')][_0xd240('0x50')]}}]})['then'](function(_0x10ed75){if(_0x10ed75){return[_0x10ed75,![]];}return db['MailInteraction'][_0xd240('0x46')](_0x56dd22)['then'](function(_0x51fdb5){return[_0x51fdb5,!![]];});});}else{throw new Error(_0xd240('0x51'));}})[_0xd240('0x52')](function(_0x292ea2,_0x5ab4d8){if(_0x292ea2){_0x572637=_0x5ab4d8;if(!_0x5ab4d8){return _0x292ea2[_0xd240('0x53')]({'inReplyTo':_0xef9285[_0xd240('0x29')][_0xd240('0x1a')]['messageId'],'to':_0xef9285[_0xd240('0x29')][_0xd240('0x1a')]['from'],'cc':_0xef9285['body'][_0xd240('0x1a')]['cc'],'subject':_0xef9285[_0xd240('0x29')][_0xd240('0x1a')][_0xd240('0x4a')],'attach':_0x292ea2[_0xd240('0x4b')]?_0x292ea2[_0xd240('0x4b')]:_0xef9285['body'][_0xd240('0x1a')][_0xd240('0x4b')],'substatus':null,'substatusAt':moment()[_0xd240('0x4c')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgAt':moment()[_0xd240('0x4c')](_0xd240('0x4d')),'lastMsgDirection':'in'});}else{return _0x292ea2;}}})[_0xd240('0x11')](function(_0x3d4ce3){_0x37da71[_0xd240('0x54')]=_0x3d4ce3[_0xd240('0x55')]({'plain':!![]});_0x37da71[_0xd240('0x54')][_0xd240('0x56')]=_0x572637;return db[_0xd240('0x4e')]['create']({'body':_0xef9285[_0xd240('0x29')]['body'],'MailAccountId':_0xef9285[_0xd240('0x39')]['id'],'MailInteractionId':_0x3d4ce3['id'],'direction':'in','ContactId':_0x37da71['contact']['id'],'messageId':_0xef9285[_0xd240('0x29')][_0xd240('0x1a')]['messageId'],'from':_0xef9285[_0xd240('0x29')]['message'][_0xd240('0x38')],'to':_0xef9285[_0xd240('0x29')]['message']['to'],'cc':_0xef9285[_0xd240('0x29')][_0xd240('0x1a')]['cc'],'subject':_0xef9285[_0xd240('0x29')][_0xd240('0x1a')][_0xd240('0x4a')],'attach':_0xef9285['body'][_0xd240('0x1a')][_0xd240('0x4b')],'Attachments':_0xef9285[_0xd240('0x29')][_0xd240('0x1a')][_0xd240('0x57')],'originTo':_0xef9285[_0xd240('0x29')][_0xd240('0x1a')][_0xd240('0x58')],'originCc':_0xef9285[_0xd240('0x29')][_0xd240('0x1a')][_0xd240('0x59')],'bcc':_0xef9285[_0xd240('0x29')][_0xd240('0x1a')][_0xd240('0x5a')],'ChatWebsiteId':_0xef9285[_0xd240('0x29')][_0xd240('0x1a')][_0xd240('0x5b')]||null,'originChannel':_0xef9285['body'][_0xd240('0x1a')][_0xd240('0x5c')]||'Email','ChatOfflineMessageId':_0xef9285['body']['message'][_0xd240('0x5d')]||null},{'include':[{'model':db[_0xd240('0x5e')],'as':_0xd240('0x5f')}]});})[_0xd240('0x11')](function(_0x574181){_0x37da71[_0xd240('0x1a')]=_0x574181;if(_0x37da71[_0xd240('0x54')][_0xd240('0x60')]){return db[_0xd240('0x61')][_0xd240('0x27')]({'attributes':['id',_0xd240('0x62')],'where':{'id':_0x37da71[_0xd240('0x54')][_0xd240('0x60')]}})[_0xd240('0x11')](function(_0x2bb35f){if(_0x2bb35f){_0x37da71['applications']['unshift']({'id':0x0,'priority':0x0,'app':_0xd240('0x63'),'appdata':_0x2bb35f[_0xd240('0x62')]+','+(_0x37da71[_0xd240('0x39')][_0xd240('0x64')]||0xa),'interval':_0xd240('0x43')});}return respondWithRpcPromise('Start',_0xd240('0x65'),_0x37da71);});}return respondWithRpcPromise(_0xd240('0x66'),_0xd240('0x65'),_0x37da71);})['then'](function(_0xb079e3){_0x3a567e(_0xb079e3);})['catch'](function(_0x5d7337){_0x880aa2(_0x34e50d[_0xd240('0x18')](0x1f4,_0x5d7337[_0xd240('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index 71cc88d..6e86a8c 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 _0xe426=['register','length','mailAccount:','./mailAccount.events','remove','update','removeListener'];(function(_0x2e8775,_0x310049){var _0x4cbf35=function(_0x103483){while(--_0x103483){_0x2e8775['push'](_0x2e8775['shift']());}};_0x4cbf35(++_0x310049);}(_0xe426,0xf8));var _0x6e42=function(_0x178ef0,_0x35af9e){_0x178ef0=_0x178ef0-0x0;var _0x422ef9=_0xe426[_0x178ef0];return _0x422ef9;};'use strict';var MailAccountEvents=require(_0x6e42('0x0'));var events=['save',_0x6e42('0x1'),_0x6e42('0x2')];function createListener(_0x1917b2,_0x29ce3c){return function(_0x239c39){_0x29ce3c['emit'](_0x1917b2,_0x239c39);};}function removeListener(_0x43c991,_0xf0aeca){return function(){MailAccountEvents[_0x6e42('0x3')](_0x43c991,_0xf0aeca);};}exports[_0x6e42('0x4')]=function(_0x534446){for(var _0x7807d8=0x0,_0xfaf712=events[_0x6e42('0x5')];_0x7807d8<_0xfaf712;_0x7807d8++){var _0x4d5d96=events[_0x7807d8];var _0x190e17=createListener(_0x6e42('0x6')+_0x4d5d96,_0x534446);MailAccountEvents['on'](_0x4d5d96,_0x190e17);}}; \ No newline at end of file +var _0x4efb=['update','emit','removeListener','length','mailAccount:','save','remove'];(function(_0x45fc8c,_0x48ceff){var _0x51a451=function(_0x364ccf){while(--_0x364ccf){_0x45fc8c['push'](_0x45fc8c['shift']());}};_0x51a451(++_0x48ceff);}(_0x4efb,0xfa));var _0xb4ef=function(_0x318b36,_0x1bc8d8){_0x318b36=_0x318b36-0x0;var _0x440770=_0x4efb[_0x318b36];return _0x440770;};'use strict';var MailAccountEvents=require('./mailAccount.events');var events=[_0xb4ef('0x0'),_0xb4ef('0x1'),_0xb4ef('0x2')];function createListener(_0x50873a,_0x26aa4){return function(_0x54f0b4){_0x26aa4[_0xb4ef('0x3')](_0x50873a,_0x54f0b4);};}function removeListener(_0x1cbfd0,_0x5d1d0f){return function(){MailAccountEvents[_0xb4ef('0x4')](_0x1cbfd0,_0x5d1d0f);};}exports['register']=function(_0x1f69fc){for(var _0xd99454=0x0,_0x446019=events[_0xb4ef('0x5')];_0xd99454<_0x446019;_0xd99454++){var _0x863531=events[_0xd99454];var _0x4cbb88=createListener(_0xb4ef('0x6')+_0x863531,_0x1f69fc);MailAccountEvents['on'](_0x863531,_0x4cbb88);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index 4c2a8c8..efd5c55 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 _0xa78a=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','show','put','isAuthenticated','update','delete','destroy','exports','multer','util'];(function(_0x1f810c,_0x51434f){var _0x2f760b=function(_0x2bd9bb){while(--_0x2bd9bb){_0x1f810c['push'](_0x1f810c['shift']());}};_0x2f760b(++_0x51434f);}(_0xa78a,0x7c));var _0xaa78=function(_0x43fa70,_0x112c4a){_0x43fa70=_0x43fa70-0x0;var _0x4c5193=_0xa78a[_0x43fa70];return _0x4c5193;};'use strict';var multer=require(_0xaa78('0x0'));var util=require(_0xaa78('0x1'));var path=require('path');var timeout=require(_0xaa78('0x2'));var express=require(_0xaa78('0x3'));var router=express[_0xaa78('0x4')]();var fs_extra=require(_0xaa78('0x5'));var auth=require(_0xaa78('0x6'));var interaction=require(_0xaa78('0x7'));var config=require(_0xaa78('0x8'));var controller=require('./mailApplication.controller');router[_0xaa78('0x9')](_0xaa78('0xa'),auth['isAuthenticated'](),controller[_0xaa78('0xb')]);router[_0xaa78('0xc')](_0xaa78('0xa'),auth[_0xaa78('0xd')](),controller[_0xaa78('0xe')]);router[_0xaa78('0xf')](_0xaa78('0xa'),auth[_0xaa78('0xd')](),controller[_0xaa78('0x10')]);module[_0xaa78('0x11')]=router; \ No newline at end of file +var _0xe369=['exports','express','Router','../../components/auth/service','../../components/interaction/service','./mailApplication.controller','get','/:id','show','put','isAuthenticated','update','destroy'];(function(_0x2df1f2,_0x58d388){var _0x38652b=function(_0x18e322){while(--_0x18e322){_0x2df1f2['push'](_0x2df1f2['shift']());}};_0x38652b(++_0x58d388);}(_0xe369,0x90));var _0x9e36=function(_0x200618,_0xed68b6){_0x200618=_0x200618-0x0;var _0xeac737=_0xe369[_0x200618];return _0xeac737;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x9e36('0x0'));var router=express[_0x9e36('0x1')]();var fs_extra=require('fs-extra');var auth=require(_0x9e36('0x2'));var interaction=require(_0x9e36('0x3'));var config=require('../../config/environment');var controller=require(_0x9e36('0x4'));router[_0x9e36('0x5')](_0x9e36('0x6'),auth['isAuthenticated'](),controller[_0x9e36('0x7')]);router[_0x9e36('0x8')](_0x9e36('0x6'),auth[_0x9e36('0x9')](),controller[_0x9e36('0xa')]);router['delete'](_0x9e36('0x6'),auth[_0x9e36('0x9')](),controller[_0x9e36('0xb')]);module[_0x9e36('0xc')]=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index 808b57c..2254994 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 _0x8fe4=['*,*,*,*','sequelize','exports','INTEGER','STRING','noop','TEXT'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0x8fe4,0x1c8));var _0x48fe=function(_0x167fad,_0x1c68be){_0x167fad=_0x167fad-0x0;var _0x109456=_0x8fe4[_0x167fad];return _0x109456;};'use strict';var Sequelize=require(_0x48fe('0x0'));module[_0x48fe('0x1')]={'priority':{'type':Sequelize[_0x48fe('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x48fe('0x3')],'allowNull':![],'defaultValue':_0x48fe('0x4')},'appdata':{'type':Sequelize[_0x48fe('0x5')]()},'description':{'type':Sequelize[_0x48fe('0x3')]},'interval':{'type':Sequelize[_0x48fe('0x3')],'defaultValue':_0x48fe('0x6')}}; \ No newline at end of file +var _0x263d=['INTEGER','noop','TEXT','STRING','*,*,*,*','sequelize','exports'];(function(_0x13bb5e,_0x19670d){var _0x21442c=function(_0x484c6b){while(--_0x484c6b){_0x13bb5e['push'](_0x13bb5e['shift']());}};_0x21442c(++_0x19670d);}(_0x263d,0x11d));var _0xd263=function(_0x4de9e8,_0x565ffa){_0x4de9e8=_0x4de9e8-0x0;var _0x4db0de=_0x263d[_0x4de9e8];return _0x4db0de;};'use strict';var Sequelize=require(_0xd263('0x0'));module[_0xd263('0x1')]={'priority':{'type':Sequelize[_0xd263('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xd263('0x3')},'appdata':{'type':Sequelize[_0xd263('0x4')]()},'description':{'type':Sequelize[_0xd263('0x5')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xd263('0x6')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index 4965428..800db08 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 _0xda3f=['includeAll','include','merge','find','catch','body','MailApplication','destroy','rimraf','zip-dir','bluebird','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','then','end','stack','name','send','params','model','keys','query','filters','intersection','attributes','fields','length'];(function(_0xb53150,_0x288756){var _0x5d7eb7=function(_0x27ff28){while(--_0x27ff28){_0xb53150['push'](_0xb53150['shift']());}};_0x5d7eb7(++_0x288756);}(_0xda3f,0xec));var _0xfda3=function(_0x41d8b5,_0x17d48){_0x41d8b5=_0x41d8b5-0x0;var _0x30f341=_0xda3f[_0x41d8b5];return _0x30f341;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfda3('0x0'));var zipdir=require(_0xfda3('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xfda3('0x2'));var Mustache=require('mustache');var util=require(_0xfda3('0x3'));var path=require(_0xfda3('0x4'));var sox=require('sox');var csv=require(_0xfda3('0x5'));var ejs=require(_0xfda3('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xfda3('0x7'));var crypto=require(_0xfda3('0x8'));var jsforce=require(_0xfda3('0x9'));var deskjs=require(_0xfda3('0xa'));var toCsv=require(_0xfda3('0x5'));var querystring=require(_0xfda3('0xb'));var Papa=require(_0xfda3('0xc'));var Redis=require(_0xfda3('0xd'));var authService=require(_0xfda3('0xe'));var qs=require(_0xfda3('0xf'));var as=require(_0xfda3('0x10'));var hardwareService=require(_0xfda3('0x11'));var logger=require('../../config/logger')(_0xfda3('0x12'));var utils=require(_0xfda3('0x13'));var config=require(_0xfda3('0x14'));var licenseUtil=require(_0xfda3('0x15'));var db=require(_0xfda3('0x16'))['db'];function respondWithStatusCode(_0x4b77ea,_0x583125){_0x583125=_0x583125||0xcc;return function(_0x5d7d5b){if(_0x5d7d5b){return _0x4b77ea[_0xfda3('0x17')](_0x583125);}return _0x4b77ea[_0xfda3('0x18')](_0x583125)['end']();};}function respondWithResult(_0x501588,_0x587e9b){_0x587e9b=_0x587e9b||0xc8;return function(_0x227d72){if(_0x227d72){return _0x501588[_0xfda3('0x18')](_0x587e9b)['json'](_0x227d72);}};}function respondWithFilteredResult(_0x57a229,_0x533365){return function(_0x80ea80){if(_0x80ea80){var _0x474707=typeof _0x533365[_0xfda3('0x19')]===_0xfda3('0x1a')&&typeof _0x533365[_0xfda3('0x1b')]===_0xfda3('0x1a');var _0x2aadcb=_0x80ea80[_0xfda3('0x1c')];var _0x4680bf=_0x474707?0x0:_0x533365[_0xfda3('0x19')];var _0x54a7c6=_0x474707?_0x80ea80[_0xfda3('0x1c')]:_0x533365[_0xfda3('0x19')]+_0x533365[_0xfda3('0x1b')];var _0x32855a;if(_0x54a7c6>=_0x2aadcb){_0x54a7c6=_0x2aadcb;_0x32855a=0xc8;}else{_0x32855a=0xce;}_0x57a229['status'](_0x32855a);return _0x57a229[_0xfda3('0x1d')](_0xfda3('0x1e'),_0x4680bf+'-'+_0x54a7c6+'/'+_0x2aadcb)[_0xfda3('0x1f')](_0x80ea80);}return null;};}function patchUpdates(_0x51e731){return function(_0x5ad52a){try{jsonpatch[_0xfda3('0x20')](_0x5ad52a,_0x51e731,!![]);}catch(_0x38d428){return BPromise[_0xfda3('0x21')](_0x38d428);}return _0x5ad52a['save']();};}function saveUpdates(_0x3cf5a9,_0xef2535){return function(_0x1e15a8){if(_0x1e15a8){return _0x1e15a8[_0xfda3('0x22')](_0x3cf5a9)[_0xfda3('0x23')](function(_0x2b84b7){return _0x2b84b7;});}return null;};}function removeEntity(_0x2677f6,_0xc6fb9a){return function(_0x16eaa6){if(_0x16eaa6){return _0x16eaa6['destroy']()[_0xfda3('0x23')](function(){_0x2677f6[_0xfda3('0x18')](0xcc)[_0xfda3('0x24')]();});}};}function handleEntityNotFound(_0x4ae9b9,_0x45a977){return function(_0x39e246){if(!_0x39e246){_0x4ae9b9[_0xfda3('0x17')](0x194);}return _0x39e246;};}function handleError(_0x38946d,_0x1cb831){_0x1cb831=_0x1cb831||0x1f4;return function(_0xad9f7b){logger['error'](_0xad9f7b[_0xfda3('0x25')]);if(_0xad9f7b[_0xfda3('0x26')]){delete _0xad9f7b[_0xfda3('0x26')];}_0x38946d[_0xfda3('0x18')](_0x1cb831)[_0xfda3('0x27')](_0xad9f7b);};}exports['show']=function(_0x3c1549,_0x4101b1){var _0x301509={'raw':!![],'where':{'id':_0x3c1549[_0xfda3('0x28')]['id']}},_0x474992={};_0x474992[_0xfda3('0x29')]=_[_0xfda3('0x2a')](db['MailApplication']['rawAttributes']);_0x474992[_0xfda3('0x2b')]=_['keys'](_0x3c1549['query']);_0x474992[_0xfda3('0x2c')]=_[_0xfda3('0x2d')](_0x474992[_0xfda3('0x29')],_0x474992[_0xfda3('0x2b')]);_0x301509[_0xfda3('0x2e')]=_[_0xfda3('0x2d')](_0x474992[_0xfda3('0x29')],qs[_0xfda3('0x2f')](_0x3c1549[_0xfda3('0x2b')]['fields']));_0x301509[_0xfda3('0x2e')]=_0x301509[_0xfda3('0x2e')][_0xfda3('0x30')]?_0x301509[_0xfda3('0x2e')]:_0x474992[_0xfda3('0x29')];if(_0x3c1549[_0xfda3('0x2b')][_0xfda3('0x31')]){_0x301509[_0xfda3('0x32')]=[{'all':!![]}];}_0x301509=_[_0xfda3('0x33')]({},_0x301509,_0x3c1549['options']);return db['MailApplication'][_0xfda3('0x34')](_0x301509)[_0xfda3('0x23')](handleEntityNotFound(_0x4101b1,null))['then'](respondWithResult(_0x4101b1,null))[_0xfda3('0x35')](handleError(_0x4101b1,null));};exports[_0xfda3('0x22')]=function(_0x28ca96,_0x52ee98){if(_0x28ca96[_0xfda3('0x36')]['id']){delete _0x28ca96[_0xfda3('0x36')]['id'];}return db[_0xfda3('0x37')][_0xfda3('0x34')]({'where':{'id':_0x28ca96[_0xfda3('0x28')]['id']}})['then'](handleEntityNotFound(_0x52ee98,null))[_0xfda3('0x23')](saveUpdates(_0x28ca96[_0xfda3('0x36')],null))[_0xfda3('0x23')](respondWithResult(_0x52ee98,null))['catch'](handleError(_0x52ee98,null));};exports[_0xfda3('0x38')]=function(_0x4854b1,_0x2d9a3f){return db[_0xfda3('0x37')][_0xfda3('0x34')]({'where':{'id':_0x4854b1[_0xfda3('0x28')]['id']}})[_0xfda3('0x23')](handleEntityNotFound(_0x2d9a3f,null))[_0xfda3('0x23')](removeEntity(_0x2d9a3f,null))[_0xfda3('0x35')](handleError(_0x2d9a3f,null));}; \ No newline at end of file +var _0xe706=['limit','count','offset','set','Content-Range','json','apply','save','update','then','end','name','send','show','params','model','keys','MailApplication','rawAttributes','query','filters','attributes','intersection','fields','length','includeAll','include','merge','options','find','body','catch','destroy','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','undefined'];(function(_0x5c43e1,_0x4c1705){var _0x397fa7=function(_0x4485e8){while(--_0x4485e8){_0x5c43e1['push'](_0x5c43e1['shift']());}};_0x397fa7(++_0x4c1705);}(_0xe706,0xa3));var _0x6e70=function(_0x342ca3,_0x31db47){_0x342ca3=_0x342ca3-0x0;var _0x580f2d=_0xe706[_0x342ca3];return _0x580f2d;};'use strict';var emlformat=require(_0x6e70('0x0'));var rimraf=require(_0x6e70('0x1'));var zipdir=require(_0x6e70('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6e70('0x3'));var moment=require(_0x6e70('0x4'));var BPromise=require(_0x6e70('0x5'));var Mustache=require(_0x6e70('0x6'));var util=require(_0x6e70('0x7'));var path=require(_0x6e70('0x8'));var sox=require(_0x6e70('0x9'));var csv=require(_0x6e70('0xa'));var ejs=require(_0x6e70('0xb'));var fs=require('fs');var fs_extra=require(_0x6e70('0xc'));var _=require(_0x6e70('0xd'));var squel=require(_0x6e70('0xe'));var crypto=require(_0x6e70('0xf'));var jsforce=require(_0x6e70('0x10'));var deskjs=require(_0x6e70('0x11'));var toCsv=require(_0x6e70('0xa'));var querystring=require(_0x6e70('0x12'));var Papa=require(_0x6e70('0x13'));var Redis=require(_0x6e70('0x14'));var authService=require(_0x6e70('0x15'));var qs=require(_0x6e70('0x16'));var as=require(_0x6e70('0x17'));var hardwareService=require(_0x6e70('0x18'));var logger=require(_0x6e70('0x19'))('api');var utils=require('../../config/utils');var config=require(_0x6e70('0x1a'));var licenseUtil=require(_0x6e70('0x1b'));var db=require(_0x6e70('0x1c'))['db'];function respondWithStatusCode(_0x27dd9b,_0x3b38f3){_0x3b38f3=_0x3b38f3||0xcc;return function(_0x310eb7){if(_0x310eb7){return _0x27dd9b[_0x6e70('0x1d')](_0x3b38f3);}return _0x27dd9b[_0x6e70('0x1e')](_0x3b38f3)['end']();};}function respondWithResult(_0x52737e,_0x48bc72){_0x48bc72=_0x48bc72||0xc8;return function(_0x257e81){if(_0x257e81){return _0x52737e['status'](_0x48bc72)['json'](_0x257e81);}};}function respondWithFilteredResult(_0x304716,_0x22c50c){return function(_0x5d9263){if(_0x5d9263){var _0x24f3ac=typeof _0x22c50c['offset']===_0x6e70('0x1f')&&typeof _0x22c50c[_0x6e70('0x20')]==='undefined';var _0x49029f=_0x5d9263[_0x6e70('0x21')];var _0x5ea7a5=_0x24f3ac?0x0:_0x22c50c[_0x6e70('0x22')];var _0x173afe=_0x24f3ac?_0x5d9263['count']:_0x22c50c['offset']+_0x22c50c[_0x6e70('0x20')];var _0x208e21;if(_0x173afe>=_0x49029f){_0x173afe=_0x49029f;_0x208e21=0xc8;}else{_0x208e21=0xce;}_0x304716[_0x6e70('0x1e')](_0x208e21);return _0x304716[_0x6e70('0x23')](_0x6e70('0x24'),_0x5ea7a5+'-'+_0x173afe+'/'+_0x49029f)[_0x6e70('0x25')](_0x5d9263);}return null;};}function patchUpdates(_0x1b2453){return function(_0x44a49f){try{jsonpatch[_0x6e70('0x26')](_0x44a49f,_0x1b2453,!![]);}catch(_0xb29a2a){return BPromise['reject'](_0xb29a2a);}return _0x44a49f[_0x6e70('0x27')]();};}function saveUpdates(_0x344b65,_0x27b294){return function(_0x502b2d){if(_0x502b2d){return _0x502b2d[_0x6e70('0x28')](_0x344b65)[_0x6e70('0x29')](function(_0x3337a6){return _0x3337a6;});}return null;};}function removeEntity(_0x50da2c,_0x10fc91){return function(_0x538b9c){if(_0x538b9c){return _0x538b9c['destroy']()['then'](function(){_0x50da2c[_0x6e70('0x1e')](0xcc)[_0x6e70('0x2a')]();});}};}function handleEntityNotFound(_0x51d292,_0x3ecdf1){return function(_0x1196ed){if(!_0x1196ed){_0x51d292['sendStatus'](0x194);}return _0x1196ed;};}function handleError(_0x338ad6,_0x67fb43){_0x67fb43=_0x67fb43||0x1f4;return function(_0x2bb231){logger['error'](_0x2bb231['stack']);if(_0x2bb231[_0x6e70('0x2b')]){delete _0x2bb231[_0x6e70('0x2b')];}_0x338ad6[_0x6e70('0x1e')](_0x67fb43)[_0x6e70('0x2c')](_0x2bb231);};}exports[_0x6e70('0x2d')]=function(_0x5d772a,_0x1952ea){var _0x406f29={'raw':!![],'where':{'id':_0x5d772a[_0x6e70('0x2e')]['id']}},_0xecf336={};_0xecf336[_0x6e70('0x2f')]=_[_0x6e70('0x30')](db[_0x6e70('0x31')][_0x6e70('0x32')]);_0xecf336[_0x6e70('0x33')]=_[_0x6e70('0x30')](_0x5d772a['query']);_0xecf336[_0x6e70('0x34')]=_['intersection'](_0xecf336[_0x6e70('0x2f')],_0xecf336['query']);_0x406f29[_0x6e70('0x35')]=_[_0x6e70('0x36')](_0xecf336[_0x6e70('0x2f')],qs['fields'](_0x5d772a[_0x6e70('0x33')][_0x6e70('0x37')]));_0x406f29['attributes']=_0x406f29[_0x6e70('0x35')][_0x6e70('0x38')]?_0x406f29['attributes']:_0xecf336[_0x6e70('0x2f')];if(_0x5d772a[_0x6e70('0x33')][_0x6e70('0x39')]){_0x406f29[_0x6e70('0x3a')]=[{'all':!![]}];}_0x406f29=_[_0x6e70('0x3b')]({},_0x406f29,_0x5d772a[_0x6e70('0x3c')]);return db[_0x6e70('0x31')][_0x6e70('0x3d')](_0x406f29)[_0x6e70('0x29')](handleEntityNotFound(_0x1952ea,null))[_0x6e70('0x29')](respondWithResult(_0x1952ea,null))['catch'](handleError(_0x1952ea,null));};exports[_0x6e70('0x28')]=function(_0x4795a0,_0x23cd1a){if(_0x4795a0[_0x6e70('0x3e')]['id']){delete _0x4795a0[_0x6e70('0x3e')]['id'];}return db[_0x6e70('0x31')][_0x6e70('0x3d')]({'where':{'id':_0x4795a0[_0x6e70('0x2e')]['id']}})[_0x6e70('0x29')](handleEntityNotFound(_0x23cd1a,null))[_0x6e70('0x29')](saveUpdates(_0x4795a0[_0x6e70('0x3e')],null))[_0x6e70('0x29')](respondWithResult(_0x23cd1a,null))[_0x6e70('0x3f')](handleError(_0x23cd1a,null));};exports[_0x6e70('0x40')]=function(_0x5594d3,_0x501b53){return db['MailApplication']['find']({'where':{'id':_0x5594d3[_0x6e70('0x2e')]['id']}})[_0x6e70('0x29')](handleEntityNotFound(_0x501b53,null))[_0x6e70('0x29')](removeEntity(_0x501b53,null))[_0x6e70('0x3f')](handleError(_0x501b53,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index 58df8c7..336c859 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 _0x65ae=['../../config/environment','./mailApplication.attributes','exports','define','mail_applications','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','path','rimraf'];(function(_0x506cc9,_0x16fdaa){var _0x53fbbf=function(_0x4a3e9f){while(--_0x4a3e9f){_0x506cc9['push'](_0x506cc9['shift']());}};_0x53fbbf(++_0x16fdaa);}(_0x65ae,0x1cd));var _0xe65a=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x65ae[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xe65a('0x0'));var util=require(_0xe65a('0x1'));var logger=require('../../config/logger')(_0xe65a('0x2'));var moment=require(_0xe65a('0x3'));var BPromise=require(_0xe65a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe65a('0x5'));var rimraf=require(_0xe65a('0x6'));var config=require(_0xe65a('0x7'));var attributes=require(_0xe65a('0x8'));module[_0xe65a('0x9')]=function(_0x4fc840,_0x6eee70){return _0x4fc840[_0xe65a('0xa')]('MailApplication',attributes,{'tableName':_0xe65a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xe65a('0xc')});}; \ No newline at end of file +var _0xd567=['../../config/environment','./mailApplication.attributes','exports','define','mail_applications','utf8mb4','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x28611e,_0x586726){var _0x530f69=function(_0x407906){while(--_0x407906){_0x28611e['push'](_0x28611e['shift']());}};_0x530f69(++_0x586726);}(_0xd567,0x124));var _0x7d56=function(_0x47ef8d,_0x7ec03a){_0x47ef8d=_0x47ef8d-0x0;var _0x1f4fca=_0xd567[_0x47ef8d];return _0x1f4fca;};'use strict';var _=require(_0x7d56('0x0'));var util=require('util');var logger=require(_0x7d56('0x1'))(_0x7d56('0x2'));var moment=require('moment');var BPromise=require(_0x7d56('0x3'));var rp=require(_0x7d56('0x4'));var fs=require('fs');var path=require(_0x7d56('0x5'));var rimraf=require(_0x7d56('0x6'));var config=require(_0x7d56('0x7'));var attributes=require(_0x7d56('0x8'));module[_0x7d56('0x9')]=function(_0x9e9a69,_0x15fa31){return _0x9e9a69[_0x7d56('0xa')]('MailApplication',attributes,{'tableName':_0x7d56('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7d56('0xc'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index ac189b5..91d5c2e 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 _0x64e1=['MailApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','MailApplication,\x20%s,\x20%s','message','result','catch','UpdateMailApplication','update','body','options','raw','where','attributes','limit','lodash','util','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','info','debug'];(function(_0x4ab2f5,_0x56e366){var _0x20dc29=function(_0x4d6f86){while(--_0x4d6f86){_0x4ab2f5['push'](_0x4ab2f5['shift']());}};_0x20dc29(++_0x56e366);}(_0x64e1,0x9d));var _0x164e=function(_0x427bd7,_0x44781f){_0x427bd7=_0x427bd7-0x0;var _0x1f3f10=_0x64e1[_0x427bd7];return _0x1f3f10;};'use strict';var _=require(_0x164e('0x0'));var util=require(_0x164e('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x164e('0x2'));var db=require(_0x164e('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x164e('0x4'))(_0x164e('0x5'));var config=require('../../config/environment');var jayson=require(_0x164e('0x6'));var client=jayson[_0x164e('0x7')][_0x164e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1a5175,_0x430444,_0x18c2c1){return new BPromise(function(_0x2b519c,_0x1d8d20){return client['request'](_0x1a5175,_0x18c2c1)['then'](function(_0x420880){logger[_0x164e('0x9')]('MailApplication,\x20%s,\x20%s',_0x430444,'request\x20sent');logger[_0x164e('0xa')](_0x164e('0xb'),_0x430444,_0x164e('0xc'),JSON[_0x164e('0xd')](_0x420880));if(_0x420880[_0x164e('0xe')]){if(_0x420880[_0x164e('0xe')][_0x164e('0xf')]===0x1f4){logger[_0x164e('0xe')](_0x164e('0x10'),_0x430444,_0x420880[_0x164e('0xe')]['message']);return _0x1d8d20(_0x420880[_0x164e('0xe')][_0x164e('0x11')]);}logger[_0x164e('0xe')](_0x164e('0x10'),_0x430444,_0x420880['error'][_0x164e('0x11')]);return _0x2b519c(_0x420880[_0x164e('0xe')][_0x164e('0x11')]);}else{logger[_0x164e('0x9')](_0x164e('0x10'),_0x430444,_0x164e('0xc'));_0x2b519c(_0x420880[_0x164e('0x12')][_0x164e('0x11')]);}})[_0x164e('0x13')](function(_0x3c5621){logger[_0x164e('0xe')](_0x164e('0x10'),_0x430444,_0x3c5621);_0x1d8d20(_0x3c5621);});});}exports[_0x164e('0x14')]=function(_0x3d6b8c){var _0x224803=this;return new Promise(function(_0x288bc,_0x4be3e9){return db['MailApplication'][_0x164e('0x15')](_0x3d6b8c[_0x164e('0x16')],{'raw':_0x3d6b8c[_0x164e('0x17')]?_0x3d6b8c['options'][_0x164e('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3d6b8c[_0x164e('0x17')]?_0x3d6b8c[_0x164e('0x17')][_0x164e('0x19')]||null:null,'attributes':_0x3d6b8c[_0x164e('0x17')]?_0x3d6b8c[_0x164e('0x17')][_0x164e('0x1a')]||null:null,'limit':_0x3d6b8c[_0x164e('0x17')]?_0x3d6b8c[_0x164e('0x17')][_0x164e('0x1b')]||null:null})['then'](function(_0x26567f){logger[_0x164e('0x9')](_0x164e('0x14'),_0x3d6b8c);logger[_0x164e('0xa')](_0x164e('0x14'),_0x3d6b8c,JSON[_0x164e('0xd')](_0x26567f));_0x288bc(_0x26567f);})[_0x164e('0x13')](function(_0x3c6e91){logger[_0x164e('0xe')](_0x164e('0x14'),_0x3c6e91[_0x164e('0x11')],_0x3d6b8c);_0x4be3e9(_0x224803[_0x164e('0xe')](0x1f4,_0x3c6e91[_0x164e('0x11')]));});});}; \ No newline at end of file +var _0x3b4e=['jayson/promise','client','http','request','then','MailApplication,\x20%s,\x20%s','debug','request\x20sent','error','code','message','info','result','catch','UpdateMailApplication','MailApplication','update','body','options','raw','attributes','limit','stringify','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3b4e,0x1aa));var _0xe3b4=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x3b4e[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require(_0xe3b4('0x0'));var moment=require('moment');var BPromise=require(_0xe3b4('0x1'));var rs=require(_0xe3b4('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe3b4('0x3'))['db'];var utils=require(_0xe3b4('0x4'));var logger=require(_0xe3b4('0x5'))(_0xe3b4('0x6'));var config=require(_0xe3b4('0x7'));var jayson=require(_0xe3b4('0x8'));var client=jayson[_0xe3b4('0x9')][_0xe3b4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3621d1,_0x1bceb1,_0x13fc9f){return new BPromise(function(_0xe2f2a9,_0x1810e6){return client[_0xe3b4('0xb')](_0x3621d1,_0x13fc9f)[_0xe3b4('0xc')](function(_0x2e5842){logger['info'](_0xe3b4('0xd'),_0x1bceb1,'request\x20sent');logger[_0xe3b4('0xe')]('MailApplication,\x20%s,\x20%s,\x20%s',_0x1bceb1,_0xe3b4('0xf'),JSON['stringify'](_0x2e5842));if(_0x2e5842['error']){if(_0x2e5842[_0xe3b4('0x10')][_0xe3b4('0x11')]===0x1f4){logger[_0xe3b4('0x10')](_0xe3b4('0xd'),_0x1bceb1,_0x2e5842[_0xe3b4('0x10')]['message']);return _0x1810e6(_0x2e5842['error'][_0xe3b4('0x12')]);}logger[_0xe3b4('0x10')](_0xe3b4('0xd'),_0x1bceb1,_0x2e5842[_0xe3b4('0x10')][_0xe3b4('0x12')]);return _0xe2f2a9(_0x2e5842[_0xe3b4('0x10')]['message']);}else{logger[_0xe3b4('0x13')](_0xe3b4('0xd'),_0x1bceb1,'request\x20sent');_0xe2f2a9(_0x2e5842[_0xe3b4('0x14')][_0xe3b4('0x12')]);}})[_0xe3b4('0x15')](function(_0x1596fd){logger[_0xe3b4('0x10')](_0xe3b4('0xd'),_0x1bceb1,_0x1596fd);_0x1810e6(_0x1596fd);});});}exports[_0xe3b4('0x16')]=function(_0x5be374){var _0x223ea9=this;return new Promise(function(_0x2ff1bb,_0x150c3b){return db[_0xe3b4('0x17')][_0xe3b4('0x18')](_0x5be374[_0xe3b4('0x19')],{'raw':_0x5be374[_0xe3b4('0x1a')]?_0x5be374[_0xe3b4('0x1a')][_0xe3b4('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5be374[_0xe3b4('0x1a')]?_0x5be374['options']['where']||null:null,'attributes':_0x5be374[_0xe3b4('0x1a')]?_0x5be374[_0xe3b4('0x1a')][_0xe3b4('0x1c')]||null:null,'limit':_0x5be374[_0xe3b4('0x1a')]?_0x5be374[_0xe3b4('0x1a')][_0xe3b4('0x1d')]||null:null})[_0xe3b4('0xc')](function(_0x54767b){logger['info']('UpdateMailApplication',_0x5be374);logger['debug']('UpdateMailApplication',_0x5be374,JSON[_0xe3b4('0x1e')](_0x54767b));_0x2ff1bb(_0x54767b);})[_0xe3b4('0x15')](function(_0x1e604c){logger[_0xe3b4('0x10')](_0xe3b4('0x16'),_0x1e604c[_0xe3b4('0x12')],_0x5be374);_0x150c3b(_0x223ea9['error'](0x1f4,_0x1e604c['message']));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index 311aa51..f8bc058 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 _0xefe0=['tracked','mail','mailinteraction:addtags','addTags','put','mailinteraction:update','update','delete','mailinteraction:destroy','destroy','removeTags','exports','util','path','../../components/interaction/service','../../config/environment','./mailInteraction.controller','get','index','describe','/:id','isAuthenticated','getMessages','/:id/download','create','post','addMessage','/:id/tags'];(function(_0x1a22ef,_0x1ef6df){var _0x4a8226=function(_0x47508a){while(--_0x47508a){_0x1a22ef['push'](_0x1a22ef['shift']());}};_0x4a8226(++_0x1ef6df);}(_0xefe0,0xd0));var _0x0efe=function(_0x53eba7,_0x38744c){_0x53eba7=_0x53eba7-0x0;var _0x32491b=_0xefe0[_0x53eba7];return _0x32491b;};'use strict';var multer=require('multer');var util=require(_0x0efe('0x0'));var path=require(_0x0efe('0x1'));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(_0x0efe('0x2'));var config=require(_0x0efe('0x3'));var controller=require(_0x0efe('0x4'));router[_0x0efe('0x5')]('/',auth['isAuthenticated'](),controller[_0x0efe('0x6')]);router[_0x0efe('0x5')]('/describe',auth['isAuthenticated'](),controller[_0x0efe('0x7')]);router[_0x0efe('0x5')](_0x0efe('0x8'),auth['isAuthenticated'](),controller['show']);router[_0x0efe('0x5')]('/:id/messages',auth[_0x0efe('0x9')](),controller[_0x0efe('0xa')]);router[_0x0efe('0x5')](_0x0efe('0xb'),auth[_0x0efe('0x9')](),controller['download']);router['post']('/',auth['isAuthenticated'](),controller[_0x0efe('0xc')]);router[_0x0efe('0xd')]('/:id/messages',auth[_0x0efe('0x9')](),controller[_0x0efe('0xe')]);router['post'](_0x0efe('0xf'),auth['isAuthenticated'](),interaction[_0x0efe('0x10')](_0x0efe('0x11'),_0x0efe('0x12')),controller[_0x0efe('0x13')]);router[_0x0efe('0x14')]('/:id',auth[_0x0efe('0x9')](),interaction['tracked'](_0x0efe('0x11'),_0x0efe('0x15')),controller[_0x0efe('0x16')]);router[_0x0efe('0x17')](_0x0efe('0x8'),auth['isAuthenticated'](),interaction[_0x0efe('0x10')](_0x0efe('0x11'),_0x0efe('0x18')),controller[_0x0efe('0x19')]);router[_0x0efe('0x17')](_0x0efe('0xf'),auth['isAuthenticated'](),controller[_0x0efe('0x1a')]);module[_0x0efe('0x1b')]=router; \ No newline at end of file +var _0xd873=['isAuthenticated','index','get','/describe','describe','/:id','show','/:id/messages','getMessages','create','addMessage','post','/:id/tags','mail','mailinteraction:addtags','addTags','put','tracked','mailinteraction:update','update','delete','mailinteraction:destroy','destroy','removeTags','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailInteraction.controller'];(function(_0x322bef,_0x4890d4){var _0x229e60=function(_0x45f89b){while(--_0x45f89b){_0x322bef['push'](_0x322bef['shift']());}};_0x229e60(++_0x4890d4);}(_0xd873,0x9c));var _0x3d87=function(_0xdbebc0,_0x16ba1e){_0xdbebc0=_0xdbebc0-0x0;var _0x3efae5=_0xd873[_0xdbebc0];return _0x3efae5;};'use strict';var multer=require(_0x3d87('0x0'));var util=require('util');var path=require(_0x3d87('0x1'));var timeout=require(_0x3d87('0x2'));var express=require('express');var router=express[_0x3d87('0x3')]();var fs_extra=require(_0x3d87('0x4'));var auth=require(_0x3d87('0x5'));var interaction=require(_0x3d87('0x6'));var config=require(_0x3d87('0x7'));var controller=require(_0x3d87('0x8'));router['get']('/',auth[_0x3d87('0x9')](),controller[_0x3d87('0xa')]);router[_0x3d87('0xb')](_0x3d87('0xc'),auth[_0x3d87('0x9')](),controller[_0x3d87('0xd')]);router[_0x3d87('0xb')](_0x3d87('0xe'),auth[_0x3d87('0x9')](),controller[_0x3d87('0xf')]);router[_0x3d87('0xb')](_0x3d87('0x10'),auth[_0x3d87('0x9')](),controller[_0x3d87('0x11')]);router[_0x3d87('0xb')]('/:id/download',auth[_0x3d87('0x9')](),controller['download']);router['post']('/',auth[_0x3d87('0x9')](),controller[_0x3d87('0x12')]);router['post'](_0x3d87('0x10'),auth[_0x3d87('0x9')](),controller[_0x3d87('0x13')]);router[_0x3d87('0x14')](_0x3d87('0x15'),auth['isAuthenticated'](),interaction['tracked'](_0x3d87('0x16'),_0x3d87('0x17')),controller[_0x3d87('0x18')]);router[_0x3d87('0x19')](_0x3d87('0xe'),auth[_0x3d87('0x9')](),interaction[_0x3d87('0x1a')](_0x3d87('0x16'),_0x3d87('0x1b')),controller[_0x3d87('0x1c')]);router[_0x3d87('0x1d')](_0x3d87('0xe'),auth[_0x3d87('0x9')](),interaction[_0x3d87('0x1a')](_0x3d87('0x16'),_0x3d87('0x1e')),controller[_0x3d87('0x1f')]);router[_0x3d87('0x1d')](_0x3d87('0x15'),auth[_0x3d87('0x9')](),controller[_0x3d87('0x20')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index 9c73058..93a9c62 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 _0x072c=['BOOLEAN','DATE','STRING','long','TEXT','ENUM','out','sequelize'];(function(_0x384962,_0x5a55df){var _0x3acd1b=function(_0x23bb63){while(--_0x23bb63){_0x384962['push'](_0x384962['shift']());}};_0x3acd1b(++_0x5a55df);}(_0x072c,0x10f));var _0xc072=function(_0x204b97,_0x33a383){_0x204b97=_0x204b97-0x0;var _0x43908c=_0x072c[_0x204b97];return _0x43908c;};'use strict';var Sequelize=require(_0xc072('0x0'));var iconv=require('iconv');module['exports']={'closed':{'type':Sequelize[_0xc072('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xc072('0x2')]},'disposition':{'type':Sequelize[_0xc072('0x3')]},'secondDisposition':{'type':Sequelize[_0xc072('0x3')]},'thirdDisposition':{'type':Sequelize[_0xc072('0x3')]},'note':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize['STRING'](0x1fe)},'to':{'type':Sequelize[_0xc072('0x3')]},'cc':{'type':Sequelize['TEXT'](_0xc072('0x4'))},'subject':{'type':Sequelize[_0xc072('0x5')]()},'attach':{'type':Sequelize[_0xc072('0x1')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0xc072('0x2')]},'substatus':{'type':Sequelize[_0xc072('0x3')](0x3c)},'substatusAt':{'type':Sequelize[_0xc072('0x2')]},'firstMsgDirection':{'type':Sequelize[_0xc072('0x6')]('in',_0xc072('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xc072('0x2')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xc072('0x1')],'defaultValue':![]}}; \ No newline at end of file +var _0x2e79=['long','ENUM','out','sequelize','BOOLEAN','DATE','STRING','TEXT'];(function(_0x23ea67,_0x4774c3){var _0x234ff6=function(_0x572e43){while(--_0x572e43){_0x23ea67['push'](_0x23ea67['shift']());}};_0x234ff6(++_0x4774c3);}(_0x2e79,0xeb));var _0x92e7=function(_0x5087e9,_0x5e9234){_0x5087e9=_0x5087e9-0x0;var _0x3bbf26=_0x2e79[_0x5087e9];return _0x3bbf26;};'use strict';var Sequelize=require(_0x92e7('0x0'));var iconv=require('iconv');module['exports']={'closed':{'type':Sequelize[_0x92e7('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x92e7('0x2')]},'disposition':{'type':Sequelize[_0x92e7('0x3')]},'secondDisposition':{'type':Sequelize[_0x92e7('0x3')]},'thirdDisposition':{'type':Sequelize[_0x92e7('0x3')]},'note':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0x92e7('0x3')](0x1fe)},'to':{'type':Sequelize[_0x92e7('0x3')]},'cc':{'type':Sequelize[_0x92e7('0x4')](_0x92e7('0x5'))},'subject':{'type':Sequelize[_0x92e7('0x4')]()},'attach':{'type':Sequelize[_0x92e7('0x1')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x92e7('0x2')]},'substatus':{'type':Sequelize[_0x92e7('0x3')](0x3c)},'substatusAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x92e7('0x6')]('in',_0x92e7('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x92e7('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x92e7('0x6')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x92e7('0x1')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index 83c0153..8b786f0 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 _0x74c4=['c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','type','text','start','Tag','union','$substring','UserId','buildExpression','some','compact','isEmpty','MailAccountId','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','tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','isNumeric','isEmail','c.email\x20LIKE\x20?','group','Sequelize','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.MailAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getMailAccounts','i.MailAccountId\x20IS\x20NULL','sequelize','toString','keyBy','merge','a.key','Account.key','a.mandatoryDisposition','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20(\x27%\x27\x20+\x20a.email\x20+\x20\x27%\x27)\x20THEN\x20SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201)\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.closed','i.attach','i.lastMsgAt','i.lastMsgDirection','i.subject','i.secondDisposition','i.thirdDisposition','i.ContactId','i.MailAccountId','i.UserId','Contact.firstName','c.lastName','Contact.lastName','Contact.email','c.phone','c.mobile','Contact.mobile','c.fax','o.internal','Owner.internal','groupBy','MailInteractionId','Setting','enableEmailPreview','all','rows','params','keys','includeAll','include','options','create','body','update','destroy','describe','addMessage','ids','getMessages','format','YYYY-MM-DD\x20HH:mm:ss','inlineCss','true','addTags','setTags','spread','findAll','mailInteractionTags:save','download','unix','join','root','files','tmp','attachments','transcript-%d-%s.zip','Attachment','Messages','bcc','subject','get','mkdirSync','each','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','Attachments','basename','existsSync','readFileSync','writeFileSync','message%d.eml','log','err','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','sox','ejs','lodash','squel','jsforce','to-csv','papaparse','html-to-text','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','register','sendStatus','status','end','undefined','count','offset','limit','set','apply','reject','save','then','error','stack','name','send','Users','fullname','TagIds','Tags','split','forEach','push','MailMessage','findOne','out','plainBody','-id','lastMsgText','trimStart','catch','index','map','MailInteraction','rawAttributes','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','select','field','color','tools_tags','u.id','ui.MailInteractionId','from','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','mail_accounts','mail_messages','me.MailInteractionId\x20=\x20i.id','mail_interaction_has_tags','t.id\x20=\x20it.TagId','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','having','`\x20>\x200','Contact','operator','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue'];(function(_0x2bd0be,_0xf63d47){var _0x3e8e85=function(_0xdc0fbc){while(--_0xdc0fbc){_0x2bd0be['push'](_0x2bd0be['shift']());}};_0x3e8e85(++_0xf63d47);}(_0x74c4,0x85));var _0x474c=function(_0x5cb1ba,_0x3e6718){_0x5cb1ba=_0x5cb1ba-0x0;var _0x4b71fe=_0x74c4[_0x5cb1ba];return _0x4b71fe;};'use strict';var emlformat=require(_0x474c('0x0'));var rimraf=require(_0x474c('0x1'));var zipdir=require(_0x474c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x474c('0x3'));var moment=require('moment');var BPromise=require(_0x474c('0x4'));var Mustache=require(_0x474c('0x5'));var util=require('util');var path=require('path');var sox=require(_0x474c('0x6'));var csv=require('to-csv');var ejs=require(_0x474c('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x474c('0x8'));var squel=require(_0x474c('0x9'));var crypto=require('crypto');var jsforce=require(_0x474c('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x474c('0xb'));var querystring=require('querystring');var Papa=require(_0x474c('0xc'));var htmlToText=require(_0x474c('0xd'));var juice=require('juice');var Redis=require(_0x474c('0xe'));var authService=require(_0x474c('0xf'));var qs=require(_0x474c('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x474c('0x11'));var logger=require(_0x474c('0x12'))(_0x474c('0x13'));var utils=require(_0x474c('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x474c('0x15'));var db=require('../../mysqldb')['db'];config[_0x474c('0x16')]=_[_0x474c('0x17')](config[_0x474c('0x16')],{'host':_0x474c('0x18'),'port':0x18eb});var socket=require(_0x474c('0x19'))(new Redis(config['redis']));require(_0x474c('0x1a'))[_0x474c('0x1b')](socket);function respondWithStatusCode(_0x7380,_0x5d0f2e){_0x5d0f2e=_0x5d0f2e||0xcc;return function(_0x5b2b5d){if(_0x5b2b5d){return _0x7380[_0x474c('0x1c')](_0x5d0f2e);}return _0x7380[_0x474c('0x1d')](_0x5d0f2e)[_0x474c('0x1e')]();};}function respondWithResult(_0x35eae5,_0x3a0214){_0x3a0214=_0x3a0214||0xc8;return function(_0x4bdbbc){if(_0x4bdbbc){return _0x35eae5[_0x474c('0x1d')](_0x3a0214)['json'](_0x4bdbbc);}};}function respondWithFilteredResult(_0x55117b,_0x27d791){return function(_0x4c570a){if(_0x4c570a){var _0x1f8960=typeof _0x27d791['offset']===_0x474c('0x1f')&&typeof _0x27d791['limit']==='undefined';var _0x4ed811=_0x4c570a[_0x474c('0x20')];var _0x7dfe10=_0x1f8960?0x0:_0x27d791[_0x474c('0x21')];var _0x52df1d=_0x1f8960?_0x4c570a['count']:_0x27d791['offset']+_0x27d791[_0x474c('0x22')];var _0x53e5aa;if(_0x52df1d>=_0x4ed811){_0x52df1d=_0x4ed811;_0x53e5aa=0xc8;}else{_0x53e5aa=0xce;}_0x55117b[_0x474c('0x1d')](_0x53e5aa);return _0x55117b[_0x474c('0x23')]('Content-Range',_0x7dfe10+'-'+_0x52df1d+'/'+_0x4ed811)['json'](_0x4c570a);}return null;};}function patchUpdates(_0x4439b1){return function(_0x336839){try{jsonpatch[_0x474c('0x24')](_0x336839,_0x4439b1,!![]);}catch(_0x22c4aa){return BPromise[_0x474c('0x25')](_0x22c4aa);}return _0x336839[_0x474c('0x26')]();};}function saveUpdates(_0x3c4919,_0x50bc4a){return function(_0x494df7){if(_0x494df7){return _0x494df7['update'](_0x3c4919)['then'](function(_0x25c116){return _0x25c116;});}return null;};}function removeEntity(_0x581478,_0x5689be){return function(_0x27ed91){if(_0x27ed91){return _0x27ed91['destroy']()[_0x474c('0x27')](function(){_0x581478[_0x474c('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2bc04d,_0xa51e5e){return function(_0x16f16e){if(!_0x16f16e){_0x2bc04d[_0x474c('0x1c')](0x194);}return _0x16f16e;};}function handleError(_0x48dcce,_0xde699d){_0xde699d=_0xde699d||0x1f4;return function(_0x53d0b1){logger[_0x474c('0x28')](_0x53d0b1[_0x474c('0x29')]);if(_0x53d0b1[_0x474c('0x2a')]){delete _0x53d0b1[_0x474c('0x2a')];}_0x48dcce[_0x474c('0x1d')](_0xde699d)[_0x474c('0x2b')](_0x53d0b1);};}function getInteractionUsers(_0x515243,_0xcbb5d0){return new BPromise(function(_0x32cacf,_0x5d1122){try{if(_0xcbb5d0[_0x515243['id']]){_0x515243[_0x474c('0x2c')]=_['map'](_0xcbb5d0[_0x515243['id']],function(_0x3a8211){return{'id':_0x3a8211['id'],'fullname':_0x3a8211[_0x474c('0x2d')]};});}}catch(_0x496b71){_0x5d1122(_0x496b71);}_0x32cacf(_0x515243);});}function getInteractionTags(_0x2ed877,_0x591e09){return new BPromise(function(_0x22601f,_0x29cb68){try{if(_0x2ed877[_0x474c('0x2e')]){_0x2ed877[_0x474c('0x2f')]=[];_0x2ed877['TagIds'][_0x474c('0x30')](',')[_0x474c('0x31')](function(_0x5712fc){_0x2ed877[_0x474c('0x2f')][_0x474c('0x32')](_0x591e09[_0x5712fc]);});}delete _0x2ed877[_0x474c('0x2e')];}catch(_0x25ec30){_0x29cb68(_0x25ec30);}_0x22601f(_0x2ed877);});}function getLastMessageText(_0x252d23){return new BPromise(function(_0x27a346,_0x2c7f65){return db[_0x474c('0x33')][_0x474c('0x34')]({'where':{'$and':[{'MailInteractionId':_0x252d23['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x474c('0x35')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x474c('0x36')],'order':_0x474c('0x37'),'raw':!![]})['then'](function(_0x92d3bf){if(_0x92d3bf&&_0x92d3bf['plainBody']){_0x252d23[_0x474c('0x38')]=_[_0x474c('0x39')](_0x92d3bf[_0x474c('0x36')]);}_0x27a346(_0x252d23);})[_0x474c('0x3a')](function(_0x284041){_0x2c7f65(_0x284041);});});}function updateMailInteraction(_0x4c6bf1,_0x1a51c2,_0x1529a6,_0x55d34c){return new BPromise(function(_0xa1fce4,_0x463400){return getInteractionUsers(_0x4c6bf1,_0x1529a6)[_0x474c('0x27')](function(_0x533394){return getInteractionTags(_0x533394,_0x1a51c2);})[_0x474c('0x27')](function(_0x232ac8){if(_0x55d34c){_0xa1fce4(getLastMessageText(_0x232ac8));}else{_0xa1fce4(_0x232ac8);}})['catch'](function(_0x4cadf9){_0x463400(_0x4cadf9);});});}exports[_0x474c('0x3b')]=function(_0x5cf93a,_0x1801f4){var _0xa615d5={},_0x340a1e={},_0x43896d={'count':0x0,'rows':[]};var _0x2876e8=_[_0x474c('0x3c')](db[_0x474c('0x3d')][_0x474c('0x3e')],function(_0x47ebbc){return{'name':_0x47ebbc['fieldName'],'type':_0x47ebbc['type'][_0x474c('0x3f')]};});_0x340a1e[_0x474c('0x40')]=_['map'](_0x2876e8,'name');_0x340a1e[_0x474c('0x41')]=_['keys'](_0x5cf93a['query']);_0x340a1e[_0x474c('0x42')]=_[_0x474c('0x43')](_0x340a1e[_0x474c('0x40')],_0x340a1e[_0x474c('0x41')]);_0xa615d5[_0x474c('0x44')]=_[_0x474c('0x43')](_0x340a1e[_0x474c('0x40')],qs['fields'](_0x5cf93a[_0x474c('0x41')][_0x474c('0x45')]));_0xa615d5[_0x474c('0x44')]=_0xa615d5[_0x474c('0x44')][_0x474c('0x46')]?_0xa615d5[_0x474c('0x44')]:_0x340a1e[_0x474c('0x40')];if(!_0x5cf93a['query'][_0x474c('0x47')](_0x474c('0x48'))){_0xa615d5[_0x474c('0x22')]=qs[_0x474c('0x22')](_0x5cf93a[_0x474c('0x41')][_0x474c('0x22')]);_0xa615d5[_0x474c('0x21')]=qs[_0x474c('0x21')](_0x5cf93a[_0x474c('0x41')][_0x474c('0x21')]);}_0xa615d5[_0x474c('0x49')]=qs['sort'](_0x5cf93a['query'][_0x474c('0x4a')]);_0xa615d5['where']=qs[_0x474c('0x42')](_[_0x474c('0x4b')](_0x5cf93a[_0x474c('0x41')],_0x340a1e[_0x474c('0x42')]),_0x2876e8);var _0x33af5a=[];var _0x215e37=squel[_0x474c('0x4c')]()[_0x474c('0x4d')]('id')['field']('name')[_0x474c('0x4d')](_0x474c('0x4e'))['from'](_0x474c('0x4f'));var _0x6fedf7=squel['select']()[_0x474c('0x4d')](_0x474c('0x50'))[_0x474c('0x4d')]('u.fullname')[_0x474c('0x4d')](_0x474c('0x51'))[_0x474c('0x52')](_0x474c('0x53'),'ui')[_0x474c('0x54')](_0x474c('0x55'),'u',_0x474c('0x56'));var _0x53688b=squel['select']()[_0x474c('0x52')](_0x474c('0x57'),'i')[_0x474c('0x54')](_0x474c('0x58'),'c',_0x474c('0x59'))[_0x474c('0x54')](_0x474c('0x55'),'o','o.id\x20=\x20i.UserId')[_0x474c('0x54')](_0x474c('0x5a'),'a','a.id\x20=\x20i.MailAccountId')[_0x474c('0x54')](_0x474c('0x5b'),'me',_0x474c('0x5c'))[_0x474c('0x54')](_0x474c('0x5d'),'it','it.MailInteractionId\x20=\x20i.id')['left_join'](_0x474c('0x4f'),'t',_0x474c('0x5e'));var _0x20cae2=squel['expr']();var _0x224087=[];var _0x533879=squel['expr']();var _0x5ad925;if(_0x5cf93a['query'][_0x474c('0x5f')]){_0x5ad925=as[_0x474c('0x60')](_0x5cf93a[_0x474c('0x41')][_0x474c('0x5f')]);var _0x3b4491=_0x5ad925[_0x474c('0x61')];for(var _0x1af7dd=0x0;_0x1af7dd<_0x5ad925[_0x474c('0x62')][_0x474c('0x46')];_0x1af7dd++){var _0xa913e4=_0x5ad925[_0x474c('0x62')][_0x1af7dd];var _0x1716b3='i';var _0x266f74=_[_0x474c('0x63')](_0x2876e8,[_0x474c('0x2a'),_0xa913e4[_0x474c('0x4d')]]);if(!_0x266f74){switch(_0xa913e4['field']){case _0x474c('0x64'):if(_0xa913e4[_0x474c('0x65')]==0x1){_0x53688b[_0x474c('0x66')]('`'+_0xa913e4[_0x474c('0x4d')]+'`\x20=\x200');}else{_0x53688b[_0x474c('0x66')]('`'+_0xa913e4[_0x474c('0x4d')]+_0x474c('0x67'));}break;case _0x474c('0x68'):if(_0xa913e4[_0x474c('0x69')]==='$substring'){if(_0xa913e4['value'][_0x474c('0x30')]('\x20')[_0x474c('0x46')]>0x1){_0x20cae2[_0x3b4491](_0x474c('0x6a'),qs[_0x474c('0x6b')](_0xa913e4[_0x474c('0x65')]),null);}else{var _0x1b2893='%'+_0xa913e4[_0x474c('0x65')]+'%';_0x20cae2[_0x3b4491](_0x474c('0x6c'),_0x1b2893,_0x1b2893,_0x1b2893);}}else{_0x266f74=_[_0x474c('0x63')](_0x2876e8,['name',_0x474c('0x6d')]);_0xa913e4[_0x474c('0x4d')]=_0x474c('0x6d');_0x2a24ea=as['buildExpression'](_0x1716b3,_0x266f74[_0x474c('0x6e')],_0xa913e4);_0x20cae2[_0x3b4491](_0x2a24ea[_0x474c('0x6f')],_0x2a24ea['value'][_0x474c('0x70')],_0x2a24ea[_0x474c('0x65')][_0x474c('0x1e')]);}break;case _0x474c('0x71'):var _0x1b9926=_0xa913e4[_0x474c('0x65')][_0x474c('0x30')](',')[_0x474c('0x3c')](function(_0x249b85){return Number(_0x249b85);});_0x1b9926[_0x474c('0x31')](function(_0xc3643d){_0x533879['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0xc3643d+',%');});_0x224087=_[_0x474c('0x72')](_0x224087,_0x1b9926);break;case'User':if(_0xa913e4[_0x474c('0x69')]===_0x474c('0x73')){_0x20cae2[_0x3b4491]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0xa913e4['value']+'%',null);}else{_0x266f74=_['find'](_0x2876e8,[_0x474c('0x2a'),_0x474c('0x74')]);_0xa913e4[_0x474c('0x4d')]=_0x474c('0x74');_0x2a24ea=as[_0x474c('0x75')](_0x1716b3,_0x266f74[_0x474c('0x6e')],_0xa913e4);_0x20cae2[_0x3b4491](_0x2a24ea[_0x474c('0x6f')],_0x2a24ea[_0x474c('0x65')]['start'],_0x2a24ea[_0x474c('0x65')][_0x474c('0x1e')]);}break;case _0x474c('0x36'):_0x2a24ea=as[_0x474c('0x75')]('me',null,_0xa913e4);_0x20cae2[_0x3b4491](_0x2a24ea[_0x474c('0x6f')],_0x2a24ea[_0x474c('0x65')][_0x474c('0x70')],_0x2a24ea['value'][_0x474c('0x1e')]);break;}}else{var _0x2a24ea=as[_0x474c('0x75')](_0x1716b3,_0x266f74['type'],_0xa913e4);_0x20cae2[_0x3b4491](_0x2a24ea[_0x474c('0x6f')],_0x2a24ea['value'][_0x474c('0x70')],_0x2a24ea[_0x474c('0x65')][_0x474c('0x1e')]);}}}else{var _0x3c3b2a=_(_0x5cf93a['query'])['keys']()[_0x474c('0x3c')](function(_0x429c93){return _[_0x474c('0x76')](_0x2876e8,[_0x474c('0x2a'),_0x429c93])?_0x429c93:undefined;})[_0x474c('0x77')]()['value']();if(!_[_0x474c('0x78')](_0x3c3b2a)){_0x3c3b2a[_0x474c('0x31')](function(_0x4ea140){if(_0x4ea140===_0x474c('0x79')){_0x53688b[_0x474c('0x7a')](_0x474c('0x7b'),[][_0x474c('0x7c')](_0x5cf93a['query'][_0x4ea140]));}else if(_0x4ea140===_0x474c('0x7d')){var _0x3ea3ab=JSON[_0x474c('0x7e')](_0x5cf93a['query'][_0x4ea140])[_0x474c('0x7f')];var _0xa23759=JSON['parse'](_0x5cf93a[_0x474c('0x41')][_0x4ea140])['$lte'];_0x53688b['where'](_0x474c('0x80'),_0x3ea3ab,_0xa23759);}else{if(_0x5cf93a[_0x474c('0x41')][_0x4ea140]===_0x474c('0x81')){_0x53688b[_0x474c('0x7a')]('i.'+_0x4ea140+_0x474c('0x82'));}else{_0x53688b[_0x474c('0x7a')]('i.'+_0x4ea140+_0x474c('0x83'),_0x5cf93a[_0x474c('0x41')][_0x4ea140]);}}});}if(_0x5cf93a[_0x474c('0x41')][_0x474c('0x84')]){if(_0x5cf93a[_0x474c('0x41')][_0x474c('0x84')]==0x1){_0x53688b['having'](_0x474c('0x85'));}else{_0x53688b['having'](_0x474c('0x86'));}}if(_0x5cf93a[_0x474c('0x41')][_0x474c('0x87')]){_0x224087=_['isArray'](_0x5cf93a['query']['tag'])?_0x5cf93a['query'][_0x474c('0x87')]:new Array(_0x5cf93a[_0x474c('0x41')][_0x474c('0x87')]);_0x224087[_0x474c('0x31')](function(_0x45241b){_0x533879['or'](_0x474c('0x88'),'%,'+_0x45241b+',%');});}if(_0x5cf93a[_0x474c('0x41')]['filter']){var _0x36f6e1=_0x5cf93a[_0x474c('0x41')][_0x474c('0x89')]['replace']('\x5c','\x5c\x5c')[_0x474c('0x8a')](/'/g,'\x27\x27');if(qs[_0x474c('0x8b')](_0x36f6e1)){_0x20cae2['or']('i.id\x20LIKE\x20?',_0x36f6e1+'%');}else if(qs[_0x474c('0x8c')](_0x36f6e1)){_0x20cae2['or'](_0x474c('0x8d'),_0x36f6e1+'%');}else{_0x20cae2['or']('MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x474c('0x6b')](_0x36f6e1))['or']('MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x474c('0x6b')](_0x36f6e1));}}}_0x53688b[_0x474c('0x7a')](_0x20cae2);_0x53688b[_0x474c('0x8e')]('i.id');var _0x51aab3={'type':db[_0x474c('0x8f')][_0x474c('0x90')][_0x474c('0x91')],'raw':!![]};var _0x3b2232=_0x53688b[_0x474c('0x92')]();_0x3b2232[_0x474c('0x4d')](_0x474c('0x93'));_0x3b2232[_0x474c('0x4d')](_0x474c('0x94'),'unreadMessages');if(_0xa615d5['order']){_0xa615d5[_0x474c('0x49')]['forEach'](function(_0x4a8996){var _0x203e10=_0x4a8996[0x0]===_0x474c('0x95')?_0x4a8996[0x0]:'i.'+_0x4a8996[0x0];_0x53688b[_0x474c('0x49')](_0x203e10,_0x4a8996[0x1]===_0x474c('0x96')?![]:!![]);});}if(!_[_0x474c('0x78')](_0x224087)){_0x53688b[_0x474c('0x66')](_0x533879);_0x3b2232['where'](_0x474c('0x97'),_0x224087);}BPromise[_0x474c('0x98')]()[_0x474c('0x27')](function(){if(!_0x5ad925){if(_0x5cf93a[_0x474c('0x41')]['MailAccountId'])return;_0x3b2232[_0x474c('0x7a')](_0x474c('0x99'));_0x53688b[_0x474c('0x7a')]('i.MailAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x5cf93a[_0x474c('0x9a')][_0x474c('0x9b')]!==_0x474c('0x9c'))return;return _0x5cf93a['user'][_0x474c('0x9d')]({'attributes':['id'],'raw':!![]})['then'](function(_0x5830db){if(_[_0x474c('0x78')](_0x5830db)){_0x3b2232[_0x474c('0x7a')](_0x474c('0x9e'));_0x53688b['where']('i.MailAccountId\x20IS\x20NULL');}else{_0x3b2232[_0x474c('0x7a')](_0x474c('0x7b'),_[_0x474c('0x3c')](_0x5830db,'id'));_0x53688b[_0x474c('0x7a')]('i.MailAccountId\x20IN\x20?',_[_0x474c('0x3c')](_0x5830db,'id'));}});})['then'](function(){if(_0x5cf93a[_0x474c('0x9a')][_0x474c('0x9b')]===_0x474c('0x9c')&&!_0x5ad925&&!_0x5cf93a[_0x474c('0x41')][_0x474c('0x79')])return[];return db[_0x474c('0x9f')][_0x474c('0x41')](_0x3b2232[_0x474c('0xa0')](),_0x51aab3);})['then'](function(_0x2f6b26){_0x43896d['count']=_0x2f6b26['length'];if(_0x43896d['count']===0x0)return[];return db[_0x474c('0x9f')][_0x474c('0x41')](_0x215e37[_0x474c('0xa0')](),_0x51aab3)[_0x474c('0x27')](function(_0x15b69b){_0x33af5a=_[_0x474c('0xa1')](_0x15b69b,'id');_0x51aab3=_[_0x474c('0xa2')](_0x51aab3,{'model':db[_0x474c('0x3d')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x5cf93a['query'][_0x474c('0x45')]){_0xa615d5[_0x474c('0x44')][_0x474c('0x31')](function(_0x5955c7){_0x53688b[_0x474c('0x4d')]('i.'+_0x5955c7);});}else{_0x53688b['field'](_0x474c('0x94'),_0x474c('0x64'));_0x53688b['field'](_0x474c('0xa3'),_0x474c('0xa4'));_0x53688b['field'](_0x474c('0xa5'),'Account.mandatoryDisposition');_0x53688b[_0x474c('0x4d')](_0x474c('0xa6'),'contactName');_0x53688b[_0x474c('0x4d')](_0x474c('0x93'));_0x53688b[_0x474c('0x4d')]('i.createdAt');_0x53688b[_0x474c('0x4d')]('i.updatedAt');_0x53688b['field'](_0x474c('0xa7'));_0x53688b['field']('i.closedAt');_0x53688b[_0x474c('0x4d')](_0x474c('0xa8'));_0x53688b['field'](_0x474c('0xa9'));_0x53688b['field'](_0x474c('0xaa'));_0x53688b[_0x474c('0x4d')](_0x474c('0xab'));_0x53688b[_0x474c('0x4d')]('i.disposition');_0x53688b[_0x474c('0x4d')](_0x474c('0xac'));_0x53688b[_0x474c('0x4d')](_0x474c('0xad'));_0x53688b[_0x474c('0x4d')]('i.substatus');_0x53688b[_0x474c('0x4d')]('i.to');_0x53688b[_0x474c('0x4d')](_0x474c('0xae'));_0x53688b[_0x474c('0x4d')](_0x474c('0xaf'));_0x53688b[_0x474c('0x4d')](_0x474c('0xb0'));_0x53688b[_0x474c('0x4d')]('c.firstName',_0x474c('0xb1'));_0x53688b[_0x474c('0x4d')](_0x474c('0xb2'),_0x474c('0xb3'));_0x53688b[_0x474c('0x4d')]('c.email',_0x474c('0xb4'));_0x53688b[_0x474c('0x4d')](_0x474c('0xb5'),'Contact.phone');_0x53688b[_0x474c('0x4d')](_0x474c('0xb6'),_0x474c('0xb7'));_0x53688b[_0x474c('0x4d')](_0x474c('0xb8'),'Contact.fax');_0x53688b[_0x474c('0x4d')]('o.fullname','Owner.fullname');_0x53688b[_0x474c('0x4d')](_0x474c('0xb9'),_0x474c('0xba'));_0x53688b['field']('GROUP_CONCAT(DISTINCT\x20t.id)',_0x474c('0x2e'));}if(_0xa615d5[_0x474c('0x22')])_0x53688b[_0x474c('0x22')](_0xa615d5[_0x474c('0x22')]);if(_0xa615d5[_0x474c('0x21')])_0x53688b['offset'](_0xa615d5['offset']);return db[_0x474c('0x9f')][_0x474c('0x41')](_0x53688b['toString'](),_0x51aab3);})['then'](function(_0x502238){if(_0x502238[_0x474c('0x46')]>0x0)_0x6fedf7[_0x474c('0x7a')]('ui.MailInteractionId\x20IN\x20?',_[_0x474c('0x3c')](_0x502238,'id'));return db[_0x474c('0x9f')][_0x474c('0x41')](_0x6fedf7[_0x474c('0xa0')](),_0x51aab3)[_0x474c('0x27')](function(_0x1a9551){var _0x35bf11=_[_0x474c('0xbb')](_0x1a9551,_0x474c('0xbc'));var _0x218246=[];return db[_0x474c('0xbd')][_0x474c('0x34')]({'attributes':['enableEmailPreview'],'raw':!![]})[_0x474c('0x27')](function(_0x42bc65){var _0x3bbe9c=_0x42bc65[_0x474c('0xbe')];_0x502238['forEach'](function(_0x116e04){_0x218246['push'](updateMailInteraction(_0x116e04,_0x33af5a,_0x35bf11,_0x3bbe9c));});return BPromise[_0x474c('0xbf')](_0x218246);});});});})['then'](function(_0x113ed2){_0x43896d[_0x474c('0xc0')]=_0x113ed2;return _0x43896d;})[_0x474c('0x27')](respondWithFilteredResult(_0x1801f4,_0xa615d5))[_0x474c('0x3a')](handleError(_0x1801f4,null));};exports['show']=function(_0x31e7e4,_0x40cd55){var _0x7cf95b={'raw':![],'where':{'id':_0x31e7e4[_0x474c('0xc1')]['id']}},_0x299b3a={};_0x299b3a['model']=_[_0x474c('0xc2')](db[_0x474c('0x3d')][_0x474c('0x3e')]);_0x299b3a[_0x474c('0x41')]=_[_0x474c('0xc2')](_0x31e7e4[_0x474c('0x41')]);_0x299b3a['filters']=_[_0x474c('0x43')](_0x299b3a[_0x474c('0x40')],_0x299b3a[_0x474c('0x41')]);_0x7cf95b[_0x474c('0x44')]=_[_0x474c('0x43')](_0x299b3a[_0x474c('0x40')],qs[_0x474c('0x45')](_0x31e7e4[_0x474c('0x41')][_0x474c('0x45')]));_0x7cf95b[_0x474c('0x44')]=_0x7cf95b[_0x474c('0x44')][_0x474c('0x46')]?_0x7cf95b[_0x474c('0x44')]:_0x299b3a[_0x474c('0x40')];if(_0x31e7e4['query'][_0x474c('0xc3')]){_0x7cf95b[_0x474c('0xc4')]=[{'all':!![]}];}_0x7cf95b=_[_0x474c('0xa2')]({},_0x7cf95b,_0x31e7e4[_0x474c('0xc5')]);return db[_0x474c('0x3d')][_0x474c('0x63')](_0x7cf95b)[_0x474c('0x27')](handleEntityNotFound(_0x40cd55,null))['then'](respondWithResult(_0x40cd55,null))[_0x474c('0x3a')](handleError(_0x40cd55,null));};exports[_0x474c('0xc6')]=function(_0x19de5b,_0x216a65){return db[_0x474c('0x3d')]['create'](_0x19de5b[_0x474c('0xc7')],{})[_0x474c('0x27')](respondWithResult(_0x216a65,0xc9))[_0x474c('0x3a')](handleError(_0x216a65,null));};exports[_0x474c('0xc8')]=function(_0x97874c,_0x585bfe){if(_0x97874c[_0x474c('0xc7')]['id']){delete _0x97874c[_0x474c('0xc7')]['id'];}return db['MailInteraction'][_0x474c('0x63')]({'where':{'id':_0x97874c[_0x474c('0xc1')]['id']}})[_0x474c('0x27')](handleEntityNotFound(_0x585bfe,null))[_0x474c('0x27')](saveUpdates(_0x97874c[_0x474c('0xc7')],null))[_0x474c('0x27')](respondWithResult(_0x585bfe,null))['catch'](handleError(_0x585bfe,null));};exports[_0x474c('0xc9')]=function(_0x296dcf,_0x46b8dd){return db['MailInteraction']['find']({'where':{'id':_0x296dcf['params']['id']}})[_0x474c('0x27')](handleEntityNotFound(_0x46b8dd,null))[_0x474c('0x27')](removeEntity(_0x46b8dd,null))[_0x474c('0x3a')](handleError(_0x46b8dd,null));};exports['describe']=function(_0x3cd191,_0x2994c7){return db[_0x474c('0x3d')][_0x474c('0xca')]()[_0x474c('0x27')](respondWithResult(_0x2994c7,null))[_0x474c('0x3a')](handleError(_0x2994c7,null));};exports[_0x474c('0xcb')]=function(_0x492fe1,_0x2a7bdd,_0x2d2dfa){return db[_0x474c('0x33')][_0x474c('0x63')]({'where':{'id':_0x492fe1[_0x474c('0xc1')]['id']}})[_0x474c('0x27')](handleEntityNotFound(_0x2a7bdd,null))[_0x474c('0x27')](function(_0x4d46a6){if(_0x4d46a6){return _0x4d46a6['addMessage'](_0x492fe1[_0x474c('0xc7')][_0x474c('0xcc')],_['omit'](_0x492fe1[_0x474c('0xc7')],[_0x474c('0xcc'),'id'])||{});}})[_0x474c('0x27')](respondWithResult(_0x2a7bdd,null))['catch'](handleError(_0x2a7bdd,null));};exports[_0x474c('0xcd')]=function(_0x26eb3a,_0x3a48c0,_0x3549dd){var _0x53a13c={'raw':![],'where':{}};var _0x4b30d0={};var _0x526f27={'count':0x0,'rows':[]};return db['MailInteraction'][_0x474c('0x34')]({'where':{'id':_0x26eb3a[_0x474c('0xc1')]['id']}})[_0x474c('0x27')](handleEntityNotFound(_0x3a48c0,null))[_0x474c('0x27')](function(_0x4ab7ad){if(_0x4ab7ad){_0x4b30d0['model']=_[_0x474c('0xc2')](db[_0x474c('0x33')][_0x474c('0x3e')]);_0x4b30d0[_0x474c('0x41')]=_['keys'](_0x26eb3a[_0x474c('0x41')]);_0x4b30d0['filters']=_[_0x474c('0x43')](_0x4b30d0[_0x474c('0x40')],_0x4b30d0[_0x474c('0x41')]);_0x53a13c[_0x474c('0x44')]=_['intersection'](_0x4b30d0[_0x474c('0x40')],qs['fields'](_0x26eb3a['query'][_0x474c('0x45')]));_0x53a13c['attributes']=_0x53a13c[_0x474c('0x44')][_0x474c('0x46')]?_0x53a13c[_0x474c('0x44')]:_0x4b30d0[_0x474c('0x40')];if(!_0x26eb3a[_0x474c('0x41')][_0x474c('0x47')](_0x474c('0x48'))){_0x53a13c['limit']=qs[_0x474c('0x22')](_0x26eb3a[_0x474c('0x41')][_0x474c('0x22')]);_0x53a13c[_0x474c('0x21')]=qs['offset'](_0x26eb3a[_0x474c('0x41')][_0x474c('0x21')]);}_0x53a13c['order']=qs[_0x474c('0x4a')](_0x26eb3a[_0x474c('0x41')][_0x474c('0x4a')]);_0x53a13c[_0x474c('0x7a')]=qs[_0x474c('0x42')](_[_0x474c('0x4b')](_0x26eb3a['query'],_0x4b30d0[_0x474c('0x42')]));_0x53a13c[_0x474c('0x7a')][_0x474c('0xbc')]=_0x4ab7ad['id'];if(_0x26eb3a[_0x474c('0x41')][_0x474c('0x89')]){_0x53a13c['where']=_[_0x474c('0xa2')](_0x53a13c[_0x474c('0x7a')],{'$or':_[_0x474c('0x3c')](_0x53a13c['attributes'],function(_0x46ce79){var _0x34e7cf={};_0x34e7cf[_0x46ce79]={'$like':'%'+_0x26eb3a[_0x474c('0x41')][_0x474c('0x89')]+'%'};return _0x34e7cf;})});}if(_0x26eb3a[_0x474c('0x41')]['$gte']){var _0x303ed1=_0x26eb3a[_0x474c('0x41')][_0x474c('0x7f')][_0x474c('0x30')](',');var _0x219f37={};_0x219f37[_0x303ed1[0x0]]={'$gte':moment(_0x303ed1[0x1])[_0x474c('0xce')](_0x474c('0xcf'))};_0x53a13c[_0x474c('0x7a')]=_[_0x474c('0xa2')](_0x53a13c[_0x474c('0x7a')],_0x219f37);}_0x53a13c=_[_0x474c('0xa2')]({},_0x53a13c,_0x26eb3a[_0x474c('0xc5')]);return db[_0x474c('0x33')][_0x474c('0x20')]({'where':_0x53a13c[_0x474c('0x7a')]})['then'](function(_0x2c4a18){_0x526f27[_0x474c('0x20')]=_0x2c4a18;if(_0x26eb3a[_0x474c('0x41')][_0x474c('0xc3')]){_0x53a13c[_0x474c('0xc4')]=[{'all':!![]}];}return db[_0x474c('0x33')]['findAll'](_0x53a13c);})[_0x474c('0x27')](function(_0x42b3c3){if(_0x26eb3a[_0x474c('0x41')][_0x474c('0xd0')]===_0x474c('0xd1')){for(var _0x682a2f=0x0;_0x682a2f<_0x42b3c3[_0x474c('0x46')];_0x682a2f++){_0x42b3c3[_0x682a2f][_0x474c('0xc7')]=juice(_0x42b3c3[_0x682a2f]['body']);}}_0x526f27[_0x474c('0xc0')]=_0x42b3c3;return _0x526f27;});}})[_0x474c('0x27')](respondWithFilteredResult(_0x3a48c0,_0x53a13c))[_0x474c('0x3a')](handleError(_0x3a48c0,null));};exports[_0x474c('0xd2')]=function(_0x3d93de,_0x123aee,_0x2a67d9){return db[_0x474c('0x3d')][_0x474c('0x63')]({'where':{'id':_0x3d93de[_0x474c('0xc1')]['id']}})['then'](handleEntityNotFound(_0x123aee,null))[_0x474c('0x27')](function(_0x42d36c){if(_0x42d36c){return _0x42d36c[_0x474c('0xd3')](_0x3d93de[_0x474c('0xc7')]['ids'],_['omit'](_0x3d93de[_0x474c('0xc7')],[_0x474c('0xcc'),'id'])||{})[_0x474c('0xd4')](function(){return db[_0x474c('0x71')][_0x474c('0xd5')]({'attributes':['id','name','color'],'where':{'id':_0x3d93de[_0x474c('0xc7')][_0x474c('0xcc')]}});})[_0x474c('0x27')](function(_0x23eebc){socket['emit'](_0x474c('0xd6'),{'id':Number(_0x3d93de[_0x474c('0xc1')]['id']),'tags':_0x23eebc||[]});return{'id':Number(_0x3d93de[_0x474c('0xc1')]['id']),'tags':_0x23eebc||[]};});}})[_0x474c('0x27')](respondWithResult(_0x123aee,null))['catch'](handleError(_0x123aee,null));};exports['removeTags']=function(_0x5ec59b,_0xf0cf72,_0x2a0152){return db[_0x474c('0x3d')]['find']({'where':{'id':_0x5ec59b['params']['id']}})[_0x474c('0x27')](handleEntityNotFound(_0xf0cf72,null))[_0x474c('0x27')](function(_0x199340){if(_0x199340){return _0x199340['removeTags'](_0x5ec59b[_0x474c('0x41')][_0x474c('0xcc')]);}})['then'](respondWithStatusCode(_0xf0cf72,null))[_0x474c('0x3a')](handleError(_0xf0cf72,null));};exports[_0x474c('0xd7')]=function(_0x114013,_0x3e56f2){var _0x3e0b61=moment()[_0x474c('0xd8')]()[_0x474c('0xa0')]();var _0x11c777=path[_0x474c('0xd9')](config[_0x474c('0xda')],'server',_0x474c('0xdb'),_0x474c('0xdc'));var _0x4bcab4=path[_0x474c('0xd9')](config[_0x474c('0xda')],'server',_0x474c('0xdb'),_0x474c('0xdd'));var _0x5bc5f6=path['join'](_0x11c777,_0x3e0b61);var _0x4d1f8d=util[_0x474c('0xce')](_0x474c('0xde'),_0x114013['params']['id'],_0x3e0b61);var _0x597ab7=path[_0x474c('0xd9')](_0x11c777,_0x4d1f8d);var _0x8c4905=[];if(_0x114013[_0x474c('0x41')][_0x474c('0xdd')]){_0x8c4905[_0x474c('0x32')]({'model':db[_0x474c('0xdf')],'as':'Attachments','raw':!![]});}var _0x33c313=[{'model':db[_0x474c('0x33')],'as':_0x474c('0xe0'),'attributes':['id',_0x474c('0xc7'),_0x474c('0x52'),'to','cc',_0x474c('0xe1'),_0x474c('0xe2'),_0x474c('0x7d')],'where':{'secret':![]},'order':qs[_0x474c('0x4a')]('id'),'include':_0x8c4905}];return db['MailInteraction'][_0x474c('0x63')]({'where':{'id':_0x114013[_0x474c('0xc1')]['id']},'include':_0x33c313})[_0x474c('0x27')](handleEntityNotFound(_0x3e56f2,null))[_0x474c('0x27')](function(_0x3966ee){if(_0x3966ee&&_0x3966ee['Messages']){var _0x37115f=_0x3966ee[_0x474c('0xe3')]({'plain':!![]});fs[_0x474c('0xe4')](_0x5bc5f6);return BPromise[_0x474c('0xe5')](_0x37115f['Messages'],function(_0x542445,_0x5ca6da){var _0x43e43b={'from':_0x542445[_0x474c('0x52')],'to':_0x542445['to'],'subject':_0x542445[_0x474c('0xe2')],'html':_0x542445[_0x474c('0xc7')],'headers':{'Date':moment(_0x542445[_0x474c('0x7d')])[_0x474c('0xce')](_0x474c('0xe6'))},'attachments':[]};if(_0x542445['cc']){_0x43e43b[_0x474c('0xe7')]['Cc']=_0x542445['cc'];}if(_0x542445['bcc']){_0x43e43b[_0x474c('0xe7')][_0x474c('0xe8')]=_0x542445[_0x474c('0xe1')];}return new BPromise(function(_0x438728,_0x3d136e){if(_0x542445[_0x474c('0xe9')]){for(var _0xa751bc=0x0;_0xa751bc<_0x542445[_0x474c('0xe9')][_0x474c('0x46')];_0xa751bc++){var _0x4cfa89=_0x542445[_0x474c('0xe9')][_0xa751bc];var _0x2ab22d=path[_0x474c('0xd9')](_0x4bcab4,_0x4cfa89[_0x474c('0xea')]);if(fs[_0x474c('0xeb')](_0x2ab22d)){_0x43e43b[_0x474c('0xdd')][_0x474c('0x32')]({'name':_0x4cfa89[_0x474c('0x2a')],'contentType':_0x4cfa89[_0x474c('0x6e')],'data':fs[_0x474c('0xec')](_0x2ab22d)});}}}emlformat['build'](_0x43e43b,function(_0xff10e8,_0x165577){if(_0xff10e8)return _0x3d136e(_0xff10e8);fs[_0x474c('0xed')](path[_0x474c('0xd9')](_0x5bc5f6,util[_0x474c('0xce')](_0x474c('0xee'),_0x5ca6da)),_0x165577);return _0x438728(_0x165577);});});})[_0x474c('0x27')](function(){return new BPromise(function(_0x31e624,_0x25742b){zipdir(_0x5bc5f6,{'saveTo':_0x597ab7},function(_0x4313ac,_0x2f468f){if(_0x4313ac)return _0x25742b(_0x4313ac);return _0x31e624(_0x2f468f);});})['then'](function(){return new BPromise(function(_0x2bae00,_0xe36c11){rimraf(_0x5bc5f6,function(_0x3eedac){if(_0x3eedac)_0xe36c11(_0x3eedac);return _0x2bae00();});});})['then'](function(){return _0x3e56f2['download'](_0x597ab7,_0x4d1f8d,function(_0x504d4b){if(_0x504d4b){console[_0x474c('0xef')](_0x474c('0xf0'),_0x504d4b);}else{fs['unlinkSync'](_0x597ab7);}});});});}else{return _0x3e56f2[_0x474c('0x1c')](0xc8);}})['catch'](handleError(_0x3e56f2,null));}; \ No newline at end of file +var _0xe4ba=['from','left_join','u.id\x20=\x20ui.UserId','mail_interactions','cm_contacts','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','mail_interaction_has_tags','it.MailInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','having','Contact','operator','$substring','value','split','length','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','Tag','forEach','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','text','start','isEmpty','MailAccountId','i.MailAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','isArray','tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','isEmail','c.email\x20LIKE\x20?','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','i.id','Sequelize','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','order','contactName','t.id\x20IN\x20?','resolve','i.MailAccountId\x20IS\x20NOT\x20NULL','agent','getMailAccounts','i.MailAccountId\x20IS\x20NULL','user','role','sequelize','toString','keyBy','merge','fields','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20(\x27%\x27\x20+\x20a.email\x20+\x20\x27%\x27)\x20THEN\x20SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201)\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.updatedAt','i.closed','i.closedAt','i.attach','i.lastMsgAt','i.lastMsgDirection','i.disposition','i.thirdDisposition','i.substatus','i.to','i.ContactId','i.UserId','c.firstName','Contact.firstName','c.lastName','c.phone','Contact.phone','c.mobile','c.fax','Contact.fax','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.MailInteractionId\x20IN\x20?','groupBy','MailInteractionId','Setting','enableEmailPreview','all','rows','includeAll','include','options','create','body','params','describe','addMessage','ids','omit','format','YYYY-MM-DD\x20HH:mm:ss','findAll','inlineCss','addTags','setTags','emit','mailInteractionTags:save','removeTags','download','unix','join','root','files','server','transcript-%d-%s.zip','attachments','Attachment','Messages','bcc','get','mkdirSync','each','subject','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','Attachments','existsSync','readFileSync','writeFileSync','log','err','unlinkSync','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','querystring','papaparse','html-to-text','juice','../../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','./mailInteraction.socket','register','end','status','json','undefined','limit','offset','count','Content-Range','apply','reject','update','destroy','then','sendStatus','error','stack','name','send','map','fullname','TagIds','push','MailMessage','findOne','out','plainBody','lastMsgText','catch','index','MailInteraction','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','hasOwnProperty','nolimit','sort','where','pick','select','field','tools_tags','u.id','ui.MailInteractionId'];(function(_0x292404,_0x29771e){var _0x3ee518=function(_0x273a02){while(--_0x273a02){_0x292404['push'](_0x292404['shift']());}};_0x3ee518(++_0x29771e);}(_0xe4ba,0x190));var _0xae4b=function(_0x3f563a,_0x1cc7cf){_0x3f563a=_0x3f563a-0x0;var _0xfb1996=_0xe4ba[_0x3f563a];return _0xfb1996;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xae4b('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xae4b('0x1'));var rp=require(_0xae4b('0x2'));var moment=require(_0xae4b('0x3'));var BPromise=require(_0xae4b('0x4'));var Mustache=require(_0xae4b('0x5'));var util=require('util');var path=require(_0xae4b('0x6'));var sox=require(_0xae4b('0x7'));var csv=require(_0xae4b('0x8'));var ejs=require(_0xae4b('0x9'));var fs=require('fs');var fs_extra=require(_0xae4b('0xa'));var _=require('lodash');var squel=require(_0xae4b('0xb'));var crypto=require(_0xae4b('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xae4b('0x8'));var querystring=require(_0xae4b('0xd'));var Papa=require(_0xae4b('0xe'));var htmlToText=require(_0xae4b('0xf'));var juice=require(_0xae4b('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xae4b('0x11'));var as=require(_0xae4b('0x12'));var hardwareService=require(_0xae4b('0x13'));var logger=require(_0xae4b('0x14'))(_0xae4b('0x15'));var utils=require(_0xae4b('0x16'));var config=require(_0xae4b('0x17'));var licenseUtil=require(_0xae4b('0x18'));var db=require('../../mysqldb')['db'];config[_0xae4b('0x19')]=_[_0xae4b('0x1a')](config['redis'],{'host':_0xae4b('0x1b'),'port':0x18eb});var socket=require(_0xae4b('0x1c'))(new Redis(config['redis']));require(_0xae4b('0x1d'))[_0xae4b('0x1e')](socket);function respondWithStatusCode(_0x1beff8,_0x22f29d){_0x22f29d=_0x22f29d||0xcc;return function(_0x4f87ca){if(_0x4f87ca){return _0x1beff8['sendStatus'](_0x22f29d);}return _0x1beff8['status'](_0x22f29d)[_0xae4b('0x1f')]();};}function respondWithResult(_0x3b95da,_0x144d66){_0x144d66=_0x144d66||0xc8;return function(_0x321eea){if(_0x321eea){return _0x3b95da[_0xae4b('0x20')](_0x144d66)[_0xae4b('0x21')](_0x321eea);}};}function respondWithFilteredResult(_0xb700c5,_0x141245){return function(_0x1001d6){if(_0x1001d6){var _0x1b634d=typeof _0x141245['offset']===_0xae4b('0x22')&&typeof _0x141245[_0xae4b('0x23')]===_0xae4b('0x22');var _0x28db9d=_0x1001d6['count'];var _0x1a7063=_0x1b634d?0x0:_0x141245[_0xae4b('0x24')];var _0x2a3267=_0x1b634d?_0x1001d6[_0xae4b('0x25')]:_0x141245[_0xae4b('0x24')]+_0x141245[_0xae4b('0x23')];var _0x3e0429;if(_0x2a3267>=_0x28db9d){_0x2a3267=_0x28db9d;_0x3e0429=0xc8;}else{_0x3e0429=0xce;}_0xb700c5[_0xae4b('0x20')](_0x3e0429);return _0xb700c5['set'](_0xae4b('0x26'),_0x1a7063+'-'+_0x2a3267+'/'+_0x28db9d)[_0xae4b('0x21')](_0x1001d6);}return null;};}function patchUpdates(_0x2e00fd){return function(_0x3e54af){try{jsonpatch[_0xae4b('0x27')](_0x3e54af,_0x2e00fd,!![]);}catch(_0x5ae0c3){return BPromise[_0xae4b('0x28')](_0x5ae0c3);}return _0x3e54af['save']();};}function saveUpdates(_0x59538e,_0x294a94){return function(_0x520fd8){if(_0x520fd8){return _0x520fd8[_0xae4b('0x29')](_0x59538e)['then'](function(_0x326ad3){return _0x326ad3;});}return null;};}function removeEntity(_0x5ec4cc,_0x1339fe){return function(_0x413ceb){if(_0x413ceb){return _0x413ceb[_0xae4b('0x2a')]()[_0xae4b('0x2b')](function(){_0x5ec4cc[_0xae4b('0x20')](0xcc)[_0xae4b('0x1f')]();});}};}function handleEntityNotFound(_0x47764f,_0x109057){return function(_0x4eafd5){if(!_0x4eafd5){_0x47764f[_0xae4b('0x2c')](0x194);}return _0x4eafd5;};}function handleError(_0x3ebfb1,_0x234c4c){_0x234c4c=_0x234c4c||0x1f4;return function(_0x2e7f72){logger[_0xae4b('0x2d')](_0x2e7f72[_0xae4b('0x2e')]);if(_0x2e7f72['name']){delete _0x2e7f72[_0xae4b('0x2f')];}_0x3ebfb1[_0xae4b('0x20')](_0x234c4c)[_0xae4b('0x30')](_0x2e7f72);};}function getInteractionUsers(_0x36041d,_0x39d19e){return new BPromise(function(_0x2cc530,_0x3c0bd1){try{if(_0x39d19e[_0x36041d['id']]){_0x36041d['Users']=_[_0xae4b('0x31')](_0x39d19e[_0x36041d['id']],function(_0x43ef61){return{'id':_0x43ef61['id'],'fullname':_0x43ef61[_0xae4b('0x32')]};});}}catch(_0x24c531){_0x3c0bd1(_0x24c531);}_0x2cc530(_0x36041d);});}function getInteractionTags(_0x4dddaa,_0x243ab1){return new BPromise(function(_0x522fa9,_0x130bdb){try{if(_0x4dddaa[_0xae4b('0x33')]){_0x4dddaa['Tags']=[];_0x4dddaa[_0xae4b('0x33')]['split'](',')['forEach'](function(_0x3562db){_0x4dddaa['Tags'][_0xae4b('0x34')](_0x243ab1[_0x3562db]);});}delete _0x4dddaa[_0xae4b('0x33')];}catch(_0x4e9e7d){_0x130bdb(_0x4e9e7d);}_0x522fa9(_0x4dddaa);});}function getLastMessageText(_0x1de5e6){return new BPromise(function(_0x58a1de,_0x287c1b){return db[_0xae4b('0x35')][_0xae4b('0x36')]({'where':{'$and':[{'MailInteractionId':_0x1de5e6['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0xae4b('0x37')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0xae4b('0x38')],'order':'-id','raw':!![]})['then'](function(_0x2a8c62){if(_0x2a8c62&&_0x2a8c62[_0xae4b('0x38')]){_0x1de5e6[_0xae4b('0x39')]=_['trimStart'](_0x2a8c62['plainBody']);}_0x58a1de(_0x1de5e6);})['catch'](function(_0x279c42){_0x287c1b(_0x279c42);});});}function updateMailInteraction(_0x2202d9,_0x9ecb42,_0x416194,_0x5e18c0){return new BPromise(function(_0x25ad20,_0x40db39){return getInteractionUsers(_0x2202d9,_0x416194)[_0xae4b('0x2b')](function(_0x230c5d){return getInteractionTags(_0x230c5d,_0x9ecb42);})[_0xae4b('0x2b')](function(_0x370b39){if(_0x5e18c0){_0x25ad20(getLastMessageText(_0x370b39));}else{_0x25ad20(_0x370b39);}})[_0xae4b('0x3a')](function(_0x50c4c8){_0x40db39(_0x50c4c8);});});}exports[_0xae4b('0x3b')]=function(_0x7697e9,_0x4d3ea2){var _0x2524d2={},_0x2c97b5={},_0x3f1a61={'count':0x0,'rows':[]};var _0x4b7ecb=_[_0xae4b('0x31')](db[_0xae4b('0x3c')][_0xae4b('0x3d')],function(_0x49f67a){return{'name':_0x49f67a[_0xae4b('0x3e')],'type':_0x49f67a[_0xae4b('0x3f')]['key']};});_0x2c97b5[_0xae4b('0x40')]=_[_0xae4b('0x31')](_0x4b7ecb,_0xae4b('0x2f'));_0x2c97b5[_0xae4b('0x41')]=_[_0xae4b('0x42')](_0x7697e9[_0xae4b('0x41')]);_0x2c97b5[_0xae4b('0x43')]=_[_0xae4b('0x44')](_0x2c97b5[_0xae4b('0x40')],_0x2c97b5[_0xae4b('0x41')]);_0x2524d2[_0xae4b('0x45')]=_[_0xae4b('0x44')](_0x2c97b5[_0xae4b('0x40')],qs['fields'](_0x7697e9[_0xae4b('0x41')]['fields']));_0x2524d2[_0xae4b('0x45')]=_0x2524d2[_0xae4b('0x45')]['length']?_0x2524d2[_0xae4b('0x45')]:_0x2c97b5[_0xae4b('0x40')];if(!_0x7697e9[_0xae4b('0x41')][_0xae4b('0x46')](_0xae4b('0x47'))){_0x2524d2['limit']=qs[_0xae4b('0x23')](_0x7697e9['query']['limit']);_0x2524d2[_0xae4b('0x24')]=qs[_0xae4b('0x24')](_0x7697e9['query'][_0xae4b('0x24')]);}_0x2524d2['order']=qs['sort'](_0x7697e9[_0xae4b('0x41')][_0xae4b('0x48')]);_0x2524d2[_0xae4b('0x49')]=qs['filters'](_[_0xae4b('0x4a')](_0x7697e9[_0xae4b('0x41')],_0x2c97b5[_0xae4b('0x43')]),_0x4b7ecb);var _0x4a8255=[];var _0x500b3=squel[_0xae4b('0x4b')]()[_0xae4b('0x4c')]('id')[_0xae4b('0x4c')](_0xae4b('0x2f'))[_0xae4b('0x4c')]('color')['from'](_0xae4b('0x4d'));var _0x27ba9b=squel['select']()['field'](_0xae4b('0x4e'))[_0xae4b('0x4c')]('u.fullname')['field'](_0xae4b('0x4f'))[_0xae4b('0x50')]('user_has_mail_interactions','ui')[_0xae4b('0x51')]('users','u',_0xae4b('0x52'));var _0xc6aea=squel[_0xae4b('0x4b')]()[_0xae4b('0x50')](_0xae4b('0x53'),'i')[_0xae4b('0x51')](_0xae4b('0x54'),'c',_0xae4b('0x55'))[_0xae4b('0x51')]('users','o',_0xae4b('0x56'))[_0xae4b('0x51')](_0xae4b('0x57'),'a',_0xae4b('0x58'))[_0xae4b('0x51')](_0xae4b('0x59'),'me',_0xae4b('0x5a'))[_0xae4b('0x51')](_0xae4b('0x5b'),'it',_0xae4b('0x5c'))[_0xae4b('0x51')](_0xae4b('0x4d'),'t',_0xae4b('0x5d'));var _0x4a24df=squel[_0xae4b('0x5e')]();var _0x45d74f=[];var _0x5024f0=squel['expr']();var _0x51994b;if(_0x7697e9[_0xae4b('0x41')][_0xae4b('0x5f')]){_0x51994b=as[_0xae4b('0x60')](_0x7697e9['query'][_0xae4b('0x5f')]);var _0x4c1008=_0x51994b[_0xae4b('0x61')];for(var _0x1277d7=0x0;_0x1277d7<_0x51994b[_0xae4b('0x62')]['length'];_0x1277d7++){var _0xde7b7=_0x51994b[_0xae4b('0x62')][_0x1277d7];var _0x37c0de='i';var _0x57b0b2=_[_0xae4b('0x63')](_0x4b7ecb,[_0xae4b('0x2f'),_0xde7b7['field']]);if(!_0x57b0b2){switch(_0xde7b7[_0xae4b('0x4c')]){case'unreadMessages':if(_0xde7b7['value']==0x1){_0xc6aea['having']('`'+_0xde7b7[_0xae4b('0x4c')]+'`\x20=\x200');}else{_0xc6aea[_0xae4b('0x64')]('`'+_0xde7b7[_0xae4b('0x4c')]+'`\x20>\x200');}break;case _0xae4b('0x65'):if(_0xde7b7[_0xae4b('0x66')]===_0xae4b('0x67')){if(_0xde7b7[_0xae4b('0x68')][_0xae4b('0x69')]('\x20')[_0xae4b('0x6a')]>0x1){_0x4a24df[_0x4c1008](_0xae4b('0x6b'),qs[_0xae4b('0x6c')](_0xde7b7['value']),null);}else{var _0xc840e8='%'+_0xde7b7[_0xae4b('0x68')]+'%';_0x4a24df[_0x4c1008](_0xae4b('0x6d'),_0xc840e8,_0xc840e8,_0xc840e8);}}else{_0x57b0b2=_[_0xae4b('0x63')](_0x4b7ecb,['name',_0xae4b('0x6e')]);_0xde7b7[_0xae4b('0x4c')]=_0xae4b('0x6e');_0xb3dc5b=as[_0xae4b('0x6f')](_0x37c0de,_0x57b0b2[_0xae4b('0x3f')],_0xde7b7);_0x4a24df[_0x4c1008](_0xb3dc5b['text'],_0xb3dc5b[_0xae4b('0x68')]['start'],_0xb3dc5b[_0xae4b('0x68')][_0xae4b('0x1f')]);}break;case _0xae4b('0x70'):var _0x32582a=_0xde7b7[_0xae4b('0x68')][_0xae4b('0x69')](',')[_0xae4b('0x31')](function(_0x3b3415){return Number(_0x3b3415);});_0x32582a[_0xae4b('0x71')](function(_0x58ff88){_0x5024f0['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x58ff88+',%');});_0x45d74f=_['union'](_0x45d74f,_0x32582a);break;case _0xae4b('0x72'):if(_0xde7b7[_0xae4b('0x66')]==='$substring'){_0x4a24df[_0x4c1008](_0xae4b('0x73'),'%'+_0xde7b7[_0xae4b('0x68')]+'%',null);}else{_0x57b0b2=_[_0xae4b('0x63')](_0x4b7ecb,['name','UserId']);_0xde7b7['field']=_0xae4b('0x74');_0xb3dc5b=as[_0xae4b('0x6f')](_0x37c0de,_0x57b0b2[_0xae4b('0x3f')],_0xde7b7);_0x4a24df[_0x4c1008](_0xb3dc5b[_0xae4b('0x75')],_0xb3dc5b[_0xae4b('0x68')]['start'],_0xb3dc5b[_0xae4b('0x68')]['end']);}break;case _0xae4b('0x38'):_0xb3dc5b=as['buildExpression']('me',null,_0xde7b7);_0x4a24df[_0x4c1008](_0xb3dc5b['text'],_0xb3dc5b['value'][_0xae4b('0x76')],_0xb3dc5b[_0xae4b('0x68')][_0xae4b('0x1f')]);break;}}else{var _0xb3dc5b=as[_0xae4b('0x6f')](_0x37c0de,_0x57b0b2[_0xae4b('0x3f')],_0xde7b7);_0x4a24df[_0x4c1008](_0xb3dc5b['text'],_0xb3dc5b[_0xae4b('0x68')][_0xae4b('0x76')],_0xb3dc5b[_0xae4b('0x68')][_0xae4b('0x1f')]);}}}else{var _0x319f8c=_(_0x7697e9[_0xae4b('0x41')])[_0xae4b('0x42')]()[_0xae4b('0x31')](function(_0x3c1e0e){return _['some'](_0x4b7ecb,[_0xae4b('0x2f'),_0x3c1e0e])?_0x3c1e0e:undefined;})['compact']()[_0xae4b('0x68')]();if(!_[_0xae4b('0x77')](_0x319f8c)){_0x319f8c['forEach'](function(_0x24fd64){if(_0x24fd64===_0xae4b('0x78')){_0xc6aea[_0xae4b('0x49')](_0xae4b('0x79'),[][_0xae4b('0x7a')](_0x7697e9['query'][_0x24fd64]));}else if(_0x24fd64===_0xae4b('0x7b')){var _0x5027ce=JSON[_0xae4b('0x7c')](_0x7697e9[_0xae4b('0x41')][_0x24fd64])[_0xae4b('0x7d')];var _0x14c55c=JSON[_0xae4b('0x7c')](_0x7697e9[_0xae4b('0x41')][_0x24fd64])[_0xae4b('0x7e')];_0xc6aea['where'](_0xae4b('0x7f'),_0x5027ce,_0x14c55c);}else{if(_0x7697e9['query'][_0x24fd64]===_0xae4b('0x80')){_0xc6aea['where']('i.'+_0x24fd64+_0xae4b('0x81'));}else{_0xc6aea[_0xae4b('0x49')]('i.'+_0x24fd64+_0xae4b('0x82'),_0x7697e9['query'][_0x24fd64]);}}});}if(_0x7697e9[_0xae4b('0x41')]['read']){if(_0x7697e9['query'][_0xae4b('0x83')]==0x1){_0xc6aea[_0xae4b('0x64')](_0xae4b('0x84'));}else{_0xc6aea[_0xae4b('0x64')](_0xae4b('0x85'));}}if(_0x7697e9[_0xae4b('0x41')]['tag']){_0x45d74f=_[_0xae4b('0x86')](_0x7697e9[_0xae4b('0x41')][_0xae4b('0x87')])?_0x7697e9['query'][_0xae4b('0x87')]:new Array(_0x7697e9['query']['tag']);_0x45d74f[_0xae4b('0x71')](function(_0x12ba9a){_0x5024f0['or'](_0xae4b('0x88'),'%,'+_0x12ba9a+',%');});}if(_0x7697e9[_0xae4b('0x41')]['filter']){var _0x500481=_0x7697e9[_0xae4b('0x41')][_0xae4b('0x89')][_0xae4b('0x8a')]('\x5c','\x5c\x5c')[_0xae4b('0x8a')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x500481)){_0x4a24df['or']('i.id\x20LIKE\x20?',_0x500481+'%');}else if(qs[_0xae4b('0x8b')](_0x500481)){_0x4a24df['or'](_0xae4b('0x8c'),_0x500481+'%');}else{_0x4a24df['or'](_0xae4b('0x8d'),qs[_0xae4b('0x6c')](_0x500481))['or'](_0xae4b('0x8e'),qs['getFullTextValue'](_0x500481));}}}_0xc6aea['where'](_0x4a24df);_0xc6aea['group'](_0xae4b('0x8f'));var _0x469d35={'type':db[_0xae4b('0x90')]['QueryTypes']['SELECT'],'raw':!![]};var _0x2f409b=_0xc6aea[_0xae4b('0x91')]();_0x2f409b['field']('i.id');_0x2f409b[_0xae4b('0x4c')](_0xae4b('0x92'),_0xae4b('0x93'));if(_0x2524d2[_0xae4b('0x94')]){_0x2524d2['order'][_0xae4b('0x71')](function(_0x120b51){var _0x5b7398=_0x120b51[0x0]===_0xae4b('0x95')?_0x120b51[0x0]:'i.'+_0x120b51[0x0];_0xc6aea[_0xae4b('0x94')](_0x5b7398,_0x120b51[0x1]==='DESC'?![]:!![]);});}if(!_['isEmpty'](_0x45d74f)){_0xc6aea['having'](_0x5024f0);_0x2f409b[_0xae4b('0x49')](_0xae4b('0x96'),_0x45d74f);}BPromise[_0xae4b('0x97')]()[_0xae4b('0x2b')](function(){if(!_0x51994b){if(_0x7697e9[_0xae4b('0x41')][_0xae4b('0x78')])return;_0x2f409b[_0xae4b('0x49')](_0xae4b('0x98'));_0xc6aea[_0xae4b('0x49')]('i.MailAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x7697e9['user']['role']!==_0xae4b('0x99'))return;return _0x7697e9['user'][_0xae4b('0x9a')]({'attributes':['id'],'raw':!![]})[_0xae4b('0x2b')](function(_0x2dc176){if(_[_0xae4b('0x77')](_0x2dc176)){_0x2f409b[_0xae4b('0x49')](_0xae4b('0x9b'));_0xc6aea[_0xae4b('0x49')](_0xae4b('0x9b'));}else{_0x2f409b['where']('i.MailAccountId\x20IN\x20?',_[_0xae4b('0x31')](_0x2dc176,'id'));_0xc6aea[_0xae4b('0x49')](_0xae4b('0x79'),_[_0xae4b('0x31')](_0x2dc176,'id'));}});})[_0xae4b('0x2b')](function(){if(_0x7697e9[_0xae4b('0x9c')][_0xae4b('0x9d')]===_0xae4b('0x99')&&!_0x51994b&&!_0x7697e9[_0xae4b('0x41')][_0xae4b('0x78')])return[];return db[_0xae4b('0x9e')][_0xae4b('0x41')](_0x2f409b[_0xae4b('0x9f')](),_0x469d35);})[_0xae4b('0x2b')](function(_0x76b4db){_0x3f1a61[_0xae4b('0x25')]=_0x76b4db['length'];if(_0x3f1a61[_0xae4b('0x25')]===0x0)return[];return db[_0xae4b('0x9e')][_0xae4b('0x41')](_0x500b3[_0xae4b('0x9f')](),_0x469d35)[_0xae4b('0x2b')](function(_0x3b2dee){_0x4a8255=_[_0xae4b('0xa0')](_0x3b2dee,'id');_0x469d35=_[_0xae4b('0xa1')](_0x469d35,{'model':db[_0xae4b('0x3c')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x7697e9[_0xae4b('0x41')][_0xae4b('0xa2')]){_0x2524d2[_0xae4b('0x45')][_0xae4b('0x71')](function(_0x2f82f4){_0xc6aea[_0xae4b('0x4c')]('i.'+_0x2f82f4);});}else{_0xc6aea[_0xae4b('0x4c')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xae4b('0x93'));_0xc6aea['field']('a.key',_0xae4b('0xa3'));_0xc6aea[_0xae4b('0x4c')](_0xae4b('0xa4'),_0xae4b('0xa5'));_0xc6aea['field'](_0xae4b('0xa6'),_0xae4b('0x95'));_0xc6aea[_0xae4b('0x4c')]('i.id');_0xc6aea[_0xae4b('0x4c')]('i.createdAt');_0xc6aea[_0xae4b('0x4c')](_0xae4b('0xa7'));_0xc6aea[_0xae4b('0x4c')](_0xae4b('0xa8'));_0xc6aea[_0xae4b('0x4c')](_0xae4b('0xa9'));_0xc6aea[_0xae4b('0x4c')](_0xae4b('0xaa'));_0xc6aea['field'](_0xae4b('0xab'));_0xc6aea[_0xae4b('0x4c')](_0xae4b('0xac'));_0xc6aea['field']('i.subject');_0xc6aea[_0xae4b('0x4c')](_0xae4b('0xad'));_0xc6aea[_0xae4b('0x4c')]('i.secondDisposition');_0xc6aea[_0xae4b('0x4c')](_0xae4b('0xae'));_0xc6aea[_0xae4b('0x4c')](_0xae4b('0xaf'));_0xc6aea[_0xae4b('0x4c')](_0xae4b('0xb0'));_0xc6aea[_0xae4b('0x4c')](_0xae4b('0xb1'));_0xc6aea[_0xae4b('0x4c')]('i.MailAccountId');_0xc6aea['field'](_0xae4b('0xb2'));_0xc6aea[_0xae4b('0x4c')](_0xae4b('0xb3'),_0xae4b('0xb4'));_0xc6aea[_0xae4b('0x4c')](_0xae4b('0xb5'),'Contact.lastName');_0xc6aea[_0xae4b('0x4c')]('c.email','Contact.email');_0xc6aea[_0xae4b('0x4c')](_0xae4b('0xb6'),_0xae4b('0xb7'));_0xc6aea[_0xae4b('0x4c')](_0xae4b('0xb8'),'Contact.mobile');_0xc6aea[_0xae4b('0x4c')](_0xae4b('0xb9'),_0xae4b('0xba'));_0xc6aea[_0xae4b('0x4c')]('o.fullname','Owner.fullname');_0xc6aea[_0xae4b('0x4c')](_0xae4b('0xbb'),'Owner.internal');_0xc6aea[_0xae4b('0x4c')](_0xae4b('0xbc'),_0xae4b('0x33'));}if(_0x2524d2[_0xae4b('0x23')])_0xc6aea[_0xae4b('0x23')](_0x2524d2[_0xae4b('0x23')]);if(_0x2524d2[_0xae4b('0x24')])_0xc6aea[_0xae4b('0x24')](_0x2524d2[_0xae4b('0x24')]);return db[_0xae4b('0x9e')]['query'](_0xc6aea[_0xae4b('0x9f')](),_0x469d35);})[_0xae4b('0x2b')](function(_0x4fe2bc){if(_0x4fe2bc[_0xae4b('0x6a')]>0x0)_0x27ba9b['where'](_0xae4b('0xbd'),_[_0xae4b('0x31')](_0x4fe2bc,'id'));return db['sequelize'][_0xae4b('0x41')](_0x27ba9b['toString'](),_0x469d35)[_0xae4b('0x2b')](function(_0x58cd4a){var _0x5d4f69=_[_0xae4b('0xbe')](_0x58cd4a,_0xae4b('0xbf'));var _0x3a9010=[];return db[_0xae4b('0xc0')][_0xae4b('0x36')]({'attributes':[_0xae4b('0xc1')],'raw':!![]})['then'](function(_0x24a4bc){var _0x33aa4b=_0x24a4bc[_0xae4b('0xc1')];_0x4fe2bc[_0xae4b('0x71')](function(_0x148641){_0x3a9010[_0xae4b('0x34')](updateMailInteraction(_0x148641,_0x4a8255,_0x5d4f69,_0x33aa4b));});return BPromise[_0xae4b('0xc2')](_0x3a9010);});});});})['then'](function(_0x36c869){_0x3f1a61[_0xae4b('0xc3')]=_0x36c869;return _0x3f1a61;})['then'](respondWithFilteredResult(_0x4d3ea2,_0x2524d2))[_0xae4b('0x3a')](handleError(_0x4d3ea2,null));};exports['show']=function(_0x53be08,_0x5076c9){var _0x26d5fe={'raw':![],'where':{'id':_0x53be08['params']['id']}},_0x59c8d8={};_0x59c8d8[_0xae4b('0x40')]=_[_0xae4b('0x42')](db[_0xae4b('0x3c')][_0xae4b('0x3d')]);_0x59c8d8[_0xae4b('0x41')]=_['keys'](_0x53be08[_0xae4b('0x41')]);_0x59c8d8[_0xae4b('0x43')]=_['intersection'](_0x59c8d8[_0xae4b('0x40')],_0x59c8d8[_0xae4b('0x41')]);_0x26d5fe[_0xae4b('0x45')]=_[_0xae4b('0x44')](_0x59c8d8['model'],qs[_0xae4b('0xa2')](_0x53be08[_0xae4b('0x41')][_0xae4b('0xa2')]));_0x26d5fe['attributes']=_0x26d5fe[_0xae4b('0x45')][_0xae4b('0x6a')]?_0x26d5fe[_0xae4b('0x45')]:_0x59c8d8[_0xae4b('0x40')];if(_0x53be08[_0xae4b('0x41')][_0xae4b('0xc4')]){_0x26d5fe[_0xae4b('0xc5')]=[{'all':!![]}];}_0x26d5fe=_['merge']({},_0x26d5fe,_0x53be08[_0xae4b('0xc6')]);return db[_0xae4b('0x3c')][_0xae4b('0x63')](_0x26d5fe)[_0xae4b('0x2b')](handleEntityNotFound(_0x5076c9,null))[_0xae4b('0x2b')](respondWithResult(_0x5076c9,null))[_0xae4b('0x3a')](handleError(_0x5076c9,null));};exports[_0xae4b('0xc7')]=function(_0x2771e1,_0xc77967){return db['MailInteraction'][_0xae4b('0xc7')](_0x2771e1[_0xae4b('0xc8')],{})[_0xae4b('0x2b')](respondWithResult(_0xc77967,0xc9))[_0xae4b('0x3a')](handleError(_0xc77967,null));};exports[_0xae4b('0x29')]=function(_0x3a7823,_0x95be8a){if(_0x3a7823['body']['id']){delete _0x3a7823[_0xae4b('0xc8')]['id'];}return db['MailInteraction'][_0xae4b('0x63')]({'where':{'id':_0x3a7823['params']['id']}})[_0xae4b('0x2b')](handleEntityNotFound(_0x95be8a,null))[_0xae4b('0x2b')](saveUpdates(_0x3a7823[_0xae4b('0xc8')],null))['then'](respondWithResult(_0x95be8a,null))[_0xae4b('0x3a')](handleError(_0x95be8a,null));};exports[_0xae4b('0x2a')]=function(_0xa7f2e8,_0x19c774){return db['MailInteraction'][_0xae4b('0x63')]({'where':{'id':_0xa7f2e8[_0xae4b('0xc9')]['id']}})[_0xae4b('0x2b')](handleEntityNotFound(_0x19c774,null))[_0xae4b('0x2b')](removeEntity(_0x19c774,null))['catch'](handleError(_0x19c774,null));};exports['describe']=function(_0x132913,_0x1044ca){return db[_0xae4b('0x3c')][_0xae4b('0xca')]()[_0xae4b('0x2b')](respondWithResult(_0x1044ca,null))[_0xae4b('0x3a')](handleError(_0x1044ca,null));};exports[_0xae4b('0xcb')]=function(_0x1d1fdd,_0x3779b3,_0x1796ed){return db['MailMessage']['find']({'where':{'id':_0x1d1fdd[_0xae4b('0xc9')]['id']}})[_0xae4b('0x2b')](handleEntityNotFound(_0x3779b3,null))[_0xae4b('0x2b')](function(_0x3655ca){if(_0x3655ca){return _0x3655ca['addMessage'](_0x1d1fdd['body'][_0xae4b('0xcc')],_[_0xae4b('0xcd')](_0x1d1fdd[_0xae4b('0xc8')],[_0xae4b('0xcc'),'id'])||{});}})[_0xae4b('0x2b')](respondWithResult(_0x3779b3,null))[_0xae4b('0x3a')](handleError(_0x3779b3,null));};exports['getMessages']=function(_0x22d71c,_0x37aa3b,_0x735a4){var _0x302ce9={'raw':![],'where':{}};var _0x50729c={};var _0x38d248={'count':0x0,'rows':[]};return db[_0xae4b('0x3c')][_0xae4b('0x36')]({'where':{'id':_0x22d71c['params']['id']}})['then'](handleEntityNotFound(_0x37aa3b,null))[_0xae4b('0x2b')](function(_0x84ef8){if(_0x84ef8){_0x50729c[_0xae4b('0x40')]=_[_0xae4b('0x42')](db[_0xae4b('0x35')][_0xae4b('0x3d')]);_0x50729c[_0xae4b('0x41')]=_[_0xae4b('0x42')](_0x22d71c[_0xae4b('0x41')]);_0x50729c[_0xae4b('0x43')]=_[_0xae4b('0x44')](_0x50729c[_0xae4b('0x40')],_0x50729c[_0xae4b('0x41')]);_0x302ce9[_0xae4b('0x45')]=_['intersection'](_0x50729c['model'],qs[_0xae4b('0xa2')](_0x22d71c[_0xae4b('0x41')][_0xae4b('0xa2')]));_0x302ce9[_0xae4b('0x45')]=_0x302ce9[_0xae4b('0x45')][_0xae4b('0x6a')]?_0x302ce9[_0xae4b('0x45')]:_0x50729c['model'];if(!_0x22d71c[_0xae4b('0x41')]['hasOwnProperty'](_0xae4b('0x47'))){_0x302ce9[_0xae4b('0x23')]=qs[_0xae4b('0x23')](_0x22d71c[_0xae4b('0x41')][_0xae4b('0x23')]);_0x302ce9[_0xae4b('0x24')]=qs[_0xae4b('0x24')](_0x22d71c['query']['offset']);}_0x302ce9[_0xae4b('0x94')]=qs[_0xae4b('0x48')](_0x22d71c[_0xae4b('0x41')][_0xae4b('0x48')]);_0x302ce9[_0xae4b('0x49')]=qs[_0xae4b('0x43')](_[_0xae4b('0x4a')](_0x22d71c[_0xae4b('0x41')],_0x50729c['filters']));_0x302ce9[_0xae4b('0x49')][_0xae4b('0xbf')]=_0x84ef8['id'];if(_0x22d71c[_0xae4b('0x41')][_0xae4b('0x89')]){_0x302ce9[_0xae4b('0x49')]=_['merge'](_0x302ce9['where'],{'$or':_[_0xae4b('0x31')](_0x302ce9[_0xae4b('0x45')],function(_0x205a9b){var _0x2f6ef6={};_0x2f6ef6[_0x205a9b]={'$like':'%'+_0x22d71c[_0xae4b('0x41')]['filter']+'%'};return _0x2f6ef6;})});}if(_0x22d71c[_0xae4b('0x41')][_0xae4b('0x7d')]){var _0x39c8a3=_0x22d71c[_0xae4b('0x41')]['$gte'][_0xae4b('0x69')](',');var _0x13d473={};_0x13d473[_0x39c8a3[0x0]]={'$gte':moment(_0x39c8a3[0x1])[_0xae4b('0xce')](_0xae4b('0xcf'))};_0x302ce9[_0xae4b('0x49')]=_['merge'](_0x302ce9['where'],_0x13d473);}_0x302ce9=_[_0xae4b('0xa1')]({},_0x302ce9,_0x22d71c[_0xae4b('0xc6')]);return db[_0xae4b('0x35')][_0xae4b('0x25')]({'where':_0x302ce9[_0xae4b('0x49')]})[_0xae4b('0x2b')](function(_0x3c6566){_0x38d248['count']=_0x3c6566;if(_0x22d71c[_0xae4b('0x41')][_0xae4b('0xc4')]){_0x302ce9['include']=[{'all':!![]}];}return db[_0xae4b('0x35')][_0xae4b('0xd0')](_0x302ce9);})[_0xae4b('0x2b')](function(_0x5a7bb6){if(_0x22d71c[_0xae4b('0x41')][_0xae4b('0xd1')]==='true'){for(var _0x3b58c3=0x0;_0x3b58c3<_0x5a7bb6[_0xae4b('0x6a')];_0x3b58c3++){_0x5a7bb6[_0x3b58c3][_0xae4b('0xc8')]=juice(_0x5a7bb6[_0x3b58c3][_0xae4b('0xc8')]);}}_0x38d248['rows']=_0x5a7bb6;return _0x38d248;});}})['then'](respondWithFilteredResult(_0x37aa3b,_0x302ce9))[_0xae4b('0x3a')](handleError(_0x37aa3b,null));};exports[_0xae4b('0xd2')]=function(_0x35aec0,_0x5c6ede,_0x690dfd){return db[_0xae4b('0x3c')][_0xae4b('0x63')]({'where':{'id':_0x35aec0[_0xae4b('0xc9')]['id']}})[_0xae4b('0x2b')](handleEntityNotFound(_0x5c6ede,null))['then'](function(_0x1102d8){if(_0x1102d8){return _0x1102d8[_0xae4b('0xd3')](_0x35aec0[_0xae4b('0xc8')]['ids'],_[_0xae4b('0xcd')](_0x35aec0[_0xae4b('0xc8')],[_0xae4b('0xcc'),'id'])||{})['spread'](function(){return db[_0xae4b('0x70')][_0xae4b('0xd0')]({'attributes':['id','name','color'],'where':{'id':_0x35aec0[_0xae4b('0xc8')]['ids']}});})['then'](function(_0x2238c2){socket[_0xae4b('0xd4')](_0xae4b('0xd5'),{'id':Number(_0x35aec0['params']['id']),'tags':_0x2238c2||[]});return{'id':Number(_0x35aec0[_0xae4b('0xc9')]['id']),'tags':_0x2238c2||[]};});}})[_0xae4b('0x2b')](respondWithResult(_0x5c6ede,null))[_0xae4b('0x3a')](handleError(_0x5c6ede,null));};exports[_0xae4b('0xd6')]=function(_0x4a1cd1,_0x458912,_0x1efa97){return db[_0xae4b('0x3c')]['find']({'where':{'id':_0x4a1cd1['params']['id']}})[_0xae4b('0x2b')](handleEntityNotFound(_0x458912,null))[_0xae4b('0x2b')](function(_0x1def1d){if(_0x1def1d){return _0x1def1d[_0xae4b('0xd6')](_0x4a1cd1[_0xae4b('0x41')][_0xae4b('0xcc')]);}})[_0xae4b('0x2b')](respondWithStatusCode(_0x458912,null))[_0xae4b('0x3a')](handleError(_0x458912,null));};exports[_0xae4b('0xd7')]=function(_0x1524c0,_0x36f2a1){var _0x1865c9=moment()[_0xae4b('0xd8')]()['toString']();var _0x3451e7=path[_0xae4b('0xd9')](config[_0xae4b('0xda')],'server',_0xae4b('0xdb'),'tmp');var _0x446374=path['join'](config['root'],_0xae4b('0xdc'),_0xae4b('0xdb'),'attachments');var _0x2e7c98=path[_0xae4b('0xd9')](_0x3451e7,_0x1865c9);var _0x299f4d=util[_0xae4b('0xce')](_0xae4b('0xdd'),_0x1524c0[_0xae4b('0xc9')]['id'],_0x1865c9);var _0x5bfd78=path['join'](_0x3451e7,_0x299f4d);var _0x51c52e=[];if(_0x1524c0[_0xae4b('0x41')][_0xae4b('0xde')]){_0x51c52e[_0xae4b('0x34')]({'model':db[_0xae4b('0xdf')],'as':'Attachments','raw':!![]});}var _0x163258=[{'model':db['MailMessage'],'as':_0xae4b('0xe0'),'attributes':['id',_0xae4b('0xc8'),_0xae4b('0x50'),'to','cc',_0xae4b('0xe1'),'subject',_0xae4b('0x7b')],'where':{'secret':![]},'order':qs[_0xae4b('0x48')]('id'),'include':_0x51c52e}];return db[_0xae4b('0x3c')]['find']({'where':{'id':_0x1524c0[_0xae4b('0xc9')]['id']},'include':_0x163258})[_0xae4b('0x2b')](handleEntityNotFound(_0x36f2a1,null))[_0xae4b('0x2b')](function(_0x43c6ae){if(_0x43c6ae&&_0x43c6ae[_0xae4b('0xe0')]){var _0x92710=_0x43c6ae[_0xae4b('0xe2')]({'plain':!![]});fs[_0xae4b('0xe3')](_0x2e7c98);return BPromise[_0xae4b('0xe4')](_0x92710[_0xae4b('0xe0')],function(_0x3701cd,_0x287b32){var _0x4c5038={'from':_0x3701cd[_0xae4b('0x50')],'to':_0x3701cd['to'],'subject':_0x3701cd[_0xae4b('0xe5')],'html':_0x3701cd[_0xae4b('0xc8')],'headers':{'Date':moment(_0x3701cd[_0xae4b('0x7b')])[_0xae4b('0xce')](_0xae4b('0xe6'))},'attachments':[]};if(_0x3701cd['cc']){_0x4c5038[_0xae4b('0xe7')]['Cc']=_0x3701cd['cc'];}if(_0x3701cd[_0xae4b('0xe1')]){_0x4c5038['headers'][_0xae4b('0xe8')]=_0x3701cd['bcc'];}return new BPromise(function(_0x5ae8cd,_0x1cddd2){if(_0x3701cd[_0xae4b('0xe9')]){for(var _0x40cd72=0x0;_0x40cd72<_0x3701cd[_0xae4b('0xe9')][_0xae4b('0x6a')];_0x40cd72++){var _0x2f1b1a=_0x3701cd[_0xae4b('0xe9')][_0x40cd72];var _0x21dfba=path[_0xae4b('0xd9')](_0x446374,_0x2f1b1a['basename']);if(fs[_0xae4b('0xea')](_0x21dfba)){_0x4c5038[_0xae4b('0xde')]['push']({'name':_0x2f1b1a[_0xae4b('0x2f')],'contentType':_0x2f1b1a[_0xae4b('0x3f')],'data':fs[_0xae4b('0xeb')](_0x21dfba)});}}}emlformat['build'](_0x4c5038,function(_0x3b0a96,_0x2f7920){if(_0x3b0a96)return _0x1cddd2(_0x3b0a96);fs[_0xae4b('0xec')](path[_0xae4b('0xd9')](_0x2e7c98,util[_0xae4b('0xce')]('message%d.eml',_0x287b32)),_0x2f7920);return _0x5ae8cd(_0x2f7920);});});})[_0xae4b('0x2b')](function(){return new BPromise(function(_0x39bf04,_0x53fd4d){zipdir(_0x2e7c98,{'saveTo':_0x5bfd78},function(_0x3e8860,_0x5e2d9e){if(_0x3e8860)return _0x53fd4d(_0x3e8860);return _0x39bf04(_0x5e2d9e);});})[_0xae4b('0x2b')](function(){return new BPromise(function(_0x69a49b,_0x332812){rimraf(_0x2e7c98,function(_0x1142e2){if(_0x1142e2)_0x332812(_0x1142e2);return _0x69a49b();});});})[_0xae4b('0x2b')](function(){return _0x36f2a1[_0xae4b('0xd7')](_0x5bfd78,_0x299f4d,function(_0x15e1c1){if(_0x15e1c1){console[_0xae4b('0xed')](_0xae4b('0xee'),_0x15e1c1);}else{fs[_0xae4b('0xef')](_0x5bfd78);}});});});}else{return _0x36f2a1[_0xae4b('0x2c')](0xc8);}})[_0xae4b('0x3a')](handleError(_0x36f2a1,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index 2d383d9..6a951e7 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 _0xdc82=['remove','getUsers','then','setDataValue','Users','map','findAll','length','emit','catch','hook','events','../../mysqldb','MailMessage','setMaxListeners'];(function(_0x275234,_0x4f76bb){var _0xdaa7ec=function(_0x118dce){while(--_0x118dce){_0x275234['push'](_0x275234['shift']());}};_0xdaa7ec(++_0x4f76bb);}(_0xdc82,0x92));var _0x2dc8=function(_0x2b0535,_0x11c348){_0x2b0535=_0x2b0535-0x0;var _0x20c879=_0xdc82[_0x2b0535];return _0x20c879;};'use strict';var EventEmitter=require(_0x2dc8('0x0'));var MailInteraction=require('../../mysqldb')['db']['MailInteraction'];var MailMessage=require(_0x2dc8('0x1'))['db'][_0x2dc8('0x2')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x2dc8('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x2dc8('0x4')};function emitEvent(_0x7b76cb){return function(_0x32fdce,_0x121ae3,_0x89c13e){_0x32fdce[_0x2dc8('0x5')]({'attributes':['id'],'raw':!![]})[_0x2dc8('0x6')](function(_0x291111){_0x32fdce[_0x2dc8('0x7')](_0x2dc8('0x8'),_0x291111[_0x2dc8('0x9')](function(_0x167216){return{'id':_0x167216['id']};}));return MailMessage[_0x2dc8('0xa')]({'where':{'MailInteractionId':_0x32fdce['id'],'direction':'in','read':![]},'raw':!![]});})[_0x2dc8('0x6')](function(_0x5a25ce){_0x32fdce[_0x2dc8('0x7')]('unreadMessages',_0x5a25ce[_0x2dc8('0xb')]);MailInteractionEvents['emit'](_0x7b76cb+':'+_0x32fdce['id'],_0x32fdce);MailInteractionEvents[_0x2dc8('0xc')](_0x7b76cb,_0x32fdce);_0x89c13e(null);})[_0x2dc8('0xd')](_0x89c13e(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailInteraction[_0x2dc8('0xe')](e,emitEvent(event));}}module['exports']=MailInteractionEvents; \ No newline at end of file +var _0xae79=['findAll','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','MailInteraction','MailMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','map'];(function(_0x3c9d39,_0x1122ce){var _0x554663=function(_0x4816e){while(--_0x4816e){_0x3c9d39['push'](_0x3c9d39['shift']());}};_0x554663(++_0x1122ce);}(_0xae79,0x1d3));var _0x9ae7=function(_0xe58e1d,_0x52541d){_0xe58e1d=_0xe58e1d-0x0;var _0x38d5d2=_0xae79[_0xe58e1d];return _0x38d5d2;};'use strict';var EventEmitter=require(_0x9ae7('0x0'));var MailInteraction=require(_0x9ae7('0x1'))['db'][_0x9ae7('0x2')];var MailMessage=require(_0x9ae7('0x1'))['db'][_0x9ae7('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x9ae7('0x4')](0x0);var events={'afterCreate':_0x9ae7('0x5'),'afterUpdate':_0x9ae7('0x6'),'afterDestroy':_0x9ae7('0x7')};function emitEvent(_0x27817e){return function(_0x3bb7d0,_0x26eec0,_0x3e98cf){_0x3bb7d0[_0x9ae7('0x8')]({'attributes':['id'],'raw':!![]})[_0x9ae7('0x9')](function(_0x57114d){_0x3bb7d0[_0x9ae7('0xa')](_0x9ae7('0xb'),_0x57114d[_0x9ae7('0xc')](function(_0x113cab){return{'id':_0x113cab['id']};}));return MailMessage[_0x9ae7('0xd')]({'where':{'MailInteractionId':_0x3bb7d0['id'],'direction':'in','read':![]},'raw':!![]});})[_0x9ae7('0x9')](function(_0x5c1107){_0x3bb7d0[_0x9ae7('0xa')]('unreadMessages',_0x5c1107[_0x9ae7('0xe')]);MailInteractionEvents[_0x9ae7('0xf')](_0x27817e+':'+_0x3bb7d0['id'],_0x3bb7d0);MailInteractionEvents[_0x9ae7('0xf')](_0x27817e,_0x3bb7d0);_0x3e98cf(null);})[_0x9ae7('0x10')](_0x3e98cf(null));};}for(var e in events){if(events[_0x9ae7('0x11')](e)){var event=events[e];MailInteraction[_0x9ae7('0x12')](e,emitEvent(event));}}module[_0x9ae7('0x13')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index c2bb80b..68acd2a 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 _0x3fb9=['FULLTEXT','substatusAt','YYYY-MM-DD\x20HH:mm:ss','closedAt','substatus','changed','closed','format','models','get','MailMessage','update','then','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailInteraction.attributes','exports','MailInteraction','mail_interactions','fti_mail_interactions','subject'];(function(_0x543f6e,_0x4b9a28){var _0x164323=function(_0x4017a5){while(--_0x4017a5){_0x543f6e['push'](_0x543f6e['shift']());}};_0x164323(++_0x4b9a28);}(_0x3fb9,0x1c1));var _0x93fb=function(_0x321b71,_0x5b5237){_0x321b71=_0x321b71-0x0;var _0x533f13=_0x3fb9[_0x321b71];return _0x533f13;};'use strict';var _=require(_0x93fb('0x0'));var util=require('util');var logger=require(_0x93fb('0x1'))(_0x93fb('0x2'));var moment=require(_0x93fb('0x3'));var BPromise=require(_0x93fb('0x4'));var rp=require(_0x93fb('0x5'));var fs=require('fs');var path=require(_0x93fb('0x6'));var rimraf=require(_0x93fb('0x7'));var config=require(_0x93fb('0x8'));var attributes=require(_0x93fb('0x9'));module[_0x93fb('0xa')]=function(_0x2f56e4,_0x23cf8d){return _0x2f56e4['define'](_0x93fb('0xb'),attributes,{'tableName':_0x93fb('0xc'),'paranoid':![],'indexes':[{'name':_0x93fb('0xd'),'fields':[_0x93fb('0xe'),'to'],'type':_0x93fb('0xf')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x3ced51,_0x14c232,_0x52812d){if(_0x3ced51['substatus']){_0x3ced51[_0x93fb('0x10')]=moment()['format'](_0x93fb('0x11'));}if(_0x3ced51['closed']){_0x3ced51[_0x93fb('0x12')]=moment()['format'](_0x93fb('0x11'));}_0x52812d(null,_0x14c232);},'beforeUpdate':function(_0x38db0b,_0x1f5409,_0x5261d1){if(_0x38db0b['changed'](_0x93fb('0x13'))){_0x38db0b['substatusAt']=_0x38db0b[_0x93fb('0x13')]?moment()['format'](_0x93fb('0x11')):null;}if(_0x38db0b[_0x93fb('0x14')](_0x93fb('0x15'))){_0x38db0b[_0x93fb('0x12')]=moment()[_0x93fb('0x16')](_0x93fb('0x11'));_0x38db0b[_0x93fb('0x13')]=null;_0x38db0b[_0x93fb('0x10')]=null;}_0x5261d1(null,_0x38db0b);},'afterUpdate':function(_0x5e4cdd,_0x2e810f,_0x534795){var _0x182dc6=_0x2f56e4[_0x93fb('0x17')];var _0x148128=_0x5e4cdd[_0x93fb('0x18')]({'plain':!![]});if(_0x148128['closed']){return _0x182dc6[_0x93fb('0x19')][_0x93fb('0x1a')]({'read':!![]},{'where':{'MailInteractionId':_0x148128['id']}})[_0x93fb('0x1b')](function(){_0x534795();})['catch'](function(_0x11fe0b){_0x534795(_0x11fe0b);});}else{_0x534795();}}},'charset':'utf8mb4','collate':_0x93fb('0x1c')});}; \ No newline at end of file +var _0x7ad0=['define','MailInteraction','mail_interactions','fti_mail_interactions','subject','substatus','substatusAt','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','changed','format','models','get','MailMessage','update','then','catch','util','api','bluebird','path','../../config/environment','./mailInteraction.attributes','exports'];(function(_0x8d7e11,_0x529294){var _0x1d2c3b=function(_0x20863e){while(--_0x20863e){_0x8d7e11['push'](_0x8d7e11['shift']());}};_0x1d2c3b(++_0x529294);}(_0x7ad0,0xf3));var _0x07ad=function(_0x419f92,_0x3486d6){_0x419f92=_0x419f92-0x0;var _0x28b5ca=_0x7ad0[_0x419f92];return _0x28b5ca;};'use strict';var _=require('lodash');var util=require(_0x07ad('0x0'));var logger=require('../../config/logger')(_0x07ad('0x1'));var moment=require('moment');var BPromise=require(_0x07ad('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x07ad('0x3'));var rimraf=require('rimraf');var config=require(_0x07ad('0x4'));var attributes=require(_0x07ad('0x5'));module[_0x07ad('0x6')]=function(_0x3beeb7,_0x22f54a){return _0x3beeb7[_0x07ad('0x7')](_0x07ad('0x8'),attributes,{'tableName':_0x07ad('0x9'),'paranoid':![],'indexes':[{'name':_0x07ad('0xa'),'fields':[_0x07ad('0xb'),'to'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x701f5d,_0x261714,_0x1c1108){if(_0x701f5d[_0x07ad('0xc')]){_0x701f5d[_0x07ad('0xd')]=moment()['format'](_0x07ad('0xe'));}if(_0x701f5d[_0x07ad('0xf')]){_0x701f5d[_0x07ad('0x10')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x1c1108(null,_0x261714);},'beforeUpdate':function(_0x175a72,_0x256655,_0x4d97aa){if(_0x175a72[_0x07ad('0x11')](_0x07ad('0xc'))){_0x175a72[_0x07ad('0xd')]=_0x175a72[_0x07ad('0xc')]?moment()[_0x07ad('0x12')](_0x07ad('0xe')):null;}if(_0x175a72[_0x07ad('0x11')]('closed')){_0x175a72[_0x07ad('0x10')]=moment()[_0x07ad('0x12')]('YYYY-MM-DD\x20HH:mm:ss');_0x175a72[_0x07ad('0xc')]=null;_0x175a72['substatusAt']=null;}_0x4d97aa(null,_0x175a72);},'afterUpdate':function(_0x581482,_0x34e645,_0x376b6d){var _0x24bd78=_0x3beeb7[_0x07ad('0x13')];var _0x3f677f=_0x581482[_0x07ad('0x14')]({'plain':!![]});if(_0x3f677f[_0x07ad('0xf')]){return _0x24bd78[_0x07ad('0x15')][_0x07ad('0x16')]({'read':!![]},{'where':{'MailInteractionId':_0x3f677f['id']}})[_0x07ad('0x17')](function(){_0x376b6d();})[_0x07ad('0x18')](function(_0x2f8d82){_0x376b6d(_0x2f8d82);});}else{_0x376b6d();}}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index b285a9c..552f904 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 _0xf771=['MailInteraction','update','body','options','where','catch','find','then','addTags','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./mailInteraction.socket','register','request','info','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','UpdateMailInteraction'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xf771,0x8e));var _0x1f77=function(_0x339671,_0x406ea2){_0x339671=_0x339671-0x0;var _0x14f217=_0xf771[_0x339671];return _0x14f217;};'use strict';var _=require(_0x1f77('0x0'));var util=require(_0x1f77('0x1'));var moment=require(_0x1f77('0x2'));var BPromise=require(_0x1f77('0x3'));var rs=require(_0x1f77('0x4'));var fs=require('fs');var Redis=require(_0x1f77('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x1f77('0x6'));var logger=require(_0x1f77('0x7'))(_0x1f77('0x8'));var config=require(_0x1f77('0x9'));var jayson=require(_0x1f77('0xa'));var client=jayson[_0x1f77('0xb')][_0x1f77('0xc')]({'port':0x232a});config['redis']=_[_0x1f77('0xd')](config[_0x1f77('0xe')],{'host':_0x1f77('0xf'),'port':0x18eb});var socket=require(_0x1f77('0x10'))(new Redis(config['redis']));require(_0x1f77('0x11'))[_0x1f77('0x12')](socket);function respondWithRpcPromise(_0x125770,_0x113226,_0x49390d){return new BPromise(function(_0x373194,_0x99cd85){return client[_0x1f77('0x13')](_0x125770,_0x49390d)['then'](function(_0x2caeff){logger[_0x1f77('0x14')](_0x1f77('0x15'),_0x113226,_0x1f77('0x16'));logger[_0x1f77('0x17')](_0x1f77('0x18'),_0x113226,_0x1f77('0x16'),JSON[_0x1f77('0x19')](_0x2caeff));if(_0x2caeff[_0x1f77('0x1a')]){if(_0x2caeff[_0x1f77('0x1a')][_0x1f77('0x1b')]===0x1f4){logger[_0x1f77('0x1a')](_0x1f77('0x15'),_0x113226,_0x2caeff[_0x1f77('0x1a')][_0x1f77('0x1c')]);return _0x99cd85(_0x2caeff[_0x1f77('0x1a')][_0x1f77('0x1c')]);}logger['error']('MailInteraction,\x20%s,\x20%s',_0x113226,_0x2caeff['error']['message']);return _0x373194(_0x2caeff[_0x1f77('0x1a')][_0x1f77('0x1c')]);}else{logger[_0x1f77('0x14')]('MailInteraction,\x20%s,\x20%s',_0x113226,_0x1f77('0x16'));_0x373194(_0x2caeff['result'][_0x1f77('0x1c')]);}})['catch'](function(_0x11fae4){logger['error']('MailInteraction,\x20%s,\x20%s',_0x113226,_0x11fae4);_0x99cd85(_0x11fae4);});});}exports[_0x1f77('0x1d')]=function(_0x20af35){var _0x26431b=this;return new Promise(function(_0x1ab59c,_0x566ba4){return db[_0x1f77('0x1e')][_0x1f77('0x1f')](_0x20af35[_0x1f77('0x20')],{'raw':_0x20af35['options']?_0x20af35[_0x1f77('0x21')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x20af35[_0x1f77('0x21')]?_0x20af35['options'][_0x1f77('0x22')]||null:null,'attributes':_0x20af35[_0x1f77('0x21')]?_0x20af35[_0x1f77('0x21')]['attributes']||null:null,'limit':_0x20af35[_0x1f77('0x21')]?_0x20af35[_0x1f77('0x21')]['limit']||null:null})['then'](function(_0x59dfeb){logger['info']('UpdateMailInteraction',_0x20af35);logger[_0x1f77('0x17')]('UpdateMailInteraction',_0x20af35,JSON[_0x1f77('0x19')](_0x59dfeb));_0x1ab59c(_0x59dfeb);})[_0x1f77('0x23')](function(_0x4d3163){logger['error'](_0x1f77('0x1d'),_0x4d3163['message'],_0x20af35);_0x566ba4(_0x26431b[_0x1f77('0x1a')](0x1f4,_0x4d3163[_0x1f77('0x1c')]));});});};exports['AddTagsToMailInteraction']=function(_0x3ac302){return new Promise(function(_0x8d7d25,_0x29268){return db[_0x1f77('0x1e')][_0x1f77('0x24')]({'where':_0x3ac302[_0x1f77('0x21')]?_0x3ac302[_0x1f77('0x21')][_0x1f77('0x22')]||null:null})[_0x1f77('0x25')](function(_0x5a0b24){if(_0x5a0b24){return _0x5a0b24[_0x1f77('0x26')](_0x3ac302[_0x1f77('0x20')][_0x1f77('0x27')],_[_0x1f77('0x28')](_0x3ac302[_0x1f77('0x20')],[_0x1f77('0x27'),'id'])||{});}})[_0x1f77('0x29')](function(_0x256d2e){logger['info']('AddTags',_0x3ac302);logger[_0x1f77('0x17')](_0x1f77('0x2a'),_0x3ac302,JSON[_0x1f77('0x19')](_0x256d2e));_0x8d7d25(_0x256d2e);})[_0x1f77('0x23')](function(_0x36f3ab){logger['error']('AddTags',_0x36f3ab[_0x1f77('0x1c')],_0x3ac302);_0x29268(_this['error'](0x1f4,_0x36f3ab['message']));});});}; \ No newline at end of file +var _0xc48d=['message','result','UpdateMailInteraction','MailInteraction','update','options','raw','where','attributes','limit','debug','catch','AddTagsToMailInteraction','addTags','body','ids','spread','AddTags','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./mailInteraction.socket','register','request','then','info','request\x20sent','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','MailInteraction,\x20%s,\x20%s'];(function(_0x21cf8b,_0x197eef){var _0x3c329a=function(_0x588424){while(--_0x588424){_0x21cf8b['push'](_0x21cf8b['shift']());}};_0x3c329a(++_0x197eef);}(_0xc48d,0x11a));var _0xdc48=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0xc48d[_0x1ddedd];return _0xa3e1ac;};'use strict';var _=require(_0xdc48('0x0'));var util=require(_0xdc48('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xdc48('0x2'));var fs=require('fs');var Redis=require(_0xdc48('0x3'));var db=require(_0xdc48('0x4'))['db'];var utils=require(_0xdc48('0x5'));var logger=require(_0xdc48('0x6'))(_0xdc48('0x7'));var config=require(_0xdc48('0x8'));var jayson=require(_0xdc48('0x9'));var client=jayson[_0xdc48('0xa')][_0xdc48('0xb')]({'port':0x232a});config[_0xdc48('0xc')]=_[_0xdc48('0xd')](config[_0xdc48('0xc')],{'host':_0xdc48('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xdc48('0xc')]));require(_0xdc48('0xf'))[_0xdc48('0x10')](socket);function respondWithRpcPromise(_0x31c527,_0x404756,_0x27dd28){return new BPromise(function(_0xfb6101,_0x327146){return client[_0xdc48('0x11')](_0x31c527,_0x27dd28)[_0xdc48('0x12')](function(_0xa225bd){logger[_0xdc48('0x13')]('MailInteraction,\x20%s,\x20%s',_0x404756,_0xdc48('0x14'));logger['debug'](_0xdc48('0x15'),_0x404756,'request\x20sent',JSON[_0xdc48('0x16')](_0xa225bd));if(_0xa225bd[_0xdc48('0x17')]){if(_0xa225bd[_0xdc48('0x17')][_0xdc48('0x18')]===0x1f4){logger['error'](_0xdc48('0x19'),_0x404756,_0xa225bd[_0xdc48('0x17')][_0xdc48('0x1a')]);return _0x327146(_0xa225bd[_0xdc48('0x17')][_0xdc48('0x1a')]);}logger[_0xdc48('0x17')](_0xdc48('0x19'),_0x404756,_0xa225bd[_0xdc48('0x17')][_0xdc48('0x1a')]);return _0xfb6101(_0xa225bd[_0xdc48('0x17')][_0xdc48('0x1a')]);}else{logger[_0xdc48('0x13')](_0xdc48('0x19'),_0x404756,_0xdc48('0x14'));_0xfb6101(_0xa225bd[_0xdc48('0x1b')]['message']);}})['catch'](function(_0x5a3747){logger[_0xdc48('0x17')]('MailInteraction,\x20%s,\x20%s',_0x404756,_0x5a3747);_0x327146(_0x5a3747);});});}exports[_0xdc48('0x1c')]=function(_0x504d24){var _0x35c20c=this;return new Promise(function(_0x3e77c3,_0x77bd0c){return db[_0xdc48('0x1d')][_0xdc48('0x1e')](_0x504d24['body'],{'raw':_0x504d24[_0xdc48('0x1f')]?_0x504d24[_0xdc48('0x1f')][_0xdc48('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x504d24[_0xdc48('0x1f')]?_0x504d24[_0xdc48('0x1f')][_0xdc48('0x21')]||null:null,'attributes':_0x504d24[_0xdc48('0x1f')]?_0x504d24[_0xdc48('0x1f')][_0xdc48('0x22')]||null:null,'limit':_0x504d24[_0xdc48('0x1f')]?_0x504d24[_0xdc48('0x1f')][_0xdc48('0x23')]||null:null})[_0xdc48('0x12')](function(_0x59b4ee){logger[_0xdc48('0x13')](_0xdc48('0x1c'),_0x504d24);logger[_0xdc48('0x24')](_0xdc48('0x1c'),_0x504d24,JSON[_0xdc48('0x16')](_0x59b4ee));_0x3e77c3(_0x59b4ee);})[_0xdc48('0x25')](function(_0x56ac16){logger[_0xdc48('0x17')](_0xdc48('0x1c'),_0x56ac16[_0xdc48('0x1a')],_0x504d24);_0x77bd0c(_0x35c20c['error'](0x1f4,_0x56ac16['message']));});});};exports[_0xdc48('0x26')]=function(_0x2912e2){return new Promise(function(_0x3c8003,_0x22a5e5){return db[_0xdc48('0x1d')]['find']({'where':_0x2912e2[_0xdc48('0x1f')]?_0x2912e2[_0xdc48('0x1f')]['where']||null:null})[_0xdc48('0x12')](function(_0x12d8ce){if(_0x12d8ce){return _0x12d8ce[_0xdc48('0x27')](_0x2912e2[_0xdc48('0x28')][_0xdc48('0x29')],_['omit'](_0x2912e2[_0xdc48('0x28')],[_0xdc48('0x29'),'id'])||{});}})[_0xdc48('0x2a')](function(_0xaacc14){logger['info']('AddTags',_0x2912e2);logger[_0xdc48('0x24')](_0xdc48('0x2b'),_0x2912e2,JSON['stringify'](_0xaacc14));_0x3c8003(_0xaacc14);})[_0xdc48('0x25')](function(_0x56f967){logger[_0xdc48('0x17')]('AddTags',_0x56f967[_0xdc48('0x1a')],_0x2912e2);_0x22a5e5(_this['error'](0x1f4,_0x56f967[_0xdc48('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index 335dc97..b9fcd08 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 _0x1a62=['./mailInteraction.events','save','remove','update','emit','removeListener','length','mailInteraction:'];(function(_0x19eebc,_0xf43aa1){var _0x40665a=function(_0x4777ca){while(--_0x4777ca){_0x19eebc['push'](_0x19eebc['shift']());}};_0x40665a(++_0xf43aa1);}(_0x1a62,0x80));var _0x21a6=function(_0x573463,_0x2e16f6){_0x573463=_0x573463-0x0;var _0x5ad700=_0x1a62[_0x573463];return _0x5ad700;};'use strict';var MailInteractionEvents=require(_0x21a6('0x0'));var events=[_0x21a6('0x1'),_0x21a6('0x2'),_0x21a6('0x3')];function createListener(_0x47ad54,_0x2d2a25){return function(_0x165030){_0x2d2a25[_0x21a6('0x4')](_0x47ad54,_0x165030);};}function removeListener(_0x149af7,_0x2058d3){return function(){MailInteractionEvents[_0x21a6('0x5')](_0x149af7,_0x2058d3);};}exports['register']=function(_0x319057){for(var _0x269d1b=0x0,_0x336f5c=events[_0x21a6('0x6')];_0x269d1b<_0x336f5c;_0x269d1b++){var _0xd8d96f=events[_0x269d1b];var _0x3b2cec=createListener(_0x21a6('0x7')+_0xd8d96f,_0x319057);MailInteractionEvents['on'](_0xd8d96f,_0x3b2cec);}}; \ No newline at end of file +var _0xcf37=['./mailInteraction.events','save','remove','update','emit','register','length'];(function(_0x387777,_0x356171){var _0x3f84c0=function(_0x4d4423){while(--_0x4d4423){_0x387777['push'](_0x387777['shift']());}};_0x3f84c0(++_0x356171);}(_0xcf37,0xbd));var _0x7cf3=function(_0x579777,_0x394d32){_0x579777=_0x579777-0x0;var _0xba81dc=_0xcf37[_0x579777];return _0xba81dc;};'use strict';var MailInteractionEvents=require(_0x7cf3('0x0'));var events=[_0x7cf3('0x1'),_0x7cf3('0x2'),_0x7cf3('0x3')];function createListener(_0x14de97,_0xf6038d){return function(_0x31fd66){_0xf6038d[_0x7cf3('0x4')](_0x14de97,_0x31fd66);};}function removeListener(_0x1f9093,_0x24815f){return function(){MailInteractionEvents['removeListener'](_0x1f9093,_0x24815f);};}exports[_0x7cf3('0x5')]=function(_0x314a33){for(var _0x1923c5=0x0,_0x2e002d=events[_0x7cf3('0x6')];_0x1923c5<_0x2e002d;_0x1923c5++){var _0x5110d4=events[_0x1923c5];var _0x199376=createListener('mailInteraction:'+_0x5110d4,_0x314a33);MailInteractionEvents['on'](_0x5110d4,_0x199376);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index a4727d3..9f3c2d4 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 _0x261b=['exports','multer','util','fs-extra','../../components/interaction/service','./mailMessage.controller','isAuthenticated','index','get','/describe','describe','/:id','/:id/download','download','post','create','put','update','accept','/:id/reject','reject','delete','destroy'];(function(_0x486653,_0xde1723){var _0x36b98d=function(_0x3d84e6){while(--_0x3d84e6){_0x486653['push'](_0x486653['shift']());}};_0x36b98d(++_0xde1723);}(_0x261b,0x15a));var _0xb261=function(_0x446c18,_0x2eae0f){_0x446c18=_0x446c18-0x0;var _0x50672e=_0x261b[_0x446c18];return _0x50672e;};'use strict';var multer=require(_0xb261('0x0'));var util=require(_0xb261('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xb261('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0xb261('0x3'));var config=require('../../config/environment');var controller=require(_0xb261('0x4'));router['get']('/',auth[_0xb261('0x5')](),controller[_0xb261('0x6')]);router[_0xb261('0x7')](_0xb261('0x8'),auth['isAuthenticated'](),controller[_0xb261('0x9')]);router[_0xb261('0x7')](_0xb261('0xa'),auth[_0xb261('0x5')](),controller['show']);router[_0xb261('0x7')](_0xb261('0xb'),auth[_0xb261('0x5')](),controller[_0xb261('0xc')]);router[_0xb261('0xd')]('/',auth[_0xb261('0x5')](),interaction['tracked']('mail','mailmessage:create'),controller[_0xb261('0xe')]);router[_0xb261('0xf')](_0xb261('0xa'),auth[_0xb261('0x5')](),controller[_0xb261('0x10')]);router[_0xb261('0xf')]('/:id/accept',auth['isAuthenticated'](),controller[_0xb261('0x11')]);router[_0xb261('0xf')](_0xb261('0x12'),auth[_0xb261('0x5')](),controller[_0xb261('0x13')]);router[_0xb261('0x14')](_0xb261('0xa'),auth[_0xb261('0x5')](),controller[_0xb261('0x15')]);module[_0xb261('0x16')]=router; \ No newline at end of file +var _0x97a8=['/:id','show','/:id/download','download','post','put','update','/:id/accept','accept','/:id/reject','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./mailMessage.controller','/describe','isAuthenticated','describe','get'];(function(_0x260478,_0x2040a1){var _0x4048fb=function(_0x49b513){while(--_0x49b513){_0x260478['push'](_0x260478['shift']());}};_0x4048fb(++_0x2040a1);}(_0x97a8,0xe3));var _0x897a=function(_0x8510d5,_0x2b2928){_0x8510d5=_0x8510d5-0x0;var _0x3b4b5d=_0x97a8[_0x8510d5];return _0x3b4b5d;};'use strict';var multer=require('multer');var util=require(_0x897a('0x0'));var path=require(_0x897a('0x1'));var timeout=require(_0x897a('0x2'));var express=require(_0x897a('0x3'));var router=express[_0x897a('0x4')]();var fs_extra=require(_0x897a('0x5'));var auth=require(_0x897a('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x897a('0x7'));var controller=require(_0x897a('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x897a('0x9'),auth[_0x897a('0xa')](),controller[_0x897a('0xb')]);router[_0x897a('0xc')](_0x897a('0xd'),auth['isAuthenticated'](),controller[_0x897a('0xe')]);router[_0x897a('0xc')](_0x897a('0xf'),auth[_0x897a('0xa')](),controller[_0x897a('0x10')]);router[_0x897a('0x11')]('/',auth[_0x897a('0xa')](),interaction['tracked']('mail','mailmessage:create'),controller['create']);router[_0x897a('0x12')]('/:id',auth[_0x897a('0xa')](),controller[_0x897a('0x13')]);router[_0x897a('0x12')](_0x897a('0x14'),auth['isAuthenticated'](),controller[_0x897a('0x15')]);router[_0x897a('0x12')](_0x897a('0x16'),auth[_0x897a('0xa')](),controller['reject']);router['delete'](_0x897a('0xd'),auth[_0x897a('0xa')](),controller['destroy']);module[_0x897a('0x17')]=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index 3dd4466..9a32c70 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 _0x722d=['medium','BOOLEAN','ENUM','out','STRING','Email','Chat','sequelize','exports','TEXT','long'];(function(_0x328454,_0x2b4186){var _0x22ec98=function(_0x2c9d3b){while(--_0x2c9d3b){_0x328454['push'](_0x328454['shift']());}};_0x22ec98(++_0x2b4186);}(_0x722d,0xa1));var _0xd722=function(_0x22fb75,_0x14674b){_0x22fb75=_0x22fb75-0x0;var _0x4572e8=_0x722d[_0x22fb75];return _0x4572e8;};'use strict';var Sequelize=require(_0xd722('0x0'));var _=require('lodash');module[_0xd722('0x1')]={'body':{'type':Sequelize[_0xd722('0x2')](_0xd722('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize[_0xd722('0x2')](_0xd722('0x4'))},'read':{'type':Sequelize[_0xd722('0x5')],'defaultValue':![]},'direction':{'type':Sequelize[_0xd722('0x6')]('in','out'),'defaultValue':_0xd722('0x7'),'allowNull':![]},'messageId':{'type':Sequelize[_0xd722('0x8')](0x1fe)},'from':{'type':Sequelize[_0xd722('0x8')]},'to':{'type':Sequelize[_0xd722('0x2')](_0xd722('0x3'))},'cc':{'type':Sequelize['TEXT'](_0xd722('0x3'))},'bcc':{'type':Sequelize[_0xd722('0x2')](_0xd722('0x3'))},'subject':{'type':Sequelize[_0xd722('0x2')]},'sentAt':{'type':Sequelize['DATE']},'attach':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'readAt':{'type':Sequelize['DATE']},'originTo':{'type':Sequelize[_0xd722('0x2')]('long')},'originCc':{'type':Sequelize[_0xd722('0x2')](_0xd722('0x3'))},'originChannel':{'type':Sequelize[_0xd722('0x6')](_0xd722('0x9'),_0xd722('0xa')),'defaultValue':_0xd722('0x9'),'allowNull':![]}}; \ No newline at end of file +var _0x599e=['INTEGER','Email','exports','TEXT','long','medium','ENUM','STRING','DATE'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0x599e,0xa4));var _0xe599=function(_0x5b2a03,_0x31b5ac){_0x5b2a03=_0x5b2a03-0x0;var _0x12a2a4=_0x599e[_0x5b2a03];return _0x12a2a4;};'use strict';var Sequelize=require('sequelize');var _=require('lodash');module[_0xe599('0x0')]={'body':{'type':Sequelize[_0xe599('0x1')](_0xe599('0x2')),'allowNull':![]},'plainBody':{'type':Sequelize[_0xe599('0x1')](_0xe599('0x3'))},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xe599('0x4')]('in','out'),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0xe599('0x5')](0x1fe)},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize['TEXT'](_0xe599('0x2'))},'cc':{'type':Sequelize[_0xe599('0x1')](_0xe599('0x2'))},'bcc':{'type':Sequelize[_0xe599('0x1')]('long')},'subject':{'type':Sequelize[_0xe599('0x1')]},'sentAt':{'type':Sequelize[_0xe599('0x6')]},'attach':{'type':Sequelize[_0xe599('0x7')],'defaultValue':0x0},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'readAt':{'type':Sequelize[_0xe599('0x6')]},'originTo':{'type':Sequelize[_0xe599('0x1')](_0xe599('0x2'))},'originCc':{'type':Sequelize[_0xe599('0x1')]('long')},'originChannel':{'type':Sequelize['ENUM'](_0xe599('0x8'),'Chat'),'defaultValue':_0xe599('0x8'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index 01f6966..34c71d2 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 _0xe788=['pass','attachments','length','join','root','basename','ListId','List\x20not\x20found','SendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','mail-interactions','accept','mail','read','readAt','UserId','Contact','get','MailInteraction','read1stAt','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','AcceptMessage','startsWith','cf_','push','ContactId','sequelize','Sequelize','SELECT','contact','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','../../config/logger','reject','agent','MailInteractionId','role','RejectMessage','rejectmessage','download','toString','files','server','message-%s.eml','from','bcc','subject','createdAt','headers','Bcc','Attachments','existsSync','build','writeFileSync','log','err','unlinkSync','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','defaults','redis','localhost','socket.io-emitter','register','jayson/promise','client','http','then','info','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','MailMessage,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','undefined','limit','offset','count','Content-Range','apply','save','update','destroy','stack','name','send','index','map','MailMessage','rawAttributes','type','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','keys','options','body','find','describe','create','direction','out','split','CmList','List','CmContact','Contacts','DESC','MailServerOut','Smtp','isNil','service','host','port','secure','authentication','auth','user'];(function(_0x468d07,_0x1ab22a){var _0x290d82=function(_0x2cdfc1){while(--_0x2cdfc1){_0x468d07['push'](_0x468d07['shift']());}};_0x290d82(++_0x1ab22a);}(_0xe788,0x19e));var _0x8e78=function(_0x12bafa,_0x280b2e){_0x12bafa=_0x12bafa-0x0;var _0x1744d5=_0xe788[_0x12bafa];return _0x1744d5;};'use strict';var emlformat=require(_0x8e78('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8e78('0x1'));var jsonpatch=require(_0x8e78('0x2'));var rp=require(_0x8e78('0x3'));var moment=require(_0x8e78('0x4'));var BPromise=require(_0x8e78('0x5'));var Mustache=require(_0x8e78('0x6'));var util=require(_0x8e78('0x7'));var path=require(_0x8e78('0x8'));var sox=require(_0x8e78('0x9'));var csv=require(_0x8e78('0xa'));var ejs=require(_0x8e78('0xb'));var fs=require('fs');var fs_extra=require(_0x8e78('0xc'));var _=require(_0x8e78('0xd'));var squel=require('squel');var crypto=require(_0x8e78('0xe'));var jsforce=require(_0x8e78('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x8e78('0xa'));var querystring=require(_0x8e78('0x10'));var Papa=require(_0x8e78('0x11'));var Redis=require(_0x8e78('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x8e78('0x13'));var hardwareService=require(_0x8e78('0x14'));var logger=require('../../config/logger')(_0x8e78('0x15'));var utils=require(_0x8e78('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x8e78('0x17'))['db'];config['redis']=_[_0x8e78('0x18')](config[_0x8e78('0x19')],{'host':_0x8e78('0x1a'),'port':0x18eb});var socket=require(_0x8e78('0x1b'))(new Redis(config[_0x8e78('0x19')]));require('./mailMessage.socket')[_0x8e78('0x1c')](socket);var jayson=require(_0x8e78('0x1d'));var client=jayson[_0x8e78('0x1e')][_0x8e78('0x1f')]({'port':0x232c});var client9003=jayson[_0x8e78('0x1e')][_0x8e78('0x1f')]({'port':0x232b});var client9002=jayson[_0x8e78('0x1e')][_0x8e78('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x5bb711,_0x2a47dd,_0x5a0cc7,_0x119f53){return new BPromise(function(_0x4551d9,_0x50c34b){var _0xdac02b=_0x119f53||client;return _0xdac02b['request'](_0x5bb711,_0x5a0cc7)[_0x8e78('0x20')](function(_0x49d3e0){logger[_0x8e78('0x21')]('MailMessage,\x20%s,\x20%s',_0x2a47dd,_0x8e78('0x22'));logger[_0x8e78('0x23')](_0x8e78('0x24'),_0x2a47dd,'request\x20sent',JSON[_0x8e78('0x25')](_0x49d3e0));if(_0x49d3e0[_0x8e78('0x26')]){if(_0x49d3e0[_0x8e78('0x26')]['code']===0x1f4){logger[_0x8e78('0x26')](_0x8e78('0x27'),_0x2a47dd,_0x49d3e0[_0x8e78('0x26')]['message']);return _0x50c34b(_0x49d3e0['error']['message']);}logger[_0x8e78('0x26')]('MailMessage,\x20%s,\x20%s',_0x2a47dd,_0x49d3e0[_0x8e78('0x26')]['message']);return _0x4551d9(_0x49d3e0[_0x8e78('0x26')][_0x8e78('0x28')]);}else{logger[_0x8e78('0x21')]('MailMessage,\x20%s,\x20%s',_0x2a47dd,'request\x20sent');_0x4551d9(_0x49d3e0[_0x8e78('0x29')][_0x8e78('0x28')]);}})[_0x8e78('0x2a')](function(_0x38875c){logger[_0x8e78('0x26')]('MailMessage,\x20%s,\x20%s',_0x2a47dd,_0x38875c);_0x50c34b(_0x38875c);});});}function respondWithStatusCode(_0x155bdb,_0x136d61){_0x136d61=_0x136d61||0xcc;return function(_0xfde07c){if(_0xfde07c){return _0x155bdb[_0x8e78('0x2b')](_0x136d61);}return _0x155bdb[_0x8e78('0x2c')](_0x136d61)[_0x8e78('0x2d')]();};}function respondWithResult(_0x1aafc7,_0x4f38ed){_0x4f38ed=_0x4f38ed||0xc8;return function(_0x3bbf5a){if(_0x3bbf5a){return _0x1aafc7['status'](_0x4f38ed)[_0x8e78('0x2e')](_0x3bbf5a);}};}function respondWithFilteredResult(_0x4a1bf6,_0x2e8fa2){return function(_0x57d2e3){if(_0x57d2e3){var _0x1c5ba8=typeof _0x2e8fa2['offset']===_0x8e78('0x2f')&&typeof _0x2e8fa2[_0x8e78('0x30')]===_0x8e78('0x2f');var _0x28a5be=_0x57d2e3['count'];var _0x2a1629=_0x1c5ba8?0x0:_0x2e8fa2[_0x8e78('0x31')];var _0x2a8dc0=_0x1c5ba8?_0x57d2e3[_0x8e78('0x32')]:_0x2e8fa2[_0x8e78('0x31')]+_0x2e8fa2[_0x8e78('0x30')];var _0x3098f3;if(_0x2a8dc0>=_0x28a5be){_0x2a8dc0=_0x28a5be;_0x3098f3=0xc8;}else{_0x3098f3=0xce;}_0x4a1bf6[_0x8e78('0x2c')](_0x3098f3);return _0x4a1bf6['set'](_0x8e78('0x33'),_0x2a1629+'-'+_0x2a8dc0+'/'+_0x28a5be)[_0x8e78('0x2e')](_0x57d2e3);}return null;};}function patchUpdates(_0x6480c4){return function(_0x1f244f){try{jsonpatch[_0x8e78('0x34')](_0x1f244f,_0x6480c4,!![]);}catch(_0x3b694){return BPromise['reject'](_0x3b694);}return _0x1f244f[_0x8e78('0x35')]();};}function saveUpdates(_0xb9c625,_0x35f2e1){return function(_0x1fabe5){if(_0x1fabe5){return _0x1fabe5[_0x8e78('0x36')](_0xb9c625)[_0x8e78('0x20')](function(_0x4626a3){return _0x4626a3;});}return null;};}function removeEntity(_0x2273af,_0xa386d9){return function(_0x516011){if(_0x516011){return _0x516011[_0x8e78('0x37')]()[_0x8e78('0x20')](function(){_0x2273af[_0x8e78('0x2c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3ad125,_0x552775){return function(_0x15efe5){if(!_0x15efe5){_0x3ad125['sendStatus'](0x194);}return _0x15efe5;};}function handleError(_0x18b888,_0x714096){_0x714096=_0x714096||0x1f4;return function(_0x4fa33b){logger[_0x8e78('0x26')](_0x4fa33b[_0x8e78('0x38')]);if(_0x4fa33b[_0x8e78('0x39')]){delete _0x4fa33b['name'];}_0x18b888[_0x8e78('0x2c')](_0x714096)[_0x8e78('0x3a')](_0x4fa33b);};}exports[_0x8e78('0x3b')]=function(_0x91f232,_0x407d2f){var _0x323105={},_0x580933={},_0x12326e={'count':0x0,'rows':[]};var _0x272e08=_[_0x8e78('0x3c')](db[_0x8e78('0x3d')][_0x8e78('0x3e')],function(_0x2f83ce){return{'name':_0x2f83ce['fieldName'],'type':_0x2f83ce[_0x8e78('0x3f')]['key']};});_0x580933[_0x8e78('0x40')]=_[_0x8e78('0x3c')](_0x272e08,_0x8e78('0x39'));_0x580933[_0x8e78('0x41')]=_['keys'](_0x91f232[_0x8e78('0x41')]);_0x580933[_0x8e78('0x42')]=_[_0x8e78('0x43')](_0x580933[_0x8e78('0x40')],_0x580933[_0x8e78('0x41')]);_0x323105[_0x8e78('0x44')]=_[_0x8e78('0x43')](_0x580933[_0x8e78('0x40')],qs[_0x8e78('0x45')](_0x91f232[_0x8e78('0x41')][_0x8e78('0x45')]));_0x323105['attributes']=_0x323105[_0x8e78('0x44')]['length']?_0x323105['attributes']:_0x580933[_0x8e78('0x40')];if(!_0x91f232['query'][_0x8e78('0x46')](_0x8e78('0x47'))){_0x323105[_0x8e78('0x30')]=qs[_0x8e78('0x30')](_0x91f232[_0x8e78('0x41')][_0x8e78('0x30')]);_0x323105[_0x8e78('0x31')]=qs[_0x8e78('0x31')](_0x91f232[_0x8e78('0x41')]['offset']);}_0x323105[_0x8e78('0x48')]=qs[_0x8e78('0x49')](_0x91f232[_0x8e78('0x41')]['sort']);_0x323105[_0x8e78('0x4a')]=qs[_0x8e78('0x42')](_['pick'](_0x91f232[_0x8e78('0x41')],_0x580933[_0x8e78('0x42')]),_0x272e08);if(_0x91f232['query'][_0x8e78('0x4b')]){_0x323105[_0x8e78('0x4a')]=_[_0x8e78('0x4c')](_0x323105[_0x8e78('0x4a')],{'$or':_['map'](_0x272e08,function(_0x51459e){if(_0x51459e[_0x8e78('0x3f')]!==_0x8e78('0x4d')){var _0x31bf8c={};_0x31bf8c[_0x51459e[_0x8e78('0x39')]]={'$like':'%'+_0x91f232[_0x8e78('0x41')][_0x8e78('0x4b')]+'%'};return _0x31bf8c;}})});}_0x323105=_[_0x8e78('0x4c')]({},_0x323105,_0x91f232['options']);var _0x191dbe={'where':_0x323105[_0x8e78('0x4a')]};return db[_0x8e78('0x3d')][_0x8e78('0x32')](_0x191dbe)[_0x8e78('0x20')](function(_0x1dc94b){_0x12326e[_0x8e78('0x32')]=_0x1dc94b;if(_0x91f232['query'][_0x8e78('0x4e')]){_0x323105[_0x8e78('0x4f')]=[{'all':!![]}];}return db[_0x8e78('0x3d')][_0x8e78('0x50')](_0x323105);})['then'](function(_0x28af82){_0x12326e[_0x8e78('0x51')]=_0x28af82;return _0x12326e;})['then'](respondWithFilteredResult(_0x407d2f,_0x323105))[_0x8e78('0x2a')](handleError(_0x407d2f,null));};exports[_0x8e78('0x52')]=function(_0x20eea0,_0x3ca60c){var _0x294b45={'raw':!![],'where':{'id':_0x20eea0[_0x8e78('0x53')]['id']}},_0x124a7b={};_0x124a7b[_0x8e78('0x40')]=_['keys'](db['MailMessage'][_0x8e78('0x3e')]);_0x124a7b[_0x8e78('0x41')]=_[_0x8e78('0x54')](_0x20eea0[_0x8e78('0x41')]);_0x124a7b[_0x8e78('0x42')]=_[_0x8e78('0x43')](_0x124a7b['model'],_0x124a7b[_0x8e78('0x41')]);_0x294b45[_0x8e78('0x44')]=_[_0x8e78('0x43')](_0x124a7b[_0x8e78('0x40')],qs[_0x8e78('0x45')](_0x20eea0[_0x8e78('0x41')]['fields']));_0x294b45[_0x8e78('0x44')]=_0x294b45['attributes']['length']?_0x294b45['attributes']:_0x124a7b[_0x8e78('0x40')];if(_0x20eea0[_0x8e78('0x41')][_0x8e78('0x4e')]){_0x294b45[_0x8e78('0x4f')]=[{'all':!![]}];}_0x294b45=_[_0x8e78('0x4c')]({},_0x294b45,_0x20eea0[_0x8e78('0x55')]);return db['MailMessage']['find'](_0x294b45)[_0x8e78('0x20')](handleEntityNotFound(_0x3ca60c,null))[_0x8e78('0x20')](respondWithResult(_0x3ca60c,null))[_0x8e78('0x2a')](handleError(_0x3ca60c,null));};exports['update']=function(_0x3606ee,_0x50c73c){if(_0x3606ee[_0x8e78('0x56')]['id']){delete _0x3606ee[_0x8e78('0x56')]['id'];}return db[_0x8e78('0x3d')][_0x8e78('0x57')]({'where':{'id':_0x3606ee[_0x8e78('0x53')]['id']}})['then'](handleEntityNotFound(_0x50c73c,null))[_0x8e78('0x20')](saveUpdates(_0x3606ee[_0x8e78('0x56')],null))[_0x8e78('0x20')](respondWithResult(_0x50c73c,null))[_0x8e78('0x2a')](handleError(_0x50c73c,null));};exports['destroy']=function(_0x5c6c61,_0x16050c){return db['MailMessage'][_0x8e78('0x57')]({'where':{'id':_0x5c6c61[_0x8e78('0x53')]['id']}})[_0x8e78('0x20')](handleEntityNotFound(_0x16050c,null))[_0x8e78('0x20')](removeEntity(_0x16050c,null))['catch'](handleError(_0x16050c,null));};exports['describe']=function(_0x589b0d,_0x522e4d){return db['MailMessage'][_0x8e78('0x58')]()[_0x8e78('0x20')](respondWithResult(_0x522e4d,null))[_0x8e78('0x2a')](handleError(_0x522e4d,null));};exports[_0x8e78('0x59')]=function(_0x28c3ba,_0x4a0f26){return db['MailMessage'][_0x8e78('0x59')](_0x28c3ba[_0x8e78('0x56')])[_0x8e78('0x20')](function(_0x8b79c4){if(_0x8b79c4){if(_0x8b79c4[_0x8e78('0x5a')]===_0x8e78('0x5b')&&!_0x8b79c4['secret']){var _0x5e68ad,_0x34e92a,_0x44a37b;if(_0x28c3ba[_0x8e78('0x56')]['to']){_0x34e92a=_0x28c3ba['body']['to'][_0x8e78('0x5c')](',')[0x0];}return db['MailAccount']['findOne']({'where':{'id':_0x8b79c4['MailAccountId']},'include':[{'model':db[_0x8e78('0x5d')],'as':_0x8e78('0x5e'),'include':[{'model':db[_0x8e78('0x5f')],'as':_0x8e78('0x60'),'where':{'email':_0x34e92a},'limit':0x1,'order':[['updatedAt',_0x8e78('0x61')]]}]},{'model':db[_0x8e78('0x62')],'as':_0x8e78('0x63'),'raw':!![]}]})['then'](function(_0x582696){_0x5e68ad=_0x582696;if(_0x5e68ad&&_0x5e68ad[_0x8e78('0x63')]){var _0x504cd2={'tls':{'rejectUnauthorized':![]}};if(_[_0x8e78('0x64')](_0x5e68ad['Smtp'][_0x8e78('0x65')])){_0x504cd2['host']=_0x5e68ad['Smtp'][_0x8e78('0x66')];_0x504cd2['port']=_0x5e68ad['Smtp'][_0x8e78('0x67')];_0x504cd2[_0x8e78('0x68')]=_0x5e68ad[_0x8e78('0x63')][_0x8e78('0x68')];if(_0x5e68ad[_0x8e78('0x63')][_0x8e78('0x69')]){_0x504cd2[_0x8e78('0x6a')]={'user':_0x5e68ad[_0x8e78('0x63')][_0x8e78('0x6b')],'pass':_0x5e68ad[_0x8e78('0x63')]['pass']};}}else{_0x504cd2[_0x8e78('0x65')]=_0x5e68ad[_0x8e78('0x63')][_0x8e78('0x65')];_0x504cd2[_0x8e78('0x6a')]={'user':_0x5e68ad[_0x8e78('0x63')]['user'],'pass':_0x5e68ad[_0x8e78('0x63')][_0x8e78('0x6c')]};_0x504cd2[_0x8e78('0x68')]=_0x5e68ad[_0x8e78('0x63')][_0x8e78('0x68')];}if(_0x28c3ba[_0x8e78('0x56')][_0x8e78('0x6d')]&&_0x28c3ba[_0x8e78('0x56')]['attachments'][_0x8e78('0x6e')]){for(var _0x3bed81=0x0;_0x3bed81<_0x28c3ba[_0x8e78('0x56')][_0x8e78('0x6d')][_0x8e78('0x6e')];_0x3bed81+=0x1){_0x28c3ba[_0x8e78('0x56')]['attachments'][_0x3bed81]={'filename':_0x28c3ba[_0x8e78('0x56')]['attachments'][_0x3bed81]['name'],'path':path[_0x8e78('0x6f')](config[_0x8e78('0x70')],'server/files/attachments',_0x28c3ba[_0x8e78('0x56')]['attachments'][_0x3bed81][_0x8e78('0x71')])};}}_0x44a37b={'account':_0x504cd2,'message':_0x28c3ba[_0x8e78('0x56')]};return;}})[_0x8e78('0x20')](function(){if(_0x5e68ad['List']){if(_0x5e68ad[_0x8e78('0x5e')][_0x8e78('0x60')][_0x8e78('0x6e')]){return _0x5e68ad['List']['Contacts'][0x0];}else{return db['CmContact'][_0x8e78('0x59')](_[_0x8e78('0x18')](_0x28c3ba[_0x8e78('0x56')],{'firstName':_0x28c3ba[_0x8e78('0x56')]['to'],'email':_0x28c3ba[_0x8e78('0x56')]['to'],'phone':_0x28c3ba['body']['to'],'ListId':_0x5e68ad[_0x8e78('0x72')]}));}}else{throw new Error(_0x8e78('0x73'));}})[_0x8e78('0x20')](function(){if(_0x44a37b){return respondWithRpcPromise(_0x8e78('0x74'),'sendMail',_0x44a37b,client9003)[_0x8e78('0x20')](function(_0x5a5866){return _0x8b79c4[_0x8e78('0x36')]({'read':!![],'messageId':_0x5a5866[_0x8e78('0x75')],'sentAt':moment()[_0x8e78('0x76')](_0x8e78('0x77'))});})[_0x8e78('0x2a')](function(_0x95d495){logger['error']('%s',JSON[_0x8e78('0x25')](_0x95d495));return _0x8b79c4;});}return _0x8b79c4;});}return _0x8b79c4;}})[_0x8e78('0x20')](respondWithResult(_0x4a0f26,0xc9))[_0x8e78('0x2a')](handleError(_0x4a0f26,null));};var interaction_log=require('../../config/logger')(_0x8e78('0x78'));exports[_0x8e78('0x79')]=function(_0x1d5ca9,_0x1c2aa8,_0x20e82f){var _0x3f72ad={'agent':{},'channel':_0x8e78('0x7a')};if(_0x1d5ca9['body']['id']){delete _0x1d5ca9[_0x8e78('0x56')]['id'];}_0x1d5ca9['body'][_0x8e78('0x7b')]=!![];_0x1d5ca9[_0x8e78('0x56')][_0x8e78('0x7c')]=moment()[_0x8e78('0x76')]('YYYY-MM-DD\x20HH:mm:ss');_0x1d5ca9[_0x8e78('0x56')][_0x8e78('0x7d')]=_0x1d5ca9[_0x8e78('0x56')][_0x8e78('0x7d')]||_0x1d5ca9['user']['id'];_0x3f72ad['agent']['id']=_0x1d5ca9[_0x8e78('0x56')][_0x8e78('0x7d')];return db[_0x8e78('0x3d')][_0x8e78('0x57')]({'where':{'id':_0x1d5ca9[_0x8e78('0x53')]['id'],'UserId':null},'include':[{'model':db[_0x8e78('0x5f')],'as':_0x8e78('0x7e')}]})[_0x8e78('0x20')](handleEntityNotFound(_0x1c2aa8,null))[_0x8e78('0x20')](saveUpdates(_0x1d5ca9[_0x8e78('0x56')],null))['then'](function(_0x3af43){if(_0x3af43){_0x3f72ad[_0x8e78('0x28')]=_0x3af43[_0x8e78('0x7f')]({'plain':!![]});return db[_0x8e78('0x80')]['find']({'where':{'id':_0x3af43['MailInteractionId']}});}return null;})[_0x8e78('0x20')](handleEntityNotFound(_0x1c2aa8,null))[_0x8e78('0x20')](function(_0x5956a2){if(_0x5956a2){return _0x5956a2[_0x8e78('0x36')]({'UserId':_0x1d5ca9[_0x8e78('0x56')][_0x8e78('0x7d')],'read1stAt':_[_0x8e78('0x64')](_0x5956a2[_0x8e78('0x81')])?moment()[_0x8e78('0x76')](_0x8e78('0x77')):undefined});}return null;})['then'](function(_0x48714c){if(_0x48714c){_0x3f72ad[_0x8e78('0x82')]=_0x48714c[_0x8e78('0x7f')]({'plain':!![]});interaction_log[_0x8e78('0x21')](_0x8e78('0x83'),_0x1d5ca9[_0x8e78('0x6b')]['id'],_0x1d5ca9[_0x8e78('0x6b')][_0x8e78('0x39')],_0x1d5ca9['user']['role'],_0x3f72ad[_0x8e78('0x82')]['id'],_0x1d5ca9[_0x8e78('0x56')]?JSON[_0x8e78('0x25')](_0x1d5ca9['body']):_0x8e78('0x84'));return respondWithRpcPromise(_0x8e78('0x85'),'acceptMessage',_0x3f72ad);}return null;})[_0x8e78('0x20')](function(_0x555966){return db[_0x8e78('0x5f')][_0x8e78('0x58')]()[_0x8e78('0x20')](function(_0x4f27da){var _0x461d1a=[];for(var _0x23a529=0x0;_0x23a529=_0x10c18b){_0x1bfe0c=_0x10c18b;_0x56a57a=0xc8;}else{_0x56a57a=0xce;}_0x953fc3[_0x8060('0x2c')](_0x56a57a);return _0x953fc3[_0x8060('0x33')](_0x8060('0x34'),_0x5dbc91+'-'+_0x1bfe0c+'/'+_0x10c18b)['json'](_0x28f99c);}return null;};}function patchUpdates(_0x16988b){return function(_0x39b0b0){try{jsonpatch[_0x8060('0x35')](_0x39b0b0,_0x16988b,!![]);}catch(_0x3b46f3){return BPromise[_0x8060('0x36')](_0x3b46f3);}return _0x39b0b0[_0x8060('0x37')]();};}function saveUpdates(_0x1ab89e,_0x279aba){return function(_0x33c410){if(_0x33c410){return _0x33c410['update'](_0x1ab89e)[_0x8060('0x21')](function(_0x10336){return _0x10336;});}return null;};}function removeEntity(_0x3ddc12,_0x546a5e){return function(_0x50c929){if(_0x50c929){return _0x50c929[_0x8060('0x38')]()[_0x8060('0x21')](function(){_0x3ddc12[_0x8060('0x2c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x14f152,_0x30f76f){return function(_0x1ab170){if(!_0x1ab170){_0x14f152[_0x8060('0x39')](0x194);}return _0x1ab170;};}function handleError(_0x3a2e21,_0x318176){_0x318176=_0x318176||0x1f4;return function(_0x4e2371){logger[_0x8060('0x26')](_0x4e2371[_0x8060('0x3a')]);if(_0x4e2371['name']){delete _0x4e2371['name'];}_0x3a2e21['status'](_0x318176)[_0x8060('0x3b')](_0x4e2371);};}exports[_0x8060('0x3c')]=function(_0xe76916,_0x211429){var _0x5b4d85={},_0x58be47={},_0x3eb07b={'count':0x0,'rows':[]};var _0x1cd947=_[_0x8060('0x3d')](db[_0x8060('0x3e')]['rawAttributes'],function(_0x18ce63){return{'name':_0x18ce63['fieldName'],'type':_0x18ce63[_0x8060('0x3f')]['key']};});_0x58be47['model']=_[_0x8060('0x3d')](_0x1cd947,_0x8060('0x40'));_0x58be47[_0x8060('0x41')]=_[_0x8060('0x42')](_0xe76916[_0x8060('0x41')]);_0x58be47['filters']=_[_0x8060('0x43')](_0x58be47[_0x8060('0x44')],_0x58be47[_0x8060('0x41')]);_0x5b4d85[_0x8060('0x45')]=_[_0x8060('0x43')](_0x58be47[_0x8060('0x44')],qs['fields'](_0xe76916[_0x8060('0x41')]['fields']));_0x5b4d85[_0x8060('0x45')]=_0x5b4d85[_0x8060('0x45')][_0x8060('0x46')]?_0x5b4d85[_0x8060('0x45')]:_0x58be47['model'];if(!_0xe76916[_0x8060('0x41')][_0x8060('0x47')](_0x8060('0x48'))){_0x5b4d85[_0x8060('0x31')]=qs[_0x8060('0x31')](_0xe76916[_0x8060('0x41')][_0x8060('0x31')]);_0x5b4d85['offset']=qs[_0x8060('0x2f')](_0xe76916['query']['offset']);}_0x5b4d85[_0x8060('0x49')]=qs[_0x8060('0x4a')](_0xe76916['query'][_0x8060('0x4a')]);_0x5b4d85[_0x8060('0x4b')]=qs['filters'](_[_0x8060('0x4c')](_0xe76916[_0x8060('0x41')],_0x58be47['filters']),_0x1cd947);if(_0xe76916[_0x8060('0x41')][_0x8060('0x4d')]){_0x5b4d85['where']=_[_0x8060('0x4e')](_0x5b4d85['where'],{'$or':_[_0x8060('0x3d')](_0x1cd947,function(_0x155e59){if(_0x155e59[_0x8060('0x3f')]!==_0x8060('0x4f')){var _0x4ed123={};_0x4ed123[_0x155e59['name']]={'$like':'%'+_0xe76916[_0x8060('0x41')][_0x8060('0x4d')]+'%'};return _0x4ed123;}})});}_0x5b4d85=_[_0x8060('0x4e')]({},_0x5b4d85,_0xe76916[_0x8060('0x50')]);var _0xeeb750={'where':_0x5b4d85[_0x8060('0x4b')]};return db[_0x8060('0x3e')][_0x8060('0x32')](_0xeeb750)['then'](function(_0x2f12a6){_0x3eb07b[_0x8060('0x32')]=_0x2f12a6;if(_0xe76916['query'][_0x8060('0x51')]){_0x5b4d85[_0x8060('0x52')]=[{'all':!![]}];}return db[_0x8060('0x3e')]['findAll'](_0x5b4d85);})[_0x8060('0x21')](function(_0x30aff7){_0x3eb07b['rows']=_0x30aff7;return _0x3eb07b;})[_0x8060('0x21')](respondWithFilteredResult(_0x211429,_0x5b4d85))[_0x8060('0x2b')](handleError(_0x211429,null));};exports[_0x8060('0x53')]=function(_0xe32257,_0x3ddfa9){var _0x380e64={'raw':!![],'where':{'id':_0xe32257[_0x8060('0x54')]['id']}},_0x9941d1={};_0x9941d1[_0x8060('0x44')]=_[_0x8060('0x42')](db['MailMessage']['rawAttributes']);_0x9941d1['query']=_[_0x8060('0x42')](_0xe32257[_0x8060('0x41')]);_0x9941d1[_0x8060('0x55')]=_[_0x8060('0x43')](_0x9941d1[_0x8060('0x44')],_0x9941d1[_0x8060('0x41')]);_0x380e64[_0x8060('0x45')]=_[_0x8060('0x43')](_0x9941d1[_0x8060('0x44')],qs[_0x8060('0x56')](_0xe32257['query'][_0x8060('0x56')]));_0x380e64[_0x8060('0x45')]=_0x380e64['attributes'][_0x8060('0x46')]?_0x380e64[_0x8060('0x45')]:_0x9941d1[_0x8060('0x44')];if(_0xe32257['query'][_0x8060('0x51')]){_0x380e64['include']=[{'all':!![]}];}_0x380e64=_[_0x8060('0x4e')]({},_0x380e64,_0xe32257[_0x8060('0x50')]);return db[_0x8060('0x3e')][_0x8060('0x57')](_0x380e64)[_0x8060('0x21')](handleEntityNotFound(_0x3ddfa9,null))['then'](respondWithResult(_0x3ddfa9,null))[_0x8060('0x2b')](handleError(_0x3ddfa9,null));};exports[_0x8060('0x58')]=function(_0x5690ef,_0x5694c1){if(_0x5690ef[_0x8060('0x59')]['id']){delete _0x5690ef['body']['id'];}return db[_0x8060('0x3e')][_0x8060('0x57')]({'where':{'id':_0x5690ef[_0x8060('0x54')]['id']}})[_0x8060('0x21')](handleEntityNotFound(_0x5694c1,null))['then'](saveUpdates(_0x5690ef['body'],null))[_0x8060('0x21')](respondWithResult(_0x5694c1,null))[_0x8060('0x2b')](handleError(_0x5694c1,null));};exports['destroy']=function(_0x3256ae,_0x55e5e1){return db[_0x8060('0x3e')][_0x8060('0x57')]({'where':{'id':_0x3256ae['params']['id']}})['then'](handleEntityNotFound(_0x55e5e1,null))[_0x8060('0x21')](removeEntity(_0x55e5e1,null))['catch'](handleError(_0x55e5e1,null));};exports[_0x8060('0x5a')]=function(_0x458be4,_0x28ecb9){return db[_0x8060('0x3e')][_0x8060('0x5a')]()['then'](respondWithResult(_0x28ecb9,null))[_0x8060('0x2b')](handleError(_0x28ecb9,null));};exports[_0x8060('0x5b')]=function(_0x159949,_0x578551){return db['MailMessage'][_0x8060('0x5b')](_0x159949[_0x8060('0x59')])[_0x8060('0x21')](function(_0x2bb040){if(_0x2bb040){if(_0x2bb040['direction']===_0x8060('0x5c')&&!_0x2bb040[_0x8060('0x5d')]){var _0x939f60,_0xd507a6,_0x4f604a;if(_0x159949[_0x8060('0x59')]['to']){_0xd507a6=_0x159949['body']['to'][_0x8060('0x5e')](',')[0x0];}return db[_0x8060('0x5f')][_0x8060('0x60')]({'where':{'id':_0x2bb040[_0x8060('0x61')]},'include':[{'model':db[_0x8060('0x62')],'as':_0x8060('0x63'),'include':[{'model':db[_0x8060('0x64')],'as':'Contacts','where':{'email':_0xd507a6},'limit':0x1,'order':[[_0x8060('0x65'),'DESC']]}]},{'model':db['MailServerOut'],'as':'Smtp','raw':!![]}]})[_0x8060('0x21')](function(_0x4b6d72){_0x939f60=_0x4b6d72;if(_0x939f60&&_0x939f60[_0x8060('0x66')]){var _0x5a0adc={'tls':{'rejectUnauthorized':![]}};if(_[_0x8060('0x67')](_0x939f60['Smtp']['service'])){_0x5a0adc['host']=_0x939f60[_0x8060('0x66')][_0x8060('0x68')];_0x5a0adc[_0x8060('0x69')]=_0x939f60[_0x8060('0x66')][_0x8060('0x69')];_0x5a0adc['secure']=_0x939f60[_0x8060('0x66')][_0x8060('0x6a')];if(_0x939f60[_0x8060('0x66')][_0x8060('0x6b')]){_0x5a0adc['auth']={'user':_0x939f60[_0x8060('0x66')]['user'],'pass':_0x939f60[_0x8060('0x66')][_0x8060('0x6c')]};}}else{_0x5a0adc['service']=_0x939f60[_0x8060('0x66')][_0x8060('0x6d')];_0x5a0adc[_0x8060('0x6e')]={'user':_0x939f60['Smtp'][_0x8060('0x6f')],'pass':_0x939f60['Smtp'][_0x8060('0x6c')]};_0x5a0adc[_0x8060('0x6a')]=_0x939f60[_0x8060('0x66')][_0x8060('0x6a')];}if(_0x159949[_0x8060('0x59')]['attachments']&&_0x159949['body'][_0x8060('0x70')][_0x8060('0x46')]){for(var _0x535685=0x0;_0x535685<_0x159949[_0x8060('0x59')][_0x8060('0x70')]['length'];_0x535685+=0x1){_0x159949[_0x8060('0x59')]['attachments'][_0x535685]={'filename':_0x159949[_0x8060('0x59')][_0x8060('0x70')][_0x535685][_0x8060('0x40')],'path':path[_0x8060('0x71')](config['root'],_0x8060('0x72'),_0x159949[_0x8060('0x59')][_0x8060('0x70')][_0x535685]['basename'])};}}_0x4f604a={'account':_0x5a0adc,'message':_0x159949['body']};return;}})[_0x8060('0x21')](function(){if(_0x939f60['List']){if(_0x939f60['List'][_0x8060('0x73')][_0x8060('0x46')]){return _0x939f60['List']['Contacts'][0x0];}else{return db[_0x8060('0x64')][_0x8060('0x5b')](_['defaults'](_0x159949[_0x8060('0x59')],{'firstName':_0x159949[_0x8060('0x59')]['to'],'email':_0x159949['body']['to'],'phone':_0x159949['body']['to'],'ListId':_0x939f60[_0x8060('0x74')]}));}}else{throw new Error(_0x8060('0x75'));}})[_0x8060('0x21')](function(){if(_0x4f604a){return respondWithRpcPromise(_0x8060('0x76'),_0x8060('0x77'),_0x4f604a,client9003)[_0x8060('0x21')](function(_0x2c98a4){return _0x2bb040[_0x8060('0x58')]({'read':!![],'messageId':_0x2c98a4['messageId'],'sentAt':moment()[_0x8060('0x78')](_0x8060('0x79'))});})['catch'](function(_0x5d2fd2){logger['error']('%s',JSON[_0x8060('0x25')](_0x5d2fd2));return _0x2bb040;});}return _0x2bb040;});}return _0x2bb040;}})[_0x8060('0x21')](respondWithResult(_0x578551,0xc9))[_0x8060('0x2b')](handleError(_0x578551,null));};var interaction_log=require(_0x8060('0x7a'))('mail-interactions');exports[_0x8060('0x7b')]=function(_0x27b3e2,_0x144bb7,_0x44ce0b){var _0x5793b9={'agent':{},'channel':_0x8060('0x7c')};if(_0x27b3e2[_0x8060('0x59')]['id']){delete _0x27b3e2[_0x8060('0x59')]['id'];}_0x27b3e2[_0x8060('0x59')]['read']=!![];_0x27b3e2[_0x8060('0x59')][_0x8060('0x7d')]=moment()[_0x8060('0x78')](_0x8060('0x79'));_0x27b3e2[_0x8060('0x59')][_0x8060('0x7e')]=_0x27b3e2['body'][_0x8060('0x7e')]||_0x27b3e2[_0x8060('0x6f')]['id'];_0x5793b9[_0x8060('0x7f')]['id']=_0x27b3e2[_0x8060('0x59')]['UserId'];return db['MailMessage'][_0x8060('0x57')]({'where':{'id':_0x27b3e2[_0x8060('0x54')]['id'],'UserId':null},'include':[{'model':db[_0x8060('0x64')],'as':'Contact'}]})[_0x8060('0x21')](handleEntityNotFound(_0x144bb7,null))[_0x8060('0x21')](saveUpdates(_0x27b3e2[_0x8060('0x59')],null))['then'](function(_0xc867fa){if(_0xc867fa){_0x5793b9[_0x8060('0x29')]=_0xc867fa[_0x8060('0x80')]({'plain':!![]});return db['MailInteraction'][_0x8060('0x57')]({'where':{'id':_0xc867fa[_0x8060('0x81')]}});}return null;})[_0x8060('0x21')](handleEntityNotFound(_0x144bb7,null))[_0x8060('0x21')](function(_0x5af323){if(_0x5af323){return _0x5af323['update']({'UserId':_0x27b3e2[_0x8060('0x59')][_0x8060('0x7e')],'read1stAt':_[_0x8060('0x67')](_0x5af323[_0x8060('0x82')])?moment()[_0x8060('0x78')](_0x8060('0x79')):undefined});}return null;})[_0x8060('0x21')](function(_0x329b84){if(_0x329b84){_0x5793b9[_0x8060('0x83')]=_0x329b84['get']({'plain':!![]});interaction_log[_0x8060('0x22')]('[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x27b3e2[_0x8060('0x6f')]['id'],_0x27b3e2[_0x8060('0x6f')][_0x8060('0x40')],_0x27b3e2['user']['role'],_0x5793b9[_0x8060('0x83')]['id'],_0x27b3e2['body']?JSON['stringify'](_0x27b3e2['body']):'null');return respondWithRpcPromise('AcceptMessage','acceptMessage',_0x5793b9);}return null;})[_0x8060('0x21')](function(_0x450a9f){return db[_0x8060('0x64')][_0x8060('0x5a')]()['then'](function(_0x5ad302){var _0x2dce34=[];for(var _0x536cc6=0x0;_0x536cc6=_0x1cbd24){_0x474ad0=_0x1cbd24;_0x94b9b0=0xc8;}else{_0x94b9b0=0xce;}_0xd8b065['status'](_0x94b9b0);return _0xd8b065[_0x48f0('0x21')](_0x48f0('0x22'),_0x5806a6+'-'+_0x474ad0+'/'+_0x1cbd24)[_0x48f0('0x1c')](_0x20c690);}return null;};}function patchUpdates(_0x2f5546){return function(_0x3141de){try{jsonpatch[_0x48f0('0x23')](_0x3141de,_0x2f5546,!![]);}catch(_0x430d69){return BPromise['reject'](_0x430d69);}return _0x3141de[_0x48f0('0x24')]();};}function saveUpdates(_0x49ac05,_0x507625){return function(_0x3230e6){if(_0x3230e6){return _0x3230e6['update'](_0x49ac05)[_0x48f0('0x25')](function(_0xfa84ea){return _0xfa84ea;});}return null;};}function removeEntity(_0x56bfc4,_0x5d8d44){return function(_0x5c35a1){if(_0x5c35a1){return _0x5c35a1[_0x48f0('0x26')]()[_0x48f0('0x25')](function(){var _0x5a3fc3=_0x5c35a1[_0x48f0('0x27')]({'plain':!![]});var _0x1b1b00='MailQueues';return db[_0x48f0('0x28')][_0x48f0('0x26')]({'where':{'type':_0x1b1b00,'resourceId':_0x5a3fc3['id']}})['then'](function(){return _0x5c35a1;});})[_0x48f0('0x25')](function(){_0x56bfc4[_0x48f0('0x1a')](0xcc)[_0x48f0('0x1b')]();});}};}function handleEntityNotFound(_0xf6172,_0x40c9d1){return function(_0x20945e){if(!_0x20945e){_0xf6172[_0x48f0('0x29')](0x194);}return _0x20945e;};}function handleError(_0x1b4d93,_0x9e32c2){_0x9e32c2=_0x9e32c2||0x1f4;return function(_0x100176){logger['error'](_0x100176['stack']);if(_0x100176[_0x48f0('0x2a')]){delete _0x100176[_0x48f0('0x2a')];}_0x1b4d93[_0x48f0('0x1a')](_0x9e32c2)[_0x48f0('0x2b')](_0x100176);};}exports['index']=function(_0x40dd8d,_0x1e7b3c){var _0xb235cf={},_0x1c0f07={},_0x4ab254={'count':0x0,'rows':[]};var _0x42f7af=_[_0x48f0('0x2c')](db['MailQueue'][_0x48f0('0x2d')],function(_0x1a3575){return{'name':_0x1a3575[_0x48f0('0x2e')],'type':_0x1a3575[_0x48f0('0x2f')][_0x48f0('0x30')]};});_0x1c0f07[_0x48f0('0x31')]=_[_0x48f0('0x2c')](_0x42f7af,_0x48f0('0x2a'));_0x1c0f07[_0x48f0('0x32')]=_[_0x48f0('0x33')](_0x40dd8d[_0x48f0('0x32')]);_0x1c0f07['filters']=_['intersection'](_0x1c0f07[_0x48f0('0x31')],_0x1c0f07[_0x48f0('0x32')]);_0xb235cf[_0x48f0('0x34')]=_[_0x48f0('0x35')](_0x1c0f07[_0x48f0('0x31')],qs[_0x48f0('0x36')](_0x40dd8d[_0x48f0('0x32')][_0x48f0('0x36')]));_0xb235cf[_0x48f0('0x34')]=_0xb235cf[_0x48f0('0x34')][_0x48f0('0x37')]?_0xb235cf[_0x48f0('0x34')]:_0x1c0f07[_0x48f0('0x31')];if(!_0x40dd8d[_0x48f0('0x32')][_0x48f0('0x38')](_0x48f0('0x39'))){_0xb235cf['limit']=qs[_0x48f0('0x1f')](_0x40dd8d[_0x48f0('0x32')][_0x48f0('0x1f')]);_0xb235cf[_0x48f0('0x1d')]=qs['offset'](_0x40dd8d[_0x48f0('0x32')][_0x48f0('0x1d')]);}_0xb235cf[_0x48f0('0x3a')]=qs[_0x48f0('0x3b')](_0x40dd8d['query'][_0x48f0('0x3b')]);_0xb235cf[_0x48f0('0x3c')]=qs[_0x48f0('0x3d')](_[_0x48f0('0x3e')](_0x40dd8d[_0x48f0('0x32')],_0x1c0f07[_0x48f0('0x3d')]),_0x42f7af);if(_0x40dd8d['query'][_0x48f0('0x3f')]){_0xb235cf[_0x48f0('0x3c')]=_[_0x48f0('0x40')](_0xb235cf[_0x48f0('0x3c')],{'$or':_[_0x48f0('0x2c')](_0x42f7af,function(_0x323a3d){if(_0x323a3d[_0x48f0('0x2f')]!==_0x48f0('0x41')){var _0x3ab083={};_0x3ab083[_0x323a3d[_0x48f0('0x2a')]]={'$like':'%'+_0x40dd8d[_0x48f0('0x32')]['filter']+'%'};return _0x3ab083;}})});}_0xb235cf=_['merge']({},_0xb235cf,_0x40dd8d[_0x48f0('0x42')]);var _0x36943d={'where':_0xb235cf['where']};return db[_0x48f0('0x43')][_0x48f0('0x20')](_0x36943d)[_0x48f0('0x25')](function(_0x32095a){_0x4ab254[_0x48f0('0x20')]=_0x32095a;if(_0x40dd8d['query']['includeAll']){_0xb235cf[_0x48f0('0x44')]=[{'all':!![]}];}return db[_0x48f0('0x43')][_0x48f0('0x45')](_0xb235cf);})[_0x48f0('0x25')](function(_0x15fcf1){_0x4ab254[_0x48f0('0x46')]=_0x15fcf1;return _0x4ab254;})[_0x48f0('0x25')](respondWithFilteredResult(_0x1e7b3c,_0xb235cf))['catch'](handleError(_0x1e7b3c,null));};exports[_0x48f0('0x47')]=function(_0x1aa876,_0x4b2117){var _0x36c871={'raw':!![],'where':{'id':_0x1aa876[_0x48f0('0x48')]['id']}},_0x50291b={};_0x50291b[_0x48f0('0x31')]=_[_0x48f0('0x33')](db[_0x48f0('0x43')][_0x48f0('0x2d')]);_0x50291b['query']=_[_0x48f0('0x33')](_0x1aa876[_0x48f0('0x32')]);_0x50291b[_0x48f0('0x3d')]=_[_0x48f0('0x35')](_0x50291b[_0x48f0('0x31')],_0x50291b[_0x48f0('0x32')]);_0x36c871[_0x48f0('0x34')]=_[_0x48f0('0x35')](_0x50291b['model'],qs[_0x48f0('0x36')](_0x1aa876[_0x48f0('0x32')][_0x48f0('0x36')]));_0x36c871['attributes']=_0x36c871[_0x48f0('0x34')]['length']?_0x36c871['attributes']:_0x50291b[_0x48f0('0x31')];if(_0x1aa876[_0x48f0('0x32')][_0x48f0('0x49')]){_0x36c871['include']=[{'all':!![]}];}_0x36c871=_[_0x48f0('0x40')]({},_0x36c871,_0x1aa876[_0x48f0('0x42')]);return db[_0x48f0('0x43')][_0x48f0('0x4a')](_0x36c871)['then'](handleEntityNotFound(_0x4b2117,null))[_0x48f0('0x25')](respondWithResult(_0x4b2117,null))[_0x48f0('0x4b')](handleError(_0x4b2117,null));};exports['create']=function(_0xa53c24,_0x3b1cd4){return db[_0x48f0('0x43')][_0x48f0('0x4c')](_0xa53c24[_0x48f0('0x4d')],{})[_0x48f0('0x25')](function(_0x26b19e){var _0x335b0c=_0xa53c24[_0x48f0('0x4e')][_0x48f0('0x27')]({'plain':!![]});if(!_0x335b0c)throw new Error(_0x48f0('0x4f'));if(_0x335b0c[_0x48f0('0x50')]==='user'){var _0xaf5f59=_0x26b19e['get']({'plain':!![]});var _0xa081ac=_0x48f0('0x51');return db['UserProfileSection'][_0x48f0('0x4a')]({'where':{'name':_0xa081ac,'userProfileId':_0x335b0c['userProfileId']},'raw':!![]})[_0x48f0('0x25')](function(_0x2ddcbb){if(_0x2ddcbb&&_0x2ddcbb[_0x48f0('0x52')]===0x0){return db[_0x48f0('0x28')][_0x48f0('0x4c')]({'name':_0xaf5f59[_0x48f0('0x2a')],'resourceId':_0xaf5f59['id'],'type':_0x2ddcbb['name'],'sectionId':_0x2ddcbb['id']},{})[_0x48f0('0x25')](function(){return _0x26b19e;});}else{return _0x26b19e;}})[_0x48f0('0x4b')](function(_0x291fd1){logger[_0x48f0('0x53')](_0x48f0('0x54'),_0x291fd1);throw _0x291fd1;});}return _0x26b19e;})['then'](respondWithResult(_0x3b1cd4,0xc9))[_0x48f0('0x4b')](handleError(_0x3b1cd4,null));};exports['update']=function(_0x4b75c2,_0x46f32d){if(_0x4b75c2[_0x48f0('0x4d')]['id']){delete _0x4b75c2['body']['id'];}return db[_0x48f0('0x43')][_0x48f0('0x4a')]({'where':{'id':_0x4b75c2[_0x48f0('0x48')]['id']}})['then'](handleEntityNotFound(_0x46f32d,null))['then'](saveUpdates(_0x4b75c2[_0x48f0('0x4d')],null))[_0x48f0('0x25')](respondWithResult(_0x46f32d,null))['catch'](handleError(_0x46f32d,null));};exports[_0x48f0('0x26')]=function(_0x1265ca,_0x1967e8){return db[_0x48f0('0x43')][_0x48f0('0x4a')]({'where':{'id':_0x1265ca[_0x48f0('0x48')]['id']}})[_0x48f0('0x25')](handleEntityNotFound(_0x1967e8,null))[_0x48f0('0x25')](removeEntity(_0x1967e8,null))['catch'](handleError(_0x1967e8,null));};exports[_0x48f0('0x55')]=function(_0x1152ba,_0x5349bc){return db[_0x48f0('0x43')][_0x48f0('0x55')]()[_0x48f0('0x25')](respondWithResult(_0x5349bc,null))[_0x48f0('0x4b')](handleError(_0x5349bc,null));};exports[_0x48f0('0x56')]=function(_0x49fd13,_0x3f21b4,_0x46204f){var _0x279f2f={'raw':!![],'where':{}},_0x2f313d={},_0x512f2b;return db['MailQueue']['findOne']({'where':{'id':_0x49fd13[_0x48f0('0x48')]['id']}})[_0x48f0('0x25')](handleEntityNotFound(_0x3f21b4,null))[_0x48f0('0x25')](function(_0x4a00e6){if(_0x4a00e6){_0x512f2b=_0x4a00e6[_0x48f0('0x27')]({'plain':!![]});_0x2f313d[_0x48f0('0x31')]=_[_0x48f0('0x33')](db[_0x48f0('0x57')]['rawAttributes']);_0x2f313d[_0x48f0('0x32')]=_[_0x48f0('0x33')](_0x49fd13[_0x48f0('0x32')]);_0x2f313d['filters']=_['intersection'](_0x2f313d['model'],_0x2f313d[_0x48f0('0x32')]);_0x279f2f[_0x48f0('0x34')]=_[_0x48f0('0x35')](_0x2f313d[_0x48f0('0x31')],qs[_0x48f0('0x36')](_0x49fd13['query'][_0x48f0('0x36')]));_0x279f2f[_0x48f0('0x34')]=_0x279f2f[_0x48f0('0x34')]['length']?_0x279f2f[_0x48f0('0x34')]:_0x2f313d['model'];if(!_0x49fd13['query'][_0x48f0('0x38')](_0x48f0('0x39'))){_0x279f2f[_0x48f0('0x1f')]=qs[_0x48f0('0x1f')](_0x49fd13[_0x48f0('0x32')][_0x48f0('0x1f')]);_0x279f2f[_0x48f0('0x1d')]=qs[_0x48f0('0x1d')](_0x49fd13['query']['offset']);}_0x279f2f[_0x48f0('0x3a')]=qs[_0x48f0('0x3b')](_0x49fd13[_0x48f0('0x32')][_0x48f0('0x3b')]);_0x279f2f['where']=qs[_0x48f0('0x3d')](_['pick'](_0x49fd13[_0x48f0('0x32')],_0x2f313d['filters']));_0x279f2f['where'][_0x48f0('0x58')]=_0x4a00e6['id'];if(_0x49fd13[_0x48f0('0x32')][_0x48f0('0x3f')]){_0x279f2f[_0x48f0('0x3c')]=_[_0x48f0('0x40')](_0x279f2f['where'],{'$or':_[_0x48f0('0x2c')](_0x279f2f['attributes'],function(_0x5572fc){var _0x5d5ecd={};_0x5d5ecd[_0x5572fc]={'$like':'%'+_0x49fd13['query'][_0x48f0('0x3f')]+'%'};return _0x5d5ecd;})});}_0x279f2f=_[_0x48f0('0x40')]({},_0x279f2f,_0x49fd13[_0x48f0('0x42')]);return db[_0x48f0('0x57')]['findAll'](_0x279f2f);}})[_0x48f0('0x25')](function(_0x4bec44){if(_0x4bec44){return db[_0x48f0('0x59')][_0x48f0('0x5a')]({'where':{'id':_[_0x48f0('0x2c')](_0x4bec44,'UserId'),'role':_0x48f0('0x5b')},'attributes':['id',_0x48f0('0x2a'),_0x48f0('0x5c'),_0x48f0('0x5d'),_0x48f0('0x5e')]});}})[_0x48f0('0x25')](function(_0x5870dc){if(_0x5870dc){return{'count':_0x5870dc[_0x48f0('0x20')],'rows':_[_0x48f0('0x2c')](_0x5870dc[_0x48f0('0x46')],function(_0x4b7ffa){return{'membername':_0x4b7ffa[_0x48f0('0x2a')],'UserId':_0x4b7ffa['id'],'queue_name':_0x512f2b[_0x48f0('0x2a')],'MailQueueId':_0x512f2b['id'],'interface':util[_0x48f0('0x5f')](_0x48f0('0x60'),_0x48f0('0x61'),_0x4b7ffa[_0x48f0('0x2a')]),'penalty':0x0,'paused':_0x4b7ffa[_0x48f0('0x5c')],'createdAt':_0x4b7ffa['createdAt'],'updatedAt':_0x4b7ffa[_0x48f0('0x5d')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x3f21b4,_0x279f2f))['catch'](handleError(_0x3f21b4,null));};exports['getTeams']=function(_0x477b83,_0x1851bf,_0xaadabf){var _0x25a1ae={};var _0x55fb3d={};var _0x57425e;var _0x532076;return db[_0x48f0('0x43')]['findOne']({'where':{'id':_0x477b83[_0x48f0('0x48')]['id']}})[_0x48f0('0x25')](handleEntityNotFound(_0x1851bf,null))[_0x48f0('0x25')](function(_0x2408e8){if(_0x2408e8){_0x57425e=_0x2408e8;_0x55fb3d[_0x48f0('0x31')]=_[_0x48f0('0x33')](db[_0x48f0('0x62')]['rawAttributes']);_0x55fb3d[_0x48f0('0x32')]=_[_0x48f0('0x33')](_0x477b83['query']);_0x55fb3d[_0x48f0('0x3d')]=_['intersection'](_0x55fb3d['model'],_0x55fb3d[_0x48f0('0x32')]);_0x25a1ae[_0x48f0('0x34')]=_[_0x48f0('0x35')](_0x55fb3d[_0x48f0('0x31')],qs[_0x48f0('0x36')](_0x477b83[_0x48f0('0x32')][_0x48f0('0x36')]));_0x25a1ae[_0x48f0('0x34')]=_0x25a1ae[_0x48f0('0x34')][_0x48f0('0x37')]?_0x25a1ae[_0x48f0('0x34')]:_0x55fb3d[_0x48f0('0x31')];_0x25a1ae[_0x48f0('0x3a')]=qs['sort'](_0x477b83['query']['sort']);_0x25a1ae[_0x48f0('0x3c')]=qs[_0x48f0('0x3d')](_[_0x48f0('0x3e')](_0x477b83[_0x48f0('0x32')],_0x55fb3d[_0x48f0('0x3d')]));if(_0x477b83[_0x48f0('0x32')][_0x48f0('0x3f')]){_0x25a1ae[_0x48f0('0x3c')]=_[_0x48f0('0x40')](_0x25a1ae['where'],{'$or':_['map'](_0x25a1ae[_0x48f0('0x34')],function(_0x343981){var _0x2961a1={};_0x2961a1[_0x343981]={'$like':'%'+_0x477b83[_0x48f0('0x32')][_0x48f0('0x3f')]+'%'};return _0x2961a1;})});}_0x25a1ae=_[_0x48f0('0x40')]({},_0x25a1ae,_0x477b83['options']);return _0x57425e['getTeams'](_0x25a1ae);}})[_0x48f0('0x25')](function(_0x43810f){if(_0x43810f){_0x532076=_0x43810f[_0x48f0('0x37')];if(!_0x477b83[_0x48f0('0x32')][_0x48f0('0x38')]('nolimit')){_0x25a1ae['limit']=qs[_0x48f0('0x1f')](_0x477b83[_0x48f0('0x32')]['limit']);_0x25a1ae[_0x48f0('0x1d')]=qs[_0x48f0('0x1d')](_0x477b83[_0x48f0('0x32')][_0x48f0('0x1d')]);}return _0x57425e['getTeams'](_0x25a1ae);}})[_0x48f0('0x25')](function(_0x249ea0){if(_0x249ea0){return _0x249ea0?{'count':_0x532076,'rows':_0x249ea0}:null;}})[_0x48f0('0x25')](respondWithResult(_0x1851bf,null))['catch'](handleError(_0x1851bf,null));};exports[_0x48f0('0x63')]=function(_0x3d5748,_0x5c4615,_0x20062a){var _0x3bd313=_0x3d5748[_0x48f0('0x4d')][_0x48f0('0x64')];return db[_0x48f0('0x62')][_0x48f0('0x45')]({'where':{'id':_0x3bd313},'attributes':['id'],'include':[{'model':db['User'],'as':_0x48f0('0x65'),'attributes':['id',_0x48f0('0x2a'),_0x48f0('0x66'),_0x48f0('0x67'),_0x48f0('0x68')],'raw':!![]}]})[_0x48f0('0x25')](function(_0x595100){if(_0x595100){var _0x31602d=_[_0x48f0('0x69')](_0x595100,function(_0xab2b50){var _0x16ca33=_0xab2b50[_0x48f0('0x27')]({'plain':!![]});return _0x16ca33[_0x48f0('0x65')];});return db[_0x48f0('0x43')]['find']({'where':{'id':_0x3d5748[_0x48f0('0x48')]['id']}})[_0x48f0('0x25')](function(_0x313095){return db[_0x48f0('0x6a')]['transaction'](function(_0x2426c8){return _0x313095[_0x48f0('0x63')](_0x3bd313,{'transaction':_0x2426c8})['then'](function(){return BPromise[_0x48f0('0x6b')](_0x31602d,function(_0x5b59bc){return db['UserMailQueue']['findOrCreate']({'where':{'UserId':_0x5b59bc['id'],'MailQueueId':_0x3d5748['params']['id']},'transaction':_0x2426c8});});})[_0x48f0('0x25')](function(){_0x31602d[_0x48f0('0x6c')](function(_0x538382){socket[_0x48f0('0x6d')]('userMailQueue:save',{'UserId':_0x538382['id'],'MailQueueId':_0x313095['id']});});});});});}})[_0x48f0('0x25')](respondWithStatusCode(_0x5c4615,null))[_0x48f0('0x4b')](handleError(_0x5c4615,null));};exports[_0x48f0('0x6e')]=function(_0x895e58,_0x49ea7f,_0x41ab76){return db['Team'][_0x48f0('0x45')]({'where':{'id':_0x895e58['query'][_0x48f0('0x64')]},'attributes':['id'],'include':[{'model':db[_0x48f0('0x59')],'as':_0x48f0('0x65'),'attributes':['id'],'raw':!![]}]})[_0x48f0('0x25')](handleEntityNotFound(_0x49ea7f,null))[_0x48f0('0x25')](function(_0x3d6cc2){var _0x3914e2=_[_0x48f0('0x2c')](_0x3d6cc2,'id');var _0x23df8f=[];var _0x38bed9=[];var _0x2a38a7=squel['select']();_0x2a38a7[_0x48f0('0x6f')](_0x48f0('0x70'))['from']('team_has_mail_queues','tq')['join'](_0x48f0('0x71'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x48f0('0x3c')](_0x48f0('0x72'),_0x895e58[_0x48f0('0x48')]['id']);for(var _0x24c65d=0x0;_0x24c65d<_0x3d6cc2[_0x48f0('0x37')];_0x24c65d+=0x1){let _0x54a58c=_0x3d6cc2[_0x24c65d];for(var _0x2b3e97=0x0;_0x2b3e97<_0x54a58c['Agents'][_0x48f0('0x37')];_0x2b3e97+=0x1){let _0x5035f6=_0x54a58c['Agents'][_0x2b3e97];var _0x2c1618=_0x2a38a7['clone']();_0x2c1618[_0x48f0('0x3c')](_0x48f0('0x73'),_0x5035f6['id']);_0x38bed9['push'](db['sequelize'][_0x48f0('0x32')](_0x2c1618['toString'](),{'type':db['sequelize'][_0x48f0('0x74')][_0x48f0('0x75')]})[_0x48f0('0x25')](function(_0x484edd){if(_0x484edd['length']===0x1){return _0x5035f6['id'];}else{var _0x52cd62=_['every'](_[_0x48f0('0x2c')](_0x484edd,_0x48f0('0x76')),function(_0x41b846){return _[_0x48f0('0x77')](_0x3914e2,_0x41b846);});if(_0x52cd62){return _0x5035f6['id'];}}}));}}return BPromise[_0x48f0('0x78')](_0x38bed9)['then'](function(_0x189510){_0x23df8f=_(_0x23df8f)[_0x48f0('0x79')](_0x189510)[_0x48f0('0x7a')]()['value']();return db[_0x48f0('0x43')]['find']({'where':{'id':_0x895e58['params']['id']}})[_0x48f0('0x25')](function(_0x2fcfb9){return db[_0x48f0('0x6a')]['transaction'](function(_0x299913){return _0x2fcfb9[_0x48f0('0x6e')](_0x895e58['query']['ids'],{'transaction':_0x299913})[_0x48f0('0x25')](function(){if(!_[_0x48f0('0x7b')](_0x23df8f)){return _0x2fcfb9['removeAgents'](_0x23df8f,{'transaction':_0x299913});}})[_0x48f0('0x25')](function(){_0x23df8f['forEach'](function(_0x10b9c4){socket[_0x48f0('0x6d')](_0x48f0('0x7c'),{'UserId':_0x10b9c4,'MailQueueId':_0x2fcfb9['id']});});});});});});})[_0x48f0('0x25')](respondWithStatusCode(_0x49ea7f,null))[_0x48f0('0x4b')](handleError(_0x49ea7f,null));};exports[_0x48f0('0x7d')]=function(_0x125975,_0x12b4d0,_0x5c38d9){return db[_0x48f0('0x43')][_0x48f0('0x4a')]({'where':{'id':_0x125975[_0x48f0('0x48')]['id']}})[_0x48f0('0x25')](handleEntityNotFound(_0x12b4d0,null))[_0x48f0('0x25')](function(_0x3def43){if(_0x3def43){return _0x3def43[_0x48f0('0x7d')](_0x125975[_0x48f0('0x4d')][_0x48f0('0x64')],_[_0x48f0('0x7e')](_0x125975[_0x48f0('0x4d')],[_0x48f0('0x64'),'id'])||{})[_0x48f0('0x7f')](function(_0x48cc0d){for(var _0x416c1b=0x0;_0x416c1b<_0x125975[_0x48f0('0x4d')][_0x48f0('0x64')][_0x48f0('0x37')];_0x416c1b+=0x1){socket['emit'](_0x48f0('0x80'),{'UserId':_0x125975[_0x48f0('0x4d')][_0x48f0('0x64')][_0x416c1b],'MailQueueId':_0x125975['params']['id']});}return _0x48cc0d;});}})[_0x48f0('0x25')](respondWithResult(_0x12b4d0,null))['catch'](handleError(_0x12b4d0,null));};exports[_0x48f0('0x81')]=function(_0x55795a,_0x543613,_0xf1dda8){return db[_0x48f0('0x43')][_0x48f0('0x4a')]({'where':{'id':_0x55795a[_0x48f0('0x48')]['id']}})[_0x48f0('0x25')](handleEntityNotFound(_0x543613,null))[_0x48f0('0x25')](function(_0x56880c){if(_0x56880c){return _0x56880c[_0x48f0('0x81')](_0x55795a[_0x48f0('0x32')][_0x48f0('0x64')])['then'](function(){if(_['isArray'](_0x55795a[_0x48f0('0x32')]['ids'])){for(var _0x368e11=0x0;_0x368e11<_0x55795a[_0x48f0('0x32')]['ids'][_0x48f0('0x37')];_0x368e11+=0x1){socket[_0x48f0('0x6d')](_0x48f0('0x7c'),{'UserId':Number(_0x55795a[_0x48f0('0x32')][_0x48f0('0x64')][_0x368e11]),'MailQueueId':Number(_0x55795a[_0x48f0('0x48')]['id'])});}}else{socket['emit'](_0x48f0('0x7c'),{'UserId':Number(_0x55795a[_0x48f0('0x32')][_0x48f0('0x64')]),'MailQueueId':Number(_0x55795a[_0x48f0('0x48')]['id'])});}});}})[_0x48f0('0x25')](respondWithStatusCode(_0x543613,null))['catch'](handleError(_0x543613,null));};exports['getAgents']=function(_0x406438,_0x3fdb67,_0x2f0f6a){var _0x4e20dd={};var _0xd0eb6={};var _0x9621a2;var _0x2aca5b;return db[_0x48f0('0x43')][_0x48f0('0x82')]({'where':{'id':_0x406438[_0x48f0('0x48')]['id']}})[_0x48f0('0x25')](handleEntityNotFound(_0x3fdb67,null))[_0x48f0('0x25')](function(_0x5c9b08){if(_0x5c9b08){_0x9621a2=_0x5c9b08;_0xd0eb6['model']=_[_0x48f0('0x33')](db['User'][_0x48f0('0x2d')]);_0xd0eb6['query']=_[_0x48f0('0x33')](_0x406438[_0x48f0('0x32')]);_0xd0eb6['filters']=_[_0x48f0('0x35')](_0xd0eb6[_0x48f0('0x31')],_0xd0eb6[_0x48f0('0x32')]);_0x4e20dd[_0x48f0('0x34')]=_[_0x48f0('0x35')](_0xd0eb6['model'],qs[_0x48f0('0x36')](_0x406438['query'][_0x48f0('0x36')]));_0x4e20dd[_0x48f0('0x34')]=_0x4e20dd[_0x48f0('0x34')]['length']?_0x4e20dd[_0x48f0('0x34')]:_0xd0eb6[_0x48f0('0x31')];_0x4e20dd[_0x48f0('0x3a')]=qs[_0x48f0('0x3b')](_0x406438[_0x48f0('0x32')]['sort']);_0x4e20dd[_0x48f0('0x3c')]=qs[_0x48f0('0x3d')](_[_0x48f0('0x3e')](_0x406438[_0x48f0('0x32')],_0xd0eb6['filters']));if(_0x406438[_0x48f0('0x32')][_0x48f0('0x3f')]){_0x4e20dd[_0x48f0('0x3c')]=_['merge'](_0x4e20dd['where'],{'$or':_[_0x48f0('0x2c')](_0x4e20dd[_0x48f0('0x34')],function(_0x2f301b){var _0x209ee1={};_0x209ee1[_0x2f301b]={'$like':'%'+_0x406438[_0x48f0('0x32')][_0x48f0('0x3f')]+'%'};return _0x209ee1;})});}_0x4e20dd=_[_0x48f0('0x40')]({},_0x4e20dd,_0x406438[_0x48f0('0x42')]);return _0x9621a2['getAgents'](_0x4e20dd);}})[_0x48f0('0x25')](function(_0xcc5b08){if(_0xcc5b08){_0x2aca5b=_0xcc5b08[_0x48f0('0x37')];if(!_0x406438[_0x48f0('0x32')][_0x48f0('0x38')](_0x48f0('0x39'))){_0x4e20dd['limit']=qs['limit'](_0x406438[_0x48f0('0x32')][_0x48f0('0x1f')]);_0x4e20dd[_0x48f0('0x1d')]=qs[_0x48f0('0x1d')](_0x406438['query']['offset']);}return _0x9621a2['getAgents'](_0x4e20dd);}})[_0x48f0('0x25')](function(_0x39e677){if(_0x39e677){return _0x39e677?{'count':_0x2aca5b,'rows':_0x39e677}:null;}})['then'](respondWithResult(_0x3fdb67,null))['catch'](handleError(_0x3fdb67,null));}; \ No newline at end of file +var _0x792f=['rows','catch','show','params','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','describe','findOne','UserMailQueue','MailQueueId','findAll','User','UserId','agent','mailPause','updatedAt','format','SIP','getTeams','Team','addTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','emit','userMailQueue:save','removeTeams','field','team_has_mail_queues','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','includes','all','union','compact','value','isEmpty','removeAgents','forEach','userMailQueue:remove','addAgents','omit','spread','isArray','getAgents','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','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/license/util','redis','defaults','socket.io-emitter','./mailQueue.socket','register','sendStatus','status','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','get','MailQueues','UserProfileResource','end','error','stack','name','send','map','MailQueue','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','VIRTUAL','filter','merge','options','include'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x792f,0x161));var _0xf792=function(_0x152136,_0x4f14f1){_0x152136=_0x152136-0x0;var _0x20df44=_0x792f[_0x152136];return _0x20df44;};'use strict';var emlformat=require(_0xf792('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf792('0x1'));var jsonpatch=require(_0xf792('0x2'));var rp=require(_0xf792('0x3'));var moment=require(_0xf792('0x4'));var BPromise=require(_0xf792('0x5'));var Mustache=require(_0xf792('0x6'));var util=require(_0xf792('0x7'));var path=require(_0xf792('0x8'));var sox=require(_0xf792('0x9'));var csv=require(_0xf792('0xa'));var ejs=require(_0xf792('0xb'));var fs=require('fs');var fs_extra=require(_0xf792('0xc'));var _=require('lodash');var squel=require(_0xf792('0xd'));var crypto=require(_0xf792('0xe'));var jsforce=require(_0xf792('0xf'));var deskjs=require(_0xf792('0x10'));var toCsv=require('to-csv');var querystring=require(_0xf792('0x11'));var Papa=require('papaparse');var Redis=require(_0xf792('0x12'));var authService=require(_0xf792('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf792('0x14'));var logger=require(_0xf792('0x15'))(_0xf792('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xf792('0x17'));var db=require('../../mysqldb')['db'];config[_0xf792('0x18')]=_[_0xf792('0x19')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xf792('0x1a'))(new Redis(config[_0xf792('0x18')]));require(_0xf792('0x1b'))[_0xf792('0x1c')](socket);function respondWithStatusCode(_0x256596,_0x41af17){_0x41af17=_0x41af17||0xcc;return function(_0xbf39d){if(_0xbf39d){return _0x256596[_0xf792('0x1d')](_0x41af17);}return _0x256596[_0xf792('0x1e')](_0x41af17)['end']();};}function respondWithResult(_0x5d3bcb,_0x574292){_0x574292=_0x574292||0xc8;return function(_0x567293){if(_0x567293){return _0x5d3bcb[_0xf792('0x1e')](_0x574292)[_0xf792('0x1f')](_0x567293);}};}function respondWithFilteredResult(_0x404691,_0x550145){return function(_0x40f67f){if(_0x40f67f){var _0xf032ad=typeof _0x550145[_0xf792('0x20')]===_0xf792('0x21')&&typeof _0x550145['limit']===_0xf792('0x21');var _0x129430=_0x40f67f[_0xf792('0x22')];var _0x4f5838=_0xf032ad?0x0:_0x550145['offset'];var _0xe50a1b=_0xf032ad?_0x40f67f[_0xf792('0x22')]:_0x550145[_0xf792('0x20')]+_0x550145['limit'];var _0x4d0112;if(_0xe50a1b>=_0x129430){_0xe50a1b=_0x129430;_0x4d0112=0xc8;}else{_0x4d0112=0xce;}_0x404691[_0xf792('0x1e')](_0x4d0112);return _0x404691[_0xf792('0x23')](_0xf792('0x24'),_0x4f5838+'-'+_0xe50a1b+'/'+_0x129430)[_0xf792('0x1f')](_0x40f67f);}return null;};}function patchUpdates(_0x3e042a){return function(_0x17ffca){try{jsonpatch[_0xf792('0x25')](_0x17ffca,_0x3e042a,!![]);}catch(_0x51d4b5){return BPromise[_0xf792('0x26')](_0x51d4b5);}return _0x17ffca[_0xf792('0x27')]();};}function saveUpdates(_0xa88927,_0x2485f0){return function(_0x1a5beb){if(_0x1a5beb){return _0x1a5beb[_0xf792('0x28')](_0xa88927)[_0xf792('0x29')](function(_0x3b86f3){return _0x3b86f3;});}return null;};}function removeEntity(_0x15bd3a,_0x3cb2a9){return function(_0x323beb){if(_0x323beb){return _0x323beb[_0xf792('0x2a')]()['then'](function(){var _0x112cc8=_0x323beb[_0xf792('0x2b')]({'plain':!![]});var _0x22b7da=_0xf792('0x2c');return db[_0xf792('0x2d')]['destroy']({'where':{'type':_0x22b7da,'resourceId':_0x112cc8['id']}})[_0xf792('0x29')](function(){return _0x323beb;});})[_0xf792('0x29')](function(){_0x15bd3a[_0xf792('0x1e')](0xcc)[_0xf792('0x2e')]();});}};}function handleEntityNotFound(_0x1a9d3f,_0x301837){return function(_0x20394b){if(!_0x20394b){_0x1a9d3f['sendStatus'](0x194);}return _0x20394b;};}function handleError(_0x45bdb1,_0x373804){_0x373804=_0x373804||0x1f4;return function(_0x4d3e56){logger[_0xf792('0x2f')](_0x4d3e56[_0xf792('0x30')]);if(_0x4d3e56[_0xf792('0x31')]){delete _0x4d3e56['name'];}_0x45bdb1[_0xf792('0x1e')](_0x373804)[_0xf792('0x32')](_0x4d3e56);};}exports['index']=function(_0x444240,_0x1b32d1){var _0x48758e={},_0xefa636={},_0x52cd58={'count':0x0,'rows':[]};var _0x482caa=_[_0xf792('0x33')](db[_0xf792('0x34')][_0xf792('0x35')],function(_0x5dc805){return{'name':_0x5dc805[_0xf792('0x36')],'type':_0x5dc805['type'][_0xf792('0x37')]};});_0xefa636[_0xf792('0x38')]=_[_0xf792('0x33')](_0x482caa,'name');_0xefa636['query']=_[_0xf792('0x39')](_0x444240[_0xf792('0x3a')]);_0xefa636[_0xf792('0x3b')]=_[_0xf792('0x3c')](_0xefa636[_0xf792('0x38')],_0xefa636[_0xf792('0x3a')]);_0x48758e[_0xf792('0x3d')]=_[_0xf792('0x3c')](_0xefa636[_0xf792('0x38')],qs[_0xf792('0x3e')](_0x444240['query'][_0xf792('0x3e')]));_0x48758e[_0xf792('0x3d')]=_0x48758e['attributes'][_0xf792('0x3f')]?_0x48758e[_0xf792('0x3d')]:_0xefa636['model'];if(!_0x444240[_0xf792('0x3a')][_0xf792('0x40')](_0xf792('0x41'))){_0x48758e['limit']=qs[_0xf792('0x42')](_0x444240['query'][_0xf792('0x42')]);_0x48758e[_0xf792('0x20')]=qs[_0xf792('0x20')](_0x444240[_0xf792('0x3a')][_0xf792('0x20')]);}_0x48758e[_0xf792('0x43')]=qs[_0xf792('0x44')](_0x444240[_0xf792('0x3a')][_0xf792('0x44')]);_0x48758e[_0xf792('0x45')]=qs['filters'](_[_0xf792('0x46')](_0x444240[_0xf792('0x3a')],_0xefa636[_0xf792('0x3b')]),_0x482caa);if(_0x444240['query']['filter']){_0x48758e[_0xf792('0x45')]=_['merge'](_0x48758e['where'],{'$or':_[_0xf792('0x33')](_0x482caa,function(_0x27b935){if(_0x27b935['type']!==_0xf792('0x47')){var _0x3b0a1c={};_0x3b0a1c[_0x27b935[_0xf792('0x31')]]={'$like':'%'+_0x444240[_0xf792('0x3a')][_0xf792('0x48')]+'%'};return _0x3b0a1c;}})});}_0x48758e=_[_0xf792('0x49')]({},_0x48758e,_0x444240[_0xf792('0x4a')]);var _0x4ad777={'where':_0x48758e[_0xf792('0x45')]};return db[_0xf792('0x34')][_0xf792('0x22')](_0x4ad777)['then'](function(_0x29df9b){_0x52cd58[_0xf792('0x22')]=_0x29df9b;if(_0x444240[_0xf792('0x3a')]['includeAll']){_0x48758e[_0xf792('0x4b')]=[{'all':!![]}];}return db[_0xf792('0x34')]['findAll'](_0x48758e);})['then'](function(_0x34abb4){_0x52cd58[_0xf792('0x4c')]=_0x34abb4;return _0x52cd58;})[_0xf792('0x29')](respondWithFilteredResult(_0x1b32d1,_0x48758e))[_0xf792('0x4d')](handleError(_0x1b32d1,null));};exports[_0xf792('0x4e')]=function(_0x241626,_0x51b20d){var _0x244338={'raw':!![],'where':{'id':_0x241626[_0xf792('0x4f')]['id']}},_0x1193c0={};_0x1193c0[_0xf792('0x38')]=_[_0xf792('0x39')](db['MailQueue']['rawAttributes']);_0x1193c0['query']=_[_0xf792('0x39')](_0x241626[_0xf792('0x3a')]);_0x1193c0[_0xf792('0x3b')]=_[_0xf792('0x3c')](_0x1193c0[_0xf792('0x38')],_0x1193c0['query']);_0x244338['attributes']=_[_0xf792('0x3c')](_0x1193c0[_0xf792('0x38')],qs[_0xf792('0x3e')](_0x241626[_0xf792('0x3a')][_0xf792('0x3e')]));_0x244338[_0xf792('0x3d')]=_0x244338[_0xf792('0x3d')][_0xf792('0x3f')]?_0x244338[_0xf792('0x3d')]:_0x1193c0[_0xf792('0x38')];if(_0x241626['query'][_0xf792('0x50')]){_0x244338['include']=[{'all':!![]}];}_0x244338=_['merge']({},_0x244338,_0x241626[_0xf792('0x4a')]);return db[_0xf792('0x34')][_0xf792('0x51')](_0x244338)[_0xf792('0x29')](handleEntityNotFound(_0x51b20d,null))[_0xf792('0x29')](respondWithResult(_0x51b20d,null))['catch'](handleError(_0x51b20d,null));};exports[_0xf792('0x52')]=function(_0x287ad2,_0x40d3dc){return db[_0xf792('0x34')]['create'](_0x287ad2[_0xf792('0x53')],{})[_0xf792('0x29')](function(_0x532154){var _0x24bd8c=_0x287ad2[_0xf792('0x54')][_0xf792('0x2b')]({'plain':!![]});if(!_0x24bd8c)throw new Error(_0xf792('0x55'));if(_0x24bd8c['role']===_0xf792('0x54')){var _0x4c79c8=_0x532154[_0xf792('0x2b')]({'plain':!![]});var _0x45280e='MailQueues';return db[_0xf792('0x56')][_0xf792('0x51')]({'where':{'name':_0x45280e,'userProfileId':_0x24bd8c[_0xf792('0x57')]},'raw':!![]})[_0xf792('0x29')](function(_0x250f9f){if(_0x250f9f&&_0x250f9f[_0xf792('0x58')]===0x0){return db['UserProfileResource']['create']({'name':_0x4c79c8[_0xf792('0x31')],'resourceId':_0x4c79c8['id'],'type':_0x250f9f[_0xf792('0x31')],'sectionId':_0x250f9f['id']},{})[_0xf792('0x29')](function(){return _0x532154;});}else{return _0x532154;}})['catch'](function(_0x5e3d45){logger[_0xf792('0x2f')](_0xf792('0x59'),_0x5e3d45);throw _0x5e3d45;});}return _0x532154;})[_0xf792('0x29')](respondWithResult(_0x40d3dc,0xc9))['catch'](handleError(_0x40d3dc,null));};exports['update']=function(_0x1a13df,_0x205c53){if(_0x1a13df[_0xf792('0x53')]['id']){delete _0x1a13df[_0xf792('0x53')]['id'];}return db[_0xf792('0x34')][_0xf792('0x51')]({'where':{'id':_0x1a13df['params']['id']}})[_0xf792('0x29')](handleEntityNotFound(_0x205c53,null))[_0xf792('0x29')](saveUpdates(_0x1a13df[_0xf792('0x53')],null))['then'](respondWithResult(_0x205c53,null))['catch'](handleError(_0x205c53,null));};exports[_0xf792('0x2a')]=function(_0x1a53c3,_0x1aa670){return db[_0xf792('0x34')][_0xf792('0x51')]({'where':{'id':_0x1a53c3[_0xf792('0x4f')]['id']}})[_0xf792('0x29')](handleEntityNotFound(_0x1aa670,null))[_0xf792('0x29')](removeEntity(_0x1aa670,null))[_0xf792('0x4d')](handleError(_0x1aa670,null));};exports['describe']=function(_0x3c4645,_0x195056){return db[_0xf792('0x34')][_0xf792('0x5a')]()[_0xf792('0x29')](respondWithResult(_0x195056,null))[_0xf792('0x4d')](handleError(_0x195056,null));};exports['getMembers']=function(_0x27d9f6,_0x49a1c1,_0x1e937d){var _0x287b04={'raw':!![],'where':{}},_0x2839e1={},_0x2114a0;return db[_0xf792('0x34')][_0xf792('0x5b')]({'where':{'id':_0x27d9f6[_0xf792('0x4f')]['id']}})[_0xf792('0x29')](handleEntityNotFound(_0x49a1c1,null))[_0xf792('0x29')](function(_0x80339){if(_0x80339){_0x2114a0=_0x80339[_0xf792('0x2b')]({'plain':!![]});_0x2839e1[_0xf792('0x38')]=_['keys'](db[_0xf792('0x5c')][_0xf792('0x35')]);_0x2839e1['query']=_[_0xf792('0x39')](_0x27d9f6[_0xf792('0x3a')]);_0x2839e1['filters']=_[_0xf792('0x3c')](_0x2839e1[_0xf792('0x38')],_0x2839e1[_0xf792('0x3a')]);_0x287b04[_0xf792('0x3d')]=_[_0xf792('0x3c')](_0x2839e1[_0xf792('0x38')],qs[_0xf792('0x3e')](_0x27d9f6[_0xf792('0x3a')][_0xf792('0x3e')]));_0x287b04[_0xf792('0x3d')]=_0x287b04[_0xf792('0x3d')][_0xf792('0x3f')]?_0x287b04[_0xf792('0x3d')]:_0x2839e1[_0xf792('0x38')];if(!_0x27d9f6[_0xf792('0x3a')]['hasOwnProperty'](_0xf792('0x41'))){_0x287b04[_0xf792('0x42')]=qs[_0xf792('0x42')](_0x27d9f6[_0xf792('0x3a')][_0xf792('0x42')]);_0x287b04['offset']=qs[_0xf792('0x20')](_0x27d9f6[_0xf792('0x3a')]['offset']);}_0x287b04[_0xf792('0x43')]=qs['sort'](_0x27d9f6['query']['sort']);_0x287b04[_0xf792('0x45')]=qs[_0xf792('0x3b')](_['pick'](_0x27d9f6[_0xf792('0x3a')],_0x2839e1[_0xf792('0x3b')]));_0x287b04[_0xf792('0x45')][_0xf792('0x5d')]=_0x80339['id'];if(_0x27d9f6[_0xf792('0x3a')][_0xf792('0x48')]){_0x287b04[_0xf792('0x45')]=_[_0xf792('0x49')](_0x287b04['where'],{'$or':_[_0xf792('0x33')](_0x287b04['attributes'],function(_0x3c13b8){var _0x5c314f={};_0x5c314f[_0x3c13b8]={'$like':'%'+_0x27d9f6[_0xf792('0x3a')][_0xf792('0x48')]+'%'};return _0x5c314f;})});}_0x287b04=_['merge']({},_0x287b04,_0x27d9f6[_0xf792('0x4a')]);return db[_0xf792('0x5c')][_0xf792('0x5e')](_0x287b04);}})[_0xf792('0x29')](function(_0xa5e2b2){if(_0xa5e2b2){return db[_0xf792('0x5f')]['findAndCountAll']({'where':{'id':_[_0xf792('0x33')](_0xa5e2b2,_0xf792('0x60')),'role':_0xf792('0x61')},'attributes':['id','name',_0xf792('0x62'),_0xf792('0x63'),'createdAt']});}})[_0xf792('0x29')](function(_0x3b8f04){if(_0x3b8f04){return{'count':_0x3b8f04['count'],'rows':_[_0xf792('0x33')](_0x3b8f04[_0xf792('0x4c')],function(_0xd2932){return{'membername':_0xd2932[_0xf792('0x31')],'UserId':_0xd2932['id'],'queue_name':_0x2114a0[_0xf792('0x31')],'MailQueueId':_0x2114a0['id'],'interface':util[_0xf792('0x64')]('%s/%s',_0xf792('0x65'),_0xd2932[_0xf792('0x31')]),'penalty':0x0,'paused':_0xd2932['mailPause'],'createdAt':_0xd2932['createdAt'],'updatedAt':_0xd2932[_0xf792('0x63')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xf792('0x29')](respondWithFilteredResult(_0x49a1c1,_0x287b04))[_0xf792('0x4d')](handleError(_0x49a1c1,null));};exports[_0xf792('0x66')]=function(_0x4a9d15,_0x536494,_0x12f8b3){var _0x561132={};var _0x557f3f={};var _0x10b890;var _0x3b0bc1;return db[_0xf792('0x34')][_0xf792('0x5b')]({'where':{'id':_0x4a9d15[_0xf792('0x4f')]['id']}})['then'](handleEntityNotFound(_0x536494,null))[_0xf792('0x29')](function(_0x1eeb8d){if(_0x1eeb8d){_0x10b890=_0x1eeb8d;_0x557f3f[_0xf792('0x38')]=_[_0xf792('0x39')](db[_0xf792('0x67')]['rawAttributes']);_0x557f3f[_0xf792('0x3a')]=_[_0xf792('0x39')](_0x4a9d15[_0xf792('0x3a')]);_0x557f3f[_0xf792('0x3b')]=_[_0xf792('0x3c')](_0x557f3f[_0xf792('0x38')],_0x557f3f[_0xf792('0x3a')]);_0x561132[_0xf792('0x3d')]=_['intersection'](_0x557f3f[_0xf792('0x38')],qs[_0xf792('0x3e')](_0x4a9d15['query'][_0xf792('0x3e')]));_0x561132[_0xf792('0x3d')]=_0x561132[_0xf792('0x3d')]['length']?_0x561132[_0xf792('0x3d')]:_0x557f3f['model'];_0x561132[_0xf792('0x43')]=qs[_0xf792('0x44')](_0x4a9d15[_0xf792('0x3a')]['sort']);_0x561132['where']=qs[_0xf792('0x3b')](_[_0xf792('0x46')](_0x4a9d15[_0xf792('0x3a')],_0x557f3f[_0xf792('0x3b')]));if(_0x4a9d15[_0xf792('0x3a')]['filter']){_0x561132[_0xf792('0x45')]=_[_0xf792('0x49')](_0x561132[_0xf792('0x45')],{'$or':_[_0xf792('0x33')](_0x561132[_0xf792('0x3d')],function(_0x5e4233){var _0x1bbb11={};_0x1bbb11[_0x5e4233]={'$like':'%'+_0x4a9d15[_0xf792('0x3a')]['filter']+'%'};return _0x1bbb11;})});}_0x561132=_['merge']({},_0x561132,_0x4a9d15[_0xf792('0x4a')]);return _0x10b890['getTeams'](_0x561132);}})[_0xf792('0x29')](function(_0x2e8366){if(_0x2e8366){_0x3b0bc1=_0x2e8366[_0xf792('0x3f')];if(!_0x4a9d15[_0xf792('0x3a')]['hasOwnProperty'](_0xf792('0x41'))){_0x561132['limit']=qs[_0xf792('0x42')](_0x4a9d15[_0xf792('0x3a')][_0xf792('0x42')]);_0x561132[_0xf792('0x20')]=qs[_0xf792('0x20')](_0x4a9d15[_0xf792('0x3a')]['offset']);}return _0x10b890[_0xf792('0x66')](_0x561132);}})[_0xf792('0x29')](function(_0x51707a){if(_0x51707a){return _0x51707a?{'count':_0x3b0bc1,'rows':_0x51707a}:null;}})[_0xf792('0x29')](respondWithResult(_0x536494,null))[_0xf792('0x4d')](handleError(_0x536494,null));};exports[_0xf792('0x68')]=function(_0x5eb6b0,_0x4d3465,_0x3fb071){var _0xe7461b=_0x5eb6b0[_0xf792('0x53')][_0xf792('0x69')];return db[_0xf792('0x67')][_0xf792('0x5e')]({'where':{'id':_0xe7461b},'attributes':['id'],'include':[{'model':db[_0xf792('0x5f')],'as':_0xf792('0x6a'),'attributes':['id','name',_0xf792('0x6b'),_0xf792('0x6c'),_0xf792('0x6d')],'raw':!![]}]})[_0xf792('0x29')](function(_0x469c4c){if(_0x469c4c){var _0x8e2a8e=_[_0xf792('0x6e')](_0x469c4c,function(_0xe917cb){var _0x4f0095=_0xe917cb[_0xf792('0x2b')]({'plain':!![]});return _0x4f0095[_0xf792('0x6a')];});return db[_0xf792('0x34')][_0xf792('0x51')]({'where':{'id':_0x5eb6b0['params']['id']}})['then'](function(_0x558b73){return db[_0xf792('0x6f')][_0xf792('0x70')](function(_0xbab63d){return _0x558b73[_0xf792('0x68')](_0xe7461b,{'transaction':_0xbab63d})[_0xf792('0x29')](function(){return BPromise[_0xf792('0x71')](_0x8e2a8e,function(_0x532132){return db['UserMailQueue'][_0xf792('0x72')]({'where':{'UserId':_0x532132['id'],'MailQueueId':_0x5eb6b0[_0xf792('0x4f')]['id']},'transaction':_0xbab63d});});})[_0xf792('0x29')](function(){_0x8e2a8e['forEach'](function(_0x5aa3cf){socket[_0xf792('0x73')](_0xf792('0x74'),{'UserId':_0x5aa3cf['id'],'MailQueueId':_0x558b73['id']});});});});});}})[_0xf792('0x29')](respondWithStatusCode(_0x4d3465,null))[_0xf792('0x4d')](handleError(_0x4d3465,null));};exports[_0xf792('0x75')]=function(_0x11e042,_0x2492a3,_0x44f3ae){return db[_0xf792('0x67')]['findAll']({'where':{'id':_0x11e042[_0xf792('0x3a')][_0xf792('0x69')]},'attributes':['id'],'include':[{'model':db[_0xf792('0x5f')],'as':_0xf792('0x6a'),'attributes':['id'],'raw':!![]}]})[_0xf792('0x29')](handleEntityNotFound(_0x2492a3,null))[_0xf792('0x29')](function(_0x4b1505){var _0x1d395f=_['map'](_0x4b1505,'id');var _0x2e72fb=[];var _0x2bf51f=[];var _0x43ae5e=squel['select']();_0x43ae5e[_0xf792('0x76')]('tq.TeamId')['from'](_0xf792('0x77'),'tq')['join']('user_has_teams','ut',_0xf792('0x78'))[_0xf792('0x45')](_0xf792('0x79'),_0x11e042[_0xf792('0x4f')]['id']);for(var _0x56e4ae=0x0;_0x56e4ae<_0x4b1505[_0xf792('0x3f')];_0x56e4ae+=0x1){let _0x5a21b3=_0x4b1505[_0x56e4ae];for(var _0x1cf03f=0x0;_0x1cf03f<_0x5a21b3[_0xf792('0x6a')][_0xf792('0x3f')];_0x1cf03f+=0x1){let _0x5a5b8b=_0x5a21b3[_0xf792('0x6a')][_0x1cf03f];var _0x314709=_0x43ae5e[_0xf792('0x7a')]();_0x314709['where'](_0xf792('0x7b'),_0x5a5b8b['id']);_0x2bf51f[_0xf792('0x7c')](db['sequelize']['query'](_0x314709[_0xf792('0x7d')](),{'type':db[_0xf792('0x6f')][_0xf792('0x7e')][_0xf792('0x7f')]})['then'](function(_0x2b6524){if(_0x2b6524['length']===0x1){return _0x5a5b8b['id'];}else{var _0x3faa76=_[_0xf792('0x80')](_[_0xf792('0x33')](_0x2b6524,'TeamId'),function(_0x4c1824){return _[_0xf792('0x81')](_0x1d395f,_0x4c1824);});if(_0x3faa76){return _0x5a5b8b['id'];}}}));}}return BPromise[_0xf792('0x82')](_0x2bf51f)[_0xf792('0x29')](function(_0x2254a3){_0x2e72fb=_(_0x2e72fb)[_0xf792('0x83')](_0x2254a3)[_0xf792('0x84')]()[_0xf792('0x85')]();return db[_0xf792('0x34')]['find']({'where':{'id':_0x11e042[_0xf792('0x4f')]['id']}})['then'](function(_0x372fff){return db[_0xf792('0x6f')][_0xf792('0x70')](function(_0x3f0baa){return _0x372fff['removeTeams'](_0x11e042[_0xf792('0x3a')]['ids'],{'transaction':_0x3f0baa})['then'](function(){if(!_[_0xf792('0x86')](_0x2e72fb)){return _0x372fff[_0xf792('0x87')](_0x2e72fb,{'transaction':_0x3f0baa});}})[_0xf792('0x29')](function(){_0x2e72fb[_0xf792('0x88')](function(_0x566888){socket[_0xf792('0x73')](_0xf792('0x89'),{'UserId':_0x566888,'MailQueueId':_0x372fff['id']});});});});});});})[_0xf792('0x29')](respondWithStatusCode(_0x2492a3,null))[_0xf792('0x4d')](handleError(_0x2492a3,null));};exports['addAgents']=function(_0x3a880a,_0x1c0846,_0x1e4948){return db['MailQueue'][_0xf792('0x51')]({'where':{'id':_0x3a880a[_0xf792('0x4f')]['id']}})[_0xf792('0x29')](handleEntityNotFound(_0x1c0846,null))[_0xf792('0x29')](function(_0x3e1427){if(_0x3e1427){return _0x3e1427[_0xf792('0x8a')](_0x3a880a['body'][_0xf792('0x69')],_[_0xf792('0x8b')](_0x3a880a[_0xf792('0x53')],['ids','id'])||{})[_0xf792('0x8c')](function(_0x3a2374){for(var _0x4043a0=0x0;_0x4043a0<_0x3a880a[_0xf792('0x53')]['ids'][_0xf792('0x3f')];_0x4043a0+=0x1){socket[_0xf792('0x73')]('userMailQueue:save',{'UserId':_0x3a880a[_0xf792('0x53')][_0xf792('0x69')][_0x4043a0],'MailQueueId':_0x3a880a[_0xf792('0x4f')]['id']});}return _0x3a2374;});}})[_0xf792('0x29')](respondWithResult(_0x1c0846,null))[_0xf792('0x4d')](handleError(_0x1c0846,null));};exports[_0xf792('0x87')]=function(_0x28cce8,_0x520ab5,_0x5e2a05){return db[_0xf792('0x34')]['find']({'where':{'id':_0x28cce8['params']['id']}})['then'](handleEntityNotFound(_0x520ab5,null))['then'](function(_0x273b1f){if(_0x273b1f){return _0x273b1f['removeAgents'](_0x28cce8[_0xf792('0x3a')]['ids'])[_0xf792('0x29')](function(){if(_[_0xf792('0x8d')](_0x28cce8[_0xf792('0x3a')]['ids'])){for(var _0x24a4ea=0x0;_0x24a4ea<_0x28cce8[_0xf792('0x3a')][_0xf792('0x69')][_0xf792('0x3f')];_0x24a4ea+=0x1){socket[_0xf792('0x73')](_0xf792('0x89'),{'UserId':Number(_0x28cce8[_0xf792('0x3a')][_0xf792('0x69')][_0x24a4ea]),'MailQueueId':Number(_0x28cce8[_0xf792('0x4f')]['id'])});}}else{socket[_0xf792('0x73')](_0xf792('0x89'),{'UserId':Number(_0x28cce8[_0xf792('0x3a')][_0xf792('0x69')]),'MailQueueId':Number(_0x28cce8[_0xf792('0x4f')]['id'])});}});}})[_0xf792('0x29')](respondWithStatusCode(_0x520ab5,null))[_0xf792('0x4d')](handleError(_0x520ab5,null));};exports['getAgents']=function(_0x4f3d85,_0x4417a7,_0x2da7df){var _0xbb853={};var _0x573fad={};var _0xddf63;var _0x44220a;return db[_0xf792('0x34')]['findOne']({'where':{'id':_0x4f3d85[_0xf792('0x4f')]['id']}})[_0xf792('0x29')](handleEntityNotFound(_0x4417a7,null))[_0xf792('0x29')](function(_0x1a6e95){if(_0x1a6e95){_0xddf63=_0x1a6e95;_0x573fad[_0xf792('0x38')]=_[_0xf792('0x39')](db[_0xf792('0x5f')][_0xf792('0x35')]);_0x573fad[_0xf792('0x3a')]=_[_0xf792('0x39')](_0x4f3d85[_0xf792('0x3a')]);_0x573fad[_0xf792('0x3b')]=_[_0xf792('0x3c')](_0x573fad[_0xf792('0x38')],_0x573fad[_0xf792('0x3a')]);_0xbb853[_0xf792('0x3d')]=_[_0xf792('0x3c')](_0x573fad[_0xf792('0x38')],qs[_0xf792('0x3e')](_0x4f3d85[_0xf792('0x3a')][_0xf792('0x3e')]));_0xbb853['attributes']=_0xbb853['attributes'][_0xf792('0x3f')]?_0xbb853['attributes']:_0x573fad['model'];_0xbb853[_0xf792('0x43')]=qs[_0xf792('0x44')](_0x4f3d85[_0xf792('0x3a')][_0xf792('0x44')]);_0xbb853['where']=qs[_0xf792('0x3b')](_['pick'](_0x4f3d85[_0xf792('0x3a')],_0x573fad[_0xf792('0x3b')]));if(_0x4f3d85[_0xf792('0x3a')]['filter']){_0xbb853[_0xf792('0x45')]=_[_0xf792('0x49')](_0xbb853[_0xf792('0x45')],{'$or':_['map'](_0xbb853[_0xf792('0x3d')],function(_0x209513){var _0x33502d={};_0x33502d[_0x209513]={'$like':'%'+_0x4f3d85[_0xf792('0x3a')][_0xf792('0x48')]+'%'};return _0x33502d;})});}_0xbb853=_[_0xf792('0x49')]({},_0xbb853,_0x4f3d85[_0xf792('0x4a')]);return _0xddf63[_0xf792('0x8e')](_0xbb853);}})['then'](function(_0x3ee663){if(_0x3ee663){_0x44220a=_0x3ee663['length'];if(!_0x4f3d85[_0xf792('0x3a')][_0xf792('0x40')]('nolimit')){_0xbb853['limit']=qs['limit'](_0x4f3d85[_0xf792('0x3a')][_0xf792('0x42')]);_0xbb853[_0xf792('0x20')]=qs[_0xf792('0x20')](_0x4f3d85['query'][_0xf792('0x20')]);}return _0xddf63[_0xf792('0x8e')](_0xbb853);}})['then'](function(_0x460b6d){if(_0x460b6d){return _0x460b6d?{'count':_0x44220a,'rows':_0x460b6d}:null;}})[_0xf792('0x29')](respondWithResult(_0x4417a7,null))[_0xf792('0x4d')](handleError(_0x4417a7,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index f134f0e..5e4e866 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 _0xc1ed=['events','../../mysqldb','save','update','remove','emit','exports'];(function(_0x8727fb,_0x2e535f){var _0xb4545a=function(_0x10b583){while(--_0x10b583){_0x8727fb['push'](_0x8727fb['shift']());}};_0xb4545a(++_0x2e535f);}(_0xc1ed,0x1ce));var _0xdc1e=function(_0x31b264,_0x172a83){_0x31b264=_0x31b264-0x0;var _0x3556ca=_0xc1ed[_0x31b264];return _0x3556ca;};'use strict';var EventEmitter=require(_0xdc1e('0x0'));var MailQueue=require(_0xdc1e('0x1'))['db']['MailQueue'];var MailQueueEvents=new EventEmitter();MailQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xdc1e('0x2'),'afterUpdate':_0xdc1e('0x3'),'afterDestroy':_0xdc1e('0x4')};function emitEvent(_0x404181){return function(_0x818bab,_0x4dbbb5,_0x310c7d){MailQueueEvents[_0xdc1e('0x5')](_0x404181+':'+_0x818bab['id'],_0x818bab);MailQueueEvents[_0xdc1e('0x5')](_0x404181,_0x818bab);_0x310c7d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailQueue['hook'](e,emitEvent(event));}}module[_0xdc1e('0x6')]=MailQueueEvents; \ No newline at end of file +var _0x596c=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','MailQueue','setMaxListeners','save'];(function(_0x2ce426,_0x2c7a2d){var _0xdbc337=function(_0x5189e6){while(--_0x5189e6){_0x2ce426['push'](_0x2ce426['shift']());}};_0xdbc337(++_0x2c7a2d);}(_0x596c,0xf8));var _0xc596=function(_0x8e7954,_0x535ee5){_0x8e7954=_0x8e7954-0x0;var _0x5b19dc=_0x596c[_0x8e7954];return _0x5b19dc;};'use strict';var EventEmitter=require(_0xc596('0x0'));var MailQueue=require(_0xc596('0x1'))['db'][_0xc596('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0xc596('0x3')](0x0);var events={'afterCreate':_0xc596('0x4'),'afterUpdate':_0xc596('0x5'),'afterDestroy':_0xc596('0x6')};function emitEvent(_0x208dbe){return function(_0x477bfd,_0x1422f3,_0x4655e3){MailQueueEvents[_0xc596('0x7')](_0x208dbe+':'+_0x477bfd['id'],_0x477bfd);MailQueueEvents[_0xc596('0x7')](_0x208dbe,_0x477bfd);_0x4655e3(null);};}for(var e in events){if(events[_0xc596('0x8')](e)){var event=events[e];MailQueue[_0xc596('0x9')](e,emitEvent(event));}}module[_0xc596('0xa')]=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index 12ae038..3e2cc7b 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 _0x1e90=['./mailQueue.attributes','exports','define','mail_queues','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x20589d,_0x55d5bf){var _0x422de9=function(_0x44cbbb){while(--_0x44cbbb){_0x20589d['push'](_0x20589d['shift']());}};_0x422de9(++_0x55d5bf);}(_0x1e90,0x190));var _0x01e9=function(_0x1c1c64,_0x4e9112){_0x1c1c64=_0x1c1c64-0x0;var _0x52a1de=_0x1e90[_0x1c1c64];return _0x52a1de;};'use strict';var _=require(_0x01e9('0x0'));var util=require(_0x01e9('0x1'));var logger=require(_0x01e9('0x2'))('api');var moment=require(_0x01e9('0x3'));var BPromise=require(_0x01e9('0x4'));var rp=require(_0x01e9('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x01e9('0x6'));var config=require(_0x01e9('0x7'));var attributes=require(_0x01e9('0x8'));module[_0x01e9('0x9')]=function(_0x394b8b,_0x5e75b9){return _0x394b8b[_0x01e9('0xa')]('MailQueue',attributes,{'tableName':_0x01e9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe51a=['../../config/environment','exports','define','MailQueue','mail_queues','lodash','util','../../config/logger','moment','request-promise','path','rimraf'];(function(_0xbd77c1,_0x50b969){var _0x47fa83=function(_0x38dac1){while(--_0x38dac1){_0xbd77c1['push'](_0xbd77c1['shift']());}};_0x47fa83(++_0x50b969);}(_0xe51a,0x71));var _0xae51=function(_0x4008f2,_0x2efe8a){_0x4008f2=_0x4008f2-0x0;var _0x11d2dc=_0xe51a[_0x4008f2];return _0x11d2dc;};'use strict';var _=require(_0xae51('0x0'));var util=require(_0xae51('0x1'));var logger=require(_0xae51('0x2'))('api');var moment=require(_0xae51('0x3'));var BPromise=require('bluebird');var rp=require(_0xae51('0x4'));var fs=require('fs');var path=require(_0xae51('0x5'));var rimraf=require(_0xae51('0x6'));var config=require(_0xae51('0x7'));var attributes=require('./mailQueue.attributes');module[_0xae51('0x8')]=function(_0x4fb7f6,_0x5cd947){return _0x4fb7f6[_0xae51('0x9')](_0xae51('0xa'),attributes,{'tableName':_0xae51('0xb'),'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 d23f61a..a5a27d0 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 _0x3cbb=['result','catch','options','raw','attributes','limit','include','model','map','GetMailQueue','ShowMailQueue','MailQueue','find','util','moment','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','defaults','redis','localhost','./mailQueue.socket','register','request','then','MailQueue,\x20%s,\x20%s','request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info'];(function(_0x4e93a9,_0x413f30){var _0x43013c=function(_0x3a0cf3){while(--_0x3a0cf3){_0x4e93a9['push'](_0x4e93a9['shift']());}};_0x43013c(++_0x413f30);}(_0x3cbb,0x175));var _0xb3cb=function(_0x5e36d1,_0x471178){_0x5e36d1=_0x5e36d1-0x0;var _0x950b9e=_0x3cbb[_0x5e36d1];return _0x950b9e;};'use strict';var _=require('lodash');var util=require(_0xb3cb('0x0'));var moment=require(_0xb3cb('0x1'));var BPromise=require(_0xb3cb('0x2'));var rs=require(_0xb3cb('0x3'));var fs=require('fs');var Redis=require(_0xb3cb('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xb3cb('0x5'))('rpc');var config=require(_0xb3cb('0x6'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0xb3cb('0x7')](config[_0xb3cb('0x8')],{'host':_0xb3cb('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb3cb('0x8')]));require(_0xb3cb('0xa'))[_0xb3cb('0xb')](socket);function respondWithRpcPromise(_0x393486,_0x14d087,_0x21b4ed){return new BPromise(function(_0x21949a,_0x591bc9){return client[_0xb3cb('0xc')](_0x393486,_0x21b4ed)[_0xb3cb('0xd')](function(_0x2ff10b){logger['info'](_0xb3cb('0xe'),_0x14d087,_0xb3cb('0xf'));logger[_0xb3cb('0x10')](_0xb3cb('0x11'),_0x14d087,_0xb3cb('0xf'),JSON[_0xb3cb('0x12')](_0x2ff10b));if(_0x2ff10b[_0xb3cb('0x13')]){if(_0x2ff10b['error'][_0xb3cb('0x14')]===0x1f4){logger['error'](_0xb3cb('0xe'),_0x14d087,_0x2ff10b[_0xb3cb('0x13')][_0xb3cb('0x15')]);return _0x591bc9(_0x2ff10b['error']['message']);}logger[_0xb3cb('0x13')](_0xb3cb('0xe'),_0x14d087,_0x2ff10b[_0xb3cb('0x13')]['message']);return _0x21949a(_0x2ff10b[_0xb3cb('0x13')][_0xb3cb('0x15')]);}else{logger[_0xb3cb('0x16')](_0xb3cb('0xe'),_0x14d087,_0xb3cb('0xf'));_0x21949a(_0x2ff10b[_0xb3cb('0x17')][_0xb3cb('0x15')]);}})[_0xb3cb('0x18')](function(_0x2a7838){logger[_0xb3cb('0x13')](_0xb3cb('0xe'),_0x14d087,_0x2a7838);_0x591bc9(_0x2a7838);});});}exports['GetMailQueue']=function(_0x36279a){var _0x11ec7a=this;return new Promise(function(_0x24bbfb,_0x2f2704){return db['MailQueue']['findAll']({'raw':_0x36279a[_0xb3cb('0x19')]?_0x36279a['options'][_0xb3cb('0x1a')]===undefined?!![]:![]:!![],'where':_0x36279a['options']?_0x36279a['options']['where']||null:null,'attributes':_0x36279a[_0xb3cb('0x19')]?_0x36279a[_0xb3cb('0x19')][_0xb3cb('0x1b')]||null:null,'limit':_0x36279a[_0xb3cb('0x19')]?_0x36279a[_0xb3cb('0x19')][_0xb3cb('0x1c')]||null:null,'include':_0x36279a['options']?_0x36279a[_0xb3cb('0x19')][_0xb3cb('0x1d')]?_['map'](_0x36279a[_0xb3cb('0x19')][_0xb3cb('0x1d')],function(_0x37c119){return{'model':db[_0x37c119[_0xb3cb('0x1e')]],'as':_0x37c119['as'],'attributes':_0x37c119[_0xb3cb('0x1b')],'include':_0x37c119[_0xb3cb('0x1d')]?_[_0xb3cb('0x1f')](_0x37c119[_0xb3cb('0x1d')],function(_0x4a212e){return{'model':db[_0x4a212e[_0xb3cb('0x1e')]],'as':_0x4a212e['as'],'attributes':_0x4a212e[_0xb3cb('0x1b')],'include':_0x4a212e[_0xb3cb('0x1d')]?_[_0xb3cb('0x1f')](_0x4a212e[_0xb3cb('0x1d')],function(_0x384c31){return{'model':db[_0x384c31[_0xb3cb('0x1e')]],'as':_0x384c31['as'],'attributes':_0x384c31[_0xb3cb('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xb3cb('0xd')](function(_0x395fa6){logger[_0xb3cb('0x16')](_0xb3cb('0x20'),_0x36279a);logger['debug'](_0xb3cb('0x20'),_0x36279a,JSON['stringify'](_0x395fa6));_0x24bbfb(_0x395fa6);})[_0xb3cb('0x18')](function(_0x18b3f0){logger[_0xb3cb('0x13')]('GetMailQueue',_0x18b3f0[_0xb3cb('0x15')],_0x36279a);_0x2f2704(_0x11ec7a['error'](0x1f4,_0x18b3f0[_0xb3cb('0x15')]));});});};exports[_0xb3cb('0x21')]=function(_0x7fae38){var _0x341935=this;return new Promise(function(_0x27f76a,_0x40cf1b){return db[_0xb3cb('0x22')][_0xb3cb('0x23')]({'raw':_0x7fae38[_0xb3cb('0x19')]?_0x7fae38[_0xb3cb('0x19')][_0xb3cb('0x1a')]===undefined?!![]:![]:!![],'where':_0x7fae38[_0xb3cb('0x19')]?_0x7fae38[_0xb3cb('0x19')]['where']||null:null,'attributes':_0x7fae38[_0xb3cb('0x19')]?_0x7fae38[_0xb3cb('0x19')][_0xb3cb('0x1b')]||null:null,'include':_0x7fae38['options']?_0x7fae38['options'][_0xb3cb('0x1d')]?_[_0xb3cb('0x1f')](_0x7fae38['options']['include'],function(_0x18e5cf){return{'model':db[_0x18e5cf['model']],'as':_0x18e5cf['as'],'attributes':_0x18e5cf['attributes'],'include':_0x18e5cf[_0xb3cb('0x1d')]?_['map'](_0x18e5cf[_0xb3cb('0x1d')],function(_0x3e5165){return{'model':db[_0x3e5165[_0xb3cb('0x1e')]],'as':_0x3e5165['as'],'attributes':_0x3e5165[_0xb3cb('0x1b')],'include':_0x3e5165['include']?_['map'](_0x3e5165[_0xb3cb('0x1d')],function(_0xd77386){return{'model':db[_0xd77386[_0xb3cb('0x1e')]],'as':_0xd77386['as'],'attributes':_0xd77386[_0xb3cb('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xb3cb('0xd')](function(_0x6186c3){logger[_0xb3cb('0x16')](_0xb3cb('0x21'),_0x7fae38);logger['debug'](_0xb3cb('0x21'),_0x7fae38,JSON[_0xb3cb('0x12')](_0x6186c3));_0x27f76a(_0x6186c3);})[_0xb3cb('0x18')](function(_0x393f98){logger[_0xb3cb('0x13')](_0xb3cb('0x21'),_0x393f98[_0xb3cb('0x15')],_0x7fae38);_0x40cf1b(_0x341935[_0xb3cb('0x13')](0x1f4,_0x393f98[_0xb3cb('0x15')]));});});}; \ No newline at end of file +var _0x50d5=['randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','redis','defaults','localhost','./mailQueue.socket','register','then','info','request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','MailQueue,\x20%s,\x20%s','catch','GetMailQueue','findAll','options','where','attributes','map','include','model','ShowMailQueue','MailQueue','raw','lodash','util','moment'];(function(_0x52efc4,_0x594bbd){var _0x3dfced=function(_0x1b8276){while(--_0x1b8276){_0x52efc4['push'](_0x52efc4['shift']());}};_0x3dfced(++_0x594bbd);}(_0x50d5,0xb6));var _0x550d=function(_0x3745eb,_0x5e62c5){_0x3745eb=_0x3745eb-0x0;var _0x1d5503=_0x50d5[_0x3745eb];return _0x1d5503;};'use strict';var _=require(_0x550d('0x0'));var util=require(_0x550d('0x1'));var moment=require(_0x550d('0x2'));var BPromise=require('bluebird');var rs=require(_0x550d('0x3'));var fs=require('fs');var Redis=require(_0x550d('0x4'));var db=require(_0x550d('0x5'))['db'];var utils=require(_0x550d('0x6'));var logger=require('../../config/logger')(_0x550d('0x7'));var config=require(_0x550d('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x550d('0x9')]['http']({'port':0x232a});config[_0x550d('0xa')]=_[_0x550d('0xb')](config[_0x550d('0xa')],{'host':_0x550d('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x550d('0xd'))[_0x550d('0xe')](socket);function respondWithRpcPromise(_0x26daec,_0xa9078c,_0x5d43ef){return new BPromise(function(_0x1651f8,_0xeb921c){return client['request'](_0x26daec,_0x5d43ef)[_0x550d('0xf')](function(_0x4c813e){logger[_0x550d('0x10')]('MailQueue,\x20%s,\x20%s',_0xa9078c,_0x550d('0x11'));logger[_0x550d('0x12')](_0x550d('0x13'),_0xa9078c,_0x550d('0x11'),JSON[_0x550d('0x14')](_0x4c813e));if(_0x4c813e[_0x550d('0x15')]){if(_0x4c813e[_0x550d('0x15')][_0x550d('0x16')]===0x1f4){logger[_0x550d('0x15')]('MailQueue,\x20%s,\x20%s',_0xa9078c,_0x4c813e['error'][_0x550d('0x17')]);return _0xeb921c(_0x4c813e['error']['message']);}logger['error'](_0x550d('0x18'),_0xa9078c,_0x4c813e[_0x550d('0x15')][_0x550d('0x17')]);return _0x1651f8(_0x4c813e[_0x550d('0x15')]['message']);}else{logger[_0x550d('0x10')]('MailQueue,\x20%s,\x20%s',_0xa9078c,_0x550d('0x11'));_0x1651f8(_0x4c813e['result'][_0x550d('0x17')]);}})[_0x550d('0x19')](function(_0x5bb040){logger[_0x550d('0x15')](_0x550d('0x18'),_0xa9078c,_0x5bb040);_0xeb921c(_0x5bb040);});});}exports[_0x550d('0x1a')]=function(_0x4530d5){var _0x572aff=this;return new Promise(function(_0x2463fd,_0x23c992){return db['MailQueue'][_0x550d('0x1b')]({'raw':_0x4530d5[_0x550d('0x1c')]?_0x4530d5[_0x550d('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x4530d5[_0x550d('0x1c')]?_0x4530d5['options'][_0x550d('0x1d')]||null:null,'attributes':_0x4530d5[_0x550d('0x1c')]?_0x4530d5[_0x550d('0x1c')][_0x550d('0x1e')]||null:null,'limit':_0x4530d5['options']?_0x4530d5[_0x550d('0x1c')]['limit']||null:null,'include':_0x4530d5['options']?_0x4530d5['options']['include']?_[_0x550d('0x1f')](_0x4530d5[_0x550d('0x1c')][_0x550d('0x20')],function(_0x5f3e17){return{'model':db[_0x5f3e17['model']],'as':_0x5f3e17['as'],'attributes':_0x5f3e17[_0x550d('0x1e')],'include':_0x5f3e17[_0x550d('0x20')]?_['map'](_0x5f3e17[_0x550d('0x20')],function(_0x396285){return{'model':db[_0x396285[_0x550d('0x21')]],'as':_0x396285['as'],'attributes':_0x396285[_0x550d('0x1e')],'include':_0x396285['include']?_['map'](_0x396285[_0x550d('0x20')],function(_0x37bec9){return{'model':db[_0x37bec9[_0x550d('0x21')]],'as':_0x37bec9['as'],'attributes':_0x37bec9[_0x550d('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x908961){logger[_0x550d('0x10')](_0x550d('0x1a'),_0x4530d5);logger[_0x550d('0x12')]('GetMailQueue',_0x4530d5,JSON[_0x550d('0x14')](_0x908961));_0x2463fd(_0x908961);})[_0x550d('0x19')](function(_0x5582d8){logger['error'](_0x550d('0x1a'),_0x5582d8['message'],_0x4530d5);_0x23c992(_0x572aff[_0x550d('0x15')](0x1f4,_0x5582d8[_0x550d('0x17')]));});});};exports[_0x550d('0x22')]=function(_0x5bc8f1){var _0x3a5805=this;return new Promise(function(_0x391fdd,_0x3e7618){return db[_0x550d('0x23')]['find']({'raw':_0x5bc8f1['options']?_0x5bc8f1[_0x550d('0x1c')][_0x550d('0x24')]===undefined?!![]:![]:!![],'where':_0x5bc8f1['options']?_0x5bc8f1[_0x550d('0x1c')][_0x550d('0x1d')]||null:null,'attributes':_0x5bc8f1['options']?_0x5bc8f1[_0x550d('0x1c')][_0x550d('0x1e')]||null:null,'include':_0x5bc8f1[_0x550d('0x1c')]?_0x5bc8f1[_0x550d('0x1c')][_0x550d('0x20')]?_['map'](_0x5bc8f1[_0x550d('0x1c')][_0x550d('0x20')],function(_0x1dcd9e){return{'model':db[_0x1dcd9e[_0x550d('0x21')]],'as':_0x1dcd9e['as'],'attributes':_0x1dcd9e['attributes'],'include':_0x1dcd9e[_0x550d('0x20')]?_['map'](_0x1dcd9e['include'],function(_0x31ae38){return{'model':db[_0x31ae38[_0x550d('0x21')]],'as':_0x31ae38['as'],'attributes':_0x31ae38[_0x550d('0x1e')],'include':_0x31ae38[_0x550d('0x20')]?_['map'](_0x31ae38['include'],function(_0x3a9918){return{'model':db[_0x3a9918[_0x550d('0x21')]],'as':_0x3a9918['as'],'attributes':_0x3a9918[_0x550d('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x550d('0xf')](function(_0x38e5d2){logger['info'](_0x550d('0x22'),_0x5bc8f1);logger[_0x550d('0x12')](_0x550d('0x22'),_0x5bc8f1,JSON[_0x550d('0x14')](_0x38e5d2));_0x391fdd(_0x38e5d2);})[_0x550d('0x19')](function(_0x2f9fb5){logger['error'](_0x550d('0x22'),_0x2f9fb5[_0x550d('0x17')],_0x5bc8f1);_0x3e7618(_0x3a5805[_0x550d('0x15')](0x1f4,_0x2f9fb5[_0x550d('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index f6472f6..5df6de4 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 _0x624a=['update','length','mailQueue:','save'];(function(_0x4303ca,_0x5048fc){var _0x24432b=function(_0x34ba7a){while(--_0x34ba7a){_0x4303ca['push'](_0x4303ca['shift']());}};_0x24432b(++_0x5048fc);}(_0x624a,0x143));var _0xa624=function(_0x188360,_0x3d93f8){_0x188360=_0x188360-0x0;var _0x1fbe6d=_0x624a[_0x188360];return _0x1fbe6d;};'use strict';var MailQueueEvents=require('./mailQueue.events');var events=[_0xa624('0x0'),'remove',_0xa624('0x1')];function createListener(_0x1416d5,_0x3c3b84){return function(_0x181763){_0x3c3b84['emit'](_0x1416d5,_0x181763);};}function removeListener(_0x5d780c,_0xfd44e6){return function(){MailQueueEvents['removeListener'](_0x5d780c,_0xfd44e6);};}exports['register']=function(_0xc64879){for(var _0x51d98f=0x0,_0x545c59=events[_0xa624('0x2')];_0x51d98f<_0x545c59;_0x51d98f++){var _0x2cce16=events[_0x51d98f];var _0x18f597=createListener(_0xa624('0x3')+_0x2cce16,_0xc64879);MailQueueEvents['on'](_0x2cce16,_0x18f597);}}; \ No newline at end of file +var _0x0c29=['./mailQueue.events','remove','update','removeListener','register','length','mailQueue:'];(function(_0x528329,_0x5219ec){var _0x561a87=function(_0x444c24){while(--_0x444c24){_0x528329['push'](_0x528329['shift']());}};_0x561a87(++_0x5219ec);}(_0x0c29,0x69));var _0x90c2=function(_0x47f719,_0x2e559d){_0x47f719=_0x47f719-0x0;var _0x407f4e=_0x0c29[_0x47f719];return _0x407f4e;};'use strict';var MailQueueEvents=require(_0x90c2('0x0'));var events=['save',_0x90c2('0x1'),_0x90c2('0x2')];function createListener(_0x3e7c1e,_0x102068){return function(_0x4e27b6){_0x102068['emit'](_0x3e7c1e,_0x4e27b6);};}function removeListener(_0x5125b3,_0x23cd26){return function(){MailQueueEvents[_0x90c2('0x3')](_0x5125b3,_0x23cd26);};}exports[_0x90c2('0x4')]=function(_0x56e6da){for(var _0x47fd4d=0x0,_0x30ba30=events[_0x90c2('0x5')];_0x47fd4d<_0x30ba30;_0x47fd4d++){var _0x14b516=events[_0x47fd4d];var _0xed30ba=createListener(_0x90c2('0x6')+_0x14b516,_0x56e6da);MailQueueEvents['on'](_0x14b516,_0xed30ba);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 97c1a3b..a78d97a 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 _0x3c6e=['./mailQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','create','put','update','delete','destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x3decc4,_0x4842d9){var _0x2b62dd=function(_0xaddf98){while(--_0xaddf98){_0x3decc4['push'](_0x3decc4['shift']());}};_0x2b62dd(++_0x4842d9);}(_0x3c6e,0x125));var _0xe3c6=function(_0x45502d,_0x5ca8b7){_0x45502d=_0x45502d-0x0;var _0x8813c9=_0x3c6e[_0x45502d];return _0x8813c9;};'use strict';var multer=require(_0xe3c6('0x0'));var util=require(_0xe3c6('0x1'));var path=require(_0xe3c6('0x2'));var timeout=require('connect-timeout');var express=require(_0xe3c6('0x3'));var router=express[_0xe3c6('0x4')]();var fs_extra=require(_0xe3c6('0x5'));var auth=require(_0xe3c6('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xe3c6('0x7'));router[_0xe3c6('0x8')]('/',auth[_0xe3c6('0x9')](),controller[_0xe3c6('0xa')]);router['get'](_0xe3c6('0xb'),auth[_0xe3c6('0x9')](),controller[_0xe3c6('0xc')]);router[_0xe3c6('0x8')](_0xe3c6('0xd'),auth['isAuthenticated'](),controller[_0xe3c6('0xe')]);router['post']('/',auth[_0xe3c6('0x9')](),controller[_0xe3c6('0xf')]);router[_0xe3c6('0x10')](_0xe3c6('0xd'),auth['isAuthenticated'](),controller[_0xe3c6('0x11')]);router[_0xe3c6('0x12')](_0xe3c6('0xd'),auth[_0xe3c6('0x9')](),controller[_0xe3c6('0x13')]);module['exports']=router; \ No newline at end of file +var _0x9774=['connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','/:id','show','create','put','update','delete','destroy','exports','multer','util','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9774,0x9d));var _0x4977=function(_0x47863a,_0x56c84e){_0x47863a=_0x47863a-0x0;var _0x1c2aca=_0x9774[_0x47863a];return _0x1c2aca;};'use strict';var multer=require(_0x4977('0x0'));var util=require(_0x4977('0x1'));var path=require(_0x4977('0x2'));var timeout=require(_0x4977('0x3'));var express=require('express');var router=express[_0x4977('0x4')]();var fs_extra=require(_0x4977('0x5'));var auth=require(_0x4977('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x4977('0x7'));var controller=require('./mailQueueReport.controller');router[_0x4977('0x8')]('/',auth[_0x4977('0x9')](),controller[_0x4977('0xa')]);router[_0x4977('0x8')](_0x4977('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0x4977('0x8')](_0x4977('0xc'),auth[_0x4977('0x9')](),controller[_0x4977('0xd')]);router['post']('/',auth[_0x4977('0x9')](),controller[_0x4977('0xe')]);router[_0x4977('0xf')]('/:id',auth[_0x4977('0x9')](),controller[_0x4977('0x10')]);router[_0x4977('0x11')](_0x4977('0xc'),auth['isAuthenticated'](),controller[_0x4977('0x12')]);module[_0x4977('0x13')]=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index 0105db9..d00594b 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 _0x516a=['STRING','DATE','moment','exports'];(function(_0x363ca5,_0x35d48b){var _0x42b35a=function(_0x4ebe82){while(--_0x4ebe82){_0x363ca5['push'](_0x363ca5['shift']());}};_0x42b35a(++_0x35d48b);}(_0x516a,0x1c6));var _0xa516=function(_0x3c8e81,_0x2ec301){_0x3c8e81=_0x3c8e81-0x0;var _0x1c07de=_0x516a[_0x3c8e81];return _0x1c07de;};'use strict';var moment=require(_0xa516('0x0'));var Sequelize=require('sequelize');module[_0xa516('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xa516('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xa516('0x3')]},'acceptAt':{'type':Sequelize[_0xa516('0x3')]},'exitAt':{'type':Sequelize[_0xa516('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xd1a3=['exports','STRING','DATE','sequelize'];(function(_0x5f2927,_0x4812b1){var _0x3196e2=function(_0x4db2e3){while(--_0x4db2e3){_0x5f2927['push'](_0x5f2927['shift']());}};_0x3196e2(++_0x4812b1);}(_0xd1a3,0xc3));var _0x3d1a=function(_0x1c5983,_0x1d545c){_0x1c5983=_0x1c5983-0x0;var _0x49619d=_0xd1a3[_0x1c5983];return _0x49619d;};'use strict';var moment=require('moment');var Sequelize=require(_0x3d1a('0x0'));module[_0x3d1a('0x1')]={'uniqueid':{'type':Sequelize[_0x3d1a('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x3d1a('0x2')]},'joinAt':{'type':Sequelize[_0x3d1a('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x3d1a('0x3')]},'reason':{'type':Sequelize[_0x3d1a('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index ea48808..ce01310 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 _0x4137=['key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','include','findAll','show','params','includeAll','options','find','catch','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','status','json','offset','limit','count','set','apply','reject','save','update','destroy','then','end','sendStatus','error','name','send','index','map','MailQueueReport','rawAttributes','type'];(function(_0x25fded,_0x34216e){var _0x269156=function(_0x190fe0){while(--_0x190fe0){_0x25fded['push'](_0x25fded['shift']());}};_0x269156(++_0x34216e);}(_0x4137,0xf8));var _0x7413=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x4137[_0x40a045];return _0x1a687c;};'use strict';var emlformat=require(_0x7413('0x0'));var rimraf=require(_0x7413('0x1'));var zipdir=require(_0x7413('0x2'));var jsonpatch=require(_0x7413('0x3'));var rp=require(_0x7413('0x4'));var moment=require(_0x7413('0x5'));var BPromise=require(_0x7413('0x6'));var Mustache=require(_0x7413('0x7'));var util=require(_0x7413('0x8'));var path=require(_0x7413('0x9'));var sox=require(_0x7413('0xa'));var csv=require(_0x7413('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7413('0xc'));var _=require(_0x7413('0xd'));var squel=require(_0x7413('0xe'));var crypto=require(_0x7413('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x7413('0x10'));var toCsv=require(_0x7413('0xb'));var querystring=require('querystring');var Papa=require(_0x7413('0x11'));var Redis=require(_0x7413('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x7413('0x13'));var as=require(_0x7413('0x14'));var hardwareService=require(_0x7413('0x15'));var logger=require(_0x7413('0x16'))(_0x7413('0x17'));var utils=require('../../config/utils');var config=require(_0x7413('0x18'));var licenseUtil=require(_0x7413('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x18a874,_0xa26ca4){_0xa26ca4=_0xa26ca4||0xcc;return function(_0x13e6bd){if(_0x13e6bd){return _0x18a874['sendStatus'](_0xa26ca4);}return _0x18a874['status'](_0xa26ca4)['end']();};}function respondWithResult(_0x2267f6,_0x336c4c){_0x336c4c=_0x336c4c||0xc8;return function(_0x49f0f6){if(_0x49f0f6){return _0x2267f6[_0x7413('0x1a')](_0x336c4c)[_0x7413('0x1b')](_0x49f0f6);}};}function respondWithFilteredResult(_0x4955d3,_0x38b3d1){return function(_0x50f301){if(_0x50f301){var _0x4b9a5b=typeof _0x38b3d1[_0x7413('0x1c')]==='undefined'&&typeof _0x38b3d1[_0x7413('0x1d')]==='undefined';var _0x2036b6=_0x50f301[_0x7413('0x1e')];var _0x19157f=_0x4b9a5b?0x0:_0x38b3d1[_0x7413('0x1c')];var _0x2a3417=_0x4b9a5b?_0x50f301[_0x7413('0x1e')]:_0x38b3d1['offset']+_0x38b3d1[_0x7413('0x1d')];var _0x17c062;if(_0x2a3417>=_0x2036b6){_0x2a3417=_0x2036b6;_0x17c062=0xc8;}else{_0x17c062=0xce;}_0x4955d3[_0x7413('0x1a')](_0x17c062);return _0x4955d3[_0x7413('0x1f')]('Content-Range',_0x19157f+'-'+_0x2a3417+'/'+_0x2036b6)[_0x7413('0x1b')](_0x50f301);}return null;};}function patchUpdates(_0x12d94d){return function(_0x206afc){try{jsonpatch[_0x7413('0x20')](_0x206afc,_0x12d94d,!![]);}catch(_0x409392){return BPromise[_0x7413('0x21')](_0x409392);}return _0x206afc[_0x7413('0x22')]();};}function saveUpdates(_0x4e18cb,_0x56a06a){return function(_0x5f12a2){if(_0x5f12a2){return _0x5f12a2[_0x7413('0x23')](_0x4e18cb)['then'](function(_0x1585ba){return _0x1585ba;});}return null;};}function removeEntity(_0x372944,_0x3b0c81){return function(_0x2fc0f4){if(_0x2fc0f4){return _0x2fc0f4[_0x7413('0x24')]()[_0x7413('0x25')](function(){_0x372944[_0x7413('0x1a')](0xcc)[_0x7413('0x26')]();});}};}function handleEntityNotFound(_0x1d455b,_0x5a8329){return function(_0x5cb15f){if(!_0x5cb15f){_0x1d455b[_0x7413('0x27')](0x194);}return _0x5cb15f;};}function handleError(_0x48c2dc,_0x46c895){_0x46c895=_0x46c895||0x1f4;return function(_0x71cbb4){logger[_0x7413('0x28')](_0x71cbb4['stack']);if(_0x71cbb4[_0x7413('0x29')]){delete _0x71cbb4[_0x7413('0x29')];}_0x48c2dc[_0x7413('0x1a')](_0x46c895)[_0x7413('0x2a')](_0x71cbb4);};}exports[_0x7413('0x2b')]=function(_0x2e521f,_0x5eb4d9){var _0x24dce7={},_0x4ed662={},_0x1d0bde={'count':0x0,'rows':[]};var _0x23e682=_[_0x7413('0x2c')](db[_0x7413('0x2d')][_0x7413('0x2e')],function(_0x2004ea){return{'name':_0x2004ea['fieldName'],'type':_0x2004ea[_0x7413('0x2f')][_0x7413('0x30')]};});_0x4ed662[_0x7413('0x31')]=_[_0x7413('0x2c')](_0x23e682,_0x7413('0x29'));_0x4ed662[_0x7413('0x32')]=_[_0x7413('0x33')](_0x2e521f['query']);_0x4ed662[_0x7413('0x34')]=_[_0x7413('0x35')](_0x4ed662[_0x7413('0x31')],_0x4ed662[_0x7413('0x32')]);_0x24dce7[_0x7413('0x36')]=_['intersection'](_0x4ed662[_0x7413('0x31')],qs['fields'](_0x2e521f[_0x7413('0x32')][_0x7413('0x37')]));_0x24dce7[_0x7413('0x36')]=_0x24dce7['attributes'][_0x7413('0x38')]?_0x24dce7['attributes']:_0x4ed662[_0x7413('0x31')];if(!_0x2e521f[_0x7413('0x32')]['hasOwnProperty']('nolimit')){_0x24dce7[_0x7413('0x1d')]=qs[_0x7413('0x1d')](_0x2e521f[_0x7413('0x32')]['limit']);_0x24dce7['offset']=qs[_0x7413('0x1c')](_0x2e521f['query']['offset']);}_0x24dce7[_0x7413('0x39')]=qs['sort'](_0x2e521f[_0x7413('0x32')][_0x7413('0x3a')]);_0x24dce7[_0x7413('0x3b')]=qs[_0x7413('0x34')](_[_0x7413('0x3c')](_0x2e521f['query'],_0x4ed662[_0x7413('0x34')]),_0x23e682);if(_0x2e521f[_0x7413('0x32')][_0x7413('0x3d')]){_0x24dce7[_0x7413('0x3b')]=_[_0x7413('0x3e')](_0x24dce7[_0x7413('0x3b')],{'$or':_[_0x7413('0x2c')](_0x23e682,function(_0x385156){if(_0x385156[_0x7413('0x2f')]!==_0x7413('0x3f')){var _0x5c03eb={};_0x5c03eb[_0x385156[_0x7413('0x29')]]={'$like':'%'+_0x2e521f['query'][_0x7413('0x3d')]+'%'};return _0x5c03eb;}})});}_0x24dce7=_['merge']({},_0x24dce7,_0x2e521f['options']);var _0x5b592c={'where':_0x24dce7['where']};return db['MailQueueReport'][_0x7413('0x1e')](_0x5b592c)['then'](function(_0x535e49){_0x1d0bde[_0x7413('0x1e')]=_0x535e49;if(_0x2e521f['query']['includeAll']){_0x24dce7[_0x7413('0x40')]=[{'all':!![]}];}return db[_0x7413('0x2d')][_0x7413('0x41')](_0x24dce7);})[_0x7413('0x25')](function(_0x8049c0){_0x1d0bde['rows']=_0x8049c0;return _0x1d0bde;})[_0x7413('0x25')](respondWithFilteredResult(_0x5eb4d9,_0x24dce7))['catch'](handleError(_0x5eb4d9,null));};exports[_0x7413('0x42')]=function(_0x1d8219,_0xa063d1){var _0xfe0daa={'raw':!![],'where':{'id':_0x1d8219[_0x7413('0x43')]['id']}},_0x3f7da2={};_0x3f7da2[_0x7413('0x31')]=_[_0x7413('0x33')](db[_0x7413('0x2d')][_0x7413('0x2e')]);_0x3f7da2[_0x7413('0x32')]=_[_0x7413('0x33')](_0x1d8219[_0x7413('0x32')]);_0x3f7da2['filters']=_[_0x7413('0x35')](_0x3f7da2[_0x7413('0x31')],_0x3f7da2[_0x7413('0x32')]);_0xfe0daa[_0x7413('0x36')]=_[_0x7413('0x35')](_0x3f7da2[_0x7413('0x31')],qs[_0x7413('0x37')](_0x1d8219[_0x7413('0x32')][_0x7413('0x37')]));_0xfe0daa[_0x7413('0x36')]=_0xfe0daa[_0x7413('0x36')]['length']?_0xfe0daa[_0x7413('0x36')]:_0x3f7da2['model'];if(_0x1d8219[_0x7413('0x32')][_0x7413('0x44')]){_0xfe0daa[_0x7413('0x40')]=[{'all':!![]}];}_0xfe0daa=_[_0x7413('0x3e')]({},_0xfe0daa,_0x1d8219[_0x7413('0x45')]);return db[_0x7413('0x2d')][_0x7413('0x46')](_0xfe0daa)[_0x7413('0x25')](handleEntityNotFound(_0xa063d1,null))[_0x7413('0x25')](respondWithResult(_0xa063d1,null))[_0x7413('0x47')](handleError(_0xa063d1,null));};exports['create']=function(_0x513657,_0x3c1f1a){return db['MailQueueReport']['create'](_0x513657[_0x7413('0x48')],{})[_0x7413('0x25')](respondWithResult(_0x3c1f1a,0xc9))['catch'](handleError(_0x3c1f1a,null));};exports[_0x7413('0x23')]=function(_0x586d25,_0x562bae){if(_0x586d25[_0x7413('0x48')]['id']){delete _0x586d25['body']['id'];}return db[_0x7413('0x2d')][_0x7413('0x46')]({'where':{'id':_0x586d25[_0x7413('0x43')]['id']}})[_0x7413('0x25')](handleEntityNotFound(_0x562bae,null))[_0x7413('0x25')](saveUpdates(_0x586d25[_0x7413('0x48')],null))[_0x7413('0x25')](respondWithResult(_0x562bae,null))[_0x7413('0x47')](handleError(_0x562bae,null));};exports[_0x7413('0x24')]=function(_0x2031e3,_0x50a27d){return db[_0x7413('0x2d')]['find']({'where':{'id':_0x2031e3['params']['id']}})['then'](handleEntityNotFound(_0x50a27d,null))[_0x7413('0x25')](removeEntity(_0x50a27d,null))[_0x7413('0x47')](handleError(_0x50a27d,null));};exports[_0x7413('0x49')]=function(_0x1ba4e9,_0x4bc337){return db['MailQueueReport'][_0x7413('0x49')]()['then'](respondWithResult(_0x4bc337,null))[_0x7413('0x47')](handleError(_0x4bc337,null));}; \ No newline at end of file +var _0x4325=['attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','options','includeAll','MailQueueReport','findAll','catch','show','params','include','find','create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','util','path','sox','ejs','fs-extra','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../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','key','model','map','query','keys','filters','intersection'];(function(_0xf50820,_0x56f041){var _0x2a9b10=function(_0x33f0f4){while(--_0x33f0f4){_0xf50820['push'](_0xf50820['shift']());}};_0x2a9b10(++_0x56f041);}(_0x4325,0x1da));var _0x5432=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x4325[_0x3ab51d];return _0x29a04e;};'use strict';var emlformat=require(_0x5432('0x0'));var rimraf=require(_0x5432('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5432('0x2'));var rp=require(_0x5432('0x3'));var moment=require(_0x5432('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x5432('0x5'));var path=require(_0x5432('0x6'));var sox=require(_0x5432('0x7'));var csv=require('to-csv');var ejs=require(_0x5432('0x8'));var fs=require('fs');var fs_extra=require(_0x5432('0x9'));var _=require('lodash');var squel=require(_0x5432('0xa'));var crypto=require('crypto');var jsforce=require(_0x5432('0xb'));var deskjs=require(_0x5432('0xc'));var toCsv=require(_0x5432('0xd'));var querystring=require(_0x5432('0xe'));var Papa=require(_0x5432('0xf'));var Redis=require('ioredis');var authService=require(_0x5432('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x5432('0x11'));var hardwareService=require(_0x5432('0x12'));var logger=require(_0x5432('0x13'))(_0x5432('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x5432('0x15'));var db=require(_0x5432('0x16'))['db'];function respondWithStatusCode(_0x5366a0,_0x10a289){_0x10a289=_0x10a289||0xcc;return function(_0x111c54){if(_0x111c54){return _0x5366a0[_0x5432('0x17')](_0x10a289);}return _0x5366a0[_0x5432('0x18')](_0x10a289)[_0x5432('0x19')]();};}function respondWithResult(_0x1a084d,_0x54f41a){_0x54f41a=_0x54f41a||0xc8;return function(_0x5617ce){if(_0x5617ce){return _0x1a084d[_0x5432('0x18')](_0x54f41a)[_0x5432('0x1a')](_0x5617ce);}};}function respondWithFilteredResult(_0x3859d1,_0x364152){return function(_0x9d2023){if(_0x9d2023){var _0x11db3c=typeof _0x364152['offset']===_0x5432('0x1b')&&typeof _0x364152['limit']===_0x5432('0x1b');var _0x3de07a=_0x9d2023[_0x5432('0x1c')];var _0x32fe60=_0x11db3c?0x0:_0x364152[_0x5432('0x1d')];var _0x5f011f=_0x11db3c?_0x9d2023[_0x5432('0x1c')]:_0x364152[_0x5432('0x1d')]+_0x364152[_0x5432('0x1e')];var _0x2bfe04;if(_0x5f011f>=_0x3de07a){_0x5f011f=_0x3de07a;_0x2bfe04=0xc8;}else{_0x2bfe04=0xce;}_0x3859d1[_0x5432('0x18')](_0x2bfe04);return _0x3859d1[_0x5432('0x1f')](_0x5432('0x20'),_0x32fe60+'-'+_0x5f011f+'/'+_0x3de07a)['json'](_0x9d2023);}return null;};}function patchUpdates(_0x66911a){return function(_0x29cde7){try{jsonpatch[_0x5432('0x21')](_0x29cde7,_0x66911a,!![]);}catch(_0xa6c864){return BPromise[_0x5432('0x22')](_0xa6c864);}return _0x29cde7['save']();};}function saveUpdates(_0x5901e2,_0x4d09cd){return function(_0x61827e){if(_0x61827e){return _0x61827e[_0x5432('0x23')](_0x5901e2)[_0x5432('0x24')](function(_0x1f4870){return _0x1f4870;});}return null;};}function removeEntity(_0x4af9f6,_0x4af5f4){return function(_0x3e0b66){if(_0x3e0b66){return _0x3e0b66[_0x5432('0x25')]()['then'](function(){_0x4af9f6[_0x5432('0x18')](0xcc)[_0x5432('0x19')]();});}};}function handleEntityNotFound(_0x637582,_0x4b6ea5){return function(_0xd9928a){if(!_0xd9928a){_0x637582[_0x5432('0x17')](0x194);}return _0xd9928a;};}function handleError(_0xe7eda2,_0x520da1){_0x520da1=_0x520da1||0x1f4;return function(_0x4ab09d){logger[_0x5432('0x26')](_0x4ab09d[_0x5432('0x27')]);if(_0x4ab09d['name']){delete _0x4ab09d[_0x5432('0x28')];}_0xe7eda2[_0x5432('0x18')](_0x520da1)[_0x5432('0x29')](_0x4ab09d);};}exports['index']=function(_0x29dc15,_0x5be867){var _0x4821be={},_0x6fc7f5={},_0x4a52ba={'count':0x0,'rows':[]};var _0x428141=_['map'](db['MailQueueReport'][_0x5432('0x2a')],function(_0x21735e){return{'name':_0x21735e[_0x5432('0x2b')],'type':_0x21735e['type'][_0x5432('0x2c')]};});_0x6fc7f5[_0x5432('0x2d')]=_[_0x5432('0x2e')](_0x428141,_0x5432('0x28'));_0x6fc7f5[_0x5432('0x2f')]=_[_0x5432('0x30')](_0x29dc15[_0x5432('0x2f')]);_0x6fc7f5[_0x5432('0x31')]=_[_0x5432('0x32')](_0x6fc7f5['model'],_0x6fc7f5['query']);_0x4821be[_0x5432('0x33')]=_[_0x5432('0x32')](_0x6fc7f5[_0x5432('0x2d')],qs[_0x5432('0x34')](_0x29dc15[_0x5432('0x2f')]['fields']));_0x4821be[_0x5432('0x33')]=_0x4821be['attributes'][_0x5432('0x35')]?_0x4821be[_0x5432('0x33')]:_0x6fc7f5[_0x5432('0x2d')];if(!_0x29dc15[_0x5432('0x2f')][_0x5432('0x36')](_0x5432('0x37'))){_0x4821be['limit']=qs[_0x5432('0x1e')](_0x29dc15[_0x5432('0x2f')][_0x5432('0x1e')]);_0x4821be[_0x5432('0x1d')]=qs['offset'](_0x29dc15[_0x5432('0x2f')][_0x5432('0x1d')]);}_0x4821be[_0x5432('0x38')]=qs[_0x5432('0x39')](_0x29dc15[_0x5432('0x2f')][_0x5432('0x39')]);_0x4821be[_0x5432('0x3a')]=qs[_0x5432('0x31')](_[_0x5432('0x3b')](_0x29dc15[_0x5432('0x2f')],_0x6fc7f5[_0x5432('0x31')]),_0x428141);if(_0x29dc15[_0x5432('0x2f')][_0x5432('0x3c')]){_0x4821be[_0x5432('0x3a')]=_['merge'](_0x4821be[_0x5432('0x3a')],{'$or':_['map'](_0x428141,function(_0x6f5006){if(_0x6f5006[_0x5432('0x3d')]!==_0x5432('0x3e')){var _0x1a5561={};_0x1a5561[_0x6f5006['name']]={'$like':'%'+_0x29dc15['query']['filter']+'%'};return _0x1a5561;}})});}_0x4821be=_[_0x5432('0x3f')]({},_0x4821be,_0x29dc15[_0x5432('0x40')]);var _0x139d0a={'where':_0x4821be[_0x5432('0x3a')]};return db['MailQueueReport'][_0x5432('0x1c')](_0x139d0a)[_0x5432('0x24')](function(_0x3cd343){_0x4a52ba['count']=_0x3cd343;if(_0x29dc15[_0x5432('0x2f')][_0x5432('0x41')]){_0x4821be['include']=[{'all':!![]}];}return db[_0x5432('0x42')][_0x5432('0x43')](_0x4821be);})['then'](function(_0x23f8f4){_0x4a52ba['rows']=_0x23f8f4;return _0x4a52ba;})[_0x5432('0x24')](respondWithFilteredResult(_0x5be867,_0x4821be))[_0x5432('0x44')](handleError(_0x5be867,null));};exports[_0x5432('0x45')]=function(_0x11c7f2,_0x5cf59a){var _0x9cfb8b={'raw':!![],'where':{'id':_0x11c7f2[_0x5432('0x46')]['id']}},_0x4b93b4={};_0x4b93b4[_0x5432('0x2d')]=_[_0x5432('0x30')](db[_0x5432('0x42')][_0x5432('0x2a')]);_0x4b93b4[_0x5432('0x2f')]=_[_0x5432('0x30')](_0x11c7f2['query']);_0x4b93b4[_0x5432('0x31')]=_[_0x5432('0x32')](_0x4b93b4[_0x5432('0x2d')],_0x4b93b4[_0x5432('0x2f')]);_0x9cfb8b[_0x5432('0x33')]=_[_0x5432('0x32')](_0x4b93b4[_0x5432('0x2d')],qs['fields'](_0x11c7f2[_0x5432('0x2f')][_0x5432('0x34')]));_0x9cfb8b[_0x5432('0x33')]=_0x9cfb8b[_0x5432('0x33')][_0x5432('0x35')]?_0x9cfb8b['attributes']:_0x4b93b4[_0x5432('0x2d')];if(_0x11c7f2['query'][_0x5432('0x41')]){_0x9cfb8b[_0x5432('0x47')]=[{'all':!![]}];}_0x9cfb8b=_['merge']({},_0x9cfb8b,_0x11c7f2[_0x5432('0x40')]);return db['MailQueueReport'][_0x5432('0x48')](_0x9cfb8b)[_0x5432('0x24')](handleEntityNotFound(_0x5cf59a,null))['then'](respondWithResult(_0x5cf59a,null))['catch'](handleError(_0x5cf59a,null));};exports[_0x5432('0x49')]=function(_0xa971bd,_0x3718be){return db[_0x5432('0x42')][_0x5432('0x49')](_0xa971bd[_0x5432('0x4a')],{})[_0x5432('0x24')](respondWithResult(_0x3718be,0xc9))['catch'](handleError(_0x3718be,null));};exports[_0x5432('0x23')]=function(_0x14763c,_0x429da8){if(_0x14763c['body']['id']){delete _0x14763c['body']['id'];}return db['MailQueueReport']['find']({'where':{'id':_0x14763c[_0x5432('0x46')]['id']}})[_0x5432('0x24')](handleEntityNotFound(_0x429da8,null))[_0x5432('0x24')](saveUpdates(_0x14763c[_0x5432('0x4a')],null))[_0x5432('0x24')](respondWithResult(_0x429da8,null))['catch'](handleError(_0x429da8,null));};exports[_0x5432('0x25')]=function(_0xce691b,_0x7937f9){return db['MailQueueReport'][_0x5432('0x48')]({'where':{'id':_0xce691b[_0x5432('0x46')]['id']}})[_0x5432('0x24')](handleEntityNotFound(_0x7937f9,null))[_0x5432('0x24')](removeEntity(_0x7937f9,null))[_0x5432('0x44')](handleError(_0x7937f9,null));};exports['describe']=function(_0xbcf523,_0x5bbedb){return db[_0x5432('0x42')]['describe']()[_0x5432('0x24')](respondWithResult(_0x5bbedb,null))[_0x5432('0x44')](handleError(_0x5bbedb,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index 2a8e665..fe6436d 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 _0x97bd=['exports','define','MailQueueReport','report_mail_queue','uniqueid','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./mailQueueReport.attributes'];(function(_0x3aaf0a,_0x450970){var _0x33e6bc=function(_0x1db54d){while(--_0x1db54d){_0x3aaf0a['push'](_0x3aaf0a['shift']());}};_0x33e6bc(++_0x450970);}(_0x97bd,0x9f));var _0xd97b=function(_0x9aa4f9,_0x4c55ce){_0x9aa4f9=_0x9aa4f9-0x0;var _0x3cfd46=_0x97bd[_0x9aa4f9];return _0x3cfd46;};'use strict';var _=require(_0xd97b('0x0'));var util=require('util');var logger=require(_0xd97b('0x1'))(_0xd97b('0x2'));var moment=require('moment');var BPromise=require(_0xd97b('0x3'));var rp=require(_0xd97b('0x4'));var fs=require('fs');var path=require(_0xd97b('0x5'));var rimraf=require(_0xd97b('0x6'));var config=require(_0xd97b('0x7'));var attributes=require(_0xd97b('0x8'));module[_0xd97b('0x9')]=function(_0xbf56f2,_0x706224){return _0xbf56f2[_0xd97b('0xa')](_0xd97b('0xb'),attributes,{'tableName':_0xd97b('0xc'),'paranoid':![],'indexes':[{'name':_0xd97b('0xd'),'fields':[_0xd97b('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4b3d=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./mailQueueReport.attributes','exports','define','MailQueueReport','report_mail_queue','uniqueid','lodash','util'];(function(_0x595add,_0x15feb9){var _0x52eb1a=function(_0x32fcec){while(--_0x32fcec){_0x595add['push'](_0x595add['shift']());}};_0x52eb1a(++_0x15feb9);}(_0x4b3d,0x15c));var _0xd4b3=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x4b3d[_0x3e5086];return _0xfeb102;};'use strict';var _=require(_0xd4b3('0x0'));var util=require(_0xd4b3('0x1'));var logger=require(_0xd4b3('0x2'))('api');var moment=require(_0xd4b3('0x3'));var BPromise=require(_0xd4b3('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd4b3('0x5'));var rimraf=require(_0xd4b3('0x6'));var config=require(_0xd4b3('0x7'));var attributes=require(_0xd4b3('0x8'));module[_0xd4b3('0x9')]=function(_0x4014ca,_0x1fd406){return _0x4014ca[_0xd4b3('0xa')](_0xd4b3('0xb'),attributes,{'tableName':_0xd4b3('0xc'),'paranoid':![],'indexes':[{'name':_0xd4b3('0xd'),'fields':[_0xd4b3('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index 3da385e..df18d6f 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 _0xdb28=['UpdateMailQueueReport','MailQueueReport','update','raw','where','limit','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','CreateMailQueueReport','create','body','options'];(function(_0xdca4a6,_0x4965f6){var _0x5c5b95=function(_0x2c8fe7){while(--_0x2c8fe7){_0xdca4a6['push'](_0xdca4a6['shift']());}};_0x5c5b95(++_0x4965f6);}(_0xdb28,0x106));var _0x8db2=function(_0xd305a8,_0x4e1806){_0xd305a8=_0xd305a8-0x0;var _0x20691f=_0xdb28[_0xd305a8];return _0x20691f;};'use strict';var _=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var moment=require(_0x8db2('0x2'));var BPromise=require(_0x8db2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8db2('0x4'));var db=require(_0x8db2('0x5'))['db'];var utils=require(_0x8db2('0x6'));var logger=require(_0x8db2('0x7'))(_0x8db2('0x8'));var config=require('../../config/environment');var jayson=require(_0x8db2('0x9'));var client=jayson[_0x8db2('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x494b40,_0x477f50,_0x46932f){return new BPromise(function(_0x131537,_0x29f698){return client[_0x8db2('0xb')](_0x494b40,_0x46932f)[_0x8db2('0xc')](function(_0x126c78){logger['info'](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));logger[_0x8db2('0xf')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x477f50,_0x8db2('0xe'),JSON[_0x8db2('0x10')](_0x126c78));if(_0x126c78['error']){if(_0x126c78[_0x8db2('0x11')][_0x8db2('0x12')]===0x1f4){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')]['message']);return _0x29f698(_0x126c78['error'][_0x8db2('0x13')]);}logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);return _0x131537(_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);}else{logger[_0x8db2('0x14')](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));_0x131537(_0x126c78['result'][_0x8db2('0x13')]);}})[_0x8db2('0x15')](function(_0x48101e){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x48101e);_0x29f698(_0x48101e);});});}exports[_0x8db2('0x16')]=function(_0x3fddc2){var _0x2efd06=this;return new Promise(function(_0x46ce14,_0x51d60d){return db['MailQueueReport'][_0x8db2('0x17')](_0x3fddc2[_0x8db2('0x18')],{'raw':_0x3fddc2[_0x8db2('0x19')]?_0x3fddc2[_0x8db2('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x8db2('0xc')](function(_0x36a9ff){logger[_0x8db2('0x14')](_0x8db2('0x16'),_0x3fddc2);logger[_0x8db2('0xf')]('CreateMailQueueReport',_0x3fddc2,JSON[_0x8db2('0x10')](_0x36a9ff));_0x46ce14(_0x36a9ff);})[_0x8db2('0x15')](function(_0x18f69c){logger[_0x8db2('0x11')](_0x8db2('0x16'),_0x18f69c[_0x8db2('0x13')],_0x3fddc2);_0x51d60d(_0x2efd06[_0x8db2('0x11')](0x1f4,_0x18f69c['message']));});});};exports[_0x8db2('0x1a')]=function(_0x4f6516){var _0x5725f0=this;return new Promise(function(_0x52a9ca,_0x4d923c){return db[_0x8db2('0x1b')][_0x8db2('0x1c')](_0x4f6516[_0x8db2('0x18')],{'raw':_0x4f6516[_0x8db2('0x19')]?_0x4f6516[_0x8db2('0x19')][_0x8db2('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4f6516['options']?_0x4f6516[_0x8db2('0x19')][_0x8db2('0x1e')]||null:null,'attributes':_0x4f6516[_0x8db2('0x19')]?_0x4f6516[_0x8db2('0x19')]['attributes']||null:null,'limit':_0x4f6516[_0x8db2('0x19')]?_0x4f6516[_0x8db2('0x19')][_0x8db2('0x1f')]||null:null})[_0x8db2('0xc')](function(_0xbe5ece){logger[_0x8db2('0x14')](_0x8db2('0x1a'),_0x4f6516);logger[_0x8db2('0xf')](_0x8db2('0x1a'),_0x4f6516,JSON['stringify'](_0xbe5ece));_0x52a9ca(_0xbe5ece);})[_0x8db2('0x15')](function(_0x50b28d){logger['error'](_0x8db2('0x1a'),_0x50b28d[_0x8db2('0x13')],_0x4f6516);_0x4d923c(_0x5725f0[_0x8db2('0x11')](0x1f4,_0x50b28d['message']));});});}; \ 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(_0x3f4f4c,_0x152171){var _0x3d48b3=function(_0x18a8a4){while(--_0x18a8a4){_0x3f4f4c['push'](_0x3f4f4c['shift']());}};_0x3d48b3(++_0x152171);}(_0x2ef3,0xba));var _0x32ef=function(_0x38a99a,_0x5dc797){_0x38a99a=_0x38a99a-0x0;var _0x3b6445=_0x2ef3[_0x38a99a];return _0x3b6445;};'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 0e09f88..b3b0f19 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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x36a474,_0x23006f){var _0x3db5e6=function(_0x451a36){while(--_0x451a36){_0x36a474['push'](_0x36a474['shift']());}};_0x3db5e6(++_0x23006f);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file +var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x564b7f,_0x162734){var _0x194ae6=function(_0x25fe6b){while(--_0x25fe6b){_0x564b7f['push'](_0x564b7f['shift']());}};_0x194ae6(++_0x162734);}(_0xa9e0,0x123));var _0x0a9e=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0xa9e0[_0xae7c2f];return _0x5d7001;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index d73bba6..5dec8bc 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 _0x0102=['exports','STRING','BOOLEAN','INBOX','INTEGER'];(function(_0x1906c1,_0x5ed839){var _0x32d21c=function(_0x596b9d){while(--_0x596b9d){_0x1906c1['push'](_0x1906c1['shift']());}};_0x32d21c(++_0x5ed839);}(_0x0102,0x186));var _0x2010=function(_0x3920ee,_0x2262d0){_0x3920ee=_0x3920ee-0x0;var _0x7f8f84=_0x0102[_0x3920ee];return _0x7f8f84;};'use strict';var Sequelize=require('sequelize');module[_0x2010('0x0')]={'description':{'type':Sequelize[_0x2010('0x1')]},'host':{'type':Sequelize[_0x2010('0x1')]},'authentication':{'type':Sequelize[_0x2010('0x2')],'defaultValue':!![]},'user':{'type':Sequelize['STRING']},'password':{'type':Sequelize['STRING']},'port':{'type':Sequelize['INTEGER']},'tls':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'mailbox':{'type':Sequelize['STRING'],'defaultValue':_0x2010('0x3')},'connTimeout':{'type':Sequelize[_0x2010('0x4')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x2010('0x4')],'defaultValue':0x5},'service':{'type':Sequelize[_0x2010('0x1')]}}; \ No newline at end of file +var _0x777d=['INTEGER','exports','STRING','INBOX'];(function(_0x5c9865,_0x1a299a){var _0x54c22b=function(_0x538537){while(--_0x538537){_0x5c9865['push'](_0x5c9865['shift']());}};_0x54c22b(++_0x1a299a);}(_0x777d,0xe9));var _0xd777=function(_0x31688a,_0x588c7d){_0x31688a=_0x31688a-0x0;var _0xc7b088=_0x777d[_0x31688a];return _0xc7b088;};'use strict';var Sequelize=require('sequelize');module[_0xd777('0x0')]={'description':{'type':Sequelize[_0xd777('0x1')]},'host':{'type':Sequelize[_0xd777('0x1')]},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'user':{'type':Sequelize[_0xd777('0x1')]},'password':{'type':Sequelize[_0xd777('0x1')]},'port':{'type':Sequelize['INTEGER']},'tls':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'mailbox':{'type':Sequelize['STRING'],'defaultValue':_0xd777('0x2')},'connTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0xd777('0x3')],'defaultValue':0x5},'service':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index 605b8db..3c937a3 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 _0xfa08=['mail_servers_in','lodash','util','api','moment','bluebird','path','rimraf','./mailServerIn.attributes'];(function(_0x32e264,_0x41cee8){var _0x1d7175=function(_0x5913d9){while(--_0x5913d9){_0x32e264['push'](_0x32e264['shift']());}};_0x1d7175(++_0x41cee8);}(_0xfa08,0x9a));var _0x8fa0=function(_0x57ef21,_0x3b271a){_0x57ef21=_0x57ef21-0x0;var _0xe86568=_0xfa08[_0x57ef21];return _0xe86568;};'use strict';var _=require(_0x8fa0('0x0'));var util=require(_0x8fa0('0x1'));var logger=require('../../config/logger')(_0x8fa0('0x2'));var moment=require(_0x8fa0('0x3'));var BPromise=require(_0x8fa0('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8fa0('0x5'));var rimraf=require(_0x8fa0('0x6'));var config=require('../../config/environment');var attributes=require(_0x8fa0('0x7'));module['exports']=function(_0x411d11,_0x3e0af3){return _0x411d11['define']('MailServerIn',attributes,{'tableName':_0x8fa0('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf206=['./mailServerIn.attributes','define','mail_servers_in','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x2fd4d8,_0x2672dd){var _0x4ff832=function(_0x443ab2){while(--_0x443ab2){_0x2fd4d8['push'](_0x2fd4d8['shift']());}};_0x4ff832(++_0x2672dd);}(_0xf206,0x1a5));var _0x6f20=function(_0x4c1667,_0x22c05d){_0x4c1667=_0x4c1667-0x0;var _0x386073=_0xf206[_0x4c1667];return _0x386073;};'use strict';var _=require(_0x6f20('0x0'));var util=require(_0x6f20('0x1'));var logger=require(_0x6f20('0x2'))(_0x6f20('0x3'));var moment=require('moment');var BPromise=require(_0x6f20('0x4'));var rp=require(_0x6f20('0x5'));var fs=require('fs');var path=require(_0x6f20('0x6'));var rimraf=require(_0x6f20('0x7'));var config=require('../../config/environment');var attributes=require(_0x6f20('0x8'));module['exports']=function(_0x47f94b,_0x261353){return _0x47f94b[_0x6f20('0x9')]('MailServerIn',attributes,{'tableName':_0x6f20('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.rpc.js b/server/api/mailServerIn/mailServerIn.rpc.js index 56c4fc2..3adc0bf 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 _0x7a4f=['GetMailServerIn','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','info','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','MailServerIn','findAll','options','attributes','limit','include','map','model'];(function(_0x2e0ffa,_0x451f12){var _0x24d627=function(_0x4d0f09){while(--_0x4d0f09){_0x2e0ffa['push'](_0x2e0ffa['shift']());}};_0x24d627(++_0x451f12);}(_0x7a4f,0x17a));var _0xf7a4=function(_0x111e94,_0x31c837){_0x111e94=_0x111e94-0x0;var _0x3de107=_0x7a4f[_0x111e94];return _0x3de107;};'use strict';var _=require('lodash');var util=require(_0xf7a4('0x0'));var moment=require(_0xf7a4('0x1'));var BPromise=require('bluebird');var rs=require(_0xf7a4('0x2'));var fs=require('fs');var Redis=require(_0xf7a4('0x3'));var db=require(_0xf7a4('0x4'))['db'];var utils=require(_0xf7a4('0x5'));var logger=require('../../config/logger')(_0xf7a4('0x6'));var config=require('../../config/environment');var jayson=require(_0xf7a4('0x7'));var client=jayson[_0xf7a4('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x28e789,_0x281e16,_0x1b919c){return new BPromise(function(_0x18e386,_0x166bdd){return client[_0xf7a4('0x9')](_0x28e789,_0x1b919c)[_0xf7a4('0xa')](function(_0x42dfb3){logger[_0xf7a4('0xb')](_0xf7a4('0xc'),_0x281e16,_0xf7a4('0xd'));logger[_0xf7a4('0xe')]('MailServerIn,\x20%s,\x20%s,\x20%s',_0x281e16,_0xf7a4('0xd'),JSON[_0xf7a4('0xf')](_0x42dfb3));if(_0x42dfb3['error']){if(_0x42dfb3[_0xf7a4('0x10')][_0xf7a4('0x11')]===0x1f4){logger['error'](_0xf7a4('0xc'),_0x281e16,_0x42dfb3[_0xf7a4('0x10')][_0xf7a4('0x12')]);return _0x166bdd(_0x42dfb3[_0xf7a4('0x10')][_0xf7a4('0x12')]);}logger[_0xf7a4('0x10')](_0xf7a4('0xc'),_0x281e16,_0x42dfb3[_0xf7a4('0x10')][_0xf7a4('0x12')]);return _0x18e386(_0x42dfb3['error'][_0xf7a4('0x12')]);}else{logger[_0xf7a4('0xb')]('MailServerIn,\x20%s,\x20%s',_0x281e16,_0xf7a4('0xd'));_0x18e386(_0x42dfb3['result'][_0xf7a4('0x12')]);}})[_0xf7a4('0x13')](function(_0x53faae){logger['error'](_0xf7a4('0xc'),_0x281e16,_0x53faae);_0x166bdd(_0x53faae);});});}exports['GetMailServerIn']=function(_0x3d8f93){var _0x5b720b=this;return new Promise(function(_0xd2cd6f,_0x1ff24d){return db[_0xf7a4('0x14')][_0xf7a4('0x15')]({'raw':_0x3d8f93[_0xf7a4('0x16')]?_0x3d8f93[_0xf7a4('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x3d8f93[_0xf7a4('0x16')]?_0x3d8f93[_0xf7a4('0x16')]['where']||null:null,'attributes':_0x3d8f93[_0xf7a4('0x16')]?_0x3d8f93[_0xf7a4('0x16')][_0xf7a4('0x17')]||null:null,'limit':_0x3d8f93[_0xf7a4('0x16')]?_0x3d8f93['options'][_0xf7a4('0x18')]||null:null,'include':_0x3d8f93['options']?_0x3d8f93[_0xf7a4('0x16')][_0xf7a4('0x19')]?_[_0xf7a4('0x1a')](_0x3d8f93[_0xf7a4('0x16')][_0xf7a4('0x19')],function(_0x299a04){return{'model':db[_0x299a04['model']],'as':_0x299a04['as'],'attributes':_0x299a04[_0xf7a4('0x17')],'include':_0x299a04['include']?_[_0xf7a4('0x1a')](_0x299a04[_0xf7a4('0x19')],function(_0x5e3298){return{'model':db[_0x5e3298[_0xf7a4('0x1b')]],'as':_0x5e3298['as'],'attributes':_0x5e3298[_0xf7a4('0x17')],'include':_0x5e3298[_0xf7a4('0x19')]?_[_0xf7a4('0x1a')](_0x5e3298[_0xf7a4('0x19')],function(_0x39c784){return{'model':db[_0x39c784['model']],'as':_0x39c784['as'],'attributes':_0x39c784['attributes']};}):[]};}):[]};}):[]:[]})[_0xf7a4('0xa')](function(_0x4984f5){logger['info'](_0xf7a4('0x1c'),_0x3d8f93);logger['debug'](_0xf7a4('0x1c'),_0x3d8f93,JSON['stringify'](_0x4984f5));_0xd2cd6f(_0x4984f5);})[_0xf7a4('0x13')](function(_0x3b5615){logger['error'](_0xf7a4('0x1c'),_0x3b5615[_0xf7a4('0x12')],_0x3d8f93);_0x1ff24d(_0x5b720b[_0xf7a4('0x10')](0x1f4,_0x3b5615[_0xf7a4('0x12')]));});});}; \ No newline at end of file +var _0x684c=['where','attributes','limit','include','model','map','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','GetMailServerIn','MailServerIn','findAll','options','raw'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x684c,0x1b3));var _0xc684=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x684c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc684('0x0'));var util=require(_0xc684('0x1'));var moment=require('moment');var BPromise=require(_0xc684('0x2'));var rs=require(_0xc684('0x3'));var fs=require('fs');var Redis=require(_0xc684('0x4'));var db=require(_0xc684('0x5'))['db'];var utils=require(_0xc684('0x6'));var logger=require('../../config/logger')(_0xc684('0x7'));var config=require(_0xc684('0x8'));var jayson=require(_0xc684('0x9'));var client=jayson[_0xc684('0xa')][_0xc684('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x57a63c,_0x23bd1c,_0x1a96ea){return new BPromise(function(_0x146733,_0xccb771){return client[_0xc684('0xc')](_0x57a63c,_0x1a96ea)[_0xc684('0xd')](function(_0x3b3bc0){logger[_0xc684('0xe')](_0xc684('0xf'),_0x23bd1c,_0xc684('0x10'));logger[_0xc684('0x11')]('MailServerIn,\x20%s,\x20%s,\x20%s',_0x23bd1c,_0xc684('0x10'),JSON[_0xc684('0x12')](_0x3b3bc0));if(_0x3b3bc0[_0xc684('0x13')]){if(_0x3b3bc0[_0xc684('0x13')][_0xc684('0x14')]===0x1f4){logger[_0xc684('0x13')]('MailServerIn,\x20%s,\x20%s',_0x23bd1c,_0x3b3bc0[_0xc684('0x13')][_0xc684('0x15')]);return _0xccb771(_0x3b3bc0['error']['message']);}logger[_0xc684('0x13')](_0xc684('0xf'),_0x23bd1c,_0x3b3bc0[_0xc684('0x13')][_0xc684('0x15')]);return _0x146733(_0x3b3bc0[_0xc684('0x13')][_0xc684('0x15')]);}else{logger['info']('MailServerIn,\x20%s,\x20%s',_0x23bd1c,_0xc684('0x10'));_0x146733(_0x3b3bc0['result']['message']);}})['catch'](function(_0x47a8eb){logger['error'](_0xc684('0xf'),_0x23bd1c,_0x47a8eb);_0xccb771(_0x47a8eb);});});}exports[_0xc684('0x16')]=function(_0x3b6f5e){var _0x1c1b4a=this;return new Promise(function(_0x1c3af5,_0x4a14a2){return db[_0xc684('0x17')][_0xc684('0x18')]({'raw':_0x3b6f5e['options']?_0x3b6f5e[_0xc684('0x19')][_0xc684('0x1a')]===undefined?!![]:![]:!![],'where':_0x3b6f5e[_0xc684('0x19')]?_0x3b6f5e['options'][_0xc684('0x1b')]||null:null,'attributes':_0x3b6f5e[_0xc684('0x19')]?_0x3b6f5e[_0xc684('0x19')][_0xc684('0x1c')]||null:null,'limit':_0x3b6f5e[_0xc684('0x19')]?_0x3b6f5e['options'][_0xc684('0x1d')]||null:null,'include':_0x3b6f5e[_0xc684('0x19')]?_0x3b6f5e[_0xc684('0x19')]['include']?_['map'](_0x3b6f5e['options'][_0xc684('0x1e')],function(_0x15ce5d){return{'model':db[_0x15ce5d[_0xc684('0x1f')]],'as':_0x15ce5d['as'],'attributes':_0x15ce5d['attributes'],'include':_0x15ce5d['include']?_['map'](_0x15ce5d['include'],function(_0x27c7cc){return{'model':db[_0x27c7cc[_0xc684('0x1f')]],'as':_0x27c7cc['as'],'attributes':_0x27c7cc[_0xc684('0x1c')],'include':_0x27c7cc['include']?_[_0xc684('0x20')](_0x27c7cc['include'],function(_0x125d55){return{'model':db[_0x125d55[_0xc684('0x1f')]],'as':_0x125d55['as'],'attributes':_0x125d55[_0xc684('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1f8e85){logger['info'](_0xc684('0x16'),_0x3b6f5e);logger[_0xc684('0x11')](_0xc684('0x16'),_0x3b6f5e,JSON[_0xc684('0x12')](_0x1f8e85));_0x1c3af5(_0x1f8e85);})['catch'](function(_0xc0f77b){logger[_0xc684('0x13')](_0xc684('0x16'),_0xc0f77b[_0xc684('0x15')],_0x3b6f5e);_0x4a14a2(_0x1c1b4a[_0xc684('0x13')](0x1f4,_0xc0f77b[_0xc684('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index c139ffc..1a08350 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 _0x7a54=['index','/:id','isAuthenticated','post','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailServerOut.controller','get'];(function(_0x47e7cb,_0x4c1b8d){var _0x2a8874=function(_0x36498f){while(--_0x36498f){_0x47e7cb['push'](_0x47e7cb['shift']());}};_0x2a8874(++_0x4c1b8d);}(_0x7a54,0x106));var _0x47a5=function(_0x5a038f,_0x2484f7){_0x5a038f=_0x5a038f-0x0;var _0x3a4e9c=_0x7a54[_0x5a038f];return _0x3a4e9c;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['show']);router[_0x47a5('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['update']);router[_0x47a5('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x47a5('0xf')]);module[_0x47a5('0x10')]=router; \ No newline at end of file +var _0x7a54=['index','/:id','isAuthenticated','post','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailServerOut.controller','get'];(function(_0x580576,_0x2f107d){var _0x3f55a0=function(_0x2e180b){while(--_0x2e180b){_0x580576['push'](_0x580576['shift']());}};_0x3f55a0(++_0x2f107d);}(_0x7a54,0x106));var _0x47a5=function(_0x21b95b,_0x51d23a){_0x21b95b=_0x21b95b-0x0;var _0x35d1bb=_0x7a54[_0x21b95b];return _0x35d1bb;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['show']);router[_0x47a5('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['update']);router[_0x47a5('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x47a5('0xf')]);module[_0x47a5('0x10')]=router; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.attributes.js b/server/api/mailServerOut/mailServerOut.attributes.js index 383fe1e..13cf6bc 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 _0x69ee=['STRING','INTEGER','BOOLEAN','exports'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x69ee,0x167));var _0xe69e=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0x69ee[_0x160c73];return _0xd9302;};'use strict';var Sequelize=require('sequelize');module[_0xe69e('0x0')]={'description':{'type':Sequelize[_0xe69e('0x1')]},'host':{'type':Sequelize['STRING']},'user':{'type':Sequelize[_0xe69e('0x1')]},'pass':{'type':Sequelize[_0xe69e('0x1')]},'port':{'type':Sequelize[_0xe69e('0x2')]},'secure':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'service':{'type':Sequelize[_0xe69e('0x1')]},'authentication':{'type':Sequelize[_0xe69e('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x4fe2=['INTEGER','sequelize','STRING'];(function(_0xec0813,_0x5bb333){var _0x1149f3=function(_0x48074f){while(--_0x48074f){_0xec0813['push'](_0xec0813['shift']());}};_0x1149f3(++_0x5bb333);}(_0x4fe2,0x8e));var _0x24fe=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x4fe2[_0x3947c9];return _0x2e7871;};'use strict';var Sequelize=require(_0x24fe('0x0'));module['exports']={'description':{'type':Sequelize[_0x24fe('0x1')]},'host':{'type':Sequelize[_0x24fe('0x1')]},'user':{'type':Sequelize['STRING']},'pass':{'type':Sequelize[_0x24fe('0x1')]},'port':{'type':Sequelize[_0x24fe('0x2')]},'secure':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'service':{'type':Sequelize[_0x24fe('0x1')]},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index 7424fc0..d52cff1 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 _0xcfaf=['end','error','stack','name','send','map','MailServerOut','rawAttributes','fieldName','type','model','query','keys','filters','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','options','includeAll','include','findAll','rows','catch','show','params','intersection','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../mysqldb','status','offset','undefined','limit','count','json','apply','reject','save','update','then','destroy'];(function(_0x3d9358,_0x4063e5){var _0x496116=function(_0x44ec33){while(--_0x44ec33){_0x3d9358['push'](_0x3d9358['shift']());}};_0x496116(++_0x4063e5);}(_0xcfaf,0x14c));var _0xfcfa=function(_0x3736b5,_0x4f5de7){_0x3736b5=_0x3736b5-0x0;var _0x268502=_0xcfaf[_0x3736b5];return _0x268502;};'use strict';var emlformat=require(_0xfcfa('0x0'));var rimraf=require(_0xfcfa('0x1'));var zipdir=require(_0xfcfa('0x2'));var jsonpatch=require(_0xfcfa('0x3'));var rp=require(_0xfcfa('0x4'));var moment=require(_0xfcfa('0x5'));var BPromise=require(_0xfcfa('0x6'));var Mustache=require(_0xfcfa('0x7'));var util=require(_0xfcfa('0x8'));var path=require(_0xfcfa('0x9'));var sox=require(_0xfcfa('0xa'));var csv=require(_0xfcfa('0xb'));var ejs=require(_0xfcfa('0xc'));var fs=require('fs');var fs_extra=require(_0xfcfa('0xd'));var _=require('lodash');var squel=require(_0xfcfa('0xe'));var crypto=require(_0xfcfa('0xf'));var jsforce=require(_0xfcfa('0x10'));var deskjs=require(_0xfcfa('0x11'));var toCsv=require(_0xfcfa('0xb'));var querystring=require(_0xfcfa('0x12'));var Papa=require('papaparse');var Redis=require(_0xfcfa('0x13'));var authService=require(_0xfcfa('0x14'));var qs=require(_0xfcfa('0x15'));var as=require(_0xfcfa('0x16'));var hardwareService=require(_0xfcfa('0x17'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xfcfa('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xfcfa('0x19'))['db'];function respondWithStatusCode(_0x2e35b6,_0x1973a8){_0x1973a8=_0x1973a8||0xcc;return function(_0x162736){if(_0x162736){return _0x2e35b6['sendStatus'](_0x1973a8);}return _0x2e35b6[_0xfcfa('0x1a')](_0x1973a8)['end']();};}function respondWithResult(_0x1a8409,_0x4eda28){_0x4eda28=_0x4eda28||0xc8;return function(_0x535db8){if(_0x535db8){return _0x1a8409[_0xfcfa('0x1a')](_0x4eda28)['json'](_0x535db8);}};}function respondWithFilteredResult(_0x3a1b83,_0x535e6d){return function(_0x537595){if(_0x537595){var _0x418aed=typeof _0x535e6d[_0xfcfa('0x1b')]===_0xfcfa('0x1c')&&typeof _0x535e6d[_0xfcfa('0x1d')]===_0xfcfa('0x1c');var _0x518aa6=_0x537595[_0xfcfa('0x1e')];var _0x525205=_0x418aed?0x0:_0x535e6d[_0xfcfa('0x1b')];var _0x5d9f64=_0x418aed?_0x537595[_0xfcfa('0x1e')]:_0x535e6d[_0xfcfa('0x1b')]+_0x535e6d[_0xfcfa('0x1d')];var _0x186d27;if(_0x5d9f64>=_0x518aa6){_0x5d9f64=_0x518aa6;_0x186d27=0xc8;}else{_0x186d27=0xce;}_0x3a1b83['status'](_0x186d27);return _0x3a1b83['set']('Content-Range',_0x525205+'-'+_0x5d9f64+'/'+_0x518aa6)[_0xfcfa('0x1f')](_0x537595);}return null;};}function patchUpdates(_0x1ec8c4){return function(_0x22947c){try{jsonpatch[_0xfcfa('0x20')](_0x22947c,_0x1ec8c4,!![]);}catch(_0x17329a){return BPromise[_0xfcfa('0x21')](_0x17329a);}return _0x22947c[_0xfcfa('0x22')]();};}function saveUpdates(_0xbb0748,_0x5696d6){return function(_0x5215f1){if(_0x5215f1){return _0x5215f1[_0xfcfa('0x23')](_0xbb0748)[_0xfcfa('0x24')](function(_0x507fbf){return _0x507fbf;});}return null;};}function removeEntity(_0x318ae9,_0x3d311d){return function(_0x399602){if(_0x399602){return _0x399602[_0xfcfa('0x25')]()[_0xfcfa('0x24')](function(){_0x318ae9[_0xfcfa('0x1a')](0xcc)[_0xfcfa('0x26')]();});}};}function handleEntityNotFound(_0x419fe4,_0xc9c2ca){return function(_0x302a92){if(!_0x302a92){_0x419fe4['sendStatus'](0x194);}return _0x302a92;};}function handleError(_0x3311ed,_0x599730){_0x599730=_0x599730||0x1f4;return function(_0x36e393){logger[_0xfcfa('0x27')](_0x36e393[_0xfcfa('0x28')]);if(_0x36e393[_0xfcfa('0x29')]){delete _0x36e393[_0xfcfa('0x29')];}_0x3311ed[_0xfcfa('0x1a')](_0x599730)[_0xfcfa('0x2a')](_0x36e393);};}exports['index']=function(_0x48a194,_0x1f9089){var _0x84e153={},_0x48ea16={},_0x12e27c={'count':0x0,'rows':[]};var _0x513af0=_[_0xfcfa('0x2b')](db[_0xfcfa('0x2c')][_0xfcfa('0x2d')],function(_0x473c6c){return{'name':_0x473c6c[_0xfcfa('0x2e')],'type':_0x473c6c[_0xfcfa('0x2f')]['key']};});_0x48ea16[_0xfcfa('0x30')]=_[_0xfcfa('0x2b')](_0x513af0,_0xfcfa('0x29'));_0x48ea16[_0xfcfa('0x31')]=_[_0xfcfa('0x32')](_0x48a194[_0xfcfa('0x31')]);_0x48ea16[_0xfcfa('0x33')]=_['intersection'](_0x48ea16[_0xfcfa('0x30')],_0x48ea16[_0xfcfa('0x31')]);_0x84e153[_0xfcfa('0x34')]=_['intersection'](_0x48ea16[_0xfcfa('0x30')],qs[_0xfcfa('0x35')](_0x48a194[_0xfcfa('0x31')][_0xfcfa('0x35')]));_0x84e153[_0xfcfa('0x34')]=_0x84e153[_0xfcfa('0x34')][_0xfcfa('0x36')]?_0x84e153[_0xfcfa('0x34')]:_0x48ea16[_0xfcfa('0x30')];if(!_0x48a194[_0xfcfa('0x31')][_0xfcfa('0x37')]('nolimit')){_0x84e153['limit']=qs[_0xfcfa('0x1d')](_0x48a194[_0xfcfa('0x31')][_0xfcfa('0x1d')]);_0x84e153[_0xfcfa('0x1b')]=qs['offset'](_0x48a194[_0xfcfa('0x31')][_0xfcfa('0x1b')]);}_0x84e153[_0xfcfa('0x38')]=qs[_0xfcfa('0x39')](_0x48a194[_0xfcfa('0x31')][_0xfcfa('0x39')]);_0x84e153['where']=qs['filters'](_[_0xfcfa('0x3a')](_0x48a194[_0xfcfa('0x31')],_0x48ea16[_0xfcfa('0x33')]),_0x513af0);if(_0x48a194[_0xfcfa('0x31')][_0xfcfa('0x3b')]){_0x84e153['where']=_['merge'](_0x84e153[_0xfcfa('0x3c')],{'$or':_[_0xfcfa('0x2b')](_0x513af0,function(_0x68c345){if(_0x68c345[_0xfcfa('0x2f')]!=='VIRTUAL'){var _0x5d6e0b={};_0x5d6e0b[_0x68c345['name']]={'$like':'%'+_0x48a194[_0xfcfa('0x31')][_0xfcfa('0x3b')]+'%'};return _0x5d6e0b;}})});}_0x84e153=_[_0xfcfa('0x3d')]({},_0x84e153,_0x48a194[_0xfcfa('0x3e')]);var _0x387dc8={'where':_0x84e153[_0xfcfa('0x3c')]};return db['MailServerOut'][_0xfcfa('0x1e')](_0x387dc8)[_0xfcfa('0x24')](function(_0x5f2d7e){_0x12e27c[_0xfcfa('0x1e')]=_0x5f2d7e;if(_0x48a194[_0xfcfa('0x31')][_0xfcfa('0x3f')]){_0x84e153[_0xfcfa('0x40')]=[{'all':!![]}];}return db[_0xfcfa('0x2c')][_0xfcfa('0x41')](_0x84e153);})['then'](function(_0x37c5d6){_0x12e27c[_0xfcfa('0x42')]=_0x37c5d6;return _0x12e27c;})['then'](respondWithFilteredResult(_0x1f9089,_0x84e153))[_0xfcfa('0x43')](handleError(_0x1f9089,null));};exports[_0xfcfa('0x44')]=function(_0x4a2ac9,_0x33953d){var _0xba4123={'raw':!![],'where':{'id':_0x4a2ac9[_0xfcfa('0x45')]['id']}},_0x39d2a0={};_0x39d2a0[_0xfcfa('0x30')]=_[_0xfcfa('0x32')](db[_0xfcfa('0x2c')][_0xfcfa('0x2d')]);_0x39d2a0[_0xfcfa('0x31')]=_[_0xfcfa('0x32')](_0x4a2ac9[_0xfcfa('0x31')]);_0x39d2a0['filters']=_['intersection'](_0x39d2a0['model'],_0x39d2a0[_0xfcfa('0x31')]);_0xba4123[_0xfcfa('0x34')]=_[_0xfcfa('0x46')](_0x39d2a0[_0xfcfa('0x30')],qs[_0xfcfa('0x35')](_0x4a2ac9[_0xfcfa('0x31')]['fields']));_0xba4123[_0xfcfa('0x34')]=_0xba4123[_0xfcfa('0x34')]['length']?_0xba4123['attributes']:_0x39d2a0[_0xfcfa('0x30')];if(_0x4a2ac9['query'][_0xfcfa('0x3f')]){_0xba4123[_0xfcfa('0x40')]=[{'all':!![]}];}_0xba4123=_[_0xfcfa('0x3d')]({},_0xba4123,_0x4a2ac9['options']);return db['MailServerOut'][_0xfcfa('0x47')](_0xba4123)[_0xfcfa('0x24')](handleEntityNotFound(_0x33953d,null))[_0xfcfa('0x24')](respondWithResult(_0x33953d,null))[_0xfcfa('0x43')](handleError(_0x33953d,null));};exports[_0xfcfa('0x48')]=function(_0x53a8d0,_0x21ca7a){return db[_0xfcfa('0x2c')]['create'](_0x53a8d0['body'],{})[_0xfcfa('0x24')](respondWithResult(_0x21ca7a,0xc9))['catch'](handleError(_0x21ca7a,null));};exports['update']=function(_0x4d4feb,_0x2b017b){if(_0x4d4feb[_0xfcfa('0x49')]['id']){delete _0x4d4feb[_0xfcfa('0x49')]['id'];}return db[_0xfcfa('0x2c')][_0xfcfa('0x47')]({'where':{'id':_0x4d4feb[_0xfcfa('0x45')]['id']}})[_0xfcfa('0x24')](handleEntityNotFound(_0x2b017b,null))[_0xfcfa('0x24')](saveUpdates(_0x4d4feb['body'],null))['then'](respondWithResult(_0x2b017b,null))['catch'](handleError(_0x2b017b,null));};exports[_0xfcfa('0x25')]=function(_0x2fc43e,_0x21fa90){return db['MailServerOut'][_0xfcfa('0x47')]({'where':{'id':_0x2fc43e[_0xfcfa('0x45')]['id']}})['then'](handleEntityNotFound(_0x21fa90,null))[_0xfcfa('0x24')](removeEntity(_0x21fa90,null))[_0xfcfa('0x43')](handleError(_0x21fa90,null));}; \ No newline at end of file +var _0xfe4c=['create','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','then','destroy','stack','name','send','index','rawAttributes','fieldName','key','map','query','keys','filters','intersection','model','attributes','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','MailServerOut','include','findAll','catch','params','length','find'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xfe4c,0x1f3));var _0xcfe4=function(_0x2a9b2f,_0xd7ac4d){_0x2a9b2f=_0x2a9b2f-0x0;var _0x203c81=_0xfe4c[_0x2a9b2f];return _0x203c81;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xcfe4('0x0'));var zipdir=require(_0xcfe4('0x1'));var jsonpatch=require(_0xcfe4('0x2'));var rp=require(_0xcfe4('0x3'));var moment=require(_0xcfe4('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xcfe4('0x5'));var util=require(_0xcfe4('0x6'));var path=require(_0xcfe4('0x7'));var sox=require(_0xcfe4('0x8'));var csv=require('to-csv');var ejs=require(_0xcfe4('0x9'));var fs=require('fs');var fs_extra=require(_0xcfe4('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xcfe4('0xb'));var jsforce=require(_0xcfe4('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xcfe4('0xd'));var querystring=require(_0xcfe4('0xe'));var Papa=require(_0xcfe4('0xf'));var Redis=require(_0xcfe4('0x10'));var authService=require(_0xcfe4('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xcfe4('0x12'));var hardwareService=require(_0xcfe4('0x13'));var logger=require('../../config/logger')(_0xcfe4('0x14'));var utils=require(_0xcfe4('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xcfe4('0x16'));var db=require(_0xcfe4('0x17'))['db'];function respondWithStatusCode(_0x38c258,_0xa8274d){_0xa8274d=_0xa8274d||0xcc;return function(_0x28b67e){if(_0x28b67e){return _0x38c258['sendStatus'](_0xa8274d);}return _0x38c258['status'](_0xa8274d)[_0xcfe4('0x18')]();};}function respondWithResult(_0x4893fc,_0x50d3a0){_0x50d3a0=_0x50d3a0||0xc8;return function(_0x3b84d2){if(_0x3b84d2){return _0x4893fc[_0xcfe4('0x19')](_0x50d3a0)[_0xcfe4('0x1a')](_0x3b84d2);}};}function respondWithFilteredResult(_0x307feb,_0x5dcc79){return function(_0xbffc66){if(_0xbffc66){var _0x4c207e=typeof _0x5dcc79[_0xcfe4('0x1b')]===_0xcfe4('0x1c')&&typeof _0x5dcc79['limit']==='undefined';var _0xca6984=_0xbffc66[_0xcfe4('0x1d')];var _0x491fb7=_0x4c207e?0x0:_0x5dcc79[_0xcfe4('0x1b')];var _0x1bc369=_0x4c207e?_0xbffc66[_0xcfe4('0x1d')]:_0x5dcc79['offset']+_0x5dcc79[_0xcfe4('0x1e')];var _0x154cd6;if(_0x1bc369>=_0xca6984){_0x1bc369=_0xca6984;_0x154cd6=0xc8;}else{_0x154cd6=0xce;}_0x307feb[_0xcfe4('0x19')](_0x154cd6);return _0x307feb[_0xcfe4('0x1f')](_0xcfe4('0x20'),_0x491fb7+'-'+_0x1bc369+'/'+_0xca6984)['json'](_0xbffc66);}return null;};}function patchUpdates(_0x8248c5){return function(_0xd148cb){try{jsonpatch[_0xcfe4('0x21')](_0xd148cb,_0x8248c5,!![]);}catch(_0x220942){return BPromise[_0xcfe4('0x22')](_0x220942);}return _0xd148cb['save']();};}function saveUpdates(_0x4e51b9,_0x6d96c8){return function(_0xee107b){if(_0xee107b){return _0xee107b[_0xcfe4('0x23')](_0x4e51b9)[_0xcfe4('0x24')](function(_0x22bcf0){return _0x22bcf0;});}return null;};}function removeEntity(_0x1ab834,_0x55091c){return function(_0x590889){if(_0x590889){return _0x590889[_0xcfe4('0x25')]()[_0xcfe4('0x24')](function(){_0x1ab834[_0xcfe4('0x19')](0xcc)[_0xcfe4('0x18')]();});}};}function handleEntityNotFound(_0x186ea6,_0x11be37){return function(_0x401594){if(!_0x401594){_0x186ea6['sendStatus'](0x194);}return _0x401594;};}function handleError(_0x6fe32c,_0x2fdd6e){_0x2fdd6e=_0x2fdd6e||0x1f4;return function(_0x29c332){logger['error'](_0x29c332[_0xcfe4('0x26')]);if(_0x29c332[_0xcfe4('0x27')]){delete _0x29c332[_0xcfe4('0x27')];}_0x6fe32c[_0xcfe4('0x19')](_0x2fdd6e)[_0xcfe4('0x28')](_0x29c332);};}exports[_0xcfe4('0x29')]=function(_0x4fe31e,_0x5f2d06){var _0x42c45a={},_0x1920b0={},_0x119aa8={'count':0x0,'rows':[]};var _0x83e967=_['map'](db['MailServerOut'][_0xcfe4('0x2a')],function(_0x150342){return{'name':_0x150342[_0xcfe4('0x2b')],'type':_0x150342['type'][_0xcfe4('0x2c')]};});_0x1920b0['model']=_[_0xcfe4('0x2d')](_0x83e967,_0xcfe4('0x27'));_0x1920b0[_0xcfe4('0x2e')]=_[_0xcfe4('0x2f')](_0x4fe31e[_0xcfe4('0x2e')]);_0x1920b0[_0xcfe4('0x30')]=_[_0xcfe4('0x31')](_0x1920b0[_0xcfe4('0x32')],_0x1920b0[_0xcfe4('0x2e')]);_0x42c45a[_0xcfe4('0x33')]=_['intersection'](_0x1920b0[_0xcfe4('0x32')],qs[_0xcfe4('0x34')](_0x4fe31e[_0xcfe4('0x2e')][_0xcfe4('0x34')]));_0x42c45a[_0xcfe4('0x33')]=_0x42c45a[_0xcfe4('0x33')]['length']?_0x42c45a[_0xcfe4('0x33')]:_0x1920b0[_0xcfe4('0x32')];if(!_0x4fe31e['query']['hasOwnProperty'](_0xcfe4('0x35'))){_0x42c45a[_0xcfe4('0x1e')]=qs[_0xcfe4('0x1e')](_0x4fe31e[_0xcfe4('0x2e')]['limit']);_0x42c45a[_0xcfe4('0x1b')]=qs[_0xcfe4('0x1b')](_0x4fe31e[_0xcfe4('0x2e')][_0xcfe4('0x1b')]);}_0x42c45a[_0xcfe4('0x36')]=qs['sort'](_0x4fe31e['query'][_0xcfe4('0x37')]);_0x42c45a[_0xcfe4('0x38')]=qs[_0xcfe4('0x30')](_[_0xcfe4('0x39')](_0x4fe31e[_0xcfe4('0x2e')],_0x1920b0['filters']),_0x83e967);if(_0x4fe31e[_0xcfe4('0x2e')][_0xcfe4('0x3a')]){_0x42c45a[_0xcfe4('0x38')]=_[_0xcfe4('0x3b')](_0x42c45a[_0xcfe4('0x38')],{'$or':_[_0xcfe4('0x2d')](_0x83e967,function(_0x477ba3){if(_0x477ba3['type']!==_0xcfe4('0x3c')){var _0x5bac38={};_0x5bac38[_0x477ba3['name']]={'$like':'%'+_0x4fe31e['query']['filter']+'%'};return _0x5bac38;}})});}_0x42c45a=_['merge']({},_0x42c45a,_0x4fe31e[_0xcfe4('0x3d')]);var _0x180cb9={'where':_0x42c45a[_0xcfe4('0x38')]};return db[_0xcfe4('0x3e')][_0xcfe4('0x1d')](_0x180cb9)['then'](function(_0x4809a8){_0x119aa8['count']=_0x4809a8;if(_0x4fe31e[_0xcfe4('0x2e')]['includeAll']){_0x42c45a[_0xcfe4('0x3f')]=[{'all':!![]}];}return db[_0xcfe4('0x3e')][_0xcfe4('0x40')](_0x42c45a);})['then'](function(_0x2d5961){_0x119aa8['rows']=_0x2d5961;return _0x119aa8;})['then'](respondWithFilteredResult(_0x5f2d06,_0x42c45a))[_0xcfe4('0x41')](handleError(_0x5f2d06,null));};exports['show']=function(_0x3cc840,_0x2110a8){var _0x3dfaca={'raw':!![],'where':{'id':_0x3cc840[_0xcfe4('0x42')]['id']}},_0x459cda={};_0x459cda[_0xcfe4('0x32')]=_['keys'](db[_0xcfe4('0x3e')][_0xcfe4('0x2a')]);_0x459cda['query']=_['keys'](_0x3cc840[_0xcfe4('0x2e')]);_0x459cda[_0xcfe4('0x30')]=_[_0xcfe4('0x31')](_0x459cda[_0xcfe4('0x32')],_0x459cda[_0xcfe4('0x2e')]);_0x3dfaca[_0xcfe4('0x33')]=_['intersection'](_0x459cda[_0xcfe4('0x32')],qs[_0xcfe4('0x34')](_0x3cc840[_0xcfe4('0x2e')][_0xcfe4('0x34')]));_0x3dfaca['attributes']=_0x3dfaca['attributes'][_0xcfe4('0x43')]?_0x3dfaca['attributes']:_0x459cda[_0xcfe4('0x32')];if(_0x3cc840[_0xcfe4('0x2e')]['includeAll']){_0x3dfaca[_0xcfe4('0x3f')]=[{'all':!![]}];}_0x3dfaca=_[_0xcfe4('0x3b')]({},_0x3dfaca,_0x3cc840[_0xcfe4('0x3d')]);return db[_0xcfe4('0x3e')][_0xcfe4('0x44')](_0x3dfaca)[_0xcfe4('0x24')](handleEntityNotFound(_0x2110a8,null))[_0xcfe4('0x24')](respondWithResult(_0x2110a8,null))['catch'](handleError(_0x2110a8,null));};exports['create']=function(_0x1e01e8,_0x39ac73){return db[_0xcfe4('0x3e')][_0xcfe4('0x45')](_0x1e01e8['body'],{})['then'](respondWithResult(_0x39ac73,0xc9))[_0xcfe4('0x41')](handleError(_0x39ac73,null));};exports[_0xcfe4('0x23')]=function(_0x280ef0,_0x523e61){if(_0x280ef0[_0xcfe4('0x46')]['id']){delete _0x280ef0['body']['id'];}return db[_0xcfe4('0x3e')][_0xcfe4('0x44')]({'where':{'id':_0x280ef0[_0xcfe4('0x42')]['id']}})[_0xcfe4('0x24')](handleEntityNotFound(_0x523e61,null))[_0xcfe4('0x24')](saveUpdates(_0x280ef0[_0xcfe4('0x46')],null))[_0xcfe4('0x24')](respondWithResult(_0x523e61,null))[_0xcfe4('0x41')](handleError(_0x523e61,null));};exports['destroy']=function(_0x15a483,_0x482503){return db[_0xcfe4('0x3e')][_0xcfe4('0x44')]({'where':{'id':_0x15a483[_0xcfe4('0x42')]['id']}})[_0xcfe4('0x24')](handleEntityNotFound(_0x482503,null))['then'](removeEntity(_0x482503,null))[_0xcfe4('0x41')](handleError(_0x482503,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index 12b993f..d189c89 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 _0x96bb=['define','lodash','util','api','bluebird','request-promise','path','rimraf','exports'];(function(_0x56a871,_0x18b7fe){var _0x124954=function(_0x39b7a1){while(--_0x39b7a1){_0x56a871['push'](_0x56a871['shift']());}};_0x124954(++_0x18b7fe);}(_0x96bb,0xd0));var _0xb96b=function(_0x53be8d,_0x2cb53f){_0x53be8d=_0x53be8d-0x0;var _0x396d2c=_0x96bb[_0x53be8d];return _0x396d2c;};'use strict';var _=require(_0xb96b('0x0'));var util=require(_0xb96b('0x1'));var logger=require('../../config/logger')(_0xb96b('0x2'));var moment=require('moment');var BPromise=require(_0xb96b('0x3'));var rp=require(_0xb96b('0x4'));var fs=require('fs');var path=require(_0xb96b('0x5'));var rimraf=require(_0xb96b('0x6'));var config=require('../../config/environment');var attributes=require('./mailServerOut.attributes');module[_0xb96b('0x7')]=function(_0x1a1f33,_0x400b31){return _0x1a1f33[_0xb96b('0x8')]('MailServerOut',attributes,{'tableName':'mail_servers_out','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbb2e=['bluebird','request-promise','path','rimraf','../../config/environment','./mailServerOut.attributes','exports','mail_servers_out','../../config/logger','api','moment'];(function(_0x2deeba,_0xd08bf0){var _0x46c616=function(_0x161de1){while(--_0x161de1){_0x2deeba['push'](_0x2deeba['shift']());}};_0x46c616(++_0xd08bf0);}(_0xbb2e,0x81));var _0xebb2=function(_0xe7d4bb,_0x29d24e){_0xe7d4bb=_0xe7d4bb-0x0;var _0x35ef7f=_0xbb2e[_0xe7d4bb];return _0x35ef7f;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xebb2('0x0'))(_0xebb2('0x1'));var moment=require(_0xebb2('0x2'));var BPromise=require(_0xebb2('0x3'));var rp=require(_0xebb2('0x4'));var fs=require('fs');var path=require(_0xebb2('0x5'));var rimraf=require(_0xebb2('0x6'));var config=require(_0xebb2('0x7'));var attributes=require(_0xebb2('0x8'));module[_0xebb2('0x9')]=function(_0x934073,_0x2399d8){return _0x934073['define']('MailServerOut',attributes,{'tableName':_0xebb2('0xa'),'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 b79aad6..8a030e1 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 _0xdb28=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','MailServerOut,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','lodash','util'];(function(_0x1f29e7,_0x2692f8){var _0x5d58ee=function(_0x5947d0){while(--_0x5947d0){_0x1f29e7['push'](_0x1f29e7['shift']());}};_0x5d58ee(++_0x2692f8);}(_0xdb28,0x106));var _0x8db2=function(_0x172088,_0x173631){_0x172088=_0x172088-0x0;var _0xf2b0e8=_0xdb28[_0x172088];return _0xf2b0e8;};'use strict';var _=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var moment=require(_0x8db2('0x2'));var BPromise=require(_0x8db2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8db2('0x4'));var db=require(_0x8db2('0x5'))['db'];var utils=require(_0x8db2('0x6'));var logger=require(_0x8db2('0x7'))(_0x8db2('0x8'));var config=require('../../config/environment');var jayson=require(_0x8db2('0x9'));var client=jayson[_0x8db2('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x494b40,_0x477f50,_0x46932f){return new BPromise(function(_0x131537,_0x29f698){return client[_0x8db2('0xb')](_0x494b40,_0x46932f)[_0x8db2('0xc')](function(_0x126c78){logger['info'](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));logger[_0x8db2('0xf')]('MailServerOut,\x20%s,\x20%s,\x20%s',_0x477f50,_0x8db2('0xe'),JSON[_0x8db2('0x10')](_0x126c78));if(_0x126c78['error']){if(_0x126c78[_0x8db2('0x11')][_0x8db2('0x12')]===0x1f4){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')]['message']);return _0x29f698(_0x126c78['error'][_0x8db2('0x13')]);}logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);return _0x131537(_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);}else{logger[_0x8db2('0x14')](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));_0x131537(_0x126c78['result'][_0x8db2('0x13')]);}})[_0x8db2('0x15')](function(_0x48101e){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x48101e);_0x29f698(_0x48101e);});});} \ No newline at end of file +var _0x5f66=['../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','MailServerOut,\x20%s,\x20%s','request\x20sent','debug','MailServerOut,\x20%s,\x20%s,\x20%s','stringify','code','message','error','info','catch','util','bluebird','randomstring','ioredis'];(function(_0x18da2d,_0x9a8849){var _0x39bbc1=function(_0x464876){while(--_0x464876){_0x18da2d['push'](_0x18da2d['shift']());}};_0x39bbc1(++_0x9a8849);}(_0x5f66,0x1a0));var _0x65f6=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x5f66[_0x432682];return _0x463d05;};'use strict';var _=require('lodash');var util=require(_0x65f6('0x0'));var moment=require('moment');var BPromise=require(_0x65f6('0x1'));var rs=require(_0x65f6('0x2'));var fs=require('fs');var Redis=require(_0x65f6('0x3'));var db=require(_0x65f6('0x4'))['db'];var utils=require(_0x65f6('0x5'));var logger=require('../../config/logger')(_0x65f6('0x6'));var config=require('../../config/environment');var jayson=require(_0x65f6('0x7'));var client=jayson[_0x65f6('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ed98f,_0x1c0e12,_0x2c6571){return new BPromise(function(_0x112079,_0x8f6451){return client[_0x65f6('0x9')](_0x4ed98f,_0x2c6571)[_0x65f6('0xa')](function(_0x48d85c){logger['info'](_0x65f6('0xb'),_0x1c0e12,_0x65f6('0xc'));logger[_0x65f6('0xd')](_0x65f6('0xe'),_0x1c0e12,'request\x20sent',JSON[_0x65f6('0xf')](_0x48d85c));if(_0x48d85c['error']){if(_0x48d85c['error'][_0x65f6('0x10')]===0x1f4){logger['error'](_0x65f6('0xb'),_0x1c0e12,_0x48d85c['error'][_0x65f6('0x11')]);return _0x8f6451(_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);}logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);return _0x112079(_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);}else{logger[_0x65f6('0x13')]('MailServerOut,\x20%s,\x20%s',_0x1c0e12,_0x65f6('0xc'));_0x112079(_0x48d85c['result']['message']);}})[_0x65f6('0x14')](function(_0x5c69f8){logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x5c69f8);_0x8f6451(_0x5c69f8);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index e11349e..25f019f 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 _0x1398=['get','isAuthenticated','index','/describe','describe','show','post','create','put','/:id','update','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x560bfc,_0x24f163){var _0x5bd00c=function(_0x362622){while(--_0x362622){_0x560bfc['push'](_0x560bfc['shift']());}};_0x5bd00c(++_0x24f163);}(_0x1398,0xb5));var _0x8139=function(_0x231cbe,_0x4a2efe){_0x231cbe=_0x231cbe-0x0;var _0x2f9470=_0x1398[_0x231cbe];return _0x2f9470;};'use strict';var multer=require(_0x8139('0x0'));var util=require(_0x8139('0x1'));var path=require('path');var timeout=require(_0x8139('0x2'));var express=require('express');var router=express[_0x8139('0x3')]();var fs_extra=require(_0x8139('0x4'));var auth=require(_0x8139('0x5'));var interaction=require(_0x8139('0x6'));var config=require(_0x8139('0x7'));var controller=require('./mailSubstatus.controller');router[_0x8139('0x8')]('/',auth[_0x8139('0x9')](),controller[_0x8139('0xa')]);router[_0x8139('0x8')](_0x8139('0xb'),auth['isAuthenticated'](),controller[_0x8139('0xc')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x8139('0xd')]);router[_0x8139('0xe')]('/',auth[_0x8139('0x9')](),controller[_0x8139('0xf')]);router[_0x8139('0x10')](_0x8139('0x11'),auth['isAuthenticated'](),controller[_0x8139('0x12')]);router['delete'](_0x8139('0x11'),auth[_0x8139('0x9')](),controller[_0x8139('0x13')]);module[_0x8139('0x14')]=router; \ No newline at end of file +var _0x85e3=['update','delete','destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./mailSubstatus.controller','index','get','/describe','isAuthenticated','describe','show','post','create','/:id'];(function(_0x2144b8,_0x3dc359){var _0x1e68ab=function(_0x2d75ff){while(--_0x2d75ff){_0x2144b8['push'](_0x2144b8['shift']());}};_0x1e68ab(++_0x3dc359);}(_0x85e3,0x153));var _0x385e=function(_0xfa3cbc,_0xdf523d){_0xfa3cbc=_0xfa3cbc-0x0;var _0x445000=_0x85e3[_0xfa3cbc];return _0x445000;};'use strict';var multer=require(_0x385e('0x0'));var util=require(_0x385e('0x1'));var path=require(_0x385e('0x2'));var timeout=require('connect-timeout');var express=require(_0x385e('0x3'));var router=express[_0x385e('0x4')]();var fs_extra=require(_0x385e('0x5'));var auth=require(_0x385e('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x385e('0x7'));var controller=require(_0x385e('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x385e('0x9')]);router[_0x385e('0xa')](_0x385e('0xb'),auth[_0x385e('0xc')](),controller[_0x385e('0xd')]);router[_0x385e('0xa')]('/:id',auth[_0x385e('0xc')](),controller[_0x385e('0xe')]);router[_0x385e('0xf')]('/',auth['isAuthenticated'](),controller[_0x385e('0x10')]);router['put'](_0x385e('0x11'),auth['isAuthenticated'](),controller[_0x385e('0x12')]);router[_0x385e('0x13')](_0x385e('0x11'),auth[_0x385e('0xc')](),controller[_0x385e('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index 43daf35..a5ddffc 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 _0xe626=['name','sequelize','exports','STRING'];(function(_0x294b6,_0x2907ae){var _0x38bb97=function(_0x5aaa76){while(--_0x5aaa76){_0x294b6['push'](_0x294b6['shift']());}};_0x38bb97(++_0x2907ae);}(_0xe626,0x9d));var _0x6e62=function(_0x160678,_0x59c914){_0x160678=_0x160678-0x0;var _0xc1a01a=_0xe626[_0x160678];return _0xc1a01a;};'use strict';var Sequelize=require(_0x6e62('0x0'));module[_0x6e62('0x1')]={'name':{'type':Sequelize[_0x6e62('0x2')],'unique':_0x6e62('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x1261=['exports','STRING','name'];(function(_0x1f80fa,_0x1b06f0){var _0xe3ac80=function(_0x280317){while(--_0x280317){_0x1f80fa['push'](_0x1f80fa['shift']());}};_0xe3ac80(++_0x1b06f0);}(_0x1261,0x144));var _0x1126=function(_0x573c9e,_0xd4ab71){_0x573c9e=_0x573c9e-0x0;var _0x5d0714=_0x1261[_0x573c9e];return _0x5d0714;};'use strict';var Sequelize=require('sequelize');module[_0x1126('0x0')]={'name':{'type':Sequelize[_0x1126('0x1')],'unique':_0x1126('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x1126('0x1')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index 6e29820..0565b82 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 _0x196b=['includeAll','findAll','rows','catch','show','params','filters','include','find','create','update','body','describe','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','end','stack','name','send','index','map','MailSubstatus','rawAttributes','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','then'];(function(_0x207b1e,_0x4ab8d5){var _0x340cae=function(_0x3e9656){while(--_0x3e9656){_0x207b1e['push'](_0x207b1e['shift']());}};_0x340cae(++_0x4ab8d5);}(_0x196b,0xa1));var _0xb196=function(_0x4e738c,_0x2a2c55){_0x4e738c=_0x4e738c-0x0;var _0x129976=_0x196b[_0x4e738c];return _0x129976;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xb196('0x0'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xb196('0x1'));var BPromise=require(_0xb196('0x2'));var Mustache=require(_0xb196('0x3'));var util=require(_0xb196('0x4'));var path=require(_0xb196('0x5'));var sox=require(_0xb196('0x6'));var csv=require(_0xb196('0x7'));var ejs=require(_0xb196('0x8'));var fs=require('fs');var fs_extra=require(_0xb196('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xb196('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xb196('0xb'));var toCsv=require(_0xb196('0x7'));var querystring=require(_0xb196('0xc'));var Papa=require(_0xb196('0xd'));var Redis=require(_0xb196('0xe'));var authService=require(_0xb196('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xb196('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb196('0x11'))(_0xb196('0x12'));var utils=require(_0xb196('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xb196('0x14'));var db=require(_0xb196('0x15'))['db'];function respondWithStatusCode(_0x3b17a7,_0x32943f){_0x32943f=_0x32943f||0xcc;return function(_0x16dfcb){if(_0x16dfcb){return _0x3b17a7[_0xb196('0x16')](_0x32943f);}return _0x3b17a7[_0xb196('0x17')](_0x32943f)['end']();};}function respondWithResult(_0x34c9c1,_0x513870){_0x513870=_0x513870||0xc8;return function(_0x37ca1e){if(_0x37ca1e){return _0x34c9c1['status'](_0x513870)[_0xb196('0x18')](_0x37ca1e);}};}function respondWithFilteredResult(_0x2c46c3,_0x2d2167){return function(_0x2eb763){if(_0x2eb763){var _0x3ceab0=typeof _0x2d2167[_0xb196('0x19')]===_0xb196('0x1a')&&typeof _0x2d2167[_0xb196('0x1b')]===_0xb196('0x1a');var _0x4c51d5=_0x2eb763[_0xb196('0x1c')];var _0x1434df=_0x3ceab0?0x0:_0x2d2167['offset'];var _0x1b205b=_0x3ceab0?_0x2eb763[_0xb196('0x1c')]:_0x2d2167[_0xb196('0x19')]+_0x2d2167['limit'];var _0x5b5e66;if(_0x1b205b>=_0x4c51d5){_0x1b205b=_0x4c51d5;_0x5b5e66=0xc8;}else{_0x5b5e66=0xce;}_0x2c46c3[_0xb196('0x17')](_0x5b5e66);return _0x2c46c3[_0xb196('0x1d')](_0xb196('0x1e'),_0x1434df+'-'+_0x1b205b+'/'+_0x4c51d5)[_0xb196('0x18')](_0x2eb763);}return null;};}function patchUpdates(_0x3468ff){return function(_0x5179d6){try{jsonpatch[_0xb196('0x1f')](_0x5179d6,_0x3468ff,!![]);}catch(_0x19d10e){return BPromise[_0xb196('0x20')](_0x19d10e);}return _0x5179d6[_0xb196('0x21')]();};}function saveUpdates(_0x40a3dc,_0x5a19f3){return function(_0x566df2){if(_0x566df2){return _0x566df2['update'](_0x40a3dc)['then'](function(_0x111ba7){return _0x111ba7;});}return null;};}function removeEntity(_0x4500a0,_0x23f257){return function(_0x3f3412){if(_0x3f3412){return _0x3f3412[_0xb196('0x22')]()['then'](function(){_0x4500a0[_0xb196('0x17')](0xcc)[_0xb196('0x23')]();});}};}function handleEntityNotFound(_0x4a87c5,_0x350ec6){return function(_0x419a89){if(!_0x419a89){_0x4a87c5['sendStatus'](0x194);}return _0x419a89;};}function handleError(_0x4e8c85,_0x34c1fd){_0x34c1fd=_0x34c1fd||0x1f4;return function(_0x26ebc2){logger['error'](_0x26ebc2[_0xb196('0x24')]);if(_0x26ebc2['name']){delete _0x26ebc2[_0xb196('0x25')];}_0x4e8c85[_0xb196('0x17')](_0x34c1fd)[_0xb196('0x26')](_0x26ebc2);};}exports[_0xb196('0x27')]=function(_0x5bbc69,_0x2e3414){var _0x78c71f={},_0x1524c0={},_0x438838={'count':0x0,'rows':[]};var _0x34d124=_[_0xb196('0x28')](db[_0xb196('0x29')][_0xb196('0x2a')],function(_0x291322){return{'name':_0x291322['fieldName'],'type':_0x291322[_0xb196('0x2b')]['key']};});_0x1524c0[_0xb196('0x2c')]=_[_0xb196('0x28')](_0x34d124,'name');_0x1524c0[_0xb196('0x2d')]=_[_0xb196('0x2e')](_0x5bbc69[_0xb196('0x2d')]);_0x1524c0['filters']=_[_0xb196('0x2f')](_0x1524c0['model'],_0x1524c0['query']);_0x78c71f[_0xb196('0x30')]=_['intersection'](_0x1524c0[_0xb196('0x2c')],qs[_0xb196('0x31')](_0x5bbc69[_0xb196('0x2d')][_0xb196('0x31')]));_0x78c71f[_0xb196('0x30')]=_0x78c71f[_0xb196('0x30')][_0xb196('0x32')]?_0x78c71f[_0xb196('0x30')]:_0x1524c0['model'];if(!_0x5bbc69['query'][_0xb196('0x33')](_0xb196('0x34'))){_0x78c71f[_0xb196('0x1b')]=qs[_0xb196('0x1b')](_0x5bbc69[_0xb196('0x2d')][_0xb196('0x1b')]);_0x78c71f[_0xb196('0x19')]=qs['offset'](_0x5bbc69[_0xb196('0x2d')][_0xb196('0x19')]);}_0x78c71f[_0xb196('0x35')]=qs[_0xb196('0x36')](_0x5bbc69['query'][_0xb196('0x36')]);_0x78c71f[_0xb196('0x37')]=qs['filters'](_[_0xb196('0x38')](_0x5bbc69[_0xb196('0x2d')],_0x1524c0['filters']),_0x34d124);if(_0x5bbc69[_0xb196('0x2d')][_0xb196('0x39')]){_0x78c71f[_0xb196('0x37')]=_[_0xb196('0x3a')](_0x78c71f[_0xb196('0x37')],{'$or':_[_0xb196('0x28')](_0x34d124,function(_0x5a91e8){if(_0x5a91e8[_0xb196('0x2b')]!=='VIRTUAL'){var _0x102b90={};_0x102b90[_0x5a91e8[_0xb196('0x25')]]={'$like':'%'+_0x5bbc69[_0xb196('0x2d')]['filter']+'%'};return _0x102b90;}})});}_0x78c71f=_[_0xb196('0x3a')]({},_0x78c71f,_0x5bbc69[_0xb196('0x3b')]);var _0x400978={'where':_0x78c71f[_0xb196('0x37')]};return db[_0xb196('0x29')]['count'](_0x400978)[_0xb196('0x3c')](function(_0x19f014){_0x438838[_0xb196('0x1c')]=_0x19f014;if(_0x5bbc69[_0xb196('0x2d')][_0xb196('0x3d')]){_0x78c71f['include']=[{'all':!![]}];}return db['MailSubstatus'][_0xb196('0x3e')](_0x78c71f);})[_0xb196('0x3c')](function(_0x35b030){_0x438838[_0xb196('0x3f')]=_0x35b030;return _0x438838;})[_0xb196('0x3c')](respondWithFilteredResult(_0x2e3414,_0x78c71f))[_0xb196('0x40')](handleError(_0x2e3414,null));};exports[_0xb196('0x41')]=function(_0x4ff356,_0x476e83){var _0x1b0fb9={'raw':!![],'where':{'id':_0x4ff356[_0xb196('0x42')]['id']}},_0x53e5ed={};_0x53e5ed['model']=_[_0xb196('0x2e')](db[_0xb196('0x29')][_0xb196('0x2a')]);_0x53e5ed['query']=_[_0xb196('0x2e')](_0x4ff356[_0xb196('0x2d')]);_0x53e5ed[_0xb196('0x43')]=_[_0xb196('0x2f')](_0x53e5ed[_0xb196('0x2c')],_0x53e5ed['query']);_0x1b0fb9[_0xb196('0x30')]=_['intersection'](_0x53e5ed[_0xb196('0x2c')],qs[_0xb196('0x31')](_0x4ff356[_0xb196('0x2d')][_0xb196('0x31')]));_0x1b0fb9[_0xb196('0x30')]=_0x1b0fb9['attributes'][_0xb196('0x32')]?_0x1b0fb9[_0xb196('0x30')]:_0x53e5ed[_0xb196('0x2c')];if(_0x4ff356[_0xb196('0x2d')][_0xb196('0x3d')]){_0x1b0fb9[_0xb196('0x44')]=[{'all':!![]}];}_0x1b0fb9=_[_0xb196('0x3a')]({},_0x1b0fb9,_0x4ff356['options']);return db['MailSubstatus'][_0xb196('0x45')](_0x1b0fb9)['then'](handleEntityNotFound(_0x476e83,null))[_0xb196('0x3c')](respondWithResult(_0x476e83,null))[_0xb196('0x40')](handleError(_0x476e83,null));};exports[_0xb196('0x46')]=function(_0x103ebb,_0x470d5f){return db[_0xb196('0x29')][_0xb196('0x46')](_0x103ebb['body'],{})[_0xb196('0x3c')](respondWithResult(_0x470d5f,0xc9))[_0xb196('0x40')](handleError(_0x470d5f,null));};exports[_0xb196('0x47')]=function(_0x5e2608,_0x5605d4){if(_0x5e2608[_0xb196('0x48')]['id']){delete _0x5e2608['body']['id'];}return db[_0xb196('0x29')][_0xb196('0x45')]({'where':{'id':_0x5e2608[_0xb196('0x42')]['id']}})[_0xb196('0x3c')](handleEntityNotFound(_0x5605d4,null))[_0xb196('0x3c')](saveUpdates(_0x5e2608[_0xb196('0x48')],null))[_0xb196('0x3c')](respondWithResult(_0x5605d4,null))[_0xb196('0x40')](handleError(_0x5605d4,null));};exports[_0xb196('0x22')]=function(_0x2b15a3,_0x103f28){return db['MailSubstatus'][_0xb196('0x45')]({'where':{'id':_0x2b15a3[_0xb196('0x42')]['id']}})[_0xb196('0x3c')](handleEntityNotFound(_0x103f28,null))[_0xb196('0x3c')](removeEntity(_0x103f28,null))[_0xb196('0x40')](handleError(_0x103f28,null));};exports['describe']=function(_0x5ecdfe,_0x372e17){return db[_0xb196('0x29')][_0xb196('0x49')]()[_0xb196('0x3c')](respondWithResult(_0x372e17,null))[_0xb196('0x40')](handleError(_0x372e17,null));}; \ No newline at end of file +var _0x3229=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','then','sendStatus','error','stack','name','send','index','MailSubstatus','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','map','merge','includeAll','include','rows','catch','rawAttributes','options','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring'];(function(_0x2ae785,_0x4bf274){var _0x43ae5b=function(_0xb40dac){while(--_0xb40dac){_0x2ae785['push'](_0x2ae785['shift']());}};_0x43ae5b(++_0x4bf274);}(_0x3229,0xc7));var _0x9322=function(_0x117f95,_0xe5de5){_0x117f95=_0x117f95-0x0;var _0x4de2ef=_0x3229[_0x117f95];return _0x4de2ef;};'use strict';var emlformat=require(_0x9322('0x0'));var rimraf=require(_0x9322('0x1'));var zipdir=require(_0x9322('0x2'));var jsonpatch=require(_0x9322('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x9322('0x4'));var Mustache=require('mustache');var util=require(_0x9322('0x5'));var path=require('path');var sox=require(_0x9322('0x6'));var csv=require('to-csv');var ejs=require(_0x9322('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9322('0x8'));var squel=require(_0x9322('0x9'));var crypto=require(_0x9322('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x9322('0xb'));var toCsv=require(_0x9322('0xc'));var querystring=require(_0x9322('0xd'));var Papa=require(_0x9322('0xe'));var Redis=require(_0x9322('0xf'));var authService=require(_0x9322('0x10'));var qs=require(_0x9322('0x11'));var as=require(_0x9322('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x9322('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x9322('0x14'));var db=require(_0x9322('0x15'))['db'];function respondWithStatusCode(_0x3c80fa,_0x7c4035){_0x7c4035=_0x7c4035||0xcc;return function(_0x7d8ae9){if(_0x7d8ae9){return _0x3c80fa['sendStatus'](_0x7c4035);}return _0x3c80fa[_0x9322('0x16')](_0x7c4035)[_0x9322('0x17')]();};}function respondWithResult(_0x539f6a,_0x57709d){_0x57709d=_0x57709d||0xc8;return function(_0x526e4d){if(_0x526e4d){return _0x539f6a[_0x9322('0x16')](_0x57709d)[_0x9322('0x18')](_0x526e4d);}};}function respondWithFilteredResult(_0x41ea6e,_0x26cbf4){return function(_0x40786a){if(_0x40786a){var _0x231522=typeof _0x26cbf4['offset']===_0x9322('0x19')&&typeof _0x26cbf4[_0x9322('0x1a')]===_0x9322('0x19');var _0x9677c3=_0x40786a['count'];var _0x507201=_0x231522?0x0:_0x26cbf4['offset'];var _0x3b987d=_0x231522?_0x40786a[_0x9322('0x1b')]:_0x26cbf4[_0x9322('0x1c')]+_0x26cbf4['limit'];var _0x3da241;if(_0x3b987d>=_0x9677c3){_0x3b987d=_0x9677c3;_0x3da241=0xc8;}else{_0x3da241=0xce;}_0x41ea6e[_0x9322('0x16')](_0x3da241);return _0x41ea6e[_0x9322('0x1d')](_0x9322('0x1e'),_0x507201+'-'+_0x3b987d+'/'+_0x9677c3)[_0x9322('0x18')](_0x40786a);}return null;};}function patchUpdates(_0x4a99ef){return function(_0x216688){try{jsonpatch['apply'](_0x216688,_0x4a99ef,!![]);}catch(_0x55befd){return BPromise[_0x9322('0x1f')](_0x55befd);}return _0x216688[_0x9322('0x20')]();};}function saveUpdates(_0x4e7f84,_0x1e5b96){return function(_0x33f904){if(_0x33f904){return _0x33f904[_0x9322('0x21')](_0x4e7f84)['then'](function(_0x371372){return _0x371372;});}return null;};}function removeEntity(_0x297cd6,_0x199b75){return function(_0x2b290b){if(_0x2b290b){return _0x2b290b['destroy']()[_0x9322('0x22')](function(){_0x297cd6[_0x9322('0x16')](0xcc)[_0x9322('0x17')]();});}};}function handleEntityNotFound(_0x1a41d8,_0x4a72e4){return function(_0x26098d){if(!_0x26098d){_0x1a41d8[_0x9322('0x23')](0x194);}return _0x26098d;};}function handleError(_0x2d5fda,_0x5361c3){_0x5361c3=_0x5361c3||0x1f4;return function(_0x29e1e8){logger[_0x9322('0x24')](_0x29e1e8[_0x9322('0x25')]);if(_0x29e1e8[_0x9322('0x26')]){delete _0x29e1e8[_0x9322('0x26')];}_0x2d5fda[_0x9322('0x16')](_0x5361c3)[_0x9322('0x27')](_0x29e1e8);};}exports[_0x9322('0x28')]=function(_0x1bcf64,_0x5149c6){var _0x29dce8={},_0x22f33a={},_0xe0117={'count':0x0,'rows':[]};var _0x3a3254=_['map'](db[_0x9322('0x29')]['rawAttributes'],function(_0x5c53c4){return{'name':_0x5c53c4['fieldName'],'type':_0x5c53c4[_0x9322('0x2a')][_0x9322('0x2b')]};});_0x22f33a[_0x9322('0x2c')]=_['map'](_0x3a3254,_0x9322('0x26'));_0x22f33a[_0x9322('0x2d')]=_[_0x9322('0x2e')](_0x1bcf64['query']);_0x22f33a[_0x9322('0x2f')]=_[_0x9322('0x30')](_0x22f33a[_0x9322('0x2c')],_0x22f33a[_0x9322('0x2d')]);_0x29dce8[_0x9322('0x31')]=_[_0x9322('0x30')](_0x22f33a['model'],qs['fields'](_0x1bcf64['query'][_0x9322('0x32')]));_0x29dce8[_0x9322('0x31')]=_0x29dce8[_0x9322('0x31')][_0x9322('0x33')]?_0x29dce8[_0x9322('0x31')]:_0x22f33a[_0x9322('0x2c')];if(!_0x1bcf64[_0x9322('0x2d')]['hasOwnProperty'](_0x9322('0x34'))){_0x29dce8['limit']=qs[_0x9322('0x1a')](_0x1bcf64[_0x9322('0x2d')]['limit']);_0x29dce8[_0x9322('0x1c')]=qs['offset'](_0x1bcf64[_0x9322('0x2d')][_0x9322('0x1c')]);}_0x29dce8[_0x9322('0x35')]=qs[_0x9322('0x36')](_0x1bcf64[_0x9322('0x2d')][_0x9322('0x36')]);_0x29dce8[_0x9322('0x37')]=qs[_0x9322('0x2f')](_[_0x9322('0x38')](_0x1bcf64['query'],_0x22f33a[_0x9322('0x2f')]),_0x3a3254);if(_0x1bcf64[_0x9322('0x2d')][_0x9322('0x39')]){_0x29dce8[_0x9322('0x37')]=_['merge'](_0x29dce8['where'],{'$or':_[_0x9322('0x3a')](_0x3a3254,function(_0x203568){if(_0x203568[_0x9322('0x2a')]!=='VIRTUAL'){var _0x3ad646={};_0x3ad646[_0x203568[_0x9322('0x26')]]={'$like':'%'+_0x1bcf64[_0x9322('0x2d')][_0x9322('0x39')]+'%'};return _0x3ad646;}})});}_0x29dce8=_[_0x9322('0x3b')]({},_0x29dce8,_0x1bcf64['options']);var _0x249344={'where':_0x29dce8['where']};return db[_0x9322('0x29')]['count'](_0x249344)['then'](function(_0x15307d){_0xe0117['count']=_0x15307d;if(_0x1bcf64[_0x9322('0x2d')][_0x9322('0x3c')]){_0x29dce8[_0x9322('0x3d')]=[{'all':!![]}];}return db[_0x9322('0x29')]['findAll'](_0x29dce8);})[_0x9322('0x22')](function(_0x35aeeb){_0xe0117[_0x9322('0x3e')]=_0x35aeeb;return _0xe0117;})[_0x9322('0x22')](respondWithFilteredResult(_0x5149c6,_0x29dce8))[_0x9322('0x3f')](handleError(_0x5149c6,null));};exports['show']=function(_0x517844,_0x3d111){var _0x280d61={'raw':!![],'where':{'id':_0x517844['params']['id']}},_0x38b0b8={};_0x38b0b8[_0x9322('0x2c')]=_[_0x9322('0x2e')](db[_0x9322('0x29')][_0x9322('0x40')]);_0x38b0b8[_0x9322('0x2d')]=_[_0x9322('0x2e')](_0x517844[_0x9322('0x2d')]);_0x38b0b8[_0x9322('0x2f')]=_[_0x9322('0x30')](_0x38b0b8['model'],_0x38b0b8['query']);_0x280d61['attributes']=_[_0x9322('0x30')](_0x38b0b8['model'],qs[_0x9322('0x32')](_0x517844[_0x9322('0x2d')]['fields']));_0x280d61[_0x9322('0x31')]=_0x280d61['attributes'][_0x9322('0x33')]?_0x280d61[_0x9322('0x31')]:_0x38b0b8[_0x9322('0x2c')];if(_0x517844[_0x9322('0x2d')][_0x9322('0x3c')]){_0x280d61[_0x9322('0x3d')]=[{'all':!![]}];}_0x280d61=_[_0x9322('0x3b')]({},_0x280d61,_0x517844[_0x9322('0x41')]);return db['MailSubstatus'][_0x9322('0x42')](_0x280d61)[_0x9322('0x22')](handleEntityNotFound(_0x3d111,null))[_0x9322('0x22')](respondWithResult(_0x3d111,null))['catch'](handleError(_0x3d111,null));};exports[_0x9322('0x43')]=function(_0xef5bbd,_0x37ae51){return db[_0x9322('0x29')][_0x9322('0x43')](_0xef5bbd['body'],{})[_0x9322('0x22')](respondWithResult(_0x37ae51,0xc9))[_0x9322('0x3f')](handleError(_0x37ae51,null));};exports[_0x9322('0x21')]=function(_0x46ca19,_0x28d6a6){if(_0x46ca19['body']['id']){delete _0x46ca19[_0x9322('0x44')]['id'];}return db[_0x9322('0x29')][_0x9322('0x42')]({'where':{'id':_0x46ca19[_0x9322('0x45')]['id']}})[_0x9322('0x22')](handleEntityNotFound(_0x28d6a6,null))[_0x9322('0x22')](saveUpdates(_0x46ca19[_0x9322('0x44')],null))[_0x9322('0x22')](respondWithResult(_0x28d6a6,null))[_0x9322('0x3f')](handleError(_0x28d6a6,null));};exports['destroy']=function(_0x4884a7,_0x42df3f){return db[_0x9322('0x29')][_0x9322('0x42')]({'where':{'id':_0x4884a7[_0x9322('0x45')]['id']}})[_0x9322('0x22')](handleEntityNotFound(_0x42df3f,null))[_0x9322('0x22')](removeEntity(_0x42df3f,null))[_0x9322('0x3f')](handleError(_0x42df3f,null));};exports['describe']=function(_0x2b2ff8,_0x36a19f){return db['MailSubstatus'][_0x9322('0x46')]()[_0x9322('0x22')](respondWithResult(_0x36a19f,null))[_0x9322('0x3f')](handleError(_0x36a19f,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index 38fe62c..6dd34d9 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 _0x4f3d=['path','rimraf','../../config/environment','./mailSubstatus.attributes','define','MailSubstatus','mail_substatuses','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x1daa55,_0x5eba07){var _0xae58f4=function(_0x2bc7cf){while(--_0x2bc7cf){_0x1daa55['push'](_0x1daa55['shift']());}};_0xae58f4(++_0x5eba07);}(_0x4f3d,0x1c7));var _0xd4f3=function(_0x3b2914,_0xe96791){_0x3b2914=_0x3b2914-0x0;var _0x398c1a=_0x4f3d[_0x3b2914];return _0x398c1a;};'use strict';var _=require(_0xd4f3('0x0'));var util=require(_0xd4f3('0x1'));var logger=require(_0xd4f3('0x2'))(_0xd4f3('0x3'));var moment=require(_0xd4f3('0x4'));var BPromise=require(_0xd4f3('0x5'));var rp=require(_0xd4f3('0x6'));var fs=require('fs');var path=require(_0xd4f3('0x7'));var rimraf=require(_0xd4f3('0x8'));var config=require(_0xd4f3('0x9'));var attributes=require(_0xd4f3('0xa'));module['exports']=function(_0x342a50,_0x25b806){return _0x342a50[_0xd4f3('0xb')](_0xd4f3('0xc'),attributes,{'tableName':_0xd4f3('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x36c3=['api','moment','request-promise','path','rimraf','../../config/environment','MailSubstatus','mail_substatuses','lodash','util','../../config/logger'];(function(_0x1ad557,_0x220324){var _0x36541f=function(_0x3e5d01){while(--_0x3e5d01){_0x1ad557['push'](_0x1ad557['shift']());}};_0x36541f(++_0x220324);}(_0x36c3,0x173));var _0x336c=function(_0x52bb76,_0x325703){_0x52bb76=_0x52bb76-0x0;var _0x2f2f21=_0x36c3[_0x52bb76];return _0x2f2f21;};'use strict';var _=require(_0x336c('0x0'));var util=require(_0x336c('0x1'));var logger=require(_0x336c('0x2'))(_0x336c('0x3'));var moment=require(_0x336c('0x4'));var BPromise=require('bluebird');var rp=require(_0x336c('0x5'));var fs=require('fs');var path=require(_0x336c('0x6'));var rimraf=require(_0x336c('0x7'));var config=require(_0x336c('0x8'));var attributes=require('./mailSubstatus.attributes');module['exports']=function(_0x5674d2,_0x23a9cc){return _0x5674d2['define'](_0x336c('0x9'),attributes,{'tableName':_0x336c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index 79bd98f..af4bbb7 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 _0xfa3d=['http','then','MailSubstatus,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','info','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xfa3d,0x73));var _0xdfa3=function(_0x744bbe,_0xd2ed3){_0x744bbe=_0x744bbe-0x0;var _0x2ee5a7=_0xfa3d[_0x744bbe];return _0x2ee5a7;};'use strict';var _=require(_0xdfa3('0x0'));var util=require(_0xdfa3('0x1'));var moment=require(_0xdfa3('0x2'));var BPromise=require(_0xdfa3('0x3'));var rs=require(_0xdfa3('0x4'));var fs=require('fs');var Redis=require(_0xdfa3('0x5'));var db=require(_0xdfa3('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xdfa3('0x7'))(_0xdfa3('0x8'));var config=require('../../config/environment');var jayson=require(_0xdfa3('0x9'));var client=jayson[_0xdfa3('0xa')][_0xdfa3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xc313b7,_0x240f09,_0xa96269){return new BPromise(function(_0x25fa6b,_0x394943){return client['request'](_0xc313b7,_0xa96269)[_0xdfa3('0xc')](function(_0x3245ad){logger['info'](_0xdfa3('0xd'),_0x240f09,'request\x20sent');logger[_0xdfa3('0xe')]('MailSubstatus,\x20%s,\x20%s,\x20%s',_0x240f09,_0xdfa3('0xf'),JSON[_0xdfa3('0x10')](_0x3245ad));if(_0x3245ad[_0xdfa3('0x11')]){if(_0x3245ad[_0xdfa3('0x11')]['code']===0x1f4){logger[_0xdfa3('0x11')](_0xdfa3('0xd'),_0x240f09,_0x3245ad[_0xdfa3('0x11')][_0xdfa3('0x12')]);return _0x394943(_0x3245ad[_0xdfa3('0x11')][_0xdfa3('0x12')]);}logger[_0xdfa3('0x11')](_0xdfa3('0xd'),_0x240f09,_0x3245ad['error'][_0xdfa3('0x12')]);return _0x25fa6b(_0x3245ad[_0xdfa3('0x11')][_0xdfa3('0x12')]);}else{logger[_0xdfa3('0x13')](_0xdfa3('0xd'),_0x240f09,_0xdfa3('0xf'));_0x25fa6b(_0x3245ad[_0xdfa3('0x14')][_0xdfa3('0x12')]);}})['catch'](function(_0x548b37){logger['error']('MailSubstatus,\x20%s,\x20%s',_0x240f09,_0x548b37);_0x394943(_0x548b37);});});} \ No newline at end of file +var _0x06dc=['request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','../../config/logger','jayson/promise','client','http','request','then','info','MailSubstatus,\x20%s,\x20%s'];(function(_0x5cda26,_0x1a79be){var _0x457e92=function(_0x4846a8){while(--_0x4846a8){_0x5cda26['push'](_0x5cda26['shift']());}};_0x457e92(++_0x1a79be);}(_0x06dc,0x87));var _0xc06d=function(_0x19d7bf,_0x265436){_0x19d7bf=_0x19d7bf-0x0;var _0x46494c=_0x06dc[_0x19d7bf];return _0x46494c;};'use strict';var _=require(_0xc06d('0x0'));var util=require('util');var moment=require(_0xc06d('0x1'));var BPromise=require(_0xc06d('0x2'));var rs=require(_0xc06d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xc06d('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0xc06d('0x5'));var client=jayson[_0xc06d('0x6')][_0xc06d('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2fe6bd,_0x36bcae,_0x281c3e){return new BPromise(function(_0x1b29ec,_0x1b88df){return client[_0xc06d('0x8')](_0x2fe6bd,_0x281c3e)[_0xc06d('0x9')](function(_0x1a01d4){logger[_0xc06d('0xa')](_0xc06d('0xb'),_0x36bcae,_0xc06d('0xc'));logger[_0xc06d('0xd')](_0xc06d('0xe'),_0x36bcae,_0xc06d('0xc'),JSON[_0xc06d('0xf')](_0x1a01d4));if(_0x1a01d4[_0xc06d('0x10')]){if(_0x1a01d4['error'][_0xc06d('0x11')]===0x1f4){logger[_0xc06d('0x10')](_0xc06d('0xb'),_0x36bcae,_0x1a01d4[_0xc06d('0x10')][_0xc06d('0x12')]);return _0x1b88df(_0x1a01d4[_0xc06d('0x10')][_0xc06d('0x12')]);}logger['error'](_0xc06d('0xb'),_0x36bcae,_0x1a01d4[_0xc06d('0x10')][_0xc06d('0x12')]);return _0x1b29ec(_0x1a01d4['error'][_0xc06d('0x12')]);}else{logger[_0xc06d('0xa')]('MailSubstatus,\x20%s,\x20%s',_0x36bcae,'request\x20sent');_0x1b29ec(_0x1a01d4[_0xc06d('0x13')]['message']);}})[_0xc06d('0x14')](function(_0x25c1fc){logger[_0xc06d('0x10')]('MailSubstatus,\x20%s,\x20%s',_0x36bcae,_0x25c1fc);_0x1b88df(_0x25c1fc);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index 4b99b06..c0012f7 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 _0x4010=['isAuthenticated','index','/describe','describe','post','create','put','/:id','delete','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailTransferReport.controller','get'];(function(_0x6da433,_0x38cf77){var _0x214d4d=function(_0x1e0a77){while(--_0x1e0a77){_0x6da433['push'](_0x6da433['shift']());}};_0x214d4d(++_0x38cf77);}(_0x4010,0x81));var _0x0401=function(_0x4db886,_0x563142){_0x4db886=_0x4db886-0x0;var _0x4cfc0e=_0x4010[_0x4db886];return _0x4cfc0e;};'use strict';var multer=require(_0x0401('0x0'));var util=require(_0x0401('0x1'));var path=require(_0x0401('0x2'));var timeout=require(_0x0401('0x3'));var express=require(_0x0401('0x4'));var router=express[_0x0401('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x0401('0x6'));var interaction=require(_0x0401('0x7'));var config=require(_0x0401('0x8'));var controller=require(_0x0401('0x9'));router[_0x0401('0xa')]('/',auth[_0x0401('0xb')](),controller[_0x0401('0xc')]);router['get'](_0x0401('0xd'),auth[_0x0401('0xb')](),controller[_0x0401('0xe')]);router[_0x0401('0xa')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x0401('0xf')]('/',auth['isAuthenticated'](),controller[_0x0401('0x10')]);router[_0x0401('0x11')](_0x0401('0x12'),auth[_0x0401('0xb')](),controller['update']);router[_0x0401('0x13')](_0x0401('0x12'),auth[_0x0401('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x774b=['./mailTransferReport.controller','get','isAuthenticated','describe','create','/:id','update','delete','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x774b,0x170));var _0xb774=function(_0x5a4032,_0x3e5108){_0x5a4032=_0x5a4032-0x0;var _0x26e7c6=_0x774b[_0x5a4032];return _0x26e7c6;};'use strict';var multer=require('multer');var util=require(_0xb774('0x0'));var path=require('path');var timeout=require(_0xb774('0x1'));var express=require(_0xb774('0x2'));var router=express['Router']();var fs_extra=require(_0xb774('0x3'));var auth=require(_0xb774('0x4'));var interaction=require(_0xb774('0x5'));var config=require(_0xb774('0x6'));var controller=require(_0xb774('0x7'));router[_0xb774('0x8')]('/',auth[_0xb774('0x9')](),controller['index']);router['get']('/describe',auth[_0xb774('0x9')](),controller[_0xb774('0xa')]);router[_0xb774('0x8')]('/:id',auth[_0xb774('0x9')](),controller['show']);router['post']('/',auth[_0xb774('0x9')](),controller[_0xb774('0xb')]);router['put'](_0xb774('0xc'),auth[_0xb774('0x9')](),controller[_0xb774('0xd')]);router[_0xb774('0xe')](_0xb774('0xc'),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 55cdaa8..a5fe898 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 _0xaa88=['account','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x12eb96,_0x1e779d){var _0x35ce63=function(_0x2a76c1){while(--_0x2a76c1){_0x12eb96['push'](_0x12eb96['shift']());}};_0x35ce63(++_0x1e779d);}(_0xaa88,0x137));var _0x8aa8=function(_0xfd5f37,_0x24a79c){_0xfd5f37=_0xfd5f37-0x0;var _0x11bd01=_0xaa88[_0xfd5f37];return _0x11bd01;};'use strict';var moment=require(_0x8aa8('0x0'));var Sequelize=require(_0x8aa8('0x1'));module[_0x8aa8('0x2')]={'uniqueid':{'type':Sequelize[_0x8aa8('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x8aa8('0x4'),_0x8aa8('0x5'),_0x8aa8('0x6')),'allowNull':![],'defaultValue':_0x8aa8('0x6')},'transferredAt':{'type':Sequelize[_0x8aa8('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x8aa8('0x8')]}}; \ No newline at end of file +var _0xa9e0=['account','queue','DATE','NOW','moment','sequelize','exports'];(function(_0x36949f,_0xac8926){var _0x225ac9=function(_0x234feb){while(--_0x234feb){_0x36949f['push'](_0x36949f['shift']());}};_0x225ac9(++_0xac8926);}(_0xa9e0,0x123));var _0x0a9e=function(_0x521929,_0x479be5){_0x521929=_0x521929-0x0;var _0x632436=_0xa9e0[_0x521929];return _0x632436;};'use strict';var moment=require(_0x0a9e('0x0'));var Sequelize=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x3'),'agent',_0x0a9e('0x4')),'allowNull':![],'defaultValue':_0x0a9e('0x4')},'transferredAt':{'type':Sequelize[_0x0a9e('0x5')],'allowNull':![],'defaultValue':Sequelize[_0x0a9e('0x6')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index 717bbad..190e25b 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 _0x389a=['../../config/utils','../../config/environment','../../mysqldb','status','json','offset','undefined','count','Content-Range','apply','save','update','then','destroy','end','sendStatus','name','send','map','MailTransferReport','rawAttributes','fieldName','type','key','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','findAll','rows','catch','show','params','keys','include','find','create','body','describe','eml-format','rimraf','zip-dir','request-promise','bluebird','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x389a,0x10f));var _0xa389=function(_0x29d89e,_0x230ed4){_0x29d89e=_0x29d89e-0x0;var _0x5c9adf=_0x389a[_0x29d89e];return _0x5c9adf;};'use strict';var emlformat=require(_0xa389('0x0'));var rimraf=require(_0xa389('0x1'));var zipdir=require(_0xa389('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa389('0x3'));var moment=require('moment');var BPromise=require(_0xa389('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xa389('0x5'));var sox=require(_0xa389('0x6'));var csv=require(_0xa389('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa389('0x8'));var _=require(_0xa389('0x9'));var squel=require(_0xa389('0xa'));var crypto=require(_0xa389('0xb'));var jsforce=require(_0xa389('0xc'));var deskjs=require(_0xa389('0xd'));var toCsv=require(_0xa389('0x7'));var querystring=require('querystring');var Papa=require(_0xa389('0xe'));var Redis=require(_0xa389('0xf'));var authService=require(_0xa389('0x10'));var qs=require(_0xa389('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa389('0x12'));var logger=require(_0xa389('0x13'))(_0xa389('0x14'));var utils=require(_0xa389('0x15'));var config=require(_0xa389('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xa389('0x17'))['db'];function respondWithStatusCode(_0x30367a,_0x2ba394){_0x2ba394=_0x2ba394||0xcc;return function(_0x2a6eca){if(_0x2a6eca){return _0x30367a['sendStatus'](_0x2ba394);}return _0x30367a['status'](_0x2ba394)['end']();};}function respondWithResult(_0x5e5010,_0x2187d4){_0x2187d4=_0x2187d4||0xc8;return function(_0x138cd6){if(_0x138cd6){return _0x5e5010[_0xa389('0x18')](_0x2187d4)[_0xa389('0x19')](_0x138cd6);}};}function respondWithFilteredResult(_0x99162b,_0x1c039e){return function(_0x31a2be){if(_0x31a2be){var _0x4c0fbe=typeof _0x1c039e[_0xa389('0x1a')]===_0xa389('0x1b')&&typeof _0x1c039e['limit']==='undefined';var _0x28aec5=_0x31a2be[_0xa389('0x1c')];var _0x53c528=_0x4c0fbe?0x0:_0x1c039e[_0xa389('0x1a')];var _0x5a059c=_0x4c0fbe?_0x31a2be['count']:_0x1c039e[_0xa389('0x1a')]+_0x1c039e['limit'];var _0x535c95;if(_0x5a059c>=_0x28aec5){_0x5a059c=_0x28aec5;_0x535c95=0xc8;}else{_0x535c95=0xce;}_0x99162b[_0xa389('0x18')](_0x535c95);return _0x99162b['set'](_0xa389('0x1d'),_0x53c528+'-'+_0x5a059c+'/'+_0x28aec5)['json'](_0x31a2be);}return null;};}function patchUpdates(_0x1e6d39){return function(_0x5e4012){try{jsonpatch[_0xa389('0x1e')](_0x5e4012,_0x1e6d39,!![]);}catch(_0x5edbc6){return BPromise['reject'](_0x5edbc6);}return _0x5e4012[_0xa389('0x1f')]();};}function saveUpdates(_0x3e468b,_0xb3bf33){return function(_0x1a9388){if(_0x1a9388){return _0x1a9388[_0xa389('0x20')](_0x3e468b)[_0xa389('0x21')](function(_0xa595bb){return _0xa595bb;});}return null;};}function removeEntity(_0x713a71,_0x4c4a0c){return function(_0xd89b41){if(_0xd89b41){return _0xd89b41[_0xa389('0x22')]()['then'](function(){_0x713a71[_0xa389('0x18')](0xcc)[_0xa389('0x23')]();});}};}function handleEntityNotFound(_0x10dda6,_0x44f95a){return function(_0x361f93){if(!_0x361f93){_0x10dda6[_0xa389('0x24')](0x194);}return _0x361f93;};}function handleError(_0x163fb8,_0x36fe20){_0x36fe20=_0x36fe20||0x1f4;return function(_0x4e77f4){logger['error'](_0x4e77f4['stack']);if(_0x4e77f4[_0xa389('0x25')]){delete _0x4e77f4['name'];}_0x163fb8[_0xa389('0x18')](_0x36fe20)[_0xa389('0x26')](_0x4e77f4);};}exports['index']=function(_0xbe5835,_0x340e69){var _0x8267ae={},_0x2d7380={},_0x1f8524={'count':0x0,'rows':[]};var _0x27cea0=_[_0xa389('0x27')](db[_0xa389('0x28')][_0xa389('0x29')],function(_0x22d157){return{'name':_0x22d157[_0xa389('0x2a')],'type':_0x22d157[_0xa389('0x2b')][_0xa389('0x2c')]};});_0x2d7380[_0xa389('0x2d')]=_['map'](_0x27cea0,_0xa389('0x25'));_0x2d7380[_0xa389('0x2e')]=_['keys'](_0xbe5835[_0xa389('0x2e')]);_0x2d7380['filters']=_[_0xa389('0x2f')](_0x2d7380[_0xa389('0x2d')],_0x2d7380['query']);_0x8267ae['attributes']=_[_0xa389('0x2f')](_0x2d7380['model'],qs['fields'](_0xbe5835[_0xa389('0x2e')][_0xa389('0x30')]));_0x8267ae[_0xa389('0x31')]=_0x8267ae[_0xa389('0x31')][_0xa389('0x32')]?_0x8267ae[_0xa389('0x31')]:_0x2d7380[_0xa389('0x2d')];if(!_0xbe5835[_0xa389('0x2e')][_0xa389('0x33')](_0xa389('0x34'))){_0x8267ae[_0xa389('0x35')]=qs[_0xa389('0x35')](_0xbe5835['query']['limit']);_0x8267ae[_0xa389('0x1a')]=qs[_0xa389('0x1a')](_0xbe5835['query'][_0xa389('0x1a')]);}_0x8267ae['order']=qs[_0xa389('0x36')](_0xbe5835[_0xa389('0x2e')]['sort']);_0x8267ae[_0xa389('0x37')]=qs[_0xa389('0x38')](_[_0xa389('0x39')](_0xbe5835['query'],_0x2d7380['filters']),_0x27cea0);if(_0xbe5835[_0xa389('0x2e')][_0xa389('0x3a')]){_0x8267ae[_0xa389('0x37')]=_[_0xa389('0x3b')](_0x8267ae['where'],{'$or':_[_0xa389('0x27')](_0x27cea0,function(_0x86c8ed){if(_0x86c8ed['type']!==_0xa389('0x3c')){var _0x37a104={};_0x37a104[_0x86c8ed['name']]={'$like':'%'+_0xbe5835['query']['filter']+'%'};return _0x37a104;}})});}_0x8267ae=_[_0xa389('0x3b')]({},_0x8267ae,_0xbe5835['options']);var _0x280c16={'where':_0x8267ae['where']};return db[_0xa389('0x28')]['count'](_0x280c16)[_0xa389('0x21')](function(_0x4bcacd){_0x1f8524['count']=_0x4bcacd;if(_0xbe5835[_0xa389('0x2e')][_0xa389('0x3d')]){_0x8267ae['include']=[{'all':!![]}];}return db[_0xa389('0x28')][_0xa389('0x3e')](_0x8267ae);})['then'](function(_0x443548){_0x1f8524[_0xa389('0x3f')]=_0x443548;return _0x1f8524;})[_0xa389('0x21')](respondWithFilteredResult(_0x340e69,_0x8267ae))[_0xa389('0x40')](handleError(_0x340e69,null));};exports[_0xa389('0x41')]=function(_0x1eafcd,_0x320424){var _0x3a6563={'raw':!![],'where':{'id':_0x1eafcd[_0xa389('0x42')]['id']}},_0x4bbd96={};_0x4bbd96[_0xa389('0x2d')]=_[_0xa389('0x43')](db[_0xa389('0x28')]['rawAttributes']);_0x4bbd96['query']=_[_0xa389('0x43')](_0x1eafcd[_0xa389('0x2e')]);_0x4bbd96[_0xa389('0x38')]=_[_0xa389('0x2f')](_0x4bbd96[_0xa389('0x2d')],_0x4bbd96[_0xa389('0x2e')]);_0x3a6563[_0xa389('0x31')]=_[_0xa389('0x2f')](_0x4bbd96[_0xa389('0x2d')],qs[_0xa389('0x30')](_0x1eafcd[_0xa389('0x2e')][_0xa389('0x30')]));_0x3a6563['attributes']=_0x3a6563['attributes']['length']?_0x3a6563[_0xa389('0x31')]:_0x4bbd96[_0xa389('0x2d')];if(_0x1eafcd['query']['includeAll']){_0x3a6563[_0xa389('0x44')]=[{'all':!![]}];}_0x3a6563=_[_0xa389('0x3b')]({},_0x3a6563,_0x1eafcd['options']);return db[_0xa389('0x28')][_0xa389('0x45')](_0x3a6563)['then'](handleEntityNotFound(_0x320424,null))[_0xa389('0x21')](respondWithResult(_0x320424,null))['catch'](handleError(_0x320424,null));};exports['create']=function(_0xeecd2c,_0x2e5ed6){return db['MailTransferReport'][_0xa389('0x46')](_0xeecd2c[_0xa389('0x47')],{})[_0xa389('0x21')](respondWithResult(_0x2e5ed6,0xc9))[_0xa389('0x40')](handleError(_0x2e5ed6,null));};exports[_0xa389('0x20')]=function(_0x3c304d,_0x2c6a7f){if(_0x3c304d[_0xa389('0x47')]['id']){delete _0x3c304d[_0xa389('0x47')]['id'];}return db[_0xa389('0x28')][_0xa389('0x45')]({'where':{'id':_0x3c304d['params']['id']}})[_0xa389('0x21')](handleEntityNotFound(_0x2c6a7f,null))[_0xa389('0x21')](saveUpdates(_0x3c304d[_0xa389('0x47')],null))[_0xa389('0x21')](respondWithResult(_0x2c6a7f,null))[_0xa389('0x40')](handleError(_0x2c6a7f,null));};exports['destroy']=function(_0x235494,_0x476e22){return db[_0xa389('0x28')]['find']({'where':{'id':_0x235494[_0xa389('0x42')]['id']}})['then'](handleEntityNotFound(_0x476e22,null))[_0xa389('0x21')](removeEntity(_0x476e22,null))[_0xa389('0x40')](handleError(_0x476e22,null));};exports[_0xa389('0x48')]=function(_0x1084f1,_0x48f3e8){return db[_0xa389('0x28')][_0xa389('0x48')]()[_0xa389('0x21')](respondWithResult(_0x48f3e8,null))['catch'](handleError(_0x48f3e8,null));}; \ No newline at end of file +var _0xde04=['where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','params','find','create','body','destroy','describe','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','offset','undefined','limit','count','Content-Range','json','apply','reject','save','update','then','end','stack','name','send','map','MailTransferReport','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xde04,0xee));var _0x4de0=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xde04[_0xa464c9];return _0x3d73c4;};'use strict';var emlformat=require(_0x4de0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4de0('0x1'));var jsonpatch=require(_0x4de0('0x2'));var rp=require('request-promise');var moment=require(_0x4de0('0x3'));var BPromise=require(_0x4de0('0x4'));var Mustache=require(_0x4de0('0x5'));var util=require('util');var path=require(_0x4de0('0x6'));var sox=require(_0x4de0('0x7'));var csv=require('to-csv');var ejs=require(_0x4de0('0x8'));var fs=require('fs');var fs_extra=require(_0x4de0('0x9'));var _=require(_0x4de0('0xa'));var squel=require(_0x4de0('0xb'));var crypto=require(_0x4de0('0xc'));var jsforce=require(_0x4de0('0xd'));var deskjs=require(_0x4de0('0xe'));var toCsv=require(_0x4de0('0xf'));var querystring=require(_0x4de0('0x10'));var Papa=require('papaparse');var Redis=require(_0x4de0('0x11'));var authService=require(_0x4de0('0x12'));var qs=require(_0x4de0('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4de0('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x4de0('0x15'));var config=require(_0x4de0('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x4de0('0x17'))['db'];function respondWithStatusCode(_0x267794,_0x42e609){_0x42e609=_0x42e609||0xcc;return function(_0x2b6bea){if(_0x2b6bea){return _0x267794[_0x4de0('0x18')](_0x42e609);}return _0x267794[_0x4de0('0x19')](_0x42e609)['end']();};}function respondWithResult(_0x1e4862,_0x2b9b7f){_0x2b9b7f=_0x2b9b7f||0xc8;return function(_0x468f22){if(_0x468f22){return _0x1e4862[_0x4de0('0x19')](_0x2b9b7f)['json'](_0x468f22);}};}function respondWithFilteredResult(_0xa8a3ee,_0x18b236){return function(_0x50b9c9){if(_0x50b9c9){var _0x257c63=typeof _0x18b236[_0x4de0('0x1a')]===_0x4de0('0x1b')&&typeof _0x18b236[_0x4de0('0x1c')]===_0x4de0('0x1b');var _0x88375e=_0x50b9c9[_0x4de0('0x1d')];var _0x32c868=_0x257c63?0x0:_0x18b236[_0x4de0('0x1a')];var _0x1c5fcb=_0x257c63?_0x50b9c9[_0x4de0('0x1d')]:_0x18b236['offset']+_0x18b236[_0x4de0('0x1c')];var _0x4801d6;if(_0x1c5fcb>=_0x88375e){_0x1c5fcb=_0x88375e;_0x4801d6=0xc8;}else{_0x4801d6=0xce;}_0xa8a3ee[_0x4de0('0x19')](_0x4801d6);return _0xa8a3ee['set'](_0x4de0('0x1e'),_0x32c868+'-'+_0x1c5fcb+'/'+_0x88375e)[_0x4de0('0x1f')](_0x50b9c9);}return null;};}function patchUpdates(_0x29bc5e){return function(_0x3cced0){try{jsonpatch[_0x4de0('0x20')](_0x3cced0,_0x29bc5e,!![]);}catch(_0x35b7c4){return BPromise[_0x4de0('0x21')](_0x35b7c4);}return _0x3cced0[_0x4de0('0x22')]();};}function saveUpdates(_0x1d15ce,_0xc0ab60){return function(_0x51e16d){if(_0x51e16d){return _0x51e16d[_0x4de0('0x23')](_0x1d15ce)[_0x4de0('0x24')](function(_0x3aaa99){return _0x3aaa99;});}return null;};}function removeEntity(_0x2aa83c,_0x1b7dc8){return function(_0x260791){if(_0x260791){return _0x260791['destroy']()[_0x4de0('0x24')](function(){_0x2aa83c[_0x4de0('0x19')](0xcc)[_0x4de0('0x25')]();});}};}function handleEntityNotFound(_0x54fc59,_0x3dc5d9){return function(_0xee0ed5){if(!_0xee0ed5){_0x54fc59['sendStatus'](0x194);}return _0xee0ed5;};}function handleError(_0x2aca40,_0x147d84){_0x147d84=_0x147d84||0x1f4;return function(_0x53beb1){logger['error'](_0x53beb1[_0x4de0('0x26')]);if(_0x53beb1[_0x4de0('0x27')]){delete _0x53beb1['name'];}_0x2aca40[_0x4de0('0x19')](_0x147d84)[_0x4de0('0x28')](_0x53beb1);};}exports['index']=function(_0x3f485f,_0x2c15c1){var _0x45f249={},_0x9f75e5={},_0xd72be={'count':0x0,'rows':[]};var _0x374305=_[_0x4de0('0x29')](db[_0x4de0('0x2a')][_0x4de0('0x2b')],function(_0x4c3c4a){return{'name':_0x4c3c4a[_0x4de0('0x2c')],'type':_0x4c3c4a[_0x4de0('0x2d')][_0x4de0('0x2e')]};});_0x9f75e5['model']=_[_0x4de0('0x29')](_0x374305,'name');_0x9f75e5[_0x4de0('0x2f')]=_[_0x4de0('0x30')](_0x3f485f[_0x4de0('0x2f')]);_0x9f75e5[_0x4de0('0x31')]=_[_0x4de0('0x32')](_0x9f75e5[_0x4de0('0x33')],_0x9f75e5['query']);_0x45f249['attributes']=_[_0x4de0('0x32')](_0x9f75e5['model'],qs[_0x4de0('0x34')](_0x3f485f['query'][_0x4de0('0x34')]));_0x45f249[_0x4de0('0x35')]=_0x45f249[_0x4de0('0x35')][_0x4de0('0x36')]?_0x45f249['attributes']:_0x9f75e5[_0x4de0('0x33')];if(!_0x3f485f[_0x4de0('0x2f')][_0x4de0('0x37')](_0x4de0('0x38'))){_0x45f249['limit']=qs[_0x4de0('0x1c')](_0x3f485f[_0x4de0('0x2f')][_0x4de0('0x1c')]);_0x45f249[_0x4de0('0x1a')]=qs[_0x4de0('0x1a')](_0x3f485f[_0x4de0('0x2f')][_0x4de0('0x1a')]);}_0x45f249['order']=qs[_0x4de0('0x39')](_0x3f485f[_0x4de0('0x2f')]['sort']);_0x45f249[_0x4de0('0x3a')]=qs[_0x4de0('0x31')](_[_0x4de0('0x3b')](_0x3f485f[_0x4de0('0x2f')],_0x9f75e5[_0x4de0('0x31')]),_0x374305);if(_0x3f485f[_0x4de0('0x2f')][_0x4de0('0x3c')]){_0x45f249[_0x4de0('0x3a')]=_[_0x4de0('0x3d')](_0x45f249['where'],{'$or':_[_0x4de0('0x29')](_0x374305,function(_0x28f049){if(_0x28f049[_0x4de0('0x2d')]!==_0x4de0('0x3e')){var _0x3476b3={};_0x3476b3[_0x28f049[_0x4de0('0x27')]]={'$like':'%'+_0x3f485f[_0x4de0('0x2f')][_0x4de0('0x3c')]+'%'};return _0x3476b3;}})});}_0x45f249=_[_0x4de0('0x3d')]({},_0x45f249,_0x3f485f[_0x4de0('0x3f')]);var _0x147fd5={'where':_0x45f249[_0x4de0('0x3a')]};return db[_0x4de0('0x2a')][_0x4de0('0x1d')](_0x147fd5)['then'](function(_0x18aa87){_0xd72be[_0x4de0('0x1d')]=_0x18aa87;if(_0x3f485f[_0x4de0('0x2f')][_0x4de0('0x40')]){_0x45f249[_0x4de0('0x41')]=[{'all':!![]}];}return db['MailTransferReport']['findAll'](_0x45f249);})['then'](function(_0x5da763){_0xd72be[_0x4de0('0x42')]=_0x5da763;return _0xd72be;})['then'](respondWithFilteredResult(_0x2c15c1,_0x45f249))[_0x4de0('0x43')](handleError(_0x2c15c1,null));};exports['show']=function(_0x121097,_0x59e11e){var _0x157568={'raw':!![],'where':{'id':_0x121097[_0x4de0('0x44')]['id']}},_0x7b2ed3={};_0x7b2ed3[_0x4de0('0x33')]=_[_0x4de0('0x30')](db[_0x4de0('0x2a')]['rawAttributes']);_0x7b2ed3[_0x4de0('0x2f')]=_[_0x4de0('0x30')](_0x121097[_0x4de0('0x2f')]);_0x7b2ed3[_0x4de0('0x31')]=_[_0x4de0('0x32')](_0x7b2ed3['model'],_0x7b2ed3[_0x4de0('0x2f')]);_0x157568[_0x4de0('0x35')]=_['intersection'](_0x7b2ed3[_0x4de0('0x33')],qs['fields'](_0x121097[_0x4de0('0x2f')]['fields']));_0x157568[_0x4de0('0x35')]=_0x157568['attributes'][_0x4de0('0x36')]?_0x157568[_0x4de0('0x35')]:_0x7b2ed3[_0x4de0('0x33')];if(_0x121097['query']['includeAll']){_0x157568[_0x4de0('0x41')]=[{'all':!![]}];}_0x157568=_[_0x4de0('0x3d')]({},_0x157568,_0x121097[_0x4de0('0x3f')]);return db[_0x4de0('0x2a')][_0x4de0('0x45')](_0x157568)[_0x4de0('0x24')](handleEntityNotFound(_0x59e11e,null))[_0x4de0('0x24')](respondWithResult(_0x59e11e,null))[_0x4de0('0x43')](handleError(_0x59e11e,null));};exports['create']=function(_0x4bc874,_0x51590a){return db[_0x4de0('0x2a')][_0x4de0('0x46')](_0x4bc874[_0x4de0('0x47')],{})[_0x4de0('0x24')](respondWithResult(_0x51590a,0xc9))[_0x4de0('0x43')](handleError(_0x51590a,null));};exports[_0x4de0('0x23')]=function(_0x47e2ab,_0xd4855){if(_0x47e2ab[_0x4de0('0x47')]['id']){delete _0x47e2ab[_0x4de0('0x47')]['id'];}return db['MailTransferReport']['find']({'where':{'id':_0x47e2ab[_0x4de0('0x44')]['id']}})[_0x4de0('0x24')](handleEntityNotFound(_0xd4855,null))[_0x4de0('0x24')](saveUpdates(_0x47e2ab['body'],null))[_0x4de0('0x24')](respondWithResult(_0xd4855,null))[_0x4de0('0x43')](handleError(_0xd4855,null));};exports[_0x4de0('0x48')]=function(_0x47ef75,_0x2ff989){return db['MailTransferReport'][_0x4de0('0x45')]({'where':{'id':_0x47ef75[_0x4de0('0x44')]['id']}})[_0x4de0('0x24')](handleEntityNotFound(_0x2ff989,null))[_0x4de0('0x24')](removeEntity(_0x2ff989,null))[_0x4de0('0x43')](handleError(_0x2ff989,null));};exports[_0x4de0('0x49')]=function(_0x201a9a,_0x2ec1d8){return db[_0x4de0('0x2a')]['describe']()[_0x4de0('0x24')](respondWithResult(_0x2ec1d8,null))[_0x4de0('0x43')](handleError(_0x2ec1d8,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index 211d1d8..910ef21 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 _0x16d8=['request-promise','path','rimraf','../../config/environment','exports','define','MailTransferReport','report_mail_transfer','uniqueid','util','../../config/logger','api','moment','bluebird'];(function(_0x2cb85d,_0x217215){var _0x873044=function(_0xcc12a2){while(--_0xcc12a2){_0x2cb85d['push'](_0x2cb85d['shift']());}};_0x873044(++_0x217215);}(_0x16d8,0xa3));var _0x816d=function(_0x19097c,_0x27c6b7){_0x19097c=_0x19097c-0x0;var _0x516ebf=_0x16d8[_0x19097c];return _0x516ebf;};'use strict';var _=require('lodash');var util=require(_0x816d('0x0'));var logger=require(_0x816d('0x1'))(_0x816d('0x2'));var moment=require(_0x816d('0x3'));var BPromise=require(_0x816d('0x4'));var rp=require(_0x816d('0x5'));var fs=require('fs');var path=require(_0x816d('0x6'));var rimraf=require(_0x816d('0x7'));var config=require(_0x816d('0x8'));var attributes=require('./mailTransferReport.attributes');module[_0x816d('0x9')]=function(_0x58d744,_0x39c8dc){return _0x58d744[_0x816d('0xa')](_0x816d('0xb'),attributes,{'tableName':_0x816d('0xc'),'paranoid':![],'indexes':[{'name':_0x816d('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x0e5d=['lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','./mailTransferReport.attributes','exports','define','report_mail_transfer','uniqueid'];(function(_0x554ee1,_0x10e023){var _0x3e3c7a=function(_0x58b389){while(--_0x58b389){_0x554ee1['push'](_0x554ee1['shift']());}};_0x3e3c7a(++_0x10e023);}(_0x0e5d,0x152));var _0xd0e5=function(_0x1bba31,_0x263591){_0x1bba31=_0x1bba31-0x0;var _0x27dad3=_0x0e5d[_0x1bba31];return _0x27dad3;};'use strict';var _=require(_0xd0e5('0x0'));var util=require(_0xd0e5('0x1'));var logger=require('../../config/logger')(_0xd0e5('0x2'));var moment=require(_0xd0e5('0x3'));var BPromise=require(_0xd0e5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd0e5('0x5'));var rimraf=require(_0xd0e5('0x6'));var config=require(_0xd0e5('0x7'));var attributes=require(_0xd0e5('0x8'));module[_0xd0e5('0x9')]=function(_0x46d98f,_0x9f0912){return _0x46d98f[_0xd0e5('0xa')]('MailTransferReport',attributes,{'tableName':_0xd0e5('0xb'),'paranoid':![],'indexes':[{'name':_0xd0e5('0xc'),'fields':[_0xd0e5('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index fba70c7..f095daa 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 _0xa351=['info','result','lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x640b06,_0x58d228){var _0x1d9a61=function(_0xc89163){while(--_0xc89163){_0x640b06['push'](_0x640b06['shift']());}};_0x1d9a61(++_0x58d228);}(_0xa351,0x17c));var _0x1a35=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xa351[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x1a35('0x0'));var util=require(_0x1a35('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x1a35('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1a35('0x3'))['db'];var utils=require(_0x1a35('0x4'));var logger=require(_0x1a35('0x5'))(_0x1a35('0x6'));var config=require(_0x1a35('0x7'));var jayson=require(_0x1a35('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5cf90d,_0x40e4a8,_0x47aa44){return new BPromise(function(_0x498193,_0x475d1f){return client[_0x1a35('0x9')](_0x5cf90d,_0x47aa44)[_0x1a35('0xa')](function(_0xb22b1a){logger['info'](_0x1a35('0xb'),_0x40e4a8,_0x1a35('0xc'));logger[_0x1a35('0xd')](_0x1a35('0xe'),_0x40e4a8,_0x1a35('0xc'),JSON[_0x1a35('0xf')](_0xb22b1a));if(_0xb22b1a[_0x1a35('0x10')]){if(_0xb22b1a[_0x1a35('0x10')][_0x1a35('0x11')]===0x1f4){logger[_0x1a35('0x10')]('MailTransferReport,\x20%s,\x20%s',_0x40e4a8,_0xb22b1a[_0x1a35('0x10')][_0x1a35('0x12')]);return _0x475d1f(_0xb22b1a[_0x1a35('0x10')]['message']);}logger[_0x1a35('0x10')](_0x1a35('0xb'),_0x40e4a8,_0xb22b1a[_0x1a35('0x10')][_0x1a35('0x12')]);return _0x498193(_0xb22b1a['error'][_0x1a35('0x12')]);}else{logger[_0x1a35('0x13')](_0x1a35('0xb'),_0x40e4a8,_0x1a35('0xc'));_0x498193(_0xb22b1a[_0x1a35('0x14')][_0x1a35('0x12')]);}})['catch'](function(_0x308130){logger[_0x1a35('0x10')](_0x1a35('0xb'),_0x40e4a8,_0x308130);_0x475d1f(_0x308130);});});} \ No newline at end of file +var _0x09ae=['http','request','then','info','MailTransferReport,\x20%s,\x20%s','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client'];(function(_0x570568,_0xac3433){var _0x4af78d=function(_0x40d8c7){while(--_0x40d8c7){_0x570568['push'](_0x570568['shift']());}};_0x4af78d(++_0xac3433);}(_0x09ae,0xbd));var _0xe09a=function(_0x226c0e,_0x3935c8){_0x226c0e=_0x226c0e-0x0;var _0x95ec59=_0x09ae[_0x226c0e];return _0x95ec59;};'use strict';var _=require(_0xe09a('0x0'));var util=require(_0xe09a('0x1'));var moment=require(_0xe09a('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe09a('0x3'))['db'];var utils=require(_0xe09a('0x4'));var logger=require(_0xe09a('0x5'))(_0xe09a('0x6'));var config=require('../../config/environment');var jayson=require(_0xe09a('0x7'));var client=jayson[_0xe09a('0x8')][_0xe09a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x393902,_0x3fcc20,_0x31f969){return new BPromise(function(_0x251d64,_0x5bbe88){return client[_0xe09a('0xa')](_0x393902,_0x31f969)[_0xe09a('0xb')](function(_0x2a4ece){logger[_0xe09a('0xc')](_0xe09a('0xd'),_0x3fcc20,'request\x20sent');logger[_0xe09a('0xe')](_0xe09a('0xf'),_0x3fcc20,_0xe09a('0x10'),JSON['stringify'](_0x2a4ece));if(_0x2a4ece[_0xe09a('0x11')]){if(_0x2a4ece[_0xe09a('0x11')][_0xe09a('0x12')]===0x1f4){logger[_0xe09a('0x11')](_0xe09a('0xd'),_0x3fcc20,_0x2a4ece[_0xe09a('0x11')][_0xe09a('0x13')]);return _0x5bbe88(_0x2a4ece[_0xe09a('0x11')][_0xe09a('0x13')]);}logger['error']('MailTransferReport,\x20%s,\x20%s',_0x3fcc20,_0x2a4ece[_0xe09a('0x11')][_0xe09a('0x13')]);return _0x251d64(_0x2a4ece[_0xe09a('0x11')][_0xe09a('0x13')]);}else{logger[_0xe09a('0xc')](_0xe09a('0xd'),_0x3fcc20,_0xe09a('0x10'));_0x251d64(_0x2a4ece[_0xe09a('0x14')][_0xe09a('0x13')]);}})[_0xe09a('0x15')](function(_0x5e4720){logger[_0xe09a('0x11')](_0xe09a('0xd'),_0x3fcc20,_0x5e4720);_0x5bbe88(_0x5e4720);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index cd6e646..5fde279 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 _0xf681=['index','/describe','isAuthenticated','describe','/:id','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./memberReport.controller','get'];(function(_0x8c461d,_0x4acfcc){var _0x3bd1cc=function(_0x3bbe1a){while(--_0x3bbe1a){_0x8c461d['push'](_0x8c461d['shift']());}};_0x3bd1cc(++_0x4acfcc);}(_0xf681,0xcd));var _0x1f68=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xf681[_0x432682];return _0x463d05;};'use strict';var multer=require(_0x1f68('0x0'));var util=require(_0x1f68('0x1'));var path=require(_0x1f68('0x2'));var timeout=require(_0x1f68('0x3'));var express=require(_0x1f68('0x4'));var router=express['Router']();var fs_extra=require(_0x1f68('0x5'));var auth=require(_0x1f68('0x6'));var interaction=require(_0x1f68('0x7'));var config=require(_0x1f68('0x8'));var controller=require(_0x1f68('0x9'));router[_0x1f68('0xa')]('/',auth['isAuthenticated'](),controller[_0x1f68('0xb')]);router['get'](_0x1f68('0xc'),auth[_0x1f68('0xd')](),controller[_0x1f68('0xe')]);router[_0x1f68('0xa')](_0x1f68('0xf'),auth[_0x1f68('0xd')](),controller['show']);router['post']('/',auth[_0x1f68('0xd')](),controller['create']);router['put']('/:id',auth[_0x1f68('0xd')](),controller['update']);router['delete'](_0x1f68('0xf'),auth['isAuthenticated'](),controller[_0x1f68('0x10')]);module[_0x1f68('0x11')]=router; \ No newline at end of file +var _0xc94e=['destroy','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','show','create','put','update','delete'];(function(_0x1cca92,_0x26e98b){var _0x4dd205=function(_0x100d37){while(--_0x100d37){_0x1cca92['push'](_0x1cca92['shift']());}};_0x4dd205(++_0x26e98b);}(_0xc94e,0x17e));var _0xec94=function(_0x4a9515,_0x6c814b){_0x4a9515=_0x4a9515-0x0;var _0x353479=_0xc94e[_0x4a9515];return _0x353479;};'use strict';var multer=require(_0xec94('0x0'));var util=require(_0xec94('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xec94('0x2'));var router=express[_0xec94('0x3')]();var fs_extra=require(_0xec94('0x4'));var auth=require(_0xec94('0x5'));var interaction=require(_0xec94('0x6'));var config=require(_0xec94('0x7'));var controller=require('./memberReport.controller');router[_0xec94('0x8')]('/',auth['isAuthenticated'](),controller[_0xec94('0x9')]);router[_0xec94('0x8')](_0xec94('0xa'),auth[_0xec94('0xb')](),controller[_0xec94('0xc')]);router[_0xec94('0x8')]('/:id',auth[_0xec94('0xb')](),controller[_0xec94('0xd')]);router['post']('/',auth[_0xec94('0xb')](),controller[_0xec94('0xe')]);router[_0xec94('0xf')]('/:id',auth[_0xec94('0xb')](),controller[_0xec94('0x10')]);router[_0xec94('0x11')]('/:id',auth[_0xec94('0xb')](),controller[_0xec94('0x12')]);module[_0xec94('0x13')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index c5b571d..af92623 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 _0xee5b=['talk:[start]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','INTEGER','sequelize','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','DATE','setDataValue','exitAt','duration','talk:[inbound,\x20outbound],\x20pause:[reason]'];(function(_0x1eda20,_0x1149f4){var _0x31b953=function(_0x25f0d8){while(--_0x25f0d8){_0x1eda20['push'](_0x1eda20['shift']());}};_0x31b953(++_0x1149f4);}(_0xee5b,0x1f4));var _0xbee5=function(_0x28e724,_0x1ec3cf){_0x28e724=_0x28e724-0x0;var _0x1b220e=_0xee5b[_0x28e724];return _0x1b220e;};'use strict';var Sequelize=require(_0xbee5('0x0'));var moment=require('moment');module[_0xbee5('0x1')]={'channel':{'type':Sequelize[_0xbee5('0x2')]},'membername':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0xbee5('0x2')]},'type':{'type':Sequelize[_0xbee5('0x2')],'defaultValue':_0xbee5('0x3'),'comment':_0xbee5('0x4')},'duration':{'type':Sequelize['INTEGER']},'enterAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xbee5('0x5')],'set':function(_0x2c0bde){var _0xab6e4d=moment(_0x2c0bde);var _0x804ab8=moment(this['getDataValue']('enterAt'));var _0x53d5b9=_0xab6e4d['diff'](_0x804ab8,'seconds');this[_0xbee5('0x6')](_0xbee5('0x7'),_0x2c0bde);this[_0xbee5('0x6')](_0xbee5('0x8'),_0x53d5b9||null);}},'data1':{'type':Sequelize['STRING'],'comment':_0xbee5('0x9')},'data2':{'type':Sequelize[_0xbee5('0x2')],'comment':_0xbee5('0xa')},'data3':{'type':Sequelize[_0xbee5('0x2')],'comment':_0xbee5('0xb')},'data4':{'type':Sequelize[_0xbee5('0x2')],'comment':_0xbee5('0xc')},'data5':{'type':Sequelize[_0xbee5('0x2')],'comment':_0xbee5('0xd')},'role':{'type':Sequelize['STRING']},'internal':{'type':Sequelize[_0xbee5('0xe')]},'uniqueid':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x6b61=['STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','getDataValue','diff','setDataValue','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','sequelize','exports'];(function(_0x5f2e1e,_0xcf2d30){var _0x56d064=function(_0x1c5df2){while(--_0x1c5df2){_0x5f2e1e['push'](_0x5f2e1e['shift']());}};_0x56d064(++_0xcf2d30);}(_0x6b61,0x16a));var _0x16b6=function(_0x59162a,_0x10e547){_0x59162a=_0x59162a-0x0;var _0x35e50d=_0x6b61[_0x59162a];return _0x35e50d;};'use strict';var Sequelize=require(_0x16b6('0x0'));var moment=require('moment');module[_0x16b6('0x1')]={'channel':{'type':Sequelize[_0x16b6('0x2')]},'membername':{'type':Sequelize[_0x16b6('0x2')]},'interface':{'type':Sequelize[_0x16b6('0x2')]},'type':{'type':Sequelize[_0x16b6('0x2')],'defaultValue':_0x16b6('0x3'),'comment':_0x16b6('0x4')},'duration':{'type':Sequelize[_0x16b6('0x5')]},'enterAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x16b6('0x6')],'set':function(_0x173c5d){var _0x594a8f=moment(_0x173c5d);var _0x3d06d6=moment(this[_0x16b6('0x7')]('enterAt'));var _0x460269=_0x594a8f[_0x16b6('0x8')](_0x3d06d6,'seconds');this['setDataValue']('exitAt',_0x173c5d);this[_0x16b6('0x9')]('duration',_0x460269||null);}},'data1':{'type':Sequelize[_0x16b6('0x2')],'comment':_0x16b6('0xa')},'data2':{'type':Sequelize[_0x16b6('0x2')],'comment':_0x16b6('0xb')},'data3':{'type':Sequelize[_0x16b6('0x2')],'comment':_0x16b6('0xc')},'data4':{'type':Sequelize[_0x16b6('0x2')],'comment':'talk:[dial\x20string]'},'data5':{'type':Sequelize['STRING'],'comment':'talk:[queue]'},'role':{'type':Sequelize[_0x16b6('0x2')]},'internal':{'type':Sequelize[_0x16b6('0x5')]},'uniqueid':{'type':Sequelize[_0x16b6('0x2')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index bd587fa..8047b17 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 _0x55ca=['merge','filter','includeAll','include','findAll','rawAttributes','options','create','body','find','params','catch','destroy','describe','eml-format','rimraf','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','reject','update','then','end','sendStatus','error','stack','name','send','index','map','MemberReport','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0x55ca,0x126));var _0xa55c=function(_0x9ec221,_0x2594a6){_0x9ec221=_0x9ec221-0x0;var _0xdbe55e=_0x55ca[_0x9ec221];return _0xdbe55e;};'use strict';var emlformat=require(_0xa55c('0x0'));var rimraf=require(_0xa55c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa55c('0x2'));var BPromise=require(_0xa55c('0x3'));var Mustache=require('mustache');var util=require(_0xa55c('0x4'));var path=require(_0xa55c('0x5'));var sox=require(_0xa55c('0x6'));var csv=require(_0xa55c('0x7'));var ejs=require(_0xa55c('0x8'));var fs=require('fs');var fs_extra=require(_0xa55c('0x9'));var _=require(_0xa55c('0xa'));var squel=require('squel');var crypto=require(_0xa55c('0xb'));var jsforce=require(_0xa55c('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xa55c('0x7'));var querystring=require(_0xa55c('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa55c('0xe'));var qs=require(_0xa55c('0xf'));var as=require(_0xa55c('0x10'));var hardwareService=require(_0xa55c('0x11'));var logger=require(_0xa55c('0x12'))(_0xa55c('0x13'));var utils=require(_0xa55c('0x14'));var config=require(_0xa55c('0x15'));var licenseUtil=require(_0xa55c('0x16'));var db=require(_0xa55c('0x17'))['db'];function respondWithStatusCode(_0x5d47ff,_0x59d84a){_0x59d84a=_0x59d84a||0xcc;return function(_0x2a35be){if(_0x2a35be){return _0x5d47ff['sendStatus'](_0x59d84a);}return _0x5d47ff['status'](_0x59d84a)['end']();};}function respondWithResult(_0x18ee85,_0x3930e4){_0x3930e4=_0x3930e4||0xc8;return function(_0x462cd6){if(_0x462cd6){return _0x18ee85[_0xa55c('0x18')](_0x3930e4)[_0xa55c('0x19')](_0x462cd6);}};}function respondWithFilteredResult(_0x247e77,_0x4e0b2f){return function(_0x3ccf65){if(_0x3ccf65){var _0x3dcf4f=typeof _0x4e0b2f[_0xa55c('0x1a')]===_0xa55c('0x1b')&&typeof _0x4e0b2f[_0xa55c('0x1c')]===_0xa55c('0x1b');var _0x51590e=_0x3ccf65[_0xa55c('0x1d')];var _0x24783b=_0x3dcf4f?0x0:_0x4e0b2f['offset'];var _0x3d4c9e=_0x3dcf4f?_0x3ccf65[_0xa55c('0x1d')]:_0x4e0b2f[_0xa55c('0x1a')]+_0x4e0b2f[_0xa55c('0x1c')];var _0x23a1ae;if(_0x3d4c9e>=_0x51590e){_0x3d4c9e=_0x51590e;_0x23a1ae=0xc8;}else{_0x23a1ae=0xce;}_0x247e77[_0xa55c('0x18')](_0x23a1ae);return _0x247e77['set']('Content-Range',_0x24783b+'-'+_0x3d4c9e+'/'+_0x51590e)[_0xa55c('0x19')](_0x3ccf65);}return null;};}function patchUpdates(_0x3776ac){return function(_0xade4c4){try{jsonpatch['apply'](_0xade4c4,_0x3776ac,!![]);}catch(_0x383d92){return BPromise[_0xa55c('0x1e')](_0x383d92);}return _0xade4c4['save']();};}function saveUpdates(_0x187a87,_0x133096){return function(_0x940f28){if(_0x940f28){return _0x940f28[_0xa55c('0x1f')](_0x187a87)[_0xa55c('0x20')](function(_0x49ed04){return _0x49ed04;});}return null;};}function removeEntity(_0x1fc828,_0x504c24){return function(_0x5ba836){if(_0x5ba836){return _0x5ba836['destroy']()[_0xa55c('0x20')](function(){_0x1fc828['status'](0xcc)[_0xa55c('0x21')]();});}};}function handleEntityNotFound(_0x190757,_0x3f64de){return function(_0xf0e574){if(!_0xf0e574){_0x190757[_0xa55c('0x22')](0x194);}return _0xf0e574;};}function handleError(_0x170ba4,_0x1da633){_0x1da633=_0x1da633||0x1f4;return function(_0x11e7f7){logger[_0xa55c('0x23')](_0x11e7f7[_0xa55c('0x24')]);if(_0x11e7f7[_0xa55c('0x25')]){delete _0x11e7f7['name'];}_0x170ba4[_0xa55c('0x18')](_0x1da633)[_0xa55c('0x26')](_0x11e7f7);};}exports[_0xa55c('0x27')]=function(_0x906caa,_0x5d940d){var _0x1377b0={},_0x22f6b6={},_0x1b8388={'count':0x0,'rows':[]};var _0x201941=_[_0xa55c('0x28')](db[_0xa55c('0x29')]['rawAttributes'],function(_0x23e698){return{'name':_0x23e698['fieldName'],'type':_0x23e698[_0xa55c('0x2a')][_0xa55c('0x2b')]};});_0x22f6b6[_0xa55c('0x2c')]=_[_0xa55c('0x28')](_0x201941,'name');_0x22f6b6[_0xa55c('0x2d')]=_[_0xa55c('0x2e')](_0x906caa[_0xa55c('0x2d')]);_0x22f6b6[_0xa55c('0x2f')]=_[_0xa55c('0x30')](_0x22f6b6[_0xa55c('0x2c')],_0x22f6b6[_0xa55c('0x2d')]);_0x1377b0[_0xa55c('0x31')]=_[_0xa55c('0x30')](_0x22f6b6[_0xa55c('0x2c')],qs[_0xa55c('0x32')](_0x906caa['query']['fields']));_0x1377b0[_0xa55c('0x31')]=_0x1377b0[_0xa55c('0x31')]['length']?_0x1377b0[_0xa55c('0x31')]:_0x22f6b6[_0xa55c('0x2c')];if(!_0x906caa[_0xa55c('0x2d')][_0xa55c('0x33')](_0xa55c('0x34'))){_0x1377b0[_0xa55c('0x1c')]=qs[_0xa55c('0x1c')](_0x906caa[_0xa55c('0x2d')][_0xa55c('0x1c')]);_0x1377b0['offset']=qs['offset'](_0x906caa['query'][_0xa55c('0x1a')]);}_0x1377b0[_0xa55c('0x35')]=qs[_0xa55c('0x36')](_0x906caa['query'][_0xa55c('0x36')]);_0x1377b0['where']=qs[_0xa55c('0x2f')](_['pick'](_0x906caa[_0xa55c('0x2d')],_0x22f6b6[_0xa55c('0x2f')]),_0x201941);if(_0x906caa[_0xa55c('0x2d')]['filter']){_0x1377b0[_0xa55c('0x37')]=_[_0xa55c('0x38')](_0x1377b0['where'],{'$or':_[_0xa55c('0x28')](_0x201941,function(_0x194e78){if(_0x194e78['type']!=='VIRTUAL'){var _0x235f6b={};_0x235f6b[_0x194e78['name']]={'$like':'%'+_0x906caa[_0xa55c('0x2d')][_0xa55c('0x39')]+'%'};return _0x235f6b;}})});}_0x1377b0=_['merge']({},_0x1377b0,_0x906caa['options']);var _0x5e50b6={'where':_0x1377b0['where']};return db[_0xa55c('0x29')][_0xa55c('0x1d')](_0x5e50b6)[_0xa55c('0x20')](function(_0x99c4f8){_0x1b8388[_0xa55c('0x1d')]=_0x99c4f8;if(_0x906caa['query'][_0xa55c('0x3a')]){_0x1377b0[_0xa55c('0x3b')]=[{'all':!![]}];}return db[_0xa55c('0x29')][_0xa55c('0x3c')](_0x1377b0);})[_0xa55c('0x20')](function(_0x23cef5){_0x1b8388['rows']=_0x23cef5;return _0x1b8388;})[_0xa55c('0x20')](respondWithFilteredResult(_0x5d940d,_0x1377b0))['catch'](handleError(_0x5d940d,null));};exports['show']=function(_0x404e7f,_0x1f63d8){var _0x496920={'raw':!![],'where':{'id':_0x404e7f['params']['id']}},_0x2bd98b={};_0x2bd98b['model']=_[_0xa55c('0x2e')](db[_0xa55c('0x29')][_0xa55c('0x3d')]);_0x2bd98b['query']=_[_0xa55c('0x2e')](_0x404e7f[_0xa55c('0x2d')]);_0x2bd98b['filters']=_[_0xa55c('0x30')](_0x2bd98b['model'],_0x2bd98b[_0xa55c('0x2d')]);_0x496920[_0xa55c('0x31')]=_['intersection'](_0x2bd98b[_0xa55c('0x2c')],qs[_0xa55c('0x32')](_0x404e7f['query'][_0xa55c('0x32')]));_0x496920[_0xa55c('0x31')]=_0x496920[_0xa55c('0x31')]['length']?_0x496920[_0xa55c('0x31')]:_0x2bd98b['model'];if(_0x404e7f[_0xa55c('0x2d')][_0xa55c('0x3a')]){_0x496920[_0xa55c('0x3b')]=[{'all':!![]}];}_0x496920=_['merge']({},_0x496920,_0x404e7f[_0xa55c('0x3e')]);return db[_0xa55c('0x29')]['find'](_0x496920)[_0xa55c('0x20')](handleEntityNotFound(_0x1f63d8,null))[_0xa55c('0x20')](respondWithResult(_0x1f63d8,null))['catch'](handleError(_0x1f63d8,null));};exports[_0xa55c('0x3f')]=function(_0xd3fe78,_0x52f9a7){return db[_0xa55c('0x29')][_0xa55c('0x3f')](_0xd3fe78[_0xa55c('0x40')],{})[_0xa55c('0x20')](respondWithResult(_0x52f9a7,0xc9))['catch'](handleError(_0x52f9a7,null));};exports[_0xa55c('0x1f')]=function(_0x58a7ea,_0x2157d6){if(_0x58a7ea[_0xa55c('0x40')]['id']){delete _0x58a7ea[_0xa55c('0x40')]['id'];}return db['MemberReport'][_0xa55c('0x41')]({'where':{'id':_0x58a7ea[_0xa55c('0x42')]['id']}})['then'](handleEntityNotFound(_0x2157d6,null))[_0xa55c('0x20')](saveUpdates(_0x58a7ea[_0xa55c('0x40')],null))[_0xa55c('0x20')](respondWithResult(_0x2157d6,null))[_0xa55c('0x43')](handleError(_0x2157d6,null));};exports[_0xa55c('0x44')]=function(_0x1c84d9,_0x1e1293){return db[_0xa55c('0x29')][_0xa55c('0x41')]({'where':{'id':_0x1c84d9[_0xa55c('0x42')]['id']}})['then'](handleEntityNotFound(_0x1e1293,null))[_0xa55c('0x20')](removeEntity(_0x1e1293,null))[_0xa55c('0x43')](handleError(_0x1e1293,null));};exports[_0xa55c('0x45')]=function(_0x4f73b6,_0x4c3095){return db[_0xa55c('0x29')]['describe']()[_0xa55c('0x20')](respondWithResult(_0x4c3095,null))['catch'](handleError(_0x4c3095,null));}; \ No newline at end of file +var _0x3e74=['show','params','options','find','catch','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','end','json','undefined','limit','offset','count','status','set','Content-Range','apply','save','update','then','destroy','sendStatus','name','send','index','map','MemberReport','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows'];(function(_0x3932e6,_0x43c47a){var _0x4c6869=function(_0x21a8e2){while(--_0x21a8e2){_0x3932e6['push'](_0x3932e6['shift']());}};_0x4c6869(++_0x43c47a);}(_0x3e74,0x175));var _0x43e7=function(_0x55dd1e,_0x41266f){_0x55dd1e=_0x55dd1e-0x0;var _0x5a4e7b=_0x3e74[_0x55dd1e];return _0x5a4e7b;};'use strict';var emlformat=require(_0x43e7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x43e7('0x1'));var jsonpatch=require(_0x43e7('0x2'));var rp=require(_0x43e7('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x43e7('0x4'));var util=require('util');var path=require(_0x43e7('0x5'));var sox=require(_0x43e7('0x6'));var csv=require(_0x43e7('0x7'));var ejs=require(_0x43e7('0x8'));var fs=require('fs');var fs_extra=require(_0x43e7('0x9'));var _=require('lodash');var squel=require(_0x43e7('0xa'));var crypto=require(_0x43e7('0xb'));var jsforce=require(_0x43e7('0xc'));var deskjs=require(_0x43e7('0xd'));var toCsv=require(_0x43e7('0x7'));var querystring=require('querystring');var Papa=require(_0x43e7('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x43e7('0xf'));var as=require(_0x43e7('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x43e7('0x11'))('api');var utils=require(_0x43e7('0x12'));var config=require(_0x43e7('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x43e7('0x14'))['db'];function respondWithStatusCode(_0xc960ea,_0x2718d3){_0x2718d3=_0x2718d3||0xcc;return function(_0x3bb83f){if(_0x3bb83f){return _0xc960ea['sendStatus'](_0x2718d3);}return _0xc960ea['status'](_0x2718d3)[_0x43e7('0x15')]();};}function respondWithResult(_0x21fdd3,_0x44b0bd){_0x44b0bd=_0x44b0bd||0xc8;return function(_0x51b974){if(_0x51b974){return _0x21fdd3['status'](_0x44b0bd)[_0x43e7('0x16')](_0x51b974);}};}function respondWithFilteredResult(_0x14c146,_0x203378){return function(_0x328445){if(_0x328445){var _0x4de324=typeof _0x203378['offset']===_0x43e7('0x17')&&typeof _0x203378[_0x43e7('0x18')]===_0x43e7('0x17');var _0x5d346f=_0x328445['count'];var _0x446986=_0x4de324?0x0:_0x203378[_0x43e7('0x19')];var _0x9037d3=_0x4de324?_0x328445[_0x43e7('0x1a')]:_0x203378[_0x43e7('0x19')]+_0x203378[_0x43e7('0x18')];var _0x619236;if(_0x9037d3>=_0x5d346f){_0x9037d3=_0x5d346f;_0x619236=0xc8;}else{_0x619236=0xce;}_0x14c146[_0x43e7('0x1b')](_0x619236);return _0x14c146[_0x43e7('0x1c')](_0x43e7('0x1d'),_0x446986+'-'+_0x9037d3+'/'+_0x5d346f)[_0x43e7('0x16')](_0x328445);}return null;};}function patchUpdates(_0x177ee1){return function(_0x4b5d64){try{jsonpatch[_0x43e7('0x1e')](_0x4b5d64,_0x177ee1,!![]);}catch(_0x3c6625){return BPromise['reject'](_0x3c6625);}return _0x4b5d64[_0x43e7('0x1f')]();};}function saveUpdates(_0x3e281e,_0x3945bb){return function(_0x28aacc){if(_0x28aacc){return _0x28aacc[_0x43e7('0x20')](_0x3e281e)[_0x43e7('0x21')](function(_0x54a9e7){return _0x54a9e7;});}return null;};}function removeEntity(_0x454359,_0x4eea52){return function(_0x4c9df3){if(_0x4c9df3){return _0x4c9df3[_0x43e7('0x22')]()[_0x43e7('0x21')](function(){_0x454359['status'](0xcc)[_0x43e7('0x15')]();});}};}function handleEntityNotFound(_0x4ca5cf,_0x326dab){return function(_0x5c5e67){if(!_0x5c5e67){_0x4ca5cf[_0x43e7('0x23')](0x194);}return _0x5c5e67;};}function handleError(_0x1b5f50,_0x20888b){_0x20888b=_0x20888b||0x1f4;return function(_0x405f85){logger['error'](_0x405f85['stack']);if(_0x405f85[_0x43e7('0x24')]){delete _0x405f85['name'];}_0x1b5f50[_0x43e7('0x1b')](_0x20888b)[_0x43e7('0x25')](_0x405f85);};}exports[_0x43e7('0x26')]=function(_0xb1fc63,_0x5087d7){var _0x33a1a5={},_0x4690a6={},_0x45b675={'count':0x0,'rows':[]};var _0x50f9f5=_[_0x43e7('0x27')](db[_0x43e7('0x28')][_0x43e7('0x29')],function(_0x31b2a6){return{'name':_0x31b2a6[_0x43e7('0x2a')],'type':_0x31b2a6[_0x43e7('0x2b')][_0x43e7('0x2c')]};});_0x4690a6[_0x43e7('0x2d')]=_[_0x43e7('0x27')](_0x50f9f5,_0x43e7('0x24'));_0x4690a6['query']=_[_0x43e7('0x2e')](_0xb1fc63[_0x43e7('0x2f')]);_0x4690a6[_0x43e7('0x30')]=_[_0x43e7('0x31')](_0x4690a6[_0x43e7('0x2d')],_0x4690a6['query']);_0x33a1a5[_0x43e7('0x32')]=_[_0x43e7('0x31')](_0x4690a6[_0x43e7('0x2d')],qs[_0x43e7('0x33')](_0xb1fc63['query']['fields']));_0x33a1a5['attributes']=_0x33a1a5[_0x43e7('0x32')][_0x43e7('0x34')]?_0x33a1a5[_0x43e7('0x32')]:_0x4690a6[_0x43e7('0x2d')];if(!_0xb1fc63[_0x43e7('0x2f')][_0x43e7('0x35')]('nolimit')){_0x33a1a5['limit']=qs['limit'](_0xb1fc63['query']['limit']);_0x33a1a5['offset']=qs['offset'](_0xb1fc63[_0x43e7('0x2f')]['offset']);}_0x33a1a5[_0x43e7('0x36')]=qs[_0x43e7('0x37')](_0xb1fc63[_0x43e7('0x2f')][_0x43e7('0x37')]);_0x33a1a5[_0x43e7('0x38')]=qs[_0x43e7('0x30')](_[_0x43e7('0x39')](_0xb1fc63['query'],_0x4690a6['filters']),_0x50f9f5);if(_0xb1fc63['query'][_0x43e7('0x3a')]){_0x33a1a5[_0x43e7('0x38')]=_[_0x43e7('0x3b')](_0x33a1a5[_0x43e7('0x38')],{'$or':_[_0x43e7('0x27')](_0x50f9f5,function(_0x1ed538){if(_0x1ed538[_0x43e7('0x2b')]!==_0x43e7('0x3c')){var _0x55c798={};_0x55c798[_0x1ed538[_0x43e7('0x24')]]={'$like':'%'+_0xb1fc63[_0x43e7('0x2f')]['filter']+'%'};return _0x55c798;}})});}_0x33a1a5=_[_0x43e7('0x3b')]({},_0x33a1a5,_0xb1fc63['options']);var _0x44d8e4={'where':_0x33a1a5[_0x43e7('0x38')]};return db[_0x43e7('0x28')][_0x43e7('0x1a')](_0x44d8e4)[_0x43e7('0x21')](function(_0x234d8f){_0x45b675['count']=_0x234d8f;if(_0xb1fc63['query'][_0x43e7('0x3d')]){_0x33a1a5[_0x43e7('0x3e')]=[{'all':!![]}];}return db[_0x43e7('0x28')][_0x43e7('0x3f')](_0x33a1a5);})[_0x43e7('0x21')](function(_0x4a4a85){_0x45b675[_0x43e7('0x40')]=_0x4a4a85;return _0x45b675;})[_0x43e7('0x21')](respondWithFilteredResult(_0x5087d7,_0x33a1a5))['catch'](handleError(_0x5087d7,null));};exports[_0x43e7('0x41')]=function(_0x51a69c,_0x2ad8ef){var _0x504101={'raw':!![],'where':{'id':_0x51a69c[_0x43e7('0x42')]['id']}},_0x3d81ae={};_0x3d81ae[_0x43e7('0x2d')]=_[_0x43e7('0x2e')](db['MemberReport']['rawAttributes']);_0x3d81ae[_0x43e7('0x2f')]=_[_0x43e7('0x2e')](_0x51a69c[_0x43e7('0x2f')]);_0x3d81ae[_0x43e7('0x30')]=_['intersection'](_0x3d81ae['model'],_0x3d81ae['query']);_0x504101[_0x43e7('0x32')]=_['intersection'](_0x3d81ae[_0x43e7('0x2d')],qs['fields'](_0x51a69c['query'][_0x43e7('0x33')]));_0x504101['attributes']=_0x504101[_0x43e7('0x32')][_0x43e7('0x34')]?_0x504101[_0x43e7('0x32')]:_0x3d81ae[_0x43e7('0x2d')];if(_0x51a69c['query'][_0x43e7('0x3d')]){_0x504101[_0x43e7('0x3e')]=[{'all':!![]}];}_0x504101=_[_0x43e7('0x3b')]({},_0x504101,_0x51a69c[_0x43e7('0x43')]);return db[_0x43e7('0x28')][_0x43e7('0x44')](_0x504101)['then'](handleEntityNotFound(_0x2ad8ef,null))['then'](respondWithResult(_0x2ad8ef,null))[_0x43e7('0x45')](handleError(_0x2ad8ef,null));};exports[_0x43e7('0x46')]=function(_0x212841,_0x4c00a8){return db['MemberReport']['create'](_0x212841[_0x43e7('0x47')],{})[_0x43e7('0x21')](respondWithResult(_0x4c00a8,0xc9))['catch'](handleError(_0x4c00a8,null));};exports[_0x43e7('0x20')]=function(_0x47686e,_0x3c96fe){if(_0x47686e['body']['id']){delete _0x47686e['body']['id'];}return db['MemberReport']['find']({'where':{'id':_0x47686e[_0x43e7('0x42')]['id']}})[_0x43e7('0x21')](handleEntityNotFound(_0x3c96fe,null))['then'](saveUpdates(_0x47686e[_0x43e7('0x47')],null))[_0x43e7('0x21')](respondWithResult(_0x3c96fe,null))[_0x43e7('0x45')](handleError(_0x3c96fe,null));};exports[_0x43e7('0x22')]=function(_0x4a0ce5,_0x2718d5){return db['MemberReport']['find']({'where':{'id':_0x4a0ce5[_0x43e7('0x42')]['id']}})[_0x43e7('0x21')](handleEntityNotFound(_0x2718d5,null))[_0x43e7('0x21')](removeEntity(_0x2718d5,null))[_0x43e7('0x45')](handleError(_0x2718d5,null));};exports[_0x43e7('0x48')]=function(_0x2351cf,_0x1cd87c){return db[_0x43e7('0x28')][_0x43e7('0x48')]()[_0x43e7('0x21')](respondWithResult(_0x1cd87c,null))['catch'](handleError(_0x1cd87c,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index e827723..90054ca 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 _0x34f0=['report_member','membername_interface','membername','lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x32c343,_0x964cb6){var _0x1bb43f=function(_0x51bf79){while(--_0x51bf79){_0x32c343['push'](_0x32c343['shift']());}};_0x1bb43f(++_0x964cb6);}(_0x34f0,0x13b));var _0x034f=function(_0x89f23f,_0x21b4b3){_0x89f23f=_0x89f23f-0x0;var _0x56971e=_0x34f0[_0x89f23f];return _0x56971e;};'use strict';var _=require(_0x034f('0x0'));var util=require(_0x034f('0x1'));var logger=require('../../config/logger')(_0x034f('0x2'));var moment=require('moment');var BPromise=require(_0x034f('0x3'));var rp=require(_0x034f('0x4'));var fs=require('fs');var path=require(_0x034f('0x5'));var rimraf=require(_0x034f('0x6'));var config=require(_0x034f('0x7'));var attributes=require('./memberReport.attributes');module[_0x034f('0x8')]=function(_0x1fd628,_0x4f349b){return _0x1fd628[_0x034f('0x9')]('MemberReport',attributes,{'tableName':_0x034f('0xa'),'paranoid':![],'indexes':[{'name':_0x034f('0xb'),'fields':[_0x034f('0xc'),'interface']}],'timestamps':!![]});}; \ No newline at end of file +var _0x3f3c=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./memberReport.attributes','exports','MemberReport','membername','interface'];(function(_0x2cb3bb,_0x1e9f19){var _0x5711ad=function(_0x3a1945){while(--_0x3a1945){_0x2cb3bb['push'](_0x2cb3bb['shift']());}};_0x5711ad(++_0x1e9f19);}(_0x3f3c,0x1e0));var _0xc3f3=function(_0x47951e,_0x51757b){_0x47951e=_0x47951e-0x0;var _0x53e01e=_0x3f3c[_0x47951e];return _0x53e01e;};'use strict';var _=require('lodash');var util=require(_0xc3f3('0x0'));var logger=require(_0xc3f3('0x1'))('api');var moment=require(_0xc3f3('0x2'));var BPromise=require(_0xc3f3('0x3'));var rp=require(_0xc3f3('0x4'));var fs=require('fs');var path=require(_0xc3f3('0x5'));var rimraf=require(_0xc3f3('0x6'));var config=require('../../config/environment');var attributes=require(_0xc3f3('0x7'));module[_0xc3f3('0x8')]=function(_0x15ce14,_0x4a553b){return _0x15ce14['define'](_0xc3f3('0x9'),attributes,{'tableName':'report_member','paranoid':![],'indexes':[{'name':'membername_interface','fields':[_0xc3f3('0xa'),_0xc3f3('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index 8e55365..d014e8d 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 _0x1203=['error','code','message','result','GetMemberReport','MemberReport','options','raw','attributes','limit','include','model','map','then','catch','CreateMemberReport','create','UpdateMemberReport','update','body','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','MemberReport,\x20%s,\x20%s','debug','MemberReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x1203,0x8c));var _0x3120=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x1203[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x3120('0x0'));var util=require(_0x3120('0x1'));var moment=require(_0x3120('0x2'));var BPromise=require(_0x3120('0x3'));var rs=require(_0x3120('0x4'));var fs=require('fs');var Redis=require(_0x3120('0x5'));var db=require(_0x3120('0x6'))['db'];var utils=require(_0x3120('0x7'));var logger=require(_0x3120('0x8'))(_0x3120('0x9'));var config=require(_0x3120('0xa'));var jayson=require(_0x3120('0xb'));var client=jayson[_0x3120('0xc')][_0x3120('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x2ac620,_0x1f1c97,_0x5e9785){return new BPromise(function(_0x1fa4b8,_0x513da6){return client['request'](_0x2ac620,_0x5e9785)['then'](function(_0x580f86){logger[_0x3120('0xe')](_0x3120('0xf'),_0x1f1c97,'request\x20sent');logger[_0x3120('0x10')](_0x3120('0x11'),_0x1f1c97,_0x3120('0x12'),JSON[_0x3120('0x13')](_0x580f86));if(_0x580f86['error']){if(_0x580f86[_0x3120('0x14')][_0x3120('0x15')]===0x1f4){logger['error']('MemberReport,\x20%s,\x20%s',_0x1f1c97,_0x580f86[_0x3120('0x14')][_0x3120('0x16')]);return _0x513da6(_0x580f86[_0x3120('0x14')][_0x3120('0x16')]);}logger[_0x3120('0x14')](_0x3120('0xf'),_0x1f1c97,_0x580f86[_0x3120('0x14')]['message']);return _0x1fa4b8(_0x580f86[_0x3120('0x14')][_0x3120('0x16')]);}else{logger[_0x3120('0xe')](_0x3120('0xf'),_0x1f1c97,_0x3120('0x12'));_0x1fa4b8(_0x580f86[_0x3120('0x17')][_0x3120('0x16')]);}})['catch'](function(_0x308873){logger['error'](_0x3120('0xf'),_0x1f1c97,_0x308873);_0x513da6(_0x308873);});});}exports[_0x3120('0x18')]=function(_0x2bbdb7){var _0x1a513c=this;return new Promise(function(_0x3c8c9b,_0x3af913){return db[_0x3120('0x19')]['findAll']({'raw':_0x2bbdb7[_0x3120('0x1a')]?_0x2bbdb7['options'][_0x3120('0x1b')]===undefined?!![]:![]:!![],'where':_0x2bbdb7[_0x3120('0x1a')]?_0x2bbdb7[_0x3120('0x1a')]['where']||null:null,'attributes':_0x2bbdb7[_0x3120('0x1a')]?_0x2bbdb7['options'][_0x3120('0x1c')]||null:null,'limit':_0x2bbdb7[_0x3120('0x1a')]?_0x2bbdb7['options'][_0x3120('0x1d')]||null:null,'include':_0x2bbdb7[_0x3120('0x1a')]?_0x2bbdb7[_0x3120('0x1a')][_0x3120('0x1e')]?_['map'](_0x2bbdb7[_0x3120('0x1a')]['include'],function(_0x444b3b){return{'model':db[_0x444b3b[_0x3120('0x1f')]],'as':_0x444b3b['as'],'attributes':_0x444b3b[_0x3120('0x1c')],'include':_0x444b3b['include']?_['map'](_0x444b3b[_0x3120('0x1e')],function(_0x7d0b5f){return{'model':db[_0x7d0b5f['model']],'as':_0x7d0b5f['as'],'attributes':_0x7d0b5f[_0x3120('0x1c')],'include':_0x7d0b5f[_0x3120('0x1e')]?_[_0x3120('0x20')](_0x7d0b5f['include'],function(_0x2636b5){return{'model':db[_0x2636b5[_0x3120('0x1f')]],'as':_0x2636b5['as'],'attributes':_0x2636b5[_0x3120('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x3120('0x21')](function(_0x4b343b){logger['info']('GetMemberReport',_0x2bbdb7);logger[_0x3120('0x10')]('GetMemberReport',_0x2bbdb7,JSON[_0x3120('0x13')](_0x4b343b));_0x3c8c9b(_0x4b343b);})[_0x3120('0x22')](function(_0x3de290){logger[_0x3120('0x14')](_0x3120('0x18'),_0x3de290[_0x3120('0x16')],_0x2bbdb7);_0x3af913(_0x1a513c['error'](0x1f4,_0x3de290[_0x3120('0x16')]));});});};exports[_0x3120('0x23')]=function(_0x1471de){var _0x1ee7bc=this;return new Promise(function(_0x6ba5,_0x35e69f){return db[_0x3120('0x19')][_0x3120('0x24')](_0x1471de['body'],{'raw':_0x1471de['options']?_0x1471de[_0x3120('0x1a')][_0x3120('0x1b')]===undefined?!![]:![]:!![]})[_0x3120('0x21')](function(_0x34beab){logger[_0x3120('0xe')](_0x3120('0x23'),_0x1471de);logger['debug'](_0x3120('0x23'),_0x1471de,JSON[_0x3120('0x13')](_0x34beab));_0x6ba5(_0x34beab);})[_0x3120('0x22')](function(_0x2d786a){logger[_0x3120('0x14')](_0x3120('0x23'),_0x2d786a[_0x3120('0x16')],_0x1471de);_0x35e69f(_0x1ee7bc['error'](0x1f4,_0x2d786a[_0x3120('0x16')]));});});};exports[_0x3120('0x25')]=function(_0x2d6b82){var _0x2f80f1=this;return new Promise(function(_0x3067ca,_0x3d0d05){return db[_0x3120('0x19')][_0x3120('0x26')](_0x2d6b82[_0x3120('0x27')],{'raw':_0x2d6b82[_0x3120('0x1a')]?_0x2d6b82[_0x3120('0x1a')][_0x3120('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2d6b82[_0x3120('0x1a')]?_0x2d6b82['options']['where']||null:null,'attributes':_0x2d6b82[_0x3120('0x1a')]?_0x2d6b82[_0x3120('0x1a')][_0x3120('0x1c')]||null:null,'limit':_0x2d6b82['options']?_0x2d6b82[_0x3120('0x1a')][_0x3120('0x1d')]||null:null})[_0x3120('0x21')](function(_0x5d414e){logger[_0x3120('0xe')](_0x3120('0x25'),_0x2d6b82);logger[_0x3120('0x10')](_0x3120('0x25'),_0x2d6b82,JSON[_0x3120('0x13')](_0x5d414e));_0x3067ca(_0x5d414e);})[_0x3120('0x22')](function(_0x4bbc5d){logger['error']('UpdateMemberReport',_0x4bbc5d[_0x3120('0x16')],_0x2d6b82);_0x3d0d05(_0x2f80f1['error'](0x1f4,_0x4bbc5d[_0x3120('0x16')]));});});}; \ No newline at end of file +var _0x55c1=['raw','where','attributes','include','map','model','then','debug','GetMemberReport','CreateMemberReport','create','stringify','catch','UpdateMemberReport','update','body','limit','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','info','MemberReport,\x20%s,\x20%s','request\x20sent','MemberReport,\x20%s,\x20%s,\x20%s','error','message','MemberReport','findAll','options'];(function(_0x1b3279,_0x2112fc){var _0x59c553=function(_0x5cbca9){while(--_0x5cbca9){_0x1b3279['push'](_0x1b3279['shift']());}};_0x59c553(++_0x2112fc);}(_0x55c1,0x1e5));var _0x155c=function(_0x3a10e3,_0x3cdb35){_0x3a10e3=_0x3a10e3-0x0;var _0xf067c8=_0x55c1[_0x3a10e3];return _0xf067c8;};'use strict';var _=require(_0x155c('0x0'));var util=require(_0x155c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x155c('0x2'));var db=require(_0x155c('0x3'))['db'];var utils=require(_0x155c('0x4'));var logger=require(_0x155c('0x5'))(_0x155c('0x6'));var config=require('../../config/environment');var jayson=require(_0x155c('0x7'));var client=jayson[_0x155c('0x8')][_0x155c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4df902,_0x1cdd2f,_0x25b08a){return new BPromise(function(_0x22ed0d,_0x5f4274){return client['request'](_0x4df902,_0x25b08a)['then'](function(_0x330e12){logger[_0x155c('0xa')](_0x155c('0xb'),_0x1cdd2f,_0x155c('0xc'));logger['debug'](_0x155c('0xd'),_0x1cdd2f,_0x155c('0xc'),JSON['stringify'](_0x330e12));if(_0x330e12[_0x155c('0xe')]){if(_0x330e12[_0x155c('0xe')]['code']===0x1f4){logger[_0x155c('0xe')](_0x155c('0xb'),_0x1cdd2f,_0x330e12['error'][_0x155c('0xf')]);return _0x5f4274(_0x330e12[_0x155c('0xe')][_0x155c('0xf')]);}logger['error'](_0x155c('0xb'),_0x1cdd2f,_0x330e12[_0x155c('0xe')][_0x155c('0xf')]);return _0x22ed0d(_0x330e12[_0x155c('0xe')][_0x155c('0xf')]);}else{logger['info'](_0x155c('0xb'),_0x1cdd2f,_0x155c('0xc'));_0x22ed0d(_0x330e12['result'][_0x155c('0xf')]);}})['catch'](function(_0x4570e2){logger[_0x155c('0xe')](_0x155c('0xb'),_0x1cdd2f,_0x4570e2);_0x5f4274(_0x4570e2);});});}exports['GetMemberReport']=function(_0xe800de){var _0x13667b=this;return new Promise(function(_0x224a3d,_0x2f0099){return db[_0x155c('0x10')][_0x155c('0x11')]({'raw':_0xe800de[_0x155c('0x12')]?_0xe800de[_0x155c('0x12')][_0x155c('0x13')]===undefined?!![]:![]:!![],'where':_0xe800de[_0x155c('0x12')]?_0xe800de[_0x155c('0x12')][_0x155c('0x14')]||null:null,'attributes':_0xe800de[_0x155c('0x12')]?_0xe800de[_0x155c('0x12')][_0x155c('0x15')]||null:null,'limit':_0xe800de[_0x155c('0x12')]?_0xe800de[_0x155c('0x12')]['limit']||null:null,'include':_0xe800de[_0x155c('0x12')]?_0xe800de[_0x155c('0x12')][_0x155c('0x16')]?_[_0x155c('0x17')](_0xe800de[_0x155c('0x12')][_0x155c('0x16')],function(_0x4b6d0d){return{'model':db[_0x4b6d0d['model']],'as':_0x4b6d0d['as'],'attributes':_0x4b6d0d[_0x155c('0x15')],'include':_0x4b6d0d[_0x155c('0x16')]?_[_0x155c('0x17')](_0x4b6d0d[_0x155c('0x16')],function(_0x41e24d){return{'model':db[_0x41e24d[_0x155c('0x18')]],'as':_0x41e24d['as'],'attributes':_0x41e24d[_0x155c('0x15')],'include':_0x41e24d[_0x155c('0x16')]?_[_0x155c('0x17')](_0x41e24d[_0x155c('0x16')],function(_0x36be3d){return{'model':db[_0x36be3d[_0x155c('0x18')]],'as':_0x36be3d['as'],'attributes':_0x36be3d[_0x155c('0x15')]};}):[]};}):[]};}):[]:[]})[_0x155c('0x19')](function(_0x115143){logger[_0x155c('0xa')]('GetMemberReport',_0xe800de);logger[_0x155c('0x1a')]('GetMemberReport',_0xe800de,JSON['stringify'](_0x115143));_0x224a3d(_0x115143);})['catch'](function(_0x47c89d){logger[_0x155c('0xe')](_0x155c('0x1b'),_0x47c89d[_0x155c('0xf')],_0xe800de);_0x2f0099(_0x13667b['error'](0x1f4,_0x47c89d[_0x155c('0xf')]));});});};exports[_0x155c('0x1c')]=function(_0x32e5b8){var _0x595d47=this;return new Promise(function(_0x5a0ddf,_0x4ad8b4){return db[_0x155c('0x10')][_0x155c('0x1d')](_0x32e5b8['body'],{'raw':_0x32e5b8[_0x155c('0x12')]?_0x32e5b8[_0x155c('0x12')][_0x155c('0x13')]===undefined?!![]:![]:!![]})['then'](function(_0x2a84e7){logger['info'](_0x155c('0x1c'),_0x32e5b8);logger[_0x155c('0x1a')]('CreateMemberReport',_0x32e5b8,JSON[_0x155c('0x1e')](_0x2a84e7));_0x5a0ddf(_0x2a84e7);})[_0x155c('0x1f')](function(_0x5d575f){logger[_0x155c('0xe')](_0x155c('0x1c'),_0x5d575f['message'],_0x32e5b8);_0x4ad8b4(_0x595d47[_0x155c('0xe')](0x1f4,_0x5d575f[_0x155c('0xf')]));});});};exports[_0x155c('0x20')]=function(_0x306572){var _0x31a174=this;return new Promise(function(_0x2dc388,_0x3ec5fc){return db[_0x155c('0x10')][_0x155c('0x21')](_0x306572[_0x155c('0x22')],{'raw':_0x306572[_0x155c('0x12')]?_0x306572['options'][_0x155c('0x13')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x306572[_0x155c('0x12')]?_0x306572[_0x155c('0x12')]['where']||null:null,'attributes':_0x306572[_0x155c('0x12')]?_0x306572[_0x155c('0x12')]['attributes']||null:null,'limit':_0x306572['options']?_0x306572[_0x155c('0x12')][_0x155c('0x23')]||null:null})[_0x155c('0x19')](function(_0x5ab939){logger[_0x155c('0xa')](_0x155c('0x20'),_0x306572);logger[_0x155c('0x1a')]('UpdateMemberReport',_0x306572,JSON[_0x155c('0x1e')](_0x5ab939));_0x2dc388(_0x5ab939);})['catch'](function(_0x3453a7){logger[_0x155c('0xe')](_0x155c('0x20'),_0x3453a7['message'],_0x306572);_0x3ec5fc(_0x31a174['error'](0x1f4,_0x3453a7[_0x155c('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index 26839ba..10be8b7 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 _0x5f1f=['multer','util','Router','fs-extra','../../components/interaction/service','../../config/environment','./migration.controller','exports'];(function(_0x145b93,_0x4cf77a){var _0x596ac2=function(_0x2c418d){while(--_0x2c418d){_0x145b93['push'](_0x145b93['shift']());}};_0x596ac2(++_0x4cf77a);}(_0x5f1f,0x1a0));var _0xf5f1=function(_0x818500,_0xe7620c){_0x818500=_0x818500-0x0;var _0x342023=_0x5f1f[_0x818500];return _0x342023;};'use strict';var multer=require(_0xf5f1('0x0'));var util=require(_0xf5f1('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xf5f1('0x2')]();var fs_extra=require(_0xf5f1('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xf5f1('0x4'));var config=require(_0xf5f1('0x5'));var controller=require(_0xf5f1('0x6'));router['get']('/',controller['index']);module[_0xf5f1('0x7')]=router; \ No newline at end of file +var _0xbb07=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./migration.controller','exports'];(function(_0x13b01f,_0x58cadf){var _0x28fbfc=function(_0x52a741){while(--_0x52a741){_0x13b01f['push'](_0x13b01f['shift']());}};_0x28fbfc(++_0x58cadf);}(_0xbb07,0xf0));var _0x7bb0=function(_0x284bc3,_0x22dffe){_0x284bc3=_0x284bc3-0x0;var _0x41ac81=_0xbb07[_0x284bc3];return _0x41ac81;};'use strict';var multer=require(_0x7bb0('0x0'));var util=require(_0x7bb0('0x1'));var path=require(_0x7bb0('0x2'));var timeout=require(_0x7bb0('0x3'));var express=require(_0x7bb0('0x4'));var router=express[_0x7bb0('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x7bb0('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x7bb0('0x7'));var controller=require(_0x7bb0('0x8'));router['get']('/',controller['index']);module[_0x7bb0('0x9')]=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index af72e78..75c9690 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 _0x8e87=['version','exports'];(function(_0x1a91b3,_0x4a12c0){var _0x37d1e5=function(_0x257e68){while(--_0x257e68){_0x1a91b3['push'](_0x1a91b3['shift']());}};_0x37d1e5(++_0x4a12c0);}(_0x8e87,0x191));var _0x78e8=function(_0x2cf279,_0x531dac){_0x2cf279=_0x2cf279-0x0;var _0x302d84=_0x8e87[_0x2cf279];return _0x302d84;};'use strict';var Sequelize=require('sequelize');module[_0x78e8('0x0')]={'version':{'type':Sequelize['STRING'],'unique':_0x78e8('0x1')}}; \ No newline at end of file +var _0x3d34=['STRING','version','sequelize','exports'];(function(_0x5427c6,_0x1240a1){var _0x5144ff=function(_0x426797){while(--_0x426797){_0x5427c6['push'](_0x5427c6['shift']());}};_0x5144ff(++_0x1240a1);}(_0x3d34,0xd6));var _0x43d3=function(_0x10baeb,_0x1f83cf){_0x10baeb=_0x10baeb-0x0;var _0x54493e=_0x3d34[_0x10baeb];return _0x54493e;};'use strict';var Sequelize=require(_0x43d3('0x0'));module[_0x43d3('0x1')]={'version':{'type':Sequelize[_0x43d3('0x2')],'unique':_0x43d3('0x3')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index e844f93..3ff5fba 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 _0x759f=['../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','status','end','json','offset','limit','undefined','count','apply','reject','save','update','destroy','error','stack','send','index','Migration','fieldName','type','key','model','map','name','query','filters','intersection','attributes','fields','length','order','sort','where','filter','merge','VIRTUAL','options','then','includeAll','include','findAll','rows','catch','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service'];(function(_0x5107bf,_0x107c52){var _0x1294c5=function(_0x4959b2){while(--_0x4959b2){_0x5107bf['push'](_0x5107bf['shift']());}};_0x1294c5(++_0x107c52);}(_0x759f,0x1a8));var _0xf759=function(_0x5678eb,_0x506a9f){_0x5678eb=_0x5678eb-0x0;var _0x3248f6=_0x759f[_0x5678eb];return _0x3248f6;};'use strict';var emlformat=require(_0xf759('0x0'));var rimraf=require(_0xf759('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf759('0x2'));var rp=require('request-promise');var moment=require(_0xf759('0x3'));var BPromise=require(_0xf759('0x4'));var Mustache=require(_0xf759('0x5'));var util=require('util');var path=require(_0xf759('0x6'));var sox=require(_0xf759('0x7'));var csv=require(_0xf759('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf759('0x9'));var _=require('lodash');var squel=require(_0xf759('0xa'));var crypto=require(_0xf759('0xb'));var jsforce=require(_0xf759('0xc'));var deskjs=require(_0xf759('0xd'));var toCsv=require(_0xf759('0x8'));var querystring=require('querystring');var Papa=require(_0xf759('0xe'));var Redis=require(_0xf759('0xf'));var authService=require(_0xf759('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xf759('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf759('0x12'))('api');var utils=require(_0xf759('0x13'));var config=require(_0xf759('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x427903,_0x588ef0){_0x588ef0=_0x588ef0||0xcc;return function(_0x2c882e){if(_0x2c882e){return _0x427903['sendStatus'](_0x588ef0);}return _0x427903[_0xf759('0x15')](_0x588ef0)[_0xf759('0x16')]();};}function respondWithResult(_0x1c033a,_0xc3b03f){_0xc3b03f=_0xc3b03f||0xc8;return function(_0x53cb3c){if(_0x53cb3c){return _0x1c033a[_0xf759('0x15')](_0xc3b03f)[_0xf759('0x17')](_0x53cb3c);}};}function respondWithFilteredResult(_0x54d5c5,_0x4ff6f3){return function(_0x11528a){if(_0x11528a){var _0x5af241=typeof _0x4ff6f3[_0xf759('0x18')]==='undefined'&&typeof _0x4ff6f3[_0xf759('0x19')]===_0xf759('0x1a');var _0x3184fa=_0x11528a[_0xf759('0x1b')];var _0x50f0a8=_0x5af241?0x0:_0x4ff6f3['offset'];var _0x1452f9=_0x5af241?_0x11528a[_0xf759('0x1b')]:_0x4ff6f3[_0xf759('0x18')]+_0x4ff6f3[_0xf759('0x19')];var _0xee6f80;if(_0x1452f9>=_0x3184fa){_0x1452f9=_0x3184fa;_0xee6f80=0xc8;}else{_0xee6f80=0xce;}_0x54d5c5[_0xf759('0x15')](_0xee6f80);return _0x54d5c5['set']('Content-Range',_0x50f0a8+'-'+_0x1452f9+'/'+_0x3184fa)[_0xf759('0x17')](_0x11528a);}return null;};}function patchUpdates(_0x77246e){return function(_0x1aa30f){try{jsonpatch[_0xf759('0x1c')](_0x1aa30f,_0x77246e,!![]);}catch(_0x2108cc){return BPromise[_0xf759('0x1d')](_0x2108cc);}return _0x1aa30f[_0xf759('0x1e')]();};}function saveUpdates(_0x1219a6,_0x33ebc5){return function(_0x2521d3){if(_0x2521d3){return _0x2521d3[_0xf759('0x1f')](_0x1219a6)['then'](function(_0x58ba67){return _0x58ba67;});}return null;};}function removeEntity(_0x1e8049,_0x188de1){return function(_0xdbbe27){if(_0xdbbe27){return _0xdbbe27[_0xf759('0x20')]()['then'](function(){_0x1e8049[_0xf759('0x15')](0xcc)[_0xf759('0x16')]();});}};}function handleEntityNotFound(_0x5f5cc1,_0x3c5895){return function(_0x31df6a){if(!_0x31df6a){_0x5f5cc1['sendStatus'](0x194);}return _0x31df6a;};}function handleError(_0x3b834f,_0x464cdc){_0x464cdc=_0x464cdc||0x1f4;return function(_0x41a824){logger[_0xf759('0x21')](_0x41a824[_0xf759('0x22')]);if(_0x41a824['name']){delete _0x41a824['name'];}_0x3b834f['status'](_0x464cdc)[_0xf759('0x23')](_0x41a824);};}exports[_0xf759('0x24')]=function(_0x58fe37,_0xfaf592){var _0x45c53f={},_0x598ccb={},_0x5304c2={'count':0x0,'rows':[]};var _0x2af4f3=_['map'](db[_0xf759('0x25')]['rawAttributes'],function(_0x22a6b5){return{'name':_0x22a6b5[_0xf759('0x26')],'type':_0x22a6b5[_0xf759('0x27')][_0xf759('0x28')]};});_0x598ccb[_0xf759('0x29')]=_[_0xf759('0x2a')](_0x2af4f3,_0xf759('0x2b'));_0x598ccb[_0xf759('0x2c')]=_['keys'](_0x58fe37['query']);_0x598ccb[_0xf759('0x2d')]=_[_0xf759('0x2e')](_0x598ccb['model'],_0x598ccb[_0xf759('0x2c')]);_0x45c53f[_0xf759('0x2f')]=_[_0xf759('0x2e')](_0x598ccb[_0xf759('0x29')],qs[_0xf759('0x30')](_0x58fe37[_0xf759('0x2c')]['fields']));_0x45c53f['attributes']=_0x45c53f[_0xf759('0x2f')][_0xf759('0x31')]?_0x45c53f['attributes']:_0x598ccb[_0xf759('0x29')];if(!_0x58fe37['query']['hasOwnProperty']('nolimit')){_0x45c53f[_0xf759('0x19')]=qs[_0xf759('0x19')](_0x58fe37['query'][_0xf759('0x19')]);_0x45c53f[_0xf759('0x18')]=qs[_0xf759('0x18')](_0x58fe37['query'][_0xf759('0x18')]);}_0x45c53f[_0xf759('0x32')]=qs[_0xf759('0x33')](_0x58fe37[_0xf759('0x2c')][_0xf759('0x33')]);_0x45c53f[_0xf759('0x34')]=qs[_0xf759('0x2d')](_['pick'](_0x58fe37['query'],_0x598ccb[_0xf759('0x2d')]),_0x2af4f3);if(_0x58fe37[_0xf759('0x2c')][_0xf759('0x35')]){_0x45c53f[_0xf759('0x34')]=_[_0xf759('0x36')](_0x45c53f[_0xf759('0x34')],{'$or':_[_0xf759('0x2a')](_0x2af4f3,function(_0x3f998a){if(_0x3f998a['type']!==_0xf759('0x37')){var _0x5a6b30={};_0x5a6b30[_0x3f998a['name']]={'$like':'%'+_0x58fe37[_0xf759('0x2c')][_0xf759('0x35')]+'%'};return _0x5a6b30;}})});}_0x45c53f=_[_0xf759('0x36')]({},_0x45c53f,_0x58fe37[_0xf759('0x38')]);var _0x2aba13={'where':_0x45c53f[_0xf759('0x34')]};return db[_0xf759('0x25')][_0xf759('0x1b')](_0x2aba13)[_0xf759('0x39')](function(_0x4045e6){_0x5304c2[_0xf759('0x1b')]=_0x4045e6;if(_0x58fe37['query'][_0xf759('0x3a')]){_0x45c53f[_0xf759('0x3b')]=[{'all':!![]}];}return db[_0xf759('0x25')][_0xf759('0x3c')](_0x45c53f);})[_0xf759('0x39')](function(_0x4db23c){_0x5304c2[_0xf759('0x3d')]=_0x4db23c;return _0x5304c2;})[_0xf759('0x39')](respondWithFilteredResult(_0xfaf592,_0x45c53f))[_0xf759('0x3e')](handleError(_0xfaf592,null));}; \ No newline at end of file +var _0xfe21=['update','then','destroy','end','stack','name','send','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','Migration','includeAll','include','findAll','catch','eml-format','rimraf','fast-json-patch','moment','bluebird','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','reject','save'];(function(_0xd3e16a,_0x28517e){var _0x449538=function(_0x2a4f10){while(--_0x2a4f10){_0xd3e16a['push'](_0xd3e16a['shift']());}};_0x449538(++_0x28517e);}(_0xfe21,0x17b));var _0x1fe2=function(_0x3a5782,_0x5ddbf7){_0x3a5782=_0x3a5782-0x0;var _0x4f0c7a=_0xfe21[_0x3a5782];return _0x4f0c7a;};'use strict';var emlformat=require(_0x1fe2('0x0'));var rimraf=require(_0x1fe2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1fe2('0x2'));var rp=require('request-promise');var moment=require(_0x1fe2('0x3'));var BPromise=require(_0x1fe2('0x4'));var Mustache=require('mustache');var util=require(_0x1fe2('0x5'));var path=require(_0x1fe2('0x6'));var sox=require('sox');var csv=require(_0x1fe2('0x7'));var ejs=require(_0x1fe2('0x8'));var fs=require('fs');var fs_extra=require(_0x1fe2('0x9'));var _=require('lodash');var squel=require(_0x1fe2('0xa'));var crypto=require(_0x1fe2('0xb'));var jsforce=require(_0x1fe2('0xc'));var deskjs=require(_0x1fe2('0xd'));var toCsv=require(_0x1fe2('0x7'));var querystring=require(_0x1fe2('0xe'));var Papa=require('papaparse');var Redis=require(_0x1fe2('0xf'));var authService=require(_0x1fe2('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x1fe2('0x11'));var hardwareService=require(_0x1fe2('0x12'));var logger=require(_0x1fe2('0x13'))(_0x1fe2('0x14'));var utils=require('../../config/utils');var config=require(_0x1fe2('0x15'));var licenseUtil=require(_0x1fe2('0x16'));var db=require(_0x1fe2('0x17'))['db'];function respondWithStatusCode(_0x35af7d,_0x2453c5){_0x2453c5=_0x2453c5||0xcc;return function(_0xd5a234){if(_0xd5a234){return _0x35af7d[_0x1fe2('0x18')](_0x2453c5);}return _0x35af7d[_0x1fe2('0x19')](_0x2453c5)['end']();};}function respondWithResult(_0x39853f,_0x3762f5){_0x3762f5=_0x3762f5||0xc8;return function(_0x12d22f){if(_0x12d22f){return _0x39853f[_0x1fe2('0x19')](_0x3762f5)[_0x1fe2('0x1a')](_0x12d22f);}};}function respondWithFilteredResult(_0x326caa,_0x169072){return function(_0xfd60cb){if(_0xfd60cb){var _0x4e9eb7=typeof _0x169072[_0x1fe2('0x1b')]==='undefined'&&typeof _0x169072[_0x1fe2('0x1c')]===_0x1fe2('0x1d');var _0x1a830e=_0xfd60cb[_0x1fe2('0x1e')];var _0x5cf497=_0x4e9eb7?0x0:_0x169072[_0x1fe2('0x1b')];var _0x46103a=_0x4e9eb7?_0xfd60cb[_0x1fe2('0x1e')]:_0x169072[_0x1fe2('0x1b')]+_0x169072[_0x1fe2('0x1c')];var _0x4e7b1c;if(_0x46103a>=_0x1a830e){_0x46103a=_0x1a830e;_0x4e7b1c=0xc8;}else{_0x4e7b1c=0xce;}_0x326caa[_0x1fe2('0x19')](_0x4e7b1c);return _0x326caa[_0x1fe2('0x1f')](_0x1fe2('0x20'),_0x5cf497+'-'+_0x46103a+'/'+_0x1a830e)['json'](_0xfd60cb);}return null;};}function patchUpdates(_0x2ab8fb){return function(_0x1b0c27){try{jsonpatch['apply'](_0x1b0c27,_0x2ab8fb,!![]);}catch(_0x1aa37f){return BPromise[_0x1fe2('0x21')](_0x1aa37f);}return _0x1b0c27[_0x1fe2('0x22')]();};}function saveUpdates(_0x51ee97,_0x1b00ab){return function(_0x36a791){if(_0x36a791){return _0x36a791[_0x1fe2('0x23')](_0x51ee97)[_0x1fe2('0x24')](function(_0x36004e){return _0x36004e;});}return null;};}function removeEntity(_0x5c69d1,_0x38ed6f){return function(_0x527a9d){if(_0x527a9d){return _0x527a9d[_0x1fe2('0x25')]()[_0x1fe2('0x24')](function(){_0x5c69d1['status'](0xcc)[_0x1fe2('0x26')]();});}};}function handleEntityNotFound(_0x164f0e,_0x357c36){return function(_0x146279){if(!_0x146279){_0x164f0e[_0x1fe2('0x18')](0x194);}return _0x146279;};}function handleError(_0x572fcf,_0x883f9){_0x883f9=_0x883f9||0x1f4;return function(_0x5294cd){logger['error'](_0x5294cd[_0x1fe2('0x27')]);if(_0x5294cd[_0x1fe2('0x28')]){delete _0x5294cd[_0x1fe2('0x28')];}_0x572fcf['status'](_0x883f9)[_0x1fe2('0x29')](_0x5294cd);};}exports['index']=function(_0x39a509,_0x13a979){var _0x45a0d9={},_0x3c88e9={},_0x23f1ae={'count':0x0,'rows':[]};var _0x21b7f2=_['map'](db['Migration'][_0x1fe2('0x2a')],function(_0x527201){return{'name':_0x527201[_0x1fe2('0x2b')],'type':_0x527201[_0x1fe2('0x2c')][_0x1fe2('0x2d')]};});_0x3c88e9['model']=_[_0x1fe2('0x2e')](_0x21b7f2,_0x1fe2('0x28'));_0x3c88e9[_0x1fe2('0x2f')]=_[_0x1fe2('0x30')](_0x39a509[_0x1fe2('0x2f')]);_0x3c88e9[_0x1fe2('0x31')]=_[_0x1fe2('0x32')](_0x3c88e9[_0x1fe2('0x33')],_0x3c88e9['query']);_0x45a0d9[_0x1fe2('0x34')]=_['intersection'](_0x3c88e9[_0x1fe2('0x33')],qs[_0x1fe2('0x35')](_0x39a509[_0x1fe2('0x2f')]['fields']));_0x45a0d9[_0x1fe2('0x34')]=_0x45a0d9[_0x1fe2('0x34')][_0x1fe2('0x36')]?_0x45a0d9[_0x1fe2('0x34')]:_0x3c88e9[_0x1fe2('0x33')];if(!_0x39a509[_0x1fe2('0x2f')]['hasOwnProperty'](_0x1fe2('0x37'))){_0x45a0d9[_0x1fe2('0x1c')]=qs['limit'](_0x39a509[_0x1fe2('0x2f')][_0x1fe2('0x1c')]);_0x45a0d9[_0x1fe2('0x1b')]=qs['offset'](_0x39a509[_0x1fe2('0x2f')][_0x1fe2('0x1b')]);}_0x45a0d9[_0x1fe2('0x38')]=qs['sort'](_0x39a509[_0x1fe2('0x2f')][_0x1fe2('0x39')]);_0x45a0d9[_0x1fe2('0x3a')]=qs[_0x1fe2('0x31')](_[_0x1fe2('0x3b')](_0x39a509[_0x1fe2('0x2f')],_0x3c88e9[_0x1fe2('0x31')]),_0x21b7f2);if(_0x39a509[_0x1fe2('0x2f')]['filter']){_0x45a0d9[_0x1fe2('0x3a')]=_[_0x1fe2('0x3c')](_0x45a0d9[_0x1fe2('0x3a')],{'$or':_[_0x1fe2('0x2e')](_0x21b7f2,function(_0x2ec194){if(_0x2ec194['type']!==_0x1fe2('0x3d')){var _0x1c4cfb={};_0x1c4cfb[_0x2ec194[_0x1fe2('0x28')]]={'$like':'%'+_0x39a509['query'][_0x1fe2('0x3e')]+'%'};return _0x1c4cfb;}})});}_0x45a0d9=_['merge']({},_0x45a0d9,_0x39a509[_0x1fe2('0x3f')]);var _0x478903={'where':_0x45a0d9['where']};return db[_0x1fe2('0x40')][_0x1fe2('0x1e')](_0x478903)['then'](function(_0x3a8cfc){_0x23f1ae[_0x1fe2('0x1e')]=_0x3a8cfc;if(_0x39a509[_0x1fe2('0x2f')][_0x1fe2('0x41')]){_0x45a0d9[_0x1fe2('0x42')]=[{'all':!![]}];}return db[_0x1fe2('0x40')][_0x1fe2('0x43')](_0x45a0d9);})[_0x1fe2('0x24')](function(_0x3c4ebc){_0x23f1ae['rows']=_0x3c4ebc;return _0x23f1ae;})['then'](respondWithFilteredResult(_0x13a979,_0x45a0d9))[_0x1fe2('0x44')](handleError(_0x13a979,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index b2b6310..58c3b87 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 _0x8822=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','./migration.attributes','exports','Migration'];(function(_0x3ec122,_0x55150a){var _0x4ecf41=function(_0x1709cd){while(--_0x1709cd){_0x3ec122['push'](_0x3ec122['shift']());}};_0x4ecf41(++_0x55150a);}(_0x8822,0x1e0));var _0x2882=function(_0xeeb94f,_0x2529a8){_0xeeb94f=_0xeeb94f-0x0;var _0x2ceaf4=_0x8822[_0xeeb94f];return _0x2ceaf4;};'use strict';var _=require(_0x2882('0x0'));var util=require(_0x2882('0x1'));var logger=require(_0x2882('0x2'))('api');var moment=require(_0x2882('0x3'));var BPromise=require(_0x2882('0x4'));var rp=require(_0x2882('0x5'));var fs=require('fs');var path=require(_0x2882('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x2882('0x7'));module[_0x2882('0x8')]=function(_0x4d6a1e,_0x52ce6e){return _0x4d6a1e['define'](_0x2882('0x9'),attributes,{'tableName':'migrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9657=['./migration.attributes','exports','define','Migration','migrations','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0xe2ce2b,_0x2b1a52){var _0x407386=function(_0x377591){while(--_0x377591){_0xe2ce2b['push'](_0xe2ce2b['shift']());}};_0x407386(++_0x2b1a52);}(_0x9657,0x91));var _0x7965=function(_0x385c5f,_0x201d4){_0x385c5f=_0x385c5f-0x0;var _0x5ba15a=_0x9657[_0x385c5f];return _0x5ba15a;};'use strict';var _=require('lodash');var util=require(_0x7965('0x0'));var logger=require(_0x7965('0x1'))(_0x7965('0x2'));var moment=require(_0x7965('0x3'));var BPromise=require(_0x7965('0x4'));var rp=require(_0x7965('0x5'));var fs=require('fs');var path=require(_0x7965('0x6'));var rimraf=require(_0x7965('0x7'));var config=require(_0x7965('0x8'));var attributes=require(_0x7965('0x9'));module[_0x7965('0xa')]=function(_0x2b0e3d,_0x25e5b7){return _0x2b0e3d[_0x7965('0xb')](_0x7965('0xc'),attributes,{'tableName':_0x7965('0xd'),'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 4b35984..78068a5 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 _0x24a6=['jayson/promise','client','http','request','then','info','Migration,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x5ab234,_0x4a1494){var _0x5850c7=function(_0xa618cb){while(--_0xa618cb){_0x5ab234['push'](_0x5ab234['shift']());}};_0x5850c7(++_0x4a1494);}(_0x24a6,0x14f));var _0x624a=function(_0xb8345a,_0x7f03a9){_0xb8345a=_0xb8345a-0x0;var _0x5e7342=_0x24a6[_0xb8345a];return _0x5e7342;};'use strict';var _=require(_0x624a('0x0'));var util=require('util');var moment=require(_0x624a('0x1'));var BPromise=require(_0x624a('0x2'));var rs=require(_0x624a('0x3'));var fs=require('fs');var Redis=require(_0x624a('0x4'));var db=require(_0x624a('0x5'))['db'];var utils=require(_0x624a('0x6'));var logger=require(_0x624a('0x7'))(_0x624a('0x8'));var config=require(_0x624a('0x9'));var jayson=require(_0x624a('0xa'));var client=jayson[_0x624a('0xb')][_0x624a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1af370,_0x3b0720,_0x58243){return new BPromise(function(_0x40cb85,_0x159187){return client[_0x624a('0xd')](_0x1af370,_0x58243)[_0x624a('0xe')](function(_0x159240){logger[_0x624a('0xf')](_0x624a('0x10'),_0x3b0720,_0x624a('0x11'));logger['debug']('Migration,\x20%s,\x20%s,\x20%s',_0x3b0720,_0x624a('0x11'),JSON[_0x624a('0x12')](_0x159240));if(_0x159240[_0x624a('0x13')]){if(_0x159240['error'][_0x624a('0x14')]===0x1f4){logger[_0x624a('0x13')]('Migration,\x20%s,\x20%s',_0x3b0720,_0x159240['error']['message']);return _0x159187(_0x159240[_0x624a('0x13')]['message']);}logger[_0x624a('0x13')](_0x624a('0x10'),_0x3b0720,_0x159240[_0x624a('0x13')][_0x624a('0x15')]);return _0x40cb85(_0x159240['error'][_0x624a('0x15')]);}else{logger['info'](_0x624a('0x10'),_0x3b0720,_0x624a('0x11'));_0x40cb85(_0x159240['result'][_0x624a('0x15')]);}})[_0x624a('0x16')](function(_0x3b6414){logger[_0x624a('0x13')](_0x624a('0x10'),_0x3b0720,_0x3b6414);_0x159187(_0x3b6414);});});} \ No newline at end of file +var _0xd0a4=['http','request','then','info','Migration,\x20%s,\x20%s','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0xf29686,_0x1e73df){var _0x288c09=function(_0x40eff2){while(--_0x40eff2){_0xf29686['push'](_0xf29686['shift']());}};_0x288c09(++_0x1e73df);}(_0xd0a4,0x166));var _0x4d0a=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xd0a4[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x4d0a('0x0'));var util=require(_0x4d0a('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4d0a('0x2'));var db=require(_0x4d0a('0x3'))['db'];var utils=require(_0x4d0a('0x4'));var logger=require(_0x4d0a('0x5'))(_0x4d0a('0x6'));var config=require(_0x4d0a('0x7'));var jayson=require(_0x4d0a('0x8'));var client=jayson[_0x4d0a('0x9')][_0x4d0a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4a3a1a,_0x59fe32,_0xd6c889){return new BPromise(function(_0x1feaea,_0x5199b8){return client[_0x4d0a('0xb')](_0x4a3a1a,_0xd6c889)[_0x4d0a('0xc')](function(_0x4e049b){logger[_0x4d0a('0xd')](_0x4d0a('0xe'),_0x59fe32,_0x4d0a('0xf'));logger[_0x4d0a('0x10')](_0x4d0a('0x11'),_0x59fe32,'request\x20sent',JSON['stringify'](_0x4e049b));if(_0x4e049b['error']){if(_0x4e049b[_0x4d0a('0x12')][_0x4d0a('0x13')]===0x1f4){logger[_0x4d0a('0x12')]('Migration,\x20%s,\x20%s',_0x59fe32,_0x4e049b['error']['message']);return _0x5199b8(_0x4e049b['error'][_0x4d0a('0x14')]);}logger['error'](_0x4d0a('0xe'),_0x59fe32,_0x4e049b[_0x4d0a('0x12')][_0x4d0a('0x14')]);return _0x1feaea(_0x4e049b['error'][_0x4d0a('0x14')]);}else{logger[_0x4d0a('0xd')](_0x4d0a('0xe'),_0x59fe32,_0x4d0a('0xf'));_0x1feaea(_0x4e049b[_0x4d0a('0x15')][_0x4d0a('0x14')]);}})[_0x4d0a('0x16')](function(_0x4052e8){logger['error'](_0x4d0a('0xe'),_0x59fe32,_0x4052e8);_0x5199b8(_0x4052e8);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index 40b77a1..2f78406 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 _0xb470=['get','isAuthenticated','index','/:id','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./network.controller'];(function(_0x4cb9aa,_0x58b44f){var _0x2eff51=function(_0x18a09c){while(--_0x18a09c){_0x4cb9aa['push'](_0x4cb9aa['shift']());}};_0x2eff51(++_0x58b44f);}(_0xb470,0x75));var _0x0b47=function(_0x4cfe89,_0x59a64d){_0x4cfe89=_0x4cfe89-0x0;var _0x4c817e=_0xb470[_0x4cfe89];return _0x4c817e;};'use strict';var multer=require(_0x0b47('0x0'));var util=require(_0x0b47('0x1'));var path=require(_0x0b47('0x2'));var timeout=require(_0x0b47('0x3'));var express=require('express');var router=express[_0x0b47('0x4')]();var fs_extra=require(_0x0b47('0x5'));var auth=require(_0x0b47('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x0b47('0x7'));var controller=require(_0x0b47('0x8'));router[_0x0b47('0x9')]('/',auth[_0x0b47('0xa')](),controller[_0x0b47('0xb')]);router[_0x0b47('0x9')](_0x0b47('0xc'),auth[_0x0b47('0xa')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x0b47('0xd')](_0x0b47('0xc'),auth['isAuthenticated'](),controller[_0x0b47('0xe')]);router[_0x0b47('0xf')](_0x0b47('0xc'),auth[_0x0b47('0xa')](),controller[_0x0b47('0x10')]);module[_0x0b47('0x11')]=router; \ No newline at end of file +var _0x6ff4=['update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','./network.controller','get','index','/:id','isAuthenticated','show','post','create','put'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x6ff4,0x90));var _0x46ff=function(_0x3ede7e,_0x4d9486){_0x3ede7e=_0x3ede7e-0x0;var _0x19490f=_0x6ff4[_0x3ede7e];return _0x19490f;};'use strict';var multer=require(_0x46ff('0x0'));var util=require(_0x46ff('0x1'));var path=require(_0x46ff('0x2'));var timeout=require(_0x46ff('0x3'));var express=require('express');var router=express[_0x46ff('0x4')]();var fs_extra=require(_0x46ff('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x46ff('0x6'));var config=require('../../config/environment');var controller=require(_0x46ff('0x7'));router[_0x46ff('0x8')]('/',auth['isAuthenticated'](),controller[_0x46ff('0x9')]);router[_0x46ff('0x8')](_0x46ff('0xa'),auth[_0x46ff('0xb')](),controller[_0x46ff('0xc')]);router[_0x46ff('0xd')]('/',auth['isAuthenticated'](),controller[_0x46ff('0xe')]);router[_0x46ff('0xf')](_0x46ff('0xa'),auth['isAuthenticated'](),controller[_0x46ff('0x10')]);router[_0x46ff('0x11')](_0x46ff('0xa'),auth[_0x46ff('0xb')](),controller[_0x46ff('0x12')]);module[_0x46ff('0x13')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index c8167d3..76b6074 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 _0x260c=['stun','turn','STRING','sequelize','exports','ENUM','localnet','externip'];(function(_0x19181d,_0xc705d9){var _0x49cb32=function(_0x5388b6){while(--_0x5388b6){_0x19181d['push'](_0x19181d['shift']());}};_0x49cb32(++_0xc705d9);}(_0x260c,0x17b));var _0xc260=function(_0x3d26a0,_0x51d38b){_0x3d26a0=_0x3d26a0-0x0;var _0x554c66=_0x260c[_0x3d26a0];return _0x554c66;};'use strict';var Sequelize=require(_0xc260('0x0'));module[_0xc260('0x1')]={'type':{'type':Sequelize[_0xc260('0x2')](_0xc260('0x3'),_0xc260('0x4'),_0xc260('0x5'),_0xc260('0x6'))},'value':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0xc260('0x7')]}}; \ No newline at end of file +var _0x0c44=['exports','ENUM','externip','turn','STRING'];(function(_0x284583,_0x178803){var _0x4a5a42=function(_0xab66e7){while(--_0xab66e7){_0x284583['push'](_0x284583['shift']());}};_0x4a5a42(++_0x178803);}(_0x0c44,0x181));var _0x40c4=function(_0x356c87,_0x199178){_0x356c87=_0x356c87-0x0;var _0x14231a=_0x0c44[_0x356c87];return _0x14231a;};'use strict';var Sequelize=require('sequelize');module[_0x40c4('0x0')]={'type':{'type':Sequelize[_0x40c4('0x1')]('localnet',_0x40c4('0x2'),'stun',_0x40c4('0x3'))},'value':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x40c4('0x4')]},'password':{'type':Sequelize[_0x40c4('0x4')]}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index 5942a7c..89ce2b9 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 _0x2e85=['findAll','rows','show','params','keys','rawAttributes','includeAll','include','options','find','create','sequelize','transaction','body','toUpperCase','STUN','readFileSync','join','server/files/templates/stun_multiple.ejs','utf8','render','writeFileSync','Reload','res_stun_monitor.so','TURN','root','server/files/templates/turn_multiple.ejs','/etc/asterisk/turn_xcally.conf','format','/etc/asterisk/sip_xcally_%s.conf','chan_sip.so','/etc/asterisk/stun_xcally.conf','toLowerCase','eml-format','rimraf','zip-dir','bluebird','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','sendStatus','status','end','offset','undefined','limit','set','Content-Range','json','apply','reject','save','update','destroy','then','stack','name','index','map','fieldName','type','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','Network','count'];(function(_0xae7c2f,_0xf31e04){var _0x5d7001=function(_0x4eeadb){while(--_0x4eeadb){_0xae7c2f['push'](_0xae7c2f['shift']());}};_0x5d7001(++_0xf31e04);}(_0x2e85,0x165));var _0x52e8=function(_0xc47203,_0x26eb71){_0xc47203=_0xc47203-0x0;var _0x354253=_0x2e85[_0xc47203];return _0x354253;};'use strict';var emlformat=require(_0x52e8('0x0'));var rimraf=require(_0x52e8('0x1'));var zipdir=require(_0x52e8('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x52e8('0x3'));var Mustache=require('mustache');var util=require(_0x52e8('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0x52e8('0x5'));var ejs=require(_0x52e8('0x6'));var fs=require('fs');var fs_extra=require(_0x52e8('0x7'));var _=require(_0x52e8('0x8'));var squel=require(_0x52e8('0x9'));var crypto=require(_0x52e8('0xa'));var jsforce=require(_0x52e8('0xb'));var deskjs=require(_0x52e8('0xc'));var toCsv=require(_0x52e8('0x5'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x52e8('0xd'));var authService=require(_0x52e8('0xe'));var qs=require(_0x52e8('0xf'));var as=require(_0x52e8('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x52e8('0x11'))(_0x52e8('0x12'));var utils=require(_0x52e8('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x52e8('0x14'));var db=require(_0x52e8('0x15'))['db'];var jayson=require(_0x52e8('0x16'));var client=jayson[_0x52e8('0x17')][_0x52e8('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x7f2d88,_0x5dd050,_0x5fbf00,_0x1ba433){return new BPromise(function(_0x179fd5,_0x14ae35){var _0x2aec23=_0x1ba433||client;return _0x2aec23[_0x52e8('0x19')](_0x7f2d88,_0x5fbf00)['then'](function(_0x5582e5){logger['info'](_0x52e8('0x1a'),_0x5dd050,_0x52e8('0x1b'));logger[_0x52e8('0x1c')](_0x52e8('0x1d'),_0x5dd050,'request\x20sent',JSON[_0x52e8('0x1e')](_0x5582e5));if(_0x5582e5[_0x52e8('0x1f')]){if(_0x5582e5['error'][_0x52e8('0x20')]===0x1f4){logger['error'](_0x52e8('0x1a'),_0x5dd050,_0x5582e5[_0x52e8('0x1f')][_0x52e8('0x21')]);return _0x14ae35(_0x5582e5['error'][_0x52e8('0x21')]);}logger['error'](_0x52e8('0x1a'),_0x5dd050,_0x5582e5[_0x52e8('0x1f')][_0x52e8('0x21')]);return _0x179fd5(_0x5582e5['error'][_0x52e8('0x21')]);}else{logger[_0x52e8('0x22')](_0x52e8('0x1a'),_0x5dd050,'request\x20sent');_0x179fd5(_0x5582e5['result'][_0x52e8('0x21')]);}})[_0x52e8('0x23')](function(_0x5a5973){logger[_0x52e8('0x1f')](_0x52e8('0x1a'),_0x5dd050,_0x5a5973);_0x14ae35(_0x5a5973);});});}function respondWithStatusCode(_0x103582,_0x258177){_0x258177=_0x258177||0xcc;return function(_0x3589f7){if(_0x3589f7){return _0x103582[_0x52e8('0x24')](_0x258177);}return _0x103582[_0x52e8('0x25')](_0x258177)[_0x52e8('0x26')]();};}function respondWithResult(_0x33e663,_0x22d51f){_0x22d51f=_0x22d51f||0xc8;return function(_0x42097a){if(_0x42097a){return _0x33e663[_0x52e8('0x25')](_0x22d51f)['json'](_0x42097a);}};}function respondWithFilteredResult(_0x436e01,_0x406017){return function(_0x16afa6){if(_0x16afa6){var _0xb52404=typeof _0x406017[_0x52e8('0x27')]===_0x52e8('0x28')&&typeof _0x406017[_0x52e8('0x29')]===_0x52e8('0x28');var _0x8c3a63=_0x16afa6['count'];var _0x20f8f5=_0xb52404?0x0:_0x406017[_0x52e8('0x27')];var _0x260996=_0xb52404?_0x16afa6['count']:_0x406017[_0x52e8('0x27')]+_0x406017['limit'];var _0x4cc385;if(_0x260996>=_0x8c3a63){_0x260996=_0x8c3a63;_0x4cc385=0xc8;}else{_0x4cc385=0xce;}_0x436e01[_0x52e8('0x25')](_0x4cc385);return _0x436e01[_0x52e8('0x2a')](_0x52e8('0x2b'),_0x20f8f5+'-'+_0x260996+'/'+_0x8c3a63)[_0x52e8('0x2c')](_0x16afa6);}return null;};}function patchUpdates(_0x3cd3c5){return function(_0x4b4c86){try{jsonpatch[_0x52e8('0x2d')](_0x4b4c86,_0x3cd3c5,!![]);}catch(_0x351856){return BPromise[_0x52e8('0x2e')](_0x351856);}return _0x4b4c86[_0x52e8('0x2f')]();};}function saveUpdates(_0x3002c5,_0x54fb1b){return function(_0x260826){if(_0x260826){return _0x260826[_0x52e8('0x30')](_0x3002c5)['then'](function(_0x1e43c4){return _0x1e43c4;});}return null;};}function removeEntity(_0xcf328d,_0x367d68){return function(_0x39d759){if(_0x39d759){return _0x39d759[_0x52e8('0x31')]()[_0x52e8('0x32')](function(){_0xcf328d[_0x52e8('0x25')](0xcc)[_0x52e8('0x26')]();});}};}function handleEntityNotFound(_0x102045,_0x59351e){return function(_0x346f27){if(!_0x346f27){_0x102045['sendStatus'](0x194);}return _0x346f27;};}function handleError(_0xdac8cb,_0x491226){_0x491226=_0x491226||0x1f4;return function(_0x5d111f){logger['error'](_0x5d111f[_0x52e8('0x33')]);if(_0x5d111f[_0x52e8('0x34')]){delete _0x5d111f['name'];}_0xdac8cb[_0x52e8('0x25')](_0x491226)['send'](_0x5d111f);};}exports[_0x52e8('0x35')]=function(_0x3f776c,_0x493c89){var _0x13bfe2={},_0x337139={},_0x39c0cd={'count':0x0,'rows':[]};var _0x41dbed=_[_0x52e8('0x36')](db['Network']['rawAttributes'],function(_0x158366){return{'name':_0x158366[_0x52e8('0x37')],'type':_0x158366[_0x52e8('0x38')]['key']};});_0x337139['model']=_['map'](_0x41dbed,_0x52e8('0x34'));_0x337139['query']=_['keys'](_0x3f776c[_0x52e8('0x39')]);_0x337139[_0x52e8('0x3a')]=_['intersection'](_0x337139[_0x52e8('0x3b')],_0x337139[_0x52e8('0x39')]);_0x13bfe2[_0x52e8('0x3c')]=_[_0x52e8('0x3d')](_0x337139['model'],qs[_0x52e8('0x3e')](_0x3f776c[_0x52e8('0x39')][_0x52e8('0x3e')]));_0x13bfe2[_0x52e8('0x3c')]=_0x13bfe2['attributes'][_0x52e8('0x3f')]?_0x13bfe2[_0x52e8('0x3c')]:_0x337139[_0x52e8('0x3b')];if(!_0x3f776c[_0x52e8('0x39')][_0x52e8('0x40')](_0x52e8('0x41'))){_0x13bfe2[_0x52e8('0x29')]=qs[_0x52e8('0x29')](_0x3f776c[_0x52e8('0x39')]['limit']);_0x13bfe2[_0x52e8('0x27')]=qs[_0x52e8('0x27')](_0x3f776c['query'][_0x52e8('0x27')]);}_0x13bfe2[_0x52e8('0x42')]=qs['sort'](_0x3f776c[_0x52e8('0x39')][_0x52e8('0x43')]);_0x13bfe2[_0x52e8('0x44')]=qs[_0x52e8('0x3a')](_[_0x52e8('0x45')](_0x3f776c['query'],_0x337139['filters']),_0x41dbed);if(_0x3f776c[_0x52e8('0x39')][_0x52e8('0x46')]){_0x13bfe2[_0x52e8('0x44')]=_['merge'](_0x13bfe2[_0x52e8('0x44')],{'$or':_['map'](_0x41dbed,function(_0x1c3d42){if(_0x1c3d42[_0x52e8('0x38')]!==_0x52e8('0x47')){var _0x508713={};_0x508713[_0x1c3d42[_0x52e8('0x34')]]={'$like':'%'+_0x3f776c[_0x52e8('0x39')][_0x52e8('0x46')]+'%'};return _0x508713;}})});}_0x13bfe2=_[_0x52e8('0x48')]({},_0x13bfe2,_0x3f776c['options']);var _0x5cca0d={'where':_0x13bfe2['where']};return db[_0x52e8('0x49')][_0x52e8('0x4a')](_0x5cca0d)[_0x52e8('0x32')](function(_0x39da2c){_0x39c0cd['count']=_0x39da2c;if(_0x3f776c[_0x52e8('0x39')]['includeAll']){_0x13bfe2['include']=[{'all':!![]}];}return db[_0x52e8('0x49')][_0x52e8('0x4b')](_0x13bfe2);})[_0x52e8('0x32')](function(_0x19666e){_0x39c0cd[_0x52e8('0x4c')]=_0x19666e;return _0x39c0cd;})[_0x52e8('0x32')](respondWithFilteredResult(_0x493c89,_0x13bfe2))[_0x52e8('0x23')](handleError(_0x493c89,null));};exports[_0x52e8('0x4d')]=function(_0x199778,_0x430762){var _0x389fd6={'raw':!![],'where':{'id':_0x199778[_0x52e8('0x4e')]['id']}},_0x40c73e={};_0x40c73e['model']=_[_0x52e8('0x4f')](db[_0x52e8('0x49')][_0x52e8('0x50')]);_0x40c73e[_0x52e8('0x39')]=_[_0x52e8('0x4f')](_0x199778[_0x52e8('0x39')]);_0x40c73e[_0x52e8('0x3a')]=_['intersection'](_0x40c73e[_0x52e8('0x3b')],_0x40c73e['query']);_0x389fd6['attributes']=_['intersection'](_0x40c73e[_0x52e8('0x3b')],qs[_0x52e8('0x3e')](_0x199778[_0x52e8('0x39')][_0x52e8('0x3e')]));_0x389fd6[_0x52e8('0x3c')]=_0x389fd6[_0x52e8('0x3c')]['length']?_0x389fd6[_0x52e8('0x3c')]:_0x40c73e['model'];if(_0x199778[_0x52e8('0x39')][_0x52e8('0x51')]){_0x389fd6[_0x52e8('0x52')]=[{'all':!![]}];}_0x389fd6=_[_0x52e8('0x48')]({},_0x389fd6,_0x199778[_0x52e8('0x53')]);return db[_0x52e8('0x49')][_0x52e8('0x54')](_0x389fd6)[_0x52e8('0x32')](handleEntityNotFound(_0x430762,null))['then'](respondWithResult(_0x430762,null))['catch'](handleError(_0x430762,null));};exports[_0x52e8('0x55')]=function(_0x2fe7df,_0x2450f9,_0xbf31c1){var _0x512566;return db[_0x52e8('0x56')][_0x52e8('0x57')](function(_0x4bac5e){return db[_0x52e8('0x49')]['create'](_0x2fe7df[_0x52e8('0x58')],{'raw':!![]})[_0x52e8('0x32')](function(_0x41158f){_0x512566=_0x41158f;return db['Network'][_0x52e8('0x4b')]({'where':{'type':_0x2fe7df[_0x52e8('0x58')][_0x52e8('0x38')]},'raw':!![]});})[_0x52e8('0x32')](function(_0x42f148){if(_0x512566[_0x52e8('0x38')][_0x52e8('0x59')]()==_0x52e8('0x5a')){var _0xef74ac=fs[_0x52e8('0x5b')](path[_0x52e8('0x5c')](config['root'],_0x52e8('0x5d')),_0x52e8('0x5e'));var _0x247b27=ejs[_0x52e8('0x5f')](_0xef74ac,{'networks':_0x42f148||[]});fs[_0x52e8('0x60')]('/etc/asterisk/stun_xcally.conf',_0x247b27);return respondWithRpcPromise(_0x52e8('0x61'),_0x52e8('0x55'),{'module':_0x52e8('0x62')});}else if(_0x512566['type']['toUpperCase']()==_0x52e8('0x63')){var _0x583b0b=fs[_0x52e8('0x5b')](path['join'](config[_0x52e8('0x64')],_0x52e8('0x65')),_0x52e8('0x5e'));var _0x5940b5=ejs[_0x52e8('0x5f')](_0x583b0b,{'networks':_0x42f148||[]});fs['writeFileSync'](_0x52e8('0x66'),_0x5940b5);return respondWithRpcPromise(_0x52e8('0x61'),'create',{'module':_0x52e8('0x62')});}else{var _0x1f4600=fs['readFileSync'](path[_0x52e8('0x5c')](config[_0x52e8('0x64')],'server/files/templates/network.ejs'),_0x52e8('0x5e'));var _0x14204f=ejs[_0x52e8('0x5f')](_0x1f4600,{'networks':_0x42f148||[]});fs['writeFileSync'](util[_0x52e8('0x67')](_0x52e8('0x68'),_0x2fe7df['body']['type']['toLowerCase']()),_0x14204f);return respondWithRpcPromise(_0x52e8('0x61'),'create',{'module':_0x52e8('0x69')});}return null;})['then'](function(){return _0x512566;});})[_0x52e8('0x32')](respondWithResult(_0x2450f9,0xc9))[_0x52e8('0x23')](handleError(_0x2450f9,null));};exports[_0x52e8('0x30')]=function(_0x4885b9,_0x1f8151,_0x5a2a64){var _0x212cfc;return db[_0x52e8('0x56')][_0x52e8('0x57')](function(_0x434db0){return db[_0x52e8('0x49')][_0x52e8('0x54')]({'where':{'id':_0x4885b9[_0x52e8('0x4e')]['id']}})[_0x52e8('0x32')](handleEntityNotFound(_0x1f8151,null))['then'](saveUpdates(_0x4885b9[_0x52e8('0x58')],null))[_0x52e8('0x32')](function(_0x3da002){if(_0x3da002){_0x212cfc=_0x3da002;return db[_0x52e8('0x49')][_0x52e8('0x4b')]({'where':{'type':_0x212cfc['type']},'raw':!![]});}return null;})['then'](function(_0x2f24e2){if(_0x212cfc[_0x52e8('0x38')][_0x52e8('0x59')]()==_0x52e8('0x5a')){var _0x486a09=fs['readFileSync'](path[_0x52e8('0x5c')](config[_0x52e8('0x64')],_0x52e8('0x5d')),_0x52e8('0x5e'));var _0x2ef9ce=ejs['render'](_0x486a09,{'networks':_0x2f24e2||[]});fs['writeFileSync'](_0x52e8('0x6a'),_0x2ef9ce);return respondWithRpcPromise(_0x52e8('0x61'),_0x52e8('0x30'),{'module':_0x52e8('0x62')});}else if(_0x212cfc[_0x52e8('0x38')][_0x52e8('0x59')]()==_0x52e8('0x63')){var _0x594359=fs[_0x52e8('0x5b')](path[_0x52e8('0x5c')](config['root'],_0x52e8('0x65')),'utf8');var _0x21e138=ejs[_0x52e8('0x5f')](_0x594359,{'networks':_0x2f24e2||[]});fs['writeFileSync'](_0x52e8('0x66'),_0x21e138);return respondWithRpcPromise(_0x52e8('0x61'),_0x52e8('0x30'),{'module':_0x52e8('0x62')});}else{var _0x5573c5=fs['readFileSync'](path[_0x52e8('0x5c')](config[_0x52e8('0x64')],'server/files/templates/network.ejs'),'utf8');var _0x62be3a=ejs['render'](_0x5573c5,{'networks':_0x2f24e2||[]});fs['writeFileSync'](util[_0x52e8('0x67')]('/etc/asterisk/sip_xcally_%s.conf',_0x4885b9['body'][_0x52e8('0x38')][_0x52e8('0x6b')]()),_0x62be3a);return respondWithRpcPromise(_0x52e8('0x61'),'update',{'module':_0x52e8('0x69')});}return null;})['then'](function(_0x3a1b2a){if(_0x3a1b2a){return _0x212cfc;}return null;});})['then'](respondWithResult(_0x1f8151,null))[_0x52e8('0x23')](handleError(_0x1f8151,null));};exports['destroy']=function(_0x12657a,_0x581519,_0x4737e9){var _0xc28745;return db['Network']['find']({'where':{'id':_0x12657a[_0x52e8('0x4e')]['id']}})['then'](function(_0x539449){_0xc28745=_0x539449;return _0x539449;})[_0x52e8('0x32')](handleEntityNotFound(_0x581519,null))[_0x52e8('0x32')](removeEntity(_0x581519,null))[_0x52e8('0x32')](function(){if(_0xc28745){return db['Network'][_0x52e8('0x4b')]({'where':{'type':_0xc28745[_0x52e8('0x38')]},'raw':!![]});}})['then'](function(_0x3c656c){if(_0xc28745[_0x52e8('0x38')]['toUpperCase']()==_0x52e8('0x5a')){var _0x4dff49=fs[_0x52e8('0x5b')](path[_0x52e8('0x5c')](config[_0x52e8('0x64')],'server/files/templates/stun_multiple.ejs'),_0x52e8('0x5e'));var _0x5996b6=ejs['render'](_0x4dff49,{'networks':_0x3c656c||[]});fs['writeFileSync'](_0x52e8('0x6a'),_0x5996b6);return respondWithRpcPromise(_0x52e8('0x61'),_0x52e8('0x31'),{'module':_0x52e8('0x62')});}else if(_0xc28745[_0x52e8('0x38')][_0x52e8('0x59')]()==_0x52e8('0x63')){var _0x3ecf75=fs['readFileSync'](path[_0x52e8('0x5c')](config['root'],_0x52e8('0x65')),_0x52e8('0x5e'));var _0x15e896=ejs[_0x52e8('0x5f')](_0x3ecf75,{'networks':_0x3c656c||[]});fs[_0x52e8('0x60')]('/etc/asterisk/turn_xcally.conf',_0x15e896);return respondWithRpcPromise(_0x52e8('0x61'),_0x52e8('0x31'),{'module':'res_stun_monitor.so'});}else{var _0x2ac514=fs['readFileSync'](path['join'](config[_0x52e8('0x64')],'server/files/templates/network.ejs'),_0x52e8('0x5e'));var _0x960546=ejs[_0x52e8('0x5f')](_0x2ac514,{'networks':_0x3c656c||[]});fs[_0x52e8('0x60')](util[_0x52e8('0x67')](_0x52e8('0x68'),_0x12657a[_0x52e8('0x58')][_0x52e8('0x38')]['toLowerCase']()),_0x960546);return respondWithRpcPromise(_0x52e8('0x61'),'destroy',{'module':'chan_sip.so'});}return null;})[_0x52e8('0x23')](handleError(_0x581519,null));}; \ No newline at end of file +var _0xa60a=['where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','params','Network','find','transaction','create','body','toUpperCase','STUN','readFileSync','join','utf8','render','writeFileSync','/etc/asterisk/stun_xcally.conf','TURN','root','server/files/templates/turn_multiple.ejs','/etc/asterisk/turn_xcally.conf','Reload','res_stun_monitor.so','server/files/templates/network.ejs','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','chan_sip.so','sequelize','server/files/templates/stun_multiple.ejs','update','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','lodash','squel','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','client','http','request','then','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xa60a,0x90));var _0xaa60=function(_0x5d3f04,_0x9badb9){_0x5d3f04=_0x5d3f04-0x0;var _0x54f951=_0xa60a[_0x5d3f04];return _0x54f951;};'use strict';var emlformat=require(_0xaa60('0x0'));var rimraf=require(_0xaa60('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xaa60('0x2'));var moment=require(_0xaa60('0x3'));var BPromise=require(_0xaa60('0x4'));var Mustache=require(_0xaa60('0x5'));var util=require(_0xaa60('0x6'));var path=require(_0xaa60('0x7'));var sox=require(_0xaa60('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xaa60('0x9'));var squel=require(_0xaa60('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xaa60('0xb'));var toCsv=require('to-csv');var querystring=require(_0xaa60('0xc'));var Papa=require('papaparse');var Redis=require(_0xaa60('0xd'));var authService=require(_0xaa60('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xaa60('0xf'));var hardwareService=require(_0xaa60('0x10'));var logger=require(_0xaa60('0x11'))('api');var utils=require('../../config/utils');var config=require(_0xaa60('0x12'));var licenseUtil=require(_0xaa60('0x13'));var db=require(_0xaa60('0x14'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xaa60('0x15')][_0xaa60('0x16')]({'port':0x232a});function respondWithRpcPromise(_0x5b4e09,_0x32dc9f,_0x1e94a6,_0x4ca55c){return new BPromise(function(_0x2066bc,_0x1887b9){var _0x4428e2=_0x4ca55c||client;return _0x4428e2[_0xaa60('0x17')](_0x5b4e09,_0x1e94a6)[_0xaa60('0x18')](function(_0x1900b4){logger['info'](_0xaa60('0x19'),_0x32dc9f,_0xaa60('0x1a'));logger[_0xaa60('0x1b')](_0xaa60('0x1c'),_0x32dc9f,_0xaa60('0x1a'),JSON[_0xaa60('0x1d')](_0x1900b4));if(_0x1900b4[_0xaa60('0x1e')]){if(_0x1900b4['error'][_0xaa60('0x1f')]===0x1f4){logger[_0xaa60('0x1e')](_0xaa60('0x19'),_0x32dc9f,_0x1900b4[_0xaa60('0x1e')]['message']);return _0x1887b9(_0x1900b4[_0xaa60('0x1e')][_0xaa60('0x20')]);}logger['error'](_0xaa60('0x19'),_0x32dc9f,_0x1900b4['error']['message']);return _0x2066bc(_0x1900b4[_0xaa60('0x1e')]['message']);}else{logger['info'](_0xaa60('0x19'),_0x32dc9f,_0xaa60('0x1a'));_0x2066bc(_0x1900b4['result']['message']);}})[_0xaa60('0x21')](function(_0x16a90a){logger[_0xaa60('0x1e')](_0xaa60('0x19'),_0x32dc9f,_0x16a90a);_0x1887b9(_0x16a90a);});});}function respondWithStatusCode(_0x55bd0e,_0x23f125){_0x23f125=_0x23f125||0xcc;return function(_0x2282a1){if(_0x2282a1){return _0x55bd0e[_0xaa60('0x22')](_0x23f125);}return _0x55bd0e[_0xaa60('0x23')](_0x23f125)[_0xaa60('0x24')]();};}function respondWithResult(_0x43844c,_0x481716){_0x481716=_0x481716||0xc8;return function(_0x549c03){if(_0x549c03){return _0x43844c[_0xaa60('0x23')](_0x481716)['json'](_0x549c03);}};}function respondWithFilteredResult(_0x4c9ace,_0x5a67bd){return function(_0x5ead90){if(_0x5ead90){var _0x5caf24=typeof _0x5a67bd[_0xaa60('0x25')]===_0xaa60('0x26')&&typeof _0x5a67bd[_0xaa60('0x27')]===_0xaa60('0x26');var _0x182f28=_0x5ead90[_0xaa60('0x28')];var _0x1ea7d2=_0x5caf24?0x0:_0x5a67bd[_0xaa60('0x25')];var _0x1c71ad=_0x5caf24?_0x5ead90['count']:_0x5a67bd[_0xaa60('0x25')]+_0x5a67bd['limit'];var _0x43d5ea;if(_0x1c71ad>=_0x182f28){_0x1c71ad=_0x182f28;_0x43d5ea=0xc8;}else{_0x43d5ea=0xce;}_0x4c9ace[_0xaa60('0x23')](_0x43d5ea);return _0x4c9ace[_0xaa60('0x29')](_0xaa60('0x2a'),_0x1ea7d2+'-'+_0x1c71ad+'/'+_0x182f28)['json'](_0x5ead90);}return null;};}function patchUpdates(_0x1275cc){return function(_0x57e400){try{jsonpatch[_0xaa60('0x2b')](_0x57e400,_0x1275cc,!![]);}catch(_0x346eec){return BPromise[_0xaa60('0x2c')](_0x346eec);}return _0x57e400[_0xaa60('0x2d')]();};}function saveUpdates(_0x5a45de,_0xb0ec54){return function(_0x2ed23b){if(_0x2ed23b){return _0x2ed23b['update'](_0x5a45de)[_0xaa60('0x18')](function(_0x3927d0){return _0x3927d0;});}return null;};}function removeEntity(_0x5b4990,_0x55c3dd){return function(_0x540842){if(_0x540842){return _0x540842[_0xaa60('0x2e')]()[_0xaa60('0x18')](function(){_0x5b4990[_0xaa60('0x23')](0xcc)[_0xaa60('0x24')]();});}};}function handleEntityNotFound(_0x40233f,_0x38f240){return function(_0x507461){if(!_0x507461){_0x40233f[_0xaa60('0x22')](0x194);}return _0x507461;};}function handleError(_0x3b97a7,_0x4f323d){_0x4f323d=_0x4f323d||0x1f4;return function(_0x4e2491){logger[_0xaa60('0x1e')](_0x4e2491[_0xaa60('0x2f')]);if(_0x4e2491[_0xaa60('0x30')]){delete _0x4e2491[_0xaa60('0x30')];}_0x3b97a7[_0xaa60('0x23')](_0x4f323d)[_0xaa60('0x31')](_0x4e2491);};}exports[_0xaa60('0x32')]=function(_0x487309,_0xfa2c7){var _0x3efe06={},_0x50f520={},_0x20bd72={'count':0x0,'rows':[]};var _0x3bd2f4=_[_0xaa60('0x33')](db['Network'][_0xaa60('0x34')],function(_0x39f53f){return{'name':_0x39f53f[_0xaa60('0x35')],'type':_0x39f53f[_0xaa60('0x36')][_0xaa60('0x37')]};});_0x50f520[_0xaa60('0x38')]=_[_0xaa60('0x33')](_0x3bd2f4,_0xaa60('0x30'));_0x50f520[_0xaa60('0x39')]=_[_0xaa60('0x3a')](_0x487309['query']);_0x50f520[_0xaa60('0x3b')]=_['intersection'](_0x50f520[_0xaa60('0x38')],_0x50f520[_0xaa60('0x39')]);_0x3efe06[_0xaa60('0x3c')]=_[_0xaa60('0x3d')](_0x50f520[_0xaa60('0x38')],qs['fields'](_0x487309['query'][_0xaa60('0x3e')]));_0x3efe06[_0xaa60('0x3c')]=_0x3efe06[_0xaa60('0x3c')][_0xaa60('0x3f')]?_0x3efe06[_0xaa60('0x3c')]:_0x50f520[_0xaa60('0x38')];if(!_0x487309['query'][_0xaa60('0x40')](_0xaa60('0x41'))){_0x3efe06['limit']=qs[_0xaa60('0x27')](_0x487309[_0xaa60('0x39')]['limit']);_0x3efe06[_0xaa60('0x25')]=qs[_0xaa60('0x25')](_0x487309['query']['offset']);}_0x3efe06[_0xaa60('0x42')]=qs[_0xaa60('0x43')](_0x487309[_0xaa60('0x39')][_0xaa60('0x43')]);_0x3efe06[_0xaa60('0x44')]=qs['filters'](_[_0xaa60('0x45')](_0x487309[_0xaa60('0x39')],_0x50f520[_0xaa60('0x3b')]),_0x3bd2f4);if(_0x487309[_0xaa60('0x39')][_0xaa60('0x46')]){_0x3efe06['where']=_[_0xaa60('0x47')](_0x3efe06['where'],{'$or':_[_0xaa60('0x33')](_0x3bd2f4,function(_0x2e25db){if(_0x2e25db[_0xaa60('0x36')]!==_0xaa60('0x48')){var _0x47493d={};_0x47493d[_0x2e25db[_0xaa60('0x30')]]={'$like':'%'+_0x487309[_0xaa60('0x39')][_0xaa60('0x46')]+'%'};return _0x47493d;}})});}_0x3efe06=_[_0xaa60('0x47')]({},_0x3efe06,_0x487309[_0xaa60('0x49')]);var _0x1cb68a={'where':_0x3efe06['where']};return db['Network'][_0xaa60('0x28')](_0x1cb68a)[_0xaa60('0x18')](function(_0x3d099e){_0x20bd72[_0xaa60('0x28')]=_0x3d099e;if(_0x487309[_0xaa60('0x39')][_0xaa60('0x4a')]){_0x3efe06[_0xaa60('0x4b')]=[{'all':!![]}];}return db['Network'][_0xaa60('0x4c')](_0x3efe06);})[_0xaa60('0x18')](function(_0xd3bcbe){_0x20bd72['rows']=_0xd3bcbe;return _0x20bd72;})[_0xaa60('0x18')](respondWithFilteredResult(_0xfa2c7,_0x3efe06))['catch'](handleError(_0xfa2c7,null));};exports[_0xaa60('0x4d')]=function(_0x4b8f22,_0x1f26f9){var _0x149bbf={'raw':!![],'where':{'id':_0x4b8f22[_0xaa60('0x4e')]['id']}},_0x4713ee={};_0x4713ee['model']=_['keys'](db[_0xaa60('0x4f')]['rawAttributes']);_0x4713ee['query']=_[_0xaa60('0x3a')](_0x4b8f22[_0xaa60('0x39')]);_0x4713ee[_0xaa60('0x3b')]=_[_0xaa60('0x3d')](_0x4713ee['model'],_0x4713ee['query']);_0x149bbf[_0xaa60('0x3c')]=_[_0xaa60('0x3d')](_0x4713ee[_0xaa60('0x38')],qs[_0xaa60('0x3e')](_0x4b8f22['query'][_0xaa60('0x3e')]));_0x149bbf[_0xaa60('0x3c')]=_0x149bbf[_0xaa60('0x3c')]['length']?_0x149bbf[_0xaa60('0x3c')]:_0x4713ee[_0xaa60('0x38')];if(_0x4b8f22[_0xaa60('0x39')][_0xaa60('0x4a')]){_0x149bbf[_0xaa60('0x4b')]=[{'all':!![]}];}_0x149bbf=_[_0xaa60('0x47')]({},_0x149bbf,_0x4b8f22['options']);return db[_0xaa60('0x4f')][_0xaa60('0x50')](_0x149bbf)[_0xaa60('0x18')](handleEntityNotFound(_0x1f26f9,null))[_0xaa60('0x18')](respondWithResult(_0x1f26f9,null))['catch'](handleError(_0x1f26f9,null));};exports['create']=function(_0x48965a,_0x586c00,_0x374a87){var _0x4266f0;return db['sequelize'][_0xaa60('0x51')](function(_0x4b3852){return db[_0xaa60('0x4f')][_0xaa60('0x52')](_0x48965a[_0xaa60('0x53')],{'raw':!![]})[_0xaa60('0x18')](function(_0x3598d3){_0x4266f0=_0x3598d3;return db[_0xaa60('0x4f')][_0xaa60('0x4c')]({'where':{'type':_0x48965a[_0xaa60('0x53')][_0xaa60('0x36')]},'raw':!![]});})[_0xaa60('0x18')](function(_0x2b8119){if(_0x4266f0['type'][_0xaa60('0x54')]()==_0xaa60('0x55')){var _0x56f903=fs[_0xaa60('0x56')](path[_0xaa60('0x57')](config['root'],'server/files/templates/stun_multiple.ejs'),_0xaa60('0x58'));var _0x40ea6f=ejs[_0xaa60('0x59')](_0x56f903,{'networks':_0x2b8119||[]});fs[_0xaa60('0x5a')](_0xaa60('0x5b'),_0x40ea6f);return respondWithRpcPromise('Reload',_0xaa60('0x52'),{'module':'res_stun_monitor.so'});}else if(_0x4266f0['type'][_0xaa60('0x54')]()==_0xaa60('0x5c')){var _0xad055=fs[_0xaa60('0x56')](path[_0xaa60('0x57')](config[_0xaa60('0x5d')],_0xaa60('0x5e')),_0xaa60('0x58'));var _0xef2243=ejs[_0xaa60('0x59')](_0xad055,{'networks':_0x2b8119||[]});fs['writeFileSync'](_0xaa60('0x5f'),_0xef2243);return respondWithRpcPromise(_0xaa60('0x60'),_0xaa60('0x52'),{'module':_0xaa60('0x61')});}else{var _0x5beb7b=fs[_0xaa60('0x56')](path[_0xaa60('0x57')](config[_0xaa60('0x5d')],_0xaa60('0x62')),_0xaa60('0x58'));var _0x2d5abb=ejs[_0xaa60('0x59')](_0x5beb7b,{'networks':_0x2b8119||[]});fs[_0xaa60('0x5a')](util[_0xaa60('0x63')](_0xaa60('0x64'),_0x48965a[_0xaa60('0x53')][_0xaa60('0x36')][_0xaa60('0x65')]()),_0x2d5abb);return respondWithRpcPromise(_0xaa60('0x60'),_0xaa60('0x52'),{'module':_0xaa60('0x66')});}return null;})[_0xaa60('0x18')](function(){return _0x4266f0;});})[_0xaa60('0x18')](respondWithResult(_0x586c00,0xc9))[_0xaa60('0x21')](handleError(_0x586c00,null));};exports['update']=function(_0xbb6dc,_0x1e60dc,_0x2d6cb5){var _0x340aa9;return db[_0xaa60('0x67')][_0xaa60('0x51')](function(_0x63ba6a){return db[_0xaa60('0x4f')][_0xaa60('0x50')]({'where':{'id':_0xbb6dc[_0xaa60('0x4e')]['id']}})['then'](handleEntityNotFound(_0x1e60dc,null))[_0xaa60('0x18')](saveUpdates(_0xbb6dc['body'],null))[_0xaa60('0x18')](function(_0x5869a0){if(_0x5869a0){_0x340aa9=_0x5869a0;return db[_0xaa60('0x4f')][_0xaa60('0x4c')]({'where':{'type':_0x340aa9[_0xaa60('0x36')]},'raw':!![]});}return null;})[_0xaa60('0x18')](function(_0x48ddf9){if(_0x340aa9[_0xaa60('0x36')][_0xaa60('0x54')]()=='STUN'){var _0x25be03=fs['readFileSync'](path[_0xaa60('0x57')](config['root'],_0xaa60('0x68')),_0xaa60('0x58'));var _0x407f06=ejs[_0xaa60('0x59')](_0x25be03,{'networks':_0x48ddf9||[]});fs[_0xaa60('0x5a')](_0xaa60('0x5b'),_0x407f06);return respondWithRpcPromise(_0xaa60('0x60'),'update',{'module':'res_stun_monitor.so'});}else if(_0x340aa9['type'][_0xaa60('0x54')]()==_0xaa60('0x5c')){var _0x4dcc26=fs[_0xaa60('0x56')](path[_0xaa60('0x57')](config[_0xaa60('0x5d')],_0xaa60('0x5e')),_0xaa60('0x58'));var _0x254da1=ejs[_0xaa60('0x59')](_0x4dcc26,{'networks':_0x48ddf9||[]});fs[_0xaa60('0x5a')](_0xaa60('0x5f'),_0x254da1);return respondWithRpcPromise(_0xaa60('0x60'),_0xaa60('0x69'),{'module':_0xaa60('0x61')});}else{var _0x2d53d6=fs[_0xaa60('0x56')](path[_0xaa60('0x57')](config['root'],_0xaa60('0x62')),'utf8');var _0x4e9ce0=ejs[_0xaa60('0x59')](_0x2d53d6,{'networks':_0x48ddf9||[]});fs[_0xaa60('0x5a')](util[_0xaa60('0x63')]('/etc/asterisk/sip_xcally_%s.conf',_0xbb6dc['body'][_0xaa60('0x36')][_0xaa60('0x65')]()),_0x4e9ce0);return respondWithRpcPromise(_0xaa60('0x60'),_0xaa60('0x69'),{'module':_0xaa60('0x66')});}return null;})['then'](function(_0x58ffad){if(_0x58ffad){return _0x340aa9;}return null;});})[_0xaa60('0x18')](respondWithResult(_0x1e60dc,null))[_0xaa60('0x21')](handleError(_0x1e60dc,null));};exports['destroy']=function(_0x120301,_0x4fca6a,_0x551fa1){var _0x509db4;return db[_0xaa60('0x4f')]['find']({'where':{'id':_0x120301[_0xaa60('0x4e')]['id']}})[_0xaa60('0x18')](function(_0x4af353){_0x509db4=_0x4af353;return _0x4af353;})[_0xaa60('0x18')](handleEntityNotFound(_0x4fca6a,null))['then'](removeEntity(_0x4fca6a,null))[_0xaa60('0x18')](function(){if(_0x509db4){return db[_0xaa60('0x4f')][_0xaa60('0x4c')]({'where':{'type':_0x509db4[_0xaa60('0x36')]},'raw':!![]});}})[_0xaa60('0x18')](function(_0x1d40c9){if(_0x509db4[_0xaa60('0x36')][_0xaa60('0x54')]()==_0xaa60('0x55')){var _0x2f6ba0=fs[_0xaa60('0x56')](path[_0xaa60('0x57')](config[_0xaa60('0x5d')],_0xaa60('0x68')),'utf8');var _0x46058a=ejs[_0xaa60('0x59')](_0x2f6ba0,{'networks':_0x1d40c9||[]});fs[_0xaa60('0x5a')]('/etc/asterisk/stun_xcally.conf',_0x46058a);return respondWithRpcPromise(_0xaa60('0x60'),_0xaa60('0x2e'),{'module':'res_stun_monitor.so'});}else if(_0x509db4[_0xaa60('0x36')][_0xaa60('0x54')]()==_0xaa60('0x5c')){var _0x349210=fs[_0xaa60('0x56')](path[_0xaa60('0x57')](config[_0xaa60('0x5d')],'server/files/templates/turn_multiple.ejs'),_0xaa60('0x58'));var _0x3444d4=ejs[_0xaa60('0x59')](_0x349210,{'networks':_0x1d40c9||[]});fs[_0xaa60('0x5a')](_0xaa60('0x5f'),_0x3444d4);return respondWithRpcPromise(_0xaa60('0x60'),'destroy',{'module':_0xaa60('0x61')});}else{var _0x4b729d=fs[_0xaa60('0x56')](path[_0xaa60('0x57')](config['root'],'server/files/templates/network.ejs'),'utf8');var _0x15f74e=ejs[_0xaa60('0x59')](_0x4b729d,{'networks':_0x1d40c9||[]});fs[_0xaa60('0x5a')](util[_0xaa60('0x63')](_0xaa60('0x64'),_0x120301[_0xaa60('0x53')][_0xaa60('0x36')][_0xaa60('0x65')]()),_0x15f74e);return respondWithRpcPromise(_0xaa60('0x60'),_0xaa60('0x2e'),{'module':'chan_sip.so'});}return null;})[_0xaa60('0x21')](handleError(_0x4fca6a,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index 2ddd327..f6d5fd1 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 _0x68fc=['bluebird','path','./network.attributes','exports','network','lodash','util','../../config/logger'];(function(_0x2a955f,_0x1a754a){var _0x31d436=function(_0x2f5708){while(--_0x2f5708){_0x2a955f['push'](_0x2a955f['shift']());}};_0x31d436(++_0x1a754a);}(_0x68fc,0xa5));var _0xc68f=function(_0x243e1e,_0x5c75ea){_0x243e1e=_0x243e1e-0x0;var _0x3a7cea=_0x68fc[_0x243e1e];return _0x3a7cea;};'use strict';var _=require(_0xc68f('0x0'));var util=require(_0xc68f('0x1'));var logger=require(_0xc68f('0x2'))('api');var moment=require('moment');var BPromise=require(_0xc68f('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc68f('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xc68f('0x5'));module[_0xc68f('0x6')]=function(_0x1c6df9,_0x363cdf){return _0x1c6df9['define']('Network',attributes,{'tableName':_0xc68f('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5ec6=['network','lodash','util','../../config/logger','moment','request-promise','rimraf','./network.attributes','Network'];(function(_0xc2fc17,_0x2b78be){var _0x5b4fe0=function(_0x5f1e00){while(--_0x5f1e00){_0xc2fc17['push'](_0xc2fc17['shift']());}};_0x5b4fe0(++_0x2b78be);}(_0x5ec6,0x7f));var _0x65ec=function(_0x31ecc1,_0x3c40c1){_0x31ecc1=_0x31ecc1-0x0;var _0x5ad6df=_0x5ec6[_0x31ecc1];return _0x5ad6df;};'use strict';var _=require(_0x65ec('0x0'));var util=require(_0x65ec('0x1'));var logger=require(_0x65ec('0x2'))('api');var moment=require(_0x65ec('0x3'));var BPromise=require('bluebird');var rp=require(_0x65ec('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x65ec('0x5'));var config=require('../../config/environment');var attributes=require(_0x65ec('0x6'));module['exports']=function(_0x2fc973,_0xbb2e56){return _0x2fc973['define'](_0x65ec('0x7'),attributes,{'tableName':_0x65ec('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 fcf753a..e01d7d9 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(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x7a54,0x106));var _0x47a5=function(_0x545cfc,_0x2606b7){_0x545cfc=_0x545cfc-0x0;var _0x1728ba=_0x7a54[_0x545cfc];return _0x1728ba;};'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(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x7a54,0x106));var _0x47a5=function(_0xa17154,_0x3ca502){_0xa17154=_0xa17154-0x0;var _0xc996c8=_0x7a54[_0xa17154];return _0xc996c8;};'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 751a20f..77ea704 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 _0x49f5=['addAgents','/:id/send','put','destroy','delete','removeDispositions','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./openchannelAccount.controller','get','isAuthenticated','index','describe','/:id','show','getDispositions','getAnswers','/:id/applications','/:id/interactions','getInteractions','/:id/users','getAgents','post','create','/:id/dispositions','addDisposition','/:id/canned_answers','addAnswer','/:id/notify','notify','addApplications'];(function(_0x5939e5,_0x39efd3){var _0x38e919=function(_0x59f2bd){while(--_0x59f2bd){_0x5939e5['push'](_0x5939e5['shift']());}};_0x38e919(++_0x39efd3);}(_0x49f5,0x80));var _0x549f=function(_0x158dd7,_0x1f5f90){_0x158dd7=_0x158dd7-0x0;var _0x1772ba=_0x49f5[_0x158dd7];return _0x1772ba;};'use strict';var multer=require(_0x549f('0x0'));var util=require(_0x549f('0x1'));var path=require(_0x549f('0x2'));var timeout=require(_0x549f('0x3'));var express=require(_0x549f('0x4'));var router=express[_0x549f('0x5')]();var fs_extra=require(_0x549f('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x549f('0x7'));var config=require(_0x549f('0x8'));var controller=require(_0x549f('0x9'));router[_0x549f('0xa')]('/',auth[_0x549f('0xb')](),controller[_0x549f('0xc')]);router[_0x549f('0xa')]('/describe',auth[_0x549f('0xb')](),controller[_0x549f('0xd')]);router[_0x549f('0xa')](_0x549f('0xe'),auth[_0x549f('0xb')](),controller[_0x549f('0xf')]);router[_0x549f('0xa')]('/:id/dispositions',auth[_0x549f('0xb')](),controller[_0x549f('0x10')]);router[_0x549f('0xa')]('/:id/canned_answers',auth[_0x549f('0xb')](),controller[_0x549f('0x11')]);router[_0x549f('0xa')](_0x549f('0x12'),auth[_0x549f('0xb')](),controller['getApplications']);router['get'](_0x549f('0x13'),auth[_0x549f('0xb')](),controller[_0x549f('0x14')]);router[_0x549f('0xa')](_0x549f('0x15'),auth[_0x549f('0xb')](),controller[_0x549f('0x16')]);router[_0x549f('0x17')]('/',auth['isAuthenticated'](),controller[_0x549f('0x18')]);router[_0x549f('0x17')](_0x549f('0x19'),auth[_0x549f('0xb')](),controller[_0x549f('0x1a')]);router[_0x549f('0x17')](_0x549f('0x1b'),auth[_0x549f('0xb')](),controller[_0x549f('0x1c')]);router[_0x549f('0x17')](_0x549f('0x1d'),controller[_0x549f('0x1e')]);router[_0x549f('0x17')]('/:id/applications',auth[_0x549f('0xb')](),controller[_0x549f('0x1f')]);router[_0x549f('0x17')](_0x549f('0x15'),auth[_0x549f('0xb')](),controller[_0x549f('0x20')]);router[_0x549f('0x17')](_0x549f('0x21'),auth['isAuthenticated'](),controller['send']);router[_0x549f('0x22')](_0x549f('0xe'),auth[_0x549f('0xb')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x549f('0x23')]);router[_0x549f('0x24')](_0x549f('0x19'),auth['isAuthenticated'](),controller[_0x549f('0x25')]);router[_0x549f('0x24')](_0x549f('0x1b'),auth[_0x549f('0xb')](),controller['removeAnswers']);router[_0x549f('0x24')](_0x549f('0x15'),auth[_0x549f('0xb')](),controller[_0x549f('0x26')]);module[_0x549f('0x27')]=router; \ No newline at end of file +var _0x77ab=['/:id/interactions','/:id/users','getAgents','post','create','addDisposition','/:id/canned_answers','addAnswer','/:id/notify','notify','/:id/send','put','/:id','delete','destroy','/:id/dispositions','removeAgents','multer','util','express','Router','fs-extra','../../components/interaction/service','get','isAuthenticated','/describe','describe','getAnswers','/:id/applications','getApplications'];(function(_0x19ea12,_0x39f26b){var _0x61eb8a=function(_0x5564c3){while(--_0x5564c3){_0x19ea12['push'](_0x19ea12['shift']());}};_0x61eb8a(++_0x39f26b);}(_0x77ab,0xc5));var _0xb77a=function(_0x59fbea,_0x4b9f3b){_0x59fbea=_0x59fbea-0x0;var _0x1d5809=_0x77ab[_0x59fbea];return _0x1d5809;};'use strict';var multer=require(_0xb77a('0x0'));var util=require(_0xb77a('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xb77a('0x2'));var router=express[_0xb77a('0x3')]();var fs_extra=require(_0xb77a('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xb77a('0x5'));var config=require('../../config/environment');var controller=require('./openchannelAccount.controller');router[_0xb77a('0x6')]('/',auth[_0xb77a('0x7')](),controller['index']);router[_0xb77a('0x6')](_0xb77a('0x8'),auth[_0xb77a('0x7')](),controller[_0xb77a('0x9')]);router[_0xb77a('0x6')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xb77a('0x6')]('/:id/dispositions',auth[_0xb77a('0x7')](),controller['getDispositions']);router['get']('/:id/canned_answers',auth[_0xb77a('0x7')](),controller[_0xb77a('0xa')]);router[_0xb77a('0x6')](_0xb77a('0xb'),auth[_0xb77a('0x7')](),controller[_0xb77a('0xc')]);router[_0xb77a('0x6')](_0xb77a('0xd'),auth[_0xb77a('0x7')](),controller['getInteractions']);router[_0xb77a('0x6')](_0xb77a('0xe'),auth[_0xb77a('0x7')](),controller[_0xb77a('0xf')]);router[_0xb77a('0x10')]('/',auth['isAuthenticated'](),controller[_0xb77a('0x11')]);router[_0xb77a('0x10')]('/:id/dispositions',auth[_0xb77a('0x7')](),controller[_0xb77a('0x12')]);router[_0xb77a('0x10')](_0xb77a('0x13'),auth[_0xb77a('0x7')](),controller[_0xb77a('0x14')]);router[_0xb77a('0x10')](_0xb77a('0x15'),controller[_0xb77a('0x16')]);router[_0xb77a('0x10')](_0xb77a('0xb'),auth['isAuthenticated'](),controller['addApplications']);router[_0xb77a('0x10')]('/:id/users',auth['isAuthenticated'](),controller['addAgents']);router[_0xb77a('0x10')](_0xb77a('0x17'),auth[_0xb77a('0x7')](),controller['send']);router[_0xb77a('0x18')](_0xb77a('0x19'),auth[_0xb77a('0x7')](),controller['update']);router[_0xb77a('0x1a')](_0xb77a('0x19'),auth[_0xb77a('0x7')](),controller[_0xb77a('0x1b')]);router[_0xb77a('0x1a')](_0xb77a('0x1c'),auth[_0xb77a('0x7')](),controller['removeDispositions']);router[_0xb77a('0x1a')](_0xb77a('0x13'),auth['isAuthenticated'](),controller['removeAnswers']);router[_0xb77a('0x1a')]('/:id/users',auth[_0xb77a('0x7')](),controller[_0xb77a('0x1d')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index d16825f..39e085d 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 _0x6832=['BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','STRING','name','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}'];(function(_0x2c7618,_0x26be9c){var _0x5ce3f0=function(_0x1837b3){while(--_0x1837b3){_0x2c7618['push'](_0x2c7618['shift']());}};_0x5ce3f0(++_0x26be9c);}(_0x6832,0xe4));var _0x2683=function(_0x14faf4,_0x41c2ed){_0x14faf4=_0x14faf4-0x0;var _0x52c71d=_0x6832[_0x14faf4];return _0x52c71d;};'use strict';var Sequelize=require(_0x2683('0x0'));var rs=require(_0x2683('0x1'));module[_0x2683('0x2')]={'name':{'type':Sequelize[_0x2683('0x3')],'unique':_0x2683('0x4'),'allowNull':![]},'description':{'type':Sequelize[_0x2683('0x3')]},'token':{'type':Sequelize[_0x2683('0x3')],'defaultValue':function(){return rs['generate']();}},'replyUri':{'type':Sequelize[_0x2683('0x3')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x2683('0x3')],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x2683('0x5');}},'notificationSound':{'type':Sequelize[_0x2683('0x6')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x2683('0x6')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x2683('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x2683('0x3')]},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x2683('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x2683('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x2683('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x2683('0x7')],'allowNull':!![],'defaultValue':null,'comment':_0x2683('0x8')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x2683('0x9'),'set':function(_0x2466d3){if(!_0x2466d3)this[_0x2683('0xa')](_0x2683('0xb'),null);this[_0x2683('0xa')](_0x2683('0xc'),_0x2466d3);}}}; \ No newline at end of file +var _0x318c=['BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','STRING','name','generate','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}'];(function(_0x4beb42,_0x3066df){var _0x198c48=function(_0x4837fb){while(--_0x4837fb){_0x4beb42['push'](_0x4beb42['shift']());}};_0x198c48(++_0x3066df);}(_0x318c,0x12c));var _0xc318=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x318c[_0x1facfa];return _0x9ec701;};'use strict';var Sequelize=require(_0xc318('0x0'));var rs=require(_0xc318('0x1'));module[_0xc318('0x2')]={'name':{'type':Sequelize[_0xc318('0x3')],'unique':_0xc318('0x4'),'allowNull':![]},'description':{'type':Sequelize[_0xc318('0x3')]},'token':{'type':Sequelize[_0xc318('0x3')],'defaultValue':function(){return rs[_0xc318('0x5')]();}},'replyUri':{'type':Sequelize[_0xc318('0x3')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0xc318('0x3')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xc318('0x6')],'defaultValue':function(){return _0xc318('0x7');}},'notificationSound':{'type':Sequelize[_0xc318('0x8')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xc318('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0xc318('0x3')]},'queueTransfer':{'type':Sequelize[_0xc318('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xc318('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xc318('0x9')],'allowNull':!![],'defaultValue':null,'comment':_0xc318('0xa')},'mandatoryDisposition':{'type':Sequelize[_0xc318('0x8')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x1a288f){if(!_0x1a288f)this[_0xc318('0xb')](_0xc318('0xc'),null);this[_0xc318('0xb')](_0xc318('0xd'),_0x1a288f);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index fc66649..40c0e6a 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 _0x4e61=['OpenchannelAccounts','UserProfileResource','sendStatus','stack','name','send','index','mandatoryDispositionPause','map','OpenchannelAccount','fieldName','key','model','query','filters','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','show','params','Pause','rawAttributes','keys','intersection','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','find','describe','addDisposition','Disposition','getDispositions','length','OpenchannelAccountId','rows','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','removeAnswers','notify','openchannel','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','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','CmList','List','DESC','account','applications','Applications','orderBy','priority','asc','Contacts','defaults','ListId','firstName','threadId','externalUrl','ContactId','spread','contact','lastName','messageId','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','Start','startRouting','EventManager','addApplications','sequelize','OpenchannelApplication','bulkCreate','findAndCountAll','getApplications','Contact','Owner','fullname','internal','Tag','Tags','color','tag','addAgents','omit','removeAgents','isArray','userOpenchannelAccount:remove','emit','getAgents','OpenchannelInteraction','Messages','dataValues','eml-format','rimraf','zip-dir','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','../../mysqldb','redis','localhost','socket.io-emitter','./openchannelAccount.socket','register','jayson/promise','client','http','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','get'];(function(_0x3a0605,_0x2679b3){var _0x2f0d52=function(_0x3f5bab){while(--_0x3f5bab){_0x3a0605['push'](_0x3a0605['shift']());}};_0x2f0d52(++_0x2679b3);}(_0x4e61,0x8c));var _0x14e6=function(_0xa8f776,_0x420cbf){_0xa8f776=_0xa8f776-0x0;var _0x435961=_0x4e61[_0xa8f776];return _0x435961;};'use strict';var emlformat=require(_0x14e6('0x0'));var rimraf=require(_0x14e6('0x1'));var zipdir=require(_0x14e6('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x14e6('0x3'));var BPromise=require(_0x14e6('0x4'));var Mustache=require(_0x14e6('0x5'));var util=require(_0x14e6('0x6'));var path=require(_0x14e6('0x7'));var sox=require(_0x14e6('0x8'));var csv=require(_0x14e6('0x9'));var ejs=require(_0x14e6('0xa'));var fs=require('fs');var fs_extra=require(_0x14e6('0xb'));var _=require(_0x14e6('0xc'));var squel=require(_0x14e6('0xd'));var crypto=require(_0x14e6('0xe'));var jsforce=require(_0x14e6('0xf'));var deskjs=require(_0x14e6('0x10'));var toCsv=require(_0x14e6('0x9'));var querystring=require(_0x14e6('0x11'));var Papa=require(_0x14e6('0x12'));var Redis=require(_0x14e6('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x14e6('0x14'));var as=require(_0x14e6('0x15'));var hardwareService=require(_0x14e6('0x16'));var logger=require(_0x14e6('0x17'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x14e6('0x18'))['db'];config['redis']=_['defaults'](config[_0x14e6('0x19')],{'host':_0x14e6('0x1a'),'port':0x18eb});var socket=require(_0x14e6('0x1b'))(new Redis(config['redis']));require(_0x14e6('0x1c'))[_0x14e6('0x1d')](socket);var jayson=require(_0x14e6('0x1e'));var client=jayson[_0x14e6('0x1f')][_0x14e6('0x20')]({'port':0x232c});var client9002=jayson['client'][_0x14e6('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x353910,_0x753064,_0x3e46c0,_0x41dc78){return new BPromise(function(_0x4d6d42,_0x34aec2){var _0x48160f=_0x41dc78||client;return _0x48160f['request'](_0x353910,_0x3e46c0)['then'](function(_0x12fc87){logger[_0x14e6('0x21')](_0x14e6('0x22'),_0x753064,_0x14e6('0x23'));logger['debug']('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x753064,_0x14e6('0x23'),JSON[_0x14e6('0x24')](_0x12fc87));if(_0x12fc87[_0x14e6('0x25')]){if(_0x12fc87[_0x14e6('0x25')][_0x14e6('0x26')]===0x1f4){logger[_0x14e6('0x25')](_0x14e6('0x22'),_0x753064,_0x12fc87[_0x14e6('0x25')][_0x14e6('0x27')]);return _0x34aec2(_0x12fc87[_0x14e6('0x25')][_0x14e6('0x27')]);}logger[_0x14e6('0x25')](_0x14e6('0x22'),_0x753064,_0x12fc87[_0x14e6('0x25')][_0x14e6('0x27')]);return _0x4d6d42(_0x12fc87[_0x14e6('0x25')][_0x14e6('0x27')]);}else{logger[_0x14e6('0x21')](_0x14e6('0x22'),_0x753064,_0x14e6('0x23'));_0x4d6d42(_0x12fc87[_0x14e6('0x28')]['message']);}})[_0x14e6('0x29')](function(_0x2a3807){logger[_0x14e6('0x25')](_0x14e6('0x22'),_0x753064,_0x2a3807);_0x34aec2(_0x2a3807);});});}function respondWithStatusCode(_0x33b28c,_0xb53f12){_0xb53f12=_0xb53f12||0xcc;return function(_0x477833){if(_0x477833){return _0x33b28c['sendStatus'](_0xb53f12);}return _0x33b28c[_0x14e6('0x2a')](_0xb53f12)['end']();};}function respondWithResult(_0x593980,_0x57a504){_0x57a504=_0x57a504||0xc8;return function(_0x3b5b43){if(_0x3b5b43){return _0x593980['status'](_0x57a504)[_0x14e6('0x2b')](_0x3b5b43);}};}function respondWithFilteredResult(_0x1aef5d,_0x2b7336){return function(_0x5c6a39){if(_0x5c6a39){var _0x3395b1=typeof _0x2b7336[_0x14e6('0x2c')]===_0x14e6('0x2d')&&typeof _0x2b7336['limit']===_0x14e6('0x2d');var _0x1e718a=_0x5c6a39[_0x14e6('0x2e')];var _0x46863c=_0x3395b1?0x0:_0x2b7336['offset'];var _0x1290b4=_0x3395b1?_0x5c6a39['count']:_0x2b7336[_0x14e6('0x2c')]+_0x2b7336[_0x14e6('0x2f')];var _0x52dafa;if(_0x1290b4>=_0x1e718a){_0x1290b4=_0x1e718a;_0x52dafa=0xc8;}else{_0x52dafa=0xce;}_0x1aef5d[_0x14e6('0x2a')](_0x52dafa);return _0x1aef5d[_0x14e6('0x30')](_0x14e6('0x31'),_0x46863c+'-'+_0x1290b4+'/'+_0x1e718a)[_0x14e6('0x2b')](_0x5c6a39);}return null;};}function patchUpdates(_0x55484b){return function(_0x14b18a){try{jsonpatch[_0x14e6('0x32')](_0x14b18a,_0x55484b,!![]);}catch(_0x2ff3b3){return BPromise[_0x14e6('0x33')](_0x2ff3b3);}return _0x14b18a[_0x14e6('0x34')]();};}function saveUpdates(_0xbfbbc5,_0x2b901f){return function(_0x4b2678){if(_0x4b2678){return _0x4b2678[_0x14e6('0x35')](_0xbfbbc5)[_0x14e6('0x36')](function(_0x2da6d4){return _0x2da6d4;});}return null;};}function removeEntity(_0x1e504e,_0x47ecac){return function(_0x26bfee){if(_0x26bfee){return _0x26bfee[_0x14e6('0x37')]()[_0x14e6('0x36')](function(){var _0xe07746=_0x26bfee[_0x14e6('0x38')]({'plain':!![]});var _0xc2e484=_0x14e6('0x39');return db[_0x14e6('0x3a')][_0x14e6('0x37')]({'where':{'type':_0xc2e484,'resourceId':_0xe07746['id']}})[_0x14e6('0x36')](function(){return _0x26bfee;});})[_0x14e6('0x36')](function(){_0x1e504e[_0x14e6('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1fdfa4,_0x1f92e){return function(_0x21bd5c){if(!_0x21bd5c){_0x1fdfa4[_0x14e6('0x3b')](0x194);}return _0x21bd5c;};}function handleError(_0x2bc334,_0x101175){_0x101175=_0x101175||0x1f4;return function(_0xac6d78){logger[_0x14e6('0x25')](_0xac6d78[_0x14e6('0x3c')]);if(_0xac6d78[_0x14e6('0x3d')]){delete _0xac6d78[_0x14e6('0x3d')];}_0x2bc334[_0x14e6('0x2a')](_0x101175)[_0x14e6('0x3e')](_0xac6d78);};}exports[_0x14e6('0x3f')]=function(_0x168c94,_0x46a52a){var _0x33a1f1={'include':[{'model':db['Pause'],'as':_0x14e6('0x40')}]},_0x5ee11a={},_0x2c8231={'count':0x0,'rows':[]};var _0x2de142=_[_0x14e6('0x41')](db[_0x14e6('0x42')]['rawAttributes'],function(_0x3a0d9b){return{'name':_0x3a0d9b[_0x14e6('0x43')],'type':_0x3a0d9b['type'][_0x14e6('0x44')]};});_0x5ee11a[_0x14e6('0x45')]=_[_0x14e6('0x41')](_0x2de142,_0x14e6('0x3d'));_0x5ee11a[_0x14e6('0x46')]=_['keys'](_0x168c94[_0x14e6('0x46')]);_0x5ee11a[_0x14e6('0x47')]=_['intersection'](_0x5ee11a[_0x14e6('0x45')],_0x5ee11a[_0x14e6('0x46')]);_0x33a1f1[_0x14e6('0x48')]=_['intersection'](_0x5ee11a['model'],qs[_0x14e6('0x49')](_0x168c94[_0x14e6('0x46')][_0x14e6('0x49')]));_0x33a1f1[_0x14e6('0x48')]=_0x33a1f1[_0x14e6('0x48')]['length']?_0x33a1f1['attributes']:_0x5ee11a['model'];if(!_0x168c94[_0x14e6('0x46')][_0x14e6('0x4a')](_0x14e6('0x4b'))){_0x33a1f1[_0x14e6('0x2f')]=qs[_0x14e6('0x2f')](_0x168c94[_0x14e6('0x46')][_0x14e6('0x2f')]);_0x33a1f1[_0x14e6('0x2c')]=qs[_0x14e6('0x2c')](_0x168c94[_0x14e6('0x46')]['offset']);}_0x33a1f1[_0x14e6('0x4c')]=qs[_0x14e6('0x4d')](_0x168c94['query'][_0x14e6('0x4d')]);_0x33a1f1[_0x14e6('0x4e')]=qs['filters'](_[_0x14e6('0x4f')](_0x168c94[_0x14e6('0x46')],_0x5ee11a[_0x14e6('0x47')]),_0x2de142);if(_0x168c94['query']['filter']){_0x33a1f1[_0x14e6('0x4e')]=_[_0x14e6('0x50')](_0x33a1f1[_0x14e6('0x4e')],{'$or':_[_0x14e6('0x41')](_0x2de142,function(_0x4a3b9c){if(_0x4a3b9c[_0x14e6('0x51')]!==_0x14e6('0x52')){var _0x1fb769={};_0x1fb769[_0x4a3b9c['name']]={'$like':'%'+_0x168c94[_0x14e6('0x46')][_0x14e6('0x53')]+'%'};return _0x1fb769;}})});}_0x33a1f1=_[_0x14e6('0x50')]({},_0x33a1f1,_0x168c94[_0x14e6('0x54')]);var _0x4b26f5={'where':_0x33a1f1[_0x14e6('0x4e')]};return db['OpenchannelAccount']['count'](_0x4b26f5)[_0x14e6('0x36')](function(_0x2e9072){_0x2c8231[_0x14e6('0x2e')]=_0x2e9072;if(_0x168c94[_0x14e6('0x46')][_0x14e6('0x55')]){_0x33a1f1[_0x14e6('0x56')]=[{'all':!![]}];}return db[_0x14e6('0x42')][_0x14e6('0x57')](_0x33a1f1);})[_0x14e6('0x36')](function(_0x2ccd96){_0x2c8231['rows']=_0x2ccd96;return _0x2c8231;})['then'](respondWithFilteredResult(_0x46a52a,_0x33a1f1))['catch'](handleError(_0x46a52a,null));};exports[_0x14e6('0x58')]=function(_0x272019,_0x5949ca){var _0x52ad6f={'raw':![],'where':{'id':_0x272019[_0x14e6('0x59')]['id']},'include':[{'model':db[_0x14e6('0x5a')],'as':_0x14e6('0x40')}]},_0x31cb98={};_0x31cb98[_0x14e6('0x45')]=_['keys'](db[_0x14e6('0x42')][_0x14e6('0x5b')]);_0x31cb98[_0x14e6('0x46')]=_[_0x14e6('0x5c')](_0x272019['query']);_0x31cb98['filters']=_[_0x14e6('0x5d')](_0x31cb98[_0x14e6('0x45')],_0x31cb98['query']);_0x52ad6f[_0x14e6('0x48')]=_['intersection'](_0x31cb98[_0x14e6('0x45')],qs[_0x14e6('0x49')](_0x272019['query'][_0x14e6('0x49')]));_0x52ad6f['attributes']=_0x52ad6f[_0x14e6('0x48')]['length']?_0x52ad6f['attributes']:_0x31cb98[_0x14e6('0x45')];if(_0x272019[_0x14e6('0x46')][_0x14e6('0x55')]){_0x52ad6f['include']=[{'all':!![]}];}_0x52ad6f=_[_0x14e6('0x50')]({},_0x52ad6f,_0x272019[_0x14e6('0x54')]);return db['OpenchannelAccount']['find'](_0x52ad6f)[_0x14e6('0x36')](handleEntityNotFound(_0x5949ca,null))['then'](respondWithResult(_0x5949ca,null))[_0x14e6('0x29')](handleError(_0x5949ca,null));};exports[_0x14e6('0x5e')]=function(_0x30413c,_0x1d9fc1){return db[_0x14e6('0x42')][_0x14e6('0x5e')](_0x30413c['body'],{})[_0x14e6('0x36')](function(_0x8151){var _0x4825b8=_0x30413c[_0x14e6('0x5f')][_0x14e6('0x38')]({'plain':!![]});if(!_0x4825b8)throw new Error(_0x14e6('0x60'));if(_0x4825b8[_0x14e6('0x61')]===_0x14e6('0x5f')){var _0x104d06=_0x8151['get']({'plain':!![]});var _0x1cb51e=_0x14e6('0x39');return db[_0x14e6('0x62')]['find']({'where':{'name':_0x1cb51e,'userProfileId':_0x4825b8[_0x14e6('0x63')]},'raw':!![]})[_0x14e6('0x36')](function(_0x3cdca4){if(_0x3cdca4&&_0x3cdca4[_0x14e6('0x64')]===0x0){return db[_0x14e6('0x3a')][_0x14e6('0x5e')]({'name':_0x104d06[_0x14e6('0x3d')],'resourceId':_0x104d06['id'],'type':_0x3cdca4[_0x14e6('0x3d')],'sectionId':_0x3cdca4['id']},{})[_0x14e6('0x36')](function(){return _0x8151;});}else{return _0x8151;}})['catch'](function(_0x871a5e){logger[_0x14e6('0x25')](_0x14e6('0x65'),_0x871a5e);throw _0x871a5e;});}return _0x8151;})[_0x14e6('0x36')](respondWithResult(_0x1d9fc1,0xc9))['catch'](handleError(_0x1d9fc1,null));};exports[_0x14e6('0x35')]=function(_0x230070,_0xee492b){if(_0x230070[_0x14e6('0x66')]['id']){delete _0x230070[_0x14e6('0x66')]['id'];}return db[_0x14e6('0x42')]['find']({'where':{'id':_0x230070[_0x14e6('0x59')]['id']},'include':[{'model':db[_0x14e6('0x5a')],'as':'mandatoryDispositionPause'}]})[_0x14e6('0x36')](handleEntityNotFound(_0xee492b,null))['then'](saveUpdates(_0x230070['body'],null))[_0x14e6('0x36')](respondWithResult(_0xee492b,null))[_0x14e6('0x29')](handleError(_0xee492b,null));};exports[_0x14e6('0x37')]=function(_0x2daf92,_0x113597){return db[_0x14e6('0x42')][_0x14e6('0x67')]({'where':{'id':_0x2daf92[_0x14e6('0x59')]['id']}})[_0x14e6('0x36')](handleEntityNotFound(_0x113597,null))[_0x14e6('0x36')](removeEntity(_0x113597,null))[_0x14e6('0x29')](handleError(_0x113597,null));};exports[_0x14e6('0x68')]=function(_0x315d8e,_0x4b1ea7){return db[_0x14e6('0x42')]['describe']()[_0x14e6('0x36')](respondWithResult(_0x4b1ea7,null))[_0x14e6('0x29')](handleError(_0x4b1ea7,null));};exports[_0x14e6('0x69')]=function(_0x3146e1,_0x396b7d,_0x5aaf54){if(_0x3146e1[_0x14e6('0x66')]['id']){delete _0x3146e1[_0x14e6('0x66')]['id'];}return db[_0x14e6('0x42')][_0x14e6('0x67')]({'where':{'id':_0x3146e1[_0x14e6('0x59')]['id']}})[_0x14e6('0x36')](handleEntityNotFound(_0x396b7d,null))[_0x14e6('0x36')](function(_0xa92578){if(_0xa92578){_0x3146e1['body']['OpenchannelAccountId']=_0xa92578['id'];return db[_0x14e6('0x6a')][_0x14e6('0x5e')](_0x3146e1[_0x14e6('0x66')]);}})[_0x14e6('0x36')](respondWithResult(_0x396b7d,null))[_0x14e6('0x29')](handleError(_0x396b7d,null));};exports[_0x14e6('0x6b')]=function(_0x414bb4,_0x1131c9,_0x54932c){var _0x4a3bd9={'raw':![],'where':{}};var _0xecf62a={};var _0x93ed06={'count':0x0,'rows':[]};return db[_0x14e6('0x42')]['findOne']({'where':{'id':_0x414bb4[_0x14e6('0x59')]['id']}})[_0x14e6('0x36')](handleEntityNotFound(_0x1131c9,null))[_0x14e6('0x36')](function(_0x491a3a){if(_0x491a3a){_0xecf62a[_0x14e6('0x45')]=_[_0x14e6('0x5c')](db[_0x14e6('0x6a')][_0x14e6('0x5b')]);_0xecf62a['query']=_['keys'](_0x414bb4[_0x14e6('0x46')]);_0xecf62a['filters']=_[_0x14e6('0x5d')](_0xecf62a[_0x14e6('0x45')],_0xecf62a['query']);_0x4a3bd9[_0x14e6('0x48')]=_['intersection'](_0xecf62a[_0x14e6('0x45')],qs[_0x14e6('0x49')](_0x414bb4[_0x14e6('0x46')][_0x14e6('0x49')]));_0x4a3bd9[_0x14e6('0x48')]=_0x4a3bd9[_0x14e6('0x48')][_0x14e6('0x6c')]?_0x4a3bd9['attributes']:_0xecf62a[_0x14e6('0x45')];if(!_0x414bb4[_0x14e6('0x46')]['hasOwnProperty'](_0x14e6('0x4b'))){_0x4a3bd9[_0x14e6('0x2f')]=qs['limit'](_0x414bb4[_0x14e6('0x46')][_0x14e6('0x2f')]);_0x4a3bd9['offset']=qs[_0x14e6('0x2c')](_0x414bb4['query'][_0x14e6('0x2c')]);}_0x4a3bd9[_0x14e6('0x4c')]=qs[_0x14e6('0x4d')](_0x414bb4[_0x14e6('0x46')]['sort']);_0x4a3bd9[_0x14e6('0x4e')]=qs['filters'](_[_0x14e6('0x4f')](_0x414bb4[_0x14e6('0x46')],_0xecf62a[_0x14e6('0x47')]));_0x4a3bd9[_0x14e6('0x4e')][_0x14e6('0x6d')]=_0x491a3a['id'];if(_0x414bb4[_0x14e6('0x46')][_0x14e6('0x53')]){_0x4a3bd9[_0x14e6('0x4e')]=_[_0x14e6('0x50')](_0x4a3bd9['where'],{'$or':_[_0x14e6('0x41')](_0x4a3bd9[_0x14e6('0x48')],function(_0x281d76){var _0x2a0b00={};_0x2a0b00[_0x281d76]={'$like':'%'+_0x414bb4[_0x14e6('0x46')][_0x14e6('0x53')]+'%'};return _0x2a0b00;})});}_0x4a3bd9=_['merge']({},_0x4a3bd9,_0x414bb4['options']);return db[_0x14e6('0x6a')][_0x14e6('0x2e')]({'where':_0x4a3bd9[_0x14e6('0x4e')]})[_0x14e6('0x36')](function(_0x14470c){_0x93ed06[_0x14e6('0x2e')]=_0x14470c;if(_0x414bb4[_0x14e6('0x46')][_0x14e6('0x55')]){_0x4a3bd9['include']=[{'all':!![]}];}return db[_0x14e6('0x6a')][_0x14e6('0x57')](_0x4a3bd9);})[_0x14e6('0x36')](function(_0x1cf513){_0x93ed06[_0x14e6('0x6e')]=_0x1cf513;return _0x93ed06;});}})[_0x14e6('0x36')](respondWithFilteredResult(_0x1131c9,_0x4a3bd9))['catch'](handleError(_0x1131c9,null));};exports[_0x14e6('0x6f')]=function(_0x1f00a1,_0x18e336,_0x31d123){return db[_0x14e6('0x42')]['find']({'where':{'id':_0x1f00a1[_0x14e6('0x59')]['id']}})[_0x14e6('0x36')](handleEntityNotFound(_0x18e336,null))['then'](function(_0x19bef8){if(_0x19bef8){return _0x19bef8[_0x14e6('0x6f')](_0x1f00a1['query'][_0x14e6('0x70')]);}})[_0x14e6('0x36')](respondWithStatusCode(_0x18e336,null))['catch'](handleError(_0x18e336,null));};exports[_0x14e6('0x71')]=function(_0x55b430,_0xc2431a,_0x17b8de){if(_0x55b430[_0x14e6('0x66')]['id']){delete _0x55b430[_0x14e6('0x66')]['id'];}return db[_0x14e6('0x42')][_0x14e6('0x67')]({'where':{'id':_0x55b430[_0x14e6('0x59')]['id']}})['then'](handleEntityNotFound(_0xc2431a,null))[_0x14e6('0x36')](function(_0x135046){if(_0x135046){_0x55b430['body'][_0x14e6('0x6d')]=_0x135046['id'];return db[_0x14e6('0x72')]['create'](_0x55b430[_0x14e6('0x66')]);}})[_0x14e6('0x36')](respondWithResult(_0xc2431a,null))[_0x14e6('0x29')](handleError(_0xc2431a,null));};exports[_0x14e6('0x73')]=function(_0x592162,_0x49c037,_0x371f04){var _0x396a08={'raw':![],'where':{}};var _0x63a7bf={};var _0x3f0878={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0x14e6('0x74')]({'where':{'id':_0x592162[_0x14e6('0x59')]['id']}})[_0x14e6('0x36')](handleEntityNotFound(_0x49c037,null))[_0x14e6('0x36')](function(_0xab7ff3){if(_0xab7ff3){_0x63a7bf[_0x14e6('0x45')]=_[_0x14e6('0x5c')](db[_0x14e6('0x72')][_0x14e6('0x5b')]);_0x63a7bf[_0x14e6('0x46')]=_['keys'](_0x592162[_0x14e6('0x46')]);_0x63a7bf[_0x14e6('0x47')]=_['intersection'](_0x63a7bf['model'],_0x63a7bf['query']);_0x396a08[_0x14e6('0x48')]=_['intersection'](_0x63a7bf[_0x14e6('0x45')],qs[_0x14e6('0x49')](_0x592162[_0x14e6('0x46')][_0x14e6('0x49')]));_0x396a08[_0x14e6('0x48')]=_0x396a08[_0x14e6('0x48')]['length']?_0x396a08[_0x14e6('0x48')]:_0x63a7bf[_0x14e6('0x45')];if(!_0x592162[_0x14e6('0x46')][_0x14e6('0x4a')](_0x14e6('0x4b'))){_0x396a08[_0x14e6('0x2f')]=qs['limit'](_0x592162[_0x14e6('0x46')][_0x14e6('0x2f')]);_0x396a08[_0x14e6('0x2c')]=qs[_0x14e6('0x2c')](_0x592162[_0x14e6('0x46')][_0x14e6('0x2c')]);}_0x396a08[_0x14e6('0x4c')]=qs['sort'](_0x592162[_0x14e6('0x46')][_0x14e6('0x4d')]);_0x396a08[_0x14e6('0x4e')]=qs['filters'](_[_0x14e6('0x4f')](_0x592162[_0x14e6('0x46')],_0x63a7bf[_0x14e6('0x47')]));_0x396a08[_0x14e6('0x4e')][_0x14e6('0x6d')]=_0xab7ff3['id'];if(_0x592162[_0x14e6('0x46')]['filter']){_0x396a08[_0x14e6('0x4e')]=_[_0x14e6('0x50')](_0x396a08['where'],{'$or':_[_0x14e6('0x41')](_0x396a08[_0x14e6('0x48')],function(_0x1aa519){var _0x39e9a0={};_0x39e9a0[_0x1aa519]={'$like':'%'+_0x592162[_0x14e6('0x46')]['filter']+'%'};return _0x39e9a0;})});}_0x396a08=_[_0x14e6('0x50')]({},_0x396a08,_0x592162['options']);return db[_0x14e6('0x72')][_0x14e6('0x2e')]({'where':_0x396a08[_0x14e6('0x4e')]})[_0x14e6('0x36')](function(_0x1ccf9e){_0x3f0878[_0x14e6('0x2e')]=_0x1ccf9e;if(_0x592162[_0x14e6('0x46')][_0x14e6('0x55')]){_0x396a08[_0x14e6('0x56')]=[{'all':!![]}];}return db[_0x14e6('0x72')][_0x14e6('0x57')](_0x396a08);})['then'](function(_0x461ee3){_0x3f0878[_0x14e6('0x6e')]=_0x461ee3;return _0x3f0878;});}})[_0x14e6('0x36')](respondWithFilteredResult(_0x49c037,_0x396a08))[_0x14e6('0x29')](handleError(_0x49c037,null));};exports[_0x14e6('0x75')]=function(_0x5f5c85,_0x42cc9d,_0x1bb412){return db[_0x14e6('0x42')][_0x14e6('0x67')]({'where':{'id':_0x5f5c85['params']['id']}})[_0x14e6('0x36')](handleEntityNotFound(_0x42cc9d,null))[_0x14e6('0x36')](function(_0x339d23){if(_0x339d23){return _0x339d23[_0x14e6('0x75')](_0x5f5c85[_0x14e6('0x46')][_0x14e6('0x70')]);}})['then'](respondWithStatusCode(_0x42cc9d,null))['catch'](handleError(_0x42cc9d,null));};exports[_0x14e6('0x76')]=function(_0x31cff1,_0xd37e07,_0x24051){var _0x3a3b53={'body':_0x31cff1[_0x14e6('0x66')],'channel':_0x14e6('0x77')};var _0x5ed306=[];var _0x512c05=[];var _0x30dcac={};var _0x5adf7b=![];return db[_0x14e6('0x78')][_0x14e6('0x68')]()[_0x14e6('0x36')](function(_0xb695a5){if(!_0xb695a5){throw new db[(_0x14e6('0x79'))][(_0x14e6('0x7a'))](_0x14e6('0x7b'));}_0x5ed306=_[_0x14e6('0x7c')](_['keys'](_0xb695a5),[_0x14e6('0x7d'),'updatedAt']);_0x512c05=_[_0x14e6('0x7c')](_[_0x14e6('0x5c')](_0xb695a5),[_0x14e6('0x7d'),_0x14e6('0x7e'),_0x14e6('0x7f'),'ListId']);if(_0x31cff1['body']['id']){delete _0x31cff1[_0x14e6('0x66')]['id'];}if(_['isNil'](_0x31cff1['body'][_0x14e6('0x80')])){throw new db['Sequelize'][(_0x14e6('0x7a'))](_0x14e6('0x81'));}if(_[_0x14e6('0x82')](_0x31cff1[_0x14e6('0x66')][_0x14e6('0x66')])||_0x31cff1[_0x14e6('0x66')][_0x14e6('0x66')]===''){throw new db[(_0x14e6('0x79'))][(_0x14e6('0x7a'))](_0x14e6('0x83'));}if(_['isNil'](_0x31cff1[_0x14e6('0x66')][_0x14e6('0x84')])){throw new db[(_0x14e6('0x79'))][(_0x14e6('0x7a'))](_0x14e6('0x85')+_0x512c05);}if(!_[_0x14e6('0x86')](_0x512c05,_0x31cff1[_0x14e6('0x66')][_0x14e6('0x84')])){throw new db[(_0x14e6('0x79'))]['ValidationError'](_0x14e6('0x87')+_0x512c05);}_0x30dcac[_0x31cff1['body'][_0x14e6('0x84')]]=_0x31cff1[_0x14e6('0x66')][_0x14e6('0x80')];})['then'](function(){return db[_0x14e6('0x42')][_0x14e6('0x67')]({'where':{'id':_0x31cff1['params']['id']},'include':[{'model':db[_0x14e6('0x88')],'as':_0x14e6('0x89'),'include':[{'model':db['CmContact'],'as':'Contacts','where':_0x30dcac,'limit':0x1,'order':[[_0x14e6('0x7e'),_0x14e6('0x8a')]]}]},{'model':db['OpenchannelApplication'],'as':'Applications'}]});})[_0x14e6('0x36')](handleEntityNotFound(_0xd37e07,null))[_0x14e6('0x36')](function(_0x5a9631){if(_0x5a9631&&_0x5a9631[_0x14e6('0x89')]){_0x3a3b53[_0x14e6('0x8b')]=_0x5a9631;_0x3a3b53[_0x14e6('0x8c')]=_0x5a9631[_0x14e6('0x8d')];_0x3a3b53['list']=_0x5a9631[_0x14e6('0x89')];_0x3a3b53[_0x14e6('0x8c')]=_[_0x14e6('0x8e')](_0x3a3b53[_0x14e6('0x8c')],[_0x14e6('0x8f')],[_0x14e6('0x90')]);if(_0x3a3b53[_0x14e6('0x8b')][_0x14e6('0x8d')]){delete _0x3a3b53['account']['Applications'];}if(_0x3a3b53[_0x14e6('0x8b')][_0x14e6('0x89')]&&_0x3a3b53['account'][_0x14e6('0x89')][_0x14e6('0x91')][_0x14e6('0x6c')]){return _0x3a3b53[_0x14e6('0x8b')][_0x14e6('0x89')][_0x14e6('0x91')][0x0];}var _0x2821f5=_[_0x14e6('0x92')](_0x31cff1[_0x14e6('0x66')],{'firstName':_0x31cff1['body'][_0x14e6('0x80')],'ListId':_0x5a9631[_0x14e6('0x93')]});_0x2821f5[_0x31cff1['body'][_0x14e6('0x84')]]=_0x31cff1[_0x14e6('0x66')][_0x14e6('0x80')];return db[_0x14e6('0x78')][_0x14e6('0x5e')](_0x2821f5,{'fields':_0x5ed306,'raw':!![]});}})[_0x14e6('0x36')](handleEntityNotFound(_0xd37e07,null))[_0x14e6('0x36')](function(_0x222415){_0x3a3b53['contact']=_0x222415;if(_0x222415){var _0x410898={'ContactId':_0x222415['id'],'OpenchannelAccountId':_0x31cff1[_0x14e6('0x59')]['id'],'from':(_0x222415[_0x14e6('0x94')]||'')+'\x20'+(_0x222415['lastName']||'')};var _0x1f82a8={'OpenchannelAccountId':_0x31cff1[_0x14e6('0x59')]['id'],'closed':![]};if(_0x31cff1['body'][_0x14e6('0x95')]){_0x1f82a8[_0x14e6('0x95')]=_0x31cff1['body'][_0x14e6('0x95')];return db['OpenchannelInteraction']['find']({'where':_0x1f82a8})[_0x14e6('0x36')](function(_0x18ca8e){if(_0x18ca8e){return[_0x18ca8e,![]];}_0x410898[_0x14e6('0x95')]=_0x31cff1[_0x14e6('0x66')][_0x14e6('0x95')];_0x410898[_0x14e6('0x96')]=_0x31cff1[_0x14e6('0x66')][_0x14e6('0x96')];return db['OpenchannelInteraction'][_0x14e6('0x5e')](_0x410898)['then'](function(_0x211527){return[_0x211527,!![]];});});}else{_0x1f82a8[_0x14e6('0x95')]=null;}_0x1f82a8[_0x14e6('0x97')]=_0x222415['id'];return db['OpenchannelInteraction']['find']({'where':_0x1f82a8})[_0x14e6('0x36')](function(_0x5241e2){if(_0x5241e2){return[_0x5241e2,![]];}return db['OpenchannelInteraction'][_0x14e6('0x5e')](_0x410898)['then'](function(_0x1bc66a){return[_0x1bc66a,!![]];});});}})[_0x14e6('0x98')](function(_0x54aa8d,_0xbf7038){if(_0x54aa8d){_0x5adf7b=_0xbf7038;if(!_0xbf7038){var _0x3e2c3a={'from':(_0x3a3b53[_0x14e6('0x99')][_0x14e6('0x94')]||'')+'\x20'+(_0x3a3b53[_0x14e6('0x99')][_0x14e6('0x9a')]||'')};if(_0x31cff1['body'][_0x14e6('0x95')]&&_0x31cff1[_0x14e6('0x66')][_0x14e6('0x9b')]&&_0x31cff1[_0x14e6('0x66')][_0x14e6('0x95')]!=_0x31cff1[_0x14e6('0x66')][_0x14e6('0x9b')]){_0x3e2c3a[_0x14e6('0x95')]=_0x31cff1['body'][_0x14e6('0x9b')];}return _0x54aa8d[_0x14e6('0x35')](_0x3e2c3a);}else{return _0x54aa8d;}}})[_0x14e6('0x36')](function(_0x564ad8){_0x3a3b53[_0x14e6('0x9c')]=_0x564ad8['get']({'plain':!![]});_0x3a3b53['interaction']['created']=_0x5adf7b;if(_0x3a3b53[_0x14e6('0x9c')][_0x14e6('0x9d')]){if(_0x3a3b53[_0x14e6('0x8b')][_0x14e6('0x9e')]){_0x3a3b53[_0x14e6('0x8c')][_0x14e6('0x9f')]({'id':0x0,'priority':_0x3a3b53[_0x14e6('0x8c')][_0x14e6('0x6c')]+0x1,'app':_0x14e6('0xa0'),'appdata':_0x14e6('0xa1'),'interval':_0x14e6('0xa2')});}}return db[_0x14e6('0xa3')]['create']({'body':_0x31cff1[_0x14e6('0x66')][_0x14e6('0x66')],'OpenchannelAccountId':_0x31cff1[_0x14e6('0x59')]['id'],'OpenchannelInteractionId':_0x564ad8['id'],'direction':'in','ContactId':_0x3a3b53[_0x14e6('0x99')]['id'],'AttachmentId':_0x31cff1['body'][_0x14e6('0xa4')]});})[_0x14e6('0x36')](function(_0x245c73){_0x3a3b53[_0x14e6('0x27')]=_0x245c73;if(_0x3a3b53[_0x14e6('0x9c')][_0x14e6('0xa5')]){return db[_0x14e6('0xa6')][_0x14e6('0x67')]({'attributes':['id',_0x14e6('0x3d')],'where':{'id':_0x3a3b53[_0x14e6('0x9c')][_0x14e6('0xa5')]}})['then'](function(_0x32d8d7){if(_0x32d8d7){_0x3a3b53[_0x14e6('0x8c')][_0x14e6('0xa7')]({'id':0x0,'priority':0x0,'app':_0x14e6('0xa8'),'appdata':_0x32d8d7[_0x14e6('0x3d')]+','+(_0x3a3b53['account'][_0x14e6('0xa9')]||0xa),'interval':_0x14e6('0xa2')});_0x3a3b53['forcedOwnership']=![];}return respondWithRpcPromise(_0x14e6('0xaa'),_0x14e6('0xab'),_0x3a3b53);});}return respondWithRpcPromise(_0x14e6('0xaa'),_0x14e6('0xab'),_0x3a3b53);})['then'](function(_0x3c6036){respondWithRpcPromise(_0x14e6('0xac'),_0x14e6('0xac'),{'event':_0x14e6('0x76'),'message':_0x3c6036},client9002);return _0x3c6036;})[_0x14e6('0x36')](respondWithResult(_0xd37e07,null))[_0x14e6('0x29')](handleError(_0xd37e07,null));};exports[_0x14e6('0xad')]=function(_0x5e080,_0x305091,_0x3c150b){return db[_0x14e6('0x42')][_0x14e6('0x74')]({'where':{'id':_0x5e080[_0x14e6('0x59')]['id']}})[_0x14e6('0x36')](handleEntityNotFound(_0x305091,null))[_0x14e6('0x36')](function(_0x228ef9){if(_0x228ef9){return db[_0x14e6('0xae')]['transaction'](function(_0x2b170b){return db['OpenchannelApplication'][_0x14e6('0x37')]({'where':{'OpenchannelAccountId':_0x5e080[_0x14e6('0x59')]['id']},'transaction':_0x2b170b})[_0x14e6('0x36')](function(_0x563434){var _0x31e3f2=_['map'](_0x5e080[_0x14e6('0x66')],function(_0x5b36aa){_0x5b36aa['OpenchannelAccountId']=_0x5e080['params']['id'];return _0x5b36aa;});return db[_0x14e6('0xaf')][_0x14e6('0xb0')](_0x31e3f2,{'transaction':_0x2b170b});});})[_0x14e6('0x36')](function(){return db['OpenchannelApplication'][_0x14e6('0xb1')]({'where':{'OpenchannelAccountId':_0x5e080[_0x14e6('0x59')]['id']},'order':_0x14e6('0x8f')});});}})[_0x14e6('0x36')](respondWithResult(_0x305091,null))[_0x14e6('0x29')](handleError(_0x305091,null));};exports[_0x14e6('0xb2')]=function(_0x23f338,_0x570db1,_0x4880b3){var _0x38100f={};var _0x3fb564={};var _0x7a7105;var _0x23a05f;return db[_0x14e6('0x42')]['findOne']({'where':{'id':_0x23f338['params']['id']}})['then'](handleEntityNotFound(_0x570db1,null))[_0x14e6('0x36')](function(_0x194e50){if(_0x194e50){_0x7a7105=_0x194e50;_0x3fb564[_0x14e6('0x45')]=_[_0x14e6('0x5c')](db['OpenchannelApplication'][_0x14e6('0x5b')]);_0x3fb564['query']=_[_0x14e6('0x5c')](_0x23f338[_0x14e6('0x46')]);_0x3fb564[_0x14e6('0x47')]=_[_0x14e6('0x5d')](_0x3fb564[_0x14e6('0x45')],_0x3fb564[_0x14e6('0x46')]);_0x38100f['attributes']=_[_0x14e6('0x5d')](_0x3fb564[_0x14e6('0x45')],qs[_0x14e6('0x49')](_0x23f338[_0x14e6('0x46')][_0x14e6('0x49')]));_0x38100f[_0x14e6('0x48')]=_0x38100f[_0x14e6('0x48')][_0x14e6('0x6c')]?_0x38100f[_0x14e6('0x48')]:_0x3fb564[_0x14e6('0x45')];_0x38100f['order']=qs[_0x14e6('0x4d')](_0x23f338[_0x14e6('0x46')][_0x14e6('0x4d')]);_0x38100f[_0x14e6('0x4e')]=qs['filters'](_['pick'](_0x23f338['query'],_0x3fb564['filters']));if(_0x23f338[_0x14e6('0x46')][_0x14e6('0x53')]){_0x38100f[_0x14e6('0x4e')]=_['merge'](_0x38100f[_0x14e6('0x4e')],{'$or':_[_0x14e6('0x41')](_0x38100f[_0x14e6('0x48')],function(_0x584734){var _0x2b897a={};_0x2b897a[_0x584734]={'$like':'%'+_0x23f338['query']['filter']+'%'};return _0x2b897a;})});}_0x38100f=_['merge']({},_0x38100f,_0x23f338[_0x14e6('0x54')]);return _0x7a7105['getApplications'](_0x38100f);}})[_0x14e6('0x36')](function(_0x491596){if(_0x491596){_0x23a05f=_0x491596[_0x14e6('0x6c')];if(!_0x23f338[_0x14e6('0x46')]['hasOwnProperty'](_0x14e6('0x4b'))){_0x38100f['limit']=qs[_0x14e6('0x2f')](_0x23f338[_0x14e6('0x46')][_0x14e6('0x2f')]);_0x38100f['offset']=qs[_0x14e6('0x2c')](_0x23f338[_0x14e6('0x46')][_0x14e6('0x2c')]);}return _0x7a7105[_0x14e6('0xb2')](_0x38100f);}})[_0x14e6('0x36')](function(_0xa6a942){if(_0xa6a942){return _0xa6a942?{'count':_0x23a05f,'rows':_0xa6a942}:null;}})[_0x14e6('0x36')](respondWithResult(_0x570db1,null))[_0x14e6('0x29')](handleError(_0x570db1,null));};exports['getInteractions']=function(_0x49c9ec,_0x204eec,_0x30a375){var _0x505873={'raw':![],'where':{}};var _0x24586a={};var _0x165c69={'count':0x0,'rows':[]};return db[_0x14e6('0x42')]['findOne']({'where':{'id':_0x49c9ec[_0x14e6('0x59')]['id']}})['then'](handleEntityNotFound(_0x204eec,null))[_0x14e6('0x36')](function(_0x16f5b3){if(_0x16f5b3){_0x24586a[_0x14e6('0x45')]=_[_0x14e6('0x5c')](db['OpenchannelInteraction'][_0x14e6('0x5b')]);_0x24586a[_0x14e6('0x46')]=_[_0x14e6('0x5c')](_0x49c9ec[_0x14e6('0x46')]);_0x24586a['filters']=_[_0x14e6('0x5d')](_0x24586a[_0x14e6('0x45')],_0x24586a['query']);_0x505873[_0x14e6('0x48')]=_[_0x14e6('0x5d')](_0x24586a[_0x14e6('0x45')],qs[_0x14e6('0x49')](_0x49c9ec[_0x14e6('0x46')][_0x14e6('0x49')]));_0x505873[_0x14e6('0x48')]=_0x505873[_0x14e6('0x48')][_0x14e6('0x6c')]?_0x505873['attributes']:_0x24586a[_0x14e6('0x45')];if(!_0x49c9ec['query'][_0x14e6('0x4a')](_0x14e6('0x4b'))){_0x505873['limit']=qs[_0x14e6('0x2f')](_0x49c9ec['query'][_0x14e6('0x2f')]);_0x505873[_0x14e6('0x2c')]=qs[_0x14e6('0x2c')](_0x49c9ec['query'][_0x14e6('0x2c')]);}_0x505873[_0x14e6('0x4c')]=qs['sort'](_0x49c9ec[_0x14e6('0x46')]['sort']);_0x505873[_0x14e6('0x4e')]=qs['filters'](_['pick'](_0x49c9ec[_0x14e6('0x46')],_0x24586a[_0x14e6('0x47')]));_0x505873[_0x14e6('0x4e')]['OpenchannelAccountId']=_0x16f5b3['id'];if(_0x49c9ec[_0x14e6('0x46')][_0x14e6('0x53')]){_0x505873[_0x14e6('0x4e')]=_[_0x14e6('0x50')](_0x505873[_0x14e6('0x4e')],{'$or':_[_0x14e6('0x41')](_0x505873[_0x14e6('0x48')],function(_0x4cf96a){var _0x56093d={};_0x56093d[_0x4cf96a]={'$like':'%'+_0x49c9ec[_0x14e6('0x46')][_0x14e6('0x53')]+'%'};return _0x56093d;})});}_0x505873=_[_0x14e6('0x50')]({},_0x505873,_0x49c9ec[_0x14e6('0x54')]);return db['OpenchannelInteraction'][_0x14e6('0x2e')]({'where':_0x505873[_0x14e6('0x4e')]})[_0x14e6('0x36')](function(_0x14acff){_0x165c69[_0x14e6('0x2e')]=_0x14acff;if(_0x49c9ec[_0x14e6('0x46')][_0x14e6('0x55')]){_0x505873[_0x14e6('0x56')]=[{'model':db[_0x14e6('0x78')],'as':_0x14e6('0xb3'),'required':![]},{'model':db['User'],'as':_0x14e6('0xb4'),'attributes':[_0x14e6('0x3d'),_0x14e6('0xb5'),_0x14e6('0xb6')],'required':![]},{'model':db[_0x14e6('0xb7')],'as':_0x14e6('0xb8'),'attributes':['id',_0x14e6('0x3d'),_0x14e6('0xb9')],'where':_0x49c9ec[_0x14e6('0x46')][_0x14e6('0xba')]?{'id':_0x49c9ec[_0x14e6('0x46')]['tag']}:undefined,'required':_0x49c9ec[_0x14e6('0x46')]['tag']?!![]:![]}];}return db['OpenchannelInteraction'][_0x14e6('0x57')](_0x505873);})[_0x14e6('0x36')](function(_0x365447){_0x165c69[_0x14e6('0x6e')]=_0x365447;return _0x165c69;});}})[_0x14e6('0x36')](respondWithFilteredResult(_0x204eec,_0x505873))[_0x14e6('0x29')](handleError(_0x204eec,null));};exports[_0x14e6('0xbb')]=function(_0x472e77,_0x22e14a,_0x45f49e){return db[_0x14e6('0x42')]['find']({'where':{'id':_0x472e77[_0x14e6('0x59')]['id']}})[_0x14e6('0x36')](handleEntityNotFound(_0x22e14a,null))[_0x14e6('0x36')](function(_0x507a4){if(_0x507a4){return _0x507a4[_0x14e6('0xbb')](_0x472e77[_0x14e6('0x66')][_0x14e6('0x70')],_[_0x14e6('0xbc')](_0x472e77[_0x14e6('0x66')],[_0x14e6('0x70'),'id'])||{})[_0x14e6('0x98')](function(_0x4d53b5){for(var _0x3dfe6e=0x0;_0x3dfe6e<_0x472e77[_0x14e6('0x66')]['ids'][_0x14e6('0x6c')];_0x3dfe6e+=0x1){socket['emit']('userOpenchannelAccount:save',{'UserId':_0x472e77['body'][_0x14e6('0x70')][_0x3dfe6e],'OpenchannelAccountId':_0x472e77[_0x14e6('0x59')]['id']});}return _0x4d53b5;});}})[_0x14e6('0x36')](respondWithResult(_0x22e14a,null))['catch'](handleError(_0x22e14a,null));};exports['removeAgents']=function(_0x221bdc,_0x5ef94f,_0x25873a){return db[_0x14e6('0x42')][_0x14e6('0x67')]({'where':{'id':_0x221bdc[_0x14e6('0x59')]['id']}})[_0x14e6('0x36')](handleEntityNotFound(_0x5ef94f,null))[_0x14e6('0x36')](function(_0x39f4a0){if(_0x39f4a0){return _0x39f4a0[_0x14e6('0xbd')](_0x221bdc[_0x14e6('0x46')][_0x14e6('0x70')])['then'](function(){if(_[_0x14e6('0xbe')](_0x221bdc['query'][_0x14e6('0x70')])){for(var _0x429a97=0x0;_0x429a97<_0x221bdc[_0x14e6('0x46')][_0x14e6('0x70')]['length'];_0x429a97+=0x1){socket['emit'](_0x14e6('0xbf'),{'UserId':Number(_0x221bdc['query']['ids'][_0x429a97]),'OpenchannelAccountId':Number(_0x221bdc['params']['id'])});}}else{socket[_0x14e6('0xc0')](_0x14e6('0xbf'),{'UserId':Number(_0x221bdc[_0x14e6('0x46')][_0x14e6('0x70')]),'OpenchannelAccountId':Number(_0x221bdc[_0x14e6('0x59')]['id'])});}});}})[_0x14e6('0x36')](respondWithStatusCode(_0x5ef94f,null))[_0x14e6('0x29')](handleError(_0x5ef94f,null));};exports[_0x14e6('0xc1')]=function(_0x1bd05c,_0x1dfea9,_0x3ef74d){var _0x258708={};var _0x5c11af={};var _0x8be08f;var _0x5780a1;return db[_0x14e6('0x42')]['findOne']({'where':{'id':_0x1bd05c[_0x14e6('0x59')]['id']}})[_0x14e6('0x36')](handleEntityNotFound(_0x1dfea9,null))[_0x14e6('0x36')](function(_0x313380){if(_0x313380){_0x8be08f=_0x313380;_0x5c11af[_0x14e6('0x45')]=_['keys'](db['User'][_0x14e6('0x5b')]);_0x5c11af[_0x14e6('0x46')]=_['keys'](_0x1bd05c['query']);_0x5c11af[_0x14e6('0x47')]=_[_0x14e6('0x5d')](_0x5c11af[_0x14e6('0x45')],_0x5c11af[_0x14e6('0x46')]);_0x258708[_0x14e6('0x48')]=_[_0x14e6('0x5d')](_0x5c11af[_0x14e6('0x45')],qs[_0x14e6('0x49')](_0x1bd05c[_0x14e6('0x46')][_0x14e6('0x49')]));_0x258708[_0x14e6('0x48')]=_0x258708[_0x14e6('0x48')][_0x14e6('0x6c')]?_0x258708[_0x14e6('0x48')]:_0x5c11af[_0x14e6('0x45')];_0x258708[_0x14e6('0x4c')]=qs[_0x14e6('0x4d')](_0x1bd05c[_0x14e6('0x46')][_0x14e6('0x4d')]);_0x258708['where']=qs[_0x14e6('0x47')](_['pick'](_0x1bd05c[_0x14e6('0x46')],_0x5c11af['filters']));if(_0x1bd05c[_0x14e6('0x46')][_0x14e6('0x53')]){_0x258708['where']=_['merge'](_0x258708['where'],{'$or':_[_0x14e6('0x41')](_0x258708[_0x14e6('0x48')],function(_0x229c8c){var _0x40ea4a={};_0x40ea4a[_0x229c8c]={'$like':'%'+_0x1bd05c['query'][_0x14e6('0x53')]+'%'};return _0x40ea4a;})});}_0x258708=_[_0x14e6('0x50')]({},_0x258708,_0x1bd05c[_0x14e6('0x54')]);return _0x8be08f[_0x14e6('0xc1')](_0x258708);}})['then'](function(_0x2e4bbd){if(_0x2e4bbd){_0x5780a1=_0x2e4bbd[_0x14e6('0x6c')];if(!_0x1bd05c[_0x14e6('0x46')]['hasOwnProperty'](_0x14e6('0x4b'))){_0x258708[_0x14e6('0x2f')]=qs[_0x14e6('0x2f')](_0x1bd05c[_0x14e6('0x46')][_0x14e6('0x2f')]);_0x258708[_0x14e6('0x2c')]=qs[_0x14e6('0x2c')](_0x1bd05c[_0x14e6('0x46')][_0x14e6('0x2c')]);}return _0x8be08f['getAgents'](_0x258708);}})[_0x14e6('0x36')](function(_0xd529c7){if(_0xd529c7){return _0xd529c7?{'count':_0x5780a1,'rows':_0xd529c7}:null;}})[_0x14e6('0x36')](respondWithResult(_0x1dfea9,null))[_0x14e6('0x29')](handleError(_0x1dfea9,null));};exports[_0x14e6('0x3e')]=function(_0x14528f,_0x2596c4,_0x17cc91){var _0x212f50,_0x2d2b5b,_0x391a89;if(_['isNil'](_0x14528f['body'][_0x14e6('0x66')])||_0x14528f[_0x14e6('0x66')][_0x14e6('0x66')]===''){throw new db[(_0x14e6('0x79'))]['ValidationError'](_0x14e6('0x83'));}if(_[_0x14e6('0x82')](_0x14528f[_0x14e6('0x66')]['to'])){}_0x212f50=_0x14528f['body']['to'];return db[_0x14e6('0x42')][_0x14e6('0x74')]({'where':{'id':_0x14528f[_0x14e6('0x59')]['id']}})[_0x14e6('0x36')](handleEntityNotFound(_0x2596c4,null))[_0x14e6('0x36')](function(_0x29055b){if(_0x29055b){return db[_0x14e6('0x42')][_0x14e6('0x67')]({'where':{'id':_0x29055b['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0x14e6('0x78')],'as':_0x14e6('0x91'),'where':{[_0x29055b[_0x14e6('0x84')]]:_0x212f50},'limit':0x1,'order':[[_0x14e6('0x7e'),'DESC']]}]}]})[_0x14e6('0x36')](handleEntityNotFound(_0x2596c4,null))['then'](function(_0x5707ee){if(_0x5707ee&&_0x5707ee[_0x14e6('0x89')]){_0x2d2b5b=_0x5707ee[_0x14e6('0x38')]({'plain':!![]});if(_0x2d2b5b[_0x14e6('0x89')]&&_0x2d2b5b[_0x14e6('0x89')][_0x14e6('0x91')]['length']){return _0x2d2b5b['List'][_0x14e6('0x91')][0x0];}return db[_0x14e6('0x78')]['create'](_[_0x14e6('0x92')](_0x14528f[_0x14e6('0x66')],{'firstName':_0x212f50,[_0x5707ee[_0x14e6('0x84')]]:_0x212f50,'phone':_0x212f50,'ListId':_0x2d2b5b[_0x14e6('0x93')]}));}})[_0x14e6('0x36')](handleEntityNotFound(_0x2596c4,null))[_0x14e6('0x36')](function(_0x24807b){if(_0x24807b){_0x391a89=_0x24807b;return db[_0x14e6('0xc2')][_0x14e6('0x67')]({'where':{'ContactId':_0x391a89['id'],'closed':![],'OpenchannelAccountId':_0x2d2b5b['id']}})['then'](function(_0x55acc1){if(_0x55acc1){return[_0x55acc1,![]];}return db['OpenchannelInteraction'][_0x14e6('0x5e')]({'UserId':_0x14528f['user']['id'],'ContactId':_0x391a89['id'],'OpenchannelAccountId':_0x2d2b5b['id'],'lastMsgDirection':'out','Messages':[_[_0x14e6('0x50')](_0x14528f[_0x14e6('0x66')],{'read':![],'body':_0x14528f[_0x14e6('0x66')]['body'],'OpenchannelAccountId':_0x2d2b5b['id'],'UserId':_0x14528f['user']['id'],'ContactId':_0x391a89['id']})]},{'include':[{'model':db[_0x14e6('0xa3')],'as':_0x14e6('0xc3')}]})[_0x14e6('0x36')](function(_0x15195c){return[_0x15195c,!![]];});});}})['spread'](function(_0x2bc7b4,_0x3e5b46){if(_0x3e5b46){return _0x2bc7b4;}return db[_0x14e6('0xa3')][_0x14e6('0x5e')](_[_0x14e6('0x50')](_0x14528f['body'],{'read':![],'body':_0x14528f[_0x14e6('0x66')][_0x14e6('0x66')],'OpenchannelAccountId':_0x2d2b5b['id'],'OpenchannelInteractionId':_0x2bc7b4['id'],'UserId':_0x14528f['user']['id'],'ContactId':_0x391a89['id']}))[_0x14e6('0x36')](function(_0x214e4e){_0x2bc7b4[_0x14e6('0xc4')]['Messages']=[];_0x2bc7b4[_0x14e6('0xc4')]['Messages'][_0x14e6('0x9f')](_0x214e4e['dataValues']);return _0x2bc7b4;});});}})[_0x14e6('0x36')](respondWithResult(_0x2596c4,null))[_0x14e6('0x29')](handleError(_0x2596c4,null));}; \ No newline at end of file +var _0x6ced=['attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','Pause','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','OpenchannelAccountId','Disposition','getDispositions','order','pick','removeDispositions','CannedAnswer','findOne','removeAnswers','openchannel','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','ListId','isNil','from','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','DESC','OpenchannelApplication','account','applications','list','orderBy','priority','asc','Applications','contact','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','messageId','interaction','created','push','close','unmanaged','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','User','unshift','waitForTheAssignedAgent','Start','startRouting','EventManager','notify','bulkCreate','findAndCountAll','getApplications','getInteractions','Owner','Tag','color','tag','addAgents','ids','omit','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','out','dataValues','Messages','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','defaults','redis','localhost','socket.io-emitter','./openchannelAccount.socket','register','jayson/promise','http','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','error','message','result','catch','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','save','update','get','OpenchannelAccounts','destroy','end','name','send','index','mandatoryDispositionPause','map','OpenchannelAccount','rawAttributes','fieldName','type','key','query','keys','intersection','model'];(function(_0x1b349a,_0x22222c){var _0x5d1f7c=function(_0x368d7c){while(--_0x368d7c){_0x1b349a['push'](_0x1b349a['shift']());}};_0x5d1f7c(++_0x22222c);}(_0x6ced,0x6d));var _0xd6ce=function(_0x2dfe6f,_0x1f96a5){_0x2dfe6f=_0x2dfe6f-0x0;var _0x103089=_0x6ced[_0x2dfe6f];return _0x103089;};'use strict';var emlformat=require(_0xd6ce('0x0'));var rimraf=require(_0xd6ce('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd6ce('0x2'));var rp=require(_0xd6ce('0x3'));var moment=require(_0xd6ce('0x4'));var BPromise=require(_0xd6ce('0x5'));var Mustache=require(_0xd6ce('0x6'));var util=require(_0xd6ce('0x7'));var path=require(_0xd6ce('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xd6ce('0x9'));var fs=require('fs');var fs_extra=require(_0xd6ce('0xa'));var _=require(_0xd6ce('0xb'));var squel=require('squel');var crypto=require(_0xd6ce('0xc'));var jsforce=require(_0xd6ce('0xd'));var deskjs=require(_0xd6ce('0xe'));var toCsv=require('to-csv');var querystring=require(_0xd6ce('0xf'));var Papa=require(_0xd6ce('0x10'));var Redis=require(_0xd6ce('0x11'));var authService=require(_0xd6ce('0x12'));var qs=require(_0xd6ce('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd6ce('0x14'));var logger=require(_0xd6ce('0x15'))(_0xd6ce('0x16'));var utils=require(_0xd6ce('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_[_0xd6ce('0x18')](config[_0xd6ce('0x19')],{'host':_0xd6ce('0x1a'),'port':0x18eb});var socket=require(_0xd6ce('0x1b'))(new Redis(config[_0xd6ce('0x19')]));require(_0xd6ce('0x1c'))[_0xd6ce('0x1d')](socket);var jayson=require(_0xd6ce('0x1e'));var client=jayson['client']['http']({'port':0x232c});var client9002=jayson['client'][_0xd6ce('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x525d92,_0x40b139,_0xb80cf0,_0x52b51f){return new BPromise(function(_0x4d0a04,_0x4ff438){var _0xaf379=_0x52b51f||client;return _0xaf379[_0xd6ce('0x20')](_0x525d92,_0xb80cf0)[_0xd6ce('0x21')](function(_0x214a9c){logger[_0xd6ce('0x22')](_0xd6ce('0x23'),_0x40b139,_0xd6ce('0x24'));logger[_0xd6ce('0x25')](_0xd6ce('0x26'),_0x40b139,_0xd6ce('0x24'),JSON['stringify'](_0x214a9c));if(_0x214a9c['error']){if(_0x214a9c[_0xd6ce('0x27')]['code']===0x1f4){logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0x40b139,_0x214a9c[_0xd6ce('0x27')][_0xd6ce('0x28')]);return _0x4ff438(_0x214a9c['error']['message']);}logger[_0xd6ce('0x27')](_0xd6ce('0x23'),_0x40b139,_0x214a9c[_0xd6ce('0x27')][_0xd6ce('0x28')]);return _0x4d0a04(_0x214a9c['error'][_0xd6ce('0x28')]);}else{logger[_0xd6ce('0x22')](_0xd6ce('0x23'),_0x40b139,'request\x20sent');_0x4d0a04(_0x214a9c[_0xd6ce('0x29')][_0xd6ce('0x28')]);}})[_0xd6ce('0x2a')](function(_0x366e93){logger[_0xd6ce('0x27')](_0xd6ce('0x23'),_0x40b139,_0x366e93);_0x4ff438(_0x366e93);});});}function respondWithStatusCode(_0x1761e5,_0x100581){_0x100581=_0x100581||0xcc;return function(_0x3c2668){if(_0x3c2668){return _0x1761e5[_0xd6ce('0x2b')](_0x100581);}return _0x1761e5[_0xd6ce('0x2c')](_0x100581)['end']();};}function respondWithResult(_0x2da32f,_0x2ad87c){_0x2ad87c=_0x2ad87c||0xc8;return function(_0x10a167){if(_0x10a167){return _0x2da32f[_0xd6ce('0x2c')](_0x2ad87c)[_0xd6ce('0x2d')](_0x10a167);}};}function respondWithFilteredResult(_0xedc5e7,_0x1167ac){return function(_0x16f107){if(_0x16f107){var _0x2dca18=typeof _0x1167ac['offset']===_0xd6ce('0x2e')&&typeof _0x1167ac[_0xd6ce('0x2f')]===_0xd6ce('0x2e');var _0x1a1052=_0x16f107[_0xd6ce('0x30')];var _0x1070e4=_0x2dca18?0x0:_0x1167ac[_0xd6ce('0x31')];var _0x9a7b4f=_0x2dca18?_0x16f107[_0xd6ce('0x30')]:_0x1167ac[_0xd6ce('0x31')]+_0x1167ac[_0xd6ce('0x2f')];var _0x1b9c6f;if(_0x9a7b4f>=_0x1a1052){_0x9a7b4f=_0x1a1052;_0x1b9c6f=0xc8;}else{_0x1b9c6f=0xce;}_0xedc5e7[_0xd6ce('0x2c')](_0x1b9c6f);return _0xedc5e7[_0xd6ce('0x32')](_0xd6ce('0x33'),_0x1070e4+'-'+_0x9a7b4f+'/'+_0x1a1052)[_0xd6ce('0x2d')](_0x16f107);}return null;};}function patchUpdates(_0x9d7945){return function(_0x5e4d0b){try{jsonpatch[_0xd6ce('0x34')](_0x5e4d0b,_0x9d7945,!![]);}catch(_0xefb70d){return BPromise['reject'](_0xefb70d);}return _0x5e4d0b[_0xd6ce('0x35')]();};}function saveUpdates(_0x545b57,_0x2ba740){return function(_0x238911){if(_0x238911){return _0x238911[_0xd6ce('0x36')](_0x545b57)[_0xd6ce('0x21')](function(_0x4c72dc){return _0x4c72dc;});}return null;};}function removeEntity(_0xb8338a,_0xbee2f7){return function(_0x4dfcc8){if(_0x4dfcc8){return _0x4dfcc8['destroy']()[_0xd6ce('0x21')](function(){var _0x592b1a=_0x4dfcc8[_0xd6ce('0x37')]({'plain':!![]});var _0x29b070=_0xd6ce('0x38');return db['UserProfileResource'][_0xd6ce('0x39')]({'where':{'type':_0x29b070,'resourceId':_0x592b1a['id']}})['then'](function(){return _0x4dfcc8;});})[_0xd6ce('0x21')](function(){_0xb8338a[_0xd6ce('0x2c')](0xcc)[_0xd6ce('0x3a')]();});}};}function handleEntityNotFound(_0x567552,_0x37a6cf){return function(_0x4e7c24){if(!_0x4e7c24){_0x567552[_0xd6ce('0x2b')](0x194);}return _0x4e7c24;};}function handleError(_0x5cb0a4,_0x1ec40a){_0x1ec40a=_0x1ec40a||0x1f4;return function(_0x5bbca1){logger[_0xd6ce('0x27')](_0x5bbca1['stack']);if(_0x5bbca1[_0xd6ce('0x3b')]){delete _0x5bbca1[_0xd6ce('0x3b')];}_0x5cb0a4[_0xd6ce('0x2c')](_0x1ec40a)[_0xd6ce('0x3c')](_0x5bbca1);};}exports[_0xd6ce('0x3d')]=function(_0x5d77bc,_0x123770){var _0x221394={'include':[{'model':db['Pause'],'as':_0xd6ce('0x3e')}]},_0x49b4b1={},_0x2ce63b={'count':0x0,'rows':[]};var _0xb737ae=_[_0xd6ce('0x3f')](db[_0xd6ce('0x40')][_0xd6ce('0x41')],function(_0x2c7595){return{'name':_0x2c7595[_0xd6ce('0x42')],'type':_0x2c7595[_0xd6ce('0x43')][_0xd6ce('0x44')]};});_0x49b4b1['model']=_[_0xd6ce('0x3f')](_0xb737ae,_0xd6ce('0x3b'));_0x49b4b1[_0xd6ce('0x45')]=_[_0xd6ce('0x46')](_0x5d77bc[_0xd6ce('0x45')]);_0x49b4b1['filters']=_[_0xd6ce('0x47')](_0x49b4b1[_0xd6ce('0x48')],_0x49b4b1[_0xd6ce('0x45')]);_0x221394[_0xd6ce('0x49')]=_[_0xd6ce('0x47')](_0x49b4b1[_0xd6ce('0x48')],qs[_0xd6ce('0x4a')](_0x5d77bc[_0xd6ce('0x45')][_0xd6ce('0x4a')]));_0x221394[_0xd6ce('0x49')]=_0x221394[_0xd6ce('0x49')][_0xd6ce('0x4b')]?_0x221394[_0xd6ce('0x49')]:_0x49b4b1[_0xd6ce('0x48')];if(!_0x5d77bc[_0xd6ce('0x45')][_0xd6ce('0x4c')](_0xd6ce('0x4d'))){_0x221394[_0xd6ce('0x2f')]=qs[_0xd6ce('0x2f')](_0x5d77bc[_0xd6ce('0x45')][_0xd6ce('0x2f')]);_0x221394[_0xd6ce('0x31')]=qs[_0xd6ce('0x31')](_0x5d77bc['query'][_0xd6ce('0x31')]);}_0x221394['order']=qs[_0xd6ce('0x4e')](_0x5d77bc[_0xd6ce('0x45')][_0xd6ce('0x4e')]);_0x221394[_0xd6ce('0x4f')]=qs[_0xd6ce('0x50')](_['pick'](_0x5d77bc['query'],_0x49b4b1['filters']),_0xb737ae);if(_0x5d77bc['query'][_0xd6ce('0x51')]){_0x221394[_0xd6ce('0x4f')]=_[_0xd6ce('0x52')](_0x221394[_0xd6ce('0x4f')],{'$or':_[_0xd6ce('0x3f')](_0xb737ae,function(_0x8288a5){if(_0x8288a5[_0xd6ce('0x43')]!==_0xd6ce('0x53')){var _0x1b4a0e={};_0x1b4a0e[_0x8288a5[_0xd6ce('0x3b')]]={'$like':'%'+_0x5d77bc[_0xd6ce('0x45')]['filter']+'%'};return _0x1b4a0e;}})});}_0x221394=_[_0xd6ce('0x52')]({},_0x221394,_0x5d77bc[_0xd6ce('0x54')]);var _0x262023={'where':_0x221394[_0xd6ce('0x4f')]};return db['OpenchannelAccount']['count'](_0x262023)[_0xd6ce('0x21')](function(_0x1f83a2){_0x2ce63b['count']=_0x1f83a2;if(_0x5d77bc['query'][_0xd6ce('0x55')]){_0x221394[_0xd6ce('0x56')]=[{'all':!![]}];}return db[_0xd6ce('0x40')][_0xd6ce('0x57')](_0x221394);})[_0xd6ce('0x21')](function(_0x413d0d){_0x2ce63b[_0xd6ce('0x58')]=_0x413d0d;return _0x2ce63b;})[_0xd6ce('0x21')](respondWithFilteredResult(_0x123770,_0x221394))[_0xd6ce('0x2a')](handleError(_0x123770,null));};exports['show']=function(_0x559a54,_0x167823){var _0x238044={'raw':![],'where':{'id':_0x559a54[_0xd6ce('0x59')]['id']},'include':[{'model':db[_0xd6ce('0x5a')],'as':'mandatoryDispositionPause'}]},_0x475633={};_0x475633[_0xd6ce('0x48')]=_[_0xd6ce('0x46')](db[_0xd6ce('0x40')][_0xd6ce('0x41')]);_0x475633[_0xd6ce('0x45')]=_['keys'](_0x559a54[_0xd6ce('0x45')]);_0x475633['filters']=_['intersection'](_0x475633[_0xd6ce('0x48')],_0x475633[_0xd6ce('0x45')]);_0x238044[_0xd6ce('0x49')]=_[_0xd6ce('0x47')](_0x475633['model'],qs['fields'](_0x559a54[_0xd6ce('0x45')][_0xd6ce('0x4a')]));_0x238044[_0xd6ce('0x49')]=_0x238044[_0xd6ce('0x49')][_0xd6ce('0x4b')]?_0x238044['attributes']:_0x475633[_0xd6ce('0x48')];if(_0x559a54[_0xd6ce('0x45')]['includeAll']){_0x238044[_0xd6ce('0x56')]=[{'all':!![]}];}_0x238044=_[_0xd6ce('0x52')]({},_0x238044,_0x559a54['options']);return db[_0xd6ce('0x40')][_0xd6ce('0x5b')](_0x238044)[_0xd6ce('0x21')](handleEntityNotFound(_0x167823,null))[_0xd6ce('0x21')](respondWithResult(_0x167823,null))[_0xd6ce('0x2a')](handleError(_0x167823,null));};exports[_0xd6ce('0x5c')]=function(_0x1fd420,_0x392b40){return db[_0xd6ce('0x40')][_0xd6ce('0x5c')](_0x1fd420[_0xd6ce('0x5d')],{})[_0xd6ce('0x21')](function(_0x44dc54){var _0xbedec8=_0x1fd420[_0xd6ce('0x5e')]['get']({'plain':!![]});if(!_0xbedec8)throw new Error(_0xd6ce('0x5f'));if(_0xbedec8[_0xd6ce('0x60')]==='user'){var _0x2f0ece=_0x44dc54['get']({'plain':!![]});var _0x212f2e='OpenchannelAccounts';return db[_0xd6ce('0x61')][_0xd6ce('0x5b')]({'where':{'name':_0x212f2e,'userProfileId':_0xbedec8['userProfileId']},'raw':!![]})[_0xd6ce('0x21')](function(_0x162218){if(_0x162218&&_0x162218[_0xd6ce('0x62')]===0x0){return db['UserProfileResource'][_0xd6ce('0x5c')]({'name':_0x2f0ece[_0xd6ce('0x3b')],'resourceId':_0x2f0ece['id'],'type':_0x162218[_0xd6ce('0x3b')],'sectionId':_0x162218['id']},{})[_0xd6ce('0x21')](function(){return _0x44dc54;});}else{return _0x44dc54;}})['catch'](function(_0xc96bf4){logger[_0xd6ce('0x27')](_0xd6ce('0x63'),_0xc96bf4);throw _0xc96bf4;});}return _0x44dc54;})[_0xd6ce('0x21')](respondWithResult(_0x392b40,0xc9))['catch'](handleError(_0x392b40,null));};exports['update']=function(_0x2c4e63,_0x1e9738){if(_0x2c4e63['body']['id']){delete _0x2c4e63[_0xd6ce('0x5d')]['id'];}return db[_0xd6ce('0x40')]['find']({'where':{'id':_0x2c4e63[_0xd6ce('0x59')]['id']},'include':[{'model':db[_0xd6ce('0x5a')],'as':_0xd6ce('0x3e')}]})[_0xd6ce('0x21')](handleEntityNotFound(_0x1e9738,null))[_0xd6ce('0x21')](saveUpdates(_0x2c4e63[_0xd6ce('0x5d')],null))[_0xd6ce('0x21')](respondWithResult(_0x1e9738,null))[_0xd6ce('0x2a')](handleError(_0x1e9738,null));};exports[_0xd6ce('0x39')]=function(_0x3798dc,_0x3451c9){return db['OpenchannelAccount'][_0xd6ce('0x5b')]({'where':{'id':_0x3798dc[_0xd6ce('0x59')]['id']}})['then'](handleEntityNotFound(_0x3451c9,null))['then'](removeEntity(_0x3451c9,null))[_0xd6ce('0x2a')](handleError(_0x3451c9,null));};exports[_0xd6ce('0x64')]=function(_0x1e7ea1,_0x530c32){return db[_0xd6ce('0x40')][_0xd6ce('0x64')]()[_0xd6ce('0x21')](respondWithResult(_0x530c32,null))[_0xd6ce('0x2a')](handleError(_0x530c32,null));};exports['addDisposition']=function(_0x300be0,_0x21e7f1,_0x53ae76){if(_0x300be0[_0xd6ce('0x5d')]['id']){delete _0x300be0[_0xd6ce('0x5d')]['id'];}return db['OpenchannelAccount'][_0xd6ce('0x5b')]({'where':{'id':_0x300be0[_0xd6ce('0x59')]['id']}})[_0xd6ce('0x21')](handleEntityNotFound(_0x21e7f1,null))['then'](function(_0xb64ad5){if(_0xb64ad5){_0x300be0[_0xd6ce('0x5d')][_0xd6ce('0x65')]=_0xb64ad5['id'];return db[_0xd6ce('0x66')]['create'](_0x300be0['body']);}})[_0xd6ce('0x21')](respondWithResult(_0x21e7f1,null))[_0xd6ce('0x2a')](handleError(_0x21e7f1,null));};exports[_0xd6ce('0x67')]=function(_0x3b0e1a,_0x2c223c,_0x238ba7){var _0x241d93={'raw':![],'where':{}};var _0x39e956={};var _0x35a1f0={'count':0x0,'rows':[]};return db[_0xd6ce('0x40')]['findOne']({'where':{'id':_0x3b0e1a[_0xd6ce('0x59')]['id']}})['then'](handleEntityNotFound(_0x2c223c,null))[_0xd6ce('0x21')](function(_0x3bed28){if(_0x3bed28){_0x39e956[_0xd6ce('0x48')]=_[_0xd6ce('0x46')](db[_0xd6ce('0x66')][_0xd6ce('0x41')]);_0x39e956[_0xd6ce('0x45')]=_[_0xd6ce('0x46')](_0x3b0e1a[_0xd6ce('0x45')]);_0x39e956[_0xd6ce('0x50')]=_[_0xd6ce('0x47')](_0x39e956[_0xd6ce('0x48')],_0x39e956[_0xd6ce('0x45')]);_0x241d93['attributes']=_[_0xd6ce('0x47')](_0x39e956[_0xd6ce('0x48')],qs[_0xd6ce('0x4a')](_0x3b0e1a[_0xd6ce('0x45')][_0xd6ce('0x4a')]));_0x241d93['attributes']=_0x241d93['attributes'][_0xd6ce('0x4b')]?_0x241d93['attributes']:_0x39e956['model'];if(!_0x3b0e1a[_0xd6ce('0x45')][_0xd6ce('0x4c')](_0xd6ce('0x4d'))){_0x241d93[_0xd6ce('0x2f')]=qs[_0xd6ce('0x2f')](_0x3b0e1a[_0xd6ce('0x45')][_0xd6ce('0x2f')]);_0x241d93[_0xd6ce('0x31')]=qs[_0xd6ce('0x31')](_0x3b0e1a['query'][_0xd6ce('0x31')]);}_0x241d93[_0xd6ce('0x68')]=qs['sort'](_0x3b0e1a[_0xd6ce('0x45')][_0xd6ce('0x4e')]);_0x241d93[_0xd6ce('0x4f')]=qs[_0xd6ce('0x50')](_[_0xd6ce('0x69')](_0x3b0e1a[_0xd6ce('0x45')],_0x39e956[_0xd6ce('0x50')]));_0x241d93['where'][_0xd6ce('0x65')]=_0x3bed28['id'];if(_0x3b0e1a[_0xd6ce('0x45')][_0xd6ce('0x51')]){_0x241d93[_0xd6ce('0x4f')]=_[_0xd6ce('0x52')](_0x241d93['where'],{'$or':_['map'](_0x241d93[_0xd6ce('0x49')],function(_0x3df059){var _0x3e4e33={};_0x3e4e33[_0x3df059]={'$like':'%'+_0x3b0e1a[_0xd6ce('0x45')][_0xd6ce('0x51')]+'%'};return _0x3e4e33;})});}_0x241d93=_[_0xd6ce('0x52')]({},_0x241d93,_0x3b0e1a[_0xd6ce('0x54')]);return db[_0xd6ce('0x66')][_0xd6ce('0x30')]({'where':_0x241d93[_0xd6ce('0x4f')]})[_0xd6ce('0x21')](function(_0x20d084){_0x35a1f0['count']=_0x20d084;if(_0x3b0e1a[_0xd6ce('0x45')]['includeAll']){_0x241d93[_0xd6ce('0x56')]=[{'all':!![]}];}return db[_0xd6ce('0x66')][_0xd6ce('0x57')](_0x241d93);})['then'](function(_0x4ca39e){_0x35a1f0[_0xd6ce('0x58')]=_0x4ca39e;return _0x35a1f0;});}})[_0xd6ce('0x21')](respondWithFilteredResult(_0x2c223c,_0x241d93))[_0xd6ce('0x2a')](handleError(_0x2c223c,null));};exports[_0xd6ce('0x6a')]=function(_0x80d72b,_0x2b67a2,_0x1285bd){return db[_0xd6ce('0x40')][_0xd6ce('0x5b')]({'where':{'id':_0x80d72b[_0xd6ce('0x59')]['id']}})[_0xd6ce('0x21')](handleEntityNotFound(_0x2b67a2,null))[_0xd6ce('0x21')](function(_0x33022e){if(_0x33022e){return _0x33022e[_0xd6ce('0x6a')](_0x80d72b[_0xd6ce('0x45')]['ids']);}})[_0xd6ce('0x21')](respondWithStatusCode(_0x2b67a2,null))['catch'](handleError(_0x2b67a2,null));};exports['addAnswer']=function(_0x1240ed,_0x1b8c2b,_0x30987d){if(_0x1240ed[_0xd6ce('0x5d')]['id']){delete _0x1240ed['body']['id'];}return db[_0xd6ce('0x40')]['find']({'where':{'id':_0x1240ed[_0xd6ce('0x59')]['id']}})[_0xd6ce('0x21')](handleEntityNotFound(_0x1b8c2b,null))[_0xd6ce('0x21')](function(_0x61b59e){if(_0x61b59e){_0x1240ed[_0xd6ce('0x5d')]['OpenchannelAccountId']=_0x61b59e['id'];return db[_0xd6ce('0x6b')][_0xd6ce('0x5c')](_0x1240ed[_0xd6ce('0x5d')]);}})['then'](respondWithResult(_0x1b8c2b,null))['catch'](handleError(_0x1b8c2b,null));};exports['getAnswers']=function(_0x535150,_0x1ce322,_0xc7a9e3){var _0x568b80={'raw':![],'where':{}};var _0x5728bb={};var _0x56e19a={'count':0x0,'rows':[]};return db[_0xd6ce('0x40')][_0xd6ce('0x6c')]({'where':{'id':_0x535150[_0xd6ce('0x59')]['id']}})[_0xd6ce('0x21')](handleEntityNotFound(_0x1ce322,null))['then'](function(_0x4122ad){if(_0x4122ad){_0x5728bb['model']=_['keys'](db[_0xd6ce('0x6b')][_0xd6ce('0x41')]);_0x5728bb[_0xd6ce('0x45')]=_[_0xd6ce('0x46')](_0x535150[_0xd6ce('0x45')]);_0x5728bb[_0xd6ce('0x50')]=_[_0xd6ce('0x47')](_0x5728bb['model'],_0x5728bb[_0xd6ce('0x45')]);_0x568b80[_0xd6ce('0x49')]=_[_0xd6ce('0x47')](_0x5728bb[_0xd6ce('0x48')],qs[_0xd6ce('0x4a')](_0x535150[_0xd6ce('0x45')][_0xd6ce('0x4a')]));_0x568b80['attributes']=_0x568b80[_0xd6ce('0x49')][_0xd6ce('0x4b')]?_0x568b80[_0xd6ce('0x49')]:_0x5728bb['model'];if(!_0x535150[_0xd6ce('0x45')]['hasOwnProperty'](_0xd6ce('0x4d'))){_0x568b80[_0xd6ce('0x2f')]=qs[_0xd6ce('0x2f')](_0x535150[_0xd6ce('0x45')][_0xd6ce('0x2f')]);_0x568b80[_0xd6ce('0x31')]=qs[_0xd6ce('0x31')](_0x535150[_0xd6ce('0x45')][_0xd6ce('0x31')]);}_0x568b80[_0xd6ce('0x68')]=qs[_0xd6ce('0x4e')](_0x535150['query'][_0xd6ce('0x4e')]);_0x568b80[_0xd6ce('0x4f')]=qs[_0xd6ce('0x50')](_[_0xd6ce('0x69')](_0x535150['query'],_0x5728bb[_0xd6ce('0x50')]));_0x568b80[_0xd6ce('0x4f')][_0xd6ce('0x65')]=_0x4122ad['id'];if(_0x535150[_0xd6ce('0x45')]['filter']){_0x568b80[_0xd6ce('0x4f')]=_[_0xd6ce('0x52')](_0x568b80['where'],{'$or':_[_0xd6ce('0x3f')](_0x568b80[_0xd6ce('0x49')],function(_0x38b181){var _0x395725={};_0x395725[_0x38b181]={'$like':'%'+_0x535150[_0xd6ce('0x45')][_0xd6ce('0x51')]+'%'};return _0x395725;})});}_0x568b80=_[_0xd6ce('0x52')]({},_0x568b80,_0x535150['options']);return db[_0xd6ce('0x6b')][_0xd6ce('0x30')]({'where':_0x568b80['where']})[_0xd6ce('0x21')](function(_0x2c1f73){_0x56e19a[_0xd6ce('0x30')]=_0x2c1f73;if(_0x535150[_0xd6ce('0x45')][_0xd6ce('0x55')]){_0x568b80[_0xd6ce('0x56')]=[{'all':!![]}];}return db[_0xd6ce('0x6b')][_0xd6ce('0x57')](_0x568b80);})['then'](function(_0x4f88f4){_0x56e19a[_0xd6ce('0x58')]=_0x4f88f4;return _0x56e19a;});}})[_0xd6ce('0x21')](respondWithFilteredResult(_0x1ce322,_0x568b80))[_0xd6ce('0x2a')](handleError(_0x1ce322,null));};exports[_0xd6ce('0x6d')]=function(_0x5aafe6,_0x3ee8c2,_0x54be9a){return db[_0xd6ce('0x40')][_0xd6ce('0x5b')]({'where':{'id':_0x5aafe6[_0xd6ce('0x59')]['id']}})['then'](handleEntityNotFound(_0x3ee8c2,null))['then'](function(_0x5b1fa1){if(_0x5b1fa1){return _0x5b1fa1['removeAnswers'](_0x5aafe6[_0xd6ce('0x45')]['ids']);}})[_0xd6ce('0x21')](respondWithStatusCode(_0x3ee8c2,null))[_0xd6ce('0x2a')](handleError(_0x3ee8c2,null));};exports['notify']=function(_0x5cfd37,_0x5cad0d,_0x189763){var _0x209e86={'body':_0x5cfd37[_0xd6ce('0x5d')],'channel':_0xd6ce('0x6e')};var _0x297810=[];var _0x573b7f=[];var _0xfaa2a6={};var _0x2f0814=![];return db[_0xd6ce('0x6f')][_0xd6ce('0x64')]()[_0xd6ce('0x21')](function(_0x45071b){if(!_0x45071b){throw new db[(_0xd6ce('0x70'))][(_0xd6ce('0x71'))](_0xd6ce('0x72'));}_0x297810=_[_0xd6ce('0x73')](_[_0xd6ce('0x46')](_0x45071b),[_0xd6ce('0x74'),'updatedAt']);_0x573b7f=_[_0xd6ce('0x73')](_[_0xd6ce('0x46')](_0x45071b),[_0xd6ce('0x74'),_0xd6ce('0x75'),'CompanyId',_0xd6ce('0x76')]);if(_0x5cfd37['body']['id']){delete _0x5cfd37[_0xd6ce('0x5d')]['id'];}if(_[_0xd6ce('0x77')](_0x5cfd37[_0xd6ce('0x5d')][_0xd6ce('0x78')])){throw new db[(_0xd6ce('0x70'))][(_0xd6ce('0x71'))]('from\x20is\x20mandatory');}if(_[_0xd6ce('0x77')](_0x5cfd37[_0xd6ce('0x5d')][_0xd6ce('0x5d')])||_0x5cfd37[_0xd6ce('0x5d')]['body']===''){throw new db[(_0xd6ce('0x70'))][(_0xd6ce('0x71'))](_0xd6ce('0x79'));}if(_[_0xd6ce('0x77')](_0x5cfd37['body'][_0xd6ce('0x7a')])){throw new db[(_0xd6ce('0x70'))][(_0xd6ce('0x71'))](_0xd6ce('0x7b')+_0x573b7f);}if(!_[_0xd6ce('0x7c')](_0x573b7f,_0x5cfd37[_0xd6ce('0x5d')][_0xd6ce('0x7a')])){throw new db[(_0xd6ce('0x70'))][(_0xd6ce('0x71'))](_0xd6ce('0x7d')+_0x573b7f);}_0xfaa2a6[_0x5cfd37[_0xd6ce('0x5d')][_0xd6ce('0x7a')]]=_0x5cfd37[_0xd6ce('0x5d')][_0xd6ce('0x78')];})[_0xd6ce('0x21')](function(){return db[_0xd6ce('0x40')][_0xd6ce('0x5b')]({'where':{'id':_0x5cfd37[_0xd6ce('0x59')]['id']},'include':[{'model':db[_0xd6ce('0x7e')],'as':_0xd6ce('0x7f'),'include':[{'model':db[_0xd6ce('0x6f')],'as':_0xd6ce('0x80'),'where':_0xfaa2a6,'limit':0x1,'order':[[_0xd6ce('0x75'),_0xd6ce('0x81')]]}]},{'model':db[_0xd6ce('0x82')],'as':'Applications'}]});})[_0xd6ce('0x21')](handleEntityNotFound(_0x5cad0d,null))[_0xd6ce('0x21')](function(_0x4b1013){if(_0x4b1013&&_0x4b1013['List']){_0x209e86[_0xd6ce('0x83')]=_0x4b1013;_0x209e86[_0xd6ce('0x84')]=_0x4b1013['Applications'];_0x209e86[_0xd6ce('0x85')]=_0x4b1013[_0xd6ce('0x7f')];_0x209e86[_0xd6ce('0x84')]=_[_0xd6ce('0x86')](_0x209e86[_0xd6ce('0x84')],[_0xd6ce('0x87')],[_0xd6ce('0x88')]);if(_0x209e86[_0xd6ce('0x83')]['Applications']){delete _0x209e86[_0xd6ce('0x83')][_0xd6ce('0x89')];}if(_0x209e86[_0xd6ce('0x83')][_0xd6ce('0x7f')]&&_0x209e86[_0xd6ce('0x83')][_0xd6ce('0x7f')][_0xd6ce('0x80')][_0xd6ce('0x4b')]){return _0x209e86[_0xd6ce('0x83')][_0xd6ce('0x7f')][_0xd6ce('0x80')][0x0];}var _0x3bc169=_[_0xd6ce('0x18')](_0x5cfd37[_0xd6ce('0x5d')],{'firstName':_0x5cfd37[_0xd6ce('0x5d')][_0xd6ce('0x78')],'ListId':_0x4b1013[_0xd6ce('0x76')]});_0x3bc169[_0x5cfd37[_0xd6ce('0x5d')][_0xd6ce('0x7a')]]=_0x5cfd37[_0xd6ce('0x5d')][_0xd6ce('0x78')];return db['CmContact']['create'](_0x3bc169,{'fields':_0x297810,'raw':!![]});}})[_0xd6ce('0x21')](handleEntityNotFound(_0x5cad0d,null))[_0xd6ce('0x21')](function(_0x19f1c7){_0x209e86[_0xd6ce('0x8a')]=_0x19f1c7;if(_0x19f1c7){var _0x2fdb57={'ContactId':_0x19f1c7['id'],'OpenchannelAccountId':_0x5cfd37[_0xd6ce('0x59')]['id'],'from':(_0x19f1c7['firstName']||'')+'\x20'+(_0x19f1c7[_0xd6ce('0x8b')]||'')};var _0x37536a={'OpenchannelAccountId':_0x5cfd37['params']['id'],'closed':![]};if(_0x5cfd37[_0xd6ce('0x5d')][_0xd6ce('0x8c')]){_0x37536a[_0xd6ce('0x8c')]=_0x5cfd37['body'][_0xd6ce('0x8c')];return db[_0xd6ce('0x8d')][_0xd6ce('0x5b')]({'where':_0x37536a})['then'](function(_0x1277dd){if(_0x1277dd){return[_0x1277dd,![]];}_0x2fdb57[_0xd6ce('0x8c')]=_0x5cfd37[_0xd6ce('0x5d')]['threadId'];_0x2fdb57[_0xd6ce('0x8e')]=_0x5cfd37['body'][_0xd6ce('0x8e')];return db[_0xd6ce('0x8d')][_0xd6ce('0x5c')](_0x2fdb57)[_0xd6ce('0x21')](function(_0x4e2517){return[_0x4e2517,!![]];});});}else{_0x37536a[_0xd6ce('0x8c')]=null;}_0x37536a[_0xd6ce('0x8f')]=_0x19f1c7['id'];return db[_0xd6ce('0x8d')]['find']({'where':_0x37536a})[_0xd6ce('0x21')](function(_0x2b888e){if(_0x2b888e){return[_0x2b888e,![]];}return db[_0xd6ce('0x8d')]['create'](_0x2fdb57)[_0xd6ce('0x21')](function(_0x361341){return[_0x361341,!![]];});});}})[_0xd6ce('0x90')](function(_0x254165,_0x1a5614){if(_0x254165){_0x2f0814=_0x1a5614;if(!_0x1a5614){var _0x16ec94={'from':(_0x209e86[_0xd6ce('0x8a')]['firstName']||'')+'\x20'+(_0x209e86[_0xd6ce('0x8a')][_0xd6ce('0x8b')]||'')};if(_0x5cfd37[_0xd6ce('0x5d')][_0xd6ce('0x8c')]&&_0x5cfd37['body'][_0xd6ce('0x91')]&&_0x5cfd37[_0xd6ce('0x5d')]['threadId']!=_0x5cfd37[_0xd6ce('0x5d')]['messageId']){_0x16ec94[_0xd6ce('0x8c')]=_0x5cfd37[_0xd6ce('0x5d')][_0xd6ce('0x91')];}return _0x254165[_0xd6ce('0x36')](_0x16ec94);}else{return _0x254165;}}})['then'](function(_0x47f4d8){_0x209e86[_0xd6ce('0x92')]=_0x47f4d8[_0xd6ce('0x37')]({'plain':!![]});_0x209e86[_0xd6ce('0x92')][_0xd6ce('0x93')]=_0x2f0814;if(_0x209e86['interaction'][_0xd6ce('0x93')]){if(_0x209e86[_0xd6ce('0x83')]['autoclose']){_0x209e86[_0xd6ce('0x84')][_0xd6ce('0x94')]({'id':0x0,'priority':_0x209e86[_0xd6ce('0x84')][_0xd6ce('0x4b')]+0x1,'app':_0xd6ce('0x95'),'appdata':_0xd6ce('0x96'),'interval':_0xd6ce('0x97')});}}return db[_0xd6ce('0x98')][_0xd6ce('0x5c')]({'body':_0x5cfd37[_0xd6ce('0x5d')][_0xd6ce('0x5d')],'OpenchannelAccountId':_0x5cfd37[_0xd6ce('0x59')]['id'],'OpenchannelInteractionId':_0x47f4d8['id'],'direction':'in','ContactId':_0x209e86[_0xd6ce('0x8a')]['id'],'AttachmentId':_0x5cfd37[_0xd6ce('0x5d')][_0xd6ce('0x99')]});})[_0xd6ce('0x21')](function(_0x2963e5){_0x209e86[_0xd6ce('0x28')]=_0x2963e5;if(_0x209e86[_0xd6ce('0x92')][_0xd6ce('0x9a')]){return db[_0xd6ce('0x9b')][_0xd6ce('0x5b')]({'attributes':['id',_0xd6ce('0x3b')],'where':{'id':_0x209e86['interaction'][_0xd6ce('0x9a')]}})[_0xd6ce('0x21')](function(_0x3c304d){if(_0x3c304d){_0x209e86['applications'][_0xd6ce('0x9c')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x3c304d['name']+','+(_0x209e86[_0xd6ce('0x83')][_0xd6ce('0x9d')]||0xa),'interval':_0xd6ce('0x97')});_0x209e86['forcedOwnership']=![];}return respondWithRpcPromise(_0xd6ce('0x9e'),_0xd6ce('0x9f'),_0x209e86);});}return respondWithRpcPromise('Start',_0xd6ce('0x9f'),_0x209e86);})[_0xd6ce('0x21')](function(_0x5f4d88){respondWithRpcPromise('EventManager',_0xd6ce('0xa0'),{'event':_0xd6ce('0xa1'),'message':_0x5f4d88},client9002);return _0x5f4d88;})['then'](respondWithResult(_0x5cad0d,null))['catch'](handleError(_0x5cad0d,null));};exports['addApplications']=function(_0x4b79e5,_0x3043f9,_0x24be0a){return db[_0xd6ce('0x40')]['findOne']({'where':{'id':_0x4b79e5[_0xd6ce('0x59')]['id']}})[_0xd6ce('0x21')](handleEntityNotFound(_0x3043f9,null))['then'](function(_0x1f849e){if(_0x1f849e){return db['sequelize']['transaction'](function(_0x21c7df){return db[_0xd6ce('0x82')][_0xd6ce('0x39')]({'where':{'OpenchannelAccountId':_0x4b79e5[_0xd6ce('0x59')]['id']},'transaction':_0x21c7df})[_0xd6ce('0x21')](function(_0x2d3139){var _0x43e211=_['map'](_0x4b79e5['body'],function(_0x284cd3){_0x284cd3[_0xd6ce('0x65')]=_0x4b79e5[_0xd6ce('0x59')]['id'];return _0x284cd3;});return db[_0xd6ce('0x82')][_0xd6ce('0xa2')](_0x43e211,{'transaction':_0x21c7df});});})[_0xd6ce('0x21')](function(){return db[_0xd6ce('0x82')][_0xd6ce('0xa3')]({'where':{'OpenchannelAccountId':_0x4b79e5[_0xd6ce('0x59')]['id']},'order':'priority'});});}})[_0xd6ce('0x21')](respondWithResult(_0x3043f9,null))[_0xd6ce('0x2a')](handleError(_0x3043f9,null));};exports[_0xd6ce('0xa4')]=function(_0x351795,_0x549d7c,_0xeb98fa){var _0x26c5a1={};var _0x53b9c7={};var _0x4f0aae;var _0x33d425;return db['OpenchannelAccount'][_0xd6ce('0x6c')]({'where':{'id':_0x351795[_0xd6ce('0x59')]['id']}})[_0xd6ce('0x21')](handleEntityNotFound(_0x549d7c,null))[_0xd6ce('0x21')](function(_0x1fbe52){if(_0x1fbe52){_0x4f0aae=_0x1fbe52;_0x53b9c7['model']=_[_0xd6ce('0x46')](db[_0xd6ce('0x82')][_0xd6ce('0x41')]);_0x53b9c7[_0xd6ce('0x45')]=_['keys'](_0x351795[_0xd6ce('0x45')]);_0x53b9c7['filters']=_[_0xd6ce('0x47')](_0x53b9c7['model'],_0x53b9c7['query']);_0x26c5a1[_0xd6ce('0x49')]=_[_0xd6ce('0x47')](_0x53b9c7[_0xd6ce('0x48')],qs[_0xd6ce('0x4a')](_0x351795[_0xd6ce('0x45')][_0xd6ce('0x4a')]));_0x26c5a1[_0xd6ce('0x49')]=_0x26c5a1[_0xd6ce('0x49')][_0xd6ce('0x4b')]?_0x26c5a1[_0xd6ce('0x49')]:_0x53b9c7[_0xd6ce('0x48')];_0x26c5a1[_0xd6ce('0x68')]=qs[_0xd6ce('0x4e')](_0x351795[_0xd6ce('0x45')]['sort']);_0x26c5a1[_0xd6ce('0x4f')]=qs['filters'](_[_0xd6ce('0x69')](_0x351795[_0xd6ce('0x45')],_0x53b9c7[_0xd6ce('0x50')]));if(_0x351795['query'][_0xd6ce('0x51')]){_0x26c5a1[_0xd6ce('0x4f')]=_[_0xd6ce('0x52')](_0x26c5a1[_0xd6ce('0x4f')],{'$or':_[_0xd6ce('0x3f')](_0x26c5a1['attributes'],function(_0x2d1f7d){var _0x4a8a61={};_0x4a8a61[_0x2d1f7d]={'$like':'%'+_0x351795[_0xd6ce('0x45')][_0xd6ce('0x51')]+'%'};return _0x4a8a61;})});}_0x26c5a1=_[_0xd6ce('0x52')]({},_0x26c5a1,_0x351795['options']);return _0x4f0aae[_0xd6ce('0xa4')](_0x26c5a1);}})[_0xd6ce('0x21')](function(_0x346fa3){if(_0x346fa3){_0x33d425=_0x346fa3['length'];if(!_0x351795[_0xd6ce('0x45')][_0xd6ce('0x4c')]('nolimit')){_0x26c5a1['limit']=qs[_0xd6ce('0x2f')](_0x351795[_0xd6ce('0x45')][_0xd6ce('0x2f')]);_0x26c5a1['offset']=qs['offset'](_0x351795[_0xd6ce('0x45')]['offset']);}return _0x4f0aae['getApplications'](_0x26c5a1);}})[_0xd6ce('0x21')](function(_0x200435){if(_0x200435){return _0x200435?{'count':_0x33d425,'rows':_0x200435}:null;}})[_0xd6ce('0x21')](respondWithResult(_0x549d7c,null))[_0xd6ce('0x2a')](handleError(_0x549d7c,null));};exports[_0xd6ce('0xa5')]=function(_0x241ef7,_0x2ed759,_0x106c12){var _0x3edf0f={'raw':![],'where':{}};var _0x3e8804={};var _0x250d01={'count':0x0,'rows':[]};return db[_0xd6ce('0x40')][_0xd6ce('0x6c')]({'where':{'id':_0x241ef7[_0xd6ce('0x59')]['id']}})[_0xd6ce('0x21')](handleEntityNotFound(_0x2ed759,null))['then'](function(_0x8576c7){if(_0x8576c7){_0x3e8804['model']=_[_0xd6ce('0x46')](db[_0xd6ce('0x8d')][_0xd6ce('0x41')]);_0x3e8804[_0xd6ce('0x45')]=_['keys'](_0x241ef7['query']);_0x3e8804[_0xd6ce('0x50')]=_[_0xd6ce('0x47')](_0x3e8804[_0xd6ce('0x48')],_0x3e8804['query']);_0x3edf0f[_0xd6ce('0x49')]=_[_0xd6ce('0x47')](_0x3e8804[_0xd6ce('0x48')],qs[_0xd6ce('0x4a')](_0x241ef7[_0xd6ce('0x45')][_0xd6ce('0x4a')]));_0x3edf0f[_0xd6ce('0x49')]=_0x3edf0f[_0xd6ce('0x49')][_0xd6ce('0x4b')]?_0x3edf0f[_0xd6ce('0x49')]:_0x3e8804[_0xd6ce('0x48')];if(!_0x241ef7[_0xd6ce('0x45')][_0xd6ce('0x4c')](_0xd6ce('0x4d'))){_0x3edf0f[_0xd6ce('0x2f')]=qs[_0xd6ce('0x2f')](_0x241ef7['query']['limit']);_0x3edf0f[_0xd6ce('0x31')]=qs['offset'](_0x241ef7[_0xd6ce('0x45')]['offset']);}_0x3edf0f[_0xd6ce('0x68')]=qs[_0xd6ce('0x4e')](_0x241ef7[_0xd6ce('0x45')][_0xd6ce('0x4e')]);_0x3edf0f[_0xd6ce('0x4f')]=qs[_0xd6ce('0x50')](_['pick'](_0x241ef7[_0xd6ce('0x45')],_0x3e8804[_0xd6ce('0x50')]));_0x3edf0f[_0xd6ce('0x4f')][_0xd6ce('0x65')]=_0x8576c7['id'];if(_0x241ef7[_0xd6ce('0x45')][_0xd6ce('0x51')]){_0x3edf0f[_0xd6ce('0x4f')]=_['merge'](_0x3edf0f[_0xd6ce('0x4f')],{'$or':_[_0xd6ce('0x3f')](_0x3edf0f['attributes'],function(_0x3180e5){var _0x59b84d={};_0x59b84d[_0x3180e5]={'$like':'%'+_0x241ef7['query'][_0xd6ce('0x51')]+'%'};return _0x59b84d;})});}_0x3edf0f=_[_0xd6ce('0x52')]({},_0x3edf0f,_0x241ef7[_0xd6ce('0x54')]);return db[_0xd6ce('0x8d')][_0xd6ce('0x30')]({'where':_0x3edf0f[_0xd6ce('0x4f')]})[_0xd6ce('0x21')](function(_0x137010){_0x250d01[_0xd6ce('0x30')]=_0x137010;if(_0x241ef7[_0xd6ce('0x45')][_0xd6ce('0x55')]){_0x3edf0f['include']=[{'model':db['CmContact'],'as':'Contact','required':![]},{'model':db[_0xd6ce('0x9b')],'as':_0xd6ce('0xa6'),'attributes':[_0xd6ce('0x3b'),'fullname','internal'],'required':![]},{'model':db[_0xd6ce('0xa7')],'as':'Tags','attributes':['id',_0xd6ce('0x3b'),_0xd6ce('0xa8')],'where':_0x241ef7['query'][_0xd6ce('0xa9')]?{'id':_0x241ef7[_0xd6ce('0x45')][_0xd6ce('0xa9')]}:undefined,'required':_0x241ef7['query'][_0xd6ce('0xa9')]?!![]:![]}];}return db[_0xd6ce('0x8d')][_0xd6ce('0x57')](_0x3edf0f);})[_0xd6ce('0x21')](function(_0x452a11){_0x250d01[_0xd6ce('0x58')]=_0x452a11;return _0x250d01;});}})['then'](respondWithFilteredResult(_0x2ed759,_0x3edf0f))[_0xd6ce('0x2a')](handleError(_0x2ed759,null));};exports['addAgents']=function(_0x5184d6,_0x2196e3,_0x15b4ae){return db[_0xd6ce('0x40')]['find']({'where':{'id':_0x5184d6['params']['id']}})[_0xd6ce('0x21')](handleEntityNotFound(_0x2196e3,null))[_0xd6ce('0x21')](function(_0x1e5f1d){if(_0x1e5f1d){return _0x1e5f1d[_0xd6ce('0xaa')](_0x5184d6[_0xd6ce('0x5d')][_0xd6ce('0xab')],_[_0xd6ce('0xac')](_0x5184d6['body'],[_0xd6ce('0xab'),'id'])||{})[_0xd6ce('0x90')](function(_0x15f917){for(var _0x3fb911=0x0;_0x3fb911<_0x5184d6[_0xd6ce('0x5d')]['ids']['length'];_0x3fb911+=0x1){socket[_0xd6ce('0xad')](_0xd6ce('0xae'),{'UserId':_0x5184d6[_0xd6ce('0x5d')]['ids'][_0x3fb911],'OpenchannelAccountId':_0x5184d6[_0xd6ce('0x59')]['id']});}return _0x15f917;});}})[_0xd6ce('0x21')](respondWithResult(_0x2196e3,null))['catch'](handleError(_0x2196e3,null));};exports['removeAgents']=function(_0x11580e,_0x127417,_0x524e1c){return db['OpenchannelAccount'][_0xd6ce('0x5b')]({'where':{'id':_0x11580e[_0xd6ce('0x59')]['id']}})[_0xd6ce('0x21')](handleEntityNotFound(_0x127417,null))[_0xd6ce('0x21')](function(_0x1959ca){if(_0x1959ca){return _0x1959ca[_0xd6ce('0xaf')](_0x11580e['query'][_0xd6ce('0xab')])[_0xd6ce('0x21')](function(){if(_[_0xd6ce('0xb0')](_0x11580e[_0xd6ce('0x45')][_0xd6ce('0xab')])){for(var _0x5451da=0x0;_0x5451da<_0x11580e[_0xd6ce('0x45')][_0xd6ce('0xab')]['length'];_0x5451da+=0x1){socket[_0xd6ce('0xad')]('userOpenchannelAccount:remove',{'UserId':Number(_0x11580e['query'][_0xd6ce('0xab')][_0x5451da]),'OpenchannelAccountId':Number(_0x11580e['params']['id'])});}}else{socket['emit'](_0xd6ce('0xb1'),{'UserId':Number(_0x11580e[_0xd6ce('0x45')][_0xd6ce('0xab')]),'OpenchannelAccountId':Number(_0x11580e['params']['id'])});}});}})['then'](respondWithStatusCode(_0x127417,null))[_0xd6ce('0x2a')](handleError(_0x127417,null));};exports[_0xd6ce('0xb2')]=function(_0x24d5bb,_0x6b8af,_0x2b9dbb){var _0x1e9a4e={};var _0x308875={};var _0x5824ab;var _0x5a22ec;return db['OpenchannelAccount'][_0xd6ce('0x6c')]({'where':{'id':_0x24d5bb['params']['id']}})['then'](handleEntityNotFound(_0x6b8af,null))[_0xd6ce('0x21')](function(_0x4e50de){if(_0x4e50de){_0x5824ab=_0x4e50de;_0x308875[_0xd6ce('0x48')]=_[_0xd6ce('0x46')](db[_0xd6ce('0x9b')][_0xd6ce('0x41')]);_0x308875[_0xd6ce('0x45')]=_[_0xd6ce('0x46')](_0x24d5bb[_0xd6ce('0x45')]);_0x308875[_0xd6ce('0x50')]=_['intersection'](_0x308875['model'],_0x308875[_0xd6ce('0x45')]);_0x1e9a4e[_0xd6ce('0x49')]=_[_0xd6ce('0x47')](_0x308875[_0xd6ce('0x48')],qs[_0xd6ce('0x4a')](_0x24d5bb[_0xd6ce('0x45')]['fields']));_0x1e9a4e[_0xd6ce('0x49')]=_0x1e9a4e['attributes'][_0xd6ce('0x4b')]?_0x1e9a4e[_0xd6ce('0x49')]:_0x308875[_0xd6ce('0x48')];_0x1e9a4e['order']=qs[_0xd6ce('0x4e')](_0x24d5bb[_0xd6ce('0x45')][_0xd6ce('0x4e')]);_0x1e9a4e[_0xd6ce('0x4f')]=qs[_0xd6ce('0x50')](_['pick'](_0x24d5bb[_0xd6ce('0x45')],_0x308875['filters']));if(_0x24d5bb[_0xd6ce('0x45')][_0xd6ce('0x51')]){_0x1e9a4e[_0xd6ce('0x4f')]=_[_0xd6ce('0x52')](_0x1e9a4e[_0xd6ce('0x4f')],{'$or':_[_0xd6ce('0x3f')](_0x1e9a4e['attributes'],function(_0x213a73){var _0x104384={};_0x104384[_0x213a73]={'$like':'%'+_0x24d5bb[_0xd6ce('0x45')]['filter']+'%'};return _0x104384;})});}_0x1e9a4e=_[_0xd6ce('0x52')]({},_0x1e9a4e,_0x24d5bb[_0xd6ce('0x54')]);return _0x5824ab[_0xd6ce('0xb2')](_0x1e9a4e);}})[_0xd6ce('0x21')](function(_0x29bc58){if(_0x29bc58){_0x5a22ec=_0x29bc58[_0xd6ce('0x4b')];if(!_0x24d5bb[_0xd6ce('0x45')][_0xd6ce('0x4c')](_0xd6ce('0x4d'))){_0x1e9a4e[_0xd6ce('0x2f')]=qs[_0xd6ce('0x2f')](_0x24d5bb['query'][_0xd6ce('0x2f')]);_0x1e9a4e[_0xd6ce('0x31')]=qs[_0xd6ce('0x31')](_0x24d5bb['query'][_0xd6ce('0x31')]);}return _0x5824ab[_0xd6ce('0xb2')](_0x1e9a4e);}})[_0xd6ce('0x21')](function(_0x243aea){if(_0x243aea){return _0x243aea?{'count':_0x5a22ec,'rows':_0x243aea}:null;}})[_0xd6ce('0x21')](respondWithResult(_0x6b8af,null))['catch'](handleError(_0x6b8af,null));};exports[_0xd6ce('0x3c')]=function(_0x1e96ed,_0x41b3c3,_0x2e78b2){var _0x5c7136,_0x2368f6,_0x59692e;if(_['isNil'](_0x1e96ed[_0xd6ce('0x5d')]['body'])||_0x1e96ed[_0xd6ce('0x5d')][_0xd6ce('0x5d')]===''){throw new db['Sequelize']['ValidationError'](_0xd6ce('0x79'));}if(_[_0xd6ce('0x77')](_0x1e96ed[_0xd6ce('0x5d')]['to'])){}_0x5c7136=_0x1e96ed[_0xd6ce('0x5d')]['to'];return db[_0xd6ce('0x40')][_0xd6ce('0x6c')]({'where':{'id':_0x1e96ed[_0xd6ce('0x59')]['id']}})['then'](handleEntityNotFound(_0x41b3c3,null))[_0xd6ce('0x21')](function(_0x3bcb5d){if(_0x3bcb5d){return db[_0xd6ce('0x40')]['find']({'where':{'id':_0x3bcb5d['id']},'include':[{'model':db[_0xd6ce('0x7e')],'as':'List','include':[{'model':db[_0xd6ce('0x6f')],'as':'Contacts','where':{[_0x3bcb5d['mapKey']]:_0x5c7136},'limit':0x1,'order':[[_0xd6ce('0x75'),_0xd6ce('0x81')]]}]}]})[_0xd6ce('0x21')](handleEntityNotFound(_0x41b3c3,null))['then'](function(_0x2cb0e5){if(_0x2cb0e5&&_0x2cb0e5['List']){_0x2368f6=_0x2cb0e5[_0xd6ce('0x37')]({'plain':!![]});if(_0x2368f6[_0xd6ce('0x7f')]&&_0x2368f6['List'][_0xd6ce('0x80')][_0xd6ce('0x4b')]){return _0x2368f6[_0xd6ce('0x7f')][_0xd6ce('0x80')][0x0];}return db[_0xd6ce('0x6f')][_0xd6ce('0x5c')](_['defaults'](_0x1e96ed[_0xd6ce('0x5d')],{'firstName':_0x5c7136,[_0x2cb0e5[_0xd6ce('0x7a')]]:_0x5c7136,'phone':_0x5c7136,'ListId':_0x2368f6[_0xd6ce('0x76')]}));}})[_0xd6ce('0x21')](handleEntityNotFound(_0x41b3c3,null))[_0xd6ce('0x21')](function(_0x42bac4){if(_0x42bac4){_0x59692e=_0x42bac4;return db[_0xd6ce('0x8d')][_0xd6ce('0x5b')]({'where':{'ContactId':_0x59692e['id'],'closed':![],'OpenchannelAccountId':_0x2368f6['id']}})[_0xd6ce('0x21')](function(_0x17326e){if(_0x17326e){return[_0x17326e,![]];}return db['OpenchannelInteraction']['create']({'UserId':_0x1e96ed[_0xd6ce('0x5e')]['id'],'ContactId':_0x59692e['id'],'OpenchannelAccountId':_0x2368f6['id'],'lastMsgDirection':_0xd6ce('0xb3'),'Messages':[_['merge'](_0x1e96ed[_0xd6ce('0x5d')],{'read':![],'body':_0x1e96ed['body'][_0xd6ce('0x5d')],'OpenchannelAccountId':_0x2368f6['id'],'UserId':_0x1e96ed['user']['id'],'ContactId':_0x59692e['id']})]},{'include':[{'model':db[_0xd6ce('0x98')],'as':'Messages'}]})[_0xd6ce('0x21')](function(_0xe9034f){return[_0xe9034f,!![]];});});}})[_0xd6ce('0x90')](function(_0x391817,_0x47eea5){if(_0x47eea5){return _0x391817;}return db[_0xd6ce('0x98')]['create'](_['merge'](_0x1e96ed['body'],{'read':![],'body':_0x1e96ed[_0xd6ce('0x5d')][_0xd6ce('0x5d')],'OpenchannelAccountId':_0x2368f6['id'],'OpenchannelInteractionId':_0x391817['id'],'UserId':_0x1e96ed['user']['id'],'ContactId':_0x59692e['id']}))['then'](function(_0x3716d4){_0x391817[_0xd6ce('0xb4')][_0xd6ce('0xb5')]=[];_0x391817[_0xd6ce('0xb4')][_0xd6ce('0xb5')][_0xd6ce('0x94')](_0x3716d4['dataValues']);return _0x391817;});});}})['then'](respondWithResult(_0x41b3c3,null))['catch'](handleError(_0x41b3c3,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index 3934f26..7779e55 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 _0x6f7a=['events','../../mysqldb','OpenchannelAccount','setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x6f7a,0x1ae));var _0xa6f7=function(_0x5d3690,_0x3d9da4){_0x5d3690=_0x5d3690-0x0;var _0x1cecd9=_0x6f7a[_0x5d3690];return _0x1cecd9;};'use strict';var EventEmitter=require(_0xa6f7('0x0'));var OpenchannelAccount=require(_0xa6f7('0x1'))['db'][_0xa6f7('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0xa6f7('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xa6f7('0x4'),'afterDestroy':_0xa6f7('0x5')};function emitEvent(_0x12ecb8){return function(_0x1da6dc,_0x22e529,_0x1f5922){OpenchannelAccountEvents[_0xa6f7('0x6')](_0x12ecb8+':'+_0x1da6dc['id'],_0x1da6dc);OpenchannelAccountEvents[_0xa6f7('0x6')](_0x12ecb8,_0x1da6dc);_0x1f5922(null);};}for(var e in events){if(events[_0xa6f7('0x7')](e)){var event=events[e];OpenchannelAccount[_0xa6f7('0x8')](e,emitEvent(event));}}module[_0xa6f7('0x9')]=OpenchannelAccountEvents; \ No newline at end of file +var _0x9c44=['save','update','remove','emit','hasOwnProperty','hook','exports','OpenchannelAccount','setMaxListeners'];(function(_0x392956,_0x53076f){var _0x4b0b57=function(_0x5273a1){while(--_0x5273a1){_0x392956['push'](_0x392956['shift']());}};_0x4b0b57(++_0x53076f);}(_0x9c44,0x178));var _0x49c4=function(_0x45d55e,_0x2fede3){_0x45d55e=_0x45d55e-0x0;var _0x29812a=_0x9c44[_0x45d55e];return _0x29812a;};'use strict';var EventEmitter=require('events');var OpenchannelAccount=require('../../mysqldb')['db'][_0x49c4('0x0')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x49c4('0x1')](0x0);var events={'afterCreate':_0x49c4('0x2'),'afterUpdate':_0x49c4('0x3'),'afterDestroy':_0x49c4('0x4')};function emitEvent(_0x2ad237){return function(_0x4e0313,_0x4941f1,_0x41a183){OpenchannelAccountEvents['emit'](_0x2ad237+':'+_0x4e0313['id'],_0x4e0313);OpenchannelAccountEvents[_0x49c4('0x5')](_0x2ad237,_0x4e0313);_0x41a183(null);};}for(var e in events){if(events[_0x49c4('0x6')](e)){var event=events[e];OpenchannelAccount[_0x49c4('0x7')](e,emitEvent(event));}}module[_0x49c4('0x8')]=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index 52d5c21..7238dba 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(_0x4a00e8,_0x807f39){var _0x131551=function(_0x1d6708){while(--_0x1d6708){_0x4a00e8['push'](_0x4a00e8['shift']());}};_0x131551(++_0x807f39);}(_0xa9e0,0x123));var _0x0a9e=function(_0x138f59,_0x1b53fb){_0x138f59=_0x138f59-0x0;var _0x3d114d=_0xa9e0[_0x138f59];return _0x3d114d;};'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(_0xf83e56,_0x351cf0){var _0x437d7a=function(_0x187878){while(--_0x187878){_0xf83e56['push'](_0xf83e56['shift']());}};_0x437d7a(++_0x351cf0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37c22c,_0x28a70d){_0x37c22c=_0x37c22c-0x0;var _0x119d79=_0xa9e0[_0x37c22c];return _0x119d79;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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 989612b..0e49b2c 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 _0x2e54=['client','http','defaults','localhost','redis','./openchannelAccount.socket','register','request','info','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelAccount,\x20%s,\x20%s','message','result','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0xd7398a,_0x1572ab){var _0x176acc=function(_0x3024b3){while(--_0x3024b3){_0xd7398a['push'](_0xd7398a['shift']());}};_0x176acc(++_0x1572ab);}(_0x2e54,0x1dd));var _0x42e5=function(_0x4b544a,_0x2890b4){_0x4b544a=_0x4b544a-0x0;var _0x5eb948=_0x2e54[_0x4b544a];return _0x5eb948;};'use strict';var _=require(_0x42e5('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x42e5('0x1'));var rs=require(_0x42e5('0x2'));var fs=require('fs');var Redis=require(_0x42e5('0x3'));var db=require(_0x42e5('0x4'))['db'];var utils=require(_0x42e5('0x5'));var logger=require(_0x42e5('0x6'))(_0x42e5('0x7'));var config=require('../../config/environment');var jayson=require(_0x42e5('0x8'));var client=jayson[_0x42e5('0x9')][_0x42e5('0xa')]({'port':0x232a});config['redis']=_[_0x42e5('0xb')](config['redis'],{'host':_0x42e5('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x42e5('0xd')]));require(_0x42e5('0xe'))[_0x42e5('0xf')](socket);function respondWithRpcPromise(_0x15f9f1,_0x206bf3,_0x1e5d2d){return new BPromise(function(_0xe1ab4b,_0x2fa2f0){return client[_0x42e5('0x10')](_0x15f9f1,_0x1e5d2d)['then'](function(_0x456298){logger[_0x42e5('0x11')]('OpenchannelAccount,\x20%s,\x20%s',_0x206bf3,_0x42e5('0x12'));logger[_0x42e5('0x13')](_0x42e5('0x14'),_0x206bf3,_0x42e5('0x12'),JSON[_0x42e5('0x15')](_0x456298));if(_0x456298[_0x42e5('0x16')]){if(_0x456298[_0x42e5('0x16')][_0x42e5('0x17')]===0x1f4){logger[_0x42e5('0x16')](_0x42e5('0x18'),_0x206bf3,_0x456298['error'][_0x42e5('0x19')]);return _0x2fa2f0(_0x456298[_0x42e5('0x16')][_0x42e5('0x19')]);}logger[_0x42e5('0x16')](_0x42e5('0x18'),_0x206bf3,_0x456298[_0x42e5('0x16')][_0x42e5('0x19')]);return _0xe1ab4b(_0x456298[_0x42e5('0x16')][_0x42e5('0x19')]);}else{logger[_0x42e5('0x11')](_0x42e5('0x18'),_0x206bf3,_0x42e5('0x12'));_0xe1ab4b(_0x456298[_0x42e5('0x1a')][_0x42e5('0x19')]);}})['catch'](function(_0x1460c0){logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0x206bf3,_0x1460c0);_0x2fa2f0(_0x1460c0);});});} \ No newline at end of file +var _0x8caf=['OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','register','then','info','OpenchannelAccount,\x20%s,\x20%s','debug'];(function(_0x39bf21,_0x5c2e3f){var _0x19c6e9=function(_0xe79045){while(--_0xe79045){_0x39bf21['push'](_0x39bf21['shift']());}};_0x19c6e9(++_0x5c2e3f);}(_0x8caf,0x1ab));var _0xf8ca=function(_0x4b36bd,_0x25a84a){_0x4b36bd=_0x4b36bd-0x0;var _0xb4a41f=_0x8caf[_0x4b36bd];return _0xb4a41f;};'use strict';var _=require('lodash');var util=require(_0xf8ca('0x0'));var moment=require(_0xf8ca('0x1'));var BPromise=require(_0xf8ca('0x2'));var rs=require(_0xf8ca('0x3'));var fs=require('fs');var Redis=require(_0xf8ca('0x4'));var db=require(_0xf8ca('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xf8ca('0x6'))(_0xf8ca('0x7'));var config=require(_0xf8ca('0x8'));var jayson=require(_0xf8ca('0x9'));var client=jayson[_0xf8ca('0xa')][_0xf8ca('0xb')]({'port':0x232a});config['redis']=_[_0xf8ca('0xc')](config[_0xf8ca('0xd')],{'host':_0xf8ca('0xe'),'port':0x18eb});var socket=require(_0xf8ca('0xf'))(new Redis(config['redis']));require('./openchannelAccount.socket')[_0xf8ca('0x10')](socket);function respondWithRpcPromise(_0x576e9d,_0x2f67c5,_0x2e86a6){return new BPromise(function(_0x2daa43,_0x2be477){return client['request'](_0x576e9d,_0x2e86a6)[_0xf8ca('0x11')](function(_0x6f3f7b){logger[_0xf8ca('0x12')](_0xf8ca('0x13'),_0x2f67c5,'request\x20sent');logger[_0xf8ca('0x14')](_0xf8ca('0x15'),_0x2f67c5,'request\x20sent',JSON[_0xf8ca('0x16')](_0x6f3f7b));if(_0x6f3f7b[_0xf8ca('0x17')]){if(_0x6f3f7b[_0xf8ca('0x17')][_0xf8ca('0x18')]===0x1f4){logger[_0xf8ca('0x17')](_0xf8ca('0x13'),_0x2f67c5,_0x6f3f7b[_0xf8ca('0x17')][_0xf8ca('0x19')]);return _0x2be477(_0x6f3f7b[_0xf8ca('0x17')][_0xf8ca('0x19')]);}logger['error'](_0xf8ca('0x13'),_0x2f67c5,_0x6f3f7b[_0xf8ca('0x17')][_0xf8ca('0x19')]);return _0x2daa43(_0x6f3f7b[_0xf8ca('0x17')][_0xf8ca('0x19')]);}else{logger[_0xf8ca('0x12')](_0xf8ca('0x13'),_0x2f67c5,_0xf8ca('0x1a'));_0x2daa43(_0x6f3f7b['result'][_0xf8ca('0x19')]);}})[_0xf8ca('0x1b')](function(_0x17eefa){logger[_0xf8ca('0x17')]('OpenchannelAccount,\x20%s,\x20%s',_0x2f67c5,_0x17eefa);_0x2be477(_0x17eefa);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index 5569032..c0311e6 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 _0xe189=['update','removeListener','register','length','./openchannelAccount.events'];(function(_0x2ab8f0,_0x4e477f){var _0x24949b=function(_0x1e65be){while(--_0x1e65be){_0x2ab8f0['push'](_0x2ab8f0['shift']());}};_0x24949b(++_0x4e477f);}(_0xe189,0x194));var _0x9e18=function(_0x54249c,_0x49ef18){_0x54249c=_0x54249c-0x0;var _0x1a4841=_0xe189[_0x54249c];return _0x1a4841;};'use strict';var OpenchannelAccountEvents=require(_0x9e18('0x0'));var events=['save','remove',_0x9e18('0x1')];function createListener(_0x2bc037,_0x22eac1){return function(_0x30a009){_0x22eac1['emit'](_0x2bc037,_0x30a009);};}function removeListener(_0x49b0f7,_0x1c652d){return function(){OpenchannelAccountEvents[_0x9e18('0x2')](_0x49b0f7,_0x1c652d);};}exports[_0x9e18('0x3')]=function(_0x53d7c9){for(var _0x3e6881=0x0,_0x5e6097=events[_0x9e18('0x4')];_0x3e6881<_0x5e6097;_0x3e6881++){var _0x2e4691=events[_0x3e6881];var _0x4656a4=createListener('openchannelAccount:'+_0x2e4691,_0x53d7c9);OpenchannelAccountEvents['on'](_0x2e4691,_0x4656a4);}}; \ No newline at end of file +var _0x0531=['emit','removeListener','register','length','openchannelAccount:','./openchannelAccount.events','save'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x0531,0xde));var _0x1053=function(_0x513aa5,_0x1fba79){_0x513aa5=_0x513aa5-0x0;var _0x1a1a7c=_0x0531[_0x513aa5];return _0x1a1a7c;};'use strict';var OpenchannelAccountEvents=require(_0x1053('0x0'));var events=[_0x1053('0x1'),'remove','update'];function createListener(_0x450b81,_0x48bca0){return function(_0x5ced96){_0x48bca0[_0x1053('0x2')](_0x450b81,_0x5ced96);};}function removeListener(_0x117b5a,_0x12d7ea){return function(){OpenchannelAccountEvents[_0x1053('0x3')](_0x117b5a,_0x12d7ea);};}exports[_0x1053('0x4')]=function(_0x5d8ce2){for(var _0x29e7cd=0x0,_0x3350a0=events[_0x1053('0x5')];_0x29e7cd<_0x3350a0;_0x29e7cd++){var _0x3d052e=events[_0x29e7cd];var _0x4f1877=createListener(_0x1053('0x6')+_0x3d052e,_0x5d8ce2);OpenchannelAccountEvents['on'](_0x3d052e,_0x4f1877);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index 08e355e..70ecd69 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 _0x8533=['path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','put','update','delete'];(function(_0x54e523,_0xfc81fc){var _0x1a8c62=function(_0x37401c){while(--_0x37401c){_0x54e523['push'](_0x54e523['shift']());}};_0x1a8c62(++_0xfc81fc);}(_0x8533,0x143));var _0x3853=function(_0x172935,_0x233b2){_0x172935=_0x172935-0x0;var _0xbaf254=_0x8533[_0x172935];return _0xbaf254;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3853('0x0'));var timeout=require(_0x3853('0x1'));var express=require(_0x3853('0x2'));var router=express[_0x3853('0x3')]();var fs_extra=require(_0x3853('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3853('0x5'));var config=require(_0x3853('0x6'));var controller=require('./openchannelApplication.controller');router[_0x3853('0x7')]('/',auth[_0x3853('0x8')](),controller[_0x3853('0x9')]);router[_0x3853('0x7')](_0x3853('0xa'),auth[_0x3853('0x8')](),controller[_0x3853('0xb')]);router[_0x3853('0xc')]('/',auth['isAuthenticated'](),controller[_0x3853('0xd')]);router[_0x3853('0xe')](_0x3853('0xa'),auth[_0x3853('0x8')](),controller[_0x3853('0xf')]);router[_0x3853('0x10')](_0x3853('0xa'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x865e=['connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','get','isAuthenticated','index','show','post','create','put','/:id','update','delete','destroy','exports','multer','util','path'];(function(_0x37acd9,_0x3871d0){var _0x3520d7=function(_0x28ca1e){while(--_0x28ca1e){_0x37acd9['push'](_0x37acd9['shift']());}};_0x3520d7(++_0x3871d0);}(_0x865e,0xf9));var _0xe865=function(_0xe73080,_0x24c56d){_0xe73080=_0xe73080-0x0;var _0x12cbc4=_0x865e[_0xe73080];return _0x12cbc4;};'use strict';var multer=require(_0xe865('0x0'));var util=require(_0xe865('0x1'));var path=require(_0xe865('0x2'));var timeout=require(_0xe865('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xe865('0x4'));var auth=require(_0xe865('0x5'));var interaction=require(_0xe865('0x6'));var config=require(_0xe865('0x7'));var controller=require(_0xe865('0x8'));router[_0xe865('0x9')]('/',auth[_0xe865('0xa')](),controller[_0xe865('0xb')]);router[_0xe865('0x9')]('/:id',auth[_0xe865('0xa')](),controller[_0xe865('0xc')]);router[_0xe865('0xd')]('/',auth[_0xe865('0xa')](),controller[_0xe865('0xe')]);router[_0xe865('0xf')](_0xe865('0x10'),auth[_0xe865('0xa')](),controller[_0xe865('0x11')]);router[_0xe865('0x12')](_0xe865('0x10'),auth[_0xe865('0xa')](),controller[_0xe865('0x13')]);module[_0xe865('0x14')]=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index 3f7a6f8..33988a9 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 _0xfabd=['noop','TEXT','*,*,*,*','sequelize','exports','STRING'];(function(_0x5839eb,_0x549e4b){var _0x7af38a=function(_0x225f45){while(--_0x225f45){_0x5839eb['push'](_0x5839eb['shift']());}};_0x7af38a(++_0x549e4b);}(_0xfabd,0x105));var _0xdfab=function(_0x345f99,_0x57ab28){_0x345f99=_0x345f99-0x0;var _0x251682=_0xfabd[_0x345f99];return _0x251682;};'use strict';var Sequelize=require(_0xdfab('0x0'));module[_0xdfab('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xdfab('0x2')],'allowNull':![],'defaultValue':_0xdfab('0x3')},'appdata':{'type':Sequelize[_0xdfab('0x4')]()},'description':{'type':Sequelize[_0xdfab('0x2')]},'interval':{'type':Sequelize[_0xdfab('0x2')],'defaultValue':_0xdfab('0x5')}}; \ No newline at end of file +var _0xea90=['noop','TEXT','*,*,*,*','exports','INTEGER','STRING'];(function(_0x3c5219,_0x1ee661){var _0x346e36=function(_0x4e9df9){while(--_0x4e9df9){_0x3c5219['push'](_0x3c5219['shift']());}};_0x346e36(++_0x1ee661);}(_0xea90,0x1ad));var _0x0ea9=function(_0x3891fe,_0x4101bb){_0x3891fe=_0x3891fe-0x0;var _0x575c3a=_0xea90[_0x3891fe];return _0x575c3a;};'use strict';var Sequelize=require('sequelize');module[_0x0ea9('0x0')]={'priority':{'type':Sequelize[_0x0ea9('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x0ea9('0x2')],'allowNull':![],'defaultValue':_0x0ea9('0x3')},'appdata':{'type':Sequelize[_0x0ea9('0x4')]()},'description':{'type':Sequelize[_0x0ea9('0x2')]},'interval':{'type':Sequelize[_0x0ea9('0x2')],'defaultValue':_0x0ea9('0x5')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index 5f7b5d5..aeb2c83 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 _0x36de=['intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','rows','show','length','find','create','body','params','catch','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','limit','undefined','count','offset','set','Content-Range','reject','update','then','destroy','name','send','index','map','OpenchannelApplication','rawAttributes','type','key','model','query','keys','filters'];(function(_0x12f7d1,_0xea85b3){var _0x17a408=function(_0x38e09a){while(--_0x38e09a){_0x12f7d1['push'](_0x12f7d1['shift']());}};_0x17a408(++_0xea85b3);}(_0x36de,0x1ba));var _0xe36d=function(_0x116265,_0x239668){_0x116265=_0x116265-0x0;var _0x46e771=_0x36de[_0x116265];return _0x46e771;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe36d('0x0'));var zipdir=require(_0xe36d('0x1'));var jsonpatch=require(_0xe36d('0x2'));var rp=require('request-promise');var moment=require(_0xe36d('0x3'));var BPromise=require(_0xe36d('0x4'));var Mustache=require(_0xe36d('0x5'));var util=require(_0xe36d('0x6'));var path=require('path');var sox=require(_0xe36d('0x7'));var csv=require('to-csv');var ejs=require(_0xe36d('0x8'));var fs=require('fs');var fs_extra=require(_0xe36d('0x9'));var _=require(_0xe36d('0xa'));var squel=require('squel');var crypto=require(_0xe36d('0xb'));var jsforce=require(_0xe36d('0xc'));var deskjs=require(_0xe36d('0xd'));var toCsv=require('to-csv');var querystring=require(_0xe36d('0xe'));var Papa=require('papaparse');var Redis=require(_0xe36d('0xf'));var authService=require(_0xe36d('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe36d('0x11'));var logger=require(_0xe36d('0x12'))(_0xe36d('0x13'));var utils=require(_0xe36d('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xe36d('0x15'));var db=require(_0xe36d('0x16'))['db'];function respondWithStatusCode(_0x40a0a0,_0x5d6aa0){_0x5d6aa0=_0x5d6aa0||0xcc;return function(_0xb0c1ff){if(_0xb0c1ff){return _0x40a0a0['sendStatus'](_0x5d6aa0);}return _0x40a0a0[_0xe36d('0x17')](_0x5d6aa0)[_0xe36d('0x18')]();};}function respondWithResult(_0x5bf311,_0x2290da){_0x2290da=_0x2290da||0xc8;return function(_0x4ed489){if(_0x4ed489){return _0x5bf311['status'](_0x2290da)[_0xe36d('0x19')](_0x4ed489);}};}function respondWithFilteredResult(_0x207fa2,_0x171b73){return function(_0x2321a0){if(_0x2321a0){var _0xb136b7=typeof _0x171b73['offset']==='undefined'&&typeof _0x171b73[_0xe36d('0x1a')]===_0xe36d('0x1b');var _0x47547b=_0x2321a0[_0xe36d('0x1c')];var _0x12b594=_0xb136b7?0x0:_0x171b73[_0xe36d('0x1d')];var _0x3d8b6b=_0xb136b7?_0x2321a0[_0xe36d('0x1c')]:_0x171b73[_0xe36d('0x1d')]+_0x171b73[_0xe36d('0x1a')];var _0x24ebdf;if(_0x3d8b6b>=_0x47547b){_0x3d8b6b=_0x47547b;_0x24ebdf=0xc8;}else{_0x24ebdf=0xce;}_0x207fa2['status'](_0x24ebdf);return _0x207fa2[_0xe36d('0x1e')](_0xe36d('0x1f'),_0x12b594+'-'+_0x3d8b6b+'/'+_0x47547b)[_0xe36d('0x19')](_0x2321a0);}return null;};}function patchUpdates(_0x132668){return function(_0x5cec3b){try{jsonpatch['apply'](_0x5cec3b,_0x132668,!![]);}catch(_0x467025){return BPromise[_0xe36d('0x20')](_0x467025);}return _0x5cec3b['save']();};}function saveUpdates(_0x18b6cc,_0x1c6fa6){return function(_0x3ae080){if(_0x3ae080){return _0x3ae080[_0xe36d('0x21')](_0x18b6cc)[_0xe36d('0x22')](function(_0x502058){return _0x502058;});}return null;};}function removeEntity(_0x25491c,_0x4c27d7){return function(_0x55aaa3){if(_0x55aaa3){return _0x55aaa3[_0xe36d('0x23')]()[_0xe36d('0x22')](function(){_0x25491c[_0xe36d('0x17')](0xcc)[_0xe36d('0x18')]();});}};}function handleEntityNotFound(_0xe72f3b,_0x453477){return function(_0x9c5512){if(!_0x9c5512){_0xe72f3b['sendStatus'](0x194);}return _0x9c5512;};}function handleError(_0x49afaa,_0x5dbce0){_0x5dbce0=_0x5dbce0||0x1f4;return function(_0x2428a0){logger['error'](_0x2428a0['stack']);if(_0x2428a0[_0xe36d('0x24')]){delete _0x2428a0[_0xe36d('0x24')];}_0x49afaa[_0xe36d('0x17')](_0x5dbce0)[_0xe36d('0x25')](_0x2428a0);};}exports[_0xe36d('0x26')]=function(_0x15077c,_0x503560){var _0x2f0995={},_0x1782b6={},_0x269f87={'count':0x0,'rows':[]};var _0x57cc6=_[_0xe36d('0x27')](db[_0xe36d('0x28')][_0xe36d('0x29')],function(_0x42b387){return{'name':_0x42b387['fieldName'],'type':_0x42b387[_0xe36d('0x2a')][_0xe36d('0x2b')]};});_0x1782b6[_0xe36d('0x2c')]=_[_0xe36d('0x27')](_0x57cc6,'name');_0x1782b6[_0xe36d('0x2d')]=_[_0xe36d('0x2e')](_0x15077c[_0xe36d('0x2d')]);_0x1782b6[_0xe36d('0x2f')]=_['intersection'](_0x1782b6[_0xe36d('0x2c')],_0x1782b6[_0xe36d('0x2d')]);_0x2f0995['attributes']=_[_0xe36d('0x30')](_0x1782b6[_0xe36d('0x2c')],qs[_0xe36d('0x31')](_0x15077c[_0xe36d('0x2d')][_0xe36d('0x31')]));_0x2f0995[_0xe36d('0x32')]=_0x2f0995[_0xe36d('0x32')]['length']?_0x2f0995[_0xe36d('0x32')]:_0x1782b6[_0xe36d('0x2c')];if(!_0x15077c[_0xe36d('0x2d')][_0xe36d('0x33')](_0xe36d('0x34'))){_0x2f0995['limit']=qs[_0xe36d('0x1a')](_0x15077c[_0xe36d('0x2d')][_0xe36d('0x1a')]);_0x2f0995[_0xe36d('0x1d')]=qs[_0xe36d('0x1d')](_0x15077c[_0xe36d('0x2d')]['offset']);}_0x2f0995[_0xe36d('0x35')]=qs[_0xe36d('0x36')](_0x15077c[_0xe36d('0x2d')][_0xe36d('0x36')]);_0x2f0995[_0xe36d('0x37')]=qs[_0xe36d('0x2f')](_[_0xe36d('0x38')](_0x15077c[_0xe36d('0x2d')],_0x1782b6[_0xe36d('0x2f')]),_0x57cc6);if(_0x15077c['query'][_0xe36d('0x39')]){_0x2f0995[_0xe36d('0x37')]=_[_0xe36d('0x3a')](_0x2f0995['where'],{'$or':_['map'](_0x57cc6,function(_0x240cd8){if(_0x240cd8[_0xe36d('0x2a')]!==_0xe36d('0x3b')){var _0x414855={};_0x414855[_0x240cd8[_0xe36d('0x24')]]={'$like':'%'+_0x15077c['query'][_0xe36d('0x39')]+'%'};return _0x414855;}})});}_0x2f0995=_[_0xe36d('0x3a')]({},_0x2f0995,_0x15077c[_0xe36d('0x3c')]);var _0x3b8675={'where':_0x2f0995[_0xe36d('0x37')]};return db['OpenchannelApplication'][_0xe36d('0x1c')](_0x3b8675)[_0xe36d('0x22')](function(_0x237546){_0x269f87[_0xe36d('0x1c')]=_0x237546;if(_0x15077c[_0xe36d('0x2d')][_0xe36d('0x3d')]){_0x2f0995['include']=[{'all':!![]}];}return db[_0xe36d('0x28')]['findAll'](_0x2f0995);})[_0xe36d('0x22')](function(_0x4a5cf5){_0x269f87[_0xe36d('0x3e')]=_0x4a5cf5;return _0x269f87;})[_0xe36d('0x22')](respondWithFilteredResult(_0x503560,_0x2f0995))['catch'](handleError(_0x503560,null));};exports[_0xe36d('0x3f')]=function(_0x407804,_0x4fb61e){var _0x488014={'raw':!![],'where':{'id':_0x407804['params']['id']}},_0x2a29b1={};_0x2a29b1[_0xe36d('0x2c')]=_[_0xe36d('0x2e')](db['OpenchannelApplication'][_0xe36d('0x29')]);_0x2a29b1[_0xe36d('0x2d')]=_[_0xe36d('0x2e')](_0x407804[_0xe36d('0x2d')]);_0x2a29b1[_0xe36d('0x2f')]=_[_0xe36d('0x30')](_0x2a29b1[_0xe36d('0x2c')],_0x2a29b1[_0xe36d('0x2d')]);_0x488014[_0xe36d('0x32')]=_[_0xe36d('0x30')](_0x2a29b1[_0xe36d('0x2c')],qs[_0xe36d('0x31')](_0x407804['query'][_0xe36d('0x31')]));_0x488014[_0xe36d('0x32')]=_0x488014[_0xe36d('0x32')][_0xe36d('0x40')]?_0x488014[_0xe36d('0x32')]:_0x2a29b1['model'];if(_0x407804[_0xe36d('0x2d')][_0xe36d('0x3d')]){_0x488014['include']=[{'all':!![]}];}_0x488014=_[_0xe36d('0x3a')]({},_0x488014,_0x407804[_0xe36d('0x3c')]);return db[_0xe36d('0x28')][_0xe36d('0x41')](_0x488014)[_0xe36d('0x22')](handleEntityNotFound(_0x4fb61e,null))[_0xe36d('0x22')](respondWithResult(_0x4fb61e,null))['catch'](handleError(_0x4fb61e,null));};exports[_0xe36d('0x42')]=function(_0x58c6c9,_0x4d95fb){return db[_0xe36d('0x28')][_0xe36d('0x42')](_0x58c6c9[_0xe36d('0x43')],{})['then'](respondWithResult(_0x4d95fb,0xc9))['catch'](handleError(_0x4d95fb,null));};exports[_0xe36d('0x21')]=function(_0x16fa1d,_0x3950cf){if(_0x16fa1d[_0xe36d('0x43')]['id']){delete _0x16fa1d[_0xe36d('0x43')]['id'];}return db[_0xe36d('0x28')]['find']({'where':{'id':_0x16fa1d[_0xe36d('0x44')]['id']}})[_0xe36d('0x22')](handleEntityNotFound(_0x3950cf,null))[_0xe36d('0x22')](saveUpdates(_0x16fa1d[_0xe36d('0x43')],null))[_0xe36d('0x22')](respondWithResult(_0x3950cf,null))['catch'](handleError(_0x3950cf,null));};exports['destroy']=function(_0x1d5e33,_0x244399){return db[_0xe36d('0x28')][_0xe36d('0x41')]({'where':{'id':_0x1d5e33['params']['id']}})[_0xe36d('0x22')](handleEntityNotFound(_0x244399,null))[_0xe36d('0x22')](removeEntity(_0x244399,null))[_0xe36d('0x45')](handleError(_0x244399,null));}; \ No newline at end of file +var _0xa150=['name','map','fieldName','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','options','OpenchannelApplication','includeAll','findAll','rows','catch','params','keys','rawAttributes','length','include','find','create','body','update','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','apply','save','then','error','stack'];(function(_0xd22b49,_0xf4bd29){var _0x3d0727=function(_0xe0e82b){while(--_0xe0e82b){_0xd22b49['push'](_0xd22b49['shift']());}};_0x3d0727(++_0xf4bd29);}(_0xa150,0x180));var _0x0a15=function(_0xcf7718,_0x137462){_0xcf7718=_0xcf7718-0x0;var _0x4d7850=_0xa150[_0xcf7718];return _0x4d7850;};'use strict';var emlformat=require(_0x0a15('0x0'));var rimraf=require(_0x0a15('0x1'));var zipdir=require(_0x0a15('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0a15('0x3'));var moment=require(_0x0a15('0x4'));var BPromise=require(_0x0a15('0x5'));var Mustache=require('mustache');var util=require(_0x0a15('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x0a15('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0a15('0x8'));var squel=require(_0x0a15('0x9'));var crypto=require(_0x0a15('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x0a15('0xb'));var toCsv=require('to-csv');var querystring=require(_0x0a15('0xc'));var Papa=require(_0x0a15('0xd'));var Redis=require(_0x0a15('0xe'));var authService=require(_0x0a15('0xf'));var qs=require(_0x0a15('0x10'));var as=require(_0x0a15('0x11'));var hardwareService=require(_0x0a15('0x12'));var logger=require('../../config/logger')(_0x0a15('0x13'));var utils=require(_0x0a15('0x14'));var config=require(_0x0a15('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x0a15('0x16'))['db'];function respondWithStatusCode(_0xa491f9,_0x447abd){_0x447abd=_0x447abd||0xcc;return function(_0x4c2d4f){if(_0x4c2d4f){return _0xa491f9[_0x0a15('0x17')](_0x447abd);}return _0xa491f9[_0x0a15('0x18')](_0x447abd)[_0x0a15('0x19')]();};}function respondWithResult(_0x3e450c,_0x274c2d){_0x274c2d=_0x274c2d||0xc8;return function(_0x2601c3){if(_0x2601c3){return _0x3e450c['status'](_0x274c2d)[_0x0a15('0x1a')](_0x2601c3);}};}function respondWithFilteredResult(_0x193ece,_0x152d68){return function(_0x3aa08d){if(_0x3aa08d){var _0x46cbcd=typeof _0x152d68[_0x0a15('0x1b')]===_0x0a15('0x1c')&&typeof _0x152d68[_0x0a15('0x1d')]===_0x0a15('0x1c');var _0x432a2b=_0x3aa08d['count'];var _0x161eaf=_0x46cbcd?0x0:_0x152d68[_0x0a15('0x1b')];var _0x5834bd=_0x46cbcd?_0x3aa08d[_0x0a15('0x1e')]:_0x152d68[_0x0a15('0x1b')]+_0x152d68['limit'];var _0x13139f;if(_0x5834bd>=_0x432a2b){_0x5834bd=_0x432a2b;_0x13139f=0xc8;}else{_0x13139f=0xce;}_0x193ece[_0x0a15('0x18')](_0x13139f);return _0x193ece['set']('Content-Range',_0x161eaf+'-'+_0x5834bd+'/'+_0x432a2b)[_0x0a15('0x1a')](_0x3aa08d);}return null;};}function patchUpdates(_0x3ee95c){return function(_0x2de714){try{jsonpatch[_0x0a15('0x1f')](_0x2de714,_0x3ee95c,!![]);}catch(_0xa2a46){return BPromise['reject'](_0xa2a46);}return _0x2de714[_0x0a15('0x20')]();};}function saveUpdates(_0x27828d,_0x643e07){return function(_0x5bb6bf){if(_0x5bb6bf){return _0x5bb6bf['update'](_0x27828d)[_0x0a15('0x21')](function(_0x17d6b1){return _0x17d6b1;});}return null;};}function removeEntity(_0x4507a2,_0x3c57b2){return function(_0x3d22e9){if(_0x3d22e9){return _0x3d22e9['destroy']()[_0x0a15('0x21')](function(){_0x4507a2[_0x0a15('0x18')](0xcc)[_0x0a15('0x19')]();});}};}function handleEntityNotFound(_0x144298,_0x302276){return function(_0x318f0b){if(!_0x318f0b){_0x144298['sendStatus'](0x194);}return _0x318f0b;};}function handleError(_0x22b775,_0x10895e){_0x10895e=_0x10895e||0x1f4;return function(_0x1f35c5){logger[_0x0a15('0x22')](_0x1f35c5[_0x0a15('0x23')]);if(_0x1f35c5[_0x0a15('0x24')]){delete _0x1f35c5[_0x0a15('0x24')];}_0x22b775[_0x0a15('0x18')](_0x10895e)['send'](_0x1f35c5);};}exports['index']=function(_0x5555d5,_0x49afc6){var _0x162feb={},_0x1c9fd0={},_0x3e9328={'count':0x0,'rows':[]};var _0x4466c4=_[_0x0a15('0x25')](db['OpenchannelApplication']['rawAttributes'],function(_0x22e2a0){return{'name':_0x22e2a0[_0x0a15('0x26')],'type':_0x22e2a0['type'][_0x0a15('0x27')]};});_0x1c9fd0[_0x0a15('0x28')]=_[_0x0a15('0x25')](_0x4466c4,_0x0a15('0x24'));_0x1c9fd0['query']=_['keys'](_0x5555d5[_0x0a15('0x29')]);_0x1c9fd0[_0x0a15('0x2a')]=_[_0x0a15('0x2b')](_0x1c9fd0[_0x0a15('0x28')],_0x1c9fd0[_0x0a15('0x29')]);_0x162feb[_0x0a15('0x2c')]=_[_0x0a15('0x2b')](_0x1c9fd0['model'],qs[_0x0a15('0x2d')](_0x5555d5['query'][_0x0a15('0x2d')]));_0x162feb[_0x0a15('0x2c')]=_0x162feb[_0x0a15('0x2c')]['length']?_0x162feb[_0x0a15('0x2c')]:_0x1c9fd0[_0x0a15('0x28')];if(!_0x5555d5[_0x0a15('0x29')][_0x0a15('0x2e')](_0x0a15('0x2f'))){_0x162feb[_0x0a15('0x1d')]=qs[_0x0a15('0x1d')](_0x5555d5[_0x0a15('0x29')]['limit']);_0x162feb[_0x0a15('0x1b')]=qs[_0x0a15('0x1b')](_0x5555d5[_0x0a15('0x29')][_0x0a15('0x1b')]);}_0x162feb[_0x0a15('0x30')]=qs[_0x0a15('0x31')](_0x5555d5[_0x0a15('0x29')][_0x0a15('0x31')]);_0x162feb[_0x0a15('0x32')]=qs[_0x0a15('0x2a')](_[_0x0a15('0x33')](_0x5555d5[_0x0a15('0x29')],_0x1c9fd0['filters']),_0x4466c4);if(_0x5555d5[_0x0a15('0x29')]['filter']){_0x162feb[_0x0a15('0x32')]=_[_0x0a15('0x34')](_0x162feb[_0x0a15('0x32')],{'$or':_[_0x0a15('0x25')](_0x4466c4,function(_0x3c1604){if(_0x3c1604[_0x0a15('0x35')]!==_0x0a15('0x36')){var _0x13d1d3={};_0x13d1d3[_0x3c1604[_0x0a15('0x24')]]={'$like':'%'+_0x5555d5[_0x0a15('0x29')]['filter']+'%'};return _0x13d1d3;}})});}_0x162feb=_[_0x0a15('0x34')]({},_0x162feb,_0x5555d5[_0x0a15('0x37')]);var _0x5ee9e5={'where':_0x162feb[_0x0a15('0x32')]};return db[_0x0a15('0x38')][_0x0a15('0x1e')](_0x5ee9e5)[_0x0a15('0x21')](function(_0xa440ce){_0x3e9328[_0x0a15('0x1e')]=_0xa440ce;if(_0x5555d5[_0x0a15('0x29')][_0x0a15('0x39')]){_0x162feb['include']=[{'all':!![]}];}return db[_0x0a15('0x38')][_0x0a15('0x3a')](_0x162feb);})[_0x0a15('0x21')](function(_0x4d3465){_0x3e9328[_0x0a15('0x3b')]=_0x4d3465;return _0x3e9328;})['then'](respondWithFilteredResult(_0x49afc6,_0x162feb))[_0x0a15('0x3c')](handleError(_0x49afc6,null));};exports['show']=function(_0x443b13,_0x5a158c){var _0x3d4c7d={'raw':!![],'where':{'id':_0x443b13[_0x0a15('0x3d')]['id']}},_0x1ccf6e={};_0x1ccf6e['model']=_[_0x0a15('0x3e')](db['OpenchannelApplication'][_0x0a15('0x3f')]);_0x1ccf6e[_0x0a15('0x29')]=_[_0x0a15('0x3e')](_0x443b13[_0x0a15('0x29')]);_0x1ccf6e[_0x0a15('0x2a')]=_[_0x0a15('0x2b')](_0x1ccf6e[_0x0a15('0x28')],_0x1ccf6e[_0x0a15('0x29')]);_0x3d4c7d[_0x0a15('0x2c')]=_[_0x0a15('0x2b')](_0x1ccf6e[_0x0a15('0x28')],qs['fields'](_0x443b13[_0x0a15('0x29')][_0x0a15('0x2d')]));_0x3d4c7d[_0x0a15('0x2c')]=_0x3d4c7d[_0x0a15('0x2c')][_0x0a15('0x40')]?_0x3d4c7d[_0x0a15('0x2c')]:_0x1ccf6e['model'];if(_0x443b13[_0x0a15('0x29')][_0x0a15('0x39')]){_0x3d4c7d[_0x0a15('0x41')]=[{'all':!![]}];}_0x3d4c7d=_[_0x0a15('0x34')]({},_0x3d4c7d,_0x443b13[_0x0a15('0x37')]);return db[_0x0a15('0x38')][_0x0a15('0x42')](_0x3d4c7d)[_0x0a15('0x21')](handleEntityNotFound(_0x5a158c,null))[_0x0a15('0x21')](respondWithResult(_0x5a158c,null))[_0x0a15('0x3c')](handleError(_0x5a158c,null));};exports['create']=function(_0x2d42cf,_0x21a7f2){return db[_0x0a15('0x38')][_0x0a15('0x43')](_0x2d42cf[_0x0a15('0x44')],{})[_0x0a15('0x21')](respondWithResult(_0x21a7f2,0xc9))[_0x0a15('0x3c')](handleError(_0x21a7f2,null));};exports[_0x0a15('0x45')]=function(_0x30487c,_0x2bd88f){if(_0x30487c[_0x0a15('0x44')]['id']){delete _0x30487c[_0x0a15('0x44')]['id'];}return db[_0x0a15('0x38')][_0x0a15('0x42')]({'where':{'id':_0x30487c[_0x0a15('0x3d')]['id']}})[_0x0a15('0x21')](handleEntityNotFound(_0x2bd88f,null))[_0x0a15('0x21')](saveUpdates(_0x30487c[_0x0a15('0x44')],null))[_0x0a15('0x21')](respondWithResult(_0x2bd88f,null))['catch'](handleError(_0x2bd88f,null));};exports['destroy']=function(_0xa80e2b,_0x2e2447){return db[_0x0a15('0x38')][_0x0a15('0x42')]({'where':{'id':_0xa80e2b[_0x0a15('0x3d')]['id']}})['then'](handleEntityNotFound(_0x2e2447,null))[_0x0a15('0x21')](removeEntity(_0x2e2447,null))[_0x0a15('0x3c')](handleError(_0x2e2447,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index 9a9b389..41e29bc 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 _0xbe65=['utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','rimraf','../../config/environment','define','OpenchannelApplication','openchannel_applications'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbe65,0x12e));var _0x5be6=function(_0x2f2fd0,_0x3c980d){_0x2f2fd0=_0x2f2fd0-0x0;var _0x44f94f=_0xbe65[_0x2f2fd0];return _0x44f94f;};'use strict';var _=require(_0x5be6('0x0'));var util=require(_0x5be6('0x1'));var logger=require(_0x5be6('0x2'))('api');var moment=require(_0x5be6('0x3'));var BPromise=require(_0x5be6('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x5be6('0x5'));var config=require(_0x5be6('0x6'));var attributes=require('./openchannelApplication.attributes');module['exports']=function(_0x28f65e,_0x581f4e){return _0x28f65e[_0x5be6('0x7')](_0x5be6('0x8'),attributes,{'tableName':_0x5be6('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x5be6('0xa'),'collate':_0x5be6('0xb')});}; \ No newline at end of file +var _0x1cdf=['../../config/logger','api','moment','rimraf','./openchannelApplication.attributes','define','OpenchannelApplication','openchannel_applications','utf8mb4','lodash','util'];(function(_0x25156d,_0x28369e){var _0x23b543=function(_0x48b759){while(--_0x48b759){_0x25156d['push'](_0x25156d['shift']());}};_0x23b543(++_0x28369e);}(_0x1cdf,0x174));var _0xf1cd=function(_0x575153,_0x2f7733){_0x575153=_0x575153-0x0;var _0x11a4e=_0x1cdf[_0x575153];return _0x11a4e;};'use strict';var _=require(_0xf1cd('0x0'));var util=require(_0xf1cd('0x1'));var logger=require(_0xf1cd('0x2'))(_0xf1cd('0x3'));var moment=require(_0xf1cd('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xf1cd('0x5'));var config=require('../../config/environment');var attributes=require(_0xf1cd('0x6'));module['exports']=function(_0x177e5c,_0xb67448){return _0x177e5c[_0xf1cd('0x7')](_0xf1cd('0x8'),attributes,{'tableName':_0xf1cd('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xf1cd('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 bd68bd5..c51ef23 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 _0x95ae=['http','request','info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','UpdateOpenchannelApplication','OpenchannelApplication','update','options','attributes','limit','then','lodash','util','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x5492f3,_0x58d511){var _0x48ef6c=function(_0x502305){while(--_0x502305){_0x5492f3['push'](_0x5492f3['shift']());}};_0x48ef6c(++_0x58d511);}(_0x95ae,0x118));var _0xe95a=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x95ae[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0xe95a('0x0'));var util=require(_0xe95a('0x1'));var moment=require('moment');var BPromise=require(_0xe95a('0x2'));var rs=require(_0xe95a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xe95a('0x4'));var logger=require(_0xe95a('0x5'))(_0xe95a('0x6'));var config=require(_0xe95a('0x7'));var jayson=require(_0xe95a('0x8'));var client=jayson[_0xe95a('0x9')][_0xe95a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3595c2,_0x33cb4e,_0x5a56cd){return new BPromise(function(_0x4e7e13,_0x379cc3){return client[_0xe95a('0xb')](_0x3595c2,_0x5a56cd)['then'](function(_0x262097){logger[_0xe95a('0xc')](_0xe95a('0xd'),_0x33cb4e,_0xe95a('0xe'));logger[_0xe95a('0xf')](_0xe95a('0x10'),_0x33cb4e,_0xe95a('0xe'),JSON[_0xe95a('0x11')](_0x262097));if(_0x262097[_0xe95a('0x12')]){if(_0x262097[_0xe95a('0x12')][_0xe95a('0x13')]===0x1f4){logger[_0xe95a('0x12')](_0xe95a('0xd'),_0x33cb4e,_0x262097[_0xe95a('0x12')][_0xe95a('0x14')]);return _0x379cc3(_0x262097['error'][_0xe95a('0x14')]);}logger[_0xe95a('0x12')](_0xe95a('0xd'),_0x33cb4e,_0x262097[_0xe95a('0x12')][_0xe95a('0x14')]);return _0x4e7e13(_0x262097[_0xe95a('0x12')][_0xe95a('0x14')]);}else{logger[_0xe95a('0xc')]('OpenchannelApplication,\x20%s,\x20%s',_0x33cb4e,'request\x20sent');_0x4e7e13(_0x262097['result'][_0xe95a('0x14')]);}})[_0xe95a('0x15')](function(_0x2bd157){logger[_0xe95a('0x12')](_0xe95a('0xd'),_0x33cb4e,_0x2bd157);_0x379cc3(_0x2bd157);});});}exports[_0xe95a('0x16')]=function(_0x5bcc53){var _0x4ffa32=this;return new Promise(function(_0x50c056,_0x558cbd){return db[_0xe95a('0x17')][_0xe95a('0x18')](_0x5bcc53['body'],{'raw':_0x5bcc53[_0xe95a('0x19')]?_0x5bcc53[_0xe95a('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5bcc53['options']?_0x5bcc53[_0xe95a('0x19')]['where']||null:null,'attributes':_0x5bcc53['options']?_0x5bcc53[_0xe95a('0x19')][_0xe95a('0x1a')]||null:null,'limit':_0x5bcc53[_0xe95a('0x19')]?_0x5bcc53[_0xe95a('0x19')][_0xe95a('0x1b')]||null:null})[_0xe95a('0x1c')](function(_0x5ee47a){logger[_0xe95a('0xc')](_0xe95a('0x16'),_0x5bcc53);logger[_0xe95a('0xf')]('UpdateOpenchannelApplication',_0x5bcc53,JSON['stringify'](_0x5ee47a));_0x50c056(_0x5ee47a);})['catch'](function(_0x40a452){logger[_0xe95a('0x12')]('UpdateOpenchannelApplication',_0x40a452[_0xe95a('0x14')],_0x5bcc53);_0x558cbd(_0x4ffa32[_0xe95a('0x12')](0x1f4,_0x40a452[_0xe95a('0x14')]));});});}; \ No newline at end of file +var _0x239e=['raw','attributes','limit','catch','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','result','UpdateOpenchannelApplication','OpenchannelApplication','update','body','options'];(function(_0x28c4db,_0x2ccd05){var _0x5907ed=function(_0x1d83c2){while(--_0x1d83c2){_0x28c4db['push'](_0x28c4db['shift']());}};_0x5907ed(++_0x2ccd05);}(_0x239e,0xb8));var _0xe239=function(_0x59ee41,_0xaf7db8){_0x59ee41=_0x59ee41-0x0;var _0x3ecd3e=_0x239e[_0x59ee41];return _0x3ecd3e;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe239('0x0'));var BPromise=require(_0xe239('0x1'));var rs=require(_0xe239('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe239('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xe239('0x4'))(_0xe239('0x5'));var config=require(_0xe239('0x6'));var jayson=require(_0xe239('0x7'));var client=jayson[_0xe239('0x8')][_0xe239('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x59c180,_0x5cf774,_0x1ff908){return new BPromise(function(_0x4b18f4,_0x45c804){return client[_0xe239('0xa')](_0x59c180,_0x1ff908)[_0xe239('0xb')](function(_0x33ba46){logger[_0xe239('0xc')](_0xe239('0xd'),_0x5cf774,_0xe239('0xe'));logger[_0xe239('0xf')](_0xe239('0x10'),_0x5cf774,_0xe239('0xe'),JSON[_0xe239('0x11')](_0x33ba46));if(_0x33ba46[_0xe239('0x12')]){if(_0x33ba46[_0xe239('0x12')]['code']===0x1f4){logger[_0xe239('0x12')](_0xe239('0xd'),_0x5cf774,_0x33ba46[_0xe239('0x12')]['message']);return _0x45c804(_0x33ba46[_0xe239('0x12')][_0xe239('0x13')]);}logger[_0xe239('0x12')]('OpenchannelApplication,\x20%s,\x20%s',_0x5cf774,_0x33ba46['error'][_0xe239('0x13')]);return _0x4b18f4(_0x33ba46['error']['message']);}else{logger['info']('OpenchannelApplication,\x20%s,\x20%s',_0x5cf774,'request\x20sent');_0x4b18f4(_0x33ba46[_0xe239('0x14')][_0xe239('0x13')]);}})['catch'](function(_0x32a003){logger[_0xe239('0x12')]('OpenchannelApplication,\x20%s,\x20%s',_0x5cf774,_0x32a003);_0x45c804(_0x32a003);});});}exports[_0xe239('0x15')]=function(_0x47c445){var _0x3239c5=this;return new Promise(function(_0x2fd275,_0x5bc57f){return db[_0xe239('0x16')][_0xe239('0x17')](_0x47c445[_0xe239('0x18')],{'raw':_0x47c445['options']?_0x47c445[_0xe239('0x19')][_0xe239('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x47c445['options']?_0x47c445[_0xe239('0x19')]['where']||null:null,'attributes':_0x47c445['options']?_0x47c445[_0xe239('0x19')][_0xe239('0x1b')]||null:null,'limit':_0x47c445[_0xe239('0x19')]?_0x47c445[_0xe239('0x19')][_0xe239('0x1c')]||null:null})[_0xe239('0xb')](function(_0x17d766){logger[_0xe239('0xc')]('UpdateOpenchannelApplication',_0x47c445);logger[_0xe239('0xf')](_0xe239('0x15'),_0x47c445,JSON['stringify'](_0x17d766));_0x2fd275(_0x17d766);})[_0xe239('0x1d')](function(_0x30f151){logger['error']('UpdateOpenchannelApplication',_0x30f151[_0xe239('0x13')],_0x47c445);_0x5bc57f(_0x3239c5['error'](0x1f4,_0x30f151[_0xe239('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index 8b68339..d0729b8 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 _0x3cf0=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./openchannelInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getMessages','download','post','/:id/messages','tracked','openchannel','openchannelinteraction:addtags','openchannelinteraction:update','update','delete','openchannelinteraction:destroy','destroy','/:id/tags','removeTags','exports','multer','util','path'];(function(_0x380a3f,_0x202483){var _0x2b4eca=function(_0x1e99b2){while(--_0x1e99b2){_0x380a3f['push'](_0x380a3f['shift']());}};_0x2b4eca(++_0x202483);}(_0x3cf0,0xf5));var _0x03cf=function(_0x417755,_0xb2053b){_0x417755=_0x417755-0x0;var _0x1bbb85=_0x3cf0[_0x417755];return _0x1bbb85;};'use strict';var multer=require(_0x03cf('0x0'));var util=require(_0x03cf('0x1'));var path=require(_0x03cf('0x2'));var timeout=require(_0x03cf('0x3'));var express=require(_0x03cf('0x4'));var router=express[_0x03cf('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x03cf('0x6'));var interaction=require(_0x03cf('0x7'));var config=require('../../config/environment');var controller=require(_0x03cf('0x8'));router[_0x03cf('0x9')]('/',auth[_0x03cf('0xa')](),controller[_0x03cf('0xb')]);router[_0x03cf('0x9')](_0x03cf('0xc'),auth['isAuthenticated'](),controller[_0x03cf('0xd')]);router[_0x03cf('0x9')](_0x03cf('0xe'),auth[_0x03cf('0xa')](),controller[_0x03cf('0xf')]);router['get']('/:id/messages',auth['isAuthenticated'](),controller[_0x03cf('0x10')]);router[_0x03cf('0x9')]('/:id/download',auth[_0x03cf('0xa')](),controller[_0x03cf('0x11')]);router[_0x03cf('0x12')]('/',auth[_0x03cf('0xa')](),controller['create']);router[_0x03cf('0x12')](_0x03cf('0x13'),auth[_0x03cf('0xa')](),controller['addMessage']);router[_0x03cf('0x12')]('/:id/tags',auth[_0x03cf('0xa')](),interaction[_0x03cf('0x14')](_0x03cf('0x15'),_0x03cf('0x16')),controller['addTags']);router['put'](_0x03cf('0xe'),auth[_0x03cf('0xa')](),interaction[_0x03cf('0x14')](_0x03cf('0x15'),_0x03cf('0x17')),controller[_0x03cf('0x18')]);router[_0x03cf('0x19')]('/:id',auth[_0x03cf('0xa')](),interaction[_0x03cf('0x14')](_0x03cf('0x15'),_0x03cf('0x1a')),controller[_0x03cf('0x1b')]);router[_0x03cf('0x19')](_0x03cf('0x1c'),auth[_0x03cf('0xa')](),controller[_0x03cf('0x1d')]);module[_0x03cf('0x1e')]=router; \ No newline at end of file +var _0x6d07=['removeTags','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','get','index','/describe','describe','/:id','isAuthenticated','show','/:id/messages','getMessages','/:id/download','download','create','addMessage','post','/:id/tags','tracked','openchannel','openchannelinteraction:addtags','put','openchannelinteraction:update','openchannelinteraction:destroy','destroy','delete'];(function(_0x4837ae,_0x4f3d47){var _0x3e12ee=function(_0x18c7a7){while(--_0x18c7a7){_0x4837ae['push'](_0x4837ae['shift']());}};_0x3e12ee(++_0x4f3d47);}(_0x6d07,0x137));var _0x76d0=function(_0x64bfd5,_0x26eed5){_0x64bfd5=_0x64bfd5-0x0;var _0x4f191e=_0x6d07[_0x64bfd5];return _0x4f191e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x76d0('0x0'));var timeout=require(_0x76d0('0x1'));var express=require(_0x76d0('0x2'));var router=express[_0x76d0('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x76d0('0x4'));var config=require(_0x76d0('0x5'));var controller=require(_0x76d0('0x6'));router[_0x76d0('0x7')]('/',auth['isAuthenticated'](),controller[_0x76d0('0x8')]);router[_0x76d0('0x7')](_0x76d0('0x9'),auth['isAuthenticated'](),controller[_0x76d0('0xa')]);router[_0x76d0('0x7')](_0x76d0('0xb'),auth[_0x76d0('0xc')](),controller[_0x76d0('0xd')]);router[_0x76d0('0x7')](_0x76d0('0xe'),auth[_0x76d0('0xc')](),controller[_0x76d0('0xf')]);router[_0x76d0('0x7')](_0x76d0('0x10'),auth[_0x76d0('0xc')](),controller[_0x76d0('0x11')]);router['post']('/',auth[_0x76d0('0xc')](),controller[_0x76d0('0x12')]);router['post'](_0x76d0('0xe'),auth[_0x76d0('0xc')](),controller[_0x76d0('0x13')]);router[_0x76d0('0x14')](_0x76d0('0x15'),auth[_0x76d0('0xc')](),interaction[_0x76d0('0x16')](_0x76d0('0x17'),_0x76d0('0x18')),controller['addTags']);router[_0x76d0('0x19')](_0x76d0('0xb'),auth[_0x76d0('0xc')](),interaction[_0x76d0('0x16')]('openchannel',_0x76d0('0x1a')),controller['update']);router['delete'](_0x76d0('0xb'),auth[_0x76d0('0xc')](),interaction[_0x76d0('0x16')](_0x76d0('0x17'),_0x76d0('0x1b')),controller[_0x76d0('0x1c')]);router[_0x76d0('0x1d')](_0x76d0('0x15'),auth[_0x76d0('0xc')](),controller[_0x76d0('0x1e')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index 6cc4402..48588df 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 _0x43f5=['out','sequelize','exports','DATE','STRING','ENUM'];(function(_0x3d3b05,_0x334c57){var _0x2c6ca3=function(_0x3fd1cc){while(--_0x3fd1cc){_0x3d3b05['push'](_0x3d3b05['shift']());}};_0x2c6ca3(++_0x334c57);}(_0x43f5,0x9d));var _0x543f=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x43f5[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0x543f('0x0'));module[_0x543f('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x543f('0x2')]},'disposition':{'type':Sequelize[_0x543f('0x3')]},'secondDisposition':{'type':Sequelize[_0x543f('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x543f('0x3')]},'read1stAt':{'type':Sequelize[_0x543f('0x2')]},'threadId':{'type':Sequelize[_0x543f('0x3')]},'externalUrl':{'type':Sequelize[_0x543f('0x3')]},'lastMsgAt':{'type':Sequelize[_0x543f('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x543f('0x4')]('in',_0x543f('0x5')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x543f('0x3')]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x6e12=['DATE','STRING','ENUM','out','sequelize','exports','BOOLEAN'];(function(_0x341095,_0x4b00e6){var _0x51e224=function(_0x5db840){while(--_0x5db840){_0x341095['push'](_0x341095['shift']());}};_0x51e224(++_0x4b00e6);}(_0x6e12,0x154));var _0x26e1=function(_0x586b79,_0x15b20d){_0x586b79=_0x586b79-0x0;var _0x4988f4=_0x6e12[_0x586b79];return _0x4988f4;};'use strict';var Sequelize=require(_0x26e1('0x0'));module[_0x26e1('0x1')]={'closed':{'type':Sequelize[_0x26e1('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x26e1('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x26e1('0x4')]},'thirdDisposition':{'type':Sequelize[_0x26e1('0x4')]},'note':{'type':Sequelize[_0x26e1('0x4')]},'read1stAt':{'type':Sequelize['DATE']},'threadId':{'type':Sequelize['STRING']},'externalUrl':{'type':Sequelize[_0x26e1('0x4')]},'lastMsgAt':{'type':Sequelize[_0x26e1('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x26e1('0x5')]('in',_0x26e1('0x6')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x26e1('0x4')]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index 5db5dd1..184709b 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 _0x8a83=['transcript-','createPdfFromHTML','err','unlinkSync','sendStatus','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','fs-extra','lodash','to-csv','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','./openchannelInteraction.socket','end','status','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','error','stack','Users','fullname','TagIds','Tags','catch','index','map','OpenchannelInteraction','type','key','model','name','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','limit','order','sort','where','select','field','color','from','u.id','u.fullname','ui.OpenchannelInteractionId','user_has_openchannel_interactions','left_join','users','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','openchannel_accounts','a.id\x20=\x20i.OpenchannelAccountId','openchannel_messages','me.OpenchannelInteractionId\x20=\x20i.id','openchannel_interaction_has_tags','it.OpenchannelInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','conditions','find','unreadMessages','value','having','`\x20=\x200','Contact','$substring','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','start','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','buildExpression','text','body','some','compact','isEmpty','OpenchannelAccountId','i.OpenchannelAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20>\x200','tag','filter','replace','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','i.from\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','t.id\x20IN\x20?','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','role','agent','i.OpenchannelAccountId\x20IS\x20NULL','sequelize','toString','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','Contact.lastName','c.email','Contact.email','c.phone','c.mobile','Contact.mobile','c.fax','o.fullname','Owner.fullname','o.internal','ui.OpenchannelInteractionId\x20IN\x20?','groupBy','push','all','rows','show','params','includeAll','merge','options','create','destroy','describe','addMessage','OpenchannelMessage','omit','ids','findOne','rawAttributes','nolimit','pick','OpenchannelInteractionId','format','YYYY-MM-DD\x20HH:mm:ss','include','findAll','addTags','setTags','spread','openchannelInteractionTags:save','removeTags','download','unix','root','server','tmp','join','files','attachments','transcript-%d-%s.zip','firstName','lastName','Attachment','secret','OpenchannelAccount','Owner','get','mkdirSync','Openchannel','closed','closedAt','disposition','threadId','Public','Private','Messages','basename','pipe','direction','out','System','renderFile','views','downloadInteraction.ejs'];(function(_0x33a6bf,_0x103feb){var _0x51adf4=function(_0x358d60){while(--_0x358d60){_0x33a6bf['push'](_0x33a6bf['shift']());}};_0x51adf4(++_0x103feb);}(_0x8a83,0x1d5));var _0x38a8=function(_0x5a7d41,_0x4447e2){_0x5a7d41=_0x5a7d41-0x0;var _0x98d8fa=_0x8a83[_0x5a7d41];return _0x98d8fa;};'use strict';var emlformat=require(_0x38a8('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x38a8('0x1'));var jsonpatch=require(_0x38a8('0x2'));var rp=require(_0x38a8('0x3'));var moment=require(_0x38a8('0x4'));var BPromise=require(_0x38a8('0x5'));var Mustache=require(_0x38a8('0x6'));var util=require(_0x38a8('0x7'));var path=require(_0x38a8('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x38a8('0x9'));var _=require(_0x38a8('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x38a8('0xb'));var querystring=require('querystring');var Papa=require(_0x38a8('0xc'));var Redis=require(_0x38a8('0xd'));var authService=require(_0x38a8('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var pdf=require('../../components/export/pdf');var hardwareService=require(_0x38a8('0xf'));var logger=require(_0x38a8('0x10'))(_0x38a8('0x11'));var utils=require(_0x38a8('0x12'));var config=require(_0x38a8('0x13'));var licenseUtil=require(_0x38a8('0x14'));var db=require('../../mysqldb')['db'];config[_0x38a8('0x15')]=_[_0x38a8('0x16')](config[_0x38a8('0x15')],{'host':_0x38a8('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x38a8('0x15')]));require(_0x38a8('0x18'))['register'](socket);function respondWithStatusCode(_0x3086ea,_0x445aa4){_0x445aa4=_0x445aa4||0xcc;return function(_0x196346){if(_0x196346){return _0x3086ea['sendStatus'](_0x445aa4);}return _0x3086ea['status'](_0x445aa4)[_0x38a8('0x19')]();};}function respondWithResult(_0x101e90,_0x4aa749){_0x4aa749=_0x4aa749||0xc8;return function(_0x11241d){if(_0x11241d){return _0x101e90[_0x38a8('0x1a')](_0x4aa749)[_0x38a8('0x1b')](_0x11241d);}};}function respondWithFilteredResult(_0xa25676,_0x474d0a){return function(_0x8f48b0){if(_0x8f48b0){var _0x776228=typeof _0x474d0a[_0x38a8('0x1c')]===_0x38a8('0x1d')&&typeof _0x474d0a['limit']===_0x38a8('0x1d');var _0x3536e5=_0x8f48b0[_0x38a8('0x1e')];var _0x308253=_0x776228?0x0:_0x474d0a['offset'];var _0x1adb9d=_0x776228?_0x8f48b0[_0x38a8('0x1e')]:_0x474d0a[_0x38a8('0x1c')]+_0x474d0a['limit'];var _0x2880b4;if(_0x1adb9d>=_0x3536e5){_0x1adb9d=_0x3536e5;_0x2880b4=0xc8;}else{_0x2880b4=0xce;}_0xa25676[_0x38a8('0x1a')](_0x2880b4);return _0xa25676[_0x38a8('0x1f')](_0x38a8('0x20'),_0x308253+'-'+_0x1adb9d+'/'+_0x3536e5)[_0x38a8('0x1b')](_0x8f48b0);}return null;};}function patchUpdates(_0x204533){return function(_0x487e5e){try{jsonpatch[_0x38a8('0x21')](_0x487e5e,_0x204533,!![]);}catch(_0x11694a){return BPromise[_0x38a8('0x22')](_0x11694a);}return _0x487e5e[_0x38a8('0x23')]();};}function saveUpdates(_0x4d2f32,_0x1bf0a7){return function(_0x56cd67){if(_0x56cd67){return _0x56cd67[_0x38a8('0x24')](_0x4d2f32)[_0x38a8('0x25')](function(_0x3ce9f0){return _0x3ce9f0;});}return null;};}function removeEntity(_0x7231ec,_0x29cbf8){return function(_0x3a23fe){if(_0x3a23fe){return _0x3a23fe['destroy']()['then'](function(){_0x7231ec[_0x38a8('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5a2d8f,_0x25383b){return function(_0xad3ed5){if(!_0xad3ed5){_0x5a2d8f['sendStatus'](0x194);}return _0xad3ed5;};}function handleError(_0x428fd4,_0x131f12){_0x131f12=_0x131f12||0x1f4;return function(_0x52c08c){logger[_0x38a8('0x26')](_0x52c08c[_0x38a8('0x27')]);if(_0x52c08c['name']){delete _0x52c08c['name'];}_0x428fd4[_0x38a8('0x1a')](_0x131f12)['send'](_0x52c08c);};}function getInteractionUsers(_0x442a95,_0x51241c){return new BPromise(function(_0x4c5f31,_0x37ea72){try{if(_0x51241c[_0x442a95['id']]){_0x442a95[_0x38a8('0x28')]=_['map'](_0x51241c[_0x442a95['id']],function(_0x40bda0){return{'id':_0x40bda0['id'],'fullname':_0x40bda0[_0x38a8('0x29')]};});}}catch(_0x102cd4){_0x37ea72(_0x102cd4);}_0x4c5f31(_0x442a95);});}function getInteractionTags(_0x56720a,_0xf52cd){return new BPromise(function(_0x5e983d,_0x1b0fec){try{if(_0x56720a[_0x38a8('0x2a')]){_0x56720a[_0x38a8('0x2b')]=[];_0x56720a[_0x38a8('0x2a')]['split'](',')['forEach'](function(_0x54506b){_0x56720a[_0x38a8('0x2b')]['push'](_0xf52cd[_0x54506b]);});}delete _0x56720a[_0x38a8('0x2a')];}catch(_0x474145){_0x1b0fec(_0x474145);}_0x5e983d(_0x56720a);});}function updateOpenchannelInteraction(_0x176f54,_0x5185e1,_0x4a8d9b){return new BPromise(function(_0x4b021a,_0xfef83){return getInteractionUsers(_0x176f54,_0x4a8d9b)['then'](function(_0x19ca19){return getInteractionTags(_0x19ca19,_0x5185e1);})['then'](function(_0x4d3e59){_0x4b021a(_0x4d3e59);})[_0x38a8('0x2c')](function(_0x5131bd){_0xfef83(_0x5131bd);});});}exports[_0x38a8('0x2d')]=function(_0x4323b2,_0x3b3b23){var _0x197b40={},_0x477bf7={},_0x3f4fa1={'count':0x0,'rows':[]};var _0x4a871c=_[_0x38a8('0x2e')](db[_0x38a8('0x2f')]['rawAttributes'],function(_0x2dfeb2){return{'name':_0x2dfeb2['fieldName'],'type':_0x2dfeb2[_0x38a8('0x30')][_0x38a8('0x31')]};});_0x477bf7[_0x38a8('0x32')]=_[_0x38a8('0x2e')](_0x4a871c,_0x38a8('0x33'));_0x477bf7['query']=_[_0x38a8('0x34')](_0x4323b2[_0x38a8('0x35')]);_0x477bf7[_0x38a8('0x36')]=_[_0x38a8('0x37')](_0x477bf7['model'],_0x477bf7['query']);_0x197b40['attributes']=_[_0x38a8('0x37')](_0x477bf7[_0x38a8('0x32')],qs[_0x38a8('0x38')](_0x4323b2[_0x38a8('0x35')][_0x38a8('0x38')]));_0x197b40[_0x38a8('0x39')]=_0x197b40[_0x38a8('0x39')][_0x38a8('0x3a')]?_0x197b40[_0x38a8('0x39')]:_0x477bf7[_0x38a8('0x32')];if(!_0x4323b2[_0x38a8('0x35')][_0x38a8('0x3b')]('nolimit')){_0x197b40['limit']=qs['limit'](_0x4323b2[_0x38a8('0x35')][_0x38a8('0x3c')]);_0x197b40[_0x38a8('0x1c')]=qs[_0x38a8('0x1c')](_0x4323b2[_0x38a8('0x35')][_0x38a8('0x1c')]);}_0x197b40[_0x38a8('0x3d')]=qs[_0x38a8('0x3e')](_0x4323b2[_0x38a8('0x35')][_0x38a8('0x3e')]);_0x197b40[_0x38a8('0x3f')]=qs[_0x38a8('0x36')](_['pick'](_0x4323b2[_0x38a8('0x35')],_0x477bf7[_0x38a8('0x36')]),_0x4a871c);var _0x440ea3=[];var _0xf269db=squel[_0x38a8('0x40')]()[_0x38a8('0x41')]('id')[_0x38a8('0x41')](_0x38a8('0x33'))[_0x38a8('0x41')](_0x38a8('0x42'))[_0x38a8('0x43')]('tools_tags');var _0x1ca46a=squel[_0x38a8('0x40')]()['field'](_0x38a8('0x44'))[_0x38a8('0x41')](_0x38a8('0x45'))[_0x38a8('0x41')](_0x38a8('0x46'))['from'](_0x38a8('0x47'),'ui')[_0x38a8('0x48')](_0x38a8('0x49'),'u','u.id\x20=\x20ui.UserId');var _0x28f500=squel[_0x38a8('0x40')]()[_0x38a8('0x43')]('openchannel_interactions','i')[_0x38a8('0x48')](_0x38a8('0x4a'),'c',_0x38a8('0x4b'))[_0x38a8('0x48')](_0x38a8('0x49'),'o',_0x38a8('0x4c'))[_0x38a8('0x48')](_0x38a8('0x4d'),'a',_0x38a8('0x4e'))['left_join'](_0x38a8('0x4f'),'me',_0x38a8('0x50'))['left_join'](_0x38a8('0x51'),'it',_0x38a8('0x52'))['left_join'](_0x38a8('0x53'),'t',_0x38a8('0x54'));var _0x2e5360=squel[_0x38a8('0x55')]();var _0x6b78f2=[];var _0x38421c=squel['expr']();var _0x415217;if(_0x4323b2['query'][_0x38a8('0x56')]){_0x415217=as[_0x38a8('0x57')](_0x4323b2[_0x38a8('0x35')]['search']);var _0x58a897=_0x415217['sqlOperator'];for(var _0x45f24e=0x0;_0x45f24e<_0x415217[_0x38a8('0x58')][_0x38a8('0x3a')];_0x45f24e++){var _0x59e2f3=_0x415217['conditions'][_0x45f24e];var _0x31a2db='i';var _0x2f0d27=_[_0x38a8('0x59')](_0x4a871c,[_0x38a8('0x33'),_0x59e2f3[_0x38a8('0x41')]]);if(!_0x2f0d27){switch(_0x59e2f3[_0x38a8('0x41')]){case _0x38a8('0x5a'):if(_0x59e2f3[_0x38a8('0x5b')]==0x1){_0x28f500[_0x38a8('0x5c')]('`'+_0x59e2f3['field']+_0x38a8('0x5d'));}else{_0x28f500[_0x38a8('0x5c')]('`'+_0x59e2f3['field']+'`\x20>\x200');}break;case _0x38a8('0x5e'):if(_0x59e2f3['operator']===_0x38a8('0x5f')){if(_0x59e2f3[_0x38a8('0x5b')][_0x38a8('0x60')]('\x20')[_0x38a8('0x3a')]>0x1){_0x2e5360[_0x58a897](_0x38a8('0x61'),qs['getFullTextValue'](_0x59e2f3[_0x38a8('0x5b')]),null);}else{var _0x4d40ec='%'+_0x59e2f3[_0x38a8('0x5b')]+'%';_0x2e5360[_0x58a897](_0x38a8('0x62'),_0x4d40ec,_0x4d40ec,_0x4d40ec);}}else{_0x2f0d27=_[_0x38a8('0x59')](_0x4a871c,[_0x38a8('0x33'),_0x38a8('0x63')]);_0x59e2f3[_0x38a8('0x41')]='ContactId';_0x4602be=as['buildExpression'](_0x31a2db,_0x2f0d27[_0x38a8('0x30')],_0x59e2f3);_0x2e5360[_0x58a897](_0x4602be['text'],_0x4602be[_0x38a8('0x5b')][_0x38a8('0x64')],_0x4602be[_0x38a8('0x5b')][_0x38a8('0x19')]);}break;case'Tag':var _0x191a4d=_0x59e2f3[_0x38a8('0x5b')][_0x38a8('0x60')](',')[_0x38a8('0x2e')](function(_0x2a27c5){return Number(_0x2a27c5);});_0x191a4d[_0x38a8('0x65')](function(_0x4c2eb8){_0x38421c['or'](_0x38a8('0x66'),'%,'+_0x4c2eb8+',%');});_0x6b78f2=_[_0x38a8('0x67')](_0x6b78f2,_0x191a4d);break;case _0x38a8('0x68'):if(_0x59e2f3['operator']===_0x38a8('0x5f')){_0x2e5360[_0x58a897](_0x38a8('0x69'),'%'+_0x59e2f3[_0x38a8('0x5b')]+'%',null);}else{_0x2f0d27=_['find'](_0x4a871c,[_0x38a8('0x33'),_0x38a8('0x6a')]);_0x59e2f3[_0x38a8('0x41')]=_0x38a8('0x6a');_0x4602be=as[_0x38a8('0x6b')](_0x31a2db,_0x2f0d27[_0x38a8('0x30')],_0x59e2f3);_0x2e5360[_0x58a897](_0x4602be[_0x38a8('0x6c')],_0x4602be[_0x38a8('0x5b')][_0x38a8('0x64')],_0x4602be[_0x38a8('0x5b')][_0x38a8('0x19')]);}break;case _0x38a8('0x6d'):_0x4602be=as[_0x38a8('0x6b')]('me',null,_0x59e2f3);_0x2e5360[_0x58a897](_0x4602be['text'],_0x4602be[_0x38a8('0x5b')][_0x38a8('0x64')],_0x4602be[_0x38a8('0x5b')][_0x38a8('0x19')]);break;}}else{var _0x4602be=as['buildExpression'](_0x31a2db,_0x2f0d27[_0x38a8('0x30')],_0x59e2f3);_0x2e5360[_0x58a897](_0x4602be[_0x38a8('0x6c')],_0x4602be[_0x38a8('0x5b')][_0x38a8('0x64')],_0x4602be[_0x38a8('0x5b')][_0x38a8('0x19')]);}}}else{var _0x4b2e81=_(_0x4323b2[_0x38a8('0x35')])[_0x38a8('0x34')]()[_0x38a8('0x2e')](function(_0x162942){return _[_0x38a8('0x6e')](_0x4a871c,['name',_0x162942])?_0x162942:undefined;})[_0x38a8('0x6f')]()[_0x38a8('0x5b')]();if(!_[_0x38a8('0x70')](_0x4b2e81)){_0x4b2e81['forEach'](function(_0x29fbd2){if(_0x29fbd2===_0x38a8('0x71')){_0x28f500[_0x38a8('0x3f')](_0x38a8('0x72'),[][_0x38a8('0x73')](_0x4323b2[_0x38a8('0x35')][_0x29fbd2]));}else if(_0x29fbd2===_0x38a8('0x74')){var _0x1b86e5=JSON[_0x38a8('0x75')](_0x4323b2[_0x38a8('0x35')][_0x29fbd2])[_0x38a8('0x76')];var _0x3cab60=JSON['parse'](_0x4323b2[_0x38a8('0x35')][_0x29fbd2])[_0x38a8('0x77')];_0x28f500[_0x38a8('0x3f')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x1b86e5,_0x3cab60);}else{if(_0x4323b2['query'][_0x29fbd2]===_0x38a8('0x78')){_0x28f500[_0x38a8('0x3f')]('i.'+_0x29fbd2+_0x38a8('0x79'));}else{_0x28f500['where']('i.'+_0x29fbd2+_0x38a8('0x7a'),_0x4323b2[_0x38a8('0x35')][_0x29fbd2]);}}});}if(_0x4323b2['query'][_0x38a8('0x7b')]){if(_0x4323b2[_0x38a8('0x35')][_0x38a8('0x7b')]==0x1){_0x28f500[_0x38a8('0x5c')]('`unreadMessages`\x20=\x200');}else{_0x28f500['having'](_0x38a8('0x7c'));}}if(_0x4323b2['query'][_0x38a8('0x7d')]){_0x6b78f2=_['isArray'](_0x4323b2[_0x38a8('0x35')][_0x38a8('0x7d')])?_0x4323b2['query']['tag']:new Array(_0x4323b2[_0x38a8('0x35')][_0x38a8('0x7d')]);_0x6b78f2['forEach'](function(_0x569bc4){_0x38421c['or'](_0x38a8('0x66'),'%,'+_0x569bc4+',%');});}if(_0x4323b2[_0x38a8('0x35')]['filter']){var _0x23c816=_0x4323b2[_0x38a8('0x35')][_0x38a8('0x7e')][_0x38a8('0x7f')]('\x5c','\x5c\x5c')[_0x38a8('0x7f')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x23c816)){_0x2e5360['or']('i.id\x20LIKE\x20?',_0x23c816+'%');}else{_0x2e5360['or'](_0x38a8('0x80'),qs[_0x38a8('0x81')](_0x23c816))['or'](_0x38a8('0x82'),_0x23c816+'%')['or'](_0x38a8('0x83'),_0x23c816+'%');}}}_0x28f500['where'](_0x2e5360);_0x28f500[_0x38a8('0x84')](_0x38a8('0x85'));var _0x15c861={'type':db['Sequelize'][_0x38a8('0x86')][_0x38a8('0x87')],'raw':!![]};var _0x2d27eb=_0x28f500[_0x38a8('0x88')]();_0x2d27eb['field'](_0x38a8('0x85'));_0x2d27eb['field'](_0x38a8('0x89'),_0x38a8('0x5a'));if(_0x197b40['order']){_0x197b40[_0x38a8('0x3d')][_0x38a8('0x65')](function(_0x38731d){var _0x5cb51d=_0x38731d[0x0]===_0x38a8('0x8a')?_0x38731d[0x0]:'i.'+_0x38731d[0x0];_0x28f500['order'](_0x5cb51d,_0x38731d[0x1]===_0x38a8('0x8b')?![]:!![]);});}if(!_[_0x38a8('0x70')](_0x6b78f2)){_0x28f500[_0x38a8('0x5c')](_0x38421c);_0x2d27eb[_0x38a8('0x3f')](_0x38a8('0x8c'),_0x6b78f2);}BPromise['resolve']()['then'](function(){if(!_0x415217){if(_0x4323b2[_0x38a8('0x35')]['OpenchannelAccountId'])return;_0x2d27eb['where']('i.OpenchannelAccountId\x20IS\x20NOT\x20NULL');_0x28f500['where'](_0x38a8('0x8d'));return;}if(_0x4323b2[_0x38a8('0x8e')][_0x38a8('0x8f')]!==_0x38a8('0x90'))return;return _0x4323b2['user']['getOpenchannelAccounts']({'attributes':['id'],'raw':!![]})[_0x38a8('0x25')](function(_0x4d95fe){if(_['isEmpty'](_0x4d95fe)){_0x2d27eb[_0x38a8('0x3f')](_0x38a8('0x91'));_0x28f500[_0x38a8('0x3f')](_0x38a8('0x91'));}else{_0x2d27eb['where']('i.OpenchannelAccountId\x20IN\x20?',_['map'](_0x4d95fe,'id'));_0x28f500[_0x38a8('0x3f')]('i.OpenchannelAccountId\x20IN\x20?',_['map'](_0x4d95fe,'id'));}});})['then'](function(){if(_0x4323b2['user'][_0x38a8('0x8f')]===_0x38a8('0x90')&&!_0x415217&&!_0x4323b2[_0x38a8('0x35')][_0x38a8('0x71')])return[];return db[_0x38a8('0x92')]['query'](_0x2d27eb[_0x38a8('0x93')](),_0x15c861);})['then'](function(_0x11f1d2){_0x3f4fa1['count']=_0x11f1d2[_0x38a8('0x3a')];if(_0x3f4fa1[_0x38a8('0x1e')]===0x0)return[];return db[_0x38a8('0x92')][_0x38a8('0x35')](_0xf269db[_0x38a8('0x93')](),_0x15c861)[_0x38a8('0x25')](function(_0x2cb760){_0x440ea3=_['keyBy'](_0x2cb760,'id');_0x15c861=_['merge'](_0x15c861,{'model':db['OpenchannelInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x4323b2[_0x38a8('0x35')][_0x38a8('0x38')]){_0x197b40[_0x38a8('0x39')]['forEach'](function(_0x521a01){_0x28f500['field']('i.'+_0x521a01);});}else{_0x28f500[_0x38a8('0x41')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x38a8('0x5a'));_0x28f500[_0x38a8('0x41')](_0x38a8('0x94'),_0x38a8('0x95'));_0x28f500[_0x38a8('0x41')](_0x38a8('0x96'),_0x38a8('0x97'));_0x28f500[_0x38a8('0x41')]('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',_0x38a8('0x8a'));_0x28f500[_0x38a8('0x41')](_0x38a8('0x98'));_0x28f500[_0x38a8('0x41')]('c.firstName','Contact.firstName');_0x28f500[_0x38a8('0x41')]('c.lastName',_0x38a8('0x99'));_0x28f500[_0x38a8('0x41')](_0x38a8('0x9a'),_0x38a8('0x9b'));_0x28f500[_0x38a8('0x41')](_0x38a8('0x9c'),'Contact.phone');_0x28f500[_0x38a8('0x41')](_0x38a8('0x9d'),_0x38a8('0x9e'));_0x28f500['field'](_0x38a8('0x9f'),'Contact.fax');_0x28f500[_0x38a8('0x41')](_0x38a8('0xa0'),_0x38a8('0xa1'));_0x28f500[_0x38a8('0x41')](_0x38a8('0xa2'),'Owner.internal');_0x28f500[_0x38a8('0x41')]('GROUP_CONCAT(DISTINCT\x20t.id)','TagIds');}if(_0x197b40[_0x38a8('0x3c')])_0x28f500['limit'](_0x197b40['limit']);if(_0x197b40[_0x38a8('0x1c')])_0x28f500[_0x38a8('0x1c')](_0x197b40[_0x38a8('0x1c')]);return db[_0x38a8('0x92')][_0x38a8('0x35')](_0x28f500[_0x38a8('0x93')](),_0x15c861);})[_0x38a8('0x25')](function(_0x57dd4e){if(_0x57dd4e[_0x38a8('0x3a')]>0x0)_0x1ca46a[_0x38a8('0x3f')](_0x38a8('0xa3'),_[_0x38a8('0x2e')](_0x57dd4e,'id'));return db[_0x38a8('0x92')][_0x38a8('0x35')](_0x1ca46a[_0x38a8('0x93')](),_0x15c861)[_0x38a8('0x25')](function(_0x573e9d){var _0x1bfd10=_[_0x38a8('0xa4')](_0x573e9d,'OpenchannelInteractionId');var _0x381d14=[];_0x57dd4e[_0x38a8('0x65')](function(_0x204458){_0x381d14[_0x38a8('0xa5')](updateOpenchannelInteraction(_0x204458,_0x440ea3,_0x1bfd10));});return BPromise[_0x38a8('0xa6')](_0x381d14);});});})[_0x38a8('0x25')](function(_0xb57d72){_0x3f4fa1[_0x38a8('0xa7')]=_0xb57d72;return _0x3f4fa1;})['then'](respondWithFilteredResult(_0x3b3b23,_0x197b40))[_0x38a8('0x2c')](handleError(_0x3b3b23,null));};exports[_0x38a8('0xa8')]=function(_0x58faf3,_0x392bea){var _0x3c8c61={};if(_0x58faf3[_0x38a8('0x35')]['type']&&_0x58faf3[_0x38a8('0x35')]['type']===_0x38a8('0x43')){_0x3c8c61[_0x38a8('0x43')]=_0x58faf3[_0x38a8('0xa9')]['id'];}else{_0x3c8c61['id']=_0x58faf3[_0x38a8('0xa9')]['id'];}var _0x4193b0={'raw':![],'where':_0x3c8c61},_0x3269e2={};_0x3269e2[_0x38a8('0x32')]=_[_0x38a8('0x34')](db[_0x38a8('0x2f')]['rawAttributes']);_0x3269e2[_0x38a8('0x35')]=_['keys'](_0x58faf3['query']);_0x3269e2[_0x38a8('0x36')]=_['intersection'](_0x3269e2[_0x38a8('0x32')],_0x3269e2['query']);_0x4193b0[_0x38a8('0x39')]=_[_0x38a8('0x37')](_0x3269e2[_0x38a8('0x32')],qs[_0x38a8('0x38')](_0x58faf3[_0x38a8('0x35')][_0x38a8('0x38')]));_0x4193b0['attributes']=_0x4193b0['attributes'][_0x38a8('0x3a')]?_0x4193b0[_0x38a8('0x39')]:_0x3269e2['model'];if(_0x58faf3[_0x38a8('0x35')][_0x38a8('0xaa')]){_0x4193b0['include']=[{'all':!![]}];}_0x4193b0=_[_0x38a8('0xab')]({},_0x4193b0,_0x58faf3[_0x38a8('0xac')]);return db[_0x38a8('0x2f')][_0x38a8('0x59')](_0x4193b0)[_0x38a8('0x25')](handleEntityNotFound(_0x392bea,null))[_0x38a8('0x25')](respondWithResult(_0x392bea,null))[_0x38a8('0x2c')](handleError(_0x392bea,null));};exports[_0x38a8('0xad')]=function(_0x3bec63,_0x58829c){return db['OpenchannelInteraction'][_0x38a8('0xad')](_0x3bec63[_0x38a8('0x6d')],{})[_0x38a8('0x25')](respondWithResult(_0x58829c,0xc9))[_0x38a8('0x2c')](handleError(_0x58829c,null));};exports['update']=function(_0x70e46c,_0x52cd70){if(_0x70e46c[_0x38a8('0x6d')]['id']){delete _0x70e46c[_0x38a8('0x6d')]['id'];}return db[_0x38a8('0x2f')][_0x38a8('0x59')]({'where':{'id':_0x70e46c[_0x38a8('0xa9')]['id']}})[_0x38a8('0x25')](handleEntityNotFound(_0x52cd70,null))['then'](saveUpdates(_0x70e46c[_0x38a8('0x6d')],null))['then'](respondWithResult(_0x52cd70,null))[_0x38a8('0x2c')](handleError(_0x52cd70,null));};exports[_0x38a8('0xae')]=function(_0x46a3c5,_0x5a1e60){return db[_0x38a8('0x2f')]['find']({'where':{'id':_0x46a3c5[_0x38a8('0xa9')]['id']}})[_0x38a8('0x25')](handleEntityNotFound(_0x5a1e60,null))[_0x38a8('0x25')](removeEntity(_0x5a1e60,null))[_0x38a8('0x2c')](handleError(_0x5a1e60,null));};exports[_0x38a8('0xaf')]=function(_0x21677c,_0x778b6d){return db[_0x38a8('0x2f')][_0x38a8('0xaf')]()['then'](respondWithResult(_0x778b6d,null))[_0x38a8('0x2c')](handleError(_0x778b6d,null));};exports[_0x38a8('0xb0')]=function(_0x1565c2,_0x34271b,_0x42cad3){return db[_0x38a8('0xb1')]['find']({'where':{'id':_0x1565c2[_0x38a8('0xa9')]['id']}})['then'](handleEntityNotFound(_0x34271b,null))[_0x38a8('0x25')](function(_0x4fcbbb){if(_0x4fcbbb){return _0x4fcbbb[_0x38a8('0xb0')](_0x1565c2['body']['ids'],_[_0x38a8('0xb2')](_0x1565c2['body'],[_0x38a8('0xb3'),'id'])||{});}})[_0x38a8('0x25')](respondWithResult(_0x34271b,null))[_0x38a8('0x2c')](handleError(_0x34271b,null));};exports['getMessages']=function(_0x288b41,_0x392cc1,_0x25f095){var _0xb11f4b={'raw':![],'where':{}};var _0x51cabc={};var _0x2b8d03={'count':0x0,'rows':[]};return db[_0x38a8('0x2f')][_0x38a8('0xb4')]({'where':{'id':_0x288b41[_0x38a8('0xa9')]['id']}})[_0x38a8('0x25')](handleEntityNotFound(_0x392cc1,null))['then'](function(_0xd8f381){if(_0xd8f381){_0x51cabc[_0x38a8('0x32')]=_['keys'](db['OpenchannelMessage'][_0x38a8('0xb5')]);_0x51cabc[_0x38a8('0x35')]=_[_0x38a8('0x34')](_0x288b41[_0x38a8('0x35')]);_0x51cabc[_0x38a8('0x36')]=_['intersection'](_0x51cabc[_0x38a8('0x32')],_0x51cabc[_0x38a8('0x35')]);_0xb11f4b[_0x38a8('0x39')]=_[_0x38a8('0x37')](_0x51cabc[_0x38a8('0x32')],qs[_0x38a8('0x38')](_0x288b41[_0x38a8('0x35')][_0x38a8('0x38')]));_0xb11f4b[_0x38a8('0x39')]=_0xb11f4b[_0x38a8('0x39')][_0x38a8('0x3a')]?_0xb11f4b['attributes']:_0x51cabc[_0x38a8('0x32')];if(!_0x288b41[_0x38a8('0x35')][_0x38a8('0x3b')](_0x38a8('0xb6'))){_0xb11f4b[_0x38a8('0x3c')]=qs['limit'](_0x288b41[_0x38a8('0x35')][_0x38a8('0x3c')]);_0xb11f4b[_0x38a8('0x1c')]=qs[_0x38a8('0x1c')](_0x288b41['query'][_0x38a8('0x1c')]);}_0xb11f4b['order']=qs[_0x38a8('0x3e')](_0x288b41[_0x38a8('0x35')][_0x38a8('0x3e')]);_0xb11f4b[_0x38a8('0x3f')]=qs['filters'](_[_0x38a8('0xb7')](_0x288b41['query'],_0x51cabc[_0x38a8('0x36')]));_0xb11f4b['where'][_0x38a8('0xb8')]=_0xd8f381['id'];if(_0x288b41[_0x38a8('0x35')]['filter']){_0xb11f4b[_0x38a8('0x3f')]=_['merge'](_0xb11f4b['where'],{'$or':_[_0x38a8('0x2e')](_0xb11f4b[_0x38a8('0x39')],function(_0x518b88){var _0x20c1f1={};_0x20c1f1[_0x518b88]={'$like':'%'+_0x288b41[_0x38a8('0x35')][_0x38a8('0x7e')]+'%'};return _0x20c1f1;})});}if(_0x288b41[_0x38a8('0x35')][_0x38a8('0x76')]){var _0x1895fc=_0x288b41['query'][_0x38a8('0x76')][_0x38a8('0x60')](',');var _0x3a257a={};_0x3a257a[_0x1895fc[0x0]]={'$gte':moment(_0x1895fc[0x1])[_0x38a8('0xb9')](_0x38a8('0xba'))};_0xb11f4b[_0x38a8('0x3f')]=_[_0x38a8('0xab')](_0xb11f4b[_0x38a8('0x3f')],_0x3a257a);}_0xb11f4b=_[_0x38a8('0xab')]({},_0xb11f4b,_0x288b41[_0x38a8('0xac')]);return db[_0x38a8('0xb1')]['count']({'where':_0xb11f4b['where']})['then'](function(_0x3a18bb){_0x2b8d03[_0x38a8('0x1e')]=_0x3a18bb;if(_0x288b41[_0x38a8('0x35')][_0x38a8('0xaa')]){_0xb11f4b[_0x38a8('0xbb')]=[{'all':!![]}];}return db['OpenchannelMessage'][_0x38a8('0xbc')](_0xb11f4b);})[_0x38a8('0x25')](function(_0x2b7ece){_0x2b8d03[_0x38a8('0xa7')]=_0x2b7ece;return _0x2b8d03;});}})[_0x38a8('0x25')](respondWithFilteredResult(_0x392cc1,_0xb11f4b))[_0x38a8('0x2c')](handleError(_0x392cc1,null));};exports[_0x38a8('0xbd')]=function(_0x276a77,_0x2c5a51,_0x281ad7){return db['OpenchannelInteraction']['find']({'where':{'id':_0x276a77[_0x38a8('0xa9')]['id']}})[_0x38a8('0x25')](handleEntityNotFound(_0x2c5a51,null))[_0x38a8('0x25')](function(_0x22b895){if(_0x22b895){return _0x22b895[_0x38a8('0xbe')](_0x276a77[_0x38a8('0x6d')]['ids'],_[_0x38a8('0xb2')](_0x276a77[_0x38a8('0x6d')],[_0x38a8('0xb3'),'id'])||{})[_0x38a8('0xbf')](function(){return db['Tag'][_0x38a8('0xbc')]({'attributes':['id',_0x38a8('0x33'),_0x38a8('0x42')],'where':{'id':_0x276a77[_0x38a8('0x6d')][_0x38a8('0xb3')]}});})['then'](function(_0x59228c){socket['emit'](_0x38a8('0xc0'),{'id':Number(_0x276a77['params']['id']),'tags':_0x59228c||[]});return{'id':Number(_0x276a77['params']['id']),'tags':_0x59228c||[]};});}})[_0x38a8('0x25')](respondWithResult(_0x2c5a51,null))['catch'](handleError(_0x2c5a51,null));};exports['removeTags']=function(_0x6e9760,_0x5a3e70,_0x2bd414){return db[_0x38a8('0x2f')][_0x38a8('0x59')]({'where':{'id':_0x6e9760[_0x38a8('0xa9')]['id']}})[_0x38a8('0x25')](handleEntityNotFound(_0x5a3e70,null))[_0x38a8('0x25')](function(_0x154aa3){if(_0x154aa3){return _0x154aa3[_0x38a8('0xc1')](_0x6e9760[_0x38a8('0x35')][_0x38a8('0xb3')]);}})[_0x38a8('0x25')](respondWithStatusCode(_0x5a3e70,null))[_0x38a8('0x2c')](handleError(_0x5a3e70,null));};exports[_0x38a8('0xc2')]=function(_0x1646a5,_0x579b45){var _0x504b88=moment()[_0x38a8('0xc3')]()[_0x38a8('0x93')]();var _0x41ea1f=path['join'](config[_0x38a8('0xc4')],_0x38a8('0xc5'),'files',_0x38a8('0xc6'));var _0x3cf476=path[_0x38a8('0xc7')](config[_0x38a8('0xc4')],_0x38a8('0xc5'),_0x38a8('0xc8'),_0x38a8('0xc9'));var _0x372b6d=path[_0x38a8('0xc7')](_0x41ea1f,_0x504b88);var _0x4b8a76=util[_0x38a8('0xb9')](_0x38a8('0xca'),_0x1646a5['params']['id'],_0x504b88);var _0x1c6bf2=path['join'](_0x41ea1f,_0x4b8a76);var _0x4d679c=[];_0x4d679c[_0x38a8('0xa5')]({'model':db['User'],'as':_0x38a8('0x68'),'attributes':['id',_0x38a8('0x29')],'raw':!![]});_0x4d679c[_0x38a8('0xa5')]({'model':db['CmContact'],'as':_0x38a8('0x5e'),'attributes':['id',_0x38a8('0xcb'),_0x38a8('0xcc')],'raw':!![]});if(_0x1646a5[_0x38a8('0x35')][_0x38a8('0xc9')]){_0x4d679c[_0x38a8('0xa5')]({'model':db[_0x38a8('0xcd')],'as':_0x38a8('0xcd'),'raw':!![]});}var _0x1db4c7=[{'model':db[_0x38a8('0xb1')],'as':'Messages','attributes':['id',_0x38a8('0x6d'),'createdAt','direction',_0x38a8('0xce'),_0x38a8('0x7b')],'include':_0x4d679c}];_0x1db4c7[_0x38a8('0xa5')]({'model':db[_0x38a8('0xcf')],'as':'Account','attributes':['id',_0x38a8('0x33')]});_0x1db4c7[_0x38a8('0xa5')]({'model':db[_0x38a8('0x68')],'as':_0x38a8('0xd0'),'attributes':['id',_0x38a8('0x29')]});return db[_0x38a8('0x2f')]['find']({'where':{'id':_0x1646a5['params']['id']},'include':_0x1db4c7})[_0x38a8('0x25')](handleEntityNotFound(_0x579b45,null))[_0x38a8('0x25')](function(_0x3a7f3e){if(_0x3a7f3e){var _0xbad495=_0x3a7f3e[_0x38a8('0xd1')]({'plain':!![]});fs[_0x38a8('0xd2')](_0x372b6d);var _0x5a6914={'channel':_0x38a8('0xd3'),'account':_0xbad495['Account'][_0x38a8('0x33')],'agent':_0xbad495['Owner']?_0xbad495[_0x38a8('0xd0')][_0x38a8('0x29')]:'N.A.','createdAt':moment(_0xbad495['createdAt'])[_0x38a8('0xb9')](_0x38a8('0xba'))[_0x38a8('0x93')](),'closedAt':_0xbad495[_0x38a8('0xd4')]?moment(_0xbad495[_0x38a8('0xd5')])[_0x38a8('0xb9')]('YYYY-MM-DD\x20HH:mm:ss')[_0x38a8('0x93')]():'','disposition':_0xbad495[_0x38a8('0xd6')],'visibility':_0xbad495[_0x38a8('0xd7')]?_0x38a8('0xd8'):_0x38a8('0xd9'),'messages':_(_0xbad495[_0x38a8('0xda')])[_0x38a8('0x7e')]({'secret':![]})[_0x38a8('0x2e')](function(_0x64b6ec){if(_0x64b6ec[_0x38a8('0xcd')]){var _0x2d6e67=path[_0x38a8('0xc7')](_0x3cf476,_0x64b6ec[_0x38a8('0xcd')][_0x38a8('0xdb')]);if(fs['existsSync'](_0x2d6e67)){fs['createReadStream'](_0x2d6e67)[_0x38a8('0xdc')](fs['createWriteStream'](path[_0x38a8('0xc7')](_0x372b6d,_0x64b6ec[_0x38a8('0xcd')][_0x38a8('0xdb')])));}}return{'date':moment(_0x64b6ec[_0x38a8('0x74')])[_0x38a8('0xb9')]('YYYY-MM-DD\x20HH:mm:ss')[_0x38a8('0x93')](),'sender':_0x64b6ec[_0x38a8('0xdd')]===_0x38a8('0xde')?_0x64b6ec['User']?_0x64b6ec[_0x38a8('0x68')][_0x38a8('0x29')]:_0x38a8('0xdf'):_0x64b6ec[_0x38a8('0x5e')][_0x38a8('0xcb')]+(_0x64b6ec[_0x38a8('0x5e')][_0x38a8('0xcc')]?'\x20'+_0x64b6ec[_0x38a8('0x5e')][_0x38a8('0xcc')]:''),'body':_0x64b6ec[_0x38a8('0xcd')]?_0x64b6ec[_0x38a8('0xcd')][_0x38a8('0xdb')]:_0x64b6ec[_0x38a8('0x6d')],'direction':_0x64b6ec[_0x38a8('0xdd')]===_0x38a8('0xde')?'A':'C','secret':_0x64b6ec[_0x38a8('0xce')],'read':_0x64b6ec[_0x38a8('0x7b')],'attachment':_0x64b6ec[_0x38a8('0xcd')]};})['value']()};return ejs[_0x38a8('0xe0')](path['join'](config['root'],'server',_0x38a8('0xe1'),_0x38a8('0xe2')),{'interaction':_0x5a6914})[_0x38a8('0x25')](function(_0x4f9a7b){var _0x46ebf0=path['join'](_0x372b6d,_0x38a8('0xe3')+_0xbad495['id']+'-'+_0x504b88+'.pdf');var _0x21427e={'path':_0x46ebf0,'channel':_0x38a8('0xd3'),'interactionId':_0xbad495['id']};return pdf[_0x38a8('0xe4')](_0x4f9a7b,_0x21427e);})[_0x38a8('0x25')](function(){return new BPromise(function(_0x5e762a,_0x49876c){zipdir(_0x372b6d,{'saveTo':_0x1c6bf2},function(_0x58478a,_0x474e4b){if(_0x58478a)return _0x49876c(_0x58478a);return _0x5e762a(_0x474e4b);});})['then'](function(){return new BPromise(function(_0xe02857,_0x32c316){rimraf(_0x372b6d,function(_0x3d5316){if(_0x3d5316)_0x32c316(_0x3d5316);return _0xe02857();});});})[_0x38a8('0x25')](function(){return _0x579b45[_0x38a8('0xc2')](_0x1c6bf2,_0x4b8a76,function(_0x4fa8ce){if(_0x4fa8ce){console['log'](_0x38a8('0xe5'),_0x4fa8ce);}else{fs[_0x38a8('0xe6')](_0x1c6bf2);}});});});}else{return _0x579b45[_0x38a8('0xe7')](0xc8);}})['catch'](handleError(_0x579b45,null));}; \ No newline at end of file +var _0xd58b=['log','err','rimraf','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','api','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','register','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','sendStatus','error','stack','name','send','Users','map','TagIds','Tags','split','forEach','catch','index','OpenchannelInteraction','rawAttributes','fieldName','type','key','query','keys','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','order','sort','where','filters','pick','select','field','color','from','tools_tags','u.fullname','ui.OpenchannelInteractionId','user_has_openchannel_interactions','left_join','u.id\x20=\x20ui.UserId','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','o.id\x20=\x20i.UserId','openchannel_accounts','a.id\x20=\x20i.OpenchannelAccountId','openchannel_messages','me.OpenchannelInteractionId\x20=\x20i.id','openchannel_interaction_has_tags','it.OpenchannelInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','conditions','find','unreadMessages','value','`\x20=\x200','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)','ContactId','buildExpression','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','some','isEmpty','OpenchannelAccountId','i.OpenchannelAccountId\x20IN\x20?','concat','createdAt','parse','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','read','tag','filter','replace','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','resolve','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getOpenchannelAccounts','i.OpenchannelAccountId\x20IS\x20NULL','sequelize','keyBy','merge','a.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','toString','groupBy','OpenchannelInteractionId','all','rows','show','params','includeAll','include','create','describe','addMessage','omit','ids','getMessages','findOne','OpenchannelMessage','$gte','format','YYYY-MM-DD\x20HH:mm:ss','findAll','addTags','setTags','spread','openchannelInteractionTags:save','removeTags','download','unix','join','server','files','attachments','CmContact','lastName','Attachment','Messages','secret','push','OpenchannelAccount','Account','Owner','fullname','mkdirSync','Openchannel','N.A.','closed','closedAt','disposition','basename','existsSync','createWriteStream','direction','out','System','root','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML'];(function(_0x5758c8,_0x23722b){var _0x648591=function(_0x2ab376){while(--_0x2ab376){_0x5758c8['push'](_0x5758c8['shift']());}};_0x648591(++_0x23722b);}(_0xd58b,0xed));var _0xbd58=function(_0x342baa,_0x4a110f){_0x342baa=_0x342baa-0x0;var _0x1208f3=_0xd58b[_0x342baa];return _0x1208f3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbd58('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbd58('0x1'));var rp=require(_0xbd58('0x2'));var moment=require(_0xbd58('0x3'));var BPromise=require(_0xbd58('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xbd58('0x5'));var sox=require(_0xbd58('0x6'));var csv=require(_0xbd58('0x7'));var ejs=require(_0xbd58('0x8'));var fs=require('fs');var fs_extra=require(_0xbd58('0x9'));var _=require(_0xbd58('0xa'));var squel=require(_0xbd58('0xb'));var crypto=require(_0xbd58('0xc'));var jsforce=require(_0xbd58('0xd'));var deskjs=require(_0xbd58('0xe'));var toCsv=require(_0xbd58('0x7'));var querystring=require(_0xbd58('0xf'));var Papa=require(_0xbd58('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xbd58('0x11'));var as=require(_0xbd58('0x12'));var pdf=require(_0xbd58('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xbd58('0x14'));var utils=require(_0xbd58('0x15'));var config=require(_0xbd58('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xbd58('0x17')]=_[_0xbd58('0x18')](config[_0xbd58('0x17')],{'host':_0xbd58('0x19'),'port':0x18eb});var socket=require(_0xbd58('0x1a'))(new Redis(config[_0xbd58('0x17')]));require('./openchannelInteraction.socket')[_0xbd58('0x1b')](socket);function respondWithStatusCode(_0x19df5e,_0x3124f2){_0x3124f2=_0x3124f2||0xcc;return function(_0x1559e8){if(_0x1559e8){return _0x19df5e['sendStatus'](_0x3124f2);}return _0x19df5e['status'](_0x3124f2)[_0xbd58('0x1c')]();};}function respondWithResult(_0x57eab1,_0x3994c9){_0x3994c9=_0x3994c9||0xc8;return function(_0x25cac0){if(_0x25cac0){return _0x57eab1[_0xbd58('0x1d')](_0x3994c9)[_0xbd58('0x1e')](_0x25cac0);}};}function respondWithFilteredResult(_0x2cd6f8,_0x5a247f){return function(_0x52a6de){if(_0x52a6de){var _0x7f939a=typeof _0x5a247f[_0xbd58('0x1f')]===_0xbd58('0x20')&&typeof _0x5a247f[_0xbd58('0x21')]==='undefined';var _0x3882c5=_0x52a6de[_0xbd58('0x22')];var _0xebdb2c=_0x7f939a?0x0:_0x5a247f[_0xbd58('0x1f')];var _0x65f467=_0x7f939a?_0x52a6de[_0xbd58('0x22')]:_0x5a247f[_0xbd58('0x1f')]+_0x5a247f[_0xbd58('0x21')];var _0x27fdde;if(_0x65f467>=_0x3882c5){_0x65f467=_0x3882c5;_0x27fdde=0xc8;}else{_0x27fdde=0xce;}_0x2cd6f8[_0xbd58('0x1d')](_0x27fdde);return _0x2cd6f8[_0xbd58('0x23')](_0xbd58('0x24'),_0xebdb2c+'-'+_0x65f467+'/'+_0x3882c5)[_0xbd58('0x1e')](_0x52a6de);}return null;};}function patchUpdates(_0x1660bd){return function(_0x486940){try{jsonpatch[_0xbd58('0x25')](_0x486940,_0x1660bd,!![]);}catch(_0x26212e){return BPromise[_0xbd58('0x26')](_0x26212e);}return _0x486940['save']();};}function saveUpdates(_0x4e4165,_0x137d95){return function(_0x5722a7){if(_0x5722a7){return _0x5722a7[_0xbd58('0x27')](_0x4e4165)[_0xbd58('0x28')](function(_0x4aebf3){return _0x4aebf3;});}return null;};}function removeEntity(_0xc14944,_0x1b234c){return function(_0x22086f){if(_0x22086f){return _0x22086f[_0xbd58('0x29')]()['then'](function(){_0xc14944[_0xbd58('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5421a2,_0x5e9770){return function(_0x22fd6e){if(!_0x22fd6e){_0x5421a2[_0xbd58('0x2a')](0x194);}return _0x22fd6e;};}function handleError(_0x54b78,_0x21cfb0){_0x21cfb0=_0x21cfb0||0x1f4;return function(_0xe2c4b5){logger[_0xbd58('0x2b')](_0xe2c4b5[_0xbd58('0x2c')]);if(_0xe2c4b5[_0xbd58('0x2d')]){delete _0xe2c4b5[_0xbd58('0x2d')];}_0x54b78['status'](_0x21cfb0)[_0xbd58('0x2e')](_0xe2c4b5);};}function getInteractionUsers(_0x4ae59b,_0x4ce0a5){return new BPromise(function(_0x453dbf,_0xf12e53){try{if(_0x4ce0a5[_0x4ae59b['id']]){_0x4ae59b[_0xbd58('0x2f')]=_[_0xbd58('0x30')](_0x4ce0a5[_0x4ae59b['id']],function(_0x31859c){return{'id':_0x31859c['id'],'fullname':_0x31859c['fullname']};});}}catch(_0x94f503){_0xf12e53(_0x94f503);}_0x453dbf(_0x4ae59b);});}function getInteractionTags(_0x404ca3,_0x455f92){return new BPromise(function(_0x56d24c,_0x5cb121){try{if(_0x404ca3[_0xbd58('0x31')]){_0x404ca3[_0xbd58('0x32')]=[];_0x404ca3[_0xbd58('0x31')][_0xbd58('0x33')](',')[_0xbd58('0x34')](function(_0x327ee6){_0x404ca3['Tags']['push'](_0x455f92[_0x327ee6]);});}delete _0x404ca3[_0xbd58('0x31')];}catch(_0x4d16ed){_0x5cb121(_0x4d16ed);}_0x56d24c(_0x404ca3);});}function updateOpenchannelInteraction(_0x20f4e8,_0x2af19d,_0x167049){return new BPromise(function(_0x432168,_0x3dd919){return getInteractionUsers(_0x20f4e8,_0x167049)[_0xbd58('0x28')](function(_0x24c3ca){return getInteractionTags(_0x24c3ca,_0x2af19d);})[_0xbd58('0x28')](function(_0x2051ae){_0x432168(_0x2051ae);})[_0xbd58('0x35')](function(_0x43a087){_0x3dd919(_0x43a087);});});}exports[_0xbd58('0x36')]=function(_0x489939,_0x507ef3){var _0x335873={},_0x3c8c91={},_0x3b0222={'count':0x0,'rows':[]};var _0x18ee1a=_['map'](db[_0xbd58('0x37')][_0xbd58('0x38')],function(_0x44e243){return{'name':_0x44e243[_0xbd58('0x39')],'type':_0x44e243[_0xbd58('0x3a')][_0xbd58('0x3b')]};});_0x3c8c91['model']=_[_0xbd58('0x30')](_0x18ee1a,'name');_0x3c8c91[_0xbd58('0x3c')]=_[_0xbd58('0x3d')](_0x489939[_0xbd58('0x3c')]);_0x3c8c91['filters']=_[_0xbd58('0x3e')](_0x3c8c91['model'],_0x3c8c91['query']);_0x335873[_0xbd58('0x3f')]=_[_0xbd58('0x3e')](_0x3c8c91['model'],qs[_0xbd58('0x40')](_0x489939[_0xbd58('0x3c')][_0xbd58('0x40')]));_0x335873[_0xbd58('0x3f')]=_0x335873['attributes'][_0xbd58('0x41')]?_0x335873[_0xbd58('0x3f')]:_0x3c8c91[_0xbd58('0x42')];if(!_0x489939[_0xbd58('0x3c')][_0xbd58('0x43')](_0xbd58('0x44'))){_0x335873[_0xbd58('0x21')]=qs[_0xbd58('0x21')](_0x489939[_0xbd58('0x3c')][_0xbd58('0x21')]);_0x335873[_0xbd58('0x1f')]=qs[_0xbd58('0x1f')](_0x489939[_0xbd58('0x3c')]['offset']);}_0x335873[_0xbd58('0x45')]=qs['sort'](_0x489939[_0xbd58('0x3c')][_0xbd58('0x46')]);_0x335873[_0xbd58('0x47')]=qs[_0xbd58('0x48')](_[_0xbd58('0x49')](_0x489939['query'],_0x3c8c91['filters']),_0x18ee1a);var _0x1f622e=[];var _0x2bcdf7=squel[_0xbd58('0x4a')]()[_0xbd58('0x4b')]('id')[_0xbd58('0x4b')](_0xbd58('0x2d'))[_0xbd58('0x4b')](_0xbd58('0x4c'))[_0xbd58('0x4d')](_0xbd58('0x4e'));var _0x36eb0c=squel['select']()[_0xbd58('0x4b')]('u.id')['field'](_0xbd58('0x4f'))[_0xbd58('0x4b')](_0xbd58('0x50'))[_0xbd58('0x4d')](_0xbd58('0x51'),'ui')[_0xbd58('0x52')]('users','u',_0xbd58('0x53'));var _0x239f2f=squel[_0xbd58('0x4a')]()['from']('openchannel_interactions','i')[_0xbd58('0x52')]('cm_contacts','c',_0xbd58('0x54'))[_0xbd58('0x52')](_0xbd58('0x55'),'o',_0xbd58('0x56'))[_0xbd58('0x52')](_0xbd58('0x57'),'a',_0xbd58('0x58'))['left_join'](_0xbd58('0x59'),'me',_0xbd58('0x5a'))[_0xbd58('0x52')](_0xbd58('0x5b'),'it',_0xbd58('0x5c'))[_0xbd58('0x52')]('tools_tags','t',_0xbd58('0x5d'));var _0x4915a3=squel[_0xbd58('0x5e')]();var _0xf085b3=[];var _0x3c1a7d=squel[_0xbd58('0x5e')]();var _0xee279d;if(_0x489939[_0xbd58('0x3c')][_0xbd58('0x5f')]){_0xee279d=as[_0xbd58('0x60')](_0x489939[_0xbd58('0x3c')][_0xbd58('0x5f')]);var _0x4d631d=_0xee279d['sqlOperator'];for(var _0x48cab5=0x0;_0x48cab5<_0xee279d[_0xbd58('0x61')][_0xbd58('0x41')];_0x48cab5++){var _0x354db7=_0xee279d['conditions'][_0x48cab5];var _0x5a2a78='i';var _0x39a010=_[_0xbd58('0x62')](_0x18ee1a,[_0xbd58('0x2d'),_0x354db7[_0xbd58('0x4b')]]);if(!_0x39a010){switch(_0x354db7[_0xbd58('0x4b')]){case _0xbd58('0x63'):if(_0x354db7[_0xbd58('0x64')]==0x1){_0x239f2f['having']('`'+_0x354db7['field']+_0xbd58('0x65'));}else{_0x239f2f[_0xbd58('0x66')]('`'+_0x354db7[_0xbd58('0x4b')]+_0xbd58('0x67'));}break;case _0xbd58('0x68'):if(_0x354db7[_0xbd58('0x69')]===_0xbd58('0x6a')){if(_0x354db7[_0xbd58('0x64')]['split']('\x20')[_0xbd58('0x41')]>0x1){_0x4915a3[_0x4d631d](_0xbd58('0x6b'),qs['getFullTextValue'](_0x354db7[_0xbd58('0x64')]),null);}else{var _0x416092='%'+_0x354db7[_0xbd58('0x64')]+'%';_0x4915a3[_0x4d631d]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x416092,_0x416092,_0x416092);}}else{_0x39a010=_[_0xbd58('0x62')](_0x18ee1a,[_0xbd58('0x2d'),'ContactId']);_0x354db7[_0xbd58('0x4b')]=_0xbd58('0x6c');_0x844378=as[_0xbd58('0x6d')](_0x5a2a78,_0x39a010[_0xbd58('0x3a')],_0x354db7);_0x4915a3[_0x4d631d](_0x844378[_0xbd58('0x6e')],_0x844378[_0xbd58('0x64')][_0xbd58('0x6f')],_0x844378[_0xbd58('0x64')][_0xbd58('0x1c')]);}break;case _0xbd58('0x70'):var _0x16b64e=_0x354db7[_0xbd58('0x64')][_0xbd58('0x33')](',')[_0xbd58('0x30')](function(_0x5a670f){return Number(_0x5a670f);});_0x16b64e[_0xbd58('0x34')](function(_0x593eed){_0x3c1a7d['or'](_0xbd58('0x71'),'%,'+_0x593eed+',%');});_0xf085b3=_[_0xbd58('0x72')](_0xf085b3,_0x16b64e);break;case _0xbd58('0x73'):if(_0x354db7['operator']===_0xbd58('0x6a')){_0x4915a3[_0x4d631d](_0xbd58('0x74'),'%'+_0x354db7[_0xbd58('0x64')]+'%',null);}else{_0x39a010=_[_0xbd58('0x62')](_0x18ee1a,[_0xbd58('0x2d'),_0xbd58('0x75')]);_0x354db7[_0xbd58('0x4b')]=_0xbd58('0x75');_0x844378=as[_0xbd58('0x6d')](_0x5a2a78,_0x39a010[_0xbd58('0x3a')],_0x354db7);_0x4915a3[_0x4d631d](_0x844378[_0xbd58('0x6e')],_0x844378[_0xbd58('0x64')]['start'],_0x844378[_0xbd58('0x64')]['end']);}break;case _0xbd58('0x76'):_0x844378=as[_0xbd58('0x6d')]('me',null,_0x354db7);_0x4915a3[_0x4d631d](_0x844378[_0xbd58('0x6e')],_0x844378[_0xbd58('0x64')][_0xbd58('0x6f')],_0x844378[_0xbd58('0x64')][_0xbd58('0x1c')]);break;}}else{var _0x844378=as['buildExpression'](_0x5a2a78,_0x39a010[_0xbd58('0x3a')],_0x354db7);_0x4915a3[_0x4d631d](_0x844378[_0xbd58('0x6e')],_0x844378[_0xbd58('0x64')]['start'],_0x844378[_0xbd58('0x64')][_0xbd58('0x1c')]);}}}else{var _0x691f8a=_(_0x489939['query'])[_0xbd58('0x3d')]()[_0xbd58('0x30')](function(_0x161352){return _[_0xbd58('0x77')](_0x18ee1a,[_0xbd58('0x2d'),_0x161352])?_0x161352:undefined;})['compact']()[_0xbd58('0x64')]();if(!_[_0xbd58('0x78')](_0x691f8a)){_0x691f8a[_0xbd58('0x34')](function(_0x28e32c){if(_0x28e32c===_0xbd58('0x79')){_0x239f2f[_0xbd58('0x47')](_0xbd58('0x7a'),[][_0xbd58('0x7b')](_0x489939[_0xbd58('0x3c')][_0x28e32c]));}else if(_0x28e32c===_0xbd58('0x7c')){var _0x5ce0f6=JSON[_0xbd58('0x7d')](_0x489939['query'][_0x28e32c])['$gte'];var _0xb43511=JSON[_0xbd58('0x7d')](_0x489939['query'][_0x28e32c])['$lte'];_0x239f2f[_0xbd58('0x47')](_0xbd58('0x7e'),_0x5ce0f6,_0xb43511);}else{if(_0x489939['query'][_0x28e32c]===_0xbd58('0x7f')){_0x239f2f[_0xbd58('0x47')]('i.'+_0x28e32c+'\x20IS\x20NULL');}else{_0x239f2f['where']('i.'+_0x28e32c+_0xbd58('0x80'),_0x489939['query'][_0x28e32c]);}}});}if(_0x489939['query'][_0xbd58('0x81')]){if(_0x489939['query']['read']==0x1){_0x239f2f[_0xbd58('0x66')]('`unreadMessages`\x20=\x200');}else{_0x239f2f[_0xbd58('0x66')]('`unreadMessages`\x20>\x200');}}if(_0x489939[_0xbd58('0x3c')]['tag']){_0xf085b3=_['isArray'](_0x489939['query'][_0xbd58('0x82')])?_0x489939[_0xbd58('0x3c')]['tag']:new Array(_0x489939[_0xbd58('0x3c')][_0xbd58('0x82')]);_0xf085b3[_0xbd58('0x34')](function(_0x4016e2){_0x3c1a7d['or'](_0xbd58('0x71'),'%,'+_0x4016e2+',%');});}if(_0x489939[_0xbd58('0x3c')][_0xbd58('0x83')]){var _0x54dfb8=_0x489939[_0xbd58('0x3c')][_0xbd58('0x83')]['replace']('\x5c','\x5c\x5c')[_0xbd58('0x84')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x54dfb8)){_0x4915a3['or'](_0xbd58('0x85'),_0x54dfb8+'%');}else{_0x4915a3['or'](_0xbd58('0x86'),qs['getFullTextValue'](_0x54dfb8))['or']('i.from\x20LIKE\x20?',_0x54dfb8+'%')['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x54dfb8+'%');}}}_0x239f2f[_0xbd58('0x47')](_0x4915a3);_0x239f2f[_0xbd58('0x87')](_0xbd58('0x88'));var _0x132414={'type':db[_0xbd58('0x89')][_0xbd58('0x8a')][_0xbd58('0x8b')],'raw':!![]};var _0x5ebc81=_0x239f2f[_0xbd58('0x8c')]();_0x5ebc81[_0xbd58('0x4b')](_0xbd58('0x88'));_0x5ebc81[_0xbd58('0x4b')](_0xbd58('0x8d'),_0xbd58('0x63'));if(_0x335873[_0xbd58('0x45')]){_0x335873[_0xbd58('0x45')][_0xbd58('0x34')](function(_0x30ec03){var _0x5830c9=_0x30ec03[0x0]===_0xbd58('0x8e')?_0x30ec03[0x0]:'i.'+_0x30ec03[0x0];_0x239f2f[_0xbd58('0x45')](_0x5830c9,_0x30ec03[0x1]===_0xbd58('0x8f')?![]:!![]);});}if(!_['isEmpty'](_0xf085b3)){_0x239f2f['having'](_0x3c1a7d);_0x5ebc81['where']('t.id\x20IN\x20?',_0xf085b3);}BPromise[_0xbd58('0x90')]()[_0xbd58('0x28')](function(){if(!_0xee279d){if(_0x489939[_0xbd58('0x3c')][_0xbd58('0x79')])return;_0x5ebc81['where'](_0xbd58('0x91'));_0x239f2f['where']('i.OpenchannelAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x489939[_0xbd58('0x92')][_0xbd58('0x93')]!==_0xbd58('0x94'))return;return _0x489939['user'][_0xbd58('0x95')]({'attributes':['id'],'raw':!![]})[_0xbd58('0x28')](function(_0x3e9583){if(_[_0xbd58('0x78')](_0x3e9583)){_0x5ebc81[_0xbd58('0x47')](_0xbd58('0x96'));_0x239f2f[_0xbd58('0x47')](_0xbd58('0x96'));}else{_0x5ebc81[_0xbd58('0x47')]('i.OpenchannelAccountId\x20IN\x20?',_['map'](_0x3e9583,'id'));_0x239f2f[_0xbd58('0x47')](_0xbd58('0x7a'),_[_0xbd58('0x30')](_0x3e9583,'id'));}});})['then'](function(){if(_0x489939[_0xbd58('0x92')]['role']===_0xbd58('0x94')&&!_0xee279d&&!_0x489939['query']['OpenchannelAccountId'])return[];return db[_0xbd58('0x97')][_0xbd58('0x3c')](_0x5ebc81['toString'](),_0x132414);})[_0xbd58('0x28')](function(_0x5822e9){_0x3b0222[_0xbd58('0x22')]=_0x5822e9[_0xbd58('0x41')];if(_0x3b0222[_0xbd58('0x22')]===0x0)return[];return db[_0xbd58('0x97')][_0xbd58('0x3c')](_0x2bcdf7['toString'](),_0x132414)[_0xbd58('0x28')](function(_0x435aef){_0x1f622e=_[_0xbd58('0x98')](_0x435aef,'id');_0x132414=_[_0xbd58('0x99')](_0x132414,{'model':db['OpenchannelInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x489939[_0xbd58('0x3c')][_0xbd58('0x40')]){_0x335873[_0xbd58('0x3f')][_0xbd58('0x34')](function(_0x5e7395){_0x239f2f[_0xbd58('0x4b')]('i.'+_0x5e7395);});}else{_0x239f2f[_0xbd58('0x4b')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xbd58('0x63'));_0x239f2f['field'](_0xbd58('0x9a'),'Account.key');_0x239f2f[_0xbd58('0x4b')](_0xbd58('0x9b'),_0xbd58('0x9c'));_0x239f2f[_0xbd58('0x4b')]('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',_0xbd58('0x8e'));_0x239f2f[_0xbd58('0x4b')](_0xbd58('0x9d'));_0x239f2f[_0xbd58('0x4b')](_0xbd58('0x9e'),_0xbd58('0x9f'));_0x239f2f['field'](_0xbd58('0xa0'),_0xbd58('0xa1'));_0x239f2f[_0xbd58('0x4b')](_0xbd58('0xa2'),'Contact.email');_0x239f2f[_0xbd58('0x4b')](_0xbd58('0xa3'),_0xbd58('0xa4'));_0x239f2f[_0xbd58('0x4b')](_0xbd58('0xa5'),_0xbd58('0xa6'));_0x239f2f[_0xbd58('0x4b')](_0xbd58('0xa7'),_0xbd58('0xa8'));_0x239f2f[_0xbd58('0x4b')]('o.fullname',_0xbd58('0xa9'));_0x239f2f[_0xbd58('0x4b')](_0xbd58('0xaa'),_0xbd58('0xab'));_0x239f2f['field'](_0xbd58('0xac'),'TagIds');}if(_0x335873[_0xbd58('0x21')])_0x239f2f['limit'](_0x335873[_0xbd58('0x21')]);if(_0x335873['offset'])_0x239f2f[_0xbd58('0x1f')](_0x335873[_0xbd58('0x1f')]);return db[_0xbd58('0x97')][_0xbd58('0x3c')](_0x239f2f[_0xbd58('0xad')](),_0x132414);})[_0xbd58('0x28')](function(_0x36e234){if(_0x36e234['length']>0x0)_0x36eb0c[_0xbd58('0x47')]('ui.OpenchannelInteractionId\x20IN\x20?',_[_0xbd58('0x30')](_0x36e234,'id'));return db[_0xbd58('0x97')][_0xbd58('0x3c')](_0x36eb0c[_0xbd58('0xad')](),_0x132414)['then'](function(_0x26df56){var _0x931951=_[_0xbd58('0xae')](_0x26df56,_0xbd58('0xaf'));var _0x26516b=[];_0x36e234[_0xbd58('0x34')](function(_0x522651){_0x26516b['push'](updateOpenchannelInteraction(_0x522651,_0x1f622e,_0x931951));});return BPromise[_0xbd58('0xb0')](_0x26516b);});});})[_0xbd58('0x28')](function(_0x10d317){_0x3b0222[_0xbd58('0xb1')]=_0x10d317;return _0x3b0222;})['then'](respondWithFilteredResult(_0x507ef3,_0x335873))['catch'](handleError(_0x507ef3,null));};exports[_0xbd58('0xb2')]=function(_0x28b471,_0x8ff2d8){var _0x44c478={};if(_0x28b471[_0xbd58('0x3c')][_0xbd58('0x3a')]&&_0x28b471['query'][_0xbd58('0x3a')]===_0xbd58('0x4d')){_0x44c478[_0xbd58('0x4d')]=_0x28b471[_0xbd58('0xb3')]['id'];}else{_0x44c478['id']=_0x28b471['params']['id'];}var _0x19513c={'raw':![],'where':_0x44c478},_0x10cfa3={};_0x10cfa3['model']=_[_0xbd58('0x3d')](db[_0xbd58('0x37')][_0xbd58('0x38')]);_0x10cfa3[_0xbd58('0x3c')]=_[_0xbd58('0x3d')](_0x28b471[_0xbd58('0x3c')]);_0x10cfa3[_0xbd58('0x48')]=_[_0xbd58('0x3e')](_0x10cfa3['model'],_0x10cfa3[_0xbd58('0x3c')]);_0x19513c[_0xbd58('0x3f')]=_[_0xbd58('0x3e')](_0x10cfa3['model'],qs[_0xbd58('0x40')](_0x28b471[_0xbd58('0x3c')][_0xbd58('0x40')]));_0x19513c[_0xbd58('0x3f')]=_0x19513c[_0xbd58('0x3f')][_0xbd58('0x41')]?_0x19513c[_0xbd58('0x3f')]:_0x10cfa3[_0xbd58('0x42')];if(_0x28b471['query'][_0xbd58('0xb4')]){_0x19513c[_0xbd58('0xb5')]=[{'all':!![]}];}_0x19513c=_[_0xbd58('0x99')]({},_0x19513c,_0x28b471['options']);return db[_0xbd58('0x37')]['find'](_0x19513c)[_0xbd58('0x28')](handleEntityNotFound(_0x8ff2d8,null))[_0xbd58('0x28')](respondWithResult(_0x8ff2d8,null))[_0xbd58('0x35')](handleError(_0x8ff2d8,null));};exports[_0xbd58('0xb6')]=function(_0x2b13c3,_0x35c351){return db[_0xbd58('0x37')][_0xbd58('0xb6')](_0x2b13c3[_0xbd58('0x76')],{})[_0xbd58('0x28')](respondWithResult(_0x35c351,0xc9))[_0xbd58('0x35')](handleError(_0x35c351,null));};exports[_0xbd58('0x27')]=function(_0x1806cc,_0x4dc40e){if(_0x1806cc[_0xbd58('0x76')]['id']){delete _0x1806cc['body']['id'];}return db[_0xbd58('0x37')][_0xbd58('0x62')]({'where':{'id':_0x1806cc[_0xbd58('0xb3')]['id']}})[_0xbd58('0x28')](handleEntityNotFound(_0x4dc40e,null))['then'](saveUpdates(_0x1806cc[_0xbd58('0x76')],null))[_0xbd58('0x28')](respondWithResult(_0x4dc40e,null))[_0xbd58('0x35')](handleError(_0x4dc40e,null));};exports[_0xbd58('0x29')]=function(_0x2ab24a,_0x29c9d4){return db[_0xbd58('0x37')]['find']({'where':{'id':_0x2ab24a[_0xbd58('0xb3')]['id']}})[_0xbd58('0x28')](handleEntityNotFound(_0x29c9d4,null))[_0xbd58('0x28')](removeEntity(_0x29c9d4,null))['catch'](handleError(_0x29c9d4,null));};exports['describe']=function(_0x1a93da,_0x50fed5){return db[_0xbd58('0x37')][_0xbd58('0xb7')]()[_0xbd58('0x28')](respondWithResult(_0x50fed5,null))[_0xbd58('0x35')](handleError(_0x50fed5,null));};exports['addMessage']=function(_0x3a592a,_0x3d9729,_0x37eec4){return db['OpenchannelMessage'][_0xbd58('0x62')]({'where':{'id':_0x3a592a['params']['id']}})[_0xbd58('0x28')](handleEntityNotFound(_0x3d9729,null))[_0xbd58('0x28')](function(_0x193e2f){if(_0x193e2f){return _0x193e2f[_0xbd58('0xb8')](_0x3a592a[_0xbd58('0x76')]['ids'],_[_0xbd58('0xb9')](_0x3a592a['body'],[_0xbd58('0xba'),'id'])||{});}})['then'](respondWithResult(_0x3d9729,null))[_0xbd58('0x35')](handleError(_0x3d9729,null));};exports[_0xbd58('0xbb')]=function(_0x170609,_0x31ce62,_0x3bcde0){var _0x1f7ce6={'raw':![],'where':{}};var _0x3066d7={};var _0xf405f2={'count':0x0,'rows':[]};return db[_0xbd58('0x37')][_0xbd58('0xbc')]({'where':{'id':_0x170609[_0xbd58('0xb3')]['id']}})[_0xbd58('0x28')](handleEntityNotFound(_0x31ce62,null))[_0xbd58('0x28')](function(_0x4cc110){if(_0x4cc110){_0x3066d7[_0xbd58('0x42')]=_[_0xbd58('0x3d')](db[_0xbd58('0xbd')][_0xbd58('0x38')]);_0x3066d7[_0xbd58('0x3c')]=_[_0xbd58('0x3d')](_0x170609[_0xbd58('0x3c')]);_0x3066d7[_0xbd58('0x48')]=_[_0xbd58('0x3e')](_0x3066d7[_0xbd58('0x42')],_0x3066d7[_0xbd58('0x3c')]);_0x1f7ce6[_0xbd58('0x3f')]=_['intersection'](_0x3066d7[_0xbd58('0x42')],qs[_0xbd58('0x40')](_0x170609[_0xbd58('0x3c')][_0xbd58('0x40')]));_0x1f7ce6[_0xbd58('0x3f')]=_0x1f7ce6[_0xbd58('0x3f')][_0xbd58('0x41')]?_0x1f7ce6[_0xbd58('0x3f')]:_0x3066d7['model'];if(!_0x170609[_0xbd58('0x3c')]['hasOwnProperty'](_0xbd58('0x44'))){_0x1f7ce6[_0xbd58('0x21')]=qs[_0xbd58('0x21')](_0x170609[_0xbd58('0x3c')][_0xbd58('0x21')]);_0x1f7ce6[_0xbd58('0x1f')]=qs[_0xbd58('0x1f')](_0x170609['query'][_0xbd58('0x1f')]);}_0x1f7ce6[_0xbd58('0x45')]=qs[_0xbd58('0x46')](_0x170609[_0xbd58('0x3c')][_0xbd58('0x46')]);_0x1f7ce6[_0xbd58('0x47')]=qs[_0xbd58('0x48')](_[_0xbd58('0x49')](_0x170609[_0xbd58('0x3c')],_0x3066d7[_0xbd58('0x48')]));_0x1f7ce6['where'][_0xbd58('0xaf')]=_0x4cc110['id'];if(_0x170609['query'][_0xbd58('0x83')]){_0x1f7ce6[_0xbd58('0x47')]=_['merge'](_0x1f7ce6['where'],{'$or':_[_0xbd58('0x30')](_0x1f7ce6[_0xbd58('0x3f')],function(_0x459e59){var _0x447d78={};_0x447d78[_0x459e59]={'$like':'%'+_0x170609[_0xbd58('0x3c')][_0xbd58('0x83')]+'%'};return _0x447d78;})});}if(_0x170609['query']['$gte']){var _0x1d2aae=_0x170609[_0xbd58('0x3c')][_0xbd58('0xbe')][_0xbd58('0x33')](',');var _0x72f0c9={};_0x72f0c9[_0x1d2aae[0x0]]={'$gte':moment(_0x1d2aae[0x1])[_0xbd58('0xbf')](_0xbd58('0xc0'))};_0x1f7ce6[_0xbd58('0x47')]=_[_0xbd58('0x99')](_0x1f7ce6['where'],_0x72f0c9);}_0x1f7ce6=_[_0xbd58('0x99')]({},_0x1f7ce6,_0x170609['options']);return db[_0xbd58('0xbd')][_0xbd58('0x22')]({'where':_0x1f7ce6[_0xbd58('0x47')]})[_0xbd58('0x28')](function(_0x545b02){_0xf405f2[_0xbd58('0x22')]=_0x545b02;if(_0x170609[_0xbd58('0x3c')][_0xbd58('0xb4')]){_0x1f7ce6[_0xbd58('0xb5')]=[{'all':!![]}];}return db[_0xbd58('0xbd')][_0xbd58('0xc1')](_0x1f7ce6);})[_0xbd58('0x28')](function(_0x90f90){_0xf405f2[_0xbd58('0xb1')]=_0x90f90;return _0xf405f2;});}})['then'](respondWithFilteredResult(_0x31ce62,_0x1f7ce6))[_0xbd58('0x35')](handleError(_0x31ce62,null));};exports[_0xbd58('0xc2')]=function(_0x53c931,_0x355253,_0x334e21){return db[_0xbd58('0x37')][_0xbd58('0x62')]({'where':{'id':_0x53c931[_0xbd58('0xb3')]['id']}})['then'](handleEntityNotFound(_0x355253,null))[_0xbd58('0x28')](function(_0x1cc9c3){if(_0x1cc9c3){return _0x1cc9c3[_0xbd58('0xc3')](_0x53c931[_0xbd58('0x76')][_0xbd58('0xba')],_[_0xbd58('0xb9')](_0x53c931['body'],[_0xbd58('0xba'),'id'])||{})[_0xbd58('0xc4')](function(){return db[_0xbd58('0x70')][_0xbd58('0xc1')]({'attributes':['id',_0xbd58('0x2d'),'color'],'where':{'id':_0x53c931[_0xbd58('0x76')][_0xbd58('0xba')]}});})[_0xbd58('0x28')](function(_0xa35330){socket['emit'](_0xbd58('0xc5'),{'id':Number(_0x53c931['params']['id']),'tags':_0xa35330||[]});return{'id':Number(_0x53c931[_0xbd58('0xb3')]['id']),'tags':_0xa35330||[]};});}})[_0xbd58('0x28')](respondWithResult(_0x355253,null))[_0xbd58('0x35')](handleError(_0x355253,null));};exports['removeTags']=function(_0x448e0d,_0x3a69f9,_0x319b16){return db[_0xbd58('0x37')][_0xbd58('0x62')]({'where':{'id':_0x448e0d[_0xbd58('0xb3')]['id']}})[_0xbd58('0x28')](handleEntityNotFound(_0x3a69f9,null))[_0xbd58('0x28')](function(_0x501fd5){if(_0x501fd5){return _0x501fd5[_0xbd58('0xc6')](_0x448e0d[_0xbd58('0x3c')][_0xbd58('0xba')]);}})[_0xbd58('0x28')](respondWithStatusCode(_0x3a69f9,null))['catch'](handleError(_0x3a69f9,null));};exports[_0xbd58('0xc7')]=function(_0x3e7125,_0x5629ac){var _0x1681d6=moment()[_0xbd58('0xc8')]()[_0xbd58('0xad')]();var _0x349b13=path[_0xbd58('0xc9')](config['root'],_0xbd58('0xca'),_0xbd58('0xcb'),'tmp');var _0xf77384=path['join'](config['root'],'server',_0xbd58('0xcb'),_0xbd58('0xcc'));var _0xdb9eb3=path[_0xbd58('0xc9')](_0x349b13,_0x1681d6);var _0x5cd008=util[_0xbd58('0xbf')]('transcript-%d-%s.zip',_0x3e7125[_0xbd58('0xb3')]['id'],_0x1681d6);var _0x2f551e=path[_0xbd58('0xc9')](_0x349b13,_0x5cd008);var _0x5d4f06=[];_0x5d4f06['push']({'model':db[_0xbd58('0x73')],'as':_0xbd58('0x73'),'attributes':['id','fullname'],'raw':!![]});_0x5d4f06['push']({'model':db[_0xbd58('0xcd')],'as':_0xbd58('0x68'),'attributes':['id','firstName',_0xbd58('0xce')],'raw':!![]});if(_0x3e7125[_0xbd58('0x3c')][_0xbd58('0xcc')]){_0x5d4f06['push']({'model':db[_0xbd58('0xcf')],'as':_0xbd58('0xcf'),'raw':!![]});}var _0x1c31ae=[{'model':db[_0xbd58('0xbd')],'as':_0xbd58('0xd0'),'attributes':['id','body',_0xbd58('0x7c'),'direction',_0xbd58('0xd1'),'read'],'include':_0x5d4f06}];_0x1c31ae[_0xbd58('0xd2')]({'model':db[_0xbd58('0xd3')],'as':_0xbd58('0xd4'),'attributes':['id','name']});_0x1c31ae['push']({'model':db[_0xbd58('0x73')],'as':_0xbd58('0xd5'),'attributes':['id',_0xbd58('0xd6')]});return db[_0xbd58('0x37')][_0xbd58('0x62')]({'where':{'id':_0x3e7125[_0xbd58('0xb3')]['id']},'include':_0x1c31ae})['then'](handleEntityNotFound(_0x5629ac,null))[_0xbd58('0x28')](function(_0x3fd48a){if(_0x3fd48a){var _0x1c6347=_0x3fd48a['get']({'plain':!![]});fs[_0xbd58('0xd7')](_0xdb9eb3);var _0x55271e={'channel':_0xbd58('0xd8'),'account':_0x1c6347['Account']['name'],'agent':_0x1c6347[_0xbd58('0xd5')]?_0x1c6347['Owner']['fullname']:_0xbd58('0xd9'),'createdAt':moment(_0x1c6347[_0xbd58('0x7c')])[_0xbd58('0xbf')](_0xbd58('0xc0'))[_0xbd58('0xad')](),'closedAt':_0x1c6347[_0xbd58('0xda')]?moment(_0x1c6347[_0xbd58('0xdb')])[_0xbd58('0xbf')](_0xbd58('0xc0'))[_0xbd58('0xad')]():'','disposition':_0x1c6347[_0xbd58('0xdc')],'visibility':_0x1c6347['threadId']?'Public':'Private','messages':_(_0x1c6347[_0xbd58('0xd0')])[_0xbd58('0x83')]({'secret':![]})[_0xbd58('0x30')](function(_0xe840d7){if(_0xe840d7[_0xbd58('0xcf')]){var _0x338baf=path['join'](_0xf77384,_0xe840d7[_0xbd58('0xcf')][_0xbd58('0xdd')]);if(fs[_0xbd58('0xde')](_0x338baf)){fs['createReadStream'](_0x338baf)['pipe'](fs[_0xbd58('0xdf')](path['join'](_0xdb9eb3,_0xe840d7[_0xbd58('0xcf')][_0xbd58('0xdd')])));}}return{'date':moment(_0xe840d7[_0xbd58('0x7c')])[_0xbd58('0xbf')](_0xbd58('0xc0'))[_0xbd58('0xad')](),'sender':_0xe840d7[_0xbd58('0xe0')]===_0xbd58('0xe1')?_0xe840d7[_0xbd58('0x73')]?_0xe840d7[_0xbd58('0x73')][_0xbd58('0xd6')]:_0xbd58('0xe2'):_0xe840d7[_0xbd58('0x68')]['firstName']+(_0xe840d7[_0xbd58('0x68')][_0xbd58('0xce')]?'\x20'+_0xe840d7[_0xbd58('0x68')][_0xbd58('0xce')]:''),'body':_0xe840d7['Attachment']?_0xe840d7[_0xbd58('0xcf')][_0xbd58('0xdd')]:_0xe840d7[_0xbd58('0x76')],'direction':_0xe840d7[_0xbd58('0xe0')]==='out'?'A':'C','secret':_0xe840d7[_0xbd58('0xd1')],'read':_0xe840d7[_0xbd58('0x81')],'attachment':_0xe840d7[_0xbd58('0xcf')]};})[_0xbd58('0x64')]()};return ejs['renderFile'](path['join'](config[_0xbd58('0xe3')],_0xbd58('0xca'),_0xbd58('0xe4'),_0xbd58('0xe5')),{'interaction':_0x55271e})[_0xbd58('0x28')](function(_0x470220){var _0x19ee37=path['join'](_0xdb9eb3,_0xbd58('0xe6')+_0x1c6347['id']+'-'+_0x1681d6+_0xbd58('0xe7'));var _0x4c7939={'path':_0x19ee37,'channel':_0xbd58('0xd8'),'interactionId':_0x1c6347['id']};return pdf[_0xbd58('0xe8')](_0x470220,_0x4c7939);})['then'](function(){return new BPromise(function(_0x328318,_0x505b68){zipdir(_0xdb9eb3,{'saveTo':_0x2f551e},function(_0x316a24,_0x36722b){if(_0x316a24)return _0x505b68(_0x316a24);return _0x328318(_0x36722b);});})[_0xbd58('0x28')](function(){return new BPromise(function(_0x1c02d0,_0x432ff6){rimraf(_0xdb9eb3,function(_0x13541c){if(_0x13541c)_0x432ff6(_0x13541c);return _0x1c02d0();});});})[_0xbd58('0x28')](function(){return _0x5629ac[_0xbd58('0xc7')](_0x2f551e,_0x5cd008,function(_0xf32271){if(_0xf32271){console[_0xbd58('0xe9')](_0xbd58('0xea'),_0xf32271);}else{fs['unlinkSync'](_0x2f551e);}});});});}else{return _0x5629ac[_0xbd58('0x2a')](0xc8);}})[_0xbd58('0x35')](handleError(_0x5629ac,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index 3e5450a..4172f0d 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 _0xc1bd=['save','update','remove','then','setDataValue','Users','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','exports','../../mysqldb','OpenchannelInteraction','setMaxListeners'];(function(_0x19af6b,_0x5b2017){var _0x2915aa=function(_0x233ce0){while(--_0x233ce0){_0x19af6b['push'](_0x19af6b['shift']());}};_0x2915aa(++_0x5b2017);}(_0xc1bd,0xda));var _0xdc1b=function(_0xc6e78e,_0x1fbd19){_0xc6e78e=_0xc6e78e-0x0;var _0x1dac61=_0xc1bd[_0xc6e78e];return _0x1dac61;};'use strict';var EventEmitter=require('events');var OpenchannelInteraction=require(_0xdc1b('0x0'))['db'][_0xdc1b('0x1')];var OpenchannelMessage=require(_0xdc1b('0x0'))['db']['OpenchannelMessage'];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0xdc1b('0x2')](0x0);var events={'afterCreate':_0xdc1b('0x3'),'afterUpdate':_0xdc1b('0x4'),'afterDestroy':_0xdc1b('0x5')};function emitEvent(_0x26e85a){return function(_0x36f202,_0x16724e,_0x5437d6){_0x36f202['getUsers']({'attributes':['id'],'raw':!![]})[_0xdc1b('0x6')](function(_0x8f7b37){_0x36f202[_0xdc1b('0x7')](_0xdc1b('0x8'),_0x8f7b37[_0xdc1b('0x9')](function(_0x58f8ac){return{'id':_0x58f8ac['id']};}));return OpenchannelMessage[_0xdc1b('0xa')]({'where':{'OpenchannelInteractionId':_0x36f202['id'],'direction':'in','read':![]},'raw':!![]});})[_0xdc1b('0x6')](function(_0x30b573){_0x36f202['setDataValue'](_0xdc1b('0xb'),_0x30b573[_0xdc1b('0xc')]);OpenchannelInteractionEvents['emit'](_0x26e85a+':'+_0x36f202['id'],_0x36f202);OpenchannelInteractionEvents[_0xdc1b('0xd')](_0x26e85a,_0x36f202);_0x5437d6(null);})[_0xdc1b('0xe')](_0x5437d6(null));};}for(var e in events){if(events[_0xdc1b('0xf')](e)){var event=events[e];OpenchannelInteraction['hook'](e,emitEvent(event));}}module[_0xdc1b('0x10')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0x562b=['setDataValue','findAll','unreadMessages','length','emit','catch','hook','events','../../mysqldb','OpenchannelInteraction','OpenchannelMessage','save','remove','getUsers','then'];(function(_0x31af77,_0x2bd762){var _0x47bbaa=function(_0x21c336){while(--_0x21c336){_0x31af77['push'](_0x31af77['shift']());}};_0x47bbaa(++_0x2bd762);}(_0x562b,0xac));var _0xb562=function(_0x17b6e3,_0x4522ed){_0x17b6e3=_0x17b6e3-0x0;var _0x3906f3=_0x562b[_0x17b6e3];return _0x3906f3;};'use strict';var EventEmitter=require(_0xb562('0x0'));var OpenchannelInteraction=require(_0xb562('0x1'))['db'][_0xb562('0x2')];var OpenchannelMessage=require('../../mysqldb')['db'][_0xb562('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xb562('0x4'),'afterUpdate':'update','afterDestroy':_0xb562('0x5')};function emitEvent(_0x1a0639){return function(_0x4b1462,_0xc1d1f7,_0x3e6eac){_0x4b1462[_0xb562('0x6')]({'attributes':['id'],'raw':!![]})[_0xb562('0x7')](function(_0x4f30c8){_0x4b1462[_0xb562('0x8')]('Users',_0x4f30c8['map'](function(_0x105a7b){return{'id':_0x105a7b['id']};}));return OpenchannelMessage[_0xb562('0x9')]({'where':{'OpenchannelInteractionId':_0x4b1462['id'],'direction':'in','read':![]},'raw':!![]});})[_0xb562('0x7')](function(_0x3d0ce6){_0x4b1462[_0xb562('0x8')](_0xb562('0xa'),_0x3d0ce6[_0xb562('0xb')]);OpenchannelInteractionEvents['emit'](_0x1a0639+':'+_0x4b1462['id'],_0x4b1462);OpenchannelInteractionEvents[_0xb562('0xc')](_0x1a0639,_0x4b1462);_0x3e6eac(null);})[_0xb562('0xd')](_0x3e6eac(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelInteraction[_0xb562('0xe')](e,emitEvent(event));}}module['exports']=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index 8cca79b..b274ebb 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 _0x5f40=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','openchannel_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger'];(function(_0x3a43d0,_0x32af24){var _0xfc40eb=function(_0x5a70d4){while(--_0x5a70d4){_0x3a43d0['push'](_0x3a43d0['shift']());}};_0xfc40eb(++_0x32af24);}(_0x5f40,0xec));var _0x05f4=function(_0x780b26,_0x375a07){_0x780b26=_0x780b26-0x0;var _0x468696=_0x5f40[_0x780b26];return _0x468696;};'use strict';var _=require(_0x05f4('0x0'));var util=require('util');var logger=require(_0x05f4('0x1'))(_0x05f4('0x2'));var moment=require(_0x05f4('0x3'));var BPromise=require(_0x05f4('0x4'));var rp=require(_0x05f4('0x5'));var fs=require('fs');var path=require(_0x05f4('0x6'));var rimraf=require(_0x05f4('0x7'));var config=require(_0x05f4('0x8'));var attributes=require('./openchannelInteraction.attributes');module[_0x05f4('0x9')]=function(_0x12b3c1,_0xfe885b){return _0x12b3c1[_0x05f4('0xa')]('OpenchannelInteraction',attributes,{'tableName':_0x05f4('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3bae9a,_0xd2d8d8,_0x229103){if(_0x3bae9a[_0x05f4('0xc')](_0x05f4('0xd'))){_0x3bae9a[_0x05f4('0xe')]=moment()[_0x05f4('0xf')](_0x05f4('0x10'));}_0x229103(null,_0x3bae9a);}}});}; \ No newline at end of file +var _0xb183=['lodash','util','rimraf','../../config/environment','exports','openchannel_interactions','changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x119961,_0xa7eee8){var _0x10ea5d=function(_0x34db37){while(--_0x34db37){_0x119961['push'](_0x119961['shift']());}};_0x10ea5d(++_0xa7eee8);}(_0xb183,0x1c2));var _0x3b18=function(_0x3ff7cd,_0x4078be){_0x3ff7cd=_0x3ff7cd-0x0;var _0x1e9a9c=_0xb183[_0x3ff7cd];return _0x1e9a9c;};'use strict';var _=require(_0x3b18('0x0'));var util=require(_0x3b18('0x1'));var logger=require('../../config/logger')('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(_0x3b18('0x2'));var config=require(_0x3b18('0x3'));var attributes=require('./openchannelInteraction.attributes');module[_0x3b18('0x4')]=function(_0x1eb6b9,_0x1b4d17){return _0x1eb6b9['define']('OpenchannelInteraction',attributes,{'tableName':_0x3b18('0x5'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2dde18,_0x436105,_0x5338af){if(_0x2dde18[_0x3b18('0x6')](_0x3b18('0x7'))){_0x2dde18[_0x3b18('0x8')]=moment()['format'](_0x3b18('0x9'));}_0x5338af(null,_0x2dde18);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index 5a35418..fb1e386 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 _0x3332=['update','body','options','raw','attributes','limit','UpdateOpenchannelInteraction','catch','find','addTags','omit','ids','spread','AddTags','lodash','util','bluebird','randomstring','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','register','request','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','OpenchannelInteraction'];(function(_0x2d0f7a,_0x1c53b5){var _0x517536=function(_0x9c2bfd){while(--_0x9c2bfd){_0x2d0f7a['push'](_0x2d0f7a['shift']());}};_0x517536(++_0x1c53b5);}(_0x3332,0x118));var _0x2333=function(_0x48d007,_0x446953){_0x48d007=_0x48d007-0x0;var _0x412d80=_0x3332[_0x48d007];return _0x412d80;};'use strict';var _=require(_0x2333('0x0'));var util=require(_0x2333('0x1'));var moment=require('moment');var BPromise=require(_0x2333('0x2'));var rs=require(_0x2333('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x2333('0x4'));var config=require(_0x2333('0x5'));var jayson=require(_0x2333('0x6'));var client=jayson['client'][_0x2333('0x7')]({'port':0x232a});config[_0x2333('0x8')]=_[_0x2333('0x9')](config[_0x2333('0x8')],{'host':_0x2333('0xa'),'port':0x18eb});var socket=require(_0x2333('0xb'))(new Redis(config['redis']));require('./openchannelInteraction.socket')[_0x2333('0xc')](socket);function respondWithRpcPromise(_0x41972a,_0x3ee9b1,_0x4e6944){return new BPromise(function(_0x5d09ae,_0x5214e5){return client[_0x2333('0xd')](_0x41972a,_0x4e6944)['then'](function(_0x3f46cf){logger[_0x2333('0xe')](_0x2333('0xf'),_0x3ee9b1,_0x2333('0x10'));logger[_0x2333('0x11')]('OpenchannelInteraction,\x20%s,\x20%s,\x20%s',_0x3ee9b1,_0x2333('0x10'),JSON[_0x2333('0x12')](_0x3f46cf));if(_0x3f46cf['error']){if(_0x3f46cf[_0x2333('0x13')][_0x2333('0x14')]===0x1f4){logger[_0x2333('0x13')](_0x2333('0xf'),_0x3ee9b1,_0x3f46cf[_0x2333('0x13')]['message']);return _0x5214e5(_0x3f46cf[_0x2333('0x13')][_0x2333('0x15')]);}logger[_0x2333('0x13')](_0x2333('0xf'),_0x3ee9b1,_0x3f46cf[_0x2333('0x13')][_0x2333('0x15')]);return _0x5d09ae(_0x3f46cf[_0x2333('0x13')][_0x2333('0x15')]);}else{logger[_0x2333('0xe')](_0x2333('0xf'),_0x3ee9b1,_0x2333('0x10'));_0x5d09ae(_0x3f46cf[_0x2333('0x16')]['message']);}})['catch'](function(_0x519025){logger['error'](_0x2333('0xf'),_0x3ee9b1,_0x519025);_0x5214e5(_0x519025);});});}exports['UpdateOpenchannelInteraction']=function(_0x102184){var _0x316966=this;return new Promise(function(_0x6a12b9,_0x11ed05){return db[_0x2333('0x17')][_0x2333('0x18')](_0x102184[_0x2333('0x19')],{'raw':_0x102184[_0x2333('0x1a')]?_0x102184['options'][_0x2333('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x102184[_0x2333('0x1a')]?_0x102184[_0x2333('0x1a')]['where']||null:null,'attributes':_0x102184['options']?_0x102184['options'][_0x2333('0x1c')]||null:null,'limit':_0x102184[_0x2333('0x1a')]?_0x102184[_0x2333('0x1a')][_0x2333('0x1d')]||null:null})['then'](function(_0x5d43bf){logger[_0x2333('0xe')](_0x2333('0x1e'),_0x102184);logger[_0x2333('0x11')]('UpdateOpenchannelInteraction',_0x102184,JSON['stringify'](_0x5d43bf));_0x6a12b9(_0x5d43bf);})[_0x2333('0x1f')](function(_0x1eb4b0){logger[_0x2333('0x13')](_0x2333('0x1e'),_0x1eb4b0[_0x2333('0x15')],_0x102184);_0x11ed05(_0x316966[_0x2333('0x13')](0x1f4,_0x1eb4b0[_0x2333('0x15')]));});});};exports['AddTagsToOpenchannelInteraction']=function(_0xfd4977){return new Promise(function(_0x3ba59c,_0xe5b0bc){return db[_0x2333('0x17')][_0x2333('0x20')]({'where':_0xfd4977[_0x2333('0x1a')]?_0xfd4977[_0x2333('0x1a')]['where']||null:null})['then'](function(_0x3d7459){if(_0x3d7459){return _0x3d7459[_0x2333('0x21')](_0xfd4977[_0x2333('0x19')]['ids'],_[_0x2333('0x22')](_0xfd4977['body'],[_0x2333('0x23'),'id'])||{});}})[_0x2333('0x24')](function(_0x3e49c5){logger[_0x2333('0xe')](_0x2333('0x25'),_0xfd4977);logger['debug'](_0x2333('0x25'),_0xfd4977,JSON[_0x2333('0x12')](_0x3e49c5));_0x3ba59c(_0x3e49c5);})['catch'](function(_0x579b19){logger[_0x2333('0x13')](_0x2333('0x25'),_0x579b19[_0x2333('0x15')],_0xfd4977);_0xe5b0bc(_this[_0x2333('0x13')](0x1f4,_0x579b19['message']));});});}; \ No newline at end of file +var _0x968b=['error','message','result','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','body','options','where','attributes','AddTagsToOpenchannelInteraction','find','addTags','ids','omit','AddTags','lodash','moment','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','redis','localhost','socket.io-emitter','./openchannelInteraction.socket','register','request','then','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x268c4c,_0x5cce8d){var _0x37e96e=function(_0x59d4c2){while(--_0x59d4c2){_0x268c4c['push'](_0x268c4c['shift']());}};_0x37e96e(++_0x5cce8d);}(_0x968b,0xe8));var _0xb968=function(_0x296c48,_0x20816a){_0x296c48=_0x296c48-0x0;var _0x234dea=_0x968b[_0x296c48];return _0x234dea;};'use strict';var _=require(_0xb968('0x0'));var util=require('util');var moment=require(_0xb968('0x1'));var BPromise=require('bluebird');var rs=require(_0xb968('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb968('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xb968('0x4'))(_0xb968('0x5'));var config=require('../../config/environment');var jayson=require(_0xb968('0x6'));var client=jayson['client']['http']({'port':0x232a});config[_0xb968('0x7')]=_['defaults'](config[_0xb968('0x7')],{'host':_0xb968('0x8'),'port':0x18eb});var socket=require(_0xb968('0x9'))(new Redis(config[_0xb968('0x7')]));require(_0xb968('0xa'))[_0xb968('0xb')](socket);function respondWithRpcPromise(_0x1b7926,_0xa62ca2,_0xd4361f){return new BPromise(function(_0x27e8dc,_0x403b9e){return client[_0xb968('0xc')](_0x1b7926,_0xd4361f)[_0xb968('0xd')](function(_0x515f2b){logger[_0xb968('0xe')](_0xb968('0xf'),_0xa62ca2,_0xb968('0x10'));logger[_0xb968('0x11')](_0xb968('0x12'),_0xa62ca2,'request\x20sent',JSON[_0xb968('0x13')](_0x515f2b));if(_0x515f2b[_0xb968('0x14')]){if(_0x515f2b[_0xb968('0x14')]['code']===0x1f4){logger['error'](_0xb968('0xf'),_0xa62ca2,_0x515f2b[_0xb968('0x14')]['message']);return _0x403b9e(_0x515f2b[_0xb968('0x14')]['message']);}logger[_0xb968('0x14')]('OpenchannelInteraction,\x20%s,\x20%s',_0xa62ca2,_0x515f2b[_0xb968('0x14')]['message']);return _0x27e8dc(_0x515f2b['error'][_0xb968('0x15')]);}else{logger[_0xb968('0xe')]('OpenchannelInteraction,\x20%s,\x20%s',_0xa62ca2,'request\x20sent');_0x27e8dc(_0x515f2b[_0xb968('0x16')][_0xb968('0x15')]);}})[_0xb968('0x17')](function(_0x3a1765){logger['error'](_0xb968('0xf'),_0xa62ca2,_0x3a1765);_0x403b9e(_0x3a1765);});});}exports[_0xb968('0x18')]=function(_0x497805){var _0x30aa46=this;return new Promise(function(_0x10f8a9,_0xfb8fa){return db[_0xb968('0x19')]['update'](_0x497805[_0xb968('0x1a')],{'raw':_0x497805['options']?_0x497805[_0xb968('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x497805[_0xb968('0x1b')]?_0x497805[_0xb968('0x1b')][_0xb968('0x1c')]||null:null,'attributes':_0x497805[_0xb968('0x1b')]?_0x497805[_0xb968('0x1b')][_0xb968('0x1d')]||null:null,'limit':_0x497805['options']?_0x497805[_0xb968('0x1b')]['limit']||null:null})[_0xb968('0xd')](function(_0x104e5c){logger[_0xb968('0xe')](_0xb968('0x18'),_0x497805);logger[_0xb968('0x11')]('UpdateOpenchannelInteraction',_0x497805,JSON[_0xb968('0x13')](_0x104e5c));_0x10f8a9(_0x104e5c);})[_0xb968('0x17')](function(_0x199736){logger[_0xb968('0x14')](_0xb968('0x18'),_0x199736[_0xb968('0x15')],_0x497805);_0xfb8fa(_0x30aa46[_0xb968('0x14')](0x1f4,_0x199736['message']));});});};exports[_0xb968('0x1e')]=function(_0x25deea){return new Promise(function(_0x48d1a8,_0x16e859){return db['OpenchannelInteraction'][_0xb968('0x1f')]({'where':_0x25deea[_0xb968('0x1b')]?_0x25deea[_0xb968('0x1b')][_0xb968('0x1c')]||null:null})[_0xb968('0xd')](function(_0x46e154){if(_0x46e154){return _0x46e154[_0xb968('0x20')](_0x25deea[_0xb968('0x1a')][_0xb968('0x21')],_[_0xb968('0x22')](_0x25deea[_0xb968('0x1a')],[_0xb968('0x21'),'id'])||{});}})['spread'](function(_0x38dd28){logger['info']('AddTags',_0x25deea);logger[_0xb968('0x11')](_0xb968('0x23'),_0x25deea,JSON['stringify'](_0x38dd28));_0x48d1a8(_0x38dd28);})[_0xb968('0x17')](function(_0x1599e1){logger[_0xb968('0x14')]('AddTags',_0x1599e1['message'],_0x25deea);_0x16e859(_this[_0xb968('0x14')](0x1f4,_0x1599e1[_0xb968('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index 89a0f7d..36c2df2 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 _0x2601=['register','length','openchannelInteraction:','./openchannelInteraction.events','save','remove','update','emit','removeListener'];(function(_0x443578,_0x2aad68){var _0x161e24=function(_0x3d3325){while(--_0x3d3325){_0x443578['push'](_0x443578['shift']());}};_0x161e24(++_0x2aad68);}(_0x2601,0x198));var _0x1260=function(_0x432e6c,_0x3b38a3){_0x432e6c=_0x432e6c-0x0;var _0x49eeec=_0x2601[_0x432e6c];return _0x49eeec;};'use strict';var OpenchannelInteractionEvents=require(_0x1260('0x0'));var events=[_0x1260('0x1'),_0x1260('0x2'),_0x1260('0x3')];function createListener(_0x358147,_0x43c80d){return function(_0x30a4ce){_0x43c80d[_0x1260('0x4')](_0x358147,_0x30a4ce);};}function removeListener(_0x53b2ca,_0x424726){return function(){OpenchannelInteractionEvents[_0x1260('0x5')](_0x53b2ca,_0x424726);};}exports[_0x1260('0x6')]=function(_0x1b7a6c){for(var _0x51c666=0x0,_0x1d1684=events[_0x1260('0x7')];_0x51c666<_0x1d1684;_0x51c666++){var _0x51206d=events[_0x51c666];var _0x41048d=createListener(_0x1260('0x8')+_0x51206d,_0x1b7a6c);OpenchannelInteractionEvents['on'](_0x51206d,_0x41048d);}}; \ No newline at end of file +var _0x8b3d=['register','length','openchannelInteraction:','./openchannelInteraction.events','save','remove','update','removeListener'];(function(_0xa4178f,_0x38880d){var _0x242202=function(_0x55e985){while(--_0x55e985){_0xa4178f['push'](_0xa4178f['shift']());}};_0x242202(++_0x38880d);}(_0x8b3d,0x133));var _0xd8b3=function(_0x26bb08,_0xa36231){_0x26bb08=_0x26bb08-0x0;var _0x54fc8d=_0x8b3d[_0x26bb08];return _0x54fc8d;};'use strict';var OpenchannelInteractionEvents=require(_0xd8b3('0x0'));var events=[_0xd8b3('0x1'),_0xd8b3('0x2'),_0xd8b3('0x3')];function createListener(_0xd37a05,_0x22bec6){return function(_0x943bc6){_0x22bec6['emit'](_0xd37a05,_0x943bc6);};}function removeListener(_0x81cd32,_0x323388){return function(){OpenchannelInteractionEvents[_0xd8b3('0x4')](_0x81cd32,_0x323388);};}exports[_0xd8b3('0x5')]=function(_0x4be147){for(var _0x10f6dc=0x0,_0x3c94bd=events[_0xd8b3('0x6')];_0x10f6dc<_0x3c94bd;_0x10f6dc++){var _0x5cba6c=events[_0x10f6dc];var _0x2ec8b0=createListener(_0xd8b3('0x7')+_0x5cba6c,_0x4be147);OpenchannelInteractionEvents['on'](_0x5cba6c,_0x2ec8b0);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index 9f1fb3b..f8f7714 100644 --- a/server/api/openchannelMessage/index.js +++ b/server/api/openchannelMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['openchannelmessage:create','put','update','/:id/reject','reject','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./openchannelMessage.controller','get','index','isAuthenticated','describe','/:id','post','tracked','openchannel'];(function(_0x91ec40,_0xa1ec3b){var _0x428c7a=function(_0x196f25){while(--_0x196f25){_0x91ec40['push'](_0x91ec40['shift']());}};_0x428c7a(++_0xa1ec3b);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x33bcdb,_0x11846b){_0x33bcdb=_0x33bcdb-0x0;var _0x18a9bf=_0xcb91[_0x33bcdb];return _0x18a9bf;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');var controller=require(_0x1cb9('0x6'));router[_0x1cb9('0x7')]('/',auth['isAuthenticated'](),controller[_0x1cb9('0x8')]);router[_0x1cb9('0x7')]('/describe',auth[_0x1cb9('0x9')](),controller[_0x1cb9('0xa')]);router['get'](_0x1cb9('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x1cb9('0xc')]('/',auth[_0x1cb9('0x9')](),interaction[_0x1cb9('0xd')](_0x1cb9('0xe'),_0x1cb9('0xf')),controller['create']);router[_0x1cb9('0x10')](_0x1cb9('0xb'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0x11')]);router[_0x1cb9('0x10')]('/:id/accept',auth['isAuthenticated'](),controller['accept']);router[_0x1cb9('0x10')](_0x1cb9('0x12'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0x13')]);router['delete'](_0x1cb9('0xb'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0x14')]);module[_0x1cb9('0x15')]=router; \ No newline at end of file +var _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','post','tracked','openchannel','create','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports'];(function(_0x40d8cb,_0x28e802){var _0x2b42b6=function(_0x119b6c){while(--_0x119b6c){_0x40d8cb['push'](_0x40d8cb['shift']());}};_0x2b42b6(++_0x28e802);}(_0xedd9,0xfc));var _0x9edd=function(_0x437370,_0x5446d9){_0x437370=_0x437370-0x0;var _0xf8189f=_0xedd9[_0x437370];return _0xf8189f;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');var controller=require(_0x9edd('0x8'));router[_0x9edd('0x9')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0xb')]);router['get'](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0xd')]);router[_0x9edd('0x9')](_0x9edd('0xe'),auth[_0x9edd('0xa')](),controller['show']);router[_0x9edd('0xf')]('/',auth['isAuthenticated'](),interaction[_0x9edd('0x10')](_0x9edd('0x11'),'openchannelmessage:create'),controller[_0x9edd('0x12')]);router[_0x9edd('0x13')]('/:id',auth[_0x9edd('0xa')](),controller[_0x9edd('0x14')]);router[_0x9edd('0x13')](_0x9edd('0x15'),auth[_0x9edd('0xa')](),controller[_0x9edd('0x16')]);router[_0x9edd('0x13')](_0x9edd('0x17'),auth['isAuthenticated'](),controller[_0x9edd('0x18')]);router[_0x9edd('0x19')](_0x9edd('0xe'),auth[_0x9edd('0xa')](),controller[_0x9edd('0x1a')]);module[_0x9edd('0x1b')]=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index 6167f75..005348a 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 _0xa249=['BOOLEAN','ENUM','out','sequelize','exports','medium'];(function(_0x2bd0f3,_0x259957){var _0x1aad5a=function(_0xc2ee62){while(--_0xc2ee62){_0x2bd0f3['push'](_0x2bd0f3['shift']());}};_0x1aad5a(++_0x259957);}(_0xa249,0x183));var _0x9a24=function(_0x5c2324,_0x1a7f66){_0x5c2324=_0x5c2324-0x0;var _0x6f3ce1=_0xa249[_0x5c2324];return _0x6f3ce1;};'use strict';var Sequelize=require(_0x9a24('0x0'));module[_0x9a24('0x1')]={'body':{'type':Sequelize['TEXT'](_0x9a24('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x9a24('0x3')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x9a24('0x4')]('in','out'),'defaultValue':_0x9a24('0x5'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x02a7=['medium','BOOLEAN','ENUM','out','DATE','STRING','exports','TEXT'];(function(_0x39c734,_0x2f3e06){var _0xb2a2f9=function(_0x502f3f){while(--_0x502f3f){_0x39c734['push'](_0x39c734['shift']());}};_0xb2a2f9(++_0x2f3e06);}(_0x02a7,0x1a6));var _0x702a=function(_0x44471b,_0x136969){_0x44471b=_0x44471b-0x0;var _0x44abe6=_0x02a7[_0x44471b];return _0x44abe6;};'use strict';var Sequelize=require('sequelize');module[_0x702a('0x0')]={'body':{'type':Sequelize[_0x702a('0x1')](_0x702a('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x702a('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0x702a('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x702a('0x4')]('in',_0x702a('0x5')),'defaultValue':_0x702a('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0x702a('0x6')]},'providerName':{'type':Sequelize[_0x702a('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 4d653b6..33f9385 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 _0x5274=['keys','startsWith','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','contact','manual','channel','event','EventManager','acceptmessage','reject','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','cf_','push','QueryTypes','SELECT','interface','SIP/%s','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/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','defaults','redis','localhost','./openchannelMessage.socket','register','jayson/promise','client','request','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','status','end','json','offset','undefined','limit','count','set','Content-Range','save','then','destroy','sendStatus','stack','name','send','index','OpenchannelMessage','rawAttributes','type','map','query','filters','model','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','intersection','find','create','body','update','params','describe','openchannel-interactions','accept','openchannel','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','CmContact','Contact','get','OpenchannelInteraction','OpenchannelInteractionId','isNil','read1stAt','format','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify','null','AcceptMessage','acceptMessage'];(function(_0x557493,_0x569137){var _0x3bfd35=function(_0x55f170){while(--_0x55f170){_0x557493['push'](_0x557493['shift']());}};_0x3bfd35(++_0x569137);}(_0x5274,0x9e));var _0x4527=function(_0x207abf,_0x33cf2e){_0x207abf=_0x207abf-0x0;var _0x481744=_0x5274[_0x207abf];return _0x481744;};'use strict';var emlformat=require(_0x4527('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4527('0x1'));var jsonpatch=require(_0x4527('0x2'));var rp=require(_0x4527('0x3'));var moment=require(_0x4527('0x4'));var BPromise=require(_0x4527('0x5'));var Mustache=require(_0x4527('0x6'));var util=require(_0x4527('0x7'));var path=require(_0x4527('0x8'));var sox=require(_0x4527('0x9'));var csv=require(_0x4527('0xa'));var ejs=require(_0x4527('0xb'));var fs=require('fs');var fs_extra=require(_0x4527('0xc'));var _=require('lodash');var squel=require(_0x4527('0xd'));var crypto=require(_0x4527('0xe'));var jsforce=require(_0x4527('0xf'));var deskjs=require(_0x4527('0x10'));var toCsv=require(_0x4527('0xa'));var querystring=require(_0x4527('0x11'));var Papa=require(_0x4527('0x12'));var Redis=require(_0x4527('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x4527('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x4527('0x15'))(_0x4527('0x16'));var utils=require(_0x4527('0x17'));var config=require(_0x4527('0x18'));var licenseUtil=require(_0x4527('0x19'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x4527('0x1a')](config[_0x4527('0x1b')],{'host':_0x4527('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4527('0x1b')]));require(_0x4527('0x1d'))[_0x4527('0x1e')](socket);var jayson=require(_0x4527('0x1f'));var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0x4527('0x20')]['http']({'port':0x232a});function respondWithRpcPromise(_0x119387,_0x38caa2,_0x54ad9b,_0x36fcda){return new BPromise(function(_0x521708,_0x1e549c){var _0x1dc80c=_0x36fcda||client;return _0x1dc80c[_0x4527('0x21')](_0x119387,_0x54ad9b)['then'](function(_0x21c893){logger[_0x4527('0x22')](_0x4527('0x23'),_0x38caa2,_0x4527('0x24'));logger[_0x4527('0x25')](_0x4527('0x26'),_0x38caa2,_0x4527('0x24'),JSON['stringify'](_0x21c893));if(_0x21c893[_0x4527('0x27')]){if(_0x21c893[_0x4527('0x27')][_0x4527('0x28')]===0x1f4){logger[_0x4527('0x27')](_0x4527('0x23'),_0x38caa2,_0x21c893[_0x4527('0x27')][_0x4527('0x29')]);return _0x1e549c(_0x21c893[_0x4527('0x27')][_0x4527('0x29')]);}logger[_0x4527('0x27')]('OpenchannelMessage,\x20%s,\x20%s',_0x38caa2,_0x21c893['error'][_0x4527('0x29')]);return _0x521708(_0x21c893[_0x4527('0x27')][_0x4527('0x29')]);}else{logger['info'](_0x4527('0x23'),_0x38caa2,_0x4527('0x24'));_0x521708(_0x21c893[_0x4527('0x2a')][_0x4527('0x29')]);}})[_0x4527('0x2b')](function(_0x1efdd2){logger[_0x4527('0x27')](_0x4527('0x23'),_0x38caa2,_0x1efdd2);_0x1e549c(_0x1efdd2);});});}function respondWithStatusCode(_0x13573e,_0x1796c3){_0x1796c3=_0x1796c3||0xcc;return function(_0x23045d){if(_0x23045d){return _0x13573e['sendStatus'](_0x1796c3);}return _0x13573e[_0x4527('0x2c')](_0x1796c3)[_0x4527('0x2d')]();};}function respondWithResult(_0x2f0329,_0x3cfd49){_0x3cfd49=_0x3cfd49||0xc8;return function(_0x413ca6){if(_0x413ca6){return _0x2f0329[_0x4527('0x2c')](_0x3cfd49)[_0x4527('0x2e')](_0x413ca6);}};}function respondWithFilteredResult(_0x25d6e5,_0x2541d6){return function(_0x20dab4){if(_0x20dab4){var _0x4eb5dc=typeof _0x2541d6[_0x4527('0x2f')]===_0x4527('0x30')&&typeof _0x2541d6[_0x4527('0x31')]===_0x4527('0x30');var _0x55b8cc=_0x20dab4['count'];var _0x390e8b=_0x4eb5dc?0x0:_0x2541d6[_0x4527('0x2f')];var _0x52f440=_0x4eb5dc?_0x20dab4[_0x4527('0x32')]:_0x2541d6['offset']+_0x2541d6[_0x4527('0x31')];var _0xfa73fd;if(_0x52f440>=_0x55b8cc){_0x52f440=_0x55b8cc;_0xfa73fd=0xc8;}else{_0xfa73fd=0xce;}_0x25d6e5[_0x4527('0x2c')](_0xfa73fd);return _0x25d6e5[_0x4527('0x33')](_0x4527('0x34'),_0x390e8b+'-'+_0x52f440+'/'+_0x55b8cc)[_0x4527('0x2e')](_0x20dab4);}return null;};}function patchUpdates(_0x46adc5){return function(_0x57bb99){try{jsonpatch['apply'](_0x57bb99,_0x46adc5,!![]);}catch(_0x4202cc){return BPromise['reject'](_0x4202cc);}return _0x57bb99[_0x4527('0x35')]();};}function saveUpdates(_0x50731d,_0x24bce0){return function(_0x53c116){if(_0x53c116){return _0x53c116['update'](_0x50731d)[_0x4527('0x36')](function(_0xd8ec76){return _0xd8ec76;});}return null;};}function removeEntity(_0x5efd74,_0x13bf18){return function(_0x303101){if(_0x303101){return _0x303101[_0x4527('0x37')]()['then'](function(){_0x5efd74[_0x4527('0x2c')](0xcc)[_0x4527('0x2d')]();});}};}function handleEntityNotFound(_0x52f9cd,_0x2f4e08){return function(_0x30d525){if(!_0x30d525){_0x52f9cd[_0x4527('0x38')](0x194);}return _0x30d525;};}function handleError(_0x2491f9,_0x488fec){_0x488fec=_0x488fec||0x1f4;return function(_0x294a27){logger[_0x4527('0x27')](_0x294a27[_0x4527('0x39')]);if(_0x294a27[_0x4527('0x3a')]){delete _0x294a27[_0x4527('0x3a')];}_0x2491f9[_0x4527('0x2c')](_0x488fec)[_0x4527('0x3b')](_0x294a27);};}exports[_0x4527('0x3c')]=function(_0x2eb1d3,_0x30cd09){var _0x15e8a2={},_0x52dca8={},_0x35f8c3={'count':0x0,'rows':[]};var _0x23638a=_['map'](db[_0x4527('0x3d')][_0x4527('0x3e')],function(_0x4ea39a){return{'name':_0x4ea39a['fieldName'],'type':_0x4ea39a[_0x4527('0x3f')]['key']};});_0x52dca8['model']=_[_0x4527('0x40')](_0x23638a,_0x4527('0x3a'));_0x52dca8[_0x4527('0x41')]=_['keys'](_0x2eb1d3[_0x4527('0x41')]);_0x52dca8[_0x4527('0x42')]=_['intersection'](_0x52dca8[_0x4527('0x43')],_0x52dca8[_0x4527('0x41')]);_0x15e8a2[_0x4527('0x44')]=_['intersection'](_0x52dca8[_0x4527('0x43')],qs[_0x4527('0x45')](_0x2eb1d3['query'][_0x4527('0x45')]));_0x15e8a2[_0x4527('0x44')]=_0x15e8a2[_0x4527('0x44')][_0x4527('0x46')]?_0x15e8a2['attributes']:_0x52dca8[_0x4527('0x43')];if(!_0x2eb1d3[_0x4527('0x41')]['hasOwnProperty'](_0x4527('0x47'))){_0x15e8a2[_0x4527('0x31')]=qs[_0x4527('0x31')](_0x2eb1d3[_0x4527('0x41')][_0x4527('0x31')]);_0x15e8a2[_0x4527('0x2f')]=qs[_0x4527('0x2f')](_0x2eb1d3[_0x4527('0x41')][_0x4527('0x2f')]);}_0x15e8a2[_0x4527('0x48')]=qs['sort'](_0x2eb1d3[_0x4527('0x41')][_0x4527('0x49')]);_0x15e8a2[_0x4527('0x4a')]=qs[_0x4527('0x42')](_[_0x4527('0x4b')](_0x2eb1d3[_0x4527('0x41')],_0x52dca8['filters']),_0x23638a);if(_0x2eb1d3[_0x4527('0x41')][_0x4527('0x4c')]){_0x15e8a2[_0x4527('0x4a')]=_[_0x4527('0x4d')](_0x15e8a2[_0x4527('0x4a')],{'$or':_[_0x4527('0x40')](_0x23638a,function(_0x3d0a15){if(_0x3d0a15[_0x4527('0x3f')]!==_0x4527('0x4e')){var _0x21eb52={};_0x21eb52[_0x3d0a15[_0x4527('0x3a')]]={'$like':'%'+_0x2eb1d3[_0x4527('0x41')][_0x4527('0x4c')]+'%'};return _0x21eb52;}})});}_0x15e8a2=_[_0x4527('0x4d')]({},_0x15e8a2,_0x2eb1d3[_0x4527('0x4f')]);var _0x27e7b4={'where':_0x15e8a2[_0x4527('0x4a')]};return db[_0x4527('0x3d')][_0x4527('0x32')](_0x27e7b4)[_0x4527('0x36')](function(_0x2b54a8){_0x35f8c3[_0x4527('0x32')]=_0x2b54a8;if(_0x2eb1d3['query'][_0x4527('0x50')]){_0x15e8a2[_0x4527('0x51')]=[{'all':!![]}];}return db[_0x4527('0x3d')][_0x4527('0x52')](_0x15e8a2);})[_0x4527('0x36')](function(_0x1d0995){_0x35f8c3[_0x4527('0x53')]=_0x1d0995;return _0x35f8c3;})['then'](respondWithFilteredResult(_0x30cd09,_0x15e8a2))['catch'](handleError(_0x30cd09,null));};exports[_0x4527('0x54')]=function(_0x5546e6,_0x4b13e5){var _0x36832a={'raw':!![],'where':{'id':_0x5546e6['params']['id']}},_0x102e2c={};_0x102e2c[_0x4527('0x43')]=_['keys'](db[_0x4527('0x3d')][_0x4527('0x3e')]);_0x102e2c[_0x4527('0x41')]=_['keys'](_0x5546e6[_0x4527('0x41')]);_0x102e2c[_0x4527('0x42')]=_[_0x4527('0x55')](_0x102e2c['model'],_0x102e2c['query']);_0x36832a[_0x4527('0x44')]=_[_0x4527('0x55')](_0x102e2c[_0x4527('0x43')],qs[_0x4527('0x45')](_0x5546e6[_0x4527('0x41')][_0x4527('0x45')]));_0x36832a['attributes']=_0x36832a['attributes']['length']?_0x36832a[_0x4527('0x44')]:_0x102e2c[_0x4527('0x43')];if(_0x5546e6[_0x4527('0x41')][_0x4527('0x50')]){_0x36832a[_0x4527('0x51')]=[{'all':!![]}];}_0x36832a=_[_0x4527('0x4d')]({},_0x36832a,_0x5546e6['options']);return db[_0x4527('0x3d')][_0x4527('0x56')](_0x36832a)[_0x4527('0x36')](handleEntityNotFound(_0x4b13e5,null))[_0x4527('0x36')](respondWithResult(_0x4b13e5,null))[_0x4527('0x2b')](handleError(_0x4b13e5,null));};exports[_0x4527('0x57')]=function(_0x126635,_0x48b28f){return db[_0x4527('0x3d')][_0x4527('0x57')](_0x126635[_0x4527('0x58')],{})['then'](respondWithResult(_0x48b28f,0xc9))[_0x4527('0x2b')](handleError(_0x48b28f,null));};exports[_0x4527('0x59')]=function(_0x1c9c48,_0x10a1f4){if(_0x1c9c48[_0x4527('0x58')]['id']){delete _0x1c9c48[_0x4527('0x58')]['id'];}return db[_0x4527('0x3d')][_0x4527('0x56')]({'where':{'id':_0x1c9c48[_0x4527('0x5a')]['id']}})['then'](handleEntityNotFound(_0x10a1f4,null))[_0x4527('0x36')](saveUpdates(_0x1c9c48[_0x4527('0x58')],null))[_0x4527('0x36')](respondWithResult(_0x10a1f4,null))['catch'](handleError(_0x10a1f4,null));};exports[_0x4527('0x37')]=function(_0x51da50,_0x53cf0c){return db[_0x4527('0x3d')]['find']({'where':{'id':_0x51da50[_0x4527('0x5a')]['id']}})[_0x4527('0x36')](handleEntityNotFound(_0x53cf0c,null))[_0x4527('0x36')](removeEntity(_0x53cf0c,null))['catch'](handleError(_0x53cf0c,null));};exports['describe']=function(_0x67bc73,_0x3a2a78){return db['OpenchannelMessage'][_0x4527('0x5b')]()[_0x4527('0x36')](respondWithResult(_0x3a2a78,null))[_0x4527('0x2b')](handleError(_0x3a2a78,null));};var interaction_log=require(_0x4527('0x15'))(_0x4527('0x5c'));exports[_0x4527('0x5d')]=function(_0x16cc16,_0x5be8c5,_0x18ab21){var _0x7738c6={'agent':{},'channel':_0x4527('0x5e')};if(_0x16cc16[_0x4527('0x58')]['id']){delete _0x16cc16[_0x4527('0x58')]['id'];}_0x16cc16['body'][_0x4527('0x5f')]=!![];_0x16cc16[_0x4527('0x58')][_0x4527('0x60')]=moment()['format'](_0x4527('0x61'));_0x16cc16['body'][_0x4527('0x62')]=_0x16cc16['body']['UserId']||_0x16cc16[_0x4527('0x63')]['id'];_0x7738c6[_0x4527('0x64')]['id']=_0x16cc16[_0x4527('0x58')][_0x4527('0x62')];return db['OpenchannelMessage'][_0x4527('0x56')]({'where':{'id':_0x16cc16[_0x4527('0x5a')]['id'],'UserId':null},'include':[{'model':db[_0x4527('0x65')],'as':_0x4527('0x66')}]})[_0x4527('0x36')](handleEntityNotFound(_0x5be8c5,null))[_0x4527('0x36')](saveUpdates(_0x16cc16[_0x4527('0x58')],null))[_0x4527('0x36')](function(_0x1388e2){if(_0x1388e2){_0x7738c6[_0x4527('0x29')]=_0x1388e2[_0x4527('0x67')]({'plain':!![]});return db[_0x4527('0x68')]['find']({'where':{'id':_0x1388e2[_0x4527('0x69')]}});}return null;})[_0x4527('0x36')](handleEntityNotFound(_0x5be8c5,null))[_0x4527('0x36')](function(_0x1cee7a){if(_0x1cee7a){return _0x1cee7a[_0x4527('0x59')]({'UserId':_0x16cc16['body'][_0x4527('0x62')],'read1stAt':_[_0x4527('0x6a')](_0x1cee7a[_0x4527('0x6b')])?moment()[_0x4527('0x6c')](_0x4527('0x61')):undefined});}return null;})[_0x4527('0x36')](function(_0x389f3e){if(_0x389f3e){_0x7738c6[_0x4527('0x6d')]=_0x389f3e[_0x4527('0x67')]({'plain':!![]});interaction_log[_0x4527('0x22')](_0x4527('0x6e'),_0x16cc16['user']['id'],_0x16cc16['user'][_0x4527('0x3a')],_0x16cc16[_0x4527('0x63')][_0x4527('0x6f')],_0x7738c6[_0x4527('0x6d')]['id'],_0x16cc16[_0x4527('0x58')]?JSON[_0x4527('0x70')](_0x16cc16[_0x4527('0x58')]):_0x4527('0x71'));return respondWithRpcPromise(_0x4527('0x72'),_0x4527('0x73'),_0x7738c6);}return null;})[_0x4527('0x36')](function(_0x20c065){return db[_0x4527('0x65')][_0x4527('0x5b')]()[_0x4527('0x36')](function(_0x21b02b){var _0x4e8fa0=[];for(var _0x2bf5ef=0x0;_0x2bf5ef=_0x1cc914){_0x2c8e1b=_0x1cc914;_0x2909f5=0xc8;}else{_0x2909f5=0xce;}_0x103691['status'](_0x2909f5);return _0x103691[_0xfdca('0x2d')](_0xfdca('0x2e'),_0x394d36+'-'+_0x2c8e1b+'/'+_0x1cc914)['json'](_0x31f524);}return null;};}function patchUpdates(_0x5d4088){return function(_0x5c9328){try{jsonpatch[_0xfdca('0x2f')](_0x5c9328,_0x5d4088,!![]);}catch(_0xa00dc5){return BPromise[_0xfdca('0x30')](_0xa00dc5);}return _0x5c9328[_0xfdca('0x31')]();};}function saveUpdates(_0x2f51e7,_0x2f8c13){return function(_0x26b31f){if(_0x26b31f){return _0x26b31f[_0xfdca('0x32')](_0x2f51e7)[_0xfdca('0x33')](function(_0x4def55){return _0x4def55;});}return null;};}function removeEntity(_0xf8c5fa,_0x4b655a){return function(_0x1b6ee9){if(_0x1b6ee9){return _0x1b6ee9[_0xfdca('0x34')]()['then'](function(){_0xf8c5fa[_0xfdca('0x27')](0xcc)[_0xfdca('0x26')]();});}};}function handleEntityNotFound(_0x5703e0,_0x204ea0){return function(_0x49c576){if(!_0x49c576){_0x5703e0[_0xfdca('0x25')](0x194);}return _0x49c576;};}function handleError(_0x3bc457,_0x12beb0){_0x12beb0=_0x12beb0||0x1f4;return function(_0x25dab8){logger['error'](_0x25dab8[_0xfdca('0x35')]);if(_0x25dab8[_0xfdca('0x36')]){delete _0x25dab8[_0xfdca('0x36')];}_0x3bc457[_0xfdca('0x27')](_0x12beb0)[_0xfdca('0x37')](_0x25dab8);};}exports[_0xfdca('0x38')]=function(_0x4225c2,_0x2b5b57){var _0x917495={},_0x4ba289={},_0x2f4522={'count':0x0,'rows':[]};var _0x16ba41=_[_0xfdca('0x39')](db['OpenchannelMessage'][_0xfdca('0x3a')],function(_0x2d6d5b){return{'name':_0x2d6d5b[_0xfdca('0x3b')],'type':_0x2d6d5b['type'][_0xfdca('0x3c')]};});_0x4ba289['model']=_[_0xfdca('0x39')](_0x16ba41,_0xfdca('0x36'));_0x4ba289[_0xfdca('0x3d')]=_['keys'](_0x4225c2[_0xfdca('0x3d')]);_0x4ba289[_0xfdca('0x3e')]=_[_0xfdca('0x3f')](_0x4ba289[_0xfdca('0x40')],_0x4ba289['query']);_0x917495['attributes']=_[_0xfdca('0x3f')](_0x4ba289[_0xfdca('0x40')],qs[_0xfdca('0x41')](_0x4225c2[_0xfdca('0x3d')][_0xfdca('0x41')]));_0x917495[_0xfdca('0x42')]=_0x917495[_0xfdca('0x42')][_0xfdca('0x43')]?_0x917495['attributes']:_0x4ba289[_0xfdca('0x40')];if(!_0x4225c2['query'][_0xfdca('0x44')](_0xfdca('0x45'))){_0x917495[_0xfdca('0x2b')]=qs[_0xfdca('0x2b')](_0x4225c2[_0xfdca('0x3d')][_0xfdca('0x2b')]);_0x917495[_0xfdca('0x29')]=qs['offset'](_0x4225c2['query'][_0xfdca('0x29')]);}_0x917495['order']=qs[_0xfdca('0x46')](_0x4225c2[_0xfdca('0x3d')][_0xfdca('0x46')]);_0x917495['where']=qs[_0xfdca('0x3e')](_['pick'](_0x4225c2['query'],_0x4ba289[_0xfdca('0x3e')]),_0x16ba41);if(_0x4225c2['query'][_0xfdca('0x47')]){_0x917495[_0xfdca('0x48')]=_[_0xfdca('0x49')](_0x917495['where'],{'$or':_[_0xfdca('0x39')](_0x16ba41,function(_0x51ca00){if(_0x51ca00['type']!==_0xfdca('0x4a')){var _0x48606f={};_0x48606f[_0x51ca00[_0xfdca('0x36')]]={'$like':'%'+_0x4225c2['query'][_0xfdca('0x47')]+'%'};return _0x48606f;}})});}_0x917495=_[_0xfdca('0x49')]({},_0x917495,_0x4225c2[_0xfdca('0x4b')]);var _0x598b03={'where':_0x917495[_0xfdca('0x48')]};return db['OpenchannelMessage'][_0xfdca('0x2c')](_0x598b03)['then'](function(_0x1c88ee){_0x2f4522[_0xfdca('0x2c')]=_0x1c88ee;if(_0x4225c2['query'][_0xfdca('0x4c')]){_0x917495['include']=[{'all':!![]}];}return db['OpenchannelMessage'][_0xfdca('0x4d')](_0x917495);})[_0xfdca('0x33')](function(_0x3acfb8){_0x2f4522['rows']=_0x3acfb8;return _0x2f4522;})['then'](respondWithFilteredResult(_0x2b5b57,_0x917495))[_0xfdca('0x24')](handleError(_0x2b5b57,null));};exports['show']=function(_0x390129,_0xd3e4e1){var _0x59ff90={'raw':!![],'where':{'id':_0x390129['params']['id']}},_0x149d6f={};_0x149d6f[_0xfdca('0x40')]=_[_0xfdca('0x4e')](db[_0xfdca('0x4f')][_0xfdca('0x3a')]);_0x149d6f[_0xfdca('0x3d')]=_[_0xfdca('0x4e')](_0x390129[_0xfdca('0x3d')]);_0x149d6f[_0xfdca('0x3e')]=_[_0xfdca('0x3f')](_0x149d6f['model'],_0x149d6f[_0xfdca('0x3d')]);_0x59ff90[_0xfdca('0x42')]=_[_0xfdca('0x3f')](_0x149d6f[_0xfdca('0x40')],qs[_0xfdca('0x41')](_0x390129['query'][_0xfdca('0x41')]));_0x59ff90[_0xfdca('0x42')]=_0x59ff90[_0xfdca('0x42')][_0xfdca('0x43')]?_0x59ff90[_0xfdca('0x42')]:_0x149d6f['model'];if(_0x390129['query'][_0xfdca('0x4c')]){_0x59ff90[_0xfdca('0x50')]=[{'all':!![]}];}_0x59ff90=_[_0xfdca('0x49')]({},_0x59ff90,_0x390129['options']);return db[_0xfdca('0x4f')][_0xfdca('0x51')](_0x59ff90)[_0xfdca('0x33')](handleEntityNotFound(_0xd3e4e1,null))['then'](respondWithResult(_0xd3e4e1,null))[_0xfdca('0x24')](handleError(_0xd3e4e1,null));};exports[_0xfdca('0x52')]=function(_0x14a207,_0x4998ce){return db['OpenchannelMessage']['create'](_0x14a207[_0xfdca('0x53')],{})[_0xfdca('0x33')](respondWithResult(_0x4998ce,0xc9))['catch'](handleError(_0x4998ce,null));};exports[_0xfdca('0x32')]=function(_0x37f72c,_0x4469bf){if(_0x37f72c['body']['id']){delete _0x37f72c['body']['id'];}return db['OpenchannelMessage'][_0xfdca('0x51')]({'where':{'id':_0x37f72c[_0xfdca('0x54')]['id']}})[_0xfdca('0x33')](handleEntityNotFound(_0x4469bf,null))[_0xfdca('0x33')](saveUpdates(_0x37f72c[_0xfdca('0x53')],null))[_0xfdca('0x33')](respondWithResult(_0x4469bf,null))[_0xfdca('0x24')](handleError(_0x4469bf,null));};exports['destroy']=function(_0x10629b,_0x20732d){return db[_0xfdca('0x4f')]['find']({'where':{'id':_0x10629b[_0xfdca('0x54')]['id']}})[_0xfdca('0x33')](handleEntityNotFound(_0x20732d,null))['then'](removeEntity(_0x20732d,null))[_0xfdca('0x24')](handleError(_0x20732d,null));};exports[_0xfdca('0x55')]=function(_0x206be6,_0x2e7f0a){return db[_0xfdca('0x4f')]['describe']()['then'](respondWithResult(_0x2e7f0a,null))[_0xfdca('0x24')](handleError(_0x2e7f0a,null));};var interaction_log=require(_0xfdca('0x10'))('openchannel-interactions');exports[_0xfdca('0x56')]=function(_0xb3adc0,_0x1cecae,_0x346f0b){var _0x1acd4d={'agent':{},'channel':_0xfdca('0x57')};if(_0xb3adc0['body']['id']){delete _0xb3adc0[_0xfdca('0x53')]['id'];}_0xb3adc0[_0xfdca('0x53')][_0xfdca('0x58')]=!![];_0xb3adc0[_0xfdca('0x53')]['readAt']=moment()[_0xfdca('0x59')]('YYYY-MM-DD\x20HH:mm:ss');_0xb3adc0[_0xfdca('0x53')]['UserId']=_0xb3adc0[_0xfdca('0x53')][_0xfdca('0x5a')]||_0xb3adc0[_0xfdca('0x5b')]['id'];_0x1acd4d[_0xfdca('0x5c')]['id']=_0xb3adc0[_0xfdca('0x53')][_0xfdca('0x5a')];return db[_0xfdca('0x4f')][_0xfdca('0x51')]({'where':{'id':_0xb3adc0[_0xfdca('0x54')]['id'],'UserId':null},'include':[{'model':db[_0xfdca('0x5d')],'as':'Contact'}]})['then'](handleEntityNotFound(_0x1cecae,null))['then'](saveUpdates(_0xb3adc0['body'],null))[_0xfdca('0x33')](function(_0x5d6fb8){if(_0x5d6fb8){_0x1acd4d[_0xfdca('0x22')]=_0x5d6fb8[_0xfdca('0x5e')]({'plain':!![]});return db['OpenchannelInteraction'][_0xfdca('0x51')]({'where':{'id':_0x5d6fb8[_0xfdca('0x5f')]}});}return null;})['then'](handleEntityNotFound(_0x1cecae,null))['then'](function(_0x35b8b9){if(_0x35b8b9){return _0x35b8b9['update']({'UserId':_0xb3adc0[_0xfdca('0x53')]['UserId'],'read1stAt':_[_0xfdca('0x60')](_0x35b8b9[_0xfdca('0x61')])?moment()[_0xfdca('0x59')](_0xfdca('0x62')):undefined});}return null;})[_0xfdca('0x33')](function(_0x4f0866){if(_0x4f0866){_0x1acd4d[_0xfdca('0x63')]=_0x4f0866[_0xfdca('0x5e')]({'plain':!![]});interaction_log[_0xfdca('0x1d')](_0xfdca('0x64'),_0xb3adc0[_0xfdca('0x5b')]['id'],_0xb3adc0[_0xfdca('0x5b')][_0xfdca('0x36')],_0xb3adc0['user'][_0xfdca('0x65')],_0x1acd4d[_0xfdca('0x63')]['id'],_0xb3adc0[_0xfdca('0x53')]?JSON['stringify'](_0xb3adc0[_0xfdca('0x53')]):_0xfdca('0x66'));return respondWithRpcPromise('AcceptMessage','acceptMessage',_0x1acd4d);}return null;})['then'](function(_0x23c5e8){return db['CmContact'][_0xfdca('0x55')]()[_0xfdca('0x33')](function(_0x311234){var _0x4b0d2c=[];for(var _0x224a65=0x0;_0x224a65=_0xe1dae0){_0x5a3531=_0xe1dae0;_0x30b064=0xc8;}else{_0x30b064=0xce;}_0x50626b[_0x04c5('0x1f')](_0x30b064);return _0x50626b['set']('Content-Range',_0x1a7da2+'-'+_0x5a3531+'/'+_0xe1dae0)['json'](_0x3fa42d);}return null;};}function patchUpdates(_0x2736be){return function(_0x2386fe){try{jsonpatch[_0x04c5('0x25')](_0x2386fe,_0x2736be,!![]);}catch(_0x568a0b){return BPromise[_0x04c5('0x26')](_0x568a0b);}return _0x2386fe['save']();};}function saveUpdates(_0x3f927f,_0x501db7){return function(_0x13eaec){if(_0x13eaec){return _0x13eaec[_0x04c5('0x27')](_0x3f927f)[_0x04c5('0x28')](function(_0x51283f){return _0x51283f;});}return null;};}function removeEntity(_0x192453,_0x521e46){return function(_0x4892bb){if(_0x4892bb){return _0x4892bb[_0x04c5('0x29')]()[_0x04c5('0x28')](function(){var _0x15f0f8=_0x4892bb[_0x04c5('0x2a')]({'plain':!![]});var _0x5759af=_0x04c5('0x2b');return db[_0x04c5('0x2c')][_0x04c5('0x29')]({'where':{'type':_0x5759af,'resourceId':_0x15f0f8['id']}})[_0x04c5('0x28')](function(){return _0x4892bb;});})[_0x04c5('0x28')](function(){_0x192453[_0x04c5('0x1f')](0xcc)[_0x04c5('0x2d')]();});}};}function handleEntityNotFound(_0x38bb19,_0x2ddb02){return function(_0x14a36){if(!_0x14a36){_0x38bb19['sendStatus'](0x194);}return _0x14a36;};}function handleError(_0x322e27,_0xfbe67b){_0xfbe67b=_0xfbe67b||0x1f4;return function(_0x202207){logger[_0x04c5('0x2e')](_0x202207['stack']);if(_0x202207[_0x04c5('0x2f')]){delete _0x202207['name'];}_0x322e27[_0x04c5('0x1f')](_0xfbe67b)[_0x04c5('0x30')](_0x202207);};}exports[_0x04c5('0x31')]=function(_0x2ae771,_0xda67e6){var _0x45f8d3={},_0x5c63bf={},_0x4905f1={'count':0x0,'rows':[]};var _0x1b48e2=_[_0x04c5('0x32')](db[_0x04c5('0x33')]['rawAttributes'],function(_0x1a3512){return{'name':_0x1a3512[_0x04c5('0x34')],'type':_0x1a3512[_0x04c5('0x35')][_0x04c5('0x36')]};});_0x5c63bf[_0x04c5('0x37')]=_[_0x04c5('0x32')](_0x1b48e2,_0x04c5('0x2f'));_0x5c63bf['query']=_['keys'](_0x2ae771['query']);_0x5c63bf[_0x04c5('0x38')]=_[_0x04c5('0x39')](_0x5c63bf[_0x04c5('0x37')],_0x5c63bf[_0x04c5('0x3a')]);_0x45f8d3['attributes']=_['intersection'](_0x5c63bf[_0x04c5('0x37')],qs[_0x04c5('0x3b')](_0x2ae771[_0x04c5('0x3a')]['fields']));_0x45f8d3[_0x04c5('0x3c')]=_0x45f8d3['attributes'][_0x04c5('0x3d')]?_0x45f8d3[_0x04c5('0x3c')]:_0x5c63bf[_0x04c5('0x37')];if(!_0x2ae771[_0x04c5('0x3a')][_0x04c5('0x3e')](_0x04c5('0x3f'))){_0x45f8d3[_0x04c5('0x22')]=qs[_0x04c5('0x22')](_0x2ae771['query']['limit']);_0x45f8d3[_0x04c5('0x21')]=qs[_0x04c5('0x21')](_0x2ae771[_0x04c5('0x3a')][_0x04c5('0x21')]);}_0x45f8d3[_0x04c5('0x40')]=qs[_0x04c5('0x41')](_0x2ae771[_0x04c5('0x3a')][_0x04c5('0x41')]);_0x45f8d3[_0x04c5('0x42')]=qs[_0x04c5('0x38')](_[_0x04c5('0x43')](_0x2ae771['query'],_0x5c63bf['filters']),_0x1b48e2);if(_0x2ae771[_0x04c5('0x3a')][_0x04c5('0x44')]){_0x45f8d3[_0x04c5('0x42')]=_[_0x04c5('0x45')](_0x45f8d3[_0x04c5('0x42')],{'$or':_[_0x04c5('0x32')](_0x1b48e2,function(_0x42a81a){if(_0x42a81a[_0x04c5('0x35')]!==_0x04c5('0x46')){var _0x2ec2fe={};_0x2ec2fe[_0x42a81a['name']]={'$like':'%'+_0x2ae771[_0x04c5('0x3a')][_0x04c5('0x44')]+'%'};return _0x2ec2fe;}})});}_0x45f8d3=_[_0x04c5('0x45')]({},_0x45f8d3,_0x2ae771['options']);var _0x5509b2={'where':_0x45f8d3['where']};return db['OpenchannelQueue'][_0x04c5('0x24')](_0x5509b2)[_0x04c5('0x28')](function(_0x2a6fa6){_0x4905f1[_0x04c5('0x24')]=_0x2a6fa6;if(_0x2ae771[_0x04c5('0x3a')][_0x04c5('0x47')]){_0x45f8d3['include']=[{'all':!![]}];}return db['OpenchannelQueue'][_0x04c5('0x48')](_0x45f8d3);})[_0x04c5('0x28')](function(_0x35b3c1){_0x4905f1['rows']=_0x35b3c1;return _0x4905f1;})[_0x04c5('0x28')](respondWithFilteredResult(_0xda67e6,_0x45f8d3))[_0x04c5('0x49')](handleError(_0xda67e6,null));};exports[_0x04c5('0x4a')]=function(_0x52eb34,_0xda008b){var _0x3f663c={'raw':!![],'where':{'id':_0x52eb34['params']['id']}},_0x11d0b2={};_0x11d0b2['model']=_[_0x04c5('0x4b')](db['OpenchannelQueue']['rawAttributes']);_0x11d0b2[_0x04c5('0x3a')]=_[_0x04c5('0x4b')](_0x52eb34['query']);_0x11d0b2['filters']=_[_0x04c5('0x39')](_0x11d0b2['model'],_0x11d0b2['query']);_0x3f663c['attributes']=_[_0x04c5('0x39')](_0x11d0b2[_0x04c5('0x37')],qs['fields'](_0x52eb34['query']['fields']));_0x3f663c[_0x04c5('0x3c')]=_0x3f663c[_0x04c5('0x3c')][_0x04c5('0x3d')]?_0x3f663c[_0x04c5('0x3c')]:_0x11d0b2[_0x04c5('0x37')];if(_0x52eb34['query']['includeAll']){_0x3f663c[_0x04c5('0x4c')]=[{'all':!![]}];}_0x3f663c=_[_0x04c5('0x45')]({},_0x3f663c,_0x52eb34[_0x04c5('0x4d')]);return db[_0x04c5('0x33')][_0x04c5('0x4e')](_0x3f663c)[_0x04c5('0x28')](handleEntityNotFound(_0xda008b,null))[_0x04c5('0x28')](respondWithResult(_0xda008b,null))[_0x04c5('0x49')](handleError(_0xda008b,null));};exports[_0x04c5('0x4f')]=function(_0x43fe6b,_0x3f6432){return db[_0x04c5('0x33')][_0x04c5('0x4f')](_0x43fe6b[_0x04c5('0x50')],{})['then'](function(_0x4d593d){var _0x1b68cf=_0x43fe6b[_0x04c5('0x51')][_0x04c5('0x2a')]({'plain':!![]});if(!_0x1b68cf)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1b68cf[_0x04c5('0x52')]==='user'){var _0xeddf00=_0x4d593d['get']({'plain':!![]});var _0x26792b=_0x04c5('0x2b');return db[_0x04c5('0x53')][_0x04c5('0x4e')]({'where':{'name':_0x26792b,'userProfileId':_0x1b68cf['userProfileId']},'raw':!![]})[_0x04c5('0x28')](function(_0x492661){if(_0x492661&&_0x492661['autoAssociation']===0x0){return db[_0x04c5('0x2c')][_0x04c5('0x4f')]({'name':_0xeddf00['name'],'resourceId':_0xeddf00['id'],'type':_0x492661[_0x04c5('0x2f')],'sectionId':_0x492661['id']},{})['then'](function(){return _0x4d593d;});}else{return _0x4d593d;}})[_0x04c5('0x49')](function(_0x59d57d){logger[_0x04c5('0x2e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x59d57d);throw _0x59d57d;});}return _0x4d593d;})['then'](respondWithResult(_0x3f6432,0xc9))[_0x04c5('0x49')](handleError(_0x3f6432,null));};exports[_0x04c5('0x27')]=function(_0x3d8cc2,_0x241608){if(_0x3d8cc2['body']['id']){delete _0x3d8cc2[_0x04c5('0x50')]['id'];}return db[_0x04c5('0x33')][_0x04c5('0x4e')]({'where':{'id':_0x3d8cc2[_0x04c5('0x54')]['id']}})[_0x04c5('0x28')](handleEntityNotFound(_0x241608,null))[_0x04c5('0x28')](saveUpdates(_0x3d8cc2[_0x04c5('0x50')],null))[_0x04c5('0x28')](respondWithResult(_0x241608,null))['catch'](handleError(_0x241608,null));};exports['destroy']=function(_0xc34dec,_0x119f9a){return db[_0x04c5('0x33')][_0x04c5('0x4e')]({'where':{'id':_0xc34dec['params']['id']}})[_0x04c5('0x28')](handleEntityNotFound(_0x119f9a,null))['then'](removeEntity(_0x119f9a,null))[_0x04c5('0x49')](handleError(_0x119f9a,null));};exports[_0x04c5('0x55')]=function(_0x6578,_0x5daeda){return db[_0x04c5('0x33')][_0x04c5('0x55')]()[_0x04c5('0x28')](respondWithResult(_0x5daeda,null))[_0x04c5('0x49')](handleError(_0x5daeda,null));};exports[_0x04c5('0x56')]=function(_0x163d69,_0x3192ab,_0x388b23){var _0x293a22={'raw':!![],'where':{}},_0x5de99f={},_0x365c35;return db['OpenchannelQueue'][_0x04c5('0x57')]({'where':{'id':_0x163d69['params']['id']}})[_0x04c5('0x28')](handleEntityNotFound(_0x3192ab,null))[_0x04c5('0x28')](function(_0x473935){if(_0x473935){_0x365c35=_0x473935[_0x04c5('0x2a')]({'plain':!![]});_0x5de99f['model']=_[_0x04c5('0x4b')](db[_0x04c5('0x58')][_0x04c5('0x59')]);_0x5de99f[_0x04c5('0x3a')]=_['keys'](_0x163d69[_0x04c5('0x3a')]);_0x5de99f[_0x04c5('0x38')]=_[_0x04c5('0x39')](_0x5de99f[_0x04c5('0x37')],_0x5de99f[_0x04c5('0x3a')]);_0x293a22[_0x04c5('0x3c')]=_[_0x04c5('0x39')](_0x5de99f[_0x04c5('0x37')],qs['fields'](_0x163d69[_0x04c5('0x3a')]['fields']));_0x293a22[_0x04c5('0x3c')]=_0x293a22[_0x04c5('0x3c')][_0x04c5('0x3d')]?_0x293a22['attributes']:_0x5de99f['model'];if(!_0x163d69['query'][_0x04c5('0x3e')](_0x04c5('0x3f'))){_0x293a22[_0x04c5('0x22')]=qs[_0x04c5('0x22')](_0x163d69[_0x04c5('0x3a')][_0x04c5('0x22')]);_0x293a22['offset']=qs[_0x04c5('0x21')](_0x163d69[_0x04c5('0x3a')]['offset']);}_0x293a22[_0x04c5('0x40')]=qs['sort'](_0x163d69[_0x04c5('0x3a')][_0x04c5('0x41')]);_0x293a22[_0x04c5('0x42')]=qs[_0x04c5('0x38')](_[_0x04c5('0x43')](_0x163d69[_0x04c5('0x3a')],_0x5de99f['filters']));_0x293a22['where'][_0x04c5('0x5a')]=_0x473935['id'];if(_0x163d69['query']['filter']){_0x293a22[_0x04c5('0x42')]=_[_0x04c5('0x45')](_0x293a22[_0x04c5('0x42')],{'$or':_[_0x04c5('0x32')](_0x293a22[_0x04c5('0x3c')],function(_0x55ebff){var _0x119991={};_0x119991[_0x55ebff]={'$like':'%'+_0x163d69[_0x04c5('0x3a')][_0x04c5('0x44')]+'%'};return _0x119991;})});}_0x293a22=_[_0x04c5('0x45')]({},_0x293a22,_0x163d69[_0x04c5('0x4d')]);return db['UserOpenchannelQueue'][_0x04c5('0x48')](_0x293a22);}})['then'](function(_0x4f7d4c){if(_0x4f7d4c){return db[_0x04c5('0x5b')][_0x04c5('0x5c')]({'where':{'id':_[_0x04c5('0x32')](_0x4f7d4c,_0x04c5('0x5d')),'role':_0x04c5('0x5e')},'attributes':['id',_0x04c5('0x2f'),_0x04c5('0x5f'),_0x04c5('0x60'),_0x04c5('0x61')]});}})[_0x04c5('0x28')](function(_0x365ef0){if(_0x365ef0){return{'count':_0x365ef0[_0x04c5('0x24')],'rows':_[_0x04c5('0x32')](_0x365ef0[_0x04c5('0x62')],function(_0x249237){return{'membername':_0x249237[_0x04c5('0x2f')],'UserId':_0x249237['id'],'queue_name':_0x365c35[_0x04c5('0x2f')],'OpenchannelQueueId':_0x365c35['id'],'interface':util[_0x04c5('0x63')]('%s/%s',_0x04c5('0x64'),_0x249237['name']),'penalty':0x0,'paused':_0x249237['openchannelPause'],'createdAt':_0x249237['createdAt'],'updatedAt':_0x249237[_0x04c5('0x60')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x04c5('0x28')](respondWithFilteredResult(_0x3192ab,_0x293a22))['catch'](handleError(_0x3192ab,null));};exports[_0x04c5('0x65')]=function(_0x531467,_0x494bb7,_0x2e487a){var _0x57d708={};var _0x9cb990={};var _0x5805ef;var _0x57ac66;return db[_0x04c5('0x33')][_0x04c5('0x57')]({'where':{'id':_0x531467[_0x04c5('0x54')]['id']}})[_0x04c5('0x28')](handleEntityNotFound(_0x494bb7,null))['then'](function(_0x4daba4){if(_0x4daba4){_0x5805ef=_0x4daba4;_0x9cb990[_0x04c5('0x37')]=_[_0x04c5('0x4b')](db[_0x04c5('0x66')][_0x04c5('0x59')]);_0x9cb990[_0x04c5('0x3a')]=_[_0x04c5('0x4b')](_0x531467['query']);_0x9cb990['filters']=_['intersection'](_0x9cb990['model'],_0x9cb990['query']);_0x57d708[_0x04c5('0x3c')]=_[_0x04c5('0x39')](_0x9cb990[_0x04c5('0x37')],qs[_0x04c5('0x3b')](_0x531467[_0x04c5('0x3a')][_0x04c5('0x3b')]));_0x57d708['attributes']=_0x57d708[_0x04c5('0x3c')]['length']?_0x57d708[_0x04c5('0x3c')]:_0x9cb990[_0x04c5('0x37')];_0x57d708['order']=qs[_0x04c5('0x41')](_0x531467['query']['sort']);_0x57d708['where']=qs[_0x04c5('0x38')](_['pick'](_0x531467[_0x04c5('0x3a')],_0x9cb990[_0x04c5('0x38')]));if(_0x531467['query'][_0x04c5('0x44')]){_0x57d708[_0x04c5('0x42')]=_['merge'](_0x57d708[_0x04c5('0x42')],{'$or':_[_0x04c5('0x32')](_0x57d708['attributes'],function(_0x2708d0){var _0xf2aa68={};_0xf2aa68[_0x2708d0]={'$like':'%'+_0x531467[_0x04c5('0x3a')][_0x04c5('0x44')]+'%'};return _0xf2aa68;})});}_0x57d708=_['merge']({},_0x57d708,_0x531467['options']);return _0x5805ef['getTeams'](_0x57d708);}})['then'](function(_0x4d772b){if(_0x4d772b){_0x57ac66=_0x4d772b['length'];if(!_0x531467['query'][_0x04c5('0x3e')](_0x04c5('0x3f'))){_0x57d708[_0x04c5('0x22')]=qs[_0x04c5('0x22')](_0x531467[_0x04c5('0x3a')][_0x04c5('0x22')]);_0x57d708[_0x04c5('0x21')]=qs['offset'](_0x531467['query'][_0x04c5('0x21')]);}return _0x5805ef['getTeams'](_0x57d708);}})[_0x04c5('0x28')](function(_0x175903){if(_0x175903){return _0x175903?{'count':_0x57ac66,'rows':_0x175903}:null;}})[_0x04c5('0x28')](respondWithResult(_0x494bb7,null))[_0x04c5('0x49')](handleError(_0x494bb7,null));};exports[_0x04c5('0x67')]=function(_0x172f06,_0x35b338,_0x3fc9e5){var _0x53b520=_0x172f06[_0x04c5('0x50')][_0x04c5('0x68')];return db[_0x04c5('0x66')][_0x04c5('0x48')]({'where':{'id':_0x53b520},'attributes':['id'],'include':[{'model':db[_0x04c5('0x5b')],'as':_0x04c5('0x69'),'attributes':['id','name',_0x04c5('0x6a'),'voicePause',_0x04c5('0x6b')],'raw':!![]}]})[_0x04c5('0x28')](function(_0xd14fcb){if(_0xd14fcb){var _0x5a8db9=_[_0x04c5('0x6c')](_0xd14fcb,function(_0x16c99){var _0x19bf9e=_0x16c99[_0x04c5('0x2a')]({'plain':!![]});return _0x19bf9e[_0x04c5('0x69')];});return db['OpenchannelQueue']['find']({'where':{'id':_0x172f06[_0x04c5('0x54')]['id']}})[_0x04c5('0x28')](function(_0x30c568){return db[_0x04c5('0x6d')][_0x04c5('0x6e')](function(_0x4efd28){return _0x30c568['addTeams'](_0x53b520,{'transaction':_0x4efd28})[_0x04c5('0x28')](function(){return BPromise[_0x04c5('0x6f')](_0x5a8db9,function(_0x41f6d3){return db[_0x04c5('0x58')]['findOrCreate']({'where':{'UserId':_0x41f6d3['id'],'OpenchannelQueueId':_0x172f06[_0x04c5('0x54')]['id']},'transaction':_0x4efd28});});})[_0x04c5('0x28')](function(){_0x5a8db9[_0x04c5('0x70')](function(_0x5b5755){socket[_0x04c5('0x71')](_0x04c5('0x72'),{'UserId':_0x5b5755['id'],'OpenchannelQueueId':_0x30c568['id']});});});});});}})[_0x04c5('0x28')](respondWithStatusCode(_0x35b338,null))[_0x04c5('0x49')](handleError(_0x35b338,null));};exports['removeTeams']=function(_0x406055,_0x1bc7f7,_0x38b5c0){return db[_0x04c5('0x66')]['findAll']({'where':{'id':_0x406055[_0x04c5('0x3a')][_0x04c5('0x68')]},'attributes':['id'],'include':[{'model':db[_0x04c5('0x5b')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x04c5('0x28')](handleEntityNotFound(_0x1bc7f7,null))[_0x04c5('0x28')](function(_0x5103a1){var _0x19fcbe=_['map'](_0x5103a1,'id');var _0xc51f2c=[];var _0x48e8e6=[];var _0x5252a6=squel['select']();_0x5252a6[_0x04c5('0x73')](_0x04c5('0x74'))['from'](_0x04c5('0x75'),'tq')['join']('user_has_teams','ut',_0x04c5('0x76'))[_0x04c5('0x42')](_0x04c5('0x77'),_0x406055['params']['id']);for(var _0x57aa9e=0x0;_0x57aa9e<_0x5103a1[_0x04c5('0x3d')];_0x57aa9e+=0x1){let _0x29af30=_0x5103a1[_0x57aa9e];for(var _0x46f386=0x0;_0x46f386<_0x29af30[_0x04c5('0x69')][_0x04c5('0x3d')];_0x46f386+=0x1){let _0x2f7d51=_0x29af30[_0x04c5('0x69')][_0x46f386];var _0x2f87f7=_0x5252a6['clone']();_0x2f87f7[_0x04c5('0x42')](_0x04c5('0x78'),_0x2f7d51['id']);_0x48e8e6[_0x04c5('0x79')](db[_0x04c5('0x6d')][_0x04c5('0x3a')](_0x2f87f7[_0x04c5('0x7a')](),{'type':db[_0x04c5('0x6d')][_0x04c5('0x7b')]['SELECT']})[_0x04c5('0x28')](function(_0x304eec){if(_0x304eec['length']===0x1){return _0x2f7d51['id'];}else{var _0x38a232=_['every'](_['map'](_0x304eec,_0x04c5('0x7c')),function(_0xe858fd){return _[_0x04c5('0x7d')](_0x19fcbe,_0xe858fd);});if(_0x38a232){return _0x2f7d51['id'];}}}));}}return BPromise[_0x04c5('0x7e')](_0x48e8e6)['then'](function(_0x49a677){_0xc51f2c=_(_0xc51f2c)['union'](_0x49a677)[_0x04c5('0x7f')]()[_0x04c5('0x80')]();return db['OpenchannelQueue']['find']({'where':{'id':_0x406055['params']['id']}})[_0x04c5('0x28')](function(_0x4d6f1a){return db[_0x04c5('0x6d')]['transaction'](function(_0x272206){return _0x4d6f1a['removeTeams'](_0x406055['query'][_0x04c5('0x68')],{'transaction':_0x272206})[_0x04c5('0x28')](function(){if(!_[_0x04c5('0x81')](_0xc51f2c)){return _0x4d6f1a[_0x04c5('0x82')](_0xc51f2c,{'transaction':_0x272206});}})[_0x04c5('0x28')](function(){_0xc51f2c[_0x04c5('0x70')](function(_0x452556){socket[_0x04c5('0x71')](_0x04c5('0x83'),{'UserId':_0x452556,'OpenchannelQueueId':_0x4d6f1a['id']});});});});});});})[_0x04c5('0x28')](respondWithStatusCode(_0x1bc7f7,null))[_0x04c5('0x49')](handleError(_0x1bc7f7,null));};exports[_0x04c5('0x84')]=function(_0x5f48cf,_0x29f5e4,_0x228ef2){return db[_0x04c5('0x33')][_0x04c5('0x4e')]({'where':{'id':_0x5f48cf['params']['id']}})[_0x04c5('0x28')](handleEntityNotFound(_0x29f5e4,null))[_0x04c5('0x28')](function(_0x6f3d0d){if(_0x6f3d0d){return _0x6f3d0d[_0x04c5('0x84')](_0x5f48cf[_0x04c5('0x50')][_0x04c5('0x68')],_[_0x04c5('0x85')](_0x5f48cf[_0x04c5('0x50')],[_0x04c5('0x68'),'id'])||{})[_0x04c5('0x86')](function(_0x57cf7e){for(var _0x2583fb=0x0;_0x2583fb<_0x5f48cf[_0x04c5('0x50')][_0x04c5('0x68')][_0x04c5('0x3d')];_0x2583fb+=0x1){socket[_0x04c5('0x71')]('userOpenchannelQueue:save',{'UserId':_0x5f48cf[_0x04c5('0x50')][_0x04c5('0x68')][_0x2583fb],'OpenchannelQueueId':_0x5f48cf[_0x04c5('0x54')]['id']});}return _0x57cf7e;});}})[_0x04c5('0x28')](respondWithResult(_0x29f5e4,null))['catch'](handleError(_0x29f5e4,null));};exports[_0x04c5('0x82')]=function(_0x24307c,_0x5e6da4,_0x282677){return db[_0x04c5('0x33')][_0x04c5('0x4e')]({'where':{'id':_0x24307c[_0x04c5('0x54')]['id']}})[_0x04c5('0x28')](handleEntityNotFound(_0x5e6da4,null))[_0x04c5('0x28')](function(_0x5469fd){if(_0x5469fd){return _0x5469fd[_0x04c5('0x82')](_0x24307c[_0x04c5('0x3a')][_0x04c5('0x68')])[_0x04c5('0x28')](function(){if(_['isArray'](_0x24307c[_0x04c5('0x3a')][_0x04c5('0x68')])){for(var _0x526ba1=0x0;_0x526ba1<_0x24307c[_0x04c5('0x3a')][_0x04c5('0x68')][_0x04c5('0x3d')];_0x526ba1+=0x1){socket['emit']('userOpenchannelQueue:remove',{'UserId':Number(_0x24307c[_0x04c5('0x3a')][_0x04c5('0x68')][_0x526ba1]),'OpenchannelQueueId':Number(_0x24307c['params']['id'])});}}else{socket[_0x04c5('0x71')](_0x04c5('0x83'),{'UserId':Number(_0x24307c['query'][_0x04c5('0x68')]),'OpenchannelQueueId':Number(_0x24307c[_0x04c5('0x54')]['id'])});}});}})['then'](respondWithStatusCode(_0x5e6da4,null))[_0x04c5('0x49')](handleError(_0x5e6da4,null));};exports['getAgents']=function(_0x59fdb9,_0x541ec6,_0x277d50){var _0x5ad55d={};var _0x30bd4b={};var _0x78b4b;var _0x4baecf;return db['OpenchannelQueue']['findOne']({'where':{'id':_0x59fdb9[_0x04c5('0x54')]['id']}})[_0x04c5('0x28')](handleEntityNotFound(_0x541ec6,null))[_0x04c5('0x28')](function(_0x2d5879){if(_0x2d5879){_0x78b4b=_0x2d5879;_0x30bd4b[_0x04c5('0x37')]=_['keys'](db['User']['rawAttributes']);_0x30bd4b[_0x04c5('0x3a')]=_[_0x04c5('0x4b')](_0x59fdb9[_0x04c5('0x3a')]);_0x30bd4b[_0x04c5('0x38')]=_['intersection'](_0x30bd4b[_0x04c5('0x37')],_0x30bd4b[_0x04c5('0x3a')]);_0x5ad55d[_0x04c5('0x3c')]=_[_0x04c5('0x39')](_0x30bd4b[_0x04c5('0x37')],qs[_0x04c5('0x3b')](_0x59fdb9['query'][_0x04c5('0x3b')]));_0x5ad55d['attributes']=_0x5ad55d['attributes']['length']?_0x5ad55d['attributes']:_0x30bd4b[_0x04c5('0x37')];_0x5ad55d[_0x04c5('0x40')]=qs[_0x04c5('0x41')](_0x59fdb9[_0x04c5('0x3a')][_0x04c5('0x41')]);_0x5ad55d[_0x04c5('0x42')]=qs[_0x04c5('0x38')](_[_0x04c5('0x43')](_0x59fdb9[_0x04c5('0x3a')],_0x30bd4b[_0x04c5('0x38')]));if(_0x59fdb9['query'][_0x04c5('0x44')]){_0x5ad55d['where']=_['merge'](_0x5ad55d['where'],{'$or':_[_0x04c5('0x32')](_0x5ad55d['attributes'],function(_0x521751){var _0x52aa9e={};_0x52aa9e[_0x521751]={'$like':'%'+_0x59fdb9[_0x04c5('0x3a')][_0x04c5('0x44')]+'%'};return _0x52aa9e;})});}_0x5ad55d=_['merge']({},_0x5ad55d,_0x59fdb9[_0x04c5('0x4d')]);return _0x78b4b[_0x04c5('0x87')](_0x5ad55d);}})[_0x04c5('0x28')](function(_0x17bfef){if(_0x17bfef){_0x4baecf=_0x17bfef[_0x04c5('0x3d')];if(!_0x59fdb9[_0x04c5('0x3a')][_0x04c5('0x3e')]('nolimit')){_0x5ad55d[_0x04c5('0x22')]=qs['limit'](_0x59fdb9[_0x04c5('0x3a')]['limit']);_0x5ad55d[_0x04c5('0x21')]=qs[_0x04c5('0x21')](_0x59fdb9[_0x04c5('0x3a')][_0x04c5('0x21')]);}return _0x78b4b['getAgents'](_0x5ad55d);}})[_0x04c5('0x28')](function(_0x2586c5){if(_0x2586c5){return _0x2586c5?{'count':_0x4baecf,'rows':_0x2586c5}:null;}})[_0x04c5('0x28')](respondWithResult(_0x541ec6,null))['catch'](handleError(_0x541ec6,null));}; \ No newline at end of file +var _0x63ea=['union','compact','isEmpty','removeAgents','userOpenchannelQueue:remove','addAgents','omit','isArray','getAgents','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','socket.io-emitter','./openchannelQueue.socket','sendStatus','status','end','json','offset','count','set','Content-Range','reject','save','update','then','get','OpenchannelQueues','error','stack','name','send','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','OpenchannelQueue','includeAll','include','catch','show','params','options','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','destroy','describe','getMembers','findOne','UserOpenchannelQueue','OpenchannelQueueId','findAll','User','UserId','openchannelPause','updatedAt','format','%s/%s','createdAt','getTeams','Team','ids','Agents','online','voicePause','interface','sequelize','transaction','addTeams','each','findOrCreate','forEach','emit','userOpenchannelQueue:save','removeTeams','select','field','tq.TeamId','team_has_openchannel_queues','user_has_teams','ut.UserId\x20=\x20?','push','toString','QueryTypes','every','TeamId','includes'];(function(_0x4d648f,_0x57c560){var _0x1471aa=function(_0xb6f274){while(--_0xb6f274){_0x4d648f['push'](_0x4d648f['shift']());}};_0x1471aa(++_0x57c560);}(_0x63ea,0x113));var _0xa63e=function(_0x50febb,_0x474865){_0x50febb=_0x50febb-0x0;var _0x2fe24c=_0x63ea[_0x50febb];return _0x2fe24c;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xa63e('0x0'));var jsonpatch=require(_0xa63e('0x1'));var rp=require(_0xa63e('0x2'));var moment=require(_0xa63e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xa63e('0x4'));var util=require('util');var path=require(_0xa63e('0x5'));var sox=require(_0xa63e('0x6'));var csv=require(_0xa63e('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa63e('0x8'));var _=require(_0xa63e('0x9'));var squel=require(_0xa63e('0xa'));var crypto=require(_0xa63e('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xa63e('0x7'));var querystring=require('querystring');var Papa=require(_0xa63e('0xc'));var Redis=require(_0xa63e('0xd'));var authService=require(_0xa63e('0xe'));var qs=require(_0xa63e('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa63e('0x10'));var logger=require(_0xa63e('0x11'))(_0xa63e('0x12'));var utils=require(_0xa63e('0x13'));var config=require(_0xa63e('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xa63e('0x15'))['db'];config[_0xa63e('0x16')]=_['defaults'](config[_0xa63e('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0xa63e('0x17'))(new Redis(config[_0xa63e('0x16')]));require(_0xa63e('0x18'))['register'](socket);function respondWithStatusCode(_0x4ef173,_0x216d76){_0x216d76=_0x216d76||0xcc;return function(_0x207785){if(_0x207785){return _0x4ef173[_0xa63e('0x19')](_0x216d76);}return _0x4ef173[_0xa63e('0x1a')](_0x216d76)[_0xa63e('0x1b')]();};}function respondWithResult(_0x3ab51f,_0x58c925){_0x58c925=_0x58c925||0xc8;return function(_0x57e02a){if(_0x57e02a){return _0x3ab51f[_0xa63e('0x1a')](_0x58c925)[_0xa63e('0x1c')](_0x57e02a);}};}function respondWithFilteredResult(_0x297e2,_0x315fb4){return function(_0x5b1e85){if(_0x5b1e85){var _0x5e917d=typeof _0x315fb4[_0xa63e('0x1d')]==='undefined'&&typeof _0x315fb4['limit']==='undefined';var _0x455160=_0x5b1e85[_0xa63e('0x1e')];var _0xad594a=_0x5e917d?0x0:_0x315fb4[_0xa63e('0x1d')];var _0x1b3a04=_0x5e917d?_0x5b1e85[_0xa63e('0x1e')]:_0x315fb4[_0xa63e('0x1d')]+_0x315fb4['limit'];var _0x59275d;if(_0x1b3a04>=_0x455160){_0x1b3a04=_0x455160;_0x59275d=0xc8;}else{_0x59275d=0xce;}_0x297e2['status'](_0x59275d);return _0x297e2[_0xa63e('0x1f')](_0xa63e('0x20'),_0xad594a+'-'+_0x1b3a04+'/'+_0x455160)[_0xa63e('0x1c')](_0x5b1e85);}return null;};}function patchUpdates(_0x47994c){return function(_0x234945){try{jsonpatch['apply'](_0x234945,_0x47994c,!![]);}catch(_0x213a26){return BPromise[_0xa63e('0x21')](_0x213a26);}return _0x234945[_0xa63e('0x22')]();};}function saveUpdates(_0x129c4c,_0x1a25c5){return function(_0x29df31){if(_0x29df31){return _0x29df31[_0xa63e('0x23')](_0x129c4c)['then'](function(_0x42693c){return _0x42693c;});}return null;};}function removeEntity(_0x52edf0,_0x588d4b){return function(_0x252936){if(_0x252936){return _0x252936['destroy']()[_0xa63e('0x24')](function(){var _0x2a1e35=_0x252936[_0xa63e('0x25')]({'plain':!![]});var _0x2745f1=_0xa63e('0x26');return db['UserProfileResource']['destroy']({'where':{'type':_0x2745f1,'resourceId':_0x2a1e35['id']}})[_0xa63e('0x24')](function(){return _0x252936;});})[_0xa63e('0x24')](function(){_0x52edf0['status'](0xcc)[_0xa63e('0x1b')]();});}};}function handleEntityNotFound(_0x3a581f,_0x51b59a){return function(_0x3f756f){if(!_0x3f756f){_0x3a581f[_0xa63e('0x19')](0x194);}return _0x3f756f;};}function handleError(_0x402e93,_0x3d5a42){_0x3d5a42=_0x3d5a42||0x1f4;return function(_0x33b321){logger[_0xa63e('0x27')](_0x33b321[_0xa63e('0x28')]);if(_0x33b321['name']){delete _0x33b321[_0xa63e('0x29')];}_0x402e93[_0xa63e('0x1a')](_0x3d5a42)[_0xa63e('0x2a')](_0x33b321);};}exports[_0xa63e('0x2b')]=function(_0x33f76a,_0xda82f8){var _0x3fc26a={},_0x27a7a2={},_0x25d406={'count':0x0,'rows':[]};var _0x15bc07=_[_0xa63e('0x2c')](db['OpenchannelQueue'][_0xa63e('0x2d')],function(_0x3dab51){return{'name':_0x3dab51['fieldName'],'type':_0x3dab51[_0xa63e('0x2e')][_0xa63e('0x2f')]};});_0x27a7a2[_0xa63e('0x30')]=_['map'](_0x15bc07,_0xa63e('0x29'));_0x27a7a2[_0xa63e('0x31')]=_[_0xa63e('0x32')](_0x33f76a['query']);_0x27a7a2[_0xa63e('0x33')]=_[_0xa63e('0x34')](_0x27a7a2[_0xa63e('0x30')],_0x27a7a2[_0xa63e('0x31')]);_0x3fc26a[_0xa63e('0x35')]=_[_0xa63e('0x34')](_0x27a7a2[_0xa63e('0x30')],qs[_0xa63e('0x36')](_0x33f76a[_0xa63e('0x31')][_0xa63e('0x36')]));_0x3fc26a[_0xa63e('0x35')]=_0x3fc26a[_0xa63e('0x35')][_0xa63e('0x37')]?_0x3fc26a[_0xa63e('0x35')]:_0x27a7a2[_0xa63e('0x30')];if(!_0x33f76a[_0xa63e('0x31')][_0xa63e('0x38')](_0xa63e('0x39'))){_0x3fc26a[_0xa63e('0x3a')]=qs[_0xa63e('0x3a')](_0x33f76a[_0xa63e('0x31')][_0xa63e('0x3a')]);_0x3fc26a[_0xa63e('0x1d')]=qs[_0xa63e('0x1d')](_0x33f76a[_0xa63e('0x31')]['offset']);}_0x3fc26a[_0xa63e('0x3b')]=qs[_0xa63e('0x3c')](_0x33f76a['query']['sort']);_0x3fc26a[_0xa63e('0x3d')]=qs[_0xa63e('0x33')](_[_0xa63e('0x3e')](_0x33f76a[_0xa63e('0x31')],_0x27a7a2[_0xa63e('0x33')]),_0x15bc07);if(_0x33f76a[_0xa63e('0x31')][_0xa63e('0x3f')]){_0x3fc26a[_0xa63e('0x3d')]=_[_0xa63e('0x40')](_0x3fc26a[_0xa63e('0x3d')],{'$or':_[_0xa63e('0x2c')](_0x15bc07,function(_0x1d56af){if(_0x1d56af['type']!==_0xa63e('0x41')){var _0x4bbc28={};_0x4bbc28[_0x1d56af['name']]={'$like':'%'+_0x33f76a[_0xa63e('0x31')]['filter']+'%'};return _0x4bbc28;}})});}_0x3fc26a=_[_0xa63e('0x40')]({},_0x3fc26a,_0x33f76a['options']);var _0x29d87e={'where':_0x3fc26a['where']};return db[_0xa63e('0x42')][_0xa63e('0x1e')](_0x29d87e)[_0xa63e('0x24')](function(_0x57ba2b){_0x25d406[_0xa63e('0x1e')]=_0x57ba2b;if(_0x33f76a[_0xa63e('0x31')][_0xa63e('0x43')]){_0x3fc26a[_0xa63e('0x44')]=[{'all':!![]}];}return db[_0xa63e('0x42')]['findAll'](_0x3fc26a);})['then'](function(_0x5aec7b){_0x25d406['rows']=_0x5aec7b;return _0x25d406;})[_0xa63e('0x24')](respondWithFilteredResult(_0xda82f8,_0x3fc26a))[_0xa63e('0x45')](handleError(_0xda82f8,null));};exports[_0xa63e('0x46')]=function(_0x146672,_0xb21dad){var _0x2de47f={'raw':!![],'where':{'id':_0x146672[_0xa63e('0x47')]['id']}},_0x122da5={};_0x122da5['model']=_[_0xa63e('0x32')](db['OpenchannelQueue']['rawAttributes']);_0x122da5['query']=_['keys'](_0x146672[_0xa63e('0x31')]);_0x122da5[_0xa63e('0x33')]=_[_0xa63e('0x34')](_0x122da5['model'],_0x122da5[_0xa63e('0x31')]);_0x2de47f[_0xa63e('0x35')]=_[_0xa63e('0x34')](_0x122da5[_0xa63e('0x30')],qs[_0xa63e('0x36')](_0x146672[_0xa63e('0x31')][_0xa63e('0x36')]));_0x2de47f[_0xa63e('0x35')]=_0x2de47f[_0xa63e('0x35')][_0xa63e('0x37')]?_0x2de47f['attributes']:_0x122da5['model'];if(_0x146672[_0xa63e('0x31')][_0xa63e('0x43')]){_0x2de47f[_0xa63e('0x44')]=[{'all':!![]}];}_0x2de47f=_[_0xa63e('0x40')]({},_0x2de47f,_0x146672[_0xa63e('0x48')]);return db['OpenchannelQueue'][_0xa63e('0x49')](_0x2de47f)[_0xa63e('0x24')](handleEntityNotFound(_0xb21dad,null))['then'](respondWithResult(_0xb21dad,null))[_0xa63e('0x45')](handleError(_0xb21dad,null));};exports[_0xa63e('0x4a')]=function(_0xb6d563,_0x510011){return db['OpenchannelQueue'][_0xa63e('0x4a')](_0xb6d563['body'],{})[_0xa63e('0x24')](function(_0x234dff){var _0x257009=_0xb6d563['user'][_0xa63e('0x25')]({'plain':!![]});if(!_0x257009)throw new Error(_0xa63e('0x4b'));if(_0x257009[_0xa63e('0x4c')]==='user'){var _0x3f0252=_0x234dff[_0xa63e('0x25')]({'plain':!![]});var _0x46f021='OpenchannelQueues';return db['UserProfileSection'][_0xa63e('0x49')]({'where':{'name':_0x46f021,'userProfileId':_0x257009[_0xa63e('0x4d')]},'raw':!![]})[_0xa63e('0x24')](function(_0x79c30c){if(_0x79c30c&&_0x79c30c[_0xa63e('0x4e')]===0x0){return db[_0xa63e('0x4f')][_0xa63e('0x4a')]({'name':_0x3f0252[_0xa63e('0x29')],'resourceId':_0x3f0252['id'],'type':_0x79c30c[_0xa63e('0x29')],'sectionId':_0x79c30c['id']},{})[_0xa63e('0x24')](function(){return _0x234dff;});}else{return _0x234dff;}})[_0xa63e('0x45')](function(_0x3b75a6){logger[_0xa63e('0x27')](_0xa63e('0x50'),_0x3b75a6);throw _0x3b75a6;});}return _0x234dff;})[_0xa63e('0x24')](respondWithResult(_0x510011,0xc9))['catch'](handleError(_0x510011,null));};exports[_0xa63e('0x23')]=function(_0x9430a6,_0x292520){if(_0x9430a6[_0xa63e('0x51')]['id']){delete _0x9430a6['body']['id'];}return db['OpenchannelQueue'][_0xa63e('0x49')]({'where':{'id':_0x9430a6[_0xa63e('0x47')]['id']}})[_0xa63e('0x24')](handleEntityNotFound(_0x292520,null))[_0xa63e('0x24')](saveUpdates(_0x9430a6['body'],null))[_0xa63e('0x24')](respondWithResult(_0x292520,null))[_0xa63e('0x45')](handleError(_0x292520,null));};exports[_0xa63e('0x52')]=function(_0x2c1886,_0x5978ae){return db['OpenchannelQueue'][_0xa63e('0x49')]({'where':{'id':_0x2c1886[_0xa63e('0x47')]['id']}})[_0xa63e('0x24')](handleEntityNotFound(_0x5978ae,null))[_0xa63e('0x24')](removeEntity(_0x5978ae,null))['catch'](handleError(_0x5978ae,null));};exports[_0xa63e('0x53')]=function(_0x405cfc,_0x2593da){return db['OpenchannelQueue']['describe']()[_0xa63e('0x24')](respondWithResult(_0x2593da,null))['catch'](handleError(_0x2593da,null));};exports[_0xa63e('0x54')]=function(_0x382299,_0x4c0fbf,_0x38fd7f){var _0x4bce33={'raw':!![],'where':{}},_0x5b889c={},_0x4fb73a;return db[_0xa63e('0x42')][_0xa63e('0x55')]({'where':{'id':_0x382299[_0xa63e('0x47')]['id']}})['then'](handleEntityNotFound(_0x4c0fbf,null))[_0xa63e('0x24')](function(_0x2f1b57){if(_0x2f1b57){_0x4fb73a=_0x2f1b57[_0xa63e('0x25')]({'plain':!![]});_0x5b889c[_0xa63e('0x30')]=_[_0xa63e('0x32')](db[_0xa63e('0x56')][_0xa63e('0x2d')]);_0x5b889c['query']=_[_0xa63e('0x32')](_0x382299[_0xa63e('0x31')]);_0x5b889c[_0xa63e('0x33')]=_['intersection'](_0x5b889c['model'],_0x5b889c[_0xa63e('0x31')]);_0x4bce33[_0xa63e('0x35')]=_[_0xa63e('0x34')](_0x5b889c[_0xa63e('0x30')],qs[_0xa63e('0x36')](_0x382299['query'][_0xa63e('0x36')]));_0x4bce33[_0xa63e('0x35')]=_0x4bce33[_0xa63e('0x35')][_0xa63e('0x37')]?_0x4bce33['attributes']:_0x5b889c['model'];if(!_0x382299['query'][_0xa63e('0x38')]('nolimit')){_0x4bce33[_0xa63e('0x3a')]=qs[_0xa63e('0x3a')](_0x382299[_0xa63e('0x31')][_0xa63e('0x3a')]);_0x4bce33[_0xa63e('0x1d')]=qs['offset'](_0x382299['query'][_0xa63e('0x1d')]);}_0x4bce33[_0xa63e('0x3b')]=qs['sort'](_0x382299[_0xa63e('0x31')][_0xa63e('0x3c')]);_0x4bce33['where']=qs[_0xa63e('0x33')](_[_0xa63e('0x3e')](_0x382299['query'],_0x5b889c[_0xa63e('0x33')]));_0x4bce33[_0xa63e('0x3d')][_0xa63e('0x57')]=_0x2f1b57['id'];if(_0x382299[_0xa63e('0x31')][_0xa63e('0x3f')]){_0x4bce33[_0xa63e('0x3d')]=_[_0xa63e('0x40')](_0x4bce33[_0xa63e('0x3d')],{'$or':_[_0xa63e('0x2c')](_0x4bce33[_0xa63e('0x35')],function(_0x47a934){var _0x33faed={};_0x33faed[_0x47a934]={'$like':'%'+_0x382299['query'][_0xa63e('0x3f')]+'%'};return _0x33faed;})});}_0x4bce33=_[_0xa63e('0x40')]({},_0x4bce33,_0x382299[_0xa63e('0x48')]);return db[_0xa63e('0x56')][_0xa63e('0x58')](_0x4bce33);}})[_0xa63e('0x24')](function(_0x12a7c1){if(_0x12a7c1){return db[_0xa63e('0x59')]['findAndCountAll']({'where':{'id':_[_0xa63e('0x2c')](_0x12a7c1,_0xa63e('0x5a')),'role':'agent'},'attributes':['id',_0xa63e('0x29'),_0xa63e('0x5b'),_0xa63e('0x5c'),'createdAt']});}})[_0xa63e('0x24')](function(_0x47d83f){if(_0x47d83f){return{'count':_0x47d83f[_0xa63e('0x1e')],'rows':_[_0xa63e('0x2c')](_0x47d83f['rows'],function(_0x3d74b9){return{'membername':_0x3d74b9[_0xa63e('0x29')],'UserId':_0x3d74b9['id'],'queue_name':_0x4fb73a[_0xa63e('0x29')],'OpenchannelQueueId':_0x4fb73a['id'],'interface':util[_0xa63e('0x5d')](_0xa63e('0x5e'),'SIP',_0x3d74b9[_0xa63e('0x29')]),'penalty':0x0,'paused':_0x3d74b9[_0xa63e('0x5b')],'createdAt':_0x3d74b9[_0xa63e('0x5f')],'updatedAt':_0x3d74b9[_0xa63e('0x5c')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xa63e('0x24')](respondWithFilteredResult(_0x4c0fbf,_0x4bce33))['catch'](handleError(_0x4c0fbf,null));};exports[_0xa63e('0x60')]=function(_0x171719,_0x188a9f,_0x1a8b68){var _0x6e40a4={};var _0x16b1e3={};var _0x4d1151;var _0x439fa0;return db[_0xa63e('0x42')]['findOne']({'where':{'id':_0x171719[_0xa63e('0x47')]['id']}})[_0xa63e('0x24')](handleEntityNotFound(_0x188a9f,null))['then'](function(_0x9cd6ef){if(_0x9cd6ef){_0x4d1151=_0x9cd6ef;_0x16b1e3[_0xa63e('0x30')]=_[_0xa63e('0x32')](db[_0xa63e('0x61')][_0xa63e('0x2d')]);_0x16b1e3[_0xa63e('0x31')]=_[_0xa63e('0x32')](_0x171719[_0xa63e('0x31')]);_0x16b1e3[_0xa63e('0x33')]=_[_0xa63e('0x34')](_0x16b1e3[_0xa63e('0x30')],_0x16b1e3['query']);_0x6e40a4[_0xa63e('0x35')]=_[_0xa63e('0x34')](_0x16b1e3[_0xa63e('0x30')],qs[_0xa63e('0x36')](_0x171719[_0xa63e('0x31')][_0xa63e('0x36')]));_0x6e40a4['attributes']=_0x6e40a4[_0xa63e('0x35')][_0xa63e('0x37')]?_0x6e40a4[_0xa63e('0x35')]:_0x16b1e3[_0xa63e('0x30')];_0x6e40a4[_0xa63e('0x3b')]=qs[_0xa63e('0x3c')](_0x171719[_0xa63e('0x31')]['sort']);_0x6e40a4['where']=qs[_0xa63e('0x33')](_[_0xa63e('0x3e')](_0x171719[_0xa63e('0x31')],_0x16b1e3[_0xa63e('0x33')]));if(_0x171719['query'][_0xa63e('0x3f')]){_0x6e40a4[_0xa63e('0x3d')]=_[_0xa63e('0x40')](_0x6e40a4[_0xa63e('0x3d')],{'$or':_[_0xa63e('0x2c')](_0x6e40a4['attributes'],function(_0x2c1539){var _0x453cb9={};_0x453cb9[_0x2c1539]={'$like':'%'+_0x171719['query'][_0xa63e('0x3f')]+'%'};return _0x453cb9;})});}_0x6e40a4=_['merge']({},_0x6e40a4,_0x171719[_0xa63e('0x48')]);return _0x4d1151[_0xa63e('0x60')](_0x6e40a4);}})[_0xa63e('0x24')](function(_0x5b9cde){if(_0x5b9cde){_0x439fa0=_0x5b9cde[_0xa63e('0x37')];if(!_0x171719['query'][_0xa63e('0x38')](_0xa63e('0x39'))){_0x6e40a4[_0xa63e('0x3a')]=qs[_0xa63e('0x3a')](_0x171719[_0xa63e('0x31')][_0xa63e('0x3a')]);_0x6e40a4[_0xa63e('0x1d')]=qs[_0xa63e('0x1d')](_0x171719[_0xa63e('0x31')]['offset']);}return _0x4d1151['getTeams'](_0x6e40a4);}})[_0xa63e('0x24')](function(_0x5c988b){if(_0x5c988b){return _0x5c988b?{'count':_0x439fa0,'rows':_0x5c988b}:null;}})['then'](respondWithResult(_0x188a9f,null))[_0xa63e('0x45')](handleError(_0x188a9f,null));};exports['addTeams']=function(_0x19efc1,_0x11a892,_0x2dc0a6){var _0x2f6e2d=_0x19efc1[_0xa63e('0x51')][_0xa63e('0x62')];return db[_0xa63e('0x61')][_0xa63e('0x58')]({'where':{'id':_0x2f6e2d},'attributes':['id'],'include':[{'model':db[_0xa63e('0x59')],'as':_0xa63e('0x63'),'attributes':['id',_0xa63e('0x29'),_0xa63e('0x64'),_0xa63e('0x65'),_0xa63e('0x66')],'raw':!![]}]})[_0xa63e('0x24')](function(_0x5c047e){if(_0x5c047e){var _0x588adb=_['flatMap'](_0x5c047e,function(_0x37fb66){var _0x5eb754=_0x37fb66[_0xa63e('0x25')]({'plain':!![]});return _0x5eb754[_0xa63e('0x63')];});return db[_0xa63e('0x42')][_0xa63e('0x49')]({'where':{'id':_0x19efc1[_0xa63e('0x47')]['id']}})[_0xa63e('0x24')](function(_0x50e327){return db[_0xa63e('0x67')][_0xa63e('0x68')](function(_0x311f61){return _0x50e327[_0xa63e('0x69')](_0x2f6e2d,{'transaction':_0x311f61})[_0xa63e('0x24')](function(){return BPromise[_0xa63e('0x6a')](_0x588adb,function(_0x1ae4f5){return db[_0xa63e('0x56')][_0xa63e('0x6b')]({'where':{'UserId':_0x1ae4f5['id'],'OpenchannelQueueId':_0x19efc1[_0xa63e('0x47')]['id']},'transaction':_0x311f61});});})[_0xa63e('0x24')](function(){_0x588adb[_0xa63e('0x6c')](function(_0x4b703e){socket[_0xa63e('0x6d')](_0xa63e('0x6e'),{'UserId':_0x4b703e['id'],'OpenchannelQueueId':_0x50e327['id']});});});});});}})[_0xa63e('0x24')](respondWithStatusCode(_0x11a892,null))[_0xa63e('0x45')](handleError(_0x11a892,null));};exports[_0xa63e('0x6f')]=function(_0x11ee8e,_0x5b7b54,_0x2cff6a){return db[_0xa63e('0x61')][_0xa63e('0x58')]({'where':{'id':_0x11ee8e[_0xa63e('0x31')][_0xa63e('0x62')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xa63e('0x63'),'attributes':['id'],'raw':!![]}]})[_0xa63e('0x24')](handleEntityNotFound(_0x5b7b54,null))[_0xa63e('0x24')](function(_0xf3177d){var _0x6a9e89=_[_0xa63e('0x2c')](_0xf3177d,'id');var _0x3cc798=[];var _0x2fd3e0=[];var _0x3d1d85=squel[_0xa63e('0x70')]();_0x3d1d85[_0xa63e('0x71')](_0xa63e('0x72'))['from'](_0xa63e('0x73'),'tq')['join'](_0xa63e('0x74'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xa63e('0x3d')]('OpenchannelQueueId\x20=\x20?',_0x11ee8e[_0xa63e('0x47')]['id']);for(var _0x5210ed=0x0;_0x5210ed<_0xf3177d[_0xa63e('0x37')];_0x5210ed+=0x1){let _0x3a97da=_0xf3177d[_0x5210ed];for(var _0xea7b64=0x0;_0xea7b64<_0x3a97da[_0xa63e('0x63')][_0xa63e('0x37')];_0xea7b64+=0x1){let _0x26b801=_0x3a97da['Agents'][_0xea7b64];var _0x49bd62=_0x3d1d85['clone']();_0x49bd62[_0xa63e('0x3d')](_0xa63e('0x75'),_0x26b801['id']);_0x2fd3e0[_0xa63e('0x76')](db[_0xa63e('0x67')][_0xa63e('0x31')](_0x49bd62[_0xa63e('0x77')](),{'type':db['sequelize'][_0xa63e('0x78')]['SELECT']})[_0xa63e('0x24')](function(_0x5331b6){if(_0x5331b6['length']===0x1){return _0x26b801['id'];}else{var _0x25ad47=_[_0xa63e('0x79')](_[_0xa63e('0x2c')](_0x5331b6,_0xa63e('0x7a')),function(_0x15a4c6){return _[_0xa63e('0x7b')](_0x6a9e89,_0x15a4c6);});if(_0x25ad47){return _0x26b801['id'];}}}));}}return BPromise['all'](_0x2fd3e0)['then'](function(_0x280962){_0x3cc798=_(_0x3cc798)[_0xa63e('0x7c')](_0x280962)[_0xa63e('0x7d')]()['value']();return db[_0xa63e('0x42')][_0xa63e('0x49')]({'where':{'id':_0x11ee8e[_0xa63e('0x47')]['id']}})[_0xa63e('0x24')](function(_0x3fb16a){return db[_0xa63e('0x67')][_0xa63e('0x68')](function(_0xa79ea7){return _0x3fb16a[_0xa63e('0x6f')](_0x11ee8e[_0xa63e('0x31')][_0xa63e('0x62')],{'transaction':_0xa79ea7})['then'](function(){if(!_[_0xa63e('0x7e')](_0x3cc798)){return _0x3fb16a[_0xa63e('0x7f')](_0x3cc798,{'transaction':_0xa79ea7});}})['then'](function(){_0x3cc798[_0xa63e('0x6c')](function(_0x344acd){socket['emit'](_0xa63e('0x80'),{'UserId':_0x344acd,'OpenchannelQueueId':_0x3fb16a['id']});});});});});});})[_0xa63e('0x24')](respondWithStatusCode(_0x5b7b54,null))[_0xa63e('0x45')](handleError(_0x5b7b54,null));};exports[_0xa63e('0x81')]=function(_0x4e3dfc,_0x1d4041,_0xd63c25){return db[_0xa63e('0x42')][_0xa63e('0x49')]({'where':{'id':_0x4e3dfc[_0xa63e('0x47')]['id']}})[_0xa63e('0x24')](handleEntityNotFound(_0x1d4041,null))['then'](function(_0x89c58c){if(_0x89c58c){return _0x89c58c['addAgents'](_0x4e3dfc['body']['ids'],_[_0xa63e('0x82')](_0x4e3dfc[_0xa63e('0x51')],['ids','id'])||{})['spread'](function(_0x523a61){for(var _0x5bb820=0x0;_0x5bb820<_0x4e3dfc[_0xa63e('0x51')][_0xa63e('0x62')][_0xa63e('0x37')];_0x5bb820+=0x1){socket['emit'](_0xa63e('0x6e'),{'UserId':_0x4e3dfc[_0xa63e('0x51')][_0xa63e('0x62')][_0x5bb820],'OpenchannelQueueId':_0x4e3dfc['params']['id']});}return _0x523a61;});}})[_0xa63e('0x24')](respondWithResult(_0x1d4041,null))[_0xa63e('0x45')](handleError(_0x1d4041,null));};exports[_0xa63e('0x7f')]=function(_0x306144,_0xfdd43a,_0xd1125f){return db[_0xa63e('0x42')]['find']({'where':{'id':_0x306144[_0xa63e('0x47')]['id']}})[_0xa63e('0x24')](handleEntityNotFound(_0xfdd43a,null))['then'](function(_0x1b44a9){if(_0x1b44a9){return _0x1b44a9[_0xa63e('0x7f')](_0x306144[_0xa63e('0x31')][_0xa63e('0x62')])[_0xa63e('0x24')](function(){if(_[_0xa63e('0x83')](_0x306144['query'][_0xa63e('0x62')])){for(var _0x29bd80=0x0;_0x29bd80<_0x306144[_0xa63e('0x31')][_0xa63e('0x62')]['length'];_0x29bd80+=0x1){socket[_0xa63e('0x6d')](_0xa63e('0x80'),{'UserId':Number(_0x306144[_0xa63e('0x31')][_0xa63e('0x62')][_0x29bd80]),'OpenchannelQueueId':Number(_0x306144[_0xa63e('0x47')]['id'])});}}else{socket[_0xa63e('0x6d')](_0xa63e('0x80'),{'UserId':Number(_0x306144[_0xa63e('0x31')][_0xa63e('0x62')]),'OpenchannelQueueId':Number(_0x306144[_0xa63e('0x47')]['id'])});}});}})[_0xa63e('0x24')](respondWithStatusCode(_0xfdd43a,null))[_0xa63e('0x45')](handleError(_0xfdd43a,null));};exports[_0xa63e('0x84')]=function(_0x224798,_0x3dc58d,_0x4ee931){var _0x2d9cff={};var _0x15c969={};var _0x4141ca;var _0x47b23b;return db[_0xa63e('0x42')]['findOne']({'where':{'id':_0x224798[_0xa63e('0x47')]['id']}})[_0xa63e('0x24')](handleEntityNotFound(_0x3dc58d,null))[_0xa63e('0x24')](function(_0x4bd6a8){if(_0x4bd6a8){_0x4141ca=_0x4bd6a8;_0x15c969['model']=_['keys'](db[_0xa63e('0x59')][_0xa63e('0x2d')]);_0x15c969[_0xa63e('0x31')]=_[_0xa63e('0x32')](_0x224798[_0xa63e('0x31')]);_0x15c969[_0xa63e('0x33')]=_[_0xa63e('0x34')](_0x15c969[_0xa63e('0x30')],_0x15c969['query']);_0x2d9cff[_0xa63e('0x35')]=_[_0xa63e('0x34')](_0x15c969[_0xa63e('0x30')],qs['fields'](_0x224798[_0xa63e('0x31')]['fields']));_0x2d9cff[_0xa63e('0x35')]=_0x2d9cff['attributes'][_0xa63e('0x37')]?_0x2d9cff[_0xa63e('0x35')]:_0x15c969['model'];_0x2d9cff[_0xa63e('0x3b')]=qs[_0xa63e('0x3c')](_0x224798[_0xa63e('0x31')][_0xa63e('0x3c')]);_0x2d9cff[_0xa63e('0x3d')]=qs['filters'](_[_0xa63e('0x3e')](_0x224798[_0xa63e('0x31')],_0x15c969[_0xa63e('0x33')]));if(_0x224798['query'][_0xa63e('0x3f')]){_0x2d9cff[_0xa63e('0x3d')]=_[_0xa63e('0x40')](_0x2d9cff['where'],{'$or':_[_0xa63e('0x2c')](_0x2d9cff[_0xa63e('0x35')],function(_0x12bf54){var _0x1e4b85={};_0x1e4b85[_0x12bf54]={'$like':'%'+_0x224798[_0xa63e('0x31')][_0xa63e('0x3f')]+'%'};return _0x1e4b85;})});}_0x2d9cff=_[_0xa63e('0x40')]({},_0x2d9cff,_0x224798[_0xa63e('0x48')]);return _0x4141ca['getAgents'](_0x2d9cff);}})['then'](function(_0x5642ef){if(_0x5642ef){_0x47b23b=_0x5642ef[_0xa63e('0x37')];if(!_0x224798[_0xa63e('0x31')][_0xa63e('0x38')](_0xa63e('0x39'))){_0x2d9cff[_0xa63e('0x3a')]=qs[_0xa63e('0x3a')](_0x224798[_0xa63e('0x31')][_0xa63e('0x3a')]);_0x2d9cff[_0xa63e('0x1d')]=qs['offset'](_0x224798[_0xa63e('0x31')][_0xa63e('0x1d')]);}return _0x4141ca[_0xa63e('0x84')](_0x2d9cff);}})[_0xa63e('0x24')](function(_0x532a89){if(_0x532a89){return _0x532a89?{'count':_0x47b23b,'rows':_0x532a89}:null;}})[_0xa63e('0x24')](respondWithResult(_0x3dc58d,null))[_0xa63e('0x45')](handleError(_0x3dc58d,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index 91e8705..903a0ba 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 _0x5772=['events','../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x4b325f,_0x41a245){var _0x4ef000=function(_0x3b84c0){while(--_0x3b84c0){_0x4b325f['push'](_0x4b325f['shift']());}};_0x4ef000(++_0x41a245);}(_0x5772,0xd2));var _0x2577=function(_0x36dfbd,_0x5bfe2d){_0x36dfbd=_0x36dfbd-0x0;var _0x4ecad9=_0x5772[_0x36dfbd];return _0x4ecad9;};'use strict';var EventEmitter=require(_0x2577('0x0'));var OpenchannelQueue=require(_0x2577('0x1'))['db']['OpenchannelQueue'];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x2577('0x2')](0x0);var events={'afterCreate':_0x2577('0x3'),'afterUpdate':_0x2577('0x4'),'afterDestroy':_0x2577('0x5')};function emitEvent(_0x1bdf7f){return function(_0xe11d7a,_0xb357c6,_0x1048cc){OpenchannelQueueEvents['emit'](_0x1bdf7f+':'+_0xe11d7a['id'],_0xe11d7a);OpenchannelQueueEvents[_0x2577('0x6')](_0x1bdf7f,_0xe11d7a);_0x1048cc(null);};}for(var e in events){if(events[_0x2577('0x7')](e)){var event=events[e];OpenchannelQueue[_0x2577('0x8')](e,emitEvent(event));}}module[_0x2577('0x9')]=OpenchannelQueueEvents; \ No newline at end of file +var _0x7ebd=['hook','exports','../../mysqldb','OpenchannelQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x117994,_0x46bbbb){var _0x40814a=function(_0x5e88ca){while(--_0x5e88ca){_0x117994['push'](_0x117994['shift']());}};_0x40814a(++_0x46bbbb);}(_0x7ebd,0x106));var _0xd7eb=function(_0x3bc43e,_0x423b0b){_0x3bc43e=_0x3bc43e-0x0;var _0x4f065b=_0x7ebd[_0x3bc43e];return _0x4f065b;};'use strict';var EventEmitter=require('events');var OpenchannelQueue=require(_0xd7eb('0x0'))['db'][_0xd7eb('0x1')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0xd7eb('0x2')](0x0);var events={'afterCreate':_0xd7eb('0x3'),'afterUpdate':_0xd7eb('0x4'),'afterDestroy':_0xd7eb('0x5')};function emitEvent(_0x4b1e98){return function(_0x3e6dcd,_0x2a77c5,_0x18add1){OpenchannelQueueEvents[_0xd7eb('0x6')](_0x4b1e98+':'+_0x3e6dcd['id'],_0x3e6dcd);OpenchannelQueueEvents['emit'](_0x4b1e98,_0x3e6dcd);_0x18add1(null);};}for(var e in events){if(events[_0xd7eb('0x7')](e)){var event=events[e];OpenchannelQueue[_0xd7eb('0x8')](e,emitEvent(event));}}module[_0xd7eb('0x9')]=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index 639209a..4a260aa 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 _0x7920=['../../config/environment','./openchannelQueue.attributes','exports','OpenchannelQueue','openchannel_queues','lodash','util','../../config/logger','api','bluebird','path','rimraf'];(function(_0x54b8fe,_0x22e2b8){var _0x25f445=function(_0x4a63fb){while(--_0x4a63fb){_0x54b8fe['push'](_0x54b8fe['shift']());}};_0x25f445(++_0x22e2b8);}(_0x7920,0xd1));var _0x0792=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x7920[_0x4cf98e];return _0x1623ac;};'use strict';var _=require(_0x0792('0x0'));var util=require(_0x0792('0x1'));var logger=require(_0x0792('0x2'))(_0x0792('0x3'));var moment=require('moment');var BPromise=require(_0x0792('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0792('0x5'));var rimraf=require(_0x0792('0x6'));var config=require(_0x0792('0x7'));var attributes=require(_0x0792('0x8'));module[_0x0792('0x9')]=function(_0x2018a2,_0x3047de){return _0x2018a2['define'](_0x0792('0xa'),attributes,{'tableName':_0x0792('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x46bb=['../../config/environment','exports','define','OpenchannelQueue','openchannel_queues','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x205eb0,_0x3b4644){var _0x55d7e9=function(_0x5796cf){while(--_0x5796cf){_0x205eb0['push'](_0x205eb0['shift']());}};_0x55d7e9(++_0x3b4644);}(_0x46bb,0x119));var _0xb46b=function(_0x2d6d88,_0x2ea070){_0x2d6d88=_0x2d6d88-0x0;var _0x1991b0=_0x46bb[_0x2d6d88];return _0x1991b0;};'use strict';var _=require('lodash');var util=require(_0xb46b('0x0'));var logger=require(_0xb46b('0x1'))(_0xb46b('0x2'));var moment=require(_0xb46b('0x3'));var BPromise=require(_0xb46b('0x4'));var rp=require(_0xb46b('0x5'));var fs=require('fs');var path=require(_0xb46b('0x6'));var rimraf=require('rimraf');var config=require(_0xb46b('0x7'));var attributes=require('./openchannelQueue.attributes');module[_0xb46b('0x8')]=function(_0xf11d25,_0x58d4f8){return _0xf11d25[_0xb46b('0x9')](_0xb46b('0xa'),attributes,{'tableName':_0xb46b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.rpc.js b/server/api/openchannelQueue/openchannelQueue.rpc.js index e73c0ef..2b6c36e 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 _0x3028=['then','info','request\x20sent','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','OpenchannelQueue,\x20%s,\x20%s','result','catch','OpenchannelQueue','options','raw','where','attributes','limit','include','model','map','GetOpenchannelQueue','ShowOpenchannelQueue','debug','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','request'];(function(_0x725554,_0x2f0314){var _0x2ee64b=function(_0x1495e2){while(--_0x1495e2){_0x725554['push'](_0x725554['shift']());}};_0x2ee64b(++_0x2f0314);}(_0x3028,0xc3));var _0x8302=function(_0x118482,_0x97ffdd){_0x118482=_0x118482-0x0;var _0x256d43=_0x3028[_0x118482];return _0x256d43;};'use strict';var _=require(_0x8302('0x0'));var util=require(_0x8302('0x1'));var moment=require(_0x8302('0x2'));var BPromise=require('bluebird');var rs=require(_0x8302('0x3'));var fs=require('fs');var Redis=require(_0x8302('0x4'));var db=require(_0x8302('0x5'))['db'];var utils=require(_0x8302('0x6'));var logger=require(_0x8302('0x7'))(_0x8302('0x8'));var config=require(_0x8302('0x9'));var jayson=require(_0x8302('0xa'));var client=jayson[_0x8302('0xb')][_0x8302('0xc')]({'port':0x232a});config[_0x8302('0xd')]=_[_0x8302('0xe')](config[_0x8302('0xd')],{'host':_0x8302('0xf'),'port':0x18eb});var socket=require(_0x8302('0x10'))(new Redis(config[_0x8302('0xd')]));require(_0x8302('0x11'))[_0x8302('0x12')](socket);function respondWithRpcPromise(_0x1c3aee,_0x5e7dcd,_0x476069){return new BPromise(function(_0x453a42,_0x4fa53d){return client[_0x8302('0x13')](_0x1c3aee,_0x476069)[_0x8302('0x14')](function(_0x1666a6){logger[_0x8302('0x15')]('OpenchannelQueue,\x20%s,\x20%s',_0x5e7dcd,_0x8302('0x16'));logger['debug'](_0x8302('0x17'),_0x5e7dcd,_0x8302('0x16'),JSON[_0x8302('0x18')](_0x1666a6));if(_0x1666a6[_0x8302('0x19')]){if(_0x1666a6[_0x8302('0x19')][_0x8302('0x1a')]===0x1f4){logger['error']('OpenchannelQueue,\x20%s,\x20%s',_0x5e7dcd,_0x1666a6[_0x8302('0x19')][_0x8302('0x1b')]);return _0x4fa53d(_0x1666a6[_0x8302('0x19')][_0x8302('0x1b')]);}logger[_0x8302('0x19')]('OpenchannelQueue,\x20%s,\x20%s',_0x5e7dcd,_0x1666a6[_0x8302('0x19')][_0x8302('0x1b')]);return _0x453a42(_0x1666a6['error'][_0x8302('0x1b')]);}else{logger['info'](_0x8302('0x1c'),_0x5e7dcd,_0x8302('0x16'));_0x453a42(_0x1666a6[_0x8302('0x1d')][_0x8302('0x1b')]);}})[_0x8302('0x1e')](function(_0x435dfb){logger[_0x8302('0x19')](_0x8302('0x1c'),_0x5e7dcd,_0x435dfb);_0x4fa53d(_0x435dfb);});});}exports['GetOpenchannelQueue']=function(_0x101faa){var _0x48b9b5=this;return new Promise(function(_0x45f84a,_0x25ccfc){return db[_0x8302('0x1f')]['findAll']({'raw':_0x101faa[_0x8302('0x20')]?_0x101faa[_0x8302('0x20')][_0x8302('0x21')]===undefined?!![]:![]:!![],'where':_0x101faa[_0x8302('0x20')]?_0x101faa[_0x8302('0x20')][_0x8302('0x22')]||null:null,'attributes':_0x101faa[_0x8302('0x20')]?_0x101faa[_0x8302('0x20')][_0x8302('0x23')]||null:null,'limit':_0x101faa[_0x8302('0x20')]?_0x101faa[_0x8302('0x20')][_0x8302('0x24')]||null:null,'include':_0x101faa['options']?_0x101faa[_0x8302('0x20')][_0x8302('0x25')]?_['map'](_0x101faa[_0x8302('0x20')][_0x8302('0x25')],function(_0x4a1bb1){return{'model':db[_0x4a1bb1[_0x8302('0x26')]],'as':_0x4a1bb1['as'],'attributes':_0x4a1bb1[_0x8302('0x23')],'include':_0x4a1bb1[_0x8302('0x25')]?_[_0x8302('0x27')](_0x4a1bb1['include'],function(_0x14d018){return{'model':db[_0x14d018[_0x8302('0x26')]],'as':_0x14d018['as'],'attributes':_0x14d018['attributes'],'include':_0x14d018[_0x8302('0x25')]?_[_0x8302('0x27')](_0x14d018[_0x8302('0x25')],function(_0x86e3f2){return{'model':db[_0x86e3f2[_0x8302('0x26')]],'as':_0x86e3f2['as'],'attributes':_0x86e3f2[_0x8302('0x23')]};}):[]};}):[]};}):[]:[]})[_0x8302('0x14')](function(_0x1affc1){logger[_0x8302('0x15')](_0x8302('0x28'),_0x101faa);logger['debug'](_0x8302('0x28'),_0x101faa,JSON[_0x8302('0x18')](_0x1affc1));_0x45f84a(_0x1affc1);})[_0x8302('0x1e')](function(_0x261514){logger[_0x8302('0x19')]('GetOpenchannelQueue',_0x261514[_0x8302('0x1b')],_0x101faa);_0x25ccfc(_0x48b9b5['error'](0x1f4,_0x261514[_0x8302('0x1b')]));});});};exports[_0x8302('0x29')]=function(_0x35ed40){var _0xbd143d=this;return new Promise(function(_0x36aa0c,_0x55223b){return db[_0x8302('0x1f')]['find']({'raw':_0x35ed40['options']?_0x35ed40[_0x8302('0x20')]['raw']===undefined?!![]:![]:!![],'where':_0x35ed40['options']?_0x35ed40[_0x8302('0x20')]['where']||null:null,'attributes':_0x35ed40[_0x8302('0x20')]?_0x35ed40[_0x8302('0x20')][_0x8302('0x23')]||null:null,'include':_0x35ed40['options']?_0x35ed40[_0x8302('0x20')][_0x8302('0x25')]?_[_0x8302('0x27')](_0x35ed40[_0x8302('0x20')][_0x8302('0x25')],function(_0x29ab89){return{'model':db[_0x29ab89[_0x8302('0x26')]],'as':_0x29ab89['as'],'attributes':_0x29ab89[_0x8302('0x23')],'include':_0x29ab89[_0x8302('0x25')]?_[_0x8302('0x27')](_0x29ab89['include'],function(_0xa22c8c){return{'model':db[_0xa22c8c['model']],'as':_0xa22c8c['as'],'attributes':_0xa22c8c[_0x8302('0x23')],'include':_0xa22c8c[_0x8302('0x25')]?_[_0x8302('0x27')](_0xa22c8c[_0x8302('0x25')],function(_0x4456b6){return{'model':db[_0x4456b6[_0x8302('0x26')]],'as':_0x4456b6['as'],'attributes':_0x4456b6[_0x8302('0x23')]};}):[]};}):[]};}):[]:[]})[_0x8302('0x14')](function(_0x14b431){logger['info']('ShowOpenchannelQueue',_0x35ed40);logger[_0x8302('0x2a')]('ShowOpenchannelQueue',_0x35ed40,JSON[_0x8302('0x18')](_0x14b431));_0x36aa0c(_0x14b431);})[_0x8302('0x1e')](function(_0x5bee47){logger['error'](_0x8302('0x29'),_0x5bee47[_0x8302('0x1b')],_0x35ed40);_0x55223b(_0xbd143d['error'](0x1f4,_0x5bee47[_0x8302('0x1b')]));});});}; \ No newline at end of file +var _0xf8ea=['options','raw','where','attributes','include','map','model','stringify','ShowOpenchannelQueue','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','register','then','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','catch','GetOpenchannelQueue','OpenchannelQueue','findAll'];(function(_0x5691c9,_0x265830){var _0x2af9b0=function(_0xb2dd43){while(--_0xb2dd43){_0x5691c9['push'](_0x5691c9['shift']());}};_0x2af9b0(++_0x265830);}(_0xf8ea,0x1dd));var _0xaf8e=function(_0x28b559,_0xd7b0dd){_0x28b559=_0x28b559-0x0;var _0x25ec26=_0xf8ea[_0x28b559];return _0x25ec26;};'use strict';var _=require(_0xaf8e('0x0'));var util=require(_0xaf8e('0x1'));var moment=require(_0xaf8e('0x2'));var BPromise=require(_0xaf8e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xaf8e('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xaf8e('0x5'))('rpc');var config=require(_0xaf8e('0x6'));var jayson=require(_0xaf8e('0x7'));var client=jayson[_0xaf8e('0x8')][_0xaf8e('0x9')]({'port':0x232a});config[_0xaf8e('0xa')]=_['defaults'](config[_0xaf8e('0xa')],{'host':_0xaf8e('0xb'),'port':0x18eb});var socket=require(_0xaf8e('0xc'))(new Redis(config['redis']));require('./openchannelQueue.socket')[_0xaf8e('0xd')](socket);function respondWithRpcPromise(_0x11a989,_0x48e0f9,_0x12f579){return new BPromise(function(_0xf2285b,_0x3a9368){return client['request'](_0x11a989,_0x12f579)[_0xaf8e('0xe')](function(_0x2d5cf2){logger['info'](_0xaf8e('0xf'),_0x48e0f9,_0xaf8e('0x10'));logger[_0xaf8e('0x11')]('OpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x48e0f9,'request\x20sent',JSON['stringify'](_0x2d5cf2));if(_0x2d5cf2[_0xaf8e('0x12')]){if(_0x2d5cf2['error'][_0xaf8e('0x13')]===0x1f4){logger[_0xaf8e('0x12')](_0xaf8e('0xf'),_0x48e0f9,_0x2d5cf2[_0xaf8e('0x12')][_0xaf8e('0x14')]);return _0x3a9368(_0x2d5cf2[_0xaf8e('0x12')]['message']);}logger[_0xaf8e('0x12')](_0xaf8e('0xf'),_0x48e0f9,_0x2d5cf2[_0xaf8e('0x12')][_0xaf8e('0x14')]);return _0xf2285b(_0x2d5cf2[_0xaf8e('0x12')][_0xaf8e('0x14')]);}else{logger[_0xaf8e('0x15')](_0xaf8e('0xf'),_0x48e0f9,'request\x20sent');_0xf2285b(_0x2d5cf2[_0xaf8e('0x16')]['message']);}})[_0xaf8e('0x17')](function(_0x437c17){logger[_0xaf8e('0x12')](_0xaf8e('0xf'),_0x48e0f9,_0x437c17);_0x3a9368(_0x437c17);});});}exports[_0xaf8e('0x18')]=function(_0x4473b3){var _0x1d90ec=this;return new Promise(function(_0x3348c9,_0x450daa){return db[_0xaf8e('0x19')][_0xaf8e('0x1a')]({'raw':_0x4473b3[_0xaf8e('0x1b')]?_0x4473b3[_0xaf8e('0x1b')][_0xaf8e('0x1c')]===undefined?!![]:![]:!![],'where':_0x4473b3[_0xaf8e('0x1b')]?_0x4473b3[_0xaf8e('0x1b')][_0xaf8e('0x1d')]||null:null,'attributes':_0x4473b3['options']?_0x4473b3['options'][_0xaf8e('0x1e')]||null:null,'limit':_0x4473b3[_0xaf8e('0x1b')]?_0x4473b3[_0xaf8e('0x1b')]['limit']||null:null,'include':_0x4473b3[_0xaf8e('0x1b')]?_0x4473b3['options'][_0xaf8e('0x1f')]?_[_0xaf8e('0x20')](_0x4473b3[_0xaf8e('0x1b')][_0xaf8e('0x1f')],function(_0x1a67e7){return{'model':db[_0x1a67e7[_0xaf8e('0x21')]],'as':_0x1a67e7['as'],'attributes':_0x1a67e7[_0xaf8e('0x1e')],'include':_0x1a67e7['include']?_[_0xaf8e('0x20')](_0x1a67e7['include'],function(_0xf3cccd){return{'model':db[_0xf3cccd[_0xaf8e('0x21')]],'as':_0xf3cccd['as'],'attributes':_0xf3cccd[_0xaf8e('0x1e')],'include':_0xf3cccd['include']?_[_0xaf8e('0x20')](_0xf3cccd[_0xaf8e('0x1f')],function(_0x58958b){return{'model':db[_0x58958b[_0xaf8e('0x21')]],'as':_0x58958b['as'],'attributes':_0x58958b[_0xaf8e('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2971f0){logger['info'](_0xaf8e('0x18'),_0x4473b3);logger['debug'](_0xaf8e('0x18'),_0x4473b3,JSON[_0xaf8e('0x22')](_0x2971f0));_0x3348c9(_0x2971f0);})[_0xaf8e('0x17')](function(_0x2ab352){logger['error']('GetOpenchannelQueue',_0x2ab352[_0xaf8e('0x14')],_0x4473b3);_0x450daa(_0x1d90ec[_0xaf8e('0x12')](0x1f4,_0x2ab352[_0xaf8e('0x14')]));});});};exports[_0xaf8e('0x23')]=function(_0x4e459e){var _0x5b27eb=this;return new Promise(function(_0x1fe9f7,_0x91dd5b){return db['OpenchannelQueue']['find']({'raw':_0x4e459e[_0xaf8e('0x1b')]?_0x4e459e[_0xaf8e('0x1b')][_0xaf8e('0x1c')]===undefined?!![]:![]:!![],'where':_0x4e459e['options']?_0x4e459e['options'][_0xaf8e('0x1d')]||null:null,'attributes':_0x4e459e[_0xaf8e('0x1b')]?_0x4e459e[_0xaf8e('0x1b')][_0xaf8e('0x1e')]||null:null,'include':_0x4e459e[_0xaf8e('0x1b')]?_0x4e459e[_0xaf8e('0x1b')][_0xaf8e('0x1f')]?_[_0xaf8e('0x20')](_0x4e459e['options'][_0xaf8e('0x1f')],function(_0x29017c){return{'model':db[_0x29017c[_0xaf8e('0x21')]],'as':_0x29017c['as'],'attributes':_0x29017c[_0xaf8e('0x1e')],'include':_0x29017c['include']?_[_0xaf8e('0x20')](_0x29017c['include'],function(_0x4d4a9d){return{'model':db[_0x4d4a9d[_0xaf8e('0x21')]],'as':_0x4d4a9d['as'],'attributes':_0x4d4a9d[_0xaf8e('0x1e')],'include':_0x4d4a9d['include']?_[_0xaf8e('0x20')](_0x4d4a9d[_0xaf8e('0x1f')],function(_0x3f3858){return{'model':db[_0x3f3858[_0xaf8e('0x21')]],'as':_0x3f3858['as'],'attributes':_0x3f3858[_0xaf8e('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xaf8e('0xe')](function(_0x2450a2){logger[_0xaf8e('0x15')]('ShowOpenchannelQueue',_0x4e459e);logger['debug'](_0xaf8e('0x23'),_0x4e459e,JSON[_0xaf8e('0x22')](_0x2450a2));_0x1fe9f7(_0x2450a2);})[_0xaf8e('0x17')](function(_0x40d3db){logger[_0xaf8e('0x12')](_0xaf8e('0x23'),_0x40d3db['message'],_0x4e459e);_0x91dd5b(_0x5b27eb['error'](0x1f4,_0x40d3db[_0xaf8e('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index 02e1060..938771c 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 _0x6fd7=['emit','removeListener','register','length','openchannelQueue:','./openchannelQueue.events','save','update'];(function(_0x1fd1cf,_0x7a08e6){var _0x2db6e6=function(_0x1c7200){while(--_0x1c7200){_0x1fd1cf['push'](_0x1fd1cf['shift']());}};_0x2db6e6(++_0x7a08e6);}(_0x6fd7,0xe5));var _0x76fd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6fd7[_0x3dd15e];return _0x231fd0;};'use strict';var OpenchannelQueueEvents=require(_0x76fd('0x0'));var events=[_0x76fd('0x1'),'remove',_0x76fd('0x2')];function createListener(_0x52be56,_0x2fe805){return function(_0x2fc7e6){_0x2fe805[_0x76fd('0x3')](_0x52be56,_0x2fc7e6);};}function removeListener(_0x47fae9,_0x16b8b6){return function(){OpenchannelQueueEvents[_0x76fd('0x4')](_0x47fae9,_0x16b8b6);};}exports[_0x76fd('0x5')]=function(_0x3e3584){for(var _0x2e154c=0x0,_0x47ddb6=events[_0x76fd('0x6')];_0x2e154c<_0x47ddb6;_0x2e154c++){var _0x287404=events[_0x2e154c];var _0x18fc93=createListener(_0x76fd('0x7')+_0x287404,_0x3e3584);OpenchannelQueueEvents['on'](_0x287404,_0x18fc93);}}; \ No newline at end of file +var _0x3615=['removeListener','register','openchannelQueue:','./openchannelQueue.events','save','remove','emit'];(function(_0x3f7395,_0x29ba55){var _0x18e30d=function(_0x43226c){while(--_0x43226c){_0x3f7395['push'](_0x3f7395['shift']());}};_0x18e30d(++_0x29ba55);}(_0x3615,0x88));var _0x5361=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x3615[_0x2d7f0e];return _0x110b07;};'use strict';var OpenchannelQueueEvents=require(_0x5361('0x0'));var events=[_0x5361('0x1'),_0x5361('0x2'),'update'];function createListener(_0x4b28ab,_0x3fda3a){return function(_0x6e43d8){_0x3fda3a[_0x5361('0x3')](_0x4b28ab,_0x6e43d8);};}function removeListener(_0x534c62,_0x4b16d5){return function(){OpenchannelQueueEvents[_0x5361('0x4')](_0x534c62,_0x4b16d5);};}exports[_0x5361('0x5')]=function(_0x399464){for(var _0x2104ad=0x0,_0x609a50=events['length'];_0x2104ad<_0x609a50;_0x2104ad++){var _0x1dd327=events[_0x2104ad];var _0x5d4538=createListener(_0x5361('0x6')+_0x1dd327,_0x399464);OpenchannelQueueEvents['on'](_0x1dd327,_0x5d4538);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index 115c25d..19b910a 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 _0xb047=['../../components/interaction/service','../../config/environment','index','/describe','isAuthenticated','describe','get','show','post','put','delete','/:id','destroy','exports','multer','path','connect-timeout','express','fs-extra'];(function(_0x3b97ae,_0x41fabf){var _0x5c894e=function(_0x267128){while(--_0x267128){_0x3b97ae['push'](_0x3b97ae['shift']());}};_0x5c894e(++_0x41fabf);}(_0xb047,0x80));var _0x7b04=function(_0x2bb067,_0x30dcb9){_0x2bb067=_0x2bb067-0x0;var _0x65d9a3=_0xb047[_0x2bb067];return _0x65d9a3;};'use strict';var multer=require(_0x7b04('0x0'));var util=require('util');var path=require(_0x7b04('0x1'));var timeout=require(_0x7b04('0x2'));var express=require(_0x7b04('0x3'));var router=express['Router']();var fs_extra=require(_0x7b04('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x7b04('0x5'));var config=require(_0x7b04('0x6'));var controller=require('./openchannelQueueReport.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x7b04('0x7')]);router['get'](_0x7b04('0x8'),auth[_0x7b04('0x9')](),controller[_0x7b04('0xa')]);router[_0x7b04('0xb')]('/:id',auth[_0x7b04('0x9')](),controller[_0x7b04('0xc')]);router[_0x7b04('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x7b04('0xe')]('/:id',auth[_0x7b04('0x9')](),controller['update']);router[_0x7b04('0xf')](_0x7b04('0x10'),auth['isAuthenticated'](),controller[_0x7b04('0x11')]);module[_0x7b04('0x12')]=router; \ No newline at end of file +var _0xa02f=['../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','create','put','update','delete','multer','util','path','connect-timeout','Router','fs-extra'];(function(_0x1189b1,_0x4ed101){var _0x3bfba4=function(_0x4c75e7){while(--_0x4c75e7){_0x1189b1['push'](_0x1189b1['shift']());}};_0x3bfba4(++_0x4ed101);}(_0xa02f,0x1f2));var _0xfa02=function(_0x4134ff,_0x13867c){_0x4134ff=_0x4134ff-0x0;var _0x4f9b88=_0xa02f[_0x4134ff];return _0x4f9b88;};'use strict';var multer=require(_0xfa02('0x0'));var util=require(_0xfa02('0x1'));var path=require(_0xfa02('0x2'));var timeout=require(_0xfa02('0x3'));var express=require('express');var router=express[_0xfa02('0x4')]();var fs_extra=require(_0xfa02('0x5'));var auth=require(_0xfa02('0x6'));var interaction=require(_0xfa02('0x7'));var config=require(_0xfa02('0x8'));var controller=require(_0xfa02('0x9'));router[_0xfa02('0xa')]('/',auth[_0xfa02('0xb')](),controller[_0xfa02('0xc')]);router[_0xfa02('0xa')](_0xfa02('0xd'),auth[_0xfa02('0xb')](),controller[_0xfa02('0xe')]);router[_0xfa02('0xa')](_0xfa02('0xf'),auth[_0xfa02('0xb')](),controller[_0xfa02('0x10')]);router['post']('/',auth[_0xfa02('0xb')](),controller[_0xfa02('0x11')]);router[_0xfa02('0x12')](_0xfa02('0xf'),auth[_0xfa02('0xb')](),controller[_0xfa02('0x13')]);router[_0xfa02('0x14')](_0xfa02('0xf'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index 0cdee36..1749ce1 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 _0xc248=['STRING','DATE','moment'];(function(_0x15d203,_0x5b93ba){var _0x350cf6=function(_0x32335b){while(--_0x32335b){_0x15d203['push'](_0x15d203['shift']());}};_0x350cf6(++_0x5b93ba);}(_0xc248,0xe6));var _0x8c24=function(_0x70cb68,_0x655078){_0x70cb68=_0x70cb68-0x0;var _0x7a453c=_0xc248[_0x70cb68];return _0x7a453c;};'use strict';var moment=require(_0x8c24('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x8c24('0x1')]},'joinAt':{'type':Sequelize[_0x8c24('0x2')]},'leaveAt':{'type':Sequelize[_0x8c24('0x2')]},'acceptAt':{'type':Sequelize[_0x8c24('0x2')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x5209=['STRING','exports','DATE'];(function(_0x50e7db,_0x1c1bba){var _0x4cdec7=function(_0x4d736d){while(--_0x4d736d){_0x50e7db['push'](_0x50e7db['shift']());}};_0x4cdec7(++_0x1c1bba);}(_0x5209,0x163));var _0x9520=function(_0x689e16,_0x176daf){_0x689e16=_0x689e16-0x0;var _0xf6f855=_0x5209[_0x689e16];return _0xf6f855;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x9520('0x0')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x9520('0x1')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x9520('0x1')]},'exitAt':{'type':Sequelize[_0x9520('0x1')]},'reason':{'type':Sequelize[_0x9520('0x2')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index b6ebdd0..9430df4 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 _0xd299=['rows','show','params','rawAttributes','find','create','body','catch','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','map','OpenchannelQueueReport','fieldName','type','key','query','keys','filters','attributes','intersection','model','fields','length','hasOwnProperty','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll'];(function(_0x51d129,_0x175d7d){var _0x44c377=function(_0x5ee454){while(--_0x5ee454){_0x51d129['push'](_0x51d129['shift']());}};_0x44c377(++_0x175d7d);}(_0xd299,0x9d));var _0x9d29=function(_0x3c7f4a,_0x4237b1){_0x3c7f4a=_0x3c7f4a-0x0;var _0x414268=_0xd299[_0x3c7f4a];return _0x414268;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9d29('0x0'));var zipdir=require(_0x9d29('0x1'));var jsonpatch=require(_0x9d29('0x2'));var rp=require(_0x9d29('0x3'));var moment=require(_0x9d29('0x4'));var BPromise=require(_0x9d29('0x5'));var Mustache=require('mustache');var util=require(_0x9d29('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x9d29('0x7'));var ejs=require(_0x9d29('0x8'));var fs=require('fs');var fs_extra=require(_0x9d29('0x9'));var _=require(_0x9d29('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x9d29('0xb'));var deskjs=require(_0x9d29('0xc'));var toCsv=require('to-csv');var querystring=require(_0x9d29('0xd'));var Papa=require(_0x9d29('0xe'));var Redis=require(_0x9d29('0xf'));var authService=require(_0x9d29('0x10'));var qs=require(_0x9d29('0x11'));var as=require(_0x9d29('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x9d29('0x13'));var licenseUtil=require(_0x9d29('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x48110f,_0x2ff0c8){_0x2ff0c8=_0x2ff0c8||0xcc;return function(_0x9bca4e){if(_0x9bca4e){return _0x48110f[_0x9d29('0x15')](_0x2ff0c8);}return _0x48110f[_0x9d29('0x16')](_0x2ff0c8)[_0x9d29('0x17')]();};}function respondWithResult(_0x24ad25,_0x4524e4){_0x4524e4=_0x4524e4||0xc8;return function(_0x4879a3){if(_0x4879a3){return _0x24ad25['status'](_0x4524e4)[_0x9d29('0x18')](_0x4879a3);}};}function respondWithFilteredResult(_0x5bc9ab,_0x2fd629){return function(_0x51d428){if(_0x51d428){var _0x51cbbf=typeof _0x2fd629[_0x9d29('0x19')]===_0x9d29('0x1a')&&typeof _0x2fd629[_0x9d29('0x1b')]==='undefined';var _0x2883ed=_0x51d428[_0x9d29('0x1c')];var _0x4f0e1f=_0x51cbbf?0x0:_0x2fd629[_0x9d29('0x19')];var _0x45ccb4=_0x51cbbf?_0x51d428[_0x9d29('0x1c')]:_0x2fd629['offset']+_0x2fd629[_0x9d29('0x1b')];var _0x520ef7;if(_0x45ccb4>=_0x2883ed){_0x45ccb4=_0x2883ed;_0x520ef7=0xc8;}else{_0x520ef7=0xce;}_0x5bc9ab[_0x9d29('0x16')](_0x520ef7);return _0x5bc9ab[_0x9d29('0x1d')](_0x9d29('0x1e'),_0x4f0e1f+'-'+_0x45ccb4+'/'+_0x2883ed)['json'](_0x51d428);}return null;};}function patchUpdates(_0xe12d9c){return function(_0x57cb99){try{jsonpatch[_0x9d29('0x1f')](_0x57cb99,_0xe12d9c,!![]);}catch(_0x58789d){return BPromise[_0x9d29('0x20')](_0x58789d);}return _0x57cb99[_0x9d29('0x21')]();};}function saveUpdates(_0x586f14,_0x3d3f57){return function(_0x6b7d59){if(_0x6b7d59){return _0x6b7d59[_0x9d29('0x22')](_0x586f14)[_0x9d29('0x23')](function(_0x42805e){return _0x42805e;});}return null;};}function removeEntity(_0x1124e1,_0x4b14b7){return function(_0x41699d){if(_0x41699d){return _0x41699d[_0x9d29('0x24')]()[_0x9d29('0x23')](function(){_0x1124e1[_0x9d29('0x16')](0xcc)[_0x9d29('0x17')]();});}};}function handleEntityNotFound(_0x1a127f,_0x13ab64){return function(_0x4cf007){if(!_0x4cf007){_0x1a127f[_0x9d29('0x15')](0x194);}return _0x4cf007;};}function handleError(_0x10a717,_0x30d791){_0x30d791=_0x30d791||0x1f4;return function(_0x176fcb){logger[_0x9d29('0x25')](_0x176fcb['stack']);if(_0x176fcb[_0x9d29('0x26')]){delete _0x176fcb[_0x9d29('0x26')];}_0x10a717[_0x9d29('0x16')](_0x30d791)[_0x9d29('0x27')](_0x176fcb);};}exports[_0x9d29('0x28')]=function(_0x37e9b8,_0xccbd00){var _0x24447e={},_0x1515a0={},_0x223972={'count':0x0,'rows':[]};var _0x57187d=_[_0x9d29('0x29')](db[_0x9d29('0x2a')]['rawAttributes'],function(_0x209b7f){return{'name':_0x209b7f[_0x9d29('0x2b')],'type':_0x209b7f[_0x9d29('0x2c')][_0x9d29('0x2d')]};});_0x1515a0['model']=_[_0x9d29('0x29')](_0x57187d,'name');_0x1515a0[_0x9d29('0x2e')]=_[_0x9d29('0x2f')](_0x37e9b8[_0x9d29('0x2e')]);_0x1515a0[_0x9d29('0x30')]=_['intersection'](_0x1515a0['model'],_0x1515a0[_0x9d29('0x2e')]);_0x24447e[_0x9d29('0x31')]=_[_0x9d29('0x32')](_0x1515a0[_0x9d29('0x33')],qs[_0x9d29('0x34')](_0x37e9b8['query'][_0x9d29('0x34')]));_0x24447e[_0x9d29('0x31')]=_0x24447e[_0x9d29('0x31')][_0x9d29('0x35')]?_0x24447e[_0x9d29('0x31')]:_0x1515a0['model'];if(!_0x37e9b8[_0x9d29('0x2e')][_0x9d29('0x36')]('nolimit')){_0x24447e[_0x9d29('0x1b')]=qs[_0x9d29('0x1b')](_0x37e9b8[_0x9d29('0x2e')][_0x9d29('0x1b')]);_0x24447e['offset']=qs[_0x9d29('0x19')](_0x37e9b8[_0x9d29('0x2e')][_0x9d29('0x19')]);}_0x24447e['order']=qs[_0x9d29('0x37')](_0x37e9b8[_0x9d29('0x2e')][_0x9d29('0x37')]);_0x24447e['where']=qs[_0x9d29('0x30')](_[_0x9d29('0x38')](_0x37e9b8['query'],_0x1515a0[_0x9d29('0x30')]),_0x57187d);if(_0x37e9b8[_0x9d29('0x2e')][_0x9d29('0x39')]){_0x24447e[_0x9d29('0x3a')]=_[_0x9d29('0x3b')](_0x24447e[_0x9d29('0x3a')],{'$or':_[_0x9d29('0x29')](_0x57187d,function(_0x2ec1e3){if(_0x2ec1e3['type']!==_0x9d29('0x3c')){var _0x229db6={};_0x229db6[_0x2ec1e3[_0x9d29('0x26')]]={'$like':'%'+_0x37e9b8['query'][_0x9d29('0x39')]+'%'};return _0x229db6;}})});}_0x24447e=_['merge']({},_0x24447e,_0x37e9b8[_0x9d29('0x3d')]);var _0x4c61a5={'where':_0x24447e['where']};return db[_0x9d29('0x2a')]['count'](_0x4c61a5)[_0x9d29('0x23')](function(_0x1dcfd1){_0x223972['count']=_0x1dcfd1;if(_0x37e9b8[_0x9d29('0x2e')][_0x9d29('0x3e')]){_0x24447e[_0x9d29('0x3f')]=[{'all':!![]}];}return db[_0x9d29('0x2a')][_0x9d29('0x40')](_0x24447e);})[_0x9d29('0x23')](function(_0xb75226){_0x223972[_0x9d29('0x41')]=_0xb75226;return _0x223972;})[_0x9d29('0x23')](respondWithFilteredResult(_0xccbd00,_0x24447e))['catch'](handleError(_0xccbd00,null));};exports[_0x9d29('0x42')]=function(_0x58fc4a,_0x2cb159){var _0x5cb9a6={'raw':!![],'where':{'id':_0x58fc4a[_0x9d29('0x43')]['id']}},_0x45991e={};_0x45991e[_0x9d29('0x33')]=_[_0x9d29('0x2f')](db['OpenchannelQueueReport'][_0x9d29('0x44')]);_0x45991e[_0x9d29('0x2e')]=_['keys'](_0x58fc4a['query']);_0x45991e[_0x9d29('0x30')]=_[_0x9d29('0x32')](_0x45991e[_0x9d29('0x33')],_0x45991e['query']);_0x5cb9a6[_0x9d29('0x31')]=_[_0x9d29('0x32')](_0x45991e[_0x9d29('0x33')],qs[_0x9d29('0x34')](_0x58fc4a[_0x9d29('0x2e')]['fields']));_0x5cb9a6[_0x9d29('0x31')]=_0x5cb9a6['attributes']['length']?_0x5cb9a6[_0x9d29('0x31')]:_0x45991e[_0x9d29('0x33')];if(_0x58fc4a['query'][_0x9d29('0x3e')]){_0x5cb9a6['include']=[{'all':!![]}];}_0x5cb9a6=_[_0x9d29('0x3b')]({},_0x5cb9a6,_0x58fc4a[_0x9d29('0x3d')]);return db[_0x9d29('0x2a')][_0x9d29('0x45')](_0x5cb9a6)[_0x9d29('0x23')](handleEntityNotFound(_0x2cb159,null))[_0x9d29('0x23')](respondWithResult(_0x2cb159,null))['catch'](handleError(_0x2cb159,null));};exports[_0x9d29('0x46')]=function(_0x23c31d,_0x4c65b5){return db[_0x9d29('0x2a')]['create'](_0x23c31d['body'],{})[_0x9d29('0x23')](respondWithResult(_0x4c65b5,0xc9))['catch'](handleError(_0x4c65b5,null));};exports[_0x9d29('0x22')]=function(_0x3e6853,_0x1eab55){if(_0x3e6853[_0x9d29('0x47')]['id']){delete _0x3e6853['body']['id'];}return db[_0x9d29('0x2a')]['find']({'where':{'id':_0x3e6853[_0x9d29('0x43')]['id']}})[_0x9d29('0x23')](handleEntityNotFound(_0x1eab55,null))[_0x9d29('0x23')](saveUpdates(_0x3e6853[_0x9d29('0x47')],null))['then'](respondWithResult(_0x1eab55,null))[_0x9d29('0x48')](handleError(_0x1eab55,null));};exports[_0x9d29('0x24')]=function(_0xae22fe,_0x1bbbff){return db[_0x9d29('0x2a')][_0x9d29('0x45')]({'where':{'id':_0xae22fe[_0x9d29('0x43')]['id']}})[_0x9d29('0x23')](handleEntityNotFound(_0x1bbbff,null))[_0x9d29('0x23')](removeEntity(_0x1bbbff,null))['catch'](handleError(_0x1bbbff,null));};exports['describe']=function(_0x364abc,_0x5931d9){return db[_0x9d29('0x2a')][_0x9d29('0x49')]()['then'](respondWithResult(_0x5931d9,null))[_0x9d29('0x48')](handleError(_0x5931d9,null));}; \ No newline at end of file +var _0x8952=['where','pick','filter','options','includeAll','include','findAll','rows','catch','show','params','merge','create','update','body','find','describe','eml-format','zip-dir','fast-json-patch','moment','mustache','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','save','then','destroy','end','error','stack','name','send','index','map','OpenchannelQueueReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort'];(function(_0x36b271,_0x501d3c){var _0xea5a84=function(_0x58f832){while(--_0x58f832){_0x36b271['push'](_0x36b271['shift']());}};_0xea5a84(++_0x501d3c);}(_0x8952,0x145));var _0x2895=function(_0x50212,_0x5a4ceb){_0x50212=_0x50212-0x0;var _0x5866f5=_0x8952[_0x50212];return _0x5866f5;};'use strict';var emlformat=require(_0x2895('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2895('0x1'));var jsonpatch=require(_0x2895('0x2'));var rp=require('request-promise');var moment=require(_0x2895('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x2895('0x4'));var util=require('util');var path=require(_0x2895('0x5'));var sox=require(_0x2895('0x6'));var csv=require(_0x2895('0x7'));var ejs=require(_0x2895('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2895('0x9'));var squel=require('squel');var crypto=require(_0x2895('0xa'));var jsforce=require(_0x2895('0xb'));var deskjs=require(_0x2895('0xc'));var toCsv=require('to-csv');var querystring=require(_0x2895('0xd'));var Papa=require('papaparse');var Redis=require(_0x2895('0xe'));var authService=require(_0x2895('0xf'));var qs=require(_0x2895('0x10'));var as=require(_0x2895('0x11'));var hardwareService=require(_0x2895('0x12'));var logger=require(_0x2895('0x13'))(_0x2895('0x14'));var utils=require(_0x2895('0x15'));var config=require(_0x2895('0x16'));var licenseUtil=require(_0x2895('0x17'));var db=require(_0x2895('0x18'))['db'];function respondWithStatusCode(_0xe4bafa,_0x162935){_0x162935=_0x162935||0xcc;return function(_0x145927){if(_0x145927){return _0xe4bafa[_0x2895('0x19')](_0x162935);}return _0xe4bafa['status'](_0x162935)['end']();};}function respondWithResult(_0x5a7215,_0x88604){_0x88604=_0x88604||0xc8;return function(_0x1642c3){if(_0x1642c3){return _0x5a7215[_0x2895('0x1a')](_0x88604)[_0x2895('0x1b')](_0x1642c3);}};}function respondWithFilteredResult(_0x457bdc,_0x3be66c){return function(_0x4689c8){if(_0x4689c8){var _0x93b572=typeof _0x3be66c[_0x2895('0x1c')]===_0x2895('0x1d')&&typeof _0x3be66c[_0x2895('0x1e')]===_0x2895('0x1d');var _0x2aa8b9=_0x4689c8[_0x2895('0x1f')];var _0x25103d=_0x93b572?0x0:_0x3be66c[_0x2895('0x1c')];var _0x48ea20=_0x93b572?_0x4689c8['count']:_0x3be66c['offset']+_0x3be66c[_0x2895('0x1e')];var _0x439098;if(_0x48ea20>=_0x2aa8b9){_0x48ea20=_0x2aa8b9;_0x439098=0xc8;}else{_0x439098=0xce;}_0x457bdc[_0x2895('0x1a')](_0x439098);return _0x457bdc[_0x2895('0x20')]('Content-Range',_0x25103d+'-'+_0x48ea20+'/'+_0x2aa8b9)[_0x2895('0x1b')](_0x4689c8);}return null;};}function patchUpdates(_0x476823){return function(_0x259443){try{jsonpatch[_0x2895('0x21')](_0x259443,_0x476823,!![]);}catch(_0x21e7b2){return BPromise[_0x2895('0x22')](_0x21e7b2);}return _0x259443[_0x2895('0x23')]();};}function saveUpdates(_0x2a033c,_0x3f8b51){return function(_0x1837ab){if(_0x1837ab){return _0x1837ab['update'](_0x2a033c)[_0x2895('0x24')](function(_0x1dd190){return _0x1dd190;});}return null;};}function removeEntity(_0x3c00b9,_0xa7f4ed){return function(_0x3448af){if(_0x3448af){return _0x3448af[_0x2895('0x25')]()['then'](function(){_0x3c00b9[_0x2895('0x1a')](0xcc)[_0x2895('0x26')]();});}};}function handleEntityNotFound(_0xbdddd,_0x4b1d94){return function(_0x3643d0){if(!_0x3643d0){_0xbdddd[_0x2895('0x19')](0x194);}return _0x3643d0;};}function handleError(_0x3e5061,_0x28086f){_0x28086f=_0x28086f||0x1f4;return function(_0xd287e){logger[_0x2895('0x27')](_0xd287e[_0x2895('0x28')]);if(_0xd287e[_0x2895('0x29')]){delete _0xd287e['name'];}_0x3e5061[_0x2895('0x1a')](_0x28086f)[_0x2895('0x2a')](_0xd287e);};}exports[_0x2895('0x2b')]=function(_0x18672f,_0x3301b7){var _0x479504={},_0x5ce806={},_0x11de60={'count':0x0,'rows':[]};var _0x28c131=_[_0x2895('0x2c')](db[_0x2895('0x2d')][_0x2895('0x2e')],function(_0x2f626c){return{'name':_0x2f626c[_0x2895('0x2f')],'type':_0x2f626c[_0x2895('0x30')]['key']};});_0x5ce806[_0x2895('0x31')]=_[_0x2895('0x2c')](_0x28c131,'name');_0x5ce806[_0x2895('0x32')]=_[_0x2895('0x33')](_0x18672f[_0x2895('0x32')]);_0x5ce806[_0x2895('0x34')]=_[_0x2895('0x35')](_0x5ce806['model'],_0x5ce806[_0x2895('0x32')]);_0x479504[_0x2895('0x36')]=_[_0x2895('0x35')](_0x5ce806[_0x2895('0x31')],qs[_0x2895('0x37')](_0x18672f[_0x2895('0x32')]['fields']));_0x479504[_0x2895('0x36')]=_0x479504['attributes'][_0x2895('0x38')]?_0x479504['attributes']:_0x5ce806['model'];if(!_0x18672f['query'][_0x2895('0x39')]('nolimit')){_0x479504[_0x2895('0x1e')]=qs['limit'](_0x18672f[_0x2895('0x32')]['limit']);_0x479504['offset']=qs[_0x2895('0x1c')](_0x18672f[_0x2895('0x32')][_0x2895('0x1c')]);}_0x479504[_0x2895('0x3a')]=qs[_0x2895('0x3b')](_0x18672f[_0x2895('0x32')][_0x2895('0x3b')]);_0x479504[_0x2895('0x3c')]=qs[_0x2895('0x34')](_[_0x2895('0x3d')](_0x18672f[_0x2895('0x32')],_0x5ce806[_0x2895('0x34')]),_0x28c131);if(_0x18672f[_0x2895('0x32')][_0x2895('0x3e')]){_0x479504['where']=_['merge'](_0x479504[_0x2895('0x3c')],{'$or':_['map'](_0x28c131,function(_0x376058){if(_0x376058[_0x2895('0x30')]!=='VIRTUAL'){var _0x408f62={};_0x408f62[_0x376058[_0x2895('0x29')]]={'$like':'%'+_0x18672f[_0x2895('0x32')][_0x2895('0x3e')]+'%'};return _0x408f62;}})});}_0x479504=_['merge']({},_0x479504,_0x18672f[_0x2895('0x3f')]);var _0x42c1db={'where':_0x479504[_0x2895('0x3c')]};return db['OpenchannelQueueReport'][_0x2895('0x1f')](_0x42c1db)[_0x2895('0x24')](function(_0x3d243b){_0x11de60[_0x2895('0x1f')]=_0x3d243b;if(_0x18672f[_0x2895('0x32')][_0x2895('0x40')]){_0x479504[_0x2895('0x41')]=[{'all':!![]}];}return db[_0x2895('0x2d')][_0x2895('0x42')](_0x479504);})[_0x2895('0x24')](function(_0x4de53d){_0x11de60[_0x2895('0x43')]=_0x4de53d;return _0x11de60;})[_0x2895('0x24')](respondWithFilteredResult(_0x3301b7,_0x479504))[_0x2895('0x44')](handleError(_0x3301b7,null));};exports[_0x2895('0x45')]=function(_0x2a2632,_0x3903f2){var _0x3592c5={'raw':!![],'where':{'id':_0x2a2632[_0x2895('0x46')]['id']}},_0x58ed1b={};_0x58ed1b['model']=_[_0x2895('0x33')](db[_0x2895('0x2d')][_0x2895('0x2e')]);_0x58ed1b[_0x2895('0x32')]=_[_0x2895('0x33')](_0x2a2632[_0x2895('0x32')]);_0x58ed1b[_0x2895('0x34')]=_[_0x2895('0x35')](_0x58ed1b[_0x2895('0x31')],_0x58ed1b[_0x2895('0x32')]);_0x3592c5[_0x2895('0x36')]=_[_0x2895('0x35')](_0x58ed1b['model'],qs[_0x2895('0x37')](_0x2a2632[_0x2895('0x32')]['fields']));_0x3592c5[_0x2895('0x36')]=_0x3592c5[_0x2895('0x36')]['length']?_0x3592c5[_0x2895('0x36')]:_0x58ed1b[_0x2895('0x31')];if(_0x2a2632[_0x2895('0x32')][_0x2895('0x40')]){_0x3592c5[_0x2895('0x41')]=[{'all':!![]}];}_0x3592c5=_[_0x2895('0x47')]({},_0x3592c5,_0x2a2632['options']);return db[_0x2895('0x2d')]['find'](_0x3592c5)[_0x2895('0x24')](handleEntityNotFound(_0x3903f2,null))[_0x2895('0x24')](respondWithResult(_0x3903f2,null))[_0x2895('0x44')](handleError(_0x3903f2,null));};exports[_0x2895('0x48')]=function(_0x560f0c,_0xd14043){return db['OpenchannelQueueReport'][_0x2895('0x48')](_0x560f0c['body'],{})[_0x2895('0x24')](respondWithResult(_0xd14043,0xc9))[_0x2895('0x44')](handleError(_0xd14043,null));};exports[_0x2895('0x49')]=function(_0x1d4add,_0x381d2c){if(_0x1d4add['body']['id']){delete _0x1d4add[_0x2895('0x4a')]['id'];}return db[_0x2895('0x2d')][_0x2895('0x4b')]({'where':{'id':_0x1d4add[_0x2895('0x46')]['id']}})[_0x2895('0x24')](handleEntityNotFound(_0x381d2c,null))[_0x2895('0x24')](saveUpdates(_0x1d4add[_0x2895('0x4a')],null))[_0x2895('0x24')](respondWithResult(_0x381d2c,null))[_0x2895('0x44')](handleError(_0x381d2c,null));};exports[_0x2895('0x25')]=function(_0x1568d2,_0x33f3fe){return db[_0x2895('0x2d')][_0x2895('0x4b')]({'where':{'id':_0x1568d2[_0x2895('0x46')]['id']}})[_0x2895('0x24')](handleEntityNotFound(_0x33f3fe,null))[_0x2895('0x24')](removeEntity(_0x33f3fe,null))[_0x2895('0x44')](handleError(_0x33f3fe,null));};exports[_0x2895('0x4c')]=function(_0x78c8a3,_0x41ea99){return db[_0x2895('0x2d')][_0x2895('0x4c')]()[_0x2895('0x24')](respondWithResult(_0x41ea99,null))[_0x2895('0x44')](handleError(_0x41ea99,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index 7e50591..427d7cd 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 _0xe14b=['bluebird','path','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','report_openchannel_queue','lodash','util','moment'];(function(_0x12ba54,_0x4fb921){var _0x3340a2=function(_0x3a9021){while(--_0x3a9021){_0x12ba54['push'](_0x12ba54['shift']());}};_0x3340a2(++_0x4fb921);}(_0xe14b,0x93));var _0xbe14=function(_0x1ccd3c,_0x26d3c8){_0x1ccd3c=_0x1ccd3c-0x0;var _0x2dd183=_0xe14b[_0x1ccd3c];return _0x2dd183;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xbe14('0x2'));var BPromise=require(_0xbe14('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbe14('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xbe14('0x5'));module[_0xbe14('0x6')]=function(_0x1fe204,_0x1ff100){return _0x1fe204[_0xbe14('0x7')](_0xbe14('0x8'),attributes,{'tableName':_0xbe14('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'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(_0x2b687d,_0x5d96b8){var _0x168904=function(_0x2f2a02){while(--_0x2f2a02){_0x2b687d['push'](_0x2b687d['shift']());}};_0x168904(++_0x5d96b8);}(_0x7a54,0x106));var _0x47a5=function(_0x36d8b3,_0x4162c1){_0x36d8b3=_0x36d8b3-0x0;var _0x4a9cee=_0x7a54[_0x36d8b3];return _0x4a9cee;};'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 c56c0e2..40ce8f2 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 _0xfff0=['../../config/environment','client','http','then','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','OpenchannelQueueReport','create','body','options','raw','CreateOpenchannelQueueReport','update','where','attributes','limit','info','UpdateOpenchannelQueueReport','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x555c95,_0x16efeb){var _0x5ab140=function(_0x4ecaba){while(--_0x4ecaba){_0x555c95['push'](_0x555c95['shift']());}};_0x5ab140(++_0x16efeb);}(_0xfff0,0x139));var _0x0fff=function(_0x24e73d,_0x1caaa4){_0x24e73d=_0x24e73d-0x0;var _0x2d13c4=_0xfff0[_0x24e73d];return _0x2d13c4;};'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});function respondWithRpcPromise(_0x2f1d2b,_0x586dc5,_0x24cfb0){return new BPromise(function(_0x5e9672,_0x1f2658){return client['request'](_0x2f1d2b,_0x24cfb0)[_0x0fff('0xa')](function(_0x3db6f6){logger['info'](_0x0fff('0xb'),_0x586dc5,_0x0fff('0xc'));logger[_0x0fff('0xd')](_0x0fff('0xe'),_0x586dc5,_0x0fff('0xc'),JSON[_0x0fff('0xf')](_0x3db6f6));if(_0x3db6f6[_0x0fff('0x10')]){if(_0x3db6f6[_0x0fff('0x10')][_0x0fff('0x11')]===0x1f4){logger[_0x0fff('0x10')](_0x0fff('0xb'),_0x586dc5,_0x3db6f6['error'][_0x0fff('0x12')]);return _0x1f2658(_0x3db6f6['error'][_0x0fff('0x12')]);}logger[_0x0fff('0x10')](_0x0fff('0xb'),_0x586dc5,_0x3db6f6[_0x0fff('0x10')]['message']);return _0x5e9672(_0x3db6f6['error'][_0x0fff('0x12')]);}else{logger['info']('OpenchannelQueueReport,\x20%s,\x20%s',_0x586dc5,'request\x20sent');_0x5e9672(_0x3db6f6[_0x0fff('0x13')][_0x0fff('0x12')]);}})['catch'](function(_0x431b33){logger[_0x0fff('0x10')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x586dc5,_0x431b33);_0x1f2658(_0x431b33);});});}exports['CreateOpenchannelQueueReport']=function(_0x48f36d){var _0x2337f=this;return new Promise(function(_0x606792,_0x46a02d){return db[_0x0fff('0x14')][_0x0fff('0x15')](_0x48f36d[_0x0fff('0x16')],{'raw':_0x48f36d['options']?_0x48f36d[_0x0fff('0x17')][_0x0fff('0x18')]===undefined?!![]:![]:!![]})[_0x0fff('0xa')](function(_0x49d211){logger['info'](_0x0fff('0x19'),_0x48f36d);logger[_0x0fff('0xd')](_0x0fff('0x19'),_0x48f36d,JSON[_0x0fff('0xf')](_0x49d211));_0x606792(_0x49d211);})['catch'](function(_0x155132){logger[_0x0fff('0x10')](_0x0fff('0x19'),_0x155132[_0x0fff('0x12')],_0x48f36d);_0x46a02d(_0x2337f[_0x0fff('0x10')](0x1f4,_0x155132[_0x0fff('0x12')]));});});};exports['UpdateOpenchannelQueueReport']=function(_0x6a116c){var _0x29f702=this;return new Promise(function(_0x37e090,_0x24cd18){return db[_0x0fff('0x14')][_0x0fff('0x1a')](_0x6a116c['body'],{'raw':_0x6a116c[_0x0fff('0x17')]?_0x6a116c[_0x0fff('0x17')][_0x0fff('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x6a116c[_0x0fff('0x17')]?_0x6a116c[_0x0fff('0x17')][_0x0fff('0x1b')]||null:null,'attributes':_0x6a116c[_0x0fff('0x17')]?_0x6a116c[_0x0fff('0x17')][_0x0fff('0x1c')]||null:null,'limit':_0x6a116c[_0x0fff('0x17')]?_0x6a116c[_0x0fff('0x17')][_0x0fff('0x1d')]||null:null})['then'](function(_0x7046a3){logger[_0x0fff('0x1e')](_0x0fff('0x1f'),_0x6a116c);logger[_0x0fff('0xd')](_0x0fff('0x1f'),_0x6a116c,JSON[_0x0fff('0xf')](_0x7046a3));_0x37e090(_0x7046a3);})['catch'](function(_0x31f9a4){logger[_0x0fff('0x10')](_0x0fff('0x1f'),_0x31f9a4['message'],_0x6a116c);_0x24cd18(_0x29f702[_0x0fff('0x10')](0x1f4,_0x31f9a4[_0x0fff('0x12')]));});});}; \ No newline at end of file +var _0x5204=['debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','body','options','UpdateOpenchannelQueueReport','update','raw','where','attributes','then','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent'];(function(_0x540777,_0x195291){var _0x395178=function(_0xaa343b){while(--_0xaa343b){_0x540777['push'](_0x540777['shift']());}};_0x395178(++_0x195291);}(_0x5204,0xdf));var _0x4520=function(_0x158da6,_0x3cb06d){_0x158da6=_0x158da6-0x0;var _0x429c30=_0x5204[_0x158da6];return _0x429c30;};'use strict';var _=require(_0x4520('0x0'));var util=require(_0x4520('0x1'));var moment=require('moment');var BPromise=require(_0x4520('0x2'));var rs=require(_0x4520('0x3'));var fs=require('fs');var Redis=require(_0x4520('0x4'));var db=require(_0x4520('0x5'))['db'];var utils=require(_0x4520('0x6'));var logger=require('../../config/logger')(_0x4520('0x7'));var config=require('../../config/environment');var jayson=require(_0x4520('0x8'));var client=jayson[_0x4520('0x9')][_0x4520('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xe741c2,_0x396d29,_0x446dc9){return new BPromise(function(_0x27890f,_0x55b44f){return client[_0x4520('0xb')](_0xe741c2,_0x446dc9)['then'](function(_0x168e62){logger[_0x4520('0xc')](_0x4520('0xd'),_0x396d29,_0x4520('0xe'));logger[_0x4520('0xf')](_0x4520('0x10'),_0x396d29,_0x4520('0xe'),JSON[_0x4520('0x11')](_0x168e62));if(_0x168e62[_0x4520('0x12')]){if(_0x168e62[_0x4520('0x12')][_0x4520('0x13')]===0x1f4){logger[_0x4520('0x12')](_0x4520('0xd'),_0x396d29,_0x168e62[_0x4520('0x12')][_0x4520('0x14')]);return _0x55b44f(_0x168e62[_0x4520('0x12')][_0x4520('0x14')]);}logger[_0x4520('0x12')](_0x4520('0xd'),_0x396d29,_0x168e62[_0x4520('0x12')][_0x4520('0x14')]);return _0x27890f(_0x168e62['error'][_0x4520('0x14')]);}else{logger[_0x4520('0xc')](_0x4520('0xd'),_0x396d29,_0x4520('0xe'));_0x27890f(_0x168e62[_0x4520('0x15')]['message']);}})[_0x4520('0x16')](function(_0x33ac29){logger[_0x4520('0x12')](_0x4520('0xd'),_0x396d29,_0x33ac29);_0x55b44f(_0x33ac29);});});}exports[_0x4520('0x17')]=function(_0x2e00f4){var _0x1dcf51=this;return new Promise(function(_0x4ba69f,_0x3791b6){return db[_0x4520('0x18')][_0x4520('0x19')](_0x2e00f4[_0x4520('0x1a')],{'raw':_0x2e00f4['options']?_0x2e00f4[_0x4520('0x1b')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x4c46c5){logger[_0x4520('0xc')]('CreateOpenchannelQueueReport',_0x2e00f4);logger[_0x4520('0xf')](_0x4520('0x17'),_0x2e00f4,JSON[_0x4520('0x11')](_0x4c46c5));_0x4ba69f(_0x4c46c5);})['catch'](function(_0x3199a9){logger[_0x4520('0x12')](_0x4520('0x17'),_0x3199a9['message'],_0x2e00f4);_0x3791b6(_0x1dcf51[_0x4520('0x12')](0x1f4,_0x3199a9[_0x4520('0x14')]));});});};exports[_0x4520('0x1c')]=function(_0x3a4680){var _0x2a8528=this;return new Promise(function(_0x552da1,_0x3774bd){return db[_0x4520('0x18')][_0x4520('0x1d')](_0x3a4680[_0x4520('0x1a')],{'raw':_0x3a4680['options']?_0x3a4680[_0x4520('0x1b')][_0x4520('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3a4680[_0x4520('0x1b')]?_0x3a4680[_0x4520('0x1b')][_0x4520('0x1f')]||null:null,'attributes':_0x3a4680[_0x4520('0x1b')]?_0x3a4680[_0x4520('0x1b')][_0x4520('0x20')]||null:null,'limit':_0x3a4680[_0x4520('0x1b')]?_0x3a4680[_0x4520('0x1b')]['limit']||null:null})[_0x4520('0x21')](function(_0x5c1a0b){logger[_0x4520('0xc')](_0x4520('0x1c'),_0x3a4680);logger[_0x4520('0xf')](_0x4520('0x1c'),_0x3a4680,JSON[_0x4520('0x11')](_0x5c1a0b));_0x552da1(_0x5c1a0b);})[_0x4520('0x16')](function(_0x5bb163){logger[_0x4520('0x12')]('UpdateOpenchannelQueueReport',_0x5bb163[_0x4520('0x14')],_0x3a4680);_0x3774bd(_0x2a8528['error'](0x1f4,_0x5bb163[_0x4520('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index ef5be73..f03de99 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 _0x4f20=['../../components/interaction/service','../../config/environment','get','/describe','isAuthenticated','describe','/:id','show','post','create','put','update','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x35c584,_0x5c3a8d){var _0x234b3b=function(_0x5961dd){while(--_0x5961dd){_0x35c584['push'](_0x35c584['shift']());}};_0x234b3b(++_0x5c3a8d);}(_0x4f20,0xe9));var _0x04f2=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x4f20[_0x1ac595];return _0x455fff;};'use strict';var multer=require(_0x04f2('0x0'));var util=require('util');var path=require(_0x04f2('0x1'));var timeout=require(_0x04f2('0x2'));var express=require(_0x04f2('0x3'));var router=express[_0x04f2('0x4')]();var fs_extra=require(_0x04f2('0x5'));var auth=require(_0x04f2('0x6'));var interaction=require(_0x04f2('0x7'));var config=require(_0x04f2('0x8'));var controller=require('./openchannelTransferReport.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x04f2('0x9')](_0x04f2('0xa'),auth[_0x04f2('0xb')](),controller[_0x04f2('0xc')]);router[_0x04f2('0x9')](_0x04f2('0xd'),auth[_0x04f2('0xb')](),controller[_0x04f2('0xe')]);router[_0x04f2('0xf')]('/',auth[_0x04f2('0xb')](),controller[_0x04f2('0x10')]);router[_0x04f2('0x11')](_0x04f2('0xd'),auth[_0x04f2('0xb')](),controller[_0x04f2('0x12')]);router['delete'](_0x04f2('0xd'),auth['isAuthenticated'](),controller[_0x04f2('0x13')]);module['exports']=router; \ No newline at end of file +var _0x81e1=['../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','create','put','multer','util','path','express','Router','fs-extra','../../components/interaction/service'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x81e1,0x1d9));var _0x181e=function(_0xd01fd9,_0x4e9ee4){_0xd01fd9=_0xd01fd9-0x0;var _0x48ac1c=_0x81e1[_0xd01fd9];return _0x48ac1c;};'use strict';var multer=require(_0x181e('0x0'));var util=require(_0x181e('0x1'));var path=require(_0x181e('0x2'));var timeout=require('connect-timeout');var express=require(_0x181e('0x3'));var router=express[_0x181e('0x4')]();var fs_extra=require(_0x181e('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x181e('0x6'));var config=require(_0x181e('0x7'));var controller=require('./openchannelTransferReport.controller');router[_0x181e('0x8')]('/',auth[_0x181e('0x9')](),controller['index']);router[_0x181e('0x8')](_0x181e('0xa'),auth[_0x181e('0x9')](),controller[_0x181e('0xb')]);router[_0x181e('0x8')](_0x181e('0xc'),auth[_0x181e('0x9')](),controller[_0x181e('0xd')]);router['post']('/',auth[_0x181e('0x9')](),controller[_0x181e('0xe')]);router[_0x181e('0xf')](_0x181e('0xc'),auth[_0x181e('0x9')](),controller['update']);router['delete'](_0x181e('0xc'),auth[_0x181e('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index a2a34f7..d5169fb 100644 --- a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js +++ b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb43b=['DATE','NOW','moment','sequelize','STRING','ENUM','account','queue'];(function(_0x4c5c97,_0x4f85bf){var _0xd5d2cb=function(_0x1e6100){while(--_0x1e6100){_0x4c5c97['push'](_0x4c5c97['shift']());}};_0xd5d2cb(++_0x4f85bf);}(_0xb43b,0x1b2));var _0xbb43=function(_0x25c241,_0x143cce){_0x25c241=_0x25c241-0x0;var _0x1913bd=_0xb43b[_0x25c241];return _0x1913bd;};'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 _0xa9e0=['account','queue','DATE','NOW','moment','sequelize','exports'];(function(_0x340e88,_0xefa352){var _0x1642f9=function(_0x397d8c){while(--_0x397d8c){_0x340e88['push'](_0x340e88['shift']());}};_0x1642f9(++_0xefa352);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2576d7,_0x167624){_0x2576d7=_0x2576d7-0x0;var _0x16a08c=_0xa9e0[_0x2576d7];return _0x16a08c;};'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/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index 98a0d50..ad83d9e 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 _0x049c=['apply','reject','save','update','destroy','then','sendStatus','error','stack','name','send','index','map','OpenchannelTransferReport','fieldName','type','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','rawAttributes','include','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','end','status','offset','undefined','limit','count','json'];(function(_0x28b224,_0x2482f3){var _0x27fcb6=function(_0x3ede90){while(--_0x3ede90){_0x28b224['push'](_0x28b224['shift']());}};_0x27fcb6(++_0x2482f3);}(_0x049c,0x154));var _0xc049=function(_0x3c13a6,_0x308e75){_0x3c13a6=_0x3c13a6-0x0;var _0x3b08a8=_0x049c[_0x3c13a6];return _0x3b08a8;};'use strict';var emlformat=require(_0xc049('0x0'));var rimraf=require(_0xc049('0x1'));var zipdir=require(_0xc049('0x2'));var jsonpatch=require(_0xc049('0x3'));var rp=require(_0xc049('0x4'));var moment=require(_0xc049('0x5'));var BPromise=require(_0xc049('0x6'));var Mustache=require(_0xc049('0x7'));var util=require(_0xc049('0x8'));var path=require(_0xc049('0x9'));var sox=require(_0xc049('0xa'));var csv=require('to-csv');var ejs=require(_0xc049('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc049('0xc'));var squel=require(_0xc049('0xd'));var crypto=require(_0xc049('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xc049('0xf'));var querystring=require(_0xc049('0x10'));var Papa=require(_0xc049('0x11'));var Redis=require('ioredis');var authService=require(_0xc049('0x12'));var qs=require(_0xc049('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc049('0x14'));var logger=require(_0xc049('0x15'))('api');var utils=require('../../config/utils');var config=require(_0xc049('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x53519e,_0x27ab93){_0x27ab93=_0x27ab93||0xcc;return function(_0x4274ec){if(_0x4274ec){return _0x53519e['sendStatus'](_0x27ab93);}return _0x53519e['status'](_0x27ab93)[_0xc049('0x17')]();};}function respondWithResult(_0x33412b,_0x5c9e64){_0x5c9e64=_0x5c9e64||0xc8;return function(_0x5912e2){if(_0x5912e2){return _0x33412b[_0xc049('0x18')](_0x5c9e64)['json'](_0x5912e2);}};}function respondWithFilteredResult(_0x28c206,_0x2d28d8){return function(_0x169eec){if(_0x169eec){var _0x42ddab=typeof _0x2d28d8[_0xc049('0x19')]===_0xc049('0x1a')&&typeof _0x2d28d8[_0xc049('0x1b')]==='undefined';var _0xceb6f=_0x169eec['count'];var _0x5aee4b=_0x42ddab?0x0:_0x2d28d8[_0xc049('0x19')];var _0x4f8600=_0x42ddab?_0x169eec[_0xc049('0x1c')]:_0x2d28d8['offset']+_0x2d28d8['limit'];var _0x361562;if(_0x4f8600>=_0xceb6f){_0x4f8600=_0xceb6f;_0x361562=0xc8;}else{_0x361562=0xce;}_0x28c206[_0xc049('0x18')](_0x361562);return _0x28c206['set']('Content-Range',_0x5aee4b+'-'+_0x4f8600+'/'+_0xceb6f)[_0xc049('0x1d')](_0x169eec);}return null;};}function patchUpdates(_0x4af8c0){return function(_0x2130a3){try{jsonpatch[_0xc049('0x1e')](_0x2130a3,_0x4af8c0,!![]);}catch(_0x2abc48){return BPromise[_0xc049('0x1f')](_0x2abc48);}return _0x2130a3[_0xc049('0x20')]();};}function saveUpdates(_0x3f962e,_0x4e48ab){return function(_0x12a7de){if(_0x12a7de){return _0x12a7de[_0xc049('0x21')](_0x3f962e)['then'](function(_0x101d74){return _0x101d74;});}return null;};}function removeEntity(_0xd78ccb,_0x273ab6){return function(_0x493d63){if(_0x493d63){return _0x493d63[_0xc049('0x22')]()[_0xc049('0x23')](function(){_0xd78ccb[_0xc049('0x18')](0xcc)[_0xc049('0x17')]();});}};}function handleEntityNotFound(_0x22f30f,_0x340ab2){return function(_0x4a8e28){if(!_0x4a8e28){_0x22f30f[_0xc049('0x24')](0x194);}return _0x4a8e28;};}function handleError(_0xc2e074,_0x35b6de){_0x35b6de=_0x35b6de||0x1f4;return function(_0x393ebb){logger[_0xc049('0x25')](_0x393ebb[_0xc049('0x26')]);if(_0x393ebb[_0xc049('0x27')]){delete _0x393ebb[_0xc049('0x27')];}_0xc2e074[_0xc049('0x18')](_0x35b6de)[_0xc049('0x28')](_0x393ebb);};}exports[_0xc049('0x29')]=function(_0x3d9f21,_0x5a7540){var _0x4e6bbf={},_0x43c81f={},_0xeaef0a={'count':0x0,'rows':[]};var _0x20e086=_[_0xc049('0x2a')](db[_0xc049('0x2b')]['rawAttributes'],function(_0x430070){return{'name':_0x430070[_0xc049('0x2c')],'type':_0x430070[_0xc049('0x2d')]['key']};});_0x43c81f[_0xc049('0x2e')]=_[_0xc049('0x2a')](_0x20e086,_0xc049('0x27'));_0x43c81f[_0xc049('0x2f')]=_['keys'](_0x3d9f21['query']);_0x43c81f[_0xc049('0x30')]=_[_0xc049('0x31')](_0x43c81f[_0xc049('0x2e')],_0x43c81f[_0xc049('0x2f')]);_0x4e6bbf['attributes']=_[_0xc049('0x31')](_0x43c81f[_0xc049('0x2e')],qs[_0xc049('0x32')](_0x3d9f21[_0xc049('0x2f')]['fields']));_0x4e6bbf[_0xc049('0x33')]=_0x4e6bbf[_0xc049('0x33')][_0xc049('0x34')]?_0x4e6bbf[_0xc049('0x33')]:_0x43c81f[_0xc049('0x2e')];if(!_0x3d9f21[_0xc049('0x2f')][_0xc049('0x35')]('nolimit')){_0x4e6bbf[_0xc049('0x1b')]=qs[_0xc049('0x1b')](_0x3d9f21['query'][_0xc049('0x1b')]);_0x4e6bbf[_0xc049('0x19')]=qs[_0xc049('0x19')](_0x3d9f21[_0xc049('0x2f')][_0xc049('0x19')]);}_0x4e6bbf[_0xc049('0x36')]=qs[_0xc049('0x37')](_0x3d9f21[_0xc049('0x2f')]['sort']);_0x4e6bbf[_0xc049('0x38')]=qs[_0xc049('0x30')](_[_0xc049('0x39')](_0x3d9f21[_0xc049('0x2f')],_0x43c81f[_0xc049('0x30')]),_0x20e086);if(_0x3d9f21[_0xc049('0x2f')][_0xc049('0x3a')]){_0x4e6bbf[_0xc049('0x38')]=_[_0xc049('0x3b')](_0x4e6bbf[_0xc049('0x38')],{'$or':_[_0xc049('0x2a')](_0x20e086,function(_0x1ae0c6){if(_0x1ae0c6[_0xc049('0x2d')]!==_0xc049('0x3c')){var _0x58877a={};_0x58877a[_0x1ae0c6[_0xc049('0x27')]]={'$like':'%'+_0x3d9f21[_0xc049('0x2f')][_0xc049('0x3a')]+'%'};return _0x58877a;}})});}_0x4e6bbf=_[_0xc049('0x3b')]({},_0x4e6bbf,_0x3d9f21[_0xc049('0x3d')]);var _0x3069b1={'where':_0x4e6bbf['where']};return db['OpenchannelTransferReport'][_0xc049('0x1c')](_0x3069b1)[_0xc049('0x23')](function(_0x5e0b5a){_0xeaef0a[_0xc049('0x1c')]=_0x5e0b5a;if(_0x3d9f21[_0xc049('0x2f')][_0xc049('0x3e')]){_0x4e6bbf['include']=[{'all':!![]}];}return db[_0xc049('0x2b')][_0xc049('0x3f')](_0x4e6bbf);})['then'](function(_0x33e0e4){_0xeaef0a[_0xc049('0x40')]=_0x33e0e4;return _0xeaef0a;})[_0xc049('0x23')](respondWithFilteredResult(_0x5a7540,_0x4e6bbf))[_0xc049('0x41')](handleError(_0x5a7540,null));};exports[_0xc049('0x42')]=function(_0x162490,_0x2e7f16){var _0x166ead={'raw':!![],'where':{'id':_0x162490[_0xc049('0x43')]['id']}},_0x13d5aa={};_0x13d5aa[_0xc049('0x2e')]=_['keys'](db[_0xc049('0x2b')][_0xc049('0x44')]);_0x13d5aa['query']=_['keys'](_0x162490[_0xc049('0x2f')]);_0x13d5aa['filters']=_[_0xc049('0x31')](_0x13d5aa['model'],_0x13d5aa[_0xc049('0x2f')]);_0x166ead['attributes']=_['intersection'](_0x13d5aa[_0xc049('0x2e')],qs[_0xc049('0x32')](_0x162490[_0xc049('0x2f')][_0xc049('0x32')]));_0x166ead[_0xc049('0x33')]=_0x166ead[_0xc049('0x33')][_0xc049('0x34')]?_0x166ead[_0xc049('0x33')]:_0x13d5aa[_0xc049('0x2e')];if(_0x162490['query'][_0xc049('0x3e')]){_0x166ead[_0xc049('0x45')]=[{'all':!![]}];}_0x166ead=_['merge']({},_0x166ead,_0x162490['options']);return db['OpenchannelTransferReport']['find'](_0x166ead)['then'](handleEntityNotFound(_0x2e7f16,null))[_0xc049('0x23')](respondWithResult(_0x2e7f16,null))[_0xc049('0x41')](handleError(_0x2e7f16,null));};exports[_0xc049('0x46')]=function(_0x8b961a,_0x7e28b8){return db['OpenchannelTransferReport'][_0xc049('0x46')](_0x8b961a[_0xc049('0x47')],{})[_0xc049('0x23')](respondWithResult(_0x7e28b8,0xc9))[_0xc049('0x41')](handleError(_0x7e28b8,null));};exports['update']=function(_0x27ca4a,_0x41a86c){if(_0x27ca4a[_0xc049('0x47')]['id']){delete _0x27ca4a[_0xc049('0x47')]['id'];}return db[_0xc049('0x2b')]['find']({'where':{'id':_0x27ca4a[_0xc049('0x43')]['id']}})[_0xc049('0x23')](handleEntityNotFound(_0x41a86c,null))[_0xc049('0x23')](saveUpdates(_0x27ca4a[_0xc049('0x47')],null))[_0xc049('0x23')](respondWithResult(_0x41a86c,null))[_0xc049('0x41')](handleError(_0x41a86c,null));};exports[_0xc049('0x22')]=function(_0x2fcd1e,_0x8f4316){return db[_0xc049('0x2b')][_0xc049('0x48')]({'where':{'id':_0x2fcd1e[_0xc049('0x43')]['id']}})['then'](handleEntityNotFound(_0x8f4316,null))['then'](removeEntity(_0x8f4316,null))[_0xc049('0x41')](handleError(_0x8f4316,null));};exports[_0xc049('0x49')]=function(_0x2c5876,_0x558ffe){return db[_0xc049('0x2b')][_0xc049('0x49')]()[_0xc049('0x23')](respondWithResult(_0x558ffe,null))['catch'](handleError(_0x558ffe,null));}; \ No newline at end of file +var _0xf83d=['options','includeAll','findAll','rows','catch','show','params','length','include','find','create','body','describe','eml-format','zip-dir','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','limit','undefined','count','offset','reject','save','update','then','destroy','end','error','stack','name','send','index','map','OpenchannelTransferReport','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter'];(function(_0x12b714,_0x56a17a){var _0x1b526c=function(_0x25e446){while(--_0x25e446){_0x12b714['push'](_0x12b714['shift']());}};_0x1b526c(++_0x56a17a);}(_0xf83d,0xab));var _0xdf83=function(_0x40e87f,_0x411c0c){_0x40e87f=_0x40e87f-0x0;var _0x44309c=_0xf83d[_0x40e87f];return _0x44309c;};'use strict';var emlformat=require(_0xdf83('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xdf83('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xdf83('0x2'));var moment=require('moment');var BPromise=require(_0xdf83('0x3'));var Mustache=require(_0xdf83('0x4'));var util=require('util');var path=require(_0xdf83('0x5'));var sox=require(_0xdf83('0x6'));var csv=require(_0xdf83('0x7'));var ejs=require(_0xdf83('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xdf83('0x9'));var squel=require(_0xdf83('0xa'));var crypto=require(_0xdf83('0xb'));var jsforce=require(_0xdf83('0xc'));var deskjs=require(_0xdf83('0xd'));var toCsv=require(_0xdf83('0x7'));var querystring=require(_0xdf83('0xe'));var Papa=require(_0xdf83('0xf'));var Redis=require(_0xdf83('0x10'));var authService=require(_0xdf83('0x11'));var qs=require(_0xdf83('0x12'));var as=require(_0xdf83('0x13'));var hardwareService=require(_0xdf83('0x14'));var logger=require('../../config/logger')(_0xdf83('0x15'));var utils=require(_0xdf83('0x16'));var config=require(_0xdf83('0x17'));var licenseUtil=require(_0xdf83('0x18'));var db=require(_0xdf83('0x19'))['db'];function respondWithStatusCode(_0x14dc9b,_0x3d7b7b){_0x3d7b7b=_0x3d7b7b||0xcc;return function(_0x1e6473){if(_0x1e6473){return _0x14dc9b[_0xdf83('0x1a')](_0x3d7b7b);}return _0x14dc9b['status'](_0x3d7b7b)['end']();};}function respondWithResult(_0x2ee665,_0x2e37d9){_0x2e37d9=_0x2e37d9||0xc8;return function(_0x4b4a2c){if(_0x4b4a2c){return _0x2ee665[_0xdf83('0x1b')](_0x2e37d9)[_0xdf83('0x1c')](_0x4b4a2c);}};}function respondWithFilteredResult(_0x411012,_0x45da38){return function(_0x17bb88){if(_0x17bb88){var _0x3a5f2e=typeof _0x45da38['offset']==='undefined'&&typeof _0x45da38[_0xdf83('0x1d')]===_0xdf83('0x1e');var _0x27a4e4=_0x17bb88[_0xdf83('0x1f')];var _0x10ff1e=_0x3a5f2e?0x0:_0x45da38[_0xdf83('0x20')];var _0x2bd737=_0x3a5f2e?_0x17bb88[_0xdf83('0x1f')]:_0x45da38['offset']+_0x45da38[_0xdf83('0x1d')];var _0x3107e2;if(_0x2bd737>=_0x27a4e4){_0x2bd737=_0x27a4e4;_0x3107e2=0xc8;}else{_0x3107e2=0xce;}_0x411012[_0xdf83('0x1b')](_0x3107e2);return _0x411012['set']('Content-Range',_0x10ff1e+'-'+_0x2bd737+'/'+_0x27a4e4)[_0xdf83('0x1c')](_0x17bb88);}return null;};}function patchUpdates(_0x186c8e){return function(_0x5be5e7){try{jsonpatch['apply'](_0x5be5e7,_0x186c8e,!![]);}catch(_0x2d16ab){return BPromise[_0xdf83('0x21')](_0x2d16ab);}return _0x5be5e7[_0xdf83('0x22')]();};}function saveUpdates(_0x42ac03,_0x400de8){return function(_0x548ff3){if(_0x548ff3){return _0x548ff3[_0xdf83('0x23')](_0x42ac03)[_0xdf83('0x24')](function(_0x30c7af){return _0x30c7af;});}return null;};}function removeEntity(_0x1c853e,_0x32ebec){return function(_0x15d6e9){if(_0x15d6e9){return _0x15d6e9[_0xdf83('0x25')]()[_0xdf83('0x24')](function(){_0x1c853e[_0xdf83('0x1b')](0xcc)[_0xdf83('0x26')]();});}};}function handleEntityNotFound(_0x3070f0,_0x35830d){return function(_0x4e0a40){if(!_0x4e0a40){_0x3070f0[_0xdf83('0x1a')](0x194);}return _0x4e0a40;};}function handleError(_0x3a57ea,_0x1cb4f5){_0x1cb4f5=_0x1cb4f5||0x1f4;return function(_0x153abf){logger[_0xdf83('0x27')](_0x153abf[_0xdf83('0x28')]);if(_0x153abf[_0xdf83('0x29')]){delete _0x153abf[_0xdf83('0x29')];}_0x3a57ea[_0xdf83('0x1b')](_0x1cb4f5)[_0xdf83('0x2a')](_0x153abf);};}exports[_0xdf83('0x2b')]=function(_0x56b8cc,_0x239630){var _0x5a9905={},_0x1dbb9c={},_0x95b695={'count':0x0,'rows':[]};var _0x56806a=_[_0xdf83('0x2c')](db[_0xdf83('0x2d')][_0xdf83('0x2e')],function(_0x2841bd){return{'name':_0x2841bd[_0xdf83('0x2f')],'type':_0x2841bd[_0xdf83('0x30')][_0xdf83('0x31')]};});_0x1dbb9c['model']=_[_0xdf83('0x2c')](_0x56806a,'name');_0x1dbb9c[_0xdf83('0x32')]=_[_0xdf83('0x33')](_0x56b8cc[_0xdf83('0x32')]);_0x1dbb9c[_0xdf83('0x34')]=_['intersection'](_0x1dbb9c[_0xdf83('0x35')],_0x1dbb9c[_0xdf83('0x32')]);_0x5a9905[_0xdf83('0x36')]=_[_0xdf83('0x37')](_0x1dbb9c[_0xdf83('0x35')],qs[_0xdf83('0x38')](_0x56b8cc[_0xdf83('0x32')][_0xdf83('0x38')]));_0x5a9905[_0xdf83('0x36')]=_0x5a9905['attributes']['length']?_0x5a9905[_0xdf83('0x36')]:_0x1dbb9c['model'];if(!_0x56b8cc[_0xdf83('0x32')][_0xdf83('0x39')](_0xdf83('0x3a'))){_0x5a9905[_0xdf83('0x1d')]=qs[_0xdf83('0x1d')](_0x56b8cc[_0xdf83('0x32')]['limit']);_0x5a9905[_0xdf83('0x20')]=qs[_0xdf83('0x20')](_0x56b8cc[_0xdf83('0x32')]['offset']);}_0x5a9905[_0xdf83('0x3b')]=qs['sort'](_0x56b8cc['query'][_0xdf83('0x3c')]);_0x5a9905['where']=qs[_0xdf83('0x34')](_[_0xdf83('0x3d')](_0x56b8cc[_0xdf83('0x32')],_0x1dbb9c['filters']),_0x56806a);if(_0x56b8cc[_0xdf83('0x32')]['filter']){_0x5a9905[_0xdf83('0x3e')]=_[_0xdf83('0x3f')](_0x5a9905[_0xdf83('0x3e')],{'$or':_['map'](_0x56806a,function(_0x59bf53){if(_0x59bf53[_0xdf83('0x30')]!==_0xdf83('0x40')){var _0xde58af={};_0xde58af[_0x59bf53[_0xdf83('0x29')]]={'$like':'%'+_0x56b8cc[_0xdf83('0x32')][_0xdf83('0x41')]+'%'};return _0xde58af;}})});}_0x5a9905=_[_0xdf83('0x3f')]({},_0x5a9905,_0x56b8cc[_0xdf83('0x42')]);var _0x426699={'where':_0x5a9905['where']};return db[_0xdf83('0x2d')][_0xdf83('0x1f')](_0x426699)['then'](function(_0x2c0469){_0x95b695[_0xdf83('0x1f')]=_0x2c0469;if(_0x56b8cc[_0xdf83('0x32')][_0xdf83('0x43')]){_0x5a9905['include']=[{'all':!![]}];}return db[_0xdf83('0x2d')][_0xdf83('0x44')](_0x5a9905);})[_0xdf83('0x24')](function(_0x2c214f){_0x95b695[_0xdf83('0x45')]=_0x2c214f;return _0x95b695;})['then'](respondWithFilteredResult(_0x239630,_0x5a9905))[_0xdf83('0x46')](handleError(_0x239630,null));};exports[_0xdf83('0x47')]=function(_0x459e2b,_0x1c17ac){var _0x8e7d1f={'raw':!![],'where':{'id':_0x459e2b[_0xdf83('0x48')]['id']}},_0x26612b={};_0x26612b[_0xdf83('0x35')]=_[_0xdf83('0x33')](db[_0xdf83('0x2d')][_0xdf83('0x2e')]);_0x26612b['query']=_[_0xdf83('0x33')](_0x459e2b[_0xdf83('0x32')]);_0x26612b[_0xdf83('0x34')]=_[_0xdf83('0x37')](_0x26612b[_0xdf83('0x35')],_0x26612b[_0xdf83('0x32')]);_0x8e7d1f[_0xdf83('0x36')]=_[_0xdf83('0x37')](_0x26612b[_0xdf83('0x35')],qs[_0xdf83('0x38')](_0x459e2b[_0xdf83('0x32')][_0xdf83('0x38')]));_0x8e7d1f[_0xdf83('0x36')]=_0x8e7d1f[_0xdf83('0x36')][_0xdf83('0x49')]?_0x8e7d1f[_0xdf83('0x36')]:_0x26612b[_0xdf83('0x35')];if(_0x459e2b[_0xdf83('0x32')][_0xdf83('0x43')]){_0x8e7d1f[_0xdf83('0x4a')]=[{'all':!![]}];}_0x8e7d1f=_[_0xdf83('0x3f')]({},_0x8e7d1f,_0x459e2b[_0xdf83('0x42')]);return db[_0xdf83('0x2d')][_0xdf83('0x4b')](_0x8e7d1f)[_0xdf83('0x24')](handleEntityNotFound(_0x1c17ac,null))[_0xdf83('0x24')](respondWithResult(_0x1c17ac,null))[_0xdf83('0x46')](handleError(_0x1c17ac,null));};exports[_0xdf83('0x4c')]=function(_0x40ea42,_0x49a709){return db[_0xdf83('0x2d')][_0xdf83('0x4c')](_0x40ea42[_0xdf83('0x4d')],{})['then'](respondWithResult(_0x49a709,0xc9))[_0xdf83('0x46')](handleError(_0x49a709,null));};exports[_0xdf83('0x23')]=function(_0x372b89,_0x1430f9){if(_0x372b89[_0xdf83('0x4d')]['id']){delete _0x372b89[_0xdf83('0x4d')]['id'];}return db[_0xdf83('0x2d')]['find']({'where':{'id':_0x372b89[_0xdf83('0x48')]['id']}})['then'](handleEntityNotFound(_0x1430f9,null))[_0xdf83('0x24')](saveUpdates(_0x372b89[_0xdf83('0x4d')],null))[_0xdf83('0x24')](respondWithResult(_0x1430f9,null))[_0xdf83('0x46')](handleError(_0x1430f9,null));};exports[_0xdf83('0x25')]=function(_0x29d6fa,_0x405615){return db['OpenchannelTransferReport'][_0xdf83('0x4b')]({'where':{'id':_0x29d6fa[_0xdf83('0x48')]['id']}})['then'](handleEntityNotFound(_0x405615,null))[_0xdf83('0x24')](removeEntity(_0x405615,null))[_0xdf83('0x46')](handleError(_0x405615,null));};exports[_0xdf83('0x4e')]=function(_0x14b76a,_0x158a5e){return db[_0xdf83('0x2d')][_0xdf83('0x4e')]()[_0xdf83('0x24')](respondWithResult(_0x158a5e,null))['catch'](handleError(_0x158a5e,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index 2cc6b59..5ad0c96 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 _0xabb6=['define','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x83f08d,_0x45ec24){var _0x42bc1a=function(_0x204194){while(--_0x204194){_0x83f08d['push'](_0x83f08d['shift']());}};_0x42bc1a(++_0x45ec24);}(_0xabb6,0x13c));var _0x6abb=function(_0x1a5449,_0x292db9){_0x1a5449=_0x1a5449-0x0;var _0x44ff4c=_0xabb6[_0x1a5449];return _0x44ff4c;};'use strict';var _=require(_0x6abb('0x0'));var util=require(_0x6abb('0x1'));var logger=require('../../config/logger')(_0x6abb('0x2'));var moment=require(_0x6abb('0x3'));var BPromise=require(_0x6abb('0x4'));var rp=require(_0x6abb('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6abb('0x6'));var config=require(_0x6abb('0x7'));var attributes=require('./openchannelTransferReport.attributes');module['exports']=function(_0x47c8b3,_0x1a867b){return _0x47c8b3[_0x6abb('0x8')](_0x6abb('0x9'),attributes,{'tableName':_0x6abb('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x6abb('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x681c=['path','rimraf','../../config/environment','exports','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','lodash','../../config/logger','api','moment','bluebird'];(function(_0x5264c6,_0x5100e6){var _0x24230d=function(_0x18cdc3){while(--_0x18cdc3){_0x5264c6['push'](_0x5264c6['shift']());}};_0x24230d(++_0x5100e6);}(_0x681c,0xbb));var _0xc681=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0x681c[_0x376b45];return _0x2341b3;};'use strict';var _=require(_0xc681('0x0'));var util=require('util');var logger=require(_0xc681('0x1'))(_0xc681('0x2'));var moment=require(_0xc681('0x3'));var BPromise=require(_0xc681('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc681('0x5'));var rimraf=require(_0xc681('0x6'));var config=require(_0xc681('0x7'));var attributes=require('./openchannelTransferReport.attributes');module[_0xc681('0x8')]=function(_0x9c01e2,_0x376a48){return _0x9c01e2['define'](_0xc681('0x9'),attributes,{'tableName':_0xc681('0xa'),'paranoid':![],'indexes':[{'name':_0xc681('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index ccb24eb..0ae1238 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 _0xbbbd=['request\x20sent','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelTransferReport,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xbbbd,0x86));var _0xdbbb=function(_0x101e7b,_0x4ef05b){_0x101e7b=_0x101e7b-0x0;var _0x4995c0=_0xbbbd[_0x101e7b];return _0x4995c0;};'use strict';var _=require(_0xdbbb('0x0'));var util=require(_0xdbbb('0x1'));var moment=require(_0xdbbb('0x2'));var BPromise=require(_0xdbbb('0x3'));var rs=require(_0xdbbb('0x4'));var fs=require('fs');var Redis=require(_0xdbbb('0x5'));var db=require(_0xdbbb('0x6'))['db'];var utils=require(_0xdbbb('0x7'));var logger=require(_0xdbbb('0x8'))(_0xdbbb('0x9'));var config=require(_0xdbbb('0xa'));var jayson=require(_0xdbbb('0xb'));var client=jayson['client'][_0xdbbb('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x42ea38,_0x197916,_0x478756){return new BPromise(function(_0x463ea6,_0x28a1fd){return client[_0xdbbb('0xd')](_0x42ea38,_0x478756)[_0xdbbb('0xe')](function(_0x2def2e){logger[_0xdbbb('0xf')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x197916,_0xdbbb('0x10'));logger['debug'](_0xdbbb('0x11'),_0x197916,'request\x20sent',JSON[_0xdbbb('0x12')](_0x2def2e));if(_0x2def2e[_0xdbbb('0x13')]){if(_0x2def2e[_0xdbbb('0x13')][_0xdbbb('0x14')]===0x1f4){logger[_0xdbbb('0x13')](_0xdbbb('0x15'),_0x197916,_0x2def2e[_0xdbbb('0x13')][_0xdbbb('0x16')]);return _0x28a1fd(_0x2def2e[_0xdbbb('0x13')]['message']);}logger[_0xdbbb('0x13')](_0xdbbb('0x15'),_0x197916,_0x2def2e[_0xdbbb('0x13')][_0xdbbb('0x16')]);return _0x463ea6(_0x2def2e[_0xdbbb('0x13')][_0xdbbb('0x16')]);}else{logger[_0xdbbb('0xf')](_0xdbbb('0x15'),_0x197916,_0xdbbb('0x10'));_0x463ea6(_0x2def2e[_0xdbbb('0x17')][_0xdbbb('0x16')]);}})[_0xdbbb('0x18')](function(_0x203feb){logger[_0xdbbb('0x13')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x197916,_0x203feb);_0x28a1fd(_0x203feb);});});} \ No newline at end of file +var _0xf006=['code','message','result','moment','bluebird','ioredis','../../config/utils','../../config/environment','jayson/promise','client','request','then','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x1b58d8,_0x577164){var _0x44c2d4=function(_0x3e5b1c){while(--_0x3e5b1c){_0x1b58d8['push'](_0x1b58d8['shift']());}};_0x44c2d4(++_0x577164);}(_0xf006,0x146));var _0x6f00=function(_0x391e1d,_0x5e16c7){_0x391e1d=_0x391e1d-0x0;var _0x28e6d1=_0xf006[_0x391e1d];return _0x28e6d1;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x6f00('0x0'));var BPromise=require(_0x6f00('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6f00('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x6f00('0x3'));var logger=require('../../config/logger')('rpc');var config=require(_0x6f00('0x4'));var jayson=require(_0x6f00('0x5'));var client=jayson[_0x6f00('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3c29ff,_0x4f918f,_0x3875fb){return new BPromise(function(_0x3001b1,_0x185728){return client[_0x6f00('0x7')](_0x3c29ff,_0x3875fb)[_0x6f00('0x8')](function(_0x3001c6){logger[_0x6f00('0x9')](_0x6f00('0xa'),_0x4f918f,_0x6f00('0xb'));logger[_0x6f00('0xc')](_0x6f00('0xd'),_0x4f918f,_0x6f00('0xb'),JSON[_0x6f00('0xe')](_0x3001c6));if(_0x3001c6['error']){if(_0x3001c6[_0x6f00('0xf')][_0x6f00('0x10')]===0x1f4){logger[_0x6f00('0xf')](_0x6f00('0xa'),_0x4f918f,_0x3001c6[_0x6f00('0xf')]['message']);return _0x185728(_0x3001c6[_0x6f00('0xf')]['message']);}logger[_0x6f00('0xf')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x4f918f,_0x3001c6[_0x6f00('0xf')][_0x6f00('0x11')]);return _0x3001b1(_0x3001c6[_0x6f00('0xf')][_0x6f00('0x11')]);}else{logger[_0x6f00('0x9')](_0x6f00('0xa'),_0x4f918f,_0x6f00('0xb'));_0x3001b1(_0x3001c6[_0x6f00('0x12')][_0x6f00('0x11')]);}})['catch'](function(_0x14b15d){logger['error']('OpenchannelTransferReport,\x20%s,\x20%s',_0x4f918f,_0x14b15d);_0x185728(_0x14b15d);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index 0988283..f8dfa42 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 _0x66f4=['destroy','util','express','Router','fs-extra','../../config/environment','isAuthenticated','index','get','/:id','show','post','update','delete'];(function(_0x62c958,_0x2bfdbc){var _0x57ec61=function(_0x5c0094){while(--_0x5c0094){_0x62c958['push'](_0x62c958['shift']());}};_0x57ec61(++_0x2bfdbc);}(_0x66f4,0x7f));var _0x466f=function(_0x44db32,_0x1801ed){_0x44db32=_0x44db32-0x0;var _0x247a7b=_0x66f4[_0x44db32];return _0x247a7b;};'use strict';var multer=require('multer');var util=require(_0x466f('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x466f('0x1'));var router=express[_0x466f('0x2')]();var fs_extra=require(_0x466f('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x466f('0x4'));var controller=require('./pause.controller');router['get']('/',auth[_0x466f('0x5')](),controller[_0x466f('0x6')]);router[_0x466f('0x7')](_0x466f('0x8'),auth['isAuthenticated'](),controller[_0x466f('0x9')]);router[_0x466f('0xa')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x466f('0x8'),auth[_0x466f('0x5')](),controller[_0x466f('0xb')]);router[_0x466f('0xc')]('/:id',auth[_0x466f('0x5')](),controller[_0x466f('0xd')]);module['exports']=router; \ No newline at end of file +var _0xe46f=['exports','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./pause.controller','get','isAuthenticated','index','/:id','show','create','put','update','delete','destroy'];(function(_0x46cf00,_0x457a43){var _0x3974dc=function(_0x4b5d0a){while(--_0x4b5d0a){_0x46cf00['push'](_0x46cf00['shift']());}};_0x3974dc(++_0x457a43);}(_0xe46f,0x157));var _0xfe46=function(_0x5cfb75,_0x224a85){_0x5cfb75=_0x5cfb75-0x0;var _0x2613d6=_0xe46f[_0x5cfb75];return _0x2613d6;};'use strict';var multer=require('multer');var util=require(_0xfe46('0x0'));var path=require(_0xfe46('0x1'));var timeout=require(_0xfe46('0x2'));var express=require(_0xfe46('0x3'));var router=express[_0xfe46('0x4')]();var fs_extra=require(_0xfe46('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xfe46('0x6'));var controller=require(_0xfe46('0x7'));router[_0xfe46('0x8')]('/',auth[_0xfe46('0x9')](),controller[_0xfe46('0xa')]);router[_0xfe46('0x8')](_0xfe46('0xb'),auth[_0xfe46('0x9')](),controller[_0xfe46('0xc')]);router['post']('/',auth[_0xfe46('0x9')](),controller[_0xfe46('0xd')]);router[_0xfe46('0xe')](_0xfe46('0xb'),auth[_0xfe46('0x9')](),controller[_0xfe46('0xf')]);router[_0xfe46('0x10')]('/:id',auth[_0xfe46('0x9')](),controller[_0xfe46('0x11')]);module[_0xfe46('0x12')]=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index 96caa07..1f3f550 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 _0xc92d=['name','sequelize','exports','STRING'];(function(_0x2c0358,_0x260c04){var _0x44c057=function(_0x313fe2){while(--_0x313fe2){_0x2c0358['push'](_0x2c0358['shift']());}};_0x44c057(++_0x260c04);}(_0xc92d,0x161));var _0xdc92=function(_0x3abcf7,_0x7feb62){_0x3abcf7=_0x3abcf7-0x0;var _0x51fb09=_0xc92d[_0x3abcf7];return _0x51fb09;};'use strict';var Sequelize=require(_0xdc92('0x0'));module[_0xdc92('0x1')]={'name':{'type':Sequelize[_0xdc92('0x2')],'unique':_0xdc92('0x3'),'allowNull':![]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x6b4b=['exports','STRING','name','sequelize'];(function(_0x120c19,_0x4a86f7){var _0x72af71=function(_0x14106e){while(--_0x14106e){_0x120c19['push'](_0x120c19['shift']());}};_0x72af71(++_0x4a86f7);}(_0x6b4b,0x1ef));var _0xb6b4=function(_0x2dadb9,_0x42cfe6){_0x2dadb9=_0x2dadb9-0x0;var _0x2f0097=_0x6b4b[_0x2dadb9];return _0x2f0097;};'use strict';var Sequelize=require(_0xb6b4('0x0'));module[_0xb6b4('0x1')]={'name':{'type':Sequelize[_0xb6b4('0x2')],'unique':_0xb6b4('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0xb6b4('0x2')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index f4f8ab9..98a459f 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 _0x0da3=['keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','includeAll','include','rows','show','params','find','catch','create','body','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','fast-json-patch','request-promise','mustache','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','then','get','Pauses','UserProfileResource','error','stack','name','index','Pause','rawAttributes','type','key','map','query'];(function(_0x5721c4,_0x2ffbd4){var _0x597a5f=function(_0x2387a5){while(--_0x2387a5){_0x5721c4['push'](_0x5721c4['shift']());}};_0x597a5f(++_0x2ffbd4);}(_0x0da3,0x1b3));var _0x30da=function(_0x547dfe,_0x1dd163){_0x547dfe=_0x547dfe-0x0;var _0x368407=_0x0da3[_0x547dfe];return _0x368407;};'use strict';var emlformat=require(_0x30da('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x30da('0x1'));var jsonpatch=require(_0x30da('0x2'));var rp=require(_0x30da('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x30da('0x4'));var util=require('util');var path=require(_0x30da('0x5'));var sox=require('sox');var csv=require(_0x30da('0x6'));var ejs=require(_0x30da('0x7'));var fs=require('fs');var fs_extra=require(_0x30da('0x8'));var _=require(_0x30da('0x9'));var squel=require('squel');var crypto=require(_0x30da('0xa'));var jsforce=require(_0x30da('0xb'));var deskjs=require(_0x30da('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x30da('0xd'));var Redis=require('ioredis');var authService=require(_0x30da('0xe'));var qs=require(_0x30da('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x30da('0x10'));var logger=require(_0x30da('0x11'))(_0x30da('0x12'));var utils=require(_0x30da('0x13'));var config=require(_0x30da('0x14'));var licenseUtil=require(_0x30da('0x15'));var db=require(_0x30da('0x16'))['db'];function respondWithStatusCode(_0x5e4f54,_0x619db9){_0x619db9=_0x619db9||0xcc;return function(_0x1c15fc){if(_0x1c15fc){return _0x5e4f54[_0x30da('0x17')](_0x619db9);}return _0x5e4f54['status'](_0x619db9)[_0x30da('0x18')]();};}function respondWithResult(_0x1da0db,_0x3f0039){_0x3f0039=_0x3f0039||0xc8;return function(_0x4b29bc){if(_0x4b29bc){return _0x1da0db[_0x30da('0x19')](_0x3f0039)[_0x30da('0x1a')](_0x4b29bc);}};}function respondWithFilteredResult(_0x45df35,_0x4946be){return function(_0xaa2310){if(_0xaa2310){var _0x586622=typeof _0x4946be[_0x30da('0x1b')]===_0x30da('0x1c')&&typeof _0x4946be[_0x30da('0x1d')]===_0x30da('0x1c');var _0x23822a=_0xaa2310[_0x30da('0x1e')];var _0x115732=_0x586622?0x0:_0x4946be['offset'];var _0x3e5cb3=_0x586622?_0xaa2310[_0x30da('0x1e')]:_0x4946be[_0x30da('0x1b')]+_0x4946be[_0x30da('0x1d')];var _0x54bb89;if(_0x3e5cb3>=_0x23822a){_0x3e5cb3=_0x23822a;_0x54bb89=0xc8;}else{_0x54bb89=0xce;}_0x45df35[_0x30da('0x19')](_0x54bb89);return _0x45df35[_0x30da('0x1f')]('Content-Range',_0x115732+'-'+_0x3e5cb3+'/'+_0x23822a)[_0x30da('0x1a')](_0xaa2310);}return null;};}function patchUpdates(_0x1792fa){return function(_0x37d5cd){try{jsonpatch[_0x30da('0x20')](_0x37d5cd,_0x1792fa,!![]);}catch(_0x245677){return BPromise[_0x30da('0x21')](_0x245677);}return _0x37d5cd[_0x30da('0x22')]();};}function saveUpdates(_0x49fa3d,_0x274868){return function(_0x193a9d){if(_0x193a9d){return _0x193a9d[_0x30da('0x23')](_0x49fa3d)['then'](function(_0x17c13b){return _0x17c13b;});}return null;};}function removeEntity(_0x1d442f,_0xc0df29){return function(_0x1d892){if(_0x1d892){return _0x1d892[_0x30da('0x24')]()[_0x30da('0x25')](function(){var _0x3f050b=_0x1d892[_0x30da('0x26')]({'plain':!![]});var _0x1cc592=_0x30da('0x27');return db[_0x30da('0x28')][_0x30da('0x24')]({'where':{'type':_0x1cc592,'resourceId':_0x3f050b['id']}})[_0x30da('0x25')](function(){return _0x1d892;});})[_0x30da('0x25')](function(){_0x1d442f[_0x30da('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x306e14,_0x750591){return function(_0x3874df){if(!_0x3874df){_0x306e14[_0x30da('0x17')](0x194);}return _0x3874df;};}function handleError(_0x1ac2b9,_0x5c40c7){_0x5c40c7=_0x5c40c7||0x1f4;return function(_0x569b7b){logger[_0x30da('0x29')](_0x569b7b[_0x30da('0x2a')]);if(_0x569b7b['name']){delete _0x569b7b[_0x30da('0x2b')];}_0x1ac2b9[_0x30da('0x19')](_0x5c40c7)['send'](_0x569b7b);};}exports[_0x30da('0x2c')]=function(_0x10fb72,_0x2cee98){var _0x2f155b={},_0x413462={},_0x1e64e2={'count':0x0,'rows':[]};var _0x11cc7a=_['map'](db[_0x30da('0x2d')][_0x30da('0x2e')],function(_0x3cbb36){return{'name':_0x3cbb36['fieldName'],'type':_0x3cbb36[_0x30da('0x2f')][_0x30da('0x30')]};});_0x413462['model']=_[_0x30da('0x31')](_0x11cc7a,_0x30da('0x2b'));_0x413462[_0x30da('0x32')]=_[_0x30da('0x33')](_0x10fb72['query']);_0x413462[_0x30da('0x34')]=_[_0x30da('0x35')](_0x413462[_0x30da('0x36')],_0x413462[_0x30da('0x32')]);_0x2f155b['attributes']=_[_0x30da('0x35')](_0x413462['model'],qs['fields'](_0x10fb72[_0x30da('0x32')][_0x30da('0x37')]));_0x2f155b[_0x30da('0x38')]=_0x2f155b[_0x30da('0x38')][_0x30da('0x39')]?_0x2f155b[_0x30da('0x38')]:_0x413462[_0x30da('0x36')];if(!_0x10fb72['query'][_0x30da('0x3a')]('nolimit')){_0x2f155b[_0x30da('0x1d')]=qs['limit'](_0x10fb72['query'][_0x30da('0x1d')]);_0x2f155b['offset']=qs[_0x30da('0x1b')](_0x10fb72['query'][_0x30da('0x1b')]);}_0x2f155b[_0x30da('0x3b')]=qs['sort'](_0x10fb72['query'][_0x30da('0x3c')]);_0x2f155b[_0x30da('0x3d')]=qs[_0x30da('0x34')](_[_0x30da('0x3e')](_0x10fb72[_0x30da('0x32')],_0x413462[_0x30da('0x34')]),_0x11cc7a);if(_0x10fb72[_0x30da('0x32')][_0x30da('0x3f')]){_0x2f155b['where']=_[_0x30da('0x40')](_0x2f155b['where'],{'$or':_[_0x30da('0x31')](_0x11cc7a,function(_0x409386){if(_0x409386['type']!=='VIRTUAL'){var _0x1df423={};_0x1df423[_0x409386[_0x30da('0x2b')]]={'$like':'%'+_0x10fb72['query'][_0x30da('0x3f')]+'%'};return _0x1df423;}})});}_0x2f155b=_[_0x30da('0x40')]({},_0x2f155b,_0x10fb72[_0x30da('0x41')]);var _0x394993={'where':_0x2f155b[_0x30da('0x3d')]};return db['Pause']['count'](_0x394993)[_0x30da('0x25')](function(_0x224857){_0x1e64e2[_0x30da('0x1e')]=_0x224857;if(_0x10fb72['query'][_0x30da('0x42')]){_0x2f155b[_0x30da('0x43')]=[{'all':!![]}];}return db[_0x30da('0x2d')]['findAll'](_0x2f155b);})[_0x30da('0x25')](function(_0x4f3f71){_0x1e64e2[_0x30da('0x44')]=_0x4f3f71;return _0x1e64e2;})[_0x30da('0x25')](respondWithFilteredResult(_0x2cee98,_0x2f155b))['catch'](handleError(_0x2cee98,null));};exports[_0x30da('0x45')]=function(_0x53dd3b,_0x3da6fd){var _0x20ffd7={'raw':!![],'where':{'id':_0x53dd3b[_0x30da('0x46')]['id']}},_0x2fde3e={};_0x2fde3e[_0x30da('0x36')]=_[_0x30da('0x33')](db[_0x30da('0x2d')][_0x30da('0x2e')]);_0x2fde3e['query']=_[_0x30da('0x33')](_0x53dd3b[_0x30da('0x32')]);_0x2fde3e[_0x30da('0x34')]=_[_0x30da('0x35')](_0x2fde3e[_0x30da('0x36')],_0x2fde3e['query']);_0x20ffd7[_0x30da('0x38')]=_[_0x30da('0x35')](_0x2fde3e[_0x30da('0x36')],qs[_0x30da('0x37')](_0x53dd3b[_0x30da('0x32')]['fields']));_0x20ffd7['attributes']=_0x20ffd7['attributes'][_0x30da('0x39')]?_0x20ffd7[_0x30da('0x38')]:_0x2fde3e[_0x30da('0x36')];if(_0x53dd3b[_0x30da('0x32')][_0x30da('0x42')]){_0x20ffd7[_0x30da('0x43')]=[{'all':!![]}];}_0x20ffd7=_[_0x30da('0x40')]({},_0x20ffd7,_0x53dd3b[_0x30da('0x41')]);return db[_0x30da('0x2d')][_0x30da('0x47')](_0x20ffd7)['then'](handleEntityNotFound(_0x3da6fd,null))['then'](respondWithResult(_0x3da6fd,null))[_0x30da('0x48')](handleError(_0x3da6fd,null));};exports[_0x30da('0x49')]=function(_0x5beedc,_0x2d1b65){return db[_0x30da('0x2d')][_0x30da('0x49')](_0x5beedc[_0x30da('0x4a')],{})['then'](function(_0x87283f){var _0x423584=_0x5beedc['user'][_0x30da('0x26')]({'plain':!![]});if(!_0x423584)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x423584[_0x30da('0x4b')]===_0x30da('0x4c')){var _0x174ffd=_0x87283f['get']({'plain':!![]});var _0x15779d='Pauses';return db[_0x30da('0x4d')][_0x30da('0x47')]({'where':{'name':_0x15779d,'userProfileId':_0x423584[_0x30da('0x4e')]},'raw':!![]})[_0x30da('0x25')](function(_0xde2fac){if(_0xde2fac&&_0xde2fac[_0x30da('0x4f')]===0x0){return db[_0x30da('0x28')]['create']({'name':_0x174ffd['name'],'resourceId':_0x174ffd['id'],'type':_0xde2fac[_0x30da('0x2b')],'sectionId':_0xde2fac['id']},{})[_0x30da('0x25')](function(){return _0x87283f;});}else{return _0x87283f;}})[_0x30da('0x48')](function(_0x38fafc){logger[_0x30da('0x29')](_0x30da('0x50'),_0x38fafc);throw _0x38fafc;});}return _0x87283f;})['then'](respondWithResult(_0x2d1b65,0xc9))[_0x30da('0x48')](handleError(_0x2d1b65,null));};exports[_0x30da('0x23')]=function(_0x2366bf,_0x45a11f){if(_0x2366bf[_0x30da('0x4a')]['id']){delete _0x2366bf[_0x30da('0x4a')]['id'];}return db[_0x30da('0x2d')]['find']({'where':{'id':_0x2366bf['params']['id']}})[_0x30da('0x25')](handleEntityNotFound(_0x45a11f,null))[_0x30da('0x25')](saveUpdates(_0x2366bf[_0x30da('0x4a')],null))[_0x30da('0x25')](respondWithResult(_0x45a11f,null))[_0x30da('0x48')](handleError(_0x45a11f,null));};exports[_0x30da('0x24')]=function(_0x27fe7e,_0xcf992b){return db[_0x30da('0x2d')][_0x30da('0x47')]({'where':{'id':_0x27fe7e[_0x30da('0x46')]['id']}})[_0x30da('0x25')](handleEntityNotFound(_0xcf992b,null))['then'](removeEntity(_0xcf992b,null))[_0x30da('0x48')](handleError(_0xcf992b,null));}; \ No newline at end of file +var _0x7617=['end','error','stack','name','index','map','rawAttributes','type','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filters','filter','where','merge','VIRTUAL','options','findAll','catch','params','Pause','includeAll','include','find','create','user','Pauses','UserProfileSection','userProfileId','autoAssociation','update','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','limit','undefined','count','offset','set','Content-Range','reject','save','then','destroy','get','UserProfileResource'];(function(_0x4504e3,_0x5ad201){var _0x14ff39=function(_0x1ff66d){while(--_0x1ff66d){_0x4504e3['push'](_0x4504e3['shift']());}};_0x14ff39(++_0x5ad201);}(_0x7617,0x170));var _0x7761=function(_0x1ce796,_0x197a4f){_0x1ce796=_0x1ce796-0x0;var _0x186315=_0x7617[_0x1ce796];return _0x186315;};'use strict';var emlformat=require(_0x7761('0x0'));var rimraf=require(_0x7761('0x1'));var zipdir=require(_0x7761('0x2'));var jsonpatch=require(_0x7761('0x3'));var rp=require(_0x7761('0x4'));var moment=require(_0x7761('0x5'));var BPromise=require(_0x7761('0x6'));var Mustache=require(_0x7761('0x7'));var util=require(_0x7761('0x8'));var path=require(_0x7761('0x9'));var sox=require(_0x7761('0xa'));var csv=require('to-csv');var ejs=require(_0x7761('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7761('0xc'));var squel=require(_0x7761('0xd'));var crypto=require(_0x7761('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x7761('0xf'));var querystring=require(_0x7761('0x10'));var Papa=require(_0x7761('0x11'));var Redis=require(_0x7761('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x7761('0x13'));var as=require(_0x7761('0x14'));var hardwareService=require(_0x7761('0x15'));var logger=require(_0x7761('0x16'))(_0x7761('0x17'));var utils=require(_0x7761('0x18'));var config=require(_0x7761('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x7761('0x1a'))['db'];function respondWithStatusCode(_0x3a53a3,_0x525dcb){_0x525dcb=_0x525dcb||0xcc;return function(_0x55d05b){if(_0x55d05b){return _0x3a53a3[_0x7761('0x1b')](_0x525dcb);}return _0x3a53a3[_0x7761('0x1c')](_0x525dcb)['end']();};}function respondWithResult(_0x57cc69,_0x4ce554){_0x4ce554=_0x4ce554||0xc8;return function(_0x43e996){if(_0x43e996){return _0x57cc69[_0x7761('0x1c')](_0x4ce554)[_0x7761('0x1d')](_0x43e996);}};}function respondWithFilteredResult(_0x183cf0,_0x14641e){return function(_0x96dab9){if(_0x96dab9){var _0x250160=typeof _0x14641e['offset']==='undefined'&&typeof _0x14641e[_0x7761('0x1e')]===_0x7761('0x1f');var _0x4da497=_0x96dab9[_0x7761('0x20')];var _0x35f60b=_0x250160?0x0:_0x14641e[_0x7761('0x21')];var _0x1d3dc4=_0x250160?_0x96dab9['count']:_0x14641e[_0x7761('0x21')]+_0x14641e['limit'];var _0x1161a3;if(_0x1d3dc4>=_0x4da497){_0x1d3dc4=_0x4da497;_0x1161a3=0xc8;}else{_0x1161a3=0xce;}_0x183cf0[_0x7761('0x1c')](_0x1161a3);return _0x183cf0[_0x7761('0x22')](_0x7761('0x23'),_0x35f60b+'-'+_0x1d3dc4+'/'+_0x4da497)[_0x7761('0x1d')](_0x96dab9);}return null;};}function patchUpdates(_0x391307){return function(_0x308f88){try{jsonpatch['apply'](_0x308f88,_0x391307,!![]);}catch(_0x3baaa6){return BPromise[_0x7761('0x24')](_0x3baaa6);}return _0x308f88[_0x7761('0x25')]();};}function saveUpdates(_0x53ee4f,_0x2f29b8){return function(_0x343c66){if(_0x343c66){return _0x343c66['update'](_0x53ee4f)[_0x7761('0x26')](function(_0x4ed2f3){return _0x4ed2f3;});}return null;};}function removeEntity(_0x3ade8d,_0x3aba56){return function(_0x33edc9){if(_0x33edc9){return _0x33edc9[_0x7761('0x27')]()['then'](function(){var _0x41c731=_0x33edc9[_0x7761('0x28')]({'plain':!![]});var _0x205fe5='Pauses';return db[_0x7761('0x29')][_0x7761('0x27')]({'where':{'type':_0x205fe5,'resourceId':_0x41c731['id']}})[_0x7761('0x26')](function(){return _0x33edc9;});})['then'](function(){_0x3ade8d[_0x7761('0x1c')](0xcc)[_0x7761('0x2a')]();});}};}function handleEntityNotFound(_0x273b5a,_0x504549){return function(_0x10fb1c){if(!_0x10fb1c){_0x273b5a[_0x7761('0x1b')](0x194);}return _0x10fb1c;};}function handleError(_0x2da930,_0x5238c5){_0x5238c5=_0x5238c5||0x1f4;return function(_0x45ee31){logger[_0x7761('0x2b')](_0x45ee31[_0x7761('0x2c')]);if(_0x45ee31[_0x7761('0x2d')]){delete _0x45ee31[_0x7761('0x2d')];}_0x2da930[_0x7761('0x1c')](_0x5238c5)['send'](_0x45ee31);};}exports[_0x7761('0x2e')]=function(_0x34d2b8,_0x566e5c){var _0x447440={},_0x3fdba1={},_0x56c559={'count':0x0,'rows':[]};var _0x10d5d1=_[_0x7761('0x2f')](db['Pause'][_0x7761('0x30')],function(_0x495ed5){return{'name':_0x495ed5['fieldName'],'type':_0x495ed5[_0x7761('0x31')]['key']};});_0x3fdba1['model']=_[_0x7761('0x2f')](_0x10d5d1,_0x7761('0x2d'));_0x3fdba1[_0x7761('0x32')]=_[_0x7761('0x33')](_0x34d2b8['query']);_0x3fdba1['filters']=_[_0x7761('0x34')](_0x3fdba1[_0x7761('0x35')],_0x3fdba1[_0x7761('0x32')]);_0x447440[_0x7761('0x36')]=_[_0x7761('0x34')](_0x3fdba1[_0x7761('0x35')],qs[_0x7761('0x37')](_0x34d2b8['query'][_0x7761('0x37')]));_0x447440[_0x7761('0x36')]=_0x447440[_0x7761('0x36')][_0x7761('0x38')]?_0x447440[_0x7761('0x36')]:_0x3fdba1[_0x7761('0x35')];if(!_0x34d2b8[_0x7761('0x32')][_0x7761('0x39')](_0x7761('0x3a'))){_0x447440[_0x7761('0x1e')]=qs['limit'](_0x34d2b8[_0x7761('0x32')][_0x7761('0x1e')]);_0x447440[_0x7761('0x21')]=qs[_0x7761('0x21')](_0x34d2b8[_0x7761('0x32')][_0x7761('0x21')]);}_0x447440['order']=qs['sort'](_0x34d2b8[_0x7761('0x32')][_0x7761('0x3b')]);_0x447440['where']=qs['filters'](_[_0x7761('0x3c')](_0x34d2b8[_0x7761('0x32')],_0x3fdba1[_0x7761('0x3d')]),_0x10d5d1);if(_0x34d2b8[_0x7761('0x32')][_0x7761('0x3e')]){_0x447440[_0x7761('0x3f')]=_[_0x7761('0x40')](_0x447440[_0x7761('0x3f')],{'$or':_[_0x7761('0x2f')](_0x10d5d1,function(_0x505c09){if(_0x505c09[_0x7761('0x31')]!==_0x7761('0x41')){var _0x1863cc={};_0x1863cc[_0x505c09['name']]={'$like':'%'+_0x34d2b8[_0x7761('0x32')][_0x7761('0x3e')]+'%'};return _0x1863cc;}})});}_0x447440=_['merge']({},_0x447440,_0x34d2b8[_0x7761('0x42')]);var _0x4cb5dd={'where':_0x447440[_0x7761('0x3f')]};return db['Pause'][_0x7761('0x20')](_0x4cb5dd)[_0x7761('0x26')](function(_0x336315){_0x56c559[_0x7761('0x20')]=_0x336315;if(_0x34d2b8['query']['includeAll']){_0x447440['include']=[{'all':!![]}];}return db['Pause'][_0x7761('0x43')](_0x447440);})[_0x7761('0x26')](function(_0x9781c5){_0x56c559['rows']=_0x9781c5;return _0x56c559;})[_0x7761('0x26')](respondWithFilteredResult(_0x566e5c,_0x447440))[_0x7761('0x44')](handleError(_0x566e5c,null));};exports['show']=function(_0x5a7c3f,_0x5c786b){var _0x380807={'raw':!![],'where':{'id':_0x5a7c3f[_0x7761('0x45')]['id']}},_0xd6d56d={};_0xd6d56d[_0x7761('0x35')]=_['keys'](db[_0x7761('0x46')][_0x7761('0x30')]);_0xd6d56d[_0x7761('0x32')]=_[_0x7761('0x33')](_0x5a7c3f[_0x7761('0x32')]);_0xd6d56d[_0x7761('0x3d')]=_['intersection'](_0xd6d56d[_0x7761('0x35')],_0xd6d56d[_0x7761('0x32')]);_0x380807[_0x7761('0x36')]=_[_0x7761('0x34')](_0xd6d56d[_0x7761('0x35')],qs['fields'](_0x5a7c3f[_0x7761('0x32')][_0x7761('0x37')]));_0x380807[_0x7761('0x36')]=_0x380807[_0x7761('0x36')][_0x7761('0x38')]?_0x380807[_0x7761('0x36')]:_0xd6d56d[_0x7761('0x35')];if(_0x5a7c3f[_0x7761('0x32')][_0x7761('0x47')]){_0x380807[_0x7761('0x48')]=[{'all':!![]}];}_0x380807=_[_0x7761('0x40')]({},_0x380807,_0x5a7c3f[_0x7761('0x42')]);return db[_0x7761('0x46')][_0x7761('0x49')](_0x380807)[_0x7761('0x26')](handleEntityNotFound(_0x5c786b,null))[_0x7761('0x26')](respondWithResult(_0x5c786b,null))[_0x7761('0x44')](handleError(_0x5c786b,null));};exports[_0x7761('0x4a')]=function(_0x56d69c,_0x5bf007){return db[_0x7761('0x46')]['create'](_0x56d69c['body'],{})[_0x7761('0x26')](function(_0x1639f0){var _0x58010c=_0x56d69c[_0x7761('0x4b')]['get']({'plain':!![]});if(!_0x58010c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x58010c['role']==='user'){var _0x16fb19=_0x1639f0[_0x7761('0x28')]({'plain':!![]});var _0x499ee8=_0x7761('0x4c');return db[_0x7761('0x4d')][_0x7761('0x49')]({'where':{'name':_0x499ee8,'userProfileId':_0x58010c[_0x7761('0x4e')]},'raw':!![]})[_0x7761('0x26')](function(_0x222327){if(_0x222327&&_0x222327[_0x7761('0x4f')]===0x0){return db[_0x7761('0x29')][_0x7761('0x4a')]({'name':_0x16fb19[_0x7761('0x2d')],'resourceId':_0x16fb19['id'],'type':_0x222327[_0x7761('0x2d')],'sectionId':_0x222327['id']},{})['then'](function(){return _0x1639f0;});}else{return _0x1639f0;}})[_0x7761('0x44')](function(_0x5a7f5e){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5a7f5e);throw _0x5a7f5e;});}return _0x1639f0;})['then'](respondWithResult(_0x5bf007,0xc9))[_0x7761('0x44')](handleError(_0x5bf007,null));};exports[_0x7761('0x50')]=function(_0x3d9d6d,_0x2f0194){if(_0x3d9d6d[_0x7761('0x51')]['id']){delete _0x3d9d6d[_0x7761('0x51')]['id'];}return db[_0x7761('0x46')][_0x7761('0x49')]({'where':{'id':_0x3d9d6d[_0x7761('0x45')]['id']}})['then'](handleEntityNotFound(_0x2f0194,null))[_0x7761('0x26')](saveUpdates(_0x3d9d6d['body'],null))[_0x7761('0x26')](respondWithResult(_0x2f0194,null))[_0x7761('0x44')](handleError(_0x2f0194,null));};exports[_0x7761('0x27')]=function(_0x58310c,_0x3b4205){return db[_0x7761('0x46')]['find']({'where':{'id':_0x58310c[_0x7761('0x45')]['id']}})[_0x7761('0x26')](handleEntityNotFound(_0x3b4205,null))[_0x7761('0x26')](removeEntity(_0x3b4205,null))[_0x7761('0x44')](handleError(_0x3b4205,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index b9f6b86..0795ffd 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 _0x53ec=['bluebird','path','../../config/environment','./pause.attributes','define','Pause','lodash','util','../../config/logger','api','moment'];(function(_0x36fe08,_0x18272b){var _0x11df52=function(_0x2f8d5a){while(--_0x2f8d5a){_0x36fe08['push'](_0x36fe08['shift']());}};_0x11df52(++_0x18272b);}(_0x53ec,0x192));var _0xc53e=function(_0x2ac71a,_0x1d2a02){_0x2ac71a=_0x2ac71a-0x0;var _0x3ee904=_0x53ec[_0x2ac71a];return _0x3ee904;};'use strict';var _=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var logger=require(_0xc53e('0x2'))(_0xc53e('0x3'));var moment=require(_0xc53e('0x4'));var BPromise=require(_0xc53e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc53e('0x6'));var rimraf=require('rimraf');var config=require(_0xc53e('0x7'));var attributes=require(_0xc53e('0x8'));module['exports']=function(_0x2f1414,_0x4f989b){return _0x2f1414[_0xc53e('0x9')](_0xc53e('0xa'),attributes,{'tableName':'tools_pauses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x326f=['tools_pauses','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./pause.attributes','exports','define','Pause'];(function(_0x2c79ae,_0x59aaeb){var _0x45c3d9=function(_0x23ef77){while(--_0x23ef77){_0x2c79ae['push'](_0x2c79ae['shift']());}};_0x45c3d9(++_0x59aaeb);}(_0x326f,0xd1));var _0xf326=function(_0x13dd0d,_0x516a53){_0x13dd0d=_0x13dd0d-0x0;var _0x3012a4=_0x326f[_0x13dd0d];return _0x3012a4;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf326('0x1'));var moment=require(_0xf326('0x2'));var BPromise=require(_0xf326('0x3'));var rp=require(_0xf326('0x4'));var fs=require('fs');var path=require(_0xf326('0x5'));var rimraf=require(_0xf326('0x6'));var config=require(_0xf326('0x7'));var attributes=require(_0xf326('0x8'));module[_0xf326('0x9')]=function(_0x3ace29,_0x4c2249){return _0x3ace29[_0xf326('0xa')](_0xf326('0xb'),attributes,{'tableName':_0xf326('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/pause/pause.rpc.js b/server/api/pause/pause.rpc.js index f552787..2fff70f 100644 --- a/server/api/pause/pause.rpc.js +++ b/server/api/pause/pause.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Pause,\x20%s,\x20%s','Pause,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','ShowPause','Pause','find','options','raw','where','attributes','map','include','model','debug'];(function(_0x4aa43f,_0x5b82ed){var _0x53f243=function(_0x238d75){while(--_0x238d75){_0x4aa43f['push'](_0x4aa43f['shift']());}};_0x53f243(++_0x5b82ed);}(_0xb10b,0x12a));var _0xbb10=function(_0x395739,_0x39a094){_0x395739=_0x395739-0x0;var _0x3c244e=_0xb10b[_0x395739];return _0x3c244e;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')]({'raw':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8[_0xbb10('0x18')]?_0x378da8['options'][_0xbb10('0x1b')]||null:null,'include':_0x378da8[_0xbb10('0x18')]?_0x378da8['options']['include']?_[_0xbb10('0x1c')](_0x378da8[_0xbb10('0x18')][_0xbb10('0x1d')],function(_0x317da4){return{'model':db[_0x317da4[_0xbb10('0x1e')]],'as':_0x317da4['as'],'attributes':_0x317da4[_0xbb10('0x1b')],'include':_0x317da4[_0xbb10('0x1d')]?_[_0xbb10('0x1c')](_0x317da4[_0xbb10('0x1d')],function(_0x395404){return{'model':db[_0x395404[_0xbb10('0x1e')]],'as':_0x395404['as'],'attributes':_0x395404[_0xbb10('0x1b')],'include':_0x395404['include']?_['map'](_0x395404['include'],function(_0xc93a04){return{'model':db[_0xc93a04[_0xbb10('0x1e')]],'as':_0xc93a04['as'],'attributes':_0xc93a04[_0xbb10('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2fdde9){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1f')](_0xbb10('0x15'),_0x378da8,JSON[_0xbb10('0x11')](_0x2fdde9));_0x575cca(_0x2fdde9);})[_0xbb10('0x20')](function(_0x4aabb9){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x4aabb9[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x4aabb9[_0xbb10('0x13')]));});});}; \ No newline at end of file +var _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(_0x2aa66c,_0x3713fa){var _0x275168=function(_0x1c8e35){while(--_0x1c8e35){_0x2aa66c['push'](_0x2aa66c['shift']());}};_0x275168(++_0x3713fa);}(_0x7a54,0x106));var _0x47a5=function(_0x566a11,_0x3b41fb){_0x566a11=_0x566a11-0x0;var _0xa43f8b=_0x7a54[_0x566a11];return _0xa43f8b;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Pause,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['ShowPause']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')]({'raw':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')][_0x47a5('0x18')]===undefined?!![]:![]:!![],'where':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x19')]||null:null,'attributes':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x1a')]||null:null,'include':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')]['include']?_[_0x47a5('0x1b')](_0x5247fd[_0x47a5('0x17')][_0x47a5('0x1c')],function(_0x7a9f9e){return{'model':db[_0x7a9f9e['model']],'as':_0x7a9f9e['as'],'attributes':_0x7a9f9e[_0x47a5('0x1a')],'include':_0x7a9f9e[_0x47a5('0x1c')]?_['map'](_0x7a9f9e[_0x47a5('0x1c')],function(_0xc4cd63){return{'model':db[_0xc4cd63[_0x47a5('0x1d')]],'as':_0xc4cd63['as'],'attributes':_0xc4cd63[_0x47a5('0x1a')],'include':_0xc4cd63[_0x47a5('0x1c')]?_['map'](_0xc4cd63['include'],function(_0x136745){return{'model':db[_0x136745['model']],'as':_0x136745['as'],'attributes':_0x136745[_0x47a5('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x23cb77){logger[_0x47a5('0xb')](_0x47a5('0x1e'),_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1e'),_0x5247fd,JSON[_0x47a5('0xe')](_0x23cb77));_0xaf70a6(_0x23cb77);})[_0x47a5('0x14')](function(_0x136b14){logger[_0x47a5('0xf')](_0x47a5('0x1e'),_0x136b14[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81[_0x47a5('0xf')](0x1f4,_0x136b14[_0x47a5('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/index.js b/server/api/plugin/index.js index f2768b8..8801944 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 _0xf72b=['./plugin.controller','get','isAuthenticated','/webhook','webhookGet','/:id','download','join','root','server/files/plugins','originalname','replace','%s-%s%s','now','extname','post','single','upload','webhookPost','put','update','delete','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x550d12,_0x5384bd){var _0x12103d=function(_0x2a9834){while(--_0x2a9834){_0x550d12['push'](_0x550d12['shift']());}};_0x12103d(++_0x5384bd);}(_0xf72b,0x1d9));var _0xbf72=function(_0x3f9169,_0x446823){_0x3f9169=_0x3f9169-0x0;var _0x535fee=_0xf72b[_0x3f9169];return _0x535fee;};'use strict';var multer=require(_0xbf72('0x0'));var util=require('util');var path=require(_0xbf72('0x1'));var timeout=require('connect-timeout');var express=require(_0xbf72('0x2'));var router=express[_0xbf72('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xbf72('0x4'));var interaction=require(_0xbf72('0x5'));var config=require(_0xbf72('0x6'));var controller=require(_0xbf72('0x7'));router[_0xbf72('0x8')]('/',auth[_0xbf72('0x9')](),controller['index']);router[_0xbf72('0x8')](_0xbf72('0xa'),controller[_0xbf72('0xb')]);router[_0xbf72('0x8')](_0xbf72('0xc'),auth[_0xbf72('0x9')](),controller['show']);router[_0xbf72('0x8')]('/:id/download',auth[_0xbf72('0x9')](),controller[_0xbf72('0xd')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0xaec095,_0x1c3453,_0x1853eb){_0x1853eb(null,path[_0xbf72('0xe')](config[_0xbf72('0xf')],_0xbf72('0x10')));},'filename':function(_0x14f6e6,_0x5eb4cc,_0x5967f5){_0x5eb4cc[_0xbf72('0x11')]=_0x5eb4cc[_0xbf72('0x11')][_0xbf72('0x12')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x5967f5(null,util['format'](_0xbf72('0x13'),path['basename'](_0x5eb4cc['originalname'],path['extname'](_0x5eb4cc[_0xbf72('0x11')])),Date[_0xbf72('0x14')](),path[_0xbf72('0x15')](_0x5eb4cc[_0xbf72('0x11')])));}})});router[_0xbf72('0x16')]('/',upload[_0xbf72('0x17')]('file'),controller[_0xbf72('0x18')]);router[_0xbf72('0x16')](_0xbf72('0xa'),controller[_0xbf72('0x19')]);router[_0xbf72('0x1a')]('/:id',auth['isAuthenticated'](),controller[_0xbf72('0x1b')]);router[_0xbf72('0x1c')](_0xbf72('0xc'),auth[_0xbf72('0x9')](),controller[_0xbf72('0x1c')]);module[_0xbf72('0x1d')]=router; \ No newline at end of file +var _0x524a=['show','/:id/download','diskStorage','join','root','server/files/plugins','originalname','format','basename','now','extname','post','single','file','/webhook','webhookPost','put','/:id','update','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','./plugin.controller','get','isAuthenticated','webhookGet'];(function(_0x4f1cd3,_0x23de4c){var _0x5f07b8=function(_0x1f98c2){while(--_0x1f98c2){_0x4f1cd3['push'](_0x4f1cd3['shift']());}};_0x5f07b8(++_0x23de4c);}(_0x524a,0xf5));var _0xa524=function(_0x29cecd,_0x6878ea){_0x29cecd=_0x29cecd-0x0;var _0x5f0401=_0x524a[_0x29cecd];return _0x5f0401;};'use strict';var multer=require(_0xa524('0x0'));var util=require(_0xa524('0x1'));var path=require(_0xa524('0x2'));var timeout=require(_0xa524('0x3'));var express=require('express');var router=express[_0xa524('0x4')]();var fs_extra=require(_0xa524('0x5'));var auth=require(_0xa524('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xa524('0x7'));router[_0xa524('0x8')]('/',auth[_0xa524('0x9')](),controller['index']);router[_0xa524('0x8')]('/webhook',controller[_0xa524('0xa')]);router[_0xa524('0x8')]('/:id',auth[_0xa524('0x9')](),controller[_0xa524('0xb')]);router[_0xa524('0x8')](_0xa524('0xc'),auth[_0xa524('0x9')](),controller['download']);var upload=multer({'storage':multer[_0xa524('0xd')]({'destination':function(_0x2ebea2,_0x59660a,_0x565fab){_0x565fab(null,path[_0xa524('0xe')](config[_0xa524('0xf')],_0xa524('0x10')));},'filename':function(_0x4936fa,_0x55117f,_0x14a0d6){_0x55117f['originalname']=_0x55117f[_0xa524('0x11')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x14a0d6(null,util[_0xa524('0x12')]('%s-%s%s',path[_0xa524('0x13')](_0x55117f[_0xa524('0x11')],path['extname'](_0x55117f[_0xa524('0x11')])),Date[_0xa524('0x14')](),path[_0xa524('0x15')](_0x55117f[_0xa524('0x11')])));}})});router[_0xa524('0x16')]('/',upload[_0xa524('0x17')](_0xa524('0x18')),controller['upload']);router[_0xa524('0x16')](_0xa524('0x19'),controller[_0xa524('0x1a')]);router[_0xa524('0x1b')](_0xa524('0x1c'),auth[_0xa524('0x9')](),controller[_0xa524('0x1d')]);router[_0xa524('0x1e')]('/:id',auth[_0xa524('0x9')](),controller[_0xa524('0x1e')]);module[_0xa524('0x1f')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index d949e80..c22c842 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 _0x14e2=['STRING','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','adminOnly','agentOnly','always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','exports','ENUM','html','script','TEXT'];(function(_0x33715a,_0x4f7afe){var _0x12b8bc=function(_0x165f7b){while(--_0x165f7b){_0x33715a['push'](_0x33715a['shift']());}};_0x12b8bc(++_0x4f7afe);}(_0x14e2,0x118));var _0x214e=function(_0x5834bc,_0x3d4801){_0x5834bc=_0x5834bc-0x0;var _0x3e183a=_0x14e2[_0x5834bc];return _0x3e183a;};'use strict';var Sequelize=require(_0x214e('0x0'));module[_0x214e('0x1')]={'name':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x214e('0x2')](_0x214e('0x3'),_0x214e('0x4'))},'description':{'type':Sequelize[_0x214e('0x5')]},'version':{'type':Sequelize[_0x214e('0x5')]},'path':{'type':Sequelize[_0x214e('0x6')],'comment':_0x214e('0x7')},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'},'sidebar':{'type':Sequelize[_0x214e('0x2')](_0x214e('0x8'),_0x214e('0x9'),_0x214e('0xa'),_0x214e('0xb')),'defaultValue':_0x214e('0xa'),'comment':_0x214e('0xc')},'icon':{'type':Sequelize[_0x214e('0x6')]},'adminUrl':{'type':Sequelize[_0x214e('0x6')]},'agentUrl':{'type':Sequelize['STRING']},'scriptName':{'type':Sequelize[_0x214e('0x6')]},'scriptPath':{'type':Sequelize[_0x214e('0x6')]}}; \ No newline at end of file +var _0x5592=['never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','exports','STRING','script','TEXT','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','ENUM','adminOnly','agentOnly','always'];(function(_0xceacf3,_0x4ecb97){var _0x2086b5=function(_0x3df51b){while(--_0x3df51b){_0xceacf3['push'](_0xceacf3['shift']());}};_0x2086b5(++_0x4ecb97);}(_0x5592,0xab));var _0x2559=function(_0x4ecf10,_0x1f6ea7){_0x4ecf10=_0x4ecf10-0x0;var _0x2e737b=_0x5592[_0x4ecf10];return _0x2e737b;};'use strict';var Sequelize=require(_0x2559('0x0'));module[_0x2559('0x1')]={'name':{'type':Sequelize[_0x2559('0x2')]},'type':{'type':Sequelize['ENUM']('html',_0x2559('0x3'))},'description':{'type':Sequelize[_0x2559('0x4')]},'version':{'type':Sequelize[_0x2559('0x4')]},'path':{'type':Sequelize['STRING'],'comment':'The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.'},'active':{'type':Sequelize[_0x2559('0x5')],'defaultValue':0x0,'comment':_0x2559('0x6')},'sidebar':{'type':Sequelize[_0x2559('0x7')](_0x2559('0x8'),_0x2559('0x9'),_0x2559('0xa'),_0x2559('0xb')),'defaultValue':_0x2559('0xa'),'comment':_0x2559('0xc')},'icon':{'type':Sequelize[_0x2559('0x2')]},'adminUrl':{'type':Sequelize['STRING']},'agentUrl':{'type':Sequelize[_0x2559('0x2')]},'scriptName':{'type':Sequelize[_0x2559('0x2')]},'scriptPath':{'type':Sequelize[_0x2559('0x2')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index ebb36dd..4ef4b87 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 _0x2034=['undefined','count','offset','set','Content-Range','apply','save','update','then','get','destroy','name','send','map','Plugin','fieldName','key','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','filter','type','VIRTUAL','merge','includeAll','include','findAll','catch','show','keys','rawAttributes','options','find','params','path','join','root','server/files/plugins','format','%s.zip','basename','zip','warning','ENOENT','Sequelize','Error\x20while\x20generating\x20the\x20zip\x20archive','error','Error','pipe','**/*','dirname','node_modules/**/*','attachments/**/*','finalize','close','Plugin\x20not\x20found','download','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Download\x20completed','Temporary\x20file\x20removed','upload','file','filename','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isDirectory','some','manifest.json','Plugin\x20manifest\x20missing','readFileSync','parse','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','views','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','Invalid\x20manifest:\x20script\x20path\x20missing','description','sidebar','always','icon','icon-apps','admin','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','create','body','role','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','Plugins','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','%s%s','headers','content-length','content-type','endsWith','statusCode','webhookPost','\x27PORT\x27\x20parameter\x20not\x20specified','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./plugin.socket','sendStatus','status','json'];(function(_0x325b84,_0x549f57){var _0x1f7b96=function(_0x10765f){while(--_0x10765f){_0x325b84['push'](_0x325b84['shift']());}};_0x1f7b96(++_0x549f57);}(_0x2034,0x1d0));var _0x4203=function(_0x40acb1,_0x3e2217){_0x40acb1=_0x40acb1-0x0;var _0x359351=_0x2034[_0x40acb1];return _0x359351;};'use strict';var emlformat=require(_0x4203('0x0'));var rimraf=require(_0x4203('0x1'));var zipdir=require(_0x4203('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4203('0x3'));var moment=require('moment');var BPromise=require(_0x4203('0x4'));var Mustache=require(_0x4203('0x5'));var util=require(_0x4203('0x6'));var path=require('path');var sox=require(_0x4203('0x7'));var csv=require(_0x4203('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4203('0x9'));var _=require(_0x4203('0xa'));var squel=require(_0x4203('0xb'));var crypto=require('crypto');var jsforce=require(_0x4203('0xc'));var deskjs=require(_0x4203('0xd'));var toCsv=require(_0x4203('0x8'));var querystring=require(_0x4203('0xe'));var Papa=require('papaparse');var extract=require('extract-zip');var rimraf=require('rimraf');var archiver=require('archiver');var Redis=require(_0x4203('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x4203('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x4203('0x11'));var utils=require(_0x4203('0x12'));var config=require(_0x4203('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x4203('0x14'))['db'];config[_0x4203('0x15')]=_['defaults'](config[_0x4203('0x15')],{'host':_0x4203('0x16'),'port':0x18eb});var socket=require(_0x4203('0x17'))(new Redis(config[_0x4203('0x15')]));require(_0x4203('0x18'))['register'](socket);function respondWithStatusCode(_0x3f9859,_0x5a6f64){_0x5a6f64=_0x5a6f64||0xcc;return function(_0x18f036){if(_0x18f036){return _0x3f9859[_0x4203('0x19')](_0x5a6f64);}return _0x3f9859[_0x4203('0x1a')](_0x5a6f64)['end']();};}function respondWithResult(_0x36c7d5,_0x531782){_0x531782=_0x531782||0xc8;return function(_0x4d0efa){if(_0x4d0efa){return _0x36c7d5['status'](_0x531782)[_0x4203('0x1b')](_0x4d0efa);}};}function respondWithFilteredResult(_0xad7e49,_0x45f662){return function(_0x79d229){if(_0x79d229){var _0x41d808=typeof _0x45f662['offset']===_0x4203('0x1c')&&typeof _0x45f662['limit']===_0x4203('0x1c');var _0x219fd8=_0x79d229[_0x4203('0x1d')];var _0x2a931b=_0x41d808?0x0:_0x45f662[_0x4203('0x1e')];var _0x54871b=_0x41d808?_0x79d229[_0x4203('0x1d')]:_0x45f662[_0x4203('0x1e')]+_0x45f662['limit'];var _0x5b7922;if(_0x54871b>=_0x219fd8){_0x54871b=_0x219fd8;_0x5b7922=0xc8;}else{_0x5b7922=0xce;}_0xad7e49[_0x4203('0x1a')](_0x5b7922);return _0xad7e49[_0x4203('0x1f')](_0x4203('0x20'),_0x2a931b+'-'+_0x54871b+'/'+_0x219fd8)[_0x4203('0x1b')](_0x79d229);}return null;};}function patchUpdates(_0x355d91){return function(_0x1a7ba1){try{jsonpatch[_0x4203('0x21')](_0x1a7ba1,_0x355d91,!![]);}catch(_0x5d1808){return BPromise['reject'](_0x5d1808);}return _0x1a7ba1[_0x4203('0x22')]();};}function saveUpdates(_0x1d6f90,_0x30c413){return function(_0x2d0c03){if(_0x2d0c03){return _0x2d0c03[_0x4203('0x23')](_0x1d6f90)[_0x4203('0x24')](function(_0x193e19){return _0x193e19;});}return null;};}function removeEntity(_0x29b9e,_0x4a60c3){return function(_0x4a241e){if(_0x4a241e){return _0x4a241e['destroy']()[_0x4203('0x24')](function(){var _0x4548e3=_0x4a241e[_0x4203('0x25')]({'plain':!![]});var _0x494313='Plugins';return db['UserProfileResource'][_0x4203('0x26')]({'where':{'type':_0x494313,'resourceId':_0x4548e3['id']}})[_0x4203('0x24')](function(){return _0x4a241e;});})[_0x4203('0x24')](function(){_0x29b9e['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4a0057,_0x40c419){return function(_0x26cb26){if(!_0x26cb26){_0x4a0057['sendStatus'](0x194);}return _0x26cb26;};}function handleError(_0x3c2363,_0x3a1ede){_0x3a1ede=_0x3a1ede||0x1f4;return function(_0x1fb082){logger['error'](_0x1fb082['stack']);if(_0x1fb082['name']){delete _0x1fb082[_0x4203('0x27')];}_0x3c2363['status'](_0x3a1ede)[_0x4203('0x28')](_0x1fb082);};}exports['index']=function(_0x58af2b,_0x5a23b9){var _0x313287={},_0x1b9b9c={},_0x32ec49={'count':0x0,'rows':[]};var _0x3c4ea4=_[_0x4203('0x29')](db[_0x4203('0x2a')]['rawAttributes'],function(_0x608044){return{'name':_0x608044[_0x4203('0x2b')],'type':_0x608044['type'][_0x4203('0x2c')]};});_0x1b9b9c['model']=_['map'](_0x3c4ea4,_0x4203('0x27'));_0x1b9b9c['query']=_['keys'](_0x58af2b[_0x4203('0x2d')]);_0x1b9b9c['filters']=_[_0x4203('0x2e')](_0x1b9b9c[_0x4203('0x2f')],_0x1b9b9c[_0x4203('0x2d')]);_0x313287[_0x4203('0x30')]=_[_0x4203('0x2e')](_0x1b9b9c[_0x4203('0x2f')],qs[_0x4203('0x31')](_0x58af2b[_0x4203('0x2d')][_0x4203('0x31')]));_0x313287[_0x4203('0x30')]=_0x313287[_0x4203('0x30')][_0x4203('0x32')]?_0x313287[_0x4203('0x30')]:_0x1b9b9c[_0x4203('0x2f')];if(!_0x58af2b['query'][_0x4203('0x33')](_0x4203('0x34'))){_0x313287[_0x4203('0x35')]=qs[_0x4203('0x35')](_0x58af2b[_0x4203('0x2d')]['limit']);_0x313287['offset']=qs['offset'](_0x58af2b[_0x4203('0x2d')]['offset']);}_0x313287[_0x4203('0x36')]=qs[_0x4203('0x37')](_0x58af2b[_0x4203('0x2d')][_0x4203('0x37')]);_0x313287[_0x4203('0x38')]=qs[_0x4203('0x39')](_['pick'](_0x58af2b[_0x4203('0x2d')],_0x1b9b9c[_0x4203('0x39')]),_0x3c4ea4);if(_0x58af2b[_0x4203('0x2d')][_0x4203('0x3a')]){_0x313287[_0x4203('0x38')]=_['merge'](_0x313287['where'],{'$or':_[_0x4203('0x29')](_0x3c4ea4,function(_0x3632e8){if(_0x3632e8[_0x4203('0x3b')]!==_0x4203('0x3c')){var _0x3bda4f={};_0x3bda4f[_0x3632e8[_0x4203('0x27')]]={'$like':'%'+_0x58af2b['query'][_0x4203('0x3a')]+'%'};return _0x3bda4f;}})});}_0x313287=_[_0x4203('0x3d')]({},_0x313287,_0x58af2b['options']);var _0x26f373={'where':_0x313287[_0x4203('0x38')]};return db['Plugin']['count'](_0x26f373)[_0x4203('0x24')](function(_0x1ec30c){_0x32ec49[_0x4203('0x1d')]=_0x1ec30c;if(_0x58af2b[_0x4203('0x2d')][_0x4203('0x3e')]){_0x313287[_0x4203('0x3f')]=[{'all':!![]}];}return db[_0x4203('0x2a')][_0x4203('0x40')](_0x313287);})[_0x4203('0x24')](function(_0x451e9b){_0x32ec49['rows']=_0x451e9b;return _0x32ec49;})[_0x4203('0x24')](respondWithFilteredResult(_0x5a23b9,_0x313287))[_0x4203('0x41')](handleError(_0x5a23b9,null));};exports[_0x4203('0x42')]=function(_0x2527f6,_0x457898){var _0x8476ef={'raw':!![],'where':{'id':_0x2527f6['params']['id']}},_0x5ee187={};_0x5ee187['model']=_[_0x4203('0x43')](db[_0x4203('0x2a')][_0x4203('0x44')]);_0x5ee187['query']=_[_0x4203('0x43')](_0x2527f6[_0x4203('0x2d')]);_0x5ee187[_0x4203('0x39')]=_[_0x4203('0x2e')](_0x5ee187[_0x4203('0x2f')],_0x5ee187['query']);_0x8476ef[_0x4203('0x30')]=_[_0x4203('0x2e')](_0x5ee187[_0x4203('0x2f')],qs[_0x4203('0x31')](_0x2527f6[_0x4203('0x2d')]['fields']));_0x8476ef['attributes']=_0x8476ef[_0x4203('0x30')][_0x4203('0x32')]?_0x8476ef[_0x4203('0x30')]:_0x5ee187[_0x4203('0x2f')];if(_0x2527f6['query'][_0x4203('0x3e')]){_0x8476ef[_0x4203('0x3f')]=[{'all':!![]}];}_0x8476ef=_[_0x4203('0x3d')]({},_0x8476ef,_0x2527f6[_0x4203('0x45')]);return db['Plugin'][_0x4203('0x46')](_0x8476ef)['then'](handleEntityNotFound(_0x457898,null))[_0x4203('0x24')](respondWithResult(_0x457898,null))[_0x4203('0x41')](handleError(_0x457898,null));};exports['download']=function(_0x2ad3bc,_0x173185,_0x5df210){return db[_0x4203('0x2a')][_0x4203('0x46')]({'where':{'id':_0x2ad3bc[_0x4203('0x47')]['id']},'attributes':[_0x4203('0x27'),_0x4203('0x48')],'raw':!![]})[_0x4203('0x24')](handleEntityNotFound(_0x173185,null))[_0x4203('0x24')](function(_0x2fd289){if(_0x2fd289){var _0x57301f=path[_0x4203('0x49')](config[_0x4203('0x4a')],_0x4203('0x4b'),util[_0x4203('0x4c')](_0x4203('0x4d'),path[_0x4203('0x4e')](_0x2fd289[_0x4203('0x48')])));var _0x57f92d=fs['createWriteStream'](_0x57301f);var _0x190769=archiver(_0x4203('0x4f'),{'zlib':{'level':0x9}});_0x190769['on'](_0x4203('0x50'),function(_0x18fe53){if(_0x18fe53['code']===_0x4203('0x51')){logger['error'](_0x18fe53);}else{throw new db[(_0x4203('0x52'))]['Error'](_0x4203('0x53'));}});_0x190769['on'](_0x4203('0x54'),function(_0x46b82a){throw new db[(_0x4203('0x52'))][(_0x4203('0x55'))](_0x4203('0x53'));});_0x190769[_0x4203('0x56')](_0x57f92d);_0x190769['glob'](_0x4203('0x57'),{'cwd':path[_0x4203('0x49')](config[_0x4203('0x4a')],'server/files/plugins',path[_0x4203('0x58')](_0x2fd289['path'])),'ignore':[path['join'](path[_0x4203('0x4e')](_0x2fd289['path']),_0x4203('0x59')),path['join'](path[_0x4203('0x4e')](_0x2fd289['path']),_0x4203('0x5a'))],'nodir':!![]})[_0x4203('0x5b')]();_0x57f92d['on'](_0x4203('0x5c'),function(){if(!fs['existsSync'](_0x57301f)){throw new db[(_0x4203('0x52'))]['Error'](_0x4203('0x5d'));}return _0x173185[_0x4203('0x5e')](_0x57301f,util['format'](_0x4203('0x4d'),path[_0x4203('0x4e')](_0x2fd289[_0x4203('0x48')])),function(_0x5734e3){if(_0x5734e3){throw new db['Sequelize'][(_0x4203('0x55'))](_0x4203('0x5f'));}fs[_0x4203('0x60')](_0x57301f);logger[_0x4203('0x61')](_0x4203('0x62'));logger['info'](_0x4203('0x63'));});});}return null;})[_0x4203('0x41')](handleError(_0x173185,null));};exports[_0x4203('0x64')]=function(_0x659d6f,_0x3baf31,_0x4dc839){var _0x5a797a=path[_0x4203('0x4e')](_0x659d6f[_0x4203('0x65')][_0x4203('0x66')],path['extname'](_0x659d6f[_0x4203('0x65')]['filename']));var _0x132964=path[_0x4203('0x49')](config['root'],'server/files/plugins',_0x659d6f[_0x4203('0x65')]['filename']);var _0xc498e9=path[_0x4203('0x49')](config['root'],_0x4203('0x4b'),_0x5a797a);logger[_0x4203('0x61')](_0x4203('0x67'),_0x132964);logger[_0x4203('0x61')](_0x4203('0x68'),_0xc498e9);try{fs['chmodSync'](_0x132964,parseInt(_0x4203('0x69'),0x8));extract(_0x132964,{'dir':_0xc498e9},function(_0x3637f8){if(_0x3637f8){logger['error'](_0x3637f8);handleError(_0x3637f8,!![]);};var _0x267d03=fs[_0x4203('0x6a')](_0xc498e9);if(_0x267d03[_0x4203('0x32')]>0x1){removeReferences(_0x132964,_0xc498e9);logger[_0x4203('0x54')]('Invalid\x20plugin\x20structure');return _0x4dc839(new Error(_0x4203('0x6b')));}var _0x16e287=fs[_0x4203('0x6c')](path[_0x4203('0x49')](_0xc498e9,_0x267d03[0x0]));if(_0x16e287['isFile']()){removeReferences(_0x132964,_0xc498e9);logger[_0x4203('0x54')]('Invalid\x20plugin\x20structure');return _0x4dc839(new Error(_0x4203('0x6b')));}if(_0x16e287[_0x4203('0x6d')]()){var _0x36395c=fs[_0x4203('0x6a')](path[_0x4203('0x49')](_0xc498e9,_0x267d03[0x0]));if(_0x36395c[_0x4203('0x32')]===0x0){removeReferences(_0x132964,_0xc498e9);logger[_0x4203('0x54')]('Invalid\x20plugin\x20structure');return _0x4dc839(new Error(_0x4203('0x6b')));}var _0x4f45e1=_0x36395c[_0x4203('0x6e')](function(_0x974084){return _0x974084===_0x4203('0x6f');});if(!_0x4f45e1){return _0x4dc839(new Error(_0x4203('0x70')));}var _0x328e96=fs[_0x4203('0x71')](path[_0x4203('0x49')](_0xc498e9,_0x267d03[0x0],_0x4203('0x6f')));var _0x322db7=JSON[_0x4203('0x72')](_0x328e96);if(_0x4203('0x1c')==typeof _0x322db7[_0x4203('0x27')]){return _0x4dc839(new Error(_0x4203('0x73')));}if('undefined'==typeof _0x322db7['type']){return _0x4dc839(new Error(_0x4203('0x74')));}if('undefined'==typeof _0x322db7[_0x4203('0x75')]){return _0x4dc839(new Error(_0x4203('0x76')));}if(_0x4203('0x1c')==typeof _0x322db7[_0x4203('0x77')]){return _0x4dc839(new Error(_0x4203('0x78')));}if(_0x322db7[_0x4203('0x3b')]===_0x4203('0x79')){if(_0x4203('0x1c')==typeof _0x322db7[_0x4203('0x77')][_0x4203('0x7a')]){return _0x4dc839(new Error('Invalid\x20manifest:\x20views\x20missing'));}if(_0x4203('0x1c')==typeof _0x322db7[_0x4203('0x77')][_0x4203('0x7a')]['admin']&&'undefined'==typeof _0x322db7[_0x4203('0x77')]['views'][_0x4203('0x7b')]){return _0x4dc839(new Error(_0x4203('0x7c')));}}else if(_0x322db7['type']===_0x4203('0x7d')){if(_0x4203('0x1c')==typeof _0x322db7[_0x4203('0x77')][_0x4203('0x7e')]){return _0x4dc839(new Error(_0x4203('0x7f')));}if('undefined'==typeof _0x322db7[_0x4203('0x77')]['scriptPath']){return _0x4dc839(new Error(_0x4203('0x80')));}}else{return _0x4dc839(new Error('Invalid\x20manifest:\x20invalid\x20type'));}var _0x5562b3=_0x322db7['name'];var _0x4416a8=_0x322db7[_0x4203('0x81')];var _0x55d5ce=_0x322db7[_0x4203('0x3b')];var _0x498193=_0x322db7[_0x4203('0x82')]?_0x322db7[_0x4203('0x82')]:_0x4203('0x83');var _0x21c14d=_0x322db7[_0x4203('0x84')]?_0x322db7[_0x4203('0x84')]:_0x4203('0x85');var _0x3ad0f2='';var _0x2666bb='';var _0xd9dfb8='';var _0x3690e1='';var _0x2faa1e=_0x322db7[_0x4203('0x75')];if(_0x55d5ce===_0x4203('0x79')){if('undefined'!=typeof _0x322db7['parameters'][_0x4203('0x7a')][_0x4203('0x86')]){var _0x2827a8=_0x322db7[_0x4203('0x77')][_0x4203('0x7a')][_0x4203('0x86')];if(!/^(f|ht)tps?:\/\//i[_0x4203('0x87')](_0x2827a8)){_0x3ad0f2=path[_0x4203('0x49')](_0x4203('0x88'),_0x5a797a,_0x267d03[0x0],_0x2827a8);}else{_0x3ad0f2=_0x2827a8;}}else{logger[_0x4203('0x61')](_0x4203('0x89'));}if(_0x4203('0x1c')!=typeof _0x322db7['parameters'][_0x4203('0x7a')][_0x4203('0x7b')]){var _0x2c1d4b=_0x322db7[_0x4203('0x77')]['views'][_0x4203('0x7b')];if(!/^(f|ht)tps?:\/\//i['test'](_0x2c1d4b)){_0x2666bb=path['join']('plugins',_0x5a797a,_0x267d03[0x0],_0x2c1d4b);}else{_0x2666bb=_0x2c1d4b;}}else{logger[_0x4203('0x61')]('Warning:\x20agent\x20view\x20not\x20specified');}}else if(_0x55d5ce===_0x4203('0x7d')){_0xd9dfb8=_0x322db7[_0x4203('0x77')]['scriptName'];_0x3690e1=_0x322db7[_0x4203('0x77')]['scriptPath'];if(_0x4203('0x1c')!=typeof _0x322db7['parameters'][_0x4203('0x7a')]){if('undefined'!=typeof _0x322db7[_0x4203('0x77')][_0x4203('0x7a')]['admin']){var _0x2827a8=_0x322db7[_0x4203('0x77')][_0x4203('0x7a')][_0x4203('0x86')];if(!/^(f|ht)tps?:\/\//i['test'](_0x2827a8)){_0x3ad0f2=path[_0x4203('0x49')](_0x4203('0x88'),_0x5a797a,_0x267d03[0x0],_0x2827a8);}else{_0x3ad0f2=_0x2827a8;}}if('undefined'!=typeof _0x322db7[_0x4203('0x77')]['views'][_0x4203('0x7b')]){var _0x2c1d4b=_0x322db7[_0x4203('0x77')][_0x4203('0x7a')][_0x4203('0x7b')];if(!/^(f|ht)tps?:\/\//i[_0x4203('0x87')](_0x2c1d4b)){_0x2666bb=path['join'](_0x4203('0x88'),_0x5a797a,_0x267d03[0x0],_0x2c1d4b);}else{_0x2666bb=_0x2c1d4b;}}}}var _0x38f599={'name':_0x5562b3,'description':_0x4416a8,'path':path[_0x4203('0x49')](_0x5a797a,_0x267d03[0x0]),'type':_0x55d5ce,'sidebar':_0x498193,'icon':_0x21c14d,'adminUrl':_0x3ad0f2,'agentUrl':_0x2666bb,'scriptName':_0xd9dfb8,'scriptPath':_0x3690e1,'version':_0x2faa1e};removeReferences(_0x132964,null);return db['Plugin'][_0x4203('0x8a')](_0x38f599)[_0x4203('0x24')](function(_0x454eda){var _0x3ec806={'role':_0x659d6f[_0x4203('0x8b')][_0x4203('0x8c')],'userProfileId':_0x659d6f['body']['userProfileId']};if(!_0x3ec806)throw new Error(_0x4203('0x8d'));if(_0x3ec806[_0x4203('0x8c')]===_0x4203('0x8e')){var _0x21a144=_0x454eda[_0x4203('0x25')]({'plain':!![]});return db[_0x4203('0x8f')][_0x4203('0x46')]({'where':{'name':_0x4203('0x90'),'userProfileId':_0x3ec806['userProfileId']},'raw':!![]})[_0x4203('0x24')](function(_0x102c52){if(_0x102c52&&_0x102c52['autoAssociation']===0x0){return db['UserProfileResource'][_0x4203('0x8a')]({'name':_0x21a144[_0x4203('0x27')],'resourceId':_0x21a144['id'],'type':_0x102c52[_0x4203('0x27')],'sectionId':_0x102c52['id']},{})['then'](function(){return _0x454eda;});}else{return _0x454eda;}})[_0x4203('0x41')](function(_0x57f96e){logger['error'](_0x4203('0x91'),_0x57f96e);throw _0x57f96e;});}return _0x454eda;})[_0x4203('0x24')](respondWithResult(_0x3baf31,null))[_0x4203('0x41')](handleError(_0x3baf31,null));}});}catch(_0x50dcd5){_0x3baf31[_0x4203('0x1a')](0x1f4)[_0x4203('0x28')](_0x50dcd5);}};function removeReferences(_0x524a63,_0x5c5002){try{if(_0x524a63){fs['unlinkSync'](_0x524a63);logger['info'](_0x4203('0x92'));}if(_0x5c5002){rimraf(_0x5c5002,function(){});logger[_0x4203('0x61')](_0x4203('0x93'));}}catch(_0x35c9cb){logger[_0x4203('0x54')](_0x35c9cb);}}exports['update']=function(_0x5c1691,_0xc32cad,_0xc83329){return db[_0x4203('0x2a')][_0x4203('0x46')]({'where':{'id':_0x5c1691[_0x4203('0x47')]['id']}})['then'](handleEntityNotFound(_0xc32cad,null))[_0x4203('0x24')](saveUpdates(_0x5c1691[_0x4203('0x8b')],null))['then'](respondWithResult(_0xc32cad,null))[_0x4203('0x41')](handleError(_0xc32cad,null));};exports[_0x4203('0x94')]=function(_0x4413ea,_0x1075cc,_0x23bb6d){return db[_0x4203('0x2a')][_0x4203('0x46')]({'where':{'id':_0x4413ea['params']['id']}})[_0x4203('0x24')](function(_0x2a1273){if(_0x2a1273){return _0x2a1273[_0x4203('0x26')]();}})[_0x4203('0x24')](function(_0x16234d){rimraf(path['join'](config[_0x4203('0x4a')],_0x4203('0x4b'),path['dirname'](_0x16234d['path'])),function(){});return _0x16234d;})[_0x4203('0x24')](handleEntityNotFound(_0x1075cc,null))['then'](respondWithStatusCode(_0x1075cc,null))[_0x4203('0x41')](handleError(_0x1075cc,null));};exports[_0x4203('0x95')]=function(_0x3679ab,_0xab4a30,_0xfa8521){return BPromise[_0x4203('0x96')]()['then'](function(){if(!_0x3679ab[_0x4203('0x2d')]['path']){throw new Error(_0x4203('0x97'));}if(!_0x3679ab[_0x4203('0x2d')][_0x4203('0x98')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x433eca=_0x3679ab[_0x4203('0x2d')][_0x4203('0x99')]?_0x3679ab[_0x4203('0x2d')]['hostname']+':'+_0x3679ab['query']['port']:_0x4203('0x9a')+_0x3679ab[_0x4203('0x2d')][_0x4203('0x98')];var _0x2e0345=_0x3679ab[_0x4203('0x2d')][_0x4203('0x1b')]?_0x3679ab['query']['json']:!![];var _0x3a414c=_0x3679ab[_0x4203('0x2d')]['encoding']?_0x3679ab[_0x4203('0x2d')][_0x4203('0x9b')]:null;var _0x253030={'method':_0x3679ab['method'],'uri':util['format'](_0x4203('0x9c'),_0x433eca,_0x3679ab[_0x4203('0x2d')]['path']),'json':_0x2e0345,'resolveWithFullResponse':!![],'encoding':_0x3a414c,'qs':_0x3679ab[_0x4203('0x2d')]};if(_0x3679ab[_0x4203('0x9d')]){_0x253030['headers']=_0x3679ab[_0x4203('0x9d')];if(_0x253030[_0x4203('0x9d')][_0x4203('0x9e')]){delete _0x253030[_0x4203('0x9d')][_0x4203('0x9e')];}}if(_0x253030[_0x4203('0x9d')]['content-type']){delete _0x253030[_0x4203('0x9d')][_0x4203('0x9f')];}return rp(_0x253030);})[_0x4203('0x24')](function(_0x35d7f2){if(_0x35d7f2){_0xab4a30['set'](_0x35d7f2['headers']);logger['info'](_0x35d7f2['body']);if(_[_0x4203('0xa0')](_0x3679ab[_0x4203('0x2d')][_0x4203('0x48')],_0x4203('0x5e'))&&_0x35d7f2[_0x4203('0xa1')]==0x1f4){return _0xab4a30['sendStatus'](_0x35d7f2['statusCode']);}else{return _0xab4a30['status'](_0x35d7f2['statusCode'])[_0x4203('0x28')](_0x35d7f2[_0x4203('0x8b')]);}}else{return _0xab4a30['sendStatus'](0xc8);}})['catch'](handleError(_0xab4a30,null));};exports[_0x4203('0xa2')]=function(_0x47ad1b,_0x249d7d,_0x419d9c){return BPromise[_0x4203('0x96')]()['then'](function(){if(!_0x47ad1b['query'][_0x4203('0x48')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x47ad1b[_0x4203('0x2d')]['port']){throw new Error(_0x4203('0xa3'));}var _0x23b0f7=_0x47ad1b['query']['hostname']?_0x47ad1b[_0x4203('0x2d')]['hostname']+':'+_0x47ad1b[_0x4203('0x2d')][_0x4203('0x98')]:_0x4203('0x9a')+_0x47ad1b[_0x4203('0x2d')][_0x4203('0x98')];var _0x2f1ac9=_0x47ad1b[_0x4203('0x2d')][_0x4203('0x1b')]?_0x47ad1b['query'][_0x4203('0x1b')]:!![];var _0x3f61cc=_0x47ad1b[_0x4203('0x2d')]['encoding']?_0x47ad1b[_0x4203('0x2d')][_0x4203('0x9b')]:null;var _0x33a671={'method':_0x47ad1b['method'],'uri':util[_0x4203('0x4c')](_0x4203('0x9c'),_0x23b0f7,_0x47ad1b[_0x4203('0x2d')][_0x4203('0x48')]),'json':_0x2f1ac9,'resolveWithFullResponse':!![],'encoding':_0x3f61cc,'body':_0x47ad1b[_0x4203('0x8b')]};if(_0x47ad1b['headers']){_0x33a671['headers']=_0x47ad1b[_0x4203('0x9d')];if(_0x33a671[_0x4203('0x9d')][_0x4203('0x9e')]){delete _0x33a671[_0x4203('0x9d')][_0x4203('0x9e')];}}if(_0x33a671[_0x4203('0x9d')][_0x4203('0x9f')]){delete _0x33a671[_0x4203('0x9d')]['content-type'];}return rp(_0x33a671);})['then'](function(_0x1d69fb){if(_0x1d69fb){_0x249d7d[_0x4203('0x1f')](_0x1d69fb[_0x4203('0x9d')]);logger['info'](_0x1d69fb[_0x4203('0x8b')]);return _0x249d7d[_0x4203('0x1a')](_0x1d69fb['statusCode'])['send'](_0x1d69fb[_0x4203('0x8b')]);}else{return _0x249d7d[_0x4203('0x19')](0xc8);}})[_0x4203('0x41')](handleError(_0x249d7d,null));}; \ No newline at end of file +var _0xe964=['update','then','destroy','get','Plugins','error','name','send','map','Plugin','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','keys','length','catch','download','find','params','join','root','server/files/plugins','%s.zip','basename','createWriteStream','zip','warning','code','ENOENT','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','Sequelize','pipe','glob','**/*','dirname','node_modules/**/*','finalize','close','existsSync','Plugin\x20not\x20found','format','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','Download\x20completed','info','Temporary\x20file\x20removed','upload','filename','file','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','some','manifest.json','Plugin\x20manifest\x20missing','readFileSync','parse','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','html','Invalid\x20manifest:\x20views\x20missing','views','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','description','sidebar','always','icon','test','Warning:\x20admin\x20view\x20not\x20specified','plugins','Warning:\x20agent\x20view\x20not\x20specified','script','create','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','delete','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','http://localhost:','encoding','headers','content-type','set','endsWith','statusCode','hostname','method','%s%s','content-length','zip-dir','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','extract-zip','rimraf','archiver','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./plugin.socket','register','sendStatus','status','end','offset','limit','undefined','count','json','apply','reject'];(function(_0x1ddb35,_0x83ad48){var _0x2c3a08=function(_0x1dda3b){while(--_0x1dda3b){_0x1ddb35['push'](_0x1ddb35['shift']());}};_0x2c3a08(++_0x83ad48);}(_0xe964,0x1db));var _0x4e96=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe964[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x4e96('0x0'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x4e96('0x1'));var BPromise=require(_0x4e96('0x2'));var Mustache=require(_0x4e96('0x3'));var util=require(_0x4e96('0x4'));var path=require(_0x4e96('0x5'));var sox=require('sox');var csv=require(_0x4e96('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4e96('0x7'));var _=require(_0x4e96('0x8'));var squel=require(_0x4e96('0x9'));var crypto=require(_0x4e96('0xa'));var jsforce=require(_0x4e96('0xb'));var deskjs=require(_0x4e96('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x4e96('0xd'));var extract=require(_0x4e96('0xe'));var rimraf=require(_0x4e96('0xf'));var archiver=require(_0x4e96('0x10'));var Redis=require(_0x4e96('0x11'));var authService=require(_0x4e96('0x12'));var qs=require(_0x4e96('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x4e96('0x14'))(_0x4e96('0x15'));var utils=require('../../config/utils');var config=require(_0x4e96('0x16'));var licenseUtil=require(_0x4e96('0x17'));var db=require(_0x4e96('0x18'))['db'];config[_0x4e96('0x19')]=_[_0x4e96('0x1a')](config[_0x4e96('0x19')],{'host':_0x4e96('0x1b'),'port':0x18eb});var socket=require(_0x4e96('0x1c'))(new Redis(config[_0x4e96('0x19')]));require(_0x4e96('0x1d'))[_0x4e96('0x1e')](socket);function respondWithStatusCode(_0x3a7155,_0x5ef944){_0x5ef944=_0x5ef944||0xcc;return function(_0x38c8da){if(_0x38c8da){return _0x3a7155[_0x4e96('0x1f')](_0x5ef944);}return _0x3a7155[_0x4e96('0x20')](_0x5ef944)[_0x4e96('0x21')]();};}function respondWithResult(_0x4f0496,_0x449ddc){_0x449ddc=_0x449ddc||0xc8;return function(_0x1b6045){if(_0x1b6045){return _0x4f0496[_0x4e96('0x20')](_0x449ddc)['json'](_0x1b6045);}};}function respondWithFilteredResult(_0x4eec91,_0x15a86e){return function(_0x201368){if(_0x201368){var _0x490836=typeof _0x15a86e[_0x4e96('0x22')]==='undefined'&&typeof _0x15a86e[_0x4e96('0x23')]===_0x4e96('0x24');var _0x1a986c=_0x201368[_0x4e96('0x25')];var _0x2c13ba=_0x490836?0x0:_0x15a86e[_0x4e96('0x22')];var _0x159e05=_0x490836?_0x201368[_0x4e96('0x25')]:_0x15a86e[_0x4e96('0x22')]+_0x15a86e[_0x4e96('0x23')];var _0x29cc24;if(_0x159e05>=_0x1a986c){_0x159e05=_0x1a986c;_0x29cc24=0xc8;}else{_0x29cc24=0xce;}_0x4eec91['status'](_0x29cc24);return _0x4eec91['set']('Content-Range',_0x2c13ba+'-'+_0x159e05+'/'+_0x1a986c)[_0x4e96('0x26')](_0x201368);}return null;};}function patchUpdates(_0x1d5de1){return function(_0x504b88){try{jsonpatch[_0x4e96('0x27')](_0x504b88,_0x1d5de1,!![]);}catch(_0x2bb3d8){return BPromise[_0x4e96('0x28')](_0x2bb3d8);}return _0x504b88['save']();};}function saveUpdates(_0x3810e9,_0x1acfde){return function(_0x40a51d){if(_0x40a51d){return _0x40a51d[_0x4e96('0x29')](_0x3810e9)[_0x4e96('0x2a')](function(_0x156871){return _0x156871;});}return null;};}function removeEntity(_0x3d4281,_0x41e9ba){return function(_0x32352a){if(_0x32352a){return _0x32352a[_0x4e96('0x2b')]()['then'](function(){var _0x1d449a=_0x32352a[_0x4e96('0x2c')]({'plain':!![]});var _0x1aa740=_0x4e96('0x2d');return db['UserProfileResource'][_0x4e96('0x2b')]({'where':{'type':_0x1aa740,'resourceId':_0x1d449a['id']}})[_0x4e96('0x2a')](function(){return _0x32352a;});})['then'](function(){_0x3d4281[_0x4e96('0x20')](0xcc)[_0x4e96('0x21')]();});}};}function handleEntityNotFound(_0x52d154,_0x342f8d){return function(_0x540145){if(!_0x540145){_0x52d154[_0x4e96('0x1f')](0x194);}return _0x540145;};}function handleError(_0x18f13b,_0x163b61){_0x163b61=_0x163b61||0x1f4;return function(_0x177f2b){logger[_0x4e96('0x2e')](_0x177f2b['stack']);if(_0x177f2b[_0x4e96('0x2f')]){delete _0x177f2b[_0x4e96('0x2f')];}_0x18f13b[_0x4e96('0x20')](_0x163b61)[_0x4e96('0x30')](_0x177f2b);};}exports['index']=function(_0x571af5,_0x567532){var _0x3aca0e={},_0x3833d9={},_0x56a4a4={'count':0x0,'rows':[]};var _0x2f284d=_[_0x4e96('0x31')](db[_0x4e96('0x32')][_0x4e96('0x33')],function(_0x5c690d){return{'name':_0x5c690d[_0x4e96('0x34')],'type':_0x5c690d[_0x4e96('0x35')]['key']};});_0x3833d9[_0x4e96('0x36')]=_['map'](_0x2f284d,'name');_0x3833d9[_0x4e96('0x37')]=_['keys'](_0x571af5[_0x4e96('0x37')]);_0x3833d9[_0x4e96('0x38')]=_[_0x4e96('0x39')](_0x3833d9[_0x4e96('0x36')],_0x3833d9['query']);_0x3aca0e[_0x4e96('0x3a')]=_['intersection'](_0x3833d9[_0x4e96('0x36')],qs[_0x4e96('0x3b')](_0x571af5[_0x4e96('0x37')][_0x4e96('0x3b')]));_0x3aca0e[_0x4e96('0x3a')]=_0x3aca0e[_0x4e96('0x3a')]['length']?_0x3aca0e[_0x4e96('0x3a')]:_0x3833d9[_0x4e96('0x36')];if(!_0x571af5[_0x4e96('0x37')][_0x4e96('0x3c')](_0x4e96('0x3d'))){_0x3aca0e[_0x4e96('0x23')]=qs[_0x4e96('0x23')](_0x571af5['query'][_0x4e96('0x23')]);_0x3aca0e[_0x4e96('0x22')]=qs[_0x4e96('0x22')](_0x571af5['query'][_0x4e96('0x22')]);}_0x3aca0e['order']=qs[_0x4e96('0x3e')](_0x571af5[_0x4e96('0x37')][_0x4e96('0x3e')]);_0x3aca0e[_0x4e96('0x3f')]=qs[_0x4e96('0x38')](_[_0x4e96('0x40')](_0x571af5[_0x4e96('0x37')],_0x3833d9[_0x4e96('0x38')]),_0x2f284d);if(_0x571af5[_0x4e96('0x37')][_0x4e96('0x41')]){_0x3aca0e[_0x4e96('0x3f')]=_[_0x4e96('0x42')](_0x3aca0e[_0x4e96('0x3f')],{'$or':_[_0x4e96('0x31')](_0x2f284d,function(_0xa91e59){if(_0xa91e59[_0x4e96('0x35')]!==_0x4e96('0x43')){var _0x1ca8a8={};_0x1ca8a8[_0xa91e59['name']]={'$like':'%'+_0x571af5['query'][_0x4e96('0x41')]+'%'};return _0x1ca8a8;}})});}_0x3aca0e=_['merge']({},_0x3aca0e,_0x571af5['options']);var _0x47feba={'where':_0x3aca0e[_0x4e96('0x3f')]};return db['Plugin'][_0x4e96('0x25')](_0x47feba)[_0x4e96('0x2a')](function(_0x43498b){_0x56a4a4[_0x4e96('0x25')]=_0x43498b;if(_0x571af5['query'][_0x4e96('0x44')]){_0x3aca0e['include']=[{'all':!![]}];}return db[_0x4e96('0x32')][_0x4e96('0x45')](_0x3aca0e);})[_0x4e96('0x2a')](function(_0x8d7923){_0x56a4a4['rows']=_0x8d7923;return _0x56a4a4;})[_0x4e96('0x2a')](respondWithFilteredResult(_0x567532,_0x3aca0e))['catch'](handleError(_0x567532,null));};exports['show']=function(_0x151ee5,_0x1157bb){var _0x37376d={'raw':!![],'where':{'id':_0x151ee5['params']['id']}},_0x390dcd={};_0x390dcd[_0x4e96('0x36')]=_[_0x4e96('0x46')](db[_0x4e96('0x32')][_0x4e96('0x33')]);_0x390dcd[_0x4e96('0x37')]=_['keys'](_0x151ee5[_0x4e96('0x37')]);_0x390dcd[_0x4e96('0x38')]=_[_0x4e96('0x39')](_0x390dcd['model'],_0x390dcd[_0x4e96('0x37')]);_0x37376d[_0x4e96('0x3a')]=_[_0x4e96('0x39')](_0x390dcd['model'],qs[_0x4e96('0x3b')](_0x151ee5[_0x4e96('0x37')]['fields']));_0x37376d[_0x4e96('0x3a')]=_0x37376d[_0x4e96('0x3a')][_0x4e96('0x47')]?_0x37376d[_0x4e96('0x3a')]:_0x390dcd['model'];if(_0x151ee5[_0x4e96('0x37')][_0x4e96('0x44')]){_0x37376d['include']=[{'all':!![]}];}_0x37376d=_[_0x4e96('0x42')]({},_0x37376d,_0x151ee5['options']);return db[_0x4e96('0x32')]['find'](_0x37376d)['then'](handleEntityNotFound(_0x1157bb,null))['then'](respondWithResult(_0x1157bb,null))[_0x4e96('0x48')](handleError(_0x1157bb,null));};exports[_0x4e96('0x49')]=function(_0x402649,_0x3504c0,_0x4b7027){return db[_0x4e96('0x32')][_0x4e96('0x4a')]({'where':{'id':_0x402649[_0x4e96('0x4b')]['id']},'attributes':[_0x4e96('0x2f'),_0x4e96('0x5')],'raw':!![]})['then'](handleEntityNotFound(_0x3504c0,null))[_0x4e96('0x2a')](function(_0x2650b4){if(_0x2650b4){var _0x36dee7=path[_0x4e96('0x4c')](config[_0x4e96('0x4d')],_0x4e96('0x4e'),util['format'](_0x4e96('0x4f'),path[_0x4e96('0x50')](_0x2650b4[_0x4e96('0x5')])));var _0x21b537=fs[_0x4e96('0x51')](_0x36dee7);var _0x11d3f3=archiver(_0x4e96('0x52'),{'zlib':{'level':0x9}});_0x11d3f3['on'](_0x4e96('0x53'),function(_0x2dee8d){if(_0x2dee8d[_0x4e96('0x54')]===_0x4e96('0x55')){logger[_0x4e96('0x2e')](_0x2dee8d);}else{throw new db['Sequelize'][(_0x4e96('0x56'))](_0x4e96('0x57'));}});_0x11d3f3['on'](_0x4e96('0x2e'),function(_0x418177){throw new db[(_0x4e96('0x58'))][(_0x4e96('0x56'))](_0x4e96('0x57'));});_0x11d3f3[_0x4e96('0x59')](_0x21b537);_0x11d3f3[_0x4e96('0x5a')](_0x4e96('0x5b'),{'cwd':path['join'](config[_0x4e96('0x4d')],_0x4e96('0x4e'),path[_0x4e96('0x5c')](_0x2650b4[_0x4e96('0x5')])),'ignore':[path[_0x4e96('0x4c')](path[_0x4e96('0x50')](_0x2650b4['path']),_0x4e96('0x5d')),path['join'](path[_0x4e96('0x50')](_0x2650b4[_0x4e96('0x5')]),'attachments/**/*')],'nodir':!![]})[_0x4e96('0x5e')]();_0x21b537['on'](_0x4e96('0x5f'),function(){if(!fs[_0x4e96('0x60')](_0x36dee7)){throw new db[(_0x4e96('0x58'))]['Error'](_0x4e96('0x61'));}return _0x3504c0['download'](_0x36dee7,util[_0x4e96('0x62')]('%s.zip',path[_0x4e96('0x50')](_0x2650b4['path'])),function(_0x1ae4e6){if(_0x1ae4e6){throw new db[(_0x4e96('0x58'))][(_0x4e96('0x56'))](_0x4e96('0x63'));}fs[_0x4e96('0x64')](_0x36dee7);logger['info'](_0x4e96('0x65'));logger[_0x4e96('0x66')](_0x4e96('0x67'));});});}return null;})[_0x4e96('0x48')](handleError(_0x3504c0,null));};exports[_0x4e96('0x68')]=function(_0x5efda0,_0x218296,_0x35554f){var _0x3d0c77=path[_0x4e96('0x50')](_0x5efda0['file'][_0x4e96('0x69')],path['extname'](_0x5efda0['file']['filename']));var _0x6763e2=path[_0x4e96('0x4c')](config[_0x4e96('0x4d')],_0x4e96('0x4e'),_0x5efda0[_0x4e96('0x6a')][_0x4e96('0x69')]);var _0x20f135=path[_0x4e96('0x4c')](config['root'],_0x4e96('0x4e'),_0x3d0c77);logger[_0x4e96('0x66')](_0x4e96('0x6b'),_0x6763e2);logger[_0x4e96('0x66')](_0x4e96('0x6c'),_0x20f135);try{fs[_0x4e96('0x6d')](_0x6763e2,parseInt(_0x4e96('0x6e'),0x8));extract(_0x6763e2,{'dir':_0x20f135},function(_0xb49d98){if(_0xb49d98){logger['error'](_0xb49d98);handleError(_0xb49d98,!![]);};var _0x43673b=fs[_0x4e96('0x6f')](_0x20f135);if(_0x43673b[_0x4e96('0x47')]>0x1){removeReferences(_0x6763e2,_0x20f135);logger['error'](_0x4e96('0x70'));return _0x35554f(new Error(_0x4e96('0x70')));}var _0x373a74=fs[_0x4e96('0x71')](path['join'](_0x20f135,_0x43673b[0x0]));if(_0x373a74[_0x4e96('0x72')]()){removeReferences(_0x6763e2,_0x20f135);logger[_0x4e96('0x2e')](_0x4e96('0x70'));return _0x35554f(new Error('Invalid\x20plugin\x20structure'));}if(_0x373a74[_0x4e96('0x73')]()){var _0x3df63c=fs['readdirSync'](path[_0x4e96('0x4c')](_0x20f135,_0x43673b[0x0]));if(_0x3df63c[_0x4e96('0x47')]===0x0){removeReferences(_0x6763e2,_0x20f135);logger[_0x4e96('0x2e')]('Invalid\x20plugin\x20structure');return _0x35554f(new Error(_0x4e96('0x70')));}var _0xf579d4=_0x3df63c[_0x4e96('0x74')](function(_0x1a75ce){return _0x1a75ce===_0x4e96('0x75');});if(!_0xf579d4){return _0x35554f(new Error(_0x4e96('0x76')));}var _0x1267e3=fs[_0x4e96('0x77')](path[_0x4e96('0x4c')](_0x20f135,_0x43673b[0x0],'manifest.json'));var _0x1a147e=JSON[_0x4e96('0x78')](_0x1267e3);if(_0x4e96('0x24')==typeof _0x1a147e['name']){return _0x35554f(new Error(_0x4e96('0x79')));}if(_0x4e96('0x24')==typeof _0x1a147e[_0x4e96('0x35')]){return _0x35554f(new Error(_0x4e96('0x7a')));}if('undefined'==typeof _0x1a147e[_0x4e96('0x7b')]){return _0x35554f(new Error(_0x4e96('0x7c')));}if('undefined'==typeof _0x1a147e[_0x4e96('0x7d')]){return _0x35554f(new Error('Invalid\x20manifest:\x20parameters\x20missing'));}if(_0x1a147e['type']===_0x4e96('0x7e')){if(_0x4e96('0x24')==typeof _0x1a147e[_0x4e96('0x7d')]['views']){return _0x35554f(new Error(_0x4e96('0x7f')));}if('undefined'==typeof _0x1a147e[_0x4e96('0x7d')][_0x4e96('0x80')][_0x4e96('0x81')]&&_0x4e96('0x24')==typeof _0x1a147e['parameters'][_0x4e96('0x80')][_0x4e96('0x82')]){return _0x35554f(new Error(_0x4e96('0x83')));}}else if(_0x1a147e[_0x4e96('0x35')]==='script'){if('undefined'==typeof _0x1a147e[_0x4e96('0x7d')][_0x4e96('0x84')]){return _0x35554f(new Error(_0x4e96('0x85')));}if(_0x4e96('0x24')==typeof _0x1a147e['parameters'][_0x4e96('0x86')]){return _0x35554f(new Error(_0x4e96('0x87')));}}else{return _0x35554f(new Error('Invalid\x20manifest:\x20invalid\x20type'));}var _0x4f6e29=_0x1a147e[_0x4e96('0x2f')];var _0x8d9175=_0x1a147e[_0x4e96('0x88')];var _0x123ba2=_0x1a147e[_0x4e96('0x35')];var _0x295f6d=_0x1a147e['sidebar']?_0x1a147e[_0x4e96('0x89')]:_0x4e96('0x8a');var _0x4a7998=_0x1a147e[_0x4e96('0x8b')]?_0x1a147e['icon']:'icon-apps';var _0x32cd9a='';var _0x5dcc7f='';var _0x1d0ea4='';var _0x4de988='';var _0x4b8132=_0x1a147e['version'];if(_0x123ba2===_0x4e96('0x7e')){if('undefined'!=typeof _0x1a147e[_0x4e96('0x7d')][_0x4e96('0x80')]['admin']){var _0x1d7e0c=_0x1a147e[_0x4e96('0x7d')][_0x4e96('0x80')][_0x4e96('0x81')];if(!/^(f|ht)tps?:\/\//i[_0x4e96('0x8c')](_0x1d7e0c)){_0x32cd9a=path[_0x4e96('0x4c')]('plugins',_0x3d0c77,_0x43673b[0x0],_0x1d7e0c);}else{_0x32cd9a=_0x1d7e0c;}}else{logger[_0x4e96('0x66')](_0x4e96('0x8d'));}if('undefined'!=typeof _0x1a147e['parameters'][_0x4e96('0x80')][_0x4e96('0x82')]){var _0x13aedb=_0x1a147e[_0x4e96('0x7d')]['views'][_0x4e96('0x82')];if(!/^(f|ht)tps?:\/\//i['test'](_0x13aedb)){_0x5dcc7f=path[_0x4e96('0x4c')](_0x4e96('0x8e'),_0x3d0c77,_0x43673b[0x0],_0x13aedb);}else{_0x5dcc7f=_0x13aedb;}}else{logger[_0x4e96('0x66')](_0x4e96('0x8f'));}}else if(_0x123ba2===_0x4e96('0x90')){_0x1d0ea4=_0x1a147e['parameters']['scriptName'];_0x4de988=_0x1a147e['parameters'][_0x4e96('0x86')];if(_0x4e96('0x24')!=typeof _0x1a147e[_0x4e96('0x7d')]['views']){if('undefined'!=typeof _0x1a147e[_0x4e96('0x7d')]['views'][_0x4e96('0x81')]){var _0x1d7e0c=_0x1a147e[_0x4e96('0x7d')][_0x4e96('0x80')][_0x4e96('0x81')];if(!/^(f|ht)tps?:\/\//i[_0x4e96('0x8c')](_0x1d7e0c)){_0x32cd9a=path[_0x4e96('0x4c')](_0x4e96('0x8e'),_0x3d0c77,_0x43673b[0x0],_0x1d7e0c);}else{_0x32cd9a=_0x1d7e0c;}}if(_0x4e96('0x24')!=typeof _0x1a147e[_0x4e96('0x7d')][_0x4e96('0x80')][_0x4e96('0x82')]){var _0x13aedb=_0x1a147e['parameters'][_0x4e96('0x80')][_0x4e96('0x82')];if(!/^(f|ht)tps?:\/\//i[_0x4e96('0x8c')](_0x13aedb)){_0x5dcc7f=path[_0x4e96('0x4c')](_0x4e96('0x8e'),_0x3d0c77,_0x43673b[0x0],_0x13aedb);}else{_0x5dcc7f=_0x13aedb;}}}}var _0x27a6ca={'name':_0x4f6e29,'description':_0x8d9175,'path':path[_0x4e96('0x4c')](_0x3d0c77,_0x43673b[0x0]),'type':_0x123ba2,'sidebar':_0x295f6d,'icon':_0x4a7998,'adminUrl':_0x32cd9a,'agentUrl':_0x5dcc7f,'scriptName':_0x1d0ea4,'scriptPath':_0x4de988,'version':_0x4b8132};removeReferences(_0x6763e2,null);return db[_0x4e96('0x32')][_0x4e96('0x91')](_0x27a6ca)['then'](function(_0x30e38d){var _0x36bf13={'role':_0x5efda0[_0x4e96('0x92')]['role'],'userProfileId':_0x5efda0[_0x4e96('0x92')][_0x4e96('0x93')]};if(!_0x36bf13)throw new Error(_0x4e96('0x94'));if(_0x36bf13['role']===_0x4e96('0x95')){var _0x4b5c30=_0x30e38d[_0x4e96('0x2c')]({'plain':!![]});return db[_0x4e96('0x96')][_0x4e96('0x4a')]({'where':{'name':_0x4e96('0x2d'),'userProfileId':_0x36bf13['userProfileId']},'raw':!![]})[_0x4e96('0x2a')](function(_0x30ac23){if(_0x30ac23&&_0x30ac23[_0x4e96('0x97')]===0x0){return db[_0x4e96('0x98')]['create']({'name':_0x4b5c30['name'],'resourceId':_0x4b5c30['id'],'type':_0x30ac23[_0x4e96('0x2f')],'sectionId':_0x30ac23['id']},{})[_0x4e96('0x2a')](function(){return _0x30e38d;});}else{return _0x30e38d;}})[_0x4e96('0x48')](function(_0x3f3d39){logger[_0x4e96('0x2e')](_0x4e96('0x99'),_0x3f3d39);throw _0x3f3d39;});}return _0x30e38d;})[_0x4e96('0x2a')](respondWithResult(_0x218296,null))[_0x4e96('0x48')](handleError(_0x218296,null));}});}catch(_0x320e6f){_0x218296['status'](0x1f4)[_0x4e96('0x30')](_0x320e6f);}};function removeReferences(_0x95185f,_0x30422c){try{if(_0x95185f){fs[_0x4e96('0x64')](_0x95185f);logger[_0x4e96('0x66')](_0x4e96('0x9a'));}if(_0x30422c){rimraf(_0x30422c,function(){});logger[_0x4e96('0x66')]('Extracted\x20folder\x20removed');}}catch(_0x49bbab){logger[_0x4e96('0x2e')](_0x49bbab);}}exports[_0x4e96('0x29')]=function(_0x27248d,_0x338ec4,_0x32fa1b){return db[_0x4e96('0x32')]['find']({'where':{'id':_0x27248d[_0x4e96('0x4b')]['id']}})[_0x4e96('0x2a')](handleEntityNotFound(_0x338ec4,null))[_0x4e96('0x2a')](saveUpdates(_0x27248d[_0x4e96('0x92')],null))['then'](respondWithResult(_0x338ec4,null))['catch'](handleError(_0x338ec4,null));};exports[_0x4e96('0x9b')]=function(_0x463f74,_0x9b30b3,_0x2f5c0f){return db[_0x4e96('0x32')][_0x4e96('0x4a')]({'where':{'id':_0x463f74[_0x4e96('0x4b')]['id']}})[_0x4e96('0x2a')](function(_0x34b5f8){if(_0x34b5f8){return _0x34b5f8['destroy']();}})[_0x4e96('0x2a')](function(_0x42085e){rimraf(path['join'](config['root'],_0x4e96('0x4e'),path[_0x4e96('0x5c')](_0x42085e[_0x4e96('0x5')])),function(){});return _0x42085e;})[_0x4e96('0x2a')](handleEntityNotFound(_0x9b30b3,null))['then'](respondWithStatusCode(_0x9b30b3,null))['catch'](handleError(_0x9b30b3,null));};exports[_0x4e96('0x9c')]=function(_0x18f0da,_0x466c84,_0x286eb8){return BPromise[_0x4e96('0x9d')]()['then'](function(){if(!_0x18f0da[_0x4e96('0x37')]['path']){throw new Error(_0x4e96('0x9e'));}if(!_0x18f0da[_0x4e96('0x37')][_0x4e96('0x9f')]){throw new Error(_0x4e96('0xa0'));}var _0x57d0e0=_0x18f0da[_0x4e96('0x37')]['hostname']?_0x18f0da[_0x4e96('0x37')]['hostname']+':'+_0x18f0da[_0x4e96('0x37')][_0x4e96('0x9f')]:_0x4e96('0xa1')+_0x18f0da['query'][_0x4e96('0x9f')];var _0x430185=_0x18f0da[_0x4e96('0x37')][_0x4e96('0x26')]?_0x18f0da[_0x4e96('0x37')]['json']:!![];var _0x3e8879=_0x18f0da[_0x4e96('0x37')]['encoding']?_0x18f0da[_0x4e96('0x37')][_0x4e96('0xa2')]:null;var _0x11830c={'method':_0x18f0da['method'],'uri':util[_0x4e96('0x62')]('%s%s',_0x57d0e0,_0x18f0da[_0x4e96('0x37')][_0x4e96('0x5')]),'json':_0x430185,'resolveWithFullResponse':!![],'encoding':_0x3e8879,'qs':_0x18f0da[_0x4e96('0x37')]};if(_0x18f0da[_0x4e96('0xa3')]){_0x11830c['headers']=_0x18f0da['headers'];if(_0x11830c[_0x4e96('0xa3')]['content-length']){delete _0x11830c[_0x4e96('0xa3')]['content-length'];}}if(_0x11830c[_0x4e96('0xa3')][_0x4e96('0xa4')]){delete _0x11830c[_0x4e96('0xa3')][_0x4e96('0xa4')];}return rp(_0x11830c);})[_0x4e96('0x2a')](function(_0x4a1dd1){if(_0x4a1dd1){_0x466c84[_0x4e96('0xa5')](_0x4a1dd1[_0x4e96('0xa3')]);logger['info'](_0x4a1dd1['body']);if(_[_0x4e96('0xa6')](_0x18f0da[_0x4e96('0x37')][_0x4e96('0x5')],_0x4e96('0x49'))&&_0x4a1dd1[_0x4e96('0xa7')]==0x1f4){return _0x466c84[_0x4e96('0x1f')](_0x4a1dd1[_0x4e96('0xa7')]);}else{return _0x466c84[_0x4e96('0x20')](_0x4a1dd1[_0x4e96('0xa7')])[_0x4e96('0x30')](_0x4a1dd1['body']);}}else{return _0x466c84[_0x4e96('0x1f')](0xc8);}})[_0x4e96('0x48')](handleError(_0x466c84,null));};exports['webhookPost']=function(_0x35b652,_0x32588d,_0x595bd7){return BPromise[_0x4e96('0x9d')]()[_0x4e96('0x2a')](function(){if(!_0x35b652[_0x4e96('0x37')][_0x4e96('0x5')]){throw new Error(_0x4e96('0x9e'));}if(!_0x35b652[_0x4e96('0x37')]['port']){throw new Error(_0x4e96('0xa0'));}var _0x2f1b81=_0x35b652[_0x4e96('0x37')][_0x4e96('0xa8')]?_0x35b652[_0x4e96('0x37')][_0x4e96('0xa8')]+':'+_0x35b652['query']['port']:_0x4e96('0xa1')+_0x35b652[_0x4e96('0x37')][_0x4e96('0x9f')];var _0x39c4e8=_0x35b652[_0x4e96('0x37')][_0x4e96('0x26')]?_0x35b652[_0x4e96('0x37')][_0x4e96('0x26')]:!![];var _0xd897c1=_0x35b652[_0x4e96('0x37')][_0x4e96('0xa2')]?_0x35b652['query']['encoding']:null;var _0x4a514f={'method':_0x35b652[_0x4e96('0xa9')],'uri':util[_0x4e96('0x62')](_0x4e96('0xaa'),_0x2f1b81,_0x35b652[_0x4e96('0x37')][_0x4e96('0x5')]),'json':_0x39c4e8,'resolveWithFullResponse':!![],'encoding':_0xd897c1,'body':_0x35b652[_0x4e96('0x92')]};if(_0x35b652[_0x4e96('0xa3')]){_0x4a514f['headers']=_0x35b652[_0x4e96('0xa3')];if(_0x4a514f[_0x4e96('0xa3')][_0x4e96('0xab')]){delete _0x4a514f[_0x4e96('0xa3')][_0x4e96('0xab')];}}if(_0x4a514f['headers'][_0x4e96('0xa4')]){delete _0x4a514f[_0x4e96('0xa3')][_0x4e96('0xa4')];}return rp(_0x4a514f);})[_0x4e96('0x2a')](function(_0x28641a){if(_0x28641a){_0x32588d[_0x4e96('0xa5')](_0x28641a['headers']);logger[_0x4e96('0x66')](_0x28641a[_0x4e96('0x92')]);return _0x32588d[_0x4e96('0x20')](_0x28641a[_0x4e96('0xa7')])[_0x4e96('0x30')](_0x28641a[_0x4e96('0x92')]);}else{return _0x32588d['sendStatus'](0xc8);}})['catch'](handleError(_0x32588d,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index fc86c0a..0e34d03 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 _0xed08=['remove','emit','hook','exports','../../mysqldb','Plugin','setMaxListeners','save','update'];(function(_0x2d0256,_0x5e8f2d){var _0x269ae7=function(_0x16f7c2){while(--_0x16f7c2){_0x2d0256['push'](_0x2d0256['shift']());}};_0x269ae7(++_0x5e8f2d);}(_0xed08,0x67));var _0x8ed0=function(_0x15facd,_0x3b1406){_0x15facd=_0x15facd-0x0;var _0x1bb273=_0xed08[_0x15facd];return _0x1bb273;};'use strict';var EventEmitter=require('events');var Plugin=require(_0x8ed0('0x0'))['db'][_0x8ed0('0x1')];var PluginEvents=new EventEmitter();PluginEvents[_0x8ed0('0x2')](0x0);var events={'afterCreate':_0x8ed0('0x3'),'afterUpdate':_0x8ed0('0x4'),'afterDestroy':_0x8ed0('0x5')};function emitEvent(_0x36127d){return function(_0x33c3ad,_0x14901f,_0x29680a){PluginEvents[_0x8ed0('0x6')](_0x36127d+':'+_0x33c3ad['id'],_0x33c3ad);PluginEvents[_0x8ed0('0x6')](_0x36127d,_0x33c3ad);_0x29680a(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Plugin[_0x8ed0('0x7')](e,emitEvent(event));}}module[_0x8ed0('0x8')]=PluginEvents; \ No newline at end of file +var _0x3595=['save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','Plugin'];(function(_0x4f724c,_0x2b7721){var _0xc015c5=function(_0x58294e){while(--_0x58294e){_0x4f724c['push'](_0x4f724c['shift']());}};_0xc015c5(++_0x2b7721);}(_0x3595,0x147));var _0x5359=function(_0x19de56,_0x2688e1){_0x19de56=_0x19de56-0x0;var _0x3e7369=_0x3595[_0x19de56];return _0x3e7369;};'use strict';var EventEmitter=require(_0x5359('0x0'));var Plugin=require(_0x5359('0x1'))['db'][_0x5359('0x2')];var PluginEvents=new EventEmitter();PluginEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x5359('0x3'),'afterUpdate':_0x5359('0x4'),'afterDestroy':_0x5359('0x5')};function emitEvent(_0x3fd018){return function(_0x1fa814,_0x125c76,_0x4e42e0){PluginEvents['emit'](_0x3fd018+':'+_0x1fa814['id'],_0x1fa814);PluginEvents[_0x5359('0x6')](_0x3fd018,_0x1fa814);_0x4e42e0(null);};}for(var e in events){if(events[_0x5359('0x7')](e)){var event=events[e];Plugin[_0x5359('0x8')](e,emitEvent(event));}}module[_0x5359('0x9')]=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index f32d2a6..a253f25 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 _0x5b3b=['rimraf','../../config/environment','./plugin.attributes','exports','Plugin','plugins','lodash','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x5b3b,0xd2));var _0xb5b3=function(_0x50c7b6,_0xbbfa7a){_0x50c7b6=_0x50c7b6-0x0;var _0x5235f9=_0x5b3b[_0x50c7b6];return _0x5235f9;};'use strict';var _=require(_0xb5b3('0x0'));var util=require('util');var logger=require(_0xb5b3('0x1'))('api');var moment=require(_0xb5b3('0x2'));var BPromise=require(_0xb5b3('0x3'));var rp=require(_0xb5b3('0x4'));var fs=require('fs');var path=require(_0xb5b3('0x5'));var rimraf=require(_0xb5b3('0x6'));var config=require(_0xb5b3('0x7'));var attributes=require(_0xb5b3('0x8'));module[_0xb5b3('0x9')]=function(_0x17370b,_0x4e9990){return _0x17370b['define'](_0xb5b3('0xa'),attributes,{'tableName':_0xb5b3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x68a0=['plugins','util','../../config/logger','api','moment','request-promise','path','../../config/environment','exports','define','Plugin'];(function(_0x303251,_0x1cb467){var _0x558942=function(_0x351d7e){while(--_0x351d7e){_0x303251['push'](_0x303251['shift']());}};_0x558942(++_0x1cb467);}(_0x68a0,0xa6));var _0x068a=function(_0x262957,_0x34c699){_0x262957=_0x262957-0x0;var _0x27e221=_0x68a0[_0x262957];return _0x27e221;};'use strict';var _=require('lodash');var util=require(_0x068a('0x0'));var logger=require(_0x068a('0x1'))(_0x068a('0x2'));var moment=require(_0x068a('0x3'));var BPromise=require('bluebird');var rp=require(_0x068a('0x4'));var fs=require('fs');var path=require(_0x068a('0x5'));var rimraf=require('rimraf');var config=require(_0x068a('0x6'));var attributes=require('./plugin.attributes');module[_0x068a('0x7')]=function(_0x224e51,_0x308e94){return _0x224e51[_0x068a('0x8')](_0x068a('0x9'),attributes,{'tableName':_0x068a('0xa'),'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 4a75eb4..3f4f277 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 _0xb678=['socket.io-emitter','register','request','then','info','Plugin,\x20%s,\x20%s','request\x20sent','debug','error','message','result','catch','Plugin','create','body','options','raw','CreatePlugin','stringify','lodash','util','randomstring','../../config/utils','jayson/promise','client','http','redis','defaults','localhost'];(function(_0xc7dbe5,_0xe5bcd8){var _0x3df96b=function(_0x4a599d){while(--_0x4a599d){_0xc7dbe5['push'](_0xc7dbe5['shift']());}};_0x3df96b(++_0xe5bcd8);}(_0xb678,0x6a));var _0x8b67=function(_0x565ed7,_0x398228){_0x565ed7=_0x565ed7-0x0;var _0x183ad7=_0xb678[_0x565ed7];return _0x183ad7;};'use strict';var _=require(_0x8b67('0x0'));var util=require(_0x8b67('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x8b67('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x8b67('0x3'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x8b67('0x4'));var client=jayson[_0x8b67('0x5')][_0x8b67('0x6')]({'port':0x232a});config[_0x8b67('0x7')]=_[_0x8b67('0x8')](config[_0x8b67('0x7')],{'host':_0x8b67('0x9'),'port':0x18eb});var socket=require(_0x8b67('0xa'))(new Redis(config[_0x8b67('0x7')]));require('./plugin.socket')[_0x8b67('0xb')](socket);function respondWithRpcPromise(_0x6db6be,_0x277f3d,_0x5a30b8){return new BPromise(function(_0x10d727,_0x4efa00){return client[_0x8b67('0xc')](_0x6db6be,_0x5a30b8)[_0x8b67('0xd')](function(_0x46af1e){logger[_0x8b67('0xe')](_0x8b67('0xf'),_0x277f3d,_0x8b67('0x10'));logger[_0x8b67('0x11')]('Plugin,\x20%s,\x20%s,\x20%s',_0x277f3d,_0x8b67('0x10'),JSON['stringify'](_0x46af1e));if(_0x46af1e[_0x8b67('0x12')]){if(_0x46af1e['error']['code']===0x1f4){logger[_0x8b67('0x12')](_0x8b67('0xf'),_0x277f3d,_0x46af1e[_0x8b67('0x12')][_0x8b67('0x13')]);return _0x4efa00(_0x46af1e[_0x8b67('0x12')][_0x8b67('0x13')]);}logger[_0x8b67('0x12')](_0x8b67('0xf'),_0x277f3d,_0x46af1e[_0x8b67('0x12')][_0x8b67('0x13')]);return _0x10d727(_0x46af1e[_0x8b67('0x12')][_0x8b67('0x13')]);}else{logger[_0x8b67('0xe')](_0x8b67('0xf'),_0x277f3d,'request\x20sent');_0x10d727(_0x46af1e[_0x8b67('0x14')][_0x8b67('0x13')]);}})[_0x8b67('0x15')](function(_0x124016){logger[_0x8b67('0x12')](_0x8b67('0xf'),_0x277f3d,_0x124016);_0x4efa00(_0x124016);});});}exports['CreatePlugin']=function(_0x29a8da){var _0x2b0f2b=this;return new Promise(function(_0x1ce888,_0x5026a1){return db[_0x8b67('0x16')][_0x8b67('0x17')](_0x29a8da[_0x8b67('0x18')],{'raw':_0x29a8da[_0x8b67('0x19')]?_0x29a8da[_0x8b67('0x19')][_0x8b67('0x1a')]===undefined?!![]:![]:!![]})[_0x8b67('0xd')](function(_0x16ae64){logger[_0x8b67('0xe')](_0x8b67('0x1b'),_0x29a8da);logger['debug'](_0x8b67('0x1b'),_0x29a8da,JSON[_0x8b67('0x1c')](_0x16ae64));_0x1ce888(_0x16ae64);})[_0x8b67('0x15')](function(_0x29ac1e){logger['error']('CreatePlugin',_0x29ac1e['message'],_0x29a8da);_0x5026a1(_0x2b0f2b[_0x8b67('0x12')](0x1f4,_0x29ac1e[_0x8b67('0x13')]));});});}; \ No newline at end of file +var _0xf06f=['code','message','result','catch','CreatePlugin','Plugin','create','options','raw','then','debug','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./plugin.socket','register','request','info','Plugin,\x20%s,\x20%s','request\x20sent','Plugin,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xf06f,0x15f));var _0xff06=function(_0x5369de,_0x476efe){_0x5369de=_0x5369de-0x0;var _0x2ca99c=_0xf06f[_0x5369de];return _0x2ca99c;};'use strict';var _=require(_0xff06('0x0'));var util=require(_0xff06('0x1'));var moment=require(_0xff06('0x2'));var BPromise=require(_0xff06('0x3'));var rs=require(_0xff06('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xff06('0x5'))['db'];var utils=require(_0xff06('0x6'));var logger=require(_0xff06('0x7'))('rpc');var config=require(_0xff06('0x8'));var jayson=require(_0xff06('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0xff06('0xa')]=_[_0xff06('0xb')](config[_0xff06('0xa')],{'host':_0xff06('0xc'),'port':0x18eb});var socket=require(_0xff06('0xd'))(new Redis(config['redis']));require(_0xff06('0xe'))[_0xff06('0xf')](socket);function respondWithRpcPromise(_0x1d4578,_0x5653ae,_0x273b02){return new BPromise(function(_0x5a9cbd,_0x1e94a8){return client[_0xff06('0x10')](_0x1d4578,_0x273b02)['then'](function(_0x40b3c1){logger[_0xff06('0x11')](_0xff06('0x12'),_0x5653ae,_0xff06('0x13'));logger['debug'](_0xff06('0x14'),_0x5653ae,_0xff06('0x13'),JSON[_0xff06('0x15')](_0x40b3c1));if(_0x40b3c1['error']){if(_0x40b3c1[_0xff06('0x16')][_0xff06('0x17')]===0x1f4){logger[_0xff06('0x16')]('Plugin,\x20%s,\x20%s',_0x5653ae,_0x40b3c1['error'][_0xff06('0x18')]);return _0x1e94a8(_0x40b3c1['error'][_0xff06('0x18')]);}logger[_0xff06('0x16')]('Plugin,\x20%s,\x20%s',_0x5653ae,_0x40b3c1['error']['message']);return _0x5a9cbd(_0x40b3c1[_0xff06('0x16')]['message']);}else{logger[_0xff06('0x11')](_0xff06('0x12'),_0x5653ae,'request\x20sent');_0x5a9cbd(_0x40b3c1[_0xff06('0x19')][_0xff06('0x18')]);}})[_0xff06('0x1a')](function(_0x47d2cb){logger[_0xff06('0x16')](_0xff06('0x12'),_0x5653ae,_0x47d2cb);_0x1e94a8(_0x47d2cb);});});}exports[_0xff06('0x1b')]=function(_0x5ee291){var _0x41d1ad=this;return new Promise(function(_0x4c738a,_0x592d0c){return db[_0xff06('0x1c')][_0xff06('0x1d')](_0x5ee291['body'],{'raw':_0x5ee291['options']?_0x5ee291[_0xff06('0x1e')][_0xff06('0x1f')]===undefined?!![]:![]:!![]})[_0xff06('0x20')](function(_0x51a343){logger[_0xff06('0x11')](_0xff06('0x1b'),_0x5ee291);logger[_0xff06('0x21')](_0xff06('0x1b'),_0x5ee291,JSON[_0xff06('0x15')](_0x51a343));_0x4c738a(_0x51a343);})[_0xff06('0x1a')](function(_0x12d4cb){logger['error'](_0xff06('0x1b'),_0x12d4cb['message'],_0x5ee291);_0x592d0c(_0x41d1ad[_0xff06('0x16')](0x1f4,_0x12d4cb['message']));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index bf5113b..a1d56ef 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 _0xcc06=['emit','removeListener','register','plugin:','./plugin.events','remove','update'];(function(_0xa6d028,_0x2ca864){var _0x5421e1=function(_0x530b2c){while(--_0x530b2c){_0xa6d028['push'](_0xa6d028['shift']());}};_0x5421e1(++_0x2ca864);}(_0xcc06,0x107));var _0x6cc0=function(_0x164eca,_0x555e28){_0x164eca=_0x164eca-0x0;var _0x2ce562=_0xcc06[_0x164eca];return _0x2ce562;};'use strict';var PluginEvents=require(_0x6cc0('0x0'));var events=['save',_0x6cc0('0x1'),_0x6cc0('0x2')];function createListener(_0x42407a,_0x50a6a1){return function(_0xaf133c){_0x50a6a1[_0x6cc0('0x3')](_0x42407a,_0xaf133c);};}function removeListener(_0x1bb2ad,_0x4200a8){return function(){PluginEvents[_0x6cc0('0x4')](_0x1bb2ad,_0x4200a8);};}exports[_0x6cc0('0x5')]=function(_0x52b365){for(var _0x263f7f=0x0,_0x51e13=events['length'];_0x263f7f<_0x51e13;_0x263f7f++){var _0x7ad92f=events[_0x263f7f];var _0x490d87=createListener(_0x6cc0('0x6')+_0x7ad92f,_0x52b365);PluginEvents['on'](_0x7ad92f,_0x490d87);}}; \ No newline at end of file +var _0xfd57=['register','length','plugin:','./plugin.events','save','remove','update','emit','removeListener'];(function(_0x10b1bb,_0x2a5815){var _0x2d4e05=function(_0xc13643){while(--_0xc13643){_0x10b1bb['push'](_0x10b1bb['shift']());}};_0x2d4e05(++_0x2a5815);}(_0xfd57,0xe4));var _0x7fd5=function(_0x406d7b,_0x3d77a6){_0x406d7b=_0x406d7b-0x0;var _0x3ab3ba=_0xfd57[_0x406d7b];return _0x3ab3ba;};'use strict';var PluginEvents=require(_0x7fd5('0x0'));var events=[_0x7fd5('0x1'),_0x7fd5('0x2'),_0x7fd5('0x3')];function createListener(_0x4c2cdd,_0x3b02ff){return function(_0x345ab9){_0x3b02ff[_0x7fd5('0x4')](_0x4c2cdd,_0x345ab9);};}function removeListener(_0x2441c4,_0x4e345f){return function(){PluginEvents[_0x7fd5('0x5')](_0x2441c4,_0x4e345f);};}exports[_0x7fd5('0x6')]=function(_0x26c23b){for(var _0xabd801=0x0,_0x124e59=events[_0x7fd5('0x7')];_0xabd801<_0x124e59;_0xabd801++){var _0xdfcc0d=events[_0xabd801];var _0x111b0d=createListener(_0x7fd5('0x8')+_0xdfcc0d,_0x26c23b);PluginEvents['on'](_0xdfcc0d,_0x111b0d);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index 6d6bfaf..2ca7e35 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(_0x374c3d,_0x17326f){var _0x595180=function(_0x5c26d5){while(--_0x5c26d5){_0x374c3d['push'](_0x374c3d['shift']());}};_0x595180(++_0x17326f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xa9e0[_0x501510];return _0x1e6ee5;};'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(_0x784ee6,_0x103b5f){var _0x2feaad=function(_0x520130){while(--_0x520130){_0x784ee6['push'](_0x784ee6['shift']());}};_0x2feaad(++_0x103b5f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0xa9e0[_0x491a7f];return _0x3d8f44;};'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 238c19c..ffb56f2 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 _0x9aea=['join','../../files/plugins','start','dump','Missing\x20name\x20and/or\x20path','update','hasOwnProperty','Unknown\x20status','destroy','delete','Unknown\x20id','lodash','../../config/logger','path','child_process','bluebird','sendStatus','status','error','stack','name','send','info','index','list','then','express','motion2','length','catch','show','params','create','body','script'];(function(_0x9cd4c3,_0x1c9b2c){var _0x4c9025=function(_0x25b3c6){while(--_0x25b3c6){_0x9cd4c3['push'](_0x9cd4c3['shift']());}};_0x4c9025(++_0x1c9b2c);}(_0x9aea,0xdd));var _0xa9ae=function(_0x243dba,_0x5dd26c){_0x243dba=_0x243dba-0x0;var _0xa96e4a=_0x9aea[_0x243dba];return _0xa96e4a;};'use strict';var _=require(_0xa9ae('0x0'));var pm2=require('../../config/pm2');var logger=require(_0xa9ae('0x1'))('api');var path=require(_0xa9ae('0x2'));var exec=require(_0xa9ae('0x3'))['exec'];var BPromise=require(_0xa9ae('0x4'));function handleEntityNotFound(_0x115593,_0x41fb71){return function(_0x10f91d){if(!_0x10f91d){_0x115593[_0xa9ae('0x5')](0x194);;}return _0x10f91d;};}function respondWithResult(_0x56f942,_0x1aa3b9){_0x1aa3b9=_0x1aa3b9||0xc8;return function(_0x22734b){if(_0x22734b){return _0x56f942[_0xa9ae('0x6')](_0x1aa3b9)['json'](_0x22734b);}return null;};}function handleError(_0x1f2e4b,_0x3917f0){_0x3917f0=_0x3917f0||0x1f4;return function(_0x465bd2){logger[_0xa9ae('0x7')](_0x465bd2[_0xa9ae('0x8')]);if(_0x465bd2[_0xa9ae('0x9')]){delete _0x465bd2[_0xa9ae('0x9')];}_0x1f2e4b[_0xa9ae('0x6')](_0x3917f0)[_0xa9ae('0xa')](_0x465bd2);};}function execChildProcess(){return new BPromise(function(_0x5a8178,_0x3d400c){exec('npm\x20install',function(_0x2addd2,_0x226cf7,_0x112ab5){logger[_0xa9ae('0xb')](_0x226cf7);logger[_0xa9ae('0xb')](_0x112ab5);if(_0x2addd2){logger[_0xa9ae('0x7')](_0x2addd2);return _0x3d400c(_0x2addd2);}return _0x5a8178(_0x226cf7);});});}exports[_0xa9ae('0xc')]=function(_0x2b511a,_0x56de45){return pm2[_0xa9ae('0xd')]()[_0xa9ae('0xe')](function(_0x10882e){if(_0x10882e){var _0x3f7f61=_['reject'](_0x10882e,function(_0x28ce2d){return _0x28ce2d[_0xa9ae('0x9')]===_0xa9ae('0xf')||_0x28ce2d[_0xa9ae('0x9')]===_0xa9ae('0x10');});return{'rows':_0x3f7f61,'count':_0x3f7f61[_0xa9ae('0x11')]};}return null;})['then'](respondWithResult(_0x56de45,null))[_0xa9ae('0x12')](handleError(_0x56de45,null));};exports[_0xa9ae('0x13')]=function(_0x3e31d9,_0x4ac5a6){return pm2['describe'](_0x3e31d9[_0xa9ae('0x14')]['id'])['then'](respondWithResult(_0x4ac5a6,null))['then'](handleEntityNotFound(_0x4ac5a6,null))[_0xa9ae('0x12')](handleError(_0x4ac5a6,null));};exports[_0xa9ae('0x15')]=function(_0xbfd2ff,_0x42f961){if(_0xbfd2ff['body'][_0xa9ae('0x9')]&&_0xbfd2ff[_0xa9ae('0x16')][_0xa9ae('0x17')]){var _0x688153=path[_0xa9ae('0x18')](__dirname,_0xa9ae('0x19'),_0xbfd2ff[_0xa9ae('0x16')]['script']);var _0xc021cf=process['cwd']();process['chdir'](path['dirname'](_0x688153));return execChildProcess()['then'](function(_0x1afd07){process['chdir'](_0xc021cf);return pm2[_0xa9ae('0x1a')]({'name':_0xbfd2ff['body'][_0xa9ae('0x9')],'script':_0x688153});})[_0xa9ae('0xe')](function(_0x93d637){pm2[_0xa9ae('0x1b')]();return _0x93d637[0x0];})[_0xa9ae('0xe')](respondWithResult(_0x42f961,0xc9))[_0xa9ae('0x12')](handleError(_0x42f961,null));}else{return _0x42f961[_0xa9ae('0x6')](0x1f4)['send']({'message':_0xa9ae('0x1c')});}};exports[_0xa9ae('0x1d')]=function(_0x2aac9e,_0xfe9ef1){if(_0x2aac9e[_0xa9ae('0x16')]['id']){delete _0x2aac9e[_0xa9ae('0x16')]['id'];}var _0xb12fa8={'online':'restart','stopped':'stop'};if(_0xb12fa8[_0xa9ae('0x1e')](_0x2aac9e[_0xa9ae('0x16')][_0xa9ae('0x6')])){return pm2[_0xb12fa8[_0x2aac9e[_0xa9ae('0x16')][_0xa9ae('0x6')]]](_0x2aac9e['params']['id'])['then'](respondWithResult(_0xfe9ef1,0xc8))[_0xa9ae('0x12')](handleError(_0xfe9ef1,null));}else{return _0xfe9ef1[_0xa9ae('0x6')](0x1f4)[_0xa9ae('0xa')]({'message':_0xa9ae('0x1f')});}};exports[_0xa9ae('0x20')]=function(_0x36bc28,_0x5d0c84){if(_0x36bc28['body']['id']){delete _0x36bc28[_0xa9ae('0x16')]['id'];}if(_0x36bc28[_0xa9ae('0x14')]['id']){return pm2[_0xa9ae('0x21')](_0x36bc28[_0xa9ae('0x14')]['id'])[_0xa9ae('0xe')](function(_0x231152){pm2[_0xa9ae('0x1b')]();return _0x231152[0x0];})[_0xa9ae('0xe')](respondWithResult(_0x5d0c84,null))['catch'](handleError(_0x5d0c84,null));}else{return _0x5d0c84[_0xa9ae('0x6')](0x1f4)['send']({'message':_0xa9ae('0x22')});}}; \ No newline at end of file +var _0xc368=['update','restart','Unknown\x20status','destroy','delete','dump','../../config/pm2','api','path','child_process','exec','bluebird','sendStatus','status','json','error','send','npm\x20install','info','index','list','then','reject','name','express','motion2','length','catch','show','describe','params','body','script','join','../../files/plugins','cwd','chdir','start','Missing\x20name\x20and/or\x20path'];(function(_0x59e73a,_0x556472){var _0x44498a=function(_0x57bf59){while(--_0x57bf59){_0x59e73a['push'](_0x59e73a['shift']());}};_0x44498a(++_0x556472);}(_0xc368,0x7b));var _0x8c36=function(_0x543a8c,_0xcfd4e8){_0x543a8c=_0x543a8c-0x0;var _0x25a028=_0xc368[_0x543a8c];return _0x25a028;};'use strict';var _=require('lodash');var pm2=require(_0x8c36('0x0'));var logger=require('../../config/logger')(_0x8c36('0x1'));var path=require(_0x8c36('0x2'));var exec=require(_0x8c36('0x3'))[_0x8c36('0x4')];var BPromise=require(_0x8c36('0x5'));function handleEntityNotFound(_0x5d3b27,_0x3e9034){return function(_0x3bb30e){if(!_0x3bb30e){_0x5d3b27[_0x8c36('0x6')](0x194);;}return _0x3bb30e;};}function respondWithResult(_0x1d3660,_0x5ebfc1){_0x5ebfc1=_0x5ebfc1||0xc8;return function(_0x554022){if(_0x554022){return _0x1d3660[_0x8c36('0x7')](_0x5ebfc1)[_0x8c36('0x8')](_0x554022);}return null;};}function handleError(_0x3e76be,_0x26bad1){_0x26bad1=_0x26bad1||0x1f4;return function(_0x3af839){logger[_0x8c36('0x9')](_0x3af839['stack']);if(_0x3af839['name']){delete _0x3af839['name'];}_0x3e76be[_0x8c36('0x7')](_0x26bad1)[_0x8c36('0xa')](_0x3af839);};}function execChildProcess(){return new BPromise(function(_0x5132f6,_0x36cb13){exec(_0x8c36('0xb'),function(_0x1d5c61,_0xe7857e,_0x2a8e73){logger[_0x8c36('0xc')](_0xe7857e);logger[_0x8c36('0xc')](_0x2a8e73);if(_0x1d5c61){logger[_0x8c36('0x9')](_0x1d5c61);return _0x36cb13(_0x1d5c61);}return _0x5132f6(_0xe7857e);});});}exports[_0x8c36('0xd')]=function(_0x11f8fa,_0x43736d){return pm2[_0x8c36('0xe')]()[_0x8c36('0xf')](function(_0x220f18){if(_0x220f18){var _0x5dfcd5=_[_0x8c36('0x10')](_0x220f18,function(_0x5e32ad){return _0x5e32ad[_0x8c36('0x11')]===_0x8c36('0x12')||_0x5e32ad[_0x8c36('0x11')]===_0x8c36('0x13');});return{'rows':_0x5dfcd5,'count':_0x5dfcd5[_0x8c36('0x14')]};}return null;})[_0x8c36('0xf')](respondWithResult(_0x43736d,null))[_0x8c36('0x15')](handleError(_0x43736d,null));};exports[_0x8c36('0x16')]=function(_0x30229e,_0x49cafe){return pm2[_0x8c36('0x17')](_0x30229e[_0x8c36('0x18')]['id'])[_0x8c36('0xf')](respondWithResult(_0x49cafe,null))[_0x8c36('0xf')](handleEntityNotFound(_0x49cafe,null))[_0x8c36('0x15')](handleError(_0x49cafe,null));};exports['create']=function(_0x15100f,_0x409de0){if(_0x15100f[_0x8c36('0x19')][_0x8c36('0x11')]&&_0x15100f[_0x8c36('0x19')][_0x8c36('0x1a')]){var _0xfb9763=path[_0x8c36('0x1b')](__dirname,_0x8c36('0x1c'),_0x15100f[_0x8c36('0x19')][_0x8c36('0x1a')]);var _0x14ee6b=process[_0x8c36('0x1d')]();process['chdir'](path['dirname'](_0xfb9763));return execChildProcess()['then'](function(_0x55b844){process[_0x8c36('0x1e')](_0x14ee6b);return pm2[_0x8c36('0x1f')]({'name':_0x15100f[_0x8c36('0x19')][_0x8c36('0x11')],'script':_0xfb9763});})[_0x8c36('0xf')](function(_0x27c0df){pm2['dump']();return _0x27c0df[0x0];})[_0x8c36('0xf')](respondWithResult(_0x409de0,0xc9))['catch'](handleError(_0x409de0,null));}else{return _0x409de0[_0x8c36('0x7')](0x1f4)['send']({'message':_0x8c36('0x20')});}};exports[_0x8c36('0x21')]=function(_0x271ec4,_0x1010c8){if(_0x271ec4['body']['id']){delete _0x271ec4['body']['id'];}var _0x7e7e56={'online':_0x8c36('0x22'),'stopped':'stop'};if(_0x7e7e56['hasOwnProperty'](_0x271ec4[_0x8c36('0x19')][_0x8c36('0x7')])){return pm2[_0x7e7e56[_0x271ec4['body'][_0x8c36('0x7')]]](_0x271ec4[_0x8c36('0x18')]['id'])[_0x8c36('0xf')](respondWithResult(_0x1010c8,0xc8))['catch'](handleError(_0x1010c8,null));}else{return _0x1010c8['status'](0x1f4)[_0x8c36('0xa')]({'message':_0x8c36('0x23')});}};exports[_0x8c36('0x24')]=function(_0x192ce3,_0x3ae970){if(_0x192ce3[_0x8c36('0x19')]['id']){delete _0x192ce3[_0x8c36('0x19')]['id'];}if(_0x192ce3[_0x8c36('0x18')]['id']){return pm2[_0x8c36('0x25')](_0x192ce3[_0x8c36('0x18')]['id'])[_0x8c36('0xf')](function(_0x36648e){pm2[_0x8c36('0x26')]();return _0x36648e[0x0];})[_0x8c36('0xf')](respondWithResult(_0x3ae970,null))[_0x8c36('0x15')](handleError(_0x3ae970,null));}else{return _0x3ae970[_0x8c36('0x7')](0x1f4)[_0x8c36('0xa')]({'message':'Unknown\x20id'});}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index 7538f77..14498b6 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(_0x41941c,_0x510273){var _0x16dbc0=function(_0x4e3451){while(--_0x4e3451){_0x41941c['push'](_0x41941c['shift']());}};_0x16dbc0(++_0x510273);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x1762b4,_0x33d836){_0x1762b4=_0x1762b4-0x0;var _0x29beda=_0xcb91[_0x1762b4];return _0x29beda;};'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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x4af45d,_0x5083e9){var _0x237064=function(_0x1f8f47){while(--_0x1f8f47){_0x4af45d['push'](_0x4af45d['shift']());}};_0x237064(++_0x5083e9);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index 9cb59cc..9dd9304 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 _0xaee6=['DATE','sequelize','exports','INTEGER','STRING'];(function(_0x3f6578,_0x59e953){var _0x59d5fa=function(_0x3cfb46){while(--_0x3cfb46){_0x3f6578['push'](_0x3f6578['shift']());}};_0x59d5fa(++_0x59e953);}(_0xaee6,0x187));var _0x6aee=function(_0x5a2423,_0x2d968e){_0x5a2423=_0x5a2423-0x0;var _0x11b9b6=_0xaee6[_0x5a2423];return _0x11b9b6;};'use strict';var Sequelize=require(_0x6aee('0x0'));module[_0x6aee('0x1')]={'state':{'type':Sequelize[_0x6aee('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x6aee('0x3')]},'scheduledat':{'type':Sequelize[_0x6aee('0x4')]},'uniqueid':{'type':Sequelize[_0x6aee('0x3')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x6aee('0x4')]},'ringtime':{'type':Sequelize[_0x6aee('0x2')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x6aee('0x3')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x6aee('0x3')]}}; \ No newline at end of file +var _0x0272=['INTEGER','sequelize','exports','STRING','DATE'];(function(_0x13ba8b,_0x58a0e9){var _0x3f7b9f=function(_0x1dcce8){while(--_0x1dcce8){_0x13ba8b['push'](_0x13ba8b['shift']());}};_0x3f7b9f(++_0x58a0e9);}(_0x0272,0x15a));var _0x2027=function(_0x2a41c0,_0x254a16){_0x2a41c0=_0x2a41c0-0x0;var _0x58ba79=_0x0272[_0x2a41c0];return _0x58ba79;};'use strict';var Sequelize=require(_0x2027('0x0'));module[_0x2027('0x1')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0x2027('0x2')]},'scheduledat':{'type':Sequelize[_0x2027('0x3')]},'uniqueid':{'type':Sequelize[_0x2027('0x2')]},'starttime':{'type':Sequelize[_0x2027('0x3')]},'responsetime':{'type':Sequelize[_0x2027('0x3')]},'ringtime':{'type':Sequelize[_0x2027('0x4')],'defaultValue':0x0},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x2027('0x2')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index 28f24c0..3bb98f6 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 _0xb6fd=['moment','bluebird','request-promise','../../config/environment','./reportAgentPreview.attributes','exports','define','ReportAgentPreview','lodash','util','../../config/logger','api'];(function(_0x9cce7f,_0x593089){var _0x3ebb6b=function(_0x507727){while(--_0x507727){_0x9cce7f['push'](_0x9cce7f['shift']());}};_0x3ebb6b(++_0x593089);}(_0xb6fd,0x74));var _0xdb6f=function(_0x1100f2,_0xf4c7b5){_0x1100f2=_0x1100f2-0x0;var _0x407e57=_0xb6fd[_0x1100f2];return _0x407e57;};'use strict';var _=require(_0xdb6f('0x0'));var util=require(_0xdb6f('0x1'));var logger=require(_0xdb6f('0x2'))(_0xdb6f('0x3'));var moment=require(_0xdb6f('0x4'));var BPromise=require(_0xdb6f('0x5'));var rp=require(_0xdb6f('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xdb6f('0x7'));var attributes=require(_0xdb6f('0x8'));module[_0xdb6f('0x9')]=function(_0xf42e4e,_0x55e870){return _0xf42e4e[_0xdb6f('0xa')](_0xdb6f('0xb'),attributes,{'tableName':'report_agent_preview','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe373=['request-promise','path','../../config/environment','exports','define','ReportAgentPreview','report_agent_preview','api','moment','bluebird'];(function(_0x398409,_0x33e7e8){var _0x413a40=function(_0x369043){while(--_0x369043){_0x398409['push'](_0x398409['shift']());}};_0x413a40(++_0x33e7e8);}(_0xe373,0x197));var _0x3e37=function(_0x5c5bee,_0x3fa9e2){_0x5c5bee=_0x5c5bee-0x0;var _0x403cc2=_0xe373[_0x5c5bee];return _0x403cc2;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x3e37('0x0'));var moment=require(_0x3e37('0x1'));var BPromise=require(_0x3e37('0x2'));var rp=require(_0x3e37('0x3'));var fs=require('fs');var path=require(_0x3e37('0x4'));var rimraf=require('rimraf');var config=require(_0x3e37('0x5'));var attributes=require('./reportAgentPreview.attributes');module[_0x3e37('0x6')]=function(_0x2492e4,_0x2fd8d8){return _0x2492e4[_0x3e37('0x7')](_0x3e37('0x8'),attributes,{'tableName':_0x3e37('0x9'),'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 db8c33d..1a14a1f 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 _0x29b5=['../../config/logger','../../config/environment','jayson/promise','client','then','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','ReportAgentPreview','create','options','CreateReportAgentPreview','catch','lodash','util','moment','randomstring','../../config/utils'];(function(_0x3f146c,_0x42e0dc){var _0x407f72=function(_0x42ada8){while(--_0x42ada8){_0x3f146c['push'](_0x3f146c['shift']());}};_0x407f72(++_0x42e0dc);}(_0x29b5,0x103));var _0x529b=function(_0x172a65,_0x19f7a1){_0x172a65=_0x172a65-0x0;var _0xbd041b=_0x29b5[_0x172a65];return _0xbd041b;};'use strict';var _=require(_0x529b('0x0'));var util=require(_0x529b('0x1'));var moment=require(_0x529b('0x2'));var BPromise=require('bluebird');var rs=require(_0x529b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x529b('0x4'));var logger=require(_0x529b('0x5'))('rpc');var config=require(_0x529b('0x6'));var jayson=require(_0x529b('0x7'));var client=jayson[_0x529b('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x193107,_0xbc0054,_0x570de6){return new BPromise(function(_0x2542a8,_0x5b0750){return client['request'](_0x193107,_0x570de6)[_0x529b('0x9')](function(_0x20d390){logger[_0x529b('0xa')](_0x529b('0xb'),_0xbc0054,_0x529b('0xc'));logger['debug'](_0x529b('0xd'),_0xbc0054,_0x529b('0xc'),JSON[_0x529b('0xe')](_0x20d390));if(_0x20d390[_0x529b('0xf')]){if(_0x20d390[_0x529b('0xf')][_0x529b('0x10')]===0x1f4){logger[_0x529b('0xf')](_0x529b('0xb'),_0xbc0054,_0x20d390[_0x529b('0xf')][_0x529b('0x11')]);return _0x5b0750(_0x20d390['error'][_0x529b('0x11')]);}logger['error']('ReportAgentPreview,\x20%s,\x20%s',_0xbc0054,_0x20d390[_0x529b('0xf')]['message']);return _0x2542a8(_0x20d390[_0x529b('0xf')]['message']);}else{logger[_0x529b('0xa')]('ReportAgentPreview,\x20%s,\x20%s',_0xbc0054,_0x529b('0xc'));_0x2542a8(_0x20d390[_0x529b('0x12')]['message']);}})['catch'](function(_0xe96b8d){logger[_0x529b('0xf')](_0x529b('0xb'),_0xbc0054,_0xe96b8d);_0x5b0750(_0xe96b8d);});});}exports['CreateReportAgentPreview']=function(_0x55840f){var _0xc7a6f9=this;return new Promise(function(_0x52bc7d,_0x2609d5){return db[_0x529b('0x13')][_0x529b('0x14')](_0x55840f['body'],{'raw':_0x55840f[_0x529b('0x15')]?_0x55840f['options']['raw']===undefined?!![]:![]:!![]})[_0x529b('0x9')](function(_0x23e751){logger[_0x529b('0xa')](_0x529b('0x16'),_0x55840f);logger['debug'](_0x529b('0x16'),_0x55840f,JSON[_0x529b('0xe')](_0x23e751));_0x52bc7d(_0x23e751);})[_0x529b('0x17')](function(_0x242d1f){logger[_0x529b('0xf')](_0x529b('0x16'),_0x242d1f[_0x529b('0x11')],_0x55840f);_0x2609d5(_0xc7a6f9[_0x529b('0xf')](0x1f4,_0x242d1f[_0x529b('0x11')]));});});}; \ No newline at end of file +var _0xc0af=['code','ReportAgentPreview,\x20%s,\x20%s','message','info','result','catch','CreateReportAgentPreview','ReportAgentPreview','create','body','options','then','lodash','util','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','error'];(function(_0x1a77bd,_0x1814ba){var _0x4bb3d0=function(_0x111b86){while(--_0x111b86){_0x1a77bd['push'](_0x1a77bd['shift']());}};_0x4bb3d0(++_0x1814ba);}(_0xc0af,0xff));var _0xfc0a=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xc0af[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0xfc0a('0x0'));var util=require(_0xfc0a('0x1'));var moment=require('moment');var BPromise=require(_0xfc0a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfc0a('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xfc0a('0x4'));var logger=require(_0xfc0a('0x5'))(_0xfc0a('0x6'));var config=require(_0xfc0a('0x7'));var jayson=require(_0xfc0a('0x8'));var client=jayson[_0xfc0a('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x15aac7,_0x4e802d,_0x591eac){return new BPromise(function(_0x3809ca,_0x51bc3d){return client[_0xfc0a('0xa')](_0x15aac7,_0x591eac)['then'](function(_0x494f77){logger['info']('ReportAgentPreview,\x20%s,\x20%s',_0x4e802d,_0xfc0a('0xb'));logger[_0xfc0a('0xc')](_0xfc0a('0xd'),_0x4e802d,_0xfc0a('0xb'),JSON['stringify'](_0x494f77));if(_0x494f77[_0xfc0a('0xe')]){if(_0x494f77[_0xfc0a('0xe')][_0xfc0a('0xf')]===0x1f4){logger[_0xfc0a('0xe')](_0xfc0a('0x10'),_0x4e802d,_0x494f77[_0xfc0a('0xe')]['message']);return _0x51bc3d(_0x494f77[_0xfc0a('0xe')][_0xfc0a('0x11')]);}logger['error'](_0xfc0a('0x10'),_0x4e802d,_0x494f77[_0xfc0a('0xe')][_0xfc0a('0x11')]);return _0x3809ca(_0x494f77[_0xfc0a('0xe')][_0xfc0a('0x11')]);}else{logger[_0xfc0a('0x12')](_0xfc0a('0x10'),_0x4e802d,_0xfc0a('0xb'));_0x3809ca(_0x494f77[_0xfc0a('0x13')][_0xfc0a('0x11')]);}})[_0xfc0a('0x14')](function(_0x52957d){logger[_0xfc0a('0xe')](_0xfc0a('0x10'),_0x4e802d,_0x52957d);_0x51bc3d(_0x52957d);});});}exports[_0xfc0a('0x15')]=function(_0x4179ab){var _0xe00d84=this;return new Promise(function(_0x6e24ae,_0x38b738){return db[_0xfc0a('0x16')][_0xfc0a('0x17')](_0x4179ab[_0xfc0a('0x18')],{'raw':_0x4179ab[_0xfc0a('0x19')]?_0x4179ab[_0xfc0a('0x19')]['raw']===undefined?!![]:![]:!![]})[_0xfc0a('0x1a')](function(_0x3ec21a){logger[_0xfc0a('0x12')](_0xfc0a('0x15'),_0x4179ab);logger[_0xfc0a('0xc')]('CreateReportAgentPreview',_0x4179ab,JSON['stringify'](_0x3ec21a));_0x6e24ae(_0x3ec21a);})['catch'](function(_0x889b6b){logger['error'](_0xfc0a('0x15'),_0x889b6b[_0xfc0a('0x11')],_0x4179ab);_0x38b738(_0xe00d84[_0xfc0a('0xe')](0x1f4,_0x889b6b[_0xfc0a('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index d9ccccd..2992831 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 _0x6a56=['mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','queueNotify','/mail/queues/:id','showMailQueues','post','/chat/queues/:id/notify','/chat/queues/:id','showChatQueues','fax','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','agentNotify','exports','util','path','Router','../../components/auth/service','./rpc.controller','get','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/mixmonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','voiceQueues','/chat/queues','/mail/queues','mailQueues','mailAccounts','/openchannel/queues','/sms/queues','smsQueues','/whatsapp/queues','whatsappQueues','faxQueues','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','/voice/queues/:id','showVoiceQueues','put','updateVoiceQueue','/outbound','outbound','/outbound/channels','outboundChannels','agents','agentCapacity','/telephones','/trunks','trunks','/campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','/mail/queues/waitinginteractions'];(function(_0x1d365b,_0x1d4bad){var _0x5463c7=function(_0x30b7da){while(--_0x30b7da){_0x1d365b['push'](_0x1d365b['shift']());}};_0x5463c7(++_0x1d4bad);}(_0x6a56,0x102));var _0x66a5=function(_0x6dfbaa,_0x31eede){_0x6dfbaa=_0x6dfbaa-0x0;var _0xfbe02=_0x6a56[_0x6dfbaa];return _0xfbe02;};'use strict';var multer=require('multer');var util=require(_0x66a5('0x0'));var path=require(_0x66a5('0x1'));var express=require('express');var router=express[_0x66a5('0x2')]();var auth=require(_0x66a5('0x3'));var controller=require(_0x66a5('0x4'));router[_0x66a5('0x5')]('/voice/channels',auth[_0x66a5('0x6')](),controller[_0x66a5('0x7')]);router['get'](_0x66a5('0x8'),auth['isAuthenticated'](),controller['voiceChannelMixMonitor']);router[_0x66a5('0x5')](_0x66a5('0x9'),auth[_0x66a5('0x6')](),controller[_0x66a5('0xa')]);router[_0x66a5('0x5')]('/voice/queues',auth['isAuthenticated'](),controller[_0x66a5('0xb')]);router[_0x66a5('0x5')](_0x66a5('0xc'),auth[_0x66a5('0x6')](),controller['chatQueues']);router[_0x66a5('0x5')](_0x66a5('0xd'),auth[_0x66a5('0x6')](),controller[_0x66a5('0xe')]);router[_0x66a5('0x5')]('/mail/accounts',auth['isAuthenticated'](),controller[_0x66a5('0xf')]);router['get'](_0x66a5('0x10'),auth['isAuthenticated'](),controller['openchannelQueues']);router[_0x66a5('0x5')](_0x66a5('0x11'),auth[_0x66a5('0x6')](),controller[_0x66a5('0x12')]);router['get'](_0x66a5('0x13'),auth['isAuthenticated'](),controller[_0x66a5('0x14')]);router['get']('/fax/queues',auth['isAuthenticated'](),controller[_0x66a5('0x15')]);router['get']('/voice/queues/preview/:id',auth[_0x66a5('0x6')](),controller['voiceQueuesPreview']);router['get']('/voice/queues/channels',auth[_0x66a5('0x6')](),controller[_0x66a5('0x16')]);router[_0x66a5('0x5')](_0x66a5('0x17'),auth[_0x66a5('0x6')](),controller[_0x66a5('0x18')]);router[_0x66a5('0x5')](_0x66a5('0x19'),auth[_0x66a5('0x6')](),controller[_0x66a5('0x1a')]);router[_0x66a5('0x5')](_0x66a5('0x1b'),auth['isAuthenticated'](),controller['voiceQueuesChannelRedirect']);router[_0x66a5('0x5')](_0x66a5('0x1c'),auth['isAuthenticated'](),controller[_0x66a5('0x1d')]);router[_0x66a5('0x1e')](_0x66a5('0x1c'),auth[_0x66a5('0x6')](),controller[_0x66a5('0x1f')]);router[_0x66a5('0x5')](_0x66a5('0x20'),auth[_0x66a5('0x6')](),controller[_0x66a5('0x21')]);router[_0x66a5('0x5')](_0x66a5('0x22'),auth[_0x66a5('0x6')](),controller[_0x66a5('0x23')]);router[_0x66a5('0x5')]('/agents',auth[_0x66a5('0x6')](),controller[_0x66a5('0x24')]);router[_0x66a5('0x1e')]('/agents/:id/capacity',auth[_0x66a5('0x6')](),controller[_0x66a5('0x25')]);router['get'](_0x66a5('0x26'),auth[_0x66a5('0x6')](),controller['telephones']);router[_0x66a5('0x5')](_0x66a5('0x27'),auth[_0x66a5('0x6')](),controller[_0x66a5('0x28')]);router[_0x66a5('0x5')](_0x66a5('0x29'),auth['isAuthenticated'](),controller['campaigns']);router[_0x66a5('0x5')](_0x66a5('0x2a'),auth[_0x66a5('0x6')](),controller[_0x66a5('0x2b')]);router['get'](_0x66a5('0x2c'),auth[_0x66a5('0x6')](),controller['chatQueuesWaitingInteractions']);router[_0x66a5('0x5')](_0x66a5('0x2d'),auth['isAuthenticated'](),controller[_0x66a5('0x2e')]);router[_0x66a5('0x5')]('/openchannel/queues/waitinginteractions',auth[_0x66a5('0x6')](),controller[_0x66a5('0x2f')]);router[_0x66a5('0x5')](_0x66a5('0x30'),auth[_0x66a5('0x6')](),controller[_0x66a5('0x31')]);router[_0x66a5('0x5')]('/sms/queues/waitinginteractions',auth[_0x66a5('0x6')](),controller[_0x66a5('0x32')]);router[_0x66a5('0x5')](_0x66a5('0x33'),auth[_0x66a5('0x6')](),controller[_0x66a5('0x34')]);router[_0x66a5('0x5')](_0x66a5('0x35'),auth[_0x66a5('0x6')](),controller['faxQueuesWaitingInteractions']);router['post']('/mail/queues/:id/notify',auth['isAuthenticated'](),controller[_0x66a5('0x36')]('mail'));router[_0x66a5('0x5')](_0x66a5('0x37'),auth[_0x66a5('0x6')](),controller[_0x66a5('0x38')]);router[_0x66a5('0x39')](_0x66a5('0x3a'),auth[_0x66a5('0x6')](),controller['queueNotify']('chat'));router['get'](_0x66a5('0x3b'),auth[_0x66a5('0x6')](),controller[_0x66a5('0x3c')]);router[_0x66a5('0x39')]('/fax/queues/:id/notify',auth[_0x66a5('0x6')](),controller[_0x66a5('0x36')](_0x66a5('0x3d')));router[_0x66a5('0x5')]('/fax/queues/:id',auth[_0x66a5('0x6')](),controller['showFaxQueues']);router[_0x66a5('0x39')](_0x66a5('0x3e'),auth[_0x66a5('0x6')](),controller[_0x66a5('0x36')](_0x66a5('0x3f')));router['get'](_0x66a5('0x40'),auth[_0x66a5('0x6')](),controller[_0x66a5('0x41')]);router[_0x66a5('0x39')](_0x66a5('0x42'),auth['isAuthenticated'](),controller[_0x66a5('0x36')](_0x66a5('0x43')));router[_0x66a5('0x39')](_0x66a5('0x44'),auth['isAuthenticated'](),controller[_0x66a5('0x36')](_0x66a5('0x45')));router[_0x66a5('0x5')](_0x66a5('0x46'),auth[_0x66a5('0x6')](),controller[_0x66a5('0x47')]);router[_0x66a5('0x5')](_0x66a5('0x48'),auth[_0x66a5('0x6')](),controller[_0x66a5('0x49')]);router[_0x66a5('0x39')]('/agents/:id/notify',auth[_0x66a5('0x6')](),controller[_0x66a5('0x4a')]);module[_0x66a5('0x4b')]=router; \ No newline at end of file +var _0xcdb1=['/chat/queues/:id/notify','chat','/chat/queues/:id','fax','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','showOpenchannelQueues','sms','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','/whatsapp/queues/:id','showWhatsappQueues','agentNotify','exports','multer','util','Router','../../components/auth/service','./rpc.controller','/voice/channels','voiceChannels','get','/voice/channels/:uniqueid/mixmonitor','isAuthenticated','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','chatQueues','/mail/accounts','mailAccounts','openchannelQueues','/sms/queues','smsQueues','/whatsapp/queues','whatsappQueues','/fax/queues','/voice/queues/preview/:id','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','put','/outbound','outbound','/outbound/channels','outboundChannels','agents','/telephones','telephones','/trunks','trunks','campaigns','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','post','/mail/queues/:id/notify','queueNotify','showMailQueues'];(function(_0x1083f0,_0x190add){var _0x3e671f=function(_0x53d219){while(--_0x53d219){_0x1083f0['push'](_0x1083f0['shift']());}};_0x3e671f(++_0x190add);}(_0xcdb1,0xa6));var _0x1cdb=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xcdb1[_0x19950b];return _0x3c6b41;};'use strict';var multer=require(_0x1cdb('0x0'));var util=require(_0x1cdb('0x1'));var path=require('path');var express=require('express');var router=express[_0x1cdb('0x2')]();var auth=require(_0x1cdb('0x3'));var controller=require(_0x1cdb('0x4'));router['get'](_0x1cdb('0x5'),auth['isAuthenticated'](),controller[_0x1cdb('0x6')]);router[_0x1cdb('0x7')](_0x1cdb('0x8'),auth[_0x1cdb('0x9')](),controller['voiceChannelMixMonitor']);router['get']('/voice/channels/:uniqueid/stopmixmonitor',auth[_0x1cdb('0x9')](),controller[_0x1cdb('0xa')]);router[_0x1cdb('0x7')](_0x1cdb('0xb'),auth[_0x1cdb('0x9')](),controller[_0x1cdb('0xc')]);router[_0x1cdb('0x7')]('/chat/queues',auth[_0x1cdb('0x9')](),controller[_0x1cdb('0xd')]);router[_0x1cdb('0x7')]('/mail/queues',auth[_0x1cdb('0x9')](),controller['mailQueues']);router[_0x1cdb('0x7')](_0x1cdb('0xe'),auth[_0x1cdb('0x9')](),controller[_0x1cdb('0xf')]);router['get']('/openchannel/queues',auth['isAuthenticated'](),controller[_0x1cdb('0x10')]);router[_0x1cdb('0x7')](_0x1cdb('0x11'),auth['isAuthenticated'](),controller[_0x1cdb('0x12')]);router[_0x1cdb('0x7')](_0x1cdb('0x13'),auth[_0x1cdb('0x9')](),controller[_0x1cdb('0x14')]);router[_0x1cdb('0x7')](_0x1cdb('0x15'),auth[_0x1cdb('0x9')](),controller['faxQueues']);router[_0x1cdb('0x7')](_0x1cdb('0x16'),auth[_0x1cdb('0x9')](),controller['voiceQueuesPreview']);router[_0x1cdb('0x7')](_0x1cdb('0x17'),auth[_0x1cdb('0x9')](),controller[_0x1cdb('0x18')]);router['get'](_0x1cdb('0x19'),auth['isAuthenticated'](),controller['voiceQueuesChannel']);router[_0x1cdb('0x7')](_0x1cdb('0x1a'),auth['isAuthenticated'](),controller[_0x1cdb('0x1b')]);router[_0x1cdb('0x7')](_0x1cdb('0x1c'),auth[_0x1cdb('0x9')](),controller[_0x1cdb('0x1d')]);router[_0x1cdb('0x7')](_0x1cdb('0x1e'),auth[_0x1cdb('0x9')](),controller[_0x1cdb('0x1f')]);router[_0x1cdb('0x20')](_0x1cdb('0x1e'),auth[_0x1cdb('0x9')](),controller['updateVoiceQueue']);router['get'](_0x1cdb('0x21'),auth[_0x1cdb('0x9')](),controller[_0x1cdb('0x22')]);router[_0x1cdb('0x7')](_0x1cdb('0x23'),auth['isAuthenticated'](),controller[_0x1cdb('0x24')]);router['get']('/agents',auth[_0x1cdb('0x9')](),controller[_0x1cdb('0x25')]);router[_0x1cdb('0x20')]('/agents/:id/capacity',auth[_0x1cdb('0x9')](),controller['agentCapacity']);router[_0x1cdb('0x7')](_0x1cdb('0x26'),auth['isAuthenticated'](),controller[_0x1cdb('0x27')]);router[_0x1cdb('0x7')](_0x1cdb('0x28'),auth[_0x1cdb('0x9')](),controller[_0x1cdb('0x29')]);router[_0x1cdb('0x7')]('/campaigns',auth['isAuthenticated'](),controller[_0x1cdb('0x2a')]);router[_0x1cdb('0x7')]('/fax/accounts',auth['isAuthenticated'](),controller[_0x1cdb('0x2b')]);router[_0x1cdb('0x7')](_0x1cdb('0x2c'),auth['isAuthenticated'](),controller[_0x1cdb('0x2d')]);router[_0x1cdb('0x7')](_0x1cdb('0x2e'),auth['isAuthenticated'](),controller[_0x1cdb('0x2f')]);router['get'](_0x1cdb('0x30'),auth['isAuthenticated'](),controller[_0x1cdb('0x31')]);router['get']('/openchannel/queues/:id/waitinginteractions',auth[_0x1cdb('0x9')](),controller[_0x1cdb('0x32')]);router[_0x1cdb('0x7')](_0x1cdb('0x33'),auth[_0x1cdb('0x9')](),controller[_0x1cdb('0x34')]);router[_0x1cdb('0x7')]('/whatsapp/queues/waitinginteractions',auth[_0x1cdb('0x9')](),controller[_0x1cdb('0x35')]);router[_0x1cdb('0x7')]('/fax/queues/waitinginteractions',auth[_0x1cdb('0x9')](),controller[_0x1cdb('0x36')]);router[_0x1cdb('0x37')](_0x1cdb('0x38'),auth['isAuthenticated'](),controller[_0x1cdb('0x39')]('mail'));router[_0x1cdb('0x7')]('/mail/queues/:id',auth[_0x1cdb('0x9')](),controller[_0x1cdb('0x3a')]);router[_0x1cdb('0x37')](_0x1cdb('0x3b'),auth[_0x1cdb('0x9')](),controller['queueNotify'](_0x1cdb('0x3c')));router[_0x1cdb('0x7')](_0x1cdb('0x3d'),auth[_0x1cdb('0x9')](),controller['showChatQueues']);router['post']('/fax/queues/:id/notify',auth[_0x1cdb('0x9')](),controller[_0x1cdb('0x39')](_0x1cdb('0x3e')));router[_0x1cdb('0x7')](_0x1cdb('0x3f'),auth[_0x1cdb('0x9')](),controller[_0x1cdb('0x40')]);router['post'](_0x1cdb('0x41'),auth[_0x1cdb('0x9')](),controller[_0x1cdb('0x39')]('openchannel'));router[_0x1cdb('0x7')]('/openchannel/queues/:id',auth['isAuthenticated'](),controller[_0x1cdb('0x42')]);router[_0x1cdb('0x37')]('/sms/queues/:id/notify',auth[_0x1cdb('0x9')](),controller[_0x1cdb('0x39')](_0x1cdb('0x43')));router[_0x1cdb('0x37')](_0x1cdb('0x44'),auth[_0x1cdb('0x9')](),controller[_0x1cdb('0x39')](_0x1cdb('0x45')));router[_0x1cdb('0x7')](_0x1cdb('0x46'),auth[_0x1cdb('0x9')](),controller['showSmsQueues']);router[_0x1cdb('0x7')](_0x1cdb('0x47'),auth[_0x1cdb('0x9')](),controller[_0x1cdb('0x48')]);router[_0x1cdb('0x37')]('/agents/:id/notify',auth[_0x1cdb('0x9')](),controller[_0x1cdb('0x49')]);module[_0x1cdb('0x4a')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index 49fe7a8..e64ae9d 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 _0xb458=['InteractionId','TransferReport','agentTransferTimeout','bluebird','moment','lodash','../../config/logger','api','jayson/promise','client','http','request','then','error','code','catch','status','json','sendStatus','stack','name','send','isNil','rows','find','voiceChannels','VoiceChannels','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','query','VoiceChannelStopMixMonitor','params','showVoiceQueues','VoiceQueues','updateVoiceQueue','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','VoiceQueuesChannel','voiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outbound','Outbound','outboundChannels','OutboundChannels','Agents','agentCapacity','interaction','user','hasOwnProperty','findAll','INTERACTION','format','YYYY-MM-DD\x20HH:mm:ss','length','updateAttributes','MemberReport','interface','SIP/%s','agent','internal','AgentCapacity','capacity','Telephones','trunks','Trunks','Campaigns','ChatQueues','showChatQueues','MailQueues','showMailQueues','mailAccounts','MailAccounts','openchannelQueues','OpenchannelQueues','smsQueues','SmsQueues','WhatsappQueues','showFaxQueues','FaxQueues','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','filter','map','queue_id','uniq','value','indexOf','smsQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','chat','Website','Account','Queue','Message','Interaction','update','queue','MessageId','From','QueueId','create','Start','queueTransferTimeout','*,*,*,*','agentNotify','channel','User','findOne','Agent\x20not\x20found','messageId','\x20Message\x20not\x20found'];(function(_0x5980a3,_0xf86730){var _0x49031e=function(_0x264f42){while(--_0x264f42){_0x5980a3['push'](_0x5980a3['shift']());}};_0x49031e(++_0xf86730);}(_0xb458,0x103));var _0x8b45=function(_0x42e39f,_0x561650){_0x42e39f=_0x42e39f-0x0;var _0x5b585f=_0xb458[_0x42e39f];return _0x5b585f;};'use strict';var BPromise=require(_0x8b45('0x0'));var moment=require(_0x8b45('0x1'));var _=require(_0x8b45('0x2'));var util=require('util');var db=require('../../mysqldb')['db'];var logger=require(_0x8b45('0x3'))(_0x8b45('0x4'));var jayson=require(_0x8b45('0x5'));var amiClient=jayson[_0x8b45('0x6')]['http']({'port':0x232a});var mailClient=jayson[_0x8b45('0x6')]['http']({'port':0x232b});var routingClient=jayson['client'][_0x8b45('0x7')]({'port':0x232c});function respondWithRpcPromise(_0x12bd05,_0x2daa9a,_0x3a8ccb){return new BPromise(function(_0x32342f,_0x4d1718){var _0xa54725=_0x3a8ccb?_0x3a8ccb:amiClient;return _0xa54725[_0x8b45('0x8')](_0x12bd05,_0x2daa9a)[_0x8b45('0x9')](function(_0x2bc809){if(_0x2bc809[_0x8b45('0xa')]){if(_0x2bc809['error'][_0x8b45('0xb')]===0x1f4){return _0x4d1718(_0x2bc809[_0x8b45('0xa')]['message']);}return _0x32342f(_0x2bc809['error']['message']);}else{_0x32342f(_0x2bc809['result']);}})[_0x8b45('0xc')](function(_0x285728){_0x4d1718(_0x285728);});});}function respondWithResult(_0x37c220,_0x52c4db){_0x52c4db=_0x52c4db||0xc8;return function(_0x30d38c){if(_0x30d38c){return _0x37c220[_0x8b45('0xd')](_0x52c4db)[_0x8b45('0xe')](_0x30d38c);}return _0x37c220[_0x8b45('0xf')](0x194);};}function handleError(_0x32babc,_0x2ad2ae){_0x2ad2ae=_0x2ad2ae||0x1f4;return function(_0x5f0b20){logger['error'](_0x5f0b20[_0x8b45('0x10')]);if(_0x5f0b20[_0x8b45('0x11')]){delete _0x5f0b20[_0x8b45('0x11')];}_0x32babc[_0x8b45('0xd')](_0x2ad2ae)[_0x8b45('0x12')](_0x5f0b20);};}function findById(_0x27ebb3){return function(_0x902c50){if(!_[_0x8b45('0x13')](_0x27ebb3)&&!_[_0x8b45('0x13')](_0x902c50)&&!_[_0x8b45('0x13')](_0x902c50[_0x8b45('0x14')])){return _[_0x8b45('0x15')](_0x902c50[_0x8b45('0x14')],function(_0x43ffb7){return _0x43ffb7['id']==_0x27ebb3;});}return null;};}exports[_0x8b45('0x16')]=function(_0x31c6b4,_0x23c520){return respondWithRpcPromise(_0x8b45('0x17'),_0x31c6b4['query'])[_0x8b45('0x9')](respondWithResult(_0x23c520,null))[_0x8b45('0xc')](handleError(_0x23c520,null));};exports[_0x8b45('0x18')]=function(_0x46e21a,_0x3e1438){return respondWithRpcPromise(_0x8b45('0x19'),_[_0x8b45('0x1a')](_0x46e21a[_0x8b45('0x1b')],_0x46e21a['params']))['then'](respondWithResult(_0x3e1438,null))[_0x8b45('0xc')](handleError(_0x3e1438,null));};exports['voiceChannelStopMixMonitor']=function(_0x1952fc,_0x3ddb50){return respondWithRpcPromise(_0x8b45('0x1c'),_[_0x8b45('0x1a')](_0x1952fc[_0x8b45('0x1b')],_0x1952fc[_0x8b45('0x1d')]))[_0x8b45('0x9')](respondWithResult(_0x3ddb50,null))['catch'](handleError(_0x3ddb50,null));};exports['voiceQueues']=function(_0x11ffcc,_0x2c2c06){return respondWithRpcPromise('VoiceQueues',_0x11ffcc['query'])[_0x8b45('0x9')](respondWithResult(_0x2c2c06,null))[_0x8b45('0xc')](handleError(_0x2c2c06,null));};exports[_0x8b45('0x1e')]=function(_0x2f37bc,_0x4e84cc){return respondWithRpcPromise(_0x8b45('0x1f'),_0x2f37bc[_0x8b45('0x1b')])[_0x8b45('0x9')](findById(_0x2f37bc[_0x8b45('0x1d')]['id']))[_0x8b45('0x9')](respondWithResult(_0x4e84cc,null))[_0x8b45('0xc')](handleError(_0x4e84cc,null));};exports[_0x8b45('0x20')]=function(_0x234f62,_0x1733a7){return respondWithRpcPromise(_0x8b45('0x21'),_[_0x8b45('0x1a')](_0x234f62[_0x8b45('0x22')],_0x234f62[_0x8b45('0x1d')]))['then'](respondWithResult(_0x1733a7,null))[_0x8b45('0xc')](handleError(_0x1733a7,null));};exports[_0x8b45('0x23')]=function(_0x34eb03,_0x15107a){return respondWithRpcPromise(_0x8b45('0x24'),_[_0x8b45('0x1a')](_0x34eb03[_0x8b45('0x1b')],_0x34eb03[_0x8b45('0x1d')]))['then'](respondWithResult(_0x15107a,null))[_0x8b45('0xc')](handleError(_0x15107a,null));};exports[_0x8b45('0x25')]=function(_0x50302,_0xc2ae94){return respondWithRpcPromise(_0x8b45('0x26'),_0x50302['query'])[_0x8b45('0x9')](respondWithResult(_0xc2ae94,null))['catch'](handleError(_0xc2ae94,null));};exports['voiceQueuesChannel']=function(_0x1f8a11,_0x94e3b6){return respondWithRpcPromise(_0x8b45('0x27'),_[_0x8b45('0x1a')](_0x1f8a11[_0x8b45('0x1b')],_0x1f8a11[_0x8b45('0x1d')]))['then'](respondWithResult(_0x94e3b6,null))[_0x8b45('0xc')](handleError(_0x94e3b6,null));};exports[_0x8b45('0x28')]=function(_0x264be7,_0x1f66a3){return respondWithRpcPromise('VoiceQueuesChannelHangup',_[_0x8b45('0x1a')](_0x264be7[_0x8b45('0x1b')],_0x264be7[_0x8b45('0x1d')]))['then'](respondWithResult(_0x1f66a3,null))[_0x8b45('0xc')](handleError(_0x1f66a3,null));};exports[_0x8b45('0x29')]=function(_0x1571b7,_0x58f32e){return respondWithRpcPromise(_0x8b45('0x2a'),_[_0x8b45('0x1a')](_0x1571b7[_0x8b45('0x1b')],_0x1571b7[_0x8b45('0x1d')]))['then'](respondWithResult(_0x58f32e,null))[_0x8b45('0xc')](handleError(_0x58f32e,null));};exports[_0x8b45('0x2b')]=function(_0x2de02d,_0x15df7c){return respondWithRpcPromise(_0x8b45('0x2c'),_0x2de02d[_0x8b45('0x1b')])['then'](respondWithResult(_0x15df7c,null))['catch'](handleError(_0x15df7c,null));};exports[_0x8b45('0x2d')]=function(_0x179f3b,_0x41d6b5){return respondWithRpcPromise(_0x8b45('0x2e'),_0x179f3b[_0x8b45('0x1b')])['then'](respondWithResult(_0x41d6b5,null))[_0x8b45('0xc')](handleError(_0x41d6b5,null));};exports['agents']=function(_0x67c59a,_0x17e9a8){var _0x5fae26;return respondWithRpcPromise(_0x8b45('0x2f'),_0x67c59a[_0x8b45('0x1b')])[_0x8b45('0x9')](function(_0x14d665){_0x5fae26=_0x14d665;return respondWithRpcPromise(_0x8b45('0x2f'),_0x67c59a[_0x8b45('0x1b')],routingClient);})[_0x8b45('0x9')](function(_0x3a97d5){return _['merge']({},_0x3a97d5,_0x5fae26);})[_0x8b45('0x9')](respondWithResult(_0x17e9a8,null))['catch'](handleError(_0x17e9a8,null));};exports[_0x8b45('0x30')]=function(_0x4eda71,_0x412c53){if(_0x4eda71[_0x8b45('0x22')]&&_0x4eda71[_0x8b45('0x22')][_0x8b45('0x31')]&&_0x4eda71[_0x8b45('0x32')]&&_0x4eda71[_0x8b45('0x32')]['name']){for(var _0x6fbca4 in _0x4eda71['body']['interaction']){if(_0x4eda71[_0x8b45('0x22')][_0x8b45('0x31')][_0x8b45('0x33')](_0x6fbca4)){db['MemberReport'][_0x8b45('0x34')]({'where':{'channel':_0x6fbca4,'membername':_0x4eda71['user'][_0x8b45('0x11')],'type':_0x8b45('0x35'),'exitAt':null,'uniqueid':_0x4eda71[_0x8b45('0x22')][_0x8b45('0x31')][_0x6fbca4]&&_0x4eda71[_0x8b45('0x22')][_0x8b45('0x31')][_0x6fbca4]['length']?{'$notIn':_0x4eda71[_0x8b45('0x22')][_0x8b45('0x31')][_0x6fbca4]}:{'$ne':null}}})[_0x8b45('0x9')](function(_0xee45ac){var _0x1a13dd=moment()[_0x8b45('0x36')](_0x8b45('0x37'));for(var _0x3de3c2=0x0,_0x37b94a=_0xee45ac[_0x8b45('0x38')];_0x3de3c2<_0x37b94a;_0x3de3c2+=0x1){_0xee45ac[_0x3de3c2][_0x8b45('0x39')]({'exitAt':_0x1a13dd});}});for(var _0x3385db=0x0;_0x3385db<_0x4eda71[_0x8b45('0x22')][_0x8b45('0x31')][_0x6fbca4][_0x8b45('0x38')];_0x3385db+=0x1){db[_0x8b45('0x3a')]['findOrCreate']({'where':{'channel':_0x6fbca4,'membername':_0x4eda71['user']['name'],'type':_0x8b45('0x35'),'uniqueid':_0x4eda71[_0x8b45('0x22')][_0x8b45('0x31')][_0x6fbca4][_0x3385db],'exitAt':null},'defaults':{'channel':_0x6fbca4,'membername':_0x4eda71[_0x8b45('0x32')][_0x8b45('0x11')],'interface':_[_0x8b45('0x13')](_0x4eda71[_0x8b45('0x32')][_0x8b45('0x3b')])?util['format'](_0x8b45('0x3c'),_0x4eda71['user'][_0x8b45('0x11')]):_0x4eda71[_0x8b45('0x32')][_0x8b45('0x3b')],'type':_0x8b45('0x35'),'enterAt':moment()['format'](_0x8b45('0x37')),'role':_0x8b45('0x3d'),'internal':_0x4eda71['user'][_0x8b45('0x3e')],'uniqueid':_0x4eda71[_0x8b45('0x22')]['interaction'][_0x6fbca4][_0x3385db]}});}}}}return respondWithRpcPromise(_0x8b45('0x3f'),{'id':_0x4eda71[_0x8b45('0x1d')]['id'],'capacity':_0x4eda71[_0x8b45('0x22')][_0x8b45('0x40')]},routingClient)[_0x8b45('0x9')](respondWithResult(_0x412c53,null))[_0x8b45('0xc')](handleError(_0x412c53,null));};exports['telephones']=function(_0x4b8826,_0x3f7a16){return respondWithRpcPromise(_0x8b45('0x41'),_0x4b8826[_0x8b45('0x1b')])['then'](respondWithResult(_0x3f7a16,null))[_0x8b45('0xc')](handleError(_0x3f7a16,null));};exports[_0x8b45('0x42')]=function(_0x20a68b,_0x3e8a7d){return respondWithRpcPromise(_0x8b45('0x43'),_0x20a68b['query'])[_0x8b45('0x9')](respondWithResult(_0x3e8a7d,null))[_0x8b45('0xc')](handleError(_0x3e8a7d,null));};exports['campaigns']=function(_0x422da0,_0x4c3f38){return respondWithRpcPromise(_0x8b45('0x44'),_0x422da0[_0x8b45('0x1b')])[_0x8b45('0x9')](respondWithResult(_0x4c3f38,null))[_0x8b45('0xc')](handleError(_0x4c3f38,null));};exports['chatQueues']=function(_0xb9f390,_0x423231){return respondWithRpcPromise(_0x8b45('0x45'),_0xb9f390[_0x8b45('0x1b')],routingClient)[_0x8b45('0x9')](respondWithResult(_0x423231,null))[_0x8b45('0xc')](handleError(_0x423231,null));};exports[_0x8b45('0x46')]=function(_0x2a35c1,_0x446fe5){return respondWithRpcPromise(_0x8b45('0x45'),_0x2a35c1[_0x8b45('0x1b')],routingClient)[_0x8b45('0x9')](findById(_0x2a35c1[_0x8b45('0x1d')]['id']))[_0x8b45('0x9')](respondWithResult(_0x446fe5,null))[_0x8b45('0xc')](handleError(_0x446fe5,null));};exports['mailQueues']=function(_0x1744f8,_0x1477bd){return respondWithRpcPromise(_0x8b45('0x47'),_0x1744f8['query'],routingClient)[_0x8b45('0x9')](respondWithResult(_0x1477bd,null))[_0x8b45('0xc')](handleError(_0x1477bd,null));};exports[_0x8b45('0x48')]=function(_0x9eacc1,_0x5795ca){return respondWithRpcPromise(_0x8b45('0x47'),_0x9eacc1[_0x8b45('0x1b')],routingClient)[_0x8b45('0x9')](findById(_0x9eacc1[_0x8b45('0x1d')]['id']))['then'](respondWithResult(_0x5795ca,null))[_0x8b45('0xc')](handleError(_0x5795ca,null));};exports[_0x8b45('0x49')]=function(_0x417778,_0x27503f){return respondWithRpcPromise(_0x8b45('0x4a'),_0x417778['query'],mailClient)[_0x8b45('0x9')](respondWithResult(_0x27503f,null))['catch'](handleError(_0x27503f,null));};exports[_0x8b45('0x4b')]=function(_0x2f7ab0,_0x19152b){return respondWithRpcPromise(_0x8b45('0x4c'),_0x2f7ab0[_0x8b45('0x1b')],routingClient)[_0x8b45('0x9')](respondWithResult(_0x19152b,null))['catch'](handleError(_0x19152b,null));};exports['showOpenchannelQueues']=function(_0x5ace1,_0x2224b7){return respondWithRpcPromise('OpenchannelQueues',_0x5ace1[_0x8b45('0x1b')],routingClient)[_0x8b45('0x9')](findById(_0x5ace1[_0x8b45('0x1d')]['id']))['then'](respondWithResult(_0x2224b7,null))['catch'](handleError(_0x2224b7,null));};exports[_0x8b45('0x4d')]=function(_0x8e5a41,_0x5abc79){return respondWithRpcPromise(_0x8b45('0x4e'),_0x8e5a41['query'],routingClient)[_0x8b45('0x9')](respondWithResult(_0x5abc79,null))['catch'](handleError(_0x5abc79,null));};exports['showSmsQueues']=function(_0x28e57a,_0x7f5a4e){return respondWithRpcPromise('SmsQueues',_0x28e57a[_0x8b45('0x1b')],routingClient)[_0x8b45('0x9')](findById(_0x28e57a[_0x8b45('0x1d')]['id']))[_0x8b45('0x9')](respondWithResult(_0x7f5a4e,null))[_0x8b45('0xc')](handleError(_0x7f5a4e,null));};exports['whatsappQueues']=function(_0x37f580,_0x3b3d21){return respondWithRpcPromise(_0x8b45('0x4f'),_0x37f580['query'],routingClient)['then'](respondWithResult(_0x3b3d21,null))[_0x8b45('0xc')](handleError(_0x3b3d21,null));};exports['showWhatsappQueues']=function(_0x43f031,_0x5a4834){return respondWithRpcPromise('WhatsappQueues',_0x43f031['query'],routingClient)[_0x8b45('0x9')](findById(_0x43f031['params']['id']))[_0x8b45('0x9')](respondWithResult(_0x5a4834,null))[_0x8b45('0xc')](handleError(_0x5a4834,null));};exports['faxQueues']=function(_0x3db84e,_0x1b3890){return respondWithRpcPromise('FaxQueues',_0x3db84e[_0x8b45('0x1b')],routingClient)[_0x8b45('0x9')](respondWithResult(_0x1b3890,null))[_0x8b45('0xc')](handleError(_0x1b3890,null));};exports[_0x8b45('0x50')]=function(_0x15cf9d,_0x877766){return respondWithRpcPromise(_0x8b45('0x51'),_0x15cf9d[_0x8b45('0x1b')],routingClient)[_0x8b45('0x9')](findById(_0x15cf9d[_0x8b45('0x1d')]['id']))[_0x8b45('0x9')](respondWithResult(_0x877766,null))[_0x8b45('0xc')](handleError(_0x877766,null));};exports['faxAccounts']=function(_0x225180,_0x403ee2){return respondWithRpcPromise(_0x8b45('0x52'),_0x225180[_0x8b45('0x1b')])[_0x8b45('0x9')](respondWithResult(_0x403ee2,null))[_0x8b45('0xc')](handleError(_0x403ee2,null));};exports[_0x8b45('0x53')]=function(_0x3d3216,_0x243632){return respondWithRpcPromise(_0x8b45('0x54'),_0x3d3216[_0x8b45('0x1b')],routingClient)[_0x8b45('0x9')](respondWithResult(_0x243632,null))[_0x8b45('0xc')](handleError(_0x243632,null));};exports[_0x8b45('0x55')]=function(_0x562c5f,_0x53143d){return respondWithRpcPromise(_0x8b45('0x56'),_0x562c5f[_0x8b45('0x1b')],routingClient)[_0x8b45('0x9')](respondWithResult(_0x53143d,null))[_0x8b45('0xc')](handleError(_0x53143d,null));};exports[_0x8b45('0x57')]=function(_0xd88538,_0x1ebbca){return respondWithRpcPromise(_0x8b45('0x58'),_0xd88538['query'],routingClient)[_0x8b45('0x9')](respondWithResult(_0x1ebbca,null))[_0x8b45('0xc')](handleError(_0x1ebbca,null));};exports[_0x8b45('0x59')]=function(_0xa22bd0,_0xa44ba5){return respondWithRpcPromise(_0x8b45('0x58'),_0xa22bd0[_0x8b45('0x1b')],routingClient)[_0x8b45('0x9')](function(_0x2a6fee){if(_0xa22bd0[_0x8b45('0x1b')][_0x8b45('0x5a')]!==undefined){var _0x5e54c6=_(_0x2a6fee['rows'])[_0x8b45('0x5b')]([_0xa22bd0[_0x8b45('0x1b')][_0x8b45('0x5a')],_0xa22bd0[_0x8b45('0x1d')]['id']])[_0x8b45('0x5c')](_0x8b45('0x5d'))[_0x8b45('0x5e')]()[_0x8b45('0x5f')]();return _0x2a6fee[_0x8b45('0x14')]['filter'](function(_0x55acf0){return _0x5e54c6[_0x8b45('0x60')](_0x55acf0[_0x8b45('0x5d')])>-0x1;});}else{return _0x2a6fee[_0x8b45('0x14')][_0x8b45('0x5b')](function(_0x55bafb){return _0x55bafb[_0x8b45('0x5d')]===parseInt(_0xa22bd0[_0x8b45('0x1d')]['id']);});}})[_0x8b45('0x9')](respondWithResult(_0xa44ba5,null))[_0x8b45('0xc')](handleError(_0xa44ba5,null));};exports[_0x8b45('0x61')]=function(_0x17588b,_0x4ed113){return respondWithRpcPromise('SmsQueuesWaitingInteractions',_0x17588b[_0x8b45('0x1b')],routingClient)['then'](respondWithResult(_0x4ed113,null))['catch'](handleError(_0x4ed113,null));};exports['whatsappQueuesWaitingInteractions']=function(_0xf602c7,_0x170b95){return respondWithRpcPromise(_0x8b45('0x62'),_0xf602c7[_0x8b45('0x1b')],routingClient)[_0x8b45('0x9')](respondWithResult(_0x170b95,null))[_0x8b45('0xc')](handleError(_0x170b95,null));};exports[_0x8b45('0x63')]=function(_0xc9be77,_0xc89fc6){return respondWithRpcPromise(_0x8b45('0x64'),_0xc9be77[_0x8b45('0x1b')],routingClient)[_0x8b45('0x9')](respondWithResult(_0xc89fc6,null))[_0x8b45('0xc')](handleError(_0xc89fc6,null));};exports[_0x8b45('0x65')]=function(_0x42b192){return function(_0x4a42e1,_0x29bfcc){var _0x91270d,_0x217798;var _0x19a135=_[_0x8b45('0x66')](_0x42b192);var _0x1446b1=_0x42b192===_0x8b45('0x67')?_0x8b45('0x68'):_0x8b45('0x69');return db[_0x19a135+_0x8b45('0x6a')]['findOne']({'raw':!![],'where':{'id':_0x4a42e1[_0x8b45('0x1d')]['id']}})[_0x8b45('0x9')](function(_0x408fff){if(_[_0x8b45('0x13')](_0x408fff)){throw new Error(_0x19a135+'\x20Queue\x20not\x20found');}_0x91270d=_0x408fff;return db[_0x19a135+_0x8b45('0x6b')]['findOne']({'where':{'id':_0x4a42e1[_0x8b45('0x22')]['messageId']},'include':[{'model':db[_0x19a135+_0x8b45('0x6c')],'as':_0x8b45('0x6c')},{'model':db[_0x19a135+_0x1446b1],'as':_0x8b45('0x69')}]});})[_0x8b45('0x9')](function(_0x16bb83){if(_[_0x8b45('0x13')](_0x16bb83)){throw new Error(_0x19a135+'\x20Message\x20not\x20found');}_0x217798=_0x16bb83;return _0x16bb83[_0x8b45('0x6d')]({'read':0x0,'readAt':null,'UserId':null});})[_0x8b45('0x9')](function(){var _0x17364d={'uniqueid':_0x42b192+'.'+_0x217798['id']+'.'+_0x217798[_0x8b45('0x6c')]['id'],'FromUserId':_0x4a42e1['user']['id'],'type':_0x8b45('0x6e')};_0x17364d[_0x19a135+_0x8b45('0x6f')]=_0x217798['id'];_0x17364d[_0x19a135+'InteractionId']=_0x217798['Interaction']['id'];_0x17364d[_0x8b45('0x70')+_0x19a135+_0x1446b1+'Id']=_0x217798[_0x8b45('0x69')]['id'];_0x17364d['To'+_0x19a135+_0x8b45('0x71')]=_0x91270d['id'];return db[_0x19a135+'TransferReport'][_0x8b45('0x72')](_0x17364d);})['then'](function(){return respondWithRpcPromise(_0x8b45('0x73'),{'channel':_0x42b192,'interaction':_0x217798[_0x8b45('0x6c')],'message':_0x217798,'account':_0x217798['Account'],'applications':[{'id':0x0,'priority':0x1,'app':'queue','appdata':_0x91270d[_0x8b45('0x11')]+','+(_0x217798[_0x8b45('0x69')][_0x8b45('0x74')]||0x12c),'interval':_0x8b45('0x75')}]},routingClient);})['then'](respondWithResult(_0x29bfcc,null))[_0x8b45('0xc')](handleError(_0x29bfcc,null));};};exports[_0x8b45('0x76')]=function(_0x376416,_0x1d475c){var _0x2680d5,_0x1abe69;if(_['isNil'](_0x376416[_0x8b45('0x22')][_0x8b45('0x77')])){throw new Error('Channel\x20field\x20is\x20mandatory');}var _0x10a91a=_0x376416[_0x8b45('0x22')]['channel'];var _0x4837af=_['capitalize'](_0x10a91a);var _0x186aa2=_0x10a91a===_0x8b45('0x67')?_0x8b45('0x68'):_0x8b45('0x69');return db[_0x8b45('0x78')][_0x8b45('0x79')]({'raw':!![],'where':{'id':_0x376416[_0x8b45('0x1d')]['id'],'role':'agent'}})[_0x8b45('0x9')](function(_0x3d321f){if(_[_0x8b45('0x13')](_0x3d321f)){throw new Error(_0x8b45('0x7a'));}_0x2680d5=_0x3d321f;return db[_0x4837af+_0x8b45('0x6b')][_0x8b45('0x79')]({'where':{'id':_0x376416['body'][_0x8b45('0x7b')]},'include':[{'model':db[_0x4837af+_0x8b45('0x6c')],'as':_0x8b45('0x6c')},{'model':db[_0x4837af+_0x186aa2],'as':_0x8b45('0x69')}]});})[_0x8b45('0x9')](function(_0x4c3bc9){if(_['isNil'](_0x4c3bc9)){throw new Error(_0x4837af+_0x8b45('0x7c'));}_0x1abe69=_0x4c3bc9;return _0x4c3bc9[_0x8b45('0x6d')]({'read':0x0,'readAt':null,'UserId':null});})[_0x8b45('0x9')](function(){var _0x9993ce={'uniqueid':_0x10a91a+'.'+_0x1abe69['id']+'.'+_0x1abe69[_0x8b45('0x6c')]['id'],'FromUserId':_0x376416['user']['id'],'type':_0x8b45('0x6e'),'ToUserId':_0x2680d5['id']};_0x9993ce[_0x4837af+'MessageId']=_0x1abe69['id'];_0x9993ce[_0x4837af+_0x8b45('0x7d')]=_0x1abe69['Interaction']['id'];_0x9993ce[_0x8b45('0x70')+_0x4837af+_0x186aa2+'Id']=_0x1abe69[_0x8b45('0x69')]['id'];return db[_0x4837af+_0x8b45('0x7e')][_0x8b45('0x72')](_0x9993ce);})[_0x8b45('0x9')](function(){return respondWithRpcPromise(_0x8b45('0x73'),{'channel':_0x10a91a,'interaction':_0x1abe69[_0x8b45('0x6c')],'message':_0x1abe69,'account':_0x1abe69[_0x8b45('0x69')],'applications':[{'id':0x0,'priority':0x1,'app':_0x8b45('0x3d'),'appdata':_0x2680d5[_0x8b45('0x11')]+','+(_0x1abe69[_0x8b45('0x69')][_0x8b45('0x7f')]||0x12c),'interval':_0x8b45('0x75')}]},routingClient);})[_0x8b45('0x9')](respondWithResult(_0x1d475c,null))['catch'](handleError(_0x1d475c,null));}; \ No newline at end of file +var _0x207c=['moment','lodash','util','../../mysqldb','../../config/logger','api','jayson/promise','http','then','error','code','result','status','json','sendStatus','stack','name','isNil','rows','find','voiceChannels','VoiceChannels','query','catch','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','params','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','voiceQueues','VoiceQueues','showVoiceQueues','updateVoiceQueue','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelRedirect','Outbound','outboundChannels','agents','Agents','interaction','user','hasOwnProperty','MemberReport','length','format','YYYY-MM-DD\x20HH:mm:ss','findOrCreate','INTERACTION','interface','agent','capacity','telephones','Telephones','trunks','Trunks','campaigns','Campaigns','chatQueues','showChatQueues','ChatQueues','mailQueues','showMailQueues','MailQueues','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','smsQueues','SmsQueues','whatsappQueues','WhatsappQueues','faxQueues','showFaxQueues','FaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','type','map','queue_id','value','filter','indexOf','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','capitalize','chat','Account','Queue','findOne','Message','messageId','Interaction','queue','QueueId','TransferReport','create','Start','queueTransferTimeout','agentNotify','channel','Channel\x20field\x20is\x20mandatory','Website','User','\x20Message\x20not\x20found','MessageId','From','*,*,*,*'];(function(_0x4131a7,_0x5a761f){var _0x176efd=function(_0xb9ef31){while(--_0xb9ef31){_0x4131a7['push'](_0x4131a7['shift']());}};_0x176efd(++_0x5a761f);}(_0x207c,0x1e8));var _0xc207=function(_0x26dcd8,_0x461d6b){_0x26dcd8=_0x26dcd8-0x0;var _0x1654e9=_0x207c[_0x26dcd8];return _0x1654e9;};'use strict';var BPromise=require('bluebird');var moment=require(_0xc207('0x0'));var _=require(_0xc207('0x1'));var util=require(_0xc207('0x2'));var db=require(_0xc207('0x3'))['db'];var logger=require(_0xc207('0x4'))(_0xc207('0x5'));var jayson=require(_0xc207('0x6'));var amiClient=jayson['client'][_0xc207('0x7')]({'port':0x232a});var mailClient=jayson['client']['http']({'port':0x232b});var routingClient=jayson['client'][_0xc207('0x7')]({'port':0x232c});function respondWithRpcPromise(_0x314561,_0x3395e4,_0x59ff6f){return new BPromise(function(_0x25cb97,_0xad159b){var _0x3c579f=_0x59ff6f?_0x59ff6f:amiClient;return _0x3c579f['request'](_0x314561,_0x3395e4)[_0xc207('0x8')](function(_0x817576){if(_0x817576[_0xc207('0x9')]){if(_0x817576[_0xc207('0x9')][_0xc207('0xa')]===0x1f4){return _0xad159b(_0x817576[_0xc207('0x9')]['message']);}return _0x25cb97(_0x817576['error']['message']);}else{_0x25cb97(_0x817576[_0xc207('0xb')]);}})['catch'](function(_0x2741f3){_0xad159b(_0x2741f3);});});}function respondWithResult(_0x2782ce,_0x59d401){_0x59d401=_0x59d401||0xc8;return function(_0x3e1108){if(_0x3e1108){return _0x2782ce[_0xc207('0xc')](_0x59d401)[_0xc207('0xd')](_0x3e1108);}return _0x2782ce[_0xc207('0xe')](0x194);};}function handleError(_0xe993a0,_0x51e967){_0x51e967=_0x51e967||0x1f4;return function(_0xc62672){logger[_0xc207('0x9')](_0xc62672[_0xc207('0xf')]);if(_0xc62672[_0xc207('0x10')]){delete _0xc62672['name'];}_0xe993a0['status'](_0x51e967)['send'](_0xc62672);};}function findById(_0x1cebfa){return function(_0x6e793d){if(!_[_0xc207('0x11')](_0x1cebfa)&&!_[_0xc207('0x11')](_0x6e793d)&&!_['isNil'](_0x6e793d[_0xc207('0x12')])){return _[_0xc207('0x13')](_0x6e793d[_0xc207('0x12')],function(_0x5f288e){return _0x5f288e['id']==_0x1cebfa;});}return null;};}exports[_0xc207('0x14')]=function(_0x488cc0,_0x42c8ba){return respondWithRpcPromise(_0xc207('0x15'),_0x488cc0[_0xc207('0x16')])[_0xc207('0x8')](respondWithResult(_0x42c8ba,null))[_0xc207('0x17')](handleError(_0x42c8ba,null));};exports[_0xc207('0x18')]=function(_0x35c0b0,_0x464dea){return respondWithRpcPromise(_0xc207('0x19'),_[_0xc207('0x1a')](_0x35c0b0[_0xc207('0x16')],_0x35c0b0[_0xc207('0x1b')]))[_0xc207('0x8')](respondWithResult(_0x464dea,null))['catch'](handleError(_0x464dea,null));};exports[_0xc207('0x1c')]=function(_0x5cda23,_0x2e89c5){return respondWithRpcPromise(_0xc207('0x1d'),_[_0xc207('0x1a')](_0x5cda23[_0xc207('0x16')],_0x5cda23[_0xc207('0x1b')]))[_0xc207('0x8')](respondWithResult(_0x2e89c5,null))[_0xc207('0x17')](handleError(_0x2e89c5,null));};exports[_0xc207('0x1e')]=function(_0xa52138,_0x2385f7){return respondWithRpcPromise(_0xc207('0x1f'),_0xa52138[_0xc207('0x16')])[_0xc207('0x8')](respondWithResult(_0x2385f7,null))[_0xc207('0x17')](handleError(_0x2385f7,null));};exports[_0xc207('0x20')]=function(_0x56a066,_0x1e1440){return respondWithRpcPromise('VoiceQueues',_0x56a066['query'])[_0xc207('0x8')](findById(_0x56a066[_0xc207('0x1b')]['id']))[_0xc207('0x8')](respondWithResult(_0x1e1440,null))[_0xc207('0x17')](handleError(_0x1e1440,null));};exports[_0xc207('0x21')]=function(_0x478af7,_0xe5e848){return respondWithRpcPromise(_0xc207('0x22'),_[_0xc207('0x1a')](_0x478af7[_0xc207('0x23')],_0x478af7[_0xc207('0x1b')]))[_0xc207('0x8')](respondWithResult(_0xe5e848,null))[_0xc207('0x17')](handleError(_0xe5e848,null));};exports[_0xc207('0x24')]=function(_0xc6a7ce,_0x3f79e8){return respondWithRpcPromise(_0xc207('0x25'),_[_0xc207('0x1a')](_0xc6a7ce[_0xc207('0x16')],_0xc6a7ce['params']))[_0xc207('0x8')](respondWithResult(_0x3f79e8,null))[_0xc207('0x17')](handleError(_0x3f79e8,null));};exports[_0xc207('0x26')]=function(_0x448df1,_0x24df00){return respondWithRpcPromise(_0xc207('0x27'),_0x448df1['query'])[_0xc207('0x8')](respondWithResult(_0x24df00,null))[_0xc207('0x17')](handleError(_0x24df00,null));};exports[_0xc207('0x28')]=function(_0x1d12fa,_0x58e906){return respondWithRpcPromise(_0xc207('0x29'),_[_0xc207('0x1a')](_0x1d12fa[_0xc207('0x16')],_0x1d12fa[_0xc207('0x1b')]))[_0xc207('0x8')](respondWithResult(_0x58e906,null))[_0xc207('0x17')](handleError(_0x58e906,null));};exports[_0xc207('0x2a')]=function(_0x458de9,_0x586776){return respondWithRpcPromise('VoiceQueuesChannelHangup',_['merge'](_0x458de9[_0xc207('0x16')],_0x458de9[_0xc207('0x1b')]))[_0xc207('0x8')](respondWithResult(_0x586776,null))[_0xc207('0x17')](handleError(_0x586776,null));};exports['voiceQueuesChannelRedirect']=function(_0x3bfbf4,_0x433c0f){return respondWithRpcPromise(_0xc207('0x2b'),_[_0xc207('0x1a')](_0x3bfbf4[_0xc207('0x16')],_0x3bfbf4['params']))[_0xc207('0x8')](respondWithResult(_0x433c0f,null))[_0xc207('0x17')](handleError(_0x433c0f,null));};exports['outbound']=function(_0x21dd42,_0x49bada){return respondWithRpcPromise(_0xc207('0x2c'),_0x21dd42[_0xc207('0x16')])['then'](respondWithResult(_0x49bada,null))[_0xc207('0x17')](handleError(_0x49bada,null));};exports[_0xc207('0x2d')]=function(_0x3313b1,_0x502dde){return respondWithRpcPromise('OutboundChannels',_0x3313b1[_0xc207('0x16')])[_0xc207('0x8')](respondWithResult(_0x502dde,null))[_0xc207('0x17')](handleError(_0x502dde,null));};exports[_0xc207('0x2e')]=function(_0x4c3e29,_0x3a6f45){var _0x47cdc4;return respondWithRpcPromise('Agents',_0x4c3e29['query'])['then'](function(_0x20cb64){_0x47cdc4=_0x20cb64;return respondWithRpcPromise(_0xc207('0x2f'),_0x4c3e29[_0xc207('0x16')],routingClient);})['then'](function(_0x1dd71e){return _[_0xc207('0x1a')]({},_0x1dd71e,_0x47cdc4);})[_0xc207('0x8')](respondWithResult(_0x3a6f45,null))[_0xc207('0x17')](handleError(_0x3a6f45,null));};exports['agentCapacity']=function(_0x47d43a,_0x223349){if(_0x47d43a[_0xc207('0x23')]&&_0x47d43a[_0xc207('0x23')][_0xc207('0x30')]&&_0x47d43a['user']&&_0x47d43a[_0xc207('0x31')][_0xc207('0x10')]){for(var _0x3a935a in _0x47d43a[_0xc207('0x23')][_0xc207('0x30')]){if(_0x47d43a[_0xc207('0x23')][_0xc207('0x30')][_0xc207('0x32')](_0x3a935a)){db[_0xc207('0x33')]['findAll']({'where':{'channel':_0x3a935a,'membername':_0x47d43a[_0xc207('0x31')][_0xc207('0x10')],'type':'INTERACTION','exitAt':null,'uniqueid':_0x47d43a[_0xc207('0x23')][_0xc207('0x30')][_0x3a935a]&&_0x47d43a[_0xc207('0x23')][_0xc207('0x30')][_0x3a935a][_0xc207('0x34')]?{'$notIn':_0x47d43a['body'][_0xc207('0x30')][_0x3a935a]}:{'$ne':null}}})[_0xc207('0x8')](function(_0x17da25){var _0x5b50cf=moment()[_0xc207('0x35')](_0xc207('0x36'));for(var _0x2967ad=0x0,_0x45536e=_0x17da25['length'];_0x2967ad<_0x45536e;_0x2967ad+=0x1){_0x17da25[_0x2967ad]['updateAttributes']({'exitAt':_0x5b50cf});}});for(var _0x11ce5a=0x0;_0x11ce5a<_0x47d43a[_0xc207('0x23')][_0xc207('0x30')][_0x3a935a][_0xc207('0x34')];_0x11ce5a+=0x1){db[_0xc207('0x33')][_0xc207('0x37')]({'where':{'channel':_0x3a935a,'membername':_0x47d43a[_0xc207('0x31')][_0xc207('0x10')],'type':_0xc207('0x38'),'uniqueid':_0x47d43a[_0xc207('0x23')][_0xc207('0x30')][_0x3a935a][_0x11ce5a],'exitAt':null},'defaults':{'channel':_0x3a935a,'membername':_0x47d43a[_0xc207('0x31')]['name'],'interface':_['isNil'](_0x47d43a[_0xc207('0x31')][_0xc207('0x39')])?util[_0xc207('0x35')]('SIP/%s',_0x47d43a[_0xc207('0x31')][_0xc207('0x10')]):_0x47d43a[_0xc207('0x31')][_0xc207('0x39')],'type':'INTERACTION','enterAt':moment()[_0xc207('0x35')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0xc207('0x3a'),'internal':_0x47d43a['user']['internal'],'uniqueid':_0x47d43a[_0xc207('0x23')][_0xc207('0x30')][_0x3a935a][_0x11ce5a]}});}}}}return respondWithRpcPromise('AgentCapacity',{'id':_0x47d43a['params']['id'],'capacity':_0x47d43a['body'][_0xc207('0x3b')]},routingClient)[_0xc207('0x8')](respondWithResult(_0x223349,null))[_0xc207('0x17')](handleError(_0x223349,null));};exports[_0xc207('0x3c')]=function(_0x173acf,_0x35e967){return respondWithRpcPromise(_0xc207('0x3d'),_0x173acf[_0xc207('0x16')])['then'](respondWithResult(_0x35e967,null))[_0xc207('0x17')](handleError(_0x35e967,null));};exports[_0xc207('0x3e')]=function(_0x5aedd3,_0x55e0c5){return respondWithRpcPromise(_0xc207('0x3f'),_0x5aedd3['query'])['then'](respondWithResult(_0x55e0c5,null))[_0xc207('0x17')](handleError(_0x55e0c5,null));};exports[_0xc207('0x40')]=function(_0x356c8c,_0x3b2448){return respondWithRpcPromise(_0xc207('0x41'),_0x356c8c[_0xc207('0x16')])[_0xc207('0x8')](respondWithResult(_0x3b2448,null))[_0xc207('0x17')](handleError(_0x3b2448,null));};exports[_0xc207('0x42')]=function(_0x278717,_0x2fcfee){return respondWithRpcPromise('ChatQueues',_0x278717['query'],routingClient)[_0xc207('0x8')](respondWithResult(_0x2fcfee,null))[_0xc207('0x17')](handleError(_0x2fcfee,null));};exports[_0xc207('0x43')]=function(_0x313580,_0xaff7a0){return respondWithRpcPromise(_0xc207('0x44'),_0x313580[_0xc207('0x16')],routingClient)[_0xc207('0x8')](findById(_0x313580[_0xc207('0x1b')]['id']))['then'](respondWithResult(_0xaff7a0,null))[_0xc207('0x17')](handleError(_0xaff7a0,null));};exports[_0xc207('0x45')]=function(_0x19637d,_0x6d387e){return respondWithRpcPromise('MailQueues',_0x19637d[_0xc207('0x16')],routingClient)[_0xc207('0x8')](respondWithResult(_0x6d387e,null))[_0xc207('0x17')](handleError(_0x6d387e,null));};exports[_0xc207('0x46')]=function(_0x464263,_0x45ad58){return respondWithRpcPromise(_0xc207('0x47'),_0x464263['query'],routingClient)[_0xc207('0x8')](findById(_0x464263[_0xc207('0x1b')]['id']))[_0xc207('0x8')](respondWithResult(_0x45ad58,null))[_0xc207('0x17')](handleError(_0x45ad58,null));};exports['mailAccounts']=function(_0xc7812,_0x4f4b58){return respondWithRpcPromise('MailAccounts',_0xc7812[_0xc207('0x16')],mailClient)[_0xc207('0x8')](respondWithResult(_0x4f4b58,null))[_0xc207('0x17')](handleError(_0x4f4b58,null));};exports[_0xc207('0x48')]=function(_0x441d5f,_0x3b1b4c){return respondWithRpcPromise(_0xc207('0x49'),_0x441d5f[_0xc207('0x16')],routingClient)[_0xc207('0x8')](respondWithResult(_0x3b1b4c,null))[_0xc207('0x17')](handleError(_0x3b1b4c,null));};exports[_0xc207('0x4a')]=function(_0x2f97bf,_0x416e85){return respondWithRpcPromise(_0xc207('0x49'),_0x2f97bf[_0xc207('0x16')],routingClient)['then'](findById(_0x2f97bf[_0xc207('0x1b')]['id']))['then'](respondWithResult(_0x416e85,null))[_0xc207('0x17')](handleError(_0x416e85,null));};exports[_0xc207('0x4b')]=function(_0x2ade23,_0x52dec1){return respondWithRpcPromise('SmsQueues',_0x2ade23[_0xc207('0x16')],routingClient)[_0xc207('0x8')](respondWithResult(_0x52dec1,null))[_0xc207('0x17')](handleError(_0x52dec1,null));};exports['showSmsQueues']=function(_0x31182c,_0x1cefa3){return respondWithRpcPromise(_0xc207('0x4c'),_0x31182c['query'],routingClient)['then'](findById(_0x31182c[_0xc207('0x1b')]['id']))['then'](respondWithResult(_0x1cefa3,null))[_0xc207('0x17')](handleError(_0x1cefa3,null));};exports[_0xc207('0x4d')]=function(_0x3cca53,_0x4b197){return respondWithRpcPromise(_0xc207('0x4e'),_0x3cca53[_0xc207('0x16')],routingClient)[_0xc207('0x8')](respondWithResult(_0x4b197,null))[_0xc207('0x17')](handleError(_0x4b197,null));};exports['showWhatsappQueues']=function(_0x289f7c,_0x85ecad){return respondWithRpcPromise(_0xc207('0x4e'),_0x289f7c[_0xc207('0x16')],routingClient)[_0xc207('0x8')](findById(_0x289f7c[_0xc207('0x1b')]['id']))[_0xc207('0x8')](respondWithResult(_0x85ecad,null))[_0xc207('0x17')](handleError(_0x85ecad,null));};exports[_0xc207('0x4f')]=function(_0x28f467,_0x203686){return respondWithRpcPromise('FaxQueues',_0x28f467[_0xc207('0x16')],routingClient)[_0xc207('0x8')](respondWithResult(_0x203686,null))[_0xc207('0x17')](handleError(_0x203686,null));};exports[_0xc207('0x50')]=function(_0x584a40,_0x586c41){return respondWithRpcPromise(_0xc207('0x51'),_0x584a40[_0xc207('0x16')],routingClient)[_0xc207('0x8')](findById(_0x584a40[_0xc207('0x1b')]['id']))['then'](respondWithResult(_0x586c41,null))[_0xc207('0x17')](handleError(_0x586c41,null));};exports[_0xc207('0x52')]=function(_0x440fc2,_0x5a04d5){return respondWithRpcPromise(_0xc207('0x53'),_0x440fc2[_0xc207('0x16')])[_0xc207('0x8')](respondWithResult(_0x5a04d5,null))['catch'](handleError(_0x5a04d5,null));};exports[_0xc207('0x54')]=function(_0x488c1f,_0x1290e4){return respondWithRpcPromise('ChatQueuesWaitingInteractions',_0x488c1f[_0xc207('0x16')],routingClient)[_0xc207('0x8')](respondWithResult(_0x1290e4,null))['catch'](handleError(_0x1290e4,null));};exports[_0xc207('0x55')]=function(_0x4c0ef0,_0x446fe8){return respondWithRpcPromise(_0xc207('0x56'),_0x4c0ef0[_0xc207('0x16')],routingClient)[_0xc207('0x8')](respondWithResult(_0x446fe8,null))[_0xc207('0x17')](handleError(_0x446fe8,null));};exports['openchannelQueuesWaitingInteractions']=function(_0x4b9342,_0x3d1659){return respondWithRpcPromise(_0xc207('0x57'),_0x4b9342['query'],routingClient)[_0xc207('0x8')](respondWithResult(_0x3d1659,null))[_0xc207('0x17')](handleError(_0x3d1659,null));};exports['openchannelQueuesIdWaitingInteractions']=function(_0x10ab93,_0x13954e){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x10ab93[_0xc207('0x16')],routingClient)[_0xc207('0x8')](function(_0x3748de){if(_0x10ab93[_0xc207('0x16')][_0xc207('0x58')]!==undefined){var _0xef037c=_(_0x3748de['rows'])['filter']([_0x10ab93[_0xc207('0x16')][_0xc207('0x58')],_0x10ab93[_0xc207('0x1b')]['id']])[_0xc207('0x59')](_0xc207('0x5a'))['uniq']()[_0xc207('0x5b')]();return _0x3748de['rows'][_0xc207('0x5c')](function(_0x97f43){return _0xef037c[_0xc207('0x5d')](_0x97f43[_0xc207('0x5a')])>-0x1;});}else{return _0x3748de[_0xc207('0x12')][_0xc207('0x5c')](function(_0x49ebe1){return _0x49ebe1[_0xc207('0x5a')]===parseInt(_0x10ab93[_0xc207('0x1b')]['id']);});}})['then'](respondWithResult(_0x13954e,null))[_0xc207('0x17')](handleError(_0x13954e,null));};exports[_0xc207('0x5e')]=function(_0x36e8b1,_0x3cb12d){return respondWithRpcPromise(_0xc207('0x5f'),_0x36e8b1[_0xc207('0x16')],routingClient)[_0xc207('0x8')](respondWithResult(_0x3cb12d,null))[_0xc207('0x17')](handleError(_0x3cb12d,null));};exports[_0xc207('0x60')]=function(_0x281c71,_0x473560){return respondWithRpcPromise(_0xc207('0x61'),_0x281c71[_0xc207('0x16')],routingClient)['then'](respondWithResult(_0x473560,null))[_0xc207('0x17')](handleError(_0x473560,null));};exports[_0xc207('0x62')]=function(_0x2f4efd,_0x266e65){return respondWithRpcPromise('FaxQueuesWaitingInteractions',_0x2f4efd[_0xc207('0x16')],routingClient)['then'](respondWithResult(_0x266e65,null))[_0xc207('0x17')](handleError(_0x266e65,null));};exports['queueNotify']=function(_0x53cb21){return function(_0x2967e6,_0x220293){var _0x383f83,_0x3adfeb;var _0x20089a=_[_0xc207('0x63')](_0x53cb21);var _0x51b775=_0x53cb21===_0xc207('0x64')?'Website':_0xc207('0x65');return db[_0x20089a+_0xc207('0x66')][_0xc207('0x67')]({'raw':!![],'where':{'id':_0x2967e6[_0xc207('0x1b')]['id']}})['then'](function(_0x25731c){if(_[_0xc207('0x11')](_0x25731c)){throw new Error(_0x20089a+'\x20Queue\x20not\x20found');}_0x383f83=_0x25731c;return db[_0x20089a+_0xc207('0x68')][_0xc207('0x67')]({'where':{'id':_0x2967e6[_0xc207('0x23')][_0xc207('0x69')]},'include':[{'model':db[_0x20089a+'Interaction'],'as':_0xc207('0x6a')},{'model':db[_0x20089a+_0x51b775],'as':_0xc207('0x65')}]});})[_0xc207('0x8')](function(_0x297ee0){if(_['isNil'](_0x297ee0)){throw new Error(_0x20089a+'\x20Message\x20not\x20found');}_0x3adfeb=_0x297ee0;return _0x297ee0['update']({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x273b30={'uniqueid':_0x53cb21+'.'+_0x3adfeb['id']+'.'+_0x3adfeb[_0xc207('0x6a')]['id'],'FromUserId':_0x2967e6[_0xc207('0x31')]['id'],'type':_0xc207('0x6b')};_0x273b30[_0x20089a+'MessageId']=_0x3adfeb['id'];_0x273b30[_0x20089a+'InteractionId']=_0x3adfeb[_0xc207('0x6a')]['id'];_0x273b30['From'+_0x20089a+_0x51b775+'Id']=_0x3adfeb['Account']['id'];_0x273b30['To'+_0x20089a+_0xc207('0x6c')]=_0x383f83['id'];return db[_0x20089a+_0xc207('0x6d')][_0xc207('0x6e')](_0x273b30);})[_0xc207('0x8')](function(){return respondWithRpcPromise(_0xc207('0x6f'),{'channel':_0x53cb21,'interaction':_0x3adfeb['Interaction'],'message':_0x3adfeb,'account':_0x3adfeb[_0xc207('0x65')],'applications':[{'id':0x0,'priority':0x1,'app':'queue','appdata':_0x383f83[_0xc207('0x10')]+','+(_0x3adfeb[_0xc207('0x65')][_0xc207('0x70')]||0x12c),'interval':'*,*,*,*'}]},routingClient);})['then'](respondWithResult(_0x220293,null))[_0xc207('0x17')](handleError(_0x220293,null));};};exports[_0xc207('0x71')]=function(_0x1841a4,_0x7d4f9c){var _0x4e5b1c,_0x4d05e5;if(_[_0xc207('0x11')](_0x1841a4['body'][_0xc207('0x72')])){throw new Error(_0xc207('0x73'));}var _0x211884=_0x1841a4[_0xc207('0x23')][_0xc207('0x72')];var _0x5a7bc9=_[_0xc207('0x63')](_0x211884);var _0x328016=_0x211884===_0xc207('0x64')?_0xc207('0x74'):_0xc207('0x65');return db[_0xc207('0x75')][_0xc207('0x67')]({'raw':!![],'where':{'id':_0x1841a4[_0xc207('0x1b')]['id'],'role':_0xc207('0x3a')}})[_0xc207('0x8')](function(_0x48213b){if(_[_0xc207('0x11')](_0x48213b)){throw new Error('Agent\x20not\x20found');}_0x4e5b1c=_0x48213b;return db[_0x5a7bc9+'Message'][_0xc207('0x67')]({'where':{'id':_0x1841a4[_0xc207('0x23')]['messageId']},'include':[{'model':db[_0x5a7bc9+'Interaction'],'as':_0xc207('0x6a')},{'model':db[_0x5a7bc9+_0x328016],'as':_0xc207('0x65')}]});})[_0xc207('0x8')](function(_0x41b655){if(_['isNil'](_0x41b655)){throw new Error(_0x5a7bc9+_0xc207('0x76'));}_0x4d05e5=_0x41b655;return _0x41b655['update']({'read':0x0,'readAt':null,'UserId':null});})[_0xc207('0x8')](function(){var _0x1c7886={'uniqueid':_0x211884+'.'+_0x4d05e5['id']+'.'+_0x4d05e5[_0xc207('0x6a')]['id'],'FromUserId':_0x1841a4[_0xc207('0x31')]['id'],'type':_0xc207('0x6b'),'ToUserId':_0x4e5b1c['id']};_0x1c7886[_0x5a7bc9+_0xc207('0x77')]=_0x4d05e5['id'];_0x1c7886[_0x5a7bc9+'InteractionId']=_0x4d05e5[_0xc207('0x6a')]['id'];_0x1c7886[_0xc207('0x78')+_0x5a7bc9+_0x328016+'Id']=_0x4d05e5['Account']['id'];return db[_0x5a7bc9+'TransferReport']['create'](_0x1c7886);})['then'](function(){return respondWithRpcPromise('Start',{'channel':_0x211884,'interaction':_0x4d05e5[_0xc207('0x6a')],'message':_0x4d05e5,'account':_0x4d05e5[_0xc207('0x65')],'applications':[{'id':0x0,'priority':0x1,'app':_0xc207('0x3a'),'appdata':_0x4e5b1c['name']+','+(_0x4d05e5[_0xc207('0x65')]['agentTransferTimeout']||0x12c),'interval':_0xc207('0x79')}]},routingClient);})[_0xc207('0x8')](respondWithResult(_0x7d4f9c,null))[_0xc207('0x17')](handleError(_0x7d4f9c,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index 2f65b5f..381d44a 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 _0x32d8=['connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./schedule.controller','isAuthenticated','index','/:id','show','get','/:id/run','run','post','create','update','delete','exports','util'];(function(_0x54380a,_0x2ac9f2){var _0x4513ad=function(_0x378392){while(--_0x378392){_0x54380a['push'](_0x54380a['shift']());}};_0x4513ad(++_0x2ac9f2);}(_0x32d8,0x1b4));var _0x832d=function(_0x4f13f8,_0x5e13c5){_0x4f13f8=_0x4f13f8-0x0;var _0x1e6b83=_0x32d8[_0x4f13f8];return _0x1e6b83;};'use strict';var multer=require('multer');var util=require(_0x832d('0x0'));var path=require('path');var timeout=require(_0x832d('0x1'));var express=require('express');var router=express[_0x832d('0x2')]();var fs_extra=require(_0x832d('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x832d('0x4'));var config=require(_0x832d('0x5'));var controller=require(_0x832d('0x6'));router['get']('/',auth[_0x832d('0x7')](),controller[_0x832d('0x8')]);router['get'](_0x832d('0x9'),auth[_0x832d('0x7')](),controller[_0x832d('0xa')]);router[_0x832d('0xb')](_0x832d('0xc'),auth['isAuthenticated'](),controller[_0x832d('0xd')]);router[_0x832d('0xe')]('/',auth[_0x832d('0x7')](),controller[_0x832d('0xf')]);router['put'](_0x832d('0x9'),auth[_0x832d('0x7')](),controller[_0x832d('0x10')]);router[_0x832d('0x11')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x832d('0x12')]=router; \ No newline at end of file +var _0xa062=['/:id/run','isAuthenticated','run','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./schedule.controller','get','index','/:id'];(function(_0x33cdae,_0x5cd3ac){var _0x27b2ba=function(_0x242eb6){while(--_0x242eb6){_0x33cdae['push'](_0x33cdae['shift']());}};_0x27b2ba(++_0x5cd3ac);}(_0xa062,0x104));var _0x2a06=function(_0x2a7c94,_0x1e5863){_0x2a7c94=_0x2a7c94-0x0;var _0x11bc42=_0xa062[_0x2a7c94];return _0x11bc42;};'use strict';var multer=require(_0x2a06('0x0'));var util=require(_0x2a06('0x1'));var path=require(_0x2a06('0x2'));var timeout=require('connect-timeout');var express=require(_0x2a06('0x3'));var router=express[_0x2a06('0x4')]();var fs_extra=require(_0x2a06('0x5'));var auth=require(_0x2a06('0x6'));var interaction=require(_0x2a06('0x7'));var config=require(_0x2a06('0x8'));var controller=require(_0x2a06('0x9'));router[_0x2a06('0xa')]('/',auth['isAuthenticated'](),controller[_0x2a06('0xb')]);router[_0x2a06('0xa')](_0x2a06('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x2a06('0xa')](_0x2a06('0xd'),auth[_0x2a06('0xe')](),controller[_0x2a06('0xf')]);router['post']('/',auth[_0x2a06('0xe')](),controller['create']);router[_0x2a06('0x10')](_0x2a06('0xc'),auth['isAuthenticated'](),controller[_0x2a06('0x11')]);router[_0x2a06('0x12')](_0x2a06('0xc'),auth[_0x2a06('0xe')](),controller[_0x2a06('0x13')]);module[_0x2a06('0x14')]=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index 917610d..b33da6c 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 _0x21d7=['exports','STRING','BOOLEAN','DATE','INTEGER','ENUM','years','months','weeks','hours','minutes','days','csv','pdf','xlsx','custom','default','TEXT','sequelize'];(function(_0x1b65a2,_0x550ee7){var _0x1f51df=function(_0x307f60){while(--_0x307f60){_0x1b65a2['push'](_0x1b65a2['shift']());}};_0x1f51df(++_0x550ee7);}(_0x21d7,0x1ed));var _0x721d=function(_0x169d5d,_0x46dc5a){_0x169d5d=_0x169d5d-0x0;var _0x25d6a6=_0x21d7[_0x169d5d];return _0x25d6a6;};'use strict';var Sequelize=require(_0x721d('0x0'));module[_0x721d('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x721d('0x2')]},'active':{'type':Sequelize[_0x721d('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'0\x200\x20*\x20*\x20*'},'startAt':{'type':Sequelize[_0x721d('0x4')],'allowNull':![]},'endAt':{'type':Sequelize[_0x721d('0x4')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x721d('0x5')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x721d('0x6')](_0x721d('0x7'),'quarters',_0x721d('0x8'),_0x721d('0x9'),'days',_0x721d('0xa'),_0x721d('0xb')),'allowNull':![],'defaultValue':_0x721d('0xc')},'output':{'type':Sequelize[_0x721d('0x6')](_0x721d('0xd'),_0x721d('0xe'),_0x721d('0xf')),'allowNull':![],'defaultValue':_0x721d('0xd')},'type':{'type':Sequelize[_0x721d('0x6')](_0x721d('0x10'),_0x721d('0x11')),'allowNull':![],'defaultValue':_0x721d('0x10')},'sendMail':{'type':Sequelize[_0x721d('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0x721d('0x2')]},'cc':{'type':Sequelize[_0x721d('0x12')]},'bcc':{'type':Sequelize[_0x721d('0x12')]},'sendIfEmpty':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0xc665=['months','weeks','days','hours','ENUM','pdf','csv','custom','default','BOOLEAN','TEXT','sequelize','exports','STRING','0\x200\x20*\x20*\x20*','DATE','INTEGER','quarters'];(function(_0x2cd5e0,_0x86c910){var _0x40cbad=function(_0x27068e){while(--_0x27068e){_0x2cd5e0['push'](_0x2cd5e0['shift']());}};_0x40cbad(++_0x86c910);}(_0xc665,0x1cd));var _0x5c66=function(_0x2fd2f0,_0x4f3477){_0x2fd2f0=_0x2fd2f0-0x0;var _0x4ef805=_0xc665[_0x2fd2f0];return _0x4ef805;};'use strict';var Sequelize=require(_0x5c66('0x0'));module[_0x5c66('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x5c66('0x2')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x5c66('0x3')},'startAt':{'type':Sequelize[_0x5c66('0x4')],'allowNull':![]},'endAt':{'type':Sequelize['DATE'],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x5c66('0x5')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize['ENUM']('years',_0x5c66('0x6'),_0x5c66('0x7'),_0x5c66('0x8'),_0x5c66('0x9'),_0x5c66('0xa'),'minutes'),'allowNull':![],'defaultValue':'days'},'output':{'type':Sequelize[_0x5c66('0xb')]('csv',_0x5c66('0xc'),'xlsx'),'allowNull':![],'defaultValue':_0x5c66('0xd')},'type':{'type':Sequelize['ENUM'](_0x5c66('0xe'),_0x5c66('0xf')),'allowNull':![],'defaultValue':_0x5c66('0xe')},'sendMail':{'type':Sequelize[_0x5c66('0x10')],'defaultValue':![]},'email':{'type':Sequelize[_0x5c66('0x2')]},'cc':{'type':Sequelize['TEXT']},'bcc':{'type':Sequelize[_0x5c66('0x11')]},'sendIfEmpty':{'type':Sequelize[_0x5c66('0x10')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index f1e2ad1..a1778b1 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 _0xcac7=['fields','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','Schedule','rows','catch','params','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Scheduler','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','../../config/schedule','run','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','reject','save','update','then','destroy','get','UserProfileResource','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection'];(function(_0x4af356,_0x298d74){var _0x40566=function(_0x3cd2b2){while(--_0x3cd2b2){_0x4af356['push'](_0x4af356['shift']());}};_0x40566(++_0x298d74);}(_0xcac7,0x162));var _0x7cac=function(_0x4d43c0,_0x2c2a77){_0x4d43c0=_0x4d43c0-0x0;var _0x377979=_0xcac7[_0x4d43c0];return _0x377979;};'use strict';var emlformat=require(_0x7cac('0x0'));var rimraf=require(_0x7cac('0x1'));var zipdir=require(_0x7cac('0x2'));var jsonpatch=require(_0x7cac('0x3'));var rp=require(_0x7cac('0x4'));var moment=require(_0x7cac('0x5'));var BPromise=require(_0x7cac('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x7cac('0x7'));var sox=require(_0x7cac('0x8'));var csv=require(_0x7cac('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7cac('0xa'));var _=require('lodash');var squel=require(_0x7cac('0xb'));var crypto=require(_0x7cac('0xc'));var jsforce=require(_0x7cac('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x7cac('0xe'));var Papa=require(_0x7cac('0xf'));var Redis=require(_0x7cac('0x10'));var authService=require(_0x7cac('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x7cac('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7cac('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x7cac('0x14'));var licenseUtil=require(_0x7cac('0x15'));var db=require(_0x7cac('0x16'))['db'];function respondWithStatusCode(_0x1c49a4,_0x55dbe4){_0x55dbe4=_0x55dbe4||0xcc;return function(_0x24c9e9){if(_0x24c9e9){return _0x1c49a4[_0x7cac('0x17')](_0x55dbe4);}return _0x1c49a4[_0x7cac('0x18')](_0x55dbe4)['end']();};}function respondWithResult(_0x1a454c,_0x3cd5bd){_0x3cd5bd=_0x3cd5bd||0xc8;return function(_0x479b77){if(_0x479b77){return _0x1a454c['status'](_0x3cd5bd)[_0x7cac('0x19')](_0x479b77);}};}function respondWithFilteredResult(_0x3a62b2,_0x2b4d42){return function(_0x1e43e9){if(_0x1e43e9){var _0x5a32b4=typeof _0x2b4d42[_0x7cac('0x1a')]===_0x7cac('0x1b')&&typeof _0x2b4d42[_0x7cac('0x1c')]==='undefined';var _0x5a0f25=_0x1e43e9[_0x7cac('0x1d')];var _0x383ce1=_0x5a32b4?0x0:_0x2b4d42['offset'];var _0x3cc55b=_0x5a32b4?_0x1e43e9[_0x7cac('0x1d')]:_0x2b4d42[_0x7cac('0x1a')]+_0x2b4d42['limit'];var _0x51cbbe;if(_0x3cc55b>=_0x5a0f25){_0x3cc55b=_0x5a0f25;_0x51cbbe=0xc8;}else{_0x51cbbe=0xce;}_0x3a62b2[_0x7cac('0x18')](_0x51cbbe);return _0x3a62b2[_0x7cac('0x1e')]('Content-Range',_0x383ce1+'-'+_0x3cc55b+'/'+_0x5a0f25)[_0x7cac('0x19')](_0x1e43e9);}return null;};}function patchUpdates(_0x4721aa){return function(_0x25c1e9){try{jsonpatch['apply'](_0x25c1e9,_0x4721aa,!![]);}catch(_0x30c92c){return BPromise[_0x7cac('0x1f')](_0x30c92c);}return _0x25c1e9[_0x7cac('0x20')]();};}function saveUpdates(_0x4eae8a,_0xcd564f){return function(_0x4f3d7b){if(_0x4f3d7b){return _0x4f3d7b[_0x7cac('0x21')](_0x4eae8a)[_0x7cac('0x22')](function(_0x22a3a3){return _0x22a3a3;});}return null;};}function removeEntity(_0x5bbc8b,_0x290714){return function(_0x2c9a9d){if(_0x2c9a9d){return _0x2c9a9d[_0x7cac('0x23')]()[_0x7cac('0x22')](function(){var _0x112ed9=_0x2c9a9d[_0x7cac('0x24')]({'plain':!![]});var _0x300f2d='Scheduler';return db[_0x7cac('0x25')][_0x7cac('0x23')]({'where':{'type':_0x300f2d,'resourceId':_0x112ed9['id']}})[_0x7cac('0x22')](function(){return _0x2c9a9d;});})[_0x7cac('0x22')](function(){_0x5bbc8b[_0x7cac('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x34578d,_0x230a8b){return function(_0x50c4bc){if(!_0x50c4bc){_0x34578d[_0x7cac('0x17')](0x194);}return _0x50c4bc;};}function handleError(_0x227a5e,_0x107f9e){_0x107f9e=_0x107f9e||0x1f4;return function(_0x101543){logger['error'](_0x101543[_0x7cac('0x26')]);if(_0x101543[_0x7cac('0x27')]){delete _0x101543[_0x7cac('0x27')];}_0x227a5e[_0x7cac('0x18')](_0x107f9e)[_0x7cac('0x28')](_0x101543);};}exports['index']=function(_0xf466ac,_0x2ac1f8){var _0x4b72dd={},_0x101147={},_0x7aebd9={'count':0x0,'rows':[]};var _0x71c878=_[_0x7cac('0x29')](db['Schedule'][_0x7cac('0x2a')],function(_0x3a4fac){return{'name':_0x3a4fac[_0x7cac('0x2b')],'type':_0x3a4fac[_0x7cac('0x2c')][_0x7cac('0x2d')]};});_0x101147[_0x7cac('0x2e')]=_[_0x7cac('0x29')](_0x71c878,_0x7cac('0x27'));_0x101147[_0x7cac('0x2f')]=_['keys'](_0xf466ac['query']);_0x101147[_0x7cac('0x30')]=_['intersection'](_0x101147['model'],_0x101147[_0x7cac('0x2f')]);_0x4b72dd[_0x7cac('0x31')]=_[_0x7cac('0x32')](_0x101147['model'],qs[_0x7cac('0x33')](_0xf466ac[_0x7cac('0x2f')][_0x7cac('0x33')]));_0x4b72dd[_0x7cac('0x31')]=_0x4b72dd[_0x7cac('0x31')][_0x7cac('0x34')]?_0x4b72dd[_0x7cac('0x31')]:_0x101147[_0x7cac('0x2e')];if(!_0xf466ac[_0x7cac('0x2f')][_0x7cac('0x35')]('nolimit')){_0x4b72dd[_0x7cac('0x1c')]=qs[_0x7cac('0x1c')](_0xf466ac[_0x7cac('0x2f')][_0x7cac('0x1c')]);_0x4b72dd[_0x7cac('0x1a')]=qs[_0x7cac('0x1a')](_0xf466ac['query'][_0x7cac('0x1a')]);}_0x4b72dd['order']=qs[_0x7cac('0x36')](_0xf466ac['query'][_0x7cac('0x36')]);_0x4b72dd[_0x7cac('0x37')]=qs[_0x7cac('0x30')](_[_0x7cac('0x38')](_0xf466ac['query'],_0x101147[_0x7cac('0x30')]),_0x71c878);if(_0xf466ac['query'][_0x7cac('0x39')]){_0x4b72dd[_0x7cac('0x37')]=_[_0x7cac('0x3a')](_0x4b72dd[_0x7cac('0x37')],{'$or':_[_0x7cac('0x29')](_0x71c878,function(_0xcb1d84){if(_0xcb1d84['type']!==_0x7cac('0x3b')){var _0x36fb70={};_0x36fb70[_0xcb1d84['name']]={'$like':'%'+_0xf466ac[_0x7cac('0x2f')]['filter']+'%'};return _0x36fb70;}})});}_0x4b72dd=_['merge']({},_0x4b72dd,_0xf466ac[_0x7cac('0x3c')]);var _0x236be8={'where':_0x4b72dd[_0x7cac('0x37')]};return db['Schedule'][_0x7cac('0x1d')](_0x236be8)['then'](function(_0x2db572){_0x7aebd9[_0x7cac('0x1d')]=_0x2db572;if(_0xf466ac['query'][_0x7cac('0x3d')]){_0x4b72dd[_0x7cac('0x3e')]=[{'all':!![]}];}return db[_0x7cac('0x3f')]['findAll'](_0x4b72dd);})[_0x7cac('0x22')](function(_0x92b5d0){_0x7aebd9[_0x7cac('0x40')]=_0x92b5d0;return _0x7aebd9;})[_0x7cac('0x22')](respondWithFilteredResult(_0x2ac1f8,_0x4b72dd))[_0x7cac('0x41')](handleError(_0x2ac1f8,null));};exports['show']=function(_0x61171b,_0xcaf154){var _0x50e93a={'raw':![],'where':{'id':_0x61171b[_0x7cac('0x42')]['id']}},_0x31485e={};_0x31485e[_0x7cac('0x2e')]=_[_0x7cac('0x43')](db[_0x7cac('0x3f')][_0x7cac('0x2a')]);_0x31485e[_0x7cac('0x2f')]=_[_0x7cac('0x43')](_0x61171b[_0x7cac('0x2f')]);_0x31485e['filters']=_[_0x7cac('0x32')](_0x31485e[_0x7cac('0x2e')],_0x31485e[_0x7cac('0x2f')]);_0x50e93a[_0x7cac('0x31')]=_[_0x7cac('0x32')](_0x31485e['model'],qs[_0x7cac('0x33')](_0x61171b[_0x7cac('0x2f')][_0x7cac('0x33')]));_0x50e93a[_0x7cac('0x31')]=_0x50e93a['attributes']['length']?_0x50e93a[_0x7cac('0x31')]:_0x31485e[_0x7cac('0x2e')];if(_0x61171b[_0x7cac('0x2f')][_0x7cac('0x3d')]){_0x50e93a[_0x7cac('0x3e')]=[{'all':!![]}];}_0x50e93a=_[_0x7cac('0x3a')]({},_0x50e93a,_0x61171b[_0x7cac('0x3c')]);return db[_0x7cac('0x3f')][_0x7cac('0x44')](_0x50e93a)['then'](handleEntityNotFound(_0xcaf154,null))[_0x7cac('0x22')](respondWithResult(_0xcaf154,null))['catch'](handleError(_0xcaf154,null));};exports['create']=function(_0x3e569d,_0x163981){return db[_0x7cac('0x3f')][_0x7cac('0x45')](_0x3e569d[_0x7cac('0x46')],{})['then'](function(_0x279870){var _0x339294=_0x3e569d[_0x7cac('0x47')][_0x7cac('0x24')]({'plain':!![]});if(!_0x339294)throw new Error(_0x7cac('0x48'));if(_0x339294[_0x7cac('0x49')]===_0x7cac('0x47')){var _0xa5c3d1=_0x279870['get']({'plain':!![]});var _0x5f3d46=_0x7cac('0x4a');return db[_0x7cac('0x4b')][_0x7cac('0x44')]({'where':{'name':_0x5f3d46,'userProfileId':_0x339294['userProfileId']},'raw':!![]})['then'](function(_0x5ab118){if(_0x5ab118&&_0x5ab118[_0x7cac('0x4c')]===0x0){return db[_0x7cac('0x25')][_0x7cac('0x45')]({'name':_0xa5c3d1[_0x7cac('0x27')],'resourceId':_0xa5c3d1['id'],'type':_0x5ab118['name'],'sectionId':_0x5ab118['id']},{})['then'](function(){return _0x279870;});}else{return _0x279870;}})[_0x7cac('0x41')](function(_0x1130b4){logger[_0x7cac('0x4d')](_0x7cac('0x4e'),_0x1130b4);throw _0x1130b4;});}return _0x279870;})['then'](respondWithResult(_0x163981,0xc9))[_0x7cac('0x41')](handleError(_0x163981,null));};exports[_0x7cac('0x21')]=function(_0x4e53da,_0x5ea17d){if(_0x4e53da['body']['id']){delete _0x4e53da[_0x7cac('0x46')]['id'];}return db[_0x7cac('0x3f')]['find']({'where':{'id':_0x4e53da[_0x7cac('0x42')]['id']}})[_0x7cac('0x22')](handleEntityNotFound(_0x5ea17d,null))[_0x7cac('0x22')](saveUpdates(_0x4e53da[_0x7cac('0x46')],null))[_0x7cac('0x22')](respondWithResult(_0x5ea17d,null))[_0x7cac('0x41')](handleError(_0x5ea17d,null));};exports[_0x7cac('0x23')]=function(_0x159dd,_0x1239da){return db[_0x7cac('0x3f')][_0x7cac('0x44')]({'where':{'id':_0x159dd[_0x7cac('0x42')]['id']}})[_0x7cac('0x22')](handleEntityNotFound(_0x1239da,null))[_0x7cac('0x22')](removeEntity(_0x1239da,null))['catch'](handleError(_0x1239da,null));};exports['run']=function(_0x170dd3,_0x567806,_0x5dacd0){var _0x167b7b=require(_0x7cac('0x4f'));return db['Schedule']['find']({'where':{'id':_0x170dd3[_0x7cac('0x42')]['id']},'raw':!![]})[_0x7cac('0x22')](handleEntityNotFound(_0x567806,null))['then'](function(){_0x167b7b[_0x7cac('0x50')](_0x170dd3[_0x7cac('0x42')]['id']);})[_0x7cac('0x22')](respondWithStatusCode(_0x567806,null))[_0x7cac('0x41')](handleError(_0x567806,null));}; \ No newline at end of file +var _0x2193=['end','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','destroy','get','Scheduler','UserProfileResource','error','send','index','map','Schedule','fieldName','type','key','model','keys','filters','intersection','attributes','fields','query','hasOwnProperty','sort','where','merge','name','filter','options','includeAll','rows','catch','show','params','rawAttributes','length','include','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','body','run','../../config/schedule','eml-format','zip-dir','fast-json-patch','mustache','util','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status'];(function(_0x39888d,_0x28cd0e){var _0x11dea4=function(_0x27f9b5){while(--_0x27f9b5){_0x39888d['push'](_0x39888d['shift']());}};_0x11dea4(++_0x28cd0e);}(_0x2193,0x85));var _0x3219=function(_0x193e5a,_0x29420c){_0x193e5a=_0x193e5a-0x0;var _0x48909a=_0x2193[_0x193e5a];return _0x48909a;};'use strict';var emlformat=require(_0x3219('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3219('0x1'));var jsonpatch=require(_0x3219('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x3219('0x3'));var util=require(_0x3219('0x4'));var path=require('path');var sox=require(_0x3219('0x5'));var csv=require('to-csv');var ejs=require(_0x3219('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x3219('0x7'));var crypto=require(_0x3219('0x8'));var jsforce=require(_0x3219('0x9'));var deskjs=require(_0x3219('0xa'));var toCsv=require(_0x3219('0xb'));var querystring=require(_0x3219('0xc'));var Papa=require(_0x3219('0xd'));var Redis=require(_0x3219('0xe'));var authService=require(_0x3219('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3219('0x10'));var logger=require(_0x3219('0x11'))(_0x3219('0x12'));var utils=require(_0x3219('0x13'));var config=require(_0x3219('0x14'));var licenseUtil=require(_0x3219('0x15'));var db=require(_0x3219('0x16'))['db'];function respondWithStatusCode(_0xfd3c66,_0x457850){_0x457850=_0x457850||0xcc;return function(_0xdedec1){if(_0xdedec1){return _0xfd3c66[_0x3219('0x17')](_0x457850);}return _0xfd3c66[_0x3219('0x18')](_0x457850)[_0x3219('0x19')]();};}function respondWithResult(_0x2910b2,_0x2b6d9c){_0x2b6d9c=_0x2b6d9c||0xc8;return function(_0xb4c6a6){if(_0xb4c6a6){return _0x2910b2[_0x3219('0x18')](_0x2b6d9c)[_0x3219('0x1a')](_0xb4c6a6);}};}function respondWithFilteredResult(_0x68d17,_0x12ad77){return function(_0x3cf351){if(_0x3cf351){var _0x2dc51d=typeof _0x12ad77[_0x3219('0x1b')]===_0x3219('0x1c')&&typeof _0x12ad77[_0x3219('0x1d')]===_0x3219('0x1c');var _0x159350=_0x3cf351[_0x3219('0x1e')];var _0x183d71=_0x2dc51d?0x0:_0x12ad77[_0x3219('0x1b')];var _0x28df8e=_0x2dc51d?_0x3cf351[_0x3219('0x1e')]:_0x12ad77[_0x3219('0x1b')]+_0x12ad77[_0x3219('0x1d')];var _0x275438;if(_0x28df8e>=_0x159350){_0x28df8e=_0x159350;_0x275438=0xc8;}else{_0x275438=0xce;}_0x68d17[_0x3219('0x18')](_0x275438);return _0x68d17[_0x3219('0x1f')](_0x3219('0x20'),_0x183d71+'-'+_0x28df8e+'/'+_0x159350)['json'](_0x3cf351);}return null;};}function patchUpdates(_0x50ab4d){return function(_0x3dbe75){try{jsonpatch['apply'](_0x3dbe75,_0x50ab4d,!![]);}catch(_0x5668f0){return BPromise[_0x3219('0x21')](_0x5668f0);}return _0x3dbe75['save']();};}function saveUpdates(_0x2a9c5b,_0x51baaf){return function(_0x4ec065){if(_0x4ec065){return _0x4ec065[_0x3219('0x22')](_0x2a9c5b)[_0x3219('0x23')](function(_0x14486c){return _0x14486c;});}return null;};}function removeEntity(_0x31dca0,_0x2b3c7e){return function(_0x11595c){if(_0x11595c){return _0x11595c[_0x3219('0x24')]()[_0x3219('0x23')](function(){var _0x4fabe8=_0x11595c[_0x3219('0x25')]({'plain':!![]});var _0x78f44a=_0x3219('0x26');return db[_0x3219('0x27')][_0x3219('0x24')]({'where':{'type':_0x78f44a,'resourceId':_0x4fabe8['id']}})['then'](function(){return _0x11595c;});})['then'](function(){_0x31dca0['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3e5794,_0x260d71){return function(_0x557cf7){if(!_0x557cf7){_0x3e5794[_0x3219('0x17')](0x194);}return _0x557cf7;};}function handleError(_0x59ca1c,_0x192d77){_0x192d77=_0x192d77||0x1f4;return function(_0x4edf30){logger[_0x3219('0x28')](_0x4edf30['stack']);if(_0x4edf30['name']){delete _0x4edf30['name'];}_0x59ca1c['status'](_0x192d77)[_0x3219('0x29')](_0x4edf30);};}exports[_0x3219('0x2a')]=function(_0x42dafe,_0x225f60){var _0x6cef8a={},_0x2ca381={},_0x544630={'count':0x0,'rows':[]};var _0x485bea=_[_0x3219('0x2b')](db[_0x3219('0x2c')]['rawAttributes'],function(_0xf8350a){return{'name':_0xf8350a[_0x3219('0x2d')],'type':_0xf8350a[_0x3219('0x2e')][_0x3219('0x2f')]};});_0x2ca381[_0x3219('0x30')]=_[_0x3219('0x2b')](_0x485bea,'name');_0x2ca381['query']=_[_0x3219('0x31')](_0x42dafe['query']);_0x2ca381[_0x3219('0x32')]=_[_0x3219('0x33')](_0x2ca381[_0x3219('0x30')],_0x2ca381['query']);_0x6cef8a[_0x3219('0x34')]=_[_0x3219('0x33')](_0x2ca381[_0x3219('0x30')],qs[_0x3219('0x35')](_0x42dafe[_0x3219('0x36')][_0x3219('0x35')]));_0x6cef8a[_0x3219('0x34')]=_0x6cef8a[_0x3219('0x34')]['length']?_0x6cef8a['attributes']:_0x2ca381['model'];if(!_0x42dafe['query'][_0x3219('0x37')]('nolimit')){_0x6cef8a[_0x3219('0x1d')]=qs[_0x3219('0x1d')](_0x42dafe[_0x3219('0x36')][_0x3219('0x1d')]);_0x6cef8a[_0x3219('0x1b')]=qs[_0x3219('0x1b')](_0x42dafe['query'][_0x3219('0x1b')]);}_0x6cef8a['order']=qs[_0x3219('0x38')](_0x42dafe['query']['sort']);_0x6cef8a[_0x3219('0x39')]=qs[_0x3219('0x32')](_['pick'](_0x42dafe[_0x3219('0x36')],_0x2ca381[_0x3219('0x32')]),_0x485bea);if(_0x42dafe['query']['filter']){_0x6cef8a[_0x3219('0x39')]=_[_0x3219('0x3a')](_0x6cef8a[_0x3219('0x39')],{'$or':_[_0x3219('0x2b')](_0x485bea,function(_0x28f37c){if(_0x28f37c['type']!=='VIRTUAL'){var _0x25fa19={};_0x25fa19[_0x28f37c[_0x3219('0x3b')]]={'$like':'%'+_0x42dafe['query'][_0x3219('0x3c')]+'%'};return _0x25fa19;}})});}_0x6cef8a=_[_0x3219('0x3a')]({},_0x6cef8a,_0x42dafe[_0x3219('0x3d')]);var _0x58da26={'where':_0x6cef8a[_0x3219('0x39')]};return db[_0x3219('0x2c')]['count'](_0x58da26)[_0x3219('0x23')](function(_0x1b888e){_0x544630['count']=_0x1b888e;if(_0x42dafe[_0x3219('0x36')][_0x3219('0x3e')]){_0x6cef8a['include']=[{'all':!![]}];}return db[_0x3219('0x2c')]['findAll'](_0x6cef8a);})[_0x3219('0x23')](function(_0x5f0a62){_0x544630[_0x3219('0x3f')]=_0x5f0a62;return _0x544630;})[_0x3219('0x23')](respondWithFilteredResult(_0x225f60,_0x6cef8a))[_0x3219('0x40')](handleError(_0x225f60,null));};exports[_0x3219('0x41')]=function(_0x4858ac,_0xe1f75b){var _0x5a6b7c={'raw':![],'where':{'id':_0x4858ac[_0x3219('0x42')]['id']}},_0x315631={};_0x315631['model']=_[_0x3219('0x31')](db[_0x3219('0x2c')][_0x3219('0x43')]);_0x315631[_0x3219('0x36')]=_[_0x3219('0x31')](_0x4858ac['query']);_0x315631[_0x3219('0x32')]=_[_0x3219('0x33')](_0x315631[_0x3219('0x30')],_0x315631[_0x3219('0x36')]);_0x5a6b7c[_0x3219('0x34')]=_[_0x3219('0x33')](_0x315631[_0x3219('0x30')],qs[_0x3219('0x35')](_0x4858ac['query'][_0x3219('0x35')]));_0x5a6b7c['attributes']=_0x5a6b7c[_0x3219('0x34')][_0x3219('0x44')]?_0x5a6b7c['attributes']:_0x315631['model'];if(_0x4858ac[_0x3219('0x36')][_0x3219('0x3e')]){_0x5a6b7c[_0x3219('0x45')]=[{'all':!![]}];}_0x5a6b7c=_[_0x3219('0x3a')]({},_0x5a6b7c,_0x4858ac['options']);return db['Schedule'][_0x3219('0x46')](_0x5a6b7c)[_0x3219('0x23')](handleEntityNotFound(_0xe1f75b,null))[_0x3219('0x23')](respondWithResult(_0xe1f75b,null))[_0x3219('0x40')](handleError(_0xe1f75b,null));};exports[_0x3219('0x47')]=function(_0x151868,_0x1a9311){return db[_0x3219('0x2c')][_0x3219('0x47')](_0x151868['body'],{})[_0x3219('0x23')](function(_0x4758f4){var _0xdaa16e=_0x151868['user']['get']({'plain':!![]});if(!_0xdaa16e)throw new Error(_0x3219('0x48'));if(_0xdaa16e['role']===_0x3219('0x49')){var _0x4bd5b4=_0x4758f4[_0x3219('0x25')]({'plain':!![]});var _0xa46cfb=_0x3219('0x26');return db[_0x3219('0x4a')][_0x3219('0x46')]({'where':{'name':_0xa46cfb,'userProfileId':_0xdaa16e['userProfileId']},'raw':!![]})[_0x3219('0x23')](function(_0x1cede0){if(_0x1cede0&&_0x1cede0[_0x3219('0x4b')]===0x0){return db[_0x3219('0x27')][_0x3219('0x47')]({'name':_0x4bd5b4[_0x3219('0x3b')],'resourceId':_0x4bd5b4['id'],'type':_0x1cede0['name'],'sectionId':_0x1cede0['id']},{})[_0x3219('0x23')](function(){return _0x4758f4;});}else{return _0x4758f4;}})[_0x3219('0x40')](function(_0x40cb5d){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x40cb5d);throw _0x40cb5d;});}return _0x4758f4;})[_0x3219('0x23')](respondWithResult(_0x1a9311,0xc9))[_0x3219('0x40')](handleError(_0x1a9311,null));};exports['update']=function(_0x129c5b,_0x59c8f8){if(_0x129c5b[_0x3219('0x4c')]['id']){delete _0x129c5b['body']['id'];}return db[_0x3219('0x2c')][_0x3219('0x46')]({'where':{'id':_0x129c5b[_0x3219('0x42')]['id']}})[_0x3219('0x23')](handleEntityNotFound(_0x59c8f8,null))[_0x3219('0x23')](saveUpdates(_0x129c5b[_0x3219('0x4c')],null))[_0x3219('0x23')](respondWithResult(_0x59c8f8,null))[_0x3219('0x40')](handleError(_0x59c8f8,null));};exports[_0x3219('0x24')]=function(_0x2a194a,_0x354a2f){return db[_0x3219('0x2c')][_0x3219('0x46')]({'where':{'id':_0x2a194a[_0x3219('0x42')]['id']}})[_0x3219('0x23')](handleEntityNotFound(_0x354a2f,null))['then'](removeEntity(_0x354a2f,null))[_0x3219('0x40')](handleError(_0x354a2f,null));};exports[_0x3219('0x4d')]=function(_0x4da1a9,_0x510d7f,_0x625ed6){var _0x24b2a9=require(_0x3219('0x4e'));return db[_0x3219('0x2c')][_0x3219('0x46')]({'where':{'id':_0x4da1a9[_0x3219('0x42')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x510d7f,null))[_0x3219('0x23')](function(){_0x24b2a9[_0x3219('0x4d')](_0x4da1a9[_0x3219('0x42')]['id']);})[_0x3219('0x23')](respondWithStatusCode(_0x510d7f,null))['catch'](handleError(_0x510d7f,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index 75a283f..c8bec47 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 _0x645b=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./schedule.attributes','define'];(function(_0x1d606d,_0x376e51){var _0x3c38bd=function(_0x2ea4e2){while(--_0x2ea4e2){_0x1d606d['push'](_0x1d606d['shift']());}};_0x3c38bd(++_0x376e51);}(_0x645b,0x14a));var _0xb645=function(_0x34d7c7,_0x128dec){_0x34d7c7=_0x34d7c7-0x0;var _0x59b527=_0x645b[_0x34d7c7];return _0x59b527;};'use strict';var _=require(_0xb645('0x0'));var util=require(_0xb645('0x1'));var logger=require(_0xb645('0x2'))(_0xb645('0x3'));var moment=require(_0xb645('0x4'));var BPromise=require(_0xb645('0x5'));var rp=require(_0xb645('0x6'));var fs=require('fs');var path=require(_0xb645('0x7'));var rimraf=require(_0xb645('0x8'));var config=require('../../config/environment');var attributes=require(_0xb645('0x9'));module['exports']=function(_0x44a49c,_0x5db2aa){return _0x44a49c[_0xb645('0xa')]('Schedule',attributes,{'tableName':'tools_schedules','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5640=['tools_schedules','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./schedule.attributes','exports','define'];(function(_0x225597,_0x5a3262){var _0x3d65d7=function(_0x5f82c8){while(--_0x5f82c8){_0x225597['push'](_0x225597['shift']());}};_0x3d65d7(++_0x5a3262);}(_0x5640,0xfd));var _0x0564=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x5640[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require(_0x0564('0x0'));var util=require('util');var logger=require(_0x0564('0x1'))('api');var moment=require(_0x0564('0x2'));var BPromise=require(_0x0564('0x3'));var rp=require(_0x0564('0x4'));var fs=require('fs');var path=require(_0x0564('0x5'));var rimraf=require(_0x0564('0x6'));var config=require(_0x0564('0x7'));var attributes=require(_0x0564('0x8'));module[_0x0564('0x9')]=function(_0x45bb82,_0x29d834){return _0x45bb82[_0x0564('0xa')]('Schedule',attributes,{'tableName':_0x0564('0xb'),'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 8162d53..90fa064 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 _0x8920=['Schedule,\x20%s,\x20%s','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','request'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x8920,0xe7));var _0x0892=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x8920[_0x501510];return _0x1e6ee5;};'use strict';var _=require('lodash');var util=require(_0x0892('0x0'));var moment=require(_0x0892('0x1'));var BPromise=require(_0x0892('0x2'));var rs=require(_0x0892('0x3'));var fs=require('fs');var Redis=require(_0x0892('0x4'));var db=require(_0x0892('0x5'))['db'];var utils=require(_0x0892('0x6'));var logger=require(_0x0892('0x7'))(_0x0892('0x8'));var config=require('../../config/environment');var jayson=require(_0x0892('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1937c5,_0x7dbd20,_0x3db42b){return new BPromise(function(_0x109e1b,_0x1e1415){return client[_0x0892('0xa')](_0x1937c5,_0x3db42b)['then'](function(_0x4909e5){logger['info'](_0x0892('0xb'),_0x7dbd20,_0x0892('0xc'));logger[_0x0892('0xd')](_0x0892('0xe'),_0x7dbd20,_0x0892('0xc'),JSON[_0x0892('0xf')](_0x4909e5));if(_0x4909e5[_0x0892('0x10')]){if(_0x4909e5[_0x0892('0x10')][_0x0892('0x11')]===0x1f4){logger[_0x0892('0x10')](_0x0892('0xb'),_0x7dbd20,_0x4909e5[_0x0892('0x10')][_0x0892('0x12')]);return _0x1e1415(_0x4909e5[_0x0892('0x10')]['message']);}logger['error']('Schedule,\x20%s,\x20%s',_0x7dbd20,_0x4909e5[_0x0892('0x10')][_0x0892('0x12')]);return _0x109e1b(_0x4909e5['error'][_0x0892('0x12')]);}else{logger[_0x0892('0x13')](_0x0892('0xb'),_0x7dbd20,_0x0892('0xc'));_0x109e1b(_0x4909e5[_0x0892('0x14')]['message']);}})[_0x0892('0x15')](function(_0x14bf5d){logger[_0x0892('0x10')](_0x0892('0xb'),_0x7dbd20,_0x14bf5d);_0x1e1415(_0x14bf5d);});});} \ No newline at end of file +var _0xe81f=['result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','Schedule,\x20%s,\x20%s','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x26a815,_0xcde2b9){var _0x539ed1=function(_0x66f759){while(--_0x66f759){_0x26a815['push'](_0x26a815['shift']());}};_0x539ed1(++_0xcde2b9);}(_0xe81f,0xff));var _0xfe81=function(_0x2dc96b,_0x23b57f){_0x2dc96b=_0x2dc96b-0x0;var _0x2534e3=_0xe81f[_0x2dc96b];return _0x2534e3;};'use strict';var _=require('lodash');var util=require(_0xfe81('0x0'));var moment=require(_0xfe81('0x1'));var BPromise=require(_0xfe81('0x2'));var rs=require(_0xfe81('0x3'));var fs=require('fs');var Redis=require(_0xfe81('0x4'));var db=require(_0xfe81('0x5'))['db'];var utils=require(_0xfe81('0x6'));var logger=require('../../config/logger')(_0xfe81('0x7'));var config=require(_0xfe81('0x8'));var jayson=require(_0xfe81('0x9'));var client=jayson[_0xfe81('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x978a94,_0x3f33bc,_0x48121d){return new BPromise(function(_0x51ff8a,_0x54b72a){return client[_0xfe81('0xb')](_0x978a94,_0x48121d)[_0xfe81('0xc')](function(_0x2029ff){logger['info'](_0xfe81('0xd'),_0x3f33bc,_0xfe81('0xe'));logger[_0xfe81('0xf')](_0xfe81('0x10'),_0x3f33bc,'request\x20sent',JSON[_0xfe81('0x11')](_0x2029ff));if(_0x2029ff[_0xfe81('0x12')]){if(_0x2029ff[_0xfe81('0x12')][_0xfe81('0x13')]===0x1f4){logger[_0xfe81('0x12')](_0xfe81('0xd'),_0x3f33bc,_0x2029ff['error'][_0xfe81('0x14')]);return _0x54b72a(_0x2029ff[_0xfe81('0x12')][_0xfe81('0x14')]);}logger['error'](_0xfe81('0xd'),_0x3f33bc,_0x2029ff['error']['message']);return _0x51ff8a(_0x2029ff['error'][_0xfe81('0x14')]);}else{logger['info'](_0xfe81('0xd'),_0x3f33bc,'request\x20sent');_0x51ff8a(_0x2029ff[_0xfe81('0x15')]['message']);}})[_0xfe81('0x16')](function(_0x5cea91){logger[_0xfe81('0x12')]('Schedule,\x20%s,\x20%s',_0x3f33bc,_0x5cea91);_0x54b72a(_0x5cea91);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index 567eea6..64451a1 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 _0xc7f5=['destroy','exports','multer','util','Router','fs-extra','../../components/interaction/service','../../config/environment','./screenRecording.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/download','download','post','create','put','update','delete'];(function(_0x1a7550,_0x1edace){var _0x426e22=function(_0x1c10a1){while(--_0x1c10a1){_0x1a7550['push'](_0x1a7550['shift']());}};_0x426e22(++_0x1edace);}(_0xc7f5,0x162));var _0x5c7f=function(_0x17812e,_0x429028){_0x17812e=_0x17812e-0x0;var _0x256192=_0xc7f5[_0x17812e];return _0x256192;};'use strict';var multer=require(_0x5c7f('0x0'));var util=require(_0x5c7f('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x5c7f('0x2')]();var fs_extra=require(_0x5c7f('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x5c7f('0x4'));var config=require(_0x5c7f('0x5'));var controller=require(_0x5c7f('0x6'));router[_0x5c7f('0x7')]('/',auth[_0x5c7f('0x8')](),controller[_0x5c7f('0x9')]);router[_0x5c7f('0x7')](_0x5c7f('0xa'),auth[_0x5c7f('0x8')](),controller[_0x5c7f('0xb')]);router[_0x5c7f('0x7')](_0x5c7f('0xc'),auth[_0x5c7f('0x8')](),controller['show']);router[_0x5c7f('0x7')](_0x5c7f('0xd'),auth[_0x5c7f('0x8')](),controller[_0x5c7f('0xe')]);router[_0x5c7f('0xf')]('/',auth[_0x5c7f('0x8')](),controller[_0x5c7f('0x10')]);router[_0x5c7f('0x11')](_0x5c7f('0xc'),auth[_0x5c7f('0x8')](),controller[_0x5c7f('0x12')]);router[_0x5c7f('0x13')](_0x5c7f('0xc'),auth[_0x5c7f('0x8')](),controller[_0x5c7f('0x14')]);module[_0x5c7f('0x15')]=router; \ No newline at end of file +var _0xa076=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./screenRecording.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/download','download','create','put','update','delete','destroy','exports','multer','util'];(function(_0x2e9b76,_0x511a45){var _0x551b7d=function(_0x137412){while(--_0x137412){_0x2e9b76['push'](_0x2e9b76['shift']());}};_0x551b7d(++_0x511a45);}(_0xa076,0xf8));var _0x6a07=function(_0x424b23,_0x50a046){_0x424b23=_0x424b23-0x0;var _0x425270=_0xa076[_0x424b23];return _0x425270;};'use strict';var multer=require(_0x6a07('0x0'));var util=require(_0x6a07('0x1'));var path=require(_0x6a07('0x2'));var timeout=require(_0x6a07('0x3'));var express=require(_0x6a07('0x4'));var router=express[_0x6a07('0x5')]();var fs_extra=require(_0x6a07('0x6'));var auth=require(_0x6a07('0x7'));var interaction=require(_0x6a07('0x8'));var config=require(_0x6a07('0x9'));var controller=require(_0x6a07('0xa'));router[_0x6a07('0xb')]('/',auth[_0x6a07('0xc')](),controller[_0x6a07('0xd')]);router[_0x6a07('0xb')](_0x6a07('0xe'),auth[_0x6a07('0xc')](),controller['describe']);router['get'](_0x6a07('0xf'),auth[_0x6a07('0xc')](),controller[_0x6a07('0x10')]);router[_0x6a07('0xb')](_0x6a07('0x11'),auth[_0x6a07('0xc')](),controller[_0x6a07('0x12')]);router['post']('/',auth[_0x6a07('0xc')](),controller[_0x6a07('0x13')]);router[_0x6a07('0x14')](_0x6a07('0xf'),auth['isAuthenticated'](),controller[_0x6a07('0x15')]);router[_0x6a07('0x16')](_0x6a07('0xf'),auth['isAuthenticated'](),controller[_0x6a07('0x17')]);module[_0x6a07('0x18')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index 98db0fd..ee59b20 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 _0xf3f9=['getDataValue','value','extname','STRING','replace','setDataValue','INTEGER','closedAt','duration','DATE','startedAt','format','MM-DD-YYYY\x20HH:mm','toString','createdAt','updatedAt','sequelize','moment','../../config/environment','exports','VIRTUAL'];(function(_0x4b91c4,_0x23f35f){var _0x25cb80=function(_0x48e283){while(--_0x48e283){_0x4b91c4['push'](_0x4b91c4['shift']());}};_0x25cb80(++_0x23f35f);}(_0xf3f9,0x1de));var _0x9f3f=function(_0x4146ef,_0x1b007b){_0x4146ef=_0x4146ef-0x0;var _0x2998f9=_0xf3f9[_0x4146ef];return _0x2998f9;};'use strict';var Sequelize=require(_0x9f3f('0x0'));var moment=require(_0x9f3f('0x1'));var path=require('path');var config=require(_0x9f3f('0x2'));module[_0x9f3f('0x3')]={'format':{'type':Sequelize[_0x9f3f('0x4')],'get':function(){return this[_0x9f3f('0x5')](_0x9f3f('0x6'))?path[_0x9f3f('0x7')](this[_0x9f3f('0x5')]('value')):undefined;}},'interactionid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x9f3f('0x8')]},'value':{'type':Sequelize['STRING'],'set':function(_0x17b150){var _0x4a9a17=_0x17b150[_0x9f3f('0x9')](/\\/g,'/');this[_0x9f3f('0xa')](_0x9f3f('0x6'),_0x4a9a17);}},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x9f3f('0xb')],'set':function(_0x588c31){this['setDataValue']('startedAt',moment()['subtract'](_0x588c31,'ms'));this[_0x9f3f('0xa')](_0x9f3f('0xc'),moment());this[_0x9f3f('0xa')](_0x9f3f('0xd'),_0x588c31);}},'startedAt':{'type':Sequelize[_0x9f3f('0xe')],'get':function(){return moment(this[_0x9f3f('0x5')](_0x9f3f('0xf')))[_0x9f3f('0x10')](_0x9f3f('0x11'))[_0x9f3f('0x12')]();}},'closedAt':{'type':Sequelize[_0x9f3f('0xe')],'get':function(){return moment(this[_0x9f3f('0x5')]('closedAt'))[_0x9f3f('0x10')](_0x9f3f('0x11'))['toString']();}},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x9f3f('0x5')](_0x9f3f('0x13')))[_0x9f3f('0x10')](_0x9f3f('0x11'))[_0x9f3f('0x12')]();}},'updatedAt':{'type':Sequelize[_0x9f3f('0xe')],'get':function(){return moment(this['getDataValue'](_0x9f3f('0x14')))[_0x9f3f('0x10')](_0x9f3f('0x11'))[_0x9f3f('0x12')]();}}}; \ No newline at end of file +var _0x9e69=['getDataValue','value','STRING','setDataValue','INTEGER','startedAt','subtract','duration','DATE','format','toString','MM-DD-YYYY\x20HH:mm','updatedAt','moment','path','../../config/environment','exports'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x9e69,0x150));var _0x99e6=function(_0x53744c,_0x10d223){_0x53744c=_0x53744c-0x0;var _0x3ea8df=_0x9e69[_0x53744c];return _0x3ea8df;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x99e6('0x0'));var path=require(_0x99e6('0x1'));var config=require(_0x99e6('0x2'));module[_0x99e6('0x3')]={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x99e6('0x4')](_0x99e6('0x5'))?path['extname'](this[_0x99e6('0x4')](_0x99e6('0x5'))):undefined;}},'interactionid':{'type':Sequelize[_0x99e6('0x6')]},'channel':{'type':Sequelize['STRING']},'value':{'type':Sequelize[_0x99e6('0x6')],'set':function(_0x3cf241){var _0x41635b=_0x3cf241['replace'](/\\/g,'/');this[_0x99e6('0x7')](_0x99e6('0x5'),_0x41635b);}},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x99e6('0x8')],'set':function(_0x133169){this['setDataValue'](_0x99e6('0x9'),moment()[_0x99e6('0xa')](_0x133169,'ms'));this['setDataValue']('closedAt',moment());this[_0x99e6('0x7')](_0x99e6('0xb'),_0x133169);}},'startedAt':{'type':Sequelize[_0x99e6('0xc')],'get':function(){return moment(this[_0x99e6('0x4')](_0x99e6('0x9')))[_0x99e6('0xd')]('MM-DD-YYYY\x20HH:mm')[_0x99e6('0xe')]();}},'closedAt':{'type':Sequelize[_0x99e6('0xc')],'get':function(){return moment(this[_0x99e6('0x4')]('closedAt'))[_0x99e6('0xd')](_0x99e6('0xf'))[_0x99e6('0xe')]();}},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this['getDataValue']('createdAt'))[_0x99e6('0xd')](_0x99e6('0xf'))[_0x99e6('0xe')]();}},'updatedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x99e6('0x4')](_0x99e6('0x10')))[_0x99e6('0xd')](_0x99e6('0xf'))[_0x99e6('0xe')]();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index bed18bf..d5ecf9e 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 _0xb4c7=['rawAttributes','fieldName','type','format','query','filters','model','attributes','intersection','fields','length','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','findAll','rows','catch','show','keys','include','find','create','body','duration','createdAt','closedAt','value','describe','../../components/encryptor','uniqueid','params','join','server/files/screen_recordings','%s.cypher','existsSync','decryptFile','secrets','recording','root','ValidationError','download','filename','extname','unlink','message','Not\x20found','isNil','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','ScreenRecording'];(function(_0x4bf814,_0x431c38){var _0xd4452c=function(_0x4648de){while(--_0x4648de){_0x4bf814['push'](_0x4bf814['shift']());}};_0xd4452c(++_0x431c38);}(_0xb4c7,0x1ea));var _0x7b4c=function(_0x17acd0,_0x58e529){_0x17acd0=_0x17acd0-0x0;var _0x2bc933=_0xb4c7[_0x17acd0];return _0x2bc933;};'use strict';var emlformat=require(_0x7b4c('0x0'));var rimraf=require(_0x7b4c('0x1'));var zipdir=require(_0x7b4c('0x2'));var jsonpatch=require(_0x7b4c('0x3'));var rp=require(_0x7b4c('0x4'));var moment=require('moment');var BPromise=require(_0x7b4c('0x5'));var Mustache=require(_0x7b4c('0x6'));var util=require(_0x7b4c('0x7'));var path=require(_0x7b4c('0x8'));var sox=require(_0x7b4c('0x9'));var csv=require('to-csv');var ejs=require(_0x7b4c('0xa'));var fs=require('fs');var fs_extra=require(_0x7b4c('0xb'));var _=require(_0x7b4c('0xc'));var squel=require('squel');var crypto=require(_0x7b4c('0xd'));var jsforce=require(_0x7b4c('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x7b4c('0xf'));var querystring=require(_0x7b4c('0x10'));var Papa=require(_0x7b4c('0x11'));var Redis=require(_0x7b4c('0x12'));var authService=require(_0x7b4c('0x13'));var qs=require(_0x7b4c('0x14'));var as=require(_0x7b4c('0x15'));var hardwareService=require(_0x7b4c('0x16'));var logger=require(_0x7b4c('0x17'))(_0x7b4c('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x7b4c('0x19'));var db=require(_0x7b4c('0x1a'))['db'];function respondWithStatusCode(_0x38656b,_0x1722ad){_0x1722ad=_0x1722ad||0xcc;return function(_0x3e1558){if(_0x3e1558){return _0x38656b[_0x7b4c('0x1b')](_0x1722ad);}return _0x38656b[_0x7b4c('0x1c')](_0x1722ad)[_0x7b4c('0x1d')]();};}function respondWithResult(_0x25b90b,_0x387488){_0x387488=_0x387488||0xc8;return function(_0x593a19){if(_0x593a19){return _0x25b90b[_0x7b4c('0x1c')](_0x387488)[_0x7b4c('0x1e')](_0x593a19);}};}function respondWithFilteredResult(_0xdc71cd,_0x2a0e2f){return function(_0xa0a812){if(_0xa0a812){var _0x2471b3=typeof _0x2a0e2f[_0x7b4c('0x1f')]===_0x7b4c('0x20')&&typeof _0x2a0e2f['limit']===_0x7b4c('0x20');var _0xe71d88=_0xa0a812[_0x7b4c('0x21')];var _0x36c02a=_0x2471b3?0x0:_0x2a0e2f['offset'];var _0x3ce10c=_0x2471b3?_0xa0a812[_0x7b4c('0x21')]:_0x2a0e2f[_0x7b4c('0x1f')]+_0x2a0e2f[_0x7b4c('0x22')];var _0x2d4c72;if(_0x3ce10c>=_0xe71d88){_0x3ce10c=_0xe71d88;_0x2d4c72=0xc8;}else{_0x2d4c72=0xce;}_0xdc71cd[_0x7b4c('0x1c')](_0x2d4c72);return _0xdc71cd[_0x7b4c('0x23')](_0x7b4c('0x24'),_0x36c02a+'-'+_0x3ce10c+'/'+_0xe71d88)[_0x7b4c('0x1e')](_0xa0a812);}return null;};}function patchUpdates(_0x55e3df){return function(_0x1f06ec){try{jsonpatch[_0x7b4c('0x25')](_0x1f06ec,_0x55e3df,!![]);}catch(_0x11996d){return BPromise[_0x7b4c('0x26')](_0x11996d);}return _0x1f06ec[_0x7b4c('0x27')]();};}function saveUpdates(_0x168ac9,_0x176704){return function(_0x3d4826){if(_0x3d4826){return _0x3d4826[_0x7b4c('0x28')](_0x168ac9)[_0x7b4c('0x29')](function(_0x5eec1e){return _0x5eec1e;});}return null;};}function removeEntity(_0x45438c,_0x4350c9){return function(_0x276271){if(_0x276271){return _0x276271[_0x7b4c('0x2a')]()[_0x7b4c('0x29')](function(){_0x45438c[_0x7b4c('0x1c')](0xcc)[_0x7b4c('0x1d')]();});}};}function handleEntityNotFound(_0x459eb4,_0x1f311e){return function(_0x1a69db){if(!_0x1a69db){_0x459eb4[_0x7b4c('0x1b')](0x194);}return _0x1a69db;};}function handleError(_0x257da2,_0x316e5f){_0x316e5f=_0x316e5f||0x1f4;return function(_0x501f75){logger[_0x7b4c('0x2b')](_0x501f75[_0x7b4c('0x2c')]);if(_0x501f75[_0x7b4c('0x2d')]){delete _0x501f75[_0x7b4c('0x2d')];}_0x257da2[_0x7b4c('0x1c')](_0x316e5f)[_0x7b4c('0x2e')](_0x501f75);};}exports[_0x7b4c('0x2f')]=function(_0x2552f9,_0x3e4a46){var _0x9a799b={},_0x3585cd={},_0x130ace={'count':0x0,'rows':[]};var _0x3544bc=_[_0x7b4c('0x30')](db[_0x7b4c('0x31')][_0x7b4c('0x32')],function(_0x1d0724){return{'name':_0x1d0724[_0x7b4c('0x33')],'type':_0x1d0724[_0x7b4c('0x34')]['key']};});_0x3585cd['model']=_['differenceBy'](_[_0x7b4c('0x30')](_0x3544bc,_0x7b4c('0x2d')),[_0x7b4c('0x35')]);_0x3585cd[_0x7b4c('0x36')]=_['keys'](_0x2552f9[_0x7b4c('0x36')]);_0x3585cd[_0x7b4c('0x37')]=_['intersection'](_0x3585cd[_0x7b4c('0x38')],_0x3585cd['query']);_0x9a799b[_0x7b4c('0x39')]=_[_0x7b4c('0x3a')](_0x3585cd[_0x7b4c('0x38')],qs['fields'](_0x2552f9[_0x7b4c('0x36')][_0x7b4c('0x3b')]));_0x9a799b['attributes']=_0x9a799b[_0x7b4c('0x39')][_0x7b4c('0x3c')]?_0x9a799b[_0x7b4c('0x39')]:_0x3585cd[_0x7b4c('0x38')];if(!_0x2552f9['query']['hasOwnProperty'](_0x7b4c('0x3d'))){_0x9a799b[_0x7b4c('0x22')]=qs['limit'](_0x2552f9[_0x7b4c('0x36')]['limit']);_0x9a799b['offset']=qs[_0x7b4c('0x1f')](_0x2552f9[_0x7b4c('0x36')][_0x7b4c('0x1f')]);}_0x9a799b[_0x7b4c('0x3e')]=qs['sort'](_0x2552f9[_0x7b4c('0x36')][_0x7b4c('0x3f')]);_0x9a799b[_0x7b4c('0x40')]=qs[_0x7b4c('0x37')](_[_0x7b4c('0x41')](_0x2552f9[_0x7b4c('0x36')],_0x3585cd[_0x7b4c('0x37')]),_0x3544bc);if(_0x2552f9['query']['filter']){_0x9a799b[_0x7b4c('0x40')]=_[_0x7b4c('0x42')](_0x9a799b[_0x7b4c('0x40')],{'$or':_[_0x7b4c('0x30')](_0x3544bc,function(_0xb8486d){if(_0xb8486d['type']!==_0x7b4c('0x43')){var _0x902367={};_0x902367[_0xb8486d[_0x7b4c('0x2d')]]={'$like':'%'+_0x2552f9[_0x7b4c('0x36')][_0x7b4c('0x44')]+'%'};return _0x902367;}})});}_0x9a799b=_[_0x7b4c('0x42')]({},_0x9a799b,_0x2552f9[_0x7b4c('0x45')]);var _0x1080fc={'where':_0x9a799b[_0x7b4c('0x40')]};return db['ScreenRecording'][_0x7b4c('0x21')](_0x1080fc)['then'](function(_0x2a3a74){_0x130ace['count']=_0x2a3a74;if(_0x2552f9[_0x7b4c('0x36')][_0x7b4c('0x46')]){_0x9a799b['include']=[{'all':!![]}];}return db['ScreenRecording'][_0x7b4c('0x47')](_0x9a799b);})[_0x7b4c('0x29')](function(_0x1def44){_0x130ace[_0x7b4c('0x48')]=_0x1def44;return _0x130ace;})['then'](respondWithFilteredResult(_0x3e4a46,_0x9a799b))[_0x7b4c('0x49')](handleError(_0x3e4a46,null));};exports[_0x7b4c('0x4a')]=function(_0x100774,_0x5d4ed8){var _0x45ad59={'raw':![],'where':{'id':_0x100774['params']['id']}},_0x4b4757={};_0x4b4757[_0x7b4c('0x38')]=_['keys'](db[_0x7b4c('0x31')][_0x7b4c('0x32')]);_0x4b4757[_0x7b4c('0x36')]=_[_0x7b4c('0x4b')](_0x100774[_0x7b4c('0x36')]);_0x4b4757[_0x7b4c('0x37')]=_[_0x7b4c('0x3a')](_0x4b4757[_0x7b4c('0x38')],_0x4b4757[_0x7b4c('0x36')]);_0x45ad59['attributes']=_[_0x7b4c('0x3a')](_0x4b4757['model'],qs['fields'](_0x100774[_0x7b4c('0x36')][_0x7b4c('0x3b')]));_0x45ad59['attributes']=_0x45ad59['attributes'][_0x7b4c('0x3c')]?_0x45ad59[_0x7b4c('0x39')]:_0x4b4757[_0x7b4c('0x38')];if(_0x100774[_0x7b4c('0x36')][_0x7b4c('0x46')]){_0x45ad59[_0x7b4c('0x4c')]=[{'all':!![]}];}_0x45ad59=_[_0x7b4c('0x42')]({},_0x45ad59,_0x100774[_0x7b4c('0x45')]);return db['ScreenRecording'][_0x7b4c('0x4d')](_0x45ad59)[_0x7b4c('0x29')](handleEntityNotFound(_0x5d4ed8,null))[_0x7b4c('0x29')](respondWithResult(_0x5d4ed8,null))[_0x7b4c('0x49')](handleError(_0x5d4ed8,null));};exports[_0x7b4c('0x4e')]=function(_0x379f15,_0x11a6f9){return db[_0x7b4c('0x31')][_0x7b4c('0x4e')](_0x379f15['body'],{})['then'](respondWithResult(_0x11a6f9,0xc9))[_0x7b4c('0x49')](handleError(_0x11a6f9,null));};exports[_0x7b4c('0x28')]=function(_0x97eadf,_0x5d4192){if(_0x97eadf[_0x7b4c('0x4f')]['id']){delete _0x97eadf[_0x7b4c('0x4f')]['id'];}delete _0x97eadf['body'][_0x7b4c('0x50')];delete _0x97eadf['body'][_0x7b4c('0x51')];delete _0x97eadf['body'][_0x7b4c('0x52')];delete _0x97eadf['body'][_0x7b4c('0x53')];return db[_0x7b4c('0x31')]['find']({'where':{'id':_0x97eadf['params']['id']}})[_0x7b4c('0x29')](handleEntityNotFound(_0x5d4192,null))[_0x7b4c('0x29')](saveUpdates(_0x97eadf[_0x7b4c('0x4f')],null))['then'](respondWithResult(_0x5d4192,null))['catch'](handleError(_0x5d4192,null));};exports[_0x7b4c('0x54')]=function(_0x1c118a,_0x4cbf1b){return db['ScreenRecording'][_0x7b4c('0x54')]()[_0x7b4c('0x29')](respondWithResult(_0x4cbf1b,null))[_0x7b4c('0x49')](handleError(_0x4cbf1b,null));};exports['download']=function(_0x1d017d,_0x2f009a,_0x4aaf57){var _0x484e80=require(_0x7b4c('0x55'));var _0x4d8491=![];var _0x59db20={};if(_0x1d017d[_0x7b4c('0x36')]['type']&&_0x1d017d['query'][_0x7b4c('0x34')]===_0x7b4c('0x56')){_0x59db20[_0x7b4c('0x56')]=_0x1d017d[_0x7b4c('0x57')]['id'];}else{_0x59db20['id']=_0x1d017d['params']['id'];}return db['ScreenRecording'][_0x7b4c('0x4d')]({'where':_0x59db20,'attributes':['id',_0x7b4c('0x53')],'raw':!![]})[_0x7b4c('0x29')](handleEntityNotFound(_0x2f009a,null))['then'](function(_0x255262){if(_0x255262){var _0x3d81fb=path[_0x7b4c('0x58')](config['root'],_0x7b4c('0x59'),_0x255262[_0x7b4c('0x53')]);var _0x529803=util[_0x7b4c('0x35')](_0x7b4c('0x5a'),_0x3d81fb);if(fs[_0x7b4c('0x5b')](_0x529803)){_0x4d8491=!![];return _0x484e80[_0x7b4c('0x5c')](_0x529803,_0x3d81fb,config[_0x7b4c('0x5d')][_0x7b4c('0x5e')])[_0x7b4c('0x29')](function(){return _0x255262;});}return _0x255262;}})['then'](function(_0x4443d0){if(_0x4443d0){var _0x2dc79a=path['join'](config[_0x7b4c('0x5f')],_0x7b4c('0x59'),_0x4443d0[_0x7b4c('0x53')]);if(!fs[_0x7b4c('0x5b')](_0x2dc79a)){throw new db['Sequelize'][(_0x7b4c('0x60'))]('ScreenRecording\x20not\x20found');}if(_0x4443d0['filename']){return _0x2f009a[_0x7b4c('0x61')](_0x2dc79a,_0x4443d0[_0x7b4c('0x62')]+path[_0x7b4c('0x63')](_0x2dc79a),function(){if(_0x4d8491){fs[_0x7b4c('0x64')](_0x2dc79a);}});}else{return _0x2f009a[_0x7b4c('0x61')](_0x2dc79a,function(_0x5b24f6){if(_0x4d8491){fs['unlink'](_0x2dc79a);}});}}})[_0x7b4c('0x49')](function(_0x3c84af){if(_0x3c84af[_0x7b4c('0x65')]==='ScreenRecording\x20not\x20found'){_0x2f009a[_0x7b4c('0x1c')](0x194)[_0x7b4c('0x2e')](_0x7b4c('0x66'));}else{return handleError(_0x2f009a,null);}});};exports['destroy']=function(_0x222b47,_0x3b2144){return db[_0x7b4c('0x31')]['find']({'where':{'id':_0x222b47[_0x7b4c('0x57')]['id']}})[_0x7b4c('0x29')](function(_0x4ac03e){if(_[_0x7b4c('0x67')](_0x4ac03e)){throw new ReferenceError('Entity\x20not\x20found');}return _0x4ac03e;})[_0x7b4c('0x29')](function(_0x11ae6e){var _0x3a3713=path['join'](config['root'],_0x7b4c('0x59'),_0x11ae6e[_0x7b4c('0x53')]);logger[_0x7b4c('0x68')]('cancellazione\x20fisica\x20documento\x20%s',_0x3a3713);if(!_[_0x7b4c('0x67')](_0x11ae6e['value'])&&fs[_0x7b4c('0x5b')](_0x3a3713)){logger[_0x7b4c('0x68')](_0x7b4c('0x69')+_0x3a3713+_0x7b4c('0x6a'));fs[_0x7b4c('0x6b')](_0x3a3713);}_0x3a3713=_0x3a3713+'.cypher';if(!_[_0x7b4c('0x67')](_0x11ae6e[_0x7b4c('0x53')])&&fs['existsSync'](_0x3a3713)){logger[_0x7b4c('0x68')](_0x7b4c('0x69')+_0x3a3713+_0x7b4c('0x6a'));fs[_0x7b4c('0x6b')](_0x3a3713);}return _0x11ae6e;})[_0x7b4c('0x29')](function(_0x2befd7){if(!_0x2befd7)throw new InternalError();return _0x2befd7[_0x7b4c('0x2a')]();})[_0x7b4c('0x29')](function(){_0x3b2144['status'](0xcc)[_0x7b4c('0x1d')]();})[_0x7b4c('0x49')](handleError(_0x3b2144,null));}; \ No newline at end of file +var _0x5c12=['undefined','count','set','Content-Range','apply','reject','update','then','destroy','end','sendStatus','error','name','send','index','map','ScreenRecording','rawAttributes','fieldName','type','key','differenceBy','format','query','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','filters','pick','merge','filter','include','rows','catch','keys','includeAll','options','find','create','body','createdAt','closedAt','value','params','describe','download','uniqueid','join','root','server/files/screen_recordings','%s.cypher','existsSync','decryptFile','secrets','recording','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','isNil','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','json','limit'];(function(_0x5f0afd,_0x5130d5){var _0x5d911b=function(_0x3ecc34){while(--_0x3ecc34){_0x5f0afd['push'](_0x5f0afd['shift']());}};_0x5d911b(++_0x5130d5);}(_0x5c12,0x188));var _0x25c1=function(_0x45f111,_0x3a1a4a){_0x45f111=_0x45f111-0x0;var _0x483508=_0x5c12[_0x45f111];return _0x483508;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x25c1('0x0'));var zipdir=require(_0x25c1('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x25c1('0x2'));var moment=require(_0x25c1('0x3'));var BPromise=require(_0x25c1('0x4'));var Mustache=require(_0x25c1('0x5'));var util=require(_0x25c1('0x6'));var path=require(_0x25c1('0x7'));var sox=require(_0x25c1('0x8'));var csv=require('to-csv');var ejs=require(_0x25c1('0x9'));var fs=require('fs');var fs_extra=require(_0x25c1('0xa'));var _=require(_0x25c1('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x25c1('0xc'));var deskjs=require(_0x25c1('0xd'));var toCsv=require(_0x25c1('0xe'));var querystring=require(_0x25c1('0xf'));var Papa=require(_0x25c1('0x10'));var Redis=require('ioredis');var authService=require(_0x25c1('0x11'));var qs=require(_0x25c1('0x12'));var as=require(_0x25c1('0x13'));var hardwareService=require(_0x25c1('0x14'));var logger=require(_0x25c1('0x15'))('api');var utils=require(_0x25c1('0x16'));var config=require(_0x25c1('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x25c1('0x18'))['db'];function respondWithStatusCode(_0x209af5,_0x323d3c){_0x323d3c=_0x323d3c||0xcc;return function(_0x329ba9){if(_0x329ba9){return _0x209af5['sendStatus'](_0x323d3c);}return _0x209af5['status'](_0x323d3c)['end']();};}function respondWithResult(_0x54f6f4,_0x3ef429){_0x3ef429=_0x3ef429||0xc8;return function(_0x1412ed){if(_0x1412ed){return _0x54f6f4[_0x25c1('0x19')](_0x3ef429)[_0x25c1('0x1a')](_0x1412ed);}};}function respondWithFilteredResult(_0x17a032,_0x4ea926){return function(_0x4638f0){if(_0x4638f0){var _0x55b62d=typeof _0x4ea926['offset']==='undefined'&&typeof _0x4ea926[_0x25c1('0x1b')]===_0x25c1('0x1c');var _0x4dc64b=_0x4638f0['count'];var _0x61a29f=_0x55b62d?0x0:_0x4ea926['offset'];var _0x7175d4=_0x55b62d?_0x4638f0[_0x25c1('0x1d')]:_0x4ea926['offset']+_0x4ea926['limit'];var _0x542768;if(_0x7175d4>=_0x4dc64b){_0x7175d4=_0x4dc64b;_0x542768=0xc8;}else{_0x542768=0xce;}_0x17a032[_0x25c1('0x19')](_0x542768);return _0x17a032[_0x25c1('0x1e')](_0x25c1('0x1f'),_0x61a29f+'-'+_0x7175d4+'/'+_0x4dc64b)[_0x25c1('0x1a')](_0x4638f0);}return null;};}function patchUpdates(_0x481c12){return function(_0x119639){try{jsonpatch[_0x25c1('0x20')](_0x119639,_0x481c12,!![]);}catch(_0x34454a){return BPromise[_0x25c1('0x21')](_0x34454a);}return _0x119639['save']();};}function saveUpdates(_0x4c3259,_0x2a8a84){return function(_0xac3335){if(_0xac3335){return _0xac3335[_0x25c1('0x22')](_0x4c3259)[_0x25c1('0x23')](function(_0x15cf2f){return _0x15cf2f;});}return null;};}function removeEntity(_0x1a4b89,_0x2ba595){return function(_0x324ea9){if(_0x324ea9){return _0x324ea9[_0x25c1('0x24')]()[_0x25c1('0x23')](function(){_0x1a4b89[_0x25c1('0x19')](0xcc)[_0x25c1('0x25')]();});}};}function handleEntityNotFound(_0x399d72,_0x4915cc){return function(_0x2dadae){if(!_0x2dadae){_0x399d72[_0x25c1('0x26')](0x194);}return _0x2dadae;};}function handleError(_0x1b1c96,_0x1fb59f){_0x1fb59f=_0x1fb59f||0x1f4;return function(_0x21fdb8){logger[_0x25c1('0x27')](_0x21fdb8['stack']);if(_0x21fdb8[_0x25c1('0x28')]){delete _0x21fdb8[_0x25c1('0x28')];}_0x1b1c96[_0x25c1('0x19')](_0x1fb59f)[_0x25c1('0x29')](_0x21fdb8);};}exports[_0x25c1('0x2a')]=function(_0x193a68,_0x5c56ab){var _0x1e498={},_0x478f1e={},_0x76b360={'count':0x0,'rows':[]};var _0x31c153=_[_0x25c1('0x2b')](db[_0x25c1('0x2c')][_0x25c1('0x2d')],function(_0x21069c){return{'name':_0x21069c[_0x25c1('0x2e')],'type':_0x21069c[_0x25c1('0x2f')][_0x25c1('0x30')]};});_0x478f1e['model']=_[_0x25c1('0x31')](_['map'](_0x31c153,'name'),[_0x25c1('0x32')]);_0x478f1e[_0x25c1('0x33')]=_['keys'](_0x193a68[_0x25c1('0x33')]);_0x478f1e['filters']=_[_0x25c1('0x34')](_0x478f1e['model'],_0x478f1e[_0x25c1('0x33')]);_0x1e498[_0x25c1('0x35')]=_[_0x25c1('0x34')](_0x478f1e[_0x25c1('0x36')],qs[_0x25c1('0x37')](_0x193a68[_0x25c1('0x33')][_0x25c1('0x37')]));_0x1e498[_0x25c1('0x35')]=_0x1e498['attributes'][_0x25c1('0x38')]?_0x1e498['attributes']:_0x478f1e[_0x25c1('0x36')];if(!_0x193a68['query'][_0x25c1('0x39')](_0x25c1('0x3a'))){_0x1e498[_0x25c1('0x1b')]=qs[_0x25c1('0x1b')](_0x193a68[_0x25c1('0x33')][_0x25c1('0x1b')]);_0x1e498[_0x25c1('0x3b')]=qs[_0x25c1('0x3b')](_0x193a68[_0x25c1('0x33')][_0x25c1('0x3b')]);}_0x1e498[_0x25c1('0x3c')]=qs[_0x25c1('0x3d')](_0x193a68[_0x25c1('0x33')][_0x25c1('0x3d')]);_0x1e498[_0x25c1('0x3e')]=qs[_0x25c1('0x3f')](_[_0x25c1('0x40')](_0x193a68[_0x25c1('0x33')],_0x478f1e[_0x25c1('0x3f')]),_0x31c153);if(_0x193a68[_0x25c1('0x33')]['filter']){_0x1e498[_0x25c1('0x3e')]=_[_0x25c1('0x41')](_0x1e498['where'],{'$or':_[_0x25c1('0x2b')](_0x31c153,function(_0x5eca99){if(_0x5eca99[_0x25c1('0x2f')]!=='VIRTUAL'){var _0x4326fb={};_0x4326fb[_0x5eca99[_0x25c1('0x28')]]={'$like':'%'+_0x193a68[_0x25c1('0x33')][_0x25c1('0x42')]+'%'};return _0x4326fb;}})});}_0x1e498=_[_0x25c1('0x41')]({},_0x1e498,_0x193a68['options']);var _0x1fe6d7={'where':_0x1e498['where']};return db[_0x25c1('0x2c')][_0x25c1('0x1d')](_0x1fe6d7)[_0x25c1('0x23')](function(_0x17fc23){_0x76b360['count']=_0x17fc23;if(_0x193a68['query']['includeAll']){_0x1e498[_0x25c1('0x43')]=[{'all':!![]}];}return db[_0x25c1('0x2c')]['findAll'](_0x1e498);})[_0x25c1('0x23')](function(_0x58792d){_0x76b360[_0x25c1('0x44')]=_0x58792d;return _0x76b360;})[_0x25c1('0x23')](respondWithFilteredResult(_0x5c56ab,_0x1e498))[_0x25c1('0x45')](handleError(_0x5c56ab,null));};exports['show']=function(_0x5502c1,_0x53f87b){var _0x1b1d17={'raw':![],'where':{'id':_0x5502c1['params']['id']}},_0x3cf9c0={};_0x3cf9c0[_0x25c1('0x36')]=_[_0x25c1('0x46')](db[_0x25c1('0x2c')]['rawAttributes']);_0x3cf9c0['query']=_['keys'](_0x5502c1['query']);_0x3cf9c0[_0x25c1('0x3f')]=_[_0x25c1('0x34')](_0x3cf9c0['model'],_0x3cf9c0[_0x25c1('0x33')]);_0x1b1d17[_0x25c1('0x35')]=_[_0x25c1('0x34')](_0x3cf9c0[_0x25c1('0x36')],qs[_0x25c1('0x37')](_0x5502c1[_0x25c1('0x33')][_0x25c1('0x37')]));_0x1b1d17['attributes']=_0x1b1d17['attributes'][_0x25c1('0x38')]?_0x1b1d17[_0x25c1('0x35')]:_0x3cf9c0[_0x25c1('0x36')];if(_0x5502c1['query'][_0x25c1('0x47')]){_0x1b1d17[_0x25c1('0x43')]=[{'all':!![]}];}_0x1b1d17=_[_0x25c1('0x41')]({},_0x1b1d17,_0x5502c1[_0x25c1('0x48')]);return db['ScreenRecording'][_0x25c1('0x49')](_0x1b1d17)[_0x25c1('0x23')](handleEntityNotFound(_0x53f87b,null))[_0x25c1('0x23')](respondWithResult(_0x53f87b,null))[_0x25c1('0x45')](handleError(_0x53f87b,null));};exports['create']=function(_0x59e96b,_0x13ac06){return db[_0x25c1('0x2c')][_0x25c1('0x4a')](_0x59e96b[_0x25c1('0x4b')],{})['then'](respondWithResult(_0x13ac06,0xc9))[_0x25c1('0x45')](handleError(_0x13ac06,null));};exports[_0x25c1('0x22')]=function(_0x5770dd,_0x102f5){if(_0x5770dd[_0x25c1('0x4b')]['id']){delete _0x5770dd[_0x25c1('0x4b')]['id'];}delete _0x5770dd[_0x25c1('0x4b')]['duration'];delete _0x5770dd['body'][_0x25c1('0x4c')];delete _0x5770dd[_0x25c1('0x4b')][_0x25c1('0x4d')];delete _0x5770dd['body'][_0x25c1('0x4e')];return db[_0x25c1('0x2c')]['find']({'where':{'id':_0x5770dd[_0x25c1('0x4f')]['id']}})[_0x25c1('0x23')](handleEntityNotFound(_0x102f5,null))[_0x25c1('0x23')](saveUpdates(_0x5770dd[_0x25c1('0x4b')],null))[_0x25c1('0x23')](respondWithResult(_0x102f5,null))[_0x25c1('0x45')](handleError(_0x102f5,null));};exports[_0x25c1('0x50')]=function(_0x5102a0,_0x5344da){return db['ScreenRecording'][_0x25c1('0x50')]()['then'](respondWithResult(_0x5344da,null))[_0x25c1('0x45')](handleError(_0x5344da,null));};exports[_0x25c1('0x51')]=function(_0x42fd6e,_0x153603,_0x40fe57){var _0x1b72e5=require('../../components/encryptor');var _0x4a876b=![];var _0x68e295={};if(_0x42fd6e[_0x25c1('0x33')][_0x25c1('0x2f')]&&_0x42fd6e[_0x25c1('0x33')][_0x25c1('0x2f')]==='uniqueid'){_0x68e295[_0x25c1('0x52')]=_0x42fd6e[_0x25c1('0x4f')]['id'];}else{_0x68e295['id']=_0x42fd6e[_0x25c1('0x4f')]['id'];}return db[_0x25c1('0x2c')][_0x25c1('0x49')]({'where':_0x68e295,'attributes':['id','value'],'raw':!![]})[_0x25c1('0x23')](handleEntityNotFound(_0x153603,null))[_0x25c1('0x23')](function(_0x49b192){if(_0x49b192){var _0x1341d2=path[_0x25c1('0x53')](config[_0x25c1('0x54')],_0x25c1('0x55'),_0x49b192[_0x25c1('0x4e')]);var _0x3d051a=util['format'](_0x25c1('0x56'),_0x1341d2);if(fs[_0x25c1('0x57')](_0x3d051a)){_0x4a876b=!![];return _0x1b72e5[_0x25c1('0x58')](_0x3d051a,_0x1341d2,config[_0x25c1('0x59')][_0x25c1('0x5a')])[_0x25c1('0x23')](function(){return _0x49b192;});}return _0x49b192;}})[_0x25c1('0x23')](function(_0x5d54cd){if(_0x5d54cd){var _0x321833=path[_0x25c1('0x53')](config[_0x25c1('0x54')],_0x25c1('0x55'),_0x5d54cd[_0x25c1('0x4e')]);if(!fs[_0x25c1('0x57')](_0x321833)){throw new db['Sequelize'][(_0x25c1('0x5b'))](_0x25c1('0x5c'));}if(_0x5d54cd[_0x25c1('0x5d')]){return _0x153603[_0x25c1('0x51')](_0x321833,_0x5d54cd[_0x25c1('0x5d')]+path[_0x25c1('0x5e')](_0x321833),function(){if(_0x4a876b){fs[_0x25c1('0x5f')](_0x321833);}});}else{return _0x153603['download'](_0x321833,function(_0x44efc9){if(_0x4a876b){fs['unlink'](_0x321833);}});}}})[_0x25c1('0x45')](function(_0x24568c){if(_0x24568c[_0x25c1('0x60')]===_0x25c1('0x5c')){_0x153603[_0x25c1('0x19')](0x194)[_0x25c1('0x29')](_0x25c1('0x61'));}else{return handleError(_0x153603,null);}});};exports[_0x25c1('0x24')]=function(_0x4c435c,_0x7dbbe1){return db[_0x25c1('0x2c')][_0x25c1('0x49')]({'where':{'id':_0x4c435c[_0x25c1('0x4f')]['id']}})[_0x25c1('0x23')](function(_0x338f70){if(_[_0x25c1('0x62')](_0x338f70)){throw new ReferenceError('Entity\x20not\x20found');}return _0x338f70;})[_0x25c1('0x23')](function(_0x51e747){var _0x5e1517=path['join'](config[_0x25c1('0x54')],_0x25c1('0x55'),_0x51e747[_0x25c1('0x4e')]);logger[_0x25c1('0x63')](_0x25c1('0x64'),_0x5e1517);if(!_['isNil'](_0x51e747[_0x25c1('0x4e')])&&fs['existsSync'](_0x5e1517)){logger[_0x25c1('0x63')](_0x25c1('0x65')+_0x5e1517+_0x25c1('0x66'));fs[_0x25c1('0x67')](_0x5e1517);}_0x5e1517=_0x5e1517+_0x25c1('0x68');if(!_[_0x25c1('0x62')](_0x51e747[_0x25c1('0x4e')])&&fs['existsSync'](_0x5e1517)){logger[_0x25c1('0x63')](_0x25c1('0x65')+_0x5e1517+_0x25c1('0x66'));fs[_0x25c1('0x67')](_0x5e1517);}return _0x51e747;})[_0x25c1('0x23')](function(_0x425f3e){if(!_0x425f3e)throw new InternalError();return _0x425f3e['destroy']();})[_0x25c1('0x23')](function(){_0x7dbbe1['status'](0xcc)[_0x25c1('0x25')]();})['catch'](handleError(_0x7dbbe1,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index f3e37c8..ff9e11b 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 _0xd79b=['rimraf','../../config/environment','./screenRecording.attributes','exports','define','screen_recordings','interactionid','lodash','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x287864,_0x12ba35){var _0x44be8f=function(_0x413172){while(--_0x413172){_0x287864['push'](_0x287864['shift']());}};_0x44be8f(++_0x12ba35);}(_0xd79b,0x69));var _0xbd79=function(_0x42182d,_0x125b1a){_0x42182d=_0x42182d-0x0;var _0x26459b=_0xd79b[_0x42182d];return _0x26459b;};'use strict';var _=require(_0xbd79('0x0'));var util=require(_0xbd79('0x1'));var logger=require(_0xbd79('0x2'))('api');var moment=require(_0xbd79('0x3'));var BPromise=require(_0xbd79('0x4'));var rp=require(_0xbd79('0x5'));var fs=require('fs');var path=require(_0xbd79('0x6'));var rimraf=require(_0xbd79('0x7'));var config=require(_0xbd79('0x8'));var attributes=require(_0xbd79('0x9'));module[_0xbd79('0xa')]=function(_0x2e848f,_0xeafc78){return _0x2e848f[_0xbd79('0xb')]('ScreenRecording',attributes,{'tableName':_0xbd79('0xc'),'paranoid':![],'indexes':[{'name':'interactionid','fields':[_0xbd79('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x00b5=['../../config/environment','./screenRecording.attributes','exports','define','ScreenRecording','screen_recordings','interactionid','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf'];(function(_0xc38699,_0x12ae38){var _0x26354f=function(_0x1dda4a){while(--_0x1dda4a){_0xc38699['push'](_0xc38699['shift']());}};_0x26354f(++_0x12ae38);}(_0x00b5,0x11f));var _0x500b=function(_0x104158,_0x23c876){_0x104158=_0x104158-0x0;var _0x2cd851=_0x00b5[_0x104158];return _0x2cd851;};'use strict';var _=require(_0x500b('0x0'));var util=require(_0x500b('0x1'));var logger=require(_0x500b('0x2'))('api');var moment=require(_0x500b('0x3'));var BPromise=require(_0x500b('0x4'));var rp=require(_0x500b('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x500b('0x6'));var config=require(_0x500b('0x7'));var attributes=require(_0x500b('0x8'));module[_0x500b('0x9')]=function(_0x2e30b2,_0x4434e5){return _0x2e30b2[_0x500b('0xa')](_0x500b('0xb'),attributes,{'tableName':_0x500b('0xc'),'paranoid':![],'indexes':[{'name':_0x500b('0xd'),'fields':[_0x500b('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index ef1b783..1fa79da 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 _0xdd81=['info','ScreenRecording,\x20%s,\x20%s','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request'];(function(_0xcbd65c,_0x103ff6){var _0x3242dd=function(_0x379a35){while(--_0x379a35){_0xcbd65c['push'](_0xcbd65c['shift']());}};_0x3242dd(++_0x103ff6);}(_0xdd81,0x129));var _0x1dd8=function(_0x2fa673,_0xad52e7){_0x2fa673=_0x2fa673-0x0;var _0x3a8584=_0xdd81[_0x2fa673];return _0x3a8584;};'use strict';var _=require('lodash');var util=require(_0x1dd8('0x0'));var moment=require(_0x1dd8('0x1'));var BPromise=require('bluebird');var rs=require(_0x1dd8('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1dd8('0x3'))['db'];var utils=require(_0x1dd8('0x4'));var logger=require(_0x1dd8('0x5'))('rpc');var config=require(_0x1dd8('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x1dd8('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2e3c43,_0x552ad0,_0x56affe){return new BPromise(function(_0x2b8780,_0x36ad90){return client[_0x1dd8('0x8')](_0x2e3c43,_0x56affe)['then'](function(_0x451693){logger[_0x1dd8('0x9')](_0x1dd8('0xa'),_0x552ad0,'request\x20sent');logger[_0x1dd8('0xb')](_0x1dd8('0xc'),_0x552ad0,_0x1dd8('0xd'),JSON[_0x1dd8('0xe')](_0x451693));if(_0x451693[_0x1dd8('0xf')]){if(_0x451693[_0x1dd8('0xf')]['code']===0x1f4){logger[_0x1dd8('0xf')]('ScreenRecording,\x20%s,\x20%s',_0x552ad0,_0x451693['error'][_0x1dd8('0x10')]);return _0x36ad90(_0x451693['error'][_0x1dd8('0x10')]);}logger[_0x1dd8('0xf')]('ScreenRecording,\x20%s,\x20%s',_0x552ad0,_0x451693['error'][_0x1dd8('0x10')]);return _0x2b8780(_0x451693[_0x1dd8('0xf')][_0x1dd8('0x10')]);}else{logger[_0x1dd8('0x9')]('ScreenRecording,\x20%s,\x20%s',_0x552ad0,_0x1dd8('0xd'));_0x2b8780(_0x451693['result']['message']);}})[_0x1dd8('0x11')](function(_0x254227){logger[_0x1dd8('0xf')](_0x1dd8('0xa'),_0x552ad0,_0x254227);_0x36ad90(_0x254227);});});} \ No newline at end of file +var _0xef0c=['info','ScreenRecording,\x20%s,\x20%s','code','error','message','catch','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request'];(function(_0x181d2d,_0x480cc8){var _0x4a0cfc=function(_0x5e96b1){while(--_0x5e96b1){_0x181d2d['push'](_0x181d2d['shift']());}};_0x4a0cfc(++_0x480cc8);}(_0xef0c,0x1aa));var _0xcef0=function(_0x5c5fcc,_0x5cab20){_0x5c5fcc=_0x5c5fcc-0x0;var _0x4c1957=_0xef0c[_0x5c5fcc];return _0x4c1957;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xcef0('0x0'));var BPromise=require('bluebird');var rs=require(_0xcef0('0x1'));var fs=require('fs');var Redis=require(_0xcef0('0x2'));var db=require(_0xcef0('0x3'))['db'];var utils=require(_0xcef0('0x4'));var logger=require(_0xcef0('0x5'))('rpc');var config=require(_0xcef0('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xcef0('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5a2001,_0x23b283,_0x3e7e81){return new BPromise(function(_0x9871c4,_0x140431){return client[_0xcef0('0x8')](_0x5a2001,_0x3e7e81)['then'](function(_0xa54c51){logger[_0xcef0('0x9')](_0xcef0('0xa'),_0x23b283,'request\x20sent');logger['debug']('ScreenRecording,\x20%s,\x20%s,\x20%s',_0x23b283,'request\x20sent',JSON['stringify'](_0xa54c51));if(_0xa54c51['error']){if(_0xa54c51['error'][_0xcef0('0xb')]===0x1f4){logger['error'](_0xcef0('0xa'),_0x23b283,_0xa54c51[_0xcef0('0xc')]['message']);return _0x140431(_0xa54c51[_0xcef0('0xc')]['message']);}logger[_0xcef0('0xc')](_0xcef0('0xa'),_0x23b283,_0xa54c51[_0xcef0('0xc')][_0xcef0('0xd')]);return _0x9871c4(_0xa54c51[_0xcef0('0xc')][_0xcef0('0xd')]);}else{logger[_0xcef0('0x9')]('ScreenRecording,\x20%s,\x20%s',_0x23b283,'request\x20sent');_0x9871c4(_0xa54c51['result']['message']);}})[_0xcef0('0xe')](function(_0x8494ab){logger[_0xcef0('0xc')](_0xcef0('0xa'),_0x23b283,_0x8494ab);_0x140431(_0x8494ab);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index ee7cf70..ab948a1 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 _0xa3e0=['post','single','file','%s%s','logologin','extname','addLogoLogin','preferred','addPreferred','favicon','isAuthenticated','update','multer','connect-timeout','fs-extra','../../components/auth/service','./setting.controller','get','index','/now','getDate','/:id','/:id/logo','getLogo','/:id/logo_login','getLogoLogin','gdpr','/:id/preferred','getPreferred','/:id/favicon','getFavicon','diskStorage','join','root','server/files/images/logos/','format','logo','originalname'];(function(_0x52f076,_0x24722b){var _0xfb82d9=function(_0x1ebd8d){while(--_0x1ebd8d){_0x52f076['push'](_0x52f076['shift']());}};_0xfb82d9(++_0x24722b);}(_0xa3e0,0x13c));var _0x0a3e=function(_0xd62e75,_0x47c7e9){_0xd62e75=_0xd62e75-0x0;var _0x21c947=_0xa3e0[_0xd62e75];return _0x21c947;};'use strict';var multer=require(_0x0a3e('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x0a3e('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x0a3e('0x2'));var auth=require(_0x0a3e('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x0a3e('0x4'));router[_0x0a3e('0x5')]('/',auth['isAuthenticated'](),controller[_0x0a3e('0x6')]);router[_0x0a3e('0x5')](_0x0a3e('0x7'),controller[_0x0a3e('0x8')]);router[_0x0a3e('0x5')](_0x0a3e('0x9'),controller['show']);router[_0x0a3e('0x5')](_0x0a3e('0xa'),controller[_0x0a3e('0xb')]);router[_0x0a3e('0x5')](_0x0a3e('0xc'),controller[_0x0a3e('0xd')]);router['get']('/:id/gdpr',controller[_0x0a3e('0xe')]);router[_0x0a3e('0x5')](_0x0a3e('0xf'),controller[_0x0a3e('0x10')]);router[_0x0a3e('0x5')](_0x0a3e('0x11'),controller[_0x0a3e('0x12')]);var upload=multer({'storage':multer[_0x0a3e('0x13')]({'destination':function(_0x405828,_0x3caaee,_0x54c8c6){_0x54c8c6(null,path[_0x0a3e('0x14')](config[_0x0a3e('0x15')],_0x0a3e('0x16')));},'filename':function(_0xddb466,_0x488bd8,_0x5298cf){_0x5298cf(null,util[_0x0a3e('0x17')]('%s%s',_0x0a3e('0x18'),path['extname'](_0x488bd8[_0x0a3e('0x19')])));}})});router[_0x0a3e('0x1a')]('/:id/logo',upload[_0x0a3e('0x1b')](_0x0a3e('0x1c')),controller['addLogo']);var upload=multer({'storage':multer[_0x0a3e('0x13')]({'destination':function(_0x2bfeb3,_0x122ec6,_0x43a751){_0x43a751(null,path[_0x0a3e('0x14')](config[_0x0a3e('0x15')],'server/files/images/logos/'));},'filename':function(_0x286500,_0x19bf29,_0x17b680){_0x17b680(null,util[_0x0a3e('0x17')](_0x0a3e('0x1d'),_0x0a3e('0x1e'),path[_0x0a3e('0x1f')](_0x19bf29['originalname'])));}})});router[_0x0a3e('0x1a')]('/:id/logo_login',upload[_0x0a3e('0x1b')](_0x0a3e('0x1c')),controller[_0x0a3e('0x20')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x36d2d5,_0x30dcb3,_0x1c6498){_0x1c6498(null,path[_0x0a3e('0x14')](config[_0x0a3e('0x15')],_0x0a3e('0x16')));},'filename':function(_0x35cc20,_0x1693ef,_0x436551){_0x436551(null,util[_0x0a3e('0x17')](_0x0a3e('0x1d'),_0x0a3e('0x21'),path['extname'](_0x1693ef[_0x0a3e('0x19')])));}})});router[_0x0a3e('0x1a')](_0x0a3e('0xf'),upload[_0x0a3e('0x1b')]('file'),controller[_0x0a3e('0x22')]);var upload=multer({'storage':multer[_0x0a3e('0x13')]({'destination':function(_0x2ca5b4,_0x12c39b,_0x4af967){_0x4af967(null,path[_0x0a3e('0x14')](config[_0x0a3e('0x15')],'server/files/images/logos/'));},'filename':function(_0xc07e98,_0x501385,_0xf744d1){_0xf744d1(null,util[_0x0a3e('0x17')](_0x0a3e('0x1d'),_0x0a3e('0x23'),path[_0x0a3e('0x1f')](_0x501385[_0x0a3e('0x19')])));}})});router['post'](_0x0a3e('0x11'),upload['single']('file'),controller['addFavicon']);router['put'](_0x0a3e('0x9'),auth[_0x0a3e('0x24')](),controller[_0x0a3e('0x25')]);module['exports']=router; \ No newline at end of file +var _0x3ad2=['update','exports','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','./setting.controller','index','get','/now','getDate','/:id','show','/:id/logo','/:id/logo_login','getLogoLogin','/:id/gdpr','gdpr','/:id/preferred','/:id/favicon','getFavicon','diskStorage','join','root','format','%s%s','logo','extname','originalname','post','single','file','addLogo','server/files/images/logos/','preferred','addPreferred','put','isAuthenticated'];(function(_0x5b8e58,_0x4f42b6){var _0x194535=function(_0x3398d5){while(--_0x3398d5){_0x5b8e58['push'](_0x5b8e58['shift']());}};_0x194535(++_0x4f42b6);}(_0x3ad2,0x158));var _0x23ad=function(_0x38a8e5,_0x55ceed){_0x38a8e5=_0x38a8e5-0x0;var _0x5670f8=_0x3ad2[_0x38a8e5];return _0x5670f8;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x23ad('0x0'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x23ad('0x1'));var auth=require(_0x23ad('0x2'));var interaction=require(_0x23ad('0x3'));var config=require('../../config/environment');var controller=require(_0x23ad('0x4'));router['get']('/',auth['isAuthenticated'](),controller[_0x23ad('0x5')]);router[_0x23ad('0x6')](_0x23ad('0x7'),controller[_0x23ad('0x8')]);router[_0x23ad('0x6')](_0x23ad('0x9'),controller[_0x23ad('0xa')]);router[_0x23ad('0x6')](_0x23ad('0xb'),controller['getLogo']);router[_0x23ad('0x6')](_0x23ad('0xc'),controller[_0x23ad('0xd')]);router[_0x23ad('0x6')](_0x23ad('0xe'),controller[_0x23ad('0xf')]);router['get'](_0x23ad('0x10'),controller['getPreferred']);router[_0x23ad('0x6')](_0x23ad('0x11'),controller[_0x23ad('0x12')]);var upload=multer({'storage':multer[_0x23ad('0x13')]({'destination':function(_0x5a4278,_0x3eee3e,_0x206a79){_0x206a79(null,path[_0x23ad('0x14')](config[_0x23ad('0x15')],'server/files/images/logos/'));},'filename':function(_0x221664,_0x58b689,_0x3d2fd4){_0x3d2fd4(null,util[_0x23ad('0x16')](_0x23ad('0x17'),_0x23ad('0x18'),path[_0x23ad('0x19')](_0x58b689[_0x23ad('0x1a')])));}})});router[_0x23ad('0x1b')](_0x23ad('0xb'),upload[_0x23ad('0x1c')](_0x23ad('0x1d')),controller[_0x23ad('0x1e')]);var upload=multer({'storage':multer[_0x23ad('0x13')]({'destination':function(_0x31650c,_0x2c490e,_0x4e29d4){_0x4e29d4(null,path[_0x23ad('0x14')](config[_0x23ad('0x15')],'server/files/images/logos/'));},'filename':function(_0x4994e9,_0x175431,_0x49127d){_0x49127d(null,util[_0x23ad('0x16')](_0x23ad('0x17'),'logologin',path[_0x23ad('0x19')](_0x175431[_0x23ad('0x1a')])));}})});router['post'](_0x23ad('0xc'),upload[_0x23ad('0x1c')]('file'),controller['addLogoLogin']);var upload=multer({'storage':multer[_0x23ad('0x13')]({'destination':function(_0x38fd81,_0x9088da,_0x3b4a9e){_0x3b4a9e(null,path['join'](config[_0x23ad('0x15')],_0x23ad('0x1f')));},'filename':function(_0x35ff3e,_0x44d124,_0x3947fd){_0x3947fd(null,util[_0x23ad('0x16')](_0x23ad('0x17'),_0x23ad('0x20'),path['extname'](_0x44d124[_0x23ad('0x1a')])));}})});router[_0x23ad('0x1b')]('/:id/preferred',upload[_0x23ad('0x1c')](_0x23ad('0x1d')),controller[_0x23ad('0x21')]);var upload=multer({'storage':multer[_0x23ad('0x13')]({'destination':function(_0x302536,_0x1f20e2,_0x26a29e){_0x26a29e(null,path['join'](config[_0x23ad('0x15')],_0x23ad('0x1f')));},'filename':function(_0xe97db5,_0x56eb38,_0x4f04ef){_0x4f04ef(null,util[_0x23ad('0x16')]('%s%s','favicon',path[_0x23ad('0x19')](_0x56eb38['originalname'])));}})});router[_0x23ad('0x1b')](_0x23ad('0x11'),upload[_0x23ad('0x1c')](_0x23ad('0x1d')),controller['addFavicon']);router[_0x23ad('0x22')](_0x23ad('0x9'),auth[_0x23ad('0x23')](),controller[_0x23ad('0x24')]);module[_0x23ad('0x25')]=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index b5527d0..297da5f 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 _0xadb5=['https://www.xcally.com/bar/phonebar/autoupdater.xml','UNSIGNED','exports','min_internal','INTEGER','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted','BOOLEAN'];(function(_0xf0bc07,_0x510ebf){var _0x1c50c2=function(_0x2e2bdf){while(--_0x2e2bdf){_0xf0bc07['push'](_0xf0bc07['shift']());}};_0x1c50c2(++_0x510ebf);}(_0xadb5,0xad));var _0x5adb=function(_0x449d44,_0x4be174){_0x449d44=_0x449d44-0x0;var _0x3139df=_0xadb5[_0x449d44];return _0x3139df;};'use strict';var Sequelize=require('sequelize');module[_0x5adb('0x0')]={'min_internal':{'type':Sequelize['INTEGER'](0xb),'unique':_0x5adb('0x1'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x5adb('0x2')](0xb),'unique':_0x5adb('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x5adb('0x4')],'defaultValue':_0x5adb('0x5')},'logo':{'type':Sequelize[_0x5adb('0x4')]},'defaultLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x5adb('0x4')]},'defaultLoginLogo':{'type':Sequelize[_0x5adb('0x6')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x5adb('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x5adb('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x5adb('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x5adb('0x6')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x5adb('0x4')]},'turnaddr':{'type':Sequelize[_0x5adb('0x4')]},'turnusername':{'type':Sequelize[_0x5adb('0x4')]},'turnpassword':{'type':Sequelize[_0x5adb('0x4')]},'pageTitle':{'type':Sequelize[_0x5adb('0x4')]},'defaultPageTitle':{'type':Sequelize[_0x5adb('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x5adb('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x5adb('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize['STRING'],'defaultValue':_0x5adb('0x7')},'enableEmailPreview':{'type':Sequelize[_0x5adb('0x6')],'defaultValue':![]},'split':{'type':Sequelize[_0x5adb('0x6')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x5adb('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x5adb('0x4')],'defaultValue':'alternate'},'chatTimeout':{'type':Sequelize[_0x5adb('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x5adb('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0x5adb('0x4')]},'defaultPreferred':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x5adb('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x5adb('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0x5adb('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x5adb('0x4')]},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x5adb('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0x5adb('0x6')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x5adb('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0x5adb('0x2')]},'transcribeRegion':{'type':Sequelize[_0x5adb('0x4')]},'sentiment':{'type':Sequelize[_0x5adb('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0x5adb('0x6')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x5adb('0x2')]},'sentimentRegion':{'type':Sequelize[_0x5adb('0x4')]},'language':{'type':Sequelize['STRING']},'bucket':{'type':Sequelize[_0x5adb('0x4')]},'googleSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x5adb('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize['INTEGER'](0x2)[_0x5adb('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize['INTEGER'](0x2)['UNSIGNED'],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x5adb('0x2')](0x2)[_0x5adb('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x5adb('0x2')](0x2)[_0x5adb('0x8')],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x5adb('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0x5adb('0x2')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0x5adb('0x2')],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x5adb('0x6')],'defaultValue':![]}}; \ No newline at end of file +var _0x5f2f=['INTEGER','min_internal','min_mailbox','STRING','BOOLEAN','alternate','UNSIGNED','sequelize','exports'];(function(_0x339922,_0x2dd7fe){var _0x79a578=function(_0x115adb){while(--_0x115adb){_0x339922['push'](_0x339922['shift']());}};_0x79a578(++_0x2dd7fe);}(_0x5f2f,0x73));var _0xf5f2=function(_0x5d0234,_0x5a36f9){_0x5d0234=_0x5d0234-0x0;var _0x39ecfe=_0x5f2f[_0x5d0234];return _0x39ecfe;};'use strict';var Sequelize=require(_0xf5f2('0x0'));module[_0xf5f2('0x1')]={'min_internal':{'type':Sequelize[_0xf5f2('0x2')](0xb),'unique':_0xf5f2('0x3'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0xf5f2('0x2')](0xb),'unique':_0xf5f2('0x4'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0xf5f2('0x2')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0xf5f2('0x5')],'defaultValue':'/var/opt/motion2/server/files/sounds/converted'},'logo':{'type':Sequelize['STRING']},'defaultLogo':{'type':Sequelize[_0xf5f2('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0xf5f2('0x5')]},'defaultLoginLogo':{'type':Sequelize[_0xf5f2('0x6')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0xf5f2('0x5')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0xf5f2('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0xf5f2('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0xf5f2('0x5')]},'turnaddr':{'type':Sequelize[_0xf5f2('0x5')]},'turnusername':{'type':Sequelize[_0xf5f2('0x5')]},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize[_0xf5f2('0x5')]},'defaultPageTitle':{'type':Sequelize[_0xf5f2('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0xf5f2('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0xf5f2('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize['STRING'],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize[_0xf5f2('0x6')],'defaultValue':![]},'split':{'type':Sequelize[_0xf5f2('0x6')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0xf5f2('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0xf5f2('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0xf5f2('0x5')],'defaultValue':_0xf5f2('0x7')},'chatTimeout':{'type':Sequelize[_0xf5f2('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0xf5f2('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize[_0xf5f2('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0xf5f2('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0xf5f2('0x5')]},'allowedLoginAttempts':{'type':Sequelize[_0xf5f2('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0xf5f2('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize['STRING']},'defaultFavicon':{'type':Sequelize[_0xf5f2('0x6')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0xf5f2('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0xf5f2('0x6')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0xf5f2('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0xf5f2('0x2')]},'transcribeRegion':{'type':Sequelize[_0xf5f2('0x5')]},'sentiment':{'type':Sequelize[_0xf5f2('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0xf5f2('0x6')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0xf5f2('0x2')]},'sentimentRegion':{'type':Sequelize[_0xf5f2('0x5')]},'language':{'type':Sequelize[_0xf5f2('0x5')]},'bucket':{'type':Sequelize[_0xf5f2('0x5')]},'googleSsoEnabled':{'type':Sequelize[_0xf5f2('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0xf5f2('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0xf5f2('0x2')](0x2)[_0xf5f2('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0xf5f2('0x2')](0x2)['UNSIGNED'],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0xf5f2('0x2')](0x2)[_0xf5f2('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize['INTEGER'](0x2)['UNSIGNED'],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0xf5f2('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0xf5f2('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0xf5f2('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0xf5f2('0x2')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0xf5f2('0x2')],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0xf5f2('0x6')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index 386fddb..83a038d 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 _0xae17=['sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','request','then','Setting,\x20%s,\x20%s','debug','Setting,\x20%s,\x20%s,\x20%s','request\x20sent','code','error','message','result','catch','end','status','json','offset','undefined','count','limit','set','Content-Range','reject','update','destroy','sendStatus','name','send','index','Setting','rawAttributes','fieldName','type','key','model','map','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','filters','pick','filter','where','VIRTUAL','merge','options','includeAll','include','show','params','keys','find','body','addLogo','file','filename','loginLogo','../../config/license/util','getLogo','server/files/images/logos','getLicense','logo','preferred','favicon','defaultLogo','defaultLoginLogo','defaultFavicon','existsSync','join','toLower','root','default_logo.svg','default','upperFirst','Sequelize','\x20not\x20found','download','defaultPreferred','default_loginLogo.svg','ValidationError','gdpr','securePassword','addPreferred','getPreferred','default_preferred.png','custom','getFavicon','default_favicon.ico','getDate','utcOffset','format','YYYY-MM-DD\x20HH:mm:ss:SSS','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path'];(function(_0xf52e30,_0x3d66dc){var _0x3e501d=function(_0xcb40a6){while(--_0xcb40a6){_0xf52e30['push'](_0xf52e30['shift']());}};_0x3e501d(++_0x3d66dc);}(_0xae17,0x171));var _0x7ae1=function(_0x55fad9,_0x5b5f53){_0x55fad9=_0x55fad9-0x0;var _0x523c68=_0xae17[_0x55fad9];return _0x523c68;};'use strict';var emlformat=require(_0x7ae1('0x0'));var rimraf=require(_0x7ae1('0x1'));var zipdir=require(_0x7ae1('0x2'));var jsonpatch=require(_0x7ae1('0x3'));var rp=require(_0x7ae1('0x4'));var moment=require('moment');var BPromise=require(_0x7ae1('0x5'));var Mustache=require(_0x7ae1('0x6'));var util=require(_0x7ae1('0x7'));var path=require(_0x7ae1('0x8'));var sox=require(_0x7ae1('0x9'));var csv=require(_0x7ae1('0xa'));var ejs=require(_0x7ae1('0xb'));var fs=require('fs');var fs_extra=require(_0x7ae1('0xc'));var _=require(_0x7ae1('0xd'));var squel=require('squel');var crypto=require(_0x7ae1('0xe'));var jsforce=require(_0x7ae1('0xf'));var deskjs=require(_0x7ae1('0x10'));var toCsv=require(_0x7ae1('0xa'));var querystring=require('querystring');var Papa=require(_0x7ae1('0x11'));var Redis=require(_0x7ae1('0x12'));var authService=require(_0x7ae1('0x13'));var qs=require(_0x7ae1('0x14'));var as=require(_0x7ae1('0x15'));var hardwareService=require(_0x7ae1('0x16'));var logger=require(_0x7ae1('0x17'))(_0x7ae1('0x18'));var utils=require(_0x7ae1('0x19'));var config=require(_0x7ae1('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x7ae1('0x1b'))['db'];var jayson=require(_0x7ae1('0x1c'));var client=jayson[_0x7ae1('0x1d')][_0x7ae1('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x43f696,_0x5d6d76,_0x5415b5,_0x42edcd){return new BPromise(function(_0xfe3d78,_0xbbd661){var _0x367c72=_0x42edcd||client;return _0x367c72[_0x7ae1('0x1f')](_0x43f696,_0x5415b5)[_0x7ae1('0x20')](function(_0x49bfe7){logger['info'](_0x7ae1('0x21'),_0x5d6d76,'request\x20sent');logger[_0x7ae1('0x22')](_0x7ae1('0x23'),_0x5d6d76,_0x7ae1('0x24'),JSON['stringify'](_0x49bfe7));if(_0x49bfe7['error']){if(_0x49bfe7['error'][_0x7ae1('0x25')]===0x1f4){logger[_0x7ae1('0x26')](_0x7ae1('0x21'),_0x5d6d76,_0x49bfe7['error']['message']);return _0xbbd661(_0x49bfe7[_0x7ae1('0x26')][_0x7ae1('0x27')]);}logger['error'](_0x7ae1('0x21'),_0x5d6d76,_0x49bfe7[_0x7ae1('0x26')][_0x7ae1('0x27')]);return _0xfe3d78(_0x49bfe7['error'][_0x7ae1('0x27')]);}else{logger['info'](_0x7ae1('0x21'),_0x5d6d76,_0x7ae1('0x24'));_0xfe3d78(_0x49bfe7[_0x7ae1('0x28')][_0x7ae1('0x27')]);}})[_0x7ae1('0x29')](function(_0xc628a0){logger['error']('Setting,\x20%s,\x20%s',_0x5d6d76,_0xc628a0);_0xbbd661(_0xc628a0);});});}function respondWithStatusCode(_0x583306,_0x3ebad2){_0x3ebad2=_0x3ebad2||0xcc;return function(_0x118e16){if(_0x118e16){return _0x583306['sendStatus'](_0x3ebad2);}return _0x583306['status'](_0x3ebad2)[_0x7ae1('0x2a')]();};}function respondWithResult(_0x4988f7,_0x4b7523){_0x4b7523=_0x4b7523||0xc8;return function(_0xdf4b6a){if(_0xdf4b6a){return _0x4988f7[_0x7ae1('0x2b')](_0x4b7523)[_0x7ae1('0x2c')](_0xdf4b6a);}};}function respondWithFilteredResult(_0x31708b,_0x166926){return function(_0x4d057f){if(_0x4d057f){var _0x21d062=typeof _0x166926[_0x7ae1('0x2d')]===_0x7ae1('0x2e')&&typeof _0x166926['limit']===_0x7ae1('0x2e');var _0x24fbe8=_0x4d057f[_0x7ae1('0x2f')];var _0x598452=_0x21d062?0x0:_0x166926[_0x7ae1('0x2d')];var _0x1ddd1e=_0x21d062?_0x4d057f[_0x7ae1('0x2f')]:_0x166926[_0x7ae1('0x2d')]+_0x166926[_0x7ae1('0x30')];var _0x410606;if(_0x1ddd1e>=_0x24fbe8){_0x1ddd1e=_0x24fbe8;_0x410606=0xc8;}else{_0x410606=0xce;}_0x31708b['status'](_0x410606);return _0x31708b[_0x7ae1('0x31')](_0x7ae1('0x32'),_0x598452+'-'+_0x1ddd1e+'/'+_0x24fbe8)[_0x7ae1('0x2c')](_0x4d057f);}return null;};}function patchUpdates(_0x4850f0){return function(_0x56d118){try{jsonpatch['apply'](_0x56d118,_0x4850f0,!![]);}catch(_0x308af2){return BPromise[_0x7ae1('0x33')](_0x308af2);}return _0x56d118['save']();};}function saveUpdates(_0x506a76,_0x3759f1){return function(_0x1d5c9a){if(_0x1d5c9a){return _0x1d5c9a[_0x7ae1('0x34')](_0x506a76)[_0x7ae1('0x20')](function(_0x3bcecc){return _0x3bcecc;});}return null;};}function removeEntity(_0xd7d27f,_0x4bc7ca){return function(_0x53a8e2){if(_0x53a8e2){return _0x53a8e2[_0x7ae1('0x35')]()[_0x7ae1('0x20')](function(){_0xd7d27f[_0x7ae1('0x2b')](0xcc)[_0x7ae1('0x2a')]();});}};}function handleEntityNotFound(_0x379b5f,_0x41c9bc){return function(_0xeea84d){if(!_0xeea84d){_0x379b5f[_0x7ae1('0x36')](0x194);}return _0xeea84d;};}function handleError(_0x485b9f,_0x862fe7){_0x862fe7=_0x862fe7||0x1f4;return function(_0x81f922){logger['error'](_0x81f922['stack']);if(_0x81f922[_0x7ae1('0x37')]){delete _0x81f922[_0x7ae1('0x37')];}_0x485b9f[_0x7ae1('0x2b')](_0x862fe7)[_0x7ae1('0x38')](_0x81f922);};}exports[_0x7ae1('0x39')]=function(_0x127d4c,_0xd59b38){var _0x46d6e6={},_0x2f55ff={},_0x5075aa={'count':0x0,'rows':[]};var _0x1a4457=_['map'](db[_0x7ae1('0x3a')][_0x7ae1('0x3b')],function(_0x4795d4){return{'name':_0x4795d4[_0x7ae1('0x3c')],'type':_0x4795d4[_0x7ae1('0x3d')][_0x7ae1('0x3e')]};});_0x2f55ff[_0x7ae1('0x3f')]=_[_0x7ae1('0x40')](_0x1a4457,'name');_0x2f55ff[_0x7ae1('0x41')]=_['keys'](_0x127d4c[_0x7ae1('0x41')]);_0x2f55ff['filters']=_[_0x7ae1('0x42')](_0x2f55ff[_0x7ae1('0x3f')],_0x2f55ff['query']);_0x46d6e6[_0x7ae1('0x43')]=_[_0x7ae1('0x42')](_0x2f55ff['model'],qs[_0x7ae1('0x44')](_0x127d4c['query'][_0x7ae1('0x44')]));_0x46d6e6[_0x7ae1('0x43')]=_0x46d6e6['attributes'][_0x7ae1('0x45')]?_0x46d6e6['attributes']:_0x2f55ff[_0x7ae1('0x3f')];if(!_0x127d4c[_0x7ae1('0x41')][_0x7ae1('0x46')]('nolimit')){_0x46d6e6['limit']=qs[_0x7ae1('0x30')](_0x127d4c['query'][_0x7ae1('0x30')]);_0x46d6e6[_0x7ae1('0x2d')]=qs['offset'](_0x127d4c[_0x7ae1('0x41')][_0x7ae1('0x2d')]);}_0x46d6e6[_0x7ae1('0x47')]=qs[_0x7ae1('0x48')](_0x127d4c['query'][_0x7ae1('0x48')]);_0x46d6e6['where']=qs[_0x7ae1('0x49')](_[_0x7ae1('0x4a')](_0x127d4c['query'],_0x2f55ff[_0x7ae1('0x49')]),_0x1a4457);if(_0x127d4c['query'][_0x7ae1('0x4b')]){_0x46d6e6['where']=_['merge'](_0x46d6e6[_0x7ae1('0x4c')],{'$or':_[_0x7ae1('0x40')](_0x1a4457,function(_0x333077){if(_0x333077['type']!==_0x7ae1('0x4d')){var _0x2f79d0={};_0x2f79d0[_0x333077[_0x7ae1('0x37')]]={'$like':'%'+_0x127d4c[_0x7ae1('0x41')][_0x7ae1('0x4b')]+'%'};return _0x2f79d0;}})});}_0x46d6e6=_[_0x7ae1('0x4e')]({},_0x46d6e6,_0x127d4c[_0x7ae1('0x4f')]);var _0x37595d={'where':_0x46d6e6[_0x7ae1('0x4c')]};return db[_0x7ae1('0x3a')][_0x7ae1('0x2f')](_0x37595d)[_0x7ae1('0x20')](function(_0x50654e){_0x5075aa['count']=_0x50654e;if(_0x127d4c[_0x7ae1('0x41')][_0x7ae1('0x50')]){_0x46d6e6[_0x7ae1('0x51')]=[{'all':!![]}];}return db[_0x7ae1('0x3a')]['findAll'](_0x46d6e6);})[_0x7ae1('0x20')](function(_0x148278){_0x5075aa['rows']=_0x148278;return _0x5075aa;})[_0x7ae1('0x20')](respondWithFilteredResult(_0xd59b38,_0x46d6e6))[_0x7ae1('0x29')](handleError(_0xd59b38,null));};exports[_0x7ae1('0x52')]=function(_0x40c1ff,_0x39940b){var _0x167712={'raw':![],'where':{'id':_0x40c1ff[_0x7ae1('0x53')]['id']}},_0x156116={};_0x156116[_0x7ae1('0x3f')]=_['keys'](db[_0x7ae1('0x3a')][_0x7ae1('0x3b')]);_0x156116[_0x7ae1('0x41')]=_[_0x7ae1('0x54')](_0x40c1ff[_0x7ae1('0x41')]);_0x156116[_0x7ae1('0x49')]=_['intersection'](_0x156116[_0x7ae1('0x3f')],_0x156116[_0x7ae1('0x41')]);_0x167712[_0x7ae1('0x43')]=_['intersection'](_0x156116[_0x7ae1('0x3f')],qs[_0x7ae1('0x44')](_0x40c1ff[_0x7ae1('0x41')][_0x7ae1('0x44')]));_0x167712[_0x7ae1('0x43')]=_0x167712['attributes'][_0x7ae1('0x45')]?_0x167712[_0x7ae1('0x43')]:_0x156116[_0x7ae1('0x3f')];if(_0x40c1ff[_0x7ae1('0x41')][_0x7ae1('0x50')]){_0x167712[_0x7ae1('0x51')]=[{'all':!![]}];}_0x167712=_[_0x7ae1('0x4e')]({},_0x167712,_0x40c1ff[_0x7ae1('0x4f')]);return db[_0x7ae1('0x3a')]['find'](_0x167712)[_0x7ae1('0x20')](handleEntityNotFound(_0x39940b,null))[_0x7ae1('0x20')](respondWithResult(_0x39940b,null))[_0x7ae1('0x29')](handleError(_0x39940b,null));};exports[_0x7ae1('0x34')]=function(_0x118362,_0x4c6f5a){if(_0x118362['body']['id']){delete _0x118362['body']['id'];}return db['Setting'][_0x7ae1('0x55')]({'where':{'id':_0x118362[_0x7ae1('0x53')]['id']}})[_0x7ae1('0x20')](handleEntityNotFound(_0x4c6f5a,null))['then'](saveUpdates(_0x118362[_0x7ae1('0x56')],null))[_0x7ae1('0x20')](respondWithResult(_0x4c6f5a,null))[_0x7ae1('0x29')](handleError(_0x4c6f5a,null));};exports[_0x7ae1('0x57')]=function(_0x2e5e8e,_0x325195,_0x33a3a6){if(_0x2e5e8e[_0x7ae1('0x58')]&&_0x2e5e8e['file'][_0x7ae1('0x59')]){_0x2e5e8e[_0x7ae1('0x56')]['logo']=_0x2e5e8e[_0x7ae1('0x58')]['filename'];}return db[_0x7ae1('0x3a')][_0x7ae1('0x55')]({'where':{'id':_0x2e5e8e[_0x7ae1('0x53')]['id']}})[_0x7ae1('0x20')](handleEntityNotFound(_0x325195,null))[_0x7ae1('0x20')](saveUpdates(_0x2e5e8e[_0x7ae1('0x56')],null))[_0x7ae1('0x20')](respondWithResult(_0x325195,null))[_0x7ae1('0x29')](handleError(_0x325195,null));};exports['addLogoLogin']=function(_0x4fe9b1,_0x5bb618,_0x311d7a){if(_0x4fe9b1[_0x7ae1('0x58')]&&_0x4fe9b1['file'][_0x7ae1('0x59')]){_0x4fe9b1[_0x7ae1('0x56')][_0x7ae1('0x5a')]=_0x4fe9b1[_0x7ae1('0x58')]['filename'];}return db[_0x7ae1('0x3a')][_0x7ae1('0x55')]({'where':{'id':_0x4fe9b1[_0x7ae1('0x53')]['id']}})[_0x7ae1('0x20')](handleEntityNotFound(_0x5bb618,null))[_0x7ae1('0x20')](saveUpdates(_0x4fe9b1[_0x7ae1('0x56')],null))[_0x7ae1('0x20')](respondWithResult(_0x5bb618,null))[_0x7ae1('0x29')](handleError(_0x5bb618,null));};var utilLicense=require(_0x7ae1('0x5b'));exports[_0x7ae1('0x5c')]=function(_0x26be30,_0x10758f,_0x580ba2){var _0x4ce975=_0x7ae1('0x5d');var _0x26f8e8={'custom':![]};return utilLicense[_0x7ae1('0x5e')]()[_0x7ae1('0x20')](function(_0xc5fed5){if(_0xc5fed5){_0x26f8e8=_0xc5fed5;}return db['Setting'][_0x7ae1('0x55')]({'where':{'id':_0x26be30[_0x7ae1('0x53')]['id']},'attributes':[_0x7ae1('0x5f'),'loginLogo',_0x7ae1('0x60'),_0x7ae1('0x61'),_0x7ae1('0x62'),_0x7ae1('0x63'),'defaultPreferred',_0x7ae1('0x64')],'raw':!![]});})[_0x7ae1('0x20')](handleEntityNotFound(_0x10758f,null))[_0x7ae1('0x20')](function(_0x45c1b4){if(_0x45c1b4){var _0x2d7c2c=_0x45c1b4['logo']&&fs[_0x7ae1('0x65')](path[_0x7ae1('0x66')](config['root'],_0x4ce975,_[_0x7ae1('0x67')](_0x45c1b4[_0x7ae1('0x5f')])))?path[_0x7ae1('0x66')](config[_0x7ae1('0x68')],_0x4ce975,_[_0x7ae1('0x67')](_0x45c1b4[_0x7ae1('0x5f')])):path[_0x7ae1('0x66')](config['root'],_0x4ce975,_['toLower'](_0x7ae1('0x69')));var _0x588eea=_0x7ae1('0x6a')+_[_0x7ae1('0x6b')](_0x7ae1('0x5f'));if(_0x45c1b4[_0x588eea]||!_0x26f8e8['custom']){_0x2d7c2c=path[_0x7ae1('0x66')](config['root'],_0x4ce975,_[_0x7ae1('0x67')](_0x7ae1('0x69')));}if(!fs[_0x7ae1('0x65')](_0x2d7c2c)){throw new db[(_0x7ae1('0x6c'))]['ValidationError'](_[_0x7ae1('0x6b')](_0x7ae1('0x5f'))+_0x7ae1('0x6d'));}return _0x10758f[_0x7ae1('0x6e')](_0x2d7c2c);}})[_0x7ae1('0x29')](handleError(_0x10758f,null));};var utilLicense=require(_0x7ae1('0x5b'));exports['getLogoLogin']=function(_0x33cd86,_0x1377b2,_0x3175f5){var _0xd1dcba='server/files/images/logos';var _0x357b26={'custom':![]};return utilLicense[_0x7ae1('0x5e')]()['then'](function(_0x5d9446){if(_0x5d9446){_0x357b26=_0x5d9446;}return db[_0x7ae1('0x3a')]['find']({'where':{'id':_0x33cd86['params']['id']},'attributes':[_0x7ae1('0x5f'),'loginLogo',_0x7ae1('0x60'),'favicon',_0x7ae1('0x62'),_0x7ae1('0x63'),_0x7ae1('0x6f'),_0x7ae1('0x64')],'raw':!![]});})[_0x7ae1('0x20')](handleEntityNotFound(_0x1377b2,null))['then'](function(_0x4717a7){if(_0x4717a7){var _0x410b87=_0x4717a7[_0x7ae1('0x5a')]&&fs[_0x7ae1('0x65')](path[_0x7ae1('0x66')](config[_0x7ae1('0x68')],_0xd1dcba,_[_0x7ae1('0x67')](_0x4717a7['loginLogo'])))?path[_0x7ae1('0x66')](config[_0x7ae1('0x68')],_0xd1dcba,_[_0x7ae1('0x67')](_0x4717a7[_0x7ae1('0x5a')])):path[_0x7ae1('0x66')](config[_0x7ae1('0x68')],_0xd1dcba,_[_0x7ae1('0x67')](_0x7ae1('0x70')));var _0x40bad1='default'+_[_0x7ae1('0x6b')]('loginLogo');if(_0x4717a7[_0x40bad1]||!_0x357b26['custom']){_0x410b87=path['join'](config['root'],_0xd1dcba,_[_0x7ae1('0x67')](_0x7ae1('0x70')));}if(!fs[_0x7ae1('0x65')](_0x410b87)){throw new db[(_0x7ae1('0x6c'))][(_0x7ae1('0x71'))](_[_0x7ae1('0x6b')](_0x7ae1('0x5a'))+_0x7ae1('0x6d'));}return _0x1377b2[_0x7ae1('0x6e')](_0x410b87);}})[_0x7ae1('0x29')](handleError(_0x1377b2,null));};exports[_0x7ae1('0x72')]=function(_0x22069d,_0x138720){return db[_0x7ae1('0x3a')][_0x7ae1('0x55')]({'where':{'id':_0x22069d['params']['id']},'attributes':[_0x7ae1('0x73')]})['then'](respondWithResult(_0x138720,null))[_0x7ae1('0x29')](handleError(_0x138720,null));};exports[_0x7ae1('0x74')]=function(_0x3af1bf,_0x27cf18,_0x4f1f52){if(_0x3af1bf[_0x7ae1('0x58')]&&_0x3af1bf[_0x7ae1('0x58')][_0x7ae1('0x59')]){_0x3af1bf['body']['preferred']=_0x3af1bf[_0x7ae1('0x58')][_0x7ae1('0x59')];}return db[_0x7ae1('0x3a')][_0x7ae1('0x55')]({'where':{'id':_0x3af1bf[_0x7ae1('0x53')]['id']}})['then'](handleEntityNotFound(_0x27cf18,null))[_0x7ae1('0x20')](saveUpdates(_0x3af1bf['body'],null))[_0x7ae1('0x20')](respondWithResult(_0x27cf18,null))[_0x7ae1('0x29')](handleError(_0x27cf18,null));};var utilLicense=require(_0x7ae1('0x5b'));exports[_0x7ae1('0x75')]=function(_0x5c7351,_0x14e0b5,_0x633a98){var _0x1c9066=_0x7ae1('0x5d');var _0x7c9fa5={'custom':![]};return utilLicense[_0x7ae1('0x5e')]()[_0x7ae1('0x20')](function(_0x53c5ee){if(_0x53c5ee){_0x7c9fa5=_0x53c5ee;}return db['Setting'][_0x7ae1('0x55')]({'where':{'id':_0x5c7351[_0x7ae1('0x53')]['id']},'attributes':[_0x7ae1('0x5f'),_0x7ae1('0x5a'),_0x7ae1('0x60'),_0x7ae1('0x61'),_0x7ae1('0x62'),_0x7ae1('0x63'),_0x7ae1('0x6f'),_0x7ae1('0x64')],'raw':!![]});})[_0x7ae1('0x20')](handleEntityNotFound(_0x14e0b5,null))[_0x7ae1('0x20')](function(_0x48cad5){if(_0x48cad5){var _0x1f5a72=_0x48cad5[_0x7ae1('0x60')]&&fs[_0x7ae1('0x65')](path['join'](config[_0x7ae1('0x68')],_0x1c9066,_[_0x7ae1('0x67')](_0x48cad5[_0x7ae1('0x60')])))?path['join'](config[_0x7ae1('0x68')],_0x1c9066,_[_0x7ae1('0x67')](_0x48cad5[_0x7ae1('0x60')])):path['join'](config[_0x7ae1('0x68')],_0x1c9066,_[_0x7ae1('0x67')](_0x7ae1('0x76')));var _0x187e7b=_0x7ae1('0x6a')+_['upperFirst']('preferred');if(_0x48cad5[_0x187e7b]||!_0x7c9fa5[_0x7ae1('0x77')]||!_0x7c9fa5[_0x7ae1('0x60')]){_0x1f5a72=path['join'](config[_0x7ae1('0x68')],_0x1c9066,_[_0x7ae1('0x67')]('default_preferred.png'));}if(!fs['existsSync'](_0x1f5a72)){throw new db[(_0x7ae1('0x6c'))]['ValidationError'](_[_0x7ae1('0x6b')](_0x7ae1('0x60'))+_0x7ae1('0x6d'));}return _0x14e0b5['download'](_0x1f5a72);}})[_0x7ae1('0x29')](handleError(_0x14e0b5,null));};exports['addFavicon']=function(_0x2173d3,_0x4317f8,_0x25f599){if(_0x2173d3[_0x7ae1('0x58')]&&_0x2173d3[_0x7ae1('0x58')][_0x7ae1('0x59')]){_0x2173d3[_0x7ae1('0x56')]['favicon']=_0x2173d3[_0x7ae1('0x58')][_0x7ae1('0x59')];}return db[_0x7ae1('0x3a')]['find']({'where':{'id':_0x2173d3[_0x7ae1('0x53')]['id']}})[_0x7ae1('0x20')](handleEntityNotFound(_0x4317f8,null))[_0x7ae1('0x20')](saveUpdates(_0x2173d3[_0x7ae1('0x56')],null))[_0x7ae1('0x20')](respondWithResult(_0x4317f8,null))[_0x7ae1('0x29')](handleError(_0x4317f8,null));};var utilLicense=require(_0x7ae1('0x5b'));exports[_0x7ae1('0x78')]=function(_0x127ba1,_0xa9e7cb,_0x1f6524){var _0x1b8d25='server/files/images/logos';var _0x542887={'custom':![]};return utilLicense['getLicense']()['then'](function(_0x2cff61){if(_0x2cff61){_0x542887=_0x2cff61;}return db[_0x7ae1('0x3a')][_0x7ae1('0x55')]({'where':{'id':_0x127ba1[_0x7ae1('0x53')]['id']},'attributes':[_0x7ae1('0x5f'),_0x7ae1('0x5a'),_0x7ae1('0x60'),_0x7ae1('0x61'),'defaultLogo',_0x7ae1('0x63'),'defaultPreferred','defaultFavicon'],'raw':!![]});})[_0x7ae1('0x20')](handleEntityNotFound(_0xa9e7cb,null))[_0x7ae1('0x20')](function(_0x4f80c7){if(_0x4f80c7){var _0x512e10=_0x4f80c7['favicon']&&fs[_0x7ae1('0x65')](path[_0x7ae1('0x66')](config[_0x7ae1('0x68')],_0x1b8d25,_[_0x7ae1('0x67')](_0x4f80c7['favicon'])))?path[_0x7ae1('0x66')](config[_0x7ae1('0x68')],_0x1b8d25,_[_0x7ae1('0x67')](_0x4f80c7['favicon'])):path[_0x7ae1('0x66')](config['root'],_0x1b8d25,_['toLower'](_0x7ae1('0x79')));var _0x56a2ff=_0x7ae1('0x6a')+_[_0x7ae1('0x6b')](_0x7ae1('0x61'));if(_0x4f80c7[_0x56a2ff]||!_0x542887['custom']){_0x512e10=path['join'](config[_0x7ae1('0x68')],_0x1b8d25,_[_0x7ae1('0x67')](_0x7ae1('0x79')));}if(!fs[_0x7ae1('0x65')](_0x512e10)){throw new db[(_0x7ae1('0x6c'))][(_0x7ae1('0x71'))](_[_0x7ae1('0x6b')](_0x7ae1('0x61'))+'\x20not\x20found');}return _0xa9e7cb['download'](_0x512e10);}})[_0x7ae1('0x29')](handleError(_0xa9e7cb,null));};exports[_0x7ae1('0x7a')]=function(_0x345532,_0x5117fe){var _0x21c05e={'offset':moment()['utcOffset']()};_0x21c05e['now']=moment()[_0x7ae1('0x7b')](_0x21c05e[_0x7ae1('0x2d')])[_0x7ae1('0x7c')](_0x7ae1('0x7d'));return _0x5117fe[_0x7ae1('0x2b')](0xc8)[_0x7ae1('0x38')](_0x21c05e);}; \ No newline at end of file +var _0xe3d7=['now','format','YYYY-MM-DD\x20HH:mm:ss:SSS','send','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Setting,\x20%s,\x20%s','result','catch','sendStatus','status','offset','undefined','count','limit','json','save','destroy','stack','name','index','map','Setting','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','include','rows','params','keys','update','body','find','filename','logo','file','addLogoLogin','loginLogo','getLogo','server/files/images/logos','getLicense','preferred','favicon','defaultLogo','defaultFavicon','join','root','toLower','default_logo.svg','default','upperFirst','custom','Sequelize','\x20not\x20found','download','getLogoLogin','defaultLoginLogo','existsSync','default_loginLogo.svg','gdpr','securePassword','addPreferred','getPreferred','default_preferred.png','addFavicon','getFavicon','defaultPreferred','default_favicon.ico','getDate','utcOffset'];(function(_0x2f9dae,_0xf0ac1d){var _0x5620ec=function(_0xf9846f){while(--_0xf9846f){_0x2f9dae['push'](_0x2f9dae['shift']());}};_0x5620ec(++_0xf0ac1d);}(_0xe3d7,0xf6));var _0x7e3d=function(_0x1314ba,_0x1cecc2){_0x1314ba=_0x1314ba-0x0;var _0x28de47=_0xe3d7[_0x1314ba];return _0x28de47;};'use strict';var emlformat=require(_0x7e3d('0x0'));var rimraf=require(_0x7e3d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7e3d('0x2'));var rp=require(_0x7e3d('0x3'));var moment=require('moment');var BPromise=require(_0x7e3d('0x4'));var Mustache=require(_0x7e3d('0x5'));var util=require(_0x7e3d('0x6'));var path=require(_0x7e3d('0x7'));var sox=require('sox');var csv=require(_0x7e3d('0x8'));var ejs=require(_0x7e3d('0x9'));var fs=require('fs');var fs_extra=require(_0x7e3d('0xa'));var _=require(_0x7e3d('0xb'));var squel=require(_0x7e3d('0xc'));var crypto=require(_0x7e3d('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x7e3d('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x7e3d('0xf'));var Redis=require(_0x7e3d('0x10'));var authService=require(_0x7e3d('0x11'));var qs=require(_0x7e3d('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7e3d('0x13'));var logger=require(_0x7e3d('0x14'))(_0x7e3d('0x15'));var utils=require(_0x7e3d('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x7e3d('0x17'));var db=require(_0x7e3d('0x18'))['db'];var jayson=require(_0x7e3d('0x19'));var client=jayson[_0x7e3d('0x1a')][_0x7e3d('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x141ea3,_0x310d11,_0x204420,_0x2a9fd8){return new BPromise(function(_0x5b40dc,_0x17bc0){var _0x651c2b=_0x2a9fd8||client;return _0x651c2b[_0x7e3d('0x1c')](_0x141ea3,_0x204420)[_0x7e3d('0x1d')](function(_0x203a2a){logger[_0x7e3d('0x1e')]('Setting,\x20%s,\x20%s',_0x310d11,_0x7e3d('0x1f'));logger[_0x7e3d('0x20')](_0x7e3d('0x21'),_0x310d11,_0x7e3d('0x1f'),JSON[_0x7e3d('0x22')](_0x203a2a));if(_0x203a2a[_0x7e3d('0x23')]){if(_0x203a2a[_0x7e3d('0x23')][_0x7e3d('0x24')]===0x1f4){logger[_0x7e3d('0x23')]('Setting,\x20%s,\x20%s',_0x310d11,_0x203a2a[_0x7e3d('0x23')][_0x7e3d('0x25')]);return _0x17bc0(_0x203a2a[_0x7e3d('0x23')][_0x7e3d('0x25')]);}logger['error'](_0x7e3d('0x26'),_0x310d11,_0x203a2a[_0x7e3d('0x23')][_0x7e3d('0x25')]);return _0x5b40dc(_0x203a2a[_0x7e3d('0x23')][_0x7e3d('0x25')]);}else{logger[_0x7e3d('0x1e')](_0x7e3d('0x26'),_0x310d11,_0x7e3d('0x1f'));_0x5b40dc(_0x203a2a[_0x7e3d('0x27')][_0x7e3d('0x25')]);}})[_0x7e3d('0x28')](function(_0x4c4a27){logger[_0x7e3d('0x23')](_0x7e3d('0x26'),_0x310d11,_0x4c4a27);_0x17bc0(_0x4c4a27);});});}function respondWithStatusCode(_0x32064b,_0xc159bf){_0xc159bf=_0xc159bf||0xcc;return function(_0x36becd){if(_0x36becd){return _0x32064b[_0x7e3d('0x29')](_0xc159bf);}return _0x32064b[_0x7e3d('0x2a')](_0xc159bf)['end']();};}function respondWithResult(_0x3b775b,_0x5a60fa){_0x5a60fa=_0x5a60fa||0xc8;return function(_0x22935f){if(_0x22935f){return _0x3b775b['status'](_0x5a60fa)['json'](_0x22935f);}};}function respondWithFilteredResult(_0x37ccd1,_0x6baff5){return function(_0x2197a0){if(_0x2197a0){var _0xf4111e=typeof _0x6baff5[_0x7e3d('0x2b')]===_0x7e3d('0x2c')&&typeof _0x6baff5['limit']===_0x7e3d('0x2c');var _0x4825c3=_0x2197a0[_0x7e3d('0x2d')];var _0x5c2874=_0xf4111e?0x0:_0x6baff5[_0x7e3d('0x2b')];var _0x2b7ce4=_0xf4111e?_0x2197a0[_0x7e3d('0x2d')]:_0x6baff5[_0x7e3d('0x2b')]+_0x6baff5[_0x7e3d('0x2e')];var _0x4261be;if(_0x2b7ce4>=_0x4825c3){_0x2b7ce4=_0x4825c3;_0x4261be=0xc8;}else{_0x4261be=0xce;}_0x37ccd1[_0x7e3d('0x2a')](_0x4261be);return _0x37ccd1['set']('Content-Range',_0x5c2874+'-'+_0x2b7ce4+'/'+_0x4825c3)[_0x7e3d('0x2f')](_0x2197a0);}return null;};}function patchUpdates(_0x25fa96){return function(_0xc8b75f){try{jsonpatch['apply'](_0xc8b75f,_0x25fa96,!![]);}catch(_0x353dad){return BPromise['reject'](_0x353dad);}return _0xc8b75f[_0x7e3d('0x30')]();};}function saveUpdates(_0x41b659,_0x22106f){return function(_0x24e260){if(_0x24e260){return _0x24e260['update'](_0x41b659)[_0x7e3d('0x1d')](function(_0x5ca784){return _0x5ca784;});}return null;};}function removeEntity(_0x494e5b,_0x40191d){return function(_0x142de4){if(_0x142de4){return _0x142de4[_0x7e3d('0x31')]()['then'](function(){_0x494e5b[_0x7e3d('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x45ffc3,_0x28399c){return function(_0x40c2e3){if(!_0x40c2e3){_0x45ffc3[_0x7e3d('0x29')](0x194);}return _0x40c2e3;};}function handleError(_0x1b5a6e,_0x123456){_0x123456=_0x123456||0x1f4;return function(_0x35b614){logger[_0x7e3d('0x23')](_0x35b614[_0x7e3d('0x32')]);if(_0x35b614[_0x7e3d('0x33')]){delete _0x35b614['name'];}_0x1b5a6e['status'](_0x123456)['send'](_0x35b614);};}exports[_0x7e3d('0x34')]=function(_0x116d25,_0x6702d9){var _0x1cf297={},_0x172f67={},_0x37f50d={'count':0x0,'rows':[]};var _0x2553c9=_[_0x7e3d('0x35')](db[_0x7e3d('0x36')][_0x7e3d('0x37')],function(_0x22ca2b){return{'name':_0x22ca2b['fieldName'],'type':_0x22ca2b[_0x7e3d('0x38')][_0x7e3d('0x39')]};});_0x172f67[_0x7e3d('0x3a')]=_[_0x7e3d('0x35')](_0x2553c9,_0x7e3d('0x33'));_0x172f67['query']=_['keys'](_0x116d25[_0x7e3d('0x3b')]);_0x172f67[_0x7e3d('0x3c')]=_[_0x7e3d('0x3d')](_0x172f67[_0x7e3d('0x3a')],_0x172f67[_0x7e3d('0x3b')]);_0x1cf297[_0x7e3d('0x3e')]=_[_0x7e3d('0x3d')](_0x172f67[_0x7e3d('0x3a')],qs[_0x7e3d('0x3f')](_0x116d25['query'][_0x7e3d('0x3f')]));_0x1cf297[_0x7e3d('0x3e')]=_0x1cf297[_0x7e3d('0x3e')][_0x7e3d('0x40')]?_0x1cf297[_0x7e3d('0x3e')]:_0x172f67[_0x7e3d('0x3a')];if(!_0x116d25[_0x7e3d('0x3b')]['hasOwnProperty'](_0x7e3d('0x41'))){_0x1cf297['limit']=qs[_0x7e3d('0x2e')](_0x116d25[_0x7e3d('0x3b')][_0x7e3d('0x2e')]);_0x1cf297[_0x7e3d('0x2b')]=qs[_0x7e3d('0x2b')](_0x116d25[_0x7e3d('0x3b')][_0x7e3d('0x2b')]);}_0x1cf297[_0x7e3d('0x42')]=qs[_0x7e3d('0x43')](_0x116d25[_0x7e3d('0x3b')]['sort']);_0x1cf297[_0x7e3d('0x44')]=qs['filters'](_[_0x7e3d('0x45')](_0x116d25[_0x7e3d('0x3b')],_0x172f67[_0x7e3d('0x3c')]),_0x2553c9);if(_0x116d25[_0x7e3d('0x3b')][_0x7e3d('0x46')]){_0x1cf297[_0x7e3d('0x44')]=_[_0x7e3d('0x47')](_0x1cf297[_0x7e3d('0x44')],{'$or':_[_0x7e3d('0x35')](_0x2553c9,function(_0x206338){if(_0x206338[_0x7e3d('0x38')]!==_0x7e3d('0x48')){var _0x3242b2={};_0x3242b2[_0x206338['name']]={'$like':'%'+_0x116d25['query'][_0x7e3d('0x46')]+'%'};return _0x3242b2;}})});}_0x1cf297=_[_0x7e3d('0x47')]({},_0x1cf297,_0x116d25['options']);var _0x4be941={'where':_0x1cf297[_0x7e3d('0x44')]};return db[_0x7e3d('0x36')][_0x7e3d('0x2d')](_0x4be941)['then'](function(_0x10a977){_0x37f50d[_0x7e3d('0x2d')]=_0x10a977;if(_0x116d25['query']['includeAll']){_0x1cf297[_0x7e3d('0x49')]=[{'all':!![]}];}return db[_0x7e3d('0x36')]['findAll'](_0x1cf297);})[_0x7e3d('0x1d')](function(_0xa4e1d5){_0x37f50d[_0x7e3d('0x4a')]=_0xa4e1d5;return _0x37f50d;})[_0x7e3d('0x1d')](respondWithFilteredResult(_0x6702d9,_0x1cf297))['catch'](handleError(_0x6702d9,null));};exports['show']=function(_0x1be6bd,_0x2f6472){var _0x55c266={'raw':![],'where':{'id':_0x1be6bd[_0x7e3d('0x4b')]['id']}},_0x48bf9a={};_0x48bf9a[_0x7e3d('0x3a')]=_[_0x7e3d('0x4c')](db[_0x7e3d('0x36')]['rawAttributes']);_0x48bf9a['query']=_[_0x7e3d('0x4c')](_0x1be6bd[_0x7e3d('0x3b')]);_0x48bf9a[_0x7e3d('0x3c')]=_[_0x7e3d('0x3d')](_0x48bf9a[_0x7e3d('0x3a')],_0x48bf9a[_0x7e3d('0x3b')]);_0x55c266[_0x7e3d('0x3e')]=_[_0x7e3d('0x3d')](_0x48bf9a['model'],qs[_0x7e3d('0x3f')](_0x1be6bd[_0x7e3d('0x3b')][_0x7e3d('0x3f')]));_0x55c266[_0x7e3d('0x3e')]=_0x55c266[_0x7e3d('0x3e')][_0x7e3d('0x40')]?_0x55c266[_0x7e3d('0x3e')]:_0x48bf9a['model'];if(_0x1be6bd[_0x7e3d('0x3b')]['includeAll']){_0x55c266[_0x7e3d('0x49')]=[{'all':!![]}];}_0x55c266=_[_0x7e3d('0x47')]({},_0x55c266,_0x1be6bd['options']);return db[_0x7e3d('0x36')]['find'](_0x55c266)[_0x7e3d('0x1d')](handleEntityNotFound(_0x2f6472,null))[_0x7e3d('0x1d')](respondWithResult(_0x2f6472,null))[_0x7e3d('0x28')](handleError(_0x2f6472,null));};exports[_0x7e3d('0x4d')]=function(_0x5d1420,_0x1667d2){if(_0x5d1420['body']['id']){delete _0x5d1420[_0x7e3d('0x4e')]['id'];}return db[_0x7e3d('0x36')][_0x7e3d('0x4f')]({'where':{'id':_0x5d1420['params']['id']}})[_0x7e3d('0x1d')](handleEntityNotFound(_0x1667d2,null))[_0x7e3d('0x1d')](saveUpdates(_0x5d1420[_0x7e3d('0x4e')],null))[_0x7e3d('0x1d')](respondWithResult(_0x1667d2,null))[_0x7e3d('0x28')](handleError(_0x1667d2,null));};exports['addLogo']=function(_0x47c3ff,_0xf5a1e1,_0x4b6835){if(_0x47c3ff['file']&&_0x47c3ff['file'][_0x7e3d('0x50')]){_0x47c3ff[_0x7e3d('0x4e')][_0x7e3d('0x51')]=_0x47c3ff[_0x7e3d('0x52')][_0x7e3d('0x50')];}return db[_0x7e3d('0x36')]['find']({'where':{'id':_0x47c3ff[_0x7e3d('0x4b')]['id']}})[_0x7e3d('0x1d')](handleEntityNotFound(_0xf5a1e1,null))[_0x7e3d('0x1d')](saveUpdates(_0x47c3ff['body'],null))[_0x7e3d('0x1d')](respondWithResult(_0xf5a1e1,null))[_0x7e3d('0x28')](handleError(_0xf5a1e1,null));};exports[_0x7e3d('0x53')]=function(_0x1b9f6e,_0x16f964,_0x7a657b){if(_0x1b9f6e[_0x7e3d('0x52')]&&_0x1b9f6e['file'][_0x7e3d('0x50')]){_0x1b9f6e['body'][_0x7e3d('0x54')]=_0x1b9f6e[_0x7e3d('0x52')][_0x7e3d('0x50')];}return db[_0x7e3d('0x36')]['find']({'where':{'id':_0x1b9f6e['params']['id']}})[_0x7e3d('0x1d')](handleEntityNotFound(_0x16f964,null))[_0x7e3d('0x1d')](saveUpdates(_0x1b9f6e['body'],null))[_0x7e3d('0x1d')](respondWithResult(_0x16f964,null))['catch'](handleError(_0x16f964,null));};var utilLicense=require(_0x7e3d('0x17'));exports[_0x7e3d('0x55')]=function(_0x37e701,_0x145db3,_0x2c05e8){var _0x89f520=_0x7e3d('0x56');var _0x570872={'custom':![]};return utilLicense[_0x7e3d('0x57')]()['then'](function(_0x546fe2){if(_0x546fe2){_0x570872=_0x546fe2;}return db[_0x7e3d('0x36')][_0x7e3d('0x4f')]({'where':{'id':_0x37e701[_0x7e3d('0x4b')]['id']},'attributes':['logo','loginLogo',_0x7e3d('0x58'),_0x7e3d('0x59'),_0x7e3d('0x5a'),'defaultLoginLogo','defaultPreferred',_0x7e3d('0x5b')],'raw':!![]});})['then'](handleEntityNotFound(_0x145db3,null))[_0x7e3d('0x1d')](function(_0x43be07){if(_0x43be07){var _0xb88047=_0x43be07[_0x7e3d('0x51')]&&fs['existsSync'](path[_0x7e3d('0x5c')](config[_0x7e3d('0x5d')],_0x89f520,_[_0x7e3d('0x5e')](_0x43be07[_0x7e3d('0x51')])))?path['join'](config['root'],_0x89f520,_[_0x7e3d('0x5e')](_0x43be07['logo'])):path[_0x7e3d('0x5c')](config[_0x7e3d('0x5d')],_0x89f520,_[_0x7e3d('0x5e')](_0x7e3d('0x5f')));var _0x5a050e=_0x7e3d('0x60')+_[_0x7e3d('0x61')](_0x7e3d('0x51'));if(_0x43be07[_0x5a050e]||!_0x570872[_0x7e3d('0x62')]){_0xb88047=path[_0x7e3d('0x5c')](config[_0x7e3d('0x5d')],_0x89f520,_[_0x7e3d('0x5e')]('default_logo.svg'));}if(!fs['existsSync'](_0xb88047)){throw new db[(_0x7e3d('0x63'))]['ValidationError'](_[_0x7e3d('0x61')]('logo')+_0x7e3d('0x64'));}return _0x145db3[_0x7e3d('0x65')](_0xb88047);}})[_0x7e3d('0x28')](handleError(_0x145db3,null));};var utilLicense=require(_0x7e3d('0x17'));exports[_0x7e3d('0x66')]=function(_0x3b0de5,_0x2acaef,_0x408f50){var _0x40a2b4='server/files/images/logos';var _0x435c4d={'custom':![]};return utilLicense[_0x7e3d('0x57')]()[_0x7e3d('0x1d')](function(_0x208b86){if(_0x208b86){_0x435c4d=_0x208b86;}return db[_0x7e3d('0x36')][_0x7e3d('0x4f')]({'where':{'id':_0x3b0de5[_0x7e3d('0x4b')]['id']},'attributes':[_0x7e3d('0x51'),_0x7e3d('0x54'),_0x7e3d('0x58'),_0x7e3d('0x59'),'defaultLogo',_0x7e3d('0x67'),'defaultPreferred',_0x7e3d('0x5b')],'raw':!![]});})[_0x7e3d('0x1d')](handleEntityNotFound(_0x2acaef,null))[_0x7e3d('0x1d')](function(_0x22de06){if(_0x22de06){var _0x38b984=_0x22de06[_0x7e3d('0x54')]&&fs[_0x7e3d('0x68')](path[_0x7e3d('0x5c')](config[_0x7e3d('0x5d')],_0x40a2b4,_[_0x7e3d('0x5e')](_0x22de06[_0x7e3d('0x54')])))?path[_0x7e3d('0x5c')](config[_0x7e3d('0x5d')],_0x40a2b4,_['toLower'](_0x22de06[_0x7e3d('0x54')])):path[_0x7e3d('0x5c')](config['root'],_0x40a2b4,_[_0x7e3d('0x5e')](_0x7e3d('0x69')));var _0x4da6eb=_0x7e3d('0x60')+_['upperFirst'](_0x7e3d('0x54'));if(_0x22de06[_0x4da6eb]||!_0x435c4d[_0x7e3d('0x62')]){_0x38b984=path[_0x7e3d('0x5c')](config['root'],_0x40a2b4,_[_0x7e3d('0x5e')](_0x7e3d('0x69')));}if(!fs['existsSync'](_0x38b984)){throw new db['Sequelize']['ValidationError'](_[_0x7e3d('0x61')](_0x7e3d('0x54'))+_0x7e3d('0x64'));}return _0x2acaef['download'](_0x38b984);}})[_0x7e3d('0x28')](handleError(_0x2acaef,null));};exports[_0x7e3d('0x6a')]=function(_0x3e57ec,_0x832d8){return db[_0x7e3d('0x36')][_0x7e3d('0x4f')]({'where':{'id':_0x3e57ec[_0x7e3d('0x4b')]['id']},'attributes':[_0x7e3d('0x6b')]})[_0x7e3d('0x1d')](respondWithResult(_0x832d8,null))[_0x7e3d('0x28')](handleError(_0x832d8,null));};exports[_0x7e3d('0x6c')]=function(_0x4e56a6,_0x3fdee9,_0x58c362){if(_0x4e56a6[_0x7e3d('0x52')]&&_0x4e56a6[_0x7e3d('0x52')][_0x7e3d('0x50')]){_0x4e56a6[_0x7e3d('0x4e')][_0x7e3d('0x58')]=_0x4e56a6[_0x7e3d('0x52')][_0x7e3d('0x50')];}return db[_0x7e3d('0x36')]['find']({'where':{'id':_0x4e56a6[_0x7e3d('0x4b')]['id']}})[_0x7e3d('0x1d')](handleEntityNotFound(_0x3fdee9,null))[_0x7e3d('0x1d')](saveUpdates(_0x4e56a6[_0x7e3d('0x4e')],null))[_0x7e3d('0x1d')](respondWithResult(_0x3fdee9,null))[_0x7e3d('0x28')](handleError(_0x3fdee9,null));};var utilLicense=require(_0x7e3d('0x17'));exports[_0x7e3d('0x6d')]=function(_0x250c5a,_0x2e54ad,_0x10a848){var _0x15b39f=_0x7e3d('0x56');var _0x5b1fba={'custom':![]};return utilLicense[_0x7e3d('0x57')]()['then'](function(_0xd7db84){if(_0xd7db84){_0x5b1fba=_0xd7db84;}return db[_0x7e3d('0x36')]['find']({'where':{'id':_0x250c5a['params']['id']},'attributes':[_0x7e3d('0x51'),_0x7e3d('0x54'),_0x7e3d('0x58'),_0x7e3d('0x59'),_0x7e3d('0x5a'),_0x7e3d('0x67'),'defaultPreferred',_0x7e3d('0x5b')],'raw':!![]});})['then'](handleEntityNotFound(_0x2e54ad,null))[_0x7e3d('0x1d')](function(_0x4f5802){if(_0x4f5802){var _0x562799=_0x4f5802[_0x7e3d('0x58')]&&fs[_0x7e3d('0x68')](path[_0x7e3d('0x5c')](config[_0x7e3d('0x5d')],_0x15b39f,_[_0x7e3d('0x5e')](_0x4f5802[_0x7e3d('0x58')])))?path[_0x7e3d('0x5c')](config['root'],_0x15b39f,_[_0x7e3d('0x5e')](_0x4f5802['preferred'])):path[_0x7e3d('0x5c')](config[_0x7e3d('0x5d')],_0x15b39f,_[_0x7e3d('0x5e')](_0x7e3d('0x6e')));var _0xbbd153=_0x7e3d('0x60')+_[_0x7e3d('0x61')]('preferred');if(_0x4f5802[_0xbbd153]||!_0x5b1fba[_0x7e3d('0x62')]||!_0x5b1fba[_0x7e3d('0x58')]){_0x562799=path['join'](config[_0x7e3d('0x5d')],_0x15b39f,_[_0x7e3d('0x5e')](_0x7e3d('0x6e')));}if(!fs[_0x7e3d('0x68')](_0x562799)){throw new db[(_0x7e3d('0x63'))]['ValidationError'](_[_0x7e3d('0x61')]('preferred')+'\x20not\x20found');}return _0x2e54ad[_0x7e3d('0x65')](_0x562799);}})[_0x7e3d('0x28')](handleError(_0x2e54ad,null));};exports[_0x7e3d('0x6f')]=function(_0x2ecf92,_0xcb6d8d,_0x24a2b9){if(_0x2ecf92[_0x7e3d('0x52')]&&_0x2ecf92[_0x7e3d('0x52')][_0x7e3d('0x50')]){_0x2ecf92[_0x7e3d('0x4e')][_0x7e3d('0x59')]=_0x2ecf92['file'][_0x7e3d('0x50')];}return db['Setting'][_0x7e3d('0x4f')]({'where':{'id':_0x2ecf92[_0x7e3d('0x4b')]['id']}})[_0x7e3d('0x1d')](handleEntityNotFound(_0xcb6d8d,null))[_0x7e3d('0x1d')](saveUpdates(_0x2ecf92['body'],null))[_0x7e3d('0x1d')](respondWithResult(_0xcb6d8d,null))[_0x7e3d('0x28')](handleError(_0xcb6d8d,null));};var utilLicense=require('../../config/license/util');exports[_0x7e3d('0x70')]=function(_0x9eaf76,_0x245062,_0x34ef69){var _0x19ff4f='server/files/images/logos';var _0xe8ec74={'custom':![]};return utilLicense[_0x7e3d('0x57')]()[_0x7e3d('0x1d')](function(_0x415343){if(_0x415343){_0xe8ec74=_0x415343;}return db[_0x7e3d('0x36')][_0x7e3d('0x4f')]({'where':{'id':_0x9eaf76['params']['id']},'attributes':[_0x7e3d('0x51'),'loginLogo','preferred','favicon',_0x7e3d('0x5a'),'defaultLoginLogo',_0x7e3d('0x71'),_0x7e3d('0x5b')],'raw':!![]});})['then'](handleEntityNotFound(_0x245062,null))[_0x7e3d('0x1d')](function(_0x3d7fd4){if(_0x3d7fd4){var _0x30ab21=_0x3d7fd4[_0x7e3d('0x59')]&&fs[_0x7e3d('0x68')](path[_0x7e3d('0x5c')](config[_0x7e3d('0x5d')],_0x19ff4f,_[_0x7e3d('0x5e')](_0x3d7fd4[_0x7e3d('0x59')])))?path['join'](config[_0x7e3d('0x5d')],_0x19ff4f,_[_0x7e3d('0x5e')](_0x3d7fd4['favicon'])):path[_0x7e3d('0x5c')](config['root'],_0x19ff4f,_['toLower'](_0x7e3d('0x72')));var _0x2e942c=_0x7e3d('0x60')+_[_0x7e3d('0x61')](_0x7e3d('0x59'));if(_0x3d7fd4[_0x2e942c]||!_0xe8ec74['custom']){_0x30ab21=path[_0x7e3d('0x5c')](config[_0x7e3d('0x5d')],_0x19ff4f,_[_0x7e3d('0x5e')](_0x7e3d('0x72')));}if(!fs[_0x7e3d('0x68')](_0x30ab21)){throw new db[(_0x7e3d('0x63'))]['ValidationError'](_['upperFirst']('favicon')+'\x20not\x20found');}return _0x245062[_0x7e3d('0x65')](_0x30ab21);}})['catch'](handleError(_0x245062,null));};exports[_0x7e3d('0x73')]=function(_0x461b43,_0x4a94bc){var _0x24db60={'offset':moment()[_0x7e3d('0x74')]()};_0x24db60[_0x7e3d('0x75')]=moment()[_0x7e3d('0x74')](_0x24db60[_0x7e3d('0x2b')])[_0x7e3d('0x76')](_0x7e3d('0x77'));return _0x4a94bc['status'](0xc8)[_0x7e3d('0x78')](_0x24db60);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index a5339f8..6ef9a3b 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 _0x008c=['define','settings','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./setting.attributes','exports'];(function(_0x435dde,_0x2a2fa3){var _0x4aca2d=function(_0x283a96){while(--_0x283a96){_0x435dde['push'](_0x435dde['shift']());}};_0x4aca2d(++_0x2a2fa3);}(_0x008c,0x188));var _0xc008=function(_0x299d27,_0x4cbc19){_0x299d27=_0x299d27-0x0;var _0x5692a1=_0x008c[_0x299d27];return _0x5692a1;};'use strict';var _=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var logger=require(_0xc008('0x2'))(_0xc008('0x3'));var moment=require(_0xc008('0x4'));var BPromise=require('bluebird');var rp=require(_0xc008('0x5'));var fs=require('fs');var path=require(_0xc008('0x6'));var rimraf=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var attributes=require(_0xc008('0x9'));module[_0xc008('0xa')]=function(_0x13aa7,_0x39bb5e){return _0x13aa7[_0xc008('0xb')]('Setting',attributes,{'tableName':_0xc008('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe14b=['bluebird','path','./setting.attributes','exports','define','Setting','settings','lodash','util','moment'];(function(_0x189b49,_0x3e21bc){var _0x383b5a=function(_0x4be839){while(--_0x4be839){_0x189b49['push'](_0x189b49['shift']());}};_0x383b5a(++_0x3e21bc);}(_0xe14b,0x93));var _0xbe14=function(_0x1522ff,_0x301b07){_0x1522ff=_0x1522ff-0x0;var _0x17c60a=_0xe14b[_0x1522ff];return _0x17c60a;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xbe14('0x2'));var BPromise=require(_0xbe14('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbe14('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xbe14('0x5'));module[_0xbe14('0x6')]=function(_0x1fe204,_0x1ff100){return _0x1fe204[_0xbe14('0x7')](_0xbe14('0x8'),attributes,{'tableName':_0xbe14('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index 72da534..234319e 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 _0x8db7=['randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','Setting,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','ShowSetting','Setting','options','raw','where','attributes','include','model','map','util','moment'];(function(_0x4a47a9,_0x4ae30e){var _0x58c4a6=function(_0x4c2acc){while(--_0x4c2acc){_0x4a47a9['push'](_0x4a47a9['shift']());}};_0x58c4a6(++_0x4ae30e);}(_0x8db7,0x184));var _0x78db=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x8db7[_0x122ef9];return _0x42fba0;};'use strict';var _=require('lodash');var util=require(_0x78db('0x0'));var moment=require(_0x78db('0x1'));var BPromise=require('bluebird');var rs=require(_0x78db('0x2'));var fs=require('fs');var Redis=require(_0x78db('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x78db('0x4'));var logger=require(_0x78db('0x5'))(_0x78db('0x6'));var config=require(_0x78db('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x78db('0x8')][_0x78db('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2cb258,_0x5bc0a2,_0x3a4d1b){return new BPromise(function(_0x8ed2a7,_0x32a0e1){return client['request'](_0x2cb258,_0x3a4d1b)[_0x78db('0xa')](function(_0x14b3e0){logger[_0x78db('0xb')](_0x78db('0xc'),_0x5bc0a2,'request\x20sent');logger[_0x78db('0xd')]('Setting,\x20%s,\x20%s,\x20%s',_0x5bc0a2,_0x78db('0xe'),JSON[_0x78db('0xf')](_0x14b3e0));if(_0x14b3e0[_0x78db('0x10')]){if(_0x14b3e0[_0x78db('0x10')][_0x78db('0x11')]===0x1f4){logger['error'](_0x78db('0xc'),_0x5bc0a2,_0x14b3e0['error'][_0x78db('0x12')]);return _0x32a0e1(_0x14b3e0['error'][_0x78db('0x12')]);}logger['error'](_0x78db('0xc'),_0x5bc0a2,_0x14b3e0[_0x78db('0x10')][_0x78db('0x12')]);return _0x8ed2a7(_0x14b3e0['error'][_0x78db('0x12')]);}else{logger[_0x78db('0xb')](_0x78db('0xc'),_0x5bc0a2,_0x78db('0xe'));_0x8ed2a7(_0x14b3e0[_0x78db('0x13')]['message']);}})[_0x78db('0x14')](function(_0x10c3e5){logger[_0x78db('0x10')](_0x78db('0xc'),_0x5bc0a2,_0x10c3e5);_0x32a0e1(_0x10c3e5);});});}exports[_0x78db('0x15')]=function(_0x1a84c3){var _0x38348a=this;return new Promise(function(_0x4b17b9,_0x205e08){return db[_0x78db('0x16')]['find']({'raw':_0x1a84c3[_0x78db('0x17')]?_0x1a84c3[_0x78db('0x17')][_0x78db('0x18')]===undefined?!![]:![]:!![],'where':_0x1a84c3[_0x78db('0x17')]?_0x1a84c3[_0x78db('0x17')][_0x78db('0x19')]||null:null,'attributes':_0x1a84c3['options']?_0x1a84c3[_0x78db('0x17')][_0x78db('0x1a')]||null:null,'include':_0x1a84c3[_0x78db('0x17')]?_0x1a84c3[_0x78db('0x17')][_0x78db('0x1b')]?_['map'](_0x1a84c3['options']['include'],function(_0x4bb764){return{'model':db[_0x4bb764[_0x78db('0x1c')]],'as':_0x4bb764['as'],'attributes':_0x4bb764['attributes'],'include':_0x4bb764[_0x78db('0x1b')]?_[_0x78db('0x1d')](_0x4bb764['include'],function(_0x4b069f){return{'model':db[_0x4b069f['model']],'as':_0x4b069f['as'],'attributes':_0x4b069f[_0x78db('0x1a')],'include':_0x4b069f['include']?_[_0x78db('0x1d')](_0x4b069f['include'],function(_0x43d14d){return{'model':db[_0x43d14d[_0x78db('0x1c')]],'as':_0x43d14d['as'],'attributes':_0x43d14d[_0x78db('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x219572){logger['info']('ShowSetting',_0x1a84c3);logger['debug'](_0x78db('0x15'),_0x1a84c3,JSON['stringify'](_0x219572));_0x4b17b9(_0x219572);})[_0x78db('0x14')](function(_0x303770){logger[_0x78db('0x10')](_0x78db('0x15'),_0x303770[_0x78db('0x12')],_0x1a84c3);_0x205e08(_0x38348a[_0x78db('0x10')](0x1f4,_0x303770[_0x78db('0x12')]));});});}; \ No newline at end of file +var _0x2564=['Setting,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','Setting','find','options','raw','where','include','map','model','attributes','ShowSetting','catch','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info'];(function(_0x3cce9a,_0x45caf2){var _0x269399=function(_0x2ce821){while(--_0x2ce821){_0x3cce9a['push'](_0x3cce9a['shift']());}};_0x269399(++_0x45caf2);}(_0x2564,0x173));var _0x4256=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x2564[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4256('0x0'));var BPromise=require(_0x4256('0x1'));var rs=require(_0x4256('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4256('0x3'))['db'];var utils=require(_0x4256('0x4'));var logger=require(_0x4256('0x5'))(_0x4256('0x6'));var config=require(_0x4256('0x7'));var jayson=require(_0x4256('0x8'));var client=jayson[_0x4256('0x9')][_0x4256('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x276f37,_0x4e347b,_0x4c17eb){return new BPromise(function(_0x261e76,_0x55a537){return client['request'](_0x276f37,_0x4c17eb)[_0x4256('0xb')](function(_0xddd849){logger[_0x4256('0xc')](_0x4256('0xd'),_0x4e347b,_0x4256('0xe'));logger[_0x4256('0xf')]('Setting,\x20%s,\x20%s,\x20%s',_0x4e347b,_0x4256('0xe'),JSON[_0x4256('0x10')](_0xddd849));if(_0xddd849['error']){if(_0xddd849[_0x4256('0x11')][_0x4256('0x12')]===0x1f4){logger[_0x4256('0x11')](_0x4256('0xd'),_0x4e347b,_0xddd849[_0x4256('0x11')][_0x4256('0x13')]);return _0x55a537(_0xddd849[_0x4256('0x11')][_0x4256('0x13')]);}logger['error'](_0x4256('0xd'),_0x4e347b,_0xddd849['error'][_0x4256('0x13')]);return _0x261e76(_0xddd849[_0x4256('0x11')][_0x4256('0x13')]);}else{logger[_0x4256('0xc')]('Setting,\x20%s,\x20%s',_0x4e347b,_0x4256('0xe'));_0x261e76(_0xddd849[_0x4256('0x14')][_0x4256('0x13')]);}})['catch'](function(_0x25b3e7){logger['error'](_0x4256('0xd'),_0x4e347b,_0x25b3e7);_0x55a537(_0x25b3e7);});});}exports['ShowSetting']=function(_0x54d334){var _0x5b1723=this;return new Promise(function(_0x1c8131,_0x40e16c){return db[_0x4256('0x15')][_0x4256('0x16')]({'raw':_0x54d334[_0x4256('0x17')]?_0x54d334[_0x4256('0x17')][_0x4256('0x18')]===undefined?!![]:![]:!![],'where':_0x54d334[_0x4256('0x17')]?_0x54d334['options'][_0x4256('0x19')]||null:null,'attributes':_0x54d334['options']?_0x54d334['options']['attributes']||null:null,'include':_0x54d334[_0x4256('0x17')]?_0x54d334[_0x4256('0x17')][_0x4256('0x1a')]?_[_0x4256('0x1b')](_0x54d334[_0x4256('0x17')][_0x4256('0x1a')],function(_0x4b786f){return{'model':db[_0x4b786f[_0x4256('0x1c')]],'as':_0x4b786f['as'],'attributes':_0x4b786f[_0x4256('0x1d')],'include':_0x4b786f[_0x4256('0x1a')]?_['map'](_0x4b786f[_0x4256('0x1a')],function(_0x70bca6){return{'model':db[_0x70bca6[_0x4256('0x1c')]],'as':_0x70bca6['as'],'attributes':_0x70bca6[_0x4256('0x1d')],'include':_0x70bca6['include']?_[_0x4256('0x1b')](_0x70bca6[_0x4256('0x1a')],function(_0x595de9){return{'model':db[_0x595de9[_0x4256('0x1c')]],'as':_0x595de9['as'],'attributes':_0x595de9[_0x4256('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x4256('0xb')](function(_0x1b6000){logger[_0x4256('0xc')]('ShowSetting',_0x54d334);logger[_0x4256('0xf')](_0x4256('0x1e'),_0x54d334,JSON[_0x4256('0x10')](_0x1b6000));_0x1c8131(_0x1b6000);})[_0x4256('0x1f')](function(_0x553ce8){logger['error'](_0x4256('0x1e'),_0x553ce8[_0x4256('0x13')],_0x54d334);_0x40e16c(_0x5b1723[_0x4256('0x11')](0x1f4,_0x553ce8[_0x4256('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index 6891788..ed91cef 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 _0xabce=['/:id/users','getAgents','create','post','addAnswer','/:id/notify','notify','/:id/send','send','status','addAgents','put','update','delete','/:id','destroy','removeDispositions','removeAnswers','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/status'];(function(_0x1537b6,_0x3fb6e4){var _0x520751=function(_0x58144d){while(--_0x58144d){_0x1537b6['push'](_0x1537b6['shift']());}};_0x520751(++_0x3fb6e4);}(_0xabce,0x103));var _0xeabc=function(_0x3635ce,_0x33a6f9){_0x3635ce=_0x3635ce-0x0;var _0x97ecd0=_0xabce[_0x3635ce];return _0x97ecd0;};'use strict';var multer=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var path=require(_0xeabc('0x2'));var timeout=require(_0xeabc('0x3'));var express=require(_0xeabc('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xeabc('0x5'));var interaction=require(_0xeabc('0x6'));var config=require(_0xeabc('0x7'));var controller=require('./smsAccount.controller');router['get']('/',auth[_0xeabc('0x8')](),controller['index']);router[_0xeabc('0x9')]('/describe',auth[_0xeabc('0x8')](),controller[_0xeabc('0xa')]);router[_0xeabc('0x9')]('/:id',auth[_0xeabc('0x8')](),controller[_0xeabc('0xb')]);router[_0xeabc('0x9')](_0xeabc('0xc'),auth[_0xeabc('0x8')](),controller[_0xeabc('0xd')]);router[_0xeabc('0x9')](_0xeabc('0xe'),auth[_0xeabc('0x8')](),controller[_0xeabc('0xf')]);router[_0xeabc('0x9')](_0xeabc('0x10'),auth[_0xeabc('0x8')](),controller[_0xeabc('0x11')]);router[_0xeabc('0x9')](_0xeabc('0x12'),auth['isAuthenticated'](),controller[_0xeabc('0x13')]);router[_0xeabc('0x9')](_0xeabc('0x14'),controller['statusGet']);router['get'](_0xeabc('0x15'),auth[_0xeabc('0x8')](),controller[_0xeabc('0x16')]);router['post']('/',auth[_0xeabc('0x8')](),controller[_0xeabc('0x17')]);router['post']('/:id/dispositions',auth[_0xeabc('0x8')](),controller['addDisposition']);router[_0xeabc('0x18')](_0xeabc('0xe'),auth[_0xeabc('0x8')](),controller[_0xeabc('0x19')]);router[_0xeabc('0x18')](_0xeabc('0x1a'),controller[_0xeabc('0x1b')]);router[_0xeabc('0x18')]('/:id/applications',auth[_0xeabc('0x8')](),controller['addApplications']);router[_0xeabc('0x18')](_0xeabc('0x1c'),auth['isAuthenticated'](),controller[_0xeabc('0x1d')]);router[_0xeabc('0x18')](_0xeabc('0x14'),controller[_0xeabc('0x1e')]);router[_0xeabc('0x18')]('/:id/users',auth[_0xeabc('0x8')](),controller[_0xeabc('0x1f')]);router[_0xeabc('0x20')]('/:id',auth[_0xeabc('0x8')](),controller[_0xeabc('0x21')]);router[_0xeabc('0x22')](_0xeabc('0x23'),auth['isAuthenticated'](),controller[_0xeabc('0x24')]);router['delete'](_0xeabc('0xc'),auth['isAuthenticated'](),controller[_0xeabc('0x25')]);router[_0xeabc('0x22')](_0xeabc('0xe'),auth[_0xeabc('0x8')](),controller[_0xeabc('0x26')]);router[_0xeabc('0x22')](_0xeabc('0x15'),auth['isAuthenticated'](),controller['removeAgents']);module[_0xeabc('0x27')]=router; \ No newline at end of file +var _0x5fc3=['/:id','show','getDispositions','/:id/canned_answers','/:id/applications','getInteractions','/:id/status','statusGet','post','create','/:id/dispositions','addAnswer','/:id/notify','/:id/send','send','status','/:id/users','put','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./smsAccount.controller','get','isAuthenticated','describe'];(function(_0x15ca3f,_0x1204cd){var _0x233a71=function(_0x100ab5){while(--_0x100ab5){_0x15ca3f['push'](_0x15ca3f['shift']());}};_0x233a71(++_0x1204cd);}(_0x5fc3,0xa8));var _0x35fc=function(_0x21205e,_0x7eb8e7){_0x21205e=_0x21205e-0x0;var _0x136ebb=_0x5fc3[_0x21205e];return _0x136ebb;};'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/dispositions',auth[_0x35fc('0xa')](),controller[_0x35fc('0xe')]);router['get'](_0x35fc('0xf'),auth[_0x35fc('0xa')](),controller['getAnswers']);router[_0x35fc('0x9')](_0x35fc('0x10'),auth['isAuthenticated'](),controller['getApplications']);router[_0x35fc('0x9')]('/:id/interactions',auth[_0x35fc('0xa')](),controller[_0x35fc('0x11')]);router[_0x35fc('0x9')](_0x35fc('0x12'),controller[_0x35fc('0x13')]);router['get']('/:id/users',auth['isAuthenticated'](),controller['getAgents']);router[_0x35fc('0x14')]('/',auth[_0x35fc('0xa')](),controller[_0x35fc('0x15')]);router[_0x35fc('0x14')](_0x35fc('0x16'),auth[_0x35fc('0xa')](),controller['addDisposition']);router[_0x35fc('0x14')](_0x35fc('0xf'),auth['isAuthenticated'](),controller[_0x35fc('0x17')]);router[_0x35fc('0x14')](_0x35fc('0x18'),controller['notify']);router[_0x35fc('0x14')](_0x35fc('0x10'),auth[_0x35fc('0xa')](),controller['addApplications']);router[_0x35fc('0x14')](_0x35fc('0x19'),auth[_0x35fc('0xa')](),controller[_0x35fc('0x1a')]);router[_0x35fc('0x14')](_0x35fc('0x12'),controller[_0x35fc('0x1b')]);router[_0x35fc('0x14')](_0x35fc('0x1c'),auth[_0x35fc('0xa')](),controller['addAgents']);router[_0x35fc('0x1d')](_0x35fc('0xc'),auth[_0x35fc('0xa')](),controller[_0x35fc('0x1e')]);router[_0x35fc('0x1f')]('/:id',auth[_0x35fc('0xa')](),controller[_0x35fc('0x20')]);router['delete'](_0x35fc('0x16'),auth[_0x35fc('0xa')](),controller[_0x35fc('0x21')]);router['delete'](_0x35fc('0xf'),auth['isAuthenticated'](),controller[_0x35fc('0x22')]);router[_0x35fc('0x1f')]('/:id/users',auth['isAuthenticated'](),controller[_0x35fc('0x23')]);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 5a1e261..765fb29 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 _0x89fe=['name','generate','ENUM','twilio','connectel','clicksend','clickatell','bandwidth','csc','infobip','intelepeer','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','sequelize','exports','STRING'];(function(_0xe9faf8,_0x5592b7){var _0x3a0d27=function(_0x53b3d1){while(--_0x53b3d1){_0xe9faf8['push'](_0xe9faf8['shift']());}};_0x3a0d27(++_0x5592b7);}(_0x89fe,0x90));var _0xe89f=function(_0x21dda1,_0xa7ec61){_0x21dda1=_0x21dda1-0x0;var _0x478ee5=_0x89fe[_0x21dda1];return _0x478ee5;};'use strict';var Sequelize=require(_0xe89f('0x0'));var rs=require('randomstring');module[_0xe89f('0x1')]={'name':{'type':Sequelize[_0xe89f('0x2')],'unique':_0xe89f('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0xe89f('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0xe89f('0x2')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0xe89f('0x4')]();}},'phone':{'type':Sequelize[_0xe89f('0x2')]},'type':{'type':Sequelize[_0xe89f('0x5')](_0xe89f('0x6'),'skebby',_0xe89f('0x7'),_0xe89f('0x8'),'plivo',_0xe89f('0x9'),_0xe89f('0xa'),_0xe89f('0xb'),_0xe89f('0xc'),_0xe89f('0xd'))},'accountSid':{'type':Sequelize[_0xe89f('0x2')]},'authId':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize['STRING']},'smsMethod':{'type':Sequelize[_0xe89f('0x5')]('SI','TI','GP')},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize['STRING']},'apiKey':{'type':Sequelize[_0xe89f('0x2')]},'applicationId':{'type':Sequelize['STRING']},'accountId':{'type':Sequelize[_0xe89f('0x2')]},'senderString':{'type':Sequelize['STRING']},'deliveryReport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0xe89f('0xe')],'defaultValue':function(){return _0xe89f('0xf');}},'notificationSound':{'type':Sequelize[_0xe89f('0x10')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xe89f('0x10')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xe89f('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xe89f('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0xe89f('0x2')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0xe89f('0x12')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xe89f('0x13'),'set':function(_0x1aed7a){if(!_0x1aed7a)this[_0xe89f('0x14')]('mandatoryDispositionPauseId',null);this[_0xe89f('0x14')]('mandatoryDisposition',_0x1aed7a);}}}; \ No newline at end of file +var _0xb575=['randomstring','exports','STRING','name','generate','ENUM','skebby','connectel','clicksend','plivo','clickatell','bandwidth','csc','infobip','intelepeer','BOOLEAN','TEXT','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','sequelize'];(function(_0x4ce028,_0x526d4b){var _0x583d0c=function(_0x874178){while(--_0x874178){_0x4ce028['push'](_0x4ce028['shift']());}};_0x583d0c(++_0x526d4b);}(_0xb575,0x149));var _0x5b57=function(_0x18b381,_0x3fe59b){_0x18b381=_0x18b381-0x0;var _0x5da044=_0xb575[_0x18b381];return _0x5da044;};'use strict';var Sequelize=require(_0x5b57('0x0'));var rs=require(_0x5b57('0x1'));module[_0x5b57('0x2')]={'name':{'type':Sequelize[_0x5b57('0x3')],'unique':_0x5b57('0x4'),'allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize[_0x5b57('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0x5b57('0x3')],'defaultValue':function(){return rs[_0x5b57('0x5')]();}},'phone':{'type':Sequelize[_0x5b57('0x3')]},'type':{'type':Sequelize[_0x5b57('0x6')]('twilio',_0x5b57('0x7'),_0x5b57('0x8'),_0x5b57('0x9'),_0x5b57('0xa'),_0x5b57('0xb'),_0x5b57('0xc'),_0x5b57('0xd'),_0x5b57('0xe'),_0x5b57('0xf'))},'accountSid':{'type':Sequelize[_0x5b57('0x3')]},'authId':{'type':Sequelize[_0x5b57('0x3')]},'authToken':{'type':Sequelize[_0x5b57('0x3')]},'smsMethod':{'type':Sequelize[_0x5b57('0x6')]('SI','TI','GP')},'username':{'type':Sequelize[_0x5b57('0x3')]},'password':{'type':Sequelize[_0x5b57('0x3')]},'apiKey':{'type':Sequelize[_0x5b57('0x3')]},'applicationId':{'type':Sequelize[_0x5b57('0x3')]},'accountId':{'type':Sequelize['STRING']},'senderString':{'type':Sequelize[_0x5b57('0x3')]},'deliveryReport':{'type':Sequelize[_0x5b57('0x10')],'defaultValue':![]},'description':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0x5b57('0x11')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x5b57('0x10')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x5b57('0x10')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x5b57('0x10')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x5b57('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x5b57('0x10')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x5b57('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x5b57('0x3')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x5b57('0x10')],'defaultValue':![],'comment':_0x5b57('0x13'),'set':function(_0x5a4bf4){if(!_0x5a4bf4)this[_0x5b57('0x14')](_0x5b57('0x15'),null);this[_0x5b57('0x14')]('mandatoryDisposition',_0x5a4bf4);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index ee7eac0..0108d88 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 _0x523e=['fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','params','mandatoryDispositionPause','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','SmsAccounts','UserProfileSection','body','describe','getDispositions','Disposition','removeDispositions','ids','addAnswer','SmsAccountId','CannedAnswer','removeAnswers','sms','SmsApplication','account','applications','orderBy','priority','Applications','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','updatedAt','CompanyId','ListId','From','Body','messageId','MessageSid','skebby','sender','text','connectel','from','clicksend','Text','infobip','results','segmentedMessage','clickatell','fromNumber','replyMessageId','bandwidth','intelepeer','refid','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','omit','contact','SmsInteraction','spread','interaction','created','autoclose','push','close','*,*,*,*','SmsMessage','agent','waitForTheAssignedAgent','Start','startRouting','receiveMessage','entity\x20found','debug','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','stringify','\x0a','addApplications','findOne','transaction','findAndCountAll','getApplications','getInteractions','User','Owner','fullname','internal','color','tag','to\x20is\x20mandatory','List','out','dataValues','Messages','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','requestid','statusInt','message_id','groupName','DELIVERED','redif','RECEIVED_BY_RECIPIENT','message-delivered','DELIVRD','statusGet','message-id','state','csc','addAgents','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','register','jayson/promise','http','request\x20sent','SmsAccount,\x20%s,\x20%s,\x20%s','error','message','SmsAccount,\x20%s,\x20%s','info','result','catch','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','update','then','destroy','UserProfileResource','stack','name','send','Pause','SmsAccount','rawAttributes','fieldName','key','model','map','query','keys','intersection'];(function(_0x36dee7,_0x410d79){var _0x372ef9=function(_0x577228){while(--_0x577228){_0x36dee7['push'](_0x36dee7['shift']());}};_0x372ef9(++_0x410d79);}(_0x523e,0x168));var _0xe523=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x523e[_0x21a9d9];return _0x46adce;};'use strict';var emlformat=require(_0xe523('0x0'));var rimraf=require(_0xe523('0x1'));var zipdir=require(_0xe523('0x2'));var jsonpatch=require(_0xe523('0x3'));var rp=require(_0xe523('0x4'));var moment=require(_0xe523('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xe523('0x6'));var util=require('util');var path=require(_0xe523('0x7'));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(_0xe523('0x8'));var squel=require(_0xe523('0x9'));var crypto=require(_0xe523('0xa'));var jsforce=require(_0xe523('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xe523('0xc'));var querystring=require(_0xe523('0xd'));var Papa=require(_0xe523('0xe'));var Redis=require(_0xe523('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xe523('0x10'));var as=require(_0xe523('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe523('0x12'))(_0xe523('0x13'));var utils=require(_0xe523('0x14'));var config=require(_0xe523('0x15'));var licenseUtil=require(_0xe523('0x16'));var db=require(_0xe523('0x17'))['db'];config[_0xe523('0x18')]=_[_0xe523('0x19')](config[_0xe523('0x18')],{'host':_0xe523('0x1a'),'port':0x18eb});var socket=require(_0xe523('0x1b'))(new Redis(config[_0xe523('0x18')]));require(_0xe523('0x1c'))[_0xe523('0x1d')](socket);var jayson=require(_0xe523('0x1e'));var client=jayson['client'][_0xe523('0x1f')]({'port':0x232c});function respondWithRpcPromise(_0x14fb9a,_0xa6178b,_0x52ff02,_0x8689cf){return new BPromise(function(_0x4e82d5,_0x59c54a){var _0x1b6a86=_0x8689cf||client;return _0x1b6a86['request'](_0x14fb9a,_0x52ff02)['then'](function(_0x484124){logger['info']('SmsAccount,\x20%s,\x20%s',_0xa6178b,_0xe523('0x20'));logger['debug'](_0xe523('0x21'),_0xa6178b,_0xe523('0x20'),JSON['stringify'](_0x484124));if(_0x484124[_0xe523('0x22')]){if(_0x484124['error']['code']===0x1f4){logger['error']('SmsAccount,\x20%s,\x20%s',_0xa6178b,_0x484124[_0xe523('0x22')][_0xe523('0x23')]);return _0x59c54a(_0x484124['error'][_0xe523('0x23')]);}logger[_0xe523('0x22')](_0xe523('0x24'),_0xa6178b,_0x484124[_0xe523('0x22')]['message']);return _0x4e82d5(_0x484124[_0xe523('0x22')]['message']);}else{logger[_0xe523('0x25')]('SmsAccount,\x20%s,\x20%s',_0xa6178b,_0xe523('0x20'));_0x4e82d5(_0x484124[_0xe523('0x26')][_0xe523('0x23')]);}})[_0xe523('0x27')](function(_0x2bf597){logger[_0xe523('0x22')](_0xe523('0x24'),_0xa6178b,_0x2bf597);_0x59c54a(_0x2bf597);});});}function respondWithStatusCode(_0x59a137,_0x4edce8){_0x4edce8=_0x4edce8||0xcc;return function(_0x430dd3){if(_0x430dd3){return _0x59a137[_0xe523('0x28')](_0x4edce8);}return _0x59a137[_0xe523('0x29')](_0x4edce8)[_0xe523('0x2a')]();};}function respondWithResult(_0x4c8d78,_0x135fb0){_0x135fb0=_0x135fb0||0xc8;return function(_0xa4084d){if(_0xa4084d){return _0x4c8d78[_0xe523('0x29')](_0x135fb0)['json'](_0xa4084d);}};}function respondWithFilteredResult(_0x5eebf2,_0x4844f5){return function(_0x5ec168){if(_0x5ec168){var _0x19c217=typeof _0x4844f5[_0xe523('0x2b')]==='undefined'&&typeof _0x4844f5[_0xe523('0x2c')]===_0xe523('0x2d');var _0x55f2ed=_0x5ec168[_0xe523('0x2e')];var _0xdafcf7=_0x19c217?0x0:_0x4844f5[_0xe523('0x2b')];var _0x3a1a40=_0x19c217?_0x5ec168[_0xe523('0x2e')]:_0x4844f5['offset']+_0x4844f5[_0xe523('0x2c')];var _0x222a04;if(_0x3a1a40>=_0x55f2ed){_0x3a1a40=_0x55f2ed;_0x222a04=0xc8;}else{_0x222a04=0xce;}_0x5eebf2[_0xe523('0x29')](_0x222a04);return _0x5eebf2[_0xe523('0x2f')](_0xe523('0x30'),_0xdafcf7+'-'+_0x3a1a40+'/'+_0x55f2ed)[_0xe523('0x31')](_0x5ec168);}return null;};}function patchUpdates(_0x2c770d){return function(_0x297a31){try{jsonpatch[_0xe523('0x32')](_0x297a31,_0x2c770d,!![]);}catch(_0x3f11cb){return BPromise[_0xe523('0x33')](_0x3f11cb);}return _0x297a31[_0xe523('0x34')]();};}function saveUpdates(_0x9aa412,_0x80d1f7){return function(_0x195223){if(_0x195223){return _0x195223[_0xe523('0x35')](_0x9aa412)[_0xe523('0x36')](function(_0x1aefd6){return _0x1aefd6;});}return null;};}function removeEntity(_0x3b02bd,_0x19a647){return function(_0x5faee6){if(_0x5faee6){return _0x5faee6[_0xe523('0x37')]()['then'](function(){var _0xec66c7=_0x5faee6['get']({'plain':!![]});var _0x576a86='SmsAccounts';return db[_0xe523('0x38')][_0xe523('0x37')]({'where':{'type':_0x576a86,'resourceId':_0xec66c7['id']}})['then'](function(){return _0x5faee6;});})[_0xe523('0x36')](function(){_0x3b02bd[_0xe523('0x29')](0xcc)[_0xe523('0x2a')]();});}};}function handleEntityNotFound(_0x454006,_0x163ed3){return function(_0x2079c8){if(!_0x2079c8){_0x454006[_0xe523('0x28')](0x194);}return _0x2079c8;};}function handleError(_0x40e22b,_0x1039d2){_0x1039d2=_0x1039d2||0x1f4;return function(_0x483d65){logger[_0xe523('0x22')](_0x483d65[_0xe523('0x39')]);if(_0x483d65[_0xe523('0x3a')]){delete _0x483d65['name'];}_0x40e22b[_0xe523('0x29')](_0x1039d2)[_0xe523('0x3b')](_0x483d65);};}exports['index']=function(_0x473b9c,_0x51e195){var _0x181749={'include':[{'model':db[_0xe523('0x3c')],'as':'mandatoryDispositionPause'}]},_0xf10e9a={},_0x38efed={'count':0x0,'rows':[]};var _0x455724=_['map'](db[_0xe523('0x3d')][_0xe523('0x3e')],function(_0x436347){return{'name':_0x436347[_0xe523('0x3f')],'type':_0x436347['type'][_0xe523('0x40')]};});_0xf10e9a[_0xe523('0x41')]=_[_0xe523('0x42')](_0x455724,_0xe523('0x3a'));_0xf10e9a[_0xe523('0x43')]=_[_0xe523('0x44')](_0x473b9c['query']);_0xf10e9a['filters']=_[_0xe523('0x45')](_0xf10e9a[_0xe523('0x41')],_0xf10e9a[_0xe523('0x43')]);_0x181749['attributes']=_['intersection'](_0xf10e9a[_0xe523('0x41')],qs['fields'](_0x473b9c[_0xe523('0x43')][_0xe523('0x46')]));_0x181749[_0xe523('0x47')]=_0x181749[_0xe523('0x47')][_0xe523('0x48')]?_0x181749[_0xe523('0x47')]:_0xf10e9a[_0xe523('0x41')];if(!_0x473b9c[_0xe523('0x43')][_0xe523('0x49')](_0xe523('0x4a'))){_0x181749[_0xe523('0x2c')]=qs[_0xe523('0x2c')](_0x473b9c[_0xe523('0x43')]['limit']);_0x181749[_0xe523('0x2b')]=qs[_0xe523('0x2b')](_0x473b9c[_0xe523('0x43')][_0xe523('0x2b')]);}_0x181749[_0xe523('0x4b')]=qs[_0xe523('0x4c')](_0x473b9c['query'][_0xe523('0x4c')]);_0x181749[_0xe523('0x4d')]=qs[_0xe523('0x4e')](_[_0xe523('0x4f')](_0x473b9c['query'],_0xf10e9a['filters']),_0x455724);if(_0x473b9c[_0xe523('0x43')][_0xe523('0x50')]){_0x181749[_0xe523('0x4d')]=_[_0xe523('0x51')](_0x181749['where'],{'$or':_[_0xe523('0x42')](_0x455724,function(_0x2ee9ac){if(_0x2ee9ac[_0xe523('0x52')]!==_0xe523('0x53')){var _0x153f9c={};_0x153f9c[_0x2ee9ac['name']]={'$like':'%'+_0x473b9c[_0xe523('0x43')]['filter']+'%'};return _0x153f9c;}})});}_0x181749=_[_0xe523('0x51')]({},_0x181749,_0x473b9c[_0xe523('0x54')]);var _0x46916e={'where':_0x181749[_0xe523('0x4d')]};return db[_0xe523('0x3d')][_0xe523('0x2e')](_0x46916e)['then'](function(_0x843ea5){_0x38efed[_0xe523('0x2e')]=_0x843ea5;if(_0x473b9c['query'][_0xe523('0x55')]){_0x181749[_0xe523('0x56')]=[{'all':!![]}];}return db[_0xe523('0x3d')][_0xe523('0x57')](_0x181749);})['then'](function(_0x505a46){_0x38efed[_0xe523('0x58')]=_0x505a46;return _0x38efed;})[_0xe523('0x36')](respondWithFilteredResult(_0x51e195,_0x181749))[_0xe523('0x27')](handleError(_0x51e195,null));};exports[_0xe523('0x59')]=function(_0x3e4ece,_0x2ccea6){var _0x376a65={'raw':![],'where':{'id':_0x3e4ece[_0xe523('0x5a')]['id']},'include':[{'model':db[_0xe523('0x3c')],'as':_0xe523('0x5b')}]},_0x340fe7={};_0x340fe7[_0xe523('0x41')]=_[_0xe523('0x44')](db['SmsAccount'][_0xe523('0x3e')]);_0x340fe7[_0xe523('0x43')]=_['keys'](_0x3e4ece[_0xe523('0x43')]);_0x340fe7[_0xe523('0x4e')]=_[_0xe523('0x45')](_0x340fe7[_0xe523('0x41')],_0x340fe7[_0xe523('0x43')]);_0x376a65[_0xe523('0x47')]=_['intersection'](_0x340fe7['model'],qs[_0xe523('0x46')](_0x3e4ece['query'][_0xe523('0x46')]));_0x376a65[_0xe523('0x47')]=_0x376a65['attributes'][_0xe523('0x48')]?_0x376a65['attributes']:_0x340fe7['model'];if(_0x3e4ece['query'][_0xe523('0x55')]){_0x376a65[_0xe523('0x56')]=[{'all':!![]}];}_0x376a65=_[_0xe523('0x51')]({},_0x376a65,_0x3e4ece['options']);return db[_0xe523('0x3d')][_0xe523('0x5c')](_0x376a65)['then'](handleEntityNotFound(_0x2ccea6,null))[_0xe523('0x36')](respondWithResult(_0x2ccea6,null))[_0xe523('0x27')](handleError(_0x2ccea6,null));};exports[_0xe523('0x5d')]=function(_0x3c15ed,_0x5c3bdb){return db[_0xe523('0x3d')]['create'](_0x3c15ed['body'],{})[_0xe523('0x36')](function(_0x57323d){var _0x37f1cd=_0x3c15ed[_0xe523('0x5e')][_0xe523('0x5f')]({'plain':!![]});if(!_0x37f1cd)throw new Error(_0xe523('0x60'));if(_0x37f1cd['role']===_0xe523('0x5e')){var _0x415c8a=_0x57323d[_0xe523('0x5f')]({'plain':!![]});var _0x1bce1b=_0xe523('0x61');return db[_0xe523('0x62')]['find']({'where':{'name':_0x1bce1b,'userProfileId':_0x37f1cd['userProfileId']},'raw':!![]})['then'](function(_0x301af7){if(_0x301af7&&_0x301af7['autoAssociation']===0x0){return db[_0xe523('0x38')][_0xe523('0x5d')]({'name':_0x415c8a['name'],'resourceId':_0x415c8a['id'],'type':_0x301af7[_0xe523('0x3a')],'sectionId':_0x301af7['id']},{})[_0xe523('0x36')](function(){return _0x57323d;});}else{return _0x57323d;}})[_0xe523('0x27')](function(_0x25bdcc){logger[_0xe523('0x22')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x25bdcc);throw _0x25bdcc;});}return _0x57323d;})['then'](respondWithResult(_0x5c3bdb,0xc9))[_0xe523('0x27')](handleError(_0x5c3bdb,null));};exports[_0xe523('0x35')]=function(_0x1526b9,_0x5bafb7){if(_0x1526b9[_0xe523('0x63')]['id']){delete _0x1526b9[_0xe523('0x63')]['id'];}return db[_0xe523('0x3d')][_0xe523('0x5c')]({'where':{'id':_0x1526b9['params']['id']},'include':[{'model':db[_0xe523('0x3c')],'as':'mandatoryDispositionPause'}]})[_0xe523('0x36')](handleEntityNotFound(_0x5bafb7,null))[_0xe523('0x36')](saveUpdates(_0x1526b9[_0xe523('0x63')],null))[_0xe523('0x36')](respondWithResult(_0x5bafb7,null))[_0xe523('0x27')](handleError(_0x5bafb7,null));};exports[_0xe523('0x37')]=function(_0xd4e027,_0x4db438){return db['SmsAccount'][_0xe523('0x5c')]({'where':{'id':_0xd4e027[_0xe523('0x5a')]['id']}})[_0xe523('0x36')](handleEntityNotFound(_0x4db438,null))['then'](removeEntity(_0x4db438,null))['catch'](handleError(_0x4db438,null));};exports[_0xe523('0x64')]=function(_0x29f126,_0x5f4b16){return db[_0xe523('0x3d')][_0xe523('0x64')]()[_0xe523('0x36')](respondWithResult(_0x5f4b16,null))['catch'](handleError(_0x5f4b16,null));};exports['addDisposition']=function(_0x542dab,_0x2ce68d,_0x252a31){if(_0x542dab[_0xe523('0x63')]['id']){delete _0x542dab[_0xe523('0x63')]['id'];}return db[_0xe523('0x3d')][_0xe523('0x5c')]({'where':{'id':_0x542dab['params']['id']}})[_0xe523('0x36')](handleEntityNotFound(_0x2ce68d,null))[_0xe523('0x36')](function(_0x53e678){if(_0x53e678){_0x542dab['body']['SmsAccountId']=_0x53e678['id'];return db['Disposition'][_0xe523('0x5d')](_0x542dab[_0xe523('0x63')]);}})['then'](respondWithResult(_0x2ce68d,null))[_0xe523('0x27')](handleError(_0x2ce68d,null));};exports[_0xe523('0x65')]=function(_0x51d6bb,_0x7f0224,_0x5b5d41){var _0x4cb2eb={'raw':![],'where':{}};var _0x10bdb6={};var _0x508f1e={'count':0x0,'rows':[]};return db[_0xe523('0x3d')]['findOne']({'where':{'id':_0x51d6bb[_0xe523('0x5a')]['id']}})['then'](handleEntityNotFound(_0x7f0224,null))[_0xe523('0x36')](function(_0x31df73){if(_0x31df73){_0x10bdb6[_0xe523('0x41')]=_[_0xe523('0x44')](db[_0xe523('0x66')]['rawAttributes']);_0x10bdb6[_0xe523('0x43')]=_[_0xe523('0x44')](_0x51d6bb['query']);_0x10bdb6['filters']=_['intersection'](_0x10bdb6[_0xe523('0x41')],_0x10bdb6[_0xe523('0x43')]);_0x4cb2eb[_0xe523('0x47')]=_[_0xe523('0x45')](_0x10bdb6[_0xe523('0x41')],qs['fields'](_0x51d6bb[_0xe523('0x43')][_0xe523('0x46')]));_0x4cb2eb[_0xe523('0x47')]=_0x4cb2eb[_0xe523('0x47')][_0xe523('0x48')]?_0x4cb2eb[_0xe523('0x47')]:_0x10bdb6[_0xe523('0x41')];if(!_0x51d6bb[_0xe523('0x43')][_0xe523('0x49')](_0xe523('0x4a'))){_0x4cb2eb['limit']=qs[_0xe523('0x2c')](_0x51d6bb[_0xe523('0x43')][_0xe523('0x2c')]);_0x4cb2eb[_0xe523('0x2b')]=qs[_0xe523('0x2b')](_0x51d6bb[_0xe523('0x43')]['offset']);}_0x4cb2eb['order']=qs[_0xe523('0x4c')](_0x51d6bb[_0xe523('0x43')]['sort']);_0x4cb2eb[_0xe523('0x4d')]=qs[_0xe523('0x4e')](_[_0xe523('0x4f')](_0x51d6bb[_0xe523('0x43')],_0x10bdb6[_0xe523('0x4e')]));_0x4cb2eb[_0xe523('0x4d')]['SmsAccountId']=_0x31df73['id'];if(_0x51d6bb[_0xe523('0x43')][_0xe523('0x50')]){_0x4cb2eb[_0xe523('0x4d')]=_['merge'](_0x4cb2eb[_0xe523('0x4d')],{'$or':_[_0xe523('0x42')](_0x4cb2eb[_0xe523('0x47')],function(_0x11bc8c){var _0xf448fe={};_0xf448fe[_0x11bc8c]={'$like':'%'+_0x51d6bb[_0xe523('0x43')][_0xe523('0x50')]+'%'};return _0xf448fe;})});}_0x4cb2eb=_['merge']({},_0x4cb2eb,_0x51d6bb[_0xe523('0x54')]);return db[_0xe523('0x66')][_0xe523('0x2e')]({'where':_0x4cb2eb[_0xe523('0x4d')]})[_0xe523('0x36')](function(_0x5a3f1c){_0x508f1e[_0xe523('0x2e')]=_0x5a3f1c;if(_0x51d6bb['query'][_0xe523('0x55')]){_0x4cb2eb[_0xe523('0x56')]=[{'all':!![]}];}return db[_0xe523('0x66')]['findAll'](_0x4cb2eb);})[_0xe523('0x36')](function(_0x4dd5b7){_0x508f1e[_0xe523('0x58')]=_0x4dd5b7;return _0x508f1e;});}})[_0xe523('0x36')](respondWithFilteredResult(_0x7f0224,_0x4cb2eb))[_0xe523('0x27')](handleError(_0x7f0224,null));};exports['removeDispositions']=function(_0x179d14,_0x5d74fc,_0x2a1df1){return db[_0xe523('0x3d')][_0xe523('0x5c')]({'where':{'id':_0x179d14[_0xe523('0x5a')]['id']}})[_0xe523('0x36')](handleEntityNotFound(_0x5d74fc,null))[_0xe523('0x36')](function(_0x22ce52){if(_0x22ce52){return _0x22ce52[_0xe523('0x67')](_0x179d14[_0xe523('0x43')][_0xe523('0x68')]);}})['then'](respondWithStatusCode(_0x5d74fc,null))[_0xe523('0x27')](handleError(_0x5d74fc,null));};exports[_0xe523('0x69')]=function(_0x37e898,_0x74ac56,_0x31c4c2){if(_0x37e898[_0xe523('0x63')]['id']){delete _0x37e898[_0xe523('0x63')]['id'];}return db[_0xe523('0x3d')]['find']({'where':{'id':_0x37e898['params']['id']}})['then'](handleEntityNotFound(_0x74ac56,null))['then'](function(_0x5390a3){if(_0x5390a3){_0x37e898[_0xe523('0x63')][_0xe523('0x6a')]=_0x5390a3['id'];return db[_0xe523('0x6b')][_0xe523('0x5d')](_0x37e898[_0xe523('0x63')]);}})[_0xe523('0x36')](respondWithResult(_0x74ac56,null))['catch'](handleError(_0x74ac56,null));};exports['getAnswers']=function(_0x99a6ab,_0x15e400,_0x6b3979){var _0x45b012={'raw':![],'where':{}};var _0x5c95e5={};var _0x548657={'count':0x0,'rows':[]};return db[_0xe523('0x3d')]['findOne']({'where':{'id':_0x99a6ab[_0xe523('0x5a')]['id']}})[_0xe523('0x36')](handleEntityNotFound(_0x15e400,null))[_0xe523('0x36')](function(_0x170fa5){if(_0x170fa5){_0x5c95e5[_0xe523('0x41')]=_['keys'](db[_0xe523('0x6b')]['rawAttributes']);_0x5c95e5[_0xe523('0x43')]=_[_0xe523('0x44')](_0x99a6ab[_0xe523('0x43')]);_0x5c95e5[_0xe523('0x4e')]=_[_0xe523('0x45')](_0x5c95e5[_0xe523('0x41')],_0x5c95e5[_0xe523('0x43')]);_0x45b012['attributes']=_[_0xe523('0x45')](_0x5c95e5[_0xe523('0x41')],qs[_0xe523('0x46')](_0x99a6ab['query'][_0xe523('0x46')]));_0x45b012[_0xe523('0x47')]=_0x45b012[_0xe523('0x47')][_0xe523('0x48')]?_0x45b012[_0xe523('0x47')]:_0x5c95e5[_0xe523('0x41')];if(!_0x99a6ab['query'][_0xe523('0x49')](_0xe523('0x4a'))){_0x45b012[_0xe523('0x2c')]=qs[_0xe523('0x2c')](_0x99a6ab['query'][_0xe523('0x2c')]);_0x45b012[_0xe523('0x2b')]=qs[_0xe523('0x2b')](_0x99a6ab['query'][_0xe523('0x2b')]);}_0x45b012[_0xe523('0x4b')]=qs[_0xe523('0x4c')](_0x99a6ab['query'][_0xe523('0x4c')]);_0x45b012[_0xe523('0x4d')]=qs['filters'](_['pick'](_0x99a6ab['query'],_0x5c95e5[_0xe523('0x4e')]));_0x45b012[_0xe523('0x4d')][_0xe523('0x6a')]=_0x170fa5['id'];if(_0x99a6ab['query'][_0xe523('0x50')]){_0x45b012[_0xe523('0x4d')]=_[_0xe523('0x51')](_0x45b012[_0xe523('0x4d')],{'$or':_[_0xe523('0x42')](_0x45b012['attributes'],function(_0x444d00){var _0xd5e47d={};_0xd5e47d[_0x444d00]={'$like':'%'+_0x99a6ab[_0xe523('0x43')][_0xe523('0x50')]+'%'};return _0xd5e47d;})});}_0x45b012=_[_0xe523('0x51')]({},_0x45b012,_0x99a6ab['options']);return db[_0xe523('0x6b')][_0xe523('0x2e')]({'where':_0x45b012[_0xe523('0x4d')]})[_0xe523('0x36')](function(_0x579799){_0x548657[_0xe523('0x2e')]=_0x579799;if(_0x99a6ab['query'][_0xe523('0x55')]){_0x45b012[_0xe523('0x56')]=[{'all':!![]}];}return db[_0xe523('0x6b')]['findAll'](_0x45b012);})[_0xe523('0x36')](function(_0x1ad8e9){_0x548657[_0xe523('0x58')]=_0x1ad8e9;return _0x548657;});}})[_0xe523('0x36')](respondWithFilteredResult(_0x15e400,_0x45b012))['catch'](handleError(_0x15e400,null));};exports[_0xe523('0x6c')]=function(_0x45c21d,_0x1444f5,_0x566010){return db[_0xe523('0x3d')]['find']({'where':{'id':_0x45c21d[_0xe523('0x5a')]['id']}})[_0xe523('0x36')](handleEntityNotFound(_0x1444f5,null))[_0xe523('0x36')](function(_0x138471){if(_0x138471){return _0x138471[_0xe523('0x6c')](_0x45c21d['query'][_0xe523('0x68')]);}})[_0xe523('0x36')](respondWithStatusCode(_0x1444f5,null))[_0xe523('0x27')](handleError(_0x1444f5,null));};exports['notify']=function(_0x34a5db,_0x20930c,_0x503030){var _0x324bb7={'channel':_0xe523('0x6d')};var _0x118178=[];var _0x4b4655=[];var _0x3a1984={};return db[_0xe523('0x3d')][_0xe523('0x5c')]({'where':{'id':_0x34a5db[_0xe523('0x5a')]['id']},'include':[{'model':db[_0xe523('0x6e')],'as':'Applications'}]})[_0xe523('0x36')](handleEntityNotFound(_0x20930c,null))['then'](function(_0x44a6f6){_0x324bb7[_0xe523('0x6f')]=_0x44a6f6;_0x324bb7[_0xe523('0x70')]=_[_0xe523('0x71')](_0x44a6f6['Applications'],[_0xe523('0x72')],['asc']);if(_0x324bb7[_0xe523('0x6f')]['Applications']){delete _0x324bb7[_0xe523('0x6f')][_0xe523('0x73')];}return db[_0xe523('0x74')][_0xe523('0x64')]();})[_0xe523('0x36')](function(_0x23d3a5){if(!_0x23d3a5){throw new db[(_0xe523('0x75'))][(_0xe523('0x76'))](_0xe523('0x77'));}_0x118178=_[_0xe523('0x78')](_[_0xe523('0x44')](_0x23d3a5),['createdAt',_0xe523('0x79')]);_0x4b4655=_[_0xe523('0x78')](_[_0xe523('0x44')](_0x23d3a5),['createdAt','updatedAt',_0xe523('0x7a'),_0xe523('0x7b')]);_0x324bb7[_0xe523('0x63')]={'mapKey':'mobile'};if(_0x324bb7[_0xe523('0x6f')][_0xe523('0x52')]){switch(_0x324bb7[_0xe523('0x6f')][_0xe523('0x52')]){case'twilio':_0x324bb7[_0xe523('0x63')]['from']=_0x34a5db['body'][_0xe523('0x7c')];_0x324bb7[_0xe523('0x63')][_0xe523('0x63')]=_0x34a5db[_0xe523('0x63')][_0xe523('0x7d')];_0x324bb7[_0xe523('0x63')][_0xe523('0x7e')]=_0x34a5db[_0xe523('0x63')][_0xe523('0x7f')];break;case _0xe523('0x80'):_0x324bb7[_0xe523('0x63')]['from']='+'+_0x34a5db['body'][_0xe523('0x81')];_0x324bb7[_0xe523('0x63')][_0xe523('0x63')]=_0x34a5db['body'][_0xe523('0x82')];break;case _0xe523('0x83'):_0x324bb7['body'][_0xe523('0x84')]=_0x34a5db[_0xe523('0x63')][_0xe523('0x84')];_0x324bb7[_0xe523('0x63')][_0xe523('0x63')]=_0x34a5db['body'][_0xe523('0x23')];break;case _0xe523('0x85'):_0x324bb7['body']['from']=_0x34a5db[_0xe523('0x63')]['from'];_0x324bb7[_0xe523('0x63')]['body']=_0x34a5db[_0xe523('0x63')][_0xe523('0x63')];_0x324bb7[_0xe523('0x63')][_0xe523('0x7e')]=_0x34a5db['body']['message_id'];break;case'plivo':_0x324bb7[_0xe523('0x63')][_0xe523('0x84')]=_0x34a5db[_0xe523('0x63')][_0xe523('0x7c')];_0x324bb7[_0xe523('0x63')][_0xe523('0x63')]=_0x34a5db[_0xe523('0x63')][_0xe523('0x86')];_0x324bb7[_0xe523('0x63')][_0xe523('0x7e')]=_0x34a5db[_0xe523('0x63')]['MessageUUID'];break;case _0xe523('0x87'):_0x324bb7[_0xe523('0x63')][_0xe523('0x84')]='+'+_0x34a5db[_0xe523('0x63')][_0xe523('0x88')][0x0]['from'];_0x324bb7[_0xe523('0x63')]['body']=_0x34a5db[_0xe523('0x63')][_0xe523('0x88')][0x0]['text'];_0x324bb7[_0xe523('0x63')][_0xe523('0x7e')]=_0x34a5db[_0xe523('0x63')]['results'][0x0]['messageId'];break;case'csc':_0x324bb7[_0xe523('0x63')][_0xe523('0x84')]=_0x34a5db['body']['originatingAddress'];_0x324bb7[_0xe523('0x63')]['body']=_0x34a5db['body'][_0xe523('0x89')][_0xe523('0x23')];break;case _0xe523('0x8a'):_0x324bb7[_0xe523('0x63')][_0xe523('0x84')]=_0x34a5db[_0xe523('0x63')][_0xe523('0x8b')];_0x324bb7[_0xe523('0x63')][_0xe523('0x63')]=_0x34a5db[_0xe523('0x63')][_0xe523('0x82')];_0x324bb7[_0xe523('0x63')][_0xe523('0x7e')]=_0x34a5db['body'][_0xe523('0x8c')];break;case _0xe523('0x8d'):_0x324bb7[_0xe523('0x63')][_0xe523('0x7e')]=_0x34a5db[_0xe523('0x63')][0x0][_0xe523('0x23')]['id'];_0x324bb7[_0xe523('0x63')][_0xe523('0x84')]=_0x34a5db['body'][0x0]['message'][_0xe523('0x84')];_0x324bb7[_0xe523('0x63')][_0xe523('0x63')]=_0x34a5db[_0xe523('0x63')][0x0][_0xe523('0x23')][_0xe523('0x82')];break;case _0xe523('0x8e'):_0x324bb7[_0xe523('0x63')]['from']=_0x34a5db[_0xe523('0x63')][_0xe523('0x84')];_0x324bb7[_0xe523('0x63')][_0xe523('0x63')]=_0x34a5db[_0xe523('0x63')][_0xe523('0x23')];_0x324bb7[_0xe523('0x63')][_0xe523('0x7e')]=_0x34a5db['body'][_0xe523('0x8f')];break;}}if(_0x324bb7[_0xe523('0x63')]['id']){delete _0x324bb7[_0xe523('0x63')]['id'];}if(_[_0xe523('0x90')](_0x324bb7[_0xe523('0x63')]['from'])){throw new db[(_0xe523('0x75'))][(_0xe523('0x76'))](_0xe523('0x91'));}if(_[_0xe523('0x90')](_0x324bb7[_0xe523('0x63')][_0xe523('0x63')])||_0x324bb7[_0xe523('0x63')][_0xe523('0x63')]===''){throw new db[(_0xe523('0x75'))]['ValidationError'](_0xe523('0x92'));}if(_[_0xe523('0x90')](_0x324bb7[_0xe523('0x63')][_0xe523('0x93')])){throw new db[(_0xe523('0x75'))][(_0xe523('0x76'))](_0xe523('0x94')+_0x4b4655);}if(!_[_0xe523('0x95')](_0x4b4655,_0x324bb7['body']['mapKey'])){throw new db[(_0xe523('0x75'))][(_0xe523('0x76'))](_0xe523('0x96')+_0x4b4655);}_0x3a1984[_0x324bb7[_0xe523('0x63')][_0xe523('0x93')]]=_0x324bb7[_0xe523('0x63')][_0xe523('0x84')];return db[_0xe523('0x97')][_0xe523('0x5c')]({'where':{'id':_0x324bb7[_0xe523('0x6f')][_0xe523('0x7b')]},'include':[{'model':db[_0xe523('0x74')],'as':_0xe523('0x98'),'where':_0x3a1984,'limit':0x1,'order':[[_0xe523('0x79'),_0xe523('0x99')]]}]});})['then'](handleEntityNotFound(_0x20930c,null))[_0xe523('0x36')](function(_0x253db8){if(_0x253db8){_0x324bb7['list']=_[_0xe523('0x9a')](_0x253db8,[_0xe523('0x98')]);if(_0x253db8[_0xe523('0x98')]['length']){return _0x253db8[_0xe523('0x98')][0x0];}var _0x3028eb=_['defaults'](_0x324bb7['body'],{'firstName':_0x324bb7['body'][_0xe523('0x84')],'ListId':_0x253db8['id']});_0x3028eb[_0x324bb7['body'][_0xe523('0x93')]]=_0x324bb7[_0xe523('0x63')][_0xe523('0x84')];return db[_0xe523('0x74')][_0xe523('0x5d')](_0x3028eb,{'fields':_0x118178,'raw':!![]});}})['then'](handleEntityNotFound(_0x20930c,null))[_0xe523('0x36')](function(_0x273b3d){if(_0x273b3d){_0x324bb7[_0xe523('0x9b')]=_0x273b3d;var _0x316dda={'ContactId':_0x273b3d['id'],'phone':_0x324bb7[_0xe523('0x63')][_0xe523('0x84')],'SmsAccountId':_0x34a5db[_0xe523('0x5a')]['id']};var _0x4cba3d={'ContactId':_0x273b3d['id'],'SmsAccountId':_0x34a5db[_0xe523('0x5a')]['id'],'closed':![]};return db[_0xe523('0x9c')][_0xe523('0x5c')]({'where':_0x4cba3d})[_0xe523('0x36')](function(_0x2ea544){if(_0x2ea544){return[_0x2ea544,![]];}return db[_0xe523('0x9c')][_0xe523('0x5d')](_0x316dda)[_0xe523('0x36')](function(_0x25a1f8){return[_0x25a1f8,!![]];});});}})[_0xe523('0x9d')](function(_0x52d857,_0x3f471e){_0x324bb7[_0xe523('0x9e')]=_0x52d857[_0xe523('0x5f')]({'plain':!![]});_0x324bb7['interaction'][_0xe523('0x9f')]=![];if(_0x3f471e){if(_0x324bb7[_0xe523('0x6f')][_0xe523('0xa0')]){_0x324bb7[_0xe523('0x70')][_0xe523('0xa1')]({'id':0x0,'priority':_0x324bb7[_0xe523('0x70')][_0xe523('0x48')]+0x1,'app':_0xe523('0xa2'),'appdata':'unmanaged','interval':_0xe523('0xa3')});}_0x324bb7['interaction'][_0xe523('0x9f')]=!![];}return db[_0xe523('0xa4')]['create']({'phone':_0x324bb7[_0xe523('0x63')][_0xe523('0x84')],'messageId':_0x324bb7['body'][_0xe523('0x7e')],'body':_0x324bb7['body'][_0xe523('0x63')],'SmsAccountId':_0x34a5db[_0xe523('0x5a')]['id'],'SmsInteractionId':_0x52d857['id'],'direction':'in','ContactId':_0x52d857['ContactId'],'AttachmentId':_0x324bb7[_0xe523('0x63')]['AttachmentId']});})['then'](function(_0xab14f5){_0x324bb7[_0xe523('0x23')]=_0xab14f5;if(_0x324bb7[_0xe523('0x9e')]['UserId']){return db['User']['find']({'attributes':['id',_0xe523('0x3a')],'where':{'id':_0x324bb7['interaction']['UserId']}})[_0xe523('0x36')](function(_0x2fa26e){if(_0x2fa26e){_0x324bb7[_0xe523('0x70')]['unshift']({'id':0x0,'priority':0x0,'app':_0xe523('0xa5'),'appdata':_0x2fa26e[_0xe523('0x3a')]+','+(_0x324bb7[_0xe523('0x6f')][_0xe523('0xa6')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0xe523('0xa7'),_0xe523('0xa8'),_0x324bb7);});}return respondWithRpcPromise(_0xe523('0xa7'),_0xe523('0xa8'),_0x324bb7);})['then'](function(_0x229edc){if(_0x229edc){var _0x2d7fba=0xc8;var _0x3b61b0=_0xe523('0xa9');logger[_0xe523('0x25')](_0xe523('0x21'),_0x3b61b0,_0x2d7fba,_0xe523('0xaa'));logger[_0xe523('0xab')](_0xe523('0xac'),_0x3b61b0,_0x2d7fba,_0xe523('0xaa'),JSON[_0xe523('0xad')](_0x229edc));if(_0x324bb7['account'][_0xe523('0x52')]==='twilio'){return _0x20930c[_0xe523('0x29')](_0x2d7fba)[_0xe523('0x2f')]('Content-Type','text/xml')['send'](_0xe523('0xae'));}else{return _0x20930c[_0xe523('0x29')](_0x2d7fba)[_0xe523('0x31')](_0x229edc);}}})[_0xe523('0x27')](handleError(_0x20930c,null));};exports[_0xe523('0xaf')]=function(_0x57d3cb,_0x52044a,_0x8b756){return db[_0xe523('0x3d')][_0xe523('0xb0')]({'where':{'id':_0x57d3cb['params']['id']}})[_0xe523('0x36')](handleEntityNotFound(_0x52044a,null))[_0xe523('0x36')](function(_0x28a00c){if(_0x28a00c){return db['sequelize'][_0xe523('0xb1')](function(_0x2252ea){return db[_0xe523('0x6e')][_0xe523('0x37')]({'where':{'SmsAccountId':_0x57d3cb[_0xe523('0x5a')]['id']},'transaction':_0x2252ea})[_0xe523('0x36')](function(_0x2d5e40){var _0x204706=_[_0xe523('0x42')](_0x57d3cb['body'],function(_0x379c68){_0x379c68[_0xe523('0x6a')]=_0x57d3cb[_0xe523('0x5a')]['id'];return _0x379c68;});return db['SmsApplication']['bulkCreate'](_0x204706,{'transaction':_0x2252ea});});})[_0xe523('0x36')](function(){return db[_0xe523('0x6e')][_0xe523('0xb2')]({'where':{'SmsAccountId':_0x57d3cb[_0xe523('0x5a')]['id']},'order':_0xe523('0x72')});});}})[_0xe523('0x36')](respondWithResult(_0x52044a,null))[_0xe523('0x27')](handleError(_0x52044a,null));};exports[_0xe523('0xb3')]=function(_0x19c54e,_0x43f179,_0x1da628){var _0x5de8b8={};var _0x4a155c={};var _0x351622;var _0x4b043d;return db[_0xe523('0x3d')][_0xe523('0xb0')]({'where':{'id':_0x19c54e['params']['id']}})[_0xe523('0x36')](handleEntityNotFound(_0x43f179,null))[_0xe523('0x36')](function(_0x565b7c){if(_0x565b7c){_0x351622=_0x565b7c;_0x4a155c[_0xe523('0x41')]=_[_0xe523('0x44')](db[_0xe523('0x6e')][_0xe523('0x3e')]);_0x4a155c[_0xe523('0x43')]=_[_0xe523('0x44')](_0x19c54e['query']);_0x4a155c[_0xe523('0x4e')]=_[_0xe523('0x45')](_0x4a155c['model'],_0x4a155c['query']);_0x5de8b8['attributes']=_[_0xe523('0x45')](_0x4a155c[_0xe523('0x41')],qs[_0xe523('0x46')](_0x19c54e[_0xe523('0x43')][_0xe523('0x46')]));_0x5de8b8[_0xe523('0x47')]=_0x5de8b8[_0xe523('0x47')][_0xe523('0x48')]?_0x5de8b8['attributes']:_0x4a155c['model'];_0x5de8b8[_0xe523('0x4b')]=qs[_0xe523('0x4c')](_0x19c54e[_0xe523('0x43')][_0xe523('0x4c')]);_0x5de8b8[_0xe523('0x4d')]=qs[_0xe523('0x4e')](_[_0xe523('0x4f')](_0x19c54e['query'],_0x4a155c['filters']));if(_0x19c54e['query'][_0xe523('0x50')]){_0x5de8b8[_0xe523('0x4d')]=_[_0xe523('0x51')](_0x5de8b8[_0xe523('0x4d')],{'$or':_[_0xe523('0x42')](_0x5de8b8[_0xe523('0x47')],function(_0x1c7d8c){var _0x3f33d0={};_0x3f33d0[_0x1c7d8c]={'$like':'%'+_0x19c54e['query'][_0xe523('0x50')]+'%'};return _0x3f33d0;})});}_0x5de8b8=_[_0xe523('0x51')]({},_0x5de8b8,_0x19c54e[_0xe523('0x54')]);return _0x351622[_0xe523('0xb3')](_0x5de8b8);}})['then'](function(_0x20771e){if(_0x20771e){_0x4b043d=_0x20771e['length'];if(!_0x19c54e['query']['hasOwnProperty'](_0xe523('0x4a'))){_0x5de8b8[_0xe523('0x2c')]=qs[_0xe523('0x2c')](_0x19c54e[_0xe523('0x43')][_0xe523('0x2c')]);_0x5de8b8['offset']=qs['offset'](_0x19c54e[_0xe523('0x43')][_0xe523('0x2b')]);}return _0x351622[_0xe523('0xb3')](_0x5de8b8);}})['then'](function(_0x598aa0){if(_0x598aa0){return _0x598aa0?{'count':_0x4b043d,'rows':_0x598aa0}:null;}})[_0xe523('0x36')](respondWithResult(_0x43f179,null))[_0xe523('0x27')](handleError(_0x43f179,null));};exports[_0xe523('0xb4')]=function(_0x4dd355,_0xd1b594,_0x23cef2){var _0x443fab={'raw':![],'where':{}};var _0x472675={};var _0x30daf7={'count':0x0,'rows':[]};return db[_0xe523('0x3d')][_0xe523('0xb0')]({'where':{'id':_0x4dd355[_0xe523('0x5a')]['id']}})['then'](handleEntityNotFound(_0xd1b594,null))['then'](function(_0x391230){if(_0x391230){_0x472675[_0xe523('0x41')]=_['keys'](db[_0xe523('0x9c')][_0xe523('0x3e')]);_0x472675['query']=_[_0xe523('0x44')](_0x4dd355[_0xe523('0x43')]);_0x472675[_0xe523('0x4e')]=_['intersection'](_0x472675[_0xe523('0x41')],_0x472675['query']);_0x443fab[_0xe523('0x47')]=_[_0xe523('0x45')](_0x472675['model'],qs[_0xe523('0x46')](_0x4dd355[_0xe523('0x43')][_0xe523('0x46')]));_0x443fab[_0xe523('0x47')]=_0x443fab[_0xe523('0x47')][_0xe523('0x48')]?_0x443fab[_0xe523('0x47')]:_0x472675[_0xe523('0x41')];if(!_0x4dd355[_0xe523('0x43')][_0xe523('0x49')]('nolimit')){_0x443fab[_0xe523('0x2c')]=qs[_0xe523('0x2c')](_0x4dd355[_0xe523('0x43')]['limit']);_0x443fab[_0xe523('0x2b')]=qs['offset'](_0x4dd355[_0xe523('0x43')]['offset']);}_0x443fab[_0xe523('0x4b')]=qs['sort'](_0x4dd355[_0xe523('0x43')]['sort']);_0x443fab['where']=qs[_0xe523('0x4e')](_['pick'](_0x4dd355[_0xe523('0x43')],_0x472675[_0xe523('0x4e')]));_0x443fab[_0xe523('0x4d')]['SmsAccountId']=_0x391230['id'];if(_0x4dd355['query'][_0xe523('0x50')]){_0x443fab[_0xe523('0x4d')]=_[_0xe523('0x51')](_0x443fab[_0xe523('0x4d')],{'$or':_['map'](_0x443fab[_0xe523('0x47')],function(_0x1b812a){var _0x35ea54={};_0x35ea54[_0x1b812a]={'$like':'%'+_0x4dd355[_0xe523('0x43')][_0xe523('0x50')]+'%'};return _0x35ea54;})});}_0x443fab=_[_0xe523('0x51')]({},_0x443fab,_0x4dd355[_0xe523('0x54')]);return db[_0xe523('0x9c')][_0xe523('0x2e')]({'where':_0x443fab[_0xe523('0x4d')]})[_0xe523('0x36')](function(_0x5dabe4){_0x30daf7[_0xe523('0x2e')]=_0x5dabe4;if(_0x4dd355[_0xe523('0x43')]['includeAll']){_0x443fab['include']=[{'model':db['CmContact'],'as':'Contact','required':![]},{'model':db[_0xe523('0xb5')],'as':_0xe523('0xb6'),'attributes':[_0xe523('0x3a'),_0xe523('0xb7'),_0xe523('0xb8')],'required':![]},{'model':db['Tag'],'as':'Tags','attributes':['id','name',_0xe523('0xb9')],'where':_0x4dd355['query'][_0xe523('0xba')]?{'id':_0x4dd355[_0xe523('0x43')]['tag']}:undefined,'required':_0x4dd355[_0xe523('0x43')]['tag']?!![]:![]}];}return db[_0xe523('0x9c')][_0xe523('0x57')](_0x443fab);})[_0xe523('0x36')](function(_0x12d5cc){_0x30daf7['rows']=_0x12d5cc;return _0x30daf7;});}})[_0xe523('0x36')](respondWithFilteredResult(_0xd1b594,_0x443fab))[_0xe523('0x27')](handleError(_0xd1b594,null));};exports['send']=function(_0x4f2c75,_0x3fadac,_0x13376a){var _0x1d2103,_0x449045,_0x19760f;if(_['isNil'](_0x4f2c75[_0xe523('0x63')][_0xe523('0x63')])||_0x4f2c75[_0xe523('0x63')]['body']===''){throw new db[(_0xe523('0x75'))][(_0xe523('0x76'))](_0xe523('0x92'));}if(_[_0xe523('0x90')](_0x4f2c75[_0xe523('0x63')]['to'])){throw new db['Sequelize'][(_0xe523('0x76'))](_0xe523('0xbb'));}_0x1d2103=_0x4f2c75[_0xe523('0x63')]['to'];return db[_0xe523('0x3d')][_0xe523('0x5c')]({'where':{'id':_0x4f2c75[_0xe523('0x5a')]['id']},'include':[{'model':db[_0xe523('0x97')],'as':_0xe523('0xbc'),'include':[{'model':db[_0xe523('0x74')],'as':'Contacts','where':{'mobile':_0x1d2103},'limit':0x1,'order':[[_0xe523('0x79'),_0xe523('0x99')]]}]}]})['then'](handleEntityNotFound(_0x3fadac,null))[_0xe523('0x36')](function(_0x2b0642){if(_0x2b0642&&_0x2b0642[_0xe523('0xbc')]){_0x449045=_0x2b0642['get']({'plain':!![]});if(_0x449045['List']&&_0x449045[_0xe523('0xbc')][_0xe523('0x98')][_0xe523('0x48')]){return _0x449045[_0xe523('0xbc')][_0xe523('0x98')][0x0];}return db[_0xe523('0x74')][_0xe523('0x5d')](_[_0xe523('0x19')](_0x4f2c75[_0xe523('0x63')],{'firstName':_0x1d2103,'mobile':_0x1d2103,'phone':_0x1d2103,'ListId':_0x449045[_0xe523('0x7b')]}));}})['then'](handleEntityNotFound(_0x3fadac,null))[_0xe523('0x36')](function(_0x1b5dba){if(_0x1b5dba){_0x19760f=_0x1b5dba;return db[_0xe523('0x9c')]['find']({'where':{'ContactId':_0x19760f['id'],'closed':![],'SmsAccountId':_0x449045['id']}})['then'](function(_0x18f163){if(_0x18f163){return[_0x18f163,![]];}return db['SmsInteraction'][_0xe523('0x5d')]({'UserId':_0x4f2c75[_0xe523('0x5e')]['id'],'ContactId':_0x19760f['id'],'SmsAccountId':_0x449045['id'],'phone':_0x1d2103,'firstMsgDirection':_0xe523('0xbd'),'Messages':[_[_0xe523('0x51')](_0x4f2c75[_0xe523('0x63')],{'read':![],'body':_0x4f2c75[_0xe523('0x63')][_0xe523('0x63')],'phone':_0x1d2103,'SmsAccountId':_0x449045['id'],'UserId':_0x4f2c75[_0xe523('0x5e')]['id'],'ContactId':_0x19760f['id']})]},{'include':[{'model':db[_0xe523('0xa4')],'as':'Messages'}]})[_0xe523('0x36')](function(_0x3e113e){return[_0x3e113e,!![]];});});}})[_0xe523('0x9d')](function(_0x3ed280,_0x4f600e){if(_0x4f600e){return _0x3ed280;}return db[_0xe523('0xa4')][_0xe523('0x5d')](_[_0xe523('0x51')](_0x4f2c75['body'],{'read':![],'body':_0x4f2c75[_0xe523('0x63')][_0xe523('0x63')],'phone':_0x1d2103,'SmsAccountId':_0x449045['id'],'SmsInteractionId':_0x3ed280['id'],'UserId':_0x4f2c75[_0xe523('0x5e')]['id'],'ContactId':_0x19760f['id']}))['then'](function(_0x50e5c4){_0x3ed280[_0xe523('0xbe')][_0xe523('0xbf')]=[];_0x3ed280[_0xe523('0xbe')]['Messages']['push'](_0x50e5c4[_0xe523('0xbe')]);return _0x3ed280;});})[_0xe523('0x36')](respondWithResult(_0x3fadac,null))[_0xe523('0x27')](handleError(_0x3fadac,null));};exports[_0xe523('0x29')]=function(_0xce9409,_0x5339b5,_0x51ab3f){if(_0xce9409[_0xe523('0x63')]['id']){delete _0xce9409['body']['id'];}var _0x46e99f,_0x360a45,_0x44f1b2;return db[_0xe523('0x3d')][_0xe523('0x5c')]({'where':{'id':_0xce9409['params']['id']}})[_0xe523('0x36')](handleEntityNotFound(_0x5339b5,null))['then'](function(_0x304884){if(_0x304884){_0x44f1b2=_0x304884;logger[_0xe523('0xab')](_0xe523('0x21'),_0xe523('0x29'),_0xe523('0xc0'),_0x304884[_0xe523('0x52')],util[_0xe523('0xc1')](_0xce9409[_0xe523('0x63')],{'showHidden':![],'depth':null}));switch(_0x304884['type']){case _0xe523('0x80'):if(_0xce9409['body'][_0xe523('0xc2')]&&_0xce9409[_0xe523('0x63')][_0xe523('0x29')]){_0x360a45=_0xce9409[_0xe523('0x63')][_0xe523('0x29')];return db[_0xe523('0xa4')][_0xe523('0x5c')]({'where':{'messageId':_0xce9409[_0xe523('0x63')]['skebby_dispatch_id']}});}break;case _0xe523('0x83'):if(_0xce9409[_0xe523('0x63')][_0xe523('0xc3')]&&_0xce9409[_0xe523('0x63')][_0xe523('0xc4')]){_0x360a45=_0xce9409['body'][_0xe523('0xc4')];return db[_0xe523('0xa4')][_0xe523('0x5c')]({'where':{'messageId':_0xce9409[_0xe523('0x63')][_0xe523('0xc3')]}});}break;case _0xe523('0x85'):if(_0xce9409[_0xe523('0x63')][_0xe523('0xc5')]&&_0xce9409[_0xe523('0x63')]['status_code']){_0x360a45=_0xce9409[_0xe523('0x63')]['status_code'];return db[_0xe523('0xa4')][_0xe523('0x5c')]({'where':{'messageId':_0xce9409[_0xe523('0x63')]['message_id']}});}break;case _0xe523('0x87'):var _0x2bec26=_0xce9409[_0xe523('0x63')]['results'][0x0];if(_0x2bec26[_0xe523('0x7e')]&&_0x2bec26[_0xe523('0x29')][_0xe523('0xc6')]===_0xe523('0xc7')){_0x360a45=_0x2bec26[_0xe523('0x29')][_0xe523('0xc6')];return db['SmsMessage']['find']({'where':{'messageId':_0x2bec26[_0xe523('0x7e')]}});}break;case'clickatell':if(_0xce9409[_0xe523('0x63')]['messageId']&&_0xce9409[_0xe523('0x63')][_0xe523('0x29')]){_0x360a45=_0xce9409[_0xe523('0x63')][_0xe523('0x29')];return db[_0xe523('0xa4')][_0xe523('0x5c')]({'where':{'messageId':_0xce9409[_0xe523('0x63')][_0xe523('0x7e')]}});}break;case _0xe523('0x8d'):if(_0xce9409[_0xe523('0x63')][0x0][_0xe523('0x23')]['id']){_0x360a45=_0xce9409[_0xe523('0x63')][0x0][_0xe523('0x52')];return db[_0xe523('0xa4')]['find']({'where':{'messageId':_0xce9409['body'][0x0][_0xe523('0x23')]['id']}});}break;case _0xe523('0x8e'):if(_0xce9409[_0xe523('0x63')][_0xe523('0xc8')]&&_0xce9409[_0xe523('0x63')][_0xe523('0x29')]){_0x360a45=_0xce9409['body'][_0xe523('0x29')];return db[_0xe523('0xa4')][_0xe523('0x5c')]({'where':{'messageId':_0xce9409[_0xe523('0x63')]['redif']}});}break;}}})[_0xe523('0x36')](handleEntityNotFound(_0x5339b5,null))['then'](function(_0x4d8bf5){if(_0x4d8bf5){_0x46e99f=_0x4d8bf5;switch(_0x44f1b2['type']){case _0xe523('0x80'):if(_0x360a45===_0xe523('0xc7')){return _0x46e99f[_0xe523('0x35')]({'read':!![]});}else{logger[_0xe523('0x22')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xe523('0x29'),_0xe523('0x80'),util[_0xe523('0xc1')](_0xce9409['body'],{'showHidden':![],'depth':null}));}break;case _0xe523('0x83'):if(_0x360a45==='1'){return _0x46e99f[_0xe523('0x35')]({'read':!![]});}else{logger[_0xe523('0x22')](_0xe523('0x21'),_0xe523('0x29'),_0xe523('0x80'),util['inspect'](_0xce9409[_0xe523('0x63')],{'showHidden':![],'depth':null}));}break;case _0xe523('0x85'):if(!_0xce9409[_0xe523('0x63')]['error_code']&&_0x360a45>=0xc8&&_0x360a45<=0xce){return _0x46e99f[_0xe523('0x35')]({'read':!![]});}else{logger[_0xe523('0x22')](_0xe523('0x21'),'status','clicksend',util[_0xe523('0xc1')](_0xce9409[_0xe523('0x63')],{'showHidden':![],'depth':null}));}break;case _0xe523('0x87'):var _0x55b4b9=_0xce9409[_0xe523('0x63')][_0xe523('0x88')][0x0];if(_0x55b4b9[_0xe523('0x29')][_0xe523('0xc6')]===_0xe523('0xc7')){return _0x46e99f[_0xe523('0x35')]({'read':!![]});}else{logger[_0xe523('0x22')](_0xe523('0x21'),_0xe523('0x29'),_0xe523('0x87'),util[_0xe523('0xc1')](_0xce9409['body'],{'showHidden':![],'depth':null}));}break;case _0xe523('0x8a'):if(_0x360a45=='DELIVERED_TO_GATEWAY'||_0x360a45==_0xe523('0xc9')){return _0x46e99f[_0xe523('0x35')]({'read':!![]});}else{logger['error'](_0xe523('0x21'),'status',_0xe523('0x8a'),util[_0xe523('0xc1')](_0xce9409[_0xe523('0x63')],{'showHidden':![],'depth':null}));}break;case'bandwidth':if(_0x360a45==_0xe523('0xca')){return _0x46e99f[_0xe523('0x35')]({'read':!![]});}else{logger['error'](_0xe523('0x21'),_0xe523('0x29'),_0xe523('0x8d'),util[_0xe523('0xc1')](_0xce9409[_0xe523('0x63')],{'showHidden':![],'depth':null}));}break;case _0xe523('0x8e'):if(_0x360a45===_0xe523('0xcb')||_0x360a45==='ACCEPTD'){return _0x46e99f[_0xe523('0x35')]({'read':!![]});}else{logger[_0xe523('0x22')](_0xe523('0x21'),'status','intelepeer',util[_0xe523('0xc1')](_0xce9409[_0xe523('0x63')],{'showHidden':![],'depth':null}));}break;}return _0x46e99f;}})[_0xe523('0x36')](respondWithResult(_0x5339b5,null))[_0xe523('0x27')](handleError(_0x5339b5,null));};exports[_0xe523('0xcc')]=function(_0x3a2ee5,_0x1c708f,_0x3d8f67){var _0x4798d3,_0x53358a,_0x500666;return db['SmsAccount']['find']({'where':{'id':_0x3a2ee5['params']['id']}})['then'](handleEntityNotFound(_0x1c708f,null))[_0xe523('0x36')](function(_0x51d005){if(_0x51d005){_0x500666=_0x51d005;logger[_0xe523('0xab')](_0xe523('0x21'),_0xe523('0x29'),'received\x20delivery\x20report\x20from',_0x51d005[_0xe523('0x52')],util['inspect'](_0x3a2ee5[_0xe523('0x43')],{'showHidden':![],'depth':null}));switch(_0x51d005[_0xe523('0x52')]){case'csc':if(_0x3a2ee5[_0xe523('0x43')][_0xe523('0xcd')]&&_0x3a2ee5['query'][_0xe523('0xce')]){_0x53358a=_0x3a2ee5[_0xe523('0x43')]['state'];return db[_0xe523('0xa4')][_0xe523('0x5c')]({'where':{'messageId':_0x3a2ee5[_0xe523('0x43')][_0xe523('0xcd')]}});}break;}}})['then'](handleEntityNotFound(_0x1c708f,null))['then'](function(_0x331c1b){if(_0x331c1b){_0x4798d3=_0x331c1b;switch(_0x500666[_0xe523('0x52')]){case _0xe523('0xcf'):if(_0x53358a==='2'||_0x53358a==='6'){return _0x4798d3[_0xe523('0x35')]({'read':!![]});}else{logger[_0xe523('0x22')](_0xe523('0x21'),_0xe523('0x29'),'csc',util[_0xe523('0xc1')](_0x3a2ee5[_0xe523('0x43')],{'showHidden':![],'depth':null}));};break;}return _0x4798d3;}})[_0xe523('0x36')](respondWithResult(_0x1c708f,null))['catch'](handleError(_0x1c708f,null));};exports[_0xe523('0xd0')]=function(_0x115737,_0x356e7d,_0x4d2315){return db['SmsAccount']['find']({'where':{'id':_0x115737[_0xe523('0x5a')]['id']}})[_0xe523('0x36')](handleEntityNotFound(_0x356e7d,null))['then'](function(_0x128501){if(_0x128501){return _0x128501[_0xe523('0xd0')](_0x115737[_0xe523('0x63')][_0xe523('0x68')],_[_0xe523('0x9a')](_0x115737[_0xe523('0x63')],['ids','id'])||{})['spread'](function(_0x1738bb){for(var _0x448d0a=0x0;_0x448d0a<_0x115737[_0xe523('0x63')]['ids']['length'];_0x448d0a+=0x1){socket[_0xe523('0xd1')](_0xe523('0xd2'),{'UserId':_0x115737[_0xe523('0x63')][_0xe523('0x68')][_0x448d0a],'SmsAccountId':_0x115737[_0xe523('0x5a')]['id']});}return _0x1738bb;});}})['then'](respondWithResult(_0x356e7d,null))[_0xe523('0x27')](handleError(_0x356e7d,null));};exports[_0xe523('0xd3')]=function(_0x595c50,_0x119ad3,_0x29a8fd){return db['SmsAccount'][_0xe523('0x5c')]({'where':{'id':_0x595c50[_0xe523('0x5a')]['id']}})[_0xe523('0x36')](handleEntityNotFound(_0x119ad3,null))[_0xe523('0x36')](function(_0x581496){if(_0x581496){return _0x581496[_0xe523('0xd3')](_0x595c50[_0xe523('0x43')][_0xe523('0x68')])[_0xe523('0x36')](function(){if(_[_0xe523('0xd4')](_0x595c50['query'][_0xe523('0x68')])){for(var _0x41ec1e=0x0;_0x41ec1e<_0x595c50[_0xe523('0x43')][_0xe523('0x68')][_0xe523('0x48')];_0x41ec1e+=0x1){socket[_0xe523('0xd1')](_0xe523('0xd5'),{'UserId':Number(_0x595c50[_0xe523('0x43')][_0xe523('0x68')][_0x41ec1e]),'SmsAccountId':Number(_0x595c50[_0xe523('0x5a')]['id'])});}}else{socket[_0xe523('0xd1')](_0xe523('0xd5'),{'UserId':Number(_0x595c50[_0xe523('0x43')]['ids']),'SmsAccountId':Number(_0x595c50[_0xe523('0x5a')]['id'])});}});}})[_0xe523('0x36')](respondWithStatusCode(_0x119ad3,null))[_0xe523('0x27')](handleError(_0x119ad3,null));};exports[_0xe523('0xd6')]=function(_0xc221ba,_0x596a8f,_0x2c0b21){var _0x3e9ce8={};var _0x3715cf={};var _0x4008f6;var _0x1e35ab;return db['SmsAccount'][_0xe523('0xb0')]({'where':{'id':_0xc221ba[_0xe523('0x5a')]['id']}})['then'](handleEntityNotFound(_0x596a8f,null))['then'](function(_0x2f1322){if(_0x2f1322){_0x4008f6=_0x2f1322;_0x3715cf[_0xe523('0x41')]=_['keys'](db[_0xe523('0xb5')][_0xe523('0x3e')]);_0x3715cf['query']=_[_0xe523('0x44')](_0xc221ba['query']);_0x3715cf[_0xe523('0x4e')]=_[_0xe523('0x45')](_0x3715cf[_0xe523('0x41')],_0x3715cf['query']);_0x3e9ce8['attributes']=_['intersection'](_0x3715cf[_0xe523('0x41')],qs['fields'](_0xc221ba[_0xe523('0x43')][_0xe523('0x46')]));_0x3e9ce8[_0xe523('0x47')]=_0x3e9ce8[_0xe523('0x47')]['length']?_0x3e9ce8[_0xe523('0x47')]:_0x3715cf[_0xe523('0x41')];_0x3e9ce8[_0xe523('0x4b')]=qs[_0xe523('0x4c')](_0xc221ba[_0xe523('0x43')][_0xe523('0x4c')]);_0x3e9ce8[_0xe523('0x4d')]=qs['filters'](_[_0xe523('0x4f')](_0xc221ba['query'],_0x3715cf[_0xe523('0x4e')]));if(_0xc221ba[_0xe523('0x43')][_0xe523('0x50')]){_0x3e9ce8[_0xe523('0x4d')]=_[_0xe523('0x51')](_0x3e9ce8[_0xe523('0x4d')],{'$or':_[_0xe523('0x42')](_0x3e9ce8[_0xe523('0x47')],function(_0x45b1dd){var _0x4bef41={};_0x4bef41[_0x45b1dd]={'$like':'%'+_0xc221ba[_0xe523('0x43')]['filter']+'%'};return _0x4bef41;})});}_0x3e9ce8=_[_0xe523('0x51')]({},_0x3e9ce8,_0xc221ba[_0xe523('0x54')]);return _0x4008f6['getAgents'](_0x3e9ce8);}})[_0xe523('0x36')](function(_0x657754){if(_0x657754){_0x1e35ab=_0x657754[_0xe523('0x48')];if(!_0xc221ba[_0xe523('0x43')][_0xe523('0x49')](_0xe523('0x4a'))){_0x3e9ce8[_0xe523('0x2c')]=qs['limit'](_0xc221ba['query']['limit']);_0x3e9ce8[_0xe523('0x2b')]=qs['offset'](_0xc221ba[_0xe523('0x43')][_0xe523('0x2b')]);}return _0x4008f6[_0xe523('0xd6')](_0x3e9ce8);}})['then'](function(_0x318333){if(_0x318333){return _0x318333?{'count':_0x1e35ab,'rows':_0x318333}:null;}})[_0xe523('0x36')](respondWithResult(_0x596a8f,null))[_0xe523('0x27')](handleError(_0x596a8f,null));}; \ No newline at end of file +var _0x8dca=['where','filters','pick','filter','merge','VIRTUAL','options','SmsAccount','findAll','rows','mandatoryDispositionPause','includeAll','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','SmsAccountId','Disposition','getDispositions','findOne','removeDispositions','CannedAnswer','removeAnswers','ids','notify','sms','SmsApplication','Applications','account','orderBy','asc','CmContact','Sequelize','no\x20available\x20attributes','updatedAt','difference','createdAt','CompanyId','mobile','twilio','From','Body','messageId','MessageSid','skebby','from','text','clicksend','plivo','Text','infobip','results','csc','originatingAddress','clickatell','fromNumber','replyMessageId','bandwidth','intelepeer','refid','isNil','ValidationError','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','ListId','DESC','list','Contacts','contact','SmsInteraction','spread','interaction','created','autoclose','applications','push','unmanaged','*,*,*,*','ContactId','AttachmentId','UserId','User','agent','waitForTheAssignedAgent','Start','startRouting','receiveMessage','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','text/xml','transaction','bulkCreate','priority','getApplications','getInteractions','include','Contact','Owner','fullname','internal','Tag','Tags','color','tag','send','to\x20is\x20mandatory','List','out','SmsMessage','Messages','dataValues','SmsAccount,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','skebby_dispatch_id','connectel','requestid','statusInt','message_id','status_code','groupName','DELIVERED','redif','error_code','inspect','DELIVERED_TO_GATEWAY','message-delivered','DELIVRD','ACCEPTD','state','message-id','addAgents','omit','emit','userSmsAccount:save','removeAgents','userSmsAccount:remove','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./smsAccount.socket','jayson/promise','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','destroy','get','SmsAccounts','UserProfileResource','stack','name','index','Pause','rawAttributes','fieldName','type','key','model','map','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort'];(function(_0x39e84d,_0x11931d){var _0x1991bc=function(_0xc81e32){while(--_0xc81e32){_0x39e84d['push'](_0x39e84d['shift']());}};_0x1991bc(++_0x11931d);}(_0x8dca,0x17a));var _0xa8dc=function(_0x5c2145,_0x17bd80){_0x5c2145=_0x5c2145-0x0;var _0x3ac93e=_0x8dca[_0x5c2145];return _0x3ac93e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa8dc('0x0'));var zipdir=require(_0xa8dc('0x1'));var jsonpatch=require(_0xa8dc('0x2'));var rp=require(_0xa8dc('0x3'));var moment=require(_0xa8dc('0x4'));var BPromise=require(_0xa8dc('0x5'));var Mustache=require(_0xa8dc('0x6'));var util=require(_0xa8dc('0x7'));var path=require(_0xa8dc('0x8'));var sox=require(_0xa8dc('0x9'));var csv=require('to-csv');var ejs=require(_0xa8dc('0xa'));var fs=require('fs');var fs_extra=require(_0xa8dc('0xb'));var _=require(_0xa8dc('0xc'));var squel=require(_0xa8dc('0xd'));var crypto=require(_0xa8dc('0xe'));var jsforce=require(_0xa8dc('0xf'));var deskjs=require(_0xa8dc('0x10'));var toCsv=require(_0xa8dc('0x11'));var querystring=require(_0xa8dc('0x12'));var Papa=require(_0xa8dc('0x13'));var Redis=require(_0xa8dc('0x14'));var authService=require(_0xa8dc('0x15'));var qs=require(_0xa8dc('0x16'));var as=require(_0xa8dc('0x17'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa8dc('0x18'))('api');var utils=require(_0xa8dc('0x19'));var config=require(_0xa8dc('0x1a'));var licenseUtil=require(_0xa8dc('0x1b'));var db=require(_0xa8dc('0x1c'))['db'];config[_0xa8dc('0x1d')]=_[_0xa8dc('0x1e')](config[_0xa8dc('0x1d')],{'host':_0xa8dc('0x1f'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa8dc('0x1d')]));require(_0xa8dc('0x20'))['register'](socket);var jayson=require(_0xa8dc('0x21'));var client=jayson['client']['http']({'port':0x232c});function respondWithRpcPromise(_0x5567b8,_0x4c44ff,_0x4e5036,_0x5469fc){return new BPromise(function(_0x14adce,_0x105a3f){var _0x170f47=_0x5469fc||client;return _0x170f47[_0xa8dc('0x22')](_0x5567b8,_0x4e5036)[_0xa8dc('0x23')](function(_0x3aaf6a){logger[_0xa8dc('0x24')](_0xa8dc('0x25'),_0x4c44ff,_0xa8dc('0x26'));logger[_0xa8dc('0x27')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x4c44ff,_0xa8dc('0x26'),JSON[_0xa8dc('0x28')](_0x3aaf6a));if(_0x3aaf6a['error']){if(_0x3aaf6a[_0xa8dc('0x29')][_0xa8dc('0x2a')]===0x1f4){logger[_0xa8dc('0x29')](_0xa8dc('0x25'),_0x4c44ff,_0x3aaf6a['error'][_0xa8dc('0x2b')]);return _0x105a3f(_0x3aaf6a[_0xa8dc('0x29')][_0xa8dc('0x2b')]);}logger[_0xa8dc('0x29')]('SmsAccount,\x20%s,\x20%s',_0x4c44ff,_0x3aaf6a[_0xa8dc('0x29')][_0xa8dc('0x2b')]);return _0x14adce(_0x3aaf6a[_0xa8dc('0x29')][_0xa8dc('0x2b')]);}else{logger['info'](_0xa8dc('0x25'),_0x4c44ff,_0xa8dc('0x26'));_0x14adce(_0x3aaf6a['result'][_0xa8dc('0x2b')]);}})[_0xa8dc('0x2c')](function(_0x58744f){logger[_0xa8dc('0x29')](_0xa8dc('0x25'),_0x4c44ff,_0x58744f);_0x105a3f(_0x58744f);});});}function respondWithStatusCode(_0x5b4f1d,_0xf8cc87){_0xf8cc87=_0xf8cc87||0xcc;return function(_0x433253){if(_0x433253){return _0x5b4f1d[_0xa8dc('0x2d')](_0xf8cc87);}return _0x5b4f1d[_0xa8dc('0x2e')](_0xf8cc87)[_0xa8dc('0x2f')]();};}function respondWithResult(_0x18f961,_0x2ce437){_0x2ce437=_0x2ce437||0xc8;return function(_0x5bff7e){if(_0x5bff7e){return _0x18f961[_0xa8dc('0x2e')](_0x2ce437)[_0xa8dc('0x30')](_0x5bff7e);}};}function respondWithFilteredResult(_0x2f19d4,_0x31b02a){return function(_0x27c6ee){if(_0x27c6ee){var _0x4de8b2=typeof _0x31b02a[_0xa8dc('0x31')]===_0xa8dc('0x32')&&typeof _0x31b02a[_0xa8dc('0x33')]===_0xa8dc('0x32');var _0x41a657=_0x27c6ee[_0xa8dc('0x34')];var _0x33ac5c=_0x4de8b2?0x0:_0x31b02a[_0xa8dc('0x31')];var _0x384def=_0x4de8b2?_0x27c6ee[_0xa8dc('0x34')]:_0x31b02a[_0xa8dc('0x31')]+_0x31b02a[_0xa8dc('0x33')];var _0x2ebec8;if(_0x384def>=_0x41a657){_0x384def=_0x41a657;_0x2ebec8=0xc8;}else{_0x2ebec8=0xce;}_0x2f19d4[_0xa8dc('0x2e')](_0x2ebec8);return _0x2f19d4[_0xa8dc('0x35')](_0xa8dc('0x36'),_0x33ac5c+'-'+_0x384def+'/'+_0x41a657)[_0xa8dc('0x30')](_0x27c6ee);}return null;};}function patchUpdates(_0x429df2){return function(_0x1e8981){try{jsonpatch[_0xa8dc('0x37')](_0x1e8981,_0x429df2,!![]);}catch(_0x4a955a){return BPromise['reject'](_0x4a955a);}return _0x1e8981[_0xa8dc('0x38')]();};}function saveUpdates(_0x4a183b,_0x5a5475){return function(_0x1eb019){if(_0x1eb019){return _0x1eb019[_0xa8dc('0x39')](_0x4a183b)[_0xa8dc('0x23')](function(_0x45bf9a){return _0x45bf9a;});}return null;};}function removeEntity(_0x37a3bc,_0x40f2e9){return function(_0x4d7634){if(_0x4d7634){return _0x4d7634[_0xa8dc('0x3a')]()['then'](function(){var _0x54facf=_0x4d7634[_0xa8dc('0x3b')]({'plain':!![]});var _0x306156=_0xa8dc('0x3c');return db[_0xa8dc('0x3d')][_0xa8dc('0x3a')]({'where':{'type':_0x306156,'resourceId':_0x54facf['id']}})[_0xa8dc('0x23')](function(){return _0x4d7634;});})[_0xa8dc('0x23')](function(){_0x37a3bc['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4134c2,_0x235dc4){return function(_0x228b78){if(!_0x228b78){_0x4134c2['sendStatus'](0x194);}return _0x228b78;};}function handleError(_0xba2f03,_0x252b03){_0x252b03=_0x252b03||0x1f4;return function(_0x39244b){logger[_0xa8dc('0x29')](_0x39244b[_0xa8dc('0x3e')]);if(_0x39244b['name']){delete _0x39244b[_0xa8dc('0x3f')];}_0xba2f03['status'](_0x252b03)['send'](_0x39244b);};}exports[_0xa8dc('0x40')]=function(_0x4417ee,_0x3c3fc3){var _0x44baf1={'include':[{'model':db[_0xa8dc('0x41')],'as':'mandatoryDispositionPause'}]},_0x4f8367={},_0x2ff6e5={'count':0x0,'rows':[]};var _0x23c6a1=_['map'](db['SmsAccount'][_0xa8dc('0x42')],function(_0x28002c){return{'name':_0x28002c[_0xa8dc('0x43')],'type':_0x28002c[_0xa8dc('0x44')][_0xa8dc('0x45')]};});_0x4f8367[_0xa8dc('0x46')]=_[_0xa8dc('0x47')](_0x23c6a1,_0xa8dc('0x3f'));_0x4f8367['query']=_[_0xa8dc('0x48')](_0x4417ee[_0xa8dc('0x49')]);_0x4f8367['filters']=_[_0xa8dc('0x4a')](_0x4f8367['model'],_0x4f8367[_0xa8dc('0x49')]);_0x44baf1[_0xa8dc('0x4b')]=_[_0xa8dc('0x4a')](_0x4f8367[_0xa8dc('0x46')],qs[_0xa8dc('0x4c')](_0x4417ee[_0xa8dc('0x49')][_0xa8dc('0x4c')]));_0x44baf1[_0xa8dc('0x4b')]=_0x44baf1['attributes'][_0xa8dc('0x4d')]?_0x44baf1[_0xa8dc('0x4b')]:_0x4f8367['model'];if(!_0x4417ee[_0xa8dc('0x49')][_0xa8dc('0x4e')](_0xa8dc('0x4f'))){_0x44baf1['limit']=qs[_0xa8dc('0x33')](_0x4417ee[_0xa8dc('0x49')][_0xa8dc('0x33')]);_0x44baf1[_0xa8dc('0x31')]=qs['offset'](_0x4417ee[_0xa8dc('0x49')][_0xa8dc('0x31')]);}_0x44baf1[_0xa8dc('0x50')]=qs['sort'](_0x4417ee[_0xa8dc('0x49')][_0xa8dc('0x51')]);_0x44baf1[_0xa8dc('0x52')]=qs[_0xa8dc('0x53')](_[_0xa8dc('0x54')](_0x4417ee[_0xa8dc('0x49')],_0x4f8367[_0xa8dc('0x53')]),_0x23c6a1);if(_0x4417ee[_0xa8dc('0x49')][_0xa8dc('0x55')]){_0x44baf1[_0xa8dc('0x52')]=_[_0xa8dc('0x56')](_0x44baf1[_0xa8dc('0x52')],{'$or':_[_0xa8dc('0x47')](_0x23c6a1,function(_0x45b4f2){if(_0x45b4f2[_0xa8dc('0x44')]!==_0xa8dc('0x57')){var _0x514db0={};_0x514db0[_0x45b4f2[_0xa8dc('0x3f')]]={'$like':'%'+_0x4417ee['query'][_0xa8dc('0x55')]+'%'};return _0x514db0;}})});}_0x44baf1=_[_0xa8dc('0x56')]({},_0x44baf1,_0x4417ee[_0xa8dc('0x58')]);var _0x500317={'where':_0x44baf1[_0xa8dc('0x52')]};return db[_0xa8dc('0x59')][_0xa8dc('0x34')](_0x500317)[_0xa8dc('0x23')](function(_0x254eec){_0x2ff6e5['count']=_0x254eec;if(_0x4417ee[_0xa8dc('0x49')]['includeAll']){_0x44baf1['include']=[{'all':!![]}];}return db['SmsAccount'][_0xa8dc('0x5a')](_0x44baf1);})[_0xa8dc('0x23')](function(_0x5aad48){_0x2ff6e5[_0xa8dc('0x5b')]=_0x5aad48;return _0x2ff6e5;})['then'](respondWithFilteredResult(_0x3c3fc3,_0x44baf1))[_0xa8dc('0x2c')](handleError(_0x3c3fc3,null));};exports['show']=function(_0x108d9a,_0x105e10){var _0x690d8f={'raw':![],'where':{'id':_0x108d9a['params']['id']},'include':[{'model':db[_0xa8dc('0x41')],'as':_0xa8dc('0x5c')}]},_0x38a8e6={};_0x38a8e6[_0xa8dc('0x46')]=_[_0xa8dc('0x48')](db[_0xa8dc('0x59')]['rawAttributes']);_0x38a8e6['query']=_[_0xa8dc('0x48')](_0x108d9a['query']);_0x38a8e6[_0xa8dc('0x53')]=_['intersection'](_0x38a8e6['model'],_0x38a8e6['query']);_0x690d8f[_0xa8dc('0x4b')]=_[_0xa8dc('0x4a')](_0x38a8e6[_0xa8dc('0x46')],qs[_0xa8dc('0x4c')](_0x108d9a['query'][_0xa8dc('0x4c')]));_0x690d8f[_0xa8dc('0x4b')]=_0x690d8f[_0xa8dc('0x4b')]['length']?_0x690d8f[_0xa8dc('0x4b')]:_0x38a8e6['model'];if(_0x108d9a[_0xa8dc('0x49')][_0xa8dc('0x5d')]){_0x690d8f['include']=[{'all':!![]}];}_0x690d8f=_[_0xa8dc('0x56')]({},_0x690d8f,_0x108d9a[_0xa8dc('0x58')]);return db[_0xa8dc('0x59')]['find'](_0x690d8f)[_0xa8dc('0x23')](handleEntityNotFound(_0x105e10,null))[_0xa8dc('0x23')](respondWithResult(_0x105e10,null))[_0xa8dc('0x2c')](handleError(_0x105e10,null));};exports[_0xa8dc('0x5e')]=function(_0x304550,_0x9e8aec){return db[_0xa8dc('0x59')]['create'](_0x304550[_0xa8dc('0x5f')],{})['then'](function(_0x20af6a){var _0x1d4825=_0x304550[_0xa8dc('0x60')][_0xa8dc('0x3b')]({'plain':!![]});if(!_0x1d4825)throw new Error(_0xa8dc('0x61'));if(_0x1d4825[_0xa8dc('0x62')]===_0xa8dc('0x60')){var _0x2200fe=_0x20af6a[_0xa8dc('0x3b')]({'plain':!![]});var _0x19e8a9=_0xa8dc('0x3c');return db[_0xa8dc('0x63')][_0xa8dc('0x64')]({'where':{'name':_0x19e8a9,'userProfileId':_0x1d4825['userProfileId']},'raw':!![]})['then'](function(_0x284990){if(_0x284990&&_0x284990[_0xa8dc('0x65')]===0x0){return db[_0xa8dc('0x3d')]['create']({'name':_0x2200fe[_0xa8dc('0x3f')],'resourceId':_0x2200fe['id'],'type':_0x284990[_0xa8dc('0x3f')],'sectionId':_0x284990['id']},{})[_0xa8dc('0x23')](function(){return _0x20af6a;});}else{return _0x20af6a;}})[_0xa8dc('0x2c')](function(_0x1e0c45){logger[_0xa8dc('0x29')](_0xa8dc('0x66'),_0x1e0c45);throw _0x1e0c45;});}return _0x20af6a;})['then'](respondWithResult(_0x9e8aec,0xc9))[_0xa8dc('0x2c')](handleError(_0x9e8aec,null));};exports[_0xa8dc('0x39')]=function(_0x478492,_0x1d8bae){if(_0x478492[_0xa8dc('0x5f')]['id']){delete _0x478492[_0xa8dc('0x5f')]['id'];}return db[_0xa8dc('0x59')][_0xa8dc('0x64')]({'where':{'id':_0x478492[_0xa8dc('0x67')]['id']},'include':[{'model':db[_0xa8dc('0x41')],'as':_0xa8dc('0x5c')}]})['then'](handleEntityNotFound(_0x1d8bae,null))[_0xa8dc('0x23')](saveUpdates(_0x478492[_0xa8dc('0x5f')],null))[_0xa8dc('0x23')](respondWithResult(_0x1d8bae,null))['catch'](handleError(_0x1d8bae,null));};exports[_0xa8dc('0x3a')]=function(_0x2c5beb,_0x44578a){return db[_0xa8dc('0x59')][_0xa8dc('0x64')]({'where':{'id':_0x2c5beb[_0xa8dc('0x67')]['id']}})[_0xa8dc('0x23')](handleEntityNotFound(_0x44578a,null))['then'](removeEntity(_0x44578a,null))[_0xa8dc('0x2c')](handleError(_0x44578a,null));};exports['describe']=function(_0x749394,_0x455c2a){return db[_0xa8dc('0x59')][_0xa8dc('0x68')]()[_0xa8dc('0x23')](respondWithResult(_0x455c2a,null))['catch'](handleError(_0x455c2a,null));};exports[_0xa8dc('0x69')]=function(_0x545b6f,_0x2c95a6,_0x261334){if(_0x545b6f['body']['id']){delete _0x545b6f[_0xa8dc('0x5f')]['id'];}return db[_0xa8dc('0x59')][_0xa8dc('0x64')]({'where':{'id':_0x545b6f['params']['id']}})['then'](handleEntityNotFound(_0x2c95a6,null))[_0xa8dc('0x23')](function(_0x4b7be7){if(_0x4b7be7){_0x545b6f[_0xa8dc('0x5f')][_0xa8dc('0x6a')]=_0x4b7be7['id'];return db[_0xa8dc('0x6b')][_0xa8dc('0x5e')](_0x545b6f[_0xa8dc('0x5f')]);}})['then'](respondWithResult(_0x2c95a6,null))['catch'](handleError(_0x2c95a6,null));};exports[_0xa8dc('0x6c')]=function(_0x4a470f,_0x1ff423,_0x2db916){var _0x53c940={'raw':![],'where':{}};var _0x47b987={};var _0x2e6d9f={'count':0x0,'rows':[]};return db['SmsAccount'][_0xa8dc('0x6d')]({'where':{'id':_0x4a470f[_0xa8dc('0x67')]['id']}})[_0xa8dc('0x23')](handleEntityNotFound(_0x1ff423,null))[_0xa8dc('0x23')](function(_0x4555d0){if(_0x4555d0){_0x47b987[_0xa8dc('0x46')]=_[_0xa8dc('0x48')](db[_0xa8dc('0x6b')][_0xa8dc('0x42')]);_0x47b987[_0xa8dc('0x49')]=_[_0xa8dc('0x48')](_0x4a470f['query']);_0x47b987[_0xa8dc('0x53')]=_[_0xa8dc('0x4a')](_0x47b987[_0xa8dc('0x46')],_0x47b987[_0xa8dc('0x49')]);_0x53c940[_0xa8dc('0x4b')]=_[_0xa8dc('0x4a')](_0x47b987[_0xa8dc('0x46')],qs[_0xa8dc('0x4c')](_0x4a470f[_0xa8dc('0x49')]['fields']));_0x53c940['attributes']=_0x53c940['attributes'][_0xa8dc('0x4d')]?_0x53c940[_0xa8dc('0x4b')]:_0x47b987['model'];if(!_0x4a470f[_0xa8dc('0x49')][_0xa8dc('0x4e')](_0xa8dc('0x4f'))){_0x53c940[_0xa8dc('0x33')]=qs['limit'](_0x4a470f[_0xa8dc('0x49')]['limit']);_0x53c940[_0xa8dc('0x31')]=qs[_0xa8dc('0x31')](_0x4a470f[_0xa8dc('0x49')][_0xa8dc('0x31')]);}_0x53c940[_0xa8dc('0x50')]=qs['sort'](_0x4a470f[_0xa8dc('0x49')][_0xa8dc('0x51')]);_0x53c940[_0xa8dc('0x52')]=qs[_0xa8dc('0x53')](_[_0xa8dc('0x54')](_0x4a470f[_0xa8dc('0x49')],_0x47b987[_0xa8dc('0x53')]));_0x53c940[_0xa8dc('0x52')][_0xa8dc('0x6a')]=_0x4555d0['id'];if(_0x4a470f[_0xa8dc('0x49')][_0xa8dc('0x55')]){_0x53c940['where']=_[_0xa8dc('0x56')](_0x53c940['where'],{'$or':_[_0xa8dc('0x47')](_0x53c940['attributes'],function(_0x22b461){var _0x54b310={};_0x54b310[_0x22b461]={'$like':'%'+_0x4a470f[_0xa8dc('0x49')]['filter']+'%'};return _0x54b310;})});}_0x53c940=_['merge']({},_0x53c940,_0x4a470f[_0xa8dc('0x58')]);return db['Disposition'][_0xa8dc('0x34')]({'where':_0x53c940[_0xa8dc('0x52')]})[_0xa8dc('0x23')](function(_0x4af75d){_0x2e6d9f[_0xa8dc('0x34')]=_0x4af75d;if(_0x4a470f[_0xa8dc('0x49')]['includeAll']){_0x53c940['include']=[{'all':!![]}];}return db[_0xa8dc('0x6b')][_0xa8dc('0x5a')](_0x53c940);})[_0xa8dc('0x23')](function(_0x455f83){_0x2e6d9f[_0xa8dc('0x5b')]=_0x455f83;return _0x2e6d9f;});}})[_0xa8dc('0x23')](respondWithFilteredResult(_0x1ff423,_0x53c940))[_0xa8dc('0x2c')](handleError(_0x1ff423,null));};exports[_0xa8dc('0x6e')]=function(_0x52dd60,_0x3e2854,_0x29381b){return db[_0xa8dc('0x59')]['find']({'where':{'id':_0x52dd60[_0xa8dc('0x67')]['id']}})['then'](handleEntityNotFound(_0x3e2854,null))['then'](function(_0x3a604d){if(_0x3a604d){return _0x3a604d['removeDispositions'](_0x52dd60[_0xa8dc('0x49')]['ids']);}})[_0xa8dc('0x23')](respondWithStatusCode(_0x3e2854,null))[_0xa8dc('0x2c')](handleError(_0x3e2854,null));};exports['addAnswer']=function(_0x256242,_0x33a092,_0x555340){if(_0x256242[_0xa8dc('0x5f')]['id']){delete _0x256242['body']['id'];}return db[_0xa8dc('0x59')][_0xa8dc('0x64')]({'where':{'id':_0x256242[_0xa8dc('0x67')]['id']}})['then'](handleEntityNotFound(_0x33a092,null))[_0xa8dc('0x23')](function(_0x50bfef){if(_0x50bfef){_0x256242['body'][_0xa8dc('0x6a')]=_0x50bfef['id'];return db[_0xa8dc('0x6f')][_0xa8dc('0x5e')](_0x256242[_0xa8dc('0x5f')]);}})['then'](respondWithResult(_0x33a092,null))[_0xa8dc('0x2c')](handleError(_0x33a092,null));};exports['getAnswers']=function(_0x48250c,_0x3a05ef,_0xce6470){var _0x47aa97={'raw':![],'where':{}};var _0xd2a5cc={};var _0x3f851e={'count':0x0,'rows':[]};return db['SmsAccount'][_0xa8dc('0x6d')]({'where':{'id':_0x48250c[_0xa8dc('0x67')]['id']}})[_0xa8dc('0x23')](handleEntityNotFound(_0x3a05ef,null))[_0xa8dc('0x23')](function(_0x109bd1){if(_0x109bd1){_0xd2a5cc['model']=_['keys'](db[_0xa8dc('0x6f')]['rawAttributes']);_0xd2a5cc[_0xa8dc('0x49')]=_[_0xa8dc('0x48')](_0x48250c[_0xa8dc('0x49')]);_0xd2a5cc[_0xa8dc('0x53')]=_['intersection'](_0xd2a5cc[_0xa8dc('0x46')],_0xd2a5cc['query']);_0x47aa97[_0xa8dc('0x4b')]=_[_0xa8dc('0x4a')](_0xd2a5cc[_0xa8dc('0x46')],qs[_0xa8dc('0x4c')](_0x48250c[_0xa8dc('0x49')][_0xa8dc('0x4c')]));_0x47aa97[_0xa8dc('0x4b')]=_0x47aa97['attributes'][_0xa8dc('0x4d')]?_0x47aa97[_0xa8dc('0x4b')]:_0xd2a5cc[_0xa8dc('0x46')];if(!_0x48250c['query'][_0xa8dc('0x4e')](_0xa8dc('0x4f'))){_0x47aa97['limit']=qs[_0xa8dc('0x33')](_0x48250c[_0xa8dc('0x49')][_0xa8dc('0x33')]);_0x47aa97['offset']=qs[_0xa8dc('0x31')](_0x48250c[_0xa8dc('0x49')][_0xa8dc('0x31')]);}_0x47aa97['order']=qs['sort'](_0x48250c['query'][_0xa8dc('0x51')]);_0x47aa97[_0xa8dc('0x52')]=qs['filters'](_['pick'](_0x48250c['query'],_0xd2a5cc[_0xa8dc('0x53')]));_0x47aa97[_0xa8dc('0x52')][_0xa8dc('0x6a')]=_0x109bd1['id'];if(_0x48250c[_0xa8dc('0x49')][_0xa8dc('0x55')]){_0x47aa97[_0xa8dc('0x52')]=_[_0xa8dc('0x56')](_0x47aa97[_0xa8dc('0x52')],{'$or':_[_0xa8dc('0x47')](_0x47aa97[_0xa8dc('0x4b')],function(_0x3d61d6){var _0x1cd1af={};_0x1cd1af[_0x3d61d6]={'$like':'%'+_0x48250c['query']['filter']+'%'};return _0x1cd1af;})});}_0x47aa97=_[_0xa8dc('0x56')]({},_0x47aa97,_0x48250c[_0xa8dc('0x58')]);return db[_0xa8dc('0x6f')][_0xa8dc('0x34')]({'where':_0x47aa97[_0xa8dc('0x52')]})[_0xa8dc('0x23')](function(_0x239c18){_0x3f851e['count']=_0x239c18;if(_0x48250c[_0xa8dc('0x49')][_0xa8dc('0x5d')]){_0x47aa97['include']=[{'all':!![]}];}return db[_0xa8dc('0x6f')]['findAll'](_0x47aa97);})['then'](function(_0x1e6d7f){_0x3f851e[_0xa8dc('0x5b')]=_0x1e6d7f;return _0x3f851e;});}})['then'](respondWithFilteredResult(_0x3a05ef,_0x47aa97))['catch'](handleError(_0x3a05ef,null));};exports[_0xa8dc('0x70')]=function(_0x301f12,_0x1456bd,_0x532b8f){return db[_0xa8dc('0x59')][_0xa8dc('0x64')]({'where':{'id':_0x301f12[_0xa8dc('0x67')]['id']}})['then'](handleEntityNotFound(_0x1456bd,null))[_0xa8dc('0x23')](function(_0x4a8e9c){if(_0x4a8e9c){return _0x4a8e9c['removeAnswers'](_0x301f12[_0xa8dc('0x49')][_0xa8dc('0x71')]);}})[_0xa8dc('0x23')](respondWithStatusCode(_0x1456bd,null))[_0xa8dc('0x2c')](handleError(_0x1456bd,null));};exports[_0xa8dc('0x72')]=function(_0x5c678b,_0x10337e,_0x28d51a){var _0x5b0d6f={'channel':_0xa8dc('0x73')};var _0x32bf51=[];var _0x128649=[];var _0x4e3be9={};return db[_0xa8dc('0x59')][_0xa8dc('0x64')]({'where':{'id':_0x5c678b[_0xa8dc('0x67')]['id']},'include':[{'model':db[_0xa8dc('0x74')],'as':_0xa8dc('0x75')}]})['then'](handleEntityNotFound(_0x10337e,null))[_0xa8dc('0x23')](function(_0x6894e4){_0x5b0d6f[_0xa8dc('0x76')]=_0x6894e4;_0x5b0d6f['applications']=_[_0xa8dc('0x77')](_0x6894e4[_0xa8dc('0x75')],['priority'],[_0xa8dc('0x78')]);if(_0x5b0d6f[_0xa8dc('0x76')]['Applications']){delete _0x5b0d6f[_0xa8dc('0x76')][_0xa8dc('0x75')];}return db[_0xa8dc('0x79')][_0xa8dc('0x68')]();})[_0xa8dc('0x23')](function(_0x30dab6){if(!_0x30dab6){throw new db[(_0xa8dc('0x7a'))]['ValidationError'](_0xa8dc('0x7b'));}_0x32bf51=_['difference'](_['keys'](_0x30dab6),['createdAt',_0xa8dc('0x7c')]);_0x128649=_[_0xa8dc('0x7d')](_['keys'](_0x30dab6),[_0xa8dc('0x7e'),_0xa8dc('0x7c'),_0xa8dc('0x7f'),'ListId']);_0x5b0d6f[_0xa8dc('0x5f')]={'mapKey':_0xa8dc('0x80')};if(_0x5b0d6f[_0xa8dc('0x76')]['type']){switch(_0x5b0d6f[_0xa8dc('0x76')]['type']){case _0xa8dc('0x81'):_0x5b0d6f[_0xa8dc('0x5f')]['from']=_0x5c678b[_0xa8dc('0x5f')][_0xa8dc('0x82')];_0x5b0d6f[_0xa8dc('0x5f')][_0xa8dc('0x5f')]=_0x5c678b[_0xa8dc('0x5f')][_0xa8dc('0x83')];_0x5b0d6f['body'][_0xa8dc('0x84')]=_0x5c678b['body'][_0xa8dc('0x85')];break;case _0xa8dc('0x86'):_0x5b0d6f[_0xa8dc('0x5f')][_0xa8dc('0x87')]='+'+_0x5c678b[_0xa8dc('0x5f')]['sender'];_0x5b0d6f[_0xa8dc('0x5f')][_0xa8dc('0x5f')]=_0x5c678b[_0xa8dc('0x5f')][_0xa8dc('0x88')];break;case'connectel':_0x5b0d6f[_0xa8dc('0x5f')][_0xa8dc('0x87')]=_0x5c678b[_0xa8dc('0x5f')][_0xa8dc('0x87')];_0x5b0d6f[_0xa8dc('0x5f')][_0xa8dc('0x5f')]=_0x5c678b[_0xa8dc('0x5f')][_0xa8dc('0x2b')];break;case _0xa8dc('0x89'):_0x5b0d6f[_0xa8dc('0x5f')][_0xa8dc('0x87')]=_0x5c678b[_0xa8dc('0x5f')]['from'];_0x5b0d6f[_0xa8dc('0x5f')][_0xa8dc('0x5f')]=_0x5c678b[_0xa8dc('0x5f')][_0xa8dc('0x5f')];_0x5b0d6f[_0xa8dc('0x5f')][_0xa8dc('0x84')]=_0x5c678b[_0xa8dc('0x5f')]['message_id'];break;case _0xa8dc('0x8a'):_0x5b0d6f[_0xa8dc('0x5f')][_0xa8dc('0x87')]=_0x5c678b[_0xa8dc('0x5f')][_0xa8dc('0x82')];_0x5b0d6f[_0xa8dc('0x5f')]['body']=_0x5c678b[_0xa8dc('0x5f')][_0xa8dc('0x8b')];_0x5b0d6f[_0xa8dc('0x5f')]['messageId']=_0x5c678b[_0xa8dc('0x5f')]['MessageUUID'];break;case _0xa8dc('0x8c'):_0x5b0d6f['body'][_0xa8dc('0x87')]='+'+_0x5c678b[_0xa8dc('0x5f')][_0xa8dc('0x8d')][0x0]['from'];_0x5b0d6f[_0xa8dc('0x5f')][_0xa8dc('0x5f')]=_0x5c678b[_0xa8dc('0x5f')][_0xa8dc('0x8d')][0x0][_0xa8dc('0x88')];_0x5b0d6f['body']['messageId']=_0x5c678b[_0xa8dc('0x5f')][_0xa8dc('0x8d')][0x0]['messageId'];break;case _0xa8dc('0x8e'):_0x5b0d6f['body'][_0xa8dc('0x87')]=_0x5c678b['body'][_0xa8dc('0x8f')];_0x5b0d6f[_0xa8dc('0x5f')][_0xa8dc('0x5f')]=_0x5c678b[_0xa8dc('0x5f')]['segmentedMessage']['message'];break;case _0xa8dc('0x90'):_0x5b0d6f[_0xa8dc('0x5f')][_0xa8dc('0x87')]=_0x5c678b['body'][_0xa8dc('0x91')];_0x5b0d6f['body']['body']=_0x5c678b[_0xa8dc('0x5f')][_0xa8dc('0x88')];_0x5b0d6f[_0xa8dc('0x5f')][_0xa8dc('0x84')]=_0x5c678b['body'][_0xa8dc('0x92')];break;case _0xa8dc('0x93'):_0x5b0d6f[_0xa8dc('0x5f')]['messageId']=_0x5c678b[_0xa8dc('0x5f')][0x0]['message']['id'];_0x5b0d6f[_0xa8dc('0x5f')]['from']=_0x5c678b[_0xa8dc('0x5f')][0x0][_0xa8dc('0x2b')][_0xa8dc('0x87')];_0x5b0d6f['body'][_0xa8dc('0x5f')]=_0x5c678b[_0xa8dc('0x5f')][0x0][_0xa8dc('0x2b')][_0xa8dc('0x88')];break;case _0xa8dc('0x94'):_0x5b0d6f[_0xa8dc('0x5f')]['from']=_0x5c678b[_0xa8dc('0x5f')]['from'];_0x5b0d6f[_0xa8dc('0x5f')][_0xa8dc('0x5f')]=_0x5c678b['body'][_0xa8dc('0x2b')];_0x5b0d6f[_0xa8dc('0x5f')]['messageId']=_0x5c678b[_0xa8dc('0x5f')][_0xa8dc('0x95')];break;}}if(_0x5b0d6f[_0xa8dc('0x5f')]['id']){delete _0x5b0d6f['body']['id'];}if(_[_0xa8dc('0x96')](_0x5b0d6f[_0xa8dc('0x5f')][_0xa8dc('0x87')])){throw new db[(_0xa8dc('0x7a'))][(_0xa8dc('0x97'))](_0xa8dc('0x98'));}if(_['isNil'](_0x5b0d6f[_0xa8dc('0x5f')][_0xa8dc('0x5f')])||_0x5b0d6f['body'][_0xa8dc('0x5f')]===''){throw new db['Sequelize'][(_0xa8dc('0x97'))](_0xa8dc('0x99'));}if(_[_0xa8dc('0x96')](_0x5b0d6f[_0xa8dc('0x5f')][_0xa8dc('0x9a')])){throw new db[(_0xa8dc('0x7a'))]['ValidationError']('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x128649);}if(!_['includes'](_0x128649,_0x5b0d6f[_0xa8dc('0x5f')][_0xa8dc('0x9a')])){throw new db[(_0xa8dc('0x7a'))][(_0xa8dc('0x97'))](_0xa8dc('0x9b')+_0x128649);}_0x4e3be9[_0x5b0d6f[_0xa8dc('0x5f')][_0xa8dc('0x9a')]]=_0x5b0d6f['body']['from'];return db[_0xa8dc('0x9c')][_0xa8dc('0x64')]({'where':{'id':_0x5b0d6f['account'][_0xa8dc('0x9d')]},'include':[{'model':db[_0xa8dc('0x79')],'as':'Contacts','where':_0x4e3be9,'limit':0x1,'order':[[_0xa8dc('0x7c'),_0xa8dc('0x9e')]]}]});})[_0xa8dc('0x23')](handleEntityNotFound(_0x10337e,null))[_0xa8dc('0x23')](function(_0x4e9dc8){if(_0x4e9dc8){_0x5b0d6f[_0xa8dc('0x9f')]=_['omit'](_0x4e9dc8,[_0xa8dc('0xa0')]);if(_0x4e9dc8['Contacts'][_0xa8dc('0x4d')]){return _0x4e9dc8[_0xa8dc('0xa0')][0x0];}var _0xfa34b2=_[_0xa8dc('0x1e')](_0x5b0d6f[_0xa8dc('0x5f')],{'firstName':_0x5b0d6f['body'][_0xa8dc('0x87')],'ListId':_0x4e9dc8['id']});_0xfa34b2[_0x5b0d6f[_0xa8dc('0x5f')]['mapKey']]=_0x5b0d6f['body'][_0xa8dc('0x87')];return db[_0xa8dc('0x79')][_0xa8dc('0x5e')](_0xfa34b2,{'fields':_0x32bf51,'raw':!![]});}})[_0xa8dc('0x23')](handleEntityNotFound(_0x10337e,null))[_0xa8dc('0x23')](function(_0x23ce32){if(_0x23ce32){_0x5b0d6f[_0xa8dc('0xa1')]=_0x23ce32;var _0x52e233={'ContactId':_0x23ce32['id'],'phone':_0x5b0d6f[_0xa8dc('0x5f')]['from'],'SmsAccountId':_0x5c678b[_0xa8dc('0x67')]['id']};var _0x2d4ccd={'ContactId':_0x23ce32['id'],'SmsAccountId':_0x5c678b['params']['id'],'closed':![]};return db[_0xa8dc('0xa2')]['find']({'where':_0x2d4ccd})[_0xa8dc('0x23')](function(_0x259d6c){if(_0x259d6c){return[_0x259d6c,![]];}return db[_0xa8dc('0xa2')][_0xa8dc('0x5e')](_0x52e233)[_0xa8dc('0x23')](function(_0x24ef04){return[_0x24ef04,!![]];});});}})[_0xa8dc('0xa3')](function(_0x441750,_0x2d3eee){_0x5b0d6f[_0xa8dc('0xa4')]=_0x441750['get']({'plain':!![]});_0x5b0d6f[_0xa8dc('0xa4')][_0xa8dc('0xa5')]=![];if(_0x2d3eee){if(_0x5b0d6f[_0xa8dc('0x76')][_0xa8dc('0xa6')]){_0x5b0d6f[_0xa8dc('0xa7')][_0xa8dc('0xa8')]({'id':0x0,'priority':_0x5b0d6f[_0xa8dc('0xa7')][_0xa8dc('0x4d')]+0x1,'app':'close','appdata':_0xa8dc('0xa9'),'interval':_0xa8dc('0xaa')});}_0x5b0d6f[_0xa8dc('0xa4')][_0xa8dc('0xa5')]=!![];}return db['SmsMessage'][_0xa8dc('0x5e')]({'phone':_0x5b0d6f['body'][_0xa8dc('0x87')],'messageId':_0x5b0d6f['body'][_0xa8dc('0x84')],'body':_0x5b0d6f['body'][_0xa8dc('0x5f')],'SmsAccountId':_0x5c678b[_0xa8dc('0x67')]['id'],'SmsInteractionId':_0x441750['id'],'direction':'in','ContactId':_0x441750[_0xa8dc('0xab')],'AttachmentId':_0x5b0d6f[_0xa8dc('0x5f')][_0xa8dc('0xac')]});})[_0xa8dc('0x23')](function(_0x39c7b3){_0x5b0d6f[_0xa8dc('0x2b')]=_0x39c7b3;if(_0x5b0d6f[_0xa8dc('0xa4')][_0xa8dc('0xad')]){return db[_0xa8dc('0xae')]['find']({'attributes':['id','name'],'where':{'id':_0x5b0d6f[_0xa8dc('0xa4')][_0xa8dc('0xad')]}})[_0xa8dc('0x23')](function(_0x3282b1){if(_0x3282b1){_0x5b0d6f[_0xa8dc('0xa7')]['unshift']({'id':0x0,'priority':0x0,'app':_0xa8dc('0xaf'),'appdata':_0x3282b1[_0xa8dc('0x3f')]+','+(_0x5b0d6f[_0xa8dc('0x76')][_0xa8dc('0xb0')]||0xa),'interval':_0xa8dc('0xaa')});}return respondWithRpcPromise(_0xa8dc('0xb1'),_0xa8dc('0xb2'),_0x5b0d6f);});}return respondWithRpcPromise(_0xa8dc('0xb1'),_0xa8dc('0xb2'),_0x5b0d6f);})[_0xa8dc('0x23')](function(_0xa48f83){if(_0xa48f83){var _0x261cfa=0xc8;var _0x417983=_0xa8dc('0xb3');logger[_0xa8dc('0x24')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x417983,_0x261cfa,'entity\x20found');logger[_0xa8dc('0x27')](_0xa8dc('0xb4'),_0x417983,_0x261cfa,'entity\x20found',JSON['stringify'](_0xa48f83));if(_0x5b0d6f[_0xa8dc('0x76')][_0xa8dc('0x44')]===_0xa8dc('0x81')){return _0x10337e['status'](_0x261cfa)['set'](_0xa8dc('0xb5'),_0xa8dc('0xb6'))['send']('\x0a');}else{return _0x10337e[_0xa8dc('0x2e')](_0x261cfa)[_0xa8dc('0x30')](_0xa48f83);}}})['catch'](handleError(_0x10337e,null));};exports['addApplications']=function(_0x587a67,_0x1f91c4,_0x5efcbb){return db['SmsAccount'][_0xa8dc('0x6d')]({'where':{'id':_0x587a67[_0xa8dc('0x67')]['id']}})[_0xa8dc('0x23')](handleEntityNotFound(_0x1f91c4,null))[_0xa8dc('0x23')](function(_0x5ea257){if(_0x5ea257){return db['sequelize'][_0xa8dc('0xb7')](function(_0x4b17ac){return db['SmsApplication'][_0xa8dc('0x3a')]({'where':{'SmsAccountId':_0x587a67['params']['id']},'transaction':_0x4b17ac})[_0xa8dc('0x23')](function(_0x4df0a4){var _0x51e4bd=_[_0xa8dc('0x47')](_0x587a67['body'],function(_0x2f5b31){_0x2f5b31[_0xa8dc('0x6a')]=_0x587a67['params']['id'];return _0x2f5b31;});return db[_0xa8dc('0x74')][_0xa8dc('0xb8')](_0x51e4bd,{'transaction':_0x4b17ac});});})['then'](function(){return db[_0xa8dc('0x74')]['findAndCountAll']({'where':{'SmsAccountId':_0x587a67[_0xa8dc('0x67')]['id']},'order':_0xa8dc('0xb9')});});}})[_0xa8dc('0x23')](respondWithResult(_0x1f91c4,null))['catch'](handleError(_0x1f91c4,null));};exports[_0xa8dc('0xba')]=function(_0x3e321c,_0x206b41,_0x513d75){var _0x891137={};var _0x292bea={};var _0x49e36d;var _0x426628;return db[_0xa8dc('0x59')][_0xa8dc('0x6d')]({'where':{'id':_0x3e321c[_0xa8dc('0x67')]['id']}})['then'](handleEntityNotFound(_0x206b41,null))[_0xa8dc('0x23')](function(_0xd7b2f8){if(_0xd7b2f8){_0x49e36d=_0xd7b2f8;_0x292bea[_0xa8dc('0x46')]=_[_0xa8dc('0x48')](db[_0xa8dc('0x74')][_0xa8dc('0x42')]);_0x292bea[_0xa8dc('0x49')]=_[_0xa8dc('0x48')](_0x3e321c[_0xa8dc('0x49')]);_0x292bea[_0xa8dc('0x53')]=_[_0xa8dc('0x4a')](_0x292bea[_0xa8dc('0x46')],_0x292bea['query']);_0x891137[_0xa8dc('0x4b')]=_['intersection'](_0x292bea[_0xa8dc('0x46')],qs[_0xa8dc('0x4c')](_0x3e321c[_0xa8dc('0x49')][_0xa8dc('0x4c')]));_0x891137[_0xa8dc('0x4b')]=_0x891137[_0xa8dc('0x4b')][_0xa8dc('0x4d')]?_0x891137[_0xa8dc('0x4b')]:_0x292bea[_0xa8dc('0x46')];_0x891137['order']=qs[_0xa8dc('0x51')](_0x3e321c[_0xa8dc('0x49')][_0xa8dc('0x51')]);_0x891137[_0xa8dc('0x52')]=qs[_0xa8dc('0x53')](_[_0xa8dc('0x54')](_0x3e321c[_0xa8dc('0x49')],_0x292bea['filters']));if(_0x3e321c['query'][_0xa8dc('0x55')]){_0x891137[_0xa8dc('0x52')]=_[_0xa8dc('0x56')](_0x891137[_0xa8dc('0x52')],{'$or':_['map'](_0x891137[_0xa8dc('0x4b')],function(_0x16f5b9){var _0x134d7c={};_0x134d7c[_0x16f5b9]={'$like':'%'+_0x3e321c[_0xa8dc('0x49')][_0xa8dc('0x55')]+'%'};return _0x134d7c;})});}_0x891137=_['merge']({},_0x891137,_0x3e321c[_0xa8dc('0x58')]);return _0x49e36d['getApplications'](_0x891137);}})[_0xa8dc('0x23')](function(_0x1995e5){if(_0x1995e5){_0x426628=_0x1995e5['length'];if(!_0x3e321c['query'][_0xa8dc('0x4e')](_0xa8dc('0x4f'))){_0x891137[_0xa8dc('0x33')]=qs[_0xa8dc('0x33')](_0x3e321c[_0xa8dc('0x49')][_0xa8dc('0x33')]);_0x891137[_0xa8dc('0x31')]=qs[_0xa8dc('0x31')](_0x3e321c['query'][_0xa8dc('0x31')]);}return _0x49e36d[_0xa8dc('0xba')](_0x891137);}})[_0xa8dc('0x23')](function(_0x14de33){if(_0x14de33){return _0x14de33?{'count':_0x426628,'rows':_0x14de33}:null;}})[_0xa8dc('0x23')](respondWithResult(_0x206b41,null))['catch'](handleError(_0x206b41,null));};exports[_0xa8dc('0xbb')]=function(_0x4a8827,_0x31693e,_0x49cd61){var _0x1e2122={'raw':![],'where':{}};var _0x4f226a={};var _0x3ecd42={'count':0x0,'rows':[]};return db['SmsAccount'][_0xa8dc('0x6d')]({'where':{'id':_0x4a8827['params']['id']}})[_0xa8dc('0x23')](handleEntityNotFound(_0x31693e,null))[_0xa8dc('0x23')](function(_0x45a5af){if(_0x45a5af){_0x4f226a[_0xa8dc('0x46')]=_[_0xa8dc('0x48')](db['SmsInteraction']['rawAttributes']);_0x4f226a['query']=_[_0xa8dc('0x48')](_0x4a8827[_0xa8dc('0x49')]);_0x4f226a[_0xa8dc('0x53')]=_[_0xa8dc('0x4a')](_0x4f226a['model'],_0x4f226a[_0xa8dc('0x49')]);_0x1e2122[_0xa8dc('0x4b')]=_['intersection'](_0x4f226a[_0xa8dc('0x46')],qs[_0xa8dc('0x4c')](_0x4a8827['query'][_0xa8dc('0x4c')]));_0x1e2122['attributes']=_0x1e2122[_0xa8dc('0x4b')][_0xa8dc('0x4d')]?_0x1e2122[_0xa8dc('0x4b')]:_0x4f226a['model'];if(!_0x4a8827['query'][_0xa8dc('0x4e')](_0xa8dc('0x4f'))){_0x1e2122[_0xa8dc('0x33')]=qs[_0xa8dc('0x33')](_0x4a8827['query'][_0xa8dc('0x33')]);_0x1e2122['offset']=qs[_0xa8dc('0x31')](_0x4a8827[_0xa8dc('0x49')][_0xa8dc('0x31')]);}_0x1e2122['order']=qs['sort'](_0x4a8827[_0xa8dc('0x49')][_0xa8dc('0x51')]);_0x1e2122['where']=qs['filters'](_[_0xa8dc('0x54')](_0x4a8827[_0xa8dc('0x49')],_0x4f226a[_0xa8dc('0x53')]));_0x1e2122[_0xa8dc('0x52')][_0xa8dc('0x6a')]=_0x45a5af['id'];if(_0x4a8827['query'][_0xa8dc('0x55')]){_0x1e2122[_0xa8dc('0x52')]=_['merge'](_0x1e2122[_0xa8dc('0x52')],{'$or':_[_0xa8dc('0x47')](_0x1e2122[_0xa8dc('0x4b')],function(_0xa9a54f){var _0x441080={};_0x441080[_0xa9a54f]={'$like':'%'+_0x4a8827[_0xa8dc('0x49')][_0xa8dc('0x55')]+'%'};return _0x441080;})});}_0x1e2122=_[_0xa8dc('0x56')]({},_0x1e2122,_0x4a8827['options']);return db[_0xa8dc('0xa2')][_0xa8dc('0x34')]({'where':_0x1e2122[_0xa8dc('0x52')]})['then'](function(_0x3ddd2c){_0x3ecd42['count']=_0x3ddd2c;if(_0x4a8827[_0xa8dc('0x49')][_0xa8dc('0x5d')]){_0x1e2122[_0xa8dc('0xbc')]=[{'model':db[_0xa8dc('0x79')],'as':_0xa8dc('0xbd'),'required':![]},{'model':db[_0xa8dc('0xae')],'as':_0xa8dc('0xbe'),'attributes':[_0xa8dc('0x3f'),_0xa8dc('0xbf'),_0xa8dc('0xc0')],'required':![]},{'model':db[_0xa8dc('0xc1')],'as':_0xa8dc('0xc2'),'attributes':['id',_0xa8dc('0x3f'),_0xa8dc('0xc3')],'where':_0x4a8827[_0xa8dc('0x49')][_0xa8dc('0xc4')]?{'id':_0x4a8827[_0xa8dc('0x49')][_0xa8dc('0xc4')]}:undefined,'required':_0x4a8827[_0xa8dc('0x49')][_0xa8dc('0xc4')]?!![]:![]}];}return db[_0xa8dc('0xa2')][_0xa8dc('0x5a')](_0x1e2122);})['then'](function(_0x343492){_0x3ecd42['rows']=_0x343492;return _0x3ecd42;});}})[_0xa8dc('0x23')](respondWithFilteredResult(_0x31693e,_0x1e2122))[_0xa8dc('0x2c')](handleError(_0x31693e,null));};exports[_0xa8dc('0xc5')]=function(_0x537fa5,_0x759674,_0xf72cfc){var _0x250c44,_0x2a84a2,_0x2f4c3c;if(_[_0xa8dc('0x96')](_0x537fa5[_0xa8dc('0x5f')][_0xa8dc('0x5f')])||_0x537fa5[_0xa8dc('0x5f')][_0xa8dc('0x5f')]===''){throw new db[(_0xa8dc('0x7a'))][(_0xa8dc('0x97'))](_0xa8dc('0x99'));}if(_[_0xa8dc('0x96')](_0x537fa5['body']['to'])){throw new db[(_0xa8dc('0x7a'))][(_0xa8dc('0x97'))](_0xa8dc('0xc6'));}_0x250c44=_0x537fa5[_0xa8dc('0x5f')]['to'];return db['SmsAccount']['find']({'where':{'id':_0x537fa5[_0xa8dc('0x67')]['id']},'include':[{'model':db['CmList'],'as':_0xa8dc('0xc7'),'include':[{'model':db[_0xa8dc('0x79')],'as':'Contacts','where':{'mobile':_0x250c44},'limit':0x1,'order':[[_0xa8dc('0x7c'),_0xa8dc('0x9e')]]}]}]})[_0xa8dc('0x23')](handleEntityNotFound(_0x759674,null))[_0xa8dc('0x23')](function(_0x40f8ad){if(_0x40f8ad&&_0x40f8ad[_0xa8dc('0xc7')]){_0x2a84a2=_0x40f8ad[_0xa8dc('0x3b')]({'plain':!![]});if(_0x2a84a2[_0xa8dc('0xc7')]&&_0x2a84a2[_0xa8dc('0xc7')][_0xa8dc('0xa0')][_0xa8dc('0x4d')]){return _0x2a84a2[_0xa8dc('0xc7')][_0xa8dc('0xa0')][0x0];}return db[_0xa8dc('0x79')][_0xa8dc('0x5e')](_[_0xa8dc('0x1e')](_0x537fa5[_0xa8dc('0x5f')],{'firstName':_0x250c44,'mobile':_0x250c44,'phone':_0x250c44,'ListId':_0x2a84a2[_0xa8dc('0x9d')]}));}})[_0xa8dc('0x23')](handleEntityNotFound(_0x759674,null))[_0xa8dc('0x23')](function(_0x2713c2){if(_0x2713c2){_0x2f4c3c=_0x2713c2;return db['SmsInteraction'][_0xa8dc('0x64')]({'where':{'ContactId':_0x2f4c3c['id'],'closed':![],'SmsAccountId':_0x2a84a2['id']}})[_0xa8dc('0x23')](function(_0x819938){if(_0x819938){return[_0x819938,![]];}return db[_0xa8dc('0xa2')]['create']({'UserId':_0x537fa5[_0xa8dc('0x60')]['id'],'ContactId':_0x2f4c3c['id'],'SmsAccountId':_0x2a84a2['id'],'phone':_0x250c44,'firstMsgDirection':_0xa8dc('0xc8'),'Messages':[_[_0xa8dc('0x56')](_0x537fa5[_0xa8dc('0x5f')],{'read':![],'body':_0x537fa5[_0xa8dc('0x5f')]['body'],'phone':_0x250c44,'SmsAccountId':_0x2a84a2['id'],'UserId':_0x537fa5['user']['id'],'ContactId':_0x2f4c3c['id']})]},{'include':[{'model':db[_0xa8dc('0xc9')],'as':_0xa8dc('0xca')}]})['then'](function(_0x33556b){return[_0x33556b,!![]];});});}})['spread'](function(_0x485e76,_0x222095){if(_0x222095){return _0x485e76;}return db[_0xa8dc('0xc9')][_0xa8dc('0x5e')](_[_0xa8dc('0x56')](_0x537fa5[_0xa8dc('0x5f')],{'read':![],'body':_0x537fa5[_0xa8dc('0x5f')][_0xa8dc('0x5f')],'phone':_0x250c44,'SmsAccountId':_0x2a84a2['id'],'SmsInteractionId':_0x485e76['id'],'UserId':_0x537fa5[_0xa8dc('0x60')]['id'],'ContactId':_0x2f4c3c['id']}))[_0xa8dc('0x23')](function(_0x5c80ec){_0x485e76[_0xa8dc('0xcb')][_0xa8dc('0xca')]=[];_0x485e76[_0xa8dc('0xcb')][_0xa8dc('0xca')][_0xa8dc('0xa8')](_0x5c80ec[_0xa8dc('0xcb')]);return _0x485e76;});})[_0xa8dc('0x23')](respondWithResult(_0x759674,null))[_0xa8dc('0x2c')](handleError(_0x759674,null));};exports[_0xa8dc('0x2e')]=function(_0x402746,_0x330874,_0x424784){if(_0x402746[_0xa8dc('0x5f')]['id']){delete _0x402746['body']['id'];}var _0x26da53,_0x92616f,_0x3fcc42;return db[_0xa8dc('0x59')][_0xa8dc('0x64')]({'where':{'id':_0x402746[_0xa8dc('0x67')]['id']}})['then'](handleEntityNotFound(_0x330874,null))[_0xa8dc('0x23')](function(_0x2f3989){if(_0x2f3989){_0x3fcc42=_0x2f3989;logger[_0xa8dc('0x27')](_0xa8dc('0xcc'),_0xa8dc('0x2e'),_0xa8dc('0xcd'),_0x2f3989[_0xa8dc('0x44')],util['inspect'](_0x402746[_0xa8dc('0x5f')],{'showHidden':![],'depth':null}));switch(_0x2f3989['type']){case _0xa8dc('0x86'):if(_0x402746['body'][_0xa8dc('0xce')]&&_0x402746[_0xa8dc('0x5f')]['status']){_0x92616f=_0x402746[_0xa8dc('0x5f')][_0xa8dc('0x2e')];return db[_0xa8dc('0xc9')][_0xa8dc('0x64')]({'where':{'messageId':_0x402746['body'][_0xa8dc('0xce')]}});}break;case _0xa8dc('0xcf'):if(_0x402746[_0xa8dc('0x5f')][_0xa8dc('0xd0')]&&_0x402746[_0xa8dc('0x5f')]['statusInt']){_0x92616f=_0x402746[_0xa8dc('0x5f')][_0xa8dc('0xd1')];return db[_0xa8dc('0xc9')][_0xa8dc('0x64')]({'where':{'messageId':_0x402746[_0xa8dc('0x5f')][_0xa8dc('0xd0')]}});}break;case _0xa8dc('0x89'):if(_0x402746[_0xa8dc('0x5f')][_0xa8dc('0xd2')]&&_0x402746[_0xa8dc('0x5f')][_0xa8dc('0xd3')]){_0x92616f=_0x402746[_0xa8dc('0x5f')]['status_code'];return db[_0xa8dc('0xc9')][_0xa8dc('0x64')]({'where':{'messageId':_0x402746['body']['message_id']}});}break;case _0xa8dc('0x8c'):var _0x3fa644=_0x402746[_0xa8dc('0x5f')][_0xa8dc('0x8d')][0x0];if(_0x3fa644[_0xa8dc('0x84')]&&_0x3fa644[_0xa8dc('0x2e')][_0xa8dc('0xd4')]===_0xa8dc('0xd5')){_0x92616f=_0x3fa644[_0xa8dc('0x2e')][_0xa8dc('0xd4')];return db[_0xa8dc('0xc9')]['find']({'where':{'messageId':_0x3fa644[_0xa8dc('0x84')]}});}break;case'clickatell':if(_0x402746[_0xa8dc('0x5f')][_0xa8dc('0x84')]&&_0x402746[_0xa8dc('0x5f')][_0xa8dc('0x2e')]){_0x92616f=_0x402746[_0xa8dc('0x5f')][_0xa8dc('0x2e')];return db[_0xa8dc('0xc9')][_0xa8dc('0x64')]({'where':{'messageId':_0x402746['body']['messageId']}});}break;case _0xa8dc('0x93'):if(_0x402746[_0xa8dc('0x5f')][0x0][_0xa8dc('0x2b')]['id']){_0x92616f=_0x402746['body'][0x0][_0xa8dc('0x44')];return db[_0xa8dc('0xc9')][_0xa8dc('0x64')]({'where':{'messageId':_0x402746[_0xa8dc('0x5f')][0x0][_0xa8dc('0x2b')]['id']}});}break;case _0xa8dc('0x94'):if(_0x402746[_0xa8dc('0x5f')][_0xa8dc('0xd6')]&&_0x402746['body'][_0xa8dc('0x2e')]){_0x92616f=_0x402746[_0xa8dc('0x5f')][_0xa8dc('0x2e')];return db[_0xa8dc('0xc9')][_0xa8dc('0x64')]({'where':{'messageId':_0x402746['body'][_0xa8dc('0xd6')]}});}break;}}})[_0xa8dc('0x23')](handleEntityNotFound(_0x330874,null))[_0xa8dc('0x23')](function(_0x518991){if(_0x518991){_0x26da53=_0x518991;switch(_0x3fcc42[_0xa8dc('0x44')]){case _0xa8dc('0x86'):if(_0x92616f===_0xa8dc('0xd5')){return _0x26da53[_0xa8dc('0x39')]({'read':!![]});}else{logger[_0xa8dc('0x29')](_0xa8dc('0xcc'),_0xa8dc('0x2e'),_0xa8dc('0x86'),util['inspect'](_0x402746[_0xa8dc('0x5f')],{'showHidden':![],'depth':null}));}break;case _0xa8dc('0xcf'):if(_0x92616f==='1'){return _0x26da53[_0xa8dc('0x39')]({'read':!![]});}else{logger[_0xa8dc('0x29')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xa8dc('0x2e'),_0xa8dc('0x86'),util['inspect'](_0x402746['body'],{'showHidden':![],'depth':null}));}break;case _0xa8dc('0x89'):if(!_0x402746['body'][_0xa8dc('0xd7')]&&_0x92616f>=0xc8&&_0x92616f<=0xce){return _0x26da53['update']({'read':!![]});}else{logger[_0xa8dc('0x29')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xa8dc('0x2e'),_0xa8dc('0x89'),util[_0xa8dc('0xd8')](_0x402746[_0xa8dc('0x5f')],{'showHidden':![],'depth':null}));}break;case _0xa8dc('0x8c'):var _0x4e1a0a=_0x402746[_0xa8dc('0x5f')][_0xa8dc('0x8d')][0x0];if(_0x4e1a0a['status'][_0xa8dc('0xd4')]===_0xa8dc('0xd5')){return _0x26da53[_0xa8dc('0x39')]({'read':!![]});}else{logger[_0xa8dc('0x29')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xa8dc('0x2e'),_0xa8dc('0x8c'),util[_0xa8dc('0xd8')](_0x402746['body'],{'showHidden':![],'depth':null}));}break;case _0xa8dc('0x90'):if(_0x92616f==_0xa8dc('0xd9')||_0x92616f=='RECEIVED_BY_RECIPIENT'){return _0x26da53['update']({'read':!![]});}else{logger[_0xa8dc('0x29')](_0xa8dc('0xcc'),_0xa8dc('0x2e'),_0xa8dc('0x90'),util[_0xa8dc('0xd8')](_0x402746[_0xa8dc('0x5f')],{'showHidden':![],'depth':null}));}break;case _0xa8dc('0x93'):if(_0x92616f==_0xa8dc('0xda')){return _0x26da53[_0xa8dc('0x39')]({'read':!![]});}else{logger[_0xa8dc('0x29')](_0xa8dc('0xcc'),_0xa8dc('0x2e'),'bandwidth',util[_0xa8dc('0xd8')](_0x402746[_0xa8dc('0x5f')],{'showHidden':![],'depth':null}));}break;case _0xa8dc('0x94'):if(_0x92616f===_0xa8dc('0xdb')||_0x92616f===_0xa8dc('0xdc')){return _0x26da53[_0xa8dc('0x39')]({'read':!![]});}else{logger[_0xa8dc('0x29')](_0xa8dc('0xcc'),_0xa8dc('0x2e'),_0xa8dc('0x94'),util[_0xa8dc('0xd8')](_0x402746['body'],{'showHidden':![],'depth':null}));}break;}return _0x26da53;}})[_0xa8dc('0x23')](respondWithResult(_0x330874,null))[_0xa8dc('0x2c')](handleError(_0x330874,null));};exports['statusGet']=function(_0x41de3b,_0x35b252,_0x9e7c9e){var _0x4fa006,_0x3bac33,_0x547da0;return db['SmsAccount'][_0xa8dc('0x64')]({'where':{'id':_0x41de3b['params']['id']}})[_0xa8dc('0x23')](handleEntityNotFound(_0x35b252,null))['then'](function(_0x5b4163){if(_0x5b4163){_0x547da0=_0x5b4163;logger[_0xa8dc('0x27')](_0xa8dc('0xcc'),'status',_0xa8dc('0xcd'),_0x5b4163[_0xa8dc('0x44')],util[_0xa8dc('0xd8')](_0x41de3b[_0xa8dc('0x49')],{'showHidden':![],'depth':null}));switch(_0x5b4163[_0xa8dc('0x44')]){case'csc':if(_0x41de3b[_0xa8dc('0x49')]['message-id']&&_0x41de3b[_0xa8dc('0x49')][_0xa8dc('0xdd')]){_0x3bac33=_0x41de3b['query'][_0xa8dc('0xdd')];return db['SmsMessage'][_0xa8dc('0x64')]({'where':{'messageId':_0x41de3b[_0xa8dc('0x49')][_0xa8dc('0xde')]}});}break;}}})[_0xa8dc('0x23')](handleEntityNotFound(_0x35b252,null))[_0xa8dc('0x23')](function(_0x39d2b8){if(_0x39d2b8){_0x4fa006=_0x39d2b8;switch(_0x547da0[_0xa8dc('0x44')]){case _0xa8dc('0x8e'):if(_0x3bac33==='2'||_0x3bac33==='6'){return _0x4fa006[_0xa8dc('0x39')]({'read':!![]});}else{logger[_0xa8dc('0x29')](_0xa8dc('0xcc'),_0xa8dc('0x2e'),_0xa8dc('0x8e'),util[_0xa8dc('0xd8')](_0x41de3b[_0xa8dc('0x49')],{'showHidden':![],'depth':null}));};break;}return _0x4fa006;}})[_0xa8dc('0x23')](respondWithResult(_0x35b252,null))['catch'](handleError(_0x35b252,null));};exports['addAgents']=function(_0x4f46fa,_0x3575ac,_0x4c3b0e){return db[_0xa8dc('0x59')][_0xa8dc('0x64')]({'where':{'id':_0x4f46fa[_0xa8dc('0x67')]['id']}})[_0xa8dc('0x23')](handleEntityNotFound(_0x3575ac,null))[_0xa8dc('0x23')](function(_0x21b722){if(_0x21b722){return _0x21b722[_0xa8dc('0xdf')](_0x4f46fa[_0xa8dc('0x5f')][_0xa8dc('0x71')],_[_0xa8dc('0xe0')](_0x4f46fa[_0xa8dc('0x5f')],['ids','id'])||{})[_0xa8dc('0xa3')](function(_0xb95c08){for(var _0x48b2b7=0x0;_0x48b2b7<_0x4f46fa['body'][_0xa8dc('0x71')][_0xa8dc('0x4d')];_0x48b2b7+=0x1){socket[_0xa8dc('0xe1')](_0xa8dc('0xe2'),{'UserId':_0x4f46fa[_0xa8dc('0x5f')][_0xa8dc('0x71')][_0x48b2b7],'SmsAccountId':_0x4f46fa[_0xa8dc('0x67')]['id']});}return _0xb95c08;});}})[_0xa8dc('0x23')](respondWithResult(_0x3575ac,null))[_0xa8dc('0x2c')](handleError(_0x3575ac,null));};exports[_0xa8dc('0xe3')]=function(_0x10bff7,_0x40cd85,_0xaffc37){return db[_0xa8dc('0x59')][_0xa8dc('0x64')]({'where':{'id':_0x10bff7['params']['id']}})[_0xa8dc('0x23')](handleEntityNotFound(_0x40cd85,null))[_0xa8dc('0x23')](function(_0x47734c){if(_0x47734c){return _0x47734c['removeAgents'](_0x10bff7[_0xa8dc('0x49')][_0xa8dc('0x71')])['then'](function(){if(_['isArray'](_0x10bff7['query'][_0xa8dc('0x71')])){for(var _0x3ce27c=0x0;_0x3ce27c<_0x10bff7[_0xa8dc('0x49')][_0xa8dc('0x71')]['length'];_0x3ce27c+=0x1){socket[_0xa8dc('0xe1')](_0xa8dc('0xe4'),{'UserId':Number(_0x10bff7[_0xa8dc('0x49')]['ids'][_0x3ce27c]),'SmsAccountId':Number(_0x10bff7['params']['id'])});}}else{socket['emit'](_0xa8dc('0xe4'),{'UserId':Number(_0x10bff7[_0xa8dc('0x49')]['ids']),'SmsAccountId':Number(_0x10bff7[_0xa8dc('0x67')]['id'])});}});}})['then'](respondWithStatusCode(_0x40cd85,null))[_0xa8dc('0x2c')](handleError(_0x40cd85,null));};exports[_0xa8dc('0xe5')]=function(_0xcf2074,_0x454b9c,_0x564ac9){var _0x4015f3={};var _0x49a0b6={};var _0x42fd00;var _0xd6e1c4;return db[_0xa8dc('0x59')][_0xa8dc('0x6d')]({'where':{'id':_0xcf2074['params']['id']}})[_0xa8dc('0x23')](handleEntityNotFound(_0x454b9c,null))[_0xa8dc('0x23')](function(_0x86b701){if(_0x86b701){_0x42fd00=_0x86b701;_0x49a0b6[_0xa8dc('0x46')]=_[_0xa8dc('0x48')](db[_0xa8dc('0xae')][_0xa8dc('0x42')]);_0x49a0b6[_0xa8dc('0x49')]=_[_0xa8dc('0x48')](_0xcf2074[_0xa8dc('0x49')]);_0x49a0b6[_0xa8dc('0x53')]=_[_0xa8dc('0x4a')](_0x49a0b6[_0xa8dc('0x46')],_0x49a0b6[_0xa8dc('0x49')]);_0x4015f3['attributes']=_[_0xa8dc('0x4a')](_0x49a0b6['model'],qs[_0xa8dc('0x4c')](_0xcf2074['query'][_0xa8dc('0x4c')]));_0x4015f3['attributes']=_0x4015f3[_0xa8dc('0x4b')][_0xa8dc('0x4d')]?_0x4015f3[_0xa8dc('0x4b')]:_0x49a0b6[_0xa8dc('0x46')];_0x4015f3[_0xa8dc('0x50')]=qs[_0xa8dc('0x51')](_0xcf2074['query']['sort']);_0x4015f3['where']=qs['filters'](_[_0xa8dc('0x54')](_0xcf2074[_0xa8dc('0x49')],_0x49a0b6['filters']));if(_0xcf2074[_0xa8dc('0x49')][_0xa8dc('0x55')]){_0x4015f3[_0xa8dc('0x52')]=_[_0xa8dc('0x56')](_0x4015f3[_0xa8dc('0x52')],{'$or':_[_0xa8dc('0x47')](_0x4015f3['attributes'],function(_0xb8205a){var _0x56712f={};_0x56712f[_0xb8205a]={'$like':'%'+_0xcf2074[_0xa8dc('0x49')][_0xa8dc('0x55')]+'%'};return _0x56712f;})});}_0x4015f3=_[_0xa8dc('0x56')]({},_0x4015f3,_0xcf2074['options']);return _0x42fd00[_0xa8dc('0xe5')](_0x4015f3);}})[_0xa8dc('0x23')](function(_0x48aa20){if(_0x48aa20){_0xd6e1c4=_0x48aa20[_0xa8dc('0x4d')];if(!_0xcf2074[_0xa8dc('0x49')][_0xa8dc('0x4e')](_0xa8dc('0x4f'))){_0x4015f3['limit']=qs[_0xa8dc('0x33')](_0xcf2074[_0xa8dc('0x49')]['limit']);_0x4015f3[_0xa8dc('0x31')]=qs[_0xa8dc('0x31')](_0xcf2074[_0xa8dc('0x49')][_0xa8dc('0x31')]);}return _0x42fd00['getAgents'](_0x4015f3);}})[_0xa8dc('0x23')](function(_0xbbe63f){if(_0xbbe63f){return _0xbbe63f?{'count':_0xd6e1c4,'rows':_0xbbe63f}:null;}})[_0xa8dc('0x23')](respondWithResult(_0x454b9c,null))['catch'](handleError(_0x454b9c,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index e899adb..562f3dc 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 _0xb231=['setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','SmsAccount'];(function(_0x16509b,_0x274c9c){var _0xa079b6=function(_0x3c684c){while(--_0x3c684c){_0x16509b['push'](_0x16509b['shift']());}};_0xa079b6(++_0x274c9c);}(_0xb231,0x1e7));var _0x1b23=function(_0x3d7ae2,_0x4ab93c){_0x3d7ae2=_0x3d7ae2-0x0;var _0x4ec8cb=_0xb231[_0x3d7ae2];return _0x4ec8cb;};'use strict';var EventEmitter=require(_0x1b23('0x0'));var SmsAccount=require(_0x1b23('0x1'))['db'][_0x1b23('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x1b23('0x3')](0x0);var events={'afterCreate':_0x1b23('0x4'),'afterUpdate':'update','afterDestroy':_0x1b23('0x5')};function emitEvent(_0x229565){return function(_0x314e90,_0x518cfa,_0x3c5139){SmsAccountEvents['emit'](_0x229565+':'+_0x314e90['id'],_0x314e90);SmsAccountEvents[_0x1b23('0x6')](_0x229565,_0x314e90);_0x3c5139(null);};}for(var e in events){if(events[_0x1b23('0x7')](e)){var event=events[e];SmsAccount[_0x1b23('0x8')](e,emitEvent(event));}}module[_0x1b23('0x9')]=SmsAccountEvents; \ No newline at end of file +var _0xce7b=['exports','../../mysqldb','SmsAccount','setMaxListeners','update','emit','hasOwnProperty','hook'];(function(_0x36b009,_0x2acf01){var _0x4e04fb=function(_0x4e6558){while(--_0x4e6558){_0x36b009['push'](_0x36b009['shift']());}};_0x4e04fb(++_0x2acf01);}(_0xce7b,0x151));var _0xbce7=function(_0x5202ed,_0x3d8b96){_0x5202ed=_0x5202ed-0x0;var _0x5269f5=_0xce7b[_0x5202ed];return _0x5269f5;};'use strict';var EventEmitter=require('events');var SmsAccount=require(_0xbce7('0x0'))['db'][_0xbce7('0x1')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0xbce7('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xbce7('0x3'),'afterDestroy':'remove'};function emitEvent(_0x5e4d47){return function(_0x41ccf7,_0x50e9f4,_0xc59a25){SmsAccountEvents[_0xbce7('0x4')](_0x5e4d47+':'+_0x41ccf7['id'],_0x41ccf7);SmsAccountEvents['emit'](_0x5e4d47,_0x41ccf7);_0xc59a25(null);};}for(var e in events){if(events[_0xbce7('0x5')](e)){var event=events[e];SmsAccount[_0xbce7('0x6')](e,emitEvent(event));}}module[_0xbce7('0x7')]=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index 149684e..7221dae 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 _0x5f2b=['request-promise','path','rimraf','../../config/environment','./smsAccount.attributes','exports','define','lodash','util','api','moment'];(function(_0x15919b,_0x1e41fe){var _0x2ef703=function(_0x15455d){while(--_0x15455d){_0x15919b['push'](_0x15919b['shift']());}};_0x2ef703(++_0x1e41fe);}(_0x5f2b,0xc2));var _0xb5f2=function(_0xf29b52,_0x1cb5b5){_0xf29b52=_0xf29b52-0x0;var _0xd0e6a2=_0x5f2b[_0xf29b52];return _0xd0e6a2;};'use strict';var _=require(_0xb5f2('0x0'));var util=require(_0xb5f2('0x1'));var logger=require('../../config/logger')(_0xb5f2('0x2'));var moment=require(_0xb5f2('0x3'));var BPromise=require('bluebird');var rp=require(_0xb5f2('0x4'));var fs=require('fs');var path=require(_0xb5f2('0x5'));var rimraf=require(_0xb5f2('0x6'));var config=require(_0xb5f2('0x7'));var attributes=require(_0xb5f2('0x8'));module[_0xb5f2('0x9')]=function(_0x1e1237,_0x473b07){return _0x1e1237[_0xb5f2('0xa')]('SmsAccount',attributes,{'tableName':'sms_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5d75=['./smsAccount.attributes','exports','sms_accounts','lodash','util','api','moment','path','rimraf','../../config/environment'];(function(_0x1ad309,_0xb68caf){var _0x5a95b8=function(_0x3ea4b9){while(--_0x3ea4b9){_0x1ad309['push'](_0x1ad309['shift']());}};_0x5a95b8(++_0xb68caf);}(_0x5d75,0x1e3));var _0x55d7=function(_0x63004f,_0x4a44c8){_0x63004f=_0x63004f-0x0;var _0x3cbed9=_0x5d75[_0x63004f];return _0x3cbed9;};'use strict';var _=require(_0x55d7('0x0'));var util=require(_0x55d7('0x1'));var logger=require('../../config/logger')(_0x55d7('0x2'));var moment=require(_0x55d7('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x55d7('0x4'));var rimraf=require(_0x55d7('0x5'));var config=require(_0x55d7('0x6'));var attributes=require(_0x55d7('0x7'));module[_0x55d7('0x8')]=function(_0x525439,_0x52cc43){return _0x525439['define']('SmsAccount',attributes,{'tableName':_0x55d7('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 50ac3e1..fd87d49 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 _0xbaf5=['map','model','stringify','lodash','moment','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','register','then','info','SmsAccount,\x20%s,\x20%s','debug','SmsAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','ShowSmsAccount','SmsAccount','find','options','where','attributes','include'];(function(_0x5ae175,_0x206588){var _0x36c378=function(_0x2c8a97){while(--_0x2c8a97){_0x5ae175['push'](_0x5ae175['shift']());}};_0x36c378(++_0x206588);}(_0xbaf5,0x10b));var _0x5baf=function(_0x545dda,_0x577f99){_0x545dda=_0x545dda-0x0;var _0xef8cba=_0xbaf5[_0x545dda];return _0xef8cba;};'use strict';var _=require(_0x5baf('0x0'));var util=require('util');var moment=require(_0x5baf('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5baf('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x5baf('0x3'));var logger=require('../../config/logger')(_0x5baf('0x4'));var config=require(_0x5baf('0x5'));var jayson=require(_0x5baf('0x6'));var client=jayson[_0x5baf('0x7')]['http']({'port':0x232a});config[_0x5baf('0x8')]=_[_0x5baf('0x9')](config['redis'],{'host':_0x5baf('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5baf('0x8')]));require('./smsAccount.socket')[_0x5baf('0xb')](socket);function respondWithRpcPromise(_0x332148,_0x2fc641,_0x2f4595){return new BPromise(function(_0x250c4c,_0x10d173){return client['request'](_0x332148,_0x2f4595)[_0x5baf('0xc')](function(_0x1ae8f8){logger[_0x5baf('0xd')](_0x5baf('0xe'),_0x2fc641,'request\x20sent');logger[_0x5baf('0xf')](_0x5baf('0x10'),_0x2fc641,_0x5baf('0x11'),JSON['stringify'](_0x1ae8f8));if(_0x1ae8f8[_0x5baf('0x12')]){if(_0x1ae8f8['error'][_0x5baf('0x13')]===0x1f4){logger[_0x5baf('0x12')](_0x5baf('0xe'),_0x2fc641,_0x1ae8f8[_0x5baf('0x12')][_0x5baf('0x14')]);return _0x10d173(_0x1ae8f8[_0x5baf('0x12')][_0x5baf('0x14')]);}logger[_0x5baf('0x12')](_0x5baf('0xe'),_0x2fc641,_0x1ae8f8['error']['message']);return _0x250c4c(_0x1ae8f8[_0x5baf('0x12')][_0x5baf('0x14')]);}else{logger[_0x5baf('0xd')](_0x5baf('0xe'),_0x2fc641,_0x5baf('0x11'));_0x250c4c(_0x1ae8f8[_0x5baf('0x15')][_0x5baf('0x14')]);}})[_0x5baf('0x16')](function(_0x11b61e){logger[_0x5baf('0x12')](_0x5baf('0xe'),_0x2fc641,_0x11b61e);_0x10d173(_0x11b61e);});});}exports[_0x5baf('0x17')]=function(_0x223297){var _0x322ee9=this;return new Promise(function(_0x329b89,_0x10bbfa){return db[_0x5baf('0x18')][_0x5baf('0x19')]({'raw':_0x223297[_0x5baf('0x1a')]?_0x223297[_0x5baf('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x223297[_0x5baf('0x1a')]?_0x223297[_0x5baf('0x1a')][_0x5baf('0x1b')]||null:null,'attributes':_0x223297['options']?_0x223297[_0x5baf('0x1a')][_0x5baf('0x1c')]||null:null,'include':_0x223297[_0x5baf('0x1a')]?_0x223297['options'][_0x5baf('0x1d')]?_[_0x5baf('0x1e')](_0x223297[_0x5baf('0x1a')][_0x5baf('0x1d')],function(_0xcf967f){return{'model':db[_0xcf967f[_0x5baf('0x1f')]],'as':_0xcf967f['as'],'attributes':_0xcf967f[_0x5baf('0x1c')],'include':_0xcf967f['include']?_[_0x5baf('0x1e')](_0xcf967f[_0x5baf('0x1d')],function(_0x2a6dae){return{'model':db[_0x2a6dae['model']],'as':_0x2a6dae['as'],'attributes':_0x2a6dae[_0x5baf('0x1c')],'include':_0x2a6dae[_0x5baf('0x1d')]?_[_0x5baf('0x1e')](_0x2a6dae[_0x5baf('0x1d')],function(_0x3c6e14){return{'model':db[_0x3c6e14[_0x5baf('0x1f')]],'as':_0x3c6e14['as'],'attributes':_0x3c6e14[_0x5baf('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x5baf('0xc')](function(_0x5cd532){logger[_0x5baf('0xd')](_0x5baf('0x17'),_0x223297);logger[_0x5baf('0xf')](_0x5baf('0x17'),_0x223297,JSON[_0x5baf('0x20')](_0x5cd532));_0x329b89(_0x5cd532);})[_0x5baf('0x16')](function(_0x584b66){logger[_0x5baf('0x12')](_0x5baf('0x17'),_0x584b66[_0x5baf('0x14')],_0x223297);_0x10bbfa(_0x322ee9[_0x5baf('0x12')](0x1f4,_0x584b66[_0x5baf('0x14')]));});});}; \ No newline at end of file +var _0xcbb3=['find','options','raw','where','attributes','include','map','model','ShowSmsAccount','util','moment','randomstring','../../config/logger','../../config/environment','client','http','redis','socket.io-emitter','./smsAccount.socket','register','then','info','SmsAccount,\x20%s,\x20%s','SmsAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch'];(function(_0x3e34da,_0x45aa62){var _0xa2dc61=function(_0x4491fe){while(--_0x4491fe){_0x3e34da['push'](_0x3e34da['shift']());}};_0xa2dc61(++_0x45aa62);}(_0xcbb3,0x17d));var _0x3cbb=function(_0x8555e7,_0x7fd514){_0x8555e7=_0x8555e7-0x0;var _0x641adb=_0xcbb3[_0x8555e7];return _0x641adb;};'use strict';var _=require('lodash');var util=require(_0x3cbb('0x0'));var moment=require(_0x3cbb('0x1'));var BPromise=require('bluebird');var rs=require(_0x3cbb('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x3cbb('0x3'))('rpc');var config=require(_0x3cbb('0x4'));var jayson=require('jayson/promise');var client=jayson[_0x3cbb('0x5')][_0x3cbb('0x6')]({'port':0x232a});config[_0x3cbb('0x7')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x3cbb('0x8'))(new Redis(config[_0x3cbb('0x7')]));require(_0x3cbb('0x9'))[_0x3cbb('0xa')](socket);function respondWithRpcPromise(_0x13c1b2,_0xc15939,_0x51d748){return new BPromise(function(_0x256b77,_0x3997d2){return client['request'](_0x13c1b2,_0x51d748)[_0x3cbb('0xb')](function(_0xb07a18){logger[_0x3cbb('0xc')](_0x3cbb('0xd'),_0xc15939,'request\x20sent');logger['debug'](_0x3cbb('0xe'),_0xc15939,_0x3cbb('0xf'),JSON[_0x3cbb('0x10')](_0xb07a18));if(_0xb07a18[_0x3cbb('0x11')]){if(_0xb07a18[_0x3cbb('0x11')][_0x3cbb('0x12')]===0x1f4){logger['error']('SmsAccount,\x20%s,\x20%s',_0xc15939,_0xb07a18[_0x3cbb('0x11')][_0x3cbb('0x13')]);return _0x3997d2(_0xb07a18[_0x3cbb('0x11')][_0x3cbb('0x13')]);}logger[_0x3cbb('0x11')](_0x3cbb('0xd'),_0xc15939,_0xb07a18[_0x3cbb('0x11')][_0x3cbb('0x13')]);return _0x256b77(_0xb07a18[_0x3cbb('0x11')]['message']);}else{logger[_0x3cbb('0xc')](_0x3cbb('0xd'),_0xc15939,_0x3cbb('0xf'));_0x256b77(_0xb07a18[_0x3cbb('0x14')]['message']);}})[_0x3cbb('0x15')](function(_0x5a037e){logger[_0x3cbb('0x11')]('SmsAccount,\x20%s,\x20%s',_0xc15939,_0x5a037e);_0x3997d2(_0x5a037e);});});}exports['ShowSmsAccount']=function(_0x115743){var _0x4dc583=this;return new Promise(function(_0xe3adf4,_0x39e693){return db['SmsAccount'][_0x3cbb('0x16')]({'raw':_0x115743[_0x3cbb('0x17')]?_0x115743[_0x3cbb('0x17')][_0x3cbb('0x18')]===undefined?!![]:![]:!![],'where':_0x115743[_0x3cbb('0x17')]?_0x115743[_0x3cbb('0x17')][_0x3cbb('0x19')]||null:null,'attributes':_0x115743[_0x3cbb('0x17')]?_0x115743[_0x3cbb('0x17')][_0x3cbb('0x1a')]||null:null,'include':_0x115743[_0x3cbb('0x17')]?_0x115743[_0x3cbb('0x17')][_0x3cbb('0x1b')]?_[_0x3cbb('0x1c')](_0x115743['options'][_0x3cbb('0x1b')],function(_0x2113d4){return{'model':db[_0x2113d4['model']],'as':_0x2113d4['as'],'attributes':_0x2113d4[_0x3cbb('0x1a')],'include':_0x2113d4[_0x3cbb('0x1b')]?_['map'](_0x2113d4[_0x3cbb('0x1b')],function(_0x2bc6f9){return{'model':db[_0x2bc6f9[_0x3cbb('0x1d')]],'as':_0x2bc6f9['as'],'attributes':_0x2bc6f9[_0x3cbb('0x1a')],'include':_0x2bc6f9[_0x3cbb('0x1b')]?_[_0x3cbb('0x1c')](_0x2bc6f9[_0x3cbb('0x1b')],function(_0x183996){return{'model':db[_0x183996[_0x3cbb('0x1d')]],'as':_0x183996['as'],'attributes':_0x183996[_0x3cbb('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x3cbb('0xb')](function(_0x45efc3){logger[_0x3cbb('0xc')](_0x3cbb('0x1e'),_0x115743);logger['debug'](_0x3cbb('0x1e'),_0x115743,JSON[_0x3cbb('0x10')](_0x45efc3));_0xe3adf4(_0x45efc3);})[_0x3cbb('0x15')](function(_0x45ec55){logger['error'](_0x3cbb('0x1e'),_0x45ec55[_0x3cbb('0x13')],_0x115743);_0x39e693(_0x4dc583[_0x3cbb('0x11')](0x1f4,_0x45ec55[_0x3cbb('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index 96217a9..b6cca1d 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(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xa9e0[_0x6131cd];return _0x47e916;};'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(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa9e0[_0x14add3];return _0x4a174f;};'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 e11667f..a0eddb1 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(_0x4baae2,_0x487ab6){var _0x1a2285=function(_0x1cea47){while(--_0x1cea47){_0x4baae2['push'](_0x4baae2['shift']());}};_0x1a2285(++_0x487ab6);}(_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 _0x3e74=['path','connect-timeout','express','../../components/auth/service','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete','exports','multer'];(function(_0x22a9b7,_0x58e5d4){var _0x8a8568=function(_0x271479){while(--_0x271479){_0x22a9b7['push'](_0x22a9b7['shift']());}};_0x8a8568(++_0x58e5d4);}(_0x3e74,0x175));var _0x43e7=function(_0x30123b,_0x1f8727){_0x30123b=_0x30123b-0x0;var _0x125ba2=_0x3e74[_0x30123b];return _0x125ba2;};'use strict';var multer=require(_0x43e7('0x0'));var util=require('util');var path=require(_0x43e7('0x1'));var timeout=require(_0x43e7('0x2'));var express=require(_0x43e7('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x43e7('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x43e7('0x5'));var controller=require(_0x43e7('0x6'));router[_0x43e7('0x7')]('/',auth[_0x43e7('0x8')](),controller[_0x43e7('0x9')]);router['get'](_0x43e7('0xa'),auth[_0x43e7('0x8')](),controller[_0x43e7('0xb')]);router[_0x43e7('0xc')]('/',auth[_0x43e7('0x8')](),controller['create']);router[_0x43e7('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x43e7('0xe')]);router[_0x43e7('0xf')]('/:id',auth[_0x43e7('0x8')](),controller['destroy']);module[_0x43e7('0x10')]=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index c4a9a1e..d5e53ab 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 _0x427b=['noop','TEXT','sequelize','exports','INTEGER','STRING'];(function(_0x4bdb9a,_0x2c01ab){var _0x2f16bd=function(_0x5efcaa){while(--_0x5efcaa){_0x4bdb9a['push'](_0x4bdb9a['shift']());}};_0x2f16bd(++_0x2c01ab);}(_0x427b,0x1a0));var _0xb427=function(_0x3e3f64,_0x5692d2){_0x3e3f64=_0x3e3f64-0x0;var _0x30801d=_0x427b[_0x3e3f64];return _0x30801d;};'use strict';var Sequelize=require(_0xb427('0x0'));module[_0xb427('0x1')]={'priority':{'type':Sequelize[_0xb427('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xb427('0x3')],'allowNull':![],'defaultValue':_0xb427('0x4')},'appdata':{'type':Sequelize[_0xb427('0x5')]()},'description':{'type':Sequelize[_0xb427('0x3')]},'interval':{'type':Sequelize[_0xb427('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x7cf4=['noop','TEXT','sequelize','STRING'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x7cf4,0xc6));var _0x47cf=function(_0x12de6b,_0x80dad2){_0x12de6b=_0x12de6b-0x0;var _0x16694b=_0x7cf4[_0x12de6b];return _0x16694b;};'use strict';var Sequelize=require(_0x47cf('0x0'));module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x47cf('0x1')],'allowNull':![],'defaultValue':_0x47cf('0x2')},'appdata':{'type':Sequelize[_0x47cf('0x3')]()},'description':{'type':Sequelize[_0x47cf('0x1')]},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index 32ee10e..be3d9c0 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 _0x7558=['pick','type','VIRTUAL','merge','findAll','rows','catch','params','include','options','create','body','find','eml-format','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','../../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','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','SmsApplication','rawAttributes','fieldName','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where'];(function(_0x5a0240,_0xed4dde){var _0x20be5a=function(_0x471ee2){while(--_0x471ee2){_0x5a0240['push'](_0x5a0240['shift']());}};_0x20be5a(++_0xed4dde);}(_0x7558,0x1cf));var _0x8755=function(_0x1e4f3c,_0x5b659b){_0x1e4f3c=_0x1e4f3c-0x0;var _0x51bd64=_0x7558[_0x1e4f3c];return _0x51bd64;};'use strict';var emlformat=require(_0x8755('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x8755('0x1'));var rp=require(_0x8755('0x2'));var moment=require('moment');var BPromise=require(_0x8755('0x3'));var Mustache=require(_0x8755('0x4'));var util=require(_0x8755('0x5'));var path=require('path');var sox=require(_0x8755('0x6'));var csv=require(_0x8755('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8755('0x8'));var squel=require(_0x8755('0x9'));var crypto=require(_0x8755('0xa'));var jsforce=require(_0x8755('0xb'));var deskjs=require(_0x8755('0xc'));var toCsv=require('to-csv');var querystring=require(_0x8755('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x8755('0xe'));var qs=require(_0x8755('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8755('0x10'));var logger=require(_0x8755('0x11'))(_0x8755('0x12'));var utils=require(_0x8755('0x13'));var config=require(_0x8755('0x14'));var licenseUtil=require(_0x8755('0x15'));var db=require(_0x8755('0x16'))['db'];function respondWithStatusCode(_0x525bbe,_0x467dff){_0x467dff=_0x467dff||0xcc;return function(_0x5e784b){if(_0x5e784b){return _0x525bbe[_0x8755('0x17')](_0x467dff);}return _0x525bbe[_0x8755('0x18')](_0x467dff)[_0x8755('0x19')]();};}function respondWithResult(_0x4dc061,_0x491461){_0x491461=_0x491461||0xc8;return function(_0x462110){if(_0x462110){return _0x4dc061['status'](_0x491461)[_0x8755('0x1a')](_0x462110);}};}function respondWithFilteredResult(_0x38176b,_0x123bda){return function(_0x44228c){if(_0x44228c){var _0x5bed96=typeof _0x123bda[_0x8755('0x1b')]===_0x8755('0x1c')&&typeof _0x123bda[_0x8755('0x1d')]==='undefined';var _0x1e3855=_0x44228c[_0x8755('0x1e')];var _0x309ece=_0x5bed96?0x0:_0x123bda['offset'];var _0x3ab513=_0x5bed96?_0x44228c[_0x8755('0x1e')]:_0x123bda['offset']+_0x123bda[_0x8755('0x1d')];var _0xf2a55a;if(_0x3ab513>=_0x1e3855){_0x3ab513=_0x1e3855;_0xf2a55a=0xc8;}else{_0xf2a55a=0xce;}_0x38176b[_0x8755('0x18')](_0xf2a55a);return _0x38176b[_0x8755('0x1f')](_0x8755('0x20'),_0x309ece+'-'+_0x3ab513+'/'+_0x1e3855)[_0x8755('0x1a')](_0x44228c);}return null;};}function patchUpdates(_0x139646){return function(_0x5381e8){try{jsonpatch[_0x8755('0x21')](_0x5381e8,_0x139646,!![]);}catch(_0x1fc78e){return BPromise[_0x8755('0x22')](_0x1fc78e);}return _0x5381e8[_0x8755('0x23')]();};}function saveUpdates(_0x54af88,_0x183ed3){return function(_0x553b9a){if(_0x553b9a){return _0x553b9a[_0x8755('0x24')](_0x54af88)[_0x8755('0x25')](function(_0x29a3d4){return _0x29a3d4;});}return null;};}function removeEntity(_0x4f2a99,_0x60abca){return function(_0x2fabeb){if(_0x2fabeb){return _0x2fabeb[_0x8755('0x26')]()[_0x8755('0x25')](function(){_0x4f2a99['status'](0xcc)[_0x8755('0x19')]();});}};}function handleEntityNotFound(_0x2c799b,_0x435089){return function(_0x432cf6){if(!_0x432cf6){_0x2c799b[_0x8755('0x17')](0x194);}return _0x432cf6;};}function handleError(_0xff95cc,_0x217ba8){_0x217ba8=_0x217ba8||0x1f4;return function(_0x57ae18){logger[_0x8755('0x27')](_0x57ae18[_0x8755('0x28')]);if(_0x57ae18[_0x8755('0x29')]){delete _0x57ae18[_0x8755('0x29')];}_0xff95cc[_0x8755('0x18')](_0x217ba8)[_0x8755('0x2a')](_0x57ae18);};}exports[_0x8755('0x2b')]=function(_0x176c61,_0x7885f8){var _0x5ee788={},_0x313462={},_0x52f0a2={'count':0x0,'rows':[]};var _0x4d70f1=_[_0x8755('0x2c')](db[_0x8755('0x2d')][_0x8755('0x2e')],function(_0x370c7b){return{'name':_0x370c7b[_0x8755('0x2f')],'type':_0x370c7b['type'][_0x8755('0x30')]};});_0x313462['model']=_[_0x8755('0x2c')](_0x4d70f1,_0x8755('0x29'));_0x313462[_0x8755('0x31')]=_[_0x8755('0x32')](_0x176c61[_0x8755('0x31')]);_0x313462[_0x8755('0x33')]=_[_0x8755('0x34')](_0x313462[_0x8755('0x35')],_0x313462['query']);_0x5ee788['attributes']=_[_0x8755('0x34')](_0x313462['model'],qs[_0x8755('0x36')](_0x176c61['query'][_0x8755('0x36')]));_0x5ee788['attributes']=_0x5ee788[_0x8755('0x37')][_0x8755('0x38')]?_0x5ee788[_0x8755('0x37')]:_0x313462['model'];if(!_0x176c61[_0x8755('0x31')][_0x8755('0x39')](_0x8755('0x3a'))){_0x5ee788['limit']=qs[_0x8755('0x1d')](_0x176c61['query']['limit']);_0x5ee788['offset']=qs[_0x8755('0x1b')](_0x176c61[_0x8755('0x31')][_0x8755('0x1b')]);}_0x5ee788[_0x8755('0x3b')]=qs[_0x8755('0x3c')](_0x176c61[_0x8755('0x31')]['sort']);_0x5ee788[_0x8755('0x3d')]=qs['filters'](_[_0x8755('0x3e')](_0x176c61[_0x8755('0x31')],_0x313462[_0x8755('0x33')]),_0x4d70f1);if(_0x176c61[_0x8755('0x31')]['filter']){_0x5ee788[_0x8755('0x3d')]=_['merge'](_0x5ee788['where'],{'$or':_[_0x8755('0x2c')](_0x4d70f1,function(_0x5c5364){if(_0x5c5364[_0x8755('0x3f')]!==_0x8755('0x40')){var _0x45c9f0={};_0x45c9f0[_0x5c5364[_0x8755('0x29')]]={'$like':'%'+_0x176c61[_0x8755('0x31')]['filter']+'%'};return _0x45c9f0;}})});}_0x5ee788=_[_0x8755('0x41')]({},_0x5ee788,_0x176c61['options']);var _0x2d5841={'where':_0x5ee788['where']};return db['SmsApplication'][_0x8755('0x1e')](_0x2d5841)[_0x8755('0x25')](function(_0x331a97){_0x52f0a2[_0x8755('0x1e')]=_0x331a97;if(_0x176c61['query']['includeAll']){_0x5ee788['include']=[{'all':!![]}];}return db[_0x8755('0x2d')][_0x8755('0x42')](_0x5ee788);})['then'](function(_0x542929){_0x52f0a2[_0x8755('0x43')]=_0x542929;return _0x52f0a2;})[_0x8755('0x25')](respondWithFilteredResult(_0x7885f8,_0x5ee788))[_0x8755('0x44')](handleError(_0x7885f8,null));};exports['show']=function(_0x7bb07f,_0x29b54a){var _0x15cce4={'raw':!![],'where':{'id':_0x7bb07f[_0x8755('0x45')]['id']}},_0x289f8d={};_0x289f8d[_0x8755('0x35')]=_[_0x8755('0x32')](db[_0x8755('0x2d')][_0x8755('0x2e')]);_0x289f8d[_0x8755('0x31')]=_[_0x8755('0x32')](_0x7bb07f[_0x8755('0x31')]);_0x289f8d['filters']=_[_0x8755('0x34')](_0x289f8d[_0x8755('0x35')],_0x289f8d[_0x8755('0x31')]);_0x15cce4[_0x8755('0x37')]=_[_0x8755('0x34')](_0x289f8d['model'],qs[_0x8755('0x36')](_0x7bb07f[_0x8755('0x31')][_0x8755('0x36')]));_0x15cce4['attributes']=_0x15cce4[_0x8755('0x37')][_0x8755('0x38')]?_0x15cce4[_0x8755('0x37')]:_0x289f8d[_0x8755('0x35')];if(_0x7bb07f[_0x8755('0x31')]['includeAll']){_0x15cce4[_0x8755('0x46')]=[{'all':!![]}];}_0x15cce4=_['merge']({},_0x15cce4,_0x7bb07f[_0x8755('0x47')]);return db[_0x8755('0x2d')]['find'](_0x15cce4)[_0x8755('0x25')](handleEntityNotFound(_0x29b54a,null))[_0x8755('0x25')](respondWithResult(_0x29b54a,null))[_0x8755('0x44')](handleError(_0x29b54a,null));};exports[_0x8755('0x48')]=function(_0x33e7b1,_0x38bcea){return db[_0x8755('0x2d')][_0x8755('0x48')](_0x33e7b1['body'],{})[_0x8755('0x25')](respondWithResult(_0x38bcea,0xc9))['catch'](handleError(_0x38bcea,null));};exports[_0x8755('0x24')]=function(_0x53bbd9,_0x2476ca){if(_0x53bbd9[_0x8755('0x49')]['id']){delete _0x53bbd9['body']['id'];}return db['SmsApplication']['find']({'where':{'id':_0x53bbd9[_0x8755('0x45')]['id']}})[_0x8755('0x25')](handleEntityNotFound(_0x2476ca,null))[_0x8755('0x25')](saveUpdates(_0x53bbd9[_0x8755('0x49')],null))[_0x8755('0x25')](respondWithResult(_0x2476ca,null))[_0x8755('0x44')](handleError(_0x2476ca,null));};exports[_0x8755('0x26')]=function(_0x5a568e,_0x46903f){return db['SmsApplication'][_0x8755('0x4a')]({'where':{'id':_0x5a568e[_0x8755('0x45')]['id']}})[_0x8755('0x25')](handleEntityNotFound(_0x46903f,null))[_0x8755('0x25')](removeEntity(_0x46903f,null))[_0x8755('0x44')](handleError(_0x46903f,null));}; \ No newline at end of file +var _0x6bd4=['util','path','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','undefined','count','offset','limit','set','apply','save','update','then','destroy','error','stack','name','send','index','SmsApplication','type','model','map','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','catch','show','params','rawAttributes','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0x5b847f,_0x59d01a){var _0x53984c=function(_0x31990d){while(--_0x31990d){_0x5b847f['push'](_0x5b847f['shift']());}};_0x53984c(++_0x59d01a);}(_0x6bd4,0x179));var _0x46bd=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0x6bd4[_0x5f1391];return _0x50ebe3;};'use strict';var emlformat=require(_0x46bd('0x0'));var rimraf=require(_0x46bd('0x1'));var zipdir=require(_0x46bd('0x2'));var jsonpatch=require(_0x46bd('0x3'));var rp=require(_0x46bd('0x4'));var moment=require(_0x46bd('0x5'));var BPromise=require(_0x46bd('0x6'));var Mustache=require(_0x46bd('0x7'));var util=require(_0x46bd('0x8'));var path=require(_0x46bd('0x9'));var sox=require('sox');var csv=require(_0x46bd('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x46bd('0xb'));var _=require(_0x46bd('0xc'));var squel=require(_0x46bd('0xd'));var crypto=require(_0x46bd('0xe'));var jsforce=require(_0x46bd('0xf'));var deskjs=require(_0x46bd('0x10'));var toCsv=require(_0x46bd('0xa'));var querystring=require('querystring');var Papa=require(_0x46bd('0x11'));var Redis=require(_0x46bd('0x12'));var authService=require(_0x46bd('0x13'));var qs=require(_0x46bd('0x14'));var as=require(_0x46bd('0x15'));var hardwareService=require(_0x46bd('0x16'));var logger=require(_0x46bd('0x17'))(_0x46bd('0x18'));var utils=require('../../config/utils');var config=require(_0x46bd('0x19'));var licenseUtil=require(_0x46bd('0x1a'));var db=require(_0x46bd('0x1b'))['db'];function respondWithStatusCode(_0x32e285,_0x4a30ba){_0x4a30ba=_0x4a30ba||0xcc;return function(_0x48bdf6){if(_0x48bdf6){return _0x32e285[_0x46bd('0x1c')](_0x4a30ba);}return _0x32e285[_0x46bd('0x1d')](_0x4a30ba)[_0x46bd('0x1e')]();};}function respondWithResult(_0x394dbe,_0x39d205){_0x39d205=_0x39d205||0xc8;return function(_0x2a306b){if(_0x2a306b){return _0x394dbe['status'](_0x39d205)[_0x46bd('0x1f')](_0x2a306b);}};}function respondWithFilteredResult(_0x28a109,_0x2c69ad){return function(_0x4c04e9){if(_0x4c04e9){var _0x2dc6ae=typeof _0x2c69ad['offset']==='undefined'&&typeof _0x2c69ad['limit']===_0x46bd('0x20');var _0xdd668b=_0x4c04e9[_0x46bd('0x21')];var _0x3511e4=_0x2dc6ae?0x0:_0x2c69ad[_0x46bd('0x22')];var _0x27f62a=_0x2dc6ae?_0x4c04e9[_0x46bd('0x21')]:_0x2c69ad[_0x46bd('0x22')]+_0x2c69ad[_0x46bd('0x23')];var _0x49cfb8;if(_0x27f62a>=_0xdd668b){_0x27f62a=_0xdd668b;_0x49cfb8=0xc8;}else{_0x49cfb8=0xce;}_0x28a109[_0x46bd('0x1d')](_0x49cfb8);return _0x28a109[_0x46bd('0x24')]('Content-Range',_0x3511e4+'-'+_0x27f62a+'/'+_0xdd668b)[_0x46bd('0x1f')](_0x4c04e9);}return null;};}function patchUpdates(_0x16cee8){return function(_0x637c89){try{jsonpatch[_0x46bd('0x25')](_0x637c89,_0x16cee8,!![]);}catch(_0x44321b){return BPromise['reject'](_0x44321b);}return _0x637c89[_0x46bd('0x26')]();};}function saveUpdates(_0x2aa3d0,_0xb357fc){return function(_0x549a75){if(_0x549a75){return _0x549a75[_0x46bd('0x27')](_0x2aa3d0)[_0x46bd('0x28')](function(_0x5b7372){return _0x5b7372;});}return null;};}function removeEntity(_0x212977,_0x488923){return function(_0x2f371a){if(_0x2f371a){return _0x2f371a[_0x46bd('0x29')]()[_0x46bd('0x28')](function(){_0x212977['status'](0xcc)[_0x46bd('0x1e')]();});}};}function handleEntityNotFound(_0x1add09,_0x10184e){return function(_0x59964c){if(!_0x59964c){_0x1add09['sendStatus'](0x194);}return _0x59964c;};}function handleError(_0x41074c,_0x2947a0){_0x2947a0=_0x2947a0||0x1f4;return function(_0x54b1d9){logger[_0x46bd('0x2a')](_0x54b1d9[_0x46bd('0x2b')]);if(_0x54b1d9[_0x46bd('0x2c')]){delete _0x54b1d9[_0x46bd('0x2c')];}_0x41074c[_0x46bd('0x1d')](_0x2947a0)[_0x46bd('0x2d')](_0x54b1d9);};}exports[_0x46bd('0x2e')]=function(_0x1efe3f,_0x16cca8){var _0x5c5716={},_0x137035={},_0x30191d={'count':0x0,'rows':[]};var _0xab868f=_['map'](db[_0x46bd('0x2f')]['rawAttributes'],function(_0x4a2d56){return{'name':_0x4a2d56['fieldName'],'type':_0x4a2d56[_0x46bd('0x30')]['key']};});_0x137035[_0x46bd('0x31')]=_[_0x46bd('0x32')](_0xab868f,_0x46bd('0x2c'));_0x137035[_0x46bd('0x33')]=_[_0x46bd('0x34')](_0x1efe3f[_0x46bd('0x33')]);_0x137035['filters']=_['intersection'](_0x137035[_0x46bd('0x31')],_0x137035[_0x46bd('0x33')]);_0x5c5716[_0x46bd('0x35')]=_[_0x46bd('0x36')](_0x137035[_0x46bd('0x31')],qs['fields'](_0x1efe3f[_0x46bd('0x33')][_0x46bd('0x37')]));_0x5c5716['attributes']=_0x5c5716[_0x46bd('0x35')][_0x46bd('0x38')]?_0x5c5716[_0x46bd('0x35')]:_0x137035[_0x46bd('0x31')];if(!_0x1efe3f['query'][_0x46bd('0x39')](_0x46bd('0x3a'))){_0x5c5716['limit']=qs['limit'](_0x1efe3f['query'][_0x46bd('0x23')]);_0x5c5716[_0x46bd('0x22')]=qs[_0x46bd('0x22')](_0x1efe3f[_0x46bd('0x33')][_0x46bd('0x22')]);}_0x5c5716[_0x46bd('0x3b')]=qs[_0x46bd('0x3c')](_0x1efe3f['query']['sort']);_0x5c5716[_0x46bd('0x3d')]=qs[_0x46bd('0x3e')](_[_0x46bd('0x3f')](_0x1efe3f['query'],_0x137035['filters']),_0xab868f);if(_0x1efe3f[_0x46bd('0x33')][_0x46bd('0x40')]){_0x5c5716[_0x46bd('0x3d')]=_[_0x46bd('0x41')](_0x5c5716[_0x46bd('0x3d')],{'$or':_[_0x46bd('0x32')](_0xab868f,function(_0xbaa33d){if(_0xbaa33d[_0x46bd('0x30')]!==_0x46bd('0x42')){var _0x238940={};_0x238940[_0xbaa33d['name']]={'$like':'%'+_0x1efe3f['query'][_0x46bd('0x40')]+'%'};return _0x238940;}})});}_0x5c5716=_[_0x46bd('0x41')]({},_0x5c5716,_0x1efe3f[_0x46bd('0x43')]);var _0x45a497={'where':_0x5c5716['where']};return db[_0x46bd('0x2f')]['count'](_0x45a497)[_0x46bd('0x28')](function(_0x5dbb1e){_0x30191d[_0x46bd('0x21')]=_0x5dbb1e;if(_0x1efe3f[_0x46bd('0x33')][_0x46bd('0x44')]){_0x5c5716[_0x46bd('0x45')]=[{'all':!![]}];}return db[_0x46bd('0x2f')]['findAll'](_0x5c5716);})[_0x46bd('0x28')](function(_0x31274f){_0x30191d['rows']=_0x31274f;return _0x30191d;})['then'](respondWithFilteredResult(_0x16cca8,_0x5c5716))[_0x46bd('0x46')](handleError(_0x16cca8,null));};exports[_0x46bd('0x47')]=function(_0x53c6a7,_0xb9ebb3){var _0x40f211={'raw':!![],'where':{'id':_0x53c6a7[_0x46bd('0x48')]['id']}},_0x259ee1={};_0x259ee1[_0x46bd('0x31')]=_[_0x46bd('0x34')](db['SmsApplication'][_0x46bd('0x49')]);_0x259ee1[_0x46bd('0x33')]=_['keys'](_0x53c6a7['query']);_0x259ee1['filters']=_[_0x46bd('0x36')](_0x259ee1[_0x46bd('0x31')],_0x259ee1['query']);_0x40f211[_0x46bd('0x35')]=_[_0x46bd('0x36')](_0x259ee1[_0x46bd('0x31')],qs['fields'](_0x53c6a7[_0x46bd('0x33')][_0x46bd('0x37')]));_0x40f211['attributes']=_0x40f211[_0x46bd('0x35')][_0x46bd('0x38')]?_0x40f211[_0x46bd('0x35')]:_0x259ee1['model'];if(_0x53c6a7['query'][_0x46bd('0x44')]){_0x40f211['include']=[{'all':!![]}];}_0x40f211=_['merge']({},_0x40f211,_0x53c6a7[_0x46bd('0x43')]);return db[_0x46bd('0x2f')][_0x46bd('0x4a')](_0x40f211)[_0x46bd('0x28')](handleEntityNotFound(_0xb9ebb3,null))[_0x46bd('0x28')](respondWithResult(_0xb9ebb3,null))['catch'](handleError(_0xb9ebb3,null));};exports[_0x46bd('0x4b')]=function(_0x5d45d0,_0x49fe9a){return db[_0x46bd('0x2f')]['create'](_0x5d45d0[_0x46bd('0x4c')],{})['then'](respondWithResult(_0x49fe9a,0xc9))[_0x46bd('0x46')](handleError(_0x49fe9a,null));};exports[_0x46bd('0x27')]=function(_0x1a8c57,_0x1df8a9){if(_0x1a8c57['body']['id']){delete _0x1a8c57[_0x46bd('0x4c')]['id'];}return db['SmsApplication'][_0x46bd('0x4a')]({'where':{'id':_0x1a8c57['params']['id']}})[_0x46bd('0x28')](handleEntityNotFound(_0x1df8a9,null))[_0x46bd('0x28')](saveUpdates(_0x1a8c57[_0x46bd('0x4c')],null))[_0x46bd('0x28')](respondWithResult(_0x1df8a9,null))['catch'](handleError(_0x1df8a9,null));};exports[_0x46bd('0x29')]=function(_0xfe4863,_0x1d89ef){return db[_0x46bd('0x2f')][_0x46bd('0x4a')]({'where':{'id':_0xfe4863['params']['id']}})[_0x46bd('0x28')](handleEntityNotFound(_0x1d89ef,null))['then'](removeEntity(_0x1d89ef,null))['catch'](handleError(_0x1d89ef,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index 32b7382..ecffc9e 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 _0x7d74=['rimraf','../../config/environment','./smsApplication.attributes','SmsApplication','sms_applications','utf8mb4','utf8mb4_unicode_ci','lodash','moment','bluebird','path'];(function(_0x4f1b7e,_0x19496e){var _0x214fa6=function(_0x515a0f){while(--_0x515a0f){_0x4f1b7e['push'](_0x4f1b7e['shift']());}};_0x214fa6(++_0x19496e);}(_0x7d74,0x172));var _0x47d7=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x7d74[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x47d7('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x47d7('0x1'));var BPromise=require(_0x47d7('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47d7('0x3'));var rimraf=require(_0x47d7('0x4'));var config=require(_0x47d7('0x5'));var attributes=require(_0x47d7('0x6'));module['exports']=function(_0x4db77d,_0x46e398){return _0x4db77d['define'](_0x47d7('0x7'),attributes,{'tableName':_0x47d7('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x47d7('0x9'),'collate':_0x47d7('0xa')});}; \ No newline at end of file +var _0xe049=['bluebird','request-promise','path','rimraf','../../config/environment','exports','define','SmsApplication','sms_applications','utf8mb4','../../config/logger','moment'];(function(_0x3d2f87,_0xa9f93a){var _0x45e78c=function(_0xb0d2f6){while(--_0xb0d2f6){_0x3d2f87['push'](_0x3d2f87['shift']());}};_0x45e78c(++_0xa9f93a);}(_0xe049,0xa6));var _0x9e04=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0xe049[_0x178e48];return _0x440d7e;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x9e04('0x0'))('api');var moment=require(_0x9e04('0x1'));var BPromise=require(_0x9e04('0x2'));var rp=require(_0x9e04('0x3'));var fs=require('fs');var path=require(_0x9e04('0x4'));var rimraf=require(_0x9e04('0x5'));var config=require(_0x9e04('0x6'));var attributes=require('./smsApplication.attributes');module[_0x9e04('0x7')]=function(_0x53884b,_0x2a02dc){return _0x53884b[_0x9e04('0x8')](_0x9e04('0x9'),attributes,{'tableName':_0x9e04('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x9e04('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index 6517578..33f761d 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 _0x15b8=['request','then','info','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x56a1c3,_0x15b24f){var _0x1be23e=function(_0x3035bc){while(--_0x3035bc){_0x56a1c3['push'](_0x56a1c3['shift']());}};_0x1be23e(++_0x15b24f);}(_0x15b8,0xcd));var _0x815b=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x15b8[_0x167cc1];return _0x10bc4b;};'use strict';var _=require('lodash');var util=require(_0x815b('0x0'));var moment=require(_0x815b('0x1'));var BPromise=require(_0x815b('0x2'));var rs=require(_0x815b('0x3'));var fs=require('fs');var Redis=require(_0x815b('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x815b('0x5'));var logger=require(_0x815b('0x6'))(_0x815b('0x7'));var config=require(_0x815b('0x8'));var jayson=require(_0x815b('0x9'));var client=jayson[_0x815b('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1e9fc0,_0xdfdf6,_0x26119a){return new BPromise(function(_0x175053,_0x2170c5){return client[_0x815b('0xb')](_0x1e9fc0,_0x26119a)[_0x815b('0xc')](function(_0x221ce4){logger[_0x815b('0xd')](_0x815b('0xe'),_0xdfdf6,_0x815b('0xf'));logger[_0x815b('0x10')](_0x815b('0x11'),_0xdfdf6,_0x815b('0xf'),JSON[_0x815b('0x12')](_0x221ce4));if(_0x221ce4[_0x815b('0x13')]){if(_0x221ce4[_0x815b('0x13')][_0x815b('0x14')]===0x1f4){logger['error']('SmsApplication,\x20%s,\x20%s',_0xdfdf6,_0x221ce4[_0x815b('0x13')][_0x815b('0x15')]);return _0x2170c5(_0x221ce4['error']['message']);}logger['error'](_0x815b('0xe'),_0xdfdf6,_0x221ce4['error']['message']);return _0x175053(_0x221ce4[_0x815b('0x13')][_0x815b('0x15')]);}else{logger[_0x815b('0xd')]('SmsApplication,\x20%s,\x20%s',_0xdfdf6,'request\x20sent');_0x175053(_0x221ce4[_0x815b('0x16')][_0x815b('0x15')]);}})[_0x815b('0x17')](function(_0x4078db){logger[_0x815b('0x13')](_0x815b('0xe'),_0xdfdf6,_0x4078db);_0x2170c5(_0x4078db);});});} \ No newline at end of file +var _0xb1ad=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','SmsApplication,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch','lodash','util','moment'];(function(_0x5aba7b,_0x23dccc){var _0x6ab65f=function(_0x2779a5){while(--_0x2779a5){_0x5aba7b['push'](_0x5aba7b['shift']());}};_0x6ab65f(++_0x23dccc);}(_0xb1ad,0x184));var _0xdb1a=function(_0x1da04e,_0x31024b){_0x1da04e=_0x1da04e-0x0;var _0xdd8c41=_0xb1ad[_0x1da04e];return _0xdd8c41;};'use strict';var _=require(_0xdb1a('0x0'));var util=require(_0xdb1a('0x1'));var moment=require(_0xdb1a('0x2'));var BPromise=require(_0xdb1a('0x3'));var rs=require(_0xdb1a('0x4'));var fs=require('fs');var Redis=require(_0xdb1a('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xdb1a('0x6'));var logger=require(_0xdb1a('0x7'))(_0xdb1a('0x8'));var config=require(_0xdb1a('0x9'));var jayson=require(_0xdb1a('0xa'));var client=jayson[_0xdb1a('0xb')][_0xdb1a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x12b8c5,_0x2712fe,_0x2a24f2){return new BPromise(function(_0x5fc831,_0x188988){return client[_0xdb1a('0xd')](_0x12b8c5,_0x2a24f2)[_0xdb1a('0xe')](function(_0x122af8){logger['info'](_0xdb1a('0xf'),_0x2712fe,_0xdb1a('0x10'));logger['debug']('SmsApplication,\x20%s,\x20%s,\x20%s',_0x2712fe,'request\x20sent',JSON[_0xdb1a('0x11')](_0x122af8));if(_0x122af8[_0xdb1a('0x12')]){if(_0x122af8[_0xdb1a('0x12')][_0xdb1a('0x13')]===0x1f4){logger[_0xdb1a('0x12')](_0xdb1a('0xf'),_0x2712fe,_0x122af8[_0xdb1a('0x12')][_0xdb1a('0x14')]);return _0x188988(_0x122af8[_0xdb1a('0x12')][_0xdb1a('0x14')]);}logger[_0xdb1a('0x12')](_0xdb1a('0xf'),_0x2712fe,_0x122af8[_0xdb1a('0x12')]['message']);return _0x5fc831(_0x122af8[_0xdb1a('0x12')][_0xdb1a('0x14')]);}else{logger[_0xdb1a('0x15')]('SmsApplication,\x20%s,\x20%s',_0x2712fe,_0xdb1a('0x10'));_0x5fc831(_0x122af8['result'][_0xdb1a('0x14')]);}})[_0xdb1a('0x16')](function(_0x1637fa){logger['error'](_0xdb1a('0xf'),_0x2712fe,_0x1637fa);_0x188988(_0x1637fa);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index a5eb42f..c206dc9 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 _0x3266=['isAuthenticated','index','get','/:id','show','getMessages','/:id/download','download','post','create','addMessage','sms','smsinteraction:addtags','addTags','put','smsinteraction:destroy','destroy','removeTags','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsInteraction.controller'];(function(_0xbed0b4,_0x31b992){var _0x11397c=function(_0x502af7){while(--_0x502af7){_0xbed0b4['push'](_0xbed0b4['shift']());}};_0x11397c(++_0x31b992);}(_0x3266,0x6a));var _0x6326=function(_0x54defc,_0x627178){_0x54defc=_0x54defc-0x0;var _0x1955d3=_0x3266[_0x54defc];return _0x1955d3;};'use strict';var multer=require(_0x6326('0x0'));var util=require(_0x6326('0x1'));var path=require(_0x6326('0x2'));var timeout=require(_0x6326('0x3'));var express=require(_0x6326('0x4'));var router=express[_0x6326('0x5')]();var fs_extra=require(_0x6326('0x6'));var auth=require(_0x6326('0x7'));var interaction=require(_0x6326('0x8'));var config=require('../../config/environment');var controller=require(_0x6326('0x9'));router['get']('/',auth[_0x6326('0xa')](),controller[_0x6326('0xb')]);router[_0x6326('0xc')]('/describe',auth[_0x6326('0xa')](),controller['describe']);router[_0x6326('0xc')](_0x6326('0xd'),auth[_0x6326('0xa')](),controller[_0x6326('0xe')]);router[_0x6326('0xc')]('/:id/messages',auth[_0x6326('0xa')](),controller[_0x6326('0xf')]);router[_0x6326('0xc')](_0x6326('0x10'),auth[_0x6326('0xa')](),controller[_0x6326('0x11')]);router[_0x6326('0x12')]('/',auth[_0x6326('0xa')](),controller[_0x6326('0x13')]);router[_0x6326('0x12')]('/:id/messages',auth['isAuthenticated'](),controller[_0x6326('0x14')]);router[_0x6326('0x12')]('/:id/tags',auth[_0x6326('0xa')](),interaction['tracked'](_0x6326('0x15'),_0x6326('0x16')),controller[_0x6326('0x17')]);router[_0x6326('0x18')](_0x6326('0xd'),auth[_0x6326('0xa')](),interaction['tracked'](_0x6326('0x15'),'smsinteraction:update'),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),interaction['tracked'](_0x6326('0x15'),_0x6326('0x19')),controller[_0x6326('0x1a')]);router['delete']('/:id/tags',auth[_0x6326('0xa')](),controller[_0x6326('0x1b')]);module[_0x6326('0x1c')]=router; \ No newline at end of file +var _0x2547=['/:id/messages','getMessages','/:id/download','post','create','addMessage','/:id/tags','tracked','sms','smsinteraction:addtags','addTags','put','smsinteraction:update','update','delete','smsinteraction:destroy','destroy','removeTags','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x457c4f,_0x50c243){var _0x48902c=function(_0x1691d5){while(--_0x1691d5){_0x457c4f['push'](_0x457c4f['shift']());}};_0x48902c(++_0x50c243);}(_0x2547,0x1cd));var _0x7254=function(_0x6e0437,_0x5a73aa){_0x6e0437=_0x6e0437-0x0;var _0x424f39=_0x2547[_0x6e0437];return _0x424f39;};'use strict';var multer=require('multer');var util=require(_0x7254('0x0'));var path=require(_0x7254('0x1'));var timeout=require(_0x7254('0x2'));var express=require(_0x7254('0x3'));var router=express[_0x7254('0x4')]();var fs_extra=require(_0x7254('0x5'));var auth=require(_0x7254('0x6'));var interaction=require(_0x7254('0x7'));var config=require('../../config/environment');var controller=require(_0x7254('0x8'));router[_0x7254('0x9')]('/',auth[_0x7254('0xa')](),controller[_0x7254('0xb')]);router['get'](_0x7254('0xc'),auth[_0x7254('0xa')](),controller[_0x7254('0xd')]);router['get'](_0x7254('0xe'),auth['isAuthenticated'](),controller['show']);router['get'](_0x7254('0xf'),auth[_0x7254('0xa')](),controller[_0x7254('0x10')]);router[_0x7254('0x9')](_0x7254('0x11'),auth[_0x7254('0xa')](),controller['download']);router[_0x7254('0x12')]('/',auth['isAuthenticated'](),controller[_0x7254('0x13')]);router['post'](_0x7254('0xf'),auth[_0x7254('0xa')](),controller[_0x7254('0x14')]);router[_0x7254('0x12')](_0x7254('0x15'),auth[_0x7254('0xa')](),interaction[_0x7254('0x16')](_0x7254('0x17'),_0x7254('0x18')),controller[_0x7254('0x19')]);router[_0x7254('0x1a')](_0x7254('0xe'),auth[_0x7254('0xa')](),interaction['tracked'](_0x7254('0x17'),_0x7254('0x1b')),controller[_0x7254('0x1c')]);router[_0x7254('0x1d')](_0x7254('0xe'),auth[_0x7254('0xa')](),interaction[_0x7254('0x16')]('sms',_0x7254('0x1e')),controller[_0x7254('0x1f')]);router[_0x7254('0x1d')](_0x7254('0x15'),auth[_0x7254('0xa')](),controller[_0x7254('0x20')]);module[_0x7254('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 4e0c38a..4d1fb46 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 _0x0f9f=['moment','exports','BOOLEAN','DATE','STRING','out','sequelize'];(function(_0x392ae4,_0x5e4dbc){var _0x58a800=function(_0x1c5640){while(--_0x1c5640){_0x392ae4['push'](_0x392ae4['shift']());}};_0x58a800(++_0x5e4dbc);}(_0x0f9f,0xae));var _0xf0f9=function(_0x4e324f,_0x4f0cfc){_0x4e324f=_0x4e324f-0x0;var _0x4e6076=_0x0f9f[_0x4e324f];return _0x4e6076;};'use strict';var Sequelize=require(_0xf0f9('0x0'));var moment=require(_0xf0f9('0x1'));module[_0xf0f9('0x2')]={'closed':{'type':Sequelize[_0xf0f9('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xf0f9('0x4')]},'disposition':{'type':Sequelize[_0xf0f9('0x5')]},'secondDisposition':{'type':Sequelize[_0xf0f9('0x5')]},'thirdDisposition':{'type':Sequelize[_0xf0f9('0x5')]},'note':{'type':Sequelize[_0xf0f9('0x5')]},'phone':{'type':Sequelize[_0xf0f9('0x5')]},'read1stAt':{'type':Sequelize[_0xf0f9('0x4')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0xf0f9('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xf0f9('0x4')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xf0f9('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xf0f9('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x0cfe=['ENUM','out','sequelize','exports','BOOLEAN','DATE','STRING'];(function(_0x13c872,_0x47e814){var _0x1edded=function(_0x2b8c21){while(--_0x2b8c21){_0x13c872['push'](_0x13c872['shift']());}};_0x1edded(++_0x47e814);}(_0x0cfe,0x9c));var _0xe0cf=function(_0x2e931a,_0x47f8c1){_0x2e931a=_0x2e931a-0x0;var _0x5e3d09=_0x0cfe[_0x2e931a];return _0x5e3d09;};'use strict';var Sequelize=require(_0xe0cf('0x0'));var moment=require('moment');module[_0xe0cf('0x1')]={'closed':{'type':Sequelize[_0xe0cf('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xe0cf('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xe0cf('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xe0cf('0x4')]},'phone':{'type':Sequelize[_0xe0cf('0x4')]},'read1stAt':{'type':Sequelize[_0xe0cf('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xe0cf('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xe0cf('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xe0cf('0x5')]('in',_0xe0cf('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index 1f0d77c..dc10e51 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 _0x7030=['hasOwnProperty','nolimit','order','sort','filters','field','color','from','select','u.id','u.fullname','ui.SmsInteractionId','users','u.id\x20=\x20ui.UserId','sms_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','left_join','o.id\x20=\x20i.UserId','sms_accounts','a.id\x20=\x20i.SmsAccountId','sms_messages','me.SmsInteractionId\x20=\x20i.id','sms_interaction_has_tags','it.SmsInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','parseSearch','search','sqlOperator','conditions','find','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','split','length','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','ContactId','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','buildExpression','some','compact','SmsAccountId','concat','createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','where','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','Sequelize','QueryTypes','SELECT','clone','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','contactName','DESC','isEmpty','t.id\x20IN\x20?','resolve','i.SmsAccountId\x20IS\x20NOT\x20NULL','agent','user','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','i.SmsAccountId\x20IN\x20?','role','sequelize','toString','keyBy','a.key','Account.key','a.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','c.mobile','Contact.mobile','Contact.fax','o.fullname','Owner.fullname','o.internal','ui.SmsInteractionId\x20IN\x20?','SmsInteractionId','rows','show','params','includeAll','merge','options','create','body','describe','SmsMessage','addMessage','ids','getMessages','pick','$gte','format','include','findAll','addTags','setTags','omit','spread','emit','removeTags','download','unix','join','server','files','root','attachments','transcript-%d-%s.zip','CmContact','firstName','direction','secret','Account','Owner','get','mkdirSync','Sms','N.A.','YYYY-MM-DD\x20HH:mm:ss','disposition','Messages','out','lastName','createPdfFromHTML','err','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','register','sendStatus','status','json','offset','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','end','stack','name','map','fullname','TagIds','forEach','Tags','push','catch','index','SmsInteraction','rawAttributes','fieldName','type','model','query','keys','intersection','fields','attributes'];(function(_0x47ea23,_0x53791a){var _0x1db219=function(_0x2c7a71){while(--_0x2c7a71){_0x47ea23['push'](_0x47ea23['shift']());}};_0x1db219(++_0x53791a);}(_0x7030,0x18c));var _0x0703=function(_0x5ce33c,_0x5c75a9){_0x5ce33c=_0x5ce33c-0x0;var _0x40c7d4=_0x7030[_0x5ce33c];return _0x40c7d4;};'use strict';var emlformat=require(_0x0703('0x0'));var rimraf=require(_0x0703('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0703('0x2'));var rp=require(_0x0703('0x3'));var moment=require('moment');var BPromise=require(_0x0703('0x4'));var Mustache=require(_0x0703('0x5'));var util=require('util');var path=require('path');var sox=require(_0x0703('0x6'));var csv=require(_0x0703('0x7'));var ejs=require(_0x0703('0x8'));var fs=require('fs');var fs_extra=require(_0x0703('0x9'));var _=require(_0x0703('0xa'));var squel=require(_0x0703('0xb'));var crypto=require('crypto');var jsforce=require(_0x0703('0xc'));var deskjs=require(_0x0703('0xd'));var toCsv=require('to-csv');var querystring=require(_0x0703('0xe'));var Papa=require(_0x0703('0xf'));var Redis=require(_0x0703('0x10'));var authService=require(_0x0703('0x11'));var qs=require(_0x0703('0x12'));var as=require(_0x0703('0x13'));var pdf=require(_0x0703('0x14'));var hardwareService=require(_0x0703('0x15'));var logger=require(_0x0703('0x16'))(_0x0703('0x17'));var utils=require('../../config/utils');var config=require(_0x0703('0x18'));var licenseUtil=require(_0x0703('0x19'));var db=require(_0x0703('0x1a'))['db'];config[_0x0703('0x1b')]=_[_0x0703('0x1c')](config[_0x0703('0x1b')],{'host':_0x0703('0x1d'),'port':0x18eb});var socket=require(_0x0703('0x1e'))(new Redis(config[_0x0703('0x1b')]));require(_0x0703('0x1f'))[_0x0703('0x20')](socket);function respondWithStatusCode(_0x5349ca,_0x1f384){_0x1f384=_0x1f384||0xcc;return function(_0x3ab279){if(_0x3ab279){return _0x5349ca[_0x0703('0x21')](_0x1f384);}return _0x5349ca['status'](_0x1f384)['end']();};}function respondWithResult(_0x122b2a,_0x1a8edb){_0x1a8edb=_0x1a8edb||0xc8;return function(_0x5f3425){if(_0x5f3425){return _0x122b2a[_0x0703('0x22')](_0x1a8edb)[_0x0703('0x23')](_0x5f3425);}};}function respondWithFilteredResult(_0x56a06a,_0x5cf3fb){return function(_0x34a217){if(_0x34a217){var _0x4941f2=typeof _0x5cf3fb[_0x0703('0x24')]==='undefined'&&typeof _0x5cf3fb[_0x0703('0x25')]==='undefined';var _0x2b3616=_0x34a217[_0x0703('0x26')];var _0x1cc20b=_0x4941f2?0x0:_0x5cf3fb['offset'];var _0x3a468b=_0x4941f2?_0x34a217[_0x0703('0x26')]:_0x5cf3fb['offset']+_0x5cf3fb[_0x0703('0x25')];var _0x58235f;if(_0x3a468b>=_0x2b3616){_0x3a468b=_0x2b3616;_0x58235f=0xc8;}else{_0x58235f=0xce;}_0x56a06a[_0x0703('0x22')](_0x58235f);return _0x56a06a[_0x0703('0x27')](_0x0703('0x28'),_0x1cc20b+'-'+_0x3a468b+'/'+_0x2b3616)['json'](_0x34a217);}return null;};}function patchUpdates(_0x4410b3){return function(_0x56d715){try{jsonpatch[_0x0703('0x29')](_0x56d715,_0x4410b3,!![]);}catch(_0x8ac7b8){return BPromise[_0x0703('0x2a')](_0x8ac7b8);}return _0x56d715[_0x0703('0x2b')]();};}function saveUpdates(_0x29467e,_0x22a2e7){return function(_0x58f6d4){if(_0x58f6d4){return _0x58f6d4[_0x0703('0x2c')](_0x29467e)['then'](function(_0x153f03){return _0x153f03;});}return null;};}function removeEntity(_0x4902cf,_0x338e99){return function(_0x2bc684){if(_0x2bc684){return _0x2bc684[_0x0703('0x2d')]()[_0x0703('0x2e')](function(){_0x4902cf[_0x0703('0x22')](0xcc)[_0x0703('0x2f')]();});}};}function handleEntityNotFound(_0x59c32c,_0x5907d0){return function(_0x293307){if(!_0x293307){_0x59c32c['sendStatus'](0x194);}return _0x293307;};}function handleError(_0x55f345,_0x141c96){_0x141c96=_0x141c96||0x1f4;return function(_0x23ec56){logger['error'](_0x23ec56[_0x0703('0x30')]);if(_0x23ec56[_0x0703('0x31')]){delete _0x23ec56['name'];}_0x55f345['status'](_0x141c96)['send'](_0x23ec56);};}function getInteractionUsers(_0x536041,_0x28574e){return new BPromise(function(_0x13568e,_0x7712df){try{if(_0x28574e[_0x536041['id']]){_0x536041['Users']=_[_0x0703('0x32')](_0x28574e[_0x536041['id']],function(_0x4041dd){return{'id':_0x4041dd['id'],'fullname':_0x4041dd[_0x0703('0x33')]};});}}catch(_0x121007){_0x7712df(_0x121007);}_0x13568e(_0x536041);});}function getInteractionTags(_0x8ea276,_0x4738e9){return new BPromise(function(_0x459d37,_0x2d4149){try{if(_0x8ea276[_0x0703('0x34')]){_0x8ea276['Tags']=[];_0x8ea276[_0x0703('0x34')]['split'](',')[_0x0703('0x35')](function(_0x573bbb){_0x8ea276[_0x0703('0x36')][_0x0703('0x37')](_0x4738e9[_0x573bbb]);});}delete _0x8ea276[_0x0703('0x34')];}catch(_0x5910d5){_0x2d4149(_0x5910d5);}_0x459d37(_0x8ea276);});}function updateSmsInteraction(_0x422bdf,_0x132031,_0x3f82b1){return new BPromise(function(_0x4f2914,_0x211d6e){return getInteractionUsers(_0x422bdf,_0x3f82b1)['then'](function(_0x7063a){return getInteractionTags(_0x7063a,_0x132031);})[_0x0703('0x2e')](function(_0x24c2f0){_0x4f2914(_0x24c2f0);})[_0x0703('0x38')](function(_0x101aaa){_0x211d6e(_0x101aaa);});});}exports[_0x0703('0x39')]=function(_0x336715,_0x2d825a){var _0x2f3fbd={},_0x5b1ee0={},_0xab1a47={'count':0x0,'rows':[]};var _0x2e939b=_[_0x0703('0x32')](db[_0x0703('0x3a')][_0x0703('0x3b')],function(_0x5ab110){return{'name':_0x5ab110[_0x0703('0x3c')],'type':_0x5ab110[_0x0703('0x3d')]['key']};});_0x5b1ee0[_0x0703('0x3e')]=_[_0x0703('0x32')](_0x2e939b,_0x0703('0x31'));_0x5b1ee0[_0x0703('0x3f')]=_[_0x0703('0x40')](_0x336715[_0x0703('0x3f')]);_0x5b1ee0['filters']=_[_0x0703('0x41')](_0x5b1ee0[_0x0703('0x3e')],_0x5b1ee0[_0x0703('0x3f')]);_0x2f3fbd['attributes']=_['intersection'](_0x5b1ee0['model'],qs[_0x0703('0x42')](_0x336715[_0x0703('0x3f')]['fields']));_0x2f3fbd[_0x0703('0x43')]=_0x2f3fbd[_0x0703('0x43')]['length']?_0x2f3fbd[_0x0703('0x43')]:_0x5b1ee0[_0x0703('0x3e')];if(!_0x336715[_0x0703('0x3f')][_0x0703('0x44')](_0x0703('0x45'))){_0x2f3fbd[_0x0703('0x25')]=qs[_0x0703('0x25')](_0x336715[_0x0703('0x3f')]['limit']);_0x2f3fbd[_0x0703('0x24')]=qs[_0x0703('0x24')](_0x336715[_0x0703('0x3f')]['offset']);}_0x2f3fbd[_0x0703('0x46')]=qs[_0x0703('0x47')](_0x336715[_0x0703('0x3f')][_0x0703('0x47')]);_0x2f3fbd['where']=qs['filters'](_['pick'](_0x336715['query'],_0x5b1ee0[_0x0703('0x48')]),_0x2e939b);var _0x191b53=[];var _0x2c37bc=squel['select']()['field']('id')[_0x0703('0x49')]('name')[_0x0703('0x49')](_0x0703('0x4a'))[_0x0703('0x4b')]('tools_tags');var _0x366b3c=squel[_0x0703('0x4c')]()['field'](_0x0703('0x4d'))[_0x0703('0x49')](_0x0703('0x4e'))['field'](_0x0703('0x4f'))[_0x0703('0x4b')]('user_has_sms_interactions','ui')['left_join'](_0x0703('0x50'),'u',_0x0703('0x51'));var _0x594adf=squel['select']()[_0x0703('0x4b')](_0x0703('0x52'),'i')['left_join']('cm_contacts','c',_0x0703('0x53'))[_0x0703('0x54')](_0x0703('0x50'),'o',_0x0703('0x55'))['left_join'](_0x0703('0x56'),'a',_0x0703('0x57'))[_0x0703('0x54')](_0x0703('0x58'),'me',_0x0703('0x59'))[_0x0703('0x54')](_0x0703('0x5a'),'it',_0x0703('0x5b'))['left_join']('tools_tags','t',_0x0703('0x5c'));var _0x257f7f=squel['expr']();var _0x29f738=[];var _0x348ad1=squel['expr']();var _0x2751a4;if(_0x336715[_0x0703('0x3f')]['search']){_0x2751a4=as[_0x0703('0x5d')](_0x336715[_0x0703('0x3f')][_0x0703('0x5e')]);var _0x456575=_0x2751a4[_0x0703('0x5f')];for(var _0x1c20df=0x0;_0x1c20df<_0x2751a4['conditions']['length'];_0x1c20df++){var _0x3eff19=_0x2751a4[_0x0703('0x60')][_0x1c20df];var _0x201c98='i';var _0x4cbd4=_[_0x0703('0x61')](_0x2e939b,[_0x0703('0x31'),_0x3eff19[_0x0703('0x49')]]);if(!_0x4cbd4){switch(_0x3eff19[_0x0703('0x49')]){case'unreadMessages':if(_0x3eff19[_0x0703('0x62')]==0x1){_0x594adf[_0x0703('0x63')]('`'+_0x3eff19[_0x0703('0x49')]+_0x0703('0x64'));}else{_0x594adf[_0x0703('0x63')]('`'+_0x3eff19[_0x0703('0x49')]+_0x0703('0x65'));}break;case _0x0703('0x66'):if(_0x3eff19[_0x0703('0x67')]===_0x0703('0x68')){if(_0x3eff19['value'][_0x0703('0x69')]('\x20')[_0x0703('0x6a')]>0x1){_0x257f7f[_0x456575](_0x0703('0x6b'),qs['getFullTextValue'](_0x3eff19['value']),null);}else{var _0x4b976f='%'+_0x3eff19['value']+'%';_0x257f7f[_0x456575]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x4b976f,_0x4b976f,_0x4b976f);}}else{_0x4cbd4=_[_0x0703('0x61')](_0x2e939b,[_0x0703('0x31'),_0x0703('0x6c')]);_0x3eff19[_0x0703('0x49')]=_0x0703('0x6c');_0x198014=as['buildExpression'](_0x201c98,_0x4cbd4[_0x0703('0x3d')],_0x3eff19);_0x257f7f[_0x456575](_0x198014[_0x0703('0x6d')],_0x198014[_0x0703('0x62')][_0x0703('0x6e')],_0x198014[_0x0703('0x62')]['end']);}break;case _0x0703('0x6f'):var _0x557903=_0x3eff19[_0x0703('0x62')][_0x0703('0x69')](',')[_0x0703('0x32')](function(_0x580221){return Number(_0x580221);});_0x557903[_0x0703('0x35')](function(_0x3933ce){_0x348ad1['or'](_0x0703('0x70'),'%,'+_0x3933ce+',%');});_0x29f738=_['union'](_0x29f738,_0x557903);break;case _0x0703('0x71'):if(_0x3eff19[_0x0703('0x67')]===_0x0703('0x68')){_0x257f7f[_0x456575](_0x0703('0x72'),'%'+_0x3eff19[_0x0703('0x62')]+'%',null);}else{_0x4cbd4=_[_0x0703('0x61')](_0x2e939b,['name','UserId']);_0x3eff19[_0x0703('0x49')]=_0x0703('0x73');_0x198014=as['buildExpression'](_0x201c98,_0x4cbd4['type'],_0x3eff19);_0x257f7f[_0x456575](_0x198014[_0x0703('0x6d')],_0x198014['value'][_0x0703('0x6e')],_0x198014[_0x0703('0x62')][_0x0703('0x2f')]);}break;case'body':_0x198014=as[_0x0703('0x74')]('me',null,_0x3eff19);_0x257f7f[_0x456575](_0x198014[_0x0703('0x6d')],_0x198014[_0x0703('0x62')][_0x0703('0x6e')],_0x198014['value'][_0x0703('0x2f')]);break;}}else{var _0x198014=as[_0x0703('0x74')](_0x201c98,_0x4cbd4[_0x0703('0x3d')],_0x3eff19);_0x257f7f[_0x456575](_0x198014[_0x0703('0x6d')],_0x198014['value'][_0x0703('0x6e')],_0x198014['value'][_0x0703('0x2f')]);}}}else{var _0x1ccb05=_(_0x336715[_0x0703('0x3f')])[_0x0703('0x40')]()[_0x0703('0x32')](function(_0x11a074){return _[_0x0703('0x75')](_0x2e939b,[_0x0703('0x31'),_0x11a074])?_0x11a074:undefined;})[_0x0703('0x76')]()[_0x0703('0x62')]();if(!_['isEmpty'](_0x1ccb05)){_0x1ccb05[_0x0703('0x35')](function(_0x5ada05){if(_0x5ada05===_0x0703('0x77')){_0x594adf['where']('i.SmsAccountId\x20IN\x20?',[][_0x0703('0x78')](_0x336715['query'][_0x5ada05]));}else if(_0x5ada05===_0x0703('0x79')){var _0x4981a3=JSON[_0x0703('0x7a')](_0x336715[_0x0703('0x3f')][_0x5ada05])['$gte'];var _0x1ac12f=JSON[_0x0703('0x7a')](_0x336715[_0x0703('0x3f')][_0x5ada05])[_0x0703('0x7b')];_0x594adf['where'](_0x0703('0x7c'),_0x4981a3,_0x1ac12f);}else{if(_0x336715[_0x0703('0x3f')][_0x5ada05]===_0x0703('0x7d')){_0x594adf[_0x0703('0x7e')]('i.'+_0x5ada05+_0x0703('0x7f'));}else{_0x594adf['where']('i.'+_0x5ada05+_0x0703('0x80'),_0x336715[_0x0703('0x3f')][_0x5ada05]);}}});}if(_0x336715[_0x0703('0x3f')][_0x0703('0x81')]){if(_0x336715[_0x0703('0x3f')][_0x0703('0x81')]==0x1){_0x594adf[_0x0703('0x63')]('`unreadMessages`\x20=\x200');}else{_0x594adf[_0x0703('0x63')](_0x0703('0x82'));}}if(_0x336715['query'][_0x0703('0x83')]){_0x29f738=_[_0x0703('0x84')](_0x336715[_0x0703('0x3f')]['tag'])?_0x336715[_0x0703('0x3f')]['tag']:new Array(_0x336715[_0x0703('0x3f')]['tag']);_0x29f738['forEach'](function(_0x395ea6){_0x348ad1['or'](_0x0703('0x70'),'%,'+_0x395ea6+',%');});}if(_0x336715['query'][_0x0703('0x85')]){var _0x26650d=_0x336715[_0x0703('0x3f')][_0x0703('0x85')]['replace']('\x5c','\x5c\x5c')[_0x0703('0x86')](/'/g,'\x27\x27');if(qs[_0x0703('0x87')](_0x26650d)){_0x257f7f['or'](_0x0703('0x88'),_0x26650d+'%')['or'](_0x0703('0x89'),_0x26650d+'%');}else{_0x257f7f['or'](_0x0703('0x8a'),qs[_0x0703('0x8b')](_0x26650d))['or'](_0x0703('0x8c'),_0x26650d+'%');}}}_0x594adf[_0x0703('0x7e')](_0x257f7f);_0x594adf[_0x0703('0x8d')]('i.id');var _0x2c52c7={'type':db[_0x0703('0x8e')][_0x0703('0x8f')][_0x0703('0x90')],'raw':!![]};var _0x2cb0e3=_0x594adf[_0x0703('0x91')]();_0x2cb0e3[_0x0703('0x49')](_0x0703('0x92'));_0x2cb0e3['field'](_0x0703('0x93'),_0x0703('0x94'));if(_0x2f3fbd[_0x0703('0x46')]){_0x2f3fbd['order'][_0x0703('0x35')](function(_0x18d6af){var _0xec9069=_0x18d6af[0x0]===_0x0703('0x95')?_0x18d6af[0x0]:'i.'+_0x18d6af[0x0];_0x594adf[_0x0703('0x46')](_0xec9069,_0x18d6af[0x1]===_0x0703('0x96')?![]:!![]);});}if(!_[_0x0703('0x97')](_0x29f738)){_0x594adf[_0x0703('0x63')](_0x348ad1);_0x2cb0e3[_0x0703('0x7e')](_0x0703('0x98'),_0x29f738);}BPromise[_0x0703('0x99')]()['then'](function(){if(!_0x2751a4){if(_0x336715[_0x0703('0x3f')][_0x0703('0x77')])return;_0x2cb0e3[_0x0703('0x7e')](_0x0703('0x9a'));_0x594adf[_0x0703('0x7e')]('i.SmsAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x336715['user']['role']!==_0x0703('0x9b'))return;return _0x336715[_0x0703('0x9c')][_0x0703('0x9d')]({'attributes':['id'],'raw':!![]})[_0x0703('0x2e')](function(_0x55e2ba){if(_[_0x0703('0x97')](_0x55e2ba)){_0x2cb0e3['where'](_0x0703('0x9e'));_0x594adf[_0x0703('0x7e')](_0x0703('0x9e'));}else{_0x2cb0e3['where'](_0x0703('0x9f'),_[_0x0703('0x32')](_0x55e2ba,'id'));_0x594adf['where']('i.SmsAccountId\x20IN\x20?',_[_0x0703('0x32')](_0x55e2ba,'id'));}});})[_0x0703('0x2e')](function(){if(_0x336715['user'][_0x0703('0xa0')]===_0x0703('0x9b')&&!_0x2751a4&&!_0x336715[_0x0703('0x3f')][_0x0703('0x77')])return[];return db[_0x0703('0xa1')][_0x0703('0x3f')](_0x2cb0e3[_0x0703('0xa2')](),_0x2c52c7);})[_0x0703('0x2e')](function(_0x48336a){_0xab1a47[_0x0703('0x26')]=_0x48336a[_0x0703('0x6a')];if(_0xab1a47['count']===0x0)return[];return db[_0x0703('0xa1')]['query'](_0x2c37bc[_0x0703('0xa2')](),_0x2c52c7)[_0x0703('0x2e')](function(_0x1752db){_0x191b53=_[_0x0703('0xa3')](_0x1752db,'id');_0x2c52c7=_['merge'](_0x2c52c7,{'model':db[_0x0703('0x3a')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x336715[_0x0703('0x3f')]['fields']){_0x2f3fbd[_0x0703('0x43')][_0x0703('0x35')](function(_0x283bc2){_0x594adf['field']('i.'+_0x283bc2);});}else{_0x594adf[_0x0703('0x49')](_0x0703('0x93'),_0x0703('0x94'));_0x594adf[_0x0703('0x49')](_0x0703('0xa4'),_0x0703('0xa5'));_0x594adf[_0x0703('0x49')](_0x0703('0xa6'),'Account.mandatoryDisposition');_0x594adf[_0x0703('0x49')](_0x0703('0xa7'),'contactName');_0x594adf[_0x0703('0x49')]('i.*');_0x594adf['field'](_0x0703('0xa8'),_0x0703('0xa9'));_0x594adf[_0x0703('0x49')](_0x0703('0xaa'),_0x0703('0xab'));_0x594adf[_0x0703('0x49')](_0x0703('0xac'),_0x0703('0xad'));_0x594adf[_0x0703('0x49')](_0x0703('0xae'),'Contact.phone');_0x594adf[_0x0703('0x49')](_0x0703('0xaf'),_0x0703('0xb0'));_0x594adf[_0x0703('0x49')]('c.fax',_0x0703('0xb1'));_0x594adf[_0x0703('0x49')](_0x0703('0xb2'),_0x0703('0xb3'));_0x594adf[_0x0703('0x49')](_0x0703('0xb4'),'Owner.internal');_0x594adf[_0x0703('0x49')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x0703('0x34'));}if(_0x2f3fbd[_0x0703('0x25')])_0x594adf['limit'](_0x2f3fbd[_0x0703('0x25')]);if(_0x2f3fbd[_0x0703('0x24')])_0x594adf[_0x0703('0x24')](_0x2f3fbd['offset']);return db[_0x0703('0xa1')][_0x0703('0x3f')](_0x594adf[_0x0703('0xa2')](),_0x2c52c7);})['then'](function(_0x2b5bfb){if(_0x2b5bfb[_0x0703('0x6a')]>0x0)_0x366b3c['where'](_0x0703('0xb5'),_['map'](_0x2b5bfb,'id'));return db[_0x0703('0xa1')]['query'](_0x366b3c[_0x0703('0xa2')](),_0x2c52c7)[_0x0703('0x2e')](function(_0x484f39){var _0x2ca2aa=_['groupBy'](_0x484f39,_0x0703('0xb6'));var _0x28d2f8=[];_0x2b5bfb[_0x0703('0x35')](function(_0x3410da){_0x28d2f8['push'](updateSmsInteraction(_0x3410da,_0x191b53,_0x2ca2aa));});return BPromise['all'](_0x28d2f8);});});})[_0x0703('0x2e')](function(_0x39e102){_0xab1a47[_0x0703('0xb7')]=_0x39e102;return _0xab1a47;})['then'](respondWithFilteredResult(_0x2d825a,_0x2f3fbd))[_0x0703('0x38')](handleError(_0x2d825a,null));};exports[_0x0703('0xb8')]=function(_0x3db2e1,_0x4c2d4f){var _0x3dd428={'raw':![],'where':{'id':_0x3db2e1[_0x0703('0xb9')]['id']}},_0x5e3605={};_0x5e3605['model']=_[_0x0703('0x40')](db['SmsInteraction'][_0x0703('0x3b')]);_0x5e3605[_0x0703('0x3f')]=_[_0x0703('0x40')](_0x3db2e1[_0x0703('0x3f')]);_0x5e3605['filters']=_[_0x0703('0x41')](_0x5e3605[_0x0703('0x3e')],_0x5e3605[_0x0703('0x3f')]);_0x3dd428[_0x0703('0x43')]=_[_0x0703('0x41')](_0x5e3605[_0x0703('0x3e')],qs['fields'](_0x3db2e1['query'][_0x0703('0x42')]));_0x3dd428[_0x0703('0x43')]=_0x3dd428[_0x0703('0x43')][_0x0703('0x6a')]?_0x3dd428[_0x0703('0x43')]:_0x5e3605[_0x0703('0x3e')];if(_0x3db2e1[_0x0703('0x3f')][_0x0703('0xba')]){_0x3dd428['include']=[{'all':!![]}];}_0x3dd428=_[_0x0703('0xbb')]({},_0x3dd428,_0x3db2e1[_0x0703('0xbc')]);return db[_0x0703('0x3a')][_0x0703('0x61')](_0x3dd428)[_0x0703('0x2e')](handleEntityNotFound(_0x4c2d4f,null))['then'](respondWithResult(_0x4c2d4f,null))[_0x0703('0x38')](handleError(_0x4c2d4f,null));};exports[_0x0703('0xbd')]=function(_0x5ee121,_0x332fa9){return db[_0x0703('0x3a')][_0x0703('0xbd')](_0x5ee121[_0x0703('0xbe')],{})[_0x0703('0x2e')](respondWithResult(_0x332fa9,0xc9))['catch'](handleError(_0x332fa9,null));};exports[_0x0703('0x2c')]=function(_0xdf293f,_0x42eb2c){if(_0xdf293f[_0x0703('0xbe')]['id']){delete _0xdf293f[_0x0703('0xbe')]['id'];}return db['SmsInteraction'][_0x0703('0x61')]({'where':{'id':_0xdf293f['params']['id']}})[_0x0703('0x2e')](handleEntityNotFound(_0x42eb2c,null))['then'](saveUpdates(_0xdf293f['body'],null))[_0x0703('0x2e')](respondWithResult(_0x42eb2c,null))['catch'](handleError(_0x42eb2c,null));};exports[_0x0703('0x2d')]=function(_0x438b7a,_0x119776){return db[_0x0703('0x3a')][_0x0703('0x61')]({'where':{'id':_0x438b7a[_0x0703('0xb9')]['id']}})[_0x0703('0x2e')](handleEntityNotFound(_0x119776,null))[_0x0703('0x2e')](removeEntity(_0x119776,null))[_0x0703('0x38')](handleError(_0x119776,null));};exports[_0x0703('0xbf')]=function(_0x1bcf51,_0xe3253c){return db[_0x0703('0x3a')][_0x0703('0xbf')]()['then'](respondWithResult(_0xe3253c,null))[_0x0703('0x38')](handleError(_0xe3253c,null));};exports['addMessage']=function(_0x5e139c,_0x4c0998,_0x54efdc){return db[_0x0703('0xc0')][_0x0703('0x61')]({'where':{'id':_0x5e139c[_0x0703('0xb9')]['id']}})['then'](handleEntityNotFound(_0x4c0998,null))[_0x0703('0x2e')](function(_0x1cc309){if(_0x1cc309){return _0x1cc309[_0x0703('0xc1')](_0x5e139c['body'][_0x0703('0xc2')],_['omit'](_0x5e139c[_0x0703('0xbe')],['ids','id'])||{});}})[_0x0703('0x2e')](respondWithResult(_0x4c0998,null))[_0x0703('0x38')](handleError(_0x4c0998,null));};exports[_0x0703('0xc3')]=function(_0x4ed583,_0x5b8587,_0x156c52){var _0x2beca2={'raw':![],'where':{}};var _0xaff9b={};var _0x465717={'count':0x0,'rows':[]};return db[_0x0703('0x3a')]['findOne']({'where':{'id':_0x4ed583[_0x0703('0xb9')]['id']}})[_0x0703('0x2e')](handleEntityNotFound(_0x5b8587,null))['then'](function(_0x1aaf27){if(_0x1aaf27){_0xaff9b[_0x0703('0x3e')]=_['keys'](db[_0x0703('0xc0')][_0x0703('0x3b')]);_0xaff9b[_0x0703('0x3f')]=_[_0x0703('0x40')](_0x4ed583[_0x0703('0x3f')]);_0xaff9b[_0x0703('0x48')]=_[_0x0703('0x41')](_0xaff9b[_0x0703('0x3e')],_0xaff9b[_0x0703('0x3f')]);_0x2beca2[_0x0703('0x43')]=_[_0x0703('0x41')](_0xaff9b[_0x0703('0x3e')],qs[_0x0703('0x42')](_0x4ed583[_0x0703('0x3f')][_0x0703('0x42')]));_0x2beca2['attributes']=_0x2beca2[_0x0703('0x43')][_0x0703('0x6a')]?_0x2beca2['attributes']:_0xaff9b[_0x0703('0x3e')];if(!_0x4ed583[_0x0703('0x3f')][_0x0703('0x44')](_0x0703('0x45'))){_0x2beca2['limit']=qs['limit'](_0x4ed583[_0x0703('0x3f')][_0x0703('0x25')]);_0x2beca2[_0x0703('0x24')]=qs['offset'](_0x4ed583[_0x0703('0x3f')][_0x0703('0x24')]);}_0x2beca2['order']=qs[_0x0703('0x47')](_0x4ed583['query'][_0x0703('0x47')]);_0x2beca2[_0x0703('0x7e')]=qs[_0x0703('0x48')](_[_0x0703('0xc4')](_0x4ed583[_0x0703('0x3f')],_0xaff9b[_0x0703('0x48')]));_0x2beca2['where']['SmsInteractionId']=_0x1aaf27['id'];if(_0x4ed583[_0x0703('0x3f')]['filter']){_0x2beca2[_0x0703('0x7e')]=_['merge'](_0x2beca2[_0x0703('0x7e')],{'$or':_['map'](_0x2beca2[_0x0703('0x43')],function(_0x50c1e2){var _0x5e961a={};_0x5e961a[_0x50c1e2]={'$like':'%'+_0x4ed583[_0x0703('0x3f')][_0x0703('0x85')]+'%'};return _0x5e961a;})});}if(_0x4ed583[_0x0703('0x3f')][_0x0703('0xc5')]){var _0x50b503=_0x4ed583['query'][_0x0703('0xc5')][_0x0703('0x69')](',');var _0x266542={};_0x266542[_0x50b503[0x0]]={'$gte':moment(_0x50b503[0x1])[_0x0703('0xc6')]('YYYY-MM-DD\x20HH:mm:ss')};_0x2beca2[_0x0703('0x7e')]=_[_0x0703('0xbb')](_0x2beca2[_0x0703('0x7e')],_0x266542);}_0x2beca2=_[_0x0703('0xbb')]({},_0x2beca2,_0x4ed583[_0x0703('0xbc')]);return db[_0x0703('0xc0')]['count']({'where':_0x2beca2['where']})[_0x0703('0x2e')](function(_0x416ad9){_0x465717[_0x0703('0x26')]=_0x416ad9;if(_0x4ed583[_0x0703('0x3f')][_0x0703('0xba')]){_0x2beca2[_0x0703('0xc7')]=[{'all':!![]}];}return db[_0x0703('0xc0')][_0x0703('0xc8')](_0x2beca2);})['then'](function(_0x29df63){_0x465717['rows']=_0x29df63;return _0x465717;});}})[_0x0703('0x2e')](respondWithFilteredResult(_0x5b8587,_0x2beca2))[_0x0703('0x38')](handleError(_0x5b8587,null));};exports[_0x0703('0xc9')]=function(_0x40befc,_0x436708,_0x5bafa7){return db[_0x0703('0x3a')][_0x0703('0x61')]({'where':{'id':_0x40befc['params']['id']}})[_0x0703('0x2e')](handleEntityNotFound(_0x436708,null))[_0x0703('0x2e')](function(_0xdefaba){if(_0xdefaba){return _0xdefaba[_0x0703('0xca')](_0x40befc['body'][_0x0703('0xc2')],_[_0x0703('0xcb')](_0x40befc[_0x0703('0xbe')],['ids','id'])||{})[_0x0703('0xcc')](function(){return db[_0x0703('0x6f')]['findAll']({'attributes':['id',_0x0703('0x31'),_0x0703('0x4a')],'where':{'id':_0x40befc[_0x0703('0xbe')][_0x0703('0xc2')]}});})[_0x0703('0x2e')](function(_0x2853d5){socket[_0x0703('0xcd')]('smsInteractionTags:save',{'id':Number(_0x40befc[_0x0703('0xb9')]['id']),'tags':_0x2853d5||[]});return{'id':Number(_0x40befc[_0x0703('0xb9')]['id']),'tags':_0x2853d5||[]};});}})[_0x0703('0x2e')](respondWithResult(_0x436708,null))[_0x0703('0x38')](handleError(_0x436708,null));};exports[_0x0703('0xce')]=function(_0x299c07,_0x3ad8d2,_0x2390dc){return db['SmsInteraction'][_0x0703('0x61')]({'where':{'id':_0x299c07[_0x0703('0xb9')]['id']}})[_0x0703('0x2e')](handleEntityNotFound(_0x3ad8d2,null))[_0x0703('0x2e')](function(_0x53966f){if(_0x53966f){return _0x53966f[_0x0703('0xce')](_0x299c07[_0x0703('0x3f')]['ids']);}})[_0x0703('0x2e')](respondWithStatusCode(_0x3ad8d2,null))['catch'](handleError(_0x3ad8d2,null));};exports[_0x0703('0xcf')]=function(_0x2d1e1f,_0x16ef38){var _0x3a2753=moment()[_0x0703('0xd0')]()[_0x0703('0xa2')]();var _0x4ceb21=path[_0x0703('0xd1')](config['root'],_0x0703('0xd2'),_0x0703('0xd3'),'tmp');var _0x3436a9=path[_0x0703('0xd1')](config[_0x0703('0xd4')],_0x0703('0xd2'),'files',_0x0703('0xd5'));var _0x56a9de=path[_0x0703('0xd1')](_0x4ceb21,_0x3a2753);var _0x3e1844=util['format'](_0x0703('0xd6'),_0x2d1e1f[_0x0703('0xb9')]['id'],_0x3a2753);var _0x59ae6b=path[_0x0703('0xd1')](_0x4ceb21,_0x3e1844);var _0x24f104=[];_0x24f104[_0x0703('0x37')]({'model':db[_0x0703('0x71')],'as':_0x0703('0x71'),'attributes':['id',_0x0703('0x33')],'raw':!![]});_0x24f104[_0x0703('0x37')]({'model':db[_0x0703('0xd7')],'as':_0x0703('0x66'),'attributes':['id',_0x0703('0xd8'),'lastName'],'raw':!![]});var _0x5cdad9=[{'model':db[_0x0703('0xc0')],'as':'Messages','attributes':['id',_0x0703('0xbe'),_0x0703('0x79'),_0x0703('0xd9'),_0x0703('0xda'),'read'],'include':_0x24f104}];_0x5cdad9[_0x0703('0x37')]({'model':db['SmsAccount'],'as':_0x0703('0xdb'),'attributes':['id',_0x0703('0x31')]});_0x5cdad9[_0x0703('0x37')]({'model':db['User'],'as':_0x0703('0xdc'),'attributes':['id',_0x0703('0x33')]});return db['SmsInteraction']['find']({'where':{'id':_0x2d1e1f[_0x0703('0xb9')]['id']},'include':_0x5cdad9})['then'](handleEntityNotFound(_0x16ef38,null))[_0x0703('0x2e')](function(_0x155e66){if(_0x155e66){var _0x4910bc=_0x155e66[_0x0703('0xdd')]({'plain':!![]});fs[_0x0703('0xde')](_0x56a9de);var _0xa29041={'channel':_0x0703('0xdf'),'account':_0x4910bc[_0x0703('0xdb')]['name'],'agent':_0x4910bc[_0x0703('0xdc')]?_0x4910bc[_0x0703('0xdc')]['fullname']:_0x0703('0xe0'),'createdAt':moment(_0x4910bc['createdAt'])[_0x0703('0xc6')](_0x0703('0xe1'))['toString'](),'closedAt':_0x4910bc['closed']?moment(_0x4910bc['closedAt'])['format'](_0x0703('0xe1'))[_0x0703('0xa2')]():'','disposition':_0x4910bc[_0x0703('0xe2')],'messages':_(_0x4910bc[_0x0703('0xe3')])[_0x0703('0x85')]({'secret':![]})[_0x0703('0x32')](function(_0x403728){return{'date':moment(_0x403728[_0x0703('0x79')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0x0703('0xa2')](),'sender':_0x403728[_0x0703('0xd9')]===_0x0703('0xe4')?_0x403728[_0x0703('0x71')]?_0x403728[_0x0703('0x71')][_0x0703('0x33')]:'System':_0x403728['Contact'][_0x0703('0xd8')]+(_0x403728[_0x0703('0x66')][_0x0703('0xe5')]?'\x20'+_0x403728[_0x0703('0x66')][_0x0703('0xe5')]:''),'body':_0x403728['body'],'direction':_0x403728['direction']===_0x0703('0xe4')?'A':'C','secret':_0x403728[_0x0703('0xda')],'read':_0x403728[_0x0703('0x81')]};})['value']()};return ejs['renderFile'](path[_0x0703('0xd1')](config['root'],_0x0703('0xd2'),'views','downloadInteraction.ejs'),{'interaction':_0xa29041})['then'](function(_0x2226d3){var _0x2749dc=path['join'](_0x56a9de,'transcript-'+_0x4910bc['id']+'-'+_0x3a2753+'.pdf');var _0x2d66a1={'path':_0x2749dc,'channel':'Sms','interactionId':_0x4910bc['id']};return pdf[_0x0703('0xe6')](_0x2226d3,_0x2d66a1);})[_0x0703('0x2e')](function(){return new BPromise(function(_0x26fd67,_0x19601f){zipdir(_0x56a9de,{'saveTo':_0x59ae6b},function(_0x1af9c3,_0x42a24b){if(_0x1af9c3)return _0x19601f(_0x1af9c3);return _0x26fd67(_0x42a24b);});})[_0x0703('0x2e')](function(){return new BPromise(function(_0x4053e4,_0x1210e9){rimraf(_0x56a9de,function(_0x4bc5ab){if(_0x4bc5ab)_0x1210e9(_0x4bc5ab);return _0x4053e4();});});})['then'](function(){return _0x16ef38[_0x0703('0xcf')](_0x59ae6b,_0x3e1844,function(_0x3ca5b2){if(_0x3ca5b2){console['log'](_0x0703('0xe7'),_0x3ca5b2);}else{fs['unlinkSync'](_0x59ae6b);}});});});}else{return _0x16ef38[_0x0703('0x21')](0xc8);}})[_0x0703('0x38')](handleError(_0x16ef38,null));}; \ No newline at end of file +var _0x420d=['stack','name','send','Users','map','fullname','TagIds','split','forEach','Tags','push','catch','index','SmsInteraction','rawAttributes','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','select','field','from','tools_tags','u.fullname','user_has_sms_interactions','users','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','a.id\x20=\x20i.SmsAccountId','sms_messages','me.SmsInteractionId\x20=\x20i.id','it.SmsInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','parseSearch','sqlOperator','conditions','find','unreadMessages','value','`\x20=\x200','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?','type','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','buildExpression','text','some','compact','isEmpty','SmsAccountId','i.SmsAccountId\x20IN\x20?','concat','createdAt','parse','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','group','Sequelize','SELECT','clone','i.id','contactName','t.id\x20IN\x20?','resolve','role','agent','user','i.SmsAccountId\x20IS\x20NULL','sequelize','toString','keyBy','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','Contact.mobile','c.fax','o.fullname','o.internal','Owner.internal','ui.SmsInteractionId\x20IN\x20?','SmsInteractionId','all','rows','show','params','include','options','create','body','destroy','describe','addMessage','SmsMessage','getMessages','findOne','$gte','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','findAll','ids','omit','color','removeTags','download','join','root','server','tmp','files','attachments','transcript-%d-%s.zip','User','firstName','lastName','Messages','direction','SmsAccount','Owner','get','Sms','Account','closed','closedAt','out','System','Contact','secret','renderFile','transcript-','.pdf','createPdfFromHTML','err','eml-format','rimraf','zip-dir','moment','bluebird','util','path','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','api','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','register','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','sendStatus'];(function(_0x13583c,_0x4f2af7){var _0x2191d5=function(_0x4cf184){while(--_0x4cf184){_0x13583c['push'](_0x13583c['shift']());}};_0x2191d5(++_0x4f2af7);}(_0x420d,0xb3));var _0xd420=function(_0x5c7c7a,_0x5e1d52){_0x5c7c7a=_0x5c7c7a-0x0;var _0x314a22=_0x420d[_0x5c7c7a];return _0x314a22;};'use strict';var emlformat=require(_0xd420('0x0'));var rimraf=require(_0xd420('0x1'));var zipdir=require(_0xd420('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xd420('0x3'));var BPromise=require(_0xd420('0x4'));var Mustache=require('mustache');var util=require(_0xd420('0x5'));var path=require(_0xd420('0x6'));var sox=require('sox');var csv=require(_0xd420('0x7'));var ejs=require(_0xd420('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd420('0x9'));var squel=require(_0xd420('0xa'));var crypto=require(_0xd420('0xb'));var jsforce=require(_0xd420('0xc'));var deskjs=require(_0xd420('0xd'));var toCsv=require(_0xd420('0x7'));var querystring=require(_0xd420('0xe'));var Papa=require(_0xd420('0xf'));var Redis=require(_0xd420('0x10'));var authService=require(_0xd420('0x11'));var qs=require(_0xd420('0x12'));var as=require(_0xd420('0x13'));var pdf=require(_0xd420('0x14'));var hardwareService=require(_0xd420('0x15'));var logger=require(_0xd420('0x16'))(_0xd420('0x17'));var utils=require('../../config/utils');var config=require(_0xd420('0x18'));var licenseUtil=require(_0xd420('0x19'));var db=require('../../mysqldb')['db'];config[_0xd420('0x1a')]=_[_0xd420('0x1b')](config[_0xd420('0x1a')],{'host':_0xd420('0x1c'),'port':0x18eb});var socket=require(_0xd420('0x1d'))(new Redis(config[_0xd420('0x1a')]));require(_0xd420('0x1e'))[_0xd420('0x1f')](socket);function respondWithStatusCode(_0x5a7a4f,_0x17bc52){_0x17bc52=_0x17bc52||0xcc;return function(_0x34ff8f){if(_0x34ff8f){return _0x5a7a4f['sendStatus'](_0x17bc52);}return _0x5a7a4f[_0xd420('0x20')](_0x17bc52)[_0xd420('0x21')]();};}function respondWithResult(_0x26c2f4,_0x3c4f1e){_0x3c4f1e=_0x3c4f1e||0xc8;return function(_0x46180a){if(_0x46180a){return _0x26c2f4[_0xd420('0x20')](_0x3c4f1e)[_0xd420('0x22')](_0x46180a);}};}function respondWithFilteredResult(_0x213b3e,_0x45cbac){return function(_0x5f4913){if(_0x5f4913){var _0x392569=typeof _0x45cbac[_0xd420('0x23')]===_0xd420('0x24')&&typeof _0x45cbac[_0xd420('0x25')]===_0xd420('0x24');var _0x502130=_0x5f4913[_0xd420('0x26')];var _0xd88640=_0x392569?0x0:_0x45cbac['offset'];var _0x11ca17=_0x392569?_0x5f4913[_0xd420('0x26')]:_0x45cbac['offset']+_0x45cbac[_0xd420('0x25')];var _0x23f12f;if(_0x11ca17>=_0x502130){_0x11ca17=_0x502130;_0x23f12f=0xc8;}else{_0x23f12f=0xce;}_0x213b3e[_0xd420('0x20')](_0x23f12f);return _0x213b3e['set'](_0xd420('0x27'),_0xd88640+'-'+_0x11ca17+'/'+_0x502130)[_0xd420('0x22')](_0x5f4913);}return null;};}function patchUpdates(_0x14aaa7){return function(_0x8f5876){try{jsonpatch[_0xd420('0x28')](_0x8f5876,_0x14aaa7,!![]);}catch(_0x284a75){return BPromise['reject'](_0x284a75);}return _0x8f5876[_0xd420('0x29')]();};}function saveUpdates(_0x10be94,_0x2f1f2f){return function(_0x578afa){if(_0x578afa){return _0x578afa[_0xd420('0x2a')](_0x10be94)['then'](function(_0x172bab){return _0x172bab;});}return null;};}function removeEntity(_0x55d8a0,_0x32d156){return function(_0xa84399){if(_0xa84399){return _0xa84399['destroy']()[_0xd420('0x2b')](function(){_0x55d8a0[_0xd420('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4b8cc3,_0x40bd01){return function(_0x40b59f){if(!_0x40b59f){_0x4b8cc3[_0xd420('0x2c')](0x194);}return _0x40b59f;};}function handleError(_0x204e8b,_0x18955d){_0x18955d=_0x18955d||0x1f4;return function(_0x1c5cce){logger['error'](_0x1c5cce[_0xd420('0x2d')]);if(_0x1c5cce[_0xd420('0x2e')]){delete _0x1c5cce[_0xd420('0x2e')];}_0x204e8b[_0xd420('0x20')](_0x18955d)[_0xd420('0x2f')](_0x1c5cce);};}function getInteractionUsers(_0x376b73,_0x17afb1){return new BPromise(function(_0x25bc0b,_0x5a28d0){try{if(_0x17afb1[_0x376b73['id']]){_0x376b73[_0xd420('0x30')]=_[_0xd420('0x31')](_0x17afb1[_0x376b73['id']],function(_0x76b792){return{'id':_0x76b792['id'],'fullname':_0x76b792[_0xd420('0x32')]};});}}catch(_0x4b6ba7){_0x5a28d0(_0x4b6ba7);}_0x25bc0b(_0x376b73);});}function getInteractionTags(_0x2e39bc,_0x4376b5){return new BPromise(function(_0x1739e3,_0x5058c7){try{if(_0x2e39bc[_0xd420('0x33')]){_0x2e39bc['Tags']=[];_0x2e39bc['TagIds'][_0xd420('0x34')](',')[_0xd420('0x35')](function(_0x2f83af){_0x2e39bc[_0xd420('0x36')][_0xd420('0x37')](_0x4376b5[_0x2f83af]);});}delete _0x2e39bc[_0xd420('0x33')];}catch(_0x15d02e){_0x5058c7(_0x15d02e);}_0x1739e3(_0x2e39bc);});}function updateSmsInteraction(_0xb895dd,_0x3b3ef6,_0x2b116d){return new BPromise(function(_0x51a4ce,_0x4febd2){return getInteractionUsers(_0xb895dd,_0x2b116d)[_0xd420('0x2b')](function(_0x5ed340){return getInteractionTags(_0x5ed340,_0x3b3ef6);})[_0xd420('0x2b')](function(_0x32709d){_0x51a4ce(_0x32709d);})[_0xd420('0x38')](function(_0x338f27){_0x4febd2(_0x338f27);});});}exports[_0xd420('0x39')]=function(_0x54592f,_0x50d611){var _0x41e959={},_0x55e0b9={},_0x1f1eab={'count':0x0,'rows':[]};var _0x941f0b=_[_0xd420('0x31')](db[_0xd420('0x3a')][_0xd420('0x3b')],function(_0x5a879d){return{'name':_0x5a879d['fieldName'],'type':_0x5a879d['type']['key']};});_0x55e0b9[_0xd420('0x3c')]=_['map'](_0x941f0b,_0xd420('0x2e'));_0x55e0b9[_0xd420('0x3d')]=_[_0xd420('0x3e')](_0x54592f[_0xd420('0x3d')]);_0x55e0b9['filters']=_[_0xd420('0x3f')](_0x55e0b9[_0xd420('0x3c')],_0x55e0b9['query']);_0x41e959[_0xd420('0x40')]=_[_0xd420('0x3f')](_0x55e0b9['model'],qs[_0xd420('0x41')](_0x54592f[_0xd420('0x3d')][_0xd420('0x41')]));_0x41e959[_0xd420('0x40')]=_0x41e959[_0xd420('0x40')][_0xd420('0x42')]?_0x41e959['attributes']:_0x55e0b9[_0xd420('0x3c')];if(!_0x54592f['query'][_0xd420('0x43')](_0xd420('0x44'))){_0x41e959[_0xd420('0x25')]=qs['limit'](_0x54592f[_0xd420('0x3d')][_0xd420('0x25')]);_0x41e959[_0xd420('0x23')]=qs[_0xd420('0x23')](_0x54592f[_0xd420('0x3d')][_0xd420('0x23')]);}_0x41e959[_0xd420('0x45')]=qs[_0xd420('0x46')](_0x54592f[_0xd420('0x3d')][_0xd420('0x46')]);_0x41e959[_0xd420('0x47')]=qs[_0xd420('0x48')](_[_0xd420('0x49')](_0x54592f[_0xd420('0x3d')],_0x55e0b9['filters']),_0x941f0b);var _0x3211f5=[];var _0x361a31=squel[_0xd420('0x4a')]()[_0xd420('0x4b')]('id')[_0xd420('0x4b')](_0xd420('0x2e'))[_0xd420('0x4b')]('color')[_0xd420('0x4c')](_0xd420('0x4d'));var _0x34f1d0=squel[_0xd420('0x4a')]()[_0xd420('0x4b')]('u.id')[_0xd420('0x4b')](_0xd420('0x4e'))['field']('ui.SmsInteractionId')[_0xd420('0x4c')](_0xd420('0x4f'),'ui')['left_join'](_0xd420('0x50'),'u',_0xd420('0x51'));var _0x8c4317=squel[_0xd420('0x4a')]()[_0xd420('0x4c')](_0xd420('0x52'),'i')[_0xd420('0x53')](_0xd420('0x54'),'c',_0xd420('0x55'))[_0xd420('0x53')]('users','o',_0xd420('0x56'))[_0xd420('0x53')](_0xd420('0x57'),'a',_0xd420('0x58'))[_0xd420('0x53')](_0xd420('0x59'),'me',_0xd420('0x5a'))[_0xd420('0x53')]('sms_interaction_has_tags','it',_0xd420('0x5b'))['left_join'](_0xd420('0x4d'),'t',_0xd420('0x5c'));var _0x447bde=squel[_0xd420('0x5d')]();var _0x487aa5=[];var _0xb08c58=squel[_0xd420('0x5d')]();var _0x1a1b78;if(_0x54592f[_0xd420('0x3d')]['search']){_0x1a1b78=as[_0xd420('0x5e')](_0x54592f[_0xd420('0x3d')]['search']);var _0x368db7=_0x1a1b78[_0xd420('0x5f')];for(var _0x2448b2=0x0;_0x2448b2<_0x1a1b78[_0xd420('0x60')]['length'];_0x2448b2++){var _0x59d51e=_0x1a1b78[_0xd420('0x60')][_0x2448b2];var _0x998bec='i';var _0x20a275=_[_0xd420('0x61')](_0x941f0b,[_0xd420('0x2e'),_0x59d51e[_0xd420('0x4b')]]);if(!_0x20a275){switch(_0x59d51e[_0xd420('0x4b')]){case _0xd420('0x62'):if(_0x59d51e[_0xd420('0x63')]==0x1){_0x8c4317['having']('`'+_0x59d51e['field']+_0xd420('0x64'));}else{_0x8c4317[_0xd420('0x65')]('`'+_0x59d51e[_0xd420('0x4b')]+_0xd420('0x66'));}break;case'Contact':if(_0x59d51e[_0xd420('0x67')]===_0xd420('0x68')){if(_0x59d51e[_0xd420('0x63')]['split']('\x20')[_0xd420('0x42')]>0x1){_0x447bde[_0x368db7](_0xd420('0x69'),qs[_0xd420('0x6a')](_0x59d51e['value']),null);}else{var _0x4bf8f6='%'+_0x59d51e[_0xd420('0x63')]+'%';_0x447bde[_0x368db7](_0xd420('0x6b'),_0x4bf8f6,_0x4bf8f6,_0x4bf8f6);}}else{_0x20a275=_[_0xd420('0x61')](_0x941f0b,[_0xd420('0x2e'),'ContactId']);_0x59d51e[_0xd420('0x4b')]='ContactId';_0x44c2cb=as['buildExpression'](_0x998bec,_0x20a275[_0xd420('0x6c')],_0x59d51e);_0x447bde[_0x368db7](_0x44c2cb['text'],_0x44c2cb['value'][_0xd420('0x6d')],_0x44c2cb[_0xd420('0x63')][_0xd420('0x21')]);}break;case _0xd420('0x6e'):var _0x2cad12=_0x59d51e[_0xd420('0x63')][_0xd420('0x34')](',')['map'](function(_0x113987){return Number(_0x113987);});_0x2cad12['forEach'](function(_0x2754bc){_0xb08c58['or'](_0xd420('0x6f'),'%,'+_0x2754bc+',%');});_0x487aa5=_['union'](_0x487aa5,_0x2cad12);break;case'User':if(_0x59d51e[_0xd420('0x67')]===_0xd420('0x68')){_0x447bde[_0x368db7](_0xd420('0x70'),'%'+_0x59d51e[_0xd420('0x63')]+'%',null);}else{_0x20a275=_[_0xd420('0x61')](_0x941f0b,[_0xd420('0x2e'),'UserId']);_0x59d51e[_0xd420('0x4b')]=_0xd420('0x71');_0x44c2cb=as[_0xd420('0x72')](_0x998bec,_0x20a275[_0xd420('0x6c')],_0x59d51e);_0x447bde[_0x368db7](_0x44c2cb[_0xd420('0x73')],_0x44c2cb[_0xd420('0x63')][_0xd420('0x6d')],_0x44c2cb[_0xd420('0x63')][_0xd420('0x21')]);}break;case'body':_0x44c2cb=as['buildExpression']('me',null,_0x59d51e);_0x447bde[_0x368db7](_0x44c2cb[_0xd420('0x73')],_0x44c2cb[_0xd420('0x63')][_0xd420('0x6d')],_0x44c2cb[_0xd420('0x63')][_0xd420('0x21')]);break;}}else{var _0x44c2cb=as[_0xd420('0x72')](_0x998bec,_0x20a275[_0xd420('0x6c')],_0x59d51e);_0x447bde[_0x368db7](_0x44c2cb[_0xd420('0x73')],_0x44c2cb['value'][_0xd420('0x6d')],_0x44c2cb[_0xd420('0x63')][_0xd420('0x21')]);}}}else{var _0x4ad612=_(_0x54592f['query'])[_0xd420('0x3e')]()[_0xd420('0x31')](function(_0x1132d9){return _[_0xd420('0x74')](_0x941f0b,[_0xd420('0x2e'),_0x1132d9])?_0x1132d9:undefined;})[_0xd420('0x75')]()[_0xd420('0x63')]();if(!_[_0xd420('0x76')](_0x4ad612)){_0x4ad612[_0xd420('0x35')](function(_0x459560){if(_0x459560===_0xd420('0x77')){_0x8c4317[_0xd420('0x47')](_0xd420('0x78'),[][_0xd420('0x79')](_0x54592f['query'][_0x459560]));}else if(_0x459560===_0xd420('0x7a')){var _0x529e22=JSON['parse'](_0x54592f[_0xd420('0x3d')][_0x459560])['$gte'];var _0x2f07b1=JSON[_0xd420('0x7b')](_0x54592f[_0xd420('0x3d')][_0x459560])['$lte'];_0x8c4317['where']('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x529e22,_0x2f07b1);}else{if(_0x54592f[_0xd420('0x3d')][_0x459560]===_0xd420('0x7c')){_0x8c4317['where']('i.'+_0x459560+_0xd420('0x7d'));}else{_0x8c4317[_0xd420('0x47')]('i.'+_0x459560+_0xd420('0x7e'),_0x54592f['query'][_0x459560]);}}});}if(_0x54592f[_0xd420('0x3d')][_0xd420('0x7f')]){if(_0x54592f[_0xd420('0x3d')][_0xd420('0x7f')]==0x1){_0x8c4317['having'](_0xd420('0x80'));}else{_0x8c4317[_0xd420('0x65')](_0xd420('0x81'));}}if(_0x54592f[_0xd420('0x3d')]['tag']){_0x487aa5=_['isArray'](_0x54592f[_0xd420('0x3d')][_0xd420('0x82')])?_0x54592f['query'][_0xd420('0x82')]:new Array(_0x54592f[_0xd420('0x3d')][_0xd420('0x82')]);_0x487aa5['forEach'](function(_0x4442a3){_0xb08c58['or'](_0xd420('0x6f'),'%,'+_0x4442a3+',%');});}if(_0x54592f[_0xd420('0x3d')][_0xd420('0x83')]){var _0x3dd9f0=_0x54592f[_0xd420('0x3d')][_0xd420('0x83')][_0xd420('0x84')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0xd420('0x85')](_0x3dd9f0)){_0x447bde['or'](_0xd420('0x86'),_0x3dd9f0+'%')['or'](_0xd420('0x87'),_0x3dd9f0+'%');}else{_0x447bde['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x3dd9f0))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x3dd9f0+'%');}}}_0x8c4317['where'](_0x447bde);_0x8c4317[_0xd420('0x88')]('i.id');var _0x55b833={'type':db[_0xd420('0x89')]['QueryTypes'][_0xd420('0x8a')],'raw':!![]};var _0x55c2ee=_0x8c4317[_0xd420('0x8b')]();_0x55c2ee[_0xd420('0x4b')](_0xd420('0x8c'));_0x55c2ee[_0xd420('0x4b')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xd420('0x62'));if(_0x41e959['order']){_0x41e959[_0xd420('0x45')][_0xd420('0x35')](function(_0x5f11a9){var _0x54d083=_0x5f11a9[0x0]===_0xd420('0x8d')?_0x5f11a9[0x0]:'i.'+_0x5f11a9[0x0];_0x8c4317['order'](_0x54d083,_0x5f11a9[0x1]==='DESC'?![]:!![]);});}if(!_['isEmpty'](_0x487aa5)){_0x8c4317[_0xd420('0x65')](_0xb08c58);_0x55c2ee['where'](_0xd420('0x8e'),_0x487aa5);}BPromise[_0xd420('0x8f')]()[_0xd420('0x2b')](function(){if(!_0x1a1b78){if(_0x54592f['query'][_0xd420('0x77')])return;_0x55c2ee[_0xd420('0x47')]('i.SmsAccountId\x20IS\x20NOT\x20NULL');_0x8c4317[_0xd420('0x47')]('i.SmsAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x54592f['user'][_0xd420('0x90')]!==_0xd420('0x91'))return;return _0x54592f[_0xd420('0x92')]['getSmsAccounts']({'attributes':['id'],'raw':!![]})[_0xd420('0x2b')](function(_0x3299b6){if(_[_0xd420('0x76')](_0x3299b6)){_0x55c2ee['where'](_0xd420('0x93'));_0x8c4317['where'](_0xd420('0x93'));}else{_0x55c2ee['where'](_0xd420('0x78'),_['map'](_0x3299b6,'id'));_0x8c4317[_0xd420('0x47')](_0xd420('0x78'),_[_0xd420('0x31')](_0x3299b6,'id'));}});})[_0xd420('0x2b')](function(){if(_0x54592f['user'][_0xd420('0x90')]===_0xd420('0x91')&&!_0x1a1b78&&!_0x54592f['query']['SmsAccountId'])return[];return db[_0xd420('0x94')][_0xd420('0x3d')](_0x55c2ee[_0xd420('0x95')](),_0x55b833);})[_0xd420('0x2b')](function(_0x18ed5b){_0x1f1eab[_0xd420('0x26')]=_0x18ed5b[_0xd420('0x42')];if(_0x1f1eab[_0xd420('0x26')]===0x0)return[];return db['sequelize']['query'](_0x361a31[_0xd420('0x95')](),_0x55b833)['then'](function(_0x5c128b){_0x3211f5=_[_0xd420('0x96')](_0x5c128b,'id');_0x55b833=_[_0xd420('0x97')](_0x55b833,{'model':db[_0xd420('0x3a')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x54592f['query'][_0xd420('0x41')]){_0x41e959[_0xd420('0x40')]['forEach'](function(_0x3674f6){_0x8c4317['field']('i.'+_0x3674f6);});}else{_0x8c4317['field'](_0xd420('0x98'),_0xd420('0x62'));_0x8c4317[_0xd420('0x4b')](_0xd420('0x99'),_0xd420('0x9a'));_0x8c4317[_0xd420('0x4b')](_0xd420('0x9b'),_0xd420('0x9c'));_0x8c4317[_0xd420('0x4b')]('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',_0xd420('0x8d'));_0x8c4317[_0xd420('0x4b')](_0xd420('0x9d'));_0x8c4317[_0xd420('0x4b')]('c.firstName',_0xd420('0x9e'));_0x8c4317['field'](_0xd420('0x9f'),_0xd420('0xa0'));_0x8c4317['field'](_0xd420('0xa1'),_0xd420('0xa2'));_0x8c4317[_0xd420('0x4b')](_0xd420('0xa3'),_0xd420('0xa4'));_0x8c4317[_0xd420('0x4b')]('c.mobile',_0xd420('0xa5'));_0x8c4317[_0xd420('0x4b')](_0xd420('0xa6'),'Contact.fax');_0x8c4317['field'](_0xd420('0xa7'),'Owner.fullname');_0x8c4317[_0xd420('0x4b')](_0xd420('0xa8'),_0xd420('0xa9'));_0x8c4317[_0xd420('0x4b')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0xd420('0x33'));}if(_0x41e959[_0xd420('0x25')])_0x8c4317['limit'](_0x41e959[_0xd420('0x25')]);if(_0x41e959[_0xd420('0x23')])_0x8c4317[_0xd420('0x23')](_0x41e959[_0xd420('0x23')]);return db['sequelize'][_0xd420('0x3d')](_0x8c4317[_0xd420('0x95')](),_0x55b833);})[_0xd420('0x2b')](function(_0x378462){if(_0x378462[_0xd420('0x42')]>0x0)_0x34f1d0[_0xd420('0x47')](_0xd420('0xaa'),_[_0xd420('0x31')](_0x378462,'id'));return db['sequelize']['query'](_0x34f1d0[_0xd420('0x95')](),_0x55b833)['then'](function(_0x11b616){var _0xd54895=_['groupBy'](_0x11b616,_0xd420('0xab'));var _0x76e105=[];_0x378462[_0xd420('0x35')](function(_0x29f37f){_0x76e105[_0xd420('0x37')](updateSmsInteraction(_0x29f37f,_0x3211f5,_0xd54895));});return BPromise[_0xd420('0xac')](_0x76e105);});});})[_0xd420('0x2b')](function(_0x4fcb47){_0x1f1eab[_0xd420('0xad')]=_0x4fcb47;return _0x1f1eab;})[_0xd420('0x2b')](respondWithFilteredResult(_0x50d611,_0x41e959))[_0xd420('0x38')](handleError(_0x50d611,null));};exports[_0xd420('0xae')]=function(_0xc1116a,_0x3443ae){var _0x1aecf0={'raw':![],'where':{'id':_0xc1116a[_0xd420('0xaf')]['id']}},_0x209dc4={};_0x209dc4['model']=_[_0xd420('0x3e')](db[_0xd420('0x3a')][_0xd420('0x3b')]);_0x209dc4[_0xd420('0x3d')]=_[_0xd420('0x3e')](_0xc1116a[_0xd420('0x3d')]);_0x209dc4[_0xd420('0x48')]=_[_0xd420('0x3f')](_0x209dc4[_0xd420('0x3c')],_0x209dc4[_0xd420('0x3d')]);_0x1aecf0['attributes']=_['intersection'](_0x209dc4['model'],qs[_0xd420('0x41')](_0xc1116a[_0xd420('0x3d')]['fields']));_0x1aecf0[_0xd420('0x40')]=_0x1aecf0[_0xd420('0x40')][_0xd420('0x42')]?_0x1aecf0[_0xd420('0x40')]:_0x209dc4['model'];if(_0xc1116a[_0xd420('0x3d')]['includeAll']){_0x1aecf0[_0xd420('0xb0')]=[{'all':!![]}];}_0x1aecf0=_[_0xd420('0x97')]({},_0x1aecf0,_0xc1116a[_0xd420('0xb1')]);return db[_0xd420('0x3a')][_0xd420('0x61')](_0x1aecf0)[_0xd420('0x2b')](handleEntityNotFound(_0x3443ae,null))['then'](respondWithResult(_0x3443ae,null))[_0xd420('0x38')](handleError(_0x3443ae,null));};exports[_0xd420('0xb2')]=function(_0x19b24f,_0x53d9f0){return db[_0xd420('0x3a')][_0xd420('0xb2')](_0x19b24f[_0xd420('0xb3')],{})['then'](respondWithResult(_0x53d9f0,0xc9))[_0xd420('0x38')](handleError(_0x53d9f0,null));};exports[_0xd420('0x2a')]=function(_0x39542b,_0x4e578d){if(_0x39542b[_0xd420('0xb3')]['id']){delete _0x39542b[_0xd420('0xb3')]['id'];}return db['SmsInteraction'][_0xd420('0x61')]({'where':{'id':_0x39542b['params']['id']}})[_0xd420('0x2b')](handleEntityNotFound(_0x4e578d,null))[_0xd420('0x2b')](saveUpdates(_0x39542b[_0xd420('0xb3')],null))[_0xd420('0x2b')](respondWithResult(_0x4e578d,null))[_0xd420('0x38')](handleError(_0x4e578d,null));};exports[_0xd420('0xb4')]=function(_0x1c54e7,_0x12b4c8){return db[_0xd420('0x3a')]['find']({'where':{'id':_0x1c54e7[_0xd420('0xaf')]['id']}})[_0xd420('0x2b')](handleEntityNotFound(_0x12b4c8,null))[_0xd420('0x2b')](removeEntity(_0x12b4c8,null))[_0xd420('0x38')](handleError(_0x12b4c8,null));};exports[_0xd420('0xb5')]=function(_0x16fa6b,_0xa3455b){return db[_0xd420('0x3a')][_0xd420('0xb5')]()['then'](respondWithResult(_0xa3455b,null))[_0xd420('0x38')](handleError(_0xa3455b,null));};exports[_0xd420('0xb6')]=function(_0x42aa0d,_0x2e37c1,_0x217527){return db[_0xd420('0xb7')][_0xd420('0x61')]({'where':{'id':_0x42aa0d[_0xd420('0xaf')]['id']}})['then'](handleEntityNotFound(_0x2e37c1,null))[_0xd420('0x2b')](function(_0x18a45b){if(_0x18a45b){return _0x18a45b[_0xd420('0xb6')](_0x42aa0d['body']['ids'],_['omit'](_0x42aa0d[_0xd420('0xb3')],['ids','id'])||{});}})[_0xd420('0x2b')](respondWithResult(_0x2e37c1,null))[_0xd420('0x38')](handleError(_0x2e37c1,null));};exports[_0xd420('0xb8')]=function(_0x2dbd07,_0x8e4f5a,_0x355252){var _0x1008bd={'raw':![],'where':{}};var _0x48a304={};var _0xfac7b3={'count':0x0,'rows':[]};return db[_0xd420('0x3a')][_0xd420('0xb9')]({'where':{'id':_0x2dbd07[_0xd420('0xaf')]['id']}})[_0xd420('0x2b')](handleEntityNotFound(_0x8e4f5a,null))[_0xd420('0x2b')](function(_0x1b1f22){if(_0x1b1f22){_0x48a304[_0xd420('0x3c')]=_['keys'](db[_0xd420('0xb7')][_0xd420('0x3b')]);_0x48a304['query']=_[_0xd420('0x3e')](_0x2dbd07[_0xd420('0x3d')]);_0x48a304[_0xd420('0x48')]=_['intersection'](_0x48a304[_0xd420('0x3c')],_0x48a304[_0xd420('0x3d')]);_0x1008bd[_0xd420('0x40')]=_[_0xd420('0x3f')](_0x48a304[_0xd420('0x3c')],qs[_0xd420('0x41')](_0x2dbd07['query'][_0xd420('0x41')]));_0x1008bd[_0xd420('0x40')]=_0x1008bd['attributes'][_0xd420('0x42')]?_0x1008bd[_0xd420('0x40')]:_0x48a304[_0xd420('0x3c')];if(!_0x2dbd07['query']['hasOwnProperty']('nolimit')){_0x1008bd[_0xd420('0x25')]=qs[_0xd420('0x25')](_0x2dbd07[_0xd420('0x3d')][_0xd420('0x25')]);_0x1008bd[_0xd420('0x23')]=qs[_0xd420('0x23')](_0x2dbd07[_0xd420('0x3d')][_0xd420('0x23')]);}_0x1008bd['order']=qs[_0xd420('0x46')](_0x2dbd07['query'][_0xd420('0x46')]);_0x1008bd[_0xd420('0x47')]=qs[_0xd420('0x48')](_[_0xd420('0x49')](_0x2dbd07[_0xd420('0x3d')],_0x48a304['filters']));_0x1008bd[_0xd420('0x47')][_0xd420('0xab')]=_0x1b1f22['id'];if(_0x2dbd07['query'][_0xd420('0x83')]){_0x1008bd['where']=_[_0xd420('0x97')](_0x1008bd['where'],{'$or':_[_0xd420('0x31')](_0x1008bd[_0xd420('0x40')],function(_0x1526e3){var _0x2b1924={};_0x2b1924[_0x1526e3]={'$like':'%'+_0x2dbd07['query'][_0xd420('0x83')]+'%'};return _0x2b1924;})});}if(_0x2dbd07[_0xd420('0x3d')]['$gte']){var _0x9c291b=_0x2dbd07['query'][_0xd420('0xba')][_0xd420('0x34')](',');var _0x4c0760={};_0x4c0760[_0x9c291b[0x0]]={'$gte':moment(_0x9c291b[0x1])[_0xd420('0xbb')](_0xd420('0xbc'))};_0x1008bd[_0xd420('0x47')]=_[_0xd420('0x97')](_0x1008bd[_0xd420('0x47')],_0x4c0760);}_0x1008bd=_[_0xd420('0x97')]({},_0x1008bd,_0x2dbd07['options']);return db[_0xd420('0xb7')][_0xd420('0x26')]({'where':_0x1008bd['where']})[_0xd420('0x2b')](function(_0x3dc157){_0xfac7b3[_0xd420('0x26')]=_0x3dc157;if(_0x2dbd07[_0xd420('0x3d')][_0xd420('0xbd')]){_0x1008bd[_0xd420('0xb0')]=[{'all':!![]}];}return db[_0xd420('0xb7')][_0xd420('0xbe')](_0x1008bd);})['then'](function(_0x5858a4){_0xfac7b3[_0xd420('0xad')]=_0x5858a4;return _0xfac7b3;});}})[_0xd420('0x2b')](respondWithFilteredResult(_0x8e4f5a,_0x1008bd))['catch'](handleError(_0x8e4f5a,null));};exports['addTags']=function(_0x112ddf,_0x173ac5,_0x5f2660){return db[_0xd420('0x3a')]['find']({'where':{'id':_0x112ddf[_0xd420('0xaf')]['id']}})[_0xd420('0x2b')](handleEntityNotFound(_0x173ac5,null))[_0xd420('0x2b')](function(_0x341a3d){if(_0x341a3d){return _0x341a3d['setTags'](_0x112ddf['body'][_0xd420('0xbf')],_[_0xd420('0xc0')](_0x112ddf[_0xd420('0xb3')],[_0xd420('0xbf'),'id'])||{})['spread'](function(){return db[_0xd420('0x6e')][_0xd420('0xbe')]({'attributes':['id','name',_0xd420('0xc1')],'where':{'id':_0x112ddf[_0xd420('0xb3')][_0xd420('0xbf')]}});})[_0xd420('0x2b')](function(_0x3a88ea){socket['emit']('smsInteractionTags:save',{'id':Number(_0x112ddf[_0xd420('0xaf')]['id']),'tags':_0x3a88ea||[]});return{'id':Number(_0x112ddf['params']['id']),'tags':_0x3a88ea||[]};});}})['then'](respondWithResult(_0x173ac5,null))[_0xd420('0x38')](handleError(_0x173ac5,null));};exports[_0xd420('0xc2')]=function(_0x13b7d3,_0x4fce4b,_0x124845){return db[_0xd420('0x3a')][_0xd420('0x61')]({'where':{'id':_0x13b7d3[_0xd420('0xaf')]['id']}})[_0xd420('0x2b')](handleEntityNotFound(_0x4fce4b,null))['then'](function(_0x2ce900){if(_0x2ce900){return _0x2ce900[_0xd420('0xc2')](_0x13b7d3['query'][_0xd420('0xbf')]);}})['then'](respondWithStatusCode(_0x4fce4b,null))[_0xd420('0x38')](handleError(_0x4fce4b,null));};exports[_0xd420('0xc3')]=function(_0x139ec9,_0x5aa472){var _0x4504c4=moment()['unix']()[_0xd420('0x95')]();var _0x229aba=path[_0xd420('0xc4')](config[_0xd420('0xc5')],_0xd420('0xc6'),'files',_0xd420('0xc7'));var _0x112563=path[_0xd420('0xc4')](config[_0xd420('0xc5')],'server',_0xd420('0xc8'),_0xd420('0xc9'));var _0x2bfad6=path['join'](_0x229aba,_0x4504c4);var _0x1bbf47=util[_0xd420('0xbb')](_0xd420('0xca'),_0x139ec9[_0xd420('0xaf')]['id'],_0x4504c4);var _0x431ba9=path[_0xd420('0xc4')](_0x229aba,_0x1bbf47);var _0x54a7d8=[];_0x54a7d8['push']({'model':db[_0xd420('0xcb')],'as':_0xd420('0xcb'),'attributes':['id',_0xd420('0x32')],'raw':!![]});_0x54a7d8['push']({'model':db['CmContact'],'as':'Contact','attributes':['id',_0xd420('0xcc'),_0xd420('0xcd')],'raw':!![]});var _0x2f3147=[{'model':db[_0xd420('0xb7')],'as':_0xd420('0xce'),'attributes':['id',_0xd420('0xb3'),_0xd420('0x7a'),_0xd420('0xcf'),'secret',_0xd420('0x7f')],'include':_0x54a7d8}];_0x2f3147[_0xd420('0x37')]({'model':db[_0xd420('0xd0')],'as':'Account','attributes':['id',_0xd420('0x2e')]});_0x2f3147[_0xd420('0x37')]({'model':db[_0xd420('0xcb')],'as':_0xd420('0xd1'),'attributes':['id','fullname']});return db[_0xd420('0x3a')][_0xd420('0x61')]({'where':{'id':_0x139ec9[_0xd420('0xaf')]['id']},'include':_0x2f3147})[_0xd420('0x2b')](handleEntityNotFound(_0x5aa472,null))[_0xd420('0x2b')](function(_0x4beeae){if(_0x4beeae){var _0xfac80c=_0x4beeae[_0xd420('0xd2')]({'plain':!![]});fs['mkdirSync'](_0x2bfad6);var _0x342641={'channel':_0xd420('0xd3'),'account':_0xfac80c[_0xd420('0xd4')]['name'],'agent':_0xfac80c[_0xd420('0xd1')]?_0xfac80c[_0xd420('0xd1')]['fullname']:'N.A.','createdAt':moment(_0xfac80c[_0xd420('0x7a')])[_0xd420('0xbb')](_0xd420('0xbc'))[_0xd420('0x95')](),'closedAt':_0xfac80c[_0xd420('0xd5')]?moment(_0xfac80c[_0xd420('0xd6')])[_0xd420('0xbb')](_0xd420('0xbc'))[_0xd420('0x95')]():'','disposition':_0xfac80c['disposition'],'messages':_(_0xfac80c['Messages'])['filter']({'secret':![]})[_0xd420('0x31')](function(_0xda5b22){return{'date':moment(_0xda5b22[_0xd420('0x7a')])[_0xd420('0xbb')](_0xd420('0xbc'))['toString'](),'sender':_0xda5b22[_0xd420('0xcf')]===_0xd420('0xd7')?_0xda5b22[_0xd420('0xcb')]?_0xda5b22['User']['fullname']:_0xd420('0xd8'):_0xda5b22[_0xd420('0xd9')][_0xd420('0xcc')]+(_0xda5b22[_0xd420('0xd9')]['lastName']?'\x20'+_0xda5b22['Contact'][_0xd420('0xcd')]:''),'body':_0xda5b22[_0xd420('0xb3')],'direction':_0xda5b22['direction']===_0xd420('0xd7')?'A':'C','secret':_0xda5b22[_0xd420('0xda')],'read':_0xda5b22['read']};})[_0xd420('0x63')]()};return ejs[_0xd420('0xdb')](path[_0xd420('0xc4')](config['root'],_0xd420('0xc6'),'views','downloadInteraction.ejs'),{'interaction':_0x342641})['then'](function(_0x32818b){var _0xdac6e8=path['join'](_0x2bfad6,_0xd420('0xdc')+_0xfac80c['id']+'-'+_0x4504c4+_0xd420('0xdd'));var _0x302b8c={'path':_0xdac6e8,'channel':_0xd420('0xd3'),'interactionId':_0xfac80c['id']};return pdf[_0xd420('0xde')](_0x32818b,_0x302b8c);})['then'](function(){return new BPromise(function(_0x1f0d79,_0x193aaf){zipdir(_0x2bfad6,{'saveTo':_0x431ba9},function(_0x1fb08e,_0x51b5d7){if(_0x1fb08e)return _0x193aaf(_0x1fb08e);return _0x1f0d79(_0x51b5d7);});})[_0xd420('0x2b')](function(){return new BPromise(function(_0x2ca122,_0x151520){rimraf(_0x2bfad6,function(_0x2aac05){if(_0x2aac05)_0x151520(_0x2aac05);return _0x2ca122();});});})[_0xd420('0x2b')](function(){return _0x5aa472[_0xd420('0xc3')](_0x431ba9,_0x1bbf47,function(_0x270fc0){if(_0x270fc0){console['log'](_0xd420('0xdf'),_0x270fc0);}else{fs['unlinkSync'](_0x431ba9);}});});});}else{return _0x5aa472[_0xd420('0x2c')](0xc8);}})['catch'](handleError(_0x5aa472,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index 4c75d15..247edd0 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 _0xfb11=['setMaxListeners','update','getUsers','setDataValue','Users','map','findAll','then','unreadMessages','emit','catch','hook','exports','events','SmsInteraction','../../mysqldb'];(function(_0xa90718,_0x2fd952){var _0x56ed79=function(_0x41cff1){while(--_0x41cff1){_0xa90718['push'](_0xa90718['shift']());}};_0x56ed79(++_0x2fd952);}(_0xfb11,0x1ad));var _0x1fb1=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xfb11[_0xbca1b1];return _0x4e1686;};'use strict';var EventEmitter=require(_0x1fb1('0x0'));var SmsInteraction=require('../../mysqldb')['db'][_0x1fb1('0x1')];var SmsMessage=require(_0x1fb1('0x2'))['db']['SmsMessage'];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x1fb1('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x1fb1('0x4'),'afterDestroy':'remove'};function emitEvent(_0x190f74){return function(_0x2ae20f,_0x5af469,_0x25d44f){_0x2ae20f[_0x1fb1('0x5')]({'attributes':['id'],'raw':!![]})['then'](function(_0x1859da){_0x2ae20f[_0x1fb1('0x6')](_0x1fb1('0x7'),_0x1859da[_0x1fb1('0x8')](function(_0x161e1b){return{'id':_0x161e1b['id']};}));return SmsMessage[_0x1fb1('0x9')]({'where':{'SmsInteractionId':_0x2ae20f['id'],'direction':'in','read':![]},'raw':!![]});})[_0x1fb1('0xa')](function(_0x416625){_0x2ae20f[_0x1fb1('0x6')](_0x1fb1('0xb'),_0x416625['length']);SmsInteractionEvents[_0x1fb1('0xc')](_0x190f74+':'+_0x2ae20f['id'],_0x2ae20f);SmsInteractionEvents['emit'](_0x190f74,_0x2ae20f);_0x25d44f(null);})[_0x1fb1('0xd')](_0x25d44f(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsInteraction[_0x1fb1('0xe')](e,emitEvent(event));}}module[_0x1fb1('0xf')]=SmsInteractionEvents; \ No newline at end of file +var _0x4325=['Users','map','findAll','then','setDataValue','length','emit','catch','exports','events','../../mysqldb','SmsMessage','setMaxListeners','remove','getUsers'];(function(_0x464251,_0x41951f){var _0x47b041=function(_0x425376){while(--_0x425376){_0x464251['push'](_0x464251['shift']());}};_0x47b041(++_0x41951f);}(_0x4325,0x1da));var _0x5432=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4325[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x5432('0x0'));var SmsInteraction=require(_0x5432('0x1'))['db']['SmsInteraction'];var SmsMessage=require(_0x5432('0x1'))['db'][_0x5432('0x2')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x5432('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x5432('0x4')};function emitEvent(_0x36ce53){return function(_0xad26e9,_0x4acbe4,_0x209e2e){_0xad26e9[_0x5432('0x5')]({'attributes':['id'],'raw':!![]})['then'](function(_0x106ec9){_0xad26e9['setDataValue'](_0x5432('0x6'),_0x106ec9[_0x5432('0x7')](function(_0x40e756){return{'id':_0x40e756['id']};}));return SmsMessage[_0x5432('0x8')]({'where':{'SmsInteractionId':_0xad26e9['id'],'direction':'in','read':![]},'raw':!![]});})[_0x5432('0x9')](function(_0x4a9a51){_0xad26e9[_0x5432('0xa')]('unreadMessages',_0x4a9a51[_0x5432('0xb')]);SmsInteractionEvents[_0x5432('0xc')](_0x36ce53+':'+_0xad26e9['id'],_0xad26e9);SmsInteractionEvents[_0x5432('0xc')](_0x36ce53,_0xad26e9);_0x209e2e(null);})[_0x5432('0xd')](_0x209e2e(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsInteraction['hook'](e,emitEvent(event));}}module[_0x5432('0xe')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index 8a7d8b0..8cb0891 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 _0xff90=['moment','bluebird','request-promise','path','../../config/environment','define','SmsInteraction','changed','closed','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','api'];(function(_0x1d4d09,_0x1bc77f){var _0x1e39b6=function(_0xf73d7e){while(--_0xf73d7e){_0x1d4d09['push'](_0x1d4d09['shift']());}};_0x1e39b6(++_0x1bc77f);}(_0xff90,0x169));var _0x0ff9=function(_0xdc356f,_0x3003d0){_0xdc356f=_0xdc356f-0x0;var _0x339eaa=_0xff90[_0xdc356f];return _0x339eaa;};'use strict';var _=require(_0x0ff9('0x0'));var util=require('util');var logger=require(_0x0ff9('0x1'))(_0x0ff9('0x2'));var moment=require(_0x0ff9('0x3'));var BPromise=require(_0x0ff9('0x4'));var rp=require(_0x0ff9('0x5'));var fs=require('fs');var path=require(_0x0ff9('0x6'));var rimraf=require('rimraf');var config=require(_0x0ff9('0x7'));var attributes=require('./smsInteraction.attributes');module['exports']=function(_0x5e7186,_0x42ce4f){return _0x5e7186[_0x0ff9('0x8')](_0x0ff9('0x9'),attributes,{'tableName':'sms_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3bee9a,_0xa5147f,_0x9b86a){if(_0x3bee9a[_0x0ff9('0xa')](_0x0ff9('0xb'))){_0x3bee9a['closedAt']=moment()['format'](_0x0ff9('0xc'));}_0x9b86a(null,_0x3bee9a);}}});}; \ No newline at end of file +var _0x6ec7=['./smsInteraction.attributes','exports','define','sms_interactions','changed','format','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','moment','bluebird','request-promise','rimraf'];(function(_0x546895,_0xb414da){var _0x3b5a09=function(_0x1da01c){while(--_0x1da01c){_0x546895['push'](_0x546895['shift']());}};_0x3b5a09(++_0xb414da);}(_0x6ec7,0x18d));var _0x76ec=function(_0x7858ed,_0x48d06b){_0x7858ed=_0x7858ed-0x0;var _0x22ea67=_0x6ec7[_0x7858ed];return _0x22ea67;};'use strict';var _=require(_0x76ec('0x0'));var util=require('util');var logger=require(_0x76ec('0x1'))('api');var moment=require(_0x76ec('0x2'));var BPromise=require(_0x76ec('0x3'));var rp=require(_0x76ec('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x76ec('0x5'));var config=require('../../config/environment');var attributes=require(_0x76ec('0x6'));module[_0x76ec('0x7')]=function(_0x323413,_0xe199d){return _0x323413[_0x76ec('0x8')]('SmsInteraction',attributes,{'tableName':_0x76ec('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1468ac,_0xa7a8f5,_0x26b530){if(_0x1468ac[_0x76ec('0xa')]('closed')){_0x1468ac['closedAt']=moment()[_0x76ec('0xb')](_0x76ec('0xc'));}_0x26b530(null,_0x1468ac);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index cc8d132..d73bc44 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 _0x06c5=['attributes','limit','debug','AddTagsToSmsInteraction','find','ids','AddTags','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','redis','socket.io-emitter','./smsInteraction.socket','register','request','then','info','SmsInteraction,\x20%s,\x20%s','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','UpdateSmsInteraction','SmsInteraction','update','body','options','where'];(function(_0x2b235e,_0x54f17e){var _0x1a95ef=function(_0x14526){while(--_0x14526){_0x2b235e['push'](_0x2b235e['shift']());}};_0x1a95ef(++_0x54f17e);}(_0x06c5,0x197));var _0x506c=function(_0x31250e,_0x590875){_0x31250e=_0x31250e-0x0;var _0xb37354=_0x06c5[_0x31250e];return _0xb37354;};'use strict';var _=require(_0x506c('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x506c('0x1'));var rs=require(_0x506c('0x2'));var fs=require('fs');var Redis=require(_0x506c('0x3'));var db=require(_0x506c('0x4'))['db'];var utils=require(_0x506c('0x5'));var logger=require(_0x506c('0x6'))('rpc');var config=require(_0x506c('0x7'));var jayson=require(_0x506c('0x8'));var client=jayson[_0x506c('0x9')][_0x506c('0xa')]({'port':0x232a});config['redis']=_[_0x506c('0xb')](config[_0x506c('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x506c('0xd'))(new Redis(config[_0x506c('0xc')]));require(_0x506c('0xe'))[_0x506c('0xf')](socket);function respondWithRpcPromise(_0x272502,_0xc1bad7,_0x4ef84d){return new BPromise(function(_0x20942c,_0xe9111){return client[_0x506c('0x10')](_0x272502,_0x4ef84d)[_0x506c('0x11')](function(_0x4c5fae){logger[_0x506c('0x12')](_0x506c('0x13'),_0xc1bad7,'request\x20sent');logger['debug'](_0x506c('0x14'),_0xc1bad7,'request\x20sent',JSON[_0x506c('0x15')](_0x4c5fae));if(_0x4c5fae[_0x506c('0x16')]){if(_0x4c5fae[_0x506c('0x16')]['code']===0x1f4){logger[_0x506c('0x16')]('SmsInteraction,\x20%s,\x20%s',_0xc1bad7,_0x4c5fae[_0x506c('0x16')][_0x506c('0x17')]);return _0xe9111(_0x4c5fae[_0x506c('0x16')][_0x506c('0x17')]);}logger[_0x506c('0x16')](_0x506c('0x13'),_0xc1bad7,_0x4c5fae[_0x506c('0x16')][_0x506c('0x17')]);return _0x20942c(_0x4c5fae[_0x506c('0x16')][_0x506c('0x17')]);}else{logger[_0x506c('0x12')](_0x506c('0x13'),_0xc1bad7,_0x506c('0x18'));_0x20942c(_0x4c5fae[_0x506c('0x19')][_0x506c('0x17')]);}})[_0x506c('0x1a')](function(_0x240872){logger['error'](_0x506c('0x13'),_0xc1bad7,_0x240872);_0xe9111(_0x240872);});});}exports[_0x506c('0x1b')]=function(_0x337e12){var _0x54279e=this;return new Promise(function(_0x1316ce,_0x6bca1c){return db[_0x506c('0x1c')][_0x506c('0x1d')](_0x337e12[_0x506c('0x1e')],{'raw':_0x337e12[_0x506c('0x1f')]?_0x337e12['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x337e12[_0x506c('0x1f')]?_0x337e12[_0x506c('0x1f')][_0x506c('0x20')]||null:null,'attributes':_0x337e12[_0x506c('0x1f')]?_0x337e12[_0x506c('0x1f')][_0x506c('0x21')]||null:null,'limit':_0x337e12[_0x506c('0x1f')]?_0x337e12['options'][_0x506c('0x22')]||null:null})[_0x506c('0x11')](function(_0x3a902f){logger[_0x506c('0x12')](_0x506c('0x1b'),_0x337e12);logger[_0x506c('0x23')]('UpdateSmsInteraction',_0x337e12,JSON[_0x506c('0x15')](_0x3a902f));_0x1316ce(_0x3a902f);})[_0x506c('0x1a')](function(_0x31354e){logger['error'](_0x506c('0x1b'),_0x31354e[_0x506c('0x17')],_0x337e12);_0x6bca1c(_0x54279e[_0x506c('0x16')](0x1f4,_0x31354e[_0x506c('0x17')]));});});};exports[_0x506c('0x24')]=function(_0x98c9a5){return new Promise(function(_0x4429f5,_0x1cadf0){return db[_0x506c('0x1c')][_0x506c('0x25')]({'where':_0x98c9a5[_0x506c('0x1f')]?_0x98c9a5['options'][_0x506c('0x20')]||null:null})[_0x506c('0x11')](function(_0x236bc1){if(_0x236bc1){return _0x236bc1['addTags'](_0x98c9a5[_0x506c('0x1e')][_0x506c('0x26')],_['omit'](_0x98c9a5[_0x506c('0x1e')],[_0x506c('0x26'),'id'])||{});}})['spread'](function(_0x519d09){logger[_0x506c('0x12')](_0x506c('0x27'),_0x98c9a5);logger[_0x506c('0x23')](_0x506c('0x27'),_0x98c9a5,JSON[_0x506c('0x15')](_0x519d09));_0x4429f5(_0x519d09);})[_0x506c('0x1a')](function(_0x38ea8a){logger[_0x506c('0x16')](_0x506c('0x27'),_0x38ea8a[_0x506c('0x17')],_0x98c9a5);_0x1cadf0(_this[_0x506c('0x16')](0x1f4,_0x38ea8a[_0x506c('0x17')]));});});}; \ No newline at end of file +var _0x6eb0=['catch','UpdateSmsInteraction','SmsInteraction','update','body','options','raw','where','attributes','limit','then','AddTagsToSmsInteraction','find','addTags','ids','spread','AddTags','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','register','request','info','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x6eb0,0x67));var _0x06eb=function(_0x556241,_0x456081){_0x556241=_0x556241-0x0;var _0x53cb34=_0x6eb0[_0x556241];return _0x53cb34;};'use strict';var _=require(_0x06eb('0x0'));var util=require('util');var moment=require(_0x06eb('0x1'));var BPromise=require(_0x06eb('0x2'));var rs=require(_0x06eb('0x3'));var fs=require('fs');var Redis=require(_0x06eb('0x4'));var db=require(_0x06eb('0x5'))['db'];var utils=require(_0x06eb('0x6'));var logger=require(_0x06eb('0x7'))('rpc');var config=require(_0x06eb('0x8'));var jayson=require(_0x06eb('0x9'));var client=jayson[_0x06eb('0xa')]['http']({'port':0x232a});config[_0x06eb('0xb')]=_[_0x06eb('0xc')](config[_0x06eb('0xb')],{'host':_0x06eb('0xd'),'port':0x18eb});var socket=require(_0x06eb('0xe'))(new Redis(config[_0x06eb('0xb')]));require(_0x06eb('0xf'))[_0x06eb('0x10')](socket);function respondWithRpcPromise(_0x3ac805,_0xcee42e,_0x38641f){return new BPromise(function(_0x450cbb,_0x590b1e){return client[_0x06eb('0x11')](_0x3ac805,_0x38641f)['then'](function(_0x325e19){logger[_0x06eb('0x12')](_0x06eb('0x13'),_0xcee42e,_0x06eb('0x14'));logger[_0x06eb('0x15')]('SmsInteraction,\x20%s,\x20%s,\x20%s',_0xcee42e,_0x06eb('0x14'),JSON[_0x06eb('0x16')](_0x325e19));if(_0x325e19[_0x06eb('0x17')]){if(_0x325e19['error']['code']===0x1f4){logger[_0x06eb('0x17')](_0x06eb('0x13'),_0xcee42e,_0x325e19[_0x06eb('0x17')][_0x06eb('0x18')]);return _0x590b1e(_0x325e19[_0x06eb('0x17')]['message']);}logger[_0x06eb('0x17')](_0x06eb('0x13'),_0xcee42e,_0x325e19[_0x06eb('0x17')][_0x06eb('0x18')]);return _0x450cbb(_0x325e19['error'][_0x06eb('0x18')]);}else{logger[_0x06eb('0x12')]('SmsInteraction,\x20%s,\x20%s',_0xcee42e,_0x06eb('0x14'));_0x450cbb(_0x325e19[_0x06eb('0x19')]['message']);}})[_0x06eb('0x1a')](function(_0x1d4f6e){logger[_0x06eb('0x17')](_0x06eb('0x13'),_0xcee42e,_0x1d4f6e);_0x590b1e(_0x1d4f6e);});});}exports[_0x06eb('0x1b')]=function(_0x3af342){var _0x693b3b=this;return new Promise(function(_0x20eac4,_0x2fed6c){return db[_0x06eb('0x1c')][_0x06eb('0x1d')](_0x3af342[_0x06eb('0x1e')],{'raw':_0x3af342[_0x06eb('0x1f')]?_0x3af342['options'][_0x06eb('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3af342['options']?_0x3af342[_0x06eb('0x1f')][_0x06eb('0x21')]||null:null,'attributes':_0x3af342[_0x06eb('0x1f')]?_0x3af342['options'][_0x06eb('0x22')]||null:null,'limit':_0x3af342['options']?_0x3af342[_0x06eb('0x1f')][_0x06eb('0x23')]||null:null})[_0x06eb('0x24')](function(_0x432adc){logger['info'](_0x06eb('0x1b'),_0x3af342);logger[_0x06eb('0x15')](_0x06eb('0x1b'),_0x3af342,JSON[_0x06eb('0x16')](_0x432adc));_0x20eac4(_0x432adc);})[_0x06eb('0x1a')](function(_0x4ed13b){logger[_0x06eb('0x17')]('UpdateSmsInteraction',_0x4ed13b['message'],_0x3af342);_0x2fed6c(_0x693b3b[_0x06eb('0x17')](0x1f4,_0x4ed13b[_0x06eb('0x18')]));});});};exports[_0x06eb('0x25')]=function(_0x5cf2f7){return new Promise(function(_0x176fbb,_0x5d57d3){return db[_0x06eb('0x1c')][_0x06eb('0x26')]({'where':_0x5cf2f7[_0x06eb('0x1f')]?_0x5cf2f7[_0x06eb('0x1f')][_0x06eb('0x21')]||null:null})[_0x06eb('0x24')](function(_0x40abba){if(_0x40abba){return _0x40abba[_0x06eb('0x27')](_0x5cf2f7['body'][_0x06eb('0x28')],_['omit'](_0x5cf2f7['body'],[_0x06eb('0x28'),'id'])||{});}})[_0x06eb('0x29')](function(_0x25d564){logger[_0x06eb('0x12')](_0x06eb('0x2a'),_0x5cf2f7);logger[_0x06eb('0x15')](_0x06eb('0x2a'),_0x5cf2f7,JSON['stringify'](_0x25d564));_0x176fbb(_0x25d564);})[_0x06eb('0x1a')](function(_0x2a1843){logger[_0x06eb('0x17')](_0x06eb('0x2a'),_0x2a1843['message'],_0x5cf2f7);_0x5d57d3(_this[_0x06eb('0x17')](0x1f4,_0x2a1843[_0x06eb('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index 7cab8bc..f7465cd 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 _0xe685=['update','removeListener','register','length','smsInteraction:','remove'];(function(_0x35451f,_0x13ccb8){var _0x282e0d=function(_0x35d67b){while(--_0x35d67b){_0x35451f['push'](_0x35451f['shift']());}};_0x282e0d(++_0x13ccb8);}(_0xe685,0x113));var _0x5e68=function(_0xb540d7,_0x5f169b){_0xb540d7=_0xb540d7-0x0;var _0x561841=_0xe685[_0xb540d7];return _0x561841;};'use strict';var SmsInteractionEvents=require('./smsInteraction.events');var events=['save',_0x5e68('0x0'),_0x5e68('0x1')];function createListener(_0x5c2311,_0x5d29d3){return function(_0x591af8){_0x5d29d3['emit'](_0x5c2311,_0x591af8);};}function removeListener(_0x3d87ab,_0x58a0e5){return function(){SmsInteractionEvents[_0x5e68('0x2')](_0x3d87ab,_0x58a0e5);};}exports[_0x5e68('0x3')]=function(_0x30e8b0){for(var _0x4ca03c=0x0,_0x3acb81=events[_0x5e68('0x4')];_0x4ca03c<_0x3acb81;_0x4ca03c++){var _0x1cd0de=events[_0x4ca03c];var _0x2f54f4=createListener(_0x5e68('0x5')+_0x1cd0de,_0x30e8b0);SmsInteractionEvents['on'](_0x1cd0de,_0x2f54f4);}}; \ No newline at end of file +var _0x0a0f=['emit','register','length','smsInteraction:','./smsInteraction.events','save','remove','update'];(function(_0x10bb3f,_0x2857a0){var _0x4198e8=function(_0x1d0d23){while(--_0x1d0d23){_0x10bb3f['push'](_0x10bb3f['shift']());}};_0x4198e8(++_0x2857a0);}(_0x0a0f,0x8c));var _0xf0a0=function(_0x35af53,_0x5966b1){_0x35af53=_0x35af53-0x0;var _0x6bbbce=_0x0a0f[_0x35af53];return _0x6bbbce;};'use strict';var SmsInteractionEvents=require(_0xf0a0('0x0'));var events=[_0xf0a0('0x1'),_0xf0a0('0x2'),_0xf0a0('0x3')];function createListener(_0x237198,_0x14174e){return function(_0x15b1fe){_0x14174e[_0xf0a0('0x4')](_0x237198,_0x15b1fe);};}function removeListener(_0x4e4e1b,_0x1c820c){return function(){SmsInteractionEvents['removeListener'](_0x4e4e1b,_0x1c820c);};}exports[_0xf0a0('0x5')]=function(_0x6416f5){for(var _0x2f747b=0x0,_0x599bc3=events[_0xf0a0('0x6')];_0x2f747b<_0x599bc3;_0x2f747b++){var _0x5dffca=events[_0x2f747b];var _0xc10d49=createListener(_0xf0a0('0x7')+_0x5dffca,_0x6416f5);SmsInteractionEvents['on'](_0x5dffca,_0xc10d49);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index c169f9f..d0fa27b 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 _0x864e=['./smsMessage.controller','get','isAuthenticated','index','describe','/:id','show','post','sms','/:id/status','status','put','/:id/accept','accept','delete','destroy','multer','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x31ced5,_0x5d5415){var _0x10d9e5=function(_0x2e51a5){while(--_0x2e51a5){_0x31ced5['push'](_0x31ced5['shift']());}};_0x10d9e5(++_0x5d5415);}(_0x864e,0x13b));var _0xe864=function(_0x4b9514,_0x3caf7d){_0x4b9514=_0x4b9514-0x0;var _0x192d80=_0x864e[_0x4b9514];return _0x192d80;};'use strict';var multer=require(_0xe864('0x0'));var util=require('util');var path=require(_0xe864('0x1'));var timeout=require(_0xe864('0x2'));var express=require('express');var router=express[_0xe864('0x3')]();var fs_extra=require(_0xe864('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xe864('0x5'));var config=require(_0xe864('0x6'));var controller=require(_0xe864('0x7'));router[_0xe864('0x8')]('/',auth[_0xe864('0x9')](),controller[_0xe864('0xa')]);router[_0xe864('0x8')]('/describe',auth[_0xe864('0x9')](),controller[_0xe864('0xb')]);router[_0xe864('0x8')](_0xe864('0xc'),auth[_0xe864('0x9')](),controller[_0xe864('0xd')]);router[_0xe864('0xe')]('/',auth[_0xe864('0x9')](),interaction['tracked'](_0xe864('0xf'),'smsmessage:create'),controller['create']);router['post'](_0xe864('0x10'),controller[_0xe864('0x11')]);router['put']('/:id',auth[_0xe864('0x9')](),controller['update']);router[_0xe864('0x12')](_0xe864('0x13'),auth[_0xe864('0x9')](),controller[_0xe864('0x14')]);router['put']('/:id/reject',auth[_0xe864('0x9')](),controller['reject']);router[_0xe864('0x15')](_0xe864('0xc'),auth['isAuthenticated'](),controller[_0xe864('0x16')]);module['exports']=router; \ No newline at end of file +var _0x4c76=['destroy','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsMessage.controller','isAuthenticated','get','/describe','show','post','tracked','sms','smsmessage:create','create','/:id/status','put','/:id','update','accept','/:id/reject','reject'];(function(_0x32e44f,_0x20542c){var _0x5d3ae8=function(_0x4311a4){while(--_0x4311a4){_0x32e44f['push'](_0x32e44f['shift']());}};_0x5d3ae8(++_0x20542c);}(_0x4c76,0x84));var _0x64c7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4c76[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x64c7('0x0'));var path=require('path');var timeout=require(_0x64c7('0x1'));var express=require(_0x64c7('0x2'));var router=express[_0x64c7('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x64c7('0x4'));var interaction=require(_0x64c7('0x5'));var config=require(_0x64c7('0x6'));var controller=require(_0x64c7('0x7'));router['get']('/',auth[_0x64c7('0x8')](),controller['index']);router[_0x64c7('0x9')](_0x64c7('0xa'),auth['isAuthenticated'](),controller['describe']);router['get']('/:id',auth[_0x64c7('0x8')](),controller[_0x64c7('0xb')]);router[_0x64c7('0xc')]('/',auth[_0x64c7('0x8')](),interaction[_0x64c7('0xd')](_0x64c7('0xe'),_0x64c7('0xf')),controller[_0x64c7('0x10')]);router[_0x64c7('0xc')](_0x64c7('0x11'),controller['status']);router[_0x64c7('0x12')](_0x64c7('0x13'),auth[_0x64c7('0x8')](),controller[_0x64c7('0x14')]);router[_0x64c7('0x12')]('/:id/accept',auth[_0x64c7('0x8')](),controller[_0x64c7('0x15')]);router[_0x64c7('0x12')](_0x64c7('0x16'),auth[_0x64c7('0x8')](),controller[_0x64c7('0x17')]);router['delete'](_0x64c7('0x13'),auth[_0x64c7('0x8')](),controller[_0x64c7('0x18')]);module[_0x64c7('0x19')]=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index 2d6d62d..00469c9 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 _0xed01=['TEXT','sequelize','exports','medium','BOOLEAN','ENUM','STRING','DATE'];(function(_0x24734e,_0x8f431d){var _0x288f7a=function(_0x2fcff6){while(--_0x2fcff6){_0x24734e['push'](_0x24734e['shift']());}};_0x288f7a(++_0x8f431d);}(_0xed01,0x111));var _0x1ed0=function(_0x44c15e,_0x96ed4c){_0x44c15e=_0x44c15e-0x0;var _0x13fc14=_0xed01[_0x44c15e];return _0x13fc14;};'use strict';var Sequelize=require(_0x1ed0('0x0'));module[_0x1ed0('0x1')]={'body':{'type':Sequelize['TEXT'](_0x1ed0('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x1ed0('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x1ed0('0x4')]('in','out'),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0x1ed0('0x5')](0xbe)},'phone':{'type':Sequelize[_0x1ed0('0x5')]},'readAt':{'type':Sequelize[_0x1ed0('0x6')]},'secret':{'type':Sequelize[_0x1ed0('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x1ed0('0x5')]},'providerResponse':{'type':Sequelize[_0x1ed0('0x7')]}}; \ No newline at end of file +var _0xdb60=['DATE','sequelize','TEXT','medium','BOOLEAN','out','STRING'];(function(_0x507aeb,_0x359717){var _0x4358cf=function(_0x517edc){while(--_0x517edc){_0x507aeb['push'](_0x507aeb['shift']());}};_0x4358cf(++_0x359717);}(_0xdb60,0xd3));var _0x0db6=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xdb60[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x0db6('0x0'));module['exports']={'body':{'type':Sequelize[_0x0db6('0x1')](_0x0db6('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x0db6('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0x0db6('0x4'),'allowNull':![]},'messageId':{'type':Sequelize[_0x0db6('0x5')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0x0db6('0x6')]},'secret':{'type':Sequelize[_0x0db6('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x0db6('0x5')]},'providerResponse':{'type':Sequelize[_0x0db6('0x1')]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index 0c8a479..868556e 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 _0x1b20=['end','json','undefined','limit','count','offset','status','set','Content-Range','reject','update','stack','name','send','map','SmsMessage','rawAttributes','key','query','keys','intersection','model','fields','attributes','length','nolimit','sort','where','filters','pick','filter','merge','type','includeAll','include','findAll','show','options','find','create','body','params','describe','sms-interactions','sms','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','CmContact','get','SmsInteraction','isNil','read1stAt','interaction','info','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','push','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','SELECT','contact','manual','interface','channel','accept','EventManager','acceptmessage','SmsInteractionId','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','stringify','rejectMessage','startsWith','cf_','Sequelize','event','rejectmessage','SmsAccount','SmsAccountId','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','MessageUUID','indexOf','sent','delivered','Status','SmsAccount,\x20%s,\x20%s,\x20%s','plivio','infobip','results','DELIVERED','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','redis','defaults','localhost','./smsMessage.socket','register','jayson/promise','client','http','request','then','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus'];(function(_0x1a082f,_0x3b5033){var _0x385cb8=function(_0xe1bc8b){while(--_0xe1bc8b){_0x1a082f['push'](_0x1a082f['shift']());}};_0x385cb8(++_0x3b5033);}(_0x1b20,0x66));var _0x01b2=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x1b20[_0x4565bf];return _0x5610ba;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x01b2('0x0'));var zipdir=require(_0x01b2('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x01b2('0x2'));var BPromise=require(_0x01b2('0x3'));var Mustache=require(_0x01b2('0x4'));var util=require(_0x01b2('0x5'));var path=require(_0x01b2('0x6'));var sox=require(_0x01b2('0x7'));var csv=require(_0x01b2('0x8'));var ejs=require(_0x01b2('0x9'));var fs=require('fs');var fs_extra=require(_0x01b2('0xa'));var _=require(_0x01b2('0xb'));var squel=require(_0x01b2('0xc'));var crypto=require(_0x01b2('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x01b2('0xe'));var toCsv=require('to-csv');var querystring=require(_0x01b2('0xf'));var Papa=require(_0x01b2('0x10'));var Redis=require(_0x01b2('0x11'));var authService=require(_0x01b2('0x12'));var qs=require(_0x01b2('0x13'));var as=require(_0x01b2('0x14'));var hardwareService=require(_0x01b2('0x15'));var logger=require(_0x01b2('0x16'))('api');var utils=require(_0x01b2('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x01b2('0x18'));var db=require('../../mysqldb')['db'];config[_0x01b2('0x19')]=_[_0x01b2('0x1a')](config[_0x01b2('0x19')],{'host':_0x01b2('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x01b2('0x19')]));require(_0x01b2('0x1c'))[_0x01b2('0x1d')](socket);var jayson=require(_0x01b2('0x1e'));var client=jayson[_0x01b2('0x1f')]['http']({'port':0x232c});var client9002=jayson[_0x01b2('0x1f')][_0x01b2('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x1a9734,_0x3f68a8,_0x50eb39,_0x523b80){return new BPromise(function(_0x2a8458,_0x3c0e03){var _0x588dbe=_0x523b80||client;return _0x588dbe[_0x01b2('0x21')](_0x1a9734,_0x50eb39)[_0x01b2('0x22')](function(_0x27a0bc){logger['info'](_0x01b2('0x23'),_0x3f68a8,_0x01b2('0x24'));logger[_0x01b2('0x25')](_0x01b2('0x26'),_0x3f68a8,_0x01b2('0x24'),JSON['stringify'](_0x27a0bc));if(_0x27a0bc[_0x01b2('0x27')]){if(_0x27a0bc['error'][_0x01b2('0x28')]===0x1f4){logger['error'](_0x01b2('0x23'),_0x3f68a8,_0x27a0bc[_0x01b2('0x27')][_0x01b2('0x29')]);return _0x3c0e03(_0x27a0bc['error'][_0x01b2('0x29')]);}logger[_0x01b2('0x27')](_0x01b2('0x23'),_0x3f68a8,_0x27a0bc[_0x01b2('0x27')][_0x01b2('0x29')]);return _0x2a8458(_0x27a0bc['error'][_0x01b2('0x29')]);}else{logger['info']('SmsMessage,\x20%s,\x20%s',_0x3f68a8,_0x01b2('0x24'));_0x2a8458(_0x27a0bc[_0x01b2('0x2a')][_0x01b2('0x29')]);}})[_0x01b2('0x2b')](function(_0x2e32c1){logger[_0x01b2('0x27')]('SmsMessage,\x20%s,\x20%s',_0x3f68a8,_0x2e32c1);_0x3c0e03(_0x2e32c1);});});}function respondWithStatusCode(_0x2cb5f1,_0x239543){_0x239543=_0x239543||0xcc;return function(_0x424cfd){if(_0x424cfd){return _0x2cb5f1[_0x01b2('0x2c')](_0x239543);}return _0x2cb5f1['status'](_0x239543)[_0x01b2('0x2d')]();};}function respondWithResult(_0x586814,_0x122925){_0x122925=_0x122925||0xc8;return function(_0x1e6ac2){if(_0x1e6ac2){return _0x586814['status'](_0x122925)[_0x01b2('0x2e')](_0x1e6ac2);}};}function respondWithFilteredResult(_0x5efdda,_0x487c49){return function(_0x291d56){if(_0x291d56){var _0x4363ec=typeof _0x487c49['offset']===_0x01b2('0x2f')&&typeof _0x487c49[_0x01b2('0x30')]===_0x01b2('0x2f');var _0x2cf50f=_0x291d56[_0x01b2('0x31')];var _0xd7ad6b=_0x4363ec?0x0:_0x487c49[_0x01b2('0x32')];var _0x3169f5=_0x4363ec?_0x291d56[_0x01b2('0x31')]:_0x487c49[_0x01b2('0x32')]+_0x487c49[_0x01b2('0x30')];var _0x5e6981;if(_0x3169f5>=_0x2cf50f){_0x3169f5=_0x2cf50f;_0x5e6981=0xc8;}else{_0x5e6981=0xce;}_0x5efdda[_0x01b2('0x33')](_0x5e6981);return _0x5efdda[_0x01b2('0x34')](_0x01b2('0x35'),_0xd7ad6b+'-'+_0x3169f5+'/'+_0x2cf50f)[_0x01b2('0x2e')](_0x291d56);}return null;};}function patchUpdates(_0x306666){return function(_0x11dd4e){try{jsonpatch['apply'](_0x11dd4e,_0x306666,!![]);}catch(_0x480fa7){return BPromise[_0x01b2('0x36')](_0x480fa7);}return _0x11dd4e['save']();};}function saveUpdates(_0x50ec09,_0x2c2d51){return function(_0x176849){if(_0x176849){return _0x176849[_0x01b2('0x37')](_0x50ec09)[_0x01b2('0x22')](function(_0x520b4c){return _0x520b4c;});}return null;};}function removeEntity(_0x42c3f8,_0x5a954a){return function(_0xcd6801){if(_0xcd6801){return _0xcd6801['destroy']()['then'](function(){_0x42c3f8['status'](0xcc)[_0x01b2('0x2d')]();});}};}function handleEntityNotFound(_0x29532e,_0x8f8433){return function(_0x12725b){if(!_0x12725b){_0x29532e['sendStatus'](0x194);}return _0x12725b;};}function handleError(_0x11504a,_0x2bd252){_0x2bd252=_0x2bd252||0x1f4;return function(_0x5865a3){logger[_0x01b2('0x27')](_0x5865a3[_0x01b2('0x38')]);if(_0x5865a3[_0x01b2('0x39')]){delete _0x5865a3[_0x01b2('0x39')];}_0x11504a[_0x01b2('0x33')](_0x2bd252)[_0x01b2('0x3a')](_0x5865a3);};}exports['index']=function(_0x2fb530,_0x2258ed){var _0x51f947={},_0x5576d8={},_0x44e338={'count':0x0,'rows':[]};var _0x3d7e77=_[_0x01b2('0x3b')](db[_0x01b2('0x3c')][_0x01b2('0x3d')],function(_0x3b0cc7){return{'name':_0x3b0cc7['fieldName'],'type':_0x3b0cc7['type'][_0x01b2('0x3e')]};});_0x5576d8['model']=_[_0x01b2('0x3b')](_0x3d7e77,_0x01b2('0x39'));_0x5576d8[_0x01b2('0x3f')]=_[_0x01b2('0x40')](_0x2fb530[_0x01b2('0x3f')]);_0x5576d8['filters']=_[_0x01b2('0x41')](_0x5576d8[_0x01b2('0x42')],_0x5576d8[_0x01b2('0x3f')]);_0x51f947['attributes']=_[_0x01b2('0x41')](_0x5576d8[_0x01b2('0x42')],qs[_0x01b2('0x43')](_0x2fb530['query'][_0x01b2('0x43')]));_0x51f947['attributes']=_0x51f947[_0x01b2('0x44')][_0x01b2('0x45')]?_0x51f947['attributes']:_0x5576d8[_0x01b2('0x42')];if(!_0x2fb530[_0x01b2('0x3f')]['hasOwnProperty'](_0x01b2('0x46'))){_0x51f947[_0x01b2('0x30')]=qs[_0x01b2('0x30')](_0x2fb530[_0x01b2('0x3f')][_0x01b2('0x30')]);_0x51f947['offset']=qs[_0x01b2('0x32')](_0x2fb530[_0x01b2('0x3f')][_0x01b2('0x32')]);}_0x51f947['order']=qs[_0x01b2('0x47')](_0x2fb530[_0x01b2('0x3f')][_0x01b2('0x47')]);_0x51f947[_0x01b2('0x48')]=qs[_0x01b2('0x49')](_[_0x01b2('0x4a')](_0x2fb530[_0x01b2('0x3f')],_0x5576d8[_0x01b2('0x49')]),_0x3d7e77);if(_0x2fb530['query'][_0x01b2('0x4b')]){_0x51f947[_0x01b2('0x48')]=_[_0x01b2('0x4c')](_0x51f947[_0x01b2('0x48')],{'$or':_[_0x01b2('0x3b')](_0x3d7e77,function(_0x3469b3){if(_0x3469b3[_0x01b2('0x4d')]!=='VIRTUAL'){var _0x1e9c10={};_0x1e9c10[_0x3469b3[_0x01b2('0x39')]]={'$like':'%'+_0x2fb530[_0x01b2('0x3f')][_0x01b2('0x4b')]+'%'};return _0x1e9c10;}})});}_0x51f947=_['merge']({},_0x51f947,_0x2fb530['options']);var _0x241bd0={'where':_0x51f947[_0x01b2('0x48')]};return db[_0x01b2('0x3c')]['count'](_0x241bd0)[_0x01b2('0x22')](function(_0x17a8fe){_0x44e338[_0x01b2('0x31')]=_0x17a8fe;if(_0x2fb530[_0x01b2('0x3f')][_0x01b2('0x4e')]){_0x51f947[_0x01b2('0x4f')]=[{'all':!![]}];}return db['SmsMessage'][_0x01b2('0x50')](_0x51f947);})['then'](function(_0x272d0d){_0x44e338['rows']=_0x272d0d;return _0x44e338;})['then'](respondWithFilteredResult(_0x2258ed,_0x51f947))[_0x01b2('0x2b')](handleError(_0x2258ed,null));};exports[_0x01b2('0x51')]=function(_0x3dda96,_0x25d72e){var _0x20cc59={'raw':!![],'where':{'id':_0x3dda96['params']['id']}},_0x496dd3={};_0x496dd3[_0x01b2('0x42')]=_[_0x01b2('0x40')](db[_0x01b2('0x3c')][_0x01b2('0x3d')]);_0x496dd3[_0x01b2('0x3f')]=_[_0x01b2('0x40')](_0x3dda96['query']);_0x496dd3[_0x01b2('0x49')]=_[_0x01b2('0x41')](_0x496dd3[_0x01b2('0x42')],_0x496dd3[_0x01b2('0x3f')]);_0x20cc59[_0x01b2('0x44')]=_[_0x01b2('0x41')](_0x496dd3[_0x01b2('0x42')],qs['fields'](_0x3dda96[_0x01b2('0x3f')][_0x01b2('0x43')]));_0x20cc59[_0x01b2('0x44')]=_0x20cc59[_0x01b2('0x44')][_0x01b2('0x45')]?_0x20cc59[_0x01b2('0x44')]:_0x496dd3['model'];if(_0x3dda96[_0x01b2('0x3f')][_0x01b2('0x4e')]){_0x20cc59[_0x01b2('0x4f')]=[{'all':!![]}];}_0x20cc59=_[_0x01b2('0x4c')]({},_0x20cc59,_0x3dda96[_0x01b2('0x52')]);return db[_0x01b2('0x3c')][_0x01b2('0x53')](_0x20cc59)[_0x01b2('0x22')](handleEntityNotFound(_0x25d72e,null))[_0x01b2('0x22')](respondWithResult(_0x25d72e,null))[_0x01b2('0x2b')](handleError(_0x25d72e,null));};exports[_0x01b2('0x54')]=function(_0x43f453,_0x11a8a0){return db[_0x01b2('0x3c')]['create'](_0x43f453['body'],{})['then'](respondWithResult(_0x11a8a0,0xc9))['catch'](handleError(_0x11a8a0,null));};exports[_0x01b2('0x37')]=function(_0x36ab3b,_0x9daac7){if(_0x36ab3b['body']['id']){delete _0x36ab3b[_0x01b2('0x55')]['id'];}return db['SmsMessage'][_0x01b2('0x53')]({'where':{'id':_0x36ab3b[_0x01b2('0x56')]['id']}})[_0x01b2('0x22')](handleEntityNotFound(_0x9daac7,null))[_0x01b2('0x22')](saveUpdates(_0x36ab3b[_0x01b2('0x55')],null))['then'](respondWithResult(_0x9daac7,null))[_0x01b2('0x2b')](handleError(_0x9daac7,null));};exports['destroy']=function(_0x469a08,_0x7533be){return db['SmsMessage'][_0x01b2('0x53')]({'where':{'id':_0x469a08['params']['id']}})[_0x01b2('0x22')](handleEntityNotFound(_0x7533be,null))[_0x01b2('0x22')](removeEntity(_0x7533be,null))[_0x01b2('0x2b')](handleError(_0x7533be,null));};exports[_0x01b2('0x57')]=function(_0x6b1e60,_0x422b20){return db[_0x01b2('0x3c')][_0x01b2('0x57')]()[_0x01b2('0x22')](respondWithResult(_0x422b20,null))[_0x01b2('0x2b')](handleError(_0x422b20,null));};var interaction_log=require('../../config/logger')(_0x01b2('0x58'));exports['accept']=function(_0x3039a1,_0x3c0f66,_0xf66ade){var _0x58c8de={'agent':{},'channel':_0x01b2('0x59')};if(_0x3039a1['body']['id']){delete _0x3039a1['body']['id'];}_0x3039a1[_0x01b2('0x55')][_0x01b2('0x5a')]=!![];_0x3039a1[_0x01b2('0x55')]['readAt']=moment()[_0x01b2('0x5b')](_0x01b2('0x5c'));_0x3039a1[_0x01b2('0x55')]['UserId']=_0x3039a1[_0x01b2('0x55')][_0x01b2('0x5d')]||_0x3039a1[_0x01b2('0x5e')]['id'];_0x58c8de[_0x01b2('0x5f')]['id']=_0x3039a1[_0x01b2('0x55')][_0x01b2('0x5d')];return db[_0x01b2('0x3c')]['find']({'where':{'id':_0x3039a1['params']['id'],'UserId':null},'include':[{'model':db[_0x01b2('0x60')],'as':'Contact'}]})['then'](handleEntityNotFound(_0x3c0f66,null))[_0x01b2('0x22')](saveUpdates(_0x3039a1['body'],null))[_0x01b2('0x22')](function(_0x548a3d){if(_0x548a3d){_0x58c8de[_0x01b2('0x29')]=_0x548a3d[_0x01b2('0x61')]({'plain':!![]});return db[_0x01b2('0x62')][_0x01b2('0x53')]({'where':{'id':_0x548a3d['SmsInteractionId']}});}return null;})[_0x01b2('0x22')](handleEntityNotFound(_0x3c0f66,null))['then'](function(_0x150f4c){if(_0x150f4c){return _0x150f4c['update']({'UserId':_0x3039a1[_0x01b2('0x55')]['UserId'],'read1stAt':_[_0x01b2('0x63')](_0x150f4c[_0x01b2('0x64')])?moment()['format'](_0x01b2('0x5c')):undefined});}return null;})[_0x01b2('0x22')](function(_0x2efe58){if(_0x2efe58){_0x58c8de[_0x01b2('0x65')]=_0x2efe58[_0x01b2('0x61')]({'plain':!![]});interaction_log[_0x01b2('0x66')](_0x01b2('0x67'),_0x3039a1[_0x01b2('0x5e')]['id'],_0x3039a1[_0x01b2('0x5e')][_0x01b2('0x39')],_0x3039a1[_0x01b2('0x5e')][_0x01b2('0x68')],_0x58c8de[_0x01b2('0x65')]['id'],_0x3039a1['body']?JSON['stringify'](_0x3039a1[_0x01b2('0x55')]):_0x01b2('0x69'));return respondWithRpcPromise(_0x01b2('0x6a'),_0x01b2('0x6b'),_0x58c8de);}return null;})[_0x01b2('0x22')](function(_0x3a44d2){return db[_0x01b2('0x60')][_0x01b2('0x57')]()['then'](function(_0xb02256){var _0x5f2a73=[];for(var _0x35eb56=0x0;_0x35eb56=0x0){return _0x1f85a5[_0x01b2('0x37')]({'read':!![]});}else{logger['error'](_0x01b2('0x8e'),_0x01b2('0x33'),_0x01b2('0x8f'),util['inspect'](_0x461e8b[_0x01b2('0x55')],{'showHidden':![],'depth':null}));}break;case _0x01b2('0x90'):var _0x26c64c=_0x461e8b[_0x01b2('0x55')][_0x01b2('0x91')][0x0];if(_0x26c64c['status']['groupName']===_0x01b2('0x92')){return _0x1f85a5[_0x01b2('0x37')]({'read':!![]});}else{logger[_0x01b2('0x27')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x01b2('0x90'),util['inspect'](_0x461e8b[_0x01b2('0x55')],{'showHidden':![],'depth':null}));}break;}return _0x1f85a5;}})[_0x01b2('0x22')](respondWithResult(_0x1268c7,null))['catch'](handleError(_0x1268c7,null));}; \ No newline at end of file +var _0xe015=['RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','QueryTypes','SmsAccount','SmsAccountId','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','indexOf','delivered','Status','plivio','infobip','results','groupName','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','ejs','fs-extra','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','defaults','redis','localhost','socket.io-emitter','./smsMessage.socket','jayson/promise','client','http','request','info','SmsMessage,\x20%s,\x20%s','debug','SmsMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','json','undefined','count','offset','set','Content-Range','apply','reject','save','update','then','end','stack','name','send','index','map','SmsMessage','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','params','create','body','find','describe','sms-interactions','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','Contact','get','SmsInteractionId','isNil','format','interaction','user','role','null','CmContact','startsWith','cf_','push','ContactId','sequelize','Sequelize','SELECT','contact','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','agent','SmsInteraction'];(function(_0x50e015,_0x339804){var _0x74e916=function(_0x373291){while(--_0x373291){_0x50e015['push'](_0x50e015['shift']());}};_0x74e916(++_0x339804);}(_0xe015,0x13b));var _0x5e01=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xe015[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0x5e01('0x0'));var rimraf=require(_0x5e01('0x1'));var zipdir=require(_0x5e01('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x5e01('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x5e01('0x4'));var util=require(_0x5e01('0x5'));var path=require(_0x5e01('0x6'));var sox=require(_0x5e01('0x7'));var csv=require('to-csv');var ejs=require(_0x5e01('0x8'));var fs=require('fs');var fs_extra=require(_0x5e01('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x5e01('0xa'));var jsforce=require(_0x5e01('0xb'));var deskjs=require(_0x5e01('0xc'));var toCsv=require(_0x5e01('0xd'));var querystring=require(_0x5e01('0xe'));var Papa=require(_0x5e01('0xf'));var Redis=require('ioredis');var authService=require(_0x5e01('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x5e01('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5e01('0x12'))(_0x5e01('0x13'));var utils=require('../../config/utils');var config=require(_0x5e01('0x14'));var licenseUtil=require(_0x5e01('0x15'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x5e01('0x16')](config[_0x5e01('0x17')],{'host':_0x5e01('0x18'),'port':0x18eb});var socket=require(_0x5e01('0x19'))(new Redis(config[_0x5e01('0x17')]));require(_0x5e01('0x1a'))['register'](socket);var jayson=require(_0x5e01('0x1b'));var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0x5e01('0x1c')][_0x5e01('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x494b8a,_0x27c6e7,_0x5a532d,_0x4fb33e){return new BPromise(function(_0x5e4058,_0x384274){var _0x5d85e3=_0x4fb33e||client;return _0x5d85e3[_0x5e01('0x1e')](_0x494b8a,_0x5a532d)['then'](function(_0x509c07){logger[_0x5e01('0x1f')](_0x5e01('0x20'),_0x27c6e7,'request\x20sent');logger[_0x5e01('0x21')](_0x5e01('0x22'),_0x27c6e7,_0x5e01('0x23'),JSON[_0x5e01('0x24')](_0x509c07));if(_0x509c07[_0x5e01('0x25')]){if(_0x509c07[_0x5e01('0x25')][_0x5e01('0x26')]===0x1f4){logger[_0x5e01('0x25')]('SmsMessage,\x20%s,\x20%s',_0x27c6e7,_0x509c07[_0x5e01('0x25')][_0x5e01('0x27')]);return _0x384274(_0x509c07['error'][_0x5e01('0x27')]);}logger[_0x5e01('0x25')](_0x5e01('0x20'),_0x27c6e7,_0x509c07[_0x5e01('0x25')][_0x5e01('0x27')]);return _0x5e4058(_0x509c07[_0x5e01('0x25')]['message']);}else{logger[_0x5e01('0x1f')](_0x5e01('0x20'),_0x27c6e7,_0x5e01('0x23'));_0x5e4058(_0x509c07[_0x5e01('0x28')]['message']);}})[_0x5e01('0x29')](function(_0x23264f){logger[_0x5e01('0x25')]('SmsMessage,\x20%s,\x20%s',_0x27c6e7,_0x23264f);_0x384274(_0x23264f);});});}function respondWithStatusCode(_0x3df641,_0x23454e){_0x23454e=_0x23454e||0xcc;return function(_0x12a19a){if(_0x12a19a){return _0x3df641[_0x5e01('0x2a')](_0x23454e);}return _0x3df641['status'](_0x23454e)['end']();};}function respondWithResult(_0xca92be,_0x5f01dd){_0x5f01dd=_0x5f01dd||0xc8;return function(_0x14b9f5){if(_0x14b9f5){return _0xca92be[_0x5e01('0x2b')](_0x5f01dd)[_0x5e01('0x2c')](_0x14b9f5);}};}function respondWithFilteredResult(_0xc26cf8,_0x592a61){return function(_0x531f0a){if(_0x531f0a){var _0x4a4a9f=typeof _0x592a61['offset']===_0x5e01('0x2d')&&typeof _0x592a61['limit']===_0x5e01('0x2d');var _0x37b32a=_0x531f0a[_0x5e01('0x2e')];var _0x494da9=_0x4a4a9f?0x0:_0x592a61[_0x5e01('0x2f')];var _0x36d7a8=_0x4a4a9f?_0x531f0a[_0x5e01('0x2e')]:_0x592a61[_0x5e01('0x2f')]+_0x592a61['limit'];var _0x5f263e;if(_0x36d7a8>=_0x37b32a){_0x36d7a8=_0x37b32a;_0x5f263e=0xc8;}else{_0x5f263e=0xce;}_0xc26cf8[_0x5e01('0x2b')](_0x5f263e);return _0xc26cf8[_0x5e01('0x30')](_0x5e01('0x31'),_0x494da9+'-'+_0x36d7a8+'/'+_0x37b32a)[_0x5e01('0x2c')](_0x531f0a);}return null;};}function patchUpdates(_0x350659){return function(_0x1a0ebe){try{jsonpatch[_0x5e01('0x32')](_0x1a0ebe,_0x350659,!![]);}catch(_0x16a8de){return BPromise[_0x5e01('0x33')](_0x16a8de);}return _0x1a0ebe[_0x5e01('0x34')]();};}function saveUpdates(_0x1ebdb9,_0x161b96){return function(_0x53ab35){if(_0x53ab35){return _0x53ab35[_0x5e01('0x35')](_0x1ebdb9)[_0x5e01('0x36')](function(_0x103b05){return _0x103b05;});}return null;};}function removeEntity(_0x514c85,_0x217fca){return function(_0x12a1f4){if(_0x12a1f4){return _0x12a1f4['destroy']()[_0x5e01('0x36')](function(){_0x514c85[_0x5e01('0x2b')](0xcc)[_0x5e01('0x37')]();});}};}function handleEntityNotFound(_0x5b68ed,_0x458a5e){return function(_0x32ef68){if(!_0x32ef68){_0x5b68ed[_0x5e01('0x2a')](0x194);}return _0x32ef68;};}function handleError(_0x3dbba,_0x388b8a){_0x388b8a=_0x388b8a||0x1f4;return function(_0x3d5c79){logger[_0x5e01('0x25')](_0x3d5c79[_0x5e01('0x38')]);if(_0x3d5c79[_0x5e01('0x39')]){delete _0x3d5c79[_0x5e01('0x39')];}_0x3dbba[_0x5e01('0x2b')](_0x388b8a)[_0x5e01('0x3a')](_0x3d5c79);};}exports[_0x5e01('0x3b')]=function(_0x28bd7a,_0x260901){var _0x578d61={},_0x3b3138={},_0x5b3bef={'count':0x0,'rows':[]};var _0x544899=_[_0x5e01('0x3c')](db[_0x5e01('0x3d')][_0x5e01('0x3e')],function(_0x117fb3){return{'name':_0x117fb3[_0x5e01('0x3f')],'type':_0x117fb3['type'][_0x5e01('0x40')]};});_0x3b3138[_0x5e01('0x41')]=_['map'](_0x544899,_0x5e01('0x39'));_0x3b3138[_0x5e01('0x42')]=_[_0x5e01('0x43')](_0x28bd7a['query']);_0x3b3138[_0x5e01('0x44')]=_[_0x5e01('0x45')](_0x3b3138['model'],_0x3b3138[_0x5e01('0x42')]);_0x578d61[_0x5e01('0x46')]=_['intersection'](_0x3b3138['model'],qs[_0x5e01('0x47')](_0x28bd7a['query'][_0x5e01('0x47')]));_0x578d61[_0x5e01('0x46')]=_0x578d61[_0x5e01('0x46')][_0x5e01('0x48')]?_0x578d61['attributes']:_0x3b3138[_0x5e01('0x41')];if(!_0x28bd7a[_0x5e01('0x42')][_0x5e01('0x49')](_0x5e01('0x4a'))){_0x578d61[_0x5e01('0x4b')]=qs[_0x5e01('0x4b')](_0x28bd7a[_0x5e01('0x42')]['limit']);_0x578d61[_0x5e01('0x2f')]=qs[_0x5e01('0x2f')](_0x28bd7a[_0x5e01('0x42')][_0x5e01('0x2f')]);}_0x578d61[_0x5e01('0x4c')]=qs['sort'](_0x28bd7a[_0x5e01('0x42')][_0x5e01('0x4d')]);_0x578d61[_0x5e01('0x4e')]=qs[_0x5e01('0x44')](_[_0x5e01('0x4f')](_0x28bd7a[_0x5e01('0x42')],_0x3b3138[_0x5e01('0x44')]),_0x544899);if(_0x28bd7a['query'][_0x5e01('0x50')]){_0x578d61['where']=_[_0x5e01('0x51')](_0x578d61[_0x5e01('0x4e')],{'$or':_[_0x5e01('0x3c')](_0x544899,function(_0x310352){if(_0x310352[_0x5e01('0x52')]!==_0x5e01('0x53')){var _0x565efe={};_0x565efe[_0x310352[_0x5e01('0x39')]]={'$like':'%'+_0x28bd7a['query'][_0x5e01('0x50')]+'%'};return _0x565efe;}})});}_0x578d61=_[_0x5e01('0x51')]({},_0x578d61,_0x28bd7a[_0x5e01('0x54')]);var _0x7fc2e={'where':_0x578d61[_0x5e01('0x4e')]};return db[_0x5e01('0x3d')]['count'](_0x7fc2e)['then'](function(_0x553ae3){_0x5b3bef[_0x5e01('0x2e')]=_0x553ae3;if(_0x28bd7a[_0x5e01('0x42')][_0x5e01('0x55')]){_0x578d61[_0x5e01('0x56')]=[{'all':!![]}];}return db[_0x5e01('0x3d')][_0x5e01('0x57')](_0x578d61);})[_0x5e01('0x36')](function(_0xfd1153){_0x5b3bef[_0x5e01('0x58')]=_0xfd1153;return _0x5b3bef;})[_0x5e01('0x36')](respondWithFilteredResult(_0x260901,_0x578d61))['catch'](handleError(_0x260901,null));};exports[_0x5e01('0x59')]=function(_0x426ab8,_0x1ad300){var _0x4f6e74={'raw':!![],'where':{'id':_0x426ab8[_0x5e01('0x5a')]['id']}},_0x33416f={};_0x33416f[_0x5e01('0x41')]=_[_0x5e01('0x43')](db[_0x5e01('0x3d')]['rawAttributes']);_0x33416f[_0x5e01('0x42')]=_['keys'](_0x426ab8[_0x5e01('0x42')]);_0x33416f[_0x5e01('0x44')]=_[_0x5e01('0x45')](_0x33416f[_0x5e01('0x41')],_0x33416f[_0x5e01('0x42')]);_0x4f6e74[_0x5e01('0x46')]=_[_0x5e01('0x45')](_0x33416f[_0x5e01('0x41')],qs[_0x5e01('0x47')](_0x426ab8['query'][_0x5e01('0x47')]));_0x4f6e74[_0x5e01('0x46')]=_0x4f6e74[_0x5e01('0x46')][_0x5e01('0x48')]?_0x4f6e74[_0x5e01('0x46')]:_0x33416f[_0x5e01('0x41')];if(_0x426ab8['query'][_0x5e01('0x55')]){_0x4f6e74['include']=[{'all':!![]}];}_0x4f6e74=_[_0x5e01('0x51')]({},_0x4f6e74,_0x426ab8[_0x5e01('0x54')]);return db[_0x5e01('0x3d')]['find'](_0x4f6e74)[_0x5e01('0x36')](handleEntityNotFound(_0x1ad300,null))[_0x5e01('0x36')](respondWithResult(_0x1ad300,null))['catch'](handleError(_0x1ad300,null));};exports[_0x5e01('0x5b')]=function(_0x49fb3b,_0x6180c9){return db[_0x5e01('0x3d')][_0x5e01('0x5b')](_0x49fb3b[_0x5e01('0x5c')],{})['then'](respondWithResult(_0x6180c9,0xc9))[_0x5e01('0x29')](handleError(_0x6180c9,null));};exports['update']=function(_0x4ef450,_0x74308c){if(_0x4ef450['body']['id']){delete _0x4ef450['body']['id'];}return db[_0x5e01('0x3d')][_0x5e01('0x5d')]({'where':{'id':_0x4ef450[_0x5e01('0x5a')]['id']}})[_0x5e01('0x36')](handleEntityNotFound(_0x74308c,null))[_0x5e01('0x36')](saveUpdates(_0x4ef450[_0x5e01('0x5c')],null))[_0x5e01('0x36')](respondWithResult(_0x74308c,null))[_0x5e01('0x29')](handleError(_0x74308c,null));};exports['destroy']=function(_0x15c7bb,_0x15227c){return db['SmsMessage'][_0x5e01('0x5d')]({'where':{'id':_0x15c7bb[_0x5e01('0x5a')]['id']}})['then'](handleEntityNotFound(_0x15227c,null))[_0x5e01('0x36')](removeEntity(_0x15227c,null))[_0x5e01('0x29')](handleError(_0x15227c,null));};exports[_0x5e01('0x5e')]=function(_0x19a392,_0x21fd2d){return db['SmsMessage'][_0x5e01('0x5e')]()[_0x5e01('0x36')](respondWithResult(_0x21fd2d,null))[_0x5e01('0x29')](handleError(_0x21fd2d,null));};var interaction_log=require('../../config/logger')(_0x5e01('0x5f'));exports['accept']=function(_0x20f5be,_0x1fa6ae,_0xa3829b){var _0xb12e9={'agent':{},'channel':'sms'};if(_0x20f5be['body']['id']){delete _0x20f5be[_0x5e01('0x5c')]['id'];}_0x20f5be[_0x5e01('0x5c')]['read']=!![];_0x20f5be[_0x5e01('0x5c')][_0x5e01('0x60')]=moment()['format'](_0x5e01('0x61'));_0x20f5be[_0x5e01('0x5c')][_0x5e01('0x62')]=_0x20f5be[_0x5e01('0x5c')][_0x5e01('0x62')]||_0x20f5be['user']['id'];_0xb12e9['agent']['id']=_0x20f5be[_0x5e01('0x5c')][_0x5e01('0x62')];return db[_0x5e01('0x3d')]['find']({'where':{'id':_0x20f5be[_0x5e01('0x5a')]['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':_0x5e01('0x63')}]})[_0x5e01('0x36')](handleEntityNotFound(_0x1fa6ae,null))[_0x5e01('0x36')](saveUpdates(_0x20f5be[_0x5e01('0x5c')],null))['then'](function(_0x297058){if(_0x297058){_0xb12e9[_0x5e01('0x27')]=_0x297058[_0x5e01('0x64')]({'plain':!![]});return db['SmsInteraction']['find']({'where':{'id':_0x297058[_0x5e01('0x65')]}});}return null;})[_0x5e01('0x36')](handleEntityNotFound(_0x1fa6ae,null))['then'](function(_0x457880){if(_0x457880){return _0x457880['update']({'UserId':_0x20f5be[_0x5e01('0x5c')][_0x5e01('0x62')],'read1stAt':_[_0x5e01('0x66')](_0x457880['read1stAt'])?moment()[_0x5e01('0x67')](_0x5e01('0x61')):undefined});}return null;})[_0x5e01('0x36')](function(_0x482dbc){if(_0x482dbc){_0xb12e9[_0x5e01('0x68')]=_0x482dbc[_0x5e01('0x64')]({'plain':!![]});interaction_log[_0x5e01('0x1f')]('[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x20f5be['user']['id'],_0x20f5be[_0x5e01('0x69')]['name'],_0x20f5be[_0x5e01('0x69')][_0x5e01('0x6a')],_0xb12e9[_0x5e01('0x68')]['id'],_0x20f5be[_0x5e01('0x5c')]?JSON['stringify'](_0x20f5be['body']):_0x5e01('0x6b'));return respondWithRpcPromise('AcceptMessage','acceptMessage',_0xb12e9);}return null;})['then'](function(_0xb38f5b){return db[_0x5e01('0x6c')][_0x5e01('0x5e')]()[_0x5e01('0x36')](function(_0x396ac8){var _0x54b72e=[];for(var _0x5b7537=0x0;_0x5b7537=0x0){return _0x1a82b2[_0x5e01('0x35')]({'read':!![]});}else{logger[_0x5e01('0x25')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x5e01('0x8f'),util[_0x5e01('0x85')](_0x1485c7[_0x5e01('0x5c')],{'showHidden':![],'depth':null}));}break;case _0x5e01('0x90'):var _0x40bb81=_0x1485c7['body'][_0x5e01('0x91')][0x0];if(_0x40bb81[_0x5e01('0x2b')][_0x5e01('0x92')]==='DELIVERED'){return _0x1a82b2[_0x5e01('0x35')]({'read':!![]});}else{logger['error'](_0x5e01('0x89'),_0x5e01('0x2b'),_0x5e01('0x90'),util[_0x5e01('0x85')](_0x1485c7['body'],{'showHidden':![],'depth':null}));}break;}return _0x1a82b2;}})[_0x5e01('0x36')](respondWithResult(_0x5c4366,null))['catch'](handleError(_0x5c4366,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index c5af0e3..79be307 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 _0x92fa=['hook','events','setMaxListeners','update','remove','emit'];(function(_0x4fbee5,_0x1d4bd1){var _0x32aadd=function(_0x599525){while(--_0x599525){_0x4fbee5['push'](_0x4fbee5['shift']());}};_0x32aadd(++_0x1d4bd1);}(_0x92fa,0x10f));var _0xa92f=function(_0x188cef,_0x5f56fb){_0x188cef=_0x188cef-0x0;var _0x47b2fc=_0x92fa[_0x188cef];return _0x47b2fc;};'use strict';var EventEmitter=require(_0xa92f('0x0'));var SmsMessage=require('../../mysqldb')['db']['SmsMessage'];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0xa92f('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0xa92f('0x2'),'afterDestroy':_0xa92f('0x3')};function emitEvent(_0x3acbfb){return function(_0x5efda3,_0x1ac75e,_0x3eda2a){SmsMessageEvents[_0xa92f('0x4')](_0x3acbfb+':'+_0x5efda3['id'],_0x5efda3);SmsMessageEvents['emit'](_0x3acbfb,_0x5efda3);_0x3eda2a(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsMessage[_0xa92f('0x5')](e,emitEvent(event));}}module['exports']=SmsMessageEvents; \ No newline at end of file +var _0x6368=['exports','events','SmsMessage','setMaxListeners','save','update','emit','hasOwnProperty','hook'];(function(_0x1193eb,_0x2a1969){var _0x5507f2=function(_0x3bc111){while(--_0x3bc111){_0x1193eb['push'](_0x1193eb['shift']());}};_0x5507f2(++_0x2a1969);}(_0x6368,0x18d));var _0x8636=function(_0x423c28,_0x33e82a){_0x423c28=_0x423c28-0x0;var _0xafba93=_0x6368[_0x423c28];return _0xafba93;};'use strict';var EventEmitter=require(_0x8636('0x0'));var SmsMessage=require('../../mysqldb')['db'][_0x8636('0x1')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x8636('0x2')](0x0);var events={'afterCreate':_0x8636('0x3'),'afterUpdate':_0x8636('0x4'),'afterDestroy':'remove'};function emitEvent(_0xf8df8d){return function(_0x7adb37,_0x1fa47f,_0x4a7318){SmsMessageEvents['emit'](_0xf8df8d+':'+_0x7adb37['id'],_0x7adb37);SmsMessageEvents[_0x8636('0x5')](_0xf8df8d,_0x7adb37);_0x4a7318(null);};}for(var e in events){if(events[_0x8636('0x6')](e)){var event=events[e];SmsMessage[_0x8636('0x7')](e,emitEvent(event));}}module[_0x8636('0x8')]=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index ee95e77..8d701c7 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 _0xcffe=['clicksend','xCALLY\x20Motion','%s:%s','https://rest.clicksend.com/v3/sms/send','format','Basic\x20%s','toString','http_code','data','queued_count','message_id','clickSend','authId','remote','base64','message_uuid','plivo','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','application/json','IBSSO\x20','Missing\x20parameters:\x20base_url','csc','apiKey','login','text','keys','sort','length','createHash','md5','digest','signature=','GET','id_sms','Missing\x20parameters:\x20apiKey','uuid','clickatell','bandwidth','https://messaging.bandwidth.com/api/v2/users/','accountId','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','status','refid','Token\x20not\x20received','finally','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','SmsMessage','sms_messages','messageId','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','SmsInteraction','findOne','SmsInteractionId','update','createdAt','catch','SmsAccount','find','SmsAccountId','then','type','twilio','accountSid','phone','authToken','messages','create','/api/sms/messages/','token','sid','error','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','smsMethod','sender','login?username=','username','&password=','password','split','sms','POST','session_key','internal_order_id','deliveryReport','read','Missing\x20parameters:\x20username,\x20password','connectel','senderString','requestid','inspect'];(function(_0xe7281f,_0x2d77c3){var _0x90dc99=function(_0x1e335b){while(--_0x1e335b){_0xe7281f['push'](_0xe7281f['shift']());}};_0x90dc99(++_0x2d77c3);}(_0xcffe,0x1a1));var _0xecff=function(_0x5533b1,_0x7f4a9a){_0x5533b1=_0x5533b1-0x0;var _0x1009f3=_0xcffe[_0x5533b1];return _0x1009f3;};'use strict';var _=require(_0xecff('0x0'));var util=require(_0xecff('0x1'));var logger=require(_0xecff('0x2'))(_0xecff('0x3'));var moment=require(_0xecff('0x4'));var BPromise=require(_0xecff('0x5'));var rp=require(_0xecff('0x6'));var fs=require('fs');var path=require(_0xecff('0x7'));var rimraf=require(_0xecff('0x8'));var config=require(_0xecff('0x9'));var attributes=require('./smsMessage.attributes');module['exports']=function(_0x3020d9,_0x25572c){return _0x3020d9[_0xecff('0xa')](_0xecff('0xb'),attributes,{'tableName':_0xecff('0xc'),'paranoid':![],'indexes':[{'name':_0xecff('0xd'),'fields':[_0xecff('0xd')]},{'name':'fti_sms_messages','fields':[_0xecff('0xe')],'type':_0xecff('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x195b15,_0x20ab4f,_0x698e40){var _0x4fa444=_0x3020d9[_0xecff('0x10')];var _0x22ce83=_0x195b15[_0xecff('0x11')]({'plain':!![]});if(_0x22ce83[_0xecff('0x12')][_0xecff('0x13')]()==='in'||_0x22ce83[_0xecff('0x12')][_0xecff('0x13')]()===_0xecff('0x14')&&!_0x22ce83[_0xecff('0x15')]&&!_[_0xecff('0x16')](_0x22ce83[_0xecff('0x17')])){_0x4fa444[_0xecff('0x18')][_0xecff('0x19')]({'where':{'id':_0x22ce83[_0xecff('0x1a')]}})['then'](function(_0x4b1893){if(_0x4b1893){_0x4b1893[_0xecff('0x1b')]({'lastMsgAt':_0x22ce83[_0xecff('0x1c')],'lastMsgDirection':_0x22ce83['direction'][_0xecff('0x13')]()});}})[_0xecff('0x1d')](function(_0x3a7623){console['error'](_0x3a7623);});}if(_0x22ce83['direction']===_0xecff('0x14')&&!_0x22ce83[_0xecff('0x15')]){var _0x53ff8e;_0x4fa444[_0xecff('0x1e')][_0xecff('0x1f')]({'where':{'id':_0x22ce83[_0xecff('0x20')]},'raw':!![]})[_0xecff('0x21')](function(_0x2fc1f9){_0x53ff8e=_0x2fc1f9;if(_0x53ff8e&&_0x53ff8e[_0xecff('0x22')]){switch(_0x53ff8e['type']){case _0xecff('0x23'):var _0x422bd8=require(_0xecff('0x23'));if(_0x53ff8e[_0xecff('0x24')]&&_0x53ff8e['authToken']&&_0x53ff8e[_0xecff('0x25')]){var _0x2e2bdd=new _0x422bd8(_0x53ff8e[_0xecff('0x24')],_0x53ff8e[_0xecff('0x26')]);_0x2e2bdd[_0xecff('0x27')][_0xecff('0x28')]({'body':_0x22ce83['body'],'to':_0x22ce83[_0xecff('0x25')],'from':_0x53ff8e['phone'],'statusCallback':_0x53ff8e['remote']+_0xecff('0x29')+_0x22ce83['id']+'/status?token='+_0x53ff8e[_0xecff('0x2a')]})['then'](function(_0x389281){if(_0x389281['sid']){return _0x195b15[_0xecff('0x1b')]({'messageId':_0x389281[_0xecff('0x2b')]});}})['catch'](function(_0x9f173d){logger[_0xecff('0x2c')](_0xecff('0x2d'),_0xecff('0x2e'),_0xecff('0x23'),util['inspect'](_0x9f173d,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xecff('0x2d'),'afterCreate',_0xecff('0x23'),_0xecff('0x2f'));}break;case _0xecff('0x30'):var _0x1dfeb6='https://api.skebby.it/API/v1.0/REST/';if(_0x53ff8e['username']&&_0x53ff8e['password']){var _0x202ee0={'recipient':[_0x22ce83[_0xecff('0x25')]],'message':_0x22ce83[_0xecff('0xe')],'message_type':_0x53ff8e[_0xecff('0x31')]};if(_0x53ff8e['smsMethod']&&_0x53ff8e[_0xecff('0x31')]!=='SI'){_0x202ee0[_0xecff('0x32')]=_0x53ff8e[_0xecff('0x25')];}var _0x474d7c={'url':_0x1dfeb6+_0xecff('0x33')+_0x53ff8e[_0xecff('0x34')]+_0xecff('0x35')+_0x53ff8e[_0xecff('0x36')],'method':'GET'};rp(_0x474d7c)[_0xecff('0x21')](function(_0x350297){var _0x4ab731=_0x350297[_0xecff('0x37')](';');var _0x2921b4={'user_key':_0x4ab731[0x0],'session_key':_0x4ab731[0x1]};_0x474d7c={'url':_0x1dfeb6+_0xecff('0x38'),'method':_0xecff('0x39'),'headers':{'user_key':_0x2921b4['user_key'],'Session_key':_0x2921b4[_0xecff('0x3a')]},'json':!![],'body':_0x202ee0};return rp(_0x474d7c);})[_0xecff('0x21')](function(_0x3fe6ce){if(_0x3fe6ce['total_sent']>=0x1){var _0x46f42a={'messageId':_0x3fe6ce[_0xecff('0x3b')]};if(_0x53ff8e[_0xecff('0x31')]!=='GP'||!_0x53ff8e[_0xecff('0x3c')]){_0x46f42a[_0xecff('0x3d')]=!![];}return _0x195b15[_0xecff('0x1b')](_0x46f42a);}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xecff('0x30'),util['inspect'](_0x3fe6ce,{'showHidden':![],'depth':null}));}})[_0xecff('0x1d')](function(_0x21411b){return logger['error'](_0xecff('0x2d'),_0xecff('0x2e'),_0xecff('0x30'),util['inspect'](_0x21411b,{'showHidden':![],'depth':null}));});}else{logger[_0xecff('0x2c')](_0xecff('0x2d'),_0xecff('0x2e'),'skebby',_0xecff('0x3e'));}break;case _0xecff('0x3f'):if(_0x53ff8e[_0xecff('0x26')]){var _0x481efa={'recipient':_0x22ce83[_0xecff('0x25')],'message':_0x22ce83[_0xecff('0xe')],'sender':_0x53ff8e[_0xecff('0x40')]||_0x53ff8e[_0xecff('0x25')],'authorization':_0x53ff8e[_0xecff('0x26')]};var _0x20ab4f={'method':_0xecff('0x39'),'uri':'https://smsapi.connectel.se/api/v2/send/','body':_0x481efa,'json':!![]};rp(_0x20ab4f)[_0xecff('0x21')](function(_0x23c8f1){var _0x199019={'messageId':_0x23c8f1[_0xecff('0x41')]};if(!_0x53ff8e[_0xecff('0x3c')]){_0x199019[_0xecff('0x3d')]=!![];}return _0x195b15[_0xecff('0x1b')](_0x199019);})[_0xecff('0x1d')](function(_0x528548){logger[_0xecff('0x2c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xecff('0x2e'),_0xecff('0x3f'),util[_0xecff('0x42')](_0x528548,{'showHidden':![],'depth':null}));});}else{logger[_0xecff('0x2c')](_0xecff('0x2d'),_0xecff('0x2e'),_0xecff('0x3f'),'Missing\x20parameters:\x20authToken');}break;case _0xecff('0x43'):if(_0x53ff8e[_0xecff('0x34')]&&_0x53ff8e['password']){var _0x481efa={'messages':[{'source':_0xecff('0x44'),'to':_0x22ce83[_0xecff('0x25')],'body':_0x22ce83[_0xecff('0xe')],'from':_0x53ff8e[_0xecff('0x40')]||_0x53ff8e[_0xecff('0x25')]}]};var _0x385909=util['format'](_0xecff('0x45'),_0x53ff8e[_0xecff('0x34')],_0x53ff8e['password']);var _0x20ab4f={'method':_0xecff('0x39'),'uri':_0xecff('0x46'),'body':_0x481efa,'headers':{'Authorization':util[_0xecff('0x47')](_0xecff('0x48'),new Buffer(_0x385909)[_0xecff('0x49')]('base64'))},'json':!![]};rp(_0x20ab4f)[_0xecff('0x21')](function(_0x4fdabc){if(_0x4fdabc[_0xecff('0x4a')]>=0xc8&&_0x4fdabc['http_code']<=0xce){if(_0x4fdabc[_0xecff('0x4b')]&&_0x4fdabc[_0xecff('0x4b')][_0xecff('0x4c')]>0x0){var _0x3c73ca=_['head'](_0x4fdabc[_0xecff('0x4b')][_0xecff('0x27')]);var _0x58cdfb={'messageId':_0x3c73ca[_0xecff('0x4d')]};if(!_0x53ff8e[_0xecff('0x3c')]){_0x58cdfb['read']=!![];}return _0x195b15[_0xecff('0x1b')](_0x58cdfb);}else{logger['error'](_0xecff('0x2d'),_0xecff('0x2e'),_0xecff('0x4e'),util[_0xecff('0x42')](_0x4fdabc,{'showHidden':![],'depth':null}));}}else{logger[_0xecff('0x2c')](_0xecff('0x2d'),'afterCreate','clickSend',util[_0xecff('0x42')](_0x4fdabc,{'showHidden':![],'depth':null}));}})[_0xecff('0x1d')](function(_0x1aae95){logger[_0xecff('0x2c')](_0xecff('0x2d'),_0xecff('0x2e'),_0xecff('0x4e'),util[_0xecff('0x42')](_0x1aae95,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xecff('0x2d'),_0xecff('0x2e'),'clickSend',_0xecff('0x3e'));}break;case'plivo':if(_0x53ff8e[_0xecff('0x4f')]&&_0x53ff8e[_0xecff('0x26')]){var _0x481efa={'dst':_0x22ce83[_0xecff('0x25')],'text':_0x22ce83[_0xecff('0xe')],'src':_0x53ff8e[_0xecff('0x40')]||_0x53ff8e[_0xecff('0x25')],'url':_0x53ff8e[_0xecff('0x50')]+'/api/sms/messages/'+_0x22ce83['id']+'/status?token='+_0x53ff8e[_0xecff('0x2a')]};var _0x385909=util[_0xecff('0x47')](_0xecff('0x45'),_0x53ff8e[_0xecff('0x4f')],_0x53ff8e[_0xecff('0x26')]);var _0x20ab4f={'method':_0xecff('0x39'),'uri':util[_0xecff('0x47')]('https://api.plivo.com/v1/Account/%s/Message/',_0x53ff8e[_0xecff('0x4f')]),'body':_0x481efa,'headers':{'Authorization':util['format'](_0xecff('0x48'),new Buffer(_0x385909)[_0xecff('0x49')](_0xecff('0x51')))},'json':!![]};rp(_0x20ab4f)['then'](function(_0x2b76c2){var _0x5ebe66={'messageId':_0x2b76c2[_0xecff('0x52')][0x0]};return _0x195b15['update'](_0x5ebe66);})['catch'](function(_0x1859d3){logger['error'](_0xecff('0x2d'),_0xecff('0x2e'),'plivo',util[_0xecff('0x42')](_0x1859d3,{'showHidden':![],'depth':null}));});}else{logger[_0xecff('0x2c')](_0xecff('0x2d'),_0xecff('0x2e'),_0xecff('0x53'),_0xecff('0x54'));}break;case _0xecff('0x55'):if(_0x53ff8e[_0xecff('0x34')]&&_0x53ff8e['password']){if(_0x53ff8e[_0xecff('0x56')]){var _0x36525d={'method':_0xecff('0x39'),'uri':_0x53ff8e[_0xecff('0x56')]+_0xecff('0x57'),'body':{'username':_0x53ff8e[_0xecff('0x34')],'password':_0x53ff8e[_0xecff('0x36')]},'json':!![]};return rp(_0x36525d)[_0xecff('0x21')](function(_0x1a5555){var _0x322438={'method':_0xecff('0x39'),'uri':_0x53ff8e[_0xecff('0x56')]+_0xecff('0x58'),'body':{'messages':[{'from':_0x53ff8e[_0xecff('0x25')],'destinations':[{'to':_0x22ce83['phone']}],'text':_0x22ce83['body'],'notifyUrl':_0x53ff8e[_0xecff('0x50')]+'/api/sms/messages/'+_0x22ce83['id']+'/status?token='+_0x53ff8e[_0xecff('0x2a')],'notifyContentType':_0xecff('0x59'),'callbackData':_0x53ff8e[_0xecff('0x25')]+';'+_0x22ce83['body']}]},'headers':{'Authorization':_0xecff('0x5a')+_0x1a5555[_0xecff('0x2a')]},'json':!![]};return rp(_0x322438)[_0xecff('0x21')](function(_0x56b445){if(_0x56b445[_0xecff('0x27')]){var _0x56eefb={'messageId':_0x56b445['messages'][0x0][_0xecff('0xd')]};if(!_0x53ff8e[_0xecff('0x3c')]){_0x56eefb[_0xecff('0x3d')]=!![];}return _0x195b15[_0xecff('0x1b')](_0x56eefb);}else{return logger[_0xecff('0x2c')](_0xecff('0x2d'),_0xecff('0x2e'),_0xecff('0x55'),util[_0xecff('0x42')](_0x56b445,{'showHidden':![],'depth':null}));}});})[_0xecff('0x1d')](function(_0x1d612c){return logger[_0xecff('0x2c')](_0xecff('0x2d'),_0xecff('0x2e'),'infobip',util['inspect'](_0x1d612c,{'showHidden':![],'depth':null}));});}else{logger[_0xecff('0x2c')](_0xecff('0x2d'),'afterCreate',_0xecff('0x55'),_0xecff('0x5b'));}}else{logger['error'](_0xecff('0x2d'),_0xecff('0x2e'),_0xecff('0x55'),_0xecff('0x3e'));}break;case _0xecff('0x5c'):var _0x3a7f3c=require('crypto');if(_0x53ff8e[_0xecff('0x5d')]){var _0x385954={};_0x385954[_0xecff('0x5e')]=_0x53ff8e[_0xecff('0x34')];_0x385954[_0xecff('0x25')]=_0x22ce83['phone'];_0x385954[_0xecff('0x32')]=_0x53ff8e[_0xecff('0x25')];_0x385954[_0xecff('0x5f')]=_0x22ce83[_0xecff('0xe')];_0x385954['timestamp']=+new Date();var _0x5988c2='';var _0x4f7b93='';var _0x3882cf=Object[_0xecff('0x60')](_0x385954);_0x3882cf[_0xecff('0x61')]();for(var _0x51aaba=0x0;_0x51aaba<_0x3882cf[_0xecff('0x62')];_0x51aaba++){if(_0x5988c2!=''){_0x5988c2+='&';}_0x5988c2+=_0x3882cf[_0x51aaba]+'='+encodeURIComponent(_0x385954[_0x3882cf[_0x51aaba]]);_0x4f7b93+=_0x385954[_0x3882cf[_0x51aaba]];}_0x4f7b93+=_0x53ff8e['apiKey'];_0x4f7b93=_0x3a7f3c[_0xecff('0x63')](_0xecff('0x64'))[_0xecff('0x1b')](_0x4f7b93)[_0xecff('0x65')]('hex');if(_0x5988c2!==''){_0x5988c2+='&';}_0x5988c2+=_0xecff('0x66')+_0x4f7b93;var _0x474d7c={'method':_0xecff('0x67'),'uri':_0x53ff8e['baseUrl']+'/external/get/send.php?'+_0x5988c2,'json':!![]};return rp(_0x474d7c)[_0xecff('0x21')](function(_0x220449){var _0x5570aa=Object[_0xecff('0x60')](_0x220449);if(_0x220449[_0x5570aa[0x0]][_0xecff('0x2c')]&&parseInt(_0x220449[_0x5570aa[0x0]][_0xecff('0x2c')])===0x0){var _0xe7f2fb={'messageId':_0x220449[_0x5570aa[0x0]][_0xecff('0x68')]};if(!_0x53ff8e['deliveryReport']){_0xe7f2fb['read']=!![];}return _0x195b15[_0xecff('0x1b')](_0xe7f2fb);}else{return logger[_0xecff('0x2c')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xecff('0x5c'),util['inspect'](_0x220449[_0xecff('0x2c')],{'showHidden':![],'depth':null}));}})[_0xecff('0x1d')](function(_0x5155c1){return logger[_0xecff('0x2c')](_0xecff('0x2d'),_0xecff('0x2e'),_0xecff('0x5c'),util[_0xecff('0x42')](_0x5155c1,{'showHidden':![],'depth':null}));});}else{logger[_0xecff('0x2c')](_0xecff('0x2d'),_0xecff('0x2e'),'csc',_0xecff('0x69'));}break;case'clickatell':if(_0x53ff8e['apiKey']){var _0x2ffdc4={'method':'POST','uri':'https://platform.clickatell.com/messages','headers':{'Authorization':_0x53ff8e[_0xecff('0x5d')]},'body':{'content':_0x22ce83[_0xecff('0xe')],'to':[_0x22ce83[_0xecff('0x25')]],'from':_0x53ff8e[_0xecff('0x25')],'binary':![],'clientMessageId':_0xecff('0x6a'),'charset':'UTF-8'},'json':!![]};rp(_0x2ffdc4)[_0xecff('0x21')](function(_0x272444){if(!_0x272444[_0xecff('0x2c')]){var _0x11b000={'messageId':_0x272444[_0xecff('0x27')][0x0]['apiMessageId']};if(!_0x53ff8e[_0xecff('0x3c')]){_0x11b000[_0xecff('0x3d')]=!![];}return _0x195b15[_0xecff('0x1b')](_0x11b000);}else{return logger[_0xecff('0x2c')](_0xecff('0x2d'),'afterCreate','clickatell',util[_0xecff('0x42')](_0x272444['error'],{'showHidden':![],'depth':null}));}})['catch'](function(_0x26593b){return logger['error'](_0xecff('0x2d'),'afterCreate','clickatell',util['inspect'](_0x26593b,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xecff('0x2d'),_0xecff('0x2e'),_0xecff('0x6b'),_0xecff('0x69'));}break;case _0xecff('0x6c'):if(_0x53ff8e[_0xecff('0x34')]&&_0x53ff8e[_0xecff('0x36')]){var _0x385909=util[_0xecff('0x47')](_0xecff('0x45'),_0x53ff8e['username'],_0x53ff8e[_0xecff('0x36')]);var _0x20ab4f={'method':_0xecff('0x39'),'uri':_0xecff('0x6d')+_0x53ff8e[_0xecff('0x6e')]+'/messages','body':{'to':[_0x22ce83[_0xecff('0x25')]],'text':_0x22ce83[_0xecff('0xe')],'from':_0x53ff8e[_0xecff('0x25')],'applicationId':_0x53ff8e['applicationId']},'headers':{'Authorization':util[_0xecff('0x47')]('Basic\x20%s',new Buffer(_0x385909)[_0xecff('0x49')]('base64'))},'json':!![]};rp(_0x20ab4f)[_0xecff('0x21')](function(_0x1fd6df){if(_0x1fd6df['id']){var _0x2d934a={'messageId':_0x1fd6df['id']};return _0x195b15[_0xecff('0x1b')](_0x2d934a);}else{logger[_0xecff('0x2c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xecff('0x2e'),_0xecff('0x6c'),util['inspect'](_0x1fd6df,{'showHidden':![],'depth':null}));}})['catch'](function(_0x4306f4){logger[_0xecff('0x2c')](_0xecff('0x2d'),_0xecff('0x2e'),'bandwidth',util[_0xecff('0x42')](_0x4306f4,{'showHidden':![],'depth':null}));});}else{logger[_0xecff('0x2c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xecff('0x2e'),'bandwidth','Missing\x20parameters:\x20username,\x20password');}break;case _0xecff('0x6f'):if(_0x53ff8e['apiKey']){var _0xcf005f={};var _0x474d7c={'method':_0xecff('0x39'),'uri':_0xecff('0x70'),'headers':{'Authorization':_0xecff('0x71')+_0x53ff8e['apiKey'],'Content-Type':'application/json'},'body':{'from':_0x53ff8e['phone'],'to':_0x22ce83['phone'],'text':_0x22ce83['body']},'json':!![]};return rp(_0x474d7c)[_0xecff('0x21')](function(_0x5a1ca5){if(_0x5a1ca5[_0xecff('0x72')]==0xca){_0xcf005f[_0xecff('0x73')]=_0x5a1ca5;var _0x1ff2aa={'method':'POST','uri':_0xecff('0x74'),'headers':{'Authorization':'Bearer\x20'+_0x53ff8e['apiKey'],'Content-Type':_0xecff('0x59')},'body':{'refid':_0xcf005f[_0xecff('0x73')]['refid']},'json':!![]};return rp(_0x1ff2aa)[_0xecff('0x21')](function(_0xe7ec21){_0xcf005f[_0xecff('0x75')]=_0xe7ec21;var _0x15b2d3={'messageId':_0xcf005f[_0xecff('0x73')][_0xecff('0x76')],'read':!![]};return _0x195b15['update'](_0x15b2d3);});}else{return logger['error'](_0xecff('0x2d'),_0xecff('0x2e'),'intelepeer',util[_0xecff('0x42')](_0x5a1ca5,{'showHidden':![],'depth':null}));}})[_0xecff('0x1d')](function(_0x41a24f){return logger['error'](_0xecff('0x2d'),_0xecff('0x2e'),_0xecff('0x6f'),util[_0xecff('0x42')](_0x41a24f,{'showHidden':![],'depth':null}));});}else{return logger['error'](_0xecff('0x2d'),'afterCreate','intelepeer',_0xecff('0x77'));}break;}}})[_0xecff('0x78')](function(){_0x698e40();});}else{_0x698e40();}}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x93e7=['keys','sort','length','createHash','md5','signature=','/external/get/send.php?','id_sms','csc','clickatell','https://platform.clickatell.com/messages','UTF-8','apiMessageId','bandwidth','https://messaging.bandwidth.com/api/v2/users/','accountId','/messages','applicationId','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','application/json','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','refid','status','Token\x20not\x20received','finally','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','./smsMessage.attributes','define','sms_messages','messageId','fti_sms_messages','body','FULLTEXT','get','direction','toLowerCase','secret','isNil','UserId','SmsInteraction','findOne','SmsInteractionId','then','update','createdAt','catch','error','out','find','SmsAccountId','type','twilio','accountSid','authToken','phone','messages','create','remote','/api/sms/messages/','afterCreate','inspect','SmsMessage,\x20%s,\x20%s,\x20%s','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','password','smsMethod','&password=','GET','split','sms','POST','user_key','total_sent','deliveryReport','read','Missing\x20parameters:\x20username,\x20password','senderString','https://smsapi.connectel.se/api/v2/send/','requestid','connectel','Missing\x20parameters:\x20authToken','clicksend','username','xCALLY\x20Motion','format','%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','base64','http_code','queued_count','head','data','message_id','clickSend','plivo','authId','token','https://api.plivo.com/v1/Account/%s/Message/','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','baseUrl','/auth/1/session','/sms/2/text/advanced','IBSSO\x20','infobip','Missing\x20parameters:\x20base_url','crypto','apiKey','login','sender','text','timestamp'];(function(_0x1e2450,_0x25a0be){var _0x5d8203=function(_0x3af365){while(--_0x3af365){_0x1e2450['push'](_0x1e2450['shift']());}};_0x5d8203(++_0x25a0be);}(_0x93e7,0x9e));var _0x793e=function(_0x6a7421,_0x20b4f5){_0x6a7421=_0x6a7421-0x0;var _0x33f5d1=_0x93e7[_0x6a7421];return _0x33f5d1;};'use strict';var _=require(_0x793e('0x0'));var util=require('util');var logger=require(_0x793e('0x1'))(_0x793e('0x2'));var moment=require('moment');var BPromise=require(_0x793e('0x3'));var rp=require(_0x793e('0x4'));var fs=require('fs');var path=require(_0x793e('0x5'));var rimraf=require(_0x793e('0x6'));var config=require('../../config/environment');var attributes=require(_0x793e('0x7'));module['exports']=function(_0x336ce8,_0x58ddb4){return _0x336ce8[_0x793e('0x8')]('SmsMessage',attributes,{'tableName':_0x793e('0x9'),'paranoid':![],'indexes':[{'name':_0x793e('0xa'),'fields':[_0x793e('0xa')]},{'name':_0x793e('0xb'),'fields':[_0x793e('0xc')],'type':_0x793e('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x42b157,_0x179661,_0x3b2e68){var _0x59babb=_0x336ce8['models'];var _0x5ef3d4=_0x42b157[_0x793e('0xe')]({'plain':!![]});if(_0x5ef3d4['direction']['toLowerCase']()==='in'||_0x5ef3d4[_0x793e('0xf')][_0x793e('0x10')]()==='out'&&!_0x5ef3d4[_0x793e('0x11')]&&!_[_0x793e('0x12')](_0x5ef3d4[_0x793e('0x13')])){_0x59babb[_0x793e('0x14')][_0x793e('0x15')]({'where':{'id':_0x5ef3d4[_0x793e('0x16')]}})[_0x793e('0x17')](function(_0x3a0952){if(_0x3a0952){_0x3a0952[_0x793e('0x18')]({'lastMsgAt':_0x5ef3d4[_0x793e('0x19')],'lastMsgDirection':_0x5ef3d4[_0x793e('0xf')][_0x793e('0x10')]()});}})[_0x793e('0x1a')](function(_0x18990a){console[_0x793e('0x1b')](_0x18990a);});}if(_0x5ef3d4[_0x793e('0xf')]===_0x793e('0x1c')&&!_0x5ef3d4[_0x793e('0x11')]){var _0xeacea6;_0x59babb['SmsAccount'][_0x793e('0x1d')]({'where':{'id':_0x5ef3d4[_0x793e('0x1e')]},'raw':!![]})['then'](function(_0x4d55d4){_0xeacea6=_0x4d55d4;if(_0xeacea6&&_0xeacea6['type']){switch(_0xeacea6[_0x793e('0x1f')]){case _0x793e('0x20'):var _0xbd81fc=require(_0x793e('0x20'));if(_0xeacea6[_0x793e('0x21')]&&_0xeacea6[_0x793e('0x22')]&&_0xeacea6[_0x793e('0x23')]){var _0x9413f9=new _0xbd81fc(_0xeacea6[_0x793e('0x21')],_0xeacea6[_0x793e('0x22')]);_0x9413f9[_0x793e('0x24')][_0x793e('0x25')]({'body':_0x5ef3d4[_0x793e('0xc')],'to':_0x5ef3d4[_0x793e('0x23')],'from':_0xeacea6[_0x793e('0x23')],'statusCallback':_0xeacea6[_0x793e('0x26')]+_0x793e('0x27')+_0x5ef3d4['id']+'/status?token='+_0xeacea6['token']})[_0x793e('0x17')](function(_0x36840f){if(_0x36840f['sid']){return _0x42b157[_0x793e('0x18')]({'messageId':_0x36840f['sid']});}})['catch'](function(_0x55b37a){logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x793e('0x28'),_0x793e('0x20'),util[_0x793e('0x29')](_0x55b37a,{'showHidden':![],'depth':null}));});}else{logger[_0x793e('0x1b')](_0x793e('0x2a'),_0x793e('0x28'),_0x793e('0x20'),_0x793e('0x2b'));}break;case _0x793e('0x2c'):var _0x13f15f=_0x793e('0x2d');if(_0xeacea6['username']&&_0xeacea6[_0x793e('0x2e')]){var _0x48edff={'recipient':[_0x5ef3d4[_0x793e('0x23')]],'message':_0x5ef3d4['body'],'message_type':_0xeacea6[_0x793e('0x2f')]};if(_0xeacea6['smsMethod']&&_0xeacea6[_0x793e('0x2f')]!=='SI'){_0x48edff['sender']=_0xeacea6[_0x793e('0x23')];}var _0x2db130={'url':_0x13f15f+'login?username='+_0xeacea6['username']+_0x793e('0x30')+_0xeacea6['password'],'method':_0x793e('0x31')};rp(_0x2db130)[_0x793e('0x17')](function(_0x103396){var _0x488da4=_0x103396[_0x793e('0x32')](';');var _0x397706={'user_key':_0x488da4[0x0],'session_key':_0x488da4[0x1]};_0x2db130={'url':_0x13f15f+_0x793e('0x33'),'method':_0x793e('0x34'),'headers':{'user_key':_0x397706[_0x793e('0x35')],'Session_key':_0x397706['session_key']},'json':!![],'body':_0x48edff};return rp(_0x2db130);})[_0x793e('0x17')](function(_0x418ad3){if(_0x418ad3[_0x793e('0x36')]>=0x1){var _0x259860={'messageId':_0x418ad3['internal_order_id']};if(_0xeacea6[_0x793e('0x2f')]!=='GP'||!_0xeacea6[_0x793e('0x37')]){_0x259860[_0x793e('0x38')]=!![];}return _0x42b157[_0x793e('0x18')](_0x259860);}else{return logger[_0x793e('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x793e('0x28'),_0x793e('0x2c'),util[_0x793e('0x29')](_0x418ad3,{'showHidden':![],'depth':null}));}})[_0x793e('0x1a')](function(_0x163b89){return logger[_0x793e('0x1b')](_0x793e('0x2a'),_0x793e('0x28'),'skebby',util[_0x793e('0x29')](_0x163b89,{'showHidden':![],'depth':null}));});}else{logger[_0x793e('0x1b')](_0x793e('0x2a'),_0x793e('0x28'),_0x793e('0x2c'),_0x793e('0x39'));}break;case'connectel':if(_0xeacea6[_0x793e('0x22')]){var _0x52c417={'recipient':_0x5ef3d4[_0x793e('0x23')],'message':_0x5ef3d4[_0x793e('0xc')],'sender':_0xeacea6[_0x793e('0x3a')]||_0xeacea6[_0x793e('0x23')],'authorization':_0xeacea6[_0x793e('0x22')]};var _0x179661={'method':'POST','uri':_0x793e('0x3b'),'body':_0x52c417,'json':!![]};rp(_0x179661)[_0x793e('0x17')](function(_0x397af4){var _0x284a43={'messageId':_0x397af4[_0x793e('0x3c')]};if(!_0xeacea6[_0x793e('0x37')]){_0x284a43['read']=!![];}return _0x42b157['update'](_0x284a43);})[_0x793e('0x1a')](function(_0x1f1f98){logger[_0x793e('0x1b')](_0x793e('0x2a'),_0x793e('0x28'),_0x793e('0x3d'),util[_0x793e('0x29')](_0x1f1f98,{'showHidden':![],'depth':null}));});}else{logger[_0x793e('0x1b')](_0x793e('0x2a'),_0x793e('0x28'),_0x793e('0x3d'),_0x793e('0x3e'));}break;case _0x793e('0x3f'):if(_0xeacea6[_0x793e('0x40')]&&_0xeacea6[_0x793e('0x2e')]){var _0x52c417={'messages':[{'source':_0x793e('0x41'),'to':_0x5ef3d4[_0x793e('0x23')],'body':_0x5ef3d4[_0x793e('0xc')],'from':_0xeacea6[_0x793e('0x3a')]||_0xeacea6[_0x793e('0x23')]}]};var _0x36e924=util[_0x793e('0x42')](_0x793e('0x43'),_0xeacea6['username'],_0xeacea6[_0x793e('0x2e')]);var _0x179661={'method':'POST','uri':_0x793e('0x44'),'body':_0x52c417,'headers':{'Authorization':util[_0x793e('0x42')](_0x793e('0x45'),new Buffer(_0x36e924)[_0x793e('0x46')](_0x793e('0x47')))},'json':!![]};rp(_0x179661)[_0x793e('0x17')](function(_0x29aba1){if(_0x29aba1[_0x793e('0x48')]>=0xc8&&_0x29aba1[_0x793e('0x48')]<=0xce){if(_0x29aba1['data']&&_0x29aba1['data'][_0x793e('0x49')]>0x0){var _0x2cb71b=_[_0x793e('0x4a')](_0x29aba1[_0x793e('0x4b')]['messages']);var _0x3ce1e9={'messageId':_0x2cb71b[_0x793e('0x4c')]};if(!_0xeacea6[_0x793e('0x37')]){_0x3ce1e9[_0x793e('0x38')]=!![];}return _0x42b157['update'](_0x3ce1e9);}else{logger[_0x793e('0x1b')](_0x793e('0x2a'),_0x793e('0x28'),_0x793e('0x4d'),util[_0x793e('0x29')](_0x29aba1,{'showHidden':![],'depth':null}));}}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','clickSend',util[_0x793e('0x29')](_0x29aba1,{'showHidden':![],'depth':null}));}})[_0x793e('0x1a')](function(_0x3e8aa){logger[_0x793e('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x793e('0x28'),_0x793e('0x4d'),util[_0x793e('0x29')](_0x3e8aa,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x793e('0x2a'),'afterCreate','clickSend',_0x793e('0x39'));}break;case _0x793e('0x4e'):if(_0xeacea6[_0x793e('0x4f')]&&_0xeacea6[_0x793e('0x22')]){var _0x52c417={'dst':_0x5ef3d4[_0x793e('0x23')],'text':_0x5ef3d4[_0x793e('0xc')],'src':_0xeacea6[_0x793e('0x3a')]||_0xeacea6[_0x793e('0x23')],'url':_0xeacea6['remote']+'/api/sms/messages/'+_0x5ef3d4['id']+'/status?token='+_0xeacea6[_0x793e('0x50')]};var _0x36e924=util[_0x793e('0x42')]('%s:%s',_0xeacea6[_0x793e('0x4f')],_0xeacea6['authToken']);var _0x179661={'method':_0x793e('0x34'),'uri':util[_0x793e('0x42')](_0x793e('0x51'),_0xeacea6['authId']),'body':_0x52c417,'headers':{'Authorization':util[_0x793e('0x42')]('Basic\x20%s',new Buffer(_0x36e924)[_0x793e('0x46')]('base64'))},'json':!![]};rp(_0x179661)['then'](function(_0x445b7f){var _0x5de1ef={'messageId':_0x445b7f[_0x793e('0x52')][0x0]};return _0x42b157['update'](_0x5de1ef);})[_0x793e('0x1a')](function(_0x5ec05d){logger['error'](_0x793e('0x2a'),_0x793e('0x28'),_0x793e('0x4e'),util[_0x793e('0x29')](_0x5ec05d,{'showHidden':![],'depth':null}));});}else{logger[_0x793e('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x793e('0x4e'),_0x793e('0x53'));}break;case'infobip':if(_0xeacea6[_0x793e('0x40')]&&_0xeacea6[_0x793e('0x2e')]){if(_0xeacea6[_0x793e('0x54')]){var _0xadbe93={'method':_0x793e('0x34'),'uri':_0xeacea6[_0x793e('0x54')]+_0x793e('0x55'),'body':{'username':_0xeacea6['username'],'password':_0xeacea6[_0x793e('0x2e')]},'json':!![]};return rp(_0xadbe93)[_0x793e('0x17')](function(_0x5d3877){var _0x2af198={'method':_0x793e('0x34'),'uri':_0xeacea6[_0x793e('0x54')]+_0x793e('0x56'),'body':{'messages':[{'from':_0xeacea6[_0x793e('0x23')],'destinations':[{'to':_0x5ef3d4[_0x793e('0x23')]}],'text':_0x5ef3d4[_0x793e('0xc')],'notifyUrl':_0xeacea6[_0x793e('0x26')]+_0x793e('0x27')+_0x5ef3d4['id']+'/status?token='+_0xeacea6[_0x793e('0x50')],'notifyContentType':'application/json','callbackData':_0xeacea6[_0x793e('0x23')]+';'+_0x5ef3d4[_0x793e('0xc')]}]},'headers':{'Authorization':_0x793e('0x57')+_0x5d3877[_0x793e('0x50')]},'json':!![]};return rp(_0x2af198)['then'](function(_0x441861){if(_0x441861['messages']){var _0x13ccc4={'messageId':_0x441861[_0x793e('0x24')][0x0][_0x793e('0xa')]};if(!_0xeacea6[_0x793e('0x37')]){_0x13ccc4[_0x793e('0x38')]=!![];}return _0x42b157[_0x793e('0x18')](_0x13ccc4);}else{return logger[_0x793e('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x793e('0x28'),_0x793e('0x58'),util[_0x793e('0x29')](_0x441861,{'showHidden':![],'depth':null}));}});})[_0x793e('0x1a')](function(_0x1aabd5){return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x793e('0x28'),_0x793e('0x58'),util[_0x793e('0x29')](_0x1aabd5,{'showHidden':![],'depth':null}));});}else{logger[_0x793e('0x1b')](_0x793e('0x2a'),_0x793e('0x28'),_0x793e('0x58'),_0x793e('0x59'));}}else{logger[_0x793e('0x1b')](_0x793e('0x2a'),_0x793e('0x28'),_0x793e('0x58'),_0x793e('0x39'));}break;case'csc':var _0x6c1f29=require(_0x793e('0x5a'));if(_0xeacea6[_0x793e('0x5b')]){var _0x12301f={};_0x12301f[_0x793e('0x5c')]=_0xeacea6[_0x793e('0x40')];_0x12301f[_0x793e('0x23')]=_0x5ef3d4[_0x793e('0x23')];_0x12301f[_0x793e('0x5d')]=_0xeacea6['phone'];_0x12301f[_0x793e('0x5e')]=_0x5ef3d4[_0x793e('0xc')];_0x12301f[_0x793e('0x5f')]=+new Date();var _0x11a2a2='';var _0x3f26bf='';var _0x2f925a=Object[_0x793e('0x60')](_0x12301f);_0x2f925a[_0x793e('0x61')]();for(var _0x27aafc=0x0;_0x27aafc<_0x2f925a[_0x793e('0x62')];_0x27aafc++){if(_0x11a2a2!=''){_0x11a2a2+='&';}_0x11a2a2+=_0x2f925a[_0x27aafc]+'='+encodeURIComponent(_0x12301f[_0x2f925a[_0x27aafc]]);_0x3f26bf+=_0x12301f[_0x2f925a[_0x27aafc]];}_0x3f26bf+=_0xeacea6[_0x793e('0x5b')];_0x3f26bf=_0x6c1f29[_0x793e('0x63')](_0x793e('0x64'))[_0x793e('0x18')](_0x3f26bf)['digest']('hex');if(_0x11a2a2!==''){_0x11a2a2+='&';}_0x11a2a2+=_0x793e('0x65')+_0x3f26bf;var _0x2db130={'method':'GET','uri':_0xeacea6[_0x793e('0x54')]+_0x793e('0x66')+_0x11a2a2,'json':!![]};return rp(_0x2db130)[_0x793e('0x17')](function(_0xe5dec0){var _0x178940=Object['keys'](_0xe5dec0);if(_0xe5dec0[_0x178940[0x0]][_0x793e('0x1b')]&&parseInt(_0xe5dec0[_0x178940[0x0]]['error'])===0x0){var _0x4eb293={'messageId':_0xe5dec0[_0x178940[0x0]][_0x793e('0x67')]};if(!_0xeacea6['deliveryReport']){_0x4eb293[_0x793e('0x38')]=!![];}return _0x42b157[_0x793e('0x18')](_0x4eb293);}else{return logger[_0x793e('0x1b')](_0x793e('0x2a'),_0x793e('0x28'),_0x793e('0x68'),util[_0x793e('0x29')](_0xe5dec0[_0x793e('0x1b')],{'showHidden':![],'depth':null}));}})[_0x793e('0x1a')](function(_0x21d28f){return logger[_0x793e('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x793e('0x28'),_0x793e('0x68'),util[_0x793e('0x29')](_0x21d28f,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x793e('0x2a'),_0x793e('0x28'),_0x793e('0x68'),'Missing\x20parameters:\x20apiKey');}break;case _0x793e('0x69'):if(_0xeacea6[_0x793e('0x5b')]){var _0x42a0cc={'method':'POST','uri':_0x793e('0x6a'),'headers':{'Authorization':_0xeacea6['apiKey']},'body':{'content':_0x5ef3d4['body'],'to':[_0x5ef3d4['phone']],'from':_0xeacea6['phone'],'binary':![],'clientMessageId':'uuid','charset':_0x793e('0x6b')},'json':!![]};rp(_0x42a0cc)['then'](function(_0x50233b){if(!_0x50233b[_0x793e('0x1b')]){var _0x5e38aa={'messageId':_0x50233b[_0x793e('0x24')][0x0][_0x793e('0x6c')]};if(!_0xeacea6['deliveryReport']){_0x5e38aa[_0x793e('0x38')]=!![];}return _0x42b157['update'](_0x5e38aa);}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x793e('0x28'),_0x793e('0x69'),util['inspect'](_0x50233b[_0x793e('0x1b')],{'showHidden':![],'depth':null}));}})[_0x793e('0x1a')](function(_0x1d6b7c){return logger[_0x793e('0x1b')](_0x793e('0x2a'),_0x793e('0x28'),_0x793e('0x69'),util[_0x793e('0x29')](_0x1d6b7c,{'showHidden':![],'depth':null}));});}else{logger[_0x793e('0x1b')](_0x793e('0x2a'),_0x793e('0x28'),_0x793e('0x69'),'Missing\x20parameters:\x20apiKey');}break;case _0x793e('0x6d'):if(_0xeacea6[_0x793e('0x40')]&&_0xeacea6[_0x793e('0x2e')]){var _0x36e924=util[_0x793e('0x42')]('%s:%s',_0xeacea6['username'],_0xeacea6[_0x793e('0x2e')]);var _0x179661={'method':_0x793e('0x34'),'uri':_0x793e('0x6e')+_0xeacea6[_0x793e('0x6f')]+_0x793e('0x70'),'body':{'to':[_0x5ef3d4[_0x793e('0x23')]],'text':_0x5ef3d4[_0x793e('0xc')],'from':_0xeacea6[_0x793e('0x23')],'applicationId':_0xeacea6[_0x793e('0x71')]},'headers':{'Authorization':util[_0x793e('0x42')]('Basic\x20%s',new Buffer(_0x36e924)[_0x793e('0x46')](_0x793e('0x47')))},'json':!![]};rp(_0x179661)[_0x793e('0x17')](function(_0xe5d4db){if(_0xe5d4db['id']){var _0x3b97b3={'messageId':_0xe5d4db['id']};return _0x42b157[_0x793e('0x18')](_0x3b97b3);}else{logger['error'](_0x793e('0x2a'),_0x793e('0x28'),'bandwidth',util[_0x793e('0x29')](_0xe5d4db,{'showHidden':![],'depth':null}));}})[_0x793e('0x1a')](function(_0x3d067e){logger[_0x793e('0x1b')](_0x793e('0x2a'),_0x793e('0x28'),_0x793e('0x6d'),util[_0x793e('0x29')](_0x3d067e,{'showHidden':![],'depth':null}));});}else{logger[_0x793e('0x1b')](_0x793e('0x2a'),'afterCreate',_0x793e('0x6d'),_0x793e('0x39'));}break;case _0x793e('0x72'):if(_0xeacea6['apiKey']){var _0x493c72={};var _0x2db130={'method':'POST','uri':_0x793e('0x73'),'headers':{'Authorization':_0x793e('0x74')+_0xeacea6[_0x793e('0x5b')],'Content-Type':_0x793e('0x75')},'body':{'from':_0xeacea6[_0x793e('0x23')],'to':_0x5ef3d4[_0x793e('0x23')],'text':_0x5ef3d4[_0x793e('0xc')]},'json':!![]};return rp(_0x2db130)[_0x793e('0x17')](function(_0x1f48b8){if(_0x1f48b8[_0x793e('0x76')]==0xca){_0x493c72[_0x793e('0x77')]=_0x1f48b8;var _0xd6bf17={'method':_0x793e('0x34'),'uri':_0x793e('0x78'),'headers':{'Authorization':'Bearer\x20'+_0xeacea6[_0x793e('0x5b')],'Content-Type':_0x793e('0x75')},'body':{'refid':_0x493c72[_0x793e('0x77')][_0x793e('0x79')]},'json':!![]};return rp(_0xd6bf17)[_0x793e('0x17')](function(_0x15f0bf){_0x493c72[_0x793e('0x7a')]=_0x15f0bf;var _0x5b7f05={'messageId':_0x493c72[_0x793e('0x77')][_0x793e('0x79')],'read':!![]};return _0x42b157[_0x793e('0x18')](_0x5b7f05);});}else{return logger[_0x793e('0x1b')](_0x793e('0x2a'),'afterCreate',_0x793e('0x72'),util[_0x793e('0x29')](_0x1f48b8,{'showHidden':![],'depth':null}));}})[_0x793e('0x1a')](function(_0x416916){return logger['error'](_0x793e('0x2a'),_0x793e('0x28'),_0x793e('0x72'),util[_0x793e('0x29')](_0x416916,{'showHidden':![],'depth':null}));});}else{return logger[_0x793e('0x1b')](_0x793e('0x2a'),_0x793e('0x28'),_0x793e('0x72'),_0x793e('0x7b'));}break;}}})[_0x793e('0x7c')](function(){_0x3b2e68();});}else{_0x3b2e68();}}},'charset':_0x793e('0x7d'),'collate':_0x793e('0x7e')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index 24288bf..17a4a84 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 _0xd244=['info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','CreateSmsMessage','SmsMessage','create','options','raw','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','register','request','then'];(function(_0x5c5e92,_0x1e3133){var _0x266316=function(_0x3aa06e){while(--_0x3aa06e){_0x5c5e92['push'](_0x5c5e92['shift']());}};_0x266316(++_0x1e3133);}(_0xd244,0x9b));var _0x4d24=function(_0x515afd,_0x1a1e91){_0x515afd=_0x515afd-0x0;var _0x536d53=_0xd244[_0x515afd];return _0x536d53;};'use strict';var _=require(_0x4d24('0x0'));var util=require('util');var moment=require(_0x4d24('0x1'));var BPromise=require(_0x4d24('0x2'));var rs=require(_0x4d24('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4d24('0x4'))['db'];var utils=require(_0x4d24('0x5'));var logger=require(_0x4d24('0x6'))(_0x4d24('0x7'));var config=require(_0x4d24('0x8'));var jayson=require(_0x4d24('0x9'));var client=jayson[_0x4d24('0xa')][_0x4d24('0xb')]({'port':0x232a});config[_0x4d24('0xc')]=_[_0x4d24('0xd')](config[_0x4d24('0xc')],{'host':_0x4d24('0xe'),'port':0x18eb});var socket=require(_0x4d24('0xf'))(new Redis(config[_0x4d24('0xc')]));require(_0x4d24('0x10'))[_0x4d24('0x11')](socket);function respondWithRpcPromise(_0x38122c,_0x180954,_0x1baa11){return new BPromise(function(_0x5c6a6f,_0x34367d){return client[_0x4d24('0x12')](_0x38122c,_0x1baa11)[_0x4d24('0x13')](function(_0x3b9928){logger[_0x4d24('0x14')](_0x4d24('0x15'),_0x180954,_0x4d24('0x16'));logger[_0x4d24('0x17')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x180954,'request\x20sent',JSON[_0x4d24('0x18')](_0x3b9928));if(_0x3b9928['error']){if(_0x3b9928[_0x4d24('0x19')][_0x4d24('0x1a')]===0x1f4){logger['error'](_0x4d24('0x15'),_0x180954,_0x3b9928[_0x4d24('0x19')][_0x4d24('0x1b')]);return _0x34367d(_0x3b9928[_0x4d24('0x19')][_0x4d24('0x1b')]);}logger[_0x4d24('0x19')](_0x4d24('0x15'),_0x180954,_0x3b9928[_0x4d24('0x19')][_0x4d24('0x1b')]);return _0x5c6a6f(_0x3b9928[_0x4d24('0x19')][_0x4d24('0x1b')]);}else{logger[_0x4d24('0x14')](_0x4d24('0x15'),_0x180954,'request\x20sent');_0x5c6a6f(_0x3b9928[_0x4d24('0x1c')][_0x4d24('0x1b')]);}})[_0x4d24('0x1d')](function(_0x26c818){logger[_0x4d24('0x19')](_0x4d24('0x15'),_0x180954,_0x26c818);_0x34367d(_0x26c818);});});}exports[_0x4d24('0x1e')]=function(_0x289360){var _0x4c0952=this;return new Promise(function(_0x15f6a0,_0x2c7c9e){return db[_0x4d24('0x1f')][_0x4d24('0x20')](_0x289360['body'],{'raw':_0x289360[_0x4d24('0x21')]?_0x289360[_0x4d24('0x21')][_0x4d24('0x22')]===undefined?!![]:![]:!![]})[_0x4d24('0x13')](function(_0x4cd5f5){logger[_0x4d24('0x14')](_0x4d24('0x1e'),_0x289360);logger[_0x4d24('0x17')](_0x4d24('0x1e'),_0x289360,JSON['stringify'](_0x4cd5f5));_0x15f6a0(_0x4cd5f5);})['catch'](function(_0x548faf){logger[_0x4d24('0x19')]('CreateSmsMessage',_0x548faf[_0x4d24('0x1b')],_0x289360);_0x2c7c9e(_0x4c0952[_0x4d24('0x19')](0x1f4,_0x548faf['message']));});});}; \ No newline at end of file +var _0x1392=['localhost','socket.io-emitter','./smsMessage.socket','register','request','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','code','error','message','result','catch','CreateSmsMessage','SmsMessage','create','body','options','raw','lodash','util','bluebird','randomstring','ioredis','../../config/utils','rpc','jayson/promise','http','redis','defaults'];(function(_0x648c3c,_0x519358){var _0x250a10=function(_0x31ee80){while(--_0x31ee80){_0x648c3c['push'](_0x648c3c['shift']());}};_0x250a10(++_0x519358);}(_0x1392,0x12b));var _0x2139=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x1392[_0x413feb];return _0x40ee88;};'use strict';var _=require(_0x2139('0x0'));var util=require(_0x2139('0x1'));var moment=require('moment');var BPromise=require(_0x2139('0x2'));var rs=require(_0x2139('0x3'));var fs=require('fs');var Redis=require(_0x2139('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2139('0x5'));var logger=require('../../config/logger')(_0x2139('0x6'));var config=require('../../config/environment');var jayson=require(_0x2139('0x7'));var client=jayson['client'][_0x2139('0x8')]({'port':0x232a});config[_0x2139('0x9')]=_[_0x2139('0xa')](config[_0x2139('0x9')],{'host':_0x2139('0xb'),'port':0x18eb});var socket=require(_0x2139('0xc'))(new Redis(config[_0x2139('0x9')]));require(_0x2139('0xd'))[_0x2139('0xe')](socket);function respondWithRpcPromise(_0x43c930,_0x497fa5,_0x1d6bd0){return new BPromise(function(_0x35e109,_0x489afd){return client[_0x2139('0xf')](_0x43c930,_0x1d6bd0)['then'](function(_0x3760ca){logger[_0x2139('0x10')](_0x2139('0x11'),_0x497fa5,_0x2139('0x12'));logger[_0x2139('0x13')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x497fa5,'request\x20sent',JSON['stringify'](_0x3760ca));if(_0x3760ca['error']){if(_0x3760ca['error'][_0x2139('0x14')]===0x1f4){logger['error'](_0x2139('0x11'),_0x497fa5,_0x3760ca[_0x2139('0x15')]['message']);return _0x489afd(_0x3760ca[_0x2139('0x15')]['message']);}logger[_0x2139('0x15')](_0x2139('0x11'),_0x497fa5,_0x3760ca[_0x2139('0x15')][_0x2139('0x16')]);return _0x35e109(_0x3760ca[_0x2139('0x15')][_0x2139('0x16')]);}else{logger[_0x2139('0x10')]('SmsMessage,\x20%s,\x20%s',_0x497fa5,_0x2139('0x12'));_0x35e109(_0x3760ca[_0x2139('0x17')]['message']);}})[_0x2139('0x18')](function(_0x900a12){logger[_0x2139('0x15')]('SmsMessage,\x20%s,\x20%s',_0x497fa5,_0x900a12);_0x489afd(_0x900a12);});});}exports[_0x2139('0x19')]=function(_0x75277e){var _0x5c67df=this;return new Promise(function(_0x81172f,_0x189d65){return db[_0x2139('0x1a')][_0x2139('0x1b')](_0x75277e[_0x2139('0x1c')],{'raw':_0x75277e[_0x2139('0x1d')]?_0x75277e[_0x2139('0x1d')][_0x2139('0x1e')]===undefined?!![]:![]:!![]})['then'](function(_0x3e5992){logger[_0x2139('0x10')]('CreateSmsMessage',_0x75277e);logger[_0x2139('0x13')](_0x2139('0x19'),_0x75277e,JSON['stringify'](_0x3e5992));_0x81172f(_0x3e5992);})[_0x2139('0x18')](function(_0x2fd25f){logger['error'](_0x2139('0x19'),_0x2fd25f[_0x2139('0x16')],_0x75277e);_0x189d65(_0x5c67df[_0x2139('0x15')](0x1f4,_0x2fd25f['message']));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index b480783..6937e68 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 _0x6084=['save','remove','update','emit','removeListener','register','smsMessage:','./smsMessage.events'];(function(_0x2e78db,_0x5ab8a1){var _0x195fb4=function(_0x4d24f3){while(--_0x4d24f3){_0x2e78db['push'](_0x2e78db['shift']());}};_0x195fb4(++_0x5ab8a1);}(_0x6084,0x1bf));var _0x4608=function(_0x3c88e2,_0x1567d9){_0x3c88e2=_0x3c88e2-0x0;var _0x2c8185=_0x6084[_0x3c88e2];return _0x2c8185;};'use strict';var SmsMessageEvents=require(_0x4608('0x0'));var events=[_0x4608('0x1'),_0x4608('0x2'),_0x4608('0x3')];function createListener(_0x437c74,_0x29d10e){return function(_0x223719){_0x29d10e[_0x4608('0x4')](_0x437c74,_0x223719);};}function removeListener(_0x365077,_0x363a10){return function(){SmsMessageEvents[_0x4608('0x5')](_0x365077,_0x363a10);};}exports[_0x4608('0x6')]=function(_0x48c7b4){for(var _0xf6b72d=0x0,_0x1489c2=events['length'];_0xf6b72d<_0x1489c2;_0xf6b72d++){var _0x5be4e4=events[_0xf6b72d];var _0x14e20a=createListener(_0x4608('0x7')+_0x5be4e4,_0x48c7b4);SmsMessageEvents['on'](_0x5be4e4,_0x14e20a);}}; \ No newline at end of file +var _0x0558=['length','smsMessage:','remove','emit','removeListener','register'];(function(_0x422311,_0x54125c){var _0x356858=function(_0x283a0f){while(--_0x283a0f){_0x422311['push'](_0x422311['shift']());}};_0x356858(++_0x54125c);}(_0x0558,0xe6));var _0x8055=function(_0x289a67,_0x1e5a3c){_0x289a67=_0x289a67-0x0;var _0x572b49=_0x0558[_0x289a67];return _0x572b49;};'use strict';var SmsMessageEvents=require('./smsMessage.events');var events=['save',_0x8055('0x0'),'update'];function createListener(_0x5e4577,_0x505b69){return function(_0x462498){_0x505b69[_0x8055('0x1')](_0x5e4577,_0x462498);};}function removeListener(_0x23cead,_0x4bd6f1){return function(){SmsMessageEvents[_0x8055('0x2')](_0x23cead,_0x4bd6f1);};}exports[_0x8055('0x3')]=function(_0x2b56e7){for(var _0x3efe25=0x0,_0x190aec=events[_0x8055('0x4')];_0x3efe25<_0x190aec;_0x3efe25++){var _0x92d869=events[_0x3efe25];var _0x495565=createListener(_0x8055('0x5')+_0x92d869,_0x2b56e7);SmsMessageEvents['on'](_0x92d869,_0x495565);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index 02ab270..5581c43 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 _0xaf23=['isAuthenticated','describe','get','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','post','addTeams','addAgents','put','update','delete','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./smsQueue.controller','index'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xaf23,0x118));var _0x3af2=function(_0x218b53,_0x7fc544){_0x218b53=_0x218b53-0x0;var _0x4ea4aa=_0xaf23[_0x218b53];return _0x4ea4aa;};'use strict';var multer=require(_0x3af2('0x0'));var util=require(_0x3af2('0x1'));var path=require(_0x3af2('0x2'));var timeout=require(_0x3af2('0x3'));var express=require(_0x3af2('0x4'));var router=express[_0x3af2('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x3af2('0x6'));var config=require(_0x3af2('0x7'));var controller=require(_0x3af2('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x3af2('0x9')]);router['get']('/describe',auth[_0x3af2('0xa')](),controller[_0x3af2('0xb')]);router[_0x3af2('0xc')](_0x3af2('0xd'),auth[_0x3af2('0xa')](),controller[_0x3af2('0xe')]);router[_0x3af2('0xc')](_0x3af2('0xf'),auth['isAuthenticated'](),controller[_0x3af2('0x10')]);router[_0x3af2('0xc')](_0x3af2('0x11'),auth['isAuthenticated'](),controller[_0x3af2('0x12')]);router[_0x3af2('0xc')](_0x3af2('0x13'),auth[_0x3af2('0xa')](),controller['getAgents']);router[_0x3af2('0x14')]('/',auth[_0x3af2('0xa')](),controller['create']);router[_0x3af2('0x14')](_0x3af2('0x11'),auth['isAuthenticated'](),controller[_0x3af2('0x15')]);router[_0x3af2('0x14')]('/:id/users',auth[_0x3af2('0xa')](),controller[_0x3af2('0x16')]);router[_0x3af2('0x17')](_0x3af2('0xd'),auth[_0x3af2('0xa')](),controller[_0x3af2('0x18')]);router[_0x3af2('0x19')]('/:id',auth[_0x3af2('0xa')](),controller['destroy']);router[_0x3af2('0x19')](_0x3af2('0x11'),auth[_0x3af2('0xa')](),controller[_0x3af2('0x1a')]);router['delete']('/:id/users',auth[_0x3af2('0xa')](),controller[_0x3af2('0x1b')]);module[_0x3af2('0x1c')]=router; \ No newline at end of file +var _0xb5b8=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsQueue.controller','get','isAuthenticated','/describe','/:id','/:id/members','getMembers','getTeams','/:id/users','getAgents','post','/:id/teams','addTeams','put','update','delete','destroy','exports','multer'];(function(_0x351463,_0x35ceca){var _0x4b73ef=function(_0x531e17){while(--_0x531e17){_0x351463['push'](_0x351463['shift']());}};_0x4b73ef(++_0x35ceca);}(_0xb5b8,0x103));var _0x8b5b=function(_0x2afd77,_0x33858d){_0x2afd77=_0x2afd77-0x0;var _0x20438c=_0xb5b8[_0x2afd77];return _0x20438c;};'use strict';var multer=require(_0x8b5b('0x0'));var util=require('util');var path=require(_0x8b5b('0x1'));var timeout=require(_0x8b5b('0x2'));var express=require(_0x8b5b('0x3'));var router=express[_0x8b5b('0x4')]();var fs_extra=require(_0x8b5b('0x5'));var auth=require(_0x8b5b('0x6'));var interaction=require(_0x8b5b('0x7'));var config=require('../../config/environment');var controller=require(_0x8b5b('0x8'));router[_0x8b5b('0x9')]('/',auth[_0x8b5b('0xa')](),controller['index']);router[_0x8b5b('0x9')](_0x8b5b('0xb'),auth['isAuthenticated'](),controller['describe']);router['get'](_0x8b5b('0xc'),auth[_0x8b5b('0xa')](),controller['show']);router['get'](_0x8b5b('0xd'),auth[_0x8b5b('0xa')](),controller[_0x8b5b('0xe')]);router['get']('/:id/teams',auth[_0x8b5b('0xa')](),controller[_0x8b5b('0xf')]);router[_0x8b5b('0x9')](_0x8b5b('0x10'),auth['isAuthenticated'](),controller[_0x8b5b('0x11')]);router[_0x8b5b('0x12')]('/',auth[_0x8b5b('0xa')](),controller['create']);router[_0x8b5b('0x12')](_0x8b5b('0x13'),auth[_0x8b5b('0xa')](),controller[_0x8b5b('0x14')]);router[_0x8b5b('0x12')](_0x8b5b('0x10'),auth[_0x8b5b('0xa')](),controller['addAgents']);router[_0x8b5b('0x15')](_0x8b5b('0xc'),auth[_0x8b5b('0xa')](),controller[_0x8b5b('0x16')]);router[_0x8b5b('0x17')]('/:id',auth['isAuthenticated'](),controller[_0x8b5b('0x18')]);router[_0x8b5b('0x17')](_0x8b5b('0x13'),auth[_0x8b5b('0xa')](),controller['removeTeams']);router[_0x8b5b('0x17')](_0x8b5b('0x10'),auth[_0x8b5b('0xa')](),controller['removeAgents']);module[_0x8b5b('0x19')]=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index bd4ebc3..c400c35 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 _0xef78=['name','ENUM','beepall','roundrobin','sequelize','exports','STRING'];(function(_0x404ec8,_0x4a2a93){var _0x587a73=function(_0x52bb26){while(--_0x52bb26){_0x404ec8['push'](_0x404ec8['shift']());}};_0x587a73(++_0x4a2a93);}(_0xef78,0x1e0));var _0x8ef7=function(_0x21bac7,_0x4ab11b){_0x21bac7=_0x21bac7-0x0;var _0x433e8d=_0xef78[_0x21bac7];return _0x433e8d;};'use strict';var Sequelize=require(_0x8ef7('0x0'));module[_0x8ef7('0x1')]={'name':{'type':Sequelize[_0x8ef7('0x2')],'unique':_0x8ef7('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x8ef7('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x8ef7('0x4')]('rrmemory',_0x8ef7('0x5'),_0x8ef7('0x6'))}}; \ No newline at end of file +var _0xed70=['rrmemory','beepall','roundrobin','sequelize','exports','STRING','INTEGER','ENUM'];(function(_0x56e649,_0x86072){var _0x4b1802=function(_0x502154){while(--_0x502154){_0x56e649['push'](_0x56e649['shift']());}};_0x4b1802(++_0x86072);}(_0xed70,0x153));var _0x0ed7=function(_0x16154d,_0x334acf){_0x16154d=_0x16154d-0x0;var _0x5c4964=_0xed70[_0x16154d];return _0x5c4964;};'use strict';var Sequelize=require(_0x0ed7('0x0'));module[_0x0ed7('0x1')]={'name':{'type':Sequelize[_0x0ed7('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x0ed7('0x2')]},'timeout':{'type':Sequelize[_0x0ed7('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x0ed7('0x4')](_0x0ed7('0x5'),_0x0ed7('0x6'),_0x0ed7('0x7'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index 763044f..71aa832 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 _0xa54b=['findOne','UserSmsQueue','SmsQueueId','findAll','findAndCountAll','UserId','agent','updatedAt','createdAt','format','SIP','getTeams','Team','sort','ids','voicePause','interface','sequelize','transaction','addTeams','each','findOrCreate','forEach','userSmsQueue:save','removeTeams','Agents','select','field','tq.TeamId','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','clone','push','SELECT','TeamId','all','union','compact','value','isEmpty','removeAgents','emit','userSmsQueue:remove','addAgents','isArray','getAgents','User','rimraf','zip-dir','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','register','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','get','SmsQueues','UserProfileResource','destroy','end','SmsQueue','rawAttributes','type','model','map','name','keys','filters','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','order','where','pick','filter','includeAll','include','rows','catch','show','params','merge','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','error','describe','getMembers'];(function(_0x327c88,_0x16d923){var _0x1d9e4e=function(_0x18d800){while(--_0x18d800){_0x327c88['push'](_0x327c88['shift']());}};_0x1d9e4e(++_0x16d923);}(_0xa54b,0xb7));var _0xba54=function(_0x4e840e,_0x5a44c1){_0x4e840e=_0x4e840e-0x0;var _0x44f805=_0xa54b[_0x4e840e];return _0x44f805;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xba54('0x0'));var zipdir=require(_0xba54('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xba54('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xba54('0x3'));var util=require(_0xba54('0x4'));var path=require(_0xba54('0x5'));var sox=require(_0xba54('0x6'));var csv=require(_0xba54('0x7'));var ejs=require(_0xba54('0x8'));var fs=require('fs');var fs_extra=require(_0xba54('0x9'));var _=require(_0xba54('0xa'));var squel=require(_0xba54('0xb'));var crypto=require(_0xba54('0xc'));var jsforce=require(_0xba54('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xba54('0xe'));var Papa=require(_0xba54('0xf'));var Redis=require(_0xba54('0x10'));var authService=require(_0xba54('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xba54('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xba54('0x13'))('api');var utils=require(_0xba54('0x14'));var config=require(_0xba54('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xba54('0x16'))['db'];config[_0xba54('0x17')]=_[_0xba54('0x18')](config[_0xba54('0x17')],{'host':_0xba54('0x19'),'port':0x18eb});var socket=require(_0xba54('0x1a'))(new Redis(config['redis']));require(_0xba54('0x1b'))[_0xba54('0x1c')](socket);function respondWithStatusCode(_0x19ff40,_0x2c3591){_0x2c3591=_0x2c3591||0xcc;return function(_0x2a26da){if(_0x2a26da){return _0x19ff40[_0xba54('0x1d')](_0x2c3591);}return _0x19ff40[_0xba54('0x1e')](_0x2c3591)['end']();};}function respondWithResult(_0x1f8f52,_0x5e0b0f){_0x5e0b0f=_0x5e0b0f||0xc8;return function(_0x408dc7){if(_0x408dc7){return _0x1f8f52[_0xba54('0x1e')](_0x5e0b0f)[_0xba54('0x1f')](_0x408dc7);}};}function respondWithFilteredResult(_0x18d8d6,_0x140a2c){return function(_0x429463){if(_0x429463){var _0x46fe11=typeof _0x140a2c[_0xba54('0x20')]===_0xba54('0x21')&&typeof _0x140a2c[_0xba54('0x22')]===_0xba54('0x21');var _0x26a8d7=_0x429463[_0xba54('0x23')];var _0x417ed5=_0x46fe11?0x0:_0x140a2c[_0xba54('0x20')];var _0x532913=_0x46fe11?_0x429463[_0xba54('0x23')]:_0x140a2c[_0xba54('0x20')]+_0x140a2c[_0xba54('0x22')];var _0x4ef011;if(_0x532913>=_0x26a8d7){_0x532913=_0x26a8d7;_0x4ef011=0xc8;}else{_0x4ef011=0xce;}_0x18d8d6[_0xba54('0x1e')](_0x4ef011);return _0x18d8d6[_0xba54('0x24')]('Content-Range',_0x417ed5+'-'+_0x532913+'/'+_0x26a8d7)['json'](_0x429463);}return null;};}function patchUpdates(_0x15e780){return function(_0x1540ef){try{jsonpatch[_0xba54('0x25')](_0x1540ef,_0x15e780,!![]);}catch(_0x1f9c82){return BPromise[_0xba54('0x26')](_0x1f9c82);}return _0x1540ef[_0xba54('0x27')]();};}function saveUpdates(_0x3855fb,_0x4de085){return function(_0x598c2f){if(_0x598c2f){return _0x598c2f[_0xba54('0x28')](_0x3855fb)[_0xba54('0x29')](function(_0x37ff3c){return _0x37ff3c;});}return null;};}function removeEntity(_0x3e182b,_0x2e1ef1){return function(_0xee862e){if(_0xee862e){return _0xee862e['destroy']()[_0xba54('0x29')](function(){var _0x39c736=_0xee862e[_0xba54('0x2a')]({'plain':!![]});var _0x28bd26=_0xba54('0x2b');return db[_0xba54('0x2c')][_0xba54('0x2d')]({'where':{'type':_0x28bd26,'resourceId':_0x39c736['id']}})[_0xba54('0x29')](function(){return _0xee862e;});})['then'](function(){_0x3e182b[_0xba54('0x1e')](0xcc)[_0xba54('0x2e')]();});}};}function handleEntityNotFound(_0x9255f5,_0x55ac0c){return function(_0x256426){if(!_0x256426){_0x9255f5[_0xba54('0x1d')](0x194);}return _0x256426;};}function handleError(_0x5a6656,_0x531a14){_0x531a14=_0x531a14||0x1f4;return function(_0x3dddc8){logger['error'](_0x3dddc8['stack']);if(_0x3dddc8['name']){delete _0x3dddc8['name'];}_0x5a6656[_0xba54('0x1e')](_0x531a14)['send'](_0x3dddc8);};}exports['index']=function(_0x45c60d,_0x18c962){var _0x2bdaf0={},_0x38915b={},_0x4fbac2={'count':0x0,'rows':[]};var _0x4d3fe2=_['map'](db[_0xba54('0x2f')][_0xba54('0x30')],function(_0x1c3d28){return{'name':_0x1c3d28['fieldName'],'type':_0x1c3d28[_0xba54('0x31')]['key']};});_0x38915b[_0xba54('0x32')]=_[_0xba54('0x33')](_0x4d3fe2,_0xba54('0x34'));_0x38915b['query']=_[_0xba54('0x35')](_0x45c60d['query']);_0x38915b[_0xba54('0x36')]=_[_0xba54('0x37')](_0x38915b[_0xba54('0x32')],_0x38915b[_0xba54('0x38')]);_0x2bdaf0['attributes']=_[_0xba54('0x37')](_0x38915b[_0xba54('0x32')],qs[_0xba54('0x39')](_0x45c60d['query'][_0xba54('0x39')]));_0x2bdaf0['attributes']=_0x2bdaf0[_0xba54('0x3a')][_0xba54('0x3b')]?_0x2bdaf0[_0xba54('0x3a')]:_0x38915b[_0xba54('0x32')];if(!_0x45c60d['query'][_0xba54('0x3c')](_0xba54('0x3d'))){_0x2bdaf0[_0xba54('0x22')]=qs[_0xba54('0x22')](_0x45c60d['query'][_0xba54('0x22')]);_0x2bdaf0[_0xba54('0x20')]=qs[_0xba54('0x20')](_0x45c60d[_0xba54('0x38')][_0xba54('0x20')]);}_0x2bdaf0[_0xba54('0x3e')]=qs['sort'](_0x45c60d[_0xba54('0x38')]['sort']);_0x2bdaf0[_0xba54('0x3f')]=qs[_0xba54('0x36')](_[_0xba54('0x40')](_0x45c60d[_0xba54('0x38')],_0x38915b[_0xba54('0x36')]),_0x4d3fe2);if(_0x45c60d[_0xba54('0x38')][_0xba54('0x41')]){_0x2bdaf0[_0xba54('0x3f')]=_['merge'](_0x2bdaf0[_0xba54('0x3f')],{'$or':_[_0xba54('0x33')](_0x4d3fe2,function(_0x4f4151){if(_0x4f4151[_0xba54('0x31')]!=='VIRTUAL'){var _0x207631={};_0x207631[_0x4f4151[_0xba54('0x34')]]={'$like':'%'+_0x45c60d[_0xba54('0x38')][_0xba54('0x41')]+'%'};return _0x207631;}})});}_0x2bdaf0=_['merge']({},_0x2bdaf0,_0x45c60d['options']);var _0x3c5355={'where':_0x2bdaf0['where']};return db['SmsQueue'][_0xba54('0x23')](_0x3c5355)[_0xba54('0x29')](function(_0x9eabf){_0x4fbac2['count']=_0x9eabf;if(_0x45c60d[_0xba54('0x38')][_0xba54('0x42')]){_0x2bdaf0[_0xba54('0x43')]=[{'all':!![]}];}return db['SmsQueue']['findAll'](_0x2bdaf0);})[_0xba54('0x29')](function(_0x3002b3){_0x4fbac2[_0xba54('0x44')]=_0x3002b3;return _0x4fbac2;})[_0xba54('0x29')](respondWithFilteredResult(_0x18c962,_0x2bdaf0))[_0xba54('0x45')](handleError(_0x18c962,null));};exports[_0xba54('0x46')]=function(_0x12ef6f,_0x2ee5ab){var _0x101923={'raw':!![],'where':{'id':_0x12ef6f[_0xba54('0x47')]['id']}},_0x1a197e={};_0x1a197e[_0xba54('0x32')]=_[_0xba54('0x35')](db[_0xba54('0x2f')][_0xba54('0x30')]);_0x1a197e[_0xba54('0x38')]=_[_0xba54('0x35')](_0x12ef6f[_0xba54('0x38')]);_0x1a197e['filters']=_[_0xba54('0x37')](_0x1a197e[_0xba54('0x32')],_0x1a197e['query']);_0x101923['attributes']=_[_0xba54('0x37')](_0x1a197e[_0xba54('0x32')],qs[_0xba54('0x39')](_0x12ef6f['query']['fields']));_0x101923[_0xba54('0x3a')]=_0x101923[_0xba54('0x3a')]['length']?_0x101923[_0xba54('0x3a')]:_0x1a197e[_0xba54('0x32')];if(_0x12ef6f[_0xba54('0x38')][_0xba54('0x42')]){_0x101923[_0xba54('0x43')]=[{'all':!![]}];}_0x101923=_[_0xba54('0x48')]({},_0x101923,_0x12ef6f[_0xba54('0x49')]);return db[_0xba54('0x2f')]['find'](_0x101923)[_0xba54('0x29')](handleEntityNotFound(_0x2ee5ab,null))[_0xba54('0x29')](respondWithResult(_0x2ee5ab,null))[_0xba54('0x45')](handleError(_0x2ee5ab,null));};exports[_0xba54('0x4a')]=function(_0x5a4129,_0x3cf1e4){return db[_0xba54('0x2f')][_0xba54('0x4a')](_0x5a4129[_0xba54('0x4b')],{})[_0xba54('0x29')](function(_0x22f24a){var _0x191feb=_0x5a4129[_0xba54('0x4c')][_0xba54('0x2a')]({'plain':!![]});if(!_0x191feb)throw new Error(_0xba54('0x4d'));if(_0x191feb[_0xba54('0x4e')]==='user'){var _0x47052b=_0x22f24a[_0xba54('0x2a')]({'plain':!![]});var _0x5be5f3='SmsQueues';return db[_0xba54('0x4f')][_0xba54('0x50')]({'where':{'name':_0x5be5f3,'userProfileId':_0x191feb[_0xba54('0x51')]},'raw':!![]})[_0xba54('0x29')](function(_0x39034c){if(_0x39034c&&_0x39034c['autoAssociation']===0x0){return db[_0xba54('0x2c')][_0xba54('0x4a')]({'name':_0x47052b['name'],'resourceId':_0x47052b['id'],'type':_0x39034c[_0xba54('0x34')],'sectionId':_0x39034c['id']},{})[_0xba54('0x29')](function(){return _0x22f24a;});}else{return _0x22f24a;}})[_0xba54('0x45')](function(_0xb32ede){logger[_0xba54('0x52')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xb32ede);throw _0xb32ede;});}return _0x22f24a;})[_0xba54('0x29')](respondWithResult(_0x3cf1e4,0xc9))[_0xba54('0x45')](handleError(_0x3cf1e4,null));};exports[_0xba54('0x28')]=function(_0x208828,_0x8e984c){if(_0x208828[_0xba54('0x4b')]['id']){delete _0x208828['body']['id'];}return db[_0xba54('0x2f')]['find']({'where':{'id':_0x208828[_0xba54('0x47')]['id']}})[_0xba54('0x29')](handleEntityNotFound(_0x8e984c,null))[_0xba54('0x29')](saveUpdates(_0x208828['body'],null))[_0xba54('0x29')](respondWithResult(_0x8e984c,null))['catch'](handleError(_0x8e984c,null));};exports[_0xba54('0x2d')]=function(_0x2f489b,_0x1ae39c){return db[_0xba54('0x2f')][_0xba54('0x50')]({'where':{'id':_0x2f489b[_0xba54('0x47')]['id']}})[_0xba54('0x29')](handleEntityNotFound(_0x1ae39c,null))[_0xba54('0x29')](removeEntity(_0x1ae39c,null))[_0xba54('0x45')](handleError(_0x1ae39c,null));};exports[_0xba54('0x53')]=function(_0x253eec,_0x533391){return db[_0xba54('0x2f')][_0xba54('0x53')]()[_0xba54('0x29')](respondWithResult(_0x533391,null))['catch'](handleError(_0x533391,null));};exports[_0xba54('0x54')]=function(_0x29124a,_0x2c7f19,_0x349351){var _0x56f7bb={'raw':!![],'where':{}},_0x8c783d={},_0x2137f6;return db[_0xba54('0x2f')][_0xba54('0x55')]({'where':{'id':_0x29124a[_0xba54('0x47')]['id']}})['then'](handleEntityNotFound(_0x2c7f19,null))[_0xba54('0x29')](function(_0x5c66b4){if(_0x5c66b4){_0x2137f6=_0x5c66b4[_0xba54('0x2a')]({'plain':!![]});_0x8c783d[_0xba54('0x32')]=_['keys'](db[_0xba54('0x56')][_0xba54('0x30')]);_0x8c783d[_0xba54('0x38')]=_['keys'](_0x29124a[_0xba54('0x38')]);_0x8c783d[_0xba54('0x36')]=_['intersection'](_0x8c783d[_0xba54('0x32')],_0x8c783d['query']);_0x56f7bb[_0xba54('0x3a')]=_['intersection'](_0x8c783d[_0xba54('0x32')],qs[_0xba54('0x39')](_0x29124a[_0xba54('0x38')]['fields']));_0x56f7bb['attributes']=_0x56f7bb[_0xba54('0x3a')]['length']?_0x56f7bb['attributes']:_0x8c783d['model'];if(!_0x29124a[_0xba54('0x38')][_0xba54('0x3c')](_0xba54('0x3d'))){_0x56f7bb[_0xba54('0x22')]=qs[_0xba54('0x22')](_0x29124a[_0xba54('0x38')][_0xba54('0x22')]);_0x56f7bb[_0xba54('0x20')]=qs[_0xba54('0x20')](_0x29124a['query'][_0xba54('0x20')]);}_0x56f7bb[_0xba54('0x3e')]=qs['sort'](_0x29124a['query']['sort']);_0x56f7bb['where']=qs['filters'](_[_0xba54('0x40')](_0x29124a[_0xba54('0x38')],_0x8c783d[_0xba54('0x36')]));_0x56f7bb[_0xba54('0x3f')][_0xba54('0x57')]=_0x5c66b4['id'];if(_0x29124a[_0xba54('0x38')][_0xba54('0x41')]){_0x56f7bb['where']=_[_0xba54('0x48')](_0x56f7bb['where'],{'$or':_['map'](_0x56f7bb[_0xba54('0x3a')],function(_0x44648b){var _0x527213={};_0x527213[_0x44648b]={'$like':'%'+_0x29124a[_0xba54('0x38')][_0xba54('0x41')]+'%'};return _0x527213;})});}_0x56f7bb=_['merge']({},_0x56f7bb,_0x29124a[_0xba54('0x49')]);return db[_0xba54('0x56')][_0xba54('0x58')](_0x56f7bb);}})[_0xba54('0x29')](function(_0x6c66a4){if(_0x6c66a4){return db['User'][_0xba54('0x59')]({'where':{'id':_['map'](_0x6c66a4,_0xba54('0x5a')),'role':_0xba54('0x5b')},'attributes':['id','name','smsPause',_0xba54('0x5c'),_0xba54('0x5d')]});}})[_0xba54('0x29')](function(_0x4feb40){if(_0x4feb40){return{'count':_0x4feb40[_0xba54('0x23')],'rows':_['map'](_0x4feb40[_0xba54('0x44')],function(_0x44bf17){return{'membername':_0x44bf17[_0xba54('0x34')],'UserId':_0x44bf17['id'],'queue_name':_0x2137f6[_0xba54('0x34')],'SmsQueueId':_0x2137f6['id'],'interface':util[_0xba54('0x5e')]('%s/%s',_0xba54('0x5f'),_0x44bf17[_0xba54('0x34')]),'penalty':0x0,'paused':_0x44bf17['smsPause'],'createdAt':_0x44bf17['createdAt'],'updatedAt':_0x44bf17['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xba54('0x29')](respondWithFilteredResult(_0x2c7f19,_0x56f7bb))[_0xba54('0x45')](handleError(_0x2c7f19,null));};exports[_0xba54('0x60')]=function(_0x544456,_0x3c1273,_0x2ea680){var _0x3bd476={};var _0x5546ea={};var _0x5a96ff;var _0xe16962;return db[_0xba54('0x2f')][_0xba54('0x55')]({'where':{'id':_0x544456[_0xba54('0x47')]['id']}})['then'](handleEntityNotFound(_0x3c1273,null))['then'](function(_0x35c160){if(_0x35c160){_0x5a96ff=_0x35c160;_0x5546ea[_0xba54('0x32')]=_['keys'](db[_0xba54('0x61')][_0xba54('0x30')]);_0x5546ea[_0xba54('0x38')]=_[_0xba54('0x35')](_0x544456[_0xba54('0x38')]);_0x5546ea[_0xba54('0x36')]=_[_0xba54('0x37')](_0x5546ea[_0xba54('0x32')],_0x5546ea[_0xba54('0x38')]);_0x3bd476[_0xba54('0x3a')]=_[_0xba54('0x37')](_0x5546ea[_0xba54('0x32')],qs[_0xba54('0x39')](_0x544456[_0xba54('0x38')][_0xba54('0x39')]));_0x3bd476[_0xba54('0x3a')]=_0x3bd476[_0xba54('0x3a')][_0xba54('0x3b')]?_0x3bd476[_0xba54('0x3a')]:_0x5546ea['model'];_0x3bd476['order']=qs['sort'](_0x544456['query'][_0xba54('0x62')]);_0x3bd476[_0xba54('0x3f')]=qs[_0xba54('0x36')](_[_0xba54('0x40')](_0x544456['query'],_0x5546ea[_0xba54('0x36')]));if(_0x544456[_0xba54('0x38')]['filter']){_0x3bd476[_0xba54('0x3f')]=_['merge'](_0x3bd476[_0xba54('0x3f')],{'$or':_['map'](_0x3bd476[_0xba54('0x3a')],function(_0x2dc8c0){var _0x205203={};_0x205203[_0x2dc8c0]={'$like':'%'+_0x544456[_0xba54('0x38')]['filter']+'%'};return _0x205203;})});}_0x3bd476=_['merge']({},_0x3bd476,_0x544456[_0xba54('0x49')]);return _0x5a96ff[_0xba54('0x60')](_0x3bd476);}})[_0xba54('0x29')](function(_0x416eaa){if(_0x416eaa){_0xe16962=_0x416eaa[_0xba54('0x3b')];if(!_0x544456[_0xba54('0x38')][_0xba54('0x3c')](_0xba54('0x3d'))){_0x3bd476['limit']=qs['limit'](_0x544456[_0xba54('0x38')][_0xba54('0x22')]);_0x3bd476[_0xba54('0x20')]=qs['offset'](_0x544456[_0xba54('0x38')][_0xba54('0x20')]);}return _0x5a96ff['getTeams'](_0x3bd476);}})[_0xba54('0x29')](function(_0x4f637b){if(_0x4f637b){return _0x4f637b?{'count':_0xe16962,'rows':_0x4f637b}:null;}})[_0xba54('0x29')](respondWithResult(_0x3c1273,null))[_0xba54('0x45')](handleError(_0x3c1273,null));};exports['addTeams']=function(_0x45c7c2,_0x1ee7ef,_0x347972){var _0x5dbff7=_0x45c7c2[_0xba54('0x4b')][_0xba54('0x63')];return db[_0xba54('0x61')]['findAll']({'where':{'id':_0x5dbff7},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id','name','online',_0xba54('0x64'),_0xba54('0x65')],'raw':!![]}]})['then'](function(_0x4b35dc){if(_0x4b35dc){var _0x24d37b=_['flatMap'](_0x4b35dc,function(_0x45fce3){var _0x5718bf=_0x45fce3[_0xba54('0x2a')]({'plain':!![]});return _0x5718bf['Agents'];});return db[_0xba54('0x2f')][_0xba54('0x50')]({'where':{'id':_0x45c7c2['params']['id']}})['then'](function(_0xb7142f){return db[_0xba54('0x66')][_0xba54('0x67')](function(_0x20a899){return _0xb7142f[_0xba54('0x68')](_0x5dbff7,{'transaction':_0x20a899})[_0xba54('0x29')](function(){return BPromise[_0xba54('0x69')](_0x24d37b,function(_0x165ef0){return db[_0xba54('0x56')][_0xba54('0x6a')]({'where':{'UserId':_0x165ef0['id'],'SmsQueueId':_0x45c7c2[_0xba54('0x47')]['id']},'transaction':_0x20a899});});})[_0xba54('0x29')](function(){_0x24d37b[_0xba54('0x6b')](function(_0x1b05fc){socket['emit'](_0xba54('0x6c'),{'UserId':_0x1b05fc['id'],'SmsQueueId':_0xb7142f['id']});});});});});}})[_0xba54('0x29')](respondWithStatusCode(_0x1ee7ef,null))[_0xba54('0x45')](handleError(_0x1ee7ef,null));};exports[_0xba54('0x6d')]=function(_0x43d785,_0x30c7a9,_0x146e08){return db[_0xba54('0x61')][_0xba54('0x58')]({'where':{'id':_0x43d785[_0xba54('0x38')][_0xba54('0x63')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xba54('0x6e'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x30c7a9,null))['then'](function(_0xc277b9){var _0x5b3e81=_[_0xba54('0x33')](_0xc277b9,'id');var _0x410563=[];var _0x19453e=[];var _0x338087=squel[_0xba54('0x6f')]();_0x338087[_0xba54('0x70')](_0xba54('0x71'))['from']('team_has_sms_queues','tq')[_0xba54('0x72')](_0xba54('0x73'),'ut',_0xba54('0x74'))[_0xba54('0x3f')](_0xba54('0x75'),_0x43d785['params']['id']);for(var _0x4fd854=0x0;_0x4fd854<_0xc277b9[_0xba54('0x3b')];_0x4fd854+=0x1){let _0x1bca31=_0xc277b9[_0x4fd854];for(var _0x1c4ad8=0x0;_0x1c4ad8<_0x1bca31[_0xba54('0x6e')][_0xba54('0x3b')];_0x1c4ad8+=0x1){let _0x5160f4=_0x1bca31[_0xba54('0x6e')][_0x1c4ad8];var _0xa494d1=_0x338087[_0xba54('0x76')]();_0xa494d1[_0xba54('0x3f')]('ut.UserId\x20=\x20?',_0x5160f4['id']);_0x19453e[_0xba54('0x77')](db[_0xba54('0x66')][_0xba54('0x38')](_0xa494d1['toString'](),{'type':db['sequelize']['QueryTypes'][_0xba54('0x78')]})[_0xba54('0x29')](function(_0x8c6792){if(_0x8c6792['length']===0x1){return _0x5160f4['id'];}else{var _0x593306=_['every'](_['map'](_0x8c6792,_0xba54('0x79')),function(_0x20453b){return _['includes'](_0x5b3e81,_0x20453b);});if(_0x593306){return _0x5160f4['id'];}}}));}}return BPromise[_0xba54('0x7a')](_0x19453e)['then'](function(_0x5512ae){_0x410563=_(_0x410563)[_0xba54('0x7b')](_0x5512ae)[_0xba54('0x7c')]()[_0xba54('0x7d')]();return db[_0xba54('0x2f')][_0xba54('0x50')]({'where':{'id':_0x43d785['params']['id']}})['then'](function(_0x8c0f86){return db['sequelize'][_0xba54('0x67')](function(_0x47b7d7){return _0x8c0f86[_0xba54('0x6d')](_0x43d785[_0xba54('0x38')]['ids'],{'transaction':_0x47b7d7})[_0xba54('0x29')](function(){if(!_[_0xba54('0x7e')](_0x410563)){return _0x8c0f86[_0xba54('0x7f')](_0x410563,{'transaction':_0x47b7d7});}})[_0xba54('0x29')](function(){_0x410563['forEach'](function(_0x97f360){socket[_0xba54('0x80')](_0xba54('0x81'),{'UserId':_0x97f360,'SmsQueueId':_0x8c0f86['id']});});});});});});})['then'](respondWithStatusCode(_0x30c7a9,null))[_0xba54('0x45')](handleError(_0x30c7a9,null));};exports[_0xba54('0x82')]=function(_0x28fbc6,_0x152ace,_0x11ea2d){return db['SmsQueue'][_0xba54('0x50')]({'where':{'id':_0x28fbc6['params']['id']}})['then'](handleEntityNotFound(_0x152ace,null))[_0xba54('0x29')](function(_0x2ee32f){if(_0x2ee32f){return _0x2ee32f[_0xba54('0x82')](_0x28fbc6[_0xba54('0x4b')][_0xba54('0x63')],_['omit'](_0x28fbc6[_0xba54('0x4b')],['ids','id'])||{})['spread'](function(_0x5e4848){for(var _0x468fcd=0x0;_0x468fcd<_0x28fbc6[_0xba54('0x4b')][_0xba54('0x63')][_0xba54('0x3b')];_0x468fcd+=0x1){socket[_0xba54('0x80')](_0xba54('0x6c'),{'UserId':_0x28fbc6[_0xba54('0x4b')][_0xba54('0x63')][_0x468fcd],'SmsQueueId':_0x28fbc6['params']['id']});}return _0x5e4848;});}})[_0xba54('0x29')](respondWithResult(_0x152ace,null))[_0xba54('0x45')](handleError(_0x152ace,null));};exports[_0xba54('0x7f')]=function(_0x1fb23a,_0x4ec794,_0x5b3c5d){return db[_0xba54('0x2f')][_0xba54('0x50')]({'where':{'id':_0x1fb23a['params']['id']}})[_0xba54('0x29')](handleEntityNotFound(_0x4ec794,null))[_0xba54('0x29')](function(_0x2c1d58){if(_0x2c1d58){return _0x2c1d58[_0xba54('0x7f')](_0x1fb23a[_0xba54('0x38')][_0xba54('0x63')])[_0xba54('0x29')](function(){if(_[_0xba54('0x83')](_0x1fb23a[_0xba54('0x38')]['ids'])){for(var _0xe6e449=0x0;_0xe6e449<_0x1fb23a[_0xba54('0x38')][_0xba54('0x63')]['length'];_0xe6e449+=0x1){socket['emit'](_0xba54('0x81'),{'UserId':Number(_0x1fb23a['query']['ids'][_0xe6e449]),'SmsQueueId':Number(_0x1fb23a[_0xba54('0x47')]['id'])});}}else{socket[_0xba54('0x80')](_0xba54('0x81'),{'UserId':Number(_0x1fb23a[_0xba54('0x38')][_0xba54('0x63')]),'SmsQueueId':Number(_0x1fb23a[_0xba54('0x47')]['id'])});}});}})[_0xba54('0x29')](respondWithStatusCode(_0x4ec794,null))[_0xba54('0x45')](handleError(_0x4ec794,null));};exports[_0xba54('0x84')]=function(_0x150933,_0x3092b9,_0x32e916){var _0x4cbcce={};var _0x447ee3={};var _0x191191;var _0x4cc4c4;return db['SmsQueue'][_0xba54('0x55')]({'where':{'id':_0x150933[_0xba54('0x47')]['id']}})['then'](handleEntityNotFound(_0x3092b9,null))['then'](function(_0x1fe8c5){if(_0x1fe8c5){_0x191191=_0x1fe8c5;_0x447ee3['model']=_[_0xba54('0x35')](db[_0xba54('0x85')][_0xba54('0x30')]);_0x447ee3[_0xba54('0x38')]=_[_0xba54('0x35')](_0x150933[_0xba54('0x38')]);_0x447ee3['filters']=_[_0xba54('0x37')](_0x447ee3['model'],_0x447ee3['query']);_0x4cbcce['attributes']=_['intersection'](_0x447ee3[_0xba54('0x32')],qs['fields'](_0x150933[_0xba54('0x38')][_0xba54('0x39')]));_0x4cbcce[_0xba54('0x3a')]=_0x4cbcce[_0xba54('0x3a')][_0xba54('0x3b')]?_0x4cbcce['attributes']:_0x447ee3[_0xba54('0x32')];_0x4cbcce[_0xba54('0x3e')]=qs[_0xba54('0x62')](_0x150933[_0xba54('0x38')][_0xba54('0x62')]);_0x4cbcce[_0xba54('0x3f')]=qs[_0xba54('0x36')](_[_0xba54('0x40')](_0x150933[_0xba54('0x38')],_0x447ee3[_0xba54('0x36')]));if(_0x150933['query'][_0xba54('0x41')]){_0x4cbcce['where']=_[_0xba54('0x48')](_0x4cbcce['where'],{'$or':_['map'](_0x4cbcce['attributes'],function(_0x5632e0){var _0x5458f0={};_0x5458f0[_0x5632e0]={'$like':'%'+_0x150933[_0xba54('0x38')][_0xba54('0x41')]+'%'};return _0x5458f0;})});}_0x4cbcce=_[_0xba54('0x48')]({},_0x4cbcce,_0x150933[_0xba54('0x49')]);return _0x191191[_0xba54('0x84')](_0x4cbcce);}})[_0xba54('0x29')](function(_0x1bbdba){if(_0x1bbdba){_0x4cc4c4=_0x1bbdba[_0xba54('0x3b')];if(!_0x150933['query'][_0xba54('0x3c')](_0xba54('0x3d'))){_0x4cbcce[_0xba54('0x22')]=qs[_0xba54('0x22')](_0x150933[_0xba54('0x38')][_0xba54('0x22')]);_0x4cbcce['offset']=qs[_0xba54('0x20')](_0x150933[_0xba54('0x38')]['offset']);}return _0x191191['getAgents'](_0x4cbcce);}})[_0xba54('0x29')](function(_0xd1079){if(_0xd1079){return _0xd1079?{'count':_0x4cc4c4,'rows':_0xd1079}:null;}})[_0xba54('0x29')](respondWithResult(_0x3092b9,null))[_0xba54('0x45')](handleError(_0x3092b9,null));}; \ No newline at end of file +var _0x6fdc=['sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./smsQueue.socket','sendStatus','status','end','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','get','SmsQueues','UserProfileResource','error','name','send','index','map','SmsQueue','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','include','findAll','catch','show','params','rawAttributes','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','create','describe','getMembers','findOne','SmsQueueId','UserSmsQueue','User','findAndCountAll','UserId','agent','smsPause','updatedAt','createdAt','rows','format','%s/%s','SIP','getTeams','Team','addTeams','online','voicePause','flatMap','Agents','sequelize','transaction','each','findOrCreate','forEach','emit','userSmsQueue:save','removeTeams','ids','select','from','team_has_sms_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','SELECT','TeamId','includes','union','compact','isEmpty','userSmsQueue:remove','addAgents','omit','spread','isArray','getAgents','order','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path'];(function(_0x5567c0,_0xa23a4a){var _0x458dfc=function(_0x4438c7){while(--_0x4438c7){_0x5567c0['push'](_0x5567c0['shift']());}};_0x458dfc(++_0xa23a4a);}(_0x6fdc,0x199));var _0xc6fd=function(_0x1cd674,_0x8d3638){_0x1cd674=_0x1cd674-0x0;var _0x27928f=_0x6fdc[_0x1cd674];return _0x27928f;};'use strict';var emlformat=require(_0xc6fd('0x0'));var rimraf=require(_0xc6fd('0x1'));var zipdir=require(_0xc6fd('0x2'));var jsonpatch=require(_0xc6fd('0x3'));var rp=require(_0xc6fd('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xc6fd('0x5'));var util=require(_0xc6fd('0x6'));var path=require(_0xc6fd('0x7'));var sox=require(_0xc6fd('0x8'));var csv=require(_0xc6fd('0x9'));var ejs=require(_0xc6fd('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc6fd('0xb'));var squel=require('squel');var crypto=require(_0xc6fd('0xc'));var jsforce=require(_0xc6fd('0xd'));var deskjs=require(_0xc6fd('0xe'));var toCsv=require(_0xc6fd('0x9'));var querystring=require(_0xc6fd('0xf'));var Papa=require('papaparse');var Redis=require(_0xc6fd('0x10'));var authService=require(_0xc6fd('0x11'));var qs=require(_0xc6fd('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xc6fd('0x13'))(_0xc6fd('0x14'));var utils=require(_0xc6fd('0x15'));var config=require(_0xc6fd('0x16'));var licenseUtil=require(_0xc6fd('0x17'));var db=require(_0xc6fd('0x18'))['db'];config[_0xc6fd('0x19')]=_[_0xc6fd('0x1a')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xc6fd('0x1b'))(new Redis(config['redis']));require(_0xc6fd('0x1c'))['register'](socket);function respondWithStatusCode(_0x5774a7,_0x21fde3){_0x21fde3=_0x21fde3||0xcc;return function(_0x567584){if(_0x567584){return _0x5774a7[_0xc6fd('0x1d')](_0x21fde3);}return _0x5774a7[_0xc6fd('0x1e')](_0x21fde3)[_0xc6fd('0x1f')]();};}function respondWithResult(_0x5c98d1,_0x413c8e){_0x413c8e=_0x413c8e||0xc8;return function(_0x104b23){if(_0x104b23){return _0x5c98d1[_0xc6fd('0x1e')](_0x413c8e)['json'](_0x104b23);}};}function respondWithFilteredResult(_0x4c2c5d,_0xde14fa){return function(_0x2ccc27){if(_0x2ccc27){var _0x3ae6df=typeof _0xde14fa[_0xc6fd('0x20')]===_0xc6fd('0x21')&&typeof _0xde14fa[_0xc6fd('0x22')]===_0xc6fd('0x21');var _0x44af8f=_0x2ccc27[_0xc6fd('0x23')];var _0x323660=_0x3ae6df?0x0:_0xde14fa[_0xc6fd('0x20')];var _0x3e55e7=_0x3ae6df?_0x2ccc27[_0xc6fd('0x23')]:_0xde14fa[_0xc6fd('0x20')]+_0xde14fa[_0xc6fd('0x22')];var _0x3954e6;if(_0x3e55e7>=_0x44af8f){_0x3e55e7=_0x44af8f;_0x3954e6=0xc8;}else{_0x3954e6=0xce;}_0x4c2c5d[_0xc6fd('0x1e')](_0x3954e6);return _0x4c2c5d[_0xc6fd('0x24')]('Content-Range',_0x323660+'-'+_0x3e55e7+'/'+_0x44af8f)['json'](_0x2ccc27);}return null;};}function patchUpdates(_0x240a30){return function(_0x15f4d5){try{jsonpatch[_0xc6fd('0x25')](_0x15f4d5,_0x240a30,!![]);}catch(_0x5d2a84){return BPromise[_0xc6fd('0x26')](_0x5d2a84);}return _0x15f4d5[_0xc6fd('0x27')]();};}function saveUpdates(_0x3c979a,_0xdd8424){return function(_0x21b4cd){if(_0x21b4cd){return _0x21b4cd[_0xc6fd('0x28')](_0x3c979a)[_0xc6fd('0x29')](function(_0x1c6bda){return _0x1c6bda;});}return null;};}function removeEntity(_0x2ca1ec,_0x2e6cfb){return function(_0x5ec86c){if(_0x5ec86c){return _0x5ec86c[_0xc6fd('0x2a')]()['then'](function(){var _0x473f6e=_0x5ec86c[_0xc6fd('0x2b')]({'plain':!![]});var _0x19fcd3=_0xc6fd('0x2c');return db[_0xc6fd('0x2d')][_0xc6fd('0x2a')]({'where':{'type':_0x19fcd3,'resourceId':_0x473f6e['id']}})[_0xc6fd('0x29')](function(){return _0x5ec86c;});})[_0xc6fd('0x29')](function(){_0x2ca1ec['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x18cc8b,_0x355421){return function(_0x56f1c5){if(!_0x56f1c5){_0x18cc8b[_0xc6fd('0x1d')](0x194);}return _0x56f1c5;};}function handleError(_0x5275bc,_0x2d8e02){_0x2d8e02=_0x2d8e02||0x1f4;return function(_0xd11131){logger[_0xc6fd('0x2e')](_0xd11131['stack']);if(_0xd11131[_0xc6fd('0x2f')]){delete _0xd11131[_0xc6fd('0x2f')];}_0x5275bc[_0xc6fd('0x1e')](_0x2d8e02)[_0xc6fd('0x30')](_0xd11131);};}exports[_0xc6fd('0x31')]=function(_0x5f4c30,_0x3f03e9){var _0x1d9742={},_0x193ca5={},_0x2cc897={'count':0x0,'rows':[]};var _0x389bdb=_[_0xc6fd('0x32')](db[_0xc6fd('0x33')]['rawAttributes'],function(_0x285155){return{'name':_0x285155[_0xc6fd('0x34')],'type':_0x285155[_0xc6fd('0x35')][_0xc6fd('0x36')]};});_0x193ca5[_0xc6fd('0x37')]=_['map'](_0x389bdb,'name');_0x193ca5[_0xc6fd('0x38')]=_[_0xc6fd('0x39')](_0x5f4c30[_0xc6fd('0x38')]);_0x193ca5[_0xc6fd('0x3a')]=_[_0xc6fd('0x3b')](_0x193ca5[_0xc6fd('0x37')],_0x193ca5[_0xc6fd('0x38')]);_0x1d9742[_0xc6fd('0x3c')]=_['intersection'](_0x193ca5[_0xc6fd('0x37')],qs['fields'](_0x5f4c30[_0xc6fd('0x38')][_0xc6fd('0x3d')]));_0x1d9742[_0xc6fd('0x3c')]=_0x1d9742[_0xc6fd('0x3c')][_0xc6fd('0x3e')]?_0x1d9742[_0xc6fd('0x3c')]:_0x193ca5[_0xc6fd('0x37')];if(!_0x5f4c30[_0xc6fd('0x38')][_0xc6fd('0x3f')](_0xc6fd('0x40'))){_0x1d9742[_0xc6fd('0x22')]=qs['limit'](_0x5f4c30[_0xc6fd('0x38')][_0xc6fd('0x22')]);_0x1d9742[_0xc6fd('0x20')]=qs['offset'](_0x5f4c30[_0xc6fd('0x38')]['offset']);}_0x1d9742['order']=qs[_0xc6fd('0x41')](_0x5f4c30[_0xc6fd('0x38')][_0xc6fd('0x41')]);_0x1d9742[_0xc6fd('0x42')]=qs[_0xc6fd('0x3a')](_[_0xc6fd('0x43')](_0x5f4c30['query'],_0x193ca5[_0xc6fd('0x3a')]),_0x389bdb);if(_0x5f4c30['query'][_0xc6fd('0x44')]){_0x1d9742[_0xc6fd('0x42')]=_[_0xc6fd('0x45')](_0x1d9742['where'],{'$or':_['map'](_0x389bdb,function(_0x486333){if(_0x486333[_0xc6fd('0x35')]!=='VIRTUAL'){var _0x5e30b6={};_0x5e30b6[_0x486333['name']]={'$like':'%'+_0x5f4c30['query']['filter']+'%'};return _0x5e30b6;}})});}_0x1d9742=_[_0xc6fd('0x45')]({},_0x1d9742,_0x5f4c30[_0xc6fd('0x46')]);var _0x597472={'where':_0x1d9742[_0xc6fd('0x42')]};return db['SmsQueue'][_0xc6fd('0x23')](_0x597472)['then'](function(_0x2dd9d7){_0x2cc897[_0xc6fd('0x23')]=_0x2dd9d7;if(_0x5f4c30[_0xc6fd('0x38')][_0xc6fd('0x47')]){_0x1d9742[_0xc6fd('0x48')]=[{'all':!![]}];}return db[_0xc6fd('0x33')][_0xc6fd('0x49')](_0x1d9742);})[_0xc6fd('0x29')](function(_0x536502){_0x2cc897['rows']=_0x536502;return _0x2cc897;})['then'](respondWithFilteredResult(_0x3f03e9,_0x1d9742))[_0xc6fd('0x4a')](handleError(_0x3f03e9,null));};exports[_0xc6fd('0x4b')]=function(_0x4954fd,_0x40ede6){var _0x2b6f99={'raw':!![],'where':{'id':_0x4954fd[_0xc6fd('0x4c')]['id']}},_0x3dff86={};_0x3dff86[_0xc6fd('0x37')]=_[_0xc6fd('0x39')](db[_0xc6fd('0x33')][_0xc6fd('0x4d')]);_0x3dff86['query']=_[_0xc6fd('0x39')](_0x4954fd['query']);_0x3dff86['filters']=_['intersection'](_0x3dff86[_0xc6fd('0x37')],_0x3dff86[_0xc6fd('0x38')]);_0x2b6f99[_0xc6fd('0x3c')]=_['intersection'](_0x3dff86[_0xc6fd('0x37')],qs[_0xc6fd('0x3d')](_0x4954fd['query'][_0xc6fd('0x3d')]));_0x2b6f99[_0xc6fd('0x3c')]=_0x2b6f99[_0xc6fd('0x3c')]['length']?_0x2b6f99['attributes']:_0x3dff86[_0xc6fd('0x37')];if(_0x4954fd[_0xc6fd('0x38')]['includeAll']){_0x2b6f99['include']=[{'all':!![]}];}_0x2b6f99=_[_0xc6fd('0x45')]({},_0x2b6f99,_0x4954fd[_0xc6fd('0x46')]);return db[_0xc6fd('0x33')][_0xc6fd('0x4e')](_0x2b6f99)[_0xc6fd('0x29')](handleEntityNotFound(_0x40ede6,null))['then'](respondWithResult(_0x40ede6,null))[_0xc6fd('0x4a')](handleError(_0x40ede6,null));};exports['create']=function(_0x244c4c,_0x31ca66){return db[_0xc6fd('0x33')]['create'](_0x244c4c[_0xc6fd('0x4f')],{})[_0xc6fd('0x29')](function(_0x3c6b4c){var _0x14d3b1=_0x244c4c[_0xc6fd('0x50')][_0xc6fd('0x2b')]({'plain':!![]});if(!_0x14d3b1)throw new Error(_0xc6fd('0x51'));if(_0x14d3b1[_0xc6fd('0x52')]===_0xc6fd('0x50')){var _0x4491fe=_0x3c6b4c[_0xc6fd('0x2b')]({'plain':!![]});var _0x42a79f=_0xc6fd('0x2c');return db[_0xc6fd('0x53')][_0xc6fd('0x4e')]({'where':{'name':_0x42a79f,'userProfileId':_0x14d3b1['userProfileId']},'raw':!![]})[_0xc6fd('0x29')](function(_0x55b85e){if(_0x55b85e&&_0x55b85e['autoAssociation']===0x0){return db[_0xc6fd('0x2d')][_0xc6fd('0x54')]({'name':_0x4491fe['name'],'resourceId':_0x4491fe['id'],'type':_0x55b85e[_0xc6fd('0x2f')],'sectionId':_0x55b85e['id']},{})[_0xc6fd('0x29')](function(){return _0x3c6b4c;});}else{return _0x3c6b4c;}})[_0xc6fd('0x4a')](function(_0x592474){logger[_0xc6fd('0x2e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x592474);throw _0x592474;});}return _0x3c6b4c;})[_0xc6fd('0x29')](respondWithResult(_0x31ca66,0xc9))['catch'](handleError(_0x31ca66,null));};exports[_0xc6fd('0x28')]=function(_0x2c58fc,_0x4bc66){if(_0x2c58fc[_0xc6fd('0x4f')]['id']){delete _0x2c58fc[_0xc6fd('0x4f')]['id'];}return db[_0xc6fd('0x33')][_0xc6fd('0x4e')]({'where':{'id':_0x2c58fc[_0xc6fd('0x4c')]['id']}})[_0xc6fd('0x29')](handleEntityNotFound(_0x4bc66,null))['then'](saveUpdates(_0x2c58fc[_0xc6fd('0x4f')],null))[_0xc6fd('0x29')](respondWithResult(_0x4bc66,null))[_0xc6fd('0x4a')](handleError(_0x4bc66,null));};exports[_0xc6fd('0x2a')]=function(_0x21edb7,_0x373687){return db[_0xc6fd('0x33')][_0xc6fd('0x4e')]({'where':{'id':_0x21edb7[_0xc6fd('0x4c')]['id']}})['then'](handleEntityNotFound(_0x373687,null))[_0xc6fd('0x29')](removeEntity(_0x373687,null))['catch'](handleError(_0x373687,null));};exports[_0xc6fd('0x55')]=function(_0x3f34e1,_0x3dd663){return db['SmsQueue'][_0xc6fd('0x55')]()[_0xc6fd('0x29')](respondWithResult(_0x3dd663,null))['catch'](handleError(_0x3dd663,null));};exports[_0xc6fd('0x56')]=function(_0xe30023,_0x41d261,_0x2779fc){var _0x4693c1={'raw':!![],'where':{}},_0x17ede8={},_0x3c50c0;return db[_0xc6fd('0x33')][_0xc6fd('0x57')]({'where':{'id':_0xe30023['params']['id']}})[_0xc6fd('0x29')](handleEntityNotFound(_0x41d261,null))[_0xc6fd('0x29')](function(_0x1d1821){if(_0x1d1821){_0x3c50c0=_0x1d1821[_0xc6fd('0x2b')]({'plain':!![]});_0x17ede8[_0xc6fd('0x37')]=_[_0xc6fd('0x39')](db['UserSmsQueue'][_0xc6fd('0x4d')]);_0x17ede8[_0xc6fd('0x38')]=_['keys'](_0xe30023[_0xc6fd('0x38')]);_0x17ede8[_0xc6fd('0x3a')]=_[_0xc6fd('0x3b')](_0x17ede8[_0xc6fd('0x37')],_0x17ede8['query']);_0x4693c1[_0xc6fd('0x3c')]=_[_0xc6fd('0x3b')](_0x17ede8[_0xc6fd('0x37')],qs['fields'](_0xe30023[_0xc6fd('0x38')][_0xc6fd('0x3d')]));_0x4693c1[_0xc6fd('0x3c')]=_0x4693c1[_0xc6fd('0x3c')][_0xc6fd('0x3e')]?_0x4693c1[_0xc6fd('0x3c')]:_0x17ede8[_0xc6fd('0x37')];if(!_0xe30023[_0xc6fd('0x38')][_0xc6fd('0x3f')](_0xc6fd('0x40'))){_0x4693c1['limit']=qs['limit'](_0xe30023[_0xc6fd('0x38')][_0xc6fd('0x22')]);_0x4693c1[_0xc6fd('0x20')]=qs[_0xc6fd('0x20')](_0xe30023[_0xc6fd('0x38')][_0xc6fd('0x20')]);}_0x4693c1['order']=qs['sort'](_0xe30023[_0xc6fd('0x38')][_0xc6fd('0x41')]);_0x4693c1['where']=qs[_0xc6fd('0x3a')](_['pick'](_0xe30023[_0xc6fd('0x38')],_0x17ede8[_0xc6fd('0x3a')]));_0x4693c1[_0xc6fd('0x42')][_0xc6fd('0x58')]=_0x1d1821['id'];if(_0xe30023[_0xc6fd('0x38')][_0xc6fd('0x44')]){_0x4693c1['where']=_[_0xc6fd('0x45')](_0x4693c1[_0xc6fd('0x42')],{'$or':_[_0xc6fd('0x32')](_0x4693c1[_0xc6fd('0x3c')],function(_0x13e2f3){var _0x298a07={};_0x298a07[_0x13e2f3]={'$like':'%'+_0xe30023[_0xc6fd('0x38')]['filter']+'%'};return _0x298a07;})});}_0x4693c1=_[_0xc6fd('0x45')]({},_0x4693c1,_0xe30023[_0xc6fd('0x46')]);return db[_0xc6fd('0x59')][_0xc6fd('0x49')](_0x4693c1);}})['then'](function(_0x54b43a){if(_0x54b43a){return db[_0xc6fd('0x5a')][_0xc6fd('0x5b')]({'where':{'id':_[_0xc6fd('0x32')](_0x54b43a,_0xc6fd('0x5c')),'role':_0xc6fd('0x5d')},'attributes':['id','name',_0xc6fd('0x5e'),_0xc6fd('0x5f'),_0xc6fd('0x60')]});}})[_0xc6fd('0x29')](function(_0x3bdf67){if(_0x3bdf67){return{'count':_0x3bdf67[_0xc6fd('0x23')],'rows':_[_0xc6fd('0x32')](_0x3bdf67[_0xc6fd('0x61')],function(_0x3e9864){return{'membername':_0x3e9864[_0xc6fd('0x2f')],'UserId':_0x3e9864['id'],'queue_name':_0x3c50c0['name'],'SmsQueueId':_0x3c50c0['id'],'interface':util[_0xc6fd('0x62')](_0xc6fd('0x63'),_0xc6fd('0x64'),_0x3e9864[_0xc6fd('0x2f')]),'penalty':0x0,'paused':_0x3e9864[_0xc6fd('0x5e')],'createdAt':_0x3e9864[_0xc6fd('0x60')],'updatedAt':_0x3e9864[_0xc6fd('0x5f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xc6fd('0x29')](respondWithFilteredResult(_0x41d261,_0x4693c1))[_0xc6fd('0x4a')](handleError(_0x41d261,null));};exports[_0xc6fd('0x65')]=function(_0x54f1ac,_0x2ab641,_0x44d8a4){var _0xc97f49={};var _0x29468e={};var _0x8133b;var _0x117d6a;return db[_0xc6fd('0x33')][_0xc6fd('0x57')]({'where':{'id':_0x54f1ac[_0xc6fd('0x4c')]['id']}})['then'](handleEntityNotFound(_0x2ab641,null))['then'](function(_0x51caec){if(_0x51caec){_0x8133b=_0x51caec;_0x29468e['model']=_['keys'](db[_0xc6fd('0x66')][_0xc6fd('0x4d')]);_0x29468e[_0xc6fd('0x38')]=_[_0xc6fd('0x39')](_0x54f1ac[_0xc6fd('0x38')]);_0x29468e[_0xc6fd('0x3a')]=_[_0xc6fd('0x3b')](_0x29468e[_0xc6fd('0x37')],_0x29468e['query']);_0xc97f49[_0xc6fd('0x3c')]=_[_0xc6fd('0x3b')](_0x29468e[_0xc6fd('0x37')],qs[_0xc6fd('0x3d')](_0x54f1ac[_0xc6fd('0x38')][_0xc6fd('0x3d')]));_0xc97f49[_0xc6fd('0x3c')]=_0xc97f49[_0xc6fd('0x3c')][_0xc6fd('0x3e')]?_0xc97f49[_0xc6fd('0x3c')]:_0x29468e[_0xc6fd('0x37')];_0xc97f49['order']=qs['sort'](_0x54f1ac[_0xc6fd('0x38')]['sort']);_0xc97f49['where']=qs[_0xc6fd('0x3a')](_[_0xc6fd('0x43')](_0x54f1ac['query'],_0x29468e[_0xc6fd('0x3a')]));if(_0x54f1ac['query'][_0xc6fd('0x44')]){_0xc97f49['where']=_['merge'](_0xc97f49[_0xc6fd('0x42')],{'$or':_['map'](_0xc97f49['attributes'],function(_0x54c8c5){var _0x1cf80f={};_0x1cf80f[_0x54c8c5]={'$like':'%'+_0x54f1ac[_0xc6fd('0x38')][_0xc6fd('0x44')]+'%'};return _0x1cf80f;})});}_0xc97f49=_['merge']({},_0xc97f49,_0x54f1ac[_0xc6fd('0x46')]);return _0x8133b[_0xc6fd('0x65')](_0xc97f49);}})[_0xc6fd('0x29')](function(_0x125583){if(_0x125583){_0x117d6a=_0x125583[_0xc6fd('0x3e')];if(!_0x54f1ac[_0xc6fd('0x38')]['hasOwnProperty'](_0xc6fd('0x40'))){_0xc97f49[_0xc6fd('0x22')]=qs[_0xc6fd('0x22')](_0x54f1ac[_0xc6fd('0x38')][_0xc6fd('0x22')]);_0xc97f49['offset']=qs['offset'](_0x54f1ac[_0xc6fd('0x38')]['offset']);}return _0x8133b['getTeams'](_0xc97f49);}})[_0xc6fd('0x29')](function(_0x41bec2){if(_0x41bec2){return _0x41bec2?{'count':_0x117d6a,'rows':_0x41bec2}:null;}})[_0xc6fd('0x29')](respondWithResult(_0x2ab641,null))['catch'](handleError(_0x2ab641,null));};exports[_0xc6fd('0x67')]=function(_0x1c0086,_0x19aee7,_0x5217b5){var _0x34fdfb=_0x1c0086[_0xc6fd('0x4f')]['ids'];return db[_0xc6fd('0x66')][_0xc6fd('0x49')]({'where':{'id':_0x34fdfb},'attributes':['id'],'include':[{'model':db[_0xc6fd('0x5a')],'as':'Agents','attributes':['id','name',_0xc6fd('0x68'),_0xc6fd('0x69'),'interface'],'raw':!![]}]})[_0xc6fd('0x29')](function(_0x2f2998){if(_0x2f2998){var _0x30c29e=_[_0xc6fd('0x6a')](_0x2f2998,function(_0x45e6c0){var _0x1e4fef=_0x45e6c0['get']({'plain':!![]});return _0x1e4fef[_0xc6fd('0x6b')];});return db[_0xc6fd('0x33')][_0xc6fd('0x4e')]({'where':{'id':_0x1c0086[_0xc6fd('0x4c')]['id']}})[_0xc6fd('0x29')](function(_0x5fd725){return db[_0xc6fd('0x6c')][_0xc6fd('0x6d')](function(_0x1bce15){return _0x5fd725[_0xc6fd('0x67')](_0x34fdfb,{'transaction':_0x1bce15})[_0xc6fd('0x29')](function(){return BPromise[_0xc6fd('0x6e')](_0x30c29e,function(_0x4f765a){return db[_0xc6fd('0x59')][_0xc6fd('0x6f')]({'where':{'UserId':_0x4f765a['id'],'SmsQueueId':_0x1c0086[_0xc6fd('0x4c')]['id']},'transaction':_0x1bce15});});})[_0xc6fd('0x29')](function(){_0x30c29e[_0xc6fd('0x70')](function(_0x40cdd2){socket[_0xc6fd('0x71')](_0xc6fd('0x72'),{'UserId':_0x40cdd2['id'],'SmsQueueId':_0x5fd725['id']});});});});});}})['then'](respondWithStatusCode(_0x19aee7,null))['catch'](handleError(_0x19aee7,null));};exports[_0xc6fd('0x73')]=function(_0x4cfcd7,_0x47efe9,_0x3f16f7){return db['Team'][_0xc6fd('0x49')]({'where':{'id':_0x4cfcd7['query'][_0xc6fd('0x74')]},'attributes':['id'],'include':[{'model':db[_0xc6fd('0x5a')],'as':_0xc6fd('0x6b'),'attributes':['id'],'raw':!![]}]})[_0xc6fd('0x29')](handleEntityNotFound(_0x47efe9,null))[_0xc6fd('0x29')](function(_0x2d9ef4){var _0xf59d1c=_['map'](_0x2d9ef4,'id');var _0x5c0135=[];var _0x1e35c1=[];var _0x1e69d9=squel[_0xc6fd('0x75')]();_0x1e69d9['field']('tq.TeamId')[_0xc6fd('0x76')](_0xc6fd('0x77'),'tq')['join'](_0xc6fd('0x78'),'ut',_0xc6fd('0x79'))[_0xc6fd('0x42')](_0xc6fd('0x7a'),_0x4cfcd7[_0xc6fd('0x4c')]['id']);for(var _0x4645f0=0x0;_0x4645f0<_0x2d9ef4[_0xc6fd('0x3e')];_0x4645f0+=0x1){let _0x519860=_0x2d9ef4[_0x4645f0];for(var _0x17314a=0x0;_0x17314a<_0x519860[_0xc6fd('0x6b')][_0xc6fd('0x3e')];_0x17314a+=0x1){let _0x2a5524=_0x519860['Agents'][_0x17314a];var _0x4b887a=_0x1e69d9['clone']();_0x4b887a[_0xc6fd('0x42')](_0xc6fd('0x7b'),_0x2a5524['id']);_0x1e35c1[_0xc6fd('0x7c')](db[_0xc6fd('0x6c')][_0xc6fd('0x38')](_0x4b887a[_0xc6fd('0x7d')](),{'type':db[_0xc6fd('0x6c')]['QueryTypes'][_0xc6fd('0x7e')]})[_0xc6fd('0x29')](function(_0x8e15c1){if(_0x8e15c1[_0xc6fd('0x3e')]===0x1){return _0x2a5524['id'];}else{var _0x30a4f3=_['every'](_[_0xc6fd('0x32')](_0x8e15c1,_0xc6fd('0x7f')),function(_0x5616a5){return _[_0xc6fd('0x80')](_0xf59d1c,_0x5616a5);});if(_0x30a4f3){return _0x2a5524['id'];}}}));}}return BPromise['all'](_0x1e35c1)[_0xc6fd('0x29')](function(_0x5fee8e){_0x5c0135=_(_0x5c0135)[_0xc6fd('0x81')](_0x5fee8e)[_0xc6fd('0x82')]()['value']();return db[_0xc6fd('0x33')]['find']({'where':{'id':_0x4cfcd7['params']['id']}})[_0xc6fd('0x29')](function(_0x561ad5){return db[_0xc6fd('0x6c')][_0xc6fd('0x6d')](function(_0x36abc8){return _0x561ad5[_0xc6fd('0x73')](_0x4cfcd7[_0xc6fd('0x38')][_0xc6fd('0x74')],{'transaction':_0x36abc8})[_0xc6fd('0x29')](function(){if(!_[_0xc6fd('0x83')](_0x5c0135)){return _0x561ad5['removeAgents'](_0x5c0135,{'transaction':_0x36abc8});}})['then'](function(){_0x5c0135['forEach'](function(_0x16fbbc){socket[_0xc6fd('0x71')](_0xc6fd('0x84'),{'UserId':_0x16fbbc,'SmsQueueId':_0x561ad5['id']});});});});});});})['then'](respondWithStatusCode(_0x47efe9,null))[_0xc6fd('0x4a')](handleError(_0x47efe9,null));};exports[_0xc6fd('0x85')]=function(_0x120109,_0x507d46,_0x4885ba){return db[_0xc6fd('0x33')][_0xc6fd('0x4e')]({'where':{'id':_0x120109[_0xc6fd('0x4c')]['id']}})['then'](handleEntityNotFound(_0x507d46,null))[_0xc6fd('0x29')](function(_0x5e2759){if(_0x5e2759){return _0x5e2759[_0xc6fd('0x85')](_0x120109['body'][_0xc6fd('0x74')],_[_0xc6fd('0x86')](_0x120109['body'],[_0xc6fd('0x74'),'id'])||{})[_0xc6fd('0x87')](function(_0x4f188a){for(var _0x5266c9=0x0;_0x5266c9<_0x120109[_0xc6fd('0x4f')][_0xc6fd('0x74')]['length'];_0x5266c9+=0x1){socket[_0xc6fd('0x71')](_0xc6fd('0x72'),{'UserId':_0x120109[_0xc6fd('0x4f')][_0xc6fd('0x74')][_0x5266c9],'SmsQueueId':_0x120109['params']['id']});}return _0x4f188a;});}})['then'](respondWithResult(_0x507d46,null))[_0xc6fd('0x4a')](handleError(_0x507d46,null));};exports['removeAgents']=function(_0x4691fe,_0x291ff8,_0x1525cf){return db['SmsQueue']['find']({'where':{'id':_0x4691fe[_0xc6fd('0x4c')]['id']}})[_0xc6fd('0x29')](handleEntityNotFound(_0x291ff8,null))[_0xc6fd('0x29')](function(_0x9790b3){if(_0x9790b3){return _0x9790b3['removeAgents'](_0x4691fe['query']['ids'])[_0xc6fd('0x29')](function(){if(_[_0xc6fd('0x88')](_0x4691fe[_0xc6fd('0x38')]['ids'])){for(var _0x1d5c29=0x0;_0x1d5c29<_0x4691fe['query'][_0xc6fd('0x74')][_0xc6fd('0x3e')];_0x1d5c29+=0x1){socket[_0xc6fd('0x71')](_0xc6fd('0x84'),{'UserId':Number(_0x4691fe[_0xc6fd('0x38')][_0xc6fd('0x74')][_0x1d5c29]),'SmsQueueId':Number(_0x4691fe[_0xc6fd('0x4c')]['id'])});}}else{socket[_0xc6fd('0x71')](_0xc6fd('0x84'),{'UserId':Number(_0x4691fe[_0xc6fd('0x38')][_0xc6fd('0x74')]),'SmsQueueId':Number(_0x4691fe[_0xc6fd('0x4c')]['id'])});}});}})[_0xc6fd('0x29')](respondWithStatusCode(_0x291ff8,null))['catch'](handleError(_0x291ff8,null));};exports[_0xc6fd('0x89')]=function(_0x474ab6,_0x30ab6e,_0x7e8648){var _0x22f9ca={};var _0x3ce536={};var _0xba7b60;var _0x450b98;return db[_0xc6fd('0x33')][_0xc6fd('0x57')]({'where':{'id':_0x474ab6[_0xc6fd('0x4c')]['id']}})[_0xc6fd('0x29')](handleEntityNotFound(_0x30ab6e,null))[_0xc6fd('0x29')](function(_0x55fabd){if(_0x55fabd){_0xba7b60=_0x55fabd;_0x3ce536[_0xc6fd('0x37')]=_[_0xc6fd('0x39')](db[_0xc6fd('0x5a')][_0xc6fd('0x4d')]);_0x3ce536[_0xc6fd('0x38')]=_[_0xc6fd('0x39')](_0x474ab6[_0xc6fd('0x38')]);_0x3ce536['filters']=_[_0xc6fd('0x3b')](_0x3ce536[_0xc6fd('0x37')],_0x3ce536[_0xc6fd('0x38')]);_0x22f9ca[_0xc6fd('0x3c')]=_[_0xc6fd('0x3b')](_0x3ce536[_0xc6fd('0x37')],qs[_0xc6fd('0x3d')](_0x474ab6[_0xc6fd('0x38')]['fields']));_0x22f9ca[_0xc6fd('0x3c')]=_0x22f9ca['attributes'][_0xc6fd('0x3e')]?_0x22f9ca['attributes']:_0x3ce536[_0xc6fd('0x37')];_0x22f9ca[_0xc6fd('0x8a')]=qs[_0xc6fd('0x41')](_0x474ab6['query'][_0xc6fd('0x41')]);_0x22f9ca[_0xc6fd('0x42')]=qs[_0xc6fd('0x3a')](_[_0xc6fd('0x43')](_0x474ab6[_0xc6fd('0x38')],_0x3ce536[_0xc6fd('0x3a')]));if(_0x474ab6['query']['filter']){_0x22f9ca[_0xc6fd('0x42')]=_[_0xc6fd('0x45')](_0x22f9ca[_0xc6fd('0x42')],{'$or':_[_0xc6fd('0x32')](_0x22f9ca[_0xc6fd('0x3c')],function(_0xa04b0d){var _0x3c80a2={};_0x3c80a2[_0xa04b0d]={'$like':'%'+_0x474ab6[_0xc6fd('0x38')][_0xc6fd('0x44')]+'%'};return _0x3c80a2;})});}_0x22f9ca=_['merge']({},_0x22f9ca,_0x474ab6[_0xc6fd('0x46')]);return _0xba7b60[_0xc6fd('0x89')](_0x22f9ca);}})['then'](function(_0x1a52d9){if(_0x1a52d9){_0x450b98=_0x1a52d9[_0xc6fd('0x3e')];if(!_0x474ab6['query'][_0xc6fd('0x3f')]('nolimit')){_0x22f9ca[_0xc6fd('0x22')]=qs['limit'](_0x474ab6['query'][_0xc6fd('0x22')]);_0x22f9ca[_0xc6fd('0x20')]=qs['offset'](_0x474ab6['query']['offset']);}return _0xba7b60[_0xc6fd('0x89')](_0x22f9ca);}})[_0xc6fd('0x29')](function(_0x541cef){if(_0x541cef){return _0x541cef?{'count':_0x450b98,'rows':_0x541cef}:null;}})[_0xc6fd('0x29')](respondWithResult(_0x30ab6e,null))[_0xc6fd('0x4a')](handleError(_0x30ab6e,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index b281e91..5a0a02a 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 _0x98c7=['events','../../mysqldb','SmsQueue','save','update','emit','hasOwnProperty','hook','exports'];(function(_0x23f578,_0x1694f6){var _0xf31dc1=function(_0x325f3e){while(--_0x325f3e){_0x23f578['push'](_0x23f578['shift']());}};_0xf31dc1(++_0x1694f6);}(_0x98c7,0x129));var _0x798c=function(_0x285cf1,_0x47e330){_0x285cf1=_0x285cf1-0x0;var _0x2fea93=_0x98c7[_0x285cf1];return _0x2fea93;};'use strict';var EventEmitter=require(_0x798c('0x0'));var SmsQueue=require(_0x798c('0x1'))['db'][_0x798c('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x798c('0x3'),'afterUpdate':_0x798c('0x4'),'afterDestroy':'remove'};function emitEvent(_0x7497da){return function(_0x5962d5,_0x112c06,_0x24570b){SmsQueueEvents[_0x798c('0x5')](_0x7497da+':'+_0x5962d5['id'],_0x5962d5);SmsQueueEvents['emit'](_0x7497da,_0x5962d5);_0x24570b(null);};}for(var e in events){if(events[_0x798c('0x6')](e)){var event=events[e];SmsQueue[_0x798c('0x7')](e,emitEvent(event));}}module[_0x798c('0x8')]=SmsQueueEvents; \ No newline at end of file +var _0x4dfc=['emit','hasOwnProperty','hook','events','SmsQueue','setMaxListeners','save','update','remove'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x4dfc,0x1e0));var _0xc4df=function(_0x4e5d67,_0x54dffc){_0x4e5d67=_0x4e5d67-0x0;var _0x4acdf3=_0x4dfc[_0x4e5d67];return _0x4acdf3;};'use strict';var EventEmitter=require(_0xc4df('0x0'));var SmsQueue=require('../../mysqldb')['db'][_0xc4df('0x1')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0xc4df('0x2')](0x0);var events={'afterCreate':_0xc4df('0x3'),'afterUpdate':_0xc4df('0x4'),'afterDestroy':_0xc4df('0x5')};function emitEvent(_0x246766){return function(_0x121a55,_0x828d7a,_0x3ae3d8){SmsQueueEvents[_0xc4df('0x6')](_0x246766+':'+_0x121a55['id'],_0x121a55);SmsQueueEvents[_0xc4df('0x6')](_0x246766,_0x121a55);_0x3ae3d8(null);};}for(var e in events){if(events[_0xc4df('0x7')](e)){var event=events[e];SmsQueue[_0xc4df('0x8')](e,emitEvent(event));}}module['exports']=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index 2c175b5..6f00ac9 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 _0x2804=['./smsQueue.attributes','exports','SmsQueue','sms_queues','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0xae282f,_0x2d9368){var _0x5f46d4=function(_0x4f703e){while(--_0x4f703e){_0xae282f['push'](_0xae282f['shift']());}};_0x5f46d4(++_0x2d9368);}(_0x2804,0xe0));var _0x4280=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x2804[_0x501510];return _0x1e6ee5;};'use strict';var _=require('lodash');var util=require(_0x4280('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x4280('0x1'));var rp=require(_0x4280('0x2'));var fs=require('fs');var path=require(_0x4280('0x3'));var rimraf=require(_0x4280('0x4'));var config=require(_0x4280('0x5'));var attributes=require(_0x4280('0x6'));module[_0x4280('0x7')]=function(_0x3ec4af,_0x4bf924){return _0x3ec4af['define'](_0x4280('0x8'),attributes,{'tableName':_0x4280('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdaaf=['moment','path','rimraf','exports','define','SmsQueue','sms_queues','util','../../config/logger'];(function(_0x2a390b,_0xf49f9b){var _0x5df10a=function(_0x115dbe){while(--_0x115dbe){_0x2a390b['push'](_0x2a390b['shift']());}};_0x5df10a(++_0xf49f9b);}(_0xdaaf,0xdf));var _0xfdaa=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xdaaf[_0x19950b];return _0x3c6b41;};'use strict';var _=require('lodash');var util=require(_0xfdaa('0x0'));var logger=require(_0xfdaa('0x1'))('api');var moment=require(_0xfdaa('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xfdaa('0x3'));var rimraf=require(_0xfdaa('0x4'));var config=require('../../config/environment');var attributes=require('./smsQueue.attributes');module[_0xfdaa('0x5')]=function(_0x233f3a,_0x4d5bd2){return _0x233f3a[_0xfdaa('0x6')](_0xfdaa('0x7'),attributes,{'tableName':_0xfdaa('0x8'),'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 1f3d8a1..59601f5 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 _0x6907=['debug','stringify','error','message','request\x20sent','result','GetSmsQueue','SmsQueue','findAll','raw','options','where','attributes','include','map','model','catch','ShowSmsQueue','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','defaults','localhost','socket.io-emitter','./smsQueue.socket','request','then','info','SmsQueue,\x20%s,\x20%s'];(function(_0x558976,_0x4f8b1e){var _0x41bad7=function(_0x2d5147){while(--_0x2d5147){_0x558976['push'](_0x558976['shift']());}};_0x41bad7(++_0x4f8b1e);}(_0x6907,0x17a));var _0x7690=function(_0x27ef21,_0x10f730){_0x27ef21=_0x27ef21-0x0;var _0x2639ed=_0x6907[_0x27ef21];return _0x2639ed;};'use strict';var _=require('lodash');var util=require(_0x7690('0x0'));var moment=require(_0x7690('0x1'));var BPromise=require(_0x7690('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7690('0x3'));var db=require(_0x7690('0x4'))['db'];var utils=require(_0x7690('0x5'));var logger=require(_0x7690('0x6'))('rpc');var config=require(_0x7690('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x7690('0x8')][_0x7690('0x9')]({'port':0x232a});config['redis']=_[_0x7690('0xa')](config['redis'],{'host':_0x7690('0xb'),'port':0x18eb});var socket=require(_0x7690('0xc'))(new Redis(config['redis']));require(_0x7690('0xd'))['register'](socket);function respondWithRpcPromise(_0x578cea,_0x3eac93,_0x564b7b){return new BPromise(function(_0x4a92de,_0x24adeb){return client[_0x7690('0xe')](_0x578cea,_0x564b7b)[_0x7690('0xf')](function(_0x1e52f8){logger[_0x7690('0x10')](_0x7690('0x11'),_0x3eac93,'request\x20sent');logger[_0x7690('0x12')]('SmsQueue,\x20%s,\x20%s,\x20%s',_0x3eac93,'request\x20sent',JSON[_0x7690('0x13')](_0x1e52f8));if(_0x1e52f8[_0x7690('0x14')]){if(_0x1e52f8[_0x7690('0x14')]['code']===0x1f4){logger[_0x7690('0x14')](_0x7690('0x11'),_0x3eac93,_0x1e52f8[_0x7690('0x14')][_0x7690('0x15')]);return _0x24adeb(_0x1e52f8[_0x7690('0x14')]['message']);}logger[_0x7690('0x14')](_0x7690('0x11'),_0x3eac93,_0x1e52f8[_0x7690('0x14')][_0x7690('0x15')]);return _0x4a92de(_0x1e52f8[_0x7690('0x14')]['message']);}else{logger[_0x7690('0x10')](_0x7690('0x11'),_0x3eac93,_0x7690('0x16'));_0x4a92de(_0x1e52f8[_0x7690('0x17')][_0x7690('0x15')]);}})['catch'](function(_0x2621eb){logger[_0x7690('0x14')](_0x7690('0x11'),_0x3eac93,_0x2621eb);_0x24adeb(_0x2621eb);});});}exports[_0x7690('0x18')]=function(_0x4d3fea){var _0x45ddf1=this;return new Promise(function(_0x59eebb,_0xf1e38f){return db[_0x7690('0x19')][_0x7690('0x1a')]({'raw':_0x4d3fea['options']?_0x4d3fea['options'][_0x7690('0x1b')]===undefined?!![]:![]:!![],'where':_0x4d3fea[_0x7690('0x1c')]?_0x4d3fea[_0x7690('0x1c')][_0x7690('0x1d')]||null:null,'attributes':_0x4d3fea[_0x7690('0x1c')]?_0x4d3fea[_0x7690('0x1c')][_0x7690('0x1e')]||null:null,'limit':_0x4d3fea[_0x7690('0x1c')]?_0x4d3fea[_0x7690('0x1c')]['limit']||null:null,'include':_0x4d3fea[_0x7690('0x1c')]?_0x4d3fea[_0x7690('0x1c')][_0x7690('0x1f')]?_[_0x7690('0x20')](_0x4d3fea[_0x7690('0x1c')]['include'],function(_0x2646bd){return{'model':db[_0x2646bd['model']],'as':_0x2646bd['as'],'attributes':_0x2646bd[_0x7690('0x1e')],'include':_0x2646bd[_0x7690('0x1f')]?_[_0x7690('0x20')](_0x2646bd[_0x7690('0x1f')],function(_0x599ed0){return{'model':db[_0x599ed0['model']],'as':_0x599ed0['as'],'attributes':_0x599ed0['attributes'],'include':_0x599ed0[_0x7690('0x1f')]?_['map'](_0x599ed0[_0x7690('0x1f')],function(_0x2d7e56){return{'model':db[_0x2d7e56[_0x7690('0x21')]],'as':_0x2d7e56['as'],'attributes':_0x2d7e56['attributes']};}):[]};}):[]};}):[]:[]})[_0x7690('0xf')](function(_0x5b4d06){logger[_0x7690('0x10')]('GetSmsQueue',_0x4d3fea);logger[_0x7690('0x12')](_0x7690('0x18'),_0x4d3fea,JSON[_0x7690('0x13')](_0x5b4d06));_0x59eebb(_0x5b4d06);})[_0x7690('0x22')](function(_0x4d7760){logger[_0x7690('0x14')](_0x7690('0x18'),_0x4d7760['message'],_0x4d3fea);_0xf1e38f(_0x45ddf1[_0x7690('0x14')](0x1f4,_0x4d7760['message']));});});};exports['ShowSmsQueue']=function(_0x2b457d){var _0x50554f=this;return new Promise(function(_0x16c2f0,_0x570d0d){return db['SmsQueue']['find']({'raw':_0x2b457d[_0x7690('0x1c')]?_0x2b457d[_0x7690('0x1c')][_0x7690('0x1b')]===undefined?!![]:![]:!![],'where':_0x2b457d['options']?_0x2b457d[_0x7690('0x1c')][_0x7690('0x1d')]||null:null,'attributes':_0x2b457d['options']?_0x2b457d[_0x7690('0x1c')]['attributes']||null:null,'include':_0x2b457d[_0x7690('0x1c')]?_0x2b457d[_0x7690('0x1c')]['include']?_[_0x7690('0x20')](_0x2b457d[_0x7690('0x1c')][_0x7690('0x1f')],function(_0x4b1784){return{'model':db[_0x4b1784[_0x7690('0x21')]],'as':_0x4b1784['as'],'attributes':_0x4b1784[_0x7690('0x1e')],'include':_0x4b1784[_0x7690('0x1f')]?_[_0x7690('0x20')](_0x4b1784['include'],function(_0x3571e3){return{'model':db[_0x3571e3['model']],'as':_0x3571e3['as'],'attributes':_0x3571e3['attributes'],'include':_0x3571e3[_0x7690('0x1f')]?_[_0x7690('0x20')](_0x3571e3['include'],function(_0x36a8ae){return{'model':db[_0x36a8ae[_0x7690('0x21')]],'as':_0x36a8ae['as'],'attributes':_0x36a8ae[_0x7690('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x7690('0xf')](function(_0x6c7699){logger[_0x7690('0x10')](_0x7690('0x23'),_0x2b457d);logger[_0x7690('0x12')](_0x7690('0x23'),_0x2b457d,JSON['stringify'](_0x6c7699));_0x16c2f0(_0x6c7699);})[_0x7690('0x22')](function(_0x4b172b){logger[_0x7690('0x14')](_0x7690('0x23'),_0x4b172b['message'],_0x2b457d);_0x570d0d(_0x50554f['error'](0x1f4,_0x4b172b[_0x7690('0x15')]));});});}; \ No newline at end of file +var _0x991d=['register','request','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','findAll','options','raw','where','limit','model','include','attributes','map','then','info','GetSmsQueue','catch','ShowSmsQueue','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','socket.io-emitter'];(function(_0x4c6adc,_0x5385c8){var _0x4909ef=function(_0x37647b){while(--_0x37647b){_0x4c6adc['push'](_0x4c6adc['shift']());}};_0x4909ef(++_0x5385c8);}(_0x991d,0x11a));var _0xd991=function(_0x480e35,_0x100dc5){_0x480e35=_0x480e35-0x0;var _0x3e6e57=_0x991d[_0x480e35];return _0x3e6e57;};'use strict';var _=require(_0xd991('0x0'));var util=require('util');var moment=require(_0xd991('0x1'));var BPromise=require(_0xd991('0x2'));var rs=require(_0xd991('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd991('0x4'))['db'];var utils=require(_0xd991('0x5'));var logger=require(_0xd991('0x6'))(_0xd991('0x7'));var config=require(_0xd991('0x8'));var jayson=require(_0xd991('0x9'));var client=jayson[_0xd991('0xa')]['http']({'port':0x232a});config[_0xd991('0xb')]=_[_0xd991('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xd991('0xd'))(new Redis(config[_0xd991('0xb')]));require('./smsQueue.socket')[_0xd991('0xe')](socket);function respondWithRpcPromise(_0x154121,_0x1704cf,_0x58a679){return new BPromise(function(_0x425e64,_0x4365cb){return client[_0xd991('0xf')](_0x154121,_0x58a679)['then'](function(_0x278b40){logger['info'](_0xd991('0x10'),_0x1704cf,_0xd991('0x11'));logger[_0xd991('0x12')](_0xd991('0x13'),_0x1704cf,'request\x20sent',JSON[_0xd991('0x14')](_0x278b40));if(_0x278b40[_0xd991('0x15')]){if(_0x278b40['error']['code']===0x1f4){logger[_0xd991('0x15')](_0xd991('0x10'),_0x1704cf,_0x278b40[_0xd991('0x15')][_0xd991('0x16')]);return _0x4365cb(_0x278b40[_0xd991('0x15')]['message']);}logger[_0xd991('0x15')](_0xd991('0x10'),_0x1704cf,_0x278b40[_0xd991('0x15')][_0xd991('0x16')]);return _0x425e64(_0x278b40[_0xd991('0x15')][_0xd991('0x16')]);}else{logger['info']('SmsQueue,\x20%s,\x20%s',_0x1704cf,_0xd991('0x11'));_0x425e64(_0x278b40['result']['message']);}})['catch'](function(_0x428d58){logger['error'](_0xd991('0x10'),_0x1704cf,_0x428d58);_0x4365cb(_0x428d58);});});}exports['GetSmsQueue']=function(_0x8eb29){var _0x24daef=this;return new Promise(function(_0xd961ed,_0x122f0a){return db['SmsQueue'][_0xd991('0x17')]({'raw':_0x8eb29[_0xd991('0x18')]?_0x8eb29['options'][_0xd991('0x19')]===undefined?!![]:![]:!![],'where':_0x8eb29[_0xd991('0x18')]?_0x8eb29[_0xd991('0x18')][_0xd991('0x1a')]||null:null,'attributes':_0x8eb29['options']?_0x8eb29[_0xd991('0x18')]['attributes']||null:null,'limit':_0x8eb29[_0xd991('0x18')]?_0x8eb29[_0xd991('0x18')][_0xd991('0x1b')]||null:null,'include':_0x8eb29[_0xd991('0x18')]?_0x8eb29['options']['include']?_['map'](_0x8eb29['options']['include'],function(_0x5441db){return{'model':db[_0x5441db[_0xd991('0x1c')]],'as':_0x5441db['as'],'attributes':_0x5441db['attributes'],'include':_0x5441db[_0xd991('0x1d')]?_['map'](_0x5441db[_0xd991('0x1d')],function(_0x54c651){return{'model':db[_0x54c651['model']],'as':_0x54c651['as'],'attributes':_0x54c651[_0xd991('0x1e')],'include':_0x54c651[_0xd991('0x1d')]?_[_0xd991('0x1f')](_0x54c651[_0xd991('0x1d')],function(_0x15408f){return{'model':db[_0x15408f[_0xd991('0x1c')]],'as':_0x15408f['as'],'attributes':_0x15408f['attributes']};}):[]};}):[]};}):[]:[]})[_0xd991('0x20')](function(_0xd43bf8){logger[_0xd991('0x21')](_0xd991('0x22'),_0x8eb29);logger[_0xd991('0x12')](_0xd991('0x22'),_0x8eb29,JSON[_0xd991('0x14')](_0xd43bf8));_0xd961ed(_0xd43bf8);})[_0xd991('0x23')](function(_0x54b210){logger[_0xd991('0x15')]('GetSmsQueue',_0x54b210['message'],_0x8eb29);_0x122f0a(_0x24daef[_0xd991('0x15')](0x1f4,_0x54b210[_0xd991('0x16')]));});});};exports[_0xd991('0x24')]=function(_0x11568f){var _0xf8b6da=this;return new Promise(function(_0x506c87,_0x33e5d2){return db['SmsQueue']['find']({'raw':_0x11568f[_0xd991('0x18')]?_0x11568f[_0xd991('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x11568f[_0xd991('0x18')]?_0x11568f['options'][_0xd991('0x1a')]||null:null,'attributes':_0x11568f['options']?_0x11568f[_0xd991('0x18')][_0xd991('0x1e')]||null:null,'include':_0x11568f['options']?_0x11568f[_0xd991('0x18')]['include']?_[_0xd991('0x1f')](_0x11568f['options'][_0xd991('0x1d')],function(_0x4cc270){return{'model':db[_0x4cc270[_0xd991('0x1c')]],'as':_0x4cc270['as'],'attributes':_0x4cc270[_0xd991('0x1e')],'include':_0x4cc270['include']?_['map'](_0x4cc270[_0xd991('0x1d')],function(_0x4c708b){return{'model':db[_0x4c708b['model']],'as':_0x4c708b['as'],'attributes':_0x4c708b[_0xd991('0x1e')],'include':_0x4c708b['include']?_['map'](_0x4c708b['include'],function(_0x2b2f85){return{'model':db[_0x2b2f85[_0xd991('0x1c')]],'as':_0x2b2f85['as'],'attributes':_0x2b2f85[_0xd991('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xd991('0x20')](function(_0x1b31d7){logger[_0xd991('0x21')](_0xd991('0x24'),_0x11568f);logger[_0xd991('0x12')](_0xd991('0x24'),_0x11568f,JSON['stringify'](_0x1b31d7));_0x506c87(_0x1b31d7);})['catch'](function(_0x28f6c2){logger[_0xd991('0x15')](_0xd991('0x24'),_0x28f6c2['message'],_0x11568f);_0x33e5d2(_0xf8b6da['error'](0x1f4,_0x28f6c2[_0xd991('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index 0dc94b4..64c41ba 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 _0x796a=['remove','update','removeListener','register','length','smsQueue:'];(function(_0xc2d734,_0x50e208){var _0x30526e=function(_0x2139ff){while(--_0x2139ff){_0xc2d734['push'](_0xc2d734['shift']());}};_0x30526e(++_0x50e208);}(_0x796a,0xc6));var _0xa796=function(_0x481844,_0x259b1f){_0x481844=_0x481844-0x0;var _0x2afc17=_0x796a[_0x481844];return _0x2afc17;};'use strict';var SmsQueueEvents=require('./smsQueue.events');var events=['save',_0xa796('0x0'),_0xa796('0x1')];function createListener(_0xf7042e,_0x358076){return function(_0x5150f5){_0x358076['emit'](_0xf7042e,_0x5150f5);};}function removeListener(_0x78dcb0,_0x5797da){return function(){SmsQueueEvents[_0xa796('0x2')](_0x78dcb0,_0x5797da);};}exports[_0xa796('0x3')]=function(_0x48a201){for(var _0x300d2a=0x0,_0x373eb2=events[_0xa796('0x4')];_0x300d2a<_0x373eb2;_0x300d2a++){var _0xb5b011=events[_0x300d2a];var _0x134696=createListener(_0xa796('0x5')+_0xb5b011,_0x48a201);SmsQueueEvents['on'](_0xb5b011,_0x134696);}}; \ No newline at end of file +var _0xe8ea=['update','emit','removeListener','register','length','smsQueue:','./smsQueue.events','save'];(function(_0x7a46ce,_0x5a21a1){var _0x280e34=function(_0x237e94){while(--_0x237e94){_0x7a46ce['push'](_0x7a46ce['shift']());}};_0x280e34(++_0x5a21a1);}(_0xe8ea,0x18e));var _0xae8e=function(_0x16063b,_0x223098){_0x16063b=_0x16063b-0x0;var _0x145aff=_0xe8ea[_0x16063b];return _0x145aff;};'use strict';var SmsQueueEvents=require(_0xae8e('0x0'));var events=[_0xae8e('0x1'),'remove',_0xae8e('0x2')];function createListener(_0x3e5d24,_0x4c6e00){return function(_0x4830e6){_0x4c6e00[_0xae8e('0x3')](_0x3e5d24,_0x4830e6);};}function removeListener(_0x39131d,_0x22251c){return function(){SmsQueueEvents[_0xae8e('0x4')](_0x39131d,_0x22251c);};}exports[_0xae8e('0x5')]=function(_0x2e39a3){for(var _0x2c15e9=0x0,_0x4b1c88=events[_0xae8e('0x6')];_0x2c15e9<_0x4b1c88;_0x2c15e9++){var _0x458dda=events[_0x2c15e9];var _0x199ce3=createListener(_0xae8e('0x7')+_0x458dda,_0x2e39a3);SmsQueueEvents['on'](_0x458dda,_0x199ce3);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index 609510a..8d956de 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 _0x6317=['post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show'];(function(_0x3ec2ea,_0x2d4e0f){var _0x43e7ce=function(_0x2f36bf){while(--_0x2f36bf){_0x3ec2ea['push'](_0x3ec2ea['shift']());}};_0x43e7ce(++_0x2d4e0f);}(_0x6317,0x11a));var _0x7631=function(_0x3d7905,_0x4ed48a){_0x3d7905=_0x3d7905-0x0;var _0x5eb929=_0x6317[_0x3d7905];return _0x5eb929;};'use strict';var multer=require(_0x7631('0x0'));var util=require(_0x7631('0x1'));var path=require(_0x7631('0x2'));var timeout=require(_0x7631('0x3'));var express=require(_0x7631('0x4'));var router=express[_0x7631('0x5')]();var fs_extra=require(_0x7631('0x6'));var auth=require(_0x7631('0x7'));var interaction=require(_0x7631('0x8'));var config=require(_0x7631('0x9'));var controller=require(_0x7631('0xa'));router[_0x7631('0xb')]('/',auth['isAuthenticated'](),controller[_0x7631('0xc')]);router[_0x7631('0xb')](_0x7631('0xd'),auth[_0x7631('0xe')](),controller[_0x7631('0xf')]);router[_0x7631('0xb')](_0x7631('0x10'),auth[_0x7631('0xe')](),controller[_0x7631('0x11')]);router[_0x7631('0x12')]('/',auth[_0x7631('0xe')](),controller[_0x7631('0x13')]);router[_0x7631('0x14')]('/:id',auth['isAuthenticated'](),controller[_0x7631('0x15')]);router[_0x7631('0x16')](_0x7631('0x10'),auth['isAuthenticated'](),controller[_0x7631('0x17')]);module[_0x7631('0x18')]=router; \ No newline at end of file +var _0x15a9=['delete','/:id','destroy','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','get','isAuthenticated','index','/describe','describe','show','post','create','put','update'];(function(_0x407b52,_0x5ddf71){var _0x58f49c=function(_0x1bd2cb){while(--_0x1bd2cb){_0x407b52['push'](_0x407b52['shift']());}};_0x58f49c(++_0x5ddf71);}(_0x15a9,0x18a));var _0x915a=function(_0xd41fed,_0x26987e){_0xd41fed=_0xd41fed-0x0;var _0x4f6dab=_0x15a9[_0xd41fed];return _0x4f6dab;};'use strict';var multer=require(_0x915a('0x0'));var util=require(_0x915a('0x1'));var path=require(_0x915a('0x2'));var timeout=require(_0x915a('0x3'));var express=require('express');var router=express[_0x915a('0x4')]();var fs_extra=require(_0x915a('0x5'));var auth=require(_0x915a('0x6'));var interaction=require(_0x915a('0x7'));var config=require(_0x915a('0x8'));var controller=require(_0x915a('0x9'));router[_0x915a('0xa')]('/',auth[_0x915a('0xb')](),controller[_0x915a('0xc')]);router[_0x915a('0xa')](_0x915a('0xd'),auth[_0x915a('0xb')](),controller[_0x915a('0xe')]);router['get']('/:id',auth[_0x915a('0xb')](),controller[_0x915a('0xf')]);router[_0x915a('0x10')]('/',auth[_0x915a('0xb')](),controller[_0x915a('0x11')]);router[_0x915a('0x12')]('/:id',auth[_0x915a('0xb')](),controller[_0x915a('0x13')]);router[_0x915a('0x14')](_0x915a('0x15'),auth[_0x915a('0xb')](),controller[_0x915a('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index bd47473..45b15a3 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 _0x687d=['DATE','moment','sequelize','exports','STRING'];(function(_0x3707ad,_0x1d477f){var _0x2767cb=function(_0x2e3786){while(--_0x2e3786){_0x3707ad['push'](_0x3707ad['shift']());}};_0x2767cb(++_0x1d477f);}(_0x687d,0x187));var _0xd687=function(_0x4aefc9,_0x27bfdc){_0x4aefc9=_0x4aefc9-0x0;var _0x1537a4=_0x687d[_0x4aefc9];return _0x1537a4;};'use strict';var moment=require(_0xd687('0x0'));var Sequelize=require(_0xd687('0x1'));module[_0xd687('0x2')]={'uniqueid':{'type':Sequelize[_0xd687('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xd687('0x4')]},'acceptAt':{'type':Sequelize[_0xd687('0x4')]},'exitAt':{'type':Sequelize[_0xd687('0x4')]},'reason':{'type':Sequelize[_0xd687('0x3')]}}; \ No newline at end of file +var _0x4965=['STRING','DATE','moment','sequelize','exports'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x4965,0x66));var _0x5496=function(_0x4eefe6,_0x1202ce){_0x4eefe6=_0x4eefe6-0x0;var _0x22b387=_0x4965[_0x4eefe6];return _0x22b387;};'use strict';var moment=require(_0x5496('0x0'));var Sequelize=require(_0x5496('0x1'));module[_0x5496('0x2')]={'uniqueid':{'type':Sequelize[_0x5496('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x5496('0x4')]},'leaveAt':{'type':Sequelize[_0x5496('0x4')]},'acceptAt':{'type':Sequelize[_0x5496('0x4')]},'exitAt':{'type':Sequelize[_0x5496('0x4')]},'reason':{'type':Sequelize[_0x5496('0x3')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index 904d5c2..f2b23e1 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 _0xa455=['crypto','desk.js','to-csv','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error','stack','name','map','SmsQueueReport','rawAttributes','fieldName','type','key','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','filters','filter','merge','VIRTUAL','options','where','includeAll','include','catch','show','create','body','find','params','destroy','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','path','sox','fs-extra','lodash','squel'];(function(_0x5a3b77,_0x390db8){var _0x36bc8a=function(_0x22abf6){while(--_0x22abf6){_0x5a3b77['push'](_0x5a3b77['shift']());}};_0x36bc8a(++_0x390db8);}(_0xa455,0x154));var _0x5a45=function(_0x2b8e6c,_0x2720a5){_0x2b8e6c=_0x2b8e6c-0x0;var _0x1e49c0=_0xa455[_0x2b8e6c];return _0x1e49c0;};'use strict';var emlformat=require(_0x5a45('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5a45('0x1'));var jsonpatch=require(_0x5a45('0x2'));var rp=require(_0x5a45('0x3'));var moment=require(_0x5a45('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x5a45('0x5'));var sox=require(_0x5a45('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5a45('0x7'));var _=require(_0x5a45('0x8'));var squel=require(_0x5a45('0x9'));var crypto=require(_0x5a45('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x5a45('0xb'));var toCsv=require(_0x5a45('0xc'));var querystring=require(_0x5a45('0xd'));var Papa=require('papaparse');var Redis=require(_0x5a45('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x5a45('0xf'));var hardwareService=require(_0x5a45('0x10'));var logger=require('../../config/logger')(_0x5a45('0x11'));var utils=require(_0x5a45('0x12'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x5a45('0x13'))['db'];function respondWithStatusCode(_0x12f230,_0x2e8bed){_0x2e8bed=_0x2e8bed||0xcc;return function(_0x3ad4b1){if(_0x3ad4b1){return _0x12f230[_0x5a45('0x14')](_0x2e8bed);}return _0x12f230[_0x5a45('0x15')](_0x2e8bed)[_0x5a45('0x16')]();};}function respondWithResult(_0x4e0796,_0x1708c0){_0x1708c0=_0x1708c0||0xc8;return function(_0x56fd95){if(_0x56fd95){return _0x4e0796['status'](_0x1708c0)[_0x5a45('0x17')](_0x56fd95);}};}function respondWithFilteredResult(_0xf5ec0d,_0x119a06){return function(_0x202716){if(_0x202716){var _0x254de2=typeof _0x119a06[_0x5a45('0x18')]===_0x5a45('0x19')&&typeof _0x119a06[_0x5a45('0x1a')]===_0x5a45('0x19');var _0x2b9df2=_0x202716[_0x5a45('0x1b')];var _0x56372e=_0x254de2?0x0:_0x119a06[_0x5a45('0x18')];var _0x1cfa57=_0x254de2?_0x202716[_0x5a45('0x1b')]:_0x119a06['offset']+_0x119a06[_0x5a45('0x1a')];var _0x6aaf95;if(_0x1cfa57>=_0x2b9df2){_0x1cfa57=_0x2b9df2;_0x6aaf95=0xc8;}else{_0x6aaf95=0xce;}_0xf5ec0d[_0x5a45('0x15')](_0x6aaf95);return _0xf5ec0d[_0x5a45('0x1c')](_0x5a45('0x1d'),_0x56372e+'-'+_0x1cfa57+'/'+_0x2b9df2)[_0x5a45('0x17')](_0x202716);}return null;};}function patchUpdates(_0x47f996){return function(_0x31c8a8){try{jsonpatch[_0x5a45('0x1e')](_0x31c8a8,_0x47f996,!![]);}catch(_0x28443d){return BPromise[_0x5a45('0x1f')](_0x28443d);}return _0x31c8a8[_0x5a45('0x20')]();};}function saveUpdates(_0xfd305e,_0xc6c8d3){return function(_0x29bb92){if(_0x29bb92){return _0x29bb92[_0x5a45('0x21')](_0xfd305e)['then'](function(_0x37d987){return _0x37d987;});}return null;};}function removeEntity(_0x370b4c,_0x3fb40c){return function(_0x264f9a){if(_0x264f9a){return _0x264f9a['destroy']()[_0x5a45('0x22')](function(){_0x370b4c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x395ea3,_0xf0ec04){return function(_0x1b94ed){if(!_0x1b94ed){_0x395ea3['sendStatus'](0x194);}return _0x1b94ed;};}function handleError(_0x5ea3f8,_0x4b7786){_0x4b7786=_0x4b7786||0x1f4;return function(_0x35c4e0){logger[_0x5a45('0x23')](_0x35c4e0[_0x5a45('0x24')]);if(_0x35c4e0[_0x5a45('0x25')]){delete _0x35c4e0['name'];}_0x5ea3f8[_0x5a45('0x15')](_0x4b7786)['send'](_0x35c4e0);};}exports['index']=function(_0x18fd14,_0x1e4e4c){var _0xe94a17={},_0x2fee10={},_0x10641b={'count':0x0,'rows':[]};var _0x3231f2=_[_0x5a45('0x26')](db[_0x5a45('0x27')][_0x5a45('0x28')],function(_0x37911a){return{'name':_0x37911a[_0x5a45('0x29')],'type':_0x37911a[_0x5a45('0x2a')][_0x5a45('0x2b')]};});_0x2fee10['model']=_[_0x5a45('0x26')](_0x3231f2,'name');_0x2fee10[_0x5a45('0x2c')]=_[_0x5a45('0x2d')](_0x18fd14[_0x5a45('0x2c')]);_0x2fee10['filters']=_[_0x5a45('0x2e')](_0x2fee10['model'],_0x2fee10[_0x5a45('0x2c')]);_0xe94a17['attributes']=_[_0x5a45('0x2e')](_0x2fee10[_0x5a45('0x2f')],qs['fields'](_0x18fd14['query'][_0x5a45('0x30')]));_0xe94a17[_0x5a45('0x31')]=_0xe94a17[_0x5a45('0x31')][_0x5a45('0x32')]?_0xe94a17[_0x5a45('0x31')]:_0x2fee10[_0x5a45('0x2f')];if(!_0x18fd14[_0x5a45('0x2c')][_0x5a45('0x33')](_0x5a45('0x34'))){_0xe94a17[_0x5a45('0x1a')]=qs[_0x5a45('0x1a')](_0x18fd14[_0x5a45('0x2c')]['limit']);_0xe94a17[_0x5a45('0x18')]=qs['offset'](_0x18fd14['query'][_0x5a45('0x18')]);}_0xe94a17['order']=qs[_0x5a45('0x35')](_0x18fd14[_0x5a45('0x2c')][_0x5a45('0x35')]);_0xe94a17['where']=qs[_0x5a45('0x36')](_['pick'](_0x18fd14[_0x5a45('0x2c')],_0x2fee10['filters']),_0x3231f2);if(_0x18fd14[_0x5a45('0x2c')][_0x5a45('0x37')]){_0xe94a17['where']=_[_0x5a45('0x38')](_0xe94a17['where'],{'$or':_[_0x5a45('0x26')](_0x3231f2,function(_0x408331){if(_0x408331['type']!==_0x5a45('0x39')){var _0x4c5ff0={};_0x4c5ff0[_0x408331['name']]={'$like':'%'+_0x18fd14[_0x5a45('0x2c')][_0x5a45('0x37')]+'%'};return _0x4c5ff0;}})});}_0xe94a17=_[_0x5a45('0x38')]({},_0xe94a17,_0x18fd14[_0x5a45('0x3a')]);var _0x2ea7a5={'where':_0xe94a17[_0x5a45('0x3b')]};return db['SmsQueueReport']['count'](_0x2ea7a5)[_0x5a45('0x22')](function(_0x5f2c33){_0x10641b[_0x5a45('0x1b')]=_0x5f2c33;if(_0x18fd14[_0x5a45('0x2c')][_0x5a45('0x3c')]){_0xe94a17[_0x5a45('0x3d')]=[{'all':!![]}];}return db[_0x5a45('0x27')]['findAll'](_0xe94a17);})[_0x5a45('0x22')](function(_0x106e25){_0x10641b['rows']=_0x106e25;return _0x10641b;})[_0x5a45('0x22')](respondWithFilteredResult(_0x1e4e4c,_0xe94a17))[_0x5a45('0x3e')](handleError(_0x1e4e4c,null));};exports[_0x5a45('0x3f')]=function(_0x5676f6,_0x1ec7cb){var _0x48076c={'raw':!![],'where':{'id':_0x5676f6['params']['id']}},_0x4a6d86={};_0x4a6d86['model']=_['keys'](db[_0x5a45('0x27')]['rawAttributes']);_0x4a6d86[_0x5a45('0x2c')]=_['keys'](_0x5676f6[_0x5a45('0x2c')]);_0x4a6d86[_0x5a45('0x36')]=_[_0x5a45('0x2e')](_0x4a6d86[_0x5a45('0x2f')],_0x4a6d86[_0x5a45('0x2c')]);_0x48076c['attributes']=_['intersection'](_0x4a6d86[_0x5a45('0x2f')],qs['fields'](_0x5676f6[_0x5a45('0x2c')][_0x5a45('0x30')]));_0x48076c[_0x5a45('0x31')]=_0x48076c[_0x5a45('0x31')]['length']?_0x48076c['attributes']:_0x4a6d86['model'];if(_0x5676f6[_0x5a45('0x2c')][_0x5a45('0x3c')]){_0x48076c[_0x5a45('0x3d')]=[{'all':!![]}];}_0x48076c=_[_0x5a45('0x38')]({},_0x48076c,_0x5676f6[_0x5a45('0x3a')]);return db[_0x5a45('0x27')]['find'](_0x48076c)['then'](handleEntityNotFound(_0x1ec7cb,null))[_0x5a45('0x22')](respondWithResult(_0x1ec7cb,null))[_0x5a45('0x3e')](handleError(_0x1ec7cb,null));};exports[_0x5a45('0x40')]=function(_0x53b49b,_0x5c6c3a){return db['SmsQueueReport'][_0x5a45('0x40')](_0x53b49b['body'],{})[_0x5a45('0x22')](respondWithResult(_0x5c6c3a,0xc9))[_0x5a45('0x3e')](handleError(_0x5c6c3a,null));};exports[_0x5a45('0x21')]=function(_0x1a2f39,_0x2c3a43){if(_0x1a2f39[_0x5a45('0x41')]['id']){delete _0x1a2f39[_0x5a45('0x41')]['id'];}return db[_0x5a45('0x27')][_0x5a45('0x42')]({'where':{'id':_0x1a2f39[_0x5a45('0x43')]['id']}})[_0x5a45('0x22')](handleEntityNotFound(_0x2c3a43,null))[_0x5a45('0x22')](saveUpdates(_0x1a2f39['body'],null))[_0x5a45('0x22')](respondWithResult(_0x2c3a43,null))[_0x5a45('0x3e')](handleError(_0x2c3a43,null));};exports[_0x5a45('0x44')]=function(_0xc9c93e,_0x18c9c9){return db[_0x5a45('0x27')][_0x5a45('0x42')]({'where':{'id':_0xc9c93e['params']['id']}})[_0x5a45('0x22')](handleEntityNotFound(_0x18c9c9,null))[_0x5a45('0x22')](removeEntity(_0x18c9c9,null))[_0x5a45('0x3e')](handleError(_0x18c9c9,null));};exports[_0x5a45('0x45')]=function(_0x467669,_0x514796){return db['SmsQueueReport'][_0x5a45('0x45')]()[_0x5a45('0x22')](respondWithResult(_0x514796,null))[_0x5a45('0x3e')](handleError(_0x514796,null));}; \ No newline at end of file +var _0x5260=['attributes','nolimit','order','sort','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','show','params','rawAttributes','length','find','catch','create','body','describe','rimraf','zip-dir','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','destroy','sendStatus','error','stack','name','send','map','SmsQueueReport','fieldName','type','key','model','query','keys','intersection','fields'];(function(_0x1a2fa7,_0x222083){var _0x5a6bf1=function(_0x1b7971){while(--_0x1b7971){_0x1a2fa7['push'](_0x1a2fa7['shift']());}};_0x5a6bf1(++_0x222083);}(_0x5260,0x182));var _0x0526=function(_0x359e7b,_0x20e135){_0x359e7b=_0x359e7b-0x0;var _0x49c0d5=_0x5260[_0x359e7b];return _0x49c0d5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0526('0x0'));var zipdir=require(_0x0526('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x0526('0x2'));var Mustache=require(_0x0526('0x3'));var util=require(_0x0526('0x4'));var path=require(_0x0526('0x5'));var sox=require(_0x0526('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0526('0x7'));var _=require(_0x0526('0x8'));var squel=require(_0x0526('0x9'));var crypto=require(_0x0526('0xa'));var jsforce=require(_0x0526('0xb'));var deskjs=require(_0x0526('0xc'));var toCsv=require('to-csv');var querystring=require(_0x0526('0xd'));var Papa=require(_0x0526('0xe'));var Redis=require(_0x0526('0xf'));var authService=require(_0x0526('0x10'));var qs=require(_0x0526('0x11'));var as=require(_0x0526('0x12'));var hardwareService=require(_0x0526('0x13'));var logger=require(_0x0526('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x0526('0x15'));var licenseUtil=require(_0x0526('0x16'));var db=require(_0x0526('0x17'))['db'];function respondWithStatusCode(_0x34dff2,_0x376ba6){_0x376ba6=_0x376ba6||0xcc;return function(_0x52684b){if(_0x52684b){return _0x34dff2['sendStatus'](_0x376ba6);}return _0x34dff2[_0x0526('0x18')](_0x376ba6)[_0x0526('0x19')]();};}function respondWithResult(_0x589bb0,_0x3b609f){_0x3b609f=_0x3b609f||0xc8;return function(_0x3ffa7b){if(_0x3ffa7b){return _0x589bb0['status'](_0x3b609f)[_0x0526('0x1a')](_0x3ffa7b);}};}function respondWithFilteredResult(_0x48b8d3,_0x1795b3){return function(_0x274180){if(_0x274180){var _0x5e5978=typeof _0x1795b3[_0x0526('0x1b')]===_0x0526('0x1c')&&typeof _0x1795b3[_0x0526('0x1d')]===_0x0526('0x1c');var _0x330689=_0x274180[_0x0526('0x1e')];var _0x376022=_0x5e5978?0x0:_0x1795b3['offset'];var _0x198d61=_0x5e5978?_0x274180['count']:_0x1795b3[_0x0526('0x1b')]+_0x1795b3[_0x0526('0x1d')];var _0x5bc721;if(_0x198d61>=_0x330689){_0x198d61=_0x330689;_0x5bc721=0xc8;}else{_0x5bc721=0xce;}_0x48b8d3[_0x0526('0x18')](_0x5bc721);return _0x48b8d3['set'](_0x0526('0x1f'),_0x376022+'-'+_0x198d61+'/'+_0x330689)['json'](_0x274180);}return null;};}function patchUpdates(_0x5a0498){return function(_0x573547){try{jsonpatch[_0x0526('0x20')](_0x573547,_0x5a0498,!![]);}catch(_0x116b8e){return BPromise['reject'](_0x116b8e);}return _0x573547[_0x0526('0x21')]();};}function saveUpdates(_0x5a6108,_0x197e7b){return function(_0x12e4d2){if(_0x12e4d2){return _0x12e4d2[_0x0526('0x22')](_0x5a6108)[_0x0526('0x23')](function(_0x262408){return _0x262408;});}return null;};}function removeEntity(_0x4678fe,_0x9db293){return function(_0xe88a38){if(_0xe88a38){return _0xe88a38[_0x0526('0x24')]()[_0x0526('0x23')](function(){_0x4678fe[_0x0526('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3d6094,_0x1af9fe){return function(_0xf1fe90){if(!_0xf1fe90){_0x3d6094[_0x0526('0x25')](0x194);}return _0xf1fe90;};}function handleError(_0x5ca972,_0x434868){_0x434868=_0x434868||0x1f4;return function(_0x15ba50){logger[_0x0526('0x26')](_0x15ba50[_0x0526('0x27')]);if(_0x15ba50['name']){delete _0x15ba50[_0x0526('0x28')];}_0x5ca972[_0x0526('0x18')](_0x434868)[_0x0526('0x29')](_0x15ba50);};}exports['index']=function(_0x3dd036,_0x405f1d){var _0x8e2713={},_0x16baa2={},_0x3099c6={'count':0x0,'rows':[]};var _0x647b4c=_[_0x0526('0x2a')](db[_0x0526('0x2b')]['rawAttributes'],function(_0x36e907){return{'name':_0x36e907[_0x0526('0x2c')],'type':_0x36e907[_0x0526('0x2d')][_0x0526('0x2e')]};});_0x16baa2[_0x0526('0x2f')]=_[_0x0526('0x2a')](_0x647b4c,'name');_0x16baa2[_0x0526('0x30')]=_[_0x0526('0x31')](_0x3dd036[_0x0526('0x30')]);_0x16baa2['filters']=_[_0x0526('0x32')](_0x16baa2[_0x0526('0x2f')],_0x16baa2[_0x0526('0x30')]);_0x8e2713['attributes']=_[_0x0526('0x32')](_0x16baa2[_0x0526('0x2f')],qs[_0x0526('0x33')](_0x3dd036['query'][_0x0526('0x33')]));_0x8e2713[_0x0526('0x34')]=_0x8e2713[_0x0526('0x34')]['length']?_0x8e2713[_0x0526('0x34')]:_0x16baa2[_0x0526('0x2f')];if(!_0x3dd036[_0x0526('0x30')]['hasOwnProperty'](_0x0526('0x35'))){_0x8e2713['limit']=qs[_0x0526('0x1d')](_0x3dd036[_0x0526('0x30')]['limit']);_0x8e2713[_0x0526('0x1b')]=qs['offset'](_0x3dd036['query'][_0x0526('0x1b')]);}_0x8e2713[_0x0526('0x36')]=qs[_0x0526('0x37')](_0x3dd036[_0x0526('0x30')][_0x0526('0x37')]);_0x8e2713['where']=qs[_0x0526('0x38')](_[_0x0526('0x39')](_0x3dd036['query'],_0x16baa2[_0x0526('0x38')]),_0x647b4c);if(_0x3dd036['query'][_0x0526('0x3a')]){_0x8e2713['where']=_[_0x0526('0x3b')](_0x8e2713['where'],{'$or':_[_0x0526('0x2a')](_0x647b4c,function(_0x516e1c){if(_0x516e1c['type']!==_0x0526('0x3c')){var _0x4dafee={};_0x4dafee[_0x516e1c[_0x0526('0x28')]]={'$like':'%'+_0x3dd036[_0x0526('0x30')][_0x0526('0x3a')]+'%'};return _0x4dafee;}})});}_0x8e2713=_[_0x0526('0x3b')]({},_0x8e2713,_0x3dd036[_0x0526('0x3d')]);var _0x25b712={'where':_0x8e2713['where']};return db[_0x0526('0x2b')][_0x0526('0x1e')](_0x25b712)[_0x0526('0x23')](function(_0x412ad8){_0x3099c6[_0x0526('0x1e')]=_0x412ad8;if(_0x3dd036[_0x0526('0x30')][_0x0526('0x3e')]){_0x8e2713[_0x0526('0x3f')]=[{'all':!![]}];}return db['SmsQueueReport']['findAll'](_0x8e2713);})[_0x0526('0x23')](function(_0x302786){_0x3099c6['rows']=_0x302786;return _0x3099c6;})[_0x0526('0x23')](respondWithFilteredResult(_0x405f1d,_0x8e2713))['catch'](handleError(_0x405f1d,null));};exports[_0x0526('0x40')]=function(_0x1d5b79,_0x210f7a){var _0x2643a7={'raw':!![],'where':{'id':_0x1d5b79[_0x0526('0x41')]['id']}},_0xc490d4={};_0xc490d4['model']=_['keys'](db[_0x0526('0x2b')][_0x0526('0x42')]);_0xc490d4[_0x0526('0x30')]=_[_0x0526('0x31')](_0x1d5b79[_0x0526('0x30')]);_0xc490d4['filters']=_[_0x0526('0x32')](_0xc490d4[_0x0526('0x2f')],_0xc490d4['query']);_0x2643a7[_0x0526('0x34')]=_[_0x0526('0x32')](_0xc490d4[_0x0526('0x2f')],qs['fields'](_0x1d5b79[_0x0526('0x30')][_0x0526('0x33')]));_0x2643a7['attributes']=_0x2643a7[_0x0526('0x34')][_0x0526('0x43')]?_0x2643a7[_0x0526('0x34')]:_0xc490d4[_0x0526('0x2f')];if(_0x1d5b79[_0x0526('0x30')][_0x0526('0x3e')]){_0x2643a7[_0x0526('0x3f')]=[{'all':!![]}];}_0x2643a7=_['merge']({},_0x2643a7,_0x1d5b79['options']);return db[_0x0526('0x2b')][_0x0526('0x44')](_0x2643a7)[_0x0526('0x23')](handleEntityNotFound(_0x210f7a,null))[_0x0526('0x23')](respondWithResult(_0x210f7a,null))[_0x0526('0x45')](handleError(_0x210f7a,null));};exports[_0x0526('0x46')]=function(_0x12ef34,_0x59b157){return db[_0x0526('0x2b')][_0x0526('0x46')](_0x12ef34['body'],{})[_0x0526('0x23')](respondWithResult(_0x59b157,0xc9))[_0x0526('0x45')](handleError(_0x59b157,null));};exports[_0x0526('0x22')]=function(_0x3a9bd3,_0x2d1c9b){if(_0x3a9bd3[_0x0526('0x47')]['id']){delete _0x3a9bd3[_0x0526('0x47')]['id'];}return db['SmsQueueReport'][_0x0526('0x44')]({'where':{'id':_0x3a9bd3[_0x0526('0x41')]['id']}})[_0x0526('0x23')](handleEntityNotFound(_0x2d1c9b,null))['then'](saveUpdates(_0x3a9bd3[_0x0526('0x47')],null))['then'](respondWithResult(_0x2d1c9b,null))['catch'](handleError(_0x2d1c9b,null));};exports[_0x0526('0x24')]=function(_0x3a734b,_0x889b36){return db[_0x0526('0x2b')]['find']({'where':{'id':_0x3a734b[_0x0526('0x41')]['id']}})['then'](handleEntityNotFound(_0x889b36,null))[_0x0526('0x23')](removeEntity(_0x889b36,null))[_0x0526('0x45')](handleError(_0x889b36,null));};exports[_0x0526('0x48')]=function(_0x407787,_0x505c4f){return db[_0x0526('0x2b')][_0x0526('0x48')]()[_0x0526('0x23')](respondWithResult(_0x505c4f,null))[_0x0526('0x45')](handleError(_0x505c4f,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index e6f451d..23e8ce6 100644 --- a/server/api/smsQueueReport/smsQueueReport.model.js +++ b/server/api/smsQueueReport/smsQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['define','report_sms_queue','uniqueid','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x4bee58,_0x339370){var _0x5f04c5=function(_0x3f3318){while(--_0x3f3318){_0x4bee58['push'](_0x4bee58['shift']());}};_0x5f04c5(++_0x339370);}(_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 +var _0xb7e7=['../../config/logger','moment','request-promise','rimraf','../../config/environment','./smsQueueReport.attributes','define','SmsQueueReport','uniqueid','lodash'];(function(_0x3b9800,_0x4b405c){var _0x469d38=function(_0x1e67eb){while(--_0x1e67eb){_0x3b9800['push'](_0x3b9800['shift']());}};_0x469d38(++_0x4b405c);}(_0xb7e7,0x121));var _0x7b7e=function(_0x4b2863,_0x494899){_0x4b2863=_0x4b2863-0x0;var _0x567d67=_0xb7e7[_0x4b2863];return _0x567d67;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var logger=require(_0x7b7e('0x1'))('api');var moment=require(_0x7b7e('0x2'));var BPromise=require('bluebird');var rp=require(_0x7b7e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7b7e('0x4'));var config=require(_0x7b7e('0x5'));var attributes=require(_0x7b7e('0x6'));module['exports']=function(_0x53ed64,_0x333fa4){return _0x53ed64[_0x7b7e('0x7')](_0x7b7e('0x8'),attributes,{'tableName':'report_sms_queue','paranoid':![],'indexes':[{'name':_0x7b7e('0x9'),'fields':[_0x7b7e('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index 43c0741..c3c039e 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 _0xcaa3=['SmsQueueReport','body','options','raw','stringify','UpdateSmsQueueReport','where','attributes','limit','lodash','util','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','SmsQueueReport,\x20%s,\x20%s','SmsQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','CreateSmsQueueReport'];(function(_0x579df2,_0x38a239){var _0x1c3ede=function(_0x23f695){while(--_0x23f695){_0x579df2['push'](_0x579df2['shift']());}};_0x1c3ede(++_0x38a239);}(_0xcaa3,0xdb));var _0x3caa=function(_0x36ed48,_0x1ee0d4){_0x36ed48=_0x36ed48-0x0;var _0x51c63a=_0xcaa3[_0x36ed48];return _0x51c63a;};'use strict';var _=require(_0x3caa('0x0'));var util=require(_0x3caa('0x1'));var moment=require('moment');var BPromise=require(_0x3caa('0x2'));var rs=require(_0x3caa('0x3'));var fs=require('fs');var Redis=require(_0x3caa('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x3caa('0x5'))(_0x3caa('0x6'));var config=require(_0x3caa('0x7'));var jayson=require(_0x3caa('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2e97af,_0x449633,_0x357908){return new BPromise(function(_0x353252,_0x4cbfb6){return client[_0x3caa('0x9')](_0x2e97af,_0x357908)[_0x3caa('0xa')](function(_0x35f223){logger[_0x3caa('0xb')](_0x3caa('0xc'),_0x449633,'request\x20sent');logger['debug'](_0x3caa('0xd'),_0x449633,_0x3caa('0xe'),JSON['stringify'](_0x35f223));if(_0x35f223[_0x3caa('0xf')]){if(_0x35f223[_0x3caa('0xf')][_0x3caa('0x10')]===0x1f4){logger[_0x3caa('0xf')]('SmsQueueReport,\x20%s,\x20%s',_0x449633,_0x35f223['error'][_0x3caa('0x11')]);return _0x4cbfb6(_0x35f223[_0x3caa('0xf')][_0x3caa('0x11')]);}logger[_0x3caa('0xf')](_0x3caa('0xc'),_0x449633,_0x35f223[_0x3caa('0xf')]['message']);return _0x353252(_0x35f223['error'][_0x3caa('0x11')]);}else{logger[_0x3caa('0xb')](_0x3caa('0xc'),_0x449633,'request\x20sent');_0x353252(_0x35f223[_0x3caa('0x12')]['message']);}})[_0x3caa('0x13')](function(_0x396804){logger[_0x3caa('0xf')](_0x3caa('0xc'),_0x449633,_0x396804);_0x4cbfb6(_0x396804);});});}exports[_0x3caa('0x14')]=function(_0x115a44){var _0x14fb50=this;return new Promise(function(_0x5e66c8,_0x46ef0f){return db[_0x3caa('0x15')]['create'](_0x115a44[_0x3caa('0x16')],{'raw':_0x115a44[_0x3caa('0x17')]?_0x115a44[_0x3caa('0x17')][_0x3caa('0x18')]===undefined?!![]:![]:!![]})[_0x3caa('0xa')](function(_0x330c4c){logger[_0x3caa('0xb')]('CreateSmsQueueReport',_0x115a44);logger['debug'](_0x3caa('0x14'),_0x115a44,JSON[_0x3caa('0x19')](_0x330c4c));_0x5e66c8(_0x330c4c);})[_0x3caa('0x13')](function(_0x2d789b){logger['error'](_0x3caa('0x14'),_0x2d789b['message'],_0x115a44);_0x46ef0f(_0x14fb50[_0x3caa('0xf')](0x1f4,_0x2d789b['message']));});});};exports[_0x3caa('0x1a')]=function(_0x2fabf4){var _0x4d26be=this;return new Promise(function(_0x522249,_0x22063d){return db[_0x3caa('0x15')]['update'](_0x2fabf4[_0x3caa('0x16')],{'raw':_0x2fabf4['options']?_0x2fabf4[_0x3caa('0x17')][_0x3caa('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2fabf4[_0x3caa('0x17')]?_0x2fabf4[_0x3caa('0x17')][_0x3caa('0x1b')]||null:null,'attributes':_0x2fabf4[_0x3caa('0x17')]?_0x2fabf4[_0x3caa('0x17')][_0x3caa('0x1c')]||null:null,'limit':_0x2fabf4['options']?_0x2fabf4[_0x3caa('0x17')][_0x3caa('0x1d')]||null:null})[_0x3caa('0xa')](function(_0x3f7583){logger[_0x3caa('0xb')](_0x3caa('0x1a'),_0x2fabf4);logger['debug'](_0x3caa('0x1a'),_0x2fabf4,JSON[_0x3caa('0x19')](_0x3f7583));_0x522249(_0x3f7583);})[_0x3caa('0x13')](function(_0x412193){logger[_0x3caa('0xf')](_0x3caa('0x1a'),_0x412193[_0x3caa('0x11')],_0x2fabf4);_0x22063d(_0x4d26be[_0x3caa('0xf')](0x1f4,_0x412193[_0x3caa('0x11')]));});});}; \ No newline at end of file +var _0xbdce=['jayson/promise','client','http','request','then','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateSmsQueueReport','create','body','options','raw','UpdateSmsQueueReport','SmsQueueReport','update','attributes','debug','lodash','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x488254,_0x23650e){var _0x5201c1=function(_0x4ded48){while(--_0x4ded48){_0x488254['push'](_0x488254['shift']());}};_0x5201c1(++_0x23650e);}(_0xbdce,0x99));var _0xebdc=function(_0x4703b2,_0x598ac7){_0x4703b2=_0x4703b2-0x0;var _0x133fa1=_0xbdce[_0x4703b2];return _0x133fa1;};'use strict';var _=require(_0xebdc('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xebdc('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xebdc('0x2'))['db'];var utils=require(_0xebdc('0x3'));var logger=require(_0xebdc('0x4'))(_0xebdc('0x5'));var config=require(_0xebdc('0x6'));var jayson=require(_0xebdc('0x7'));var client=jayson[_0xebdc('0x8')][_0xebdc('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4b970d,_0x25a798,_0x4a027d){return new BPromise(function(_0x49c8cd,_0x536429){return client[_0xebdc('0xa')](_0x4b970d,_0x4a027d)[_0xebdc('0xb')](function(_0x1d2f55){logger[_0xebdc('0xc')](_0xebdc('0xd'),_0x25a798,_0xebdc('0xe'));logger['debug'](_0xebdc('0xf'),_0x25a798,'request\x20sent',JSON[_0xebdc('0x10')](_0x1d2f55));if(_0x1d2f55[_0xebdc('0x11')]){if(_0x1d2f55[_0xebdc('0x11')][_0xebdc('0x12')]===0x1f4){logger['error'](_0xebdc('0xd'),_0x25a798,_0x1d2f55['error'][_0xebdc('0x13')]);return _0x536429(_0x1d2f55['error'][_0xebdc('0x13')]);}logger['error'](_0xebdc('0xd'),_0x25a798,_0x1d2f55[_0xebdc('0x11')][_0xebdc('0x13')]);return _0x49c8cd(_0x1d2f55['error']['message']);}else{logger[_0xebdc('0xc')](_0xebdc('0xd'),_0x25a798,_0xebdc('0xe'));_0x49c8cd(_0x1d2f55[_0xebdc('0x14')]['message']);}})[_0xebdc('0x15')](function(_0x5a66fa){logger[_0xebdc('0x11')](_0xebdc('0xd'),_0x25a798,_0x5a66fa);_0x536429(_0x5a66fa);});});}exports[_0xebdc('0x16')]=function(_0x12e478){var _0x1b0fbb=this;return new Promise(function(_0x420d1f,_0x3b37dd){return db['SmsQueueReport'][_0xebdc('0x17')](_0x12e478[_0xebdc('0x18')],{'raw':_0x12e478[_0xebdc('0x19')]?_0x12e478[_0xebdc('0x19')][_0xebdc('0x1a')]===undefined?!![]:![]:!![]})[_0xebdc('0xb')](function(_0x33a737){logger[_0xebdc('0xc')]('CreateSmsQueueReport',_0x12e478);logger['debug']('CreateSmsQueueReport',_0x12e478,JSON[_0xebdc('0x10')](_0x33a737));_0x420d1f(_0x33a737);})[_0xebdc('0x15')](function(_0x4ce5b7){logger[_0xebdc('0x11')](_0xebdc('0x16'),_0x4ce5b7['message'],_0x12e478);_0x3b37dd(_0x1b0fbb[_0xebdc('0x11')](0x1f4,_0x4ce5b7[_0xebdc('0x13')]));});});};exports[_0xebdc('0x1b')]=function(_0x22a46c){var _0x70d739=this;return new Promise(function(_0xf5dd2b,_0x163ca2){return db[_0xebdc('0x1c')][_0xebdc('0x1d')](_0x22a46c[_0xebdc('0x18')],{'raw':_0x22a46c['options']?_0x22a46c[_0xebdc('0x19')][_0xebdc('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x22a46c[_0xebdc('0x19')]?_0x22a46c[_0xebdc('0x19')]['where']||null:null,'attributes':_0x22a46c[_0xebdc('0x19')]?_0x22a46c['options'][_0xebdc('0x1e')]||null:null,'limit':_0x22a46c[_0xebdc('0x19')]?_0x22a46c[_0xebdc('0x19')]['limit']||null:null})['then'](function(_0x4aa151){logger[_0xebdc('0xc')](_0xebdc('0x1b'),_0x22a46c);logger[_0xebdc('0x1f')](_0xebdc('0x1b'),_0x22a46c,JSON['stringify'](_0x4aa151));_0xf5dd2b(_0x4aa151);})['catch'](function(_0x11064b){logger[_0xebdc('0x11')](_0xebdc('0x1b'),_0x11064b[_0xebdc('0x13')],_0x22a46c);_0x163ca2(_0x70d739[_0xebdc('0x11')](0x1f4,_0x11064b[_0xebdc('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index ea2ee40..a2a06cd 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 _0x72b1=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','path'];(function(_0x5f5122,_0x4e689a){var _0x2298ab=function(_0x5373c5){while(--_0x5373c5){_0x5f5122['push'](_0x5f5122['shift']());}};_0x2298ab(++_0x4e689a);}(_0x72b1,0x16e));var _0x172b=function(_0x444ef7,_0x5ceca6){_0x444ef7=_0x444ef7-0x0;var _0xc56d34=_0x72b1[_0x444ef7];return _0xc56d34;};'use strict';var multer=require(_0x172b('0x0'));var util=require('util');var path=require(_0x172b('0x1'));var timeout=require(_0x172b('0x2'));var express=require(_0x172b('0x3'));var router=express[_0x172b('0x4')]();var fs_extra=require(_0x172b('0x5'));var auth=require(_0x172b('0x6'));var interaction=require(_0x172b('0x7'));var config=require('../../config/environment');var controller=require(_0x172b('0x8'));router[_0x172b('0x9')]('/',auth[_0x172b('0xa')](),controller[_0x172b('0xb')]);router['get'](_0x172b('0xc'),auth['isAuthenticated'](),controller[_0x172b('0xd')]);router['get'](_0x172b('0xe'),auth[_0x172b('0xa')](),controller[_0x172b('0xf')]);router[_0x172b('0x10')]('/',auth['isAuthenticated'](),controller[_0x172b('0x11')]);router[_0x172b('0x12')](_0x172b('0xe'),auth[_0x172b('0xa')](),controller[_0x172b('0x13')]);router[_0x172b('0x14')](_0x172b('0xe'),auth['isAuthenticated'](),controller[_0x172b('0x15')]);module[_0x172b('0x16')]=router; \ No newline at end of file +var _0x3c6c=['delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','post','create','put','update'];(function(_0x23f063,_0x51af83){var _0x10d5bb=function(_0x2b0129){while(--_0x2b0129){_0x23f063['push'](_0x23f063['shift']());}};_0x10d5bb(++_0x51af83);}(_0x3c6c,0x7b));var _0xc3c6=function(_0x179ed0,_0x5ccd8e){_0x179ed0=_0x179ed0-0x0;var _0x3a6f97=_0x3c6c[_0x179ed0];return _0x3a6f97;};'use strict';var multer=require(_0xc3c6('0x0'));var util=require('util');var path=require(_0xc3c6('0x1'));var timeout=require(_0xc3c6('0x2'));var express=require(_0xc3c6('0x3'));var router=express[_0xc3c6('0x4')]();var fs_extra=require(_0xc3c6('0x5'));var auth=require(_0xc3c6('0x6'));var interaction=require(_0xc3c6('0x7'));var config=require(_0xc3c6('0x8'));var controller=require('./smsTransferReport.controller');router[_0xc3c6('0x9')]('/',auth['isAuthenticated'](),controller[_0xc3c6('0xa')]);router['get']('/describe',auth['isAuthenticated'](),controller['describe']);router['get'](_0xc3c6('0xb'),auth[_0xc3c6('0xc')](),controller['show']);router[_0xc3c6('0xd')]('/',auth[_0xc3c6('0xc')](),controller[_0xc3c6('0xe')]);router[_0xc3c6('0xf')]('/:id',auth[_0xc3c6('0xc')](),controller[_0xc3c6('0x10')]);router[_0xc3c6('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xc3c6('0x12')]);module[_0xc3c6('0x13')]=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index f3eef8d..1ae25ef 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 _0xcb91=['STRING','ENUM','account','queue','NOW','exports'];(function(_0x2b55ae,_0x223d5b){var _0x1778d6=function(_0x5372db){while(--_0x5372db){_0x2b55ae['push'](_0x2b55ae['shift']());}};_0x1778d6(++_0x223d5b);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x13594e,_0x6f0ed0){_0x13594e=_0x13594e-0x0;var _0x1a4f42=_0xcb91[_0x13594e];return _0x1a4f42;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x1cb9('0x0')]={'uniqueid':{'type':Sequelize[_0x1cb9('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x1cb9('0x2')](_0x1cb9('0x3'),'agent',_0x1cb9('0x4')),'allowNull':![],'defaultValue':_0x1cb9('0x4')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x1cb9('0x5')]}}; \ No newline at end of file +var _0xf3cd=['exports','STRING','ENUM','account','queue','DATE','moment','sequelize'];(function(_0x23622b,_0x5cd449){var _0x13bb3f=function(_0x33bd8a){while(--_0x33bd8a){_0x23622b['push'](_0x23622b['shift']());}};_0x13bb3f(++_0x5cd449);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x249d99,_0x16b584){_0x249d99=_0x249d99-0x0;var _0x5bfb05=_0xf3cd[_0x249d99];return _0x5bfb05;};'use strict';var moment=require(_0xdf3c('0x0'));var Sequelize=require(_0xdf3c('0x1'));module[_0xdf3c('0x2')]={'uniqueid':{'type':Sequelize[_0xdf3c('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xdf3c('0x4')](_0xdf3c('0x5'),'agent',_0xdf3c('0x6')),'allowNull':![],'defaultValue':_0xdf3c('0x6')},'transferredAt':{'type':Sequelize[_0xdf3c('0x7')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index 13d3bda..f3cb980 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 _0xae0e=['sort','pick','filter','where','merge','VIRTUAL','findAll','show','params','keys','includeAll','include','options','catch','create','body','find','describe','eml-format','zip-dir','request-promise','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','save','update','destroy','then','error','stack','name','send','index','SmsTransferReport','rawAttributes','model','map','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order'];(function(_0x3792e6,_0x32bd91){var _0x441e44=function(_0x357478){while(--_0x357478){_0x3792e6['push'](_0x3792e6['shift']());}};_0x441e44(++_0x32bd91);}(_0xae0e,0xa8));var _0xeae0=function(_0x41081a,_0x77010b){_0x41081a=_0x41081a-0x0;var _0x3d3549=_0xae0e[_0x41081a];return _0x3d3549;};'use strict';var emlformat=require(_0xeae0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xeae0('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xeae0('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xeae0('0x3'));var path=require(_0xeae0('0x4'));var sox=require(_0xeae0('0x5'));var csv=require(_0xeae0('0x6'));var ejs=require(_0xeae0('0x7'));var fs=require('fs');var fs_extra=require(_0xeae0('0x8'));var _=require(_0xeae0('0x9'));var squel=require(_0xeae0('0xa'));var crypto=require(_0xeae0('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xeae0('0xc'));var toCsv=require(_0xeae0('0x6'));var querystring=require(_0xeae0('0xd'));var Papa=require(_0xeae0('0xe'));var Redis=require(_0xeae0('0xf'));var authService=require(_0xeae0('0x10'));var qs=require(_0xeae0('0x11'));var as=require(_0xeae0('0x12'));var hardwareService=require(_0xeae0('0x13'));var logger=require('../../config/logger')(_0xeae0('0x14'));var utils=require('../../config/utils');var config=require(_0xeae0('0x15'));var licenseUtil=require(_0xeae0('0x16'));var db=require(_0xeae0('0x17'))['db'];function respondWithStatusCode(_0x101d80,_0x100ab4){_0x100ab4=_0x100ab4||0xcc;return function(_0x558829){if(_0x558829){return _0x101d80[_0xeae0('0x18')](_0x100ab4);}return _0x101d80['status'](_0x100ab4)[_0xeae0('0x19')]();};}function respondWithResult(_0x51621e,_0x1c4b3a){_0x1c4b3a=_0x1c4b3a||0xc8;return function(_0x595435){if(_0x595435){return _0x51621e[_0xeae0('0x1a')](_0x1c4b3a)[_0xeae0('0x1b')](_0x595435);}};}function respondWithFilteredResult(_0x3fbf9c,_0x2ee38b){return function(_0x11905d){if(_0x11905d){var _0x500b89=typeof _0x2ee38b['offset']===_0xeae0('0x1c')&&typeof _0x2ee38b[_0xeae0('0x1d')]===_0xeae0('0x1c');var _0x14d6de=_0x11905d[_0xeae0('0x1e')];var _0x50a515=_0x500b89?0x0:_0x2ee38b[_0xeae0('0x1f')];var _0x28e5c8=_0x500b89?_0x11905d[_0xeae0('0x1e')]:_0x2ee38b[_0xeae0('0x1f')]+_0x2ee38b[_0xeae0('0x1d')];var _0x5989a7;if(_0x28e5c8>=_0x14d6de){_0x28e5c8=_0x14d6de;_0x5989a7=0xc8;}else{_0x5989a7=0xce;}_0x3fbf9c['status'](_0x5989a7);return _0x3fbf9c[_0xeae0('0x20')](_0xeae0('0x21'),_0x50a515+'-'+_0x28e5c8+'/'+_0x14d6de)[_0xeae0('0x1b')](_0x11905d);}return null;};}function patchUpdates(_0x4bd57f){return function(_0x5612af){try{jsonpatch[_0xeae0('0x22')](_0x5612af,_0x4bd57f,!![]);}catch(_0x44e827){return BPromise['reject'](_0x44e827);}return _0x5612af[_0xeae0('0x23')]();};}function saveUpdates(_0x56f455,_0x567fe4){return function(_0x2c17fd){if(_0x2c17fd){return _0x2c17fd[_0xeae0('0x24')](_0x56f455)['then'](function(_0x536fa8){return _0x536fa8;});}return null;};}function removeEntity(_0x167a27,_0x5dad39){return function(_0x330f31){if(_0x330f31){return _0x330f31[_0xeae0('0x25')]()[_0xeae0('0x26')](function(){_0x167a27['status'](0xcc)[_0xeae0('0x19')]();});}};}function handleEntityNotFound(_0x4a6c73,_0x281deb){return function(_0x3cdeb8){if(!_0x3cdeb8){_0x4a6c73['sendStatus'](0x194);}return _0x3cdeb8;};}function handleError(_0x3383a8,_0x1e4926){_0x1e4926=_0x1e4926||0x1f4;return function(_0x54a483){logger[_0xeae0('0x27')](_0x54a483[_0xeae0('0x28')]);if(_0x54a483[_0xeae0('0x29')]){delete _0x54a483['name'];}_0x3383a8[_0xeae0('0x1a')](_0x1e4926)[_0xeae0('0x2a')](_0x54a483);};}exports[_0xeae0('0x2b')]=function(_0x517f88,_0x2e0341){var _0x52ace0={},_0x18c710={},_0x3caa3f={'count':0x0,'rows':[]};var _0x19c5fb=_['map'](db[_0xeae0('0x2c')][_0xeae0('0x2d')],function(_0x4770bc){return{'name':_0x4770bc['fieldName'],'type':_0x4770bc['type']['key']};});_0x18c710[_0xeae0('0x2e')]=_[_0xeae0('0x2f')](_0x19c5fb,_0xeae0('0x29'));_0x18c710[_0xeae0('0x30')]=_['keys'](_0x517f88[_0xeae0('0x30')]);_0x18c710[_0xeae0('0x31')]=_['intersection'](_0x18c710['model'],_0x18c710[_0xeae0('0x30')]);_0x52ace0['attributes']=_[_0xeae0('0x32')](_0x18c710[_0xeae0('0x2e')],qs[_0xeae0('0x33')](_0x517f88['query'][_0xeae0('0x33')]));_0x52ace0[_0xeae0('0x34')]=_0x52ace0[_0xeae0('0x34')][_0xeae0('0x35')]?_0x52ace0[_0xeae0('0x34')]:_0x18c710['model'];if(!_0x517f88['query'][_0xeae0('0x36')](_0xeae0('0x37'))){_0x52ace0['limit']=qs['limit'](_0x517f88[_0xeae0('0x30')]['limit']);_0x52ace0[_0xeae0('0x1f')]=qs[_0xeae0('0x1f')](_0x517f88[_0xeae0('0x30')]['offset']);}_0x52ace0[_0xeae0('0x38')]=qs[_0xeae0('0x39')](_0x517f88[_0xeae0('0x30')][_0xeae0('0x39')]);_0x52ace0['where']=qs[_0xeae0('0x31')](_[_0xeae0('0x3a')](_0x517f88['query'],_0x18c710['filters']),_0x19c5fb);if(_0x517f88[_0xeae0('0x30')][_0xeae0('0x3b')]){_0x52ace0[_0xeae0('0x3c')]=_[_0xeae0('0x3d')](_0x52ace0[_0xeae0('0x3c')],{'$or':_[_0xeae0('0x2f')](_0x19c5fb,function(_0x2c42e9){if(_0x2c42e9['type']!==_0xeae0('0x3e')){var _0x3a1783={};_0x3a1783[_0x2c42e9['name']]={'$like':'%'+_0x517f88[_0xeae0('0x30')][_0xeae0('0x3b')]+'%'};return _0x3a1783;}})});}_0x52ace0=_[_0xeae0('0x3d')]({},_0x52ace0,_0x517f88['options']);var _0x449025={'where':_0x52ace0[_0xeae0('0x3c')]};return db[_0xeae0('0x2c')]['count'](_0x449025)[_0xeae0('0x26')](function(_0x324b3c){_0x3caa3f[_0xeae0('0x1e')]=_0x324b3c;if(_0x517f88[_0xeae0('0x30')]['includeAll']){_0x52ace0['include']=[{'all':!![]}];}return db[_0xeae0('0x2c')][_0xeae0('0x3f')](_0x52ace0);})[_0xeae0('0x26')](function(_0x2e2766){_0x3caa3f['rows']=_0x2e2766;return _0x3caa3f;})[_0xeae0('0x26')](respondWithFilteredResult(_0x2e0341,_0x52ace0))['catch'](handleError(_0x2e0341,null));};exports[_0xeae0('0x40')]=function(_0x4f240d,_0x37e79d){var _0x504316={'raw':!![],'where':{'id':_0x4f240d[_0xeae0('0x41')]['id']}},_0x3d1c80={};_0x3d1c80[_0xeae0('0x2e')]=_[_0xeae0('0x42')](db[_0xeae0('0x2c')][_0xeae0('0x2d')]);_0x3d1c80['query']=_[_0xeae0('0x42')](_0x4f240d['query']);_0x3d1c80[_0xeae0('0x31')]=_[_0xeae0('0x32')](_0x3d1c80[_0xeae0('0x2e')],_0x3d1c80[_0xeae0('0x30')]);_0x504316[_0xeae0('0x34')]=_['intersection'](_0x3d1c80[_0xeae0('0x2e')],qs['fields'](_0x4f240d['query'][_0xeae0('0x33')]));_0x504316[_0xeae0('0x34')]=_0x504316[_0xeae0('0x34')][_0xeae0('0x35')]?_0x504316[_0xeae0('0x34')]:_0x3d1c80[_0xeae0('0x2e')];if(_0x4f240d[_0xeae0('0x30')][_0xeae0('0x43')]){_0x504316[_0xeae0('0x44')]=[{'all':!![]}];}_0x504316=_[_0xeae0('0x3d')]({},_0x504316,_0x4f240d[_0xeae0('0x45')]);return db[_0xeae0('0x2c')]['find'](_0x504316)[_0xeae0('0x26')](handleEntityNotFound(_0x37e79d,null))[_0xeae0('0x26')](respondWithResult(_0x37e79d,null))[_0xeae0('0x46')](handleError(_0x37e79d,null));};exports[_0xeae0('0x47')]=function(_0x43b0d1,_0x106435){return db[_0xeae0('0x2c')][_0xeae0('0x47')](_0x43b0d1[_0xeae0('0x48')],{})['then'](respondWithResult(_0x106435,0xc9))[_0xeae0('0x46')](handleError(_0x106435,null));};exports[_0xeae0('0x24')]=function(_0x463069,_0x4fa2ef){if(_0x463069[_0xeae0('0x48')]['id']){delete _0x463069[_0xeae0('0x48')]['id'];}return db[_0xeae0('0x2c')]['find']({'where':{'id':_0x463069[_0xeae0('0x41')]['id']}})['then'](handleEntityNotFound(_0x4fa2ef,null))[_0xeae0('0x26')](saveUpdates(_0x463069[_0xeae0('0x48')],null))[_0xeae0('0x26')](respondWithResult(_0x4fa2ef,null))[_0xeae0('0x46')](handleError(_0x4fa2ef,null));};exports[_0xeae0('0x25')]=function(_0x3164fb,_0x12d9c3){return db['SmsTransferReport'][_0xeae0('0x49')]({'where':{'id':_0x3164fb[_0xeae0('0x41')]['id']}})[_0xeae0('0x26')](handleEntityNotFound(_0x12d9c3,null))[_0xeae0('0x26')](removeEntity(_0x12d9c3,null))[_0xeae0('0x46')](handleError(_0x12d9c3,null));};exports[_0xeae0('0x4a')]=function(_0x57670a,_0x1b8181){return db[_0xeae0('0x2c')]['describe']()[_0xeae0('0x26')](respondWithResult(_0x1b8181,null))['catch'](handleError(_0x1b8181,null));}; \ No newline at end of file +var _0xe284=['params','catch','create','body','update','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','end','sendStatus','error','stack','name','send','index','map','SmsTransferReport','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','show'];(function(_0x8de54f,_0x271987){var _0x14cba4=function(_0x58ed41){while(--_0x58ed41){_0x8de54f['push'](_0x8de54f['shift']());}};_0x14cba4(++_0x271987);}(_0xe284,0x18d));var _0x4e28=function(_0x2b1fa9,_0x2e6a4b){_0x2b1fa9=_0x2b1fa9-0x0;var _0x405640=_0xe284[_0x2b1fa9];return _0x405640;};'use strict';var emlformat=require(_0x4e28('0x0'));var rimraf=require(_0x4e28('0x1'));var zipdir=require(_0x4e28('0x2'));var jsonpatch=require(_0x4e28('0x3'));var rp=require(_0x4e28('0x4'));var moment=require(_0x4e28('0x5'));var BPromise=require(_0x4e28('0x6'));var Mustache=require(_0x4e28('0x7'));var util=require(_0x4e28('0x8'));var path=require(_0x4e28('0x9'));var sox=require(_0x4e28('0xa'));var csv=require(_0x4e28('0xb'));var ejs=require(_0x4e28('0xc'));var fs=require('fs');var fs_extra=require(_0x4e28('0xd'));var _=require(_0x4e28('0xe'));var squel=require(_0x4e28('0xf'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x4e28('0x10'));var toCsv=require(_0x4e28('0xb'));var querystring=require('querystring');var Papa=require(_0x4e28('0x11'));var Redis=require(_0x4e28('0x12'));var authService=require(_0x4e28('0x13'));var qs=require(_0x4e28('0x14'));var as=require(_0x4e28('0x15'));var hardwareService=require(_0x4e28('0x16'));var logger=require(_0x4e28('0x17'))('api');var utils=require(_0x4e28('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x6e2dd1,_0x4f8a0f){_0x4f8a0f=_0x4f8a0f||0xcc;return function(_0x19d717){if(_0x19d717){return _0x6e2dd1['sendStatus'](_0x4f8a0f);}return _0x6e2dd1[_0x4e28('0x19')](_0x4f8a0f)['end']();};}function respondWithResult(_0x25440e,_0x147313){_0x147313=_0x147313||0xc8;return function(_0x5704b9){if(_0x5704b9){return _0x25440e[_0x4e28('0x19')](_0x147313)[_0x4e28('0x1a')](_0x5704b9);}};}function respondWithFilteredResult(_0x58fd8a,_0x4538d2){return function(_0x1e63b0){if(_0x1e63b0){var _0x1d53f2=typeof _0x4538d2[_0x4e28('0x1b')]===_0x4e28('0x1c')&&typeof _0x4538d2[_0x4e28('0x1d')]===_0x4e28('0x1c');var _0x1484a5=_0x1e63b0[_0x4e28('0x1e')];var _0x218376=_0x1d53f2?0x0:_0x4538d2[_0x4e28('0x1b')];var _0xe55ffb=_0x1d53f2?_0x1e63b0[_0x4e28('0x1e')]:_0x4538d2[_0x4e28('0x1b')]+_0x4538d2[_0x4e28('0x1d')];var _0x21e1ea;if(_0xe55ffb>=_0x1484a5){_0xe55ffb=_0x1484a5;_0x21e1ea=0xc8;}else{_0x21e1ea=0xce;}_0x58fd8a['status'](_0x21e1ea);return _0x58fd8a[_0x4e28('0x1f')](_0x4e28('0x20'),_0x218376+'-'+_0xe55ffb+'/'+_0x1484a5)['json'](_0x1e63b0);}return null;};}function patchUpdates(_0xbe8e9d){return function(_0x427a1b){try{jsonpatch[_0x4e28('0x21')](_0x427a1b,_0xbe8e9d,!![]);}catch(_0x25fa3e){return BPromise[_0x4e28('0x22')](_0x25fa3e);}return _0x427a1b[_0x4e28('0x23')]();};}function saveUpdates(_0x4507e1,_0x527a2b){return function(_0x4c57d9){if(_0x4c57d9){return _0x4c57d9['update'](_0x4507e1)[_0x4e28('0x24')](function(_0x337f08){return _0x337f08;});}return null;};}function removeEntity(_0x3a5e36,_0x1c03ed){return function(_0x5647a6){if(_0x5647a6){return _0x5647a6[_0x4e28('0x25')]()['then'](function(){_0x3a5e36[_0x4e28('0x19')](0xcc)[_0x4e28('0x26')]();});}};}function handleEntityNotFound(_0x2afb21,_0x320f4f){return function(_0x18c5e2){if(!_0x18c5e2){_0x2afb21[_0x4e28('0x27')](0x194);}return _0x18c5e2;};}function handleError(_0x51f796,_0x5b8b87){_0x5b8b87=_0x5b8b87||0x1f4;return function(_0x459a21){logger[_0x4e28('0x28')](_0x459a21[_0x4e28('0x29')]);if(_0x459a21['name']){delete _0x459a21[_0x4e28('0x2a')];}_0x51f796[_0x4e28('0x19')](_0x5b8b87)[_0x4e28('0x2b')](_0x459a21);};}exports[_0x4e28('0x2c')]=function(_0x1d1045,_0x451db9){var _0x5533f6={},_0x5403d5={},_0x472fb1={'count':0x0,'rows':[]};var _0x3d1bcd=_[_0x4e28('0x2d')](db[_0x4e28('0x2e')]['rawAttributes'],function(_0x142b79){return{'name':_0x142b79[_0x4e28('0x2f')],'type':_0x142b79[_0x4e28('0x30')][_0x4e28('0x31')]};});_0x5403d5['model']=_[_0x4e28('0x2d')](_0x3d1bcd,_0x4e28('0x2a'));_0x5403d5[_0x4e28('0x32')]=_[_0x4e28('0x33')](_0x1d1045[_0x4e28('0x32')]);_0x5403d5[_0x4e28('0x34')]=_[_0x4e28('0x35')](_0x5403d5['model'],_0x5403d5[_0x4e28('0x32')]);_0x5533f6['attributes']=_[_0x4e28('0x35')](_0x5403d5[_0x4e28('0x36')],qs[_0x4e28('0x37')](_0x1d1045[_0x4e28('0x32')][_0x4e28('0x37')]));_0x5533f6[_0x4e28('0x38')]=_0x5533f6[_0x4e28('0x38')][_0x4e28('0x39')]?_0x5533f6[_0x4e28('0x38')]:_0x5403d5['model'];if(!_0x1d1045[_0x4e28('0x32')][_0x4e28('0x3a')](_0x4e28('0x3b'))){_0x5533f6[_0x4e28('0x1d')]=qs['limit'](_0x1d1045[_0x4e28('0x32')][_0x4e28('0x1d')]);_0x5533f6[_0x4e28('0x1b')]=qs[_0x4e28('0x1b')](_0x1d1045[_0x4e28('0x32')]['offset']);}_0x5533f6['order']=qs[_0x4e28('0x3c')](_0x1d1045[_0x4e28('0x32')]['sort']);_0x5533f6[_0x4e28('0x3d')]=qs['filters'](_[_0x4e28('0x3e')](_0x1d1045['query'],_0x5403d5['filters']),_0x3d1bcd);if(_0x1d1045[_0x4e28('0x32')][_0x4e28('0x3f')]){_0x5533f6[_0x4e28('0x3d')]=_[_0x4e28('0x40')](_0x5533f6[_0x4e28('0x3d')],{'$or':_[_0x4e28('0x2d')](_0x3d1bcd,function(_0x29386c){if(_0x29386c[_0x4e28('0x30')]!=='VIRTUAL'){var _0x5bf6c2={};_0x5bf6c2[_0x29386c[_0x4e28('0x2a')]]={'$like':'%'+_0x1d1045['query'][_0x4e28('0x3f')]+'%'};return _0x5bf6c2;}})});}_0x5533f6=_[_0x4e28('0x40')]({},_0x5533f6,_0x1d1045[_0x4e28('0x41')]);var _0xdd1885={'where':_0x5533f6[_0x4e28('0x3d')]};return db['SmsTransferReport'][_0x4e28('0x1e')](_0xdd1885)[_0x4e28('0x24')](function(_0x350fcd){_0x472fb1[_0x4e28('0x1e')]=_0x350fcd;if(_0x1d1045[_0x4e28('0x32')][_0x4e28('0x42')]){_0x5533f6[_0x4e28('0x43')]=[{'all':!![]}];}return db[_0x4e28('0x2e')][_0x4e28('0x44')](_0x5533f6);})['then'](function(_0x54edd6){_0x472fb1[_0x4e28('0x45')]=_0x54edd6;return _0x472fb1;})[_0x4e28('0x24')](respondWithFilteredResult(_0x451db9,_0x5533f6))['catch'](handleError(_0x451db9,null));};exports[_0x4e28('0x46')]=function(_0x204031,_0x3ca61d){var _0x4b914f={'raw':!![],'where':{'id':_0x204031[_0x4e28('0x47')]['id']}},_0x213aa3={};_0x213aa3[_0x4e28('0x36')]=_[_0x4e28('0x33')](db['SmsTransferReport']['rawAttributes']);_0x213aa3[_0x4e28('0x32')]=_['keys'](_0x204031[_0x4e28('0x32')]);_0x213aa3[_0x4e28('0x34')]=_['intersection'](_0x213aa3[_0x4e28('0x36')],_0x213aa3[_0x4e28('0x32')]);_0x4b914f[_0x4e28('0x38')]=_[_0x4e28('0x35')](_0x213aa3[_0x4e28('0x36')],qs[_0x4e28('0x37')](_0x204031['query'][_0x4e28('0x37')]));_0x4b914f[_0x4e28('0x38')]=_0x4b914f[_0x4e28('0x38')][_0x4e28('0x39')]?_0x4b914f['attributes']:_0x213aa3[_0x4e28('0x36')];if(_0x204031[_0x4e28('0x32')][_0x4e28('0x42')]){_0x4b914f[_0x4e28('0x43')]=[{'all':!![]}];}_0x4b914f=_[_0x4e28('0x40')]({},_0x4b914f,_0x204031['options']);return db[_0x4e28('0x2e')]['find'](_0x4b914f)[_0x4e28('0x24')](handleEntityNotFound(_0x3ca61d,null))[_0x4e28('0x24')](respondWithResult(_0x3ca61d,null))[_0x4e28('0x48')](handleError(_0x3ca61d,null));};exports[_0x4e28('0x49')]=function(_0x5be4da,_0x995c78){return db[_0x4e28('0x2e')][_0x4e28('0x49')](_0x5be4da[_0x4e28('0x4a')],{})['then'](respondWithResult(_0x995c78,0xc9))[_0x4e28('0x48')](handleError(_0x995c78,null));};exports[_0x4e28('0x4b')]=function(_0x21e48d,_0x23c453){if(_0x21e48d[_0x4e28('0x4a')]['id']){delete _0x21e48d[_0x4e28('0x4a')]['id'];}return db[_0x4e28('0x2e')]['find']({'where':{'id':_0x21e48d[_0x4e28('0x47')]['id']}})[_0x4e28('0x24')](handleEntityNotFound(_0x23c453,null))[_0x4e28('0x24')](saveUpdates(_0x21e48d[_0x4e28('0x4a')],null))[_0x4e28('0x24')](respondWithResult(_0x23c453,null))[_0x4e28('0x48')](handleError(_0x23c453,null));};exports[_0x4e28('0x25')]=function(_0x4803a9,_0x5c53fd){return db[_0x4e28('0x2e')][_0x4e28('0x4c')]({'where':{'id':_0x4803a9[_0x4e28('0x47')]['id']}})['then'](handleEntityNotFound(_0x5c53fd,null))['then'](removeEntity(_0x5c53fd,null))[_0x4e28('0x48')](handleError(_0x5c53fd,null));};exports[_0x4e28('0x4d')]=function(_0x5bbe39,_0x259ed0){return db['SmsTransferReport'][_0x4e28('0x4d')]()['then'](respondWithResult(_0x259ed0,null))[_0x4e28('0x48')](handleError(_0x259ed0,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index 3e671b7..c7d8b91 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 _0x0704=['request-promise','path','rimraf','./smsTransferReport.attributes','exports','define','report_sms_transfer','uniqueid','lodash','../../config/logger','api','moment','bluebird'];(function(_0x5194fd,_0x15588c){var _0x1f2aad=function(_0x31aec9){while(--_0x31aec9){_0x5194fd['push'](_0x5194fd['shift']());}};_0x1f2aad(++_0x15588c);}(_0x0704,0x1c2));var _0x4070=function(_0xae0806,_0x34c2a4){_0xae0806=_0xae0806-0x0;var _0x31f160=_0x0704[_0xae0806];return _0x31f160;};'use strict';var _=require(_0x4070('0x0'));var util=require('util');var logger=require(_0x4070('0x1'))(_0x4070('0x2'));var moment=require(_0x4070('0x3'));var BPromise=require(_0x4070('0x4'));var rp=require(_0x4070('0x5'));var fs=require('fs');var path=require(_0x4070('0x6'));var rimraf=require(_0x4070('0x7'));var config=require('../../config/environment');var attributes=require(_0x4070('0x8'));module[_0x4070('0x9')]=function(_0x2b3e13,_0x1d3af2){return _0x2b3e13[_0x4070('0xa')]('SmsTransferReport',attributes,{'tableName':_0x4070('0xb'),'paranoid':![],'indexes':[{'name':_0x4070('0xc'),'fields':[_0x4070('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb43e=['path','rimraf','../../config/environment','exports','define','SmsTransferReport','uniqueid','lodash','../../config/logger','moment'];(function(_0x3f2855,_0x220576){var _0x20c16f=function(_0x38da20){while(--_0x38da20){_0x3f2855['push'](_0x3f2855['shift']());}};_0x20c16f(++_0x220576);}(_0xb43e,0x183));var _0xeb43=function(_0x3dfe95,_0x1a66b6){_0x3dfe95=_0x3dfe95-0x0;var _0x182b28=_0xb43e[_0x3dfe95];return _0x182b28;};'use strict';var _=require(_0xeb43('0x0'));var util=require('util');var logger=require(_0xeb43('0x1'))('api');var moment=require(_0xeb43('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xeb43('0x3'));var rimraf=require(_0xeb43('0x4'));var config=require(_0xeb43('0x5'));var attributes=require('./smsTransferReport.attributes');module[_0xeb43('0x6')]=function(_0x450cc4,_0x224311){return _0x450cc4[_0xeb43('0x7')](_0xeb43('0x8'),attributes,{'tableName':'report_sms_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xeb43('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index b981971..06560e2 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 _0x9a6b=['SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then'];(function(_0xd71c5d,_0x48bc63){var _0xa8915a=function(_0x4be226){while(--_0x4be226){_0xd71c5d['push'](_0xd71c5d['shift']());}};_0xa8915a(++_0x48bc63);}(_0x9a6b,0x77));var _0xb9a6=function(_0x691235,_0x72d709){_0x691235=_0x691235-0x0;var _0x5cbaf8=_0x9a6b[_0x691235];return _0x5cbaf8;};'use strict';var _=require(_0xb9a6('0x0'));var util=require(_0xb9a6('0x1'));var moment=require(_0xb9a6('0x2'));var BPromise=require(_0xb9a6('0x3'));var rs=require(_0xb9a6('0x4'));var fs=require('fs');var Redis=require(_0xb9a6('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xb9a6('0x6'));var logger=require('../../config/logger')(_0xb9a6('0x7'));var config=require(_0xb9a6('0x8'));var jayson=require(_0xb9a6('0x9'));var client=jayson[_0xb9a6('0xa')][_0xb9a6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x555d54,_0x1b85cc,_0x2afba5){return new BPromise(function(_0x15cb33,_0x301a01){return client['request'](_0x555d54,_0x2afba5)[_0xb9a6('0xc')](function(_0x451771){logger['info'](_0xb9a6('0xd'),_0x1b85cc,_0xb9a6('0xe'));logger[_0xb9a6('0xf')](_0xb9a6('0x10'),_0x1b85cc,'request\x20sent',JSON['stringify'](_0x451771));if(_0x451771['error']){if(_0x451771[_0xb9a6('0x11')]['code']===0x1f4){logger[_0xb9a6('0x11')]('SmsTransferReport,\x20%s,\x20%s',_0x1b85cc,_0x451771[_0xb9a6('0x11')][_0xb9a6('0x12')]);return _0x301a01(_0x451771[_0xb9a6('0x11')][_0xb9a6('0x12')]);}logger[_0xb9a6('0x11')](_0xb9a6('0xd'),_0x1b85cc,_0x451771[_0xb9a6('0x11')][_0xb9a6('0x12')]);return _0x15cb33(_0x451771[_0xb9a6('0x11')]['message']);}else{logger[_0xb9a6('0x13')](_0xb9a6('0xd'),_0x1b85cc,_0xb9a6('0xe'));_0x15cb33(_0x451771[_0xb9a6('0x14')]['message']);}})[_0xb9a6('0x15')](function(_0x3d0516){logger[_0xb9a6('0x11')]('SmsTransferReport,\x20%s,\x20%s',_0x1b85cc,_0x3d0516);_0x301a01(_0x3d0516);});});} \ No newline at end of file +var _0x302c=['code','SmsTransferReport,\x20%s,\x20%s','message','request\x20sent','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','client','request','info','debug','error'];(function(_0x33c246,_0x202dc4){var _0x4b9e63=function(_0x505b79){while(--_0x505b79){_0x33c246['push'](_0x33c246['shift']());}};_0x4b9e63(++_0x202dc4);}(_0x302c,0x15c));var _0xc302=function(_0x20b4cb,_0x3b0147){_0x20b4cb=_0x20b4cb-0x0;var _0x2baf46=_0x302c[_0x20b4cb];return _0x2baf46;};'use strict';var _=require(_0xc302('0x0'));var util=require(_0xc302('0x1'));var moment=require(_0xc302('0x2'));var BPromise=require(_0xc302('0x3'));var rs=require(_0xc302('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xc302('0x5'));var logger=require(_0xc302('0x6'))(_0xc302('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xc302('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x13c4aa,_0x2ac42e,_0x33c314){return new BPromise(function(_0x232e75,_0x15317a){return client[_0xc302('0x9')](_0x13c4aa,_0x33c314)['then'](function(_0x398f1a){logger[_0xc302('0xa')]('SmsTransferReport,\x20%s,\x20%s',_0x2ac42e,'request\x20sent');logger[_0xc302('0xb')]('SmsTransferReport,\x20%s,\x20%s,\x20%s',_0x2ac42e,'request\x20sent',JSON['stringify'](_0x398f1a));if(_0x398f1a[_0xc302('0xc')]){if(_0x398f1a[_0xc302('0xc')][_0xc302('0xd')]===0x1f4){logger[_0xc302('0xc')](_0xc302('0xe'),_0x2ac42e,_0x398f1a[_0xc302('0xc')][_0xc302('0xf')]);return _0x15317a(_0x398f1a[_0xc302('0xc')][_0xc302('0xf')]);}logger[_0xc302('0xc')]('SmsTransferReport,\x20%s,\x20%s',_0x2ac42e,_0x398f1a[_0xc302('0xc')][_0xc302('0xf')]);return _0x232e75(_0x398f1a['error'][_0xc302('0xf')]);}else{logger[_0xc302('0xa')](_0xc302('0xe'),_0x2ac42e,_0xc302('0x10'));_0x232e75(_0x398f1a[_0xc302('0x11')]['message']);}})[_0xc302('0x12')](function(_0x4b90c4){logger[_0xc302('0xc')](_0xc302('0xe'),_0x2ac42e,_0x4b90c4);_0x15317a(_0x4b90c4);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index 0b094c7..be34dc8 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 _0xe085=['basename','extname','now','post','single','file','create','put','/:id','update','delete','exports','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./sound.controller','get','isAuthenticated','index','/:id/download','download','diskStorage','join','root','server/files/sounds/original/','originalname','format','%s-%s%s'];(function(_0x545124,_0x252049){var _0x282bd6=function(_0x5f273f){while(--_0x5f273f){_0x545124['push'](_0x545124['shift']());}};_0x282bd6(++_0x252049);}(_0xe085,0x8c));var _0x5e08=function(_0x40aaa0,_0x2d7fad){_0x40aaa0=_0x40aaa0-0x0;var _0x5e0937=_0xe085[_0x40aaa0];return _0x5e0937;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x5e08('0x0'));var express=require(_0x5e08('0x1'));var router=express[_0x5e08('0x2')]();var fs_extra=require(_0x5e08('0x3'));var auth=require(_0x5e08('0x4'));var interaction=require(_0x5e08('0x5'));var config=require(_0x5e08('0x6'));var controller=require(_0x5e08('0x7'));router[_0x5e08('0x8')]('/',auth[_0x5e08('0x9')](),controller[_0x5e08('0xa')]);router[_0x5e08('0x8')]('/:id',auth[_0x5e08('0x9')](),controller['show']);router[_0x5e08('0x8')](_0x5e08('0xb'),auth['isAuthenticated'](),controller[_0x5e08('0xc')]);var upload=multer({'storage':multer[_0x5e08('0xd')]({'destination':function(_0x156187,_0x54b8de,_0x3f1204){_0x3f1204(null,path[_0x5e08('0xe')](config[_0x5e08('0xf')],_0x5e08('0x10')));},'filename':function(_0x51f2be,_0x137c8d,_0x4408bb){_0x137c8d[_0x5e08('0x11')]=_0x137c8d['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x4408bb(null,util[_0x5e08('0x12')](_0x5e08('0x13'),path[_0x5e08('0x14')](_0x137c8d[_0x5e08('0x11')],path[_0x5e08('0x15')](_0x137c8d[_0x5e08('0x11')])),Date[_0x5e08('0x16')](),path['extname'](_0x137c8d[_0x5e08('0x11')])));}})});router[_0x5e08('0x17')]('/',upload[_0x5e08('0x18')](_0x5e08('0x19')),controller[_0x5e08('0x1a')]);router[_0x5e08('0x1b')](_0x5e08('0x1c'),auth[_0x5e08('0x9')](),controller[_0x5e08('0x1d')]);router[_0x5e08('0x1e')](_0x5e08('0x1c'),auth[_0x5e08('0x9')](),controller[_0x5e08('0x1e')]);module[_0x5e08('0x1f')]=router; \ No newline at end of file +var _0xde0b=['fs-extra','../../components/interaction/service','../../config/environment','./sound.controller','get','index','/:id','isAuthenticated','show','/:id/download','download','diskStorage','join','root','originalname','replace','format','extname','post','single','file','put','delete','exports','util','path','express'];(function(_0x2cd5f1,_0x58e244){var _0x2761c6=function(_0x2f13c8){while(--_0x2f13c8){_0x2cd5f1['push'](_0x2cd5f1['shift']());}};_0x2761c6(++_0x58e244);}(_0xde0b,0x1c8));var _0xbde0=function(_0x8d7a14,_0x2df5f5){_0x8d7a14=_0x8d7a14-0x0;var _0x31ddfa=_0xde0b[_0x8d7a14];return _0x31ddfa;};'use strict';var multer=require('multer');var util=require(_0xbde0('0x0'));var path=require(_0xbde0('0x1'));var timeout=require('connect-timeout');var express=require(_0xbde0('0x2'));var router=express['Router']();var fs_extra=require(_0xbde0('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xbde0('0x4'));var config=require(_0xbde0('0x5'));var controller=require(_0xbde0('0x6'));router[_0xbde0('0x7')]('/',auth['isAuthenticated'](),controller[_0xbde0('0x8')]);router[_0xbde0('0x7')](_0xbde0('0x9'),auth[_0xbde0('0xa')](),controller[_0xbde0('0xb')]);router[_0xbde0('0x7')](_0xbde0('0xc'),auth[_0xbde0('0xa')](),controller[_0xbde0('0xd')]);var upload=multer({'storage':multer[_0xbde0('0xe')]({'destination':function(_0x56b92e,_0x55f9f1,_0x1b5d2d){_0x1b5d2d(null,path[_0xbde0('0xf')](config[_0xbde0('0x10')],'server/files/sounds/original/'));},'filename':function(_0x314187,_0x276fce,_0x58a131){_0x276fce['originalname']=_0x276fce[_0xbde0('0x11')][_0xbde0('0x12')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x58a131(null,util[_0xbde0('0x13')]('%s-%s%s',path['basename'](_0x276fce[_0xbde0('0x11')],path[_0xbde0('0x14')](_0x276fce[_0xbde0('0x11')])),Date['now'](),path[_0xbde0('0x14')](_0x276fce[_0xbde0('0x11')])));}})});router[_0xbde0('0x15')]('/',upload[_0xbde0('0x16')](_0xbde0('0x17')),controller['create']);router[_0xbde0('0x18')](_0xbde0('0x9'),auth[_0xbde0('0xa')](),controller['update']);router[_0xbde0('0x19')](_0xbde0('0x9'),auth[_0xbde0('0xa')](),controller[_0xbde0('0x19')]);module[_0xbde0('0x1a')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index 61ba002..836b253 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 _0xa8b2=['FLOAT','INTEGER','BIGINT','sequelize','exports','STRING'];(function(_0x526141,_0x1fb1c2){var _0x5348ae=function(_0xa797b5){while(--_0xa797b5){_0x526141['push'](_0x526141['shift']());}};_0x5348ae(++_0x1fb1c2);}(_0xa8b2,0x9f));var _0x2a8b=function(_0x59f68d,_0x5c3dfb){_0x59f68d=_0x59f68d-0x0;var _0x4d9637=_0xa8b2[_0x59f68d];return _0x4d9637;};'use strict';var Sequelize=require(_0x2a8b('0x0'));module[_0x2a8b('0x1')]={'name':{'type':Sequelize[_0x2a8b('0x2')],'unique':'name','allowNull':![]},'save_name':{'type':Sequelize[_0x2a8b('0x2')]},'display_name':{'type':Sequelize[_0x2a8b('0x2')],'defaultValue':''},'description':{'type':Sequelize['STRING']},'original_format':{'type':Sequelize['STRING']},'original_duration':{'type':Sequelize[_0x2a8b('0x3')]},'original_sampleCount':{'type':Sequelize['BIGINT']},'original_channelCount':{'type':Sequelize['INTEGER']},'original_bitRate':{'type':Sequelize['BIGINT']},'original_sampleRate':{'type':Sequelize[_0x2a8b('0x4')]},'converted_format':{'type':Sequelize['STRING']},'converted_duration':{'type':Sequelize['FLOAT']},'converted_sampleCount':{'type':Sequelize['BIGINT']},'converted_channelCount':{'type':Sequelize[_0x2a8b('0x4')]},'converted_bitRate':{'type':Sequelize[_0x2a8b('0x5')]},'converted_sampleRate':{'type':Sequelize[_0x2a8b('0x4')]}}; \ No newline at end of file +var _0x76f7=['sequelize','exports','STRING','name','FLOAT','BIGINT','INTEGER'];(function(_0x6a4771,_0x5ed054){var _0x3c1467=function(_0x504553){while(--_0x504553){_0x6a4771['push'](_0x6a4771['shift']());}};_0x3c1467(++_0x5ed054);}(_0x76f7,0x1c7));var _0x776f=function(_0x5d354a,_0x11fd0c){_0x5d354a=_0x5d354a-0x0;var _0x5f3e46=_0x76f7[_0x5d354a];return _0x5f3e46;};'use strict';var Sequelize=require(_0x776f('0x0'));module[_0x776f('0x1')]={'name':{'type':Sequelize[_0x776f('0x2')],'unique':_0x776f('0x3'),'allowNull':![]},'save_name':{'type':Sequelize[_0x776f('0x2')]},'display_name':{'type':Sequelize[_0x776f('0x2')],'defaultValue':''},'description':{'type':Sequelize[_0x776f('0x2')]},'original_format':{'type':Sequelize[_0x776f('0x2')]},'original_duration':{'type':Sequelize[_0x776f('0x4')]},'original_sampleCount':{'type':Sequelize[_0x776f('0x5')]},'original_channelCount':{'type':Sequelize[_0x776f('0x6')]},'original_bitRate':{'type':Sequelize[_0x776f('0x5')]},'original_sampleRate':{'type':Sequelize['INTEGER']},'converted_format':{'type':Sequelize[_0x776f('0x2')]},'converted_duration':{'type':Sequelize[_0x776f('0x4')]},'converted_sampleCount':{'type':Sequelize[_0x776f('0x5')]},'converted_channelCount':{'type':Sequelize['INTEGER']},'converted_bitRate':{'type':Sequelize[_0x776f('0x5')]},'converted_sampleRate':{'type':Sequelize[_0x776f('0x6')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index 1884eea..4827cda 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 _0xd01b=['fields','length','hasOwnProperty','nolimit','order','sort','where','merge','filter','includeAll','include','rows','catch','show','params','options','find','save_name','converted_format','existsSync','join','root','Sequelize','ValidationError','Sound\x20not\x20found','server/files/sounds/converted','format','%s.%s','create','basename','file','extname','originalname','filename','substring','info','Sound\x20upload\x20filepath:\x20%s','transcode','wav','unlinkSync','src','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_sampleCount','converted_bitRate','converted_sampleRate','chmodSync','0777','body','userProfileId','role','user','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','update','pick','description','delete','server/files/sounds/original','original_format','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','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/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','save','destroy','then','get','Sounds','UserProfileResource','error','stack','name','send','index','Sound','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes'];(function(_0x21b95c,_0x35c39e){var _0x1ede2f=function(_0x40be0a){while(--_0x40be0a){_0x21b95c['push'](_0x21b95c['shift']());}};_0x1ede2f(++_0x35c39e);}(_0xd01b,0x1cb));var _0xbd01=function(_0x5f3559,_0x2e8af1){_0x5f3559=_0x5f3559-0x0;var _0x102ec6=_0xd01b[_0x5f3559];return _0x102ec6;};'use strict';var emlformat=require(_0xbd01('0x0'));var rimraf=require(_0xbd01('0x1'));var zipdir=require(_0xbd01('0x2'));var jsonpatch=require(_0xbd01('0x3'));var rp=require(_0xbd01('0x4'));var moment=require(_0xbd01('0x5'));var BPromise=require(_0xbd01('0x6'));var Mustache=require(_0xbd01('0x7'));var util=require('util');var path=require(_0xbd01('0x8'));var sox=require(_0xbd01('0x9'));var csv=require(_0xbd01('0xa'));var ejs=require(_0xbd01('0xb'));var fs=require('fs');var fs_extra=require(_0xbd01('0xc'));var _=require('lodash');var squel=require(_0xbd01('0xd'));var crypto=require(_0xbd01('0xe'));var jsforce=require(_0xbd01('0xf'));var deskjs=require(_0xbd01('0x10'));var toCsv=require(_0xbd01('0xa'));var querystring=require(_0xbd01('0x11'));var Papa=require('papaparse');var Redis=require(_0xbd01('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xbd01('0x13'));var as=require(_0xbd01('0x14'));var hardwareService=require(_0xbd01('0x15'));var logger=require(_0xbd01('0x16'))(_0xbd01('0x17'));var utils=require(_0xbd01('0x18'));var config=require(_0xbd01('0x19'));var licenseUtil=require(_0xbd01('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5a9ea2,_0x5b91be){_0x5b91be=_0x5b91be||0xcc;return function(_0x302ca7){if(_0x302ca7){return _0x5a9ea2[_0xbd01('0x1b')](_0x5b91be);}return _0x5a9ea2[_0xbd01('0x1c')](_0x5b91be)[_0xbd01('0x1d')]();};}function respondWithResult(_0x25f02a,_0x4679ad){_0x4679ad=_0x4679ad||0xc8;return function(_0x455bc7){if(_0x455bc7){return _0x25f02a[_0xbd01('0x1c')](_0x4679ad)['json'](_0x455bc7);}};}function respondWithFilteredResult(_0x2ba9ce,_0x322ed3){return function(_0x3a7e54){if(_0x3a7e54){var _0x501156=typeof _0x322ed3[_0xbd01('0x1e')]===_0xbd01('0x1f')&&typeof _0x322ed3[_0xbd01('0x20')]===_0xbd01('0x1f');var _0x46b145=_0x3a7e54['count'];var _0x5d689e=_0x501156?0x0:_0x322ed3[_0xbd01('0x1e')];var _0x201e5c=_0x501156?_0x3a7e54[_0xbd01('0x21')]:_0x322ed3[_0xbd01('0x1e')]+_0x322ed3[_0xbd01('0x20')];var _0x41e2fa;if(_0x201e5c>=_0x46b145){_0x201e5c=_0x46b145;_0x41e2fa=0xc8;}else{_0x41e2fa=0xce;}_0x2ba9ce[_0xbd01('0x1c')](_0x41e2fa);return _0x2ba9ce['set'](_0xbd01('0x22'),_0x5d689e+'-'+_0x201e5c+'/'+_0x46b145)[_0xbd01('0x23')](_0x3a7e54);}return null;};}function patchUpdates(_0xb8b807){return function(_0x2097b5){try{jsonpatch[_0xbd01('0x24')](_0x2097b5,_0xb8b807,!![]);}catch(_0x13365e){return BPromise[_0xbd01('0x25')](_0x13365e);}return _0x2097b5[_0xbd01('0x26')]();};}function saveUpdates(_0x17c8a9,_0x15e353){return function(_0x2bdf0e){if(_0x2bdf0e){return _0x2bdf0e['update'](_0x17c8a9)['then'](function(_0x230069){return _0x230069;});}return null;};}function removeEntity(_0x38b0c9,_0x16c9cc){return function(_0x48c15d){if(_0x48c15d){return _0x48c15d[_0xbd01('0x27')]()[_0xbd01('0x28')](function(){var _0x3a85f6=_0x48c15d[_0xbd01('0x29')]({'plain':!![]});var _0x5a5671=_0xbd01('0x2a');return db[_0xbd01('0x2b')][_0xbd01('0x27')]({'where':{'type':_0x5a5671,'resourceId':_0x3a85f6['id']}})[_0xbd01('0x28')](function(){return _0x48c15d;});})[_0xbd01('0x28')](function(){_0x38b0c9[_0xbd01('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1251d5,_0x5b796a){return function(_0x32241c){if(!_0x32241c){_0x1251d5['sendStatus'](0x194);}return _0x32241c;};}function handleError(_0x179ba1,_0x619abe){_0x619abe=_0x619abe||0x1f4;return function(_0x5d0d25){logger[_0xbd01('0x2c')](_0x5d0d25[_0xbd01('0x2d')]);if(_0x5d0d25[_0xbd01('0x2e')]){delete _0x5d0d25['name'];}_0x179ba1['status'](_0x619abe)[_0xbd01('0x2f')](_0x5d0d25);};}exports[_0xbd01('0x30')]=function(_0x184351,_0x476135){var _0x1d0d6b={},_0x7e8600={},_0x591d70={'count':0x0,'rows':[]};var _0x3393c8=_['map'](db[_0xbd01('0x31')][_0xbd01('0x32')],function(_0x2dd255){return{'name':_0x2dd255[_0xbd01('0x33')],'type':_0x2dd255[_0xbd01('0x34')][_0xbd01('0x35')]};});_0x7e8600[_0xbd01('0x36')]=_[_0xbd01('0x37')](_0x3393c8,'name');_0x7e8600[_0xbd01('0x38')]=_[_0xbd01('0x39')](_0x184351[_0xbd01('0x38')]);_0x7e8600[_0xbd01('0x3a')]=_[_0xbd01('0x3b')](_0x7e8600[_0xbd01('0x36')],_0x7e8600[_0xbd01('0x38')]);_0x1d0d6b[_0xbd01('0x3c')]=_['intersection'](_0x7e8600[_0xbd01('0x36')],qs['fields'](_0x184351[_0xbd01('0x38')][_0xbd01('0x3d')]));_0x1d0d6b['attributes']=_0x1d0d6b[_0xbd01('0x3c')][_0xbd01('0x3e')]?_0x1d0d6b['attributes']:_0x7e8600[_0xbd01('0x36')];if(!_0x184351[_0xbd01('0x38')][_0xbd01('0x3f')](_0xbd01('0x40'))){_0x1d0d6b[_0xbd01('0x20')]=qs['limit'](_0x184351[_0xbd01('0x38')][_0xbd01('0x20')]);_0x1d0d6b[_0xbd01('0x1e')]=qs[_0xbd01('0x1e')](_0x184351[_0xbd01('0x38')][_0xbd01('0x1e')]);}_0x1d0d6b[_0xbd01('0x41')]=qs[_0xbd01('0x42')](_0x184351[_0xbd01('0x38')]['sort']);_0x1d0d6b[_0xbd01('0x43')]=qs['filters'](_['pick'](_0x184351['query'],_0x7e8600[_0xbd01('0x3a')]),_0x3393c8);if(_0x184351[_0xbd01('0x38')]['filter']){_0x1d0d6b[_0xbd01('0x43')]=_[_0xbd01('0x44')](_0x1d0d6b[_0xbd01('0x43')],{'$or':_[_0xbd01('0x37')](_0x3393c8,function(_0x57c553){if(_0x57c553[_0xbd01('0x34')]!=='VIRTUAL'){var _0x257f72={};_0x257f72[_0x57c553[_0xbd01('0x2e')]]={'$like':'%'+_0x184351[_0xbd01('0x38')][_0xbd01('0x45')]+'%'};return _0x257f72;}})});}_0x1d0d6b=_['merge']({},_0x1d0d6b,_0x184351['options']);var _0x429143={'where':_0x1d0d6b['where']};return db[_0xbd01('0x31')][_0xbd01('0x21')](_0x429143)[_0xbd01('0x28')](function(_0xa66d94){_0x591d70[_0xbd01('0x21')]=_0xa66d94;if(_0x184351[_0xbd01('0x38')][_0xbd01('0x46')]){_0x1d0d6b[_0xbd01('0x47')]=[{'all':!![]}];}return db['Sound']['findAll'](_0x1d0d6b);})[_0xbd01('0x28')](function(_0xbb1c00){_0x591d70[_0xbd01('0x48')]=_0xbb1c00;return _0x591d70;})['then'](respondWithFilteredResult(_0x476135,_0x1d0d6b))[_0xbd01('0x49')](handleError(_0x476135,null));};exports[_0xbd01('0x4a')]=function(_0x1fada7,_0x12adf3){var _0x1c63c0={'raw':!![],'where':{'id':_0x1fada7[_0xbd01('0x4b')]['id']}},_0x31b710={};_0x31b710[_0xbd01('0x36')]=_[_0xbd01('0x39')](db[_0xbd01('0x31')][_0xbd01('0x32')]);_0x31b710[_0xbd01('0x38')]=_[_0xbd01('0x39')](_0x1fada7[_0xbd01('0x38')]);_0x31b710[_0xbd01('0x3a')]=_[_0xbd01('0x3b')](_0x31b710[_0xbd01('0x36')],_0x31b710[_0xbd01('0x38')]);_0x1c63c0[_0xbd01('0x3c')]=_['intersection'](_0x31b710[_0xbd01('0x36')],qs[_0xbd01('0x3d')](_0x1fada7[_0xbd01('0x38')]['fields']));_0x1c63c0[_0xbd01('0x3c')]=_0x1c63c0[_0xbd01('0x3c')]['length']?_0x1c63c0[_0xbd01('0x3c')]:_0x31b710[_0xbd01('0x36')];if(_0x1fada7['query']['includeAll']){_0x1c63c0[_0xbd01('0x47')]=[{'all':!![]}];}_0x1c63c0=_[_0xbd01('0x44')]({},_0x1c63c0,_0x1fada7[_0xbd01('0x4c')]);return db['Sound'][_0xbd01('0x4d')](_0x1c63c0)[_0xbd01('0x28')](handleEntityNotFound(_0x12adf3,null))[_0xbd01('0x28')](respondWithResult(_0x12adf3,null))[_0xbd01('0x49')](handleError(_0x12adf3,null));};exports['download']=function(_0x263be3,_0x1aba6e,_0x32d274){return db[_0xbd01('0x31')][_0xbd01('0x4d')]({'where':{'id':_0x263be3[_0xbd01('0x4b')]['id']},'attributes':[_0xbd01('0x2e'),_0xbd01('0x4e'),_0xbd01('0x4f')],'raw':!![]})[_0xbd01('0x28')](handleEntityNotFound(_0x1aba6e,null))[_0xbd01('0x28')](function(_0x282ebf){if(_0x282ebf){if(!fs[_0xbd01('0x50')](path[_0xbd01('0x51')](config[_0xbd01('0x52')],'server/files/sounds/converted',_0x282ebf['save_name']+'.'+_0x282ebf[_0xbd01('0x4f')]))){throw new db[(_0xbd01('0x53'))][(_0xbd01('0x54'))](_0xbd01('0x55'));}return _0x1aba6e['download'](path[_0xbd01('0x51')](config[_0xbd01('0x52')],_0xbd01('0x56'),util[_0xbd01('0x57')](_0xbd01('0x58'),_0x282ebf['save_name'],_0x282ebf['converted_format'])),util['format'](_0xbd01('0x58'),_0x282ebf[_0xbd01('0x2e')],_0x282ebf[_0xbd01('0x4f')]));}return null;})[_0xbd01('0x49')](handleError(_0x1aba6e,null));};exports[_0xbd01('0x59')]=function(_0x1ee73a,_0x50c3aa,_0x30c644){var _0x20c1cc={'name':path[_0xbd01('0x5a')](_0x1ee73a[_0xbd01('0x5b')]['originalname'],path[_0xbd01('0x5c')](_0x1ee73a[_0xbd01('0x5b')][_0xbd01('0x5d')])),'save_name':path['basename'](_0x1ee73a['file'][_0xbd01('0x5e')],path[_0xbd01('0x5c')](_0x1ee73a[_0xbd01('0x5b')][_0xbd01('0x5e')])),'original_format':path['extname'](_0x1ee73a[_0xbd01('0x5b')][_0xbd01('0x5d')])[_0xbd01('0x5f')](0x1),'converted_format':'wav'};var _0x162f95=path[_0xbd01('0x51')](config[_0xbd01('0x52')],'server/files/sounds/original',_0x1ee73a['file'][_0xbd01('0x5e')]);var _0x3499ae=path['join'](config[_0xbd01('0x52')],_0xbd01('0x56'),util['format'](_0xbd01('0x58'),path[_0xbd01('0x5a')](_0x1ee73a[_0xbd01('0x5b')][_0xbd01('0x5e')],path[_0xbd01('0x5c')](_0x1ee73a[_0xbd01('0x5b')][_0xbd01('0x5e')])),_0x20c1cc[_0xbd01('0x4f')]));logger[_0xbd01('0x60')](_0xbd01('0x61'),_0x162f95);logger[_0xbd01('0x60')]('Sound\x20upload\x20destination:\x20%s',_0x3499ae);try{fs['chmodSync'](_0x162f95,parseInt('0777',0x8));var _0x3672e4=sox[_0xbd01('0x62')](_0x162f95,_0x3499ae,{'sampleRate':0x1f40,'format':_0xbd01('0x63'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x3672e4['on'](_0xbd01('0x2c'),function(_0x93c9ef){fs[_0xbd01('0x64')](_0x162f95);_0x50c3aa[_0xbd01('0x1c')](0x1f4)[_0xbd01('0x2f')](_0x93c9ef);});_0x3672e4['on'](_0xbd01('0x65'),function(_0x588b9c){_0x20c1cc[_0xbd01('0x66')]=isNaN(_0x588b9c[_0xbd01('0x67')])?null:_0x588b9c['duration']*0x3e8;_0x20c1cc[_0xbd01('0x68')]=isNaN(_0x588b9c[_0xbd01('0x69')])?null:_0x588b9c[_0xbd01('0x69')];_0x20c1cc[_0xbd01('0x6a')]=isNaN(_0x588b9c[_0xbd01('0x6b')])?null:_0x588b9c[_0xbd01('0x6b')];_0x20c1cc['original_bitRate']=isNaN(_0x588b9c[_0xbd01('0x6c')])?null:_0x588b9c[_0xbd01('0x6c')];_0x20c1cc[_0xbd01('0x6d')]=isNaN(_0x588b9c[_0xbd01('0x6e')])?null:_0x588b9c['sampleRate'];});_0x3672e4['on'](_0xbd01('0x6f'),function(_0x53524b){_0x20c1cc[_0xbd01('0x70')]=isNaN(_0x53524b[_0xbd01('0x67')])?null:_0x53524b[_0xbd01('0x67')]*0x3e8;_0x20c1cc[_0xbd01('0x71')]=isNaN(_0x53524b[_0xbd01('0x69')])?null:_0x53524b[_0xbd01('0x69')];_0x20c1cc['converted_channelCount']=isNaN(_0x53524b[_0xbd01('0x6b')])?null:_0x53524b[_0xbd01('0x6b')];_0x20c1cc[_0xbd01('0x72')]=isNaN(_0x53524b[_0xbd01('0x6c')])?null:_0x53524b[_0xbd01('0x6c')];_0x20c1cc[_0xbd01('0x73')]=isNaN(_0x53524b[_0xbd01('0x6e')])?null:_0x53524b[_0xbd01('0x6e')];});_0x3672e4['on']('end',function(){fs[_0xbd01('0x74')](_0x3499ae,parseInt(_0xbd01('0x75'),0x8));return db['Sound']['create'](_0x20c1cc)[_0xbd01('0x28')](function(_0x38bc80){var _0x4f0973={'role':_0x1ee73a[_0xbd01('0x76')]['role'],'userProfileId':_0x1ee73a[_0xbd01('0x76')][_0xbd01('0x77')]};if(!_0x4f0973)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4f0973[_0xbd01('0x78')]===_0xbd01('0x79')){var _0x5599d3=_0x38bc80['get']({'plain':!![]});return db['UserProfileSection']['find']({'where':{'name':_0xbd01('0x2a'),'userProfileId':_0x4f0973['userProfileId']},'raw':!![]})['then'](function(_0x1c4f7b){if(_0x1c4f7b&&_0x1c4f7b['autoAssociation']===0x0){return db[_0xbd01('0x2b')][_0xbd01('0x59')]({'name':_0x5599d3[_0xbd01('0x2e')],'resourceId':_0x5599d3['id'],'type':_0x1c4f7b[_0xbd01('0x2e')],'sectionId':_0x1c4f7b['id']},{})[_0xbd01('0x28')](function(){return _0x38bc80;});}else{return _0x38bc80;}})[_0xbd01('0x49')](function(_0x480ec4){logger[_0xbd01('0x2c')](_0xbd01('0x7a'),_0x480ec4);throw _0x480ec4;});}return _0x38bc80;})[_0xbd01('0x28')](respondWithResult(_0x50c3aa,null))[_0xbd01('0x49')](handleError(_0x50c3aa,null));});_0x3672e4[_0xbd01('0x7b')]();}catch(_0x3cf73d){_0x50c3aa['status'](0x1f4)[_0xbd01('0x2f')](_0x3cf73d);}};exports[_0xbd01('0x7c')]=function(_0x16e763,_0x1d1ec6,_0x225e55){return db[_0xbd01('0x31')][_0xbd01('0x4d')]({'where':{'id':_0x16e763[_0xbd01('0x4b')]['id']}})['then'](handleEntityNotFound(_0x1d1ec6,null))[_0xbd01('0x28')](saveUpdates(_[_0xbd01('0x7d')](_0x16e763[_0xbd01('0x76')],['name',_0xbd01('0x7e')]),null))[_0xbd01('0x28')](respondWithResult(_0x1d1ec6,null))[_0xbd01('0x49')](handleError(_0x1d1ec6,null));};exports[_0xbd01('0x7f')]=function(_0xa973c4,_0x5eef07,_0x19490b){return db[_0xbd01('0x31')][_0xbd01('0x4d')]({'where':{'id':_0xa973c4['params']['id']}})[_0xbd01('0x28')](function(_0x31b248){if(_0x31b248){return _0x31b248[_0xbd01('0x27')]();}})[_0xbd01('0x28')](function(_0x346e30){var _0xb595f5=path[_0xbd01('0x51')](config[_0xbd01('0x52')],_0xbd01('0x80'),util[_0xbd01('0x57')](_0xbd01('0x58'),_0x346e30['save_name'],_0x346e30[_0xbd01('0x81')]));var _0x5ea8d5=path[_0xbd01('0x51')](config[_0xbd01('0x52')],_0xbd01('0x56'),util['format']('%s.%s',_0x346e30[_0xbd01('0x4e')],_0x346e30[_0xbd01('0x4f')]));fs['unlinkSync'](_0xb595f5);fs['unlinkSync'](_0x5ea8d5);return _0x346e30;})[_0xbd01('0x28')](function(_0x42c317){if(_0x42c317){return _0x5eef07[_0xbd01('0x1c')](0xcc)[_0xbd01('0x1d')]();}})[_0xbd01('0x28')](handleEntityNotFound(_0x5eef07,null))[_0xbd01('0x49')](handleError(_0x5eef07,null));}; \ No newline at end of file +var _0x7cc5=['channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_sampleCount','converted_channelCount','converted_bitRate','converted_sampleRate','create','body','role','userProfileId','Sounds','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','description','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','status','json','undefined','limit','offset','set','Content-Range','reject','then','destroy','get','UserProfileResource','end','sendStatus','stack','name','send','index','rawAttributes','fieldName','model','map','query','filters','intersection','fields','attributes','hasOwnProperty','order','sort','pick','filter','where','merge','type','VIRTUAL','options','count','includeAll','include','Sound','findAll','rows','catch','show','keys','length','download','find','params','save_name','existsSync','join','server/files/sounds/converted','Sequelize','Sound\x20not\x20found','root','%s.%s','format','basename','file','extname','filename','originalname','substring','server/files/sounds/original','converted_format','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','transcode','wav','error','unlinkSync','src','original_duration','duration','original_sampleCount','sampleCount','original_channelCount'];(function(_0x379109,_0x53e490){var _0xa78d6d=function(_0x554a53){while(--_0x554a53){_0x379109['push'](_0x379109['shift']());}};_0xa78d6d(++_0x53e490);}(_0x7cc5,0x10c));var _0x57cc=function(_0x3c9c23,_0x2ba2ac){_0x3c9c23=_0x3c9c23-0x0;var _0x1bc438=_0x7cc5[_0x3c9c23];return _0x1bc438;};'use strict';var emlformat=require(_0x57cc('0x0'));var rimraf=require(_0x57cc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x57cc('0x2'));var rp=require(_0x57cc('0x3'));var moment=require(_0x57cc('0x4'));var BPromise=require(_0x57cc('0x5'));var Mustache=require(_0x57cc('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x57cc('0x7'));var ejs=require(_0x57cc('0x8'));var fs=require('fs');var fs_extra=require(_0x57cc('0x9'));var _=require(_0x57cc('0xa'));var squel=require(_0x57cc('0xb'));var crypto=require(_0x57cc('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x57cc('0xd'));var toCsv=require(_0x57cc('0x7'));var querystring=require(_0x57cc('0xe'));var Papa=require('papaparse');var Redis=require(_0x57cc('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x57cc('0x10'));var hardwareService=require(_0x57cc('0x11'));var logger=require(_0x57cc('0x12'))(_0x57cc('0x13'));var utils=require('../../config/utils');var config=require(_0x57cc('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x57cc('0x15'))['db'];function respondWithStatusCode(_0x36c4dd,_0x988730){_0x988730=_0x988730||0xcc;return function(_0x31f28a){if(_0x31f28a){return _0x36c4dd['sendStatus'](_0x988730);}return _0x36c4dd[_0x57cc('0x16')](_0x988730)['end']();};}function respondWithResult(_0x4d60fe,_0x4d2683){_0x4d2683=_0x4d2683||0xc8;return function(_0x5e7c34){if(_0x5e7c34){return _0x4d60fe[_0x57cc('0x16')](_0x4d2683)[_0x57cc('0x17')](_0x5e7c34);}};}function respondWithFilteredResult(_0x21c33d,_0x572077){return function(_0x11a68a){if(_0x11a68a){var _0x1f4b9a=typeof _0x572077['offset']===_0x57cc('0x18')&&typeof _0x572077[_0x57cc('0x19')]===_0x57cc('0x18');var _0x2c1e27=_0x11a68a['count'];var _0x4815d1=_0x1f4b9a?0x0:_0x572077[_0x57cc('0x1a')];var _0x2fd757=_0x1f4b9a?_0x11a68a['count']:_0x572077['offset']+_0x572077['limit'];var _0x5e7b21;if(_0x2fd757>=_0x2c1e27){_0x2fd757=_0x2c1e27;_0x5e7b21=0xc8;}else{_0x5e7b21=0xce;}_0x21c33d[_0x57cc('0x16')](_0x5e7b21);return _0x21c33d[_0x57cc('0x1b')](_0x57cc('0x1c'),_0x4815d1+'-'+_0x2fd757+'/'+_0x2c1e27)[_0x57cc('0x17')](_0x11a68a);}return null;};}function patchUpdates(_0x132add){return function(_0x3bc496){try{jsonpatch['apply'](_0x3bc496,_0x132add,!![]);}catch(_0x271172){return BPromise[_0x57cc('0x1d')](_0x271172);}return _0x3bc496['save']();};}function saveUpdates(_0x4e5688,_0xcc94c7){return function(_0x8a5f84){if(_0x8a5f84){return _0x8a5f84['update'](_0x4e5688)[_0x57cc('0x1e')](function(_0x496114){return _0x496114;});}return null;};}function removeEntity(_0x371e7,_0x3e4625){return function(_0x295288){if(_0x295288){return _0x295288[_0x57cc('0x1f')]()[_0x57cc('0x1e')](function(){var _0x3c3a08=_0x295288[_0x57cc('0x20')]({'plain':!![]});var _0x3ccdb8='Sounds';return db[_0x57cc('0x21')][_0x57cc('0x1f')]({'where':{'type':_0x3ccdb8,'resourceId':_0x3c3a08['id']}})[_0x57cc('0x1e')](function(){return _0x295288;});})[_0x57cc('0x1e')](function(){_0x371e7['status'](0xcc)[_0x57cc('0x22')]();});}};}function handleEntityNotFound(_0x2fd557,_0x2a3496){return function(_0x5e5a40){if(!_0x5e5a40){_0x2fd557[_0x57cc('0x23')](0x194);}return _0x5e5a40;};}function handleError(_0xc5e6f7,_0x4f3a83){_0x4f3a83=_0x4f3a83||0x1f4;return function(_0x529495){logger['error'](_0x529495[_0x57cc('0x24')]);if(_0x529495[_0x57cc('0x25')]){delete _0x529495['name'];}_0xc5e6f7[_0x57cc('0x16')](_0x4f3a83)[_0x57cc('0x26')](_0x529495);};}exports[_0x57cc('0x27')]=function(_0x4483de,_0x727232){var _0x5a3aac={},_0x4edb43={},_0x40246f={'count':0x0,'rows':[]};var _0x36ae09=_['map'](db['Sound'][_0x57cc('0x28')],function(_0x54edfe){return{'name':_0x54edfe[_0x57cc('0x29')],'type':_0x54edfe['type']['key']};});_0x4edb43[_0x57cc('0x2a')]=_[_0x57cc('0x2b')](_0x36ae09,_0x57cc('0x25'));_0x4edb43[_0x57cc('0x2c')]=_['keys'](_0x4483de[_0x57cc('0x2c')]);_0x4edb43[_0x57cc('0x2d')]=_[_0x57cc('0x2e')](_0x4edb43[_0x57cc('0x2a')],_0x4edb43[_0x57cc('0x2c')]);_0x5a3aac['attributes']=_[_0x57cc('0x2e')](_0x4edb43[_0x57cc('0x2a')],qs[_0x57cc('0x2f')](_0x4483de[_0x57cc('0x2c')]['fields']));_0x5a3aac[_0x57cc('0x30')]=_0x5a3aac[_0x57cc('0x30')]['length']?_0x5a3aac[_0x57cc('0x30')]:_0x4edb43['model'];if(!_0x4483de[_0x57cc('0x2c')][_0x57cc('0x31')]('nolimit')){_0x5a3aac[_0x57cc('0x19')]=qs[_0x57cc('0x19')](_0x4483de['query'][_0x57cc('0x19')]);_0x5a3aac[_0x57cc('0x1a')]=qs[_0x57cc('0x1a')](_0x4483de[_0x57cc('0x2c')]['offset']);}_0x5a3aac[_0x57cc('0x32')]=qs[_0x57cc('0x33')](_0x4483de[_0x57cc('0x2c')][_0x57cc('0x33')]);_0x5a3aac['where']=qs['filters'](_[_0x57cc('0x34')](_0x4483de[_0x57cc('0x2c')],_0x4edb43[_0x57cc('0x2d')]),_0x36ae09);if(_0x4483de[_0x57cc('0x2c')][_0x57cc('0x35')]){_0x5a3aac[_0x57cc('0x36')]=_[_0x57cc('0x37')](_0x5a3aac[_0x57cc('0x36')],{'$or':_['map'](_0x36ae09,function(_0x216a5f){if(_0x216a5f[_0x57cc('0x38')]!==_0x57cc('0x39')){var _0x4b2690={};_0x4b2690[_0x216a5f['name']]={'$like':'%'+_0x4483de[_0x57cc('0x2c')]['filter']+'%'};return _0x4b2690;}})});}_0x5a3aac=_[_0x57cc('0x37')]({},_0x5a3aac,_0x4483de[_0x57cc('0x3a')]);var _0x964395={'where':_0x5a3aac[_0x57cc('0x36')]};return db['Sound'][_0x57cc('0x3b')](_0x964395)['then'](function(_0x16ce6e){_0x40246f[_0x57cc('0x3b')]=_0x16ce6e;if(_0x4483de[_0x57cc('0x2c')][_0x57cc('0x3c')]){_0x5a3aac[_0x57cc('0x3d')]=[{'all':!![]}];}return db[_0x57cc('0x3e')][_0x57cc('0x3f')](_0x5a3aac);})[_0x57cc('0x1e')](function(_0x3383a0){_0x40246f[_0x57cc('0x40')]=_0x3383a0;return _0x40246f;})['then'](respondWithFilteredResult(_0x727232,_0x5a3aac))[_0x57cc('0x41')](handleError(_0x727232,null));};exports[_0x57cc('0x42')]=function(_0x1ff51c,_0x12fae7){var _0x8ef472={'raw':!![],'where':{'id':_0x1ff51c['params']['id']}},_0x257d7e={};_0x257d7e[_0x57cc('0x2a')]=_['keys'](db['Sound']['rawAttributes']);_0x257d7e[_0x57cc('0x2c')]=_[_0x57cc('0x43')](_0x1ff51c[_0x57cc('0x2c')]);_0x257d7e[_0x57cc('0x2d')]=_[_0x57cc('0x2e')](_0x257d7e[_0x57cc('0x2a')],_0x257d7e[_0x57cc('0x2c')]);_0x8ef472[_0x57cc('0x30')]=_[_0x57cc('0x2e')](_0x257d7e['model'],qs[_0x57cc('0x2f')](_0x1ff51c['query'][_0x57cc('0x2f')]));_0x8ef472[_0x57cc('0x30')]=_0x8ef472[_0x57cc('0x30')][_0x57cc('0x44')]?_0x8ef472[_0x57cc('0x30')]:_0x257d7e[_0x57cc('0x2a')];if(_0x1ff51c[_0x57cc('0x2c')][_0x57cc('0x3c')]){_0x8ef472[_0x57cc('0x3d')]=[{'all':!![]}];}_0x8ef472=_['merge']({},_0x8ef472,_0x1ff51c[_0x57cc('0x3a')]);return db[_0x57cc('0x3e')]['find'](_0x8ef472)[_0x57cc('0x1e')](handleEntityNotFound(_0x12fae7,null))[_0x57cc('0x1e')](respondWithResult(_0x12fae7,null))['catch'](handleError(_0x12fae7,null));};exports[_0x57cc('0x45')]=function(_0x160fbe,_0x234647,_0x1558ed){return db[_0x57cc('0x3e')][_0x57cc('0x46')]({'where':{'id':_0x160fbe[_0x57cc('0x47')]['id']},'attributes':['name',_0x57cc('0x48'),'converted_format'],'raw':!![]})[_0x57cc('0x1e')](handleEntityNotFound(_0x234647,null))['then'](function(_0x27092f){if(_0x27092f){if(!fs[_0x57cc('0x49')](path[_0x57cc('0x4a')](config['root'],_0x57cc('0x4b'),_0x27092f[_0x57cc('0x48')]+'.'+_0x27092f['converted_format']))){throw new db[(_0x57cc('0x4c'))]['ValidationError'](_0x57cc('0x4d'));}return _0x234647[_0x57cc('0x45')](path[_0x57cc('0x4a')](config[_0x57cc('0x4e')],_0x57cc('0x4b'),util['format'](_0x57cc('0x4f'),_0x27092f[_0x57cc('0x48')],_0x27092f['converted_format'])),util[_0x57cc('0x50')]('%s.%s',_0x27092f[_0x57cc('0x25')],_0x27092f['converted_format']));}return null;})[_0x57cc('0x41')](handleError(_0x234647,null));};exports['create']=function(_0x5b2577,_0xa578dd,_0x5a5826){var _0x21eaa0={'name':path[_0x57cc('0x51')](_0x5b2577[_0x57cc('0x52')]['originalname'],path[_0x57cc('0x53')](_0x5b2577[_0x57cc('0x52')]['originalname'])),'save_name':path['basename'](_0x5b2577[_0x57cc('0x52')][_0x57cc('0x54')],path[_0x57cc('0x53')](_0x5b2577[_0x57cc('0x52')][_0x57cc('0x54')])),'original_format':path[_0x57cc('0x53')](_0x5b2577['file'][_0x57cc('0x55')])[_0x57cc('0x56')](0x1),'converted_format':'wav'};var _0x49e345=path[_0x57cc('0x4a')](config[_0x57cc('0x4e')],_0x57cc('0x57'),_0x5b2577[_0x57cc('0x52')]['filename']);var _0x18e82b=path[_0x57cc('0x4a')](config[_0x57cc('0x4e')],_0x57cc('0x4b'),util['format']('%s.%s',path[_0x57cc('0x51')](_0x5b2577[_0x57cc('0x52')]['filename'],path['extname'](_0x5b2577[_0x57cc('0x52')][_0x57cc('0x54')])),_0x21eaa0[_0x57cc('0x58')]));logger[_0x57cc('0x59')](_0x57cc('0x5a'),_0x49e345);logger[_0x57cc('0x59')](_0x57cc('0x5b'),_0x18e82b);try{fs[_0x57cc('0x5c')](_0x49e345,parseInt(_0x57cc('0x5d'),0x8));var _0x26a839=sox[_0x57cc('0x5e')](_0x49e345,_0x18e82b,{'sampleRate':0x1f40,'format':_0x57cc('0x5f'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x26a839['on'](_0x57cc('0x60'),function(_0x5db7e1){fs[_0x57cc('0x61')](_0x49e345);_0xa578dd[_0x57cc('0x16')](0x1f4)['send'](_0x5db7e1);});_0x26a839['on'](_0x57cc('0x62'),function(_0x340e40){_0x21eaa0[_0x57cc('0x63')]=isNaN(_0x340e40[_0x57cc('0x64')])?null:_0x340e40[_0x57cc('0x64')]*0x3e8;_0x21eaa0[_0x57cc('0x65')]=isNaN(_0x340e40[_0x57cc('0x66')])?null:_0x340e40[_0x57cc('0x66')];_0x21eaa0[_0x57cc('0x67')]=isNaN(_0x340e40['channelCount'])?null:_0x340e40[_0x57cc('0x68')];_0x21eaa0[_0x57cc('0x69')]=isNaN(_0x340e40[_0x57cc('0x6a')])?null:_0x340e40[_0x57cc('0x6a')];_0x21eaa0[_0x57cc('0x6b')]=isNaN(_0x340e40['sampleRate'])?null:_0x340e40[_0x57cc('0x6c')];});_0x26a839['on'](_0x57cc('0x6d'),function(_0x1cd60f){_0x21eaa0[_0x57cc('0x6e')]=isNaN(_0x1cd60f[_0x57cc('0x64')])?null:_0x1cd60f[_0x57cc('0x64')]*0x3e8;_0x21eaa0[_0x57cc('0x6f')]=isNaN(_0x1cd60f[_0x57cc('0x66')])?null:_0x1cd60f[_0x57cc('0x66')];_0x21eaa0[_0x57cc('0x70')]=isNaN(_0x1cd60f[_0x57cc('0x68')])?null:_0x1cd60f[_0x57cc('0x68')];_0x21eaa0[_0x57cc('0x71')]=isNaN(_0x1cd60f[_0x57cc('0x6a')])?null:_0x1cd60f[_0x57cc('0x6a')];_0x21eaa0[_0x57cc('0x72')]=isNaN(_0x1cd60f[_0x57cc('0x6c')])?null:_0x1cd60f[_0x57cc('0x6c')];});_0x26a839['on'](_0x57cc('0x22'),function(){fs[_0x57cc('0x5c')](_0x18e82b,parseInt(_0x57cc('0x5d'),0x8));return db['Sound'][_0x57cc('0x73')](_0x21eaa0)['then'](function(_0x49a380){var _0x4491f5={'role':_0x5b2577[_0x57cc('0x74')][_0x57cc('0x75')],'userProfileId':_0x5b2577[_0x57cc('0x74')][_0x57cc('0x76')]};if(!_0x4491f5)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4491f5[_0x57cc('0x75')]==='user'){var _0x9db108=_0x49a380['get']({'plain':!![]});return db['UserProfileSection'][_0x57cc('0x46')]({'where':{'name':_0x57cc('0x77'),'userProfileId':_0x4491f5[_0x57cc('0x76')]},'raw':!![]})[_0x57cc('0x1e')](function(_0x2d3638){if(_0x2d3638&&_0x2d3638[_0x57cc('0x78')]===0x0){return db['UserProfileResource'][_0x57cc('0x73')]({'name':_0x9db108[_0x57cc('0x25')],'resourceId':_0x9db108['id'],'type':_0x2d3638[_0x57cc('0x25')],'sectionId':_0x2d3638['id']},{})[_0x57cc('0x1e')](function(){return _0x49a380;});}else{return _0x49a380;}})[_0x57cc('0x41')](function(_0x14195a){logger[_0x57cc('0x60')](_0x57cc('0x79'),_0x14195a);throw _0x14195a;});}return _0x49a380;})[_0x57cc('0x1e')](respondWithResult(_0xa578dd,null))['catch'](handleError(_0xa578dd,null));});_0x26a839['start']();}catch(_0x2b4414){_0xa578dd['status'](0x1f4)[_0x57cc('0x26')](_0x2b4414);}};exports[_0x57cc('0x7a')]=function(_0x145147,_0x23c160,_0x4eed41){return db[_0x57cc('0x3e')][_0x57cc('0x46')]({'where':{'id':_0x145147['params']['id']}})[_0x57cc('0x1e')](handleEntityNotFound(_0x23c160,null))[_0x57cc('0x1e')](saveUpdates(_[_0x57cc('0x34')](_0x145147['body'],[_0x57cc('0x25'),_0x57cc('0x7b')]),null))[_0x57cc('0x1e')](respondWithResult(_0x23c160,null))[_0x57cc('0x41')](handleError(_0x23c160,null));};exports['delete']=function(_0x4a9fc7,_0xb62658,_0x480464){return db[_0x57cc('0x3e')][_0x57cc('0x46')]({'where':{'id':_0x4a9fc7[_0x57cc('0x47')]['id']}})[_0x57cc('0x1e')](function(_0x5a1527){if(_0x5a1527){return _0x5a1527[_0x57cc('0x1f')]();}})[_0x57cc('0x1e')](function(_0x592e8c){var _0x2877dd=path[_0x57cc('0x4a')](config['root'],_0x57cc('0x57'),util[_0x57cc('0x50')](_0x57cc('0x4f'),_0x592e8c[_0x57cc('0x48')],_0x592e8c['original_format']));var _0x3376b5=path[_0x57cc('0x4a')](config[_0x57cc('0x4e')],'server/files/sounds/converted',util['format'](_0x57cc('0x4f'),_0x592e8c[_0x57cc('0x48')],_0x592e8c[_0x57cc('0x58')]));fs[_0x57cc('0x61')](_0x2877dd);fs[_0x57cc('0x61')](_0x3376b5);return _0x592e8c;})[_0x57cc('0x1e')](function(_0x302a8f){if(_0x302a8f){return _0xb62658[_0x57cc('0x16')](0xcc)['end']();}})[_0x57cc('0x1e')](handleEntityNotFound(_0xb62658,null))[_0x57cc('0x41')](handleError(_0xb62658,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index 71e0935..e825a43 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 _0x2f70=['exports','define','Sound','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./sound.attributes'];(function(_0x234a4c,_0x54a50c){var _0x30d9f6=function(_0x65ccc1){while(--_0x65ccc1){_0x234a4c['push'](_0x234a4c['shift']());}};_0x30d9f6(++_0x54a50c);}(_0x2f70,0x18f));var _0x02f7=function(_0x5f4deb,_0x5a46c3){_0x5f4deb=_0x5f4deb-0x0;var _0x1c8aa5=_0x2f70[_0x5f4deb];return _0x1c8aa5;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x02f7('0x0'))(_0x02f7('0x1'));var moment=require(_0x02f7('0x2'));var BPromise=require(_0x02f7('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x02f7('0x4'));var rimraf=require(_0x02f7('0x5'));var config=require(_0x02f7('0x6'));var attributes=require(_0x02f7('0x7'));module[_0x02f7('0x8')]=function(_0x46c10f,_0x4f122f){return _0x46c10f[_0x02f7('0x9')](_0x02f7('0xa'),attributes,{'tableName':'tools_sounds','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xec75=['util','../../config/logger','api','moment','bluebird','../../config/environment','./sound.attributes','Sound','lodash'];(function(_0x2b05f,_0x41c02d){var _0xf95755=function(_0x33ac69){while(--_0x33ac69){_0x2b05f['push'](_0x2b05f['shift']());}};_0xf95755(++_0x41c02d);}(_0xec75,0x98));var _0x5ec7=function(_0x4e672b,_0x4b8263){_0x4e672b=_0x4e672b-0x0;var _0x19b2a0=_0xec75[_0x4e672b];return _0x19b2a0;};'use strict';var _=require(_0x5ec7('0x0'));var util=require(_0x5ec7('0x1'));var logger=require(_0x5ec7('0x2'))(_0x5ec7('0x3'));var moment=require(_0x5ec7('0x4'));var BPromise=require(_0x5ec7('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x5ec7('0x6'));var attributes=require(_0x5ec7('0x7'));module['exports']=function(_0xe75686,_0xdecb8f){return _0xe75686['define'](_0x5ec7('0x8'),attributes,{'tableName':'tools_sounds','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 916ac8c..8824c2b 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 _0x4ce3=['Sound','find','options','raw','where','attributes','map','include','model','then','debug','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','request','Sound,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch','ShowSound'];(function(_0x4d264,_0x189efd){var _0x37a197=function(_0x20ad31){while(--_0x20ad31){_0x4d264['push'](_0x4d264['shift']());}};_0x37a197(++_0x189efd);}(_0x4ce3,0x14a));var _0x34ce=function(_0x39d474,_0x280fb6){_0x39d474=_0x39d474-0x0;var _0x5915ca=_0x4ce3[_0x39d474];return _0x5915ca;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x34ce('0x0'));var BPromise=require(_0x34ce('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x34ce('0x2'));var db=require(_0x34ce('0x3'))['db'];var utils=require(_0x34ce('0x4'));var logger=require(_0x34ce('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x34ce('0x6'));var client=jayson[_0x34ce('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1915ae,_0x5b290a,_0x5a1c5a){return new BPromise(function(_0x1e786e,_0x12537b){return client[_0x34ce('0x8')](_0x1915ae,_0x5a1c5a)['then'](function(_0x48a43a){logger['info'](_0x34ce('0x9'),_0x5b290a,_0x34ce('0xa'));logger['debug']('Sound,\x20%s,\x20%s,\x20%s',_0x5b290a,_0x34ce('0xa'),JSON[_0x34ce('0xb')](_0x48a43a));if(_0x48a43a['error']){if(_0x48a43a[_0x34ce('0xc')][_0x34ce('0xd')]===0x1f4){logger['error']('Sound,\x20%s,\x20%s',_0x5b290a,_0x48a43a[_0x34ce('0xc')][_0x34ce('0xe')]);return _0x12537b(_0x48a43a['error']['message']);}logger['error'](_0x34ce('0x9'),_0x5b290a,_0x48a43a[_0x34ce('0xc')]['message']);return _0x1e786e(_0x48a43a[_0x34ce('0xc')][_0x34ce('0xe')]);}else{logger[_0x34ce('0xf')](_0x34ce('0x9'),_0x5b290a,_0x34ce('0xa'));_0x1e786e(_0x48a43a['result'][_0x34ce('0xe')]);}})[_0x34ce('0x10')](function(_0x1fef90){logger[_0x34ce('0xc')](_0x34ce('0x9'),_0x5b290a,_0x1fef90);_0x12537b(_0x1fef90);});});}exports[_0x34ce('0x11')]=function(_0x2b3824){var _0x3f79ee=this;return new Promise(function(_0x221fa6,_0x48fc65){return db[_0x34ce('0x12')][_0x34ce('0x13')]({'raw':_0x2b3824[_0x34ce('0x14')]?_0x2b3824[_0x34ce('0x14')][_0x34ce('0x15')]===undefined?!![]:![]:!![],'where':_0x2b3824[_0x34ce('0x14')]?_0x2b3824['options'][_0x34ce('0x16')]||null:null,'attributes':_0x2b3824['options']?_0x2b3824['options'][_0x34ce('0x17')]||null:null,'include':_0x2b3824[_0x34ce('0x14')]?_0x2b3824[_0x34ce('0x14')]['include']?_[_0x34ce('0x18')](_0x2b3824[_0x34ce('0x14')][_0x34ce('0x19')],function(_0x3874a0){return{'model':db[_0x3874a0[_0x34ce('0x1a')]],'as':_0x3874a0['as'],'attributes':_0x3874a0[_0x34ce('0x17')],'include':_0x3874a0[_0x34ce('0x19')]?_[_0x34ce('0x18')](_0x3874a0[_0x34ce('0x19')],function(_0x395fdf){return{'model':db[_0x395fdf[_0x34ce('0x1a')]],'as':_0x395fdf['as'],'attributes':_0x395fdf[_0x34ce('0x17')],'include':_0x395fdf[_0x34ce('0x19')]?_['map'](_0x395fdf['include'],function(_0xc81869){return{'model':db[_0xc81869[_0x34ce('0x1a')]],'as':_0xc81869['as'],'attributes':_0xc81869[_0x34ce('0x17')]};}):[]};}):[]};}):[]:[]})[_0x34ce('0x1b')](function(_0x478c07){logger[_0x34ce('0xf')](_0x34ce('0x11'),_0x2b3824);logger[_0x34ce('0x1c')]('ShowSound',_0x2b3824,JSON[_0x34ce('0xb')](_0x478c07));_0x221fa6(_0x478c07);})[_0x34ce('0x10')](function(_0x4a9060){logger[_0x34ce('0xc')](_0x34ce('0x11'),_0x4a9060[_0x34ce('0xe')],_0x2b3824);_0x48fc65(_0x3f79ee[_0x34ce('0xc')](0x1f4,_0x4a9060[_0x34ce('0xe')]));});});}; \ No newline at end of file +var _0xe6e4=['rpc','../../config/environment','client','http','info','Sound,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','ShowSound','Sound','find','options','where','attributes','include','model','map','then','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x5dcae8,_0x14040a){var _0xa7a0c6=function(_0x40d4a9){while(--_0x40d4a9){_0x5dcae8['push'](_0x5dcae8['shift']());}};_0xa7a0c6(++_0x14040a);}(_0xe6e4,0xd1));var _0x4e6e=function(_0x17c8cc,_0x5e5647){_0x17c8cc=_0x17c8cc-0x0;var _0x3db4eb=_0xe6e4[_0x17c8cc];return _0x3db4eb;};'use strict';var _=require(_0x4e6e('0x0'));var util=require(_0x4e6e('0x1'));var moment=require(_0x4e6e('0x2'));var BPromise=require(_0x4e6e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4e6e('0x4'));var db=require(_0x4e6e('0x5'))['db'];var utils=require(_0x4e6e('0x6'));var logger=require(_0x4e6e('0x7'))(_0x4e6e('0x8'));var config=require(_0x4e6e('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x4e6e('0xa')][_0x4e6e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x31ff47,_0x2e02a6,_0xf1eaf3){return new BPromise(function(_0xacb182,_0x154766){return client['request'](_0x31ff47,_0xf1eaf3)['then'](function(_0xc89323){logger[_0x4e6e('0xc')](_0x4e6e('0xd'),_0x2e02a6,'request\x20sent');logger['debug']('Sound,\x20%s,\x20%s,\x20%s',_0x2e02a6,'request\x20sent',JSON[_0x4e6e('0xe')](_0xc89323));if(_0xc89323['error']){if(_0xc89323[_0x4e6e('0xf')][_0x4e6e('0x10')]===0x1f4){logger[_0x4e6e('0xf')](_0x4e6e('0xd'),_0x2e02a6,_0xc89323[_0x4e6e('0xf')]['message']);return _0x154766(_0xc89323[_0x4e6e('0xf')][_0x4e6e('0x11')]);}logger[_0x4e6e('0xf')](_0x4e6e('0xd'),_0x2e02a6,_0xc89323[_0x4e6e('0xf')][_0x4e6e('0x11')]);return _0xacb182(_0xc89323[_0x4e6e('0xf')][_0x4e6e('0x11')]);}else{logger['info'](_0x4e6e('0xd'),_0x2e02a6,_0x4e6e('0x12'));_0xacb182(_0xc89323[_0x4e6e('0x13')][_0x4e6e('0x11')]);}})['catch'](function(_0x117f18){logger['error'](_0x4e6e('0xd'),_0x2e02a6,_0x117f18);_0x154766(_0x117f18);});});}exports[_0x4e6e('0x14')]=function(_0x2924d9){var _0xc174bf=this;return new Promise(function(_0x15dd9a,_0x5196b8){return db[_0x4e6e('0x15')][_0x4e6e('0x16')]({'raw':_0x2924d9[_0x4e6e('0x17')]?_0x2924d9[_0x4e6e('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x2924d9['options']?_0x2924d9[_0x4e6e('0x17')][_0x4e6e('0x18')]||null:null,'attributes':_0x2924d9['options']?_0x2924d9['options'][_0x4e6e('0x19')]||null:null,'include':_0x2924d9[_0x4e6e('0x17')]?_0x2924d9[_0x4e6e('0x17')][_0x4e6e('0x1a')]?_['map'](_0x2924d9[_0x4e6e('0x17')][_0x4e6e('0x1a')],function(_0x119956){return{'model':db[_0x119956[_0x4e6e('0x1b')]],'as':_0x119956['as'],'attributes':_0x119956[_0x4e6e('0x19')],'include':_0x119956['include']?_[_0x4e6e('0x1c')](_0x119956[_0x4e6e('0x1a')],function(_0x10bbb8){return{'model':db[_0x10bbb8[_0x4e6e('0x1b')]],'as':_0x10bbb8['as'],'attributes':_0x10bbb8[_0x4e6e('0x19')],'include':_0x10bbb8[_0x4e6e('0x1a')]?_['map'](_0x10bbb8['include'],function(_0x54f383){return{'model':db[_0x54f383[_0x4e6e('0x1b')]],'as':_0x54f383['as'],'attributes':_0x54f383[_0x4e6e('0x19')]};}):[]};}):[]};}):[]:[]})[_0x4e6e('0x1d')](function(_0x45a068){logger[_0x4e6e('0xc')](_0x4e6e('0x14'),_0x2924d9);logger['debug'](_0x4e6e('0x14'),_0x2924d9,JSON['stringify'](_0x45a068));_0x15dd9a(_0x45a068);})[_0x4e6e('0x1e')](function(_0x923ae2){logger['error'](_0x4e6e('0x14'),_0x923ae2[_0x4e6e('0x11')],_0x2924d9);_0x5196b8(_0xc174bf['error'](0x1f4,_0x923ae2[_0x4e6e('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index 0eb2b5c..5daeff8 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 _0xda2d=['isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../config/environment','./squareMessage.controller','get'];(function(_0x531e48,_0x4bb96b){var _0x202971=function(_0x403bf5){while(--_0x403bf5){_0x531e48['push'](_0x531e48['shift']());}};_0x202971(++_0x4bb96b);}(_0xda2d,0x102));var _0xdda2=function(_0x80f77f,_0x42aa55){_0x80f77f=_0x80f77f-0x0;var _0x4288e8=_0xda2d[_0x80f77f];return _0x4288e8;};'use strict';var multer=require('multer');var util=require(_0xdda2('0x0'));var path=require(_0xdda2('0x1'));var timeout=require(_0xdda2('0x2'));var express=require(_0xdda2('0x3'));var router=express[_0xdda2('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xdda2('0x5'));var controller=require(_0xdda2('0x6'));router[_0xdda2('0x7')]('/',auth[_0xdda2('0x8')](),controller[_0xdda2('0x9')]);router[_0xdda2('0x7')](_0xdda2('0xa'),auth[_0xdda2('0x8')](),controller[_0xdda2('0xb')]);router[_0xdda2('0xc')]('/',auth['isAuthenticated'](),controller[_0xdda2('0xd')]);router[_0xdda2('0xe')]('/:id',auth[_0xdda2('0x8')](),controller[_0xdda2('0xf')]);router[_0xdda2('0x10')](_0xdda2('0xa'),auth[_0xdda2('0x8')](),controller[_0xdda2('0x11')]);module[_0xdda2('0x12')]=router; \ No newline at end of file +var _0x4fc2=['show','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./squareMessage.controller','isAuthenticated','index','/:id'];(function(_0x2298f0,_0x3bbf4f){var _0x39b136=function(_0xc2cd6e){while(--_0xc2cd6e){_0x2298f0['push'](_0x2298f0['shift']());}};_0x39b136(++_0x3bbf4f);}(_0x4fc2,0x111));var _0x24fc=function(_0x5c4669,_0x7f9bcd){_0x5c4669=_0x5c4669-0x0;var _0xf18b6a=_0x4fc2[_0x5c4669];return _0xf18b6a;};'use strict';var multer=require(_0x24fc('0x0'));var util=require(_0x24fc('0x1'));var path=require(_0x24fc('0x2'));var timeout=require(_0x24fc('0x3'));var express=require('express');var router=express[_0x24fc('0x4')]();var fs_extra=require(_0x24fc('0x5'));var auth=require(_0x24fc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x24fc('0x7'));var controller=require(_0x24fc('0x8'));router['get']('/',auth[_0x24fc('0x9')](),controller[_0x24fc('0xa')]);router['get'](_0x24fc('0xb'),auth[_0x24fc('0x9')](),controller[_0x24fc('0xc')]);router[_0x24fc('0xd')]('/',auth[_0x24fc('0x9')](),controller[_0x24fc('0xe')]);router['put'](_0x24fc('0xb'),auth[_0x24fc('0x9')](),controller[_0x24fc('0xf')]);router[_0x24fc('0x10')](_0x24fc('0xb'),auth[_0x24fc('0x9')](),controller[_0x24fc('0x11')]);module[_0x24fc('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index aefcb11..8a94385 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 _0xe7c6=['ENUM','out','sequelize','exports','STRING','TEXT','medium'];(function(_0x483205,_0x16ace9){var _0x45dbbb=function(_0x110bfc){while(--_0x110bfc){_0x483205['push'](_0x483205['shift']());}};_0x45dbbb(++_0x16ace9);}(_0xe7c6,0x105));var _0x6e7c=function(_0xa41274,_0x77f9b8){_0xa41274=_0xa41274-0x0;var _0x3d525a=_0xe7c6[_0xa41274];return _0x3d525a;};'use strict';var Sequelize=require(_0x6e7c('0x0'));module[_0x6e7c('0x1')]={'uniqueid':{'type':Sequelize[_0x6e7c('0x2')]},'body':{'type':Sequelize[_0x6e7c('0x3')](_0x6e7c('0x4')),'allowNull':![]},'direction':{'type':Sequelize[_0x6e7c('0x5')]('in',_0x6e7c('0x6')),'defaultValue':_0x6e7c('0x6'),'allowNull':![]},'providerName':{'type':Sequelize[_0x6e7c('0x2')]},'providerResponse':{'type':Sequelize[_0x6e7c('0x3')]}}; \ No newline at end of file +var _0x7d11=['sequelize','exports','STRING','TEXT','ENUM','out'];(function(_0x5b1f59,_0xb00751){var _0x53ab60=function(_0x3fa436){while(--_0x3fa436){_0x5b1f59['push'](_0x5b1f59['shift']());}};_0x53ab60(++_0xb00751);}(_0x7d11,0xb4));var _0x17d1=function(_0x1ef566,_0x739ea1){_0x1ef566=_0x1ef566-0x0;var _0x91a95d=_0x7d11[_0x1ef566];return _0x91a95d;};'use strict';var Sequelize=require(_0x17d1('0x0'));module[_0x17d1('0x1')]={'uniqueid':{'type':Sequelize[_0x17d1('0x2')]},'body':{'type':Sequelize[_0x17d1('0x3')]('medium'),'allowNull':![]},'direction':{'type':Sequelize[_0x17d1('0x4')]('in',_0x17d1('0x5')),'defaultValue':'out','allowNull':![]},'providerName':{'type':Sequelize[_0x17d1('0x2')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index 226ef4e..9cdc160 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 _0x6216=['sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','save','update','destroy','then','error','stack','name','send','index','map','rawAttributes','type','key','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','SquareMessage','include','findAll','rows','catch','keys','includeAll','options','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path'];(function(_0xe639d7,_0x4009e3){var _0x43e3cf=function(_0x562d1d){while(--_0x562d1d){_0xe639d7['push'](_0xe639d7['shift']());}};_0x43e3cf(++_0x4009e3);}(_0x6216,0x90));var _0x6621=function(_0x4572fc,_0x3c5f49){_0x4572fc=_0x4572fc-0x0;var _0x25f2f5=_0x6216[_0x4572fc];return _0x25f2f5;};'use strict';var emlformat=require(_0x6621('0x0'));var rimraf=require(_0x6621('0x1'));var zipdir=require(_0x6621('0x2'));var jsonpatch=require(_0x6621('0x3'));var rp=require(_0x6621('0x4'));var moment=require(_0x6621('0x5'));var BPromise=require(_0x6621('0x6'));var Mustache=require(_0x6621('0x7'));var util=require(_0x6621('0x8'));var path=require(_0x6621('0x9'));var sox=require(_0x6621('0xa'));var csv=require(_0x6621('0xb'));var ejs=require(_0x6621('0xc'));var fs=require('fs');var fs_extra=require(_0x6621('0xd'));var _=require(_0x6621('0xe'));var squel=require(_0x6621('0xf'));var crypto=require(_0x6621('0x10'));var jsforce=require(_0x6621('0x11'));var deskjs=require(_0x6621('0x12'));var toCsv=require(_0x6621('0xb'));var querystring=require('querystring');var Papa=require(_0x6621('0x13'));var Redis=require(_0x6621('0x14'));var authService=require(_0x6621('0x15'));var qs=require(_0x6621('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x6621('0x17'))('api');var utils=require('../../config/utils');var config=require(_0x6621('0x18'));var licenseUtil=require(_0x6621('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2e6dc1,_0x5ec9a9){_0x5ec9a9=_0x5ec9a9||0xcc;return function(_0x4ef2a4){if(_0x4ef2a4){return _0x2e6dc1[_0x6621('0x1a')](_0x5ec9a9);}return _0x2e6dc1['status'](_0x5ec9a9)[_0x6621('0x1b')]();};}function respondWithResult(_0x5c5f9d,_0xc25f2){_0xc25f2=_0xc25f2||0xc8;return function(_0x55f6ce){if(_0x55f6ce){return _0x5c5f9d[_0x6621('0x1c')](_0xc25f2)[_0x6621('0x1d')](_0x55f6ce);}};}function respondWithFilteredResult(_0x96c3c0,_0x3ce2d9){return function(_0x2713e4){if(_0x2713e4){var _0x4505a1=typeof _0x3ce2d9[_0x6621('0x1e')]==='undefined'&&typeof _0x3ce2d9[_0x6621('0x1f')]===_0x6621('0x20');var _0x19eee1=_0x2713e4[_0x6621('0x21')];var _0x5f4e6d=_0x4505a1?0x0:_0x3ce2d9[_0x6621('0x1e')];var _0x27cd21=_0x4505a1?_0x2713e4[_0x6621('0x21')]:_0x3ce2d9['offset']+_0x3ce2d9[_0x6621('0x1f')];var _0x3ca04c;if(_0x27cd21>=_0x19eee1){_0x27cd21=_0x19eee1;_0x3ca04c=0xc8;}else{_0x3ca04c=0xce;}_0x96c3c0[_0x6621('0x1c')](_0x3ca04c);return _0x96c3c0[_0x6621('0x22')](_0x6621('0x23'),_0x5f4e6d+'-'+_0x27cd21+'/'+_0x19eee1)['json'](_0x2713e4);}return null;};}function patchUpdates(_0x56e082){return function(_0x23fa74){try{jsonpatch[_0x6621('0x24')](_0x23fa74,_0x56e082,!![]);}catch(_0xc26ef4){return BPromise['reject'](_0xc26ef4);}return _0x23fa74[_0x6621('0x25')]();};}function saveUpdates(_0x1e92eb,_0x1d6bc9){return function(_0x174712){if(_0x174712){return _0x174712[_0x6621('0x26')](_0x1e92eb)['then'](function(_0x33e25e){return _0x33e25e;});}return null;};}function removeEntity(_0x3b8afc,_0x50754e){return function(_0xfcac2d){if(_0xfcac2d){return _0xfcac2d[_0x6621('0x27')]()[_0x6621('0x28')](function(){_0x3b8afc[_0x6621('0x1c')](0xcc)[_0x6621('0x1b')]();});}};}function handleEntityNotFound(_0x53496e,_0x227998){return function(_0x128b97){if(!_0x128b97){_0x53496e[_0x6621('0x1a')](0x194);}return _0x128b97;};}function handleError(_0x50c622,_0x42132a){_0x42132a=_0x42132a||0x1f4;return function(_0x526e7a){logger[_0x6621('0x29')](_0x526e7a[_0x6621('0x2a')]);if(_0x526e7a[_0x6621('0x2b')]){delete _0x526e7a['name'];}_0x50c622[_0x6621('0x1c')](_0x42132a)[_0x6621('0x2c')](_0x526e7a);};}exports[_0x6621('0x2d')]=function(_0x20647f,_0xfb2fbe){var _0x40b847={},_0x5bd090={},_0x1fdf18={'count':0x0,'rows':[]};var _0x169557=_[_0x6621('0x2e')](db['SquareMessage'][_0x6621('0x2f')],function(_0x1ad3ac){return{'name':_0x1ad3ac['fieldName'],'type':_0x1ad3ac[_0x6621('0x30')][_0x6621('0x31')]};});_0x5bd090[_0x6621('0x32')]=_['map'](_0x169557,'name');_0x5bd090[_0x6621('0x33')]=_['keys'](_0x20647f[_0x6621('0x33')]);_0x5bd090['filters']=_[_0x6621('0x34')](_0x5bd090[_0x6621('0x32')],_0x5bd090[_0x6621('0x33')]);_0x40b847['attributes']=_[_0x6621('0x34')](_0x5bd090['model'],qs[_0x6621('0x35')](_0x20647f[_0x6621('0x33')][_0x6621('0x35')]));_0x40b847[_0x6621('0x36')]=_0x40b847[_0x6621('0x36')][_0x6621('0x37')]?_0x40b847[_0x6621('0x36')]:_0x5bd090[_0x6621('0x32')];if(!_0x20647f[_0x6621('0x33')][_0x6621('0x38')](_0x6621('0x39'))){_0x40b847[_0x6621('0x1f')]=qs['limit'](_0x20647f[_0x6621('0x33')][_0x6621('0x1f')]);_0x40b847[_0x6621('0x1e')]=qs['offset'](_0x20647f[_0x6621('0x33')][_0x6621('0x1e')]);}_0x40b847[_0x6621('0x3a')]=qs[_0x6621('0x3b')](_0x20647f['query'][_0x6621('0x3b')]);_0x40b847[_0x6621('0x3c')]=qs[_0x6621('0x3d')](_[_0x6621('0x3e')](_0x20647f[_0x6621('0x33')],_0x5bd090['filters']),_0x169557);if(_0x20647f[_0x6621('0x33')][_0x6621('0x3f')]){_0x40b847[_0x6621('0x3c')]=_[_0x6621('0x40')](_0x40b847[_0x6621('0x3c')],{'$or':_['map'](_0x169557,function(_0x448b70){if(_0x448b70[_0x6621('0x30')]!=='VIRTUAL'){var _0xd01929={};_0xd01929[_0x448b70[_0x6621('0x2b')]]={'$like':'%'+_0x20647f[_0x6621('0x33')][_0x6621('0x3f')]+'%'};return _0xd01929;}})});}_0x40b847=_['merge']({},_0x40b847,_0x20647f['options']);var _0x516ed0={'where':_0x40b847['where']};return db[_0x6621('0x41')][_0x6621('0x21')](_0x516ed0)[_0x6621('0x28')](function(_0x5b3b78){_0x1fdf18[_0x6621('0x21')]=_0x5b3b78;if(_0x20647f['query']['includeAll']){_0x40b847[_0x6621('0x42')]=[{'all':!![]}];}return db[_0x6621('0x41')][_0x6621('0x43')](_0x40b847);})[_0x6621('0x28')](function(_0x499a03){_0x1fdf18[_0x6621('0x44')]=_0x499a03;return _0x1fdf18;})[_0x6621('0x28')](respondWithFilteredResult(_0xfb2fbe,_0x40b847))[_0x6621('0x45')](handleError(_0xfb2fbe,null));};exports['show']=function(_0x2ea128,_0x539473){var _0x519c4e={'raw':!![],'where':{'id':_0x2ea128['params']['id']}},_0x14d9ce={};_0x14d9ce[_0x6621('0x32')]=_[_0x6621('0x46')](db[_0x6621('0x41')]['rawAttributes']);_0x14d9ce['query']=_[_0x6621('0x46')](_0x2ea128['query']);_0x14d9ce[_0x6621('0x3d')]=_[_0x6621('0x34')](_0x14d9ce[_0x6621('0x32')],_0x14d9ce[_0x6621('0x33')]);_0x519c4e[_0x6621('0x36')]=_[_0x6621('0x34')](_0x14d9ce[_0x6621('0x32')],qs['fields'](_0x2ea128[_0x6621('0x33')][_0x6621('0x35')]));_0x519c4e[_0x6621('0x36')]=_0x519c4e[_0x6621('0x36')]['length']?_0x519c4e[_0x6621('0x36')]:_0x14d9ce[_0x6621('0x32')];if(_0x2ea128[_0x6621('0x33')][_0x6621('0x47')]){_0x519c4e[_0x6621('0x42')]=[{'all':!![]}];}_0x519c4e=_[_0x6621('0x40')]({},_0x519c4e,_0x2ea128[_0x6621('0x48')]);return db['SquareMessage'][_0x6621('0x49')](_0x519c4e)['then'](handleEntityNotFound(_0x539473,null))[_0x6621('0x28')](respondWithResult(_0x539473,null))['catch'](handleError(_0x539473,null));};exports[_0x6621('0x4a')]=function(_0x4c994b,_0x3092ee){return db[_0x6621('0x41')][_0x6621('0x4a')](_0x4c994b[_0x6621('0x4b')],{})[_0x6621('0x28')](respondWithResult(_0x3092ee,0xc9))['catch'](handleError(_0x3092ee,null));};exports[_0x6621('0x26')]=function(_0x1f3aba,_0x34e6b1){if(_0x1f3aba['body']['id']){delete _0x1f3aba[_0x6621('0x4b')]['id'];}return db['SquareMessage'][_0x6621('0x49')]({'where':{'id':_0x1f3aba['params']['id']}})['then'](handleEntityNotFound(_0x34e6b1,null))['then'](saveUpdates(_0x1f3aba[_0x6621('0x4b')],null))[_0x6621('0x28')](respondWithResult(_0x34e6b1,null))['catch'](handleError(_0x34e6b1,null));};exports[_0x6621('0x27')]=function(_0x297180,_0x288ed7){return db[_0x6621('0x41')][_0x6621('0x49')]({'where':{'id':_0x297180[_0x6621('0x4c')]['id']}})[_0x6621('0x28')](handleEntityNotFound(_0x288ed7,null))[_0x6621('0x28')](removeEntity(_0x288ed7,null))['catch'](handleError(_0x288ed7,null));}; \ No newline at end of file +var _0x97e7=['Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','SquareMessage','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','type','options','includeAll','include','findAll','rows','catch','find','create','body','params','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','path','sox','ejs','lodash','squel','crypto','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set'];(function(_0x5c2570,_0x197138){var _0x380c18=function(_0x2eba9c){while(--_0x2eba9c){_0x5c2570['push'](_0x5c2570['shift']());}};_0x380c18(++_0x197138);}(_0x97e7,0x7a));var _0x797e=function(_0x9eb1c6,_0x59a8c0){_0x9eb1c6=_0x9eb1c6-0x0;var _0x502048=_0x97e7[_0x9eb1c6];return _0x502048;};'use strict';var emlformat=require(_0x797e('0x0'));var rimraf=require(_0x797e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x797e('0x2'));var rp=require(_0x797e('0x3'));var moment=require(_0x797e('0x4'));var BPromise=require(_0x797e('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x797e('0x6'));var sox=require(_0x797e('0x7'));var csv=require('to-csv');var ejs=require(_0x797e('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x797e('0x9'));var squel=require(_0x797e('0xa'));var crypto=require(_0x797e('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x797e('0xc'));var toCsv=require(_0x797e('0xd'));var querystring=require('querystring');var Papa=require(_0x797e('0xe'));var Redis=require(_0x797e('0xf'));var authService=require(_0x797e('0x10'));var qs=require(_0x797e('0x11'));var as=require(_0x797e('0x12'));var hardwareService=require(_0x797e('0x13'));var logger=require('../../config/logger')(_0x797e('0x14'));var utils=require('../../config/utils');var config=require(_0x797e('0x15'));var licenseUtil=require(_0x797e('0x16'));var db=require(_0x797e('0x17'))['db'];function respondWithStatusCode(_0x302ccb,_0x5b7315){_0x5b7315=_0x5b7315||0xcc;return function(_0x4b8063){if(_0x4b8063){return _0x302ccb['sendStatus'](_0x5b7315);}return _0x302ccb['status'](_0x5b7315)[_0x797e('0x18')]();};}function respondWithResult(_0x59ac08,_0x4016f6){_0x4016f6=_0x4016f6||0xc8;return function(_0x85791d){if(_0x85791d){return _0x59ac08[_0x797e('0x19')](_0x4016f6)[_0x797e('0x1a')](_0x85791d);}};}function respondWithFilteredResult(_0x6dba47,_0x5e10e6){return function(_0x14cff8){if(_0x14cff8){var _0x567e6c=typeof _0x5e10e6[_0x797e('0x1b')]===_0x797e('0x1c')&&typeof _0x5e10e6[_0x797e('0x1d')]===_0x797e('0x1c');var _0x2c7922=_0x14cff8[_0x797e('0x1e')];var _0xfaab85=_0x567e6c?0x0:_0x5e10e6['offset'];var _0x566d9f=_0x567e6c?_0x14cff8[_0x797e('0x1e')]:_0x5e10e6[_0x797e('0x1b')]+_0x5e10e6[_0x797e('0x1d')];var _0x5375ae;if(_0x566d9f>=_0x2c7922){_0x566d9f=_0x2c7922;_0x5375ae=0xc8;}else{_0x5375ae=0xce;}_0x6dba47[_0x797e('0x19')](_0x5375ae);return _0x6dba47[_0x797e('0x1f')](_0x797e('0x20'),_0xfaab85+'-'+_0x566d9f+'/'+_0x2c7922)[_0x797e('0x1a')](_0x14cff8);}return null;};}function patchUpdates(_0x1eec17){return function(_0x288c61){try{jsonpatch[_0x797e('0x21')](_0x288c61,_0x1eec17,!![]);}catch(_0x482b9f){return BPromise[_0x797e('0x22')](_0x482b9f);}return _0x288c61[_0x797e('0x23')]();};}function saveUpdates(_0x55776,_0x3aa4d0){return function(_0x51b40f){if(_0x51b40f){return _0x51b40f[_0x797e('0x24')](_0x55776)[_0x797e('0x25')](function(_0x77de97){return _0x77de97;});}return null;};}function removeEntity(_0x341dc6,_0x28cd37){return function(_0x529caf){if(_0x529caf){return _0x529caf[_0x797e('0x26')]()[_0x797e('0x25')](function(){_0x341dc6[_0x797e('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x300e29,_0x122923){return function(_0x54e02f){if(!_0x54e02f){_0x300e29[_0x797e('0x27')](0x194);}return _0x54e02f;};}function handleError(_0x1d8166,_0x4bf88a){_0x4bf88a=_0x4bf88a||0x1f4;return function(_0x4d4c32){logger[_0x797e('0x28')](_0x4d4c32[_0x797e('0x29')]);if(_0x4d4c32[_0x797e('0x2a')]){delete _0x4d4c32[_0x797e('0x2a')];}_0x1d8166[_0x797e('0x19')](_0x4bf88a)[_0x797e('0x2b')](_0x4d4c32);};}exports[_0x797e('0x2c')]=function(_0x257c21,_0x29a14f){var _0x3241a5={},_0x562eab={},_0x5bf0fb={'count':0x0,'rows':[]};var _0x5087b4=_[_0x797e('0x2d')](db[_0x797e('0x2e')][_0x797e('0x2f')],function(_0xb69f81){return{'name':_0xb69f81[_0x797e('0x30')],'type':_0xb69f81['type'][_0x797e('0x31')]};});_0x562eab[_0x797e('0x32')]=_['map'](_0x5087b4,'name');_0x562eab[_0x797e('0x33')]=_[_0x797e('0x34')](_0x257c21[_0x797e('0x33')]);_0x562eab['filters']=_[_0x797e('0x35')](_0x562eab[_0x797e('0x32')],_0x562eab[_0x797e('0x33')]);_0x3241a5[_0x797e('0x36')]=_[_0x797e('0x35')](_0x562eab[_0x797e('0x32')],qs[_0x797e('0x37')](_0x257c21[_0x797e('0x33')]['fields']));_0x3241a5[_0x797e('0x36')]=_0x3241a5[_0x797e('0x36')][_0x797e('0x38')]?_0x3241a5[_0x797e('0x36')]:_0x562eab['model'];if(!_0x257c21[_0x797e('0x33')][_0x797e('0x39')](_0x797e('0x3a'))){_0x3241a5[_0x797e('0x1d')]=qs[_0x797e('0x1d')](_0x257c21[_0x797e('0x33')][_0x797e('0x1d')]);_0x3241a5[_0x797e('0x1b')]=qs[_0x797e('0x1b')](_0x257c21[_0x797e('0x33')][_0x797e('0x1b')]);}_0x3241a5[_0x797e('0x3b')]=qs['sort'](_0x257c21[_0x797e('0x33')][_0x797e('0x3c')]);_0x3241a5[_0x797e('0x3d')]=qs['filters'](_[_0x797e('0x3e')](_0x257c21[_0x797e('0x33')],_0x562eab[_0x797e('0x3f')]),_0x5087b4);if(_0x257c21['query'][_0x797e('0x40')]){_0x3241a5[_0x797e('0x3d')]=_[_0x797e('0x41')](_0x3241a5[_0x797e('0x3d')],{'$or':_[_0x797e('0x2d')](_0x5087b4,function(_0x29e271){if(_0x29e271[_0x797e('0x42')]!=='VIRTUAL'){var _0x24625b={};_0x24625b[_0x29e271[_0x797e('0x2a')]]={'$like':'%'+_0x257c21[_0x797e('0x33')][_0x797e('0x40')]+'%'};return _0x24625b;}})});}_0x3241a5=_[_0x797e('0x41')]({},_0x3241a5,_0x257c21[_0x797e('0x43')]);var _0x384778={'where':_0x3241a5[_0x797e('0x3d')]};return db[_0x797e('0x2e')][_0x797e('0x1e')](_0x384778)['then'](function(_0x27ca6e){_0x5bf0fb[_0x797e('0x1e')]=_0x27ca6e;if(_0x257c21[_0x797e('0x33')][_0x797e('0x44')]){_0x3241a5[_0x797e('0x45')]=[{'all':!![]}];}return db[_0x797e('0x2e')][_0x797e('0x46')](_0x3241a5);})[_0x797e('0x25')](function(_0x249850){_0x5bf0fb[_0x797e('0x47')]=_0x249850;return _0x5bf0fb;})[_0x797e('0x25')](respondWithFilteredResult(_0x29a14f,_0x3241a5))[_0x797e('0x48')](handleError(_0x29a14f,null));};exports['show']=function(_0x420d1b,_0x175f95){var _0xa5a3fe={'raw':!![],'where':{'id':_0x420d1b['params']['id']}},_0x4d3e6d={};_0x4d3e6d['model']=_[_0x797e('0x34')](db[_0x797e('0x2e')][_0x797e('0x2f')]);_0x4d3e6d[_0x797e('0x33')]=_['keys'](_0x420d1b[_0x797e('0x33')]);_0x4d3e6d[_0x797e('0x3f')]=_[_0x797e('0x35')](_0x4d3e6d[_0x797e('0x32')],_0x4d3e6d[_0x797e('0x33')]);_0xa5a3fe[_0x797e('0x36')]=_[_0x797e('0x35')](_0x4d3e6d[_0x797e('0x32')],qs[_0x797e('0x37')](_0x420d1b[_0x797e('0x33')][_0x797e('0x37')]));_0xa5a3fe[_0x797e('0x36')]=_0xa5a3fe[_0x797e('0x36')][_0x797e('0x38')]?_0xa5a3fe['attributes']:_0x4d3e6d['model'];if(_0x420d1b['query'][_0x797e('0x44')]){_0xa5a3fe[_0x797e('0x45')]=[{'all':!![]}];}_0xa5a3fe=_[_0x797e('0x41')]({},_0xa5a3fe,_0x420d1b[_0x797e('0x43')]);return db['SquareMessage'][_0x797e('0x49')](_0xa5a3fe)['then'](handleEntityNotFound(_0x175f95,null))['then'](respondWithResult(_0x175f95,null))['catch'](handleError(_0x175f95,null));};exports[_0x797e('0x4a')]=function(_0xc578ba,_0x46ff32){return db[_0x797e('0x2e')][_0x797e('0x4a')](_0xc578ba['body'],{})['then'](respondWithResult(_0x46ff32,0xc9))[_0x797e('0x48')](handleError(_0x46ff32,null));};exports[_0x797e('0x24')]=function(_0x1cf24b,_0x40497c){if(_0x1cf24b['body']['id']){delete _0x1cf24b[_0x797e('0x4b')]['id'];}return db['SquareMessage'][_0x797e('0x49')]({'where':{'id':_0x1cf24b[_0x797e('0x4c')]['id']}})[_0x797e('0x25')](handleEntityNotFound(_0x40497c,null))[_0x797e('0x25')](saveUpdates(_0x1cf24b[_0x797e('0x4b')],null))[_0x797e('0x25')](respondWithResult(_0x40497c,null))[_0x797e('0x48')](handleError(_0x40497c,null));};exports[_0x797e('0x26')]=function(_0x3b3c27,_0x2b1417){return db[_0x797e('0x2e')]['find']({'where':{'id':_0x3b3c27[_0x797e('0x4c')]['id']}})[_0x797e('0x25')](handleEntityNotFound(_0x2b1417,null))[_0x797e('0x25')](removeEntity(_0x2b1417,null))[_0x797e('0x48')](handleError(_0x2b1417,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index f2d7e19..bc43f11 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 _0x0719=['../../config/environment','./squareMessage.attributes','exports','define','SquareMessage','square_messages','util','../../config/logger','api','request-promise','path','rimraf'];(function(_0x352df0,_0x119ad3){var _0x2aaaf4=function(_0x232835){while(--_0x232835){_0x352df0['push'](_0x352df0['shift']());}};_0x2aaaf4(++_0x119ad3);}(_0x0719,0x14a));var _0x9071=function(_0xdc96ec,_0x41340d){_0xdc96ec=_0xdc96ec-0x0;var _0x14d08c=_0x0719[_0xdc96ec];return _0x14d08c;};'use strict';var _=require('lodash');var util=require(_0x9071('0x0'));var logger=require(_0x9071('0x1'))(_0x9071('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x9071('0x3'));var fs=require('fs');var path=require(_0x9071('0x4'));var rimraf=require(_0x9071('0x5'));var config=require(_0x9071('0x6'));var attributes=require(_0x9071('0x7'));module[_0x9071('0x8')]=function(_0x5d3e1b,_0x5bc969){return _0x5d3e1b[_0x9071('0x9')](_0x9071('0xa'),attributes,{'tableName':_0x9071('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x505a=['define','square_messages','lodash','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x281910,_0x59116e){var _0x21b1c8=function(_0x303c0b){while(--_0x303c0b){_0x281910['push'](_0x281910['shift']());}};_0x21b1c8(++_0x59116e);}(_0x505a,0x1f1));var _0xa505=function(_0x6f6971,_0x280eac){_0x6f6971=_0x6f6971-0x0;var _0x314279=_0x505a[_0x6f6971];return _0x314279;};'use strict';var _=require(_0xa505('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xa505('0x1'));var moment=require(_0xa505('0x2'));var BPromise=require(_0xa505('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa505('0x4'));var rimraf=require(_0xa505('0x5'));var config=require(_0xa505('0x6'));var attributes=require('./squareMessage.attributes');module['exports']=function(_0x24fbac,_0x21ebf8){return _0x24fbac[_0xa505('0x7')]('SquareMessage',attributes,{'tableName':_0xa505('0x8'),'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 17bcd09..dbf0eee 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 _0xeb8c=['request\x20sent','stringify','error','code','message','result','catch','SquareMessage','create','body','raw','then','CreateSquareMessage','debug','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','SquareMessage,\x20%s,\x20%s','SquareMessage,\x20%s,\x20%s,\x20%s'];(function(_0xfb5dc2,_0x211d0e){var _0x18f048=function(_0x2feea5){while(--_0x2feea5){_0xfb5dc2['push'](_0xfb5dc2['shift']());}};_0x18f048(++_0x211d0e);}(_0xeb8c,0x176));var _0xceb8=function(_0x3fd6a5,_0x47c494){_0x3fd6a5=_0x3fd6a5-0x0;var _0x97831=_0xeb8c[_0x3fd6a5];return _0x97831;};'use strict';var _=require(_0xceb8('0x0'));var util=require(_0xceb8('0x1'));var moment=require(_0xceb8('0x2'));var BPromise=require(_0xceb8('0x3'));var rs=require(_0xceb8('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xceb8('0x5'))['db'];var utils=require(_0xceb8('0x6'));var logger=require(_0xceb8('0x7'))(_0xceb8('0x8'));var config=require(_0xceb8('0x9'));var jayson=require(_0xceb8('0xa'));var client=jayson[_0xceb8('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2f2fc7,_0x35db36,_0x29e3d0){return new BPromise(function(_0x48270b,_0x3f86da){return client[_0xceb8('0xc')](_0x2f2fc7,_0x29e3d0)['then'](function(_0x3ffd17){logger[_0xceb8('0xd')](_0xceb8('0xe'),_0x35db36,'request\x20sent');logger['debug'](_0xceb8('0xf'),_0x35db36,_0xceb8('0x10'),JSON[_0xceb8('0x11')](_0x3ffd17));if(_0x3ffd17['error']){if(_0x3ffd17[_0xceb8('0x12')][_0xceb8('0x13')]===0x1f4){logger['error']('SquareMessage,\x20%s,\x20%s',_0x35db36,_0x3ffd17[_0xceb8('0x12')][_0xceb8('0x14')]);return _0x3f86da(_0x3ffd17['error'][_0xceb8('0x14')]);}logger[_0xceb8('0x12')](_0xceb8('0xe'),_0x35db36,_0x3ffd17[_0xceb8('0x12')][_0xceb8('0x14')]);return _0x48270b(_0x3ffd17[_0xceb8('0x12')][_0xceb8('0x14')]);}else{logger[_0xceb8('0xd')]('SquareMessage,\x20%s,\x20%s',_0x35db36,_0xceb8('0x10'));_0x48270b(_0x3ffd17[_0xceb8('0x15')][_0xceb8('0x14')]);}})[_0xceb8('0x16')](function(_0x3dbe9e){logger['error'](_0xceb8('0xe'),_0x35db36,_0x3dbe9e);_0x3f86da(_0x3dbe9e);});});}exports['CreateSquareMessage']=function(_0x5c17b7){var _0x2b3e12=this;return new Promise(function(_0x2beecb,_0xb0fe65){return db[_0xceb8('0x17')][_0xceb8('0x18')](_0x5c17b7[_0xceb8('0x19')],{'raw':_0x5c17b7['options']?_0x5c17b7['options'][_0xceb8('0x1a')]===undefined?!![]:![]:!![]})[_0xceb8('0x1b')](function(_0xac57b3){logger[_0xceb8('0xd')](_0xceb8('0x1c'),_0x5c17b7);logger[_0xceb8('0x1d')](_0xceb8('0x1c'),_0x5c17b7,JSON['stringify'](_0xac57b3));_0x2beecb(_0xac57b3);})[_0xceb8('0x16')](function(_0x4e98e9){logger[_0xceb8('0x12')](_0xceb8('0x1c'),_0x4e98e9[_0xceb8('0x14')],_0x5c17b7);_0xb0fe65(_0x2b3e12[_0xceb8('0x12')](0x1f4,_0x4e98e9[_0xceb8('0x14')]));});});}; \ No newline at end of file +var _0x4689=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','error','code','SquareMessage,\x20%s,\x20%s','message','result','catch','CreateSquareMessage','SquareMessage','body','options','raw','stringify','lodash','util'];(function(_0x38a6c6,_0x4062ca){var _0x142f0a=function(_0x1531ce){while(--_0x1531ce){_0x38a6c6['push'](_0x38a6c6['shift']());}};_0x142f0a(++_0x4062ca);}(_0x4689,0x166));var _0x9468=function(_0x253238,_0x139746){_0x253238=_0x253238-0x0;var _0x5bf6b9=_0x4689[_0x253238];return _0x5bf6b9;};'use strict';var _=require(_0x9468('0x0'));var util=require(_0x9468('0x1'));var moment=require(_0x9468('0x2'));var BPromise=require(_0x9468('0x3'));var rs=require(_0x9468('0x4'));var fs=require('fs');var Redis=require(_0x9468('0x5'));var db=require(_0x9468('0x6'))['db'];var utils=require(_0x9468('0x7'));var logger=require('../../config/logger')(_0x9468('0x8'));var config=require(_0x9468('0x9'));var jayson=require(_0x9468('0xa'));var client=jayson[_0x9468('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0xeb1bed,_0x13764a,_0x30db15){return new BPromise(function(_0x48a09d,_0xee3816){return client[_0x9468('0xc')](_0xeb1bed,_0x30db15)[_0x9468('0xd')](function(_0x2e2d84){logger[_0x9468('0xe')]('SquareMessage,\x20%s,\x20%s',_0x13764a,_0x9468('0xf'));logger[_0x9468('0x10')](_0x9468('0x11'),_0x13764a,_0x9468('0xf'),JSON['stringify'](_0x2e2d84));if(_0x2e2d84[_0x9468('0x12')]){if(_0x2e2d84[_0x9468('0x12')][_0x9468('0x13')]===0x1f4){logger['error'](_0x9468('0x14'),_0x13764a,_0x2e2d84['error']['message']);return _0xee3816(_0x2e2d84['error']['message']);}logger[_0x9468('0x12')](_0x9468('0x14'),_0x13764a,_0x2e2d84[_0x9468('0x12')][_0x9468('0x15')]);return _0x48a09d(_0x2e2d84[_0x9468('0x12')][_0x9468('0x15')]);}else{logger[_0x9468('0xe')](_0x9468('0x14'),_0x13764a,_0x9468('0xf'));_0x48a09d(_0x2e2d84[_0x9468('0x16')][_0x9468('0x15')]);}})[_0x9468('0x17')](function(_0x51e1f0){logger[_0x9468('0x12')](_0x9468('0x14'),_0x13764a,_0x51e1f0);_0xee3816(_0x51e1f0);});});}exports[_0x9468('0x18')]=function(_0x936a39){var _0x5baa70=this;return new Promise(function(_0x2e7baf,_0x1e4b47){return db[_0x9468('0x19')]['create'](_0x936a39[_0x9468('0x1a')],{'raw':_0x936a39[_0x9468('0x1b')]?_0x936a39[_0x9468('0x1b')][_0x9468('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x38bcd9){logger[_0x9468('0xe')]('CreateSquareMessage',_0x936a39);logger[_0x9468('0x10')](_0x9468('0x18'),_0x936a39,JSON[_0x9468('0x1d')](_0x38bcd9));_0x2e7baf(_0x38bcd9);})[_0x9468('0x17')](function(_0x4647b1){logger['error']('CreateSquareMessage',_0x4647b1[_0x9468('0x15')],_0x936a39);_0x1e4b47(_0x5baa70[_0x9468('0x12')](0x1f4,_0x4647b1[_0x9468('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index 1e2f4ec..d30f9c7 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 _0xc968=['index','/:id','show','/:id/test','15s','test','create','update','delete','destroy','exports','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./squareOdbc.controller','get','isAuthenticated'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0xc968,0x6a));var _0x8c96=function(_0x41699c,_0x317092){_0x41699c=_0x41699c-0x0;var _0xb1e0ad=_0xc968[_0x41699c];return _0xb1e0ad;};'use strict';var multer=require('multer');var util=require(_0x8c96('0x0'));var path=require('path');var timeout=require(_0x8c96('0x1'));var express=require('express');var router=express[_0x8c96('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x8c96('0x3'));var interaction=require(_0x8c96('0x4'));var config=require('../../config/environment');var controller=require(_0x8c96('0x5'));router[_0x8c96('0x6')]('/',auth[_0x8c96('0x7')](),controller[_0x8c96('0x8')]);router[_0x8c96('0x6')](_0x8c96('0x9'),auth['isAuthenticated'](),controller[_0x8c96('0xa')]);router['get'](_0x8c96('0xb'),auth[_0x8c96('0x7')](),timeout(_0x8c96('0xc')),controller[_0x8c96('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x8c96('0xe')]);router['put'](_0x8c96('0x9'),auth[_0x8c96('0x7')](),controller[_0x8c96('0xf')]);router[_0x8c96('0x10')](_0x8c96('0x9'),auth[_0x8c96('0x7')](),controller[_0x8c96('0x11')]);module[_0x8c96('0x12')]=router; \ No newline at end of file +var _0xc5e3=['../../components/auth/service','../../components/interaction/service','../../config/environment','./squareOdbc.controller','get','isAuthenticated','index','/:id','/:id/test','15s','test','post','create','put','update','delete','util','path','connect-timeout','fs-extra'];(function(_0x455676,_0x548c10){var _0x1af0d5=function(_0x26e569){while(--_0x26e569){_0x455676['push'](_0x455676['shift']());}};_0x1af0d5(++_0x548c10);}(_0xc5e3,0x1dc));var _0x3c5e=function(_0x53d3aa,_0x3766b1){_0x53d3aa=_0x53d3aa-0x0;var _0x13e0b1=_0xc5e3[_0x53d3aa];return _0x13e0b1;};'use strict';var multer=require('multer');var util=require(_0x3c5e('0x0'));var path=require(_0x3c5e('0x1'));var timeout=require(_0x3c5e('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x3c5e('0x3'));var auth=require(_0x3c5e('0x4'));var interaction=require(_0x3c5e('0x5'));var config=require(_0x3c5e('0x6'));var controller=require(_0x3c5e('0x7'));router[_0x3c5e('0x8')]('/',auth[_0x3c5e('0x9')](),controller[_0x3c5e('0xa')]);router[_0x3c5e('0x8')](_0x3c5e('0xb'),auth[_0x3c5e('0x9')](),controller['show']);router[_0x3c5e('0x8')](_0x3c5e('0xc'),auth[_0x3c5e('0x9')](),timeout(_0x3c5e('0xd')),controller[_0x3c5e('0xe')]);router[_0x3c5e('0xf')]('/',auth[_0x3c5e('0x9')](),controller[_0x3c5e('0x10')]);router[_0x3c5e('0x11')]('/:id',auth[_0x3c5e('0x9')](),controller[_0x3c5e('0x12')]);router[_0x3c5e('0x13')](_0x3c5e('0xb'),auth[_0x3c5e('0x9')](),controller['destroy']);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 2f23f23..517b92e 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 _0x9545=['STRING','name','sequelize'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x9545,0x89));var _0x5954=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x9545[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0x5954('0x0'));module['exports']={'name':{'type':Sequelize[_0x5954('0x1')],'unique':_0x5954('0x2'),'allowNull':![]},'dsn':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x5954('0x1')]}}; \ No newline at end of file +var _0x74fa=['sequelize','STRING'];(function(_0x3e978c,_0x1d5774){var _0x295585=function(_0x309460){while(--_0x309460){_0x3e978c['push'](_0x3e978c['shift']());}};_0x295585(++_0x1d5774);}(_0x74fa,0x138));var _0xa74f=function(_0x21c258,_0x19b72b){_0x21c258=_0x21c258-0x0;var _0x1ac288=_0x74fa[_0x21c258];return _0x1ac288;};'use strict';var Sequelize=require(_0xa74f('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'dsn':{'type':Sequelize[_0xa74f('0x1')]},'description':{'type':Sequelize[_0xa74f('0x1')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index 170cb69..73b60ea 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 _0x79fd=['save','update','then','destroy','get','ODBC','UserProfileResource','stack','name','index','map','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','type','VIRTUAL','options','SquareOdbc','include','findAll','catch','show','params','includeAll','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','test','odbc','openSync','closeSync','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x79fd,0x149));var _0xd79f=function(_0x32b158,_0x42c063){_0x32b158=_0x32b158-0x0;var _0x201991=_0x79fd[_0x32b158];return _0x201991;};'use strict';var emlformat=require(_0xd79f('0x0'));var rimraf=require(_0xd79f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd79f('0x2'));var rp=require(_0xd79f('0x3'));var moment=require(_0xd79f('0x4'));var BPromise=require(_0xd79f('0x5'));var Mustache=require(_0xd79f('0x6'));var util=require(_0xd79f('0x7'));var path=require('path');var sox=require(_0xd79f('0x8'));var csv=require(_0xd79f('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd79f('0xa'));var squel=require(_0xd79f('0xb'));var crypto=require(_0xd79f('0xc'));var jsforce=require(_0xd79f('0xd'));var deskjs=require(_0xd79f('0xe'));var toCsv=require('to-csv');var querystring=require(_0xd79f('0xf'));var Papa=require(_0xd79f('0x10'));var Redis=require(_0xd79f('0x11'));var authService=require(_0xd79f('0x12'));var qs=require(_0xd79f('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd79f('0x14'));var logger=require(_0xd79f('0x15'))(_0xd79f('0x16'));var utils=require(_0xd79f('0x17'));var config=require(_0xd79f('0x18'));var licenseUtil=require(_0xd79f('0x19'));var db=require(_0xd79f('0x1a'))['db'];function respondWithStatusCode(_0x5b6d5a,_0x32ef1a){_0x32ef1a=_0x32ef1a||0xcc;return function(_0x4bd467){if(_0x4bd467){return _0x5b6d5a[_0xd79f('0x1b')](_0x32ef1a);}return _0x5b6d5a[_0xd79f('0x1c')](_0x32ef1a)[_0xd79f('0x1d')]();};}function respondWithResult(_0x1bb3fb,_0x189532){_0x189532=_0x189532||0xc8;return function(_0x517143){if(_0x517143){return _0x1bb3fb[_0xd79f('0x1c')](_0x189532)[_0xd79f('0x1e')](_0x517143);}};}function respondWithFilteredResult(_0x134f99,_0x6a652){return function(_0x7f8d2){if(_0x7f8d2){var _0x523254=typeof _0x6a652['offset']===_0xd79f('0x1f')&&typeof _0x6a652['limit']==='undefined';var _0x27ce3b=_0x7f8d2[_0xd79f('0x20')];var _0x35631c=_0x523254?0x0:_0x6a652[_0xd79f('0x21')];var _0xc2c1e3=_0x523254?_0x7f8d2['count']:_0x6a652['offset']+_0x6a652[_0xd79f('0x22')];var _0x24807c;if(_0xc2c1e3>=_0x27ce3b){_0xc2c1e3=_0x27ce3b;_0x24807c=0xc8;}else{_0x24807c=0xce;}_0x134f99['status'](_0x24807c);return _0x134f99[_0xd79f('0x23')](_0xd79f('0x24'),_0x35631c+'-'+_0xc2c1e3+'/'+_0x27ce3b)[_0xd79f('0x1e')](_0x7f8d2);}return null;};}function patchUpdates(_0x394cc8){return function(_0x1f2fff){try{jsonpatch[_0xd79f('0x25')](_0x1f2fff,_0x394cc8,!![]);}catch(_0x2cafd2){return BPromise[_0xd79f('0x26')](_0x2cafd2);}return _0x1f2fff[_0xd79f('0x27')]();};}function saveUpdates(_0xd9314e,_0x29d078){return function(_0x4110dd){if(_0x4110dd){return _0x4110dd[_0xd79f('0x28')](_0xd9314e)[_0xd79f('0x29')](function(_0x5fc4d){return _0x5fc4d;});}return null;};}function removeEntity(_0x356276,_0x189267){return function(_0x5b8e3e){if(_0x5b8e3e){return _0x5b8e3e[_0xd79f('0x2a')]()[_0xd79f('0x29')](function(){var _0x4fd62d=_0x5b8e3e[_0xd79f('0x2b')]({'plain':!![]});var _0x4591f0=_0xd79f('0x2c');return db[_0xd79f('0x2d')][_0xd79f('0x2a')]({'where':{'type':_0x4591f0,'resourceId':_0x4fd62d['id']}})[_0xd79f('0x29')](function(){return _0x5b8e3e;});})['then'](function(){_0x356276[_0xd79f('0x1c')](0xcc)[_0xd79f('0x1d')]();});}};}function handleEntityNotFound(_0x50c0cf,_0x287cda){return function(_0x5be94e){if(!_0x5be94e){_0x50c0cf[_0xd79f('0x1b')](0x194);}return _0x5be94e;};}function handleError(_0xfa218a,_0xdab57d){_0xdab57d=_0xdab57d||0x1f4;return function(_0x553ec2){logger['error'](_0x553ec2[_0xd79f('0x2e')]);if(_0x553ec2[_0xd79f('0x2f')]){delete _0x553ec2[_0xd79f('0x2f')];}_0xfa218a['status'](_0xdab57d)['send'](_0x553ec2);};}exports[_0xd79f('0x30')]=function(_0x301f44,_0x269eee){var _0x4505c7={},_0x6d0d={},_0x15e316={'count':0x0,'rows':[]};var _0x5b9b58=_[_0xd79f('0x31')](db['SquareOdbc'][_0xd79f('0x32')],function(_0x2f5ffb){return{'name':_0x2f5ffb[_0xd79f('0x33')],'type':_0x2f5ffb['type']['key']};});_0x6d0d[_0xd79f('0x34')]=_['map'](_0x5b9b58,_0xd79f('0x2f'));_0x6d0d[_0xd79f('0x35')]=_[_0xd79f('0x36')](_0x301f44[_0xd79f('0x35')]);_0x6d0d[_0xd79f('0x37')]=_[_0xd79f('0x38')](_0x6d0d['model'],_0x6d0d['query']);_0x4505c7[_0xd79f('0x39')]=_[_0xd79f('0x38')](_0x6d0d[_0xd79f('0x34')],qs[_0xd79f('0x3a')](_0x301f44['query'][_0xd79f('0x3a')]));_0x4505c7['attributes']=_0x4505c7['attributes'][_0xd79f('0x3b')]?_0x4505c7['attributes']:_0x6d0d[_0xd79f('0x34')];if(!_0x301f44['query'][_0xd79f('0x3c')](_0xd79f('0x3d'))){_0x4505c7[_0xd79f('0x22')]=qs['limit'](_0x301f44[_0xd79f('0x35')]['limit']);_0x4505c7[_0xd79f('0x21')]=qs[_0xd79f('0x21')](_0x301f44[_0xd79f('0x35')][_0xd79f('0x21')]);}_0x4505c7[_0xd79f('0x3e')]=qs[_0xd79f('0x3f')](_0x301f44[_0xd79f('0x35')][_0xd79f('0x3f')]);_0x4505c7['where']=qs[_0xd79f('0x37')](_[_0xd79f('0x40')](_0x301f44[_0xd79f('0x35')],_0x6d0d[_0xd79f('0x37')]),_0x5b9b58);if(_0x301f44[_0xd79f('0x35')][_0xd79f('0x41')]){_0x4505c7['where']=_[_0xd79f('0x42')](_0x4505c7[_0xd79f('0x43')],{'$or':_[_0xd79f('0x31')](_0x5b9b58,function(_0x15993e){if(_0x15993e[_0xd79f('0x44')]!==_0xd79f('0x45')){var _0x369a07={};_0x369a07[_0x15993e[_0xd79f('0x2f')]]={'$like':'%'+_0x301f44[_0xd79f('0x35')][_0xd79f('0x41')]+'%'};return _0x369a07;}})});}_0x4505c7=_[_0xd79f('0x42')]({},_0x4505c7,_0x301f44[_0xd79f('0x46')]);var _0x5b1aa7={'where':_0x4505c7[_0xd79f('0x43')]};return db[_0xd79f('0x47')][_0xd79f('0x20')](_0x5b1aa7)['then'](function(_0x22f288){_0x15e316['count']=_0x22f288;if(_0x301f44[_0xd79f('0x35')]['includeAll']){_0x4505c7[_0xd79f('0x48')]=[{'all':!![]}];}return db[_0xd79f('0x47')][_0xd79f('0x49')](_0x4505c7);})[_0xd79f('0x29')](function(_0x226588){_0x15e316['rows']=_0x226588;return _0x15e316;})['then'](respondWithFilteredResult(_0x269eee,_0x4505c7))[_0xd79f('0x4a')](handleError(_0x269eee,null));};exports[_0xd79f('0x4b')]=function(_0x3bd5d5,_0x44c7ba){var _0x5a36b1={'raw':!![],'where':{'id':_0x3bd5d5[_0xd79f('0x4c')]['id']}},_0x20e33d={};_0x20e33d['model']=_[_0xd79f('0x36')](db[_0xd79f('0x47')][_0xd79f('0x32')]);_0x20e33d[_0xd79f('0x35')]=_[_0xd79f('0x36')](_0x3bd5d5['query']);_0x20e33d[_0xd79f('0x37')]=_[_0xd79f('0x38')](_0x20e33d[_0xd79f('0x34')],_0x20e33d['query']);_0x5a36b1['attributes']=_[_0xd79f('0x38')](_0x20e33d[_0xd79f('0x34')],qs[_0xd79f('0x3a')](_0x3bd5d5[_0xd79f('0x35')][_0xd79f('0x3a')]));_0x5a36b1[_0xd79f('0x39')]=_0x5a36b1[_0xd79f('0x39')]['length']?_0x5a36b1[_0xd79f('0x39')]:_0x20e33d[_0xd79f('0x34')];if(_0x3bd5d5[_0xd79f('0x35')][_0xd79f('0x4d')]){_0x5a36b1[_0xd79f('0x48')]=[{'all':!![]}];}_0x5a36b1=_[_0xd79f('0x42')]({},_0x5a36b1,_0x3bd5d5['options']);return db[_0xd79f('0x47')][_0xd79f('0x4e')](_0x5a36b1)[_0xd79f('0x29')](handleEntityNotFound(_0x44c7ba,null))[_0xd79f('0x29')](respondWithResult(_0x44c7ba,null))[_0xd79f('0x4a')](handleError(_0x44c7ba,null));};exports[_0xd79f('0x4f')]=function(_0x1fd2f5,_0x4bc945){return db[_0xd79f('0x47')][_0xd79f('0x4f')](_0x1fd2f5['body'],{})[_0xd79f('0x29')](function(_0x120469){var _0x57e8e2=_0x1fd2f5[_0xd79f('0x50')][_0xd79f('0x2b')]({'plain':!![]});if(!_0x57e8e2)throw new Error(_0xd79f('0x51'));if(_0x57e8e2[_0xd79f('0x52')]==='user'){var _0x56f36f=_0x120469[_0xd79f('0x2b')]({'plain':!![]});var _0x243fc2=_0xd79f('0x2c');return db['UserProfileSection'][_0xd79f('0x4e')]({'where':{'name':_0x243fc2,'userProfileId':_0x57e8e2[_0xd79f('0x53')]},'raw':!![]})[_0xd79f('0x29')](function(_0x47bb8e){if(_0x47bb8e&&_0x47bb8e[_0xd79f('0x54')]===0x0){return db[_0xd79f('0x2d')]['create']({'name':_0x56f36f[_0xd79f('0x2f')],'resourceId':_0x56f36f['id'],'type':_0x47bb8e[_0xd79f('0x2f')],'sectionId':_0x47bb8e['id']},{})[_0xd79f('0x29')](function(){return _0x120469;});}else{return _0x120469;}})[_0xd79f('0x4a')](function(_0xa38aef){logger[_0xd79f('0x55')](_0xd79f('0x56'),_0xa38aef);throw _0xa38aef;});}return _0x120469;})[_0xd79f('0x29')](respondWithResult(_0x4bc945,0xc9))['catch'](handleError(_0x4bc945,null));};exports[_0xd79f('0x28')]=function(_0x55320f,_0xa775b9){if(_0x55320f[_0xd79f('0x57')]['id']){delete _0x55320f[_0xd79f('0x57')]['id'];}return db[_0xd79f('0x47')][_0xd79f('0x4e')]({'where':{'id':_0x55320f[_0xd79f('0x4c')]['id']}})[_0xd79f('0x29')](handleEntityNotFound(_0xa775b9,null))[_0xd79f('0x29')](saveUpdates(_0x55320f[_0xd79f('0x57')],null))[_0xd79f('0x29')](respondWithResult(_0xa775b9,null))[_0xd79f('0x4a')](handleError(_0xa775b9,null));};exports['destroy']=function(_0xfbad26,_0x12b752){return db[_0xd79f('0x47')][_0xd79f('0x4e')]({'where':{'id':_0xfbad26[_0xd79f('0x4c')]['id']}})[_0xd79f('0x29')](handleEntityNotFound(_0x12b752,null))['then'](removeEntity(_0x12b752,null))['catch'](handleError(_0x12b752,null));};exports[_0xd79f('0x58')]=function(_0x319550,_0x4e0ce1,_0x391609){var _0x2fe30b;return db['SquareOdbc']['find']({'where':{'id':_0x319550['params']['id']},'attributes':['id','dsn']})['then'](handleEntityNotFound(_0x4e0ce1,null))[_0xd79f('0x29')](function(_0x59eeb1){if(_0x59eeb1){var _0x22dd6d=require(_0xd79f('0x59'))();_0x22dd6d[_0xd79f('0x5a')](_0x59eeb1['dsn']);_0x22dd6d[_0xd79f('0x5b')]();return _0x59eeb1;}})[_0xd79f('0x29')](respondWithResult(_0x4e0ce1,null))[_0xd79f('0x4a')](handleError(_0x4e0ce1,null));}; \ No newline at end of file +var _0x7cd3=['save','update','then','get','ODBC','UserProfileResource','destroy','error','stack','name','index','map','SquareOdbc','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','include','rows','keys','length','includeAll','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','test','dsn','odbc','openSync','closeSync','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject'];(function(_0x50a330,_0x2e003c){var _0x475636=function(_0x1ce9ab){while(--_0x1ce9ab){_0x50a330['push'](_0x50a330['shift']());}};_0x475636(++_0x2e003c);}(_0x7cd3,0x18c));var _0x37cd=function(_0x44d645,_0x52c486){_0x44d645=_0x44d645-0x0;var _0x4cd21a=_0x7cd3[_0x44d645];return _0x4cd21a;};'use strict';var emlformat=require(_0x37cd('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x37cd('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x37cd('0x2'));var moment=require(_0x37cd('0x3'));var BPromise=require(_0x37cd('0x4'));var Mustache=require(_0x37cd('0x5'));var util=require(_0x37cd('0x6'));var path=require(_0x37cd('0x7'));var sox=require(_0x37cd('0x8'));var csv=require(_0x37cd('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x37cd('0xa'));var squel=require('squel');var crypto=require(_0x37cd('0xb'));var jsforce=require(_0x37cd('0xc'));var deskjs=require(_0x37cd('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x37cd('0xe'));var qs=require(_0x37cd('0xf'));var as=require(_0x37cd('0x10'));var hardwareService=require(_0x37cd('0x11'));var logger=require(_0x37cd('0x12'))(_0x37cd('0x13'));var utils=require(_0x37cd('0x14'));var config=require(_0x37cd('0x15'));var licenseUtil=require(_0x37cd('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x149618,_0x5890fb){_0x5890fb=_0x5890fb||0xcc;return function(_0x364fa0){if(_0x364fa0){return _0x149618[_0x37cd('0x17')](_0x5890fb);}return _0x149618[_0x37cd('0x18')](_0x5890fb)[_0x37cd('0x19')]();};}function respondWithResult(_0x18a0a0,_0x5817b5){_0x5817b5=_0x5817b5||0xc8;return function(_0x5ec3ca){if(_0x5ec3ca){return _0x18a0a0['status'](_0x5817b5)[_0x37cd('0x1a')](_0x5ec3ca);}};}function respondWithFilteredResult(_0x50272d,_0x17dbed){return function(_0x2bbd03){if(_0x2bbd03){var _0x594e92=typeof _0x17dbed[_0x37cd('0x1b')]===_0x37cd('0x1c')&&typeof _0x17dbed[_0x37cd('0x1d')]===_0x37cd('0x1c');var _0x23075b=_0x2bbd03[_0x37cd('0x1e')];var _0x5b1462=_0x594e92?0x0:_0x17dbed['offset'];var _0x2a0640=_0x594e92?_0x2bbd03[_0x37cd('0x1e')]:_0x17dbed[_0x37cd('0x1b')]+_0x17dbed[_0x37cd('0x1d')];var _0x319f55;if(_0x2a0640>=_0x23075b){_0x2a0640=_0x23075b;_0x319f55=0xc8;}else{_0x319f55=0xce;}_0x50272d[_0x37cd('0x18')](_0x319f55);return _0x50272d[_0x37cd('0x1f')]('Content-Range',_0x5b1462+'-'+_0x2a0640+'/'+_0x23075b)['json'](_0x2bbd03);}return null;};}function patchUpdates(_0xc84a4c){return function(_0x4b72e4){try{jsonpatch[_0x37cd('0x20')](_0x4b72e4,_0xc84a4c,!![]);}catch(_0x1709d7){return BPromise[_0x37cd('0x21')](_0x1709d7);}return _0x4b72e4[_0x37cd('0x22')]();};}function saveUpdates(_0x4d242d,_0x3eebdd){return function(_0x7df88){if(_0x7df88){return _0x7df88[_0x37cd('0x23')](_0x4d242d)[_0x37cd('0x24')](function(_0x5426ec){return _0x5426ec;});}return null;};}function removeEntity(_0x4f1508,_0x3d88c0){return function(_0x281f1a){if(_0x281f1a){return _0x281f1a['destroy']()[_0x37cd('0x24')](function(){var _0x2b4a85=_0x281f1a[_0x37cd('0x25')]({'plain':!![]});var _0x478a37=_0x37cd('0x26');return db[_0x37cd('0x27')][_0x37cd('0x28')]({'where':{'type':_0x478a37,'resourceId':_0x2b4a85['id']}})[_0x37cd('0x24')](function(){return _0x281f1a;});})[_0x37cd('0x24')](function(){_0x4f1508[_0x37cd('0x18')](0xcc)[_0x37cd('0x19')]();});}};}function handleEntityNotFound(_0x1aa475,_0x54bb5b){return function(_0xe7e610){if(!_0xe7e610){_0x1aa475['sendStatus'](0x194);}return _0xe7e610;};}function handleError(_0x455ff7,_0x23ed69){_0x23ed69=_0x23ed69||0x1f4;return function(_0x26fec4){logger[_0x37cd('0x29')](_0x26fec4[_0x37cd('0x2a')]);if(_0x26fec4[_0x37cd('0x2b')]){delete _0x26fec4[_0x37cd('0x2b')];}_0x455ff7[_0x37cd('0x18')](_0x23ed69)['send'](_0x26fec4);};}exports[_0x37cd('0x2c')]=function(_0x8c1a14,_0x1b82f8){var _0x50b4b1={},_0x259f6a={},_0x25f3cb={'count':0x0,'rows':[]};var _0x3ceb68=_[_0x37cd('0x2d')](db[_0x37cd('0x2e')][_0x37cd('0x2f')],function(_0x125fdc){return{'name':_0x125fdc[_0x37cd('0x30')],'type':_0x125fdc[_0x37cd('0x31')][_0x37cd('0x32')]};});_0x259f6a[_0x37cd('0x33')]=_[_0x37cd('0x2d')](_0x3ceb68,_0x37cd('0x2b'));_0x259f6a[_0x37cd('0x34')]=_['keys'](_0x8c1a14[_0x37cd('0x34')]);_0x259f6a[_0x37cd('0x35')]=_[_0x37cd('0x36')](_0x259f6a[_0x37cd('0x33')],_0x259f6a['query']);_0x50b4b1[_0x37cd('0x37')]=_[_0x37cd('0x36')](_0x259f6a[_0x37cd('0x33')],qs[_0x37cd('0x38')](_0x8c1a14[_0x37cd('0x34')][_0x37cd('0x38')]));_0x50b4b1[_0x37cd('0x37')]=_0x50b4b1[_0x37cd('0x37')]['length']?_0x50b4b1[_0x37cd('0x37')]:_0x259f6a[_0x37cd('0x33')];if(!_0x8c1a14['query'][_0x37cd('0x39')](_0x37cd('0x3a'))){_0x50b4b1['limit']=qs['limit'](_0x8c1a14[_0x37cd('0x34')][_0x37cd('0x1d')]);_0x50b4b1['offset']=qs[_0x37cd('0x1b')](_0x8c1a14[_0x37cd('0x34')][_0x37cd('0x1b')]);}_0x50b4b1['order']=qs[_0x37cd('0x3b')](_0x8c1a14['query']['sort']);_0x50b4b1[_0x37cd('0x3c')]=qs['filters'](_[_0x37cd('0x3d')](_0x8c1a14[_0x37cd('0x34')],_0x259f6a[_0x37cd('0x35')]),_0x3ceb68);if(_0x8c1a14[_0x37cd('0x34')][_0x37cd('0x3e')]){_0x50b4b1[_0x37cd('0x3c')]=_[_0x37cd('0x3f')](_0x50b4b1['where'],{'$or':_['map'](_0x3ceb68,function(_0x3751d9){if(_0x3751d9[_0x37cd('0x31')]!=='VIRTUAL'){var _0x2cb443={};_0x2cb443[_0x3751d9['name']]={'$like':'%'+_0x8c1a14[_0x37cd('0x34')][_0x37cd('0x3e')]+'%'};return _0x2cb443;}})});}_0x50b4b1=_[_0x37cd('0x3f')]({},_0x50b4b1,_0x8c1a14[_0x37cd('0x40')]);var _0x2f8fa6={'where':_0x50b4b1['where']};return db[_0x37cd('0x2e')]['count'](_0x2f8fa6)[_0x37cd('0x24')](function(_0x20dec8){_0x25f3cb[_0x37cd('0x1e')]=_0x20dec8;if(_0x8c1a14[_0x37cd('0x34')]['includeAll']){_0x50b4b1[_0x37cd('0x41')]=[{'all':!![]}];}return db['SquareOdbc']['findAll'](_0x50b4b1);})[_0x37cd('0x24')](function(_0x235a5b){_0x25f3cb[_0x37cd('0x42')]=_0x235a5b;return _0x25f3cb;})[_0x37cd('0x24')](respondWithFilteredResult(_0x1b82f8,_0x50b4b1))['catch'](handleError(_0x1b82f8,null));};exports['show']=function(_0x2c67d3,_0x37a0b8){var _0x1c6226={'raw':!![],'where':{'id':_0x2c67d3['params']['id']}},_0x5ce263={};_0x5ce263['model']=_['keys'](db[_0x37cd('0x2e')][_0x37cd('0x2f')]);_0x5ce263[_0x37cd('0x34')]=_[_0x37cd('0x43')](_0x2c67d3[_0x37cd('0x34')]);_0x5ce263[_0x37cd('0x35')]=_['intersection'](_0x5ce263['model'],_0x5ce263[_0x37cd('0x34')]);_0x1c6226[_0x37cd('0x37')]=_['intersection'](_0x5ce263['model'],qs[_0x37cd('0x38')](_0x2c67d3[_0x37cd('0x34')][_0x37cd('0x38')]));_0x1c6226[_0x37cd('0x37')]=_0x1c6226[_0x37cd('0x37')][_0x37cd('0x44')]?_0x1c6226['attributes']:_0x5ce263[_0x37cd('0x33')];if(_0x2c67d3['query'][_0x37cd('0x45')]){_0x1c6226[_0x37cd('0x41')]=[{'all':!![]}];}_0x1c6226=_[_0x37cd('0x3f')]({},_0x1c6226,_0x2c67d3['options']);return db[_0x37cd('0x2e')][_0x37cd('0x46')](_0x1c6226)[_0x37cd('0x24')](handleEntityNotFound(_0x37a0b8,null))[_0x37cd('0x24')](respondWithResult(_0x37a0b8,null))[_0x37cd('0x47')](handleError(_0x37a0b8,null));};exports[_0x37cd('0x48')]=function(_0xf0d0b3,_0x3ff332){return db[_0x37cd('0x2e')][_0x37cd('0x48')](_0xf0d0b3[_0x37cd('0x49')],{})[_0x37cd('0x24')](function(_0x5c2be6){var _0x132e4c=_0xf0d0b3[_0x37cd('0x4a')][_0x37cd('0x25')]({'plain':!![]});if(!_0x132e4c)throw new Error(_0x37cd('0x4b'));if(_0x132e4c['role']===_0x37cd('0x4a')){var _0x2de444=_0x5c2be6[_0x37cd('0x25')]({'plain':!![]});var _0x75e069=_0x37cd('0x26');return db[_0x37cd('0x4c')]['find']({'where':{'name':_0x75e069,'userProfileId':_0x132e4c[_0x37cd('0x4d')]},'raw':!![]})[_0x37cd('0x24')](function(_0x29c303){if(_0x29c303&&_0x29c303[_0x37cd('0x4e')]===0x0){return db[_0x37cd('0x27')][_0x37cd('0x48')]({'name':_0x2de444[_0x37cd('0x2b')],'resourceId':_0x2de444['id'],'type':_0x29c303['name'],'sectionId':_0x29c303['id']},{})[_0x37cd('0x24')](function(){return _0x5c2be6;});}else{return _0x5c2be6;}})[_0x37cd('0x47')](function(_0x2e993b){logger[_0x37cd('0x29')](_0x37cd('0x4f'),_0x2e993b);throw _0x2e993b;});}return _0x5c2be6;})['then'](respondWithResult(_0x3ff332,0xc9))[_0x37cd('0x47')](handleError(_0x3ff332,null));};exports[_0x37cd('0x23')]=function(_0x3e41ec,_0x235962){if(_0x3e41ec[_0x37cd('0x49')]['id']){delete _0x3e41ec['body']['id'];}return db[_0x37cd('0x2e')][_0x37cd('0x46')]({'where':{'id':_0x3e41ec[_0x37cd('0x50')]['id']}})[_0x37cd('0x24')](handleEntityNotFound(_0x235962,null))[_0x37cd('0x24')](saveUpdates(_0x3e41ec[_0x37cd('0x49')],null))[_0x37cd('0x24')](respondWithResult(_0x235962,null))[_0x37cd('0x47')](handleError(_0x235962,null));};exports[_0x37cd('0x28')]=function(_0xd5b796,_0x4058bb){return db['SquareOdbc'][_0x37cd('0x46')]({'where':{'id':_0xd5b796['params']['id']}})[_0x37cd('0x24')](handleEntityNotFound(_0x4058bb,null))[_0x37cd('0x24')](removeEntity(_0x4058bb,null))['catch'](handleError(_0x4058bb,null));};exports[_0x37cd('0x51')]=function(_0xa412a7,_0xb6e464,_0x364220){var _0x2dbbf7;return db[_0x37cd('0x2e')]['find']({'where':{'id':_0xa412a7[_0x37cd('0x50')]['id']},'attributes':['id',_0x37cd('0x52')]})[_0x37cd('0x24')](handleEntityNotFound(_0xb6e464,null))[_0x37cd('0x24')](function(_0x47b627){if(_0x47b627){var _0x10843f=require(_0x37cd('0x53'))();_0x10843f[_0x37cd('0x54')](_0x47b627[_0x37cd('0x52')]);_0x10843f[_0x37cd('0x55')]();return _0x47b627;}})[_0x37cd('0x24')](respondWithResult(_0xb6e464,null))[_0x37cd('0x47')](handleError(_0xb6e464,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index 366f02a..9f8e886 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 _0x7664=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareOdbc.attributes','exports','define','lodash'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x7664,0x1d3));var _0x4766=function(_0x3c680b,_0x2ff94d){_0x3c680b=_0x3c680b-0x0;var _0x36b288=_0x7664[_0x3c680b];return _0x36b288;};'use strict';var _=require(_0x4766('0x0'));var util=require('util');var logger=require(_0x4766('0x1'))(_0x4766('0x2'));var moment=require(_0x4766('0x3'));var BPromise=require(_0x4766('0x4'));var rp=require(_0x4766('0x5'));var fs=require('fs');var path=require(_0x4766('0x6'));var rimraf=require(_0x4766('0x7'));var config=require(_0x4766('0x8'));var attributes=require(_0x4766('0x9'));module[_0x4766('0xa')]=function(_0x5b4eb6,_0x5a8d9e){return _0x5b4eb6[_0x4766('0xb')]('SquareOdbc',attributes,{'tableName':'square_odbc','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4ced=['./squareOdbc.attributes','exports','define','SquareOdbc','lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment'];(function(_0x3ab19e,_0x25566a){var _0x183322=function(_0x477736){while(--_0x477736){_0x3ab19e['push'](_0x3ab19e['shift']());}};_0x183322(++_0x25566a);}(_0x4ced,0x16c));var _0xd4ce=function(_0x5e95e8,_0x235c15){_0x5e95e8=_0x5e95e8-0x0;var _0x20e65d=_0x4ced[_0x5e95e8];return _0x20e65d;};'use strict';var _=require(_0xd4ce('0x0'));var util=require(_0xd4ce('0x1'));var logger=require(_0xd4ce('0x2'))(_0xd4ce('0x3'));var moment=require(_0xd4ce('0x4'));var BPromise=require('bluebird');var rp=require(_0xd4ce('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd4ce('0x6'));var config=require(_0xd4ce('0x7'));var attributes=require(_0xd4ce('0x8'));module[_0xd4ce('0x9')]=function(_0x38fa8f,_0x394566){return _0x38fa8f[_0xd4ce('0xa')](_0xd4ce('0xb'),attributes,{'tableName':'square_odbc','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 503b82a..33934d8 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 _0xe068=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','ShowSquareOdbc','SquareOdbc','find','options','raw','where','attributes','include','map','model','then','stringify','util','moment','bluebird'];(function(_0x308408,_0x37d440){var _0x9dc073=function(_0x29f0c9){while(--_0x29f0c9){_0x308408['push'](_0x308408['shift']());}};_0x9dc073(++_0x37d440);}(_0xe068,0xeb));var _0x8e06=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe068[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x8e06('0x0'));var moment=require(_0x8e06('0x1'));var BPromise=require(_0x8e06('0x2'));var rs=require(_0x8e06('0x3'));var fs=require('fs');var Redis=require(_0x8e06('0x4'));var db=require(_0x8e06('0x5'))['db'];var utils=require(_0x8e06('0x6'));var logger=require(_0x8e06('0x7'))(_0x8e06('0x8'));var config=require(_0x8e06('0x9'));var jayson=require(_0x8e06('0xa'));var client=jayson['client'][_0x8e06('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x35b63a,_0x496e50,_0x541deb){return new BPromise(function(_0x194009,_0x2cc4af){return client['request'](_0x35b63a,_0x541deb)['then'](function(_0x35b96f){logger[_0x8e06('0xc')](_0x8e06('0xd'),_0x496e50,_0x8e06('0xe'));logger[_0x8e06('0xf')](_0x8e06('0x10'),_0x496e50,'request\x20sent',JSON['stringify'](_0x35b96f));if(_0x35b96f[_0x8e06('0x11')]){if(_0x35b96f[_0x8e06('0x11')][_0x8e06('0x12')]===0x1f4){logger[_0x8e06('0x11')]('SquareOdbc,\x20%s,\x20%s',_0x496e50,_0x35b96f[_0x8e06('0x11')][_0x8e06('0x13')]);return _0x2cc4af(_0x35b96f[_0x8e06('0x11')]['message']);}logger[_0x8e06('0x11')](_0x8e06('0xd'),_0x496e50,_0x35b96f[_0x8e06('0x11')]['message']);return _0x194009(_0x35b96f[_0x8e06('0x11')][_0x8e06('0x13')]);}else{logger['info'](_0x8e06('0xd'),_0x496e50,_0x8e06('0xe'));_0x194009(_0x35b96f[_0x8e06('0x14')]['message']);}})[_0x8e06('0x15')](function(_0x3ea8bb){logger[_0x8e06('0x11')](_0x8e06('0xd'),_0x496e50,_0x3ea8bb);_0x2cc4af(_0x3ea8bb);});});}exports[_0x8e06('0x16')]=function(_0x5b7662){var _0x4feb1f=this;return new Promise(function(_0x249fd1,_0xaaf8af){return db[_0x8e06('0x17')][_0x8e06('0x18')]({'raw':_0x5b7662[_0x8e06('0x19')]?_0x5b7662[_0x8e06('0x19')][_0x8e06('0x1a')]===undefined?!![]:![]:!![],'where':_0x5b7662['options']?_0x5b7662['options'][_0x8e06('0x1b')]||null:null,'attributes':_0x5b7662[_0x8e06('0x19')]?_0x5b7662['options'][_0x8e06('0x1c')]||null:null,'include':_0x5b7662['options']?_0x5b7662[_0x8e06('0x19')][_0x8e06('0x1d')]?_[_0x8e06('0x1e')](_0x5b7662[_0x8e06('0x19')]['include'],function(_0x536eda){return{'model':db[_0x536eda[_0x8e06('0x1f')]],'as':_0x536eda['as'],'attributes':_0x536eda['attributes'],'include':_0x536eda[_0x8e06('0x1d')]?_[_0x8e06('0x1e')](_0x536eda[_0x8e06('0x1d')],function(_0x44fa25){return{'model':db[_0x44fa25[_0x8e06('0x1f')]],'as':_0x44fa25['as'],'attributes':_0x44fa25['attributes'],'include':_0x44fa25[_0x8e06('0x1d')]?_[_0x8e06('0x1e')](_0x44fa25[_0x8e06('0x1d')],function(_0x4273bb){return{'model':db[_0x4273bb[_0x8e06('0x1f')]],'as':_0x4273bb['as'],'attributes':_0x4273bb[_0x8e06('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x8e06('0x20')](function(_0x5d4f55){logger[_0x8e06('0xc')](_0x8e06('0x16'),_0x5b7662);logger[_0x8e06('0xf')](_0x8e06('0x16'),_0x5b7662,JSON[_0x8e06('0x21')](_0x5d4f55));_0x249fd1(_0x5d4f55);})[_0x8e06('0x15')](function(_0x8d3b40){logger[_0x8e06('0x11')]('ShowSquareOdbc',_0x8d3b40[_0x8e06('0x13')],_0x5b7662);_0xaaf8af(_0x4feb1f[_0x8e06('0x11')](0x1f4,_0x8d3b40[_0x8e06('0x13')]));});});}; \ No newline at end of file +var _0xd554=['info','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','error','code','SquareOdbc,\x20%s,\x20%s','message','result','catch','ShowSquareOdbc','SquareOdbc','find','options','include','model','attributes','lodash','util','bluebird','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then'];(function(_0x454018,_0x46e33a){var _0x24697d=function(_0x3ec647){while(--_0x3ec647){_0x454018['push'](_0x454018['shift']());}};_0x24697d(++_0x46e33a);}(_0xd554,0x134));var _0x4d55=function(_0x2ec031,_0x1ce76d){_0x2ec031=_0x2ec031-0x0;var _0x594b6d=_0xd554[_0x2ec031];return _0x594b6d;};'use strict';var _=require(_0x4d55('0x0'));var util=require(_0x4d55('0x1'));var moment=require('moment');var BPromise=require(_0x4d55('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4d55('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x4d55('0x4'));var logger=require('../../config/logger')(_0x4d55('0x5'));var config=require(_0x4d55('0x6'));var jayson=require(_0x4d55('0x7'));var client=jayson['client'][_0x4d55('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3bf696,_0x578b76,_0x62c9f){return new BPromise(function(_0x24c912,_0x398e00){return client[_0x4d55('0x9')](_0x3bf696,_0x62c9f)[_0x4d55('0xa')](function(_0x541ba8){logger[_0x4d55('0xb')]('SquareOdbc,\x20%s,\x20%s',_0x578b76,_0x4d55('0xc'));logger[_0x4d55('0xd')](_0x4d55('0xe'),_0x578b76,_0x4d55('0xc'),JSON[_0x4d55('0xf')](_0x541ba8));if(_0x541ba8[_0x4d55('0x10')]){if(_0x541ba8[_0x4d55('0x10')][_0x4d55('0x11')]===0x1f4){logger['error'](_0x4d55('0x12'),_0x578b76,_0x541ba8[_0x4d55('0x10')]['message']);return _0x398e00(_0x541ba8['error'][_0x4d55('0x13')]);}logger[_0x4d55('0x10')](_0x4d55('0x12'),_0x578b76,_0x541ba8[_0x4d55('0x10')][_0x4d55('0x13')]);return _0x24c912(_0x541ba8[_0x4d55('0x10')][_0x4d55('0x13')]);}else{logger['info'](_0x4d55('0x12'),_0x578b76,_0x4d55('0xc'));_0x24c912(_0x541ba8[_0x4d55('0x14')]['message']);}})[_0x4d55('0x15')](function(_0x3ca405){logger[_0x4d55('0x10')](_0x4d55('0x12'),_0x578b76,_0x3ca405);_0x398e00(_0x3ca405);});});}exports[_0x4d55('0x16')]=function(_0x5e6c3b){var _0x29bd68=this;return new Promise(function(_0x566a69,_0x67f308){return db[_0x4d55('0x17')][_0x4d55('0x18')]({'raw':_0x5e6c3b[_0x4d55('0x19')]?_0x5e6c3b[_0x4d55('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x5e6c3b[_0x4d55('0x19')]?_0x5e6c3b[_0x4d55('0x19')]['where']||null:null,'attributes':_0x5e6c3b[_0x4d55('0x19')]?_0x5e6c3b['options']['attributes']||null:null,'include':_0x5e6c3b[_0x4d55('0x19')]?_0x5e6c3b[_0x4d55('0x19')][_0x4d55('0x1a')]?_['map'](_0x5e6c3b[_0x4d55('0x19')][_0x4d55('0x1a')],function(_0x544311){return{'model':db[_0x544311[_0x4d55('0x1b')]],'as':_0x544311['as'],'attributes':_0x544311[_0x4d55('0x1c')],'include':_0x544311[_0x4d55('0x1a')]?_['map'](_0x544311['include'],function(_0x2eba79){return{'model':db[_0x2eba79[_0x4d55('0x1b')]],'as':_0x2eba79['as'],'attributes':_0x2eba79[_0x4d55('0x1c')],'include':_0x2eba79['include']?_['map'](_0x2eba79[_0x4d55('0x1a')],function(_0xdc8cba){return{'model':db[_0xdc8cba[_0x4d55('0x1b')]],'as':_0xdc8cba['as'],'attributes':_0xdc8cba[_0x4d55('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x4d55('0xa')](function(_0x5450f1){logger[_0x4d55('0xb')]('ShowSquareOdbc',_0x5e6c3b);logger['debug']('ShowSquareOdbc',_0x5e6c3b,JSON[_0x4d55('0xf')](_0x5450f1));_0x566a69(_0x5450f1);})['catch'](function(_0x210984){logger[_0x4d55('0x10')](_0x4d55('0x16'),_0x210984[_0x4d55('0x13')],_0x5e6c3b);_0x67f308(_0x29bd68['error'](0x1f4,_0x210984[_0x4d55('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index c7d30d5..1194d11 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 _0xed3c=['delete','/:id','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','./squareProject.controller','get','isAuthenticated','index','show','getUsers','post','create','addUsers','put','update'];(function(_0x172dcb,_0x198a65){var _0x1cceb9=function(_0x4546ea){while(--_0x4546ea){_0x172dcb['push'](_0x172dcb['shift']());}};_0x1cceb9(++_0x198a65);}(_0xed3c,0x1a6));var _0xced3=function(_0x3d0016,_0x4a37e0){_0x3d0016=_0x3d0016-0x0;var _0x1dcb28=_0xed3c[_0x3d0016];return _0x1dcb28;};'use strict';var multer=require(_0xced3('0x0'));var util=require(_0xced3('0x1'));var path=require(_0xced3('0x2'));var timeout=require(_0xced3('0x3'));var express=require('express');var router=express[_0xced3('0x4')]();var fs_extra=require(_0xced3('0x5'));var auth=require(_0xced3('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xced3('0x7'));router[_0xced3('0x8')]('/',auth[_0xced3('0x9')](),controller[_0xced3('0xa')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xced3('0xb')]);router['get']('/:id/users',auth['isAuthenticated'](),controller[_0xced3('0xc')]);router[_0xced3('0xd')]('/',auth[_0xced3('0x9')](),controller[_0xced3('0xe')]);router[_0xced3('0xd')]('/:id/users',auth[_0xced3('0x9')](),controller[_0xced3('0xf')]);router[_0xced3('0x10')]('/:id',auth[_0xced3('0x9')](),controller[_0xced3('0x11')]);router[_0xced3('0x12')](_0xced3('0x13'),auth[_0xced3('0x9')](),controller[_0xced3('0x14')]);router[_0xced3('0x12')]('/:id/users',auth[_0xced3('0x9')](),controller['removeUsers']);module[_0xced3('0x15')]=router; \ No newline at end of file +var _0x757c=['removeUsers','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','/:id','show','/:id/users','post','put','update','delete','destroy'];(function(_0x842858,_0x3a3ca0){var _0x46c2a2=function(_0x47f795){while(--_0x47f795){_0x842858['push'](_0x842858['shift']());}};_0x46c2a2(++_0x3a3ca0);}(_0x757c,0x191));var _0xc757=function(_0x5b959c,_0x459886){_0x5b959c=_0x5b959c-0x0;var _0x5341f1=_0x757c[_0x5b959c];return _0x5341f1;};'use strict';var multer=require(_0xc757('0x0'));var util=require(_0xc757('0x1'));var path=require('path');var timeout=require(_0xc757('0x2'));var express=require(_0xc757('0x3'));var router=express[_0xc757('0x4')]();var fs_extra=require(_0xc757('0x5'));var auth=require(_0xc757('0x6'));var interaction=require(_0xc757('0x7'));var config=require(_0xc757('0x8'));var controller=require('./squareProject.controller');router['get']('/',auth[_0xc757('0x9')](),controller['index']);router[_0xc757('0xa')](_0xc757('0xb'),auth[_0xc757('0x9')](),controller[_0xc757('0xc')]);router[_0xc757('0xa')](_0xc757('0xd'),auth[_0xc757('0x9')](),controller['getUsers']);router['post']('/',auth[_0xc757('0x9')](),controller['create']);router[_0xc757('0xe')]('/:id/users',auth[_0xc757('0x9')](),controller['addUsers']);router[_0xc757('0xf')](_0xc757('0xb'),auth[_0xc757('0x9')](),controller[_0xc757('0x10')]);router[_0xc757('0x11')]('/:id',auth[_0xc757('0x9')](),controller[_0xc757('0x12')]);router[_0xc757('0x11')]('/:id/users',auth['isAuthenticated'](),controller[_0xc757('0x13')]);module[_0xc757('0x14')]=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index 5da7d74..3ea8899 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 _0xeeeb=['exports','STRING','TEXT','BLOB','getDataValue','preproduction','toString','utf8','production','DATE','sequelize'];(function(_0x7b8e15,_0x32c584){var _0x8e4868=function(_0x28d077){while(--_0x28d077){_0x7b8e15['push'](_0x7b8e15['shift']());}};_0x8e4868(++_0x32c584);}(_0xeeeb,0x16a));var _0xbeee=function(_0x52feb2,_0x46c5c4){_0x52feb2=_0x52feb2-0x0;var _0x24c489=_0xeeeb[_0x52feb2];return _0x24c489;};'use strict';var Sequelize=require(_0xbeee('0x0'));module[_0xbeee('0x1')]={'name':{'type':Sequelize[_0xbeee('0x2')],'unique':'name','allowNull':![]},'description':{'type':Sequelize['STRING']},'notes':{'type':Sequelize[_0xbeee('0x3')]},'preproduction':{'type':Sequelize[_0xbeee('0x4')]('long'),'get':function(){if(this[_0xbeee('0x5')]('preproduction')){return this['getDataValue'](_0xbeee('0x6'))[_0xbeee('0x7')](_0xbeee('0x8'));}}},'production':{'type':Sequelize[_0xbeee('0x4')]('long'),'get':function(){if(this[_0xbeee('0x5')](_0xbeee('0x9'))){return this[_0xbeee('0x5')]('production')[_0xbeee('0x7')](_0xbeee('0x8'));}}},'savedAt':{'type':Sequelize['DATE']},'publishedAt':{'type':Sequelize[_0xbeee('0xa')]}}; \ No newline at end of file +var _0x1c90=['getDataValue','preproduction','toString','utf8','long','production','DATE','exports','STRING','TEXT','BLOB'];(function(_0x57add2,_0x4f2b7d){var _0x4e3670=function(_0x3311b){while(--_0x3311b){_0x57add2['push'](_0x57add2['shift']());}};_0x4e3670(++_0x4f2b7d);}(_0x1c90,0x104));var _0x01c9=function(_0x4abe79,_0xb55578){_0x4abe79=_0x4abe79-0x0;var _0x3d4e38=_0x1c90[_0x4abe79];return _0x3d4e38;};'use strict';var Sequelize=require('sequelize');module[_0x01c9('0x0')]={'name':{'type':Sequelize[_0x01c9('0x1')],'unique':'name','allowNull':![]},'description':{'type':Sequelize['STRING']},'notes':{'type':Sequelize[_0x01c9('0x2')]},'preproduction':{'type':Sequelize[_0x01c9('0x3')]('long'),'get':function(){if(this[_0x01c9('0x4')](_0x01c9('0x5'))){return this[_0x01c9('0x4')]('preproduction')[_0x01c9('0x6')](_0x01c9('0x7'));}}},'production':{'type':Sequelize[_0x01c9('0x3')](_0x01c9('0x8')),'get':function(){if(this[_0x01c9('0x4')](_0x01c9('0x9'))){return this[_0x01c9('0x4')](_0x01c9('0x9'))['toString'](_0x01c9('0x7'));}}},'savedAt':{'type':Sequelize[_0x01c9('0xa')]},'publishedAt':{'type':Sequelize[_0x01c9('0xa')]}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index 5511388..fcd6717 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 _0x7882=['params','keys','find','catch','create','body','user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addUsers','ids','removeUsers','isArray','emit','userSquareProject:remove','User','getUsers','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','sendStatus','end','status','offset','undefined','limit','count','json','apply','reject','save','update','then','destroy','get','SquareProjects','UserProfileResource','error','stack','name','index','map','rawAttributes','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','merge','where','VIRTUAL','options','SquareProject','includeAll','include','findAll','rows','show'];(function(_0x4f9b18,_0x2cb5ca){var _0x29f20c=function(_0x268b3d){while(--_0x268b3d){_0x4f9b18['push'](_0x4f9b18['shift']());}};_0x29f20c(++_0x2cb5ca);}(_0x7882,0x136));var _0x2788=function(_0x36bff5,_0x3156cb){_0x36bff5=_0x36bff5-0x0;var _0x80ade5=_0x7882[_0x36bff5];return _0x80ade5;};'use strict';var emlformat=require(_0x2788('0x0'));var rimraf=require(_0x2788('0x1'));var zipdir=require(_0x2788('0x2'));var jsonpatch=require(_0x2788('0x3'));var rp=require(_0x2788('0x4'));var moment=require(_0x2788('0x5'));var BPromise=require(_0x2788('0x6'));var Mustache=require(_0x2788('0x7'));var util=require(_0x2788('0x8'));var path=require(_0x2788('0x9'));var sox=require(_0x2788('0xa'));var csv=require('to-csv');var ejs=require(_0x2788('0xb'));var fs=require('fs');var fs_extra=require(_0x2788('0xc'));var _=require(_0x2788('0xd'));var squel=require(_0x2788('0xe'));var crypto=require(_0x2788('0xf'));var jsforce=require(_0x2788('0x10'));var deskjs=require(_0x2788('0x11'));var toCsv=require('to-csv');var querystring=require(_0x2788('0x12'));var Papa=require(_0x2788('0x13'));var Redis=require('ioredis');var authService=require(_0x2788('0x14'));var qs=require(_0x2788('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x2788('0x16'))(_0x2788('0x17'));var utils=require(_0x2788('0x18'));var config=require(_0x2788('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x2788('0x1a'))['db'];config[_0x2788('0x1b')]=_[_0x2788('0x1c')](config[_0x2788('0x1b')],{'host':_0x2788('0x1d'),'port':0x18eb});var socket=require(_0x2788('0x1e'))(new Redis(config['redis']));require('./squareProject.socket')['register'](socket);function respondWithStatusCode(_0x942890,_0x201c85){_0x201c85=_0x201c85||0xcc;return function(_0x39b122){if(_0x39b122){return _0x942890[_0x2788('0x1f')](_0x201c85);}return _0x942890['status'](_0x201c85)[_0x2788('0x20')]();};}function respondWithResult(_0x17d8ab,_0x16959e){_0x16959e=_0x16959e||0xc8;return function(_0x2c0ebe){if(_0x2c0ebe){return _0x17d8ab[_0x2788('0x21')](_0x16959e)['json'](_0x2c0ebe);}};}function respondWithFilteredResult(_0x581a2e,_0x30a683){return function(_0x8832ac){if(_0x8832ac){var _0x4c7eda=typeof _0x30a683[_0x2788('0x22')]===_0x2788('0x23')&&typeof _0x30a683[_0x2788('0x24')]===_0x2788('0x23');var _0x1b4ff0=_0x8832ac[_0x2788('0x25')];var _0x5a5abe=_0x4c7eda?0x0:_0x30a683[_0x2788('0x22')];var _0x3aa06a=_0x4c7eda?_0x8832ac[_0x2788('0x25')]:_0x30a683[_0x2788('0x22')]+_0x30a683[_0x2788('0x24')];var _0x287f64;if(_0x3aa06a>=_0x1b4ff0){_0x3aa06a=_0x1b4ff0;_0x287f64=0xc8;}else{_0x287f64=0xce;}_0x581a2e[_0x2788('0x21')](_0x287f64);return _0x581a2e['set']('Content-Range',_0x5a5abe+'-'+_0x3aa06a+'/'+_0x1b4ff0)[_0x2788('0x26')](_0x8832ac);}return null;};}function patchUpdates(_0x95720c){return function(_0x3e1472){try{jsonpatch[_0x2788('0x27')](_0x3e1472,_0x95720c,!![]);}catch(_0x4218d6){return BPromise[_0x2788('0x28')](_0x4218d6);}return _0x3e1472[_0x2788('0x29')]();};}function saveUpdates(_0x36d3af,_0x3a1865){return function(_0x3abc24){if(_0x3abc24){return _0x3abc24[_0x2788('0x2a')](_0x36d3af)[_0x2788('0x2b')](function(_0x2aeb05){return _0x2aeb05;});}return null;};}function removeEntity(_0x55ce51,_0x281109){return function(_0x5f0cf2){if(_0x5f0cf2){return _0x5f0cf2[_0x2788('0x2c')]()[_0x2788('0x2b')](function(){var _0x329c73=_0x5f0cf2[_0x2788('0x2d')]({'plain':!![]});var _0x3cc724=_0x2788('0x2e');return db[_0x2788('0x2f')]['destroy']({'where':{'type':_0x3cc724,'resourceId':_0x329c73['id']}})[_0x2788('0x2b')](function(){return _0x5f0cf2;});})[_0x2788('0x2b')](function(){_0x55ce51[_0x2788('0x21')](0xcc)[_0x2788('0x20')]();});}};}function handleEntityNotFound(_0x37d6bd,_0x31ad5f){return function(_0x44f690){if(!_0x44f690){_0x37d6bd['sendStatus'](0x194);}return _0x44f690;};}function handleError(_0x402fd5,_0x55680e){_0x55680e=_0x55680e||0x1f4;return function(_0x4dd557){logger[_0x2788('0x30')](_0x4dd557[_0x2788('0x31')]);if(_0x4dd557[_0x2788('0x32')]){delete _0x4dd557[_0x2788('0x32')];}_0x402fd5[_0x2788('0x21')](_0x55680e)['send'](_0x4dd557);};}exports[_0x2788('0x33')]=function(_0x374f2e,_0x4dc52a){var _0x530a6e={},_0x2946bd={},_0x56c831={'count':0x0,'rows':[]};var _0x506f28=_[_0x2788('0x34')](db['SquareProject'][_0x2788('0x35')],function(_0x226f04){return{'name':_0x226f04['fieldName'],'type':_0x226f04[_0x2788('0x36')][_0x2788('0x37')]};});_0x2946bd[_0x2788('0x38')]=_[_0x2788('0x34')](_0x506f28,_0x2788('0x32'));_0x2946bd['query']=_['keys'](_0x374f2e[_0x2788('0x39')]);_0x2946bd[_0x2788('0x3a')]=_['intersection'](_0x2946bd[_0x2788('0x38')],_0x2946bd[_0x2788('0x39')]);_0x530a6e['attributes']=_[_0x2788('0x3b')](_0x2946bd[_0x2788('0x38')],qs[_0x2788('0x3c')](_0x374f2e[_0x2788('0x39')][_0x2788('0x3c')]));_0x530a6e[_0x2788('0x3d')]=_0x530a6e[_0x2788('0x3d')][_0x2788('0x3e')]?_0x530a6e[_0x2788('0x3d')]:_0x2946bd[_0x2788('0x38')];if(!_0x374f2e[_0x2788('0x39')][_0x2788('0x3f')](_0x2788('0x40'))){_0x530a6e[_0x2788('0x24')]=qs['limit'](_0x374f2e[_0x2788('0x39')][_0x2788('0x24')]);_0x530a6e[_0x2788('0x22')]=qs['offset'](_0x374f2e['query'][_0x2788('0x22')]);}_0x530a6e[_0x2788('0x41')]=qs[_0x2788('0x42')](_0x374f2e[_0x2788('0x39')]['sort']);_0x530a6e['where']=qs[_0x2788('0x3a')](_[_0x2788('0x43')](_0x374f2e[_0x2788('0x39')],_0x2946bd[_0x2788('0x3a')]),_0x506f28);if(_0x374f2e[_0x2788('0x39')]['filter']){_0x530a6e['where']=_[_0x2788('0x44')](_0x530a6e[_0x2788('0x45')],{'$or':_[_0x2788('0x34')](_0x506f28,function(_0x1ed623){if(_0x1ed623['type']!==_0x2788('0x46')){var _0x233a20={};_0x233a20[_0x1ed623['name']]={'$like':'%'+_0x374f2e[_0x2788('0x39')]['filter']+'%'};return _0x233a20;}})});}_0x530a6e=_[_0x2788('0x44')]({},_0x530a6e,_0x374f2e[_0x2788('0x47')]);var _0x462c02={'where':_0x530a6e[_0x2788('0x45')]};return db[_0x2788('0x48')][_0x2788('0x25')](_0x462c02)[_0x2788('0x2b')](function(_0x52e8c0){_0x56c831[_0x2788('0x25')]=_0x52e8c0;if(_0x374f2e[_0x2788('0x39')][_0x2788('0x49')]){_0x530a6e[_0x2788('0x4a')]=[{'all':!![]}];}return db[_0x2788('0x48')][_0x2788('0x4b')](_0x530a6e);})[_0x2788('0x2b')](function(_0x4f7343){_0x56c831[_0x2788('0x4c')]=_0x4f7343;return _0x56c831;})[_0x2788('0x2b')](respondWithFilteredResult(_0x4dc52a,_0x530a6e))['catch'](handleError(_0x4dc52a,null));};exports[_0x2788('0x4d')]=function(_0x40d002,_0x458378){var _0x3bffd9={'raw':![],'where':{'id':_0x40d002[_0x2788('0x4e')]['id']}},_0x223e74={};_0x223e74[_0x2788('0x38')]=_[_0x2788('0x4f')](db[_0x2788('0x48')][_0x2788('0x35')]);_0x223e74['query']=_[_0x2788('0x4f')](_0x40d002[_0x2788('0x39')]);_0x223e74[_0x2788('0x3a')]=_['intersection'](_0x223e74['model'],_0x223e74[_0x2788('0x39')]);_0x3bffd9[_0x2788('0x3d')]=_[_0x2788('0x3b')](_0x223e74[_0x2788('0x38')],qs[_0x2788('0x3c')](_0x40d002[_0x2788('0x39')][_0x2788('0x3c')]));_0x3bffd9['attributes']=_0x3bffd9[_0x2788('0x3d')][_0x2788('0x3e')]?_0x3bffd9[_0x2788('0x3d')]:_0x223e74['model'];if(_0x40d002['query'][_0x2788('0x49')]){_0x3bffd9[_0x2788('0x4a')]=[{'all':!![]}];}_0x3bffd9=_['merge']({},_0x3bffd9,_0x40d002[_0x2788('0x47')]);return db[_0x2788('0x48')][_0x2788('0x50')](_0x3bffd9)[_0x2788('0x2b')](handleEntityNotFound(_0x458378,null))[_0x2788('0x2b')](respondWithResult(_0x458378,null))[_0x2788('0x51')](handleError(_0x458378,null));};exports[_0x2788('0x52')]=function(_0x561de1,_0x4a5762){return db[_0x2788('0x48')][_0x2788('0x52')](_0x561de1[_0x2788('0x53')],{})[_0x2788('0x2b')](function(_0x24b272){var _0xe7f542=_0x561de1[_0x2788('0x54')]['get']({'plain':!![]});if(!_0xe7f542)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xe7f542[_0x2788('0x55')]===_0x2788('0x54')){var _0x2e0e08=_0x24b272[_0x2788('0x2d')]({'plain':!![]});var _0x2defd8=_0x2788('0x2e');return db[_0x2788('0x56')][_0x2788('0x50')]({'where':{'name':_0x2defd8,'userProfileId':_0xe7f542['userProfileId']},'raw':!![]})[_0x2788('0x2b')](function(_0x4de021){if(_0x4de021&&_0x4de021[_0x2788('0x57')]===0x0){return db[_0x2788('0x2f')][_0x2788('0x52')]({'name':_0x2e0e08['name'],'resourceId':_0x2e0e08['id'],'type':_0x4de021[_0x2788('0x32')],'sectionId':_0x4de021['id']},{})[_0x2788('0x2b')](function(){return _0x24b272;});}else{return _0x24b272;}})['catch'](function(_0x4ee5fb){logger[_0x2788('0x30')](_0x2788('0x58'),_0x4ee5fb);throw _0x4ee5fb;});}return _0x24b272;})[_0x2788('0x2b')](respondWithResult(_0x4a5762,0xc9))[_0x2788('0x51')](handleError(_0x4a5762,null));};exports[_0x2788('0x2a')]=function(_0x50bb21,_0x508228){if(_0x50bb21[_0x2788('0x53')]['id']){delete _0x50bb21[_0x2788('0x53')]['id'];}return db[_0x2788('0x48')][_0x2788('0x50')]({'where':{'id':_0x50bb21[_0x2788('0x4e')]['id']}})[_0x2788('0x2b')](handleEntityNotFound(_0x508228,null))[_0x2788('0x2b')](saveUpdates(_0x50bb21['body'],null))[_0x2788('0x2b')](respondWithResult(_0x508228,null))['catch'](handleError(_0x508228,null));};exports[_0x2788('0x2c')]=function(_0x38717c,_0xa351e8){return db[_0x2788('0x48')][_0x2788('0x50')]({'where':{'id':_0x38717c['params']['id']}})[_0x2788('0x2b')](handleEntityNotFound(_0xa351e8,null))[_0x2788('0x2b')](removeEntity(_0xa351e8,null))['catch'](handleError(_0xa351e8,null));};exports['addUsers']=function(_0x3d979a,_0x332052,_0x62f683){return db[_0x2788('0x48')]['find']({'where':{'id':_0x3d979a[_0x2788('0x4e')]['id']}})['then'](handleEntityNotFound(_0x332052,null))[_0x2788('0x2b')](function(_0x1fb7bb){if(_0x1fb7bb){return _0x1fb7bb[_0x2788('0x59')](_0x3d979a[_0x2788('0x53')][_0x2788('0x5a')],_['omit'](_0x3d979a['body'],['ids','id'])||{});}})[_0x2788('0x2b')](respondWithResult(_0x332052,null))[_0x2788('0x51')](handleError(_0x332052,null));};exports[_0x2788('0x5b')]=function(_0xe47e30,_0x386179,_0x2ccdd1){return db['SquareProject'][_0x2788('0x50')]({'where':{'id':_0xe47e30['params']['id']}})[_0x2788('0x2b')](handleEntityNotFound(_0x386179,null))[_0x2788('0x2b')](function(_0x67e000){if(_0x67e000){return _0x67e000['removeUsers'](_0xe47e30['query'][_0x2788('0x5a')])[_0x2788('0x2b')](function(){if(_[_0x2788('0x5c')](_0xe47e30[_0x2788('0x39')][_0x2788('0x5a')])){for(var _0x48d837=0x0;_0x48d837<_0xe47e30[_0x2788('0x39')][_0x2788('0x5a')][_0x2788('0x3e')];_0x48d837+=0x1){socket[_0x2788('0x5d')](_0x2788('0x5e'),{'UserId':Number(_0xe47e30[_0x2788('0x39')]['ids'][_0x48d837]),'SquareProjectId':Number(_0xe47e30[_0x2788('0x4e')]['id'])});}}else{socket['emit'](_0x2788('0x5e'),{'UserId':Number(_0xe47e30[_0x2788('0x39')][_0x2788('0x5a')]),'SquareProjectId':Number(_0xe47e30[_0x2788('0x4e')]['id'])});}});}})[_0x2788('0x2b')](respondWithStatusCode(_0x386179,null))[_0x2788('0x51')](handleError(_0x386179,null));};exports['getUsers']=function(_0x6a6d66,_0x2930b1,_0x17242e){var _0x2364bb={};var _0x5ca8bd={};var _0x4d379e;var _0x302637;return db[_0x2788('0x48')]['findOne']({'where':{'id':_0x6a6d66['params']['id']}})['then'](handleEntityNotFound(_0x2930b1,null))[_0x2788('0x2b')](function(_0x577f62){if(_0x577f62){_0x4d379e=_0x577f62;_0x5ca8bd[_0x2788('0x38')]=_['keys'](db[_0x2788('0x5f')][_0x2788('0x35')]);_0x5ca8bd['query']=_['keys'](_0x6a6d66['query']);_0x5ca8bd[_0x2788('0x3a')]=_['intersection'](_0x5ca8bd[_0x2788('0x38')],_0x5ca8bd['query']);_0x2364bb[_0x2788('0x3d')]=_['intersection'](_0x5ca8bd[_0x2788('0x38')],qs[_0x2788('0x3c')](_0x6a6d66[_0x2788('0x39')][_0x2788('0x3c')]));_0x2364bb['attributes']=_0x2364bb[_0x2788('0x3d')][_0x2788('0x3e')]?_0x2364bb[_0x2788('0x3d')]:_0x5ca8bd[_0x2788('0x38')];_0x2364bb['order']=qs[_0x2788('0x42')](_0x6a6d66[_0x2788('0x39')]['sort']);_0x2364bb[_0x2788('0x45')]=qs[_0x2788('0x3a')](_[_0x2788('0x43')](_0x6a6d66[_0x2788('0x39')],_0x5ca8bd[_0x2788('0x3a')]));if(_0x6a6d66['query']['filter']){_0x2364bb['where']=_['merge'](_0x2364bb[_0x2788('0x45')],{'$or':_[_0x2788('0x34')](_0x2364bb['attributes'],function(_0xa90695){var _0x2cef4={};_0x2cef4[_0xa90695]={'$like':'%'+_0x6a6d66[_0x2788('0x39')]['filter']+'%'};return _0x2cef4;})});}_0x2364bb=_[_0x2788('0x44')]({},_0x2364bb,_0x6a6d66[_0x2788('0x47')]);return _0x4d379e['getUsers'](_0x2364bb);}})['then'](function(_0x3c5011){if(_0x3c5011){_0x302637=_0x3c5011['length'];if(!_0x6a6d66[_0x2788('0x39')]['hasOwnProperty']('nolimit')){_0x2364bb['limit']=qs[_0x2788('0x24')](_0x6a6d66['query']['limit']);_0x2364bb[_0x2788('0x22')]=qs[_0x2788('0x22')](_0x6a6d66[_0x2788('0x39')][_0x2788('0x22')]);}return _0x4d379e[_0x2788('0x60')](_0x2364bb);}})['then'](function(_0x35db68){if(_0x35db68){return _0x35db68?{'count':_0x302637,'rows':_0x35db68}:null;}})[_0x2788('0x2b')](respondWithResult(_0x2930b1,null))[_0x2788('0x51')](handleError(_0x2930b1,null));}; \ No newline at end of file +var _0xb9f2=['bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','save','update','then','destroy','get','SquareProjects','UserProfileResource','error','stack','name','send','index','map','SquareProject','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','order','sort','pick','filter','where','merge','options','includeAll','include','findAll','rows','show','params','length','find','catch','create','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','addUsers','ids','omit','removeUsers','isArray','emit','userSquareProject:remove','getUsers','User','rawAttributes','rimraf','zip-dir','fast-json-patch','moment'];(function(_0x538719,_0x1b74ba){var _0x343fbe=function(_0x348d14){while(--_0x348d14){_0x538719['push'](_0x538719['shift']());}};_0x343fbe(++_0x1b74ba);}(_0xb9f2,0x128));var _0x2b9f=function(_0x2e1cbe,_0x19aee7){_0x2e1cbe=_0x2e1cbe-0x0;var _0x2f77bc=_0xb9f2[_0x2e1cbe];return _0x2f77bc;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2b9f('0x0'));var zipdir=require(_0x2b9f('0x1'));var jsonpatch=require(_0x2b9f('0x2'));var rp=require('request-promise');var moment=require(_0x2b9f('0x3'));var BPromise=require(_0x2b9f('0x4'));var Mustache=require(_0x2b9f('0x5'));var util=require(_0x2b9f('0x6'));var path=require(_0x2b9f('0x7'));var sox=require(_0x2b9f('0x8'));var csv=require(_0x2b9f('0x9'));var ejs=require(_0x2b9f('0xa'));var fs=require('fs');var fs_extra=require(_0x2b9f('0xb'));var _=require('lodash');var squel=require(_0x2b9f('0xc'));var crypto=require(_0x2b9f('0xd'));var jsforce=require(_0x2b9f('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x2b9f('0xf'));var Papa=require(_0x2b9f('0x10'));var Redis=require(_0x2b9f('0x11'));var authService=require(_0x2b9f('0x12'));var qs=require(_0x2b9f('0x13'));var as=require(_0x2b9f('0x14'));var hardwareService=require(_0x2b9f('0x15'));var logger=require(_0x2b9f('0x16'))(_0x2b9f('0x17'));var utils=require('../../config/utils');var config=require(_0x2b9f('0x18'));var licenseUtil=require(_0x2b9f('0x19'));var db=require(_0x2b9f('0x1a'))['db'];config['redis']=_[_0x2b9f('0x1b')](config['redis'],{'host':_0x2b9f('0x1c'),'port':0x18eb});var socket=require(_0x2b9f('0x1d'))(new Redis(config['redis']));require('./squareProject.socket')[_0x2b9f('0x1e')](socket);function respondWithStatusCode(_0x4d2e50,_0x8c2bad){_0x8c2bad=_0x8c2bad||0xcc;return function(_0x56f222){if(_0x56f222){return _0x4d2e50[_0x2b9f('0x1f')](_0x8c2bad);}return _0x4d2e50[_0x2b9f('0x20')](_0x8c2bad)[_0x2b9f('0x21')]();};}function respondWithResult(_0x9c4aa5,_0x503262){_0x503262=_0x503262||0xc8;return function(_0x5bf18d){if(_0x5bf18d){return _0x9c4aa5[_0x2b9f('0x20')](_0x503262)['json'](_0x5bf18d);}};}function respondWithFilteredResult(_0x2330bd,_0x2844de){return function(_0x20c346){if(_0x20c346){var _0x17c51e=typeof _0x2844de[_0x2b9f('0x22')]===_0x2b9f('0x23')&&typeof _0x2844de[_0x2b9f('0x24')]===_0x2b9f('0x23');var _0x1c1fb3=_0x20c346[_0x2b9f('0x25')];var _0x447b5c=_0x17c51e?0x0:_0x2844de[_0x2b9f('0x22')];var _0x3b9468=_0x17c51e?_0x20c346[_0x2b9f('0x25')]:_0x2844de['offset']+_0x2844de[_0x2b9f('0x24')];var _0x2938bd;if(_0x3b9468>=_0x1c1fb3){_0x3b9468=_0x1c1fb3;_0x2938bd=0xc8;}else{_0x2938bd=0xce;}_0x2330bd[_0x2b9f('0x20')](_0x2938bd);return _0x2330bd['set'](_0x2b9f('0x26'),_0x447b5c+'-'+_0x3b9468+'/'+_0x1c1fb3)[_0x2b9f('0x27')](_0x20c346);}return null;};}function patchUpdates(_0x3d8dcc){return function(_0x2b6669){try{jsonpatch[_0x2b9f('0x28')](_0x2b6669,_0x3d8dcc,!![]);}catch(_0x2ab4f5){return BPromise[_0x2b9f('0x29')](_0x2ab4f5);}return _0x2b6669[_0x2b9f('0x2a')]();};}function saveUpdates(_0x4c8f43,_0x1ebd4d){return function(_0x2b6542){if(_0x2b6542){return _0x2b6542[_0x2b9f('0x2b')](_0x4c8f43)[_0x2b9f('0x2c')](function(_0x22dc21){return _0x22dc21;});}return null;};}function removeEntity(_0xddda2b,_0x578c08){return function(_0x4abbc7){if(_0x4abbc7){return _0x4abbc7[_0x2b9f('0x2d')]()['then'](function(){var _0x4b2698=_0x4abbc7[_0x2b9f('0x2e')]({'plain':!![]});var _0x1dc93c=_0x2b9f('0x2f');return db[_0x2b9f('0x30')][_0x2b9f('0x2d')]({'where':{'type':_0x1dc93c,'resourceId':_0x4b2698['id']}})[_0x2b9f('0x2c')](function(){return _0x4abbc7;});})[_0x2b9f('0x2c')](function(){_0xddda2b['status'](0xcc)[_0x2b9f('0x21')]();});}};}function handleEntityNotFound(_0x25adaa,_0x5814a4){return function(_0x3e09f1){if(!_0x3e09f1){_0x25adaa[_0x2b9f('0x1f')](0x194);}return _0x3e09f1;};}function handleError(_0x5f6c87,_0x535e9d){_0x535e9d=_0x535e9d||0x1f4;return function(_0x1aad66){logger[_0x2b9f('0x31')](_0x1aad66[_0x2b9f('0x32')]);if(_0x1aad66[_0x2b9f('0x33')]){delete _0x1aad66['name'];}_0x5f6c87[_0x2b9f('0x20')](_0x535e9d)[_0x2b9f('0x34')](_0x1aad66);};}exports[_0x2b9f('0x35')]=function(_0x45097e,_0x4c1e28){var _0x1b16c4={},_0x1b1f90={},_0x1b5835={'count':0x0,'rows':[]};var _0x52a5ce=_[_0x2b9f('0x36')](db[_0x2b9f('0x37')]['rawAttributes'],function(_0x5a3eea){return{'name':_0x5a3eea[_0x2b9f('0x38')],'type':_0x5a3eea[_0x2b9f('0x39')][_0x2b9f('0x3a')]};});_0x1b1f90[_0x2b9f('0x3b')]=_['map'](_0x52a5ce,'name');_0x1b1f90[_0x2b9f('0x3c')]=_[_0x2b9f('0x3d')](_0x45097e[_0x2b9f('0x3c')]);_0x1b1f90[_0x2b9f('0x3e')]=_[_0x2b9f('0x3f')](_0x1b1f90[_0x2b9f('0x3b')],_0x1b1f90[_0x2b9f('0x3c')]);_0x1b16c4['attributes']=_[_0x2b9f('0x3f')](_0x1b1f90[_0x2b9f('0x3b')],qs['fields'](_0x45097e[_0x2b9f('0x3c')][_0x2b9f('0x40')]));_0x1b16c4['attributes']=_0x1b16c4[_0x2b9f('0x41')]['length']?_0x1b16c4['attributes']:_0x1b1f90[_0x2b9f('0x3b')];if(!_0x45097e['query'][_0x2b9f('0x42')]('nolimit')){_0x1b16c4['limit']=qs[_0x2b9f('0x24')](_0x45097e['query'][_0x2b9f('0x24')]);_0x1b16c4[_0x2b9f('0x22')]=qs['offset'](_0x45097e[_0x2b9f('0x3c')]['offset']);}_0x1b16c4[_0x2b9f('0x43')]=qs['sort'](_0x45097e[_0x2b9f('0x3c')][_0x2b9f('0x44')]);_0x1b16c4['where']=qs[_0x2b9f('0x3e')](_[_0x2b9f('0x45')](_0x45097e[_0x2b9f('0x3c')],_0x1b1f90[_0x2b9f('0x3e')]),_0x52a5ce);if(_0x45097e[_0x2b9f('0x3c')][_0x2b9f('0x46')]){_0x1b16c4[_0x2b9f('0x47')]=_[_0x2b9f('0x48')](_0x1b16c4[_0x2b9f('0x47')],{'$or':_[_0x2b9f('0x36')](_0x52a5ce,function(_0x29a627){if(_0x29a627[_0x2b9f('0x39')]!=='VIRTUAL'){var _0x5a4bc2={};_0x5a4bc2[_0x29a627[_0x2b9f('0x33')]]={'$like':'%'+_0x45097e[_0x2b9f('0x3c')][_0x2b9f('0x46')]+'%'};return _0x5a4bc2;}})});}_0x1b16c4=_[_0x2b9f('0x48')]({},_0x1b16c4,_0x45097e[_0x2b9f('0x49')]);var _0x596d09={'where':_0x1b16c4['where']};return db['SquareProject'][_0x2b9f('0x25')](_0x596d09)[_0x2b9f('0x2c')](function(_0x1d59eb){_0x1b5835['count']=_0x1d59eb;if(_0x45097e[_0x2b9f('0x3c')][_0x2b9f('0x4a')]){_0x1b16c4[_0x2b9f('0x4b')]=[{'all':!![]}];}return db['SquareProject'][_0x2b9f('0x4c')](_0x1b16c4);})[_0x2b9f('0x2c')](function(_0x321c54){_0x1b5835[_0x2b9f('0x4d')]=_0x321c54;return _0x1b5835;})[_0x2b9f('0x2c')](respondWithFilteredResult(_0x4c1e28,_0x1b16c4))['catch'](handleError(_0x4c1e28,null));};exports[_0x2b9f('0x4e')]=function(_0x5c7010,_0x4a16d5){var _0x512a68={'raw':![],'where':{'id':_0x5c7010[_0x2b9f('0x4f')]['id']}},_0x36fa91={};_0x36fa91[_0x2b9f('0x3b')]=_[_0x2b9f('0x3d')](db[_0x2b9f('0x37')]['rawAttributes']);_0x36fa91[_0x2b9f('0x3c')]=_[_0x2b9f('0x3d')](_0x5c7010[_0x2b9f('0x3c')]);_0x36fa91['filters']=_[_0x2b9f('0x3f')](_0x36fa91[_0x2b9f('0x3b')],_0x36fa91[_0x2b9f('0x3c')]);_0x512a68[_0x2b9f('0x41')]=_[_0x2b9f('0x3f')](_0x36fa91[_0x2b9f('0x3b')],qs[_0x2b9f('0x40')](_0x5c7010[_0x2b9f('0x3c')][_0x2b9f('0x40')]));_0x512a68[_0x2b9f('0x41')]=_0x512a68['attributes'][_0x2b9f('0x50')]?_0x512a68[_0x2b9f('0x41')]:_0x36fa91[_0x2b9f('0x3b')];if(_0x5c7010[_0x2b9f('0x3c')][_0x2b9f('0x4a')]){_0x512a68['include']=[{'all':!![]}];}_0x512a68=_['merge']({},_0x512a68,_0x5c7010['options']);return db[_0x2b9f('0x37')][_0x2b9f('0x51')](_0x512a68)[_0x2b9f('0x2c')](handleEntityNotFound(_0x4a16d5,null))['then'](respondWithResult(_0x4a16d5,null))[_0x2b9f('0x52')](handleError(_0x4a16d5,null));};exports[_0x2b9f('0x53')]=function(_0x59f810,_0x52fed9){return db[_0x2b9f('0x37')][_0x2b9f('0x53')](_0x59f810['body'],{})[_0x2b9f('0x2c')](function(_0x1e1fdd){var _0xc89fe5=_0x59f810[_0x2b9f('0x54')]['get']({'plain':!![]});if(!_0xc89fe5)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xc89fe5['role']===_0x2b9f('0x54')){var _0x4b9862=_0x1e1fdd[_0x2b9f('0x2e')]({'plain':!![]});var _0x5db6d0=_0x2b9f('0x2f');return db[_0x2b9f('0x55')][_0x2b9f('0x51')]({'where':{'name':_0x5db6d0,'userProfileId':_0xc89fe5[_0x2b9f('0x56')]},'raw':!![]})['then'](function(_0x102b6f){if(_0x102b6f&&_0x102b6f[_0x2b9f('0x57')]===0x0){return db[_0x2b9f('0x30')][_0x2b9f('0x53')]({'name':_0x4b9862[_0x2b9f('0x33')],'resourceId':_0x4b9862['id'],'type':_0x102b6f[_0x2b9f('0x33')],'sectionId':_0x102b6f['id']},{})[_0x2b9f('0x2c')](function(){return _0x1e1fdd;});}else{return _0x1e1fdd;}})[_0x2b9f('0x52')](function(_0x4c6a3b){logger[_0x2b9f('0x31')](_0x2b9f('0x58'),_0x4c6a3b);throw _0x4c6a3b;});}return _0x1e1fdd;})[_0x2b9f('0x2c')](respondWithResult(_0x52fed9,0xc9))[_0x2b9f('0x52')](handleError(_0x52fed9,null));};exports[_0x2b9f('0x2b')]=function(_0x50e31b,_0x3f8904){if(_0x50e31b['body']['id']){delete _0x50e31b[_0x2b9f('0x59')]['id'];}return db[_0x2b9f('0x37')][_0x2b9f('0x51')]({'where':{'id':_0x50e31b[_0x2b9f('0x4f')]['id']}})[_0x2b9f('0x2c')](handleEntityNotFound(_0x3f8904,null))[_0x2b9f('0x2c')](saveUpdates(_0x50e31b['body'],null))['then'](respondWithResult(_0x3f8904,null))[_0x2b9f('0x52')](handleError(_0x3f8904,null));};exports[_0x2b9f('0x2d')]=function(_0x240642,_0x139d19){return db[_0x2b9f('0x37')][_0x2b9f('0x51')]({'where':{'id':_0x240642['params']['id']}})[_0x2b9f('0x2c')](handleEntityNotFound(_0x139d19,null))[_0x2b9f('0x2c')](removeEntity(_0x139d19,null))['catch'](handleError(_0x139d19,null));};exports[_0x2b9f('0x5a')]=function(_0x45e6ee,_0x534cd7,_0x1fccc4){return db[_0x2b9f('0x37')][_0x2b9f('0x51')]({'where':{'id':_0x45e6ee[_0x2b9f('0x4f')]['id']}})[_0x2b9f('0x2c')](handleEntityNotFound(_0x534cd7,null))[_0x2b9f('0x2c')](function(_0x33b6b5){if(_0x33b6b5){return _0x33b6b5['addUsers'](_0x45e6ee['body'][_0x2b9f('0x5b')],_[_0x2b9f('0x5c')](_0x45e6ee[_0x2b9f('0x59')],[_0x2b9f('0x5b'),'id'])||{});}})[_0x2b9f('0x2c')](respondWithResult(_0x534cd7,null))['catch'](handleError(_0x534cd7,null));};exports[_0x2b9f('0x5d')]=function(_0x4a523e,_0x1921b1,_0x4a8848){return db[_0x2b9f('0x37')]['find']({'where':{'id':_0x4a523e[_0x2b9f('0x4f')]['id']}})['then'](handleEntityNotFound(_0x1921b1,null))['then'](function(_0x4ad1a5){if(_0x4ad1a5){return _0x4ad1a5[_0x2b9f('0x5d')](_0x4a523e[_0x2b9f('0x3c')][_0x2b9f('0x5b')])[_0x2b9f('0x2c')](function(){if(_[_0x2b9f('0x5e')](_0x4a523e[_0x2b9f('0x3c')][_0x2b9f('0x5b')])){for(var _0x2b1d71=0x0;_0x2b1d71<_0x4a523e[_0x2b9f('0x3c')][_0x2b9f('0x5b')][_0x2b9f('0x50')];_0x2b1d71+=0x1){socket[_0x2b9f('0x5f')](_0x2b9f('0x60'),{'UserId':Number(_0x4a523e[_0x2b9f('0x3c')]['ids'][_0x2b1d71]),'SquareProjectId':Number(_0x4a523e[_0x2b9f('0x4f')]['id'])});}}else{socket[_0x2b9f('0x5f')]('userSquareProject:remove',{'UserId':Number(_0x4a523e[_0x2b9f('0x3c')][_0x2b9f('0x5b')]),'SquareProjectId':Number(_0x4a523e[_0x2b9f('0x4f')]['id'])});}});}})[_0x2b9f('0x2c')](respondWithStatusCode(_0x1921b1,null))['catch'](handleError(_0x1921b1,null));};exports[_0x2b9f('0x61')]=function(_0x38ab33,_0x246f1b,_0x39eedb){var _0x455fa3={};var _0x517323={};var _0x2f7308;var _0x2eb291;return db[_0x2b9f('0x37')]['findOne']({'where':{'id':_0x38ab33[_0x2b9f('0x4f')]['id']}})[_0x2b9f('0x2c')](handleEntityNotFound(_0x246f1b,null))['then'](function(_0x3c8d09){if(_0x3c8d09){_0x2f7308=_0x3c8d09;_0x517323[_0x2b9f('0x3b')]=_[_0x2b9f('0x3d')](db[_0x2b9f('0x62')][_0x2b9f('0x63')]);_0x517323[_0x2b9f('0x3c')]=_[_0x2b9f('0x3d')](_0x38ab33[_0x2b9f('0x3c')]);_0x517323[_0x2b9f('0x3e')]=_[_0x2b9f('0x3f')](_0x517323[_0x2b9f('0x3b')],_0x517323['query']);_0x455fa3[_0x2b9f('0x41')]=_[_0x2b9f('0x3f')](_0x517323[_0x2b9f('0x3b')],qs[_0x2b9f('0x40')](_0x38ab33[_0x2b9f('0x3c')][_0x2b9f('0x40')]));_0x455fa3[_0x2b9f('0x41')]=_0x455fa3[_0x2b9f('0x41')][_0x2b9f('0x50')]?_0x455fa3[_0x2b9f('0x41')]:_0x517323['model'];_0x455fa3[_0x2b9f('0x43')]=qs['sort'](_0x38ab33[_0x2b9f('0x3c')][_0x2b9f('0x44')]);_0x455fa3['where']=qs['filters'](_[_0x2b9f('0x45')](_0x38ab33['query'],_0x517323['filters']));if(_0x38ab33[_0x2b9f('0x3c')][_0x2b9f('0x46')]){_0x455fa3[_0x2b9f('0x47')]=_[_0x2b9f('0x48')](_0x455fa3[_0x2b9f('0x47')],{'$or':_[_0x2b9f('0x36')](_0x455fa3[_0x2b9f('0x41')],function(_0x2436c5){var _0x5d74d2={};_0x5d74d2[_0x2436c5]={'$like':'%'+_0x38ab33[_0x2b9f('0x3c')][_0x2b9f('0x46')]+'%'};return _0x5d74d2;})});}_0x455fa3=_[_0x2b9f('0x48')]({},_0x455fa3,_0x38ab33[_0x2b9f('0x49')]);return _0x2f7308[_0x2b9f('0x61')](_0x455fa3);}})[_0x2b9f('0x2c')](function(_0x4c1d27){if(_0x4c1d27){_0x2eb291=_0x4c1d27[_0x2b9f('0x50')];if(!_0x38ab33[_0x2b9f('0x3c')][_0x2b9f('0x42')]('nolimit')){_0x455fa3[_0x2b9f('0x24')]=qs['limit'](_0x38ab33['query'][_0x2b9f('0x24')]);_0x455fa3[_0x2b9f('0x22')]=qs[_0x2b9f('0x22')](_0x38ab33[_0x2b9f('0x3c')][_0x2b9f('0x22')]);}return _0x2f7308['getUsers'](_0x455fa3);}})[_0x2b9f('0x2c')](function(_0x330e6b){if(_0x330e6b){return _0x330e6b?{'count':_0x2eb291,'rows':_0x330e6b}:null;}})['then'](respondWithResult(_0x246f1b,null))[_0x2b9f('0x52')](handleError(_0x246f1b,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index a2e46b4..3c55b6b 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 _0x39f9=['exports','events','../../mysqldb','SquareProject','setMaxListeners','save','emit','hook'];(function(_0x225a23,_0x199b74){var _0x4632b3=function(_0x465148){while(--_0x465148){_0x225a23['push'](_0x225a23['shift']());}};_0x4632b3(++_0x199b74);}(_0x39f9,0x161));var _0x939f=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x39f9[_0x2641f9];return _0x585741;};'use strict';var EventEmitter=require(_0x939f('0x0'));var SquareProject=require(_0x939f('0x1'))['db'][_0x939f('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x939f('0x3')](0x0);var events={'afterCreate':_0x939f('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x4dc6c0){return function(_0x5139e4,_0x458979,_0x3e8e40){SquareProjectEvents[_0x939f('0x5')](_0x4dc6c0+':'+_0x5139e4['id'],_0x5139e4);SquareProjectEvents[_0x939f('0x5')](_0x4dc6c0,_0x5139e4);_0x3e8e40(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SquareProject[_0x939f('0x6')](e,emitEvent(event));}}module[_0x939f('0x7')]=SquareProjectEvents; \ No newline at end of file +var _0xe4dd=['exports','../../mysqldb','SquareProject','setMaxListeners','save','update','emit','hook'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xe4dd,0x179));var _0xde4d=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xe4dd[_0x6131cd];return _0x47e916;};'use strict';var EventEmitter=require('events');var SquareProject=require(_0xde4d('0x0'))['db'][_0xde4d('0x1')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0xde4d('0x2')](0x0);var events={'afterCreate':_0xde4d('0x3'),'afterUpdate':_0xde4d('0x4'),'afterDestroy':'remove'};function emitEvent(_0x48651b){return function(_0x3b2330,_0x32f555,_0x57248c){SquareProjectEvents[_0xde4d('0x5')](_0x48651b+':'+_0x3b2330['id'],_0x3b2330);SquareProjectEvents[_0xde4d('0x5')](_0x48651b,_0x3b2330);_0x57248c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SquareProject[_0xde4d('0x6')](e,emitEvent(event));}}module[_0xde4d('0x7')]=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index 676eb12..bbd2542 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 _0x4bfb=['production','format','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports','define','square_projects','preproduction','changed'];(function(_0x50a9ef,_0x412c64){var _0xba44d3=function(_0x577ac0){while(--_0x577ac0){_0x50a9ef['push'](_0x50a9ef['shift']());}};_0xba44d3(++_0x412c64);}(_0x4bfb,0x1b3));var _0xb4bf=function(_0x44c742,_0x5d69a4){_0x44c742=_0x44c742-0x0;var _0x40fcf0=_0x4bfb[_0x44c742];return _0x40fcf0;};'use strict';var _=require('lodash');var util=require(_0xb4bf('0x0'));var logger=require(_0xb4bf('0x1'))(_0xb4bf('0x2'));var moment=require(_0xb4bf('0x3'));var BPromise=require(_0xb4bf('0x4'));var rp=require(_0xb4bf('0x5'));var fs=require('fs');var path=require(_0xb4bf('0x6'));var rimraf=require('rimraf');var config=require(_0xb4bf('0x7'));var attributes=require('./squareProject.attributes');module[_0xb4bf('0x8')]=function(_0x4435df,_0x475d91){return _0x4435df[_0xb4bf('0x9')]('SquareProject',attributes,{'tableName':_0xb4bf('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3a14dc,_0x1302e5,_0x452322){if(_0x3a14dc['changed'](_0xb4bf('0xb'))){_0x3a14dc['savedAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}if(_0x3a14dc[_0xb4bf('0xc')](_0xb4bf('0xd'))){_0x3a14dc['publishedAt']=moment()[_0xb4bf('0xe')](_0xb4bf('0xf'));}_0x452322(null,_0x3a14dc);}}});}; \ No newline at end of file +var _0x329d=['bluebird','request-promise','path','rimraf','./squareProject.attributes','exports','define','SquareProject','square_projects','changed','savedAt','format','publishedAt','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','api','moment'];(function(_0x16196b,_0x22dea7){var _0x1628eb=function(_0x5ed1b1){while(--_0x5ed1b1){_0x16196b['push'](_0x16196b['shift']());}};_0x1628eb(++_0x22dea7);}(_0x329d,0x188));var _0xd329=function(_0x3f9584,_0x5ab12c){_0x3f9584=_0x3f9584-0x0;var _0x9d54c=_0x329d[_0x3f9584];return _0x9d54c;};'use strict';var _=require('lodash');var util=require(_0xd329('0x0'));var logger=require(_0xd329('0x1'))(_0xd329('0x2'));var moment=require(_0xd329('0x3'));var BPromise=require(_0xd329('0x4'));var rp=require(_0xd329('0x5'));var fs=require('fs');var path=require(_0xd329('0x6'));var rimraf=require(_0xd329('0x7'));var config=require('../../config/environment');var attributes=require(_0xd329('0x8'));module[_0xd329('0x9')]=function(_0x15fb6f,_0x1854e2){return _0x15fb6f[_0xd329('0xa')](_0xd329('0xb'),attributes,{'tableName':_0xd329('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x59351a,_0x5678ce,_0x3a9cb5){if(_0x59351a[_0xd329('0xd')]('preproduction')){_0x59351a[_0xd329('0xe')]=moment()[_0xd329('0xf')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x59351a['changed']('production')){_0x59351a[_0xd329('0x10')]=moment()[_0xd329('0xf')](_0xd329('0x11'));}_0x3a9cb5(null,_0x59351a);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index 1d40a32..d596fe2 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 _0x6c7a=['stringify','error','code','message','result','catch','ShowSquareProject','SquareProject','find','options','raw','where','attributes','include','map','model','then','lodash','util','moment','ioredis','../../config/utils','../../config/environment','client','http','redis','defaults','socket.io-emitter','./squareProject.socket','register','info','SquareProject,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x13769f,_0x7bba5c){var _0x79705e=function(_0x409083){while(--_0x409083){_0x13769f['push'](_0x13769f['shift']());}};_0x79705e(++_0x7bba5c);}(_0x6c7a,0xdd));var _0xa6c7=function(_0x314648,_0x2ea390){_0x314648=_0x314648-0x0;var _0x1dac7d=_0x6c7a[_0x314648];return _0x1dac7d;};'use strict';var _=require(_0xa6c7('0x0'));var util=require(_0xa6c7('0x1'));var moment=require(_0xa6c7('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa6c7('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xa6c7('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xa6c7('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xa6c7('0x6')][_0xa6c7('0x7')]({'port':0x232a});config[_0xa6c7('0x8')]=_[_0xa6c7('0x9')](config[_0xa6c7('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0xa6c7('0xa'))(new Redis(config['redis']));require(_0xa6c7('0xb'))[_0xa6c7('0xc')](socket);function respondWithRpcPromise(_0x13639d,_0x4d63f6,_0x3c2788){return new BPromise(function(_0x31f672,_0x16f44f){return client['request'](_0x13639d,_0x3c2788)['then'](function(_0x193262){logger[_0xa6c7('0xd')](_0xa6c7('0xe'),_0x4d63f6,_0xa6c7('0xf'));logger[_0xa6c7('0x10')]('SquareProject,\x20%s,\x20%s,\x20%s',_0x4d63f6,_0xa6c7('0xf'),JSON[_0xa6c7('0x11')](_0x193262));if(_0x193262['error']){if(_0x193262[_0xa6c7('0x12')][_0xa6c7('0x13')]===0x1f4){logger[_0xa6c7('0x12')]('SquareProject,\x20%s,\x20%s',_0x4d63f6,_0x193262[_0xa6c7('0x12')][_0xa6c7('0x14')]);return _0x16f44f(_0x193262[_0xa6c7('0x12')][_0xa6c7('0x14')]);}logger[_0xa6c7('0x12')](_0xa6c7('0xe'),_0x4d63f6,_0x193262['error']['message']);return _0x31f672(_0x193262['error'][_0xa6c7('0x14')]);}else{logger['info'](_0xa6c7('0xe'),_0x4d63f6,_0xa6c7('0xf'));_0x31f672(_0x193262[_0xa6c7('0x15')][_0xa6c7('0x14')]);}})[_0xa6c7('0x16')](function(_0xe4a381){logger[_0xa6c7('0x12')](_0xa6c7('0xe'),_0x4d63f6,_0xe4a381);_0x16f44f(_0xe4a381);});});}exports[_0xa6c7('0x17')]=function(_0x25a68b){var _0x5f3e30=this;return new Promise(function(_0x5386cb,_0x1b7042){return db[_0xa6c7('0x18')][_0xa6c7('0x19')]({'raw':_0x25a68b['options']?_0x25a68b[_0xa6c7('0x1a')][_0xa6c7('0x1b')]===undefined?!![]:![]:!![],'where':_0x25a68b[_0xa6c7('0x1a')]?_0x25a68b['options'][_0xa6c7('0x1c')]||null:null,'attributes':_0x25a68b['options']?_0x25a68b[_0xa6c7('0x1a')][_0xa6c7('0x1d')]||null:null,'include':_0x25a68b[_0xa6c7('0x1a')]?_0x25a68b[_0xa6c7('0x1a')][_0xa6c7('0x1e')]?_[_0xa6c7('0x1f')](_0x25a68b[_0xa6c7('0x1a')]['include'],function(_0x334e1c){return{'model':db[_0x334e1c[_0xa6c7('0x20')]],'as':_0x334e1c['as'],'attributes':_0x334e1c[_0xa6c7('0x1d')],'include':_0x334e1c[_0xa6c7('0x1e')]?_[_0xa6c7('0x1f')](_0x334e1c[_0xa6c7('0x1e')],function(_0x380db5){return{'model':db[_0x380db5['model']],'as':_0x380db5['as'],'attributes':_0x380db5[_0xa6c7('0x1d')],'include':_0x380db5[_0xa6c7('0x1e')]?_[_0xa6c7('0x1f')](_0x380db5['include'],function(_0x511e5f){return{'model':db[_0x511e5f[_0xa6c7('0x20')]],'as':_0x511e5f['as'],'attributes':_0x511e5f[_0xa6c7('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xa6c7('0x21')](function(_0x4803f1){logger[_0xa6c7('0xd')]('ShowSquareProject',_0x25a68b);logger[_0xa6c7('0x10')]('ShowSquareProject',_0x25a68b,JSON[_0xa6c7('0x11')](_0x4803f1));_0x5386cb(_0x4803f1);})[_0xa6c7('0x16')](function(_0x9bec60){logger[_0xa6c7('0x12')](_0xa6c7('0x17'),_0x9bec60[_0xa6c7('0x14')],_0x25a68b);_0x1b7042(_0x5f3e30[_0xa6c7('0x12')](0x1f4,_0x9bec60[_0xa6c7('0x14')]));});});}; \ No newline at end of file +var _0x599e=['include','model','map','info','lodash','util','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','then','SquareProject,\x20%s,\x20%s','request\x20sent','debug','SquareProject,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','ShowSquareProject','SquareProject','find','options','raw','attributes'];(function(_0x5ea458,_0x1a6ea9){var _0x540208=function(_0x2cdc78){while(--_0x2cdc78){_0x5ea458['push'](_0x5ea458['shift']());}};_0x540208(++_0x1a6ea9);}(_0x599e,0x136));var _0xe599=function(_0x1c0537,_0x5024f4){_0x1c0537=_0x1c0537-0x0;var _0x3903ca=_0x599e[_0x1c0537];return _0x3903ca;};'use strict';var _=require(_0xe599('0x0'));var util=require(_0xe599('0x1'));var moment=require('moment');var BPromise=require(_0xe599('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe599('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xe599('0x4'));var logger=require(_0xe599('0x5'))(_0xe599('0x6'));var config=require(_0xe599('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xe599('0x8')]['http']({'port':0x232a});config[_0xe599('0x9')]=_[_0xe599('0xa')](config[_0xe599('0x9')],{'host':_0xe599('0xb'),'port':0x18eb});var socket=require(_0xe599('0xc'))(new Redis(config[_0xe599('0x9')]));require('./squareProject.socket')['register'](socket);function respondWithRpcPromise(_0x2fa142,_0xb4ed85,_0x151c32){return new BPromise(function(_0x13417c,_0x3fa0d3){return client['request'](_0x2fa142,_0x151c32)[_0xe599('0xd')](function(_0x225c00){logger['info'](_0xe599('0xe'),_0xb4ed85,_0xe599('0xf'));logger[_0xe599('0x10')](_0xe599('0x11'),_0xb4ed85,_0xe599('0xf'),JSON[_0xe599('0x12')](_0x225c00));if(_0x225c00['error']){if(_0x225c00['error'][_0xe599('0x13')]===0x1f4){logger[_0xe599('0x14')](_0xe599('0xe'),_0xb4ed85,_0x225c00[_0xe599('0x14')][_0xe599('0x15')]);return _0x3fa0d3(_0x225c00[_0xe599('0x14')][_0xe599('0x15')]);}logger['error'](_0xe599('0xe'),_0xb4ed85,_0x225c00[_0xe599('0x14')][_0xe599('0x15')]);return _0x13417c(_0x225c00[_0xe599('0x14')][_0xe599('0x15')]);}else{logger['info'](_0xe599('0xe'),_0xb4ed85,_0xe599('0xf'));_0x13417c(_0x225c00[_0xe599('0x16')][_0xe599('0x15')]);}})[_0xe599('0x17')](function(_0x5d745f){logger[_0xe599('0x14')](_0xe599('0xe'),_0xb4ed85,_0x5d745f);_0x3fa0d3(_0x5d745f);});});}exports[_0xe599('0x18')]=function(_0x25875f){var _0x1865f4=this;return new Promise(function(_0x1f8e60,_0x38073f){return db[_0xe599('0x19')][_0xe599('0x1a')]({'raw':_0x25875f['options']?_0x25875f[_0xe599('0x1b')][_0xe599('0x1c')]===undefined?!![]:![]:!![],'where':_0x25875f[_0xe599('0x1b')]?_0x25875f['options']['where']||null:null,'attributes':_0x25875f[_0xe599('0x1b')]?_0x25875f[_0xe599('0x1b')][_0xe599('0x1d')]||null:null,'include':_0x25875f[_0xe599('0x1b')]?_0x25875f['options'][_0xe599('0x1e')]?_['map'](_0x25875f[_0xe599('0x1b')][_0xe599('0x1e')],function(_0x56b616){return{'model':db[_0x56b616[_0xe599('0x1f')]],'as':_0x56b616['as'],'attributes':_0x56b616['attributes'],'include':_0x56b616[_0xe599('0x1e')]?_[_0xe599('0x20')](_0x56b616[_0xe599('0x1e')],function(_0x733ae2){return{'model':db[_0x733ae2[_0xe599('0x1f')]],'as':_0x733ae2['as'],'attributes':_0x733ae2[_0xe599('0x1d')],'include':_0x733ae2[_0xe599('0x1e')]?_[_0xe599('0x20')](_0x733ae2['include'],function(_0xbbf677){return{'model':db[_0xbbf677['model']],'as':_0xbbf677['as'],'attributes':_0xbbf677[_0xe599('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xe599('0xd')](function(_0x16b411){logger[_0xe599('0x21')](_0xe599('0x18'),_0x25875f);logger[_0xe599('0x10')]('ShowSquareProject',_0x25875f,JSON[_0xe599('0x12')](_0x16b411));_0x1f8e60(_0x16b411);})[_0xe599('0x17')](function(_0xe8db64){logger[_0xe599('0x14')]('ShowSquareProject',_0xe8db64[_0xe599('0x15')],_0x25875f);_0x38073f(_0x1865f4[_0xe599('0x14')](0x1f4,_0xe8db64[_0xe599('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index 7f947a2..f59c6a7 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 _0xebbf=['removeListener','register','length','squareProject:','remove'];(function(_0x2b18d8,_0x21778e){var _0x2bcce2=function(_0xc14e4b){while(--_0xc14e4b){_0x2b18d8['push'](_0x2b18d8['shift']());}};_0x2bcce2(++_0x21778e);}(_0xebbf,0x1b2));var _0xfebb=function(_0x1f1305,_0x2435f5){_0x1f1305=_0x1f1305-0x0;var _0x571a9d=_0xebbf[_0x1f1305];return _0x571a9d;};'use strict';var SquareProjectEvents=require('./squareProject.events');var events=['save',_0xfebb('0x0'),'update'];function createListener(_0x5e7aa7,_0x2920e9){return function(_0xdaae2b){_0x2920e9['emit'](_0x5e7aa7,_0xdaae2b);};}function removeListener(_0x2cc131,_0xc8a7ea){return function(){SquareProjectEvents[_0xfebb('0x1')](_0x2cc131,_0xc8a7ea);};}exports[_0xfebb('0x2')]=function(_0x298c71){for(var _0x481b7a=0x0,_0x4982b8=events[_0xfebb('0x3')];_0x481b7a<_0x4982b8;_0x481b7a++){var _0x691c8=events[_0x481b7a];var _0x5329c8=createListener(_0xfebb('0x4')+_0x691c8,_0x298c71);SquareProjectEvents['on'](_0x691c8,_0x5329c8);}}; \ No newline at end of file +var _0xc06e=['./squareProject.events','save','emit','removeListener','register','length','squareProject:'];(function(_0x25d2fb,_0x18a774){var _0x1ded53=function(_0x4c0715){while(--_0x4c0715){_0x25d2fb['push'](_0x25d2fb['shift']());}};_0x1ded53(++_0x18a774);}(_0xc06e,0x7e));var _0xec06=function(_0x27d8bc,_0x19e010){_0x27d8bc=_0x27d8bc-0x0;var _0x4b04cb=_0xc06e[_0x27d8bc];return _0x4b04cb;};'use strict';var SquareProjectEvents=require(_0xec06('0x0'));var events=[_0xec06('0x1'),'remove','update'];function createListener(_0x3dad92,_0x278565){return function(_0x4463b5){_0x278565[_0xec06('0x2')](_0x3dad92,_0x4463b5);};}function removeListener(_0x25e1a2,_0x406519){return function(){SquareProjectEvents[_0xec06('0x3')](_0x25e1a2,_0x406519);};}exports[_0xec06('0x4')]=function(_0x2450f6){for(var _0x11f374=0x0,_0x4e5e0d=events[_0xec06('0x5')];_0x11f374<_0x4e5e0d;_0x11f374++){var _0x57381e=events[_0x11f374];var _0x20b3f6=createListener(_0xec06('0x6')+_0x57381e,_0x2450f6);SquareProjectEvents['on'](_0x57381e,_0x20b3f6);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index 67b0cf2..e9d6d20 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 _0xf494=['../../config/environment','./squareRecording.controller','get','isAuthenticated','index','show','/:id/download','download','post','create','/:id','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x416219,_0x287951){var _0x1398db=function(_0x38b60a){while(--_0x38b60a){_0x416219['push'](_0x416219['shift']());}};_0x1398db(++_0x287951);}(_0xf494,0x1c6));var _0x4f49=function(_0x2421e1,_0x2ef188){_0x2421e1=_0x2421e1-0x0;var _0x4a9018=_0xf494[_0x2421e1];return _0x4a9018;};'use strict';var multer=require(_0x4f49('0x0'));var util=require(_0x4f49('0x1'));var path=require(_0x4f49('0x2'));var timeout=require('connect-timeout');var express=require(_0x4f49('0x3'));var router=express[_0x4f49('0x4')]();var fs_extra=require(_0x4f49('0x5'));var auth=require(_0x4f49('0x6'));var interaction=require(_0x4f49('0x7'));var config=require(_0x4f49('0x8'));var controller=require(_0x4f49('0x9'));router[_0x4f49('0xa')]('/',auth[_0x4f49('0xb')](),controller[_0x4f49('0xc')]);router[_0x4f49('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x4f49('0xd')]);router[_0x4f49('0xa')](_0x4f49('0xe'),auth[_0x4f49('0xb')](),controller[_0x4f49('0xf')]);router[_0x4f49('0x10')]('/',auth[_0x4f49('0xb')](),controller[_0x4f49('0x11')]);router['put'](_0x4f49('0x12'),auth[_0x4f49('0xb')](),controller['update']);router[_0x4f49('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x4f49('0x14')]);module[_0x4f49('0x15')]=router; \ No newline at end of file +var _0x4975=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','get','index','/:id','isAuthenticated','show','/:id/download','download','post','create','put','update','destroy','exports','multer','path','connect-timeout','express'];(function(_0x4b5395,_0x40b67c){var _0x13b27c=function(_0x11ed77){while(--_0x11ed77){_0x4b5395['push'](_0x4b5395['shift']());}};_0x13b27c(++_0x40b67c);}(_0x4975,0x86));var _0x5497=function(_0x43ef7,_0x2a6900){_0x43ef7=_0x43ef7-0x0;var _0x73e0a9=_0x4975[_0x43ef7];return _0x73e0a9;};'use strict';var multer=require(_0x5497('0x0'));var util=require('util');var path=require(_0x5497('0x1'));var timeout=require(_0x5497('0x2'));var express=require(_0x5497('0x3'));var router=express[_0x5497('0x4')]();var fs_extra=require(_0x5497('0x5'));var auth=require(_0x5497('0x6'));var interaction=require(_0x5497('0x7'));var config=require(_0x5497('0x8'));var controller=require(_0x5497('0x9'));router[_0x5497('0xa')]('/',auth['isAuthenticated'](),controller[_0x5497('0xb')]);router['get'](_0x5497('0xc'),auth[_0x5497('0xd')](),controller[_0x5497('0xe')]);router['get'](_0x5497('0xf'),auth['isAuthenticated'](),controller[_0x5497('0x10')]);router[_0x5497('0x11')]('/',auth[_0x5497('0xd')](),controller[_0x5497('0x12')]);router[_0x5497('0x13')](_0x5497('0xc'),auth[_0x5497('0xd')](),controller[_0x5497('0x14')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x5497('0x15')]);module[_0x5497('0x16')]=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index 73bb0ac..93f5fd7 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 _0xa630=['substring','sequelize','exports','STRING','VIRTUAL','getDataValue','savePath'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa630,0xbe));var _0x0a63=function(_0x4d0ed7,_0x53cc08){_0x4d0ed7=_0x4d0ed7-0x0;var _0x42871a=_0xa630[_0x4d0ed7];return _0x42871a;};'use strict';var Sequelize=require(_0x0a63('0x0'));module[_0x0a63('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x0a63('0x2')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x0a63('0x2')]},'priority':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x0a63('0x2')]},'dnid':{'type':Sequelize[_0x0a63('0x2')]},'projectName':{'type':Sequelize[_0x0a63('0x2')]},'saveName':{'type':Sequelize[_0x0a63('0x2')]},'filename':{'type':Sequelize[_0x0a63('0x2')]},'savePath':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0x0a63('0x3')],'get':function(){var _0x3d5f0b='';var _0xc2dcd7=this[_0x0a63('0x4')](_0x0a63('0x5'));if(_0xc2dcd7){_0x3d5f0b=_0xc2dcd7[_0x0a63('0x6')](_0xc2dcd7['lastIndexOf']('.'));}return _0x3d5f0b;}}}; \ No newline at end of file +var _0x032e=['VIRTUAL','getDataValue','savePath','substring','lastIndexOf','sequelize','STRING'];(function(_0x22ab44,_0x692fa7){var _0x1d17cd=function(_0x732d00){while(--_0x732d00){_0x22ab44['push'](_0x22ab44['shift']());}};_0x1d17cd(++_0x692fa7);}(_0x032e,0x124));var _0xe032=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0x032e[_0x134c2e];return _0x2825db;};'use strict';var Sequelize=require(_0xe032('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xe032('0x1')]},'callerid':{'type':Sequelize[_0xe032('0x1')]},'calleridname':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0xe032('0x1')]},'priority':{'type':Sequelize[_0xe032('0x1')]},'accountcode':{'type':Sequelize[_0xe032('0x1')]},'dnid':{'type':Sequelize[_0xe032('0x1')]},'projectName':{'type':Sequelize[_0xe032('0x1')]},'saveName':{'type':Sequelize[_0xe032('0x1')]},'filename':{'type':Sequelize[_0xe032('0x1')]},'savePath':{'type':Sequelize[_0xe032('0x1')]},'format':{'type':Sequelize[_0xe032('0x2')],'get':function(){var _0x1576c8='';var _0x3289b0=this[_0xe032('0x3')](_0xe032('0x4'));if(_0x3289b0){_0x1576c8=_0x3289b0[_0xe032('0x5')](_0x3289b0[_0xe032('0x6')]('.'));}return _0x1576c8;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index a459f0e..6a7ddd0 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 _0x7c47=['body','find','download','uniqueid','savePath','filename','%s.cypher','existsSync','secrets','recording','Sequelize','ValidationError','SquareRecording\x20not\x20found','unlink','message','isNil','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','eml-format','rimraf','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','reject','update','then','destroy','stack','name','send','index','map','SquareRecording','rawAttributes','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','merge','VIRTUAL','filter','includeAll','findAll','rows','catch','params','options','create'];(function(_0x5ec1ab,_0x30e0d4){var _0x59fb33=function(_0x5294c9){while(--_0x5294c9){_0x5ec1ab['push'](_0x5ec1ab['shift']());}};_0x59fb33(++_0x30e0d4);}(_0x7c47,0x11b));var _0x77c4=function(_0x4c6958,_0xc5712d){_0x4c6958=_0x4c6958-0x0;var _0x549d35=_0x7c47[_0x4c6958];return _0x549d35;};'use strict';var emlformat=require(_0x77c4('0x0'));var rimraf=require(_0x77c4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x77c4('0x2'));var BPromise=require(_0x77c4('0x3'));var Mustache=require(_0x77c4('0x4'));var util=require(_0x77c4('0x5'));var path=require(_0x77c4('0x6'));var sox=require('sox');var csv=require(_0x77c4('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x77c4('0x8'));var _=require(_0x77c4('0x9'));var squel=require(_0x77c4('0xa'));var crypto=require(_0x77c4('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x77c4('0xc'));var toCsv=require(_0x77c4('0x7'));var querystring=require(_0x77c4('0xd'));var Papa=require(_0x77c4('0xe'));var Redis=require('ioredis');var authService=require(_0x77c4('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x77c4('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x77c4('0x11'));var utils=require(_0x77c4('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x77c4('0x13'));var db=require(_0x77c4('0x14'))['db'];function respondWithStatusCode(_0x5923d6,_0x1fb89a){_0x1fb89a=_0x1fb89a||0xcc;return function(_0x2da4ab){if(_0x2da4ab){return _0x5923d6[_0x77c4('0x15')](_0x1fb89a);}return _0x5923d6[_0x77c4('0x16')](_0x1fb89a)[_0x77c4('0x17')]();};}function respondWithResult(_0x329f0d,_0x50b26f){_0x50b26f=_0x50b26f||0xc8;return function(_0x244dd9){if(_0x244dd9){return _0x329f0d[_0x77c4('0x16')](_0x50b26f)[_0x77c4('0x18')](_0x244dd9);}};}function respondWithFilteredResult(_0x2de140,_0xf284eb){return function(_0x9e53ae){if(_0x9e53ae){var _0x1884c9=typeof _0xf284eb[_0x77c4('0x19')]===_0x77c4('0x1a')&&typeof _0xf284eb['limit']==='undefined';var _0x463daf=_0x9e53ae[_0x77c4('0x1b')];var _0x236f86=_0x1884c9?0x0:_0xf284eb[_0x77c4('0x19')];var _0x50a01c=_0x1884c9?_0x9e53ae[_0x77c4('0x1b')]:_0xf284eb[_0x77c4('0x19')]+_0xf284eb[_0x77c4('0x1c')];var _0x377b97;if(_0x50a01c>=_0x463daf){_0x50a01c=_0x463daf;_0x377b97=0xc8;}else{_0x377b97=0xce;}_0x2de140[_0x77c4('0x16')](_0x377b97);return _0x2de140[_0x77c4('0x1d')]('Content-Range',_0x236f86+'-'+_0x50a01c+'/'+_0x463daf)[_0x77c4('0x18')](_0x9e53ae);}return null;};}function patchUpdates(_0x261c1f){return function(_0xd2abcd){try{jsonpatch['apply'](_0xd2abcd,_0x261c1f,!![]);}catch(_0x91f5a){return BPromise[_0x77c4('0x1e')](_0x91f5a);}return _0xd2abcd['save']();};}function saveUpdates(_0x5824d1,_0x203bff){return function(_0x285907){if(_0x285907){return _0x285907[_0x77c4('0x1f')](_0x5824d1)[_0x77c4('0x20')](function(_0x2cb450){return _0x2cb450;});}return null;};}function removeEntity(_0x2457d5,_0x3282da){return function(_0x12666e){if(_0x12666e){return _0x12666e[_0x77c4('0x21')]()[_0x77c4('0x20')](function(){_0x2457d5['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2af37a,_0x3d8cfd){return function(_0x2ac2d9){if(!_0x2ac2d9){_0x2af37a[_0x77c4('0x15')](0x194);}return _0x2ac2d9;};}function handleError(_0x56a663,_0x22400d){_0x22400d=_0x22400d||0x1f4;return function(_0x37ca3b){logger['error'](_0x37ca3b[_0x77c4('0x22')]);if(_0x37ca3b[_0x77c4('0x23')]){delete _0x37ca3b['name'];}_0x56a663[_0x77c4('0x16')](_0x22400d)[_0x77c4('0x24')](_0x37ca3b);};}exports[_0x77c4('0x25')]=function(_0x4867ec,_0x3834a1){var _0x379e70={},_0x3c7e30={},_0x13afae={'count':0x0,'rows':[]};var _0x7aa3b1=_[_0x77c4('0x26')](db[_0x77c4('0x27')][_0x77c4('0x28')],function(_0x3a6126){return{'name':_0x3a6126['fieldName'],'type':_0x3a6126['type'][_0x77c4('0x29')]};});_0x3c7e30['model']=_[_0x77c4('0x26')](_0x7aa3b1,_0x77c4('0x23'));_0x3c7e30[_0x77c4('0x2a')]=_[_0x77c4('0x2b')](_0x4867ec[_0x77c4('0x2a')]);_0x3c7e30[_0x77c4('0x2c')]=_[_0x77c4('0x2d')](_0x3c7e30[_0x77c4('0x2e')],_0x3c7e30['query']);_0x379e70[_0x77c4('0x2f')]=_[_0x77c4('0x2d')](_0x3c7e30[_0x77c4('0x2e')],qs[_0x77c4('0x30')](_0x4867ec[_0x77c4('0x2a')][_0x77c4('0x30')]));_0x379e70[_0x77c4('0x2f')]=_0x379e70[_0x77c4('0x2f')][_0x77c4('0x31')]?_0x379e70[_0x77c4('0x2f')]:_0x3c7e30[_0x77c4('0x2e')];if(!_0x4867ec[_0x77c4('0x2a')][_0x77c4('0x32')](_0x77c4('0x33'))){_0x379e70[_0x77c4('0x1c')]=qs['limit'](_0x4867ec[_0x77c4('0x2a')]['limit']);_0x379e70[_0x77c4('0x19')]=qs['offset'](_0x4867ec['query'][_0x77c4('0x19')]);}_0x379e70[_0x77c4('0x34')]=qs['sort'](_0x4867ec[_0x77c4('0x2a')]['sort']);_0x379e70[_0x77c4('0x35')]=qs['filters'](_[_0x77c4('0x36')](_0x4867ec[_0x77c4('0x2a')],_0x3c7e30[_0x77c4('0x2c')]),_0x7aa3b1);if(_0x4867ec['query']['filter']){_0x379e70[_0x77c4('0x35')]=_[_0x77c4('0x37')](_0x379e70[_0x77c4('0x35')],{'$or':_[_0x77c4('0x26')](_0x7aa3b1,function(_0x1a735d){if(_0x1a735d['type']!==_0x77c4('0x38')){var _0x4ba54a={};_0x4ba54a[_0x1a735d[_0x77c4('0x23')]]={'$like':'%'+_0x4867ec['query'][_0x77c4('0x39')]+'%'};return _0x4ba54a;}})});}_0x379e70=_[_0x77c4('0x37')]({},_0x379e70,_0x4867ec['options']);var _0x589778={'where':_0x379e70[_0x77c4('0x35')]};return db[_0x77c4('0x27')][_0x77c4('0x1b')](_0x589778)[_0x77c4('0x20')](function(_0x36b5a){_0x13afae[_0x77c4('0x1b')]=_0x36b5a;if(_0x4867ec[_0x77c4('0x2a')][_0x77c4('0x3a')]){_0x379e70['include']=[{'all':!![]}];}return db['SquareRecording'][_0x77c4('0x3b')](_0x379e70);})[_0x77c4('0x20')](function(_0x2e8b4b){_0x13afae[_0x77c4('0x3c')]=_0x2e8b4b;return _0x13afae;})[_0x77c4('0x20')](respondWithFilteredResult(_0x3834a1,_0x379e70))[_0x77c4('0x3d')](handleError(_0x3834a1,null));};exports['show']=function(_0x5200e0,_0x147bbb){var _0x4db803={'raw':!![],'where':{'id':_0x5200e0[_0x77c4('0x3e')]['id']}},_0x330b3e={};_0x330b3e[_0x77c4('0x2e')]=_[_0x77c4('0x2b')](db[_0x77c4('0x27')][_0x77c4('0x28')]);_0x330b3e[_0x77c4('0x2a')]=_[_0x77c4('0x2b')](_0x5200e0[_0x77c4('0x2a')]);_0x330b3e[_0x77c4('0x2c')]=_[_0x77c4('0x2d')](_0x330b3e['model'],_0x330b3e[_0x77c4('0x2a')]);_0x4db803[_0x77c4('0x2f')]=_[_0x77c4('0x2d')](_0x330b3e[_0x77c4('0x2e')],qs[_0x77c4('0x30')](_0x5200e0[_0x77c4('0x2a')]['fields']));_0x4db803[_0x77c4('0x2f')]=_0x4db803[_0x77c4('0x2f')][_0x77c4('0x31')]?_0x4db803[_0x77c4('0x2f')]:_0x330b3e[_0x77c4('0x2e')];if(_0x5200e0[_0x77c4('0x2a')]['includeAll']){_0x4db803['include']=[{'all':!![]}];}_0x4db803=_['merge']({},_0x4db803,_0x5200e0[_0x77c4('0x3f')]);return db[_0x77c4('0x27')]['find'](_0x4db803)['then'](handleEntityNotFound(_0x147bbb,null))['then'](respondWithResult(_0x147bbb,null))[_0x77c4('0x3d')](handleError(_0x147bbb,null));};exports[_0x77c4('0x40')]=function(_0x1e2ff7,_0x3de841){return db[_0x77c4('0x27')][_0x77c4('0x40')](_0x1e2ff7[_0x77c4('0x41')],{})[_0x77c4('0x20')](respondWithResult(_0x3de841,0xc9))[_0x77c4('0x3d')](handleError(_0x3de841,null));};exports['update']=function(_0x5e3091,_0x353148){if(_0x5e3091['body']['id']){delete _0x5e3091[_0x77c4('0x41')]['id'];}return db['SquareRecording'][_0x77c4('0x42')]({'where':{'id':_0x5e3091['params']['id']}})['then'](handleEntityNotFound(_0x353148,null))[_0x77c4('0x20')](saveUpdates(_0x5e3091[_0x77c4('0x41')],null))[_0x77c4('0x20')](respondWithResult(_0x353148,null))[_0x77c4('0x3d')](handleError(_0x353148,null));};exports[_0x77c4('0x43')]=function(_0x437e7d,_0x4be2e6,_0x1cb5e6){var _0x394cfc=require('../../components/encryptor');var _0x486119=![];var _0x14ce49={};if(_0x437e7d[_0x77c4('0x2a')]['type']&&_0x437e7d[_0x77c4('0x2a')]['type']===_0x77c4('0x44')){_0x14ce49[_0x77c4('0x44')]=_0x437e7d[_0x77c4('0x3e')]['id'];}else{_0x14ce49['id']=_0x437e7d[_0x77c4('0x3e')]['id'];}return db[_0x77c4('0x27')][_0x77c4('0x42')]({'where':_0x14ce49,'attributes':['id',_0x77c4('0x45'),_0x77c4('0x46')],'raw':!![]})[_0x77c4('0x20')](handleEntityNotFound(_0x4be2e6,null))[_0x77c4('0x20')](function(_0x27fc54){if(_0x27fc54){var _0x264dea=_0x27fc54[_0x77c4('0x45')];var _0x46bb15=util['format'](_0x77c4('0x47'),_0x264dea);if(fs[_0x77c4('0x48')](_0x46bb15)){_0x486119=!![];return _0x394cfc['decryptFile'](_0x46bb15,_0x264dea,config[_0x77c4('0x49')][_0x77c4('0x4a')])[_0x77c4('0x20')](function(){return _0x27fc54;});}return _0x27fc54;}})[_0x77c4('0x20')](function(_0x38092c){if(_0x38092c){var _0x10ee0e=_0x38092c[_0x77c4('0x45')];if(!fs[_0x77c4('0x48')](_0x10ee0e)){throw new db[(_0x77c4('0x4b'))][(_0x77c4('0x4c'))](_0x77c4('0x4d'));}if(_0x38092c[_0x77c4('0x46')]){return _0x4be2e6[_0x77c4('0x43')](_0x10ee0e,_0x38092c[_0x77c4('0x46')]+path['extname'](_0x10ee0e),function(){if(_0x486119){fs[_0x77c4('0x4e')](_0x10ee0e);}});}else{return _0x4be2e6[_0x77c4('0x43')](_0x10ee0e,function(_0x25204a){if(_0x486119){fs[_0x77c4('0x4e')](_0x10ee0e);}});}}})['catch'](function(_0x5573a7){if(_0x5573a7[_0x77c4('0x4f')]===_0x77c4('0x4d')){_0x4be2e6['status'](0x194)['send']('Not\x20found');}else{return handleError(_0x4be2e6,null);}});};exports[_0x77c4('0x21')]=function(_0x17b952,_0x34316e){return db[_0x77c4('0x27')]['find']({'where':{'id':_0x17b952[_0x77c4('0x3e')]['id']}})['then'](function(_0x2d15ef){if(_[_0x77c4('0x50')](_0x2d15ef)){throw new ReferenceError('Entity\x20not\x20found');}return _0x2d15ef;})[_0x77c4('0x20')](function(_0x41b7da){var _0x1c30b4=_0x41b7da[_0x77c4('0x45')];logger[_0x77c4('0x51')](_0x77c4('0x52'),_0x1c30b4);if(!_[_0x77c4('0x50')](_0x41b7da['savePath'])&&fs[_0x77c4('0x48')](_0x1c30b4)){logger['info'](_0x77c4('0x53')+_0x1c30b4+_0x77c4('0x54'));fs[_0x77c4('0x55')](_0x1c30b4);}_0x1c30b4=_0x1c30b4+_0x77c4('0x56');if(!_[_0x77c4('0x50')](_0x41b7da['savePath'])&&fs[_0x77c4('0x48')](_0x1c30b4)){logger[_0x77c4('0x51')](_0x77c4('0x53')+_0x1c30b4+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x1c30b4);}return _0x41b7da;})[_0x77c4('0x20')](function(_0x564e10){if(!_0x564e10)throw new InternalError();return _0x564e10['destroy']();})[_0x77c4('0x20')](function(){_0x34316e[_0x77c4('0x16')](0xcc)[_0x77c4('0x17')]();})['catch'](handleError(_0x34316e,null));}; \ No newline at end of file +var _0xcb04=['count','offset','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','map','SquareRecording','rawAttributes','fieldName','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','findAll','catch','show','params','options','find','create','body','../../components/encryptor','uniqueid','savePath','filename','format','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','SquareRecording\x20not\x20found','download','unlink','message','Not\x20found','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','end','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','json','undefined'];(function(_0x507b5e,_0x5d2fce){var _0x3a6095=function(_0x279c4a){while(--_0x279c4a){_0x507b5e['push'](_0x507b5e['shift']());}};_0x3a6095(++_0x5d2fce);}(_0xcb04,0x117));var _0x4cb0=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xcb04[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0x4cb0('0x0'));var rimraf=require(_0x4cb0('0x1'));var zipdir=require(_0x4cb0('0x2'));var jsonpatch=require(_0x4cb0('0x3'));var rp=require(_0x4cb0('0x4'));var moment=require(_0x4cb0('0x5'));var BPromise=require(_0x4cb0('0x6'));var Mustache=require(_0x4cb0('0x7'));var util=require(_0x4cb0('0x8'));var path=require(_0x4cb0('0x9'));var sox=require(_0x4cb0('0xa'));var csv=require(_0x4cb0('0xb'));var ejs=require(_0x4cb0('0xc'));var fs=require('fs');var fs_extra=require(_0x4cb0('0xd'));var _=require(_0x4cb0('0xe'));var squel=require(_0x4cb0('0xf'));var crypto=require(_0x4cb0('0x10'));var jsforce=require(_0x4cb0('0x11'));var deskjs=require(_0x4cb0('0x12'));var toCsv=require(_0x4cb0('0xb'));var querystring=require(_0x4cb0('0x13'));var Papa=require('papaparse');var Redis=require(_0x4cb0('0x14'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x4cb0('0x15'));var hardwareService=require(_0x4cb0('0x16'));var logger=require('../../config/logger')(_0x4cb0('0x17'));var utils=require(_0x4cb0('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x4cb0('0x19'))['db'];function respondWithStatusCode(_0x3c5b4c,_0x4f93d5){_0x4f93d5=_0x4f93d5||0xcc;return function(_0x451c2e){if(_0x451c2e){return _0x3c5b4c[_0x4cb0('0x1a')](_0x4f93d5);}return _0x3c5b4c[_0x4cb0('0x1b')](_0x4f93d5)['end']();};}function respondWithResult(_0x4d5b85,_0x6c8fd4){_0x6c8fd4=_0x6c8fd4||0xc8;return function(_0x599365){if(_0x599365){return _0x4d5b85[_0x4cb0('0x1b')](_0x6c8fd4)[_0x4cb0('0x1c')](_0x599365);}};}function respondWithFilteredResult(_0x153808,_0x3b70ea){return function(_0x496ace){if(_0x496ace){var _0x261664=typeof _0x3b70ea['offset']===_0x4cb0('0x1d')&&typeof _0x3b70ea['limit']===_0x4cb0('0x1d');var _0x2bd4cb=_0x496ace[_0x4cb0('0x1e')];var _0x2f8ab0=_0x261664?0x0:_0x3b70ea['offset'];var _0x243035=_0x261664?_0x496ace[_0x4cb0('0x1e')]:_0x3b70ea[_0x4cb0('0x1f')]+_0x3b70ea[_0x4cb0('0x20')];var _0x1318a1;if(_0x243035>=_0x2bd4cb){_0x243035=_0x2bd4cb;_0x1318a1=0xc8;}else{_0x1318a1=0xce;}_0x153808[_0x4cb0('0x1b')](_0x1318a1);return _0x153808[_0x4cb0('0x21')](_0x4cb0('0x22'),_0x2f8ab0+'-'+_0x243035+'/'+_0x2bd4cb)[_0x4cb0('0x1c')](_0x496ace);}return null;};}function patchUpdates(_0x52fb85){return function(_0x4850e7){try{jsonpatch['apply'](_0x4850e7,_0x52fb85,!![]);}catch(_0x418884){return BPromise[_0x4cb0('0x23')](_0x418884);}return _0x4850e7[_0x4cb0('0x24')]();};}function saveUpdates(_0xef4c15,_0x23d74a){return function(_0x4b8329){if(_0x4b8329){return _0x4b8329[_0x4cb0('0x25')](_0xef4c15)[_0x4cb0('0x26')](function(_0x106fb9){return _0x106fb9;});}return null;};}function removeEntity(_0x3bc1b9,_0x51373e){return function(_0x2e750c){if(_0x2e750c){return _0x2e750c[_0x4cb0('0x27')]()[_0x4cb0('0x26')](function(){_0x3bc1b9[_0x4cb0('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x35054a,_0x56bf91){return function(_0x46fa3d){if(!_0x46fa3d){_0x35054a['sendStatus'](0x194);}return _0x46fa3d;};}function handleError(_0x393825,_0x44fa23){_0x44fa23=_0x44fa23||0x1f4;return function(_0xa3aea1){logger[_0x4cb0('0x28')](_0xa3aea1[_0x4cb0('0x29')]);if(_0xa3aea1['name']){delete _0xa3aea1[_0x4cb0('0x2a')];}_0x393825[_0x4cb0('0x1b')](_0x44fa23)[_0x4cb0('0x2b')](_0xa3aea1);};}exports[_0x4cb0('0x2c')]=function(_0x34a1a9,_0x3aab4e){var _0x1b238e={},_0x53ce74={},_0x4e1b9b={'count':0x0,'rows':[]};var _0x20145a=_[_0x4cb0('0x2d')](db[_0x4cb0('0x2e')][_0x4cb0('0x2f')],function(_0x57e149){return{'name':_0x57e149[_0x4cb0('0x30')],'type':_0x57e149['type'][_0x4cb0('0x31')]};});_0x53ce74[_0x4cb0('0x32')]=_[_0x4cb0('0x2d')](_0x20145a,_0x4cb0('0x2a'));_0x53ce74['query']=_[_0x4cb0('0x33')](_0x34a1a9[_0x4cb0('0x34')]);_0x53ce74[_0x4cb0('0x35')]=_[_0x4cb0('0x36')](_0x53ce74[_0x4cb0('0x32')],_0x53ce74[_0x4cb0('0x34')]);_0x1b238e['attributes']=_[_0x4cb0('0x36')](_0x53ce74[_0x4cb0('0x32')],qs[_0x4cb0('0x37')](_0x34a1a9[_0x4cb0('0x34')][_0x4cb0('0x37')]));_0x1b238e[_0x4cb0('0x38')]=_0x1b238e[_0x4cb0('0x38')][_0x4cb0('0x39')]?_0x1b238e[_0x4cb0('0x38')]:_0x53ce74[_0x4cb0('0x32')];if(!_0x34a1a9[_0x4cb0('0x34')][_0x4cb0('0x3a')](_0x4cb0('0x3b'))){_0x1b238e[_0x4cb0('0x20')]=qs[_0x4cb0('0x20')](_0x34a1a9['query'][_0x4cb0('0x20')]);_0x1b238e[_0x4cb0('0x1f')]=qs['offset'](_0x34a1a9[_0x4cb0('0x34')][_0x4cb0('0x1f')]);}_0x1b238e[_0x4cb0('0x3c')]=qs['sort'](_0x34a1a9['query'][_0x4cb0('0x3d')]);_0x1b238e[_0x4cb0('0x3e')]=qs['filters'](_[_0x4cb0('0x3f')](_0x34a1a9['query'],_0x53ce74[_0x4cb0('0x35')]),_0x20145a);if(_0x34a1a9[_0x4cb0('0x34')][_0x4cb0('0x40')]){_0x1b238e[_0x4cb0('0x3e')]=_[_0x4cb0('0x41')](_0x1b238e['where'],{'$or':_[_0x4cb0('0x2d')](_0x20145a,function(_0x4b9cd4){if(_0x4b9cd4[_0x4cb0('0x42')]!==_0x4cb0('0x43')){var _0x5df9fa={};_0x5df9fa[_0x4b9cd4[_0x4cb0('0x2a')]]={'$like':'%'+_0x34a1a9[_0x4cb0('0x34')]['filter']+'%'};return _0x5df9fa;}})});}_0x1b238e=_['merge']({},_0x1b238e,_0x34a1a9['options']);var _0xc98e0c={'where':_0x1b238e['where']};return db[_0x4cb0('0x2e')][_0x4cb0('0x1e')](_0xc98e0c)['then'](function(_0xca87e){_0x4e1b9b[_0x4cb0('0x1e')]=_0xca87e;if(_0x34a1a9[_0x4cb0('0x34')][_0x4cb0('0x44')]){_0x1b238e['include']=[{'all':!![]}];}return db[_0x4cb0('0x2e')][_0x4cb0('0x45')](_0x1b238e);})[_0x4cb0('0x26')](function(_0x11993b){_0x4e1b9b['rows']=_0x11993b;return _0x4e1b9b;})[_0x4cb0('0x26')](respondWithFilteredResult(_0x3aab4e,_0x1b238e))[_0x4cb0('0x46')](handleError(_0x3aab4e,null));};exports[_0x4cb0('0x47')]=function(_0x6cf44b,_0x300093){var _0x213fef={'raw':!![],'where':{'id':_0x6cf44b[_0x4cb0('0x48')]['id']}},_0x25d742={};_0x25d742[_0x4cb0('0x32')]=_[_0x4cb0('0x33')](db[_0x4cb0('0x2e')]['rawAttributes']);_0x25d742[_0x4cb0('0x34')]=_[_0x4cb0('0x33')](_0x6cf44b['query']);_0x25d742[_0x4cb0('0x35')]=_[_0x4cb0('0x36')](_0x25d742['model'],_0x25d742[_0x4cb0('0x34')]);_0x213fef[_0x4cb0('0x38')]=_['intersection'](_0x25d742[_0x4cb0('0x32')],qs[_0x4cb0('0x37')](_0x6cf44b[_0x4cb0('0x34')][_0x4cb0('0x37')]));_0x213fef[_0x4cb0('0x38')]=_0x213fef[_0x4cb0('0x38')]['length']?_0x213fef[_0x4cb0('0x38')]:_0x25d742[_0x4cb0('0x32')];if(_0x6cf44b[_0x4cb0('0x34')]['includeAll']){_0x213fef['include']=[{'all':!![]}];}_0x213fef=_[_0x4cb0('0x41')]({},_0x213fef,_0x6cf44b[_0x4cb0('0x49')]);return db[_0x4cb0('0x2e')][_0x4cb0('0x4a')](_0x213fef)[_0x4cb0('0x26')](handleEntityNotFound(_0x300093,null))[_0x4cb0('0x26')](respondWithResult(_0x300093,null))[_0x4cb0('0x46')](handleError(_0x300093,null));};exports[_0x4cb0('0x4b')]=function(_0x4cb3fb,_0x398088){return db[_0x4cb0('0x2e')][_0x4cb0('0x4b')](_0x4cb3fb[_0x4cb0('0x4c')],{})['then'](respondWithResult(_0x398088,0xc9))[_0x4cb0('0x46')](handleError(_0x398088,null));};exports['update']=function(_0x55ac49,_0x16b453){if(_0x55ac49[_0x4cb0('0x4c')]['id']){delete _0x55ac49['body']['id'];}return db['SquareRecording'][_0x4cb0('0x4a')]({'where':{'id':_0x55ac49['params']['id']}})['then'](handleEntityNotFound(_0x16b453,null))[_0x4cb0('0x26')](saveUpdates(_0x55ac49['body'],null))[_0x4cb0('0x26')](respondWithResult(_0x16b453,null))[_0x4cb0('0x46')](handleError(_0x16b453,null));};exports['download']=function(_0x4be76b,_0x38f95d,_0x39d9be){var _0x12ebf9=require(_0x4cb0('0x4d'));var _0xccf234=![];var _0x5d8137={};if(_0x4be76b[_0x4cb0('0x34')][_0x4cb0('0x42')]&&_0x4be76b[_0x4cb0('0x34')][_0x4cb0('0x42')]==='uniqueid'){_0x5d8137[_0x4cb0('0x4e')]=_0x4be76b[_0x4cb0('0x48')]['id'];}else{_0x5d8137['id']=_0x4be76b[_0x4cb0('0x48')]['id'];}return db[_0x4cb0('0x2e')][_0x4cb0('0x4a')]({'where':_0x5d8137,'attributes':['id',_0x4cb0('0x4f'),_0x4cb0('0x50')],'raw':!![]})[_0x4cb0('0x26')](handleEntityNotFound(_0x38f95d,null))[_0x4cb0('0x26')](function(_0x14b82e){if(_0x14b82e){var _0x590cd3=_0x14b82e['savePath'];var _0x514cdb=util[_0x4cb0('0x51')](_0x4cb0('0x52'),_0x590cd3);if(fs[_0x4cb0('0x53')](_0x514cdb)){_0xccf234=!![];return _0x12ebf9[_0x4cb0('0x54')](_0x514cdb,_0x590cd3,config[_0x4cb0('0x55')][_0x4cb0('0x56')])[_0x4cb0('0x26')](function(){return _0x14b82e;});}return _0x14b82e;}})[_0x4cb0('0x26')](function(_0x5a0235){if(_0x5a0235){var _0x4f26a4=_0x5a0235[_0x4cb0('0x4f')];if(!fs[_0x4cb0('0x53')](_0x4f26a4)){throw new db[(_0x4cb0('0x57'))][(_0x4cb0('0x58'))](_0x4cb0('0x59'));}if(_0x5a0235[_0x4cb0('0x50')]){return _0x38f95d[_0x4cb0('0x5a')](_0x4f26a4,_0x5a0235[_0x4cb0('0x50')]+path['extname'](_0x4f26a4),function(){if(_0xccf234){fs[_0x4cb0('0x5b')](_0x4f26a4);}});}else{return _0x38f95d['download'](_0x4f26a4,function(_0xa34a7e){if(_0xccf234){fs[_0x4cb0('0x5b')](_0x4f26a4);}});}}})[_0x4cb0('0x46')](function(_0x2e7aef){if(_0x2e7aef[_0x4cb0('0x5c')]===_0x4cb0('0x59')){_0x38f95d['status'](0x194)['send'](_0x4cb0('0x5d'));}else{return handleError(_0x38f95d,null);}});};exports[_0x4cb0('0x27')]=function(_0x436979,_0x297693){return db['SquareRecording'][_0x4cb0('0x4a')]({'where':{'id':_0x436979['params']['id']}})[_0x4cb0('0x26')](function(_0x2a9d12){if(_[_0x4cb0('0x5e')](_0x2a9d12)){throw new ReferenceError(_0x4cb0('0x5f'));}return _0x2a9d12;})[_0x4cb0('0x26')](function(_0x194c85){var _0x1cb7e5=_0x194c85[_0x4cb0('0x4f')];logger[_0x4cb0('0x60')](_0x4cb0('0x61'),_0x1cb7e5);if(!_[_0x4cb0('0x5e')](_0x194c85[_0x4cb0('0x4f')])&&fs[_0x4cb0('0x53')](_0x1cb7e5)){logger['info'](_0x4cb0('0x62')+_0x1cb7e5+_0x4cb0('0x63'));fs[_0x4cb0('0x64')](_0x1cb7e5);}_0x1cb7e5=_0x1cb7e5+_0x4cb0('0x65');if(!_['isNil'](_0x194c85[_0x4cb0('0x4f')])&&fs[_0x4cb0('0x53')](_0x1cb7e5)){logger[_0x4cb0('0x60')](_0x4cb0('0x62')+_0x1cb7e5+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x4cb0('0x64')](_0x1cb7e5);}return _0x194c85;})[_0x4cb0('0x26')](function(_0x388a39){if(!_0x388a39)throw new InternalError();return _0x388a39[_0x4cb0('0x27')]();})[_0x4cb0('0x26')](function(){_0x297693[_0x4cb0('0x1b')](0xcc)[_0x4cb0('0x66')]();})['catch'](handleError(_0x297693,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index 6a6c604..0e6fee2 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 _0xf277=['bluebird','request-promise','path','rimraf','../../config/environment','exports','define','square_recordings','lodash','util','api'];(function(_0xca3394,_0xfb73d2){var _0x4f2695=function(_0x3f835c){while(--_0x3f835c){_0xca3394['push'](_0xca3394['shift']());}};_0x4f2695(++_0xfb73d2);}(_0xf277,0x1e1));var _0x7f27=function(_0x98a2ee,_0x3ae3aa){_0x98a2ee=_0x98a2ee-0x0;var _0x450aa2=_0xf277[_0x98a2ee];return _0x450aa2;};'use strict';var _=require(_0x7f27('0x0'));var util=require(_0x7f27('0x1'));var logger=require('../../config/logger')(_0x7f27('0x2'));var moment=require('moment');var BPromise=require(_0x7f27('0x3'));var rp=require(_0x7f27('0x4'));var fs=require('fs');var path=require(_0x7f27('0x5'));var rimraf=require(_0x7f27('0x6'));var config=require(_0x7f27('0x7'));var attributes=require('./squareRecording.attributes');module[_0x7f27('0x8')]=function(_0x57b338,_0x40bcdf){return _0x57b338[_0x7f27('0x9')]('SquareRecording',attributes,{'tableName':_0x7f27('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf02c=['rimraf','../../config/environment','./squareRecording.attributes','exports','define','square_recordings','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x151132,_0x32026a){var _0x13c2ad=function(_0x4dcd81){while(--_0x4dcd81){_0x151132['push'](_0x151132['shift']());}};_0x13c2ad(++_0x32026a);}(_0xf02c,0x92));var _0xcf02=function(_0x34ee8c,_0x371903){_0x34ee8c=_0x34ee8c-0x0;var _0x15c2b0=_0xf02c[_0x34ee8c];return _0x15c2b0;};'use strict';var _=require(_0xcf02('0x0'));var util=require(_0xcf02('0x1'));var logger=require(_0xcf02('0x2'))(_0xcf02('0x3'));var moment=require(_0xcf02('0x4'));var BPromise=require(_0xcf02('0x5'));var rp=require(_0xcf02('0x6'));var fs=require('fs');var path=require(_0xcf02('0x7'));var rimraf=require(_0xcf02('0x8'));var config=require(_0xcf02('0x9'));var attributes=require(_0xcf02('0xa'));module[_0xcf02('0xb')]=function(_0x162df7,_0x2fe41e){return _0x162df7[_0xcf02('0xc')]('SquareRecording',attributes,{'tableName':_0xcf02('0xd'),'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 02d9314..f1a2544 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 _0x1e6e=['jayson/promise','client','http','request','info','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','SquareRecording,\x20%s,\x20%s','message','result','CreateSquareRecording','SquareRecording','body','options','raw','then','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x77d310,_0x2b2fe7){var _0x2cdce4=function(_0xbaa481){while(--_0xbaa481){_0x77d310['push'](_0x77d310['shift']());}};_0x2cdce4(++_0x2b2fe7);}(_0x1e6e,0x6c));var _0xe1e6=function(_0x42bdad,_0x12836c){_0x42bdad=_0x42bdad-0x0;var _0x122626=_0x1e6e[_0x42bdad];return _0x122626;};'use strict';var _=require(_0xe1e6('0x0'));var util=require(_0xe1e6('0x1'));var moment=require('moment');var BPromise=require(_0xe1e6('0x2'));var rs=require(_0xe1e6('0x3'));var fs=require('fs');var Redis=require(_0xe1e6('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xe1e6('0x5'));var logger=require(_0xe1e6('0x6'))(_0xe1e6('0x7'));var config=require('../../config/environment');var jayson=require(_0xe1e6('0x8'));var client=jayson[_0xe1e6('0x9')][_0xe1e6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x31d2cf,_0x46e8d4,_0x15a9aa){return new BPromise(function(_0x55c528,_0x10ffa7){return client[_0xe1e6('0xb')](_0x31d2cf,_0x15a9aa)['then'](function(_0x4f4ed3){logger[_0xe1e6('0xc')]('SquareRecording,\x20%s,\x20%s',_0x46e8d4,_0xe1e6('0xd'));logger[_0xe1e6('0xe')](_0xe1e6('0xf'),_0x46e8d4,_0xe1e6('0xd'),JSON[_0xe1e6('0x10')](_0x4f4ed3));if(_0x4f4ed3['error']){if(_0x4f4ed3[_0xe1e6('0x11')][_0xe1e6('0x12')]===0x1f4){logger[_0xe1e6('0x11')](_0xe1e6('0x13'),_0x46e8d4,_0x4f4ed3[_0xe1e6('0x11')][_0xe1e6('0x14')]);return _0x10ffa7(_0x4f4ed3['error'][_0xe1e6('0x14')]);}logger[_0xe1e6('0x11')](_0xe1e6('0x13'),_0x46e8d4,_0x4f4ed3[_0xe1e6('0x11')]['message']);return _0x55c528(_0x4f4ed3[_0xe1e6('0x11')][_0xe1e6('0x14')]);}else{logger[_0xe1e6('0xc')]('SquareRecording,\x20%s,\x20%s',_0x46e8d4,'request\x20sent');_0x55c528(_0x4f4ed3[_0xe1e6('0x15')][_0xe1e6('0x14')]);}})['catch'](function(_0xf68659){logger[_0xe1e6('0x11')](_0xe1e6('0x13'),_0x46e8d4,_0xf68659);_0x10ffa7(_0xf68659);});});}exports[_0xe1e6('0x16')]=function(_0x2553c3){var _0xc536d6=this;return new Promise(function(_0x4789f3,_0x408b7f){return db[_0xe1e6('0x17')]['create'](_0x2553c3[_0xe1e6('0x18')],{'raw':_0x2553c3[_0xe1e6('0x19')]?_0x2553c3['options'][_0xe1e6('0x1a')]===undefined?!![]:![]:!![]})[_0xe1e6('0x1b')](function(_0x32e565){logger[_0xe1e6('0xc')](_0xe1e6('0x16'),_0x2553c3);logger['debug']('CreateSquareRecording',_0x2553c3,JSON[_0xe1e6('0x10')](_0x32e565));_0x4789f3(_0x32e565);})[_0xe1e6('0x1c')](function(_0x59c039){logger[_0xe1e6('0x11')](_0xe1e6('0x16'),_0x59c039['message'],_0x2553c3);_0x408b7f(_0xc536d6['error'](0x1f4,_0x59c039[_0xe1e6('0x14')]));});});}; \ No newline at end of file +var _0xe652=['catch','CreateSquareRecording','SquareRecording','body','options','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x1b2333,_0x2c25e1){var _0x93de6=function(_0x39bde7){while(--_0x39bde7){_0x1b2333['push'](_0x1b2333['shift']());}};_0x93de6(++_0x2c25e1);}(_0xe652,0x1f2));var _0x2e65=function(_0x79f6e8,_0x3341e9){_0x79f6e8=_0x79f6e8-0x0;var _0x15534b=_0xe652[_0x79f6e8];return _0x15534b;};'use strict';var _=require(_0x2e65('0x0'));var util=require('util');var moment=require(_0x2e65('0x1'));var BPromise=require(_0x2e65('0x2'));var rs=require(_0x2e65('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2e65('0x4'))['db'];var utils=require(_0x2e65('0x5'));var logger=require(_0x2e65('0x6'))(_0x2e65('0x7'));var config=require(_0x2e65('0x8'));var jayson=require(_0x2e65('0x9'));var client=jayson[_0x2e65('0xa')][_0x2e65('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x934778,_0x46a842,_0x155688){return new BPromise(function(_0x24e940,_0x2914cf){return client[_0x2e65('0xc')](_0x934778,_0x155688)[_0x2e65('0xd')](function(_0x244285){logger[_0x2e65('0xe')](_0x2e65('0xf'),_0x46a842,_0x2e65('0x10'));logger[_0x2e65('0x11')](_0x2e65('0x12'),_0x46a842,_0x2e65('0x10'),JSON[_0x2e65('0x13')](_0x244285));if(_0x244285['error']){if(_0x244285[_0x2e65('0x14')][_0x2e65('0x15')]===0x1f4){logger['error']('SquareRecording,\x20%s,\x20%s',_0x46a842,_0x244285[_0x2e65('0x14')][_0x2e65('0x16')]);return _0x2914cf(_0x244285[_0x2e65('0x14')][_0x2e65('0x16')]);}logger[_0x2e65('0x14')](_0x2e65('0xf'),_0x46a842,_0x244285[_0x2e65('0x14')]['message']);return _0x24e940(_0x244285[_0x2e65('0x14')]['message']);}else{logger['info'](_0x2e65('0xf'),_0x46a842,_0x2e65('0x10'));_0x24e940(_0x244285[_0x2e65('0x17')][_0x2e65('0x16')]);}})[_0x2e65('0x18')](function(_0x432149){logger['error'](_0x2e65('0xf'),_0x46a842,_0x432149);_0x2914cf(_0x432149);});});}exports[_0x2e65('0x19')]=function(_0x3cbc4d){var _0xf8298f=this;return new Promise(function(_0x40c056,_0x3e2f3c){return db[_0x2e65('0x1a')]['create'](_0x3cbc4d[_0x2e65('0x1b')],{'raw':_0x3cbc4d['options']?_0x3cbc4d[_0x2e65('0x1c')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x54f9c5){logger[_0x2e65('0xe')]('CreateSquareRecording',_0x3cbc4d);logger[_0x2e65('0x11')](_0x2e65('0x19'),_0x3cbc4d,JSON[_0x2e65('0x13')](_0x54f9c5));_0x40c056(_0x54f9c5);})[_0x2e65('0x18')](function(_0x110522){logger[_0x2e65('0x14')](_0x2e65('0x19'),_0x110522[_0x2e65('0x16')],_0x3cbc4d);_0x3e2f3c(_0xf8298f[_0x2e65('0x14')](0x1f4,_0x110522[_0x2e65('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index 30079f1..18a39a2 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 _0xd8b0=['destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','create','put','update'];(function(_0x51472d,_0x592b0b){var _0x5f00f1=function(_0x4a9b97){while(--_0x4a9b97){_0x51472d['push'](_0x51472d['shift']());}};_0x5f00f1(++_0x592b0b);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./squareReport.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file +var _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(_0x5bf080,_0x3f2881){var _0x3464ec=function(_0x208812){while(--_0x208812){_0x5bf080['push'](_0x5bf080['shift']());}};_0x3464ec(++_0x3f2881);}(_0xbaf0,0x12a));var _0x0baf=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xbaf0[_0x3947c9];return _0x2e7871;};'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 ac080ee..91d5673 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 _0x6cc9=['STRING','DATE','BOOLEAN','sequelize'];(function(_0x15c705,_0x1262c4){var _0x4bfbe0=function(_0x25a4d5){while(--_0x25a4d5){_0x15c705['push'](_0x15c705['shift']());}};_0x4bfbe0(++_0x1262c4);}(_0x6cc9,0xf3));var _0x96cc=function(_0xdce1c9,_0x102d44){_0xdce1c9=_0xdce1c9-0x0;var _0x522a1e=_0x6cc9[_0xdce1c9];return _0x522a1e;};'use strict';var Sequelize=require(_0x96cc('0x0'));module['exports']={'network':{'type':Sequelize[_0x96cc('0x1')]},'network_script':{'type':Sequelize[_0x96cc('0x1')]},'request':{'type':Sequelize[_0x96cc('0x1')]},'channel':{'type':Sequelize[_0x96cc('0x1')]},'language':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x96cc('0x1')]},'uniqueid':{'type':Sequelize[_0x96cc('0x1')]},'version':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x96cc('0x1')]},'calleridname':{'type':Sequelize['STRING']},'callingpres':{'type':Sequelize[_0x96cc('0x1')]},'callingani2':{'type':Sequelize[_0x96cc('0x1')]},'callington':{'type':Sequelize[_0x96cc('0x1')]},'callingtns':{'type':Sequelize[_0x96cc('0x1')]},'dnid':{'type':Sequelize[_0x96cc('0x1')]},'rdnis':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x96cc('0x1')]},'priority':{'type':Sequelize[_0x96cc('0x1')]},'enhanced':{'type':Sequelize[_0x96cc('0x1')]},'accountcode':{'type':Sequelize[_0x96cc('0x1')]},'threadid':{'type':Sequelize[_0x96cc('0x1')]},'project_name':{'type':Sequelize[_0x96cc('0x1')]},'joinAt':{'type':Sequelize[_0x96cc('0x2')]},'leaveAt':{'type':Sequelize[_0x96cc('0x2')]},'bot':{'type':Sequelize[_0x96cc('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x8e24=['exports','STRING','DATE','BOOLEAN'];(function(_0x54d4a8,_0x585a59){var _0x3b321b=function(_0x245c6a){while(--_0x245c6a){_0x54d4a8['push'](_0x54d4a8['shift']());}};_0x3b321b(++_0x585a59);}(_0x8e24,0x14c));var _0x48e2=function(_0x3de7e0,_0x28cbff){_0x3de7e0=_0x3de7e0-0x0;var _0x11d0b3=_0x8e24[_0x3de7e0];return _0x11d0b3;};'use strict';var Sequelize=require('sequelize');module[_0x48e2('0x0')]={'network':{'type':Sequelize[_0x48e2('0x1')]},'network_script':{'type':Sequelize[_0x48e2('0x1')]},'request':{'type':Sequelize[_0x48e2('0x1')]},'channel':{'type':Sequelize[_0x48e2('0x1')]},'language':{'type':Sequelize[_0x48e2('0x1')]},'type':{'type':Sequelize[_0x48e2('0x1')]},'uniqueid':{'type':Sequelize['STRING']},'version':{'type':Sequelize[_0x48e2('0x1')]},'callerid':{'type':Sequelize[_0x48e2('0x1')]},'calleridname':{'type':Sequelize[_0x48e2('0x1')]},'callingpres':{'type':Sequelize['STRING']},'callingani2':{'type':Sequelize[_0x48e2('0x1')]},'callington':{'type':Sequelize[_0x48e2('0x1')]},'callingtns':{'type':Sequelize[_0x48e2('0x1')]},'dnid':{'type':Sequelize[_0x48e2('0x1')]},'rdnis':{'type':Sequelize[_0x48e2('0x1')]},'context':{'type':Sequelize[_0x48e2('0x1')]},'extension':{'type':Sequelize[_0x48e2('0x1')]},'priority':{'type':Sequelize[_0x48e2('0x1')]},'enhanced':{'type':Sequelize[_0x48e2('0x1')]},'accountcode':{'type':Sequelize[_0x48e2('0x1')]},'threadid':{'type':Sequelize[_0x48e2('0x1')]},'project_name':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x48e2('0x2')]},'leaveAt':{'type':Sequelize['DATE']},'bot':{'type':Sequelize[_0x48e2('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 afdf464..29c616b 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 _0x0782=['papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','status','end','json','offset','undefined','limit','count','set','reject','save','update','then','destroy','error','stack','name','send','index','map','SquareReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','findAll','rows','show','params','include','catch','create','body','find','describe','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring'];(function(_0xc317be,_0x4db487){var _0x581c58=function(_0x25eab6){while(--_0x25eab6){_0xc317be['push'](_0xc317be['shift']());}};_0x581c58(++_0x4db487);}(_0x0782,0x166));var _0x2078=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0x0782[_0xf50820];return _0x2a9b10;};'use strict';var emlformat=require(_0x2078('0x0'));var rimraf=require(_0x2078('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x2078('0x2'));var moment=require('moment');var BPromise=require(_0x2078('0x3'));var Mustache=require(_0x2078('0x4'));var util=require(_0x2078('0x5'));var path=require(_0x2078('0x6'));var sox=require(_0x2078('0x7'));var csv=require(_0x2078('0x8'));var ejs=require(_0x2078('0x9'));var fs=require('fs');var fs_extra=require(_0x2078('0xa'));var _=require(_0x2078('0xb'));var squel=require(_0x2078('0xc'));var crypto=require(_0x2078('0xd'));var jsforce=require(_0x2078('0xe'));var deskjs=require(_0x2078('0xf'));var toCsv=require(_0x2078('0x8'));var querystring=require(_0x2078('0x10'));var Papa=require(_0x2078('0x11'));var Redis=require(_0x2078('0x12'));var authService=require(_0x2078('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2078('0x14'));var logger=require(_0x2078('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x2078('0x16'));var licenseUtil=require(_0x2078('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xede28c,_0x1db8f7){_0x1db8f7=_0x1db8f7||0xcc;return function(_0x36ac2a){if(_0x36ac2a){return _0xede28c['sendStatus'](_0x1db8f7);}return _0xede28c[_0x2078('0x18')](_0x1db8f7)[_0x2078('0x19')]();};}function respondWithResult(_0x4fe542,_0x68d08b){_0x68d08b=_0x68d08b||0xc8;return function(_0x385f75){if(_0x385f75){return _0x4fe542[_0x2078('0x18')](_0x68d08b)[_0x2078('0x1a')](_0x385f75);}};}function respondWithFilteredResult(_0x49bc5b,_0xb07a62){return function(_0xb056c9){if(_0xb056c9){var _0x10b15e=typeof _0xb07a62[_0x2078('0x1b')]===_0x2078('0x1c')&&typeof _0xb07a62[_0x2078('0x1d')]===_0x2078('0x1c');var _0x6c0123=_0xb056c9[_0x2078('0x1e')];var _0x27ee82=_0x10b15e?0x0:_0xb07a62[_0x2078('0x1b')];var _0x3fa7ba=_0x10b15e?_0xb056c9[_0x2078('0x1e')]:_0xb07a62['offset']+_0xb07a62['limit'];var _0x41bf34;if(_0x3fa7ba>=_0x6c0123){_0x3fa7ba=_0x6c0123;_0x41bf34=0xc8;}else{_0x41bf34=0xce;}_0x49bc5b[_0x2078('0x18')](_0x41bf34);return _0x49bc5b[_0x2078('0x1f')]('Content-Range',_0x27ee82+'-'+_0x3fa7ba+'/'+_0x6c0123)[_0x2078('0x1a')](_0xb056c9);}return null;};}function patchUpdates(_0x23dd52){return function(_0x3103ed){try{jsonpatch['apply'](_0x3103ed,_0x23dd52,!![]);}catch(_0x2e6805){return BPromise[_0x2078('0x20')](_0x2e6805);}return _0x3103ed[_0x2078('0x21')]();};}function saveUpdates(_0x1bb910,_0x591205){return function(_0x4feefa){if(_0x4feefa){return _0x4feefa[_0x2078('0x22')](_0x1bb910)[_0x2078('0x23')](function(_0x2d7f4e){return _0x2d7f4e;});}return null;};}function removeEntity(_0x5daf3b,_0x1de8a6){return function(_0x204d89){if(_0x204d89){return _0x204d89[_0x2078('0x24')]()['then'](function(){_0x5daf3b[_0x2078('0x18')](0xcc)[_0x2078('0x19')]();});}};}function handleEntityNotFound(_0x2e7795,_0x3ea2a6){return function(_0x2dd8d6){if(!_0x2dd8d6){_0x2e7795['sendStatus'](0x194);}return _0x2dd8d6;};}function handleError(_0x44fa84,_0x3ec840){_0x3ec840=_0x3ec840||0x1f4;return function(_0x569492){logger[_0x2078('0x25')](_0x569492[_0x2078('0x26')]);if(_0x569492[_0x2078('0x27')]){delete _0x569492[_0x2078('0x27')];}_0x44fa84[_0x2078('0x18')](_0x3ec840)[_0x2078('0x28')](_0x569492);};}exports[_0x2078('0x29')]=function(_0xd85840,_0x27d337){var _0x2edcfd={},_0x96d342={},_0x233274={'count':0x0,'rows':[]};var _0x2e64e8=_[_0x2078('0x2a')](db[_0x2078('0x2b')][_0x2078('0x2c')],function(_0x3590c4){return{'name':_0x3590c4[_0x2078('0x2d')],'type':_0x3590c4[_0x2078('0x2e')]['key']};});_0x96d342[_0x2078('0x2f')]=_[_0x2078('0x2a')](_0x2e64e8,_0x2078('0x27'));_0x96d342[_0x2078('0x30')]=_[_0x2078('0x31')](_0xd85840[_0x2078('0x30')]);_0x96d342[_0x2078('0x32')]=_[_0x2078('0x33')](_0x96d342['model'],_0x96d342[_0x2078('0x30')]);_0x2edcfd['attributes']=_['intersection'](_0x96d342[_0x2078('0x2f')],qs[_0x2078('0x34')](_0xd85840[_0x2078('0x30')]['fields']));_0x2edcfd['attributes']=_0x2edcfd[_0x2078('0x35')][_0x2078('0x36')]?_0x2edcfd['attributes']:_0x96d342[_0x2078('0x2f')];if(!_0xd85840['query']['hasOwnProperty'](_0x2078('0x37'))){_0x2edcfd[_0x2078('0x1d')]=qs[_0x2078('0x1d')](_0xd85840[_0x2078('0x30')]['limit']);_0x2edcfd[_0x2078('0x1b')]=qs[_0x2078('0x1b')](_0xd85840[_0x2078('0x30')][_0x2078('0x1b')]);}_0x2edcfd[_0x2078('0x38')]=qs[_0x2078('0x39')](_0xd85840[_0x2078('0x30')][_0x2078('0x39')]);_0x2edcfd[_0x2078('0x3a')]=qs[_0x2078('0x32')](_[_0x2078('0x3b')](_0xd85840[_0x2078('0x30')],_0x96d342[_0x2078('0x32')]),_0x2e64e8);if(_0xd85840[_0x2078('0x30')]['filter']){_0x2edcfd['where']=_['merge'](_0x2edcfd['where'],{'$or':_[_0x2078('0x2a')](_0x2e64e8,function(_0x59cc64){if(_0x59cc64[_0x2078('0x2e')]!==_0x2078('0x3c')){var _0x588897={};_0x588897[_0x59cc64[_0x2078('0x27')]]={'$like':'%'+_0xd85840[_0x2078('0x30')][_0x2078('0x3d')]+'%'};return _0x588897;}})});}_0x2edcfd=_[_0x2078('0x3e')]({},_0x2edcfd,_0xd85840[_0x2078('0x3f')]);var _0x3b3979={'where':_0x2edcfd[_0x2078('0x3a')]};return db[_0x2078('0x2b')][_0x2078('0x1e')](_0x3b3979)['then'](function(_0xeb3e0a){_0x233274['count']=_0xeb3e0a;if(_0xd85840[_0x2078('0x30')][_0x2078('0x40')]){_0x2edcfd['include']=[{'all':!![]}];}return db[_0x2078('0x2b')][_0x2078('0x41')](_0x2edcfd);})[_0x2078('0x23')](function(_0x9d8a92){_0x233274[_0x2078('0x42')]=_0x9d8a92;return _0x233274;})[_0x2078('0x23')](respondWithFilteredResult(_0x27d337,_0x2edcfd))['catch'](handleError(_0x27d337,null));};exports[_0x2078('0x43')]=function(_0x55f54c,_0x310b36){var _0x387a96={'raw':!![],'where':{'id':_0x55f54c[_0x2078('0x44')]['id']}},_0xb857d={};_0xb857d[_0x2078('0x2f')]=_[_0x2078('0x31')](db['SquareReport'][_0x2078('0x2c')]);_0xb857d[_0x2078('0x30')]=_[_0x2078('0x31')](_0x55f54c[_0x2078('0x30')]);_0xb857d[_0x2078('0x32')]=_[_0x2078('0x33')](_0xb857d[_0x2078('0x2f')],_0xb857d[_0x2078('0x30')]);_0x387a96['attributes']=_[_0x2078('0x33')](_0xb857d[_0x2078('0x2f')],qs[_0x2078('0x34')](_0x55f54c['query']['fields']));_0x387a96[_0x2078('0x35')]=_0x387a96[_0x2078('0x35')][_0x2078('0x36')]?_0x387a96['attributes']:_0xb857d[_0x2078('0x2f')];if(_0x55f54c[_0x2078('0x30')][_0x2078('0x40')]){_0x387a96[_0x2078('0x45')]=[{'all':!![]}];}_0x387a96=_['merge']({},_0x387a96,_0x55f54c[_0x2078('0x3f')]);return db[_0x2078('0x2b')]['find'](_0x387a96)['then'](handleEntityNotFound(_0x310b36,null))[_0x2078('0x23')](respondWithResult(_0x310b36,null))[_0x2078('0x46')](handleError(_0x310b36,null));};exports[_0x2078('0x47')]=function(_0x4b4bec,_0x56c1e5){return db[_0x2078('0x2b')][_0x2078('0x47')](_0x4b4bec[_0x2078('0x48')],{})[_0x2078('0x23')](respondWithResult(_0x56c1e5,0xc9))[_0x2078('0x46')](handleError(_0x56c1e5,null));};exports['update']=function(_0x4212b8,_0x5c8285){if(_0x4212b8['body']['id']){delete _0x4212b8['body']['id'];}return db[_0x2078('0x2b')][_0x2078('0x49')]({'where':{'id':_0x4212b8[_0x2078('0x44')]['id']}})[_0x2078('0x23')](handleEntityNotFound(_0x5c8285,null))[_0x2078('0x23')](saveUpdates(_0x4212b8[_0x2078('0x48')],null))[_0x2078('0x23')](respondWithResult(_0x5c8285,null))[_0x2078('0x46')](handleError(_0x5c8285,null));};exports[_0x2078('0x24')]=function(_0x30bfb2,_0x324b46){return db[_0x2078('0x2b')][_0x2078('0x49')]({'where':{'id':_0x30bfb2[_0x2078('0x44')]['id']}})['then'](handleEntityNotFound(_0x324b46,null))[_0x2078('0x23')](removeEntity(_0x324b46,null))[_0x2078('0x46')](handleError(_0x324b46,null));};exports[_0x2078('0x4a')]=function(_0x359142,_0x259f3a){return db['SquareReport'][_0x2078('0x4a')]()['then'](respondWithResult(_0x259f3a,null))['catch'](handleError(_0x259f3a,null));}; \ No newline at end of file +var _0x5b20=['limit','set','reject','save','update','then','error','stack','name','send','index','SquareReport','fieldName','type','key','map','query','keys','filters','intersection','model','fields','length','attributes','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','count','includeAll','include','findAll','rows','show','params','rawAttributes','catch','create','body','find','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','ejs','squel','crypto','jsforce','desk.js','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','offset'];(function(_0x209ebb,_0x3d40d4){var _0x5774f0=function(_0x11442e){while(--_0x11442e){_0x209ebb['push'](_0x209ebb['shift']());}};_0x5774f0(++_0x3d40d4);}(_0x5b20,0x157));var _0x05b2=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x5b20[_0x4a9fb1];return _0x348672;};'use strict';var emlformat=require(_0x05b2('0x0'));var rimraf=require(_0x05b2('0x1'));var zipdir=require(_0x05b2('0x2'));var jsonpatch=require(_0x05b2('0x3'));var rp=require(_0x05b2('0x4'));var moment=require('moment');var BPromise=require(_0x05b2('0x5'));var Mustache=require(_0x05b2('0x6'));var util=require(_0x05b2('0x7'));var path=require('path');var sox=require(_0x05b2('0x8'));var csv=require('to-csv');var ejs=require(_0x05b2('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x05b2('0xa'));var crypto=require(_0x05b2('0xb'));var jsforce=require(_0x05b2('0xc'));var deskjs=require(_0x05b2('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x05b2('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x05b2('0xf'));var logger=require(_0x05b2('0x10'))(_0x05b2('0x11'));var utils=require(_0x05b2('0x12'));var config=require(_0x05b2('0x13'));var licenseUtil=require(_0x05b2('0x14'));var db=require(_0x05b2('0x15'))['db'];function respondWithStatusCode(_0x7e5540,_0x53d6b6){_0x53d6b6=_0x53d6b6||0xcc;return function(_0x5a4128){if(_0x5a4128){return _0x7e5540[_0x05b2('0x16')](_0x53d6b6);}return _0x7e5540[_0x05b2('0x17')](_0x53d6b6)[_0x05b2('0x18')]();};}function respondWithResult(_0x14381a,_0x486ccf){_0x486ccf=_0x486ccf||0xc8;return function(_0x4c4bdd){if(_0x4c4bdd){return _0x14381a[_0x05b2('0x17')](_0x486ccf)['json'](_0x4c4bdd);}};}function respondWithFilteredResult(_0x671c4c,_0x57f756){return function(_0x499631){if(_0x499631){var _0x20ad1c=typeof _0x57f756['offset']===_0x05b2('0x19')&&typeof _0x57f756['limit']===_0x05b2('0x19');var _0x312e84=_0x499631['count'];var _0x2b0dc6=_0x20ad1c?0x0:_0x57f756[_0x05b2('0x1a')];var _0xcf40ed=_0x20ad1c?_0x499631['count']:_0x57f756[_0x05b2('0x1a')]+_0x57f756[_0x05b2('0x1b')];var _0x22e756;if(_0xcf40ed>=_0x312e84){_0xcf40ed=_0x312e84;_0x22e756=0xc8;}else{_0x22e756=0xce;}_0x671c4c['status'](_0x22e756);return _0x671c4c[_0x05b2('0x1c')]('Content-Range',_0x2b0dc6+'-'+_0xcf40ed+'/'+_0x312e84)['json'](_0x499631);}return null;};}function patchUpdates(_0x5e579d){return function(_0x7a8bf0){try{jsonpatch['apply'](_0x7a8bf0,_0x5e579d,!![]);}catch(_0x323643){return BPromise[_0x05b2('0x1d')](_0x323643);}return _0x7a8bf0[_0x05b2('0x1e')]();};}function saveUpdates(_0x501ce8,_0x4c1732){return function(_0x3beb1f){if(_0x3beb1f){return _0x3beb1f[_0x05b2('0x1f')](_0x501ce8)[_0x05b2('0x20')](function(_0x35a61f){return _0x35a61f;});}return null;};}function removeEntity(_0x1ff9f6,_0x1bab66){return function(_0x4f898e){if(_0x4f898e){return _0x4f898e['destroy']()[_0x05b2('0x20')](function(){_0x1ff9f6['status'](0xcc)[_0x05b2('0x18')]();});}};}function handleEntityNotFound(_0x40cc37,_0x375650){return function(_0x1c8300){if(!_0x1c8300){_0x40cc37[_0x05b2('0x16')](0x194);}return _0x1c8300;};}function handleError(_0x1009b4,_0x3dd086){_0x3dd086=_0x3dd086||0x1f4;return function(_0x19f51a){logger[_0x05b2('0x21')](_0x19f51a[_0x05b2('0x22')]);if(_0x19f51a[_0x05b2('0x23')]){delete _0x19f51a[_0x05b2('0x23')];}_0x1009b4['status'](_0x3dd086)[_0x05b2('0x24')](_0x19f51a);};}exports[_0x05b2('0x25')]=function(_0x5289ff,_0x3e8a84){var _0x2ce9bd={},_0x350462={},_0xbd5249={'count':0x0,'rows':[]};var _0x58c10a=_['map'](db[_0x05b2('0x26')]['rawAttributes'],function(_0x5d13c7){return{'name':_0x5d13c7[_0x05b2('0x27')],'type':_0x5d13c7[_0x05b2('0x28')][_0x05b2('0x29')]};});_0x350462['model']=_[_0x05b2('0x2a')](_0x58c10a,_0x05b2('0x23'));_0x350462[_0x05b2('0x2b')]=_[_0x05b2('0x2c')](_0x5289ff[_0x05b2('0x2b')]);_0x350462[_0x05b2('0x2d')]=_[_0x05b2('0x2e')](_0x350462['model'],_0x350462[_0x05b2('0x2b')]);_0x2ce9bd['attributes']=_[_0x05b2('0x2e')](_0x350462[_0x05b2('0x2f')],qs[_0x05b2('0x30')](_0x5289ff[_0x05b2('0x2b')][_0x05b2('0x30')]));_0x2ce9bd['attributes']=_0x2ce9bd['attributes'][_0x05b2('0x31')]?_0x2ce9bd[_0x05b2('0x32')]:_0x350462[_0x05b2('0x2f')];if(!_0x5289ff[_0x05b2('0x2b')]['hasOwnProperty'](_0x05b2('0x33'))){_0x2ce9bd[_0x05b2('0x1b')]=qs[_0x05b2('0x1b')](_0x5289ff[_0x05b2('0x2b')][_0x05b2('0x1b')]);_0x2ce9bd[_0x05b2('0x1a')]=qs[_0x05b2('0x1a')](_0x5289ff['query'][_0x05b2('0x1a')]);}_0x2ce9bd[_0x05b2('0x34')]=qs[_0x05b2('0x35')](_0x5289ff[_0x05b2('0x2b')][_0x05b2('0x35')]);_0x2ce9bd[_0x05b2('0x36')]=qs[_0x05b2('0x2d')](_[_0x05b2('0x37')](_0x5289ff[_0x05b2('0x2b')],_0x350462[_0x05b2('0x2d')]),_0x58c10a);if(_0x5289ff[_0x05b2('0x2b')]['filter']){_0x2ce9bd['where']=_[_0x05b2('0x38')](_0x2ce9bd[_0x05b2('0x36')],{'$or':_[_0x05b2('0x2a')](_0x58c10a,function(_0x346b8e){if(_0x346b8e['type']!==_0x05b2('0x39')){var _0x4ce8e6={};_0x4ce8e6[_0x346b8e[_0x05b2('0x23')]]={'$like':'%'+_0x5289ff[_0x05b2('0x2b')][_0x05b2('0x3a')]+'%'};return _0x4ce8e6;}})});}_0x2ce9bd=_[_0x05b2('0x38')]({},_0x2ce9bd,_0x5289ff[_0x05b2('0x3b')]);var _0x4ed775={'where':_0x2ce9bd[_0x05b2('0x36')]};return db['SquareReport'][_0x05b2('0x3c')](_0x4ed775)[_0x05b2('0x20')](function(_0x35e41a){_0xbd5249[_0x05b2('0x3c')]=_0x35e41a;if(_0x5289ff[_0x05b2('0x2b')][_0x05b2('0x3d')]){_0x2ce9bd[_0x05b2('0x3e')]=[{'all':!![]}];}return db['SquareReport'][_0x05b2('0x3f')](_0x2ce9bd);})['then'](function(_0x47079d){_0xbd5249[_0x05b2('0x40')]=_0x47079d;return _0xbd5249;})[_0x05b2('0x20')](respondWithFilteredResult(_0x3e8a84,_0x2ce9bd))['catch'](handleError(_0x3e8a84,null));};exports[_0x05b2('0x41')]=function(_0xb25421,_0x39ef3a){var _0x431bac={'raw':!![],'where':{'id':_0xb25421[_0x05b2('0x42')]['id']}},_0x29e40f={};_0x29e40f[_0x05b2('0x2f')]=_[_0x05b2('0x2c')](db[_0x05b2('0x26')][_0x05b2('0x43')]);_0x29e40f[_0x05b2('0x2b')]=_[_0x05b2('0x2c')](_0xb25421[_0x05b2('0x2b')]);_0x29e40f[_0x05b2('0x2d')]=_[_0x05b2('0x2e')](_0x29e40f[_0x05b2('0x2f')],_0x29e40f[_0x05b2('0x2b')]);_0x431bac[_0x05b2('0x32')]=_['intersection'](_0x29e40f['model'],qs['fields'](_0xb25421[_0x05b2('0x2b')][_0x05b2('0x30')]));_0x431bac[_0x05b2('0x32')]=_0x431bac[_0x05b2('0x32')][_0x05b2('0x31')]?_0x431bac['attributes']:_0x29e40f[_0x05b2('0x2f')];if(_0xb25421[_0x05b2('0x2b')][_0x05b2('0x3d')]){_0x431bac[_0x05b2('0x3e')]=[{'all':!![]}];}_0x431bac=_[_0x05b2('0x38')]({},_0x431bac,_0xb25421[_0x05b2('0x3b')]);return db[_0x05b2('0x26')]['find'](_0x431bac)[_0x05b2('0x20')](handleEntityNotFound(_0x39ef3a,null))[_0x05b2('0x20')](respondWithResult(_0x39ef3a,null))[_0x05b2('0x44')](handleError(_0x39ef3a,null));};exports[_0x05b2('0x45')]=function(_0x544091,_0x3e000e){return db[_0x05b2('0x26')][_0x05b2('0x45')](_0x544091[_0x05b2('0x46')],{})['then'](respondWithResult(_0x3e000e,0xc9))['catch'](handleError(_0x3e000e,null));};exports[_0x05b2('0x1f')]=function(_0x2a3821,_0x2047c6){if(_0x2a3821[_0x05b2('0x46')]['id']){delete _0x2a3821[_0x05b2('0x46')]['id'];}return db[_0x05b2('0x26')][_0x05b2('0x47')]({'where':{'id':_0x2a3821[_0x05b2('0x42')]['id']}})['then'](handleEntityNotFound(_0x2047c6,null))['then'](saveUpdates(_0x2a3821[_0x05b2('0x46')],null))[_0x05b2('0x20')](respondWithResult(_0x2047c6,null))[_0x05b2('0x44')](handleError(_0x2047c6,null));};exports[_0x05b2('0x48')]=function(_0x1e42d3,_0x54a570){return db['SquareReport']['find']({'where':{'id':_0x1e42d3[_0x05b2('0x42')]['id']}})[_0x05b2('0x20')](handleEntityNotFound(_0x54a570,null))['then'](removeEntity(_0x54a570,null))[_0x05b2('0x44')](handleError(_0x54a570,null));};exports['describe']=function(_0x38e072,_0x43c143){return db[_0x05b2('0x26')][_0x05b2('0x49')]()[_0x05b2('0x20')](respondWithResult(_0x43c143,null))['catch'](handleError(_0x43c143,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index 9eb80ae..d3f3113 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 _0x1672=['lodash','util','../../config/logger','moment','bluebird','path','./squareReport.attributes','exports','define','SquareReport','report_square','uid_pname','uniqueid','project_name','leaveAt'];(function(_0x4b2251,_0x393f10){var _0x5d22fb=function(_0x10992c){while(--_0x10992c){_0x4b2251['push'](_0x4b2251['shift']());}};_0x5d22fb(++_0x393f10);}(_0x1672,0xa5));var _0x2167=function(_0x1b8a41,_0x314ba0){_0x1b8a41=_0x1b8a41-0x0;var _0x4641cc=_0x1672[_0x1b8a41];return _0x4641cc;};'use strict';var _=require(_0x2167('0x0'));var util=require(_0x2167('0x1'));var logger=require(_0x2167('0x2'))('api');var moment=require(_0x2167('0x3'));var BPromise=require(_0x2167('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2167('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x2167('0x6'));module[_0x2167('0x7')]=function(_0x54179c,_0x397ed5){return _0x54179c[_0x2167('0x8')](_0x2167('0x9'),attributes,{'tableName':_0x2167('0xa'),'paranoid':![],'indexes':[{'name':_0x2167('0xb'),'fields':[_0x2167('0xc'),_0x2167('0xd')]},{'name':_0x2167('0xe'),'fields':[_0x2167('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa9bc=['SquareReport','report_square','uid_pname','uniqueid','project_name','leaveAt','lodash','../../config/logger','api','moment','request-promise','../../config/environment','./squareReport.attributes','define'];(function(_0x54e856,_0x313d5c){var _0x124873=function(_0x48547e){while(--_0x48547e){_0x54e856['push'](_0x54e856['shift']());}};_0x124873(++_0x313d5c);}(_0xa9bc,0x148));var _0xca9b=function(_0x222c40,_0x4f91ea){_0x222c40=_0x222c40-0x0;var _0x355d20=_0xa9bc[_0x222c40];return _0x355d20;};'use strict';var _=require(_0xca9b('0x0'));var util=require('util');var logger=require(_0xca9b('0x1'))(_0xca9b('0x2'));var moment=require(_0xca9b('0x3'));var BPromise=require('bluebird');var rp=require(_0xca9b('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xca9b('0x5'));var attributes=require(_0xca9b('0x6'));module['exports']=function(_0x13a7bb,_0x1c331d){return _0x13a7bb[_0xca9b('0x7')](_0xca9b('0x8'),attributes,{'tableName':_0xca9b('0x9'),'paranoid':![],'indexes':[{'name':_0xca9b('0xa'),'fields':[_0xca9b('0xb'),_0xca9b('0xc')]},{'name':_0xca9b('0xd'),'fields':[_0xca9b('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index 658632d..6352b66 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 _0xd4ba=['create','options','CreateSquareReport','SquareReport','update','raw','where','attributes','limit','UpdateSquareReport','lodash','util','moment','ioredis','../../mysqldb','jayson/promise','client','request','then','info','SquareReport,\x20%s,\x20%s','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch'];(function(_0xc35549,_0x1c72f4){var _0x20fe81=function(_0x1519a0){while(--_0x1519a0){_0xc35549['push'](_0xc35549['shift']());}};_0x20fe81(++_0x1c72f4);}(_0xd4ba,0x10f));var _0xad4b=function(_0x31741c,_0x3b500c){_0x31741c=_0x31741c-0x0;var _0x2f0c37=_0xd4ba[_0x31741c];return _0x2f0c37;};'use strict';var _=require(_0xad4b('0x0'));var util=require(_0xad4b('0x1'));var moment=require(_0xad4b('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xad4b('0x3'));var db=require(_0xad4b('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xad4b('0x5'));var client=jayson[_0xad4b('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4326f2,_0xe7d831,_0xe774dd){return new BPromise(function(_0x323bd1,_0x5bad4c){return client[_0xad4b('0x7')](_0x4326f2,_0xe774dd)[_0xad4b('0x8')](function(_0x3a2130){logger[_0xad4b('0x9')](_0xad4b('0xa'),_0xe7d831,_0xad4b('0xb'));logger[_0xad4b('0xc')](_0xad4b('0xd'),_0xe7d831,'request\x20sent',JSON[_0xad4b('0xe')](_0x3a2130));if(_0x3a2130[_0xad4b('0xf')]){if(_0x3a2130[_0xad4b('0xf')][_0xad4b('0x10')]===0x1f4){logger['error'](_0xad4b('0xa'),_0xe7d831,_0x3a2130['error'][_0xad4b('0x11')]);return _0x5bad4c(_0x3a2130['error'][_0xad4b('0x11')]);}logger[_0xad4b('0xf')]('SquareReport,\x20%s,\x20%s',_0xe7d831,_0x3a2130[_0xad4b('0xf')][_0xad4b('0x11')]);return _0x323bd1(_0x3a2130[_0xad4b('0xf')][_0xad4b('0x11')]);}else{logger[_0xad4b('0x9')](_0xad4b('0xa'),_0xe7d831,_0xad4b('0xb'));_0x323bd1(_0x3a2130['result']['message']);}})[_0xad4b('0x12')](function(_0x4e17ba){logger['error']('SquareReport,\x20%s,\x20%s',_0xe7d831,_0x4e17ba);_0x5bad4c(_0x4e17ba);});});}exports['CreateSquareReport']=function(_0x13bfb1){var _0x239390=this;return new Promise(function(_0x19d611,_0x587ba){return db['SquareReport'][_0xad4b('0x13')](_0x13bfb1['body'],{'raw':_0x13bfb1[_0xad4b('0x14')]?_0x13bfb1[_0xad4b('0x14')]['raw']===undefined?!![]:![]:!![]})[_0xad4b('0x8')](function(_0x1df58d){logger['info'](_0xad4b('0x15'),_0x13bfb1);logger['debug'](_0xad4b('0x15'),_0x13bfb1,JSON['stringify'](_0x1df58d));_0x19d611(_0x1df58d);})[_0xad4b('0x12')](function(_0x4e28e2){logger[_0xad4b('0xf')]('CreateSquareReport',_0x4e28e2[_0xad4b('0x11')],_0x13bfb1);_0x587ba(_0x239390[_0xad4b('0xf')](0x1f4,_0x4e28e2[_0xad4b('0x11')]));});});};exports['UpdateSquareReport']=function(_0x1d9542){var _0xcf4986=this;return new Promise(function(_0x197651,_0x3c1e2d){return db[_0xad4b('0x16')][_0xad4b('0x17')](_0x1d9542['body'],{'raw':_0x1d9542['options']?_0x1d9542[_0xad4b('0x14')][_0xad4b('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1d9542[_0xad4b('0x14')]?_0x1d9542[_0xad4b('0x14')][_0xad4b('0x19')]||null:null,'attributes':_0x1d9542['options']?_0x1d9542[_0xad4b('0x14')][_0xad4b('0x1a')]||null:null,'limit':_0x1d9542['options']?_0x1d9542['options'][_0xad4b('0x1b')]||null:null})[_0xad4b('0x8')](function(_0x379865){logger['info'](_0xad4b('0x1c'),_0x1d9542);logger[_0xad4b('0xc')](_0xad4b('0x1c'),_0x1d9542,JSON[_0xad4b('0xe')](_0x379865));_0x197651(_0x379865);})['catch'](function(_0x5e4b47){logger[_0xad4b('0xf')](_0xad4b('0x1c'),_0x5e4b47[_0xad4b('0x11')],_0x1d9542);_0x3c1e2d(_0xcf4986['error'](0x1f4,_0x5e4b47[_0xad4b('0x11')]));});});}; \ No newline at end of file +var _0xe81d=['info','SquareReport,\x20%s,\x20%s','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateSquareReport','SquareReport','create','body','options','raw','UpdateSquareReport','update','where','limit','lodash','bluebird','../../config/logger','jayson/promise','request','then'];(function(_0x1d5cbb,_0x425e7f){var _0x1da5d5=function(_0x462f8d){while(--_0x462f8d){_0x1d5cbb['push'](_0x1d5cbb['shift']());}};_0x1da5d5(++_0x425e7f);}(_0xe81d,0x81));var _0xde81=function(_0x46f3fa,_0x3dd600){_0x46f3fa=_0x46f3fa-0x0;var _0x4a4699=_0xe81d[_0x46f3fa];return _0x4a4699;};'use strict';var _=require(_0xde81('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xde81('0x1'));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(_0xde81('0x2'))('rpc');var config=require('../../config/environment');var jayson=require(_0xde81('0x3'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x531f0d,_0x30d9cf,_0x5a002b){return new BPromise(function(_0x232c97,_0x4305eb){return client[_0xde81('0x4')](_0x531f0d,_0x5a002b)[_0xde81('0x5')](function(_0x4504c9){logger[_0xde81('0x6')](_0xde81('0x7'),_0x30d9cf,_0xde81('0x8'));logger[_0xde81('0x9')](_0xde81('0xa'),_0x30d9cf,'request\x20sent',JSON[_0xde81('0xb')](_0x4504c9));if(_0x4504c9[_0xde81('0xc')]){if(_0x4504c9[_0xde81('0xc')][_0xde81('0xd')]===0x1f4){logger[_0xde81('0xc')](_0xde81('0x7'),_0x30d9cf,_0x4504c9[_0xde81('0xc')][_0xde81('0xe')]);return _0x4305eb(_0x4504c9[_0xde81('0xc')][_0xde81('0xe')]);}logger[_0xde81('0xc')]('SquareReport,\x20%s,\x20%s',_0x30d9cf,_0x4504c9[_0xde81('0xc')][_0xde81('0xe')]);return _0x232c97(_0x4504c9[_0xde81('0xc')][_0xde81('0xe')]);}else{logger['info'](_0xde81('0x7'),_0x30d9cf,_0xde81('0x8'));_0x232c97(_0x4504c9[_0xde81('0xf')][_0xde81('0xe')]);}})[_0xde81('0x10')](function(_0x4c0243){logger[_0xde81('0xc')](_0xde81('0x7'),_0x30d9cf,_0x4c0243);_0x4305eb(_0x4c0243);});});}exports[_0xde81('0x11')]=function(_0x313d9c){var _0x5090ac=this;return new Promise(function(_0x96e85,_0x4af44a){return db[_0xde81('0x12')][_0xde81('0x13')](_0x313d9c[_0xde81('0x14')],{'raw':_0x313d9c[_0xde81('0x15')]?_0x313d9c[_0xde81('0x15')][_0xde81('0x16')]===undefined?!![]:![]:!![]})[_0xde81('0x5')](function(_0x59e414){logger[_0xde81('0x6')](_0xde81('0x11'),_0x313d9c);logger[_0xde81('0x9')](_0xde81('0x11'),_0x313d9c,JSON['stringify'](_0x59e414));_0x96e85(_0x59e414);})[_0xde81('0x10')](function(_0x576c90){logger[_0xde81('0xc')]('CreateSquareReport',_0x576c90[_0xde81('0xe')],_0x313d9c);_0x4af44a(_0x5090ac['error'](0x1f4,_0x576c90[_0xde81('0xe')]));});});};exports[_0xde81('0x17')]=function(_0x83a64c){var _0x95ec9=this;return new Promise(function(_0x1f06f7,_0x53e10a){return db[_0xde81('0x12')][_0xde81('0x18')](_0x83a64c[_0xde81('0x14')],{'raw':_0x83a64c[_0xde81('0x15')]?_0x83a64c['options'][_0xde81('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x83a64c[_0xde81('0x15')]?_0x83a64c['options'][_0xde81('0x19')]||null:null,'attributes':_0x83a64c[_0xde81('0x15')]?_0x83a64c[_0xde81('0x15')]['attributes']||null:null,'limit':_0x83a64c[_0xde81('0x15')]?_0x83a64c['options'][_0xde81('0x1a')]||null:null})[_0xde81('0x5')](function(_0x45c875){logger['info'](_0xde81('0x17'),_0x83a64c);logger[_0xde81('0x9')](_0xde81('0x17'),_0x83a64c,JSON[_0xde81('0xb')](_0x45c875));_0x1f06f7(_0x45c875);})[_0xde81('0x10')](function(_0x214d86){logger['error'](_0xde81('0x17'),_0x214d86[_0xde81('0xe')],_0x83a64c);_0x53e10a(_0x95ec9[_0xde81('0xc')](0x1f4,_0x214d86[_0xde81('0xe')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index 381fd71..a80a265 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 _0x28e4=['fs-extra','../../components/auth/service','./squareReportDetail.controller','get','isAuthenticated','index','describe','show','create','put','/:id','update','destroy','multer','util','path','express','Router'];(function(_0x839d86,_0x5598d3){var _0x555ca8=function(_0x390b6a){while(--_0x390b6a){_0x839d86['push'](_0x839d86['shift']());}};_0x555ca8(++_0x5598d3);}(_0x28e4,0x13f));var _0x428e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x28e4[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x428e('0x0'));var util=require(_0x428e('0x1'));var path=require(_0x428e('0x2'));var timeout=require('connect-timeout');var express=require(_0x428e('0x3'));var router=express[_0x428e('0x4')]();var fs_extra=require(_0x428e('0x5'));var auth=require(_0x428e('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x428e('0x7'));router[_0x428e('0x8')]('/',auth[_0x428e('0x9')](),controller[_0x428e('0xa')]);router[_0x428e('0x8')]('/describe',auth['isAuthenticated'](),controller[_0x428e('0xb')]);router['get']('/:id',auth[_0x428e('0x9')](),controller[_0x428e('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x428e('0xd')]);router[_0x428e('0xe')](_0x428e('0xf'),auth[_0x428e('0x9')](),controller[_0x428e('0x10')]);router['delete']('/:id',auth[_0x428e('0x9')](),controller[_0x428e('0x11')]);module['exports']=router; \ No newline at end of file +var _0xa173=['isAuthenticated','index','/describe','describe','/:id','show','create','put','update','delete','destroy','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','get'];(function(_0x4eafc5,_0x203b54){var _0x5e20db=function(_0x364b6a){while(--_0x364b6a){_0x4eafc5['push'](_0x4eafc5['shift']());}};_0x5e20db(++_0x203b54);}(_0xa173,0x1c3));var _0x3a17=function(_0x577cc5,_0x2e8586){_0x577cc5=_0x577cc5-0x0;var _0x509960=_0xa173[_0x577cc5];return _0x509960;};'use strict';var multer=require(_0x3a17('0x0'));var util=require(_0x3a17('0x1'));var path=require(_0x3a17('0x2'));var timeout=require(_0x3a17('0x3'));var express=require('express');var router=express[_0x3a17('0x4')]();var fs_extra=require(_0x3a17('0x5'));var auth=require(_0x3a17('0x6'));var interaction=require(_0x3a17('0x7'));var config=require(_0x3a17('0x8'));var controller=require(_0x3a17('0x9'));router[_0x3a17('0xa')]('/',auth[_0x3a17('0xb')](),controller[_0x3a17('0xc')]);router[_0x3a17('0xa')](_0x3a17('0xd'),auth[_0x3a17('0xb')](),controller[_0x3a17('0xe')]);router[_0x3a17('0xa')](_0x3a17('0xf'),auth[_0x3a17('0xb')](),controller[_0x3a17('0x10')]);router['post']('/',auth['isAuthenticated'](),controller[_0x3a17('0x11')]);router[_0x3a17('0x12')](_0x3a17('0xf'),auth[_0x3a17('0xb')](),controller[_0x3a17('0x13')]);router[_0x3a17('0x14')](_0x3a17('0xf'),auth[_0x3a17('0xb')](),controller[_0x3a17('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index 4376fea..427bb4a 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 _0x9dc3=['exports','STRING','sequelize'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x9dc3,0x9b));var _0x39dc=function(_0x32e580,_0x517fd2){_0x32e580=_0x32e580-0x0;var _0x2defc4=_0x9dc3[_0x32e580];return _0x2defc4;};'use strict';var Sequelize=require(_0x39dc('0x0'));module[_0x39dc('0x1')]={'uniqueid':{'type':Sequelize[_0x39dc('0x2')]},'node':{'type':Sequelize[_0x39dc('0x2')]},'application':{'type':Sequelize[_0x39dc('0x2')]},'data':{'type':Sequelize['TEXT']},'project_name':{'type':Sequelize[_0x39dc('0x2')]},'callerid':{'type':Sequelize[_0x39dc('0x2')]}}; \ No newline at end of file +var _0x4631=['exports','STRING','sequelize'];(function(_0x107554,_0x5c2947){var _0x1d7876=function(_0xb51431){while(--_0xb51431){_0x107554['push'](_0x107554['shift']());}};_0x1d7876(++_0x5c2947);}(_0x4631,0xb9));var _0x1463=function(_0x4b26b5,_0x4f71fd){_0x4b26b5=_0x4b26b5-0x0;var _0x4dec71=_0x4631[_0x4b26b5];return _0x4dec71;};'use strict';var Sequelize=require(_0x1463('0x0'));module[_0x1463('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'node':{'type':Sequelize[_0x1463('0x2')]},'application':{'type':Sequelize['STRING']},'data':{'type':Sequelize['TEXT']},'project_name':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index 90dd1b2..39df047 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 _0xd596=['sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','params','keys','find','catch','create','update','body','describe','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','then','destroy','error','stack','name','send','index','map','SquareDetailsReport','rawAttributes','fieldName','type','model','filters','attributes','intersection','fields','query','length','nolimit','order'];(function(_0x162c47,_0xc67687){var _0x4b90d5=function(_0x232641){while(--_0x232641){_0x162c47['push'](_0x162c47['shift']());}};_0x4b90d5(++_0xc67687);}(_0xd596,0x199));var _0x6d59=function(_0x496333,_0x1c47d6){_0x496333=_0x496333-0x0;var _0x44256e=_0xd596[_0x496333];return _0x44256e;};'use strict';var emlformat=require(_0x6d59('0x0'));var rimraf=require(_0x6d59('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6d59('0x2'));var rp=require('request-promise');var moment=require(_0x6d59('0x3'));var BPromise=require(_0x6d59('0x4'));var Mustache=require(_0x6d59('0x5'));var util=require(_0x6d59('0x6'));var path=require(_0x6d59('0x7'));var sox=require(_0x6d59('0x8'));var csv=require(_0x6d59('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6d59('0xa'));var squel=require(_0x6d59('0xb'));var crypto=require(_0x6d59('0xc'));var jsforce=require(_0x6d59('0xd'));var deskjs=require(_0x6d59('0xe'));var toCsv=require(_0x6d59('0x9'));var querystring=require(_0x6d59('0xf'));var Papa=require(_0x6d59('0x10'));var Redis=require(_0x6d59('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x6d59('0x12'));var as=require(_0x6d59('0x13'));var hardwareService=require(_0x6d59('0x14'));var logger=require('../../config/logger')(_0x6d59('0x15'));var utils=require(_0x6d59('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x6d59('0x17'));var db=require(_0x6d59('0x18'))['db'];function respondWithStatusCode(_0x435e7f,_0x327d77){_0x327d77=_0x327d77||0xcc;return function(_0x3a5991){if(_0x3a5991){return _0x435e7f[_0x6d59('0x19')](_0x327d77);}return _0x435e7f[_0x6d59('0x1a')](_0x327d77)[_0x6d59('0x1b')]();};}function respondWithResult(_0x50582a,_0x4d90bf){_0x4d90bf=_0x4d90bf||0xc8;return function(_0x4de6c9){if(_0x4de6c9){return _0x50582a[_0x6d59('0x1a')](_0x4d90bf)['json'](_0x4de6c9);}};}function respondWithFilteredResult(_0x251a64,_0x2b9b1d){return function(_0xeed5c6){if(_0xeed5c6){var _0x7c743e=typeof _0x2b9b1d[_0x6d59('0x1c')]==='undefined'&&typeof _0x2b9b1d['limit']===_0x6d59('0x1d');var _0x2fca74=_0xeed5c6[_0x6d59('0x1e')];var _0x50b4d9=_0x7c743e?0x0:_0x2b9b1d[_0x6d59('0x1c')];var _0x158c12=_0x7c743e?_0xeed5c6['count']:_0x2b9b1d[_0x6d59('0x1c')]+_0x2b9b1d[_0x6d59('0x1f')];var _0x540f93;if(_0x158c12>=_0x2fca74){_0x158c12=_0x2fca74;_0x540f93=0xc8;}else{_0x540f93=0xce;}_0x251a64[_0x6d59('0x1a')](_0x540f93);return _0x251a64[_0x6d59('0x20')](_0x6d59('0x21'),_0x50b4d9+'-'+_0x158c12+'/'+_0x2fca74)[_0x6d59('0x22')](_0xeed5c6);}return null;};}function patchUpdates(_0x31b237){return function(_0x37430c){try{jsonpatch[_0x6d59('0x23')](_0x37430c,_0x31b237,!![]);}catch(_0xb74b02){return BPromise[_0x6d59('0x24')](_0xb74b02);}return _0x37430c[_0x6d59('0x25')]();};}function saveUpdates(_0x22862c,_0x22410a){return function(_0x34db7d){if(_0x34db7d){return _0x34db7d['update'](_0x22862c)[_0x6d59('0x26')](function(_0x32995d){return _0x32995d;});}return null;};}function removeEntity(_0x2364ce,_0x551614){return function(_0xd98725){if(_0xd98725){return _0xd98725[_0x6d59('0x27')]()['then'](function(){_0x2364ce[_0x6d59('0x1a')](0xcc)[_0x6d59('0x1b')]();});}};}function handleEntityNotFound(_0x30814d,_0x5a1782){return function(_0x474597){if(!_0x474597){_0x30814d[_0x6d59('0x19')](0x194);}return _0x474597;};}function handleError(_0x2a0fc1,_0x1bac13){_0x1bac13=_0x1bac13||0x1f4;return function(_0x1d1ec7){logger[_0x6d59('0x28')](_0x1d1ec7[_0x6d59('0x29')]);if(_0x1d1ec7['name']){delete _0x1d1ec7[_0x6d59('0x2a')];}_0x2a0fc1[_0x6d59('0x1a')](_0x1bac13)[_0x6d59('0x2b')](_0x1d1ec7);};}exports[_0x6d59('0x2c')]=function(_0x455814,_0x2118d0){var _0x488dc2={},_0x267b00={},_0x491d4f={'count':0x0,'rows':[]};var _0x170d27=_[_0x6d59('0x2d')](db[_0x6d59('0x2e')][_0x6d59('0x2f')],function(_0x4b3b65){return{'name':_0x4b3b65[_0x6d59('0x30')],'type':_0x4b3b65[_0x6d59('0x31')]['key']};});_0x267b00[_0x6d59('0x32')]=_['map'](_0x170d27,_0x6d59('0x2a'));_0x267b00['query']=_['keys'](_0x455814['query']);_0x267b00[_0x6d59('0x33')]=_['intersection'](_0x267b00['model'],_0x267b00['query']);_0x488dc2[_0x6d59('0x34')]=_[_0x6d59('0x35')](_0x267b00[_0x6d59('0x32')],qs[_0x6d59('0x36')](_0x455814[_0x6d59('0x37')][_0x6d59('0x36')]));_0x488dc2[_0x6d59('0x34')]=_0x488dc2[_0x6d59('0x34')][_0x6d59('0x38')]?_0x488dc2[_0x6d59('0x34')]:_0x267b00[_0x6d59('0x32')];if(!_0x455814[_0x6d59('0x37')]['hasOwnProperty'](_0x6d59('0x39'))){_0x488dc2[_0x6d59('0x1f')]=qs['limit'](_0x455814[_0x6d59('0x37')][_0x6d59('0x1f')]);_0x488dc2[_0x6d59('0x1c')]=qs[_0x6d59('0x1c')](_0x455814['query'][_0x6d59('0x1c')]);}_0x488dc2[_0x6d59('0x3a')]=qs['sort'](_0x455814['query'][_0x6d59('0x3b')]);_0x488dc2[_0x6d59('0x3c')]=qs[_0x6d59('0x33')](_[_0x6d59('0x3d')](_0x455814[_0x6d59('0x37')],_0x267b00[_0x6d59('0x33')]),_0x170d27);if(_0x455814[_0x6d59('0x37')][_0x6d59('0x3e')]){_0x488dc2[_0x6d59('0x3c')]=_[_0x6d59('0x3f')](_0x488dc2[_0x6d59('0x3c')],{'$or':_[_0x6d59('0x2d')](_0x170d27,function(_0x47c731){if(_0x47c731[_0x6d59('0x31')]!==_0x6d59('0x40')){var _0x5813a9={};_0x5813a9[_0x47c731['name']]={'$like':'%'+_0x455814[_0x6d59('0x37')][_0x6d59('0x3e')]+'%'};return _0x5813a9;}})});}_0x488dc2=_[_0x6d59('0x3f')]({},_0x488dc2,_0x455814[_0x6d59('0x41')]);var _0x11cb03={'where':_0x488dc2['where']};return db[_0x6d59('0x2e')][_0x6d59('0x1e')](_0x11cb03)[_0x6d59('0x26')](function(_0x44ac1a){_0x491d4f['count']=_0x44ac1a;if(_0x455814[_0x6d59('0x37')][_0x6d59('0x42')]){_0x488dc2[_0x6d59('0x43')]=[{'all':!![]}];}return db[_0x6d59('0x2e')][_0x6d59('0x44')](_0x488dc2);})[_0x6d59('0x26')](function(_0x3ec4e9){_0x491d4f['rows']=_0x3ec4e9;return _0x491d4f;})[_0x6d59('0x26')](respondWithFilteredResult(_0x2118d0,_0x488dc2))['catch'](handleError(_0x2118d0,null));};exports[_0x6d59('0x45')]=function(_0x1780a4,_0x3c39fc){var _0x4b5aef={'raw':!![],'where':{'id':_0x1780a4[_0x6d59('0x46')]['id']}},_0x27ffa5={};_0x27ffa5[_0x6d59('0x32')]=_[_0x6d59('0x47')](db[_0x6d59('0x2e')][_0x6d59('0x2f')]);_0x27ffa5['query']=_[_0x6d59('0x47')](_0x1780a4[_0x6d59('0x37')]);_0x27ffa5[_0x6d59('0x33')]=_[_0x6d59('0x35')](_0x27ffa5[_0x6d59('0x32')],_0x27ffa5[_0x6d59('0x37')]);_0x4b5aef[_0x6d59('0x34')]=_[_0x6d59('0x35')](_0x27ffa5[_0x6d59('0x32')],qs[_0x6d59('0x36')](_0x1780a4[_0x6d59('0x37')][_0x6d59('0x36')]));_0x4b5aef['attributes']=_0x4b5aef['attributes'][_0x6d59('0x38')]?_0x4b5aef[_0x6d59('0x34')]:_0x27ffa5[_0x6d59('0x32')];if(_0x1780a4[_0x6d59('0x37')][_0x6d59('0x42')]){_0x4b5aef[_0x6d59('0x43')]=[{'all':!![]}];}_0x4b5aef=_['merge']({},_0x4b5aef,_0x1780a4['options']);return db[_0x6d59('0x2e')][_0x6d59('0x48')](_0x4b5aef)[_0x6d59('0x26')](handleEntityNotFound(_0x3c39fc,null))[_0x6d59('0x26')](respondWithResult(_0x3c39fc,null))[_0x6d59('0x49')](handleError(_0x3c39fc,null));};exports[_0x6d59('0x4a')]=function(_0x5f4426,_0xb150fb){return db[_0x6d59('0x2e')][_0x6d59('0x4a')](_0x5f4426['body'],{})['then'](respondWithResult(_0xb150fb,0xc9))[_0x6d59('0x49')](handleError(_0xb150fb,null));};exports[_0x6d59('0x4b')]=function(_0x50d1a4,_0x16a464){if(_0x50d1a4[_0x6d59('0x4c')]['id']){delete _0x50d1a4['body']['id'];}return db[_0x6d59('0x2e')][_0x6d59('0x48')]({'where':{'id':_0x50d1a4[_0x6d59('0x46')]['id']}})[_0x6d59('0x26')](handleEntityNotFound(_0x16a464,null))[_0x6d59('0x26')](saveUpdates(_0x50d1a4[_0x6d59('0x4c')],null))[_0x6d59('0x26')](respondWithResult(_0x16a464,null))[_0x6d59('0x49')](handleError(_0x16a464,null));};exports['destroy']=function(_0x32a832,_0x358870){return db['SquareDetailsReport'][_0x6d59('0x48')]({'where':{'id':_0x32a832[_0x6d59('0x46')]['id']}})[_0x6d59('0x26')](handleEntityNotFound(_0x358870,null))[_0x6d59('0x26')](removeEntity(_0x358870,null))[_0x6d59('0x49')](handleError(_0x358870,null));};exports[_0x6d59('0x4d')]=function(_0x52f9d9,_0x20801e){return db[_0x6d59('0x2e')]['describe']()[_0x6d59('0x26')](respondWithResult(_0x20801e,null))[_0x6d59('0x49')](handleError(_0x20801e,null));}; \ No newline at end of file +var _0x621a=['name','send','index','map','SquareDetailsReport','fieldName','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','filters','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','rawAttributes','find','create','body','params','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','sendStatus','end','status','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','then','destroy','error','stack'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x621a,0x195));var _0xa621=function(_0x3b1705,_0x17bf2e){_0x3b1705=_0x3b1705-0x0;var _0x5157a3=_0x621a[_0x3b1705];return _0x5157a3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa621('0x0'));var zipdir=require(_0xa621('0x1'));var jsonpatch=require(_0xa621('0x2'));var rp=require(_0xa621('0x3'));var moment=require('moment');var BPromise=require(_0xa621('0x4'));var Mustache=require(_0xa621('0x5'));var util=require(_0xa621('0x6'));var path=require(_0xa621('0x7'));var sox=require('sox');var csv=require(_0xa621('0x8'));var ejs=require(_0xa621('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xa621('0xa'));var crypto=require(_0xa621('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xa621('0xc'));var toCsv=require(_0xa621('0x8'));var querystring=require(_0xa621('0xd'));var Papa=require(_0xa621('0xe'));var Redis=require(_0xa621('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xa621('0x10'));var as=require(_0xa621('0x11'));var hardwareService=require(_0xa621('0x12'));var logger=require(_0xa621('0x13'))('api');var utils=require(_0xa621('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xa621('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2ad037,_0x5e41ae){_0x5e41ae=_0x5e41ae||0xcc;return function(_0x1e56ff){if(_0x1e56ff){return _0x2ad037[_0xa621('0x16')](_0x5e41ae);}return _0x2ad037['status'](_0x5e41ae)[_0xa621('0x17')]();};}function respondWithResult(_0x50268a,_0x203453){_0x203453=_0x203453||0xc8;return function(_0x344ce7){if(_0x344ce7){return _0x50268a[_0xa621('0x18')](_0x203453)[_0xa621('0x19')](_0x344ce7);}};}function respondWithFilteredResult(_0x4c8491,_0x5e8f46){return function(_0x12c8a4){if(_0x12c8a4){var _0xc0bce8=typeof _0x5e8f46[_0xa621('0x1a')]===_0xa621('0x1b')&&typeof _0x5e8f46['limit']===_0xa621('0x1b');var _0x878749=_0x12c8a4['count'];var _0x56bc10=_0xc0bce8?0x0:_0x5e8f46[_0xa621('0x1a')];var _0x294fcb=_0xc0bce8?_0x12c8a4[_0xa621('0x1c')]:_0x5e8f46['offset']+_0x5e8f46[_0xa621('0x1d')];var _0x134d00;if(_0x294fcb>=_0x878749){_0x294fcb=_0x878749;_0x134d00=0xc8;}else{_0x134d00=0xce;}_0x4c8491[_0xa621('0x18')](_0x134d00);return _0x4c8491['set'](_0xa621('0x1e'),_0x56bc10+'-'+_0x294fcb+'/'+_0x878749)[_0xa621('0x19')](_0x12c8a4);}return null;};}function patchUpdates(_0xb1bd54){return function(_0x4e3f50){try{jsonpatch[_0xa621('0x1f')](_0x4e3f50,_0xb1bd54,!![]);}catch(_0x36a7ea){return BPromise[_0xa621('0x20')](_0x36a7ea);}return _0x4e3f50[_0xa621('0x21')]();};}function saveUpdates(_0x188c6e,_0x551026){return function(_0x35b386){if(_0x35b386){return _0x35b386[_0xa621('0x22')](_0x188c6e)[_0xa621('0x23')](function(_0x1d4716){return _0x1d4716;});}return null;};}function removeEntity(_0x4faeba,_0x5f2102){return function(_0x5c6147){if(_0x5c6147){return _0x5c6147[_0xa621('0x24')]()[_0xa621('0x23')](function(){_0x4faeba[_0xa621('0x18')](0xcc)[_0xa621('0x17')]();});}};}function handleEntityNotFound(_0xd3fae6,_0x4b5c46){return function(_0x7e8946){if(!_0x7e8946){_0xd3fae6[_0xa621('0x16')](0x194);}return _0x7e8946;};}function handleError(_0x3601ac,_0x1d6efe){_0x1d6efe=_0x1d6efe||0x1f4;return function(_0x3436c4){logger[_0xa621('0x25')](_0x3436c4[_0xa621('0x26')]);if(_0x3436c4[_0xa621('0x27')]){delete _0x3436c4[_0xa621('0x27')];}_0x3601ac[_0xa621('0x18')](_0x1d6efe)[_0xa621('0x28')](_0x3436c4);};}exports[_0xa621('0x29')]=function(_0x2287e7,_0x1d8b16){var _0x36a090={},_0x4d4cc4={},_0x5b3cf0={'count':0x0,'rows':[]};var _0x35d7a8=_[_0xa621('0x2a')](db[_0xa621('0x2b')]['rawAttributes'],function(_0xdeb0c6){return{'name':_0xdeb0c6[_0xa621('0x2c')],'type':_0xdeb0c6['type'][_0xa621('0x2d')]};});_0x4d4cc4[_0xa621('0x2e')]=_[_0xa621('0x2a')](_0x35d7a8,_0xa621('0x27'));_0x4d4cc4[_0xa621('0x2f')]=_[_0xa621('0x30')](_0x2287e7[_0xa621('0x2f')]);_0x4d4cc4['filters']=_['intersection'](_0x4d4cc4[_0xa621('0x2e')],_0x4d4cc4[_0xa621('0x2f')]);_0x36a090[_0xa621('0x31')]=_[_0xa621('0x32')](_0x4d4cc4[_0xa621('0x2e')],qs['fields'](_0x2287e7[_0xa621('0x2f')][_0xa621('0x33')]));_0x36a090[_0xa621('0x31')]=_0x36a090['attributes'][_0xa621('0x34')]?_0x36a090[_0xa621('0x31')]:_0x4d4cc4[_0xa621('0x2e')];if(!_0x2287e7[_0xa621('0x2f')][_0xa621('0x35')](_0xa621('0x36'))){_0x36a090[_0xa621('0x1d')]=qs[_0xa621('0x1d')](_0x2287e7[_0xa621('0x2f')][_0xa621('0x1d')]);_0x36a090['offset']=qs[_0xa621('0x1a')](_0x2287e7[_0xa621('0x2f')][_0xa621('0x1a')]);}_0x36a090['order']=qs[_0xa621('0x37')](_0x2287e7[_0xa621('0x2f')][_0xa621('0x37')]);_0x36a090[_0xa621('0x38')]=qs[_0xa621('0x39')](_['pick'](_0x2287e7[_0xa621('0x2f')],_0x4d4cc4['filters']),_0x35d7a8);if(_0x2287e7[_0xa621('0x2f')][_0xa621('0x3a')]){_0x36a090[_0xa621('0x38')]=_[_0xa621('0x3b')](_0x36a090['where'],{'$or':_[_0xa621('0x2a')](_0x35d7a8,function(_0x4f7a57){if(_0x4f7a57[_0xa621('0x3c')]!==_0xa621('0x3d')){var _0x19d45f={};_0x19d45f[_0x4f7a57[_0xa621('0x27')]]={'$like':'%'+_0x2287e7[_0xa621('0x2f')]['filter']+'%'};return _0x19d45f;}})});}_0x36a090=_[_0xa621('0x3b')]({},_0x36a090,_0x2287e7[_0xa621('0x3e')]);var _0x19e3e6={'where':_0x36a090[_0xa621('0x38')]};return db[_0xa621('0x2b')][_0xa621('0x1c')](_0x19e3e6)[_0xa621('0x23')](function(_0x3eb569){_0x5b3cf0[_0xa621('0x1c')]=_0x3eb569;if(_0x2287e7[_0xa621('0x2f')][_0xa621('0x3f')]){_0x36a090[_0xa621('0x40')]=[{'all':!![]}];}return db['SquareDetailsReport'][_0xa621('0x41')](_0x36a090);})[_0xa621('0x23')](function(_0x5ba307){_0x5b3cf0[_0xa621('0x42')]=_0x5ba307;return _0x5b3cf0;})[_0xa621('0x23')](respondWithFilteredResult(_0x1d8b16,_0x36a090))[_0xa621('0x43')](handleError(_0x1d8b16,null));};exports[_0xa621('0x44')]=function(_0x479970,_0x4a27a1){var _0x35045b={'raw':!![],'where':{'id':_0x479970['params']['id']}},_0x3fd4e5={};_0x3fd4e5['model']=_[_0xa621('0x30')](db['SquareDetailsReport'][_0xa621('0x45')]);_0x3fd4e5[_0xa621('0x2f')]=_[_0xa621('0x30')](_0x479970[_0xa621('0x2f')]);_0x3fd4e5['filters']=_[_0xa621('0x32')](_0x3fd4e5[_0xa621('0x2e')],_0x3fd4e5[_0xa621('0x2f')]);_0x35045b[_0xa621('0x31')]=_[_0xa621('0x32')](_0x3fd4e5[_0xa621('0x2e')],qs[_0xa621('0x33')](_0x479970[_0xa621('0x2f')][_0xa621('0x33')]));_0x35045b[_0xa621('0x31')]=_0x35045b['attributes'][_0xa621('0x34')]?_0x35045b[_0xa621('0x31')]:_0x3fd4e5[_0xa621('0x2e')];if(_0x479970[_0xa621('0x2f')][_0xa621('0x3f')]){_0x35045b[_0xa621('0x40')]=[{'all':!![]}];}_0x35045b=_[_0xa621('0x3b')]({},_0x35045b,_0x479970[_0xa621('0x3e')]);return db[_0xa621('0x2b')][_0xa621('0x46')](_0x35045b)[_0xa621('0x23')](handleEntityNotFound(_0x4a27a1,null))['then'](respondWithResult(_0x4a27a1,null))[_0xa621('0x43')](handleError(_0x4a27a1,null));};exports[_0xa621('0x47')]=function(_0x596710,_0x9d50e0){return db[_0xa621('0x2b')][_0xa621('0x47')](_0x596710[_0xa621('0x48')],{})[_0xa621('0x23')](respondWithResult(_0x9d50e0,0xc9))[_0xa621('0x43')](handleError(_0x9d50e0,null));};exports[_0xa621('0x22')]=function(_0x56aade,_0x2071a0){if(_0x56aade['body']['id']){delete _0x56aade[_0xa621('0x48')]['id'];}return db['SquareDetailsReport'][_0xa621('0x46')]({'where':{'id':_0x56aade[_0xa621('0x49')]['id']}})[_0xa621('0x23')](handleEntityNotFound(_0x2071a0,null))[_0xa621('0x23')](saveUpdates(_0x56aade['body'],null))[_0xa621('0x23')](respondWithResult(_0x2071a0,null))[_0xa621('0x43')](handleError(_0x2071a0,null));};exports['destroy']=function(_0x565069,_0x2bf43d){return db[_0xa621('0x2b')][_0xa621('0x46')]({'where':{'id':_0x565069[_0xa621('0x49')]['id']}})['then'](handleEntityNotFound(_0x2bf43d,null))[_0xa621('0x23')](removeEntity(_0x2bf43d,null))['catch'](handleError(_0x2bf43d,null));};exports['describe']=function(_0x208325,_0x29241c){return db[_0xa621('0x2b')]['describe']()[_0xa621('0x23')](respondWithResult(_0x29241c,null))[_0xa621('0x43')](handleError(_0x29241c,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index 31772e1..2d7c0af 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 _0x5ad5=['lodash','util','api','bluebird','rimraf','../../config/environment','./squareReportDetail.attributes','exports','define','SquareDetailsReport','report_square_details'];(function(_0x56cfd0,_0x57fdb8){var _0xa88e9d=function(_0x4b0a1f){while(--_0x4b0a1f){_0x56cfd0['push'](_0x56cfd0['shift']());}};_0xa88e9d(++_0x57fdb8);}(_0x5ad5,0xa5));var _0x55ad=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x5ad5[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0x55ad('0x0'));var util=require(_0x55ad('0x1'));var logger=require('../../config/logger')(_0x55ad('0x2'));var moment=require('moment');var BPromise=require(_0x55ad('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x55ad('0x4'));var config=require(_0x55ad('0x5'));var attributes=require(_0x55ad('0x6'));module[_0x55ad('0x7')]=function(_0x2c1b27,_0x3f5df7){return _0x2c1b27[_0x55ad('0x8')](_0x55ad('0x9'),attributes,{'tableName':_0x55ad('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7d71=['exports','define','SquareDetailsReport','report_square_details','lodash','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x192a19,_0x5a3ea0){var _0x57626e=function(_0xfff665){while(--_0xfff665){_0x192a19['push'](_0x192a19['shift']());}};_0x57626e(++_0x5a3ea0);}(_0x7d71,0x185));var _0x17d7=function(_0x2064e5,_0x4f6fa2){_0x2064e5=_0x2064e5-0x0;var _0x21a233=_0x7d71[_0x2064e5];return _0x21a233;};'use strict';var _=require(_0x17d7('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x17d7('0x1'));var moment=require('moment');var BPromise=require(_0x17d7('0x2'));var rp=require(_0x17d7('0x3'));var fs=require('fs');var path=require(_0x17d7('0x4'));var rimraf=require(_0x17d7('0x5'));var config=require(_0x17d7('0x6'));var attributes=require('./squareReportDetail.attributes');module[_0x17d7('0x7')]=function(_0x3ed6bf,_0x392103){return _0x3ed6bf[_0x17d7('0x8')](_0x17d7('0x9'),attributes,{'tableName':_0x17d7('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 beb7556..60df8f2 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 _0x4f7b=['util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','SquareDetailsReport','create','body','raw','CreateSquareDetailsReport','debug','lodash'];(function(_0x4b6219,_0x547374){var _0x5e3b9c=function(_0x6bfe1a){while(--_0x6bfe1a){_0x4b6219['push'](_0x4b6219['shift']());}};_0x5e3b9c(++_0x547374);}(_0x4f7b,0x13e));var _0xb4f7=function(_0x594a62,_0x36752a){_0x594a62=_0x594a62-0x0;var _0x4cc591=_0x4f7b[_0x594a62];return _0x4cc591;};'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['CreateSquareDetailsReport']=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')]));});});}; \ No newline at end of file +var _0x15b8=['options','raw','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','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'];(function(_0x20400b,_0x5ddaa4){var _0x1281e6=function(_0x582f13){while(--_0x582f13){_0x20400b['push'](_0x20400b['shift']());}};_0x1281e6(++_0x5ddaa4);}(_0x15b8,0xcd));var _0x815b=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x15b8[_0x397e5f];return _0x5302b8;};'use strict';var _=require('lodash');var util=require(_0x815b('0x0'));var moment=require(_0x815b('0x1'));var BPromise=require(_0x815b('0x2'));var rs=require(_0x815b('0x3'));var fs=require('fs');var Redis=require(_0x815b('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x815b('0x5'));var logger=require(_0x815b('0x6'))(_0x815b('0x7'));var config=require(_0x815b('0x8'));var jayson=require(_0x815b('0x9'));var client=jayson[_0x815b('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1e9fc0,_0xdfdf6,_0x26119a){return new BPromise(function(_0x175053,_0x2170c5){return client[_0x815b('0xb')](_0x1e9fc0,_0x26119a)[_0x815b('0xc')](function(_0x221ce4){logger[_0x815b('0xd')](_0x815b('0xe'),_0xdfdf6,_0x815b('0xf'));logger[_0x815b('0x10')](_0x815b('0x11'),_0xdfdf6,_0x815b('0xf'),JSON[_0x815b('0x12')](_0x221ce4));if(_0x221ce4[_0x815b('0x13')]){if(_0x221ce4[_0x815b('0x13')][_0x815b('0x14')]===0x1f4){logger['error']('SquareDetailsReport,\x20%s,\x20%s',_0xdfdf6,_0x221ce4[_0x815b('0x13')][_0x815b('0x15')]);return _0x2170c5(_0x221ce4['error']['message']);}logger['error'](_0x815b('0xe'),_0xdfdf6,_0x221ce4['error']['message']);return _0x175053(_0x221ce4[_0x815b('0x13')][_0x815b('0x15')]);}else{logger[_0x815b('0xd')]('SquareDetailsReport,\x20%s,\x20%s',_0xdfdf6,'request\x20sent');_0x175053(_0x221ce4[_0x815b('0x16')][_0x815b('0x15')]);}})[_0x815b('0x17')](function(_0x4078db){logger[_0x815b('0x13')](_0x815b('0xe'),_0xdfdf6,_0x4078db);_0x2170c5(_0x4078db);});});}exports[_0x815b('0x18')]=function(_0x92d86a){var _0x26a8a3=this;return new Promise(function(_0x2fa2bd,_0x2ade43){return db[_0x815b('0x19')][_0x815b('0x1a')](_0x92d86a['body'],{'raw':_0x92d86a[_0x815b('0x1b')]?_0x92d86a[_0x815b('0x1b')][_0x815b('0x1c')]===undefined?!![]:![]:!![]})[_0x815b('0xc')](function(_0x3f710c){logger['info'](_0x815b('0x18'),_0x92d86a);logger[_0x815b('0x10')](_0x815b('0x18'),_0x92d86a,JSON['stringify'](_0x3f710c));_0x2fa2bd(_0x3f710c);})['catch'](function(_0x3ffdb7){logger[_0x815b('0x13')](_0x815b('0x18'),_0x3ffdb7[_0x815b('0x15')],_0x92d86a);_0x2ade43(_0x26a8a3[_0x815b('0x13')](0x1f4,_0x3ffdb7[_0x815b('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index 319769a..6b84102 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 _0x4066=['get','index','/process/:pid/kill','express','Router','../../components/auth/service'];(function(_0x10251e,_0x2ef51d){var _0xe4c29a=function(_0x5c5f4f){while(--_0x5c5f4f){_0x10251e['push'](_0x10251e['shift']());}};_0xe4c29a(++_0x2ef51d);}(_0x4066,0x1b3));var _0x6406=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x4066[_0x17d9e3];return _0x14192d;};'use strict';var express=require(_0x6406('0x0'));var router=express[_0x6406('0x1')]();var auth=require(_0x6406('0x2'));var controller=require('./system.controller');router[_0x6406('0x3')]('/',auth['isAuthenticated'](),controller[_0x6406('0x4')]);router['get'](_0x6406('0x5'),auth['isAuthenticated'](),controller['killProcess']);module['exports']=router; \ No newline at end of file +var _0x5b98=['./system.controller','get','index','isAuthenticated','killProcess','Router','../../components/auth/service'];(function(_0x37d8ae,_0x17e484){var _0x4de500=function(_0x538a36){while(--_0x538a36){_0x37d8ae['push'](_0x37d8ae['shift']());}};_0x4de500(++_0x17e484);}(_0x5b98,0x139));var _0x85b9=function(_0x35da42,_0x5c2610){_0x35da42=_0x35da42-0x0;var _0x370035=_0x5b98[_0x35da42];return _0x370035;};'use strict';var express=require('express');var router=express[_0x85b9('0x0')]();var auth=require(_0x85b9('0x1'));var controller=require(_0x85b9('0x2'));router[_0x85b9('0x3')]('/',auth['isAuthenticated'](),controller[_0x85b9('0x4')]);router[_0x85b9('0x3')]('/process/:pid/kill',auth[_0x85b9('0x5')](),controller[_0x85b9('0x6')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index 89221b3..3f03f6b 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 _0xbcc5=['ps\x20-p\x20%s\x20-ww\x20-o\x20args','split','Process\x20with\x20pid\x20%s\x20not\x20found!','params','pid','SIGINT','catch','systeminformation','child_process','exec','api','util','bluebird','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','status','index','getAllData','then','json','killProcess','components/import/cm','format'];(function(_0x3821ab,_0x5ddeed){var _0x181d35=function(_0x4d7430){while(--_0x4d7430){_0x3821ab['push'](_0x3821ab['shift']());}};_0x181d35(++_0x5ddeed);}(_0xbcc5,0xe8));var _0x5bcc=function(_0x8a3ebd,_0x5123ef){_0x8a3ebd=_0x8a3ebd-0x0;var _0x28ae52=_0xbcc5[_0x8a3ebd];return _0x28ae52;};'use strict';var info=require(_0x5bcc('0x0'));var exec=require(_0x5bcc('0x1'))[_0x5bcc('0x2')];var logger=require('../../config/logger')(_0x5bcc('0x3'));var util=require(_0x5bcc('0x4'));var BPromise=require(_0x5bcc('0x5'));var _=require(_0x5bcc('0x6'));function handleError(_0x406df2,_0x33e647,_0x51aec4){_0x33e647=_0x33e647||0x1f4;return function(_0x1cb171){logger[_0x5bcc('0x7')](_0x5bcc('0x8'),_0x51aec4,_0x33e647,util[_0x5bcc('0x9')](_0x1cb171,{'showHidden':![],'depth':null}));delete _0x1cb171['name'];_0x406df2[_0x5bcc('0xa')](_0x33e647)['send'](_0x1cb171);};}exports[_0x5bcc('0xb')]=function(_0x20bc8f,_0x46a080){return info[_0x5bcc('0xc')]()[_0x5bcc('0xd')](function(_0x47c9be){return _0x46a080['status'](0xc8)[_0x5bcc('0xe')](_0x47c9be);})['catch'](function(_0x50e87b){return _0x46a080['status'](0x1f4)[_0x5bcc('0xe')](_0x50e87b);});};exports[_0x5bcc('0xf')]=function(_0x24cb06,_0x4be55d){var _0x232087=[_0x5bcc('0x10')];return new BPromise(function(_0x1c86bd,_0x26678c){return exec(util[_0x5bcc('0x11')](_0x5bcc('0x12'),_0x24cb06['params']['pid']),function(_0x11eaec,_0x225e9f,_0x42bf2f){if(_0x11eaec){return _0x26678c(_0x11eaec);}return _0x1c86bd(_0x225e9f);});})[_0x5bcc('0xd')](function(_0x508902){var _0x3e9fa5=![];var _0x2d1f82=_0x508902[_0x5bcc('0x13')](/\n/);for(var _0x3ff2f8=0x0,_0x2c435b=_0x232087['length'];_0x3ff2f8<_0x2c435b,_0x3e9fa5===![];_0x3ff2f8+=0x1){if(_0x508902['indexOf'](_0x232087[_0x3ff2f8])>=0x0){_0x3e9fa5=!![];}}if(!_0x3e9fa5){throw new Error(util['format'](_0x5bcc('0x14'),_0x24cb06[_0x5bcc('0x15')][_0x5bcc('0x16')]));}process['kill'](_0x24cb06['params'][_0x5bcc('0x16')],_0x5bcc('0x17'));return _0x4be55d[_0x5bcc('0xa')](0xc8)[_0x5bcc('0xe')]({'message':util['format']('Process\x20with\x20pid\x20%s\x20killed\x20correctly',_0x24cb06[_0x5bcc('0x15')][_0x5bcc('0x16')])});})[_0x5bcc('0x18')](handleError(_0x4be55d,null,'killProcess'));}; \ No newline at end of file +var _0x334e=['then','split','length','Process\x20with\x20pid\x20%s\x20not\x20found!','params','pid','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','killProcess','exec','api','bluebird','lodash','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','status','send','getAllData','json','catch','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args'];(function(_0x1b9dc2,_0x367135){var _0x35a248=function(_0x39ef8f){while(--_0x39ef8f){_0x1b9dc2['push'](_0x1b9dc2['shift']());}};_0x35a248(++_0x367135);}(_0x334e,0x1c1));var _0xe334=function(_0x3a490e,_0x44961b){_0x3a490e=_0x3a490e-0x0;var _0x53d15e=_0x334e[_0x3a490e];return _0x53d15e;};'use strict';var info=require('systeminformation');var exec=require('child_process')[_0xe334('0x0')];var logger=require('../../config/logger')(_0xe334('0x1'));var util=require('util');var BPromise=require(_0xe334('0x2'));var _=require(_0xe334('0x3'));function handleError(_0x1129ed,_0x5ba2cc,_0x33b224){_0x5ba2cc=_0x5ba2cc||0x1f4;return function(_0x23f703){logger['error'](_0xe334('0x4'),_0x33b224,_0x5ba2cc,util[_0xe334('0x5')](_0x23f703,{'showHidden':![],'depth':null}));delete _0x23f703['name'];_0x1129ed[_0xe334('0x6')](_0x5ba2cc)[_0xe334('0x7')](_0x23f703);};}exports['index']=function(_0xf0cbe9,_0x567fd4){return info[_0xe334('0x8')]()['then'](function(_0x3f6c65){return _0x567fd4[_0xe334('0x6')](0xc8)[_0xe334('0x9')](_0x3f6c65);})[_0xe334('0xa')](function(_0x186da1){return _0x567fd4['status'](0x1f4)[_0xe334('0x9')](_0x186da1);});};exports['killProcess']=function(_0x8b1db0,_0x1d7e87){var _0x2e0d73=['components/import/cm'];return new BPromise(function(_0xbd0287,_0x65ca87){return exec(util[_0xe334('0xb')](_0xe334('0xc'),_0x8b1db0['params']['pid']),function(_0x1d61eb,_0x43f8ea,_0x2d9c2e){if(_0x1d61eb){return _0x65ca87(_0x1d61eb);}return _0xbd0287(_0x43f8ea);});})[_0xe334('0xd')](function(_0x5a7e3f){var _0x42e8f4=![];var _0x4125b6=_0x5a7e3f[_0xe334('0xe')](/\n/);for(var _0x24353c=0x0,_0x594f96=_0x2e0d73[_0xe334('0xf')];_0x24353c<_0x594f96,_0x42e8f4===![];_0x24353c+=0x1){if(_0x5a7e3f['indexOf'](_0x2e0d73[_0x24353c])>=0x0){_0x42e8f4=!![];}}if(!_0x42e8f4){throw new Error(util[_0xe334('0xb')](_0xe334('0x10'),_0x8b1db0[_0xe334('0x11')][_0xe334('0x12')]));}process['kill'](_0x8b1db0[_0xe334('0x11')]['pid'],_0xe334('0x13'));return _0x1d7e87[_0xe334('0x6')](0xc8)[_0xe334('0x9')]({'message':util[_0xe334('0xb')](_0xe334('0x14'),_0x8b1db0['params'][_0xe334('0x12')])});})[_0xe334('0xa')](handleError(_0x1d7e87,null,_0xe334('0x15')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index 6635fe9..2d36fd0 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 _0xe3ef=['exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./tag.controller','get','isAuthenticated','index','/:id','create','put','update','delete','destroy'];(function(_0x531106,_0x33aa61){var _0x33d05f=function(_0x211a21){while(--_0x211a21){_0x531106['push'](_0x531106['shift']());}};_0x33d05f(++_0x33aa61);}(_0xe3ef,0x65));var _0xfe3e=function(_0x5652e6,_0x189339){_0x5652e6=_0x5652e6-0x0;var _0x2c383a=_0xe3ef[_0x5652e6];return _0x2c383a;};'use strict';var multer=require(_0xfe3e('0x0'));var util=require(_0xfe3e('0x1'));var path=require('path');var timeout=require(_0xfe3e('0x2'));var express=require(_0xfe3e('0x3'));var router=express[_0xfe3e('0x4')]();var fs_extra=require(_0xfe3e('0x5'));var auth=require(_0xfe3e('0x6'));var interaction=require(_0xfe3e('0x7'));var config=require(_0xfe3e('0x8'));var controller=require(_0xfe3e('0x9'));router[_0xfe3e('0xa')]('/',auth[_0xfe3e('0xb')](),controller[_0xfe3e('0xc')]);router[_0xfe3e('0xa')](_0xfe3e('0xd'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0xfe3e('0xe')]);router[_0xfe3e('0xf')]('/:id',auth[_0xfe3e('0xb')](),controller[_0xfe3e('0x10')]);router[_0xfe3e('0x11')](_0xfe3e('0xd'),auth[_0xfe3e('0xb')](),controller[_0xfe3e('0x12')]);module[_0xfe3e('0x13')]=router; \ No newline at end of file +var _0xf2a0=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','/:id','show','create','put','update','delete'];(function(_0x5d1523,_0x40731e){var _0x16b368=function(_0x26cdf8){while(--_0x26cdf8){_0x5d1523['push'](_0x5d1523['shift']());}};_0x16b368(++_0x40731e);}(_0xf2a0,0x88));var _0x0f2a=function(_0x321e39,_0x2f99c8){_0x321e39=_0x321e39-0x0;var _0x2e5be2=_0xf2a0[_0x321e39];return _0x2e5be2;};'use strict';var multer=require('multer');var util=require(_0x0f2a('0x0'));var path=require(_0x0f2a('0x1'));var timeout=require(_0x0f2a('0x2'));var express=require(_0x0f2a('0x3'));var router=express[_0x0f2a('0x4')]();var fs_extra=require(_0x0f2a('0x5'));var auth=require(_0x0f2a('0x6'));var interaction=require(_0x0f2a('0x7'));var config=require(_0x0f2a('0x8'));var controller=require('./tag.controller');router['get']('/',auth[_0x0f2a('0x9')](),controller[_0x0f2a('0xa')]);router['get'](_0x0f2a('0xb'),auth[_0x0f2a('0x9')](),controller[_0x0f2a('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x0f2a('0xd')]);router[_0x0f2a('0xe')](_0x0f2a('0xb'),auth[_0x0f2a('0x9')](),controller[_0x0f2a('0xf')]);router[_0x0f2a('0x10')](_0x0f2a('0xb'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index 22bc8ad..4a9853f 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 _0x2bb0=['sequelize','exports','STRING'];(function(_0x469aed,_0x58ae60){var _0x20b32f=function(_0x161e67){while(--_0x161e67){_0x469aed['push'](_0x469aed['shift']());}};_0x20b32f(++_0x58ae60);}(_0x2bb0,0xf3));var _0x02bb=function(_0x2c47d2,_0x101000){_0x2c47d2=_0x2c47d2-0x0;var _0x592e9e=_0x2bb0[_0x2c47d2];return _0x592e9e;};'use strict';var Sequelize=require(_0x02bb('0x0'));module[_0x02bb('0x1')]={'name':{'type':Sequelize[_0x02bb('0x2')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x02bb('0x2')],'defaultValue':'#0091EA'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x887b=['exports','STRING','name','#0091EA','sequelize'];(function(_0x1746f5,_0x1729f8){var _0x4b09c4=function(_0xa7b974){while(--_0xa7b974){_0x1746f5['push'](_0x1746f5['shift']());}};_0x4b09c4(++_0x1729f8);}(_0x887b,0x185));var _0xb887=function(_0x5bb3b9,_0x56ac0e){_0x5bb3b9=_0x5bb3b9-0x0;var _0x4f998d=_0x887b[_0x5bb3b9];return _0x4f998d;};'use strict';var Sequelize=require(_0xb887('0x0'));module[_0xb887('0x1')]={'name':{'type':Sequelize[_0xb887('0x2')],'unique':_0xb887('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0xb887('0x2')],'defaultValue':_0xb887('0x4')},'description':{'type':Sequelize[_0xb887('0x2')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index 2092484..8877bfc 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 _0x1be1=['bluebird','mustache','util','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','get','Tags','destroy','sendStatus','error','stack','name','send','index','map','Tag','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','include','findAll','rows','show','options','find','catch','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','zip-dir','fast-json-patch','moment'];(function(_0x526cb0,_0xc9628f){var _0x585562=function(_0x3385c8){while(--_0x3385c8){_0x526cb0['push'](_0x526cb0['shift']());}};_0x585562(++_0xc9628f);}(_0x1be1,0x192));var _0x11be=function(_0x4b2eb4,_0x2d6913){_0x4b2eb4=_0x4b2eb4-0x0;var _0x38ec00=_0x1be1[_0x4b2eb4];return _0x38ec00;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x11be('0x0'));var jsonpatch=require(_0x11be('0x1'));var rp=require('request-promise');var moment=require(_0x11be('0x2'));var BPromise=require(_0x11be('0x3'));var Mustache=require(_0x11be('0x4'));var util=require(_0x11be('0x5'));var path=require('path');var sox=require(_0x11be('0x6'));var csv=require(_0x11be('0x7'));var ejs=require(_0x11be('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x11be('0x9'));var squel=require('squel');var crypto=require(_0x11be('0xa'));var jsforce=require(_0x11be('0xb'));var deskjs=require(_0x11be('0xc'));var toCsv=require(_0x11be('0x7'));var querystring=require(_0x11be('0xd'));var Papa=require('papaparse');var Redis=require(_0x11be('0xe'));var authService=require(_0x11be('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x11be('0x10'));var hardwareService=require(_0x11be('0x11'));var logger=require(_0x11be('0x12'))(_0x11be('0x13'));var utils=require('../../config/utils');var config=require(_0x11be('0x14'));var licenseUtil=require(_0x11be('0x15'));var db=require(_0x11be('0x16'))['db'];function respondWithStatusCode(_0x4b36c8,_0x3ff31f){_0x3ff31f=_0x3ff31f||0xcc;return function(_0x2dad05){if(_0x2dad05){return _0x4b36c8['sendStatus'](_0x3ff31f);}return _0x4b36c8[_0x11be('0x17')](_0x3ff31f)['end']();};}function respondWithResult(_0x49228e,_0x569842){_0x569842=_0x569842||0xc8;return function(_0x4b6e7e){if(_0x4b6e7e){return _0x49228e['status'](_0x569842)['json'](_0x4b6e7e);}};}function respondWithFilteredResult(_0x588871,_0x2280e2){return function(_0x52bbef){if(_0x52bbef){var _0x31047c=typeof _0x2280e2[_0x11be('0x18')]===_0x11be('0x19')&&typeof _0x2280e2[_0x11be('0x1a')]==='undefined';var _0x2ed725=_0x52bbef[_0x11be('0x1b')];var _0x56ab61=_0x31047c?0x0:_0x2280e2[_0x11be('0x18')];var _0xc3263c=_0x31047c?_0x52bbef[_0x11be('0x1b')]:_0x2280e2['offset']+_0x2280e2['limit'];var _0x141391;if(_0xc3263c>=_0x2ed725){_0xc3263c=_0x2ed725;_0x141391=0xc8;}else{_0x141391=0xce;}_0x588871[_0x11be('0x17')](_0x141391);return _0x588871[_0x11be('0x1c')](_0x11be('0x1d'),_0x56ab61+'-'+_0xc3263c+'/'+_0x2ed725)['json'](_0x52bbef);}return null;};}function patchUpdates(_0x12a5bd){return function(_0x45136f){try{jsonpatch[_0x11be('0x1e')](_0x45136f,_0x12a5bd,!![]);}catch(_0x452315){return BPromise[_0x11be('0x1f')](_0x452315);}return _0x45136f[_0x11be('0x20')]();};}function saveUpdates(_0xa944ac,_0x17678d){return function(_0x3aea14){if(_0x3aea14){return _0x3aea14[_0x11be('0x21')](_0xa944ac)['then'](function(_0xfe3737){return _0xfe3737;});}return null;};}function removeEntity(_0x46b7c2,_0x2fe43c){return function(_0x5d1690){if(_0x5d1690){return _0x5d1690['destroy']()[_0x11be('0x22')](function(){var _0x10ce04=_0x5d1690[_0x11be('0x23')]({'plain':!![]});var _0x4cb27f=_0x11be('0x24');return db['UserProfileResource'][_0x11be('0x25')]({'where':{'type':_0x4cb27f,'resourceId':_0x10ce04['id']}})['then'](function(){return _0x5d1690;});})[_0x11be('0x22')](function(){_0x46b7c2[_0x11be('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x48029b,_0x28b3a0){return function(_0x1d3b5c){if(!_0x1d3b5c){_0x48029b[_0x11be('0x26')](0x194);}return _0x1d3b5c;};}function handleError(_0x30427b,_0x17c67f){_0x17c67f=_0x17c67f||0x1f4;return function(_0xf5a6ac){logger[_0x11be('0x27')](_0xf5a6ac[_0x11be('0x28')]);if(_0xf5a6ac['name']){delete _0xf5a6ac[_0x11be('0x29')];}_0x30427b['status'](_0x17c67f)[_0x11be('0x2a')](_0xf5a6ac);};}exports[_0x11be('0x2b')]=function(_0x510476,_0x584d4c){var _0x49fd5c={},_0x265fc9={},_0x5e8f9a={'count':0x0,'rows':[]};var _0x66316d=_[_0x11be('0x2c')](db[_0x11be('0x2d')][_0x11be('0x2e')],function(_0x25e214){return{'name':_0x25e214[_0x11be('0x2f')],'type':_0x25e214['type'][_0x11be('0x30')]};});_0x265fc9[_0x11be('0x31')]=_[_0x11be('0x2c')](_0x66316d,_0x11be('0x29'));_0x265fc9[_0x11be('0x32')]=_[_0x11be('0x33')](_0x510476['query']);_0x265fc9[_0x11be('0x34')]=_[_0x11be('0x35')](_0x265fc9[_0x11be('0x31')],_0x265fc9[_0x11be('0x32')]);_0x49fd5c[_0x11be('0x36')]=_['intersection'](_0x265fc9[_0x11be('0x31')],qs[_0x11be('0x37')](_0x510476[_0x11be('0x32')]['fields']));_0x49fd5c[_0x11be('0x36')]=_0x49fd5c['attributes']['length']?_0x49fd5c['attributes']:_0x265fc9['model'];if(!_0x510476[_0x11be('0x32')][_0x11be('0x38')](_0x11be('0x39'))){_0x49fd5c['limit']=qs[_0x11be('0x1a')](_0x510476[_0x11be('0x32')]['limit']);_0x49fd5c[_0x11be('0x18')]=qs['offset'](_0x510476[_0x11be('0x32')]['offset']);}_0x49fd5c[_0x11be('0x3a')]=qs[_0x11be('0x3b')](_0x510476[_0x11be('0x32')][_0x11be('0x3b')]);_0x49fd5c['where']=qs[_0x11be('0x34')](_[_0x11be('0x3c')](_0x510476[_0x11be('0x32')],_0x265fc9[_0x11be('0x34')]),_0x66316d);if(_0x510476['query'][_0x11be('0x3d')]){_0x49fd5c[_0x11be('0x3e')]=_[_0x11be('0x3f')](_0x49fd5c[_0x11be('0x3e')],{'$or':_[_0x11be('0x2c')](_0x66316d,function(_0x1b1aac){if(_0x1b1aac[_0x11be('0x40')]!=='VIRTUAL'){var _0x2618f5={};_0x2618f5[_0x1b1aac[_0x11be('0x29')]]={'$like':'%'+_0x510476['query'][_0x11be('0x3d')]+'%'};return _0x2618f5;}})});}_0x49fd5c=_[_0x11be('0x3f')]({},_0x49fd5c,_0x510476['options']);var _0x30b67a={'where':_0x49fd5c['where']};return db[_0x11be('0x2d')]['count'](_0x30b67a)[_0x11be('0x22')](function(_0x30be21){_0x5e8f9a['count']=_0x30be21;if(_0x510476[_0x11be('0x32')]['includeAll']){_0x49fd5c[_0x11be('0x41')]=[{'all':!![]}];}return db[_0x11be('0x2d')][_0x11be('0x42')](_0x49fd5c);})[_0x11be('0x22')](function(_0x2b847a){_0x5e8f9a[_0x11be('0x43')]=_0x2b847a;return _0x5e8f9a;})[_0x11be('0x22')](respondWithFilteredResult(_0x584d4c,_0x49fd5c))['catch'](handleError(_0x584d4c,null));};exports[_0x11be('0x44')]=function(_0x18cddf,_0x9610a1){var _0x317e2d={'raw':!![],'where':{'id':_0x18cddf['params']['id']}},_0x589ac4={};_0x589ac4['model']=_[_0x11be('0x33')](db['Tag'][_0x11be('0x2e')]);_0x589ac4['query']=_[_0x11be('0x33')](_0x18cddf[_0x11be('0x32')]);_0x589ac4[_0x11be('0x34')]=_[_0x11be('0x35')](_0x589ac4[_0x11be('0x31')],_0x589ac4[_0x11be('0x32')]);_0x317e2d[_0x11be('0x36')]=_['intersection'](_0x589ac4[_0x11be('0x31')],qs['fields'](_0x18cddf[_0x11be('0x32')][_0x11be('0x37')]));_0x317e2d[_0x11be('0x36')]=_0x317e2d['attributes']['length']?_0x317e2d['attributes']:_0x589ac4[_0x11be('0x31')];if(_0x18cddf[_0x11be('0x32')]['includeAll']){_0x317e2d['include']=[{'all':!![]}];}_0x317e2d=_['merge']({},_0x317e2d,_0x18cddf[_0x11be('0x45')]);return db[_0x11be('0x2d')][_0x11be('0x46')](_0x317e2d)[_0x11be('0x22')](handleEntityNotFound(_0x9610a1,null))[_0x11be('0x22')](respondWithResult(_0x9610a1,null))[_0x11be('0x47')](handleError(_0x9610a1,null));};exports[_0x11be('0x48')]=function(_0x3f2070,_0x2ce110){return db[_0x11be('0x2d')][_0x11be('0x48')](_0x3f2070['body'],{})[_0x11be('0x22')](function(_0x29f82f){var _0x534ee7=_0x3f2070['user']['get']({'plain':!![]});if(!_0x534ee7)throw new Error(_0x11be('0x49'));if(_0x534ee7['role']===_0x11be('0x4a')){var _0x1c1626=_0x29f82f[_0x11be('0x23')]({'plain':!![]});var _0x1fb48d=_0x11be('0x24');return db[_0x11be('0x4b')][_0x11be('0x46')]({'where':{'name':_0x1fb48d,'userProfileId':_0x534ee7[_0x11be('0x4c')]},'raw':!![]})[_0x11be('0x22')](function(_0x4c873a){if(_0x4c873a&&_0x4c873a[_0x11be('0x4d')]===0x0){return db['UserProfileResource'][_0x11be('0x48')]({'name':_0x1c1626[_0x11be('0x29')],'resourceId':_0x1c1626['id'],'type':_0x4c873a['name'],'sectionId':_0x4c873a['id']},{})[_0x11be('0x22')](function(){return _0x29f82f;});}else{return _0x29f82f;}})[_0x11be('0x47')](function(_0x4c0e37){logger[_0x11be('0x27')](_0x11be('0x4e'),_0x4c0e37);throw _0x4c0e37;});}return _0x29f82f;})['then'](respondWithResult(_0x2ce110,0xc9))['catch'](handleError(_0x2ce110,null));};exports[_0x11be('0x21')]=function(_0x2886ac,_0x50eeab){if(_0x2886ac['body']['id']){delete _0x2886ac[_0x11be('0x4f')]['id'];}return db[_0x11be('0x2d')][_0x11be('0x46')]({'where':{'id':_0x2886ac['params']['id']}})['then'](handleEntityNotFound(_0x50eeab,null))['then'](saveUpdates(_0x2886ac[_0x11be('0x4f')],null))[_0x11be('0x22')](respondWithResult(_0x50eeab,null))[_0x11be('0x47')](handleError(_0x50eeab,null));};exports['destroy']=function(_0x4db963,_0x33409c){return db[_0x11be('0x2d')][_0x11be('0x46')]({'where':{'id':_0x4db963[_0x11be('0x50')]['id']}})['then'](handleEntityNotFound(_0x33409c,null))[_0x11be('0x22')](removeEntity(_0x33409c,null))['catch'](handleError(_0x33409c,null));}; \ No newline at end of file +var _0x073e=['save','update','then','destroy','stack','name','send','index','Tag','fieldName','type','map','keys','query','filters','model','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','rawAttributes','includeAll','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Tags','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','rimraf','zip-dir','fast-json-patch','mustache','util','path','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','count','limit','set','Content-Range','apply','reject'];(function(_0x59f20f,_0x22b857){var _0x49de03=function(_0x2ddb5c){while(--_0x2ddb5c){_0x59f20f['push'](_0x59f20f['shift']());}};_0x49de03(++_0x22b857);}(_0x073e,0x181));var _0xe073=function(_0x5d7e04,_0xa140){_0x5d7e04=_0x5d7e04-0x0;var _0x179210=_0x073e[_0x5d7e04];return _0x179210;};'use strict';var emlformat=require(_0xe073('0x0'));var rimraf=require(_0xe073('0x1'));var zipdir=require(_0xe073('0x2'));var jsonpatch=require(_0xe073('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xe073('0x4'));var util=require(_0xe073('0x5'));var path=require(_0xe073('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe073('0x7'));var _=require(_0xe073('0x8'));var squel=require(_0xe073('0x9'));var crypto=require(_0xe073('0xa'));var jsforce=require(_0xe073('0xb'));var deskjs=require(_0xe073('0xc'));var toCsv=require('to-csv');var querystring=require(_0xe073('0xd'));var Papa=require(_0xe073('0xe'));var Redis=require(_0xe073('0xf'));var authService=require(_0xe073('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xe073('0x11'));var hardwareService=require(_0xe073('0x12'));var logger=require(_0xe073('0x13'))(_0xe073('0x14'));var utils=require(_0xe073('0x15'));var config=require(_0xe073('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xe073('0x17'))['db'];function respondWithStatusCode(_0x56e3f5,_0x3dedf7){_0x3dedf7=_0x3dedf7||0xcc;return function(_0x5d2f2f){if(_0x5d2f2f){return _0x56e3f5[_0xe073('0x18')](_0x3dedf7);}return _0x56e3f5['status'](_0x3dedf7)[_0xe073('0x19')]();};}function respondWithResult(_0x27d34,_0x47828d){_0x47828d=_0x47828d||0xc8;return function(_0x2ce92d){if(_0x2ce92d){return _0x27d34[_0xe073('0x1a')](_0x47828d)[_0xe073('0x1b')](_0x2ce92d);}};}function respondWithFilteredResult(_0x2f4b36,_0xfb28f5){return function(_0x208f2e){if(_0x208f2e){var _0x26f3d3=typeof _0xfb28f5[_0xe073('0x1c')]==='undefined'&&typeof _0xfb28f5['limit']==='undefined';var _0x4c578c=_0x208f2e[_0xe073('0x1d')];var _0x10486c=_0x26f3d3?0x0:_0xfb28f5[_0xe073('0x1c')];var _0x4f9c8e=_0x26f3d3?_0x208f2e[_0xe073('0x1d')]:_0xfb28f5[_0xe073('0x1c')]+_0xfb28f5[_0xe073('0x1e')];var _0x54c10e;if(_0x4f9c8e>=_0x4c578c){_0x4f9c8e=_0x4c578c;_0x54c10e=0xc8;}else{_0x54c10e=0xce;}_0x2f4b36[_0xe073('0x1a')](_0x54c10e);return _0x2f4b36[_0xe073('0x1f')](_0xe073('0x20'),_0x10486c+'-'+_0x4f9c8e+'/'+_0x4c578c)[_0xe073('0x1b')](_0x208f2e);}return null;};}function patchUpdates(_0x43668e){return function(_0x17dd4b){try{jsonpatch[_0xe073('0x21')](_0x17dd4b,_0x43668e,!![]);}catch(_0x1d7a13){return BPromise[_0xe073('0x22')](_0x1d7a13);}return _0x17dd4b[_0xe073('0x23')]();};}function saveUpdates(_0x5143fa,_0x4405fd){return function(_0x21f9c2){if(_0x21f9c2){return _0x21f9c2[_0xe073('0x24')](_0x5143fa)[_0xe073('0x25')](function(_0x39bcb4){return _0x39bcb4;});}return null;};}function removeEntity(_0x275aa8,_0x504c26){return function(_0x4c76ef){if(_0x4c76ef){return _0x4c76ef[_0xe073('0x26')]()['then'](function(){var _0x5e3b16=_0x4c76ef['get']({'plain':!![]});var _0x5c4137='Tags';return db['UserProfileResource'][_0xe073('0x26')]({'where':{'type':_0x5c4137,'resourceId':_0x5e3b16['id']}})[_0xe073('0x25')](function(){return _0x4c76ef;});})['then'](function(){_0x275aa8[_0xe073('0x1a')](0xcc)[_0xe073('0x19')]();});}};}function handleEntityNotFound(_0x436c34,_0x5a5b2b){return function(_0x10f5ba){if(!_0x10f5ba){_0x436c34['sendStatus'](0x194);}return _0x10f5ba;};}function handleError(_0x255d91,_0x2e5fac){_0x2e5fac=_0x2e5fac||0x1f4;return function(_0x599972){logger['error'](_0x599972[_0xe073('0x27')]);if(_0x599972[_0xe073('0x28')]){delete _0x599972[_0xe073('0x28')];}_0x255d91[_0xe073('0x1a')](_0x2e5fac)[_0xe073('0x29')](_0x599972);};}exports[_0xe073('0x2a')]=function(_0x4f60dd,_0x2a206a){var _0x5c04fe={},_0x1baa0a={},_0x1cdcb0={'count':0x0,'rows':[]};var _0x4a6884=_['map'](db[_0xe073('0x2b')]['rawAttributes'],function(_0x3f6564){return{'name':_0x3f6564[_0xe073('0x2c')],'type':_0x3f6564[_0xe073('0x2d')]['key']};});_0x1baa0a['model']=_[_0xe073('0x2e')](_0x4a6884,_0xe073('0x28'));_0x1baa0a['query']=_[_0xe073('0x2f')](_0x4f60dd[_0xe073('0x30')]);_0x1baa0a[_0xe073('0x31')]=_['intersection'](_0x1baa0a[_0xe073('0x32')],_0x1baa0a['query']);_0x5c04fe['attributes']=_[_0xe073('0x33')](_0x1baa0a[_0xe073('0x32')],qs[_0xe073('0x34')](_0x4f60dd['query'][_0xe073('0x34')]));_0x5c04fe[_0xe073('0x35')]=_0x5c04fe[_0xe073('0x35')]['length']?_0x5c04fe[_0xe073('0x35')]:_0x1baa0a[_0xe073('0x32')];if(!_0x4f60dd[_0xe073('0x30')][_0xe073('0x36')](_0xe073('0x37'))){_0x5c04fe[_0xe073('0x1e')]=qs['limit'](_0x4f60dd[_0xe073('0x30')][_0xe073('0x1e')]);_0x5c04fe[_0xe073('0x1c')]=qs['offset'](_0x4f60dd[_0xe073('0x30')][_0xe073('0x1c')]);}_0x5c04fe[_0xe073('0x38')]=qs[_0xe073('0x39')](_0x4f60dd[_0xe073('0x30')]['sort']);_0x5c04fe[_0xe073('0x3a')]=qs['filters'](_[_0xe073('0x3b')](_0x4f60dd[_0xe073('0x30')],_0x1baa0a[_0xe073('0x31')]),_0x4a6884);if(_0x4f60dd[_0xe073('0x30')][_0xe073('0x3c')]){_0x5c04fe[_0xe073('0x3a')]=_[_0xe073('0x3d')](_0x5c04fe[_0xe073('0x3a')],{'$or':_[_0xe073('0x2e')](_0x4a6884,function(_0x3d29e5){if(_0x3d29e5[_0xe073('0x2d')]!==_0xe073('0x3e')){var _0x16be1a={};_0x16be1a[_0x3d29e5['name']]={'$like':'%'+_0x4f60dd[_0xe073('0x30')]['filter']+'%'};return _0x16be1a;}})});}_0x5c04fe=_[_0xe073('0x3d')]({},_0x5c04fe,_0x4f60dd[_0xe073('0x3f')]);var _0x5a4e19={'where':_0x5c04fe[_0xe073('0x3a')]};return db['Tag'][_0xe073('0x1d')](_0x5a4e19)[_0xe073('0x25')](function(_0x93852a){_0x1cdcb0[_0xe073('0x1d')]=_0x93852a;if(_0x4f60dd[_0xe073('0x30')]['includeAll']){_0x5c04fe[_0xe073('0x40')]=[{'all':!![]}];}return db['Tag'][_0xe073('0x41')](_0x5c04fe);})[_0xe073('0x25')](function(_0x125d1f){_0x1cdcb0[_0xe073('0x42')]=_0x125d1f;return _0x1cdcb0;})[_0xe073('0x25')](respondWithFilteredResult(_0x2a206a,_0x5c04fe))[_0xe073('0x43')](handleError(_0x2a206a,null));};exports[_0xe073('0x44')]=function(_0x2f4939,_0x1b50c5){var _0x2d3ffe={'raw':!![],'where':{'id':_0x2f4939['params']['id']}},_0x2c312b={};_0x2c312b['model']=_[_0xe073('0x2f')](db[_0xe073('0x2b')][_0xe073('0x45')]);_0x2c312b[_0xe073('0x30')]=_[_0xe073('0x2f')](_0x2f4939['query']);_0x2c312b[_0xe073('0x31')]=_[_0xe073('0x33')](_0x2c312b[_0xe073('0x32')],_0x2c312b[_0xe073('0x30')]);_0x2d3ffe[_0xe073('0x35')]=_['intersection'](_0x2c312b[_0xe073('0x32')],qs['fields'](_0x2f4939['query'][_0xe073('0x34')]));_0x2d3ffe[_0xe073('0x35')]=_0x2d3ffe['attributes']['length']?_0x2d3ffe[_0xe073('0x35')]:_0x2c312b[_0xe073('0x32')];if(_0x2f4939[_0xe073('0x30')][_0xe073('0x46')]){_0x2d3ffe[_0xe073('0x40')]=[{'all':!![]}];}_0x2d3ffe=_[_0xe073('0x3d')]({},_0x2d3ffe,_0x2f4939[_0xe073('0x3f')]);return db['Tag'][_0xe073('0x47')](_0x2d3ffe)['then'](handleEntityNotFound(_0x1b50c5,null))[_0xe073('0x25')](respondWithResult(_0x1b50c5,null))[_0xe073('0x43')](handleError(_0x1b50c5,null));};exports[_0xe073('0x48')]=function(_0x4e1f1d,_0x4d5bcd){return db[_0xe073('0x2b')][_0xe073('0x48')](_0x4e1f1d[_0xe073('0x49')],{})['then'](function(_0x151035){var _0x338557=_0x4e1f1d[_0xe073('0x4a')][_0xe073('0x4b')]({'plain':!![]});if(!_0x338557)throw new Error(_0xe073('0x4c'));if(_0x338557[_0xe073('0x4d')]===_0xe073('0x4a')){var _0x307541=_0x151035[_0xe073('0x4b')]({'plain':!![]});var _0x5626d4=_0xe073('0x4e');return db['UserProfileSection'][_0xe073('0x47')]({'where':{'name':_0x5626d4,'userProfileId':_0x338557['userProfileId']},'raw':!![]})[_0xe073('0x25')](function(_0x202687){if(_0x202687&&_0x202687[_0xe073('0x4f')]===0x0){return db[_0xe073('0x50')]['create']({'name':_0x307541[_0xe073('0x28')],'resourceId':_0x307541['id'],'type':_0x202687[_0xe073('0x28')],'sectionId':_0x202687['id']},{})[_0xe073('0x25')](function(){return _0x151035;});}else{return _0x151035;}})['catch'](function(_0x5503c2){logger[_0xe073('0x51')](_0xe073('0x52'),_0x5503c2);throw _0x5503c2;});}return _0x151035;})[_0xe073('0x25')](respondWithResult(_0x4d5bcd,0xc9))[_0xe073('0x43')](handleError(_0x4d5bcd,null));};exports[_0xe073('0x24')]=function(_0x5212d5,_0x197c42){if(_0x5212d5[_0xe073('0x49')]['id']){delete _0x5212d5[_0xe073('0x49')]['id'];}return db[_0xe073('0x2b')][_0xe073('0x47')]({'where':{'id':_0x5212d5[_0xe073('0x53')]['id']}})[_0xe073('0x25')](handleEntityNotFound(_0x197c42,null))[_0xe073('0x25')](saveUpdates(_0x5212d5[_0xe073('0x49')],null))[_0xe073('0x25')](respondWithResult(_0x197c42,null))['catch'](handleError(_0x197c42,null));};exports[_0xe073('0x26')]=function(_0x582007,_0x5825eb){return db[_0xe073('0x2b')][_0xe073('0x47')]({'where':{'id':_0x582007[_0xe073('0x53')]['id']}})['then'](handleEntityNotFound(_0x5825eb,null))[_0xe073('0x25')](removeEntity(_0x5825eb,null))[_0xe073('0x43')](handleError(_0x5825eb,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index b56075f..a34e5ed 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 _0xff1b=['path','../../config/environment','./tag.attributes','exports','Tag','tools_tags','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x545e41,_0x55830d){var _0x20ee17=function(_0xac9b17){while(--_0xac9b17){_0x545e41['push'](_0x545e41['shift']());}};_0x20ee17(++_0x55830d);}(_0xff1b,0x1cd));var _0xbff1=function(_0x20187f,_0xbf67c9){_0x20187f=_0x20187f-0x0;var _0x398db5=_0xff1b[_0x20187f];return _0x398db5;};'use strict';var _=require(_0xbff1('0x0'));var util=require(_0xbff1('0x1'));var logger=require(_0xbff1('0x2'))(_0xbff1('0x3'));var moment=require(_0xbff1('0x4'));var BPromise=require(_0xbff1('0x5'));var rp=require(_0xbff1('0x6'));var fs=require('fs');var path=require(_0xbff1('0x7'));var rimraf=require('rimraf');var config=require(_0xbff1('0x8'));var attributes=require(_0xbff1('0x9'));module[_0xbff1('0xa')]=function(_0x54a98e,_0x4d7768){return _0x54a98e['define'](_0xbff1('0xb'),attributes,{'tableName':_0xbff1('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x55af=['tools_tags','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./tag.attributes','exports','define','Tag'];(function(_0x443960,_0x4cf814){var _0xae4b53=function(_0x2f8456){while(--_0x2f8456){_0x443960['push'](_0x443960['shift']());}};_0xae4b53(++_0x4cf814);}(_0x55af,0x196));var _0xf55a=function(_0x1a55ac,_0x419d98){_0x1a55ac=_0x1a55ac-0x0;var _0x36a57b=_0x55af[_0x1a55ac];return _0x36a57b;};'use strict';var _=require(_0xf55a('0x0'));var util=require(_0xf55a('0x1'));var logger=require(_0xf55a('0x2'))(_0xf55a('0x3'));var moment=require(_0xf55a('0x4'));var BPromise=require(_0xf55a('0x5'));var rp=require(_0xf55a('0x6'));var fs=require('fs');var path=require(_0xf55a('0x7'));var rimraf=require(_0xf55a('0x8'));var config=require(_0xf55a('0x9'));var attributes=require(_0xf55a('0xa'));module[_0xf55a('0xb')]=function(_0x3325b4,_0x3d666e){return _0x3325b4[_0xf55a('0xc')](_0xf55a('0xd'),attributes,{'tableName':_0xf55a('0xe'),'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 91c5102..87fa2ff 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 _0x3937=['error','code','Tag,\x20%s,\x20%s','message','lodash','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent'];(function(_0x395416,_0x2a97cd){var _0x5add08=function(_0x1fd9ba){while(--_0x1fd9ba){_0x395416['push'](_0x395416['shift']());}};_0x5add08(++_0x2a97cd);}(_0x3937,0xbf));var _0x7393=function(_0x39d5a3,_0x2856ef){_0x39d5a3=_0x39d5a3-0x0;var _0x178055=_0x3937[_0x39d5a3];return _0x178055;};'use strict';var _=require(_0x7393('0x0'));var util=require('util');var moment=require(_0x7393('0x1'));var BPromise=require(_0x7393('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7393('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x7393('0x4'));var logger=require('../../config/logger')(_0x7393('0x5'));var config=require(_0x7393('0x6'));var jayson=require(_0x7393('0x7'));var client=jayson[_0x7393('0x8')][_0x7393('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x42bdd1,_0x3f0800,_0x26668a){return new BPromise(function(_0x944b0b,_0x4efb50){return client['request'](_0x42bdd1,_0x26668a)[_0x7393('0xa')](function(_0x3b7bbc){logger[_0x7393('0xb')]('Tag,\x20%s,\x20%s',_0x3f0800,_0x7393('0xc'));logger['debug']('Tag,\x20%s,\x20%s,\x20%s',_0x3f0800,'request\x20sent',JSON['stringify'](_0x3b7bbc));if(_0x3b7bbc[_0x7393('0xd')]){if(_0x3b7bbc[_0x7393('0xd')][_0x7393('0xe')]===0x1f4){logger['error'](_0x7393('0xf'),_0x3f0800,_0x3b7bbc[_0x7393('0xd')][_0x7393('0x10')]);return _0x4efb50(_0x3b7bbc[_0x7393('0xd')][_0x7393('0x10')]);}logger[_0x7393('0xd')](_0x7393('0xf'),_0x3f0800,_0x3b7bbc[_0x7393('0xd')][_0x7393('0x10')]);return _0x944b0b(_0x3b7bbc['error']['message']);}else{logger[_0x7393('0xb')]('Tag,\x20%s,\x20%s',_0x3f0800,'request\x20sent');_0x944b0b(_0x3b7bbc['result'][_0x7393('0x10')]);}})['catch'](function(_0x2a1180){logger[_0x7393('0xd')]('Tag,\x20%s,\x20%s',_0x3f0800,_0x2a1180);_0x4efb50(_0x2a1180);});});} \ No newline at end of file +var _0x54f3=['moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','http','then','info','Tag,\x20%s,\x20%s','Tag,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','catch','util'];(function(_0x5bf5f8,_0x54cb84){var _0x5ede44=function(_0x81b3a){while(--_0x81b3a){_0x5bf5f8['push'](_0x5bf5f8['shift']());}};_0x5ede44(++_0x54cb84);}(_0x54f3,0x120));var _0x354f=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x54f3[_0x4a9fb1];return _0x348672;};'use strict';var _=require('lodash');var util=require(_0x354f('0x0'));var moment=require(_0x354f('0x1'));var BPromise=require(_0x354f('0x2'));var rs=require(_0x354f('0x3'));var fs=require('fs');var Redis=require(_0x354f('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x354f('0x5'))(_0x354f('0x6'));var config=require(_0x354f('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x354f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x51cd16,_0x1da503,_0x4311ad){return new BPromise(function(_0x2f111a,_0x173e1d){return client['request'](_0x51cd16,_0x4311ad)[_0x354f('0x9')](function(_0x5d1e5d){logger[_0x354f('0xa')](_0x354f('0xb'),_0x1da503,'request\x20sent');logger['debug'](_0x354f('0xc'),_0x1da503,_0x354f('0xd'),JSON['stringify'](_0x5d1e5d));if(_0x5d1e5d[_0x354f('0xe')]){if(_0x5d1e5d[_0x354f('0xe')]['code']===0x1f4){logger[_0x354f('0xe')](_0x354f('0xb'),_0x1da503,_0x5d1e5d[_0x354f('0xe')][_0x354f('0xf')]);return _0x173e1d(_0x5d1e5d[_0x354f('0xe')][_0x354f('0xf')]);}logger[_0x354f('0xe')]('Tag,\x20%s,\x20%s',_0x1da503,_0x5d1e5d[_0x354f('0xe')][_0x354f('0xf')]);return _0x2f111a(_0x5d1e5d[_0x354f('0xe')]['message']);}else{logger[_0x354f('0xa')](_0x354f('0xb'),_0x1da503,_0x354f('0xd'));_0x2f111a(_0x5d1e5d['result']['message']);}})[_0x354f('0x10')](function(_0x1d7627){logger[_0x354f('0xe')](_0x354f('0xb'),_0x1da503,_0x1d7627);_0x173e1d(_0x1d7627);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index bd346b9..eaf7b93 100644 --- a/server/api/team/index.js +++ b/server/api/team/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./team.controller','get','index','/:id','getQueues','/:id/users','isAuthenticated','getAgents','post','addQueues','addAgents','update','delete','removeAgents','multer','util','path'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xa9e0[_0x2b10c6];return _0x3789d2;};'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(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xa9e0[_0x2b4411];return _0x8e41ef;};'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 237c571..b9b42d3 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 _0xb7e7=['STRING','sequelize'];(function(_0x2afbb0,_0x44f16d){var _0x411ff2=function(_0x5edd7e){while(--_0x5edd7e){_0x2afbb0['push'](_0x2afbb0['shift']());}};_0x411ff2(++_0x44f16d);}(_0xb7e7,0x121));var _0x7b7e=function(_0xac151d,_0x4ea1d2){_0xac151d=_0xac151d-0x0;var _0x111dba=_0xb7e7[_0xac151d];return _0x111dba;};'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 _0xbaf0=['name','exports','STRING'];(function(_0x1d87fc,_0x1e5321){var _0x492b56=function(_0x4c6b16){while(--_0x4c6b16){_0x1d87fc['push'](_0x1d87fc['shift']());}};_0x492b56(++_0x1e5321);}(_0xbaf0,0x12a));var _0x0baf=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xbaf0[_0x2b4411];return _0x8e41ef;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'name':{'type':Sequelize[_0x0baf('0x1')],'allowNull':![],'unique':_0x0baf('0x2')},'description':{'type':Sequelize[_0x0baf('0x1')]}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index d32d1bf..42d4a7a 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 _0xa32b=['sendStatus','end','status','offset','undefined','limit','set','Content-Range','json','apply','reject','then','destroy','get','Teams','UserProfileResource','error','name','send','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','Team','count','include','findAll','rows','catch','show','params','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','update','body','getQueues','findOne','channel','isValidChannel','Sequelize','ValidationError','Unknown\x20channel','toLowerCase','Queue','options','capitalize','Queues','addQueues','add','ids','removeQueues','Chat','Mail','Sms','Fax','sequelize','transaction','through','penalty','TeamVoiceQueue','emit','Queue:save','QueueId','Voice','User','online','voicePause','upsert','isNil','interface','format','SIP/%s','all','addAgents','spread','removeAgents','Openchannel','Whatsapp','parse','UserVoiceQueueRt','getAgents','eml-format','zip-dir','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../mysqldb','redis','defaults','localhost','./team.socket','register'];(function(_0x2c8ed8,_0x489e3f){var _0x2f73fc=function(_0x3e4b75){while(--_0x3e4b75){_0x2c8ed8['push'](_0x2c8ed8['shift']());}};_0x2f73fc(++_0x489e3f);}(_0xa32b,0x68));var _0xba32=function(_0x47041d,_0x42153f){_0x47041d=_0x47041d-0x0;var _0x5022bd=_0xa32b[_0x47041d];return _0x5022bd;};'use strict';var emlformat=require(_0xba32('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xba32('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xba32('0x2'));var BPromise=require(_0xba32('0x3'));var Mustache=require(_0xba32('0x4'));var util=require('util');var path=require(_0xba32('0x5'));var sox=require(_0xba32('0x6'));var csv=require(_0xba32('0x7'));var ejs=require(_0xba32('0x8'));var fs=require('fs');var fs_extra=require(_0xba32('0x9'));var _=require('lodash');var squel=require(_0xba32('0xa'));var crypto=require('crypto');var jsforce=require(_0xba32('0xb'));var deskjs=require(_0xba32('0xc'));var toCsv=require(_0xba32('0x7'));var querystring=require(_0xba32('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xba32('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xba32('0xf'))('api');var utils=require(_0xba32('0x10'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xba32('0x11'))['db'];config[_0xba32('0x12')]=_[_0xba32('0x13')](config[_0xba32('0x12')],{'host':_0xba32('0x14'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xba32('0x12')]));require(_0xba32('0x15'))[_0xba32('0x16')](socket);function respondWithStatusCode(_0xd82932,_0x36c197){_0x36c197=_0x36c197||0xcc;return function(_0x184f31){if(_0x184f31){return _0xd82932[_0xba32('0x17')](_0x36c197);}return _0xd82932['status'](_0x36c197)[_0xba32('0x18')]();};}function respondWithResult(_0x22c2be,_0x3d3ebe){_0x3d3ebe=_0x3d3ebe||0xc8;return function(_0xd8e067){if(_0xd8e067){return _0x22c2be[_0xba32('0x19')](_0x3d3ebe)['json'](_0xd8e067);}};}function respondWithFilteredResult(_0x4d0b72,_0x56ea88){return function(_0x5c3fe6){if(_0x5c3fe6){var _0x234db9=typeof _0x56ea88[_0xba32('0x1a')]===_0xba32('0x1b')&&typeof _0x56ea88[_0xba32('0x1c')]===_0xba32('0x1b');var _0x1bcce4=_0x5c3fe6['count'];var _0x4f9e48=_0x234db9?0x0:_0x56ea88['offset'];var _0x10de9c=_0x234db9?_0x5c3fe6['count']:_0x56ea88[_0xba32('0x1a')]+_0x56ea88[_0xba32('0x1c')];var _0x4266dc;if(_0x10de9c>=_0x1bcce4){_0x10de9c=_0x1bcce4;_0x4266dc=0xc8;}else{_0x4266dc=0xce;}_0x4d0b72[_0xba32('0x19')](_0x4266dc);return _0x4d0b72[_0xba32('0x1d')](_0xba32('0x1e'),_0x4f9e48+'-'+_0x10de9c+'/'+_0x1bcce4)[_0xba32('0x1f')](_0x5c3fe6);}return null;};}function patchUpdates(_0x503698){return function(_0x1226f2){try{jsonpatch[_0xba32('0x20')](_0x1226f2,_0x503698,!![]);}catch(_0x34a3cd){return BPromise[_0xba32('0x21')](_0x34a3cd);}return _0x1226f2['save']();};}function saveUpdates(_0x4b03a5,_0x2f3318){return function(_0x3a8f30){if(_0x3a8f30){return _0x3a8f30['update'](_0x4b03a5)[_0xba32('0x22')](function(_0x5dcdc4){return _0x5dcdc4;});}return null;};}function removeEntity(_0x37ade0,_0x18f0c8){return function(_0x3c8b78){if(_0x3c8b78){return _0x3c8b78[_0xba32('0x23')]()[_0xba32('0x22')](function(){var _0x11fb8c=_0x3c8b78[_0xba32('0x24')]({'plain':!![]});var _0x54d03d=_0xba32('0x25');return db[_0xba32('0x26')][_0xba32('0x23')]({'where':{'type':_0x54d03d,'resourceId':_0x11fb8c['id']}})[_0xba32('0x22')](function(){return _0x3c8b78;});})[_0xba32('0x22')](function(){_0x37ade0[_0xba32('0x19')](0xcc)[_0xba32('0x18')]();});}};}function handleEntityNotFound(_0xd00fcd,_0x1ef5ed){return function(_0x5dbba9){if(!_0x5dbba9){_0xd00fcd[_0xba32('0x17')](0x194);}return _0x5dbba9;};}function handleError(_0x24884e,_0x19d88b){_0x19d88b=_0x19d88b||0x1f4;return function(_0x2a466e){logger[_0xba32('0x27')](_0x2a466e['stack']);if(_0x2a466e[_0xba32('0x28')]){delete _0x2a466e['name'];}_0x24884e[_0xba32('0x19')](_0x19d88b)[_0xba32('0x29')](_0x2a466e);};}exports['index']=function(_0x198161,_0x1e2433){var _0xd67336={},_0x42cf37={},_0x48d819={'count':0x0,'rows':[]};var _0x197325=_[_0xba32('0x2a')](db['Team'][_0xba32('0x2b')],function(_0x3cfff3){return{'name':_0x3cfff3[_0xba32('0x2c')],'type':_0x3cfff3[_0xba32('0x2d')]['key']};});_0x42cf37[_0xba32('0x2e')]=_['map'](_0x197325,_0xba32('0x28'));_0x42cf37[_0xba32('0x2f')]=_[_0xba32('0x30')](_0x198161['query']);_0x42cf37[_0xba32('0x31')]=_[_0xba32('0x32')](_0x42cf37['model'],_0x42cf37[_0xba32('0x2f')]);_0xd67336[_0xba32('0x33')]=_[_0xba32('0x32')](_0x42cf37[_0xba32('0x2e')],qs['fields'](_0x198161['query'][_0xba32('0x34')]));_0xd67336['attributes']=_0xd67336[_0xba32('0x33')][_0xba32('0x35')]?_0xd67336[_0xba32('0x33')]:_0x42cf37[_0xba32('0x2e')];if(!_0x198161['query'][_0xba32('0x36')](_0xba32('0x37'))){_0xd67336[_0xba32('0x1c')]=qs[_0xba32('0x1c')](_0x198161['query']['limit']);_0xd67336[_0xba32('0x1a')]=qs[_0xba32('0x1a')](_0x198161[_0xba32('0x2f')][_0xba32('0x1a')]);}_0xd67336[_0xba32('0x38')]=qs[_0xba32('0x39')](_0x198161[_0xba32('0x2f')][_0xba32('0x39')]);_0xd67336[_0xba32('0x3a')]=qs[_0xba32('0x31')](_[_0xba32('0x3b')](_0x198161['query'],_0x42cf37[_0xba32('0x31')]),_0x197325);if(_0x198161[_0xba32('0x2f')][_0xba32('0x3c')]){_0xd67336[_0xba32('0x3a')]=_['merge'](_0xd67336[_0xba32('0x3a')],{'$or':_['map'](_0x197325,function(_0x95a6ff){if(_0x95a6ff['type']!==_0xba32('0x3d')){var _0x396f29={};_0x396f29[_0x95a6ff[_0xba32('0x28')]]={'$like':'%'+_0x198161[_0xba32('0x2f')][_0xba32('0x3c')]+'%'};return _0x396f29;}})});}_0xd67336=_[_0xba32('0x3e')]({},_0xd67336,_0x198161['options']);var _0x40de96={'where':_0xd67336['where']};return db[_0xba32('0x3f')][_0xba32('0x40')](_0x40de96)[_0xba32('0x22')](function(_0x558d2b){_0x48d819[_0xba32('0x40')]=_0x558d2b;if(_0x198161[_0xba32('0x2f')]['includeAll']){_0xd67336[_0xba32('0x41')]=[{'all':!![]}];}return db[_0xba32('0x3f')][_0xba32('0x42')](_0xd67336);})['then'](function(_0x1537a3){_0x48d819[_0xba32('0x43')]=_0x1537a3;return _0x48d819;})['then'](respondWithFilteredResult(_0x1e2433,_0xd67336))[_0xba32('0x44')](handleError(_0x1e2433,null));};exports[_0xba32('0x45')]=function(_0x1044d8,_0x4bb065){var _0x520afd={'raw':![],'where':{'id':_0x1044d8[_0xba32('0x46')]['id']}},_0x7cd2e0={};_0x7cd2e0['model']=_[_0xba32('0x30')](db[_0xba32('0x3f')]['rawAttributes']);_0x7cd2e0[_0xba32('0x2f')]=_['keys'](_0x1044d8[_0xba32('0x2f')]);_0x7cd2e0[_0xba32('0x31')]=_[_0xba32('0x32')](_0x7cd2e0[_0xba32('0x2e')],_0x7cd2e0[_0xba32('0x2f')]);_0x520afd[_0xba32('0x33')]=_['intersection'](_0x7cd2e0[_0xba32('0x2e')],qs[_0xba32('0x34')](_0x1044d8[_0xba32('0x2f')][_0xba32('0x34')]));_0x520afd[_0xba32('0x33')]=_0x520afd['attributes'][_0xba32('0x35')]?_0x520afd[_0xba32('0x33')]:_0x7cd2e0[_0xba32('0x2e')];if(_0x1044d8['query']['includeAll']){_0x520afd[_0xba32('0x41')]=[{'all':!![]}];}_0x520afd=_[_0xba32('0x3e')]({},_0x520afd,_0x1044d8['options']);return db['Team'][_0xba32('0x47')](_0x520afd)[_0xba32('0x22')](handleEntityNotFound(_0x4bb065,null))[_0xba32('0x22')](respondWithResult(_0x4bb065,null))['catch'](handleError(_0x4bb065,null));};exports['create']=function(_0x284848,_0x2bdc42){return db[_0xba32('0x3f')][_0xba32('0x48')](_0x284848['body'],{})[_0xba32('0x22')](function(_0x165c34){var _0x2b5366=_0x284848[_0xba32('0x49')]['get']({'plain':!![]});if(!_0x2b5366)throw new Error(_0xba32('0x4a'));if(_0x2b5366[_0xba32('0x4b')]===_0xba32('0x49')){var _0xf4fa51=_0x165c34['get']({'plain':!![]});var _0x15da05=_0xba32('0x25');return db[_0xba32('0x4c')][_0xba32('0x47')]({'where':{'name':_0x15da05,'userProfileId':_0x2b5366[_0xba32('0x4d')]},'raw':!![]})['then'](function(_0x18e7d9){if(_0x18e7d9&&_0x18e7d9[_0xba32('0x4e')]===0x0){return db[_0xba32('0x26')][_0xba32('0x48')]({'name':_0xf4fa51['name'],'resourceId':_0xf4fa51['id'],'type':_0x18e7d9[_0xba32('0x28')],'sectionId':_0x18e7d9['id']},{})[_0xba32('0x22')](function(){return _0x165c34;});}else{return _0x165c34;}})[_0xba32('0x44')](function(_0x2cbe01){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2cbe01);throw _0x2cbe01;});}return _0x165c34;})[_0xba32('0x22')](respondWithResult(_0x2bdc42,0xc9))[_0xba32('0x44')](handleError(_0x2bdc42,null));};exports[_0xba32('0x4f')]=function(_0x1e3a83,_0x416572){if(_0x1e3a83['body']['id']){delete _0x1e3a83[_0xba32('0x50')]['id'];}return db[_0xba32('0x3f')][_0xba32('0x47')]({'where':{'id':_0x1e3a83[_0xba32('0x46')]['id']}})['then'](handleEntityNotFound(_0x416572,null))[_0xba32('0x22')](saveUpdates(_0x1e3a83[_0xba32('0x50')],null))['then'](respondWithResult(_0x416572,null))[_0xba32('0x44')](handleError(_0x416572,null));};exports['destroy']=function(_0x552c93,_0xabccac){return db[_0xba32('0x3f')][_0xba32('0x47')]({'where':{'id':_0x552c93['params']['id']}})[_0xba32('0x22')](handleEntityNotFound(_0xabccac,null))[_0xba32('0x22')](removeEntity(_0xabccac,null))[_0xba32('0x44')](handleError(_0xabccac,null));};exports[_0xba32('0x51')]=function(_0x23de08,_0x4a8040,_0xcb83c7){return db['Team'][_0xba32('0x52')]({'where':{'id':_0x23de08[_0xba32('0x46')]['id']}})[_0xba32('0x22')](handleEntityNotFound(_0x4a8040,null))[_0xba32('0x22')](function(_0x33155e){if(!_0x23de08[_0xba32('0x2f')][_0xba32('0x53')]||!utils[_0xba32('0x54')](_0x23de08[_0xba32('0x2f')][_0xba32('0x53')])){throw new db[(_0xba32('0x55'))][(_0xba32('0x56'))](_0xba32('0x57'));}var _0x5d00e4={};var _0x2eef2d={};_0x2eef2d[_0xba32('0x2e')]=_['keys'](db[_['capitalize'](_0x23de08[_0xba32('0x2f')][_0xba32('0x53')][_0xba32('0x58')]())+_0xba32('0x59')][_0xba32('0x2b')]);_0x2eef2d[_0xba32('0x2f')]=_[_0xba32('0x30')](_0x23de08['query']);_0x2eef2d[_0xba32('0x31')]=_[_0xba32('0x32')](_0x2eef2d[_0xba32('0x2e')],_0x2eef2d[_0xba32('0x2f')]);_0x5d00e4[_0xba32('0x33')]=_[_0xba32('0x32')](_0x2eef2d['model'],qs[_0xba32('0x34')](_0x23de08[_0xba32('0x2f')][_0xba32('0x34')]));_0x5d00e4['attributes']=_0x5d00e4[_0xba32('0x33')]['length']?_0x5d00e4[_0xba32('0x33')]:_0x2eef2d['model'];_0x5d00e4['limit']=qs[_0xba32('0x1c')](_0x23de08[_0xba32('0x2f')]['limit']);_0x5d00e4[_0xba32('0x1a')]=qs['offset'](_0x23de08[_0xba32('0x2f')][_0xba32('0x1a')]);_0x5d00e4[_0xba32('0x38')]=qs[_0xba32('0x39')](_0x23de08[_0xba32('0x2f')][_0xba32('0x39')]);_0x5d00e4[_0xba32('0x3a')]=qs[_0xba32('0x31')](_[_0xba32('0x3b')](_0x23de08[_0xba32('0x2f')],_0x2eef2d[_0xba32('0x31')]));_0x5d00e4=_[_0xba32('0x3e')]({},_0x5d00e4,_0x23de08[_0xba32('0x5a')]);return _0x33155e[_0xba32('0x24')+_[_0xba32('0x5b')](_0x23de08['query'][_0xba32('0x53')][_0xba32('0x58')]())+_0xba32('0x5c')](_0x5d00e4);})[_0xba32('0x22')](respondWithResult(_0x4a8040,null))[_0xba32('0x44')](handleError(_0x4a8040,null));};exports[_0xba32('0x5d')]=function(_0x12da0d,_0x48c0c8,_0x23f97c){return db[_0xba32('0x3f')][_0xba32('0x52')]({'where':{'id':_0x12da0d[_0xba32('0x46')]['id']}})['then'](function(_0x350f10){if(_0x350f10){if(!_0x12da0d[_0xba32('0x50')]['channel']||!utils['isValidChannel'](_0x12da0d[_0xba32('0x50')][_0xba32('0x53')])){throw new db[(_0xba32('0x55'))][(_0xba32('0x56'))](_0xba32('0x57'));}return _0x350f10[_0xba32('0x5e')+_[_0xba32('0x5b')](_0x12da0d[_0xba32('0x50')][_0xba32('0x53')]['toLowerCase']())+_0xba32('0x5c')](_0x12da0d[_0xba32('0x50')][_0xba32('0x5f')]);}return null;})[_0xba32('0x22')](handleEntityNotFound(_0x48c0c8,null))['then'](respondWithStatusCode(_0x48c0c8,null))['catch'](handleError(_0x48c0c8,null));};exports[_0xba32('0x60')]=function(_0xec94d4,_0x1bf21c,_0x35689f){return db['Team'][_0xba32('0x52')]({'where':{'id':_0xec94d4['params']['id']}})['then'](function(_0x1d44a7){if(_0x1d44a7){if(!_0xec94d4['query'][_0xba32('0x53')]||!utils[_0xba32('0x54')](_0xec94d4[_0xba32('0x2f')][_0xba32('0x53')])){throw new db[(_0xba32('0x55'))][(_0xba32('0x56'))](_0xba32('0x57'));}return _0x1d44a7['remove'+_[_0xba32('0x5b')](_0xec94d4[_0xba32('0x2f')]['channel'][_0xba32('0x58')]())+_0xba32('0x5c')](_0xec94d4[_0xba32('0x2f')]['ids']);}return null;})[_0xba32('0x22')](handleEntityNotFound(_0x1bf21c,null))['then'](respondWithStatusCode(_0x1bf21c,null))['catch'](handleError(_0x1bf21c,null));};exports['addAgents']=function(_0x44d139,_0x2cbd94){return db[_0xba32('0x3f')][_0xba32('0x47')]({'where':{'id':_0x44d139[_0xba32('0x46')]['id']}})[_0xba32('0x22')](handleEntityNotFound(_0x2cbd94,null))[_0xba32('0x22')](function(_0x1ff865){if(_0x1ff865){var _0xf60750=['Voice',_0xba32('0x61'),_0xba32('0x62'),_0xba32('0x63'),_0xba32('0x64'),'Openchannel','Whatsapp'];return db[_0xba32('0x65')][_0xba32('0x66')](function(_0x1b87b3){var _0x5866f4=_['map'](_0xf60750,function(_0x2002d5){var _0x529101={'attributes':['id',_0xba32('0x28')]};if(_0x2002d5==='Voice'){_0x529101[_0xba32('0x67')]={'attributes':[_0xba32('0x68')]};}return _0x1ff865[_0xba32('0x24')+_0x2002d5+'Queues'](_0x529101)[_0xba32('0x22')](function(_0x1eada6){var _0x5bc235=_[_0xba32('0x2a')](_0x1eada6,function(_0x21a979){var _0x4491e8=_['map'](_0x44d139['body'][_0xba32('0x5f')],function(_0x553ed8){var _0xabcc8a={'where':{'UserId':_0x553ed8,[_0x2002d5+'QueueId']:_0x21a979['id']},'transaction':_0x1b87b3};if(_0x2002d5==='Voice'){_0xabcc8a[_0xba32('0x13')]={'penalty':_0x21a979[_0xba32('0x69')][_0xba32('0x68')]};}return db['User'+_0x2002d5+'Queue']['findOrCreate'](_0xabcc8a)[_0xba32('0x22')](function(){socket[_0xba32('0x6a')](_0xba32('0x49')+_0x2002d5+_0xba32('0x6b'),{'UserId':_0x553ed8,[_0x2002d5+_0xba32('0x6c')]:_0x21a979['id']});if(_0x2002d5!==_0xba32('0x6d'))return;return db[_0xba32('0x6e')]['findAll']({'where':{'id':_0x44d139[_0xba32('0x50')][_0xba32('0x5f')],'online':0x1},'attributes':['id',_0xba32('0x28'),_0xba32('0x6f'),_0xba32('0x70'),'interface'],'raw':!![]})[_0xba32('0x22')](function(_0xfc2766){var _0x3b6709=_[_0xba32('0x2a')](_0xfc2766,function(_0x483056){return db['UserVoiceQueueRt'][_0xba32('0x71')]({'membername':_0x483056['name'],'UserId':_0x483056['id'],'queue_name':_0x21a979[_0xba32('0x28')],'VoiceQueueId':_0x21a979['id'],'interface':_[_0xba32('0x72')](_0x483056[_0xba32('0x73')])?util[_0xba32('0x74')](_0xba32('0x75'),_0x483056[_0xba32('0x28')]):_0x483056[_0xba32('0x73')],'paused':_0x483056[_0xba32('0x70')]||![],'penalty':_0x21a979[_0xba32('0x69')][_0xba32('0x68')]},{'transaction':_0x1b87b3});});return Promise['all'](_0x3b6709);});});});return Promise[_0xba32('0x76')](_0x4491e8);});return Promise['all'](_0x5bc235);});});return Promise['all'](_0x5866f4)['then'](function(){return _0x1ff865[_0xba32('0x77')](_0x44d139[_0xba32('0x50')][_0xba32('0x5f')],{'transaction':_0x1b87b3})[_0xba32('0x78')](function(_0x3f2722){return _0x3f2722;});});});}})[_0xba32('0x22')](respondWithResult(_0x2cbd94,null))[_0xba32('0x44')](handleError(_0x2cbd94,null));};exports[_0xba32('0x79')]=function(_0x38f5e0,_0x4549d6){return db['Team'][_0xba32('0x47')]({'where':{'id':_0x38f5e0[_0xba32('0x46')]['id']}})['then'](handleEntityNotFound(_0x4549d6,null))[_0xba32('0x22')](function(_0x196bbe){if(_0x196bbe){var _0x49f9e2=[_0xba32('0x6d'),_0xba32('0x61'),_0xba32('0x62'),_0xba32('0x63'),_0xba32('0x64'),_0xba32('0x7a'),_0xba32('0x7b')];return db[_0xba32('0x65')]['transaction'](function(_0x22ca2a){var _0x2fee33=_[_0xba32('0x2a')](_0x49f9e2,function(_0x625752){var _0x5a5713={'attributes':['id','name']};return _0x196bbe[_0xba32('0x24')+_0x625752+_0xba32('0x5c')](_0x5a5713)[_0xba32('0x22')](function(_0xcc5976){var _0x13ed2f=_[_0xba32('0x2a')](_0xcc5976,function(_0x3481da){return _0x3481da[_0xba32('0x79')](_0x38f5e0['query'][_0xba32('0x5f')],{'transaction':_0x22ca2a})[_0xba32('0x22')](function(){var _0x23080a=JSON[_0xba32('0x7c')]('['+_0x38f5e0['query']['ids']+']');var _0x156995=_[_0xba32('0x2a')](_0x23080a,function(_0x45bb90){socket[_0xba32('0x6a')]('user'+_0x625752+'Queue:remove',{'UserId':Number(_0x45bb90),[_0x625752+'QueueId']:_0x3481da['id']});if(_0x625752!==_0xba32('0x6d'))return;return db[_0xba32('0x7d')][_0xba32('0x23')]({'where':{'VoiceQueueId':_0x3481da['id'],'UserId':_0x45bb90},'transaction':_0x22ca2a});});return Promise[_0xba32('0x76')](_0x156995);});});return Promise[_0xba32('0x76')](_0x13ed2f);});});return Promise[_0xba32('0x76')](_0x2fee33)[_0xba32('0x22')](function(){return _0x196bbe['removeAgents'](_0x38f5e0[_0xba32('0x2f')][_0xba32('0x5f')],{'transaction':_0x22ca2a});});});}})[_0xba32('0x22')](respondWithStatusCode(_0x4549d6,null))[_0xba32('0x44')](handleError(_0x4549d6,null));};exports[_0xba32('0x7e')]=function(_0xb5038d,_0x3a3985,_0x3915eb){var _0x403cfe={};var _0x43e085={};var _0x300dad;var _0x49743e;return db[_0xba32('0x3f')][_0xba32('0x52')]({'where':{'id':_0xb5038d[_0xba32('0x46')]['id']}})[_0xba32('0x22')](handleEntityNotFound(_0x3a3985,null))[_0xba32('0x22')](function(_0x15c2f5){if(_0x15c2f5){_0x300dad=_0x15c2f5;_0x43e085[_0xba32('0x2e')]=_[_0xba32('0x30')](db[_0xba32('0x6e')]['rawAttributes']);_0x43e085['query']=_['keys'](_0xb5038d['query']);_0x43e085['filters']=_[_0xba32('0x32')](_0x43e085[_0xba32('0x2e')],_0x43e085['query']);_0x403cfe[_0xba32('0x33')]=_[_0xba32('0x32')](_0x43e085['model'],qs[_0xba32('0x34')](_0xb5038d[_0xba32('0x2f')][_0xba32('0x34')]));_0x403cfe[_0xba32('0x33')]=_0x403cfe[_0xba32('0x33')]['length']?_0x403cfe['attributes']:_0x43e085[_0xba32('0x2e')];_0x403cfe['order']=qs[_0xba32('0x39')](_0xb5038d[_0xba32('0x2f')]['sort']);_0x403cfe['where']=qs[_0xba32('0x31')](_[_0xba32('0x3b')](_0xb5038d[_0xba32('0x2f')],_0x43e085['filters']));if(_0xb5038d[_0xba32('0x2f')][_0xba32('0x3c')]){_0x403cfe[_0xba32('0x3a')]=_[_0xba32('0x3e')](_0x403cfe[_0xba32('0x3a')],{'$or':_[_0xba32('0x2a')](_0x403cfe[_0xba32('0x33')],function(_0x2dd83d){var _0x1d0418={};_0x1d0418[_0x2dd83d]={'$like':'%'+_0xb5038d[_0xba32('0x2f')][_0xba32('0x3c')]+'%'};return _0x1d0418;})});}_0x403cfe=_['merge']({},_0x403cfe,_0xb5038d[_0xba32('0x5a')]);return _0x300dad[_0xba32('0x7e')](_0x403cfe);}})[_0xba32('0x22')](function(_0x25557b){if(_0x25557b){_0x49743e=_0x25557b[_0xba32('0x35')];if(!_0xb5038d[_0xba32('0x2f')][_0xba32('0x36')](_0xba32('0x37'))){_0x403cfe[_0xba32('0x1c')]=qs[_0xba32('0x1c')](_0xb5038d[_0xba32('0x2f')]['limit']);_0x403cfe['offset']=qs[_0xba32('0x1a')](_0xb5038d[_0xba32('0x2f')][_0xba32('0x1a')]);}return _0x300dad[_0xba32('0x7e')](_0x403cfe);}})[_0xba32('0x22')](function(_0x423da9){if(_0x423da9){return _0x423da9?{'count':_0x49743e,'rows':_0x423da9}:null;}})['then'](respondWithResult(_0x3a3985,null))[_0xba32('0x44')](handleError(_0x3a3985,null));}; \ No newline at end of file +var _0x6903=['includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','getQueues','channel','isValidChannel','Sequelize','Unknown\x20channel','capitalize','toLowerCase','Queues','ValidationError','add','ids','removeQueues','findOne','remove','addAgents','Chat','Mail','Openchannel','Whatsapp','Voice','penalty','QueueId','TeamVoiceQueue','User','emit','Queue:save','online','voicePause','UserVoiceQueueRt','upsert','isNil','interface','format','SIP/%s','all','removeAgents','Sms','Fax','sequelize','transaction','parse','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','redis','localhost','./team.socket','register','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','then','destroy','get','Teams','UserProfileResource','sendStatus','error','name','index','map','Team','fieldName','type','key','keys','filters','intersection','model','attributes','fields','query','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options'];(function(_0x6c88c2,_0x1da47a){var _0x55c354=function(_0xb6858f){while(--_0xb6858f){_0x6c88c2['push'](_0x6c88c2['shift']());}};_0x55c354(++_0x1da47a);}(_0x6903,0x1c5));var _0x3690=function(_0x3fcacb,_0x6d7dd1){_0x3fcacb=_0x3fcacb-0x0;var _0x2f9e9b=_0x6903[_0x3fcacb];return _0x2f9e9b;};'use strict';var emlformat=require(_0x3690('0x0'));var rimraf=require(_0x3690('0x1'));var zipdir=require(_0x3690('0x2'));var jsonpatch=require(_0x3690('0x3'));var rp=require(_0x3690('0x4'));var moment=require(_0x3690('0x5'));var BPromise=require(_0x3690('0x6'));var Mustache=require(_0x3690('0x7'));var util=require(_0x3690('0x8'));var path=require(_0x3690('0x9'));var sox=require('sox');var csv=require(_0x3690('0xa'));var ejs=require(_0x3690('0xb'));var fs=require('fs');var fs_extra=require(_0x3690('0xc'));var _=require(_0x3690('0xd'));var squel=require('squel');var crypto=require(_0x3690('0xe'));var jsforce=require(_0x3690('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x3690('0xa'));var querystring=require(_0x3690('0x10'));var Papa=require(_0x3690('0x11'));var Redis=require('ioredis');var authService=require(_0x3690('0x12'));var qs=require(_0x3690('0x13'));var as=require(_0x3690('0x14'));var hardwareService=require(_0x3690('0x15'));var logger=require('../../config/logger')(_0x3690('0x16'));var utils=require(_0x3690('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x3690('0x18'))['db'];config[_0x3690('0x19')]=_['defaults'](config[_0x3690('0x19')],{'host':_0x3690('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x3690('0x1b'))[_0x3690('0x1c')](socket);function respondWithStatusCode(_0x35b031,_0x5abbe0){_0x5abbe0=_0x5abbe0||0xcc;return function(_0x3c8a75){if(_0x3c8a75){return _0x35b031['sendStatus'](_0x5abbe0);}return _0x35b031[_0x3690('0x1d')](_0x5abbe0)['end']();};}function respondWithResult(_0x2706f4,_0xb40e77){_0xb40e77=_0xb40e77||0xc8;return function(_0x397327){if(_0x397327){return _0x2706f4[_0x3690('0x1d')](_0xb40e77)[_0x3690('0x1e')](_0x397327);}};}function respondWithFilteredResult(_0x55e787,_0x155e56){return function(_0x3dd610){if(_0x3dd610){var _0x562a07=typeof _0x155e56['offset']===_0x3690('0x1f')&&typeof _0x155e56[_0x3690('0x20')]===_0x3690('0x1f');var _0x4662b2=_0x3dd610[_0x3690('0x21')];var _0x411282=_0x562a07?0x0:_0x155e56[_0x3690('0x22')];var _0x5a7fd1=_0x562a07?_0x3dd610[_0x3690('0x21')]:_0x155e56[_0x3690('0x22')]+_0x155e56[_0x3690('0x20')];var _0x9b7e84;if(_0x5a7fd1>=_0x4662b2){_0x5a7fd1=_0x4662b2;_0x9b7e84=0xc8;}else{_0x9b7e84=0xce;}_0x55e787[_0x3690('0x1d')](_0x9b7e84);return _0x55e787[_0x3690('0x23')](_0x3690('0x24'),_0x411282+'-'+_0x5a7fd1+'/'+_0x4662b2)['json'](_0x3dd610);}return null;};}function patchUpdates(_0x599907){return function(_0x29dd8f){try{jsonpatch[_0x3690('0x25')](_0x29dd8f,_0x599907,!![]);}catch(_0x28047a){return BPromise[_0x3690('0x26')](_0x28047a);}return _0x29dd8f[_0x3690('0x27')]();};}function saveUpdates(_0x419ee0,_0x39cb7e){return function(_0x50fbb4){if(_0x50fbb4){return _0x50fbb4['update'](_0x419ee0)[_0x3690('0x28')](function(_0x45eff3){return _0x45eff3;});}return null;};}function removeEntity(_0x54a210,_0x581b70){return function(_0x32ac96){if(_0x32ac96){return _0x32ac96[_0x3690('0x29')]()['then'](function(){var _0x2ba5f4=_0x32ac96[_0x3690('0x2a')]({'plain':!![]});var _0x3d1d02=_0x3690('0x2b');return db[_0x3690('0x2c')][_0x3690('0x29')]({'where':{'type':_0x3d1d02,'resourceId':_0x2ba5f4['id']}})[_0x3690('0x28')](function(){return _0x32ac96;});})['then'](function(){_0x54a210['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4a8936,_0x3790dc){return function(_0xff6e0b){if(!_0xff6e0b){_0x4a8936[_0x3690('0x2d')](0x194);}return _0xff6e0b;};}function handleError(_0x7cbb8e,_0x48a0e7){_0x48a0e7=_0x48a0e7||0x1f4;return function(_0x9f4cf5){logger[_0x3690('0x2e')](_0x9f4cf5['stack']);if(_0x9f4cf5['name']){delete _0x9f4cf5[_0x3690('0x2f')];}_0x7cbb8e['status'](_0x48a0e7)['send'](_0x9f4cf5);};}exports[_0x3690('0x30')]=function(_0x45ba59,_0x27a376){var _0x24540b={},_0x338076={},_0x4f00d0={'count':0x0,'rows':[]};var _0x2efac5=_[_0x3690('0x31')](db[_0x3690('0x32')]['rawAttributes'],function(_0x2a0211){return{'name':_0x2a0211[_0x3690('0x33')],'type':_0x2a0211[_0x3690('0x34')][_0x3690('0x35')]};});_0x338076['model']=_[_0x3690('0x31')](_0x2efac5,_0x3690('0x2f'));_0x338076['query']=_[_0x3690('0x36')](_0x45ba59['query']);_0x338076[_0x3690('0x37')]=_[_0x3690('0x38')](_0x338076[_0x3690('0x39')],_0x338076['query']);_0x24540b[_0x3690('0x3a')]=_[_0x3690('0x38')](_0x338076[_0x3690('0x39')],qs[_0x3690('0x3b')](_0x45ba59[_0x3690('0x3c')]['fields']));_0x24540b[_0x3690('0x3a')]=_0x24540b[_0x3690('0x3a')][_0x3690('0x3d')]?_0x24540b[_0x3690('0x3a')]:_0x338076[_0x3690('0x39')];if(!_0x45ba59['query'][_0x3690('0x3e')](_0x3690('0x3f'))){_0x24540b[_0x3690('0x20')]=qs[_0x3690('0x20')](_0x45ba59[_0x3690('0x3c')][_0x3690('0x20')]);_0x24540b['offset']=qs[_0x3690('0x22')](_0x45ba59['query'][_0x3690('0x22')]);}_0x24540b[_0x3690('0x40')]=qs[_0x3690('0x41')](_0x45ba59[_0x3690('0x3c')][_0x3690('0x41')]);_0x24540b[_0x3690('0x42')]=qs[_0x3690('0x37')](_['pick'](_0x45ba59[_0x3690('0x3c')],_0x338076['filters']),_0x2efac5);if(_0x45ba59['query']['filter']){_0x24540b['where']=_[_0x3690('0x43')](_0x24540b[_0x3690('0x42')],{'$or':_[_0x3690('0x31')](_0x2efac5,function(_0x48d48e){if(_0x48d48e[_0x3690('0x34')]!==_0x3690('0x44')){var _0x67def0={};_0x67def0[_0x48d48e[_0x3690('0x2f')]]={'$like':'%'+_0x45ba59['query'][_0x3690('0x45')]+'%'};return _0x67def0;}})});}_0x24540b=_[_0x3690('0x43')]({},_0x24540b,_0x45ba59[_0x3690('0x46')]);var _0x2dc88a={'where':_0x24540b['where']};return db[_0x3690('0x32')]['count'](_0x2dc88a)[_0x3690('0x28')](function(_0x718f51){_0x4f00d0['count']=_0x718f51;if(_0x45ba59['query'][_0x3690('0x47')]){_0x24540b[_0x3690('0x48')]=[{'all':!![]}];}return db[_0x3690('0x32')][_0x3690('0x49')](_0x24540b);})['then'](function(_0x192489){_0x4f00d0[_0x3690('0x4a')]=_0x192489;return _0x4f00d0;})[_0x3690('0x28')](respondWithFilteredResult(_0x27a376,_0x24540b))[_0x3690('0x4b')](handleError(_0x27a376,null));};exports[_0x3690('0x4c')]=function(_0xd709e6,_0x5a0f1a){var _0x8500e8={'raw':![],'where':{'id':_0xd709e6[_0x3690('0x4d')]['id']}},_0x5de7e3={};_0x5de7e3['model']=_[_0x3690('0x36')](db[_0x3690('0x32')][_0x3690('0x4e')]);_0x5de7e3[_0x3690('0x3c')]=_['keys'](_0xd709e6[_0x3690('0x3c')]);_0x5de7e3[_0x3690('0x37')]=_[_0x3690('0x38')](_0x5de7e3['model'],_0x5de7e3[_0x3690('0x3c')]);_0x8500e8[_0x3690('0x3a')]=_[_0x3690('0x38')](_0x5de7e3[_0x3690('0x39')],qs[_0x3690('0x3b')](_0xd709e6[_0x3690('0x3c')]['fields']));_0x8500e8[_0x3690('0x3a')]=_0x8500e8[_0x3690('0x3a')][_0x3690('0x3d')]?_0x8500e8['attributes']:_0x5de7e3[_0x3690('0x39')];if(_0xd709e6[_0x3690('0x3c')][_0x3690('0x47')]){_0x8500e8[_0x3690('0x48')]=[{'all':!![]}];}_0x8500e8=_[_0x3690('0x43')]({},_0x8500e8,_0xd709e6[_0x3690('0x46')]);return db['Team'][_0x3690('0x4f')](_0x8500e8)[_0x3690('0x28')](handleEntityNotFound(_0x5a0f1a,null))[_0x3690('0x28')](respondWithResult(_0x5a0f1a,null))[_0x3690('0x4b')](handleError(_0x5a0f1a,null));};exports['create']=function(_0x282a46,_0x3bcac6){return db[_0x3690('0x32')][_0x3690('0x50')](_0x282a46[_0x3690('0x51')],{})[_0x3690('0x28')](function(_0x4dc3b4){var _0x1d97bc=_0x282a46[_0x3690('0x52')][_0x3690('0x2a')]({'plain':!![]});if(!_0x1d97bc)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1d97bc[_0x3690('0x53')]==='user'){var _0x2ee545=_0x4dc3b4[_0x3690('0x2a')]({'plain':!![]});var _0x2ceb47=_0x3690('0x2b');return db[_0x3690('0x54')]['find']({'where':{'name':_0x2ceb47,'userProfileId':_0x1d97bc[_0x3690('0x55')]},'raw':!![]})[_0x3690('0x28')](function(_0x5c3fb9){if(_0x5c3fb9&&_0x5c3fb9[_0x3690('0x56')]===0x0){return db[_0x3690('0x2c')][_0x3690('0x50')]({'name':_0x2ee545['name'],'resourceId':_0x2ee545['id'],'type':_0x5c3fb9[_0x3690('0x2f')],'sectionId':_0x5c3fb9['id']},{})['then'](function(){return _0x4dc3b4;});}else{return _0x4dc3b4;}})[_0x3690('0x4b')](function(_0x4b3546){logger['error'](_0x3690('0x57'),_0x4b3546);throw _0x4b3546;});}return _0x4dc3b4;})[_0x3690('0x28')](respondWithResult(_0x3bcac6,0xc9))['catch'](handleError(_0x3bcac6,null));};exports[_0x3690('0x58')]=function(_0x4779cd,_0x2342d9){if(_0x4779cd[_0x3690('0x51')]['id']){delete _0x4779cd['body']['id'];}return db[_0x3690('0x32')][_0x3690('0x4f')]({'where':{'id':_0x4779cd[_0x3690('0x4d')]['id']}})[_0x3690('0x28')](handleEntityNotFound(_0x2342d9,null))[_0x3690('0x28')](saveUpdates(_0x4779cd[_0x3690('0x51')],null))[_0x3690('0x28')](respondWithResult(_0x2342d9,null))[_0x3690('0x4b')](handleError(_0x2342d9,null));};exports[_0x3690('0x29')]=function(_0x2643cf,_0x5712da){return db['Team'][_0x3690('0x4f')]({'where':{'id':_0x2643cf[_0x3690('0x4d')]['id']}})[_0x3690('0x28')](handleEntityNotFound(_0x5712da,null))[_0x3690('0x28')](removeEntity(_0x5712da,null))[_0x3690('0x4b')](handleError(_0x5712da,null));};exports[_0x3690('0x59')]=function(_0x53f1dc,_0x12b014,_0x1a5257){return db[_0x3690('0x32')]['findOne']({'where':{'id':_0x53f1dc[_0x3690('0x4d')]['id']}})[_0x3690('0x28')](handleEntityNotFound(_0x12b014,null))['then'](function(_0x2152ed){if(!_0x53f1dc['query'][_0x3690('0x5a')]||!utils[_0x3690('0x5b')](_0x53f1dc[_0x3690('0x3c')][_0x3690('0x5a')])){throw new db[(_0x3690('0x5c'))]['ValidationError'](_0x3690('0x5d'));}var _0x4626ef={};var _0xf2bc84={};_0xf2bc84[_0x3690('0x39')]=_['keys'](db[_[_0x3690('0x5e')](_0x53f1dc[_0x3690('0x3c')][_0x3690('0x5a')]['toLowerCase']())+'Queue']['rawAttributes']);_0xf2bc84[_0x3690('0x3c')]=_[_0x3690('0x36')](_0x53f1dc[_0x3690('0x3c')]);_0xf2bc84['filters']=_[_0x3690('0x38')](_0xf2bc84[_0x3690('0x39')],_0xf2bc84[_0x3690('0x3c')]);_0x4626ef[_0x3690('0x3a')]=_[_0x3690('0x38')](_0xf2bc84[_0x3690('0x39')],qs[_0x3690('0x3b')](_0x53f1dc[_0x3690('0x3c')][_0x3690('0x3b')]));_0x4626ef['attributes']=_0x4626ef[_0x3690('0x3a')][_0x3690('0x3d')]?_0x4626ef[_0x3690('0x3a')]:_0xf2bc84[_0x3690('0x39')];_0x4626ef[_0x3690('0x20')]=qs['limit'](_0x53f1dc['query']['limit']);_0x4626ef[_0x3690('0x22')]=qs['offset'](_0x53f1dc['query'][_0x3690('0x22')]);_0x4626ef['order']=qs[_0x3690('0x41')](_0x53f1dc[_0x3690('0x3c')][_0x3690('0x41')]);_0x4626ef[_0x3690('0x42')]=qs[_0x3690('0x37')](_['pick'](_0x53f1dc[_0x3690('0x3c')],_0xf2bc84[_0x3690('0x37')]));_0x4626ef=_[_0x3690('0x43')]({},_0x4626ef,_0x53f1dc[_0x3690('0x46')]);return _0x2152ed[_0x3690('0x2a')+_[_0x3690('0x5e')](_0x53f1dc[_0x3690('0x3c')][_0x3690('0x5a')][_0x3690('0x5f')]())+_0x3690('0x60')](_0x4626ef);})[_0x3690('0x28')](respondWithResult(_0x12b014,null))[_0x3690('0x4b')](handleError(_0x12b014,null));};exports['addQueues']=function(_0x5ee5b7,_0x3e6734,_0x524545){return db[_0x3690('0x32')]['findOne']({'where':{'id':_0x5ee5b7['params']['id']}})[_0x3690('0x28')](function(_0x49de09){if(_0x49de09){if(!_0x5ee5b7[_0x3690('0x51')][_0x3690('0x5a')]||!utils['isValidChannel'](_0x5ee5b7[_0x3690('0x51')][_0x3690('0x5a')])){throw new db['Sequelize'][(_0x3690('0x61'))]('Unknown\x20channel');}return _0x49de09[_0x3690('0x62')+_['capitalize'](_0x5ee5b7[_0x3690('0x51')][_0x3690('0x5a')]['toLowerCase']())+'Queues'](_0x5ee5b7[_0x3690('0x51')][_0x3690('0x63')]);}return null;})[_0x3690('0x28')](handleEntityNotFound(_0x3e6734,null))['then'](respondWithStatusCode(_0x3e6734,null))[_0x3690('0x4b')](handleError(_0x3e6734,null));};exports[_0x3690('0x64')]=function(_0x3ba939,_0x4d9314,_0x44a72e){return db['Team'][_0x3690('0x65')]({'where':{'id':_0x3ba939[_0x3690('0x4d')]['id']}})[_0x3690('0x28')](function(_0x51f16d){if(_0x51f16d){if(!_0x3ba939[_0x3690('0x3c')]['channel']||!utils['isValidChannel'](_0x3ba939[_0x3690('0x3c')][_0x3690('0x5a')])){throw new db[(_0x3690('0x5c'))][(_0x3690('0x61'))](_0x3690('0x5d'));}return _0x51f16d[_0x3690('0x66')+_[_0x3690('0x5e')](_0x3ba939[_0x3690('0x3c')][_0x3690('0x5a')][_0x3690('0x5f')]())+_0x3690('0x60')](_0x3ba939[_0x3690('0x3c')][_0x3690('0x63')]);}return null;})['then'](handleEntityNotFound(_0x4d9314,null))[_0x3690('0x28')](respondWithStatusCode(_0x4d9314,null))[_0x3690('0x4b')](handleError(_0x4d9314,null));};exports[_0x3690('0x67')]=function(_0x1520f1,_0x3243ea){return db['Team'][_0x3690('0x4f')]({'where':{'id':_0x1520f1['params']['id']}})['then'](handleEntityNotFound(_0x3243ea,null))[_0x3690('0x28')](function(_0x12e181){if(_0x12e181){var _0x50b9ff=['Voice',_0x3690('0x68'),_0x3690('0x69'),'Sms','Fax',_0x3690('0x6a'),_0x3690('0x6b')];return db['sequelize']['transaction'](function(_0x15e353){var _0x26330d=_[_0x3690('0x31')](_0x50b9ff,function(_0x11863a){var _0x415b20={'attributes':['id',_0x3690('0x2f')]};if(_0x11863a===_0x3690('0x6c')){_0x415b20['through']={'attributes':[_0x3690('0x6d')]};}return _0x12e181[_0x3690('0x2a')+_0x11863a+'Queues'](_0x415b20)['then'](function(_0x516d9c){var _0x4bf94a=_[_0x3690('0x31')](_0x516d9c,function(_0x1c8107){var _0x43f76f=_[_0x3690('0x31')](_0x1520f1[_0x3690('0x51')][_0x3690('0x63')],function(_0x1112d2){var _0x311bad={'where':{'UserId':_0x1112d2,[_0x11863a+_0x3690('0x6e')]:_0x1c8107['id']},'transaction':_0x15e353};if(_0x11863a===_0x3690('0x6c')){_0x311bad['defaults']={'penalty':_0x1c8107[_0x3690('0x6f')][_0x3690('0x6d')]};}return db[_0x3690('0x70')+_0x11863a+'Queue']['findOrCreate'](_0x311bad)[_0x3690('0x28')](function(){socket[_0x3690('0x71')](_0x3690('0x52')+_0x11863a+_0x3690('0x72'),{'UserId':_0x1112d2,[_0x11863a+'QueueId']:_0x1c8107['id']});if(_0x11863a!==_0x3690('0x6c'))return;return db[_0x3690('0x70')][_0x3690('0x49')]({'where':{'id':_0x1520f1['body'][_0x3690('0x63')],'online':0x1},'attributes':['id',_0x3690('0x2f'),_0x3690('0x73'),_0x3690('0x74'),'interface'],'raw':!![]})[_0x3690('0x28')](function(_0xebeff8){var _0x44d755=_[_0x3690('0x31')](_0xebeff8,function(_0x4d2c65){return db[_0x3690('0x75')][_0x3690('0x76')]({'membername':_0x4d2c65[_0x3690('0x2f')],'UserId':_0x4d2c65['id'],'queue_name':_0x1c8107[_0x3690('0x2f')],'VoiceQueueId':_0x1c8107['id'],'interface':_[_0x3690('0x77')](_0x4d2c65[_0x3690('0x78')])?util[_0x3690('0x79')](_0x3690('0x7a'),_0x4d2c65['name']):_0x4d2c65['interface'],'paused':_0x4d2c65[_0x3690('0x74')]||![],'penalty':_0x1c8107[_0x3690('0x6f')][_0x3690('0x6d')]},{'transaction':_0x15e353});});return Promise['all'](_0x44d755);});});});return Promise['all'](_0x43f76f);});return Promise[_0x3690('0x7b')](_0x4bf94a);});});return Promise['all'](_0x26330d)[_0x3690('0x28')](function(){return _0x12e181[_0x3690('0x67')](_0x1520f1[_0x3690('0x51')][_0x3690('0x63')],{'transaction':_0x15e353})['spread'](function(_0x4327d7){return _0x4327d7;});});});}})[_0x3690('0x28')](respondWithResult(_0x3243ea,null))[_0x3690('0x4b')](handleError(_0x3243ea,null));};exports[_0x3690('0x7c')]=function(_0x17e80e,_0x2dbce5){return db['Team']['find']({'where':{'id':_0x17e80e[_0x3690('0x4d')]['id']}})[_0x3690('0x28')](handleEntityNotFound(_0x2dbce5,null))[_0x3690('0x28')](function(_0x3d3301){if(_0x3d3301){var _0x269131=[_0x3690('0x6c'),_0x3690('0x68'),_0x3690('0x69'),_0x3690('0x7d'),_0x3690('0x7e'),_0x3690('0x6a'),_0x3690('0x6b')];return db[_0x3690('0x7f')][_0x3690('0x80')](function(_0xd93ea2){var _0x4c3338=_[_0x3690('0x31')](_0x269131,function(_0x26a22c){var _0xbcef0d={'attributes':['id',_0x3690('0x2f')]};return _0x3d3301[_0x3690('0x2a')+_0x26a22c+'Queues'](_0xbcef0d)[_0x3690('0x28')](function(_0xea00a8){var _0x10d20d=_[_0x3690('0x31')](_0xea00a8,function(_0x420ee4){return _0x420ee4['removeAgents'](_0x17e80e[_0x3690('0x3c')]['ids'],{'transaction':_0xd93ea2})['then'](function(){var _0x2e32f3=JSON[_0x3690('0x81')]('['+_0x17e80e['query'][_0x3690('0x63')]+']');var _0x255c42=_['map'](_0x2e32f3,function(_0x4f6dab){socket[_0x3690('0x71')](_0x3690('0x52')+_0x26a22c+'Queue:remove',{'UserId':Number(_0x4f6dab),[_0x26a22c+_0x3690('0x6e')]:_0x420ee4['id']});if(_0x26a22c!=='Voice')return;return db['UserVoiceQueueRt']['destroy']({'where':{'VoiceQueueId':_0x420ee4['id'],'UserId':_0x4f6dab},'transaction':_0xd93ea2});});return Promise['all'](_0x255c42);});});return Promise[_0x3690('0x7b')](_0x10d20d);});});return Promise[_0x3690('0x7b')](_0x4c3338)[_0x3690('0x28')](function(){return _0x3d3301[_0x3690('0x7c')](_0x17e80e[_0x3690('0x3c')]['ids'],{'transaction':_0xd93ea2});});});}})['then'](respondWithStatusCode(_0x2dbce5,null))['catch'](handleError(_0x2dbce5,null));};exports[_0x3690('0x82')]=function(_0x3ddc20,_0x585c99,_0x9283a4){var _0x3587ac={};var _0x2c95e9={};var _0x35c7ca;var _0x5910d8;return db['Team']['findOne']({'where':{'id':_0x3ddc20['params']['id']}})['then'](handleEntityNotFound(_0x585c99,null))[_0x3690('0x28')](function(_0x159a0a){if(_0x159a0a){_0x35c7ca=_0x159a0a;_0x2c95e9['model']=_[_0x3690('0x36')](db['User'][_0x3690('0x4e')]);_0x2c95e9[_0x3690('0x3c')]=_[_0x3690('0x36')](_0x3ddc20[_0x3690('0x3c')]);_0x2c95e9['filters']=_[_0x3690('0x38')](_0x2c95e9[_0x3690('0x39')],_0x2c95e9[_0x3690('0x3c')]);_0x3587ac[_0x3690('0x3a')]=_[_0x3690('0x38')](_0x2c95e9['model'],qs[_0x3690('0x3b')](_0x3ddc20[_0x3690('0x3c')][_0x3690('0x3b')]));_0x3587ac['attributes']=_0x3587ac['attributes'][_0x3690('0x3d')]?_0x3587ac[_0x3690('0x3a')]:_0x2c95e9['model'];_0x3587ac[_0x3690('0x40')]=qs[_0x3690('0x41')](_0x3ddc20[_0x3690('0x3c')][_0x3690('0x41')]);_0x3587ac['where']=qs[_0x3690('0x37')](_['pick'](_0x3ddc20[_0x3690('0x3c')],_0x2c95e9[_0x3690('0x37')]));if(_0x3ddc20['query'][_0x3690('0x45')]){_0x3587ac[_0x3690('0x42')]=_[_0x3690('0x43')](_0x3587ac[_0x3690('0x42')],{'$or':_[_0x3690('0x31')](_0x3587ac['attributes'],function(_0x5250b0){var _0x309706={};_0x309706[_0x5250b0]={'$like':'%'+_0x3ddc20[_0x3690('0x3c')][_0x3690('0x45')]+'%'};return _0x309706;})});}_0x3587ac=_['merge']({},_0x3587ac,_0x3ddc20[_0x3690('0x46')]);return _0x35c7ca['getAgents'](_0x3587ac);}})[_0x3690('0x28')](function(_0x23ae01){if(_0x23ae01){_0x5910d8=_0x23ae01[_0x3690('0x3d')];if(!_0x3ddc20['query'][_0x3690('0x3e')](_0x3690('0x3f'))){_0x3587ac['limit']=qs[_0x3690('0x20')](_0x3ddc20[_0x3690('0x3c')][_0x3690('0x20')]);_0x3587ac[_0x3690('0x22')]=qs[_0x3690('0x22')](_0x3ddc20['query'][_0x3690('0x22')]);}return _0x35c7ca[_0x3690('0x82')](_0x3587ac);}})[_0x3690('0x28')](function(_0x5cafbf){if(_0x5cafbf){return _0x5cafbf?{'count':_0x5910d8,'rows':_0x5cafbf}:null;}})[_0x3690('0x28')](respondWithResult(_0x585c99,null))[_0x3690('0x4b')](handleError(_0x585c99,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index 2f1097b..0dc390f 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 _0x1bd3=['save','remove','emit','exports','events','Team'];(function(_0x13eca7,_0x29b30d){var _0x1abd34=function(_0x49ec9d){while(--_0x49ec9d){_0x13eca7['push'](_0x13eca7['shift']());}};_0x1abd34(++_0x29b30d);}(_0x1bd3,0x106));var _0x31bd=function(_0x3161eb,_0x338081){_0x3161eb=_0x3161eb-0x0;var _0x545a66=_0x1bd3[_0x3161eb];return _0x545a66;};'use strict';var EventEmitter=require(_0x31bd('0x0'));var Team=require('../../mysqldb')['db'][_0x31bd('0x1')];var TeamEvents=new EventEmitter();TeamEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x31bd('0x2'),'afterUpdate':'update','afterDestroy':_0x31bd('0x3')};function emitEvent(_0x19f5b5){return function(_0x226caf,_0x41701d,_0x1638ff){TeamEvents['emit'](_0x19f5b5+':'+_0x226caf['id'],_0x226caf);TeamEvents[_0x31bd('0x4')](_0x19f5b5,_0x226caf);_0x1638ff(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Team['hook'](e,emitEvent(event));}}module[_0x31bd('0x5')]=TeamEvents; \ No newline at end of file +var _0x8bea=['setMaxListeners','update','remove','emit','hasOwnProperty','hook','events','Team'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8bea,0x116));var _0xa8be=function(_0x2b8770,_0x114beb){_0x2b8770=_0x2b8770-0x0;var _0x25936c=_0x8bea[_0x2b8770];return _0x25936c;};'use strict';var EventEmitter=require(_0xa8be('0x0'));var Team=require('../../mysqldb')['db'][_0xa8be('0x1')];var TeamEvents=new EventEmitter();TeamEvents[_0xa8be('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xa8be('0x3'),'afterDestroy':_0xa8be('0x4')};function emitEvent(_0x2f6670){return function(_0x5cd87d,_0x557c2f,_0x1cf3d3){TeamEvents[_0xa8be('0x5')](_0x2f6670+':'+_0x5cd87d['id'],_0x5cd87d);TeamEvents[_0xa8be('0x5')](_0x2f6670,_0x5cd87d);_0x1cf3d3(null);};}for(var e in events){if(events[_0xa8be('0x6')](e)){var event=events[e];Team[_0xa8be('0x7')](e,emitEvent(event));}}module['exports']=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index 5e41b4e..43c9144 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 _0xc7bf=['path','rimraf','../../config/environment','./team.attributes','exports','define','teams','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x2d138c,_0x5e7bcf){var _0x490d68=function(_0x38963f){while(--_0x38963f){_0x2d138c['push'](_0x2d138c['shift']());}};_0x490d68(++_0x5e7bcf);}(_0xc7bf,0x18d));var _0xfc7b=function(_0x95ce6b,_0x207c1d){_0x95ce6b=_0x95ce6b-0x0;var _0xa00e15=_0xc7bf[_0x95ce6b];return _0xa00e15;};'use strict';var _=require(_0xfc7b('0x0'));var util=require(_0xfc7b('0x1'));var logger=require(_0xfc7b('0x2'))('api');var moment=require(_0xfc7b('0x3'));var BPromise=require(_0xfc7b('0x4'));var rp=require(_0xfc7b('0x5'));var fs=require('fs');var path=require(_0xfc7b('0x6'));var rimraf=require(_0xfc7b('0x7'));var config=require(_0xfc7b('0x8'));var attributes=require(_0xfc7b('0x9'));module[_0xfc7b('0xa')]=function(_0x9afbc3,_0x2aeec6){return _0x9afbc3[_0xfc7b('0xb')]('Team',attributes,{'tableName':_0xfc7b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x395a=['request-promise','path','rimraf','../../config/environment','./team.attributes','exports','define','teams','lodash','util','../../config/logger','moment','bluebird'];(function(_0x220f3f,_0x11c540){var _0x1f170e=function(_0x2c0ec9){while(--_0x2c0ec9){_0x220f3f['push'](_0x220f3f['shift']());}};_0x1f170e(++_0x11c540);}(_0x395a,0xf2));var _0xa395=function(_0x173f10,_0x35db61){_0x173f10=_0x173f10-0x0;var _0x53142d=_0x395a[_0x173f10];return _0x53142d;};'use strict';var _=require(_0xa395('0x0'));var util=require(_0xa395('0x1'));var logger=require(_0xa395('0x2'))('api');var moment=require(_0xa395('0x3'));var BPromise=require(_0xa395('0x4'));var rp=require(_0xa395('0x5'));var fs=require('fs');var path=require(_0xa395('0x6'));var rimraf=require(_0xa395('0x7'));var config=require(_0xa395('0x8'));var attributes=require(_0xa395('0x9'));module[_0xa395('0xa')]=function(_0x2c58fa,_0x39edfc){return _0x2c58fa[_0xa395('0xb')]('Team',attributes,{'tableName':_0xa395('0xc'),'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 0a5addf..6f94a8c 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 _0xe0a8=['socket.io-emitter','./team.socket','register','info','Team,\x20%s,\x20%s','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','defaults','redis','localhost'];(function(_0x4f4d2e,_0xcfd371){var _0x1cb575=function(_0x147137){while(--_0x147137){_0x4f4d2e['push'](_0x4f4d2e['shift']());}};_0x1cb575(++_0xcfd371);}(_0xe0a8,0x115));var _0x8e0a=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xe0a8[_0x59ee6f];return _0x4c0979;};'use strict';var _=require(_0x8e0a('0x0'));var util=require(_0x8e0a('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8e0a('0x2'));var db=require(_0x8e0a('0x3'))['db'];var utils=require(_0x8e0a('0x4'));var logger=require('../../config/logger')(_0x8e0a('0x5'));var config=require(_0x8e0a('0x6'));var jayson=require(_0x8e0a('0x7'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0x8e0a('0x8')](config[_0x8e0a('0x9')],{'host':_0x8e0a('0xa'),'port':0x18eb});var socket=require(_0x8e0a('0xb'))(new Redis(config[_0x8e0a('0x9')]));require(_0x8e0a('0xc'))[_0x8e0a('0xd')](socket);function respondWithRpcPromise(_0x4084a4,_0x5c6559,_0x4a4f78){return new BPromise(function(_0x52acb6,_0x491eb3){return client['request'](_0x4084a4,_0x4a4f78)['then'](function(_0x182f9b){logger[_0x8e0a('0xe')](_0x8e0a('0xf'),_0x5c6559,_0x8e0a('0x10'));logger[_0x8e0a('0x11')](_0x8e0a('0x12'),_0x5c6559,_0x8e0a('0x10'),JSON[_0x8e0a('0x13')](_0x182f9b));if(_0x182f9b[_0x8e0a('0x14')]){if(_0x182f9b[_0x8e0a('0x14')][_0x8e0a('0x15')]===0x1f4){logger[_0x8e0a('0x14')](_0x8e0a('0xf'),_0x5c6559,_0x182f9b['error']['message']);return _0x491eb3(_0x182f9b['error'][_0x8e0a('0x16')]);}logger[_0x8e0a('0x14')]('Team,\x20%s,\x20%s',_0x5c6559,_0x182f9b[_0x8e0a('0x14')]['message']);return _0x52acb6(_0x182f9b['error'][_0x8e0a('0x16')]);}else{logger[_0x8e0a('0xe')](_0x8e0a('0xf'),_0x5c6559,_0x8e0a('0x10'));_0x52acb6(_0x182f9b['result'][_0x8e0a('0x16')]);}})[_0x8e0a('0x17')](function(_0x495bb0){logger[_0x8e0a('0x14')](_0x8e0a('0xf'),_0x5c6559,_0x495bb0);_0x491eb3(_0x495bb0);});});} \ No newline at end of file +var _0x536b=['../../config/logger','../../config/environment','jayson/promise','http','defaults','localhost','socket.io-emitter','redis','./team.socket','register','request','info','Team,\x20%s,\x20%s','debug','Team,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch','util','bluebird','randomstring','../../config/utils'];(function(_0x3eb1b3,_0x4e5143){var _0x45fd50=function(_0x138137){while(--_0x138137){_0x3eb1b3['push'](_0x3eb1b3['shift']());}};_0x45fd50(++_0x4e5143);}(_0x536b,0x1f4));var _0xb536=function(_0x598e1a,_0x11f7df){_0x598e1a=_0x598e1a-0x0;var _0x483b89=_0x536b[_0x598e1a];return _0x483b89;};'use strict';var _=require('lodash');var util=require(_0xb536('0x0'));var moment=require('moment');var BPromise=require(_0xb536('0x1'));var rs=require(_0xb536('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xb536('0x3'));var logger=require(_0xb536('0x4'))('rpc');var config=require(_0xb536('0x5'));var jayson=require(_0xb536('0x6'));var client=jayson['client'][_0xb536('0x7')]({'port':0x232a});config['redis']=_[_0xb536('0x8')](config['redis'],{'host':_0xb536('0x9'),'port':0x18eb});var socket=require(_0xb536('0xa'))(new Redis(config[_0xb536('0xb')]));require(_0xb536('0xc'))[_0xb536('0xd')](socket);function respondWithRpcPromise(_0x39d197,_0x5cc913,_0x35356c){return new BPromise(function(_0x291898,_0x21645a){return client[_0xb536('0xe')](_0x39d197,_0x35356c)['then'](function(_0x350150){logger[_0xb536('0xf')](_0xb536('0x10'),_0x5cc913,'request\x20sent');logger[_0xb536('0x11')](_0xb536('0x12'),_0x5cc913,_0xb536('0x13'),JSON['stringify'](_0x350150));if(_0x350150[_0xb536('0x14')]){if(_0x350150[_0xb536('0x14')]['code']===0x1f4){logger[_0xb536('0x14')](_0xb536('0x10'),_0x5cc913,_0x350150['error'][_0xb536('0x15')]);return _0x21645a(_0x350150['error'][_0xb536('0x15')]);}logger[_0xb536('0x14')](_0xb536('0x10'),_0x5cc913,_0x350150[_0xb536('0x14')][_0xb536('0x15')]);return _0x291898(_0x350150[_0xb536('0x14')][_0xb536('0x15')]);}else{logger[_0xb536('0xf')](_0xb536('0x10'),_0x5cc913,_0xb536('0x13'));_0x291898(_0x350150[_0xb536('0x16')][_0xb536('0x15')]);}})[_0xb536('0x17')](function(_0x55bbdd){logger[_0xb536('0x14')]('Team,\x20%s,\x20%s',_0x5cc913,_0x55bbdd);_0x21645a(_0x55bbdd);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index a1db9a3..65eac48 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 _0x9703=['register','length','team:','remove','update','removeListener'];(function(_0x35658d,_0x532e45){var _0x5f90d1=function(_0x5aa639){while(--_0x5aa639){_0x35658d['push'](_0x35658d['shift']());}};_0x5f90d1(++_0x532e45);}(_0x9703,0xdb));var _0x3970=function(_0x4b5cde,_0x518a82){_0x4b5cde=_0x4b5cde-0x0;var _0x313c11=_0x9703[_0x4b5cde];return _0x313c11;};'use strict';var TeamEvents=require('./team.events');var events=['save',_0x3970('0x0'),_0x3970('0x1')];function createListener(_0x3ed006,_0x58168c){return function(_0x1fb9af){_0x58168c['emit'](_0x3ed006,_0x1fb9af);};}function removeListener(_0x2312a5,_0x5edd50){return function(){TeamEvents[_0x3970('0x2')](_0x2312a5,_0x5edd50);};}exports[_0x3970('0x3')]=function(_0x5cdfda){for(var _0x5669ec=0x0,_0x21986b=events[_0x3970('0x4')];_0x5669ec<_0x21986b;_0x5669ec++){var _0x282355=events[_0x5669ec];var _0x41d4d1=createListener(_0x3970('0x5')+_0x282355,_0x5cdfda);TeamEvents['on'](_0x282355,_0x41d4d1);}}; \ No newline at end of file +var _0x637b=['remove','emit','removeListener','register','length','team:','./team.events'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x637b,0x133));var _0xb637=function(_0x285106,_0xdbd697){_0x285106=_0x285106-0x0;var _0x418f99=_0x637b[_0x285106];return _0x418f99;};'use strict';var TeamEvents=require(_0xb637('0x0'));var events=['save',_0xb637('0x1'),'update'];function createListener(_0x5d99a7,_0x430ad5){return function(_0xc9417f){_0x430ad5[_0xb637('0x2')](_0x5d99a7,_0xc9417f);};}function removeListener(_0x4b9900,_0x4f1476){return function(){TeamEvents[_0xb637('0x3')](_0x4b9900,_0x4f1476);};}exports[_0xb637('0x4')]=function(_0x1bfc81){for(var _0x1c9289=0x0,_0x60d020=events[_0xb637('0x5')];_0x1c9289<_0x60d020;_0x1c9289++){var _0x54951e=events[_0x1c9289];var _0x42d082=createListener(_0xb637('0x6')+_0x54951e,_0x1bfc81);TeamEvents['on'](_0x54951e,_0x42d082);}}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/index.js b/server/api/teamVoiceQueue/index.js index ce3a176..9c9a450 100644 --- a/server/api/teamVoiceQueue/index.js +++ b/server/api/teamVoiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x1bdc21,_0xa1cd9b){var _0x29c48b=function(_0x2861dd){while(--_0x2861dd){_0x1bdc21['push'](_0x1bdc21['shift']());}};_0x29c48b(++_0xa1cd9b);}(_0x70e0,0x17b));var _0x070e=function(_0x532e82,_0xf7018f){_0x532e82=_0x532e82-0x0;var _0x4931b0=_0x70e0[_0x532e82];return _0x4931b0;};'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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x1a32fe,_0xdab6ac){var _0x1abca6=function(_0x280920){while(--_0x280920){_0x1a32fe['push'](_0x1a32fe['shift']());}};_0x1abca6(++_0xdab6ac);}(_0x9c44,0x178));var _0x49c4=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x9c44[_0x465a0c];return _0x1e202e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index 5429065..7a50dd8 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 _0x1e47=['exports','INTEGER'];(function(_0xcfd01b,_0x269ef7){var _0x3b0920=function(_0x54fbb3){while(--_0x54fbb3){_0xcfd01b['push'](_0xcfd01b['shift']());}};_0x3b0920(++_0x269ef7);}(_0x1e47,0x18e));var _0x71e4=function(_0x2f1d28,_0x457407){_0x2f1d28=_0x2f1d28-0x0;var _0x56e946=_0x1e47[_0x2f1d28];return _0x56e946;};'use strict';var Sequelize=require('sequelize');module[_0x71e4('0x0')]={'penalty':{'type':Sequelize[_0x71e4('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x4434=['INTEGER','exports'];(function(_0x3ca553,_0x2b1b8c){var _0x41ff72=function(_0x55d91a){while(--_0x55d91a){_0x3ca553['push'](_0x3ca553['shift']());}};_0x41ff72(++_0x2b1b8c);}(_0x4434,0x175));var _0x4443=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x4434[_0x19950b];return _0x3c6b41;};'use strict';var Sequelize=require('sequelize');module[_0x4443('0x0')]={'penalty':{'type':Sequelize[_0x4443('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 52abcf7..77c418a 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 _0x6611=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./teamVoiceQueue.attributes','exports','TeamVoiceQueue','team_has_voice_queues'];(function(_0x2a802e,_0x4ca0d7){var _0x5d964d=function(_0x449111){while(--_0x449111){_0x2a802e['push'](_0x2a802e['shift']());}};_0x5d964d(++_0x4ca0d7);}(_0x6611,0xdd));var _0x1661=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x6611[_0x501510];return _0x1e6ee5;};'use strict';var _=require('lodash');var util=require(_0x1661('0x0'));var logger=require(_0x1661('0x1'))(_0x1661('0x2'));var moment=require(_0x1661('0x3'));var BPromise=require(_0x1661('0x4'));var rp=require(_0x1661('0x5'));var fs=require('fs');var path=require(_0x1661('0x6'));var rimraf=require(_0x1661('0x7'));var config=require(_0x1661('0x8'));var attributes=require(_0x1661('0x9'));module[_0x1661('0xa')]=function(_0x1e5dab,_0x58781d){return _0x1e5dab['define'](_0x1661('0xb'),attributes,{'tableName':_0x1661('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7e16=['api','request-promise','rimraf','../../config/environment','exports','define','TeamVoiceQueue','lodash','util','../../config/logger'];(function(_0x32e8d3,_0x15e456){var _0x2aa726=function(_0x4cb05e){while(--_0x4cb05e){_0x32e8d3['push'](_0x32e8d3['shift']());}};_0x2aa726(++_0x15e456);}(_0x7e16,0x16f));var _0x67e1=function(_0x38b68c,_0x45b276){_0x38b68c=_0x38b68c-0x0;var _0x2b137c=_0x7e16[_0x38b68c];return _0x2b137c;};'use strict';var _=require(_0x67e1('0x0'));var util=require(_0x67e1('0x1'));var logger=require(_0x67e1('0x2'))(_0x67e1('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x67e1('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x67e1('0x5'));var config=require(_0x67e1('0x6'));var attributes=require('./teamVoiceQueue.attributes');module[_0x67e1('0x7')]=function(_0x3b5769,_0x2e0cb9){return _0x3b5769[_0x67e1('0x8')](_0x67e1('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 e95be9b..54e5d44 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 _0xffe1=['util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','then','info','TeamVoiceQueue,\x20%s,\x20%s','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash'];(function(_0x249d38,_0x356e5a){var _0x598098=function(_0x34b749){while(--_0x34b749){_0x249d38['push'](_0x249d38['shift']());}};_0x598098(++_0x356e5a);}(_0xffe1,0x175));var _0x1ffe=function(_0x1bd9d0,_0x4580a5){_0x1bd9d0=_0x1bd9d0-0x0;var _0x3f3439=_0xffe1[_0x1bd9d0];return _0x3f3439;};'use strict';var _=require(_0x1ffe('0x0'));var util=require(_0x1ffe('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x1ffe('0x2'));var fs=require('fs');var Redis=require(_0x1ffe('0x3'));var db=require(_0x1ffe('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x1ffe('0x5'))(_0x1ffe('0x6'));var config=require(_0x1ffe('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x1ffe('0x8')][_0x1ffe('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x6bc1ed,_0x26e370,_0xb34112){return new BPromise(function(_0x8eee2b,_0x4d2a28){return client['request'](_0x6bc1ed,_0xb34112)[_0x1ffe('0xa')](function(_0x13556e){logger[_0x1ffe('0xb')](_0x1ffe('0xc'),_0x26e370,'request\x20sent');logger[_0x1ffe('0xd')](_0x1ffe('0xe'),_0x26e370,_0x1ffe('0xf'),JSON[_0x1ffe('0x10')](_0x13556e));if(_0x13556e[_0x1ffe('0x11')]){if(_0x13556e[_0x1ffe('0x11')][_0x1ffe('0x12')]===0x1f4){logger[_0x1ffe('0x11')]('TeamVoiceQueue,\x20%s,\x20%s',_0x26e370,_0x13556e[_0x1ffe('0x11')][_0x1ffe('0x13')]);return _0x4d2a28(_0x13556e['error'][_0x1ffe('0x13')]);}logger[_0x1ffe('0x11')](_0x1ffe('0xc'),_0x26e370,_0x13556e[_0x1ffe('0x11')][_0x1ffe('0x13')]);return _0x8eee2b(_0x13556e['error'][_0x1ffe('0x13')]);}else{logger[_0x1ffe('0xb')](_0x1ffe('0xc'),_0x26e370,'request\x20sent');_0x8eee2b(_0x13556e[_0x1ffe('0x14')]['message']);}})[_0x1ffe('0x15')](function(_0x565922){logger[_0x1ffe('0x11')](_0x1ffe('0xc'),_0x26e370,_0x565922);_0x4d2a28(_0x565922);});});} \ No newline at end of file +var _0xbbdc=['code','TeamVoiceQueue,\x20%s,\x20%s','message','result','catch','lodash','util','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','stringify','error'];(function(_0x5b66aa,_0xfe6494){var _0x1198b3=function(_0x1ed76c){while(--_0x1ed76c){_0x5b66aa['push'](_0x5b66aa['shift']());}};_0x1198b3(++_0xfe6494);}(_0xbbdc,0x1eb));var _0xcbbd=function(_0x2351c4,_0x1dca54){_0x2351c4=_0x2351c4-0x0;var _0x1dd3f8=_0xbbdc[_0x2351c4];return _0x1dd3f8;};'use strict';var _=require(_0xcbbd('0x0'));var util=require(_0xcbbd('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xcbbd('0x2'))('rpc');var config=require(_0xcbbd('0x3'));var jayson=require(_0xcbbd('0x4'));var client=jayson[_0xcbbd('0x5')][_0xcbbd('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x16584f,_0x4e2de1,_0x45298f){return new BPromise(function(_0x4cb6c5,_0x513cbf){return client['request'](_0x16584f,_0x45298f)[_0xcbbd('0x7')](function(_0x5a2c40){logger[_0xcbbd('0x8')]('TeamVoiceQueue,\x20%s,\x20%s',_0x4e2de1,_0xcbbd('0x9'));logger[_0xcbbd('0xa')]('TeamVoiceQueue,\x20%s,\x20%s,\x20%s',_0x4e2de1,'request\x20sent',JSON[_0xcbbd('0xb')](_0x5a2c40));if(_0x5a2c40[_0xcbbd('0xc')]){if(_0x5a2c40[_0xcbbd('0xc')][_0xcbbd('0xd')]===0x1f4){logger[_0xcbbd('0xc')](_0xcbbd('0xe'),_0x4e2de1,_0x5a2c40[_0xcbbd('0xc')]['message']);return _0x513cbf(_0x5a2c40['error']['message']);}logger[_0xcbbd('0xc')]('TeamVoiceQueue,\x20%s,\x20%s',_0x4e2de1,_0x5a2c40['error'][_0xcbbd('0xf')]);return _0x4cb6c5(_0x5a2c40['error']['message']);}else{logger[_0xcbbd('0x8')](_0xcbbd('0xe'),_0x4e2de1,_0xcbbd('0x9'));_0x4cb6c5(_0x5a2c40[_0xcbbd('0x10')][_0xcbbd('0xf')]);}})[_0xcbbd('0x11')](function(_0xf181c){logger[_0xcbbd('0xc')]('TeamVoiceQueue,\x20%s,\x20%s',_0x4e2de1,_0xf181c);_0x513cbf(_0xf181c);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index 5eb7158..c192c70 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 _0x3c85=['multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','./template.controller','get','isAuthenticated','show','create','put','delete','destroy','exports'];(function(_0x10b317,_0x2adf32){var _0x1e3054=function(_0x38ed3e){while(--_0x38ed3e){_0x10b317['push'](_0x10b317['shift']());}};_0x1e3054(++_0x2adf32);}(_0x3c85,0x1a0));var _0x53c8=function(_0x1e8055,_0x53e878){_0x1e8055=_0x1e8055-0x0;var _0x2d4045=_0x3c85[_0x1e8055];return _0x2d4045;};'use strict';var multer=require(_0x53c8('0x0'));var util=require(_0x53c8('0x1'));var path=require(_0x53c8('0x2'));var timeout=require(_0x53c8('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x53c8('0x4'));var auth=require(_0x53c8('0x5'));var interaction=require(_0x53c8('0x6'));var config=require('../../config/environment');var controller=require(_0x53c8('0x7'));router[_0x53c8('0x8')]('/',auth[_0x53c8('0x9')](),controller['index']);router['get']('/:id',auth['isAuthenticated'](),controller[_0x53c8('0xa')]);router['post']('/',auth['isAuthenticated'](),controller[_0x53c8('0xb')]);router[_0x53c8('0xc')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x53c8('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x53c8('0xe')]);module[_0x53c8('0xf')]=router; \ No newline at end of file +var _0xb1ad=['isAuthenticated','index','/:id','show','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./template.controller','get'];(function(_0x55d58f,_0x2bea83){var _0x1ad6e6=function(_0x31447e){while(--_0x31447e){_0x55d58f['push'](_0x55d58f['shift']());}};_0x1ad6e6(++_0x2bea83);}(_0xb1ad,0x184));var _0xdb1a=function(_0x75f869,_0x3690d6){_0x75f869=_0x75f869-0x0;var _0x10af8b=_0xb1ad[_0x75f869];return _0x10af8b;};'use strict';var multer=require(_0xdb1a('0x0'));var util=require(_0xdb1a('0x1'));var path=require(_0xdb1a('0x2'));var timeout=require(_0xdb1a('0x3'));var express=require(_0xdb1a('0x4'));var router=express[_0xdb1a('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xdb1a('0x6'));var interaction=require(_0xdb1a('0x7'));var config=require(_0xdb1a('0x8'));var controller=require(_0xdb1a('0x9'));router[_0xdb1a('0xa')]('/',auth[_0xdb1a('0xb')](),controller[_0xdb1a('0xc')]);router[_0xdb1a('0xa')](_0xdb1a('0xd'),auth[_0xdb1a('0xb')](),controller[_0xdb1a('0xe')]);router[_0xdb1a('0xf')]('/',auth[_0xdb1a('0xb')](),controller[_0xdb1a('0x10')]);router[_0xdb1a('0x11')]('/:id',auth[_0xdb1a('0xb')](),controller[_0xdb1a('0x12')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xdb1a('0x13')]);module[_0xdb1a('0x14')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index 50e12a7..e707e21 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 _0x2187=['exports','sequelize'];(function(_0x5d4140,_0x40ed39){var _0x1c3e56=function(_0x3d227b){while(--_0x3d227b){_0x5d4140['push'](_0x5d4140['shift']());}};_0x1c3e56(++_0x40ed39);}(_0x2187,0xc5));var _0x7218=function(_0x5e3ef3,_0x5c73e2){_0x5e3ef3=_0x5e3ef3-0x0;var _0x4c276b=_0x2187[_0x5e3ef3];return _0x4c276b;};'use strict';var Sequelize=require(_0x7218('0x0'));module[_0x7218('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'html':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x424e=['exports','STRING','sequelize'];(function(_0x20c829,_0x10eb0e){var _0x92460e=function(_0x3e6e53){while(--_0x3e6e53){_0x20c829['push'](_0x20c829['shift']());}};_0x92460e(++_0x10eb0e);}(_0x424e,0xef));var _0xe424=function(_0x2b9b7f,_0x4d47df){_0x2b9b7f=_0x2b9b7f-0x0;var _0x4ed19a=_0x424e[_0x2b9b7f];return _0x4ed19a;};'use strict';var Sequelize=require(_0xe424('0x0'));module[_0xe424('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xe424('0x2')]},'html':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index 46530ce..fccd550 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 _0x0215=['index','map','Template','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','merge','where','VIRTUAL','filter','includeAll','findAll','rows','show','include','options','find','catch','create','body','user','role','Templates','UserProfileSection','params','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','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','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','get','UserProfileResource','destroy','stack','name','send'];(function(_0x41e310,_0x572032){var _0x348b3e=function(_0x1f08eb){while(--_0x1f08eb){_0x41e310['push'](_0x41e310['shift']());}};_0x348b3e(++_0x572032);}(_0x0215,0x15e));var _0x5021=function(_0x1ba43c,_0x5bd2e8){_0x1ba43c=_0x1ba43c-0x0;var _0x2f60eb=_0x0215[_0x1ba43c];return _0x2f60eb;};'use strict';var emlformat=require(_0x5021('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5021('0x1'));var jsonpatch=require(_0x5021('0x2'));var rp=require(_0x5021('0x3'));var moment=require(_0x5021('0x4'));var BPromise=require(_0x5021('0x5'));var Mustache=require('mustache');var util=require(_0x5021('0x6'));var path=require(_0x5021('0x7'));var sox=require(_0x5021('0x8'));var csv=require(_0x5021('0x9'));var ejs=require(_0x5021('0xa'));var fs=require('fs');var fs_extra=require(_0x5021('0xb'));var _=require(_0x5021('0xc'));var squel=require(_0x5021('0xd'));var crypto=require(_0x5021('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x5021('0xf'));var toCsv=require(_0x5021('0x9'));var querystring=require(_0x5021('0x10'));var Papa=require('papaparse');var Redis=require(_0x5021('0x11'));var authService=require(_0x5021('0x12'));var qs=require(_0x5021('0x13'));var as=require(_0x5021('0x14'));var hardwareService=require(_0x5021('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0x5021('0x16'));var config=require(_0x5021('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x5021('0x18'))['db'];function respondWithStatusCode(_0x584c73,_0x4dd8b3){_0x4dd8b3=_0x4dd8b3||0xcc;return function(_0x26c886){if(_0x26c886){return _0x584c73['sendStatus'](_0x4dd8b3);}return _0x584c73[_0x5021('0x19')](_0x4dd8b3)[_0x5021('0x1a')]();};}function respondWithResult(_0x3943a4,_0xa54ec4){_0xa54ec4=_0xa54ec4||0xc8;return function(_0x2749f1){if(_0x2749f1){return _0x3943a4[_0x5021('0x19')](_0xa54ec4)[_0x5021('0x1b')](_0x2749f1);}};}function respondWithFilteredResult(_0x3c1946,_0x5dfc6e){return function(_0x50b324){if(_0x50b324){var _0x1f2e15=typeof _0x5dfc6e[_0x5021('0x1c')]==='undefined'&&typeof _0x5dfc6e[_0x5021('0x1d')]===_0x5021('0x1e');var _0x5f14de=_0x50b324[_0x5021('0x1f')];var _0x5a4a0d=_0x1f2e15?0x0:_0x5dfc6e[_0x5021('0x1c')];var _0x23fb18=_0x1f2e15?_0x50b324[_0x5021('0x1f')]:_0x5dfc6e[_0x5021('0x1c')]+_0x5dfc6e[_0x5021('0x1d')];var _0xb28116;if(_0x23fb18>=_0x5f14de){_0x23fb18=_0x5f14de;_0xb28116=0xc8;}else{_0xb28116=0xce;}_0x3c1946['status'](_0xb28116);return _0x3c1946[_0x5021('0x20')](_0x5021('0x21'),_0x5a4a0d+'-'+_0x23fb18+'/'+_0x5f14de)[_0x5021('0x1b')](_0x50b324);}return null;};}function patchUpdates(_0x157c48){return function(_0x46bf18){try{jsonpatch[_0x5021('0x22')](_0x46bf18,_0x157c48,!![]);}catch(_0x21ae17){return BPromise[_0x5021('0x23')](_0x21ae17);}return _0x46bf18[_0x5021('0x24')]();};}function saveUpdates(_0x3db202,_0x570055){return function(_0x5f46ad){if(_0x5f46ad){return _0x5f46ad[_0x5021('0x25')](_0x3db202)[_0x5021('0x26')](function(_0x52c9b1){return _0x52c9b1;});}return null;};}function removeEntity(_0x234e88,_0x5f324b){return function(_0x155d02){if(_0x155d02){return _0x155d02['destroy']()[_0x5021('0x26')](function(){var _0x189b98=_0x155d02[_0x5021('0x27')]({'plain':!![]});var _0x21c3db='Templates';return db[_0x5021('0x28')][_0x5021('0x29')]({'where':{'type':_0x21c3db,'resourceId':_0x189b98['id']}})[_0x5021('0x26')](function(){return _0x155d02;});})[_0x5021('0x26')](function(){_0x234e88['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x98cfeb,_0x369ef7){return function(_0x4b6320){if(!_0x4b6320){_0x98cfeb['sendStatus'](0x194);}return _0x4b6320;};}function handleError(_0x6bf59a,_0x2c1662){_0x2c1662=_0x2c1662||0x1f4;return function(_0x48f01d){logger['error'](_0x48f01d[_0x5021('0x2a')]);if(_0x48f01d['name']){delete _0x48f01d[_0x5021('0x2b')];}_0x6bf59a[_0x5021('0x19')](_0x2c1662)[_0x5021('0x2c')](_0x48f01d);};}exports[_0x5021('0x2d')]=function(_0xe1b8a2,_0x3eebe3){var _0xc6d779={},_0x5a58f0={},_0x5b7dee={'count':0x0,'rows':[]};var _0x4de392=_[_0x5021('0x2e')](db[_0x5021('0x2f')][_0x5021('0x30')],function(_0x546c78){return{'name':_0x546c78[_0x5021('0x31')],'type':_0x546c78[_0x5021('0x32')][_0x5021('0x33')]};});_0x5a58f0['model']=_[_0x5021('0x2e')](_0x4de392,'name');_0x5a58f0[_0x5021('0x34')]=_[_0x5021('0x35')](_0xe1b8a2['query']);_0x5a58f0[_0x5021('0x36')]=_[_0x5021('0x37')](_0x5a58f0['model'],_0x5a58f0[_0x5021('0x34')]);_0xc6d779['attributes']=_[_0x5021('0x37')](_0x5a58f0[_0x5021('0x38')],qs[_0x5021('0x39')](_0xe1b8a2[_0x5021('0x34')]['fields']));_0xc6d779[_0x5021('0x3a')]=_0xc6d779['attributes'][_0x5021('0x3b')]?_0xc6d779[_0x5021('0x3a')]:_0x5a58f0[_0x5021('0x38')];if(!_0xe1b8a2[_0x5021('0x34')]['hasOwnProperty']('nolimit')){_0xc6d779['limit']=qs[_0x5021('0x1d')](_0xe1b8a2['query'][_0x5021('0x1d')]);_0xc6d779['offset']=qs['offset'](_0xe1b8a2[_0x5021('0x34')]['offset']);}_0xc6d779['order']=qs['sort'](_0xe1b8a2[_0x5021('0x34')]['sort']);_0xc6d779['where']=qs[_0x5021('0x36')](_['pick'](_0xe1b8a2[_0x5021('0x34')],_0x5a58f0[_0x5021('0x36')]),_0x4de392);if(_0xe1b8a2['query']['filter']){_0xc6d779['where']=_[_0x5021('0x3c')](_0xc6d779[_0x5021('0x3d')],{'$or':_[_0x5021('0x2e')](_0x4de392,function(_0x4b3f07){if(_0x4b3f07['type']!==_0x5021('0x3e')){var _0x4d9615={};_0x4d9615[_0x4b3f07[_0x5021('0x2b')]]={'$like':'%'+_0xe1b8a2[_0x5021('0x34')][_0x5021('0x3f')]+'%'};return _0x4d9615;}})});}_0xc6d779=_[_0x5021('0x3c')]({},_0xc6d779,_0xe1b8a2['options']);var _0x18ea89={'where':_0xc6d779[_0x5021('0x3d')]};return db[_0x5021('0x2f')][_0x5021('0x1f')](_0x18ea89)[_0x5021('0x26')](function(_0x12c4f9){_0x5b7dee[_0x5021('0x1f')]=_0x12c4f9;if(_0xe1b8a2[_0x5021('0x34')][_0x5021('0x40')]){_0xc6d779['include']=[{'all':!![]}];}return db[_0x5021('0x2f')][_0x5021('0x41')](_0xc6d779);})[_0x5021('0x26')](function(_0x50b1ff){_0x5b7dee[_0x5021('0x42')]=_0x50b1ff;return _0x5b7dee;})[_0x5021('0x26')](respondWithFilteredResult(_0x3eebe3,_0xc6d779))['catch'](handleError(_0x3eebe3,null));};exports[_0x5021('0x43')]=function(_0x37d86d,_0x453adf){var _0x1bc296={'raw':!![],'where':{'id':_0x37d86d['params']['id']}},_0x3e8339={};_0x3e8339[_0x5021('0x38')]=_[_0x5021('0x35')](db[_0x5021('0x2f')][_0x5021('0x30')]);_0x3e8339['query']=_[_0x5021('0x35')](_0x37d86d['query']);_0x3e8339['filters']=_[_0x5021('0x37')](_0x3e8339['model'],_0x3e8339['query']);_0x1bc296[_0x5021('0x3a')]=_['intersection'](_0x3e8339[_0x5021('0x38')],qs[_0x5021('0x39')](_0x37d86d[_0x5021('0x34')][_0x5021('0x39')]));_0x1bc296['attributes']=_0x1bc296['attributes'][_0x5021('0x3b')]?_0x1bc296[_0x5021('0x3a')]:_0x3e8339['model'];if(_0x37d86d[_0x5021('0x34')][_0x5021('0x40')]){_0x1bc296[_0x5021('0x44')]=[{'all':!![]}];}_0x1bc296=_[_0x5021('0x3c')]({},_0x1bc296,_0x37d86d[_0x5021('0x45')]);return db[_0x5021('0x2f')][_0x5021('0x46')](_0x1bc296)[_0x5021('0x26')](handleEntityNotFound(_0x453adf,null))[_0x5021('0x26')](respondWithResult(_0x453adf,null))[_0x5021('0x47')](handleError(_0x453adf,null));};exports[_0x5021('0x48')]=function(_0x1b523c,_0x489cf1){return db[_0x5021('0x2f')]['create'](_0x1b523c[_0x5021('0x49')],{})[_0x5021('0x26')](function(_0x798f1d){var _0x20f4f2=_0x1b523c[_0x5021('0x4a')][_0x5021('0x27')]({'plain':!![]});if(!_0x20f4f2)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x20f4f2[_0x5021('0x4b')]===_0x5021('0x4a')){var _0x448b=_0x798f1d[_0x5021('0x27')]({'plain':!![]});var _0x303acf=_0x5021('0x4c');return db[_0x5021('0x4d')]['find']({'where':{'name':_0x303acf,'userProfileId':_0x20f4f2['userProfileId']},'raw':!![]})[_0x5021('0x26')](function(_0x155d5d){if(_0x155d5d&&_0x155d5d['autoAssociation']===0x0){return db[_0x5021('0x28')]['create']({'name':_0x448b[_0x5021('0x2b')],'resourceId':_0x448b['id'],'type':_0x155d5d[_0x5021('0x2b')],'sectionId':_0x155d5d['id']},{})['then'](function(){return _0x798f1d;});}else{return _0x798f1d;}})[_0x5021('0x47')](function(_0x287361){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x287361);throw _0x287361;});}return _0x798f1d;})[_0x5021('0x26')](respondWithResult(_0x489cf1,0xc9))[_0x5021('0x47')](handleError(_0x489cf1,null));};exports['update']=function(_0x16ab2b,_0x910a8){if(_0x16ab2b['body']['id']){delete _0x16ab2b[_0x5021('0x49')]['id'];}return db[_0x5021('0x2f')][_0x5021('0x46')]({'where':{'id':_0x16ab2b[_0x5021('0x4e')]['id']}})[_0x5021('0x26')](handleEntityNotFound(_0x910a8,null))[_0x5021('0x26')](saveUpdates(_0x16ab2b[_0x5021('0x49')],null))[_0x5021('0x26')](respondWithResult(_0x910a8,null))[_0x5021('0x47')](handleError(_0x910a8,null));};exports[_0x5021('0x29')]=function(_0x446d57,_0x5a9b7c){return db[_0x5021('0x2f')][_0x5021('0x46')]({'where':{'id':_0x446d57[_0x5021('0x4e')]['id']}})[_0x5021('0x26')](handleEntityNotFound(_0x5a9b7c,null))[_0x5021('0x26')](removeEntity(_0x5a9b7c,null))[_0x5021('0x47')](handleError(_0x5a9b7c,null));}; \ No newline at end of file +var _0x35dc=['findAll','rows','catch','show','params','keys','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','get','Templates','then','end','stack','name','send','index','map','Template','rawAttributes','fieldName','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','type','VIRTUAL','merge','options','includeAll','include'];(function(_0x336f33,_0x43cc91){var _0x3ea123=function(_0x19b81c){while(--_0x19b81c){_0x336f33['push'](_0x336f33['shift']());}};_0x3ea123(++_0x43cc91);}(_0x35dc,0x67));var _0xc35d=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x35dc[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0xc35d('0x0'));var rimraf=require(_0xc35d('0x1'));var zipdir=require(_0xc35d('0x2'));var jsonpatch=require(_0xc35d('0x3'));var rp=require(_0xc35d('0x4'));var moment=require(_0xc35d('0x5'));var BPromise=require(_0xc35d('0x6'));var Mustache=require('mustache');var util=require(_0xc35d('0x7'));var path=require(_0xc35d('0x8'));var sox=require(_0xc35d('0x9'));var csv=require(_0xc35d('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc35d('0xb'));var _=require(_0xc35d('0xc'));var squel=require(_0xc35d('0xd'));var crypto=require(_0xc35d('0xe'));var jsforce=require(_0xc35d('0xf'));var deskjs=require(_0xc35d('0x10'));var toCsv=require(_0xc35d('0xa'));var querystring=require(_0xc35d('0x11'));var Papa=require(_0xc35d('0x12'));var Redis=require(_0xc35d('0x13'));var authService=require(_0xc35d('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xc35d('0x15'));var hardwareService=require(_0xc35d('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0xc35d('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xc35d('0x18'))['db'];function respondWithStatusCode(_0x40879a,_0x8789ca){_0x8789ca=_0x8789ca||0xcc;return function(_0x460ae4){if(_0x460ae4){return _0x40879a[_0xc35d('0x19')](_0x8789ca);}return _0x40879a[_0xc35d('0x1a')](_0x8789ca)['end']();};}function respondWithResult(_0x5eba0d,_0x356af4){_0x356af4=_0x356af4||0xc8;return function(_0x52cc25){if(_0x52cc25){return _0x5eba0d[_0xc35d('0x1a')](_0x356af4)[_0xc35d('0x1b')](_0x52cc25);}};}function respondWithFilteredResult(_0x277f0f,_0x3cfe93){return function(_0x374dbf){if(_0x374dbf){var _0x37373b=typeof _0x3cfe93[_0xc35d('0x1c')]===_0xc35d('0x1d')&&typeof _0x3cfe93[_0xc35d('0x1e')]===_0xc35d('0x1d');var _0xc22ce1=_0x374dbf[_0xc35d('0x1f')];var _0xcdcfea=_0x37373b?0x0:_0x3cfe93[_0xc35d('0x1c')];var _0x1dac7b=_0x37373b?_0x374dbf[_0xc35d('0x1f')]:_0x3cfe93[_0xc35d('0x1c')]+_0x3cfe93[_0xc35d('0x1e')];var _0x5425a1;if(_0x1dac7b>=_0xc22ce1){_0x1dac7b=_0xc22ce1;_0x5425a1=0xc8;}else{_0x5425a1=0xce;}_0x277f0f[_0xc35d('0x1a')](_0x5425a1);return _0x277f0f[_0xc35d('0x20')](_0xc35d('0x21'),_0xcdcfea+'-'+_0x1dac7b+'/'+_0xc22ce1)[_0xc35d('0x1b')](_0x374dbf);}return null;};}function patchUpdates(_0xeda580){return function(_0x35ab95){try{jsonpatch['apply'](_0x35ab95,_0xeda580,!![]);}catch(_0x32c190){return BPromise[_0xc35d('0x22')](_0x32c190);}return _0x35ab95[_0xc35d('0x23')]();};}function saveUpdates(_0x52785e,_0x3ed992){return function(_0x55c2bd){if(_0x55c2bd){return _0x55c2bd[_0xc35d('0x24')](_0x52785e)['then'](function(_0x28cfc8){return _0x28cfc8;});}return null;};}function removeEntity(_0x258148,_0x498ed7){return function(_0x2724b1){if(_0x2724b1){return _0x2724b1[_0xc35d('0x25')]()['then'](function(){var _0x36c4e6=_0x2724b1[_0xc35d('0x26')]({'plain':!![]});var _0x5ee6a4=_0xc35d('0x27');return db['UserProfileResource'][_0xc35d('0x25')]({'where':{'type':_0x5ee6a4,'resourceId':_0x36c4e6['id']}})[_0xc35d('0x28')](function(){return _0x2724b1;});})['then'](function(){_0x258148[_0xc35d('0x1a')](0xcc)[_0xc35d('0x29')]();});}};}function handleEntityNotFound(_0x2ff622,_0x1d334f){return function(_0xff69f5){if(!_0xff69f5){_0x2ff622[_0xc35d('0x19')](0x194);}return _0xff69f5;};}function handleError(_0x6196af,_0xea96fb){_0xea96fb=_0xea96fb||0x1f4;return function(_0x5243a9){logger['error'](_0x5243a9[_0xc35d('0x2a')]);if(_0x5243a9[_0xc35d('0x2b')]){delete _0x5243a9['name'];}_0x6196af[_0xc35d('0x1a')](_0xea96fb)[_0xc35d('0x2c')](_0x5243a9);};}exports[_0xc35d('0x2d')]=function(_0x26d397,_0x3cc4c3){var _0x389c81={},_0x4ed579={},_0x44ca62={'count':0x0,'rows':[]};var _0x59213e=_[_0xc35d('0x2e')](db[_0xc35d('0x2f')][_0xc35d('0x30')],function(_0xc232d2){return{'name':_0xc232d2[_0xc35d('0x31')],'type':_0xc232d2['type'][_0xc35d('0x32')]};});_0x4ed579[_0xc35d('0x33')]=_['map'](_0x59213e,_0xc35d('0x2b'));_0x4ed579['query']=_['keys'](_0x26d397[_0xc35d('0x34')]);_0x4ed579[_0xc35d('0x35')]=_[_0xc35d('0x36')](_0x4ed579['model'],_0x4ed579['query']);_0x389c81['attributes']=_['intersection'](_0x4ed579['model'],qs[_0xc35d('0x37')](_0x26d397[_0xc35d('0x34')][_0xc35d('0x37')]));_0x389c81[_0xc35d('0x38')]=_0x389c81[_0xc35d('0x38')][_0xc35d('0x39')]?_0x389c81['attributes']:_0x4ed579['model'];if(!_0x26d397[_0xc35d('0x34')][_0xc35d('0x3a')]('nolimit')){_0x389c81[_0xc35d('0x1e')]=qs[_0xc35d('0x1e')](_0x26d397[_0xc35d('0x34')][_0xc35d('0x1e')]);_0x389c81[_0xc35d('0x1c')]=qs['offset'](_0x26d397[_0xc35d('0x34')]['offset']);}_0x389c81[_0xc35d('0x3b')]=qs[_0xc35d('0x3c')](_0x26d397[_0xc35d('0x34')][_0xc35d('0x3c')]);_0x389c81[_0xc35d('0x3d')]=qs[_0xc35d('0x35')](_[_0xc35d('0x3e')](_0x26d397[_0xc35d('0x34')],_0x4ed579[_0xc35d('0x35')]),_0x59213e);if(_0x26d397[_0xc35d('0x34')]['filter']){_0x389c81['where']=_['merge'](_0x389c81['where'],{'$or':_[_0xc35d('0x2e')](_0x59213e,function(_0x1551fd){if(_0x1551fd[_0xc35d('0x3f')]!==_0xc35d('0x40')){var _0x387068={};_0x387068[_0x1551fd['name']]={'$like':'%'+_0x26d397['query']['filter']+'%'};return _0x387068;}})});}_0x389c81=_[_0xc35d('0x41')]({},_0x389c81,_0x26d397[_0xc35d('0x42')]);var _0x56477e={'where':_0x389c81[_0xc35d('0x3d')]};return db['Template'][_0xc35d('0x1f')](_0x56477e)[_0xc35d('0x28')](function(_0x1196f1){_0x44ca62[_0xc35d('0x1f')]=_0x1196f1;if(_0x26d397['query'][_0xc35d('0x43')]){_0x389c81[_0xc35d('0x44')]=[{'all':!![]}];}return db[_0xc35d('0x2f')][_0xc35d('0x45')](_0x389c81);})[_0xc35d('0x28')](function(_0x380f1){_0x44ca62[_0xc35d('0x46')]=_0x380f1;return _0x44ca62;})[_0xc35d('0x28')](respondWithFilteredResult(_0x3cc4c3,_0x389c81))[_0xc35d('0x47')](handleError(_0x3cc4c3,null));};exports[_0xc35d('0x48')]=function(_0xdf73bb,_0x4c52a4){var _0x4fd27a={'raw':!![],'where':{'id':_0xdf73bb[_0xc35d('0x49')]['id']}},_0x389992={};_0x389992[_0xc35d('0x33')]=_[_0xc35d('0x4a')](db['Template'][_0xc35d('0x30')]);_0x389992['query']=_[_0xc35d('0x4a')](_0xdf73bb['query']);_0x389992[_0xc35d('0x35')]=_[_0xc35d('0x36')](_0x389992['model'],_0x389992[_0xc35d('0x34')]);_0x4fd27a['attributes']=_['intersection'](_0x389992[_0xc35d('0x33')],qs[_0xc35d('0x37')](_0xdf73bb[_0xc35d('0x34')]['fields']));_0x4fd27a[_0xc35d('0x38')]=_0x4fd27a[_0xc35d('0x38')][_0xc35d('0x39')]?_0x4fd27a[_0xc35d('0x38')]:_0x389992[_0xc35d('0x33')];if(_0xdf73bb[_0xc35d('0x34')][_0xc35d('0x43')]){_0x4fd27a['include']=[{'all':!![]}];}_0x4fd27a=_[_0xc35d('0x41')]({},_0x4fd27a,_0xdf73bb[_0xc35d('0x42')]);return db['Template'][_0xc35d('0x4b')](_0x4fd27a)[_0xc35d('0x28')](handleEntityNotFound(_0x4c52a4,null))['then'](respondWithResult(_0x4c52a4,null))['catch'](handleError(_0x4c52a4,null));};exports[_0xc35d('0x4c')]=function(_0x131f9f,_0x1c394b){return db[_0xc35d('0x2f')][_0xc35d('0x4c')](_0x131f9f['body'],{})[_0xc35d('0x28')](function(_0x440350){var _0x42c350=_0x131f9f[_0xc35d('0x4d')]['get']({'plain':!![]});if(!_0x42c350)throw new Error(_0xc35d('0x4e'));if(_0x42c350[_0xc35d('0x4f')]===_0xc35d('0x4d')){var _0x3e2b30=_0x440350[_0xc35d('0x26')]({'plain':!![]});var _0x5303fa='Templates';return db[_0xc35d('0x50')][_0xc35d('0x4b')]({'where':{'name':_0x5303fa,'userProfileId':_0x42c350[_0xc35d('0x51')]},'raw':!![]})[_0xc35d('0x28')](function(_0x18867f){if(_0x18867f&&_0x18867f[_0xc35d('0x52')]===0x0){return db['UserProfileResource'][_0xc35d('0x4c')]({'name':_0x3e2b30[_0xc35d('0x2b')],'resourceId':_0x3e2b30['id'],'type':_0x18867f[_0xc35d('0x2b')],'sectionId':_0x18867f['id']},{})[_0xc35d('0x28')](function(){return _0x440350;});}else{return _0x440350;}})['catch'](function(_0x579d8f){logger[_0xc35d('0x53')](_0xc35d('0x54'),_0x579d8f);throw _0x579d8f;});}return _0x440350;})[_0xc35d('0x28')](respondWithResult(_0x1c394b,0xc9))[_0xc35d('0x47')](handleError(_0x1c394b,null));};exports[_0xc35d('0x24')]=function(_0x3b096f,_0x1d77e5){if(_0x3b096f[_0xc35d('0x55')]['id']){delete _0x3b096f[_0xc35d('0x55')]['id'];}return db[_0xc35d('0x2f')][_0xc35d('0x4b')]({'where':{'id':_0x3b096f[_0xc35d('0x49')]['id']}})[_0xc35d('0x28')](handleEntityNotFound(_0x1d77e5,null))[_0xc35d('0x28')](saveUpdates(_0x3b096f[_0xc35d('0x55')],null))[_0xc35d('0x28')](respondWithResult(_0x1d77e5,null))[_0xc35d('0x47')](handleError(_0x1d77e5,null));};exports['destroy']=function(_0x5abe7c,_0x3214a5){return db[_0xc35d('0x2f')][_0xc35d('0x4b')]({'where':{'id':_0x5abe7c[_0xc35d('0x49')]['id']}})[_0xc35d('0x28')](handleEntityNotFound(_0x3214a5,null))[_0xc35d('0x28')](removeEntity(_0x3214a5,null))[_0xc35d('0x47')](handleError(_0x3214a5,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index 9d5c1c5..b23d050 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 _0xba54=['path','./template.attributes','tools_templates','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x9b3efc,_0x577a0d){var _0x200f05=function(_0x15ad7c){while(--_0x15ad7c){_0x9b3efc['push'](_0x9b3efc['shift']());}};_0x200f05(++_0x577a0d);}(_0xba54,0x108));var _0x4ba5=function(_0x2277a0,_0xf18088){_0x2277a0=_0x2277a0-0x0;var _0x1d4962=_0xba54[_0x2277a0];return _0x1d4962;};'use strict';var _=require('lodash');var util=require(_0x4ba5('0x0'));var logger=require(_0x4ba5('0x1'))(_0x4ba5('0x2'));var moment=require(_0x4ba5('0x3'));var BPromise=require(_0x4ba5('0x4'));var rp=require(_0x4ba5('0x5'));var fs=require('fs');var path=require(_0x4ba5('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x4ba5('0x7'));module['exports']=function(_0x4b07a3,_0x5069b6){return _0x4b07a3['define']('Template',attributes,{'tableName':_0x4ba5('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbe41=['util','../../config/logger','api','moment','request-promise','rimraf','define','Template','tools_templates'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xbe41,0x195));var _0x1be4=function(_0x3a3361,_0x4b055b){_0x3a3361=_0x3a3361-0x0;var _0x5922fc=_0xbe41[_0x3a3361];return _0x5922fc;};'use strict';var _=require('lodash');var util=require(_0x1be4('0x0'));var logger=require(_0x1be4('0x1'))(_0x1be4('0x2'));var moment=require(_0x1be4('0x3'));var BPromise=require('bluebird');var rp=require(_0x1be4('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1be4('0x5'));var config=require('../../config/environment');var attributes=require('./template.attributes');module['exports']=function(_0x508f47,_0x5f5a50){return _0x508f47[_0x1be4('0x6')](_0x1be4('0x7'),attributes,{'tableName':_0x1be4('0x8'),'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 2944f5a..bf4193d 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 _0x5c27=['attributes','include','map','model','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','stringify','error','code','Template,\x20%s,\x20%s','message','result','GetTemplate','Template','findAll','options','raw','where'];(function(_0x3f3bad,_0x193f06){var _0x4f0801=function(_0x5cfd32){while(--_0x5cfd32){_0x3f3bad['push'](_0x3f3bad['shift']());}};_0x4f0801(++_0x193f06);}(_0x5c27,0x91));var _0x75c2=function(_0x56e2a8,_0x2cf877){_0x56e2a8=_0x56e2a8-0x0;var _0x232412=_0x5c27[_0x56e2a8];return _0x232412;};'use strict';var _=require(_0x75c2('0x0'));var util=require('util');var moment=require(_0x75c2('0x1'));var BPromise=require(_0x75c2('0x2'));var rs=require(_0x75c2('0x3'));var fs=require('fs');var Redis=require(_0x75c2('0x4'));var db=require(_0x75c2('0x5'))['db'];var utils=require(_0x75c2('0x6'));var logger=require(_0x75c2('0x7'))('rpc');var config=require(_0x75c2('0x8'));var jayson=require(_0x75c2('0x9'));var client=jayson[_0x75c2('0xa')][_0x75c2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x38b312,_0x388fab,_0x56fc79){return new BPromise(function(_0x42c7b2,_0x567b49){return client[_0x75c2('0xc')](_0x38b312,_0x56fc79)[_0x75c2('0xd')](function(_0x4e2d24){logger[_0x75c2('0xe')]('Template,\x20%s,\x20%s',_0x388fab,_0x75c2('0xf'));logger[_0x75c2('0x10')](_0x75c2('0x11'),_0x388fab,_0x75c2('0xf'),JSON[_0x75c2('0x12')](_0x4e2d24));if(_0x4e2d24['error']){if(_0x4e2d24[_0x75c2('0x13')][_0x75c2('0x14')]===0x1f4){logger[_0x75c2('0x13')](_0x75c2('0x15'),_0x388fab,_0x4e2d24[_0x75c2('0x13')][_0x75c2('0x16')]);return _0x567b49(_0x4e2d24['error'][_0x75c2('0x16')]);}logger[_0x75c2('0x13')](_0x75c2('0x15'),_0x388fab,_0x4e2d24[_0x75c2('0x13')][_0x75c2('0x16')]);return _0x42c7b2(_0x4e2d24[_0x75c2('0x13')][_0x75c2('0x16')]);}else{logger[_0x75c2('0xe')](_0x75c2('0x15'),_0x388fab,_0x75c2('0xf'));_0x42c7b2(_0x4e2d24[_0x75c2('0x17')][_0x75c2('0x16')]);}})['catch'](function(_0x2a97fc){logger[_0x75c2('0x13')](_0x75c2('0x15'),_0x388fab,_0x2a97fc);_0x567b49(_0x2a97fc);});});}exports[_0x75c2('0x18')]=function(_0x38eac1){var _0x5c5b3d=this;return new Promise(function(_0x493d7d,_0x3ebe6d){return db[_0x75c2('0x19')][_0x75c2('0x1a')]({'raw':_0x38eac1[_0x75c2('0x1b')]?_0x38eac1[_0x75c2('0x1b')][_0x75c2('0x1c')]===undefined?!![]:![]:!![],'where':_0x38eac1[_0x75c2('0x1b')]?_0x38eac1['options'][_0x75c2('0x1d')]||null:null,'attributes':_0x38eac1[_0x75c2('0x1b')]?_0x38eac1[_0x75c2('0x1b')][_0x75c2('0x1e')]||null:null,'limit':_0x38eac1[_0x75c2('0x1b')]?_0x38eac1[_0x75c2('0x1b')]['limit']||null:null,'include':_0x38eac1[_0x75c2('0x1b')]?_0x38eac1['options'][_0x75c2('0x1f')]?_[_0x75c2('0x20')](_0x38eac1[_0x75c2('0x1b')][_0x75c2('0x1f')],function(_0x2624d9){return{'model':db[_0x2624d9[_0x75c2('0x21')]],'as':_0x2624d9['as'],'attributes':_0x2624d9[_0x75c2('0x1e')],'include':_0x2624d9[_0x75c2('0x1f')]?_['map'](_0x2624d9[_0x75c2('0x1f')],function(_0x53e083){return{'model':db[_0x53e083[_0x75c2('0x21')]],'as':_0x53e083['as'],'attributes':_0x53e083[_0x75c2('0x1e')],'include':_0x53e083['include']?_['map'](_0x53e083[_0x75c2('0x1f')],function(_0x2283ba){return{'model':db[_0x2283ba[_0x75c2('0x21')]],'as':_0x2283ba['as'],'attributes':_0x2283ba[_0x75c2('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x19d5db){logger[_0x75c2('0xe')](_0x75c2('0x18'),_0x38eac1);logger[_0x75c2('0x10')](_0x75c2('0x18'),_0x38eac1,JSON[_0x75c2('0x12')](_0x19d5db));_0x493d7d(_0x19d5db);})[_0x75c2('0x22')](function(_0x44fc7c){logger[_0x75c2('0x13')](_0x75c2('0x18'),_0x44fc7c['message'],_0x38eac1);_0x3ebe6d(_0x5c5b3d['error'](0x1f4,_0x44fc7c[_0x75c2('0x16')]));});});}; \ No newline at end of file +var _0x8bfb=['Template','findAll','options','where','attributes','limit','include','map','model','then','debug','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','http','info','Template,\x20%s,\x20%s','Template,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','GetTemplate'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x8bfb,0x17f));var _0xb8bf=function(_0x59c312,_0x34cf0d){_0x59c312=_0x59c312-0x0;var _0x17b2a7=_0x8bfb[_0x59c312];return _0x17b2a7;};'use strict';var _=require(_0xb8bf('0x0'));var util=require(_0xb8bf('0x1'));var moment=require('moment');var BPromise=require(_0xb8bf('0x2'));var rs=require(_0xb8bf('0x3'));var fs=require('fs');var Redis=require(_0xb8bf('0x4'));var db=require(_0xb8bf('0x5'))['db'];var utils=require(_0xb8bf('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xb8bf('0x7'));var client=jayson[_0xb8bf('0x8')][_0xb8bf('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x342f32,_0x479181,_0x583fc3){return new BPromise(function(_0x198141,_0x1c217d){return client['request'](_0x342f32,_0x583fc3)['then'](function(_0x173a0b){logger[_0xb8bf('0xa')](_0xb8bf('0xb'),_0x479181,'request\x20sent');logger['debug'](_0xb8bf('0xc'),_0x479181,_0xb8bf('0xd'),JSON[_0xb8bf('0xe')](_0x173a0b));if(_0x173a0b[_0xb8bf('0xf')]){if(_0x173a0b['error']['code']===0x1f4){logger[_0xb8bf('0xf')]('Template,\x20%s,\x20%s',_0x479181,_0x173a0b[_0xb8bf('0xf')]['message']);return _0x1c217d(_0x173a0b[_0xb8bf('0xf')][_0xb8bf('0x10')]);}logger['error'](_0xb8bf('0xb'),_0x479181,_0x173a0b[_0xb8bf('0xf')][_0xb8bf('0x10')]);return _0x198141(_0x173a0b[_0xb8bf('0xf')][_0xb8bf('0x10')]);}else{logger[_0xb8bf('0xa')](_0xb8bf('0xb'),_0x479181,_0xb8bf('0xd'));_0x198141(_0x173a0b[_0xb8bf('0x11')][_0xb8bf('0x10')]);}})[_0xb8bf('0x12')](function(_0x4a96e4){logger[_0xb8bf('0xf')]('Template,\x20%s,\x20%s',_0x479181,_0x4a96e4);_0x1c217d(_0x4a96e4);});});}exports[_0xb8bf('0x13')]=function(_0x327256){var _0x30c6c1=this;return new Promise(function(_0x234ede,_0x3b18c4){return db[_0xb8bf('0x14')][_0xb8bf('0x15')]({'raw':_0x327256[_0xb8bf('0x16')]?_0x327256[_0xb8bf('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x327256[_0xb8bf('0x16')]?_0x327256[_0xb8bf('0x16')][_0xb8bf('0x17')]||null:null,'attributes':_0x327256[_0xb8bf('0x16')]?_0x327256['options'][_0xb8bf('0x18')]||null:null,'limit':_0x327256['options']?_0x327256[_0xb8bf('0x16')][_0xb8bf('0x19')]||null:null,'include':_0x327256[_0xb8bf('0x16')]?_0x327256[_0xb8bf('0x16')][_0xb8bf('0x1a')]?_[_0xb8bf('0x1b')](_0x327256[_0xb8bf('0x16')][_0xb8bf('0x1a')],function(_0x3ed390){return{'model':db[_0x3ed390[_0xb8bf('0x1c')]],'as':_0x3ed390['as'],'attributes':_0x3ed390[_0xb8bf('0x18')],'include':_0x3ed390[_0xb8bf('0x1a')]?_[_0xb8bf('0x1b')](_0x3ed390[_0xb8bf('0x1a')],function(_0x28adba){return{'model':db[_0x28adba[_0xb8bf('0x1c')]],'as':_0x28adba['as'],'attributes':_0x28adba[_0xb8bf('0x18')],'include':_0x28adba[_0xb8bf('0x1a')]?_[_0xb8bf('0x1b')](_0x28adba[_0xb8bf('0x1a')],function(_0x40fe3d){return{'model':db[_0x40fe3d['model']],'as':_0x40fe3d['as'],'attributes':_0x40fe3d['attributes']};}):[]};}):[]};}):[]:[]})[_0xb8bf('0x1d')](function(_0x4de4aa){logger['info']('GetTemplate',_0x327256);logger[_0xb8bf('0x1e')](_0xb8bf('0x13'),_0x327256,JSON['stringify'](_0x4de4aa));_0x234ede(_0x4de4aa);})[_0xb8bf('0x12')](function(_0x32f36e){logger[_0xb8bf('0xf')]('GetTemplate',_0x32f36e[_0xb8bf('0x10')],_0x327256);_0x3b18c4(_0x30c6c1['error'](0x1f4,_0x32f36e[_0xb8bf('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index 314e113..35d5e94 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 _0x9b51=['isAuthenticated','show','/:id/all_conditions','getAllConditions','getAnyConditions','/:id/actions','getActions','post','create','addAllCondition','/:id/any_conditions','addAnyCondition','addAction','put','delete','destroy','multer','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','get','index','/:id'];(function(_0x532f78,_0x434fd2){var _0x5e07a2=function(_0xfb64da){while(--_0xfb64da){_0x532f78['push'](_0x532f78['shift']());}};_0x5e07a2(++_0x434fd2);}(_0x9b51,0x1d2));var _0x19b5=function(_0x1c677a,_0x4c8e34){_0x1c677a=_0x1c677a-0x0;var _0x48596c=_0x9b51[_0x1c677a];return _0x48596c;};'use strict';var multer=require(_0x19b5('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x19b5('0x1'));var express=require(_0x19b5('0x2'));var router=express['Router']();var fs_extra=require(_0x19b5('0x3'));var auth=require(_0x19b5('0x4'));var interaction=require(_0x19b5('0x5'));var config=require('../../config/environment');var controller=require('./trigger.controller');router[_0x19b5('0x6')]('/',auth['isAuthenticated'](),controller[_0x19b5('0x7')]);router[_0x19b5('0x6')](_0x19b5('0x8'),auth[_0x19b5('0x9')](),controller[_0x19b5('0xa')]);router[_0x19b5('0x6')](_0x19b5('0xb'),auth['isAuthenticated'](),controller[_0x19b5('0xc')]);router['get']('/:id/any_conditions',auth[_0x19b5('0x9')](),controller[_0x19b5('0xd')]);router[_0x19b5('0x6')](_0x19b5('0xe'),auth[_0x19b5('0x9')](),controller[_0x19b5('0xf')]);router[_0x19b5('0x10')]('/',auth[_0x19b5('0x9')](),controller[_0x19b5('0x11')]);router['post']('/:id/all_conditions',auth[_0x19b5('0x9')](),controller[_0x19b5('0x12')]);router[_0x19b5('0x10')](_0x19b5('0x13'),auth[_0x19b5('0x9')](),controller[_0x19b5('0x14')]);router['post'](_0x19b5('0xe'),auth[_0x19b5('0x9')](),controller[_0x19b5('0x15')]);router[_0x19b5('0x16')](_0x19b5('0x8'),auth[_0x19b5('0x9')](),controller['update']);router[_0x19b5('0x17')]('/:id',auth[_0x19b5('0x9')](),controller[_0x19b5('0x18')]);module['exports']=router; \ No newline at end of file +var _0x914a=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','index','/:id','show','get','/:id/all_conditions','getAllConditions','/:id/actions','getActions','post','create','addAllCondition','/:id/any_conditions','addAnyCondition','addAction','put'];(function(_0x9ad0b1,_0x1dff9a){var _0x4decfc=function(_0x56bc1d){while(--_0x56bc1d){_0x9ad0b1['push'](_0x9ad0b1['shift']());}};_0x4decfc(++_0x1dff9a);}(_0x914a,0x74));var _0xa914=function(_0xe3e0af,_0x4564ed){_0xe3e0af=_0xe3e0af-0x0;var _0x4828e9=_0x914a[_0xe3e0af];return _0x4828e9;};'use strict';var multer=require(_0xa914('0x0'));var util=require(_0xa914('0x1'));var path=require(_0xa914('0x2'));var timeout=require(_0xa914('0x3'));var express=require(_0xa914('0x4'));var router=express['Router']();var fs_extra=require(_0xa914('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xa914('0x6'));var config=require(_0xa914('0x7'));var controller=require('./trigger.controller');router['get']('/',auth[_0xa914('0x8')](),controller[_0xa914('0x9')]);router['get'](_0xa914('0xa'),auth['isAuthenticated'](),controller[_0xa914('0xb')]);router[_0xa914('0xc')](_0xa914('0xd'),auth['isAuthenticated'](),controller[_0xa914('0xe')]);router[_0xa914('0xc')]('/:id/any_conditions',auth[_0xa914('0x8')](),controller['getAnyConditions']);router[_0xa914('0xc')](_0xa914('0xf'),auth[_0xa914('0x8')](),controller[_0xa914('0x10')]);router[_0xa914('0x11')]('/',auth[_0xa914('0x8')](),controller[_0xa914('0x12')]);router[_0xa914('0x11')]('/:id/all_conditions',auth[_0xa914('0x8')](),controller[_0xa914('0x13')]);router['post'](_0xa914('0x14'),auth[_0xa914('0x8')](),controller[_0xa914('0x15')]);router[_0xa914('0x11')](_0xa914('0xf'),auth['isAuthenticated'](),controller[_0xa914('0x16')]);router[_0xa914('0x17')](_0xa914('0xa'),auth['isAuthenticated'](),controller[_0xa914('0x18')]);router[_0xa914('0x19')](_0xa914('0xa'),auth[_0xa914('0x8')](),controller[_0xa914('0x1a')]);module[_0xa914('0x1b')]=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index 069785a..6f617d9 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 _0x7a34=['STRING','sequelize'];(function(_0x5bf57d,_0x2b07c2){var _0x17d216=function(_0x433365){while(--_0x433365){_0x5bf57d['push'](_0x5bf57d['shift']());}};_0x17d216(++_0x2b07c2);}(_0x7a34,0xdd));var _0x47a3=function(_0x34da8b,_0x4c5388){_0x34da8b=_0x34da8b-0x0;var _0x4da3d2=_0x7a34[_0x34da8b];return _0x4da3d2;};'use strict';var Sequelize=require(_0x47a3('0x0'));module['exports']={'name':{'type':Sequelize[_0x47a3('0x1')]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x47a3('0x1')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xf629=['STRING','BOOLEAN','sequelize'];(function(_0x98ac1f,_0x2effb0){var _0x1579d1=function(_0x54b8d7){while(--_0x54b8d7){_0x98ac1f['push'](_0x98ac1f['shift']());}};_0x1579d1(++_0x2effb0);}(_0xf629,0xd7));var _0x9f62=function(_0x5d0b6e,_0x2a13a5){_0x5d0b6e=_0x5d0b6e-0x0;var _0x13c731=_0xf629[_0x5d0b6e];return _0x13c731;};'use strict';var Sequelize=require(_0x9f62('0x0'));module['exports']={'name':{'type':Sequelize[_0x9f62('0x1')]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x9f62('0x1')]},'status':{'type':Sequelize[_0x9f62('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/trigger/trigger.controller.js b/server/api/trigger/trigger.controller.js index 37c86de..0c07477 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 _0xa4aa=['reject','update','then','get','destroy','error','stack','name','send','index','map','Trigger','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','include','findAll','rows','catch','show','keys','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Triggers','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','params','addAllCondition','TriggerAllId','addAnyCondition','TriggerAnyId','Condition','getAllConditions','findOne','getAnyConditions','addAction','TriggerId','Action','getActions','eml-format','rimraf','fast-json-patch','moment','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset','count','set','apply'];(function(_0x1589dd,_0x2b9d22){var _0x1bddd1=function(_0x3687f8){while(--_0x3687f8){_0x1589dd['push'](_0x1589dd['shift']());}};_0x1bddd1(++_0x2b9d22);}(_0xa4aa,0x9a));var _0xaa4a=function(_0x5ed157,_0x1aab72){_0x5ed157=_0x5ed157-0x0;var _0x21aa6d=_0xa4aa[_0x5ed157];return _0x21aa6d;};'use strict';var emlformat=require(_0xaa4a('0x0'));var rimraf=require(_0xaa4a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xaa4a('0x2'));var rp=require('request-promise');var moment=require(_0xaa4a('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xaa4a('0x4'));var util=require('util');var path=require('path');var sox=require(_0xaa4a('0x5'));var csv=require(_0xaa4a('0x6'));var ejs=require(_0xaa4a('0x7'));var fs=require('fs');var fs_extra=require(_0xaa4a('0x8'));var _=require(_0xaa4a('0x9'));var squel=require(_0xaa4a('0xa'));var crypto=require('crypto');var jsforce=require(_0xaa4a('0xb'));var deskjs=require(_0xaa4a('0xc'));var toCsv=require(_0xaa4a('0x6'));var querystring=require(_0xaa4a('0xd'));var Papa=require(_0xaa4a('0xe'));var Redis=require('ioredis');var authService=require(_0xaa4a('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xaa4a('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xaa4a('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0xaa4a('0x12'));var db=require(_0xaa4a('0x13'))['db'];function respondWithStatusCode(_0x5472de,_0xb69b9d){_0xb69b9d=_0xb69b9d||0xcc;return function(_0x1c303c){if(_0x1c303c){return _0x5472de[_0xaa4a('0x14')](_0xb69b9d);}return _0x5472de[_0xaa4a('0x15')](_0xb69b9d)[_0xaa4a('0x16')]();};}function respondWithResult(_0x55eb86,_0x1f5503){_0x1f5503=_0x1f5503||0xc8;return function(_0x4c796a){if(_0x4c796a){return _0x55eb86[_0xaa4a('0x15')](_0x1f5503)[_0xaa4a('0x17')](_0x4c796a);}};}function respondWithFilteredResult(_0x33e907,_0x18e22a){return function(_0xa2386){if(_0xa2386){var _0x49f372=typeof _0x18e22a['offset']===_0xaa4a('0x18')&&typeof _0x18e22a[_0xaa4a('0x19')]==='undefined';var _0x5297f8=_0xa2386['count'];var _0x5b9ff9=_0x49f372?0x0:_0x18e22a[_0xaa4a('0x1a')];var _0x19cf68=_0x49f372?_0xa2386[_0xaa4a('0x1b')]:_0x18e22a[_0xaa4a('0x1a')]+_0x18e22a[_0xaa4a('0x19')];var _0x38adf5;if(_0x19cf68>=_0x5297f8){_0x19cf68=_0x5297f8;_0x38adf5=0xc8;}else{_0x38adf5=0xce;}_0x33e907[_0xaa4a('0x15')](_0x38adf5);return _0x33e907[_0xaa4a('0x1c')]('Content-Range',_0x5b9ff9+'-'+_0x19cf68+'/'+_0x5297f8)[_0xaa4a('0x17')](_0xa2386);}return null;};}function patchUpdates(_0x13719f){return function(_0x4020ba){try{jsonpatch[_0xaa4a('0x1d')](_0x4020ba,_0x13719f,!![]);}catch(_0xc5ffc0){return BPromise[_0xaa4a('0x1e')](_0xc5ffc0);}return _0x4020ba['save']();};}function saveUpdates(_0x193651,_0x555c88){return function(_0x5d6e9d){if(_0x5d6e9d){return _0x5d6e9d[_0xaa4a('0x1f')](_0x193651)[_0xaa4a('0x20')](function(_0x4021da){return _0x4021da;});}return null;};}function removeEntity(_0xd50e6c,_0x1b3bf1){return function(_0x5013a8){if(_0x5013a8){return _0x5013a8['destroy']()[_0xaa4a('0x20')](function(){var _0x247f32=_0x5013a8[_0xaa4a('0x21')]({'plain':!![]});var _0x1e3fca='Triggers';return db['UserProfileResource'][_0xaa4a('0x22')]({'where':{'type':_0x1e3fca,'resourceId':_0x247f32['id']}})['then'](function(){return _0x5013a8;});})['then'](function(){_0xd50e6c['status'](0xcc)[_0xaa4a('0x16')]();});}};}function handleEntityNotFound(_0x5d4278,_0x3ffaf4){return function(_0x35f5f0){if(!_0x35f5f0){_0x5d4278['sendStatus'](0x194);}return _0x35f5f0;};}function handleError(_0x1f6bc8,_0x181655){_0x181655=_0x181655||0x1f4;return function(_0x2ac348){logger[_0xaa4a('0x23')](_0x2ac348[_0xaa4a('0x24')]);if(_0x2ac348[_0xaa4a('0x25')]){delete _0x2ac348['name'];}_0x1f6bc8['status'](_0x181655)[_0xaa4a('0x26')](_0x2ac348);};}exports[_0xaa4a('0x27')]=function(_0x2db095,_0x4ffae8){var _0x40c253={},_0x4d8a9d={},_0x18d224={'count':0x0,'rows':[]};var _0xe2a0a5=_[_0xaa4a('0x28')](db[_0xaa4a('0x29')][_0xaa4a('0x2a')],function(_0x595bec){return{'name':_0x595bec[_0xaa4a('0x2b')],'type':_0x595bec[_0xaa4a('0x2c')][_0xaa4a('0x2d')]};});_0x4d8a9d[_0xaa4a('0x2e')]=_[_0xaa4a('0x28')](_0xe2a0a5,_0xaa4a('0x25'));_0x4d8a9d[_0xaa4a('0x2f')]=_['keys'](_0x2db095['query']);_0x4d8a9d[_0xaa4a('0x30')]=_[_0xaa4a('0x31')](_0x4d8a9d[_0xaa4a('0x2e')],_0x4d8a9d[_0xaa4a('0x2f')]);_0x40c253[_0xaa4a('0x32')]=_['intersection'](_0x4d8a9d[_0xaa4a('0x2e')],qs[_0xaa4a('0x33')](_0x2db095[_0xaa4a('0x2f')][_0xaa4a('0x33')]));_0x40c253['attributes']=_0x40c253['attributes'][_0xaa4a('0x34')]?_0x40c253['attributes']:_0x4d8a9d[_0xaa4a('0x2e')];if(!_0x2db095[_0xaa4a('0x2f')][_0xaa4a('0x35')](_0xaa4a('0x36'))){_0x40c253[_0xaa4a('0x19')]=qs[_0xaa4a('0x19')](_0x2db095[_0xaa4a('0x2f')][_0xaa4a('0x19')]);_0x40c253[_0xaa4a('0x1a')]=qs[_0xaa4a('0x1a')](_0x2db095[_0xaa4a('0x2f')][_0xaa4a('0x1a')]);}_0x40c253[_0xaa4a('0x37')]=qs[_0xaa4a('0x38')](_0x2db095[_0xaa4a('0x2f')][_0xaa4a('0x38')]);_0x40c253[_0xaa4a('0x39')]=qs[_0xaa4a('0x30')](_[_0xaa4a('0x3a')](_0x2db095['query'],_0x4d8a9d['filters']),_0xe2a0a5);if(_0x2db095['query'][_0xaa4a('0x3b')]){_0x40c253[_0xaa4a('0x39')]=_['merge'](_0x40c253['where'],{'$or':_[_0xaa4a('0x28')](_0xe2a0a5,function(_0x132133){if(_0x132133[_0xaa4a('0x2c')]!=='VIRTUAL'){var _0x2705c0={};_0x2705c0[_0x132133['name']]={'$like':'%'+_0x2db095[_0xaa4a('0x2f')][_0xaa4a('0x3b')]+'%'};return _0x2705c0;}})});}_0x40c253=_[_0xaa4a('0x3c')]({},_0x40c253,_0x2db095[_0xaa4a('0x3d')]);var _0x58a364={'where':_0x40c253['where']};return db[_0xaa4a('0x29')][_0xaa4a('0x1b')](_0x58a364)[_0xaa4a('0x20')](function(_0x5bdb36){_0x18d224[_0xaa4a('0x1b')]=_0x5bdb36;if(_0x2db095[_0xaa4a('0x2f')]['includeAll']){_0x40c253[_0xaa4a('0x3e')]=[{'all':!![]}];}return db[_0xaa4a('0x29')][_0xaa4a('0x3f')](_0x40c253);})[_0xaa4a('0x20')](function(_0x3fa10c){_0x18d224[_0xaa4a('0x40')]=_0x3fa10c;return _0x18d224;})[_0xaa4a('0x20')](respondWithFilteredResult(_0x4ffae8,_0x40c253))[_0xaa4a('0x41')](handleError(_0x4ffae8,null));};exports[_0xaa4a('0x42')]=function(_0x18e409,_0xb9a46e){var _0x249958={'raw':![],'where':{'id':_0x18e409['params']['id']}},_0x2a0bb3={};_0x2a0bb3[_0xaa4a('0x2e')]=_[_0xaa4a('0x43')](db[_0xaa4a('0x29')][_0xaa4a('0x2a')]);_0x2a0bb3['query']=_[_0xaa4a('0x43')](_0x18e409[_0xaa4a('0x2f')]);_0x2a0bb3[_0xaa4a('0x30')]=_[_0xaa4a('0x31')](_0x2a0bb3[_0xaa4a('0x2e')],_0x2a0bb3[_0xaa4a('0x2f')]);_0x249958[_0xaa4a('0x32')]=_[_0xaa4a('0x31')](_0x2a0bb3[_0xaa4a('0x2e')],qs[_0xaa4a('0x33')](_0x18e409[_0xaa4a('0x2f')]['fields']));_0x249958[_0xaa4a('0x32')]=_0x249958[_0xaa4a('0x32')][_0xaa4a('0x34')]?_0x249958[_0xaa4a('0x32')]:_0x2a0bb3[_0xaa4a('0x2e')];if(_0x18e409['query'][_0xaa4a('0x44')]){_0x249958[_0xaa4a('0x3e')]=[{'all':!![]}];}_0x249958=_['merge']({},_0x249958,_0x18e409[_0xaa4a('0x3d')]);return db[_0xaa4a('0x29')][_0xaa4a('0x45')](_0x249958)[_0xaa4a('0x20')](handleEntityNotFound(_0xb9a46e,null))['then'](respondWithResult(_0xb9a46e,null))[_0xaa4a('0x41')](handleError(_0xb9a46e,null));};exports[_0xaa4a('0x46')]=function(_0xbe8725,_0x1718e0){return db[_0xaa4a('0x29')][_0xaa4a('0x46')](_0xbe8725[_0xaa4a('0x47')],{})['then'](function(_0x5ad7e9){var _0x59bac5=_0xbe8725[_0xaa4a('0x48')][_0xaa4a('0x21')]({'plain':!![]});if(!_0x59bac5)throw new Error(_0xaa4a('0x49'));if(_0x59bac5['role']===_0xaa4a('0x48')){var _0x514929=_0x5ad7e9['get']({'plain':!![]});var _0x902d46=_0xaa4a('0x4a');return db[_0xaa4a('0x4b')][_0xaa4a('0x45')]({'where':{'name':_0x902d46,'userProfileId':_0x59bac5[_0xaa4a('0x4c')]},'raw':!![]})['then'](function(_0x25ddca){if(_0x25ddca&&_0x25ddca[_0xaa4a('0x4d')]===0x0){return db[_0xaa4a('0x4e')]['create']({'name':_0x514929['name'],'resourceId':_0x514929['id'],'type':_0x25ddca[_0xaa4a('0x25')],'sectionId':_0x25ddca['id']},{})[_0xaa4a('0x20')](function(){return _0x5ad7e9;});}else{return _0x5ad7e9;}})[_0xaa4a('0x41')](function(_0x4e947d){logger[_0xaa4a('0x23')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4e947d);throw _0x4e947d;});}return _0x5ad7e9;})[_0xaa4a('0x20')](respondWithResult(_0x1718e0,0xc9))[_0xaa4a('0x41')](handleError(_0x1718e0,null));};exports[_0xaa4a('0x1f')]=function(_0x186397,_0xbf5592){if(_0x186397['body']['id']){delete _0x186397[_0xaa4a('0x47')]['id'];}return db[_0xaa4a('0x29')]['find']({'where':{'id':_0x186397['params']['id']}})[_0xaa4a('0x20')](handleEntityNotFound(_0xbf5592,null))[_0xaa4a('0x20')](saveUpdates(_0x186397[_0xaa4a('0x47')],null))[_0xaa4a('0x20')](respondWithResult(_0xbf5592,null))[_0xaa4a('0x41')](handleError(_0xbf5592,null));};exports[_0xaa4a('0x22')]=function(_0x4ca94c,_0x9b31a){return db[_0xaa4a('0x29')][_0xaa4a('0x45')]({'where':{'id':_0x4ca94c[_0xaa4a('0x4f')]['id']}})[_0xaa4a('0x20')](handleEntityNotFound(_0x9b31a,null))[_0xaa4a('0x20')](removeEntity(_0x9b31a,null))['catch'](handleError(_0x9b31a,null));};exports[_0xaa4a('0x50')]=function(_0x4923f6,_0xedc924,_0x36f5a9){if(_0x4923f6[_0xaa4a('0x47')]['id']){delete _0x4923f6[_0xaa4a('0x47')]['id'];}return db[_0xaa4a('0x29')][_0xaa4a('0x45')]({'where':{'id':_0x4923f6[_0xaa4a('0x4f')]['id']}})[_0xaa4a('0x20')](handleEntityNotFound(_0xedc924,null))[_0xaa4a('0x20')](function(_0x58c780){if(_0x58c780){_0x4923f6[_0xaa4a('0x47')][_0xaa4a('0x51')]=_0x58c780['id'];return db['Condition'][_0xaa4a('0x46')](_0x4923f6[_0xaa4a('0x47')]);}})[_0xaa4a('0x20')](respondWithResult(_0xedc924,null))['catch'](handleError(_0xedc924,null));};exports[_0xaa4a('0x52')]=function(_0x563958,_0x1fc4be,_0x11effe){if(_0x563958[_0xaa4a('0x47')]['id']){delete _0x563958[_0xaa4a('0x47')]['id'];}return db['Trigger'][_0xaa4a('0x45')]({'where':{'id':_0x563958[_0xaa4a('0x4f')]['id']}})[_0xaa4a('0x20')](handleEntityNotFound(_0x1fc4be,null))[_0xaa4a('0x20')](function(_0x19943f){if(_0x19943f){_0x563958['body'][_0xaa4a('0x53')]=_0x19943f['id'];return db[_0xaa4a('0x54')][_0xaa4a('0x46')](_0x563958[_0xaa4a('0x47')]);}})[_0xaa4a('0x20')](respondWithResult(_0x1fc4be,null))['catch'](handleError(_0x1fc4be,null));};exports[_0xaa4a('0x55')]=function(_0x40b086,_0x3189df,_0x2b5d9f){var _0x40c24c={};var _0x1d309b={};var _0x147fca;var _0x1a0355;return db[_0xaa4a('0x29')][_0xaa4a('0x56')]({'where':{'id':_0x40b086['params']['id']}})[_0xaa4a('0x20')](handleEntityNotFound(_0x3189df,null))[_0xaa4a('0x20')](function(_0x24514c){if(_0x24514c){_0x147fca=_0x24514c;_0x1d309b[_0xaa4a('0x2e')]=_[_0xaa4a('0x43')](db[_0xaa4a('0x54')][_0xaa4a('0x2a')]);_0x1d309b[_0xaa4a('0x2f')]=_['keys'](_0x40b086[_0xaa4a('0x2f')]);_0x1d309b['filters']=_[_0xaa4a('0x31')](_0x1d309b[_0xaa4a('0x2e')],_0x1d309b[_0xaa4a('0x2f')]);_0x40c24c['attributes']=_[_0xaa4a('0x31')](_0x1d309b[_0xaa4a('0x2e')],qs[_0xaa4a('0x33')](_0x40b086[_0xaa4a('0x2f')][_0xaa4a('0x33')]));_0x40c24c['attributes']=_0x40c24c[_0xaa4a('0x32')][_0xaa4a('0x34')]?_0x40c24c[_0xaa4a('0x32')]:_0x1d309b[_0xaa4a('0x2e')];_0x40c24c[_0xaa4a('0x37')]=qs[_0xaa4a('0x38')](_0x40b086[_0xaa4a('0x2f')][_0xaa4a('0x38')]);_0x40c24c['where']=qs[_0xaa4a('0x30')](_[_0xaa4a('0x3a')](_0x40b086[_0xaa4a('0x2f')],_0x1d309b['filters']));if(_0x40b086[_0xaa4a('0x2f')]['filter']){_0x40c24c['where']=_[_0xaa4a('0x3c')](_0x40c24c['where'],{'$or':_[_0xaa4a('0x28')](_0x40c24c[_0xaa4a('0x32')],function(_0x58fb04){var _0x579906={};_0x579906[_0x58fb04]={'$like':'%'+_0x40b086[_0xaa4a('0x2f')]['filter']+'%'};return _0x579906;})});}_0x40c24c=_[_0xaa4a('0x3c')]({},_0x40c24c,_0x40b086[_0xaa4a('0x3d')]);return _0x147fca[_0xaa4a('0x55')](_0x40c24c);}})[_0xaa4a('0x20')](function(_0x2add95){if(_0x2add95){_0x1a0355=_0x2add95[_0xaa4a('0x34')];if(!_0x40b086['query'][_0xaa4a('0x35')](_0xaa4a('0x36'))){_0x40c24c[_0xaa4a('0x19')]=qs[_0xaa4a('0x19')](_0x40b086[_0xaa4a('0x2f')][_0xaa4a('0x19')]);_0x40c24c['offset']=qs['offset'](_0x40b086[_0xaa4a('0x2f')][_0xaa4a('0x1a')]);}return _0x147fca[_0xaa4a('0x55')](_0x40c24c);}})['then'](function(_0x3e5a2a){if(_0x3e5a2a){return _0x3e5a2a?{'count':_0x1a0355,'rows':_0x3e5a2a}:null;}})[_0xaa4a('0x20')](respondWithResult(_0x3189df,null))[_0xaa4a('0x41')](handleError(_0x3189df,null));};exports[_0xaa4a('0x57')]=function(_0x26d877,_0x370236,_0x58ba81){var _0x1d7631={};var _0x2e6f7e={};var _0x945018;var _0x14320c;return db['Trigger'][_0xaa4a('0x56')]({'where':{'id':_0x26d877[_0xaa4a('0x4f')]['id']}})[_0xaa4a('0x20')](handleEntityNotFound(_0x370236,null))[_0xaa4a('0x20')](function(_0x24be7a){if(_0x24be7a){_0x945018=_0x24be7a;_0x2e6f7e[_0xaa4a('0x2e')]=_['keys'](db[_0xaa4a('0x54')][_0xaa4a('0x2a')]);_0x2e6f7e[_0xaa4a('0x2f')]=_[_0xaa4a('0x43')](_0x26d877[_0xaa4a('0x2f')]);_0x2e6f7e['filters']=_[_0xaa4a('0x31')](_0x2e6f7e[_0xaa4a('0x2e')],_0x2e6f7e[_0xaa4a('0x2f')]);_0x1d7631[_0xaa4a('0x32')]=_[_0xaa4a('0x31')](_0x2e6f7e[_0xaa4a('0x2e')],qs[_0xaa4a('0x33')](_0x26d877[_0xaa4a('0x2f')][_0xaa4a('0x33')]));_0x1d7631[_0xaa4a('0x32')]=_0x1d7631[_0xaa4a('0x32')]['length']?_0x1d7631['attributes']:_0x2e6f7e[_0xaa4a('0x2e')];_0x1d7631[_0xaa4a('0x37')]=qs[_0xaa4a('0x38')](_0x26d877['query'][_0xaa4a('0x38')]);_0x1d7631['where']=qs[_0xaa4a('0x30')](_[_0xaa4a('0x3a')](_0x26d877[_0xaa4a('0x2f')],_0x2e6f7e[_0xaa4a('0x30')]));if(_0x26d877[_0xaa4a('0x2f')][_0xaa4a('0x3b')]){_0x1d7631[_0xaa4a('0x39')]=_[_0xaa4a('0x3c')](_0x1d7631[_0xaa4a('0x39')],{'$or':_[_0xaa4a('0x28')](_0x1d7631[_0xaa4a('0x32')],function(_0x19fbad){var _0x507328={};_0x507328[_0x19fbad]={'$like':'%'+_0x26d877[_0xaa4a('0x2f')][_0xaa4a('0x3b')]+'%'};return _0x507328;})});}_0x1d7631=_[_0xaa4a('0x3c')]({},_0x1d7631,_0x26d877[_0xaa4a('0x3d')]);return _0x945018[_0xaa4a('0x57')](_0x1d7631);}})[_0xaa4a('0x20')](function(_0x52c97c){if(_0x52c97c){_0x14320c=_0x52c97c[_0xaa4a('0x34')];if(!_0x26d877['query'][_0xaa4a('0x35')]('nolimit')){_0x1d7631[_0xaa4a('0x19')]=qs[_0xaa4a('0x19')](_0x26d877[_0xaa4a('0x2f')][_0xaa4a('0x19')]);_0x1d7631['offset']=qs['offset'](_0x26d877['query']['offset']);}return _0x945018[_0xaa4a('0x57')](_0x1d7631);}})[_0xaa4a('0x20')](function(_0x16ee70){if(_0x16ee70){return _0x16ee70?{'count':_0x14320c,'rows':_0x16ee70}:null;}})[_0xaa4a('0x20')](respondWithResult(_0x370236,null))[_0xaa4a('0x41')](handleError(_0x370236,null));};exports[_0xaa4a('0x58')]=function(_0x2f3b0e,_0x3b259a,_0x2e60a6){if(_0x2f3b0e['body']['id']){delete _0x2f3b0e[_0xaa4a('0x47')]['id'];}return db[_0xaa4a('0x29')][_0xaa4a('0x45')]({'where':{'id':_0x2f3b0e[_0xaa4a('0x4f')]['id']}})[_0xaa4a('0x20')](handleEntityNotFound(_0x3b259a,null))[_0xaa4a('0x20')](function(_0x1cccbf){if(_0x1cccbf){_0x2f3b0e[_0xaa4a('0x47')][_0xaa4a('0x59')]=_0x1cccbf['id'];return db[_0xaa4a('0x5a')][_0xaa4a('0x46')](_0x2f3b0e[_0xaa4a('0x47')]);}})['then'](respondWithResult(_0x3b259a,null))[_0xaa4a('0x41')](handleError(_0x3b259a,null));};exports[_0xaa4a('0x5b')]=function(_0xa53570,_0x120202,_0x102dcc){var _0x35aea7={};var _0x509072={};var _0x407abb;var _0x5384e8;return db['Trigger'][_0xaa4a('0x56')]({'where':{'id':_0xa53570['params']['id']}})['then'](handleEntityNotFound(_0x120202,null))[_0xaa4a('0x20')](function(_0x246b11){if(_0x246b11){_0x407abb=_0x246b11;_0x509072[_0xaa4a('0x2e')]=_[_0xaa4a('0x43')](db[_0xaa4a('0x5a')][_0xaa4a('0x2a')]);_0x509072[_0xaa4a('0x2f')]=_[_0xaa4a('0x43')](_0xa53570[_0xaa4a('0x2f')]);_0x509072[_0xaa4a('0x30')]=_[_0xaa4a('0x31')](_0x509072[_0xaa4a('0x2e')],_0x509072[_0xaa4a('0x2f')]);_0x35aea7[_0xaa4a('0x32')]=_[_0xaa4a('0x31')](_0x509072[_0xaa4a('0x2e')],qs['fields'](_0xa53570[_0xaa4a('0x2f')][_0xaa4a('0x33')]));_0x35aea7[_0xaa4a('0x32')]=_0x35aea7['attributes']['length']?_0x35aea7[_0xaa4a('0x32')]:_0x509072[_0xaa4a('0x2e')];_0x35aea7[_0xaa4a('0x37')]=qs['sort'](_0xa53570[_0xaa4a('0x2f')][_0xaa4a('0x38')]);_0x35aea7['where']=qs[_0xaa4a('0x30')](_[_0xaa4a('0x3a')](_0xa53570[_0xaa4a('0x2f')],_0x509072[_0xaa4a('0x30')]));if(_0xa53570[_0xaa4a('0x2f')][_0xaa4a('0x3b')]){_0x35aea7[_0xaa4a('0x39')]=_['merge'](_0x35aea7[_0xaa4a('0x39')],{'$or':_[_0xaa4a('0x28')](_0x35aea7['attributes'],function(_0x4213ca){var _0x2cf4a0={};_0x2cf4a0[_0x4213ca]={'$like':'%'+_0xa53570[_0xaa4a('0x2f')][_0xaa4a('0x3b')]+'%'};return _0x2cf4a0;})});}_0x35aea7=_['merge']({},_0x35aea7,_0xa53570['options']);return _0x407abb[_0xaa4a('0x5b')](_0x35aea7);}})[_0xaa4a('0x20')](function(_0x10c99e){if(_0x10c99e){_0x5384e8=_0x10c99e[_0xaa4a('0x34')];if(!_0xa53570[_0xaa4a('0x2f')]['hasOwnProperty'](_0xaa4a('0x36'))){_0x35aea7['limit']=qs[_0xaa4a('0x19')](_0xa53570['query'][_0xaa4a('0x19')]);_0x35aea7['offset']=qs['offset'](_0xa53570[_0xaa4a('0x2f')][_0xaa4a('0x1a')]);}return _0x407abb[_0xaa4a('0x5b')](_0x35aea7);}})[_0xaa4a('0x20')](function(_0x34d5c9){if(_0x34d5c9){return _0x34d5c9?{'count':_0x5384e8,'rows':_0x34d5c9}:null;}})['then'](respondWithResult(_0x120202,null))[_0xaa4a('0x41')](handleError(_0x120202,null));}; \ No newline at end of file +var _0x115d=['Condition','addAnyCondition','TriggerAnyId','getAllConditions','findOne','order','getAnyConditions','Action','getActions','zip-dir','moment','bluebird','mustache','path','sox','to-csv','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','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','Triggers','UserProfileResource','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','model','query','keys','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','Trigger','include','rows','catch','params','filters','intersection','find','create','body','get','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addAllCondition','TriggerAllId'];(function(_0x3db722,_0x410315){var _0x48a086=function(_0x252f9b){while(--_0x252f9b){_0x3db722['push'](_0x3db722['shift']());}};_0x48a086(++_0x410315);}(_0x115d,0x181));var _0xd115=function(_0x2b3b51,_0x3244ba){_0x2b3b51=_0x2b3b51-0x0;var _0x2b8395=_0x115d[_0x2b3b51];return _0x2b8395;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xd115('0x0'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xd115('0x1'));var BPromise=require(_0xd115('0x2'));var Mustache=require(_0xd115('0x3'));var util=require('util');var path=require(_0xd115('0x4'));var sox=require(_0xd115('0x5'));var csv=require(_0xd115('0x6'));var ejs=require(_0xd115('0x7'));var fs=require('fs');var fs_extra=require(_0xd115('0x8'));var _=require('lodash');var squel=require(_0xd115('0x9'));var crypto=require(_0xd115('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xd115('0xb'));var toCsv=require(_0xd115('0x6'));var querystring=require(_0xd115('0xc'));var Papa=require(_0xd115('0xd'));var Redis=require(_0xd115('0xe'));var authService=require(_0xd115('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xd115('0x10'));var hardwareService=require(_0xd115('0x11'));var logger=require(_0xd115('0x12'))(_0xd115('0x13'));var utils=require(_0xd115('0x14'));var config=require(_0xd115('0x15'));var licenseUtil=require(_0xd115('0x16'));var db=require(_0xd115('0x17'))['db'];function respondWithStatusCode(_0x3f5812,_0x7cc9f5){_0x7cc9f5=_0x7cc9f5||0xcc;return function(_0x31399f){if(_0x31399f){return _0x3f5812['sendStatus'](_0x7cc9f5);}return _0x3f5812['status'](_0x7cc9f5)[_0xd115('0x18')]();};}function respondWithResult(_0x53069b,_0x10464d){_0x10464d=_0x10464d||0xc8;return function(_0x526ec0){if(_0x526ec0){return _0x53069b[_0xd115('0x19')](_0x10464d)[_0xd115('0x1a')](_0x526ec0);}};}function respondWithFilteredResult(_0x1ac4de,_0x526e5f){return function(_0x5b0dda){if(_0x5b0dda){var _0x3fa63c=typeof _0x526e5f[_0xd115('0x1b')]===_0xd115('0x1c')&&typeof _0x526e5f[_0xd115('0x1d')]===_0xd115('0x1c');var _0x26df96=_0x5b0dda['count'];var _0x566fe7=_0x3fa63c?0x0:_0x526e5f[_0xd115('0x1b')];var _0x28442c=_0x3fa63c?_0x5b0dda[_0xd115('0x1e')]:_0x526e5f['offset']+_0x526e5f[_0xd115('0x1d')];var _0x130475;if(_0x28442c>=_0x26df96){_0x28442c=_0x26df96;_0x130475=0xc8;}else{_0x130475=0xce;}_0x1ac4de['status'](_0x130475);return _0x1ac4de[_0xd115('0x1f')](_0xd115('0x20'),_0x566fe7+'-'+_0x28442c+'/'+_0x26df96)['json'](_0x5b0dda);}return null;};}function patchUpdates(_0x2a0946){return function(_0x5ca53c){try{jsonpatch[_0xd115('0x21')](_0x5ca53c,_0x2a0946,!![]);}catch(_0x5977b3){return BPromise[_0xd115('0x22')](_0x5977b3);}return _0x5ca53c[_0xd115('0x23')]();};}function saveUpdates(_0x3ca0fa,_0x3cf57e){return function(_0x2bac84){if(_0x2bac84){return _0x2bac84[_0xd115('0x24')](_0x3ca0fa)[_0xd115('0x25')](function(_0x553033){return _0x553033;});}return null;};}function removeEntity(_0x1d2856,_0xc14d99){return function(_0x4546bf){if(_0x4546bf){return _0x4546bf[_0xd115('0x26')]()[_0xd115('0x25')](function(){var _0x566e69=_0x4546bf['get']({'plain':!![]});var _0x1a6021=_0xd115('0x27');return db[_0xd115('0x28')][_0xd115('0x26')]({'where':{'type':_0x1a6021,'resourceId':_0x566e69['id']}})[_0xd115('0x25')](function(){return _0x4546bf;});})[_0xd115('0x25')](function(){_0x1d2856[_0xd115('0x19')](0xcc)[_0xd115('0x18')]();});}};}function handleEntityNotFound(_0x27d3ea,_0x1bf279){return function(_0x15a153){if(!_0x15a153){_0x27d3ea[_0xd115('0x29')](0x194);}return _0x15a153;};}function handleError(_0x2ea64b,_0x4055a8){_0x4055a8=_0x4055a8||0x1f4;return function(_0x8e21f6){logger[_0xd115('0x2a')](_0x8e21f6[_0xd115('0x2b')]);if(_0x8e21f6[_0xd115('0x2c')]){delete _0x8e21f6[_0xd115('0x2c')];}_0x2ea64b[_0xd115('0x19')](_0x4055a8)[_0xd115('0x2d')](_0x8e21f6);};}exports[_0xd115('0x2e')]=function(_0x27f035,_0x233edf){var _0xd16d7c={},_0x43f56c={},_0x39bf24={'count':0x0,'rows':[]};var _0x500ee2=_[_0xd115('0x2f')](db['Trigger'][_0xd115('0x30')],function(_0x310daf){return{'name':_0x310daf[_0xd115('0x31')],'type':_0x310daf['type']['key']};});_0x43f56c[_0xd115('0x32')]=_[_0xd115('0x2f')](_0x500ee2,_0xd115('0x2c'));_0x43f56c[_0xd115('0x33')]=_[_0xd115('0x34')](_0x27f035[_0xd115('0x33')]);_0x43f56c['filters']=_['intersection'](_0x43f56c[_0xd115('0x32')],_0x43f56c['query']);_0xd16d7c[_0xd115('0x35')]=_['intersection'](_0x43f56c[_0xd115('0x32')],qs[_0xd115('0x36')](_0x27f035[_0xd115('0x33')][_0xd115('0x36')]));_0xd16d7c[_0xd115('0x35')]=_0xd16d7c['attributes'][_0xd115('0x37')]?_0xd16d7c[_0xd115('0x35')]:_0x43f56c[_0xd115('0x32')];if(!_0x27f035['query'][_0xd115('0x38')](_0xd115('0x39'))){_0xd16d7c[_0xd115('0x1d')]=qs[_0xd115('0x1d')](_0x27f035[_0xd115('0x33')][_0xd115('0x1d')]);_0xd16d7c[_0xd115('0x1b')]=qs[_0xd115('0x1b')](_0x27f035[_0xd115('0x33')]['offset']);}_0xd16d7c['order']=qs[_0xd115('0x3a')](_0x27f035[_0xd115('0x33')][_0xd115('0x3a')]);_0xd16d7c[_0xd115('0x3b')]=qs['filters'](_[_0xd115('0x3c')](_0x27f035[_0xd115('0x33')],_0x43f56c['filters']),_0x500ee2);if(_0x27f035[_0xd115('0x33')][_0xd115('0x3d')]){_0xd16d7c[_0xd115('0x3b')]=_[_0xd115('0x3e')](_0xd16d7c[_0xd115('0x3b')],{'$or':_['map'](_0x500ee2,function(_0x225167){if(_0x225167[_0xd115('0x3f')]!==_0xd115('0x40')){var _0x34e3a2={};_0x34e3a2[_0x225167['name']]={'$like':'%'+_0x27f035[_0xd115('0x33')]['filter']+'%'};return _0x34e3a2;}})});}_0xd16d7c=_[_0xd115('0x3e')]({},_0xd16d7c,_0x27f035[_0xd115('0x41')]);var _0x26cdab={'where':_0xd16d7c[_0xd115('0x3b')]};return db[_0xd115('0x42')][_0xd115('0x1e')](_0x26cdab)[_0xd115('0x25')](function(_0x26158a){_0x39bf24[_0xd115('0x1e')]=_0x26158a;if(_0x27f035['query']['includeAll']){_0xd16d7c[_0xd115('0x43')]=[{'all':!![]}];}return db[_0xd115('0x42')]['findAll'](_0xd16d7c);})[_0xd115('0x25')](function(_0x59d378){_0x39bf24[_0xd115('0x44')]=_0x59d378;return _0x39bf24;})[_0xd115('0x25')](respondWithFilteredResult(_0x233edf,_0xd16d7c))[_0xd115('0x45')](handleError(_0x233edf,null));};exports['show']=function(_0x45aedb,_0x983c7b){var _0x1859df={'raw':![],'where':{'id':_0x45aedb[_0xd115('0x46')]['id']}},_0x432ffa={};_0x432ffa['model']=_['keys'](db[_0xd115('0x42')][_0xd115('0x30')]);_0x432ffa['query']=_[_0xd115('0x34')](_0x45aedb['query']);_0x432ffa[_0xd115('0x47')]=_[_0xd115('0x48')](_0x432ffa[_0xd115('0x32')],_0x432ffa[_0xd115('0x33')]);_0x1859df['attributes']=_['intersection'](_0x432ffa[_0xd115('0x32')],qs[_0xd115('0x36')](_0x45aedb[_0xd115('0x33')]['fields']));_0x1859df['attributes']=_0x1859df[_0xd115('0x35')]['length']?_0x1859df[_0xd115('0x35')]:_0x432ffa[_0xd115('0x32')];if(_0x45aedb['query']['includeAll']){_0x1859df[_0xd115('0x43')]=[{'all':!![]}];}_0x1859df=_[_0xd115('0x3e')]({},_0x1859df,_0x45aedb[_0xd115('0x41')]);return db[_0xd115('0x42')][_0xd115('0x49')](_0x1859df)['then'](handleEntityNotFound(_0x983c7b,null))[_0xd115('0x25')](respondWithResult(_0x983c7b,null))[_0xd115('0x45')](handleError(_0x983c7b,null));};exports[_0xd115('0x4a')]=function(_0x550e8f,_0x3a2638){return db[_0xd115('0x42')][_0xd115('0x4a')](_0x550e8f[_0xd115('0x4b')],{})[_0xd115('0x25')](function(_0x2803fd){var _0x3e2792=_0x550e8f['user'][_0xd115('0x4c')]({'plain':!![]});if(!_0x3e2792)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3e2792[_0xd115('0x4d')]===_0xd115('0x4e')){var _0x431919=_0x2803fd['get']({'plain':!![]});var _0x293c28='Triggers';return db[_0xd115('0x4f')]['find']({'where':{'name':_0x293c28,'userProfileId':_0x3e2792[_0xd115('0x50')]},'raw':!![]})[_0xd115('0x25')](function(_0x4472c0){if(_0x4472c0&&_0x4472c0[_0xd115('0x51')]===0x0){return db[_0xd115('0x28')]['create']({'name':_0x431919['name'],'resourceId':_0x431919['id'],'type':_0x4472c0[_0xd115('0x2c')],'sectionId':_0x4472c0['id']},{})[_0xd115('0x25')](function(){return _0x2803fd;});}else{return _0x2803fd;}})[_0xd115('0x45')](function(_0x117409){logger['error'](_0xd115('0x52'),_0x117409);throw _0x117409;});}return _0x2803fd;})[_0xd115('0x25')](respondWithResult(_0x3a2638,0xc9))[_0xd115('0x45')](handleError(_0x3a2638,null));};exports[_0xd115('0x24')]=function(_0x4ca477,_0x28402c){if(_0x4ca477[_0xd115('0x4b')]['id']){delete _0x4ca477[_0xd115('0x4b')]['id'];}return db['Trigger'][_0xd115('0x49')]({'where':{'id':_0x4ca477[_0xd115('0x46')]['id']}})[_0xd115('0x25')](handleEntityNotFound(_0x28402c,null))[_0xd115('0x25')](saveUpdates(_0x4ca477[_0xd115('0x4b')],null))[_0xd115('0x25')](respondWithResult(_0x28402c,null))['catch'](handleError(_0x28402c,null));};exports[_0xd115('0x26')]=function(_0x43e510,_0x173df6){return db[_0xd115('0x42')][_0xd115('0x49')]({'where':{'id':_0x43e510[_0xd115('0x46')]['id']}})[_0xd115('0x25')](handleEntityNotFound(_0x173df6,null))['then'](removeEntity(_0x173df6,null))[_0xd115('0x45')](handleError(_0x173df6,null));};exports[_0xd115('0x53')]=function(_0x2c39be,_0x41e73b,_0x2ab9a3){if(_0x2c39be[_0xd115('0x4b')]['id']){delete _0x2c39be[_0xd115('0x4b')]['id'];}return db['Trigger'][_0xd115('0x49')]({'where':{'id':_0x2c39be[_0xd115('0x46')]['id']}})[_0xd115('0x25')](handleEntityNotFound(_0x41e73b,null))[_0xd115('0x25')](function(_0x17a4e0){if(_0x17a4e0){_0x2c39be['body'][_0xd115('0x54')]=_0x17a4e0['id'];return db[_0xd115('0x55')][_0xd115('0x4a')](_0x2c39be[_0xd115('0x4b')]);}})[_0xd115('0x25')](respondWithResult(_0x41e73b,null))['catch'](handleError(_0x41e73b,null));};exports[_0xd115('0x56')]=function(_0x23d93f,_0x1c2246,_0x1edbf5){if(_0x23d93f[_0xd115('0x4b')]['id']){delete _0x23d93f[_0xd115('0x4b')]['id'];}return db['Trigger'][_0xd115('0x49')]({'where':{'id':_0x23d93f[_0xd115('0x46')]['id']}})[_0xd115('0x25')](handleEntityNotFound(_0x1c2246,null))['then'](function(_0x39b9f9){if(_0x39b9f9){_0x23d93f[_0xd115('0x4b')][_0xd115('0x57')]=_0x39b9f9['id'];return db[_0xd115('0x55')]['create'](_0x23d93f[_0xd115('0x4b')]);}})[_0xd115('0x25')](respondWithResult(_0x1c2246,null))[_0xd115('0x45')](handleError(_0x1c2246,null));};exports[_0xd115('0x58')]=function(_0x561c25,_0x16c4f4,_0x3481ef){var _0x5aaf7e={};var _0x2206ff={};var _0x26b873;var _0xecae6c;return db['Trigger'][_0xd115('0x59')]({'where':{'id':_0x561c25['params']['id']}})[_0xd115('0x25')](handleEntityNotFound(_0x16c4f4,null))[_0xd115('0x25')](function(_0x5a5b05){if(_0x5a5b05){_0x26b873=_0x5a5b05;_0x2206ff['model']=_[_0xd115('0x34')](db[_0xd115('0x55')]['rawAttributes']);_0x2206ff[_0xd115('0x33')]=_[_0xd115('0x34')](_0x561c25[_0xd115('0x33')]);_0x2206ff[_0xd115('0x47')]=_[_0xd115('0x48')](_0x2206ff[_0xd115('0x32')],_0x2206ff[_0xd115('0x33')]);_0x5aaf7e[_0xd115('0x35')]=_[_0xd115('0x48')](_0x2206ff['model'],qs[_0xd115('0x36')](_0x561c25['query'][_0xd115('0x36')]));_0x5aaf7e[_0xd115('0x35')]=_0x5aaf7e[_0xd115('0x35')][_0xd115('0x37')]?_0x5aaf7e[_0xd115('0x35')]:_0x2206ff[_0xd115('0x32')];_0x5aaf7e[_0xd115('0x5a')]=qs[_0xd115('0x3a')](_0x561c25[_0xd115('0x33')]['sort']);_0x5aaf7e[_0xd115('0x3b')]=qs['filters'](_[_0xd115('0x3c')](_0x561c25['query'],_0x2206ff[_0xd115('0x47')]));if(_0x561c25['query'][_0xd115('0x3d')]){_0x5aaf7e[_0xd115('0x3b')]=_[_0xd115('0x3e')](_0x5aaf7e['where'],{'$or':_['map'](_0x5aaf7e['attributes'],function(_0x18e1cb){var _0x832889={};_0x832889[_0x18e1cb]={'$like':'%'+_0x561c25[_0xd115('0x33')][_0xd115('0x3d')]+'%'};return _0x832889;})});}_0x5aaf7e=_[_0xd115('0x3e')]({},_0x5aaf7e,_0x561c25[_0xd115('0x41')]);return _0x26b873[_0xd115('0x58')](_0x5aaf7e);}})[_0xd115('0x25')](function(_0x25b6c0){if(_0x25b6c0){_0xecae6c=_0x25b6c0[_0xd115('0x37')];if(!_0x561c25['query'][_0xd115('0x38')](_0xd115('0x39'))){_0x5aaf7e[_0xd115('0x1d')]=qs['limit'](_0x561c25[_0xd115('0x33')]['limit']);_0x5aaf7e[_0xd115('0x1b')]=qs[_0xd115('0x1b')](_0x561c25[_0xd115('0x33')][_0xd115('0x1b')]);}return _0x26b873[_0xd115('0x58')](_0x5aaf7e);}})['then'](function(_0x599169){if(_0x599169){return _0x599169?{'count':_0xecae6c,'rows':_0x599169}:null;}})[_0xd115('0x25')](respondWithResult(_0x16c4f4,null))['catch'](handleError(_0x16c4f4,null));};exports[_0xd115('0x5b')]=function(_0x2480d4,_0x4c49ed,_0x4bdd8b){var _0xf57833={};var _0x19e87f={};var _0x2c35c2;var _0xc93d14;return db['Trigger'][_0xd115('0x59')]({'where':{'id':_0x2480d4['params']['id']}})['then'](handleEntityNotFound(_0x4c49ed,null))[_0xd115('0x25')](function(_0x53a8da){if(_0x53a8da){_0x2c35c2=_0x53a8da;_0x19e87f[_0xd115('0x32')]=_['keys'](db['Condition'][_0xd115('0x30')]);_0x19e87f['query']=_[_0xd115('0x34')](_0x2480d4[_0xd115('0x33')]);_0x19e87f['filters']=_['intersection'](_0x19e87f[_0xd115('0x32')],_0x19e87f[_0xd115('0x33')]);_0xf57833[_0xd115('0x35')]=_[_0xd115('0x48')](_0x19e87f[_0xd115('0x32')],qs[_0xd115('0x36')](_0x2480d4[_0xd115('0x33')]['fields']));_0xf57833[_0xd115('0x35')]=_0xf57833[_0xd115('0x35')][_0xd115('0x37')]?_0xf57833[_0xd115('0x35')]:_0x19e87f[_0xd115('0x32')];_0xf57833['order']=qs['sort'](_0x2480d4[_0xd115('0x33')][_0xd115('0x3a')]);_0xf57833[_0xd115('0x3b')]=qs['filters'](_[_0xd115('0x3c')](_0x2480d4['query'],_0x19e87f[_0xd115('0x47')]));if(_0x2480d4[_0xd115('0x33')]['filter']){_0xf57833[_0xd115('0x3b')]=_[_0xd115('0x3e')](_0xf57833[_0xd115('0x3b')],{'$or':_[_0xd115('0x2f')](_0xf57833['attributes'],function(_0x1e40e6){var _0x30b664={};_0x30b664[_0x1e40e6]={'$like':'%'+_0x2480d4['query']['filter']+'%'};return _0x30b664;})});}_0xf57833=_['merge']({},_0xf57833,_0x2480d4['options']);return _0x2c35c2['getAnyConditions'](_0xf57833);}})[_0xd115('0x25')](function(_0x486cf2){if(_0x486cf2){_0xc93d14=_0x486cf2[_0xd115('0x37')];if(!_0x2480d4[_0xd115('0x33')]['hasOwnProperty'](_0xd115('0x39'))){_0xf57833[_0xd115('0x1d')]=qs[_0xd115('0x1d')](_0x2480d4[_0xd115('0x33')][_0xd115('0x1d')]);_0xf57833[_0xd115('0x1b')]=qs['offset'](_0x2480d4[_0xd115('0x33')][_0xd115('0x1b')]);}return _0x2c35c2[_0xd115('0x5b')](_0xf57833);}})['then'](function(_0x4801db){if(_0x4801db){return _0x4801db?{'count':_0xc93d14,'rows':_0x4801db}:null;}})['then'](respondWithResult(_0x4c49ed,null))[_0xd115('0x45')](handleError(_0x4c49ed,null));};exports['addAction']=function(_0x396715,_0x25c62a,_0x40d75a){if(_0x396715['body']['id']){delete _0x396715[_0xd115('0x4b')]['id'];}return db[_0xd115('0x42')][_0xd115('0x49')]({'where':{'id':_0x396715[_0xd115('0x46')]['id']}})[_0xd115('0x25')](handleEntityNotFound(_0x25c62a,null))[_0xd115('0x25')](function(_0x119572){if(_0x119572){_0x396715[_0xd115('0x4b')]['TriggerId']=_0x119572['id'];return db[_0xd115('0x5c')][_0xd115('0x4a')](_0x396715[_0xd115('0x4b')]);}})['then'](respondWithResult(_0x25c62a,null))['catch'](handleError(_0x25c62a,null));};exports[_0xd115('0x5d')]=function(_0x4cd3f5,_0x1215b2,_0x2694f0){var _0x50f77f={};var _0x1819fe={};var _0x487c94;var _0x3e0b1d;return db[_0xd115('0x42')][_0xd115('0x59')]({'where':{'id':_0x4cd3f5[_0xd115('0x46')]['id']}})[_0xd115('0x25')](handleEntityNotFound(_0x1215b2,null))['then'](function(_0x4a9138){if(_0x4a9138){_0x487c94=_0x4a9138;_0x1819fe[_0xd115('0x32')]=_[_0xd115('0x34')](db[_0xd115('0x5c')][_0xd115('0x30')]);_0x1819fe[_0xd115('0x33')]=_[_0xd115('0x34')](_0x4cd3f5[_0xd115('0x33')]);_0x1819fe[_0xd115('0x47')]=_['intersection'](_0x1819fe[_0xd115('0x32')],_0x1819fe['query']);_0x50f77f['attributes']=_['intersection'](_0x1819fe[_0xd115('0x32')],qs[_0xd115('0x36')](_0x4cd3f5[_0xd115('0x33')]['fields']));_0x50f77f[_0xd115('0x35')]=_0x50f77f[_0xd115('0x35')]['length']?_0x50f77f[_0xd115('0x35')]:_0x1819fe[_0xd115('0x32')];_0x50f77f['order']=qs[_0xd115('0x3a')](_0x4cd3f5['query'][_0xd115('0x3a')]);_0x50f77f[_0xd115('0x3b')]=qs[_0xd115('0x47')](_['pick'](_0x4cd3f5['query'],_0x1819fe[_0xd115('0x47')]));if(_0x4cd3f5[_0xd115('0x33')][_0xd115('0x3d')]){_0x50f77f[_0xd115('0x3b')]=_[_0xd115('0x3e')](_0x50f77f[_0xd115('0x3b')],{'$or':_[_0xd115('0x2f')](_0x50f77f['attributes'],function(_0x46a257){var _0x1bff0f={};_0x1bff0f[_0x46a257]={'$like':'%'+_0x4cd3f5[_0xd115('0x33')][_0xd115('0x3d')]+'%'};return _0x1bff0f;})});}_0x50f77f=_[_0xd115('0x3e')]({},_0x50f77f,_0x4cd3f5[_0xd115('0x41')]);return _0x487c94[_0xd115('0x5d')](_0x50f77f);}})[_0xd115('0x25')](function(_0x46cd62){if(_0x46cd62){_0x3e0b1d=_0x46cd62[_0xd115('0x37')];if(!_0x4cd3f5[_0xd115('0x33')][_0xd115('0x38')]('nolimit')){_0x50f77f[_0xd115('0x1d')]=qs[_0xd115('0x1d')](_0x4cd3f5[_0xd115('0x33')]['limit']);_0x50f77f[_0xd115('0x1b')]=qs[_0xd115('0x1b')](_0x4cd3f5['query']['offset']);}return _0x487c94['getActions'](_0x50f77f);}})['then'](function(_0x1be533){if(_0x1be533){return _0x1be533?{'count':_0x3e0b1d,'rows':_0x1be533}:null;}})[_0xd115('0x25')](respondWithResult(_0x1215b2,null))[_0xd115('0x45')](handleError(_0x1215b2,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index 48a2ad1..a4dee5a 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 _0x1ee2=['../../config/logger','api','moment','request-promise','path','./trigger.attributes','exports','Trigger','tools_triggers','lodash','util'];(function(_0x415472,_0x1f1247){var _0x4efd85=function(_0x13b9c1){while(--_0x13b9c1){_0x415472['push'](_0x415472['shift']());}};_0x4efd85(++_0x1f1247);}(_0x1ee2,0x11c));var _0x21ee=function(_0x22ce5b,_0x24d8bc){_0x22ce5b=_0x22ce5b-0x0;var _0x47d23b=_0x1ee2[_0x22ce5b];return _0x47d23b;};'use strict';var _=require(_0x21ee('0x0'));var util=require(_0x21ee('0x1'));var logger=require(_0x21ee('0x2'))(_0x21ee('0x3'));var moment=require(_0x21ee('0x4'));var BPromise=require('bluebird');var rp=require(_0x21ee('0x5'));var fs=require('fs');var path=require(_0x21ee('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x21ee('0x7'));module[_0x21ee('0x8')]=function(_0x221a30,_0x20a492){return _0x221a30['define'](_0x21ee('0x9'),attributes,{'tableName':_0x21ee('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9009=['path','rimraf','./trigger.attributes','exports','define','Trigger','lodash','../../config/logger','api','bluebird','request-promise'];(function(_0x278634,_0x5d9dcf){var _0x47f237=function(_0x206d78){while(--_0x206d78){_0x278634['push'](_0x278634['shift']());}};_0x47f237(++_0x5d9dcf);}(_0x9009,0x1d4));var _0x9900=function(_0x5b47f7,_0x297b4f){_0x5b47f7=_0x5b47f7-0x0;var _0xae03a8=_0x9009[_0x5b47f7];return _0xae03a8;};'use strict';var _=require(_0x9900('0x0'));var util=require('util');var logger=require(_0x9900('0x1'))(_0x9900('0x2'));var moment=require('moment');var BPromise=require(_0x9900('0x3'));var rp=require(_0x9900('0x4'));var fs=require('fs');var path=require(_0x9900('0x5'));var rimraf=require(_0x9900('0x6'));var config=require('../../config/environment');var attributes=require(_0x9900('0x7'));module[_0x9900('0x8')]=function(_0x502dac,_0x59dd25){return _0x502dac[_0x9900('0x9')](_0x9900('0xa'),attributes,{'tableName':'tools_triggers','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 1ee0df9..d2dfd52 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 _0xa886=['../../config/utils','../../config/logger','rpc','../../config/environment','http','info','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','Trigger,\x20%s,\x20%s','message','result','GetTrigger','Trigger','findAll','options','where','limit','include','model','attributes','map','catch','ShowTrigger','find','then','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x4913ea,_0x3b110d){var _0x5647ff=function(_0x1d63c){while(--_0x1d63c){_0x4913ea['push'](_0x4913ea['shift']());}};_0x5647ff(++_0x3b110d);}(_0xa886,0x17a));var _0x6a88=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xa886[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x6a88('0x0'));var util=require(_0x6a88('0x1'));var moment=require(_0x6a88('0x2'));var BPromise=require(_0x6a88('0x3'));var rs=require(_0x6a88('0x4'));var fs=require('fs');var Redis=require(_0x6a88('0x5'));var db=require(_0x6a88('0x6'))['db'];var utils=require(_0x6a88('0x7'));var logger=require(_0x6a88('0x8'))(_0x6a88('0x9'));var config=require(_0x6a88('0xa'));var jayson=require('jayson/promise');var client=jayson['client'][_0x6a88('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xad5c58,_0x4df698,_0x5b966a){return new BPromise(function(_0x23a383,_0x4b5050){return client['request'](_0xad5c58,_0x5b966a)['then'](function(_0x3b702d){logger[_0x6a88('0xc')]('Trigger,\x20%s,\x20%s',_0x4df698,_0x6a88('0xd'));logger[_0x6a88('0xe')](_0x6a88('0xf'),_0x4df698,_0x6a88('0xd'),JSON[_0x6a88('0x10')](_0x3b702d));if(_0x3b702d[_0x6a88('0x11')]){if(_0x3b702d['error']['code']===0x1f4){logger[_0x6a88('0x11')](_0x6a88('0x12'),_0x4df698,_0x3b702d[_0x6a88('0x11')]['message']);return _0x4b5050(_0x3b702d['error'][_0x6a88('0x13')]);}logger[_0x6a88('0x11')](_0x6a88('0x12'),_0x4df698,_0x3b702d[_0x6a88('0x11')]['message']);return _0x23a383(_0x3b702d[_0x6a88('0x11')][_0x6a88('0x13')]);}else{logger['info'](_0x6a88('0x12'),_0x4df698,_0x6a88('0xd'));_0x23a383(_0x3b702d[_0x6a88('0x14')]['message']);}})['catch'](function(_0x58af5e){logger[_0x6a88('0x11')](_0x6a88('0x12'),_0x4df698,_0x58af5e);_0x4b5050(_0x58af5e);});});}exports[_0x6a88('0x15')]=function(_0x476500){var _0x59166b=this;return new Promise(function(_0x472cc5,_0x4971af){return db[_0x6a88('0x16')][_0x6a88('0x17')]({'raw':_0x476500[_0x6a88('0x18')]?_0x476500[_0x6a88('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x476500[_0x6a88('0x18')]?_0x476500[_0x6a88('0x18')][_0x6a88('0x19')]||null:null,'attributes':_0x476500[_0x6a88('0x18')]?_0x476500[_0x6a88('0x18')]['attributes']||null:null,'limit':_0x476500[_0x6a88('0x18')]?_0x476500[_0x6a88('0x18')][_0x6a88('0x1a')]||null:null,'include':_0x476500[_0x6a88('0x18')]?_0x476500[_0x6a88('0x18')]['include']?_['map'](_0x476500[_0x6a88('0x18')][_0x6a88('0x1b')],function(_0x59a009){return{'model':db[_0x59a009[_0x6a88('0x1c')]],'as':_0x59a009['as'],'attributes':_0x59a009[_0x6a88('0x1d')],'include':_0x59a009[_0x6a88('0x1b')]?_[_0x6a88('0x1e')](_0x59a009[_0x6a88('0x1b')],function(_0x592bcc){return{'model':db[_0x592bcc['model']],'as':_0x592bcc['as'],'attributes':_0x592bcc[_0x6a88('0x1d')],'include':_0x592bcc['include']?_[_0x6a88('0x1e')](_0x592bcc[_0x6a88('0x1b')],function(_0x1d61ab){return{'model':db[_0x1d61ab[_0x6a88('0x1c')]],'as':_0x1d61ab['as'],'attributes':_0x1d61ab[_0x6a88('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4b624d){logger[_0x6a88('0xc')](_0x6a88('0x15'),_0x476500);logger[_0x6a88('0xe')](_0x6a88('0x15'),_0x476500,JSON['stringify'](_0x4b624d));_0x472cc5(_0x4b624d);})[_0x6a88('0x1f')](function(_0x57dae0){logger[_0x6a88('0x11')](_0x6a88('0x15'),_0x57dae0['message'],_0x476500);_0x4971af(_0x59166b[_0x6a88('0x11')](0x1f4,_0x57dae0['message']));});});};exports[_0x6a88('0x20')]=function(_0x2d91c3){var _0x15a10b=this;return new Promise(function(_0x361fb8,_0x27756a){return db[_0x6a88('0x16')][_0x6a88('0x21')]({'raw':_0x2d91c3['options']?_0x2d91c3[_0x6a88('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x2d91c3[_0x6a88('0x18')]?_0x2d91c3[_0x6a88('0x18')]['where']||null:null,'attributes':_0x2d91c3[_0x6a88('0x18')]?_0x2d91c3[_0x6a88('0x18')][_0x6a88('0x1d')]||null:null,'include':_0x2d91c3[_0x6a88('0x18')]?_0x2d91c3[_0x6a88('0x18')][_0x6a88('0x1b')]?_[_0x6a88('0x1e')](_0x2d91c3[_0x6a88('0x18')][_0x6a88('0x1b')],function(_0x887ec6){return{'model':db[_0x887ec6['model']],'as':_0x887ec6['as'],'attributes':_0x887ec6['attributes'],'include':_0x887ec6[_0x6a88('0x1b')]?_[_0x6a88('0x1e')](_0x887ec6[_0x6a88('0x1b')],function(_0x2a1f2a){return{'model':db[_0x2a1f2a[_0x6a88('0x1c')]],'as':_0x2a1f2a['as'],'attributes':_0x2a1f2a[_0x6a88('0x1d')],'include':_0x2a1f2a[_0x6a88('0x1b')]?_[_0x6a88('0x1e')](_0x2a1f2a[_0x6a88('0x1b')],function(_0x3d4e7b){return{'model':db[_0x3d4e7b[_0x6a88('0x1c')]],'as':_0x3d4e7b['as'],'attributes':_0x3d4e7b[_0x6a88('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x6a88('0x22')](function(_0x430c36){logger['info'](_0x6a88('0x20'),_0x2d91c3);logger[_0x6a88('0xe')](_0x6a88('0x20'),_0x2d91c3,JSON[_0x6a88('0x10')](_0x430c36));_0x361fb8(_0x430c36);})['catch'](function(_0x2441ab){logger['error'](_0x6a88('0x20'),_0x2441ab[_0x6a88('0x13')],_0x2d91c3);_0x27756a(_0x15a10b[_0x6a88('0x11')](0x1f4,_0x2441ab[_0x6a88('0x13')]));});});}; \ No newline at end of file +var _0x1335=['map','model','Trigger','ShowTrigger','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','then','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','code','Trigger,\x20%s,\x20%s','message','info','result','catch','GetTrigger','findAll','options','raw','where','attributes','limit','include'];(function(_0x1dbb99,_0x24a0db){var _0x557b00=function(_0xd82190){while(--_0xd82190){_0x1dbb99['push'](_0x1dbb99['shift']());}};_0x557b00(++_0x24a0db);}(_0x1335,0x1f3));var _0x5133=function(_0x4fae95,_0x5b4296){_0x4fae95=_0x4fae95-0x0;var _0x1fac97=_0x1335[_0x4fae95];return _0x1fac97;};'use strict';var _=require('lodash');var util=require(_0x5133('0x0'));var moment=require(_0x5133('0x1'));var BPromise=require('bluebird');var rs=require(_0x5133('0x2'));var fs=require('fs');var Redis=require(_0x5133('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5133('0x4'));var logger=require(_0x5133('0x5'))(_0x5133('0x6'));var config=require(_0x5133('0x7'));var jayson=require(_0x5133('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x6ec7c7,_0x367102,_0x3cdf92){return new BPromise(function(_0x2653a5,_0x317a4a){return client['request'](_0x6ec7c7,_0x3cdf92)[_0x5133('0x9')](function(_0x2bcc56){logger['info']('Trigger,\x20%s,\x20%s',_0x367102,_0x5133('0xa'));logger[_0x5133('0xb')](_0x5133('0xc'),_0x367102,_0x5133('0xa'),JSON[_0x5133('0xd')](_0x2bcc56));if(_0x2bcc56[_0x5133('0xe')]){if(_0x2bcc56['error'][_0x5133('0xf')]===0x1f4){logger[_0x5133('0xe')](_0x5133('0x10'),_0x367102,_0x2bcc56[_0x5133('0xe')][_0x5133('0x11')]);return _0x317a4a(_0x2bcc56[_0x5133('0xe')][_0x5133('0x11')]);}logger['error'](_0x5133('0x10'),_0x367102,_0x2bcc56[_0x5133('0xe')][_0x5133('0x11')]);return _0x2653a5(_0x2bcc56['error'][_0x5133('0x11')]);}else{logger[_0x5133('0x12')](_0x5133('0x10'),_0x367102,_0x5133('0xa'));_0x2653a5(_0x2bcc56[_0x5133('0x13')]['message']);}})[_0x5133('0x14')](function(_0x42343d){logger[_0x5133('0xe')](_0x5133('0x10'),_0x367102,_0x42343d);_0x317a4a(_0x42343d);});});}exports[_0x5133('0x15')]=function(_0x84811){var _0x5ad4f3=this;return new Promise(function(_0x2af041,_0xc1a004){return db['Trigger'][_0x5133('0x16')]({'raw':_0x84811['options']?_0x84811[_0x5133('0x17')][_0x5133('0x18')]===undefined?!![]:![]:!![],'where':_0x84811['options']?_0x84811['options'][_0x5133('0x19')]||null:null,'attributes':_0x84811[_0x5133('0x17')]?_0x84811[_0x5133('0x17')][_0x5133('0x1a')]||null:null,'limit':_0x84811[_0x5133('0x17')]?_0x84811[_0x5133('0x17')][_0x5133('0x1b')]||null:null,'include':_0x84811[_0x5133('0x17')]?_0x84811['options'][_0x5133('0x1c')]?_[_0x5133('0x1d')](_0x84811[_0x5133('0x17')][_0x5133('0x1c')],function(_0x311875){return{'model':db[_0x311875[_0x5133('0x1e')]],'as':_0x311875['as'],'attributes':_0x311875['attributes'],'include':_0x311875['include']?_['map'](_0x311875[_0x5133('0x1c')],function(_0x15cbba){return{'model':db[_0x15cbba['model']],'as':_0x15cbba['as'],'attributes':_0x15cbba[_0x5133('0x1a')],'include':_0x15cbba['include']?_['map'](_0x15cbba[_0x5133('0x1c')],function(_0x22b31e){return{'model':db[_0x22b31e['model']],'as':_0x22b31e['as'],'attributes':_0x22b31e['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x49a56a){logger['info'](_0x5133('0x15'),_0x84811);logger[_0x5133('0xb')](_0x5133('0x15'),_0x84811,JSON['stringify'](_0x49a56a));_0x2af041(_0x49a56a);})['catch'](function(_0x239946){logger[_0x5133('0xe')](_0x5133('0x15'),_0x239946[_0x5133('0x11')],_0x84811);_0xc1a004(_0x5ad4f3[_0x5133('0xe')](0x1f4,_0x239946[_0x5133('0x11')]));});});};exports['ShowTrigger']=function(_0x4d5ad6){var _0x136c89=this;return new Promise(function(_0x105c52,_0x456c18){return db[_0x5133('0x1f')]['find']({'raw':_0x4d5ad6[_0x5133('0x17')]?_0x4d5ad6[_0x5133('0x17')][_0x5133('0x18')]===undefined?!![]:![]:!![],'where':_0x4d5ad6['options']?_0x4d5ad6['options'][_0x5133('0x19')]||null:null,'attributes':_0x4d5ad6[_0x5133('0x17')]?_0x4d5ad6[_0x5133('0x17')][_0x5133('0x1a')]||null:null,'include':_0x4d5ad6['options']?_0x4d5ad6[_0x5133('0x17')][_0x5133('0x1c')]?_[_0x5133('0x1d')](_0x4d5ad6['options'][_0x5133('0x1c')],function(_0x33ce7f){return{'model':db[_0x33ce7f['model']],'as':_0x33ce7f['as'],'attributes':_0x33ce7f['attributes'],'include':_0x33ce7f[_0x5133('0x1c')]?_[_0x5133('0x1d')](_0x33ce7f[_0x5133('0x1c')],function(_0x52d34c){return{'model':db[_0x52d34c['model']],'as':_0x52d34c['as'],'attributes':_0x52d34c[_0x5133('0x1a')],'include':_0x52d34c['include']?_[_0x5133('0x1d')](_0x52d34c[_0x5133('0x1c')],function(_0x153846){return{'model':db[_0x153846['model']],'as':_0x153846['as'],'attributes':_0x153846[_0x5133('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x45ae26){logger[_0x5133('0x12')](_0x5133('0x20'),_0x4d5ad6);logger[_0x5133('0xb')](_0x5133('0x20'),_0x4d5ad6,JSON[_0x5133('0xd')](_0x45ae26));_0x105c52(_0x45ae26);})[_0x5133('0x14')](function(_0x425f8b){logger['error'](_0x5133('0x20'),_0x425f8b[_0x5133('0x11')],_0x4d5ad6);_0x456c18(_0x136c89[_0x5133('0xe')](0x1f4,_0x425f8b[_0x5133('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index 77618e1..2390eb1 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 _0x2820=['clone','put','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./trunk.controller','get','isAuthenticated','index','/:id','show','post'];(function(_0x438285,_0x485065){var _0x63b8eb=function(_0x1b1d00){while(--_0x1b1d00){_0x438285['push'](_0x438285['shift']());}};_0x63b8eb(++_0x485065);}(_0x2820,0x134));var _0x0282=function(_0x2c688d,_0x30e396){_0x2c688d=_0x2c688d-0x0;var _0x15527e=_0x2820[_0x2c688d];return _0x15527e;};'use strict';var multer=require(_0x0282('0x0'));var util=require(_0x0282('0x1'));var path=require('path');var timeout=require(_0x0282('0x2'));var express=require(_0x0282('0x3'));var router=express[_0x0282('0x4')]();var fs_extra=require(_0x0282('0x5'));var auth=require(_0x0282('0x6'));var interaction=require(_0x0282('0x7'));var config=require('../../config/environment');var controller=require(_0x0282('0x8'));router[_0x0282('0x9')]('/',auth[_0x0282('0xa')](),controller[_0x0282('0xb')]);router[_0x0282('0x9')](_0x0282('0xc'),auth[_0x0282('0xa')](),controller[_0x0282('0xd')]);router[_0x0282('0xe')]('/:id/clone',auth[_0x0282('0xa')](),controller[_0x0282('0xf')]);router['post']('/',auth[_0x0282('0xa')](),controller['create']);router[_0x0282('0x10')](_0x0282('0xc'),auth[_0x0282('0xa')](),controller['update']);router[_0x0282('0x11')]('/:id',auth[_0x0282('0xa')](),controller['destroy']);module[_0x0282('0x12')]=router; \ No newline at end of file +var _0xfb35=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./trunk.controller','get','isAuthenticated','index','/:id','post','/:id/clone','clone','create','put','update','delete','destroy','exports','multer','util','path'];(function(_0x5a7b40,_0x585230){var _0x463559=function(_0x280fe4){while(--_0x280fe4){_0x5a7b40['push'](_0x5a7b40['shift']());}};_0x463559(++_0x585230);}(_0xfb35,0x177));var _0x5fb3=function(_0x1b6186,_0x1ec7f2){_0x1b6186=_0x1b6186-0x0;var _0x186121=_0xfb35[_0x1b6186];return _0x186121;};'use strict';var multer=require(_0x5fb3('0x0'));var util=require(_0x5fb3('0x1'));var path=require(_0x5fb3('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x5fb3('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x5fb3('0x4'));var interaction=require(_0x5fb3('0x5'));var config=require(_0x5fb3('0x6'));var controller=require(_0x5fb3('0x7'));router[_0x5fb3('0x8')]('/',auth[_0x5fb3('0x9')](),controller[_0x5fb3('0xa')]);router[_0x5fb3('0x8')](_0x5fb3('0xb'),auth[_0x5fb3('0x9')](),controller['show']);router[_0x5fb3('0xc')](_0x5fb3('0xd'),auth[_0x5fb3('0x9')](),controller[_0x5fb3('0xe')]);router[_0x5fb3('0xc')]('/',auth[_0x5fb3('0x9')](),controller[_0x5fb3('0xf')]);router[_0x5fb3('0x10')](_0x5fb3('0xb'),auth['isAuthenticated'](),controller[_0x5fb3('0x11')]);router[_0x5fb3('0x12')](_0x5fb3('0xb'),auth[_0x5fb3('0x9')](),controller[_0x5fb3('0x13')]);module[_0x5fb3('0x14')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index 8038af5..305e20c 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 _0xe1fe=['allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','INTEGER','\x22\x22\x20<>','always','accept','refuse','originate','uac','uas','fingerprint','certificate','passive','actpass','dynamic','update,nonat','BOOLEAN','sequelize','friend','user','STRING','ENUM','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','transport','join','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','nonat','update','outgoing','yes','force_rport,comedia','setDataValue','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all'];(function(_0xbebf50,_0x44ec09){var _0xce1496=function(_0x1bf94d){while(--_0x1bf94d){_0xbebf50['push'](_0xbebf50['shift']());}};_0xce1496(++_0x44ec09);}(_0xe1fe,0x114));var _0xee1f=function(_0x3aacfc,_0x77bc8b){_0x3aacfc=_0x3aacfc-0x0;var _0x197cf5=_0xe1fe[_0x3aacfc];return _0x197cf5;};'use strict';var Sequelize=require(_0xee1f('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0xee1f('0x1'),_0xee1f('0x2'),'peer'),'allowNull':![],'defaultValue':_0xee1f('0x1')},'context':{'type':Sequelize[_0xee1f('0x3')],'allowNull':![],'defaultValue':'from-voip-provider'},'callingpres':{'type':Sequelize[_0xee1f('0x4')](_0xee1f('0x5'),_0xee1f('0x6'),_0xee1f('0x7'),_0xee1f('0x8'),'PROHIB_NOT_SCREENED',_0xee1f('0x9'),_0xee1f('0xa'),'PROHIB')},'deny':{'type':Sequelize[_0xee1f('0x3')]},'permit':{'type':Sequelize[_0xee1f('0x3')]},'secret':{'type':Sequelize[_0xee1f('0x3')]},'md5secret':{'type':Sequelize[_0xee1f('0x3')]},'remotesecret':{'type':Sequelize[_0xee1f('0x3')]},'transport':{'type':Sequelize[_0xee1f('0x3')],'defaultValue':'udp','set':function(_0x3299c1){this['setDataValue'](_0xee1f('0xb'),_0x3299c1?_0x3299c1[_0xee1f('0xc')](','):null);},'get':function(){return this[_0xee1f('0xd')](_0xee1f('0xb'))?this['getDataValue'](_0xee1f('0xb'))[_0xee1f('0xe')](','):null;},'comment':_0xee1f('0xf')},'dtmfmode':{'type':Sequelize[_0xee1f('0x4')](_0xee1f('0x10'),_0xee1f('0x11'),_0xee1f('0x12'),_0xee1f('0x13'),_0xee1f('0x14')),'defaultValue':_0xee1f('0x10')},'directmedia':{'type':Sequelize[_0xee1f('0x4')]('yes','no',_0xee1f('0x15'),_0xee1f('0x16'),_0xee1f('0x17')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xee1f('0x4')](_0xee1f('0x18'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xee1f('0x3')]},'directmediadeny':{'type':Sequelize[_0xee1f('0x3')]},'nat':{'type':Sequelize[_0xee1f('0x3')],'defaultValue':_0xee1f('0x19'),'set':function(_0x37eef1){this[_0xee1f('0x1a')]('nat',_0x37eef1?_0x37eef1[_0xee1f('0xc')](','):null);},'get':function(){return this['getDataValue'](_0xee1f('0x1b'))?this['getDataValue'](_0xee1f('0x1b'))[_0xee1f('0xe')](','):null;},'comment':_0xee1f('0x1c')},'callgroup':{'type':Sequelize[_0xee1f('0x3')]},'namedcallgroup':{'type':Sequelize[_0xee1f('0x3')]},'pickupgroup':{'type':Sequelize[_0xee1f('0x3')]},'namedpickupgroup':{'type':Sequelize[_0xee1f('0x3')]},'language':{'type':Sequelize[_0xee1f('0x3')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xee1f('0x3')],'allowNull':!![]},'disallow':{'type':Sequelize[_0xee1f('0x3')],'defaultValue':_0xee1f('0x1d')},'allow':{'type':Sequelize[_0xee1f('0x3')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x538845){this['setDataValue']('allow',_0x538845?_0x538845[_0xee1f('0xc')](';'):'ulaw;alaw;gsm');},'get':function(){return this[_0xee1f('0xd')]('allow')?this[_0xee1f('0xd')](_0xee1f('0x1e'))[_0xee1f('0xe')](';'):null;},'comment':_0xee1f('0x1f')},'autoframing':{'type':Sequelize[_0xee1f('0x4')](_0xee1f('0x18'),'no')},'insecure':{'type':Sequelize[_0xee1f('0x3')],'defaultValue':_0xee1f('0x20'),'set':function(_0x12b8a2){this[_0xee1f('0x1a')](_0xee1f('0x21'),_0x12b8a2?_0x12b8a2[_0xee1f('0xc')](','):null);},'get':function(){return this[_0xee1f('0xd')]('insecure')?this['getDataValue'](_0xee1f('0x21'))[_0xee1f('0xe')](','):null;},'comment':_0xee1f('0x22')},'trustrpid':{'type':Sequelize[_0xee1f('0x4')](_0xee1f('0x18'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xee1f('0x4')](_0xee1f('0x18'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM'](_0xee1f('0x18'),'no',_0xee1f('0x23'))},'promiscredir':{'type':Sequelize[_0xee1f('0x4')](_0xee1f('0x18'),'no')},'useclientcode':{'type':Sequelize['ENUM'](_0xee1f('0x18'),'no')},'accountcode':{'type':Sequelize[_0xee1f('0x24')](0xb)},'setvar':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xee1f('0x3')],'defaultValue':_0xee1f('0x25')},'amaflags':{'type':Sequelize[_0xee1f('0x3')]},'callcounter':{'type':Sequelize[_0xee1f('0x4')]('yes','no'),'defaultValue':_0xee1f('0x18')},'busylevel':{'type':Sequelize[_0xee1f('0x24')](0xb)},'allowoverlap':{'type':Sequelize[_0xee1f('0x4')](_0xee1f('0x18'),'no')},'allowsubscribe':{'type':Sequelize[_0xee1f('0x4')](_0xee1f('0x18'),'no')},'allowtransfer':{'type':Sequelize[_0xee1f('0x4')](_0xee1f('0x18'),'no')},'ignoresdpversion':{'type':Sequelize[_0xee1f('0x4')](_0xee1f('0x18'),'no')},'subscribecontext':{'type':Sequelize[_0xee1f('0x3')]},'template':{'type':Sequelize[_0xee1f('0x3')]},'videosupport':{'type':Sequelize[_0xee1f('0x4')](_0xee1f('0x18'),'no',_0xee1f('0x26')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xee1f('0x24')](0xb)},'rfc2833compensate':{'type':Sequelize['ENUM'](_0xee1f('0x18'),'no')},'mailbox':{'type':Sequelize[_0xee1f('0x3')]},'session_timers':{'type':Sequelize[_0xee1f('0x4')](_0xee1f('0x27'),_0xee1f('0x28'),_0xee1f('0x29'))},'session_expires':{'type':Sequelize['INTEGER'](0xb)},'session_minse':{'type':Sequelize['INTEGER'](0xb)},'session_refresher':{'type':Sequelize['ENUM'](_0xee1f('0x2a'),_0xee1f('0x2b')),'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize['STRING']},'regexten':{'type':Sequelize['STRING']},'fromdomain':{'type':Sequelize[_0xee1f('0x3')]},'fromuser':{'type':Sequelize[_0xee1f('0x3')]},'port':{'type':Sequelize[_0xee1f('0x24')](0x5)},'qualify':{'type':Sequelize['ENUM'](_0xee1f('0x18'),'no'),'defaultValue':_0xee1f('0x18')},'keepalive':{'type':Sequelize['INTEGER'](0xb)},'defaultip':{'type':Sequelize[_0xee1f('0x3')]},'defaultuser':{'type':Sequelize[_0xee1f('0x3')]},'rtptimeout':{'type':Sequelize[_0xee1f('0x24')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0xee1f('0x24')](0xb)},'rtpkeepalive':{'type':Sequelize[_0xee1f('0x24')](0xb)},'sendrpid':{'type':Sequelize[_0xee1f('0x4')](_0xee1f('0x18'),'no','pai'),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xee1f('0x3')]},'callbackextension':{'type':Sequelize[_0xee1f('0x3')]},'timert1':{'type':Sequelize[_0xee1f('0x24')](0xb)},'timerb':{'type':Sequelize['INTEGER'](0xb)},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb)},'contactpermit':{'type':Sequelize[_0xee1f('0x3')]},'contactdeny':{'type':Sequelize[_0xee1f('0x3')]},'contactacl':{'type':Sequelize[_0xee1f('0x3')]},'unsolicited_mailbox':{'type':Sequelize[_0xee1f('0x3')]},'use_q850_reason':{'type':Sequelize[_0xee1f('0x3')]},'maxforwards':{'type':Sequelize['INTEGER'](0xb)},'encryption':{'type':Sequelize[_0xee1f('0x4')](_0xee1f('0x18'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0xee1f('0x18'),'no')},'force_avp':{'type':Sequelize[_0xee1f('0x4')](_0xee1f('0x18'),'no')},'icesupport':{'type':Sequelize[_0xee1f('0x4')](_0xee1f('0x18'),'no')},'dtlsenable':{'type':Sequelize[_0xee1f('0x4')](_0xee1f('0x18'),'no')},'dtlsverify':{'type':Sequelize[_0xee1f('0x4')](_0xee1f('0x18'),'no',_0xee1f('0x2c'),_0xee1f('0x2d'))},'dtlsrekey':{'type':Sequelize[_0xee1f('0x24')](0xb)},'dtlscertfile':{'type':Sequelize[_0xee1f('0x3')]},'dtlsprivatekey':{'type':Sequelize[_0xee1f('0x3')]},'dtlscipher':{'type':Sequelize[_0xee1f('0x3')]},'dtlscafile':{'type':Sequelize[_0xee1f('0x3')]},'dtlscapath':{'type':Sequelize['STRING']},'dtlssetup':{'type':Sequelize['ENUM']('active',_0xee1f('0x2e'),_0xee1f('0x2f')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xee1f('0x3')]},'usereqphone':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xee1f('0x3')]},'recordofffeature':{'type':Sequelize[_0xee1f('0x3')]},'call_limit':{'type':Sequelize[_0xee1f('0x24')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0xee1f('0x4')](_0xee1f('0x18'),'no')},'subscribemwi':{'type':Sequelize[_0xee1f('0x4')](_0xee1f('0x18'),'no')},'vmexten':{'type':Sequelize['STRING']},'mohinterpret':{'type':Sequelize[_0xee1f('0x3')]},'mohsuggest':{'type':Sequelize[_0xee1f('0x3')]},'parkinglot':{'type':Sequelize[_0xee1f('0x3')]},'description':{'type':Sequelize[_0xee1f('0x3')]},'host':{'type':Sequelize[_0xee1f('0x3')],'defaultValue':_0xee1f('0x30')},'canreinvite':{'type':Sequelize['ENUM'](_0xee1f('0x18'),'no',_0xee1f('0x15'),_0xee1f('0x16'),_0xee1f('0x31')),'defaultValue':'no'},'registry':{'type':Sequelize[_0xee1f('0x3')]},'otherFields':{'type':Sequelize[_0xee1f('0x3')]},'active':{'type':Sequelize[_0xee1f('0x32')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0xee1f('0x3')],'defaultValue':'no'}}; \ No newline at end of file +var _0xc69d=['passive','dynamic','update,nonat','sequelize','STRING','name','ENUM','friend','user','peer','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','setDataValue','transport','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','shortinfo','yes','nonat','update','force_rport,comedia','nat','join','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>','INTEGER','always','accept','originate','uac','uas','pai','fingerprint','certificate'];(function(_0x4cf765,_0xc7a6bf){var _0x473760=function(_0x2d501d){while(--_0x2d501d){_0x4cf765['push'](_0x4cf765['shift']());}};_0x473760(++_0xc7a6bf);}(_0xc69d,0x1bc));var _0xdc69=function(_0x2d8f6c,_0x44db4c){_0x2d8f6c=_0x2d8f6c-0x0;var _0x3a00f6=_0xc69d[_0x2d8f6c];return _0x3a00f6;};'use strict';var Sequelize=require(_0xdc69('0x0'));module['exports']={'name':{'type':Sequelize[_0xdc69('0x1')],'allowNull':![],'unique':_0xdc69('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xdc69('0x3')](_0xdc69('0x4'),_0xdc69('0x5'),_0xdc69('0x6')),'allowNull':![],'defaultValue':_0xdc69('0x4')},'context':{'type':Sequelize[_0xdc69('0x1')],'allowNull':![],'defaultValue':_0xdc69('0x7')},'callingpres':{'type':Sequelize['ENUM'](_0xdc69('0x8'),_0xdc69('0x9'),'ALLOWED_FAILED_SCREEN','ALLOWED',_0xdc69('0xa'),_0xdc69('0xb'),_0xdc69('0xc'),_0xdc69('0xd'))},'deny':{'type':Sequelize[_0xdc69('0x1')]},'permit':{'type':Sequelize[_0xdc69('0x1')]},'secret':{'type':Sequelize[_0xdc69('0x1')]},'md5secret':{'type':Sequelize['STRING']},'remotesecret':{'type':Sequelize[_0xdc69('0x1')]},'transport':{'type':Sequelize[_0xdc69('0x1')],'defaultValue':_0xdc69('0xe'),'set':function(_0x1a26df){this[_0xdc69('0xf')](_0xdc69('0x10'),_0x1a26df?_0x1a26df['join'](','):null);},'get':function(){return this['getDataValue'](_0xdc69('0x10'))?this[_0xdc69('0x11')]('transport')[_0xdc69('0x12')](','):null;},'comment':_0xdc69('0x13')},'dtmfmode':{'type':Sequelize[_0xdc69('0x3')](_0xdc69('0x14'),'info',_0xdc69('0x15'),'inband','auto'),'defaultValue':_0xdc69('0x14')},'directmedia':{'type':Sequelize['ENUM'](_0xdc69('0x16'),'no',_0xdc69('0x17'),_0xdc69('0x18'),'outgoing'),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xdc69('0x3')]('yes','no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xdc69('0x1')]},'directmediadeny':{'type':Sequelize['STRING']},'nat':{'type':Sequelize[_0xdc69('0x1')],'defaultValue':_0xdc69('0x19'),'set':function(_0x1ce1c8){this[_0xdc69('0xf')](_0xdc69('0x1a'),_0x1ce1c8?_0x1ce1c8[_0xdc69('0x1b')](','):null);},'get':function(){return this[_0xdc69('0x11')](_0xdc69('0x1a'))?this['getDataValue'](_0xdc69('0x1a'))[_0xdc69('0x12')](','):null;},'comment':_0xdc69('0x1c')},'callgroup':{'type':Sequelize[_0xdc69('0x1')]},'namedcallgroup':{'type':Sequelize[_0xdc69('0x1')]},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0xdc69('0x1')]},'language':{'type':Sequelize[_0xdc69('0x1')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING'],'allowNull':!![]},'disallow':{'type':Sequelize['STRING'],'defaultValue':_0xdc69('0x1d')},'allow':{'type':Sequelize[_0xdc69('0x1')],'allowNull':![],'defaultValue':_0xdc69('0x1e'),'set':function(_0xcb55d){this['setDataValue']('allow',_0xcb55d?_0xcb55d[_0xdc69('0x1b')](';'):'ulaw;alaw;gsm');},'get':function(){return this['getDataValue'](_0xdc69('0x1f'))?this['getDataValue'](_0xdc69('0x1f'))[_0xdc69('0x12')](';'):null;},'comment':_0xdc69('0x20')},'autoframing':{'type':Sequelize['ENUM'](_0xdc69('0x16'),'no')},'insecure':{'type':Sequelize[_0xdc69('0x1')],'defaultValue':'port,invite','set':function(_0x5bc050){this[_0xdc69('0xf')](_0xdc69('0x21'),_0x5bc050?_0x5bc050['join'](','):null);},'get':function(){return this[_0xdc69('0x11')](_0xdc69('0x21'))?this[_0xdc69('0x11')](_0xdc69('0x21'))[_0xdc69('0x12')](','):null;},'comment':_0xdc69('0x22')},'trustrpid':{'type':Sequelize['ENUM'](_0xdc69('0x16'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xdc69('0x3')](_0xdc69('0x16'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xdc69('0x3')]('yes','no',_0xdc69('0x23'))},'promiscredir':{'type':Sequelize['ENUM']('yes','no')},'useclientcode':{'type':Sequelize[_0xdc69('0x3')](_0xdc69('0x16'),'no')},'accountcode':{'type':Sequelize['INTEGER'](0xb)},'setvar':{'type':Sequelize[_0xdc69('0x1')]},'callerid':{'type':Sequelize['STRING'],'defaultValue':_0xdc69('0x24')},'amaflags':{'type':Sequelize[_0xdc69('0x1')]},'callcounter':{'type':Sequelize[_0xdc69('0x3')](_0xdc69('0x16'),'no'),'defaultValue':_0xdc69('0x16')},'busylevel':{'type':Sequelize[_0xdc69('0x25')](0xb)},'allowoverlap':{'type':Sequelize[_0xdc69('0x3')](_0xdc69('0x16'),'no')},'allowsubscribe':{'type':Sequelize[_0xdc69('0x3')](_0xdc69('0x16'),'no')},'allowtransfer':{'type':Sequelize[_0xdc69('0x3')](_0xdc69('0x16'),'no')},'ignoresdpversion':{'type':Sequelize[_0xdc69('0x3')]('yes','no')},'subscribecontext':{'type':Sequelize[_0xdc69('0x1')]},'template':{'type':Sequelize[_0xdc69('0x1')]},'videosupport':{'type':Sequelize['ENUM'](_0xdc69('0x16'),'no',_0xdc69('0x26')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xdc69('0x25')](0xb)},'rfc2833compensate':{'type':Sequelize[_0xdc69('0x3')]('yes','no')},'mailbox':{'type':Sequelize[_0xdc69('0x1')]},'session_timers':{'type':Sequelize[_0xdc69('0x3')](_0xdc69('0x27'),'refuse',_0xdc69('0x28'))},'session_expires':{'type':Sequelize[_0xdc69('0x25')](0xb)},'session_minse':{'type':Sequelize[_0xdc69('0x25')](0xb)},'session_refresher':{'type':Sequelize['ENUM'](_0xdc69('0x29'),_0xdc69('0x2a')),'defaultValue':_0xdc69('0x2a')},'t38pt_usertpsource':{'type':Sequelize[_0xdc69('0x1')]},'regexten':{'type':Sequelize[_0xdc69('0x1')]},'fromdomain':{'type':Sequelize[_0xdc69('0x1')]},'fromuser':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0xdc69('0x25')](0x5)},'qualify':{'type':Sequelize['ENUM'](_0xdc69('0x16'),'no'),'defaultValue':_0xdc69('0x16')},'keepalive':{'type':Sequelize[_0xdc69('0x25')](0xb)},'defaultip':{'type':Sequelize[_0xdc69('0x1')]},'defaultuser':{'type':Sequelize[_0xdc69('0x1')]},'rtptimeout':{'type':Sequelize[_0xdc69('0x25')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0xdc69('0x25')](0xb)},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb)},'sendrpid':{'type':Sequelize[_0xdc69('0x3')]('yes','no',_0xdc69('0x2b')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xdc69('0x1')]},'callbackextension':{'type':Sequelize[_0xdc69('0x1')]},'timert1':{'type':Sequelize[_0xdc69('0x25')](0xb)},'timerb':{'type':Sequelize['INTEGER'](0xb)},'qualifyfreq':{'type':Sequelize[_0xdc69('0x25')](0xb)},'contactpermit':{'type':Sequelize['STRING']},'contactdeny':{'type':Sequelize[_0xdc69('0x1')]},'contactacl':{'type':Sequelize['STRING']},'unsolicited_mailbox':{'type':Sequelize[_0xdc69('0x1')]},'use_q850_reason':{'type':Sequelize[_0xdc69('0x1')]},'maxforwards':{'type':Sequelize[_0xdc69('0x25')](0xb)},'encryption':{'type':Sequelize['ENUM'](_0xdc69('0x16'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0xdc69('0x3')](_0xdc69('0x16'),'no')},'force_avp':{'type':Sequelize[_0xdc69('0x3')](_0xdc69('0x16'),'no')},'icesupport':{'type':Sequelize[_0xdc69('0x3')](_0xdc69('0x16'),'no')},'dtlsenable':{'type':Sequelize[_0xdc69('0x3')](_0xdc69('0x16'),'no')},'dtlsverify':{'type':Sequelize[_0xdc69('0x3')](_0xdc69('0x16'),'no',_0xdc69('0x2c'),_0xdc69('0x2d'))},'dtlsrekey':{'type':Sequelize[_0xdc69('0x25')](0xb)},'dtlscertfile':{'type':Sequelize['STRING']},'dtlsprivatekey':{'type':Sequelize[_0xdc69('0x1')]},'dtlscipher':{'type':Sequelize[_0xdc69('0x1')]},'dtlscafile':{'type':Sequelize[_0xdc69('0x1')]},'dtlscapath':{'type':Sequelize[_0xdc69('0x1')]},'dtlssetup':{'type':Sequelize[_0xdc69('0x3')]('active',_0xdc69('0x2e'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING']},'usereqphone':{'type':Sequelize['ENUM'](_0xdc69('0x16'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xdc69('0x1')]},'recordofffeature':{'type':Sequelize['STRING']},'call_limit':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize['ENUM']('yes','no')},'subscribemwi':{'type':Sequelize[_0xdc69('0x3')](_0xdc69('0x16'),'no')},'vmexten':{'type':Sequelize[_0xdc69('0x1')]},'mohinterpret':{'type':Sequelize['STRING']},'mohsuggest':{'type':Sequelize[_0xdc69('0x1')]},'parkinglot':{'type':Sequelize[_0xdc69('0x1')]},'description':{'type':Sequelize[_0xdc69('0x1')]},'host':{'type':Sequelize['STRING'],'defaultValue':_0xdc69('0x2f')},'canreinvite':{'type':Sequelize['ENUM']('yes','no',_0xdc69('0x17'),_0xdc69('0x18'),_0xdc69('0x30')),'defaultValue':'no'},'registry':{'type':Sequelize[_0xdc69('0x1')]},'otherFields':{'type':Sequelize['STRING']},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0xdc69('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 9557e3d..bd8e6fe 100644 --- a/server/api/trunk/trunk.controller.js +++ b/server/api/trunk/trunk.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6f0d=['server/files/templates/registry.ejs','utf8','render','writeFileSync','registry','Reload','chan_sip.so','user','UserProfileSection','autoAssociation','/etc/asterisk/sip_xcally_trunks.conf','/etc/asterisk/sip_xcally_registers.conf','destroy','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','jayson/promise','client','http','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','get','Trunks','UserProfileResource','end','stack','name','send','index','map','Trunk','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','clone','rawAttributes','find','updatedAt','body','omit','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','root','server/files/templates/trunk.ejs','join'];(function(_0xb925ca,_0x2f7fde){var _0x3c2c6f=function(_0x1589d1){while(--_0x1589d1){_0xb925ca['push'](_0xb925ca['shift']());}};_0x3c2c6f(++_0x2f7fde);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x3f5bb6,_0x43da3d){_0x3f5bb6=_0x3f5bb6-0x0;var _0x5538c8=_0x6f0d[_0x3f5bb6];return _0x5538c8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd6f0('0x0'));var zipdir=require(_0xd6f0('0x1'));var jsonpatch=require(_0xd6f0('0x2'));var rp=require(_0xd6f0('0x3'));var moment=require('moment');var BPromise=require(_0xd6f0('0x4'));var Mustache=require(_0xd6f0('0x5'));var util=require(_0xd6f0('0x6'));var path=require(_0xd6f0('0x7'));var sox=require(_0xd6f0('0x8'));var csv=require('to-csv');var ejs=require(_0xd6f0('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd6f0('0xa'));var squel=require(_0xd6f0('0xb'));var crypto=require(_0xd6f0('0xc'));var jsforce=require(_0xd6f0('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xd6f0('0xe'));var Papa=require(_0xd6f0('0xf'));var Redis=require(_0xd6f0('0x10'));var authService=require(_0xd6f0('0x11'));var qs=require(_0xd6f0('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd6f0('0x13'));var logger=require(_0xd6f0('0x14'))(_0xd6f0('0x15'));var utils=require(_0xd6f0('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xd6f0('0x17'));var db=require(_0xd6f0('0x18'))['db'];var jayson=require(_0xd6f0('0x19'));var client=jayson[_0xd6f0('0x1a')][_0xd6f0('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x409549,_0x2bf5b8,_0x250999,_0x246dad){return new BPromise(function(_0x4ab979,_0x2b3f32){var _0x354846=_0x246dad||client;return _0x354846['request'](_0x409549,_0x250999)[_0xd6f0('0x1c')](function(_0x593abe){logger[_0xd6f0('0x1d')](_0xd6f0('0x1e'),_0x2bf5b8,_0xd6f0('0x1f'));logger[_0xd6f0('0x20')](_0xd6f0('0x21'),_0x2bf5b8,_0xd6f0('0x1f'),JSON[_0xd6f0('0x22')](_0x593abe));if(_0x593abe[_0xd6f0('0x23')]){if(_0x593abe[_0xd6f0('0x23')][_0xd6f0('0x24')]===0x1f4){logger[_0xd6f0('0x23')](_0xd6f0('0x1e'),_0x2bf5b8,_0x593abe[_0xd6f0('0x23')][_0xd6f0('0x25')]);return _0x2b3f32(_0x593abe[_0xd6f0('0x23')][_0xd6f0('0x25')]);}logger['error']('Trunk,\x20%s,\x20%s',_0x2bf5b8,_0x593abe[_0xd6f0('0x23')][_0xd6f0('0x25')]);return _0x4ab979(_0x593abe[_0xd6f0('0x23')]['message']);}else{logger[_0xd6f0('0x1d')](_0xd6f0('0x1e'),_0x2bf5b8,'request\x20sent');_0x4ab979(_0x593abe[_0xd6f0('0x26')]['message']);}})[_0xd6f0('0x27')](function(_0x1c9d90){logger['error'](_0xd6f0('0x1e'),_0x2bf5b8,_0x1c9d90);_0x2b3f32(_0x1c9d90);});});}function respondWithStatusCode(_0x45e99c,_0x5ea2dd){_0x5ea2dd=_0x5ea2dd||0xcc;return function(_0x3dbdc3){if(_0x3dbdc3){return _0x45e99c[_0xd6f0('0x28')](_0x5ea2dd);}return _0x45e99c[_0xd6f0('0x29')](_0x5ea2dd)['end']();};}function respondWithResult(_0x2ca8bb,_0x3dc166){_0x3dc166=_0x3dc166||0xc8;return function(_0x5ecb16){if(_0x5ecb16){return _0x2ca8bb[_0xd6f0('0x29')](_0x3dc166)['json'](_0x5ecb16);}};}function respondWithFilteredResult(_0x2042d5,_0x3fb5c3){return function(_0x1630dc){if(_0x1630dc){var _0x3c1bff=typeof _0x3fb5c3[_0xd6f0('0x2a')]===_0xd6f0('0x2b')&&typeof _0x3fb5c3[_0xd6f0('0x2c')]===_0xd6f0('0x2b');var _0x48975d=_0x1630dc[_0xd6f0('0x2d')];var _0x1982d3=_0x3c1bff?0x0:_0x3fb5c3['offset'];var _0x38a3e9=_0x3c1bff?_0x1630dc[_0xd6f0('0x2d')]:_0x3fb5c3[_0xd6f0('0x2a')]+_0x3fb5c3[_0xd6f0('0x2c')];var _0x1a3967;if(_0x38a3e9>=_0x48975d){_0x38a3e9=_0x48975d;_0x1a3967=0xc8;}else{_0x1a3967=0xce;}_0x2042d5[_0xd6f0('0x29')](_0x1a3967);return _0x2042d5[_0xd6f0('0x2e')](_0xd6f0('0x2f'),_0x1982d3+'-'+_0x38a3e9+'/'+_0x48975d)[_0xd6f0('0x30')](_0x1630dc);}return null;};}function patchUpdates(_0x43f72f){return function(_0x1dff9b){try{jsonpatch[_0xd6f0('0x31')](_0x1dff9b,_0x43f72f,!![]);}catch(_0x348529){return BPromise[_0xd6f0('0x32')](_0x348529);}return _0x1dff9b[_0xd6f0('0x33')]();};}function saveUpdates(_0x2d7c90,_0x31c493){return function(_0x376890){if(_0x376890){return _0x376890[_0xd6f0('0x34')](_0x2d7c90)[_0xd6f0('0x1c')](function(_0x3906ca){return _0x3906ca;});}return null;};}function removeEntity(_0x26ab29,_0x4a8ebe){return function(_0x11124c){if(_0x11124c){return _0x11124c['destroy']()['then'](function(){var _0x43d588=_0x11124c[_0xd6f0('0x35')]({'plain':!![]});var _0x12a6fa=_0xd6f0('0x36');return db[_0xd6f0('0x37')]['destroy']({'where':{'type':_0x12a6fa,'resourceId':_0x43d588['id']}})[_0xd6f0('0x1c')](function(){return _0x11124c;});})['then'](function(){_0x26ab29[_0xd6f0('0x29')](0xcc)[_0xd6f0('0x38')]();});}};}function handleEntityNotFound(_0x42c01a,_0x1eecf0){return function(_0x518751){if(!_0x518751){_0x42c01a['sendStatus'](0x194);}return _0x518751;};}function handleError(_0x47b33d,_0x3b6463){_0x3b6463=_0x3b6463||0x1f4;return function(_0xe2958d){logger['error'](_0xe2958d[_0xd6f0('0x39')]);if(_0xe2958d['name']){delete _0xe2958d[_0xd6f0('0x3a')];}_0x47b33d[_0xd6f0('0x29')](_0x3b6463)[_0xd6f0('0x3b')](_0xe2958d);};}exports[_0xd6f0('0x3c')]=function(_0x451834,_0x3d1280){var _0x6b44fa={},_0x4fd4db={},_0x52203d={'count':0x0,'rows':[]};var _0x162537=_[_0xd6f0('0x3d')](db[_0xd6f0('0x3e')]['rawAttributes'],function(_0x59f905){return{'name':_0x59f905[_0xd6f0('0x3f')],'type':_0x59f905[_0xd6f0('0x40')][_0xd6f0('0x41')]};});_0x4fd4db[_0xd6f0('0x42')]=_[_0xd6f0('0x3d')](_0x162537,_0xd6f0('0x3a'));_0x4fd4db[_0xd6f0('0x43')]=_[_0xd6f0('0x44')](_0x451834['query']);_0x4fd4db[_0xd6f0('0x45')]=_[_0xd6f0('0x46')](_0x4fd4db[_0xd6f0('0x42')],_0x4fd4db[_0xd6f0('0x43')]);_0x6b44fa['attributes']=_[_0xd6f0('0x46')](_0x4fd4db[_0xd6f0('0x42')],qs[_0xd6f0('0x47')](_0x451834[_0xd6f0('0x43')][_0xd6f0('0x47')]));_0x6b44fa['attributes']=_0x6b44fa[_0xd6f0('0x48')][_0xd6f0('0x49')]?_0x6b44fa[_0xd6f0('0x48')]:_0x4fd4db['model'];if(!_0x451834[_0xd6f0('0x43')][_0xd6f0('0x4a')]('nolimit')){_0x6b44fa['limit']=qs[_0xd6f0('0x2c')](_0x451834[_0xd6f0('0x43')][_0xd6f0('0x2c')]);_0x6b44fa['offset']=qs[_0xd6f0('0x2a')](_0x451834[_0xd6f0('0x43')]['offset']);}_0x6b44fa[_0xd6f0('0x4b')]=qs[_0xd6f0('0x4c')](_0x451834[_0xd6f0('0x43')][_0xd6f0('0x4c')]);_0x6b44fa['where']=qs[_0xd6f0('0x45')](_[_0xd6f0('0x4d')](_0x451834[_0xd6f0('0x43')],_0x4fd4db[_0xd6f0('0x45')]),_0x162537);if(_0x451834[_0xd6f0('0x43')][_0xd6f0('0x4e')]){_0x6b44fa[_0xd6f0('0x4f')]=_[_0xd6f0('0x50')](_0x6b44fa['where'],{'$or':_[_0xd6f0('0x3d')](_0x162537,function(_0x3d42ca){if(_0x3d42ca['type']!==_0xd6f0('0x51')){var _0x39ca69={};_0x39ca69[_0x3d42ca[_0xd6f0('0x3a')]]={'$like':'%'+_0x451834[_0xd6f0('0x43')]['filter']+'%'};return _0x39ca69;}})});}_0x6b44fa=_[_0xd6f0('0x50')]({},_0x6b44fa,_0x451834[_0xd6f0('0x52')]);var _0x494542={'where':_0x6b44fa['where']};return db[_0xd6f0('0x3e')]['count'](_0x494542)[_0xd6f0('0x1c')](function(_0x61b354){_0x52203d[_0xd6f0('0x2d')]=_0x61b354;if(_0x451834['query'][_0xd6f0('0x53')]){_0x6b44fa[_0xd6f0('0x54')]=[{'all':!![]}];}return db[_0xd6f0('0x3e')][_0xd6f0('0x55')](_0x6b44fa);})[_0xd6f0('0x1c')](function(_0x4c42ce){_0x52203d[_0xd6f0('0x56')]=_0x4c42ce;return _0x52203d;})['then'](respondWithFilteredResult(_0x3d1280,_0x6b44fa))[_0xd6f0('0x27')](handleError(_0x3d1280,null));};exports[_0xd6f0('0x57')]=function(_0x2eb338,_0x1dc320){var _0x554e37={'raw':![],'where':{'id':_0x2eb338[_0xd6f0('0x58')]['id']}},_0x5ceb6b={};_0x5ceb6b[_0xd6f0('0x42')]=_['keys'](db[_0xd6f0('0x3e')]['rawAttributes']);_0x5ceb6b[_0xd6f0('0x43')]=_[_0xd6f0('0x44')](_0x2eb338[_0xd6f0('0x43')]);_0x5ceb6b[_0xd6f0('0x45')]=_[_0xd6f0('0x46')](_0x5ceb6b['model'],_0x5ceb6b[_0xd6f0('0x43')]);_0x554e37[_0xd6f0('0x48')]=_[_0xd6f0('0x46')](_0x5ceb6b[_0xd6f0('0x42')],qs[_0xd6f0('0x47')](_0x2eb338[_0xd6f0('0x43')][_0xd6f0('0x47')]));_0x554e37[_0xd6f0('0x48')]=_0x554e37['attributes'][_0xd6f0('0x49')]?_0x554e37[_0xd6f0('0x48')]:_0x5ceb6b[_0xd6f0('0x42')];if(_0x2eb338[_0xd6f0('0x43')][_0xd6f0('0x53')]){_0x554e37[_0xd6f0('0x54')]=[{'all':!![]}];}_0x554e37=_[_0xd6f0('0x50')]({},_0x554e37,_0x2eb338[_0xd6f0('0x52')]);return db[_0xd6f0('0x3e')]['find'](_0x554e37)[_0xd6f0('0x1c')](handleEntityNotFound(_0x1dc320,null))['then'](respondWithResult(_0x1dc320,null))['catch'](handleError(_0x1dc320,null));};exports[_0xd6f0('0x59')]=function(_0x55fd25,_0x539ef1){var _0x28c3c4={'where':{'id':_0x55fd25[_0xd6f0('0x58')]['id']}},_0x2d39a2={};_0x2d39a2['model']=_[_0xd6f0('0x44')](db[_0xd6f0('0x3e')][_0xd6f0('0x5a')]);_0x28c3c4['attributes']=_[_0xd6f0('0x46')](_0x2d39a2[_0xd6f0('0x42')],qs['fields'](_0x55fd25[_0xd6f0('0x43')][_0xd6f0('0x47')]));_0x28c3c4['attributes']=_0x28c3c4[_0xd6f0('0x48')][_0xd6f0('0x49')]?_0x28c3c4[_0xd6f0('0x48')]:_0x2d39a2[_0xd6f0('0x42')];if(_0x55fd25[_0xd6f0('0x43')]['includeAll']){_0x28c3c4[_0xd6f0('0x54')]=[{'all':!![]}];}_0x28c3c4=_[_0xd6f0('0x50')]({},_0x28c3c4,_0x55fd25['options']);return db[_0xd6f0('0x3e')][_0xd6f0('0x5b')](_0x28c3c4)[_0xd6f0('0x1c')](handleEntityNotFound(_0x539ef1,null))['then'](function(_0x229f19){if(_0x229f19){var _0x5d75fa=_0x229f19['get']({'plain':!![]});_0x5d75fa=qs['omit'](_0x5d75fa,['id','createdAt',_0xd6f0('0x5c')]);_0x55fd25[_0xd6f0('0x5d')]=_[_0xd6f0('0x5e')](_0x55fd25[_0xd6f0('0x5d')],['id','createdAt',_0xd6f0('0x5c')]);return db['Trunk'][_0xd6f0('0x5f')](_[_0xd6f0('0x50')](_0x5d75fa,_0x55fd25[_0xd6f0('0x5d')]),{'include':_0x55fd25['query'][_0xd6f0('0x53')]?[{'all':!![]}]:undefined})[_0xd6f0('0x1c')](function(_0x269dd7){var _0x705eb=_0x55fd25['user'][_0xd6f0('0x35')]({'plain':!![]});if(!_0x705eb)throw new Error(_0xd6f0('0x60'));if(_0x705eb[_0xd6f0('0x61')]==='user'){var _0x5bc4e7=_0x269dd7[_0xd6f0('0x35')]({'plain':!![]});var _0x1fee47=_0xd6f0('0x36');return db['UserProfileSection'][_0xd6f0('0x5b')]({'where':{'name':_0x1fee47,'userProfileId':_0x705eb[_0xd6f0('0x62')]},'raw':!![]})[_0xd6f0('0x1c')](function(_0x282e9b){if(_0x282e9b&&_0x282e9b['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x5bc4e7['name'],'resourceId':_0x5bc4e7['id'],'type':_0x282e9b[_0xd6f0('0x3a')],'sectionId':_0x282e9b['id']},{})[_0xd6f0('0x1c')](function(){return _0x269dd7;});}else{return _0x269dd7;}})[_0xd6f0('0x27')](function(_0x30cd81){logger[_0xd6f0('0x23')](_0xd6f0('0x63'),_0x30cd81);throw _0x30cd81;});}return _0x269dd7;});}})[_0xd6f0('0x1c')](respondWithResult(_0x539ef1,0xc9))[_0xd6f0('0x27')](handleError(_0x539ef1,null));};exports[_0xd6f0('0x5f')]=function(_0x5ad146,_0x55f96e,_0x1b9728){var _0x5af4f6;return db[_0xd6f0('0x3e')][_0xd6f0('0x5f')](_0x5ad146[_0xd6f0('0x5d')],{'raw':!![]})[_0xd6f0('0x1c')](function(_0x14384f){_0x5af4f6=_0x14384f;return db[_0xd6f0('0x3e')][_0xd6f0('0x55')]({'raw':!![]});})['then'](function(_0x3c8a3e){var _0x318a68=fs[_0xd6f0('0x64')](path['join'](config[_0xd6f0('0x65')],_0xd6f0('0x66')),'utf8');var _0xad50ac=fs[_0xd6f0('0x64')](path[_0xd6f0('0x67')](config[_0xd6f0('0x65')],_0xd6f0('0x68')),_0xd6f0('0x69'));var _0x1c6140=ejs[_0xd6f0('0x6a')](_0x318a68,{'trunks':_0x3c8a3e||[]});fs[_0xd6f0('0x6b')]('/etc/asterisk/sip_xcally_trunks.conf',_0x1c6140);if(_0x5af4f6[_0xd6f0('0x6c')]){var _0x205b6a=ejs[_0xd6f0('0x6a')](_0xad50ac,{'trunks':_0x3c8a3e||[]});fs[_0xd6f0('0x6b')]('/etc/asterisk/sip_xcally_registers.conf',_0x205b6a);}})[_0xd6f0('0x1c')](function(){return respondWithRpcPromise(_0xd6f0('0x6d'),_0xd6f0('0x5f'),{'module':_0xd6f0('0x6e')});})[_0xd6f0('0x1c')](function(){var _0x12e0e5=_0x5ad146[_0xd6f0('0x6f')][_0xd6f0('0x35')]({'plain':!![]});if(!_0x12e0e5)throw new Error(_0xd6f0('0x60'));if(_0x12e0e5[_0xd6f0('0x61')]==='user'){var _0x440d5c=_0x5af4f6[_0xd6f0('0x35')]({'plain':!![]});return db[_0xd6f0('0x70')]['find']({'where':{'name':_0xd6f0('0x36'),'userProfileId':_0x12e0e5[_0xd6f0('0x62')]},'raw':!![]})[_0xd6f0('0x1c')](function(_0x406bc7){if(_0x406bc7&&_0x406bc7[_0xd6f0('0x71')]===0x0){return db[_0xd6f0('0x37')][_0xd6f0('0x5f')]({'name':_0x440d5c[_0xd6f0('0x3a')],'resourceId':_0x440d5c['id'],'type':_0x406bc7[_0xd6f0('0x3a')],'sectionId':_0x406bc7['id']},{})[_0xd6f0('0x1c')](function(){return _0x5af4f6;});}else{return _0x5af4f6;}})[_0xd6f0('0x27')](function(_0x5b3155){logger['error'](_0xd6f0('0x63'),_0x5b3155);throw _0x5b3155;});}return _0x5af4f6;})[_0xd6f0('0x1c')](respondWithResult(_0x55f96e,0xc9))[_0xd6f0('0x27')](handleError(_0x55f96e,null));};exports[_0xd6f0('0x34')]=function(_0x1da442,_0x5a781b,_0x15143a){var _0x2d38e6;return db['Trunk'][_0xd6f0('0x5b')]({'where':{'id':_0x1da442['params']['id']}})[_0xd6f0('0x1c')](handleEntityNotFound(_0x5a781b,null))[_0xd6f0('0x1c')](saveUpdates(_0x1da442[_0xd6f0('0x5d')],null))[_0xd6f0('0x1c')](function(_0x391c2a){if(_0x391c2a){_0x2d38e6=_0x391c2a;return db['Trunk']['findAll']({'raw':!![]});}})[_0xd6f0('0x1c')](function(_0x17b320){if(_0x17b320){var _0x484124=fs[_0xd6f0('0x64')](path['join'](config['root'],_0xd6f0('0x66')),'utf8');var _0x5dc1c7=fs['readFileSync'](path['join'](config[_0xd6f0('0x65')],_0xd6f0('0x68')),_0xd6f0('0x69'));var _0xcfed18=ejs[_0xd6f0('0x6a')](_0x484124,{'trunks':_0x17b320||[]});fs[_0xd6f0('0x6b')](_0xd6f0('0x72'),_0xcfed18);var _0x381f88=ejs[_0xd6f0('0x6a')](_0x5dc1c7,{'trunks':_0x17b320||[]});fs['writeFileSync'](_0xd6f0('0x73'),_0x381f88);return respondWithRpcPromise('Reload','update',{'module':_0xd6f0('0x6e')});}return null;})[_0xd6f0('0x1c')](function(_0x397f2c){if(_0x397f2c){return _0x2d38e6;}})['then'](respondWithResult(_0x5a781b,null))[_0xd6f0('0x27')](handleError(_0x5a781b,null));};exports[_0xd6f0('0x74')]=function(_0xc0585c,_0xf7ade1,_0x41e738){var _0x202e37;return db[_0xd6f0('0x3e')][_0xd6f0('0x5b')]({'where':{'id':_0xc0585c['params']['id']}})[_0xd6f0('0x1c')](handleEntityNotFound(_0xf7ade1,null))[_0xd6f0('0x1c')](removeEntity(_0xf7ade1,null))['then'](function(){return db[_0xd6f0('0x3e')][_0xd6f0('0x55')]({'raw':!![]});})[_0xd6f0('0x1c')](function(_0x175ba6){var _0x403698=fs[_0xd6f0('0x64')](path[_0xd6f0('0x67')](config['root'],_0xd6f0('0x66')),_0xd6f0('0x69'));var _0x5c3659=fs['readFileSync'](path['join'](config['root'],_0xd6f0('0x68')),_0xd6f0('0x69'));var _0x2fdd59=ejs[_0xd6f0('0x6a')](_0x403698,{'trunks':_0x175ba6});var _0x427b95=ejs[_0xd6f0('0x6a')](_0x5c3659,{'trunks':_0x175ba6});fs['writeFileSync'](_0xd6f0('0x72'),_0x2fdd59);fs[_0xd6f0('0x6b')](_0xd6f0('0x73'),_0x427b95);return respondWithRpcPromise(_0xd6f0('0x6d'),'destroy',{'module':_0xd6f0('0x6e')});})['catch'](handleError(_0xf7ade1,null));}; \ No newline at end of file +var _0xe5b3=['then','info','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Trunk,\x20%s,\x20%s','request\x20sent','result','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','destroy','get','Trunks','UserProfileResource','stack','name','index','map','Trunk','rawAttributes','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','params','catch','clone','find','omit','createdAt','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','create','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','/etc/asterisk/sip_xcally_registers.conf','update','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request'];(function(_0x4f4e4b,_0x46ea73){var _0x23a628=function(_0x56791){while(--_0x56791){_0x4f4e4b['push'](_0x4f4e4b['shift']());}};_0x23a628(++_0x46ea73);}(_0xe5b3,0x133));var _0x3e5b=function(_0x235983,_0xd22673){_0x235983=_0x235983-0x0;var _0x538b67=_0xe5b3[_0x235983];return _0x538b67;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3e5b('0x0'));var zipdir=require(_0x3e5b('0x1'));var jsonpatch=require(_0x3e5b('0x2'));var rp=require(_0x3e5b('0x3'));var moment=require(_0x3e5b('0x4'));var BPromise=require(_0x3e5b('0x5'));var Mustache=require(_0x3e5b('0x6'));var util=require(_0x3e5b('0x7'));var path=require(_0x3e5b('0x8'));var sox=require(_0x3e5b('0x9'));var csv=require(_0x3e5b('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3e5b('0xb'));var _=require(_0x3e5b('0xc'));var squel=require('squel');var crypto=require(_0x3e5b('0xd'));var jsforce=require(_0x3e5b('0xe'));var deskjs=require(_0x3e5b('0xf'));var toCsv=require(_0x3e5b('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x3e5b('0x10'));var authService=require(_0x3e5b('0x11'));var qs=require(_0x3e5b('0x12'));var as=require(_0x3e5b('0x13'));var hardwareService=require(_0x3e5b('0x14'));var logger=require('../../config/logger')(_0x3e5b('0x15'));var utils=require('../../config/utils');var config=require(_0x3e5b('0x16'));var licenseUtil=require(_0x3e5b('0x17'));var db=require(_0x3e5b('0x18'))['db'];var jayson=require(_0x3e5b('0x19'));var client=jayson[_0x3e5b('0x1a')][_0x3e5b('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x405e70,_0x560010,_0x39a2a1,_0x5f2f9c){return new BPromise(function(_0x51a188,_0x4d71a3){var _0x3754e3=_0x5f2f9c||client;return _0x3754e3[_0x3e5b('0x1c')](_0x405e70,_0x39a2a1)[_0x3e5b('0x1d')](function(_0x4fb471){logger[_0x3e5b('0x1e')]('Trunk,\x20%s,\x20%s',_0x560010,'request\x20sent');logger[_0x3e5b('0x1f')](_0x3e5b('0x20'),_0x560010,'request\x20sent',JSON[_0x3e5b('0x21')](_0x4fb471));if(_0x4fb471[_0x3e5b('0x22')]){if(_0x4fb471['error'][_0x3e5b('0x23')]===0x1f4){logger[_0x3e5b('0x22')]('Trunk,\x20%s,\x20%s',_0x560010,_0x4fb471['error'][_0x3e5b('0x24')]);return _0x4d71a3(_0x4fb471[_0x3e5b('0x22')][_0x3e5b('0x24')]);}logger[_0x3e5b('0x22')](_0x3e5b('0x25'),_0x560010,_0x4fb471[_0x3e5b('0x22')][_0x3e5b('0x24')]);return _0x51a188(_0x4fb471[_0x3e5b('0x22')][_0x3e5b('0x24')]);}else{logger[_0x3e5b('0x1e')](_0x3e5b('0x25'),_0x560010,_0x3e5b('0x26'));_0x51a188(_0x4fb471[_0x3e5b('0x27')][_0x3e5b('0x24')]);}})['catch'](function(_0x433f9c){logger[_0x3e5b('0x22')](_0x3e5b('0x25'),_0x560010,_0x433f9c);_0x4d71a3(_0x433f9c);});});}function respondWithStatusCode(_0x150674,_0x50039b){_0x50039b=_0x50039b||0xcc;return function(_0x1eb80f){if(_0x1eb80f){return _0x150674['sendStatus'](_0x50039b);}return _0x150674[_0x3e5b('0x28')](_0x50039b)[_0x3e5b('0x29')]();};}function respondWithResult(_0x4d5e61,_0x41b684){_0x41b684=_0x41b684||0xc8;return function(_0x2f6368){if(_0x2f6368){return _0x4d5e61[_0x3e5b('0x28')](_0x41b684)[_0x3e5b('0x2a')](_0x2f6368);}};}function respondWithFilteredResult(_0x3bb749,_0x26c7f2){return function(_0x160e87){if(_0x160e87){var _0x2ddf57=typeof _0x26c7f2['offset']===_0x3e5b('0x2b')&&typeof _0x26c7f2['limit']===_0x3e5b('0x2b');var _0x4fd64b=_0x160e87[_0x3e5b('0x2c')];var _0x1f6473=_0x2ddf57?0x0:_0x26c7f2[_0x3e5b('0x2d')];var _0x475b39=_0x2ddf57?_0x160e87[_0x3e5b('0x2c')]:_0x26c7f2[_0x3e5b('0x2d')]+_0x26c7f2[_0x3e5b('0x2e')];var _0x9c2123;if(_0x475b39>=_0x4fd64b){_0x475b39=_0x4fd64b;_0x9c2123=0xc8;}else{_0x9c2123=0xce;}_0x3bb749[_0x3e5b('0x28')](_0x9c2123);return _0x3bb749[_0x3e5b('0x2f')](_0x3e5b('0x30'),_0x1f6473+'-'+_0x475b39+'/'+_0x4fd64b)['json'](_0x160e87);}return null;};}function patchUpdates(_0x21bc10){return function(_0x1882aa){try{jsonpatch[_0x3e5b('0x31')](_0x1882aa,_0x21bc10,!![]);}catch(_0x2a14eb){return BPromise[_0x3e5b('0x32')](_0x2a14eb);}return _0x1882aa[_0x3e5b('0x33')]();};}function saveUpdates(_0x345927,_0x4c4e01){return function(_0x33f089){if(_0x33f089){return _0x33f089['update'](_0x345927)['then'](function(_0x32c6b0){return _0x32c6b0;});}return null;};}function removeEntity(_0x78d68a,_0x51ea0d){return function(_0x40e37d){if(_0x40e37d){return _0x40e37d[_0x3e5b('0x34')]()[_0x3e5b('0x1d')](function(){var _0x33e356=_0x40e37d[_0x3e5b('0x35')]({'plain':!![]});var _0x26f842=_0x3e5b('0x36');return db[_0x3e5b('0x37')][_0x3e5b('0x34')]({'where':{'type':_0x26f842,'resourceId':_0x33e356['id']}})[_0x3e5b('0x1d')](function(){return _0x40e37d;});})[_0x3e5b('0x1d')](function(){_0x78d68a[_0x3e5b('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x141b7e,_0xec45c5){return function(_0x53caa2){if(!_0x53caa2){_0x141b7e['sendStatus'](0x194);}return _0x53caa2;};}function handleError(_0x471196,_0x56d7ef){_0x56d7ef=_0x56d7ef||0x1f4;return function(_0x2939da){logger[_0x3e5b('0x22')](_0x2939da[_0x3e5b('0x38')]);if(_0x2939da[_0x3e5b('0x39')]){delete _0x2939da['name'];}_0x471196[_0x3e5b('0x28')](_0x56d7ef)['send'](_0x2939da);};}exports[_0x3e5b('0x3a')]=function(_0x5ec841,_0x47f7c8){var _0x48f414={},_0x10c202={},_0x174ebf={'count':0x0,'rows':[]};var _0x2eaa30=_[_0x3e5b('0x3b')](db[_0x3e5b('0x3c')][_0x3e5b('0x3d')],function(_0x5466ac){return{'name':_0x5466ac['fieldName'],'type':_0x5466ac['type']['key']};});_0x10c202['model']=_['map'](_0x2eaa30,'name');_0x10c202[_0x3e5b('0x3e')]=_[_0x3e5b('0x3f')](_0x5ec841[_0x3e5b('0x3e')]);_0x10c202[_0x3e5b('0x40')]=_[_0x3e5b('0x41')](_0x10c202[_0x3e5b('0x42')],_0x10c202[_0x3e5b('0x3e')]);_0x48f414[_0x3e5b('0x43')]=_[_0x3e5b('0x41')](_0x10c202[_0x3e5b('0x42')],qs[_0x3e5b('0x44')](_0x5ec841['query'][_0x3e5b('0x44')]));_0x48f414[_0x3e5b('0x43')]=_0x48f414[_0x3e5b('0x43')][_0x3e5b('0x45')]?_0x48f414[_0x3e5b('0x43')]:_0x10c202[_0x3e5b('0x42')];if(!_0x5ec841[_0x3e5b('0x3e')][_0x3e5b('0x46')](_0x3e5b('0x47'))){_0x48f414[_0x3e5b('0x2e')]=qs[_0x3e5b('0x2e')](_0x5ec841['query']['limit']);_0x48f414['offset']=qs['offset'](_0x5ec841[_0x3e5b('0x3e')][_0x3e5b('0x2d')]);}_0x48f414[_0x3e5b('0x48')]=qs[_0x3e5b('0x49')](_0x5ec841[_0x3e5b('0x3e')][_0x3e5b('0x49')]);_0x48f414[_0x3e5b('0x4a')]=qs[_0x3e5b('0x40')](_[_0x3e5b('0x4b')](_0x5ec841[_0x3e5b('0x3e')],_0x10c202['filters']),_0x2eaa30);if(_0x5ec841[_0x3e5b('0x3e')][_0x3e5b('0x4c')]){_0x48f414[_0x3e5b('0x4a')]=_[_0x3e5b('0x4d')](_0x48f414[_0x3e5b('0x4a')],{'$or':_['map'](_0x2eaa30,function(_0x588ee7){if(_0x588ee7['type']!==_0x3e5b('0x4e')){var _0x20af6a={};_0x20af6a[_0x588ee7[_0x3e5b('0x39')]]={'$like':'%'+_0x5ec841['query']['filter']+'%'};return _0x20af6a;}})});}_0x48f414=_[_0x3e5b('0x4d')]({},_0x48f414,_0x5ec841[_0x3e5b('0x4f')]);var _0x123947={'where':_0x48f414['where']};return db['Trunk'][_0x3e5b('0x2c')](_0x123947)['then'](function(_0x14b62a){_0x174ebf[_0x3e5b('0x2c')]=_0x14b62a;if(_0x5ec841[_0x3e5b('0x3e')][_0x3e5b('0x50')]){_0x48f414[_0x3e5b('0x51')]=[{'all':!![]}];}return db[_0x3e5b('0x3c')][_0x3e5b('0x52')](_0x48f414);})[_0x3e5b('0x1d')](function(_0x339852){_0x174ebf['rows']=_0x339852;return _0x174ebf;})[_0x3e5b('0x1d')](respondWithFilteredResult(_0x47f7c8,_0x48f414))['catch'](handleError(_0x47f7c8,null));};exports[_0x3e5b('0x53')]=function(_0x2e7047,_0x26e11e){var _0x3d51fa={'raw':![],'where':{'id':_0x2e7047[_0x3e5b('0x54')]['id']}},_0x291e4d={};_0x291e4d[_0x3e5b('0x42')]=_[_0x3e5b('0x3f')](db[_0x3e5b('0x3c')][_0x3e5b('0x3d')]);_0x291e4d[_0x3e5b('0x3e')]=_[_0x3e5b('0x3f')](_0x2e7047[_0x3e5b('0x3e')]);_0x291e4d['filters']=_[_0x3e5b('0x41')](_0x291e4d[_0x3e5b('0x42')],_0x291e4d[_0x3e5b('0x3e')]);_0x3d51fa[_0x3e5b('0x43')]=_[_0x3e5b('0x41')](_0x291e4d[_0x3e5b('0x42')],qs['fields'](_0x2e7047[_0x3e5b('0x3e')][_0x3e5b('0x44')]));_0x3d51fa[_0x3e5b('0x43')]=_0x3d51fa[_0x3e5b('0x43')][_0x3e5b('0x45')]?_0x3d51fa[_0x3e5b('0x43')]:_0x291e4d[_0x3e5b('0x42')];if(_0x2e7047[_0x3e5b('0x3e')]['includeAll']){_0x3d51fa[_0x3e5b('0x51')]=[{'all':!![]}];}_0x3d51fa=_['merge']({},_0x3d51fa,_0x2e7047['options']);return db[_0x3e5b('0x3c')]['find'](_0x3d51fa)[_0x3e5b('0x1d')](handleEntityNotFound(_0x26e11e,null))[_0x3e5b('0x1d')](respondWithResult(_0x26e11e,null))[_0x3e5b('0x55')](handleError(_0x26e11e,null));};exports[_0x3e5b('0x56')]=function(_0x4a492b,_0x5ddeee){var _0x545712={'where':{'id':_0x4a492b[_0x3e5b('0x54')]['id']}},_0x581b94={};_0x581b94[_0x3e5b('0x42')]=_[_0x3e5b('0x3f')](db[_0x3e5b('0x3c')][_0x3e5b('0x3d')]);_0x545712['attributes']=_['intersection'](_0x581b94[_0x3e5b('0x42')],qs[_0x3e5b('0x44')](_0x4a492b[_0x3e5b('0x3e')][_0x3e5b('0x44')]));_0x545712[_0x3e5b('0x43')]=_0x545712['attributes']['length']?_0x545712['attributes']:_0x581b94['model'];if(_0x4a492b[_0x3e5b('0x3e')][_0x3e5b('0x50')]){_0x545712[_0x3e5b('0x51')]=[{'all':!![]}];}_0x545712=_[_0x3e5b('0x4d')]({},_0x545712,_0x4a492b[_0x3e5b('0x4f')]);return db[_0x3e5b('0x3c')][_0x3e5b('0x57')](_0x545712)[_0x3e5b('0x1d')](handleEntityNotFound(_0x5ddeee,null))['then'](function(_0x285db6){if(_0x285db6){var _0x29897b=_0x285db6[_0x3e5b('0x35')]({'plain':!![]});_0x29897b=qs[_0x3e5b('0x58')](_0x29897b,['id',_0x3e5b('0x59'),'updatedAt']);_0x4a492b[_0x3e5b('0x5a')]=_['omit'](_0x4a492b[_0x3e5b('0x5a')],['id',_0x3e5b('0x59'),'updatedAt']);return db['Trunk']['create'](_[_0x3e5b('0x4d')](_0x29897b,_0x4a492b['body']),{'include':_0x4a492b[_0x3e5b('0x3e')][_0x3e5b('0x50')]?[{'all':!![]}]:undefined})[_0x3e5b('0x1d')](function(_0x40197c){var _0x14f187=_0x4a492b['user']['get']({'plain':!![]});if(!_0x14f187)throw new Error(_0x3e5b('0x5b'));if(_0x14f187[_0x3e5b('0x5c')]===_0x3e5b('0x5d')){var _0x4dfb45=_0x40197c[_0x3e5b('0x35')]({'plain':!![]});var _0x3c5293=_0x3e5b('0x36');return db[_0x3e5b('0x5e')][_0x3e5b('0x57')]({'where':{'name':_0x3c5293,'userProfileId':_0x14f187[_0x3e5b('0x5f')]},'raw':!![]})[_0x3e5b('0x1d')](function(_0x4a1ce3){if(_0x4a1ce3&&_0x4a1ce3[_0x3e5b('0x60')]===0x0){return db[_0x3e5b('0x37')][_0x3e5b('0x61')]({'name':_0x4dfb45[_0x3e5b('0x39')],'resourceId':_0x4dfb45['id'],'type':_0x4a1ce3[_0x3e5b('0x39')],'sectionId':_0x4a1ce3['id']},{})[_0x3e5b('0x1d')](function(){return _0x40197c;});}else{return _0x40197c;}})[_0x3e5b('0x55')](function(_0x2411c3){logger[_0x3e5b('0x22')](_0x3e5b('0x62'),_0x2411c3);throw _0x2411c3;});}return _0x40197c;});}})['then'](respondWithResult(_0x5ddeee,0xc9))[_0x3e5b('0x55')](handleError(_0x5ddeee,null));};exports[_0x3e5b('0x61')]=function(_0x5af305,_0x177144,_0x31ef31){var _0x561c78;return db['Trunk']['create'](_0x5af305[_0x3e5b('0x5a')],{'raw':!![]})[_0x3e5b('0x1d')](function(_0x498e6d){_0x561c78=_0x498e6d;return db[_0x3e5b('0x3c')][_0x3e5b('0x52')]({'raw':!![]});})['then'](function(_0x3d3bf2){var _0x17f60f=fs[_0x3e5b('0x63')](path[_0x3e5b('0x64')](config[_0x3e5b('0x65')],_0x3e5b('0x66')),_0x3e5b('0x67'));var _0x410c7a=fs[_0x3e5b('0x63')](path['join'](config[_0x3e5b('0x65')],_0x3e5b('0x68')),_0x3e5b('0x67'));var _0x40103e=ejs[_0x3e5b('0x69')](_0x17f60f,{'trunks':_0x3d3bf2||[]});fs[_0x3e5b('0x6a')](_0x3e5b('0x6b'),_0x40103e);if(_0x561c78['registry']){var _0x590f0c=ejs[_0x3e5b('0x69')](_0x410c7a,{'trunks':_0x3d3bf2||[]});fs[_0x3e5b('0x6a')]('/etc/asterisk/sip_xcally_registers.conf',_0x590f0c);}})[_0x3e5b('0x1d')](function(){return respondWithRpcPromise(_0x3e5b('0x6c'),_0x3e5b('0x61'),{'module':_0x3e5b('0x6d')});})[_0x3e5b('0x1d')](function(){var _0x9deb09=_0x5af305[_0x3e5b('0x5d')]['get']({'plain':!![]});if(!_0x9deb09)throw new Error(_0x3e5b('0x5b'));if(_0x9deb09[_0x3e5b('0x5c')]==='user'){var _0x577747=_0x561c78['get']({'plain':!![]});return db[_0x3e5b('0x5e')][_0x3e5b('0x57')]({'where':{'name':_0x3e5b('0x36'),'userProfileId':_0x9deb09[_0x3e5b('0x5f')]},'raw':!![]})[_0x3e5b('0x1d')](function(_0x1ba550){if(_0x1ba550&&_0x1ba550['autoAssociation']===0x0){return db[_0x3e5b('0x37')][_0x3e5b('0x61')]({'name':_0x577747['name'],'resourceId':_0x577747['id'],'type':_0x1ba550[_0x3e5b('0x39')],'sectionId':_0x1ba550['id']},{})['then'](function(){return _0x561c78;});}else{return _0x561c78;}})['catch'](function(_0x211e73){logger[_0x3e5b('0x22')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x211e73);throw _0x211e73;});}return _0x561c78;})[_0x3e5b('0x1d')](respondWithResult(_0x177144,0xc9))[_0x3e5b('0x55')](handleError(_0x177144,null));};exports['update']=function(_0x2e36af,_0x185640,_0x14baa9){var _0x1425eb;return db[_0x3e5b('0x3c')][_0x3e5b('0x57')]({'where':{'id':_0x2e36af['params']['id']}})['then'](handleEntityNotFound(_0x185640,null))[_0x3e5b('0x1d')](saveUpdates(_0x2e36af['body'],null))['then'](function(_0x25d3d8){if(_0x25d3d8){_0x1425eb=_0x25d3d8;return db[_0x3e5b('0x3c')][_0x3e5b('0x52')]({'raw':!![]});}})['then'](function(_0x2e5fa3){if(_0x2e5fa3){var _0x4b8d19=fs[_0x3e5b('0x63')](path['join'](config[_0x3e5b('0x65')],_0x3e5b('0x66')),_0x3e5b('0x67'));var _0xdf2677=fs['readFileSync'](path[_0x3e5b('0x64')](config['root'],_0x3e5b('0x68')),_0x3e5b('0x67'));var _0x58ccf3=ejs[_0x3e5b('0x69')](_0x4b8d19,{'trunks':_0x2e5fa3||[]});fs[_0x3e5b('0x6a')](_0x3e5b('0x6b'),_0x58ccf3);var _0x5ad011=ejs[_0x3e5b('0x69')](_0xdf2677,{'trunks':_0x2e5fa3||[]});fs[_0x3e5b('0x6a')](_0x3e5b('0x6e'),_0x5ad011);return respondWithRpcPromise('Reload',_0x3e5b('0x6f'),{'module':_0x3e5b('0x6d')});}return null;})['then'](function(_0xd9d941){if(_0xd9d941){return _0x1425eb;}})[_0x3e5b('0x1d')](respondWithResult(_0x185640,null))[_0x3e5b('0x55')](handleError(_0x185640,null));};exports['destroy']=function(_0x3b3306,_0x30e079,_0x352f7e){var _0x1d7c05;return db['Trunk'][_0x3e5b('0x57')]({'where':{'id':_0x3b3306['params']['id']}})[_0x3e5b('0x1d')](handleEntityNotFound(_0x30e079,null))['then'](removeEntity(_0x30e079,null))[_0x3e5b('0x1d')](function(){return db[_0x3e5b('0x3c')]['findAll']({'raw':!![]});})[_0x3e5b('0x1d')](function(_0x2299b9){var _0x56ff9d=fs[_0x3e5b('0x63')](path[_0x3e5b('0x64')](config[_0x3e5b('0x65')],_0x3e5b('0x66')),'utf8');var _0x53328b=fs[_0x3e5b('0x63')](path[_0x3e5b('0x64')](config[_0x3e5b('0x65')],_0x3e5b('0x68')),_0x3e5b('0x67'));var _0x3d1193=ejs['render'](_0x56ff9d,{'trunks':_0x2299b9});var _0x5d6aae=ejs[_0x3e5b('0x69')](_0x53328b,{'trunks':_0x2299b9});fs[_0x3e5b('0x6a')](_0x3e5b('0x6b'),_0x3d1193);fs[_0x3e5b('0x6a')](_0x3e5b('0x6e'),_0x5d6aae);return respondWithRpcPromise(_0x3e5b('0x6c'),_0x3e5b('0x34'),{'module':_0x3e5b('0x6d')});})['catch'](handleError(_0x30e079,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index 459afdb..befac52 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 _0x02d2=['tools_trunks','lodash','util','../../config/logger','path','rimraf','../../config/environment','./trunk.attributes','exports','define','Trunk'];(function(_0x279d37,_0x14de3f){var _0x530173=function(_0x37fc79){while(--_0x37fc79){_0x279d37['push'](_0x279d37['shift']());}};_0x530173(++_0x14de3f);}(_0x02d2,0x7a));var _0x202d=function(_0x5a9606,_0xaf8b45){_0x5a9606=_0x5a9606-0x0;var _0xbc660b=_0x02d2[_0x5a9606];return _0xbc660b;};'use strict';var _=require(_0x202d('0x0'));var util=require(_0x202d('0x1'));var logger=require(_0x202d('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x202d('0x3'));var rimraf=require(_0x202d('0x4'));var config=require(_0x202d('0x5'));var attributes=require(_0x202d('0x6'));module[_0x202d('0x7')]=function(_0x112304,_0x99ffd2){return _0x112304[_0x202d('0x8')](_0x202d('0x9'),attributes,{'tableName':_0x202d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3456=['rimraf','../../config/environment','./trunk.attributes','exports','define','Trunk','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x3456,0x124));var _0x6345=function(_0x15f8ad,_0x5275c3){_0x15f8ad=_0x15f8ad-0x0;var _0xc0238a=_0x3456[_0x15f8ad];return _0xc0238a;};'use strict';var _=require(_0x6345('0x0'));var util=require(_0x6345('0x1'));var logger=require(_0x6345('0x2'))(_0x6345('0x3'));var moment=require(_0x6345('0x4'));var BPromise=require(_0x6345('0x5'));var rp=require(_0x6345('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6345('0x7'));var config=require(_0x6345('0x8'));var attributes=require(_0x6345('0x9'));module[_0x6345('0xa')]=function(_0x4a4130,_0xa3a2ad){return _0x4a4130[_0x6345('0xb')](_0x6345('0xc'),attributes,{'tableName':'tools_trunks','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 8b5c31e..91bad0e 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 _0x597f=['findAll','options','raw','where','attributes','limit','map','model','include','catch','ShowTrunk','find','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','http','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetTrunk','Trunk'];(function(_0x26b5ff,_0x92009a){var _0x58603e=function(_0x4454ff){while(--_0x4454ff){_0x26b5ff['push'](_0x26b5ff['shift']());}};_0x58603e(++_0x92009a);}(_0x597f,0x12c));var _0xf597=function(_0x7f5123,_0x3062c5){_0x7f5123=_0x7f5123-0x0;var _0x10a02a=_0x597f[_0x7f5123];return _0x10a02a;};'use strict';var _=require('lodash');var util=require(_0xf597('0x0'));var moment=require(_0xf597('0x1'));var BPromise=require(_0xf597('0x2'));var rs=require(_0xf597('0x3'));var fs=require('fs');var Redis=require(_0xf597('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xf597('0x5'));var logger=require(_0xf597('0x6'))(_0xf597('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xf597('0x8')][_0xf597('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xa4488c,_0x2f61d2,_0x1ce95a){return new BPromise(function(_0x84fbd7,_0x20b0cb){return client[_0xf597('0xa')](_0xa4488c,_0x1ce95a)[_0xf597('0xb')](function(_0x8a2848){logger[_0xf597('0xc')](_0xf597('0xd'),_0x2f61d2,_0xf597('0xe'));logger[_0xf597('0xf')](_0xf597('0x10'),_0x2f61d2,_0xf597('0xe'),JSON[_0xf597('0x11')](_0x8a2848));if(_0x8a2848[_0xf597('0x12')]){if(_0x8a2848[_0xf597('0x12')][_0xf597('0x13')]===0x1f4){logger[_0xf597('0x12')](_0xf597('0xd'),_0x2f61d2,_0x8a2848['error'][_0xf597('0x14')]);return _0x20b0cb(_0x8a2848[_0xf597('0x12')][_0xf597('0x14')]);}logger['error']('Trunk,\x20%s,\x20%s',_0x2f61d2,_0x8a2848['error'][_0xf597('0x14')]);return _0x84fbd7(_0x8a2848[_0xf597('0x12')][_0xf597('0x14')]);}else{logger[_0xf597('0xc')](_0xf597('0xd'),_0x2f61d2,_0xf597('0xe'));_0x84fbd7(_0x8a2848[_0xf597('0x15')][_0xf597('0x14')]);}})['catch'](function(_0x2d0ce1){logger[_0xf597('0x12')](_0xf597('0xd'),_0x2f61d2,_0x2d0ce1);_0x20b0cb(_0x2d0ce1);});});}exports[_0xf597('0x16')]=function(_0x1afec2){var _0x1eebc4=this;return new Promise(function(_0x18b4e5,_0x4f6615){return db[_0xf597('0x17')][_0xf597('0x18')]({'raw':_0x1afec2[_0xf597('0x19')]?_0x1afec2[_0xf597('0x19')][_0xf597('0x1a')]===undefined?!![]:![]:!![],'where':_0x1afec2[_0xf597('0x19')]?_0x1afec2[_0xf597('0x19')][_0xf597('0x1b')]||null:null,'attributes':_0x1afec2[_0xf597('0x19')]?_0x1afec2['options'][_0xf597('0x1c')]||null:null,'limit':_0x1afec2[_0xf597('0x19')]?_0x1afec2['options'][_0xf597('0x1d')]||null:null,'include':_0x1afec2[_0xf597('0x19')]?_0x1afec2['options']['include']?_[_0xf597('0x1e')](_0x1afec2['options']['include'],function(_0x5ee291){return{'model':db[_0x5ee291[_0xf597('0x1f')]],'as':_0x5ee291['as'],'attributes':_0x5ee291['attributes'],'include':_0x5ee291[_0xf597('0x20')]?_['map'](_0x5ee291[_0xf597('0x20')],function(_0x3583ce){return{'model':db[_0x3583ce[_0xf597('0x1f')]],'as':_0x3583ce['as'],'attributes':_0x3583ce['attributes'],'include':_0x3583ce[_0xf597('0x20')]?_[_0xf597('0x1e')](_0x3583ce[_0xf597('0x20')],function(_0x2e8433){return{'model':db[_0x2e8433['model']],'as':_0x2e8433['as'],'attributes':_0x2e8433[_0xf597('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3e76da){logger[_0xf597('0xc')](_0xf597('0x16'),_0x1afec2);logger[_0xf597('0xf')](_0xf597('0x16'),_0x1afec2,JSON['stringify'](_0x3e76da));_0x18b4e5(_0x3e76da);})[_0xf597('0x21')](function(_0x421d11){logger[_0xf597('0x12')]('GetTrunk',_0x421d11[_0xf597('0x14')],_0x1afec2);_0x4f6615(_0x1eebc4[_0xf597('0x12')](0x1f4,_0x421d11[_0xf597('0x14')]));});});};exports[_0xf597('0x22')]=function(_0x1e0b63){var _0xac2516=this;return new Promise(function(_0x52275e,_0x59a998){return db[_0xf597('0x17')][_0xf597('0x23')]({'raw':_0x1e0b63[_0xf597('0x19')]?_0x1e0b63['options'][_0xf597('0x1a')]===undefined?!![]:![]:!![],'where':_0x1e0b63['options']?_0x1e0b63[_0xf597('0x19')][_0xf597('0x1b')]||null:null,'attributes':_0x1e0b63[_0xf597('0x19')]?_0x1e0b63[_0xf597('0x19')][_0xf597('0x1c')]||null:null,'include':_0x1e0b63[_0xf597('0x19')]?_0x1e0b63[_0xf597('0x19')]['include']?_[_0xf597('0x1e')](_0x1e0b63['options'][_0xf597('0x20')],function(_0x1053ac){return{'model':db[_0x1053ac[_0xf597('0x1f')]],'as':_0x1053ac['as'],'attributes':_0x1053ac[_0xf597('0x1c')],'include':_0x1053ac['include']?_['map'](_0x1053ac['include'],function(_0x80bbe2){return{'model':db[_0x80bbe2[_0xf597('0x1f')]],'as':_0x80bbe2['as'],'attributes':_0x80bbe2['attributes'],'include':_0x80bbe2[_0xf597('0x20')]?_[_0xf597('0x1e')](_0x80bbe2['include'],function(_0x2eaa70){return{'model':db[_0x2eaa70[_0xf597('0x1f')]],'as':_0x2eaa70['as'],'attributes':_0x2eaa70[_0xf597('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xf597('0xb')](function(_0x303eb8){logger[_0xf597('0xc')](_0xf597('0x22'),_0x1e0b63);logger[_0xf597('0xf')]('ShowTrunk',_0x1e0b63,JSON['stringify'](_0x303eb8));_0x52275e(_0x303eb8);})[_0xf597('0x21')](function(_0x509c20){logger[_0xf597('0x12')](_0xf597('0x22'),_0x509c20['message'],_0x1e0b63);_0x59a998(_0xac2516[_0xf597('0x12')](0x1f4,_0x509c20[_0xf597('0x14')]));});});}; \ No newline at end of file +var _0xb176=['ShowTrunk','where','lodash','moment','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','GetTrunk','Trunk','raw','options','attributes','limit','include','map','model'];(function(_0x1a26be,_0x2c4c09){var _0x3f25f1=function(_0x9ea485){while(--_0x9ea485){_0x1a26be['push'](_0x1a26be['shift']());}};_0x3f25f1(++_0x2c4c09);}(_0xb176,0xd4));var _0x6b17=function(_0x3b0e76,_0x239221){_0x3b0e76=_0x3b0e76-0x0;var _0x1e4af4=_0xb176[_0x3b0e76];return _0x1e4af4;};'use strict';var _=require(_0x6b17('0x0'));var util=require('util');var moment=require(_0x6b17('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x6b17('0x2'));var logger=require('../../config/logger')('rpc');var config=require(_0x6b17('0x3'));var jayson=require(_0x6b17('0x4'));var client=jayson[_0x6b17('0x5')][_0x6b17('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x538769,_0x32ef6e,_0x268cac){return new BPromise(function(_0x2179ae,_0x1ac497){return client[_0x6b17('0x7')](_0x538769,_0x268cac)[_0x6b17('0x8')](function(_0x5c99fc){logger['info'](_0x6b17('0x9'),_0x32ef6e,_0x6b17('0xa'));logger[_0x6b17('0xb')](_0x6b17('0xc'),_0x32ef6e,_0x6b17('0xa'),JSON[_0x6b17('0xd')](_0x5c99fc));if(_0x5c99fc[_0x6b17('0xe')]){if(_0x5c99fc['error'][_0x6b17('0xf')]===0x1f4){logger[_0x6b17('0xe')]('Trunk,\x20%s,\x20%s',_0x32ef6e,_0x5c99fc['error']['message']);return _0x1ac497(_0x5c99fc['error']['message']);}logger[_0x6b17('0xe')]('Trunk,\x20%s,\x20%s',_0x32ef6e,_0x5c99fc[_0x6b17('0xe')][_0x6b17('0x10')]);return _0x2179ae(_0x5c99fc[_0x6b17('0xe')]['message']);}else{logger[_0x6b17('0x11')](_0x6b17('0x9'),_0x32ef6e,_0x6b17('0xa'));_0x2179ae(_0x5c99fc['result'][_0x6b17('0x10')]);}})[_0x6b17('0x12')](function(_0x79140e){logger[_0x6b17('0xe')]('Trunk,\x20%s,\x20%s',_0x32ef6e,_0x79140e);_0x1ac497(_0x79140e);});});}exports[_0x6b17('0x13')]=function(_0xdf4fad){var _0x3ae7b1=this;return new Promise(function(_0x1f261b,_0x3686b4){return db[_0x6b17('0x14')]['findAll']({'raw':_0xdf4fad['options']?_0xdf4fad['options'][_0x6b17('0x15')]===undefined?!![]:![]:!![],'where':_0xdf4fad['options']?_0xdf4fad['options']['where']||null:null,'attributes':_0xdf4fad['options']?_0xdf4fad[_0x6b17('0x16')][_0x6b17('0x17')]||null:null,'limit':_0xdf4fad[_0x6b17('0x16')]?_0xdf4fad[_0x6b17('0x16')][_0x6b17('0x18')]||null:null,'include':_0xdf4fad['options']?_0xdf4fad[_0x6b17('0x16')][_0x6b17('0x19')]?_[_0x6b17('0x1a')](_0xdf4fad[_0x6b17('0x16')][_0x6b17('0x19')],function(_0x4ac697){return{'model':db[_0x4ac697['model']],'as':_0x4ac697['as'],'attributes':_0x4ac697[_0x6b17('0x17')],'include':_0x4ac697[_0x6b17('0x19')]?_['map'](_0x4ac697[_0x6b17('0x19')],function(_0x1aecaf){return{'model':db[_0x1aecaf[_0x6b17('0x1b')]],'as':_0x1aecaf['as'],'attributes':_0x1aecaf[_0x6b17('0x17')],'include':_0x1aecaf['include']?_['map'](_0x1aecaf[_0x6b17('0x19')],function(_0x1a1b2f){return{'model':db[_0x1a1b2f[_0x6b17('0x1b')]],'as':_0x1a1b2f['as'],'attributes':_0x1a1b2f['attributes']};}):[]};}):[]};}):[]:[]})[_0x6b17('0x8')](function(_0x3d4cd3){logger[_0x6b17('0x11')](_0x6b17('0x13'),_0xdf4fad);logger[_0x6b17('0xb')](_0x6b17('0x13'),_0xdf4fad,JSON['stringify'](_0x3d4cd3));_0x1f261b(_0x3d4cd3);})['catch'](function(_0x4407a6){logger['error']('GetTrunk',_0x4407a6[_0x6b17('0x10')],_0xdf4fad);_0x3686b4(_0x3ae7b1[_0x6b17('0xe')](0x1f4,_0x4407a6[_0x6b17('0x10')]));});});};exports[_0x6b17('0x1c')]=function(_0x3d6c0f){var _0x26af3a=this;return new Promise(function(_0x1bb32a,_0x1dda70){return db[_0x6b17('0x14')]['find']({'raw':_0x3d6c0f[_0x6b17('0x16')]?_0x3d6c0f[_0x6b17('0x16')][_0x6b17('0x15')]===undefined?!![]:![]:!![],'where':_0x3d6c0f['options']?_0x3d6c0f[_0x6b17('0x16')][_0x6b17('0x1d')]||null:null,'attributes':_0x3d6c0f[_0x6b17('0x16')]?_0x3d6c0f[_0x6b17('0x16')][_0x6b17('0x17')]||null:null,'include':_0x3d6c0f['options']?_0x3d6c0f[_0x6b17('0x16')]['include']?_[_0x6b17('0x1a')](_0x3d6c0f[_0x6b17('0x16')][_0x6b17('0x19')],function(_0x52c98e){return{'model':db[_0x52c98e['model']],'as':_0x52c98e['as'],'attributes':_0x52c98e[_0x6b17('0x17')],'include':_0x52c98e[_0x6b17('0x19')]?_[_0x6b17('0x1a')](_0x52c98e[_0x6b17('0x19')],function(_0x4f7e03){return{'model':db[_0x4f7e03[_0x6b17('0x1b')]],'as':_0x4f7e03['as'],'attributes':_0x4f7e03[_0x6b17('0x17')],'include':_0x4f7e03[_0x6b17('0x19')]?_[_0x6b17('0x1a')](_0x4f7e03[_0x6b17('0x19')],function(_0x404ace){return{'model':db[_0x404ace['model']],'as':_0x404ace['as'],'attributes':_0x404ace[_0x6b17('0x17')]};}):[]};}):[]};}):[]:[]})[_0x6b17('0x8')](function(_0x3fb73b){logger[_0x6b17('0x11')](_0x6b17('0x1c'),_0x3d6c0f);logger['debug']('ShowTrunk',_0x3d6c0f,JSON['stringify'](_0x3fb73b));_0x1bb32a(_0x3fb73b);})[_0x6b17('0x12')](function(_0x4b2e16){logger[_0x6b17('0xe')]('ShowTrunk',_0x4b2e16[_0x6b17('0x10')],_0x3d6c0f);_0x1dda70(_0x26af3a[_0x6b17('0xe')](0x1f4,_0x4b2e16[_0x6b17('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index d9160a1..e9c1a37 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 _0x0e9b=['/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','getMailAccounts','getOpenchannelAccounts','/:id/chat_websites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/square_projects','getSquareProjects','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','getApiKey','post','create','/create_many','bulkCreate','diskStorage','join','server/files/images/','%s-%s','single','addAvatar','/:id/login','logout','/:id/pause','/:id/teams','/:id/chat_interactions','addChatInteractions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','/:id/whatsapp_interactions','addWhatsappInteractions','/:id/openchannel_accounts','addOpenchannelAccounts','addSmsAccounts','addChatWebsites','addWhatsappAccounts','addSquareProjects','createApiKey','put','/:id/password','delete','removeTeams','/:id/mail_interactions','removeMailInteractions','removeFaxInteractions','removeOpenchannelInteractions','removeMailAccounts','removeOpenchannelAccounts','removeChatWebsites','removeApiKey','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./user.controller','get','isAuthenticated','describe','/whoami','whoami','/presence','/:id','/:id/avatar','/:id/open_tabs','/:id/contacts','getContacts','/:id/queues','getQueues','/:id/groups','getGroups','/:id/recordings','getRecordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','getTeams','/:id/lists','getLists','getAgents'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0e9b,0xa2));var _0xb0e9=function(_0x46a324,_0x42f729){_0x46a324=_0x46a324-0x0;var _0x1140bd=_0x0e9b[_0x46a324];return _0x1140bd;};'use strict';var multer=require(_0xb0e9('0x0'));var util=require(_0xb0e9('0x1'));var path=require('path');var timeout=require(_0xb0e9('0x2'));var express=require(_0xb0e9('0x3'));var router=express[_0xb0e9('0x4')]();var fs_extra=require(_0xb0e9('0x5'));var auth=require(_0xb0e9('0x6'));var interaction=require(_0xb0e9('0x7'));var config=require(_0xb0e9('0x8'));var controller=require(_0xb0e9('0x9'));router[_0xb0e9('0xa')]('/',auth[_0xb0e9('0xb')](),controller['index']);router[_0xb0e9('0xa')]('/describe',auth[_0xb0e9('0xb')](),controller[_0xb0e9('0xc')]);router['get'](_0xb0e9('0xd'),auth[_0xb0e9('0xb')](),controller[_0xb0e9('0xe')]);router[_0xb0e9('0xa')](_0xb0e9('0xf'),auth['isAuthenticated'](),controller['getPresence']);router['get'](_0xb0e9('0x10'),auth['isAuthenticated'](),controller['show']);router[_0xb0e9('0xa')](_0xb0e9('0x11'),controller['getAvatar']);router[_0xb0e9('0xa')](_0xb0e9('0x12'),auth[_0xb0e9('0xb')](),controller['getOpenTabs']);router[_0xb0e9('0xa')](_0xb0e9('0x13'),auth['isAuthenticated'](),controller[_0xb0e9('0x14')]);router[_0xb0e9('0xa')](_0xb0e9('0x15'),auth['isAuthenticated'](),controller[_0xb0e9('0x16')]);router[_0xb0e9('0xa')]('/:id/queues_rt',auth[_0xb0e9('0xb')](),controller['getVoiceQueuesRt']);router['get'](_0xb0e9('0x17'),auth[_0xb0e9('0xb')](),controller[_0xb0e9('0x18')]);router[_0xb0e9('0xa')](_0xb0e9('0x19'),auth[_0xb0e9('0xb')](),controller[_0xb0e9('0x1a')]);router[_0xb0e9('0xa')](_0xb0e9('0x1b'),auth[_0xb0e9('0xb')](),controller[_0xb0e9('0x1c')]);router[_0xb0e9('0xa')](_0xb0e9('0x1d'),auth['isAuthenticated'](),controller[_0xb0e9('0x1e')]);router[_0xb0e9('0xa')](_0xb0e9('0x1f'),auth['isAuthenticated'](),controller[_0xb0e9('0x20')]);router[_0xb0e9('0xa')](_0xb0e9('0x21'),auth[_0xb0e9('0xb')](),controller['getMailInteractions']);router[_0xb0e9('0xa')]('/:id/sms/interactions',auth[_0xb0e9('0xb')](),controller['getSmsInteractions']);router[_0xb0e9('0xa')](_0xb0e9('0x22'),auth['isAuthenticated'](),controller[_0xb0e9('0x23')]);router[_0xb0e9('0xa')](_0xb0e9('0x24'),auth[_0xb0e9('0xb')](),controller[_0xb0e9('0x25')]);router[_0xb0e9('0xa')]('/:id/teams',auth[_0xb0e9('0xb')](),controller[_0xb0e9('0x26')]);router[_0xb0e9('0xa')](_0xb0e9('0x27'),auth[_0xb0e9('0xb')](),controller[_0xb0e9('0x28')]);router['get']('/:id/agents',auth[_0xb0e9('0xb')](),controller[_0xb0e9('0x29')]);router[_0xb0e9('0xa')](_0xb0e9('0x2a'),auth[_0xb0e9('0xb')](),controller[_0xb0e9('0x2b')]);router['get'](_0xb0e9('0x2c'),auth[_0xb0e9('0xb')](),controller[_0xb0e9('0x2d')]);router['get'](_0xb0e9('0x2e'),auth[_0xb0e9('0xb')](),controller[_0xb0e9('0x2f')]);router[_0xb0e9('0xa')]('/:id/openchannel_accounts',auth[_0xb0e9('0xb')](),controller[_0xb0e9('0x30')]);router[_0xb0e9('0xa')]('/:id/sms_accounts',auth[_0xb0e9('0xb')](),controller['getSmsAccounts']);router[_0xb0e9('0xa')](_0xb0e9('0x31'),auth[_0xb0e9('0xb')](),controller['getChatWebsites']);router[_0xb0e9('0xa')](_0xb0e9('0x32'),auth[_0xb0e9('0xb')](),controller[_0xb0e9('0x33')]);router[_0xb0e9('0xa')](_0xb0e9('0x34'),auth[_0xb0e9('0xb')](),controller[_0xb0e9('0x35')]);router[_0xb0e9('0xa')](_0xb0e9('0x36'),auth[_0xb0e9('0xb')](),controller[_0xb0e9('0x37')]);router[_0xb0e9('0xa')](_0xb0e9('0x38'),auth[_0xb0e9('0xb')](),controller[_0xb0e9('0x39')]);router[_0xb0e9('0x3a')](_0xb0e9('0x13'),auth['isAuthenticated'](),controller['addContacts']);router[_0xb0e9('0x3a')]('/',auth[_0xb0e9('0xb')](),controller[_0xb0e9('0x3b')]);router[_0xb0e9('0x3a')](_0xb0e9('0x3c'),auth[_0xb0e9('0xb')](),controller[_0xb0e9('0x3d')]);router['post']('/:id/queues',auth[_0xb0e9('0xb')](),controller['addQueues']);var upload=multer({'storage':multer[_0xb0e9('0x3e')]({'destination':function(_0x35d19c,_0x3dd389,_0x37d768){_0x37d768(null,path[_0xb0e9('0x3f')](config['root'],_0xb0e9('0x40')));},'filename':function(_0x2c2e48,_0x26e89c,_0x2c9b8f){_0x2c9b8f(null,util['format'](_0xb0e9('0x41'),Date['now'](),_0x26e89c['originalname']));}})});router['post'](_0xb0e9('0x11'),upload[_0xb0e9('0x42')]('file'),controller[_0xb0e9('0x43')]);router['post'](_0xb0e9('0x44'),auth['isAuthenticated'](),controller['login']);router[_0xb0e9('0x3a')]('/:id/logout',auth[_0xb0e9('0xb')](),controller[_0xb0e9('0x45')]);router[_0xb0e9('0x3a')](_0xb0e9('0x46'),auth['isAuthenticated'](),controller['pause']);router[_0xb0e9('0x3a')]('/:id/unpause',auth['isAuthenticated'](),controller['unpause']);router[_0xb0e9('0x3a')](_0xb0e9('0x47'),auth[_0xb0e9('0xb')](),controller['addTeams']);router[_0xb0e9('0x3a')](_0xb0e9('0x48'),auth['isAuthenticated'](),controller[_0xb0e9('0x49')]);router[_0xb0e9('0x3a')]('/:id/mail_interactions',auth['isAuthenticated'](),controller[_0xb0e9('0x4a')]);router[_0xb0e9('0x3a')](_0xb0e9('0x4b'),auth['isAuthenticated'](),controller[_0xb0e9('0x4c')]);router[_0xb0e9('0x3a')](_0xb0e9('0x4d'),auth[_0xb0e9('0xb')](),controller[_0xb0e9('0x4e')]);router['post'](_0xb0e9('0x4f'),auth[_0xb0e9('0xb')](),controller['addOpenchannelInteractions']);router[_0xb0e9('0x3a')](_0xb0e9('0x50'),auth[_0xb0e9('0xb')](),controller[_0xb0e9('0x51')]);router[_0xb0e9('0x3a')](_0xb0e9('0x2c'),auth['isAuthenticated'](),controller['addFaxAccounts']);router[_0xb0e9('0x3a')](_0xb0e9('0x2e'),auth[_0xb0e9('0xb')](),controller['addMailAccounts']);router[_0xb0e9('0x3a')](_0xb0e9('0x52'),auth[_0xb0e9('0xb')](),controller[_0xb0e9('0x53')]);router[_0xb0e9('0x3a')]('/:id/sms_accounts',auth[_0xb0e9('0xb')](),controller[_0xb0e9('0x54')]);router[_0xb0e9('0x3a')](_0xb0e9('0x31'),auth[_0xb0e9('0xb')](),controller[_0xb0e9('0x55')]);router[_0xb0e9('0x3a')]('/:id/whatsapp_accounts',auth['isAuthenticated'](),controller[_0xb0e9('0x56')]);router['post']('/:id/square_projects',auth[_0xb0e9('0xb')](),controller[_0xb0e9('0x57')]);router[_0xb0e9('0x3a')](_0xb0e9('0x38'),auth[_0xb0e9('0xb')](),controller[_0xb0e9('0x58')]);router[_0xb0e9('0x59')](_0xb0e9('0x10'),auth[_0xb0e9('0xb')](),controller['update']);router[_0xb0e9('0x59')](_0xb0e9('0x5a'),auth['isAuthenticated'](),controller['changePassword']);router[_0xb0e9('0x5b')]('/:id/queues',auth[_0xb0e9('0xb')](),controller['removeQueues']);router[_0xb0e9('0x5b')](_0xb0e9('0x47'),auth[_0xb0e9('0xb')](),controller[_0xb0e9('0x5c')]);router[_0xb0e9('0x5b')]('/:id',auth[_0xb0e9('0xb')](),controller['destroy']);router['delete'](_0xb0e9('0x48'),auth['isAuthenticated'](),controller['removeChatInteractions']);router['delete'](_0xb0e9('0x5d'),auth['isAuthenticated'](),controller[_0xb0e9('0x5e')]);router[_0xb0e9('0x5b')](_0xb0e9('0x4b'),auth['isAuthenticated'](),controller[_0xb0e9('0x5f')]);router[_0xb0e9('0x5b')](_0xb0e9('0x4d'),auth[_0xb0e9('0xb')](),controller['removeSmsInteractions']);router[_0xb0e9('0x5b')](_0xb0e9('0x4f'),auth[_0xb0e9('0xb')](),controller[_0xb0e9('0x60')]);router[_0xb0e9('0x5b')](_0xb0e9('0x50'),auth[_0xb0e9('0xb')](),controller['removeWhatsappInteractions']);router[_0xb0e9('0x5b')]('/:id/fax_accounts',auth['isAuthenticated'](),controller['removeFaxAccounts']);router['delete'](_0xb0e9('0x2e'),auth[_0xb0e9('0xb')](),controller[_0xb0e9('0x61')]);router[_0xb0e9('0x5b')](_0xb0e9('0x52'),auth['isAuthenticated'](),controller[_0xb0e9('0x62')]);router[_0xb0e9('0x5b')]('/:id/sms_accounts',auth[_0xb0e9('0xb')](),controller['removeSmsAccounts']);router['delete']('/:id/chat_websites',auth[_0xb0e9('0xb')](),controller[_0xb0e9('0x63')]);router[_0xb0e9('0x5b')](_0xb0e9('0x32'),auth['isAuthenticated'](),controller['removeWhatsappAccounts']);router[_0xb0e9('0x5b')](_0xb0e9('0x34'),auth[_0xb0e9('0xb')](),controller['removeSquareProjects']);router[_0xb0e9('0x5b')](_0xb0e9('0x38'),auth[_0xb0e9('0xb')](),controller[_0xb0e9('0x64')]);module[_0xb0e9('0x65')]=router; \ No newline at end of file +var _0xd3b6=['put','update','/:id/password','changePassword','removeQueues','delete','removeTeams','destroy','/:id/chat_interactions','removeChatInteractions','/:id/mail_interactions','removeMailInteractions','removeFaxInteractions','removeSmsInteractions','removeOpenchannelInteractions','removeWhatsappInteractions','removeFaxAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeWhatsappAccounts','removeSquareProjects','exports','util','path','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','whoami','getPresence','/:id','show','/:id/avatar','getAvatar','/:id/open_tabs','getOpenTabs','/:id/contacts','getContacts','/:id/queues','getQueues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','getGroups','/:id/recordings','/:id/screen_recordings','getScreenRecordings','getChatInteractions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','/:id/teams','getTeams','/:id/lists','getLists','/:id/agents','getAgents','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','getSmsAccounts','getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/square_projects','getSquareProjects','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','getApiKey','post','addContacts','create','/create_many','addQueues','format','%s-%s','now','originalname','single','file','addAvatar','/:id/login','login','/:id/logout','logout','/:id/pause','pause','/:id/unpause','addTeams','addMailInteractions','/:id/fax_interactions','/:id/sms_interactions','addSmsInteractions','addOpenchannelInteractions','/:id/whatsapp_interactions','addFaxAccounts','addMailAccounts','addOpenchannelAccounts','addSmsAccounts','/:id/chat_websites','addChatWebsites','addWhatsappAccounts','addSquareProjects'];(function(_0x5c389f,_0x516f81){var _0x3c8fc4=function(_0x191683){while(--_0x191683){_0x5c389f['push'](_0x5c389f['shift']());}};_0x3c8fc4(++_0x516f81);}(_0xd3b6,0x16c));var _0x6d3b=function(_0x2bf481,_0xc37357){_0x2bf481=_0x2bf481-0x0;var _0x5208e6=_0xd3b6[_0x2bf481];return _0x5208e6;};'use strict';var multer=require('multer');var util=require(_0x6d3b('0x0'));var path=require(_0x6d3b('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x6d3b('0x2'));var interaction=require(_0x6d3b('0x3'));var config=require(_0x6d3b('0x4'));var controller=require('./user.controller');router[_0x6d3b('0x5')]('/',auth[_0x6d3b('0x6')](),controller[_0x6d3b('0x7')]);router['get']('/describe',auth[_0x6d3b('0x6')](),controller[_0x6d3b('0x8')]);router['get']('/whoami',auth[_0x6d3b('0x6')](),controller[_0x6d3b('0x9')]);router[_0x6d3b('0x5')]('/presence',auth[_0x6d3b('0x6')](),controller[_0x6d3b('0xa')]);router[_0x6d3b('0x5')](_0x6d3b('0xb'),auth['isAuthenticated'](),controller[_0x6d3b('0xc')]);router[_0x6d3b('0x5')](_0x6d3b('0xd'),controller[_0x6d3b('0xe')]);router[_0x6d3b('0x5')](_0x6d3b('0xf'),auth[_0x6d3b('0x6')](),controller[_0x6d3b('0x10')]);router[_0x6d3b('0x5')](_0x6d3b('0x11'),auth['isAuthenticated'](),controller[_0x6d3b('0x12')]);router['get'](_0x6d3b('0x13'),auth['isAuthenticated'](),controller[_0x6d3b('0x14')]);router[_0x6d3b('0x5')](_0x6d3b('0x15'),auth['isAuthenticated'](),controller[_0x6d3b('0x16')]);router[_0x6d3b('0x5')](_0x6d3b('0x17'),auth[_0x6d3b('0x6')](),controller[_0x6d3b('0x18')]);router['get'](_0x6d3b('0x19'),auth['isAuthenticated'](),controller['getRecordings']);router[_0x6d3b('0x5')](_0x6d3b('0x1a'),auth[_0x6d3b('0x6')](),controller[_0x6d3b('0x1b')]);router['get']('/:id/chat/interactions',auth[_0x6d3b('0x6')](),controller[_0x6d3b('0x1c')]);router['get']('/:id/openchannel/interactions',auth['isAuthenticated'](),controller[_0x6d3b('0x1d')]);router[_0x6d3b('0x5')](_0x6d3b('0x1e'),auth[_0x6d3b('0x6')](),controller[_0x6d3b('0x1f')]);router[_0x6d3b('0x5')](_0x6d3b('0x20'),auth[_0x6d3b('0x6')](),controller[_0x6d3b('0x21')]);router['get'](_0x6d3b('0x22'),auth[_0x6d3b('0x6')](),controller['getFaxInteractions']);router[_0x6d3b('0x5')]('/:id/whatsapp/interactions',auth[_0x6d3b('0x6')](),controller['getWhatsappInteractions']);router[_0x6d3b('0x5')](_0x6d3b('0x23'),auth[_0x6d3b('0x6')](),controller[_0x6d3b('0x24')]);router[_0x6d3b('0x5')](_0x6d3b('0x25'),auth['isAuthenticated'](),controller[_0x6d3b('0x26')]);router[_0x6d3b('0x5')](_0x6d3b('0x27'),auth[_0x6d3b('0x6')](),controller[_0x6d3b('0x28')]);router[_0x6d3b('0x5')]('/:id/prefixes',auth['isAuthenticated'](),controller[_0x6d3b('0x29')]);router[_0x6d3b('0x5')](_0x6d3b('0x2a'),auth[_0x6d3b('0x6')](),controller[_0x6d3b('0x2b')]);router[_0x6d3b('0x5')](_0x6d3b('0x2c'),auth[_0x6d3b('0x6')](),controller[_0x6d3b('0x2d')]);router['get'](_0x6d3b('0x2e'),auth[_0x6d3b('0x6')](),controller[_0x6d3b('0x2f')]);router['get']('/:id/sms_accounts',auth[_0x6d3b('0x6')](),controller[_0x6d3b('0x30')]);router['get']('/:id/chat_websites',auth[_0x6d3b('0x6')](),controller[_0x6d3b('0x31')]);router[_0x6d3b('0x5')](_0x6d3b('0x32'),auth[_0x6d3b('0x6')](),controller[_0x6d3b('0x33')]);router[_0x6d3b('0x5')](_0x6d3b('0x34'),auth[_0x6d3b('0x6')](),controller[_0x6d3b('0x35')]);router['get'](_0x6d3b('0x36'),auth[_0x6d3b('0x6')](),controller[_0x6d3b('0x37')]);router[_0x6d3b('0x5')](_0x6d3b('0x38'),auth[_0x6d3b('0x6')](),controller[_0x6d3b('0x39')]);router[_0x6d3b('0x3a')](_0x6d3b('0x11'),auth[_0x6d3b('0x6')](),controller[_0x6d3b('0x3b')]);router[_0x6d3b('0x3a')]('/',auth['isAuthenticated'](),controller[_0x6d3b('0x3c')]);router[_0x6d3b('0x3a')](_0x6d3b('0x3d'),auth['isAuthenticated'](),controller['bulkCreate']);router[_0x6d3b('0x3a')](_0x6d3b('0x13'),auth[_0x6d3b('0x6')](),controller[_0x6d3b('0x3e')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x45f8d1,_0x24eddb,_0x12f736){_0x12f736(null,path['join'](config['root'],'server/files/images/'));},'filename':function(_0xf5fcc2,_0x29fd9b,_0x73c62d){_0x73c62d(null,util[_0x6d3b('0x3f')](_0x6d3b('0x40'),Date[_0x6d3b('0x41')](),_0x29fd9b[_0x6d3b('0x42')]));}})});router['post'](_0x6d3b('0xd'),upload[_0x6d3b('0x43')](_0x6d3b('0x44')),controller[_0x6d3b('0x45')]);router[_0x6d3b('0x3a')](_0x6d3b('0x46'),auth['isAuthenticated'](),controller[_0x6d3b('0x47')]);router[_0x6d3b('0x3a')](_0x6d3b('0x48'),auth['isAuthenticated'](),controller[_0x6d3b('0x49')]);router[_0x6d3b('0x3a')](_0x6d3b('0x4a'),auth[_0x6d3b('0x6')](),controller[_0x6d3b('0x4b')]);router[_0x6d3b('0x3a')](_0x6d3b('0x4c'),auth['isAuthenticated'](),controller['unpause']);router[_0x6d3b('0x3a')]('/:id/teams',auth[_0x6d3b('0x6')](),controller[_0x6d3b('0x4d')]);router[_0x6d3b('0x3a')]('/:id/chat_interactions',auth[_0x6d3b('0x6')](),controller['addChatInteractions']);router['post']('/:id/mail_interactions',auth[_0x6d3b('0x6')](),controller[_0x6d3b('0x4e')]);router[_0x6d3b('0x3a')](_0x6d3b('0x4f'),auth[_0x6d3b('0x6')](),controller['addFaxInteractions']);router['post'](_0x6d3b('0x50'),auth['isAuthenticated'](),controller[_0x6d3b('0x51')]);router[_0x6d3b('0x3a')]('/:id/openchannel_interactions',auth[_0x6d3b('0x6')](),controller[_0x6d3b('0x52')]);router[_0x6d3b('0x3a')](_0x6d3b('0x53'),auth[_0x6d3b('0x6')](),controller['addWhatsappInteractions']);router[_0x6d3b('0x3a')](_0x6d3b('0x2a'),auth[_0x6d3b('0x6')](),controller[_0x6d3b('0x54')]);router[_0x6d3b('0x3a')](_0x6d3b('0x2c'),auth[_0x6d3b('0x6')](),controller[_0x6d3b('0x55')]);router[_0x6d3b('0x3a')](_0x6d3b('0x2e'),auth[_0x6d3b('0x6')](),controller[_0x6d3b('0x56')]);router[_0x6d3b('0x3a')]('/:id/sms_accounts',auth[_0x6d3b('0x6')](),controller[_0x6d3b('0x57')]);router[_0x6d3b('0x3a')](_0x6d3b('0x58'),auth['isAuthenticated'](),controller[_0x6d3b('0x59')]);router[_0x6d3b('0x3a')]('/:id/whatsapp_accounts',auth[_0x6d3b('0x6')](),controller[_0x6d3b('0x5a')]);router[_0x6d3b('0x3a')](_0x6d3b('0x34'),auth[_0x6d3b('0x6')](),controller[_0x6d3b('0x5b')]);router[_0x6d3b('0x3a')]('/:id/api_key',auth[_0x6d3b('0x6')](),controller['createApiKey']);router[_0x6d3b('0x5c')](_0x6d3b('0xb'),auth[_0x6d3b('0x6')](),controller[_0x6d3b('0x5d')]);router['put'](_0x6d3b('0x5e'),auth[_0x6d3b('0x6')](),controller[_0x6d3b('0x5f')]);router['delete'](_0x6d3b('0x13'),auth[_0x6d3b('0x6')](),controller[_0x6d3b('0x60')]);router[_0x6d3b('0x61')](_0x6d3b('0x23'),auth[_0x6d3b('0x6')](),controller[_0x6d3b('0x62')]);router[_0x6d3b('0x61')](_0x6d3b('0xb'),auth[_0x6d3b('0x6')](),controller[_0x6d3b('0x63')]);router['delete'](_0x6d3b('0x64'),auth['isAuthenticated'](),controller[_0x6d3b('0x65')]);router[_0x6d3b('0x61')](_0x6d3b('0x66'),auth['isAuthenticated'](),controller[_0x6d3b('0x67')]);router['delete'](_0x6d3b('0x4f'),auth[_0x6d3b('0x6')](),controller[_0x6d3b('0x68')]);router[_0x6d3b('0x61')](_0x6d3b('0x50'),auth[_0x6d3b('0x6')](),controller[_0x6d3b('0x69')]);router['delete']('/:id/openchannel_interactions',auth[_0x6d3b('0x6')](),controller[_0x6d3b('0x6a')]);router['delete'](_0x6d3b('0x53'),auth[_0x6d3b('0x6')](),controller[_0x6d3b('0x6b')]);router[_0x6d3b('0x61')](_0x6d3b('0x2a'),auth[_0x6d3b('0x6')](),controller[_0x6d3b('0x6c')]);router[_0x6d3b('0x61')]('/:id/mail_accounts',auth[_0x6d3b('0x6')](),controller['removeMailAccounts']);router['delete'](_0x6d3b('0x2e'),auth[_0x6d3b('0x6')](),controller[_0x6d3b('0x6d')]);router[_0x6d3b('0x61')]('/:id/sms_accounts',auth[_0x6d3b('0x6')](),controller[_0x6d3b('0x6e')]);router[_0x6d3b('0x61')](_0x6d3b('0x58'),auth[_0x6d3b('0x6')](),controller['removeChatWebsites']);router['delete']('/:id/whatsapp_accounts',auth[_0x6d3b('0x6')](),controller[_0x6d3b('0x6f')]);router[_0x6d3b('0x61')](_0x6d3b('0x34'),auth[_0x6d3b('0x6')](),controller[_0x6d3b('0x70')]);router['delete'](_0x6d3b('0x38'),auth[_0x6d3b('0x6')](),controller['removeApiKey']);module[_0x6d3b('0x71')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index 480fb21..eec9188 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 _0xf3fe=['UNSIGNED','moment','util','lodash','exports','STRING','setDataValue','name','defaultuser','fullname','callerid','format','\x22%s\x22\x20<%s>','getDataValue','internal','email','toLowerCase','admin','user','telephone','INTEGER','accountcode','BOOLEAN','DATE','DEFAULT\x20PAUSE','dynamic','ENUM','friend','from-sip','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_FAILED_SCREEN','PROHIB','udp','transport','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','info','inband','rfc2833','update','outgoing','yes','force_rport,comedia','nat','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','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>','always','accept','originate','uac','uas','fingerprint','certificate','active','passive','actpass','nonat','update,nonat','TEXT','showWebBar','get','wss','encryption','avpf','icesupport','dtlsenable','dtlsverify','dtlscertfile','dtlsprivatekey','rtcp_mux','force_avp','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','screenrecording','blockedAt','loginAttempts'];(function(_0x3cdd81,_0x262e38){var _0x5d4275=function(_0x26c344){while(--_0x26c344){_0x3cdd81['push'](_0x3cdd81['shift']());}};_0x5d4275(++_0x262e38);}(_0xf3fe,0x1cd));var _0xef3f=function(_0x250498,_0x4f983e){_0x250498=_0x250498-0x0;var _0x5d6b81=_0xf3fe[_0x250498];return _0x5d6b81;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xef3f('0x0'));var util=require(_0xef3f('0x1'));var _=require(_0xef3f('0x2'));module[_0xef3f('0x3')]={'name':{'type':Sequelize[_0xef3f('0x4')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x29b501){this[_0xef3f('0x5')](_0xef3f('0x6'),_0x29b501);this[_0xef3f('0x5')](_0xef3f('0x7'),_0x29b501);},'comment':'The\x20name\x20of\x20the\x20user'},'fullname':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x9e20c7){this[_0xef3f('0x5')](_0xef3f('0x8'),_0x9e20c7);this[_0xef3f('0x5')](_0xef3f('0x9'),util[_0xef3f('0xa')](_0xef3f('0xb'),_0x9e20c7,this[_0xef3f('0xc')](_0xef3f('0xd'))));}},'alias':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0xef3f('0x4')],'allowNull':![],'unique':'email','validate':{'isEmail':!![]},'set':function(_0x3f47b7){if(_0x3f47b7){this[_0xef3f('0x5')](_0xef3f('0xe'),_0x3f47b7[_0xef3f('0xf')]());}}},'role':{'type':Sequelize['ENUM'](_0xef3f('0x10'),_0xef3f('0x11'),'agent',_0xef3f('0x12')),'allowNull':![]},'password':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0xef3f('0x4')],'defaultValue':'local'},'internal':{'type':Sequelize[_0xef3f('0x13')](0xb),'allowNull':![],'unique':_0xef3f('0xd'),'set':function(_0x23392e){this[_0xef3f('0x5')](_0xef3f('0xd'),_0x23392e);this[_0xef3f('0x5')](_0xef3f('0x14'),_0x23392e);this[_0xef3f('0x5')](_0xef3f('0x9'),util[_0xef3f('0xa')](_0xef3f('0xb'),this['getDataValue'](_0xef3f('0x8')),_0x23392e));}},'salt':{'type':Sequelize[_0xef3f('0x4')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0xef3f('0x4')]},'address':{'type':Sequelize[_0xef3f('0x4')]},'zipcode':{'type':Sequelize['STRING']},'userpic':{'type':Sequelize['STRING']},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize['STRING']},'online':{'type':Sequelize[_0xef3f('0x15')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0xef3f('0x16')]},'voicePause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'mailPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'faxPause':{'type':Sequelize[_0xef3f('0x15')],'defaultValue':![]},'smsPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0xef3f('0x15')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0xef3f('0x15')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0xef3f('0x4')],'defaultValue':_0xef3f('0x17')},'lastPauseAt':{'type':Sequelize['DATE']},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0xef3f('0x13')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0xef3f('0x13')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0xef3f('0x13')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0xef3f('0x13')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0xef3f('0x13')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0xef3f('0x15')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0xef3f('0x13')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0xef3f('0x13')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0xef3f('0x15')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize['INTEGER'],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0xef3f('0x15')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0xef3f('0x15')],'defaultValue':![]},'chanspy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0xef3f('0x4')],'allowNull':!![]},'host':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xef3f('0x18')},'ipaddr':{'type':Sequelize['STRING'],'allowNull':!![]},'port':{'type':Sequelize['INTEGER'](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0xef3f('0x4')],'allowNull':!![]},'regserver':{'type':Sequelize[_0xef3f('0x4')],'allowNull':!![]},'useragent':{'type':Sequelize[_0xef3f('0x4')],'allowNull':!![]},'lastms':{'type':Sequelize[_0xef3f('0x13')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0xef3f('0x19')](_0xef3f('0x1a'),'user','peer'),'allowNull':!![],'defaultValue':'friend'},'context':{'type':Sequelize[_0xef3f('0x4')],'allowNull':!![],'defaultValue':_0xef3f('0x1b')},'callingpres':{'type':Sequelize[_0xef3f('0x19')]('ALLOWED_NOT_SCREENED',_0xef3f('0x1c'),_0xef3f('0x1d'),_0xef3f('0x1e'),_0xef3f('0x1f'),'PROHIB_PASSED_SCREEN',_0xef3f('0x20'),_0xef3f('0x21')),'allowNull':!![]},'deny':{'type':Sequelize[_0xef3f('0x4')],'allowNull':!![]},'permit':{'type':Sequelize[_0xef3f('0x4')],'allowNull':!![]},'secret':{'type':Sequelize['STRING'],'allowNull':!![]},'md5secret':{'type':Sequelize[_0xef3f('0x4')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0xef3f('0x4')],'allowNull':!![]},'transport':{'type':Sequelize[_0xef3f('0x4')],'allowNull':!![],'defaultValue':_0xef3f('0x22'),'set':function(_0x5e0673){this[_0xef3f('0x5')](_0xef3f('0x23'),_0x5e0673?_0x5e0673[_0xef3f('0x24')](','):null);},'get':function(){return this['getDataValue'](_0xef3f('0x23'))?this[_0xef3f('0xc')](_0xef3f('0x23'))[_0xef3f('0x25')](','):null;},'comment':_0xef3f('0x26')},'dtmfmode':{'type':Sequelize[_0xef3f('0x19')]('rfc2833',_0xef3f('0x27'),'shortinfo',_0xef3f('0x28'),'auto'),'allowNull':!![],'defaultValue':_0xef3f('0x29')},'directmedia':{'type':Sequelize['ENUM']('yes','no','nonat',_0xef3f('0x2a'),_0xef3f('0x2b')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xef3f('0x19')](_0xef3f('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xef3f('0x4')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0xef3f('0x4')],'allowNull':!![]},'nat':{'type':Sequelize[_0xef3f('0x4')],'allowNull':!![],'defaultValue':_0xef3f('0x2d'),'set':function(_0x5c6651){this[_0xef3f('0x5')](_0xef3f('0x2e'),_0x5c6651?_0x5c6651[_0xef3f('0x24')](','):null);},'get':function(){return this[_0xef3f('0xc')](_0xef3f('0x2e'))?this[_0xef3f('0xc')](_0xef3f('0x2e'))[_0xef3f('0x25')](','):null;},'comment':_0xef3f('0x2f')},'callgroup':{'type':Sequelize[_0xef3f('0x4')]},'namedcallgroup':{'type':Sequelize[_0xef3f('0x4')]},'pickupgroup':{'type':Sequelize[_0xef3f('0x4')]},'namedpickupgroup':{'type':Sequelize[_0xef3f('0x4')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xef3f('0x4')]},'disallow':{'type':Sequelize[_0xef3f('0x4')],'allowNull':![],'defaultValue':'all'},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xef3f('0x30'),'set':function(_0x5a7974){this[_0xef3f('0x5')](_0xef3f('0x31'),_0x5a7974?_0x5a7974[_0xef3f('0x24')](';'):_0xef3f('0x30'));},'get':function(){return this[_0xef3f('0xc')]('allow')?this[_0xef3f('0xc')](_0xef3f('0x31'))[_0xef3f('0x25')](';'):null;},'comment':_0xef3f('0x32')},'autoframing':{'type':Sequelize[_0xef3f('0x19')](_0xef3f('0x2c'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize['STRING'],'allowNull':!![],'set':function(_0x455cf7){this[_0xef3f('0x5')](_0xef3f('0x33'),_0x455cf7?_0x455cf7['join'](','):null);},'get':function(){return this['getDataValue'](_0xef3f('0x33'))?this[_0xef3f('0xc')](_0xef3f('0x33'))['split'](','):null;},'comment':_0xef3f('0x34')},'trustrpid':{'type':Sequelize[_0xef3f('0x19')](_0xef3f('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xef3f('0x19')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xef3f('0x19')](_0xef3f('0x2c'),'no',_0xef3f('0x35')),'allowNull':!![]},'promiscredir':{'type':Sequelize['ENUM'](_0xef3f('0x2c'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0xef3f('0x19')](_0xef3f('0x2c'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0xef3f('0x13')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize['STRING'],'allowNull':!![]},'callerid':{'type':Sequelize[_0xef3f('0x4')],'allowNull':!![],'defaultValue':_0xef3f('0x36')},'amaflags':{'type':Sequelize[_0xef3f('0x4')],'allowNull':!![]},'callcounter':{'type':Sequelize['ENUM'](_0xef3f('0x2c'),'no'),'allowNull':!![],'defaultValue':_0xef3f('0x2c')},'busylevel':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0xef3f('0x19')](_0xef3f('0x2c'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0xef3f('0x19')]('yes','no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0xef3f('0x19')]('yes','no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0xef3f('0x19')](_0xef3f('0x2c'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize['STRING'],'allowNull':!![]},'template':{'type':Sequelize[_0xef3f('0x4')],'allowNull':!![]},'videosupport':{'type':Sequelize['ENUM'](_0xef3f('0x2c'),'no',_0xef3f('0x37')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xef3f('0x13')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0xef3f('0x19')]('yes','no'),'allowNull':!![]},'mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'session_timers':{'type':Sequelize[_0xef3f('0x19')](_0xef3f('0x38'),'refuse',_0xef3f('0x39')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0xef3f('0x13')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0xef3f('0x13')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0xef3f('0x19')](_0xef3f('0x3a'),_0xef3f('0x3b')),'allowNull':!![],'defaultValue':_0xef3f('0x3b')},'t38pt_usertpsource':{'type':Sequelize[_0xef3f('0x4')],'allowNull':!![]},'regexten':{'type':Sequelize[_0xef3f('0x4')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0xef3f('0x4')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0xef3f('0x4')],'allowNull':!![]},'qualify':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':_0xef3f('0x2c')},'keepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0xef3f('0x4')],'allowNull':!![]},'defaultuser':{'type':Sequelize['STRING'],'allowNull':!![]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0xef3f('0x13')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0xef3f('0x19')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING'],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0xef3f('0x4')],'allowNull':!![]},'timert1':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'timerb':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0xef3f('0x13')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize['STRING'],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0xef3f('0x4')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0xef3f('0x4')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0xef3f('0x4')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0xef3f('0x13')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0xef3f('0x19')](_0xef3f('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0xef3f('0x2c'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'icesupport':{'type':Sequelize['ENUM'](_0xef3f('0x2c'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0xef3f('0x19')](_0xef3f('0x2c'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0xef3f('0x19')](_0xef3f('0x2c'),'no',_0xef3f('0x3c'),_0xef3f('0x3d')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0xef3f('0x4')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0xef3f('0x4')],'allowNull':!![]},'dtlscipher':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0xef3f('0x4')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0xef3f('0x4')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0xef3f('0x19')](_0xef3f('0x3e'),_0xef3f('0x3f'),_0xef3f('0x40')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xef3f('0x4')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0xef3f('0x19')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xef3f('0x4')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0xef3f('0x4')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0xef3f('0x13')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize['ENUM'](_0xef3f('0x2c'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0xef3f('0x19')](_0xef3f('0x2c'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize['STRING'],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0xef3f('0x4')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0xef3f('0x4')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0xef3f('0x4')],'allowNull':!![]},'canreinvite':{'type':Sequelize['ENUM'](_0xef3f('0x2c'),'no',_0xef3f('0x41'),_0xef3f('0x2a'),_0xef3f('0x42')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0xef3f('0x15')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0xef3f('0x4')]},'resetPasswordExpires':{'type':Sequelize[_0xef3f('0x16')]},'passwordResetAt':{'type':Sequelize[_0xef3f('0x16')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0xef3f('0x43')]},'showWebBar':{'type':Sequelize[_0xef3f('0x13')],'defaultValue':0x0,'set':function(_0x662347){this['setDataValue'](_0xef3f('0x44'),_0x662347);var _0xb3e587=this[_0xef3f('0x45')]({'plain':!![]});switch(_0x662347){case 0x0:case 0x1:var _0x3e0f99=_0xb3e587[_0xef3f('0x23')]?_['isArray'](_0xb3e587['transport'])?_0xb3e587[_0xef3f('0x23')]['join']():_0xb3e587[_0xef3f('0x23')]:_0xef3f('0x22');if(_0x3e0f99===_0xef3f('0x46')){_0x3e0f99=_0xef3f('0x22');}this[_0xef3f('0x5')](_0xef3f('0x23'),_0x3e0f99);this[_0xef3f('0x5')](_0xef3f('0x47'),'no');this[_0xef3f('0x5')](_0xef3f('0x48'),null);this['setDataValue']('force_avp',null);this['setDataValue'](_0xef3f('0x49'),null);this[_0xef3f('0x5')](_0xef3f('0x4a'),null);this['setDataValue'](_0xef3f('0x4b'),null);this['setDataValue']('dtlssetup',null);this['setDataValue'](_0xef3f('0x4c'),null);this[_0xef3f('0x5')](_0xef3f('0x4d'),null);this[_0xef3f('0x5')](_0xef3f('0x4e'),'no');break;case 0x2:this[_0xef3f('0x5')](_0xef3f('0x23'),_0xef3f('0x46'));this['setDataValue'](_0xef3f('0x47'),_0xef3f('0x2c'));this['setDataValue']('avpf',_0xef3f('0x2c'));this[_0xef3f('0x5')](_0xef3f('0x4f'),_0xef3f('0x2c'));this['setDataValue'](_0xef3f('0x49'),_0xef3f('0x2c'));this['setDataValue']('dtlsenable',_0xef3f('0x2c'));this[_0xef3f('0x5')](_0xef3f('0x4b'),'no');this['setDataValue']('dtlssetup','actpass');this['setDataValue'](_0xef3f('0x4c'),_0xb3e587['dtlscertfile']||_0xef3f('0x50'));this[_0xef3f('0x5')](_0xef3f('0x4d'),_0xb3e587[_0xef3f('0x4d')]||_0xef3f('0x51'));this[_0xef3f('0x5')](_0xef3f('0x4e'),_0xef3f('0x2c'));break;default:}}},'permissions':{'type':Sequelize[_0xef3f('0x43')],'set':function(_0xfb3567){this[_0xef3f('0x5')](_0xef3f('0x52'),_0xfb3567?_0xfb3567[_0xef3f('0x24')](','):[]);},'get':function(){return this['getDataValue'](_0xef3f('0x52'))?_[_0xef3f('0x53')](this[_0xef3f('0xc')](_0xef3f('0x52'))[_0xef3f('0x25')](','),function(_0x44b5e0){return parseInt(_0x44b5e0,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0xef3f('0x4')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0xef3f('0x4')]},'phoneBarBusyNumber':{'type':Sequelize['STRING']},'phoneBarUnconditional':{'type':Sequelize[_0xef3f('0x15')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0xef3f('0x15')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0xef3f('0x15')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0xef3f('0x15')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0xef3f('0x15')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0xef3f('0x4')],'defaultValue':''},'crudPermissions':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0xef3f('0x15')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0xef3f('0x4')]},'phoneBarEnableJaws':{'type':Sequelize[_0xef3f('0x15')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0xef3f('0x15')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0xef3f('0x54')],'get':function(){return this[_0xef3f('0xc')]('phoneBarEnableScreenRecordingByAgent')?this[_0xef3f('0xc')](_0xef3f('0x55')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hotdesk':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'interface':{'type':Sequelize['STRING'],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0xef3f('0x15')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0xef3f('0x4')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0xef3f('0x4')],'allowNull':!![]},'screenrecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x2894a6){if(typeof _0x2894a6===_0xef3f('0x56')){var _0x10df39=_0x2894a6==='1'?!![]:_0x2894a6==='0'?![]:_0x2894a6===_0xef3f('0x57')?!![]:_0x2894a6==='false'?![]:![];this[_0xef3f('0x5')](_0xef3f('0x58'),_0x10df39);}else{this[_0xef3f('0x5')](_0xef3f('0x58'),_0x2894a6);}}},'blocked':{'type':Sequelize[_0xef3f('0x15')],'defaultValue':![],'set':function(_0x2da8f1){this[_0xef3f('0x5')]('blocked',_0x2da8f1);if(_0x2da8f1===!![]){this[_0xef3f('0x5')](_0xef3f('0x59'),moment());this[_0xef3f('0x5')](_0xef3f('0x5a'),0x0);}else{this[_0xef3f('0x5')](_0xef3f('0x59'),null);}}},'blockedAt':{'type':Sequelize['DATE'],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0xef3f('0x13')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0xef3f('0x15')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0xef3f('0x13')](0x5)[_0xef3f('0x5b')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0xef3f('0x15')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xef3f('0x15')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xef3f('0x15')],'defaultValue':!![]}}; \ No newline at end of file +var _0x04cc=['sequelize','moment','util','lodash','STRING','setDataValue','name','defaultuser','The\x20name\x20of\x20the\x20user','fullname','callerid','format','\x22%s\x22\x20<%s>','getDataValue','internal','email','toLowerCase','ENUM','admin','user','local','INTEGER','accountcode','BOOLEAN','DATE','DEFAULT\x20PAUSE','dynamic','friend','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','udp','join','transport','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','yes','nonat','update','outgoing','nat','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>','always','accept','refuse','originate','uas','fingerprint','certificate','active','actpass','update,nonat','TEXT','showWebBar','get','isArray','wss','encryption','avpf','force_avp','dtlsverify','dtlssetup','dtlsprivatekey','icesupport','dtlsenable','dtlscertfile','rtcp_mux','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','screenrecording','blocked','blockedAt','loginAttempts','UNSIGNED'];(function(_0x1b349a,_0x22222c){var _0x5d1f7c=function(_0x368d7c){while(--_0x368d7c){_0x1b349a['push'](_0x1b349a['shift']());}};_0x5d1f7c(++_0x22222c);}(_0x04cc,0x11a));var _0xc04c=function(_0x1082ca,_0xf509b1){_0x1082ca=_0x1082ca-0x0;var _0x36ecc0=_0x04cc[_0x1082ca];return _0x36ecc0;};'use strict';var Sequelize=require(_0xc04c('0x0'));var moment=require(_0xc04c('0x1'));var util=require(_0xc04c('0x2'));var _=require(_0xc04c('0x3'));module['exports']={'name':{'type':Sequelize[_0xc04c('0x4')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x4cca40){this[_0xc04c('0x5')](_0xc04c('0x6'),_0x4cca40);this[_0xc04c('0x5')](_0xc04c('0x7'),_0x4cca40);},'comment':_0xc04c('0x8')},'fullname':{'type':Sequelize[_0xc04c('0x4')],'allowNull':![],'set':function(_0x5c32d8){this['setDataValue'](_0xc04c('0x9'),_0x5c32d8);this[_0xc04c('0x5')](_0xc04c('0xa'),util[_0xc04c('0xb')](_0xc04c('0xc'),_0x5c32d8,this[_0xc04c('0xd')](_0xc04c('0xe'))));}},'alias':{'type':Sequelize[_0xc04c('0x4')]},'email':{'type':Sequelize['STRING'],'allowNull':![],'unique':'email','validate':{'isEmail':!![]},'set':function(_0x1e7ced){if(_0x1e7ced){this[_0xc04c('0x5')](_0xc04c('0xf'),_0x1e7ced[_0xc04c('0x10')]());}}},'role':{'type':Sequelize[_0xc04c('0x11')](_0xc04c('0x12'),_0xc04c('0x13'),'agent','telephone'),'allowNull':![]},'password':{'type':Sequelize[_0xc04c('0x4')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize['STRING'],'defaultValue':_0xc04c('0x14')},'internal':{'type':Sequelize[_0xc04c('0x15')](0xb),'allowNull':![],'unique':_0xc04c('0xe'),'set':function(_0x23e500){this['setDataValue'](_0xc04c('0xe'),_0x23e500);this[_0xc04c('0x5')](_0xc04c('0x16'),_0x23e500);this[_0xc04c('0x5')]('callerid',util['format']('\x22%s\x22\x20<%s>',this[_0xc04c('0xd')](_0xc04c('0x9')),_0x23e500));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0xc04c('0x4')]},'mobile':{'type':Sequelize['STRING']},'address':{'type':Sequelize[_0xc04c('0x4')]},'zipcode':{'type':Sequelize[_0xc04c('0x4')]},'userpic':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0xc04c('0x4')]},'country':{'type':Sequelize[_0xc04c('0x4')]},'online':{'type':Sequelize[_0xc04c('0x17')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0xc04c('0x18')]},'voicePause':{'type':Sequelize[_0xc04c('0x17')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0xc04c('0x17')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0xc04c('0x17')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0xc04c('0x17')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0xc04c('0x17')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0xc04c('0x17')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0xc04c('0x17')],'defaultValue':![]},'pauseType':{'type':Sequelize['STRING'],'defaultValue':_0xc04c('0x19')},'lastPauseAt':{'type':Sequelize[_0xc04c('0x18')]},'chatCapacity':{'type':Sequelize[_0xc04c('0x15')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0xc04c('0x15')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0xc04c('0x15')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0xc04c('0x15')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0xc04c('0x15')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0xc04c('0x15')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0xc04c('0x17')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0xc04c('0x17')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0xc04c('0x15')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0xc04c('0x15')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0xc04c('0x17')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0xc04c('0x17')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0xc04c('0x17')],'defaultValue':![]},'description':{'type':Sequelize[_0xc04c('0x4')],'allowNull':!![]},'host':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xc04c('0x1a')},'ipaddr':{'type':Sequelize[_0xc04c('0x4')],'allowNull':!![]},'port':{'type':Sequelize[_0xc04c('0x15')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0xc04c('0x15')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0xc04c('0x4')],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize[_0xc04c('0x4')],'allowNull':!![]},'lastms':{'type':Sequelize[_0xc04c('0x15')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0xc04c('0x11')]('friend',_0xc04c('0x13'),'peer'),'allowNull':!![],'defaultValue':_0xc04c('0x1b')},'context':{'type':Sequelize[_0xc04c('0x4')],'allowNull':!![],'defaultValue':_0xc04c('0x1c')},'callingpres':{'type':Sequelize['ENUM'](_0xc04c('0x1d'),'ALLOWED_PASSED_SCREEN',_0xc04c('0x1e'),_0xc04c('0x1f'),_0xc04c('0x20'),_0xc04c('0x21'),_0xc04c('0x22'),'PROHIB'),'allowNull':!![]},'deny':{'type':Sequelize[_0xc04c('0x4')],'allowNull':!![]},'permit':{'type':Sequelize['STRING'],'allowNull':!![]},'secret':{'type':Sequelize[_0xc04c('0x4')],'allowNull':!![]},'md5secret':{'type':Sequelize['STRING'],'allowNull':!![]},'remotesecret':{'type':Sequelize['STRING'],'allowNull':!![]},'transport':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xc04c('0x23'),'set':function(_0x2b4b82){this['setDataValue']('transport',_0x2b4b82?_0x2b4b82[_0xc04c('0x24')](','):null);},'get':function(){return this[_0xc04c('0xd')](_0xc04c('0x25'))?this[_0xc04c('0xd')]('transport')[_0xc04c('0x26')](','):null;},'comment':_0xc04c('0x27')},'dtmfmode':{'type':Sequelize[_0xc04c('0x11')](_0xc04c('0x28'),_0xc04c('0x29'),_0xc04c('0x2a'),_0xc04c('0x2b'),_0xc04c('0x2c')),'allowNull':!![],'defaultValue':_0xc04c('0x28')},'directmedia':{'type':Sequelize['ENUM'](_0xc04c('0x2d'),'no',_0xc04c('0x2e'),_0xc04c('0x2f'),_0xc04c('0x30')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xc04c('0x11')](_0xc04c('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING'],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0xc04c('0x4')],'allowNull':!![]},'nat':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'force_rport,comedia','set':function(_0x5e5b49){this[_0xc04c('0x5')](_0xc04c('0x31'),_0x5e5b49?_0x5e5b49[_0xc04c('0x24')](','):null);},'get':function(){return this[_0xc04c('0xd')](_0xc04c('0x31'))?this[_0xc04c('0xd')](_0xc04c('0x31'))[_0xc04c('0x26')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0xc04c('0x4')]},'namedcallgroup':{'type':Sequelize[_0xc04c('0x4')]},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0xc04c('0x4')]},'language':{'type':Sequelize[_0xc04c('0x4')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xc04c('0x4')]},'disallow':{'type':Sequelize[_0xc04c('0x4')],'allowNull':![],'defaultValue':_0xc04c('0x32')},'allow':{'type':Sequelize[_0xc04c('0x4')],'allowNull':![],'defaultValue':_0xc04c('0x33'),'set':function(_0xb4968){this['setDataValue'](_0xc04c('0x34'),_0xb4968?_0xb4968['join'](';'):_0xc04c('0x33'));},'get':function(){return this[_0xc04c('0xd')](_0xc04c('0x34'))?this[_0xc04c('0xd')](_0xc04c('0x34'))[_0xc04c('0x26')](';'):null;},'comment':_0xc04c('0x35')},'autoframing':{'type':Sequelize['ENUM'](_0xc04c('0x2d'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0xc04c('0x4')],'allowNull':!![],'set':function(_0x1c984a){this[_0xc04c('0x5')](_0xc04c('0x36'),_0x1c984a?_0x1c984a[_0xc04c('0x24')](','):null);},'get':function(){return this[_0xc04c('0xd')](_0xc04c('0x36'))?this[_0xc04c('0xd')]('insecure')[_0xc04c('0x26')](','):null;},'comment':_0xc04c('0x37')},'trustrpid':{'type':Sequelize['ENUM'](_0xc04c('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xc04c('0x11')](_0xc04c('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xc04c('0x11')](_0xc04c('0x2d'),'no',_0xc04c('0x38')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0xc04c('0x11')]('yes','no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0xc04c('0x11')](_0xc04c('0x2d'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0xc04c('0x4')],'allowNull':!![]},'callerid':{'type':Sequelize[_0xc04c('0x4')],'allowNull':!![],'defaultValue':_0xc04c('0x39')},'amaflags':{'type':Sequelize[_0xc04c('0x4')],'allowNull':!![]},'callcounter':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'yes'},'busylevel':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize['ENUM'](_0xc04c('0x2d'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0xc04c('0x11')]('yes','no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0xc04c('0x11')](_0xc04c('0x2d'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0xc04c('0x11')](_0xc04c('0x2d'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0xc04c('0x4')],'allowNull':!![]},'template':{'type':Sequelize['STRING'],'allowNull':!![]},'videosupport':{'type':Sequelize['ENUM'](_0xc04c('0x2d'),'no',_0xc04c('0x3a')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xc04c('0x15')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0xc04c('0x11')](_0xc04c('0x2d'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'session_timers':{'type':Sequelize[_0xc04c('0x11')](_0xc04c('0x3b'),_0xc04c('0x3c'),_0xc04c('0x3d')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0xc04c('0x15')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0xc04c('0x11')]('uac','uas'),'allowNull':!![],'defaultValue':_0xc04c('0x3e')},'t38pt_usertpsource':{'type':Sequelize['STRING'],'allowNull':!![]},'regexten':{'type':Sequelize[_0xc04c('0x4')],'allowNull':!![]},'fromdomain':{'type':Sequelize['STRING'],'allowNull':!![]},'fromuser':{'type':Sequelize[_0xc04c('0x4')],'allowNull':!![]},'qualify':{'type':Sequelize[_0xc04c('0x11')]('yes','no'),'allowNull':!![],'defaultValue':_0xc04c('0x2d')},'keepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0xc04c('0x4')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0xc04c('0x4')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0xc04c('0x15')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0xc04c('0x15')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0xc04c('0x15')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0xc04c('0x11')](_0xc04c('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING'],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0xc04c('0x4')],'allowNull':!![]},'timert1':{'type':Sequelize[_0xc04c('0x15')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0xc04c('0x15')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0xc04c('0x15')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0xc04c('0x4')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0xc04c('0x4')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0xc04c('0x4')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0xc04c('0x4')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0xc04c('0x4')],'allowNull':!![]},'maxforwards':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'encryption':{'type':Sequelize['ENUM'](_0xc04c('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0xc04c('0x11')](_0xc04c('0x2d'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize['ENUM'](_0xc04c('0x2d'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0xc04c('0x11')](_0xc04c('0x2d'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0xc04c('0x11')](_0xc04c('0x2d'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0xc04c('0x11')]('yes','no',_0xc04c('0x3f'),_0xc04c('0x40')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0xc04c('0x15')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0xc04c('0x4')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0xc04c('0x4')],'allowNull':!![]},'dtlscipher':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscafile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0xc04c('0x4')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0xc04c('0x11')](_0xc04c('0x41'),'passive',_0xc04c('0x42')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xc04c('0x4')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0xc04c('0x11')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING'],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0xc04c('0x4')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0xc04c('0x15')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0xc04c('0x11')](_0xc04c('0x2d'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0xc04c('0x4')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0xc04c('0x4')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0xc04c('0x4')],'allowNull':!![]},'parkinglot':{'type':Sequelize['STRING'],'allowNull':!![]},'canreinvite':{'type':Sequelize['ENUM'](_0xc04c('0x2d'),'no',_0xc04c('0x2e'),_0xc04c('0x2f'),_0xc04c('0x43')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0xc04c('0x17')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0xc04c('0x4')]},'resetPasswordExpires':{'type':Sequelize[_0xc04c('0x18')]},'passwordResetAt':{'type':Sequelize['DATE'],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0xc04c('0x44')]},'showWebBar':{'type':Sequelize[_0xc04c('0x15')],'defaultValue':0x0,'set':function(_0x51f3ba){this[_0xc04c('0x5')](_0xc04c('0x45'),_0x51f3ba);var _0x3dee3d=this[_0xc04c('0x46')]({'plain':!![]});switch(_0x51f3ba){case 0x0:case 0x1:var _0x3acfdb=_0x3dee3d[_0xc04c('0x25')]?_[_0xc04c('0x47')](_0x3dee3d[_0xc04c('0x25')])?_0x3dee3d[_0xc04c('0x25')][_0xc04c('0x24')]():_0x3dee3d[_0xc04c('0x25')]:'udp';if(_0x3acfdb===_0xc04c('0x48')){_0x3acfdb=_0xc04c('0x23');}this[_0xc04c('0x5')](_0xc04c('0x25'),_0x3acfdb);this[_0xc04c('0x5')](_0xc04c('0x49'),'no');this[_0xc04c('0x5')](_0xc04c('0x4a'),null);this['setDataValue'](_0xc04c('0x4b'),null);this[_0xc04c('0x5')]('icesupport',null);this[_0xc04c('0x5')]('dtlsenable',null);this[_0xc04c('0x5')](_0xc04c('0x4c'),null);this['setDataValue'](_0xc04c('0x4d'),null);this[_0xc04c('0x5')]('dtlscertfile',null);this['setDataValue'](_0xc04c('0x4e'),null);this['setDataValue']('rtcp_mux','no');break;case 0x2:this[_0xc04c('0x5')]('transport',_0xc04c('0x48'));this['setDataValue'](_0xc04c('0x49'),_0xc04c('0x2d'));this['setDataValue'](_0xc04c('0x4a'),_0xc04c('0x2d'));this['setDataValue'](_0xc04c('0x4b'),_0xc04c('0x2d'));this[_0xc04c('0x5')](_0xc04c('0x4f'),_0xc04c('0x2d'));this[_0xc04c('0x5')](_0xc04c('0x50'),_0xc04c('0x2d'));this['setDataValue'](_0xc04c('0x4c'),'no');this[_0xc04c('0x5')](_0xc04c('0x4d'),_0xc04c('0x42'));this[_0xc04c('0x5')]('dtlscertfile',_0x3dee3d[_0xc04c('0x51')]||'/etc/pki/tls/certs/motion.crt');this[_0xc04c('0x5')](_0xc04c('0x4e'),_0x3dee3d[_0xc04c('0x4e')]||'/etc/pki/tls/private/motion.key');this[_0xc04c('0x5')](_0xc04c('0x52'),'yes');break;default:}}},'permissions':{'type':Sequelize[_0xc04c('0x44')],'set':function(_0x2f253a){this[_0xc04c('0x5')](_0xc04c('0x53'),_0x2f253a?_0x2f253a[_0xc04c('0x24')](','):[]);},'get':function(){return this[_0xc04c('0xd')](_0xc04c('0x53'))?_[_0xc04c('0x54')](this[_0xc04c('0xd')]('permissions')['split'](','),function(_0xa3fe98){return parseInt(_0xa3fe98,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0xc04c('0x4')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0xc04c('0x4')]},'phoneBarBusyNumber':{'type':Sequelize[_0xc04c('0x4')]},'phoneBarUnconditional':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0xc04c('0x17')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0xc04c('0x17')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0xc04c('0x17')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0xc04c('0x15')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0xc04c('0x4')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0xc04c('0x15')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0xc04c('0x11')](_0xc04c('0x2d'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize['STRING']},'phoneBarEnableJaws':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0xc04c('0x17')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0xc04c('0x55')],'get':function(){return this['getDataValue'](_0xc04c('0x56'))?this[_0xc04c('0xd')](_0xc04c('0x56')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0xc04c('0x17')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0xc04c('0x17')],'defaultValue':![]},'hotdesk':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'interface':{'type':Sequelize[_0xc04c('0x4')],'defaultValue':null},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0xc04c('0x4')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0xc04c('0x4')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0xc04c('0x17')],'defaultValue':![],'set':function(_0x1de638){if(typeof _0x1de638===_0xc04c('0x57')){var _0x9e7406=_0x1de638==='1'?!![]:_0x1de638==='0'?![]:_0x1de638===_0xc04c('0x58')?!![]:_0x1de638==='false'?![]:![];this[_0xc04c('0x5')]('screenrecording',_0x9e7406);}else{this[_0xc04c('0x5')](_0xc04c('0x59'),_0x1de638);}}},'blocked':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x4f6c43){this[_0xc04c('0x5')](_0xc04c('0x5a'),_0x4f6c43);if(_0x4f6c43===!![]){this[_0xc04c('0x5')](_0xc04c('0x5b'),moment());this[_0xc04c('0x5')](_0xc04c('0x5c'),0x0);}else{this['setDataValue']('blockedAt',null);}}},'blockedAt':{'type':Sequelize[_0xc04c('0x18')],'defaultValue':null},'loginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disabled':{'type':Sequelize[_0xc04c('0x17')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0xc04c('0x17')],'defaultValue':!![]},'wssPort':{'type':Sequelize['INTEGER'](0x5)[_0xc04c('0x5d')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xc04c('0x17')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xc04c('0x17')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index 7a0150d..e78c8f5 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 _0x6067=['apiKeyNonce','API\x20key\x20not\x20available','whoami','send','getPresence','queues','teams','Team','inbound','getAgents','isEmpty','col','desc','asc','substring','uniqBy','orderBy','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','offline','idle','unknown','unavailable','ringing','busy','slice','charAt','toUpperCase','QueryTypes','select','field','ui.','InteractionId','_interactions','ui.UserId\x20=\x20?','OpenTabs','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./user.socket','register','client','http','request','info','User,\x20%s,\x20%s','debug','User,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','sendStatus','status','end','undefined','limit','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','get','admin','user','Agents','telephone','filter','ignore','map','value','includes','role','find','name','UserProfileResource','stack','index','rawAttributes','fieldName','type','key','model','differenceBy','password','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','lower','options','User','count','include','push','findAll','openTabs','true','chat','rows','dataValues','fax','mail','openchannel','whatsapp','all','catch','show','salt','includeAll','body','describe','addContacts','params','ids','omit','Setting','findById','securePassword','validatePasswordPattern','max','internal','isNil','min_internal','sequelize','select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)','SELECT','from','voicemail','mailbox','VoiceMail','fullname','email','permissions','101','113','110','104','106','107','109','100','111','114','115','create','agent','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','userProfileId','Telephones','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','bulkCreate','some','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator','each','UserProfileSection','compact','oldPassword','newPassword','Sequelize','Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword','authenticate','ValidationError','Wrong\x20credentials','Invalid\x20body\x20format.\x20Use\x20newPassword','findOne','enforcePasswordHistory','passwordHistoryLimit','previousPasswords','addQueues','channel','loginInPause','interface','isValidChannel','add','capitalize','toLowerCase','Queues','penalty','spread','emit','voice','VoiceQueue','online','format','voicePause','UserVoiceQueueRt','removeQueues','remove','QueueId','Queue:remove','userpic','file','filename','getAvatar','join','root','server/files/images/logos/default_profile.png','download','existsSync','server/files/images/','getOpenTabs','ChatOpenTabs','FaxOpenTabs','FAX','createdAt','OpenchannelOpenTabs','OPENCHANNEL','MailOpenTabs','MAIL','SmsOpenTabs','SMS','WhatsappOpenTabs','getContacts','CmContact','List','Tag','color','tag','Unknown\x20channel','Queue','getGroups','ChatGroup','getRecordings','VoiceRecording','UserId','getScreenRecordings','ScreenRecording','ChatInteraction','getChatInteractions','getOpenchannelInteractions','OpenchannelInteraction','getMailInteractions','MailInteraction','SmsInteraction','getSmsInteractions','getFaxInteractions','FaxInteraction','WhatsappInteraction','getWhatsappInteractions','login','phone','LOCAL/%s@from-sip/n','intrf','SIP/%s','user:%s','user:forcelogout','headers','remoteAddress','socket','connection','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','getVoiceQueues','UserVoiceQueue.penalty','upsert','MemberReport','forEach','getChannels','YYYY-MM-DD\x20HH:mm:ss','LOGIN','device','PAUSE','LOGININPAUSE','concat','isMiddleware','resolve','logout','pause','QueuePause','DEFAULT\x20PAUSE','unpause','mailPause','chatPause','faxPause','openchannelPause','smsPause','pauseType','lastPauseAt','manual','sms','%s%s','Pause','getTeams','addTeams','setDataValue','Voice','Chat','getMailQueues','Mail','getSmsQueues','Sms','getWhatsappQueues','Whatsapp','getFaxQueues','Fax','Openchannel','flatten','addAgent','getDataValue','Queue:save','removeTeams','getChatQueues','getOpenchannelQueues','transaction','CmList','getLists','values','You\x20can\x27t\x20delete\x20yourself','addChatInteractions','removeChatInteractions','isArray','addMailInteractions','user_has_mail_interactions:save','removeMailInteractions','user_has_mail_interactions:remove','user_has_fax_interactions:save','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','user_has_sms_interactions:save','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','user_has_openchannel_interactions:save','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','addWhatsappInteractions','user_has_whatsapp_interactions:save','removeWhatsappInteractions','getVoicePrefixes','VoicePrefix','getFaxAccounts','FaxAccount','addFaxAccounts','removeFaxAccounts','getMailAccounts','MailAccount','addMailAccounts','removeMailAccounts','OpenchannelAccount','getOpenchannelAccounts','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','addSmsAccounts','removeSmsAccounts','getChatWebsites','addChatWebsites','removeChatWebsites','getWhatsappAccounts','WhatsappAccount','addWhatsappAccounts','removeWhatsappAccounts','getSquareProjects','SquareProject','addSquareProjects','removeSquareProjects','getScheduledCalls','$or','$gt','$lt','$lte','$ne','$eq','$not','$in','$notIn','$like','$notLike','$iLike','$notILike','$overlap','$contains','firstName','dialActive','CmHopper','getApiKey','retrieveApiKey','token','No\x20API\x20access\x20key\x20found!','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','createApiKey','generateApiKey','iat','nonce'];(function(_0xb3dbe0,_0x41779b){var _0x46ab96=function(_0x46d340){while(--_0x46d340){_0xb3dbe0['push'](_0xb3dbe0['shift']());}};_0x46ab96(++_0x41779b);}(_0x6067,0x1d6));var _0x7606=function(_0x148569,_0x5c810e){_0x148569=_0x148569-0x0;var _0x2a0f65=_0x6067[_0x148569];return _0x2a0f65;};'use strict';var emlformat=require(_0x7606('0x0'));var rimraf=require(_0x7606('0x1'));var zipdir=require(_0x7606('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7606('0x3'));var moment=require(_0x7606('0x4'));var BPromise=require(_0x7606('0x5'));var Mustache=require(_0x7606('0x6'));var util=require(_0x7606('0x7'));var path=require(_0x7606('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x7606('0x9'));var fs=require('fs');var fs_extra=require(_0x7606('0xa'));var _=require(_0x7606('0xb'));var squel=require(_0x7606('0xc'));var crypto=require('crypto');var jsforce=require(_0x7606('0xd'));var deskjs=require(_0x7606('0xe'));var toCsv=require(_0x7606('0xf'));var querystring=require(_0x7606('0x10'));var Papa=require(_0x7606('0x11'));var Redis=require(_0x7606('0x12'));var values;var authService=require('../../components/auth/service');var qs=require(_0x7606('0x13'));var as=require(_0x7606('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7606('0x15'))(_0x7606('0x16'));var utils=require(_0x7606('0x17'));var config=require(_0x7606('0x18'));var licenseUtil=require(_0x7606('0x19'));var db=require(_0x7606('0x1a'))['db'];config['redis']=_[_0x7606('0x1b')](config[_0x7606('0x1c')],{'host':_0x7606('0x1d'),'port':0x18eb});var socket=require(_0x7606('0x1e'))(new Redis(config[_0x7606('0x1c')]));require(_0x7606('0x1f'))[_0x7606('0x20')](socket);var jayson=require('jayson/promise');var client=jayson[_0x7606('0x21')][_0x7606('0x22')]({'port':0x232a});function respondWithRpcPromise(_0x51483d,_0x5405e5,_0x282d69,_0x1847e2){return new BPromise(function(_0x2c1640,_0x2c7ea1){var _0x65b498=_0x1847e2||client;return _0x65b498[_0x7606('0x23')](_0x51483d,_0x282d69)['then'](function(_0x105a58){logger[_0x7606('0x24')](_0x7606('0x25'),_0x5405e5,'request\x20sent');logger[_0x7606('0x26')](_0x7606('0x27'),_0x5405e5,_0x7606('0x28'),JSON['stringify'](_0x105a58));if(_0x105a58[_0x7606('0x29')]){if(_0x105a58['error'][_0x7606('0x2a')]===0x1f4){logger[_0x7606('0x29')]('User,\x20%s,\x20%s',_0x5405e5,_0x105a58[_0x7606('0x29')]['message']);return _0x2c7ea1(_0x105a58[_0x7606('0x29')][_0x7606('0x2b')]);}logger[_0x7606('0x29')](_0x7606('0x25'),_0x5405e5,_0x105a58[_0x7606('0x29')][_0x7606('0x2b')]);return _0x2c1640(_0x105a58[_0x7606('0x29')][_0x7606('0x2b')]);}else{logger['info'](_0x7606('0x25'),_0x5405e5,_0x7606('0x28'));_0x2c1640(_0x105a58[_0x7606('0x2c')][_0x7606('0x2b')]);}})['catch'](function(_0x2926ac){logger['error'](_0x7606('0x25'),_0x5405e5,_0x2926ac);_0x2c7ea1(_0x2926ac);});});}function respondWithStatusCode(_0xf25982,_0x29b3fd){_0x29b3fd=_0x29b3fd||0xcc;return function(_0x364ed5){if(_0x364ed5){return _0xf25982[_0x7606('0x2d')](_0x29b3fd);}return _0xf25982[_0x7606('0x2e')](_0x29b3fd)[_0x7606('0x2f')]();};}function respondWithResult(_0x1c4955,_0x49fadc){_0x49fadc=_0x49fadc||0xc8;return function(_0x1bdc1f){if(_0x1bdc1f){return _0x1c4955[_0x7606('0x2e')](_0x49fadc)['json'](_0x1bdc1f);}};}function respondWithFilteredResult(_0x4a4d47,_0x2fd6f0){return function(_0x3f2f50){if(_0x3f2f50){var _0x2f4912=typeof _0x2fd6f0['offset']===_0x7606('0x30')&&typeof _0x2fd6f0[_0x7606('0x31')]===_0x7606('0x30');var _0x48bbef=_0x3f2f50['count'];var _0x5307d3=_0x2f4912?0x0:_0x2fd6f0[_0x7606('0x32')];var _0x312f3e=_0x2f4912?_0x3f2f50['count']:_0x2fd6f0[_0x7606('0x32')]+_0x2fd6f0[_0x7606('0x31')];var _0x1dfe3a;if(_0x312f3e>=_0x48bbef){_0x312f3e=_0x48bbef;_0x1dfe3a=0xc8;}else{_0x1dfe3a=0xce;}_0x4a4d47['status'](_0x1dfe3a);return _0x4a4d47[_0x7606('0x33')](_0x7606('0x34'),_0x5307d3+'-'+_0x312f3e+'/'+_0x48bbef)[_0x7606('0x35')](_0x3f2f50);}return null;};}function patchUpdates(_0x231fdf){return function(_0x44aabc){try{jsonpatch[_0x7606('0x36')](_0x44aabc,_0x231fdf,!![]);}catch(_0x2a5aa6){return BPromise[_0x7606('0x37')](_0x2a5aa6);}return _0x44aabc[_0x7606('0x38')]();};}function saveUpdates(_0x5d88e5,_0x2e8f8f){return function(_0x4537b){if(_0x4537b){return _0x4537b[_0x7606('0x39')](_0x5d88e5)[_0x7606('0x3a')](function(_0x3179c3){return _0x3179c3;});}return null;};}function removeEntity(_0x194abf,_0x22c14c){return function(_0x3351e1){if(_0x3351e1){return _0x3351e1[_0x7606('0x3b')]()[_0x7606('0x3a')](function(){var _0x19bb0a=_0x3351e1[_0x7606('0x3c')]({'plain':!![]});if(_0x19bb0a['role']===_0x7606('0x3d'))return;var _0x246f3d=[{'name':'Users','value':_0x7606('0x3e'),'ignore':!![]},{'name':_0x7606('0x3f'),'value':'agent','ignore':![]},{'name':'Telephones','value':_0x7606('0x40'),'ignore':![]}];var _0x21c097=_(_0x246f3d)[_0x7606('0x41')](_0x7606('0x42'))[_0x7606('0x43')]('value')[_0x7606('0x44')]();if(_[_0x7606('0x45')](_0x21c097,_0x19bb0a[_0x7606('0x46')])){return;}var _0x2e6316=_[_0x7606('0x47')](_0x246f3d,[_0x7606('0x44'),_0x19bb0a[_0x7606('0x46')]])[_0x7606('0x48')];return db[_0x7606('0x49')][_0x7606('0x3b')]({'where':{'type':_0x2e6316,'resourceId':_0x19bb0a['id']}})[_0x7606('0x3a')](function(){return _0x3351e1;});})['then'](function(){_0x194abf[_0x7606('0x2e')](0xcc)[_0x7606('0x2f')]();});}};}function handleEntityNotFound(_0x1b226e,_0x1ed462){return function(_0x223ca3){if(!_0x223ca3){_0x1b226e['sendStatus'](0x194);}return _0x223ca3;};}function handleError(_0x1e8116,_0x3a100a){_0x3a100a=_0x3a100a||0x1f4;return function(_0x2d7676){logger[_0x7606('0x29')](_0x2d7676[_0x7606('0x4a')]);if(_0x2d7676[_0x7606('0x48')]){delete _0x2d7676[_0x7606('0x48')];}_0x1e8116['status'](_0x3a100a)['send'](_0x2d7676);};}exports[_0x7606('0x4b')]=function(_0x57bbd0,_0x3f9681){var _0x4b1b74={},_0x5eb9aa={},_0x3a3021={'count':0x0,'rows':[]};var _0x3c79d2=_[_0x7606('0x43')](db['User'][_0x7606('0x4c')],function(_0x2c4eaa){return{'name':_0x2c4eaa[_0x7606('0x4d')],'type':_0x2c4eaa[_0x7606('0x4e')][_0x7606('0x4f')]};});_0x5eb9aa[_0x7606('0x50')]=_[_0x7606('0x51')](_[_0x7606('0x43')](_0x3c79d2,_0x7606('0x48')),[_0x7606('0x52'),'salt']);_0x5eb9aa[_0x7606('0x53')]=_[_0x7606('0x54')](_0x57bbd0[_0x7606('0x53')]);_0x5eb9aa[_0x7606('0x55')]=_[_0x7606('0x56')](_0x5eb9aa[_0x7606('0x50')],_0x5eb9aa['query']);_0x4b1b74[_0x7606('0x57')]=_[_0x7606('0x56')](_0x5eb9aa[_0x7606('0x50')],qs[_0x7606('0x58')](_0x57bbd0['query'][_0x7606('0x58')]));_0x4b1b74[_0x7606('0x57')]=_0x4b1b74[_0x7606('0x57')][_0x7606('0x59')]?_0x4b1b74['attributes']:_0x5eb9aa[_0x7606('0x50')];if(!_0x57bbd0['query'][_0x7606('0x5a')](_0x7606('0x5b'))){_0x4b1b74[_0x7606('0x31')]=qs[_0x7606('0x31')](_0x57bbd0[_0x7606('0x53')][_0x7606('0x31')]);_0x4b1b74[_0x7606('0x32')]=qs[_0x7606('0x32')](_0x57bbd0[_0x7606('0x53')][_0x7606('0x32')]);}_0x4b1b74[_0x7606('0x5c')]=qs[_0x7606('0x5d')](_0x57bbd0['query'][_0x7606('0x5d')]);_0x4b1b74[_0x7606('0x5e')]=qs[_0x7606('0x55')](_[_0x7606('0x5f')](_0x57bbd0[_0x7606('0x53')],_0x5eb9aa[_0x7606('0x55')]),_0x3c79d2);if(_0x57bbd0[_0x7606('0x53')][_0x7606('0x41')]){_0x4b1b74['where']=_[_0x7606('0x60')](_0x4b1b74[_0x7606('0x5e')],{'$or':_['map'](_0x3c79d2,function(_0x590169){if(_0x590169[_0x7606('0x4e')]!=='VIRTUAL'){return db['sequelize']['where'](db['sequelize']['fn']('lower',db['sequelize']['col'](_0x590169[_0x7606('0x48')])),{'$like':db['sequelize']['fn'](_0x7606('0x61'),'%'+_0x57bbd0[_0x7606('0x53')][_0x7606('0x41')]+'%')});}})});}_0x4b1b74=_[_0x7606('0x60')]({},_0x4b1b74,_0x57bbd0[_0x7606('0x62')]);var _0x64f5ea={'where':_0x4b1b74[_0x7606('0x5e')]};return db[_0x7606('0x63')][_0x7606('0x64')](_0x64f5ea)['then'](function(_0x1e47e6){_0x3a3021['count']=_0x1e47e6;if(_0x57bbd0[_0x7606('0x53')]['includeAll']){_0x4b1b74[_0x7606('0x65')]=[{'all':!![]}];}if(!_['includes'](_0x4b1b74[_0x7606('0x57')],'id')){_0x4b1b74[_0x7606('0x57')][_0x7606('0x66')]('id');}return db[_0x7606('0x63')][_0x7606('0x67')](_0x4b1b74);})[_0x7606('0x3a')](function(_0x413b43){_0x3a3021['rows']=_0x413b43;if(_0x57bbd0['query'][_0x7606('0x68')]===_0x7606('0x69')){var _0x199280=[];for(var _0x33fabc=0x0;_0x33fabc<_0x3a3021['rows']['length'];_0x33fabc++){_0x199280[_0x7606('0x66')](get_open_tabs(_0x7606('0x6a'),_0x3a3021[_0x7606('0x6b')][_0x33fabc]['dataValues']));_0x199280[_0x7606('0x66')](get_open_tabs('sms',_0x3a3021[_0x7606('0x6b')][_0x33fabc][_0x7606('0x6c')]));_0x199280['push'](get_open_tabs(_0x7606('0x6d'),_0x3a3021[_0x7606('0x6b')][_0x33fabc][_0x7606('0x6c')]));_0x199280[_0x7606('0x66')](get_open_tabs(_0x7606('0x6e'),_0x3a3021[_0x7606('0x6b')][_0x33fabc][_0x7606('0x6c')]));_0x199280[_0x7606('0x66')](get_open_tabs(_0x7606('0x6f'),_0x3a3021[_0x7606('0x6b')][_0x33fabc]['dataValues']));_0x199280[_0x7606('0x66')](get_open_tabs(_0x7606('0x70'),_0x3a3021[_0x7606('0x6b')][_0x33fabc][_0x7606('0x6c')]));}return BPromise[_0x7606('0x71')](_0x199280)[_0x7606('0x3a')](function(_0x55ace8){return _0x3a3021;});}else{return _0x3a3021;}})[_0x7606('0x3a')](respondWithFilteredResult(_0x3f9681,_0x4b1b74))[_0x7606('0x72')](handleError(_0x3f9681,null));};exports[_0x7606('0x73')]=function(_0x168fa8,_0x490fb0){var _0x34818c={'raw':![],'where':{'id':_0x168fa8['params']['id']}},_0x22f94c={};_0x22f94c['model']=_[_0x7606('0x51')](_['keys'](db[_0x7606('0x63')][_0x7606('0x4c')]),[_0x7606('0x52'),_0x7606('0x74')]);_0x22f94c[_0x7606('0x53')]=_[_0x7606('0x54')](_0x168fa8['query']);_0x22f94c['filters']=_[_0x7606('0x56')](_0x22f94c[_0x7606('0x50')],_0x22f94c[_0x7606('0x53')]);_0x34818c[_0x7606('0x57')]=_[_0x7606('0x56')](_0x22f94c['model'],qs[_0x7606('0x58')](_0x168fa8[_0x7606('0x53')]['fields']));_0x34818c[_0x7606('0x57')]=_0x34818c['attributes'][_0x7606('0x59')]?_0x34818c[_0x7606('0x57')]:_0x22f94c[_0x7606('0x50')];if(_0x168fa8['query'][_0x7606('0x75')]){_0x34818c[_0x7606('0x65')]=[{'all':!![]}];}_0x34818c=_[_0x7606('0x60')]({},_0x34818c,_0x168fa8[_0x7606('0x62')]);if(!_[_0x7606('0x45')](_0x34818c['attributes'],'id')){_0x34818c[_0x7606('0x57')]['push']('id');}return db[_0x7606('0x63')]['find'](_0x34818c)[_0x7606('0x3a')](handleEntityNotFound(_0x490fb0,null))[_0x7606('0x3a')](function(_0x260c7b){var _0x58ac69=[];values=_0x260c7b;if(_0x168fa8[_0x7606('0x53')][_0x7606('0x68')]===_0x7606('0x69')){_0x58ac69[_0x7606('0x66')](get_open_tabs(_0x7606('0x6a'),_0x260c7b[_0x7606('0x6c')]));_0x58ac69[_0x7606('0x66')](get_open_tabs('sms',_0x260c7b[_0x7606('0x6c')]));_0x58ac69[_0x7606('0x66')](get_open_tabs(_0x7606('0x6f'),_0x260c7b[_0x7606('0x6c')]));_0x58ac69[_0x7606('0x66')](get_open_tabs('whatsapp',_0x260c7b['dataValues']));_0x58ac69[_0x7606('0x66')](get_open_tabs(_0x7606('0x6d'),_0x260c7b['dataValues']));_0x58ac69[_0x7606('0x66')](get_open_tabs('mail',_0x260c7b['dataValues']));return BPromise[_0x7606('0x71')](_0x58ac69);}else{return values;}})[_0x7606('0x3a')](function(_0x37dc4d){return values;})[_0x7606('0x3a')](respondWithResult(_0x490fb0,null))[_0x7606('0x72')](handleError(_0x490fb0,null));};exports[_0x7606('0x39')]=function(_0x30c2f6,_0x39ea31){if(_0x30c2f6[_0x7606('0x76')]['id']){delete _0x30c2f6[_0x7606('0x76')]['id'];}delete _0x30c2f6[_0x7606('0x76')][_0x7606('0x46')];return db[_0x7606('0x63')]['find']({'where':{'id':_0x30c2f6['params']['id']}})[_0x7606('0x3a')](handleEntityNotFound(_0x39ea31,null))['then'](saveUpdates(_0x30c2f6[_0x7606('0x76')],null))['then'](respondWithResult(_0x39ea31,null))[_0x7606('0x72')](handleError(_0x39ea31,null));};exports[_0x7606('0x77')]=function(_0xe444a6,_0x2bebf2){return db[_0x7606('0x63')][_0x7606('0x77')]()[_0x7606('0x3a')](respondWithResult(_0x2bebf2,null))[_0x7606('0x72')](handleError(_0x2bebf2,null));};exports[_0x7606('0x78')]=function(_0x179d13,_0x23dbbc,_0x2c2dcf){return db[_0x7606('0x63')][_0x7606('0x47')]({'where':{'id':_0x179d13[_0x7606('0x79')]['id']}})['then'](handleEntityNotFound(_0x23dbbc,null))[_0x7606('0x3a')](function(_0xd7f91c){if(_0xd7f91c){return _0xd7f91c[_0x7606('0x78')](_0x179d13[_0x7606('0x76')][_0x7606('0x7a')],_[_0x7606('0x7b')](_0x179d13[_0x7606('0x76')],[_0x7606('0x7a'),'id'])||{});}})[_0x7606('0x3a')](respondWithResult(_0x23dbbc,null))[_0x7606('0x72')](handleError(_0x23dbbc,null));};function validateUser(_0x2d9cf2){return new BPromise(function(_0x305394,_0x5e1463){if(_0x2d9cf2['internal'])return _0x305394(_0x2d9cf2);return db[_0x7606('0x7c')][_0x7606('0x7d')](0x1)['then'](function(_0x4d013b){if(_0x4d013b[_0x7606('0x7e')])authService[_0x7606('0x7f')](_0x2d9cf2[_0x7606('0x52')]);db[_0x7606('0x63')][_0x7606('0x80')](_0x7606('0x81'))[_0x7606('0x3a')](function(_0x5018be){if(_[_0x7606('0x82')](_0x5018be)){_0x2d9cf2[_0x7606('0x81')]=_0x4d013b['min_internal']||0x1;return;}if(_['isNil'](_0x4d013b[_0x7606('0x83')])||_0x4d013b['min_internal']===_0x5018be){_0x2d9cf2['internal']=_0x5018be+0x1;return;}if(_0x4d013b[_0x7606('0x83')]>_0x5018be){_0x2d9cf2[_0x7606('0x81')]=_0x4d013b[_0x7606('0x83')];return;}return db[_0x7606('0x84')][_0x7606('0x53')](_0x7606('0x85'),{'type':db[_0x7606('0x84')]['QueryTypes'][_0x7606('0x86')]})[_0x7606('0x3a')](function(_0x588363){if(_0x588363&&_0x588363[_0x7606('0x59')]){for(var _0x19b9b0=0x0,_0x50266a=_0x588363['length'];_0x19b9b0<_0x50266a&&_[_0x7606('0x82')](_0x2d9cf2['internal']);_0x19b9b0++){if(_0x4d013b[_0x7606('0x83')]<=_0x588363[_0x19b9b0][_0x7606('0x87')]){_0x2d9cf2['internal']=_0x588363[_0x19b9b0][_0x7606('0x87')];}else if(_0x4d013b[_0x7606('0x83')]>_0x588363[_0x19b9b0][_0x7606('0x87')]&&_0x4d013b['min_internal']<=_0x588363[_0x19b9b0]['to']){_0x2d9cf2[_0x7606('0x81')]=_0x4d013b[_0x7606('0x83')];}}}if(_[_0x7606('0x82')](_0x2d9cf2['internal'])){_0x2d9cf2[_0x7606('0x81')]=_0x5018be+0x1;}return _0x305394(_0x2d9cf2);});});})[_0x7606('0x72')](function(_0x51310f){_0x5e1463(_0x51310f);});});}function updateUser(_0x184024){return new BPromise(function(_0x2206bb,_0x5bebc0){try{if(_0x184024[_0x7606('0x88')]){_0x184024[_0x7606('0x89')]=_0x184024['internal'];_0x184024[_0x7606('0x8a')]={'mailbox':_0x184024[_0x7606('0x81')],'password':_0x184024[_0x7606('0x52')],'fullname':_0x184024[_0x7606('0x8b')],'email':_0x184024[_0x7606('0x8c')]};}if(_0x184024[_0x7606('0x46')]==='agent'){if(!_0x184024[_0x7606('0x8d')])_0x184024[_0x7606('0x8d')]=[_0x7606('0x8e'),'102','103',_0x7606('0x8f'),_0x7606('0x90'),_0x7606('0x91'),'105',_0x7606('0x92'),_0x7606('0x93'),'108',_0x7606('0x94'),_0x7606('0x95'),_0x7606('0x96'),_0x7606('0x97'),_0x7606('0x98')];}_0x2206bb(_0x184024);}catch(_0x1f7c7b){_0x5bebc0(_0x1f7c7b);}});}exports[_0x7606('0x99')]=function(_0x2f5694,_0x39c59){if(_0x2f5694[_0x7606('0x3e')][_0x7606('0x46')]===_0x7606('0x9a'))throw new Error(_0x7606('0x9b'));if(_0x2f5694[_0x7606('0x76')][_0x7606('0x46')]==='user'&&_0x2f5694[_0x7606('0x3e')][_0x7606('0x46')]!==_0x7606('0x3d')){throw new Error(_0x7606('0x9c'));}if(_0x2f5694[_0x7606('0x76')][_0x7606('0x46')]===_0x7606('0x3d')&&_0x2f5694[_0x7606('0x3e')][_0x7606('0x46')]!=='admin'){throw new Error(_0x7606('0x9d'));}return licenseUtil[_0x7606('0x9e')]([_0x2f5694[_0x7606('0x76')]])[_0x7606('0x3a')](function(){return validateUser(_0x2f5694[_0x7606('0x76')]);})[_0x7606('0x3a')](function(_0x5bd05c){return updateUser(_0x5bd05c)[_0x7606('0x3a')](function(_0x434c25){if(_0x434c25['role']===_0x7606('0x3d')){_0x434c25[_0x7606('0x9f')]=_0x2f5694[_0x7606('0x3e')][_0x7606('0x9f')];delete _0x434c25[_0x7606('0xa0')];}return _0x434c25;});})['then'](function(_0x5237c7){return db[_0x7606('0x63')][_0x7606('0x99')](_0x5237c7,{'include':[{'model':db[_0x7606('0x8a')],'as':'VoiceMail'}]});})['then'](function(_0x30d8b3){if(_0x2f5694['body']['role']===_0x7606('0x3e'))return _0x30d8b3;if(_0x2f5694[_0x7606('0x3e')]['role']!==_0x7606('0x3e'))return _0x30d8b3;return db['UserProfileSection'][_0x7606('0x47')]({'where':{'name':_0x30d8b3[_0x7606('0x46')]===_0x7606('0x9a')?_0x7606('0x3f'):_0x7606('0xa1'),'userProfileId':_0x2f5694[_0x7606('0x3e')]['userProfileId']},'raw':!![]})['then'](function(_0x3b8b43){if(!_0x3b8b43||_0x3b8b43[_0x7606('0xa2')]!=0x0)return _0x30d8b3;return db['UserProfileResource'][_0x7606('0x99')]({'name':_0x30d8b3[_0x7606('0x48')],'resourceId':_0x30d8b3['id'],'type':_0x3b8b43['name'],'sectionId':_0x3b8b43['id']},{})[_0x7606('0x3a')](function(){return _0x30d8b3;});})['catch'](function(_0x13cd02){logger[_0x7606('0x29')](_0x7606('0xa3'),_0x13cd02);throw _0x13cd02;});})['then'](respondWithResult(_0x39c59,0xc9))[_0x7606('0x72')](handleError(_0x39c59,null));};exports[_0x7606('0xa4')]=function(_0x6bf6ed,_0x2fb956){var _0x42462c=_0x6bf6ed[_0x7606('0x76')];var _0x2cb4bf=[];if(_0x6bf6ed['user'][_0x7606('0x46')]===_0x7606('0x9a'))throw new Error(_0x7606('0x9b'));if(_[_0x7606('0xa5')](_0x42462c,['role',_0x7606('0x3e')])&&_0x6bf6ed[_0x7606('0x3e')]['role']!==_0x7606('0x3d')){throw new Error(_0x7606('0x9c'));}if(_[_0x7606('0xa5')](_0x42462c,[_0x7606('0x46'),'admin'])&&_0x6bf6ed[_0x7606('0x3e')][_0x7606('0x46')]!==_0x7606('0x3d')){throw new Error(_0x7606('0xa6'));}return licenseUtil[_0x7606('0x9e')](_0x42462c)[_0x7606('0x3a')](function(){return validateUser(_0x42462c[0x0]);})[_0x7606('0x3a')](function(){for(var _0x14529e=0x1;_0x14529e<_0x42462c[_0x7606('0x59')];_0x14529e++){var _0x26f092=_0x42462c[_0x14529e-0x1][_0x7606('0x81')];if(!_0x42462c[_0x14529e][_0x7606('0x81')])_0x42462c[_0x14529e][_0x7606('0x81')]=_0x26f092+0x1;_0x2cb4bf['push'](validateUser(_0x42462c[_0x14529e]));}return BPromise[_0x7606('0x71')](_0x2cb4bf);})['then'](function(){_0x2cb4bf=[];for(var _0x431278=0x0;_0x431278<_0x42462c[_0x7606('0x59')];_0x431278++){_0x2cb4bf[_0x7606('0x66')](updateUser(_0x42462c[_0x431278]));}return BPromise[_0x7606('0x71')](_0x2cb4bf);})[_0x7606('0x3a')](function(){return BPromise[_0x7606('0xa7')](_0x42462c,function(_0x44bbe4){return db[_0x7606('0x63')]['create'](_0x44bbe4,{'include':[{'model':db[_0x7606('0x8a')],'as':_0x7606('0x8a')}]})[_0x7606('0x3a')](function(_0x559cf4){_0x44bbe4['id']=_0x559cf4['id'];return _0x44bbe4;});});})[_0x7606('0x3a')](function(_0x47f583){if(_0x6bf6ed['body']['role']===_0x7606('0x3e'))return _0x47f583;if(_0x6bf6ed[_0x7606('0x3e')][_0x7606('0x46')]!==_0x7606('0x3e'))return _0x47f583;var _0x46f437=_[_0x7606('0xa5')](_0x47f583,function(_0x5c0658){return _0x5c0658[_0x7606('0x46')]==='agent'||_0x5c0658[_0x7606('0x46')]===_0x7606('0x40');});if(!_0x46f437)return _0x47f583;return db[_0x7606('0xa8')][_0x7606('0x67')]({'where':{'name':{'$or':['Agents',_0x7606('0xa1')]},'userProfileId':_0x6bf6ed[_0x7606('0x3e')][_0x7606('0xa0')]},'raw':!![]})[_0x7606('0x3a')](function(_0x1deef8){if(_['isEmpty'](_0x1deef8)||!_[_0x7606('0xa5')](_0x1deef8,[_0x7606('0xa2'),0x0]))return _0x47f583;_0x2cb4bf=[];var _0x90d570=_(_0x1deef8)['map'](function(_0x4a7fe5){if(_0x4a7fe5[_0x7606('0xa2')]===0x1)return;return _0x4a7fe5[_0x7606('0x48')]==='Agents'?_0x7606('0x9a'):_0x7606('0x40');})[_0x7606('0xa9')]()[_0x7606('0x44')]();for(var _0x5e913d=0x0;_0x5e913d<_0x47f583[_0x7606('0x59')];_0x5e913d++){if(!_['includes'](_0x90d570,_0x47f583[_0x5e913d][_0x7606('0x46')]))return;var _0x38dedd=_0x47f583[_0x5e913d]['role']===_0x7606('0x9a')?'Agents':_0x7606('0xa1');_0x2cb4bf['push'](db[_0x7606('0x49')][_0x7606('0x99')]({'name':_0x47f583[_0x5e913d][_0x7606('0x48')],'resourceId':_0x47f583[_0x5e913d]['id'],'type':_0x38dedd,'sectionId':_[_0x7606('0x47')](_0x1deef8,[_0x7606('0x48'),_0x38dedd])['id']},{}));}return BPromise[_0x7606('0x71')](_0x2cb4bf);});})[_0x7606('0x3a')](respondWithResult(_0x2fb956,0xc9))[_0x7606('0x72')](handleError(_0x2fb956,null));};exports['changePassword']=function(_0xf19ccc,_0xaacf1,_0x461b5f){if(_0xf19ccc[_0x7606('0x76')]['id']){delete _0xf19ccc[_0x7606('0x76')]['id'];}return db[_0x7606('0x63')][_0x7606('0x47')]({'where':{'id':_0xf19ccc[_0x7606('0x79')]['id']}})['then'](function(_0x5ab5fd){if(!_0x5ab5fd)return null;if(_0x5ab5fd['id']===_0xf19ccc[_0x7606('0x3e')]['id']){if(!_0xf19ccc[_0x7606('0x76')][_0x7606('0xaa')]||!_0xf19ccc['body'][_0x7606('0xab')]){throw new db[(_0x7606('0xac'))]['ValidationError'](_0x7606('0xad'));}if(!_0x5ab5fd[_0x7606('0xae')](_0xf19ccc[_0x7606('0x76')][_0x7606('0xaa')])){throw new db[(_0x7606('0xac'))][(_0x7606('0xaf'))](_0x7606('0xb0'));}if(_0xf19ccc[_0x7606('0x76')][_0x7606('0xaa')]===_0xf19ccc[_0x7606('0x76')][_0x7606('0xab')]){throw new db[(_0x7606('0xac'))][(_0x7606('0xaf'))]('New\x20password\x20must\x20be\x20different\x20from\x20old\x20password');}}else if(_0xf19ccc[_0x7606('0x3e')][_0x7606('0x46')]===_0x7606('0x3d')){if(!_0xf19ccc['body'][_0x7606('0xab')]){throw new db[(_0x7606('0xac'))][(_0x7606('0xaf'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}}else if(_0xf19ccc[_0x7606('0x3e')][_0x7606('0x46')]===_0x7606('0x3e')){if(!_0xf19ccc[_0x7606('0x76')][_0x7606('0xab')]){throw new db[(_0x7606('0xac'))][(_0x7606('0xaf'))](_0x7606('0xb1'));}if(_0x5ab5fd[_0x7606('0x46')]!=='agent'){throw new db[(_0x7606('0xac'))][(_0x7606('0xaf'))]('Unauthorized');}}else{throw new db[(_0x7606('0xac'))][(_0x7606('0xaf'))](_0x7606('0x9b'));}return _0x5ab5fd;})[_0x7606('0x3a')](handleEntityNotFound(_0xaacf1,null))[_0x7606('0x3a')](function(_0x23041e){return db[_0x7606('0x7c')][_0x7606('0xb2')]({'attributes':['id',_0x7606('0x7e'),_0x7606('0xb3'),_0x7606('0xb4')]})[_0x7606('0x3a')](function(_0x52c665){if(_0x52c665[_0x7606('0x7e')])authService['validatePasswordPattern'](_0xf19ccc['body'][_0x7606('0xab')]);if(!_0x52c665['enforcePasswordHistory']||!_0x23041e[_0x7606('0xb5')])return _0x23041e;authService['validatePasswordHistory'](_0xf19ccc[_0x7606('0x76')]['newPassword'],_0x23041e[_0x7606('0xb5')],_0x52c665['passwordHistoryLimit']);return _0x23041e;})[_0x7606('0x3a')](saveUpdates({'password':_0xf19ccc['body'][_0x7606('0xab')],'passwordResetAt':_0xf19ccc[_0x7606('0x3e')]['id']==_0xf19ccc[_0x7606('0x79')]['id']?moment():null,'previousPasswords':authService['updatePasswordsHistory'](_0xf19ccc[_0x7606('0x76')][_0x7606('0xab')],_0x23041e[_0x7606('0xb5')])},null));})[_0x7606('0x3a')](respondWithResult(_0xaacf1,null))[_0x7606('0x72')](handleError(_0xaacf1,null));};exports[_0x7606('0xb6')]=function(_0x498771,_0x3b8ca0,_0x14ec7d){var _0x45ecb9=_0x498771[_0x7606('0x76')][_0x7606('0xb7')];return db[_0x7606('0x63')][_0x7606('0x47')]({'where':{'id':_0x498771[_0x7606('0x79')]['id']},'attributes':['id',_0x7606('0x48'),'role','online',_0x7606('0xb8'),'voicePause',_0x7606('0xb9')]})[_0x7606('0x3a')](handleEntityNotFound(_0x3b8ca0,null))[_0x7606('0x3a')](function(_0x3b9ae0){if(_0x3b9ae0){if(!utils[_0x7606('0xba')](_0x45ecb9)){throw new db[(_0x7606('0xac'))][(_0x7606('0xaf'))]('Unknown\x20channel');}return _0x3b9ae0[_0x7606('0xbb')+_[_0x7606('0xbc')](_0x45ecb9[_0x7606('0xbd')]())+_0x7606('0xbe')](_0x498771['body'][_0x7606('0x7a')],{'penalty':_0x498771[_0x7606('0x76')][_0x7606('0xbf')]||0x0})[_0x7606('0xc0')](function(_0x559478){for(var _0x204438=0x0;_0x204438<_0x498771[_0x7606('0x76')][_0x7606('0x7a')][_0x7606('0x59')];_0x204438+=0x1){var _0x2bbeca={'UserId':_0x498771[_0x7606('0x79')]['id']};_0x2bbeca[_[_0x7606('0xbc')](_0x45ecb9[_0x7606('0xbd')]())+'QueueId']=_0x498771[_0x7606('0x76')][_0x7606('0x7a')][_0x204438];socket[_0x7606('0xc1')](_0x7606('0x3e')+_[_0x7606('0xbc')](_0x45ecb9[_0x7606('0xbd')]())+'Queue:save',_0x2bbeca);}return _0x559478;})[_0x7606('0x3a')](function(){if(_0x45ecb9===_0x7606('0xc2')){return db[_0x7606('0xc3')][_0x7606('0x67')]({'where':{'id':_0x498771[_0x7606('0x76')][_0x7606('0x7a')]||[]},'raw':!![],'attributes':['id','name']});}})[_0x7606('0x3a')](function(_0x1b5ef7){var _0x31babd=_0x3b9ae0[_0x7606('0x3c')]({'plain':!![]});var _0x568501=[];if(_0x45ecb9==='voice'&&_0x31babd[_0x7606('0x46')]==='agent'&&_0x31babd[_0x7606('0xc4')]){for(var _0x35952b=0x0;_0x35952b<_0x1b5ef7[_0x7606('0x59')];_0x35952b+=0x1){_0x568501[_0x7606('0x66')]({'membername':_0x31babd['name'],'UserId':_0x31babd['id'],'queue_name':_0x1b5ef7[_0x35952b][_0x7606('0x48')],'VoiceQueueId':_0x1b5ef7[_0x35952b]['id'],'interface':_[_0x7606('0x82')](_0x31babd[_0x7606('0xb9')])?util[_0x7606('0xc5')]('SIP/%s',_0x31babd[_0x7606('0x48')]):_0x31babd[_0x7606('0xb9')],'paused':_0x31babd[_0x7606('0xc6')]||![],'penalty':_0x498771[_0x7606('0x76')][_0x7606('0xbf')]||0x0});}return BPromise['each'](_0x568501,function(_0x3e88ad){return db[_0x7606('0xc7')]['upsert'](_0x3e88ad);});}return _0x3b9ae0;});}})[_0x7606('0x3a')](respondWithStatusCode(_0x3b8ca0,null))[_0x7606('0x72')](handleError(_0x3b8ca0,null));};exports[_0x7606('0xc8')]=function(_0x37454c,_0x2a7149,_0x2be80f){var _0x3b8e42;return db['User']['find']({'where':{'id':_0x37454c['params']['id']},'attributes':['id','name',_0x7606('0x46')]})['then'](handleEntityNotFound(_0x2a7149,null))['then'](function(_0x4bb24b){if(_0x4bb24b){_0x3b8e42=_0x4bb24b;if(!_0x37454c[_0x7606('0x53')]['channel']||!utils[_0x7606('0xba')](_0x37454c['query'][_0x7606('0xb7')])){throw new db[(_0x7606('0xac'))][(_0x7606('0xaf'))]('Unknown\x20channel');}return _0x4bb24b[_0x7606('0xc9')+_[_0x7606('0xbc')](_0x37454c['query'][_0x7606('0xb7')][_0x7606('0xbd')]())+_0x7606('0xbe')](_0x37454c[_0x7606('0x53')][_0x7606('0x7a')]);}})['then'](function(_0x29a42f){if(_['isArray'](_0x37454c['query'][_0x7606('0x7a')])){for(var _0x38bc46=0x0;_0x38bc46<_0x37454c[_0x7606('0x53')][_0x7606('0x7a')][_0x7606('0x59')];_0x38bc46+=0x1){var _0x55f10c={'UserId':_0x37454c[_0x7606('0x79')]['id']};_0x55f10c[_[_0x7606('0xbc')](_0x37454c[_0x7606('0x53')][_0x7606('0xb7')]['toLowerCase']())+'QueueId']=_0x37454c['query'][_0x7606('0x7a')][_0x38bc46];socket[_0x7606('0xc1')]('user'+_[_0x7606('0xbc')](_0x37454c['query'][_0x7606('0xb7')][_0x7606('0xbd')]())+'Queue:remove',_0x55f10c);}}else{var _0x55f10c={'UserId':_0x37454c[_0x7606('0x79')]['id']};_0x55f10c[_[_0x7606('0xbc')](_0x37454c[_0x7606('0x53')][_0x7606('0xb7')][_0x7606('0xbd')]())+_0x7606('0xca')]=_0x37454c['query'][_0x7606('0x7a')];socket['emit'](_0x7606('0x3e')+_[_0x7606('0xbc')](_0x37454c[_0x7606('0x53')][_0x7606('0xb7')][_0x7606('0xbd')]())+_0x7606('0xcb'),_0x55f10c);}return _0x29a42f;})[_0x7606('0x3a')](function(){if(_0x37454c[_0x7606('0x53')][_0x7606('0xb7')]===_0x7606('0xc2')){return db[_0x7606('0xc7')][_0x7606('0x3b')]({'where':{'UserId':_0x37454c[_0x7606('0x79')]['id'],'VoiceQueueId':_0x37454c[_0x7606('0x53')][_0x7606('0x7a')]},'individualHooks':!![]})[_0x7606('0x3a')](function(){return _0x3b8e42;});}return _0x3b8e42;})['then'](respondWithStatusCode(_0x2a7149,null))[_0x7606('0x72')](handleError(_0x2a7149,null));};exports['addAvatar']=function(_0x54cbfd,_0x5549b4,_0x458e1d){_0x54cbfd[_0x7606('0x76')][_0x7606('0xcc')]=_0x54cbfd[_0x7606('0xcd')][_0x7606('0xce')];return db[_0x7606('0x63')][_0x7606('0x47')]({'where':{'id':_0x54cbfd[_0x7606('0x79')]['id']}})[_0x7606('0x3a')](handleEntityNotFound(_0x5549b4,null))[_0x7606('0x3a')](saveUpdates(_0x54cbfd[_0x7606('0x76')],null))[_0x7606('0x3a')](respondWithResult(_0x5549b4,null))[_0x7606('0x72')](handleError(_0x5549b4,null));};exports[_0x7606('0xcf')]=function(_0x5d4726,_0x1f5c63,_0x401652){var _0x116993=path[_0x7606('0xd0')](config[_0x7606('0xd1')],_0x7606('0xd2'));return db[_0x7606('0x63')][_0x7606('0x47')]({'where':{'id':_0x5d4726[_0x7606('0x79')]['id']},'attributes':['id',_0x7606('0xcc')],'raw':!![]})[_0x7606('0x3a')](handleEntityNotFound(_0x1f5c63,null))[_0x7606('0x3a')](function(_0x59815f){if(_0x59815f){if(_[_0x7606('0x82')](_0x59815f[_0x7606('0xcc')])){return _0x1f5c63[_0x7606('0xd3')](_0x116993);}else{if(!fs[_0x7606('0xd4')](path[_0x7606('0xd0')](config[_0x7606('0xd1')],_0x7606('0xd5'),_0x59815f[_0x7606('0xcc')]))){return _0x1f5c63[_0x7606('0xd3')](_0x116993);}return _0x1f5c63[_0x7606('0xd3')](path[_0x7606('0xd0')](config[_0x7606('0xd1')],_0x7606('0xd5'),_0x59815f[_0x7606('0xcc')]));}}})[_0x7606('0x72')](handleError(_0x1f5c63,null));};exports[_0x7606('0xd6')]=function(_0x29048c,_0x391cd3,_0x36a61b){return db[_0x7606('0x63')][_0x7606('0x47')]({'where':{'id':_0x29048c[_0x7606('0x79')]['id']},'attributes':['id']})['then'](handleEntityNotFound(_0x391cd3,null))[_0x7606('0x3a')](function(_0x2814dc){var _0x4d8249=[];values=_0x2814dc['dataValues'];_0x4d8249[_0x7606('0x66')](get_open_tabs(_0x7606('0x6a'),_0x2814dc[_0x7606('0x6c')]));_0x4d8249[_0x7606('0x66')](get_open_tabs('sms',_0x2814dc[_0x7606('0x6c')]));_0x4d8249[_0x7606('0x66')](get_open_tabs(_0x7606('0x6f'),_0x2814dc['dataValues']));_0x4d8249[_0x7606('0x66')](get_open_tabs(_0x7606('0x70'),_0x2814dc['dataValues']));_0x4d8249[_0x7606('0x66')](get_open_tabs(_0x7606('0x6d'),_0x2814dc[_0x7606('0x6c')]));_0x4d8249['push'](get_open_tabs(_0x7606('0x6e'),_0x2814dc[_0x7606('0x6c')]));return BPromise['all'](_0x4d8249);})[_0x7606('0x3a')](function(_0x7e35d4){var _0x14d80c=[];if(_0x7e35d4){for(var _0xfb51ed=0x0;_0xfb51ed=_0x341a0b){_0x114d11=_0x341a0b;_0x4dce97=0xc8;}else{_0x4dce97=0xce;}_0x3f666e[_0x7b40('0x2c')](_0x4dce97);return _0x3f666e[_0x7b40('0x33')](_0x7b40('0x34'),_0x530a25+'-'+_0x114d11+'/'+_0x341a0b)[_0x7b40('0x2e')](_0x382336);}return null;};}function patchUpdates(_0x52126e){return function(_0x487076){try{jsonpatch[_0x7b40('0x35')](_0x487076,_0x52126e,!![]);}catch(_0x1c0528){return BPromise['reject'](_0x1c0528);}return _0x487076['save']();};}function saveUpdates(_0x3e7d69,_0x5806e9){return function(_0x28643c){if(_0x28643c){return _0x28643c[_0x7b40('0x36')](_0x3e7d69)[_0x7b40('0x21')](function(_0x232835){return _0x232835;});}return null;};}function removeEntity(_0x509b0f,_0x3270fa){return function(_0x5d98c7){if(_0x5d98c7){return _0x5d98c7[_0x7b40('0x37')]()[_0x7b40('0x21')](function(){var _0x35668a=_0x5d98c7['get']({'plain':!![]});if(_0x35668a['role']===_0x7b40('0x38'))return;var _0x329a3e=[{'name':'Users','value':_0x7b40('0x39'),'ignore':!![]},{'name':_0x7b40('0x3a'),'value':_0x7b40('0x3b'),'ignore':![]},{'name':_0x7b40('0x3c'),'value':_0x7b40('0x3d'),'ignore':![]}];var _0x4b819e=_(_0x329a3e)['filter'](_0x7b40('0x3e'))[_0x7b40('0x3f')](_0x7b40('0x40'))['value']();if(_[_0x7b40('0x41')](_0x4b819e,_0x35668a[_0x7b40('0x42')])){return;}var _0x1736ac=_[_0x7b40('0x43')](_0x329a3e,[_0x7b40('0x40'),_0x35668a[_0x7b40('0x42')]])[_0x7b40('0x44')];return db[_0x7b40('0x45')]['destroy']({'where':{'type':_0x1736ac,'resourceId':_0x35668a['id']}})[_0x7b40('0x21')](function(){return _0x5d98c7;});})[_0x7b40('0x21')](function(){_0x509b0f[_0x7b40('0x2c')](0xcc)[_0x7b40('0x2d')]();});}};}function handleEntityNotFound(_0x33f282,_0x537aa3){return function(_0x11604e){if(!_0x11604e){_0x33f282[_0x7b40('0x46')](0x194);}return _0x11604e;};}function handleError(_0x295c45,_0x544488){_0x544488=_0x544488||0x1f4;return function(_0x31820c){logger['error'](_0x31820c[_0x7b40('0x47')]);if(_0x31820c[_0x7b40('0x44')]){delete _0x31820c[_0x7b40('0x44')];}_0x295c45[_0x7b40('0x2c')](_0x544488)[_0x7b40('0x48')](_0x31820c);};}exports['index']=function(_0x351614,_0x2c323d){var _0x9a5d95={},_0x522db3={},_0x38e525={'count':0x0,'rows':[]};var _0x1b0356=_[_0x7b40('0x3f')](db[_0x7b40('0x49')][_0x7b40('0x4a')],function(_0x33dfc0){return{'name':_0x33dfc0[_0x7b40('0x4b')],'type':_0x33dfc0[_0x7b40('0x4c')]['key']};});_0x522db3['model']=_[_0x7b40('0x4d')](_[_0x7b40('0x3f')](_0x1b0356,_0x7b40('0x44')),['password',_0x7b40('0x4e')]);_0x522db3[_0x7b40('0x4f')]=_[_0x7b40('0x50')](_0x351614[_0x7b40('0x4f')]);_0x522db3[_0x7b40('0x51')]=_['intersection'](_0x522db3['model'],_0x522db3[_0x7b40('0x4f')]);_0x9a5d95[_0x7b40('0x52')]=_[_0x7b40('0x53')](_0x522db3['model'],qs[_0x7b40('0x54')](_0x351614[_0x7b40('0x4f')][_0x7b40('0x54')]));_0x9a5d95[_0x7b40('0x52')]=_0x9a5d95[_0x7b40('0x52')]['length']?_0x9a5d95[_0x7b40('0x52')]:_0x522db3[_0x7b40('0x55')];if(!_0x351614[_0x7b40('0x4f')][_0x7b40('0x56')]('nolimit')){_0x9a5d95[_0x7b40('0x31')]=qs[_0x7b40('0x31')](_0x351614[_0x7b40('0x4f')]['limit']);_0x9a5d95[_0x7b40('0x2f')]=qs[_0x7b40('0x2f')](_0x351614['query']['offset']);}_0x9a5d95['order']=qs[_0x7b40('0x57')](_0x351614['query']['sort']);_0x9a5d95[_0x7b40('0x58')]=qs[_0x7b40('0x51')](_['pick'](_0x351614[_0x7b40('0x4f')],_0x522db3['filters']),_0x1b0356);if(_0x351614[_0x7b40('0x4f')][_0x7b40('0x59')]){_0x9a5d95[_0x7b40('0x58')]=_[_0x7b40('0x5a')](_0x9a5d95[_0x7b40('0x58')],{'$or':_[_0x7b40('0x3f')](_0x1b0356,function(_0x41c01b){if(_0x41c01b[_0x7b40('0x4c')]!==_0x7b40('0x5b')){return db[_0x7b40('0x5c')]['where'](db['sequelize']['fn'](_0x7b40('0x5d'),db[_0x7b40('0x5c')][_0x7b40('0x5e')](_0x41c01b[_0x7b40('0x44')])),{'$like':db[_0x7b40('0x5c')]['fn'](_0x7b40('0x5d'),'%'+_0x351614[_0x7b40('0x4f')][_0x7b40('0x59')]+'%')});}})});}_0x9a5d95=_[_0x7b40('0x5a')]({},_0x9a5d95,_0x351614[_0x7b40('0x5f')]);var _0x4f798f={'where':_0x9a5d95[_0x7b40('0x58')]};return db[_0x7b40('0x49')][_0x7b40('0x32')](_0x4f798f)[_0x7b40('0x21')](function(_0x51ad42){_0x38e525[_0x7b40('0x32')]=_0x51ad42;if(_0x351614[_0x7b40('0x4f')][_0x7b40('0x60')]){_0x9a5d95[_0x7b40('0x61')]=[{'all':!![]}];}if(!_[_0x7b40('0x41')](_0x9a5d95[_0x7b40('0x52')],'id')){_0x9a5d95[_0x7b40('0x52')]['push']('id');}return db[_0x7b40('0x49')][_0x7b40('0x62')](_0x9a5d95);})[_0x7b40('0x21')](function(_0x319082){_0x38e525[_0x7b40('0x63')]=_0x319082;if(_0x351614['query'][_0x7b40('0x64')]===_0x7b40('0x65')){var _0x5357a7=[];for(var _0x44349f=0x0;_0x44349f<_0x38e525[_0x7b40('0x63')][_0x7b40('0x66')];_0x44349f++){_0x5357a7['push'](get_open_tabs(_0x7b40('0x67'),_0x38e525[_0x7b40('0x63')][_0x44349f][_0x7b40('0x68')]));_0x5357a7[_0x7b40('0x69')](get_open_tabs(_0x7b40('0x6a'),_0x38e525[_0x7b40('0x63')][_0x44349f][_0x7b40('0x68')]));_0x5357a7['push'](get_open_tabs('fax',_0x38e525[_0x7b40('0x63')][_0x44349f][_0x7b40('0x68')]));_0x5357a7[_0x7b40('0x69')](get_open_tabs(_0x7b40('0x6b'),_0x38e525[_0x7b40('0x63')][_0x44349f][_0x7b40('0x68')]));_0x5357a7[_0x7b40('0x69')](get_open_tabs(_0x7b40('0x6c'),_0x38e525[_0x7b40('0x63')][_0x44349f]['dataValues']));_0x5357a7[_0x7b40('0x69')](get_open_tabs(_0x7b40('0x6d'),_0x38e525[_0x7b40('0x63')][_0x44349f]['dataValues']));}return BPromise['all'](_0x5357a7)[_0x7b40('0x21')](function(_0x52d470){return _0x38e525;});}else{return _0x38e525;}})[_0x7b40('0x21')](respondWithFilteredResult(_0x2c323d,_0x9a5d95))['catch'](handleError(_0x2c323d,null));};exports[_0x7b40('0x6e')]=function(_0x30c161,_0x40e57f){var _0x442326={'raw':![],'where':{'id':_0x30c161['params']['id']}},_0x3c5137={};_0x3c5137[_0x7b40('0x55')]=_[_0x7b40('0x4d')](_['keys'](db[_0x7b40('0x49')][_0x7b40('0x4a')]),[_0x7b40('0x6f'),_0x7b40('0x4e')]);_0x3c5137['query']=_[_0x7b40('0x50')](_0x30c161[_0x7b40('0x4f')]);_0x3c5137[_0x7b40('0x51')]=_[_0x7b40('0x53')](_0x3c5137[_0x7b40('0x55')],_0x3c5137[_0x7b40('0x4f')]);_0x442326[_0x7b40('0x52')]=_['intersection'](_0x3c5137[_0x7b40('0x55')],qs[_0x7b40('0x54')](_0x30c161[_0x7b40('0x4f')][_0x7b40('0x54')]));_0x442326[_0x7b40('0x52')]=_0x442326[_0x7b40('0x52')][_0x7b40('0x66')]?_0x442326['attributes']:_0x3c5137[_0x7b40('0x55')];if(_0x30c161['query'][_0x7b40('0x60')]){_0x442326['include']=[{'all':!![]}];}_0x442326=_[_0x7b40('0x5a')]({},_0x442326,_0x30c161[_0x7b40('0x5f')]);if(!_['includes'](_0x442326[_0x7b40('0x52')],'id')){_0x442326[_0x7b40('0x52')][_0x7b40('0x69')]('id');}return db[_0x7b40('0x49')][_0x7b40('0x43')](_0x442326)['then'](handleEntityNotFound(_0x40e57f,null))[_0x7b40('0x21')](function(_0x27a275){var _0xff60a=[];values=_0x27a275;if(_0x30c161[_0x7b40('0x4f')][_0x7b40('0x64')]===_0x7b40('0x65')){_0xff60a[_0x7b40('0x69')](get_open_tabs(_0x7b40('0x67'),_0x27a275[_0x7b40('0x68')]));_0xff60a[_0x7b40('0x69')](get_open_tabs(_0x7b40('0x6a'),_0x27a275[_0x7b40('0x68')]));_0xff60a[_0x7b40('0x69')](get_open_tabs(_0x7b40('0x6c'),_0x27a275[_0x7b40('0x68')]));_0xff60a[_0x7b40('0x69')](get_open_tabs(_0x7b40('0x6d'),_0x27a275[_0x7b40('0x68')]));_0xff60a[_0x7b40('0x69')](get_open_tabs('fax',_0x27a275[_0x7b40('0x68')]));_0xff60a[_0x7b40('0x69')](get_open_tabs('mail',_0x27a275[_0x7b40('0x68')]));return BPromise[_0x7b40('0x70')](_0xff60a);}else{return values;}})[_0x7b40('0x21')](function(_0x14c5cb){return values;})[_0x7b40('0x21')](respondWithResult(_0x40e57f,null))['catch'](handleError(_0x40e57f,null));};exports[_0x7b40('0x36')]=function(_0x47e8ed,_0x1dab78){if(_0x47e8ed[_0x7b40('0x71')]['id']){delete _0x47e8ed['body']['id'];}delete _0x47e8ed[_0x7b40('0x71')][_0x7b40('0x42')];return db[_0x7b40('0x49')]['find']({'where':{'id':_0x47e8ed[_0x7b40('0x72')]['id']}})['then'](handleEntityNotFound(_0x1dab78,null))['then'](saveUpdates(_0x47e8ed['body'],null))[_0x7b40('0x21')](respondWithResult(_0x1dab78,null))[_0x7b40('0x2b')](handleError(_0x1dab78,null));};exports[_0x7b40('0x73')]=function(_0x504044,_0x5b7ab4){return db[_0x7b40('0x49')][_0x7b40('0x73')]()['then'](respondWithResult(_0x5b7ab4,null))[_0x7b40('0x2b')](handleError(_0x5b7ab4,null));};exports[_0x7b40('0x74')]=function(_0x1a276b,_0x87ac1d,_0xeaaac0){return db[_0x7b40('0x49')]['find']({'where':{'id':_0x1a276b[_0x7b40('0x72')]['id']}})[_0x7b40('0x21')](handleEntityNotFound(_0x87ac1d,null))[_0x7b40('0x21')](function(_0x3f6b72){if(_0x3f6b72){return _0x3f6b72[_0x7b40('0x74')](_0x1a276b[_0x7b40('0x71')][_0x7b40('0x75')],_[_0x7b40('0x76')](_0x1a276b['body'],['ids','id'])||{});}})[_0x7b40('0x21')](respondWithResult(_0x87ac1d,null))['catch'](handleError(_0x87ac1d,null));};function validateUser(_0x366330){return new BPromise(function(_0x4a3aab,_0x2dd863){if(_0x366330['internal'])return _0x4a3aab(_0x366330);return db[_0x7b40('0x77')]['findById'](0x1)[_0x7b40('0x21')](function(_0x32ddd5){if(_0x32ddd5[_0x7b40('0x78')])authService[_0x7b40('0x79')](_0x366330[_0x7b40('0x6f')]);db['User'][_0x7b40('0x7a')]('internal')[_0x7b40('0x21')](function(_0x33d93b){if(_[_0x7b40('0x7b')](_0x33d93b)){_0x366330['internal']=_0x32ddd5[_0x7b40('0x7c')]||0x1;return;}if(_[_0x7b40('0x7b')](_0x32ddd5[_0x7b40('0x7c')])||_0x32ddd5[_0x7b40('0x7c')]===_0x33d93b){_0x366330[_0x7b40('0x7d')]=_0x33d93b+0x1;return;}if(_0x32ddd5[_0x7b40('0x7c')]>_0x33d93b){_0x366330['internal']=_0x32ddd5['min_internal'];return;}return db[_0x7b40('0x5c')][_0x7b40('0x4f')](_0x7b40('0x7e'),{'type':db[_0x7b40('0x5c')][_0x7b40('0x7f')][_0x7b40('0x80')]})[_0x7b40('0x21')](function(_0x3920bf){if(_0x3920bf&&_0x3920bf[_0x7b40('0x66')]){for(var _0x4f75e4=0x0,_0x3a4dac=_0x3920bf[_0x7b40('0x66')];_0x4f75e4<_0x3a4dac&&_[_0x7b40('0x7b')](_0x366330[_0x7b40('0x7d')]);_0x4f75e4++){if(_0x32ddd5[_0x7b40('0x7c')]<=_0x3920bf[_0x4f75e4][_0x7b40('0x81')]){_0x366330['internal']=_0x3920bf[_0x4f75e4]['from'];}else if(_0x32ddd5['min_internal']>_0x3920bf[_0x4f75e4][_0x7b40('0x81')]&&_0x32ddd5[_0x7b40('0x7c')]<=_0x3920bf[_0x4f75e4]['to']){_0x366330[_0x7b40('0x7d')]=_0x32ddd5[_0x7b40('0x7c')];}}}if(_[_0x7b40('0x7b')](_0x366330[_0x7b40('0x7d')])){_0x366330[_0x7b40('0x7d')]=_0x33d93b+0x1;}return _0x4a3aab(_0x366330);});});})['catch'](function(_0x2dd59b){_0x2dd863(_0x2dd59b);});});}function updateUser(_0x2251c){return new BPromise(function(_0x4f5f2f,_0xaabfca){try{if(_0x2251c['voicemail']){_0x2251c[_0x7b40('0x82')]=_0x2251c[_0x7b40('0x7d')];_0x2251c[_0x7b40('0x83')]={'mailbox':_0x2251c[_0x7b40('0x7d')],'password':_0x2251c['password'],'fullname':_0x2251c[_0x7b40('0x84')],'email':_0x2251c[_0x7b40('0x85')]};}if(_0x2251c[_0x7b40('0x42')]===_0x7b40('0x3b')){if(!_0x2251c[_0x7b40('0x86')])_0x2251c[_0x7b40('0x86')]=[_0x7b40('0x87'),'102','103',_0x7b40('0x88'),_0x7b40('0x89'),_0x7b40('0x8a'),'105','106',_0x7b40('0x8b'),_0x7b40('0x8c'),_0x7b40('0x8d'),_0x7b40('0x8e'),_0x7b40('0x8f'),_0x7b40('0x90'),_0x7b40('0x91')];}_0x4f5f2f(_0x2251c);}catch(_0x4c86b4){_0xaabfca(_0x4c86b4);}});}exports[_0x7b40('0x92')]=function(_0x1fb0c8,_0x545304){if(_0x1fb0c8[_0x7b40('0x39')]['role']===_0x7b40('0x3b'))throw new Error('Unauthorized');if(_0x1fb0c8[_0x7b40('0x71')][_0x7b40('0x42')]==='user'&&_0x1fb0c8[_0x7b40('0x39')][_0x7b40('0x42')]!==_0x7b40('0x38')){throw new Error(_0x7b40('0x93'));}if(_0x1fb0c8[_0x7b40('0x71')][_0x7b40('0x42')]===_0x7b40('0x38')&&_0x1fb0c8[_0x7b40('0x39')][_0x7b40('0x42')]!==_0x7b40('0x38')){throw new Error(_0x7b40('0x94'));}return licenseUtil['checkUserLimits']([_0x1fb0c8[_0x7b40('0x71')]])[_0x7b40('0x21')](function(){return validateUser(_0x1fb0c8[_0x7b40('0x71')]);})['then'](function(_0x39287a){return updateUser(_0x39287a)[_0x7b40('0x21')](function(_0xc20199){if(_0xc20199[_0x7b40('0x42')]==='admin'){_0xc20199[_0x7b40('0x95')]=_0x1fb0c8[_0x7b40('0x39')]['settingsEnabled'];delete _0xc20199[_0x7b40('0x96')];}return _0xc20199;});})[_0x7b40('0x21')](function(_0x29c638){return db['User'][_0x7b40('0x92')](_0x29c638,{'include':[{'model':db['VoiceMail'],'as':_0x7b40('0x83')}]});})['then'](function(_0x1eae0a){if(_0x1fb0c8[_0x7b40('0x71')]['role']==='user')return _0x1eae0a;if(_0x1fb0c8[_0x7b40('0x39')][_0x7b40('0x42')]!=='user')return _0x1eae0a;return db['UserProfileSection'][_0x7b40('0x43')]({'where':{'name':_0x1eae0a[_0x7b40('0x42')]===_0x7b40('0x3b')?_0x7b40('0x3a'):_0x7b40('0x3c'),'userProfileId':_0x1fb0c8[_0x7b40('0x39')]['userProfileId']},'raw':!![]})[_0x7b40('0x21')](function(_0x33e68a){if(!_0x33e68a||_0x33e68a['autoAssociation']!=0x0)return _0x1eae0a;return db[_0x7b40('0x45')]['create']({'name':_0x1eae0a['name'],'resourceId':_0x1eae0a['id'],'type':_0x33e68a['name'],'sectionId':_0x33e68a['id']},{})[_0x7b40('0x21')](function(){return _0x1eae0a;});})[_0x7b40('0x2b')](function(_0x4bc9f4){logger[_0x7b40('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4bc9f4);throw _0x4bc9f4;});})[_0x7b40('0x21')](respondWithResult(_0x545304,0xc9))['catch'](handleError(_0x545304,null));};exports[_0x7b40('0x97')]=function(_0x1490b6,_0x4248a6){var _0x39e409=_0x1490b6['body'];var _0x2b328d=[];if(_0x1490b6[_0x7b40('0x39')]['role']===_0x7b40('0x3b'))throw new Error(_0x7b40('0x98'));if(_[_0x7b40('0x99')](_0x39e409,[_0x7b40('0x42'),'user'])&&_0x1490b6[_0x7b40('0x39')]['role']!==_0x7b40('0x38')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_[_0x7b40('0x99')](_0x39e409,[_0x7b40('0x42'),_0x7b40('0x38')])&&_0x1490b6['user'][_0x7b40('0x42')]!==_0x7b40('0x38')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator');}return licenseUtil[_0x7b40('0x9a')](_0x39e409)['then'](function(){return validateUser(_0x39e409[0x0]);})[_0x7b40('0x21')](function(){for(var _0x2109f9=0x1;_0x2109f9<_0x39e409[_0x7b40('0x66')];_0x2109f9++){var _0x3deb38=_0x39e409[_0x2109f9-0x1][_0x7b40('0x7d')];if(!_0x39e409[_0x2109f9][_0x7b40('0x7d')])_0x39e409[_0x2109f9]['internal']=_0x3deb38+0x1;_0x2b328d['push'](validateUser(_0x39e409[_0x2109f9]));}return BPromise[_0x7b40('0x70')](_0x2b328d);})['then'](function(){_0x2b328d=[];for(var _0x39ef1c=0x0;_0x39ef1c<_0x39e409['length'];_0x39ef1c++){_0x2b328d[_0x7b40('0x69')](updateUser(_0x39e409[_0x39ef1c]));}return BPromise[_0x7b40('0x70')](_0x2b328d);})['then'](function(){return BPromise[_0x7b40('0x9b')](_0x39e409,function(_0x5dfd37){return db[_0x7b40('0x49')][_0x7b40('0x92')](_0x5dfd37,{'include':[{'model':db[_0x7b40('0x83')],'as':'VoiceMail'}]})[_0x7b40('0x21')](function(_0xd7d446){_0x5dfd37['id']=_0xd7d446['id'];return _0x5dfd37;});});})[_0x7b40('0x21')](function(_0x116608){if(_0x1490b6['body']['role']===_0x7b40('0x39'))return _0x116608;if(_0x1490b6[_0x7b40('0x39')]['role']!==_0x7b40('0x39'))return _0x116608;var _0x2ccc12=_[_0x7b40('0x99')](_0x116608,function(_0x193739){return _0x193739[_0x7b40('0x42')]==='agent'||_0x193739[_0x7b40('0x42')]===_0x7b40('0x3d');});if(!_0x2ccc12)return _0x116608;return db[_0x7b40('0x9c')][_0x7b40('0x62')]({'where':{'name':{'$or':[_0x7b40('0x3a'),'Telephones']},'userProfileId':_0x1490b6[_0x7b40('0x39')]['userProfileId']},'raw':!![]})[_0x7b40('0x21')](function(_0x4db3f2){if(_['isEmpty'](_0x4db3f2)||!_[_0x7b40('0x99')](_0x4db3f2,['autoAssociation',0x0]))return _0x116608;_0x2b328d=[];var _0x193070=_(_0x4db3f2)['map'](function(_0x4f34da){if(_0x4f34da['autoAssociation']===0x1)return;return _0x4f34da['name']===_0x7b40('0x3a')?_0x7b40('0x3b'):_0x7b40('0x3d');})[_0x7b40('0x9d')]()['value']();for(var _0x31dcd5=0x0;_0x31dcd5<_0x116608[_0x7b40('0x66')];_0x31dcd5++){if(!_['includes'](_0x193070,_0x116608[_0x31dcd5]['role']))return;var _0x1b0f8d=_0x116608[_0x31dcd5][_0x7b40('0x42')]==='agent'?_0x7b40('0x3a'):_0x7b40('0x3c');_0x2b328d['push'](db[_0x7b40('0x45')][_0x7b40('0x92')]({'name':_0x116608[_0x31dcd5][_0x7b40('0x44')],'resourceId':_0x116608[_0x31dcd5]['id'],'type':_0x1b0f8d,'sectionId':_[_0x7b40('0x43')](_0x4db3f2,[_0x7b40('0x44'),_0x1b0f8d])['id']},{}));}return BPromise[_0x7b40('0x70')](_0x2b328d);});})[_0x7b40('0x21')](respondWithResult(_0x4248a6,0xc9))['catch'](handleError(_0x4248a6,null));};exports[_0x7b40('0x9e')]=function(_0x27e660,_0x5c997f,_0x3696ee){if(_0x27e660['body']['id']){delete _0x27e660['body']['id'];}return db[_0x7b40('0x49')][_0x7b40('0x43')]({'where':{'id':_0x27e660[_0x7b40('0x72')]['id']}})[_0x7b40('0x21')](function(_0x1a757c){if(!_0x1a757c)return null;if(_0x1a757c['id']===_0x27e660['user']['id']){if(!_0x27e660[_0x7b40('0x71')][_0x7b40('0x9f')]||!_0x27e660[_0x7b40('0x71')][_0x7b40('0xa0')]){throw new db[(_0x7b40('0xa1'))]['ValidationError'](_0x7b40('0xa2'));}if(!_0x1a757c[_0x7b40('0xa3')](_0x27e660[_0x7b40('0x71')]['oldPassword'])){throw new db[(_0x7b40('0xa1'))][(_0x7b40('0xa4'))]('Wrong\x20credentials');}if(_0x27e660[_0x7b40('0x71')]['oldPassword']===_0x27e660[_0x7b40('0x71')][_0x7b40('0xa0')]){throw new db[(_0x7b40('0xa1'))][(_0x7b40('0xa4'))](_0x7b40('0xa5'));}}else if(_0x27e660[_0x7b40('0x39')][_0x7b40('0x42')]===_0x7b40('0x38')){if(!_0x27e660[_0x7b40('0x71')]['newPassword']){throw new db[(_0x7b40('0xa1'))]['ValidationError']('Invalid\x20body\x20format.\x20Use\x20newPassword');}}else if(_0x27e660[_0x7b40('0x39')][_0x7b40('0x42')]===_0x7b40('0x39')){if(!_0x27e660[_0x7b40('0x71')]['newPassword']){throw new db[(_0x7b40('0xa1'))][(_0x7b40('0xa4'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}if(_0x1a757c['role']!==_0x7b40('0x3b')){throw new db[(_0x7b40('0xa1'))][(_0x7b40('0xa4'))]('Unauthorized');}}else{throw new db[(_0x7b40('0xa1'))][(_0x7b40('0xa4'))]('Unauthorized');}return _0x1a757c;})[_0x7b40('0x21')](handleEntityNotFound(_0x5c997f,null))[_0x7b40('0x21')](function(_0x415d71){return db[_0x7b40('0x77')][_0x7b40('0xa6')]({'attributes':['id','securePassword',_0x7b40('0xa7'),_0x7b40('0xa8')]})[_0x7b40('0x21')](function(_0x2c74d4){if(_0x2c74d4['securePassword'])authService[_0x7b40('0x79')](_0x27e660[_0x7b40('0x71')][_0x7b40('0xa0')]);if(!_0x2c74d4['enforcePasswordHistory']||!_0x415d71[_0x7b40('0xa9')])return _0x415d71;authService[_0x7b40('0xaa')](_0x27e660['body'][_0x7b40('0xa0')],_0x415d71[_0x7b40('0xa9')],_0x2c74d4[_0x7b40('0xa8')]);return _0x415d71;})[_0x7b40('0x21')](saveUpdates({'password':_0x27e660[_0x7b40('0x71')][_0x7b40('0xa0')],'passwordResetAt':_0x27e660[_0x7b40('0x39')]['id']==_0x27e660['params']['id']?moment():null,'previousPasswords':authService[_0x7b40('0xab')](_0x27e660['body'][_0x7b40('0xa0')],_0x415d71['previousPasswords'])},null));})[_0x7b40('0x21')](respondWithResult(_0x5c997f,null))[_0x7b40('0x2b')](handleError(_0x5c997f,null));};exports[_0x7b40('0xac')]=function(_0x69aff3,_0x422cff,_0x50718c){var _0x94b38b=_0x69aff3[_0x7b40('0x71')][_0x7b40('0xad')];return db[_0x7b40('0x49')]['find']({'where':{'id':_0x69aff3[_0x7b40('0x72')]['id']},'attributes':['id','name',_0x7b40('0x42'),_0x7b40('0xae'),'loginInPause',_0x7b40('0xaf'),_0x7b40('0xb0')]})[_0x7b40('0x21')](handleEntityNotFound(_0x422cff,null))[_0x7b40('0x21')](function(_0x201635){if(_0x201635){if(!utils[_0x7b40('0xb1')](_0x94b38b)){throw new db[(_0x7b40('0xa1'))]['ValidationError'](_0x7b40('0xb2'));}return _0x201635[_0x7b40('0xb3')+_[_0x7b40('0xb4')](_0x94b38b[_0x7b40('0xb5')]())+_0x7b40('0xb6')](_0x69aff3[_0x7b40('0x71')][_0x7b40('0x75')],{'penalty':_0x69aff3[_0x7b40('0x71')][_0x7b40('0xb7')]||0x0})['spread'](function(_0x2598e3){for(var _0x96f782=0x0;_0x96f782<_0x69aff3[_0x7b40('0x71')][_0x7b40('0x75')][_0x7b40('0x66')];_0x96f782+=0x1){var _0x5e807b={'UserId':_0x69aff3['params']['id']};_0x5e807b[_['capitalize'](_0x94b38b['toLowerCase']())+'QueueId']=_0x69aff3[_0x7b40('0x71')][_0x7b40('0x75')][_0x96f782];socket[_0x7b40('0xb8')](_0x7b40('0x39')+_[_0x7b40('0xb4')](_0x94b38b[_0x7b40('0xb5')]())+_0x7b40('0xb9'),_0x5e807b);}return _0x2598e3;})['then'](function(){if(_0x94b38b===_0x7b40('0xba')){return db['VoiceQueue'][_0x7b40('0x62')]({'where':{'id':_0x69aff3[_0x7b40('0x71')][_0x7b40('0x75')]||[]},'raw':!![],'attributes':['id','name']});}})['then'](function(_0x442bc8){var _0x4e66fd=_0x201635[_0x7b40('0xbb')]({'plain':!![]});var _0x5c0096=[];if(_0x94b38b===_0x7b40('0xba')&&_0x4e66fd[_0x7b40('0x42')]===_0x7b40('0x3b')&&_0x4e66fd[_0x7b40('0xae')]){for(var _0x54ae8e=0x0;_0x54ae8e<_0x442bc8[_0x7b40('0x66')];_0x54ae8e+=0x1){_0x5c0096['push']({'membername':_0x4e66fd['name'],'UserId':_0x4e66fd['id'],'queue_name':_0x442bc8[_0x54ae8e]['name'],'VoiceQueueId':_0x442bc8[_0x54ae8e]['id'],'interface':_[_0x7b40('0x7b')](_0x4e66fd[_0x7b40('0xb0')])?util[_0x7b40('0xbc')](_0x7b40('0xbd'),_0x4e66fd[_0x7b40('0x44')]):_0x4e66fd[_0x7b40('0xb0')],'paused':_0x4e66fd['voicePause']||![],'penalty':_0x69aff3['body']['penalty']||0x0});}return BPromise[_0x7b40('0x9b')](_0x5c0096,function(_0x51f11f){return db[_0x7b40('0xbe')][_0x7b40('0xbf')](_0x51f11f);});}return _0x201635;});}})[_0x7b40('0x21')](respondWithStatusCode(_0x422cff,null))[_0x7b40('0x2b')](handleError(_0x422cff,null));};exports[_0x7b40('0xc0')]=function(_0x582dcf,_0x4e93fb,_0x17a1f5){var _0x11ef01;return db['User'][_0x7b40('0x43')]({'where':{'id':_0x582dcf[_0x7b40('0x72')]['id']},'attributes':['id',_0x7b40('0x44'),_0x7b40('0x42')]})['then'](handleEntityNotFound(_0x4e93fb,null))['then'](function(_0x6b1612){if(_0x6b1612){_0x11ef01=_0x6b1612;if(!_0x582dcf[_0x7b40('0x4f')][_0x7b40('0xad')]||!utils[_0x7b40('0xb1')](_0x582dcf[_0x7b40('0x4f')][_0x7b40('0xad')])){throw new db['Sequelize']['ValidationError'](_0x7b40('0xb2'));}return _0x6b1612['remove'+_['capitalize'](_0x582dcf[_0x7b40('0x4f')]['channel'][_0x7b40('0xb5')]())+_0x7b40('0xb6')](_0x582dcf[_0x7b40('0x4f')]['ids']);}})[_0x7b40('0x21')](function(_0x3e72ce){if(_[_0x7b40('0xc1')](_0x582dcf[_0x7b40('0x4f')][_0x7b40('0x75')])){for(var _0x54524a=0x0;_0x54524a<_0x582dcf[_0x7b40('0x4f')][_0x7b40('0x75')][_0x7b40('0x66')];_0x54524a+=0x1){var _0x18f865={'UserId':_0x582dcf[_0x7b40('0x72')]['id']};_0x18f865[_[_0x7b40('0xb4')](_0x582dcf['query'][_0x7b40('0xad')][_0x7b40('0xb5')]())+_0x7b40('0xc2')]=_0x582dcf[_0x7b40('0x4f')][_0x7b40('0x75')][_0x54524a];socket[_0x7b40('0xb8')](_0x7b40('0x39')+_[_0x7b40('0xb4')](_0x582dcf[_0x7b40('0x4f')][_0x7b40('0xad')][_0x7b40('0xb5')]())+_0x7b40('0xc3'),_0x18f865);}}else{var _0x18f865={'UserId':_0x582dcf[_0x7b40('0x72')]['id']};_0x18f865[_['capitalize'](_0x582dcf['query'][_0x7b40('0xad')][_0x7b40('0xb5')]())+_0x7b40('0xc2')]=_0x582dcf['query'][_0x7b40('0x75')];socket['emit'](_0x7b40('0x39')+_[_0x7b40('0xb4')](_0x582dcf[_0x7b40('0x4f')]['channel'][_0x7b40('0xb5')]())+_0x7b40('0xc3'),_0x18f865);}return _0x3e72ce;})[_0x7b40('0x21')](function(){if(_0x582dcf[_0x7b40('0x4f')][_0x7b40('0xad')]===_0x7b40('0xba')){return db[_0x7b40('0xbe')][_0x7b40('0x37')]({'where':{'UserId':_0x582dcf[_0x7b40('0x72')]['id'],'VoiceQueueId':_0x582dcf['query'][_0x7b40('0x75')]},'individualHooks':!![]})['then'](function(){return _0x11ef01;});}return _0x11ef01;})[_0x7b40('0x21')](respondWithStatusCode(_0x4e93fb,null))[_0x7b40('0x2b')](handleError(_0x4e93fb,null));};exports[_0x7b40('0xc4')]=function(_0x4cc1a4,_0x1d0c4f,_0x503e68){_0x4cc1a4['body'][_0x7b40('0xc5')]=_0x4cc1a4['file'][_0x7b40('0xc6')];return db[_0x7b40('0x49')][_0x7b40('0x43')]({'where':{'id':_0x4cc1a4[_0x7b40('0x72')]['id']}})['then'](handleEntityNotFound(_0x1d0c4f,null))['then'](saveUpdates(_0x4cc1a4[_0x7b40('0x71')],null))[_0x7b40('0x21')](respondWithResult(_0x1d0c4f,null))['catch'](handleError(_0x1d0c4f,null));};exports['getAvatar']=function(_0x40ece2,_0x47d01a,_0x447e){var _0x4db04f=path[_0x7b40('0xc7')](config[_0x7b40('0xc8')],'server/files/images/logos/default_profile.png');return db[_0x7b40('0x49')][_0x7b40('0x43')]({'where':{'id':_0x40ece2['params']['id']},'attributes':['id','userpic'],'raw':!![]})[_0x7b40('0x21')](handleEntityNotFound(_0x47d01a,null))[_0x7b40('0x21')](function(_0x3b00a4){if(_0x3b00a4){if(_[_0x7b40('0x7b')](_0x3b00a4[_0x7b40('0xc5')])){return _0x47d01a[_0x7b40('0xc9')](_0x4db04f);}else{if(!fs[_0x7b40('0xca')](path[_0x7b40('0xc7')](config[_0x7b40('0xc8')],'server/files/images/',_0x3b00a4['userpic']))){return _0x47d01a[_0x7b40('0xc9')](_0x4db04f);}return _0x47d01a[_0x7b40('0xc9')](path[_0x7b40('0xc7')](config[_0x7b40('0xc8')],_0x7b40('0xcb'),_0x3b00a4[_0x7b40('0xc5')]));}}})[_0x7b40('0x2b')](handleError(_0x47d01a,null));};exports[_0x7b40('0xcc')]=function(_0x26b2d2,_0x3fa67e,_0x250638){return db[_0x7b40('0x49')][_0x7b40('0x43')]({'where':{'id':_0x26b2d2[_0x7b40('0x72')]['id']},'attributes':['id']})[_0x7b40('0x21')](handleEntityNotFound(_0x3fa67e,null))['then'](function(_0x2442f2){var _0x55d713=[];values=_0x2442f2[_0x7b40('0x68')];_0x55d713[_0x7b40('0x69')](get_open_tabs(_0x7b40('0x67'),_0x2442f2[_0x7b40('0x68')]));_0x55d713[_0x7b40('0x69')](get_open_tabs(_0x7b40('0x6a'),_0x2442f2[_0x7b40('0x68')]));_0x55d713[_0x7b40('0x69')](get_open_tabs(_0x7b40('0x6c'),_0x2442f2[_0x7b40('0x68')]));_0x55d713['push'](get_open_tabs('whatsapp',_0x2442f2[_0x7b40('0x68')]));_0x55d713[_0x7b40('0x69')](get_open_tabs(_0x7b40('0xcd'),_0x2442f2['dataValues']));_0x55d713['push'](get_open_tabs(_0x7b40('0x6b'),_0x2442f2[_0x7b40('0x68')]));return BPromise[_0x7b40('0x70')](_0x55d713);})['then'](function(_0x1f8ccb){var _0x135199=[];if(_0x1f8ccb){for(var _0x2daf74=0x0;_0x2daf74=_0x5b3f0c[_0xf0ef('0x50')]){throw new Error(_0xf0ef('0x51'));}})[_0xf0ef('0x26')](function(){if(_0x171069){return db['UserVoiceQueueRt'][_0xf0ef('0x52')]({'where':{'membername':_0x171069[_0xf0ef('0x27')]},'individualHooks':!![]});}})[_0xf0ef('0x26')](function(){if(_0x171069){return _0x171069[_0xf0ef('0x53')]({'raw':!![]});}})['then'](function(_0x359942){if(_0x171069){if(_0x359942){var _0x2043eb=[];_0x4b77e2=_0x359942;if(_0x4b77e2['length']){for(var _0x276dc2=0x0;_0x276dc2<_0x4b77e2['length'];_0x276dc2++){_0x2043eb[_0xf0ef('0x45')](db[_0xf0ef('0x2b')][_0xf0ef('0x54')]({'membername':_0x171069[_0xf0ef('0x27')],'UserId':_0x171069['id'],'queue_name':_0x4b77e2[_0x276dc2]['name'],'VoiceQueueId':_0x4b77e2[_0x276dc2]['id'],'interface':_0x2b5dc9,'paused':_0x171069[_0xf0ef('0x4c')]||![],'penalty':_0x4b77e2[_0x276dc2][_0xf0ef('0x55')]||0x0}));}return BPromise[_0xf0ef('0x47')](_0x2043eb);}}}})[_0xf0ef('0x26')](function(){if(_0x171069){return db[_0xf0ef('0x2d')][_0xf0ef('0x1b')]({'where':{'membername':_0x171069[_0xf0ef('0x27')],'exitAt':null}});}})['then'](function(_0x33a083){if(_0x171069){if(_0x33a083&&_0x33a083[_0xf0ef('0x2f')]){var _0x543f7e=[];_0x33a083['forEach'](function(_0x15901b){_0x543f7e['push'](_0x15901b[_0xf0ef('0x2c')]({'exitAt':moment()[_0xf0ef('0x30')](_0xf0ef('0x31'))}));});return BPromise['all'](_0x543f7e);}}})[_0xf0ef('0x26')](function(_0x4bb7c3){if(_0x171069){var _0x40be4b=[];var _0x5d2f18=[];var _0x368eec=utils[_0xf0ef('0x33')]();var _0x505a98={'membername':_0x171069[_0xf0ef('0x27')],'interface':_0x2b5dc9,'enterAt':moment()[_0xf0ef('0x30')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x171069[_0xf0ef('0x28')],'internal':_0x171069[_0xf0ef('0x29')]};_0x368eec[_0xf0ef('0x56')](function(_0x5e91df){_0x40be4b[_0xf0ef('0x45')](_[_0xf0ef('0x57')]({'channel':_0x5e91df,'type':_0xf0ef('0x58'),'data1':_0xf0ef('0x59'),'data2':_0x2b5dc9},_0x505a98));if(_0x171069[_0xf0ef('0x4c')]){_0x5d2f18[_0xf0ef('0x45')](_[_0xf0ef('0x57')]({'channel':_0x5e91df,'type':_0xf0ef('0x2e'),'data1':_0xf0ef('0x5a')},_0x505a98));}});return db[_0xf0ef('0x2d')][_0xf0ef('0x37')](_0x40be4b[_0xf0ef('0x5b')](_0x5d2f18),{'individualHooks':!![]});}})['then'](function(){if(_0x171069){return _0x171069[_0xf0ef('0x2c')]({'online':!![],'lastLoginAt':moment()[_0xf0ef('0x30')](_0xf0ef('0x31')),'voicePause':_0x171069['loginInPause']||![],'mailPause':_0x171069[_0xf0ef('0x4c')]||![],'chatPause':_0x171069[_0xf0ef('0x4c')]||![],'faxPause':_0x171069[_0xf0ef('0x4c')]||![],'smsPause':_0x171069['loginInPause']||![],'openchannelPause':_0x171069[_0xf0ef('0x4c')]||![],'pauseType':_0x171069['loginInPause']?_0xf0ef('0x5a'):null,'lastPauseAt':moment()[_0xf0ef('0x30')](_0xf0ef('0x31')),'interface':_0x2b5dc9});}})[_0xf0ef('0x26')](function(_0x513230){_0x2398ae(_0x513230);})[_0xf0ef('0x18')](function(_0x1c49c1){_0x164ce8(_0x4cb9b4[_0xf0ef('0x15')](0x1f4,_0x1c49c1['message']));});});}; \ No newline at end of file +var _0x963c=['Pause','all','destroy','mobile','phone','SIP/%s','count','agent','../../config/license/util','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','getVoiceQueues','upsert','loginInPause','UserVoiceQueue.penalty','push','merge','LOGIN','LOGININPAUSE','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./user.socket','register','request','then','info','User,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','GetUser','User','findAll','options','where','attributes','limit','include','map','model','stringify','ShowUser','find','raw','PauseUser','role','internal','interface','UserVoiceQueueRt','update','MemberReport','name','PAUSE','YYYY-MM-DD\x20HH:mm:ss','length','updateAttributes','getChannels','forEach','format','body','type','DEFAULT\x20PAUSE','bulkCreate','UnpauseUser','findOne','channel','isValidChannel','Unknown\x20channel','system','mail','chat','fax','sms','whatsapp','set','%s%s'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x963c,0x12e));var _0xc963=function(_0x3edf58,_0xa73f7d){_0x3edf58=_0x3edf58-0x0;var _0x467b73=_0x963c[_0x3edf58];return _0x467b73;};'use strict';var _=require(_0xc963('0x0'));var util=require(_0xc963('0x1'));var moment=require(_0xc963('0x2'));var BPromise=require(_0xc963('0x3'));var rs=require(_0xc963('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xc963('0x5'));var logger=require(_0xc963('0x6'))(_0xc963('0x7'));var config=require(_0xc963('0x8'));var jayson=require(_0xc963('0x9'));var client=jayson[_0xc963('0xa')][_0xc963('0xb')]({'port':0x232a});config[_0xc963('0xc')]=_['defaults'](config[_0xc963('0xc')],{'host':_0xc963('0xd'),'port':0x18eb});var socket=require(_0xc963('0xe'))(new Redis(config[_0xc963('0xc')]));require(_0xc963('0xf'))[_0xc963('0x10')](socket);function respondWithRpcPromise(_0x24c0f1,_0x408067,_0x1dcb5e){return new BPromise(function(_0x1acaf2,_0x20c99c){return client[_0xc963('0x11')](_0x24c0f1,_0x1dcb5e)[_0xc963('0x12')](function(_0x2620f7){logger[_0xc963('0x13')](_0xc963('0x14'),_0x408067,_0xc963('0x15'));logger[_0xc963('0x16')]('User,\x20%s,\x20%s,\x20%s',_0x408067,'request\x20sent',JSON['stringify'](_0x2620f7));if(_0x2620f7[_0xc963('0x17')]){if(_0x2620f7[_0xc963('0x17')][_0xc963('0x18')]===0x1f4){logger[_0xc963('0x17')](_0xc963('0x14'),_0x408067,_0x2620f7['error'][_0xc963('0x19')]);return _0x20c99c(_0x2620f7[_0xc963('0x17')]['message']);}logger[_0xc963('0x17')](_0xc963('0x14'),_0x408067,_0x2620f7[_0xc963('0x17')][_0xc963('0x19')]);return _0x1acaf2(_0x2620f7[_0xc963('0x17')][_0xc963('0x19')]);}else{logger['info'](_0xc963('0x14'),_0x408067,_0xc963('0x15'));_0x1acaf2(_0x2620f7[_0xc963('0x1a')][_0xc963('0x19')]);}})[_0xc963('0x1b')](function(_0x5b5672){logger[_0xc963('0x17')](_0xc963('0x14'),_0x408067,_0x5b5672);_0x20c99c(_0x5b5672);});});}exports[_0xc963('0x1c')]=function(_0x5ca302){var _0x7b6c34=this;return new Promise(function(_0x1d7fa5,_0x23dc35){return db[_0xc963('0x1d')][_0xc963('0x1e')]({'raw':_0x5ca302['options']?_0x5ca302['options']['raw']===undefined?!![]:![]:!![],'where':_0x5ca302[_0xc963('0x1f')]?_0x5ca302[_0xc963('0x1f')][_0xc963('0x20')]||null:null,'attributes':_0x5ca302[_0xc963('0x1f')]?_0x5ca302[_0xc963('0x1f')][_0xc963('0x21')]||null:null,'limit':_0x5ca302[_0xc963('0x1f')]?_0x5ca302[_0xc963('0x1f')][_0xc963('0x22')]||null:null,'include':_0x5ca302[_0xc963('0x1f')]?_0x5ca302[_0xc963('0x1f')][_0xc963('0x23')]?_[_0xc963('0x24')](_0x5ca302[_0xc963('0x1f')][_0xc963('0x23')],function(_0x13dfc4){return{'model':db[_0x13dfc4[_0xc963('0x25')]],'as':_0x13dfc4['as'],'attributes':_0x13dfc4[_0xc963('0x21')],'include':_0x13dfc4[_0xc963('0x23')]?_[_0xc963('0x24')](_0x13dfc4[_0xc963('0x23')],function(_0x4beb15){return{'model':db[_0x4beb15[_0xc963('0x25')]],'as':_0x4beb15['as'],'attributes':_0x4beb15[_0xc963('0x21')],'include':_0x4beb15[_0xc963('0x23')]?_[_0xc963('0x24')](_0x4beb15[_0xc963('0x23')],function(_0x5d9865){return{'model':db[_0x5d9865[_0xc963('0x25')]],'as':_0x5d9865['as'],'attributes':_0x5d9865['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x16858b){logger['info'](_0xc963('0x1c'),_0x5ca302);logger[_0xc963('0x16')](_0xc963('0x1c'),_0x5ca302,JSON[_0xc963('0x26')](_0x16858b));_0x1d7fa5(_0x16858b);})[_0xc963('0x1b')](function(_0x5fdda9){logger[_0xc963('0x17')](_0xc963('0x1c'),_0x5fdda9[_0xc963('0x19')],_0x5ca302);_0x23dc35(_0x7b6c34[_0xc963('0x17')](0x1f4,_0x5fdda9[_0xc963('0x19')]));});});};exports[_0xc963('0x27')]=function(_0x58f4b5){var _0x2f9820=this;return new Promise(function(_0x5e62ff,_0x3a5da3){return db[_0xc963('0x1d')][_0xc963('0x28')]({'raw':_0x58f4b5[_0xc963('0x1f')]?_0x58f4b5[_0xc963('0x1f')][_0xc963('0x29')]===undefined?!![]:![]:!![],'where':_0x58f4b5[_0xc963('0x1f')]?_0x58f4b5['options']['where']||null:null,'attributes':_0x58f4b5['options']?_0x58f4b5['options']['attributes']||null:null,'include':_0x58f4b5['options']?_0x58f4b5['options'][_0xc963('0x23')]?_['map'](_0x58f4b5[_0xc963('0x1f')][_0xc963('0x23')],function(_0xb5b5a1){return{'model':db[_0xb5b5a1['model']],'as':_0xb5b5a1['as'],'attributes':_0xb5b5a1[_0xc963('0x21')],'include':_0xb5b5a1[_0xc963('0x23')]?_[_0xc963('0x24')](_0xb5b5a1[_0xc963('0x23')],function(_0x308937){return{'model':db[_0x308937['model']],'as':_0x308937['as'],'attributes':_0x308937['attributes'],'include':_0x308937['include']?_[_0xc963('0x24')](_0x308937[_0xc963('0x23')],function(_0x57d11e){return{'model':db[_0x57d11e[_0xc963('0x25')]],'as':_0x57d11e['as'],'attributes':_0x57d11e[_0xc963('0x21')]};}):[]};}):[]};}):[]:[]})[_0xc963('0x12')](function(_0x37931d){logger[_0xc963('0x13')]('ShowUser',_0x58f4b5);logger[_0xc963('0x16')](_0xc963('0x27'),_0x58f4b5,JSON[_0xc963('0x26')](_0x37931d));_0x5e62ff(_0x37931d);})['catch'](function(_0x57e755){logger[_0xc963('0x17')](_0xc963('0x27'),_0x57e755[_0xc963('0x19')],_0x58f4b5);_0x3a5da3(_0x2f9820[_0xc963('0x17')](0x1f4,_0x57e755[_0xc963('0x19')]));});});};exports[_0xc963('0x2a')]=function(_0x550c41){var _0x670cb6=this;return new Promise(function(_0x5bc81d,_0x24e15b){var _0x4d6a9a;return db['User'][_0xc963('0x28')]({'where':_0x550c41[_0xc963('0x1f')]['where']||{},'attributes':['id','name',_0xc963('0x2b'),_0xc963('0x2c'),_0xc963('0x2d')]})['then'](function(_0x1f93c2){if(_0x1f93c2){_0x4d6a9a=_0x1f93c2;return db[_0xc963('0x2e')][_0xc963('0x2f')]({'paused':0x1},{'where':{'UserId':_0x4d6a9a['id']},'individualHooks':!![]});}})[_0xc963('0x12')](function(){if(_0x4d6a9a){return db[_0xc963('0x30')]['findAll']({'where':{'membername':_0x4d6a9a[_0xc963('0x31')],'type':_0xc963('0x32'),'exitAt':null}});}})[_0xc963('0x12')](function(_0x69122e){if(_0x4d6a9a){if(_0x69122e&&_0x69122e['length']){var _0x30a67e=moment()['format'](_0xc963('0x33'));for(var _0x10fcb3=0x0,_0x2849c0=_0x69122e[_0xc963('0x34')];_0x10fcb3<_0x2849c0;_0x10fcb3++){_0x69122e[_0x10fcb3][_0xc963('0x35')]({'exitAt':_0x30a67e});}}}})[_0xc963('0x12')](function(){if(_0x4d6a9a){var _0x473305=[];var _0x3b8bf0=utils[_0xc963('0x36')]();_0x3b8bf0[_0xc963('0x37')](function(_0x20ecea){_0x473305['push']({'channel':_0x20ecea,'membername':_0x4d6a9a[_0xc963('0x31')],'interface':_['isNil'](_0x4d6a9a[_0xc963('0x2d')])?util[_0xc963('0x38')]('SIP/%s',_0x4d6a9a['name']):_0x4d6a9a[_0xc963('0x2d')],'type':_0xc963('0x32'),'enterAt':moment()['format'](_0xc963('0x33')),'data1':_0x550c41[_0xc963('0x39')][_0xc963('0x3a')]||_0xc963('0x3b'),'role':_0x4d6a9a[_0xc963('0x2b')],'internal':_0x4d6a9a[_0xc963('0x2c')],'uniqueid':_0x550c41['body']['uniqueid']||null});});return db[_0xc963('0x30')][_0xc963('0x3c')](_0x473305,{'individualHooks':!![]});}})[_0xc963('0x12')](function(){if(_0x4d6a9a){return _0x4d6a9a[_0xc963('0x2f')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x550c41['body']['type']||_0xc963('0x3b'),'lastPauseAt':moment()['format'](_0xc963('0x33'))});}})[_0xc963('0x12')](function(_0x318286){_0x5bc81d(_0x318286);})[_0xc963('0x1b')](function(_0x381a7b){_0x24e15b(_0x670cb6[_0xc963('0x17')](0x1f4,_0x381a7b['message']));});});};exports[_0xc963('0x3d')]=function(_0x2d3913){var _0x590512=this;return new Promise(function(_0xf9dc6d,_0x15d745){var _0x185d65;return db[_0xc963('0x1d')][_0xc963('0x3e')]({'where':_0x2d3913[_0xc963('0x1f')][_0xc963('0x20')]||{},'attributes':['id',_0xc963('0x31')]})[_0xc963('0x12')](function(_0x5d1e50){if(_0x5d1e50){_0x185d65=_0x5d1e50;if(_0x2d3913[_0xc963('0x39')][_0xc963('0x3f')]&&!utils[_0xc963('0x40')](_0x2d3913[_0xc963('0x39')]['channel'])){throw new Error(_0xc963('0x41'));}switch(_0x2d3913['body'][_0xc963('0x3f')]){case'voice':return db[_0xc963('0x2e')][_0xc963('0x2f')]({'paused':0x0},{'where':{'UserId':_0x185d65['id']}})[_0xc963('0x12')](function(){return db[_0xc963('0x30')][_0xc963('0x28')]({'where':{'channel':_0x2d3913[_0xc963('0x39')]['channel'],'membername':_0x185d65[_0xc963('0x31')],'type':'PAUSE','exitAt':null}});})['then'](function(_0x435871){if(_0x435871){return _0x435871[_0xc963('0x2f')]({'exitAt':moment()[_0xc963('0x38')](_0xc963('0x33')),'data2':_0xc963('0x42')},{'individualHooks':!![]});}return null;})[_0xc963('0x12')](function(){return _0x185d65[_0xc963('0x2f')]({'voicePause':![]});});case _0xc963('0x43'):case _0xc963('0x44'):case _0xc963('0x45'):case _0xc963('0x46'):case'openchannel':case _0xc963('0x47'):return db[_0xc963('0x30')]['find']({'where':{'channel':_0x2d3913[_0xc963('0x39')][_0xc963('0x3f')],'membername':_0x185d65[_0xc963('0x31')],'type':_0xc963('0x32'),'exitAt':null}})[_0xc963('0x12')](function(_0x1ff9ea){return _0x1ff9ea['update']({'exitAt':moment()[_0xc963('0x38')](_0xc963('0x33')),'data2':_0xc963('0x42')},{'individualHooks':!![]});})[_0xc963('0x12')](function(){var _0x403a48={};_[_0xc963('0x48')](_0x403a48,util[_0xc963('0x38')](_0xc963('0x49'),_0x2d3913[_0xc963('0x39')][_0xc963('0x3f')],_0xc963('0x4a')),![]);return _0x185d65['update'](_0x403a48);});default:return db[_0xc963('0x2e')][_0xc963('0x2f')]({'paused':0x0},{'where':{'UserId':_0x185d65['id']}})[_0xc963('0x12')](function(){return db[_0xc963('0x30')][_0xc963('0x1e')]({'where':{'membername':_0x185d65[_0xc963('0x31')],'type':_0xc963('0x32'),'exitAt':null}});})[_0xc963('0x12')](function(_0x330c0e){var _0x55d758=[];_0x330c0e[_0xc963('0x37')](function(_0x5775d7){_0x55d758['push'](_0x5775d7[_0xc963('0x2f')]({'exitAt':moment()['format'](_0xc963('0x33')),'data2':_0xc963('0x42')}));});return BPromise[_0xc963('0x4b')](_0x55d758);})[_0xc963('0x12')](function(){return _0x185d65[_0xc963('0x2f')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![]});});}}})[_0xc963('0x12')](function(_0x5be4a9){_0xf9dc6d(_0x5be4a9);})['catch'](function(_0x3948de){_0x15d745(_0x590512[_0xc963('0x17')](0x1f4,_0x3948de['message']));});});};exports['LogoutUser']=function(_0x1ea87f){var _0x2f4afc=this;return new Promise(function(_0x5a9a67,_0x197bee){var _0x468d4b;return db['User']['findOne']({'where':_0x1ea87f[_0xc963('0x1f')]['where']||{},'attributes':['id','name']})['then'](function(_0x3194f5){if(_0x3194f5){_0x468d4b=_0x3194f5;return db[_0xc963('0x2e')][_0xc963('0x4c')]({'where':{'membername':_0x468d4b[_0xc963('0x31')]},'individualHooks':!![]});}})[_0xc963('0x12')](function(){if(_0x468d4b){return db[_0xc963('0x30')][_0xc963('0x1e')]({'where':{'membername':_0x468d4b[_0xc963('0x31')],'exitAt':null}});}})[_0xc963('0x12')](function(_0x3bffe7){if(_0x468d4b){if(_0x3bffe7&&_0x3bffe7[_0xc963('0x34')]){var _0x430b62=[];_0x3bffe7[_0xc963('0x37')](function(_0x27dca7){_0x430b62['push'](_0x27dca7[_0xc963('0x2f')]({'exitAt':moment()[_0xc963('0x38')](_0xc963('0x33'))}));});return BPromise[_0xc963('0x4b')](_0x430b62);}}})[_0xc963('0x12')](function(){if(_0x468d4b){return _0x468d4b[_0xc963('0x2f')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})['then'](function(_0x3cfecb){_0x5a9a67(_0x3cfecb);})[_0xc963('0x1b')](function(_0x387f68){_0x197bee(_0x2f4afc[_0xc963('0x17')](0x1f4,_0x387f68[_0xc963('0x19')]));});});};exports['LoginUser']=function(_0x31c8e6){var _0x470ac0=this;return new Promise(function(_0xa1d359,_0x1c69df){var _0xce2932;var _0x2596ad;var _0x49fb16;var _0x315862;return db[_0xc963('0x1d')][_0xc963('0x3e')]({'where':_0x31c8e6[_0xc963('0x1f')][_0xc963('0x20')]||{},'attributes':['id',_0xc963('0x31'),_0xc963('0x2b'),_0xc963('0x4d'),_0xc963('0x4e'),_0xc963('0x2c'),'loginInPause','interface']})[_0xc963('0x12')](function(_0x66c122){if(_0x66c122){_0xce2932=_0x66c122;_0x315862=_0x31c8e6[_0xc963('0x39')][_0xc963('0x2d')]?_0x31c8e6['body'][_0xc963('0x2d')]:util['format'](_0xc963('0x4f'),_0xce2932[_0xc963('0x31')]);return db[_0xc963('0x1d')][_0xc963('0x50')]({'where':{'role':_0xc963('0x51'),'online':!![],'id':{'$ne':_0xce2932['id']}}});}})[_0xc963('0x12')](function(_0xe5d308){if(_0xe5d308){_0x49fb16=_0xe5d308;return require(_0xc963('0x52'))[_0xc963('0x53')]();}})[_0xc963('0x12')](function(_0x462970){if(_0x462970&&_0x462970[_0xc963('0x54')]&&_0x49fb16>=_0x462970[_0xc963('0x54')]){throw new Error(_0xc963('0x55'));}})[_0xc963('0x12')](function(){if(_0xce2932){return db['UserVoiceQueueRt'][_0xc963('0x4c')]({'where':{'membername':_0xce2932['name']},'individualHooks':!![]});}})[_0xc963('0x12')](function(){if(_0xce2932){return _0xce2932[_0xc963('0x56')]({'raw':!![]});}})['then'](function(_0x5bffa0){if(_0xce2932){if(_0x5bffa0){var _0x3b2d07=[];_0x2596ad=_0x5bffa0;if(_0x2596ad[_0xc963('0x34')]){for(var _0x211a64=0x0;_0x211a64<_0x2596ad[_0xc963('0x34')];_0x211a64++){_0x3b2d07['push'](db[_0xc963('0x2e')][_0xc963('0x57')]({'membername':_0xce2932[_0xc963('0x31')],'UserId':_0xce2932['id'],'queue_name':_0x2596ad[_0x211a64][_0xc963('0x31')],'VoiceQueueId':_0x2596ad[_0x211a64]['id'],'interface':_0x315862,'paused':_0xce2932[_0xc963('0x58')]||![],'penalty':_0x2596ad[_0x211a64][_0xc963('0x59')]||0x0}));}return BPromise[_0xc963('0x4b')](_0x3b2d07);}}}})['then'](function(){if(_0xce2932){return db[_0xc963('0x30')]['findAll']({'where':{'membername':_0xce2932['name'],'exitAt':null}});}})[_0xc963('0x12')](function(_0x3e302a){if(_0xce2932){if(_0x3e302a&&_0x3e302a['length']){var _0x6c418b=[];_0x3e302a['forEach'](function(_0x530dcd){_0x6c418b[_0xc963('0x5a')](_0x530dcd[_0xc963('0x2f')]({'exitAt':moment()[_0xc963('0x38')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0xc963('0x4b')](_0x6c418b);}}})[_0xc963('0x12')](function(_0x3206d8){if(_0xce2932){var _0x2e1a3d=[];var _0x7f24d2=[];var _0x38af27=utils[_0xc963('0x36')]();var _0x484b49={'membername':_0xce2932[_0xc963('0x31')],'interface':_0x315862,'enterAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'role':_0xce2932['role'],'internal':_0xce2932[_0xc963('0x2c')]};_0x38af27[_0xc963('0x37')](function(_0x2c29dc){_0x2e1a3d['push'](_[_0xc963('0x5b')]({'channel':_0x2c29dc,'type':_0xc963('0x5c'),'data1':'callysquare','data2':_0x315862},_0x484b49));if(_0xce2932[_0xc963('0x58')]){_0x7f24d2[_0xc963('0x5a')](_['merge']({'channel':_0x2c29dc,'type':_0xc963('0x32'),'data1':_0xc963('0x5d')},_0x484b49));}});return db[_0xc963('0x30')]['bulkCreate'](_0x2e1a3d['concat'](_0x7f24d2),{'individualHooks':!![]});}})[_0xc963('0x12')](function(){if(_0xce2932){return _0xce2932[_0xc963('0x2f')]({'online':!![],'lastLoginAt':moment()[_0xc963('0x38')](_0xc963('0x33')),'voicePause':_0xce2932[_0xc963('0x58')]||![],'mailPause':_0xce2932[_0xc963('0x58')]||![],'chatPause':_0xce2932['loginInPause']||![],'faxPause':_0xce2932[_0xc963('0x58')]||![],'smsPause':_0xce2932[_0xc963('0x58')]||![],'openchannelPause':_0xce2932['loginInPause']||![],'pauseType':_0xce2932[_0xc963('0x58')]?'LOGININPAUSE':null,'lastPauseAt':moment()[_0xc963('0x38')](_0xc963('0x33')),'interface':_0x315862});}})[_0xc963('0x12')](function(_0x44f205){_0xa1d359(_0x44f205);})[_0xc963('0x1b')](function(_0x12390a){_0x1c69df(_0x470ac0[_0xc963('0x17')](0x1f4,_0x12390a['message']));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index 1133856..59b98a3 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 _0x85d8=['removeListener','register','length','./user.events','remove','update'];(function(_0x1c081d,_0x10b432){var _0x2deb0e=function(_0x43fcbd){while(--_0x43fcbd){_0x1c081d['push'](_0x1c081d['shift']());}};_0x2deb0e(++_0x10b432);}(_0x85d8,0x1d7));var _0x885d=function(_0x2e3b4e,_0x2fef00){_0x2e3b4e=_0x2e3b4e-0x0;var _0x29275d=_0x85d8[_0x2e3b4e];return _0x29275d;};'use strict';var UserEvents=require(_0x885d('0x0'));var events=['save',_0x885d('0x1'),_0x885d('0x2')];function createListener(_0x5e52de,_0x2de984){return function(_0x4c09c8){_0x2de984['emit'](_0x5e52de,_0x4c09c8);};}function removeListener(_0x1c1b14,_0x4dadcc){return function(){UserEvents[_0x885d('0x3')](_0x1c1b14,_0x4dadcc);};}exports[_0x885d('0x4')]=function(_0x56c2e5){for(var _0x15cc67=0x0,_0xf2cd90=events[_0x885d('0x5')];_0x15cc67<_0xf2cd90;_0x15cc67++){var _0x1f9564=events[_0x15cc67];var _0x22f022=createListener('user:'+_0x1f9564,_0x56c2e5);UserEvents['on'](_0x1f9564,_0x22f022);}}; \ No newline at end of file +var _0x0343=['./user.events','remove','update','removeListener','register','length','user:'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0x0343,0x1c7));var _0x3034=function(_0x4b4865,_0xb43449){_0x4b4865=_0x4b4865-0x0;var _0x190dc2=_0x0343[_0x4b4865];return _0x190dc2;};'use strict';var UserEvents=require(_0x3034('0x0'));var events=['save',_0x3034('0x1'),_0x3034('0x2')];function createListener(_0x1c81fb,_0x2920ac){return function(_0x211f5e){_0x2920ac['emit'](_0x1c81fb,_0x211f5e);};}function removeListener(_0x1f27ba,_0x114483){return function(){UserEvents[_0x3034('0x3')](_0x1f27ba,_0x114483);};}exports[_0x3034('0x4')]=function(_0x53bafc){for(var _0x259890=0x0,_0x532faf=events[_0x3034('0x5')];_0x259890<_0x532faf;_0x259890++){var _0x42c024=events[_0x259890];var _0x2a3f0b=createListener(_0x3034('0x6')+_0x42c024,_0x53bafc);UserEvents['on'](_0x42c024,_0x2a3f0b);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index a19f817..4c8f2af 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(_0x6ed9e5,_0x1cfd51){var _0x30c517=function(_0x17fe86){while(--_0x17fe86){_0x6ed9e5['push'](_0x6ed9e5['shift']());}};_0x30c517(++_0x1cfd51);}(_0xe706,0xa3));var _0x6e70=function(_0x2b3a40,_0x386ecd){_0x2b3a40=_0x2b3a40-0x0;var _0x2ad588=_0xe706[_0x2b3a40];return _0x2ad588;};'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(_0x50319c,_0x4271b3){var _0x34b90b=function(_0x2797f8){while(--_0x2797f8){_0x50319c['push'](_0x50319c['shift']());}};_0x34b90b(++_0x4271b3);}(_0xe706,0xa3));var _0x6e70=function(_0x53b53e,_0x498437){_0x53b53e=_0x53b53e-0x0;var _0xbb6179=_0xe706[_0x53b53e];return _0xbb6179;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index 9e90acd..f62bddd 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 _0xb0b8=['exports','INTEGER','sequelize'];(function(_0x18f354,_0x205662){var _0xb774ff=function(_0xedb26f){while(--_0xedb26f){_0x18f354['push'](_0x18f354['shift']());}};_0xb774ff(++_0x205662);}(_0xb0b8,0x74));var _0x8b0b=function(_0x593564,_0x43583f){_0x593564=_0x593564-0x0;var _0x211a89=_0xb0b8[_0x593564];return _0x211a89;};'use strict';var Sequelize=require(_0x8b0b('0x0'));module[_0x8b0b('0x1')]={'penalty':{'type':Sequelize[_0x8b0b('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x3cf1=['INTEGER','sequelize'];(function(_0x3f5a64,_0x56027f){var _0x3725b3=function(_0x3f6e57){while(--_0x3f6e57){_0x3f5a64['push'](_0x3f5a64['shift']());}};_0x3725b3(++_0x56027f);}(_0x3cf1,0x16b));var _0x13cf=function(_0x630986,_0x3d1316){_0x630986=_0x630986-0x0;var _0x35e01c=_0x3cf1[_0x630986];return _0x35e01c;};'use strict';var Sequelize=require(_0x13cf('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x13cf('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.model.js b/server/api/userChatQueue/userChatQueue.model.js index 49b9823..b1e4f41 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 _0x3b60=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./userChatQueue.attributes','exports','define','UserChatQueue','lodash'];(function(_0x3496d3,_0x4467a2){var _0x509096=function(_0xcc66bc){while(--_0xcc66bc){_0x3496d3['push'](_0x3496d3['shift']());}};_0x509096(++_0x4467a2);}(_0x3b60,0x143));var _0x03b6=function(_0x451f2f,_0x11dbe7){_0x451f2f=_0x451f2f-0x0;var _0x36f9f6=_0x3b60[_0x451f2f];return _0x36f9f6;};'use strict';var _=require(_0x03b6('0x0'));var util=require('util');var logger=require(_0x03b6('0x1'))(_0x03b6('0x2'));var moment=require(_0x03b6('0x3'));var BPromise=require(_0x03b6('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x03b6('0x5'));var rimraf=require(_0x03b6('0x6'));var config=require(_0x03b6('0x7'));var attributes=require(_0x03b6('0x8'));module[_0x03b6('0x9')]=function(_0x34cf44,_0x505b02){return _0x34cf44[_0x03b6('0xa')](_0x03b6('0xb'),attributes,{'tableName':'user_has_chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf3b6=['api','moment','bluebird','request-promise','path','../../config/environment','./userChatQueue.attributes','define','UserChatQueue','user_has_chat_queues','util','../../config/logger'];(function(_0x1fb004,_0x33f605){var _0x2fd31b=function(_0x4a9c2d){while(--_0x4a9c2d){_0x1fb004['push'](_0x1fb004['shift']());}};_0x2fd31b(++_0x33f605);}(_0xf3b6,0xee));var _0x6f3b=function(_0x461397,_0x36d83f){_0x461397=_0x461397-0x0;var _0x179011=_0xf3b6[_0x461397];return _0x179011;};'use strict';var _=require('lodash');var util=require(_0x6f3b('0x0'));var logger=require(_0x6f3b('0x1'))(_0x6f3b('0x2'));var moment=require(_0x6f3b('0x3'));var BPromise=require(_0x6f3b('0x4'));var rp=require(_0x6f3b('0x5'));var fs=require('fs');var path=require(_0x6f3b('0x6'));var rimraf=require('rimraf');var config=require(_0x6f3b('0x7'));var attributes=require(_0x6f3b('0x8'));module['exports']=function(_0xe75707,_0x8fa82f){return _0xe75707[_0x6f3b('0x9')](_0x6f3b('0xa'),attributes,{'tableName':_0x6f3b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.rpc.js b/server/api/userChatQueue/userChatQueue.rpc.js index 9d46eac..32e079d 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 _0xf212=['util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash'];(function(_0x10b95c,_0x134f5a){var _0x53fbf8=function(_0x5cc266){while(--_0x5cc266){_0x10b95c['push'](_0x10b95c['shift']());}};_0x53fbf8(++_0x134f5a);}(_0xf212,0xc5));var _0x2f21=function(_0x260751,_0x3aa56a){_0x260751=_0x260751-0x0;var _0xaee64b=_0xf212[_0x260751];return _0xaee64b;};'use strict';var _=require(_0x2f21('0x0'));var util=require(_0x2f21('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x2f21('0x2'));var fs=require('fs');var Redis=require(_0x2f21('0x3'));var db=require(_0x2f21('0x4'))['db'];var utils=require(_0x2f21('0x5'));var logger=require(_0x2f21('0x6'))('rpc');var config=require(_0x2f21('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x2f21('0x8')][_0x2f21('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x12d945,_0x87b7b7,_0x4e764e){return new BPromise(function(_0x8de611,_0x3dc7cb){return client[_0x2f21('0xa')](_0x12d945,_0x4e764e)[_0x2f21('0xb')](function(_0x1ea3a4){logger[_0x2f21('0xc')](_0x2f21('0xd'),_0x87b7b7,_0x2f21('0xe'));logger['debug'](_0x2f21('0xf'),_0x87b7b7,_0x2f21('0xe'),JSON[_0x2f21('0x10')](_0x1ea3a4));if(_0x1ea3a4[_0x2f21('0x11')]){if(_0x1ea3a4[_0x2f21('0x11')][_0x2f21('0x12')]===0x1f4){logger[_0x2f21('0x11')](_0x2f21('0xd'),_0x87b7b7,_0x1ea3a4['error'][_0x2f21('0x13')]);return _0x3dc7cb(_0x1ea3a4[_0x2f21('0x11')][_0x2f21('0x13')]);}logger[_0x2f21('0x11')](_0x2f21('0xd'),_0x87b7b7,_0x1ea3a4[_0x2f21('0x11')][_0x2f21('0x13')]);return _0x8de611(_0x1ea3a4['error'][_0x2f21('0x13')]);}else{logger[_0x2f21('0xc')](_0x2f21('0xd'),_0x87b7b7,_0x2f21('0xe'));_0x8de611(_0x1ea3a4[_0x2f21('0x14')][_0x2f21('0x13')]);}})[_0x2f21('0x15')](function(_0x3c14fa){logger[_0x2f21('0x11')](_0x2f21('0xd'),_0x87b7b7,_0x3c14fa);_0x3dc7cb(_0x3c14fa);});});} \ No newline at end of file +var _0x1bc1=['stringify','error','code','message','info','result','catch','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','then','UserChatQueue,\x20%s,\x20%s','request\x20sent','UserChatQueue,\x20%s,\x20%s,\x20%s'];(function(_0x3f758f,_0x302451){var _0x26e4ae=function(_0x54beae){while(--_0x54beae){_0x3f758f['push'](_0x3f758f['shift']());}};_0x26e4ae(++_0x302451);}(_0x1bc1,0x170));var _0x11bc=function(_0x22b824,_0x54e2cb){_0x22b824=_0x22b824-0x0;var _0x573452=_0x1bc1[_0x22b824];return _0x573452;};'use strict';var _=require(_0x11bc('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x11bc('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x11bc('0x2'));var db=require(_0x11bc('0x3'))['db'];var utils=require(_0x11bc('0x4'));var logger=require(_0x11bc('0x5'))('rpc');var config=require(_0x11bc('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x11bc('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x16e64c,_0x3a5964,_0x160b6f){return new BPromise(function(_0x304d29,_0x2660d5){return client['request'](_0x16e64c,_0x160b6f)[_0x11bc('0x8')](function(_0xeed49){logger['info'](_0x11bc('0x9'),_0x3a5964,_0x11bc('0xa'));logger['debug'](_0x11bc('0xb'),_0x3a5964,_0x11bc('0xa'),JSON[_0x11bc('0xc')](_0xeed49));if(_0xeed49[_0x11bc('0xd')]){if(_0xeed49['error'][_0x11bc('0xe')]===0x1f4){logger[_0x11bc('0xd')]('UserChatQueue,\x20%s,\x20%s',_0x3a5964,_0xeed49[_0x11bc('0xd')][_0x11bc('0xf')]);return _0x2660d5(_0xeed49[_0x11bc('0xd')]['message']);}logger['error'](_0x11bc('0x9'),_0x3a5964,_0xeed49['error'][_0x11bc('0xf')]);return _0x304d29(_0xeed49[_0x11bc('0xd')][_0x11bc('0xf')]);}else{logger[_0x11bc('0x10')](_0x11bc('0x9'),_0x3a5964,_0x11bc('0xa'));_0x304d29(_0xeed49[_0x11bc('0x11')][_0x11bc('0xf')]);}})[_0x11bc('0x12')](function(_0x21dd73){logger[_0x11bc('0xd')]('UserChatQueue,\x20%s,\x20%s',_0x3a5964,_0x21dd73);_0x2660d5(_0x21dd73);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index 4c7d06e..8d9c601 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 _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x42ba4b,_0x1530f2){var _0xfa2e28=function(_0x4c22e0){while(--_0x4c22e0){_0x42ba4b['push'](_0x42ba4b['shift']());}};_0xfa2e28(++_0x1530f2);}(_0xedd9,0xfc));var _0x9edd=function(_0x5dd093,_0x86a802){_0x5dd093=_0x5dd093-0x0;var _0x1e8f74=_0xedd9[_0x5dd093];return _0x1e8f74;};'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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x9c8c83,_0x16ebdd){var _0x4636ac=function(_0x5bacfc){while(--_0x5bacfc){_0x9c8c83['push'](_0x9c8c83['shift']());}};_0x4636ac(++_0x16ebdd);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0xa9e0[_0x4154a6];return _0x3b2786;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index 8f4426d..a451c14 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 _0x1461=['INTEGER','STRING'];(function(_0x19e3c6,_0x1f68fa){var _0x5c85bf=function(_0x729794){while(--_0x729794){_0x19e3c6['push'](_0x19e3c6['shift']());}};_0x5c85bf(++_0x1f68fa);}(_0x1461,0x9a));var _0x1146=function(_0x325501,_0x5242f6){_0x325501=_0x325501-0x0;var _0x2c1626=_0x1461[_0x325501];return _0x2c1626;};'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize[_0x1146('0x0')],'defaultValue':0x0},'assigned':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'queue':{'type':Sequelize[_0x1146('0x1')]}}; \ No newline at end of file +var _0x6717=['INTEGER','STRING'];(function(_0x530e38,_0x5f1d0f){var _0x4b6a58=function(_0xea6fde){while(--_0xea6fde){_0x530e38['push'](_0x530e38['shift']());}};_0x4b6a58(++_0x5f1d0f);}(_0x6717,0x104));var _0x7671=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6717[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize[_0x7671('0x0')],'defaultValue':0x0},'assigned':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'queue':{'type':Sequelize[_0x7671('0x1')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index ba782fc..d5a847a 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 _0x7f9b=['moment','bluebird','request-promise','rimraf','./userFaxQueue.attributes','exports','define','UserFaxQueue','lodash','../../config/logger','api'];(function(_0xf4c340,_0xc715f9){var _0x44f703=function(_0x2d00be){while(--_0x2d00be){_0xf4c340['push'](_0xf4c340['shift']());}};_0x44f703(++_0xc715f9);}(_0x7f9b,0xef));var _0xb7f9=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x7f9b[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xb7f9('0x0'));var util=require('util');var logger=require(_0xb7f9('0x1'))(_0xb7f9('0x2'));var moment=require(_0xb7f9('0x3'));var BPromise=require(_0xb7f9('0x4'));var rp=require(_0xb7f9('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb7f9('0x6'));var config=require('../../config/environment');var attributes=require(_0xb7f9('0x7'));module[_0xb7f9('0x8')]=function(_0x54e0cb,_0x58464b){return _0x54e0cb[_0xb7f9('0x9')](_0xb7f9('0xa'),attributes,{'tableName':'user_has_fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaa2b=['UserFaxQueue','user_has_fax_queues','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./userFaxQueue.attributes','exports'];(function(_0x204eb7,_0x4974c3){var _0x37e444=function(_0x390613){while(--_0x390613){_0x204eb7['push'](_0x204eb7['shift']());}};_0x37e444(++_0x4974c3);}(_0xaa2b,0x86));var _0xbaa2=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xaa2b[_0x2dafbe];return _0x58a45a;};'use strict';var _=require('lodash');var util=require(_0xbaa2('0x0'));var logger=require(_0xbaa2('0x1'))(_0xbaa2('0x2'));var moment=require('moment');var BPromise=require(_0xbaa2('0x3'));var rp=require(_0xbaa2('0x4'));var fs=require('fs');var path=require(_0xbaa2('0x5'));var rimraf=require(_0xbaa2('0x6'));var config=require('../../config/environment');var attributes=require(_0xbaa2('0x7'));module[_0xbaa2('0x8')]=function(_0x543ddb,_0x19232d){return _0x543ddb['define'](_0xbaa2('0x9'),attributes,{'tableName':_0xbaa2('0xa'),'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 a10b15b..8ee42e1 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 _0x7ee2=['randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird'];(function(_0x396d74,_0x22736a){var _0x693fcc=function(_0x4e2ca9){while(--_0x4e2ca9){_0x396d74['push'](_0x396d74['shift']());}};_0x693fcc(++_0x22736a);}(_0x7ee2,0x9e));var _0x27ee=function(_0x8ed73f,_0x1c0bae){_0x8ed73f=_0x8ed73f-0x0;var _0x402580=_0x7ee2[_0x8ed73f];return _0x402580;};'use strict';var _=require('lodash');var util=require(_0x27ee('0x0'));var moment=require(_0x27ee('0x1'));var BPromise=require(_0x27ee('0x2'));var rs=require(_0x27ee('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x27ee('0x4'))['db'];var utils=require(_0x27ee('0x5'));var logger=require(_0x27ee('0x6'))(_0x27ee('0x7'));var config=require('../../config/environment');var jayson=require(_0x27ee('0x8'));var client=jayson[_0x27ee('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5b915a,_0x3ee0ff,_0x4d2d65){return new BPromise(function(_0x3ce04e,_0x2dfb5d){return client[_0x27ee('0xa')](_0x5b915a,_0x4d2d65)[_0x27ee('0xb')](function(_0xc0097a){logger[_0x27ee('0xc')](_0x27ee('0xd'),_0x3ee0ff,_0x27ee('0xe'));logger[_0x27ee('0xf')](_0x27ee('0x10'),_0x3ee0ff,_0x27ee('0xe'),JSON[_0x27ee('0x11')](_0xc0097a));if(_0xc0097a[_0x27ee('0x12')]){if(_0xc0097a[_0x27ee('0x12')][_0x27ee('0x13')]===0x1f4){logger[_0x27ee('0x12')]('UserFaxQueue,\x20%s,\x20%s',_0x3ee0ff,_0xc0097a[_0x27ee('0x12')][_0x27ee('0x14')]);return _0x2dfb5d(_0xc0097a['error']['message']);}logger[_0x27ee('0x12')](_0x27ee('0xd'),_0x3ee0ff,_0xc0097a['error'][_0x27ee('0x14')]);return _0x3ce04e(_0xc0097a['error'][_0x27ee('0x14')]);}else{logger[_0x27ee('0xc')](_0x27ee('0xd'),_0x3ee0ff,_0x27ee('0xe'));_0x3ce04e(_0xc0097a[_0x27ee('0x15')][_0x27ee('0x14')]);}})[_0x27ee('0x16')](function(_0x12f28d){logger[_0x27ee('0x12')](_0x27ee('0xd'),_0x3ee0ff,_0x12f28d);_0x2dfb5d(_0x12f28d);});});} \ No newline at end of file +var _0x1342=['util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','UserFaxQueue,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result','catch','lodash'];(function(_0x47dc5c,_0xfb861c){var _0x4611ff=function(_0x26bc4e){while(--_0x26bc4e){_0x47dc5c['push'](_0x47dc5c['shift']());}};_0x4611ff(++_0xfb861c);}(_0x1342,0xf1));var _0x2134=function(_0x3f90e7,_0x3da2dd){_0x3f90e7=_0x3f90e7-0x0;var _0x5413ed=_0x1342[_0x3f90e7];return _0x5413ed;};'use strict';var _=require(_0x2134('0x0'));var util=require(_0x2134('0x1'));var moment=require('moment');var BPromise=require(_0x2134('0x2'));var rs=require(_0x2134('0x3'));var fs=require('fs');var Redis=require(_0x2134('0x4'));var db=require(_0x2134('0x5'))['db'];var utils=require(_0x2134('0x6'));var logger=require(_0x2134('0x7'))(_0x2134('0x8'));var config=require('../../config/environment');var jayson=require(_0x2134('0x9'));var client=jayson[_0x2134('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3517d5,_0x219269,_0x49a906){return new BPromise(function(_0x5571b8,_0x415f81){return client[_0x2134('0xb')](_0x3517d5,_0x49a906)[_0x2134('0xc')](function(_0x350b7a){logger[_0x2134('0xd')](_0x2134('0xe'),_0x219269,'request\x20sent');logger[_0x2134('0xf')]('UserFaxQueue,\x20%s,\x20%s,\x20%s',_0x219269,_0x2134('0x10'),JSON['stringify'](_0x350b7a));if(_0x350b7a[_0x2134('0x11')]){if(_0x350b7a[_0x2134('0x11')][_0x2134('0x12')]===0x1f4){logger[_0x2134('0x11')](_0x2134('0xe'),_0x219269,_0x350b7a['error'][_0x2134('0x13')]);return _0x415f81(_0x350b7a['error']['message']);}logger[_0x2134('0x11')](_0x2134('0xe'),_0x219269,_0x350b7a[_0x2134('0x11')][_0x2134('0x13')]);return _0x5571b8(_0x350b7a[_0x2134('0x11')][_0x2134('0x13')]);}else{logger['info'](_0x2134('0xe'),_0x219269,_0x2134('0x10'));_0x5571b8(_0x350b7a[_0x2134('0x14')][_0x2134('0x13')]);}})[_0x2134('0x15')](function(_0x4fec4c){logger[_0x2134('0x11')](_0x2134('0xe'),_0x219269,_0x4fec4c);_0x415f81(_0x4fec4c);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index 581ba00..c943da7 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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x4dfe01,_0x327a20){var _0x2f66a7=function(_0x297e47){while(--_0x297e47){_0x4dfe01['push'](_0x4dfe01['shift']());}};_0x2f66a7(++_0x327a20);}(_0xe706,0xa3));var _0x6e70=function(_0x255cca,_0x121536){_0x255cca=_0x255cca-0x0;var _0x16d8de=_0xe706[_0x255cca];return _0x16d8de;};'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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x35f969,_0x2c03bd){var _0x373c46=function(_0x480568){while(--_0x480568){_0x35f969['push'](_0x35f969['shift']());}};_0x373c46(++_0x2c03bd);}(_0x9c44,0x178));var _0x49c4=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x9c44[_0xfae23b];return _0x200640;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index cf02eb6..0748bf1 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 _0x446d=['sequelize','INTEGER'];(function(_0x1b6186,_0x1ec7f2){var _0x186121=function(_0x1748a8){while(--_0x1748a8){_0x1b6186['push'](_0x1b6186['shift']());}};_0x186121(++_0x1ec7f2);}(_0x446d,0x126));var _0xd446=function(_0x19be52,_0x417078){_0x19be52=_0x19be52-0x0;var _0x42dfd2=_0x446d[_0x19be52];return _0x42dfd2;};'use strict';var Sequelize=require(_0xd446('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xd446('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xeac0=['sequelize','INTEGER'];(function(_0x24f5b1,_0x350007){var _0x451a13=function(_0x30d668){while(--_0x30d668){_0x24f5b1['push'](_0x24f5b1['shift']());}};_0x451a13(++_0x350007);}(_0xeac0,0x1f0));var _0x0eac=function(_0x2c4748,_0x2c10f0){_0x2c4748=_0x2c4748-0x0;var _0x312891=_0xeac0[_0x2c4748];return _0x312891;};'use strict';var Sequelize=require(_0x0eac('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x0eac('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.model.js b/server/api/userMailQueue/userMailQueue.model.js index 7d89be9..d7791cc 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 _0x0c50=['define','UserMailQueue','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./userMailQueue.attributes','exports'];(function(_0x17a2eb,_0x12e240){var _0x3e9478=function(_0x41c6b3){while(--_0x41c6b3){_0x17a2eb['push'](_0x17a2eb['shift']());}};_0x3e9478(++_0x12e240);}(_0x0c50,0xf9));var _0x00c5=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0x0c50[_0x134c2e];return _0x2825db;};'use strict';var _=require(_0x00c5('0x0'));var util=require(_0x00c5('0x1'));var logger=require(_0x00c5('0x2'))(_0x00c5('0x3'));var moment=require(_0x00c5('0x4'));var BPromise=require(_0x00c5('0x5'));var rp=require(_0x00c5('0x6'));var fs=require('fs');var path=require(_0x00c5('0x7'));var rimraf=require('rimraf');var config=require(_0x00c5('0x8'));var attributes=require(_0x00c5('0x9'));module[_0x00c5('0xa')]=function(_0x53c8e9,_0x87c91c){return _0x53c8e9[_0x00c5('0xb')](_0x00c5('0xc'),attributes,{'tableName':'user_has_mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9a65=['bluebird','path','rimraf','define','UserMailQueue','user_has_mail_queues','lodash','../../config/logger','api','moment'];(function(_0x10a904,_0x2bf292){var _0x53815a=function(_0x2e6ce4){while(--_0x2e6ce4){_0x10a904['push'](_0x10a904['shift']());}};_0x53815a(++_0x2bf292);}(_0x9a65,0x10a));var _0x59a6=function(_0x1602ef,_0x447aba){_0x1602ef=_0x1602ef-0x0;var _0x5870ee=_0x9a65[_0x1602ef];return _0x5870ee;};'use strict';var _=require(_0x59a6('0x0'));var util=require('util');var logger=require(_0x59a6('0x1'))(_0x59a6('0x2'));var moment=require(_0x59a6('0x3'));var BPromise=require(_0x59a6('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x59a6('0x5'));var rimraf=require(_0x59a6('0x6'));var config=require('../../config/environment');var attributes=require('./userMailQueue.attributes');module['exports']=function(_0x5a6840,_0x1a619e){return _0x5a6840[_0x59a6('0x7')](_0x59a6('0x8'),attributes,{'tableName':_0x59a6('0x9'),'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 e74a17d..2a744fd 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 _0x008c=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','UserMailQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','UserMailQueue,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x008c,0x188));var _0xc008=function(_0x3a21c0,_0x348451){_0x3a21c0=_0x3a21c0-0x0;var _0x411e84=_0x008c[_0x3a21c0];return _0x411e84;};'use strict';var _=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var moment=require(_0xc008('0x2'));var BPromise=require(_0xc008('0x3'));var rs=require(_0xc008('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc008('0x5'))['db'];var utils=require(_0xc008('0x6'));var logger=require(_0xc008('0x7'))(_0xc008('0x8'));var config=require(_0xc008('0x9'));var jayson=require(_0xc008('0xa'));var client=jayson[_0xc008('0xb')][_0xc008('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x9c8cb2,_0x4af530,_0x428fa9){return new BPromise(function(_0x5aa09b,_0x30be38){return client['request'](_0x9c8cb2,_0x428fa9)['then'](function(_0x27830d){logger[_0xc008('0xd')]('UserMailQueue,\x20%s,\x20%s',_0x4af530,'request\x20sent');logger['debug'](_0xc008('0xe'),_0x4af530,_0xc008('0xf'),JSON['stringify'](_0x27830d));if(_0x27830d[_0xc008('0x10')]){if(_0x27830d[_0xc008('0x10')][_0xc008('0x11')]===0x1f4){logger[_0xc008('0x10')](_0xc008('0x12'),_0x4af530,_0x27830d[_0xc008('0x10')][_0xc008('0x13')]);return _0x30be38(_0x27830d['error']['message']);}logger[_0xc008('0x10')]('UserMailQueue,\x20%s,\x20%s',_0x4af530,_0x27830d[_0xc008('0x10')][_0xc008('0x13')]);return _0x5aa09b(_0x27830d[_0xc008('0x10')][_0xc008('0x13')]);}else{logger[_0xc008('0xd')]('UserMailQueue,\x20%s,\x20%s',_0x4af530,'request\x20sent');_0x5aa09b(_0x27830d['result'][_0xc008('0x13')]);}})[_0xc008('0x14')](function(_0x3cafe3){logger[_0xc008('0x10')]('UserMailQueue,\x20%s,\x20%s',_0x4af530,_0x3cafe3);_0x30be38(_0x3cafe3);});});} \ No newline at end of file +var _0x9957=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x1b18a1,_0x7857fa){var _0x1c110d=function(_0x40636d){while(--_0x40636d){_0x1b18a1['push'](_0x1b18a1['shift']());}};_0x1c110d(++_0x7857fa);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('UserMailQueue,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index ca2c3b7..8880f85 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 _0x9e15=['util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./userNotification.controller','isAuthenticated','sendUserNotification','exports','multer'];(function(_0x4d78b0,_0x49082d){var _0x267575=function(_0x3a11bf){while(--_0x3a11bf){_0x4d78b0['push'](_0x4d78b0['shift']());}};_0x267575(++_0x49082d);}(_0x9e15,0xc5));var _0x59e1=function(_0x2261ce,_0x9ed8b6){_0x2261ce=_0x2261ce-0x0;var _0x524640=_0x9e15[_0x2261ce];return _0x524640;};'use strict';var multer=require(_0x59e1('0x0'));var util=require(_0x59e1('0x1'));var path=require('path');var timeout=require(_0x59e1('0x2'));var express=require('express');var router=express[_0x59e1('0x3')]();var fs_extra=require(_0x59e1('0x4'));var auth=require(_0x59e1('0x5'));var interaction=require(_0x59e1('0x6'));var config=require('../../config/environment');var controller=require(_0x59e1('0x7'));router['post']('/',auth[_0x59e1('0x8')](),controller[_0x59e1('0x9')]);module[_0x59e1('0xa')]=router; \ No newline at end of file +var _0x61ff=['exports','multer','util','connect-timeout','express','Router','fs-extra','../../config/environment','./userNotification.controller','post','isAuthenticated','sendUserNotification'];(function(_0x52c282,_0x5c413d){var _0x5bc98f=function(_0x20e7e7){while(--_0x20e7e7){_0x52c282['push'](_0x52c282['shift']());}};_0x5bc98f(++_0x5c413d);}(_0x61ff,0x12d));var _0xf61f=function(_0x1795df,_0xcb261e){_0x1795df=_0x1795df-0x0;var _0x3f13c0=_0x61ff[_0x1795df];return _0x3f13c0;};'use strict';var multer=require(_0xf61f('0x0'));var util=require(_0xf61f('0x1'));var path=require('path');var timeout=require(_0xf61f('0x2'));var express=require(_0xf61f('0x3'));var router=express[_0xf61f('0x4')]();var fs_extra=require(_0xf61f('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xf61f('0x6'));var controller=require(_0xf61f('0x7'));router[_0xf61f('0x8')]('/',auth[_0xf61f('0x9')](),controller[_0xf61f('0xa')]);module[_0xf61f('0xb')]=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index 71c6c6c..02827f6 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 _0xb900=['sequelize','exports','STRING','TEXT','BOOLEAN'];(function(_0x5c5740,_0x1b691f){var _0x298da9=function(_0x1ad54b){while(--_0x1ad54b){_0x5c5740['push'](_0x5c5740['shift']());}};_0x298da9(++_0x1b691f);}(_0xb900,0xa0));var _0x0b90=function(_0x4e5962,_0x5b61b8){_0x4e5962=_0x4e5962-0x0;var _0x360556=_0xb900[_0x4e5962];return _0x360556;};'use strict';var Sequelize=require(_0x0b90('0x0'));module[_0x0b90('0x1')]={'body':{'type':Sequelize['TEXT']},'senderName':{'type':Sequelize[_0x0b90('0x2')]},'recipientsId':{'type':Sequelize[_0x0b90('0x3')]},'recipientsDescription':{'type':Sequelize['STRING']},'beep':{'type':Sequelize[_0x0b90('0x4')]}}; \ No newline at end of file +var _0xf24f=['sequelize','exports','STRING','TEXT'];(function(_0x3aa464,_0x37b769){var _0x50e7d4=function(_0x27d5a4){while(--_0x27d5a4){_0x3aa464['push'](_0x3aa464['shift']());}};_0x50e7d4(++_0x37b769);}(_0xf24f,0x1ec));var _0xff24=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xf24f[_0x47b58b];return _0x46bebe;};'use strict';var Sequelize=require(_0xff24('0x0'));module[_0xff24('0x1')]={'body':{'type':Sequelize['TEXT']},'senderName':{'type':Sequelize[_0xff24('0x2')]},'recipientsId':{'type':Sequelize[_0xff24('0x3')]},'recipientsDescription':{'type':Sequelize['STRING']},'beep':{'type':Sequelize['BOOLEAN']}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index 38959ac..af029be 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 _0xccb1=['crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./userNotification.socket','register','sendStatus','end','json','offset','undefined','limit','count','status','set','apply','reject','save','update','then','error','stack','name','sendUserNotification','body','hasOwnProperty','TemplateId','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','Sequelize','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','openchannelqueue','smsqueue','voicequeue','whatsappqueue','team','user','includes','model','toLowerCase','senderName','fullname','recipientsDescription','isEmpty','beep','SenderId','sortBy','join','sequelize','UserNotification','create','forEach','recipient','emit','userNotification:send','text','Template','render','html','catch','startCase','User','union','queue','replace','Queue','ids','push','flatten','getAgents','map','zip-dir','fast-json-patch','util','path','sox','ejs','fs-extra','lodash','squel'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xccb1,0x1e6));var _0x1ccb=function(_0x1ccdf7,_0x215d5a){_0x1ccdf7=_0x1ccdf7-0x0;var _0x52a0ae=_0xccb1[_0x1ccdf7];return _0x52a0ae;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x1ccb('0x0'));var jsonpatch=require(_0x1ccb('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x1ccb('0x2'));var path=require(_0x1ccb('0x3'));var sox=require(_0x1ccb('0x4'));var csv=require('to-csv');var ejs=require(_0x1ccb('0x5'));var fs=require('fs');var fs_extra=require(_0x1ccb('0x6'));var _=require(_0x1ccb('0x7'));var squel=require(_0x1ccb('0x8'));var crypto=require(_0x1ccb('0x9'));var jsforce=require(_0x1ccb('0xa'));var deskjs=require(_0x1ccb('0xb'));var toCsv=require('to-csv');var querystring=require(_0x1ccb('0xc'));var Papa=require('papaparse');var Redis=require(_0x1ccb('0xd'));var authService=require(_0x1ccb('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x1ccb('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1ccb('0x10'))(_0x1ccb('0x11'));var utils=require(_0x1ccb('0x12'));var config=require(_0x1ccb('0x13'));var licenseUtil=require(_0x1ccb('0x14'));var db=require(_0x1ccb('0x15'))['db'];config[_0x1ccb('0x16')]=_[_0x1ccb('0x17')](config[_0x1ccb('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0x1ccb('0x18'))(new Redis(config[_0x1ccb('0x16')]));require(_0x1ccb('0x19'))[_0x1ccb('0x1a')](socket);function respondWithStatusCode(_0x20bd27,_0x4677a2){_0x4677a2=_0x4677a2||0xcc;return function(_0x12aa2b){if(_0x12aa2b){return _0x20bd27[_0x1ccb('0x1b')](_0x4677a2);}return _0x20bd27['status'](_0x4677a2)[_0x1ccb('0x1c')]();};}function respondWithResult(_0x509b0a,_0x673a90){_0x673a90=_0x673a90||0xc8;return function(_0xe5dc1a){if(_0xe5dc1a){return _0x509b0a['status'](_0x673a90)[_0x1ccb('0x1d')](_0xe5dc1a);}};}function respondWithFilteredResult(_0x37afed,_0x3a7a55){return function(_0x16fb02){if(_0x16fb02){var _0x2a73f5=typeof _0x3a7a55[_0x1ccb('0x1e')]===_0x1ccb('0x1f')&&typeof _0x3a7a55[_0x1ccb('0x20')]===_0x1ccb('0x1f');var _0x2210ca=_0x16fb02[_0x1ccb('0x21')];var _0x2f794a=_0x2a73f5?0x0:_0x3a7a55[_0x1ccb('0x1e')];var _0x5e3b23=_0x2a73f5?_0x16fb02[_0x1ccb('0x21')]:_0x3a7a55['offset']+_0x3a7a55[_0x1ccb('0x20')];var _0x47c39f;if(_0x5e3b23>=_0x2210ca){_0x5e3b23=_0x2210ca;_0x47c39f=0xc8;}else{_0x47c39f=0xce;}_0x37afed[_0x1ccb('0x22')](_0x47c39f);return _0x37afed[_0x1ccb('0x23')]('Content-Range',_0x2f794a+'-'+_0x5e3b23+'/'+_0x2210ca)[_0x1ccb('0x1d')](_0x16fb02);}return null;};}function patchUpdates(_0x12cd6d){return function(_0x3f98c9){try{jsonpatch[_0x1ccb('0x24')](_0x3f98c9,_0x12cd6d,!![]);}catch(_0x4c1d0b){return BPromise[_0x1ccb('0x25')](_0x4c1d0b);}return _0x3f98c9[_0x1ccb('0x26')]();};}function saveUpdates(_0x3bec9d,_0x1e2c42){return function(_0xaceacd){if(_0xaceacd){return _0xaceacd[_0x1ccb('0x27')](_0x3bec9d)[_0x1ccb('0x28')](function(_0x2fca83){return _0x2fca83;});}return null;};}function removeEntity(_0x5848af,_0x3c054c){return function(_0x4c9c87){if(_0x4c9c87){return _0x4c9c87['destroy']()[_0x1ccb('0x28')](function(){_0x5848af[_0x1ccb('0x22')](0xcc)[_0x1ccb('0x1c')]();});}};}function handleEntityNotFound(_0x26ee2c,_0x52c97b){return function(_0xa721f3){if(!_0xa721f3){_0x26ee2c['sendStatus'](0x194);}return _0xa721f3;};}function handleError(_0x1cb6f5,_0x34e179){_0x34e179=_0x34e179||0x1f4;return function(_0x100a13){logger[_0x1ccb('0x29')](_0x100a13[_0x1ccb('0x2a')]);if(_0x100a13[_0x1ccb('0x2b')]){delete _0x100a13[_0x1ccb('0x2b')];}_0x1cb6f5[_0x1ccb('0x22')](_0x34e179)['send'](_0x100a13);};}exports[_0x1ccb('0x2c')]=function(_0x4f841e,_0x1d5958,_0x2ebe16){if(!_0x4f841e[_0x1ccb('0x2d')][_0x1ccb('0x2e')]('text')&&!_0x4f841e[_0x1ccb('0x2d')][_0x1ccb('0x2e')](_0x1ccb('0x2f'))){throw new db['Sequelize'][(_0x1ccb('0x30'))](_0x1ccb('0x31'));}else{if(_0x4f841e[_0x1ccb('0x2d')][_0x1ccb('0x2e')]('TemplateId')&&!_0x4f841e['body']['hasOwnProperty'](_0x1ccb('0x32'))){throw new db[(_0x1ccb('0x33'))][(_0x1ccb('0x30'))](_0x1ccb('0x34'));}if(!_0x4f841e['body'][_0x1ccb('0x2e')](_0x1ccb('0x35'))){throw new db[(_0x1ccb('0x33'))][(_0x1ccb('0x30'))](_0x1ccb('0x36'));}else{try{var _0x4a6b07=JSON[_0x1ccb('0x37')](_0x4f841e[_0x1ccb('0x2d')][_0x1ccb('0x35')]);}catch(_0x58c2bb){logger['error'](_0x58c2bb);throw new db[(_0x1ccb('0x33'))][(_0x1ccb('0x30'))](_0x1ccb('0x38'));}var _0x4b3516=[_0x1ccb('0x39'),_0x1ccb('0x3a'),'mailqueue',_0x1ccb('0x3b'),_0x1ccb('0x3c'),_0x1ccb('0x3d'),_0x1ccb('0x3e'),_0x1ccb('0x3f'),_0x1ccb('0x40')];if(_['some'](_0x4a6b07,function(_0x304c83){return!_[_0x1ccb('0x41')](_0x4b3516,_0x304c83[_0x1ccb('0x42')][_0x1ccb('0x43')]());})){throw new db['Sequelize'][(_0x1ccb('0x30'))]('Invalid\x20model\x20in\x20\x27recipients\x27\x20object');}}}var _0x17abed={};_0x17abed['senderName']=_0x4f841e[_0x1ccb('0x2d')]['hasOwnProperty'](_0x1ccb('0x44'))?_0x4f841e['body'][_0x1ccb('0x44')]:_0x4f841e[_0x1ccb('0x40')][_0x1ccb('0x45')];_0x17abed[_0x1ccb('0x46')]=_[_0x1ccb('0x47')](_0x4f841e['body'][_0x1ccb('0x46')])?null:_0x4f841e[_0x1ccb('0x2d')][_0x1ccb('0x46')];_0x17abed['beep']=_0x4f841e[_0x1ccb('0x2d')][_0x1ccb('0x48')]||![];_0x17abed[_0x1ccb('0x49')]=_0x4f841e[_0x1ccb('0x40')]['id'];return getContent(_0x4f841e[_0x1ccb('0x2d')])[_0x1ccb('0x28')](function(_0x17d2de){_0x17abed['body']=_0x17d2de;return getRecipients(_0x4a6b07);})[_0x1ccb('0x28')](function(_0x331327){_0x17abed['recipientsId']=_[_0x1ccb('0x4a')](_0x331327)[_0x1ccb('0x4b')](',');return db[_0x1ccb('0x4c')]['transaction'](function(_0x120221){return db[_0x1ccb('0x4d')][_0x1ccb('0x4e')](_0x17abed,{'raw':!![],'transaction':_0x120221})[_0x1ccb('0x28')](function(_0x4ffa52){var _0x1dd6bb={'sender':_0x17abed[_0x1ccb('0x44')],'description':_0x17abed[_0x1ccb('0x46')],'content':_0x17abed[_0x1ccb('0x2d')],'beep':_0x17abed[_0x1ccb('0x48')]};_0x331327[_0x1ccb('0x4f')](function(_0x4cad8f){_0x1dd6bb[_0x1ccb('0x50')]=_0x4cad8f;socket[_0x1ccb('0x51')](_0x1ccb('0x52'),_0x1dd6bb);});return _0x4ffa52;});});})[_0x1ccb('0x28')](respondWithResult(_0x1d5958,0xc9))['catch'](handleError(_0x1d5958,null));};function getContent(_0x208e31){return new BPromise(function(_0x5efa6a,_0x54c28a){if(_0x208e31[_0x1ccb('0x53')]){_0x5efa6a(_0x208e31[_0x1ccb('0x53')]);return;}return db[_0x1ccb('0x54')]['findOne']({'attributes':['html'],'where':{'id':_0x208e31[_0x1ccb('0x2f')]},'raw':!![]})[_0x1ccb('0x28')](function(_0x3fd40e){if(!_0x3fd40e)throw new db['Sequelize'][(_0x1ccb('0x30'))]('Invalid\x20\x27TemplateId\x27\x20parameter');var _0x50fc77=Mustache[_0x1ccb('0x55')](_0x3fd40e[_0x1ccb('0x56')],_0x208e31[_0x1ccb('0x32')]);_0x5efa6a(_0x50fc77);})[_0x1ccb('0x57')](function(_0x792a33){_0x54c28a(_0x792a33);});});}function getRecipients(_0xd63320){return new BPromise(function(_0x9d33e1,_0x58cf9c){var _0x5169c6=[];var _0x935d36=[];_0xd63320[_0x1ccb('0x4f')](function(_0x44a4e8){var _0x59d0b2=_[_0x1ccb('0x58')](_0x44a4e8[_0x1ccb('0x42')][_0x1ccb('0x43')]());if(_0x59d0b2===_0x1ccb('0x59')){_0x5169c6=_[_0x1ccb('0x5a')](_0x5169c6,_0x44a4e8['ids']);}else{if(_['includes'](_0x59d0b2,_0x1ccb('0x5b')))_0x59d0b2=_0x59d0b2[_0x1ccb('0x5c')](_0x1ccb('0x5b'),_0x1ccb('0x5d'));_0x44a4e8[_0x1ccb('0x5e')][_0x1ccb('0x4f')](function(_0x5d95bb){_0x935d36[_0x1ccb('0x5f')](getAgents(_0x59d0b2,_0x5d95bb));});}});return BPromise['all'](_0x935d36)['then'](function(_0x15535d){_0x5169c6=_[_0x1ccb('0x5a')](_0x5169c6,_[_0x1ccb('0x60')](_0x15535d));_0x9d33e1(_0x5169c6);})[_0x1ccb('0x57')](function(_0x45fc95){_0x58cf9c(_0x45fc95);});});}function getAgents(_0x10d752,_0x38f8a6){return new BPromise(function(_0x4e053b,_0x557e76){return db[_0x10d752]['findOne']({'where':{'id':_0x38f8a6}})[_0x1ccb('0x28')](function(_0x483dad){return _0x483dad[_0x1ccb('0x61')]({'attributes':['id'],'raw':!![]})[_0x1ccb('0x28')](function(_0x4e0f76){var _0x1b7409=_[_0x1ccb('0x62')](_0x4e0f76,'id');_0x4e053b(_0x1b7409);});})[_0x1ccb('0x57')](function(_0x59680b){_0x557e76(_0x59680b);});});} \ No newline at end of file +var _0xb540=['localhost','socket.io-emitter','redis','./userNotification.socket','register','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','destroy','then','end','error','name','send','body','hasOwnProperty','text','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','TemplateId','view','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','chatqueue','faxqueue','mailqueue','openchannelqueue','smsqueue','voicequeue','whatsappqueue','team','user','some','includes','model','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','beep','SenderId','recipientsId','join','sequelize','transaction','create','forEach','recipient','emit','Template','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','catch','startCase','toLowerCase','User','union','ids','queue','replace','Queue','push','all','flatten','getAgents','map','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','defaults'];(function(_0x42bdad,_0x12836c){var _0x122626=function(_0x2eb29c){while(--_0x2eb29c){_0x42bdad['push'](_0x42bdad['shift']());}};_0x122626(++_0x12836c);}(_0xb540,0x187));var _0x0b54=function(_0x4c85bf,_0x541e50){_0x4c85bf=_0x4c85bf-0x0;var _0x53220e=_0xb540[_0x4c85bf];return _0x53220e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0b54('0x0'));var zipdir=require(_0x0b54('0x1'));var jsonpatch=require(_0x0b54('0x2'));var rp=require(_0x0b54('0x3'));var moment=require(_0x0b54('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x0b54('0x5'));var util=require(_0x0b54('0x6'));var path=require(_0x0b54('0x7'));var sox=require('sox');var csv=require(_0x0b54('0x8'));var ejs=require(_0x0b54('0x9'));var fs=require('fs');var fs_extra=require(_0x0b54('0xa'));var _=require(_0x0b54('0xb'));var squel=require('squel');var crypto=require(_0x0b54('0xc'));var jsforce=require(_0x0b54('0xd'));var deskjs=require(_0x0b54('0xe'));var toCsv=require(_0x0b54('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x0b54('0xf'));var authService=require(_0x0b54('0x10'));var qs=require(_0x0b54('0x11'));var as=require(_0x0b54('0x12'));var hardwareService=require(_0x0b54('0x13'));var logger=require('../../config/logger')(_0x0b54('0x14'));var utils=require(_0x0b54('0x15'));var config=require(_0x0b54('0x16'));var licenseUtil=require(_0x0b54('0x17'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x0b54('0x18')](config['redis'],{'host':_0x0b54('0x19'),'port':0x18eb});var socket=require(_0x0b54('0x1a'))(new Redis(config[_0x0b54('0x1b')]));require(_0x0b54('0x1c'))[_0x0b54('0x1d')](socket);function respondWithStatusCode(_0xaa1e2,_0x47231a){_0x47231a=_0x47231a||0xcc;return function(_0x541787){if(_0x541787){return _0xaa1e2[_0x0b54('0x1e')](_0x47231a);}return _0xaa1e2[_0x0b54('0x1f')](_0x47231a)['end']();};}function respondWithResult(_0x464eb9,_0x4f85b8){_0x4f85b8=_0x4f85b8||0xc8;return function(_0x411483){if(_0x411483){return _0x464eb9[_0x0b54('0x1f')](_0x4f85b8)[_0x0b54('0x20')](_0x411483);}};}function respondWithFilteredResult(_0x18789b,_0x206459){return function(_0x2e4bdc){if(_0x2e4bdc){var _0x5b1b38=typeof _0x206459['offset']===_0x0b54('0x21')&&typeof _0x206459['limit']==='undefined';var _0x4ea5a6=_0x2e4bdc[_0x0b54('0x22')];var _0x179fbe=_0x5b1b38?0x0:_0x206459[_0x0b54('0x23')];var _0x4eef15=_0x5b1b38?_0x2e4bdc[_0x0b54('0x22')]:_0x206459[_0x0b54('0x23')]+_0x206459[_0x0b54('0x24')];var _0x29aed3;if(_0x4eef15>=_0x4ea5a6){_0x4eef15=_0x4ea5a6;_0x29aed3=0xc8;}else{_0x29aed3=0xce;}_0x18789b[_0x0b54('0x1f')](_0x29aed3);return _0x18789b[_0x0b54('0x25')](_0x0b54('0x26'),_0x179fbe+'-'+_0x4eef15+'/'+_0x4ea5a6)[_0x0b54('0x20')](_0x2e4bdc);}return null;};}function patchUpdates(_0x3083b7){return function(_0xb9d25){try{jsonpatch[_0x0b54('0x27')](_0xb9d25,_0x3083b7,!![]);}catch(_0x454c2c){return BPromise[_0x0b54('0x28')](_0x454c2c);}return _0xb9d25[_0x0b54('0x29')]();};}function saveUpdates(_0x44ad94,_0x5dbf37){return function(_0x1767ea){if(_0x1767ea){return _0x1767ea['update'](_0x44ad94)['then'](function(_0x7fa2ba){return _0x7fa2ba;});}return null;};}function removeEntity(_0x151eaa,_0xe5836b){return function(_0x16bc15){if(_0x16bc15){return _0x16bc15[_0x0b54('0x2a')]()[_0x0b54('0x2b')](function(){_0x151eaa[_0x0b54('0x1f')](0xcc)[_0x0b54('0x2c')]();});}};}function handleEntityNotFound(_0x4fcfa4,_0x383b79){return function(_0x516b31){if(!_0x516b31){_0x4fcfa4[_0x0b54('0x1e')](0x194);}return _0x516b31;};}function handleError(_0x463012,_0x4cc551){_0x4cc551=_0x4cc551||0x1f4;return function(_0x1db7e3){logger[_0x0b54('0x2d')](_0x1db7e3['stack']);if(_0x1db7e3[_0x0b54('0x2e')]){delete _0x1db7e3[_0x0b54('0x2e')];}_0x463012[_0x0b54('0x1f')](_0x4cc551)[_0x0b54('0x2f')](_0x1db7e3);};}exports['sendUserNotification']=function(_0x3288ed,_0x2bee7d,_0x3ea84b){if(!_0x3288ed[_0x0b54('0x30')][_0x0b54('0x31')](_0x0b54('0x32'))&&!_0x3288ed['body'][_0x0b54('0x31')]('TemplateId')){throw new db[(_0x0b54('0x33'))][(_0x0b54('0x34'))](_0x0b54('0x35'));}else{if(_0x3288ed[_0x0b54('0x30')][_0x0b54('0x31')](_0x0b54('0x36'))&&!_0x3288ed[_0x0b54('0x30')][_0x0b54('0x31')](_0x0b54('0x37'))){throw new db['Sequelize']['ValidationError'](_0x0b54('0x38'));}if(!_0x3288ed[_0x0b54('0x30')][_0x0b54('0x31')](_0x0b54('0x39'))){throw new db[(_0x0b54('0x33'))][(_0x0b54('0x34'))](_0x0b54('0x3a'));}else{try{var _0x3f3bf1=JSON['parse'](_0x3288ed[_0x0b54('0x30')][_0x0b54('0x39')]);}catch(_0x1c47a6){logger[_0x0b54('0x2d')](_0x1c47a6);throw new db[(_0x0b54('0x33'))][(_0x0b54('0x34'))]('Invalid\x20\x27recipients\x27\x20object');}var _0x2d4c12=[_0x0b54('0x3b'),_0x0b54('0x3c'),_0x0b54('0x3d'),_0x0b54('0x3e'),_0x0b54('0x3f'),_0x0b54('0x40'),_0x0b54('0x41'),_0x0b54('0x42'),_0x0b54('0x43')];if(_[_0x0b54('0x44')](_0x3f3bf1,function(_0x35b340){return!_[_0x0b54('0x45')](_0x2d4c12,_0x35b340[_0x0b54('0x46')]['toLowerCase']());})){throw new db[(_0x0b54('0x33'))][(_0x0b54('0x34'))](_0x0b54('0x47'));}}}var _0x20c958={};_0x20c958[_0x0b54('0x48')]=_0x3288ed[_0x0b54('0x30')][_0x0b54('0x31')](_0x0b54('0x48'))?_0x3288ed['body'][_0x0b54('0x48')]:_0x3288ed[_0x0b54('0x43')][_0x0b54('0x49')];_0x20c958[_0x0b54('0x4a')]=_['isEmpty'](_0x3288ed['body'][_0x0b54('0x4a')])?null:_0x3288ed[_0x0b54('0x30')][_0x0b54('0x4a')];_0x20c958[_0x0b54('0x4b')]=_0x3288ed['body'][_0x0b54('0x4b')]||![];_0x20c958[_0x0b54('0x4c')]=_0x3288ed['user']['id'];return getContent(_0x3288ed[_0x0b54('0x30')])[_0x0b54('0x2b')](function(_0x3cf41b){_0x20c958[_0x0b54('0x30')]=_0x3cf41b;return getRecipients(_0x3f3bf1);})['then'](function(_0x321760){_0x20c958[_0x0b54('0x4d')]=_['sortBy'](_0x321760)[_0x0b54('0x4e')](',');return db[_0x0b54('0x4f')][_0x0b54('0x50')](function(_0x2e4019){return db['UserNotification'][_0x0b54('0x51')](_0x20c958,{'raw':!![],'transaction':_0x2e4019})[_0x0b54('0x2b')](function(_0xac735c){var _0x4ea6ae={'sender':_0x20c958['senderName'],'description':_0x20c958['recipientsDescription'],'content':_0x20c958[_0x0b54('0x30')],'beep':_0x20c958[_0x0b54('0x4b')]};_0x321760[_0x0b54('0x52')](function(_0x3f46b7){_0x4ea6ae[_0x0b54('0x53')]=_0x3f46b7;socket[_0x0b54('0x54')]('userNotification:send',_0x4ea6ae);});return _0xac735c;});});})['then'](respondWithResult(_0x2bee7d,0xc9))['catch'](handleError(_0x2bee7d,null));};function getContent(_0x41679e){return new BPromise(function(_0x16d6f3,_0x199089){if(_0x41679e[_0x0b54('0x32')]){_0x16d6f3(_0x41679e[_0x0b54('0x32')]);return;}return db[_0x0b54('0x55')][_0x0b54('0x56')]({'attributes':[_0x0b54('0x57')],'where':{'id':_0x41679e[_0x0b54('0x36')]},'raw':!![]})[_0x0b54('0x2b')](function(_0x5f0de0){if(!_0x5f0de0)throw new db[(_0x0b54('0x33'))][(_0x0b54('0x34'))](_0x0b54('0x58'));var _0x56123c=Mustache[_0x0b54('0x59')](_0x5f0de0[_0x0b54('0x57')],_0x41679e[_0x0b54('0x37')]);_0x16d6f3(_0x56123c);})[_0x0b54('0x5a')](function(_0x49588e){_0x199089(_0x49588e);});});}function getRecipients(_0x69ed8f){return new BPromise(function(_0x174228,_0x2a2c6c){var _0x53259d=[];var _0x3dbe78=[];_0x69ed8f[_0x0b54('0x52')](function(_0x2920c0){var _0x166f55=_[_0x0b54('0x5b')](_0x2920c0[_0x0b54('0x46')][_0x0b54('0x5c')]());if(_0x166f55===_0x0b54('0x5d')){_0x53259d=_[_0x0b54('0x5e')](_0x53259d,_0x2920c0[_0x0b54('0x5f')]);}else{if(_[_0x0b54('0x45')](_0x166f55,_0x0b54('0x60')))_0x166f55=_0x166f55[_0x0b54('0x61')]('queue',_0x0b54('0x62'));_0x2920c0[_0x0b54('0x5f')][_0x0b54('0x52')](function(_0x529679){_0x3dbe78[_0x0b54('0x63')](getAgents(_0x166f55,_0x529679));});}});return BPromise[_0x0b54('0x64')](_0x3dbe78)['then'](function(_0x504116){_0x53259d=_['union'](_0x53259d,_[_0x0b54('0x65')](_0x504116));_0x174228(_0x53259d);})['catch'](function(_0x2793cb){_0x2a2c6c(_0x2793cb);});});}function getAgents(_0x421391,_0x1a00f5){return new BPromise(function(_0x1e2495,_0x2c6572){return db[_0x421391][_0x0b54('0x56')]({'where':{'id':_0x1a00f5}})[_0x0b54('0x2b')](function(_0x311038){return _0x311038[_0x0b54('0x66')]({'attributes':['id'],'raw':!![]})[_0x0b54('0x2b')](function(_0x2fbaf3){var _0x4f6d05=_[_0x0b54('0x67')](_0x2fbaf3,'id');_0x1e2495(_0x4f6d05);});})[_0x0b54('0x5a')](function(_0x1746a3){_0x2c6572(_0x1746a3);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index 8f28147..45ffc58 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 _0x8501=['setMaxListeners','save','remove','emit','hasOwnProperty','exports','events'];(function(_0x5ba790,_0x12b58a){var _0x163249=function(_0x6e3005){while(--_0x6e3005){_0x5ba790['push'](_0x5ba790['shift']());}};_0x163249(++_0x12b58a);}(_0x8501,0x172));var _0x1850=function(_0x301486,_0x27b799){_0x301486=_0x301486-0x0;var _0x418d16=_0x8501[_0x301486];return _0x418d16;};'use strict';var EventEmitter=require(_0x1850('0x0'));var UserNotification=require('../../mysqldb')['db']['UserNotification'];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x1850('0x1')](0x0);var events={'afterCreate':_0x1850('0x2'),'afterUpdate':'update','afterDestroy':_0x1850('0x3')};function emitEvent(_0x36a653){return function(_0x4d4d5d,_0x1fb7e5,_0x465cfe){UserNotificationEvents[_0x1850('0x4')](_0x36a653+':'+_0x4d4d5d['id'],_0x4d4d5d);UserNotificationEvents[_0x1850('0x4')](_0x36a653,_0x4d4d5d);_0x465cfe(null);};}for(var e in events){if(events[_0x1850('0x5')](e)){var event=events[e];UserNotification['hook'](e,emitEvent(event));}}module[_0x1850('0x6')]=UserNotificationEvents; \ No newline at end of file +var _0xec1c=['save','hasOwnProperty','hook','events','setMaxListeners'];(function(_0x324b27,_0x3a81c6){var _0x3980a0=function(_0x198a5f){while(--_0x198a5f){_0x324b27['push'](_0x324b27['shift']());}};_0x3980a0(++_0x3a81c6);}(_0xec1c,0x157));var _0xcec1=function(_0x33fcbb,_0x291d0f){_0x33fcbb=_0x33fcbb-0x0;var _0x2efe40=_0xec1c[_0x33fcbb];return _0x2efe40;};'use strict';var EventEmitter=require(_0xcec1('0x0'));var UserNotification=require('../../mysqldb')['db']['UserNotification'];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0xcec1('0x1')](0x0);var events={'afterCreate':_0xcec1('0x2'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x69a0c4){return function(_0x170649,_0x28b6b5,_0x2c1349){UserNotificationEvents['emit'](_0x69a0c4+':'+_0x170649['id'],_0x170649);UserNotificationEvents['emit'](_0x69a0c4,_0x170649);_0x2c1349(null);};}for(var e in events){if(events[_0xcec1('0x3')](e)){var event=events[e];UserNotification[_0xcec1('0x4')](e,emitEvent(event));}}module['exports']=UserNotificationEvents; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.model.js b/server/api/userNotification/userNotification.model.js index 53bff70..0220b74 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 _0x4c6b=['lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./userNotification.attributes','exports','define','UserNotification','userNotifications','utf8mb4','utf8mb4_unicode_ci'];(function(_0x479880,_0x4ff378){var _0x331a91=function(_0x23a565){while(--_0x23a565){_0x479880['push'](_0x479880['shift']());}};_0x331a91(++_0x4ff378);}(_0x4c6b,0x87));var _0xb4c6=function(_0x255d5b,_0x4f6f35){_0x255d5b=_0x255d5b-0x0;var _0x3e141a=_0x4c6b[_0x255d5b];return _0x3e141a;};'use strict';var _=require(_0xb4c6('0x0'));var util=require('util');var logger=require(_0xb4c6('0x1'))(_0xb4c6('0x2'));var moment=require(_0xb4c6('0x3'));var BPromise=require(_0xb4c6('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb4c6('0x5'));var rimraf=require(_0xb4c6('0x6'));var config=require(_0xb4c6('0x7'));var attributes=require(_0xb4c6('0x8'));module[_0xb4c6('0x9')]=function(_0x5dfe17,_0x4734e5){return _0x5dfe17[_0xb4c6('0xa')](_0xb4c6('0xb'),attributes,{'tableName':_0xb4c6('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xb4c6('0xd'),'collate':_0xb4c6('0xe')});}; \ No newline at end of file +var _0xd76f=['userNotifications','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','./userNotification.attributes','exports','define','UserNotification'];(function(_0x5f3579,_0x2c2c9f){var _0x2a4cf7=function(_0x5360c4){while(--_0x5360c4){_0x5f3579['push'](_0x5f3579['shift']());}};_0x2a4cf7(++_0x2c2c9f);}(_0xd76f,0xe3));var _0xfd76=function(_0x25cd2c,_0x57498e){_0x25cd2c=_0x25cd2c-0x0;var _0x1e364c=_0xd76f[_0x25cd2c];return _0x1e364c;};'use strict';var _=require(_0xfd76('0x0'));var util=require('util');var logger=require(_0xfd76('0x1'))(_0xfd76('0x2'));var moment=require(_0xfd76('0x3'));var BPromise=require(_0xfd76('0x4'));var rp=require(_0xfd76('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfd76('0x6'));var config=require('../../config/environment');var attributes=require(_0xfd76('0x7'));module[_0xfd76('0x8')]=function(_0x418656,_0x4aac38){return _0x418656[_0xfd76('0x9')](_0xfd76('0xa'),attributes,{'tableName':_0xfd76('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xfd76('0xc'),'collate':_0xfd76('0xd')});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index 9df5ece..7515819 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 _0xcc07=['redis','defaults','socket.io-emitter','./userNotification.socket','request','then','UserNotification,\x20%s,\x20%s','request\x20sent','UserNotification,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment'];(function(_0x21010f,_0x1128a8){var _0x438d96=function(_0x5379f0){while(--_0x5379f0){_0x21010f['push'](_0x21010f['shift']());}};_0x438d96(++_0x1128a8);}(_0xcc07,0xd0));var _0x7cc0=function(_0x44268d,_0xad8443){_0x44268d=_0x44268d-0x0;var _0x4be92d=_0xcc07[_0x44268d];return _0x4be92d;};'use strict';var _=require(_0x7cc0('0x0'));var util=require('util');var moment=require(_0x7cc0('0x1'));var BPromise=require(_0x7cc0('0x2'));var rs=require(_0x7cc0('0x3'));var fs=require('fs');var Redis=require(_0x7cc0('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x7cc0('0x5'));var logger=require(_0x7cc0('0x6'))('rpc');var config=require(_0x7cc0('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0x7cc0('0x8')]=_[_0x7cc0('0x9')](config[_0x7cc0('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0x7cc0('0xa'))(new Redis(config[_0x7cc0('0x8')]));require(_0x7cc0('0xb'))['register'](socket);function respondWithRpcPromise(_0x4a362c,_0x3ea6c1,_0x398663){return new BPromise(function(_0x43ef68,_0x4934e3){return client[_0x7cc0('0xc')](_0x4a362c,_0x398663)[_0x7cc0('0xd')](function(_0x31f14e){logger['info'](_0x7cc0('0xe'),_0x3ea6c1,_0x7cc0('0xf'));logger['debug'](_0x7cc0('0x10'),_0x3ea6c1,_0x7cc0('0xf'),JSON[_0x7cc0('0x11')](_0x31f14e));if(_0x31f14e[_0x7cc0('0x12')]){if(_0x31f14e[_0x7cc0('0x12')][_0x7cc0('0x13')]===0x1f4){logger['error']('UserNotification,\x20%s,\x20%s',_0x3ea6c1,_0x31f14e[_0x7cc0('0x12')][_0x7cc0('0x14')]);return _0x4934e3(_0x31f14e[_0x7cc0('0x12')][_0x7cc0('0x14')]);}logger[_0x7cc0('0x12')]('UserNotification,\x20%s,\x20%s',_0x3ea6c1,_0x31f14e[_0x7cc0('0x12')][_0x7cc0('0x14')]);return _0x43ef68(_0x31f14e[_0x7cc0('0x12')]['message']);}else{logger[_0x7cc0('0x15')](_0x7cc0('0xe'),_0x3ea6c1,_0x7cc0('0xf'));_0x43ef68(_0x31f14e[_0x7cc0('0x16')][_0x7cc0('0x14')]);}})[_0x7cc0('0x17')](function(_0x5d8728){logger['error'](_0x7cc0('0xe'),_0x3ea6c1,_0x5d8728);_0x4934e3(_0x5d8728);});});} \ No newline at end of file +var _0x2ab4=['redis','localhost','socket.io-emitter','./userNotification.socket','register','info','request\x20sent','debug','UserNotification,\x20%s,\x20%s,\x20%s','stringify','error','code','UserNotification,\x20%s,\x20%s','message','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','http'];(function(_0xe87b98,_0x42e93c){var _0x4fd029=function(_0x43b993){while(--_0x43b993){_0xe87b98['push'](_0xe87b98['shift']());}};_0x4fd029(++_0x42e93c);}(_0x2ab4,0x15e));var _0x42ab=function(_0x26462c,_0xd20a35){_0x26462c=_0x26462c-0x0;var _0x509a42=_0x2ab4[_0x26462c];return _0x509a42;};'use strict';var _=require(_0x42ab('0x0'));var util=require(_0x42ab('0x1'));var moment=require('moment');var BPromise=require(_0x42ab('0x2'));var rs=require(_0x42ab('0x3'));var fs=require('fs');var Redis=require(_0x42ab('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x42ab('0x5'));var logger=require(_0x42ab('0x6'))(_0x42ab('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x42ab('0x8')][_0x42ab('0x9')]({'port':0x232a});config[_0x42ab('0xa')]=_['defaults'](config['redis'],{'host':_0x42ab('0xb'),'port':0x18eb});var socket=require(_0x42ab('0xc'))(new Redis(config[_0x42ab('0xa')]));require(_0x42ab('0xd'))[_0x42ab('0xe')](socket);function respondWithRpcPromise(_0x2b5fc5,_0xe64d05,_0xfbf538){return new BPromise(function(_0x17f6aa,_0xa2bb8b){return client['request'](_0x2b5fc5,_0xfbf538)['then'](function(_0xb784b4){logger[_0x42ab('0xf')]('UserNotification,\x20%s,\x20%s',_0xe64d05,_0x42ab('0x10'));logger[_0x42ab('0x11')](_0x42ab('0x12'),_0xe64d05,_0x42ab('0x10'),JSON[_0x42ab('0x13')](_0xb784b4));if(_0xb784b4[_0x42ab('0x14')]){if(_0xb784b4[_0x42ab('0x14')][_0x42ab('0x15')]===0x1f4){logger['error'](_0x42ab('0x16'),_0xe64d05,_0xb784b4[_0x42ab('0x14')]['message']);return _0xa2bb8b(_0xb784b4[_0x42ab('0x14')][_0x42ab('0x17')]);}logger[_0x42ab('0x14')](_0x42ab('0x16'),_0xe64d05,_0xb784b4[_0x42ab('0x14')][_0x42ab('0x17')]);return _0x17f6aa(_0xb784b4[_0x42ab('0x14')][_0x42ab('0x17')]);}else{logger[_0x42ab('0xf')](_0x42ab('0x16'),_0xe64d05,'request\x20sent');_0x17f6aa(_0xb784b4['result'][_0x42ab('0x17')]);}})['catch'](function(_0x5f2564){logger[_0x42ab('0x14')]('UserNotification,\x20%s,\x20%s',_0xe64d05,_0x5f2564);_0xa2bb8b(_0x5f2564);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index 50236c9..9482186 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 _0xb7cb=['emit','removeListener','register','userNotification:','save','remove'];(function(_0x228307,_0x517a62){var _0x1e02d8=function(_0x63d1f2){while(--_0x63d1f2){_0x228307['push'](_0x228307['shift']());}};_0x1e02d8(++_0x517a62);}(_0xb7cb,0x1f0));var _0xbb7c=function(_0x247064,_0x471718){_0x247064=_0x247064-0x0;var _0x287b72=_0xb7cb[_0x247064];return _0x287b72;};'use strict';var UserNotificationEvents=require('./userNotification.events');var events=[_0xbb7c('0x0'),_0xbb7c('0x1'),'update'];function createListener(_0x46e93e,_0xd465af){return function(_0x2d5c88){_0xd465af[_0xbb7c('0x2')](_0x46e93e,_0x2d5c88);};}function removeListener(_0xb2ad37,_0x3c3567){return function(){UserNotificationEvents[_0xbb7c('0x3')](_0xb2ad37,_0x3c3567);};}exports[_0xbb7c('0x4')]=function(_0x359c4f){for(var _0x5450ea=0x0,_0x2def17=events['length'];_0x5450ea<_0x2def17;_0x5450ea++){var _0x265374=events[_0x5450ea];var _0x5b23a9=createListener(_0xbb7c('0x5')+_0x265374,_0x359c4f);UserNotificationEvents['on'](_0x265374,_0x5b23a9);}}; \ No newline at end of file +var _0x165c=['length','./userNotification.events','save','remove','update','emit','removeListener','register'];(function(_0x13cc59,_0x13e92b){var _0x3a7730=function(_0x34a260){while(--_0x34a260){_0x13cc59['push'](_0x13cc59['shift']());}};_0x3a7730(++_0x13e92b);}(_0x165c,0x121));var _0xc165=function(_0x3f8170,_0xbb25e9){_0x3f8170=_0x3f8170-0x0;var _0x571696=_0x165c[_0x3f8170];return _0x571696;};'use strict';var UserNotificationEvents=require(_0xc165('0x0'));var events=[_0xc165('0x1'),_0xc165('0x2'),_0xc165('0x3')];function createListener(_0x9be2f3,_0xad5b57){return function(_0x1d2ef9){_0xad5b57[_0xc165('0x4')](_0x9be2f3,_0x1d2ef9);};}function removeListener(_0x1dd109,_0xfbfd12){return function(){UserNotificationEvents[_0xc165('0x5')](_0x1dd109,_0xfbfd12);};}exports[_0xc165('0x6')]=function(_0x16a40b){for(var _0x564753=0x0,_0x2b702f=events[_0xc165('0x7')];_0x564753<_0x2b702f;_0x564753++){var _0x20dd5d=events[_0x564753];var _0x418d3c=createListener('userNotification:'+_0x20dd5d,_0x16a40b);UserNotificationEvents['on'](_0x20dd5d,_0x418d3c);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index 126836b..1608709 100644 --- a/server/api/userOpenchannelQueue/index.js +++ b/server/api/userOpenchannelQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x4ce088,_0x34fcfc){var _0x1c22c7=function(_0x4a15da){while(--_0x4a15da){_0x4ce088['push'](_0x4ce088['shift']());}};_0x1c22c7(++_0x34fcfc);}(_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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x2aa16c,_0x5d96df){var _0x3698ff=function(_0x15541f){while(--_0x15541f){_0x2aa16c['push'](_0x2aa16c['shift']());}};_0x3698ff(++_0x5d96df);}(_0x70e0,0x17b));var _0x070e=function(_0x21ce03,_0x1baada){_0x21ce03=_0x21ce03-0x0;var _0x184974=_0x70e0[_0x21ce03];return _0x184974;};'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 73562f1..78c9631 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 _0xce5f=['sequelize','exports'];(function(_0x16e3ba,_0x46baf7){var _0x39304b=function(_0x5cc1ab){while(--_0x5cc1ab){_0x16e3ba['push'](_0x16e3ba['shift']());}};_0x39304b(++_0x46baf7);}(_0xce5f,0x152));var _0xfce5=function(_0x3f835a,_0x3d2469){_0x3f835a=_0x3f835a-0x0;var _0x57c6f2=_0xce5f[_0x3f835a];return _0x57c6f2;};'use strict';var Sequelize=require(_0xfce5('0x0'));module[_0xfce5('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xf20a=['exports','INTEGER','sequelize'];(function(_0x4b095c,_0x266c55){var _0x4495e2=function(_0x556701){while(--_0x556701){_0x4b095c['push'](_0x4b095c['shift']());}};_0x4495e2(++_0x266c55);}(_0xf20a,0x1b8));var _0xaf20=function(_0x382389,_0x515e77){_0x382389=_0x382389-0x0;var _0x5dbba2=_0xf20a[_0x382389];return _0x5dbba2;};'use strict';var Sequelize=require(_0xaf20('0x0'));module[_0xaf20('0x1')]={'penalty':{'type':Sequelize[_0xaf20('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 035bdc7..5b942f7 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 _0xb9a5=['user_has_openchannel_queues','lodash','../../config/logger','api','bluebird','path','rimraf','./userOpenchannelQueue.attributes','exports','define','UserOpenchannelQueue'];(function(_0x53bf64,_0x3842ed){var _0x5b2e71=function(_0x3f93bb){while(--_0x3f93bb){_0x53bf64['push'](_0x53bf64['shift']());}};_0x5b2e71(++_0x3842ed);}(_0xb9a5,0xa6));var _0x5b9a=function(_0x326b39,_0x4143c9){_0x326b39=_0x326b39-0x0;var _0x5b62d1=_0xb9a5[_0x326b39];return _0x5b62d1;};'use strict';var _=require(_0x5b9a('0x0'));var util=require('util');var logger=require(_0x5b9a('0x1'))(_0x5b9a('0x2'));var moment=require('moment');var BPromise=require(_0x5b9a('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5b9a('0x4'));var rimraf=require(_0x5b9a('0x5'));var config=require('../../config/environment');var attributes=require(_0x5b9a('0x6'));module[_0x5b9a('0x7')]=function(_0x422fac,_0x5ae07a){return _0x422fac[_0x5b9a('0x8')](_0x5b9a('0x9'),attributes,{'tableName':_0x5b9a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3fe4=['path','rimraf','../../config/environment','./userOpenchannelQueue.attributes','exports','define','user_has_openchannel_queues','lodash','util','../../config/logger','request-promise'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x3fe4,0x130));var _0x43fe=function(_0x43f942,_0x23cd17){_0x43f942=_0x43f942-0x0;var _0x426301=_0x3fe4[_0x43f942];return _0x426301;};'use strict';var _=require(_0x43fe('0x0'));var util=require(_0x43fe('0x1'));var logger=require(_0x43fe('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x43fe('0x3'));var fs=require('fs');var path=require(_0x43fe('0x4'));var rimraf=require(_0x43fe('0x5'));var config=require(_0x43fe('0x6'));var attributes=require(_0x43fe('0x7'));module[_0x43fe('0x8')]=function(_0x12a4c6,_0x3c7ea3){return _0x12a4c6[_0x43fe('0x9')]('UserOpenchannelQueue',attributes,{'tableName':_0x43fe('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js index ea14c15..065924f 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 _0x75cf=['ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','error','code','message','lodash','util','moment','bluebird','randomstring'];(function(_0x59ee9c,_0x43f62d){var _0x44a2a8=function(_0x5b2c33){while(--_0x5b2c33){_0x59ee9c['push'](_0x59ee9c['shift']());}};_0x44a2a8(++_0x43f62d);}(_0x75cf,0x7f));var _0xf75c=function(_0x15f609,_0x209e8a){_0x15f609=_0x15f609-0x0;var _0x343a94=_0x75cf[_0x15f609];return _0x343a94;};'use strict';var _=require(_0xf75c('0x0'));var util=require(_0xf75c('0x1'));var moment=require(_0xf75c('0x2'));var BPromise=require(_0xf75c('0x3'));var rs=require(_0xf75c('0x4'));var fs=require('fs');var Redis=require(_0xf75c('0x5'));var db=require(_0xf75c('0x6'))['db'];var utils=require(_0xf75c('0x7'));var logger=require('../../config/logger')(_0xf75c('0x8'));var config=require(_0xf75c('0x9'));var jayson=require(_0xf75c('0xa'));var client=jayson[_0xf75c('0xb')][_0xf75c('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xd26014,_0x479085,_0x57c5ba){return new BPromise(function(_0x56355b,_0x1305c8){return client[_0xf75c('0xd')](_0xd26014,_0x57c5ba)[_0xf75c('0xe')](function(_0x3210b6){logger[_0xf75c('0xf')](_0xf75c('0x10'),_0x479085,_0xf75c('0x11'));logger['debug'](_0xf75c('0x12'),_0x479085,'request\x20sent',JSON['stringify'](_0x3210b6));if(_0x3210b6[_0xf75c('0x13')]){if(_0x3210b6[_0xf75c('0x13')][_0xf75c('0x14')]===0x1f4){logger[_0xf75c('0x13')](_0xf75c('0x10'),_0x479085,_0x3210b6[_0xf75c('0x13')][_0xf75c('0x15')]);return _0x1305c8(_0x3210b6['error'][_0xf75c('0x15')]);}logger[_0xf75c('0x13')](_0xf75c('0x10'),_0x479085,_0x3210b6[_0xf75c('0x13')][_0xf75c('0x15')]);return _0x56355b(_0x3210b6['error'][_0xf75c('0x15')]);}else{logger[_0xf75c('0xf')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x479085,'request\x20sent');_0x56355b(_0x3210b6['result'][_0xf75c('0x15')]);}})['catch'](function(_0x40acc1){logger[_0xf75c('0x13')](_0xf75c('0x10'),_0x479085,_0x40acc1);_0x1305c8(_0x40acc1);});});} \ No newline at end of file +var _0x0956=['../../config/environment','jayson/promise','client','request','then','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc'];(function(_0x5aeba2,_0x3a8203){var _0x5758a2=function(_0x42c7aa){while(--_0x42c7aa){_0x5aeba2['push'](_0x5aeba2['shift']());}};_0x5758a2(++_0x3a8203);}(_0x0956,0x158));var _0x6095=function(_0x27d841,_0x2a7c0e){_0x27d841=_0x27d841-0x0;var _0x27974b=_0x0956[_0x27d841];return _0x27974b;};'use strict';var _=require(_0x6095('0x0'));var util=require(_0x6095('0x1'));var moment=require(_0x6095('0x2'));var BPromise=require(_0x6095('0x3'));var rs=require(_0x6095('0x4'));var fs=require('fs');var Redis=require(_0x6095('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x6095('0x6'));var logger=require('../../config/logger')(_0x6095('0x7'));var config=require(_0x6095('0x8'));var jayson=require(_0x6095('0x9'));var client=jayson[_0x6095('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x588be9,_0x5a40f0,_0x1ac151){return new BPromise(function(_0x10292e,_0x5e46c8){return client[_0x6095('0xb')](_0x588be9,_0x1ac151)[_0x6095('0xc')](function(_0x2c64fc){logger[_0x6095('0xd')](_0x6095('0xe'),_0x5a40f0,_0x6095('0xf'));logger[_0x6095('0x10')](_0x6095('0x11'),_0x5a40f0,_0x6095('0xf'),JSON[_0x6095('0x12')](_0x2c64fc));if(_0x2c64fc[_0x6095('0x13')]){if(_0x2c64fc[_0x6095('0x13')]['code']===0x1f4){logger[_0x6095('0x13')](_0x6095('0xe'),_0x5a40f0,_0x2c64fc['error']['message']);return _0x5e46c8(_0x2c64fc['error']['message']);}logger[_0x6095('0x13')](_0x6095('0xe'),_0x5a40f0,_0x2c64fc[_0x6095('0x13')][_0x6095('0x14')]);return _0x10292e(_0x2c64fc[_0x6095('0x13')][_0x6095('0x14')]);}else{logger[_0x6095('0xd')](_0x6095('0xe'),_0x5a40f0,_0x6095('0xf'));_0x10292e(_0x2c64fc[_0x6095('0x15')][_0x6095('0x14')]);}})['catch'](function(_0x453d94){logger[_0x6095('0x13')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x5a40f0,_0x453d94);_0x5e46c8(_0x453d94);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index ccb1cf8..e42de01 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 _0x5424=['/describe','describe','/:id','/:id/sections','getSections','getResources','post','/:id/clone','addSections','/:id/resources','put','update','destroy','removeSections','delete','removeResources','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./userProfile.controller','get','isAuthenticated','index'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x5424,0x17d));var _0x4542=function(_0x10c16d,_0x2b3e14){_0x10c16d=_0x10c16d-0x0;var _0x5896f4=_0x5424[_0x10c16d];return _0x5896f4;};'use strict';var multer=require('multer');var util=require(_0x4542('0x0'));var path=require(_0x4542('0x1'));var timeout=require(_0x4542('0x2'));var express=require('express');var router=express[_0x4542('0x3')]();var fs_extra=require(_0x4542('0x4'));var auth=require(_0x4542('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x4542('0x6'));var controller=require(_0x4542('0x7'));router[_0x4542('0x8')]('/',auth[_0x4542('0x9')](),controller[_0x4542('0xa')]);router['get'](_0x4542('0xb'),auth[_0x4542('0x9')](),controller[_0x4542('0xc')]);router['get'](_0x4542('0xd'),auth[_0x4542('0x9')](),controller['show']);router[_0x4542('0x8')](_0x4542('0xe'),auth[_0x4542('0x9')](),controller[_0x4542('0xf')]);router[_0x4542('0x8')]('/:id/resources',auth['isAuthenticated'](),controller[_0x4542('0x10')]);router['post']('/',auth[_0x4542('0x9')](),controller['create']);router[_0x4542('0x11')](_0x4542('0x12'),auth['isAuthenticated'](),controller['clone']);router[_0x4542('0x11')](_0x4542('0xe'),auth[_0x4542('0x9')](),controller[_0x4542('0x13')]);router['post'](_0x4542('0x14'),auth[_0x4542('0x9')](),controller['addResources']);router[_0x4542('0x15')](_0x4542('0xd'),auth[_0x4542('0x9')](),controller[_0x4542('0x16')]);router['delete'](_0x4542('0xd'),auth['isAuthenticated'](),controller[_0x4542('0x17')]);router['delete']('/:id/sections',auth[_0x4542('0x9')](),controller[_0x4542('0x18')]);router[_0x4542('0x19')](_0x4542('0x14'),auth[_0x4542('0x9')](),controller[_0x4542('0x1a')]);module[_0x4542('0x1b')]=router; \ No newline at end of file +var _0x17e3=['../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfile.controller','get','isAuthenticated','index','/describe','describe','getSections','/:id/resources','post','/:id/sections','addSections','addResources','put','/:id','update','destroy','delete','removeSections','removeResources','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x2b0875,_0x21ff12){var _0xedb8d7=function(_0x33ebf6){while(--_0x33ebf6){_0x2b0875['push'](_0x2b0875['shift']());}};_0xedb8d7(++_0x21ff12);}(_0x17e3,0x143));var _0x317e=function(_0x2eca5d,_0x2d0940){_0x2eca5d=_0x2eca5d-0x0;var _0x375dfe=_0x17e3[_0x2eca5d];return _0x375dfe;};'use strict';var multer=require(_0x317e('0x0'));var util=require(_0x317e('0x1'));var path=require(_0x317e('0x2'));var timeout=require(_0x317e('0x3'));var express=require(_0x317e('0x4'));var router=express[_0x317e('0x5')]();var fs_extra=require(_0x317e('0x6'));var auth=require(_0x317e('0x7'));var interaction=require(_0x317e('0x8'));var config=require(_0x317e('0x9'));var controller=require(_0x317e('0xa'));router[_0x317e('0xb')]('/',auth[_0x317e('0xc')](),controller[_0x317e('0xd')]);router['get'](_0x317e('0xe'),auth['isAuthenticated'](),controller[_0x317e('0xf')]);router[_0x317e('0xb')]('/:id',auth[_0x317e('0xc')](),controller['show']);router[_0x317e('0xb')]('/:id/sections',auth[_0x317e('0xc')](),controller[_0x317e('0x10')]);router[_0x317e('0xb')](_0x317e('0x11'),auth['isAuthenticated'](),controller['getResources']);router[_0x317e('0x12')]('/',auth['isAuthenticated'](),controller['create']);router[_0x317e('0x12')]('/:id/clone',auth[_0x317e('0xc')](),controller['clone']);router['post'](_0x317e('0x13'),auth[_0x317e('0xc')](),controller[_0x317e('0x14')]);router[_0x317e('0x12')](_0x317e('0x11'),auth[_0x317e('0xc')](),controller[_0x317e('0x15')]);router[_0x317e('0x16')](_0x317e('0x17'),auth[_0x317e('0xc')](),controller[_0x317e('0x18')]);router['delete'](_0x317e('0x17'),auth[_0x317e('0xc')](),controller[_0x317e('0x19')]);router[_0x317e('0x1a')](_0x317e('0x13'),auth[_0x317e('0xc')](),controller[_0x317e('0x1b')]);router[_0x317e('0x1a')](_0x317e('0x11'),auth[_0x317e('0xc')](),controller[_0x317e('0x1c')]);module[_0x317e('0x1d')]=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index 8196f5b..135fe49 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 _0xe1b8=['sequelize','STRING','name','setDataValue','crudPermissions','join','getDataValue','BOOLEAN'];(function(_0x40220a,_0x22feb1){var _0x3903cc=function(_0x33a296){while(--_0x33a296){_0x40220a['push'](_0x40220a['shift']());}};_0x3903cc(++_0x22feb1);}(_0xe1b8,0x158));var _0x8e1b=function(_0x417cd3,_0x498726){_0x417cd3=_0x417cd3-0x0;var _0xf155e2=_0xe1b8[_0x417cd3];return _0xf155e2;};'use strict';var Sequelize=require(_0x8e1b('0x0'));module['exports']={'name':{'type':Sequelize[_0x8e1b('0x1')],'allowNull':![],'unique':_0x8e1b('0x2')},'crudPermissions':{'type':Sequelize[_0x8e1b('0x1')],'set':function(_0x2586db){this[_0x8e1b('0x3')](_0x8e1b('0x4'),_0x2586db?_0x2586db[_0x8e1b('0x5')](''):[]);},'get':function(){return this[_0x8e1b('0x6')](_0x8e1b('0x4'))?this['getDataValue'](_0x8e1b('0x4'))['split'](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x8e1b('0x1')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x8e1b('0x7')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x8e1b('0x7')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0x8e1b('0x7')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x8e1b('0x7')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x8e1b('0x7')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x8e1b('0x7')],'defaultValue':!![]}}; \ No newline at end of file +var _0xd057=['name','setDataValue','crudPermissions','join','getDataValue','BOOLEAN','exports','STRING'];(function(_0x24a591,_0x55c6a0){var _0x35cc83=function(_0x35ed52){while(--_0x35ed52){_0x24a591['push'](_0x24a591['shift']());}};_0x35cc83(++_0x55c6a0);}(_0xd057,0x86));var _0x7d05=function(_0x2aa549,_0x427876){_0x2aa549=_0x2aa549-0x0;var _0x274a1f=_0xd057[_0x2aa549];return _0x274a1f;};'use strict';var Sequelize=require('sequelize');module[_0x7d05('0x0')]={'name':{'type':Sequelize[_0x7d05('0x1')],'allowNull':![],'unique':_0x7d05('0x2')},'crudPermissions':{'type':Sequelize[_0x7d05('0x1')],'set':function(_0x30587b){this[_0x7d05('0x3')](_0x7d05('0x4'),_0x30587b?_0x30587b[_0x7d05('0x5')](''):[]);},'get':function(){return this[_0x7d05('0x6')](_0x7d05('0x4'))?this[_0x7d05('0x6')](_0x7d05('0x4'))['split'](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x7d05('0x1')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0x7d05('0x7')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x7d05('0x7')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x7d05('0x7')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0x7d05('0x7')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0x7d05('0x7')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x7d05('0x7')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x7d05('0x7')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x7d05('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 0da11b1..cd744ad 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 _0xb621=['merge','VIRTUAL','options','where','includeAll','include','UserProfile','findAll','rows','show','params','rawAttributes','find','catch','create','body','length','get','updatedAt','crudPermissions','omit','sequelize','transaction','UserProfileSection','autoAssociation','UserProfileResource','sectionId','userProfileId','Resources','describe','addSections','each','removeSections','ids','getSections','enabled','isEmpty','subsections','includes','push','findOne','Dashboard','forEach','resourceId','Plugin','addResources','bulkCreate','removeResources','getResources','section','Sequelize','ValidationError','Unknown\x20section','mergeResources','childModel','Invalid\x20section\x20\x27','parentSections','ignore','all','hasOwnProperty','order','key','field','foreignKey','associatedResources','AnalyticExtractedReport','reportType','default','reportId','DefaultReports','custom','CustomReports','CmContact','Tag','Tags','color','tag','ThroughTags','openTabs','true','chat','dataValues','fax','mail','openchannel','charAt','toUpperCase','slice','QueryTypes','select','ui.','ui.createdAt','user_has_','_interactions','toString','OpenTabs','value','squareprojects','SquareProject','SquareOdbc','squarerecordings','SquareRecording','SquareProjects','projectName','projects','JscriptyProject','contacts','Lists','ListId','lists','CmList','companies','CmCompany','globalcustomfields','CmCustomField','chatqueues','ChatQueue','chatwebsites','ChatWebsite','faxqueues','FaxQueue','faxaccounts','FaxAccount','inboundroutes','internalroutes','outboundroutes','VoiceExtension','contexts','VoiceContext','voicemails','VoiceMail','Agents','membername','User','agent','Telephones','role','telephone','VoiceQueue','QueueCampaigns','outbound','VoiceMusicOnHold','chanspies','VoiceChanSpy','voiceprefixes','VoicePrefix','ivrcampaigns','Campaign','mailqueues','MailQueue','mailaccounts','MailAccount','mailsubstatuses','MailSubstatus','openchannelqueues','OpenchannelAccount','smsqueues','SmsQueue','smsaccounts','WhatsappQueue','teams','Team','queuecampaigns','VoiceQueues','agents','telephones','Users','admin','user','zendeskaccounts','ZendeskAccount','salesforceaccounts','SalesforceAccount','freshdeskaccounts','sugarcrmaccounts','deskaccounts','DeskAccount','zohoaccounts','ZohoAccount','vtigeraccounts','cannedanswers','dispositions','Disposition','customdashboards','intervals','Interval','Pause','scheduler','Schedule','Sound','tags','templates','triggers','Trigger','trunks','Trunk','Variable','extractedreports','metrics','AnalyticMetric','whatsappaccounts','screenrecordings','ScreenRecording','eml-format','rimraf','fast-json-patch','bluebird','mustache','util','path','to-csv','ejs','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/environment','../../mysqldb','redis','defaults','localhost','./userProfile.socket','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','reject','save','update','then','destroy','error','name','index','map','type','model','query','keys','filters','intersection','attributes','fields','nolimit','sort','pick','filter'];(function(_0x2dc9c9,_0x588aa6){var _0x330663=function(_0x2d0473){while(--_0x2d0473){_0x2dc9c9['push'](_0x2dc9c9['shift']());}};_0x330663(++_0x588aa6);}(_0xb621,0x1d1));var _0x1b62=function(_0x2a1894,_0x23c39e){_0x2a1894=_0x2a1894-0x0;var _0x545cee=_0xb621[_0x2a1894];return _0x545cee;};'use strict';var emlformat=require(_0x1b62('0x0'));var rimraf=require(_0x1b62('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1b62('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x1b62('0x3'));var Mustache=require(_0x1b62('0x4'));var util=require(_0x1b62('0x5'));var path=require(_0x1b62('0x6'));var sox=require('sox');var csv=require(_0x1b62('0x7'));var ejs=require(_0x1b62('0x8'));var fs=require('fs');var fs_extra=require(_0x1b62('0x9'));var _=require(_0x1b62('0xa'));var squel=require(_0x1b62('0xb'));var crypto=require(_0x1b62('0xc'));var jsforce=require(_0x1b62('0xd'));var deskjs=require(_0x1b62('0xe'));var toCsv=require('to-csv');var querystring=require(_0x1b62('0xf'));var Papa=require('papaparse');var Redis=require(_0x1b62('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x1b62('0x11'));var as=require(_0x1b62('0x12'));var hardwareService=require(_0x1b62('0x13'));var logger=require(_0x1b62('0x14'))(_0x1b62('0x15'));var utils=require(_0x1b62('0x16'));var config=require(_0x1b62('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x1b62('0x18'))['db'];config[_0x1b62('0x19')]=_[_0x1b62('0x1a')](config['redis'],{'host':_0x1b62('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1b62('0x19')]));require(_0x1b62('0x1c'))['register'](socket);function respondWithStatusCode(_0x18b7af,_0x4ecf6f){_0x4ecf6f=_0x4ecf6f||0xcc;return function(_0x537d9e){if(_0x537d9e){return _0x18b7af[_0x1b62('0x1d')](_0x4ecf6f);}return _0x18b7af[_0x1b62('0x1e')](_0x4ecf6f)[_0x1b62('0x1f')]();};}function respondWithResult(_0x47202f,_0x211dec){_0x211dec=_0x211dec||0xc8;return function(_0x3959ab){if(_0x3959ab){return _0x47202f[_0x1b62('0x1e')](_0x211dec)[_0x1b62('0x20')](_0x3959ab);}};}function respondWithFilteredResult(_0x2e3327,_0x275a12){return function(_0x79fa11){if(_0x79fa11){var _0x32dcf2=typeof _0x275a12[_0x1b62('0x21')]==='undefined'&&typeof _0x275a12[_0x1b62('0x22')]===_0x1b62('0x23');var _0x227a94=_0x79fa11[_0x1b62('0x24')];var _0x30c436=_0x32dcf2?0x0:_0x275a12[_0x1b62('0x21')];var _0x44d63d=_0x32dcf2?_0x79fa11[_0x1b62('0x24')]:_0x275a12[_0x1b62('0x21')]+_0x275a12['limit'];var _0x5c0f55;if(_0x44d63d>=_0x227a94){_0x44d63d=_0x227a94;_0x5c0f55=0xc8;}else{_0x5c0f55=0xce;}_0x2e3327['status'](_0x5c0f55);return _0x2e3327['set'](_0x1b62('0x25'),_0x30c436+'-'+_0x44d63d+'/'+_0x227a94)[_0x1b62('0x20')](_0x79fa11);}return null;};}function patchUpdates(_0xd1abd0){return function(_0x40784d){try{jsonpatch['apply'](_0x40784d,_0xd1abd0,!![]);}catch(_0x193965){return BPromise[_0x1b62('0x26')](_0x193965);}return _0x40784d[_0x1b62('0x27')]();};}function saveUpdates(_0x74e848,_0x575d1c){return function(_0x52f350){if(_0x52f350){return _0x52f350[_0x1b62('0x28')](_0x74e848)[_0x1b62('0x29')](function(_0x31f13e){return _0x31f13e;});}return null;};}function removeEntity(_0x4fe9f5,_0x331ce0){return function(_0x23bfe9){if(_0x23bfe9){return _0x23bfe9[_0x1b62('0x2a')]()[_0x1b62('0x29')](function(){_0x4fe9f5[_0x1b62('0x1e')](0xcc)[_0x1b62('0x1f')]();});}};}function handleEntityNotFound(_0x459136,_0xea2d79){return function(_0x1503ec){if(!_0x1503ec){_0x459136[_0x1b62('0x1d')](0x194);}return _0x1503ec;};}function handleError(_0x5166ac,_0x1c3d74){_0x1c3d74=_0x1c3d74||0x1f4;return function(_0x1ac9a8){logger[_0x1b62('0x2b')](_0x1ac9a8['stack']);if(_0x1ac9a8[_0x1b62('0x2c')]){delete _0x1ac9a8['name'];}_0x5166ac['status'](_0x1c3d74)['send'](_0x1ac9a8);};}exports[_0x1b62('0x2d')]=function(_0x1d9cc0,_0x43cd95){var _0xe9f46={},_0x541fde={},_0x4436a1={'count':0x0,'rows':[]};var _0x6ddcac=_[_0x1b62('0x2e')](db['UserProfile']['rawAttributes'],function(_0x255fd2){return{'name':_0x255fd2['fieldName'],'type':_0x255fd2[_0x1b62('0x2f')]['key']};});_0x541fde[_0x1b62('0x30')]=_[_0x1b62('0x2e')](_0x6ddcac,_0x1b62('0x2c'));_0x541fde[_0x1b62('0x31')]=_[_0x1b62('0x32')](_0x1d9cc0[_0x1b62('0x31')]);_0x541fde[_0x1b62('0x33')]=_[_0x1b62('0x34')](_0x541fde[_0x1b62('0x30')],_0x541fde['query']);_0xe9f46[_0x1b62('0x35')]=_[_0x1b62('0x34')](_0x541fde[_0x1b62('0x30')],qs[_0x1b62('0x36')](_0x1d9cc0['query'][_0x1b62('0x36')]));_0xe9f46[_0x1b62('0x35')]=_0xe9f46[_0x1b62('0x35')]['length']?_0xe9f46[_0x1b62('0x35')]:_0x541fde[_0x1b62('0x30')];if(!_0x1d9cc0[_0x1b62('0x31')]['hasOwnProperty'](_0x1b62('0x37'))){_0xe9f46[_0x1b62('0x22')]=qs[_0x1b62('0x22')](_0x1d9cc0[_0x1b62('0x31')]['limit']);_0xe9f46[_0x1b62('0x21')]=qs[_0x1b62('0x21')](_0x1d9cc0[_0x1b62('0x31')][_0x1b62('0x21')]);}_0xe9f46['order']=qs[_0x1b62('0x38')](_0x1d9cc0[_0x1b62('0x31')]['sort']);_0xe9f46['where']=qs['filters'](_[_0x1b62('0x39')](_0x1d9cc0['query'],_0x541fde[_0x1b62('0x33')]),_0x6ddcac);if(_0x1d9cc0[_0x1b62('0x31')][_0x1b62('0x3a')]){_0xe9f46['where']=_[_0x1b62('0x3b')](_0xe9f46['where'],{'$or':_['map'](_0x6ddcac,function(_0xbd3e55){if(_0xbd3e55[_0x1b62('0x2f')]!==_0x1b62('0x3c')){var _0x291d85={};_0x291d85[_0xbd3e55[_0x1b62('0x2c')]]={'$like':'%'+_0x1d9cc0[_0x1b62('0x31')][_0x1b62('0x3a')]+'%'};return _0x291d85;}})});}_0xe9f46=_[_0x1b62('0x3b')]({},_0xe9f46,_0x1d9cc0[_0x1b62('0x3d')]);var _0x2aec91={'where':_0xe9f46[_0x1b62('0x3e')]};return db['UserProfile'][_0x1b62('0x24')](_0x2aec91)['then'](function(_0x3a098d){_0x4436a1['count']=_0x3a098d;if(_0x1d9cc0[_0x1b62('0x31')][_0x1b62('0x3f')]){_0xe9f46[_0x1b62('0x40')]=[{'all':!![]}];}return db[_0x1b62('0x41')][_0x1b62('0x42')](_0xe9f46);})[_0x1b62('0x29')](function(_0x37c789){_0x4436a1[_0x1b62('0x43')]=_0x37c789;return _0x4436a1;})[_0x1b62('0x29')](respondWithFilteredResult(_0x43cd95,_0xe9f46))['catch'](handleError(_0x43cd95,null));};exports[_0x1b62('0x44')]=function(_0x6b4aa6,_0x529ea7){var _0x34d1e2={'raw':![],'where':{'id':_0x6b4aa6[_0x1b62('0x45')]['id']}},_0x442a10={};_0x442a10[_0x1b62('0x30')]=_[_0x1b62('0x32')](db[_0x1b62('0x41')][_0x1b62('0x46')]);_0x442a10[_0x1b62('0x31')]=_[_0x1b62('0x32')](_0x6b4aa6[_0x1b62('0x31')]);_0x442a10[_0x1b62('0x33')]=_['intersection'](_0x442a10[_0x1b62('0x30')],_0x442a10['query']);_0x34d1e2[_0x1b62('0x35')]=_['intersection'](_0x442a10[_0x1b62('0x30')],qs['fields'](_0x6b4aa6[_0x1b62('0x31')][_0x1b62('0x36')]));_0x34d1e2[_0x1b62('0x35')]=_0x34d1e2[_0x1b62('0x35')]['length']?_0x34d1e2[_0x1b62('0x35')]:_0x442a10[_0x1b62('0x30')];if(_0x6b4aa6[_0x1b62('0x31')][_0x1b62('0x3f')]){_0x34d1e2['include']=[{'all':!![]}];}_0x34d1e2=_[_0x1b62('0x3b')]({},_0x34d1e2,_0x6b4aa6['options']);return db[_0x1b62('0x41')][_0x1b62('0x47')](_0x34d1e2)[_0x1b62('0x29')](handleEntityNotFound(_0x529ea7,null))['then'](respondWithResult(_0x529ea7,null))[_0x1b62('0x48')](handleError(_0x529ea7,null));};exports[_0x1b62('0x49')]=function(_0x5dff10,_0x3a409f){return db[_0x1b62('0x41')][_0x1b62('0x49')](_0x5dff10[_0x1b62('0x4a')],{})[_0x1b62('0x29')](respondWithResult(_0x3a409f,0xc9))[_0x1b62('0x48')](handleError(_0x3a409f,null));};exports['clone']=function(_0x13cd81,_0x14d667){var _0xb7ead={'where':{'id':_0x13cd81[_0x1b62('0x45')]['id']}},_0x49f9f1={};_0x49f9f1['model']=_['keys'](db['UserProfile'][_0x1b62('0x46')]);_0xb7ead[_0x1b62('0x35')]=_[_0x1b62('0x34')](_0x49f9f1[_0x1b62('0x30')],qs[_0x1b62('0x36')](_0x13cd81[_0x1b62('0x31')][_0x1b62('0x36')]));_0xb7ead[_0x1b62('0x35')]=_0xb7ead[_0x1b62('0x35')][_0x1b62('0x4b')]?_0xb7ead[_0x1b62('0x35')]:_0x49f9f1['model'];if(_0x13cd81[_0x1b62('0x31')][_0x1b62('0x3f')]){_0xb7ead[_0x1b62('0x40')]=[{'all':!![]}];}_0xb7ead=_[_0x1b62('0x3b')]({},_0xb7ead,_0x13cd81['options']);return db[_0x1b62('0x41')][_0x1b62('0x47')](_0xb7ead)[_0x1b62('0x29')](handleEntityNotFound(_0x14d667,null))['then'](function(_0x472c7a){if(_0x472c7a){var _0x1c409d=_0x472c7a[_0x1b62('0x4c')]({'plain':!![]});_0x1c409d=qs['omit'](_0x1c409d,['id','createdAt',_0x1b62('0x4d'),_0x1b62('0x4e')]);_0x13cd81[_0x1b62('0x4a')]=_[_0x1b62('0x4f')](_0x13cd81[_0x1b62('0x4a')],['id','createdAt','updatedAt']);return db[_0x1b62('0x50')][_0x1b62('0x51')](function(_0x176af2){return db['UserProfile'][_0x1b62('0x49')](_[_0x1b62('0x3b')](_0x1c409d,_0x13cd81[_0x1b62('0x4a')]),{'include':_0x13cd81['query']['includeAll']?[{'all':!![]}]:undefined,'transaction':_0x176af2})[_0x1b62('0x29')](function(_0x34aa9a){var _0xf6b3ee=_0x34aa9a[_0x1b62('0x4c')]({'plain':!![]});return db[_0x1b62('0x52')]['findAll']({'where':{'userProfileId':_0x13cd81[_0x1b62('0x45')]['id']},'raw':!![]})[_0x1b62('0x29')](function(_0x2bd0af){if(_0x2bd0af){return BPromise['each'](_0x2bd0af,function(_0x3c14fa){return new BPromise(function(_0x457de7,_0x4d4edf){if(_0x3c14fa[_0x1b62('0x53')]===null||_0x3c14fa[_0x1b62('0x53')]===0x1)_0x457de7(null);return db[_0x1b62('0x54')][_0x1b62('0x42')]({'where':{'sectionId':_0x3c14fa['id']},'raw':!![]})[_0x1b62('0x29')](function(_0x1f6eb3){var _0x114261=_[_0x1b62('0x2e')](_0x1f6eb3,function(_0xc40b5d){return qs[_0x1b62('0x4f')](_0xc40b5d,['id','createdAt','updatedAt',_0x1b62('0x55')]);});_0x457de7(_0x114261);})[_0x1b62('0x48')](function(_0x2dfecb){_0x4d4edf(_0x2dfecb);});})[_0x1b62('0x29')](function(_0x4ae9bc){var _0x58f7e5=qs[_0x1b62('0x4f')](_0x3c14fa,['id','createdAt',_0x1b62('0x4d')]);_0x58f7e5[_0x1b62('0x56')]=_0xf6b3ee['id'];if(_0x4ae9bc)_0x58f7e5[_0x1b62('0x57')]=_0x4ae9bc;return _0x58f7e5;})[_0x1b62('0x29')](function(_0x4a33e9){return db[_0x1b62('0x52')][_0x1b62('0x49')](_0x4a33e9,{'include':[{'model':db[_0x1b62('0x54')],'as':'Resources'}],'raw':!![],'transaction':_0x176af2});});})[_0x1b62('0x29')](function(){return _0xf6b3ee;});}});});});}})[_0x1b62('0x29')](respondWithResult(_0x14d667,0xc9))[_0x1b62('0x48')](handleError(_0x14d667,null));};exports[_0x1b62('0x28')]=function(_0x53f947,_0x4a2810){if(_0x53f947[_0x1b62('0x4a')]['id']){delete _0x53f947[_0x1b62('0x4a')]['id'];}return db['UserProfile'][_0x1b62('0x47')]({'where':{'id':_0x53f947[_0x1b62('0x45')]['id']}})[_0x1b62('0x29')](handleEntityNotFound(_0x4a2810,null))[_0x1b62('0x29')](saveUpdates(_0x53f947[_0x1b62('0x4a')],null))[_0x1b62('0x29')](respondWithResult(_0x4a2810,null))[_0x1b62('0x48')](handleError(_0x4a2810,null));};exports[_0x1b62('0x2a')]=function(_0x4d2a8a,_0x4bc33c){return db['UserProfile'][_0x1b62('0x47')]({'where':{'id':_0x4d2a8a[_0x1b62('0x45')]['id']}})[_0x1b62('0x29')](handleEntityNotFound(_0x4bc33c,null))[_0x1b62('0x29')](removeEntity(_0x4bc33c,null))[_0x1b62('0x48')](handleError(_0x4bc33c,null));};exports[_0x1b62('0x58')]=function(_0x20ad11,_0x2d3990){return db[_0x1b62('0x41')]['describe']()[_0x1b62('0x29')](respondWithResult(_0x2d3990,null))[_0x1b62('0x48')](handleError(_0x2d3990,null));};exports[_0x1b62('0x59')]=function(_0x39dbf9,_0x4c3654){var _0x5617fb=_0x39dbf9[_0x1b62('0x4a')];return db[_0x1b62('0x41')][_0x1b62('0x47')]({'where':{'id':_0x39dbf9[_0x1b62('0x45')]['id']}})['then'](handleEntityNotFound(_0x4c3654,null))[_0x1b62('0x29')](function(_0x59c049){if(_0x59c049){return db['sequelize'][_0x1b62('0x51')](function(_0x59cb99){return db[_0x1b62('0x52')][_0x1b62('0x2a')]({'where':{'userProfileId':_0x39dbf9['params']['id'],'sectionId':_[_0x1b62('0x2e')](_0x5617fb,function(_0x5973b5){return _0x5973b5[_0x1b62('0x55')];})},'transaction':_0x59cb99})[_0x1b62('0x29')](function(){var _0x2d2d8d=_['map'](_0x5617fb,function(_0x55d500){_0x55d500[_0x1b62('0x56')]=_0x39dbf9[_0x1b62('0x45')]['id'];return _0x55d500;});var _0x35f820=[];return BPromise[_0x1b62('0x5a')](_0x2d2d8d,function(_0x49004b){return db[_0x1b62('0x52')][_0x1b62('0x49')](_0x49004b,{'include':[{'model':db['UserProfileResource'],'as':_0x1b62('0x57')}],'raw':!![],'transaction':_0x59cb99})[_0x1b62('0x29')](function(_0x5c2e8c){_0x35f820['push'](_0x5c2e8c[_0x1b62('0x4c')]({'plain':!![]}));});})[_0x1b62('0x29')](function(){return _0x35f820;});});});}})[_0x1b62('0x29')](function(_0x2d4ef6){return _0x2d4ef6;})[_0x1b62('0x29')](respondWithResult(_0x4c3654,null))[_0x1b62('0x48')](handleError(_0x4c3654,null));};exports[_0x1b62('0x5b')]=function(_0x12ae99,_0x57e1bf){var _0x2ebeb5;return db[_0x1b62('0x41')][_0x1b62('0x47')]({'where':{'id':_0x12ae99[_0x1b62('0x45')]['id']},'attributes':['id','name']})[_0x1b62('0x29')](handleEntityNotFound(_0x57e1bf,null))['then'](function(_0x434390){if(_0x434390){_0x2ebeb5=_0x434390;return db[_0x1b62('0x52')][_0x1b62('0x2a')]({'where':{'userProfileId':_0x12ae99[_0x1b62('0x45')]['id'],'sectionId':_0x12ae99[_0x1b62('0x31')][_0x1b62('0x5c')]}});}})[_0x1b62('0x29')](function(){return _0x2ebeb5;})[_0x1b62('0x29')](respondWithStatusCode(_0x57e1bf,null))[_0x1b62('0x48')](handleError(_0x57e1bf,null));};exports[_0x1b62('0x5d')]=function(_0x530ff8,_0x41edcb){var _0x23b633=[];var _0x3d753=[];return db[_0x1b62('0x52')][_0x1b62('0x42')]({'where':{'userProfileId':_0x530ff8[_0x1b62('0x45')]['id']},'raw':!![]})['then'](function(_0x1b25dc){_0x23b633=_[_0x1b62('0x3a')](_0x1b25dc,function(_0x1bdee5){return _0x1bdee5[_0x1b62('0x5e')]===0x1||_['includes']([0x3eb,0x709],_0x1bdee5[_0x1b62('0x55')]);});if(!_[_0x1b62('0x5f')](_0x23b633)){return _['map'](_0x23b633,function(_0xc8d0c1){return _0xc8d0c1[_0x1b62('0x55')];});}else{return;}})[_0x1b62('0x29')](function(_0x151caa){if(_0x151caa)_0x3d753=_0x151caa;if(_['includes'](_0x3d753,0x64)){var _0x26325d=_[_0x1b62('0x47')](_0x23b633,{'sectionId':0x64});return hasDefaultDashboard(_0x26325d)['then'](function(_0x4d6af2){return _[_0x1b62('0x2e')](_0x23b633,function(_0x585552){if(_0x585552[_0x1b62('0x55')]===0x64){_0x585552[_0x1b62('0x60')]=_0x4d6af2;}return _0x585552;});});}else{return;}})['then'](function(_0x3a31be){if(_0x3a31be)_0x23b633=_0x3a31be;if(_[_0x1b62('0x61')](_0x3d753,0x3eb)){var _0x3f2e1c=_[_0x1b62('0x47')](_0x23b633,{'sectionId':0x3eb});return getCustomDashboards(_0x3f2e1c)['then'](function(_0x191323){return _[_0x1b62('0x2e')](_0x23b633,function(_0x254222){if(_0x3f2e1c[_0x1b62('0x5e')]){if(_0x254222[_0x1b62('0x55')]===0x3eb){_0x254222['subsections']=_0x191323;}}else{if(_0x254222[_0x1b62('0x55')]===0x64){_0x254222[_0x1b62('0x60')]=_0x191323;}}return _0x254222;});});}else{return;}})[_0x1b62('0x29')](function(_0x2623d8){if(_0x2623d8)_0x23b633=_0x2623d8;if(_[_0x1b62('0x61')](_0x3d753,0x709)){var _0x42400f=_[_0x1b62('0x47')](_0x23b633,{'sectionId':0x709});return getPlugins(_0x42400f)[_0x1b62('0x29')](function(_0x18dc32){if(_0x42400f[_0x1b62('0x5e')]){return _[_0x1b62('0x2e')](_0x23b633,function(_0x434b3c){if(_0x434b3c['sectionId']===0x709){_0x434b3c['subsections']=_0x18dc32;}return _0x434b3c;});}else{var _0x150f7e={'sectionId':0x76c,'enabled':0x1,'subsections':_0x18dc32};var _0x2f3d71=_[_0x1b62('0x2e')](_0x23b633);_0x2f3d71[_0x1b62('0x62')](_0x150f7e);return _0x2f3d71;}});}else{return;}})[_0x1b62('0x29')](function(_0x2d3560){if(_0x2d3560)_0x23b633=_0x2d3560;return _[_0x1b62('0x3a')](_0x23b633,[_0x1b62('0x5e'),0x1]);})[_0x1b62('0x29')](respondWithResult(_0x41edcb,null))[_0x1b62('0x48')](handleError(_0x41edcb,null));};function hasDefaultDashboard(_0x31850d){var _0xd6383b=[0x65];return new BPromise(function(_0x4e98ea,_0x1466a7){try{if(_0x31850d[_0x1b62('0x53')]){_0x4e98ea(_0xd6383b);}else{return db[_0x1b62('0x54')][_0x1b62('0x63')]({'where':{'sectionId':_0x31850d['id']},'raw':!![]})['then'](function(_0x38b71f){_0x38b71f?_0x4e98ea(_0xd6383b):_0x4e98ea();});}}catch(_0x1b2a3c){_0x1466a7(_0x1b2a3c);}});}function getCustomDashboards(_0x1c8b52){var _0x2df436=[];return new BPromise(function(_0x387403,_0x234986){try{if(_0x1c8b52[_0x1b62('0x53')]){return db[_0x1b62('0x64')]['findAll']({'raw':!![]})[_0x1b62('0x29')](function(_0xa11a21){_0xa11a21['forEach'](function(_0x3584ac){_0x2df436[_0x1b62('0x62')](_0x3584ac['id']+0x1869f);});_0x387403(_0x2df436);});}else{return db[_0x1b62('0x54')][_0x1b62('0x42')]({'where':{'sectionId':_0x1c8b52['id']},'raw':!![]})[_0x1b62('0x29')](function(_0x29eec8){_0x29eec8[_0x1b62('0x65')](function(_0x38a011){_0x2df436[_0x1b62('0x62')](_0x38a011[_0x1b62('0x66')]+0x1869f);});_0x387403(_0x2df436);});}}catch(_0x1ab4e4){_0x234986(_0x1ab4e4);}});}function getPlugins(_0x16ef9f){var _0x2c72a7=[];return new BPromise(function(_0x2c6854,_0x187ac6){try{if(_0x16ef9f[_0x1b62('0x53')]){return db[_0x1b62('0x67')][_0x1b62('0x42')]({'raw':!![]})[_0x1b62('0x29')](function(_0x2aa80a){_0x2aa80a[_0x1b62('0x65')](function(_0x2ac156){_0x2c72a7['push'](_0x2ac156['id']+0x15b38);});_0x2c6854(_0x2c72a7);});}else{return db[_0x1b62('0x54')][_0x1b62('0x42')]({'where':{'sectionId':_0x16ef9f['id']},'raw':!![]})[_0x1b62('0x29')](function(_0x299d8e){_0x299d8e[_0x1b62('0x65')](function(_0x235d02){_0x2c72a7[_0x1b62('0x62')](_0x235d02[_0x1b62('0x66')]+0x15b38);});_0x2c6854(_0x2c72a7);});}}catch(_0x14339d){_0x187ac6(_0x14339d);}});}exports[_0x1b62('0x68')]=function(_0x462d2b,_0x9ef85f){return db[_0x1b62('0x41')][_0x1b62('0x47')]({'where':{'id':_0x462d2b[_0x1b62('0x45')]['id']}})[_0x1b62('0x29')](handleEntityNotFound(_0x9ef85f,null))[_0x1b62('0x29')](function(_0x592958){if(_0x592958){return db[_0x1b62('0x50')][_0x1b62('0x51')](function(_0x3612cd){return db[_0x1b62('0x52')]['findAll']({'where':{'userProfileId':_0x462d2b[_0x1b62('0x45')]['id']},'attributes':['id'],'raw':!![]})['then'](function(_0x8739f6){if(_0x8739f6){return db[_0x1b62('0x52')][_0x1b62('0x2a')]({'where':{'userProfileId':_0x462d2b[_0x1b62('0x45')]['id'],'id':_[_0x1b62('0x2e')](_0x8739f6,function(_0x17fa41){return _0x17fa41['id'];})},'transaction':_0x3612cd});}})['then'](function(_0x7610c6){var _0xfc9c7a=_['map'](_0x462d2b[_0x1b62('0x4a')],function(_0x529f67){_0x529f67[_0x1b62('0x56')]=_0x462d2b[_0x1b62('0x45')]['id'];return _0x529f67;});return db[_0x1b62('0x52')][_0x1b62('0x69')](_0xfc9c7a,{'raw':!![],'transaction':_0x3612cd});})[_0x1b62('0x29')](function(_0x3da791){var _0x3d99be=_['filter'](_[_0x1b62('0x2e')](_0x3da791,function(_0x41eeb0){return _0x41eeb0[_0x1b62('0x4c')]({'plain':!![]});}),{'includeAll':![]});if(_0x3d99be){return db[_0x1b62('0x52')]['findAll']({'where':{'userProfileId':_0x462d2b[_0x1b62('0x45')]['id'],'sectionId':_[_0x1b62('0x2e')](_0x3d99be,function(_0x2b2744){return _0x2b2744[_0x1b62('0x55')];})},'attributes':['id',_0x1b62('0x55')],'raw':!![]})[_0x1b62('0x29')](function(_0x3b0dce){var _0x37e868=_[_0x1b62('0x2e')](_0x462d2b[_0x1b62('0x4a')],function(_0x297d3a){_0x297d3a['userProfileId']=_0x462d2b[_0x1b62('0x45')]['id'];return _0x297d3a;});return db[_0x1b62('0x54')][_0x1b62('0x69')](_0x37e868,{'raw':!![],'transaction':_0x3612cd});});}})['catch'](handleError(_0x9ef85f,null));});}})[_0x1b62('0x29')](function(_0x27825d){var _0x291cd8=_[_0x1b62('0x2e')](_0x27825d,function(_0x5eae57){return _0x5eae57[_0x1b62('0x4c')]({'plain':!![]});});})[_0x1b62('0x29')](respondWithResult(_0x9ef85f,null))[_0x1b62('0x48')](handleError(_0x9ef85f,null));};exports[_0x1b62('0x6a')]=function(_0x2a89ab,_0x2ef291,_0x3573eb){return db[_0x1b62('0x41')][_0x1b62('0x47')]({'where':{'id':_0x2a89ab[_0x1b62('0x45')]['id']}})[_0x1b62('0x29')](handleEntityNotFound(_0x2ef291,null))[_0x1b62('0x29')](function(_0x56d8a3){if(_0x56d8a3){return _0x56d8a3[_0x1b62('0x6a')](_0x2a89ab[_0x1b62('0x31')]['ids']);}})[_0x1b62('0x29')](respondWithStatusCode(_0x2ef291,null))[_0x1b62('0x48')](handleError(_0x2ef291,null));};exports[_0x1b62('0x6b')]=function(_0x122791,_0x522b8c){var _0x518110={'raw':![],'where':{}};var _0x8d9674={};var _0x559b82={'count':0x0,'rows':[]};var _0x7ee929=_0x122791[_0x1b62('0x31')][_0x1b62('0x6c')];if(typeof _0x7ee929===_0x1b62('0x23')){throw new db[(_0x1b62('0x6d'))][(_0x1b62('0x6e'))](_0x1b62('0x6f'));}var _0x440da5=_0x122791[_0x1b62('0x31')][_0x1b62('0x70')]||![];var _0xce0357=getQueryModels(_0x7ee929,_0x440da5);if(typeof _0xce0357[_0x1b62('0x71')]===_0x1b62('0x23')){throw new db['Sequelize'][(_0x1b62('0x6e'))](_0x1b62('0x72')+_0x7ee929+'\x27');}var _0x172274=[];if(!_[_0x1b62('0x5f')](_0xce0357[_0x1b62('0x73')])){_0x172274=_0xce0357[_0x1b62('0x73')];}else{_0x172274=[{'name':_0x7ee929}];}return db[_0x1b62('0x41')][_0x1b62('0x63')]({'where':{'id':_0x122791['params']['id']}})['then'](handleEntityNotFound(_0x522b8c,null))[_0x1b62('0x29')](function(_0x2319c8){if(_0x2319c8){var _0x537915=[];for(var _0xcd4f0e=0x0;_0xcd4f0e<_0x172274[_0x1b62('0x4b')];_0xcd4f0e++){_0x537915[_0x1b62('0x62')](db[_0x1b62('0x52')]['findOne']({'where':{'userProfileId':_0x2319c8['id'],'name':_0x172274[_0xcd4f0e][_0x1b62('0x2c')]},'raw':!![]}));}return BPromise['all'](_0x537915);}})[_0x1b62('0x29')](function(_0x36a8c0){var _0x152ed4=_[_0x1b62('0x3a')](_0x36a8c0,function(_0x5f0e1b){return _0x5f0e1b?_0x5f0e1b:undefined;});var _0x53e2b5=_[_0x1b62('0x3a')](_0x172274,[_0x1b62('0x74'),!![]]);var _0x5d0e90=_[_0x1b62('0x5f')](_0x152ed4)&&_[_0x1b62('0x5f')](_0x53e2b5)?null:_['union'](_0x53e2b5,_0x152ed4);if(_0x5d0e90){var _0x42e30d=[];for(var _0x4f5071=0x0;_0x4f5071<_0x5d0e90['length'];_0x4f5071++){var _0x137b65=_[_0x1b62('0x47')](_0x172274,function(_0x4a4820){return _0x5d0e90[_0x4f5071]?_0x4a4820[_0x1b62('0x2c')]===_0x5d0e90[_0x4f5071][_0x1b62('0x2c')]:null;});if(_0x137b65){if(_0x5d0e90[_0x4f5071]['ignore']){_0x42e30d[_0x1b62('0x62')](getAllResources(_0xce0357[_0x1b62('0x71')],_0x5d0e90[_0x4f5071]));}else{if(!_0x5d0e90[_0x4f5071][_0x1b62('0x53')]){_0x42e30d[_0x1b62('0x62')](getAllowedResources(_0x137b65,_0x5d0e90[_0x4f5071],_0xce0357[_0x1b62('0x71')]));}else{if(_0x137b65['model']){_0x42e30d['push'](getAllFilteredResources(_0x137b65,_0x5d0e90[_0x4f5071]));}}}}}return BPromise[_0x1b62('0x75')](_0x42e30d);}else{return null;}})[_0x1b62('0x29')](function(_0x209af9){var _0x5b3239=_0x209af9;var _0x533290=null;if(_0x5b3239){_0x533290=_0x5b3239[_0x1b62('0x4b')]===0x1?_0x5b3239[0x0]:null;}if(_0x533290||_0x5b3239){var _0x1d300c=db[_0xce0357[_0x1b62('0x71')]]['rawAttributes'];_0x8d9674[_0x1b62('0x30')]=_['keys'](_0x1d300c);_0x8d9674[_0x1b62('0x31')]=_[_0x1b62('0x32')](_0x122791[_0x1b62('0x31')]);_0x8d9674[_0x1b62('0x33')]=_[_0x1b62('0x34')](_0x8d9674[_0x1b62('0x30')],_0x8d9674['query']);_0x518110['attributes']=_['intersection'](_0x8d9674[_0x1b62('0x30')],qs[_0x1b62('0x36')](_0x122791[_0x1b62('0x31')][_0x1b62('0x36')]));_0x518110['attributes']=_0x518110[_0x1b62('0x35')][_0x1b62('0x4b')]?_0x518110[_0x1b62('0x35')]:_0x8d9674[_0x1b62('0x30')];if(!_0x122791[_0x1b62('0x31')][_0x1b62('0x76')]('nolimit')){_0x518110['limit']=qs[_0x1b62('0x22')](_0x122791[_0x1b62('0x31')][_0x1b62('0x22')]);_0x518110[_0x1b62('0x21')]=qs[_0x1b62('0x21')](_0x122791['query'][_0x1b62('0x21')]);}_0x518110[_0x1b62('0x77')]=qs[_0x1b62('0x38')](_0x122791[_0x1b62('0x31')]['sort']);_0x518110[_0x1b62('0x3e')]=qs[_0x1b62('0x33')](_[_0x1b62('0x39')](_0x122791[_0x1b62('0x31')],_0x8d9674[_0x1b62('0x33')]));if(_0x122791[_0x1b62('0x31')][_0x1b62('0x3a')]){_0x518110['where']=_['merge'](_0x518110['where'],{'$or':_['map'](_0x1d300c,function(_0x30efbd){if(_0x30efbd[_0x1b62('0x2f')][_0x1b62('0x78')]!==_0x1b62('0x3c')){var _0x495137={};_0x495137[_0x30efbd[_0x1b62('0x79')]]={'$like':'%'+_0x122791['query'][_0x1b62('0x3a')]+'%'};return _0x495137;}})});}var _0x237784=[];if(_0x533290){var _0x2ac558=_[_0x1b62('0x47')](_0x172274,[_0x1b62('0x2c'),_0x533290[_0x1b62('0x2c')]]);if(_0x2ac558[_0x1b62('0x79')]){var _0x1ebdb7={};if(_0xce0357[_0x1b62('0x71')]==='AnalyticExtractedReport'){_0x1ebdb7[_0x2ac558[_0x1b62('0x7a')]]=_[_0x1b62('0x2e')](_0x533290[_0x1b62('0x7b')],'id');}else{_0x1ebdb7[_0x2ac558[_0x1b62('0x7a')]]=_0x533290[_0x1b62('0x7b')];}_0x237784[_0x1b62('0x62')](_0x1ebdb7);}else{_0x518110[_0x1b62('0x3e')]['id']=_0x533290[_0x1b62('0x7b')];}}else{for(var _0x4509c5=0x0;_0x4509c5<_0x5b3239[_0x1b62('0x4b')];_0x4509c5++){var _0x2ac558=_['find'](_0x172274,[_0x1b62('0x2c'),_0x5b3239[_0x4509c5]['name']]);if(_0x2ac558[_0x1b62('0x79')]){var _0x1ebdb7={};_0x1ebdb7[_0x2ac558[_0x1b62('0x7a')]]=_0x5b3239[_0x4509c5][_0x1b62('0x7b')];_0x237784[_0x1b62('0x62')](_0x1ebdb7);}else{if(!_0x518110[_0x1b62('0x3e')]['id'])_0x518110['where']['id']=[];_0x5b3239[_0x4509c5][_0x1b62('0x7b')][_0x1b62('0x65')](function(_0x583793){_0x518110[_0x1b62('0x3e')]['id']['push'](_0x583793);});}}}if(!_[_0x1b62('0x5f')](_0x237784)){_0x518110[_0x1b62('0x3e')]=_[_0x1b62('0x3b')](_0x518110['where'],{'$and':{'$or':_0x237784}});}_0x518110=_[_0x1b62('0x3b')]({},_0x518110,_0x122791[_0x1b62('0x3d')]);if(_0x533290&&!_0x533290[_0x1b62('0x53')]&&_0xce0357[_0x1b62('0x71')]===_0x1b62('0x7c')){if(_0x122791[_0x1b62('0x31')][_0x1b62('0x3f')]){_0x518110['include']=[{'all':!![]}];}return db[_0xce0357[_0x1b62('0x71')]]['findAll'](_0x518110)[_0x1b62('0x29')](function(_0x11c291){var _0x3a14cd=[];_0x11c291['forEach'](function(_0x14ef42){var _0xae2c0;switch(_0x14ef42[_0x1b62('0x7d')]){case _0x1b62('0x7e'):_0xae2c0=_['find'](_0x533290[_0x1b62('0x7b')],function(_0x362a2d){return _0x362a2d['id']===_0x14ef42[_0x1b62('0x7f')]&&_0x362a2d['type']===_0x1b62('0x80');});break;case _0x1b62('0x81'):_0xae2c0=_[_0x1b62('0x47')](_0x533290['associatedResources'],function(_0x4d54b3){return _0x4d54b3['id']===_0x14ef42[_0x1b62('0x7f')]&&_0x4d54b3[_0x1b62('0x2f')]===_0x1b62('0x82');});break;}if(_0xae2c0)_0x3a14cd['push'](_0x14ef42);});_0x559b82[_0x1b62('0x24')]=_0x3a14cd[_0x1b62('0x4b')];_0x559b82[_0x1b62('0x43')]=_0x3a14cd;return _0x559b82;});}else{return db[_0xce0357['childModel']][_0x1b62('0x24')]({'where':_0x518110[_0x1b62('0x3e')]})['then'](function(_0x326c6b){_0x559b82[_0x1b62('0x24')]=_0x326c6b;if(_0x122791['query'][_0x1b62('0x3f')]){if(_0xce0357[_0x1b62('0x71')]===_0x1b62('0x83')){_0x518110[_0x1b62('0x40')]=[{'model':db[_0x1b62('0x84')],'as':_0x1b62('0x85'),'attributes':['id',_0x1b62('0x2c'),_0x1b62('0x86')],'required':_0x122791['query'][_0x1b62('0x87')]?!![]:![]},{'model':db[_0x1b62('0x84')],'as':_0x1b62('0x88'),'attributes':['id',_0x1b62('0x2c'),_0x1b62('0x86')],'through':_0x122791[_0x1b62('0x31')]['tag']?{'attributes':[],'where':{'TagId':_0x122791[_0x1b62('0x31')][_0x1b62('0x87')]||undefined}}:{},'required':_0x122791['query']['tag']?!![]:![]}];}else{_0x518110[_0x1b62('0x40')]=[{'all':!![]}];}}return db[_0xce0357[_0x1b62('0x71')]]['findAll'](_0x518110);})[_0x1b62('0x29')](function(_0x4f03a9){_0x559b82[_0x1b62('0x43')]=_0x4f03a9;if(_0x7ee929==='Agents'&&_0x122791[_0x1b62('0x31')][_0x1b62('0x89')]===_0x1b62('0x8a')){var _0x19ebe5=[];for(var _0x1e6048=0x0;_0x1e6048<_0x559b82[_0x1b62('0x43')][_0x1b62('0x4b')];_0x1e6048++){_0x19ebe5[_0x1b62('0x62')](getOpenTabs(_0x1b62('0x8b'),_0x559b82[_0x1b62('0x43')][_0x1e6048][_0x1b62('0x8c')]));_0x19ebe5[_0x1b62('0x62')](getOpenTabs('sms',_0x559b82[_0x1b62('0x43')][_0x1e6048][_0x1b62('0x8c')]));_0x19ebe5[_0x1b62('0x62')](getOpenTabs(_0x1b62('0x8d'),_0x559b82['rows'][_0x1e6048][_0x1b62('0x8c')]));_0x19ebe5[_0x1b62('0x62')](getOpenTabs(_0x1b62('0x8e'),_0x559b82[_0x1b62('0x43')][_0x1e6048][_0x1b62('0x8c')]));_0x19ebe5[_0x1b62('0x62')](getOpenTabs(_0x1b62('0x8f'),_0x559b82[_0x1b62('0x43')][_0x1e6048][_0x1b62('0x8c')]));_0x19ebe5['push'](getOpenTabs('whatsapp',_0x559b82[_0x1b62('0x43')][_0x1e6048][_0x1b62('0x8c')]));}return Promise['all'](_0x19ebe5)[_0x1b62('0x29')](function(){return _0x559b82;});}return _0x559b82;});}}else{return _0x559b82;}})[_0x1b62('0x29')](respondWithFilteredResult(_0x522b8c,_0x518110))[_0x1b62('0x48')](handleError(_0x522b8c,null));};function getOpenTabs(_0x2496f9,_0xd41a67){var _0x3bae47=_0x2496f9[_0x1b62('0x90')](0x0)[_0x1b62('0x91')]()+_0x2496f9[_0x1b62('0x92')](0x1);var _0x2313f6={'type':db[_0x1b62('0x6d')][_0x1b62('0x93')]['SELECT'],'raw':!![]};return new BPromise(function(_0xff3c85,_0x381757){var _0x5120c8=squel[_0x1b62('0x94')]()[_0x1b62('0x79')](_0x1b62('0x95')+_0x3bae47+'InteractionId','id')[_0x1b62('0x79')](_0x1b62('0x96'))['from'](_0x1b62('0x97')+_0x2496f9+_0x1b62('0x98'),'ui')[_0x1b62('0x3e')]('ui.UserId\x20=\x20?',_0xd41a67['id']);return db[_0x1b62('0x50')][_0x1b62('0x31')](_0x5120c8[_0x1b62('0x99')](),_0x2313f6)[_0x1b62('0x29')](function(_0x58d2e8){_0xd41a67[_0x3bae47+_0x1b62('0x9a')]=_0x58d2e8;_0xff3c85(_0x58d2e8);})[_0x1b62('0x48')](function(_0x5baed0){_0x381757(_0x5baed0);});});}function getAllResources(_0x160257,_0x1f8c57){return new BPromise(function(_0x11dbad,_0x2030f0){if(_0x1f8c57){var _0x4b20a9=_0x1f8c57[_0x1b62('0x3a')]?{[_0x1f8c57['filter']['field']]:_0x1f8c57[_0x1b62('0x3a')]['value']}:undefined;return db[_0x160257]['findAll']({'where':_0x4b20a9,'raw':!![]})['then'](function(_0x28799b){_0x1f8c57['associatedResources']=_[_0x1b62('0x2e')](_0x28799b,'id');_0x11dbad(_0x1f8c57);})['catch'](function(_0x4752c9){_0x2030f0(_0x4752c9);});}else{_0x11dbad(null);}});}function getAllFilteredResources(_0x3f944e,_0x9392ef){return new BPromise(function(_0x5dac21,_0x47a86f){var _0x36f063=_0x3f944e[_0x1b62('0x3a')]?{[_0x3f944e['filter'][_0x1b62('0x79')]]:_0x3f944e['filter'][_0x1b62('0x9b')]}:undefined;return db[_0x3f944e['model']]['findAll']({'where':_0x36f063,'raw':!![]})[_0x1b62('0x29')](function(_0x4fabcd){_0x9392ef[_0x1b62('0x7b')]=_[_0x1b62('0x2e')](_0x4fabcd,function(_0x33bdbd){return _0x3f944e[_0x1b62('0x79')]?_0x33bdbd[_0x3f944e[_0x1b62('0x79')]]:_0x33bdbd[_0x1b62('0x2c')];});_0x5dac21(_0x9392ef);})[_0x1b62('0x48')](function(_0x13e219){_0x47a86f(_0x13e219);});});}function getAllowedResources(_0x491954,_0xa4f8b4,_0x4a356c){return new BPromise(function(_0x2b6751,_0xddc850){if(_0xa4f8b4){return db['UserProfileResource']['findAll']({'where':{'sectionId':_0xa4f8b4['id']},'raw':!![]})[_0x1b62('0x29')](function(_0x4130b7){if(_0x491954['field']&&_0x491954[_0x1b62('0x79')]!=='id'){_0xa4f8b4[_0x1b62('0x7b')]=_['map'](_0x4130b7,function(_0x458951){return _0x458951[_0x491954[_0x1b62('0x79')]];});}else{if(_0x4a356c===_0x1b62('0x7c')){_0xa4f8b4[_0x1b62('0x7b')]=_[_0x1b62('0x2e')](_0x4130b7,function(_0x23d476){return{'id':_0x23d476[_0x1b62('0x66')],'type':_0x23d476[_0x1b62('0x2f')]};});}else{_0xa4f8b4[_0x1b62('0x7b')]=_[_0x1b62('0x2e')](_0x4130b7,function(_0x2fc03e){return _0x2fc03e['resourceId'];});}}_0x2b6751(_0xa4f8b4);})['catch'](function(_0x5a9696){_0xddc850(_0x5a9696);});}else{_0x2b6751(null);}});}function getQueryModels(_0x1ef2e3,_0x3538e9){var _0x58243f=_0x1ef2e3['toLowerCase']();var _0x423b58={'childModel':undefined,'parentSections':[]};switch(_0x58243f){case _0x1b62('0x9c'):_0x423b58[_0x1b62('0x71')]=_0x1b62('0x9d');break;case'odbc':_0x423b58[_0x1b62('0x71')]=_0x1b62('0x9e');break;case _0x1b62('0x9f'):_0x423b58[_0x1b62('0x71')]=_0x1b62('0xa0');_0x423b58[_0x1b62('0x73')]=[{'name':_0x1b62('0xa1'),'field':_0x1b62('0x2c'),'foreignKey':_0x1b62('0xa2')}];break;case _0x1b62('0xa3'):_0x423b58[_0x1b62('0x71')]=_0x1b62('0xa4');break;case _0x1b62('0xa5'):_0x423b58['childModel']=_0x1b62('0x83');_0x423b58[_0x1b62('0x73')]=[{'name':_0x1b62('0xa6'),'field':'id','foreignKey':_0x1b62('0xa7')}];break;case _0x1b62('0xa8'):_0x423b58['childModel']=_0x1b62('0xa9');break;case _0x1b62('0xaa'):_0x423b58[_0x1b62('0x71')]=_0x1b62('0xab');break;case _0x1b62('0xac'):_0x423b58[_0x1b62('0x71')]=_0x1b62('0xad');break;case _0x1b62('0xae'):_0x423b58[_0x1b62('0x71')]=_0x1b62('0xaf');break;case _0x1b62('0xb0'):_0x423b58['childModel']=_0x1b62('0xb1');break;case _0x1b62('0xb2'):_0x423b58['childModel']=_0x1b62('0xb3');break;case _0x1b62('0xb4'):_0x423b58[_0x1b62('0x71')]=_0x1b62('0xb5');break;case _0x1b62('0xb6'):case _0x1b62('0xb7'):case _0x1b62('0xb8'):_0x423b58[_0x1b62('0x71')]=_0x1b62('0xb9');break;case _0x1b62('0xba'):_0x423b58['childModel']=_0x1b62('0xbb');break;case _0x1b62('0xbc'):_0x423b58[_0x1b62('0x71')]=_0x1b62('0xbd');break;case'voicerecordings':_0x423b58[_0x1b62('0x71')]='VoiceRecording';_0x423b58[_0x1b62('0x73')]=[{'name':_0x1b62('0xbe'),'field':_0x1b62('0x2c'),'foreignKey':_0x1b62('0xbf'),'model':_0x1b62('0xc0'),'filter':{'field':'role','value':[_0x1b62('0xc1')]}},{'name':_0x1b62('0xc2'),'field':'name','foreignKey':_0x1b62('0xbf'),'model':_0x1b62('0xc0'),'filter':{'field':_0x1b62('0xc3'),'value':[_0x1b62('0xc4')]}},{'name':'VoiceQueues','field':_0x1b62('0x2c'),'foreignKey':'queue','model':_0x1b62('0xc5'),'filter':{'field':_0x1b62('0x2f'),'value':['inbound']}},{'name':_0x1b62('0xc6'),'field':_0x1b62('0x2c'),'foreignKey':'queue','model':_0x1b62('0xc5'),'filter':{'field':_0x1b62('0x2f'),'value':[_0x1b62('0xc7')]}}];break;case'musiconholds':_0x423b58['childModel']=_0x1b62('0xc8');break;case _0x1b62('0xc9'):_0x423b58[_0x1b62('0x71')]=_0x1b62('0xca');break;case _0x1b62('0xcb'):_0x423b58[_0x1b62('0x71')]=_0x1b62('0xcc');break;case _0x1b62('0xcd'):_0x423b58[_0x1b62('0x71')]=_0x1b62('0xce');break;case _0x1b62('0xcf'):_0x423b58[_0x1b62('0x71')]=_0x1b62('0xd0');break;case _0x1b62('0xd1'):_0x423b58[_0x1b62('0x71')]=_0x1b62('0xd2');break;case _0x1b62('0xd3'):_0x423b58[_0x1b62('0x71')]=_0x1b62('0xd4');break;case _0x1b62('0xd5'):_0x423b58[_0x1b62('0x71')]='OpenchannelQueue';break;case'openchannelaccounts':_0x423b58[_0x1b62('0x71')]=_0x1b62('0xd6');break;case _0x1b62('0xd7'):_0x423b58[_0x1b62('0x71')]=_0x1b62('0xd8');break;case _0x1b62('0xd9'):_0x423b58[_0x1b62('0x71')]='SmsAccount';break;case'whatsappqueues':_0x423b58[_0x1b62('0x71')]=_0x1b62('0xda');break;case _0x1b62('0xdb'):_0x423b58[_0x1b62('0x71')]=_0x1b62('0xdc');break;case'voicequeues':case _0x1b62('0xdd'):_0x423b58[_0x1b62('0x71')]=_0x1b62('0xc5');if(_0x3538e9){_0x423b58['parentSections']=[{'name':_0x1b62('0xde')},{'name':_0x1b62('0xc6')}];}break;case'users':case _0x1b62('0xdf'):case _0x1b62('0xe0'):_0x423b58[_0x1b62('0x71')]=_0x1b62('0xc0');if(_0x3538e9){_0x423b58[_0x1b62('0x73')]=[{'name':_0x1b62('0xe1'),'filter':{'field':_0x1b62('0xc3'),'value':[_0x1b62('0xe2'),_0x1b62('0xe3')]},'ignore':!![]},{'name':_0x1b62('0xbe')},{'name':_0x1b62('0xc2')}];}break;case _0x1b62('0xe4'):_0x423b58[_0x1b62('0x71')]=_0x1b62('0xe5');break;case _0x1b62('0xe6'):_0x423b58[_0x1b62('0x71')]=_0x1b62('0xe7');break;case _0x1b62('0xe8'):_0x423b58[_0x1b62('0x71')]='FreshdeskAccount';break;case _0x1b62('0xe9'):_0x423b58[_0x1b62('0x71')]='SugarcrmAccount';break;case _0x1b62('0xea'):_0x423b58[_0x1b62('0x71')]=_0x1b62('0xeb');break;case _0x1b62('0xec'):_0x423b58[_0x1b62('0x71')]=_0x1b62('0xed');break;case _0x1b62('0xee'):_0x423b58[_0x1b62('0x71')]='User';break;case _0x1b62('0xef'):_0x423b58[_0x1b62('0x71')]='CannedAnswer';break;case _0x1b62('0xf0'):_0x423b58[_0x1b62('0x71')]=_0x1b62('0xf1');break;case _0x1b62('0xf2'):_0x423b58['childModel']=_0x1b62('0x64');break;case _0x1b62('0xf3'):_0x423b58[_0x1b62('0x71')]=_0x1b62('0xf4');break;case'pauses':_0x423b58[_0x1b62('0x71')]=_0x1b62('0xf5');break;case _0x1b62('0xf6'):_0x423b58[_0x1b62('0x71')]=_0x1b62('0xf7');break;case'sounds':_0x423b58['childModel']=_0x1b62('0xf8');break;case _0x1b62('0xf9'):_0x423b58[_0x1b62('0x71')]=_0x1b62('0x84');break;case _0x1b62('0xfa'):_0x423b58[_0x1b62('0x71')]='Template';break;case _0x1b62('0xfb'):_0x423b58[_0x1b62('0x71')]=_0x1b62('0xfc');break;case _0x1b62('0xfd'):_0x423b58[_0x1b62('0x71')]=_0x1b62('0xfe');break;case'variables':_0x423b58[_0x1b62('0x71')]=_0x1b62('0xff');break;case'plugins':_0x423b58[_0x1b62('0x71')]=_0x1b62('0x67');break;case _0x1b62('0x100'):_0x423b58[_0x1b62('0x71')]=_0x1b62('0x7c');_0x423b58['parentSections']=[{'name':'Reports','field':'id','foreignKey':_0x1b62('0x7f')}];break;case _0x1b62('0x101'):_0x423b58[_0x1b62('0x71')]=_0x1b62('0x102');break;case _0x1b62('0x103'):_0x423b58[_0x1b62('0x71')]='WhatsappAccount';break;case _0x1b62('0x104'):_0x423b58['childModel']=_0x1b62('0x105');_0x423b58['parentSections']=[{'name':'Agents','field':'id','foreignKey':'UserId','model':_0x1b62('0xc0'),'filter':{'field':'role','value':['agent']}},{'name':'Telephones','field':'id','foreignKey':'UserId','model':_0x1b62('0xc0'),'filter':{'field':_0x1b62('0xc3'),'value':[_0x1b62('0xc4')]}}];break;default:return _0x423b58;}return _0x423b58;} \ No newline at end of file +var _0x9bc0=['OpenTabs','value','squareprojects','SquareProject','odbc','SquareOdbc','SquareRecording','SquareProjects','projectName','projects','JscriptyProject','contacts','Lists','ListId','lists','CmList','CmCompany','globalcustomfields','CmCustomField','ChatWebsite','faxqueues','FaxQueue','FaxAccount','inboundroutes','internalroutes','outboundroutes','VoiceExtension','contexts','voicemails','voicerecordings','VoiceRecording','Agents','membername','User','role','agent','Telephones','telephone','VoiceQueues','queue','VoiceQueue','QueueCampaigns','musiconholds','chanspies','VoiceChanSpy','voiceprefixes','VoicePrefix','ivrcampaigns','Campaign','mailqueues','MailQueue','mailaccounts','MailAccount','mailsubstatuses','MailSubstatus','openchannelqueues','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','smsqueues','SmsQueue','smsaccounts','SmsAccount','whatsappqueues','WhatsappQueue','teams','Team','queuecampaigns','users','telephones','Users','user','zendeskaccounts','ZendeskAccount','SalesforceAccount','deskaccounts','DeskAccount','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','dispositions','Disposition','customdashboards','intervals','Interval','pauses','Pause','scheduler','Schedule','sounds','Sound','tags','templates','Template','triggers','Trigger','trunks','Trunk','variables','plugins','extractedreports','Reports','metrics','whatsappaccounts','screenrecordings','ScreenRecording','UserId','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','defaults','redis','socket.io-emitter','./userProfile.socket','register','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','save','then','destroy','end','stack','name','send','map','UserProfile','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','findAll','rows','catch','show','params','find','create','body','clone','includeAll','include','get','omit','createdAt','updatedAt','crudPermissions','sequelize','transaction','UserProfileSection','each','autoAssociation','UserProfileResource','sectionId','userProfileId','update','describe','addSections','Resources','push','removeSections','enabled','isEmpty','includes','subsections','findOne','Dashboard','forEach','resourceId','Plugin','bulkCreate','removeResources','ids','getResources','section','Sequelize','ValidationError','Unknown\x20section','mergeResources','childModel','parentSections','all','ignore','union','hasOwnProperty','key','field','AnalyticExtractedReport','foreignKey','associatedResources','reportType','default','reportId','custom','CmContact','Tag','color','tag','ThroughTags','openTabs','true','chat','dataValues','fax','openchannel','whatsapp','slice','QueryTypes','SELECT','select','InteractionId','ui.createdAt','from','user_has_','ui.UserId\x20=\x20?','toString'];(function(_0xa1c0c7,_0x397f64){var _0x183d74=function(_0x2c1341){while(--_0x2c1341){_0xa1c0c7['push'](_0xa1c0c7['shift']());}};_0x183d74(++_0x397f64);}(_0x9bc0,0x172));var _0x09bc=function(_0x52bc3a,_0x6c3f15){_0x52bc3a=_0x52bc3a-0x0;var _0x2f4731=_0x9bc0[_0x52bc3a];return _0x2f4731;};'use strict';var emlformat=require(_0x09bc('0x0'));var rimraf=require(_0x09bc('0x1'));var zipdir=require(_0x09bc('0x2'));var jsonpatch=require(_0x09bc('0x3'));var rp=require(_0x09bc('0x4'));var moment=require('moment');var BPromise=require(_0x09bc('0x5'));var Mustache=require(_0x09bc('0x6'));var util=require(_0x09bc('0x7'));var path=require(_0x09bc('0x8'));var sox=require(_0x09bc('0x9'));var csv=require(_0x09bc('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x09bc('0xb'));var _=require(_0x09bc('0xc'));var squel=require(_0x09bc('0xd'));var crypto=require('crypto');var jsforce=require(_0x09bc('0xe'));var deskjs=require(_0x09bc('0xf'));var toCsv=require('to-csv');var querystring=require(_0x09bc('0x10'));var Papa=require('papaparse');var Redis=require(_0x09bc('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x09bc('0x12'));var as=require(_0x09bc('0x13'));var hardwareService=require(_0x09bc('0x14'));var logger=require(_0x09bc('0x15'))(_0x09bc('0x16'));var utils=require(_0x09bc('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x09bc('0x18'))['db'];config['redis']=_[_0x09bc('0x19')](config[_0x09bc('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0x09bc('0x1b'))(new Redis(config[_0x09bc('0x1a')]));require(_0x09bc('0x1c'))[_0x09bc('0x1d')](socket);function respondWithStatusCode(_0x16b934,_0x15c2fd){_0x15c2fd=_0x15c2fd||0xcc;return function(_0xda3079){if(_0xda3079){return _0x16b934[_0x09bc('0x1e')](_0x15c2fd);}return _0x16b934[_0x09bc('0x1f')](_0x15c2fd)['end']();};}function respondWithResult(_0x9c7d23,_0x4ecea8){_0x4ecea8=_0x4ecea8||0xc8;return function(_0x57d8c3){if(_0x57d8c3){return _0x9c7d23[_0x09bc('0x1f')](_0x4ecea8)[_0x09bc('0x20')](_0x57d8c3);}};}function respondWithFilteredResult(_0x1ac718,_0x4e41d2){return function(_0x493a18){if(_0x493a18){var _0x2b57ea=typeof _0x4e41d2[_0x09bc('0x21')]===_0x09bc('0x22')&&typeof _0x4e41d2[_0x09bc('0x23')]===_0x09bc('0x22');var _0xf9d17b=_0x493a18[_0x09bc('0x24')];var _0x532e49=_0x2b57ea?0x0:_0x4e41d2[_0x09bc('0x21')];var _0x2eef16=_0x2b57ea?_0x493a18[_0x09bc('0x24')]:_0x4e41d2['offset']+_0x4e41d2[_0x09bc('0x23')];var _0x423c5b;if(_0x2eef16>=_0xf9d17b){_0x2eef16=_0xf9d17b;_0x423c5b=0xc8;}else{_0x423c5b=0xce;}_0x1ac718[_0x09bc('0x1f')](_0x423c5b);return _0x1ac718[_0x09bc('0x25')]('Content-Range',_0x532e49+'-'+_0x2eef16+'/'+_0xf9d17b)[_0x09bc('0x20')](_0x493a18);}return null;};}function patchUpdates(_0x3ba238){return function(_0x234c3a){try{jsonpatch[_0x09bc('0x26')](_0x234c3a,_0x3ba238,!![]);}catch(_0x22442a){return BPromise[_0x09bc('0x27')](_0x22442a);}return _0x234c3a[_0x09bc('0x28')]();};}function saveUpdates(_0x33f993,_0x161b0c){return function(_0x196454){if(_0x196454){return _0x196454['update'](_0x33f993)[_0x09bc('0x29')](function(_0x59888c){return _0x59888c;});}return null;};}function removeEntity(_0x244395,_0x460d29){return function(_0x2ab8b5){if(_0x2ab8b5){return _0x2ab8b5[_0x09bc('0x2a')]()['then'](function(){_0x244395[_0x09bc('0x1f')](0xcc)[_0x09bc('0x2b')]();});}};}function handleEntityNotFound(_0x3a8067,_0xf5dd8b){return function(_0x9ab798){if(!_0x9ab798){_0x3a8067['sendStatus'](0x194);}return _0x9ab798;};}function handleError(_0x1b4bc3,_0x50ea5b){_0x50ea5b=_0x50ea5b||0x1f4;return function(_0x5d2d37){logger['error'](_0x5d2d37[_0x09bc('0x2c')]);if(_0x5d2d37['name']){delete _0x5d2d37[_0x09bc('0x2d')];}_0x1b4bc3[_0x09bc('0x1f')](_0x50ea5b)[_0x09bc('0x2e')](_0x5d2d37);};}exports['index']=function(_0x344a5b,_0x39fc04){var _0x2b68d6={},_0x578902={},_0x2f9b53={'count':0x0,'rows':[]};var _0x47a79c=_[_0x09bc('0x2f')](db[_0x09bc('0x30')][_0x09bc('0x31')],function(_0x3e8342){return{'name':_0x3e8342[_0x09bc('0x32')],'type':_0x3e8342[_0x09bc('0x33')]['key']};});_0x578902[_0x09bc('0x34')]=_[_0x09bc('0x2f')](_0x47a79c,_0x09bc('0x2d'));_0x578902['query']=_[_0x09bc('0x35')](_0x344a5b[_0x09bc('0x36')]);_0x578902[_0x09bc('0x37')]=_[_0x09bc('0x38')](_0x578902['model'],_0x578902[_0x09bc('0x36')]);_0x2b68d6[_0x09bc('0x39')]=_[_0x09bc('0x38')](_0x578902['model'],qs[_0x09bc('0x3a')](_0x344a5b['query'][_0x09bc('0x3a')]));_0x2b68d6[_0x09bc('0x39')]=_0x2b68d6[_0x09bc('0x39')][_0x09bc('0x3b')]?_0x2b68d6[_0x09bc('0x39')]:_0x578902[_0x09bc('0x34')];if(!_0x344a5b[_0x09bc('0x36')]['hasOwnProperty'](_0x09bc('0x3c'))){_0x2b68d6[_0x09bc('0x23')]=qs[_0x09bc('0x23')](_0x344a5b['query']['limit']);_0x2b68d6[_0x09bc('0x21')]=qs[_0x09bc('0x21')](_0x344a5b[_0x09bc('0x36')][_0x09bc('0x21')]);}_0x2b68d6[_0x09bc('0x3d')]=qs[_0x09bc('0x3e')](_0x344a5b[_0x09bc('0x36')][_0x09bc('0x3e')]);_0x2b68d6[_0x09bc('0x3f')]=qs[_0x09bc('0x37')](_[_0x09bc('0x40')](_0x344a5b['query'],_0x578902['filters']),_0x47a79c);if(_0x344a5b[_0x09bc('0x36')][_0x09bc('0x41')]){_0x2b68d6[_0x09bc('0x3f')]=_['merge'](_0x2b68d6[_0x09bc('0x3f')],{'$or':_[_0x09bc('0x2f')](_0x47a79c,function(_0x5b620f){if(_0x5b620f['type']!==_0x09bc('0x42')){var _0x293812={};_0x293812[_0x5b620f[_0x09bc('0x2d')]]={'$like':'%'+_0x344a5b[_0x09bc('0x36')][_0x09bc('0x41')]+'%'};return _0x293812;}})});}_0x2b68d6=_[_0x09bc('0x43')]({},_0x2b68d6,_0x344a5b[_0x09bc('0x44')]);var _0x2841e1={'where':_0x2b68d6[_0x09bc('0x3f')]};return db[_0x09bc('0x30')][_0x09bc('0x24')](_0x2841e1)['then'](function(_0x38ce29){_0x2f9b53['count']=_0x38ce29;if(_0x344a5b['query']['includeAll']){_0x2b68d6['include']=[{'all':!![]}];}return db[_0x09bc('0x30')][_0x09bc('0x45')](_0x2b68d6);})['then'](function(_0x4d4766){_0x2f9b53[_0x09bc('0x46')]=_0x4d4766;return _0x2f9b53;})[_0x09bc('0x29')](respondWithFilteredResult(_0x39fc04,_0x2b68d6))[_0x09bc('0x47')](handleError(_0x39fc04,null));};exports[_0x09bc('0x48')]=function(_0x57d633,_0x349d38){var _0x58207a={'raw':![],'where':{'id':_0x57d633[_0x09bc('0x49')]['id']}},_0x5d1eb9={};_0x5d1eb9['model']=_[_0x09bc('0x35')](db['UserProfile'][_0x09bc('0x31')]);_0x5d1eb9[_0x09bc('0x36')]=_[_0x09bc('0x35')](_0x57d633['query']);_0x5d1eb9['filters']=_[_0x09bc('0x38')](_0x5d1eb9[_0x09bc('0x34')],_0x5d1eb9[_0x09bc('0x36')]);_0x58207a[_0x09bc('0x39')]=_[_0x09bc('0x38')](_0x5d1eb9[_0x09bc('0x34')],qs[_0x09bc('0x3a')](_0x57d633['query'][_0x09bc('0x3a')]));_0x58207a[_0x09bc('0x39')]=_0x58207a[_0x09bc('0x39')][_0x09bc('0x3b')]?_0x58207a[_0x09bc('0x39')]:_0x5d1eb9[_0x09bc('0x34')];if(_0x57d633[_0x09bc('0x36')]['includeAll']){_0x58207a['include']=[{'all':!![]}];}_0x58207a=_['merge']({},_0x58207a,_0x57d633['options']);return db[_0x09bc('0x30')][_0x09bc('0x4a')](_0x58207a)[_0x09bc('0x29')](handleEntityNotFound(_0x349d38,null))[_0x09bc('0x29')](respondWithResult(_0x349d38,null))[_0x09bc('0x47')](handleError(_0x349d38,null));};exports[_0x09bc('0x4b')]=function(_0x365bb3,_0x531181){return db['UserProfile'][_0x09bc('0x4b')](_0x365bb3[_0x09bc('0x4c')],{})[_0x09bc('0x29')](respondWithResult(_0x531181,0xc9))[_0x09bc('0x47')](handleError(_0x531181,null));};exports[_0x09bc('0x4d')]=function(_0x201134,_0x501115){var _0x4bc830={'where':{'id':_0x201134['params']['id']}},_0x22bd6c={};_0x22bd6c[_0x09bc('0x34')]=_['keys'](db['UserProfile'][_0x09bc('0x31')]);_0x4bc830[_0x09bc('0x39')]=_[_0x09bc('0x38')](_0x22bd6c['model'],qs['fields'](_0x201134['query'][_0x09bc('0x3a')]));_0x4bc830[_0x09bc('0x39')]=_0x4bc830[_0x09bc('0x39')]['length']?_0x4bc830[_0x09bc('0x39')]:_0x22bd6c[_0x09bc('0x34')];if(_0x201134[_0x09bc('0x36')][_0x09bc('0x4e')]){_0x4bc830[_0x09bc('0x4f')]=[{'all':!![]}];}_0x4bc830=_[_0x09bc('0x43')]({},_0x4bc830,_0x201134[_0x09bc('0x44')]);return db[_0x09bc('0x30')][_0x09bc('0x4a')](_0x4bc830)[_0x09bc('0x29')](handleEntityNotFound(_0x501115,null))[_0x09bc('0x29')](function(_0x5f2a58){if(_0x5f2a58){var _0x39095e=_0x5f2a58[_0x09bc('0x50')]({'plain':!![]});_0x39095e=qs[_0x09bc('0x51')](_0x39095e,['id',_0x09bc('0x52'),_0x09bc('0x53'),_0x09bc('0x54')]);_0x201134[_0x09bc('0x4c')]=_['omit'](_0x201134['body'],['id',_0x09bc('0x52'),'updatedAt']);return db[_0x09bc('0x55')][_0x09bc('0x56')](function(_0x1ba2cc){return db['UserProfile'][_0x09bc('0x4b')](_['merge'](_0x39095e,_0x201134['body']),{'include':_0x201134[_0x09bc('0x36')]['includeAll']?[{'all':!![]}]:undefined,'transaction':_0x1ba2cc})['then'](function(_0xf0ec3b){var _0x4b3186=_0xf0ec3b[_0x09bc('0x50')]({'plain':!![]});return db[_0x09bc('0x57')][_0x09bc('0x45')]({'where':{'userProfileId':_0x201134['params']['id']},'raw':!![]})[_0x09bc('0x29')](function(_0xd02759){if(_0xd02759){return BPromise[_0x09bc('0x58')](_0xd02759,function(_0x592dc4){return new BPromise(function(_0x19d8b2,_0x12d1be){if(_0x592dc4[_0x09bc('0x59')]===null||_0x592dc4[_0x09bc('0x59')]===0x1)_0x19d8b2(null);return db[_0x09bc('0x5a')][_0x09bc('0x45')]({'where':{'sectionId':_0x592dc4['id']},'raw':!![]})['then'](function(_0x455539){var _0x570718=_[_0x09bc('0x2f')](_0x455539,function(_0x410d68){return qs['omit'](_0x410d68,['id',_0x09bc('0x52'),'updatedAt',_0x09bc('0x5b')]);});_0x19d8b2(_0x570718);})[_0x09bc('0x47')](function(_0xa84c07){_0x12d1be(_0xa84c07);});})[_0x09bc('0x29')](function(_0x52bab9){var _0xd3ed38=qs['omit'](_0x592dc4,['id',_0x09bc('0x52'),'updatedAt']);_0xd3ed38[_0x09bc('0x5c')]=_0x4b3186['id'];if(_0x52bab9)_0xd3ed38['Resources']=_0x52bab9;return _0xd3ed38;})[_0x09bc('0x29')](function(_0x2b5f93){return db[_0x09bc('0x57')]['create'](_0x2b5f93,{'include':[{'model':db['UserProfileResource'],'as':'Resources'}],'raw':!![],'transaction':_0x1ba2cc});});})[_0x09bc('0x29')](function(){return _0x4b3186;});}});});});}})[_0x09bc('0x29')](respondWithResult(_0x501115,0xc9))['catch'](handleError(_0x501115,null));};exports[_0x09bc('0x5d')]=function(_0x38e164,_0x426ccf){if(_0x38e164['body']['id']){delete _0x38e164[_0x09bc('0x4c')]['id'];}return db['UserProfile'][_0x09bc('0x4a')]({'where':{'id':_0x38e164[_0x09bc('0x49')]['id']}})[_0x09bc('0x29')](handleEntityNotFound(_0x426ccf,null))[_0x09bc('0x29')](saveUpdates(_0x38e164['body'],null))[_0x09bc('0x29')](respondWithResult(_0x426ccf,null))[_0x09bc('0x47')](handleError(_0x426ccf,null));};exports[_0x09bc('0x2a')]=function(_0x5dae96,_0x518a49){return db['UserProfile'][_0x09bc('0x4a')]({'where':{'id':_0x5dae96[_0x09bc('0x49')]['id']}})[_0x09bc('0x29')](handleEntityNotFound(_0x518a49,null))[_0x09bc('0x29')](removeEntity(_0x518a49,null))[_0x09bc('0x47')](handleError(_0x518a49,null));};exports[_0x09bc('0x5e')]=function(_0x41828e,_0x1a4ed7){return db[_0x09bc('0x30')][_0x09bc('0x5e')]()['then'](respondWithResult(_0x1a4ed7,null))[_0x09bc('0x47')](handleError(_0x1a4ed7,null));};exports[_0x09bc('0x5f')]=function(_0x24d638,_0x1a4f36){var _0x1f11c8=_0x24d638[_0x09bc('0x4c')];return db[_0x09bc('0x30')][_0x09bc('0x4a')]({'where':{'id':_0x24d638['params']['id']}})['then'](handleEntityNotFound(_0x1a4f36,null))[_0x09bc('0x29')](function(_0x61b32a){if(_0x61b32a){return db[_0x09bc('0x55')][_0x09bc('0x56')](function(_0x5e19ff){return db['UserProfileSection'][_0x09bc('0x2a')]({'where':{'userProfileId':_0x24d638[_0x09bc('0x49')]['id'],'sectionId':_[_0x09bc('0x2f')](_0x1f11c8,function(_0x45d2ab){return _0x45d2ab[_0x09bc('0x5b')];})},'transaction':_0x5e19ff})['then'](function(){var _0x384ccc=_[_0x09bc('0x2f')](_0x1f11c8,function(_0x5e64b3){_0x5e64b3['userProfileId']=_0x24d638[_0x09bc('0x49')]['id'];return _0x5e64b3;});var _0x82e256=[];return BPromise[_0x09bc('0x58')](_0x384ccc,function(_0xafeb74){return db['UserProfileSection'][_0x09bc('0x4b')](_0xafeb74,{'include':[{'model':db[_0x09bc('0x5a')],'as':_0x09bc('0x60')}],'raw':!![],'transaction':_0x5e19ff})[_0x09bc('0x29')](function(_0x5dffcc){_0x82e256[_0x09bc('0x61')](_0x5dffcc[_0x09bc('0x50')]({'plain':!![]}));});})['then'](function(){return _0x82e256;});});});}})[_0x09bc('0x29')](function(_0xde80b3){return _0xde80b3;})['then'](respondWithResult(_0x1a4f36,null))[_0x09bc('0x47')](handleError(_0x1a4f36,null));};exports[_0x09bc('0x62')]=function(_0x43575a,_0x4bcd64){var _0x198934;return db[_0x09bc('0x30')][_0x09bc('0x4a')]({'where':{'id':_0x43575a['params']['id']},'attributes':['id',_0x09bc('0x2d')]})[_0x09bc('0x29')](handleEntityNotFound(_0x4bcd64,null))['then'](function(_0x165ef0){if(_0x165ef0){_0x198934=_0x165ef0;return db[_0x09bc('0x57')][_0x09bc('0x2a')]({'where':{'userProfileId':_0x43575a[_0x09bc('0x49')]['id'],'sectionId':_0x43575a[_0x09bc('0x36')]['ids']}});}})[_0x09bc('0x29')](function(){return _0x198934;})['then'](respondWithStatusCode(_0x4bcd64,null))[_0x09bc('0x47')](handleError(_0x4bcd64,null));};exports['getSections']=function(_0x4c8ff4,_0x1ec417){var _0x21a14a=[];var _0x941e26=[];return db['UserProfileSection'][_0x09bc('0x45')]({'where':{'userProfileId':_0x4c8ff4[_0x09bc('0x49')]['id']},'raw':!![]})[_0x09bc('0x29')](function(_0x299d22){_0x21a14a=_[_0x09bc('0x41')](_0x299d22,function(_0xd81a2e){return _0xd81a2e[_0x09bc('0x63')]===0x1||_['includes']([0x3eb,0x709],_0xd81a2e[_0x09bc('0x5b')]);});if(!_[_0x09bc('0x64')](_0x21a14a)){return _[_0x09bc('0x2f')](_0x21a14a,function(_0x2aa9b4){return _0x2aa9b4[_0x09bc('0x5b')];});}else{return;}})[_0x09bc('0x29')](function(_0x114d0c){if(_0x114d0c)_0x941e26=_0x114d0c;if(_[_0x09bc('0x65')](_0x941e26,0x64)){var _0x4d43b3=_[_0x09bc('0x4a')](_0x21a14a,{'sectionId':0x64});return hasDefaultDashboard(_0x4d43b3)[_0x09bc('0x29')](function(_0x3240a6){return _['map'](_0x21a14a,function(_0x5450e0){if(_0x5450e0['sectionId']===0x64){_0x5450e0[_0x09bc('0x66')]=_0x3240a6;}return _0x5450e0;});});}else{return;}})[_0x09bc('0x29')](function(_0x16d855){if(_0x16d855)_0x21a14a=_0x16d855;if(_[_0x09bc('0x65')](_0x941e26,0x3eb)){var _0x4e95e5=_[_0x09bc('0x4a')](_0x21a14a,{'sectionId':0x3eb});return getCustomDashboards(_0x4e95e5)['then'](function(_0x1f025b){return _[_0x09bc('0x2f')](_0x21a14a,function(_0x513bc9){if(_0x4e95e5['enabled']){if(_0x513bc9['sectionId']===0x3eb){_0x513bc9[_0x09bc('0x66')]=_0x1f025b;}}else{if(_0x513bc9[_0x09bc('0x5b')]===0x64){_0x513bc9[_0x09bc('0x66')]=_0x1f025b;}}return _0x513bc9;});});}else{return;}})[_0x09bc('0x29')](function(_0x2034bf){if(_0x2034bf)_0x21a14a=_0x2034bf;if(_['includes'](_0x941e26,0x709)){var _0x1ca74b=_[_0x09bc('0x4a')](_0x21a14a,{'sectionId':0x709});return getPlugins(_0x1ca74b)[_0x09bc('0x29')](function(_0x3bf836){if(_0x1ca74b[_0x09bc('0x63')]){return _[_0x09bc('0x2f')](_0x21a14a,function(_0x5eebe3){if(_0x5eebe3[_0x09bc('0x5b')]===0x709){_0x5eebe3[_0x09bc('0x66')]=_0x3bf836;}return _0x5eebe3;});}else{var _0x59db98={'sectionId':0x76c,'enabled':0x1,'subsections':_0x3bf836};var _0x1d78a6=_['map'](_0x21a14a);_0x1d78a6[_0x09bc('0x61')](_0x59db98);return _0x1d78a6;}});}else{return;}})[_0x09bc('0x29')](function(_0x8ec4b2){if(_0x8ec4b2)_0x21a14a=_0x8ec4b2;return _[_0x09bc('0x41')](_0x21a14a,[_0x09bc('0x63'),0x1]);})['then'](respondWithResult(_0x1ec417,null))[_0x09bc('0x47')](handleError(_0x1ec417,null));};function hasDefaultDashboard(_0x1a08f0){var _0x1bed5f=[0x65];return new BPromise(function(_0x19ff18,_0x16b2ef){try{if(_0x1a08f0[_0x09bc('0x59')]){_0x19ff18(_0x1bed5f);}else{return db[_0x09bc('0x5a')][_0x09bc('0x67')]({'where':{'sectionId':_0x1a08f0['id']},'raw':!![]})['then'](function(_0x52140f){_0x52140f?_0x19ff18(_0x1bed5f):_0x19ff18();});}}catch(_0x2f7a2b){_0x16b2ef(_0x2f7a2b);}});}function getCustomDashboards(_0x9b4b2){var _0x590b05=[];return new BPromise(function(_0x2cd63a,_0x3fd4e7){try{if(_0x9b4b2[_0x09bc('0x59')]){return db[_0x09bc('0x68')]['findAll']({'raw':!![]})[_0x09bc('0x29')](function(_0x3dbf5a){_0x3dbf5a['forEach'](function(_0x738b26){_0x590b05[_0x09bc('0x61')](_0x738b26['id']+0x1869f);});_0x2cd63a(_0x590b05);});}else{return db[_0x09bc('0x5a')][_0x09bc('0x45')]({'where':{'sectionId':_0x9b4b2['id']},'raw':!![]})[_0x09bc('0x29')](function(_0x20b7b4){_0x20b7b4[_0x09bc('0x69')](function(_0x480563){_0x590b05[_0x09bc('0x61')](_0x480563[_0x09bc('0x6a')]+0x1869f);});_0x2cd63a(_0x590b05);});}}catch(_0xf33b4d){_0x3fd4e7(_0xf33b4d);}});}function getPlugins(_0x4f5eef){var _0xb61d70=[];return new BPromise(function(_0x3a4ca2,_0x1e9c3c){try{if(_0x4f5eef[_0x09bc('0x59')]){return db[_0x09bc('0x6b')][_0x09bc('0x45')]({'raw':!![]})[_0x09bc('0x29')](function(_0x4a8be4){_0x4a8be4['forEach'](function(_0x648612){_0xb61d70[_0x09bc('0x61')](_0x648612['id']+0x15b38);});_0x3a4ca2(_0xb61d70);});}else{return db['UserProfileResource']['findAll']({'where':{'sectionId':_0x4f5eef['id']},'raw':!![]})[_0x09bc('0x29')](function(_0x639c9b){_0x639c9b[_0x09bc('0x69')](function(_0x5d8fd2){_0xb61d70[_0x09bc('0x61')](_0x5d8fd2[_0x09bc('0x6a')]+0x15b38);});_0x3a4ca2(_0xb61d70);});}}catch(_0x598b90){_0x1e9c3c(_0x598b90);}});}exports['addResources']=function(_0x22c114,_0x4bf9a0){return db[_0x09bc('0x30')][_0x09bc('0x4a')]({'where':{'id':_0x22c114[_0x09bc('0x49')]['id']}})[_0x09bc('0x29')](handleEntityNotFound(_0x4bf9a0,null))[_0x09bc('0x29')](function(_0x3409ad){if(_0x3409ad){return db[_0x09bc('0x55')][_0x09bc('0x56')](function(_0x24c522){return db['UserProfileSection']['findAll']({'where':{'userProfileId':_0x22c114[_0x09bc('0x49')]['id']},'attributes':['id'],'raw':!![]})[_0x09bc('0x29')](function(_0x517be2){if(_0x517be2){return db[_0x09bc('0x57')]['destroy']({'where':{'userProfileId':_0x22c114[_0x09bc('0x49')]['id'],'id':_[_0x09bc('0x2f')](_0x517be2,function(_0x1b6979){return _0x1b6979['id'];})},'transaction':_0x24c522});}})[_0x09bc('0x29')](function(_0x18c1e9){var _0x550070=_[_0x09bc('0x2f')](_0x22c114['body'],function(_0x571477){_0x571477[_0x09bc('0x5c')]=_0x22c114[_0x09bc('0x49')]['id'];return _0x571477;});return db['UserProfileSection'][_0x09bc('0x6c')](_0x550070,{'raw':!![],'transaction':_0x24c522});})[_0x09bc('0x29')](function(_0xd454b5){var _0xd42802=_[_0x09bc('0x41')](_['map'](_0xd454b5,function(_0x3c3e8d){return _0x3c3e8d[_0x09bc('0x50')]({'plain':!![]});}),{'includeAll':![]});if(_0xd42802){return db[_0x09bc('0x57')][_0x09bc('0x45')]({'where':{'userProfileId':_0x22c114[_0x09bc('0x49')]['id'],'sectionId':_[_0x09bc('0x2f')](_0xd42802,function(_0x3ae96f){return _0x3ae96f[_0x09bc('0x5b')];})},'attributes':['id',_0x09bc('0x5b')],'raw':!![]})[_0x09bc('0x29')](function(_0x364bd0){var _0x2b0388=_[_0x09bc('0x2f')](_0x22c114[_0x09bc('0x4c')],function(_0x3b796b){_0x3b796b['userProfileId']=_0x22c114['params']['id'];return _0x3b796b;});return db[_0x09bc('0x5a')][_0x09bc('0x6c')](_0x2b0388,{'raw':!![],'transaction':_0x24c522});});}})[_0x09bc('0x47')](handleError(_0x4bf9a0,null));});}})[_0x09bc('0x29')](function(_0x16800f){var _0x4e0ff7=_[_0x09bc('0x2f')](_0x16800f,function(_0x4f302d){return _0x4f302d['get']({'plain':!![]});});})[_0x09bc('0x29')](respondWithResult(_0x4bf9a0,null))[_0x09bc('0x47')](handleError(_0x4bf9a0,null));};exports['removeResources']=function(_0x5172e4,_0x2e99bb,_0x545419){return db[_0x09bc('0x30')][_0x09bc('0x4a')]({'where':{'id':_0x5172e4[_0x09bc('0x49')]['id']}})['then'](handleEntityNotFound(_0x2e99bb,null))[_0x09bc('0x29')](function(_0x50ddc1){if(_0x50ddc1){return _0x50ddc1[_0x09bc('0x6d')](_0x5172e4[_0x09bc('0x36')][_0x09bc('0x6e')]);}})['then'](respondWithStatusCode(_0x2e99bb,null))[_0x09bc('0x47')](handleError(_0x2e99bb,null));};exports[_0x09bc('0x6f')]=function(_0x19e507,_0x2d52bc){var _0x4f70d2={'raw':![],'where':{}};var _0x4a0235={};var _0xe44c8e={'count':0x0,'rows':[]};var _0x548fb0=_0x19e507['query'][_0x09bc('0x70')];if(typeof _0x548fb0===_0x09bc('0x22')){throw new db[(_0x09bc('0x71'))][(_0x09bc('0x72'))](_0x09bc('0x73'));}var _0x141473=_0x19e507[_0x09bc('0x36')][_0x09bc('0x74')]||![];var _0x4dae95=getQueryModels(_0x548fb0,_0x141473);if(typeof _0x4dae95[_0x09bc('0x75')]==='undefined'){throw new db['Sequelize'][(_0x09bc('0x72'))]('Invalid\x20section\x20\x27'+_0x548fb0+'\x27');}var _0xe1f508=[];if(!_['isEmpty'](_0x4dae95['parentSections'])){_0xe1f508=_0x4dae95[_0x09bc('0x76')];}else{_0xe1f508=[{'name':_0x548fb0}];}return db[_0x09bc('0x30')][_0x09bc('0x67')]({'where':{'id':_0x19e507[_0x09bc('0x49')]['id']}})[_0x09bc('0x29')](handleEntityNotFound(_0x2d52bc,null))['then'](function(_0x34fdad){if(_0x34fdad){var _0x3b9aa3=[];for(var _0x1abefa=0x0;_0x1abefa<_0xe1f508[_0x09bc('0x3b')];_0x1abefa++){_0x3b9aa3[_0x09bc('0x61')](db[_0x09bc('0x57')][_0x09bc('0x67')]({'where':{'userProfileId':_0x34fdad['id'],'name':_0xe1f508[_0x1abefa][_0x09bc('0x2d')]},'raw':!![]}));}return BPromise[_0x09bc('0x77')](_0x3b9aa3);}})['then'](function(_0x25bf1d){var _0x134567=_[_0x09bc('0x41')](_0x25bf1d,function(_0x2756e8){return _0x2756e8?_0x2756e8:undefined;});var _0x378025=_['filter'](_0xe1f508,[_0x09bc('0x78'),!![]]);var _0x17e0b8=_[_0x09bc('0x64')](_0x134567)&&_[_0x09bc('0x64')](_0x378025)?null:_[_0x09bc('0x79')](_0x378025,_0x134567);if(_0x17e0b8){var _0x13a6df=[];for(var _0xad4f6=0x0;_0xad4f6<_0x17e0b8[_0x09bc('0x3b')];_0xad4f6++){var _0x185dd1=_[_0x09bc('0x4a')](_0xe1f508,function(_0x3493ce){return _0x17e0b8[_0xad4f6]?_0x3493ce[_0x09bc('0x2d')]===_0x17e0b8[_0xad4f6][_0x09bc('0x2d')]:null;});if(_0x185dd1){if(_0x17e0b8[_0xad4f6]['ignore']){_0x13a6df[_0x09bc('0x61')](getAllResources(_0x4dae95[_0x09bc('0x75')],_0x17e0b8[_0xad4f6]));}else{if(!_0x17e0b8[_0xad4f6][_0x09bc('0x59')]){_0x13a6df[_0x09bc('0x61')](getAllowedResources(_0x185dd1,_0x17e0b8[_0xad4f6],_0x4dae95[_0x09bc('0x75')]));}else{if(_0x185dd1[_0x09bc('0x34')]){_0x13a6df[_0x09bc('0x61')](getAllFilteredResources(_0x185dd1,_0x17e0b8[_0xad4f6]));}}}}}return BPromise[_0x09bc('0x77')](_0x13a6df);}else{return null;}})['then'](function(_0x1fb21a){var _0x350de0=_0x1fb21a;var _0x1cb075=null;if(_0x350de0){_0x1cb075=_0x350de0[_0x09bc('0x3b')]===0x1?_0x350de0[0x0]:null;}if(_0x1cb075||_0x350de0){var _0x5a8f17=db[_0x4dae95[_0x09bc('0x75')]][_0x09bc('0x31')];_0x4a0235['model']=_[_0x09bc('0x35')](_0x5a8f17);_0x4a0235[_0x09bc('0x36')]=_[_0x09bc('0x35')](_0x19e507[_0x09bc('0x36')]);_0x4a0235[_0x09bc('0x37')]=_['intersection'](_0x4a0235['model'],_0x4a0235[_0x09bc('0x36')]);_0x4f70d2[_0x09bc('0x39')]=_[_0x09bc('0x38')](_0x4a0235[_0x09bc('0x34')],qs[_0x09bc('0x3a')](_0x19e507[_0x09bc('0x36')][_0x09bc('0x3a')]));_0x4f70d2[_0x09bc('0x39')]=_0x4f70d2[_0x09bc('0x39')][_0x09bc('0x3b')]?_0x4f70d2[_0x09bc('0x39')]:_0x4a0235[_0x09bc('0x34')];if(!_0x19e507[_0x09bc('0x36')][_0x09bc('0x7a')](_0x09bc('0x3c'))){_0x4f70d2['limit']=qs[_0x09bc('0x23')](_0x19e507[_0x09bc('0x36')]['limit']);_0x4f70d2[_0x09bc('0x21')]=qs[_0x09bc('0x21')](_0x19e507[_0x09bc('0x36')][_0x09bc('0x21')]);}_0x4f70d2[_0x09bc('0x3d')]=qs[_0x09bc('0x3e')](_0x19e507['query'][_0x09bc('0x3e')]);_0x4f70d2[_0x09bc('0x3f')]=qs[_0x09bc('0x37')](_[_0x09bc('0x40')](_0x19e507[_0x09bc('0x36')],_0x4a0235[_0x09bc('0x37')]));if(_0x19e507[_0x09bc('0x36')][_0x09bc('0x41')]){_0x4f70d2[_0x09bc('0x3f')]=_[_0x09bc('0x43')](_0x4f70d2['where'],{'$or':_[_0x09bc('0x2f')](_0x5a8f17,function(_0x42e687){if(_0x42e687[_0x09bc('0x33')][_0x09bc('0x7b')]!==_0x09bc('0x42')){var _0x52c76e={};_0x52c76e[_0x42e687[_0x09bc('0x7c')]]={'$like':'%'+_0x19e507['query']['filter']+'%'};return _0x52c76e;}})});}var _0x68ea3=[];if(_0x1cb075){var _0xd2b2a6=_[_0x09bc('0x4a')](_0xe1f508,[_0x09bc('0x2d'),_0x1cb075[_0x09bc('0x2d')]]);if(_0xd2b2a6[_0x09bc('0x7c')]){var _0x537182={};if(_0x4dae95[_0x09bc('0x75')]===_0x09bc('0x7d')){_0x537182[_0xd2b2a6[_0x09bc('0x7e')]]=_[_0x09bc('0x2f')](_0x1cb075[_0x09bc('0x7f')],'id');}else{_0x537182[_0xd2b2a6['foreignKey']]=_0x1cb075[_0x09bc('0x7f')];}_0x68ea3[_0x09bc('0x61')](_0x537182);}else{_0x4f70d2['where']['id']=_0x1cb075['associatedResources'];}}else{for(var _0x3a6675=0x0;_0x3a6675<_0x350de0[_0x09bc('0x3b')];_0x3a6675++){var _0xd2b2a6=_[_0x09bc('0x4a')](_0xe1f508,['name',_0x350de0[_0x3a6675][_0x09bc('0x2d')]]);if(_0xd2b2a6['field']){var _0x537182={};_0x537182[_0xd2b2a6['foreignKey']]=_0x350de0[_0x3a6675][_0x09bc('0x7f')];_0x68ea3['push'](_0x537182);}else{if(!_0x4f70d2[_0x09bc('0x3f')]['id'])_0x4f70d2['where']['id']=[];_0x350de0[_0x3a6675][_0x09bc('0x7f')][_0x09bc('0x69')](function(_0x1df438){_0x4f70d2[_0x09bc('0x3f')]['id'][_0x09bc('0x61')](_0x1df438);});}}}if(!_[_0x09bc('0x64')](_0x68ea3)){_0x4f70d2[_0x09bc('0x3f')]=_['merge'](_0x4f70d2[_0x09bc('0x3f')],{'$and':{'$or':_0x68ea3}});}_0x4f70d2=_['merge']({},_0x4f70d2,_0x19e507[_0x09bc('0x44')]);if(_0x1cb075&&!_0x1cb075[_0x09bc('0x59')]&&_0x4dae95[_0x09bc('0x75')]==='AnalyticExtractedReport'){if(_0x19e507[_0x09bc('0x36')][_0x09bc('0x4e')]){_0x4f70d2[_0x09bc('0x4f')]=[{'all':!![]}];}return db[_0x4dae95[_0x09bc('0x75')]][_0x09bc('0x45')](_0x4f70d2)[_0x09bc('0x29')](function(_0x42a3c7){var _0xa4859b=[];_0x42a3c7[_0x09bc('0x69')](function(_0x52cd84){var _0x3c6b80;switch(_0x52cd84[_0x09bc('0x80')]){case _0x09bc('0x81'):_0x3c6b80=_[_0x09bc('0x4a')](_0x1cb075[_0x09bc('0x7f')],function(_0x55f4df){return _0x55f4df['id']===_0x52cd84[_0x09bc('0x82')]&&_0x55f4df['type']==='DefaultReports';});break;case _0x09bc('0x83'):_0x3c6b80=_[_0x09bc('0x4a')](_0x1cb075[_0x09bc('0x7f')],function(_0x4d6714){return _0x4d6714['id']===_0x52cd84[_0x09bc('0x82')]&&_0x4d6714['type']==='CustomReports';});break;}if(_0x3c6b80)_0xa4859b[_0x09bc('0x61')](_0x52cd84);});_0xe44c8e[_0x09bc('0x24')]=_0xa4859b[_0x09bc('0x3b')];_0xe44c8e[_0x09bc('0x46')]=_0xa4859b;return _0xe44c8e;});}else{return db[_0x4dae95[_0x09bc('0x75')]]['count']({'where':_0x4f70d2['where']})['then'](function(_0x44d804){_0xe44c8e['count']=_0x44d804;if(_0x19e507['query']['includeAll']){if(_0x4dae95['childModel']===_0x09bc('0x84')){_0x4f70d2[_0x09bc('0x4f')]=[{'model':db[_0x09bc('0x85')],'as':'Tags','attributes':['id',_0x09bc('0x2d'),_0x09bc('0x86')],'required':_0x19e507[_0x09bc('0x36')][_0x09bc('0x87')]?!![]:![]},{'model':db[_0x09bc('0x85')],'as':_0x09bc('0x88'),'attributes':['id',_0x09bc('0x2d'),_0x09bc('0x86')],'through':_0x19e507['query'][_0x09bc('0x87')]?{'attributes':[],'where':{'TagId':_0x19e507[_0x09bc('0x36')]['tag']||undefined}}:{},'required':_0x19e507[_0x09bc('0x36')][_0x09bc('0x87')]?!![]:![]}];}else{_0x4f70d2[_0x09bc('0x4f')]=[{'all':!![]}];}}return db[_0x4dae95[_0x09bc('0x75')]]['findAll'](_0x4f70d2);})[_0x09bc('0x29')](function(_0x57b0d7){_0xe44c8e['rows']=_0x57b0d7;if(_0x548fb0==='Agents'&&_0x19e507[_0x09bc('0x36')][_0x09bc('0x89')]===_0x09bc('0x8a')){var _0x3968e8=[];for(var _0x185585=0x0;_0x185585<_0xe44c8e[_0x09bc('0x46')][_0x09bc('0x3b')];_0x185585++){_0x3968e8[_0x09bc('0x61')](getOpenTabs(_0x09bc('0x8b'),_0xe44c8e[_0x09bc('0x46')][_0x185585][_0x09bc('0x8c')]));_0x3968e8['push'](getOpenTabs('sms',_0xe44c8e['rows'][_0x185585]['dataValues']));_0x3968e8[_0x09bc('0x61')](getOpenTabs(_0x09bc('0x8d'),_0xe44c8e[_0x09bc('0x46')][_0x185585]['dataValues']));_0x3968e8[_0x09bc('0x61')](getOpenTabs('mail',_0xe44c8e[_0x09bc('0x46')][_0x185585][_0x09bc('0x8c')]));_0x3968e8[_0x09bc('0x61')](getOpenTabs(_0x09bc('0x8e'),_0xe44c8e[_0x09bc('0x46')][_0x185585][_0x09bc('0x8c')]));_0x3968e8[_0x09bc('0x61')](getOpenTabs(_0x09bc('0x8f'),_0xe44c8e[_0x09bc('0x46')][_0x185585][_0x09bc('0x8c')]));}return Promise[_0x09bc('0x77')](_0x3968e8)['then'](function(){return _0xe44c8e;});}return _0xe44c8e;});}}else{return _0xe44c8e;}})['then'](respondWithFilteredResult(_0x2d52bc,_0x4f70d2))[_0x09bc('0x47')](handleError(_0x2d52bc,null));};function getOpenTabs(_0x138a68,_0x18a5db){var _0x795955=_0x138a68['charAt'](0x0)['toUpperCase']()+_0x138a68[_0x09bc('0x90')](0x1);var _0x5e7d37={'type':db[_0x09bc('0x71')][_0x09bc('0x91')][_0x09bc('0x92')],'raw':!![]};return new BPromise(function(_0x338106,_0x10f377){var _0x2def9e=squel[_0x09bc('0x93')]()[_0x09bc('0x7c')]('ui.'+_0x795955+_0x09bc('0x94'),'id')[_0x09bc('0x7c')](_0x09bc('0x95'))[_0x09bc('0x96')](_0x09bc('0x97')+_0x138a68+'_interactions','ui')[_0x09bc('0x3f')](_0x09bc('0x98'),_0x18a5db['id']);return db[_0x09bc('0x55')][_0x09bc('0x36')](_0x2def9e[_0x09bc('0x99')](),_0x5e7d37)[_0x09bc('0x29')](function(_0x2c8a6e){_0x18a5db[_0x795955+_0x09bc('0x9a')]=_0x2c8a6e;_0x338106(_0x2c8a6e);})[_0x09bc('0x47')](function(_0x216ca7){_0x10f377(_0x216ca7);});});}function getAllResources(_0xf58bfb,_0x210586){return new BPromise(function(_0x329467,_0x4dca7b){if(_0x210586){var _0x47f149=_0x210586[_0x09bc('0x41')]?{[_0x210586[_0x09bc('0x41')]['field']]:_0x210586[_0x09bc('0x41')][_0x09bc('0x9b')]}:undefined;return db[_0xf58bfb][_0x09bc('0x45')]({'where':_0x47f149,'raw':!![]})[_0x09bc('0x29')](function(_0x170e73){_0x210586[_0x09bc('0x7f')]=_[_0x09bc('0x2f')](_0x170e73,'id');_0x329467(_0x210586);})[_0x09bc('0x47')](function(_0x32827c){_0x4dca7b(_0x32827c);});}else{_0x329467(null);}});}function getAllFilteredResources(_0x45b900,_0x467fd6){return new BPromise(function(_0x55353a,_0xe787f0){var _0x5bcf5d=_0x45b900[_0x09bc('0x41')]?{[_0x45b900['filter'][_0x09bc('0x7c')]]:_0x45b900[_0x09bc('0x41')][_0x09bc('0x9b')]}:undefined;return db[_0x45b900[_0x09bc('0x34')]]['findAll']({'where':_0x5bcf5d,'raw':!![]})[_0x09bc('0x29')](function(_0x469f23){_0x467fd6[_0x09bc('0x7f')]=_[_0x09bc('0x2f')](_0x469f23,function(_0x5ade9a){return _0x45b900['field']?_0x5ade9a[_0x45b900[_0x09bc('0x7c')]]:_0x5ade9a[_0x09bc('0x2d')];});_0x55353a(_0x467fd6);})[_0x09bc('0x47')](function(_0x12448e){_0xe787f0(_0x12448e);});});}function getAllowedResources(_0x5ba554,_0x2b7c37,_0x13d5c7){return new BPromise(function(_0x7baa44,_0x56ef7a){if(_0x2b7c37){return db[_0x09bc('0x5a')]['findAll']({'where':{'sectionId':_0x2b7c37['id']},'raw':!![]})[_0x09bc('0x29')](function(_0xdef109){if(_0x5ba554[_0x09bc('0x7c')]&&_0x5ba554['field']!=='id'){_0x2b7c37['associatedResources']=_[_0x09bc('0x2f')](_0xdef109,function(_0x4d217b){return _0x4d217b[_0x5ba554['field']];});}else{if(_0x13d5c7===_0x09bc('0x7d')){_0x2b7c37[_0x09bc('0x7f')]=_[_0x09bc('0x2f')](_0xdef109,function(_0x1ffe98){return{'id':_0x1ffe98[_0x09bc('0x6a')],'type':_0x1ffe98[_0x09bc('0x33')]};});}else{_0x2b7c37['associatedResources']=_[_0x09bc('0x2f')](_0xdef109,function(_0x14d279){return _0x14d279['resourceId'];});}}_0x7baa44(_0x2b7c37);})[_0x09bc('0x47')](function(_0x23a14d){_0x56ef7a(_0x23a14d);});}else{_0x7baa44(null);}});}function getQueryModels(_0x8d8c8,_0x47c46a){var _0xf4868d=_0x8d8c8['toLowerCase']();var _0x3367e2={'childModel':undefined,'parentSections':[]};switch(_0xf4868d){case _0x09bc('0x9c'):_0x3367e2['childModel']=_0x09bc('0x9d');break;case _0x09bc('0x9e'):_0x3367e2[_0x09bc('0x75')]=_0x09bc('0x9f');break;case'squarerecordings':_0x3367e2[_0x09bc('0x75')]=_0x09bc('0xa0');_0x3367e2['parentSections']=[{'name':_0x09bc('0xa1'),'field':_0x09bc('0x2d'),'foreignKey':_0x09bc('0xa2')}];break;case _0x09bc('0xa3'):_0x3367e2['childModel']=_0x09bc('0xa4');break;case _0x09bc('0xa5'):_0x3367e2[_0x09bc('0x75')]='CmContact';_0x3367e2[_0x09bc('0x76')]=[{'name':_0x09bc('0xa6'),'field':'id','foreignKey':_0x09bc('0xa7')}];break;case _0x09bc('0xa8'):_0x3367e2[_0x09bc('0x75')]=_0x09bc('0xa9');break;case'companies':_0x3367e2['childModel']=_0x09bc('0xaa');break;case _0x09bc('0xab'):_0x3367e2[_0x09bc('0x75')]=_0x09bc('0xac');break;case'chatqueues':_0x3367e2['childModel']='ChatQueue';break;case'chatwebsites':_0x3367e2[_0x09bc('0x75')]=_0x09bc('0xad');break;case _0x09bc('0xae'):_0x3367e2[_0x09bc('0x75')]=_0x09bc('0xaf');break;case'faxaccounts':_0x3367e2[_0x09bc('0x75')]=_0x09bc('0xb0');break;case _0x09bc('0xb1'):case _0x09bc('0xb2'):case _0x09bc('0xb3'):_0x3367e2[_0x09bc('0x75')]=_0x09bc('0xb4');break;case _0x09bc('0xb5'):_0x3367e2[_0x09bc('0x75')]='VoiceContext';break;case _0x09bc('0xb6'):_0x3367e2[_0x09bc('0x75')]='VoiceMail';break;case _0x09bc('0xb7'):_0x3367e2[_0x09bc('0x75')]=_0x09bc('0xb8');_0x3367e2['parentSections']=[{'name':_0x09bc('0xb9'),'field':_0x09bc('0x2d'),'foreignKey':_0x09bc('0xba'),'model':_0x09bc('0xbb'),'filter':{'field':_0x09bc('0xbc'),'value':[_0x09bc('0xbd')]}},{'name':_0x09bc('0xbe'),'field':_0x09bc('0x2d'),'foreignKey':_0x09bc('0xba'),'model':_0x09bc('0xbb'),'filter':{'field':'role','value':[_0x09bc('0xbf')]}},{'name':_0x09bc('0xc0'),'field':'name','foreignKey':_0x09bc('0xc1'),'model':_0x09bc('0xc2'),'filter':{'field':_0x09bc('0x33'),'value':['inbound']}},{'name':_0x09bc('0xc3'),'field':_0x09bc('0x2d'),'foreignKey':_0x09bc('0xc1'),'model':_0x09bc('0xc2'),'filter':{'field':_0x09bc('0x33'),'value':['outbound']}}];break;case _0x09bc('0xc4'):_0x3367e2[_0x09bc('0x75')]='VoiceMusicOnHold';break;case _0x09bc('0xc5'):_0x3367e2['childModel']=_0x09bc('0xc6');break;case _0x09bc('0xc7'):_0x3367e2[_0x09bc('0x75')]=_0x09bc('0xc8');break;case _0x09bc('0xc9'):_0x3367e2[_0x09bc('0x75')]=_0x09bc('0xca');break;case _0x09bc('0xcb'):_0x3367e2[_0x09bc('0x75')]=_0x09bc('0xcc');break;case _0x09bc('0xcd'):_0x3367e2['childModel']=_0x09bc('0xce');break;case _0x09bc('0xcf'):_0x3367e2[_0x09bc('0x75')]=_0x09bc('0xd0');break;case _0x09bc('0xd1'):_0x3367e2[_0x09bc('0x75')]=_0x09bc('0xd2');break;case _0x09bc('0xd3'):_0x3367e2[_0x09bc('0x75')]=_0x09bc('0xd4');break;case _0x09bc('0xd5'):_0x3367e2[_0x09bc('0x75')]=_0x09bc('0xd6');break;case _0x09bc('0xd7'):_0x3367e2['childModel']=_0x09bc('0xd8');break;case _0x09bc('0xd9'):_0x3367e2[_0x09bc('0x75')]=_0x09bc('0xda');break;case _0x09bc('0xdb'):_0x3367e2[_0x09bc('0x75')]=_0x09bc('0xdc');break;case'voicequeues':case _0x09bc('0xdd'):_0x3367e2[_0x09bc('0x75')]=_0x09bc('0xc2');if(_0x47c46a){_0x3367e2['parentSections']=[{'name':_0x09bc('0xc0')},{'name':_0x09bc('0xc3')}];}break;case _0x09bc('0xde'):case'agents':case _0x09bc('0xdf'):_0x3367e2[_0x09bc('0x75')]=_0x09bc('0xbb');if(_0x47c46a){_0x3367e2[_0x09bc('0x76')]=[{'name':_0x09bc('0xe0'),'filter':{'field':_0x09bc('0xbc'),'value':['admin',_0x09bc('0xe1')]},'ignore':!![]},{'name':_0x09bc('0xb9')},{'name':_0x09bc('0xbe')}];}break;case _0x09bc('0xe2'):_0x3367e2[_0x09bc('0x75')]=_0x09bc('0xe3');break;case'salesforceaccounts':_0x3367e2[_0x09bc('0x75')]=_0x09bc('0xe4');break;case'freshdeskaccounts':_0x3367e2[_0x09bc('0x75')]='FreshdeskAccount';break;case'sugarcrmaccounts':_0x3367e2[_0x09bc('0x75')]='SugarcrmAccount';break;case _0x09bc('0xe5'):_0x3367e2['childModel']=_0x09bc('0xe6');break;case'zohoaccounts':_0x3367e2[_0x09bc('0x75')]=_0x09bc('0xe7');break;case _0x09bc('0xe8'):_0x3367e2[_0x09bc('0x75')]=_0x09bc('0xbb');break;case _0x09bc('0xe9'):_0x3367e2[_0x09bc('0x75')]=_0x09bc('0xea');break;case _0x09bc('0xeb'):_0x3367e2['childModel']=_0x09bc('0xec');break;case _0x09bc('0xed'):_0x3367e2[_0x09bc('0x75')]=_0x09bc('0x68');break;case _0x09bc('0xee'):_0x3367e2[_0x09bc('0x75')]=_0x09bc('0xef');break;case _0x09bc('0xf0'):_0x3367e2[_0x09bc('0x75')]=_0x09bc('0xf1');break;case _0x09bc('0xf2'):_0x3367e2[_0x09bc('0x75')]=_0x09bc('0xf3');break;case _0x09bc('0xf4'):_0x3367e2[_0x09bc('0x75')]=_0x09bc('0xf5');break;case _0x09bc('0xf6'):_0x3367e2[_0x09bc('0x75')]=_0x09bc('0x85');break;case _0x09bc('0xf7'):_0x3367e2['childModel']=_0x09bc('0xf8');break;case _0x09bc('0xf9'):_0x3367e2[_0x09bc('0x75')]=_0x09bc('0xfa');break;case _0x09bc('0xfb'):_0x3367e2['childModel']=_0x09bc('0xfc');break;case _0x09bc('0xfd'):_0x3367e2[_0x09bc('0x75')]='Variable';break;case _0x09bc('0xfe'):_0x3367e2[_0x09bc('0x75')]=_0x09bc('0x6b');break;case _0x09bc('0xff'):_0x3367e2[_0x09bc('0x75')]='AnalyticExtractedReport';_0x3367e2[_0x09bc('0x76')]=[{'name':_0x09bc('0x100'),'field':'id','foreignKey':_0x09bc('0x82')}];break;case _0x09bc('0x101'):_0x3367e2[_0x09bc('0x75')]='AnalyticMetric';break;case _0x09bc('0x102'):_0x3367e2[_0x09bc('0x75')]='WhatsappAccount';break;case _0x09bc('0x103'):_0x3367e2['childModel']=_0x09bc('0x104');_0x3367e2[_0x09bc('0x76')]=[{'name':_0x09bc('0xb9'),'field':'id','foreignKey':_0x09bc('0x105'),'model':_0x09bc('0xbb'),'filter':{'field':'role','value':[_0x09bc('0xbd')]}},{'name':'Telephones','field':'id','foreignKey':_0x09bc('0x105'),'model':_0x09bc('0xbb'),'filter':{'field':'role','value':[_0x09bc('0xbf')]}}];break;default:return _0x3367e2;}return _0x3367e2;} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index f0467ea..7704409 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 _0x1228=['UserProfile','save','update','remove','emit','hook','exports','events'];(function(_0x1be0b6,_0x19f455){var _0x23aff7=function(_0x3af5ff){while(--_0x3af5ff){_0x1be0b6['push'](_0x1be0b6['shift']());}};_0x23aff7(++_0x19f455);}(_0x1228,0x12f));var _0x8122=function(_0xff2ad3,_0x1b1be3){_0xff2ad3=_0xff2ad3-0x0;var _0x2f20e1=_0x1228[_0xff2ad3];return _0x2f20e1;};'use strict';var EventEmitter=require(_0x8122('0x0'));var UserProfile=require('../../mysqldb')['db'][_0x8122('0x1')];var UserProfileEvents=new EventEmitter();UserProfileEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x8122('0x2'),'afterUpdate':_0x8122('0x3'),'afterDestroy':_0x8122('0x4')};function emitEvent(_0x49a540){return function(_0x762ce4,_0xf4d3e5,_0x4de3a0){UserProfileEvents[_0x8122('0x5')](_0x49a540+':'+_0x762ce4['id'],_0x762ce4);UserProfileEvents[_0x8122('0x5')](_0x49a540,_0x762ce4);_0x4de3a0(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserProfile[_0x8122('0x6')](e,emitEvent(event));}}module[_0x8122('0x7')]=UserProfileEvents; \ No newline at end of file +var _0x781d=['hasOwnProperty','exports','events','../../mysqldb','save','update','remove','emit'];(function(_0x5b8b97,_0x6b4dfa){var _0x1fdf84=function(_0x2ced4c){while(--_0x2ced4c){_0x5b8b97['push'](_0x5b8b97['shift']());}};_0x1fdf84(++_0x6b4dfa);}(_0x781d,0x14a));var _0xd781=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x781d[_0x2d7f0e];return _0x110b07;};'use strict';var EventEmitter=require(_0xd781('0x0'));var UserProfile=require(_0xd781('0x1'))['db']['UserProfile'];var UserProfileEvents=new EventEmitter();UserProfileEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xd781('0x2'),'afterUpdate':_0xd781('0x3'),'afterDestroy':_0xd781('0x4')};function emitEvent(_0x1a9f94){return function(_0xfd915d,_0x42258e,_0x446534){UserProfileEvents[_0xd781('0x5')](_0x1a9f94+':'+_0xfd915d['id'],_0xfd915d);UserProfileEvents[_0xd781('0x5')](_0x1a9f94,_0xfd915d);_0x446534(null);};}for(var e in events){if(events[_0xd781('0x6')](e)){var event=events[e];UserProfile['hook'](e,emitEvent(event));}}module[_0xd781('0x7')]=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index dac335d..9c2adde 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 _0xedd9=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./userProfile.attributes','exports','UserProfile','User','privacyEnabled','then'];(function(_0x291d3f,_0x3ef99f){var _0x242080=function(_0x257705){while(--_0x257705){_0x291d3f['push'](_0x291d3f['shift']());}};_0x242080(++_0x3ef99f);}(_0xedd9,0xfc));var _0x9edd=function(_0x2f59f1,_0xdfe0c6){_0x2f59f1=_0x2f59f1-0x0;var _0x2ee114=_0xedd9[_0x2f59f1];return _0x2ee114;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var logger=require(_0x9edd('0x1'))(_0x9edd('0x2'));var moment=require(_0x9edd('0x3'));var BPromise=require(_0x9edd('0x4'));var rp=require(_0x9edd('0x5'));var fs=require('fs');var path=require(_0x9edd('0x6'));var rimraf=require(_0x9edd('0x7'));var config=require('../../config/environment');var attributes=require(_0x9edd('0x8'));module[_0x9edd('0x9')]=function(_0x268f9e,_0x34c1a7){return _0x268f9e['define'](_0x9edd('0xa'),attributes,{'tableName':'user_profiles','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x172522,_0x190185,_0x1355be){var _0x3280fd=_0x268f9e['models'];_0x3280fd[_0x9edd('0xb')]['update']({'privacyEnabled':_0x172522[_0x9edd('0xc')]},{'where':{'UserProfileId':_0x172522['id']}})[_0x9edd('0xd')](function(){_0x1355be();})['catch'](function(_0xbf9da6){_0x1355be(_0xbf9da6);});}}});}; \ No newline at end of file +var _0x008c=['../../config/environment','./userProfile.attributes','exports','define','user_profiles','models','User','catch','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0xce93c,_0x555be5){var _0x230720=function(_0x6d5428){while(--_0x6d5428){_0xce93c['push'](_0xce93c['shift']());}};_0x230720(++_0x555be5);}(_0x008c,0x188));var _0xc008=function(_0x5e45fa,_0x24a7b4){_0x5e45fa=_0x5e45fa-0x0;var _0x244b80=_0x008c[_0x5e45fa];return _0x244b80;};'use strict';var _=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var logger=require(_0xc008('0x2'))(_0xc008('0x3'));var moment=require(_0xc008('0x4'));var BPromise=require('bluebird');var rp=require(_0xc008('0x5'));var fs=require('fs');var path=require(_0xc008('0x6'));var rimraf=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var attributes=require(_0xc008('0x9'));module[_0xc008('0xa')]=function(_0x13aa7,_0x39bb5e){return _0x13aa7[_0xc008('0xb')]('UserProfile',attributes,{'tableName':_0xc008('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x5aa09b,_0x30be38,_0x5b64f8){var _0x52041f=_0x13aa7[_0xc008('0xd')];_0x52041f[_0xc008('0xe')]['update']({'privacyEnabled':_0x5aa09b['privacyEnabled']},{'where':{'UserProfileId':_0x5aa09b['id']}})['then'](function(){_0x5b64f8();})[_0xc008('0xf')](function(_0xc881aa){_0x5b64f8(_0xc881aa);});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index 34b7ad7..409cfa4 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 _0x80c3=['lodash','bluebird','ioredis','../../mysqldb','../../config/utils','jayson/promise','redis','defaults','socket.io-emitter','register','then','info','UserProfile,\x20%s,\x20%s','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x24d93a,_0x1fcc0a){var _0x3fb705=function(_0x38a609){while(--_0x38a609){_0x24d93a['push'](_0x24d93a['shift']());}};_0x3fb705(++_0x1fcc0a);}(_0x80c3,0x18f));var _0x380c=function(_0x285c85,_0x132c21){_0x285c85=_0x285c85-0x0;var _0x2f81cd=_0x80c3[_0x285c85];return _0x2f81cd;};'use strict';var _=require(_0x380c('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x380c('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x380c('0x2'));var db=require(_0x380c('0x3'))['db'];var utils=require(_0x380c('0x4'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x380c('0x5'));var client=jayson['client']['http']({'port':0x232a});config[_0x380c('0x6')]=_[_0x380c('0x7')](config[_0x380c('0x6')],{'host':'localhost','port':0x18eb});var socket=require(_0x380c('0x8'))(new Redis(config[_0x380c('0x6')]));require('./userProfile.socket')[_0x380c('0x9')](socket);function respondWithRpcPromise(_0x1d5493,_0x50be52,_0x58886c){return new BPromise(function(_0x3a1ebb,_0x35f424){return client['request'](_0x1d5493,_0x58886c)[_0x380c('0xa')](function(_0x41fbf2){logger[_0x380c('0xb')](_0x380c('0xc'),_0x50be52,_0x380c('0xd'));logger[_0x380c('0xe')](_0x380c('0xf'),_0x50be52,_0x380c('0xd'),JSON[_0x380c('0x10')](_0x41fbf2));if(_0x41fbf2[_0x380c('0x11')]){if(_0x41fbf2['error'][_0x380c('0x12')]===0x1f4){logger[_0x380c('0x11')]('UserProfile,\x20%s,\x20%s',_0x50be52,_0x41fbf2[_0x380c('0x11')][_0x380c('0x13')]);return _0x35f424(_0x41fbf2[_0x380c('0x11')][_0x380c('0x13')]);}logger[_0x380c('0x11')](_0x380c('0xc'),_0x50be52,_0x41fbf2[_0x380c('0x11')][_0x380c('0x13')]);return _0x3a1ebb(_0x41fbf2[_0x380c('0x11')]['message']);}else{logger[_0x380c('0xb')]('UserProfile,\x20%s,\x20%s',_0x50be52,'request\x20sent');_0x3a1ebb(_0x41fbf2[_0x380c('0x14')]['message']);}})['catch'](function(_0x4901fe){logger['error'](_0x380c('0xc'),_0x50be52,_0x4901fe);_0x35f424(_0x4901fe);});});} \ No newline at end of file +var _0x33ac=['code','message','result','catch','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','redis','socket.io-emitter','./userProfile.socket','register','request','then','UserProfile,\x20%s,\x20%s','UserProfile,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x33ac,0x1f2));var _0xc33a=function(_0x4ad65c,_0x531b71){_0x4ad65c=_0x4ad65c-0x0;var _0x15240d=_0x33ac[_0x4ad65c];return _0x15240d;};'use strict';var _=require('lodash');var util=require(_0xc33a('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xc33a('0x1'));var fs=require('fs');var Redis=require(_0xc33a('0x2'));var db=require(_0xc33a('0x3'))['db'];var utils=require(_0xc33a('0x4'));var logger=require(_0xc33a('0x5'))(_0xc33a('0x6'));var config=require(_0xc33a('0x7'));var jayson=require(_0xc33a('0x8'));var client=jayson[_0xc33a('0x9')]['http']({'port':0x232a});config['redis']=_[_0xc33a('0xa')](config[_0xc33a('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xc33a('0xc'))(new Redis(config['redis']));require(_0xc33a('0xd'))[_0xc33a('0xe')](socket);function respondWithRpcPromise(_0x288e87,_0x6ec731,_0x1abc99){return new BPromise(function(_0x36ad93,_0x2a6228){return client[_0xc33a('0xf')](_0x288e87,_0x1abc99)[_0xc33a('0x10')](function(_0x4eef76){logger['info'](_0xc33a('0x11'),_0x6ec731,'request\x20sent');logger['debug'](_0xc33a('0x12'),_0x6ec731,_0xc33a('0x13'),JSON[_0xc33a('0x14')](_0x4eef76));if(_0x4eef76[_0xc33a('0x15')]){if(_0x4eef76[_0xc33a('0x15')][_0xc33a('0x16')]===0x1f4){logger['error'](_0xc33a('0x11'),_0x6ec731,_0x4eef76[_0xc33a('0x15')][_0xc33a('0x17')]);return _0x2a6228(_0x4eef76['error'][_0xc33a('0x17')]);}logger['error'](_0xc33a('0x11'),_0x6ec731,_0x4eef76[_0xc33a('0x15')][_0xc33a('0x17')]);return _0x36ad93(_0x4eef76[_0xc33a('0x15')][_0xc33a('0x17')]);}else{logger['info']('UserProfile,\x20%s,\x20%s',_0x6ec731,_0xc33a('0x13'));_0x36ad93(_0x4eef76[_0xc33a('0x18')][_0xc33a('0x17')]);}})[_0xc33a('0x19')](function(_0x2f6095){logger[_0xc33a('0x15')](_0xc33a('0x11'),_0x6ec731,_0x2f6095);_0x2a6228(_0x2f6095);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index 99c5bd2..d89d1bb 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 _0x378d=['length','userProfile:','./userProfile.events','save','remove','update'];(function(_0xeacbf2,_0x8491ca){var _0x57fb89=function(_0x22e831){while(--_0x22e831){_0xeacbf2['push'](_0xeacbf2['shift']());}};_0x57fb89(++_0x8491ca);}(_0x378d,0x194));var _0xd378=function(_0x7714df,_0xf9787d){_0x7714df=_0x7714df-0x0;var _0x1e21a5=_0x378d[_0x7714df];return _0x1e21a5;};'use strict';var UserProfileEvents=require(_0xd378('0x0'));var events=[_0xd378('0x1'),_0xd378('0x2'),_0xd378('0x3')];function createListener(_0x1ac4fb,_0x581a37){return function(_0x4e55b4){_0x581a37['emit'](_0x1ac4fb,_0x4e55b4);};}function removeListener(_0x4f3093,_0x2cd2e4){return function(){UserProfileEvents['removeListener'](_0x4f3093,_0x2cd2e4);};}exports['register']=function(_0x6feb90){for(var _0x75f0aa=0x0,_0x338759=events[_0xd378('0x4')];_0x75f0aa<_0x338759;_0x75f0aa++){var _0x47885c=events[_0x75f0aa];var _0x409ea8=createListener(_0xd378('0x5')+_0x47885c,_0x6feb90);UserProfileEvents['on'](_0x47885c,_0x409ea8);}}; \ No newline at end of file +var _0x0e42=['emit','removeListener','register','length','./userProfile.events','remove','update'];(function(_0x2539e6,_0x595d36){var _0xe83570=function(_0x2a8b2e){while(--_0x2a8b2e){_0x2539e6['push'](_0x2539e6['shift']());}};_0xe83570(++_0x595d36);}(_0x0e42,0x18c));var _0x20e4=function(_0x540d14,_0x1f8cae){_0x540d14=_0x540d14-0x0;var _0xcc5eca=_0x0e42[_0x540d14];return _0xcc5eca;};'use strict';var UserProfileEvents=require(_0x20e4('0x0'));var events=['save',_0x20e4('0x1'),_0x20e4('0x2')];function createListener(_0x3bbb64,_0x192c0e){return function(_0x1d5817){_0x192c0e[_0x20e4('0x3')](_0x3bbb64,_0x1d5817);};}function removeListener(_0x3d566b,_0x5290a7){return function(){UserProfileEvents[_0x20e4('0x4')](_0x3d566b,_0x5290a7);};}exports[_0x20e4('0x5')]=function(_0xadc363){for(var _0x31c78a=0x0,_0x5dc4ed=events[_0x20e4('0x6')];_0x31c78a<_0x5dc4ed;_0x31c78a++){var _0xcf351f=events[_0x31c78a];var _0x36d198=createListener('userProfile:'+_0xcf351f,_0xadc363);UserProfileEvents['on'](_0xcf351f,_0x36d198);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index 0de16a8..775c845 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 _0xa8e0=['util','connect-timeout','express','Router','./userProfileResource.controller','get','isAuthenticated','index','/describe','describe','/:id','create','put','update','delete','destroy'];(function(_0x5e5d8d,_0xda039){var _0x9a973e=function(_0x5001e1){while(--_0x5001e1){_0x5e5d8d['push'](_0x5e5d8d['shift']());}};_0x9a973e(++_0xda039);}(_0xa8e0,0xf0));var _0x0a8e=function(_0x247445,_0x5483d7){_0x247445=_0x247445-0x0;var _0x391c60=_0xa8e0[_0x247445];return _0x391c60;};'use strict';var multer=require('multer');var util=require(_0x0a8e('0x0'));var path=require('path');var timeout=require(_0x0a8e('0x1'));var express=require(_0x0a8e('0x2'));var router=express[_0x0a8e('0x3')]();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(_0x0a8e('0x4'));router[_0x0a8e('0x5')]('/',auth[_0x0a8e('0x6')](),controller[_0x0a8e('0x7')]);router['get'](_0x0a8e('0x8'),auth[_0x0a8e('0x6')](),controller[_0x0a8e('0x9')]);router[_0x0a8e('0x5')](_0x0a8e('0xa'),auth[_0x0a8e('0x6')](),controller['show']);router['post']('/',auth[_0x0a8e('0x6')](),controller[_0x0a8e('0xb')]);router[_0x0a8e('0xc')](_0x0a8e('0xa'),auth['isAuthenticated'](),controller[_0x0a8e('0xd')]);router[_0x0a8e('0xe')](_0x0a8e('0xa'),auth[_0x0a8e('0x6')](),controller[_0x0a8e('0xf')]);module['exports']=router; \ No newline at end of file +var _0xd4cc=['../../config/environment','./userProfileResource.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','update','delete','destroy','exports','util','connect-timeout','express','Router','../../components/auth/service'];(function(_0x16a637,_0x5eb627){var _0x25126d=function(_0x54e016){while(--_0x54e016){_0x16a637['push'](_0x16a637['shift']());}};_0x25126d(++_0x5eb627);}(_0xd4cc,0x1b3));var _0xcd4c=function(_0x5f55fb,_0x1f6f1a){_0x5f55fb=_0x5f55fb-0x0;var _0x5cf4a3=_0xd4cc[_0x5f55fb];return _0x5cf4a3;};'use strict';var multer=require('multer');var util=require(_0xcd4c('0x0'));var path=require('path');var timeout=require(_0xcd4c('0x1'));var express=require(_0xcd4c('0x2'));var router=express[_0xcd4c('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xcd4c('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xcd4c('0x5'));var controller=require(_0xcd4c('0x6'));router[_0xcd4c('0x7')]('/',auth[_0xcd4c('0x8')](),controller[_0xcd4c('0x9')]);router[_0xcd4c('0x7')](_0xcd4c('0xa'),auth['isAuthenticated'](),controller[_0xcd4c('0xb')]);router[_0xcd4c('0x7')](_0xcd4c('0xc'),auth[_0xcd4c('0x8')](),controller[_0xcd4c('0xd')]);router[_0xcd4c('0xe')]('/',auth[_0xcd4c('0x8')](),controller[_0xcd4c('0xf')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xcd4c('0x10')]);router[_0xcd4c('0x11')](_0xcd4c('0xc'),auth[_0xcd4c('0x8')](),controller[_0xcd4c('0x12')]);module[_0xcd4c('0x13')]=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index 19ba49c..12ac8ee 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 _0x2bc7=['STRING','INTEGER','sequelize','exports'];(function(_0x1f93dd,_0x2f6232){var _0x597e32=function(_0x5c97af){while(--_0x5c97af){_0x1f93dd['push'](_0x1f93dd['shift']());}};_0x597e32(++_0x2f6232);}(_0x2bc7,0x8e));var _0x72bc=function(_0xa5ac50,_0x99599e){_0xa5ac50=_0xa5ac50-0x0;var _0x34ebd1=_0x2bc7[_0xa5ac50];return _0x34ebd1;};'use strict';var Sequelize=require(_0x72bc('0x0'));module[_0x72bc('0x1')]={'name':{'type':Sequelize[_0x72bc('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x72bc('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x72bc('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x355d=['STRING','sequelize','exports','INTEGER'];(function(_0x2e97d5,_0x1ca37b){var _0x51a52e=function(_0x327c5c){while(--_0x327c5c){_0x2e97d5['push'](_0x2e97d5['shift']());}};_0x51a52e(++_0x1ca37b);}(_0x355d,0x89));var _0xd355=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x355d[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0xd355('0x0'));module[_0xd355('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'resourceId':{'type':Sequelize[_0xd355('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xd355('0x3')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index d1bcd9a..02cf7f6 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 _0x5f2f=['offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','stack','name','send','index','UserProfileResource','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','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status'];(function(_0xb875ee,_0x583042){var _0x4c7f3a=function(_0x1f6661){while(--_0x1f6661){_0xb875ee['push'](_0xb875ee['shift']());}};_0x4c7f3a(++_0x583042);}(_0x5f2f,0x73));var _0xf5f2=function(_0x48a06f,_0x152e72){_0x48a06f=_0x48a06f-0x0;var _0x3e75e4=_0x5f2f[_0x48a06f];return _0x3e75e4;};'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));};exports['describe']=function(_0x22b645,_0xe0ce7f){return db[_0xf5f2('0x29')][_0xf5f2('0x46')]()['then'](respondWithResult(_0xe0ce7f,null))['catch'](handleError(_0xe0ce7f,null));}; \ No newline at end of file +var _0xafc4=['update','destroy','then','stack','name','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge','map','VIRTUAL','options','UserProfileResource','includeAll','catch','show','params','create','body','find','describe','eml-format','zip-dir','request-promise','moment','bluebird','mustache','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save'];(function(_0x2b0db6,_0x52bd52){var _0x9c90df=function(_0x42e405){while(--_0x42e405){_0x2b0db6['push'](_0x2b0db6['shift']());}};_0x9c90df(++_0x52bd52);}(_0xafc4,0x69));var _0x4afc=function(_0x274e5d,_0x55b350){_0x274e5d=_0x274e5d-0x0;var _0x467c5=_0xafc4[_0x274e5d];return _0x467c5;};'use strict';var emlformat=require(_0x4afc('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4afc('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4afc('0x2'));var moment=require(_0x4afc('0x3'));var BPromise=require(_0x4afc('0x4'));var Mustache=require(_0x4afc('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x4afc('0x6'));var ejs=require(_0x4afc('0x7'));var fs=require('fs');var fs_extra=require(_0x4afc('0x8'));var _=require(_0x4afc('0x9'));var squel=require(_0x4afc('0xa'));var crypto=require(_0x4afc('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x4afc('0xc'));var toCsv=require(_0x4afc('0x6'));var querystring=require(_0x4afc('0xd'));var Papa=require(_0x4afc('0xe'));var Redis=require(_0x4afc('0xf'));var authService=require(_0x4afc('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4afc('0x11'));var logger=require('../../config/logger')(_0x4afc('0x12'));var utils=require(_0x4afc('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x4afc('0x14'));var db=require(_0x4afc('0x15'))['db'];function respondWithStatusCode(_0x2b191c,_0x2768bf){_0x2768bf=_0x2768bf||0xcc;return function(_0x1d8f98){if(_0x1d8f98){return _0x2b191c[_0x4afc('0x16')](_0x2768bf);}return _0x2b191c[_0x4afc('0x17')](_0x2768bf)[_0x4afc('0x18')]();};}function respondWithResult(_0x5effb4,_0x26f3f1){_0x26f3f1=_0x26f3f1||0xc8;return function(_0x429fd8){if(_0x429fd8){return _0x5effb4[_0x4afc('0x17')](_0x26f3f1)[_0x4afc('0x19')](_0x429fd8);}};}function respondWithFilteredResult(_0x5f2dc9,_0x4e32e8){return function(_0x2452ae){if(_0x2452ae){var _0x4f3127=typeof _0x4e32e8[_0x4afc('0x1a')]===_0x4afc('0x1b')&&typeof _0x4e32e8[_0x4afc('0x1c')]===_0x4afc('0x1b');var _0x3a306f=_0x2452ae[_0x4afc('0x1d')];var _0x22f809=_0x4f3127?0x0:_0x4e32e8[_0x4afc('0x1a')];var _0x16365f=_0x4f3127?_0x2452ae[_0x4afc('0x1d')]:_0x4e32e8[_0x4afc('0x1a')]+_0x4e32e8['limit'];var _0x1a8f49;if(_0x16365f>=_0x3a306f){_0x16365f=_0x3a306f;_0x1a8f49=0xc8;}else{_0x1a8f49=0xce;}_0x5f2dc9[_0x4afc('0x17')](_0x1a8f49);return _0x5f2dc9[_0x4afc('0x1e')](_0x4afc('0x1f'),_0x22f809+'-'+_0x16365f+'/'+_0x3a306f)['json'](_0x2452ae);}return null;};}function patchUpdates(_0x3bddc0){return function(_0x30eda3){try{jsonpatch[_0x4afc('0x20')](_0x30eda3,_0x3bddc0,!![]);}catch(_0x280587){return BPromise[_0x4afc('0x21')](_0x280587);}return _0x30eda3[_0x4afc('0x22')]();};}function saveUpdates(_0x3ad7a5,_0x573a75){return function(_0x5403e4){if(_0x5403e4){return _0x5403e4[_0x4afc('0x23')](_0x3ad7a5)['then'](function(_0x37debf){return _0x37debf;});}return null;};}function removeEntity(_0x4e9a48,_0x1aa676){return function(_0x2a0314){if(_0x2a0314){return _0x2a0314[_0x4afc('0x24')]()[_0x4afc('0x25')](function(){_0x4e9a48[_0x4afc('0x17')](0xcc)[_0x4afc('0x18')]();});}};}function handleEntityNotFound(_0x40a0db,_0x383a71){return function(_0x2bb837){if(!_0x2bb837){_0x40a0db[_0x4afc('0x16')](0x194);}return _0x2bb837;};}function handleError(_0x4e8273,_0x359c07){_0x359c07=_0x359c07||0x1f4;return function(_0x35f5b3){logger['error'](_0x35f5b3[_0x4afc('0x26')]);if(_0x35f5b3[_0x4afc('0x27')]){delete _0x35f5b3[_0x4afc('0x27')];}_0x4e8273['status'](_0x359c07)['send'](_0x35f5b3);};}exports['index']=function(_0x426e9d,_0x5db47e){var _0x5e4747={},_0xd26d2f={},_0x628e42={'count':0x0,'rows':[]};var _0x494fe7=_['map'](db['UserProfileResource'][_0x4afc('0x28')],function(_0x34434a){return{'name':_0x34434a[_0x4afc('0x29')],'type':_0x34434a[_0x4afc('0x2a')][_0x4afc('0x2b')]};});_0xd26d2f[_0x4afc('0x2c')]=_['map'](_0x494fe7,_0x4afc('0x27'));_0xd26d2f[_0x4afc('0x2d')]=_[_0x4afc('0x2e')](_0x426e9d[_0x4afc('0x2d')]);_0xd26d2f[_0x4afc('0x2f')]=_[_0x4afc('0x30')](_0xd26d2f[_0x4afc('0x2c')],_0xd26d2f[_0x4afc('0x2d')]);_0x5e4747['attributes']=_[_0x4afc('0x30')](_0xd26d2f['model'],qs['fields'](_0x426e9d[_0x4afc('0x2d')][_0x4afc('0x31')]));_0x5e4747[_0x4afc('0x32')]=_0x5e4747[_0x4afc('0x32')][_0x4afc('0x33')]?_0x5e4747[_0x4afc('0x32')]:_0xd26d2f['model'];if(!_0x426e9d[_0x4afc('0x2d')][_0x4afc('0x34')](_0x4afc('0x35'))){_0x5e4747[_0x4afc('0x1c')]=qs[_0x4afc('0x1c')](_0x426e9d[_0x4afc('0x2d')]['limit']);_0x5e4747[_0x4afc('0x1a')]=qs[_0x4afc('0x1a')](_0x426e9d[_0x4afc('0x2d')][_0x4afc('0x1a')]);}_0x5e4747['order']=qs['sort'](_0x426e9d[_0x4afc('0x2d')][_0x4afc('0x36')]);_0x5e4747[_0x4afc('0x37')]=qs['filters'](_['pick'](_0x426e9d[_0x4afc('0x2d')],_0xd26d2f['filters']),_0x494fe7);if(_0x426e9d['query'][_0x4afc('0x38')]){_0x5e4747[_0x4afc('0x37')]=_[_0x4afc('0x39')](_0x5e4747[_0x4afc('0x37')],{'$or':_[_0x4afc('0x3a')](_0x494fe7,function(_0x4420fb){if(_0x4420fb[_0x4afc('0x2a')]!==_0x4afc('0x3b')){var _0x3ccc5a={};_0x3ccc5a[_0x4420fb[_0x4afc('0x27')]]={'$like':'%'+_0x426e9d[_0x4afc('0x2d')][_0x4afc('0x38')]+'%'};return _0x3ccc5a;}})});}_0x5e4747=_[_0x4afc('0x39')]({},_0x5e4747,_0x426e9d[_0x4afc('0x3c')]);var _0x46dd2a={'where':_0x5e4747['where']};return db[_0x4afc('0x3d')][_0x4afc('0x1d')](_0x46dd2a)[_0x4afc('0x25')](function(_0xe6db12){_0x628e42[_0x4afc('0x1d')]=_0xe6db12;if(_0x426e9d[_0x4afc('0x2d')][_0x4afc('0x3e')]){_0x5e4747['include']=[{'all':!![]}];}return db['UserProfileResource']['findAll'](_0x5e4747);})[_0x4afc('0x25')](function(_0x105c03){_0x628e42['rows']=_0x105c03;return _0x628e42;})[_0x4afc('0x25')](respondWithFilteredResult(_0x5db47e,_0x5e4747))[_0x4afc('0x3f')](handleError(_0x5db47e,null));};exports[_0x4afc('0x40')]=function(_0x397996,_0x545109){var _0x12b5db={'raw':![],'where':{'id':_0x397996[_0x4afc('0x41')]['id']}},_0x45c9c3={};_0x45c9c3[_0x4afc('0x2c')]=_[_0x4afc('0x2e')](db[_0x4afc('0x3d')]['rawAttributes']);_0x45c9c3[_0x4afc('0x2d')]=_['keys'](_0x397996[_0x4afc('0x2d')]);_0x45c9c3[_0x4afc('0x2f')]=_[_0x4afc('0x30')](_0x45c9c3['model'],_0x45c9c3['query']);_0x12b5db[_0x4afc('0x32')]=_[_0x4afc('0x30')](_0x45c9c3[_0x4afc('0x2c')],qs[_0x4afc('0x31')](_0x397996[_0x4afc('0x2d')][_0x4afc('0x31')]));_0x12b5db[_0x4afc('0x32')]=_0x12b5db[_0x4afc('0x32')]['length']?_0x12b5db[_0x4afc('0x32')]:_0x45c9c3[_0x4afc('0x2c')];if(_0x397996['query'][_0x4afc('0x3e')]){_0x12b5db['include']=[{'all':!![]}];}_0x12b5db=_[_0x4afc('0x39')]({},_0x12b5db,_0x397996[_0x4afc('0x3c')]);return db[_0x4afc('0x3d')]['find'](_0x12b5db)[_0x4afc('0x25')](handleEntityNotFound(_0x545109,null))[_0x4afc('0x25')](respondWithResult(_0x545109,null))[_0x4afc('0x3f')](handleError(_0x545109,null));};exports[_0x4afc('0x42')]=function(_0x4772db,_0x19a0ac){return db['UserProfileResource']['create'](_0x4772db['body'],{})[_0x4afc('0x25')](respondWithResult(_0x19a0ac,0xc9))[_0x4afc('0x3f')](handleError(_0x19a0ac,null));};exports[_0x4afc('0x23')]=function(_0x269c24,_0xb5cca9){if(_0x269c24[_0x4afc('0x43')]['id']){delete _0x269c24[_0x4afc('0x43')]['id'];}return db[_0x4afc('0x3d')][_0x4afc('0x44')]({'where':{'id':_0x269c24[_0x4afc('0x41')]['id']}})['then'](handleEntityNotFound(_0xb5cca9,null))[_0x4afc('0x25')](saveUpdates(_0x269c24['body'],null))['then'](respondWithResult(_0xb5cca9,null))[_0x4afc('0x3f')](handleError(_0xb5cca9,null));};exports['destroy']=function(_0x428d78,_0x355198){return db[_0x4afc('0x3d')][_0x4afc('0x44')]({'where':{'id':_0x428d78['params']['id']}})[_0x4afc('0x25')](handleEntityNotFound(_0x355198,null))['then'](removeEntity(_0x355198,null))[_0x4afc('0x3f')](handleError(_0x355198,null));};exports[_0x4afc('0x45')]=function(_0x3625c9,_0x387834){return db[_0x4afc('0x3d')][_0x4afc('0x45')]()[_0x4afc('0x25')](respondWithResult(_0x387834,null))[_0x4afc('0x3f')](handleError(_0x387834,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index 551a40c..ad675b5 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 _0x5e6b=['resourceId','sectionId','util','../../config/logger','api','moment','rimraf','../../config/environment','./userProfileResource.attributes','exports','define','UserProfileResource','user_profile_has_resources','compositeIndex'];(function(_0x4e6fb2,_0x3cf23e){var _0x2f1636=function(_0x53c7eb){while(--_0x53c7eb){_0x4e6fb2['push'](_0x4e6fb2['shift']());}};_0x2f1636(++_0x3cf23e);}(_0x5e6b,0xd4));var _0xb5e6=function(_0x1cb18a,_0x33167a){_0x1cb18a=_0x1cb18a-0x0;var _0x22442e=_0x5e6b[_0x1cb18a];return _0x22442e;};'use strict';var _=require('lodash');var util=require(_0xb5e6('0x0'));var logger=require(_0xb5e6('0x1'))(_0xb5e6('0x2'));var moment=require(_0xb5e6('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xb5e6('0x4'));var config=require(_0xb5e6('0x5'));var attributes=require(_0xb5e6('0x6'));module[_0xb5e6('0x7')]=function(_0x28baeb,_0xe84eda){return _0x28baeb[_0xb5e6('0x8')](_0xb5e6('0x9'),attributes,{'tableName':_0xb5e6('0xa'),'paranoid':![],'indexes':[{'name':_0xb5e6('0xb'),'fields':[_0xb5e6('0xc'),_0xb5e6('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x72fb=['exports','define','UserProfileResource','user_profile_has_resources','compositeIndex','resourceId','sectionId','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./userProfileResource.attributes'];(function(_0x2ea680,_0x99a563){var _0x317396=function(_0x40c50d){while(--_0x40c50d){_0x2ea680['push'](_0x2ea680['shift']());}};_0x317396(++_0x99a563);}(_0x72fb,0x197));var _0xb72f=function(_0x20f96d,_0x23e67f){_0x20f96d=_0x20f96d-0x0;var _0x9a7524=_0x72fb[_0x20f96d];return _0x9a7524;};'use strict';var _=require(_0xb72f('0x0'));var util=require('util');var logger=require(_0xb72f('0x1'))(_0xb72f('0x2'));var moment=require(_0xb72f('0x3'));var BPromise=require(_0xb72f('0x4'));var rp=require(_0xb72f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb72f('0x6'));var config=require(_0xb72f('0x7'));var attributes=require(_0xb72f('0x8'));module[_0xb72f('0x9')]=function(_0x182c4d,_0x4e655d){return _0x182c4d[_0xb72f('0xa')](_0xb72f('0xb'),attributes,{'tableName':_0xb72f('0xc'),'paranoid':![],'indexes':[{'name':_0xb72f('0xd'),'fields':[_0xb72f('0xe'),_0xb72f('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index 7458db4..9c1b39b 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 _0x2535=['../../config/logger','rpc','../../config/environment','client','http','then','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x5b6024,_0x2872bb){var _0x1bfedf=function(_0x85617f){while(--_0x85617f){_0x5b6024['push'](_0x5b6024['shift']());}};_0x1bfedf(++_0x2872bb);}(_0x2535,0x1c5));var _0x5253=function(_0x4c6192,_0x4e0ec6){_0x4c6192=_0x4c6192-0x0;var _0x4672ac=_0x2535[_0x4c6192];return _0x4672ac;};'use strict';var _=require(_0x5253('0x0'));var util=require('util');var moment=require(_0x5253('0x1'));var BPromise=require(_0x5253('0x2'));var rs=require(_0x5253('0x3'));var fs=require('fs');var Redis=require(_0x5253('0x4'));var db=require(_0x5253('0x5'))['db'];var utils=require(_0x5253('0x6'));var logger=require(_0x5253('0x7'))(_0x5253('0x8'));var config=require(_0x5253('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x5253('0xa')][_0x5253('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4b2a0d,_0x1fd199,_0x39b550){return new BPromise(function(_0x58eded,_0x1690f2){return client['request'](_0x4b2a0d,_0x39b550)[_0x5253('0xc')](function(_0x10a3b1){logger[_0x5253('0xd')](_0x5253('0xe'),_0x1fd199,_0x5253('0xf'));logger[_0x5253('0x10')](_0x5253('0x11'),_0x1fd199,'request\x20sent',JSON[_0x5253('0x12')](_0x10a3b1));if(_0x10a3b1[_0x5253('0x13')]){if(_0x10a3b1[_0x5253('0x13')]['code']===0x1f4){logger[_0x5253('0x13')]('UserProfileResource,\x20%s,\x20%s',_0x1fd199,_0x10a3b1['error'][_0x5253('0x14')]);return _0x1690f2(_0x10a3b1[_0x5253('0x13')][_0x5253('0x14')]);}logger[_0x5253('0x13')](_0x5253('0xe'),_0x1fd199,_0x10a3b1[_0x5253('0x13')][_0x5253('0x14')]);return _0x58eded(_0x10a3b1[_0x5253('0x13')][_0x5253('0x14')]);}else{logger[_0x5253('0xd')](_0x5253('0xe'),_0x1fd199,_0x5253('0xf'));_0x58eded(_0x10a3b1[_0x5253('0x15')][_0x5253('0x14')]);}})[_0x5253('0x16')](function(_0x38722e){logger[_0x5253('0x13')](_0x5253('0xe'),_0x1fd199,_0x38722e);_0x1690f2(_0x38722e);});});} \ No newline at end of file +var _0x020b=['bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','request','info','UserProfileResource,\x20%s,\x20%s','UserProfileResource,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','util','moment'];(function(_0x4746be,_0x14d1ec){var _0x3fb821=function(_0xb5fe30){while(--_0xb5fe30){_0x4746be['push'](_0x4746be['shift']());}};_0x3fb821(++_0x14d1ec);}(_0x020b,0x1ae));var _0xb020=function(_0x4b59e3,_0x2ae719){_0x4b59e3=_0x4b59e3-0x0;var _0x126809=_0x020b[_0x4b59e3];return _0x126809;};'use strict';var _=require('lodash');var util=require(_0xb020('0x0'));var moment=require(_0xb020('0x1'));var BPromise=require(_0xb020('0x2'));var rs=require(_0xb020('0x3'));var fs=require('fs');var Redis=require(_0xb020('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xb020('0x5'));var logger=require('../../config/logger')(_0xb020('0x6'));var config=require(_0xb020('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xb020('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x336401,_0x5a6cd3,_0x509806){return new BPromise(function(_0x43b253,_0x2a6a70){return client[_0xb020('0x9')](_0x336401,_0x509806)['then'](function(_0x216e4c){logger[_0xb020('0xa')](_0xb020('0xb'),_0x5a6cd3,'request\x20sent');logger['debug'](_0xb020('0xc'),_0x5a6cd3,_0xb020('0xd'),JSON['stringify'](_0x216e4c));if(_0x216e4c[_0xb020('0xe')]){if(_0x216e4c[_0xb020('0xe')]['code']===0x1f4){logger[_0xb020('0xe')]('UserProfileResource,\x20%s,\x20%s',_0x5a6cd3,_0x216e4c['error']['message']);return _0x2a6a70(_0x216e4c[_0xb020('0xe')]['message']);}logger[_0xb020('0xe')]('UserProfileResource,\x20%s,\x20%s',_0x5a6cd3,_0x216e4c[_0xb020('0xe')][_0xb020('0xf')]);return _0x43b253(_0x216e4c[_0xb020('0xe')][_0xb020('0xf')]);}else{logger[_0xb020('0xa')](_0xb020('0xb'),_0x5a6cd3,_0xb020('0xd'));_0x43b253(_0x216e4c['result'][_0xb020('0xf')]);}})['catch'](function(_0x4b7c53){logger[_0xb020('0xe')](_0xb020('0xb'),_0x5a6cd3,_0x4b7c53);_0x2a6a70(_0x4b7c53);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index 6e3f164..016cc42 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 _0x7b7c=['/:id','post','create','put','update','delete','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./userProfileSection.controller','isAuthenticated','index','get','/describe','describe'];(function(_0x11df3e,_0x21249e){var _0x5139c4=function(_0x5d8f55){while(--_0x5d8f55){_0x11df3e['push'](_0x11df3e['shift']());}};_0x5139c4(++_0x21249e);}(_0x7b7c,0x1ce));var _0xc7b7=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x7b7c[_0x502c7d];return _0x30b7ed;};'use strict';var multer=require('multer');var util=require(_0xc7b7('0x0'));var path=require(_0xc7b7('0x1'));var timeout=require(_0xc7b7('0x2'));var express=require(_0xc7b7('0x3'));var router=express[_0xc7b7('0x4')]();var fs_extra=require(_0xc7b7('0x5'));var auth=require(_0xc7b7('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xc7b7('0x7'));router['get']('/',auth[_0xc7b7('0x8')](),controller[_0xc7b7('0x9')]);router[_0xc7b7('0xa')](_0xc7b7('0xb'),auth[_0xc7b7('0x8')](),controller[_0xc7b7('0xc')]);router[_0xc7b7('0xa')](_0xc7b7('0xd'),auth[_0xc7b7('0x8')](),controller['show']);router[_0xc7b7('0xe')]('/',auth[_0xc7b7('0x8')](),controller[_0xc7b7('0xf')]);router[_0xc7b7('0x10')](_0xc7b7('0xd'),auth[_0xc7b7('0x8')](),controller[_0xc7b7('0x11')]);router[_0xc7b7('0x12')](_0xc7b7('0xd'),auth[_0xc7b7('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x5b1b=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileSection.controller','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','destroy','multer','util','path'];(function(_0xa59569,_0x4df2dc){var _0x1ee44d=function(_0x902edf){while(--_0x902edf){_0xa59569['push'](_0xa59569['shift']());}};_0x1ee44d(++_0x4df2dc);}(_0x5b1b,0x1e1));var _0xb5b1=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x5b1b[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0xb5b1('0x0'));var util=require(_0xb5b1('0x1'));var path=require(_0xb5b1('0x2'));var timeout=require('connect-timeout');var express=require(_0xb5b1('0x3'));var router=express[_0xb5b1('0x4')]();var fs_extra=require(_0xb5b1('0x5'));var auth=require(_0xb5b1('0x6'));var interaction=require(_0xb5b1('0x7'));var config=require(_0xb5b1('0x8'));var controller=require(_0xb5b1('0x9'));router['get']('/',auth[_0xb5b1('0xa')](),controller[_0xb5b1('0xb')]);router['get'](_0xb5b1('0xc'),auth[_0xb5b1('0xa')](),controller[_0xb5b1('0xd')]);router['get'](_0xb5b1('0xe'),auth['isAuthenticated'](),controller[_0xb5b1('0xf')]);router[_0xb5b1('0x10')]('/',auth['isAuthenticated'](),controller[_0xb5b1('0x11')]);router[_0xb5b1('0x12')](_0xb5b1('0xe'),auth[_0xb5b1('0xa')](),controller[_0xb5b1('0x13')]);router[_0xb5b1('0x14')](_0xb5b1('0xe'),auth[_0xb5b1('0xa')](),controller[_0xb5b1('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index c963e46..9c0a373 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 _0xfef3=['sequelize','STRING','INTEGER','BOOLEAN','crudPermissions','join','getDataValue','split'];(function(_0x5ca00f,_0x1a42b5){var _0x528b89=function(_0x4255ad){while(--_0x4255ad){_0x5ca00f['push'](_0x5ca00f['shift']());}};_0x528b89(++_0x1a42b5);}(_0xfef3,0x118));var _0x3fef=function(_0x3e4ccf,_0x263017){_0x3e4ccf=_0x3e4ccf-0x0;var _0x25d931=_0xfef3[_0x3e4ccf];return _0x25d931;};'use strict';var Sequelize=require(_0x3fef('0x0'));module['exports']={'name':{'type':Sequelize[_0x3fef('0x1')],'allowNull':![]},'category':{'type':Sequelize['STRING'],'allowNull':![]},'sectionId':{'type':Sequelize[_0x3fef('0x2')],'allowNull':![]},'enabled':{'type':Sequelize[_0x3fef('0x3')],'defaultValue':null},'autoAssociation':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x3fef('0x1')],'set':function(_0x3b71e5){this['setDataValue'](_0x3fef('0x4'),_0x3b71e5?_0x3b71e5[_0x3fef('0x5')](''):[]);},'get':function(){return this['getDataValue'](_0x3fef('0x4'))?this[_0x3fef('0x6')](_0x3fef('0x4'))[_0x3fef('0x7')](''):[];}}}; \ No newline at end of file +var _0xe5b5=['exports','STRING','INTEGER','BOOLEAN','setDataValue','crudPermissions','join','getDataValue','split','sequelize'];(function(_0x3f70bb,_0x329d02){var _0x865b97=function(_0x21374b){while(--_0x21374b){_0x3f70bb['push'](_0x3f70bb['shift']());}};_0x865b97(++_0x329d02);}(_0xe5b5,0x12b));var _0x5e5b=function(_0x2ce6d5,_0x333e0c){_0x2ce6d5=_0x2ce6d5-0x0;var _0x32d272=_0xe5b5[_0x2ce6d5];return _0x32d272;};'use strict';var Sequelize=require(_0x5e5b('0x0'));module[_0x5e5b('0x1')]={'name':{'type':Sequelize[_0x5e5b('0x2')],'allowNull':![]},'category':{'type':Sequelize[_0x5e5b('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize[_0x5e5b('0x3')],'allowNull':![]},'enabled':{'type':Sequelize[_0x5e5b('0x4')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x5e5b('0x4')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x5e5b('0x2')],'set':function(_0xf20c6a){this[_0x5e5b('0x5')](_0x5e5b('0x6'),_0xf20c6a?_0xf20c6a[_0x5e5b('0x7')](''):[]);},'get':function(){return this[_0x5e5b('0x8')](_0x5e5b('0x6'))?this[_0x5e5b('0x8')](_0x5e5b('0x6'))[_0x5e5b('0x9')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index 35da4ea..f3c1173 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 _0x6aa9=['zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','map','UserProfileSection','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','order','sort','where','filter','VIRTUAL','merge','options','includeAll','rows','catch','show','params','length','find','create','body','describe','rimraf'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x6aa9,0x1af));var _0x96aa=function(_0x112c73,_0x5a4e2d){_0x112c73=_0x112c73-0x0;var _0x24867c=_0x6aa9[_0x112c73];return _0x24867c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x96aa('0x0'));var zipdir=require(_0x96aa('0x1'));var jsonpatch=require(_0x96aa('0x2'));var rp=require(_0x96aa('0x3'));var moment=require('moment');var BPromise=require(_0x96aa('0x4'));var Mustache=require(_0x96aa('0x5'));var util=require(_0x96aa('0x6'));var path=require('path');var sox=require(_0x96aa('0x7'));var csv=require(_0x96aa('0x8'));var ejs=require(_0x96aa('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x96aa('0xa'));var squel=require('squel');var crypto=require(_0x96aa('0xb'));var jsforce=require(_0x96aa('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x96aa('0xd'));var Papa=require(_0x96aa('0xe'));var Redis=require(_0x96aa('0xf'));var authService=require(_0x96aa('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x96aa('0x11'))(_0x96aa('0x12'));var utils=require(_0x96aa('0x13'));var config=require(_0x96aa('0x14'));var licenseUtil=require(_0x96aa('0x15'));var db=require(_0x96aa('0x16'))['db'];function respondWithStatusCode(_0x26aeb0,_0x1f4bf7){_0x1f4bf7=_0x1f4bf7||0xcc;return function(_0x4e87c0){if(_0x4e87c0){return _0x26aeb0[_0x96aa('0x17')](_0x1f4bf7);}return _0x26aeb0[_0x96aa('0x18')](_0x1f4bf7)[_0x96aa('0x19')]();};}function respondWithResult(_0x31d25f,_0x46700b){_0x46700b=_0x46700b||0xc8;return function(_0x2bf898){if(_0x2bf898){return _0x31d25f[_0x96aa('0x18')](_0x46700b)[_0x96aa('0x1a')](_0x2bf898);}};}function respondWithFilteredResult(_0x3bec8d,_0x47f1a){return function(_0x5169c3){if(_0x5169c3){var _0x464bb1=typeof _0x47f1a[_0x96aa('0x1b')]===_0x96aa('0x1c')&&typeof _0x47f1a[_0x96aa('0x1d')]===_0x96aa('0x1c');var _0x541ec3=_0x5169c3[_0x96aa('0x1e')];var _0x2fc679=_0x464bb1?0x0:_0x47f1a['offset'];var _0x4a9bde=_0x464bb1?_0x5169c3[_0x96aa('0x1e')]:_0x47f1a[_0x96aa('0x1b')]+_0x47f1a[_0x96aa('0x1d')];var _0x2808f8;if(_0x4a9bde>=_0x541ec3){_0x4a9bde=_0x541ec3;_0x2808f8=0xc8;}else{_0x2808f8=0xce;}_0x3bec8d[_0x96aa('0x18')](_0x2808f8);return _0x3bec8d[_0x96aa('0x1f')](_0x96aa('0x20'),_0x2fc679+'-'+_0x4a9bde+'/'+_0x541ec3)['json'](_0x5169c3);}return null;};}function patchUpdates(_0x596cda){return function(_0x5a635e){try{jsonpatch[_0x96aa('0x21')](_0x5a635e,_0x596cda,!![]);}catch(_0x492586){return BPromise[_0x96aa('0x22')](_0x492586);}return _0x5a635e[_0x96aa('0x23')]();};}function saveUpdates(_0x2b9ac9,_0x56e2b7){return function(_0x35689d){if(_0x35689d){return _0x35689d[_0x96aa('0x24')](_0x2b9ac9)[_0x96aa('0x25')](function(_0x5af467){return _0x5af467;});}return null;};}function removeEntity(_0x2784ea,_0x43627a){return function(_0x470188){if(_0x470188){return _0x470188[_0x96aa('0x26')]()[_0x96aa('0x25')](function(){_0x2784ea['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2328aa,_0x1788d1){return function(_0x274b4f){if(!_0x274b4f){_0x2328aa[_0x96aa('0x17')](0x194);}return _0x274b4f;};}function handleError(_0x4247f5,_0x558ddd){_0x558ddd=_0x558ddd||0x1f4;return function(_0x10bf63){logger[_0x96aa('0x27')](_0x10bf63['stack']);if(_0x10bf63[_0x96aa('0x28')]){delete _0x10bf63[_0x96aa('0x28')];}_0x4247f5[_0x96aa('0x18')](_0x558ddd)[_0x96aa('0x29')](_0x10bf63);};}exports['index']=function(_0x48dee1,_0x15a756){var _0x5272f6={},_0x781830={},_0x15ee7d={'count':0x0,'rows':[]};var _0x53699e=_[_0x96aa('0x2a')](db[_0x96aa('0x2b')][_0x96aa('0x2c')],function(_0x13be43){return{'name':_0x13be43[_0x96aa('0x2d')],'type':_0x13be43[_0x96aa('0x2e')][_0x96aa('0x2f')]};});_0x781830[_0x96aa('0x30')]=_['map'](_0x53699e,'name');_0x781830[_0x96aa('0x31')]=_[_0x96aa('0x32')](_0x48dee1[_0x96aa('0x31')]);_0x781830[_0x96aa('0x33')]=_[_0x96aa('0x34')](_0x781830[_0x96aa('0x30')],_0x781830[_0x96aa('0x31')]);_0x5272f6['attributes']=_[_0x96aa('0x34')](_0x781830[_0x96aa('0x30')],qs[_0x96aa('0x35')](_0x48dee1[_0x96aa('0x31')][_0x96aa('0x35')]));_0x5272f6[_0x96aa('0x36')]=_0x5272f6[_0x96aa('0x36')]['length']?_0x5272f6[_0x96aa('0x36')]:_0x781830[_0x96aa('0x30')];if(!_0x48dee1['query']['hasOwnProperty']('nolimit')){_0x5272f6[_0x96aa('0x1d')]=qs['limit'](_0x48dee1[_0x96aa('0x31')][_0x96aa('0x1d')]);_0x5272f6['offset']=qs[_0x96aa('0x1b')](_0x48dee1['query'][_0x96aa('0x1b')]);}_0x5272f6[_0x96aa('0x37')]=qs['sort'](_0x48dee1[_0x96aa('0x31')][_0x96aa('0x38')]);_0x5272f6[_0x96aa('0x39')]=qs[_0x96aa('0x33')](_['pick'](_0x48dee1[_0x96aa('0x31')],_0x781830[_0x96aa('0x33')]),_0x53699e);if(_0x48dee1['query'][_0x96aa('0x3a')]){_0x5272f6[_0x96aa('0x39')]=_['merge'](_0x5272f6[_0x96aa('0x39')],{'$or':_[_0x96aa('0x2a')](_0x53699e,function(_0x56ce08){if(_0x56ce08[_0x96aa('0x2e')]!==_0x96aa('0x3b')){var _0x58cd59={};_0x58cd59[_0x56ce08[_0x96aa('0x28')]]={'$like':'%'+_0x48dee1[_0x96aa('0x31')][_0x96aa('0x3a')]+'%'};return _0x58cd59;}})});}_0x5272f6=_[_0x96aa('0x3c')]({},_0x5272f6,_0x48dee1[_0x96aa('0x3d')]);var _0x275f8b={'where':_0x5272f6[_0x96aa('0x39')]};return db['UserProfileSection'][_0x96aa('0x1e')](_0x275f8b)[_0x96aa('0x25')](function(_0x5b056a){_0x15ee7d[_0x96aa('0x1e')]=_0x5b056a;if(_0x48dee1['query'][_0x96aa('0x3e')]){_0x5272f6['include']=[{'all':!![]}];}return db['UserProfileSection']['findAll'](_0x5272f6);})[_0x96aa('0x25')](function(_0x1b18e7){_0x15ee7d[_0x96aa('0x3f')]=_0x1b18e7;return _0x15ee7d;})[_0x96aa('0x25')](respondWithFilteredResult(_0x15a756,_0x5272f6))[_0x96aa('0x40')](handleError(_0x15a756,null));};exports[_0x96aa('0x41')]=function(_0x2d811e,_0x234dc3){var _0x244f4e={'raw':![],'where':{'id':_0x2d811e[_0x96aa('0x42')]['id']}},_0x1dc734={};_0x1dc734[_0x96aa('0x30')]=_['keys'](db[_0x96aa('0x2b')][_0x96aa('0x2c')]);_0x1dc734[_0x96aa('0x31')]=_[_0x96aa('0x32')](_0x2d811e[_0x96aa('0x31')]);_0x1dc734['filters']=_[_0x96aa('0x34')](_0x1dc734[_0x96aa('0x30')],_0x1dc734[_0x96aa('0x31')]);_0x244f4e[_0x96aa('0x36')]=_[_0x96aa('0x34')](_0x1dc734[_0x96aa('0x30')],qs[_0x96aa('0x35')](_0x2d811e[_0x96aa('0x31')][_0x96aa('0x35')]));_0x244f4e[_0x96aa('0x36')]=_0x244f4e[_0x96aa('0x36')][_0x96aa('0x43')]?_0x244f4e[_0x96aa('0x36')]:_0x1dc734['model'];if(_0x2d811e[_0x96aa('0x31')]['includeAll']){_0x244f4e['include']=[{'all':!![]}];}_0x244f4e=_['merge']({},_0x244f4e,_0x2d811e['options']);return db[_0x96aa('0x2b')][_0x96aa('0x44')](_0x244f4e)[_0x96aa('0x25')](handleEntityNotFound(_0x234dc3,null))[_0x96aa('0x25')](respondWithResult(_0x234dc3,null))[_0x96aa('0x40')](handleError(_0x234dc3,null));};exports['create']=function(_0x238264,_0x391224){return db[_0x96aa('0x2b')][_0x96aa('0x45')](_0x238264['body'],{})[_0x96aa('0x25')](respondWithResult(_0x391224,0xc9))[_0x96aa('0x40')](handleError(_0x391224,null));};exports[_0x96aa('0x24')]=function(_0x3ee82c,_0x5bcdb0){if(_0x3ee82c[_0x96aa('0x46')]['id']){delete _0x3ee82c[_0x96aa('0x46')]['id'];}return db[_0x96aa('0x2b')][_0x96aa('0x44')]({'where':{'id':_0x3ee82c[_0x96aa('0x42')]['id']}})[_0x96aa('0x25')](handleEntityNotFound(_0x5bcdb0,null))[_0x96aa('0x25')](saveUpdates(_0x3ee82c[_0x96aa('0x46')],null))['then'](respondWithResult(_0x5bcdb0,null))[_0x96aa('0x40')](handleError(_0x5bcdb0,null));};exports[_0x96aa('0x26')]=function(_0xabc18,_0x477e24){return db[_0x96aa('0x2b')][_0x96aa('0x44')]({'where':{'id':_0xabc18[_0x96aa('0x42')]['id']}})[_0x96aa('0x25')](handleEntityNotFound(_0x477e24,null))[_0x96aa('0x25')](removeEntity(_0x477e24,null))['catch'](handleError(_0x477e24,null));};exports[_0x96aa('0x47')]=function(_0x13b4fb,_0x3770e3){return db['UserProfileSection']['describe']()[_0x96aa('0x25')](respondWithResult(_0x3770e3,null))[_0x96aa('0x40')](handleError(_0x3770e3,null));}; \ No newline at end of file +var _0x7b0a=['stack','name','send','index','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','order','sort','where','filter','merge','map','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','UserProfileSection','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','../../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','offset','limit','undefined','count','set','Content-Range','json','apply','save','update','destroy','then','error'];(function(_0x1cefbb,_0x40cf22){var _0x455e2c=function(_0x3c411a){while(--_0x3c411a){_0x1cefbb['push'](_0x1cefbb['shift']());}};_0x455e2c(++_0x40cf22);}(_0x7b0a,0x111));var _0xa7b0=function(_0x1eb6c9,_0x4d8fd7){_0x1eb6c9=_0x1eb6c9-0x0;var _0xc6e9d0=_0x7b0a[_0x1eb6c9];return _0xc6e9d0;};'use strict';var emlformat=require(_0xa7b0('0x0'));var rimraf=require(_0xa7b0('0x1'));var zipdir=require(_0xa7b0('0x2'));var jsonpatch=require(_0xa7b0('0x3'));var rp=require(_0xa7b0('0x4'));var moment=require(_0xa7b0('0x5'));var BPromise=require(_0xa7b0('0x6'));var Mustache=require('mustache');var util=require(_0xa7b0('0x7'));var path=require(_0xa7b0('0x8'));var sox=require(_0xa7b0('0x9'));var csv=require(_0xa7b0('0xa'));var ejs=require(_0xa7b0('0xb'));var fs=require('fs');var fs_extra=require(_0xa7b0('0xc'));var _=require(_0xa7b0('0xd'));var squel=require('squel');var crypto=require(_0xa7b0('0xe'));var jsforce=require(_0xa7b0('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xa7b0('0xa'));var querystring=require(_0xa7b0('0x10'));var Papa=require(_0xa7b0('0x11'));var Redis=require('ioredis');var authService=require(_0xa7b0('0x12'));var qs=require(_0xa7b0('0x13'));var as=require(_0xa7b0('0x14'));var hardwareService=require(_0xa7b0('0x15'));var logger=require(_0xa7b0('0x16'))('api');var utils=require(_0xa7b0('0x17'));var config=require(_0xa7b0('0x18'));var licenseUtil=require(_0xa7b0('0x19'));var db=require(_0xa7b0('0x1a'))['db'];function respondWithStatusCode(_0x5952fa,_0x43f814){_0x43f814=_0x43f814||0xcc;return function(_0x563b4f){if(_0x563b4f){return _0x5952fa[_0xa7b0('0x1b')](_0x43f814);}return _0x5952fa['status'](_0x43f814)[_0xa7b0('0x1c')]();};}function respondWithResult(_0x2b3a56,_0x2727be){_0x2727be=_0x2727be||0xc8;return function(_0x242ce2){if(_0x242ce2){return _0x2b3a56[_0xa7b0('0x1d')](_0x2727be)['json'](_0x242ce2);}};}function respondWithFilteredResult(_0x3f070b,_0x1621db){return function(_0x23a1c0){if(_0x23a1c0){var _0x4b2378=typeof _0x1621db[_0xa7b0('0x1e')]==='undefined'&&typeof _0x1621db[_0xa7b0('0x1f')]===_0xa7b0('0x20');var _0x2d7851=_0x23a1c0[_0xa7b0('0x21')];var _0x8deec8=_0x4b2378?0x0:_0x1621db[_0xa7b0('0x1e')];var _0x10ba31=_0x4b2378?_0x23a1c0['count']:_0x1621db['offset']+_0x1621db[_0xa7b0('0x1f')];var _0x2c1182;if(_0x10ba31>=_0x2d7851){_0x10ba31=_0x2d7851;_0x2c1182=0xc8;}else{_0x2c1182=0xce;}_0x3f070b['status'](_0x2c1182);return _0x3f070b[_0xa7b0('0x22')](_0xa7b0('0x23'),_0x8deec8+'-'+_0x10ba31+'/'+_0x2d7851)[_0xa7b0('0x24')](_0x23a1c0);}return null;};}function patchUpdates(_0x132ffb){return function(_0x698c70){try{jsonpatch[_0xa7b0('0x25')](_0x698c70,_0x132ffb,!![]);}catch(_0x312404){return BPromise['reject'](_0x312404);}return _0x698c70[_0xa7b0('0x26')]();};}function saveUpdates(_0x2a7ed3,_0x225b4e){return function(_0x39c564){if(_0x39c564){return _0x39c564[_0xa7b0('0x27')](_0x2a7ed3)['then'](function(_0x5d6460){return _0x5d6460;});}return null;};}function removeEntity(_0x5ad1b0,_0x1c194c){return function(_0x3f43d5){if(_0x3f43d5){return _0x3f43d5[_0xa7b0('0x28')]()[_0xa7b0('0x29')](function(){_0x5ad1b0[_0xa7b0('0x1d')](0xcc)[_0xa7b0('0x1c')]();});}};}function handleEntityNotFound(_0x4139e0,_0x4bc88c){return function(_0x64188e){if(!_0x64188e){_0x4139e0[_0xa7b0('0x1b')](0x194);}return _0x64188e;};}function handleError(_0x1f2378,_0x3cee2e){_0x3cee2e=_0x3cee2e||0x1f4;return function(_0x411a38){logger[_0xa7b0('0x2a')](_0x411a38[_0xa7b0('0x2b')]);if(_0x411a38[_0xa7b0('0x2c')]){delete _0x411a38[_0xa7b0('0x2c')];}_0x1f2378['status'](_0x3cee2e)[_0xa7b0('0x2d')](_0x411a38);};}exports[_0xa7b0('0x2e')]=function(_0x3fda69,_0x31662d){var _0x2236cc={},_0x322c89={},_0x29d264={'count':0x0,'rows':[]};var _0x4c89a0=_['map'](db['UserProfileSection'][_0xa7b0('0x2f')],function(_0x57eeda){return{'name':_0x57eeda[_0xa7b0('0x30')],'type':_0x57eeda['type'][_0xa7b0('0x31')]};});_0x322c89[_0xa7b0('0x32')]=_['map'](_0x4c89a0,_0xa7b0('0x2c'));_0x322c89[_0xa7b0('0x33')]=_[_0xa7b0('0x34')](_0x3fda69[_0xa7b0('0x33')]);_0x322c89[_0xa7b0('0x35')]=_[_0xa7b0('0x36')](_0x322c89['model'],_0x322c89['query']);_0x2236cc['attributes']=_['intersection'](_0x322c89['model'],qs['fields'](_0x3fda69[_0xa7b0('0x33')][_0xa7b0('0x37')]));_0x2236cc['attributes']=_0x2236cc[_0xa7b0('0x38')][_0xa7b0('0x39')]?_0x2236cc['attributes']:_0x322c89[_0xa7b0('0x32')];if(!_0x3fda69[_0xa7b0('0x33')]['hasOwnProperty']('nolimit')){_0x2236cc[_0xa7b0('0x1f')]=qs[_0xa7b0('0x1f')](_0x3fda69[_0xa7b0('0x33')]['limit']);_0x2236cc[_0xa7b0('0x1e')]=qs['offset'](_0x3fda69[_0xa7b0('0x33')][_0xa7b0('0x1e')]);}_0x2236cc[_0xa7b0('0x3a')]=qs[_0xa7b0('0x3b')](_0x3fda69[_0xa7b0('0x33')][_0xa7b0('0x3b')]);_0x2236cc[_0xa7b0('0x3c')]=qs['filters'](_['pick'](_0x3fda69['query'],_0x322c89[_0xa7b0('0x35')]),_0x4c89a0);if(_0x3fda69[_0xa7b0('0x33')][_0xa7b0('0x3d')]){_0x2236cc[_0xa7b0('0x3c')]=_[_0xa7b0('0x3e')](_0x2236cc[_0xa7b0('0x3c')],{'$or':_[_0xa7b0('0x3f')](_0x4c89a0,function(_0x106ee1){if(_0x106ee1[_0xa7b0('0x40')]!==_0xa7b0('0x41')){var _0x3483af={};_0x3483af[_0x106ee1['name']]={'$like':'%'+_0x3fda69[_0xa7b0('0x33')][_0xa7b0('0x3d')]+'%'};return _0x3483af;}})});}_0x2236cc=_['merge']({},_0x2236cc,_0x3fda69[_0xa7b0('0x42')]);var _0x3963dc={'where':_0x2236cc[_0xa7b0('0x3c')]};return db['UserProfileSection']['count'](_0x3963dc)[_0xa7b0('0x29')](function(_0x14b096){_0x29d264[_0xa7b0('0x21')]=_0x14b096;if(_0x3fda69['query'][_0xa7b0('0x43')]){_0x2236cc[_0xa7b0('0x44')]=[{'all':!![]}];}return db['UserProfileSection'][_0xa7b0('0x45')](_0x2236cc);})['then'](function(_0x48e620){_0x29d264[_0xa7b0('0x46')]=_0x48e620;return _0x29d264;})[_0xa7b0('0x29')](respondWithFilteredResult(_0x31662d,_0x2236cc))[_0xa7b0('0x47')](handleError(_0x31662d,null));};exports[_0xa7b0('0x48')]=function(_0x1ba6ea,_0x385ea3){var _0x3b6ec5={'raw':![],'where':{'id':_0x1ba6ea[_0xa7b0('0x49')]['id']}},_0x41192f={};_0x41192f[_0xa7b0('0x32')]=_[_0xa7b0('0x34')](db['UserProfileSection'][_0xa7b0('0x2f')]);_0x41192f[_0xa7b0('0x33')]=_[_0xa7b0('0x34')](_0x1ba6ea[_0xa7b0('0x33')]);_0x41192f['filters']=_[_0xa7b0('0x36')](_0x41192f[_0xa7b0('0x32')],_0x41192f['query']);_0x3b6ec5[_0xa7b0('0x38')]=_[_0xa7b0('0x36')](_0x41192f[_0xa7b0('0x32')],qs[_0xa7b0('0x37')](_0x1ba6ea['query']['fields']));_0x3b6ec5['attributes']=_0x3b6ec5['attributes'][_0xa7b0('0x39')]?_0x3b6ec5[_0xa7b0('0x38')]:_0x41192f[_0xa7b0('0x32')];if(_0x1ba6ea[_0xa7b0('0x33')][_0xa7b0('0x43')]){_0x3b6ec5[_0xa7b0('0x44')]=[{'all':!![]}];}_0x3b6ec5=_[_0xa7b0('0x3e')]({},_0x3b6ec5,_0x1ba6ea[_0xa7b0('0x42')]);return db[_0xa7b0('0x4a')][_0xa7b0('0x4b')](_0x3b6ec5)[_0xa7b0('0x29')](handleEntityNotFound(_0x385ea3,null))[_0xa7b0('0x29')](respondWithResult(_0x385ea3,null))[_0xa7b0('0x47')](handleError(_0x385ea3,null));};exports['create']=function(_0x1aca88,_0x5cba9e){return db[_0xa7b0('0x4a')][_0xa7b0('0x4c')](_0x1aca88['body'],{})['then'](respondWithResult(_0x5cba9e,0xc9))[_0xa7b0('0x47')](handleError(_0x5cba9e,null));};exports[_0xa7b0('0x27')]=function(_0x4ad5b7,_0x28885b){if(_0x4ad5b7[_0xa7b0('0x4d')]['id']){delete _0x4ad5b7['body']['id'];}return db['UserProfileSection']['find']({'where':{'id':_0x4ad5b7[_0xa7b0('0x49')]['id']}})[_0xa7b0('0x29')](handleEntityNotFound(_0x28885b,null))[_0xa7b0('0x29')](saveUpdates(_0x4ad5b7[_0xa7b0('0x4d')],null))['then'](respondWithResult(_0x28885b,null))[_0xa7b0('0x47')](handleError(_0x28885b,null));};exports[_0xa7b0('0x28')]=function(_0x52dd6b,_0x3b46f0){return db[_0xa7b0('0x4a')][_0xa7b0('0x4b')]({'where':{'id':_0x52dd6b[_0xa7b0('0x49')]['id']}})[_0xa7b0('0x29')](handleEntityNotFound(_0x3b46f0,null))[_0xa7b0('0x29')](removeEntity(_0x3b46f0,null))[_0xa7b0('0x47')](handleError(_0x3b46f0,null));};exports[_0xa7b0('0x4e')]=function(_0x45ac48,_0x45afbf){return db[_0xa7b0('0x4a')]['describe']()[_0xa7b0('0x29')](respondWithResult(_0x45afbf,null))[_0xa7b0('0x47')](handleError(_0x45afbf,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index 85fa38c..a1808a2 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 _0x27ee=['util','../../config/logger','api','moment','bluebird','path','rimraf','./userProfileSection.attributes','exports','define','user_profile_has_sections','compositeIndex','sectionId','lodash'];(function(_0x3360d5,_0x212ac0){var _0x51ebce=function(_0xdefe5d){while(--_0xdefe5d){_0x3360d5['push'](_0x3360d5['shift']());}};_0x51ebce(++_0x212ac0);}(_0x27ee,0x195));var _0xe27e=function(_0x8b8d25,_0x24f0de){_0x8b8d25=_0x8b8d25-0x0;var _0xb4de07=_0x27ee[_0x8b8d25];return _0xb4de07;};'use strict';var _=require(_0xe27e('0x0'));var util=require(_0xe27e('0x1'));var logger=require(_0xe27e('0x2'))(_0xe27e('0x3'));var moment=require(_0xe27e('0x4'));var BPromise=require(_0xe27e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe27e('0x6'));var rimraf=require(_0xe27e('0x7'));var config=require('../../config/environment');var attributes=require(_0xe27e('0x8'));module[_0xe27e('0x9')]=function(_0x1f5651,_0x3ca559){return _0x1f5651[_0xe27e('0xa')]('UserProfileSection',attributes,{'tableName':_0xe27e('0xb'),'paranoid':![],'indexes':[{'name':_0xe27e('0xc'),'fields':[_0xe27e('0xd'),'userProfileId']}],'timestamps':!![]});}; \ No newline at end of file +var _0x65ad=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userProfileSection.attributes','define','UserProfileSection','compositeIndex','sectionId','userProfileId','lodash','../../config/logger'];(function(_0x209abe,_0x347fb3){var _0x347a56=function(_0x168497){while(--_0x168497){_0x209abe['push'](_0x209abe['shift']());}};_0x347a56(++_0x347fb3);}(_0x65ad,0x193));var _0xd65a=function(_0x1fda4b,_0x5a4dfe){_0x1fda4b=_0x1fda4b-0x0;var _0x2532d6=_0x65ad[_0x1fda4b];return _0x2532d6;};'use strict';var _=require(_0xd65a('0x0'));var util=require('util');var logger=require(_0xd65a('0x1'))(_0xd65a('0x2'));var moment=require(_0xd65a('0x3'));var BPromise=require(_0xd65a('0x4'));var rp=require(_0xd65a('0x5'));var fs=require('fs');var path=require(_0xd65a('0x6'));var rimraf=require(_0xd65a('0x7'));var config=require(_0xd65a('0x8'));var attributes=require(_0xd65a('0x9'));module['exports']=function(_0x4ac8fe,_0x20e437){return _0x4ac8fe[_0xd65a('0xa')](_0xd65a('0xb'),attributes,{'tableName':'user_profile_has_sections','paranoid':![],'indexes':[{'name':_0xd65a('0xc'),'fields':[_0xd65a('0xd'),_0xd65a('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index 87a5daa..d419efb 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 _0x8768=['error','UserProfileSection,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x8768,0x78));var _0x8876=function(_0x5516cb,_0x93dc8){_0x5516cb=_0x5516cb-0x0;var _0x76ce3d=_0x8768[_0x5516cb];return _0x76ce3d;};'use strict';var _=require(_0x8876('0x0'));var util=require(_0x8876('0x1'));var moment=require(_0x8876('0x2'));var BPromise=require(_0x8876('0x3'));var rs=require(_0x8876('0x4'));var fs=require('fs');var Redis=require(_0x8876('0x5'));var db=require(_0x8876('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x8876('0x7'));var config=require(_0x8876('0x8'));var jayson=require(_0x8876('0x9'));var client=jayson[_0x8876('0xa')][_0x8876('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1f46af,_0x2d537f,_0x1d2ab8){return new BPromise(function(_0x102381,_0x8e0ea8){return client[_0x8876('0xc')](_0x1f46af,_0x1d2ab8)[_0x8876('0xd')](function(_0x158f78){logger[_0x8876('0xe')]('UserProfileSection,\x20%s,\x20%s',_0x2d537f,_0x8876('0xf'));logger['debug'](_0x8876('0x10'),_0x2d537f,'request\x20sent',JSON[_0x8876('0x11')](_0x158f78));if(_0x158f78[_0x8876('0x12')]){if(_0x158f78[_0x8876('0x12')]['code']===0x1f4){logger[_0x8876('0x12')](_0x8876('0x13'),_0x2d537f,_0x158f78[_0x8876('0x12')][_0x8876('0x14')]);return _0x8e0ea8(_0x158f78['error'][_0x8876('0x14')]);}logger[_0x8876('0x12')](_0x8876('0x13'),_0x2d537f,_0x158f78[_0x8876('0x12')][_0x8876('0x14')]);return _0x102381(_0x158f78['error'][_0x8876('0x14')]);}else{logger[_0x8876('0xe')](_0x8876('0x13'),_0x2d537f,_0x8876('0xf'));_0x102381(_0x158f78[_0x8876('0x15')]['message']);}})[_0x8876('0x16')](function(_0x2dc3e9){logger['error']('UserProfileSection,\x20%s,\x20%s',_0x2d537f,_0x2dc3e9);_0x8e0ea8(_0x2dc3e9);});});} \ No newline at end of file +var _0x6697=['jayson/promise','client','http','request','then','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment'];(function(_0x297fd3,_0x115406){var _0x2af381=function(_0x1dd31b){while(--_0x1dd31b){_0x297fd3['push'](_0x297fd3['shift']());}};_0x2af381(++_0x115406);}(_0x6697,0x10c));var _0x7669=function(_0x14df7f,_0x12da2c){_0x14df7f=_0x14df7f-0x0;var _0x36ee87=_0x6697[_0x14df7f];return _0x36ee87;};'use strict';var _=require('lodash');var util=require(_0x7669('0x0'));var moment=require(_0x7669('0x1'));var BPromise=require(_0x7669('0x2'));var rs=require(_0x7669('0x3'));var fs=require('fs');var Redis=require(_0x7669('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x7669('0x5'));var logger=require(_0x7669('0x6'))('rpc');var config=require(_0x7669('0x7'));var jayson=require(_0x7669('0x8'));var client=jayson[_0x7669('0x9')][_0x7669('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4d22ca,_0x451707,_0x3e3f15){return new BPromise(function(_0x4c76f1,_0x2d5d87){return client[_0x7669('0xb')](_0x4d22ca,_0x3e3f15)[_0x7669('0xc')](function(_0x43f63c){logger[_0x7669('0xd')](_0x7669('0xe'),_0x451707,_0x7669('0xf'));logger['debug'](_0x7669('0x10'),_0x451707,_0x7669('0xf'),JSON[_0x7669('0x11')](_0x43f63c));if(_0x43f63c[_0x7669('0x12')]){if(_0x43f63c[_0x7669('0x12')][_0x7669('0x13')]===0x1f4){logger['error'](_0x7669('0xe'),_0x451707,_0x43f63c[_0x7669('0x12')][_0x7669('0x14')]);return _0x2d5d87(_0x43f63c['error'][_0x7669('0x14')]);}logger[_0x7669('0x12')](_0x7669('0xe'),_0x451707,_0x43f63c[_0x7669('0x12')][_0x7669('0x14')]);return _0x4c76f1(_0x43f63c[_0x7669('0x12')][_0x7669('0x14')]);}else{logger[_0x7669('0xd')]('UserProfileSection,\x20%s,\x20%s',_0x451707,_0x7669('0xf'));_0x4c76f1(_0x43f63c[_0x7669('0x15')][_0x7669('0x14')]);}})[_0x7669('0x16')](function(_0x2d316f){logger['error'](_0x7669('0xe'),_0x451707,_0x2d316f);_0x2d5d87(_0x2d316f);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index 48e047b..3c3d0f0 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(_0x2571b6,_0x5c0362){var _0x46f6e1=function(_0x538a4c){while(--_0x538a4c){_0x2571b6['push'](_0x2571b6['shift']());}};_0x46f6e1(++_0x5c0362);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x39cd3c,_0xa21102){_0x39cd3c=_0x39cd3c-0x0;var _0x47a0ae=_0xcb91[_0x39cd3c];return _0x47a0ae;};'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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x47c701,_0x2518c6){var _0x45aee1=function(_0x4c950f){while(--_0x4c950f){_0x47c701['push'](_0x47c701['shift']());}};_0x45aee1(++_0x2518c6);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index f874688..f7baa75 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 _0xbb57=['INTEGER','exports'];(function(_0x530a37,_0x524809){var _0x1b19f8=function(_0x5a834e){while(--_0x5a834e){_0x530a37['push'](_0x530a37['shift']());}};_0x1b19f8(++_0x524809);}(_0xbb57,0xc3));var _0x7bb5=function(_0x58a6b0,_0x5abbd1){_0x58a6b0=_0x58a6b0-0x0;var _0x1e2135=_0xbb57[_0x58a6b0];return _0x1e2135;};'use strict';var Sequelize=require('sequelize');module[_0x7bb5('0x0')]={'penalty':{'type':Sequelize[_0x7bb5('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xd114=['exports','INTEGER','sequelize'];(function(_0x1da527,_0x2dc953){var _0x40fc7c=function(_0x9949f5){while(--_0x9949f5){_0x1da527['push'](_0x1da527['shift']());}};_0x40fc7c(++_0x2dc953);}(_0xd114,0xd7));var _0x4d11=function(_0x394f0b,_0x420681){_0x394f0b=_0x394f0b-0x0;var _0x23e65b=_0xd114[_0x394f0b];return _0x23e65b;};'use strict';var Sequelize=require(_0x4d11('0x0'));module[_0x4d11('0x1')]={'penalty':{'type':Sequelize[_0x4d11('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 0f8ba09..09accd1 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 _0xf2e3=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userSmsQueue.attributes','define','UserSmsQueue','user_has_sms_queues','lodash'];(function(_0x5a7e59,_0x47e42f){var _0x1c6465=function(_0x55e802){while(--_0x55e802){_0x5a7e59['push'](_0x5a7e59['shift']());}};_0x1c6465(++_0x47e42f);}(_0xf2e3,0x9b));var _0x3f2e=function(_0x263a74,_0xc31414){_0x263a74=_0x263a74-0x0;var _0x2aa86c=_0xf2e3[_0x263a74];return _0x2aa86c;};'use strict';var _=require(_0x3f2e('0x0'));var util=require('util');var logger=require(_0x3f2e('0x1'))(_0x3f2e('0x2'));var moment=require(_0x3f2e('0x3'));var BPromise=require(_0x3f2e('0x4'));var rp=require(_0x3f2e('0x5'));var fs=require('fs');var path=require(_0x3f2e('0x6'));var rimraf=require(_0x3f2e('0x7'));var config=require(_0x3f2e('0x8'));var attributes=require(_0x3f2e('0x9'));module['exports']=function(_0x33a3b7,_0xdd6b3e){return _0x33a3b7[_0x3f2e('0xa')](_0x3f2e('0xb'),attributes,{'tableName':_0x3f2e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xce68=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./userSmsQueue.attributes','user_has_sms_queues','lodash','../../config/logger'];(function(_0x48373f,_0x319cfb){var _0x4c4da3=function(_0x35ead8){while(--_0x35ead8){_0x48373f['push'](_0x48373f['shift']());}};_0x4c4da3(++_0x319cfb);}(_0xce68,0x10c));var _0x8ce6=function(_0x168ec3,_0x41697a){_0x168ec3=_0x168ec3-0x0;var _0x3351ee=_0xce68[_0x168ec3];return _0x3351ee;};'use strict';var _=require(_0x8ce6('0x0'));var util=require('util');var logger=require(_0x8ce6('0x1'))(_0x8ce6('0x2'));var moment=require(_0x8ce6('0x3'));var BPromise=require(_0x8ce6('0x4'));var rp=require(_0x8ce6('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8ce6('0x6'));var config=require(_0x8ce6('0x7'));var attributes=require(_0x8ce6('0x8'));module['exports']=function(_0x116e0a,_0x10b3ca){return _0x116e0a['define']('UserSmsQueue',attributes,{'tableName':_0x8ce6('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.rpc.js b/server/api/userSmsQueue/userSmsQueue.rpc.js index 2e0e5db..6ff37e7 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 _0x0b71=['result','catch','lodash','util','moment','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x41b1f7,_0x456fb7){var _0x5704f6=function(_0x3cc2b4){while(--_0x3cc2b4){_0x41b1f7['push'](_0x41b1f7['shift']());}};_0x5704f6(++_0x456fb7);}(_0x0b71,0x156));var _0x10b7=function(_0x36921f,_0x3d8888){_0x36921f=_0x36921f-0x0;var _0x2a20bb=_0x0b71[_0x36921f];return _0x2a20bb;};'use strict';var _=require(_0x10b7('0x0'));var util=require(_0x10b7('0x1'));var moment=require(_0x10b7('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x10b7('0x3'))['db'];var utils=require(_0x10b7('0x4'));var logger=require('../../config/logger')(_0x10b7('0x5'));var config=require(_0x10b7('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x10b7('0x7')][_0x10b7('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x19e0e0,_0x3e563b,_0x5bd010){return new BPromise(function(_0x175de3,_0x3460bb){return client[_0x10b7('0x9')](_0x19e0e0,_0x5bd010)['then'](function(_0x4fed07){logger[_0x10b7('0xa')](_0x10b7('0xb'),_0x3e563b,_0x10b7('0xc'));logger[_0x10b7('0xd')](_0x10b7('0xe'),_0x3e563b,_0x10b7('0xc'),JSON[_0x10b7('0xf')](_0x4fed07));if(_0x4fed07[_0x10b7('0x10')]){if(_0x4fed07['error']['code']===0x1f4){logger[_0x10b7('0x10')](_0x10b7('0xb'),_0x3e563b,_0x4fed07['error'][_0x10b7('0x11')]);return _0x3460bb(_0x4fed07['error'][_0x10b7('0x11')]);}logger[_0x10b7('0x10')](_0x10b7('0xb'),_0x3e563b,_0x4fed07['error'][_0x10b7('0x11')]);return _0x175de3(_0x4fed07[_0x10b7('0x10')][_0x10b7('0x11')]);}else{logger[_0x10b7('0xa')](_0x10b7('0xb'),_0x3e563b,_0x10b7('0xc'));_0x175de3(_0x4fed07[_0x10b7('0x12')][_0x10b7('0x11')]);}})[_0x10b7('0x13')](function(_0x1bef83){logger[_0x10b7('0x10')]('UserSmsQueue,\x20%s,\x20%s',_0x3e563b,_0x1bef83);_0x3460bb(_0x1bef83);});});} \ No newline at end of file +var _0xcf6b=['message','catch','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','info','request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','UserSmsQueue,\x20%s,\x20%s'];(function(_0x3c9654,_0x175ad4){var _0x52d79b=function(_0x44da0){while(--_0x44da0){_0x3c9654['push'](_0x3c9654['shift']());}};_0x52d79b(++_0x175ad4);}(_0xcf6b,0x1f0));var _0xbcf6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcf6b[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xbcf6('0x0'));var util=require('util');var moment=require(_0xbcf6('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbcf6('0x2'));var db=require(_0xbcf6('0x3'))['db'];var utils=require(_0xbcf6('0x4'));var logger=require(_0xbcf6('0x5'))(_0xbcf6('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xbcf6('0x7')][_0xbcf6('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5eb61d,_0x4dde71,_0x43baad){return new BPromise(function(_0x31f54a,_0x20ddc7){return client['request'](_0x5eb61d,_0x43baad)['then'](function(_0x2e0b0b){logger[_0xbcf6('0x9')]('UserSmsQueue,\x20%s,\x20%s',_0x4dde71,_0xbcf6('0xa'));logger[_0xbcf6('0xb')](_0xbcf6('0xc'),_0x4dde71,_0xbcf6('0xa'),JSON[_0xbcf6('0xd')](_0x2e0b0b));if(_0x2e0b0b['error']){if(_0x2e0b0b[_0xbcf6('0xe')][_0xbcf6('0xf')]===0x1f4){logger[_0xbcf6('0xe')](_0xbcf6('0x10'),_0x4dde71,_0x2e0b0b[_0xbcf6('0xe')][_0xbcf6('0x11')]);return _0x20ddc7(_0x2e0b0b['error'][_0xbcf6('0x11')]);}logger[_0xbcf6('0xe')](_0xbcf6('0x10'),_0x4dde71,_0x2e0b0b['error']['message']);return _0x31f54a(_0x2e0b0b[_0xbcf6('0xe')][_0xbcf6('0x11')]);}else{logger[_0xbcf6('0x9')]('UserSmsQueue,\x20%s,\x20%s',_0x4dde71,_0xbcf6('0xa'));_0x31f54a(_0x2e0b0b['result'][_0xbcf6('0x11')]);}})[_0xbcf6('0x12')](function(_0x37ed58){logger[_0xbcf6('0xe')]('UserSmsQueue,\x20%s,\x20%s',_0x4dde71,_0x37ed58);_0x20ddc7(_0x37ed58);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueue/index.js b/server/api/userVoiceQueue/index.js index c743d7a..055ea80 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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x3e6128,_0x2ad13a){var _0x3f7b58=function(_0x3995fa){while(--_0x3995fa){_0x3e6128['push'](_0x3e6128['shift']());}};_0x3f7b58(++_0x2ad13a);}(_0xe706,0xa3));var _0x6e70=function(_0x16af88,_0x1c6a15){_0x16af88=_0x16af88-0x0;var _0x376ddd=_0xe706[_0x16af88];return _0x376ddd;};'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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x3abf1f,_0x4d3894){var _0x3b3c47=function(_0x4ee124){while(--_0x4ee124){_0x3abf1f['push'](_0x3abf1f['shift']());}};_0x3b3c47(++_0x4d3894);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index 4873383..c0302e6 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 _0x820a=['exports','sequelize'];(function(_0x44d3f8,_0x42372c){var _0x3a0f01=function(_0x14d45e){while(--_0x14d45e){_0x44d3f8['push'](_0x44d3f8['shift']());}};_0x3a0f01(++_0x42372c);}(_0x820a,0x187));var _0xa820=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x820a[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xa820('0x0'));module[_0xa820('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x0549=['INTEGER','sequelize','exports'];(function(_0x34cca8,_0x1c11f8){var _0x1c5629=function(_0x30f336){while(--_0x30f336){_0x34cca8['push'](_0x34cca8['shift']());}};_0x1c5629(++_0x1c11f8);}(_0x0549,0x1a5));var _0x9054=function(_0x7edd0,_0x2323f5){_0x7edd0=_0x7edd0-0x0;var _0x227eb3=_0x0549[_0x7edd0];return _0x227eb3;};'use strict';var Sequelize=require(_0x9054('0x0'));module[_0x9054('0x1')]={'penalty':{'type':Sequelize[_0x9054('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 42e57e0..ebb5071 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 _0x390e=['UserVoiceQueue','user_has_voice_queues','lodash','util','../../config/logger','api','bluebird','rimraf','../../config/environment','exports','define'];(function(_0x2272b5,_0x362458){var _0x110156=function(_0x5c2e32){while(--_0x5c2e32){_0x2272b5['push'](_0x2272b5['shift']());}};_0x110156(++_0x362458);}(_0x390e,0xf4));var _0xe390=function(_0x320a7c,_0x43681b){_0x320a7c=_0x320a7c-0x0;var _0x2cd152=_0x390e[_0x320a7c];return _0x2cd152;};'use strict';var _=require(_0xe390('0x0'));var util=require(_0xe390('0x1'));var logger=require(_0xe390('0x2'))(_0xe390('0x3'));var moment=require('moment');var BPromise=require(_0xe390('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xe390('0x5'));var config=require(_0xe390('0x6'));var attributes=require('./userVoiceQueue.attributes');module[_0xe390('0x7')]=function(_0x36053c,_0x889bb7){return _0x36053c[_0xe390('0x8')](_0xe390('0x9'),attributes,{'tableName':_0xe390('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xeedd=['request-promise','rimraf','../../config/environment','UserVoiceQueue','user_has_voice_queues','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x3b36a8,_0x285c95){var _0x4cfb64=function(_0xe2a8f5){while(--_0xe2a8f5){_0x3b36a8['push'](_0x3b36a8['shift']());}};_0x4cfb64(++_0x285c95);}(_0xeedd,0x89));var _0xdeed=function(_0x2d4e64,_0x4de3e5){_0x2d4e64=_0x2d4e64-0x0;var _0x4b0541=_0xeedd[_0x2d4e64];return _0x4b0541;};'use strict';var _=require(_0xdeed('0x0'));var util=require(_0xdeed('0x1'));var logger=require(_0xdeed('0x2'))(_0xdeed('0x3'));var moment=require(_0xdeed('0x4'));var BPromise=require(_0xdeed('0x5'));var rp=require(_0xdeed('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xdeed('0x7'));var config=require(_0xdeed('0x8'));var attributes=require('./userVoiceQueue.attributes');module['exports']=function(_0x38f06c,_0x50b84d){return _0x38f06c['define'](_0xdeed('0x9'),attributes,{'tableName':_0xdeed('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.rpc.js b/server/api/userVoiceQueue/userVoiceQueue.rpc.js index c963e7d..421693e 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 _0x8641=['../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','UserVoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','UserVoiceQueue,\x20%s,\x20%s','message','result','catch','util','moment','ioredis','../../mysqldb'];(function(_0x45c856,_0x5e6a1e){var _0x4961aa=function(_0x29f14d){while(--_0x29f14d){_0x45c856['push'](_0x45c856['shift']());}};_0x4961aa(++_0x5e6a1e);}(_0x8641,0x8f));var _0x1864=function(_0x3bb21a,_0x353b56){_0x3bb21a=_0x3bb21a-0x0;var _0x5f3983=_0x8641[_0x3bb21a];return _0x5f3983;};'use strict';var _=require('lodash');var util=require(_0x1864('0x0'));var moment=require(_0x1864('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1864('0x2'));var db=require(_0x1864('0x3'))['db'];var utils=require(_0x1864('0x4'));var logger=require(_0x1864('0x5'))(_0x1864('0x6'));var config=require(_0x1864('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x1864('0x8')][_0x1864('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x24a2de,_0xb10859,_0x10162f){return new BPromise(function(_0x19c3a9,_0x2769e2){return client[_0x1864('0xa')](_0x24a2de,_0x10162f)[_0x1864('0xb')](function(_0x1fc57d){logger[_0x1864('0xc')]('UserVoiceQueue,\x20%s,\x20%s',_0xb10859,'request\x20sent');logger['debug'](_0x1864('0xd'),_0xb10859,_0x1864('0xe'),JSON['stringify'](_0x1fc57d));if(_0x1fc57d[_0x1864('0xf')]){if(_0x1fc57d['error'][_0x1864('0x10')]===0x1f4){logger['error'](_0x1864('0x11'),_0xb10859,_0x1fc57d[_0x1864('0xf')]['message']);return _0x2769e2(_0x1fc57d[_0x1864('0xf')][_0x1864('0x12')]);}logger[_0x1864('0xf')](_0x1864('0x11'),_0xb10859,_0x1fc57d[_0x1864('0xf')][_0x1864('0x12')]);return _0x19c3a9(_0x1fc57d[_0x1864('0xf')][_0x1864('0x12')]);}else{logger[_0x1864('0xc')](_0x1864('0x11'),_0xb10859,_0x1864('0xe'));_0x19c3a9(_0x1fc57d[_0x1864('0x13')][_0x1864('0x12')]);}})[_0x1864('0x14')](function(_0x4572cf){logger[_0x1864('0xf')](_0x1864('0x11'),_0xb10859,_0x4572cf);_0x2769e2(_0x4572cf);});});} \ No newline at end of file +var _0xfab7=['ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','randomstring'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xfab7,0xc4));var _0x7fab=function(_0x1c0ce8,_0x5c34cb){_0x1c0ce8=_0x1c0ce8-0x0;var _0x20430c=_0xfab7[_0x1c0ce8];return _0x20430c;};'use strict';var _=require(_0x7fab('0x0'));var util=require(_0x7fab('0x1'));var moment=require(_0x7fab('0x2'));var BPromise=require('bluebird');var rs=require(_0x7fab('0x3'));var fs=require('fs');var Redis=require(_0x7fab('0x4'));var db=require(_0x7fab('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x7fab('0x6'))(_0x7fab('0x7'));var config=require(_0x7fab('0x8'));var jayson=require(_0x7fab('0x9'));var client=jayson[_0x7fab('0xa')][_0x7fab('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x248fca,_0x3db4c0,_0x582926){return new BPromise(function(_0x119eb3,_0x23be05){return client[_0x7fab('0xc')](_0x248fca,_0x582926)[_0x7fab('0xd')](function(_0x28a4d3){logger[_0x7fab('0xe')](_0x7fab('0xf'),_0x3db4c0,_0x7fab('0x10'));logger[_0x7fab('0x11')](_0x7fab('0x12'),_0x3db4c0,'request\x20sent',JSON[_0x7fab('0x13')](_0x28a4d3));if(_0x28a4d3[_0x7fab('0x14')]){if(_0x28a4d3[_0x7fab('0x14')][_0x7fab('0x15')]===0x1f4){logger['error'](_0x7fab('0xf'),_0x3db4c0,_0x28a4d3[_0x7fab('0x14')][_0x7fab('0x16')]);return _0x23be05(_0x28a4d3['error'][_0x7fab('0x16')]);}logger[_0x7fab('0x14')](_0x7fab('0xf'),_0x3db4c0,_0x28a4d3['error']['message']);return _0x119eb3(_0x28a4d3[_0x7fab('0x14')][_0x7fab('0x16')]);}else{logger['info'](_0x7fab('0xf'),_0x3db4c0,'request\x20sent');_0x119eb3(_0x28a4d3[_0x7fab('0x17')][_0x7fab('0x16')]);}})[_0x7fab('0x18')](function(_0x3103e8){logger[_0x7fab('0x14')]('UserVoiceQueue,\x20%s,\x20%s',_0x3db4c0,_0x3103e8);_0x23be05(_0x3103e8);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index 134a04f..ea2ec6c 100644 --- a/server/api/userVoiceQueueRt/index.js +++ b/server/api/userVoiceQueueRt/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x1580f7,_0xf2b31c){var _0x2a5b4f=function(_0x3e8173){while(--_0x3e8173){_0x1580f7['push'](_0x1580f7['shift']());}};_0x2a5b4f(++_0xf2b31c);}(_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(_0x53a76c,_0x1bbef1){var _0x34dd68=function(_0x391a1b){while(--_0x391a1b){_0x53a76c['push'](_0x53a76c['shift']());}};_0x34dd68(++_0x1bbef1);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index b4f6cbc..95e94d5 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 _0x4032=['Required\x20by\x20Asterisk','STRING','sequelize','exports','INTEGER'];(function(_0x4de8b4,_0x155752){var _0x2eca03=function(_0x350a43){while(--_0x350a43){_0x4de8b4['push'](_0x4de8b4['shift']());}};_0x2eca03(++_0x155752);}(_0x4032,0x6b));var _0x2403=function(_0x2ed04b,_0x3c8f9a){_0x2ed04b=_0x2ed04b-0x0;var _0x3847ff=_0x4032[_0x2ed04b];return _0x3847ff;};'use strict';var Sequelize=require(_0x2403('0x0'));module[_0x2403('0x1')]={'uniqueid':{'type':Sequelize[_0x2403('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x2403('0x3')},'membername':{'type':Sequelize[_0x2403('0x4')],'allowNull':![],'comment':'Required\x20by\x20Asterisk'},'UserId':{'type':Sequelize[_0x2403('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'queue_interface','comment':'Required\x20by\x20Asterisk'},'VoiceQueueId':{'type':Sequelize[_0x2403('0x2')],'allowNull':![]},'interface':{'type':Sequelize[_0x2403('0x4')],'allowNull':![],'unique':'queue_interface','comment':_0x2403('0x3')},'penalty':{'type':Sequelize[_0x2403('0x2')](0xb),'defaultValue':0x0,'comment':_0x2403('0x3')},'paused':{'type':Sequelize[_0x2403('0x2')](0xb),'defaultValue':0x0,'comment':_0x2403('0x3')}}; \ No newline at end of file +var _0xcf30=['sequelize','exports','INTEGER','Required\x20by\x20Asterisk'];(function(_0x2a028d,_0x1eed2e){var _0xc254ab=function(_0xf46ced){while(--_0xf46ced){_0x2a028d['push'](_0x2a028d['shift']());}};_0xc254ab(++_0x1eed2e);}(_0xcf30,0x128));var _0x0cf3=function(_0x267ef8,_0x2d76a0){_0x267ef8=_0x267ef8-0x0;var _0x57033f=_0xcf30[_0x267ef8];return _0x57033f;};'use strict';var Sequelize=require(_0x0cf3('0x0'));module[_0x0cf3('0x1')]={'uniqueid':{'type':Sequelize[_0x0cf3('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x0cf3('0x3')},'membername':{'type':Sequelize['STRING'],'allowNull':![],'comment':_0x0cf3('0x3')},'UserId':{'type':Sequelize[_0x0cf3('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'queue_interface','comment':'Required\x20by\x20Asterisk'},'VoiceQueueId':{'type':Sequelize[_0x0cf3('0x2')],'allowNull':![]},'interface':{'type':Sequelize['STRING'],'allowNull':![],'unique':'queue_interface','comment':'Required\x20by\x20Asterisk'},'penalty':{'type':Sequelize[_0x0cf3('0x2')](0xb),'defaultValue':0x0,'comment':_0x0cf3('0x3')},'paused':{'type':Sequelize[_0x0cf3('0x2')](0xb),'defaultValue':0x0,'comment':_0x0cf3('0x3')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index 0d37836..7610a69 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 _0x6ff2=['update','emit','hasOwnProperty','hook','exports','events','setMaxListeners','save'];(function(_0x39707c,_0x2d5879){var _0x24e5dd=function(_0x558a7b){while(--_0x558a7b){_0x39707c['push'](_0x39707c['shift']());}};_0x24e5dd(++_0x2d5879);}(_0x6ff2,0x105));var _0x26ff=function(_0x52535e,_0x40e50b){_0x52535e=_0x52535e-0x0;var _0x2dc24c=_0x6ff2[_0x52535e];return _0x2dc24c;};'use strict';var EventEmitter=require(_0x26ff('0x0'));var UserVoiceQueueRt=require('../../mysqldb')['db']['UserVoiceQueueRt'];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x26ff('0x1')](0x0);var events={'afterCreate':_0x26ff('0x2'),'afterUpdate':_0x26ff('0x3'),'afterDestroy':'remove'};function emitEvent(_0x50b9cd){return function(_0x232e51,_0xbf0f92,_0x252672){UserVoiceQueueRtEvents[_0x26ff('0x4')](_0x50b9cd+':'+_0x232e51['id'],_0x232e51);UserVoiceQueueRtEvents[_0x26ff('0x4')](_0x50b9cd,_0x232e51);_0x252672(null);};}for(var e in events){if(events[_0x26ff('0x5')](e)){var event=events[e];UserVoiceQueueRt[_0x26ff('0x6')](e,emitEvent(event));}}module[_0x26ff('0x7')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0x2bca=['hasOwnProperty','hook','events','../../mysqldb','save','update','remove','emit'];(function(_0x296d25,_0x4c72bc){var _0x15643a=function(_0x14a672){while(--_0x14a672){_0x296d25['push'](_0x296d25['shift']());}};_0x15643a(++_0x4c72bc);}(_0x2bca,0x92));var _0xa2bc=function(_0x2d696b,_0x5a7666){_0x2d696b=_0x2d696b-0x0;var _0xc80ded=_0x2bca[_0x2d696b];return _0xc80ded;};'use strict';var EventEmitter=require(_0xa2bc('0x0'));var UserVoiceQueueRt=require(_0xa2bc('0x1'))['db']['UserVoiceQueueRt'];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xa2bc('0x2'),'afterUpdate':_0xa2bc('0x3'),'afterDestroy':_0xa2bc('0x4')};function emitEvent(_0x22ee63){return function(_0x577399,_0x14655c,_0x18a7ed){UserVoiceQueueRtEvents[_0xa2bc('0x5')](_0x22ee63+':'+_0x577399['id'],_0x577399);UserVoiceQueueRtEvents[_0xa2bc('0x5')](_0x22ee63,_0x577399);_0x18a7ed(null);};}for(var e in events){if(events[_0xa2bc('0x6')](e)){var event=events[e];UserVoiceQueueRt[_0xa2bc('0x7')](e,emitEvent(event));}}module['exports']=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index 2ad9f02..ccfbd6c 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 _0x930d=['./userVoiceQueueRt.attributes','exports','define','UserVoiceQueueRt','lodash','../../config/logger','api','moment','bluebird','path','../../config/environment'];(function(_0x324088,_0x945da8){var _0x726a0f=function(_0x4699e6){while(--_0x4699e6){_0x324088['push'](_0x324088['shift']());}};_0x726a0f(++_0x945da8);}(_0x930d,0x122));var _0xd930=function(_0x43de22,_0x1eced6){_0x43de22=_0x43de22-0x0;var _0x4b15ee=_0x930d[_0x43de22];return _0x4b15ee;};'use strict';var _=require(_0xd930('0x0'));var util=require('util');var logger=require(_0xd930('0x1'))(_0xd930('0x2'));var moment=require(_0xd930('0x3'));var BPromise=require(_0xd930('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd930('0x5'));var rimraf=require('rimraf');var config=require(_0xd930('0x6'));var attributes=require(_0xd930('0x7'));module[_0xd930('0x8')]=function(_0x4be848,_0x43bd0a){return _0x4be848[_0xd930('0x9')](_0xd930('0xa'),attributes,{'tableName':'user_has_voice_queues_rt','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xafb4=['user_has_voice_queues_rt','lodash','util','../../config/logger','api','path','rimraf','../../config/environment','./userVoiceQueueRt.attributes','exports','define','UserVoiceQueueRt'];(function(_0x2b1301,_0x433937){var _0x2ac04e=function(_0x4beb84){while(--_0x4beb84){_0x2b1301['push'](_0x2b1301['shift']());}};_0x2ac04e(++_0x433937);}(_0xafb4,0xc1));var _0x4afb=function(_0x326e46,_0x4f9354){_0x326e46=_0x326e46-0x0;var _0x51609c=_0xafb4[_0x326e46];return _0x51609c;};'use strict';var _=require(_0x4afb('0x0'));var util=require(_0x4afb('0x1'));var logger=require(_0x4afb('0x2'))(_0x4afb('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x4afb('0x4'));var rimraf=require(_0x4afb('0x5'));var config=require(_0x4afb('0x6'));var attributes=require(_0x4afb('0x7'));module[_0x4afb('0x8')]=function(_0x1dfe47,_0x34d2c7){return _0x1dfe47[_0x4afb('0x9')](_0x4afb('0xa'),attributes,{'tableName':_0x4afb('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js index 11d8d7c..dbf22f5 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 _0xb8e4=['sequelize','COUNT','literal','`paused`\x20=\x201,\x201,\x20null','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','redis','defaults','socket.io-emitter','./userVoiceQueueRt.socket','register','then','info','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','code','UserVoiceQueueRt,\x20%s,\x20%s','message','result','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','raw','where'];(function(_0x2c7618,_0x26be9c){var _0x5ce3f0=function(_0x1837b3){while(--_0x1837b3){_0x2c7618['push'](_0x2c7618['shift']());}};_0x5ce3f0(++_0x26be9c);}(_0xb8e4,0x12d));var _0x4b8e=function(_0x22af33,_0x578008){_0x22af33=_0x22af33-0x0;var _0x403f55=_0xb8e4[_0x22af33];return _0x403f55;};'use strict';var _=require(_0x4b8e('0x0'));var util=require(_0x4b8e('0x1'));var moment=require(_0x4b8e('0x2'));var BPromise=require(_0x4b8e('0x3'));var rs=require(_0x4b8e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4b8e('0x5'))['db'];var utils=require(_0x4b8e('0x6'));var logger=require(_0x4b8e('0x7'))('rpc');var config=require(_0x4b8e('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x4b8e('0x9')]({'port':0x232a});config[_0x4b8e('0xa')]=_[_0x4b8e('0xb')](config[_0x4b8e('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x4b8e('0xc'))(new Redis(config[_0x4b8e('0xa')]));require(_0x4b8e('0xd'))[_0x4b8e('0xe')](socket);function respondWithRpcPromise(_0x2b75e3,_0x19e5f0,_0x32aea8){return new BPromise(function(_0x6a6f9,_0x5da961){return client['request'](_0x2b75e3,_0x32aea8)[_0x4b8e('0xf')](function(_0xaad6ea){logger[_0x4b8e('0x10')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x19e5f0,_0x4b8e('0x11'));logger[_0x4b8e('0x12')](_0x4b8e('0x13'),_0x19e5f0,_0x4b8e('0x11'),JSON[_0x4b8e('0x14')](_0xaad6ea));if(_0xaad6ea[_0x4b8e('0x15')]){if(_0xaad6ea[_0x4b8e('0x15')][_0x4b8e('0x16')]===0x1f4){logger[_0x4b8e('0x15')](_0x4b8e('0x17'),_0x19e5f0,_0xaad6ea['error']['message']);return _0x5da961(_0xaad6ea[_0x4b8e('0x15')]['message']);}logger[_0x4b8e('0x15')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x19e5f0,_0xaad6ea[_0x4b8e('0x15')][_0x4b8e('0x18')]);return _0x6a6f9(_0xaad6ea['error'][_0x4b8e('0x18')]);}else{logger[_0x4b8e('0x10')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x19e5f0,_0x4b8e('0x11'));_0x6a6f9(_0xaad6ea[_0x4b8e('0x19')][_0x4b8e('0x18')]);}})['catch'](function(_0x32073b){logger[_0x4b8e('0x15')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x19e5f0,_0x32073b);_0x5da961(_0x32073b);});});}exports[_0x4b8e('0x1a')]=function(_0xc3f114){var _0x1d5b4f=this;return new Promise(function(_0x4fe8f9,_0x1461e0){return db[_0x4b8e('0x1b')][_0x4b8e('0x1c')]({'raw':_0xc3f114[_0x4b8e('0x1d')]?_0xc3f114[_0x4b8e('0x1d')][_0x4b8e('0x1e')]===undefined?!![]:![]:!![],'where':_0xc3f114[_0x4b8e('0x1d')]?_0xc3f114[_0x4b8e('0x1d')][_0x4b8e('0x1f')]||null:null,'attributes':[[db[_0x4b8e('0x20')]['fn'](_0x4b8e('0x21'),db[_0x4b8e('0x20')]['fn']('IF',db[_0x4b8e('0x20')][_0x4b8e('0x22')](_0x4b8e('0x23')))),'outboundQueuePauses']]})[_0x4b8e('0xf')](function(_0x51dacb){logger['info']('GetVoiceQueueRtPauses',_0xc3f114);logger[_0x4b8e('0x12')](_0x4b8e('0x1a'),_0xc3f114,JSON[_0x4b8e('0x14')](_0x51dacb));_0x4fe8f9(_0x51dacb);})[_0x4b8e('0x24')](function(_0xde7127){logger['error'](_0x4b8e('0x1a'),_0xde7127[_0x4b8e('0x18')],_0xc3f114);_0x1461e0(_0x1d5b4f['error'](0x1f4,_0xde7127[_0x4b8e('0x18')]));});});}; \ No newline at end of file +var _0x390a=['sequelize','COUNT','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','stringify','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','./userVoiceQueueRt.socket','register','request','then','info','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','error','code','UserVoiceQueueRt,\x20%s,\x20%s','message','catch','GetVoiceQueueRtPauses','findAll','options','raw'];(function(_0x7791d5,_0xdab65f){var _0x5ce288=function(_0x2b818d){while(--_0x2b818d){_0x7791d5['push'](_0x7791d5['shift']());}};_0x5ce288(++_0xdab65f);}(_0x390a,0x9a));var _0xa390=function(_0x336ad4,_0x44c545){_0x336ad4=_0x336ad4-0x0;var _0x1cbdd4=_0x390a[_0x336ad4];return _0x1cbdd4;};'use strict';var _=require(_0xa390('0x0'));var util=require(_0xa390('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xa390('0x2'));var fs=require('fs');var Redis=require(_0xa390('0x3'));var db=require(_0xa390('0x4'))['db'];var utils=require(_0xa390('0x5'));var logger=require(_0xa390('0x6'))(_0xa390('0x7'));var config=require(_0xa390('0x8'));var jayson=require(_0xa390('0x9'));var client=jayson['client'][_0xa390('0xa')]({'port':0x232a});config[_0xa390('0xb')]=_[_0xa390('0xc')](config[_0xa390('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xa390('0xd'))(new Redis(config[_0xa390('0xb')]));require(_0xa390('0xe'))[_0xa390('0xf')](socket);function respondWithRpcPromise(_0x950229,_0x57b17b,_0x24265f){return new BPromise(function(_0x1bffd3,_0x2c7fc1){return client[_0xa390('0x10')](_0x950229,_0x24265f)[_0xa390('0x11')](function(_0x2b31fb){logger[_0xa390('0x12')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x57b17b,_0xa390('0x13'));logger[_0xa390('0x14')](_0xa390('0x15'),_0x57b17b,_0xa390('0x13'),JSON['stringify'](_0x2b31fb));if(_0x2b31fb[_0xa390('0x16')]){if(_0x2b31fb[_0xa390('0x16')][_0xa390('0x17')]===0x1f4){logger['error'](_0xa390('0x18'),_0x57b17b,_0x2b31fb['error'][_0xa390('0x19')]);return _0x2c7fc1(_0x2b31fb[_0xa390('0x16')]['message']);}logger[_0xa390('0x16')](_0xa390('0x18'),_0x57b17b,_0x2b31fb[_0xa390('0x16')][_0xa390('0x19')]);return _0x1bffd3(_0x2b31fb[_0xa390('0x16')]['message']);}else{logger[_0xa390('0x12')](_0xa390('0x18'),_0x57b17b,_0xa390('0x13'));_0x1bffd3(_0x2b31fb['result']['message']);}})[_0xa390('0x1a')](function(_0x2c18a7){logger['error'](_0xa390('0x18'),_0x57b17b,_0x2c18a7);_0x2c7fc1(_0x2c18a7);});});}exports[_0xa390('0x1b')]=function(_0x2e7b7f){var _0x1ec151=this;return new Promise(function(_0x4815c3,_0x2c9945){return db['UserVoiceQueueRt'][_0xa390('0x1c')]({'raw':_0x2e7b7f[_0xa390('0x1d')]?_0x2e7b7f[_0xa390('0x1d')][_0xa390('0x1e')]===undefined?!![]:![]:!![],'where':_0x2e7b7f[_0xa390('0x1d')]?_0x2e7b7f[_0xa390('0x1d')]['where']||null:null,'attributes':[[db[_0xa390('0x1f')]['fn'](_0xa390('0x20'),db['sequelize']['fn']('IF',db['sequelize'][_0xa390('0x21')](_0xa390('0x22')))),_0xa390('0x23')]]})['then'](function(_0x510c04){logger['info']('GetVoiceQueueRtPauses',_0x2e7b7f);logger[_0xa390('0x14')](_0xa390('0x1b'),_0x2e7b7f,JSON[_0xa390('0x24')](_0x510c04));_0x4815c3(_0x510c04);})['catch'](function(_0x14d901){logger[_0xa390('0x16')](_0xa390('0x1b'),_0x14d901[_0xa390('0x19')],_0x2e7b7f);_0x2c9945(_0x1ec151['error'](0x1f4,_0x14d901[_0xa390('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index 4398618..9031f3f 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 _0x9a96=['userVoiceQueueRt:','./userVoiceQueueRt.events','save','remove','update','emit','removeListener','register','length'];(function(_0x2a4878,_0x30e394){var _0x343bd8=function(_0x3340a1){while(--_0x3340a1){_0x2a4878['push'](_0x2a4878['shift']());}};_0x343bd8(++_0x30e394);}(_0x9a96,0xd0));var _0x69a9=function(_0x505734,_0x35d4e8){_0x505734=_0x505734-0x0;var _0x2bf718=_0x9a96[_0x505734];return _0x2bf718;};'use strict';var UserVoiceQueueRtEvents=require(_0x69a9('0x0'));var events=[_0x69a9('0x1'),_0x69a9('0x2'),_0x69a9('0x3')];function createListener(_0x10bba3,_0x6ebe9b){return function(_0x5de2f6){_0x6ebe9b[_0x69a9('0x4')](_0x10bba3,_0x5de2f6);};}function removeListener(_0x303516,_0x2480e1){return function(){UserVoiceQueueRtEvents[_0x69a9('0x5')](_0x303516,_0x2480e1);};}exports[_0x69a9('0x6')]=function(_0x5a48bf){for(var _0x245072=0x0,_0x260fd3=events[_0x69a9('0x7')];_0x245072<_0x260fd3;_0x245072++){var _0x2306b8=events[_0x245072];var _0x49125f=createListener(_0x69a9('0x8')+_0x2306b8,_0x5a48bf);UserVoiceQueueRtEvents['on'](_0x2306b8,_0x49125f);}}; \ No newline at end of file +var _0xafc4=['register','length','userVoiceQueueRt:','./userVoiceQueueRt.events','remove','emit'];(function(_0x5c6299,_0x11bd28){var _0x23b564=function(_0x329ed6){while(--_0x329ed6){_0x5c6299['push'](_0x5c6299['shift']());}};_0x23b564(++_0x11bd28);}(_0xafc4,0x69));var _0x4afc=function(_0x30689c,_0x5642ec){_0x30689c=_0x30689c-0x0;var _0x2e90af=_0xafc4[_0x30689c];return _0x2e90af;};'use strict';var UserVoiceQueueRtEvents=require(_0x4afc('0x0'));var events=['save',_0x4afc('0x1'),'update'];function createListener(_0x10aede,_0x11789f){return function(_0x20e443){_0x11789f[_0x4afc('0x2')](_0x10aede,_0x20e443);};}function removeListener(_0x4d9dbd,_0x49f417){return function(){UserVoiceQueueRtEvents['removeListener'](_0x4d9dbd,_0x49f417);};}exports[_0x4afc('0x3')]=function(_0x471d45){for(var _0x16953b=0x0,_0x1bb281=events[_0x4afc('0x4')];_0x16953b<_0x1bb281;_0x16953b++){var _0xaf053d=events[_0x16953b];var _0x5e1e29=createListener(_0x4afc('0x5')+_0xaf053d,_0x471d45);UserVoiceQueueRtEvents['on'](_0xaf053d,_0x5e1e29);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index 3cfa739..659ee24 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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x27d354,_0x119482){var _0x843f5d=function(_0x36bbd6){while(--_0x36bbd6){_0x27d354['push'](_0x27d354['shift']());}};_0x843f5d(++_0x119482);}(_0xe706,0xa3));var _0x6e70=function(_0x209cc0,_0x59bb37){_0x209cc0=_0x209cc0-0x0;var _0x3c5029=_0xe706[_0x209cc0];return _0x3c5029;};'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 _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x287820,_0x35e696){var _0x4fa2=function(_0x1d9a0f){while(--_0x1d9a0f){_0x287820['push'](_0x287820['shift']());}};_0x4fa2(++_0x35e696);}(_0xedd9,0xfc));var _0x9edd=function(_0x3360f3,_0x344f01){_0x3360f3=_0x3360f3-0x0;var _0x45e856=_0xedd9[_0x3360f3];return _0x45e856;};'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/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index 75536e0..7cbd0d9 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 _0xb95d=['INTEGER','sequelize','exports'];(function(_0x162f57,_0x194f53){var _0x52b08e=function(_0x1323b5){while(--_0x1323b5){_0x162f57['push'](_0x162f57['shift']());}};_0x52b08e(++_0x194f53);}(_0xb95d,0x13f));var _0xdb95=function(_0x1479fa,_0x315d83){_0x1479fa=_0x1479fa-0x0;var _0x2c13d5=_0xb95d[_0x1479fa];return _0x2c13d5;};'use strict';var Sequelize=require(_0xdb95('0x0'));module[_0xdb95('0x1')]={'penalty':{'type':Sequelize[_0xdb95('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x7300=['INTEGER','sequelize','exports'];(function(_0xb8a1d5,_0x4b63d6){var _0xc4fc3d=function(_0x4a52e2){while(--_0x4a52e2){_0xb8a1d5['push'](_0xb8a1d5['shift']());}};_0xc4fc3d(++_0x4b63d6);}(_0x7300,0x181));var _0x0730=function(_0x48f25c,_0x56b755){_0x48f25c=_0x48f25c-0x0;var _0x49b6dd=_0x7300[_0x48f25c];return _0x49b6dd;};'use strict';var Sequelize=require(_0x0730('0x0'));module[_0x0730('0x1')]={'penalty':{'type':Sequelize[_0x0730('0x2')],'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 a9a2c17..ca1db2e 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 _0x1fe1=['user_has_whatsapp_queues','lodash','util','../../config/logger','moment','rimraf','../../config/environment','UserWhatsappQueue'];(function(_0x18ab2a,_0x4debcd){var _0x16dcee=function(_0x10107a){while(--_0x10107a){_0x18ab2a['push'](_0x18ab2a['shift']());}};_0x16dcee(++_0x4debcd);}(_0x1fe1,0x91));var _0x11fe=function(_0x22258c,_0x2d8e31){_0x22258c=_0x22258c-0x0;var _0x104b3e=_0x1fe1[_0x22258c];return _0x104b3e;};'use strict';var _=require(_0x11fe('0x0'));var util=require(_0x11fe('0x1'));var logger=require(_0x11fe('0x2'))('api');var moment=require(_0x11fe('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x11fe('0x4'));var config=require(_0x11fe('0x5'));var attributes=require('./userWhatsappQueue.attributes');module['exports']=function(_0x1b00ca,_0x3edf4b){return _0x1b00ca['define'](_0x11fe('0x6'),attributes,{'tableName':_0x11fe('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf3bf=['UserWhatsappQueue','user_has_whatsapp_queues','lodash','util','api','moment','path','rimraf','./userWhatsappQueue.attributes','exports'];(function(_0x46fd11,_0x314373){var _0x588aaf=function(_0x2494e7){while(--_0x2494e7){_0x46fd11['push'](_0x46fd11['shift']());}};_0x588aaf(++_0x314373);}(_0xf3bf,0x19c));var _0xff3b=function(_0x344252,_0x54404c){_0x344252=_0x344252-0x0;var _0x1b8ef2=_0xf3bf[_0x344252];return _0x1b8ef2;};'use strict';var _=require(_0xff3b('0x0'));var util=require(_0xff3b('0x1'));var logger=require('../../config/logger')(_0xff3b('0x2'));var moment=require(_0xff3b('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xff3b('0x4'));var rimraf=require(_0xff3b('0x5'));var config=require('../../config/environment');var attributes=require(_0xff3b('0x6'));module[_0xff3b('0x7')]=function(_0x12410b,_0x14c73b){return _0x12410b['define'](_0xff3b('0x8'),attributes,{'tableName':_0xff3b('0x9'),'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 d2ceb3b..40c6fe0 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 _0x134a=['message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','request','info','request\x20sent','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','UserWhatsappQueue,\x20%s,\x20%s'];(function(_0x285cf1,_0x47e330){var _0x2fea93=function(_0x4129d6){while(--_0x4129d6){_0x285cf1['push'](_0x285cf1['shift']());}};_0x2fea93(++_0x47e330);}(_0x134a,0xcb));var _0xa134=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x134a[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0xa134('0x0'));var moment=require(_0xa134('0x1'));var BPromise=require('bluebird');var rs=require(_0xa134('0x2'));var fs=require('fs');var Redis=require(_0xa134('0x3'));var db=require(_0xa134('0x4'))['db'];var utils=require(_0xa134('0x5'));var logger=require(_0xa134('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa134('0x7')][_0xa134('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1f1c00,_0xf32ef6,_0x1b5918){return new BPromise(function(_0x1ff134,_0x2f0d7f){return client[_0xa134('0x9')](_0x1f1c00,_0x1b5918)['then'](function(_0x20c712){logger[_0xa134('0xa')]('UserWhatsappQueue,\x20%s,\x20%s',_0xf32ef6,_0xa134('0xb'));logger[_0xa134('0xc')](_0xa134('0xd'),_0xf32ef6,_0xa134('0xb'),JSON[_0xa134('0xe')](_0x20c712));if(_0x20c712[_0xa134('0xf')]){if(_0x20c712['error']['code']===0x1f4){logger['error'](_0xa134('0x10'),_0xf32ef6,_0x20c712[_0xa134('0xf')][_0xa134('0x11')]);return _0x2f0d7f(_0x20c712[_0xa134('0xf')][_0xa134('0x11')]);}logger[_0xa134('0xf')]('UserWhatsappQueue,\x20%s,\x20%s',_0xf32ef6,_0x20c712[_0xa134('0xf')]['message']);return _0x1ff134(_0x20c712[_0xa134('0xf')]['message']);}else{logger['info']('UserWhatsappQueue,\x20%s,\x20%s',_0xf32ef6,_0xa134('0xb'));_0x1ff134(_0x20c712[_0xa134('0x12')][_0xa134('0x11')]);}})[_0xa134('0x13')](function(_0xda3cec){logger[_0xa134('0xf')](_0xa134('0x10'),_0xf32ef6,_0xda3cec);_0x2f0d7f(_0xda3cec);});});} \ No newline at end of file +var _0x4762=['jayson/promise','client','request','then','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x2a276d,_0x482b0c){var _0x2914cd=function(_0x452b8b){while(--_0x452b8b){_0x2a276d['push'](_0x2a276d['shift']());}};_0x2914cd(++_0x482b0c);}(_0x4762,0x1c5));var _0x2476=function(_0x1e4afa,_0x12e7df){_0x1e4afa=_0x1e4afa-0x0;var _0x7e494c=_0x4762[_0x1e4afa];return _0x7e494c;};'use strict';var _=require(_0x2476('0x0'));var util=require('util');var moment=require(_0x2476('0x1'));var BPromise=require(_0x2476('0x2'));var rs=require(_0x2476('0x3'));var fs=require('fs');var Redis=require(_0x2476('0x4'));var db=require(_0x2476('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x2476('0x6'))(_0x2476('0x7'));var config=require(_0x2476('0x8'));var jayson=require(_0x2476('0x9'));var client=jayson[_0x2476('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x73bd1c,_0x28d2a7,_0x5cc692){return new BPromise(function(_0x332bf7,_0x577eb8){return client[_0x2476('0xb')](_0x73bd1c,_0x5cc692)[_0x2476('0xc')](function(_0x7f53e8){logger['info'](_0x2476('0xd'),_0x28d2a7,_0x2476('0xe'));logger[_0x2476('0xf')]('UserWhatsappQueue,\x20%s,\x20%s,\x20%s',_0x28d2a7,_0x2476('0xe'),JSON[_0x2476('0x10')](_0x7f53e8));if(_0x7f53e8['error']){if(_0x7f53e8[_0x2476('0x11')]['code']===0x1f4){logger[_0x2476('0x11')]('UserWhatsappQueue,\x20%s,\x20%s',_0x28d2a7,_0x7f53e8[_0x2476('0x11')][_0x2476('0x12')]);return _0x577eb8(_0x7f53e8[_0x2476('0x11')]['message']);}logger[_0x2476('0x11')](_0x2476('0xd'),_0x28d2a7,_0x7f53e8[_0x2476('0x11')][_0x2476('0x12')]);return _0x332bf7(_0x7f53e8['error'][_0x2476('0x12')]);}else{logger[_0x2476('0x13')](_0x2476('0xd'),_0x28d2a7,'request\x20sent');_0x332bf7(_0x7f53e8[_0x2476('0x14')]['message']);}})['catch'](function(_0x5b1971){logger[_0x2476('0x11')](_0x2476('0xd'),_0x28d2a7,_0x5b1971);_0x577eb8(_0x5b1971);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index c15a147..7b39d6a 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 _0xb7a8=['express','Router','fs-extra','../../components/interaction/service','../../config/environment','./variable.controller','get','isAuthenticated','index','/:id','show','post','put','update','destroy','util','path'];(function(_0x2d98f1,_0x254499){var _0x5cbe38=function(_0x4f6b39){while(--_0x4f6b39){_0x2d98f1['push'](_0x2d98f1['shift']());}};_0x5cbe38(++_0x254499);}(_0xb7a8,0xec));var _0x8b7a=function(_0xb61f71,_0xcb78fd){_0xb61f71=_0xb61f71-0x0;var _0x3f2162=_0xb7a8[_0xb61f71];return _0x3f2162;};'use strict';var multer=require('multer');var util=require(_0x8b7a('0x0'));var path=require(_0x8b7a('0x1'));var timeout=require('connect-timeout');var express=require(_0x8b7a('0x2'));var router=express[_0x8b7a('0x3')]();var fs_extra=require(_0x8b7a('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x8b7a('0x5'));var config=require(_0x8b7a('0x6'));var controller=require(_0x8b7a('0x7'));router[_0x8b7a('0x8')]('/',auth[_0x8b7a('0x9')](),controller[_0x8b7a('0xa')]);router[_0x8b7a('0x8')](_0x8b7a('0xb'),auth[_0x8b7a('0x9')](),controller[_0x8b7a('0xc')]);router[_0x8b7a('0xd')]('/',auth[_0x8b7a('0x9')](),controller['create']);router[_0x8b7a('0xe')]('/:id',auth[_0x8b7a('0x9')](),controller[_0x8b7a('0xf')]);router['delete'](_0x8b7a('0xb'),auth[_0x8b7a('0x9')](),controller[_0x8b7a('0x10')]);module['exports']=router; \ No newline at end of file +var _0x3e9d=['put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../config/environment','./variable.controller','get','isAuthenticated','/:id','show','post','create'];(function(_0x4c7fb5,_0x2548ef){var _0x2e10ac=function(_0xf7e27c){while(--_0xf7e27c){_0x4c7fb5['push'](_0x4c7fb5['shift']());}};_0x2e10ac(++_0x2548ef);}(_0x3e9d,0x1ba));var _0xd3e9=function(_0x5172d9,_0x1dd6b8){_0x5172d9=_0x5172d9-0x0;var _0x541aa8=_0x3e9d[_0x5172d9];return _0x541aa8;};'use strict';var multer=require(_0xd3e9('0x0'));var util=require(_0xd3e9('0x1'));var path=require('path');var timeout=require(_0xd3e9('0x2'));var express=require(_0xd3e9('0x3'));var router=express[_0xd3e9('0x4')]();var fs_extra=require(_0xd3e9('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xd3e9('0x6'));var controller=require(_0xd3e9('0x7'));router[_0xd3e9('0x8')]('/',auth[_0xd3e9('0x9')](),controller['index']);router['get'](_0xd3e9('0xa'),auth[_0xd3e9('0x9')](),controller[_0xd3e9('0xb')]);router[_0xd3e9('0xc')]('/',auth[_0xd3e9('0x9')](),controller[_0xd3e9('0xd')]);router[_0xd3e9('0xe')]('/:id',auth[_0xd3e9('0x9')](),controller[_0xd3e9('0xf')]);router[_0xd3e9('0x10')](_0xd3e9('0xa'),auth[_0xd3e9('0x9')](),controller[_0xd3e9('0x11')]);module[_0xd3e9('0x12')]=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index a3474c0..cabde4b 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 _0x0e0d=['name','sequelize','exports'];(function(_0x102ac0,_0x142f22){var _0x322b9e=function(_0x45c5a1){while(--_0x45c5a1){_0x102ac0['push'](_0x102ac0['shift']());}};_0x322b9e(++_0x142f22);}(_0x0e0d,0x100));var _0xd0e0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0e0d[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xd0e0('0x0'));module[_0xd0e0('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xd0e0('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xeb1c=['exports','STRING','sequelize'];(function(_0x4c2f30,_0xa91340){var _0xb8854d=function(_0x5ddf3d){while(--_0x5ddf3d){_0x4c2f30['push'](_0x4c2f30['shift']());}};_0xb8854d(++_0xa91340);}(_0xeb1c,0x185));var _0xceb1=function(_0x32d66a,_0x22972d){_0x32d66a=_0x32d66a-0x0;var _0xd580fc=_0xeb1c[_0x32d66a];return _0xd580fc;};'use strict';var Sequelize=require(_0xceb1('0x0'));module[_0xceb1('0x1')]={'name':{'type':Sequelize[_0xceb1('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xceb1('0x2')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index 41304c5..dc85ca1 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 _0xb1c7=['request-promise','bluebird','mustache','util','sox','to-csv','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','limit','undefined','count','set','Content-Range','json','apply','save','update','then','Variables','UserProfileResource','destroy','end','error','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll','include','Variable','findAll','rows','catch','show','params','options','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x1548fa,_0x4e33d1){var _0x537ee5=function(_0x35862d){while(--_0x35862d){_0x1548fa['push'](_0x1548fa['shift']());}};_0x537ee5(++_0x4e33d1);}(_0xb1c7,0xa8));var _0x7b1c=function(_0x3b6648,_0x2d723a){_0x3b6648=_0x3b6648-0x0;var _0x5a0a0d=_0xb1c7[_0x3b6648];return _0x5a0a0d;};'use strict';var emlformat=require(_0x7b1c('0x0'));var rimraf=require(_0x7b1c('0x1'));var zipdir=require(_0x7b1c('0x2'));var jsonpatch=require(_0x7b1c('0x3'));var rp=require(_0x7b1c('0x4'));var moment=require('moment');var BPromise=require(_0x7b1c('0x5'));var Mustache=require(_0x7b1c('0x6'));var util=require(_0x7b1c('0x7'));var path=require('path');var sox=require(_0x7b1c('0x8'));var csv=require(_0x7b1c('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7b1c('0xa'));var _=require('lodash');var squel=require(_0x7b1c('0xb'));var crypto=require(_0x7b1c('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x7b1c('0xd'));var toCsv=require(_0x7b1c('0x9'));var querystring=require(_0x7b1c('0xe'));var Papa=require(_0x7b1c('0xf'));var Redis=require(_0x7b1c('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x7b1c('0x11'));var as=require(_0x7b1c('0x12'));var hardwareService=require(_0x7b1c('0x13'));var logger=require(_0x7b1c('0x14'))(_0x7b1c('0x15'));var utils=require('../../config/utils');var config=require(_0x7b1c('0x16'));var licenseUtil=require(_0x7b1c('0x17'));var db=require(_0x7b1c('0x18'))['db'];function respondWithStatusCode(_0x21e596,_0x572345){_0x572345=_0x572345||0xcc;return function(_0x65db47){if(_0x65db47){return _0x21e596[_0x7b1c('0x19')](_0x572345);}return _0x21e596[_0x7b1c('0x1a')](_0x572345)['end']();};}function respondWithResult(_0x932946,_0x2ddc51){_0x2ddc51=_0x2ddc51||0xc8;return function(_0x36aff3){if(_0x36aff3){return _0x932946[_0x7b1c('0x1a')](_0x2ddc51)['json'](_0x36aff3);}};}function respondWithFilteredResult(_0x4bd9a2,_0x515b83){return function(_0x250a67){if(_0x250a67){var _0x268073=typeof _0x515b83[_0x7b1c('0x1b')]==='undefined'&&typeof _0x515b83[_0x7b1c('0x1c')]===_0x7b1c('0x1d');var _0x514bf4=_0x250a67[_0x7b1c('0x1e')];var _0x340ca1=_0x268073?0x0:_0x515b83[_0x7b1c('0x1b')];var _0x5b5105=_0x268073?_0x250a67[_0x7b1c('0x1e')]:_0x515b83[_0x7b1c('0x1b')]+_0x515b83['limit'];var _0x4cfbbc;if(_0x5b5105>=_0x514bf4){_0x5b5105=_0x514bf4;_0x4cfbbc=0xc8;}else{_0x4cfbbc=0xce;}_0x4bd9a2[_0x7b1c('0x1a')](_0x4cfbbc);return _0x4bd9a2[_0x7b1c('0x1f')](_0x7b1c('0x20'),_0x340ca1+'-'+_0x5b5105+'/'+_0x514bf4)[_0x7b1c('0x21')](_0x250a67);}return null;};}function patchUpdates(_0x1df2c7){return function(_0x21b1c7){try{jsonpatch[_0x7b1c('0x22')](_0x21b1c7,_0x1df2c7,!![]);}catch(_0x56d2ee){return BPromise['reject'](_0x56d2ee);}return _0x21b1c7[_0x7b1c('0x23')]();};}function saveUpdates(_0x2ebf12,_0x552d54){return function(_0x15cf5f){if(_0x15cf5f){return _0x15cf5f[_0x7b1c('0x24')](_0x2ebf12)[_0x7b1c('0x25')](function(_0x3a1eeb){return _0x3a1eeb;});}return null;};}function removeEntity(_0x2cf63a,_0x37051e){return function(_0x525f1a){if(_0x525f1a){return _0x525f1a['destroy']()[_0x7b1c('0x25')](function(){var _0x204193=_0x525f1a['get']({'plain':!![]});var _0x30b14e=_0x7b1c('0x26');return db[_0x7b1c('0x27')][_0x7b1c('0x28')]({'where':{'type':_0x30b14e,'resourceId':_0x204193['id']}})['then'](function(){return _0x525f1a;});})[_0x7b1c('0x25')](function(){_0x2cf63a[_0x7b1c('0x1a')](0xcc)[_0x7b1c('0x29')]();});}};}function handleEntityNotFound(_0x223ba2,_0x3f2429){return function(_0xd415c6){if(!_0xd415c6){_0x223ba2[_0x7b1c('0x19')](0x194);}return _0xd415c6;};}function handleError(_0x28bf6e,_0x4d895a){_0x4d895a=_0x4d895a||0x1f4;return function(_0x580288){logger[_0x7b1c('0x2a')](_0x580288['stack']);if(_0x580288[_0x7b1c('0x2b')]){delete _0x580288[_0x7b1c('0x2b')];}_0x28bf6e['status'](_0x4d895a)[_0x7b1c('0x2c')](_0x580288);};}exports[_0x7b1c('0x2d')]=function(_0x16d92e,_0x3c1e0b){var _0x390651={},_0x57541b={},_0x51729d={'count':0x0,'rows':[]};var _0x215064=_[_0x7b1c('0x2e')](db['Variable'][_0x7b1c('0x2f')],function(_0x2d34f3){return{'name':_0x2d34f3[_0x7b1c('0x30')],'type':_0x2d34f3[_0x7b1c('0x31')][_0x7b1c('0x32')]};});_0x57541b[_0x7b1c('0x33')]=_[_0x7b1c('0x2e')](_0x215064,'name');_0x57541b[_0x7b1c('0x34')]=_[_0x7b1c('0x35')](_0x16d92e[_0x7b1c('0x34')]);_0x57541b[_0x7b1c('0x36')]=_[_0x7b1c('0x37')](_0x57541b[_0x7b1c('0x33')],_0x57541b[_0x7b1c('0x34')]);_0x390651[_0x7b1c('0x38')]=_[_0x7b1c('0x37')](_0x57541b[_0x7b1c('0x33')],qs[_0x7b1c('0x39')](_0x16d92e['query'][_0x7b1c('0x39')]));_0x390651[_0x7b1c('0x38')]=_0x390651[_0x7b1c('0x38')][_0x7b1c('0x3a')]?_0x390651[_0x7b1c('0x38')]:_0x57541b[_0x7b1c('0x33')];if(!_0x16d92e[_0x7b1c('0x34')]['hasOwnProperty'](_0x7b1c('0x3b'))){_0x390651[_0x7b1c('0x1c')]=qs[_0x7b1c('0x1c')](_0x16d92e[_0x7b1c('0x34')][_0x7b1c('0x1c')]);_0x390651['offset']=qs[_0x7b1c('0x1b')](_0x16d92e[_0x7b1c('0x34')][_0x7b1c('0x1b')]);}_0x390651[_0x7b1c('0x3c')]=qs['sort'](_0x16d92e['query'][_0x7b1c('0x3d')]);_0x390651[_0x7b1c('0x3e')]=qs[_0x7b1c('0x36')](_['pick'](_0x16d92e[_0x7b1c('0x34')],_0x57541b['filters']),_0x215064);if(_0x16d92e['query'][_0x7b1c('0x3f')]){_0x390651[_0x7b1c('0x3e')]=_[_0x7b1c('0x40')](_0x390651['where'],{'$or':_[_0x7b1c('0x2e')](_0x215064,function(_0x150433){if(_0x150433[_0x7b1c('0x31')]!==_0x7b1c('0x41')){var _0x34733a={};_0x34733a[_0x150433[_0x7b1c('0x2b')]]={'$like':'%'+_0x16d92e[_0x7b1c('0x34')][_0x7b1c('0x3f')]+'%'};return _0x34733a;}})});}_0x390651=_[_0x7b1c('0x40')]({},_0x390651,_0x16d92e['options']);var _0x5096ab={'where':_0x390651[_0x7b1c('0x3e')]};return db['Variable'][_0x7b1c('0x1e')](_0x5096ab)['then'](function(_0x243546){_0x51729d[_0x7b1c('0x1e')]=_0x243546;if(_0x16d92e[_0x7b1c('0x34')][_0x7b1c('0x42')]){_0x390651[_0x7b1c('0x43')]=[{'all':!![]}];}return db[_0x7b1c('0x44')][_0x7b1c('0x45')](_0x390651);})[_0x7b1c('0x25')](function(_0x29f816){_0x51729d[_0x7b1c('0x46')]=_0x29f816;return _0x51729d;})[_0x7b1c('0x25')](respondWithFilteredResult(_0x3c1e0b,_0x390651))[_0x7b1c('0x47')](handleError(_0x3c1e0b,null));};exports[_0x7b1c('0x48')]=function(_0x539533,_0x3ab909){var _0xefef1c={'raw':!![],'where':{'id':_0x539533[_0x7b1c('0x49')]['id']}},_0x33a524={};_0x33a524[_0x7b1c('0x33')]=_['keys'](db[_0x7b1c('0x44')][_0x7b1c('0x2f')]);_0x33a524['query']=_[_0x7b1c('0x35')](_0x539533['query']);_0x33a524[_0x7b1c('0x36')]=_[_0x7b1c('0x37')](_0x33a524[_0x7b1c('0x33')],_0x33a524['query']);_0xefef1c['attributes']=_['intersection'](_0x33a524['model'],qs[_0x7b1c('0x39')](_0x539533[_0x7b1c('0x34')][_0x7b1c('0x39')]));_0xefef1c['attributes']=_0xefef1c[_0x7b1c('0x38')][_0x7b1c('0x3a')]?_0xefef1c[_0x7b1c('0x38')]:_0x33a524[_0x7b1c('0x33')];if(_0x539533['query'][_0x7b1c('0x42')]){_0xefef1c[_0x7b1c('0x43')]=[{'all':!![]}];}_0xefef1c=_[_0x7b1c('0x40')]({},_0xefef1c,_0x539533[_0x7b1c('0x4a')]);return db['Variable'][_0x7b1c('0x4b')](_0xefef1c)[_0x7b1c('0x25')](handleEntityNotFound(_0x3ab909,null))[_0x7b1c('0x25')](respondWithResult(_0x3ab909,null))['catch'](handleError(_0x3ab909,null));};exports[_0x7b1c('0x4c')]=function(_0x143cde,_0x1cad87){return db[_0x7b1c('0x44')][_0x7b1c('0x4c')](_0x143cde[_0x7b1c('0x4d')],{})['then'](function(_0x5e1e4f){var _0x299561=_0x143cde[_0x7b1c('0x4e')][_0x7b1c('0x4f')]({'plain':!![]});if(!_0x299561)throw new Error(_0x7b1c('0x50'));if(_0x299561[_0x7b1c('0x51')]===_0x7b1c('0x4e')){var _0x4e2d0c=_0x5e1e4f[_0x7b1c('0x4f')]({'plain':!![]});var _0x4f0f51='Variables';return db[_0x7b1c('0x52')][_0x7b1c('0x4b')]({'where':{'name':_0x4f0f51,'userProfileId':_0x299561[_0x7b1c('0x53')]},'raw':!![]})[_0x7b1c('0x25')](function(_0x5b204b){if(_0x5b204b&&_0x5b204b[_0x7b1c('0x54')]===0x0){return db['UserProfileResource']['create']({'name':_0x4e2d0c['name'],'resourceId':_0x4e2d0c['id'],'type':_0x5b204b['name'],'sectionId':_0x5b204b['id']},{})[_0x7b1c('0x25')](function(){return _0x5e1e4f;});}else{return _0x5e1e4f;}})['catch'](function(_0x42d883){logger['error'](_0x7b1c('0x55'),_0x42d883);throw _0x42d883;});}return _0x5e1e4f;})[_0x7b1c('0x25')](respondWithResult(_0x1cad87,0xc9))['catch'](handleError(_0x1cad87,null));};exports[_0x7b1c('0x24')]=function(_0x1fc047,_0x194673){if(_0x1fc047[_0x7b1c('0x4d')]['id']){delete _0x1fc047[_0x7b1c('0x4d')]['id'];}return db['Variable'][_0x7b1c('0x4b')]({'where':{'id':_0x1fc047[_0x7b1c('0x49')]['id']}})['then'](handleEntityNotFound(_0x194673,null))[_0x7b1c('0x25')](saveUpdates(_0x1fc047['body'],null))[_0x7b1c('0x25')](respondWithResult(_0x194673,null))[_0x7b1c('0x47')](handleError(_0x194673,null));};exports[_0x7b1c('0x28')]=function(_0x502ae4,_0x411b85){return db[_0x7b1c('0x44')][_0x7b1c('0x4b')]({'where':{'id':_0x502ae4[_0x7b1c('0x49')]['id']}})['then'](handleEntityNotFound(_0x411b85,null))[_0x7b1c('0x25')](removeEntity(_0x411b85,null))[_0x7b1c('0x47')](handleError(_0x411b85,null));}; \ No newline at end of file +var _0x8f6d=['status','json','undefined','limit','offset','count','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','map','Variable','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','sort','where','filters','pick','merge','VIRTUAL','filter','options','include','findAll','rows','show','params','includeAll','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Variables','UserProfileSection','find','userProfileId','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end'];(function(_0x249508,_0x22e605){var _0x15ebf2=function(_0x489e87){while(--_0x489e87){_0x249508['push'](_0x249508['shift']());}};_0x15ebf2(++_0x22e605);}(_0x8f6d,0xe4));var _0xd8f6=function(_0x4c575e,_0x444328){_0x4c575e=_0x4c575e-0x0;var _0x516cef=_0x8f6d[_0x4c575e];return _0x516cef;};'use strict';var emlformat=require(_0xd8f6('0x0'));var rimraf=require(_0xd8f6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd8f6('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xd8f6('0x3'));var Mustache=require(_0xd8f6('0x4'));var util=require(_0xd8f6('0x5'));var path=require(_0xd8f6('0x6'));var sox=require(_0xd8f6('0x7'));var csv=require(_0xd8f6('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd8f6('0x9'));var _=require(_0xd8f6('0xa'));var squel=require(_0xd8f6('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xd8f6('0xc'));var toCsv=require(_0xd8f6('0x8'));var querystring=require(_0xd8f6('0xd'));var Papa=require(_0xd8f6('0xe'));var Redis=require(_0xd8f6('0xf'));var authService=require(_0xd8f6('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xd8f6('0x11'));var hardwareService=require(_0xd8f6('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xd8f6('0x13'));var licenseUtil=require(_0xd8f6('0x14'));var db=require(_0xd8f6('0x15'))['db'];function respondWithStatusCode(_0x2346da,_0xf133c5){_0xf133c5=_0xf133c5||0xcc;return function(_0x1ed2c2){if(_0x1ed2c2){return _0x2346da[_0xd8f6('0x16')](_0xf133c5);}return _0x2346da['status'](_0xf133c5)[_0xd8f6('0x17')]();};}function respondWithResult(_0x51a7c5,_0x22d3ea){_0x22d3ea=_0x22d3ea||0xc8;return function(_0x5e2720){if(_0x5e2720){return _0x51a7c5[_0xd8f6('0x18')](_0x22d3ea)[_0xd8f6('0x19')](_0x5e2720);}};}function respondWithFilteredResult(_0x5802b0,_0x4293ba){return function(_0x72628){if(_0x72628){var _0x1ed4f4=typeof _0x4293ba['offset']===_0xd8f6('0x1a')&&typeof _0x4293ba[_0xd8f6('0x1b')]===_0xd8f6('0x1a');var _0x43d762=_0x72628['count'];var _0x1c986f=_0x1ed4f4?0x0:_0x4293ba[_0xd8f6('0x1c')];var _0x2fe224=_0x1ed4f4?_0x72628[_0xd8f6('0x1d')]:_0x4293ba[_0xd8f6('0x1c')]+_0x4293ba[_0xd8f6('0x1b')];var _0x1e3dc6;if(_0x2fe224>=_0x43d762){_0x2fe224=_0x43d762;_0x1e3dc6=0xc8;}else{_0x1e3dc6=0xce;}_0x5802b0['status'](_0x1e3dc6);return _0x5802b0[_0xd8f6('0x1e')](_0xd8f6('0x1f'),_0x1c986f+'-'+_0x2fe224+'/'+_0x43d762)['json'](_0x72628);}return null;};}function patchUpdates(_0x2b2adc){return function(_0x1c4ef5){try{jsonpatch[_0xd8f6('0x20')](_0x1c4ef5,_0x2b2adc,!![]);}catch(_0x1ca864){return BPromise[_0xd8f6('0x21')](_0x1ca864);}return _0x1c4ef5[_0xd8f6('0x22')]();};}function saveUpdates(_0xf86273,_0x4c2d3e){return function(_0x3f891c){if(_0x3f891c){return _0x3f891c[_0xd8f6('0x23')](_0xf86273)[_0xd8f6('0x24')](function(_0x5288c0){return _0x5288c0;});}return null;};}function removeEntity(_0x100889,_0x4a4d8d){return function(_0xf8b7ec){if(_0xf8b7ec){return _0xf8b7ec[_0xd8f6('0x25')]()['then'](function(){var _0x10bb37=_0xf8b7ec[_0xd8f6('0x26')]({'plain':!![]});var _0x21ec3c='Variables';return db[_0xd8f6('0x27')][_0xd8f6('0x25')]({'where':{'type':_0x21ec3c,'resourceId':_0x10bb37['id']}})['then'](function(){return _0xf8b7ec;});})[_0xd8f6('0x24')](function(){_0x100889[_0xd8f6('0x18')](0xcc)[_0xd8f6('0x17')]();});}};}function handleEntityNotFound(_0x5d6d81,_0x5b5280){return function(_0x133652){if(!_0x133652){_0x5d6d81[_0xd8f6('0x16')](0x194);}return _0x133652;};}function handleError(_0x281b04,_0x379cd3){_0x379cd3=_0x379cd3||0x1f4;return function(_0x48e8f1){logger[_0xd8f6('0x28')](_0x48e8f1[_0xd8f6('0x29')]);if(_0x48e8f1[_0xd8f6('0x2a')]){delete _0x48e8f1[_0xd8f6('0x2a')];}_0x281b04[_0xd8f6('0x18')](_0x379cd3)[_0xd8f6('0x2b')](_0x48e8f1);};}exports[_0xd8f6('0x2c')]=function(_0x32583e,_0x207d5a){var _0x65bdf4={},_0x460cd2={},_0x259907={'count':0x0,'rows':[]};var _0x471ae3=_[_0xd8f6('0x2d')](db[_0xd8f6('0x2e')][_0xd8f6('0x2f')],function(_0x2fcff6){return{'name':_0x2fcff6[_0xd8f6('0x30')],'type':_0x2fcff6[_0xd8f6('0x31')][_0xd8f6('0x32')]};});_0x460cd2[_0xd8f6('0x33')]=_[_0xd8f6('0x2d')](_0x471ae3,_0xd8f6('0x2a'));_0x460cd2['query']=_[_0xd8f6('0x34')](_0x32583e[_0xd8f6('0x35')]);_0x460cd2['filters']=_[_0xd8f6('0x36')](_0x460cd2[_0xd8f6('0x33')],_0x460cd2[_0xd8f6('0x35')]);_0x65bdf4[_0xd8f6('0x37')]=_[_0xd8f6('0x36')](_0x460cd2[_0xd8f6('0x33')],qs['fields'](_0x32583e[_0xd8f6('0x35')][_0xd8f6('0x38')]));_0x65bdf4[_0xd8f6('0x37')]=_0x65bdf4[_0xd8f6('0x37')][_0xd8f6('0x39')]?_0x65bdf4['attributes']:_0x460cd2[_0xd8f6('0x33')];if(!_0x32583e[_0xd8f6('0x35')][_0xd8f6('0x3a')]('nolimit')){_0x65bdf4[_0xd8f6('0x1b')]=qs[_0xd8f6('0x1b')](_0x32583e['query']['limit']);_0x65bdf4[_0xd8f6('0x1c')]=qs[_0xd8f6('0x1c')](_0x32583e['query']['offset']);}_0x65bdf4['order']=qs[_0xd8f6('0x3b')](_0x32583e['query'][_0xd8f6('0x3b')]);_0x65bdf4[_0xd8f6('0x3c')]=qs[_0xd8f6('0x3d')](_[_0xd8f6('0x3e')](_0x32583e[_0xd8f6('0x35')],_0x460cd2[_0xd8f6('0x3d')]),_0x471ae3);if(_0x32583e['query']['filter']){_0x65bdf4[_0xd8f6('0x3c')]=_[_0xd8f6('0x3f')](_0x65bdf4['where'],{'$or':_[_0xd8f6('0x2d')](_0x471ae3,function(_0x135594){if(_0x135594[_0xd8f6('0x31')]!==_0xd8f6('0x40')){var _0x3316da={};_0x3316da[_0x135594[_0xd8f6('0x2a')]]={'$like':'%'+_0x32583e[_0xd8f6('0x35')][_0xd8f6('0x41')]+'%'};return _0x3316da;}})});}_0x65bdf4=_[_0xd8f6('0x3f')]({},_0x65bdf4,_0x32583e[_0xd8f6('0x42')]);var _0x5471fe={'where':_0x65bdf4[_0xd8f6('0x3c')]};return db[_0xd8f6('0x2e')][_0xd8f6('0x1d')](_0x5471fe)[_0xd8f6('0x24')](function(_0x199661){_0x259907[_0xd8f6('0x1d')]=_0x199661;if(_0x32583e[_0xd8f6('0x35')]['includeAll']){_0x65bdf4[_0xd8f6('0x43')]=[{'all':!![]}];}return db['Variable'][_0xd8f6('0x44')](_0x65bdf4);})[_0xd8f6('0x24')](function(_0x155404){_0x259907[_0xd8f6('0x45')]=_0x155404;return _0x259907;})[_0xd8f6('0x24')](respondWithFilteredResult(_0x207d5a,_0x65bdf4))['catch'](handleError(_0x207d5a,null));};exports[_0xd8f6('0x46')]=function(_0x341860,_0x12605c){var _0x4ae3a8={'raw':!![],'where':{'id':_0x341860[_0xd8f6('0x47')]['id']}},_0x273948={};_0x273948[_0xd8f6('0x33')]=_[_0xd8f6('0x34')](db['Variable'][_0xd8f6('0x2f')]);_0x273948[_0xd8f6('0x35')]=_[_0xd8f6('0x34')](_0x341860[_0xd8f6('0x35')]);_0x273948[_0xd8f6('0x3d')]=_[_0xd8f6('0x36')](_0x273948[_0xd8f6('0x33')],_0x273948[_0xd8f6('0x35')]);_0x4ae3a8['attributes']=_[_0xd8f6('0x36')](_0x273948[_0xd8f6('0x33')],qs[_0xd8f6('0x38')](_0x341860[_0xd8f6('0x35')][_0xd8f6('0x38')]));_0x4ae3a8['attributes']=_0x4ae3a8[_0xd8f6('0x37')][_0xd8f6('0x39')]?_0x4ae3a8[_0xd8f6('0x37')]:_0x273948['model'];if(_0x341860[_0xd8f6('0x35')][_0xd8f6('0x48')]){_0x4ae3a8['include']=[{'all':!![]}];}_0x4ae3a8=_[_0xd8f6('0x3f')]({},_0x4ae3a8,_0x341860[_0xd8f6('0x42')]);return db[_0xd8f6('0x2e')]['find'](_0x4ae3a8)[_0xd8f6('0x24')](handleEntityNotFound(_0x12605c,null))[_0xd8f6('0x24')](respondWithResult(_0x12605c,null))['catch'](handleError(_0x12605c,null));};exports['create']=function(_0x1aca3d,_0x3fba98){return db[_0xd8f6('0x2e')][_0xd8f6('0x49')](_0x1aca3d[_0xd8f6('0x4a')],{})[_0xd8f6('0x24')](function(_0x48ce2e){var _0x425ce3=_0x1aca3d[_0xd8f6('0x4b')][_0xd8f6('0x26')]({'plain':!![]});if(!_0x425ce3)throw new Error(_0xd8f6('0x4c'));if(_0x425ce3[_0xd8f6('0x4d')]===_0xd8f6('0x4b')){var _0x3f7cae=_0x48ce2e[_0xd8f6('0x26')]({'plain':!![]});var _0x393e47=_0xd8f6('0x4e');return db[_0xd8f6('0x4f')][_0xd8f6('0x50')]({'where':{'name':_0x393e47,'userProfileId':_0x425ce3[_0xd8f6('0x51')]},'raw':!![]})[_0xd8f6('0x24')](function(_0x2125bf){if(_0x2125bf&&_0x2125bf['autoAssociation']===0x0){return db[_0xd8f6('0x27')]['create']({'name':_0x3f7cae[_0xd8f6('0x2a')],'resourceId':_0x3f7cae['id'],'type':_0x2125bf[_0xd8f6('0x2a')],'sectionId':_0x2125bf['id']},{})[_0xd8f6('0x24')](function(){return _0x48ce2e;});}else{return _0x48ce2e;}})[_0xd8f6('0x52')](function(_0x11dacc){logger[_0xd8f6('0x28')](_0xd8f6('0x53'),_0x11dacc);throw _0x11dacc;});}return _0x48ce2e;})[_0xd8f6('0x24')](respondWithResult(_0x3fba98,0xc9))[_0xd8f6('0x52')](handleError(_0x3fba98,null));};exports[_0xd8f6('0x23')]=function(_0x4b8cb1,_0x32ac9e){if(_0x4b8cb1['body']['id']){delete _0x4b8cb1[_0xd8f6('0x4a')]['id'];}return db[_0xd8f6('0x2e')][_0xd8f6('0x50')]({'where':{'id':_0x4b8cb1['params']['id']}})[_0xd8f6('0x24')](handleEntityNotFound(_0x32ac9e,null))['then'](saveUpdates(_0x4b8cb1[_0xd8f6('0x4a')],null))[_0xd8f6('0x24')](respondWithResult(_0x32ac9e,null))[_0xd8f6('0x52')](handleError(_0x32ac9e,null));};exports[_0xd8f6('0x25')]=function(_0x12aaa5,_0x279175){return db[_0xd8f6('0x2e')][_0xd8f6('0x50')]({'where':{'id':_0x12aaa5['params']['id']}})[_0xd8f6('0x24')](handleEntityNotFound(_0x279175,null))[_0xd8f6('0x24')](removeEntity(_0x279175,null))['catch'](handleError(_0x279175,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index 305ab06..96a3640 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 _0x4d4f=['../../config/logger','api','request-promise','path','rimraf','./variable.attributes','exports','Variable','tools_variables','lodash'];(function(_0xce64d0,_0x1ccf9d){var _0x11ca0c=function(_0x770913){while(--_0x770913){_0xce64d0['push'](_0xce64d0['shift']());}};_0x11ca0c(++_0x1ccf9d);}(_0x4d4f,0xd1));var _0xf4d4=function(_0x902f9b,_0x121458){_0x902f9b=_0x902f9b-0x0;var _0x3128e1=_0x4d4f[_0x902f9b];return _0x3128e1;};'use strict';var _=require(_0xf4d4('0x0'));var util=require('util');var logger=require(_0xf4d4('0x1'))(_0xf4d4('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xf4d4('0x3'));var fs=require('fs');var path=require(_0xf4d4('0x4'));var rimraf=require(_0xf4d4('0x5'));var config=require('../../config/environment');var attributes=require(_0xf4d4('0x6'));module[_0xf4d4('0x7')]=function(_0x41d787,_0x36cf39){return _0x41d787['define'](_0xf4d4('0x8'),attributes,{'tableName':_0xf4d4('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2707=['moment','bluebird','request-promise','../../config/environment','./variable.attributes','exports','Variable','tools_variables','lodash','util','../../config/logger','api'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x2707,0xec));var _0x7270=function(_0x4c445a,_0x4ee80f){_0x4c445a=_0x4c445a-0x0;var _0x2f611c=_0x2707[_0x4c445a];return _0x2f611c;};'use strict';var _=require(_0x7270('0x0'));var util=require(_0x7270('0x1'));var logger=require(_0x7270('0x2'))(_0x7270('0x3'));var moment=require(_0x7270('0x4'));var BPromise=require(_0x7270('0x5'));var rp=require(_0x7270('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7270('0x7'));var attributes=require(_0x7270('0x8'));module[_0x7270('0x9')]=function(_0x4523ef,_0x135a6f){return _0x4523ef['define'](_0x7270('0xa'),attributes,{'tableName':_0x7270('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 6ab5460..48f9aad 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 _0xa41a=['debug','Variable,\x20%s,\x20%s,\x20%s','error','message','result','catch','ShowVariable','options','raw','where','attributes','include','map','model','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','Variable,\x20%s,\x20%s','request\x20sent'];(function(_0x40ac5e,_0x2de228){var _0x2839d6=function(_0x123d47){while(--_0x123d47){_0x40ac5e['push'](_0x40ac5e['shift']());}};_0x2839d6(++_0x2de228);}(_0xa41a,0x6b));var _0xaa41=function(_0x46b362,_0x14b73c){_0x46b362=_0x46b362-0x0;var _0x103a1f=_0xa41a[_0x46b362];return _0x103a1f;};'use strict';var _=require(_0xaa41('0x0'));var util=require(_0xaa41('0x1'));var moment=require('moment');var BPromise=require(_0xaa41('0x2'));var rs=require(_0xaa41('0x3'));var fs=require('fs');var Redis=require(_0xaa41('0x4'));var db=require(_0xaa41('0x5'))['db'];var utils=require(_0xaa41('0x6'));var logger=require(_0xaa41('0x7'))(_0xaa41('0x8'));var config=require(_0xaa41('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xaa41('0xa')][_0xaa41('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x54bc5a,_0x5b1fff,_0x179545){return new BPromise(function(_0x202cce,_0x588ab4){return client[_0xaa41('0xc')](_0x54bc5a,_0x179545)[_0xaa41('0xd')](function(_0x409dab){logger[_0xaa41('0xe')](_0xaa41('0xf'),_0x5b1fff,_0xaa41('0x10'));logger[_0xaa41('0x11')](_0xaa41('0x12'),_0x5b1fff,_0xaa41('0x10'),JSON['stringify'](_0x409dab));if(_0x409dab[_0xaa41('0x13')]){if(_0x409dab[_0xaa41('0x13')]['code']===0x1f4){logger['error'](_0xaa41('0xf'),_0x5b1fff,_0x409dab['error'][_0xaa41('0x14')]);return _0x588ab4(_0x409dab[_0xaa41('0x13')][_0xaa41('0x14')]);}logger[_0xaa41('0x13')](_0xaa41('0xf'),_0x5b1fff,_0x409dab['error'][_0xaa41('0x14')]);return _0x202cce(_0x409dab[_0xaa41('0x13')][_0xaa41('0x14')]);}else{logger[_0xaa41('0xe')](_0xaa41('0xf'),_0x5b1fff,_0xaa41('0x10'));_0x202cce(_0x409dab[_0xaa41('0x15')]['message']);}})[_0xaa41('0x16')](function(_0x16b930){logger[_0xaa41('0x13')](_0xaa41('0xf'),_0x5b1fff,_0x16b930);_0x588ab4(_0x16b930);});});}exports[_0xaa41('0x17')]=function(_0xd20ddf){var _0x29efe5=this;return new Promise(function(_0x46e6d3,_0x150ddf){return db['Variable']['find']({'raw':_0xd20ddf[_0xaa41('0x18')]?_0xd20ddf[_0xaa41('0x18')][_0xaa41('0x19')]===undefined?!![]:![]:!![],'where':_0xd20ddf['options']?_0xd20ddf[_0xaa41('0x18')][_0xaa41('0x1a')]||null:null,'attributes':_0xd20ddf['options']?_0xd20ddf['options'][_0xaa41('0x1b')]||null:null,'include':_0xd20ddf['options']?_0xd20ddf[_0xaa41('0x18')][_0xaa41('0x1c')]?_[_0xaa41('0x1d')](_0xd20ddf[_0xaa41('0x18')][_0xaa41('0x1c')],function(_0x4eb01f){return{'model':db[_0x4eb01f[_0xaa41('0x1e')]],'as':_0x4eb01f['as'],'attributes':_0x4eb01f[_0xaa41('0x1b')],'include':_0x4eb01f[_0xaa41('0x1c')]?_[_0xaa41('0x1d')](_0x4eb01f[_0xaa41('0x1c')],function(_0xa1f024){return{'model':db[_0xa1f024['model']],'as':_0xa1f024['as'],'attributes':_0xa1f024['attributes'],'include':_0xa1f024[_0xaa41('0x1c')]?_['map'](_0xa1f024['include'],function(_0x12e362){return{'model':db[_0x12e362['model']],'as':_0x12e362['as'],'attributes':_0x12e362['attributes']};}):[]};}):[]};}):[]:[]})[_0xaa41('0xd')](function(_0x9c8c21){logger[_0xaa41('0xe')](_0xaa41('0x17'),_0xd20ddf);logger[_0xaa41('0x11')](_0xaa41('0x17'),_0xd20ddf,JSON['stringify'](_0x9c8c21));_0x46e6d3(_0x9c8c21);})[_0xaa41('0x16')](function(_0x1f0275){logger[_0xaa41('0x13')](_0xaa41('0x17'),_0x1f0275[_0xaa41('0x14')],_0xd20ddf);_0x150ddf(_0x29efe5[_0xaa41('0x13')](0x1f4,_0x1f0275[_0xaa41('0x14')]));});});}; \ No newline at end of file +var _0x7fbe=['stringify','error','code','message','result','catch','Variable','find','options','where','attributes','include','map','model','info','ShowVariable','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s'];(function(_0x3c438e,_0x4468b9){var _0x54c8be=function(_0x562b41){while(--_0x562b41){_0x3c438e['push'](_0x3c438e['shift']());}};_0x54c8be(++_0x4468b9);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x957193,_0x3fec8b){_0x957193=_0x957193-0x0;var _0x9473f8=_0x7fbe[_0x957193];return _0x9473f8;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe7fb('0x0'));var BPromise=require(_0xe7fb('0x1'));var rs=require(_0xe7fb('0x2'));var fs=require('fs');var Redis=require(_0xe7fb('0x3'));var db=require(_0xe7fb('0x4'))['db'];var utils=require(_0xe7fb('0x5'));var logger=require(_0xe7fb('0x6'))(_0xe7fb('0x7'));var config=require(_0xe7fb('0x8'));var jayson=require(_0xe7fb('0x9'));var client=jayson[_0xe7fb('0xa')][_0xe7fb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x24cd67,_0x1f943f,_0x5ad75b){return new BPromise(function(_0x213ebc,_0x228f6b){return client[_0xe7fb('0xc')](_0x24cd67,_0x5ad75b)[_0xe7fb('0xd')](function(_0x4ba197){logger['info'](_0xe7fb('0xe'),_0x1f943f,_0xe7fb('0xf'));logger[_0xe7fb('0x10')](_0xe7fb('0x11'),_0x1f943f,_0xe7fb('0xf'),JSON[_0xe7fb('0x12')](_0x4ba197));if(_0x4ba197[_0xe7fb('0x13')]){if(_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x14')]===0x1f4){logger[_0xe7fb('0x13')](_0xe7fb('0xe'),_0x1f943f,_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x15')]);return _0x228f6b(_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x15')]);}logger['error'](_0xe7fb('0xe'),_0x1f943f,_0x4ba197[_0xe7fb('0x13')]['message']);return _0x213ebc(_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x15')]);}else{logger['info'](_0xe7fb('0xe'),_0x1f943f,'request\x20sent');_0x213ebc(_0x4ba197[_0xe7fb('0x16')][_0xe7fb('0x15')]);}})[_0xe7fb('0x17')](function(_0x17e8a8){logger['error'](_0xe7fb('0xe'),_0x1f943f,_0x17e8a8);_0x228f6b(_0x17e8a8);});});}exports['ShowVariable']=function(_0x293a47){var _0x546463=this;return new Promise(function(_0x1e77fd,_0x4708f7){return db[_0xe7fb('0x18')][_0xe7fb('0x19')]({'raw':_0x293a47['options']?_0x293a47[_0xe7fb('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x293a47[_0xe7fb('0x1a')]?_0x293a47['options'][_0xe7fb('0x1b')]||null:null,'attributes':_0x293a47['options']?_0x293a47[_0xe7fb('0x1a')][_0xe7fb('0x1c')]||null:null,'include':_0x293a47['options']?_0x293a47[_0xe7fb('0x1a')][_0xe7fb('0x1d')]?_[_0xe7fb('0x1e')](_0x293a47['options'][_0xe7fb('0x1d')],function(_0x469ead){return{'model':db[_0x469ead['model']],'as':_0x469ead['as'],'attributes':_0x469ead['attributes'],'include':_0x469ead['include']?_[_0xe7fb('0x1e')](_0x469ead['include'],function(_0x49b219){return{'model':db[_0x49b219[_0xe7fb('0x1f')]],'as':_0x49b219['as'],'attributes':_0x49b219[_0xe7fb('0x1c')],'include':_0x49b219[_0xe7fb('0x1d')]?_['map'](_0x49b219[_0xe7fb('0x1d')],function(_0x2b69c4){return{'model':db[_0x2b69c4[_0xe7fb('0x1f')]],'as':_0x2b69c4['as'],'attributes':_0x2b69c4[_0xe7fb('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xe7fb('0xd')](function(_0x16237a){logger[_0xe7fb('0x20')]('ShowVariable',_0x293a47);logger['debug'](_0xe7fb('0x21'),_0x293a47,JSON[_0xe7fb('0x12')](_0x16237a));_0x1e77fd(_0x16237a);})[_0xe7fb('0x17')](function(_0x4fd290){logger[_0xe7fb('0x13')](_0xe7fb('0x21'),_0x4fd290[_0xe7fb('0x15')],_0x293a47);_0x4708f7(_0x546463[_0xe7fb('0x13')](0x1f4,_0x4fd290[_0xe7fb('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index e29a337..112c33c 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 _0xfacb=['pull','/restart','restart','/migrations','migrations','express','Router','../../components/auth/service','get','index','/fetch','isAuthenticated','canUpdate','fetch','/reset','reset','/pull'];(function(_0xe74b39,_0x276c5c){var _0x37c549=function(_0x350980){while(--_0x350980){_0xe74b39['push'](_0xe74b39['shift']());}};_0x37c549(++_0x276c5c);}(_0xfacb,0x1bf));var _0xbfac=function(_0xe5b9d2,_0x2b181a){_0xe5b9d2=_0xe5b9d2-0x0;var _0x4424fb=_0xfacb[_0xe5b9d2];return _0x4424fb;};'use strict';var express=require(_0xbfac('0x0'));var router=express[_0xbfac('0x1')]();var auth=require(_0xbfac('0x2'));var controller=require('./version.controller');router[_0xbfac('0x3')]('/',controller[_0xbfac('0x4')]);router[_0xbfac('0x3')](_0xbfac('0x5'),auth[_0xbfac('0x6')](),auth[_0xbfac('0x7')](),controller[_0xbfac('0x8')]);router['get'](_0xbfac('0x9'),auth[_0xbfac('0x6')](),auth['canUpdate'](),controller[_0xbfac('0xa')]);router[_0xbfac('0x3')](_0xbfac('0xb'),auth[_0xbfac('0x6')](),auth[_0xbfac('0x7')](),controller[_0xbfac('0xc')]);router[_0xbfac('0x3')](_0xbfac('0xd'),auth[_0xbfac('0x6')](),controller[_0xbfac('0xe')]);router[_0xbfac('0x3')](_0xbfac('0xf'),controller[_0xbfac('0x10')]);module['exports']=router; \ No newline at end of file +var _0xdf34=['migrations','exports','express','../../components/auth/service','get','index','isAuthenticated','canUpdate','/reset','reset','pull','/restart','restart','/migrations'];(function(_0x4b7b62,_0x4920a9){var _0x2280df=function(_0x21e1f8){while(--_0x21e1f8){_0x4b7b62['push'](_0x4b7b62['shift']());}};_0x2280df(++_0x4920a9);}(_0xdf34,0x1a6));var _0x4df3=function(_0x2ec448,_0x189d0f){_0x2ec448=_0x2ec448-0x0;var _0x16e9a1=_0xdf34[_0x2ec448];return _0x16e9a1;};'use strict';var express=require(_0x4df3('0x0'));var router=express['Router']();var auth=require(_0x4df3('0x1'));var controller=require('./version.controller');router[_0x4df3('0x2')]('/',controller[_0x4df3('0x3')]);router[_0x4df3('0x2')]('/fetch',auth[_0x4df3('0x4')](),auth[_0x4df3('0x5')](),controller['fetch']);router['get'](_0x4df3('0x6'),auth['isAuthenticated'](),auth['canUpdate'](),controller[_0x4df3('0x7')]);router[_0x4df3('0x2')]('/pull',auth[_0x4df3('0x4')](),auth[_0x4df3('0x5')](),controller[_0x4df3('0x8')]);router['get'](_0x4df3('0x9'),auth[_0x4df3('0x4')](),controller[_0x4df3('0xa')]);router[_0x4df3('0x2')](_0x4df3('0xb'),controller[_0x4df3('0xc')]);module[_0x4df3('0xd')]=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index eee5c00..ce91d61 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 _0x93f8=['Migration','constructor','map','then','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','UniqueConstraintError','Database\x20already\x20up-to-date','path','lodash','version','child_process','../../config/environment','../../config/logger','update','index','exports','query','latest','fetch','tags','2.0.0','status','master','json','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','npm\x20install\x20--production','error','restart','motion2','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','readdirSync','join','root','server','length','replace','.js','push','sequelize'];(function(_0x1ad73c,_0x5671b3){var _0x2af975=function(_0x2f789c){while(--_0x2f789c){_0x1ad73c['push'](_0x1ad73c['shift']());}};_0x2af975(++_0x5671b3);}(_0x93f8,0xd5));var _0x893f=function(_0x2ef587,_0x137ab4){_0x2ef587=_0x2ef587-0x0;var _0x3067ca=_0x93f8[_0x2ef587];return _0x3067ca;};'use strict';var Umzug=require('umzug');var path=require(_0x893f('0x0'));var fs=require('fs');var _=require(_0x893f('0x1'));var pkginfo=require('pkginfo')(module,_0x893f('0x2'));var compareVersions=require('compare-versions');var exec=require(_0x893f('0x3'))['exec'];var db=require('../../mysqldb')['db'];var config=require(_0x893f('0x4'));var pm2=require('../../config/pm2');var logger=require(_0x893f('0x5'))(_0x893f('0x6'));var git=require('simple-git')(config['root']);exports[_0x893f('0x7')]=function(_0x474199,_0x85c2d0){var _0x3c5844={'current':module[_0x893f('0x8')][_0x893f('0x2')],'phonebar':0x2};if(_0x474199[_0x893f('0x9')]&&_0x474199[_0x893f('0x9')][_0x893f('0xa')]){return git[_0x893f('0xb')]()[_0x893f('0xc')](function(_0x206caf,_0x3b1253){_0x3c5844['latest']=(_0x206caf?module[_0x893f('0x8')][_0x893f('0x2')]:_0x3b1253[_0x893f('0xa')])||_0x893f('0xd');return _0x85c2d0[_0x893f('0xe')](0xc8)['json'](_0x3c5844);});}else{return _0x85c2d0[_0x893f('0xe')](0xc8)['json'](_0x3c5844);}};exports[_0x893f('0xb')]=function(_0x5067a2,_0x189ed8){return git[_0x893f('0xb')](['origin',_0x893f('0xf')],function(_0x50171a){if(_0x50171a){logger['error'](_0x50171a);return _0x189ed8[_0x893f('0xe')](0x1f4)[_0x893f('0x10')](_0x50171a);}logger[_0x893f('0x11')](_0x893f('0x12'));return _0x189ed8['status'](0xc8)[_0x893f('0x10')]({'output':_0x893f('0x13')});});};exports[_0x893f('0x14')]=function(_0xa41163,_0x211c67){return git[_0x893f('0x14')]([_0x893f('0x15'),'FETCH_HEAD'],function(_0xaa4ce8){if(_0xaa4ce8){logger['error'](_0xaa4ce8);return _0x211c67['status'](0x1f4)[_0x893f('0x10')](_0xaa4ce8);}logger[_0x893f('0x11')](_0x893f('0x16'));return _0x211c67['status'](0xc8)[_0x893f('0x10')]({'output':_0x893f('0x17')});});};exports[_0x893f('0x18')]=function(_0x370357,_0x2fdaa0){exec(_0x893f('0x19'),function(_0x16e658,_0xb6f7d9,_0x9e8f0c){logger[_0x893f('0x11')](_0xb6f7d9);logger[_0x893f('0x11')](_0x9e8f0c);if(_0x16e658){logger[_0x893f('0x1a')](_0x16e658);return _0x2fdaa0[_0x893f('0xe')](0x1f4)[_0x893f('0x10')](_0x16e658);}return _0x2fdaa0['status'](0xc8)[_0x893f('0x10')]({'output':_0xb6f7d9});});};exports[_0x893f('0x1b')]=function(_0x2034a6,_0x37f105){return pm2[_0x893f('0x1b')](_0x893f('0x1c'))['then'](function(_0x15f2de){logger['info'](_0x893f('0x1d'),_0x15f2de);return _0x37f105[_0x893f('0xe')](0xc8)[_0x893f('0x10')]({'output':_0x893f('0x1e')});})[_0x893f('0x1f')](function(_0x586911){logger[_0x893f('0x1a')](_0x586911);return _0x37f105[_0x893f('0xe')](0x1f4)[_0x893f('0x10')](_0x586911);});};exports[_0x893f('0x20')]=function(_0x159e36,_0x5881f7){var _0x200cae=fs[_0x893f('0x21')](path[_0x893f('0x22')](config[_0x893f('0x23')],_0x893f('0x24'),_0x893f('0x20')));var _0x34fd00=[];for(var _0x3862e4=0x0;_0x3862e4<_0x200cae[_0x893f('0x25')];_0x3862e4++){var _0x2fb436=_0x200cae[_0x3862e4][_0x893f('0x26')](_0x893f('0x27'),'');if(compareVersions(module[_0x893f('0x8')][_0x893f('0x2')],_0x2fb436)===-0x1){_0x34fd00[_0x893f('0x28')](_0x2fb436);}}if(_0x34fd00['length']){var _0x4ad600=_0x34fd00['sort'](compareVersions);var _0x51b91c=new Umzug({'storage':_0x893f('0x29'),'storageOptions':{'model':db[_0x893f('0x2a')],'modelName':_0x893f('0x2a'),'columnName':_0x893f('0x2')},'migrations':{'params':[db[_0x893f('0x29')]['getQueryInterface'](),db['sequelize'][_0x893f('0x2b')],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[_0x893f('0x22')](config[_0x893f('0x23')],_0x893f('0x24'),_0x893f('0x20')),'pattern':/\.js$/}});_0x51b91c['up']({'migrations':_[_0x893f('0x2c')](_0x4ad600,function(_0x72b93d){return _0x72b93d+_0x893f('0x27');})})[_0x893f('0x2d')](function(){return _0x5881f7['status'](0xc8)[_0x893f('0x10')]({'output':_0x893f('0x2e')+module[_0x893f('0x8')][_0x893f('0x2')]+_0x893f('0x2f')+_[_0x893f('0x30')](_0x4ad600),'migrations':_[_0x893f('0x22')](_0x4ad600)});})[_0x893f('0x1f')](function(_0x42b048){if(_0x42b048 instanceof db['sequelize'][_0x893f('0x31')]){return _0x5881f7[_0x893f('0xe')](0xc8)[_0x893f('0x10')]({'output':_0x893f('0x32')});}else{return _0x5881f7['status'](0x1f4)['json'](_0x42b048);}});}else{return _0x5881f7[_0x893f('0xe')](0xc8)[_0x893f('0x10')]({'output':_0x893f('0x32')});}}; \ No newline at end of file +var _0xb3a3=['error','git\x20reset\x20--hard','pull','restart','motion2','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','readdirSync','server','push','length','sequelize','Migration','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','join','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','pkginfo','version','compare-versions','exec','../../config/environment','../../config/pm2','update','query','latest','tags','exports','status','json','fetch','origin','master','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD'];(function(_0xc499f7,_0xdd419c){var _0x46eed=function(_0xcbfdc4){while(--_0xcbfdc4){_0xc499f7['push'](_0xc499f7['shift']());}};_0x46eed(++_0xdd419c);}(_0xb3a3,0xc9));var _0x3b3a=function(_0x2fca12,_0x3a24d4){_0x2fca12=_0x2fca12-0x0;var _0x3b449c=_0xb3a3[_0x2fca12];return _0x3b449c;};'use strict';var Umzug=require(_0x3b3a('0x0'));var path=require(_0x3b3a('0x1'));var fs=require('fs');var _=require('lodash');var pkginfo=require(_0x3b3a('0x2'))(module,_0x3b3a('0x3'));var compareVersions=require(_0x3b3a('0x4'));var exec=require('child_process')[_0x3b3a('0x5')];var db=require('../../mysqldb')['db'];var config=require(_0x3b3a('0x6'));var pm2=require(_0x3b3a('0x7'));var logger=require('../../config/logger')(_0x3b3a('0x8'));var git=require('simple-git')(config['root']);exports['index']=function(_0x2720f6,_0x3c8ce6){var _0xca94a4={'current':module['exports']['version'],'phonebar':0x2};if(_0x2720f6[_0x3b3a('0x9')]&&_0x2720f6['query'][_0x3b3a('0xa')]){return git['fetch']()[_0x3b3a('0xb')](function(_0x573553,_0x527f15){_0xca94a4[_0x3b3a('0xa')]=(_0x573553?module[_0x3b3a('0xc')][_0x3b3a('0x3')]:_0x527f15[_0x3b3a('0xa')])||'2.0.0';return _0x3c8ce6[_0x3b3a('0xd')](0xc8)[_0x3b3a('0xe')](_0xca94a4);});}else{return _0x3c8ce6[_0x3b3a('0xd')](0xc8)[_0x3b3a('0xe')](_0xca94a4);}};exports['fetch']=function(_0x4c2a3a,_0x3579f4){return git[_0x3b3a('0xf')]([_0x3b3a('0x10'),_0x3b3a('0x11')],function(_0x12b481){if(_0x12b481){logger['error'](_0x12b481);return _0x3579f4[_0x3b3a('0xd')](0x1f4)[_0x3b3a('0xe')](_0x12b481);}logger[_0x3b3a('0x12')](_0x3b3a('0x13'));return _0x3579f4['status'](0xc8)[_0x3b3a('0xe')]({'output':_0x3b3a('0x14')});});};exports[_0x3b3a('0x15')]=function(_0x37e04c,_0x29a9ff){return git[_0x3b3a('0x15')]([_0x3b3a('0x16'),_0x3b3a('0x17')],function(_0x5543f6){if(_0x5543f6){logger[_0x3b3a('0x18')](_0x5543f6);return _0x29a9ff[_0x3b3a('0xd')](0x1f4)['json'](_0x5543f6);}logger[_0x3b3a('0x12')]('git\x20reset\x20--hard\x20FETCH_HEAD');return _0x29a9ff[_0x3b3a('0xd')](0xc8)[_0x3b3a('0xe')]({'output':_0x3b3a('0x19')});});};exports[_0x3b3a('0x1a')]=function(_0x2e92c3,_0x51b527){exec('npm\x20install\x20--production',function(_0x42dec6,_0x3e5009,_0x1dca44){logger['info'](_0x3e5009);logger[_0x3b3a('0x12')](_0x1dca44);if(_0x42dec6){logger[_0x3b3a('0x18')](_0x42dec6);return _0x51b527['status'](0x1f4)['json'](_0x42dec6);}return _0x51b527[_0x3b3a('0xd')](0xc8)[_0x3b3a('0xe')]({'output':_0x3e5009});});};exports[_0x3b3a('0x1b')]=function(_0x41903c,_0x295f4e){return pm2[_0x3b3a('0x1b')](_0x3b3a('0x1c'))['then'](function(_0x59516a){logger[_0x3b3a('0x12')]('pm2\x20restart\x20motion\x20%s',_0x59516a);return _0x295f4e[_0x3b3a('0xd')](0xc8)[_0x3b3a('0xe')]({'output':_0x3b3a('0x1d')});})[_0x3b3a('0x1e')](function(_0x3a3720){logger[_0x3b3a('0x18')](_0x3a3720);return _0x295f4e[_0x3b3a('0xd')](0x1f4)[_0x3b3a('0xe')](_0x3a3720);});};exports[_0x3b3a('0x1f')]=function(_0xba72d1,_0x596cbc){var _0x23456a=fs[_0x3b3a('0x20')](path['join'](config['root'],_0x3b3a('0x21'),'migrations'));var _0x48ee30=[];for(var _0x5ae699=0x0;_0x5ae699<_0x23456a['length'];_0x5ae699++){var _0x341fd4=_0x23456a[_0x5ae699]['replace']('.js','');if(compareVersions(module[_0x3b3a('0xc')][_0x3b3a('0x3')],_0x341fd4)===-0x1){_0x48ee30[_0x3b3a('0x22')](_0x341fd4);}}if(_0x48ee30[_0x3b3a('0x23')]){var _0x6763dc=_0x48ee30['sort'](compareVersions);var _0x2634b7=new Umzug({'storage':_0x3b3a('0x24'),'storageOptions':{'model':db[_0x3b3a('0x25')],'modelName':_0x3b3a('0x25'),'columnName':'version'},'migrations':{'params':[db[_0x3b3a('0x24')]['getQueryInterface'](),db['sequelize'][_0x3b3a('0x26')],function(){throw new Error(_0x3b3a('0x27'));}],'path':path[_0x3b3a('0x28')](config['root'],_0x3b3a('0x21'),_0x3b3a('0x1f')),'pattern':/\.js$/}});_0x2634b7['up']({'migrations':_['map'](_0x6763dc,function(_0x5c2432){return _0x5c2432+'.js';})})['then'](function(){return _0x596cbc['status'](0xc8)[_0x3b3a('0xe')]({'output':_0x3b3a('0x29')+module[_0x3b3a('0xc')]['version']+_0x3b3a('0x2a')+_['last'](_0x6763dc),'migrations':_['join'](_0x6763dc)});})[_0x3b3a('0x1e')](function(_0x5d6540){if(_0x5d6540 instanceof db[_0x3b3a('0x24')][_0x3b3a('0x2b')]){return _0x596cbc[_0x3b3a('0xd')](0xc8)[_0x3b3a('0xe')]({'output':_0x3b3a('0x2c')});}else{return _0x596cbc[_0x3b3a('0xd')](0x1f4)[_0x3b3a('0xe')](_0x5d6540);}});}else{return _0x596cbc[_0x3b3a('0xd')](0xc8)[_0x3b3a('0xe')]({'output':'Database\x20already\x20up-to-date'});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index 85c3896..5b84cc5 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 _0x3e6a=['./voiceAgentReport.controller','isAuthenticated','index','get','/describe','describe','show','post','create','/:id','update','delete','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x2aa788,_0x498eb8){var _0x5be967=function(_0x546ba9){while(--_0x546ba9){_0x2aa788['push'](_0x2aa788['shift']());}};_0x5be967(++_0x498eb8);}(_0x3e6a,0x1ed));var _0xa3e6=function(_0x671da8,_0x497008){_0x671da8=_0x671da8-0x0;var _0x185f9c=_0x3e6a[_0x671da8];return _0x185f9c;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xa3e6('0x0'));var timeout=require(_0xa3e6('0x1'));var express=require(_0xa3e6('0x2'));var router=express[_0xa3e6('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xa3e6('0x4'));var interaction=require(_0xa3e6('0x5'));var config=require(_0xa3e6('0x6'));var controller=require(_0xa3e6('0x7'));router['get']('/',auth[_0xa3e6('0x8')](),controller[_0xa3e6('0x9')]);router[_0xa3e6('0xa')](_0xa3e6('0xb'),auth[_0xa3e6('0x8')](),controller[_0xa3e6('0xc')]);router[_0xa3e6('0xa')]('/:id',auth[_0xa3e6('0x8')](),controller[_0xa3e6('0xd')]);router[_0xa3e6('0xe')]('/',auth[_0xa3e6('0x8')](),controller[_0xa3e6('0xf')]);router['put'](_0xa3e6('0x10'),auth['isAuthenticated'](),controller[_0xa3e6('0x11')]);router[_0xa3e6('0x12')](_0xa3e6('0x10'),auth[_0xa3e6('0x8')](),controller['destroy']);module[_0xa3e6('0x13')]=router; \ No newline at end of file +var _0xd63a=['show','create','put','update','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceAgentReport.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x124a4d,_0x17f233){var _0x4b1431=function(_0x3ac410){while(--_0x3ac410){_0x124a4d['push'](_0x124a4d['shift']());}};_0x4b1431(++_0x17f233);}(_0xd63a,0xed));var _0xad63=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd63a[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0xad63('0x0'));var path=require(_0xad63('0x1'));var timeout=require(_0xad63('0x2'));var express=require(_0xad63('0x3'));var router=express[_0xad63('0x4')]();var fs_extra=require(_0xad63('0x5'));var auth=require(_0xad63('0x6'));var interaction=require(_0xad63('0x7'));var config=require('../../config/environment');var controller=require(_0xad63('0x8'));router[_0xad63('0x9')]('/',auth[_0xad63('0xa')](),controller[_0xad63('0xb')]);router[_0xad63('0x9')](_0xad63('0xc'),auth['isAuthenticated'](),controller[_0xad63('0xd')]);router[_0xad63('0x9')](_0xad63('0xe'),auth[_0xad63('0xa')](),controller[_0xad63('0xf')]);router['post']('/',auth[_0xad63('0xa')](),controller[_0xad63('0x10')]);router[_0xad63('0x11')](_0xad63('0xe'),auth['isAuthenticated'](),controller[_0xad63('0x12')]);router['delete'](_0xad63('0xe'),auth[_0xad63('0xa')](),controller[_0xad63('0x13')]);module[_0xad63('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index 4e9041e..9949517 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 _0x0120=['exports','STRING','DATE','BOOLEAN','INTEGER','FORWARD,\x20BLIND,\x20ATTENDED','sequelize'];(function(_0x19616e,_0x4183db){var _0xe0958b=function(_0x3d1752){while(--_0x3d1752){_0x19616e['push'](_0x19616e['shift']());}};_0xe0958b(++_0x4183db);}(_0x0120,0x6f));var _0x0012=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x0120[_0x2f5ac5];return _0x37c9a8;};'use strict';var Sequelize=require(_0x0012('0x0'));module[_0x0012('0x1')]={'type':{'type':Sequelize[_0x0012('0x2')]},'uniqueid':{'type':Sequelize[_0x0012('0x2')]},'calleridnum':{'type':Sequelize[_0x0012('0x2')]},'calleridname':{'type':Sequelize[_0x0012('0x2')]},'queue':{'type':Sequelize[_0x0012('0x2')]},'interface':{'type':Sequelize[_0x0012('0x2')]},'membername':{'type':Sequelize[_0x0012('0x2')]},'agentcalledAt':{'type':Sequelize[_0x0012('0x3')]},'agentconnectAt':{'type':Sequelize[_0x0012('0x3')]},'agentcompleteAt':{'type':Sequelize[_0x0012('0x3')]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdumpAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0x0012('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x0012('0x4')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x0012('0x4')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x0012('0x5')]},'agentacw':{'type':Sequelize[_0x0012('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0x0012('0x2')]},'lastevent':{'type':Sequelize[_0x0012('0x2')]},'channel':{'type':Sequelize[_0x0012('0x2')]},'channelstate':{'type':Sequelize[_0x0012('0x5')]},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x0012('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x0012('0x2')]},'accountcode':{'type':Sequelize[_0x0012('0x2')]},'context':{'type':Sequelize[_0x0012('0x2')]},'exten':{'type':Sequelize[_0x0012('0x2')]},'priority':{'type':Sequelize[_0x0012('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x0012('0x5')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0x0012('0x2')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0x0012('0x2')]},'destcontext':{'type':Sequelize[_0x0012('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x0012('0x2')]},'destuniqueid':{'type':Sequelize[_0x0012('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x0012('0x2')]},'answeredelsewheremembername':{'type':Sequelize[_0x0012('0x2')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0x0012('0x6')},'transferexten':{'type':Sequelize[_0x0012('0x2')]},'transferuniqueid':{'type':Sequelize[_0x0012('0x2')]},'agententerreason':{'type':Sequelize[_0x0012('0x5')],'defaultValue':0x0}}; \ No newline at end of file +var _0x0b7f=['DATE','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports','STRING'];(function(_0x53273a,_0x5ed978){var _0x3c41db=function(_0x491a57){while(--_0x491a57){_0x53273a['push'](_0x53273a['shift']());}};_0x3c41db(++_0x5ed978);}(_0x0b7f,0x115));var _0xf0b7=function(_0x225634,_0x2822e2){_0x225634=_0x225634-0x0;var _0x2f3c62=_0x0b7f[_0x225634];return _0x2f3c62;};'use strict';var Sequelize=require(_0xf0b7('0x0'));module[_0xf0b7('0x1')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xf0b7('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xf0b7('0x2')]},'queue':{'type':Sequelize[_0xf0b7('0x2')]},'interface':{'type':Sequelize[_0xf0b7('0x2')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0xf0b7('0x3')]},'agentcompleteAt':{'type':Sequelize[_0xf0b7('0x3')]},'agentringnoanswerAt':{'type':Sequelize[_0xf0b7('0x3')]},'agentdumpAt':{'type':Sequelize[_0xf0b7('0x3')]},'holdtime':{'type':Sequelize[_0xf0b7('0x4')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0xf0b7('0x5')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0xf0b7('0x5')],'defaultValue':![]},'talktime':{'type':Sequelize[_0xf0b7('0x4')]},'agentacw':{'type':Sequelize[_0xf0b7('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xf0b7('0x4')]},'reason':{'type':Sequelize['STRING']},'lastevent':{'type':Sequelize[_0xf0b7('0x2')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0xf0b7('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xf0b7('0x2')]},'context':{'type':Sequelize[_0xf0b7('0x2')]},'exten':{'type':Sequelize[_0xf0b7('0x2')]},'priority':{'type':Sequelize[_0xf0b7('0x2')]},'destchannel':{'type':Sequelize[_0xf0b7('0x2')]},'destchannelstate':{'type':Sequelize[_0xf0b7('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0xf0b7('0x2')]},'destcalleridnum':{'type':Sequelize[_0xf0b7('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0xf0b7('0x2')]},'destlanguage':{'type':Sequelize[_0xf0b7('0x2')]},'destaccountcode':{'type':Sequelize[_0xf0b7('0x2')]},'destcontext':{'type':Sequelize[_0xf0b7('0x2')]},'destexten':{'type':Sequelize[_0xf0b7('0x2')]},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize[_0xf0b7('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0xf0b7('0x2')]},'answeredelsewheremembername':{'type':Sequelize[_0xf0b7('0x2')]},'transfer':{'type':Sequelize[_0xf0b7('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0xf0b7('0x6')},'transferexten':{'type':Sequelize[_0xf0b7('0x2')]},'transferuniqueid':{'type':Sequelize[_0xf0b7('0x2')]},'agententerreason':{'type':Sequelize[_0xf0b7('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.controller.js b/server/api/voiceAgentReport/voiceAgentReport.controller.js index 29d3e87..b2adaba 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(_0x5a776b,_0x46f785){var _0xbbef59=function(_0x38313e){while(--_0x38313e){_0x5a776b['push'](_0x5a776b['shift']());}};_0xbbef59(++_0x46f785);}(_0xa9e0,0x123));var _0x0a9e=function(_0x387777,_0x356171){_0x387777=_0x387777-0x0;var _0x3f84c0=_0xa9e0[_0x387777];return _0x3f84c0;};'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(_0x26462c,_0xd20a35){var _0x509a42=function(_0x1b22c9){while(--_0x1b22c9){_0x26462c['push'](_0x26462c['shift']());}};_0x509a42(++_0xd20a35);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xa9e0[_0x5b644e];return _0x49c6bf;};'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 74e7426..92d9d2e 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 _0x038b=['report_agent','util','../../config/logger','api','bluebird','path','rimraf','./voiceAgentReport.attributes','exports','define','VoiceAgentReport'];(function(_0x3a2a3c,_0x37bd31){var _0x50ac9a=function(_0x494a7f){while(--_0x494a7f){_0x3a2a3c['push'](_0x3a2a3c['shift']());}};_0x50ac9a(++_0x37bd31);}(_0x038b,0x114));var _0xb038=function(_0x147144,_0x737b4a){_0x147144=_0x147144-0x0;var _0x33bb46=_0x038b[_0x147144];return _0x33bb46;};'use strict';var _=require('lodash');var util=require(_0xb038('0x0'));var logger=require(_0xb038('0x1'))(_0xb038('0x2'));var moment=require('moment');var BPromise=require(_0xb038('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb038('0x4'));var rimraf=require(_0xb038('0x5'));var config=require('../../config/environment');var attributes=require(_0xb038('0x6'));module[_0xb038('0x7')]=function(_0x4fe092,_0x54e1e7){return _0x4fe092[_0xb038('0x8')](_0xb038('0x9'),attributes,{'tableName':_0xb038('0xa'),'paranoid':![],'indexes':[{'fields':['uniqueid','destuniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x1501=['path','rimraf','./voiceAgentReport.attributes','define','VoiceAgentReport','report_agent','uniqueid','destuniqueid','util','../../config/logger','api','bluebird','request-promise'];(function(_0x169a8a,_0x3526b1){var _0x2e8502=function(_0x4c37f3){while(--_0x4c37f3){_0x169a8a['push'](_0x169a8a['shift']());}};_0x2e8502(++_0x3526b1);}(_0x1501,0x126));var _0x1150=function(_0x2b11e1,_0x5363eb){_0x2b11e1=_0x2b11e1-0x0;var _0x573679=_0x1501[_0x2b11e1];return _0x573679;};'use strict';var _=require('lodash');var util=require(_0x1150('0x0'));var logger=require(_0x1150('0x1'))(_0x1150('0x2'));var moment=require('moment');var BPromise=require(_0x1150('0x3'));var rp=require(_0x1150('0x4'));var fs=require('fs');var path=require(_0x1150('0x5'));var rimraf=require(_0x1150('0x6'));var config=require('../../config/environment');var attributes=require(_0x1150('0x7'));module['exports']=function(_0x63c724,_0x316a7d){return _0x63c724[_0x1150('0x8')](_0x1150('0x9'),attributes,{'tableName':_0x1150('0xa'),'paranoid':![],'indexes':[{'fields':[_0x1150('0xb'),_0x1150('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index 354343e..25d5732 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 _0x0ff3=['code','VoiceAgentReport,\x20%s,\x20%s','message','result','catch','create','body','options','raw','CreateVoiceAgentReport','UpdateVoiceAgentReport','VoiceAgentReport','update','where','attributes','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','debug','request\x20sent','stringify','error'];(function(_0x45c0f7,_0x3b1c07){var _0x56cb13=function(_0x3434f6){while(--_0x3434f6){_0x45c0f7['push'](_0x45c0f7['shift']());}};_0x56cb13(++_0x3b1c07);}(_0x0ff3,0x93));var _0x30ff=function(_0x2ef2cf,_0x55b72b){_0x2ef2cf=_0x2ef2cf-0x0;var _0x1ba4a0=_0x0ff3[_0x2ef2cf];return _0x1ba4a0;};'use strict';var _=require(_0x30ff('0x0'));var util=require(_0x30ff('0x1'));var moment=require(_0x30ff('0x2'));var BPromise=require(_0x30ff('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x30ff('0x4'));var db=require(_0x30ff('0x5'))['db'];var utils=require(_0x30ff('0x6'));var logger=require(_0x30ff('0x7'))(_0x30ff('0x8'));var config=require(_0x30ff('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x30ff('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x7dd67,_0x142104,_0x3f2f07){return new BPromise(function(_0x1bc0ba,_0x12fdf3){return client[_0x30ff('0xb')](_0x7dd67,_0x3f2f07)[_0x30ff('0xc')](function(_0x66e2e7){logger[_0x30ff('0xd')]('VoiceAgentReport,\x20%s,\x20%s',_0x142104,'request\x20sent');logger[_0x30ff('0xe')]('VoiceAgentReport,\x20%s,\x20%s,\x20%s',_0x142104,_0x30ff('0xf'),JSON[_0x30ff('0x10')](_0x66e2e7));if(_0x66e2e7[_0x30ff('0x11')]){if(_0x66e2e7[_0x30ff('0x11')][_0x30ff('0x12')]===0x1f4){logger[_0x30ff('0x11')](_0x30ff('0x13'),_0x142104,_0x66e2e7[_0x30ff('0x11')][_0x30ff('0x14')]);return _0x12fdf3(_0x66e2e7[_0x30ff('0x11')]['message']);}logger[_0x30ff('0x11')](_0x30ff('0x13'),_0x142104,_0x66e2e7[_0x30ff('0x11')][_0x30ff('0x14')]);return _0x1bc0ba(_0x66e2e7['error'][_0x30ff('0x14')]);}else{logger[_0x30ff('0xd')](_0x30ff('0x13'),_0x142104,_0x30ff('0xf'));_0x1bc0ba(_0x66e2e7[_0x30ff('0x15')]['message']);}})[_0x30ff('0x16')](function(_0x46e3e2){logger[_0x30ff('0x11')](_0x30ff('0x13'),_0x142104,_0x46e3e2);_0x12fdf3(_0x46e3e2);});});}exports['CreateVoiceAgentReport']=function(_0x5e7e31){var _0x1ba745=this;return new Promise(function(_0x4a0c23,_0x4e3574){return db['VoiceAgentReport'][_0x30ff('0x17')](_0x5e7e31[_0x30ff('0x18')],{'raw':_0x5e7e31[_0x30ff('0x19')]?_0x5e7e31[_0x30ff('0x19')][_0x30ff('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x5be07){logger[_0x30ff('0xd')](_0x30ff('0x1b'),_0x5e7e31);logger['debug'](_0x30ff('0x1b'),_0x5e7e31,JSON[_0x30ff('0x10')](_0x5be07));_0x4a0c23(_0x5be07);})['catch'](function(_0x51ab90){logger[_0x30ff('0x11')](_0x30ff('0x1b'),_0x51ab90[_0x30ff('0x14')],_0x5e7e31);_0x4e3574(_0x1ba745[_0x30ff('0x11')](0x1f4,_0x51ab90[_0x30ff('0x14')]));});});};exports[_0x30ff('0x1c')]=function(_0x3938c7){var _0x18e20b=this;return new Promise(function(_0x3c6c73,_0x2d583e){return db[_0x30ff('0x1d')][_0x30ff('0x1e')](_0x3938c7[_0x30ff('0x18')],{'raw':_0x3938c7['options']?_0x3938c7[_0x30ff('0x19')][_0x30ff('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3938c7[_0x30ff('0x19')]?_0x3938c7[_0x30ff('0x19')][_0x30ff('0x1f')]||null:null,'attributes':_0x3938c7[_0x30ff('0x19')]?_0x3938c7[_0x30ff('0x19')][_0x30ff('0x20')]||null:null,'limit':_0x3938c7[_0x30ff('0x19')]?_0x3938c7[_0x30ff('0x19')]['limit']||null:null})[_0x30ff('0xc')](function(_0x5ee190){logger[_0x30ff('0xd')](_0x30ff('0x1c'),_0x3938c7);logger[_0x30ff('0xe')]('UpdateVoiceAgentReport',_0x3938c7,JSON[_0x30ff('0x10')](_0x5ee190));_0x3c6c73(_0x5ee190);})[_0x30ff('0x16')](function(_0x4168c4){logger['error'](_0x30ff('0x1c'),_0x4168c4[_0x30ff('0x14')],_0x3938c7);_0x2d583e(_0x18e20b[_0x30ff('0x11')](0x1f4,_0x4168c4['message']));});});}; \ No newline at end of file +var _0x3062=['catch','CreateVoiceAgentReport','VoiceAgentReport','body','options','raw','stringify','UpdateVoiceAgentReport','update','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','VoiceAgentReport,\x20%s,\x20%s','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x3062,0xb5));var _0x2306=function(_0xcf5436,_0x4632c3){_0xcf5436=_0xcf5436-0x0;var _0xc4f5c8=_0x3062[_0xcf5436];return _0xc4f5c8;};'use strict';var _=require(_0x2306('0x0'));var util=require(_0x2306('0x1'));var moment=require(_0x2306('0x2'));var BPromise=require(_0x2306('0x3'));var rs=require(_0x2306('0x4'));var fs=require('fs');var Redis=require(_0x2306('0x5'));var db=require(_0x2306('0x6'))['db'];var utils=require(_0x2306('0x7'));var logger=require(_0x2306('0x8'))(_0x2306('0x9'));var config=require(_0x2306('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x2306('0xb')][_0x2306('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x437b5b,_0x833748,_0x3baf2a){return new BPromise(function(_0x5f498b,_0x46a29e){return client[_0x2306('0xd')](_0x437b5b,_0x3baf2a)[_0x2306('0xe')](function(_0xbc986f){logger[_0x2306('0xf')](_0x2306('0x10'),_0x833748,'request\x20sent');logger[_0x2306('0x11')](_0x2306('0x12'),_0x833748,_0x2306('0x13'),JSON['stringify'](_0xbc986f));if(_0xbc986f[_0x2306('0x14')]){if(_0xbc986f[_0x2306('0x14')]['code']===0x1f4){logger[_0x2306('0x14')](_0x2306('0x10'),_0x833748,_0xbc986f[_0x2306('0x14')]['message']);return _0x46a29e(_0xbc986f[_0x2306('0x14')]['message']);}logger[_0x2306('0x14')]('VoiceAgentReport,\x20%s,\x20%s',_0x833748,_0xbc986f['error'][_0x2306('0x15')]);return _0x5f498b(_0xbc986f['error'][_0x2306('0x15')]);}else{logger[_0x2306('0xf')](_0x2306('0x10'),_0x833748,_0x2306('0x13'));_0x5f498b(_0xbc986f[_0x2306('0x16')][_0x2306('0x15')]);}})[_0x2306('0x17')](function(_0x3c436a){logger['error']('VoiceAgentReport,\x20%s,\x20%s',_0x833748,_0x3c436a);_0x46a29e(_0x3c436a);});});}exports[_0x2306('0x18')]=function(_0x5302db){var _0x33958c=this;return new Promise(function(_0x49e00d,_0x52eb56){return db[_0x2306('0x19')]['create'](_0x5302db[_0x2306('0x1a')],{'raw':_0x5302db[_0x2306('0x1b')]?_0x5302db[_0x2306('0x1b')][_0x2306('0x1c')]===undefined?!![]:![]:!![]})[_0x2306('0xe')](function(_0x1bbd45){logger[_0x2306('0xf')]('CreateVoiceAgentReport',_0x5302db);logger[_0x2306('0x11')]('CreateVoiceAgentReport',_0x5302db,JSON[_0x2306('0x1d')](_0x1bbd45));_0x49e00d(_0x1bbd45);})[_0x2306('0x17')](function(_0x9d5ef8){logger['error'](_0x2306('0x18'),_0x9d5ef8['message'],_0x5302db);_0x52eb56(_0x33958c[_0x2306('0x14')](0x1f4,_0x9d5ef8['message']));});});};exports[_0x2306('0x1e')]=function(_0x14ea36){var _0x13838b=this;return new Promise(function(_0xda7b31,_0x501f93){return db['VoiceAgentReport'][_0x2306('0x1f')](_0x14ea36[_0x2306('0x1a')],{'raw':_0x14ea36[_0x2306('0x1b')]?_0x14ea36[_0x2306('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x14ea36['options']?_0x14ea36['options']['where']||null:null,'attributes':_0x14ea36[_0x2306('0x1b')]?_0x14ea36[_0x2306('0x1b')][_0x2306('0x20')]||null:null,'limit':_0x14ea36[_0x2306('0x1b')]?_0x14ea36[_0x2306('0x1b')][_0x2306('0x21')]||null:null})[_0x2306('0xe')](function(_0x3b3c8){logger['info']('UpdateVoiceAgentReport',_0x14ea36);logger[_0x2306('0x11')](_0x2306('0x1e'),_0x14ea36,JSON[_0x2306('0x1d')](_0x3b3c8));_0xda7b31(_0x3b3c8);})[_0x2306('0x17')](function(_0x1bbbff){logger[_0x2306('0x14')](_0x2306('0x1e'),_0x1bbbff[_0x2306('0x15')],_0x14ea36);_0x501f93(_0x13838b['error'](0x1f4,_0x1bbbff[_0x2306('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index 2b6fe28..557a13c 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 _0x5fd1=['path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','create','update','delete','destroy','exports','multer'];(function(_0x2b5c69,_0x5a1779){var _0x488b78=function(_0x52f9d2){while(--_0x52f9d2){_0x2b5c69['push'](_0x2b5c69['shift']());}};_0x488b78(++_0x5a1779);}(_0x5fd1,0x155));var _0x15fd=function(_0x4aa2ed,_0x2db5a4){_0x4aa2ed=_0x4aa2ed-0x0;var _0x27695f=_0x5fd1[_0x4aa2ed];return _0x27695f;};'use strict';var multer=require(_0x15fd('0x0'));var util=require('util');var path=require(_0x15fd('0x1'));var timeout=require(_0x15fd('0x2'));var express=require(_0x15fd('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x15fd('0x4'));var interaction=require(_0x15fd('0x5'));var config=require(_0x15fd('0x6'));var controller=require('./voiceCallReport.controller');router[_0x15fd('0x7')]('/',auth[_0x15fd('0x8')](),controller[_0x15fd('0x9')]);router[_0x15fd('0x7')](_0x15fd('0xa'),auth['isAuthenticated'](),controller[_0x15fd('0xb')]);router[_0x15fd('0x7')](_0x15fd('0xc'),auth['isAuthenticated'](),controller[_0x15fd('0xd')]);router['post']('/',auth[_0x15fd('0x8')](),controller[_0x15fd('0xe')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x15fd('0xf')]);router[_0x15fd('0x10')](_0x15fd('0xc'),auth[_0x15fd('0x8')](),controller[_0x15fd('0x11')]);module[_0x15fd('0x12')]=router; \ No newline at end of file +var _0xcb99=['create','put','update','delete','destroy','exports','multer','path','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceCallReport.controller','isAuthenticated','get','/describe','describe','/:id','show'];(function(_0x2616cd,_0x6b2d90){var _0x4e1fcb=function(_0x2562cb){while(--_0x2562cb){_0x2616cd['push'](_0x2616cd['shift']());}};_0x4e1fcb(++_0x6b2d90);}(_0xcb99,0x8b));var _0x9cb9=function(_0x14691c,_0xe1c878){_0x14691c=_0x14691c-0x0;var _0xbec98=_0xcb99[_0x14691c];return _0xbec98;};'use strict';var multer=require(_0x9cb9('0x0'));var util=require('util');var path=require(_0x9cb9('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x9cb9('0x2')]();var fs_extra=require(_0x9cb9('0x3'));var auth=require(_0x9cb9('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x9cb9('0x5'));var controller=require(_0x9cb9('0x6'));router['get']('/',auth[_0x9cb9('0x7')](),controller['index']);router[_0x9cb9('0x8')](_0x9cb9('0x9'),auth[_0x9cb9('0x7')](),controller[_0x9cb9('0xa')]);router[_0x9cb9('0x8')](_0x9cb9('0xb'),auth[_0x9cb9('0x7')](),controller[_0x9cb9('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x9cb9('0xd')]);router[_0x9cb9('0xe')](_0x9cb9('0xb'),auth['isAuthenticated'](),controller[_0x9cb9('0xf')]);router[_0x9cb9('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x9cb9('0x11')]);module[_0x9cb9('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index 8513222..4f350f9 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 _0x60e0=['sequelize','ENUM','internal','outbound','inbound-fax','outbound-fax','dialer','STRING','TEXT','DATE','INTEGER'];(function(_0x20e1f1,_0x37f32c){var _0x4fd6cd=function(_0x5e941b){while(--_0x5e941b){_0x20e1f1['push'](_0x20e1f1['shift']());}};_0x4fd6cd(++_0x37f32c);}(_0x60e0,0x176));var _0x060e=function(_0x5441af,_0x416437){_0x5441af=_0x5441af-0x0;var _0xafcc49=_0x60e0[_0x5441af];return _0xafcc49;};'use strict';var Sequelize=require(_0x060e('0x0'));module['exports']={'uniqueid':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x060e('0x1')]('inbound',_0x060e('0x2'),_0x060e('0x3'),_0x060e('0x4'),_0x060e('0x5'),_0x060e('0x6'))},'tag':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x060e('0x7')]},'source':{'type':Sequelize[_0x060e('0x7')]},'destination':{'type':Sequelize[_0x060e('0x7')]},'destinationcontext':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x060e('0x7')]},'destinationchannel':{'type':Sequelize[_0x060e('0x7')]},'lastapplication':{'type':Sequelize[_0x060e('0x7')]},'lastdata':{'type':Sequelize[_0x060e('0x8')]},'starttime':{'type':Sequelize[_0x060e('0x9')]},'systemanswertime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize['DATE']},'duration':{'type':Sequelize[_0x060e('0xa')]},'billableseconds':{'type':Sequelize[_0x060e('0xa')]},'mohtime':{'type':Sequelize[_0x060e('0xa')],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0x060e('0x7')]},'userfield':{'type':Sequelize[_0x060e('0x7')]},'userDisposition':{'type':Sequelize[_0x060e('0x7')]},'userSecondDisposition':{'type':Sequelize[_0x060e('0x7')]},'userThirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x060e('0x7')]},'prefix':{'type':Sequelize['STRING']},'routeid':{'type':Sequelize[_0x060e('0xa')]},'sipcallid':{'type':Sequelize[_0x060e('0x7')]}}; \ No newline at end of file +var _0x20a3=['dialer','DATE','INTEGER','sequelize','STRING','ENUM','inbound','outbound-fax'];(function(_0x328425,_0x388435){var _0x42dff5=function(_0x361bc0){while(--_0x361bc0){_0x328425['push'](_0x328425['shift']());}};_0x42dff5(++_0x388435);}(_0x20a3,0x15b));var _0x320a=function(_0x44cf57,_0x13a9e4){_0x44cf57=_0x44cf57-0x0;var _0x3b9f1d=_0x20a3[_0x44cf57];return _0x3b9f1d;};'use strict';var Sequelize=require(_0x320a('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x320a('0x1')]},'type':{'type':Sequelize[_0x320a('0x2')](_0x320a('0x3'),'internal','outbound','inbound-fax',_0x320a('0x4'),_0x320a('0x5'))},'tag':{'type':Sequelize[_0x320a('0x1')]},'accountcode':{'type':Sequelize[_0x320a('0x1')]},'source':{'type':Sequelize[_0x320a('0x1')]},'destination':{'type':Sequelize[_0x320a('0x1')]},'destinationcontext':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x320a('0x1')]},'destinationchannel':{'type':Sequelize[_0x320a('0x1')]},'lastapplication':{'type':Sequelize[_0x320a('0x1')]},'lastdata':{'type':Sequelize['TEXT']},'starttime':{'type':Sequelize['DATE']},'systemanswertime':{'type':Sequelize[_0x320a('0x6')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x320a('0x6')]},'duration':{'type':Sequelize[_0x320a('0x7')]},'billableseconds':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize[_0x320a('0x7')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x320a('0x1')]},'amaflags':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0x320a('0x1')]},'userDisposition':{'type':Sequelize[_0x320a('0x1')]},'userSecondDisposition':{'type':Sequelize[_0x320a('0x1')]},'userThirdDisposition':{'type':Sequelize[_0x320a('0x1')]},'note':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0x320a('0x1')]},'routeid':{'type':Sequelize[_0x320a('0x7')]},'sipcallid':{'type':Sequelize[_0x320a('0x1')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index af51f0d..ed91da2 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(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x5f66,0x1a0));var _0x65f6=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x5f66[_0x19e35c];return _0x3e1fe8;};'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 _0xb10b=['desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','reject','update','then','destroy','end','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','VIRTUAL','filter','merge','options','VoiceCallReport','includeAll','include','alias','User','rows','show','find','create','body','catch','params','describe','uniqueid','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce'];(function(_0x419202,_0x3d701b){var _0x903d09=function(_0x15a0c5){while(--_0x15a0c5){_0x419202['push'](_0x419202['shift']());}};_0x903d09(++_0x3d701b);}(_0xb10b,0x12a));var _0xbb10=function(_0x224f30,_0x4483c7){_0x224f30=_0x224f30-0x0;var _0x2a67ad=_0xb10b[_0x224f30];return _0x2a67ad;};'use strict';var emlformat=require(_0xbb10('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbb10('0x1'));var jsonpatch=require(_0xbb10('0x2'));var rp=require(_0xbb10('0x3'));var moment=require('moment');var BPromise=require(_0xbb10('0x4'));var Mustache=require(_0xbb10('0x5'));var util=require(_0xbb10('0x6'));var path=require(_0xbb10('0x7'));var sox=require(_0xbb10('0x8'));var csv=require(_0xbb10('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbb10('0xa'));var _=require(_0xbb10('0xb'));var squel=require('squel');var crypto=require(_0xbb10('0xc'));var jsforce=require(_0xbb10('0xd'));var deskjs=require(_0xbb10('0xe'));var toCsv=require(_0xbb10('0x9'));var querystring=require(_0xbb10('0xf'));var Papa=require(_0xbb10('0x10'));var Redis=require(_0xbb10('0x11'));var authService=require(_0xbb10('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbb10('0x13'));var logger=require(_0xbb10('0x14'))(_0xbb10('0x15'));var utils=require('../../config/utils');var config=require(_0xbb10('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xbb10('0x17'))['db'];function respondWithStatusCode(_0x916a32,_0x285009){_0x285009=_0x285009||0xcc;return function(_0x193a27){if(_0x193a27){return _0x916a32[_0xbb10('0x18')](_0x285009);}return _0x916a32[_0xbb10('0x19')](_0x285009)['end']();};}function respondWithResult(_0x26e021,_0x42d7e4){_0x42d7e4=_0x42d7e4||0xc8;return function(_0x45b9d6){if(_0x45b9d6){return _0x26e021[_0xbb10('0x19')](_0x42d7e4)[_0xbb10('0x1a')](_0x45b9d6);}};}function respondWithFilteredResult(_0x2f2ebf,_0x24a57b){return function(_0x36b5e8){if(_0x36b5e8){var _0x3e26f4=typeof _0x24a57b[_0xbb10('0x1b')]==='undefined'&&typeof _0x24a57b[_0xbb10('0x1c')]===_0xbb10('0x1d');var _0x133ac2=_0x36b5e8[_0xbb10('0x1e')];var _0x378da8=_0x3e26f4?0x0:_0x24a57b[_0xbb10('0x1b')];var _0x575cca=_0x3e26f4?_0x36b5e8[_0xbb10('0x1e')]:_0x24a57b[_0xbb10('0x1b')]+_0x24a57b[_0xbb10('0x1c')];var _0x48b6e9;if(_0x575cca>=_0x133ac2){_0x575cca=_0x133ac2;_0x48b6e9=0xc8;}else{_0x48b6e9=0xce;}_0x2f2ebf[_0xbb10('0x19')](_0x48b6e9);return _0x2f2ebf[_0xbb10('0x1f')](_0xbb10('0x20'),_0x378da8+'-'+_0x575cca+'/'+_0x133ac2)[_0xbb10('0x1a')](_0x36b5e8);}return null;};}function patchUpdates(_0xdf237d){return function(_0x44e563){try{jsonpatch['apply'](_0x44e563,_0xdf237d,!![]);}catch(_0x12f888){return BPromise[_0xbb10('0x21')](_0x12f888);}return _0x44e563['save']();};}function saveUpdates(_0x4c4b0d,_0x8e2b97){return function(_0x311abe){if(_0x311abe){return _0x311abe[_0xbb10('0x22')](_0x4c4b0d)[_0xbb10('0x23')](function(_0x445761){return _0x445761;});}return null;};}function removeEntity(_0x1824b7,_0x407cb4){return function(_0x436104){if(_0x436104){return _0x436104[_0xbb10('0x24')]()[_0xbb10('0x23')](function(){_0x1824b7[_0xbb10('0x19')](0xcc)[_0xbb10('0x25')]();});}};}function handleEntityNotFound(_0x537898,_0x4fedac){return function(_0x4fb5e0){if(!_0x4fb5e0){_0x537898[_0xbb10('0x18')](0x194);}return _0x4fb5e0;};}function handleError(_0x3c5ae7,_0x2c89b9){_0x2c89b9=_0x2c89b9||0x1f4;return function(_0x4e25ff){logger[_0xbb10('0x26')](_0x4e25ff[_0xbb10('0x27')]);if(_0x4e25ff[_0xbb10('0x28')]){delete _0x4e25ff[_0xbb10('0x28')];}_0x3c5ae7[_0xbb10('0x19')](_0x2c89b9)[_0xbb10('0x29')](_0x4e25ff);};}exports[_0xbb10('0x2a')]=function(_0x4aabb9,_0x3796c7){var _0x21ac54={},_0xfc3595={},_0x2e0249={'count':0x0,'rows':[]};var _0x1d30aa=_[_0xbb10('0x2b')](db['VoiceCallReport'][_0xbb10('0x2c')],function(_0x4ee02e){return{'name':_0x4ee02e[_0xbb10('0x2d')],'type':_0x4ee02e['type'][_0xbb10('0x2e')]};});_0xfc3595[_0xbb10('0x2f')]=_[_0xbb10('0x2b')](_0x1d30aa,'name');_0xfc3595['query']=_[_0xbb10('0x30')](_0x4aabb9[_0xbb10('0x31')]);_0xfc3595['filters']=_[_0xbb10('0x32')](_0xfc3595[_0xbb10('0x2f')],_0xfc3595[_0xbb10('0x31')]);_0x21ac54[_0xbb10('0x33')]=_[_0xbb10('0x32')](_0xfc3595[_0xbb10('0x2f')],qs[_0xbb10('0x34')](_0x4aabb9['query'][_0xbb10('0x34')]));_0x21ac54[_0xbb10('0x33')]=_0x21ac54[_0xbb10('0x33')][_0xbb10('0x35')]?_0x21ac54[_0xbb10('0x33')]:_0xfc3595[_0xbb10('0x2f')];if(!_0x4aabb9[_0xbb10('0x31')][_0xbb10('0x36')](_0xbb10('0x37'))){_0x21ac54['limit']=qs[_0xbb10('0x1c')](_0x4aabb9[_0xbb10('0x31')][_0xbb10('0x1c')]);_0x21ac54[_0xbb10('0x1b')]=qs['offset'](_0x4aabb9[_0xbb10('0x31')]['offset']);}_0x21ac54['order']=qs[_0xbb10('0x38')](_0x4aabb9[_0xbb10('0x31')][_0xbb10('0x38')]);_0x21ac54[_0xbb10('0x39')]=qs[_0xbb10('0x3a')](_[_0xbb10('0x3b')](_0x4aabb9['query'],_0xfc3595[_0xbb10('0x3a')]),_0x1d30aa);if(_0x4aabb9[_0xbb10('0x31')]['filter']){_0x21ac54['where']=_['merge'](_0x21ac54[_0xbb10('0x39')],{'$or':_[_0xbb10('0x2b')](_0x1d30aa,function(_0x2b658a){if(_0x2b658a['type']!==_0xbb10('0x3c')){var _0x3e8538={};_0x3e8538[_0x2b658a[_0xbb10('0x28')]]={'$like':'%'+_0x4aabb9['query'][_0xbb10('0x3d')]+'%'};return _0x3e8538;}})});}_0x21ac54=_[_0xbb10('0x3e')]({},_0x21ac54,_0x4aabb9[_0xbb10('0x3f')]);var _0x446f49={'where':_0x21ac54['where']};return db[_0xbb10('0x40')][_0xbb10('0x1e')](_0x446f49)['then'](function(_0xe2040f){_0x2e0249[_0xbb10('0x1e')]=_0xe2040f;if(_0x4aabb9[_0xbb10('0x31')][_0xbb10('0x41')]){_0x21ac54[_0xbb10('0x42')]=[{'attributes':['id',_0xbb10('0x28'),'fullname',_0xbb10('0x43')],'model':db[_0xbb10('0x44')],'as':_0xbb10('0x44')}];}return db[_0xbb10('0x40')]['findAll'](_0x21ac54);})[_0xbb10('0x23')](function(_0x331751){_0x2e0249[_0xbb10('0x45')]=_0x331751;return _0x2e0249;})[_0xbb10('0x23')](respondWithFilteredResult(_0x3796c7,_0x21ac54))['catch'](handleError(_0x3796c7,null));};exports[_0xbb10('0x46')]=function(_0x202c60,_0x54ac18){var _0x5d9a4f={'raw':!![],'where':{'id':_0x202c60['params']['id']}},_0x38d78f={};_0x38d78f[_0xbb10('0x2f')]=_[_0xbb10('0x30')](db['VoiceCallReport'][_0xbb10('0x2c')]);_0x38d78f[_0xbb10('0x31')]=_[_0xbb10('0x30')](_0x202c60['query']);_0x38d78f[_0xbb10('0x3a')]=_[_0xbb10('0x32')](_0x38d78f[_0xbb10('0x2f')],_0x38d78f[_0xbb10('0x31')]);_0x5d9a4f[_0xbb10('0x33')]=_[_0xbb10('0x32')](_0x38d78f[_0xbb10('0x2f')],qs[_0xbb10('0x34')](_0x202c60[_0xbb10('0x31')][_0xbb10('0x34')]));_0x5d9a4f[_0xbb10('0x33')]=_0x5d9a4f[_0xbb10('0x33')]['length']?_0x5d9a4f[_0xbb10('0x33')]:_0x38d78f[_0xbb10('0x2f')];if(_0x202c60['query'][_0xbb10('0x41')]){_0x5d9a4f[_0xbb10('0x42')]=[{'all':!![]}];}_0x5d9a4f=_[_0xbb10('0x3e')]({},_0x5d9a4f,_0x202c60[_0xbb10('0x3f')]);return db[_0xbb10('0x40')][_0xbb10('0x47')](_0x5d9a4f)[_0xbb10('0x23')](handleEntityNotFound(_0x54ac18,null))['then'](respondWithResult(_0x54ac18,null))['catch'](handleError(_0x54ac18,null));};exports[_0xbb10('0x48')]=function(_0x76a208,_0x2b12bd){return db['VoiceCallReport']['create'](_0x76a208[_0xbb10('0x49')],{})[_0xbb10('0x23')](respondWithResult(_0x2b12bd,0xc9))[_0xbb10('0x4a')](handleError(_0x2b12bd,null));};exports[_0xbb10('0x24')]=function(_0x10159b,_0x22b315){return db[_0xbb10('0x40')][_0xbb10('0x47')]({'where':{'id':_0x10159b[_0xbb10('0x4b')]['id']}})[_0xbb10('0x23')](handleEntityNotFound(_0x22b315,null))['then'](removeEntity(_0x22b315,null))['catch'](handleError(_0x22b315,null));};exports[_0xbb10('0x4c')]=function(_0x467dba,_0x36ab7d){return db[_0xbb10('0x40')][_0xbb10('0x4c')]()[_0xbb10('0x23')](respondWithResult(_0x36ab7d,null))[_0xbb10('0x4a')](handleError(_0x36ab7d,null));};exports[_0xbb10('0x22')]=function(_0x1c0d8f,_0x1214f7){if(_0x1c0d8f[_0xbb10('0x49')][_0xbb10('0x4d')]){delete _0x1c0d8f[_0xbb10('0x49')][_0xbb10('0x4d')];}return db[_0xbb10('0x40')]['find']({'where':{'uniqueid':_0x1c0d8f[_0xbb10('0x4b')]['id'],'UserId':{'$or':[null,_0x1c0d8f['user']['id']]}}})[_0xbb10('0x23')](handleEntityNotFound(_0x1214f7,null))[_0xbb10('0x23')](saveUpdates(_0x1c0d8f[_0xbb10('0x49')],null))[_0xbb10('0x23')](respondWithResult(_0x1214f7,null))[_0xbb10('0x4a')](handleError(_0x1214f7,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index f8d7b9d..fffda9d 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 _0x2c23=['request-promise','rimraf','exports','define','VoiceCallReport','report_call','uniqueid','lodash','util','api','moment','bluebird'];(function(_0x46c8d6,_0x16fa9b){var _0x2084ec=function(_0x27a089){while(--_0x27a089){_0x46c8d6['push'](_0x46c8d6['shift']());}};_0x2084ec(++_0x16fa9b);}(_0x2c23,0xdf));var _0x32c2=function(_0x3e0a0e,_0x1ecf6d){_0x3e0a0e=_0x3e0a0e-0x0;var _0x8e0d0a=_0x2c23[_0x3e0a0e];return _0x8e0d0a;};'use strict';var _=require(_0x32c2('0x0'));var util=require(_0x32c2('0x1'));var logger=require('../../config/logger')(_0x32c2('0x2'));var moment=require(_0x32c2('0x3'));var BPromise=require(_0x32c2('0x4'));var rp=require(_0x32c2('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x32c2('0x6'));var config=require('../../config/environment');var attributes=require('./voiceCallReport.attributes');module[_0x32c2('0x7')]=function(_0x1f73b1,_0x374443){return _0x1f73b1[_0x32c2('0x8')](_0x32c2('0x9'),attributes,{'tableName':_0x32c2('0xa'),'paranoid':![],'indexes':[{'fields':[_0x32c2('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7a92=['define','uniqueid','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceCallReport.attributes','exports'];(function(_0x4b9539,_0x45481c){var _0xae78c5=function(_0x4385b4){while(--_0x4385b4){_0x4b9539['push'](_0x4b9539['shift']());}};_0xae78c5(++_0x45481c);}(_0x7a92,0x1bc));var _0x27a9=function(_0x15d5e3,_0xeac1e4){_0x15d5e3=_0x15d5e3-0x0;var _0x21a7e5=_0x7a92[_0x15d5e3];return _0x21a7e5;};'use strict';var _=require(_0x27a9('0x0'));var util=require(_0x27a9('0x1'));var logger=require('../../config/logger')(_0x27a9('0x2'));var moment=require(_0x27a9('0x3'));var BPromise=require(_0x27a9('0x4'));var rp=require(_0x27a9('0x5'));var fs=require('fs');var path=require(_0x27a9('0x6'));var rimraf=require(_0x27a9('0x7'));var config=require(_0x27a9('0x8'));var attributes=require(_0x27a9('0x9'));module[_0x27a9('0xa')]=function(_0x3a53b3,_0x37689a){return _0x3a53b3[_0x27a9('0xb')]('VoiceCallReport',attributes,{'tableName':'report_call','paranoid':![],'indexes':[{'fields':[_0x27a9('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index 3c44e56..759d857 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 _0x42e9=['CreateVoiceCallReport','VoiceCallReport','create','body','UpdateVoiceCallReport','update','lodash','util','moment','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','error','message','catch','GetVoiceCallReport','findAll','options','raw','where','attributes','limit','map','include','model','stringify'];(function(_0x1ce51a,_0x1f2adc){var _0x4073f8=function(_0x2fbaee){while(--_0x2fbaee){_0x1ce51a['push'](_0x1ce51a['shift']());}};_0x4073f8(++_0x1f2adc);}(_0x42e9,0x136));var _0x942e=function(_0x19f973,_0x2a7edc){_0x19f973=_0x19f973-0x0;var _0x1146a7=_0x42e9[_0x19f973];return _0x1146a7;};'use strict';var _=require(_0x942e('0x0'));var util=require(_0x942e('0x1'));var moment=require(_0x942e('0x2'));var BPromise=require('bluebird');var rs=require(_0x942e('0x3'));var fs=require('fs');var Redis=require(_0x942e('0x4'));var db=require(_0x942e('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x942e('0x6'));var config=require(_0x942e('0x7'));var jayson=require(_0x942e('0x8'));var client=jayson[_0x942e('0x9')][_0x942e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5ad780,_0x3aae00,_0x444b98){return new BPromise(function(_0xec84e5,_0x1cd7e5){return client[_0x942e('0xb')](_0x5ad780,_0x444b98)[_0x942e('0xc')](function(_0x100dea){logger[_0x942e('0xd')](_0x942e('0xe'),_0x3aae00,_0x942e('0xf'));logger[_0x942e('0x10')](_0x942e('0x11'),_0x3aae00,'request\x20sent',JSON['stringify'](_0x100dea));if(_0x100dea[_0x942e('0x12')]){if(_0x100dea[_0x942e('0x12')]['code']===0x1f4){logger[_0x942e('0x12')]('VoiceCallReport,\x20%s,\x20%s',_0x3aae00,_0x100dea[_0x942e('0x12')][_0x942e('0x13')]);return _0x1cd7e5(_0x100dea[_0x942e('0x12')][_0x942e('0x13')]);}logger[_0x942e('0x12')]('VoiceCallReport,\x20%s,\x20%s',_0x3aae00,_0x100dea[_0x942e('0x12')][_0x942e('0x13')]);return _0xec84e5(_0x100dea[_0x942e('0x12')][_0x942e('0x13')]);}else{logger[_0x942e('0xd')]('VoiceCallReport,\x20%s,\x20%s',_0x3aae00,_0x942e('0xf'));_0xec84e5(_0x100dea['result'][_0x942e('0x13')]);}})[_0x942e('0x14')](function(_0x12c75e){logger['error']('VoiceCallReport,\x20%s,\x20%s',_0x3aae00,_0x12c75e);_0x1cd7e5(_0x12c75e);});});}exports[_0x942e('0x15')]=function(_0x3e7d28){var _0x276e77=this;return new Promise(function(_0x113a50,_0x2a092e){return db['VoiceCallReport'][_0x942e('0x16')]({'raw':_0x3e7d28[_0x942e('0x17')]?_0x3e7d28['options'][_0x942e('0x18')]===undefined?!![]:![]:!![],'where':_0x3e7d28[_0x942e('0x17')]?_0x3e7d28['options'][_0x942e('0x19')]||null:null,'attributes':_0x3e7d28[_0x942e('0x17')]?_0x3e7d28[_0x942e('0x17')][_0x942e('0x1a')]||null:null,'limit':_0x3e7d28[_0x942e('0x17')]?_0x3e7d28[_0x942e('0x17')][_0x942e('0x1b')]||null:null,'include':_0x3e7d28['options']?_0x3e7d28[_0x942e('0x17')]['include']?_[_0x942e('0x1c')](_0x3e7d28[_0x942e('0x17')][_0x942e('0x1d')],function(_0x288600){return{'model':db[_0x288600[_0x942e('0x1e')]],'as':_0x288600['as'],'attributes':_0x288600[_0x942e('0x1a')],'include':_0x288600[_0x942e('0x1d')]?_['map'](_0x288600[_0x942e('0x1d')],function(_0x3d93e9){return{'model':db[_0x3d93e9[_0x942e('0x1e')]],'as':_0x3d93e9['as'],'attributes':_0x3d93e9[_0x942e('0x1a')],'include':_0x3d93e9[_0x942e('0x1d')]?_[_0x942e('0x1c')](_0x3d93e9[_0x942e('0x1d')],function(_0x4e20f0){return{'model':db[_0x4e20f0[_0x942e('0x1e')]],'as':_0x4e20f0['as'],'attributes':_0x4e20f0[_0x942e('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x942e('0xc')](function(_0x7a3d2b){logger[_0x942e('0xd')](_0x942e('0x15'),_0x3e7d28);logger['debug'](_0x942e('0x15'),_0x3e7d28,JSON[_0x942e('0x1f')](_0x7a3d2b));_0x113a50(_0x7a3d2b);})[_0x942e('0x14')](function(_0x31e650){logger[_0x942e('0x12')](_0x942e('0x15'),_0x31e650[_0x942e('0x13')],_0x3e7d28);_0x2a092e(_0x276e77[_0x942e('0x12')](0x1f4,_0x31e650[_0x942e('0x13')]));});});};exports[_0x942e('0x20')]=function(_0x2ff3b2){var _0x8014b5=this;return new Promise(function(_0x1a67fe,_0x4633b8){return db[_0x942e('0x21')][_0x942e('0x22')](_0x2ff3b2[_0x942e('0x23')],{'raw':_0x2ff3b2['options']?_0x2ff3b2[_0x942e('0x17')][_0x942e('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x26c3a3){logger[_0x942e('0xd')](_0x942e('0x20'),_0x2ff3b2);logger[_0x942e('0x10')]('CreateVoiceCallReport',_0x2ff3b2,JSON[_0x942e('0x1f')](_0x26c3a3));_0x1a67fe(_0x26c3a3);})[_0x942e('0x14')](function(_0x159959){logger[_0x942e('0x12')]('CreateVoiceCallReport',_0x159959[_0x942e('0x13')],_0x2ff3b2);_0x4633b8(_0x8014b5[_0x942e('0x12')](0x1f4,_0x159959['message']));});});};exports[_0x942e('0x24')]=function(_0x178cd7){var _0x140f24=this;return new Promise(function(_0x25d792,_0xaf41d9){return db[_0x942e('0x21')][_0x942e('0x25')](_0x178cd7['body'],{'raw':_0x178cd7['options']?_0x178cd7[_0x942e('0x17')][_0x942e('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x178cd7['options']?_0x178cd7[_0x942e('0x17')][_0x942e('0x19')]||null:null,'attributes':_0x178cd7[_0x942e('0x17')]?_0x178cd7[_0x942e('0x17')][_0x942e('0x1a')]||null:null,'limit':_0x178cd7[_0x942e('0x17')]?_0x178cd7['options']['limit']||null:null})[_0x942e('0xc')](function(_0x2e3f2c){logger[_0x942e('0xd')](_0x942e('0x24'),_0x178cd7);logger[_0x942e('0x10')]('UpdateVoiceCallReport',_0x178cd7,JSON[_0x942e('0x1f')](_0x2e3f2c));_0x25d792(_0x2e3f2c);})['catch'](function(_0x57474b){logger[_0x942e('0x12')]('UpdateVoiceCallReport',_0x57474b[_0x942e('0x13')],_0x178cd7);_0xaf41d9(_0x140f24[_0x942e('0x12')](0x1f4,_0x57474b['message']));});});}; \ No newline at end of file +var _0x2052=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','VoiceCallReport,\x20%s,\x20%s','message','result','catch','GetVoiceCallReport','VoiceCallReport','findAll','raw','options','attributes','limit','include','model','map','CreateVoiceCallReport','create','UpdateVoiceCallReport','update','where'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x2052,0x75));var _0x2205=function(_0x288cd1,_0x5541f4){_0x288cd1=_0x288cd1-0x0;var _0x2ab25a=_0x2052[_0x288cd1];return _0x2ab25a;};'use strict';var _=require('lodash');var util=require(_0x2205('0x0'));var moment=require(_0x2205('0x1'));var BPromise=require(_0x2205('0x2'));var rs=require(_0x2205('0x3'));var fs=require('fs');var Redis=require(_0x2205('0x4'));var db=require(_0x2205('0x5'))['db'];var utils=require(_0x2205('0x6'));var logger=require('../../config/logger')(_0x2205('0x7'));var config=require(_0x2205('0x8'));var jayson=require(_0x2205('0x9'));var client=jayson[_0x2205('0xa')][_0x2205('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x34b4a3,_0x4bf429,_0x51e9cd){return new BPromise(function(_0x1c03cb,_0x4b7b0d){return client[_0x2205('0xc')](_0x34b4a3,_0x51e9cd)[_0x2205('0xd')](function(_0x5795d7){logger[_0x2205('0xe')]('VoiceCallReport,\x20%s,\x20%s',_0x4bf429,'request\x20sent');logger[_0x2205('0xf')](_0x2205('0x10'),_0x4bf429,_0x2205('0x11'),JSON[_0x2205('0x12')](_0x5795d7));if(_0x5795d7[_0x2205('0x13')]){if(_0x5795d7[_0x2205('0x13')]['code']===0x1f4){logger[_0x2205('0x13')](_0x2205('0x14'),_0x4bf429,_0x5795d7['error'][_0x2205('0x15')]);return _0x4b7b0d(_0x5795d7[_0x2205('0x13')]['message']);}logger[_0x2205('0x13')](_0x2205('0x14'),_0x4bf429,_0x5795d7['error']['message']);return _0x1c03cb(_0x5795d7['error'][_0x2205('0x15')]);}else{logger[_0x2205('0xe')](_0x2205('0x14'),_0x4bf429,_0x2205('0x11'));_0x1c03cb(_0x5795d7[_0x2205('0x16')][_0x2205('0x15')]);}})[_0x2205('0x17')](function(_0x549f5a){logger[_0x2205('0x13')]('VoiceCallReport,\x20%s,\x20%s',_0x4bf429,_0x549f5a);_0x4b7b0d(_0x549f5a);});});}exports[_0x2205('0x18')]=function(_0x2bcc7b){var _0x122953=this;return new Promise(function(_0x2b16b8,_0xa40eb2){return db[_0x2205('0x19')][_0x2205('0x1a')]({'raw':_0x2bcc7b['options']?_0x2bcc7b['options'][_0x2205('0x1b')]===undefined?!![]:![]:!![],'where':_0x2bcc7b[_0x2205('0x1c')]?_0x2bcc7b[_0x2205('0x1c')]['where']||null:null,'attributes':_0x2bcc7b[_0x2205('0x1c')]?_0x2bcc7b[_0x2205('0x1c')][_0x2205('0x1d')]||null:null,'limit':_0x2bcc7b[_0x2205('0x1c')]?_0x2bcc7b[_0x2205('0x1c')][_0x2205('0x1e')]||null:null,'include':_0x2bcc7b[_0x2205('0x1c')]?_0x2bcc7b[_0x2205('0x1c')][_0x2205('0x1f')]?_['map'](_0x2bcc7b[_0x2205('0x1c')][_0x2205('0x1f')],function(_0x488eb5){return{'model':db[_0x488eb5[_0x2205('0x20')]],'as':_0x488eb5['as'],'attributes':_0x488eb5[_0x2205('0x1d')],'include':_0x488eb5['include']?_[_0x2205('0x21')](_0x488eb5[_0x2205('0x1f')],function(_0x4dd23d){return{'model':db[_0x4dd23d['model']],'as':_0x4dd23d['as'],'attributes':_0x4dd23d[_0x2205('0x1d')],'include':_0x4dd23d[_0x2205('0x1f')]?_[_0x2205('0x21')](_0x4dd23d[_0x2205('0x1f')],function(_0x4822a2){return{'model':db[_0x4822a2[_0x2205('0x20')]],'as':_0x4822a2['as'],'attributes':_0x4822a2[_0x2205('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x2205('0xd')](function(_0x1ac6cb){logger[_0x2205('0xe')](_0x2205('0x18'),_0x2bcc7b);logger['debug'](_0x2205('0x18'),_0x2bcc7b,JSON[_0x2205('0x12')](_0x1ac6cb));_0x2b16b8(_0x1ac6cb);})['catch'](function(_0x32164e){logger[_0x2205('0x13')](_0x2205('0x18'),_0x32164e[_0x2205('0x15')],_0x2bcc7b);_0xa40eb2(_0x122953[_0x2205('0x13')](0x1f4,_0x32164e[_0x2205('0x15')]));});});};exports[_0x2205('0x22')]=function(_0x379502){var _0x106d23=this;return new Promise(function(_0x570d38,_0x18f8d8){return db[_0x2205('0x19')][_0x2205('0x23')](_0x379502['body'],{'raw':_0x379502[_0x2205('0x1c')]?_0x379502[_0x2205('0x1c')][_0x2205('0x1b')]===undefined?!![]:![]:!![]})[_0x2205('0xd')](function(_0x438585){logger[_0x2205('0xe')](_0x2205('0x22'),_0x379502);logger[_0x2205('0xf')](_0x2205('0x22'),_0x379502,JSON[_0x2205('0x12')](_0x438585));_0x570d38(_0x438585);})['catch'](function(_0x16eceb){logger[_0x2205('0x13')]('CreateVoiceCallReport',_0x16eceb[_0x2205('0x15')],_0x379502);_0x18f8d8(_0x106d23[_0x2205('0x13')](0x1f4,_0x16eceb[_0x2205('0x15')]));});});};exports[_0x2205('0x24')]=function(_0x286f58){var _0x454244=this;return new Promise(function(_0x510926,_0x375c69){return db['VoiceCallReport'][_0x2205('0x25')](_0x286f58['body'],{'raw':_0x286f58[_0x2205('0x1c')]?_0x286f58[_0x2205('0x1c')][_0x2205('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x286f58['options']?_0x286f58[_0x2205('0x1c')][_0x2205('0x26')]||null:null,'attributes':_0x286f58['options']?_0x286f58[_0x2205('0x1c')][_0x2205('0x1d')]||null:null,'limit':_0x286f58['options']?_0x286f58['options'][_0x2205('0x1e')]||null:null})['then'](function(_0x53acff){logger[_0x2205('0xe')]('UpdateVoiceCallReport',_0x286f58);logger[_0x2205('0xf')](_0x2205('0x24'),_0x286f58,JSON[_0x2205('0x12')](_0x53acff));_0x510926(_0x53acff);})['catch'](function(_0x190659){logger['error']('UpdateVoiceCallReport',_0x190659[_0x2205('0x15')],_0x286f58);_0x375c69(_0x454244[_0x2205('0x13')](0x1f4,_0x190659['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index 993f083..ad69e07 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 _0xe527=['post','create','put','delete','destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','get','isAuthenticated','index','/:id','show'];(function(_0x328ad2,_0x4718c1){var _0x5d439e=function(_0x5cfb74){while(--_0x5cfb74){_0x328ad2['push'](_0x328ad2['shift']());}};_0x5d439e(++_0x4718c1);}(_0xe527,0x91));var _0x7e52=function(_0x207803,_0x203963){_0x207803=_0x207803-0x0;var _0x23223a=_0xe527[_0x207803];return _0x23223a;};'use strict';var multer=require(_0x7e52('0x0'));var util=require(_0x7e52('0x1'));var path=require(_0x7e52('0x2'));var timeout=require(_0x7e52('0x3'));var express=require(_0x7e52('0x4'));var router=express['Router']();var fs_extra=require(_0x7e52('0x5'));var auth=require(_0x7e52('0x6'));var interaction=require(_0x7e52('0x7'));var config=require(_0x7e52('0x8'));var controller=require(_0x7e52('0x9'));router[_0x7e52('0xa')]('/',auth[_0x7e52('0xb')](),controller[_0x7e52('0xc')]);router[_0x7e52('0xa')](_0x7e52('0xd'),auth[_0x7e52('0xb')](),controller[_0x7e52('0xe')]);router[_0x7e52('0xf')]('/',auth[_0x7e52('0xb')](),controller[_0x7e52('0x10')]);router[_0x7e52('0x11')](_0x7e52('0xd'),auth[_0x7e52('0xb')](),controller['update']);router[_0x7e52('0x12')](_0x7e52('0xd'),auth['isAuthenticated'](),controller[_0x7e52('0x13')]);module['exports']=router; \ No newline at end of file +var _0xd1b0=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','get','isAuthenticated','index','/:id','show','post','create','update','delete','exports','multer','path','connect-timeout','Router'];(function(_0x4b10f2,_0x1ef8b7){var _0x5262f3=function(_0x20c446){while(--_0x20c446){_0x4b10f2['push'](_0x4b10f2['shift']());}};_0x5262f3(++_0x1ef8b7);}(_0xd1b0,0x94));var _0x0d1b=function(_0x399987,_0x50ccf8){_0x399987=_0x399987-0x0;var _0x84b960=_0xd1b0[_0x399987];return _0x84b960;};'use strict';var multer=require(_0x0d1b('0x0'));var util=require('util');var path=require(_0x0d1b('0x1'));var timeout=require(_0x0d1b('0x2'));var express=require('express');var router=express[_0x0d1b('0x3')]();var fs_extra=require(_0x0d1b('0x4'));var auth=require(_0x0d1b('0x5'));var interaction=require(_0x0d1b('0x6'));var config=require(_0x0d1b('0x7'));var controller=require(_0x0d1b('0x8'));router[_0x0d1b('0x9')]('/',auth[_0x0d1b('0xa')](),controller[_0x0d1b('0xb')]);router[_0x0d1b('0x9')](_0x0d1b('0xc'),auth[_0x0d1b('0xa')](),controller[_0x0d1b('0xd')]);router[_0x0d1b('0xe')]('/',auth['isAuthenticated'](),controller[_0x0d1b('0xf')]);router['put'](_0x0d1b('0xc'),auth[_0x0d1b('0xa')](),controller[_0x0d1b('0x10')]);router[_0x0d1b('0x11')](_0x0d1b('0xc'),auth[_0x0d1b('0xa')](),controller['destroy']);module[_0x0d1b('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index 1d6df04..58fbbd5 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 _0x20f0=['setDataValue','options','getDataValue','split','BOOLEAN','sequelize','exports','STRING','name'];(function(_0x15cdcb,_0x4340e9){var _0x37b069=function(_0x304cfb){while(--_0x304cfb){_0x15cdcb['push'](_0x15cdcb['shift']());}};_0x37b069(++_0x4340e9);}(_0x20f0,0x1eb));var _0x020f=function(_0x541260,_0x4c7f2e){_0x541260=_0x541260-0x0;var _0x1dd2b5=_0x20f0[_0x541260];return _0x1dd2b5;};'use strict';var Sequelize=require(_0x020f('0x0'));module[_0x020f('0x1')]={'name':{'type':Sequelize[_0x020f('0x2')]},'prefix':{'type':Sequelize['STRING'],'unique':_0x020f('0x3'),'allowNull':![]},'options':{'type':Sequelize[_0x020f('0x2')],'set':function(_0x3c183f){this[_0x020f('0x4')](_0x020f('0x5'),_0x3c183f?_0x3c183f['join'](''):[]);},'get':function(){return this['getDataValue'](_0x020f('0x5'))?this[_0x020f('0x6')]('options')[_0x020f('0x7')](''):[];}},'auth':{'type':Sequelize[_0x020f('0x8')],'defaultValue':![]},'password':{'type':Sequelize['STRING']},'record':{'type':Sequelize[_0x020f('0x8')],'defaultValue':![]},'recordingFormat':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x020f('0x2')]}}; \ No newline at end of file +var _0xfdf4=['options','getDataValue','BOOLEAN','exports','STRING','name','setDataValue'];(function(_0x104a74,_0x262379){var _0x820291=function(_0x51005e){while(--_0x51005e){_0x104a74['push'](_0x104a74['shift']());}};_0x820291(++_0x262379);}(_0xfdf4,0x88));var _0x4fdf=function(_0x3f3836,_0x260fca){_0x3f3836=_0x3f3836-0x0;var _0x547966=_0xfdf4[_0x3f3836];return _0x547966;};'use strict';var Sequelize=require('sequelize');module[_0x4fdf('0x0')]={'name':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0x4fdf('0x1')],'unique':_0x4fdf('0x2'),'allowNull':![]},'options':{'type':Sequelize[_0x4fdf('0x1')],'set':function(_0x5d9904){this[_0x4fdf('0x3')](_0x4fdf('0x4'),_0x5d9904?_0x5d9904['join'](''):[]);},'get':function(){return this['getDataValue']('options')?this[_0x4fdf('0x5')](_0x4fdf('0x4'))['split'](''):[];}},'auth':{'type':Sequelize[_0x4fdf('0x6')],'defaultValue':![]},'password':{'type':Sequelize['STRING']},'record':{'type':Sequelize[_0x4fdf('0x6')],'defaultValue':![]},'recordingFormat':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index ca91b1e..36347fc 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 _0xa900=['intersection','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','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','mustache','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','save','update','then','destroy','get','ChanSpies','UserProfileResource','error','name','index','map','rawAttributes','fieldName','type','key','model','query','filters','fields','attributes','length','hasOwnProperty','nolimit','order','where','filter','VIRTUAL','merge','VoiceChanSpy','includeAll','include','findAll','rows','catch','show','params','keys'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xa900,0x101));var _0x0a90=function(_0x208d39,_0x5de94f){_0x208d39=_0x208d39-0x0;var _0x3f96cb=_0xa900[_0x208d39];return _0x3f96cb;};'use strict';var emlformat=require(_0x0a90('0x0'));var rimraf=require(_0x0a90('0x1'));var zipdir=require(_0x0a90('0x2'));var jsonpatch=require(_0x0a90('0x3'));var rp=require(_0x0a90('0x4'));var moment=require(_0x0a90('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x0a90('0x6'));var util=require('util');var path=require('path');var sox=require(_0x0a90('0x7'));var csv=require(_0x0a90('0x8'));var ejs=require(_0x0a90('0x9'));var fs=require('fs');var fs_extra=require(_0x0a90('0xa'));var _=require('lodash');var squel=require(_0x0a90('0xb'));var crypto=require(_0x0a90('0xc'));var jsforce=require(_0x0a90('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x0a90('0x8'));var querystring=require(_0x0a90('0xe'));var Papa=require(_0x0a90('0xf'));var Redis=require('ioredis');var authService=require(_0x0a90('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x0a90('0x11'));var hardwareService=require(_0x0a90('0x12'));var logger=require('../../config/logger')(_0x0a90('0x13'));var utils=require(_0x0a90('0x14'));var config=require(_0x0a90('0x15'));var licenseUtil=require(_0x0a90('0x16'));var db=require(_0x0a90('0x17'))['db'];function respondWithStatusCode(_0x37fd09,_0x198fec){_0x198fec=_0x198fec||0xcc;return function(_0x1f82d3){if(_0x1f82d3){return _0x37fd09[_0x0a90('0x18')](_0x198fec);}return _0x37fd09[_0x0a90('0x19')](_0x198fec)[_0x0a90('0x1a')]();};}function respondWithResult(_0x391bd7,_0x1f0dca){_0x1f0dca=_0x1f0dca||0xc8;return function(_0x50dfee){if(_0x50dfee){return _0x391bd7['status'](_0x1f0dca)[_0x0a90('0x1b')](_0x50dfee);}};}function respondWithFilteredResult(_0x91163a,_0x44237d){return function(_0x166806){if(_0x166806){var _0x87365=typeof _0x44237d[_0x0a90('0x1c')]===_0x0a90('0x1d')&&typeof _0x44237d['limit']===_0x0a90('0x1d');var _0x149fe9=_0x166806['count'];var _0x2c0719=_0x87365?0x0:_0x44237d[_0x0a90('0x1c')];var _0x619487=_0x87365?_0x166806[_0x0a90('0x1e')]:_0x44237d[_0x0a90('0x1c')]+_0x44237d[_0x0a90('0x1f')];var _0x4c2916;if(_0x619487>=_0x149fe9){_0x619487=_0x149fe9;_0x4c2916=0xc8;}else{_0x4c2916=0xce;}_0x91163a[_0x0a90('0x19')](_0x4c2916);return _0x91163a[_0x0a90('0x20')](_0x0a90('0x21'),_0x2c0719+'-'+_0x619487+'/'+_0x149fe9)['json'](_0x166806);}return null;};}function patchUpdates(_0x4ba044){return function(_0x7808b0){try{jsonpatch['apply'](_0x7808b0,_0x4ba044,!![]);}catch(_0x2b2ed5){return BPromise['reject'](_0x2b2ed5);}return _0x7808b0[_0x0a90('0x22')]();};}function saveUpdates(_0x30eb4a,_0xf3e76f){return function(_0x35b503){if(_0x35b503){return _0x35b503[_0x0a90('0x23')](_0x30eb4a)[_0x0a90('0x24')](function(_0x454c4c){return _0x454c4c;});}return null;};}function removeEntity(_0x1b2e71,_0x2c3431){return function(_0x228279){if(_0x228279){return _0x228279[_0x0a90('0x25')]()[_0x0a90('0x24')](function(){var _0x413814=_0x228279[_0x0a90('0x26')]({'plain':!![]});var _0x569dc3=_0x0a90('0x27');return db[_0x0a90('0x28')][_0x0a90('0x25')]({'where':{'type':_0x569dc3,'resourceId':_0x413814['id']}})[_0x0a90('0x24')](function(){return _0x228279;});})['then'](function(){_0x1b2e71[_0x0a90('0x19')](0xcc)[_0x0a90('0x1a')]();});}};}function handleEntityNotFound(_0x74f558,_0x328294){return function(_0xe4729b){if(!_0xe4729b){_0x74f558[_0x0a90('0x18')](0x194);}return _0xe4729b;};}function handleError(_0x3c3715,_0x341cdc){_0x341cdc=_0x341cdc||0x1f4;return function(_0x285897){logger[_0x0a90('0x29')](_0x285897['stack']);if(_0x285897[_0x0a90('0x2a')]){delete _0x285897[_0x0a90('0x2a')];}_0x3c3715[_0x0a90('0x19')](_0x341cdc)['send'](_0x285897);};}exports[_0x0a90('0x2b')]=function(_0x5eea8a,_0x41c872){var _0x8d9407={},_0x52a28f={},_0x18beba={'count':0x0,'rows':[]};var _0x4a6880=_[_0x0a90('0x2c')](db['VoiceChanSpy'][_0x0a90('0x2d')],function(_0x152a80){return{'name':_0x152a80[_0x0a90('0x2e')],'type':_0x152a80[_0x0a90('0x2f')][_0x0a90('0x30')]};});_0x52a28f[_0x0a90('0x31')]=_[_0x0a90('0x2c')](_0x4a6880,_0x0a90('0x2a'));_0x52a28f[_0x0a90('0x32')]=_['keys'](_0x5eea8a[_0x0a90('0x32')]);_0x52a28f[_0x0a90('0x33')]=_['intersection'](_0x52a28f['model'],_0x52a28f[_0x0a90('0x32')]);_0x8d9407['attributes']=_['intersection'](_0x52a28f[_0x0a90('0x31')],qs[_0x0a90('0x34')](_0x5eea8a[_0x0a90('0x32')][_0x0a90('0x34')]));_0x8d9407[_0x0a90('0x35')]=_0x8d9407[_0x0a90('0x35')][_0x0a90('0x36')]?_0x8d9407['attributes']:_0x52a28f[_0x0a90('0x31')];if(!_0x5eea8a[_0x0a90('0x32')][_0x0a90('0x37')](_0x0a90('0x38'))){_0x8d9407['limit']=qs['limit'](_0x5eea8a['query']['limit']);_0x8d9407[_0x0a90('0x1c')]=qs[_0x0a90('0x1c')](_0x5eea8a['query'][_0x0a90('0x1c')]);}_0x8d9407[_0x0a90('0x39')]=qs['sort'](_0x5eea8a[_0x0a90('0x32')]['sort']);_0x8d9407[_0x0a90('0x3a')]=qs[_0x0a90('0x33')](_['pick'](_0x5eea8a['query'],_0x52a28f['filters']),_0x4a6880);if(_0x5eea8a[_0x0a90('0x32')][_0x0a90('0x3b')]){_0x8d9407[_0x0a90('0x3a')]=_['merge'](_0x8d9407[_0x0a90('0x3a')],{'$or':_['map'](_0x4a6880,function(_0x3d99e9){if(_0x3d99e9['type']!==_0x0a90('0x3c')){var _0x1c6673={};_0x1c6673[_0x3d99e9[_0x0a90('0x2a')]]={'$like':'%'+_0x5eea8a['query'][_0x0a90('0x3b')]+'%'};return _0x1c6673;}})});}_0x8d9407=_[_0x0a90('0x3d')]({},_0x8d9407,_0x5eea8a['options']);var _0x44ea85={'where':_0x8d9407['where']};return db[_0x0a90('0x3e')][_0x0a90('0x1e')](_0x44ea85)[_0x0a90('0x24')](function(_0x2e77b4){_0x18beba[_0x0a90('0x1e')]=_0x2e77b4;if(_0x5eea8a[_0x0a90('0x32')][_0x0a90('0x3f')]){_0x8d9407[_0x0a90('0x40')]=[{'all':!![]}];}return db['VoiceChanSpy'][_0x0a90('0x41')](_0x8d9407);})['then'](function(_0x123e56){_0x18beba[_0x0a90('0x42')]=_0x123e56;return _0x18beba;})[_0x0a90('0x24')](respondWithFilteredResult(_0x41c872,_0x8d9407))[_0x0a90('0x43')](handleError(_0x41c872,null));};exports[_0x0a90('0x44')]=function(_0x750f2e,_0x1ab11d){var _0x39b9c2={'raw':![],'where':{'id':_0x750f2e[_0x0a90('0x45')]['id']}},_0x30a9a6={};_0x30a9a6[_0x0a90('0x31')]=_['keys'](db[_0x0a90('0x3e')][_0x0a90('0x2d')]);_0x30a9a6[_0x0a90('0x32')]=_[_0x0a90('0x46')](_0x750f2e[_0x0a90('0x32')]);_0x30a9a6[_0x0a90('0x33')]=_[_0x0a90('0x47')](_0x30a9a6[_0x0a90('0x31')],_0x30a9a6[_0x0a90('0x32')]);_0x39b9c2['attributes']=_[_0x0a90('0x47')](_0x30a9a6[_0x0a90('0x31')],qs['fields'](_0x750f2e['query'][_0x0a90('0x34')]));_0x39b9c2[_0x0a90('0x35')]=_0x39b9c2[_0x0a90('0x35')][_0x0a90('0x36')]?_0x39b9c2[_0x0a90('0x35')]:_0x30a9a6[_0x0a90('0x31')];if(_0x750f2e[_0x0a90('0x32')][_0x0a90('0x3f')]){_0x39b9c2[_0x0a90('0x40')]=[{'all':!![]}];}_0x39b9c2=_['merge']({},_0x39b9c2,_0x750f2e[_0x0a90('0x48')]);return db[_0x0a90('0x3e')][_0x0a90('0x49')](_0x39b9c2)[_0x0a90('0x24')](handleEntityNotFound(_0x1ab11d,null))[_0x0a90('0x24')](respondWithResult(_0x1ab11d,null))['catch'](handleError(_0x1ab11d,null));};exports['create']=function(_0x19e0f7,_0x3b3494){return db[_0x0a90('0x3e')][_0x0a90('0x4a')](_0x19e0f7[_0x0a90('0x4b')],{})[_0x0a90('0x24')](function(_0x173a1a){var _0x55968c=_0x19e0f7['user'][_0x0a90('0x26')]({'plain':!![]});if(!_0x55968c)throw new Error(_0x0a90('0x4c'));if(_0x55968c['role']===_0x0a90('0x4d')){var _0x2707be=_0x173a1a['get']({'plain':!![]});var _0x54953e=_0x0a90('0x27');return db[_0x0a90('0x4e')][_0x0a90('0x49')]({'where':{'name':_0x54953e,'userProfileId':_0x55968c[_0x0a90('0x4f')]},'raw':!![]})[_0x0a90('0x24')](function(_0x4fdd2c){if(_0x4fdd2c&&_0x4fdd2c[_0x0a90('0x50')]===0x0){return db[_0x0a90('0x28')][_0x0a90('0x4a')]({'name':_0x2707be[_0x0a90('0x2a')],'resourceId':_0x2707be['id'],'type':_0x4fdd2c['name'],'sectionId':_0x4fdd2c['id']},{})['then'](function(){return _0x173a1a;});}else{return _0x173a1a;}})[_0x0a90('0x43')](function(_0x20d28e){logger[_0x0a90('0x29')](_0x0a90('0x51'),_0x20d28e);throw _0x20d28e;});}return _0x173a1a;})['then'](respondWithResult(_0x3b3494,0xc9))[_0x0a90('0x43')](handleError(_0x3b3494,null));};exports[_0x0a90('0x23')]=function(_0x5619c9,_0x1cdc27){if(_0x5619c9[_0x0a90('0x4b')]['id']){delete _0x5619c9[_0x0a90('0x4b')]['id'];}return db[_0x0a90('0x3e')]['find']({'where':{'id':_0x5619c9[_0x0a90('0x45')]['id']}})[_0x0a90('0x24')](handleEntityNotFound(_0x1cdc27,null))[_0x0a90('0x24')](saveUpdates(_0x5619c9[_0x0a90('0x4b')],null))[_0x0a90('0x24')](respondWithResult(_0x1cdc27,null))[_0x0a90('0x43')](handleError(_0x1cdc27,null));};exports[_0x0a90('0x25')]=function(_0x1e962e,_0x43906b){return db[_0x0a90('0x3e')][_0x0a90('0x49')]({'where':{'id':_0x1e962e['params']['id']}})[_0x0a90('0x24')](handleEntityNotFound(_0x43906b,null))['then'](removeEntity(_0x43906b,null))[_0x0a90('0x43')](handleError(_0x43906b,null));}; \ No newline at end of file +var _0x86fd=['count','includeAll','findAll','rows','length','include','options','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','params','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','sox','to-csv','lodash','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','set','json','save','update','then','destroy','get','ChanSpies','UserProfileResource','error','name','send','map','VoiceChanSpy','rawAttributes','type','key','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','limit','sort','where','pick','VIRTUAL','filter','merge'];(function(_0x4fc922,_0x37f862){var _0x13bb06=function(_0x335634){while(--_0x335634){_0x4fc922['push'](_0x4fc922['shift']());}};_0x13bb06(++_0x37f862);}(_0x86fd,0xa7));var _0xd86f=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x86fd[_0xa464c9];return _0x3d73c4;};'use strict';var emlformat=require(_0xd86f('0x0'));var rimraf=require(_0xd86f('0x1'));var zipdir=require(_0xd86f('0x2'));var jsonpatch=require(_0xd86f('0x3'));var rp=require('request-promise');var moment=require(_0xd86f('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd86f('0x5'));var util=require(_0xd86f('0x6'));var path=require('path');var sox=require(_0xd86f('0x7'));var csv=require(_0xd86f('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd86f('0x9'));var squel=require('squel');var crypto=require(_0xd86f('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xd86f('0xb'));var toCsv=require(_0xd86f('0x8'));var querystring=require(_0xd86f('0xc'));var Papa=require(_0xd86f('0xd'));var Redis=require('ioredis');var authService=require(_0xd86f('0xe'));var qs=require(_0xd86f('0xf'));var as=require(_0xd86f('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xd86f('0x11'));var licenseUtil=require(_0xd86f('0x12'));var db=require(_0xd86f('0x13'))['db'];function respondWithStatusCode(_0x114705,_0x48b519){_0x48b519=_0x48b519||0xcc;return function(_0x568d81){if(_0x568d81){return _0x114705[_0xd86f('0x14')](_0x48b519);}return _0x114705[_0xd86f('0x15')](_0x48b519)[_0xd86f('0x16')]();};}function respondWithResult(_0x2485b5,_0x2d6a4e){_0x2d6a4e=_0x2d6a4e||0xc8;return function(_0x59a22a){if(_0x59a22a){return _0x2485b5['status'](_0x2d6a4e)['json'](_0x59a22a);}};}function respondWithFilteredResult(_0x18cde8,_0xd65895){return function(_0x44c3e8){if(_0x44c3e8){var _0x155d21=typeof _0xd65895[_0xd86f('0x17')]===_0xd86f('0x18')&&typeof _0xd65895['limit']===_0xd86f('0x18');var _0x4a51b8=_0x44c3e8['count'];var _0x4ff13e=_0x155d21?0x0:_0xd65895[_0xd86f('0x17')];var _0x56ae7e=_0x155d21?_0x44c3e8['count']:_0xd65895['offset']+_0xd65895['limit'];var _0x4156d6;if(_0x56ae7e>=_0x4a51b8){_0x56ae7e=_0x4a51b8;_0x4156d6=0xc8;}else{_0x4156d6=0xce;}_0x18cde8[_0xd86f('0x15')](_0x4156d6);return _0x18cde8[_0xd86f('0x19')]('Content-Range',_0x4ff13e+'-'+_0x56ae7e+'/'+_0x4a51b8)[_0xd86f('0x1a')](_0x44c3e8);}return null;};}function patchUpdates(_0x2cdaed){return function(_0x15c195){try{jsonpatch['apply'](_0x15c195,_0x2cdaed,!![]);}catch(_0x179c3f){return BPromise['reject'](_0x179c3f);}return _0x15c195[_0xd86f('0x1b')]();};}function saveUpdates(_0x46dbee,_0x5bc102){return function(_0x4536a7){if(_0x4536a7){return _0x4536a7[_0xd86f('0x1c')](_0x46dbee)[_0xd86f('0x1d')](function(_0x48a8b8){return _0x48a8b8;});}return null;};}function removeEntity(_0x25b4bf,_0x3247a0){return function(_0x171c5c){if(_0x171c5c){return _0x171c5c[_0xd86f('0x1e')]()['then'](function(){var _0x5aacac=_0x171c5c[_0xd86f('0x1f')]({'plain':!![]});var _0x4f1fde=_0xd86f('0x20');return db[_0xd86f('0x21')]['destroy']({'where':{'type':_0x4f1fde,'resourceId':_0x5aacac['id']}})[_0xd86f('0x1d')](function(){return _0x171c5c;});})[_0xd86f('0x1d')](function(){_0x25b4bf[_0xd86f('0x15')](0xcc)[_0xd86f('0x16')]();});}};}function handleEntityNotFound(_0x2da4e8,_0x48348d){return function(_0x136f80){if(!_0x136f80){_0x2da4e8['sendStatus'](0x194);}return _0x136f80;};}function handleError(_0x5eb368,_0x3b00a5){_0x3b00a5=_0x3b00a5||0x1f4;return function(_0x4881b2){logger[_0xd86f('0x22')](_0x4881b2['stack']);if(_0x4881b2['name']){delete _0x4881b2[_0xd86f('0x23')];}_0x5eb368[_0xd86f('0x15')](_0x3b00a5)[_0xd86f('0x24')](_0x4881b2);};}exports['index']=function(_0x2c2eae,_0x309253){var _0x1916c2={},_0x5b5db3={},_0x1cd47e={'count':0x0,'rows':[]};var _0x23b14a=_[_0xd86f('0x25')](db[_0xd86f('0x26')][_0xd86f('0x27')],function(_0x3258bc){return{'name':_0x3258bc['fieldName'],'type':_0x3258bc[_0xd86f('0x28')][_0xd86f('0x29')]};});_0x5b5db3[_0xd86f('0x2a')]=_[_0xd86f('0x25')](_0x23b14a,'name');_0x5b5db3['query']=_[_0xd86f('0x2b')](_0x2c2eae[_0xd86f('0x2c')]);_0x5b5db3[_0xd86f('0x2d')]=_[_0xd86f('0x2e')](_0x5b5db3[_0xd86f('0x2a')],_0x5b5db3[_0xd86f('0x2c')]);_0x1916c2['attributes']=_[_0xd86f('0x2e')](_0x5b5db3[_0xd86f('0x2a')],qs[_0xd86f('0x2f')](_0x2c2eae[_0xd86f('0x2c')][_0xd86f('0x2f')]));_0x1916c2[_0xd86f('0x30')]=_0x1916c2['attributes']['length']?_0x1916c2[_0xd86f('0x30')]:_0x5b5db3[_0xd86f('0x2a')];if(!_0x2c2eae[_0xd86f('0x2c')][_0xd86f('0x31')](_0xd86f('0x32'))){_0x1916c2[_0xd86f('0x33')]=qs[_0xd86f('0x33')](_0x2c2eae[_0xd86f('0x2c')]['limit']);_0x1916c2['offset']=qs[_0xd86f('0x17')](_0x2c2eae['query'][_0xd86f('0x17')]);}_0x1916c2['order']=qs[_0xd86f('0x34')](_0x2c2eae['query'][_0xd86f('0x34')]);_0x1916c2[_0xd86f('0x35')]=qs[_0xd86f('0x2d')](_[_0xd86f('0x36')](_0x2c2eae['query'],_0x5b5db3[_0xd86f('0x2d')]),_0x23b14a);if(_0x2c2eae[_0xd86f('0x2c')]['filter']){_0x1916c2[_0xd86f('0x35')]=_['merge'](_0x1916c2[_0xd86f('0x35')],{'$or':_[_0xd86f('0x25')](_0x23b14a,function(_0x3e5e6e){if(_0x3e5e6e[_0xd86f('0x28')]!==_0xd86f('0x37')){var _0x25f978={};_0x25f978[_0x3e5e6e['name']]={'$like':'%'+_0x2c2eae[_0xd86f('0x2c')][_0xd86f('0x38')]+'%'};return _0x25f978;}})});}_0x1916c2=_[_0xd86f('0x39')]({},_0x1916c2,_0x2c2eae['options']);var _0x38a75b={'where':_0x1916c2[_0xd86f('0x35')]};return db[_0xd86f('0x26')][_0xd86f('0x3a')](_0x38a75b)[_0xd86f('0x1d')](function(_0x3fe088){_0x1cd47e[_0xd86f('0x3a')]=_0x3fe088;if(_0x2c2eae[_0xd86f('0x2c')][_0xd86f('0x3b')]){_0x1916c2['include']=[{'all':!![]}];}return db[_0xd86f('0x26')][_0xd86f('0x3c')](_0x1916c2);})[_0xd86f('0x1d')](function(_0x1c14dc){_0x1cd47e[_0xd86f('0x3d')]=_0x1c14dc;return _0x1cd47e;})[_0xd86f('0x1d')](respondWithFilteredResult(_0x309253,_0x1916c2))['catch'](handleError(_0x309253,null));};exports['show']=function(_0xcabbd3,_0x3e2b3c){var _0x329a8f={'raw':![],'where':{'id':_0xcabbd3['params']['id']}},_0x47baab={};_0x47baab['model']=_[_0xd86f('0x2b')](db['VoiceChanSpy']['rawAttributes']);_0x47baab[_0xd86f('0x2c')]=_[_0xd86f('0x2b')](_0xcabbd3[_0xd86f('0x2c')]);_0x47baab[_0xd86f('0x2d')]=_[_0xd86f('0x2e')](_0x47baab[_0xd86f('0x2a')],_0x47baab[_0xd86f('0x2c')]);_0x329a8f['attributes']=_[_0xd86f('0x2e')](_0x47baab[_0xd86f('0x2a')],qs[_0xd86f('0x2f')](_0xcabbd3[_0xd86f('0x2c')]['fields']));_0x329a8f[_0xd86f('0x30')]=_0x329a8f[_0xd86f('0x30')][_0xd86f('0x3e')]?_0x329a8f['attributes']:_0x47baab[_0xd86f('0x2a')];if(_0xcabbd3[_0xd86f('0x2c')][_0xd86f('0x3b')]){_0x329a8f[_0xd86f('0x3f')]=[{'all':!![]}];}_0x329a8f=_[_0xd86f('0x39')]({},_0x329a8f,_0xcabbd3[_0xd86f('0x40')]);return db[_0xd86f('0x26')]['find'](_0x329a8f)['then'](handleEntityNotFound(_0x3e2b3c,null))[_0xd86f('0x1d')](respondWithResult(_0x3e2b3c,null))[_0xd86f('0x41')](handleError(_0x3e2b3c,null));};exports['create']=function(_0x5dfa20,_0x94a4e8){return db[_0xd86f('0x26')][_0xd86f('0x42')](_0x5dfa20[_0xd86f('0x43')],{})[_0xd86f('0x1d')](function(_0x158a10){var _0x12f156=_0x5dfa20[_0xd86f('0x44')][_0xd86f('0x1f')]({'plain':!![]});if(!_0x12f156)throw new Error(_0xd86f('0x45'));if(_0x12f156[_0xd86f('0x46')]===_0xd86f('0x44')){var _0x291b6a=_0x158a10[_0xd86f('0x1f')]({'plain':!![]});var _0x321a1a=_0xd86f('0x20');return db['UserProfileSection']['find']({'where':{'name':_0x321a1a,'userProfileId':_0x12f156[_0xd86f('0x47')]},'raw':!![]})[_0xd86f('0x1d')](function(_0x4ac708){if(_0x4ac708&&_0x4ac708['autoAssociation']===0x0){return db[_0xd86f('0x21')][_0xd86f('0x42')]({'name':_0x291b6a[_0xd86f('0x23')],'resourceId':_0x291b6a['id'],'type':_0x4ac708[_0xd86f('0x23')],'sectionId':_0x4ac708['id']},{})[_0xd86f('0x1d')](function(){return _0x158a10;});}else{return _0x158a10;}})[_0xd86f('0x41')](function(_0x5dfbbf){logger['error'](_0xd86f('0x48'),_0x5dfbbf);throw _0x5dfbbf;});}return _0x158a10;})['then'](respondWithResult(_0x94a4e8,0xc9))[_0xd86f('0x41')](handleError(_0x94a4e8,null));};exports[_0xd86f('0x1c')]=function(_0x20282a,_0x3e74f0){if(_0x20282a[_0xd86f('0x43')]['id']){delete _0x20282a['body']['id'];}return db['VoiceChanSpy'][_0xd86f('0x49')]({'where':{'id':_0x20282a[_0xd86f('0x4a')]['id']}})['then'](handleEntityNotFound(_0x3e74f0,null))[_0xd86f('0x1d')](saveUpdates(_0x20282a[_0xd86f('0x43')],null))[_0xd86f('0x1d')](respondWithResult(_0x3e74f0,null))[_0xd86f('0x41')](handleError(_0x3e74f0,null));};exports['destroy']=function(_0x3e20aa,_0x33c767){return db[_0xd86f('0x26')][_0xd86f('0x49')]({'where':{'id':_0x3e20aa[_0xd86f('0x4a')]['id']}})['then'](handleEntityNotFound(_0x33c767,null))[_0xd86f('0x1d')](removeEntity(_0x33c767,null))[_0xd86f('0x41')](handleError(_0x33c767,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index b032840..75f040d 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 _0x331d=['password','ChanSpy','SIP/%s,%s','name','options','StopMixMonitor','concat','internal','findAll','agent','then','catch','models','define','VoiceChanSpy','voice_chanspy','length','VoiceExtension','destroy','bulkCreate','lodash','bluebird','./voiceChanSpy.attributes','from-sip','%s%s','push','merge','Set','format','chanspy','record','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','Authenticate'];(function(_0x1dbdb1,_0x4215d7){var _0x59ffe9=function(_0x4abc0b){while(--_0x4abc0b){_0x1dbdb1['push'](_0x1dbdb1['shift']());}};_0x59ffe9(++_0x4215d7);}(_0x331d,0x1b8));var _0xd331=function(_0x5dd481,_0x4bb49e){_0x5dd481=_0x5dd481-0x0;var _0x4e6f86=_0x331d[_0x5dd481];return _0x4e6f86;};'use strict';var _=require(_0xd331('0x0'));var util=require('util');var BPromise=require(_0xd331('0x1'));var attributes=require(_0xd331('0x2'));var getUserApplications=function(_0x29a5fa,_0x257532,_0x327f4f){var _0x4b3d06=0x1;var _0x367c03=[];var _0x247ea2={'context':_0x257532['context']||_0xd331('0x3'),'exten':util['format'](_0xd331('0x4'),_0x29a5fa['prefix'],_0x327f4f),'type':'system','isApp':![],'ChanSpyId':_0x29a5fa['id'],'UserId':_0x257532['id']};_0x367c03[_0xd331('0x5')](_[_0xd331('0x6')]({'app':_0xd331('0x7'),'appdata':util[_0xd331('0x8')]('CDR(type)=%s',_0xd331('0x9')),'priority':_0x4b3d06++},_0x247ea2));if(_0x29a5fa[_0xd331('0xa')]){_0x367c03['push'](_[_0xd331('0x6')]({'app':_0xd331('0xb'),'appdata':util[_0xd331('0x8')](_0xd331('0xc'),_0x29a5fa[_0xd331('0xd')]),'priority':_0x4b3d06++},_0x247ea2));}if(_0x29a5fa['auth']){_0x367c03[_0xd331('0x5')](_['merge']({'app':_0xd331('0xe'),'appdata':_0x29a5fa[_0xd331('0xf')],'priority':_0x4b3d06++},_0x247ea2));}_0x367c03[_0xd331('0x5')](_[_0xd331('0x6')]({'app':_0xd331('0x10'),'appdata':util[_0xd331('0x8')](_0xd331('0x11'),_0x257532[_0xd331('0x12')],_0x29a5fa[_0xd331('0x13')]?_0x29a5fa[_0xd331('0x13')]['join'](''):''),'priority':_0x4b3d06++},_0x247ea2));if(_0x29a5fa[_0xd331('0xa')]){_0x367c03[_0xd331('0x5')](_['merge']({'app':_0xd331('0x14'),'priority':_0x4b3d06++},_0x247ea2));}return _0x367c03;};var getChanSpyApplications=function(_0x167ab4,_0x4e650b){var _0x2b8558=[];for(var _0x5bdc1a=0x0,_0x367b79=0x1;_0x5bdc1a<_0x4e650b['length'];_0x5bdc1a++,_0x367b79=0x1){_0x2b8558=_0x2b8558[_0xd331('0x15')](getUserApplications(_0x167ab4,_0x4e650b[_0x5bdc1a],_0x4e650b[_0x5bdc1a][_0xd331('0x16')]));if(_0x4e650b[_0x5bdc1a][_0xd331('0x16')]!=_0x4e650b[_0x5bdc1a][_0xd331('0x12')]){_0x2b8558=_0x2b8558[_0xd331('0x15')](getUserApplications(_0x167ab4,_0x4e650b[_0x5bdc1a],_0x4e650b[_0x5bdc1a][_0xd331('0x12')]));}}return _0x2b8558;};var getChanSpyPromise=function(_0x2aa40a,_0x520757){return new BPromise(function(_0x397573,_0x3fd2e0){return _0x2aa40a['User'][_0xd331('0x17')]({'attributes':['id','name','internal'],'where':{'role':_0xd331('0x18'),'chanspy':!![]},'raw':!![]})[_0xd331('0x19')](function(_0x15a5b1){if(_0x15a5b1){return _0x397573(getChanSpyApplications(_0x520757,_0x15a5b1));}return _0x397573([]);})[_0xd331('0x1a')](function(_0x2147cc){_0x3fd2e0(_0x2147cc);});});};module['exports']=function(_0x5ee920,_0x270c95){var _0x117e26=_0x5ee920[_0xd331('0x1b')];return _0x5ee920[_0xd331('0x1c')](_0xd331('0x1d'),attributes,{'tableName':_0xd331('0x1e'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x2acbf8,_0x21b793,_0x1d21b3){return getChanSpyPromise(_0x117e26,_0x2acbf8)['then'](function(_0x2155b4){if(_0x2155b4&&_0x2155b4[_0xd331('0x1f')]){return _0x117e26['VoiceExtension']['bulkCreate'](_0x2155b4);}})[_0xd331('0x19')](function(){_0x1d21b3();})[_0xd331('0x1a')](function(_0x566eb0){_0x1d21b3(_0x566eb0);});},'afterUpdate':function(_0x5694b2,_0x3c3348,_0x44612d){return _0x117e26[_0xd331('0x20')][_0xd331('0x21')]({'where':{'ChanSpyId':_0x5694b2['id']}})['then'](function(){return getChanSpyPromise(_0x117e26,_0x5694b2);})['then'](function(_0x2907fc){if(_0x2907fc&&_0x2907fc['length']){return _0x117e26[_0xd331('0x20')][_0xd331('0x22')](_0x2907fc);}})[_0xd331('0x19')](function(){_0x44612d();})[_0xd331('0x1a')](function(_0x5d2a6d){_0x44612d(_0x5d2a6d);});},'afterDestroy':function(_0x48b542,_0xeb0fd0,_0x4758de){return _0x117e26['VoiceExtension'][_0xd331('0x21')]({'where':{'ChanSpyId':_0x48b542['id']}})[_0xd331('0x19')](function(){_0x4758de();})['catch'](function(_0x5445d4){_0x4758de(_0x5445d4);});}}});}; \ No newline at end of file +var _0x8856=['VoiceExtension','bulkCreate','destroy','lodash','util','bluebird','context','from-sip','format','%s%s','prefix','Set','CDR(type)=%s','record','push','merge','MixMonitor','recordingFormat','auth','Authenticate','password','ChanSpy','SIP/%s,%s','name','join','StopMixMonitor','length','concat','internal','User','findAll','agent','catch','exports','define','VoiceChanSpy','voice_chanspy','then'];(function(_0x8b6814,_0x174197){var _0x1d2a99=function(_0x54ed60){while(--_0x54ed60){_0x8b6814['push'](_0x8b6814['shift']());}};_0x1d2a99(++_0x174197);}(_0x8856,0x1a5));var _0x6885=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x8856[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x6885('0x0'));var util=require(_0x6885('0x1'));var BPromise=require(_0x6885('0x2'));var attributes=require('./voiceChanSpy.attributes');var getUserApplications=function(_0x4ccc5d,_0x4e9279,_0x1c635e){var _0x410a77=0x1;var _0x58e489=[];var _0x13ffec={'context':_0x4e9279[_0x6885('0x3')]||_0x6885('0x4'),'exten':util[_0x6885('0x5')](_0x6885('0x6'),_0x4ccc5d[_0x6885('0x7')],_0x1c635e),'type':'system','isApp':![],'ChanSpyId':_0x4ccc5d['id'],'UserId':_0x4e9279['id']};_0x58e489['push'](_['merge']({'app':_0x6885('0x8'),'appdata':util[_0x6885('0x5')](_0x6885('0x9'),'chanspy'),'priority':_0x410a77++},_0x13ffec));if(_0x4ccc5d[_0x6885('0xa')]){_0x58e489[_0x6885('0xb')](_[_0x6885('0xc')]({'app':_0x6885('0xd'),'appdata':util[_0x6885('0x5')]('${UNIQUEID}.%s,a',_0x4ccc5d[_0x6885('0xe')]),'priority':_0x410a77++},_0x13ffec));}if(_0x4ccc5d[_0x6885('0xf')]){_0x58e489[_0x6885('0xb')](_[_0x6885('0xc')]({'app':_0x6885('0x10'),'appdata':_0x4ccc5d[_0x6885('0x11')],'priority':_0x410a77++},_0x13ffec));}_0x58e489[_0x6885('0xb')](_[_0x6885('0xc')]({'app':_0x6885('0x12'),'appdata':util[_0x6885('0x5')](_0x6885('0x13'),_0x4e9279[_0x6885('0x14')],_0x4ccc5d['options']?_0x4ccc5d['options'][_0x6885('0x15')](''):''),'priority':_0x410a77++},_0x13ffec));if(_0x4ccc5d[_0x6885('0xa')]){_0x58e489[_0x6885('0xb')](_['merge']({'app':_0x6885('0x16'),'priority':_0x410a77++},_0x13ffec));}return _0x58e489;};var getChanSpyApplications=function(_0x2eb832,_0x56bde9){var _0x88390=[];for(var _0x5d3b13=0x0,_0x5907fe=0x1;_0x5d3b13<_0x56bde9[_0x6885('0x17')];_0x5d3b13++,_0x5907fe=0x1){_0x88390=_0x88390[_0x6885('0x18')](getUserApplications(_0x2eb832,_0x56bde9[_0x5d3b13],_0x56bde9[_0x5d3b13][_0x6885('0x19')]));if(_0x56bde9[_0x5d3b13][_0x6885('0x19')]!=_0x56bde9[_0x5d3b13][_0x6885('0x14')]){_0x88390=_0x88390[_0x6885('0x18')](getUserApplications(_0x2eb832,_0x56bde9[_0x5d3b13],_0x56bde9[_0x5d3b13][_0x6885('0x14')]));}}return _0x88390;};var getChanSpyPromise=function(_0x4849d1,_0x29f198){return new BPromise(function(_0x4ae96c,_0x17079a){return _0x4849d1[_0x6885('0x1a')][_0x6885('0x1b')]({'attributes':['id',_0x6885('0x14'),_0x6885('0x19')],'where':{'role':_0x6885('0x1c'),'chanspy':!![]},'raw':!![]})['then'](function(_0x192083){if(_0x192083){return _0x4ae96c(getChanSpyApplications(_0x29f198,_0x192083));}return _0x4ae96c([]);})[_0x6885('0x1d')](function(_0x113bcc){_0x17079a(_0x113bcc);});});};module[_0x6885('0x1e')]=function(_0x721493,_0x1eded4){var _0x51b605=_0x721493['models'];return _0x721493[_0x6885('0x1f')](_0x6885('0x20'),attributes,{'tableName':_0x6885('0x21'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x1fba07,_0x580d2,_0x20da35){return getChanSpyPromise(_0x51b605,_0x1fba07)[_0x6885('0x22')](function(_0x7884ec){if(_0x7884ec&&_0x7884ec['length']){return _0x51b605[_0x6885('0x23')][_0x6885('0x24')](_0x7884ec);}})[_0x6885('0x22')](function(){_0x20da35();})[_0x6885('0x1d')](function(_0xb8112a){_0x20da35(_0xb8112a);});},'afterUpdate':function(_0x3ad85a,_0x8a9438,_0xf33218){return _0x51b605[_0x6885('0x23')][_0x6885('0x25')]({'where':{'ChanSpyId':_0x3ad85a['id']}})[_0x6885('0x22')](function(){return getChanSpyPromise(_0x51b605,_0x3ad85a);})[_0x6885('0x22')](function(_0x18d7e1){if(_0x18d7e1&&_0x18d7e1[_0x6885('0x17')]){return _0x51b605['VoiceExtension'][_0x6885('0x24')](_0x18d7e1);}})['then'](function(){_0xf33218();})[_0x6885('0x1d')](function(_0x570870){_0xf33218(_0x570870);});},'afterDestroy':function(_0x183876,_0x5e63e9,_0x9accd3){return _0x51b605[_0x6885('0x23')][_0x6885('0x25')]({'where':{'ChanSpyId':_0x183876['id']}})[_0x6885('0x22')](function(){_0x9accd3();})[_0x6885('0x1d')](function(_0x11eefe){_0x9accd3(_0x11eefe);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index 5391eb1..ba2f975 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 _0x657b=['bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','VoiceChanSpy,\x20%s,\x20%s','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','moment'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x657b,0x131));var _0xb657=function(_0x299c04,_0x4ffaa9){_0x299c04=_0x299c04-0x0;var _0x2a5a13=_0x657b[_0x299c04];return _0x2a5a13;};'use strict';var _=require(_0xb657('0x0'));var util=require(_0xb657('0x1'));var moment=require(_0xb657('0x2'));var BPromise=require(_0xb657('0x3'));var rs=require(_0xb657('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb657('0x5'))['db'];var utils=require(_0xb657('0x6'));var logger=require('../../config/logger')(_0xb657('0x7'));var config=require(_0xb657('0x8'));var jayson=require(_0xb657('0x9'));var client=jayson[_0xb657('0xa')][_0xb657('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5d54f6,_0x471e78,_0x55acdf){return new BPromise(function(_0x326dd7,_0x42a844){return client[_0xb657('0xc')](_0x5d54f6,_0x55acdf)['then'](function(_0x36b334){logger['info'](_0xb657('0xd'),_0x471e78,'request\x20sent');logger[_0xb657('0xe')](_0xb657('0xf'),_0x471e78,_0xb657('0x10'),JSON['stringify'](_0x36b334));if(_0x36b334[_0xb657('0x11')]){if(_0x36b334[_0xb657('0x11')][_0xb657('0x12')]===0x1f4){logger[_0xb657('0x11')]('VoiceChanSpy,\x20%s,\x20%s',_0x471e78,_0x36b334[_0xb657('0x11')][_0xb657('0x13')]);return _0x42a844(_0x36b334['error'][_0xb657('0x13')]);}logger[_0xb657('0x11')](_0xb657('0xd'),_0x471e78,_0x36b334[_0xb657('0x11')]['message']);return _0x326dd7(_0x36b334[_0xb657('0x11')][_0xb657('0x13')]);}else{logger['info']('VoiceChanSpy,\x20%s,\x20%s',_0x471e78,_0xb657('0x10'));_0x326dd7(_0x36b334[_0xb657('0x14')][_0xb657('0x13')]);}})[_0xb657('0x15')](function(_0x17c045){logger[_0xb657('0x11')](_0xb657('0xd'),_0x471e78,_0x17c045);_0x42a844(_0x17c045);});});} \ No newline at end of file +var _0xe205=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash'];(function(_0x3d2d6f,_0x368872){var _0x5c0022=function(_0x408819){while(--_0x408819){_0x3d2d6f['push'](_0x3d2d6f['shift']());}};_0x5c0022(++_0x368872);}(_0xe205,0xa7));var _0x5e20=function(_0x14d85f,_0x1fe9ec){_0x14d85f=_0x14d85f-0x0;var _0x8b6fe0=_0xe205[_0x14d85f];return _0x8b6fe0;};'use strict';var _=require(_0x5e20('0x0'));var util=require(_0x5e20('0x1'));var moment=require(_0x5e20('0x2'));var BPromise=require(_0x5e20('0x3'));var rs=require(_0x5e20('0x4'));var fs=require('fs');var Redis=require(_0x5e20('0x5'));var db=require(_0x5e20('0x6'))['db'];var utils=require(_0x5e20('0x7'));var logger=require(_0x5e20('0x8'))('rpc');var config=require(_0x5e20('0x9'));var jayson=require(_0x5e20('0xa'));var client=jayson[_0x5e20('0xb')][_0x5e20('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5eca5c,_0x4cc88d,_0x3a382f){return new BPromise(function(_0x4c9332,_0x533e18){return client[_0x5e20('0xd')](_0x5eca5c,_0x3a382f)[_0x5e20('0xe')](function(_0x5c1eee){logger[_0x5e20('0xf')](_0x5e20('0x10'),_0x4cc88d,_0x5e20('0x11'));logger[_0x5e20('0x12')]('VoiceChanSpy,\x20%s,\x20%s,\x20%s',_0x4cc88d,_0x5e20('0x11'),JSON[_0x5e20('0x13')](_0x5c1eee));if(_0x5c1eee[_0x5e20('0x14')]){if(_0x5c1eee[_0x5e20('0x14')][_0x5e20('0x15')]===0x1f4){logger[_0x5e20('0x14')]('VoiceChanSpy,\x20%s,\x20%s',_0x4cc88d,_0x5c1eee[_0x5e20('0x14')][_0x5e20('0x16')]);return _0x533e18(_0x5c1eee[_0x5e20('0x14')]['message']);}logger[_0x5e20('0x14')]('VoiceChanSpy,\x20%s,\x20%s',_0x4cc88d,_0x5c1eee[_0x5e20('0x14')]['message']);return _0x4c9332(_0x5c1eee[_0x5e20('0x14')][_0x5e20('0x16')]);}else{logger[_0x5e20('0xf')](_0x5e20('0x10'),_0x4cc88d,_0x5e20('0x11'));_0x4c9332(_0x5c1eee['result'][_0x5e20('0x16')]);}})[_0x5e20('0x17')](function(_0x166ffd){logger[_0x5e20('0x14')](_0x5e20('0x10'),_0x4cc88d,_0x166ffd);_0x533e18(_0x166ffd);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index 6ace6a9..94b1808 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 _0x2533=['get','isAuthenticated','show','post','create','put','/:id','destroy','exports','multer','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceContext.controller'];(function(_0x512eb8,_0x5b7cd5){var _0x280fab=function(_0x379696){while(--_0x379696){_0x512eb8['push'](_0x512eb8['shift']());}};_0x280fab(++_0x5b7cd5);}(_0x2533,0x1b9));var _0x3253=function(_0x1c34e7,_0x33f9a8){_0x1c34e7=_0x1c34e7-0x0;var _0x378cb1=_0x2533[_0x1c34e7];return _0x378cb1;};'use strict';var multer=require(_0x3253('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x3253('0x1'));var express=require('express');var router=express[_0x3253('0x2')]();var fs_extra=require(_0x3253('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x3253('0x4'));var config=require(_0x3253('0x5'));var controller=require(_0x3253('0x6'));router[_0x3253('0x7')]('/',auth[_0x3253('0x8')](),controller['index']);router[_0x3253('0x7')]('/:id',auth[_0x3253('0x8')](),controller[_0x3253('0x9')]);router[_0x3253('0xa')]('/',auth[_0x3253('0x8')](),controller[_0x3253('0xb')]);router[_0x3253('0xc')](_0x3253('0xd'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x3253('0xd'),auth[_0x3253('0x8')](),controller[_0x3253('0xe')]);module[_0x3253('0xf')]=router; \ No newline at end of file +var _0xdf3b=['path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceContext.controller','get','index','/:id','isAuthenticated','show','create','update','delete','destroy','exports','multer','util'];(function(_0x503f49,_0x6d6576){var _0x2f4d63=function(_0x5beaf3){while(--_0x5beaf3){_0x503f49['push'](_0x503f49['shift']());}};_0x2f4d63(++_0x6d6576);}(_0xdf3b,0xfa));var _0xbdf3=function(_0x1f75d4,_0x183581){_0x1f75d4=_0x1f75d4-0x0;var _0x72f2ca=_0xdf3b[_0x1f75d4];return _0x72f2ca;};'use strict';var multer=require(_0xbdf3('0x0'));var util=require(_0xbdf3('0x1'));var path=require(_0xbdf3('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xbdf3('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xbdf3('0x4'));var interaction=require(_0xbdf3('0x5'));var config=require(_0xbdf3('0x6'));var controller=require(_0xbdf3('0x7'));router[_0xbdf3('0x8')]('/',auth['isAuthenticated'](),controller[_0xbdf3('0x9')]);router['get'](_0xbdf3('0xa'),auth[_0xbdf3('0xb')](),controller[_0xbdf3('0xc')]);router['post']('/',auth[_0xbdf3('0xb')](),controller[_0xbdf3('0xd')]);router['put'](_0xbdf3('0xa'),auth['isAuthenticated'](),controller[_0xbdf3('0xe')]);router[_0xbdf3('0xf')](_0xbdf3('0xa'),auth[_0xbdf3('0xb')](),controller[_0xbdf3('0x10')]);module[_0xbdf3('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index b945de0..34ede6c 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 _0x84ee=['BOOLEAN','STRING'];(function(_0x2bb9b3,_0x1d2c25){var _0x601b6=function(_0x4f8d09){while(--_0x4f8d09){_0x2bb9b3['push'](_0x2bb9b3['shift']());}};_0x601b6(++_0x1d2c25);}(_0x84ee,0xc5));var _0xe84e=function(_0x261522,_0x1adc1f){_0x261522=_0x261522-0x0;var _0x98a25a=_0x84ee[_0x261522];return _0x98a25a;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xe84e('0x0')],'unique':'name'},'description':{'type':Sequelize[_0xe84e('0x0')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0xe84e('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x1e32=['name','BOOLEAN','sequelize','exports','STRING'];(function(_0x4f0755,_0x3d0c50){var _0x1b3da8=function(_0x460fb8){while(--_0x460fb8){_0x4f0755['push'](_0x4f0755['shift']());}};_0x1b3da8(++_0x3d0c50);}(_0x1e32,0x1dd));var _0x21e3=function(_0x2aa4c8,_0x1f65b4){_0x2aa4c8=_0x2aa4c8-0x0;var _0x29edb8=_0x1e32[_0x2aa4c8];return _0x29edb8;};'use strict';var Sequelize=require(_0x21e3('0x0'));module[_0x21e3('0x1')]={'name':{'type':Sequelize[_0x21e3('0x2')],'unique':_0x21e3('0x3')},'description':{'type':Sequelize[_0x21e3('0x2')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x21e3('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.controller.js b/server/api/voiceContext/voiceContext.controller.js index 2d6d81a..16dc75e 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 _0x6819=['fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','includeAll','find','create','body','readFileSync','join','root','utf8','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Contexts','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','server/files/templates/context.ejs','render','eml-format','fast-json-patch','request-promise','moment','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','jayson/promise','request','then','info','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','VoiceContext,\x20%s,\x20%s','catch','sendStatus','status','end','json','undefined','limit','count','offset','set','reject','save','update','destroy','get','UserProfileResource','stack','name','send','map','VoiceContext','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes'];(function(_0x92713a,_0x68f8b0){var _0x1893e1=function(_0xe49768){while(--_0xe49768){_0x92713a['push'](_0x92713a['shift']());}};_0x1893e1(++_0x68f8b0);}(_0x6819,0xee));var _0x9681=function(_0x138d08,_0x38d5c6){_0x138d08=_0x138d08-0x0;var _0x4d5435=_0x6819[_0x138d08];return _0x4d5435;};'use strict';var emlformat=require(_0x9681('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x9681('0x1'));var rp=require(_0x9681('0x2'));var moment=require(_0x9681('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x9681('0x4'));var path=require(_0x9681('0x5'));var sox=require(_0x9681('0x6'));var csv=require(_0x9681('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9681('0x8'));var _=require(_0x9681('0x9'));var squel=require(_0x9681('0xa'));var crypto=require(_0x9681('0xb'));var jsforce=require(_0x9681('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x9681('0x7'));var querystring=require(_0x9681('0xd'));var Papa=require(_0x9681('0xe'));var Redis=require(_0x9681('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x9681('0x10'));var hardwareService=require(_0x9681('0x11'));var logger=require('../../config/logger')(_0x9681('0x12'));var utils=require(_0x9681('0x13'));var config=require(_0x9681('0x14'));var licenseUtil=require(_0x9681('0x15'));var db=require('../../mysqldb')['db'];var jayson=require(_0x9681('0x16'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x53f12e,_0x4992c4,_0x153dc6,_0xec06de){return new BPromise(function(_0x41212e,_0x4ced21){var _0x9f9136=_0xec06de||client;return _0x9f9136[_0x9681('0x17')](_0x53f12e,_0x153dc6)[_0x9681('0x18')](function(_0x43e7fd){logger[_0x9681('0x19')]('VoiceContext,\x20%s,\x20%s',_0x4992c4,_0x9681('0x1a'));logger[_0x9681('0x1b')](_0x9681('0x1c'),_0x4992c4,'request\x20sent',JSON[_0x9681('0x1d')](_0x43e7fd));if(_0x43e7fd[_0x9681('0x1e')]){if(_0x43e7fd[_0x9681('0x1e')][_0x9681('0x1f')]===0x1f4){logger[_0x9681('0x1e')]('VoiceContext,\x20%s,\x20%s',_0x4992c4,_0x43e7fd[_0x9681('0x1e')][_0x9681('0x20')]);return _0x4ced21(_0x43e7fd[_0x9681('0x1e')][_0x9681('0x20')]);}logger[_0x9681('0x1e')]('VoiceContext,\x20%s,\x20%s',_0x4992c4,_0x43e7fd[_0x9681('0x1e')]['message']);return _0x41212e(_0x43e7fd['error']['message']);}else{logger[_0x9681('0x19')](_0x9681('0x21'),_0x4992c4,'request\x20sent');_0x41212e(_0x43e7fd['result'][_0x9681('0x20')]);}})[_0x9681('0x22')](function(_0x4f975f){logger[_0x9681('0x1e')](_0x9681('0x21'),_0x4992c4,_0x4f975f);_0x4ced21(_0x4f975f);});});}function respondWithStatusCode(_0x362d5f,_0x354760){_0x354760=_0x354760||0xcc;return function(_0x5b2be1){if(_0x5b2be1){return _0x362d5f[_0x9681('0x23')](_0x354760);}return _0x362d5f[_0x9681('0x24')](_0x354760)[_0x9681('0x25')]();};}function respondWithResult(_0x454871,_0xce24be){_0xce24be=_0xce24be||0xc8;return function(_0x12806f){if(_0x12806f){return _0x454871[_0x9681('0x24')](_0xce24be)[_0x9681('0x26')](_0x12806f);}};}function respondWithFilteredResult(_0xeeff75,_0x5e47dc){return function(_0x504651){if(_0x504651){var _0x16ee69=typeof _0x5e47dc['offset']===_0x9681('0x27')&&typeof _0x5e47dc[_0x9681('0x28')]==='undefined';var _0x52cebc=_0x504651[_0x9681('0x29')];var _0x54664a=_0x16ee69?0x0:_0x5e47dc[_0x9681('0x2a')];var _0x26ecc0=_0x16ee69?_0x504651['count']:_0x5e47dc[_0x9681('0x2a')]+_0x5e47dc[_0x9681('0x28')];var _0x35f689;if(_0x26ecc0>=_0x52cebc){_0x26ecc0=_0x52cebc;_0x35f689=0xc8;}else{_0x35f689=0xce;}_0xeeff75['status'](_0x35f689);return _0xeeff75[_0x9681('0x2b')]('Content-Range',_0x54664a+'-'+_0x26ecc0+'/'+_0x52cebc)['json'](_0x504651);}return null;};}function patchUpdates(_0xd93433){return function(_0x2f7c8e){try{jsonpatch['apply'](_0x2f7c8e,_0xd93433,!![]);}catch(_0x12e837){return BPromise[_0x9681('0x2c')](_0x12e837);}return _0x2f7c8e[_0x9681('0x2d')]();};}function saveUpdates(_0x663bcc,_0x520244){return function(_0x1e4bb9){if(_0x1e4bb9){return _0x1e4bb9[_0x9681('0x2e')](_0x663bcc)[_0x9681('0x18')](function(_0xe823e2){return _0xe823e2;});}return null;};}function removeEntity(_0xb8551,_0x3faa44){return function(_0x3fcc18){if(_0x3fcc18){return _0x3fcc18[_0x9681('0x2f')]()[_0x9681('0x18')](function(){var _0x2baba2=_0x3fcc18[_0x9681('0x30')]({'plain':!![]});var _0x311344='Contexts';return db[_0x9681('0x31')]['destroy']({'where':{'type':_0x311344,'resourceId':_0x2baba2['id']}})[_0x9681('0x18')](function(){return _0x3fcc18;});})[_0x9681('0x18')](function(){_0xb8551[_0x9681('0x24')](0xcc)['end']();});}};}function handleEntityNotFound(_0x25623b,_0x21ef95){return function(_0x2583f3){if(!_0x2583f3){_0x25623b['sendStatus'](0x194);}return _0x2583f3;};}function handleError(_0x3b2b95,_0x23f286){_0x23f286=_0x23f286||0x1f4;return function(_0x2c4262){logger['error'](_0x2c4262[_0x9681('0x32')]);if(_0x2c4262[_0x9681('0x33')]){delete _0x2c4262[_0x9681('0x33')];}_0x3b2b95[_0x9681('0x24')](_0x23f286)[_0x9681('0x34')](_0x2c4262);};}exports['index']=function(_0x564b68,_0x5bad27){var _0xe14ef7={},_0x1f2d90={},_0x916592={'count':0x0,'rows':[]};var _0x271e9a=_[_0x9681('0x35')](db[_0x9681('0x36')][_0x9681('0x37')],function(_0x575ea4){return{'name':_0x575ea4[_0x9681('0x38')],'type':_0x575ea4[_0x9681('0x39')][_0x9681('0x3a')]};});_0x1f2d90['model']=_[_0x9681('0x35')](_0x271e9a,_0x9681('0x33'));_0x1f2d90[_0x9681('0x3b')]=_[_0x9681('0x3c')](_0x564b68[_0x9681('0x3b')]);_0x1f2d90[_0x9681('0x3d')]=_[_0x9681('0x3e')](_0x1f2d90[_0x9681('0x3f')],_0x1f2d90[_0x9681('0x3b')]);_0xe14ef7[_0x9681('0x40')]=_['intersection'](_0x1f2d90['model'],qs[_0x9681('0x41')](_0x564b68[_0x9681('0x3b')][_0x9681('0x41')]));_0xe14ef7[_0x9681('0x40')]=_0xe14ef7[_0x9681('0x40')][_0x9681('0x42')]?_0xe14ef7[_0x9681('0x40')]:_0x1f2d90['model'];if(!_0x564b68['query']['hasOwnProperty'](_0x9681('0x43'))){_0xe14ef7[_0x9681('0x28')]=qs[_0x9681('0x28')](_0x564b68['query']['limit']);_0xe14ef7[_0x9681('0x2a')]=qs[_0x9681('0x2a')](_0x564b68['query'][_0x9681('0x2a')]);}_0xe14ef7[_0x9681('0x44')]=qs[_0x9681('0x45')](_0x564b68[_0x9681('0x3b')][_0x9681('0x45')]);_0xe14ef7[_0x9681('0x46')]=qs['filters'](_[_0x9681('0x47')](_0x564b68[_0x9681('0x3b')],_0x1f2d90[_0x9681('0x3d')]),_0x271e9a);if(_0x564b68[_0x9681('0x3b')][_0x9681('0x48')]){_0xe14ef7[_0x9681('0x46')]=_[_0x9681('0x49')](_0xe14ef7[_0x9681('0x46')],{'$or':_[_0x9681('0x35')](_0x271e9a,function(_0x480c21){if(_0x480c21[_0x9681('0x39')]!==_0x9681('0x4a')){var _0x845348={};_0x845348[_0x480c21['name']]={'$like':'%'+_0x564b68[_0x9681('0x3b')][_0x9681('0x48')]+'%'};return _0x845348;}})});}_0xe14ef7=_[_0x9681('0x49')]({},_0xe14ef7,_0x564b68[_0x9681('0x4b')]);var _0x329ba6={'where':_0xe14ef7[_0x9681('0x46')]};return db[_0x9681('0x36')][_0x9681('0x29')](_0x329ba6)[_0x9681('0x18')](function(_0x25ceaf){_0x916592[_0x9681('0x29')]=_0x25ceaf;if(_0x564b68[_0x9681('0x3b')]['includeAll']){_0xe14ef7[_0x9681('0x4c')]=[{'all':!![]}];}return db[_0x9681('0x36')][_0x9681('0x4d')](_0xe14ef7);})[_0x9681('0x18')](function(_0x384fb2){_0x916592[_0x9681('0x4e')]=_0x384fb2;return _0x916592;})[_0x9681('0x18')](respondWithFilteredResult(_0x5bad27,_0xe14ef7))['catch'](handleError(_0x5bad27,null));};exports['show']=function(_0x1361b3,_0xa7281b){var _0x530a96={'raw':![],'where':{'id':_0x1361b3['params']['id']}},_0x503726={};_0x503726[_0x9681('0x3f')]=_['keys'](db[_0x9681('0x36')]['rawAttributes']);_0x503726['query']=_[_0x9681('0x3c')](_0x1361b3['query']);_0x503726[_0x9681('0x3d')]=_[_0x9681('0x3e')](_0x503726[_0x9681('0x3f')],_0x503726['query']);_0x530a96['attributes']=_[_0x9681('0x3e')](_0x503726[_0x9681('0x3f')],qs[_0x9681('0x41')](_0x1361b3[_0x9681('0x3b')][_0x9681('0x41')]));_0x530a96['attributes']=_0x530a96[_0x9681('0x40')][_0x9681('0x42')]?_0x530a96[_0x9681('0x40')]:_0x503726[_0x9681('0x3f')];if(_0x1361b3['query'][_0x9681('0x4f')]){_0x530a96[_0x9681('0x4c')]=[{'all':!![]}];}_0x530a96=_['merge']({},_0x530a96,_0x1361b3[_0x9681('0x4b')]);return db[_0x9681('0x36')][_0x9681('0x50')](_0x530a96)['then'](handleEntityNotFound(_0xa7281b,null))[_0x9681('0x18')](respondWithResult(_0xa7281b,null))[_0x9681('0x22')](handleError(_0xa7281b,null));};exports[_0x9681('0x51')]=function(_0x541586,_0x29cddb,_0x5ca9cc){var _0x1de493;return db[_0x9681('0x36')][_0x9681('0x51')](_0x541586[_0x9681('0x52')],{'raw':!![]})[_0x9681('0x18')](function(_0x4fca24){_0x1de493=_0x4fca24;return db['VoiceContext'][_0x9681('0x4d')]({'raw':!![]});})['then'](function(_0x408626){var _0x2fca25=fs[_0x9681('0x53')](path[_0x9681('0x54')](config[_0x9681('0x55')],'server/files/templates/context.ejs'),_0x9681('0x56'));var _0x4808c6=ejs['render'](_0x2fca25,{'contexts':_0x408626||[]});fs[_0x9681('0x57')](_0x9681('0x58'),_0x4808c6);})[_0x9681('0x18')](function(){return respondWithRpcPromise(_0x9681('0x59'),_0x9681('0x51'),{'module':_0x9681('0x5a')});})['then'](function(){var _0x527169=_0x541586[_0x9681('0x5b')]['get']({'plain':!![]});if(!_0x527169)throw new Error(_0x9681('0x5c'));if(_0x527169[_0x9681('0x5d')]===_0x9681('0x5b')){var _0x519a88=_0x1de493[_0x9681('0x30')]({'plain':!![]});return db[_0x9681('0x5e')][_0x9681('0x50')]({'where':{'name':_0x9681('0x5f'),'userProfileId':_0x527169['userProfileId']},'raw':!![]})[_0x9681('0x18')](function(_0x17bc78){if(_0x17bc78&&_0x17bc78[_0x9681('0x60')]===0x0){return db[_0x9681('0x31')]['create']({'name':_0x519a88[_0x9681('0x33')],'resourceId':_0x519a88['id'],'type':_0x17bc78[_0x9681('0x33')],'sectionId':_0x17bc78['id']},{})[_0x9681('0x18')](function(){return _0x1de493;});}else{return _0x1de493;}})[_0x9681('0x22')](function(_0x3dd033){logger[_0x9681('0x1e')](_0x9681('0x61'),_0x3dd033);throw _0x3dd033;});}return _0x1de493;})[_0x9681('0x18')](respondWithResult(_0x29cddb,0xc9))[_0x9681('0x22')](handleError(_0x29cddb,null));};exports[_0x9681('0x2e')]=function(_0x346187,_0x31eafd,_0x361fc1){var _0x2b1d05;return db[_0x9681('0x36')][_0x9681('0x50')]({'where':{'id':_0x346187[_0x9681('0x62')]['id']}})[_0x9681('0x18')](handleEntityNotFound(_0x31eafd,null))[_0x9681('0x18')](saveUpdates(_0x346187[_0x9681('0x52')],null))[_0x9681('0x18')](function(_0x741c18){if(_0x741c18){_0x2b1d05=_0x741c18;return db[_0x9681('0x36')][_0x9681('0x4d')]({'raw':!![]});}})[_0x9681('0x18')](function(_0x54f38b){var _0x12b6ec=fs[_0x9681('0x53')](path[_0x9681('0x54')](config[_0x9681('0x55')],_0x9681('0x63')),_0x9681('0x56'));var _0xcef70=ejs[_0x9681('0x64')](_0x12b6ec,{'contexts':_0x54f38b||[]});fs[_0x9681('0x57')](_0x9681('0x58'),_0xcef70);})[_0x9681('0x18')](function(){return respondWithRpcPromise(_0x9681('0x59'),_0x9681('0x2e'),{'module':_0x9681('0x5a')});})['then'](function(){return _0x2b1d05;})[_0x9681('0x18')](respondWithResult(_0x31eafd,null))[_0x9681('0x22')](handleError(_0x31eafd,null));};exports[_0x9681('0x2f')]=function(_0x4595a6,_0xc40a7e,_0x1176c2){var _0x5ae449;return db[_0x9681('0x36')][_0x9681('0x50')]({'where':{'id':_0x4595a6[_0x9681('0x62')]['id']}})[_0x9681('0x18')](handleEntityNotFound(_0xc40a7e,null))['then'](removeEntity(_0xc40a7e,null))[_0x9681('0x18')](function(){return db['VoiceContext'][_0x9681('0x4d')]({'raw':!![]});})[_0x9681('0x18')](function(_0x434852){var _0x17130e=fs['readFileSync'](path[_0x9681('0x54')](config[_0x9681('0x55')],'server/files/templates/context.ejs'),_0x9681('0x56'));var _0x25316c=ejs['render'](_0x17130e,{'contexts':_0x434852});fs[_0x9681('0x57')](_0x9681('0x58'),_0x25316c);return respondWithRpcPromise(_0x9681('0x59'),_0x9681('0x2f'),{'module':_0x9681('0x5a')});})['catch'](handleError(_0xc40a7e,null));}; \ No newline at end of file +var _0x0db0=['hasOwnProperty','nolimit','order','sort','where','filters','filter','options','includeAll','include','findAll','rows','params','rawAttributes','intersection','find','create','body','server/files/templates/context.ejs','utf8','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','join','root','eml-format','rimraf','zip-dir','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','reject','save','update','get','Contexts','UserProfileResource','destroy','stack','name','send','index','VoiceContext','fieldName','type','key','model','map','keys','query','attributes','fields','length'];(function(_0x225ff5,_0x1d80e4){var _0x371dbd=function(_0x23227e){while(--_0x23227e){_0x225ff5['push'](_0x225ff5['shift']());}};_0x371dbd(++_0x1d80e4);}(_0x0db0,0x1ac));var _0x00db=function(_0x45c536,_0x52a556){_0x45c536=_0x45c536-0x0;var _0x10e06d=_0x0db0[_0x45c536];return _0x10e06d;};'use strict';var emlformat=require(_0x00db('0x0'));var rimraf=require(_0x00db('0x1'));var zipdir=require(_0x00db('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x00db('0x3'));var Mustache=require(_0x00db('0x4'));var util=require(_0x00db('0x5'));var path=require(_0x00db('0x6'));var sox=require(_0x00db('0x7'));var csv=require(_0x00db('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x00db('0x9'));var _=require(_0x00db('0xa'));var squel=require(_0x00db('0xb'));var crypto=require(_0x00db('0xc'));var jsforce=require(_0x00db('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x00db('0x8'));var querystring=require(_0x00db('0xe'));var Papa=require(_0x00db('0xf'));var Redis=require('ioredis');var authService=require(_0x00db('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x00db('0x11'));var hardwareService=require(_0x00db('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x00db('0x13'));var licenseUtil=require(_0x00db('0x14'));var db=require(_0x00db('0x15'))['db'];var jayson=require(_0x00db('0x16'));var client=jayson[_0x00db('0x17')][_0x00db('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x42ac8b,_0x4143d9,_0x5aa44e,_0x28b0d1){return new BPromise(function(_0x189ebd,_0x14d6a9){var _0x4f55bb=_0x28b0d1||client;return _0x4f55bb['request'](_0x42ac8b,_0x5aa44e)[_0x00db('0x19')](function(_0x25f17d){logger[_0x00db('0x1a')](_0x00db('0x1b'),_0x4143d9,_0x00db('0x1c'));logger['debug']('VoiceContext,\x20%s,\x20%s,\x20%s',_0x4143d9,_0x00db('0x1c'),JSON[_0x00db('0x1d')](_0x25f17d));if(_0x25f17d['error']){if(_0x25f17d[_0x00db('0x1e')][_0x00db('0x1f')]===0x1f4){logger[_0x00db('0x1e')](_0x00db('0x1b'),_0x4143d9,_0x25f17d[_0x00db('0x1e')]['message']);return _0x14d6a9(_0x25f17d['error']['message']);}logger[_0x00db('0x1e')](_0x00db('0x1b'),_0x4143d9,_0x25f17d[_0x00db('0x1e')]['message']);return _0x189ebd(_0x25f17d['error'][_0x00db('0x20')]);}else{logger[_0x00db('0x1a')](_0x00db('0x1b'),_0x4143d9,'request\x20sent');_0x189ebd(_0x25f17d[_0x00db('0x21')][_0x00db('0x20')]);}})[_0x00db('0x22')](function(_0x4d3c1e){logger[_0x00db('0x1e')](_0x00db('0x1b'),_0x4143d9,_0x4d3c1e);_0x14d6a9(_0x4d3c1e);});});}function respondWithStatusCode(_0x11a6f7,_0x2f0a10){_0x2f0a10=_0x2f0a10||0xcc;return function(_0x353f51){if(_0x353f51){return _0x11a6f7[_0x00db('0x23')](_0x2f0a10);}return _0x11a6f7[_0x00db('0x24')](_0x2f0a10)[_0x00db('0x25')]();};}function respondWithResult(_0xfd2853,_0x344e66){_0x344e66=_0x344e66||0xc8;return function(_0x5f75ae){if(_0x5f75ae){return _0xfd2853[_0x00db('0x24')](_0x344e66)[_0x00db('0x26')](_0x5f75ae);}};}function respondWithFilteredResult(_0x4120b0,_0xcefeb7){return function(_0x54c6a0){if(_0x54c6a0){var _0x1a4591=typeof _0xcefeb7[_0x00db('0x27')]==='undefined'&&typeof _0xcefeb7[_0x00db('0x28')]===_0x00db('0x29');var _0x2aad48=_0x54c6a0['count'];var _0x1ef29=_0x1a4591?0x0:_0xcefeb7['offset'];var _0x292727=_0x1a4591?_0x54c6a0[_0x00db('0x2a')]:_0xcefeb7[_0x00db('0x27')]+_0xcefeb7[_0x00db('0x28')];var _0x45b929;if(_0x292727>=_0x2aad48){_0x292727=_0x2aad48;_0x45b929=0xc8;}else{_0x45b929=0xce;}_0x4120b0[_0x00db('0x24')](_0x45b929);return _0x4120b0[_0x00db('0x2b')]('Content-Range',_0x1ef29+'-'+_0x292727+'/'+_0x2aad48)[_0x00db('0x26')](_0x54c6a0);}return null;};}function patchUpdates(_0x53068a){return function(_0x832b8f){try{jsonpatch[_0x00db('0x2c')](_0x832b8f,_0x53068a,!![]);}catch(_0x2efe55){return BPromise[_0x00db('0x2d')](_0x2efe55);}return _0x832b8f[_0x00db('0x2e')]();};}function saveUpdates(_0x389aa3,_0x475a2f){return function(_0x5a31a4){if(_0x5a31a4){return _0x5a31a4[_0x00db('0x2f')](_0x389aa3)[_0x00db('0x19')](function(_0x59cd22){return _0x59cd22;});}return null;};}function removeEntity(_0x3ab2a6,_0x32d8ac){return function(_0x18a863){if(_0x18a863){return _0x18a863['destroy']()[_0x00db('0x19')](function(){var _0x1c58a5=_0x18a863[_0x00db('0x30')]({'plain':!![]});var _0x1e42e7=_0x00db('0x31');return db[_0x00db('0x32')][_0x00db('0x33')]({'where':{'type':_0x1e42e7,'resourceId':_0x1c58a5['id']}})[_0x00db('0x19')](function(){return _0x18a863;});})[_0x00db('0x19')](function(){_0x3ab2a6[_0x00db('0x24')](0xcc)['end']();});}};}function handleEntityNotFound(_0xdf8e93,_0x341f70){return function(_0x33400a){if(!_0x33400a){_0xdf8e93['sendStatus'](0x194);}return _0x33400a;};}function handleError(_0xf7232c,_0x7efad2){_0x7efad2=_0x7efad2||0x1f4;return function(_0x28ed34){logger[_0x00db('0x1e')](_0x28ed34[_0x00db('0x34')]);if(_0x28ed34[_0x00db('0x35')]){delete _0x28ed34[_0x00db('0x35')];}_0xf7232c['status'](_0x7efad2)[_0x00db('0x36')](_0x28ed34);};}exports[_0x00db('0x37')]=function(_0x4bbcd8,_0x463986){var _0x51f426={},_0x49f817={},_0x18c076={'count':0x0,'rows':[]};var _0x4ffe64=_['map'](db[_0x00db('0x38')]['rawAttributes'],function(_0x25d019){return{'name':_0x25d019[_0x00db('0x39')],'type':_0x25d019[_0x00db('0x3a')][_0x00db('0x3b')]};});_0x49f817[_0x00db('0x3c')]=_[_0x00db('0x3d')](_0x4ffe64,_0x00db('0x35'));_0x49f817['query']=_[_0x00db('0x3e')](_0x4bbcd8[_0x00db('0x3f')]);_0x49f817['filters']=_['intersection'](_0x49f817['model'],_0x49f817['query']);_0x51f426[_0x00db('0x40')]=_['intersection'](_0x49f817[_0x00db('0x3c')],qs[_0x00db('0x41')](_0x4bbcd8['query'][_0x00db('0x41')]));_0x51f426[_0x00db('0x40')]=_0x51f426[_0x00db('0x40')][_0x00db('0x42')]?_0x51f426['attributes']:_0x49f817[_0x00db('0x3c')];if(!_0x4bbcd8[_0x00db('0x3f')][_0x00db('0x43')](_0x00db('0x44'))){_0x51f426['limit']=qs[_0x00db('0x28')](_0x4bbcd8[_0x00db('0x3f')][_0x00db('0x28')]);_0x51f426[_0x00db('0x27')]=qs[_0x00db('0x27')](_0x4bbcd8[_0x00db('0x3f')][_0x00db('0x27')]);}_0x51f426[_0x00db('0x45')]=qs[_0x00db('0x46')](_0x4bbcd8[_0x00db('0x3f')][_0x00db('0x46')]);_0x51f426[_0x00db('0x47')]=qs[_0x00db('0x48')](_['pick'](_0x4bbcd8[_0x00db('0x3f')],_0x49f817[_0x00db('0x48')]),_0x4ffe64);if(_0x4bbcd8[_0x00db('0x3f')][_0x00db('0x49')]){_0x51f426[_0x00db('0x47')]=_['merge'](_0x51f426[_0x00db('0x47')],{'$or':_[_0x00db('0x3d')](_0x4ffe64,function(_0x412c0d){if(_0x412c0d[_0x00db('0x3a')]!=='VIRTUAL'){var _0x789da5={};_0x789da5[_0x412c0d[_0x00db('0x35')]]={'$like':'%'+_0x4bbcd8[_0x00db('0x3f')][_0x00db('0x49')]+'%'};return _0x789da5;}})});}_0x51f426=_['merge']({},_0x51f426,_0x4bbcd8[_0x00db('0x4a')]);var _0x37b3b9={'where':_0x51f426[_0x00db('0x47')]};return db[_0x00db('0x38')]['count'](_0x37b3b9)['then'](function(_0x33f5e7){_0x18c076[_0x00db('0x2a')]=_0x33f5e7;if(_0x4bbcd8[_0x00db('0x3f')][_0x00db('0x4b')]){_0x51f426[_0x00db('0x4c')]=[{'all':!![]}];}return db['VoiceContext'][_0x00db('0x4d')](_0x51f426);})[_0x00db('0x19')](function(_0x4af15d){_0x18c076[_0x00db('0x4e')]=_0x4af15d;return _0x18c076;})[_0x00db('0x19')](respondWithFilteredResult(_0x463986,_0x51f426))[_0x00db('0x22')](handleError(_0x463986,null));};exports['show']=function(_0xd1c0d1,_0x1e6e15){var _0x421253={'raw':![],'where':{'id':_0xd1c0d1[_0x00db('0x4f')]['id']}},_0x576e63={};_0x576e63[_0x00db('0x3c')]=_['keys'](db['VoiceContext'][_0x00db('0x50')]);_0x576e63[_0x00db('0x3f')]=_[_0x00db('0x3e')](_0xd1c0d1[_0x00db('0x3f')]);_0x576e63[_0x00db('0x48')]=_['intersection'](_0x576e63[_0x00db('0x3c')],_0x576e63['query']);_0x421253[_0x00db('0x40')]=_[_0x00db('0x51')](_0x576e63[_0x00db('0x3c')],qs[_0x00db('0x41')](_0xd1c0d1[_0x00db('0x3f')][_0x00db('0x41')]));_0x421253['attributes']=_0x421253[_0x00db('0x40')][_0x00db('0x42')]?_0x421253[_0x00db('0x40')]:_0x576e63[_0x00db('0x3c')];if(_0xd1c0d1['query']['includeAll']){_0x421253[_0x00db('0x4c')]=[{'all':!![]}];}_0x421253=_['merge']({},_0x421253,_0xd1c0d1['options']);return db[_0x00db('0x38')][_0x00db('0x52')](_0x421253)[_0x00db('0x19')](handleEntityNotFound(_0x1e6e15,null))[_0x00db('0x19')](respondWithResult(_0x1e6e15,null))[_0x00db('0x22')](handleError(_0x1e6e15,null));};exports[_0x00db('0x53')]=function(_0xcb3829,_0x54f8ed,_0x5b03a4){var _0x4ca66a;return db[_0x00db('0x38')][_0x00db('0x53')](_0xcb3829[_0x00db('0x54')],{'raw':!![]})[_0x00db('0x19')](function(_0x5d7cde){_0x4ca66a=_0x5d7cde;return db[_0x00db('0x38')][_0x00db('0x4d')]({'raw':!![]});})[_0x00db('0x19')](function(_0x554ff3){var _0x39c3f0=fs['readFileSync'](path['join'](config['root'],_0x00db('0x55')),_0x00db('0x56'));var _0x45974c=ejs[_0x00db('0x57')](_0x39c3f0,{'contexts':_0x554ff3||[]});fs[_0x00db('0x58')](_0x00db('0x59'),_0x45974c);})['then'](function(){return respondWithRpcPromise(_0x00db('0x5a'),_0x00db('0x53'),{'module':_0x00db('0x5b')});})[_0x00db('0x19')](function(){var _0x1e5c0d=_0xcb3829[_0x00db('0x5c')][_0x00db('0x30')]({'plain':!![]});if(!_0x1e5c0d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1e5c0d['role']==='user'){var _0x3e271f=_0x4ca66a[_0x00db('0x30')]({'plain':!![]});return db[_0x00db('0x5d')][_0x00db('0x52')]({'where':{'name':_0x00db('0x31'),'userProfileId':_0x1e5c0d[_0x00db('0x5e')]},'raw':!![]})[_0x00db('0x19')](function(_0x4db510){if(_0x4db510&&_0x4db510['autoAssociation']===0x0){return db[_0x00db('0x32')][_0x00db('0x53')]({'name':_0x3e271f['name'],'resourceId':_0x3e271f['id'],'type':_0x4db510['name'],'sectionId':_0x4db510['id']},{})['then'](function(){return _0x4ca66a;});}else{return _0x4ca66a;}})[_0x00db('0x22')](function(_0x4e2a14){logger['error'](_0x00db('0x5f'),_0x4e2a14);throw _0x4e2a14;});}return _0x4ca66a;})[_0x00db('0x19')](respondWithResult(_0x54f8ed,0xc9))[_0x00db('0x22')](handleError(_0x54f8ed,null));};exports[_0x00db('0x2f')]=function(_0x5030cc,_0xa0ecc6,_0x33b7b3){var _0x56f36c;return db[_0x00db('0x38')][_0x00db('0x52')]({'where':{'id':_0x5030cc[_0x00db('0x4f')]['id']}})[_0x00db('0x19')](handleEntityNotFound(_0xa0ecc6,null))['then'](saveUpdates(_0x5030cc[_0x00db('0x54')],null))[_0x00db('0x19')](function(_0x52cce5){if(_0x52cce5){_0x56f36c=_0x52cce5;return db[_0x00db('0x38')]['findAll']({'raw':!![]});}})[_0x00db('0x19')](function(_0x928469){var _0x53f334=fs[_0x00db('0x60')](path[_0x00db('0x61')](config[_0x00db('0x62')],_0x00db('0x55')),_0x00db('0x56'));var _0x585532=ejs[_0x00db('0x57')](_0x53f334,{'contexts':_0x928469||[]});fs['writeFileSync'](_0x00db('0x59'),_0x585532);})[_0x00db('0x19')](function(){return respondWithRpcPromise(_0x00db('0x5a'),'update',{'module':_0x00db('0x5b')});})[_0x00db('0x19')](function(){return _0x56f36c;})['then'](respondWithResult(_0xa0ecc6,null))['catch'](handleError(_0xa0ecc6,null));};exports[_0x00db('0x33')]=function(_0x3dd2ec,_0x294642,_0x11467a){var _0x56cdc2;return db['VoiceContext']['find']({'where':{'id':_0x3dd2ec['params']['id']}})[_0x00db('0x19')](handleEntityNotFound(_0x294642,null))[_0x00db('0x19')](removeEntity(_0x294642,null))[_0x00db('0x19')](function(){return db[_0x00db('0x38')][_0x00db('0x4d')]({'raw':!![]});})[_0x00db('0x19')](function(_0x208192){var _0x16e915=fs[_0x00db('0x60')](path['join'](config[_0x00db('0x62')],_0x00db('0x55')),'utf8');var _0x5d7506=ejs['render'](_0x16e915,{'contexts':_0x208192});fs[_0x00db('0x58')](_0x00db('0x59'),_0x5d7506);return respondWithRpcPromise(_0x00db('0x5a'),'destroy',{'module':_0x00db('0x5b')});})[_0x00db('0x22')](handleError(_0x294642,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index 57e4ad5..e4ef8bf 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 _0xf1e5=['bluebird','path','rimraf','../../config/environment','./voiceContext.attributes','define','VoiceContext','voice_contexts','lodash','util','api','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf1e5,0x1e8));var _0x5f1e=function(_0x1dc18f,_0x22d667){_0x1dc18f=_0x1dc18f-0x0;var _0x1e0546=_0xf1e5[_0x1dc18f];return _0x1e0546;};'use strict';var _=require(_0x5f1e('0x0'));var util=require(_0x5f1e('0x1'));var logger=require('../../config/logger')(_0x5f1e('0x2'));var moment=require(_0x5f1e('0x3'));var BPromise=require(_0x5f1e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5f1e('0x5'));var rimraf=require(_0x5f1e('0x6'));var config=require(_0x5f1e('0x7'));var attributes=require(_0x5f1e('0x8'));module['exports']=function(_0x1c96a5,_0x2797e7){return _0x1c96a5[_0x5f1e('0x9')](_0x5f1e('0xa'),attributes,{'tableName':_0x5f1e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x83a7=['moment','bluebird','request-promise','../../config/environment','./voiceContext.attributes','exports','define','voice_contexts','lodash','util'];(function(_0x3d1c01,_0x167abd){var _0x28b188=function(_0x123ae6){while(--_0x123ae6){_0x3d1c01['push'](_0x3d1c01['shift']());}};_0x28b188(++_0x167abd);}(_0x83a7,0x1f2));var _0x783a=function(_0x565a70,_0x1677c6){_0x565a70=_0x565a70-0x0;var _0x3c69c7=_0x83a7[_0x565a70];return _0x3c69c7;};'use strict';var _=require(_0x783a('0x0'));var util=require(_0x783a('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x783a('0x2'));var BPromise=require(_0x783a('0x3'));var rp=require(_0x783a('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x783a('0x5'));var attributes=require(_0x783a('0x6'));module[_0x783a('0x7')]=function(_0x4d9468,_0x41eeba){return _0x4d9468[_0x783a('0x8')]('VoiceContext',attributes,{'tableName':_0x783a('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 cd33fb6..5968672 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 _0xae8e=['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','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x540dcb,_0x4eacb6){var _0x49353c=function(_0x449bb1){while(--_0x449bb1){_0x540dcb['push'](_0x540dcb['shift']());}};_0x49353c(++_0x4eacb6);}(_0xae8e,0xc3));var _0xeae8=function(_0x550707,_0x5c7076){_0x550707=_0x550707-0x0;var _0x56f8bd=_0xae8e[_0x550707];return _0x56f8bd;};'use strict';var _=require(_0xeae8('0x0'));var util=require(_0xeae8('0x1'));var moment=require(_0xeae8('0x2'));var BPromise=require(_0xeae8('0x3'));var rs=require(_0xeae8('0x4'));var fs=require('fs');var Redis=require(_0xeae8('0x5'));var db=require(_0xeae8('0x6'))['db'];var utils=require(_0xeae8('0x7'));var logger=require(_0xeae8('0x8'))(_0xeae8('0x9'));var config=require(_0xeae8('0xa'));var jayson=require(_0xeae8('0xb'));var client=jayson[_0xeae8('0xc')][_0xeae8('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x1a573d,_0x4f1e68,_0x164e04){return new BPromise(function(_0xb4a0eb,_0x16e287){return client[_0xeae8('0xe')](_0x1a573d,_0x164e04)[_0xeae8('0xf')](function(_0x25af4f){logger[_0xeae8('0x10')](_0xeae8('0x11'),_0x4f1e68,_0xeae8('0x12'));logger[_0xeae8('0x13')](_0xeae8('0x14'),_0x4f1e68,_0xeae8('0x12'),JSON[_0xeae8('0x15')](_0x25af4f));if(_0x25af4f[_0xeae8('0x16')]){if(_0x25af4f[_0xeae8('0x16')]['code']===0x1f4){logger[_0xeae8('0x16')](_0xeae8('0x11'),_0x4f1e68,_0x25af4f[_0xeae8('0x16')][_0xeae8('0x17')]);return _0x16e287(_0x25af4f[_0xeae8('0x16')][_0xeae8('0x17')]);}logger['error'](_0xeae8('0x11'),_0x4f1e68,_0x25af4f[_0xeae8('0x16')][_0xeae8('0x17')]);return _0xb4a0eb(_0x25af4f[_0xeae8('0x16')][_0xeae8('0x17')]);}else{logger[_0xeae8('0x10')](_0xeae8('0x11'),_0x4f1e68,'request\x20sent');_0xb4a0eb(_0x25af4f[_0xeae8('0x18')][_0xeae8('0x17')]);}})[_0xeae8('0x19')](function(_0x371a89){logger[_0xeae8('0x16')](_0xeae8('0x11'),_0x4f1e68,_0x371a89);_0x16e287(_0x371a89);});});} \ No newline at end of file +var _0x122a=['bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','VoiceContext,\x20%s,\x20%s','request\x20sent','catch','lodash','util','moment'];(function(_0x506a8a,_0x1e7852){var _0x412d24=function(_0x8e5ff3){while(--_0x8e5ff3){_0x506a8a['push'](_0x506a8a['shift']());}};_0x412d24(++_0x1e7852);}(_0x122a,0xba));var _0xa122=function(_0x300a4f,_0x457f39){_0x300a4f=_0x300a4f-0x0;var _0x26f5c5=_0x122a[_0x300a4f];return _0x26f5c5;};'use strict';var _=require(_0xa122('0x0'));var util=require(_0xa122('0x1'));var moment=require(_0xa122('0x2'));var BPromise=require(_0xa122('0x3'));var rs=require(_0xa122('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xa122('0x5'));var logger=require('../../config/logger')(_0xa122('0x6'));var config=require(_0xa122('0x7'));var jayson=require(_0xa122('0x8'));var client=jayson[_0xa122('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x576d57,_0x5157f6,_0x23e139){return new BPromise(function(_0x190f74,_0x4d180f){return client[_0xa122('0xa')](_0x576d57,_0x23e139)[_0xa122('0xb')](function(_0x2046c4){logger[_0xa122('0xc')]('VoiceContext,\x20%s,\x20%s',_0x5157f6,'request\x20sent');logger['debug'](_0xa122('0xd'),_0x5157f6,'request\x20sent',JSON[_0xa122('0xe')](_0x2046c4));if(_0x2046c4[_0xa122('0xf')]){if(_0x2046c4['error'][_0xa122('0x10')]===0x1f4){logger['error']('VoiceContext,\x20%s,\x20%s',_0x5157f6,_0x2046c4[_0xa122('0xf')][_0xa122('0x11')]);return _0x4d180f(_0x2046c4['error'][_0xa122('0x11')]);}logger[_0xa122('0xf')](_0xa122('0x12'),_0x5157f6,_0x2046c4['error'][_0xa122('0x11')]);return _0x190f74(_0x2046c4[_0xa122('0xf')][_0xa122('0x11')]);}else{logger[_0xa122('0xc')](_0xa122('0x12'),_0x5157f6,_0xa122('0x13'));_0x190f74(_0x2046c4['result'][_0xa122('0x11')]);}})[_0xa122('0x14')](function(_0xf1b733){logger[_0xa122('0xf')](_0xa122('0x12'),_0x5157f6,_0xf1b733);_0x4d180f(_0xf1b733);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index 4b4b230..3ad1314 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 _0x05fd=['../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceDialReport.controller','get','isAuthenticated','index','/:id','post','put','update','multer','util','connect-timeout','fs-extra'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x05fd,0x173));var _0xd05f=function(_0x2c2775,_0x195446){_0x2c2775=_0x2c2775-0x0;var _0x3bbad9=_0x05fd[_0x2c2775];return _0x3bbad9;};'use strict';var multer=require(_0xd05f('0x0'));var util=require(_0xd05f('0x1'));var path=require('path');var timeout=require(_0xd05f('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xd05f('0x3'));var auth=require(_0xd05f('0x4'));var interaction=require(_0xd05f('0x5'));var config=require(_0xd05f('0x6'));var controller=require(_0xd05f('0x7'));router[_0xd05f('0x8')]('/',auth[_0xd05f('0x9')](),controller[_0xd05f('0xa')]);router[_0xd05f('0x8')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0xd05f('0x8')](_0xd05f('0xb'),auth[_0xd05f('0x9')](),controller['show']);router[_0xd05f('0xc')]('/',auth[_0xd05f('0x9')](),controller['create']);router[_0xd05f('0xd')]('/:id',auth[_0xd05f('0x9')](),controller[_0xd05f('0xe')]);router['delete'](_0xd05f('0xb'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x5b05=['describe','/:id','show','post','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceDialReport.controller','index','get','/describe','isAuthenticated'];(function(_0x5c1b7a,_0x2a8efc){var _0x4a1dcf=function(_0x6a17dc){while(--_0x6a17dc){_0x5c1b7a['push'](_0x5c1b7a['shift']());}};_0x4a1dcf(++_0x2a8efc);}(_0x5b05,0x190));var _0x55b0=function(_0x45a02c,_0x1f7db6){_0x45a02c=_0x45a02c-0x0;var _0x31e27b=_0x5b05[_0x45a02c];return _0x31e27b;};'use strict';var multer=require('multer');var util=require(_0x55b0('0x0'));var path=require(_0x55b0('0x1'));var timeout=require(_0x55b0('0x2'));var express=require(_0x55b0('0x3'));var router=express[_0x55b0('0x4')]();var fs_extra=require(_0x55b0('0x5'));var auth=require(_0x55b0('0x6'));var interaction=require(_0x55b0('0x7'));var config=require(_0x55b0('0x8'));var controller=require(_0x55b0('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x55b0('0xa')]);router[_0x55b0('0xb')](_0x55b0('0xc'),auth[_0x55b0('0xd')](),controller[_0x55b0('0xe')]);router['get'](_0x55b0('0xf'),auth[_0x55b0('0xd')](),controller[_0x55b0('0x10')]);router[_0x55b0('0x11')]('/',auth['isAuthenticated'](),controller['create']);router[_0x55b0('0x12')](_0x55b0('0xf'),auth[_0x55b0('0xd')](),controller[_0x55b0('0x13')]);router[_0x55b0('0x14')](_0x55b0('0xf'),auth['isAuthenticated'](),controller[_0x55b0('0x15')]);module[_0x55b0('0x16')]=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index 392d60b..00cfe8e 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 _0x9c44=['STRING','INTEGER','DATE','called,connect,complete'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x9c44,0x178));var _0x49c4=function(_0x4fde08,_0x463a36){_0x4fde08=_0x4fde08-0x0;var _0x12e725=_0x9c44[_0x4fde08];return _0x12e725;};'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 +var _0x9a19=['sequelize','exports','STRING','INTEGER','DATE','called,connect,complete'];(function(_0x59ed34,_0x9c6d2c){var _0x48d2d4=function(_0x157137){while(--_0x157137){_0x59ed34['push'](_0x59ed34['shift']());}};_0x48d2d4(++_0x9c6d2c);}(_0x9a19,0x114));var _0x99a1=function(_0x1762b4,_0x33d836){_0x1762b4=_0x1762b4-0x0;var _0x29beda=_0x9a19[_0x1762b4];return _0x29beda;};'use strict';var Sequelize=require(_0x99a1('0x0'));module[_0x99a1('0x1')]={'privilege':{'type':Sequelize[_0x99a1('0x2')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0x99a1('0x3')]},'channelstatedesc':{'type':Sequelize[_0x99a1('0x2')]},'calleridnum':{'type':Sequelize[_0x99a1('0x2')]},'calleridname':{'type':Sequelize[_0x99a1('0x2')]},'connectedlinenum':{'type':Sequelize[_0x99a1('0x2')]},'connectedlinename':{'type':Sequelize[_0x99a1('0x2')]},'language':{'type':Sequelize[_0x99a1('0x2')]},'accountcode':{'type':Sequelize[_0x99a1('0x2')]},'context':{'type':Sequelize[_0x99a1('0x2')]},'exten':{'type':Sequelize[_0x99a1('0x2')]},'priority':{'type':Sequelize[_0x99a1('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x99a1('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x99a1('0x2')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x99a1('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x99a1('0x2')]},'destlanguage':{'type':Sequelize[_0x99a1('0x2')]},'destaccountcode':{'type':Sequelize[_0x99a1('0x2')]},'destcontext':{'type':Sequelize[_0x99a1('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x99a1('0x3')]},'destuniqueid':{'type':Sequelize[_0x99a1('0x2')]},'destlinkedid':{'type':Sequelize[_0x99a1('0x2')]},'dialstring':{'type':Sequelize[_0x99a1('0x2')]},'dialstatus':{'type':Sequelize[_0x99a1('0x2')]},'starttime':{'type':Sequelize[_0x99a1('0x4')]},'answertime':{'type':Sequelize[_0x99a1('0x4')]},'endtime':{'type':Sequelize[_0x99a1('0x4')]},'lastevent':{'type':Sequelize[_0x99a1('0x2')],'comment':_0x99a1('0x5')},'routeId':{'type':Sequelize[_0x99a1('0x3')]},'duration':{'type':Sequelize[_0x99a1('0x3')]},'holdtime':{'type':Sequelize[_0x99a1('0x3')]},'billableseconds':{'type':Sequelize[_0x99a1('0x3')]}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index a55cf36..6892fd3 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 _0xfaf7=['count','then','includeAll','include','findAll','rows','params','keys','find','catch','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','destroy','error','stack','name','send','index','VoiceDialReport','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options'];(function(_0x1d7e20,_0x440010){var _0x922f14=function(_0x18ea27){while(--_0x18ea27){_0x1d7e20['push'](_0x1d7e20['shift']());}};_0x922f14(++_0x440010);}(_0xfaf7,0xf4));var _0x7faf=function(_0x17928f,_0x4ad33f){_0x17928f=_0x17928f-0x0;var _0x500b63=_0xfaf7[_0x17928f];return _0x500b63;};'use strict';var emlformat=require(_0x7faf('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7faf('0x1'));var jsonpatch=require(_0x7faf('0x2'));var rp=require(_0x7faf('0x3'));var moment=require(_0x7faf('0x4'));var BPromise=require(_0x7faf('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x7faf('0x6'));var sox=require('sox');var csv=require(_0x7faf('0x7'));var ejs=require(_0x7faf('0x8'));var fs=require('fs');var fs_extra=require(_0x7faf('0x9'));var _=require(_0x7faf('0xa'));var squel=require(_0x7faf('0xb'));var crypto=require(_0x7faf('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x7faf('0xd'));var toCsv=require(_0x7faf('0x7'));var querystring=require(_0x7faf('0xe'));var Papa=require(_0x7faf('0xf'));var Redis=require('ioredis');var authService=require(_0x7faf('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x7faf('0x11'));var hardwareService=require(_0x7faf('0x12'));var logger=require('../../config/logger')(_0x7faf('0x13'));var utils=require('../../config/utils');var config=require(_0x7faf('0x14'));var licenseUtil=require(_0x7faf('0x15'));var db=require(_0x7faf('0x16'))['db'];function respondWithStatusCode(_0x4292fa,_0x597f55){_0x597f55=_0x597f55||0xcc;return function(_0x54e68c){if(_0x54e68c){return _0x4292fa[_0x7faf('0x17')](_0x597f55);}return _0x4292fa[_0x7faf('0x18')](_0x597f55)[_0x7faf('0x19')]();};}function respondWithResult(_0x1f1319,_0x3cbb0d){_0x3cbb0d=_0x3cbb0d||0xc8;return function(_0x4c3b3c){if(_0x4c3b3c){return _0x1f1319['status'](_0x3cbb0d)[_0x7faf('0x1a')](_0x4c3b3c);}};}function respondWithFilteredResult(_0x1b72d7,_0x39d338){return function(_0x2779f0){if(_0x2779f0){var _0x47e752=typeof _0x39d338[_0x7faf('0x1b')]===_0x7faf('0x1c')&&typeof _0x39d338[_0x7faf('0x1d')]==='undefined';var _0x4af3b4=_0x2779f0['count'];var _0x1cffe7=_0x47e752?0x0:_0x39d338[_0x7faf('0x1b')];var _0x329090=_0x47e752?_0x2779f0['count']:_0x39d338[_0x7faf('0x1b')]+_0x39d338[_0x7faf('0x1d')];var _0x32c8ed;if(_0x329090>=_0x4af3b4){_0x329090=_0x4af3b4;_0x32c8ed=0xc8;}else{_0x32c8ed=0xce;}_0x1b72d7[_0x7faf('0x18')](_0x32c8ed);return _0x1b72d7[_0x7faf('0x1e')](_0x7faf('0x1f'),_0x1cffe7+'-'+_0x329090+'/'+_0x4af3b4)['json'](_0x2779f0);}return null;};}function patchUpdates(_0x3295a8){return function(_0x220941){try{jsonpatch[_0x7faf('0x20')](_0x220941,_0x3295a8,!![]);}catch(_0x21d18b){return BPromise[_0x7faf('0x21')](_0x21d18b);}return _0x220941[_0x7faf('0x22')]();};}function saveUpdates(_0x441b06,_0x4e36a5){return function(_0x11ad69){if(_0x11ad69){return _0x11ad69[_0x7faf('0x23')](_0x441b06)['then'](function(_0x2271f2){return _0x2271f2;});}return null;};}function removeEntity(_0x35dd7b,_0x2f3fc9){return function(_0x9133e9){if(_0x9133e9){return _0x9133e9[_0x7faf('0x24')]()['then'](function(){_0x35dd7b[_0x7faf('0x18')](0xcc)[_0x7faf('0x19')]();});}};}function handleEntityNotFound(_0x4f71d3,_0x2f592b){return function(_0x26a04b){if(!_0x26a04b){_0x4f71d3[_0x7faf('0x17')](0x194);}return _0x26a04b;};}function handleError(_0x2279ec,_0x70a68d){_0x70a68d=_0x70a68d||0x1f4;return function(_0xc7fd78){logger[_0x7faf('0x25')](_0xc7fd78[_0x7faf('0x26')]);if(_0xc7fd78[_0x7faf('0x27')]){delete _0xc7fd78[_0x7faf('0x27')];}_0x2279ec[_0x7faf('0x18')](_0x70a68d)[_0x7faf('0x28')](_0xc7fd78);};}exports[_0x7faf('0x29')]=function(_0x350709,_0x555580){var _0x4a3de2={},_0x2e0caa={},_0xb91912={'count':0x0,'rows':[]};var _0x18477a=_['map'](db[_0x7faf('0x2a')][_0x7faf('0x2b')],function(_0xed81d8){return{'name':_0xed81d8[_0x7faf('0x2c')],'type':_0xed81d8[_0x7faf('0x2d')][_0x7faf('0x2e')]};});_0x2e0caa[_0x7faf('0x2f')]=_[_0x7faf('0x30')](_0x18477a,'name');_0x2e0caa[_0x7faf('0x31')]=_['keys'](_0x350709[_0x7faf('0x31')]);_0x2e0caa[_0x7faf('0x32')]=_[_0x7faf('0x33')](_0x2e0caa['model'],_0x2e0caa[_0x7faf('0x31')]);_0x4a3de2[_0x7faf('0x34')]=_['intersection'](_0x2e0caa[_0x7faf('0x2f')],qs[_0x7faf('0x35')](_0x350709[_0x7faf('0x31')][_0x7faf('0x35')]));_0x4a3de2['attributes']=_0x4a3de2[_0x7faf('0x34')][_0x7faf('0x36')]?_0x4a3de2[_0x7faf('0x34')]:_0x2e0caa[_0x7faf('0x2f')];if(!_0x350709[_0x7faf('0x31')][_0x7faf('0x37')](_0x7faf('0x38'))){_0x4a3de2[_0x7faf('0x1d')]=qs[_0x7faf('0x1d')](_0x350709[_0x7faf('0x31')][_0x7faf('0x1d')]);_0x4a3de2[_0x7faf('0x1b')]=qs[_0x7faf('0x1b')](_0x350709[_0x7faf('0x31')][_0x7faf('0x1b')]);}_0x4a3de2[_0x7faf('0x39')]=qs[_0x7faf('0x3a')](_0x350709[_0x7faf('0x31')][_0x7faf('0x3a')]);_0x4a3de2[_0x7faf('0x3b')]=qs[_0x7faf('0x32')](_['pick'](_0x350709['query'],_0x2e0caa[_0x7faf('0x32')]),_0x18477a);if(_0x350709[_0x7faf('0x31')][_0x7faf('0x3c')]){_0x4a3de2['where']=_[_0x7faf('0x3d')](_0x4a3de2['where'],{'$or':_[_0x7faf('0x30')](_0x18477a,function(_0x2f5432){if(_0x2f5432[_0x7faf('0x2d')]!==_0x7faf('0x3e')){var _0x4a56b0={};_0x4a56b0[_0x2f5432[_0x7faf('0x27')]]={'$like':'%'+_0x350709[_0x7faf('0x31')]['filter']+'%'};return _0x4a56b0;}})});}_0x4a3de2=_[_0x7faf('0x3d')]({},_0x4a3de2,_0x350709[_0x7faf('0x3f')]);var _0x46b205={'where':_0x4a3de2[_0x7faf('0x3b')]};return db[_0x7faf('0x2a')][_0x7faf('0x40')](_0x46b205)[_0x7faf('0x41')](function(_0x25a0bf){_0xb91912[_0x7faf('0x40')]=_0x25a0bf;if(_0x350709[_0x7faf('0x31')][_0x7faf('0x42')]){_0x4a3de2[_0x7faf('0x43')]=[{'all':!![]}];}return db[_0x7faf('0x2a')][_0x7faf('0x44')](_0x4a3de2);})[_0x7faf('0x41')](function(_0x2092ad){_0xb91912[_0x7faf('0x45')]=_0x2092ad;return _0xb91912;})['then'](respondWithFilteredResult(_0x555580,_0x4a3de2))['catch'](handleError(_0x555580,null));};exports['show']=function(_0xce04d3,_0x27c5d9){var _0x317e55={'raw':!![],'where':{'id':_0xce04d3[_0x7faf('0x46')]['id']}},_0x4371be={};_0x4371be[_0x7faf('0x2f')]=_[_0x7faf('0x47')](db[_0x7faf('0x2a')][_0x7faf('0x2b')]);_0x4371be[_0x7faf('0x31')]=_[_0x7faf('0x47')](_0xce04d3[_0x7faf('0x31')]);_0x4371be[_0x7faf('0x32')]=_[_0x7faf('0x33')](_0x4371be[_0x7faf('0x2f')],_0x4371be[_0x7faf('0x31')]);_0x317e55[_0x7faf('0x34')]=_['intersection'](_0x4371be[_0x7faf('0x2f')],qs[_0x7faf('0x35')](_0xce04d3[_0x7faf('0x31')]['fields']));_0x317e55[_0x7faf('0x34')]=_0x317e55[_0x7faf('0x34')][_0x7faf('0x36')]?_0x317e55[_0x7faf('0x34')]:_0x4371be[_0x7faf('0x2f')];if(_0xce04d3[_0x7faf('0x31')][_0x7faf('0x42')]){_0x317e55[_0x7faf('0x43')]=[{'all':!![]}];}_0x317e55=_[_0x7faf('0x3d')]({},_0x317e55,_0xce04d3[_0x7faf('0x3f')]);return db[_0x7faf('0x2a')][_0x7faf('0x48')](_0x317e55)[_0x7faf('0x41')](handleEntityNotFound(_0x27c5d9,null))['then'](respondWithResult(_0x27c5d9,null))[_0x7faf('0x49')](handleError(_0x27c5d9,null));};exports[_0x7faf('0x4a')]=function(_0x35b044,_0x227a3a){return db[_0x7faf('0x2a')][_0x7faf('0x4a')](_0x35b044['body'],{})[_0x7faf('0x41')](respondWithResult(_0x227a3a,0xc9))[_0x7faf('0x49')](handleError(_0x227a3a,null));};exports['update']=function(_0x52ba3a,_0x4c9bb2){if(_0x52ba3a[_0x7faf('0x4b')]['id']){delete _0x52ba3a[_0x7faf('0x4b')]['id'];}return db[_0x7faf('0x2a')]['find']({'where':{'id':_0x52ba3a['params']['id']}})[_0x7faf('0x41')](handleEntityNotFound(_0x4c9bb2,null))['then'](saveUpdates(_0x52ba3a['body'],null))[_0x7faf('0x41')](respondWithResult(_0x4c9bb2,null))[_0x7faf('0x49')](handleError(_0x4c9bb2,null));};exports[_0x7faf('0x24')]=function(_0x546c1b,_0x1a5d47){return db[_0x7faf('0x2a')][_0x7faf('0x48')]({'where':{'id':_0x546c1b[_0x7faf('0x46')]['id']}})[_0x7faf('0x41')](handleEntityNotFound(_0x1a5d47,null))[_0x7faf('0x41')](removeEntity(_0x1a5d47,null))[_0x7faf('0x49')](handleError(_0x1a5d47,null));};exports[_0x7faf('0x4c')]=function(_0x2e1de1,_0x462de8){return db[_0x7faf('0x2a')][_0x7faf('0x4c')]()[_0x7faf('0x41')](respondWithResult(_0x462de8,null))[_0x7faf('0x49')](handleError(_0x462de8,null));}; \ No newline at end of file +var _0x576e=['model','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','name','options','VoiceDialReport','include','findAll','rows','catch','show','params','rawAttributes','includeAll','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','json','save','update','destroy','then','error','stack','index','map','type','query','keys','filters','intersection','attributes'];(function(_0x290599,_0x553cb8){var _0x1b0eec=function(_0x20a06a){while(--_0x20a06a){_0x290599['push'](_0x290599['shift']());}};_0x1b0eec(++_0x553cb8);}(_0x576e,0xb3));var _0xe576=function(_0x100682,_0x11afec){_0x100682=_0x100682-0x0;var _0xcb6e87=_0x576e[_0x100682];return _0xcb6e87;};'use strict';var emlformat=require(_0xe576('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe576('0x1'));var jsonpatch=require(_0xe576('0x2'));var rp=require(_0xe576('0x3'));var moment=require(_0xe576('0x4'));var BPromise=require(_0xe576('0x5'));var Mustache=require(_0xe576('0x6'));var util=require(_0xe576('0x7'));var path=require(_0xe576('0x8'));var sox=require(_0xe576('0x9'));var csv=require(_0xe576('0xa'));var ejs=require(_0xe576('0xb'));var fs=require('fs');var fs_extra=require(_0xe576('0xc'));var _=require(_0xe576('0xd'));var squel=require(_0xe576('0xe'));var crypto=require(_0xe576('0xf'));var jsforce=require(_0xe576('0x10'));var deskjs=require(_0xe576('0x11'));var toCsv=require(_0xe576('0xa'));var querystring=require(_0xe576('0x12'));var Papa=require(_0xe576('0x13'));var Redis=require('ioredis');var authService=require(_0xe576('0x14'));var qs=require(_0xe576('0x15'));var as=require(_0xe576('0x16'));var hardwareService=require(_0xe576('0x17'));var logger=require('../../config/logger')(_0xe576('0x18'));var utils=require(_0xe576('0x19'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xe576('0x1a'))['db'];function respondWithStatusCode(_0x50bc76,_0x41a0af){_0x41a0af=_0x41a0af||0xcc;return function(_0x41d695){if(_0x41d695){return _0x50bc76[_0xe576('0x1b')](_0x41a0af);}return _0x50bc76[_0xe576('0x1c')](_0x41a0af)[_0xe576('0x1d')]();};}function respondWithResult(_0x4bb388,_0x204e59){_0x204e59=_0x204e59||0xc8;return function(_0x1ea786){if(_0x1ea786){return _0x4bb388['status'](_0x204e59)['json'](_0x1ea786);}};}function respondWithFilteredResult(_0x4faa5a,_0x535623){return function(_0x223750){if(_0x223750){var _0x206ed7=typeof _0x535623[_0xe576('0x1e')]===_0xe576('0x1f')&&typeof _0x535623[_0xe576('0x20')]===_0xe576('0x1f');var _0x2cfbe9=_0x223750[_0xe576('0x21')];var _0x51caf6=_0x206ed7?0x0:_0x535623[_0xe576('0x1e')];var _0x252918=_0x206ed7?_0x223750[_0xe576('0x21')]:_0x535623[_0xe576('0x1e')]+_0x535623[_0xe576('0x20')];var _0x385c07;if(_0x252918>=_0x2cfbe9){_0x252918=_0x2cfbe9;_0x385c07=0xc8;}else{_0x385c07=0xce;}_0x4faa5a[_0xe576('0x1c')](_0x385c07);return _0x4faa5a['set']('Content-Range',_0x51caf6+'-'+_0x252918+'/'+_0x2cfbe9)[_0xe576('0x22')](_0x223750);}return null;};}function patchUpdates(_0x2a7da0){return function(_0x2598ef){try{jsonpatch['apply'](_0x2598ef,_0x2a7da0,!![]);}catch(_0x81c822){return BPromise['reject'](_0x81c822);}return _0x2598ef[_0xe576('0x23')]();};}function saveUpdates(_0x244605,_0x2e3b12){return function(_0x51df3a){if(_0x51df3a){return _0x51df3a[_0xe576('0x24')](_0x244605)['then'](function(_0x46bf13){return _0x46bf13;});}return null;};}function removeEntity(_0x2d1124,_0x59ab85){return function(_0x59e7d2){if(_0x59e7d2){return _0x59e7d2[_0xe576('0x25')]()[_0xe576('0x26')](function(){_0x2d1124['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1c666b,_0x58aadf){return function(_0x4d8551){if(!_0x4d8551){_0x1c666b[_0xe576('0x1b')](0x194);}return _0x4d8551;};}function handleError(_0x7c40ef,_0xcc5dd9){_0xcc5dd9=_0xcc5dd9||0x1f4;return function(_0x2c8abc){logger[_0xe576('0x27')](_0x2c8abc[_0xe576('0x28')]);if(_0x2c8abc['name']){delete _0x2c8abc['name'];}_0x7c40ef[_0xe576('0x1c')](_0xcc5dd9)['send'](_0x2c8abc);};}exports[_0xe576('0x29')]=function(_0x57d4d6,_0x3f00f1){var _0x2c01c5={},_0x1b1b8b={},_0x2b76b6={'count':0x0,'rows':[]};var _0x41ff1d=_[_0xe576('0x2a')](db['VoiceDialReport']['rawAttributes'],function(_0x42d6b4){return{'name':_0x42d6b4['fieldName'],'type':_0x42d6b4[_0xe576('0x2b')]['key']};});_0x1b1b8b['model']=_[_0xe576('0x2a')](_0x41ff1d,'name');_0x1b1b8b[_0xe576('0x2c')]=_[_0xe576('0x2d')](_0x57d4d6['query']);_0x1b1b8b[_0xe576('0x2e')]=_[_0xe576('0x2f')](_0x1b1b8b['model'],_0x1b1b8b[_0xe576('0x2c')]);_0x2c01c5[_0xe576('0x30')]=_['intersection'](_0x1b1b8b[_0xe576('0x31')],qs[_0xe576('0x32')](_0x57d4d6['query'][_0xe576('0x32')]));_0x2c01c5['attributes']=_0x2c01c5['attributes'][_0xe576('0x33')]?_0x2c01c5[_0xe576('0x30')]:_0x1b1b8b['model'];if(!_0x57d4d6['query'][_0xe576('0x34')](_0xe576('0x35'))){_0x2c01c5[_0xe576('0x20')]=qs[_0xe576('0x20')](_0x57d4d6['query']['limit']);_0x2c01c5[_0xe576('0x1e')]=qs[_0xe576('0x1e')](_0x57d4d6['query'][_0xe576('0x1e')]);}_0x2c01c5[_0xe576('0x36')]=qs[_0xe576('0x37')](_0x57d4d6[_0xe576('0x2c')]['sort']);_0x2c01c5['where']=qs[_0xe576('0x2e')](_[_0xe576('0x38')](_0x57d4d6[_0xe576('0x2c')],_0x1b1b8b[_0xe576('0x2e')]),_0x41ff1d);if(_0x57d4d6[_0xe576('0x2c')][_0xe576('0x39')]){_0x2c01c5[_0xe576('0x3a')]=_[_0xe576('0x3b')](_0x2c01c5['where'],{'$or':_[_0xe576('0x2a')](_0x41ff1d,function(_0x39a8db){if(_0x39a8db['type']!==_0xe576('0x3c')){var _0x2acab0={};_0x2acab0[_0x39a8db[_0xe576('0x3d')]]={'$like':'%'+_0x57d4d6[_0xe576('0x2c')][_0xe576('0x39')]+'%'};return _0x2acab0;}})});}_0x2c01c5=_[_0xe576('0x3b')]({},_0x2c01c5,_0x57d4d6[_0xe576('0x3e')]);var _0x4babce={'where':_0x2c01c5['where']};return db[_0xe576('0x3f')][_0xe576('0x21')](_0x4babce)[_0xe576('0x26')](function(_0x404ca8){_0x2b76b6[_0xe576('0x21')]=_0x404ca8;if(_0x57d4d6['query']['includeAll']){_0x2c01c5[_0xe576('0x40')]=[{'all':!![]}];}return db['VoiceDialReport'][_0xe576('0x41')](_0x2c01c5);})[_0xe576('0x26')](function(_0x2cdf12){_0x2b76b6[_0xe576('0x42')]=_0x2cdf12;return _0x2b76b6;})[_0xe576('0x26')](respondWithFilteredResult(_0x3f00f1,_0x2c01c5))[_0xe576('0x43')](handleError(_0x3f00f1,null));};exports[_0xe576('0x44')]=function(_0x5bdab8,_0x343bfa){var _0x4dcc8c={'raw':!![],'where':{'id':_0x5bdab8[_0xe576('0x45')]['id']}},_0x17d5e3={};_0x17d5e3[_0xe576('0x31')]=_[_0xe576('0x2d')](db['VoiceDialReport'][_0xe576('0x46')]);_0x17d5e3[_0xe576('0x2c')]=_[_0xe576('0x2d')](_0x5bdab8['query']);_0x17d5e3[_0xe576('0x2e')]=_[_0xe576('0x2f')](_0x17d5e3['model'],_0x17d5e3[_0xe576('0x2c')]);_0x4dcc8c[_0xe576('0x30')]=_[_0xe576('0x2f')](_0x17d5e3['model'],qs[_0xe576('0x32')](_0x5bdab8['query'][_0xe576('0x32')]));_0x4dcc8c[_0xe576('0x30')]=_0x4dcc8c[_0xe576('0x30')][_0xe576('0x33')]?_0x4dcc8c[_0xe576('0x30')]:_0x17d5e3['model'];if(_0x5bdab8[_0xe576('0x2c')][_0xe576('0x47')]){_0x4dcc8c['include']=[{'all':!![]}];}_0x4dcc8c=_[_0xe576('0x3b')]({},_0x4dcc8c,_0x5bdab8[_0xe576('0x3e')]);return db['VoiceDialReport'][_0xe576('0x48')](_0x4dcc8c)[_0xe576('0x26')](handleEntityNotFound(_0x343bfa,null))[_0xe576('0x26')](respondWithResult(_0x343bfa,null))[_0xe576('0x43')](handleError(_0x343bfa,null));};exports[_0xe576('0x49')]=function(_0x3b020f,_0x491081){return db[_0xe576('0x3f')][_0xe576('0x49')](_0x3b020f[_0xe576('0x4a')],{})[_0xe576('0x26')](respondWithResult(_0x491081,0xc9))['catch'](handleError(_0x491081,null));};exports['update']=function(_0x19c578,_0x4dd5ae){if(_0x19c578[_0xe576('0x4a')]['id']){delete _0x19c578[_0xe576('0x4a')]['id'];}return db['VoiceDialReport'][_0xe576('0x48')]({'where':{'id':_0x19c578[_0xe576('0x45')]['id']}})[_0xe576('0x26')](handleEntityNotFound(_0x4dd5ae,null))['then'](saveUpdates(_0x19c578[_0xe576('0x4a')],null))[_0xe576('0x26')](respondWithResult(_0x4dd5ae,null))[_0xe576('0x43')](handleError(_0x4dd5ae,null));};exports['destroy']=function(_0x31ecc2,_0x483990){return db[_0xe576('0x3f')]['find']({'where':{'id':_0x31ecc2[_0xe576('0x45')]['id']}})[_0xe576('0x26')](handleEntityNotFound(_0x483990,null))[_0xe576('0x26')](removeEntity(_0x483990,null))[_0xe576('0x43')](handleError(_0x483990,null));};exports[_0xe576('0x4b')]=function(_0x194c8e,_0x21efe7){return db[_0xe576('0x3f')]['describe']()[_0xe576('0x26')](respondWithResult(_0x21efe7,null))[_0xe576('0x43')](handleError(_0x21efe7,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index 63e4a1c..584c3bb 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 _0x441d=['path','../../config/environment','./voiceDialReport.attributes','exports','define','VoiceDialReport','uniqueid','lodash','util','api','moment','bluebird'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x441d,0x13f));var _0xd441=function(_0x47d199,_0x5a23bf){_0x47d199=_0x47d199-0x0;var _0x5674d1=_0x441d[_0x47d199];return _0x5674d1;};'use strict';var _=require(_0xd441('0x0'));var util=require(_0xd441('0x1'));var logger=require('../../config/logger')(_0xd441('0x2'));var moment=require(_0xd441('0x3'));var BPromise=require(_0xd441('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd441('0x5'));var rimraf=require('rimraf');var config=require(_0xd441('0x6'));var attributes=require(_0xd441('0x7'));module[_0xd441('0x8')]=function(_0x3228d6,_0xfb30a2){return _0x3228d6[_0xd441('0x9')](_0xd441('0xa'),attributes,{'tableName':'report_dial','paranoid':![],'indexes':[{'fields':[_0xd441('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3cb0=['../../config/environment','./voiceDialReport.attributes','exports','VoiceDialReport','uniqueid','util','../../config/logger','moment','bluebird','path','rimraf'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x3cb0,0x123));var _0x03cb=function(_0x25b463,_0x566283){_0x25b463=_0x25b463-0x0;var _0x240fd2=_0x3cb0[_0x25b463];return _0x240fd2;};'use strict';var _=require('lodash');var util=require(_0x03cb('0x0'));var logger=require(_0x03cb('0x1'))('api');var moment=require(_0x03cb('0x2'));var BPromise=require(_0x03cb('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x03cb('0x4'));var rimraf=require(_0x03cb('0x5'));var config=require(_0x03cb('0x6'));var attributes=require(_0x03cb('0x7'));module[_0x03cb('0x8')]=function(_0x5ec2fe,_0x23ad6d){return _0x5ec2fe['define'](_0x03cb('0x9'),attributes,{'tableName':'report_dial','paranoid':![],'indexes':[{'fields':[_0x03cb('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index 3cd9da6..6dcbd0f 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 _0x3782=['catch','CreateVoiceDialReport','VoiceDialReport','create','body','options','raw','UpdateVoiceDialReport','update','where','attributes','limit','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','VoiceDialReport,\x20%s,\x20%s','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result'];(function(_0x367dd1,_0x1fd388){var _0x289209=function(_0x42c8ea){while(--_0x42c8ea){_0x367dd1['push'](_0x367dd1['shift']());}};_0x289209(++_0x1fd388);}(_0x3782,0x1cc));var _0x2378=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x3782[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x2378('0x0'));var BPromise=require(_0x2378('0x1'));var rs=require(_0x2378('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2378('0x3'))['db'];var utils=require(_0x2378('0x4'));var logger=require(_0x2378('0x5'))(_0x2378('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x2378('0x7')][_0x2378('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xbd3941,_0x3e867a,_0x4607a4){return new BPromise(function(_0x298490,_0x42cceb){return client[_0x2378('0x9')](_0xbd3941,_0x4607a4)[_0x2378('0xa')](function(_0x42a018){logger['info'](_0x2378('0xb'),_0x3e867a,'request\x20sent');logger[_0x2378('0xc')](_0x2378('0xd'),_0x3e867a,_0x2378('0xe'),JSON[_0x2378('0xf')](_0x42a018));if(_0x42a018[_0x2378('0x10')]){if(_0x42a018['error']['code']===0x1f4){logger['error'](_0x2378('0xb'),_0x3e867a,_0x42a018[_0x2378('0x10')]['message']);return _0x42cceb(_0x42a018['error'][_0x2378('0x11')]);}logger[_0x2378('0x10')](_0x2378('0xb'),_0x3e867a,_0x42a018[_0x2378('0x10')][_0x2378('0x11')]);return _0x298490(_0x42a018['error'][_0x2378('0x11')]);}else{logger[_0x2378('0x12')](_0x2378('0xb'),_0x3e867a,_0x2378('0xe'));_0x298490(_0x42a018[_0x2378('0x13')]['message']);}})[_0x2378('0x14')](function(_0x20533b){logger[_0x2378('0x10')](_0x2378('0xb'),_0x3e867a,_0x20533b);_0x42cceb(_0x20533b);});});}exports[_0x2378('0x15')]=function(_0x41d4da){var _0x5b1283=this;return new Promise(function(_0x14fa04,_0x288e98){return db[_0x2378('0x16')][_0x2378('0x17')](_0x41d4da[_0x2378('0x18')],{'raw':_0x41d4da['options']?_0x41d4da[_0x2378('0x19')][_0x2378('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x350109){logger[_0x2378('0x12')](_0x2378('0x15'),_0x41d4da);logger['debug'](_0x2378('0x15'),_0x41d4da,JSON['stringify'](_0x350109));_0x14fa04(_0x350109);})[_0x2378('0x14')](function(_0x2b7a9c){logger[_0x2378('0x10')](_0x2378('0x15'),_0x2b7a9c[_0x2378('0x11')],_0x41d4da);_0x288e98(_0x5b1283[_0x2378('0x10')](0x1f4,_0x2b7a9c['message']));});});};exports[_0x2378('0x1b')]=function(_0x4055b3){var _0x1bb5c1=this;return new Promise(function(_0x16e981,_0x2ba0cd){return db['VoiceDialReport'][_0x2378('0x1c')](_0x4055b3[_0x2378('0x18')],{'raw':_0x4055b3[_0x2378('0x19')]?_0x4055b3[_0x2378('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4055b3['options']?_0x4055b3[_0x2378('0x19')][_0x2378('0x1d')]||null:null,'attributes':_0x4055b3['options']?_0x4055b3[_0x2378('0x19')][_0x2378('0x1e')]||null:null,'limit':_0x4055b3[_0x2378('0x19')]?_0x4055b3[_0x2378('0x19')][_0x2378('0x1f')]||null:null})[_0x2378('0xa')](function(_0x2c8a5b){logger[_0x2378('0x12')](_0x2378('0x1b'),_0x4055b3);logger[_0x2378('0xc')](_0x2378('0x1b'),_0x4055b3,JSON[_0x2378('0xf')](_0x2c8a5b));_0x16e981(_0x2c8a5b);})[_0x2378('0x14')](function(_0x5c15c9){logger['error'](_0x2378('0x1b'),_0x5c15c9['message'],_0x4055b3);_0x2ba0cd(_0x1bb5c1[_0x2378('0x10')](0x1f4,_0x5c15c9[_0x2378('0x11')]));});});}; \ No newline at end of file +var _0x61d5=['info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateVoiceDialReport','VoiceDialReport','create','body','options','raw','then','UpdateVoiceDialReport','update','where','limit','lodash','util','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x48a723,_0x2baad8){var _0x5f5b2c=function(_0x5cc79e){while(--_0x5cc79e){_0x48a723['push'](_0x48a723['shift']());}};_0x5f5b2c(++_0x2baad8);}(_0x61d5,0xd6));var _0x561d=function(_0x2ec461,_0x5f588a){_0x2ec461=_0x2ec461-0x0;var _0x28603d=_0x61d5[_0x2ec461];return _0x28603d;};'use strict';var _=require(_0x561d('0x0'));var util=require(_0x561d('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x561d('0x2'));var logger=require(_0x561d('0x3'))(_0x561d('0x4'));var config=require(_0x561d('0x5'));var jayson=require(_0x561d('0x6'));var client=jayson[_0x561d('0x7')][_0x561d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4dfef7,_0x3ef8a4,_0xa9fe7c){return new BPromise(function(_0x192966,_0x98c883){return client[_0x561d('0x9')](_0x4dfef7,_0xa9fe7c)['then'](function(_0x2f4158){logger[_0x561d('0xa')](_0x561d('0xb'),_0x3ef8a4,_0x561d('0xc'));logger[_0x561d('0xd')](_0x561d('0xe'),_0x3ef8a4,'request\x20sent',JSON[_0x561d('0xf')](_0x2f4158));if(_0x2f4158[_0x561d('0x10')]){if(_0x2f4158['error'][_0x561d('0x11')]===0x1f4){logger[_0x561d('0x10')](_0x561d('0xb'),_0x3ef8a4,_0x2f4158[_0x561d('0x10')][_0x561d('0x12')]);return _0x98c883(_0x2f4158['error']['message']);}logger[_0x561d('0x10')](_0x561d('0xb'),_0x3ef8a4,_0x2f4158[_0x561d('0x10')][_0x561d('0x12')]);return _0x192966(_0x2f4158[_0x561d('0x10')][_0x561d('0x12')]);}else{logger[_0x561d('0xa')](_0x561d('0xb'),_0x3ef8a4,_0x561d('0xc'));_0x192966(_0x2f4158[_0x561d('0x13')][_0x561d('0x12')]);}})[_0x561d('0x14')](function(_0x1f7f42){logger[_0x561d('0x10')](_0x561d('0xb'),_0x3ef8a4,_0x1f7f42);_0x98c883(_0x1f7f42);});});}exports[_0x561d('0x15')]=function(_0x543813){var _0x50d5ce=this;return new Promise(function(_0x154ff7,_0x15872a){return db[_0x561d('0x16')][_0x561d('0x17')](_0x543813[_0x561d('0x18')],{'raw':_0x543813[_0x561d('0x19')]?_0x543813[_0x561d('0x19')][_0x561d('0x1a')]===undefined?!![]:![]:!![]})[_0x561d('0x1b')](function(_0x35dcf6){logger[_0x561d('0xa')](_0x561d('0x15'),_0x543813);logger['debug'](_0x561d('0x15'),_0x543813,JSON[_0x561d('0xf')](_0x35dcf6));_0x154ff7(_0x35dcf6);})[_0x561d('0x14')](function(_0x9fca46){logger[_0x561d('0x10')](_0x561d('0x15'),_0x9fca46[_0x561d('0x12')],_0x543813);_0x15872a(_0x50d5ce[_0x561d('0x10')](0x1f4,_0x9fca46[_0x561d('0x12')]));});});};exports[_0x561d('0x1c')]=function(_0x53dcf4){var _0x2dd507=this;return new Promise(function(_0x53ef02,_0x12dec9){return db[_0x561d('0x16')][_0x561d('0x1d')](_0x53dcf4[_0x561d('0x18')],{'raw':_0x53dcf4[_0x561d('0x19')]?_0x53dcf4[_0x561d('0x19')][_0x561d('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x53dcf4[_0x561d('0x19')]?_0x53dcf4[_0x561d('0x19')][_0x561d('0x1e')]||null:null,'attributes':_0x53dcf4[_0x561d('0x19')]?_0x53dcf4[_0x561d('0x19')]['attributes']||null:null,'limit':_0x53dcf4[_0x561d('0x19')]?_0x53dcf4[_0x561d('0x19')][_0x561d('0x1f')]||null:null})['then'](function(_0x32dd6a){logger[_0x561d('0xa')](_0x561d('0x1c'),_0x53dcf4);logger[_0x561d('0xd')](_0x561d('0x1c'),_0x53dcf4,JSON[_0x561d('0xf')](_0x32dd6a));_0x53ef02(_0x32dd6a);})[_0x561d('0x14')](function(_0x567a9e){logger[_0x561d('0x10')](_0x561d('0x1c'),_0x567a9e[_0x561d('0x12')],_0x53dcf4);_0x12dec9(_0x2dd507[_0x561d('0x10')](0x1f4,_0x567a9e[_0x561d('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index d980e5b..e5f560a 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 _0x458e=['../../components/auth/service','../../config/environment','./voiceExtension.controller','get','isAuthenticated','/:id','show','create','/:id/applications','addApplications','put','update','delete','destroy','exports','multer','util','path','express','Router'];(function(_0x43352a,_0x2f42b1){var _0x1b4f47=function(_0x1b9ce2){while(--_0x1b9ce2){_0x43352a['push'](_0x43352a['shift']());}};_0x1b4f47(++_0x2f42b1);}(_0x458e,0x1b3));var _0xe458=function(_0x2bde30,_0x56a3a6){_0x2bde30=_0x2bde30-0x0;var _0x4fcb55=_0x458e[_0x2bde30];return _0x4fcb55;};'use strict';var multer=require(_0xe458('0x0'));var util=require(_0xe458('0x1'));var path=require(_0xe458('0x2'));var timeout=require('connect-timeout');var express=require(_0xe458('0x3'));var router=express[_0xe458('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xe458('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xe458('0x6'));var controller=require(_0xe458('0x7'));router[_0xe458('0x8')]('/',auth[_0xe458('0x9')](),controller['index']);router[_0xe458('0x8')](_0xe458('0xa'),auth[_0xe458('0x9')](),controller[_0xe458('0xb')]);router['post']('/',auth[_0xe458('0x9')](),controller[_0xe458('0xc')]);router['post'](_0xe458('0xd'),auth['isAuthenticated'](),controller[_0xe458('0xe')]);router[_0xe458('0xf')](_0xe458('0xa'),auth[_0xe458('0x9')](),controller[_0xe458('0x10')]);router[_0xe458('0x11')](_0xe458('0xa'),auth[_0xe458('0x9')](),controller[_0xe458('0x12')]);module[_0xe458('0x13')]=router; \ No newline at end of file +var _0x5f95=['get','/:id','isAuthenticated','show','create','post','/:id/applications','addApplications','update','delete','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','index'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x5f95,0x15f));var _0x55f9=function(_0x4be522,_0x2d3d4e){_0x4be522=_0x4be522-0x0;var _0x30b54f=_0x5f95[_0x4be522];return _0x30b54f;};'use strict';var multer=require('multer');var util=require(_0x55f9('0x0'));var path=require(_0x55f9('0x1'));var timeout=require(_0x55f9('0x2'));var express=require(_0x55f9('0x3'));var router=express[_0x55f9('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x55f9('0x5'));var interaction=require(_0x55f9('0x6'));var config=require(_0x55f9('0x7'));var controller=require('./voiceExtension.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x55f9('0x8')]);router[_0x55f9('0x9')](_0x55f9('0xa'),auth[_0x55f9('0xb')](),controller[_0x55f9('0xc')]);router['post']('/',auth[_0x55f9('0xb')](),controller[_0x55f9('0xd')]);router[_0x55f9('0xe')](_0x55f9('0xf'),auth[_0x55f9('0xb')](),controller[_0x55f9('0x10')]);router['put'](_0x55f9('0xa'),auth[_0x55f9('0xb')](),controller[_0x55f9('0x11')]);router[_0x55f9('0x12')](_0x55f9('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x55f9('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index ace314a..06339c4 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 _0xd8b0=['VIRTUAL','getDataValue','exten','sequelize','exports','compositeIndex','STRING','ENUM','inbound','outbound','inbound-fax','outbound-fax','any','*,*,*,*','INTEGER','BOOLEAN','wav'];(function(_0x25d58a,_0x2facde){var _0x4cdd41=function(_0x49a701){while(--_0x49a701){_0x25d58a['push'](_0x25d58a['shift']());}};_0x4cdd41(++_0x2facde);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'context':{'type':Sequelize['STRING'],'allowNull':![],'unique':'compositeIndex','validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x0d8b('0x2')},'priority':{'type':Sequelize[_0x0d8b('0x3')],'allowNull':![],'defaultValue':'1','unique':_0x0d8b('0x2')},'tag':{'type':Sequelize[_0x0d8b('0x3')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x0d8b('0x3')],'allowNull':![],'defaultValue':'NoOp'},'appdata':{'type':Sequelize['STRING'](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0x0d8b('0x4')](_0x0d8b('0x5'),_0x0d8b('0x6'),'internal',_0x0d8b('0x7'),_0x0d8b('0x8'),'system',_0x0d8b('0x9')),'allowNull':![]},'description':{'type':Sequelize[_0x0d8b('0x3')]},'interval':{'type':Sequelize[_0x0d8b('0x3')],'allowNull':![],'defaultValue':_0x0d8b('0xa')},'IntervalId':{'type':Sequelize[_0x0d8b('0xb')]},'isApp':{'type':Sequelize[_0x0d8b('0xc')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x0d8b('0x3')],'defaultValue':null},'callerID':{'type':Sequelize[_0x0d8b('0x3')],'allowNull':!![]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x0d8b('0xb')]},'recordingFormat':{'type':Sequelize['STRING'],'defaultValue':_0x0d8b('0xd')},'answer':{'type':Sequelize[_0x0d8b('0xc')],'defaultValue':!![]},'name':{'type':Sequelize[_0x0d8b('0xe')],'get':function(_0x92cdd8){return this[_0x0d8b('0xf')](_0x0d8b('0x10'));}}}; \ No newline at end of file +var _0xe706=['VIRTUAL','getDataValue','exten','sequelize','exports','STRING','compositeIndex','NoOp','ENUM','inbound','outbound','internal','inbound-fax','outbound-fax','system','any','*,*,*,*','INTEGER','BOOLEAN','wav'];(function(_0x314708,_0x50d72b){var _0x3b552f=function(_0x135e65){while(--_0x135e65){_0x314708['push'](_0x314708['shift']());}};_0x3b552f(++_0x50d72b);}(_0xe706,0xa3));var _0x6e70=function(_0x20834a,_0x471f90){_0x20834a=_0x20834a-0x0;var _0x33da2d=_0xe706[_0x20834a];return _0x33da2d;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'context':{'type':Sequelize[_0x6e70('0x2')],'allowNull':![],'unique':'compositeIndex','validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x6e70('0x2')],'allowNull':![],'unique':_0x6e70('0x3')},'priority':{'type':Sequelize[_0x6e70('0x2')],'allowNull':![],'defaultValue':'1','unique':_0x6e70('0x3')},'tag':{'type':Sequelize[_0x6e70('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x6e70('0x2')],'allowNull':![],'defaultValue':_0x6e70('0x4')},'appdata':{'type':Sequelize[_0x6e70('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0x6e70('0x5')](_0x6e70('0x6'),_0x6e70('0x7'),_0x6e70('0x8'),_0x6e70('0x9'),_0x6e70('0xa'),_0x6e70('0xb'),_0x6e70('0xc')),'allowNull':![]},'description':{'type':Sequelize[_0x6e70('0x2')]},'interval':{'type':Sequelize[_0x6e70('0x2')],'allowNull':![],'defaultValue':_0x6e70('0xd')},'IntervalId':{'type':Sequelize[_0x6e70('0xe')]},'isApp':{'type':Sequelize[_0x6e70('0xf')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x6e70('0x2')],'defaultValue':null},'callerID':{'type':Sequelize[_0x6e70('0x2')],'allowNull':!![]},'record':{'type':Sequelize[_0x6e70('0xf')],'defaultValue':![]},'cutdigits':{'type':Sequelize['INTEGER']},'recordingFormat':{'type':Sequelize['STRING'],'defaultValue':_0x6e70('0x10')},'answer':{'type':Sequelize[_0x6e70('0xf')],'defaultValue':!![]},'name':{'type':Sequelize[_0x6e70('0x11')],'get':function(_0x27dd9b){return this[_0x6e70('0x12')](_0x6e70('0x13'));}}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index 6de2329..8c3aa9d 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 _0x7b83=['value','type','find','sendStatus','error','stack','name','send','index','rawAttributes','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VoiceExtension','includeAll','findAll','catch','show','params','include','create','outbound','startsWith','body','exten','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','description','recordingFormat','cutdigits','mandatoryDisposition','addApplications','findOne','transaction','VoiceExtensionId','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','eml-format','rimraf','zip-dir','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','end','status','json','undefined','limit','offset','count','set','apply','reject','save','update','then','destroy','InboundRoutes','inbound','OutboundRoutes','InternalRoutes','internal','filter','ignore','map'];(function(_0x44cb4a,_0x1fe3c4){var _0x43bee0=function(_0x55d471){while(--_0x55d471){_0x44cb4a['push'](_0x44cb4a['shift']());}};_0x43bee0(++_0x1fe3c4);}(_0x7b83,0xa1));var _0x37b8=function(_0x50bbd9,_0x3f7db2){_0x50bbd9=_0x50bbd9-0x0;var _0x408f6f=_0x7b83[_0x50bbd9];return _0x408f6f;};'use strict';var emlformat=require(_0x37b8('0x0'));var rimraf=require(_0x37b8('0x1'));var zipdir=require(_0x37b8('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x37b8('0x3'));var BPromise=require(_0x37b8('0x4'));var Mustache=require(_0x37b8('0x5'));var util=require('util');var path=require(_0x37b8('0x6'));var sox=require(_0x37b8('0x7'));var csv=require(_0x37b8('0x8'));var ejs=require(_0x37b8('0x9'));var fs=require('fs');var fs_extra=require(_0x37b8('0xa'));var _=require(_0x37b8('0xb'));var squel=require('squel');var crypto=require(_0x37b8('0xc'));var jsforce=require(_0x37b8('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x37b8('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x37b8('0xe'));var as=require(_0x37b8('0xf'));var hardwareService=require(_0x37b8('0x10'));var logger=require(_0x37b8('0x11'))(_0x37b8('0x12'));var utils=require('../../config/utils');var config=require(_0x37b8('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x37b8('0x14'))['db'];config['redis']=_[_0x37b8('0x15')](config[_0x37b8('0x16')],{'host':_0x37b8('0x17'),'port':0x18eb});var socket=require(_0x37b8('0x18'))(new Redis(config[_0x37b8('0x16')]));require('./voiceExtension.socket')['register'](socket);function respondWithStatusCode(_0x316229,_0x35fe29){_0x35fe29=_0x35fe29||0xcc;return function(_0x915af8){if(_0x915af8){return _0x316229['sendStatus'](_0x35fe29);}return _0x316229['status'](_0x35fe29)[_0x37b8('0x19')]();};}function respondWithResult(_0x29b875,_0xd017bd){_0xd017bd=_0xd017bd||0xc8;return function(_0x1fd6e6){if(_0x1fd6e6){return _0x29b875[_0x37b8('0x1a')](_0xd017bd)[_0x37b8('0x1b')](_0x1fd6e6);}};}function respondWithFilteredResult(_0x286cf3,_0x4935db){return function(_0x5c2cf8){if(_0x5c2cf8){var _0x4b0540=typeof _0x4935db['offset']===_0x37b8('0x1c')&&typeof _0x4935db[_0x37b8('0x1d')]===_0x37b8('0x1c');var _0x371b1f=_0x5c2cf8['count'];var _0x449b92=_0x4b0540?0x0:_0x4935db[_0x37b8('0x1e')];var _0x273de4=_0x4b0540?_0x5c2cf8[_0x37b8('0x1f')]:_0x4935db['offset']+_0x4935db[_0x37b8('0x1d')];var _0x1a09e6;if(_0x273de4>=_0x371b1f){_0x273de4=_0x371b1f;_0x1a09e6=0xc8;}else{_0x1a09e6=0xce;}_0x286cf3[_0x37b8('0x1a')](_0x1a09e6);return _0x286cf3[_0x37b8('0x20')]('Content-Range',_0x449b92+'-'+_0x273de4+'/'+_0x371b1f)[_0x37b8('0x1b')](_0x5c2cf8);}return null;};}function patchUpdates(_0x15edb1){return function(_0x272957){try{jsonpatch[_0x37b8('0x21')](_0x272957,_0x15edb1,!![]);}catch(_0x2c9307){return BPromise[_0x37b8('0x22')](_0x2c9307);}return _0x272957[_0x37b8('0x23')]();};}function saveUpdates(_0x4a1044,_0x8c6dd7){return function(_0x203bd3){if(_0x203bd3){return _0x203bd3[_0x37b8('0x24')](_0x4a1044)[_0x37b8('0x25')](function(_0x3e07f6){return _0x3e07f6;});}return null;};}function removeEntity(_0x5803d7,_0x56018e){return function(_0x18baef){if(_0x18baef){return _0x18baef[_0x37b8('0x26')]()['then'](function(){var _0xc25fb3=_0x18baef['get']({'plain':!![]});var _0x14d814=[{'name':_0x37b8('0x27'),'value':_0x37b8('0x28'),'ignore':![]},{'name':_0x37b8('0x29'),'value':'outbound','ignore':![]},{'name':_0x37b8('0x2a'),'value':_0x37b8('0x2b'),'ignore':![]}];var _0x1d1e77=_(_0x14d814)[_0x37b8('0x2c')](_0x37b8('0x2d'))[_0x37b8('0x2e')](_0x37b8('0x2f'))[_0x37b8('0x2f')]();if(_['includes'](_0x1d1e77,_0xc25fb3[_0x37b8('0x30')])){return;}var _0x555c47=_[_0x37b8('0x31')](_0x14d814,[_0x37b8('0x2f'),_0xc25fb3[_0x37b8('0x30')]])['name'];return db['UserProfileResource']['destroy']({'where':{'type':_0x555c47,'resourceId':_0xc25fb3['id']}})['then'](function(){return _0x18baef;});})['then'](function(){_0x5803d7[_0x37b8('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x73ff36,_0x4895c6){return function(_0x1bad1d){if(!_0x1bad1d){_0x73ff36[_0x37b8('0x32')](0x194);}return _0x1bad1d;};}function handleError(_0x50912b,_0x379aa1){_0x379aa1=_0x379aa1||0x1f4;return function(_0x5ac244){logger[_0x37b8('0x33')](_0x5ac244[_0x37b8('0x34')]);if(_0x5ac244['name']){delete _0x5ac244[_0x37b8('0x35')];}_0x50912b[_0x37b8('0x1a')](_0x379aa1)[_0x37b8('0x36')](_0x5ac244);};}exports[_0x37b8('0x37')]=function(_0x48b949,_0x2ddf0d){var _0x13903e={},_0x47c32e={},_0x5a57fb={'count':0x0,'rows':[]};var _0xfa4b18=_['map'](db['VoiceExtension'][_0x37b8('0x38')],function(_0x3ca903){return{'name':_0x3ca903['fieldName'],'type':_0x3ca903[_0x37b8('0x30')]['key']};});_0x47c32e[_0x37b8('0x39')]=_['map'](_0xfa4b18,'name');_0x47c32e['query']=_[_0x37b8('0x3a')](_0x48b949[_0x37b8('0x3b')]);_0x47c32e[_0x37b8('0x3c')]=_[_0x37b8('0x3d')](_0x47c32e[_0x37b8('0x39')],_0x47c32e[_0x37b8('0x3b')]);_0x13903e[_0x37b8('0x3e')]=_[_0x37b8('0x3d')](_0x47c32e[_0x37b8('0x39')],qs['fields'](_0x48b949['query'][_0x37b8('0x3f')]));_0x13903e['attributes']=_0x13903e['attributes'][_0x37b8('0x40')]?_0x13903e['attributes']:_0x47c32e[_0x37b8('0x39')];if(!_0x48b949[_0x37b8('0x3b')][_0x37b8('0x41')](_0x37b8('0x42'))){_0x13903e[_0x37b8('0x1d')]=qs['limit'](_0x48b949[_0x37b8('0x3b')]['limit']);_0x13903e[_0x37b8('0x1e')]=qs['offset'](_0x48b949[_0x37b8('0x3b')][_0x37b8('0x1e')]);}_0x13903e[_0x37b8('0x43')]=qs[_0x37b8('0x44')](_0x48b949['query'][_0x37b8('0x44')]);_0x13903e[_0x37b8('0x45')]=qs[_0x37b8('0x3c')](_[_0x37b8('0x46')](_0x48b949[_0x37b8('0x3b')],_0x47c32e[_0x37b8('0x3c')]),_0xfa4b18);if(_0x48b949['query'][_0x37b8('0x2c')]){_0x13903e['where']=_[_0x37b8('0x47')](_0x13903e['where'],{'$or':_['map'](_0xfa4b18,function(_0x18ace9){if(_0x18ace9['type']!=='VIRTUAL'){var _0x3faa07={};_0x3faa07[_0x18ace9[_0x37b8('0x35')]]={'$like':'%'+_0x48b949[_0x37b8('0x3b')][_0x37b8('0x2c')]+'%'};return _0x3faa07;}})});}_0x13903e=_[_0x37b8('0x47')]({},_0x13903e,_0x48b949['options']);var _0x4e3366={'where':_0x13903e[_0x37b8('0x45')]};return db[_0x37b8('0x48')][_0x37b8('0x1f')](_0x4e3366)[_0x37b8('0x25')](function(_0x2650b0){_0x5a57fb[_0x37b8('0x1f')]=_0x2650b0;if(_0x48b949[_0x37b8('0x3b')][_0x37b8('0x49')]){_0x13903e['include']=[{'all':!![]}];}return db[_0x37b8('0x48')][_0x37b8('0x4a')](_0x13903e);})[_0x37b8('0x25')](function(_0x2df1e6){_0x5a57fb['rows']=_0x2df1e6;return _0x5a57fb;})[_0x37b8('0x25')](respondWithFilteredResult(_0x2ddf0d,_0x13903e))[_0x37b8('0x4b')](handleError(_0x2ddf0d,null));};exports[_0x37b8('0x4c')]=function(_0x39595d,_0x312a58){var _0x4bed98={'raw':![],'where':{'id':_0x39595d[_0x37b8('0x4d')]['id']}},_0x2a1f1b={};_0x2a1f1b[_0x37b8('0x39')]=_['keys'](db['VoiceExtension']['rawAttributes']);_0x2a1f1b['query']=_['keys'](_0x39595d['query']);_0x2a1f1b[_0x37b8('0x3c')]=_['intersection'](_0x2a1f1b['model'],_0x2a1f1b['query']);_0x4bed98['attributes']=_[_0x37b8('0x3d')](_0x2a1f1b[_0x37b8('0x39')],qs[_0x37b8('0x3f')](_0x39595d['query'][_0x37b8('0x3f')]));_0x4bed98[_0x37b8('0x3e')]=_0x4bed98['attributes']['length']?_0x4bed98[_0x37b8('0x3e')]:_0x2a1f1b[_0x37b8('0x39')];if(_0x39595d[_0x37b8('0x3b')]['includeAll']){_0x4bed98[_0x37b8('0x4e')]=[{'all':!![]}];}_0x4bed98=_['merge']({},_0x4bed98,_0x39595d['options']);return db['VoiceExtension']['find'](_0x4bed98)[_0x37b8('0x25')](handleEntityNotFound(_0x312a58,null))['then'](respondWithResult(_0x312a58,null))[_0x37b8('0x4b')](handleError(_0x312a58,null));};exports['destroy']=function(_0x16edec,_0x42de65){return db['VoiceExtension'][_0x37b8('0x31')]({'where':{'id':_0x16edec[_0x37b8('0x4d')]['id']}})[_0x37b8('0x25')](handleEntityNotFound(_0x42de65,null))['then'](removeEntity(_0x42de65,null))[_0x37b8('0x4b')](handleError(_0x42de65,null));};exports[_0x37b8('0x4f')]=function(_0x537c10,_0x5ed898){if(_0x537c10['body'][_0x37b8('0x30')]===_0x37b8('0x50')&&!_[_0x37b8('0x51')](_0x537c10[_0x37b8('0x52')]['exten'],'_')){_0x537c10[_0x37b8('0x52')][_0x37b8('0x53')]='_'['concat'](_0x537c10[_0x37b8('0x52')][_0x37b8('0x53')]);}return db['VoiceExtension']['create'](_0x537c10[_0x37b8('0x52')],{'raw':![]})[_0x37b8('0x25')](function(_0x559559){var _0x2ebc3b=_0x537c10[_0x37b8('0x54')]['get']({'plain':!![]});if(!_0x2ebc3b)throw new Error(_0x37b8('0x55'));if(_0x2ebc3b['role']===_0x37b8('0x54')){var _0x296659=_0x559559[_0x37b8('0x56')]({'plain':!![]});var _0x54c559=[{'name':_0x37b8('0x27'),'value':_0x37b8('0x28')},{'name':_0x37b8('0x29'),'value':'outbound'},{'name':_0x37b8('0x2a'),'value':_0x37b8('0x2b')}];var _0x2dfc9b=_['find'](_0x54c559,['value',_0x296659[_0x37b8('0x30')]])[_0x37b8('0x35')];return db[_0x37b8('0x57')][_0x37b8('0x31')]({'where':{'name':_0x2dfc9b,'userProfileId':_0x2ebc3b[_0x37b8('0x58')]},'raw':!![]})[_0x37b8('0x25')](function(_0x424e58){if(_0x424e58&&_0x424e58[_0x37b8('0x59')]===0x0){return db[_0x37b8('0x5a')][_0x37b8('0x4f')]({'name':_0x296659[_0x37b8('0x35')],'resourceId':_0x296659['id'],'type':_0x424e58[_0x37b8('0x35')],'sectionId':_0x424e58['id']},{})['then'](function(){return _0x559559;});}else{return _0x559559;}})[_0x37b8('0x4b')](function(_0x36c09b){logger[_0x37b8('0x33')](_0x37b8('0x5b'),_0x36c09b);throw _0x36c09b;});}return _0x559559;})[_0x37b8('0x25')](respondWithResult(_0x5ed898,0xc9))['catch'](handleError(_0x5ed898,null));};exports[_0x37b8('0x24')]=function(_0x55fa91,_0x396b67){if(_0x55fa91[_0x37b8('0x52')]['id']){delete _0x55fa91['body']['id'];}return db[_0x37b8('0x48')]['find']({'where':{'id':_0x55fa91[_0x37b8('0x4d')]['id']}})[_0x37b8('0x25')](handleEntityNotFound(_0x396b67,null))['then'](function(_0x5a5711){if(_0x5a5711){return db[_0x37b8('0x48')][_0x37b8('0x24')](_[_0x37b8('0x46')](_0x55fa91['body'],[_0x37b8('0x53'),_0x37b8('0x5c'),_0x37b8('0x5d'),_0x37b8('0x5e'),_0x37b8('0x5f'),_0x37b8('0x60')]),{'where':{'context':_0x5a5711[_0x37b8('0x5c')],'exten':_0x5a5711[_0x37b8('0x53')]},'individualHooks':!![]})[_0x37b8('0x25')](function(_0x58487b){return _0x58487b;});}return null;})['then'](respondWithStatusCode(_0x396b67,null))['catch'](handleError(_0x396b67,null));};exports[_0x37b8('0x61')]=function(_0x37950,_0x491ef4,_0x3a8068){return db[_0x37b8('0x48')][_0x37b8('0x62')]({'where':{'id':_0x37950['params']['id']}})[_0x37b8('0x25')](handleEntityNotFound(_0x491ef4,null))['then'](function(_0x550234){if(_0x550234){return db['sequelize'][_0x37b8('0x63')](function(_0x37b6dc){return db[_0x37b8('0x48')][_0x37b8('0x26')]({'where':{'VoiceExtensionId':_0x37950[_0x37b8('0x4d')]['id']},'transaction':_0x37b6dc})['then'](function(_0x180d87){var _0x22483b=_['map'](_0x37950[_0x37b8('0x52')],function(_0x41e9ca){_0x41e9ca[_0x37b8('0x64')]=_0x37950['params']['id'];return _0x41e9ca;});return db[_0x37b8('0x48')][_0x37b8('0x65')](_0x22483b,{'transaction':_0x37b6dc});});})[_0x37b8('0x25')](function(){return db['VoiceExtension'][_0x37b8('0x66')]({'where':{'isApp':!![],'VoiceExtensionId':_0x37950['params']['id']},'order':_0x37b8('0x67')});});}})[_0x37b8('0x25')](respondWithResult(_0x491ef4,null))[_0x37b8('0x4b')](handleError(_0x491ef4,null));}; \ No newline at end of file +var _0xfe60=['InternalRoutes','internal','filter','ignore','map','value','includes','type','find','name','UserProfileResource','send','index','fieldName','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','VoiceExtension','findAll','catch','rawAttributes','include','options','params','create','body','startsWith','exten','concat','role','inbound','UserProfileSection','userProfileId','autoAssociation','description','recordingFormat','context','addApplications','findOne','VoiceExtensionId','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','get','InboundRoutes','OutboundRoutes','outbound'];(function(_0xba1760,_0x191969){var _0x1f3143=function(_0x5aa807){while(--_0x5aa807){_0xba1760['push'](_0xba1760['shift']());}};_0x1f3143(++_0x191969);}(_0xfe60,0x1cb));var _0x0fe6=function(_0xc4a89a,_0x322f6a){_0xc4a89a=_0xc4a89a-0x0;var _0x13f7bc=_0xfe60[_0xc4a89a];return _0x13f7bc;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0fe6('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0fe6('0x1'));var rp=require(_0x0fe6('0x2'));var moment=require(_0x0fe6('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0fe6('0x4'));var util=require(_0x0fe6('0x5'));var path=require(_0x0fe6('0x6'));var sox=require(_0x0fe6('0x7'));var csv=require(_0x0fe6('0x8'));var ejs=require(_0x0fe6('0x9'));var fs=require('fs');var fs_extra=require(_0x0fe6('0xa'));var _=require(_0x0fe6('0xb'));var squel=require(_0x0fe6('0xc'));var crypto=require(_0x0fe6('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x0fe6('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x0fe6('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x0fe6('0x10'));var as=require(_0x0fe6('0x11'));var hardwareService=require(_0x0fe6('0x12'));var logger=require(_0x0fe6('0x13'))(_0x0fe6('0x14'));var utils=require(_0x0fe6('0x15'));var config=require(_0x0fe6('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x0fe6('0x17'))['db'];config[_0x0fe6('0x18')]=_[_0x0fe6('0x19')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x0fe6('0x1a'))(new Redis(config['redis']));require('./voiceExtension.socket')['register'](socket);function respondWithStatusCode(_0x225253,_0x7f3271){_0x7f3271=_0x7f3271||0xcc;return function(_0x46029f){if(_0x46029f){return _0x225253[_0x0fe6('0x1b')](_0x7f3271);}return _0x225253[_0x0fe6('0x1c')](_0x7f3271)[_0x0fe6('0x1d')]();};}function respondWithResult(_0x44011a,_0x14286b){_0x14286b=_0x14286b||0xc8;return function(_0x2f9cd5){if(_0x2f9cd5){return _0x44011a[_0x0fe6('0x1c')](_0x14286b)[_0x0fe6('0x1e')](_0x2f9cd5);}};}function respondWithFilteredResult(_0x347ebb,_0x4a90c5){return function(_0x469a48){if(_0x469a48){var _0xe6bb13=typeof _0x4a90c5[_0x0fe6('0x1f')]===_0x0fe6('0x20')&&typeof _0x4a90c5[_0x0fe6('0x21')]===_0x0fe6('0x20');var _0xf351d5=_0x469a48[_0x0fe6('0x22')];var _0x96187d=_0xe6bb13?0x0:_0x4a90c5[_0x0fe6('0x1f')];var _0x1599bf=_0xe6bb13?_0x469a48[_0x0fe6('0x22')]:_0x4a90c5['offset']+_0x4a90c5[_0x0fe6('0x21')];var _0x270fc2;if(_0x1599bf>=_0xf351d5){_0x1599bf=_0xf351d5;_0x270fc2=0xc8;}else{_0x270fc2=0xce;}_0x347ebb[_0x0fe6('0x1c')](_0x270fc2);return _0x347ebb[_0x0fe6('0x23')]('Content-Range',_0x96187d+'-'+_0x1599bf+'/'+_0xf351d5)[_0x0fe6('0x1e')](_0x469a48);}return null;};}function patchUpdates(_0x35a5da){return function(_0x4c9569){try{jsonpatch[_0x0fe6('0x24')](_0x4c9569,_0x35a5da,!![]);}catch(_0x57198d){return BPromise[_0x0fe6('0x25')](_0x57198d);}return _0x4c9569[_0x0fe6('0x26')]();};}function saveUpdates(_0x447086,_0x4690a7){return function(_0x4c4fe3){if(_0x4c4fe3){return _0x4c4fe3[_0x0fe6('0x27')](_0x447086)[_0x0fe6('0x28')](function(_0x7f855d){return _0x7f855d;});}return null;};}function removeEntity(_0x19370b,_0x18431d){return function(_0x490ca4){if(_0x490ca4){return _0x490ca4[_0x0fe6('0x29')]()[_0x0fe6('0x28')](function(){var _0x3428a7=_0x490ca4[_0x0fe6('0x2a')]({'plain':!![]});var _0xfbd414=[{'name':_0x0fe6('0x2b'),'value':'inbound','ignore':![]},{'name':_0x0fe6('0x2c'),'value':_0x0fe6('0x2d'),'ignore':![]},{'name':_0x0fe6('0x2e'),'value':_0x0fe6('0x2f'),'ignore':![]}];var _0x2ede48=_(_0xfbd414)[_0x0fe6('0x30')](_0x0fe6('0x31'))[_0x0fe6('0x32')](_0x0fe6('0x33'))['value']();if(_[_0x0fe6('0x34')](_0x2ede48,_0x3428a7[_0x0fe6('0x35')])){return;}var _0x5e0839=_[_0x0fe6('0x36')](_0xfbd414,[_0x0fe6('0x33'),_0x3428a7[_0x0fe6('0x35')]])[_0x0fe6('0x37')];return db[_0x0fe6('0x38')][_0x0fe6('0x29')]({'where':{'type':_0x5e0839,'resourceId':_0x3428a7['id']}})[_0x0fe6('0x28')](function(){return _0x490ca4;});})[_0x0fe6('0x28')](function(){_0x19370b[_0x0fe6('0x1c')](0xcc)[_0x0fe6('0x1d')]();});}};}function handleEntityNotFound(_0x187b8a,_0x4707b7){return function(_0x3ffc47){if(!_0x3ffc47){_0x187b8a[_0x0fe6('0x1b')](0x194);}return _0x3ffc47;};}function handleError(_0x346811,_0x422a49){_0x422a49=_0x422a49||0x1f4;return function(_0x3bd969){logger['error'](_0x3bd969['stack']);if(_0x3bd969[_0x0fe6('0x37')]){delete _0x3bd969[_0x0fe6('0x37')];}_0x346811[_0x0fe6('0x1c')](_0x422a49)[_0x0fe6('0x39')](_0x3bd969);};}exports[_0x0fe6('0x3a')]=function(_0x4e183e,_0xd1b332){var _0xf35693={},_0x46c9b7={},_0x2fa136={'count':0x0,'rows':[]};var _0x673a6a=_[_0x0fe6('0x32')](db['VoiceExtension']['rawAttributes'],function(_0x196bd9){return{'name':_0x196bd9[_0x0fe6('0x3b')],'type':_0x196bd9[_0x0fe6('0x35')]['key']};});_0x46c9b7[_0x0fe6('0x3c')]=_[_0x0fe6('0x32')](_0x673a6a,_0x0fe6('0x37'));_0x46c9b7['query']=_[_0x0fe6('0x3d')](_0x4e183e[_0x0fe6('0x3e')]);_0x46c9b7[_0x0fe6('0x3f')]=_[_0x0fe6('0x40')](_0x46c9b7['model'],_0x46c9b7[_0x0fe6('0x3e')]);_0xf35693[_0x0fe6('0x41')]=_[_0x0fe6('0x40')](_0x46c9b7[_0x0fe6('0x3c')],qs[_0x0fe6('0x42')](_0x4e183e[_0x0fe6('0x3e')]['fields']));_0xf35693[_0x0fe6('0x41')]=_0xf35693[_0x0fe6('0x41')][_0x0fe6('0x43')]?_0xf35693[_0x0fe6('0x41')]:_0x46c9b7[_0x0fe6('0x3c')];if(!_0x4e183e[_0x0fe6('0x3e')][_0x0fe6('0x44')]('nolimit')){_0xf35693[_0x0fe6('0x21')]=qs[_0x0fe6('0x21')](_0x4e183e[_0x0fe6('0x3e')]['limit']);_0xf35693[_0x0fe6('0x1f')]=qs[_0x0fe6('0x1f')](_0x4e183e['query'][_0x0fe6('0x1f')]);}_0xf35693[_0x0fe6('0x45')]=qs[_0x0fe6('0x46')](_0x4e183e[_0x0fe6('0x3e')][_0x0fe6('0x46')]);_0xf35693[_0x0fe6('0x47')]=qs[_0x0fe6('0x3f')](_[_0x0fe6('0x48')](_0x4e183e[_0x0fe6('0x3e')],_0x46c9b7[_0x0fe6('0x3f')]),_0x673a6a);if(_0x4e183e[_0x0fe6('0x3e')][_0x0fe6('0x30')]){_0xf35693[_0x0fe6('0x47')]=_[_0x0fe6('0x49')](_0xf35693[_0x0fe6('0x47')],{'$or':_[_0x0fe6('0x32')](_0x673a6a,function(_0x540f27){if(_0x540f27[_0x0fe6('0x35')]!==_0x0fe6('0x4a')){var _0x19ed3a={};_0x19ed3a[_0x540f27[_0x0fe6('0x37')]]={'$like':'%'+_0x4e183e[_0x0fe6('0x3e')][_0x0fe6('0x30')]+'%'};return _0x19ed3a;}})});}_0xf35693=_['merge']({},_0xf35693,_0x4e183e['options']);var _0x415839={'where':_0xf35693[_0x0fe6('0x47')]};return db[_0x0fe6('0x4b')]['count'](_0x415839)[_0x0fe6('0x28')](function(_0x2c09f5){_0x2fa136['count']=_0x2c09f5;if(_0x4e183e[_0x0fe6('0x3e')]['includeAll']){_0xf35693['include']=[{'all':!![]}];}return db[_0x0fe6('0x4b')][_0x0fe6('0x4c')](_0xf35693);})['then'](function(_0x17400b){_0x2fa136['rows']=_0x17400b;return _0x2fa136;})['then'](respondWithFilteredResult(_0xd1b332,_0xf35693))[_0x0fe6('0x4d')](handleError(_0xd1b332,null));};exports['show']=function(_0x507035,_0x3ebefd){var _0x5429fb={'raw':![],'where':{'id':_0x507035['params']['id']}},_0x591626={};_0x591626[_0x0fe6('0x3c')]=_[_0x0fe6('0x3d')](db['VoiceExtension'][_0x0fe6('0x4e')]);_0x591626[_0x0fe6('0x3e')]=_[_0x0fe6('0x3d')](_0x507035[_0x0fe6('0x3e')]);_0x591626[_0x0fe6('0x3f')]=_[_0x0fe6('0x40')](_0x591626[_0x0fe6('0x3c')],_0x591626[_0x0fe6('0x3e')]);_0x5429fb['attributes']=_[_0x0fe6('0x40')](_0x591626['model'],qs[_0x0fe6('0x42')](_0x507035['query'][_0x0fe6('0x42')]));_0x5429fb[_0x0fe6('0x41')]=_0x5429fb[_0x0fe6('0x41')][_0x0fe6('0x43')]?_0x5429fb[_0x0fe6('0x41')]:_0x591626[_0x0fe6('0x3c')];if(_0x507035[_0x0fe6('0x3e')]['includeAll']){_0x5429fb[_0x0fe6('0x4f')]=[{'all':!![]}];}_0x5429fb=_[_0x0fe6('0x49')]({},_0x5429fb,_0x507035[_0x0fe6('0x50')]);return db[_0x0fe6('0x4b')][_0x0fe6('0x36')](_0x5429fb)[_0x0fe6('0x28')](handleEntityNotFound(_0x3ebefd,null))[_0x0fe6('0x28')](respondWithResult(_0x3ebefd,null))[_0x0fe6('0x4d')](handleError(_0x3ebefd,null));};exports[_0x0fe6('0x29')]=function(_0x1107f5,_0x544a15){return db['VoiceExtension'][_0x0fe6('0x36')]({'where':{'id':_0x1107f5[_0x0fe6('0x51')]['id']}})[_0x0fe6('0x28')](handleEntityNotFound(_0x544a15,null))[_0x0fe6('0x28')](removeEntity(_0x544a15,null))[_0x0fe6('0x4d')](handleError(_0x544a15,null));};exports[_0x0fe6('0x52')]=function(_0x2fc011,_0x1994ef){if(_0x2fc011[_0x0fe6('0x53')]['type']===_0x0fe6('0x2d')&&!_[_0x0fe6('0x54')](_0x2fc011[_0x0fe6('0x53')][_0x0fe6('0x55')],'_')){_0x2fc011['body'][_0x0fe6('0x55')]='_'[_0x0fe6('0x56')](_0x2fc011['body']['exten']);}return db[_0x0fe6('0x4b')][_0x0fe6('0x52')](_0x2fc011[_0x0fe6('0x53')],{'raw':![]})['then'](function(_0x5b9abe){var _0x4e1b6c=_0x2fc011['user'][_0x0fe6('0x2a')]({'plain':!![]});if(!_0x4e1b6c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4e1b6c[_0x0fe6('0x57')]==='user'){var _0x18e1a6=_0x5b9abe[_0x0fe6('0x2a')]({'plain':!![]});var _0x4bfe41=[{'name':'InboundRoutes','value':_0x0fe6('0x58')},{'name':_0x0fe6('0x2c'),'value':_0x0fe6('0x2d')},{'name':_0x0fe6('0x2e'),'value':_0x0fe6('0x2f')}];var _0x353d3c=_['find'](_0x4bfe41,[_0x0fe6('0x33'),_0x18e1a6[_0x0fe6('0x35')]])[_0x0fe6('0x37')];return db[_0x0fe6('0x59')]['find']({'where':{'name':_0x353d3c,'userProfileId':_0x4e1b6c[_0x0fe6('0x5a')]},'raw':!![]})[_0x0fe6('0x28')](function(_0x1c4957){if(_0x1c4957&&_0x1c4957[_0x0fe6('0x5b')]===0x0){return db['UserProfileResource'][_0x0fe6('0x52')]({'name':_0x18e1a6['name'],'resourceId':_0x18e1a6['id'],'type':_0x1c4957[_0x0fe6('0x37')],'sectionId':_0x1c4957['id']},{})[_0x0fe6('0x28')](function(){return _0x5b9abe;});}else{return _0x5b9abe;}})[_0x0fe6('0x4d')](function(_0x15c7bd){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x15c7bd);throw _0x15c7bd;});}return _0x5b9abe;})['then'](respondWithResult(_0x1994ef,0xc9))[_0x0fe6('0x4d')](handleError(_0x1994ef,null));};exports[_0x0fe6('0x27')]=function(_0x4936c5,_0x1feb66){if(_0x4936c5[_0x0fe6('0x53')]['id']){delete _0x4936c5[_0x0fe6('0x53')]['id'];}return db[_0x0fe6('0x4b')][_0x0fe6('0x36')]({'where':{'id':_0x4936c5['params']['id']}})[_0x0fe6('0x28')](handleEntityNotFound(_0x1feb66,null))[_0x0fe6('0x28')](function(_0x5f4c5c){if(_0x5f4c5c){return db['VoiceExtension'][_0x0fe6('0x27')](_[_0x0fe6('0x48')](_0x4936c5[_0x0fe6('0x53')],[_0x0fe6('0x55'),'context',_0x0fe6('0x5c'),_0x0fe6('0x5d'),'cutdigits','mandatoryDisposition']),{'where':{'context':_0x5f4c5c[_0x0fe6('0x5e')],'exten':_0x5f4c5c[_0x0fe6('0x55')]},'individualHooks':!![]})[_0x0fe6('0x28')](function(_0x427ed4){return _0x427ed4;});}return null;})[_0x0fe6('0x28')](respondWithStatusCode(_0x1feb66,null))[_0x0fe6('0x4d')](handleError(_0x1feb66,null));};exports[_0x0fe6('0x5f')]=function(_0x1419c7,_0xc52346,_0x236764){return db['VoiceExtension'][_0x0fe6('0x60')]({'where':{'id':_0x1419c7[_0x0fe6('0x51')]['id']}})['then'](handleEntityNotFound(_0xc52346,null))[_0x0fe6('0x28')](function(_0x3f6051){if(_0x3f6051){return db['sequelize']['transaction'](function(_0x4de994){return db[_0x0fe6('0x4b')]['destroy']({'where':{'VoiceExtensionId':_0x1419c7[_0x0fe6('0x51')]['id']},'transaction':_0x4de994})[_0x0fe6('0x28')](function(_0x4e2d29){var _0x440e70=_[_0x0fe6('0x32')](_0x1419c7[_0x0fe6('0x53')],function(_0x3ba423){_0x3ba423[_0x0fe6('0x61')]=_0x1419c7[_0x0fe6('0x51')]['id'];return _0x3ba423;});return db[_0x0fe6('0x4b')][_0x0fe6('0x62')](_0x440e70,{'transaction':_0x4de994});});})[_0x0fe6('0x28')](function(){return db[_0x0fe6('0x4b')][_0x0fe6('0x63')]({'where':{'isApp':!![],'VoiceExtensionId':_0x1419c7['params']['id']},'order':_0x0fe6('0x64')});});}})[_0x0fe6('0x28')](respondWithResult(_0xc52346,null))[_0x0fe6('0x4d')](handleError(_0xc52346,null));}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index 57ddfaa..83ebdc9 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 _0x3fdd=['remove','emit','hasOwnProperty','hook','exports','VoiceExtension','setMaxListeners','update'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x3fdd,0x105));var _0xd3fd=function(_0x2b2882,_0x3f89ad){_0x2b2882=_0x2b2882-0x0;var _0xf5bccc=_0x3fdd[_0x2b2882];return _0xf5bccc;};'use strict';var EventEmitter=require('events');var VoiceExtension=require('../../mysqldb')['db'][_0xd3fd('0x0')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0xd3fd('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0xd3fd('0x2'),'afterDestroy':_0xd3fd('0x3')};function emitEvent(_0x31a758){return function(_0x249eab,_0x1da6b9,_0x234cca){VoiceExtensionEvents[_0xd3fd('0x4')](_0x31a758+':'+_0x249eab['id'],_0x249eab);VoiceExtensionEvents['emit'](_0x31a758,_0x249eab);_0x234cca(null);};}for(var e in events){if(events[_0xd3fd('0x5')](e)){var event=events[e];VoiceExtension[_0xd3fd('0x6')](e,emitEvent(event));}}module[_0xd3fd('0x7')]=VoiceExtensionEvents; \ No newline at end of file +var _0x1b94=['events','../../mysqldb','VoiceExtension','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x1f4354,_0x18576c){var _0x2880a1=function(_0xe0a4bd){while(--_0xe0a4bd){_0x1f4354['push'](_0x1f4354['shift']());}};_0x2880a1(++_0x18576c);}(_0x1b94,0x15e));var _0x41b9=function(_0x39e283,_0x247e6b){_0x39e283=_0x39e283-0x0;var _0x7de89f=_0x1b94[_0x39e283];return _0x7de89f;};'use strict';var EventEmitter=require(_0x41b9('0x0'));var VoiceExtension=require(_0x41b9('0x1'))['db'][_0x41b9('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x41b9('0x3'),'afterUpdate':_0x41b9('0x4'),'afterDestroy':_0x41b9('0x5')};function emitEvent(_0x50cb6a){return function(_0x4e84ea,_0x1afed6,_0x2d0026){VoiceExtensionEvents[_0x41b9('0x6')](_0x50cb6a+':'+_0x4e84ea['id'],_0x4e84ea);VoiceExtensionEvents[_0x41b9('0x6')](_0x50cb6a,_0x4e84ea);_0x2d0026(null);};}for(var e in events){if(events[_0x41b9('0x7')](e)){var event=events[e];VoiceExtension[_0x41b9('0x8')](e,emitEvent(event));}}module[_0x41b9('0x9')]=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index ddfa7b5..69df9c9 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 _0x60bc=['lodash','util','api','bluebird','path','rimraf','../../config/environment','./voiceExtension.attributes','exports','voice_extensions'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x60bc,0x104));var _0xc60b=function(_0x1c1bf5,_0x4fc8e6){_0x1c1bf5=_0x1c1bf5-0x0;var _0xa3389=_0x60bc[_0x1c1bf5];return _0xa3389;};'use strict';var _=require(_0xc60b('0x0'));var util=require(_0xc60b('0x1'));var logger=require('../../config/logger')(_0xc60b('0x2'));var moment=require('moment');var BPromise=require(_0xc60b('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc60b('0x4'));var rimraf=require(_0xc60b('0x5'));var config=require(_0xc60b('0x6'));var attributes=require(_0xc60b('0x7'));module[_0xc60b('0x8')]=function(_0x44fdc2,_0x13018a){return _0x44fdc2['define']('VoiceExtension',attributes,{'tableName':_0xc60b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9dd8=['voice_extensions','util','api','request-promise','path','rimraf','../../config/environment','./voiceExtension.attributes','exports','define','VoiceExtension'];(function(_0x4d8a55,_0x293e05){var _0x4fe3c9=function(_0x1a22c3){while(--_0x1a22c3){_0x4d8a55['push'](_0x4d8a55['shift']());}};_0x4fe3c9(++_0x293e05);}(_0x9dd8,0x1cf));var _0x89dd=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x9dd8[_0x178e48];return _0x440d7e;};'use strict';var _=require('lodash');var util=require(_0x89dd('0x0'));var logger=require('../../config/logger')(_0x89dd('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x89dd('0x2'));var fs=require('fs');var path=require(_0x89dd('0x3'));var rimraf=require(_0x89dd('0x4'));var config=require(_0x89dd('0x5'));var attributes=require(_0x89dd('0x6'));module[_0x89dd('0x7')]=function(_0xb99664,_0x46ba90){return _0xb99664[_0x89dd('0x8')](_0x89dd('0x9'),attributes,{'tableName':_0x89dd('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index 6cc40a1..78427b1 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 _0x21cd=['localhost','socket.io-emitter','./voiceExtension.socket','register','request','then','info','VoiceExtension,\x20%s,\x20%s','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','VoiceExtension','findAll','options','where','attributes','limit','include','map','model','GetVoiceExtension','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','redis','defaults'];(function(_0x321082,_0x21eb5a){var _0x478d7d=function(_0x3a9e0d){while(--_0x3a9e0d){_0x321082['push'](_0x321082['shift']());}};_0x478d7d(++_0x21eb5a);}(_0x21cd,0x6a));var _0xd21c=function(_0x5a3cf0,_0x160a68){_0x5a3cf0=_0x5a3cf0-0x0;var _0x5a64ee=_0x21cd[_0x5a3cf0];return _0x5a64ee;};'use strict';var _=require(_0xd21c('0x0'));var util=require(_0xd21c('0x1'));var moment=require(_0xd21c('0x2'));var BPromise=require(_0xd21c('0x3'));var rs=require(_0xd21c('0x4'));var fs=require('fs');var Redis=require(_0xd21c('0x5'));var db=require(_0xd21c('0x6'))['db'];var utils=require(_0xd21c('0x7'));var logger=require(_0xd21c('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0xd21c('0x9'));var client=jayson[_0xd21c('0xa')][_0xd21c('0xb')]({'port':0x232a});config[_0xd21c('0xc')]=_[_0xd21c('0xd')](config['redis'],{'host':_0xd21c('0xe'),'port':0x18eb});var socket=require(_0xd21c('0xf'))(new Redis(config[_0xd21c('0xc')]));require(_0xd21c('0x10'))[_0xd21c('0x11')](socket);function respondWithRpcPromise(_0x5298c4,_0x380c59,_0x4ad6d1){return new BPromise(function(_0x39dd4a,_0x2e36b0){return client[_0xd21c('0x12')](_0x5298c4,_0x4ad6d1)[_0xd21c('0x13')](function(_0x474042){logger[_0xd21c('0x14')](_0xd21c('0x15'),_0x380c59,'request\x20sent');logger[_0xd21c('0x16')](_0xd21c('0x17'),_0x380c59,_0xd21c('0x18'),JSON[_0xd21c('0x19')](_0x474042));if(_0x474042[_0xd21c('0x1a')]){if(_0x474042[_0xd21c('0x1a')][_0xd21c('0x1b')]===0x1f4){logger[_0xd21c('0x1a')](_0xd21c('0x15'),_0x380c59,_0x474042[_0xd21c('0x1a')][_0xd21c('0x1c')]);return _0x2e36b0(_0x474042[_0xd21c('0x1a')]['message']);}logger[_0xd21c('0x1a')](_0xd21c('0x15'),_0x380c59,_0x474042[_0xd21c('0x1a')][_0xd21c('0x1c')]);return _0x39dd4a(_0x474042[_0xd21c('0x1a')]['message']);}else{logger[_0xd21c('0x14')](_0xd21c('0x15'),_0x380c59,_0xd21c('0x18'));_0x39dd4a(_0x474042['result'][_0xd21c('0x1c')]);}})[_0xd21c('0x1d')](function(_0x580546){logger[_0xd21c('0x1a')](_0xd21c('0x15'),_0x380c59,_0x580546);_0x2e36b0(_0x580546);});});}exports['GetVoiceExtension']=function(_0x4e352a){var _0x50b0b9=this;return new Promise(function(_0x258ef1,_0x21a175){return db[_0xd21c('0x1e')][_0xd21c('0x1f')]({'raw':_0x4e352a['options']?_0x4e352a[_0xd21c('0x20')]['raw']===undefined?!![]:![]:!![],'where':_0x4e352a['options']?_0x4e352a[_0xd21c('0x20')][_0xd21c('0x21')]||null:null,'attributes':_0x4e352a[_0xd21c('0x20')]?_0x4e352a[_0xd21c('0x20')][_0xd21c('0x22')]||null:null,'limit':_0x4e352a[_0xd21c('0x20')]?_0x4e352a[_0xd21c('0x20')][_0xd21c('0x23')]||null:null,'include':_0x4e352a[_0xd21c('0x20')]?_0x4e352a[_0xd21c('0x20')][_0xd21c('0x24')]?_[_0xd21c('0x25')](_0x4e352a['options'][_0xd21c('0x24')],function(_0x5382bf){return{'model':db[_0x5382bf[_0xd21c('0x26')]],'as':_0x5382bf['as'],'attributes':_0x5382bf['attributes'],'include':_0x5382bf[_0xd21c('0x24')]?_[_0xd21c('0x25')](_0x5382bf[_0xd21c('0x24')],function(_0x46f344){return{'model':db[_0x46f344[_0xd21c('0x26')]],'as':_0x46f344['as'],'attributes':_0x46f344[_0xd21c('0x22')],'include':_0x46f344[_0xd21c('0x24')]?_[_0xd21c('0x25')](_0x46f344[_0xd21c('0x24')],function(_0x14cc32){return{'model':db[_0x14cc32['model']],'as':_0x14cc32['as'],'attributes':_0x14cc32[_0xd21c('0x22')]};}):[]};}):[]};}):[]:[]})[_0xd21c('0x13')](function(_0x5c0e39){logger[_0xd21c('0x14')]('GetVoiceExtension',_0x4e352a);logger['debug']('GetVoiceExtension',_0x4e352a,JSON[_0xd21c('0x19')](_0x5c0e39));_0x258ef1(_0x5c0e39);})[_0xd21c('0x1d')](function(_0x3b7f6e){logger[_0xd21c('0x1a')](_0xd21c('0x27'),_0x3b7f6e[_0xd21c('0x1c')],_0x4e352a);_0x21a175(_0x50b0b9['error'](0x1f4,_0x3b7f6e[_0xd21c('0x1c')]));});});}; \ No newline at end of file +var _0x1354=['stringify','error','message','catch','GetVoiceExtension','findAll','options','raw','attributes','limit','include','map','model','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','defaults','redis','localhost','register','info','VoiceExtension,\x20%s,\x20%s','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x21c14d,_0x5d3a24){var _0x239be8=function(_0x4fd0e8){while(--_0x4fd0e8){_0x21c14d['push'](_0x21c14d['shift']());}};_0x239be8(++_0x5d3a24);}(_0x1354,0x95));var _0x4135=function(_0x4fc435,_0x45eddf){_0x4fc435=_0x4fc435-0x0;var _0x3c5db1=_0x1354[_0x4fc435];return _0x3c5db1;};'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});config['redis']=_[_0x4135('0xc')](config[_0x4135('0xd')],{'host':_0x4135('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4135('0xd')]));require('./voiceExtension.socket')[_0x4135('0xf')](socket);function respondWithRpcPromise(_0x1d0cc6,_0x4447c8,_0x39822e){return new BPromise(function(_0x5dd78a,_0x35d576){return client['request'](_0x1d0cc6,_0x39822e)['then'](function(_0x73c55f){logger[_0x4135('0x10')](_0x4135('0x11'),_0x4447c8,'request\x20sent');logger[_0x4135('0x12')](_0x4135('0x13'),_0x4447c8,_0x4135('0x14'),JSON[_0x4135('0x15')](_0x73c55f));if(_0x73c55f[_0x4135('0x16')]){if(_0x73c55f[_0x4135('0x16')]['code']===0x1f4){logger['error'](_0x4135('0x11'),_0x4447c8,_0x73c55f[_0x4135('0x16')][_0x4135('0x17')]);return _0x35d576(_0x73c55f[_0x4135('0x16')]['message']);}logger[_0x4135('0x16')](_0x4135('0x11'),_0x4447c8,_0x73c55f['error']['message']);return _0x5dd78a(_0x73c55f[_0x4135('0x16')]['message']);}else{logger[_0x4135('0x10')]('VoiceExtension,\x20%s,\x20%s',_0x4447c8,'request\x20sent');_0x5dd78a(_0x73c55f['result']['message']);}})[_0x4135('0x18')](function(_0x55adba){logger[_0x4135('0x16')](_0x4135('0x11'),_0x4447c8,_0x55adba);_0x35d576(_0x55adba);});});}exports[_0x4135('0x19')]=function(_0x5eddcc){var _0x3f7e85=this;return new Promise(function(_0x3dae32,_0x398294){return db['VoiceExtension'][_0x4135('0x1a')]({'raw':_0x5eddcc['options']?_0x5eddcc[_0x4135('0x1b')][_0x4135('0x1c')]===undefined?!![]:![]:!![],'where':_0x5eddcc[_0x4135('0x1b')]?_0x5eddcc[_0x4135('0x1b')]['where']||null:null,'attributes':_0x5eddcc[_0x4135('0x1b')]?_0x5eddcc[_0x4135('0x1b')][_0x4135('0x1d')]||null:null,'limit':_0x5eddcc[_0x4135('0x1b')]?_0x5eddcc[_0x4135('0x1b')][_0x4135('0x1e')]||null:null,'include':_0x5eddcc[_0x4135('0x1b')]?_0x5eddcc[_0x4135('0x1b')][_0x4135('0x1f')]?_[_0x4135('0x20')](_0x5eddcc[_0x4135('0x1b')][_0x4135('0x1f')],function(_0x212228){return{'model':db[_0x212228[_0x4135('0x21')]],'as':_0x212228['as'],'attributes':_0x212228['attributes'],'include':_0x212228[_0x4135('0x1f')]?_[_0x4135('0x20')](_0x212228[_0x4135('0x1f')],function(_0x36b9e3){return{'model':db[_0x36b9e3[_0x4135('0x21')]],'as':_0x36b9e3['as'],'attributes':_0x36b9e3[_0x4135('0x1d')],'include':_0x36b9e3['include']?_[_0x4135('0x20')](_0x36b9e3[_0x4135('0x1f')],function(_0x31b508){return{'model':db[_0x31b508[_0x4135('0x21')]],'as':_0x31b508['as'],'attributes':_0x31b508[_0x4135('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x411ee0){logger[_0x4135('0x10')]('GetVoiceExtension',_0x5eddcc);logger[_0x4135('0x12')]('GetVoiceExtension',_0x5eddcc,JSON[_0x4135('0x15')](_0x411ee0));_0x3dae32(_0x411ee0);})[_0x4135('0x18')](function(_0x25a672){logger[_0x4135('0x16')]('GetVoiceExtension',_0x25a672[_0x4135('0x17')],_0x5eddcc);_0x398294(_0x3f7e85[_0x4135('0x16')](0x1f4,_0x25a672[_0x4135('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index 49b9a20..092890b 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 _0xc4aa=['remove','update','removeListener','register','length','./voiceExtension.events','save'];(function(_0x164f07,_0x5b1bdf){var _0x21bcd7=function(_0x4783ca){while(--_0x4783ca){_0x164f07['push'](_0x164f07['shift']());}};_0x21bcd7(++_0x5b1bdf);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0xc4aa[_0x46698a];return _0x356db0;};'use strict';var VoiceExtensionEvents=require(_0xac4a('0x0'));var events=[_0xac4a('0x1'),_0xac4a('0x2'),_0xac4a('0x3')];function createListener(_0x275161,_0x22469d){return function(_0x58634e){_0x22469d['emit'](_0x275161,_0x58634e);};}function removeListener(_0x47d4f6,_0x2f48ed){return function(){VoiceExtensionEvents[_0xac4a('0x4')](_0x47d4f6,_0x2f48ed);};}exports[_0xac4a('0x5')]=function(_0x215f39){for(var _0x96be2b=0x0,_0x15cd34=events[_0xac4a('0x6')];_0x96be2b<_0x15cd34;_0x96be2b++){var _0x10525b=events[_0x96be2b];var _0x5c6179=createListener('voiceExtension:'+_0x10525b,_0x215f39);VoiceExtensionEvents['on'](_0x10525b,_0x5c6179);}}; \ No newline at end of file +var _0x53ec=['length','voiceExtension:','./voiceExtension.events','save','remove','update','emit','removeListener'];(function(_0x1b0f43,_0x3df546){var _0xe5fc0f=function(_0xcf0585){while(--_0xcf0585){_0x1b0f43['push'](_0x1b0f43['shift']());}};_0xe5fc0f(++_0x3df546);}(_0x53ec,0x192));var _0xc53e=function(_0x5114aa,_0x4596b9){_0x5114aa=_0x5114aa-0x0;var _0x1841bc=_0x53ec[_0x5114aa];return _0x1841bc;};'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 d5770fe..c42148b 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 _0xb091=['getMessages','post','create','put','/:id','update','delete','destroy','exports','util','path','connect-timeout','express','fs-extra','../../config/environment','./voiceMail.controller','isAuthenticated','index','get','show','/:id/messages'];(function(_0x3cd283,_0x2b8542){var _0x5ea1f0=function(_0x5d7e1c){while(--_0x5d7e1c){_0x3cd283['push'](_0x3cd283['shift']());}};_0x5ea1f0(++_0x2b8542);}(_0xb091,0x16e));var _0x1b09=function(_0x5a77a4,_0x458af0){_0x5a77a4=_0x5a77a4-0x0;var _0x27312d=_0xb091[_0x5a77a4];return _0x27312d;};'use strict';var multer=require('multer');var util=require(_0x1b09('0x0'));var path=require(_0x1b09('0x1'));var timeout=require(_0x1b09('0x2'));var express=require(_0x1b09('0x3'));var router=express['Router']();var fs_extra=require(_0x1b09('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x1b09('0x5'));var controller=require(_0x1b09('0x6'));router['get']('/',auth[_0x1b09('0x7')](),controller[_0x1b09('0x8')]);router[_0x1b09('0x9')]('/:id',auth[_0x1b09('0x7')](),controller[_0x1b09('0xa')]);router[_0x1b09('0x9')](_0x1b09('0xb'),auth[_0x1b09('0x7')](),controller[_0x1b09('0xc')]);router[_0x1b09('0xd')]('/',auth[_0x1b09('0x7')](),controller[_0x1b09('0xe')]);router[_0x1b09('0xf')](_0x1b09('0x10'),auth['isAuthenticated'](),controller[_0x1b09('0x11')]);router[_0x1b09('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x1b09('0x13')]);module[_0x1b09('0x14')]=router; \ No newline at end of file +var _0x687b=['../../components/interaction/service','../../config/environment','./voiceMail.controller','get','isAuthenticated','index','/:id','show','getMessages','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service'];(function(_0x262ce9,_0xcf8a15){var _0x22e538=function(_0x32ee56){while(--_0x32ee56){_0x262ce9['push'](_0x262ce9['shift']());}};_0x22e538(++_0xcf8a15);}(_0x687b,0x14a));var _0xb687=function(_0xe502ca,_0x1cc7cc){_0xe502ca=_0xe502ca-0x0;var _0x514270=_0x687b[_0xe502ca];return _0x514270;};'use strict';var multer=require(_0xb687('0x0'));var util=require(_0xb687('0x1'));var path=require(_0xb687('0x2'));var timeout=require(_0xb687('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xb687('0x4'));var auth=require(_0xb687('0x5'));var interaction=require(_0xb687('0x6'));var config=require(_0xb687('0x7'));var controller=require(_0xb687('0x8'));router[_0xb687('0x9')]('/',auth[_0xb687('0xa')](),controller[_0xb687('0xb')]);router[_0xb687('0x9')](_0xb687('0xc'),auth['isAuthenticated'](),controller[_0xb687('0xd')]);router[_0xb687('0x9')]('/:id/messages',auth[_0xb687('0xa')](),controller[_0xb687('0xe')]);router[_0xb687('0xf')]('/',auth[_0xb687('0xa')](),controller[_0xb687('0x10')]);router[_0xb687('0x11')](_0xb687('0xc'),auth[_0xb687('0xa')](),controller[_0xb687('0x12')]);router['delete'](_0xb687('0xc'),auth[_0xb687('0xa')](),controller[_0xb687('0x13')]);module[_0xb687('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index 156470a..cd064c9 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 _0xf4d0=['trim','central','yes','ENUM','TINYINT(4)','INTEGER','VIRTUAL','getDataValue','sequelize','exports','STRING','contest_mailbox','setDataValue','email','string'];(function(_0x3cdfb1,_0x32aefe){var _0x1ce4a0=function(_0x33a517){while(--_0x33a517){_0x3cdfb1['push'](_0x3cdfb1['shift']());}};_0x1ce4a0(++_0x32aefe);}(_0xf4d0,0x125));var _0x0f4d=function(_0x2133c3,_0x3d644a){_0x2133c3=_0x2133c3-0x0;var _0x3cdd9c=_0xf4d0[_0x2133c3];return _0x3cdd9c;};'use strict';var Sequelize=require(_0x0f4d('0x0'));module[_0x0f4d('0x1')]={'customer_id':{'type':Sequelize[_0x0f4d('0x2')]},'context':{'type':Sequelize[_0x0f4d('0x2')],'defaultValue':'from-voicemail','unique':_0x0f4d('0x3')},'mailbox':{'type':Sequelize[_0x0f4d('0x2')],'defaultValue':'','allowNull':![],'unique':'contest_mailbox'},'password':{'type':Sequelize['STRING']},'fullname':{'type':Sequelize[_0x0f4d('0x2')]},'email':{'type':Sequelize[_0x0f4d('0x2')],'validate':{'isEmail':!![]},'set':function(_0x431163){this[_0x0f4d('0x4')](_0x0f4d('0x5'),typeof _0x431163===_0x0f4d('0x6')&&_0x431163[_0x0f4d('0x7')]()?_0x431163[_0x0f4d('0x7')]():null);}},'pager':{'type':Sequelize['STRING']},'tz':{'type':Sequelize[_0x0f4d('0x2')],'defaultValue':_0x0f4d('0x8')},'attach':{'type':Sequelize['ENUM'](_0x0f4d('0x9'),'no'),'defaultValue':_0x0f4d('0x9'),'allowNull':![]},'saycid':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':_0x0f4d('0x9'),'allowNull':![]},'dialout':{'type':Sequelize[_0x0f4d('0x2')]},'callback':{'type':Sequelize['STRING']},'review':{'type':Sequelize['ENUM'](_0x0f4d('0x9'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x0f4d('0xa')](_0x0f4d('0x9'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x0f4d('0xa')](_0x0f4d('0x9'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize['ENUM'](_0x0f4d('0x9'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x0f4d('0xb'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize['ENUM'](_0x0f4d('0x9'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize['ENUM'](_0x0f4d('0x9'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x0f4d('0xa')]('yes','no'),'defaultValue':_0x0f4d('0x9'),'allowNull':![]},'forcename':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize['ENUM'](_0x0f4d('0x9'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'yes','allowNull':![]},'stamp':{'type':'TIMESTAMP'},'emailsubject':{'type':Sequelize['STRING']},'emailbody':{'type':Sequelize[_0x0f4d('0x2')]},'maxsecs':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x0f4d('0xc')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x0f4d('0xd')],'get':function(){return this[_0x0f4d('0xe')]('fullname')+'\x20-\x20'+this[_0x0f4d('0xe')]('mailbox');}}}; \ No newline at end of file +var _0x7444=['mailbox','sequelize','exports','STRING','from-voicemail','contest_mailbox','setDataValue','email','string','trim','central','ENUM','yes','TINYINT(4)','INTEGER','VIRTUAL','getDataValue','fullname'];(function(_0x9df060,_0x253d33){var _0x338dfe=function(_0x17d9a5){while(--_0x17d9a5){_0x9df060['push'](_0x9df060['shift']());}};_0x338dfe(++_0x253d33);}(_0x7444,0x157));var _0x4744=function(_0x23b374,_0x351fb5){_0x23b374=_0x23b374-0x0;var _0x18eab1=_0x7444[_0x23b374];return _0x18eab1;};'use strict';var Sequelize=require(_0x4744('0x0'));module[_0x4744('0x1')]={'customer_id':{'type':Sequelize[_0x4744('0x2')]},'context':{'type':Sequelize[_0x4744('0x2')],'defaultValue':_0x4744('0x3'),'unique':_0x4744('0x4')},'mailbox':{'type':Sequelize[_0x4744('0x2')],'defaultValue':'','allowNull':![],'unique':_0x4744('0x4')},'password':{'type':Sequelize[_0x4744('0x2')]},'fullname':{'type':Sequelize[_0x4744('0x2')]},'email':{'type':Sequelize[_0x4744('0x2')],'validate':{'isEmail':!![]},'set':function(_0x53070d){this[_0x4744('0x5')](_0x4744('0x6'),typeof _0x53070d===_0x4744('0x7')&&_0x53070d[_0x4744('0x8')]()?_0x53070d[_0x4744('0x8')]():null);}},'pager':{'type':Sequelize[_0x4744('0x2')]},'tz':{'type':Sequelize['STRING'],'defaultValue':_0x4744('0x9')},'attach':{'type':Sequelize[_0x4744('0xa')](_0x4744('0xb'),'no'),'defaultValue':_0x4744('0xb'),'allowNull':![]},'saycid':{'type':Sequelize['ENUM'](_0x4744('0xb'),'no'),'defaultValue':_0x4744('0xb'),'allowNull':![]},'dialout':{'type':Sequelize['STRING']},'callback':{'type':Sequelize['STRING']},'review':{'type':Sequelize[_0x4744('0xa')]('yes','no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize['ENUM'](_0x4744('0xb'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x4744('0xa')](_0x4744('0xb'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x4744('0xc'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x4744('0xa')](_0x4744('0xb'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x4744('0xa')]('yes','no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x4744('0xa')](_0x4744('0xb'),'no'),'defaultValue':_0x4744('0xb'),'allowNull':![]},'forcename':{'type':Sequelize[_0x4744('0xa')](_0x4744('0xb'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize['ENUM'](_0x4744('0xb'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x4744('0xa')]('yes','no'),'defaultValue':_0x4744('0xb'),'allowNull':![]},'stamp':{'type':'TIMESTAMP'},'emailsubject':{'type':Sequelize[_0x4744('0x2')]},'emailbody':{'type':Sequelize[_0x4744('0x2')]},'maxsecs':{'type':Sequelize[_0x4744('0xd')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x4744('0xd')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x4744('0xe')],'get':function(){return this[_0x4744('0xf')](_0x4744('0x10'))+'\x20-\x20'+this[_0x4744('0xf')](_0x4744('0x11'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index 590fdb4..daabbb3 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 _0x4fc2=['nolimit','mailbox','VoiceMailMessage','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','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','save','update','destroy','then','get','Voicemails','UserProfileResource','stack','name','send','map','VoiceMail','fieldName','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','type','merge','options','includeAll','findAll','rows','show','params','keys','rawAttributes','include','find','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','create','catch','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','getMessages','findOne'];(function(_0x591ea0,_0x1eac23){var _0x4ae2c3=function(_0x4a68a0){while(--_0x4a68a0){_0x591ea0['push'](_0x591ea0['shift']());}};_0x4ae2c3(++_0x1eac23);}(_0x4fc2,0x111));var _0x24fc=function(_0x28a9e0,_0x15c16b){_0x28a9e0=_0x28a9e0-0x0;var _0x28b3df=_0x4fc2[_0x28a9e0];return _0x28b3df;};'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 hardwareService=require(_0x24fc('0x15'));var logger=require(_0x24fc('0x16'))(_0x24fc('0x17'));var utils=require(_0x24fc('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x24fc('0x19'));var db=require(_0x24fc('0x1a'))['db'];function respondWithStatusCode(_0x5cc65e,_0x306873){_0x306873=_0x306873||0xcc;return function(_0x76cb25){if(_0x76cb25){return _0x5cc65e[_0x24fc('0x1b')](_0x306873);}return _0x5cc65e[_0x24fc('0x1c')](_0x306873)[_0x24fc('0x1d')]();};}function respondWithResult(_0x326276,_0x537b5c){_0x537b5c=_0x537b5c||0xc8;return function(_0x2a0971){if(_0x2a0971){return _0x326276[_0x24fc('0x1c')](_0x537b5c)[_0x24fc('0x1e')](_0x2a0971);}};}function respondWithFilteredResult(_0x42cbe8,_0x4acd36){return function(_0x2ac989){if(_0x2ac989){var _0x588543=typeof _0x4acd36[_0x24fc('0x1f')]===_0x24fc('0x20')&&typeof _0x4acd36[_0x24fc('0x21')]===_0x24fc('0x20');var _0x25cb40=_0x2ac989['count'];var _0x23873c=_0x588543?0x0:_0x4acd36[_0x24fc('0x1f')];var _0x6cfa0a=_0x588543?_0x2ac989[_0x24fc('0x22')]:_0x4acd36['offset']+_0x4acd36[_0x24fc('0x21')];var _0x4073e0;if(_0x6cfa0a>=_0x25cb40){_0x6cfa0a=_0x25cb40;_0x4073e0=0xc8;}else{_0x4073e0=0xce;}_0x42cbe8[_0x24fc('0x1c')](_0x4073e0);return _0x42cbe8['set'](_0x24fc('0x23'),_0x23873c+'-'+_0x6cfa0a+'/'+_0x25cb40)[_0x24fc('0x1e')](_0x2ac989);}return null;};}function patchUpdates(_0xbf1d6b){return function(_0x2d0e3d){try{jsonpatch['apply'](_0x2d0e3d,_0xbf1d6b,!![]);}catch(_0x323beb){return BPromise['reject'](_0x323beb);}return _0x2d0e3d[_0x24fc('0x24')]();};}function saveUpdates(_0x591c8f,_0x3ed464){return function(_0x44c121){if(_0x44c121){return _0x44c121[_0x24fc('0x25')](_0x591c8f)['then'](function(_0x313a25){return _0x313a25;});}return null;};}function removeEntity(_0x552035,_0x35a9c7){return function(_0x2bb93a){if(_0x2bb93a){return _0x2bb93a[_0x24fc('0x26')]()[_0x24fc('0x27')](function(){var _0x3296fc=_0x2bb93a[_0x24fc('0x28')]({'plain':!![]});var _0x3f0875=_0x24fc('0x29');return db[_0x24fc('0x2a')][_0x24fc('0x26')]({'where':{'type':_0x3f0875,'resourceId':_0x3296fc['id']}})['then'](function(){return _0x2bb93a;});})[_0x24fc('0x27')](function(){_0x552035[_0x24fc('0x1c')](0xcc)[_0x24fc('0x1d')]();});}};}function handleEntityNotFound(_0x5bb4c8,_0xf2f77d){return function(_0x3d1ec8){if(!_0x3d1ec8){_0x5bb4c8[_0x24fc('0x1b')](0x194);}return _0x3d1ec8;};}function handleError(_0x290f84,_0x8f2528){_0x8f2528=_0x8f2528||0x1f4;return function(_0x443796){logger['error'](_0x443796[_0x24fc('0x2b')]);if(_0x443796[_0x24fc('0x2c')]){delete _0x443796[_0x24fc('0x2c')];}_0x290f84[_0x24fc('0x1c')](_0x8f2528)[_0x24fc('0x2d')](_0x443796);};}exports['index']=function(_0x55c27f,_0x4e6f73){var _0x3df6f4={},_0x574ba3={},_0x3f2464={'count':0x0,'rows':[]};var _0x3e6389=_[_0x24fc('0x2e')](db[_0x24fc('0x2f')]['rawAttributes'],function(_0x66eec0){return{'name':_0x66eec0[_0x24fc('0x30')],'type':_0x66eec0['type'][_0x24fc('0x31')]};});_0x574ba3[_0x24fc('0x32')]=_['map'](_0x3e6389,'name');_0x574ba3[_0x24fc('0x33')]=_['keys'](_0x55c27f[_0x24fc('0x33')]);_0x574ba3[_0x24fc('0x34')]=_['intersection'](_0x574ba3[_0x24fc('0x32')],_0x574ba3[_0x24fc('0x33')]);_0x3df6f4[_0x24fc('0x35')]=_[_0x24fc('0x36')](_0x574ba3[_0x24fc('0x32')],qs[_0x24fc('0x37')](_0x55c27f[_0x24fc('0x33')][_0x24fc('0x37')]));_0x3df6f4[_0x24fc('0x35')]=_0x3df6f4['attributes'][_0x24fc('0x38')]?_0x3df6f4[_0x24fc('0x35')]:_0x574ba3[_0x24fc('0x32')];if(!_0x55c27f[_0x24fc('0x33')][_0x24fc('0x39')]('nolimit')){_0x3df6f4['limit']=qs[_0x24fc('0x21')](_0x55c27f['query'][_0x24fc('0x21')]);_0x3df6f4[_0x24fc('0x1f')]=qs[_0x24fc('0x1f')](_0x55c27f[_0x24fc('0x33')]['offset']);}_0x3df6f4[_0x24fc('0x3a')]=qs['sort'](_0x55c27f[_0x24fc('0x33')][_0x24fc('0x3b')]);_0x3df6f4[_0x24fc('0x3c')]=qs[_0x24fc('0x34')](_[_0x24fc('0x3d')](_0x55c27f['query'],_0x574ba3[_0x24fc('0x34')]),_0x3e6389);if(_0x55c27f[_0x24fc('0x33')][_0x24fc('0x3e')]){_0x3df6f4[_0x24fc('0x3c')]=_['merge'](_0x3df6f4[_0x24fc('0x3c')],{'$or':_[_0x24fc('0x2e')](_0x3e6389,function(_0x56306e){if(_0x56306e[_0x24fc('0x3f')]!=='VIRTUAL'){var _0x320f7b={};_0x320f7b[_0x56306e[_0x24fc('0x2c')]]={'$like':'%'+_0x55c27f[_0x24fc('0x33')][_0x24fc('0x3e')]+'%'};return _0x320f7b;}})});}_0x3df6f4=_[_0x24fc('0x40')]({},_0x3df6f4,_0x55c27f[_0x24fc('0x41')]);var _0x77b959={'where':_0x3df6f4[_0x24fc('0x3c')]};return db['VoiceMail'][_0x24fc('0x22')](_0x77b959)[_0x24fc('0x27')](function(_0x32f72c){_0x3f2464['count']=_0x32f72c;if(_0x55c27f[_0x24fc('0x33')][_0x24fc('0x42')]){_0x3df6f4['include']=[{'all':!![]}];}return db[_0x24fc('0x2f')][_0x24fc('0x43')](_0x3df6f4);})[_0x24fc('0x27')](function(_0x5e4e9b){_0x3f2464[_0x24fc('0x44')]=_0x5e4e9b;return _0x3f2464;})[_0x24fc('0x27')](respondWithFilteredResult(_0x4e6f73,_0x3df6f4))['catch'](handleError(_0x4e6f73,null));};exports[_0x24fc('0x45')]=function(_0x169982,_0x158f7b){var _0x2a0ac4={'raw':!![],'where':{'id':_0x169982[_0x24fc('0x46')]['id']}},_0x4c8dad={};_0x4c8dad[_0x24fc('0x32')]=_[_0x24fc('0x47')](db[_0x24fc('0x2f')][_0x24fc('0x48')]);_0x4c8dad['query']=_[_0x24fc('0x47')](_0x169982[_0x24fc('0x33')]);_0x4c8dad[_0x24fc('0x34')]=_[_0x24fc('0x36')](_0x4c8dad['model'],_0x4c8dad[_0x24fc('0x33')]);_0x2a0ac4[_0x24fc('0x35')]=_['intersection'](_0x4c8dad['model'],qs[_0x24fc('0x37')](_0x169982['query']['fields']));_0x2a0ac4[_0x24fc('0x35')]=_0x2a0ac4['attributes'][_0x24fc('0x38')]?_0x2a0ac4[_0x24fc('0x35')]:_0x4c8dad[_0x24fc('0x32')];if(_0x169982['query'][_0x24fc('0x42')]){_0x2a0ac4[_0x24fc('0x49')]=[{'all':!![]}];}_0x2a0ac4=_[_0x24fc('0x40')]({},_0x2a0ac4,_0x169982[_0x24fc('0x41')]);return db[_0x24fc('0x2f')][_0x24fc('0x4a')](_0x2a0ac4)[_0x24fc('0x27')](handleEntityNotFound(_0x158f7b,null))[_0x24fc('0x27')](respondWithResult(_0x158f7b,null))['catch'](handleError(_0x158f7b,null));};exports['create']=function(_0x266378,_0x2f1a99){return db[_0x24fc('0x2f')]['create'](_0x266378['body'],{})[_0x24fc('0x27')](function(_0x213439){var _0x179a60=_0x266378[_0x24fc('0x4b')][_0x24fc('0x28')]({'plain':!![]});if(!_0x179a60)throw new Error(_0x24fc('0x4c'));if(_0x179a60[_0x24fc('0x4d')]===_0x24fc('0x4b')){var _0x1671b0=_0x213439[_0x24fc('0x28')]({'plain':!![]});var _0x434700=_0x24fc('0x29');return db['UserProfileSection'][_0x24fc('0x4a')]({'where':{'name':_0x434700,'userProfileId':_0x179a60[_0x24fc('0x4e')]},'raw':!![]})[_0x24fc('0x27')](function(_0xb0fc00){if(_0xb0fc00&&_0xb0fc00[_0x24fc('0x4f')]===0x0){return db['UserProfileResource'][_0x24fc('0x50')]({'name':_0x1671b0['name'],'resourceId':_0x1671b0['id'],'type':_0xb0fc00[_0x24fc('0x2c')],'sectionId':_0xb0fc00['id']},{})[_0x24fc('0x27')](function(){return _0x213439;});}else{return _0x213439;}})[_0x24fc('0x51')](function(_0x41ddfb){logger[_0x24fc('0x52')](_0x24fc('0x53'),_0x41ddfb);throw _0x41ddfb;});}return _0x213439;})['then'](respondWithResult(_0x2f1a99,0xc9))[_0x24fc('0x51')](handleError(_0x2f1a99,null));};exports[_0x24fc('0x25')]=function(_0xc49d9f,_0x31a2ef){if(_0xc49d9f[_0x24fc('0x54')]['id']){delete _0xc49d9f[_0x24fc('0x54')]['id'];}return db['VoiceMail'][_0x24fc('0x4a')]({'where':{'id':_0xc49d9f[_0x24fc('0x46')]['id']}})[_0x24fc('0x27')](handleEntityNotFound(_0x31a2ef,null))[_0x24fc('0x27')](saveUpdates(_0xc49d9f[_0x24fc('0x54')],null))[_0x24fc('0x27')](respondWithResult(_0x31a2ef,null))[_0x24fc('0x51')](handleError(_0x31a2ef,null));};exports['destroy']=function(_0xd673f8,_0x11690f){return db['VoiceMail'][_0x24fc('0x4a')]({'where':{'id':_0xd673f8[_0x24fc('0x46')]['id']}})[_0x24fc('0x27')](handleEntityNotFound(_0x11690f,null))[_0x24fc('0x27')](removeEntity(_0x11690f,null))[_0x24fc('0x51')](handleError(_0x11690f,null));};exports[_0x24fc('0x55')]=function(_0x50302e,_0x28a44c,_0x4a0524){return db[_0x24fc('0x2f')][_0x24fc('0x56')]({'where':{'id':_0x50302e['params']['id']}})[_0x24fc('0x27')](handleEntityNotFound(_0x28a44c,null))['then'](function(_0x1c1f74){var _0x595c47;var _0xdff811={},_0x27b612={};_0x27b612['model']=_[_0x24fc('0x47')](db['VoiceMailMessage'][_0x24fc('0x48')]);_0x27b612[_0x24fc('0x33')]=_['keys'](_0x50302e[_0x24fc('0x33')]);_0x27b612[_0x24fc('0x34')]=_[_0x24fc('0x36')](_0x27b612[_0x24fc('0x32')],_0x27b612[_0x24fc('0x33')]);_0xdff811['attributes']=_[_0x24fc('0x36')](_0x27b612[_0x24fc('0x32')],qs[_0x24fc('0x37')](_0x50302e[_0x24fc('0x33')][_0x24fc('0x37')]));_0xdff811['attributes']=_0xdff811['attributes'][_0x24fc('0x38')]?_0xdff811[_0x24fc('0x35')]:_0x27b612['model'];if(!_0x50302e['query'][_0x24fc('0x39')](_0x24fc('0x57'))){_0xdff811[_0x24fc('0x21')]=qs[_0x24fc('0x21')](_0x50302e['query'][_0x24fc('0x21')]);_0xdff811[_0x24fc('0x1f')]=qs[_0x24fc('0x1f')](_0x50302e[_0x24fc('0x33')][_0x24fc('0x1f')]);}_0xdff811[_0x24fc('0x3a')]=qs[_0x24fc('0x3b')](_0x50302e[_0x24fc('0x33')][_0x24fc('0x3b')]);_0xdff811[_0x24fc('0x3c')]=qs[_0x24fc('0x34')](_[_0x24fc('0x3d')](_0x50302e[_0x24fc('0x33')],_0x27b612[_0x24fc('0x34')]));if(_0x50302e[_0x24fc('0x33')]['filter']){_0xdff811[_0x24fc('0x3c')]=_[_0x24fc('0x40')](_0xdff811[_0x24fc('0x3c')],{'$or':_[_0x24fc('0x2e')](_0xdff811[_0x24fc('0x35')],function(_0x2eb6dc){var _0x10d148={};_0x10d148[_0x2eb6dc]={'$like':'%'+_0x50302e[_0x24fc('0x33')]['filter']+'%'};return _0x10d148;})});}_0xdff811[_0x24fc('0x3c')]=_[_0x24fc('0x40')](_0xdff811[_0x24fc('0x3c')],{'mailboxuser':_0x1c1f74[_0x24fc('0x58')]});_0xdff811=_['merge']({},_0xdff811,_0x50302e[_0x24fc('0x41')]);return db[_0x24fc('0x59')]['findAndCountAll'](_0xdff811)['then'](respondWithFilteredResult(_0x28a44c,_0xdff811));})['catch'](handleError(_0x28a44c,null));}; \ No newline at end of file +var _0x7d25=['then','destroy','get','Voicemails','UserProfileResource','error','stack','name','send','index','map','VoiceMail','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','rows','catch','includeAll','include','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','params','findOne','VoiceMailMessage','nolimit','findAndCountAll','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','ejs','lodash','squel','crypto','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','Content-Range','apply','reject','save','update'];(function(_0x563066,_0x34e2d5){var _0x450943=function(_0x4825c6){while(--_0x4825c6){_0x563066['push'](_0x563066['shift']());}};_0x450943(++_0x34e2d5);}(_0x7d25,0x8a));var _0x57d2=function(_0x4a3898,_0x4c9853){_0x4a3898=_0x4a3898-0x0;var _0x25ceb0=_0x7d25[_0x4a3898];return _0x25ceb0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x57d2('0x0'));var zipdir=require(_0x57d2('0x1'));var jsonpatch=require(_0x57d2('0x2'));var rp=require(_0x57d2('0x3'));var moment=require(_0x57d2('0x4'));var BPromise=require(_0x57d2('0x5'));var Mustache=require(_0x57d2('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x57d2('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x57d2('0x8'));var squel=require(_0x57d2('0x9'));var crypto=require(_0x57d2('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x57d2('0xb'));var querystring=require('querystring');var Papa=require(_0x57d2('0xc'));var Redis=require(_0x57d2('0xd'));var authService=require(_0x57d2('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x57d2('0xf'));var hardwareService=require(_0x57d2('0x10'));var logger=require(_0x57d2('0x11'))(_0x57d2('0x12'));var utils=require(_0x57d2('0x13'));var config=require(_0x57d2('0x14'));var licenseUtil=require(_0x57d2('0x15'));var db=require(_0x57d2('0x16'))['db'];function respondWithStatusCode(_0x43d7fb,_0x32c33a){_0x32c33a=_0x32c33a||0xcc;return function(_0x28428b){if(_0x28428b){return _0x43d7fb[_0x57d2('0x17')](_0x32c33a);}return _0x43d7fb[_0x57d2('0x18')](_0x32c33a)[_0x57d2('0x19')]();};}function respondWithResult(_0x1ba57e,_0x4086f3){_0x4086f3=_0x4086f3||0xc8;return function(_0x5382d9){if(_0x5382d9){return _0x1ba57e['status'](_0x4086f3)[_0x57d2('0x1a')](_0x5382d9);}};}function respondWithFilteredResult(_0x148ef3,_0x4ec4b1){return function(_0x8cf637){if(_0x8cf637){var _0x319489=typeof _0x4ec4b1['offset']===_0x57d2('0x1b')&&typeof _0x4ec4b1['limit']===_0x57d2('0x1b');var _0x4b4fe0=_0x8cf637[_0x57d2('0x1c')];var _0x7d4cf1=_0x319489?0x0:_0x4ec4b1[_0x57d2('0x1d')];var _0x4a94e3=_0x319489?_0x8cf637['count']:_0x4ec4b1[_0x57d2('0x1d')]+_0x4ec4b1[_0x57d2('0x1e')];var _0x2662cd;if(_0x4a94e3>=_0x4b4fe0){_0x4a94e3=_0x4b4fe0;_0x2662cd=0xc8;}else{_0x2662cd=0xce;}_0x148ef3[_0x57d2('0x18')](_0x2662cd);return _0x148ef3['set'](_0x57d2('0x1f'),_0x7d4cf1+'-'+_0x4a94e3+'/'+_0x4b4fe0)[_0x57d2('0x1a')](_0x8cf637);}return null;};}function patchUpdates(_0x55191e){return function(_0x5f3fd5){try{jsonpatch[_0x57d2('0x20')](_0x5f3fd5,_0x55191e,!![]);}catch(_0x326d49){return BPromise[_0x57d2('0x21')](_0x326d49);}return _0x5f3fd5[_0x57d2('0x22')]();};}function saveUpdates(_0x386196,_0x803c25){return function(_0x32c7c8){if(_0x32c7c8){return _0x32c7c8[_0x57d2('0x23')](_0x386196)[_0x57d2('0x24')](function(_0x26718e){return _0x26718e;});}return null;};}function removeEntity(_0x46a4d1,_0x456fe1){return function(_0x12ff19){if(_0x12ff19){return _0x12ff19[_0x57d2('0x25')]()['then'](function(){var _0x424ddc=_0x12ff19[_0x57d2('0x26')]({'plain':!![]});var _0x3c7de8=_0x57d2('0x27');return db[_0x57d2('0x28')]['destroy']({'where':{'type':_0x3c7de8,'resourceId':_0x424ddc['id']}})[_0x57d2('0x24')](function(){return _0x12ff19;});})[_0x57d2('0x24')](function(){_0x46a4d1[_0x57d2('0x18')](0xcc)[_0x57d2('0x19')]();});}};}function handleEntityNotFound(_0x18d500,_0x4b3d8e){return function(_0x9bdb11){if(!_0x9bdb11){_0x18d500['sendStatus'](0x194);}return _0x9bdb11;};}function handleError(_0x1ae5ff,_0x15f1ba){_0x15f1ba=_0x15f1ba||0x1f4;return function(_0x277426){logger[_0x57d2('0x29')](_0x277426[_0x57d2('0x2a')]);if(_0x277426[_0x57d2('0x2b')]){delete _0x277426[_0x57d2('0x2b')];}_0x1ae5ff[_0x57d2('0x18')](_0x15f1ba)[_0x57d2('0x2c')](_0x277426);};}exports[_0x57d2('0x2d')]=function(_0x574589,_0x4e9178){var _0x3da926={},_0x26e052={},_0x3e017c={'count':0x0,'rows':[]};var _0x484597=_[_0x57d2('0x2e')](db[_0x57d2('0x2f')][_0x57d2('0x30')],function(_0x290c2d){return{'name':_0x290c2d[_0x57d2('0x31')],'type':_0x290c2d[_0x57d2('0x32')][_0x57d2('0x33')]};});_0x26e052[_0x57d2('0x34')]=_[_0x57d2('0x2e')](_0x484597,'name');_0x26e052[_0x57d2('0x35')]=_[_0x57d2('0x36')](_0x574589['query']);_0x26e052[_0x57d2('0x37')]=_[_0x57d2('0x38')](_0x26e052['model'],_0x26e052[_0x57d2('0x35')]);_0x3da926[_0x57d2('0x39')]=_[_0x57d2('0x38')](_0x26e052[_0x57d2('0x34')],qs[_0x57d2('0x3a')](_0x574589['query']['fields']));_0x3da926['attributes']=_0x3da926['attributes'][_0x57d2('0x3b')]?_0x3da926[_0x57d2('0x39')]:_0x26e052[_0x57d2('0x34')];if(!_0x574589[_0x57d2('0x35')][_0x57d2('0x3c')]('nolimit')){_0x3da926[_0x57d2('0x1e')]=qs['limit'](_0x574589[_0x57d2('0x35')][_0x57d2('0x1e')]);_0x3da926[_0x57d2('0x1d')]=qs['offset'](_0x574589[_0x57d2('0x35')][_0x57d2('0x1d')]);}_0x3da926['order']=qs[_0x57d2('0x3d')](_0x574589[_0x57d2('0x35')][_0x57d2('0x3d')]);_0x3da926[_0x57d2('0x3e')]=qs[_0x57d2('0x37')](_[_0x57d2('0x3f')](_0x574589['query'],_0x26e052[_0x57d2('0x37')]),_0x484597);if(_0x574589['query'][_0x57d2('0x40')]){_0x3da926[_0x57d2('0x3e')]=_[_0x57d2('0x41')](_0x3da926[_0x57d2('0x3e')],{'$or':_[_0x57d2('0x2e')](_0x484597,function(_0x512dbf){if(_0x512dbf[_0x57d2('0x32')]!==_0x57d2('0x42')){var _0x4f6955={};_0x4f6955[_0x512dbf[_0x57d2('0x2b')]]={'$like':'%'+_0x574589[_0x57d2('0x35')][_0x57d2('0x40')]+'%'};return _0x4f6955;}})});}_0x3da926=_['merge']({},_0x3da926,_0x574589[_0x57d2('0x43')]);var _0x2fe0cd={'where':_0x3da926[_0x57d2('0x3e')]};return db[_0x57d2('0x2f')]['count'](_0x2fe0cd)['then'](function(_0x11a2ec){_0x3e017c[_0x57d2('0x1c')]=_0x11a2ec;if(_0x574589[_0x57d2('0x35')]['includeAll']){_0x3da926['include']=[{'all':!![]}];}return db[_0x57d2('0x2f')]['findAll'](_0x3da926);})[_0x57d2('0x24')](function(_0x1bb8ad){_0x3e017c[_0x57d2('0x44')]=_0x1bb8ad;return _0x3e017c;})[_0x57d2('0x24')](respondWithFilteredResult(_0x4e9178,_0x3da926))[_0x57d2('0x45')](handleError(_0x4e9178,null));};exports['show']=function(_0x13216b,_0x1c069a){var _0x53ab43={'raw':!![],'where':{'id':_0x13216b['params']['id']}},_0x775f8c={};_0x775f8c[_0x57d2('0x34')]=_[_0x57d2('0x36')](db[_0x57d2('0x2f')][_0x57d2('0x30')]);_0x775f8c['query']=_['keys'](_0x13216b[_0x57d2('0x35')]);_0x775f8c['filters']=_['intersection'](_0x775f8c[_0x57d2('0x34')],_0x775f8c['query']);_0x53ab43['attributes']=_[_0x57d2('0x38')](_0x775f8c['model'],qs[_0x57d2('0x3a')](_0x13216b['query'][_0x57d2('0x3a')]));_0x53ab43['attributes']=_0x53ab43['attributes'][_0x57d2('0x3b')]?_0x53ab43[_0x57d2('0x39')]:_0x775f8c[_0x57d2('0x34')];if(_0x13216b[_0x57d2('0x35')][_0x57d2('0x46')]){_0x53ab43[_0x57d2('0x47')]=[{'all':!![]}];}_0x53ab43=_['merge']({},_0x53ab43,_0x13216b[_0x57d2('0x43')]);return db[_0x57d2('0x2f')][_0x57d2('0x48')](_0x53ab43)[_0x57d2('0x24')](handleEntityNotFound(_0x1c069a,null))[_0x57d2('0x24')](respondWithResult(_0x1c069a,null))[_0x57d2('0x45')](handleError(_0x1c069a,null));};exports[_0x57d2('0x49')]=function(_0x406375,_0x51f172){return db[_0x57d2('0x2f')][_0x57d2('0x49')](_0x406375['body'],{})[_0x57d2('0x24')](function(_0x5b06f7){var _0x59a6eb=_0x406375[_0x57d2('0x4a')][_0x57d2('0x26')]({'plain':!![]});if(!_0x59a6eb)throw new Error(_0x57d2('0x4b'));if(_0x59a6eb[_0x57d2('0x4c')]==='user'){var _0x265d24=_0x5b06f7[_0x57d2('0x26')]({'plain':!![]});var _0x51b535='Voicemails';return db[_0x57d2('0x4d')][_0x57d2('0x48')]({'where':{'name':_0x51b535,'userProfileId':_0x59a6eb[_0x57d2('0x4e')]},'raw':!![]})[_0x57d2('0x24')](function(_0x3092c8){if(_0x3092c8&&_0x3092c8[_0x57d2('0x4f')]===0x0){return db['UserProfileResource']['create']({'name':_0x265d24['name'],'resourceId':_0x265d24['id'],'type':_0x3092c8[_0x57d2('0x2b')],'sectionId':_0x3092c8['id']},{})['then'](function(){return _0x5b06f7;});}else{return _0x5b06f7;}})[_0x57d2('0x45')](function(_0x2ef710){logger['error'](_0x57d2('0x50'),_0x2ef710);throw _0x2ef710;});}return _0x5b06f7;})[_0x57d2('0x24')](respondWithResult(_0x51f172,0xc9))[_0x57d2('0x45')](handleError(_0x51f172,null));};exports['update']=function(_0x10d4e5,_0x224b7d){if(_0x10d4e5[_0x57d2('0x51')]['id']){delete _0x10d4e5[_0x57d2('0x51')]['id'];}return db[_0x57d2('0x2f')][_0x57d2('0x48')]({'where':{'id':_0x10d4e5[_0x57d2('0x52')]['id']}})[_0x57d2('0x24')](handleEntityNotFound(_0x224b7d,null))[_0x57d2('0x24')](saveUpdates(_0x10d4e5['body'],null))[_0x57d2('0x24')](respondWithResult(_0x224b7d,null))[_0x57d2('0x45')](handleError(_0x224b7d,null));};exports[_0x57d2('0x25')]=function(_0x5e3289,_0x7b334f){return db[_0x57d2('0x2f')][_0x57d2('0x48')]({'where':{'id':_0x5e3289['params']['id']}})['then'](handleEntityNotFound(_0x7b334f,null))['then'](removeEntity(_0x7b334f,null))[_0x57d2('0x45')](handleError(_0x7b334f,null));};exports['getMessages']=function(_0x682542,_0x4cdae5,_0x3111a2){return db['VoiceMail'][_0x57d2('0x53')]({'where':{'id':_0x682542[_0x57d2('0x52')]['id']}})[_0x57d2('0x24')](handleEntityNotFound(_0x4cdae5,null))['then'](function(_0x5985e4){var _0xd5b87e;var _0x2c1710={},_0x3b57fa={};_0x3b57fa[_0x57d2('0x34')]=_[_0x57d2('0x36')](db[_0x57d2('0x54')]['rawAttributes']);_0x3b57fa['query']=_[_0x57d2('0x36')](_0x682542[_0x57d2('0x35')]);_0x3b57fa[_0x57d2('0x37')]=_[_0x57d2('0x38')](_0x3b57fa['model'],_0x3b57fa['query']);_0x2c1710[_0x57d2('0x39')]=_[_0x57d2('0x38')](_0x3b57fa['model'],qs[_0x57d2('0x3a')](_0x682542[_0x57d2('0x35')][_0x57d2('0x3a')]));_0x2c1710[_0x57d2('0x39')]=_0x2c1710['attributes']['length']?_0x2c1710['attributes']:_0x3b57fa['model'];if(!_0x682542[_0x57d2('0x35')][_0x57d2('0x3c')](_0x57d2('0x55'))){_0x2c1710[_0x57d2('0x1e')]=qs[_0x57d2('0x1e')](_0x682542[_0x57d2('0x35')][_0x57d2('0x1e')]);_0x2c1710['offset']=qs[_0x57d2('0x1d')](_0x682542['query'][_0x57d2('0x1d')]);}_0x2c1710['order']=qs[_0x57d2('0x3d')](_0x682542[_0x57d2('0x35')][_0x57d2('0x3d')]);_0x2c1710[_0x57d2('0x3e')]=qs[_0x57d2('0x37')](_[_0x57d2('0x3f')](_0x682542['query'],_0x3b57fa[_0x57d2('0x37')]));if(_0x682542[_0x57d2('0x35')][_0x57d2('0x40')]){_0x2c1710[_0x57d2('0x3e')]=_[_0x57d2('0x41')](_0x2c1710[_0x57d2('0x3e')],{'$or':_[_0x57d2('0x2e')](_0x2c1710[_0x57d2('0x39')],function(_0x10141e){var _0x59c4e4={};_0x59c4e4[_0x10141e]={'$like':'%'+_0x682542[_0x57d2('0x35')]['filter']+'%'};return _0x59c4e4;})});}_0x2c1710['where']=_['merge'](_0x2c1710[_0x57d2('0x3e')],{'mailboxuser':_0x5985e4['mailbox']});_0x2c1710=_[_0x57d2('0x41')]({},_0x2c1710,_0x682542[_0x57d2('0x43')]);return db['VoiceMailMessage'][_0x57d2('0x56')](_0x2c1710)[_0x57d2('0x24')](respondWithFilteredResult(_0x4cdae5,_0x2c1710));})[_0x57d2('0x45')](handleError(_0x4cdae5,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index ae46143..c8f93f3 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 _0x2698=['path','../../config/environment','./voiceMail.attributes','exports','voice_voicemail','context','lodash','util','../../config/logger','moment','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2698,0x13a));var _0x8269=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x2698[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x8269('0x0'));var util=require(_0x8269('0x1'));var logger=require(_0x8269('0x2'))('api');var moment=require(_0x8269('0x3'));var BPromise=require(_0x8269('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8269('0x5'));var rimraf=require('rimraf');var config=require(_0x8269('0x6'));var attributes=require(_0x8269('0x7'));module[_0x8269('0x8')]=function(_0x3871a2,_0x58f91d){return _0x3871a2['define']('VoiceMail',attributes,{'tableName':_0x8269('0x9'),'paranoid':![],'indexes':[{'name':'mailbox_context','fields':['mailbox',_0x8269('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2c3a=['api','moment','bluebird','path','rimraf','../../config/environment','./voiceMail.attributes','exports','define','VoiceMail','voice_voicemail','mailbox_context','context','lodash','../../config/logger'];(function(_0x49fe77,_0x1b924f){var _0x5f108d=function(_0x4b7edd){while(--_0x4b7edd){_0x49fe77['push'](_0x49fe77['shift']());}};_0x5f108d(++_0x1b924f);}(_0x2c3a,0x1ed));var _0xa2c3=function(_0x1bca24,_0x514635){_0x1bca24=_0x1bca24-0x0;var _0xcfbfce=_0x2c3a[_0x1bca24];return _0xcfbfce;};'use strict';var _=require(_0xa2c3('0x0'));var util=require('util');var logger=require(_0xa2c3('0x1'))(_0xa2c3('0x2'));var moment=require(_0xa2c3('0x3'));var BPromise=require(_0xa2c3('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa2c3('0x5'));var rimraf=require(_0xa2c3('0x6'));var config=require(_0xa2c3('0x7'));var attributes=require(_0xa2c3('0x8'));module[_0xa2c3('0x9')]=function(_0x2ff818,_0x2bef47){return _0x2ff818[_0xa2c3('0xa')](_0xa2c3('0xb'),attributes,{'tableName':_0xa2c3('0xc'),'paranoid':![],'indexes':[{'name':_0xa2c3('0xd'),'fields':['mailbox',_0xa2c3('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index 624c8cf..d5e1bf9 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 _0xf87d=['moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','VoiceMail,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','info','catch','lodash'];(function(_0x36bfdd,_0x425a87){var _0x2f60c0=function(_0x384135){while(--_0x384135){_0x36bfdd['push'](_0x36bfdd['shift']());}};_0x2f60c0(++_0x425a87);}(_0xf87d,0x167));var _0xdf87=function(_0x4c97dd,_0x576880){_0x4c97dd=_0x4c97dd-0x0;var _0xc6e31f=_0xf87d[_0x4c97dd];return _0xc6e31f;};'use strict';var _=require(_0xdf87('0x0'));var util=require('util');var moment=require(_0xdf87('0x1'));var BPromise=require('bluebird');var rs=require(_0xdf87('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdf87('0x3'))['db'];var utils=require(_0xdf87('0x4'));var logger=require('../../config/logger')(_0xdf87('0x5'));var config=require(_0xdf87('0x6'));var jayson=require(_0xdf87('0x7'));var client=jayson[_0xdf87('0x8')][_0xdf87('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1265ad,_0x243d52,_0x481d86){return new BPromise(function(_0x17f251,_0x206be8){return client[_0xdf87('0xa')](_0x1265ad,_0x481d86)['then'](function(_0x5c6a90){logger['info'](_0xdf87('0xb'),_0x243d52,'request\x20sent');logger[_0xdf87('0xc')]('VoiceMail,\x20%s,\x20%s,\x20%s',_0x243d52,_0xdf87('0xd'),JSON[_0xdf87('0xe')](_0x5c6a90));if(_0x5c6a90[_0xdf87('0xf')]){if(_0x5c6a90[_0xdf87('0xf')][_0xdf87('0x10')]===0x1f4){logger[_0xdf87('0xf')](_0xdf87('0xb'),_0x243d52,_0x5c6a90['error'][_0xdf87('0x11')]);return _0x206be8(_0x5c6a90[_0xdf87('0xf')]['message']);}logger['error'](_0xdf87('0xb'),_0x243d52,_0x5c6a90[_0xdf87('0xf')][_0xdf87('0x11')]);return _0x17f251(_0x5c6a90[_0xdf87('0xf')][_0xdf87('0x11')]);}else{logger[_0xdf87('0x12')](_0xdf87('0xb'),_0x243d52,_0xdf87('0xd'));_0x17f251(_0x5c6a90['result'][_0xdf87('0x11')]);}})[_0xdf87('0x13')](function(_0x28f23f){logger[_0xdf87('0xf')](_0xdf87('0xb'),_0x243d52,_0x28f23f);_0x206be8(_0x28f23f);});});} \ No newline at end of file +var _0x6e11=['VoiceMail,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info'];(function(_0x1036ae,_0x28832a){var _0x484aab=function(_0x12f73a){while(--_0x12f73a){_0x1036ae['push'](_0x1036ae['shift']());}};_0x484aab(++_0x28832a);}(_0x6e11,0xa2));var _0x16e1=function(_0x324012,_0x23f45f){_0x324012=_0x324012-0x0;var _0x435cf2=_0x6e11[_0x324012];return _0x435cf2;};'use strict';var _=require(_0x16e1('0x0'));var util=require(_0x16e1('0x1'));var moment=require(_0x16e1('0x2'));var BPromise=require(_0x16e1('0x3'));var rs=require(_0x16e1('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x16e1('0x5'));var logger=require(_0x16e1('0x6'))(_0x16e1('0x7'));var config=require('../../config/environment');var jayson=require(_0x16e1('0x8'));var client=jayson[_0x16e1('0x9')][_0x16e1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4c1c91,_0x136030,_0x247887){return new BPromise(function(_0x3bb3c9,_0x14eded){return client[_0x16e1('0xb')](_0x4c1c91,_0x247887)[_0x16e1('0xc')](function(_0x12ee5a){logger[_0x16e1('0xd')](_0x16e1('0xe'),_0x136030,_0x16e1('0xf'));logger[_0x16e1('0x10')]('VoiceMail,\x20%s,\x20%s,\x20%s',_0x136030,_0x16e1('0xf'),JSON['stringify'](_0x12ee5a));if(_0x12ee5a[_0x16e1('0x11')]){if(_0x12ee5a[_0x16e1('0x11')][_0x16e1('0x12')]===0x1f4){logger[_0x16e1('0x11')](_0x16e1('0xe'),_0x136030,_0x12ee5a[_0x16e1('0x11')][_0x16e1('0x13')]);return _0x14eded(_0x12ee5a['error'][_0x16e1('0x13')]);}logger[_0x16e1('0x11')](_0x16e1('0xe'),_0x136030,_0x12ee5a['error'][_0x16e1('0x13')]);return _0x3bb3c9(_0x12ee5a[_0x16e1('0x11')][_0x16e1('0x13')]);}else{logger[_0x16e1('0xd')](_0x16e1('0xe'),_0x136030,_0x16e1('0xf'));_0x3bb3c9(_0x12ee5a[_0x16e1('0x14')]['message']);}})[_0x16e1('0x15')](function(_0x2af7b0){logger[_0x16e1('0x11')](_0x16e1('0xe'),_0x136030,_0x2af7b0);_0x14eded(_0x2af7b0);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index 4c8038b..4f8bc93 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 _0xa6a3=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','get','isAuthenticated','index','/:id','show','/:id/download','download','post','create','put','update','delete','destroy'];(function(_0x34d397,_0x47e341){var _0x1c3ed5=function(_0x4bf839){while(--_0x4bf839){_0x34d397['push'](_0x34d397['shift']());}};_0x1c3ed5(++_0x47e341);}(_0xa6a3,0x142));var _0x3a6a=function(_0x24c24e,_0x1649a0){_0x24c24e=_0x24c24e-0x0;var _0x2b0732=_0xa6a3[_0x24c24e];return _0x2b0732;};'use strict';var multer=require(_0x3a6a('0x0'));var util=require(_0x3a6a('0x1'));var path=require(_0x3a6a('0x2'));var timeout=require(_0x3a6a('0x3'));var express=require(_0x3a6a('0x4'));var router=express[_0x3a6a('0x5')]();var fs_extra=require(_0x3a6a('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x3a6a('0x7'));var config=require(_0x3a6a('0x8'));var controller=require(_0x3a6a('0x9'));router[_0x3a6a('0xa')]('/',auth[_0x3a6a('0xb')](),controller[_0x3a6a('0xc')]);router['get'](_0x3a6a('0xd'),auth[_0x3a6a('0xb')](),controller[_0x3a6a('0xe')]);router[_0x3a6a('0xa')](_0x3a6a('0xf'),auth[_0x3a6a('0xb')](),controller[_0x3a6a('0x10')]);router[_0x3a6a('0x11')]('/',auth[_0x3a6a('0xb')](),controller[_0x3a6a('0x12')]);router[_0x3a6a('0x13')](_0x3a6a('0xd'),auth[_0x3a6a('0xb')](),controller[_0x3a6a('0x14')]);router[_0x3a6a('0x15')](_0x3a6a('0xd'),auth[_0x3a6a('0xb')](),controller[_0x3a6a('0x16')]);module['exports']=router; \ No newline at end of file +var _0x7b86=['post','put','update','/:id','destroy','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','show','isAuthenticated','download'];(function(_0x1ac85c,_0xdddd27){var _0x5b30a9=function(_0x530d6f){while(--_0x530d6f){_0x1ac85c['push'](_0x1ac85c['shift']());}};_0x5b30a9(++_0xdddd27);}(_0x7b86,0x72));var _0x67b8=function(_0xf3a03d,_0x5c3170){_0xf3a03d=_0xf3a03d-0x0;var _0x24b6e3=_0x7b86[_0xf3a03d];return _0x24b6e3;};'use strict';var multer=require('multer');var util=require(_0x67b8('0x0'));var path=require(_0x67b8('0x1'));var timeout=require(_0x67b8('0x2'));var express=require('express');var router=express[_0x67b8('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x67b8('0x4'));var interaction=require(_0x67b8('0x5'));var config=require(_0x67b8('0x6'));var controller=require('./voiceMailMessage.controller');router[_0x67b8('0x7')]('/',auth['isAuthenticated'](),controller[_0x67b8('0x8')]);router[_0x67b8('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x67b8('0x9')]);router[_0x67b8('0x7')]('/:id/download',auth[_0x67b8('0xa')](),controller[_0x67b8('0xb')]);router[_0x67b8('0xc')]('/',auth[_0x67b8('0xa')](),controller['create']);router[_0x67b8('0xd')]('/:id',auth[_0x67b8('0xa')](),controller[_0x67b8('0xe')]);router['delete'](_0x67b8('0xf'),auth[_0x67b8('0xa')](),controller[_0x67b8('0x10')]);module[_0x67b8('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index b30a046..b058c36 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 _0xf44d=['VIRTUAL','getDataValue','STRING','BLOB','TIMESTAMP','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP'];(function(_0x2209b4,_0x8cb08){var _0x5636ae=function(_0x3347dc){while(--_0x3347dc){_0x2209b4['push'](_0x2209b4['shift']());}};_0x5636ae(++_0x8cb08);}(_0xf44d,0x19d));var _0xdf44=function(_0x40de6f,_0x34678d){_0x40de6f=_0x40de6f-0x0;var _0x5504a4=_0xf44d[_0x40de6f];return _0x5504a4;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xdf44('0x0')],'get':function(_0x579ebb){return this[_0xdf44('0x1')]('id');}},'msgnum':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0xdf44('0x2')],'defaultValue':''},'context':{'type':Sequelize[_0xdf44('0x2')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0xdf44('0x2')],'defaultValue':''},'callerid':{'type':Sequelize[_0xdf44('0x2')],'defaultValue':''},'origtime':{'type':Sequelize[_0xdf44('0x2')],'defaultValue':''},'duration':{'type':Sequelize[_0xdf44('0x2')],'defaultValue':''},'mailboxuser':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxcontext':{'type':Sequelize['STRING'],'defaultValue':''},'recording':{'type':Sequelize[_0xdf44('0x3')]('long'),'defaultValue':null},'flag':{'type':Sequelize[_0xdf44('0x2')],'defaultValue':''},'msg_id':{'type':Sequelize[_0xdf44('0x2')],'defaultValue':''},'stamp':{'type':_0xdf44('0x4'),'defaultValue':Sequelize[_0xdf44('0x5')](_0xdf44('0x6'))}}; \ No newline at end of file +var _0x83bf=['INTEGER','STRING','BLOB','TIMESTAMP','literal','exports','VIRTUAL','getDataValue'];(function(_0x4f89ff,_0x5e466b){var _0x42f34c=function(_0x2806d6){while(--_0x2806d6){_0x4f89ff['push'](_0x4f89ff['shift']());}};_0x42f34c(++_0x5e466b);}(_0x83bf,0x1ed));var _0xf83b=function(_0x2b80f8,_0x22c850){_0x2b80f8=_0x2b80f8-0x0;var _0x5ed6b8=_0x83bf[_0x2b80f8];return _0x5ed6b8;};'use strict';var Sequelize=require('sequelize');module[_0xf83b('0x0')]={'name':{'type':Sequelize[_0xf83b('0x1')],'get':function(_0x30e5d3){return this[_0xf83b('0x2')]('id');}},'msgnum':{'type':Sequelize[_0xf83b('0x3')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0xf83b('0x4')],'defaultValue':''},'context':{'type':Sequelize['STRING'],'defaultValue':''},'macrocontext':{'type':Sequelize[_0xf83b('0x4')],'defaultValue':''},'callerid':{'type':Sequelize[_0xf83b('0x4')],'defaultValue':''},'origtime':{'type':Sequelize['STRING'],'defaultValue':''},'duration':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0xf83b('0x4')],'defaultValue':''},'mailboxcontext':{'type':Sequelize['STRING'],'defaultValue':''},'recording':{'type':Sequelize[_0xf83b('0x5')]('long'),'defaultValue':null},'flag':{'type':Sequelize[_0xf83b('0x4')],'defaultValue':''},'msg_id':{'type':Sequelize[_0xf83b('0x4')],'defaultValue':''},'stamp':{'type':_0xf83b('0x6'),'defaultValue':Sequelize[_0xf83b('0x7')]('CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP')}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index ddcec47..3ecb969 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 _0x5786=['sendStatus','error','stack','name','index','VoiceMailMessage','fieldName','type','key','differenceBy','map','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','rawAttributes','include','create','body','find','download','recording','msg_id','Sequelize','VoiceMailMessage\x20not\x20found','attachment','attachment;\x20filename=\x22','.wav\x22','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','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','status','end','json','offset','undefined','count','set','apply','reject','update','then','destroy'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x5786,0x187));var _0x6578=function(_0x1c176e,_0x18c876){_0x1c176e=_0x1c176e-0x0;var _0x1054d1=_0x5786[_0x1c176e];return _0x1054d1;};'use strict';var emlformat=require(_0x6578('0x0'));var rimraf=require(_0x6578('0x1'));var zipdir=require(_0x6578('0x2'));var jsonpatch=require(_0x6578('0x3'));var rp=require(_0x6578('0x4'));var moment=require(_0x6578('0x5'));var BPromise=require(_0x6578('0x6'));var Mustache=require(_0x6578('0x7'));var util=require(_0x6578('0x8'));var path=require(_0x6578('0x9'));var sox=require(_0x6578('0xa'));var csv=require(_0x6578('0xb'));var ejs=require(_0x6578('0xc'));var fs=require('fs');var fs_extra=require(_0x6578('0xd'));var _=require(_0x6578('0xe'));var squel=require(_0x6578('0xf'));var crypto=require(_0x6578('0x10'));var jsforce=require(_0x6578('0x11'));var deskjs=require('desk.js');var toCsv=require(_0x6578('0xb'));var querystring=require(_0x6578('0x12'));var Papa=require(_0x6578('0x13'));var Redis=require('ioredis');var authService=require(_0x6578('0x14'));var qs=require(_0x6578('0x15'));var as=require(_0x6578('0x16'));var hardwareService=require(_0x6578('0x17'));var logger=require(_0x6578('0x18'))('api');var utils=require(_0x6578('0x19'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x6578('0x1a'))['db'];function respondWithStatusCode(_0x393436,_0x4cb2d1){_0x4cb2d1=_0x4cb2d1||0xcc;return function(_0x196b5b){if(_0x196b5b){return _0x393436['sendStatus'](_0x4cb2d1);}return _0x393436[_0x6578('0x1b')](_0x4cb2d1)[_0x6578('0x1c')]();};}function respondWithResult(_0x5ea0bf,_0x499abf){_0x499abf=_0x499abf||0xc8;return function(_0x1fc2bd){if(_0x1fc2bd){return _0x5ea0bf[_0x6578('0x1b')](_0x499abf)[_0x6578('0x1d')](_0x1fc2bd);}};}function respondWithFilteredResult(_0xeef189,_0x3bc2d1){return function(_0x39d58e){if(_0x39d58e){var _0x148e36=typeof _0x3bc2d1[_0x6578('0x1e')]===_0x6578('0x1f')&&typeof _0x3bc2d1['limit']===_0x6578('0x1f');var _0xb4d77f=_0x39d58e[_0x6578('0x20')];var _0x629f45=_0x148e36?0x0:_0x3bc2d1[_0x6578('0x1e')];var _0x3d76f8=_0x148e36?_0x39d58e[_0x6578('0x20')]:_0x3bc2d1['offset']+_0x3bc2d1['limit'];var _0x1e08f9;if(_0x3d76f8>=_0xb4d77f){_0x3d76f8=_0xb4d77f;_0x1e08f9=0xc8;}else{_0x1e08f9=0xce;}_0xeef189['status'](_0x1e08f9);return _0xeef189[_0x6578('0x21')]('Content-Range',_0x629f45+'-'+_0x3d76f8+'/'+_0xb4d77f)[_0x6578('0x1d')](_0x39d58e);}return null;};}function patchUpdates(_0x2e1c4a){return function(_0x53da81){try{jsonpatch[_0x6578('0x22')](_0x53da81,_0x2e1c4a,!![]);}catch(_0x30d0a5){return BPromise[_0x6578('0x23')](_0x30d0a5);}return _0x53da81['save']();};}function saveUpdates(_0xd5e6c7,_0x16581f){return function(_0x532237){if(_0x532237){return _0x532237[_0x6578('0x24')](_0xd5e6c7)[_0x6578('0x25')](function(_0x3b6e6c){return _0x3b6e6c;});}return null;};}function removeEntity(_0xfd738e,_0x446b53){return function(_0x3e420e){if(_0x3e420e){return _0x3e420e[_0x6578('0x26')]()[_0x6578('0x25')](function(){_0xfd738e[_0x6578('0x1b')](0xcc)[_0x6578('0x1c')]();});}};}function handleEntityNotFound(_0x2fc9cc,_0x2b5866){return function(_0x5367b8){if(!_0x5367b8){_0x2fc9cc[_0x6578('0x27')](0x194);}return _0x5367b8;};}function handleError(_0x324c50,_0x50f7fe){_0x50f7fe=_0x50f7fe||0x1f4;return function(_0xc2ee70){logger[_0x6578('0x28')](_0xc2ee70[_0x6578('0x29')]);if(_0xc2ee70[_0x6578('0x2a')]){delete _0xc2ee70['name'];}_0x324c50[_0x6578('0x1b')](_0x50f7fe)['send'](_0xc2ee70);};}exports[_0x6578('0x2b')]=function(_0x4e36bd,_0x40bbc8){var _0xcdc40b={},_0xc849c8={},_0x13fc67={'count':0x0,'rows':[]};var _0x158eeb=_['map'](db[_0x6578('0x2c')]['rawAttributes'],function(_0x15f0ff){return{'name':_0x15f0ff[_0x6578('0x2d')],'type':_0x15f0ff[_0x6578('0x2e')][_0x6578('0x2f')]};});_0xc849c8['model']=_[_0x6578('0x30')](_[_0x6578('0x31')](_0x158eeb,_0x6578('0x2a')),['name']);_0xc849c8['query']=_[_0x6578('0x32')](_0x4e36bd[_0x6578('0x33')]);_0xc849c8[_0x6578('0x34')]=_[_0x6578('0x35')](_0xc849c8[_0x6578('0x36')],_0xc849c8[_0x6578('0x33')]);_0xcdc40b[_0x6578('0x37')]=_['intersection'](_0xc849c8['model'],qs[_0x6578('0x38')](_0x4e36bd['query'][_0x6578('0x38')]));_0xcdc40b[_0x6578('0x37')]=_0xcdc40b[_0x6578('0x37')][_0x6578('0x39')]?_0xcdc40b[_0x6578('0x37')]:_0xc849c8['model'];if(!_0x4e36bd[_0x6578('0x33')][_0x6578('0x3a')](_0x6578('0x3b'))){_0xcdc40b['limit']=qs[_0x6578('0x3c')](_0x4e36bd['query']['limit']);_0xcdc40b[_0x6578('0x1e')]=qs[_0x6578('0x1e')](_0x4e36bd[_0x6578('0x33')][_0x6578('0x1e')]);}_0xcdc40b['order']=qs[_0x6578('0x3d')](_0x4e36bd[_0x6578('0x33')][_0x6578('0x3d')]);_0xcdc40b[_0x6578('0x3e')]=qs[_0x6578('0x34')](_['pick'](_0x4e36bd['query'],_0xc849c8[_0x6578('0x34')]),_0x158eeb);if(_0x4e36bd[_0x6578('0x33')][_0x6578('0x3f')]){_0xcdc40b['where']=_[_0x6578('0x40')](_0xcdc40b[_0x6578('0x3e')],{'$or':_[_0x6578('0x31')](_0x158eeb,function(_0x13271a){if(_0x13271a[_0x6578('0x2e')]!==_0x6578('0x41')){var _0x22234c={};_0x22234c[_0x13271a[_0x6578('0x2a')]]={'$like':'%'+_0x4e36bd[_0x6578('0x33')][_0x6578('0x3f')]+'%'};return _0x22234c;}})});}_0xcdc40b=_['merge']({},_0xcdc40b,_0x4e36bd[_0x6578('0x42')]);var _0x26255b={'where':_0xcdc40b[_0x6578('0x3e')]};return db[_0x6578('0x2c')][_0x6578('0x20')](_0x26255b)[_0x6578('0x25')](function(_0x4740a9){_0x13fc67[_0x6578('0x20')]=_0x4740a9;if(_0x4e36bd[_0x6578('0x33')][_0x6578('0x43')]){_0xcdc40b['include']=[{'all':!![]}];}return db[_0x6578('0x2c')][_0x6578('0x44')](_0xcdc40b);})[_0x6578('0x25')](function(_0x32165d){_0x13fc67[_0x6578('0x45')]=_0x32165d;return _0x13fc67;})[_0x6578('0x25')](respondWithFilteredResult(_0x40bbc8,_0xcdc40b))[_0x6578('0x46')](handleError(_0x40bbc8,null));};exports[_0x6578('0x47')]=function(_0x584532,_0x4cc018){var _0x3a0f6a={'raw':!![],'where':{'id':_0x584532[_0x6578('0x48')]['id']}},_0x14a9c1={};_0x14a9c1[_0x6578('0x36')]=_[_0x6578('0x32')](db['VoiceMailMessage'][_0x6578('0x49')]);_0x14a9c1[_0x6578('0x33')]=_['keys'](_0x584532[_0x6578('0x33')]);_0x14a9c1[_0x6578('0x34')]=_['intersection'](_0x14a9c1[_0x6578('0x36')],_0x14a9c1[_0x6578('0x33')]);_0x3a0f6a[_0x6578('0x37')]=_[_0x6578('0x35')](_0x14a9c1[_0x6578('0x36')],qs[_0x6578('0x38')](_0x584532[_0x6578('0x33')]['fields']));_0x3a0f6a[_0x6578('0x37')]=_0x3a0f6a[_0x6578('0x37')][_0x6578('0x39')]?_0x3a0f6a[_0x6578('0x37')]:_0x14a9c1[_0x6578('0x36')];if(_0x584532[_0x6578('0x33')][_0x6578('0x43')]){_0x3a0f6a[_0x6578('0x4a')]=[{'all':!![]}];}_0x3a0f6a=_['merge']({},_0x3a0f6a,_0x584532[_0x6578('0x42')]);return db[_0x6578('0x2c')]['find'](_0x3a0f6a)[_0x6578('0x25')](handleEntityNotFound(_0x4cc018,null))[_0x6578('0x25')](respondWithResult(_0x4cc018,null))[_0x6578('0x46')](handleError(_0x4cc018,null));};exports[_0x6578('0x4b')]=function(_0x2f82c6,_0x10f1fb){return db['VoiceMailMessage'][_0x6578('0x4b')](_0x2f82c6['body'],{})['then'](respondWithResult(_0x10f1fb,0xc9))[_0x6578('0x46')](handleError(_0x10f1fb,null));};exports['update']=function(_0x393390,_0x591596){if(_0x393390[_0x6578('0x4c')]['id']){delete _0x393390[_0x6578('0x4c')]['id'];}return db[_0x6578('0x2c')][_0x6578('0x4d')]({'where':{'id':_0x393390[_0x6578('0x48')]['id']}})[_0x6578('0x25')](handleEntityNotFound(_0x591596,null))['then'](saveUpdates(_0x393390[_0x6578('0x4c')],null))[_0x6578('0x25')](respondWithResult(_0x591596,null))[_0x6578('0x46')](handleError(_0x591596,null));};exports[_0x6578('0x26')]=function(_0x323152,_0x34ef83){return db[_0x6578('0x2c')]['find']({'where':{'id':_0x323152[_0x6578('0x48')]['id']}})[_0x6578('0x25')](handleEntityNotFound(_0x34ef83,null))[_0x6578('0x25')](removeEntity(_0x34ef83,null))[_0x6578('0x46')](handleError(_0x34ef83,null));};exports[_0x6578('0x4e')]=function(_0x50868f,_0x5d3b22,_0x81ee95){return db['VoiceMailMessage'][_0x6578('0x4d')]({'where':{'id':_0x50868f[_0x6578('0x48')]['id']},'attributes':['id',_0x6578('0x4f'),_0x6578('0x50')]})[_0x6578('0x25')](handleEntityNotFound(_0x5d3b22,null))[_0x6578('0x25')](function(_0x22b7c3){if(_0x22b7c3){if(!_0x22b7c3[_0x6578('0x4f')]){throw new db[(_0x6578('0x51'))]['ValidationError'](_0x6578('0x52'));}var _0x4d5991={'Content-Type':'audio/wav','Content-Disposition':_0x6578('0x53')};if(_0x22b7c3['msg_id']){_0x4d5991['Content-Disposition']=_0x6578('0x54')+_0x22b7c3[_0x6578('0x50')]+_0x6578('0x55');}_0x5d3b22[_0x6578('0x21')](_0x4d5991);return _0x5d3b22['send'](new Buffer(_0x22b7c3['recording']));}})['catch'](handleError(_0x5d3b22,null));}; \ No newline at end of file +var _0xcc8f=['VoiceMailMessage','rawAttributes','fieldName','type','model','query','keys','intersection','fields','nolimit','sort','where','pick','filters','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','attributes','length','find','catch','create','body','download','msg_id','recording','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','attachment','Content-Disposition','.wav\x22','send','rimraf','fast-json-patch','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','crypto','desk.js','to-csv','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','json','offset','limit','undefined','count','status','set','apply','save','update','then','destroy','stack','name','index','map'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0xcc8f,0x164));var _0xfcc8=function(_0x1692b5,_0x1b68bc){_0x1692b5=_0x1692b5-0x0;var _0xf2c892=_0xcc8f[_0x1692b5];return _0xf2c892;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfcc8('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xfcc8('0x1'));var rp=require('request-promise');var moment=require(_0xfcc8('0x2'));var BPromise=require(_0xfcc8('0x3'));var Mustache=require('mustache');var util=require(_0xfcc8('0x4'));var path=require(_0xfcc8('0x5'));var sox=require(_0xfcc8('0x6'));var csv=require('to-csv');var ejs=require(_0xfcc8('0x7'));var fs=require('fs');var fs_extra=require(_0xfcc8('0x8'));var _=require(_0xfcc8('0x9'));var squel=require('squel');var crypto=require(_0xfcc8('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xfcc8('0xb'));var toCsv=require(_0xfcc8('0xc'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xfcc8('0xd'));var qs=require(_0xfcc8('0xe'));var as=require(_0xfcc8('0xf'));var hardwareService=require(_0xfcc8('0x10'));var logger=require(_0xfcc8('0x11'))(_0xfcc8('0x12'));var utils=require(_0xfcc8('0x13'));var config=require(_0xfcc8('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xfcc8('0x15'))['db'];function respondWithStatusCode(_0x16c5bb,_0x5e3e59){_0x5e3e59=_0x5e3e59||0xcc;return function(_0x883f34){if(_0x883f34){return _0x16c5bb[_0xfcc8('0x16')](_0x5e3e59);}return _0x16c5bb['status'](_0x5e3e59)['end']();};}function respondWithResult(_0x41cedb,_0x30adb5){_0x30adb5=_0x30adb5||0xc8;return function(_0x43f9b){if(_0x43f9b){return _0x41cedb['status'](_0x30adb5)[_0xfcc8('0x17')](_0x43f9b);}};}function respondWithFilteredResult(_0x426950,_0x1d503f){return function(_0x708bf4){if(_0x708bf4){var _0x4d53b8=typeof _0x1d503f[_0xfcc8('0x18')]==='undefined'&&typeof _0x1d503f[_0xfcc8('0x19')]===_0xfcc8('0x1a');var _0x311d07=_0x708bf4[_0xfcc8('0x1b')];var _0x314003=_0x4d53b8?0x0:_0x1d503f[_0xfcc8('0x18')];var _0x366673=_0x4d53b8?_0x708bf4['count']:_0x1d503f['offset']+_0x1d503f['limit'];var _0x274082;if(_0x366673>=_0x311d07){_0x366673=_0x311d07;_0x274082=0xc8;}else{_0x274082=0xce;}_0x426950[_0xfcc8('0x1c')](_0x274082);return _0x426950[_0xfcc8('0x1d')]('Content-Range',_0x314003+'-'+_0x366673+'/'+_0x311d07)['json'](_0x708bf4);}return null;};}function patchUpdates(_0x4ad7dd){return function(_0x2034c1){try{jsonpatch[_0xfcc8('0x1e')](_0x2034c1,_0x4ad7dd,!![]);}catch(_0x4331f2){return BPromise['reject'](_0x4331f2);}return _0x2034c1[_0xfcc8('0x1f')]();};}function saveUpdates(_0x9aaa2e,_0x35d3c6){return function(_0x145086){if(_0x145086){return _0x145086[_0xfcc8('0x20')](_0x9aaa2e)[_0xfcc8('0x21')](function(_0x41e070){return _0x41e070;});}return null;};}function removeEntity(_0x109bf1,_0x4cf271){return function(_0x3a9a90){if(_0x3a9a90){return _0x3a9a90[_0xfcc8('0x22')]()[_0xfcc8('0x21')](function(){_0x109bf1[_0xfcc8('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x225b65,_0x2b84aa){return function(_0x5bd4fc){if(!_0x5bd4fc){_0x225b65['sendStatus'](0x194);}return _0x5bd4fc;};}function handleError(_0x5d2b9f,_0x51207e){_0x51207e=_0x51207e||0x1f4;return function(_0x43b561){logger['error'](_0x43b561[_0xfcc8('0x23')]);if(_0x43b561[_0xfcc8('0x24')]){delete _0x43b561[_0xfcc8('0x24')];}_0x5d2b9f['status'](_0x51207e)['send'](_0x43b561);};}exports[_0xfcc8('0x25')]=function(_0x24f560,_0x5f28ed){var _0x3ad2dd={},_0x2f91fd={},_0x4fccd7={'count':0x0,'rows':[]};var _0x35319b=_[_0xfcc8('0x26')](db[_0xfcc8('0x27')][_0xfcc8('0x28')],function(_0x416e85){return{'name':_0x416e85[_0xfcc8('0x29')],'type':_0x416e85[_0xfcc8('0x2a')]['key']};});_0x2f91fd[_0xfcc8('0x2b')]=_['differenceBy'](_[_0xfcc8('0x26')](_0x35319b,'name'),[_0xfcc8('0x24')]);_0x2f91fd[_0xfcc8('0x2c')]=_[_0xfcc8('0x2d')](_0x24f560['query']);_0x2f91fd['filters']=_[_0xfcc8('0x2e')](_0x2f91fd[_0xfcc8('0x2b')],_0x2f91fd[_0xfcc8('0x2c')]);_0x3ad2dd['attributes']=_[_0xfcc8('0x2e')](_0x2f91fd[_0xfcc8('0x2b')],qs[_0xfcc8('0x2f')](_0x24f560[_0xfcc8('0x2c')][_0xfcc8('0x2f')]));_0x3ad2dd['attributes']=_0x3ad2dd['attributes']['length']?_0x3ad2dd['attributes']:_0x2f91fd[_0xfcc8('0x2b')];if(!_0x24f560[_0xfcc8('0x2c')]['hasOwnProperty'](_0xfcc8('0x30'))){_0x3ad2dd['limit']=qs['limit'](_0x24f560['query'][_0xfcc8('0x19')]);_0x3ad2dd[_0xfcc8('0x18')]=qs[_0xfcc8('0x18')](_0x24f560[_0xfcc8('0x2c')][_0xfcc8('0x18')]);}_0x3ad2dd['order']=qs[_0xfcc8('0x31')](_0x24f560[_0xfcc8('0x2c')][_0xfcc8('0x31')]);_0x3ad2dd[_0xfcc8('0x32')]=qs['filters'](_[_0xfcc8('0x33')](_0x24f560[_0xfcc8('0x2c')],_0x2f91fd[_0xfcc8('0x34')]),_0x35319b);if(_0x24f560[_0xfcc8('0x2c')][_0xfcc8('0x35')]){_0x3ad2dd['where']=_[_0xfcc8('0x36')](_0x3ad2dd[_0xfcc8('0x32')],{'$or':_[_0xfcc8('0x26')](_0x35319b,function(_0x23c6fa){if(_0x23c6fa[_0xfcc8('0x2a')]!==_0xfcc8('0x37')){var _0x424340={};_0x424340[_0x23c6fa[_0xfcc8('0x24')]]={'$like':'%'+_0x24f560['query']['filter']+'%'};return _0x424340;}})});}_0x3ad2dd=_[_0xfcc8('0x36')]({},_0x3ad2dd,_0x24f560['options']);var _0x55acb7={'where':_0x3ad2dd['where']};return db[_0xfcc8('0x27')][_0xfcc8('0x1b')](_0x55acb7)[_0xfcc8('0x21')](function(_0x11a179){_0x4fccd7[_0xfcc8('0x1b')]=_0x11a179;if(_0x24f560[_0xfcc8('0x2c')][_0xfcc8('0x38')]){_0x3ad2dd[_0xfcc8('0x39')]=[{'all':!![]}];}return db[_0xfcc8('0x27')][_0xfcc8('0x3a')](_0x3ad2dd);})[_0xfcc8('0x21')](function(_0x5a8ed0){_0x4fccd7[_0xfcc8('0x3b')]=_0x5a8ed0;return _0x4fccd7;})[_0xfcc8('0x21')](respondWithFilteredResult(_0x5f28ed,_0x3ad2dd))['catch'](handleError(_0x5f28ed,null));};exports[_0xfcc8('0x3c')]=function(_0x330097,_0xe181a){var _0x41a76b={'raw':!![],'where':{'id':_0x330097[_0xfcc8('0x3d')]['id']}},_0x213db2={};_0x213db2[_0xfcc8('0x2b')]=_['keys'](db['VoiceMailMessage'][_0xfcc8('0x28')]);_0x213db2[_0xfcc8('0x2c')]=_['keys'](_0x330097['query']);_0x213db2[_0xfcc8('0x34')]=_[_0xfcc8('0x2e')](_0x213db2[_0xfcc8('0x2b')],_0x213db2['query']);_0x41a76b['attributes']=_[_0xfcc8('0x2e')](_0x213db2[_0xfcc8('0x2b')],qs[_0xfcc8('0x2f')](_0x330097['query'][_0xfcc8('0x2f')]));_0x41a76b['attributes']=_0x41a76b[_0xfcc8('0x3e')][_0xfcc8('0x3f')]?_0x41a76b['attributes']:_0x213db2['model'];if(_0x330097[_0xfcc8('0x2c')]['includeAll']){_0x41a76b['include']=[{'all':!![]}];}_0x41a76b=_[_0xfcc8('0x36')]({},_0x41a76b,_0x330097['options']);return db[_0xfcc8('0x27')][_0xfcc8('0x40')](_0x41a76b)['then'](handleEntityNotFound(_0xe181a,null))[_0xfcc8('0x21')](respondWithResult(_0xe181a,null))[_0xfcc8('0x41')](handleError(_0xe181a,null));};exports[_0xfcc8('0x42')]=function(_0x43c942,_0x58000d){return db[_0xfcc8('0x27')][_0xfcc8('0x42')](_0x43c942[_0xfcc8('0x43')],{})['then'](respondWithResult(_0x58000d,0xc9))[_0xfcc8('0x41')](handleError(_0x58000d,null));};exports[_0xfcc8('0x20')]=function(_0x533351,_0x1da41e){if(_0x533351[_0xfcc8('0x43')]['id']){delete _0x533351[_0xfcc8('0x43')]['id'];}return db[_0xfcc8('0x27')][_0xfcc8('0x40')]({'where':{'id':_0x533351[_0xfcc8('0x3d')]['id']}})[_0xfcc8('0x21')](handleEntityNotFound(_0x1da41e,null))[_0xfcc8('0x21')](saveUpdates(_0x533351[_0xfcc8('0x43')],null))['then'](respondWithResult(_0x1da41e,null))[_0xfcc8('0x41')](handleError(_0x1da41e,null));};exports[_0xfcc8('0x22')]=function(_0x9cb54c,_0x42350b){return db['VoiceMailMessage'][_0xfcc8('0x40')]({'where':{'id':_0x9cb54c['params']['id']}})['then'](handleEntityNotFound(_0x42350b,null))[_0xfcc8('0x21')](removeEntity(_0x42350b,null))[_0xfcc8('0x41')](handleError(_0x42350b,null));};exports[_0xfcc8('0x44')]=function(_0x2acc02,_0x4cb452,_0x5ea9be){return db[_0xfcc8('0x27')][_0xfcc8('0x40')]({'where':{'id':_0x2acc02[_0xfcc8('0x3d')]['id']},'attributes':['id','recording',_0xfcc8('0x45')]})['then'](handleEntityNotFound(_0x4cb452,null))[_0xfcc8('0x21')](function(_0x16b5ed){if(_0x16b5ed){if(!_0x16b5ed[_0xfcc8('0x46')]){throw new db[(_0xfcc8('0x47'))][(_0xfcc8('0x48'))](_0xfcc8('0x49'));}var _0x383758={'Content-Type':_0xfcc8('0x4a'),'Content-Disposition':_0xfcc8('0x4b')};if(_0x16b5ed[_0xfcc8('0x45')]){_0x383758[_0xfcc8('0x4c')]='attachment;\x20filename=\x22'+_0x16b5ed[_0xfcc8('0x45')]+_0xfcc8('0x4d');}_0x4cb452[_0xfcc8('0x1d')](_0x383758);return _0x4cb452[_0xfcc8('0x4e')](new Buffer(_0x16b5ed[_0xfcc8('0x46')]));}})[_0xfcc8('0x41')](handleError(_0x4cb452,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index 3888734..95ef535 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 _0xb838=['request-promise','path','rimraf','../../config/environment','./voiceMailMessage.attributes','define','dir','lodash','../../config/logger','api','moment'];(function(_0xb8202c,_0x5a8b6c){var _0x57f77d=function(_0x4e92d8){while(--_0x4e92d8){_0xb8202c['push'](_0xb8202c['shift']());}};_0x57f77d(++_0x5a8b6c);}(_0xb838,0xd8));var _0x8b83=function(_0x3fd0a7,_0x4d6128){_0x3fd0a7=_0x3fd0a7-0x0;var _0x387d08=_0xb838[_0x3fd0a7];return _0x387d08;};'use strict';var _=require(_0x8b83('0x0'));var util=require('util');var logger=require(_0x8b83('0x1'))(_0x8b83('0x2'));var moment=require(_0x8b83('0x3'));var BPromise=require('bluebird');var rp=require(_0x8b83('0x4'));var fs=require('fs');var path=require(_0x8b83('0x5'));var rimraf=require(_0x8b83('0x6'));var config=require(_0x8b83('0x7'));var attributes=require(_0x8b83('0x8'));module['exports']=function(_0xc15f5,_0x1952b9){return _0xc15f5[_0x8b83('0x9')]('VoiceMailMessage',attributes,{'tableName':'voice_voicemail_messages','paranoid':![],'indexes':[{'name':_0x8b83('0xa'),'fields':['dir']}],'timestamps':![]});}; \ No newline at end of file +var _0x90a5=['request-promise','rimraf','define','voice_voicemail_messages','lodash','util','../../config/logger','api','bluebird'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x90a5,0x12d));var _0x590a=function(_0x579ccf,_0x422fe2){_0x579ccf=_0x579ccf-0x0;var _0xe25624=_0x90a5[_0x579ccf];return _0xe25624;};'use strict';var _=require(_0x590a('0x0'));var util=require(_0x590a('0x1'));var logger=require(_0x590a('0x2'))(_0x590a('0x3'));var moment=require('moment');var BPromise=require(_0x590a('0x4'));var rp=require(_0x590a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x590a('0x6'));var config=require('../../config/environment');var attributes=require('./voiceMailMessage.attributes');module['exports']=function(_0x359bf2,_0x390ce5){return _0x359bf2[_0x590a('0x7')]('VoiceMailMessage',attributes,{'tableName':_0x590a('0x8'),'paranoid':![],'indexes':[{'name':'dir','fields':['dir']}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index e5111aa..b00193a 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 _0x844c=['rpc','jayson/promise','request','info','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','code','error','VoiceMailMessage,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x217090,_0x647b59){var _0x5dee10=function(_0x56285b){while(--_0x56285b){_0x217090['push'](_0x217090['shift']());}};_0x5dee10(++_0x647b59);}(_0x844c,0x1f0));var _0xc844=function(_0x130719,_0x2a7018){_0x130719=_0x130719-0x0;var _0x159865=_0x844c[_0x130719];return _0x159865;};'use strict';var _=require(_0xc844('0x0'));var util=require('util');var moment=require(_0xc844('0x1'));var BPromise=require(_0xc844('0x2'));var rs=require(_0xc844('0x3'));var fs=require('fs');var Redis=require(_0xc844('0x4'));var db=require(_0xc844('0x5'))['db'];var utils=require(_0xc844('0x6'));var logger=require(_0xc844('0x7'))(_0xc844('0x8'));var config=require('../../config/environment');var jayson=require(_0xc844('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x51ff33,_0x30e852,_0x4fb8cf){return new BPromise(function(_0x410ca1,_0x18a0e0){return client[_0xc844('0xa')](_0x51ff33,_0x4fb8cf)['then'](function(_0x4910c6){logger[_0xc844('0xb')]('VoiceMailMessage,\x20%s,\x20%s',_0x30e852,'request\x20sent');logger[_0xc844('0xc')](_0xc844('0xd'),_0x30e852,_0xc844('0xe'),JSON['stringify'](_0x4910c6));if(_0x4910c6['error']){if(_0x4910c6['error'][_0xc844('0xf')]===0x1f4){logger[_0xc844('0x10')](_0xc844('0x11'),_0x30e852,_0x4910c6['error']['message']);return _0x18a0e0(_0x4910c6[_0xc844('0x10')][_0xc844('0x12')]);}logger[_0xc844('0x10')](_0xc844('0x11'),_0x30e852,_0x4910c6[_0xc844('0x10')]['message']);return _0x410ca1(_0x4910c6[_0xc844('0x10')][_0xc844('0x12')]);}else{logger['info'](_0xc844('0x11'),_0x30e852,_0xc844('0xe'));_0x410ca1(_0x4910c6[_0xc844('0x13')][_0xc844('0x12')]);}})[_0xc844('0x14')](function(_0x3109bc){logger['error'](_0xc844('0x11'),_0x30e852,_0x3109bc);_0x18a0e0(_0x3109bc);});});} \ No newline at end of file +var _0xe885=['VoiceMailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','VoiceMailMessage,\x20%s,\x20%s','debug'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe885,0xa1));var _0x5e88=function(_0xb0770b,_0x4ea51a){_0xb0770b=_0xb0770b-0x0;var _0x159d84=_0xe885[_0xb0770b];return _0x159d84;};'use strict';var _=require('lodash');var util=require(_0x5e88('0x0'));var moment=require(_0x5e88('0x1'));var BPromise=require(_0x5e88('0x2'));var rs=require(_0x5e88('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5e88('0x4'))['db'];var utils=require(_0x5e88('0x5'));var logger=require('../../config/logger')(_0x5e88('0x6'));var config=require(_0x5e88('0x7'));var jayson=require(_0x5e88('0x8'));var client=jayson[_0x5e88('0x9')][_0x5e88('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x45b879,_0x531d32,_0x120080){return new BPromise(function(_0x4dcaaa,_0x3a86f4){return client['request'](_0x45b879,_0x120080)[_0x5e88('0xb')](function(_0x27ad6b){logger[_0x5e88('0xc')](_0x5e88('0xd'),_0x531d32,'request\x20sent');logger[_0x5e88('0xe')](_0x5e88('0xf'),_0x531d32,_0x5e88('0x10'),JSON[_0x5e88('0x11')](_0x27ad6b));if(_0x27ad6b[_0x5e88('0x12')]){if(_0x27ad6b[_0x5e88('0x12')][_0x5e88('0x13')]===0x1f4){logger[_0x5e88('0x12')](_0x5e88('0xd'),_0x531d32,_0x27ad6b[_0x5e88('0x12')][_0x5e88('0x14')]);return _0x3a86f4(_0x27ad6b[_0x5e88('0x12')][_0x5e88('0x14')]);}logger[_0x5e88('0x12')](_0x5e88('0xd'),_0x531d32,_0x27ad6b[_0x5e88('0x12')][_0x5e88('0x14')]);return _0x4dcaaa(_0x27ad6b[_0x5e88('0x12')][_0x5e88('0x14')]);}else{logger[_0x5e88('0xc')](_0x5e88('0xd'),_0x531d32,_0x5e88('0x10'));_0x4dcaaa(_0x27ad6b[_0x5e88('0x15')]['message']);}})['catch'](function(_0x5045d0){logger[_0x5e88('0x12')](_0x5e88('0xd'),_0x531d32,_0x5045d0);_0x3a86f4(_0x5045d0);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index b2213eb..43578ba 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 _0xc157=['isAuthenticated','index','/:id','show','/:id/sounds','getSounds','post','create','addSound','put','update','delete','destroy','/:id/sounds/:id2','removeSound','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceMusicOnHold.controller','get'];(function(_0x2224b1,_0x1f087d){var _0x51749b=function(_0x346e61){while(--_0x346e61){_0x2224b1['push'](_0x2224b1['shift']());}};_0x51749b(++_0x1f087d);}(_0xc157,0x1e4));var _0x7c15=function(_0x4948eb,_0x1d9816){_0x4948eb=_0x4948eb-0x0;var _0x5b6add=_0xc157[_0x4948eb];return _0x5b6add;};'use strict';var multer=require(_0x7c15('0x0'));var util=require('util');var path=require(_0x7c15('0x1'));var timeout=require(_0x7c15('0x2'));var express=require(_0x7c15('0x3'));var router=express[_0x7c15('0x4')]();var fs_extra=require(_0x7c15('0x5'));var auth=require(_0x7c15('0x6'));var interaction=require(_0x7c15('0x7'));var config=require('../../config/environment');var controller=require(_0x7c15('0x8'));router[_0x7c15('0x9')]('/',auth[_0x7c15('0xa')](),controller[_0x7c15('0xb')]);router[_0x7c15('0x9')](_0x7c15('0xc'),auth[_0x7c15('0xa')](),controller[_0x7c15('0xd')]);router[_0x7c15('0x9')](_0x7c15('0xe'),auth[_0x7c15('0xa')](),controller[_0x7c15('0xf')]);router[_0x7c15('0x10')]('/',auth[_0x7c15('0xa')](),controller[_0x7c15('0x11')]);router[_0x7c15('0x10')]('/:id/sounds',auth[_0x7c15('0xa')](),controller[_0x7c15('0x12')]);router[_0x7c15('0x13')](_0x7c15('0xc'),auth[_0x7c15('0xa')](),controller[_0x7c15('0x14')]);router[_0x7c15('0x15')]('/:id',auth[_0x7c15('0xa')](),controller[_0x7c15('0x16')]);router[_0x7c15('0x15')](_0x7c15('0x17'),auth[_0x7c15('0xa')](),controller[_0x7c15('0x18')]);module[_0x7c15('0x19')]=router; \ No newline at end of file +var _0x7a8b=['Router','fs-extra','../../components/interaction/service','./voiceMusicOnHold.controller','isAuthenticated','index','/:id','show','get','/:id/sounds','getSounds','post','update','delete','destroy','/:id/sounds/:id2','removeSound','exports','multer','util','path','express'];(function(_0x187399,_0x40c56d){var _0x40fa92=function(_0x36058c){while(--_0x36058c){_0x187399['push'](_0x187399['shift']());}};_0x40fa92(++_0x40c56d);}(_0x7a8b,0xd8));var _0xb7a8=function(_0x3e97cb,_0x15b629){_0x3e97cb=_0x3e97cb-0x0;var _0x22f39e=_0x7a8b[_0x3e97cb];return _0x22f39e;};'use strict';var multer=require(_0xb7a8('0x0'));var util=require(_0xb7a8('0x1'));var path=require(_0xb7a8('0x2'));var timeout=require('connect-timeout');var express=require(_0xb7a8('0x3'));var router=express[_0xb7a8('0x4')]();var fs_extra=require(_0xb7a8('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xb7a8('0x6'));var config=require('../../config/environment');var controller=require(_0xb7a8('0x7'));router['get']('/',auth[_0xb7a8('0x8')](),controller[_0xb7a8('0x9')]);router['get'](_0xb7a8('0xa'),auth[_0xb7a8('0x8')](),controller[_0xb7a8('0xb')]);router[_0xb7a8('0xc')](_0xb7a8('0xd'),auth[_0xb7a8('0x8')](),controller[_0xb7a8('0xe')]);router[_0xb7a8('0xf')]('/',auth[_0xb7a8('0x8')](),controller['create']);router[_0xb7a8('0xf')]('/:id/sounds',auth[_0xb7a8('0x8')](),controller['addSound']);router['put'](_0xb7a8('0xa'),auth[_0xb7a8('0x8')](),controller[_0xb7a8('0x10')]);router[_0xb7a8('0x11')](_0xb7a8('0xa'),auth[_0xb7a8('0x8')](),controller[_0xb7a8('0x12')]);router[_0xb7a8('0x11')](_0xb7a8('0x13'),auth[_0xb7a8('0x8')](),controller[_0xb7a8('0x14')]);module[_0xb7a8('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index cc5dd0c..2f7f453 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 _0x67a2=['files','mp3nb','quietmp3nb','mp3','alpha','TIMESTAMP','BOOLEAN','sequelize','exports','STRING','custom'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x67a2,0xa1));var _0x267a=function(_0x407494,_0x17a8ff){_0x407494=_0x407494-0x0;var _0x39696d=_0x67a2[_0x407494];return _0x39696d;};'use strict';var Sequelize=require(_0x267a('0x0'));module[_0x267a('0x1')]={'name':{'type':Sequelize[_0x267a('0x2')],'allowNull':![],'unique':'name'},'mode':{'type':Sequelize['ENUM'](_0x267a('0x3'),_0x267a('0x4'),_0x267a('0x5'),_0x267a('0x6'),'quietmp3',_0x267a('0x7')),'allowNull':!![],'defaultValue':_0x267a('0x4')},'directory':{'type':Sequelize[_0x267a('0x2')],'allowNull':!![]},'application':{'type':Sequelize[_0x267a('0x2')],'allowNull':!![]},'digit':{'type':Sequelize[_0x267a('0x2')],'allowNull':!![]},'sort':{'type':Sequelize[_0x267a('0x2')],'allowNull':!![],'defaultValue':_0x267a('0x8')},'format':{'type':Sequelize[_0x267a('0x2')],'allowNull':!![]},'stamp':{'type':_0x267a('0x9')},'defaultEntry':{'type':Sequelize[_0x267a('0xa')],'defaultValue':0x0}}; \ No newline at end of file +var _0x4445=['quietmp3','mp3','alpha','TIMESTAMP','BOOLEAN','sequelize','exports','STRING','files','mp3nb'];(function(_0x10d828,_0x5d07f6){var _0x22e087=function(_0x5641e5){while(--_0x5641e5){_0x10d828['push'](_0x10d828['shift']());}};_0x22e087(++_0x5d07f6);}(_0x4445,0x177));var _0x5444=function(_0x51beba,_0x202d19){_0x51beba=_0x51beba-0x0;var _0x167ee0=_0x4445[_0x51beba];return _0x167ee0;};'use strict';var Sequelize=require(_0x5444('0x0'));module[_0x5444('0x1')]={'name':{'type':Sequelize[_0x5444('0x2')],'allowNull':![],'unique':'name'},'mode':{'type':Sequelize['ENUM']('custom',_0x5444('0x3'),_0x5444('0x4'),'quietmp3nb',_0x5444('0x5'),_0x5444('0x6')),'allowNull':!![],'defaultValue':_0x5444('0x3')},'directory':{'type':Sequelize[_0x5444('0x2')],'allowNull':!![]},'application':{'type':Sequelize[_0x5444('0x2')],'allowNull':!![]},'digit':{'type':Sequelize[_0x5444('0x2')],'allowNull':!![]},'sort':{'type':Sequelize[_0x5444('0x2')],'allowNull':!![],'defaultValue':_0x5444('0x7')},'format':{'type':Sequelize[_0x5444('0x2')],'allowNull':!![]},'stamp':{'type':_0x5444('0x8')},'defaultEntry':{'type':Sequelize[_0x5444('0x9')],'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 69eb9b8..6f1010f 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 _0xa529=['map','VoiceMusicOnHold','rawAttributes','fieldName','key','query','intersection','attributes','model','fields','length','nolimit','order','sort','where','filters','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','keys','find','update','body','create','sequelize','transaction','mode','files','directory','root','server/files/moh','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','forEach','unlinkSync','ValidationError','addSound','Sound','findOne','save_name','converted_format','createdAt','join','server/files/sounds/converted','format','%s.%s','extname','symlinkSync','Sequelize','message','removeSound','getSounds','pick','hasOwnProperty','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','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','end','json','undefined','limit','count','offset','status','set','apply','reject','save','then','destroy','get','MusicOnHolds','UserProfileResource','stack','name','send','index'];(function(_0x201626,_0x32ec75){var _0xca815e=function(_0x108cc1){while(--_0x108cc1){_0x201626['push'](_0x201626['shift']());}};_0xca815e(++_0x32ec75);}(_0xa529,0xb6));var _0x9a52=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa529[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0x9a52('0x0'));var rimraf=require(_0x9a52('0x1'));var zipdir=require(_0x9a52('0x2'));var jsonpatch=require(_0x9a52('0x3'));var rp=require(_0x9a52('0x4'));var moment=require(_0x9a52('0x5'));var BPromise=require(_0x9a52('0x6'));var Mustache=require(_0x9a52('0x7'));var util=require('util');var path=require(_0x9a52('0x8'));var sox=require('sox');var csv=require(_0x9a52('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9a52('0xa'));var _=require(_0x9a52('0xb'));var squel=require(_0x9a52('0xc'));var crypto=require(_0x9a52('0xd'));var jsforce=require(_0x9a52('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x9a52('0x9'));var querystring=require(_0x9a52('0xf'));var Papa=require(_0x9a52('0x10'));var Redis=require(_0x9a52('0x11'));var authService=require(_0x9a52('0x12'));var qs=require(_0x9a52('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9a52('0x14'));var logger=require('../../config/logger')(_0x9a52('0x15'));var utils=require(_0x9a52('0x16'));var config=require(_0x9a52('0x17'));var licenseUtil=require(_0x9a52('0x18'));var db=require(_0x9a52('0x19'))['db'];function respondWithStatusCode(_0x259698,_0x1c80ea){_0x1c80ea=_0x1c80ea||0xcc;return function(_0x2782fc){if(_0x2782fc){return _0x259698['sendStatus'](_0x1c80ea);}return _0x259698['status'](_0x1c80ea)[_0x9a52('0x1a')]();};}function respondWithResult(_0x543e7f,_0x533631){_0x533631=_0x533631||0xc8;return function(_0x4c70cf){if(_0x4c70cf){return _0x543e7f['status'](_0x533631)[_0x9a52('0x1b')](_0x4c70cf);}};}function respondWithFilteredResult(_0x572710,_0x3bb913){return function(_0x4da35f){if(_0x4da35f){var _0x6a38ca=typeof _0x3bb913['offset']===_0x9a52('0x1c')&&typeof _0x3bb913[_0x9a52('0x1d')]==='undefined';var _0x381e46=_0x4da35f[_0x9a52('0x1e')];var _0x4bd86c=_0x6a38ca?0x0:_0x3bb913[_0x9a52('0x1f')];var _0x599927=_0x6a38ca?_0x4da35f['count']:_0x3bb913[_0x9a52('0x1f')]+_0x3bb913[_0x9a52('0x1d')];var _0x4128d8;if(_0x599927>=_0x381e46){_0x599927=_0x381e46;_0x4128d8=0xc8;}else{_0x4128d8=0xce;}_0x572710[_0x9a52('0x20')](_0x4128d8);return _0x572710[_0x9a52('0x21')]('Content-Range',_0x4bd86c+'-'+_0x599927+'/'+_0x381e46)[_0x9a52('0x1b')](_0x4da35f);}return null;};}function patchUpdates(_0x394c2b){return function(_0x1c2f0a){try{jsonpatch[_0x9a52('0x22')](_0x1c2f0a,_0x394c2b,!![]);}catch(_0x460a92){return BPromise[_0x9a52('0x23')](_0x460a92);}return _0x1c2f0a[_0x9a52('0x24')]();};}function saveUpdates(_0x44ba87,_0x205197){return function(_0x43538e){if(_0x43538e){return _0x43538e['update'](_0x44ba87)[_0x9a52('0x25')](function(_0x33a6d8){return _0x33a6d8;});}return null;};}function removeEntity(_0x324668,_0x253430){return function(_0x48809f){if(_0x48809f){return _0x48809f[_0x9a52('0x26')]()[_0x9a52('0x25')](function(){var _0x23d991=_0x48809f[_0x9a52('0x27')]({'plain':!![]});var _0x73b2cf=_0x9a52('0x28');return db[_0x9a52('0x29')][_0x9a52('0x26')]({'where':{'type':_0x73b2cf,'resourceId':_0x23d991['id']}})['then'](function(){return _0x48809f;});})[_0x9a52('0x25')](function(){_0x324668['status'](0xcc)[_0x9a52('0x1a')]();});}};}function handleEntityNotFound(_0x278a63,_0x5316b5){return function(_0x2eec0b){if(!_0x2eec0b){_0x278a63['sendStatus'](0x194);}return _0x2eec0b;};}function handleError(_0x1fce84,_0x494f0a){_0x494f0a=_0x494f0a||0x1f4;return function(_0x2c1da2){logger['error'](_0x2c1da2[_0x9a52('0x2a')]);if(_0x2c1da2[_0x9a52('0x2b')]){delete _0x2c1da2[_0x9a52('0x2b')];}_0x1fce84[_0x9a52('0x20')](_0x494f0a)[_0x9a52('0x2c')](_0x2c1da2);};}exports[_0x9a52('0x2d')]=function(_0x48fa4d,_0x43f705){var _0x5b1372={},_0x364834={},_0x3c30b0={'count':0x0,'rows':[]};var _0x18454a=_[_0x9a52('0x2e')](db[_0x9a52('0x2f')][_0x9a52('0x30')],function(_0xcebdc6){return{'name':_0xcebdc6[_0x9a52('0x31')],'type':_0xcebdc6['type'][_0x9a52('0x32')]};});_0x364834['model']=_['map'](_0x18454a,_0x9a52('0x2b'));_0x364834[_0x9a52('0x33')]=_['keys'](_0x48fa4d['query']);_0x364834['filters']=_[_0x9a52('0x34')](_0x364834['model'],_0x364834['query']);_0x5b1372[_0x9a52('0x35')]=_[_0x9a52('0x34')](_0x364834[_0x9a52('0x36')],qs[_0x9a52('0x37')](_0x48fa4d[_0x9a52('0x33')]['fields']));_0x5b1372[_0x9a52('0x35')]=_0x5b1372[_0x9a52('0x35')][_0x9a52('0x38')]?_0x5b1372[_0x9a52('0x35')]:_0x364834[_0x9a52('0x36')];if(!_0x48fa4d[_0x9a52('0x33')]['hasOwnProperty'](_0x9a52('0x39'))){_0x5b1372[_0x9a52('0x1d')]=qs[_0x9a52('0x1d')](_0x48fa4d['query'][_0x9a52('0x1d')]);_0x5b1372[_0x9a52('0x1f')]=qs[_0x9a52('0x1f')](_0x48fa4d[_0x9a52('0x33')][_0x9a52('0x1f')]);}_0x5b1372[_0x9a52('0x3a')]=qs[_0x9a52('0x3b')](_0x48fa4d['query'][_0x9a52('0x3b')]);delete _0x48fa4d[_0x9a52('0x33')]['sort'];_0x5b1372[_0x9a52('0x3c')]=qs['filters'](_['pick'](_0x48fa4d[_0x9a52('0x33')],_0x364834[_0x9a52('0x3d')]),_0x18454a);if(_0x48fa4d['query']['filter']){_0x5b1372[_0x9a52('0x3c')]=_[_0x9a52('0x3e')](_0x5b1372['where'],{'$or':_[_0x9a52('0x2e')](_0x18454a,function(_0x3d9fba){if(_0x3d9fba[_0x9a52('0x3f')]!==_0x9a52('0x40')){var _0x511155={};_0x511155[_0x3d9fba[_0x9a52('0x2b')]]={'$like':'%'+_0x48fa4d[_0x9a52('0x33')][_0x9a52('0x41')]+'%'};return _0x511155;}})});}_0x5b1372=_['merge']({},_0x5b1372,_0x48fa4d[_0x9a52('0x42')]);var _0x5986a4={'where':_0x5b1372[_0x9a52('0x3c')]};return db[_0x9a52('0x2f')][_0x9a52('0x1e')](_0x5986a4)[_0x9a52('0x25')](function(_0x3aa19e){_0x3c30b0[_0x9a52('0x1e')]=_0x3aa19e;if(_0x48fa4d[_0x9a52('0x33')][_0x9a52('0x43')]){_0x5b1372[_0x9a52('0x44')]=[{'all':!![]}];}return db[_0x9a52('0x2f')][_0x9a52('0x45')](_0x5b1372);})[_0x9a52('0x25')](function(_0x38f122){_0x3c30b0[_0x9a52('0x46')]=_0x38f122;return _0x3c30b0;})['then'](respondWithFilteredResult(_0x43f705,_0x5b1372))[_0x9a52('0x47')](handleError(_0x43f705,null));};exports[_0x9a52('0x48')]=function(_0x18e5a0,_0x10fb20){var _0x1b8459={'raw':![],'where':{'id':_0x18e5a0[_0x9a52('0x49')]['id']}},_0x56b3de={};_0x56b3de[_0x9a52('0x36')]=_['keys'](db[_0x9a52('0x2f')][_0x9a52('0x30')]);_0x56b3de[_0x9a52('0x33')]=_[_0x9a52('0x4a')](_0x18e5a0[_0x9a52('0x33')]);_0x56b3de[_0x9a52('0x3d')]=_[_0x9a52('0x34')](_0x56b3de['model'],_0x56b3de[_0x9a52('0x33')]);_0x1b8459[_0x9a52('0x35')]=_[_0x9a52('0x34')](_0x56b3de[_0x9a52('0x36')],qs['fields'](_0x18e5a0[_0x9a52('0x33')][_0x9a52('0x37')]));_0x1b8459[_0x9a52('0x35')]=_0x1b8459[_0x9a52('0x35')][_0x9a52('0x38')]?_0x1b8459[_0x9a52('0x35')]:_0x56b3de[_0x9a52('0x36')];if(_0x18e5a0['query'][_0x9a52('0x43')]){_0x1b8459[_0x9a52('0x44')]=[{'all':!![]}];}_0x1b8459=_[_0x9a52('0x3e')]({},_0x1b8459,_0x18e5a0[_0x9a52('0x42')]);return db[_0x9a52('0x2f')][_0x9a52('0x4b')](_0x1b8459)[_0x9a52('0x25')](handleEntityNotFound(_0x10fb20,null))['then'](respondWithResult(_0x10fb20,null))[_0x9a52('0x47')](handleError(_0x10fb20,null));};exports[_0x9a52('0x4c')]=function(_0x1cabc0,_0x161bbb){if(_0x1cabc0[_0x9a52('0x4d')]['id']){delete _0x1cabc0[_0x9a52('0x4d')]['id'];}return db['VoiceMusicOnHold'][_0x9a52('0x4b')]({'where':{'id':_0x1cabc0[_0x9a52('0x49')]['id']}})[_0x9a52('0x25')](handleEntityNotFound(_0x161bbb,null))['then'](saveUpdates(_0x1cabc0[_0x9a52('0x4d')],null))[_0x9a52('0x25')](respondWithResult(_0x161bbb,null))[_0x9a52('0x47')](handleError(_0x161bbb,null));};exports[_0x9a52('0x4e')]=function(_0x258aa0,_0x5f0b49,_0x3d6ba3){return db[_0x9a52('0x4f')][_0x9a52('0x50')](function(_0x4a77bc){if(_0x258aa0[_0x9a52('0x4d')][_0x9a52('0x51')]===_0x9a52('0x52')){_0x258aa0[_0x9a52('0x4d')][_0x9a52('0x53')]=path['join'](config[_0x9a52('0x54')],_0x9a52('0x55'),_0x258aa0[_0x9a52('0x4d')]['name']);}return db[_0x9a52('0x2f')][_0x9a52('0x4e')](_0x258aa0[_0x9a52('0x4d')],{'transaction':_0x4a77bc})['then'](function(_0x2a0748){if(_0x258aa0['body']['mode']===_0x9a52('0x52')){fs['mkdirSync'](_0x2a0748[_0x9a52('0x53')],parseInt('0777',0x8));}var _0x20246e=_0x258aa0[_0x9a52('0x56')][_0x9a52('0x27')]({'plain':!![]});if(!_0x20246e)throw new Error(_0x9a52('0x57'));if(_0x20246e[_0x9a52('0x58')]==='user'){var _0x24db1f=_0x2a0748[_0x9a52('0x27')]({'plain':!![]});return db[_0x9a52('0x59')][_0x9a52('0x4b')]({'where':{'name':_0x9a52('0x28'),'userProfileId':_0x20246e['userProfileId']},'raw':!![]})['then'](function(_0x486ec1){if(_0x486ec1&&_0x486ec1[_0x9a52('0x5a')]===0x0){return db[_0x9a52('0x29')]['create']({'name':_0x24db1f[_0x9a52('0x2b')],'resourceId':_0x24db1f['id'],'type':_0x486ec1[_0x9a52('0x2b')],'sectionId':_0x486ec1['id']},{})['then'](function(){return _0x2a0748;});}else{return _0x2a0748;}})[_0x9a52('0x47')](function(_0x5e5291){logger[_0x9a52('0x5b')](_0x9a52('0x5c'),_0x5e5291);});}return _0x2a0748;});})[_0x9a52('0x25')](respondWithResult(_0x5f0b49,0xc9))[_0x9a52('0x47')](handleError(_0x5f0b49,null));};exports['destroy']=function(_0x3a1b06,_0x44c11c,_0x351fe3){var _0x39a479;return db['VoiceMusicOnHold'][_0x9a52('0x4b')]({'where':{'id':_0x3a1b06['params']['id']}})[_0x9a52('0x25')](function(_0x58c9f4){if(_0x58c9f4){return db[_0x9a52('0x4f')]['transaction'](function(_0x536d99){return _0x58c9f4[_0x9a52('0x26')]({'transaction':_0x536d99,'raw':!![]})['then'](function(_0x1d7adc){if(_0x1d7adc[_0x9a52('0x53')]){fs['readdirSync'](_0x1d7adc[_0x9a52('0x53')])[_0x9a52('0x5d')](function(_0x2aaddc){fs[_0x9a52('0x5e')](path['join'](_0x1d7adc[_0x9a52('0x53')],_0x2aaddc));});fs['rmdirSync'](_0x1d7adc[_0x9a52('0x53')]);}return _0x1d7adc;});})[_0x9a52('0x47')](function(_0x168ba7){throw new db['Sequelize'][(_0x9a52('0x5f'))](_0x168ba7['message']);});}})['then'](handleEntityNotFound(_0x44c11c,null))[_0x9a52('0x25')](removeEntity(_0x44c11c,null))['catch'](handleError(_0x44c11c,null));};exports[_0x9a52('0x60')]=function(_0x3dadfb,_0x482c81,_0x2cd757){return db['sequelize'][_0x9a52('0x50')](function(_0x524183){var _0x349ce1;return db['VoiceMusicOnHold']['find']({'where':{'id':_0x3dadfb[_0x9a52('0x49')]['id']}})['then'](function(_0x362552){if(_0x362552){_0x349ce1=_0x362552;return _0x362552['addSound'](_0x3dadfb['body']['id'],{'transaction':_0x524183});}})[_0x9a52('0x25')](function(_0x3744ca){if(_0x3744ca){return db[_0x9a52('0x61')][_0x9a52('0x62')]({'where':{'id':_0x3dadfb[_0x9a52('0x4d')]['id']},'attributes':['id',_0x9a52('0x2b'),_0x9a52('0x63'),_0x9a52('0x64'),_0x9a52('0x65')],'raw':!![]});}})['then'](function(_0x136edd){if(_0x136edd){var _0x49ca18=path[_0x9a52('0x66')](config['root'],_0x9a52('0x67'),util[_0x9a52('0x68')](_0x9a52('0x69'),path['basename'](_0x136edd[_0x9a52('0x63')],path[_0x9a52('0x6a')](_0x136edd[_0x9a52('0x63')])),_0x136edd[_0x9a52('0x64')]));var _0x442bfa=path[_0x9a52('0x66')](config[_0x9a52('0x54')],'server/files/moh',_0x349ce1[_0x9a52('0x2b')],util[_0x9a52('0x68')](_0x9a52('0x69'),_0x136edd[_0x9a52('0x2b')],_0x136edd[_0x9a52('0x64')]));fs[_0x9a52('0x6b')](_0x49ca18,_0x442bfa);return _0x136edd;}})[_0x9a52('0x47')](function(_0x15da76){throw new db[(_0x9a52('0x6c'))][(_0x9a52('0x5f'))](_0x15da76[_0x9a52('0x6d')]);});})[_0x9a52('0x25')](handleEntityNotFound(_0x482c81,null))['then'](respondWithResult(_0x482c81,0xc9))[_0x9a52('0x47')](handleError(_0x482c81,null));};exports[_0x9a52('0x6e')]=function(_0x8a80a5,_0x49129f,_0x179140){return db[_0x9a52('0x4f')]['transaction'](function(_0x204de9){var _0x79e7da;return db[_0x9a52('0x2f')][_0x9a52('0x62')]({'where':{'id':_0x8a80a5[_0x9a52('0x49')]['id']}})[_0x9a52('0x25')](handleEntityNotFound(_0x49129f,null))[_0x9a52('0x25')](function(_0xd45d67){if(_0xd45d67){_0x79e7da=_0xd45d67;return _0xd45d67['removeSound'](_0x8a80a5[_0x9a52('0x49')]['id2']);}})[_0x9a52('0x25')](function(_0x44751d){if(_0x44751d){return db[_0x9a52('0x61')][_0x9a52('0x62')]({'where':{'id':_0x8a80a5['params']['id2']},'attributes':['id',_0x9a52('0x2b'),_0x9a52('0x63'),_0x9a52('0x64'),_0x9a52('0x65')],'raw':!![]});}})[_0x9a52('0x25')](function(_0x3cf3dd){if(_0x3cf3dd){fs['unlinkSync'](path['join'](_0x79e7da['directory'],util[_0x9a52('0x68')](_0x9a52('0x69'),_0x3cf3dd[_0x9a52('0x2b')],_0x3cf3dd[_0x9a52('0x64')])));return _0x3cf3dd;}})['catch'](function(_0x3cf8ea){throw new db['Sequelize'][(_0x9a52('0x5f'))](_0x3cf8ea['message']);});})[_0x9a52('0x25')](handleEntityNotFound(_0x49129f,null))[_0x9a52('0x25')](respondWithStatusCode(_0x49129f,0xcc))[_0x9a52('0x47')](handleError(_0x49129f,null));};exports[_0x9a52('0x6f')]=function(_0x72cc11,_0x1a64f7,_0x5edeb4){var _0x14e405={};var _0x49eb58={};var _0x5fb119;var _0x4e5f13;return db[_0x9a52('0x2f')][_0x9a52('0x62')]({'where':{'id':_0x72cc11[_0x9a52('0x49')]['id']}})['then'](handleEntityNotFound(_0x1a64f7,null))['then'](function(_0x4509b9){if(_0x4509b9){_0x5fb119=_0x4509b9;_0x49eb58[_0x9a52('0x36')]=_[_0x9a52('0x4a')](db[_0x9a52('0x61')][_0x9a52('0x30')]);_0x49eb58[_0x9a52('0x33')]=_[_0x9a52('0x4a')](_0x72cc11['query']);_0x49eb58[_0x9a52('0x3d')]=_['intersection'](_0x49eb58[_0x9a52('0x36')],_0x49eb58['query']);_0x14e405[_0x9a52('0x35')]=_['intersection'](_0x49eb58[_0x9a52('0x36')],qs[_0x9a52('0x37')](_0x72cc11['query']['fields']));_0x14e405['attributes']=_0x14e405[_0x9a52('0x35')][_0x9a52('0x38')]?_0x14e405['attributes']:_0x49eb58['model'];_0x14e405[_0x9a52('0x3a')]=qs[_0x9a52('0x3b')](_0x72cc11[_0x9a52('0x33')][_0x9a52('0x3b')]);_0x14e405['where']=qs['filters'](_[_0x9a52('0x70')](_0x72cc11['query'],_0x49eb58[_0x9a52('0x3d')]));if(_0x72cc11['query']['filter']){_0x14e405[_0x9a52('0x3c')]=_['merge'](_0x14e405['where'],{'$or':_[_0x9a52('0x2e')](_0x14e405[_0x9a52('0x35')],function(_0x2ad306){var _0x30be60={};_0x30be60[_0x2ad306]={'$like':'%'+_0x72cc11[_0x9a52('0x33')][_0x9a52('0x41')]+'%'};return _0x30be60;})});}_0x14e405=_['merge']({},_0x14e405,_0x72cc11['options']);return _0x5fb119[_0x9a52('0x6f')](_0x14e405);}})[_0x9a52('0x25')](function(_0xaf558c){if(_0xaf558c){_0x4e5f13=_0xaf558c['length'];if(!_0x72cc11[_0x9a52('0x33')][_0x9a52('0x71')](_0x9a52('0x39'))){_0x14e405[_0x9a52('0x1d')]=qs[_0x9a52('0x1d')](_0x72cc11[_0x9a52('0x33')]['limit']);_0x14e405[_0x9a52('0x1f')]=qs['offset'](_0x72cc11['query']['offset']);}return _0x5fb119[_0x9a52('0x6f')](_0x14e405);}})['then'](function(_0x53f624){if(_0x53f624){return _0x53f624?{'count':_0x4e5f13,'rows':_0x53f624}:null;}})['then'](respondWithResult(_0x1a64f7,null))[_0x9a52('0x47')](handleError(_0x1a64f7,null));}; \ No newline at end of file +var _0xa646=['pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','catch','show','fields','length','find','body','params','create','sequelize','transaction','mode','files','directory','join','root','mkdirSync','role','user','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','forEach','unlinkSync','Sequelize','ValidationError','addSound','Sound','findOne','converted_format','createdAt','server/files/sounds/converted','format','extname','save_name','server/files/moh','%s.%s','symlinkSync','message','removeSound','id2','getSounds','rawAttributes','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','crypto','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','get','UserProfileResource','destroy','end','sendStatus','stack','name','map','VoiceMusicOnHold','fieldName','key','model','query','keys','intersection','attributes','nolimit','order','sort','where','filters'];(function(_0x522f00,_0x5a19c3){var _0x5976b6=function(_0x4f4e1e){while(--_0x4f4e1e){_0x522f00['push'](_0x522f00['shift']());}};_0x5976b6(++_0x5a19c3);}(_0xa646,0x1d0));var _0x6a64=function(_0x82db9f,_0x230e96){_0x82db9f=_0x82db9f-0x0;var _0x447d09=_0xa646[_0x82db9f];return _0x447d09;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x6a64('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6a64('0x1'));var moment=require(_0x6a64('0x2'));var BPromise=require(_0x6a64('0x3'));var Mustache=require(_0x6a64('0x4'));var util=require(_0x6a64('0x5'));var path=require(_0x6a64('0x6'));var sox=require('sox');var csv=require(_0x6a64('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x6a64('0x8'));var jsforce=require('jsforce');var deskjs=require(_0x6a64('0x9'));var toCsv=require(_0x6a64('0x7'));var querystring=require(_0x6a64('0xa'));var Papa=require(_0x6a64('0xb'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x6a64('0xc'));var hardwareService=require(_0x6a64('0xd'));var logger=require(_0x6a64('0xe'))(_0x6a64('0xf'));var utils=require(_0x6a64('0x10'));var config=require(_0x6a64('0x11'));var licenseUtil=require('../../config/license/util');var db=require(_0x6a64('0x12'))['db'];function respondWithStatusCode(_0x1a062a,_0x61a676){_0x61a676=_0x61a676||0xcc;return function(_0x499c70){if(_0x499c70){return _0x1a062a['sendStatus'](_0x61a676);}return _0x1a062a[_0x6a64('0x13')](_0x61a676)['end']();};}function respondWithResult(_0x5c84e4,_0xfd188a){_0xfd188a=_0xfd188a||0xc8;return function(_0x538ffe){if(_0x538ffe){return _0x5c84e4[_0x6a64('0x13')](_0xfd188a)[_0x6a64('0x14')](_0x538ffe);}};}function respondWithFilteredResult(_0x204c65,_0x36f2a8){return function(_0x3e36c0){if(_0x3e36c0){var _0xf228d2=typeof _0x36f2a8[_0x6a64('0x15')]===_0x6a64('0x16')&&typeof _0x36f2a8[_0x6a64('0x17')]==='undefined';var _0x3a960b=_0x3e36c0[_0x6a64('0x18')];var _0x57ca9d=_0xf228d2?0x0:_0x36f2a8[_0x6a64('0x15')];var _0x3f7610=_0xf228d2?_0x3e36c0['count']:_0x36f2a8[_0x6a64('0x15')]+_0x36f2a8[_0x6a64('0x17')];var _0x5918a9;if(_0x3f7610>=_0x3a960b){_0x3f7610=_0x3a960b;_0x5918a9=0xc8;}else{_0x5918a9=0xce;}_0x204c65['status'](_0x5918a9);return _0x204c65[_0x6a64('0x19')](_0x6a64('0x1a'),_0x57ca9d+'-'+_0x3f7610+'/'+_0x3a960b)[_0x6a64('0x14')](_0x3e36c0);}return null;};}function patchUpdates(_0x3c5d7d){return function(_0x6161e0){try{jsonpatch['apply'](_0x6161e0,_0x3c5d7d,!![]);}catch(_0xa13792){return BPromise[_0x6a64('0x1b')](_0xa13792);}return _0x6161e0['save']();};}function saveUpdates(_0x11ad24,_0x98cee1){return function(_0x1ad910){if(_0x1ad910){return _0x1ad910[_0x6a64('0x1c')](_0x11ad24)[_0x6a64('0x1d')](function(_0x3876a1){return _0x3876a1;});}return null;};}function removeEntity(_0xb0e0b6,_0x445c90){return function(_0x2450d6){if(_0x2450d6){return _0x2450d6['destroy']()[_0x6a64('0x1d')](function(){var _0x4a1f5d=_0x2450d6[_0x6a64('0x1e')]({'plain':!![]});var _0x5a9382='MusicOnHolds';return db[_0x6a64('0x1f')][_0x6a64('0x20')]({'where':{'type':_0x5a9382,'resourceId':_0x4a1f5d['id']}})[_0x6a64('0x1d')](function(){return _0x2450d6;});})[_0x6a64('0x1d')](function(){_0xb0e0b6[_0x6a64('0x13')](0xcc)[_0x6a64('0x21')]();});}};}function handleEntityNotFound(_0x179821,_0x493beb){return function(_0x1d4a43){if(!_0x1d4a43){_0x179821[_0x6a64('0x22')](0x194);}return _0x1d4a43;};}function handleError(_0x482da1,_0x7d55d9){_0x7d55d9=_0x7d55d9||0x1f4;return function(_0x3e1a09){logger['error'](_0x3e1a09[_0x6a64('0x23')]);if(_0x3e1a09[_0x6a64('0x24')]){delete _0x3e1a09[_0x6a64('0x24')];}_0x482da1[_0x6a64('0x13')](_0x7d55d9)['send'](_0x3e1a09);};}exports['index']=function(_0x4c6506,_0x50cc9e){var _0x41e77a={},_0x5cf563={},_0x282c99={'count':0x0,'rows':[]};var _0x3f6ea9=_[_0x6a64('0x25')](db[_0x6a64('0x26')]['rawAttributes'],function(_0x5c433b){return{'name':_0x5c433b[_0x6a64('0x27')],'type':_0x5c433b['type'][_0x6a64('0x28')]};});_0x5cf563[_0x6a64('0x29')]=_[_0x6a64('0x25')](_0x3f6ea9,'name');_0x5cf563[_0x6a64('0x2a')]=_[_0x6a64('0x2b')](_0x4c6506[_0x6a64('0x2a')]);_0x5cf563['filters']=_[_0x6a64('0x2c')](_0x5cf563[_0x6a64('0x29')],_0x5cf563[_0x6a64('0x2a')]);_0x41e77a[_0x6a64('0x2d')]=_[_0x6a64('0x2c')](_0x5cf563[_0x6a64('0x29')],qs['fields'](_0x4c6506[_0x6a64('0x2a')]['fields']));_0x41e77a[_0x6a64('0x2d')]=_0x41e77a[_0x6a64('0x2d')]['length']?_0x41e77a['attributes']:_0x5cf563[_0x6a64('0x29')];if(!_0x4c6506['query']['hasOwnProperty'](_0x6a64('0x2e'))){_0x41e77a[_0x6a64('0x17')]=qs[_0x6a64('0x17')](_0x4c6506[_0x6a64('0x2a')][_0x6a64('0x17')]);_0x41e77a[_0x6a64('0x15')]=qs[_0x6a64('0x15')](_0x4c6506[_0x6a64('0x2a')]['offset']);}_0x41e77a[_0x6a64('0x2f')]=qs[_0x6a64('0x30')](_0x4c6506[_0x6a64('0x2a')][_0x6a64('0x30')]);delete _0x4c6506['query']['sort'];_0x41e77a[_0x6a64('0x31')]=qs[_0x6a64('0x32')](_[_0x6a64('0x33')](_0x4c6506[_0x6a64('0x2a')],_0x5cf563['filters']),_0x3f6ea9);if(_0x4c6506[_0x6a64('0x2a')][_0x6a64('0x34')]){_0x41e77a[_0x6a64('0x31')]=_[_0x6a64('0x35')](_0x41e77a[_0x6a64('0x31')],{'$or':_['map'](_0x3f6ea9,function(_0x407480){if(_0x407480[_0x6a64('0x36')]!==_0x6a64('0x37')){var _0x3ee360={};_0x3ee360[_0x407480[_0x6a64('0x24')]]={'$like':'%'+_0x4c6506[_0x6a64('0x2a')][_0x6a64('0x34')]+'%'};return _0x3ee360;}})});}_0x41e77a=_[_0x6a64('0x35')]({},_0x41e77a,_0x4c6506[_0x6a64('0x38')]);var _0x53b87a={'where':_0x41e77a[_0x6a64('0x31')]};return db[_0x6a64('0x26')][_0x6a64('0x18')](_0x53b87a)['then'](function(_0x205969){_0x282c99[_0x6a64('0x18')]=_0x205969;if(_0x4c6506[_0x6a64('0x2a')][_0x6a64('0x39')]){_0x41e77a[_0x6a64('0x3a')]=[{'all':!![]}];}return db['VoiceMusicOnHold'][_0x6a64('0x3b')](_0x41e77a);})['then'](function(_0x2bfec6){_0x282c99['rows']=_0x2bfec6;return _0x282c99;})['then'](respondWithFilteredResult(_0x50cc9e,_0x41e77a))[_0x6a64('0x3c')](handleError(_0x50cc9e,null));};exports[_0x6a64('0x3d')]=function(_0x427d92,_0x19eb1d){var _0x46c0ae={'raw':![],'where':{'id':_0x427d92['params']['id']}},_0x387140={};_0x387140[_0x6a64('0x29')]=_['keys'](db[_0x6a64('0x26')]['rawAttributes']);_0x387140[_0x6a64('0x2a')]=_[_0x6a64('0x2b')](_0x427d92[_0x6a64('0x2a')]);_0x387140['filters']=_['intersection'](_0x387140[_0x6a64('0x29')],_0x387140[_0x6a64('0x2a')]);_0x46c0ae['attributes']=_[_0x6a64('0x2c')](_0x387140[_0x6a64('0x29')],qs['fields'](_0x427d92[_0x6a64('0x2a')][_0x6a64('0x3e')]));_0x46c0ae[_0x6a64('0x2d')]=_0x46c0ae[_0x6a64('0x2d')][_0x6a64('0x3f')]?_0x46c0ae[_0x6a64('0x2d')]:_0x387140[_0x6a64('0x29')];if(_0x427d92[_0x6a64('0x2a')][_0x6a64('0x39')]){_0x46c0ae[_0x6a64('0x3a')]=[{'all':!![]}];}_0x46c0ae=_[_0x6a64('0x35')]({},_0x46c0ae,_0x427d92[_0x6a64('0x38')]);return db[_0x6a64('0x26')][_0x6a64('0x40')](_0x46c0ae)[_0x6a64('0x1d')](handleEntityNotFound(_0x19eb1d,null))['then'](respondWithResult(_0x19eb1d,null))['catch'](handleError(_0x19eb1d,null));};exports['update']=function(_0x34c32c,_0x3e36b6){if(_0x34c32c[_0x6a64('0x41')]['id']){delete _0x34c32c[_0x6a64('0x41')]['id'];}return db[_0x6a64('0x26')][_0x6a64('0x40')]({'where':{'id':_0x34c32c[_0x6a64('0x42')]['id']}})[_0x6a64('0x1d')](handleEntityNotFound(_0x3e36b6,null))['then'](saveUpdates(_0x34c32c[_0x6a64('0x41')],null))[_0x6a64('0x1d')](respondWithResult(_0x3e36b6,null))[_0x6a64('0x3c')](handleError(_0x3e36b6,null));};exports[_0x6a64('0x43')]=function(_0x1c255c,_0x4e5bf2,_0x123812){return db[_0x6a64('0x44')][_0x6a64('0x45')](function(_0x1c83f3){if(_0x1c255c['body'][_0x6a64('0x46')]===_0x6a64('0x47')){_0x1c255c[_0x6a64('0x41')][_0x6a64('0x48')]=path[_0x6a64('0x49')](config[_0x6a64('0x4a')],'server/files/moh',_0x1c255c[_0x6a64('0x41')][_0x6a64('0x24')]);}return db[_0x6a64('0x26')][_0x6a64('0x43')](_0x1c255c['body'],{'transaction':_0x1c83f3})[_0x6a64('0x1d')](function(_0x4fc12f){if(_0x1c255c[_0x6a64('0x41')][_0x6a64('0x46')]===_0x6a64('0x47')){fs[_0x6a64('0x4b')](_0x4fc12f[_0x6a64('0x48')],parseInt('0777',0x8));}var _0x1f5098=_0x1c255c['user'][_0x6a64('0x1e')]({'plain':!![]});if(!_0x1f5098)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1f5098[_0x6a64('0x4c')]===_0x6a64('0x4d')){var _0x272e2c=_0x4fc12f[_0x6a64('0x1e')]({'plain':!![]});return db['UserProfileSection'][_0x6a64('0x40')]({'where':{'name':'MusicOnHolds','userProfileId':_0x1f5098[_0x6a64('0x4e')]},'raw':!![]})['then'](function(_0x35628e){if(_0x35628e&&_0x35628e[_0x6a64('0x4f')]===0x0){return db['UserProfileResource']['create']({'name':_0x272e2c[_0x6a64('0x24')],'resourceId':_0x272e2c['id'],'type':_0x35628e[_0x6a64('0x24')],'sectionId':_0x35628e['id']},{})[_0x6a64('0x1d')](function(){return _0x4fc12f;});}else{return _0x4fc12f;}})['catch'](function(_0x5ccbc9){logger[_0x6a64('0x50')](_0x6a64('0x51'),_0x5ccbc9);});}return _0x4fc12f;});})[_0x6a64('0x1d')](respondWithResult(_0x4e5bf2,0xc9))[_0x6a64('0x3c')](handleError(_0x4e5bf2,null));};exports[_0x6a64('0x20')]=function(_0xc1250c,_0x183557,_0x1138cd){var _0x1cb270;return db[_0x6a64('0x26')][_0x6a64('0x40')]({'where':{'id':_0xc1250c['params']['id']}})[_0x6a64('0x1d')](function(_0x15c117){if(_0x15c117){return db[_0x6a64('0x44')][_0x6a64('0x45')](function(_0x883c3a){return _0x15c117[_0x6a64('0x20')]({'transaction':_0x883c3a,'raw':!![]})[_0x6a64('0x1d')](function(_0x55f0c7){if(_0x55f0c7[_0x6a64('0x48')]){fs['readdirSync'](_0x55f0c7['directory'])[_0x6a64('0x52')](function(_0x49315a){fs[_0x6a64('0x53')](path[_0x6a64('0x49')](_0x55f0c7[_0x6a64('0x48')],_0x49315a));});fs['rmdirSync'](_0x55f0c7[_0x6a64('0x48')]);}return _0x55f0c7;});})[_0x6a64('0x3c')](function(_0x182cde){throw new db[(_0x6a64('0x54'))][(_0x6a64('0x55'))](_0x182cde['message']);});}})[_0x6a64('0x1d')](handleEntityNotFound(_0x183557,null))[_0x6a64('0x1d')](removeEntity(_0x183557,null))[_0x6a64('0x3c')](handleError(_0x183557,null));};exports[_0x6a64('0x56')]=function(_0x5589e3,_0x104653,_0x9d2531){return db[_0x6a64('0x44')][_0x6a64('0x45')](function(_0x659283){var _0x80ebda;return db['VoiceMusicOnHold'][_0x6a64('0x40')]({'where':{'id':_0x5589e3[_0x6a64('0x42')]['id']}})[_0x6a64('0x1d')](function(_0x3859f8){if(_0x3859f8){_0x80ebda=_0x3859f8;return _0x3859f8['addSound'](_0x5589e3['body']['id'],{'transaction':_0x659283});}})['then'](function(_0x4ec1b1){if(_0x4ec1b1){return db[_0x6a64('0x57')][_0x6a64('0x58')]({'where':{'id':_0x5589e3['body']['id']},'attributes':['id',_0x6a64('0x24'),'save_name',_0x6a64('0x59'),_0x6a64('0x5a')],'raw':!![]});}})['then'](function(_0x49a07c){if(_0x49a07c){var _0x53d6ea=path[_0x6a64('0x49')](config[_0x6a64('0x4a')],_0x6a64('0x5b'),util[_0x6a64('0x5c')]('%s.%s',path['basename'](_0x49a07c['save_name'],path[_0x6a64('0x5d')](_0x49a07c[_0x6a64('0x5e')])),_0x49a07c[_0x6a64('0x59')]));var _0x301609=path[_0x6a64('0x49')](config[_0x6a64('0x4a')],_0x6a64('0x5f'),_0x80ebda[_0x6a64('0x24')],util[_0x6a64('0x5c')](_0x6a64('0x60'),_0x49a07c[_0x6a64('0x24')],_0x49a07c[_0x6a64('0x59')]));fs[_0x6a64('0x61')](_0x53d6ea,_0x301609);return _0x49a07c;}})[_0x6a64('0x3c')](function(_0x19b7cd){throw new db[(_0x6a64('0x54'))][(_0x6a64('0x55'))](_0x19b7cd[_0x6a64('0x62')]);});})[_0x6a64('0x1d')](handleEntityNotFound(_0x104653,null))['then'](respondWithResult(_0x104653,0xc9))[_0x6a64('0x3c')](handleError(_0x104653,null));};exports[_0x6a64('0x63')]=function(_0x3acf25,_0x360413,_0x1dac2d){return db[_0x6a64('0x44')][_0x6a64('0x45')](function(_0x229bfb){var _0x45d797;return db[_0x6a64('0x26')][_0x6a64('0x58')]({'where':{'id':_0x3acf25[_0x6a64('0x42')]['id']}})[_0x6a64('0x1d')](handleEntityNotFound(_0x360413,null))['then'](function(_0x540610){if(_0x540610){_0x45d797=_0x540610;return _0x540610[_0x6a64('0x63')](_0x3acf25[_0x6a64('0x42')][_0x6a64('0x64')]);}})[_0x6a64('0x1d')](function(_0x51e375){if(_0x51e375){return db[_0x6a64('0x57')][_0x6a64('0x58')]({'where':{'id':_0x3acf25[_0x6a64('0x42')][_0x6a64('0x64')]},'attributes':['id',_0x6a64('0x24'),_0x6a64('0x5e'),_0x6a64('0x59'),'createdAt'],'raw':!![]});}})['then'](function(_0x2a2785){if(_0x2a2785){fs['unlinkSync'](path[_0x6a64('0x49')](_0x45d797['directory'],util['format'](_0x6a64('0x60'),_0x2a2785['name'],_0x2a2785['converted_format'])));return _0x2a2785;}})[_0x6a64('0x3c')](function(_0x1e8869){throw new db['Sequelize'][(_0x6a64('0x55'))](_0x1e8869[_0x6a64('0x62')]);});})[_0x6a64('0x1d')](handleEntityNotFound(_0x360413,null))[_0x6a64('0x1d')](respondWithStatusCode(_0x360413,0xcc))[_0x6a64('0x3c')](handleError(_0x360413,null));};exports[_0x6a64('0x65')]=function(_0x3ac61f,_0x45adf0,_0x201087){var _0x25d276={};var _0x41bd22={};var _0xb2d65d;var _0x498854;return db[_0x6a64('0x26')][_0x6a64('0x58')]({'where':{'id':_0x3ac61f['params']['id']}})['then'](handleEntityNotFound(_0x45adf0,null))[_0x6a64('0x1d')](function(_0x1acd2d){if(_0x1acd2d){_0xb2d65d=_0x1acd2d;_0x41bd22['model']=_['keys'](db[_0x6a64('0x57')][_0x6a64('0x66')]);_0x41bd22[_0x6a64('0x2a')]=_['keys'](_0x3ac61f[_0x6a64('0x2a')]);_0x41bd22['filters']=_[_0x6a64('0x2c')](_0x41bd22['model'],_0x41bd22['query']);_0x25d276[_0x6a64('0x2d')]=_['intersection'](_0x41bd22[_0x6a64('0x29')],qs['fields'](_0x3ac61f[_0x6a64('0x2a')][_0x6a64('0x3e')]));_0x25d276[_0x6a64('0x2d')]=_0x25d276[_0x6a64('0x2d')][_0x6a64('0x3f')]?_0x25d276[_0x6a64('0x2d')]:_0x41bd22[_0x6a64('0x29')];_0x25d276[_0x6a64('0x2f')]=qs[_0x6a64('0x30')](_0x3ac61f[_0x6a64('0x2a')][_0x6a64('0x30')]);_0x25d276[_0x6a64('0x31')]=qs[_0x6a64('0x32')](_['pick'](_0x3ac61f[_0x6a64('0x2a')],_0x41bd22[_0x6a64('0x32')]));if(_0x3ac61f[_0x6a64('0x2a')][_0x6a64('0x34')]){_0x25d276[_0x6a64('0x31')]=_[_0x6a64('0x35')](_0x25d276[_0x6a64('0x31')],{'$or':_[_0x6a64('0x25')](_0x25d276[_0x6a64('0x2d')],function(_0x1bd20c){var _0x24799e={};_0x24799e[_0x1bd20c]={'$like':'%'+_0x3ac61f['query']['filter']+'%'};return _0x24799e;})});}_0x25d276=_['merge']({},_0x25d276,_0x3ac61f[_0x6a64('0x38')]);return _0xb2d65d['getSounds'](_0x25d276);}})[_0x6a64('0x1d')](function(_0x50b5d8){if(_0x50b5d8){_0x498854=_0x50b5d8[_0x6a64('0x3f')];if(!_0x3ac61f[_0x6a64('0x2a')]['hasOwnProperty'](_0x6a64('0x2e'))){_0x25d276['limit']=qs[_0x6a64('0x17')](_0x3ac61f[_0x6a64('0x2a')][_0x6a64('0x17')]);_0x25d276[_0x6a64('0x15')]=qs[_0x6a64('0x15')](_0x3ac61f[_0x6a64('0x2a')][_0x6a64('0x15')]);}return _0xb2d65d['getSounds'](_0x25d276);}})[_0x6a64('0x1d')](function(_0xec87cb){if(_0xec87cb){return _0xec87cb?{'count':_0x498854,'rows':_0xec87cb}:null;}})[_0x6a64('0x1d')](respondWithResult(_0x45adf0,null))[_0x6a64('0x3c')](handleError(_0x45adf0,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index 39aa8ff..a7a4c53 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 _0xf6d7=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','VoiceMusicOnHold'];(function(_0x3653c7,_0x358ba0){var _0x41bdef=function(_0x3de081){while(--_0x3de081){_0x3653c7['push'](_0x3653c7['shift']());}};_0x41bdef(++_0x358ba0);}(_0xf6d7,0x8c));var _0x7f6d=function(_0x185334,_0x4630ac){_0x185334=_0x185334-0x0;var _0xf2e59a=_0xf6d7[_0x185334];return _0xf2e59a;};'use strict';var _=require(_0x7f6d('0x0'));var util=require(_0x7f6d('0x1'));var logger=require(_0x7f6d('0x2'))(_0x7f6d('0x3'));var moment=require(_0x7f6d('0x4'));var BPromise=require(_0x7f6d('0x5'));var rp=require(_0x7f6d('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7f6d('0x7'));var config=require(_0x7f6d('0x8'));var attributes=require('./voiceMusicOnHold.attributes');module['exports']=function(_0x50a73f,_0x59814e){return _0x50a73f['define'](_0x7f6d('0x9'),attributes,{'tableName':'voice_musiconhold','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x85a5=['bluebird','path','rimraf','../../config/environment','./voiceMusicOnHold.attributes','exports','voice_musiconhold','lodash','util','../../config/logger','api','moment'];(function(_0x1f8349,_0x55db28){var _0x3d80ea=function(_0x523600){while(--_0x523600){_0x1f8349['push'](_0x1f8349['shift']());}};_0x3d80ea(++_0x55db28);}(_0x85a5,0xf7));var _0x585a=function(_0x37bee6,_0xa58df8){_0x37bee6=_0x37bee6-0x0;var _0x1bfcf9=_0x85a5[_0x37bee6];return _0x1bfcf9;};'use strict';var _=require(_0x585a('0x0'));var util=require(_0x585a('0x1'));var logger=require(_0x585a('0x2'))(_0x585a('0x3'));var moment=require(_0x585a('0x4'));var BPromise=require(_0x585a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x585a('0x6'));var rimraf=require(_0x585a('0x7'));var config=require(_0x585a('0x8'));var attributes=require(_0x585a('0x9'));module[_0x585a('0xa')]=function(_0x37d28c,_0x38108b){return _0x37d28c['define']('VoiceMusicOnHold',attributes,{'tableName':_0x585a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js index e71c2c9..6612ade 100644 --- a/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js +++ b/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','request','then','request\x20sent','debug','stringify','code','error','message','VoiceMusicOnHold,\x20%s,\x20%s','info','result','catch','moment','bluebird'];(function(_0x207629,_0x26455e){var _0x38d914=function(_0x2a8aa7){while(--_0x2a8aa7){_0x207629['push'](_0x207629['shift']());}};_0x38d914(++_0x26455e);}(_0x9c44,0x178));var _0x49c4=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0x9c44[_0x5d2803];return _0xdcad2c;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x49c4('0x0'));var BPromise=require(_0x49c4('0x1'));var rs=require(_0x49c4('0x2'));var fs=require('fs');var Redis=require(_0x49c4('0x3'));var db=require(_0x49c4('0x4'))['db'];var utils=require(_0x49c4('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x49c4('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x49c4('0x7')][_0x49c4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x69bc41,_0x2c4e2e,_0x436234){return new BPromise(function(_0x511d53,_0x11c586){return client[_0x49c4('0x9')](_0x69bc41,_0x436234)[_0x49c4('0xa')](function(_0x4487ca){logger['info']('VoiceMusicOnHold,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'));logger[_0x49c4('0xc')]('VoiceMusicOnHold,\x20%s,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'),JSON[_0x49c4('0xd')](_0x4487ca));if(_0x4487ca['error']){if(_0x4487ca['error'][_0x49c4('0xe')]===0x1f4){logger[_0x49c4('0xf')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2c4e2e,_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);return _0x11c586(_0x4487ca['error'][_0x49c4('0x10')]);}logger[_0x49c4('0xf')](_0x49c4('0x11'),_0x2c4e2e,_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);return _0x511d53(_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);}else{logger[_0x49c4('0x12')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'));_0x511d53(_0x4487ca[_0x49c4('0x13')][_0x49c4('0x10')]);}})[_0x49c4('0x14')](function(_0x2abc78){logger['error'](_0x49c4('0x11'),_0x2c4e2e,_0x2abc78);_0x11c586(_0x2abc78);});});} \ No newline at end of file +var _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(_0x1cff1f,_0x1cb322){var _0xb13e47=function(_0x3bc5e2){while(--_0x3bc5e2){_0x1cff1f['push'](_0x1cff1f['shift']());}};_0xb13e47(++_0x1cb322);}(_0xe706,0xa3));var _0x6e70=function(_0xa05fd3,_0x4c6517){_0xa05fd3=_0xa05fd3-0x0;var _0x581738=_0xe706[_0xa05fd3];return _0x581738;};'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 4c57a56..5d9d2c8 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 _0xe58a=['index','/describe','describe','getAgents','post','/:id/users','addAgents','put','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./voicePrefix.controller','get','isAuthenticated'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xe58a,0x1d9));var _0xae58=function(_0x2f234b,_0xee7b7b){_0x2f234b=_0x2f234b-0x0;var _0x47c48a=_0xe58a[_0x2f234b];return _0x47c48a;};'use strict';var multer=require('multer');var util=require(_0xae58('0x0'));var path=require(_0xae58('0x1'));var timeout=require(_0xae58('0x2'));var express=require(_0xae58('0x3'));var router=express[_0xae58('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xae58('0x5'));var interaction=require(_0xae58('0x6'));var config=require('../../config/environment');var controller=require(_0xae58('0x7'));router[_0xae58('0x8')]('/',auth[_0xae58('0x9')](),controller[_0xae58('0xa')]);router[_0xae58('0x8')](_0xae58('0xb'),auth[_0xae58('0x9')](),controller[_0xae58('0xc')]);router['get']('/:id',auth[_0xae58('0x9')](),controller['show']);router['get']('/:id/users',auth[_0xae58('0x9')](),controller[_0xae58('0xd')]);router[_0xae58('0xe')]('/',auth[_0xae58('0x9')](),controller['create']);router[_0xae58('0xe')](_0xae58('0xf'),auth[_0xae58('0x9')](),controller[_0xae58('0x10')]);router[_0xae58('0x11')]('/:id',auth[_0xae58('0x9')](),controller['update']);router[_0xae58('0x12')]('/:id',auth['isAuthenticated'](),controller[_0xae58('0x13')]);router[_0xae58('0x12')](_0xae58('0xf'),auth[_0xae58('0x9')](),controller['removeAgents']);module[_0xae58('0x14')]=router; \ No newline at end of file +var _0x7070=['./voicePrefix.controller','get','isAuthenticated','/:id','show','/:id/users','post','create','update','delete','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x521733,_0x4f6812){var _0x2740fb=function(_0x8166ca){while(--_0x8166ca){_0x521733['push'](_0x521733['shift']());}};_0x2740fb(++_0x4f6812);}(_0x7070,0xb6));var _0x0707=function(_0x10b0cf,_0x55da32){_0x10b0cf=_0x10b0cf-0x0;var _0x3ea7d8=_0x7070[_0x10b0cf];return _0x3ea7d8;};'use strict';var multer=require(_0x0707('0x0'));var util=require('util');var path=require(_0x0707('0x1'));var timeout=require(_0x0707('0x2'));var express=require(_0x0707('0x3'));var router=express[_0x0707('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x0707('0x5'));var interaction=require(_0x0707('0x6'));var config=require(_0x0707('0x7'));var controller=require(_0x0707('0x8'));router[_0x0707('0x9')]('/',auth[_0x0707('0xa')](),controller['index']);router[_0x0707('0x9')]('/describe',auth[_0x0707('0xa')](),controller['describe']);router['get'](_0x0707('0xb'),auth[_0x0707('0xa')](),controller[_0x0707('0xc')]);router['get'](_0x0707('0xd'),auth['isAuthenticated'](),controller['getAgents']);router[_0x0707('0xe')]('/',auth['isAuthenticated'](),controller[_0x0707('0xf')]);router[_0x0707('0xe')](_0x0707('0xd'),auth[_0x0707('0xa')](),controller['addAgents']);router['put'](_0x0707('0xb'),auth['isAuthenticated'](),controller[_0x0707('0x10')]);router[_0x0707('0x11')](_0x0707('0xb'),auth[_0x0707('0xa')](),controller['destroy']);router[_0x0707('0x11')]('/:id/users',auth[_0x0707('0xa')](),controller['removeAgents']);module[_0x0707('0x12')]=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index eeccdc5..f93865c 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 _0x1ab6=['VIRTUAL','system-','getDataValue','name','INTEGER','sequelize','exports','STRING'];(function(_0x4109e7,_0x2c8158){var _0x28d807=function(_0x386518){while(--_0x386518){_0x4109e7['push'](_0x4109e7['shift']());}};_0x28d807(++_0x2c8158);}(_0x1ab6,0xed));var _0x61ab=function(_0x45eb4b,_0x3a31cd){_0x45eb4b=_0x45eb4b-0x0;var _0x4f028c=_0x1ab6[_0x45eb4b];return _0x4f028c;};'use strict';var Sequelize=require(_0x61ab('0x0'));module[_0x61ab('0x1')]={'name':{'type':Sequelize[_0x61ab('0x2')],'allowNull':![],'unique':'name'},'prefix':{'type':Sequelize[_0x61ab('0x3')],'get':function(_0x48ed73){return _0x61ab('0x4')+this[_0x61ab('0x5')](_0x61ab('0x6'))+'-';}},'description':{'type':Sequelize[_0x61ab('0x2')]},'callerIdAll':{'type':Sequelize[_0x61ab('0x2')]},'VoiceExtensionId':{'type':Sequelize[_0x61ab('0x7')]}}; \ No newline at end of file +var _0xe919=['sequelize','exports','STRING','name','VIRTUAL','getDataValue'];(function(_0x31c3eb,_0x1c0d6f){var _0x121dc2=function(_0x437c48){while(--_0x437c48){_0x31c3eb['push'](_0x31c3eb['shift']());}};_0x121dc2(++_0x1c0d6f);}(_0xe919,0x192));var _0x9e91=function(_0x3d55a4,_0x57d61b){_0x3d55a4=_0x3d55a4-0x0;var _0x38c5c4=_0xe919[_0x3d55a4];return _0x38c5c4;};'use strict';var Sequelize=require(_0x9e91('0x0'));module[_0x9e91('0x1')]={'name':{'type':Sequelize[_0x9e91('0x2')],'allowNull':![],'unique':_0x9e91('0x3')},'prefix':{'type':Sequelize[_0x9e91('0x4')],'get':function(_0x21d662){return'system-'+this[_0x9e91('0x5')]('name')+'-';}},'description':{'type':Sequelize[_0x9e91('0x2')]},'callerIdAll':{'type':Sequelize[_0x9e91('0x2')]},'VoiceExtensionId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index b1d2f47..6a1b4ba 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 _0xa9e0=['VoicePrefix','includeAll','include','findAll','catch','show','params','find','describe','create','body','get','VoiceExtensionId','user','role','VoicePrefixes','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','from-sip','exten','app','system','description','priority','appdata','NoOp','VoicePrefixId','VoiceExtension','bulkCreate','Extensions\x20creation\x20failed','prefix','push','Set','callerIdAll','PREFIX-CALLERIDALL=','No\x20callerid\x20available','goto','context','${EXTEN:','charAt','sequelize','findById','addAgents','ids','spread','emit','removeAgents','isArray','getAgents','findOne','User','pick','hasOwnProperty','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','./voicePrefix.socket','register','status','offset','undefined','limit','count','set','apply','save','update','then','destroy','UserProfileResource','end','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xa9e0,0x123));var _0x0a9e=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0xa9e0[_0x411add];return _0x238242;};'use strict';var emlformat=require(_0x0a9e('0x0'));var rimraf=require(_0x0a9e('0x1'));var zipdir=require(_0x0a9e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0a9e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0a9e('0x4'));var util=require(_0x0a9e('0x5'));var path=require(_0x0a9e('0x6'));var sox=require(_0x0a9e('0x7'));var csv=require(_0x0a9e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0a9e('0x9'));var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];config[_0x0a9e('0x15')]=_[_0x0a9e('0x16')](config[_0x0a9e('0x15')],{'host':_0x0a9e('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0a9e('0x15')]));require(_0x0a9e('0x18'))[_0x0a9e('0x19')](socket);function respondWithStatusCode(_0x281129,_0x44dcfd){_0x44dcfd=_0x44dcfd||0xcc;return function(_0x4d5611){if(_0x4d5611){return _0x281129['sendStatus'](_0x44dcfd);}return _0x281129[_0x0a9e('0x1a')](_0x44dcfd)['end']();};}function respondWithResult(_0x1985b6,_0x519dfd){_0x519dfd=_0x519dfd||0xc8;return function(_0x16033c){if(_0x16033c){return _0x1985b6[_0x0a9e('0x1a')](_0x519dfd)['json'](_0x16033c);}};}function respondWithFilteredResult(_0x225616,_0x5a0a06){return function(_0x459eb1){if(_0x459eb1){var _0x478723=typeof _0x5a0a06[_0x0a9e('0x1b')]===_0x0a9e('0x1c')&&typeof _0x5a0a06[_0x0a9e('0x1d')]===_0x0a9e('0x1c');var _0x530eb7=_0x459eb1[_0x0a9e('0x1e')];var _0x1314ae=_0x478723?0x0:_0x5a0a06[_0x0a9e('0x1b')];var _0x1c696a=_0x478723?_0x459eb1[_0x0a9e('0x1e')]:_0x5a0a06['offset']+_0x5a0a06[_0x0a9e('0x1d')];var _0x155cce;if(_0x1c696a>=_0x530eb7){_0x1c696a=_0x530eb7;_0x155cce=0xc8;}else{_0x155cce=0xce;}_0x225616['status'](_0x155cce);return _0x225616[_0x0a9e('0x1f')]('Content-Range',_0x1314ae+'-'+_0x1c696a+'/'+_0x530eb7)['json'](_0x459eb1);}return null;};}function patchUpdates(_0x3a02e1){return function(_0x432e56){try{jsonpatch[_0x0a9e('0x20')](_0x432e56,_0x3a02e1,!![]);}catch(_0x30bae6){return BPromise['reject'](_0x30bae6);}return _0x432e56[_0x0a9e('0x21')]();};}function saveUpdates(_0x2fb0e4,_0x3b45bc){return function(_0x4d00e6){if(_0x4d00e6){return _0x4d00e6[_0x0a9e('0x22')](_0x2fb0e4)[_0x0a9e('0x23')](function(_0x16b1ca){return _0x16b1ca;});}return null;};}function removeEntity(_0x5ea472,_0x59181e){return function(_0x197ec0){if(_0x197ec0){return _0x197ec0[_0x0a9e('0x24')]()[_0x0a9e('0x23')](function(){var _0x33161b=_0x197ec0['get']({'plain':!![]});var _0x384319='VoicePrefixes';return db[_0x0a9e('0x25')]['destroy']({'where':{'type':_0x384319,'resourceId':_0x33161b['id']}})[_0x0a9e('0x23')](function(){return _0x197ec0;});})[_0x0a9e('0x23')](function(){_0x5ea472[_0x0a9e('0x1a')](0xcc)[_0x0a9e('0x26')]();});}};}function handleEntityNotFound(_0x140511,_0x1538a4){return function(_0x11c3b6){if(!_0x11c3b6){_0x140511[_0x0a9e('0x27')](0x194);}return _0x11c3b6;};}function handleError(_0x5a101a,_0x3652a7){_0x3652a7=_0x3652a7||0x1f4;return function(_0x468813){logger[_0x0a9e('0x28')](_0x468813[_0x0a9e('0x29')]);if(_0x468813['name']){delete _0x468813[_0x0a9e('0x2a')];}_0x5a101a[_0x0a9e('0x1a')](_0x3652a7)[_0x0a9e('0x2b')](_0x468813);};}exports[_0x0a9e('0x2c')]=function(_0x58b06f,_0x563b45){var _0x296f41={},_0x2e8759={},_0x1dbde2={'count':0x0,'rows':[]};var _0x540530=_[_0x0a9e('0x2d')](db['VoicePrefix'][_0x0a9e('0x2e')],function(_0x3ae878){return{'name':_0x3ae878[_0x0a9e('0x2f')],'type':_0x3ae878[_0x0a9e('0x30')][_0x0a9e('0x31')]};});_0x2e8759['model']=_[_0x0a9e('0x2d')](_0x540530,_0x0a9e('0x2a'));_0x2e8759[_0x0a9e('0x32')]=_[_0x0a9e('0x33')](_0x58b06f[_0x0a9e('0x32')]);_0x2e8759[_0x0a9e('0x34')]=_[_0x0a9e('0x35')](_0x2e8759[_0x0a9e('0x36')],_0x2e8759['query']);_0x296f41[_0x0a9e('0x37')]=_['intersection'](_0x2e8759[_0x0a9e('0x36')],qs[_0x0a9e('0x38')](_0x58b06f[_0x0a9e('0x32')][_0x0a9e('0x38')]));_0x296f41['attributes']=_0x296f41[_0x0a9e('0x37')][_0x0a9e('0x39')]?_0x296f41[_0x0a9e('0x37')]:_0x2e8759[_0x0a9e('0x36')];if(!_0x58b06f['query']['hasOwnProperty'](_0x0a9e('0x3a'))){_0x296f41['limit']=qs[_0x0a9e('0x1d')](_0x58b06f[_0x0a9e('0x32')][_0x0a9e('0x1d')]);_0x296f41[_0x0a9e('0x1b')]=qs['offset'](_0x58b06f[_0x0a9e('0x32')][_0x0a9e('0x1b')]);}_0x296f41[_0x0a9e('0x3b')]=qs['sort'](_0x58b06f[_0x0a9e('0x32')][_0x0a9e('0x3c')]);_0x296f41[_0x0a9e('0x3d')]=qs['filters'](_['pick'](_0x58b06f[_0x0a9e('0x32')],_0x2e8759[_0x0a9e('0x34')]),_0x540530);if(_0x58b06f['query'][_0x0a9e('0x3e')]){_0x296f41[_0x0a9e('0x3d')]=_[_0x0a9e('0x3f')](_0x296f41[_0x0a9e('0x3d')],{'$or':_['map'](_0x540530,function(_0x5a594b){if(_0x5a594b[_0x0a9e('0x30')]!==_0x0a9e('0x40')){var _0x53f3ee={};_0x53f3ee[_0x5a594b[_0x0a9e('0x2a')]]={'$like':'%'+_0x58b06f[_0x0a9e('0x32')][_0x0a9e('0x3e')]+'%'};return _0x53f3ee;}})});}_0x296f41=_['merge']({},_0x296f41,_0x58b06f[_0x0a9e('0x41')]);var _0x2cfea9={'where':_0x296f41[_0x0a9e('0x3d')]};return db[_0x0a9e('0x42')][_0x0a9e('0x1e')](_0x2cfea9)[_0x0a9e('0x23')](function(_0x2881b3){_0x1dbde2[_0x0a9e('0x1e')]=_0x2881b3;if(_0x58b06f[_0x0a9e('0x32')][_0x0a9e('0x43')]){_0x296f41[_0x0a9e('0x44')]=[{'all':!![]}];}return db[_0x0a9e('0x42')][_0x0a9e('0x45')](_0x296f41);})[_0x0a9e('0x23')](function(_0x37f6cc){_0x1dbde2['rows']=_0x37f6cc;return _0x1dbde2;})['then'](respondWithFilteredResult(_0x563b45,_0x296f41))[_0x0a9e('0x46')](handleError(_0x563b45,null));};exports[_0x0a9e('0x47')]=function(_0x405c8f,_0x315881){var _0x1a69dd={'raw':![],'where':{'id':_0x405c8f[_0x0a9e('0x48')]['id']}},_0xc9a702={};_0xc9a702[_0x0a9e('0x36')]=_[_0x0a9e('0x33')](db[_0x0a9e('0x42')][_0x0a9e('0x2e')]);_0xc9a702[_0x0a9e('0x32')]=_['keys'](_0x405c8f[_0x0a9e('0x32')]);_0xc9a702[_0x0a9e('0x34')]=_[_0x0a9e('0x35')](_0xc9a702[_0x0a9e('0x36')],_0xc9a702[_0x0a9e('0x32')]);_0x1a69dd[_0x0a9e('0x37')]=_[_0x0a9e('0x35')](_0xc9a702[_0x0a9e('0x36')],qs['fields'](_0x405c8f[_0x0a9e('0x32')]['fields']));_0x1a69dd[_0x0a9e('0x37')]=_0x1a69dd[_0x0a9e('0x37')][_0x0a9e('0x39')]?_0x1a69dd['attributes']:_0xc9a702[_0x0a9e('0x36')];if(_0x405c8f[_0x0a9e('0x32')][_0x0a9e('0x43')]){_0x1a69dd[_0x0a9e('0x44')]=[{'all':!![]}];}_0x1a69dd=_[_0x0a9e('0x3f')]({},_0x1a69dd,_0x405c8f[_0x0a9e('0x41')]);return db[_0x0a9e('0x42')]['find'](_0x1a69dd)[_0x0a9e('0x23')](handleEntityNotFound(_0x315881,null))[_0x0a9e('0x23')](respondWithResult(_0x315881,null))[_0x0a9e('0x46')](handleError(_0x315881,null));};exports[_0x0a9e('0x24')]=function(_0x409789,_0x992c77){return db[_0x0a9e('0x42')][_0x0a9e('0x49')]({'where':{'id':_0x409789[_0x0a9e('0x48')]['id']}})['then'](handleEntityNotFound(_0x992c77,null))[_0x0a9e('0x23')](removeEntity(_0x992c77,null))[_0x0a9e('0x46')](handleError(_0x992c77,null));};exports['describe']=function(_0x4ae14b,_0x5ddf84){return db[_0x0a9e('0x42')][_0x0a9e('0x4a')]()[_0x0a9e('0x23')](respondWithResult(_0x5ddf84,null))[_0x0a9e('0x46')](handleError(_0x5ddf84,null));};exports[_0x0a9e('0x4b')]=function(_0x30decb,_0x2e5165){var _0x375c18;return db['sequelize']['transaction'](function(_0x53975a){return db[_0x0a9e('0x42')][_0x0a9e('0x4b')](_0x30decb[_0x0a9e('0x4c')],{'transaction':_0x53975a})['then'](function(_0x2b69d9){_0x375c18=_0x2b69d9[_0x0a9e('0x4d')]({'plain':!![]});return db['VoiceExtension']['find']({'where':{'id':_0x375c18[_0x0a9e('0x4e')]},'raw':!![]})['then'](function(_0x443e72){return createVoicePrefixExtensions(_0x375c18,_0x443e72,_0x53975a);});});})['then'](function(){var _0x2e5e62=_0x30decb[_0x0a9e('0x4f')][_0x0a9e('0x4d')]({'plain':!![]});if(!_0x2e5e62)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2e5e62[_0x0a9e('0x50')]===_0x0a9e('0x4f')){var _0x508b47=_0x375c18;return db['UserProfileSection'][_0x0a9e('0x49')]({'where':{'name':_0x0a9e('0x51'),'userProfileId':_0x2e5e62['userProfileId']},'raw':!![]})[_0x0a9e('0x23')](function(_0x5ce9ac){if(_0x5ce9ac&&_0x5ce9ac[_0x0a9e('0x52')]===0x0){return db['UserProfileResource'][_0x0a9e('0x4b')]({'name':_0x508b47['name'],'resourceId':_0x508b47['id'],'type':_0x5ce9ac['name'],'sectionId':_0x5ce9ac['id']},{})['then'](function(){return _0x375c18;});}else{return _0x375c18;}})[_0x0a9e('0x46')](function(_0x47de4c){logger[_0x0a9e('0x28')](_0x0a9e('0x53'),_0x47de4c);throw _0x47de4c;});}return _0x375c18;})[_0x0a9e('0x23')](respondWithResult(_0x2e5165,null))[_0x0a9e('0x46')](handleError(_0x2e5165,null));};function Extension(_0x232830,_0x272738,_0xd10662,_0x28d814){this['context']=_0x0a9e('0x54');this[_0x0a9e('0x55')]=_0x232830;this[_0x0a9e('0x56')]=_0xd10662;this[_0x0a9e('0x30')]=_0x0a9e('0x57');this[_0x0a9e('0x58')]='Voice\x20Prefix\x20Extension';this[_0x0a9e('0x59')]=_0x272738;this[_0x0a9e('0x5a')]=_0x28d814;}function createVoicePrefixExtensions(_0x5239ef,_0x3649cc,_0x5cc8fb){return new BPromise(function(_0x20c668,_0x5ba1f9){var _0x4b3c1a=new Extension(formatPrefixName(_0x5239ef['prefix']),0x1,_0x0a9e('0x5b'),'Voice\x20Prefix');_0x4b3c1a[_0x0a9e('0x5c')]=_0x5239ef['id'];return db[_0x0a9e('0x5d')][_0x0a9e('0x4b')](_0x4b3c1a,{'transaction':_0x5cc8fb})[_0x0a9e('0x23')](function(_0x1cca9f){var _0x26d7db=_0x1cca9f['get']({'plain':!![]});var _0x1627a7=_['map'](addVoicePrefixExtensions(_0x5239ef,_0x3649cc),function(_0xca4ade){_0xca4ade[_0x0a9e('0x4e')]=_0x26d7db['id'];_0xca4ade[_0x0a9e('0x5c')]=_0x5239ef['id'];return _0xca4ade;});return db['VoiceExtension'][_0x0a9e('0x5e')](_0x1627a7,{'transaction':_0x5cc8fb})[_0x0a9e('0x23')](function(_0x119677){if(!_0x119677){return _0x5ba1f9(_0x0a9e('0x5f'));}else{return _0x20c668(_0x119677);}})['catch'](function(_0x1d0dc8){return _0x5ba1f9(_0x1d0dc8);});});;});};function addVoicePrefixExtensions(_0xe05a5a,_0x54327c){var _0x797b45=[];var _0x17e88c=formatPrefixName(_0xe05a5a[_0x0a9e('0x60')]);_0x797b45[_0x0a9e('0x61')](new Extension(_0x17e88c,0x2,_0x0a9e('0x62'),'CDR(prefix)='+_0xe05a5a[_0x0a9e('0x2a')]));if(_0xe05a5a[_0x0a9e('0x63')]){_0x797b45[_0x0a9e('0x61')](new Extension(_0x17e88c,0x3,'Set',_0x0a9e('0x64')+_0xe05a5a['callerIdAll']));}else{_0x797b45['push'](new Extension(_0x17e88c,0x3,_0x0a9e('0x5b'),_0x0a9e('0x65')));}_0x797b45[_0x0a9e('0x61')](new Extension(_0x17e88c,0x4,_0x0a9e('0x66'),_0x54327c[_0x0a9e('0x67')]+','+_0x0a9e('0x68')+(0x8+_0xe05a5a[_0x0a9e('0x2a')][_0x0a9e('0x39')])+'}'+','+0x1));return _0x797b45;}function formatPrefixName(_0x2d7205){var _0x1cc4f3='_';for(var _0x2e89b7=0x0;_0x2e89b7<_0x2d7205[_0x0a9e('0x39')];_0x2e89b7++){if(_0x2d7205[_0x0a9e('0x69')](_0x2e89b7)=='-'){_0x1cc4f3+=_0x2d7205[_0x0a9e('0x69')](_0x2e89b7);}else{_0x1cc4f3+='['+_0x2d7205[_0x0a9e('0x69')](_0x2e89b7)+']';}}_0x1cc4f3+='.';return _0x1cc4f3;}exports[_0x0a9e('0x22')]=function(_0x2a28c0,_0x4257c9,_0x5150a4){var _0x1b0b98=_0x2a28c0[_0x0a9e('0x4c')];_0x1b0b98[_0x0a9e('0x60')]='system-'+_0x1b0b98[_0x0a9e('0x2a')]+'-';return db[_0x0a9e('0x6a')]['transaction'](function(_0x83f0b2){return db[_0x0a9e('0x42')][_0x0a9e('0x22')](_0x1b0b98,{'where':{'id':_0x1b0b98['id']},'transaction':_0x83f0b2})[_0x0a9e('0x23')](function(){return db[_0x0a9e('0x5d')]['destroy']({'where':{'VoicePrefixId':_0x1b0b98['id']},'transaction':_0x83f0b2})['then'](function(){return db['VoiceExtension'][_0x0a9e('0x49')]({'where':{'id':_0x1b0b98[_0x0a9e('0x4e')]},'raw':!![]})[_0x0a9e('0x23')](function(_0x23a7d3){return createVoicePrefixExtensions(_0x1b0b98,_0x23a7d3,_0x83f0b2);});});});})[_0x0a9e('0x23')](function(){return db[_0x0a9e('0x42')][_0x0a9e('0x6b')](_0x1b0b98['id']);})[_0x0a9e('0x23')](respondWithResult(_0x4257c9,null))['catch'](handleError(_0x4257c9,null));};exports[_0x0a9e('0x6c')]=function(_0xcbc8b2,_0x12ccdb,_0x4a4fc7){return db[_0x0a9e('0x42')]['find']({'where':{'id':_0xcbc8b2[_0x0a9e('0x48')]['id']}})[_0x0a9e('0x23')](handleEntityNotFound(_0x12ccdb,null))['then'](function(_0x2ed01e){if(_0x2ed01e){return _0x2ed01e[_0x0a9e('0x6c')](_0xcbc8b2[_0x0a9e('0x4c')][_0x0a9e('0x6d')],_['omit'](_0xcbc8b2[_0x0a9e('0x4c')],[_0x0a9e('0x6d'),'id'])||{})[_0x0a9e('0x6e')](function(_0x278ab4){for(var _0x5b7fc3=0x0;_0x5b7fc3<_0xcbc8b2[_0x0a9e('0x4c')][_0x0a9e('0x6d')][_0x0a9e('0x39')];_0x5b7fc3+=0x1){socket[_0x0a9e('0x6f')]('userVoicePrefix:save',{'UserId':_0xcbc8b2[_0x0a9e('0x4c')][_0x0a9e('0x6d')][_0x5b7fc3],'VoicePrefixId':_0xcbc8b2[_0x0a9e('0x48')]['id']});}return _0x278ab4;});}})[_0x0a9e('0x23')](respondWithResult(_0x12ccdb,null))[_0x0a9e('0x46')](handleError(_0x12ccdb,null));};exports[_0x0a9e('0x70')]=function(_0x40fc56,_0x3df0e3,_0x1a7b03){return db[_0x0a9e('0x42')][_0x0a9e('0x49')]({'where':{'id':_0x40fc56[_0x0a9e('0x48')]['id']}})[_0x0a9e('0x23')](handleEntityNotFound(_0x3df0e3,null))[_0x0a9e('0x23')](function(_0x5b35db){if(_0x5b35db){return _0x5b35db[_0x0a9e('0x70')](_0x40fc56[_0x0a9e('0x32')][_0x0a9e('0x6d')])['then'](function(){if(_[_0x0a9e('0x71')](_0x40fc56[_0x0a9e('0x32')][_0x0a9e('0x6d')])){for(var _0x2b9463=0x0;_0x2b9463<_0x40fc56['query']['ids'][_0x0a9e('0x39')];_0x2b9463+=0x1){socket[_0x0a9e('0x6f')]('userVoicePrefix:remove',{'UserId':Number(_0x40fc56[_0x0a9e('0x32')]['ids'][_0x2b9463]),'VoicePrefixId':Number(_0x40fc56[_0x0a9e('0x48')]['id'])});}}else{socket[_0x0a9e('0x6f')]('userVoicePrefix:remove',{'UserId':Number(_0x40fc56[_0x0a9e('0x32')][_0x0a9e('0x6d')]),'VoicePrefixId':Number(_0x40fc56[_0x0a9e('0x48')]['id'])});}});}})[_0x0a9e('0x23')](respondWithStatusCode(_0x3df0e3,null))[_0x0a9e('0x46')](handleError(_0x3df0e3,null));};exports[_0x0a9e('0x72')]=function(_0x444f1f,_0x482ca2,_0x2973d3){var _0x3ca9b9={};var _0x45c109={};var _0x16e5b9;var _0x492543;return db[_0x0a9e('0x42')][_0x0a9e('0x73')]({'where':{'id':_0x444f1f['params']['id']}})[_0x0a9e('0x23')](handleEntityNotFound(_0x482ca2,null))['then'](function(_0x163710){if(_0x163710){_0x16e5b9=_0x163710;_0x45c109[_0x0a9e('0x36')]=_[_0x0a9e('0x33')](db[_0x0a9e('0x74')]['rawAttributes']);_0x45c109['query']=_[_0x0a9e('0x33')](_0x444f1f[_0x0a9e('0x32')]);_0x45c109[_0x0a9e('0x34')]=_['intersection'](_0x45c109[_0x0a9e('0x36')],_0x45c109[_0x0a9e('0x32')]);_0x3ca9b9['attributes']=_['intersection'](_0x45c109[_0x0a9e('0x36')],qs['fields'](_0x444f1f['query']['fields']));_0x3ca9b9[_0x0a9e('0x37')]=_0x3ca9b9[_0x0a9e('0x37')][_0x0a9e('0x39')]?_0x3ca9b9[_0x0a9e('0x37')]:_0x45c109[_0x0a9e('0x36')];_0x3ca9b9[_0x0a9e('0x3b')]=qs['sort'](_0x444f1f[_0x0a9e('0x32')]['sort']);_0x3ca9b9[_0x0a9e('0x3d')]=qs[_0x0a9e('0x34')](_[_0x0a9e('0x75')](_0x444f1f[_0x0a9e('0x32')],_0x45c109['filters']));if(_0x444f1f[_0x0a9e('0x32')][_0x0a9e('0x3e')]){_0x3ca9b9[_0x0a9e('0x3d')]=_['merge'](_0x3ca9b9[_0x0a9e('0x3d')],{'$or':_[_0x0a9e('0x2d')](_0x3ca9b9[_0x0a9e('0x37')],function(_0x22063c){var _0x255e49={};_0x255e49[_0x22063c]={'$like':'%'+_0x444f1f[_0x0a9e('0x32')][_0x0a9e('0x3e')]+'%'};return _0x255e49;})});}_0x3ca9b9=_[_0x0a9e('0x3f')]({},_0x3ca9b9,_0x444f1f['options']);return _0x16e5b9[_0x0a9e('0x72')](_0x3ca9b9);}})[_0x0a9e('0x23')](function(_0x589ff3){if(_0x589ff3){_0x492543=_0x589ff3[_0x0a9e('0x39')];if(!_0x444f1f[_0x0a9e('0x32')][_0x0a9e('0x76')]('nolimit')){_0x3ca9b9[_0x0a9e('0x1d')]=qs['limit'](_0x444f1f[_0x0a9e('0x32')][_0x0a9e('0x1d')]);_0x3ca9b9[_0x0a9e('0x1b')]=qs[_0x0a9e('0x1b')](_0x444f1f[_0x0a9e('0x32')][_0x0a9e('0x1b')]);}return _0x16e5b9[_0x0a9e('0x72')](_0x3ca9b9);}})[_0x0a9e('0x23')](function(_0x501050){if(_0x501050){return _0x501050?{'count':_0x492543,'rows':_0x501050}:null;}})[_0x0a9e('0x23')](respondWithResult(_0x482ca2,null))[_0x0a9e('0x46')](handleError(_0x482ca2,null));}; \ No newline at end of file +var _0xa9e0=['VoicePrefix','includeAll','include','findAll','catch','show','params','find','describe','create','body','get','VoiceExtensionId','user','role','VoicePrefixes','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','from-sip','exten','app','system','description','priority','appdata','NoOp','VoicePrefixId','VoiceExtension','bulkCreate','Extensions\x20creation\x20failed','prefix','push','Set','callerIdAll','PREFIX-CALLERIDALL=','No\x20callerid\x20available','goto','context','${EXTEN:','charAt','sequelize','findById','addAgents','ids','spread','emit','removeAgents','isArray','getAgents','findOne','User','pick','hasOwnProperty','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','./voicePrefix.socket','register','status','offset','undefined','limit','count','set','apply','save','update','then','destroy','UserProfileResource','end','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0xa9e0[_0x139a3c];return _0x2b375b;};'use strict';var emlformat=require(_0x0a9e('0x0'));var rimraf=require(_0x0a9e('0x1'));var zipdir=require(_0x0a9e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0a9e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0a9e('0x4'));var util=require(_0x0a9e('0x5'));var path=require(_0x0a9e('0x6'));var sox=require(_0x0a9e('0x7'));var csv=require(_0x0a9e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0a9e('0x9'));var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];config[_0x0a9e('0x15')]=_[_0x0a9e('0x16')](config[_0x0a9e('0x15')],{'host':_0x0a9e('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0a9e('0x15')]));require(_0x0a9e('0x18'))[_0x0a9e('0x19')](socket);function respondWithStatusCode(_0x281129,_0x44dcfd){_0x44dcfd=_0x44dcfd||0xcc;return function(_0x4d5611){if(_0x4d5611){return _0x281129['sendStatus'](_0x44dcfd);}return _0x281129[_0x0a9e('0x1a')](_0x44dcfd)['end']();};}function respondWithResult(_0x1985b6,_0x519dfd){_0x519dfd=_0x519dfd||0xc8;return function(_0x16033c){if(_0x16033c){return _0x1985b6[_0x0a9e('0x1a')](_0x519dfd)['json'](_0x16033c);}};}function respondWithFilteredResult(_0x225616,_0x5a0a06){return function(_0x459eb1){if(_0x459eb1){var _0x478723=typeof _0x5a0a06[_0x0a9e('0x1b')]===_0x0a9e('0x1c')&&typeof _0x5a0a06[_0x0a9e('0x1d')]===_0x0a9e('0x1c');var _0x530eb7=_0x459eb1[_0x0a9e('0x1e')];var _0x1314ae=_0x478723?0x0:_0x5a0a06[_0x0a9e('0x1b')];var _0x1c696a=_0x478723?_0x459eb1[_0x0a9e('0x1e')]:_0x5a0a06['offset']+_0x5a0a06[_0x0a9e('0x1d')];var _0x155cce;if(_0x1c696a>=_0x530eb7){_0x1c696a=_0x530eb7;_0x155cce=0xc8;}else{_0x155cce=0xce;}_0x225616['status'](_0x155cce);return _0x225616[_0x0a9e('0x1f')]('Content-Range',_0x1314ae+'-'+_0x1c696a+'/'+_0x530eb7)['json'](_0x459eb1);}return null;};}function patchUpdates(_0x3a02e1){return function(_0x432e56){try{jsonpatch[_0x0a9e('0x20')](_0x432e56,_0x3a02e1,!![]);}catch(_0x30bae6){return BPromise['reject'](_0x30bae6);}return _0x432e56[_0x0a9e('0x21')]();};}function saveUpdates(_0x2fb0e4,_0x3b45bc){return function(_0x4d00e6){if(_0x4d00e6){return _0x4d00e6[_0x0a9e('0x22')](_0x2fb0e4)[_0x0a9e('0x23')](function(_0x16b1ca){return _0x16b1ca;});}return null;};}function removeEntity(_0x5ea472,_0x59181e){return function(_0x197ec0){if(_0x197ec0){return _0x197ec0[_0x0a9e('0x24')]()[_0x0a9e('0x23')](function(){var _0x33161b=_0x197ec0['get']({'plain':!![]});var _0x384319='VoicePrefixes';return db[_0x0a9e('0x25')]['destroy']({'where':{'type':_0x384319,'resourceId':_0x33161b['id']}})[_0x0a9e('0x23')](function(){return _0x197ec0;});})[_0x0a9e('0x23')](function(){_0x5ea472[_0x0a9e('0x1a')](0xcc)[_0x0a9e('0x26')]();});}};}function handleEntityNotFound(_0x140511,_0x1538a4){return function(_0x11c3b6){if(!_0x11c3b6){_0x140511[_0x0a9e('0x27')](0x194);}return _0x11c3b6;};}function handleError(_0x5a101a,_0x3652a7){_0x3652a7=_0x3652a7||0x1f4;return function(_0x468813){logger[_0x0a9e('0x28')](_0x468813[_0x0a9e('0x29')]);if(_0x468813['name']){delete _0x468813[_0x0a9e('0x2a')];}_0x5a101a[_0x0a9e('0x1a')](_0x3652a7)[_0x0a9e('0x2b')](_0x468813);};}exports[_0x0a9e('0x2c')]=function(_0x58b06f,_0x563b45){var _0x296f41={},_0x2e8759={},_0x1dbde2={'count':0x0,'rows':[]};var _0x540530=_[_0x0a9e('0x2d')](db['VoicePrefix'][_0x0a9e('0x2e')],function(_0x3ae878){return{'name':_0x3ae878[_0x0a9e('0x2f')],'type':_0x3ae878[_0x0a9e('0x30')][_0x0a9e('0x31')]};});_0x2e8759['model']=_[_0x0a9e('0x2d')](_0x540530,_0x0a9e('0x2a'));_0x2e8759[_0x0a9e('0x32')]=_[_0x0a9e('0x33')](_0x58b06f[_0x0a9e('0x32')]);_0x2e8759[_0x0a9e('0x34')]=_[_0x0a9e('0x35')](_0x2e8759[_0x0a9e('0x36')],_0x2e8759['query']);_0x296f41[_0x0a9e('0x37')]=_['intersection'](_0x2e8759[_0x0a9e('0x36')],qs[_0x0a9e('0x38')](_0x58b06f[_0x0a9e('0x32')][_0x0a9e('0x38')]));_0x296f41['attributes']=_0x296f41[_0x0a9e('0x37')][_0x0a9e('0x39')]?_0x296f41[_0x0a9e('0x37')]:_0x2e8759[_0x0a9e('0x36')];if(!_0x58b06f['query']['hasOwnProperty'](_0x0a9e('0x3a'))){_0x296f41['limit']=qs[_0x0a9e('0x1d')](_0x58b06f[_0x0a9e('0x32')][_0x0a9e('0x1d')]);_0x296f41[_0x0a9e('0x1b')]=qs['offset'](_0x58b06f[_0x0a9e('0x32')][_0x0a9e('0x1b')]);}_0x296f41[_0x0a9e('0x3b')]=qs['sort'](_0x58b06f[_0x0a9e('0x32')][_0x0a9e('0x3c')]);_0x296f41[_0x0a9e('0x3d')]=qs['filters'](_['pick'](_0x58b06f[_0x0a9e('0x32')],_0x2e8759[_0x0a9e('0x34')]),_0x540530);if(_0x58b06f['query'][_0x0a9e('0x3e')]){_0x296f41[_0x0a9e('0x3d')]=_[_0x0a9e('0x3f')](_0x296f41[_0x0a9e('0x3d')],{'$or':_['map'](_0x540530,function(_0x5a594b){if(_0x5a594b[_0x0a9e('0x30')]!==_0x0a9e('0x40')){var _0x53f3ee={};_0x53f3ee[_0x5a594b[_0x0a9e('0x2a')]]={'$like':'%'+_0x58b06f[_0x0a9e('0x32')][_0x0a9e('0x3e')]+'%'};return _0x53f3ee;}})});}_0x296f41=_['merge']({},_0x296f41,_0x58b06f[_0x0a9e('0x41')]);var _0x2cfea9={'where':_0x296f41[_0x0a9e('0x3d')]};return db[_0x0a9e('0x42')][_0x0a9e('0x1e')](_0x2cfea9)[_0x0a9e('0x23')](function(_0x2881b3){_0x1dbde2[_0x0a9e('0x1e')]=_0x2881b3;if(_0x58b06f[_0x0a9e('0x32')][_0x0a9e('0x43')]){_0x296f41[_0x0a9e('0x44')]=[{'all':!![]}];}return db[_0x0a9e('0x42')][_0x0a9e('0x45')](_0x296f41);})[_0x0a9e('0x23')](function(_0x37f6cc){_0x1dbde2['rows']=_0x37f6cc;return _0x1dbde2;})['then'](respondWithFilteredResult(_0x563b45,_0x296f41))[_0x0a9e('0x46')](handleError(_0x563b45,null));};exports[_0x0a9e('0x47')]=function(_0x405c8f,_0x315881){var _0x1a69dd={'raw':![],'where':{'id':_0x405c8f[_0x0a9e('0x48')]['id']}},_0xc9a702={};_0xc9a702[_0x0a9e('0x36')]=_[_0x0a9e('0x33')](db[_0x0a9e('0x42')][_0x0a9e('0x2e')]);_0xc9a702[_0x0a9e('0x32')]=_['keys'](_0x405c8f[_0x0a9e('0x32')]);_0xc9a702[_0x0a9e('0x34')]=_[_0x0a9e('0x35')](_0xc9a702[_0x0a9e('0x36')],_0xc9a702[_0x0a9e('0x32')]);_0x1a69dd[_0x0a9e('0x37')]=_[_0x0a9e('0x35')](_0xc9a702[_0x0a9e('0x36')],qs['fields'](_0x405c8f[_0x0a9e('0x32')]['fields']));_0x1a69dd[_0x0a9e('0x37')]=_0x1a69dd[_0x0a9e('0x37')][_0x0a9e('0x39')]?_0x1a69dd['attributes']:_0xc9a702[_0x0a9e('0x36')];if(_0x405c8f[_0x0a9e('0x32')][_0x0a9e('0x43')]){_0x1a69dd[_0x0a9e('0x44')]=[{'all':!![]}];}_0x1a69dd=_[_0x0a9e('0x3f')]({},_0x1a69dd,_0x405c8f[_0x0a9e('0x41')]);return db[_0x0a9e('0x42')]['find'](_0x1a69dd)[_0x0a9e('0x23')](handleEntityNotFound(_0x315881,null))[_0x0a9e('0x23')](respondWithResult(_0x315881,null))[_0x0a9e('0x46')](handleError(_0x315881,null));};exports[_0x0a9e('0x24')]=function(_0x409789,_0x992c77){return db[_0x0a9e('0x42')][_0x0a9e('0x49')]({'where':{'id':_0x409789[_0x0a9e('0x48')]['id']}})['then'](handleEntityNotFound(_0x992c77,null))[_0x0a9e('0x23')](removeEntity(_0x992c77,null))[_0x0a9e('0x46')](handleError(_0x992c77,null));};exports['describe']=function(_0x4ae14b,_0x5ddf84){return db[_0x0a9e('0x42')][_0x0a9e('0x4a')]()[_0x0a9e('0x23')](respondWithResult(_0x5ddf84,null))[_0x0a9e('0x46')](handleError(_0x5ddf84,null));};exports[_0x0a9e('0x4b')]=function(_0x30decb,_0x2e5165){var _0x375c18;return db['sequelize']['transaction'](function(_0x53975a){return db[_0x0a9e('0x42')][_0x0a9e('0x4b')](_0x30decb[_0x0a9e('0x4c')],{'transaction':_0x53975a})['then'](function(_0x2b69d9){_0x375c18=_0x2b69d9[_0x0a9e('0x4d')]({'plain':!![]});return db['VoiceExtension']['find']({'where':{'id':_0x375c18[_0x0a9e('0x4e')]},'raw':!![]})['then'](function(_0x443e72){return createVoicePrefixExtensions(_0x375c18,_0x443e72,_0x53975a);});});})['then'](function(){var _0x2e5e62=_0x30decb[_0x0a9e('0x4f')][_0x0a9e('0x4d')]({'plain':!![]});if(!_0x2e5e62)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2e5e62[_0x0a9e('0x50')]===_0x0a9e('0x4f')){var _0x508b47=_0x375c18;return db['UserProfileSection'][_0x0a9e('0x49')]({'where':{'name':_0x0a9e('0x51'),'userProfileId':_0x2e5e62['userProfileId']},'raw':!![]})[_0x0a9e('0x23')](function(_0x5ce9ac){if(_0x5ce9ac&&_0x5ce9ac[_0x0a9e('0x52')]===0x0){return db['UserProfileResource'][_0x0a9e('0x4b')]({'name':_0x508b47['name'],'resourceId':_0x508b47['id'],'type':_0x5ce9ac['name'],'sectionId':_0x5ce9ac['id']},{})['then'](function(){return _0x375c18;});}else{return _0x375c18;}})[_0x0a9e('0x46')](function(_0x47de4c){logger[_0x0a9e('0x28')](_0x0a9e('0x53'),_0x47de4c);throw _0x47de4c;});}return _0x375c18;})[_0x0a9e('0x23')](respondWithResult(_0x2e5165,null))[_0x0a9e('0x46')](handleError(_0x2e5165,null));};function Extension(_0x232830,_0x272738,_0xd10662,_0x28d814){this['context']=_0x0a9e('0x54');this[_0x0a9e('0x55')]=_0x232830;this[_0x0a9e('0x56')]=_0xd10662;this[_0x0a9e('0x30')]=_0x0a9e('0x57');this[_0x0a9e('0x58')]='Voice\x20Prefix\x20Extension';this[_0x0a9e('0x59')]=_0x272738;this[_0x0a9e('0x5a')]=_0x28d814;}function createVoicePrefixExtensions(_0x5239ef,_0x3649cc,_0x5cc8fb){return new BPromise(function(_0x20c668,_0x5ba1f9){var _0x4b3c1a=new Extension(formatPrefixName(_0x5239ef['prefix']),0x1,_0x0a9e('0x5b'),'Voice\x20Prefix');_0x4b3c1a[_0x0a9e('0x5c')]=_0x5239ef['id'];return db[_0x0a9e('0x5d')][_0x0a9e('0x4b')](_0x4b3c1a,{'transaction':_0x5cc8fb})[_0x0a9e('0x23')](function(_0x1cca9f){var _0x26d7db=_0x1cca9f['get']({'plain':!![]});var _0x1627a7=_['map'](addVoicePrefixExtensions(_0x5239ef,_0x3649cc),function(_0xca4ade){_0xca4ade[_0x0a9e('0x4e')]=_0x26d7db['id'];_0xca4ade[_0x0a9e('0x5c')]=_0x5239ef['id'];return _0xca4ade;});return db['VoiceExtension'][_0x0a9e('0x5e')](_0x1627a7,{'transaction':_0x5cc8fb})[_0x0a9e('0x23')](function(_0x119677){if(!_0x119677){return _0x5ba1f9(_0x0a9e('0x5f'));}else{return _0x20c668(_0x119677);}})['catch'](function(_0x1d0dc8){return _0x5ba1f9(_0x1d0dc8);});});;});};function addVoicePrefixExtensions(_0xe05a5a,_0x54327c){var _0x797b45=[];var _0x17e88c=formatPrefixName(_0xe05a5a[_0x0a9e('0x60')]);_0x797b45[_0x0a9e('0x61')](new Extension(_0x17e88c,0x2,_0x0a9e('0x62'),'CDR(prefix)='+_0xe05a5a[_0x0a9e('0x2a')]));if(_0xe05a5a[_0x0a9e('0x63')]){_0x797b45[_0x0a9e('0x61')](new Extension(_0x17e88c,0x3,'Set',_0x0a9e('0x64')+_0xe05a5a['callerIdAll']));}else{_0x797b45['push'](new Extension(_0x17e88c,0x3,_0x0a9e('0x5b'),_0x0a9e('0x65')));}_0x797b45[_0x0a9e('0x61')](new Extension(_0x17e88c,0x4,_0x0a9e('0x66'),_0x54327c[_0x0a9e('0x67')]+','+_0x0a9e('0x68')+(0x8+_0xe05a5a[_0x0a9e('0x2a')][_0x0a9e('0x39')])+'}'+','+0x1));return _0x797b45;}function formatPrefixName(_0x2d7205){var _0x1cc4f3='_';for(var _0x2e89b7=0x0;_0x2e89b7<_0x2d7205[_0x0a9e('0x39')];_0x2e89b7++){if(_0x2d7205[_0x0a9e('0x69')](_0x2e89b7)=='-'){_0x1cc4f3+=_0x2d7205[_0x0a9e('0x69')](_0x2e89b7);}else{_0x1cc4f3+='['+_0x2d7205[_0x0a9e('0x69')](_0x2e89b7)+']';}}_0x1cc4f3+='.';return _0x1cc4f3;}exports[_0x0a9e('0x22')]=function(_0x2a28c0,_0x4257c9,_0x5150a4){var _0x1b0b98=_0x2a28c0[_0x0a9e('0x4c')];_0x1b0b98[_0x0a9e('0x60')]='system-'+_0x1b0b98[_0x0a9e('0x2a')]+'-';return db[_0x0a9e('0x6a')]['transaction'](function(_0x83f0b2){return db[_0x0a9e('0x42')][_0x0a9e('0x22')](_0x1b0b98,{'where':{'id':_0x1b0b98['id']},'transaction':_0x83f0b2})[_0x0a9e('0x23')](function(){return db[_0x0a9e('0x5d')]['destroy']({'where':{'VoicePrefixId':_0x1b0b98['id']},'transaction':_0x83f0b2})['then'](function(){return db['VoiceExtension'][_0x0a9e('0x49')]({'where':{'id':_0x1b0b98[_0x0a9e('0x4e')]},'raw':!![]})[_0x0a9e('0x23')](function(_0x23a7d3){return createVoicePrefixExtensions(_0x1b0b98,_0x23a7d3,_0x83f0b2);});});});})[_0x0a9e('0x23')](function(){return db[_0x0a9e('0x42')][_0x0a9e('0x6b')](_0x1b0b98['id']);})[_0x0a9e('0x23')](respondWithResult(_0x4257c9,null))['catch'](handleError(_0x4257c9,null));};exports[_0x0a9e('0x6c')]=function(_0xcbc8b2,_0x12ccdb,_0x4a4fc7){return db[_0x0a9e('0x42')]['find']({'where':{'id':_0xcbc8b2[_0x0a9e('0x48')]['id']}})[_0x0a9e('0x23')](handleEntityNotFound(_0x12ccdb,null))['then'](function(_0x2ed01e){if(_0x2ed01e){return _0x2ed01e[_0x0a9e('0x6c')](_0xcbc8b2[_0x0a9e('0x4c')][_0x0a9e('0x6d')],_['omit'](_0xcbc8b2[_0x0a9e('0x4c')],[_0x0a9e('0x6d'),'id'])||{})[_0x0a9e('0x6e')](function(_0x278ab4){for(var _0x5b7fc3=0x0;_0x5b7fc3<_0xcbc8b2[_0x0a9e('0x4c')][_0x0a9e('0x6d')][_0x0a9e('0x39')];_0x5b7fc3+=0x1){socket[_0x0a9e('0x6f')]('userVoicePrefix:save',{'UserId':_0xcbc8b2[_0x0a9e('0x4c')][_0x0a9e('0x6d')][_0x5b7fc3],'VoicePrefixId':_0xcbc8b2[_0x0a9e('0x48')]['id']});}return _0x278ab4;});}})[_0x0a9e('0x23')](respondWithResult(_0x12ccdb,null))[_0x0a9e('0x46')](handleError(_0x12ccdb,null));};exports[_0x0a9e('0x70')]=function(_0x40fc56,_0x3df0e3,_0x1a7b03){return db[_0x0a9e('0x42')][_0x0a9e('0x49')]({'where':{'id':_0x40fc56[_0x0a9e('0x48')]['id']}})[_0x0a9e('0x23')](handleEntityNotFound(_0x3df0e3,null))[_0x0a9e('0x23')](function(_0x5b35db){if(_0x5b35db){return _0x5b35db[_0x0a9e('0x70')](_0x40fc56[_0x0a9e('0x32')][_0x0a9e('0x6d')])['then'](function(){if(_[_0x0a9e('0x71')](_0x40fc56[_0x0a9e('0x32')][_0x0a9e('0x6d')])){for(var _0x2b9463=0x0;_0x2b9463<_0x40fc56['query']['ids'][_0x0a9e('0x39')];_0x2b9463+=0x1){socket[_0x0a9e('0x6f')]('userVoicePrefix:remove',{'UserId':Number(_0x40fc56[_0x0a9e('0x32')]['ids'][_0x2b9463]),'VoicePrefixId':Number(_0x40fc56[_0x0a9e('0x48')]['id'])});}}else{socket[_0x0a9e('0x6f')]('userVoicePrefix:remove',{'UserId':Number(_0x40fc56[_0x0a9e('0x32')][_0x0a9e('0x6d')]),'VoicePrefixId':Number(_0x40fc56[_0x0a9e('0x48')]['id'])});}});}})[_0x0a9e('0x23')](respondWithStatusCode(_0x3df0e3,null))[_0x0a9e('0x46')](handleError(_0x3df0e3,null));};exports[_0x0a9e('0x72')]=function(_0x444f1f,_0x482ca2,_0x2973d3){var _0x3ca9b9={};var _0x45c109={};var _0x16e5b9;var _0x492543;return db[_0x0a9e('0x42')][_0x0a9e('0x73')]({'where':{'id':_0x444f1f['params']['id']}})[_0x0a9e('0x23')](handleEntityNotFound(_0x482ca2,null))['then'](function(_0x163710){if(_0x163710){_0x16e5b9=_0x163710;_0x45c109[_0x0a9e('0x36')]=_[_0x0a9e('0x33')](db[_0x0a9e('0x74')]['rawAttributes']);_0x45c109['query']=_[_0x0a9e('0x33')](_0x444f1f[_0x0a9e('0x32')]);_0x45c109[_0x0a9e('0x34')]=_['intersection'](_0x45c109[_0x0a9e('0x36')],_0x45c109[_0x0a9e('0x32')]);_0x3ca9b9['attributes']=_['intersection'](_0x45c109[_0x0a9e('0x36')],qs['fields'](_0x444f1f['query']['fields']));_0x3ca9b9[_0x0a9e('0x37')]=_0x3ca9b9[_0x0a9e('0x37')][_0x0a9e('0x39')]?_0x3ca9b9[_0x0a9e('0x37')]:_0x45c109[_0x0a9e('0x36')];_0x3ca9b9[_0x0a9e('0x3b')]=qs['sort'](_0x444f1f[_0x0a9e('0x32')]['sort']);_0x3ca9b9[_0x0a9e('0x3d')]=qs[_0x0a9e('0x34')](_[_0x0a9e('0x75')](_0x444f1f[_0x0a9e('0x32')],_0x45c109['filters']));if(_0x444f1f[_0x0a9e('0x32')][_0x0a9e('0x3e')]){_0x3ca9b9[_0x0a9e('0x3d')]=_['merge'](_0x3ca9b9[_0x0a9e('0x3d')],{'$or':_[_0x0a9e('0x2d')](_0x3ca9b9[_0x0a9e('0x37')],function(_0x22063c){var _0x255e49={};_0x255e49[_0x22063c]={'$like':'%'+_0x444f1f[_0x0a9e('0x32')][_0x0a9e('0x3e')]+'%'};return _0x255e49;})});}_0x3ca9b9=_[_0x0a9e('0x3f')]({},_0x3ca9b9,_0x444f1f['options']);return _0x16e5b9[_0x0a9e('0x72')](_0x3ca9b9);}})[_0x0a9e('0x23')](function(_0x589ff3){if(_0x589ff3){_0x492543=_0x589ff3[_0x0a9e('0x39')];if(!_0x444f1f[_0x0a9e('0x32')][_0x0a9e('0x76')]('nolimit')){_0x3ca9b9[_0x0a9e('0x1d')]=qs['limit'](_0x444f1f[_0x0a9e('0x32')][_0x0a9e('0x1d')]);_0x3ca9b9[_0x0a9e('0x1b')]=qs[_0x0a9e('0x1b')](_0x444f1f[_0x0a9e('0x32')][_0x0a9e('0x1b')]);}return _0x16e5b9[_0x0a9e('0x72')](_0x3ca9b9);}})[_0x0a9e('0x23')](function(_0x501050){if(_0x501050){return _0x501050?{'count':_0x492543,'rows':_0x501050}:null;}})[_0x0a9e('0x23')](respondWithResult(_0x482ca2,null))[_0x0a9e('0x46')](handleError(_0x482ca2,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index 4080628..7318ae4 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 _0x8e5b=['remove','emit','hasOwnProperty','exports','events','../../mysqldb','VoicePrefix','save','update'];(function(_0xfa52f5,_0x17bd77){var _0x201ec9=function(_0x48fd99){while(--_0x48fd99){_0xfa52f5['push'](_0xfa52f5['shift']());}};_0x201ec9(++_0x17bd77);}(_0x8e5b,0x13f));var _0xb8e5=function(_0x515f2d,_0x15e224){_0x515f2d=_0x515f2d-0x0;var _0x3eba22=_0x8e5b[_0x515f2d];return _0x3eba22;};'use strict';var EventEmitter=require(_0xb8e5('0x0'));var VoicePrefix=require(_0xb8e5('0x1'))['db'][_0xb8e5('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xb8e5('0x3'),'afterUpdate':_0xb8e5('0x4'),'afterDestroy':_0xb8e5('0x5')};function emitEvent(_0x6020e7){return function(_0x119f3b,_0x5e8bee,_0x59a2ce){VoicePrefixEvents['emit'](_0x6020e7+':'+_0x119f3b['id'],_0x119f3b);VoicePrefixEvents[_0xb8e5('0x6')](_0x6020e7,_0x119f3b);_0x59a2ce(null);};}for(var e in events){if(events[_0xb8e5('0x7')](e)){var event=events[e];VoicePrefix['hook'](e,emitEvent(event));}}module[_0xb8e5('0x8')]=VoicePrefixEvents; \ No newline at end of file +var _0xff9f=['update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x226494,_0xc4b645){var _0x27b950=function(_0x3e6acf){while(--_0x3e6acf){_0x226494['push'](_0x226494['shift']());}};_0x27b950(++_0xc4b645);}(_0xff9f,0xa2));var _0xfff9=function(_0x2aefb6,_0x1bd384){_0x2aefb6=_0x2aefb6-0x0;var _0x202772=_0xff9f[_0x2aefb6];return _0x202772;};'use strict';var EventEmitter=require('events');var VoicePrefix=require('../../mysqldb')['db']['VoicePrefix'];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xfff9('0x0'),'afterDestroy':_0xfff9('0x1')};function emitEvent(_0x259ed1){return function(_0xcf9860,_0x36fe58,_0x2bef80){VoicePrefixEvents[_0xfff9('0x2')](_0x259ed1+':'+_0xcf9860['id'],_0xcf9860);VoicePrefixEvents['emit'](_0x259ed1,_0xcf9860);_0x2bef80(null);};}for(var e in events){if(events[_0xfff9('0x3')](e)){var event=events[e];VoicePrefix[_0xfff9('0x4')](e,emitEvent(event));}}module[_0xfff9('0x5')]=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index 2f917ed..369f1d9 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 _0xc61f=['VoicePrefix','voice_prefixes','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voicePrefix.attributes','exports'];(function(_0x2fcc44,_0x5ce1bb){var _0x5c00de=function(_0x2fe9a5){while(--_0x2fe9a5){_0x2fcc44['push'](_0x2fcc44['shift']());}};_0x5c00de(++_0x5ce1bb);}(_0xc61f,0xb8));var _0xfc61=function(_0xcccd92,_0x135e42){_0xcccd92=_0xcccd92-0x0;var _0x34b822=_0xc61f[_0xcccd92];return _0x34b822;};'use strict';var _=require(_0xfc61('0x0'));var util=require(_0xfc61('0x1'));var logger=require(_0xfc61('0x2'))('api');var moment=require(_0xfc61('0x3'));var BPromise=require(_0xfc61('0x4'));var rp=require(_0xfc61('0x5'));var fs=require('fs');var path=require(_0xfc61('0x6'));var rimraf=require(_0xfc61('0x7'));var config=require(_0xfc61('0x8'));var attributes=require(_0xfc61('0x9'));module[_0xfc61('0xa')]=function(_0x19bcea,_0x475efa){return _0x19bcea['define'](_0xfc61('0xb'),attributes,{'tableName':_0xfc61('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0241=['exports','define','VoicePrefix','voice_prefixes','lodash','util','api','bluebird','request-promise','../../config/environment','./voicePrefix.attributes'];(function(_0x72c353,_0x262a4c){var _0x50191d=function(_0x26451a){while(--_0x26451a){_0x72c353['push'](_0x72c353['shift']());}};_0x50191d(++_0x262a4c);}(_0x0241,0x159));var _0x1024=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x0241[_0xfae23b];return _0x200640;};'use strict';var _=require(_0x1024('0x0'));var util=require(_0x1024('0x1'));var logger=require('../../config/logger')(_0x1024('0x2'));var moment=require('moment');var BPromise=require(_0x1024('0x3'));var rp=require(_0x1024('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x1024('0x5'));var attributes=require(_0x1024('0x6'));module[_0x1024('0x7')]=function(_0x5084a6,_0x1fd0fe){return _0x5084a6[_0x1024('0x8')](_0x1024('0x9'),attributes,{'tableName':_0x1024('0xa'),'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 ebf6f07..dc1330e 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 _0x9e2e=['info','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','VoicePrefix,\x20%s,\x20%s','message','result','catch','lodash','util','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','localhost','socket.io-emitter','./voicePrefix.socket','register','request','then'];(function(_0xe6e78c,_0x582369){var _0x2a09c8=function(_0x470ccc){while(--_0x470ccc){_0xe6e78c['push'](_0xe6e78c['shift']());}};_0x2a09c8(++_0x582369);}(_0x9e2e,0xd6));var _0xe9e2=function(_0x16e13b,_0x5684d4){_0x16e13b=_0x16e13b-0x0;var _0x4b5a91=_0x9e2e[_0x16e13b];return _0x4b5a91;};'use strict';var _=require(_0xe9e2('0x0'));var util=require(_0xe9e2('0x1'));var moment=require(_0xe9e2('0x2'));var BPromise=require('bluebird');var rs=require(_0xe9e2('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xe9e2('0x4'));var logger=require(_0xe9e2('0x5'))(_0xe9e2('0x6'));var config=require(_0xe9e2('0x7'));var jayson=require(_0xe9e2('0x8'));var client=jayson[_0xe9e2('0x9')][_0xe9e2('0xa')]({'port':0x232a});config['redis']=_[_0xe9e2('0xb')](config['redis'],{'host':_0xe9e2('0xc'),'port':0x18eb});var socket=require(_0xe9e2('0xd'))(new Redis(config['redis']));require(_0xe9e2('0xe'))[_0xe9e2('0xf')](socket);function respondWithRpcPromise(_0x5d065f,_0x20a3e9,_0xe1c4d3){return new BPromise(function(_0x56264f,_0x53e3c5){return client[_0xe9e2('0x10')](_0x5d065f,_0xe1c4d3)[_0xe9e2('0x11')](function(_0x2e02c8){logger[_0xe9e2('0x12')]('VoicePrefix,\x20%s,\x20%s',_0x20a3e9,'request\x20sent');logger[_0xe9e2('0x13')](_0xe9e2('0x14'),_0x20a3e9,_0xe9e2('0x15'),JSON[_0xe9e2('0x16')](_0x2e02c8));if(_0x2e02c8[_0xe9e2('0x17')]){if(_0x2e02c8[_0xe9e2('0x17')][_0xe9e2('0x18')]===0x1f4){logger[_0xe9e2('0x17')](_0xe9e2('0x19'),_0x20a3e9,_0x2e02c8[_0xe9e2('0x17')]['message']);return _0x53e3c5(_0x2e02c8['error'][_0xe9e2('0x1a')]);}logger['error']('VoicePrefix,\x20%s,\x20%s',_0x20a3e9,_0x2e02c8[_0xe9e2('0x17')][_0xe9e2('0x1a')]);return _0x56264f(_0x2e02c8[_0xe9e2('0x17')][_0xe9e2('0x1a')]);}else{logger[_0xe9e2('0x12')](_0xe9e2('0x19'),_0x20a3e9,'request\x20sent');_0x56264f(_0x2e02c8[_0xe9e2('0x1b')][_0xe9e2('0x1a')]);}})[_0xe9e2('0x1c')](function(_0x5b804f){logger[_0xe9e2('0x17')](_0xe9e2('0x19'),_0x20a3e9,_0x5b804f);_0x53e3c5(_0x5b804f);});});} \ No newline at end of file +var _0x4279=['redis','defaults','socket.io-emitter','./voicePrefix.socket','request','then','info','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','code','VoicePrefix,\x20%s,\x20%s','message','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client'];(function(_0x5925b5,_0x35005c){var _0x5b2ac2=function(_0x5d517e){while(--_0x5d517e){_0x5925b5['push'](_0x5925b5['shift']());}};_0x5b2ac2(++_0x35005c);}(_0x4279,0x8d));var _0x9427=function(_0x44995b,_0x4eb195){_0x44995b=_0x44995b-0x0;var _0x5cf485=_0x4279[_0x44995b];return _0x5cf485;};'use strict';var _=require('lodash');var util=require(_0x9427('0x0'));var moment=require(_0x9427('0x1'));var BPromise=require('bluebird');var rs=require(_0x9427('0x2'));var fs=require('fs');var Redis=require(_0x9427('0x3'));var db=require(_0x9427('0x4'))['db'];var utils=require(_0x9427('0x5'));var logger=require('../../config/logger')(_0x9427('0x6'));var config=require('../../config/environment');var jayson=require(_0x9427('0x7'));var client=jayson[_0x9427('0x8')]['http']({'port':0x232a});config[_0x9427('0x9')]=_[_0x9427('0xa')](config[_0x9427('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x9427('0xb'))(new Redis(config['redis']));require(_0x9427('0xc'))['register'](socket);function respondWithRpcPromise(_0x559a48,_0xc62445,_0x12b94e){return new BPromise(function(_0xfe89e1,_0x2aff5b){return client[_0x9427('0xd')](_0x559a48,_0x12b94e)[_0x9427('0xe')](function(_0x4f1a57){logger[_0x9427('0xf')]('VoicePrefix,\x20%s,\x20%s',_0xc62445,_0x9427('0x10'));logger[_0x9427('0x11')](_0x9427('0x12'),_0xc62445,_0x9427('0x10'),JSON[_0x9427('0x13')](_0x4f1a57));if(_0x4f1a57[_0x9427('0x14')]){if(_0x4f1a57[_0x9427('0x14')][_0x9427('0x15')]===0x1f4){logger[_0x9427('0x14')](_0x9427('0x16'),_0xc62445,_0x4f1a57[_0x9427('0x14')][_0x9427('0x17')]);return _0x2aff5b(_0x4f1a57[_0x9427('0x14')]['message']);}logger[_0x9427('0x14')](_0x9427('0x16'),_0xc62445,_0x4f1a57[_0x9427('0x14')]['message']);return _0xfe89e1(_0x4f1a57['error'][_0x9427('0x17')]);}else{logger['info'](_0x9427('0x16'),_0xc62445,_0x9427('0x10'));_0xfe89e1(_0x4f1a57['result']['message']);}})[_0x9427('0x18')](function(_0xd64381){logger[_0x9427('0x14')](_0x9427('0x16'),_0xc62445,_0xd64381);_0x2aff5b(_0xd64381);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index 232ff8a..e792138 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 _0x2b84=['register','voicePrefix:','./voicePrefix.events','remove','update','emit','removeListener'];(function(_0x4de364,_0x6b4ba){var _0x385173=function(_0x2c5655){while(--_0x2c5655){_0x4de364['push'](_0x4de364['shift']());}};_0x385173(++_0x6b4ba);}(_0x2b84,0x105));var _0x42b8=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0x2b84[_0x491a7f];return _0x3d8f44;};'use strict';var VoicePrefixEvents=require(_0x42b8('0x0'));var events=['save',_0x42b8('0x1'),_0x42b8('0x2')];function createListener(_0x1c2132,_0x2f479c){return function(_0x5b5cec){_0x2f479c[_0x42b8('0x3')](_0x1c2132,_0x5b5cec);};}function removeListener(_0x14cc6b,_0x1561c3){return function(){VoicePrefixEvents[_0x42b8('0x4')](_0x14cc6b,_0x1561c3);};}exports[_0x42b8('0x5')]=function(_0x396739){for(var _0x25b33e=0x0,_0x57e9a=events['length'];_0x25b33e<_0x57e9a;_0x25b33e++){var _0x17bf95=events[_0x25b33e];var _0x57830c=createListener(_0x42b8('0x6')+_0x17bf95,_0x396739);VoicePrefixEvents['on'](_0x17bf95,_0x57830c);}}; \ No newline at end of file +var _0x43b1=['emit','removeListener','register','length','voicePrefix:','./voicePrefix.events','save','remove'];(function(_0x289c1e,_0x1b3421){var _0x58555c=function(_0x581655){while(--_0x581655){_0x289c1e['push'](_0x289c1e['shift']());}};_0x58555c(++_0x1b3421);}(_0x43b1,0x7d));var _0x143b=function(_0x144db2,_0x287210){_0x144db2=_0x144db2-0x0;var _0x434090=_0x43b1[_0x144db2];return _0x434090;};'use strict';var VoicePrefixEvents=require(_0x143b('0x0'));var events=[_0x143b('0x1'),_0x143b('0x2'),'update'];function createListener(_0xb377ea,_0x4976d0){return function(_0x1e1282){_0x4976d0[_0x143b('0x3')](_0xb377ea,_0x1e1282);};}function removeListener(_0x223e86,_0x1552bc){return function(){VoicePrefixEvents[_0x143b('0x4')](_0x223e86,_0x1552bc);};}exports[_0x143b('0x5')]=function(_0x4be3bc){for(var _0x263d20=0x0,_0x2236ae=events[_0x143b('0x6')];_0x263d20<_0x2236ae;_0x263d20++){var _0x519333=events[_0x263d20];var _0x453a09=createListener(_0x143b('0x7')+_0x519333,_0x4be3bc);VoicePrefixEvents['on'](_0x519333,_0x453a09);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index a3693ba..5ff67e8 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 _0xe5f8=['exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./voiceQueue.controller','index','get','/:id','isAuthenticated','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','getHopperFinals','/:id/hopper_black','/:id/teams','getTeams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','getLists','/:id/blacklists','create','clone','addTeams','post','addAgents','addLists','addBlackLists','put','update','delete','destroy','removeTeams','removeLists','removeBlackLists'];(function(_0x4b4d43,_0x1590f7){var _0x5706ba=function(_0x11d99b){while(--_0x11d99b){_0x4b4d43['push'](_0x4b4d43['shift']());}};_0x5706ba(++_0x1590f7);}(_0xe5f8,0xd3));var _0x8e5f=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xe5f8[_0x19950b];return _0x3c6b41;};'use strict';var multer=require(_0x8e5f('0x0'));var util=require('util');var path=require(_0x8e5f('0x1'));var timeout=require(_0x8e5f('0x2'));var express=require(_0x8e5f('0x3'));var router=express[_0x8e5f('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x8e5f('0x5'));var interaction=require(_0x8e5f('0x6'));var config=require('../../config/environment');var controller=require(_0x8e5f('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x8e5f('0x8')]);router[_0x8e5f('0x9')](_0x8e5f('0xa'),auth[_0x8e5f('0xb')](),controller['show']);router[_0x8e5f('0x9')](_0x8e5f('0xc'),auth['isAuthenticated'](),controller[_0x8e5f('0xd')]);router[_0x8e5f('0x9')](_0x8e5f('0xe'),auth[_0x8e5f('0xb')](),controller[_0x8e5f('0xf')]);router['get']('/:id/hopper_finals',auth[_0x8e5f('0xb')](),controller[_0x8e5f('0x10')]);router[_0x8e5f('0x9')](_0x8e5f('0x11'),auth[_0x8e5f('0xb')](),controller['getHopperBlacks']);router[_0x8e5f('0x9')](_0x8e5f('0x12'),auth[_0x8e5f('0xb')](),controller[_0x8e5f('0x13')]);router[_0x8e5f('0x9')](_0x8e5f('0x14'),auth[_0x8e5f('0xb')](),controller[_0x8e5f('0x15')]);router[_0x8e5f('0x9')](_0x8e5f('0x16'),auth[_0x8e5f('0xb')](),controller[_0x8e5f('0x17')]);router[_0x8e5f('0x9')](_0x8e5f('0x18'),auth['isAuthenticated'](),controller[_0x8e5f('0x19')]);router[_0x8e5f('0x9')](_0x8e5f('0x1a'),auth[_0x8e5f('0xb')](),controller['getBlackLists']);router['post']('/',auth[_0x8e5f('0xb')](),controller[_0x8e5f('0x1b')]);router['post']('/:id/clone',auth[_0x8e5f('0xb')](),controller[_0x8e5f('0x1c')]);router['post'](_0x8e5f('0x12'),auth[_0x8e5f('0xb')](),controller[_0x8e5f('0x1d')]);router[_0x8e5f('0x1e')](_0x8e5f('0x14'),auth['isAuthenticated'](),controller[_0x8e5f('0x1f')]);router[_0x8e5f('0x1e')](_0x8e5f('0x18'),auth[_0x8e5f('0xb')](),controller[_0x8e5f('0x20')]);router[_0x8e5f('0x1e')](_0x8e5f('0x1a'),auth[_0x8e5f('0xb')](),controller[_0x8e5f('0x21')]);router[_0x8e5f('0x22')]('/:id',auth[_0x8e5f('0xb')](),controller[_0x8e5f('0x23')]);router[_0x8e5f('0x24')](_0x8e5f('0xa'),auth[_0x8e5f('0xb')](),controller[_0x8e5f('0x25')]);router['delete'](_0x8e5f('0x12'),auth[_0x8e5f('0xb')](),controller[_0x8e5f('0x26')]);router[_0x8e5f('0x24')](_0x8e5f('0x14'),auth[_0x8e5f('0xb')](),controller['removeAgents']);router[_0x8e5f('0x24')](_0x8e5f('0x18'),auth[_0x8e5f('0xb')](),controller[_0x8e5f('0x27')]);router[_0x8e5f('0x24')](_0x8e5f('0x1a'),auth[_0x8e5f('0xb')](),controller[_0x8e5f('0x28')]);module[_0x8e5f('0x29')]=router; \ No newline at end of file +var _0x63b0=['delete','destroy','removeTeams','removeAgents','/:id/lists','removeLists','/:id/blacklists','exports','multer','util','express','fs-extra','get','isAuthenticated','/:id','show','/:id/hoppers','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/teams','getTeams','/:id/users','getAgents','/:id/members','getMembers','getLists','getBlackLists','post','create','/:id/clone','clone','addTeams','addAgents','addLists','addBlackLists','put','update'];(function(_0x5cc961,_0x11c57a){var _0x4aa868=function(_0x589884){while(--_0x589884){_0x5cc961['push'](_0x5cc961['shift']());}};_0x4aa868(++_0x11c57a);}(_0x63b0,0x198));var _0x063b=function(_0x42219a,_0x47ea58){_0x42219a=_0x42219a-0x0;var _0x4bee64=_0x63b0[_0x42219a];return _0x4bee64;};'use strict';var multer=require(_0x063b('0x0'));var util=require(_0x063b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x063b('0x2'));var router=express['Router']();var fs_extra=require(_0x063b('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./voiceQueue.controller');router[_0x063b('0x4')]('/',auth[_0x063b('0x5')](),controller['index']);router[_0x063b('0x4')](_0x063b('0x6'),auth['isAuthenticated'](),controller[_0x063b('0x7')]);router[_0x063b('0x4')](_0x063b('0x8'),auth[_0x063b('0x5')](),controller['getHoppers']);router[_0x063b('0x4')]('/:id/hopper_histories',auth['isAuthenticated'](),controller[_0x063b('0x9')]);router['get'](_0x063b('0xa'),auth[_0x063b('0x5')](),controller[_0x063b('0xb')]);router['get'](_0x063b('0xc'),auth['isAuthenticated'](),controller[_0x063b('0xd')]);router['get'](_0x063b('0xe'),auth[_0x063b('0x5')](),controller[_0x063b('0xf')]);router[_0x063b('0x4')](_0x063b('0x10'),auth['isAuthenticated'](),controller[_0x063b('0x11')]);router[_0x063b('0x4')](_0x063b('0x12'),auth['isAuthenticated'](),controller[_0x063b('0x13')]);router[_0x063b('0x4')]('/:id/lists',auth[_0x063b('0x5')](),controller[_0x063b('0x14')]);router[_0x063b('0x4')]('/:id/blacklists',auth[_0x063b('0x5')](),controller[_0x063b('0x15')]);router[_0x063b('0x16')]('/',auth['isAuthenticated'](),controller[_0x063b('0x17')]);router[_0x063b('0x16')](_0x063b('0x18'),auth[_0x063b('0x5')](),controller[_0x063b('0x19')]);router[_0x063b('0x16')](_0x063b('0xe'),auth[_0x063b('0x5')](),controller[_0x063b('0x1a')]);router[_0x063b('0x16')](_0x063b('0x10'),auth[_0x063b('0x5')](),controller[_0x063b('0x1b')]);router[_0x063b('0x16')]('/:id/lists',auth[_0x063b('0x5')](),controller[_0x063b('0x1c')]);router[_0x063b('0x16')]('/:id/blacklists',auth[_0x063b('0x5')](),controller[_0x063b('0x1d')]);router[_0x063b('0x1e')](_0x063b('0x6'),auth[_0x063b('0x5')](),controller[_0x063b('0x1f')]);router[_0x063b('0x20')](_0x063b('0x6'),auth['isAuthenticated'](),controller[_0x063b('0x21')]);router['delete'](_0x063b('0xe'),auth['isAuthenticated'](),controller[_0x063b('0x22')]);router[_0x063b('0x20')](_0x063b('0x10'),auth[_0x063b('0x5')](),controller[_0x063b('0x23')]);router[_0x063b('0x20')](_0x063b('0x24'),auth[_0x063b('0x5')](),controller[_0x063b('0x25')]);router[_0x063b('0x20')](_0x063b('0x26'),auth['isAuthenticated'](),controller['removeBlackLists']);module[_0x063b('0x27')]=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index 8d328d2..ca485b8 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 _0xb777=['join','joinempty','split','leavewhenempty','acw','wrapuptime','BOOLEAN','preview','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','FLOAT','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','dropRate','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','never','Active/Disactive\x20AMD','#AMD\x20Initial\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)','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','DESC','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','exports','STRING','name','ENUM','outbound','inbound','default','ringall','leastrecent','random','rrmemory','linear','wrandom','setDataValue','strategy','getDataValue','booked','progressive','predictive','power','INTEGER','yes','once','TEXT','periodic_announce'];(function(_0xb7a459,_0xc13228){var _0x104ab5=function(_0x186a0e){while(--_0x186a0e){_0xb7a459['push'](_0xb7a459['shift']());}};_0x104ab5(++_0xc13228);}(_0xb777,0x107));var _0x7b77=function(_0x786e9,_0x1a029){_0x786e9=_0x786e9-0x0;var _0x1f891b=_0xb777[_0x786e9];return _0x1f891b;};'use strict';var Sequelize=require('sequelize');module[_0x7b77('0x0')]={'name':{'type':Sequelize[_0x7b77('0x1')],'allowNull':![],'unique':_0x7b77('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x7b77('0x3')]('inbound',_0x7b77('0x4')),'allowNull':![],'defaultValue':_0x7b77('0x5')},'musiconhold':{'type':Sequelize[_0x7b77('0x1')],'defaultValue':_0x7b77('0x6')},'announce':{'type':Sequelize[_0x7b77('0x1')],'defaultValue':''},'strategy':{'type':Sequelize[_0x7b77('0x3')]('rr',_0x7b77('0x7'),_0x7b77('0x8'),'fewestcalls',_0x7b77('0x9'),_0x7b77('0xa'),_0x7b77('0xb'),_0x7b77('0xc'),'rrordered'),'allowNull':![],'defaultValue':_0x7b77('0x7'),'set':function(_0xa989d6){this[_0x7b77('0xd')](_0x7b77('0xe'),_0xa989d6?_0xa989d6:_0x7b77('0xa'));},'get':function(){var _0x11b601=this['getDataValue']('type');var _0x55e381=this[_0x7b77('0xf')]('dialMethod');var _0x239e7c=this[_0x7b77('0xf')]('strategy');if(_0x11b601===_0x7b77('0x5')){return _0x239e7c;}if(_0x55e381===_0x7b77('0x10')&&_0x239e7c===_0x7b77('0xa')||_0x55e381===_0x7b77('0x10')&&_0x239e7c==='roundrobin'){return _0x239e7c;}if(_0x55e381===_0x7b77('0x11')||_0x55e381===_0x7b77('0x12')||_0x55e381===_0x7b77('0x13')){return _0x239e7c;}return null;}},'servicelevel':{'type':Sequelize[_0x7b77('0x14')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x7b77('0x1')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize['INTEGER'](0xb)},'timeout':{'type':Sequelize[_0x7b77('0x14')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize['STRING']},'weight':{'type':Sequelize[_0x7b77('0x14')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x7b77('0x14')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x7b77('0x3')](_0x7b77('0x15'),'no'),'defaultValue':'yes'},'autopause':{'type':Sequelize['ENUM'](_0x7b77('0x15'),'no','all'),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x7b77('0x14')](0xb)},'autopausebusy':{'type':Sequelize[_0x7b77('0x3')](_0x7b77('0x15'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x7b77('0x3')](_0x7b77('0x15'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x7b77('0x14')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x7b77('0x3')](_0x7b77('0x15'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x7b77('0x3')](_0x7b77('0x15'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x7b77('0x3')]('yes','no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x7b77('0x3')]('yes','no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x7b77('0x1')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x7b77('0x1')],'allowNull':!![]},'announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x7b77('0x14')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x7b77('0x14')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x7b77('0x3')](_0x7b77('0x15'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize['ENUM'](_0x7b77('0x15'),'no'),'defaultValue':_0x7b77('0x15')},'announce_holdtime':{'type':Sequelize[_0x7b77('0x3')](_0x7b77('0x15'),'no',_0x7b77('0x16')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x7b77('0x1')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x7b77('0x3')](_0x7b77('0x15'),'no')},'announce_position_limit':{'type':Sequelize['INTEGER'](0xb)},'announce_round_seconds':{'type':Sequelize[_0x7b77('0x3')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x7b77('0x1')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x7b77('0x1')]},'queue_youarenext':{'type':Sequelize[_0x7b77('0x1')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x7b77('0x1')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize['STRING'],'defaultValue':null},'queue_holdtime':{'type':Sequelize['STRING'],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x7b77('0x1')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x7b77('0x1')],'defaultValue':null},'queue_seconds':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x7b77('0x1')],'defaultValue':null},'queue_reporthold':{'type':Sequelize['STRING']},'queue_quantity1':{'type':Sequelize[_0x7b77('0x1')]},'queue_quantity2':{'type':Sequelize['STRING']},'queue_periodic_announce':{'type':Sequelize[_0x7b77('0x1')]},'queue_less_than':{'type':Sequelize['STRING']},'periodic_announce':{'type':Sequelize[_0x7b77('0x17')],'set':function(_0x17b381){this[_0x7b77('0xd')](_0x7b77('0x18'),_0x17b381?_0x17b381[_0x7b77('0x19')](','):[]);},'get':function(){return this['getDataValue'](_0x7b77('0x18'))?this[_0x7b77('0xf')](_0x7b77('0x18'))['split'](','):[];}},'joinempty':{'type':Sequelize[_0x7b77('0x1')],'defaultValue':_0x7b77('0x15'),'set':function(_0x4c5f56){this[_0x7b77('0xd')](_0x7b77('0x1a'),_0x4c5f56?_0x4c5f56['join'](','):undefined);},'get':function(){return this[_0x7b77('0xf')](_0x7b77('0x1a'))?this['getDataValue']('joinempty')[_0x7b77('0x1b')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x7b77('0x1')],'defaultValue':'no','set':function(_0x1b7448){this['setDataValue']('leavewhenempty',_0x1b7448?_0x1b7448[_0x7b77('0x19')](','):undefined);},'get':function(){return this[_0x7b77('0xf')](_0x7b77('0x1c'))?this[_0x7b77('0xf')](_0x7b77('0x1c'))[_0x7b77('0x1b')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x7b77('0x3')](_0x7b77('0x15'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x7b77('0x3')](_0x7b77('0x15'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x7b77('0x3')](_0x7b77('0x15'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x7b77('0x1')]},'description':{'type':Sequelize[_0x7b77('0x1')]},'acw':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'set':function(_0x204ea0){this[_0x7b77('0xd')](_0x7b77('0x1d'),_0x204ea0);if(_0x204ea0){if(this[_0x7b77('0xf')]('wrapuptime')<0x2){this[_0x7b77('0xd')](_0x7b77('0x1e'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0x7b77('0x14')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x7b77('0x1f')],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'dialMethod':{'type':Sequelize['ENUM'](_0x7b77('0x20'),_0x7b77('0x11'),_0x7b77('0x13'),'predictive',_0x7b77('0x10')),'defaultValue':_0x7b77('0x11'),'comment':'Dial\x20Method.'},'dialLimitChannel':{'type':Sequelize[_0x7b77('0x14')](0x4)[_0x7b77('0x21')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x7b77('0x22')},'dialLimitQueue':{'type':Sequelize[_0x7b77('0x14')](0x4)[_0x7b77('0x21')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.'},'dialPowerLevel':{'type':Sequelize[_0x7b77('0x23')](0x2)['UNSIGNED'],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x7b77('0x24')},'dialPredictiveOptimization':{'type':Sequelize[_0x7b77('0x3')](_0x7b77('0x25'),_0x7b77('0x26')),'defaultValue':_0x7b77('0x26'),'comment':'Only\x20for\x20predictive\x20method.'},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x7b77('0x23')](0x2)[_0x7b77('0x21')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':'Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)'},'dialPredictiveInterval':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':'Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)'},'dialOriginateCallerIdName':{'type':Sequelize[_0x7b77('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0x7b77('0x14')](0x3)[_0x7b77('0x21')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7b77('0x27')},'dialQueueOptions':{'type':Sequelize[_0x7b77('0x1')],'defaultValue':'tTxX','comment':_0x7b77('0x28')},'dialQueueTimeout':{'type':Sequelize['INTEGER'](0x3)[_0x7b77('0x21')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7b77('0x29')},'dialQueueProject':{'type':Sequelize['STRING'],'comment':_0x7b77('0x2a')},'dialCongestionMaxRetry':{'type':Sequelize[_0x7b77('0x14')](0x3)[_0x7b77('0x21')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7b77('0x2b')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x7b77('0x14')](0x5)[_0x7b77('0x21')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7b77('0x2c')},'dialBusyMaxRetry':{'type':Sequelize[_0x7b77('0x14')](0x3)[_0x7b77('0x21')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7b77('0x2d')},'dialBusyRetryFrequency':{'type':Sequelize[_0x7b77('0x14')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7b77('0x2e')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x7b77('0x14')](0x3)[_0x7b77('0x21')],'defaultValue':0x3,'comment':_0x7b77('0x2f')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x7b77('0x14')](0x5)[_0x7b77('0x21')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize[_0x7b77('0x14')](0x3)[_0x7b77('0x21')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x7b77('0x30')},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x7b77('0x1')],'defaultValue':'07:00-22:00,*,*,*'},'dialPrefix':{'type':Sequelize[_0x7b77('0x1')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x7b77('0x3')]('always',_0x7b77('0x31'),'onlyIfOpen'),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0x7b77('0x1f')],'defaultValue':0x0,'comment':_0x7b77('0x32')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0x7b77('0x21')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x7b77('0x33')},'dialAMDGreeting':{'type':Sequelize[_0x7b77('0x14')](0x9)[_0x7b77('0x21')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x7b77('0x14')](0x9)[_0x7b77('0x21')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x7b77('0x34')},'dialAMDMinWordLength':{'type':Sequelize[_0x7b77('0x14')](0x9)[_0x7b77('0x21')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x7b77('0x35')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x7b77('0x14')](0x9)[_0x7b77('0x21')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x7b77('0x36')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x7b77('0x14')](0x9)[_0x7b77('0x21')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x7b77('0x37')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x7b77('0x14')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x7b77('0x38')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x7b77('0x14')](0x9)[_0x7b77('0x21')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialRecallMeTimeout':{'type':Sequelize[_0x7b77('0x14')](0x5)[_0x7b77('0x21')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x7b77('0x39')},'dialRecallInQueue':{'type':Sequelize[_0x7b77('0x1f')],'defaultValue':0x0,'comment':_0x7b77('0x3a')},'dialOrderByScheduledAt':{'type':Sequelize[_0x7b77('0x3')](_0x7b77('0x3b'),'ASC'),'defaultValue':_0x7b77('0x3b')},'dialQueueProject2':{'type':Sequelize[_0x7b77('0x1')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialAgiAfterHangupClient':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x7b77('0x1f')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize[_0x7b77('0x14')](0x3)[_0x7b77('0x21')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x7b77('0x3c')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x7b77('0x14')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7b77('0x3d')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x7b77('0x14')](0x5)[_0x7b77('0x21')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7b77('0x3e')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7b77('0x3f')},'dialDropRetryFrequency':{'type':Sequelize[_0x7b77('0x14')](0x5)[_0x7b77('0x21')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7b77('0x40')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x7b77('0x14')](0x3)[_0x7b77('0x21')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7b77('0x41')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x7b77('0x14')](0x5)[_0x7b77('0x21')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7b77('0x42')},'dialMachineMaxRetry':{'type':Sequelize[_0x7b77('0x14')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7b77('0x43')},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7b77('0x44')},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7b77('0x45')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x7b77('0x14')](0x5)[_0x7b77('0x21')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'mandatoryDispositionPauseId':{'type':Sequelize[_0x7b77('0x14')],'allowNull':!![],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x7b77('0x46'),'set':function(_0x109f67){if(!_0x109f67)this[_0x7b77('0xd')](_0x7b77('0x47'),null);this[_0x7b77('0xd')]('mandatoryDisposition',_0x109f67);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x7b77('0x14')](0x3)[_0x7b77('0x21')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x7b77('0x14')](0x3)[_0x7b77('0x21')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}}}; \ No newline at end of file +var _0x6dfa=['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\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','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','ASC','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','name','ENUM','outbound','ringall','leastrecent','fewestcalls','random','rrmemory','linear','wrandom','rrordered','setDataValue','strategy','getDataValue','dialMethod','inbound','booked','roundrobin','predictive','power','INTEGER','yes','once','TEXT','join','periodic_announce','joinempty','leavewhenempty','split','BOOLEAN','acw','wrapuptime','Active/Disactive\x20Campaign','preview','progressive','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','dropRate'];(function(_0x1680fd,_0x2f538c){var _0x70333e=function(_0x2123cd){while(--_0x2123cd){_0x1680fd['push'](_0x1680fd['shift']());}};_0x70333e(++_0x2f538c);}(_0x6dfa,0x7b));var _0xa6df=function(_0x58f509,_0x3837eb){_0x58f509=_0x58f509-0x0;var _0x2b63de=_0x6dfa[_0x58f509];return _0x2b63de;};'use strict';var Sequelize=require(_0xa6df('0x0'));module[_0xa6df('0x1')]={'name':{'type':Sequelize[_0xa6df('0x2')],'allowNull':![],'unique':_0xa6df('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xa6df('0x4')]('inbound',_0xa6df('0x5')),'allowNull':![],'defaultValue':'inbound'},'musiconhold':{'type':Sequelize[_0xa6df('0x2')],'defaultValue':'default'},'announce':{'type':Sequelize['STRING'],'defaultValue':''},'strategy':{'type':Sequelize[_0xa6df('0x4')]('rr',_0xa6df('0x6'),_0xa6df('0x7'),_0xa6df('0x8'),_0xa6df('0x9'),_0xa6df('0xa'),_0xa6df('0xb'),_0xa6df('0xc'),_0xa6df('0xd')),'allowNull':![],'defaultValue':_0xa6df('0x6'),'set':function(_0x5f4ddb){this[_0xa6df('0xe')](_0xa6df('0xf'),_0x5f4ddb?_0x5f4ddb:_0xa6df('0xa'));},'get':function(){var _0x594e9c=this[_0xa6df('0x10')]('type');var _0x1b33e4=this[_0xa6df('0x10')](_0xa6df('0x11'));var _0x3de1c0=this['getDataValue'](_0xa6df('0xf'));if(_0x594e9c===_0xa6df('0x12')){return _0x3de1c0;}if(_0x1b33e4===_0xa6df('0x13')&&_0x3de1c0===_0xa6df('0xa')||_0x1b33e4===_0xa6df('0x13')&&_0x3de1c0===_0xa6df('0x14')){return _0x3de1c0;}if(_0x1b33e4==='progressive'||_0x1b33e4===_0xa6df('0x15')||_0x1b33e4===_0xa6df('0x16')){return _0x3de1c0;}return null;}},'servicelevel':{'type':Sequelize[_0xa6df('0x17')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0xa6df('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize['INTEGER'](0xb)},'timeout':{'type':Sequelize[_0xa6df('0x17')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0xa6df('0x17')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0xa6df('0x2')]},'weight':{'type':Sequelize[_0xa6df('0x17')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0xa6df('0x17')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize['ENUM'](_0xa6df('0x18'),'no'),'defaultValue':_0xa6df('0x18')},'autopause':{'type':Sequelize[_0xa6df('0x4')](_0xa6df('0x18'),'no','all'),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0xa6df('0x17')](0xb)},'autopausebusy':{'type':Sequelize[_0xa6df('0x4')](_0xa6df('0x18'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0xa6df('0x4')]('yes','no'),'defaultValue':'no'},'maxlen':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0xa6df('0x4')]('yes','no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0xa6df('0x4')](_0xa6df('0x18'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0xa6df('0x4')](_0xa6df('0x18'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0xa6df('0x4')]('yes','no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0xa6df('0x2')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0xa6df('0x2')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0xa6df('0x17')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0xa6df('0x17')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0xa6df('0x17')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0xa6df('0x4')]('yes','no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize['ENUM'](_0xa6df('0x18'),'no'),'defaultValue':_0xa6df('0x18')},'announce_holdtime':{'type':Sequelize[_0xa6df('0x4')](_0xa6df('0x18'),'no',_0xa6df('0x19')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0xa6df('0x2')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize['ENUM']('yes','no')},'announce_position_limit':{'type':Sequelize[_0xa6df('0x17')](0xb)},'announce_round_seconds':{'type':Sequelize[_0xa6df('0x4')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0xa6df('0x2')],'defaultValue':''},'monitor_type':{'type':Sequelize['STRING']},'queue_youarenext':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thereare':{'type':Sequelize['STRING'],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0xa6df('0x2')],'defaultValue':null},'queue_holdtime':{'type':Sequelize['STRING'],'defaultValue':null},'queue_minute':{'type':Sequelize[_0xa6df('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0xa6df('0x2')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0xa6df('0x2')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0xa6df('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0xa6df('0x2')]},'queue_quantity1':{'type':Sequelize[_0xa6df('0x2')]},'queue_quantity2':{'type':Sequelize['STRING']},'queue_periodic_announce':{'type':Sequelize[_0xa6df('0x2')]},'queue_less_than':{'type':Sequelize[_0xa6df('0x2')]},'periodic_announce':{'type':Sequelize[_0xa6df('0x1a')],'set':function(_0x1257b2){this[_0xa6df('0xe')]('periodic_announce',_0x1257b2?_0x1257b2[_0xa6df('0x1b')](','):[]);},'get':function(){return this[_0xa6df('0x10')]('periodic_announce')?this[_0xa6df('0x10')](_0xa6df('0x1c'))['split'](','):[];}},'joinempty':{'type':Sequelize[_0xa6df('0x2')],'defaultValue':_0xa6df('0x18'),'set':function(_0x20ed33){this[_0xa6df('0xe')](_0xa6df('0x1d'),_0x20ed33?_0x20ed33['join'](','):undefined);},'get':function(){return this[_0xa6df('0x10')](_0xa6df('0x1d'))?this[_0xa6df('0x10')](_0xa6df('0x1d'))['split'](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0xa6df('0x2')],'defaultValue':'no','set':function(_0x58102d){this[_0xa6df('0xe')](_0xa6df('0x1e'),_0x58102d?_0x58102d[_0xa6df('0x1b')](','):undefined);},'get':function(){return this[_0xa6df('0x10')](_0xa6df('0x1e'))?this[_0xa6df('0x10')](_0xa6df('0x1e'))[_0xa6df('0x1f')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0xa6df('0x4')](_0xa6df('0x18'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0xa6df('0x4')]('yes','no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0xa6df('0x4')](_0xa6df('0x18'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0xa6df('0x2')]},'description':{'type':Sequelize[_0xa6df('0x2')]},'acw':{'type':Sequelize[_0xa6df('0x20')],'defaultValue':0x0,'set':function(_0x4e2d03){this[_0xa6df('0xe')](_0xa6df('0x21'),_0x4e2d03);if(_0x4e2d03){if(this[_0xa6df('0x10')](_0xa6df('0x22'))<0x2){this[_0xa6df('0xe')]('wrapuptime',0x2);}}}},'acwTimeout':{'type':Sequelize[_0xa6df('0x17')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0xa6df('0x20')],'defaultValue':0x0,'comment':_0xa6df('0x23')},'dialMethod':{'type':Sequelize['ENUM'](_0xa6df('0x24'),'progressive','power','predictive',_0xa6df('0x13')),'defaultValue':_0xa6df('0x25'),'comment':'Dial\x20Method.'},'dialLimitChannel':{'type':Sequelize['INTEGER'](0x4)[_0xa6df('0x26')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xa6df('0x27')},'dialLimitQueue':{'type':Sequelize[_0xa6df('0x17')](0x4)[_0xa6df('0x26')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xa6df('0x28')},'dialPowerLevel':{'type':Sequelize['FLOAT'](0x2)[_0xa6df('0x26')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0xa6df('0x29')},'dialPredictiveOptimization':{'type':Sequelize[_0xa6df('0x4')]('agentBusyFactor',_0xa6df('0x2a')),'defaultValue':_0xa6df('0x2a'),'comment':_0xa6df('0x2b')},'dialPredictiveOptimizationPercentage':{'type':Sequelize['FLOAT'](0x2)[_0xa6df('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':'Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)'},'dialPredictiveInterval':{'type':Sequelize[_0xa6df('0x17')](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0xa6df('0x2c')},'dialOriginateCallerIdName':{'type':Sequelize[_0xa6df('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xa6df('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0xa6df('0x17')](0x3)[_0xa6df('0x26')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa6df('0x2d')},'dialQueueOptions':{'type':Sequelize[_0xa6df('0x2')],'defaultValue':'tTxX','comment':_0xa6df('0x2e')},'dialQueueTimeout':{'type':Sequelize[_0xa6df('0x17')](0x3)[_0xa6df('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueProject':{'type':Sequelize[_0xa6df('0x2')],'comment':_0xa6df('0x2f')},'dialCongestionMaxRetry':{'type':Sequelize[_0xa6df('0x17')](0x3)[_0xa6df('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa6df('0x30')},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xa6df('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa6df('0x31')},'dialBusyMaxRetry':{'type':Sequelize[_0xa6df('0x17')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xa6df('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa6df('0x32')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xa6df('0x17')](0x3)[_0xa6df('0x26')],'defaultValue':0x3,'comment':_0xa6df('0x33')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xa6df('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa6df('0x34')},'dialGlobalMaxRetry':{'type':Sequelize[_0xa6df('0x17')](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xa6df('0x2')],'defaultValue':_0xa6df('0x35')},'dialPrefix':{'type':Sequelize[_0xa6df('0x2')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0xa6df('0x36'),'never',_0xa6df('0x37')),'defaultValue':_0xa6df('0x36')},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0xa6df('0x38')},'dialAMDInitialSilence':{'type':Sequelize[_0xa6df('0x17')](0x9)[_0xa6df('0x26')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xa6df('0x39')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)[_0xa6df('0x26')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xa6df('0x3a')},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xa6df('0x17')](0x9)[_0xa6df('0x26')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xa6df('0x3b')},'dialAMDMinWordLength':{'type':Sequelize[_0xa6df('0x17')](0x9)[_0xa6df('0x26')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xa6df('0x3c')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)[_0xa6df('0x26')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xa6df('0x3d')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xa6df('0x17')](0x9)[_0xa6df('0x26')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xa6df('0x3e')},'dialAMDSilenceThreshold':{'type':Sequelize[_0xa6df('0x17')](0x5)[_0xa6df('0x26')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xa6df('0x3f')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xa6df('0x17')](0x9)[_0xa6df('0x26')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xa6df('0x40')},'dialRecallMeTimeout':{'type':Sequelize[_0xa6df('0x17')](0x5)[_0xa6df('0x26')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0xa6df('0x41')},'dialRecallInQueue':{'type':Sequelize[_0xa6df('0x20')],'defaultValue':0x0,'comment':_0xa6df('0x42')},'dialOrderByScheduledAt':{'type':Sequelize[_0xa6df('0x4')]('DESC',_0xa6df('0x43')),'defaultValue':_0xa6df('0x44')},'dialQueueProject2':{'type':Sequelize[_0xa6df('0x2')],'comment':_0xa6df('0x2f')},'dialAgiAfterHangupClient':{'type':Sequelize[_0xa6df('0x20')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0xa6df('0x20')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xa6df('0x17')](0x3)[_0xa6df('0x26')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xa6df('0x45')},'dialCutDigit':{'type':Sequelize[_0xa6df('0x17')](0x3)[_0xa6df('0x26')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xa6df('0x17')](0x3)[_0xa6df('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa6df('0x46')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xa6df('0x17')](0x5)[_0xa6df('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize[_0xa6df('0x17')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa6df('0x47')},'dialDropRetryFrequency':{'type':Sequelize[_0xa6df('0x17')](0x5)[_0xa6df('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa6df('0x48')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xa6df('0x17')](0x3)[_0xa6df('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa6df('0x49')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xa6df('0x17')](0x5)[_0xa6df('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa6df('0x4a')},'dialMachineMaxRetry':{'type':Sequelize[_0xa6df('0x17')](0x3)[_0xa6df('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa6df('0x4b')},'dialMachineRetryFrequency':{'type':Sequelize[_0xa6df('0x17')](0x5)[_0xa6df('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa6df('0x4c')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xa6df('0x17')](0x3)[_0xa6df('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa6df('0x4d')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xa6df('0x17')](0x5)[_0xa6df('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa6df('0x4e')},'mandatoryDispositionPauseId':{'type':Sequelize[_0xa6df('0x17')],'allowNull':!![],'comment':_0xa6df('0x4f')},'mandatoryDisposition':{'type':Sequelize[_0xa6df('0x20')],'defaultValue':![],'comment':_0xa6df('0x50'),'set':function(_0x5db762){if(!_0x5db762)this[_0xa6df('0xe')](_0xa6df('0x51'),null);this[_0xa6df('0xe')](_0xa6df('0x52'),_0x5db762);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0xa6df('0x17')](0x3)[_0xa6df('0x26')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize['INTEGER'](0x3)[_0xa6df('0x26')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index c28608a..f0b6d54 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 _0xb230=['getAgents','getMembers','getLists','CmList','addLists','spread','dialCheckDuplicateType','always','insert','cm_hopper','fromQuery','phone','ContactId','ListId','field','NOW()','scheduledAt','CmListId','from','cm_contacts','deletedAt\x20IS\x20NULL','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','COALESCE(phone,\x27\x27)','onlyIfOpen','into','ListId\x20=\x20?','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','register','sendStatus','status','end','json','undefined','limit','count','offset','set','apply','save','then','destroy','get','inbound','QueueCampaigns','outbound','filter','value','type','name','UserProfileResource','error','stack','send','index','VoiceQueue','rawAttributes','fieldName','map','query','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','findAll','catch','show','params','keys','fields','includeAll','include','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','VoiceQueues','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','userProfileId','update','getHoppers','findOne','CmHopper','order','rows','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','VoiceQueueId','getHopperBlacks','CmHopperBlack','getTeams','Team','addTeams','teams','User','Agents','voicePause','interface','flatMap','forEach','penalty','sequelize','each','TeamVoiceQueue','findOrCreate','UserVoiceQueueRt','format','SIP/%s','emit','userVoiceQueue:save','removeTeams','ids','select','tq.TeamId','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','toString','QueryTypes','TeamId','includes','all','compact','transaction','isEmpty','removeAgents','userVoiceQueue:remove','addAgents','online','push','upsert','isArray'];(function(_0x48dd5d,_0x42dd6b){var _0x347e6a=function(_0x2d375b){while(--_0x2d375b){_0x48dd5d['push'](_0x48dd5d['shift']());}};_0x347e6a(++_0x42dd6b);}(_0xb230,0xde));var _0x0b23=function(_0x1ba096,_0x102b0f){_0x1ba096=_0x1ba096-0x0;var _0x85e660=_0xb230[_0x1ba096];return _0x85e660;};'use strict';var emlformat=require(_0x0b23('0x0'));var rimraf=require(_0x0b23('0x1'));var zipdir=require(_0x0b23('0x2'));var jsonpatch=require(_0x0b23('0x3'));var rp=require(_0x0b23('0x4'));var moment=require(_0x0b23('0x5'));var BPromise=require(_0x0b23('0x6'));var Mustache=require(_0x0b23('0x7'));var util=require(_0x0b23('0x8'));var path=require(_0x0b23('0x9'));var sox=require(_0x0b23('0xa'));var csv=require(_0x0b23('0xb'));var ejs=require(_0x0b23('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0b23('0xd'));var squel=require(_0x0b23('0xe'));var crypto=require(_0x0b23('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x0b23('0x10'));var toCsv=require(_0x0b23('0xb'));var querystring=require(_0x0b23('0x11'));var Papa=require(_0x0b23('0x12'));var Redis=require(_0x0b23('0x13'));var authService=require(_0x0b23('0x14'));var qs=require(_0x0b23('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0b23('0x16'));var logger=require(_0x0b23('0x17'))(_0x0b23('0x18'));var utils=require(_0x0b23('0x19'));var config=require(_0x0b23('0x1a'));var licenseUtil=require(_0x0b23('0x1b'));var db=require(_0x0b23('0x1c'))['db'];config[_0x0b23('0x1d')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./voiceQueue.socket')[_0x0b23('0x1e')](socket);function respondWithStatusCode(_0x1858c2,_0x55b432){_0x55b432=_0x55b432||0xcc;return function(_0x3f7174){if(_0x3f7174){return _0x1858c2[_0x0b23('0x1f')](_0x55b432);}return _0x1858c2[_0x0b23('0x20')](_0x55b432)[_0x0b23('0x21')]();};}function respondWithResult(_0x5f562e,_0x4975f6){_0x4975f6=_0x4975f6||0xc8;return function(_0x298888){if(_0x298888){return _0x5f562e[_0x0b23('0x20')](_0x4975f6)[_0x0b23('0x22')](_0x298888);}};}function respondWithFilteredResult(_0x34697d,_0x42f67f){return function(_0x512795){if(_0x512795){var _0x188adb=typeof _0x42f67f['offset']===_0x0b23('0x23')&&typeof _0x42f67f[_0x0b23('0x24')]===_0x0b23('0x23');var _0xa56891=_0x512795[_0x0b23('0x25')];var _0x157116=_0x188adb?0x0:_0x42f67f[_0x0b23('0x26')];var _0x5e5fdd=_0x188adb?_0x512795[_0x0b23('0x25')]:_0x42f67f[_0x0b23('0x26')]+_0x42f67f['limit'];var _0x54ac6c;if(_0x5e5fdd>=_0xa56891){_0x5e5fdd=_0xa56891;_0x54ac6c=0xc8;}else{_0x54ac6c=0xce;}_0x34697d['status'](_0x54ac6c);return _0x34697d[_0x0b23('0x27')]('Content-Range',_0x157116+'-'+_0x5e5fdd+'/'+_0xa56891)[_0x0b23('0x22')](_0x512795);}return null;};}function patchUpdates(_0x35c26b){return function(_0x2e6f9c){try{jsonpatch[_0x0b23('0x28')](_0x2e6f9c,_0x35c26b,!![]);}catch(_0x469ba8){return BPromise['reject'](_0x469ba8);}return _0x2e6f9c[_0x0b23('0x29')]();};}function saveUpdates(_0x5ea371,_0x197b37){return function(_0x12576c){if(_0x12576c){return _0x12576c['update'](_0x5ea371)[_0x0b23('0x2a')](function(_0xfe7d5b){return _0xfe7d5b;});}return null;};}function removeEntity(_0x21ddf1,_0x19b799){return function(_0xa10714){if(_0xa10714){return _0xa10714[_0x0b23('0x2b')]()[_0x0b23('0x2a')](function(){var _0x34ca2f=_0xa10714[_0x0b23('0x2c')]({'plain':!![]});var _0x549d89=[{'name':'VoiceQueues','value':_0x0b23('0x2d'),'ignore':![]},{'name':_0x0b23('0x2e'),'value':_0x0b23('0x2f'),'ignore':![]}];var _0x92d9d8=_(_0x549d89)[_0x0b23('0x30')]('ignore')['map'](_0x0b23('0x31'))[_0x0b23('0x31')]();if(_['includes'](_0x92d9d8,_0x34ca2f[_0x0b23('0x32')])){return;}var _0x27f055=_['find'](_0x549d89,[_0x0b23('0x31'),_0x34ca2f[_0x0b23('0x32')]])[_0x0b23('0x33')];return db[_0x0b23('0x34')][_0x0b23('0x2b')]({'where':{'type':_0x27f055,'resourceId':_0x34ca2f['id']}})['then'](function(){return _0xa10714;});})[_0x0b23('0x2a')](function(){_0x21ddf1['status'](0xcc)[_0x0b23('0x21')]();});}};}function handleEntityNotFound(_0x545009,_0x5c3585){return function(_0x48e616){if(!_0x48e616){_0x545009[_0x0b23('0x1f')](0x194);}return _0x48e616;};}function handleError(_0x5f09cc,_0x32b09e){_0x32b09e=_0x32b09e||0x1f4;return function(_0x1a6bc7){logger[_0x0b23('0x35')](_0x1a6bc7[_0x0b23('0x36')]);if(_0x1a6bc7['name']){delete _0x1a6bc7[_0x0b23('0x33')];}_0x5f09cc[_0x0b23('0x20')](_0x32b09e)[_0x0b23('0x37')](_0x1a6bc7);};}exports[_0x0b23('0x38')]=function(_0x595462,_0x29f4fe){var _0x16cf1e={},_0x2fb599={},_0x1ec23f={'count':0x0,'rows':[]};var _0x158388=_['map'](db[_0x0b23('0x39')][_0x0b23('0x3a')],function(_0x4d1495){return{'name':_0x4d1495[_0x0b23('0x3b')],'type':_0x4d1495['type']['key']};});_0x2fb599['model']=_[_0x0b23('0x3c')](_0x158388,_0x0b23('0x33'));_0x2fb599[_0x0b23('0x3d')]=_['keys'](_0x595462[_0x0b23('0x3d')]);_0x2fb599[_0x0b23('0x3e')]=_[_0x0b23('0x3f')](_0x2fb599[_0x0b23('0x40')],_0x2fb599[_0x0b23('0x3d')]);_0x16cf1e[_0x0b23('0x41')]=_[_0x0b23('0x3f')](_0x2fb599[_0x0b23('0x40')],qs['fields'](_0x595462[_0x0b23('0x3d')]['fields']));_0x16cf1e['attributes']=_0x16cf1e[_0x0b23('0x41')][_0x0b23('0x42')]?_0x16cf1e[_0x0b23('0x41')]:_0x2fb599[_0x0b23('0x40')];if(!_0x595462[_0x0b23('0x3d')][_0x0b23('0x43')](_0x0b23('0x44'))){_0x16cf1e['limit']=qs[_0x0b23('0x24')](_0x595462['query'][_0x0b23('0x24')]);_0x16cf1e[_0x0b23('0x26')]=qs['offset'](_0x595462[_0x0b23('0x3d')][_0x0b23('0x26')]);}_0x16cf1e['order']=qs['sort'](_0x595462[_0x0b23('0x3d')][_0x0b23('0x45')]);_0x16cf1e[_0x0b23('0x46')]=qs['filters'](_[_0x0b23('0x47')](_0x595462[_0x0b23('0x3d')],_0x2fb599['filters']),_0x158388);if(_0x595462[_0x0b23('0x3d')][_0x0b23('0x30')]){_0x16cf1e[_0x0b23('0x46')]=_[_0x0b23('0x48')](_0x16cf1e[_0x0b23('0x46')],{'$or':_[_0x0b23('0x3c')](_0x158388,function(_0x15022e){if(_0x15022e[_0x0b23('0x32')]!==_0x0b23('0x49')){var _0x4c5864={};_0x4c5864[_0x15022e[_0x0b23('0x33')]]={'$like':'%'+_0x595462[_0x0b23('0x3d')][_0x0b23('0x30')]+'%'};return _0x4c5864;}})});}_0x16cf1e=_[_0x0b23('0x48')]({},_0x16cf1e,_0x595462['options']);var _0x50627f={'where':_0x16cf1e[_0x0b23('0x46')]};return db[_0x0b23('0x39')]['count'](_0x50627f)[_0x0b23('0x2a')](function(_0xd15c34){_0x1ec23f['count']=_0xd15c34;if(_0x595462['query']['includeAll']){_0x16cf1e['include']=[{'all':!![]}];}return db['VoiceQueue'][_0x0b23('0x4a')](_0x16cf1e);})[_0x0b23('0x2a')](function(_0x2495ab){_0x1ec23f['rows']=_0x2495ab;return _0x1ec23f;})[_0x0b23('0x2a')](respondWithFilteredResult(_0x29f4fe,_0x16cf1e))[_0x0b23('0x4b')](handleError(_0x29f4fe,null));};exports[_0x0b23('0x4c')]=function(_0x14c993,_0x53b5b5){var _0x3f8d43={'raw':![],'where':{'id':_0x14c993[_0x0b23('0x4d')]['id']}},_0xb9671e={};_0xb9671e[_0x0b23('0x40')]=_['keys'](db['VoiceQueue'][_0x0b23('0x3a')]);_0xb9671e[_0x0b23('0x3d')]=_[_0x0b23('0x4e')](_0x14c993[_0x0b23('0x3d')]);_0xb9671e[_0x0b23('0x3e')]=_[_0x0b23('0x3f')](_0xb9671e[_0x0b23('0x40')],_0xb9671e['query']);_0x3f8d43[_0x0b23('0x41')]=_[_0x0b23('0x3f')](_0xb9671e[_0x0b23('0x40')],qs[_0x0b23('0x4f')](_0x14c993[_0x0b23('0x3d')]['fields']));_0x3f8d43[_0x0b23('0x41')]=_0x3f8d43[_0x0b23('0x41')][_0x0b23('0x42')]?_0x3f8d43[_0x0b23('0x41')]:_0xb9671e[_0x0b23('0x40')];if(_0x14c993[_0x0b23('0x3d')][_0x0b23('0x50')]){_0x3f8d43[_0x0b23('0x51')]=[{'all':!![]}];}_0x3f8d43=_[_0x0b23('0x48')]({},_0x3f8d43,_0x14c993[_0x0b23('0x52')]);return db[_0x0b23('0x39')][_0x0b23('0x53')](_0x3f8d43)[_0x0b23('0x2a')](handleEntityNotFound(_0x53b5b5,null))[_0x0b23('0x2a')](respondWithResult(_0x53b5b5,null))['catch'](handleError(_0x53b5b5,null));};exports[_0x0b23('0x54')]=function(_0x17a03b,_0x1b6a1a){return db['VoiceQueue']['create'](_0x17a03b[_0x0b23('0x55')],{})[_0x0b23('0x2a')](function(_0x1ab20c){var _0x28a3d7=_0x17a03b[_0x0b23('0x56')]['get']({'plain':!![]});if(!_0x28a3d7)throw new Error(_0x0b23('0x57'));if(_0x28a3d7[_0x0b23('0x58')]===_0x0b23('0x56')){var _0x2617f5=_0x1ab20c['get']({'plain':!![]});var _0x276753=[{'name':_0x0b23('0x59'),'value':'inbound'},{'name':_0x0b23('0x2e'),'value':_0x0b23('0x2f')}];var _0x3b7731=_[_0x0b23('0x53')](_0x276753,[_0x0b23('0x31'),_0x2617f5['type']])['name'];return db[_0x0b23('0x5a')][_0x0b23('0x53')]({'where':{'name':_0x3b7731,'userProfileId':_0x28a3d7['userProfileId']},'raw':!![]})[_0x0b23('0x2a')](function(_0x3f6011){if(_0x3f6011&&_0x3f6011[_0x0b23('0x5b')]===0x0){return db[_0x0b23('0x34')]['create']({'name':_0x2617f5[_0x0b23('0x33')],'resourceId':_0x2617f5['id'],'type':_0x3f6011[_0x0b23('0x33')],'sectionId':_0x3f6011['id']},{})['then'](function(){return _0x1ab20c;});}else{return _0x1ab20c;}})[_0x0b23('0x4b')](function(_0x275f7b){logger[_0x0b23('0x35')](_0x0b23('0x5c'),_0x275f7b);throw _0x275f7b;});}return _0x1ab20c;})[_0x0b23('0x2a')](respondWithResult(_0x1b6a1a,0xc9))[_0x0b23('0x4b')](handleError(_0x1b6a1a,null));};exports[_0x0b23('0x5d')]=function(_0x4dd417,_0x4be8f0){var _0x5b52e6={'where':{'id':_0x4dd417['params']['id']}},_0x2b534c={};_0x2b534c[_0x0b23('0x40')]=_[_0x0b23('0x4e')](db[_0x0b23('0x39')]['rawAttributes']);_0x5b52e6['attributes']=_[_0x0b23('0x3f')](_0x2b534c[_0x0b23('0x40')],qs['fields'](_0x4dd417['query'][_0x0b23('0x4f')]));_0x5b52e6[_0x0b23('0x41')]=_0x5b52e6['attributes'][_0x0b23('0x42')]?_0x5b52e6['attributes']:_0x2b534c[_0x0b23('0x40')];if(_0x4dd417[_0x0b23('0x3d')][_0x0b23('0x50')]){_0x5b52e6[_0x0b23('0x51')]=[{'all':!![]}];}_0x5b52e6=_[_0x0b23('0x48')]({},_0x5b52e6,_0x4dd417['options']);return db[_0x0b23('0x39')][_0x0b23('0x53')](_0x5b52e6)[_0x0b23('0x2a')](handleEntityNotFound(_0x4be8f0,null))[_0x0b23('0x2a')](function(_0x52a607){if(_0x52a607){var _0xde4818=_0x52a607[_0x0b23('0x2c')]({'plain':!![]});_0xde4818=qs[_0x0b23('0x5e')](_0xde4818,['id',_0x0b23('0x5f'),_0x0b23('0x60')]);_0x4dd417[_0x0b23('0x55')]=_[_0x0b23('0x5e')](_0x4dd417[_0x0b23('0x55')],['id',_0x0b23('0x5f'),_0x0b23('0x60')]);return db[_0x0b23('0x39')]['create'](_['merge'](_0xde4818,_0x4dd417[_0x0b23('0x55')]),{'include':_0x4dd417[_0x0b23('0x3d')][_0x0b23('0x50')]?[{'all':!![]}]:undefined})[_0x0b23('0x2a')](function(_0xca1f36){var _0x1811b=_0x4dd417[_0x0b23('0x56')][_0x0b23('0x2c')]({'plain':!![]});if(!_0x1811b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1811b[_0x0b23('0x58')]===_0x0b23('0x56')){var _0x20a0c4=_0xca1f36[_0x0b23('0x2c')]({'plain':!![]});var _0x2318e6=[{'name':_0x0b23('0x59'),'value':'inbound'},{'name':_0x0b23('0x2e'),'value':'outbound'}];var _0x26f806=_[_0x0b23('0x53')](_0x2318e6,[_0x0b23('0x31'),_0x20a0c4[_0x0b23('0x32')]])[_0x0b23('0x33')];return db[_0x0b23('0x5a')][_0x0b23('0x53')]({'where':{'name':_0x26f806,'userProfileId':_0x1811b[_0x0b23('0x61')]},'raw':!![]})[_0x0b23('0x2a')](function(_0x5ee1fa){if(_0x5ee1fa&&_0x5ee1fa[_0x0b23('0x5b')]===0x0){return db[_0x0b23('0x34')][_0x0b23('0x54')]({'name':_0x20a0c4[_0x0b23('0x33')],'resourceId':_0x20a0c4['id'],'type':_0x5ee1fa[_0x0b23('0x33')],'sectionId':_0x5ee1fa['id']},{})[_0x0b23('0x2a')](function(){return _0xca1f36;});}else{return _0xca1f36;}})[_0x0b23('0x4b')](function(_0x46fbb0){logger[_0x0b23('0x35')](_0x0b23('0x5c'),_0x46fbb0);throw _0x46fbb0;});}return _0xca1f36;});}})[_0x0b23('0x2a')](respondWithResult(_0x4be8f0,0xc9))[_0x0b23('0x4b')](handleError(_0x4be8f0,null));};exports[_0x0b23('0x62')]=function(_0x1e339b,_0xce67c1){if(_0x1e339b[_0x0b23('0x55')]['id']){delete _0x1e339b[_0x0b23('0x55')]['id'];}return db[_0x0b23('0x39')]['find']({'where':{'id':_0x1e339b[_0x0b23('0x4d')]['id']}})['then'](handleEntityNotFound(_0xce67c1,null))[_0x0b23('0x2a')](saveUpdates(_0x1e339b[_0x0b23('0x55')],null))[_0x0b23('0x2a')](respondWithResult(_0xce67c1,null))[_0x0b23('0x4b')](handleError(_0xce67c1,null));};exports[_0x0b23('0x2b')]=function(_0x25092a,_0x11fd67){return db[_0x0b23('0x39')][_0x0b23('0x53')]({'where':{'id':_0x25092a[_0x0b23('0x4d')]['id']}})[_0x0b23('0x2a')](handleEntityNotFound(_0x11fd67,null))[_0x0b23('0x2a')](removeEntity(_0x11fd67,null))[_0x0b23('0x4b')](handleError(_0x11fd67,null));};exports[_0x0b23('0x63')]=function(_0x4992e1,_0x657893,_0xd8a3e1){var _0x151c32={'raw':![],'where':{}};var _0xd0f5bc={};var _0x4943a3={'count':0x0,'rows':[]};return db[_0x0b23('0x39')][_0x0b23('0x64')]({'where':{'id':_0x4992e1[_0x0b23('0x4d')]['id']}})[_0x0b23('0x2a')](handleEntityNotFound(_0x657893,null))['then'](function(_0x581ab4){if(_0x581ab4){_0xd0f5bc[_0x0b23('0x40')]=_['keys'](db[_0x0b23('0x65')][_0x0b23('0x3a')]);_0xd0f5bc[_0x0b23('0x3d')]=_[_0x0b23('0x4e')](_0x4992e1[_0x0b23('0x3d')]);_0xd0f5bc[_0x0b23('0x3e')]=_[_0x0b23('0x3f')](_0xd0f5bc['model'],_0xd0f5bc[_0x0b23('0x3d')]);_0x151c32['attributes']=_['intersection'](_0xd0f5bc[_0x0b23('0x40')],qs['fields'](_0x4992e1[_0x0b23('0x3d')][_0x0b23('0x4f')]));_0x151c32[_0x0b23('0x41')]=_0x151c32['attributes'][_0x0b23('0x42')]?_0x151c32[_0x0b23('0x41')]:_0xd0f5bc[_0x0b23('0x40')];if(!_0x4992e1[_0x0b23('0x3d')][_0x0b23('0x43')](_0x0b23('0x44'))){_0x151c32[_0x0b23('0x24')]=qs[_0x0b23('0x24')](_0x4992e1[_0x0b23('0x3d')][_0x0b23('0x24')]);_0x151c32[_0x0b23('0x26')]=qs[_0x0b23('0x26')](_0x4992e1[_0x0b23('0x3d')][_0x0b23('0x26')]);}_0x151c32[_0x0b23('0x66')]=qs[_0x0b23('0x45')](_0x4992e1[_0x0b23('0x3d')]['sort']);_0x151c32['where']=qs[_0x0b23('0x3e')](_[_0x0b23('0x47')](_0x4992e1[_0x0b23('0x3d')],_0xd0f5bc['filters']));_0x151c32[_0x0b23('0x46')]['VoiceQueueId']=_0x581ab4['id'];if(_0x4992e1['query']['filter']){_0x151c32['where']=_[_0x0b23('0x48')](_0x151c32[_0x0b23('0x46')],{'$or':_[_0x0b23('0x3c')](_0x151c32['attributes'],function(_0xee8fac){var _0xf570f9={};_0xf570f9[_0xee8fac]={'$like':'%'+_0x4992e1['query']['filter']+'%'};return _0xf570f9;})});}_0x151c32=_[_0x0b23('0x48')]({},_0x151c32,_0x4992e1[_0x0b23('0x52')]);return db[_0x0b23('0x65')]['count']({'where':_0x151c32['where']})['then'](function(_0x440917){_0x4943a3[_0x0b23('0x25')]=_0x440917;if(_0x4992e1[_0x0b23('0x3d')][_0x0b23('0x50')]){_0x151c32['include']=[{'all':!![]}];}return db[_0x0b23('0x65')][_0x0b23('0x4a')](_0x151c32);})['then'](function(_0x552e9e){_0x4943a3[_0x0b23('0x67')]=_0x552e9e;return _0x4943a3;});}})[_0x0b23('0x2a')](respondWithFilteredResult(_0x657893,_0x151c32))[_0x0b23('0x4b')](handleError(_0x657893,null));};exports[_0x0b23('0x68')]=function(_0x56f1e2,_0x4439fa,_0x689c00){var _0x32d31f={'raw':!![],'where':{}};var _0x282d9d={};var _0x12f9b1={'count':0x0,'rows':[]};return db['VoiceQueue']['findOne']({'where':{'id':_0x56f1e2[_0x0b23('0x4d')]['id']}})['then'](handleEntityNotFound(_0x4439fa,null))[_0x0b23('0x2a')](function(_0x3a44b8){if(_0x3a44b8){_0x282d9d[_0x0b23('0x40')]=_[_0x0b23('0x4e')](db[_0x0b23('0x69')][_0x0b23('0x3a')]);_0x282d9d['query']=_['keys'](_0x56f1e2[_0x0b23('0x3d')]);_0x282d9d[_0x0b23('0x3e')]=_[_0x0b23('0x3f')](_0x282d9d[_0x0b23('0x40')],_0x282d9d['query']);_0x32d31f['attributes']=_[_0x0b23('0x3f')](_0x282d9d[_0x0b23('0x40')],qs[_0x0b23('0x4f')](_0x56f1e2[_0x0b23('0x3d')][_0x0b23('0x4f')]));_0x32d31f['attributes']=_0x32d31f[_0x0b23('0x41')][_0x0b23('0x42')]?_0x32d31f[_0x0b23('0x41')]:_0x282d9d[_0x0b23('0x40')];if(!_0x56f1e2[_0x0b23('0x3d')][_0x0b23('0x43')]('nolimit')){_0x32d31f[_0x0b23('0x24')]=qs[_0x0b23('0x24')](_0x56f1e2[_0x0b23('0x3d')][_0x0b23('0x24')]);_0x32d31f[_0x0b23('0x26')]=qs['offset'](_0x56f1e2[_0x0b23('0x3d')][_0x0b23('0x26')]);}_0x32d31f[_0x0b23('0x66')]=qs[_0x0b23('0x45')](_0x56f1e2[_0x0b23('0x3d')][_0x0b23('0x45')]);_0x32d31f['where']=qs[_0x0b23('0x3e')](_[_0x0b23('0x47')](_0x56f1e2[_0x0b23('0x3d')],_0x282d9d[_0x0b23('0x3e')]));_0x32d31f[_0x0b23('0x46')]['VoiceQueueId']=_0x3a44b8['id'];if(_0x56f1e2['query'][_0x0b23('0x30')]){_0x32d31f[_0x0b23('0x46')]=_[_0x0b23('0x48')](_0x32d31f['where'],{'$or':_['map'](_0x32d31f[_0x0b23('0x41')],function(_0x2bc9f5){var _0x1ff86e={};_0x1ff86e[_0x2bc9f5]={'$like':'%'+_0x56f1e2[_0x0b23('0x3d')][_0x0b23('0x30')]+'%'};return _0x1ff86e;})});}_0x32d31f=_[_0x0b23('0x48')]({},_0x32d31f,_0x56f1e2['options']);return db[_0x0b23('0x69')]['count']({'where':_0x32d31f['where']})[_0x0b23('0x2a')](function(_0x33a1f0){_0x12f9b1[_0x0b23('0x25')]=_0x33a1f0;if(_0x56f1e2['query'][_0x0b23('0x50')]){_0x32d31f[_0x0b23('0x51')]=[{'all':!![]}];}return db[_0x0b23('0x69')]['findAll'](_0x32d31f);})['then'](function(_0x1f87f7){_0x12f9b1[_0x0b23('0x67')]=_0x1f87f7;return _0x12f9b1;});}})['then'](respondWithFilteredResult(_0x4439fa,_0x32d31f))[_0x0b23('0x4b')](handleError(_0x4439fa,null));};exports[_0x0b23('0x6a')]=function(_0x19136a,_0x3057be,_0xc58b89){var _0x4af722={'raw':!![],'where':{}};var _0x2a2bb9={};var _0x3fc496={'count':0x0,'rows':[]};return db[_0x0b23('0x39')][_0x0b23('0x64')]({'where':{'id':_0x19136a[_0x0b23('0x4d')]['id']}})['then'](handleEntityNotFound(_0x3057be,null))[_0x0b23('0x2a')](function(_0x5ce750){if(_0x5ce750){_0x2a2bb9['model']=_['keys'](db[_0x0b23('0x6b')]['rawAttributes']);_0x2a2bb9[_0x0b23('0x3d')]=_[_0x0b23('0x4e')](_0x19136a[_0x0b23('0x3d')]);_0x2a2bb9[_0x0b23('0x3e')]=_[_0x0b23('0x3f')](_0x2a2bb9[_0x0b23('0x40')],_0x2a2bb9[_0x0b23('0x3d')]);_0x4af722[_0x0b23('0x41')]=_['intersection'](_0x2a2bb9[_0x0b23('0x40')],qs['fields'](_0x19136a['query'][_0x0b23('0x4f')]));_0x4af722[_0x0b23('0x41')]=_0x4af722[_0x0b23('0x41')][_0x0b23('0x42')]?_0x4af722[_0x0b23('0x41')]:_0x2a2bb9['model'];if(!_0x19136a['query'][_0x0b23('0x43')](_0x0b23('0x44'))){_0x4af722['limit']=qs[_0x0b23('0x24')](_0x19136a[_0x0b23('0x3d')][_0x0b23('0x24')]);_0x4af722[_0x0b23('0x26')]=qs['offset'](_0x19136a[_0x0b23('0x3d')]['offset']);}_0x4af722['order']=qs[_0x0b23('0x45')](_0x19136a[_0x0b23('0x3d')][_0x0b23('0x45')]);_0x4af722[_0x0b23('0x46')]=qs['filters'](_[_0x0b23('0x47')](_0x19136a['query'],_0x2a2bb9[_0x0b23('0x3e')]));_0x4af722['where'][_0x0b23('0x6c')]=_0x5ce750['id'];if(_0x19136a[_0x0b23('0x3d')]['filter']){_0x4af722[_0x0b23('0x46')]=_['merge'](_0x4af722['where'],{'$or':_[_0x0b23('0x3c')](_0x4af722['attributes'],function(_0x2d31c8){var _0x104383={};_0x104383[_0x2d31c8]={'$like':'%'+_0x19136a['query'][_0x0b23('0x30')]+'%'};return _0x104383;})});}_0x4af722=_[_0x0b23('0x48')]({},_0x4af722,_0x19136a[_0x0b23('0x52')]);return db[_0x0b23('0x6b')][_0x0b23('0x25')]({'where':_0x4af722['where']})[_0x0b23('0x2a')](function(_0x1f0bf5){_0x3fc496[_0x0b23('0x25')]=_0x1f0bf5;if(_0x19136a[_0x0b23('0x3d')][_0x0b23('0x50')]){_0x4af722[_0x0b23('0x51')]=[{'all':!![]}];}return db[_0x0b23('0x6b')][_0x0b23('0x4a')](_0x4af722);})[_0x0b23('0x2a')](function(_0x3efce7){_0x3fc496[_0x0b23('0x67')]=_0x3efce7;return _0x3fc496;});}})[_0x0b23('0x2a')](respondWithFilteredResult(_0x3057be,_0x4af722))[_0x0b23('0x4b')](handleError(_0x3057be,null));};exports[_0x0b23('0x6d')]=function(_0x25ae3b,_0x515010,_0x20147f){var _0x5cac8b={'raw':!![],'where':{}};var _0x5ce76b={};var _0x2b9291={'count':0x0,'rows':[]};return db['VoiceQueue']['findOne']({'where':{'id':_0x25ae3b[_0x0b23('0x4d')]['id']}})['then'](handleEntityNotFound(_0x515010,null))[_0x0b23('0x2a')](function(_0x456bb5){if(_0x456bb5){_0x5ce76b[_0x0b23('0x40')]=_[_0x0b23('0x4e')](db[_0x0b23('0x6e')][_0x0b23('0x3a')]);_0x5ce76b[_0x0b23('0x3d')]=_[_0x0b23('0x4e')](_0x25ae3b[_0x0b23('0x3d')]);_0x5ce76b['filters']=_[_0x0b23('0x3f')](_0x5ce76b[_0x0b23('0x40')],_0x5ce76b['query']);_0x5cac8b[_0x0b23('0x41')]=_[_0x0b23('0x3f')](_0x5ce76b[_0x0b23('0x40')],qs['fields'](_0x25ae3b[_0x0b23('0x3d')]['fields']));_0x5cac8b[_0x0b23('0x41')]=_0x5cac8b[_0x0b23('0x41')][_0x0b23('0x42')]?_0x5cac8b['attributes']:_0x5ce76b['model'];if(!_0x25ae3b['query'][_0x0b23('0x43')](_0x0b23('0x44'))){_0x5cac8b[_0x0b23('0x24')]=qs[_0x0b23('0x24')](_0x25ae3b[_0x0b23('0x3d')]['limit']);_0x5cac8b[_0x0b23('0x26')]=qs['offset'](_0x25ae3b[_0x0b23('0x3d')][_0x0b23('0x26')]);}_0x5cac8b['order']=qs[_0x0b23('0x45')](_0x25ae3b[_0x0b23('0x3d')][_0x0b23('0x45')]);_0x5cac8b[_0x0b23('0x46')]=qs[_0x0b23('0x3e')](_[_0x0b23('0x47')](_0x25ae3b[_0x0b23('0x3d')],_0x5ce76b['filters']));_0x5cac8b[_0x0b23('0x46')]['VoiceQueueId']=_0x456bb5['id'];if(_0x25ae3b[_0x0b23('0x3d')][_0x0b23('0x30')]){_0x5cac8b['where']=_[_0x0b23('0x48')](_0x5cac8b[_0x0b23('0x46')],{'$or':_['map'](_0x5cac8b['attributes'],function(_0xec3545){var _0x353066={};_0x353066[_0xec3545]={'$like':'%'+_0x25ae3b[_0x0b23('0x3d')]['filter']+'%'};return _0x353066;})});}_0x5cac8b=_[_0x0b23('0x48')]({},_0x5cac8b,_0x25ae3b[_0x0b23('0x52')]);return db[_0x0b23('0x6e')][_0x0b23('0x25')]({'where':_0x5cac8b[_0x0b23('0x46')]})[_0x0b23('0x2a')](function(_0x310af8){_0x2b9291['count']=_0x310af8;if(_0x25ae3b[_0x0b23('0x3d')]['includeAll']){_0x5cac8b['include']=[{'all':!![]}];}return db['CmHopperBlack'][_0x0b23('0x4a')](_0x5cac8b);})[_0x0b23('0x2a')](function(_0x224fee){_0x2b9291[_0x0b23('0x67')]=_0x224fee;return _0x2b9291;});}})[_0x0b23('0x2a')](respondWithFilteredResult(_0x515010,_0x5cac8b))[_0x0b23('0x4b')](handleError(_0x515010,null));};exports[_0x0b23('0x6f')]=function(_0x1a4f48,_0x50879e,_0x1c7be7){var _0x2f6c16={};var _0x5893f8={};var _0x27a17e;var _0x4064b6;return db[_0x0b23('0x39')][_0x0b23('0x64')]({'where':{'id':_0x1a4f48['params']['id']}})[_0x0b23('0x2a')](handleEntityNotFound(_0x50879e,null))['then'](function(_0x39e205){if(_0x39e205){_0x27a17e=_0x39e205;_0x5893f8[_0x0b23('0x40')]=_[_0x0b23('0x4e')](db[_0x0b23('0x70')][_0x0b23('0x3a')]);_0x5893f8['query']=_[_0x0b23('0x4e')](_0x1a4f48[_0x0b23('0x3d')]);_0x5893f8[_0x0b23('0x3e')]=_[_0x0b23('0x3f')](_0x5893f8[_0x0b23('0x40')],_0x5893f8[_0x0b23('0x3d')]);_0x2f6c16['attributes']=_[_0x0b23('0x3f')](_0x5893f8[_0x0b23('0x40')],qs[_0x0b23('0x4f')](_0x1a4f48[_0x0b23('0x3d')][_0x0b23('0x4f')]));_0x2f6c16[_0x0b23('0x41')]=_0x2f6c16['attributes'][_0x0b23('0x42')]?_0x2f6c16[_0x0b23('0x41')]:_0x5893f8[_0x0b23('0x40')];_0x2f6c16[_0x0b23('0x66')]=qs[_0x0b23('0x45')](_0x1a4f48[_0x0b23('0x3d')]['sort']);_0x2f6c16[_0x0b23('0x46')]=qs[_0x0b23('0x3e')](_[_0x0b23('0x47')](_0x1a4f48[_0x0b23('0x3d')],_0x5893f8[_0x0b23('0x3e')]));if(_0x1a4f48[_0x0b23('0x3d')]['filter']){_0x2f6c16[_0x0b23('0x46')]=_['merge'](_0x2f6c16[_0x0b23('0x46')],{'$or':_[_0x0b23('0x3c')](_0x2f6c16[_0x0b23('0x41')],function(_0x3326f5){var _0xc47bfa={};_0xc47bfa[_0x3326f5]={'$like':'%'+_0x1a4f48[_0x0b23('0x3d')][_0x0b23('0x30')]+'%'};return _0xc47bfa;})});}_0x2f6c16=_[_0x0b23('0x48')]({},_0x2f6c16,_0x1a4f48['options']);return _0x27a17e[_0x0b23('0x6f')](_0x2f6c16);}})[_0x0b23('0x2a')](function(_0x244b6c){if(_0x244b6c){_0x4064b6=_0x244b6c[_0x0b23('0x42')];if(!_0x1a4f48[_0x0b23('0x3d')][_0x0b23('0x43')]('nolimit')){_0x2f6c16[_0x0b23('0x24')]=qs[_0x0b23('0x24')](_0x1a4f48[_0x0b23('0x3d')][_0x0b23('0x24')]);_0x2f6c16[_0x0b23('0x26')]=qs[_0x0b23('0x26')](_0x1a4f48[_0x0b23('0x3d')][_0x0b23('0x26')]);}return _0x27a17e[_0x0b23('0x6f')](_0x2f6c16);}})[_0x0b23('0x2a')](function(_0xd6d94a){if(_0xd6d94a){return _0xd6d94a?{'count':_0x4064b6,'rows':_0xd6d94a}:null;}})[_0x0b23('0x2a')](respondWithResult(_0x50879e,null))[_0x0b23('0x4b')](handleError(_0x50879e,null));};exports[_0x0b23('0x71')]=function(_0x4d4086,_0x304f11,_0x4a81fa){var _0x37a516=_0x4d4086[_0x0b23('0x55')][_0x0b23('0x72')];var _0x192d15=_[_0x0b23('0x3c')](_0x37a516,'id');return db['Team'][_0x0b23('0x4a')]({'where':{'id':_0x192d15},'attributes':['id'],'include':[{'model':db[_0x0b23('0x73')],'as':_0x0b23('0x74'),'attributes':['id',_0x0b23('0x33'),'online',_0x0b23('0x75'),_0x0b23('0x76')],'raw':!![]}]})[_0x0b23('0x2a')](function(_0x21bc3b){if(_0x21bc3b){var _0x16b988=_[_0x0b23('0x77')](_0x21bc3b,function(_0x44d22f){var _0x540051=_0x44d22f[_0x0b23('0x2c')]({'plain':!![]});_0x540051[_0x0b23('0x74')][_0x0b23('0x78')](function(_0x2ae502){_0x2ae502['penalty']=_[_0x0b23('0x53')](_0x37a516,{'id':_0x540051['id']})[_0x0b23('0x79')];});return _0x540051['Agents'];});return db['VoiceQueue']['find']({'where':{'id':_0x4d4086[_0x0b23('0x4d')]['id']}})[_0x0b23('0x2a')](function(_0x4ac6c8){return db[_0x0b23('0x7a')]['transaction'](function(_0x30d005){return _0x4ac6c8[_0x0b23('0x71')](_0x192d15,{'transaction':_0x30d005})[_0x0b23('0x2a')](function(){return BPromise[_0x0b23('0x7b')](_0x37a516,function(_0x188eb3){return db[_0x0b23('0x7c')]['upsert']({'TeamId':_0x188eb3['id'],'VoiceQueueId':_0x4d4086[_0x0b23('0x4d')]['id'],'penalty':_0x188eb3['penalty']},{'transaction':_0x30d005});});})[_0x0b23('0x2a')](function(){return BPromise['each'](_0x16b988,function(_0x57e8cd){return db['UserVoiceQueue'][_0x0b23('0x7d')]({'where':{'UserId':_0x57e8cd['id'],'VoiceQueueId':_0x4d4086[_0x0b23('0x4d')]['id']},'defaults':{'penalty':_0x57e8cd[_0x0b23('0x79')]},'transaction':_0x30d005});});})[_0x0b23('0x2a')](function(){return BPromise['each'](_[_0x0b23('0x30')](_0x16b988,{'online':!![]}),function(_0x1a8e67){return db[_0x0b23('0x7e')]['upsert']({'membername':_0x1a8e67[_0x0b23('0x33')],'UserId':_0x1a8e67['id'],'queue_name':_0x4ac6c8[_0x0b23('0x33')],'VoiceQueueId':_0x4ac6c8['id'],'interface':_['isNil'](_0x1a8e67[_0x0b23('0x76')])?util[_0x0b23('0x7f')](_0x0b23('0x80'),_0x1a8e67['name']):_0x1a8e67[_0x0b23('0x76')],'paused':_0x1a8e67['voicePause']||![],'penalty':_0x1a8e67[_0x0b23('0x79')]},{'transaction':_0x30d005});});})['then'](function(){_0x16b988['forEach'](function(_0x4f5498){socket[_0x0b23('0x81')](_0x0b23('0x82'),{'UserId':_0x4f5498['id'],'VoiceQueueId':_0x4ac6c8['id']});});});});});}})[_0x0b23('0x2a')](respondWithStatusCode(_0x304f11,null))[_0x0b23('0x4b')](handleError(_0x304f11,null));};exports[_0x0b23('0x83')]=function(_0x5a54a8,_0x1d7423,_0x35380c){return db[_0x0b23('0x70')][_0x0b23('0x4a')]({'where':{'id':_0x5a54a8[_0x0b23('0x3d')][_0x0b23('0x84')]},'attributes':['id'],'include':[{'model':db[_0x0b23('0x73')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x0b23('0x2a')](handleEntityNotFound(_0x1d7423,null))[_0x0b23('0x2a')](function(_0xd6f3b3){var _0x11f624=_[_0x0b23('0x3c')](_0xd6f3b3,'id');var _0xe23061=[];var _0x485981=[];var _0x21c28a=squel[_0x0b23('0x85')]();_0x21c28a['field'](_0x0b23('0x86'))['from']('team_has_voice_queues','tq')['join'](_0x0b23('0x87'),'ut',_0x0b23('0x88'))[_0x0b23('0x46')](_0x0b23('0x89'),_0x5a54a8[_0x0b23('0x4d')]['id']);for(var _0xe495b4=0x0;_0xe495b4<_0xd6f3b3[_0x0b23('0x42')];_0xe495b4+=0x1){let _0x37c119=_0xd6f3b3[_0xe495b4];for(var _0x2b6617=0x0;_0x2b6617<_0x37c119[_0x0b23('0x74')][_0x0b23('0x42')];_0x2b6617+=0x1){let _0x1f2404=_0x37c119[_0x0b23('0x74')][_0x2b6617];var _0xdaffa1=_0x21c28a[_0x0b23('0x5d')]();_0xdaffa1[_0x0b23('0x46')](_0x0b23('0x8a'),_0x1f2404['id']);_0x485981['push'](db[_0x0b23('0x7a')][_0x0b23('0x3d')](_0xdaffa1[_0x0b23('0x8b')](),{'type':db[_0x0b23('0x7a')][_0x0b23('0x8c')]['SELECT']})[_0x0b23('0x2a')](function(_0x18b9b5){if(_0x18b9b5[_0x0b23('0x42')]===0x1){return _0x1f2404['id'];}else{var _0x5e0279=_['every'](_['map'](_0x18b9b5,_0x0b23('0x8d')),function(_0x508db2){return _[_0x0b23('0x8e')](_0x11f624,_0x508db2);});if(_0x5e0279){return _0x1f2404['id'];}}}));}}return BPromise[_0x0b23('0x8f')](_0x485981)[_0x0b23('0x2a')](function(_0x67a0d7){_0xe23061=_(_0xe23061)['union'](_0x67a0d7)[_0x0b23('0x90')]()[_0x0b23('0x31')]();return db['VoiceQueue']['find']({'where':{'id':_0x5a54a8[_0x0b23('0x4d')]['id']}})[_0x0b23('0x2a')](function(_0x2f2fe5){return db[_0x0b23('0x7a')][_0x0b23('0x91')](function(_0x298917){return _0x2f2fe5[_0x0b23('0x83')](_0x5a54a8[_0x0b23('0x3d')][_0x0b23('0x84')],{'transaction':_0x298917})['then'](function(){if(!_[_0x0b23('0x92')](_0xe23061)){return _0x2f2fe5[_0x0b23('0x93')](_0xe23061,{'transaction':_0x298917})['then'](function(){return db[_0x0b23('0x7e')][_0x0b23('0x2b')]({'where':{'VoiceQueueId':_0x5a54a8[_0x0b23('0x4d')]['id'],'UserId':_0xe23061},'transaction':_0x298917});});}})[_0x0b23('0x2a')](function(){_0xe23061[_0x0b23('0x78')](function(_0x595c81){socket[_0x0b23('0x81')](_0x0b23('0x94'),{'UserId':_0x595c81,'VoiceQueueId':_0x2f2fe5['id']});});});});});});})['then'](respondWithStatusCode(_0x1d7423,null))[_0x0b23('0x4b')](handleError(_0x1d7423,null));};exports[_0x0b23('0x95')]=function(_0x59c786,_0x4622e1,_0x6e2419){var _0x4250ec,_0x29709b;return db[_0x0b23('0x39')][_0x0b23('0x53')]({'where':{'id':_0x59c786[_0x0b23('0x4d')]['id']}})[_0x0b23('0x2a')](handleEntityNotFound(_0x4622e1,null))[_0x0b23('0x2a')](function(_0x2802f5){if(_0x2802f5){_0x29709b=_0x2802f5;return _0x2802f5[_0x0b23('0x95')](_0x59c786[_0x0b23('0x55')][_0x0b23('0x84')],_[_0x0b23('0x5e')](_0x59c786[_0x0b23('0x55')],[_0x0b23('0x84'),'id'])||{})['spread'](function(_0x159359){for(var _0x5a00a6=0x0;_0x5a00a6<_0x59c786[_0x0b23('0x55')][_0x0b23('0x84')]['length'];_0x5a00a6+=0x1){socket[_0x0b23('0x81')](_0x0b23('0x82'),{'UserId':_0x59c786[_0x0b23('0x55')]['ids'][_0x5a00a6],'VoiceQueueId':_0x59c786[_0x0b23('0x4d')]['id']});}return _0x159359;});}})[_0x0b23('0x2a')](function(_0x419edf){_0x4250ec=_0x419edf||[];if(_0x29709b){return db['User'][_0x0b23('0x4a')]({'where':{'id':_0x59c786[_0x0b23('0x55')][_0x0b23('0x84')]},'attributes':['id',_0x0b23('0x33'),_0x0b23('0x96'),_0x0b23('0x75'),'interface'],'raw':!![]});}})[_0x0b23('0x2a')](function(_0x12a9f1){if(!_[_0x0b23('0x92')](_0x12a9f1)){var _0xccb363=[];for(var _0x57c1d3=0x0;_0x57c1d3<_0x12a9f1[_0x0b23('0x42')];_0x57c1d3++){if(_0x12a9f1[_0x57c1d3][_0x0b23('0x96')]){_0xccb363[_0x0b23('0x97')](db[_0x0b23('0x7e')][_0x0b23('0x98')]({'membername':_0x12a9f1[_0x57c1d3][_0x0b23('0x33')],'UserId':_0x12a9f1[_0x57c1d3]['id'],'queue_name':_0x29709b['name'],'VoiceQueueId':_0x29709b['id'],'interface':_['isNil'](_0x12a9f1[_0x57c1d3][_0x0b23('0x76')])?util[_0x0b23('0x7f')](_0x0b23('0x80'),_0x12a9f1[_0x57c1d3]['name']):_0x12a9f1[_0x57c1d3][_0x0b23('0x76')],'paused':_0x12a9f1[_0x57c1d3][_0x0b23('0x75')]||![],'penalty':_0x59c786[_0x0b23('0x55')][_0x0b23('0x79')]||0x0}));}}return BPromise[_0x0b23('0x8f')](_0xccb363);}})[_0x0b23('0x2a')](function(){return _0x4250ec;})[_0x0b23('0x2a')](respondWithResult(_0x4622e1,null))[_0x0b23('0x4b')](handleError(_0x4622e1,null));};exports[_0x0b23('0x93')]=function(_0x1bd61e,_0x246e70,_0x17dc2){return db[_0x0b23('0x39')]['find']({'where':{'id':_0x1bd61e['params']['id']}})[_0x0b23('0x2a')](handleEntityNotFound(_0x246e70,null))[_0x0b23('0x2a')](function(_0x15579f){if(_0x15579f){return _0x15579f['removeAgents'](_0x1bd61e['query'][_0x0b23('0x84')])[_0x0b23('0x2a')](function(){if(_[_0x0b23('0x99')](_0x1bd61e[_0x0b23('0x3d')]['ids'])){for(var _0x32db05=0x0;_0x32db05<_0x1bd61e['query'][_0x0b23('0x84')]['length'];_0x32db05+=0x1){socket[_0x0b23('0x81')](_0x0b23('0x94'),{'UserId':Number(_0x1bd61e[_0x0b23('0x3d')][_0x0b23('0x84')][_0x32db05]),'VoiceQueueId':Number(_0x1bd61e[_0x0b23('0x4d')]['id'])});}}else{socket[_0x0b23('0x81')](_0x0b23('0x94'),{'UserId':Number(_0x1bd61e['query'][_0x0b23('0x84')]),'VoiceQueueId':Number(_0x1bd61e['params']['id'])});}});}})[_0x0b23('0x2a')](function(_0x3287bb){return db[_0x0b23('0x7e')][_0x0b23('0x2b')]({'where':{'VoiceQueueId':_0x1bd61e[_0x0b23('0x4d')]['id'],'UserId':_0x1bd61e[_0x0b23('0x3d')][_0x0b23('0x84')]}})[_0x0b23('0x2a')](function(){return _0x3287bb;});})['then'](respondWithStatusCode(_0x246e70,null))[_0x0b23('0x4b')](handleError(_0x246e70,null));};exports[_0x0b23('0x9a')]=function(_0x3d6574,_0x23425a,_0xe06508){var _0x4dd785={};var _0x4ee107={};var _0x3b21bf;var _0x3e307d;return db[_0x0b23('0x39')][_0x0b23('0x64')]({'where':{'id':_0x3d6574[_0x0b23('0x4d')]['id']}})[_0x0b23('0x2a')](handleEntityNotFound(_0x23425a,null))[_0x0b23('0x2a')](function(_0x5a22c5){if(_0x5a22c5){_0x3b21bf=_0x5a22c5;_0x4ee107['model']=_['keys'](db[_0x0b23('0x73')][_0x0b23('0x3a')]);_0x4ee107['query']=_[_0x0b23('0x4e')](_0x3d6574['query']);_0x4ee107[_0x0b23('0x3e')]=_['intersection'](_0x4ee107[_0x0b23('0x40')],_0x4ee107[_0x0b23('0x3d')]);_0x4dd785['attributes']=_[_0x0b23('0x3f')](_0x4ee107[_0x0b23('0x40')],qs[_0x0b23('0x4f')](_0x3d6574['query'][_0x0b23('0x4f')]));_0x4dd785[_0x0b23('0x41')]=_0x4dd785[_0x0b23('0x41')][_0x0b23('0x42')]?_0x4dd785['attributes']:_0x4ee107['model'];_0x4dd785[_0x0b23('0x66')]=qs[_0x0b23('0x45')](_0x3d6574[_0x0b23('0x3d')][_0x0b23('0x45')]);_0x4dd785['where']=qs[_0x0b23('0x3e')](_['pick'](_0x3d6574['query'],_0x4ee107[_0x0b23('0x3e')]));if(_0x3d6574[_0x0b23('0x3d')]['filter']){_0x4dd785['where']=_[_0x0b23('0x48')](_0x4dd785[_0x0b23('0x46')],{'$or':_[_0x0b23('0x3c')](_0x4dd785[_0x0b23('0x41')],function(_0x599d55){var _0x521b02={};_0x521b02[_0x599d55]={'$like':'%'+_0x3d6574[_0x0b23('0x3d')]['filter']+'%'};return _0x521b02;})});}_0x4dd785=_['merge']({},_0x4dd785,_0x3d6574['options']);return _0x3b21bf[_0x0b23('0x9a')](_0x4dd785);}})[_0x0b23('0x2a')](function(_0x4801e4){if(_0x4801e4){_0x3e307d=_0x4801e4[_0x0b23('0x42')];if(!_0x3d6574[_0x0b23('0x3d')]['hasOwnProperty'](_0x0b23('0x44'))){_0x4dd785[_0x0b23('0x24')]=qs[_0x0b23('0x24')](_0x3d6574['query'][_0x0b23('0x24')]);_0x4dd785[_0x0b23('0x26')]=qs[_0x0b23('0x26')](_0x3d6574[_0x0b23('0x3d')][_0x0b23('0x26')]);}return _0x3b21bf[_0x0b23('0x9a')](_0x4dd785);}})['then'](function(_0x4edfa9){if(_0x4edfa9){return _0x4edfa9?{'count':_0x3e307d,'rows':_0x4edfa9}:null;}})[_0x0b23('0x2a')](respondWithResult(_0x23425a,null))[_0x0b23('0x4b')](handleError(_0x23425a,null));};exports[_0x0b23('0x9b')]=function(_0x4d20b0,_0x3cb2fe,_0x3aee95){var _0x1d74ac={};var _0x4d5b6c={};var _0x52be44;var _0x14cd7c;return db[_0x0b23('0x39')]['findOne']({'where':{'id':_0x4d20b0['params']['id']}})[_0x0b23('0x2a')](handleEntityNotFound(_0x3cb2fe,null))[_0x0b23('0x2a')](function(_0x56e5af){if(_0x56e5af){_0x52be44=_0x56e5af;_0x4d5b6c[_0x0b23('0x40')]=_[_0x0b23('0x4e')](db[_0x0b23('0x7e')][_0x0b23('0x3a')]);_0x4d5b6c[_0x0b23('0x3d')]=_[_0x0b23('0x4e')](_0x4d20b0[_0x0b23('0x3d')]);_0x4d5b6c[_0x0b23('0x3e')]=_['intersection'](_0x4d5b6c['model'],_0x4d5b6c[_0x0b23('0x3d')]);_0x1d74ac[_0x0b23('0x41')]=_[_0x0b23('0x3f')](_0x4d5b6c[_0x0b23('0x40')],qs[_0x0b23('0x4f')](_0x4d20b0['query'][_0x0b23('0x4f')]));_0x1d74ac[_0x0b23('0x41')]=_0x1d74ac[_0x0b23('0x41')][_0x0b23('0x42')]?_0x1d74ac['attributes']:_0x4d5b6c[_0x0b23('0x40')];_0x1d74ac[_0x0b23('0x66')]=qs[_0x0b23('0x45')](_0x4d20b0[_0x0b23('0x3d')][_0x0b23('0x45')]);_0x1d74ac[_0x0b23('0x46')]=qs[_0x0b23('0x3e')](_[_0x0b23('0x47')](_0x4d20b0[_0x0b23('0x3d')],_0x4d5b6c[_0x0b23('0x3e')]));if(_0x4d20b0['query'][_0x0b23('0x30')]){_0x1d74ac['where']=_[_0x0b23('0x48')](_0x1d74ac[_0x0b23('0x46')],{'$or':_[_0x0b23('0x3c')](_0x1d74ac[_0x0b23('0x41')],function(_0x29a46c){var _0x4c9d95={};_0x4c9d95[_0x29a46c]={'$like':'%'+_0x4d20b0[_0x0b23('0x3d')][_0x0b23('0x30')]+'%'};return _0x4c9d95;})});}_0x1d74ac=_[_0x0b23('0x48')]({},_0x1d74ac,_0x4d20b0[_0x0b23('0x52')]);return _0x52be44[_0x0b23('0x9b')](_0x1d74ac);}})['then'](function(_0x368f9a){if(_0x368f9a){_0x14cd7c=_0x368f9a[_0x0b23('0x42')];if(!_0x4d20b0[_0x0b23('0x3d')][_0x0b23('0x43')]('nolimit')){_0x1d74ac[_0x0b23('0x24')]=qs[_0x0b23('0x24')](_0x4d20b0[_0x0b23('0x3d')][_0x0b23('0x24')]);_0x1d74ac[_0x0b23('0x26')]=qs['offset'](_0x4d20b0[_0x0b23('0x3d')][_0x0b23('0x26')]);}return _0x52be44[_0x0b23('0x9b')](_0x1d74ac);}})[_0x0b23('0x2a')](function(_0x42e079){return _0x42e079?{'count':_0x14cd7c,'rows':_0x42e079}:null;})[_0x0b23('0x2a')](respondWithResult(_0x3cb2fe,null))[_0x0b23('0x4b')](handleError(_0x3cb2fe,null));};exports[_0x0b23('0x9c')]=function(_0x2e5e4c,_0x6e2b43,_0x3c1bce){var _0x5a77b5={};var _0x521970={};var _0x2b4484;var _0xe9810f;return db[_0x0b23('0x39')][_0x0b23('0x64')]({'where':{'id':_0x2e5e4c['params']['id']}})[_0x0b23('0x2a')](handleEntityNotFound(_0x6e2b43,null))[_0x0b23('0x2a')](function(_0x361583){if(_0x361583){_0x2b4484=_0x361583;_0x521970[_0x0b23('0x40')]=_[_0x0b23('0x4e')](db[_0x0b23('0x9d')][_0x0b23('0x3a')]);_0x521970[_0x0b23('0x3d')]=_[_0x0b23('0x4e')](_0x2e5e4c[_0x0b23('0x3d')]);_0x521970[_0x0b23('0x3e')]=_[_0x0b23('0x3f')](_0x521970[_0x0b23('0x40')],_0x521970[_0x0b23('0x3d')]);_0x5a77b5[_0x0b23('0x41')]=_[_0x0b23('0x3f')](_0x521970[_0x0b23('0x40')],qs['fields'](_0x2e5e4c['query'][_0x0b23('0x4f')]));_0x5a77b5[_0x0b23('0x41')]=_0x5a77b5['attributes'][_0x0b23('0x42')]?_0x5a77b5[_0x0b23('0x41')]:_0x521970['model'];_0x5a77b5['order']=qs[_0x0b23('0x45')](_0x2e5e4c[_0x0b23('0x3d')]['sort']);_0x5a77b5[_0x0b23('0x46')]=qs[_0x0b23('0x3e')](_[_0x0b23('0x47')](_0x2e5e4c[_0x0b23('0x3d')],_0x521970['filters']));if(_0x2e5e4c['query'][_0x0b23('0x30')]){_0x5a77b5[_0x0b23('0x46')]=_[_0x0b23('0x48')](_0x5a77b5[_0x0b23('0x46')],{'$or':_[_0x0b23('0x3c')](_0x5a77b5[_0x0b23('0x41')],function(_0x18acf9){var _0x4e200a={};_0x4e200a[_0x18acf9]={'$like':'%'+_0x2e5e4c[_0x0b23('0x3d')][_0x0b23('0x30')]+'%'};return _0x4e200a;})});}_0x5a77b5=_[_0x0b23('0x48')]({},_0x5a77b5,_0x2e5e4c[_0x0b23('0x52')]);return _0x2b4484[_0x0b23('0x9c')](_0x5a77b5);}})[_0x0b23('0x2a')](function(_0x22b665){if(_0x22b665){_0xe9810f=_0x22b665[_0x0b23('0x42')];if(!_0x2e5e4c[_0x0b23('0x3d')]['hasOwnProperty'](_0x0b23('0x44'))){_0x5a77b5[_0x0b23('0x24')]=qs[_0x0b23('0x24')](_0x2e5e4c['query'][_0x0b23('0x24')]);_0x5a77b5[_0x0b23('0x26')]=qs['offset'](_0x2e5e4c['query'][_0x0b23('0x26')]);}return _0x2b4484[_0x0b23('0x9c')](_0x5a77b5);}})[_0x0b23('0x2a')](function(_0x17fd37){if(_0x17fd37){return _0x17fd37?{'count':_0xe9810f,'rows':_0x17fd37}:null;}})['then'](respondWithResult(_0x6e2b43,null))[_0x0b23('0x4b')](handleError(_0x6e2b43,null));};exports[_0x0b23('0x9e')]=function(_0x404ec1,_0x33c5a8,_0x1cfaa4){var _0x12d643,_0x1dc0b1;return db[_0x0b23('0x39')][_0x0b23('0x53')]({'where':{'id':_0x404ec1[_0x0b23('0x4d')]['id']}})['then'](handleEntityNotFound(_0x33c5a8,null))[_0x0b23('0x2a')](function(_0x10ffad){if(_0x10ffad){_0x1dc0b1=_0x10ffad;return _0x10ffad[_0x0b23('0x9e')](_0x404ec1[_0x0b23('0x55')][_0x0b23('0x84')],_[_0x0b23('0x5e')](_0x404ec1[_0x0b23('0x55')],[_0x0b23('0x84'),'id'])||{});}return null;})[_0x0b23('0x9f')](function(_0x3a6849){var _0x155757;_0x12d643=_0x3a6849||[];var _0x4a64b2=[];if(_0x3a6849){for(var _0x446053=0x0;_0x446053<_0x3a6849[_0x0b23('0x42')];_0x446053+=0x1){var _0x820e08=_0x3a6849[_0x446053][_0x0b23('0x2c')]({'plain':!![]});_0x1dc0b1[_0x0b23('0xa0')]=_0x404ec1[_0x0b23('0x55')][_0x0b23('0xa0')]?_0x404ec1[_0x0b23('0x55')][_0x0b23('0xa0')]:_0x1dc0b1[_0x0b23('0xa0')];switch(_0x1dc0b1[_0x0b23('0xa0')]){case _0x0b23('0xa1'):_0x155757=squel[_0x0b23('0xa2')]()['into'](_0x0b23('0xa3'))[_0x0b23('0xa4')]([_0x0b23('0xa5'),'scheduledAt',_0x0b23('0xa6'),_0x0b23('0xa7'),'VoiceQueueId',_0x0b23('0x5f'),_0x0b23('0x60')],squel[_0x0b23('0x85')]()['field']('phone',_0x0b23('0xa5'))[_0x0b23('0xa8')](_0x0b23('0xa9'),_0x0b23('0xaa'))[_0x0b23('0xa8')]('id','ContactId')['field'](_0x820e08[_0x0b23('0xab')]['toString'](),_0x0b23('0xa7'))[_0x0b23('0xa8')](_0x404ec1['params']['id'][_0x0b23('0x8b')](),'VoiceQueueId')[_0x0b23('0xa8')](_0x0b23('0xa9'),'createdAt')['field']('NOW()','updatedAt')[_0x0b23('0xac')](_0x0b23('0xad'))[_0x0b23('0x46')](_0x0b23('0xae'))[_0x0b23('0x46')]('ListId\x20=\x20?',_0x820e08[_0x0b23('0xab')][_0x0b23('0x8b')]())[_0x0b23('0x46')](_0x0b23('0xaf'))[_0x0b23('0x46')](_0x0b23('0xb0'),squel[_0x0b23('0x85')]()[_0x0b23('0xa8')](_0x0b23('0xb1'))['from'](_0x0b23('0xb2'))['where'](_0x0b23('0x89'),_0x404ec1[_0x0b23('0x4d')]['id'][_0x0b23('0x8b')]()))['where'](_0x0b23('0xb0'),squel['select']()[_0x0b23('0xa8')](_0x0b23('0xb3'))[_0x0b23('0xac')](_0x0b23('0xa3'))['where'](_0x0b23('0x89'),_0x404ec1[_0x0b23('0x4d')]['id']['toString']())))['toString']();break;case _0x0b23('0xb4'):_0x155757=squel[_0x0b23('0xa2')]()[_0x0b23('0xb5')]('cm_hopper')[_0x0b23('0xa4')]([_0x0b23('0xa5'),_0x0b23('0xaa'),_0x0b23('0xa6'),'ListId',_0x0b23('0x6c'),_0x0b23('0x5f'),_0x0b23('0x60')],squel[_0x0b23('0x85')]()['field']('phone',_0x0b23('0xa5'))['field']('NOW()','scheduledAt')[_0x0b23('0xa8')]('id',_0x0b23('0xa6'))[_0x0b23('0xa8')](_0x820e08[_0x0b23('0xab')][_0x0b23('0x8b')](),_0x0b23('0xa7'))[_0x0b23('0xa8')](_0x404ec1[_0x0b23('0x4d')]['id'][_0x0b23('0x8b')](),_0x0b23('0x6c'))[_0x0b23('0xa8')](_0x0b23('0xa9'),_0x0b23('0x5f'))[_0x0b23('0xa8')](_0x0b23('0xa9'),_0x0b23('0x60'))['from'](_0x0b23('0xad'))['where'](_0x0b23('0xae'))[_0x0b23('0x46')](_0x0b23('0xb6'),_0x820e08[_0x0b23('0xab')][_0x0b23('0x8b')]())[_0x0b23('0x46')](_0x0b23('0xaf'))[_0x0b23('0x46')]('phone\x20NOT\x20IN\x20(?)',squel[_0x0b23('0x85')]()['field']('COALESCE(phone,\x27\x27)')[_0x0b23('0xac')](_0x0b23('0xa3'))[_0x0b23('0x46')]('VoiceQueueId\x20=\x20?',_0x404ec1[_0x0b23('0x4d')]['id'][_0x0b23('0x8b')]())))['toString']();break;default:_0x155757=squel[_0x0b23('0xa2')]()[_0x0b23('0xb5')](_0x0b23('0xa3'))[_0x0b23('0xa4')](['phone',_0x0b23('0xaa'),_0x0b23('0xa6'),'ListId','VoiceQueueId',_0x0b23('0x5f'),_0x0b23('0x60')],squel['select']()['field'](_0x0b23('0xa5'),_0x0b23('0xa5'))[_0x0b23('0xa8')]('NOW()',_0x0b23('0xaa'))[_0x0b23('0xa8')]('id','ContactId')[_0x0b23('0xa8')](_0x820e08['CmListId'][_0x0b23('0x8b')](),_0x0b23('0xa7'))[_0x0b23('0xa8')](_0x404ec1[_0x0b23('0x4d')]['id'][_0x0b23('0x8b')](),_0x0b23('0x6c'))[_0x0b23('0xa8')](_0x0b23('0xa9'),_0x0b23('0x5f'))[_0x0b23('0xa8')]('NOW()',_0x0b23('0x60'))['from'](_0x0b23('0xad'))[_0x0b23('0x46')](_0x0b23('0xae'))[_0x0b23('0x46')](_0x0b23('0xb6'),_0x820e08[_0x0b23('0xab')][_0x0b23('0x8b')]())['where'](_0x0b23('0xaf')))['toString']();}_0x4a64b2[_0x0b23('0x97')](db['sequelize']['query'](_0x155757));}return BPromise[_0x0b23('0x8f')](_0x4a64b2);}})[_0x0b23('0x2a')](function(){return _0x12d643;})[_0x0b23('0x2a')](respondWithResult(_0x33c5a8,null))[_0x0b23('0x4b')](handleError(_0x33c5a8,null));};exports[_0x0b23('0xb7')]=function(_0x14088c,_0x53c3e5,_0x5cb662){return db[_0x0b23('0x39')][_0x0b23('0x53')]({'where':{'id':_0x14088c[_0x0b23('0x4d')]['id']}})[_0x0b23('0x2a')](handleEntityNotFound(_0x53c3e5,null))[_0x0b23('0x2a')](function(_0x250130){if(_0x250130){return _0x250130[_0x0b23('0xb7')](_0x14088c[_0x0b23('0x3d')]['ids']);}})[_0x0b23('0x2a')](function(_0x2ab2be){if(_0x2ab2be){return db[_0x0b23('0x65')]['destroy']({'where':{'ListId':_0x14088c[_0x0b23('0x3d')][_0x0b23('0x84')],'VoiceQueueId':_0x14088c[_0x0b23('0x4d')]['id']}})[_0x0b23('0x2a')](function(){return _0x2ab2be;});}})['then'](respondWithStatusCode(_0x53c3e5,null))[_0x0b23('0x4b')](handleError(_0x53c3e5,null));};exports[_0x0b23('0xb8')]=function(_0x18410c,_0x1a1fbd,_0x31adff){var _0x4cc59d={};var _0x230252={};var _0x160b0c;var _0x3b2c8e;return db[_0x0b23('0x39')][_0x0b23('0x64')]({'where':{'id':_0x18410c[_0x0b23('0x4d')]['id']}})[_0x0b23('0x2a')](handleEntityNotFound(_0x1a1fbd,null))[_0x0b23('0x2a')](function(_0x45752b){if(_0x45752b){_0x160b0c=_0x45752b;_0x230252['model']=_[_0x0b23('0x4e')](db['CmList']['rawAttributes']);_0x230252[_0x0b23('0x3d')]=_[_0x0b23('0x4e')](_0x18410c['query']);_0x230252[_0x0b23('0x3e')]=_[_0x0b23('0x3f')](_0x230252['model'],_0x230252[_0x0b23('0x3d')]);_0x4cc59d['attributes']=_[_0x0b23('0x3f')](_0x230252[_0x0b23('0x40')],qs[_0x0b23('0x4f')](_0x18410c['query'][_0x0b23('0x4f')]));_0x4cc59d[_0x0b23('0x41')]=_0x4cc59d[_0x0b23('0x41')][_0x0b23('0x42')]?_0x4cc59d[_0x0b23('0x41')]:_0x230252[_0x0b23('0x40')];_0x4cc59d[_0x0b23('0x66')]=qs[_0x0b23('0x45')](_0x18410c['query']['sort']);_0x4cc59d[_0x0b23('0x46')]=qs[_0x0b23('0x3e')](_[_0x0b23('0x47')](_0x18410c[_0x0b23('0x3d')],_0x230252[_0x0b23('0x3e')]));if(_0x18410c[_0x0b23('0x3d')]['filter']){_0x4cc59d['where']=_[_0x0b23('0x48')](_0x4cc59d[_0x0b23('0x46')],{'$or':_['map'](_0x4cc59d[_0x0b23('0x41')],function(_0xc333f3){var _0x275b0b={};_0x275b0b[_0xc333f3]={'$like':'%'+_0x18410c[_0x0b23('0x3d')][_0x0b23('0x30')]+'%'};return _0x275b0b;})});}_0x4cc59d=_[_0x0b23('0x48')]({},_0x4cc59d,_0x18410c[_0x0b23('0x52')]);return _0x160b0c[_0x0b23('0xb8')](_0x4cc59d);}})[_0x0b23('0x2a')](function(_0x2d03da){if(_0x2d03da){_0x3b2c8e=_0x2d03da['length'];if(!_0x18410c[_0x0b23('0x3d')][_0x0b23('0x43')](_0x0b23('0x44'))){_0x4cc59d['limit']=qs[_0x0b23('0x24')](_0x18410c['query'][_0x0b23('0x24')]);_0x4cc59d['offset']=qs[_0x0b23('0x26')](_0x18410c[_0x0b23('0x3d')][_0x0b23('0x26')]);}return _0x160b0c[_0x0b23('0xb8')](_0x4cc59d);}})['then'](function(_0x42d87c){if(_0x42d87c){return _0x42d87c?{'count':_0x3b2c8e,'rows':_0x42d87c}:null;}})[_0x0b23('0x2a')](respondWithResult(_0x1a1fbd,null))[_0x0b23('0x4b')](handleError(_0x1a1fbd,null));};exports[_0x0b23('0xb9')]=function(_0x826c46,_0x44909d,_0x34f7d8){var _0x3e8e9f,_0x23c2c4;return db['VoiceQueue']['find']({'where':{'id':_0x826c46[_0x0b23('0x4d')]['id']}})[_0x0b23('0x2a')](handleEntityNotFound(_0x44909d,null))['then'](function(_0xbb148c){if(_0xbb148c){_0x23c2c4=_0xbb148c;return _0xbb148c[_0x0b23('0xb9')](_0x826c46[_0x0b23('0x55')]['ids'],_[_0x0b23('0x5e')](_0x826c46[_0x0b23('0x55')],[_0x0b23('0x84'),'id'])||{});}return null;})[_0x0b23('0x9f')](function(_0x3e1f67){var _0x241acf;_0x3e8e9f=_0x3e1f67||[];var _0x36cc12=[];if(_0x3e1f67){for(var _0x1cc317=0x0;_0x1cc317<_0x3e1f67['length'];_0x1cc317+=0x1){var _0x2c23ef=_0x3e1f67[_0x1cc317]['get']({'plain':!![]});_0x241acf=squel['insert']()['into'](_0x0b23('0xba'))[_0x0b23('0xa4')]([_0x0b23('0xa5'),_0x0b23('0xa6'),'ListId',_0x0b23('0x6c'),_0x0b23('0x5f'),_0x0b23('0x60')],squel[_0x0b23('0x85')]()[_0x0b23('0xa8')]('phone',_0x0b23('0xa5'))[_0x0b23('0xa8')]('id',_0x0b23('0xa6'))['field'](_0x2c23ef[_0x0b23('0xab')][_0x0b23('0x8b')](),_0x0b23('0xa7'))[_0x0b23('0xa8')](_0x826c46[_0x0b23('0x4d')]['id'][_0x0b23('0x8b')](),'VoiceQueueId')[_0x0b23('0xa8')](_0x0b23('0xa9'),'createdAt')['field'](_0x0b23('0xa9'),_0x0b23('0x60'))[_0x0b23('0xac')](_0x0b23('0xad'))[_0x0b23('0x46')]('deletedAt\x20IS\x20NULL')['where'](_0x0b23('0xb6'),_0x2c23ef[_0x0b23('0xab')][_0x0b23('0x8b')]())[_0x0b23('0x46')](_0x0b23('0xaf')))['toString']();_0x36cc12[_0x0b23('0x97')](db[_0x0b23('0x7a')][_0x0b23('0x3d')](_0x241acf));}return BPromise['all'](_0x36cc12);}})[_0x0b23('0x2a')](function(){return _0x3e8e9f;})['then'](respondWithResult(_0x44909d,null))['catch'](handleError(_0x44909d,null));};exports['removeBlackLists']=function(_0x404bb5,_0x432059,_0x1f75f9){return db[_0x0b23('0x39')][_0x0b23('0x53')]({'where':{'id':_0x404bb5[_0x0b23('0x4d')]['id']}})['then'](handleEntityNotFound(_0x432059,null))['then'](function(_0x5fb8d0){if(_0x5fb8d0){return _0x5fb8d0[_0x0b23('0xbb')](_0x404bb5[_0x0b23('0x3d')][_0x0b23('0x84')]);}})[_0x0b23('0x2a')](function(_0x483526){if(_0x483526){return db['CmHopperBlack'][_0x0b23('0x2b')]({'where':{'ListId':_0x404bb5[_0x0b23('0x3d')][_0x0b23('0x84')],'VoiceQueueId':_0x404bb5[_0x0b23('0x4d')]['id']}})[_0x0b23('0x2a')](function(){return _0x483526;});}})[_0x0b23('0x2a')](respondWithStatusCode(_0x432059,null))[_0x0b23('0x4b')](handleError(_0x432059,null));}; \ No newline at end of file +var _0x3439=['CmHopperHistory','nolimit','VoiceQueueId','getHopperFinals','CmHopperFinal','findAll','getHopperBlacks','CmHopperBlack','Team','getTeams','addTeams','teams','online','voicePause','interface','flatMap','Agents','forEach','penalty','sequelize','transaction','each','TeamVoiceQueue','upsert','UserVoiceQueue','findOrCreate','UserVoiceQueueRt','isNil','format','SIP/%s','emit','userVoiceQueue:save','removeTeams','ids','select','field','from','team_has_voice_queues','join','user_has_teams','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','TeamId','includes','isEmpty','removeAgents','userVoiceQueue:remove','addAgents','spread','User','push','all','isArray','getAgents','getMembers','getLists','CmList','addLists','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ListId','createdAt','NOW()','ContactId','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','COALESCE(phone,\x27\x27)','CmListId','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','to-csv','fs-extra','squel','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','redis','localhost','./voiceQueue.socket','register','sendStatus','status','end','offset','limit','undefined','set','Content-Range','apply','save','update','then','destroy','get','VoiceQueues','inbound','QueueCampaigns','outbound','filter','map','value','type','find','name','UserProfileResource','stack','send','index','VoiceQueue','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','options','count','include','rows','catch','show','params','rawAttributes','includeAll','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','updatedAt','autoAssociation','error','getHoppers','findOne','CmHopper','getHopperHistories'];(function(_0x3e51e2,_0x5196c2){var _0x2817b9=function(_0x1f3cf8){while(--_0x1f3cf8){_0x3e51e2['push'](_0x3e51e2['shift']());}};_0x2817b9(++_0x5196c2);}(_0x3439,0x1cc));var _0x9343=function(_0xbd1760,_0x43d413){_0xbd1760=_0xbd1760-0x0;var _0x2f71d9=_0x3439[_0xbd1760];return _0x2f71d9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9343('0x0'));var zipdir=require(_0x9343('0x1'));var jsonpatch=require(_0x9343('0x2'));var rp=require(_0x9343('0x3'));var moment=require('moment');var BPromise=require(_0x9343('0x4'));var Mustache=require(_0x9343('0x5'));var util=require('util');var path=require(_0x9343('0x6'));var sox=require('sox');var csv=require(_0x9343('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9343('0x8'));var _=require('lodash');var squel=require(_0x9343('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x9343('0xa'));var toCsv=require(_0x9343('0x7'));var querystring=require(_0x9343('0xb'));var Papa=require('papaparse');var Redis=require(_0x9343('0xc'));var authService=require(_0x9343('0xd'));var qs=require(_0x9343('0xe'));var as=require(_0x9343('0xf'));var hardwareService=require(_0x9343('0x10'));var logger=require(_0x9343('0x11'))(_0x9343('0x12'));var utils=require(_0x9343('0x13'));var config=require(_0x9343('0x14'));var licenseUtil=require(_0x9343('0x15'));var db=require(_0x9343('0x16'))['db'];config[_0x9343('0x17')]=_['defaults'](config['redis'],{'host':_0x9343('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9343('0x17')]));require(_0x9343('0x19'))[_0x9343('0x1a')](socket);function respondWithStatusCode(_0x47f5f4,_0x237353){_0x237353=_0x237353||0xcc;return function(_0x2096fa){if(_0x2096fa){return _0x47f5f4[_0x9343('0x1b')](_0x237353);}return _0x47f5f4[_0x9343('0x1c')](_0x237353)[_0x9343('0x1d')]();};}function respondWithResult(_0x4f5457,_0x5a48b0){_0x5a48b0=_0x5a48b0||0xc8;return function(_0x3b4a9){if(_0x3b4a9){return _0x4f5457[_0x9343('0x1c')](_0x5a48b0)['json'](_0x3b4a9);}};}function respondWithFilteredResult(_0x7e7d06,_0x16670d){return function(_0x4ad4d6){if(_0x4ad4d6){var _0x41794b=typeof _0x16670d[_0x9343('0x1e')]==='undefined'&&typeof _0x16670d[_0x9343('0x1f')]===_0x9343('0x20');var _0x26fca5=_0x4ad4d6['count'];var _0x16aefc=_0x41794b?0x0:_0x16670d[_0x9343('0x1e')];var _0x47399a=_0x41794b?_0x4ad4d6['count']:_0x16670d[_0x9343('0x1e')]+_0x16670d[_0x9343('0x1f')];var _0x40ac32;if(_0x47399a>=_0x26fca5){_0x47399a=_0x26fca5;_0x40ac32=0xc8;}else{_0x40ac32=0xce;}_0x7e7d06[_0x9343('0x1c')](_0x40ac32);return _0x7e7d06[_0x9343('0x21')](_0x9343('0x22'),_0x16aefc+'-'+_0x47399a+'/'+_0x26fca5)['json'](_0x4ad4d6);}return null;};}function patchUpdates(_0x49908b){return function(_0x177e81){try{jsonpatch[_0x9343('0x23')](_0x177e81,_0x49908b,!![]);}catch(_0x3e9dda){return BPromise['reject'](_0x3e9dda);}return _0x177e81[_0x9343('0x24')]();};}function saveUpdates(_0x1e0491,_0x47a89b){return function(_0x41f693){if(_0x41f693){return _0x41f693[_0x9343('0x25')](_0x1e0491)[_0x9343('0x26')](function(_0x559b03){return _0x559b03;});}return null;};}function removeEntity(_0x2866f7,_0x47f47d){return function(_0x552214){if(_0x552214){return _0x552214[_0x9343('0x27')]()[_0x9343('0x26')](function(){var _0x3d5116=_0x552214[_0x9343('0x28')]({'plain':!![]});var _0x3137bc=[{'name':_0x9343('0x29'),'value':_0x9343('0x2a'),'ignore':![]},{'name':_0x9343('0x2b'),'value':_0x9343('0x2c'),'ignore':![]}];var _0x35b4c5=_(_0x3137bc)[_0x9343('0x2d')]('ignore')[_0x9343('0x2e')](_0x9343('0x2f'))[_0x9343('0x2f')]();if(_['includes'](_0x35b4c5,_0x3d5116[_0x9343('0x30')])){return;}var _0x3589c9=_[_0x9343('0x31')](_0x3137bc,[_0x9343('0x2f'),_0x3d5116[_0x9343('0x30')]])[_0x9343('0x32')];return db[_0x9343('0x33')]['destroy']({'where':{'type':_0x3589c9,'resourceId':_0x3d5116['id']}})[_0x9343('0x26')](function(){return _0x552214;});})[_0x9343('0x26')](function(){_0x2866f7[_0x9343('0x1c')](0xcc)[_0x9343('0x1d')]();});}};}function handleEntityNotFound(_0x379058,_0x5b748a){return function(_0x17232e){if(!_0x17232e){_0x379058[_0x9343('0x1b')](0x194);}return _0x17232e;};}function handleError(_0x32bd38,_0x2c8a48){_0x2c8a48=_0x2c8a48||0x1f4;return function(_0x4a36db){logger['error'](_0x4a36db[_0x9343('0x34')]);if(_0x4a36db['name']){delete _0x4a36db[_0x9343('0x32')];}_0x32bd38['status'](_0x2c8a48)[_0x9343('0x35')](_0x4a36db);};}exports[_0x9343('0x36')]=function(_0x21c4a3,_0x29f593){var _0x4034fe={},_0x4d0532={},_0x5f56dc={'count':0x0,'rows':[]};var _0x7f64fd=_[_0x9343('0x2e')](db[_0x9343('0x37')]['rawAttributes'],function(_0x44fa44){return{'name':_0x44fa44['fieldName'],'type':_0x44fa44[_0x9343('0x30')][_0x9343('0x38')]};});_0x4d0532[_0x9343('0x39')]=_['map'](_0x7f64fd,_0x9343('0x32'));_0x4d0532[_0x9343('0x3a')]=_[_0x9343('0x3b')](_0x21c4a3['query']);_0x4d0532[_0x9343('0x3c')]=_['intersection'](_0x4d0532['model'],_0x4d0532[_0x9343('0x3a')]);_0x4034fe[_0x9343('0x3d')]=_[_0x9343('0x3e')](_0x4d0532[_0x9343('0x39')],qs[_0x9343('0x3f')](_0x21c4a3[_0x9343('0x3a')][_0x9343('0x3f')]));_0x4034fe['attributes']=_0x4034fe['attributes'][_0x9343('0x40')]?_0x4034fe[_0x9343('0x3d')]:_0x4d0532[_0x9343('0x39')];if(!_0x21c4a3['query'][_0x9343('0x41')]('nolimit')){_0x4034fe[_0x9343('0x1f')]=qs[_0x9343('0x1f')](_0x21c4a3[_0x9343('0x3a')]['limit']);_0x4034fe[_0x9343('0x1e')]=qs[_0x9343('0x1e')](_0x21c4a3[_0x9343('0x3a')][_0x9343('0x1e')]);}_0x4034fe[_0x9343('0x42')]=qs[_0x9343('0x43')](_0x21c4a3[_0x9343('0x3a')][_0x9343('0x43')]);_0x4034fe[_0x9343('0x44')]=qs[_0x9343('0x3c')](_[_0x9343('0x45')](_0x21c4a3[_0x9343('0x3a')],_0x4d0532[_0x9343('0x3c')]),_0x7f64fd);if(_0x21c4a3['query'][_0x9343('0x2d')]){_0x4034fe[_0x9343('0x44')]=_[_0x9343('0x46')](_0x4034fe[_0x9343('0x44')],{'$or':_[_0x9343('0x2e')](_0x7f64fd,function(_0x37a3a7){if(_0x37a3a7[_0x9343('0x30')]!==_0x9343('0x47')){var _0x245102={};_0x245102[_0x37a3a7[_0x9343('0x32')]]={'$like':'%'+_0x21c4a3[_0x9343('0x3a')][_0x9343('0x2d')]+'%'};return _0x245102;}})});}_0x4034fe=_[_0x9343('0x46')]({},_0x4034fe,_0x21c4a3[_0x9343('0x48')]);var _0x2ba5b5={'where':_0x4034fe['where']};return db['VoiceQueue']['count'](_0x2ba5b5)[_0x9343('0x26')](function(_0xb64f03){_0x5f56dc[_0x9343('0x49')]=_0xb64f03;if(_0x21c4a3['query']['includeAll']){_0x4034fe[_0x9343('0x4a')]=[{'all':!![]}];}return db['VoiceQueue']['findAll'](_0x4034fe);})[_0x9343('0x26')](function(_0x3001c2){_0x5f56dc[_0x9343('0x4b')]=_0x3001c2;return _0x5f56dc;})[_0x9343('0x26')](respondWithFilteredResult(_0x29f593,_0x4034fe))[_0x9343('0x4c')](handleError(_0x29f593,null));};exports[_0x9343('0x4d')]=function(_0x4c9a5c,_0x43681d){var _0x4e355a={'raw':![],'where':{'id':_0x4c9a5c[_0x9343('0x4e')]['id']}},_0x29a3b6={};_0x29a3b6[_0x9343('0x39')]=_[_0x9343('0x3b')](db[_0x9343('0x37')][_0x9343('0x4f')]);_0x29a3b6[_0x9343('0x3a')]=_['keys'](_0x4c9a5c[_0x9343('0x3a')]);_0x29a3b6[_0x9343('0x3c')]=_[_0x9343('0x3e')](_0x29a3b6['model'],_0x29a3b6[_0x9343('0x3a')]);_0x4e355a['attributes']=_['intersection'](_0x29a3b6[_0x9343('0x39')],qs['fields'](_0x4c9a5c['query'][_0x9343('0x3f')]));_0x4e355a['attributes']=_0x4e355a[_0x9343('0x3d')]['length']?_0x4e355a[_0x9343('0x3d')]:_0x29a3b6[_0x9343('0x39')];if(_0x4c9a5c[_0x9343('0x3a')][_0x9343('0x50')]){_0x4e355a[_0x9343('0x4a')]=[{'all':!![]}];}_0x4e355a=_[_0x9343('0x46')]({},_0x4e355a,_0x4c9a5c[_0x9343('0x48')]);return db[_0x9343('0x37')][_0x9343('0x31')](_0x4e355a)[_0x9343('0x26')](handleEntityNotFound(_0x43681d,null))[_0x9343('0x26')](respondWithResult(_0x43681d,null))['catch'](handleError(_0x43681d,null));};exports[_0x9343('0x51')]=function(_0x34c34a,_0x4961af){return db[_0x9343('0x37')][_0x9343('0x51')](_0x34c34a[_0x9343('0x52')],{})[_0x9343('0x26')](function(_0x28d532){var _0x228ad6=_0x34c34a[_0x9343('0x53')][_0x9343('0x28')]({'plain':!![]});if(!_0x228ad6)throw new Error(_0x9343('0x54'));if(_0x228ad6[_0x9343('0x55')]===_0x9343('0x53')){var _0x52480e=_0x28d532[_0x9343('0x28')]({'plain':!![]});var _0x255b15=[{'name':_0x9343('0x29'),'value':'inbound'},{'name':_0x9343('0x2b'),'value':_0x9343('0x2c')}];var _0x237e39=_[_0x9343('0x31')](_0x255b15,[_0x9343('0x2f'),_0x52480e['type']])[_0x9343('0x32')];return db[_0x9343('0x56')]['find']({'where':{'name':_0x237e39,'userProfileId':_0x228ad6[_0x9343('0x57')]},'raw':!![]})[_0x9343('0x26')](function(_0x440c90){if(_0x440c90&&_0x440c90['autoAssociation']===0x0){return db[_0x9343('0x33')][_0x9343('0x51')]({'name':_0x52480e[_0x9343('0x32')],'resourceId':_0x52480e['id'],'type':_0x440c90[_0x9343('0x32')],'sectionId':_0x440c90['id']},{})[_0x9343('0x26')](function(){return _0x28d532;});}else{return _0x28d532;}})[_0x9343('0x4c')](function(_0x48db42){logger['error'](_0x9343('0x58'),_0x48db42);throw _0x48db42;});}return _0x28d532;})[_0x9343('0x26')](respondWithResult(_0x4961af,0xc9))[_0x9343('0x4c')](handleError(_0x4961af,null));};exports[_0x9343('0x59')]=function(_0x2bb843,_0x2cbe44){var _0x57f237={'where':{'id':_0x2bb843['params']['id']}},_0x2b63c2={};_0x2b63c2[_0x9343('0x39')]=_[_0x9343('0x3b')](db[_0x9343('0x37')][_0x9343('0x4f')]);_0x57f237['attributes']=_['intersection'](_0x2b63c2['model'],qs[_0x9343('0x3f')](_0x2bb843[_0x9343('0x3a')][_0x9343('0x3f')]));_0x57f237[_0x9343('0x3d')]=_0x57f237[_0x9343('0x3d')]['length']?_0x57f237['attributes']:_0x2b63c2[_0x9343('0x39')];if(_0x2bb843[_0x9343('0x3a')]['includeAll']){_0x57f237[_0x9343('0x4a')]=[{'all':!![]}];}_0x57f237=_[_0x9343('0x46')]({},_0x57f237,_0x2bb843['options']);return db[_0x9343('0x37')][_0x9343('0x31')](_0x57f237)['then'](handleEntityNotFound(_0x2cbe44,null))[_0x9343('0x26')](function(_0x31ca65){if(_0x31ca65){var _0x591dd7=_0x31ca65[_0x9343('0x28')]({'plain':!![]});_0x591dd7=qs[_0x9343('0x5a')](_0x591dd7,['id','createdAt',_0x9343('0x5b')]);_0x2bb843[_0x9343('0x52')]=_[_0x9343('0x5a')](_0x2bb843[_0x9343('0x52')],['id','createdAt',_0x9343('0x5b')]);return db[_0x9343('0x37')]['create'](_[_0x9343('0x46')](_0x591dd7,_0x2bb843['body']),{'include':_0x2bb843[_0x9343('0x3a')][_0x9343('0x50')]?[{'all':!![]}]:undefined})[_0x9343('0x26')](function(_0x3293df){var _0x6250b1=_0x2bb843[_0x9343('0x53')][_0x9343('0x28')]({'plain':!![]});if(!_0x6250b1)throw new Error(_0x9343('0x54'));if(_0x6250b1[_0x9343('0x55')]==='user'){var _0x4057b1=_0x3293df[_0x9343('0x28')]({'plain':!![]});var _0x329756=[{'name':_0x9343('0x29'),'value':'inbound'},{'name':'QueueCampaigns','value':'outbound'}];var _0x29e92e=_[_0x9343('0x31')](_0x329756,[_0x9343('0x2f'),_0x4057b1[_0x9343('0x30')]])['name'];return db[_0x9343('0x56')][_0x9343('0x31')]({'where':{'name':_0x29e92e,'userProfileId':_0x6250b1[_0x9343('0x57')]},'raw':!![]})['then'](function(_0x4d6b22){if(_0x4d6b22&&_0x4d6b22[_0x9343('0x5c')]===0x0){return db[_0x9343('0x33')][_0x9343('0x51')]({'name':_0x4057b1[_0x9343('0x32')],'resourceId':_0x4057b1['id'],'type':_0x4d6b22[_0x9343('0x32')],'sectionId':_0x4d6b22['id']},{})['then'](function(){return _0x3293df;});}else{return _0x3293df;}})[_0x9343('0x4c')](function(_0xb39ca1){logger[_0x9343('0x5d')](_0x9343('0x58'),_0xb39ca1);throw _0xb39ca1;});}return _0x3293df;});}})[_0x9343('0x26')](respondWithResult(_0x2cbe44,0xc9))[_0x9343('0x4c')](handleError(_0x2cbe44,null));};exports[_0x9343('0x25')]=function(_0x53da8f,_0x8c303e){if(_0x53da8f[_0x9343('0x52')]['id']){delete _0x53da8f['body']['id'];}return db[_0x9343('0x37')]['find']({'where':{'id':_0x53da8f[_0x9343('0x4e')]['id']}})[_0x9343('0x26')](handleEntityNotFound(_0x8c303e,null))[_0x9343('0x26')](saveUpdates(_0x53da8f[_0x9343('0x52')],null))[_0x9343('0x26')](respondWithResult(_0x8c303e,null))[_0x9343('0x4c')](handleError(_0x8c303e,null));};exports[_0x9343('0x27')]=function(_0x1ac640,_0x204d91){return db[_0x9343('0x37')][_0x9343('0x31')]({'where':{'id':_0x1ac640['params']['id']}})[_0x9343('0x26')](handleEntityNotFound(_0x204d91,null))[_0x9343('0x26')](removeEntity(_0x204d91,null))[_0x9343('0x4c')](handleError(_0x204d91,null));};exports[_0x9343('0x5e')]=function(_0x26a8f0,_0x464125,_0x34aeaf){var _0x50e8d3={'raw':![],'where':{}};var _0x548762={};var _0x1e44b4={'count':0x0,'rows':[]};return db[_0x9343('0x37')][_0x9343('0x5f')]({'where':{'id':_0x26a8f0[_0x9343('0x4e')]['id']}})[_0x9343('0x26')](handleEntityNotFound(_0x464125,null))['then'](function(_0x5e26db){if(_0x5e26db){_0x548762[_0x9343('0x39')]=_[_0x9343('0x3b')](db[_0x9343('0x60')][_0x9343('0x4f')]);_0x548762[_0x9343('0x3a')]=_[_0x9343('0x3b')](_0x26a8f0['query']);_0x548762[_0x9343('0x3c')]=_[_0x9343('0x3e')](_0x548762['model'],_0x548762[_0x9343('0x3a')]);_0x50e8d3[_0x9343('0x3d')]=_['intersection'](_0x548762[_0x9343('0x39')],qs[_0x9343('0x3f')](_0x26a8f0[_0x9343('0x3a')][_0x9343('0x3f')]));_0x50e8d3[_0x9343('0x3d')]=_0x50e8d3[_0x9343('0x3d')][_0x9343('0x40')]?_0x50e8d3[_0x9343('0x3d')]:_0x548762[_0x9343('0x39')];if(!_0x26a8f0[_0x9343('0x3a')][_0x9343('0x41')]('nolimit')){_0x50e8d3['limit']=qs['limit'](_0x26a8f0[_0x9343('0x3a')][_0x9343('0x1f')]);_0x50e8d3[_0x9343('0x1e')]=qs[_0x9343('0x1e')](_0x26a8f0[_0x9343('0x3a')][_0x9343('0x1e')]);}_0x50e8d3[_0x9343('0x42')]=qs[_0x9343('0x43')](_0x26a8f0[_0x9343('0x3a')][_0x9343('0x43')]);_0x50e8d3[_0x9343('0x44')]=qs[_0x9343('0x3c')](_[_0x9343('0x45')](_0x26a8f0[_0x9343('0x3a')],_0x548762[_0x9343('0x3c')]));_0x50e8d3[_0x9343('0x44')]['VoiceQueueId']=_0x5e26db['id'];if(_0x26a8f0[_0x9343('0x3a')][_0x9343('0x2d')]){_0x50e8d3[_0x9343('0x44')]=_[_0x9343('0x46')](_0x50e8d3[_0x9343('0x44')],{'$or':_[_0x9343('0x2e')](_0x50e8d3[_0x9343('0x3d')],function(_0x1f202e){var _0xb6bb90={};_0xb6bb90[_0x1f202e]={'$like':'%'+_0x26a8f0['query'][_0x9343('0x2d')]+'%'};return _0xb6bb90;})});}_0x50e8d3=_[_0x9343('0x46')]({},_0x50e8d3,_0x26a8f0[_0x9343('0x48')]);return db['CmHopper']['count']({'where':_0x50e8d3[_0x9343('0x44')]})[_0x9343('0x26')](function(_0x3f14b1){_0x1e44b4[_0x9343('0x49')]=_0x3f14b1;if(_0x26a8f0[_0x9343('0x3a')][_0x9343('0x50')]){_0x50e8d3[_0x9343('0x4a')]=[{'all':!![]}];}return db[_0x9343('0x60')]['findAll'](_0x50e8d3);})['then'](function(_0x214584){_0x1e44b4[_0x9343('0x4b')]=_0x214584;return _0x1e44b4;});}})['then'](respondWithFilteredResult(_0x464125,_0x50e8d3))['catch'](handleError(_0x464125,null));};exports[_0x9343('0x61')]=function(_0x5db8dc,_0x27b599,_0x4bc148){var _0x1a45a8={'raw':!![],'where':{}};var _0x45d1f5={};var _0x324e23={'count':0x0,'rows':[]};return db[_0x9343('0x37')][_0x9343('0x5f')]({'where':{'id':_0x5db8dc[_0x9343('0x4e')]['id']}})[_0x9343('0x26')](handleEntityNotFound(_0x27b599,null))[_0x9343('0x26')](function(_0x45421e){if(_0x45421e){_0x45d1f5[_0x9343('0x39')]=_[_0x9343('0x3b')](db[_0x9343('0x62')][_0x9343('0x4f')]);_0x45d1f5[_0x9343('0x3a')]=_[_0x9343('0x3b')](_0x5db8dc['query']);_0x45d1f5[_0x9343('0x3c')]=_[_0x9343('0x3e')](_0x45d1f5[_0x9343('0x39')],_0x45d1f5['query']);_0x1a45a8[_0x9343('0x3d')]=_[_0x9343('0x3e')](_0x45d1f5[_0x9343('0x39')],qs['fields'](_0x5db8dc[_0x9343('0x3a')]['fields']));_0x1a45a8['attributes']=_0x1a45a8[_0x9343('0x3d')][_0x9343('0x40')]?_0x1a45a8[_0x9343('0x3d')]:_0x45d1f5[_0x9343('0x39')];if(!_0x5db8dc[_0x9343('0x3a')]['hasOwnProperty'](_0x9343('0x63'))){_0x1a45a8[_0x9343('0x1f')]=qs['limit'](_0x5db8dc[_0x9343('0x3a')][_0x9343('0x1f')]);_0x1a45a8[_0x9343('0x1e')]=qs[_0x9343('0x1e')](_0x5db8dc['query'][_0x9343('0x1e')]);}_0x1a45a8[_0x9343('0x42')]=qs[_0x9343('0x43')](_0x5db8dc[_0x9343('0x3a')][_0x9343('0x43')]);_0x1a45a8[_0x9343('0x44')]=qs[_0x9343('0x3c')](_['pick'](_0x5db8dc[_0x9343('0x3a')],_0x45d1f5[_0x9343('0x3c')]));_0x1a45a8[_0x9343('0x44')][_0x9343('0x64')]=_0x45421e['id'];if(_0x5db8dc[_0x9343('0x3a')][_0x9343('0x2d')]){_0x1a45a8[_0x9343('0x44')]=_[_0x9343('0x46')](_0x1a45a8[_0x9343('0x44')],{'$or':_[_0x9343('0x2e')](_0x1a45a8['attributes'],function(_0x1bbe79){var _0x5c71f4={};_0x5c71f4[_0x1bbe79]={'$like':'%'+_0x5db8dc[_0x9343('0x3a')][_0x9343('0x2d')]+'%'};return _0x5c71f4;})});}_0x1a45a8=_['merge']({},_0x1a45a8,_0x5db8dc['options']);return db[_0x9343('0x62')]['count']({'where':_0x1a45a8[_0x9343('0x44')]})[_0x9343('0x26')](function(_0x42ee81){_0x324e23['count']=_0x42ee81;if(_0x5db8dc[_0x9343('0x3a')][_0x9343('0x50')]){_0x1a45a8[_0x9343('0x4a')]=[{'all':!![]}];}return db['CmHopperHistory']['findAll'](_0x1a45a8);})[_0x9343('0x26')](function(_0x260bc5){_0x324e23[_0x9343('0x4b')]=_0x260bc5;return _0x324e23;});}})[_0x9343('0x26')](respondWithFilteredResult(_0x27b599,_0x1a45a8))[_0x9343('0x4c')](handleError(_0x27b599,null));};exports[_0x9343('0x65')]=function(_0x4e4181,_0x3b61ab,_0x326b00){var _0x363c76={'raw':!![],'where':{}};var _0x5a67d7={};var _0x1f757e={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x9343('0x5f')]({'where':{'id':_0x4e4181[_0x9343('0x4e')]['id']}})['then'](handleEntityNotFound(_0x3b61ab,null))[_0x9343('0x26')](function(_0x674420){if(_0x674420){_0x5a67d7[_0x9343('0x39')]=_['keys'](db['CmHopperFinal'][_0x9343('0x4f')]);_0x5a67d7[_0x9343('0x3a')]=_[_0x9343('0x3b')](_0x4e4181[_0x9343('0x3a')]);_0x5a67d7[_0x9343('0x3c')]=_[_0x9343('0x3e')](_0x5a67d7[_0x9343('0x39')],_0x5a67d7[_0x9343('0x3a')]);_0x363c76['attributes']=_['intersection'](_0x5a67d7['model'],qs[_0x9343('0x3f')](_0x4e4181[_0x9343('0x3a')][_0x9343('0x3f')]));_0x363c76['attributes']=_0x363c76[_0x9343('0x3d')][_0x9343('0x40')]?_0x363c76['attributes']:_0x5a67d7[_0x9343('0x39')];if(!_0x4e4181['query']['hasOwnProperty'](_0x9343('0x63'))){_0x363c76['limit']=qs[_0x9343('0x1f')](_0x4e4181['query'][_0x9343('0x1f')]);_0x363c76['offset']=qs['offset'](_0x4e4181['query'][_0x9343('0x1e')]);}_0x363c76[_0x9343('0x42')]=qs[_0x9343('0x43')](_0x4e4181['query'][_0x9343('0x43')]);_0x363c76[_0x9343('0x44')]=qs[_0x9343('0x3c')](_[_0x9343('0x45')](_0x4e4181[_0x9343('0x3a')],_0x5a67d7[_0x9343('0x3c')]));_0x363c76[_0x9343('0x44')][_0x9343('0x64')]=_0x674420['id'];if(_0x4e4181['query'][_0x9343('0x2d')]){_0x363c76[_0x9343('0x44')]=_[_0x9343('0x46')](_0x363c76[_0x9343('0x44')],{'$or':_['map'](_0x363c76[_0x9343('0x3d')],function(_0x2532d1){var _0x3e80f7={};_0x3e80f7[_0x2532d1]={'$like':'%'+_0x4e4181[_0x9343('0x3a')][_0x9343('0x2d')]+'%'};return _0x3e80f7;})});}_0x363c76=_[_0x9343('0x46')]({},_0x363c76,_0x4e4181[_0x9343('0x48')]);return db[_0x9343('0x66')][_0x9343('0x49')]({'where':_0x363c76[_0x9343('0x44')]})['then'](function(_0xd7bd){_0x1f757e[_0x9343('0x49')]=_0xd7bd;if(_0x4e4181[_0x9343('0x3a')]['includeAll']){_0x363c76[_0x9343('0x4a')]=[{'all':!![]}];}return db[_0x9343('0x66')][_0x9343('0x67')](_0x363c76);})[_0x9343('0x26')](function(_0x54a605){_0x1f757e[_0x9343('0x4b')]=_0x54a605;return _0x1f757e;});}})[_0x9343('0x26')](respondWithFilteredResult(_0x3b61ab,_0x363c76))[_0x9343('0x4c')](handleError(_0x3b61ab,null));};exports[_0x9343('0x68')]=function(_0x4808ed,_0x5b80c8,_0x5f5d56){var _0x5c0698={'raw':!![],'where':{}};var _0x10b6ae={};var _0x20b79f={'count':0x0,'rows':[]};return db[_0x9343('0x37')][_0x9343('0x5f')]({'where':{'id':_0x4808ed['params']['id']}})[_0x9343('0x26')](handleEntityNotFound(_0x5b80c8,null))[_0x9343('0x26')](function(_0x257dac){if(_0x257dac){_0x10b6ae[_0x9343('0x39')]=_[_0x9343('0x3b')](db['CmHopperBlack'][_0x9343('0x4f')]);_0x10b6ae[_0x9343('0x3a')]=_['keys'](_0x4808ed['query']);_0x10b6ae[_0x9343('0x3c')]=_['intersection'](_0x10b6ae['model'],_0x10b6ae[_0x9343('0x3a')]);_0x5c0698[_0x9343('0x3d')]=_['intersection'](_0x10b6ae[_0x9343('0x39')],qs[_0x9343('0x3f')](_0x4808ed[_0x9343('0x3a')]['fields']));_0x5c0698[_0x9343('0x3d')]=_0x5c0698[_0x9343('0x3d')]['length']?_0x5c0698['attributes']:_0x10b6ae[_0x9343('0x39')];if(!_0x4808ed['query'][_0x9343('0x41')](_0x9343('0x63'))){_0x5c0698['limit']=qs[_0x9343('0x1f')](_0x4808ed['query'][_0x9343('0x1f')]);_0x5c0698[_0x9343('0x1e')]=qs[_0x9343('0x1e')](_0x4808ed[_0x9343('0x3a')]['offset']);}_0x5c0698[_0x9343('0x42')]=qs[_0x9343('0x43')](_0x4808ed['query'][_0x9343('0x43')]);_0x5c0698[_0x9343('0x44')]=qs[_0x9343('0x3c')](_[_0x9343('0x45')](_0x4808ed[_0x9343('0x3a')],_0x10b6ae[_0x9343('0x3c')]));_0x5c0698[_0x9343('0x44')]['VoiceQueueId']=_0x257dac['id'];if(_0x4808ed[_0x9343('0x3a')]['filter']){_0x5c0698[_0x9343('0x44')]=_['merge'](_0x5c0698[_0x9343('0x44')],{'$or':_[_0x9343('0x2e')](_0x5c0698[_0x9343('0x3d')],function(_0x5d47eb){var _0x444301={};_0x444301[_0x5d47eb]={'$like':'%'+_0x4808ed[_0x9343('0x3a')][_0x9343('0x2d')]+'%'};return _0x444301;})});}_0x5c0698=_[_0x9343('0x46')]({},_0x5c0698,_0x4808ed[_0x9343('0x48')]);return db['CmHopperBlack'][_0x9343('0x49')]({'where':_0x5c0698[_0x9343('0x44')]})[_0x9343('0x26')](function(_0x2a547f){_0x20b79f['count']=_0x2a547f;if(_0x4808ed[_0x9343('0x3a')][_0x9343('0x50')]){_0x5c0698[_0x9343('0x4a')]=[{'all':!![]}];}return db[_0x9343('0x69')][_0x9343('0x67')](_0x5c0698);})[_0x9343('0x26')](function(_0x156d41){_0x20b79f[_0x9343('0x4b')]=_0x156d41;return _0x20b79f;});}})[_0x9343('0x26')](respondWithFilteredResult(_0x5b80c8,_0x5c0698))[_0x9343('0x4c')](handleError(_0x5b80c8,null));};exports['getTeams']=function(_0x5eae10,_0x58472a,_0x2697b2){var _0x19e41f={};var _0x25e477={};var _0x43d3ad;var _0x5ec3df;return db[_0x9343('0x37')][_0x9343('0x5f')]({'where':{'id':_0x5eae10[_0x9343('0x4e')]['id']}})[_0x9343('0x26')](handleEntityNotFound(_0x58472a,null))[_0x9343('0x26')](function(_0x61fd7b){if(_0x61fd7b){_0x43d3ad=_0x61fd7b;_0x25e477[_0x9343('0x39')]=_[_0x9343('0x3b')](db[_0x9343('0x6a')][_0x9343('0x4f')]);_0x25e477[_0x9343('0x3a')]=_[_0x9343('0x3b')](_0x5eae10[_0x9343('0x3a')]);_0x25e477['filters']=_[_0x9343('0x3e')](_0x25e477[_0x9343('0x39')],_0x25e477[_0x9343('0x3a')]);_0x19e41f['attributes']=_['intersection'](_0x25e477[_0x9343('0x39')],qs[_0x9343('0x3f')](_0x5eae10[_0x9343('0x3a')][_0x9343('0x3f')]));_0x19e41f[_0x9343('0x3d')]=_0x19e41f[_0x9343('0x3d')][_0x9343('0x40')]?_0x19e41f[_0x9343('0x3d')]:_0x25e477[_0x9343('0x39')];_0x19e41f['order']=qs[_0x9343('0x43')](_0x5eae10[_0x9343('0x3a')][_0x9343('0x43')]);_0x19e41f['where']=qs[_0x9343('0x3c')](_[_0x9343('0x45')](_0x5eae10[_0x9343('0x3a')],_0x25e477['filters']));if(_0x5eae10[_0x9343('0x3a')]['filter']){_0x19e41f['where']=_['merge'](_0x19e41f[_0x9343('0x44')],{'$or':_[_0x9343('0x2e')](_0x19e41f[_0x9343('0x3d')],function(_0x3ce574){var _0x50cec1={};_0x50cec1[_0x3ce574]={'$like':'%'+_0x5eae10['query'][_0x9343('0x2d')]+'%'};return _0x50cec1;})});}_0x19e41f=_[_0x9343('0x46')]({},_0x19e41f,_0x5eae10[_0x9343('0x48')]);return _0x43d3ad[_0x9343('0x6b')](_0x19e41f);}})[_0x9343('0x26')](function(_0x4d30b3){if(_0x4d30b3){_0x5ec3df=_0x4d30b3[_0x9343('0x40')];if(!_0x5eae10[_0x9343('0x3a')][_0x9343('0x41')](_0x9343('0x63'))){_0x19e41f['limit']=qs[_0x9343('0x1f')](_0x5eae10['query'][_0x9343('0x1f')]);_0x19e41f[_0x9343('0x1e')]=qs[_0x9343('0x1e')](_0x5eae10[_0x9343('0x3a')][_0x9343('0x1e')]);}return _0x43d3ad['getTeams'](_0x19e41f);}})[_0x9343('0x26')](function(_0x35c2a6){if(_0x35c2a6){return _0x35c2a6?{'count':_0x5ec3df,'rows':_0x35c2a6}:null;}})[_0x9343('0x26')](respondWithResult(_0x58472a,null))[_0x9343('0x4c')](handleError(_0x58472a,null));};exports[_0x9343('0x6c')]=function(_0x1bfb46,_0x13a234,_0x3fb1f6){var _0x304e50=_0x1bfb46['body'][_0x9343('0x6d')];var _0x571ac1=_[_0x9343('0x2e')](_0x304e50,'id');return db[_0x9343('0x6a')][_0x9343('0x67')]({'where':{'id':_0x571ac1},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0x9343('0x32'),_0x9343('0x6e'),_0x9343('0x6f'),_0x9343('0x70')],'raw':!![]}]})[_0x9343('0x26')](function(_0xdc191d){if(_0xdc191d){var _0x22a8a4=_[_0x9343('0x71')](_0xdc191d,function(_0x342674){var _0x574c66=_0x342674[_0x9343('0x28')]({'plain':!![]});_0x574c66[_0x9343('0x72')][_0x9343('0x73')](function(_0x3aa379){_0x3aa379['penalty']=_[_0x9343('0x31')](_0x304e50,{'id':_0x574c66['id']})[_0x9343('0x74')];});return _0x574c66[_0x9343('0x72')];});return db['VoiceQueue'][_0x9343('0x31')]({'where':{'id':_0x1bfb46[_0x9343('0x4e')]['id']}})['then'](function(_0x4da653){return db[_0x9343('0x75')][_0x9343('0x76')](function(_0x60a48c){return _0x4da653[_0x9343('0x6c')](_0x571ac1,{'transaction':_0x60a48c})['then'](function(){return BPromise[_0x9343('0x77')](_0x304e50,function(_0x333544){return db[_0x9343('0x78')][_0x9343('0x79')]({'TeamId':_0x333544['id'],'VoiceQueueId':_0x1bfb46['params']['id'],'penalty':_0x333544[_0x9343('0x74')]},{'transaction':_0x60a48c});});})['then'](function(){return BPromise[_0x9343('0x77')](_0x22a8a4,function(_0x5d60fe){return db[_0x9343('0x7a')][_0x9343('0x7b')]({'where':{'UserId':_0x5d60fe['id'],'VoiceQueueId':_0x1bfb46[_0x9343('0x4e')]['id']},'defaults':{'penalty':_0x5d60fe[_0x9343('0x74')]},'transaction':_0x60a48c});});})[_0x9343('0x26')](function(){return BPromise[_0x9343('0x77')](_['filter'](_0x22a8a4,{'online':!![]}),function(_0x3c5819){return db[_0x9343('0x7c')][_0x9343('0x79')]({'membername':_0x3c5819[_0x9343('0x32')],'UserId':_0x3c5819['id'],'queue_name':_0x4da653['name'],'VoiceQueueId':_0x4da653['id'],'interface':_[_0x9343('0x7d')](_0x3c5819[_0x9343('0x70')])?util[_0x9343('0x7e')](_0x9343('0x7f'),_0x3c5819[_0x9343('0x32')]):_0x3c5819['interface'],'paused':_0x3c5819[_0x9343('0x6f')]||![],'penalty':_0x3c5819[_0x9343('0x74')]},{'transaction':_0x60a48c});});})[_0x9343('0x26')](function(){_0x22a8a4[_0x9343('0x73')](function(_0x2da185){socket[_0x9343('0x80')](_0x9343('0x81'),{'UserId':_0x2da185['id'],'VoiceQueueId':_0x4da653['id']});});});});});}})[_0x9343('0x26')](respondWithStatusCode(_0x13a234,null))['catch'](handleError(_0x13a234,null));};exports[_0x9343('0x82')]=function(_0x52f7c1,_0x1d1836,_0x3c889c){return db[_0x9343('0x6a')][_0x9343('0x67')]({'where':{'id':_0x52f7c1[_0x9343('0x3a')][_0x9343('0x83')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x9343('0x72'),'attributes':['id'],'raw':!![]}]})[_0x9343('0x26')](handleEntityNotFound(_0x1d1836,null))[_0x9343('0x26')](function(_0x2129fc){var _0x34781b=_[_0x9343('0x2e')](_0x2129fc,'id');var _0x30c6a4=[];var _0x33dac9=[];var _0x4aeae3=squel[_0x9343('0x84')]();_0x4aeae3[_0x9343('0x85')]('tq.TeamId')[_0x9343('0x86')](_0x9343('0x87'),'tq')[_0x9343('0x88')](_0x9343('0x89'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0x9343('0x8a'),_0x52f7c1[_0x9343('0x4e')]['id']);for(var _0x3e87ad=0x0;_0x3e87ad<_0x2129fc[_0x9343('0x40')];_0x3e87ad+=0x1){let _0x3185eb=_0x2129fc[_0x3e87ad];for(var _0x3c1f91=0x0;_0x3c1f91<_0x3185eb[_0x9343('0x72')]['length'];_0x3c1f91+=0x1){let _0x13239c=_0x3185eb[_0x9343('0x72')][_0x3c1f91];var _0x404a8c=_0x4aeae3['clone']();_0x404a8c[_0x9343('0x44')](_0x9343('0x8b'),_0x13239c['id']);_0x33dac9['push'](db[_0x9343('0x75')]['query'](_0x404a8c[_0x9343('0x8c')](),{'type':db[_0x9343('0x75')][_0x9343('0x8d')][_0x9343('0x8e')]})[_0x9343('0x26')](function(_0x17d750){if(_0x17d750[_0x9343('0x40')]===0x1){return _0x13239c['id'];}else{var _0x46e72c=_[_0x9343('0x8f')](_[_0x9343('0x2e')](_0x17d750,_0x9343('0x90')),function(_0x248724){return _[_0x9343('0x91')](_0x34781b,_0x248724);});if(_0x46e72c){return _0x13239c['id'];}}}));}}return BPromise['all'](_0x33dac9)[_0x9343('0x26')](function(_0xc43b63){_0x30c6a4=_(_0x30c6a4)['union'](_0xc43b63)['compact']()[_0x9343('0x2f')]();return db[_0x9343('0x37')][_0x9343('0x31')]({'where':{'id':_0x52f7c1['params']['id']}})['then'](function(_0x48effb){return db[_0x9343('0x75')]['transaction'](function(_0x4bd418){return _0x48effb[_0x9343('0x82')](_0x52f7c1['query']['ids'],{'transaction':_0x4bd418})[_0x9343('0x26')](function(){if(!_[_0x9343('0x92')](_0x30c6a4)){return _0x48effb[_0x9343('0x93')](_0x30c6a4,{'transaction':_0x4bd418})[_0x9343('0x26')](function(){return db['UserVoiceQueueRt'][_0x9343('0x27')]({'where':{'VoiceQueueId':_0x52f7c1['params']['id'],'UserId':_0x30c6a4},'transaction':_0x4bd418});});}})[_0x9343('0x26')](function(){_0x30c6a4[_0x9343('0x73')](function(_0x36c184){socket[_0x9343('0x80')](_0x9343('0x94'),{'UserId':_0x36c184,'VoiceQueueId':_0x48effb['id']});});});});});});})[_0x9343('0x26')](respondWithStatusCode(_0x1d1836,null))[_0x9343('0x4c')](handleError(_0x1d1836,null));};exports[_0x9343('0x95')]=function(_0x2e3249,_0x598d26,_0x963072){var _0x2483b9,_0x11a4ea;return db[_0x9343('0x37')][_0x9343('0x31')]({'where':{'id':_0x2e3249['params']['id']}})[_0x9343('0x26')](handleEntityNotFound(_0x598d26,null))[_0x9343('0x26')](function(_0x31b30f){if(_0x31b30f){_0x11a4ea=_0x31b30f;return _0x31b30f[_0x9343('0x95')](_0x2e3249['body'][_0x9343('0x83')],_[_0x9343('0x5a')](_0x2e3249[_0x9343('0x52')],[_0x9343('0x83'),'id'])||{})[_0x9343('0x96')](function(_0x56df95){for(var _0x5d1155=0x0;_0x5d1155<_0x2e3249[_0x9343('0x52')]['ids']['length'];_0x5d1155+=0x1){socket['emit'](_0x9343('0x81'),{'UserId':_0x2e3249['body']['ids'][_0x5d1155],'VoiceQueueId':_0x2e3249[_0x9343('0x4e')]['id']});}return _0x56df95;});}})['then'](function(_0x423a40){_0x2483b9=_0x423a40||[];if(_0x11a4ea){return db[_0x9343('0x97')]['findAll']({'where':{'id':_0x2e3249[_0x9343('0x52')][_0x9343('0x83')]},'attributes':['id',_0x9343('0x32'),_0x9343('0x6e'),_0x9343('0x6f'),_0x9343('0x70')],'raw':!![]});}})[_0x9343('0x26')](function(_0x47b8d3){if(!_['isEmpty'](_0x47b8d3)){var _0x1f7de2=[];for(var _0x4cdfbc=0x0;_0x4cdfbc<_0x47b8d3[_0x9343('0x40')];_0x4cdfbc++){if(_0x47b8d3[_0x4cdfbc]['online']){_0x1f7de2[_0x9343('0x98')](db[_0x9343('0x7c')][_0x9343('0x79')]({'membername':_0x47b8d3[_0x4cdfbc][_0x9343('0x32')],'UserId':_0x47b8d3[_0x4cdfbc]['id'],'queue_name':_0x11a4ea[_0x9343('0x32')],'VoiceQueueId':_0x11a4ea['id'],'interface':_[_0x9343('0x7d')](_0x47b8d3[_0x4cdfbc][_0x9343('0x70')])?util[_0x9343('0x7e')]('SIP/%s',_0x47b8d3[_0x4cdfbc]['name']):_0x47b8d3[_0x4cdfbc][_0x9343('0x70')],'paused':_0x47b8d3[_0x4cdfbc][_0x9343('0x6f')]||![],'penalty':_0x2e3249['body']['penalty']||0x0}));}}return BPromise[_0x9343('0x99')](_0x1f7de2);}})['then'](function(){return _0x2483b9;})['then'](respondWithResult(_0x598d26,null))[_0x9343('0x4c')](handleError(_0x598d26,null));};exports[_0x9343('0x93')]=function(_0x24d48a,_0x2d0945,_0x5dbf9a){return db[_0x9343('0x37')]['find']({'where':{'id':_0x24d48a[_0x9343('0x4e')]['id']}})[_0x9343('0x26')](handleEntityNotFound(_0x2d0945,null))['then'](function(_0x47918b){if(_0x47918b){return _0x47918b[_0x9343('0x93')](_0x24d48a[_0x9343('0x3a')][_0x9343('0x83')])[_0x9343('0x26')](function(){if(_[_0x9343('0x9a')](_0x24d48a['query']['ids'])){for(var _0x331049=0x0;_0x331049<_0x24d48a['query'][_0x9343('0x83')][_0x9343('0x40')];_0x331049+=0x1){socket['emit']('userVoiceQueue:remove',{'UserId':Number(_0x24d48a[_0x9343('0x3a')][_0x9343('0x83')][_0x331049]),'VoiceQueueId':Number(_0x24d48a[_0x9343('0x4e')]['id'])});}}else{socket[_0x9343('0x80')](_0x9343('0x94'),{'UserId':Number(_0x24d48a[_0x9343('0x3a')][_0x9343('0x83')]),'VoiceQueueId':Number(_0x24d48a[_0x9343('0x4e')]['id'])});}});}})[_0x9343('0x26')](function(_0x382c0e){return db[_0x9343('0x7c')]['destroy']({'where':{'VoiceQueueId':_0x24d48a[_0x9343('0x4e')]['id'],'UserId':_0x24d48a[_0x9343('0x3a')][_0x9343('0x83')]}})[_0x9343('0x26')](function(){return _0x382c0e;});})['then'](respondWithStatusCode(_0x2d0945,null))[_0x9343('0x4c')](handleError(_0x2d0945,null));};exports[_0x9343('0x9b')]=function(_0x52f237,_0x1f8d9b,_0x5c655c){var _0x7f9c61={};var _0x335a6c={};var _0x53a8bd;var _0x2ed1e9;return db['VoiceQueue'][_0x9343('0x5f')]({'where':{'id':_0x52f237[_0x9343('0x4e')]['id']}})[_0x9343('0x26')](handleEntityNotFound(_0x1f8d9b,null))[_0x9343('0x26')](function(_0x36b5d3){if(_0x36b5d3){_0x53a8bd=_0x36b5d3;_0x335a6c[_0x9343('0x39')]=_['keys'](db[_0x9343('0x97')][_0x9343('0x4f')]);_0x335a6c[_0x9343('0x3a')]=_[_0x9343('0x3b')](_0x52f237['query']);_0x335a6c[_0x9343('0x3c')]=_['intersection'](_0x335a6c['model'],_0x335a6c[_0x9343('0x3a')]);_0x7f9c61[_0x9343('0x3d')]=_[_0x9343('0x3e')](_0x335a6c[_0x9343('0x39')],qs[_0x9343('0x3f')](_0x52f237[_0x9343('0x3a')][_0x9343('0x3f')]));_0x7f9c61[_0x9343('0x3d')]=_0x7f9c61['attributes'][_0x9343('0x40')]?_0x7f9c61[_0x9343('0x3d')]:_0x335a6c['model'];_0x7f9c61[_0x9343('0x42')]=qs['sort'](_0x52f237['query']['sort']);_0x7f9c61[_0x9343('0x44')]=qs[_0x9343('0x3c')](_[_0x9343('0x45')](_0x52f237[_0x9343('0x3a')],_0x335a6c[_0x9343('0x3c')]));if(_0x52f237[_0x9343('0x3a')][_0x9343('0x2d')]){_0x7f9c61[_0x9343('0x44')]=_[_0x9343('0x46')](_0x7f9c61[_0x9343('0x44')],{'$or':_['map'](_0x7f9c61[_0x9343('0x3d')],function(_0x4f9182){var _0x2ce735={};_0x2ce735[_0x4f9182]={'$like':'%'+_0x52f237[_0x9343('0x3a')][_0x9343('0x2d')]+'%'};return _0x2ce735;})});}_0x7f9c61=_[_0x9343('0x46')]({},_0x7f9c61,_0x52f237[_0x9343('0x48')]);return _0x53a8bd[_0x9343('0x9b')](_0x7f9c61);}})['then'](function(_0xf9c0cb){if(_0xf9c0cb){_0x2ed1e9=_0xf9c0cb[_0x9343('0x40')];if(!_0x52f237[_0x9343('0x3a')]['hasOwnProperty'](_0x9343('0x63'))){_0x7f9c61[_0x9343('0x1f')]=qs[_0x9343('0x1f')](_0x52f237[_0x9343('0x3a')][_0x9343('0x1f')]);_0x7f9c61[_0x9343('0x1e')]=qs[_0x9343('0x1e')](_0x52f237['query'][_0x9343('0x1e')]);}return _0x53a8bd['getAgents'](_0x7f9c61);}})[_0x9343('0x26')](function(_0x5b3f7d){if(_0x5b3f7d){return _0x5b3f7d?{'count':_0x2ed1e9,'rows':_0x5b3f7d}:null;}})[_0x9343('0x26')](respondWithResult(_0x1f8d9b,null))[_0x9343('0x4c')](handleError(_0x1f8d9b,null));};exports['getMembers']=function(_0x500004,_0x1ddb20,_0x230598){var _0x46d331={};var _0x5aae8={};var _0x50ef11;var _0x525515;return db[_0x9343('0x37')]['findOne']({'where':{'id':_0x500004[_0x9343('0x4e')]['id']}})[_0x9343('0x26')](handleEntityNotFound(_0x1ddb20,null))[_0x9343('0x26')](function(_0x70d11e){if(_0x70d11e){_0x50ef11=_0x70d11e;_0x5aae8[_0x9343('0x39')]=_[_0x9343('0x3b')](db['UserVoiceQueueRt'][_0x9343('0x4f')]);_0x5aae8[_0x9343('0x3a')]=_['keys'](_0x500004[_0x9343('0x3a')]);_0x5aae8['filters']=_[_0x9343('0x3e')](_0x5aae8[_0x9343('0x39')],_0x5aae8[_0x9343('0x3a')]);_0x46d331[_0x9343('0x3d')]=_[_0x9343('0x3e')](_0x5aae8[_0x9343('0x39')],qs[_0x9343('0x3f')](_0x500004[_0x9343('0x3a')][_0x9343('0x3f')]));_0x46d331[_0x9343('0x3d')]=_0x46d331[_0x9343('0x3d')]['length']?_0x46d331['attributes']:_0x5aae8[_0x9343('0x39')];_0x46d331[_0x9343('0x42')]=qs[_0x9343('0x43')](_0x500004[_0x9343('0x3a')]['sort']);_0x46d331[_0x9343('0x44')]=qs[_0x9343('0x3c')](_[_0x9343('0x45')](_0x500004[_0x9343('0x3a')],_0x5aae8[_0x9343('0x3c')]));if(_0x500004[_0x9343('0x3a')]['filter']){_0x46d331[_0x9343('0x44')]=_['merge'](_0x46d331['where'],{'$or':_[_0x9343('0x2e')](_0x46d331['attributes'],function(_0x4b1d83){var _0x4bea36={};_0x4bea36[_0x4b1d83]={'$like':'%'+_0x500004[_0x9343('0x3a')][_0x9343('0x2d')]+'%'};return _0x4bea36;})});}_0x46d331=_[_0x9343('0x46')]({},_0x46d331,_0x500004[_0x9343('0x48')]);return _0x50ef11['getMembers'](_0x46d331);}})[_0x9343('0x26')](function(_0x110a2b){if(_0x110a2b){_0x525515=_0x110a2b['length'];if(!_0x500004[_0x9343('0x3a')][_0x9343('0x41')](_0x9343('0x63'))){_0x46d331[_0x9343('0x1f')]=qs[_0x9343('0x1f')](_0x500004[_0x9343('0x3a')][_0x9343('0x1f')]);_0x46d331['offset']=qs['offset'](_0x500004[_0x9343('0x3a')]['offset']);}return _0x50ef11[_0x9343('0x9c')](_0x46d331);}})[_0x9343('0x26')](function(_0x54dcd5){return _0x54dcd5?{'count':_0x525515,'rows':_0x54dcd5}:null;})[_0x9343('0x26')](respondWithResult(_0x1ddb20,null))[_0x9343('0x4c')](handleError(_0x1ddb20,null));};exports[_0x9343('0x9d')]=function(_0x4bf2a8,_0x1866f9,_0x151a3d){var _0x2b3814={};var _0x53109e={};var _0x1e3a09;var _0x49c428;return db[_0x9343('0x37')][_0x9343('0x5f')]({'where':{'id':_0x4bf2a8['params']['id']}})[_0x9343('0x26')](handleEntityNotFound(_0x1866f9,null))[_0x9343('0x26')](function(_0x7acf01){if(_0x7acf01){_0x1e3a09=_0x7acf01;_0x53109e[_0x9343('0x39')]=_[_0x9343('0x3b')](db[_0x9343('0x9e')]['rawAttributes']);_0x53109e['query']=_[_0x9343('0x3b')](_0x4bf2a8[_0x9343('0x3a')]);_0x53109e['filters']=_[_0x9343('0x3e')](_0x53109e[_0x9343('0x39')],_0x53109e[_0x9343('0x3a')]);_0x2b3814[_0x9343('0x3d')]=_[_0x9343('0x3e')](_0x53109e[_0x9343('0x39')],qs[_0x9343('0x3f')](_0x4bf2a8[_0x9343('0x3a')][_0x9343('0x3f')]));_0x2b3814[_0x9343('0x3d')]=_0x2b3814[_0x9343('0x3d')][_0x9343('0x40')]?_0x2b3814[_0x9343('0x3d')]:_0x53109e['model'];_0x2b3814[_0x9343('0x42')]=qs[_0x9343('0x43')](_0x4bf2a8['query'][_0x9343('0x43')]);_0x2b3814[_0x9343('0x44')]=qs[_0x9343('0x3c')](_['pick'](_0x4bf2a8[_0x9343('0x3a')],_0x53109e['filters']));if(_0x4bf2a8[_0x9343('0x3a')][_0x9343('0x2d')]){_0x2b3814[_0x9343('0x44')]=_[_0x9343('0x46')](_0x2b3814['where'],{'$or':_[_0x9343('0x2e')](_0x2b3814[_0x9343('0x3d')],function(_0x34143f){var _0x1d8766={};_0x1d8766[_0x34143f]={'$like':'%'+_0x4bf2a8[_0x9343('0x3a')][_0x9343('0x2d')]+'%'};return _0x1d8766;})});}_0x2b3814=_[_0x9343('0x46')]({},_0x2b3814,_0x4bf2a8[_0x9343('0x48')]);return _0x1e3a09['getLists'](_0x2b3814);}})['then'](function(_0x4c5982){if(_0x4c5982){_0x49c428=_0x4c5982[_0x9343('0x40')];if(!_0x4bf2a8['query'][_0x9343('0x41')](_0x9343('0x63'))){_0x2b3814['limit']=qs[_0x9343('0x1f')](_0x4bf2a8[_0x9343('0x3a')][_0x9343('0x1f')]);_0x2b3814[_0x9343('0x1e')]=qs[_0x9343('0x1e')](_0x4bf2a8[_0x9343('0x3a')]['offset']);}return _0x1e3a09[_0x9343('0x9d')](_0x2b3814);}})[_0x9343('0x26')](function(_0x4a5cec){if(_0x4a5cec){return _0x4a5cec?{'count':_0x49c428,'rows':_0x4a5cec}:null;}})[_0x9343('0x26')](respondWithResult(_0x1866f9,null))[_0x9343('0x4c')](handleError(_0x1866f9,null));};exports[_0x9343('0x9f')]=function(_0x38e74e,_0x322d40,_0x1aa5b1){var _0x22acba,_0x3a470b;return db['VoiceQueue'][_0x9343('0x31')]({'where':{'id':_0x38e74e[_0x9343('0x4e')]['id']}})['then'](handleEntityNotFound(_0x322d40,null))[_0x9343('0x26')](function(_0xc2f97d){if(_0xc2f97d){_0x3a470b=_0xc2f97d;return _0xc2f97d[_0x9343('0x9f')](_0x38e74e[_0x9343('0x52')][_0x9343('0x83')],_[_0x9343('0x5a')](_0x38e74e[_0x9343('0x52')],[_0x9343('0x83'),'id'])||{});}return null;})[_0x9343('0x96')](function(_0x4a1a47){var _0x4f59db;_0x22acba=_0x4a1a47||[];var _0x188a95=[];if(_0x4a1a47){for(var _0x54e7de=0x0;_0x54e7de<_0x4a1a47[_0x9343('0x40')];_0x54e7de+=0x1){var _0x1ad773=_0x4a1a47[_0x54e7de][_0x9343('0x28')]({'plain':!![]});_0x3a470b[_0x9343('0xa0')]=_0x38e74e[_0x9343('0x52')][_0x9343('0xa0')]?_0x38e74e[_0x9343('0x52')][_0x9343('0xa0')]:_0x3a470b[_0x9343('0xa0')];switch(_0x3a470b[_0x9343('0xa0')]){case _0x9343('0xa1'):_0x4f59db=squel[_0x9343('0xa2')]()[_0x9343('0xa3')](_0x9343('0xa4'))[_0x9343('0xa5')]([_0x9343('0xa6'),_0x9343('0xa7'),'ContactId',_0x9343('0xa8'),_0x9343('0x64'),_0x9343('0xa9'),_0x9343('0x5b')],squel[_0x9343('0x84')]()['field'](_0x9343('0xa6'),'phone')['field'](_0x9343('0xaa'),'scheduledAt')[_0x9343('0x85')]('id',_0x9343('0xab'))[_0x9343('0x85')](_0x1ad773['CmListId'][_0x9343('0x8c')](),_0x9343('0xa8'))[_0x9343('0x85')](_0x38e74e[_0x9343('0x4e')]['id'][_0x9343('0x8c')](),'VoiceQueueId')[_0x9343('0x85')](_0x9343('0xaa'),_0x9343('0xa9'))[_0x9343('0x85')](_0x9343('0xaa'),_0x9343('0x5b'))[_0x9343('0x86')](_0x9343('0xac'))['where'](_0x9343('0xad'))['where'](_0x9343('0xae'),_0x1ad773['CmListId'][_0x9343('0x8c')]())[_0x9343('0x44')](_0x9343('0xaf'))[_0x9343('0x44')](_0x9343('0xb0'),squel['select']()[_0x9343('0x85')](_0x9343('0xb1'))[_0x9343('0x86')](_0x9343('0xb2'))[_0x9343('0x44')](_0x9343('0x8a'),_0x38e74e[_0x9343('0x4e')]['id'][_0x9343('0x8c')]()))[_0x9343('0x44')](_0x9343('0xb0'),squel[_0x9343('0x84')]()[_0x9343('0x85')](_0x9343('0xb3'))[_0x9343('0x86')]('cm_hopper')['where']('VoiceQueueId\x20=\x20?',_0x38e74e[_0x9343('0x4e')]['id'][_0x9343('0x8c')]())))[_0x9343('0x8c')]();break;case'onlyIfOpen':_0x4f59db=squel[_0x9343('0xa2')]()[_0x9343('0xa3')]('cm_hopper')['fromQuery']([_0x9343('0xa6'),_0x9343('0xa7'),'ContactId',_0x9343('0xa8'),'VoiceQueueId',_0x9343('0xa9'),_0x9343('0x5b')],squel[_0x9343('0x84')]()[_0x9343('0x85')](_0x9343('0xa6'),_0x9343('0xa6'))[_0x9343('0x85')](_0x9343('0xaa'),'scheduledAt')[_0x9343('0x85')]('id','ContactId')[_0x9343('0x85')](_0x1ad773[_0x9343('0xb4')]['toString'](),_0x9343('0xa8'))[_0x9343('0x85')](_0x38e74e[_0x9343('0x4e')]['id'][_0x9343('0x8c')](),_0x9343('0x64'))[_0x9343('0x85')](_0x9343('0xaa'),_0x9343('0xa9'))[_0x9343('0x85')](_0x9343('0xaa'),_0x9343('0x5b'))[_0x9343('0x86')](_0x9343('0xac'))['where'](_0x9343('0xad'))[_0x9343('0x44')]('ListId\x20=\x20?',_0x1ad773[_0x9343('0xb4')]['toString']())[_0x9343('0x44')](_0x9343('0xaf'))[_0x9343('0x44')](_0x9343('0xb0'),squel[_0x9343('0x84')]()[_0x9343('0x85')]('COALESCE(phone,\x27\x27)')['from'](_0x9343('0xa4'))[_0x9343('0x44')](_0x9343('0x8a'),_0x38e74e[_0x9343('0x4e')]['id'][_0x9343('0x8c')]())))[_0x9343('0x8c')]();break;default:_0x4f59db=squel[_0x9343('0xa2')]()[_0x9343('0xa3')](_0x9343('0xa4'))[_0x9343('0xa5')]([_0x9343('0xa6'),_0x9343('0xa7'),'ContactId','ListId',_0x9343('0x64'),_0x9343('0xa9'),_0x9343('0x5b')],squel['select']()['field'](_0x9343('0xa6'),'phone')['field'](_0x9343('0xaa'),'scheduledAt')[_0x9343('0x85')]('id',_0x9343('0xab'))[_0x9343('0x85')](_0x1ad773['CmListId'][_0x9343('0x8c')](),'ListId')[_0x9343('0x85')](_0x38e74e[_0x9343('0x4e')]['id']['toString'](),'VoiceQueueId')[_0x9343('0x85')](_0x9343('0xaa'),_0x9343('0xa9'))[_0x9343('0x85')]('NOW()',_0x9343('0x5b'))['from'](_0x9343('0xac'))[_0x9343('0x44')](_0x9343('0xad'))['where'](_0x9343('0xae'),_0x1ad773[_0x9343('0xb4')]['toString']())[_0x9343('0x44')]('phone\x20IS\x20NOT\x20NULL'))['toString']();}_0x188a95[_0x9343('0x98')](db[_0x9343('0x75')][_0x9343('0x3a')](_0x4f59db));}return BPromise[_0x9343('0x99')](_0x188a95);}})[_0x9343('0x26')](function(){return _0x22acba;})[_0x9343('0x26')](respondWithResult(_0x322d40,null))['catch'](handleError(_0x322d40,null));};exports[_0x9343('0xb5')]=function(_0x454986,_0xf52704,_0x1dfc79){return db['VoiceQueue'][_0x9343('0x31')]({'where':{'id':_0x454986[_0x9343('0x4e')]['id']}})[_0x9343('0x26')](handleEntityNotFound(_0xf52704,null))[_0x9343('0x26')](function(_0x267214){if(_0x267214){return _0x267214[_0x9343('0xb5')](_0x454986[_0x9343('0x3a')][_0x9343('0x83')]);}})[_0x9343('0x26')](function(_0x47ea67){if(_0x47ea67){return db['CmHopper'][_0x9343('0x27')]({'where':{'ListId':_0x454986[_0x9343('0x3a')][_0x9343('0x83')],'VoiceQueueId':_0x454986['params']['id']}})[_0x9343('0x26')](function(){return _0x47ea67;});}})['then'](respondWithStatusCode(_0xf52704,null))[_0x9343('0x4c')](handleError(_0xf52704,null));};exports[_0x9343('0xb6')]=function(_0x347a53,_0x9fee21,_0x3fabc8){var _0x49559a={};var _0x2939a3={};var _0x43fb75;var _0x3c1cb1;return db[_0x9343('0x37')][_0x9343('0x5f')]({'where':{'id':_0x347a53[_0x9343('0x4e')]['id']}})[_0x9343('0x26')](handleEntityNotFound(_0x9fee21,null))[_0x9343('0x26')](function(_0x4f4889){if(_0x4f4889){_0x43fb75=_0x4f4889;_0x2939a3['model']=_[_0x9343('0x3b')](db['CmList']['rawAttributes']);_0x2939a3[_0x9343('0x3a')]=_[_0x9343('0x3b')](_0x347a53[_0x9343('0x3a')]);_0x2939a3[_0x9343('0x3c')]=_[_0x9343('0x3e')](_0x2939a3[_0x9343('0x39')],_0x2939a3[_0x9343('0x3a')]);_0x49559a[_0x9343('0x3d')]=_[_0x9343('0x3e')](_0x2939a3[_0x9343('0x39')],qs[_0x9343('0x3f')](_0x347a53[_0x9343('0x3a')][_0x9343('0x3f')]));_0x49559a[_0x9343('0x3d')]=_0x49559a[_0x9343('0x3d')][_0x9343('0x40')]?_0x49559a[_0x9343('0x3d')]:_0x2939a3[_0x9343('0x39')];_0x49559a['order']=qs[_0x9343('0x43')](_0x347a53[_0x9343('0x3a')]['sort']);_0x49559a['where']=qs['filters'](_[_0x9343('0x45')](_0x347a53['query'],_0x2939a3[_0x9343('0x3c')]));if(_0x347a53[_0x9343('0x3a')][_0x9343('0x2d')]){_0x49559a[_0x9343('0x44')]=_[_0x9343('0x46')](_0x49559a[_0x9343('0x44')],{'$or':_[_0x9343('0x2e')](_0x49559a[_0x9343('0x3d')],function(_0x3a22e3){var _0x5640f8={};_0x5640f8[_0x3a22e3]={'$like':'%'+_0x347a53[_0x9343('0x3a')][_0x9343('0x2d')]+'%'};return _0x5640f8;})});}_0x49559a=_['merge']({},_0x49559a,_0x347a53['options']);return _0x43fb75[_0x9343('0xb6')](_0x49559a);}})[_0x9343('0x26')](function(_0x5e2f10){if(_0x5e2f10){_0x3c1cb1=_0x5e2f10['length'];if(!_0x347a53[_0x9343('0x3a')][_0x9343('0x41')](_0x9343('0x63'))){_0x49559a[_0x9343('0x1f')]=qs[_0x9343('0x1f')](_0x347a53['query']['limit']);_0x49559a['offset']=qs[_0x9343('0x1e')](_0x347a53[_0x9343('0x3a')][_0x9343('0x1e')]);}return _0x43fb75['getBlackLists'](_0x49559a);}})[_0x9343('0x26')](function(_0x18d795){if(_0x18d795){return _0x18d795?{'count':_0x3c1cb1,'rows':_0x18d795}:null;}})[_0x9343('0x26')](respondWithResult(_0x9fee21,null))[_0x9343('0x4c')](handleError(_0x9fee21,null));};exports['addBlackLists']=function(_0x4dd1e3,_0x4cc579,_0x445940){var _0x5a575a,_0x125572;return db[_0x9343('0x37')][_0x9343('0x31')]({'where':{'id':_0x4dd1e3[_0x9343('0x4e')]['id']}})['then'](handleEntityNotFound(_0x4cc579,null))[_0x9343('0x26')](function(_0x28d67f){if(_0x28d67f){_0x125572=_0x28d67f;return _0x28d67f[_0x9343('0xb7')](_0x4dd1e3['body']['ids'],_[_0x9343('0x5a')](_0x4dd1e3['body'],[_0x9343('0x83'),'id'])||{});}return null;})[_0x9343('0x96')](function(_0xbc09b2){var _0x4c2553;_0x5a575a=_0xbc09b2||[];var _0x450646=[];if(_0xbc09b2){for(var _0x237919=0x0;_0x237919<_0xbc09b2['length'];_0x237919+=0x1){var _0x5f556e=_0xbc09b2[_0x237919][_0x9343('0x28')]({'plain':!![]});_0x4c2553=squel['insert']()[_0x9343('0xa3')](_0x9343('0xb8'))[_0x9343('0xa5')]([_0x9343('0xa6'),_0x9343('0xab'),'ListId','VoiceQueueId','createdAt',_0x9343('0x5b')],squel[_0x9343('0x84')]()['field'](_0x9343('0xa6'),_0x9343('0xa6'))[_0x9343('0x85')]('id',_0x9343('0xab'))[_0x9343('0x85')](_0x5f556e['CmListId'][_0x9343('0x8c')](),_0x9343('0xa8'))[_0x9343('0x85')](_0x4dd1e3['params']['id']['toString'](),_0x9343('0x64'))[_0x9343('0x85')](_0x9343('0xaa'),'createdAt')[_0x9343('0x85')](_0x9343('0xaa'),_0x9343('0x5b'))[_0x9343('0x86')](_0x9343('0xac'))[_0x9343('0x44')]('deletedAt\x20IS\x20NULL')[_0x9343('0x44')]('ListId\x20=\x20?',_0x5f556e[_0x9343('0xb4')][_0x9343('0x8c')]())[_0x9343('0x44')]('phone\x20IS\x20NOT\x20NULL'))[_0x9343('0x8c')]();_0x450646[_0x9343('0x98')](db[_0x9343('0x75')][_0x9343('0x3a')](_0x4c2553));}return BPromise[_0x9343('0x99')](_0x450646);}})[_0x9343('0x26')](function(){return _0x5a575a;})['then'](respondWithResult(_0x4cc579,null))['catch'](handleError(_0x4cc579,null));};exports[_0x9343('0xb9')]=function(_0x18edde,_0xf78c2e,_0x38737b){return db[_0x9343('0x37')][_0x9343('0x31')]({'where':{'id':_0x18edde[_0x9343('0x4e')]['id']}})['then'](handleEntityNotFound(_0xf78c2e,null))[_0x9343('0x26')](function(_0x1b321b){if(_0x1b321b){return _0x1b321b[_0x9343('0xb9')](_0x18edde[_0x9343('0x3a')][_0x9343('0x83')]);}})[_0x9343('0x26')](function(_0x498130){if(_0x498130){return db[_0x9343('0x69')][_0x9343('0x27')]({'where':{'ListId':_0x18edde[_0x9343('0x3a')][_0x9343('0x83')],'VoiceQueueId':_0x18edde[_0x9343('0x4e')]['id']}})[_0x9343('0x26')](function(){return _0x498130;});}})[_0x9343('0x26')](respondWithStatusCode(_0xf78c2e,null))['catch'](handleError(_0xf78c2e,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index fb1de38..a119692 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 _0x1f58=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','VoiceQueue','setMaxListeners','save'];(function(_0x9df060,_0x253d33){var _0x338dfe=function(_0x17d9a5){while(--_0x17d9a5){_0x9df060['push'](_0x9df060['shift']());}};_0x338dfe(++_0x253d33);}(_0x1f58,0x1a9));var _0x81f5=function(_0x583e88,_0x1268e7){_0x583e88=_0x583e88-0x0;var _0x5639d5=_0x1f58[_0x583e88];return _0x5639d5;};'use strict';var EventEmitter=require(_0x81f5('0x0'));var VoiceQueue=require(_0x81f5('0x1'))['db'][_0x81f5('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x81f5('0x3')](0x0);var events={'afterCreate':_0x81f5('0x4'),'afterUpdate':'update','afterDestroy':_0x81f5('0x5')};function emitEvent(_0xbfcdca){return function(_0x17c36e,_0x16bf4b,_0x13288a){VoiceQueueEvents[_0x81f5('0x6')](_0xbfcdca+':'+_0x17c36e['id'],_0x17c36e);VoiceQueueEvents[_0x81f5('0x6')](_0xbfcdca,_0x17c36e);_0x13288a(null);};}for(var e in events){if(events[_0x81f5('0x7')](e)){var event=events[e];VoiceQueue[_0x81f5('0x8')](e,emitEvent(event));}}module[_0x81f5('0x9')]=VoiceQueueEvents; \ No newline at end of file +var _0x4d63=['events','VoiceQueue','setMaxListeners','remove','emit','hook','exports'];(function(_0x590851,_0x496bee){var _0x3b0115=function(_0x5140cc){while(--_0x5140cc){_0x590851['push'](_0x590851['shift']());}};_0x3b0115(++_0x496bee);}(_0x4d63,0x12d));var _0x34d6=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x4d63[_0x321bb2];return _0x9c12ed;};'use strict';var EventEmitter=require(_0x34d6('0x0'));var VoiceQueue=require('../../mysqldb')['db'][_0x34d6('0x1')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x34d6('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x34d6('0x3')};function emitEvent(_0x4ed23e){return function(_0x3ca57d,_0x83e58d,_0x5ca422){VoiceQueueEvents[_0x34d6('0x4')](_0x4ed23e+':'+_0x3ca57d['id'],_0x3ca57d);VoiceQueueEvents[_0x34d6('0x4')](_0x4ed23e,_0x3ca57d);_0x5ca422(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueue[_0x34d6('0x5')](e,emitEvent(event));}}module[_0x34d6('0x6')]=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index ba5ed88..c277c26 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 _0x3e74=['exports','VoiceQueue','voice_queues','lodash','../../config/logger','api','moment','path','../../config/environment','./voiceQueue.attributes'];(function(_0x55bf96,_0x7267a7){var _0x5092ef=function(_0x3ed3f1){while(--_0x3ed3f1){_0x55bf96['push'](_0x55bf96['shift']());}};_0x5092ef(++_0x7267a7);}(_0x3e74,0x175));var _0x43e7=function(_0x41c2b2,_0xdb7f25){_0x41c2b2=_0x41c2b2-0x0;var _0x93cd88=_0x3e74[_0x41c2b2];return _0x93cd88;};'use strict';var _=require(_0x43e7('0x0'));var util=require('util');var logger=require(_0x43e7('0x1'))(_0x43e7('0x2'));var moment=require(_0x43e7('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x43e7('0x4'));var rimraf=require('rimraf');var config=require(_0x43e7('0x5'));var attributes=require(_0x43e7('0x6'));module[_0x43e7('0x7')]=function(_0x1c503b,_0xc98b9c){return _0x1c503b['define'](_0x43e7('0x8'),attributes,{'tableName':_0x43e7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xedd9=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./voiceQueue.attributes','exports','VoiceQueue','util'];(function(_0x341631,_0x5d8daa){var _0x2ccc46=function(_0x59c561){while(--_0x59c561){_0x341631['push'](_0x341631['shift']());}};_0x2ccc46(++_0x5d8daa);}(_0xedd9,0xfc));var _0x9edd=function(_0x771f44,_0x33419f){_0x771f44=_0x771f44-0x0;var _0x6aa112=_0xedd9[_0x771f44];return _0x6aa112;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var logger=require(_0x9edd('0x1'))(_0x9edd('0x2'));var moment=require(_0x9edd('0x3'));var BPromise=require(_0x9edd('0x4'));var rp=require(_0x9edd('0x5'));var fs=require('fs');var path=require(_0x9edd('0x6'));var rimraf=require(_0x9edd('0x7'));var config=require('../../config/environment');var attributes=require(_0x9edd('0x8'));module[_0x9edd('0x9')]=function(_0x268f9e,_0x34c1a7){return _0x268f9e['define'](_0x9edd('0xa'),attributes,{'tableName':'voice_queues','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 76e5135..b25670b 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 _0x03c9=['request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','GetVoiceQueue','VoiceQueue','findAll','options','raw','where','attributes','limit','include','model','map','then','ShowVoiceQueue','find','lodash','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults','localhost','socket.io-emitter','./voiceQueue.socket','register','VoiceQueue,\x20%s,\x20%s'];(function(_0x282ccc,_0x5d66a1){var _0x27c2dd=function(_0x58431a){while(--_0x58431a){_0x282ccc['push'](_0x282ccc['shift']());}};_0x27c2dd(++_0x5d66a1);}(_0x03c9,0x164));var _0x903c=function(_0x131f9c,_0x3c05cd){_0x131f9c=_0x131f9c-0x0;var _0x3258f7=_0x03c9[_0x131f9c];return _0x3258f7;};'use strict';var _=require(_0x903c('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x903c('0x1'));var fs=require('fs');var Redis=require(_0x903c('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x903c('0x3'))(_0x903c('0x4'));var config=require(_0x903c('0x5'));var jayson=require(_0x903c('0x6'));var client=jayson['client'][_0x903c('0x7')]({'port':0x232a});config['redis']=_[_0x903c('0x8')](config['redis'],{'host':_0x903c('0x9'),'port':0x18eb});var socket=require(_0x903c('0xa'))(new Redis(config['redis']));require(_0x903c('0xb'))[_0x903c('0xc')](socket);function respondWithRpcPromise(_0x33684a,_0xb26df8,_0xf07502){return new BPromise(function(_0x477d04,_0x3bfcc0){return client['request'](_0x33684a,_0xf07502)['then'](function(_0x398143){logger['info'](_0x903c('0xd'),_0xb26df8,_0x903c('0xe'));logger[_0x903c('0xf')](_0x903c('0x10'),_0xb26df8,_0x903c('0xe'),JSON[_0x903c('0x11')](_0x398143));if(_0x398143[_0x903c('0x12')]){if(_0x398143[_0x903c('0x12')]['code']===0x1f4){logger[_0x903c('0x12')](_0x903c('0xd'),_0xb26df8,_0x398143[_0x903c('0x12')][_0x903c('0x13')]);return _0x3bfcc0(_0x398143[_0x903c('0x12')]['message']);}logger[_0x903c('0x12')](_0x903c('0xd'),_0xb26df8,_0x398143[_0x903c('0x12')][_0x903c('0x13')]);return _0x477d04(_0x398143[_0x903c('0x12')]['message']);}else{logger[_0x903c('0x14')](_0x903c('0xd'),_0xb26df8,'request\x20sent');_0x477d04(_0x398143[_0x903c('0x15')][_0x903c('0x13')]);}})[_0x903c('0x16')](function(_0x45ef26){logger[_0x903c('0x12')](_0x903c('0xd'),_0xb26df8,_0x45ef26);_0x3bfcc0(_0x45ef26);});});}exports[_0x903c('0x17')]=function(_0x1ba203){var _0x3138d2=this;return new Promise(function(_0x53ac36,_0x5af37e){return db[_0x903c('0x18')][_0x903c('0x19')]({'raw':_0x1ba203[_0x903c('0x1a')]?_0x1ba203['options'][_0x903c('0x1b')]===undefined?!![]:![]:!![],'where':_0x1ba203[_0x903c('0x1a')]?_0x1ba203['options'][_0x903c('0x1c')]||null:null,'attributes':_0x1ba203['options']?_0x1ba203[_0x903c('0x1a')][_0x903c('0x1d')]||null:null,'limit':_0x1ba203['options']?_0x1ba203['options'][_0x903c('0x1e')]||null:null,'include':_0x1ba203['options']?_0x1ba203[_0x903c('0x1a')][_0x903c('0x1f')]?_['map'](_0x1ba203['options'][_0x903c('0x1f')],function(_0x435478){return{'model':db[_0x435478[_0x903c('0x20')]],'as':_0x435478['as'],'attributes':_0x435478['attributes'],'include':_0x435478[_0x903c('0x1f')]?_['map'](_0x435478[_0x903c('0x1f')],function(_0xbb7231){return{'model':db[_0xbb7231['model']],'as':_0xbb7231['as'],'attributes':_0xbb7231[_0x903c('0x1d')],'include':_0xbb7231[_0x903c('0x1f')]?_[_0x903c('0x21')](_0xbb7231[_0x903c('0x1f')],function(_0x4d5329){return{'model':db[_0x4d5329[_0x903c('0x20')]],'as':_0x4d5329['as'],'attributes':_0x4d5329[_0x903c('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x903c('0x22')](function(_0x3a6ad9){logger[_0x903c('0x14')](_0x903c('0x17'),_0x1ba203);logger[_0x903c('0xf')]('GetVoiceQueue',_0x1ba203,JSON[_0x903c('0x11')](_0x3a6ad9));_0x53ac36(_0x3a6ad9);})[_0x903c('0x16')](function(_0x4483bb){logger[_0x903c('0x12')](_0x903c('0x17'),_0x4483bb['message'],_0x1ba203);_0x5af37e(_0x3138d2[_0x903c('0x12')](0x1f4,_0x4483bb['message']));});});};exports[_0x903c('0x23')]=function(_0x274237){var _0xe32436=this;return new Promise(function(_0x4b9ba7,_0x438c64){return db[_0x903c('0x18')][_0x903c('0x24')]({'raw':_0x274237['options']?_0x274237['options']['raw']===undefined?!![]:![]:!![],'where':_0x274237[_0x903c('0x1a')]?_0x274237[_0x903c('0x1a')][_0x903c('0x1c')]||null:null,'attributes':_0x274237['options']?_0x274237[_0x903c('0x1a')][_0x903c('0x1d')]||null:null,'include':_0x274237[_0x903c('0x1a')]?_0x274237[_0x903c('0x1a')][_0x903c('0x1f')]?_[_0x903c('0x21')](_0x274237[_0x903c('0x1a')]['include'],function(_0x372d37){return{'model':db[_0x372d37[_0x903c('0x20')]],'as':_0x372d37['as'],'attributes':_0x372d37['attributes'],'include':_0x372d37[_0x903c('0x1f')]?_[_0x903c('0x21')](_0x372d37[_0x903c('0x1f')],function(_0x56b49e){return{'model':db[_0x56b49e[_0x903c('0x20')]],'as':_0x56b49e['as'],'attributes':_0x56b49e[_0x903c('0x1d')],'include':_0x56b49e[_0x903c('0x1f')]?_[_0x903c('0x21')](_0x56b49e[_0x903c('0x1f')],function(_0x45e9ee){return{'model':db[_0x45e9ee[_0x903c('0x20')]],'as':_0x45e9ee['as'],'attributes':_0x45e9ee[_0x903c('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x903c('0x22')](function(_0xb51ba2){logger['info']('ShowVoiceQueue',_0x274237);logger[_0x903c('0xf')](_0x903c('0x23'),_0x274237,JSON[_0x903c('0x11')](_0xb51ba2));_0x4b9ba7(_0xb51ba2);})[_0x903c('0x16')](function(_0xdbcfdf){logger['error'](_0x903c('0x23'),_0xdbcfdf['message'],_0x274237);_0x438c64(_0xe32436['error'](0x1f4,_0xdbcfdf[_0x903c('0x13')]));});});}; \ No newline at end of file +var _0x1c1d=['attributes','limit','map','include','model','GetVoiceQueue','ShowVoiceQueue','VoiceQueue','where','stringify','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','then','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','options','raw'];(function(_0x1c1bda,_0x588f3c){var _0x1f0fd8=function(_0x827fa){while(--_0x827fa){_0x1c1bda['push'](_0x1c1bda['shift']());}};_0x1f0fd8(++_0x588f3c);}(_0x1c1d,0x1a1));var _0xd1c1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1c1d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd1c1('0x0'));var util=require('util');var moment=require(_0xd1c1('0x1'));var BPromise=require('bluebird');var rs=require(_0xd1c1('0x2'));var fs=require('fs');var Redis=require(_0xd1c1('0x3'));var db=require(_0xd1c1('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xd1c1('0x5'))(_0xd1c1('0x6'));var config=require(_0xd1c1('0x7'));var jayson=require(_0xd1c1('0x8'));var client=jayson[_0xd1c1('0x9')]['http']({'port':0x232a});config[_0xd1c1('0xa')]=_[_0xd1c1('0xb')](config[_0xd1c1('0xa')],{'host':_0xd1c1('0xc'),'port':0x18eb});var socket=require(_0xd1c1('0xd'))(new Redis(config[_0xd1c1('0xa')]));require(_0xd1c1('0xe'))['register'](socket);function respondWithRpcPromise(_0x2d74d6,_0x58ed35,_0x2e9ff9){return new BPromise(function(_0x2aa1fd,_0x5408a9){return client['request'](_0x2d74d6,_0x2e9ff9)[_0xd1c1('0xf')](function(_0x59fed8){logger[_0xd1c1('0x10')](_0xd1c1('0x11'),_0x58ed35,_0xd1c1('0x12'));logger[_0xd1c1('0x13')](_0xd1c1('0x14'),_0x58ed35,_0xd1c1('0x12'),JSON['stringify'](_0x59fed8));if(_0x59fed8[_0xd1c1('0x15')]){if(_0x59fed8[_0xd1c1('0x15')][_0xd1c1('0x16')]===0x1f4){logger['error']('VoiceQueue,\x20%s,\x20%s',_0x58ed35,_0x59fed8['error']['message']);return _0x5408a9(_0x59fed8[_0xd1c1('0x15')][_0xd1c1('0x17')]);}logger['error']('VoiceQueue,\x20%s,\x20%s',_0x58ed35,_0x59fed8['error']['message']);return _0x2aa1fd(_0x59fed8[_0xd1c1('0x15')][_0xd1c1('0x17')]);}else{logger[_0xd1c1('0x10')](_0xd1c1('0x11'),_0x58ed35,'request\x20sent');_0x2aa1fd(_0x59fed8[_0xd1c1('0x18')][_0xd1c1('0x17')]);}})['catch'](function(_0x1591fd){logger['error'](_0xd1c1('0x11'),_0x58ed35,_0x1591fd);_0x5408a9(_0x1591fd);});});}exports['GetVoiceQueue']=function(_0x58a63f){var _0x7db3d3=this;return new Promise(function(_0xbe04c,_0x5533e2){return db['VoiceQueue']['findAll']({'raw':_0x58a63f['options']?_0x58a63f[_0xd1c1('0x19')][_0xd1c1('0x1a')]===undefined?!![]:![]:!![],'where':_0x58a63f[_0xd1c1('0x19')]?_0x58a63f[_0xd1c1('0x19')]['where']||null:null,'attributes':_0x58a63f[_0xd1c1('0x19')]?_0x58a63f['options'][_0xd1c1('0x1b')]||null:null,'limit':_0x58a63f[_0xd1c1('0x19')]?_0x58a63f['options'][_0xd1c1('0x1c')]||null:null,'include':_0x58a63f['options']?_0x58a63f[_0xd1c1('0x19')]['include']?_[_0xd1c1('0x1d')](_0x58a63f[_0xd1c1('0x19')][_0xd1c1('0x1e')],function(_0x5a203b){return{'model':db[_0x5a203b[_0xd1c1('0x1f')]],'as':_0x5a203b['as'],'attributes':_0x5a203b[_0xd1c1('0x1b')],'include':_0x5a203b[_0xd1c1('0x1e')]?_[_0xd1c1('0x1d')](_0x5a203b[_0xd1c1('0x1e')],function(_0x13eea7){return{'model':db[_0x13eea7['model']],'as':_0x13eea7['as'],'attributes':_0x13eea7[_0xd1c1('0x1b')],'include':_0x13eea7['include']?_['map'](_0x13eea7['include'],function(_0x204788){return{'model':db[_0x204788[_0xd1c1('0x1f')]],'as':_0x204788['as'],'attributes':_0x204788[_0xd1c1('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xd1c1('0xf')](function(_0xc0dcbc){logger[_0xd1c1('0x10')](_0xd1c1('0x20'),_0x58a63f);logger[_0xd1c1('0x13')](_0xd1c1('0x20'),_0x58a63f,JSON['stringify'](_0xc0dcbc));_0xbe04c(_0xc0dcbc);})['catch'](function(_0x14a94c){logger[_0xd1c1('0x15')]('GetVoiceQueue',_0x14a94c['message'],_0x58a63f);_0x5533e2(_0x7db3d3[_0xd1c1('0x15')](0x1f4,_0x14a94c['message']));});});};exports[_0xd1c1('0x21')]=function(_0x1b1671){var _0x59a9fc=this;return new Promise(function(_0x4558f1,_0x164b32){return db[_0xd1c1('0x22')]['find']({'raw':_0x1b1671[_0xd1c1('0x19')]?_0x1b1671[_0xd1c1('0x19')][_0xd1c1('0x1a')]===undefined?!![]:![]:!![],'where':_0x1b1671['options']?_0x1b1671['options'][_0xd1c1('0x23')]||null:null,'attributes':_0x1b1671[_0xd1c1('0x19')]?_0x1b1671[_0xd1c1('0x19')][_0xd1c1('0x1b')]||null:null,'include':_0x1b1671[_0xd1c1('0x19')]?_0x1b1671[_0xd1c1('0x19')]['include']?_[_0xd1c1('0x1d')](_0x1b1671[_0xd1c1('0x19')][_0xd1c1('0x1e')],function(_0x240b50){return{'model':db[_0x240b50[_0xd1c1('0x1f')]],'as':_0x240b50['as'],'attributes':_0x240b50[_0xd1c1('0x1b')],'include':_0x240b50[_0xd1c1('0x1e')]?_['map'](_0x240b50[_0xd1c1('0x1e')],function(_0x24c369){return{'model':db[_0x24c369[_0xd1c1('0x1f')]],'as':_0x24c369['as'],'attributes':_0x24c369[_0xd1c1('0x1b')],'include':_0x24c369[_0xd1c1('0x1e')]?_['map'](_0x24c369[_0xd1c1('0x1e')],function(_0x398dce){return{'model':db[_0x398dce['model']],'as':_0x398dce['as'],'attributes':_0x398dce['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x6ded26){logger['info']('ShowVoiceQueue',_0x1b1671);logger['debug'](_0xd1c1('0x21'),_0x1b1671,JSON[_0xd1c1('0x24')](_0x6ded26));_0x4558f1(_0x6ded26);})['catch'](function(_0x16ec18){logger['error'](_0xd1c1('0x21'),_0x16ec18[_0xd1c1('0x17')],_0x1b1671);_0x164b32(_0x59a9fc[_0xd1c1('0x15')](0x1f4,_0x16ec18[_0xd1c1('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index 8c0999a..5c3d66b 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 _0xd653=['register','length','./voiceQueue.events','save','remove','emit'];(function(_0x2ced89,_0x2c0883){var _0x584ddd=function(_0x58ef83){while(--_0x58ef83){_0x2ced89['push'](_0x2ced89['shift']());}};_0x584ddd(++_0x2c0883);}(_0xd653,0x1f4));var _0x3d65=function(_0x230eec,_0x543bcc){_0x230eec=_0x230eec-0x0;var _0x3182db=_0xd653[_0x230eec];return _0x3182db;};'use strict';var VoiceQueueEvents=require(_0x3d65('0x0'));var events=[_0x3d65('0x1'),_0x3d65('0x2'),'update'];function createListener(_0xff2f0,_0xd2fae4){return function(_0x10072f){_0xd2fae4[_0x3d65('0x3')](_0xff2f0,_0x10072f);};}function removeListener(_0x512995,_0x24e550){return function(){VoiceQueueEvents['removeListener'](_0x512995,_0x24e550);};}exports[_0x3d65('0x4')]=function(_0x2a4228){for(var _0x580b0c=0x0,_0x2bbfa4=events[_0x3d65('0x5')];_0x580b0c<_0x2bbfa4;_0x580b0c++){var _0x5dcfbf=events[_0x580b0c];var _0x44e3b0=createListener('voiceQueue:'+_0x5dcfbf,_0x2a4228);VoiceQueueEvents['on'](_0x5dcfbf,_0x44e3b0);}}; \ No newline at end of file +var _0x8e81=['voiceQueue:','./voiceQueue.events','save','remove','emit','removeListener','register'];(function(_0x1d5ba8,_0x412a52){var _0x1022a2=function(_0x187f11){while(--_0x187f11){_0x1d5ba8['push'](_0x1d5ba8['shift']());}};_0x1022a2(++_0x412a52);}(_0x8e81,0x14a));var _0x18e8=function(_0x29aded,_0x37b630){_0x29aded=_0x29aded-0x0;var _0x47daaf=_0x8e81[_0x29aded];return _0x47daaf;};'use strict';var VoiceQueueEvents=require(_0x18e8('0x0'));var events=[_0x18e8('0x1'),_0x18e8('0x2'),'update'];function createListener(_0x1876c8,_0x12dd39){return function(_0xbc6b03){_0x12dd39[_0x18e8('0x3')](_0x1876c8,_0xbc6b03);};}function removeListener(_0x1caa18,_0x5a5fc0){return function(){VoiceQueueEvents[_0x18e8('0x4')](_0x1caa18,_0x5a5fc0);};}exports[_0x18e8('0x5')]=function(_0x5357dc){for(var _0x1ba893=0x0,_0x4dac4c=events['length'];_0x1ba893<_0x4dac4c;_0x1ba893++){var _0x4378dd=events[_0x1ba893];var _0x2db3e7=createListener(_0x18e8('0x6')+_0x4378dd,_0x5357dc);VoiceQueueEvents['on'](_0x4378dd,_0x2db3e7);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index fcc4ae5..aa608c5 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 _0x6f07=['post','create','put','update','exports','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','isAuthenticated','index','get','/index','getVoiceQueuesReport','/:id','show'];(function(_0x393fe8,_0x209fba){var _0x46fa16=function(_0x1e914b){while(--_0x1e914b){_0x393fe8['push'](_0x393fe8['shift']());}};_0x46fa16(++_0x209fba);}(_0x6f07,0x181));var _0x76f0=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x6f07[_0x57b54c];return _0x59cc19;};'use strict';var multer=require('multer');var util=require(_0x76f0('0x0'));var path=require(_0x76f0('0x1'));var timeout=require(_0x76f0('0x2'));var express=require('express');var router=express[_0x76f0('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x76f0('0x4'));var config=require(_0x76f0('0x5'));var controller=require(_0x76f0('0x6'));router['get']('/',auth[_0x76f0('0x7')](),controller[_0x76f0('0x8')]);router[_0x76f0('0x9')]('/describe',auth[_0x76f0('0x7')](),controller['describe']);router[_0x76f0('0x9')](_0x76f0('0xa'),auth[_0x76f0('0x7')](),controller[_0x76f0('0xb')]);router[_0x76f0('0x9')](_0x76f0('0xc'),auth[_0x76f0('0x7')](),controller[_0x76f0('0xd')]);router[_0x76f0('0xe')]('/',auth[_0x76f0('0x7')](),controller[_0x76f0('0xf')]);router[_0x76f0('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x76f0('0x11')]);router['delete'](_0x76f0('0xc'),auth[_0x76f0('0x7')](),controller['destroy']);module[_0x76f0('0x12')]=router; \ No newline at end of file +var _0x8c44=['util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','get','isAuthenticated','index','describe','/index','getVoiceQueuesReport','/:id','show','post','create','put','update','delete','destroy','exports','multer'];(function(_0x50fec5,_0x3b4ac1){var _0x17528a=function(_0x5d763d){while(--_0x5d763d){_0x50fec5['push'](_0x50fec5['shift']());}};_0x17528a(++_0x3b4ac1);}(_0x8c44,0xce));var _0x48c4=function(_0x59f0f7,_0x423bc4){_0x59f0f7=_0x59f0f7-0x0;var _0xf5ef2a=_0x8c44[_0x59f0f7];return _0xf5ef2a;};'use strict';var multer=require(_0x48c4('0x0'));var util=require(_0x48c4('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x48c4('0x2')]();var fs_extra=require(_0x48c4('0x3'));var auth=require(_0x48c4('0x4'));var interaction=require(_0x48c4('0x5'));var config=require(_0x48c4('0x6'));var controller=require(_0x48c4('0x7'));router[_0x48c4('0x8')]('/',auth[_0x48c4('0x9')](),controller[_0x48c4('0xa')]);router[_0x48c4('0x8')]('/describe',auth[_0x48c4('0x9')](),controller[_0x48c4('0xb')]);router[_0x48c4('0x8')](_0x48c4('0xc'),auth['isAuthenticated'](),controller[_0x48c4('0xd')]);router[_0x48c4('0x8')](_0x48c4('0xe'),auth[_0x48c4('0x9')](),controller[_0x48c4('0xf')]);router[_0x48c4('0x10')]('/',auth['isAuthenticated'](),controller[_0x48c4('0x11')]);router[_0x48c4('0x12')](_0x48c4('0xe'),auth['isAuthenticated'](),controller[_0x48c4('0x13')]);router[_0x48c4('0x14')](_0x48c4('0xe'),auth[_0x48c4('0x9')](),controller[_0x48c4('0x15')]);module[_0x48c4('0x16')]=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index 51c7a0a..47e830a 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 _0x87b3=['BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment','STRING','DATE','getDataValue','queuecallerjoinAt','YYYY-MM-DD\x20HH:mm:ss','diff','seconds','setDataValue','queuecallerleaveAt','holdtime','INTEGER'];(function(_0x237f8b,_0xc5eddb){var _0x423f94=function(_0x1f18f9){while(--_0x1f18f9){_0x237f8b['push'](_0x237f8b['shift']());}};_0x423f94(++_0xc5eddb);}(_0x87b3,0x14c));var _0x387b=function(_0x38bdc1,_0x2927cf){_0x38bdc1=_0x38bdc1-0x0;var _0x47098f=_0x87b3[_0x38bdc1];return _0x47098f;};'use strict';var Sequelize=require(_0x387b('0x0'));var moment=require(_0x387b('0x1'));module['exports']={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x387b('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x387b('0x2')]},'queue':{'type':Sequelize['STRING']},'queuecallerjoinAt':{'type':Sequelize[_0x387b('0x3')]},'queuecallerleaveAt':{'type':Sequelize[_0x387b('0x3')],'set':function(_0x5be574){var _0x1df65e=moment(_0x5be574);var _0x6ce5e1=moment(this[_0x387b('0x4')](_0x387b('0x5')))['format'](_0x387b('0x6'));var _0x17f85f=_0x1df65e[_0x387b('0x7')](_0x6ce5e1,_0x387b('0x8'));this[_0x387b('0x9')](_0x387b('0xa'),_0x5be574);this[_0x387b('0x9')](_0x387b('0xb'),_0x17f85f||null);}},'position':{'type':Sequelize[_0x387b('0xc')]},'count':{'type':Sequelize[_0x387b('0xc')]},'queuecallerabandon':{'type':Sequelize[_0x387b('0xd')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x387b('0x3')]},'queuecallercomplete':{'type':Sequelize[_0x387b('0xd')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x387b('0x3')]},'queuecallerexit':{'type':Sequelize[_0x387b('0xd')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize['DATE']},'queuecallerexitreason':{'type':Sequelize[_0x387b('0x2')],'comment':'COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'},'originalposition':{'type':Sequelize['INTEGER']},'channel':{'type':Sequelize[_0x387b('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x387b('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x387b('0x2')]},'exten':{'type':Sequelize[_0x387b('0x2')]},'priority':{'type':Sequelize[_0x387b('0x2')]},'holdtime':{'type':Sequelize[_0x387b('0xc')]},'mohtime':{'type':Sequelize[_0x387b('0xc')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x387b('0xd')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x387b('0x2')]},'transfer':{'type':Sequelize[_0x387b('0xd')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0x387b('0xe')},'transferexten':{'type':Sequelize[_0x387b('0x2')]},'transferuniqueid':{'type':Sequelize[_0x387b('0x2')]},'disposition':{'type':Sequelize[_0x387b('0x2')]},'secondDisposition':{'type':Sequelize[_0x387b('0x2')]},'thirdDisposition':{'type':Sequelize[_0x387b('0x2')]},'queuecallerenterreason':{'type':Sequelize[_0x387b('0xc')],'defaultValue':0x0}}; \ No newline at end of file +var _0x30af=['queuecallerjoinAt','format','diff','seconds','queuecallerleaveAt','setDataValue','holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','moment','STRING','DATE'];(function(_0x1265ed,_0x4b85e8){var _0x5ac459=function(_0xf0c114){while(--_0xf0c114){_0x1265ed['push'](_0x1265ed['shift']());}};_0x5ac459(++_0x4b85e8);}(_0x30af,0xb3));var _0xf30a=function(_0xe06071,_0x4eeaa1){_0xe06071=_0xe06071-0x0;var _0x8ad8be=_0x30af[_0xe06071];return _0x8ad8be;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xf30a('0x0'));module['exports']={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xf30a('0x1')]},'calleridnum':{'type':Sequelize[_0xf30a('0x1')]},'calleridname':{'type':Sequelize[_0xf30a('0x1')]},'queue':{'type':Sequelize[_0xf30a('0x1')]},'queuecallerjoinAt':{'type':Sequelize[_0xf30a('0x2')]},'queuecallerleaveAt':{'type':Sequelize[_0xf30a('0x2')],'set':function(_0x50afef){var _0x419144=moment(_0x50afef);var _0x58c485=moment(this['getDataValue'](_0xf30a('0x3')))[_0xf30a('0x4')]('YYYY-MM-DD\x20HH:mm:ss');var _0x49ad11=_0x419144[_0xf30a('0x5')](_0x58c485,_0xf30a('0x6'));this['setDataValue'](_0xf30a('0x7'),_0x50afef);this[_0xf30a('0x8')](_0xf30a('0x9'),_0x49ad11||null);}},'position':{'type':Sequelize[_0xf30a('0xa')]},'count':{'type':Sequelize[_0xf30a('0xa')]},'queuecallerabandon':{'type':Sequelize[_0xf30a('0xb')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0xf30a('0x2')]},'queuecallercomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize['DATE']},'queuecallerexit':{'type':Sequelize[_0xf30a('0xb')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0xf30a('0x2')]},'queuecallerexitreason':{'type':Sequelize[_0xf30a('0x1')],'comment':_0xf30a('0xc')},'originalposition':{'type':Sequelize[_0xf30a('0xa')]},'channel':{'type':Sequelize[_0xf30a('0x1')]},'connectedlinenum':{'type':Sequelize[_0xf30a('0x1')]},'connectedlinename':{'type':Sequelize[_0xf30a('0x1')]},'accountcode':{'type':Sequelize[_0xf30a('0x1')]},'context':{'type':Sequelize[_0xf30a('0x1')]},'exten':{'type':Sequelize[_0xf30a('0x1')]},'priority':{'type':Sequelize[_0xf30a('0x1')]},'holdtime':{'type':Sequelize[_0xf30a('0xa')]},'mohtime':{'type':Sequelize[_0xf30a('0xa')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xf30a('0xb')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0xf30a('0x1')]},'transfer':{'type':Sequelize[_0xf30a('0xb')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0xf30a('0xd')},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0xf30a('0x1')]},'secondDisposition':{'type':Sequelize[_0xf30a('0x1')]},'thirdDisposition':{'type':Sequelize[_0xf30a('0x1')]},'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 64d3b65..e1121b1 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 _0xd86d=['error','stack','name','send','index','map','VoiceQueueReport','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','merge','where','VIRTUAL','filter','includeAll','include','findAll','catch','show','params','rawAttributes','options','find','create','body','describe','getVoiceQueuesReport','rows','eml-format','fast-json-patch','request-promise','moment','util','path','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/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy'];(function(_0x96a742,_0x5dfcf9){var _0x2ed181=function(_0x539206){while(--_0x539206){_0x96a742['push'](_0x96a742['shift']());}};_0x2ed181(++_0x5dfcf9);}(_0xd86d,0xd0));var _0xdd86=function(_0x3de9ea,_0x137fb0){_0x3de9ea=_0x3de9ea-0x0;var _0x3fbd98=_0xd86d[_0x3de9ea];return _0x3fbd98;};'use strict';var emlformat=require(_0xdd86('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xdd86('0x1'));var rp=require(_0xdd86('0x2'));var moment=require(_0xdd86('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xdd86('0x4'));var path=require(_0xdd86('0x5'));var sox=require('sox');var csv=require(_0xdd86('0x6'));var ejs=require(_0xdd86('0x7'));var fs=require('fs');var fs_extra=require(_0xdd86('0x8'));var _=require('lodash');var squel=require(_0xdd86('0x9'));var crypto=require(_0xdd86('0xa'));var jsforce=require(_0xdd86('0xb'));var deskjs=require(_0xdd86('0xc'));var toCsv=require(_0xdd86('0x6'));var querystring=require(_0xdd86('0xd'));var Papa=require(_0xdd86('0xe'));var Redis=require(_0xdd86('0xf'));var authService=require(_0xdd86('0x10'));var qs=require(_0xdd86('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdd86('0x12'));var logger=require(_0xdd86('0x13'))('api');var utils=require(_0xdd86('0x14'));var config=require(_0xdd86('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xdd86('0x16')]=_[_0xdd86('0x17')](config['redis'],{'host':_0xdd86('0x18'),'port':0x18eb});var socket=require(_0xdd86('0x19'))(new Redis(config[_0xdd86('0x16')]));require(_0xdd86('0x1a'))[_0xdd86('0x1b')](socket);function respondWithStatusCode(_0x3807e2,_0x31222e){_0x31222e=_0x31222e||0xcc;return function(_0xb5004b){if(_0xb5004b){return _0x3807e2[_0xdd86('0x1c')](_0x31222e);}return _0x3807e2[_0xdd86('0x1d')](_0x31222e)[_0xdd86('0x1e')]();};}function respondWithResult(_0x26bfc8,_0x193da0){_0x193da0=_0x193da0||0xc8;return function(_0x43b880){if(_0x43b880){return _0x26bfc8[_0xdd86('0x1d')](_0x193da0)[_0xdd86('0x1f')](_0x43b880);}};}function respondWithFilteredResult(_0x567ab8,_0x1dfefa){return function(_0x3e8403){if(_0x3e8403){var _0x42fd19=typeof _0x1dfefa[_0xdd86('0x20')]===_0xdd86('0x21')&&typeof _0x1dfefa['limit']===_0xdd86('0x21');var _0x207f80=_0x3e8403[_0xdd86('0x22')];var _0x39bcf4=_0x42fd19?0x0:_0x1dfefa[_0xdd86('0x20')];var _0x215086=_0x42fd19?_0x3e8403[_0xdd86('0x22')]:_0x1dfefa[_0xdd86('0x20')]+_0x1dfefa[_0xdd86('0x23')];var _0xbc9482;if(_0x215086>=_0x207f80){_0x215086=_0x207f80;_0xbc9482=0xc8;}else{_0xbc9482=0xce;}_0x567ab8[_0xdd86('0x1d')](_0xbc9482);return _0x567ab8[_0xdd86('0x24')](_0xdd86('0x25'),_0x39bcf4+'-'+_0x215086+'/'+_0x207f80)[_0xdd86('0x1f')](_0x3e8403);}return null;};}function patchUpdates(_0x49ddbf){return function(_0x4e336c){try{jsonpatch[_0xdd86('0x26')](_0x4e336c,_0x49ddbf,!![]);}catch(_0x5903e0){return BPromise[_0xdd86('0x27')](_0x5903e0);}return _0x4e336c[_0xdd86('0x28')]();};}function saveUpdates(_0x55d4cc,_0x492c59){return function(_0x28f52a){if(_0x28f52a){return _0x28f52a[_0xdd86('0x29')](_0x55d4cc)[_0xdd86('0x2a')](function(_0x4b33f3){return _0x4b33f3;});}return null;};}function removeEntity(_0x2d18d0,_0x221179){return function(_0xd7cd77){if(_0xd7cd77){return _0xd7cd77[_0xdd86('0x2b')]()[_0xdd86('0x2a')](function(){_0x2d18d0[_0xdd86('0x1d')](0xcc)[_0xdd86('0x1e')]();});}};}function handleEntityNotFound(_0x44c17d,_0x2ea122){return function(_0x366207){if(!_0x366207){_0x44c17d['sendStatus'](0x194);}return _0x366207;};}function handleError(_0x47ff4a,_0x4fb475){_0x4fb475=_0x4fb475||0x1f4;return function(_0x211f10){logger[_0xdd86('0x2c')](_0x211f10[_0xdd86('0x2d')]);if(_0x211f10[_0xdd86('0x2e')]){delete _0x211f10[_0xdd86('0x2e')];}_0x47ff4a[_0xdd86('0x1d')](_0x4fb475)[_0xdd86('0x2f')](_0x211f10);};}exports[_0xdd86('0x30')]=function(_0x54949d,_0x21583e){var _0x2202d2={},_0x66e793={},_0x1148d3={'count':0x0,'rows':[]};var _0x24a226=_[_0xdd86('0x31')](db[_0xdd86('0x32')]['rawAttributes'],function(_0x4b5426){return{'name':_0x4b5426['fieldName'],'type':_0x4b5426[_0xdd86('0x33')][_0xdd86('0x34')]};});_0x66e793[_0xdd86('0x35')]=_[_0xdd86('0x31')](_0x24a226,'name');_0x66e793[_0xdd86('0x36')]=_[_0xdd86('0x37')](_0x54949d[_0xdd86('0x36')]);_0x66e793[_0xdd86('0x38')]=_[_0xdd86('0x39')](_0x66e793[_0xdd86('0x35')],_0x66e793[_0xdd86('0x36')]);_0x2202d2[_0xdd86('0x3a')]=_[_0xdd86('0x39')](_0x66e793[_0xdd86('0x35')],qs['fields'](_0x54949d[_0xdd86('0x36')][_0xdd86('0x3b')]));_0x2202d2[_0xdd86('0x3a')]=_0x2202d2['attributes'][_0xdd86('0x3c')]?_0x2202d2[_0xdd86('0x3a')]:_0x66e793['model'];if(!_0x54949d[_0xdd86('0x36')][_0xdd86('0x3d')](_0xdd86('0x3e'))){_0x2202d2['limit']=qs[_0xdd86('0x23')](_0x54949d['query'][_0xdd86('0x23')]);_0x2202d2[_0xdd86('0x20')]=qs[_0xdd86('0x20')](_0x54949d['query'][_0xdd86('0x20')]);}_0x2202d2[_0xdd86('0x3f')]=qs[_0xdd86('0x40')](_0x54949d[_0xdd86('0x36')]['sort']);_0x2202d2['where']=qs[_0xdd86('0x38')](_[_0xdd86('0x41')](_0x54949d['query'],_0x66e793['filters']),_0x24a226);if(_0x54949d[_0xdd86('0x36')]['filter']){_0x2202d2['where']=_[_0xdd86('0x42')](_0x2202d2[_0xdd86('0x43')],{'$or':_[_0xdd86('0x31')](_0x24a226,function(_0x3df469){if(_0x3df469[_0xdd86('0x33')]!==_0xdd86('0x44')){var _0x15f13d={};_0x15f13d[_0x3df469['name']]={'$like':'%'+_0x54949d['query'][_0xdd86('0x45')]+'%'};return _0x15f13d;}})});}_0x2202d2=_[_0xdd86('0x42')]({},_0x2202d2,_0x54949d['options']);var _0x55712c={'where':_0x2202d2[_0xdd86('0x43')]};return db[_0xdd86('0x32')][_0xdd86('0x22')](_0x55712c)[_0xdd86('0x2a')](function(_0x4fac83){_0x1148d3['count']=_0x4fac83;if(_0x54949d['query'][_0xdd86('0x46')]){_0x2202d2[_0xdd86('0x47')]=[{'all':!![]}];}return db[_0xdd86('0x32')][_0xdd86('0x48')](_0x2202d2);})[_0xdd86('0x2a')](function(_0x1b2a98){_0x1148d3['rows']=_0x1b2a98;return _0x1148d3;})[_0xdd86('0x2a')](respondWithFilteredResult(_0x21583e,_0x2202d2))[_0xdd86('0x49')](handleError(_0x21583e,null));};exports[_0xdd86('0x4a')]=function(_0xe43b49,_0x170aca){var _0x48ebdb={'raw':![],'where':{'id':_0xe43b49[_0xdd86('0x4b')]['id']}},_0x4ad4eb={};_0x4ad4eb[_0xdd86('0x35')]=_[_0xdd86('0x37')](db[_0xdd86('0x32')][_0xdd86('0x4c')]);_0x4ad4eb[_0xdd86('0x36')]=_[_0xdd86('0x37')](_0xe43b49['query']);_0x4ad4eb['filters']=_[_0xdd86('0x39')](_0x4ad4eb['model'],_0x4ad4eb[_0xdd86('0x36')]);_0x48ebdb[_0xdd86('0x3a')]=_[_0xdd86('0x39')](_0x4ad4eb[_0xdd86('0x35')],qs['fields'](_0xe43b49[_0xdd86('0x36')][_0xdd86('0x3b')]));_0x48ebdb[_0xdd86('0x3a')]=_0x48ebdb[_0xdd86('0x3a')][_0xdd86('0x3c')]?_0x48ebdb[_0xdd86('0x3a')]:_0x4ad4eb[_0xdd86('0x35')];if(_0xe43b49['query'][_0xdd86('0x46')]){_0x48ebdb[_0xdd86('0x47')]=[{'all':!![]}];}_0x48ebdb=_[_0xdd86('0x42')]({},_0x48ebdb,_0xe43b49[_0xdd86('0x4d')]);return db[_0xdd86('0x32')][_0xdd86('0x4e')](_0x48ebdb)[_0xdd86('0x2a')](handleEntityNotFound(_0x170aca,null))['then'](respondWithResult(_0x170aca,null))[_0xdd86('0x49')](handleError(_0x170aca,null));};exports[_0xdd86('0x4f')]=function(_0x1dd156,_0x555771){return db[_0xdd86('0x32')][_0xdd86('0x4f')](_0x1dd156[_0xdd86('0x50')],{})[_0xdd86('0x2a')](respondWithResult(_0x555771,0xc9))['catch'](handleError(_0x555771,null));};exports[_0xdd86('0x29')]=function(_0x325fab,_0x19a240){if(_0x325fab[_0xdd86('0x50')]['id']){delete _0x325fab[_0xdd86('0x50')]['id'];}return db['VoiceQueueReport'][_0xdd86('0x4e')]({'where':{'id':_0x325fab['params']['id']}})['then'](handleEntityNotFound(_0x19a240,null))[_0xdd86('0x2a')](saveUpdates(_0x325fab[_0xdd86('0x50')],null))[_0xdd86('0x2a')](respondWithResult(_0x19a240,null))[_0xdd86('0x49')](handleError(_0x19a240,null));};exports[_0xdd86('0x2b')]=function(_0x45ae87,_0x16c6e4){return db[_0xdd86('0x32')][_0xdd86('0x4e')]({'where':{'id':_0x45ae87[_0xdd86('0x4b')]['id']}})[_0xdd86('0x2a')](handleEntityNotFound(_0x16c6e4,null))[_0xdd86('0x2a')](removeEntity(_0x16c6e4,null))[_0xdd86('0x49')](handleError(_0x16c6e4,null));};exports[_0xdd86('0x51')]=function(_0x2de31d,_0x4ad86f){return db['VoiceQueueReport']['describe']()['then'](respondWithResult(_0x4ad86f,null))[_0xdd86('0x49')](handleError(_0x4ad86f,null));};exports[_0xdd86('0x52')]=function(_0xb69cb1,_0x1730dc){var _0x1dbf13={},_0x205b6f={},_0x27126e={'count':0x0,'rows':[]};_0x205b6f[_0xdd86('0x35')]=_[_0xdd86('0x37')](db[_0xdd86('0x32')][_0xdd86('0x4c')]);_0x205b6f[_0xdd86('0x36')]=_[_0xdd86('0x37')](_0xb69cb1[_0xdd86('0x36')]);_0x205b6f[_0xdd86('0x38')]=_['intersection'](_0x205b6f['model'],_0x205b6f[_0xdd86('0x36')]);_0x1dbf13[_0xdd86('0x3a')]=_['intersection'](_0x205b6f['model'],qs[_0xdd86('0x3b')](_0xb69cb1['query'][_0xdd86('0x3b')]));_0x1dbf13[_0xdd86('0x3a')]=_0x1dbf13['attributes'][_0xdd86('0x3c')]?_0x1dbf13[_0xdd86('0x3a')]:_0x205b6f['model'];if(!_0xb69cb1[_0xdd86('0x36')]['hasOwnProperty'](_0xdd86('0x3e'))){_0x1dbf13['limit']=qs[_0xdd86('0x23')](_0xb69cb1['query'][_0xdd86('0x23')]);_0x1dbf13['offset']=qs[_0xdd86('0x20')](_0xb69cb1['query']['offset']);}_0x1dbf13[_0xdd86('0x3f')]=qs[_0xdd86('0x40')](_0xb69cb1[_0xdd86('0x36')][_0xdd86('0x40')]);_0x1dbf13[_0xdd86('0x43')]=qs[_0xdd86('0x38')](_[_0xdd86('0x41')](_0xb69cb1[_0xdd86('0x36')],_0x205b6f[_0xdd86('0x38')]));if(_0xb69cb1[_0xdd86('0x36')][_0xdd86('0x45')]){_0x1dbf13[_0xdd86('0x43')]=_[_0xdd86('0x42')](_0x1dbf13[_0xdd86('0x43')],{'$or':_[_0xdd86('0x31')](_0x1dbf13[_0xdd86('0x3a')],function(_0x344617){var _0x5ca913={};_0x5ca913[_0x344617]={'$like':'%'+_0xb69cb1[_0xdd86('0x36')][_0xdd86('0x45')]+'%'};return _0x5ca913;})});}_0x1dbf13=_['merge']({},_0x1dbf13,_0xb69cb1[_0xdd86('0x4d')]);var _0x19bdef={'where':_0x1dbf13[_0xdd86('0x43')]};return db[_0xdd86('0x32')][_0xdd86('0x22')](_0x19bdef)[_0xdd86('0x2a')](function(_0x540dd5){_0x27126e[_0xdd86('0x22')]=_0x540dd5;if(_0xb69cb1[_0xdd86('0x36')][_0xdd86('0x46')]){_0x1dbf13['include']=[{'all':!![]}];}return db[_0xdd86('0x32')][_0xdd86('0x48')](_0x1dbf13);})['then'](function(_0x42f154){_0x27126e[_0xdd86('0x53')]=_0x42f154;return _0x27126e;})[_0xdd86('0x2a')](respondWithFilteredResult(_0x1730dc,_0x1dbf13,_0xdd86('0x52')))[_0xdd86('0x49')](handleError(_0x1730dc,null,'getVoiceQueuesReport'));}; \ No newline at end of file +var _0x7e11=['count','offset','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','map','VoiceQueueReport','fieldName','type','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','include','rows','catch','show','params','find','create','body','update','describe','getVoiceQueuesReport','rawAttributes','nolimit','findAll','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','defaults','redis','localhost','./voiceQueueReport.socket','register','status','end','json','undefined','limit'];(function(_0x2e3dfc,_0x454d6c){var _0x4b1245=function(_0x5e9faa){while(--_0x5e9faa){_0x2e3dfc['push'](_0x2e3dfc['shift']());}};_0x4b1245(++_0x454d6c);}(_0x7e11,0x126));var _0x17e1=function(_0x5609ef,_0x182267){_0x5609ef=_0x5609ef-0x0;var _0x18b2ff=_0x7e11[_0x5609ef];return _0x18b2ff;};'use strict';var emlformat=require(_0x17e1('0x0'));var rimraf=require(_0x17e1('0x1'));var zipdir=require(_0x17e1('0x2'));var jsonpatch=require(_0x17e1('0x3'));var rp=require(_0x17e1('0x4'));var moment=require(_0x17e1('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x17e1('0x6'));var util=require(_0x17e1('0x7'));var path=require(_0x17e1('0x8'));var sox=require(_0x17e1('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x17e1('0xa'));var _=require(_0x17e1('0xb'));var squel=require(_0x17e1('0xc'));var crypto=require(_0x17e1('0xd'));var jsforce=require(_0x17e1('0xe'));var deskjs=require(_0x17e1('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x17e1('0x10'));var Redis=require(_0x17e1('0x11'));var authService=require(_0x17e1('0x12'));var qs=require(_0x17e1('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x17e1('0x14'));var logger=require('../../config/logger')(_0x17e1('0x15'));var utils=require('../../config/utils');var config=require(_0x17e1('0x16'));var licenseUtil=require(_0x17e1('0x17'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x17e1('0x18')](config[_0x17e1('0x19')],{'host':_0x17e1('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x17e1('0x19')]));require(_0x17e1('0x1b'))[_0x17e1('0x1c')](socket);function respondWithStatusCode(_0x5196b1,_0x2c64f1){_0x2c64f1=_0x2c64f1||0xcc;return function(_0xa35684){if(_0xa35684){return _0x5196b1['sendStatus'](_0x2c64f1);}return _0x5196b1[_0x17e1('0x1d')](_0x2c64f1)[_0x17e1('0x1e')]();};}function respondWithResult(_0x364f8c,_0x3bcda){_0x3bcda=_0x3bcda||0xc8;return function(_0x3602b5){if(_0x3602b5){return _0x364f8c['status'](_0x3bcda)[_0x17e1('0x1f')](_0x3602b5);}};}function respondWithFilteredResult(_0x2194b0,_0x1d6990){return function(_0x128e5d){if(_0x128e5d){var _0x312e1e=typeof _0x1d6990['offset']===_0x17e1('0x20')&&typeof _0x1d6990[_0x17e1('0x21')]===_0x17e1('0x20');var _0x4a3b50=_0x128e5d[_0x17e1('0x22')];var _0x253f7c=_0x312e1e?0x0:_0x1d6990['offset'];var _0x12969a=_0x312e1e?_0x128e5d[_0x17e1('0x22')]:_0x1d6990[_0x17e1('0x23')]+_0x1d6990[_0x17e1('0x21')];var _0x48d7fe;if(_0x12969a>=_0x4a3b50){_0x12969a=_0x4a3b50;_0x48d7fe=0xc8;}else{_0x48d7fe=0xce;}_0x2194b0[_0x17e1('0x1d')](_0x48d7fe);return _0x2194b0['set'](_0x17e1('0x24'),_0x253f7c+'-'+_0x12969a+'/'+_0x4a3b50)[_0x17e1('0x1f')](_0x128e5d);}return null;};}function patchUpdates(_0x68214a){return function(_0x52eb60){try{jsonpatch[_0x17e1('0x25')](_0x52eb60,_0x68214a,!![]);}catch(_0x2c4d7d){return BPromise[_0x17e1('0x26')](_0x2c4d7d);}return _0x52eb60[_0x17e1('0x27')]();};}function saveUpdates(_0x5c45ac,_0x146269){return function(_0x2bfc88){if(_0x2bfc88){return _0x2bfc88['update'](_0x5c45ac)[_0x17e1('0x28')](function(_0x3a6d9d){return _0x3a6d9d;});}return null;};}function removeEntity(_0x121d5f,_0x4309de){return function(_0x2866d1){if(_0x2866d1){return _0x2866d1[_0x17e1('0x29')]()[_0x17e1('0x28')](function(){_0x121d5f[_0x17e1('0x1d')](0xcc)[_0x17e1('0x1e')]();});}};}function handleEntityNotFound(_0x521803,_0x30d6c4){return function(_0x282a79){if(!_0x282a79){_0x521803['sendStatus'](0x194);}return _0x282a79;};}function handleError(_0x2b36c8,_0x8961c1){_0x8961c1=_0x8961c1||0x1f4;return function(_0xc5fc0c){logger[_0x17e1('0x2a')](_0xc5fc0c[_0x17e1('0x2b')]);if(_0xc5fc0c[_0x17e1('0x2c')]){delete _0xc5fc0c[_0x17e1('0x2c')];}_0x2b36c8[_0x17e1('0x1d')](_0x8961c1)[_0x17e1('0x2d')](_0xc5fc0c);};}exports[_0x17e1('0x2e')]=function(_0x14ce48,_0x2598e1){var _0x2e7f09={},_0x5a73ca={},_0x28861c={'count':0x0,'rows':[]};var _0x318037=_[_0x17e1('0x2f')](db[_0x17e1('0x30')]['rawAttributes'],function(_0x59a302){return{'name':_0x59a302[_0x17e1('0x31')],'type':_0x59a302[_0x17e1('0x32')]['key']};});_0x5a73ca['model']=_[_0x17e1('0x2f')](_0x318037,_0x17e1('0x2c'));_0x5a73ca[_0x17e1('0x33')]=_[_0x17e1('0x34')](_0x14ce48['query']);_0x5a73ca[_0x17e1('0x35')]=_['intersection'](_0x5a73ca[_0x17e1('0x36')],_0x5a73ca['query']);_0x2e7f09[_0x17e1('0x37')]=_[_0x17e1('0x38')](_0x5a73ca[_0x17e1('0x36')],qs['fields'](_0x14ce48[_0x17e1('0x33')][_0x17e1('0x39')]));_0x2e7f09[_0x17e1('0x37')]=_0x2e7f09['attributes'][_0x17e1('0x3a')]?_0x2e7f09[_0x17e1('0x37')]:_0x5a73ca[_0x17e1('0x36')];if(!_0x14ce48['query'][_0x17e1('0x3b')]('nolimit')){_0x2e7f09[_0x17e1('0x21')]=qs['limit'](_0x14ce48[_0x17e1('0x33')][_0x17e1('0x21')]);_0x2e7f09[_0x17e1('0x23')]=qs[_0x17e1('0x23')](_0x14ce48[_0x17e1('0x33')][_0x17e1('0x23')]);}_0x2e7f09[_0x17e1('0x3c')]=qs[_0x17e1('0x3d')](_0x14ce48[_0x17e1('0x33')][_0x17e1('0x3d')]);_0x2e7f09[_0x17e1('0x3e')]=qs[_0x17e1('0x35')](_[_0x17e1('0x3f')](_0x14ce48['query'],_0x5a73ca[_0x17e1('0x35')]),_0x318037);if(_0x14ce48[_0x17e1('0x33')][_0x17e1('0x40')]){_0x2e7f09[_0x17e1('0x3e')]=_[_0x17e1('0x41')](_0x2e7f09[_0x17e1('0x3e')],{'$or':_[_0x17e1('0x2f')](_0x318037,function(_0x2f4b67){if(_0x2f4b67['type']!==_0x17e1('0x42')){var _0x3020cb={};_0x3020cb[_0x2f4b67['name']]={'$like':'%'+_0x14ce48[_0x17e1('0x33')][_0x17e1('0x40')]+'%'};return _0x3020cb;}})});}_0x2e7f09=_['merge']({},_0x2e7f09,_0x14ce48[_0x17e1('0x43')]);var _0x2ae8e3={'where':_0x2e7f09['where']};return db[_0x17e1('0x30')]['count'](_0x2ae8e3)['then'](function(_0x2191f7){_0x28861c[_0x17e1('0x22')]=_0x2191f7;if(_0x14ce48[_0x17e1('0x33')]['includeAll']){_0x2e7f09[_0x17e1('0x44')]=[{'all':!![]}];}return db[_0x17e1('0x30')]['findAll'](_0x2e7f09);})[_0x17e1('0x28')](function(_0x217299){_0x28861c[_0x17e1('0x45')]=_0x217299;return _0x28861c;})[_0x17e1('0x28')](respondWithFilteredResult(_0x2598e1,_0x2e7f09))[_0x17e1('0x46')](handleError(_0x2598e1,null));};exports[_0x17e1('0x47')]=function(_0x14882c,_0x44ed36){var _0x56834c={'raw':![],'where':{'id':_0x14882c[_0x17e1('0x48')]['id']}},_0x2c4b70={};_0x2c4b70[_0x17e1('0x36')]=_[_0x17e1('0x34')](db['VoiceQueueReport']['rawAttributes']);_0x2c4b70[_0x17e1('0x33')]=_[_0x17e1('0x34')](_0x14882c[_0x17e1('0x33')]);_0x2c4b70[_0x17e1('0x35')]=_['intersection'](_0x2c4b70[_0x17e1('0x36')],_0x2c4b70[_0x17e1('0x33')]);_0x56834c[_0x17e1('0x37')]=_[_0x17e1('0x38')](_0x2c4b70[_0x17e1('0x36')],qs[_0x17e1('0x39')](_0x14882c[_0x17e1('0x33')][_0x17e1('0x39')]));_0x56834c[_0x17e1('0x37')]=_0x56834c['attributes']['length']?_0x56834c['attributes']:_0x2c4b70[_0x17e1('0x36')];if(_0x14882c[_0x17e1('0x33')]['includeAll']){_0x56834c[_0x17e1('0x44')]=[{'all':!![]}];}_0x56834c=_[_0x17e1('0x41')]({},_0x56834c,_0x14882c['options']);return db[_0x17e1('0x30')][_0x17e1('0x49')](_0x56834c)[_0x17e1('0x28')](handleEntityNotFound(_0x44ed36,null))[_0x17e1('0x28')](respondWithResult(_0x44ed36,null))['catch'](handleError(_0x44ed36,null));};exports[_0x17e1('0x4a')]=function(_0x17c108,_0x295efd){return db['VoiceQueueReport'][_0x17e1('0x4a')](_0x17c108[_0x17e1('0x4b')],{})[_0x17e1('0x28')](respondWithResult(_0x295efd,0xc9))[_0x17e1('0x46')](handleError(_0x295efd,null));};exports[_0x17e1('0x4c')]=function(_0x26821a,_0x3b41dc){if(_0x26821a[_0x17e1('0x4b')]['id']){delete _0x26821a['body']['id'];}return db['VoiceQueueReport'][_0x17e1('0x49')]({'where':{'id':_0x26821a[_0x17e1('0x48')]['id']}})[_0x17e1('0x28')](handleEntityNotFound(_0x3b41dc,null))[_0x17e1('0x28')](saveUpdates(_0x26821a[_0x17e1('0x4b')],null))[_0x17e1('0x28')](respondWithResult(_0x3b41dc,null))[_0x17e1('0x46')](handleError(_0x3b41dc,null));};exports[_0x17e1('0x29')]=function(_0x2a6d1d,_0x4872aa){return db[_0x17e1('0x30')][_0x17e1('0x49')]({'where':{'id':_0x2a6d1d[_0x17e1('0x48')]['id']}})['then'](handleEntityNotFound(_0x4872aa,null))[_0x17e1('0x28')](removeEntity(_0x4872aa,null))[_0x17e1('0x46')](handleError(_0x4872aa,null));};exports[_0x17e1('0x4d')]=function(_0x341917,_0x1f4883){return db[_0x17e1('0x30')]['describe']()['then'](respondWithResult(_0x1f4883,null))[_0x17e1('0x46')](handleError(_0x1f4883,null));};exports[_0x17e1('0x4e')]=function(_0x1ea365,_0x5e953c){var _0x48375e={},_0x4ea624={},_0x47fdfd={'count':0x0,'rows':[]};_0x4ea624['model']=_[_0x17e1('0x34')](db[_0x17e1('0x30')][_0x17e1('0x4f')]);_0x4ea624[_0x17e1('0x33')]=_[_0x17e1('0x34')](_0x1ea365['query']);_0x4ea624['filters']=_[_0x17e1('0x38')](_0x4ea624[_0x17e1('0x36')],_0x4ea624[_0x17e1('0x33')]);_0x48375e[_0x17e1('0x37')]=_[_0x17e1('0x38')](_0x4ea624[_0x17e1('0x36')],qs['fields'](_0x1ea365['query'][_0x17e1('0x39')]));_0x48375e[_0x17e1('0x37')]=_0x48375e['attributes'][_0x17e1('0x3a')]?_0x48375e[_0x17e1('0x37')]:_0x4ea624[_0x17e1('0x36')];if(!_0x1ea365[_0x17e1('0x33')][_0x17e1('0x3b')](_0x17e1('0x50'))){_0x48375e[_0x17e1('0x21')]=qs['limit'](_0x1ea365[_0x17e1('0x33')][_0x17e1('0x21')]);_0x48375e[_0x17e1('0x23')]=qs[_0x17e1('0x23')](_0x1ea365[_0x17e1('0x33')][_0x17e1('0x23')]);}_0x48375e[_0x17e1('0x3c')]=qs[_0x17e1('0x3d')](_0x1ea365[_0x17e1('0x33')]['sort']);_0x48375e['where']=qs[_0x17e1('0x35')](_['pick'](_0x1ea365[_0x17e1('0x33')],_0x4ea624[_0x17e1('0x35')]));if(_0x1ea365[_0x17e1('0x33')]['filter']){_0x48375e[_0x17e1('0x3e')]=_[_0x17e1('0x41')](_0x48375e[_0x17e1('0x3e')],{'$or':_[_0x17e1('0x2f')](_0x48375e['attributes'],function(_0x3769ca){var _0x542c2a={};_0x542c2a[_0x3769ca]={'$like':'%'+_0x1ea365[_0x17e1('0x33')][_0x17e1('0x40')]+'%'};return _0x542c2a;})});}_0x48375e=_[_0x17e1('0x41')]({},_0x48375e,_0x1ea365[_0x17e1('0x43')]);var _0x560f0b={'where':_0x48375e['where']};return db[_0x17e1('0x30')]['count'](_0x560f0b)[_0x17e1('0x28')](function(_0x2c2d19){_0x47fdfd[_0x17e1('0x22')]=_0x2c2d19;if(_0x1ea365[_0x17e1('0x33')]['includeAll']){_0x48375e[_0x17e1('0x44')]=[{'all':!![]}];}return db['VoiceQueueReport'][_0x17e1('0x51')](_0x48375e);})[_0x17e1('0x28')](function(_0x42e290){_0x47fdfd['rows']=_0x42e290;return _0x47fdfd;})[_0x17e1('0x28')](respondWithFilteredResult(_0x5e953c,_0x48375e,'getVoiceQueuesReport'))['catch'](handleError(_0x5e953c,null,_0x17e1('0x4e')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index c5345b3..a5450c6 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 _0xd66d=['events','VoiceQueueReport','update','emit','hasOwnProperty','hook','exports'];(function(_0x4ee6ca,_0x499b7e){var _0x358cf4=function(_0x14ace9){while(--_0x14ace9){_0x4ee6ca['push'](_0x4ee6ca['shift']());}};_0x358cf4(++_0x499b7e);}(_0xd66d,0x12d));var _0xdd66=function(_0x51c819,_0xd812db){_0x51c819=_0x51c819-0x0;var _0x15c5d2=_0xd66d[_0x51c819];return _0x15c5d2;};'use strict';var EventEmitter=require(_0xdd66('0x0'));var VoiceQueueReport=require('../../mysqldb')['db'][_0xdd66('0x1')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xdd66('0x2'),'afterDestroy':'remove'};function emitEvent(_0x35ec93){return function(_0xce83f7,_0x4b9c32,_0x4491b4){VoiceQueueReportEvents[_0xdd66('0x3')](_0x35ec93+':'+_0xce83f7['id'],_0xce83f7);VoiceQueueReportEvents[_0xdd66('0x3')](_0x35ec93,_0xce83f7);_0x4491b4(null);};}for(var e in events){if(events[_0xdd66('0x4')](e)){var event=events[e];VoiceQueueReport[_0xdd66('0x5')](e,emitEvent(event));}}module[_0xdd66('0x6')]=VoiceQueueReportEvents; \ No newline at end of file +var _0x0eaa=['setMaxListeners','save','emit','hook','exports','../../mysqldb','VoiceQueueReport'];(function(_0x1314ef,_0x250962){var _0x363d5c=function(_0x333685){while(--_0x333685){_0x1314ef['push'](_0x1314ef['shift']());}};_0x363d5c(++_0x250962);}(_0x0eaa,0x155));var _0xa0ea=function(_0x5e599e,_0x1d61e2){_0x5e599e=_0x5e599e-0x0;var _0x241bbe=_0x0eaa[_0x5e599e];return _0x241bbe;};'use strict';var EventEmitter=require('events');var VoiceQueueReport=require(_0xa0ea('0x0'))['db'][_0xa0ea('0x1')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0xa0ea('0x2')](0x0);var events={'afterCreate':_0xa0ea('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x5b38fd){return function(_0x544625,_0x2f2d2c,_0x442dbd){VoiceQueueReportEvents[_0xa0ea('0x4')](_0x5b38fd+':'+_0x544625['id'],_0x544625);VoiceQueueReportEvents[_0xa0ea('0x4')](_0x5b38fd,_0x544625);_0x442dbd(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueueReport[_0xa0ea('0x5')](e,emitEvent(event));}}module[_0xa0ea('0x6')]=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index 53ddef5..c68f4c7 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 _0x7f4a=['./voiceQueueReport.attributes','exports','define','VoiceQueueReport','report_queue','uniqueid','calleridnum','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x2e1370,_0x553a33){var _0x45ece1=function(_0x312061){while(--_0x312061){_0x2e1370['push'](_0x2e1370['shift']());}};_0x45ece1(++_0x553a33);}(_0x7f4a,0x1c7));var _0xa7f4=function(_0xf4129c,_0x44fcf1){_0xf4129c=_0xf4129c-0x0;var _0x426611=_0x7f4a[_0xf4129c];return _0x426611;};'use strict';var _=require(_0xa7f4('0x0'));var util=require(_0xa7f4('0x1'));var logger=require('../../config/logger')(_0xa7f4('0x2'));var moment=require(_0xa7f4('0x3'));var BPromise=require(_0xa7f4('0x4'));var rp=require(_0xa7f4('0x5'));var fs=require('fs');var path=require(_0xa7f4('0x6'));var rimraf=require(_0xa7f4('0x7'));var config=require(_0xa7f4('0x8'));var attributes=require(_0xa7f4('0x9'));module[_0xa7f4('0xa')]=function(_0x1bd403,_0x564b54){return _0x1bd403[_0xa7f4('0xb')](_0xa7f4('0xc'),attributes,{'tableName':_0xa7f4('0xd'),'paranoid':![],'indexes':[{'fields':[_0xa7f4('0xe')]},{'fields':[_0xa7f4('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6cef=['exports','define','calleridnum','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueueReport.attributes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6cef,0x1f1));var _0xf6ce=function(_0x2df84d,_0x56d874){_0x2df84d=_0x2df84d-0x0;var _0x2634ce=_0x6cef[_0x2df84d];return _0x2634ce;};'use strict';var _=require('lodash');var util=require(_0xf6ce('0x0'));var logger=require(_0xf6ce('0x1'))(_0xf6ce('0x2'));var moment=require(_0xf6ce('0x3'));var BPromise=require(_0xf6ce('0x4'));var rp=require(_0xf6ce('0x5'));var fs=require('fs');var path=require(_0xf6ce('0x6'));var rimraf=require(_0xf6ce('0x7'));var config=require(_0xf6ce('0x8'));var attributes=require(_0xf6ce('0x9'));module[_0xf6ce('0xa')]=function(_0x29ae68,_0x627153){return _0x29ae68[_0xf6ce('0xb')]('VoiceQueueReport',attributes,{'tableName':'report_queue','paranoid':![],'indexes':[{'fields':['uniqueid']},{'fields':[_0xf6ce('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index 20672b3..6c937bf 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 _0xd5a9=['request\x20sent','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','VoiceQueueReport,\x20%s,\x20%s','info','result','catch','GetVoiceQueueReport','findAll','options','raw','where','limit','include','map','model','attributes','debug','VoiceQueueReport','create','update','body','UpdateVoiceQueueReport','moment','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','request','then'];(function(_0x2fa1c6,_0x4a5b8d){var _0x5f3257=function(_0x195b53){while(--_0x195b53){_0x2fa1c6['push'](_0x2fa1c6['shift']());}};_0x5f3257(++_0x4a5b8d);}(_0xd5a9,0x110));var _0x9d5a=function(_0x5acb66,_0x1b7f93){_0x5acb66=_0x5acb66-0x0;var _0x2f1cd1=_0xd5a9[_0x5acb66];return _0x2f1cd1;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x9d5a('0x0'));var BPromise=require('bluebird');var rs=require(_0x9d5a('0x1'));var fs=require('fs');var Redis=require(_0x9d5a('0x2'));var db=require(_0x9d5a('0x3'))['db'];var utils=require(_0x9d5a('0x4'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x9d5a('0x5'));var client=jayson[_0x9d5a('0x6')][_0x9d5a('0x7')]({'port':0x232a});config[_0x9d5a('0x8')]=_[_0x9d5a('0x9')](config[_0x9d5a('0x8')],{'host':_0x9d5a('0xa'),'port':0x18eb});var socket=require(_0x9d5a('0xb'))(new Redis(config[_0x9d5a('0x8')]));require(_0x9d5a('0xc'))['register'](socket);function respondWithRpcPromise(_0x129880,_0x43930f,_0x4218b4){return new BPromise(function(_0x45baca,_0x5c880c){return client[_0x9d5a('0xd')](_0x129880,_0x4218b4)[_0x9d5a('0xe')](function(_0x80102d){logger['info']('VoiceQueueReport,\x20%s,\x20%s',_0x43930f,_0x9d5a('0xf'));logger['debug'](_0x9d5a('0x10'),_0x43930f,'request\x20sent',JSON[_0x9d5a('0x11')](_0x80102d));if(_0x80102d['error']){if(_0x80102d[_0x9d5a('0x12')][_0x9d5a('0x13')]===0x1f4){logger[_0x9d5a('0x12')]('VoiceQueueReport,\x20%s,\x20%s',_0x43930f,_0x80102d['error'][_0x9d5a('0x14')]);return _0x5c880c(_0x80102d['error'][_0x9d5a('0x14')]);}logger[_0x9d5a('0x12')](_0x9d5a('0x15'),_0x43930f,_0x80102d[_0x9d5a('0x12')][_0x9d5a('0x14')]);return _0x45baca(_0x80102d[_0x9d5a('0x12')][_0x9d5a('0x14')]);}else{logger[_0x9d5a('0x16')]('VoiceQueueReport,\x20%s,\x20%s',_0x43930f,_0x9d5a('0xf'));_0x45baca(_0x80102d[_0x9d5a('0x17')]['message']);}})[_0x9d5a('0x18')](function(_0x3aa28e){logger['error'](_0x9d5a('0x15'),_0x43930f,_0x3aa28e);_0x5c880c(_0x3aa28e);});});}exports[_0x9d5a('0x19')]=function(_0x18d0cb){var _0x47425c=this;return new Promise(function(_0x23f319,_0xa798cc){return db['VoiceQueueReport'][_0x9d5a('0x1a')]({'raw':_0x18d0cb[_0x9d5a('0x1b')]?_0x18d0cb[_0x9d5a('0x1b')][_0x9d5a('0x1c')]===undefined?!![]:![]:!![],'where':_0x18d0cb[_0x9d5a('0x1b')]?_0x18d0cb[_0x9d5a('0x1b')][_0x9d5a('0x1d')]||null:null,'attributes':_0x18d0cb[_0x9d5a('0x1b')]?_0x18d0cb[_0x9d5a('0x1b')]['attributes']||null:null,'limit':_0x18d0cb[_0x9d5a('0x1b')]?_0x18d0cb[_0x9d5a('0x1b')][_0x9d5a('0x1e')]||null:null,'include':_0x18d0cb[_0x9d5a('0x1b')]?_0x18d0cb['options'][_0x9d5a('0x1f')]?_[_0x9d5a('0x20')](_0x18d0cb['options'][_0x9d5a('0x1f')],function(_0x493d4a){return{'model':db[_0x493d4a[_0x9d5a('0x21')]],'as':_0x493d4a['as'],'attributes':_0x493d4a[_0x9d5a('0x22')],'include':_0x493d4a[_0x9d5a('0x1f')]?_[_0x9d5a('0x20')](_0x493d4a[_0x9d5a('0x1f')],function(_0x1cd57c){return{'model':db[_0x1cd57c[_0x9d5a('0x21')]],'as':_0x1cd57c['as'],'attributes':_0x1cd57c[_0x9d5a('0x22')],'include':_0x1cd57c[_0x9d5a('0x1f')]?_[_0x9d5a('0x20')](_0x1cd57c[_0x9d5a('0x1f')],function(_0x1128bd){return{'model':db[_0x1128bd[_0x9d5a('0x21')]],'as':_0x1128bd['as'],'attributes':_0x1128bd[_0x9d5a('0x22')]};}):[]};}):[]};}):[]:[]})[_0x9d5a('0xe')](function(_0x19e1b9){logger['info'](_0x9d5a('0x19'),_0x18d0cb);logger[_0x9d5a('0x23')](_0x9d5a('0x19'),_0x18d0cb,JSON[_0x9d5a('0x11')](_0x19e1b9));_0x23f319(_0x19e1b9);})['catch'](function(_0x2e7344){logger[_0x9d5a('0x12')]('GetVoiceQueueReport',_0x2e7344[_0x9d5a('0x14')],_0x18d0cb);_0xa798cc(_0x47425c[_0x9d5a('0x12')](0x1f4,_0x2e7344[_0x9d5a('0x14')]));});});};exports['CreateVoiceQueueReport']=function(_0x4e4566){var _0x5bffde=this;return new Promise(function(_0x5d1111,_0x15534c){return db[_0x9d5a('0x24')][_0x9d5a('0x25')](_0x4e4566['body'],{'raw':_0x4e4566[_0x9d5a('0x1b')]?_0x4e4566['options'][_0x9d5a('0x1c')]===undefined?!![]:![]:!![]})[_0x9d5a('0xe')](function(_0x40046f){logger['info']('CreateVoiceQueueReport',_0x4e4566);logger[_0x9d5a('0x23')]('CreateVoiceQueueReport',_0x4e4566,JSON[_0x9d5a('0x11')](_0x40046f));_0x5d1111(_0x40046f);})['catch'](function(_0xa35797){logger[_0x9d5a('0x12')]('CreateVoiceQueueReport',_0xa35797[_0x9d5a('0x14')],_0x4e4566);_0x15534c(_0x5bffde[_0x9d5a('0x12')](0x1f4,_0xa35797['message']));});});};exports['UpdateVoiceQueueReport']=function(_0x49247b){var _0x537c13=this;return new Promise(function(_0x166e15,_0x5a812a){return db[_0x9d5a('0x24')][_0x9d5a('0x26')](_0x49247b[_0x9d5a('0x27')],{'raw':_0x49247b[_0x9d5a('0x1b')]?_0x49247b[_0x9d5a('0x1b')][_0x9d5a('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x49247b[_0x9d5a('0x1b')]?_0x49247b[_0x9d5a('0x1b')][_0x9d5a('0x1d')]||null:null,'attributes':_0x49247b[_0x9d5a('0x1b')]?_0x49247b[_0x9d5a('0x1b')][_0x9d5a('0x22')]||null:null,'limit':_0x49247b[_0x9d5a('0x1b')]?_0x49247b[_0x9d5a('0x1b')][_0x9d5a('0x1e')]||null:null})[_0x9d5a('0xe')](function(_0x37f8a8){logger[_0x9d5a('0x16')]('UpdateVoiceQueueReport',_0x49247b);logger[_0x9d5a('0x23')]('UpdateVoiceQueueReport',_0x49247b,JSON['stringify'](_0x37f8a8));_0x166e15(_0x37f8a8);})['catch'](function(_0x8ac864){logger['error'](_0x9d5a('0x28'),_0x8ac864['message'],_0x49247b);_0x5a812a(_0x537c13[_0x9d5a('0x12')](0x1f4,_0x8ac864['message']));});});}; \ No newline at end of file +var _0xc30a=['register','request','then','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetVoiceQueueReport','VoiceQueueReport','findAll','raw','options','where','attributes','limit','include','model','map','create','body','CreateVoiceQueueReport','UpdateVoiceQueueReport','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./voiceQueueReport.socket'];(function(_0x13d8af,_0x51ee52){var _0x981d50=function(_0x5ab5b4){while(--_0x5ab5b4){_0x13d8af['push'](_0x13d8af['shift']());}};_0x981d50(++_0x51ee52);}(_0xc30a,0x150));var _0xac30=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0xc30a[_0x5bd426];return _0x23a7eb;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xac30('0x0'));var BPromise=require(_0xac30('0x1'));var rs=require(_0xac30('0x2'));var fs=require('fs');var Redis=require(_0xac30('0x3'));var db=require(_0xac30('0x4'))['db'];var utils=require(_0xac30('0x5'));var logger=require(_0xac30('0x6'))('rpc');var config=require(_0xac30('0x7'));var jayson=require(_0xac30('0x8'));var client=jayson[_0xac30('0x9')][_0xac30('0xa')]({'port':0x232a});config['redis']=_[_0xac30('0xb')](config[_0xac30('0xc')],{'host':_0xac30('0xd'),'port':0x18eb});var socket=require(_0xac30('0xe'))(new Redis(config[_0xac30('0xc')]));require(_0xac30('0xf'))[_0xac30('0x10')](socket);function respondWithRpcPromise(_0x2953ee,_0x13479e,_0x12d8a4){return new BPromise(function(_0x4411e2,_0x3450db){return client[_0xac30('0x11')](_0x2953ee,_0x12d8a4)[_0xac30('0x12')](function(_0x5c9cb3){logger[_0xac30('0x13')](_0xac30('0x14'),_0x13479e,_0xac30('0x15'));logger[_0xac30('0x16')](_0xac30('0x17'),_0x13479e,_0xac30('0x15'),JSON[_0xac30('0x18')](_0x5c9cb3));if(_0x5c9cb3['error']){if(_0x5c9cb3[_0xac30('0x19')][_0xac30('0x1a')]===0x1f4){logger[_0xac30('0x19')](_0xac30('0x14'),_0x13479e,_0x5c9cb3[_0xac30('0x19')][_0xac30('0x1b')]);return _0x3450db(_0x5c9cb3[_0xac30('0x19')][_0xac30('0x1b')]);}logger[_0xac30('0x19')](_0xac30('0x14'),_0x13479e,_0x5c9cb3[_0xac30('0x19')]['message']);return _0x4411e2(_0x5c9cb3['error'][_0xac30('0x1b')]);}else{logger[_0xac30('0x13')](_0xac30('0x14'),_0x13479e,_0xac30('0x15'));_0x4411e2(_0x5c9cb3['result'][_0xac30('0x1b')]);}})[_0xac30('0x1c')](function(_0x2c4eea){logger['error'](_0xac30('0x14'),_0x13479e,_0x2c4eea);_0x3450db(_0x2c4eea);});});}exports[_0xac30('0x1d')]=function(_0x3e91c8){var _0x45594b=this;return new Promise(function(_0x3ca79c,_0x416622){return db[_0xac30('0x1e')][_0xac30('0x1f')]({'raw':_0x3e91c8['options']?_0x3e91c8['options'][_0xac30('0x20')]===undefined?!![]:![]:!![],'where':_0x3e91c8[_0xac30('0x21')]?_0x3e91c8[_0xac30('0x21')][_0xac30('0x22')]||null:null,'attributes':_0x3e91c8['options']?_0x3e91c8[_0xac30('0x21')][_0xac30('0x23')]||null:null,'limit':_0x3e91c8['options']?_0x3e91c8[_0xac30('0x21')][_0xac30('0x24')]||null:null,'include':_0x3e91c8[_0xac30('0x21')]?_0x3e91c8[_0xac30('0x21')][_0xac30('0x25')]?_['map'](_0x3e91c8[_0xac30('0x21')][_0xac30('0x25')],function(_0x17c3c2){return{'model':db[_0x17c3c2[_0xac30('0x26')]],'as':_0x17c3c2['as'],'attributes':_0x17c3c2['attributes'],'include':_0x17c3c2['include']?_['map'](_0x17c3c2['include'],function(_0x4d8bb8){return{'model':db[_0x4d8bb8[_0xac30('0x26')]],'as':_0x4d8bb8['as'],'attributes':_0x4d8bb8[_0xac30('0x23')],'include':_0x4d8bb8[_0xac30('0x25')]?_[_0xac30('0x27')](_0x4d8bb8[_0xac30('0x25')],function(_0xee485){return{'model':db[_0xee485[_0xac30('0x26')]],'as':_0xee485['as'],'attributes':_0xee485[_0xac30('0x23')]};}):[]};}):[]};}):[]:[]})[_0xac30('0x12')](function(_0x34dc3d){logger[_0xac30('0x13')](_0xac30('0x1d'),_0x3e91c8);logger['debug'](_0xac30('0x1d'),_0x3e91c8,JSON[_0xac30('0x18')](_0x34dc3d));_0x3ca79c(_0x34dc3d);})['catch'](function(_0x3e1f2a){logger['error'](_0xac30('0x1d'),_0x3e1f2a['message'],_0x3e91c8);_0x416622(_0x45594b[_0xac30('0x19')](0x1f4,_0x3e1f2a[_0xac30('0x1b')]));});});};exports['CreateVoiceQueueReport']=function(_0x1f82ef){var _0x38bfd3=this;return new Promise(function(_0x428d8c,_0x28b048){return db['VoiceQueueReport'][_0xac30('0x28')](_0x1f82ef[_0xac30('0x29')],{'raw':_0x1f82ef[_0xac30('0x21')]?_0x1f82ef[_0xac30('0x21')][_0xac30('0x20')]===undefined?!![]:![]:!![]})[_0xac30('0x12')](function(_0xdd504d){logger[_0xac30('0x13')](_0xac30('0x2a'),_0x1f82ef);logger[_0xac30('0x16')](_0xac30('0x2a'),_0x1f82ef,JSON[_0xac30('0x18')](_0xdd504d));_0x428d8c(_0xdd504d);})['catch'](function(_0x3ca273){logger[_0xac30('0x19')](_0xac30('0x2a'),_0x3ca273['message'],_0x1f82ef);_0x28b048(_0x38bfd3[_0xac30('0x19')](0x1f4,_0x3ca273[_0xac30('0x1b')]));});});};exports[_0xac30('0x2b')]=function(_0x3f3915){var _0x162024=this;return new Promise(function(_0x1fd201,_0x2036ed){return db[_0xac30('0x1e')]['update'](_0x3f3915[_0xac30('0x29')],{'raw':_0x3f3915[_0xac30('0x21')]?_0x3f3915[_0xac30('0x21')][_0xac30('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3f3915[_0xac30('0x21')]?_0x3f3915[_0xac30('0x21')][_0xac30('0x22')]||null:null,'attributes':_0x3f3915['options']?_0x3f3915['options']['attributes']||null:null,'limit':_0x3f3915['options']?_0x3f3915[_0xac30('0x21')][_0xac30('0x24')]||null:null})[_0xac30('0x12')](function(_0xba33fa){logger['info']('UpdateVoiceQueueReport',_0x3f3915);logger['debug'](_0xac30('0x2b'),_0x3f3915,JSON[_0xac30('0x18')](_0xba33fa));_0x1fd201(_0xba33fa);})[_0xac30('0x1c')](function(_0x181cef){logger[_0xac30('0x19')](_0xac30('0x2b'),_0x181cef['message'],_0x3f3915);_0x2036ed(_0x162024[_0xac30('0x19')](0x1f4,_0x181cef['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index be60a96..6f2a96c 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 _0xb205=['remove','update','removeListener','register','length','voiceQueueReport:','./voiceQueueReport.events'];(function(_0x4a53d,_0x58a95e){var _0x27410e=function(_0x38fc90){while(--_0x38fc90){_0x4a53d['push'](_0x4a53d['shift']());}};_0x27410e(++_0x58a95e);}(_0xb205,0x156));var _0x5b20=function(_0x2e4e05,_0x26117c){_0x2e4e05=_0x2e4e05-0x0;var _0xf6879b=_0xb205[_0x2e4e05];return _0xf6879b;};'use strict';var VoiceQueueReportEvents=require(_0x5b20('0x0'));var events=['save',_0x5b20('0x1'),_0x5b20('0x2')];function createListener(_0x55fcc8,_0x3962be){return function(_0x237047){_0x3962be['emit'](_0x55fcc8,_0x237047);};}function removeListener(_0x364cc7,_0x456e5f){return function(){VoiceQueueReportEvents[_0x5b20('0x3')](_0x364cc7,_0x456e5f);};}exports[_0x5b20('0x4')]=function(_0x329ad4){for(var _0xb51467=0x0,_0x41a412=events[_0x5b20('0x5')];_0xb51467<_0x41a412;_0xb51467++){var _0x301499=events[_0xb51467];var _0x394d37=createListener(_0x5b20('0x6')+_0x301499,_0x329ad4);VoiceQueueReportEvents['on'](_0x301499,_0x394d37);}}; \ No newline at end of file +var _0x9829=['remove','update','emit','removeListener','register','length','voiceQueueReport:','./voiceQueueReport.events','save'];(function(_0xe51920,_0x4a1092){var _0x4e4c70=function(_0x71151){while(--_0x71151){_0xe51920['push'](_0xe51920['shift']());}};_0x4e4c70(++_0x4a1092);}(_0x9829,0xc4));var _0x9982=function(_0x455c6c,_0x1e78b7){_0x455c6c=_0x455c6c-0x0;var _0x488242=_0x9829[_0x455c6c];return _0x488242;};'use strict';var VoiceQueueReportEvents=require(_0x9982('0x0'));var events=[_0x9982('0x1'),_0x9982('0x2'),_0x9982('0x3')];function createListener(_0x338564,_0x4c01a9){return function(_0x399b6c){_0x4c01a9[_0x9982('0x4')](_0x338564,_0x399b6c);};}function removeListener(_0x2f782a,_0x4bee19){return function(){VoiceQueueReportEvents[_0x9982('0x5')](_0x2f782a,_0x4bee19);};}exports[_0x9982('0x6')]=function(_0x58f8fe){for(var _0x500dfd=0x0,_0x340d62=events[_0x9982('0x7')];_0x500dfd<_0x340d62;_0x500dfd++){var _0x5d0824=events[_0x500dfd];var _0x25f30a=createListener(_0x9982('0x8')+_0x5d0824,_0x58f8fe);VoiceQueueReportEvents['on'](_0x5d0824,_0x25f30a);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index 89c00ae..7b424f4 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 _0xc4a1=['get','isAuthenticated','index','/:id','show','post','create','put','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller'];(function(_0x1286ab,_0x17b3c7){var _0x2dca5f=function(_0x157ead){while(--_0x157ead){_0x1286ab['push'](_0x1286ab['shift']());}};_0x2dca5f(++_0x17b3c7);}(_0xc4a1,0x1ef));var _0x1c4a=function(_0x5b5557,_0xe018f2){_0x5b5557=_0x5b5557-0x0;var _0x50c3bb=_0xc4a1[_0x5b5557];return _0x50c3bb;};'use strict';var multer=require(_0x1c4a('0x0'));var util=require('util');var path=require(_0x1c4a('0x1'));var timeout=require(_0x1c4a('0x2'));var express=require(_0x1c4a('0x3'));var router=express['Router']();var fs_extra=require(_0x1c4a('0x4'));var auth=require(_0x1c4a('0x5'));var interaction=require(_0x1c4a('0x6'));var config=require(_0x1c4a('0x7'));var controller=require(_0x1c4a('0x8'));router[_0x1c4a('0x9')]('/',auth[_0x1c4a('0xa')](),controller[_0x1c4a('0xb')]);router[_0x1c4a('0x9')](_0x1c4a('0xc'),auth[_0x1c4a('0xa')](),controller[_0x1c4a('0xd')]);router[_0x1c4a('0xe')]('/',auth['isAuthenticated'](),controller[_0x1c4a('0xf')]);router[_0x1c4a('0x10')]('/:id',auth[_0x1c4a('0xa')](),controller['update']);router['delete'](_0x1c4a('0xc'),auth[_0x1c4a('0xa')](),controller['destroy']);module[_0x1c4a('0x11')]=router; \ No newline at end of file +var _0xe023=['../../components/auth/service','get','isAuthenticated','index','post','/:id','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra'];(function(_0x23b655,_0x4feb2b){var _0x364b32=function(_0x4e41ac){while(--_0x4e41ac){_0x23b655['push'](_0x23b655['shift']());}};_0x364b32(++_0x4feb2b);}(_0xe023,0x1da));var _0x3e02=function(_0x55a62a,_0x433b30){_0x55a62a=_0x55a62a-0x0;var _0x50e450=_0xe023[_0x55a62a];return _0x50e450;};'use strict';var multer=require(_0x3e02('0x0'));var util=require(_0x3e02('0x1'));var path=require('path');var timeout=require(_0x3e02('0x2'));var express=require(_0x3e02('0x3'));var router=express[_0x3e02('0x4')]();var fs_extra=require(_0x3e02('0x5'));var auth=require(_0x3e02('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./voiceQueuesLog.controller');router[_0x3e02('0x7')]('/',auth[_0x3e02('0x8')](),controller[_0x3e02('0x9')]);router[_0x3e02('0x7')]('/:id',auth[_0x3e02('0x8')](),controller['show']);router[_0x3e02('0xa')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x3e02('0xb'),auth[_0x3e02('0x8')](),controller[_0x3e02('0xc')]);router[_0x3e02('0xd')](_0x3e02('0xb'),auth[_0x3e02('0x8')](),controller[_0x3e02('0xe')]);module[_0x3e02('0xf')]=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index dc5723c..f1c63b3 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 _0x3761=['STRING','DATE','YYYY-MM-DD\x20HH:mm:ss','moment','exports'];(function(_0x6ee75d,_0xdebd4d){var _0x5cec37=function(_0x25ab66){while(--_0x25ab66){_0x6ee75d['push'](_0x6ee75d['shift']());}};_0x5cec37(++_0xdebd4d);}(_0x3761,0x8a));var _0x1376=function(_0x1536d8,_0x25d82a){_0x1536d8=_0x1536d8-0x0;var _0x130885=_0x3761[_0x1536d8];return _0x130885;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x1376('0x0'));module[_0x1376('0x1')]={'time':{'type':Sequelize[_0x1376('0x2')]},'callid':{'type':Sequelize[_0x1376('0x2')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x1376('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x1376('0x2')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x1376('0x2')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x1376('0x2')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x1376('0x2')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x1376('0x2')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x1376('0x3')],'allowNull':![],'defaultValue':moment()['format'](_0x1376('0x4'))}}; \ No newline at end of file +var _0x4866=['exports','STRING','DATE','format','moment'];(function(_0x7457fe,_0x564a5e){var _0x57a6e4=function(_0x566577){while(--_0x566577){_0x7457fe['push'](_0x7457fe['shift']());}};_0x57a6e4(++_0x564a5e);}(_0x4866,0x149));var _0x6486=function(_0x466bc5,_0x3a0f2a){_0x466bc5=_0x466bc5-0x0;var _0x138952=_0x4866[_0x466bc5];return _0x138952;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x6486('0x0'));module[_0x6486('0x1')]={'time':{'type':Sequelize['STRING']},'callid':{'type':Sequelize[_0x6486('0x2')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x6486('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x6486('0x2')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x6486('0x2')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x6486('0x2')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x6486('0x2')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x6486('0x2')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x6486('0x2')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x6486('0x3')],'allowNull':![],'defaultValue':moment()[_0x6486('0x4')]('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 3c5d7e4..1dc3e9d 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 _0x364b=['name','send','index','map','VoiceQueuesLog','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','type','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset','count','Content-Range','save','update','then','destroy','error','stack'];(function(_0x5c291f,_0x5512a0){var _0x4e5738=function(_0x25ee47){while(--_0x25ee47){_0x5c291f['push'](_0x5c291f['shift']());}};_0x4e5738(++_0x5512a0);}(_0x364b,0x195));var _0xb364=function(_0x1f74be,_0x2c979f){_0x1f74be=_0x1f74be-0x0;var _0x251fa7=_0x364b[_0x1f74be];return _0x251fa7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb364('0x0'));var zipdir=require(_0xb364('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb364('0x2'));var moment=require(_0xb364('0x3'));var BPromise=require(_0xb364('0x4'));var Mustache=require('mustache');var util=require(_0xb364('0x5'));var path=require(_0xb364('0x6'));var sox=require(_0xb364('0x7'));var csv=require(_0xb364('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb364('0x9'));var _=require(_0xb364('0xa'));var squel=require(_0xb364('0xb'));var crypto=require(_0xb364('0xc'));var jsforce=require(_0xb364('0xd'));var deskjs=require(_0xb364('0xe'));var toCsv=require(_0xb364('0x8'));var querystring=require('querystring');var Papa=require(_0xb364('0xf'));var Redis=require(_0xb364('0x10'));var authService=require(_0xb364('0x11'));var qs=require(_0xb364('0x12'));var as=require(_0xb364('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb364('0x14'))('api');var utils=require(_0xb364('0x15'));var config=require(_0xb364('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xb364('0x17'))['db'];function respondWithStatusCode(_0x18f0fd,_0x1b889c){_0x1b889c=_0x1b889c||0xcc;return function(_0x2fa17a){if(_0x2fa17a){return _0x18f0fd[_0xb364('0x18')](_0x1b889c);}return _0x18f0fd[_0xb364('0x19')](_0x1b889c)[_0xb364('0x1a')]();};}function respondWithResult(_0x211de1,_0x20dc53){_0x20dc53=_0x20dc53||0xc8;return function(_0x180ba9){if(_0x180ba9){return _0x211de1[_0xb364('0x19')](_0x20dc53)[_0xb364('0x1b')](_0x180ba9);}};}function respondWithFilteredResult(_0x1668a1,_0x3229e0){return function(_0x2deded){if(_0x2deded){var _0xb34b41=typeof _0x3229e0['offset']===_0xb364('0x1c')&&typeof _0x3229e0[_0xb364('0x1d')]===_0xb364('0x1c');var _0xd0e432=_0x2deded['count'];var _0x3876d0=_0xb34b41?0x0:_0x3229e0[_0xb364('0x1e')];var _0x44e68f=_0xb34b41?_0x2deded[_0xb364('0x1f')]:_0x3229e0[_0xb364('0x1e')]+_0x3229e0['limit'];var _0x1443fe;if(_0x44e68f>=_0xd0e432){_0x44e68f=_0xd0e432;_0x1443fe=0xc8;}else{_0x1443fe=0xce;}_0x1668a1[_0xb364('0x19')](_0x1443fe);return _0x1668a1['set'](_0xb364('0x20'),_0x3876d0+'-'+_0x44e68f+'/'+_0xd0e432)[_0xb364('0x1b')](_0x2deded);}return null;};}function patchUpdates(_0x5f295f){return function(_0x5cecca){try{jsonpatch['apply'](_0x5cecca,_0x5f295f,!![]);}catch(_0x1ba20c){return BPromise['reject'](_0x1ba20c);}return _0x5cecca[_0xb364('0x21')]();};}function saveUpdates(_0x44362e,_0x5f1456){return function(_0x19415a){if(_0x19415a){return _0x19415a[_0xb364('0x22')](_0x44362e)[_0xb364('0x23')](function(_0x2c363a){return _0x2c363a;});}return null;};}function removeEntity(_0x552b15,_0x110cc1){return function(_0x763a1c){if(_0x763a1c){return _0x763a1c[_0xb364('0x24')]()[_0xb364('0x23')](function(){_0x552b15['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1fbf6f,_0x2ac2d9){return function(_0x40a3fe){if(!_0x40a3fe){_0x1fbf6f[_0xb364('0x18')](0x194);}return _0x40a3fe;};}function handleError(_0x53b407,_0x18fff4){_0x18fff4=_0x18fff4||0x1f4;return function(_0x5f15c1){logger[_0xb364('0x25')](_0x5f15c1[_0xb364('0x26')]);if(_0x5f15c1['name']){delete _0x5f15c1[_0xb364('0x27')];}_0x53b407['status'](_0x18fff4)[_0xb364('0x28')](_0x5f15c1);};}exports[_0xb364('0x29')]=function(_0x59a3a8,_0x45a37e){var _0x1c8989={},_0x335ccf={},_0x3209cc={'count':0x0,'rows':[]};var _0x4f3174=_[_0xb364('0x2a')](db[_0xb364('0x2b')][_0xb364('0x2c')],function(_0x38bc8a){return{'name':_0x38bc8a[_0xb364('0x2d')],'type':_0x38bc8a['type'][_0xb364('0x2e')]};});_0x335ccf[_0xb364('0x2f')]=_['map'](_0x4f3174,_0xb364('0x27'));_0x335ccf[_0xb364('0x30')]=_['keys'](_0x59a3a8['query']);_0x335ccf[_0xb364('0x31')]=_[_0xb364('0x32')](_0x335ccf['model'],_0x335ccf[_0xb364('0x30')]);_0x1c8989[_0xb364('0x33')]=_[_0xb364('0x32')](_0x335ccf[_0xb364('0x2f')],qs[_0xb364('0x34')](_0x59a3a8[_0xb364('0x30')][_0xb364('0x34')]));_0x1c8989[_0xb364('0x33')]=_0x1c8989['attributes'][_0xb364('0x35')]?_0x1c8989[_0xb364('0x33')]:_0x335ccf[_0xb364('0x2f')];if(!_0x59a3a8[_0xb364('0x30')][_0xb364('0x36')](_0xb364('0x37'))){_0x1c8989[_0xb364('0x1d')]=qs[_0xb364('0x1d')](_0x59a3a8['query'][_0xb364('0x1d')]);_0x1c8989['offset']=qs['offset'](_0x59a3a8[_0xb364('0x30')]['offset']);}_0x1c8989[_0xb364('0x38')]=qs[_0xb364('0x39')](_0x59a3a8[_0xb364('0x30')]['sort']);_0x1c8989[_0xb364('0x3a')]=qs[_0xb364('0x31')](_[_0xb364('0x3b')](_0x59a3a8[_0xb364('0x30')],_0x335ccf['filters']),_0x4f3174);if(_0x59a3a8[_0xb364('0x30')]['filter']){_0x1c8989['where']=_['merge'](_0x1c8989[_0xb364('0x3a')],{'$or':_['map'](_0x4f3174,function(_0x45f97e){if(_0x45f97e[_0xb364('0x3c')]!=='VIRTUAL'){var _0x9476c8={};_0x9476c8[_0x45f97e['name']]={'$like':'%'+_0x59a3a8[_0xb364('0x30')]['filter']+'%'};return _0x9476c8;}})});}_0x1c8989=_[_0xb364('0x3d')]({},_0x1c8989,_0x59a3a8[_0xb364('0x3e')]);var _0x5563eb={'where':_0x1c8989[_0xb364('0x3a')]};return db[_0xb364('0x2b')]['count'](_0x5563eb)[_0xb364('0x23')](function(_0x427b41){_0x3209cc[_0xb364('0x1f')]=_0x427b41;if(_0x59a3a8['query'][_0xb364('0x3f')]){_0x1c8989[_0xb364('0x40')]=[{'all':!![]}];}return db['VoiceQueuesLog'][_0xb364('0x41')](_0x1c8989);})['then'](function(_0x3cd9cc){_0x3209cc[_0xb364('0x42')]=_0x3cd9cc;return _0x3209cc;})[_0xb364('0x23')](respondWithFilteredResult(_0x45a37e,_0x1c8989))[_0xb364('0x43')](handleError(_0x45a37e,null));};exports[_0xb364('0x44')]=function(_0x3dd098,_0x4091b0){var _0x20ffcb={'raw':!![],'where':{'id':_0x3dd098[_0xb364('0x45')]['id']}},_0x4cba39={};_0x4cba39['model']=_[_0xb364('0x46')](db[_0xb364('0x2b')][_0xb364('0x2c')]);_0x4cba39[_0xb364('0x30')]=_[_0xb364('0x46')](_0x3dd098[_0xb364('0x30')]);_0x4cba39[_0xb364('0x31')]=_[_0xb364('0x32')](_0x4cba39[_0xb364('0x2f')],_0x4cba39[_0xb364('0x30')]);_0x20ffcb[_0xb364('0x33')]=_['intersection'](_0x4cba39[_0xb364('0x2f')],qs[_0xb364('0x34')](_0x3dd098[_0xb364('0x30')]['fields']));_0x20ffcb[_0xb364('0x33')]=_0x20ffcb['attributes'][_0xb364('0x35')]?_0x20ffcb['attributes']:_0x4cba39[_0xb364('0x2f')];if(_0x3dd098[_0xb364('0x30')][_0xb364('0x3f')]){_0x20ffcb[_0xb364('0x40')]=[{'all':!![]}];}_0x20ffcb=_[_0xb364('0x3d')]({},_0x20ffcb,_0x3dd098[_0xb364('0x3e')]);return db[_0xb364('0x2b')][_0xb364('0x47')](_0x20ffcb)['then'](handleEntityNotFound(_0x4091b0,null))['then'](respondWithResult(_0x4091b0,null))[_0xb364('0x43')](handleError(_0x4091b0,null));};exports[_0xb364('0x48')]=function(_0x41f291,_0x1c6da8){return db['VoiceQueuesLog'][_0xb364('0x48')](_0x41f291[_0xb364('0x49')],{})[_0xb364('0x23')](respondWithResult(_0x1c6da8,0xc9))[_0xb364('0x43')](handleError(_0x1c6da8,null));};exports['update']=function(_0x882bbb,_0x270943){if(_0x882bbb[_0xb364('0x49')]['id']){delete _0x882bbb[_0xb364('0x49')]['id'];}return db[_0xb364('0x2b')][_0xb364('0x47')]({'where':{'id':_0x882bbb[_0xb364('0x45')]['id']}})[_0xb364('0x23')](handleEntityNotFound(_0x270943,null))['then'](saveUpdates(_0x882bbb[_0xb364('0x49')],null))[_0xb364('0x23')](respondWithResult(_0x270943,null))[_0xb364('0x43')](handleError(_0x270943,null));};exports[_0xb364('0x24')]=function(_0x4d19d8,_0x44edcd){return db[_0xb364('0x2b')][_0xb364('0x47')]({'where':{'id':_0x4d19d8['params']['id']}})[_0xb364('0x23')](handleEntityNotFound(_0x44edcd,null))[_0xb364('0x23')](removeEntity(_0x44edcd,null))['catch'](handleError(_0x44edcd,null));}; \ No newline at end of file +var _0xc617=['query','keys','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','create','update','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','end','status','offset','undefined','count','limit','Content-Range','json','reject','save','then','destroy','sendStatus','error','name','send','index','VoiceQueuesLog','fieldName','type','key','map'];(function(_0x5d5b19,_0x377254){var _0x5cdf9d=function(_0xfa431a){while(--_0xfa431a){_0x5d5b19['push'](_0x5d5b19['shift']());}};_0x5cdf9d(++_0x377254);}(_0xc617,0xb1));var _0x7c61=function(_0x7bdda5,_0x3358f5){_0x7bdda5=_0x7bdda5-0x0;var _0x45be29=_0xc617[_0x7bdda5];return _0x45be29;};'use strict';var emlformat=require(_0x7c61('0x0'));var rimraf=require(_0x7c61('0x1'));var zipdir=require(_0x7c61('0x2'));var jsonpatch=require(_0x7c61('0x3'));var rp=require(_0x7c61('0x4'));var moment=require(_0x7c61('0x5'));var BPromise=require(_0x7c61('0x6'));var Mustache=require(_0x7c61('0x7'));var util=require(_0x7c61('0x8'));var path=require(_0x7c61('0x9'));var sox=require(_0x7c61('0xa'));var csv=require(_0x7c61('0xb'));var ejs=require(_0x7c61('0xc'));var fs=require('fs');var fs_extra=require(_0x7c61('0xd'));var _=require(_0x7c61('0xe'));var squel=require(_0x7c61('0xf'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x7c61('0x10'));var toCsv=require(_0x7c61('0xb'));var querystring=require(_0x7c61('0x11'));var Papa=require(_0x7c61('0x12'));var Redis=require(_0x7c61('0x13'));var authService=require(_0x7c61('0x14'));var qs=require(_0x7c61('0x15'));var as=require(_0x7c61('0x16'));var hardwareService=require(_0x7c61('0x17'));var logger=require(_0x7c61('0x18'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x7c61('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x50b946,_0x32007d){_0x32007d=_0x32007d||0xcc;return function(_0x1b01ab){if(_0x1b01ab){return _0x50b946['sendStatus'](_0x32007d);}return _0x50b946['status'](_0x32007d)[_0x7c61('0x1a')]();};}function respondWithResult(_0x25e35d,_0x1bb02a){_0x1bb02a=_0x1bb02a||0xc8;return function(_0x2459c6){if(_0x2459c6){return _0x25e35d[_0x7c61('0x1b')](_0x1bb02a)['json'](_0x2459c6);}};}function respondWithFilteredResult(_0x19a6b6,_0x421f3d){return function(_0xa092a2){if(_0xa092a2){var _0x5d128c=typeof _0x421f3d[_0x7c61('0x1c')]===_0x7c61('0x1d')&&typeof _0x421f3d['limit']===_0x7c61('0x1d');var _0x46b0df=_0xa092a2['count'];var _0x23df43=_0x5d128c?0x0:_0x421f3d['offset'];var _0x180ecc=_0x5d128c?_0xa092a2[_0x7c61('0x1e')]:_0x421f3d['offset']+_0x421f3d[_0x7c61('0x1f')];var _0x36a626;if(_0x180ecc>=_0x46b0df){_0x180ecc=_0x46b0df;_0x36a626=0xc8;}else{_0x36a626=0xce;}_0x19a6b6[_0x7c61('0x1b')](_0x36a626);return _0x19a6b6['set'](_0x7c61('0x20'),_0x23df43+'-'+_0x180ecc+'/'+_0x46b0df)[_0x7c61('0x21')](_0xa092a2);}return null;};}function patchUpdates(_0xe0fea9){return function(_0x419cdf){try{jsonpatch['apply'](_0x419cdf,_0xe0fea9,!![]);}catch(_0x48ad48){return BPromise[_0x7c61('0x22')](_0x48ad48);}return _0x419cdf[_0x7c61('0x23')]();};}function saveUpdates(_0x48e135,_0x94d7d0){return function(_0x23af20){if(_0x23af20){return _0x23af20['update'](_0x48e135)[_0x7c61('0x24')](function(_0x2b376b){return _0x2b376b;});}return null;};}function removeEntity(_0x4f3355,_0x23aeb6){return function(_0xc2e6e9){if(_0xc2e6e9){return _0xc2e6e9[_0x7c61('0x25')]()[_0x7c61('0x24')](function(){_0x4f3355[_0x7c61('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5ce8d9,_0x56715c){return function(_0x1d484f){if(!_0x1d484f){_0x5ce8d9[_0x7c61('0x26')](0x194);}return _0x1d484f;};}function handleError(_0x2cb034,_0x5d4cf3){_0x5d4cf3=_0x5d4cf3||0x1f4;return function(_0xd0aaaa){logger[_0x7c61('0x27')](_0xd0aaaa['stack']);if(_0xd0aaaa['name']){delete _0xd0aaaa[_0x7c61('0x28')];}_0x2cb034['status'](_0x5d4cf3)[_0x7c61('0x29')](_0xd0aaaa);};}exports[_0x7c61('0x2a')]=function(_0x1ce3a6,_0x3627c9){var _0x41c6ac={},_0x506599={},_0x3be6d5={'count':0x0,'rows':[]};var _0x574068=_['map'](db[_0x7c61('0x2b')]['rawAttributes'],function(_0x27ae32){return{'name':_0x27ae32[_0x7c61('0x2c')],'type':_0x27ae32[_0x7c61('0x2d')][_0x7c61('0x2e')]};});_0x506599['model']=_[_0x7c61('0x2f')](_0x574068,_0x7c61('0x28'));_0x506599[_0x7c61('0x30')]=_[_0x7c61('0x31')](_0x1ce3a6[_0x7c61('0x30')]);_0x506599['filters']=_[_0x7c61('0x32')](_0x506599[_0x7c61('0x33')],_0x506599[_0x7c61('0x30')]);_0x41c6ac[_0x7c61('0x34')]=_[_0x7c61('0x32')](_0x506599[_0x7c61('0x33')],qs[_0x7c61('0x35')](_0x1ce3a6[_0x7c61('0x30')][_0x7c61('0x35')]));_0x41c6ac[_0x7c61('0x34')]=_0x41c6ac[_0x7c61('0x34')][_0x7c61('0x36')]?_0x41c6ac['attributes']:_0x506599[_0x7c61('0x33')];if(!_0x1ce3a6[_0x7c61('0x30')][_0x7c61('0x37')]('nolimit')){_0x41c6ac[_0x7c61('0x1f')]=qs[_0x7c61('0x1f')](_0x1ce3a6['query']['limit']);_0x41c6ac[_0x7c61('0x1c')]=qs[_0x7c61('0x1c')](_0x1ce3a6[_0x7c61('0x30')][_0x7c61('0x1c')]);}_0x41c6ac[_0x7c61('0x38')]=qs[_0x7c61('0x39')](_0x1ce3a6[_0x7c61('0x30')][_0x7c61('0x39')]);_0x41c6ac[_0x7c61('0x3a')]=qs[_0x7c61('0x3b')](_['pick'](_0x1ce3a6[_0x7c61('0x30')],_0x506599[_0x7c61('0x3b')]),_0x574068);if(_0x1ce3a6[_0x7c61('0x30')][_0x7c61('0x3c')]){_0x41c6ac[_0x7c61('0x3a')]=_[_0x7c61('0x3d')](_0x41c6ac['where'],{'$or':_[_0x7c61('0x2f')](_0x574068,function(_0x3be901){if(_0x3be901[_0x7c61('0x2d')]!==_0x7c61('0x3e')){var _0xae690d={};_0xae690d[_0x3be901[_0x7c61('0x28')]]={'$like':'%'+_0x1ce3a6[_0x7c61('0x30')][_0x7c61('0x3c')]+'%'};return _0xae690d;}})});}_0x41c6ac=_['merge']({},_0x41c6ac,_0x1ce3a6[_0x7c61('0x3f')]);var _0x1f45ac={'where':_0x41c6ac[_0x7c61('0x3a')]};return db[_0x7c61('0x2b')][_0x7c61('0x1e')](_0x1f45ac)['then'](function(_0x12c1a8){_0x3be6d5[_0x7c61('0x1e')]=_0x12c1a8;if(_0x1ce3a6[_0x7c61('0x30')][_0x7c61('0x40')]){_0x41c6ac[_0x7c61('0x41')]=[{'all':!![]}];}return db[_0x7c61('0x2b')][_0x7c61('0x42')](_0x41c6ac);})['then'](function(_0x1f979a){_0x3be6d5[_0x7c61('0x43')]=_0x1f979a;return _0x3be6d5;})['then'](respondWithFilteredResult(_0x3627c9,_0x41c6ac))[_0x7c61('0x44')](handleError(_0x3627c9,null));};exports[_0x7c61('0x45')]=function(_0x59d7f5,_0x37c4e6){var _0x3142dd={'raw':!![],'where':{'id':_0x59d7f5[_0x7c61('0x46')]['id']}},_0x59b170={};_0x59b170[_0x7c61('0x33')]=_[_0x7c61('0x31')](db[_0x7c61('0x2b')]['rawAttributes']);_0x59b170[_0x7c61('0x30')]=_[_0x7c61('0x31')](_0x59d7f5[_0x7c61('0x30')]);_0x59b170[_0x7c61('0x3b')]=_['intersection'](_0x59b170[_0x7c61('0x33')],_0x59b170[_0x7c61('0x30')]);_0x3142dd[_0x7c61('0x34')]=_[_0x7c61('0x32')](_0x59b170[_0x7c61('0x33')],qs[_0x7c61('0x35')](_0x59d7f5[_0x7c61('0x30')][_0x7c61('0x35')]));_0x3142dd[_0x7c61('0x34')]=_0x3142dd[_0x7c61('0x34')]['length']?_0x3142dd[_0x7c61('0x34')]:_0x59b170[_0x7c61('0x33')];if(_0x59d7f5[_0x7c61('0x30')][_0x7c61('0x40')]){_0x3142dd[_0x7c61('0x41')]=[{'all':!![]}];}_0x3142dd=_[_0x7c61('0x3d')]({},_0x3142dd,_0x59d7f5['options']);return db['VoiceQueuesLog']['find'](_0x3142dd)['then'](handleEntityNotFound(_0x37c4e6,null))['then'](respondWithResult(_0x37c4e6,null))[_0x7c61('0x44')](handleError(_0x37c4e6,null));};exports[_0x7c61('0x47')]=function(_0x52e0cc,_0x3ae790){return db[_0x7c61('0x2b')][_0x7c61('0x47')](_0x52e0cc['body'],{})[_0x7c61('0x24')](respondWithResult(_0x3ae790,0xc9))[_0x7c61('0x44')](handleError(_0x3ae790,null));};exports[_0x7c61('0x48')]=function(_0x4abe9a,_0x36290a){if(_0x4abe9a['body']['id']){delete _0x4abe9a[_0x7c61('0x49')]['id'];}return db['VoiceQueuesLog']['find']({'where':{'id':_0x4abe9a[_0x7c61('0x46')]['id']}})[_0x7c61('0x24')](handleEntityNotFound(_0x36290a,null))[_0x7c61('0x24')](saveUpdates(_0x4abe9a[_0x7c61('0x49')],null))[_0x7c61('0x24')](respondWithResult(_0x36290a,null))['catch'](handleError(_0x36290a,null));};exports['destroy']=function(_0x194073,_0x3c8052){return db['VoiceQueuesLog'][_0x7c61('0x4a')]({'where':{'id':_0x194073[_0x7c61('0x46')]['id']}})[_0x7c61('0x24')](handleEntityNotFound(_0x3c8052,null))[_0x7c61('0x24')](removeEntity(_0x3c8052,null))[_0x7c61('0x44')](handleError(_0x3c8052,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index fd7a615..c6f56c3 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 _0xeac6=['bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueuesLog.attributes','exports','define','VoiceQueuesLog','event_dtm','lodash','util','../../config/logger','moment'];(function(_0xa4616b,_0x4ff22b){var _0x6891f9=function(_0x3bf874){while(--_0x3bf874){_0xa4616b['push'](_0xa4616b['shift']());}};_0x6891f9(++_0x4ff22b);}(_0xeac6,0xc0));var _0x6eac=function(_0x37cb9a,_0x538b72){_0x37cb9a=_0x37cb9a-0x0;var _0x352f45=_0xeac6[_0x37cb9a];return _0x352f45;};'use strict';var _=require(_0x6eac('0x0'));var util=require(_0x6eac('0x1'));var logger=require(_0x6eac('0x2'))('api');var moment=require(_0x6eac('0x3'));var BPromise=require(_0x6eac('0x4'));var rp=require(_0x6eac('0x5'));var fs=require('fs');var path=require(_0x6eac('0x6'));var rimraf=require(_0x6eac('0x7'));var config=require(_0x6eac('0x8'));var attributes=require(_0x6eac('0x9'));module[_0x6eac('0xa')]=function(_0xebef33,_0x429b19){return _0xebef33[_0x6eac('0xb')](_0x6eac('0xc'),attributes,{'tableName':'voice_queues_log','paranoid':![],'indexes':[{'name':_0x6eac('0xd'),'fields':['event','dtm']}],'timestamps':![]});}; \ No newline at end of file +var _0x6b8f=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./voiceQueuesLog.attributes','dtm'];(function(_0x309486,_0xf91589){var _0x4e4d93=function(_0x479ee2){while(--_0x479ee2){_0x309486['push'](_0x309486['shift']());}};_0x4e4d93(++_0xf91589);}(_0x6b8f,0x1d6));var _0xf6b8=function(_0x5f1218,_0xef392f){_0x5f1218=_0x5f1218-0x0;var _0x5a9971=_0x6b8f[_0x5f1218];return _0x5a9971;};'use strict';var _=require(_0xf6b8('0x0'));var util=require(_0xf6b8('0x1'));var logger=require(_0xf6b8('0x2'))('api');var moment=require(_0xf6b8('0x3'));var BPromise=require(_0xf6b8('0x4'));var rp=require(_0xf6b8('0x5'));var fs=require('fs');var path=require(_0xf6b8('0x6'));var rimraf=require('rimraf');var config=require(_0xf6b8('0x7'));var attributes=require(_0xf6b8('0x8'));module['exports']=function(_0x5f5199,_0x1ece4c){return _0x5f5199['define']('VoiceQueuesLog',attributes,{'tableName':'voice_queues_log','paranoid':![],'indexes':[{'name':'event_dtm','fields':['event',_0xf6b8('0x9')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index da1af04..e5ae3cc 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 _0xff2e=['moment','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','error','code','VoiceQueuesLog,\x20%s,\x20%s','message','info','result'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xff2e,0x198));var _0xeff2=function(_0x38b515,_0x1296d1){_0x38b515=_0x38b515-0x0;var _0x443566=_0xff2e[_0x38b515];return _0x443566;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xeff2('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xeff2('0x1'));var db=require(_0xeff2('0x2'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xeff2('0x3'));var jayson=require(_0xeff2('0x4'));var client=jayson[_0xeff2('0x5')][_0xeff2('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x57700a,_0x27e51c,_0x3722d5){return new BPromise(function(_0x1cc523,_0x21a078){return client[_0xeff2('0x7')](_0x57700a,_0x3722d5)[_0xeff2('0x8')](function(_0x521a72){logger['info']('VoiceQueuesLog,\x20%s,\x20%s',_0x27e51c,_0xeff2('0x9'));logger[_0xeff2('0xa')]('VoiceQueuesLog,\x20%s,\x20%s,\x20%s',_0x27e51c,_0xeff2('0x9'),JSON['stringify'](_0x521a72));if(_0x521a72[_0xeff2('0xb')]){if(_0x521a72['error'][_0xeff2('0xc')]===0x1f4){logger['error'](_0xeff2('0xd'),_0x27e51c,_0x521a72[_0xeff2('0xb')][_0xeff2('0xe')]);return _0x21a078(_0x521a72['error'][_0xeff2('0xe')]);}logger[_0xeff2('0xb')](_0xeff2('0xd'),_0x27e51c,_0x521a72[_0xeff2('0xb')][_0xeff2('0xe')]);return _0x1cc523(_0x521a72['error'][_0xeff2('0xe')]);}else{logger[_0xeff2('0xf')](_0xeff2('0xd'),_0x27e51c,'request\x20sent');_0x1cc523(_0x521a72[_0xeff2('0x10')][_0xeff2('0xe')]);}})['catch'](function(_0xa43606){logger['error'](_0xeff2('0xd'),_0x27e51c,_0xa43606);_0x21a078(_0xa43606);});});} \ No newline at end of file +var _0x0434=['../../config/environment','jayson/promise','client','request','then','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc'];(function(_0x15f3c0,_0x165a64){var _0x1adfe0=function(_0x212cfc){while(--_0x212cfc){_0x15f3c0['push'](_0x15f3c0['shift']());}};_0x1adfe0(++_0x165a64);}(_0x0434,0x1ad));var _0x4043=function(_0x2a5099,_0x329e92){_0x2a5099=_0x2a5099-0x0;var _0x2802f1=_0x0434[_0x2a5099];return _0x2802f1;};'use strict';var _=require(_0x4043('0x0'));var util=require(_0x4043('0x1'));var moment=require(_0x4043('0x2'));var BPromise=require(_0x4043('0x3'));var rs=require(_0x4043('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x4043('0x5'));var logger=require(_0x4043('0x6'))(_0x4043('0x7'));var config=require(_0x4043('0x8'));var jayson=require(_0x4043('0x9'));var client=jayson[_0x4043('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x41d0a9,_0x1ed6c4,_0x5080e5){return new BPromise(function(_0x56355c,_0x14694d){return client[_0x4043('0xb')](_0x41d0a9,_0x5080e5)[_0x4043('0xc')](function(_0x31cb1f){logger[_0x4043('0xd')](_0x4043('0xe'),_0x1ed6c4,_0x4043('0xf'));logger[_0x4043('0x10')]('VoiceQueuesLog,\x20%s,\x20%s,\x20%s',_0x1ed6c4,_0x4043('0xf'),JSON[_0x4043('0x11')](_0x31cb1f));if(_0x31cb1f[_0x4043('0x12')]){if(_0x31cb1f[_0x4043('0x12')][_0x4043('0x13')]===0x1f4){logger['error'](_0x4043('0xe'),_0x1ed6c4,_0x31cb1f[_0x4043('0x12')][_0x4043('0x14')]);return _0x14694d(_0x31cb1f[_0x4043('0x12')][_0x4043('0x14')]);}logger['error'](_0x4043('0xe'),_0x1ed6c4,_0x31cb1f[_0x4043('0x12')][_0x4043('0x14')]);return _0x56355c(_0x31cb1f[_0x4043('0x12')][_0x4043('0x14')]);}else{logger[_0x4043('0xd')](_0x4043('0xe'),_0x1ed6c4,_0x4043('0xf'));_0x56355c(_0x31cb1f[_0x4043('0x15')][_0x4043('0x14')]);}})[_0x4043('0x16')](function(_0x38aefa){logger['error'](_0x4043('0xe'),_0x1ed6c4,_0x38aefa);_0x14694d(_0x38aefa);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index 09fc138..40eace0 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 _0xdb18=['/:id/downloads','downloads','/:id/transcribe','downloadTranscribe','post','runTranscribe','put','update','delete','destroy','multer','connect-timeout','express','../../components/interaction/service','../../config/environment','./voiceRecording.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/download','download'];(function(_0x47a385,_0x5d8781){var _0x31abb9=function(_0x210f7a){while(--_0x210f7a){_0x47a385['push'](_0x47a385['shift']());}};_0x31abb9(++_0x5d8781);}(_0xdb18,0x1ba));var _0x8db1=function(_0x253cd7,_0x3bf005){_0x253cd7=_0x253cd7-0x0;var _0x15c533=_0xdb18[_0x253cd7];return _0x15c533;};'use strict';var multer=require(_0x8db1('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x8db1('0x1'));var express=require(_0x8db1('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x8db1('0x3'));var config=require(_0x8db1('0x4'));var controller=require(_0x8db1('0x5'));router[_0x8db1('0x6')]('/',auth[_0x8db1('0x7')](),controller['index']);router['get'](_0x8db1('0x8'),auth[_0x8db1('0x7')](),controller[_0x8db1('0x9')]);router['get'](_0x8db1('0xa'),auth['isAuthenticated'](),controller[_0x8db1('0xb')]);router[_0x8db1('0x6')](_0x8db1('0xc'),auth[_0x8db1('0x7')](),controller[_0x8db1('0xd')]);router['get'](_0x8db1('0xe'),controller[_0x8db1('0xf')]);router['get'](_0x8db1('0x10'),auth[_0x8db1('0x7')](),controller[_0x8db1('0x11')]);router['post']('/',auth[_0x8db1('0x7')](),controller['create']);router[_0x8db1('0x12')](_0x8db1('0x10'),auth['isAuthenticated'](),controller[_0x8db1('0x13')]);router[_0x8db1('0x14')](_0x8db1('0xa'),auth[_0x8db1('0x7')](),controller[_0x8db1('0x15')]);router[_0x8db1('0x16')](_0x8db1('0xa'),auth[_0x8db1('0x7')](),controller[_0x8db1('0x17')]);module['exports']=router; \ No newline at end of file +var _0xb948=['update','delete','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceRecording.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/download','download','/:id/downloads','/:id/transcribe','runTranscribe','put'];(function(_0x55b9f2,_0x2cc49a){var _0x2d8b05=function(_0x153fab){while(--_0x153fab){_0x55b9f2['push'](_0x55b9f2['shift']());}};_0x2d8b05(++_0x2cc49a);}(_0xb948,0xb2));var _0x8b94=function(_0x25fded,_0x34216e){_0x25fded=_0x25fded-0x0;var _0x269156=_0xb948[_0x25fded];return _0x269156;};'use strict';var multer=require(_0x8b94('0x0'));var util=require(_0x8b94('0x1'));var path=require('path');var timeout=require(_0x8b94('0x2'));var express=require(_0x8b94('0x3'));var router=express[_0x8b94('0x4')]();var fs_extra=require(_0x8b94('0x5'));var auth=require(_0x8b94('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x8b94('0x7'));var controller=require(_0x8b94('0x8'));router[_0x8b94('0x9')]('/',auth[_0x8b94('0xa')](),controller[_0x8b94('0xb')]);router[_0x8b94('0x9')](_0x8b94('0xc'),auth[_0x8b94('0xa')](),controller[_0x8b94('0xd')]);router['get'](_0x8b94('0xe'),auth[_0x8b94('0xa')](),controller[_0x8b94('0xf')]);router[_0x8b94('0x9')](_0x8b94('0x10'),auth[_0x8b94('0xa')](),controller[_0x8b94('0x11')]);router[_0x8b94('0x9')](_0x8b94('0x12'),controller['downloads']);router[_0x8b94('0x9')](_0x8b94('0x13'),auth[_0x8b94('0xa')](),controller['downloadTranscribe']);router['post']('/',auth['isAuthenticated'](),controller['create']);router['post'](_0x8b94('0x13'),auth[_0x8b94('0xa')](),controller[_0x8b94('0x14')]);router[_0x8b94('0x15')](_0x8b94('0xe'),auth['isAuthenticated'](),controller[_0x8b94('0x16')]);router[_0x8b94('0x17')](_0x8b94('0xe'),auth['isAuthenticated'](),controller[_0x8b94('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index 63242f0..840779d 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(_0x341e0f,_0x4a09d0){var _0x59555a=function(_0x4343a8){while(--_0x4343a8){_0x341e0f['push'](_0x341e0f['shift']());}};_0x59555a(++_0x4a09d0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37c22c,_0x28a70d){_0x37c22c=_0x37c22c-0x0;var _0x119d79=_0xa9e0[_0x37c22c];return _0x119d79;};'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(_0x243b2f,_0x30aa15){var _0xcb3c2d=function(_0x213bb2){while(--_0x213bb2){_0x243b2f['push'](_0x243b2f['shift']());}};_0xcb3c2d(++_0x30aa15);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1cfa0d,_0x4391f2){_0x1cfa0d=_0x1cfa0d-0x0;var _0xe33279=_0xa9e0[_0x1cfa0d];return _0xe33279;};'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 af87722..ddf1b70 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 _0x26d1=['error','stack','name','send','index','map','rawAttributes','type','model','differenceBy','format','query','keys','filters','intersection','attributes','fields','nolimit','offset','order','sort','filter','where','VIRTUAL','VoiceRecording','includeAll','findAll','show','params','length','include','merge','options','catch','create','body','find','describe','../../components/encryptor','uniqueid','value','decryptFile','secrets','recording','Sequelize','download','filename','extname','unlink','VoiceRecording\x20not\x20found','Not\x20found','downloads','sequelize','MD5','token','$and','push','%s.cypher','existsSync','isNil','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','listBuckets','createBucket','upload','TranscribeService','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','Bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJobName','transcribeName','TranscriptionJob','transcribeStatus','TranscriptionJobStatus','runTranscribe','findOne','ValidationError','transcribe','transcribeRegion','language','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentAccountId','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','transcribeAccountId','Cloud\x20Provider\x20not\x20available','data1','Cloud\x20Provider\x20not\x20configured','data2','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','tempSentiment','updateAttributes','fileText','/server/files/transcribes/transcribe_','.txt','Transcript\x20not\x20available','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','aws-sdk','uuid/v4','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','set','Content-Range','reject','save','update','destroy','then'];(function(_0x1241d9,_0x5becf6){var _0x43ce83=function(_0x296e6a){while(--_0x296e6a){_0x1241d9['push'](_0x1241d9['shift']());}};_0x43ce83(++_0x5becf6);}(_0x26d1,0x1a6));var _0x126d=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x26d1[_0x413feb];return _0x40ee88;};'use strict';var emlformat=require(_0x126d('0x0'));var rimraf=require(_0x126d('0x1'));var zipdir=require(_0x126d('0x2'));var jsonpatch=require(_0x126d('0x3'));var rp=require(_0x126d('0x4'));var moment=require(_0x126d('0x5'));var BPromise=require(_0x126d('0x6'));var Mustache=require(_0x126d('0x7'));var util=require('util');var path=require(_0x126d('0x8'));var sox=require(_0x126d('0x9'));var csv=require(_0x126d('0xa'));var ejs=require(_0x126d('0xb'));var fs=require('fs');var fs_extra=require(_0x126d('0xc'));var _=require('lodash');var squel=require(_0x126d('0xd'));var crypto=require(_0x126d('0xe'));var jsforce=require(_0x126d('0xf'));var deskjs=require(_0x126d('0x10'));var toCsv=require('to-csv');var querystring=require(_0x126d('0x11'));var Papa=require('papaparse');var AWS=require(_0x126d('0x12'));var uuidv4=require(_0x126d('0x13'));var Redis=require(_0x126d('0x14'));var authService=require(_0x126d('0x15'));var qs=require('../../components/parsers/qs');var as=require(_0x126d('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x126d('0x17'))(_0x126d('0x18'));var utils=require(_0x126d('0x19'));var config=require(_0x126d('0x1a'));var licenseUtil=require(_0x126d('0x1b'));var db=require(_0x126d('0x1c'))['db'];function respondWithStatusCode(_0x244757,_0x22fb63){_0x22fb63=_0x22fb63||0xcc;return function(_0x32b5b8){if(_0x32b5b8){return _0x244757[_0x126d('0x1d')](_0x22fb63);}return _0x244757[_0x126d('0x1e')](_0x22fb63)[_0x126d('0x1f')]();};}function respondWithResult(_0xee0e43,_0x43afe2){_0x43afe2=_0x43afe2||0xc8;return function(_0x53b4d9){if(_0x53b4d9){return _0xee0e43['status'](_0x43afe2)[_0x126d('0x20')](_0x53b4d9);}};}function respondWithFilteredResult(_0x7e6d96,_0x444f93){return function(_0x119ef8){if(_0x119ef8){var _0x3317ff=typeof _0x444f93['offset']===_0x126d('0x21')&&typeof _0x444f93[_0x126d('0x22')]===_0x126d('0x21');var _0xb263e5=_0x119ef8[_0x126d('0x23')];var _0x13fc46=_0x3317ff?0x0:_0x444f93['offset'];var _0x1082c6=_0x3317ff?_0x119ef8[_0x126d('0x23')]:_0x444f93['offset']+_0x444f93['limit'];var _0x44fed4;if(_0x1082c6>=_0xb263e5){_0x1082c6=_0xb263e5;_0x44fed4=0xc8;}else{_0x44fed4=0xce;}_0x7e6d96[_0x126d('0x1e')](_0x44fed4);return _0x7e6d96[_0x126d('0x24')](_0x126d('0x25'),_0x13fc46+'-'+_0x1082c6+'/'+_0xb263e5)[_0x126d('0x20')](_0x119ef8);}return null;};}function patchUpdates(_0x84e334){return function(_0x1085a2){try{jsonpatch['apply'](_0x1085a2,_0x84e334,!![]);}catch(_0x2f75ff){return BPromise[_0x126d('0x26')](_0x2f75ff);}return _0x1085a2[_0x126d('0x27')]();};}function saveUpdates(_0x443b60,_0x597386){return function(_0x1a133f){if(_0x1a133f){return _0x1a133f[_0x126d('0x28')](_0x443b60)['then'](function(_0x550fff){return _0x550fff;});}return null;};}function removeEntity(_0x469f6c,_0x50e751){return function(_0x416fe2){if(_0x416fe2){return _0x416fe2[_0x126d('0x29')]()[_0x126d('0x2a')](function(){_0x469f6c['status'](0xcc)[_0x126d('0x1f')]();});}};}function handleEntityNotFound(_0x3c6008,_0xb0667f){return function(_0x5662e3){if(!_0x5662e3){_0x3c6008['sendStatus'](0x194);}return _0x5662e3;};}function handleError(_0x3b87c4,_0x1bc656){_0x1bc656=_0x1bc656||0x1f4;return function(_0x281ba9){logger[_0x126d('0x2b')](_0x281ba9[_0x126d('0x2c')]);if(_0x281ba9[_0x126d('0x2d')]){delete _0x281ba9['name'];}_0x3b87c4['status'](_0x1bc656)[_0x126d('0x2e')](_0x281ba9);};}exports[_0x126d('0x2f')]=function(_0x88886a,_0x5ae7d2){var _0x180ae3={},_0x54678f={},_0x4e1599={'count':0x0,'rows':[]};var _0x4125d7=_[_0x126d('0x30')](db['VoiceRecording'][_0x126d('0x31')],function(_0x4b91af){return{'name':_0x4b91af['fieldName'],'type':_0x4b91af[_0x126d('0x32')]['key']};});_0x54678f[_0x126d('0x33')]=_[_0x126d('0x34')](_['map'](_0x4125d7,_0x126d('0x2d')),[_0x126d('0x35')]);_0x54678f[_0x126d('0x36')]=_[_0x126d('0x37')](_0x88886a['query']);_0x54678f[_0x126d('0x38')]=_[_0x126d('0x39')](_0x54678f[_0x126d('0x33')],_0x54678f['query']);_0x180ae3[_0x126d('0x3a')]=_[_0x126d('0x39')](_0x54678f['model'],qs[_0x126d('0x3b')](_0x88886a['query']['fields']));_0x180ae3[_0x126d('0x3a')]=_0x180ae3[_0x126d('0x3a')]['length']?_0x180ae3['attributes']:_0x54678f[_0x126d('0x33')];if(!_0x88886a[_0x126d('0x36')]['hasOwnProperty'](_0x126d('0x3c'))){_0x180ae3['limit']=qs[_0x126d('0x22')](_0x88886a[_0x126d('0x36')][_0x126d('0x22')]);_0x180ae3[_0x126d('0x3d')]=qs[_0x126d('0x3d')](_0x88886a['query'][_0x126d('0x3d')]);}_0x180ae3[_0x126d('0x3e')]=qs[_0x126d('0x3f')](_0x88886a[_0x126d('0x36')][_0x126d('0x3f')]);_0x180ae3['where']=qs[_0x126d('0x38')](_['pick'](_0x88886a[_0x126d('0x36')],_0x54678f[_0x126d('0x38')]),_0x4125d7);if(_0x88886a[_0x126d('0x36')][_0x126d('0x40')]){_0x180ae3[_0x126d('0x41')]=_['merge'](_0x180ae3[_0x126d('0x41')],{'$or':_[_0x126d('0x30')](_0x4125d7,function(_0x23b9ea){if(_0x23b9ea[_0x126d('0x32')]!==_0x126d('0x42')){var _0x1145db={};_0x1145db[_0x23b9ea[_0x126d('0x2d')]]={'$like':'%'+_0x88886a['query']['filter']+'%'};return _0x1145db;}})});}_0x180ae3=_['merge']({},_0x180ae3,_0x88886a['options']);var _0x85ab26={'where':_0x180ae3[_0x126d('0x41')]};return db[_0x126d('0x43')][_0x126d('0x23')](_0x85ab26)[_0x126d('0x2a')](function(_0xdaf6f9){_0x4e1599['count']=_0xdaf6f9;if(_0x88886a['query'][_0x126d('0x44')]){_0x180ae3['include']=[{'all':!![]}];}return db[_0x126d('0x43')][_0x126d('0x45')](_0x180ae3);})[_0x126d('0x2a')](function(_0x531228){_0x4e1599['rows']=_0x531228;return _0x4e1599;})[_0x126d('0x2a')](respondWithFilteredResult(_0x5ae7d2,_0x180ae3))['catch'](handleError(_0x5ae7d2,null));};exports[_0x126d('0x46')]=function(_0x1fed10,_0x4559d7){var _0xf06f34={'raw':![],'where':{'id':_0x1fed10[_0x126d('0x47')]['id']}},_0x364593={};_0x364593['model']=_[_0x126d('0x37')](db[_0x126d('0x43')][_0x126d('0x31')]);_0x364593[_0x126d('0x36')]=_[_0x126d('0x37')](_0x1fed10['query']);_0x364593['filters']=_[_0x126d('0x39')](_0x364593[_0x126d('0x33')],_0x364593[_0x126d('0x36')]);_0xf06f34['attributes']=_[_0x126d('0x39')](_0x364593[_0x126d('0x33')],qs[_0x126d('0x3b')](_0x1fed10[_0x126d('0x36')][_0x126d('0x3b')]));_0xf06f34['attributes']=_0xf06f34[_0x126d('0x3a')][_0x126d('0x48')]?_0xf06f34[_0x126d('0x3a')]:_0x364593[_0x126d('0x33')];if(_0x1fed10[_0x126d('0x36')][_0x126d('0x44')]){_0xf06f34[_0x126d('0x49')]=[{'all':!![]}];}_0xf06f34=_[_0x126d('0x4a')]({},_0xf06f34,_0x1fed10[_0x126d('0x4b')]);return db[_0x126d('0x43')]['find'](_0xf06f34)['then'](handleEntityNotFound(_0x4559d7,null))[_0x126d('0x2a')](respondWithResult(_0x4559d7,null))[_0x126d('0x4c')](handleError(_0x4559d7,null));};exports[_0x126d('0x4d')]=function(_0x3f43a7,_0xd93d64){return db[_0x126d('0x43')][_0x126d('0x4d')](_0x3f43a7[_0x126d('0x4e')],{})['then'](respondWithResult(_0xd93d64,0xc9))[_0x126d('0x4c')](handleError(_0xd93d64,null));};exports['update']=function(_0x550c63,_0x3b169b){if(_0x550c63[_0x126d('0x4e')]['id']){delete _0x550c63[_0x126d('0x4e')]['id'];}return db[_0x126d('0x43')][_0x126d('0x4f')]({'where':{'id':_0x550c63['params']['id']}})[_0x126d('0x2a')](handleEntityNotFound(_0x3b169b,null))[_0x126d('0x2a')](saveUpdates(_0x550c63['body'],null))[_0x126d('0x2a')](respondWithResult(_0x3b169b,null))['catch'](handleError(_0x3b169b,null));};exports[_0x126d('0x50')]=function(_0x5a9f19,_0x32d9e7){return db[_0x126d('0x43')][_0x126d('0x50')]()[_0x126d('0x2a')](respondWithResult(_0x32d9e7,null))['catch'](handleError(_0x32d9e7,null));};exports['download']=function(_0x4d0442,_0x9ef430,_0x3502c1){var _0x22d341=require(_0x126d('0x51'));var _0x4f35e1=![];var _0x118b42={};if(_0x4d0442[_0x126d('0x36')][_0x126d('0x32')]&&_0x4d0442[_0x126d('0x36')][_0x126d('0x32')]===_0x126d('0x52')){_0x118b42[_0x126d('0x52')]=_0x4d0442[_0x126d('0x47')]['id'];}else{_0x118b42['id']=_0x4d0442[_0x126d('0x47')]['id'];}return db[_0x126d('0x43')][_0x126d('0x4f')]({'where':_0x118b42,'attributes':['id','value'],'raw':!![]})[_0x126d('0x2a')](handleEntityNotFound(_0x9ef430,null))[_0x126d('0x2a')](function(_0x4f480b){if(_0x4f480b){var _0x4129bc=_0x4f480b[_0x126d('0x53')];var _0x555852=util[_0x126d('0x35')]('%s.cypher',_0x4129bc);if(fs['existsSync'](_0x555852)){_0x4f35e1=!![];return _0x22d341[_0x126d('0x54')](_0x555852,_0x4129bc,config[_0x126d('0x55')][_0x126d('0x56')])[_0x126d('0x2a')](function(){return _0x4f480b;});}return _0x4f480b;}})[_0x126d('0x2a')](function(_0x420a7a){if(_0x420a7a){var _0x2bcf5d=_0x420a7a['value'];if(!fs['existsSync'](_0x2bcf5d)){throw new db[(_0x126d('0x57'))]['ValidationError']('VoiceRecording\x20not\x20found');}if(_0x420a7a['filename']){return _0x9ef430[_0x126d('0x58')](_0x2bcf5d,_0x420a7a[_0x126d('0x59')]+path[_0x126d('0x5a')](_0x2bcf5d),function(){if(_0x4f35e1){fs[_0x126d('0x5b')](_0x2bcf5d);}});}else{return _0x9ef430[_0x126d('0x58')](_0x2bcf5d,function(_0x3af768){if(_0x4f35e1){fs[_0x126d('0x5b')](_0x2bcf5d);}});}}})['catch'](function(_0xf9b03f){if(_0xf9b03f['message']===_0x126d('0x5c')){_0x9ef430['status'](0x194)['send'](_0x126d('0x5d'));}else{return handleError(_0x9ef430,null);}});};exports[_0x126d('0x5e')]=function(_0x39b58f,_0x56e99b,_0x54bab2){var _0x590175=require(_0x126d('0x51'));var _0x30818d=![];var _0x2e68c0={'$and':[db['sequelize'][_0x126d('0x41')](db[_0x126d('0x5f')]['fn'](_0x126d('0x60'),db[_0x126d('0x5f')]['col'](_0x126d('0x52'))),_0x39b58f[_0x126d('0x36')][_0x126d('0x61')])]};if(_0x39b58f['query'][_0x126d('0x32')]&&_0x39b58f[_0x126d('0x36')][_0x126d('0x32')]===_0x126d('0x52')){_0x2e68c0[_0x126d('0x62')][_0x126d('0x63')]({'uniqueid':_0x39b58f[_0x126d('0x47')]['id']});}else{_0x2e68c0[_0x126d('0x62')][_0x126d('0x63')]({'id':_0x39b58f[_0x126d('0x47')]['id']});}return db['VoiceRecording']['find']({'where':_0x2e68c0,'attributes':['id',_0x126d('0x53')],'raw':!![]})[_0x126d('0x2a')](handleEntityNotFound(_0x56e99b,null))[_0x126d('0x2a')](function(_0x41b3a0){if(_0x41b3a0){var _0x27e833=util['format'](_0x126d('0x64'),_0x41b3a0[_0x126d('0x53')]);if(fs[_0x126d('0x65')](_0x27e833)){_0x30818d=!![];return _0x590175[_0x126d('0x54')](_0x27e833,_0x41b3a0[_0x126d('0x53')],config[_0x126d('0x55')]['recording'])[_0x126d('0x2a')](function(){return _0x41b3a0;});}return _0x41b3a0;}})['then'](function(_0x784582){if(_0x784582){if(!fs[_0x126d('0x65')](_0x784582[_0x126d('0x53')])){throw new db[(_0x126d('0x57'))]['ValidationError']('VoiceRecording\x20not\x20found');}if(_0x784582['filename']){return _0x56e99b[_0x126d('0x58')](_0x784582['value'],_0x784582[_0x126d('0x59')]+path[_0x126d('0x5a')](_0x784582['value']),function(){if(_0x30818d){fs[_0x126d('0x5b')](_0x784582['value']);}});}else{return _0x56e99b[_0x126d('0x58')](_0x784582[_0x126d('0x53')],function(_0x2646d4){if(_0x30818d){fs['unlink'](_0x784582[_0x126d('0x53')]);}});}}})[_0x126d('0x4c')](handleError(_0x56e99b,null));};exports[_0x126d('0x29')]=function(_0x1e2881,_0x42d978){return db[_0x126d('0x43')][_0x126d('0x4f')]({'where':{'id':_0x1e2881[_0x126d('0x47')]['id']}})[_0x126d('0x2a')](function(_0x11adc2){if(_[_0x126d('0x66')](_0x11adc2)){throw new ReferenceError('Entity\x20not\x20found');}return _0x11adc2;})[_0x126d('0x2a')](function(_0x4f89bc){var _0x870a96=_0x4f89bc[_0x126d('0x53')];logger[_0x126d('0x67')](_0x126d('0x68'),_0x870a96);if(!_[_0x126d('0x66')](_0x4f89bc[_0x126d('0x53')])&&fs[_0x126d('0x65')](_0x870a96)){logger[_0x126d('0x67')](_0x126d('0x69')+_0x870a96+_0x126d('0x6a'));fs[_0x126d('0x6b')](_0x870a96);}_0x870a96=_0x870a96+'.cypher';if(!_[_0x126d('0x66')](_0x4f89bc[_0x126d('0x53')])&&fs['existsSync'](_0x870a96)){logger[_0x126d('0x67')]('File:\x20\x22'+_0x870a96+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x126d('0x6b')](_0x870a96);}return _0x4f89bc;})[_0x126d('0x2a')](function(_0xbf5f1c){if(!_0xbf5f1c)throw new InternalError();return _0xbf5f1c[_0x126d('0x29')]();})[_0x126d('0x2a')](function(){_0x42d978[_0x126d('0x1e')](0xcc)[_0x126d('0x1f')]();})[_0x126d('0x4c')](handleError(_0x42d978,null));};function getBucketslist(_0x56fb2a,_0x36537a,_0x24877a){return new Promise(function(_0x57bbd9,_0x27f6fd){var _0x3ddc75=new AWS['S3']({'accessKeyId':_0x36537a,'secretAccessKey':_0x56fb2a,'region':_0x24877a});_0x3ddc75[_0x126d('0x6c')]({},function(_0x53e2d8,_0x247155){if(_0x53e2d8){return _0x27f6fd(_0x53e2d8);}else{return _0x57bbd9(_0x247155);}});});}function createBucket(_0x32d346,_0x4afe28,_0x15a4b9,_0x23bdd2){return new Promise(function(_0x35760f,_0x334197){var _0x1e022e=new AWS['S3']({'accessKeyId':_0x4afe28,'secretAccessKey':_0x32d346,'region':_0x15a4b9});_0x1e022e[_0x126d('0x6d')]({'Bucket':_0x23bdd2},function(_0x24446a,_0x411ead){if(_0x24446a){return _0x334197(_0x24446a);}else{return _0x35760f(_0x411ead);}});});}function uploadFile(_0x4f1163,_0x202716,_0x5a2a65,_0x499461,_0x2702c2,_0x3d8ef7){return new Promise(function(_0x19e45e,_0x237d37){var _0x3ea072=new AWS['S3']({'accessKeyId':_0x202716,'secretAccessKey':_0x4f1163,'region':_0x5a2a65});_0x3ea072[_0x126d('0x6e')]({'Bucket':_0x499461,'Key':_0x2702c2,'Body':_0x3d8ef7},function(_0x36d4b4,_0x48028c){if(_0x36d4b4){return _0x237d37(_0x36d4b4);}else{return _0x19e45e(_0x48028c);}});});}function startTranscribe(_0xeeacb1,_0x449bc0,_0xc77312,_0x44e393,_0x163ade,_0x2c483b){return new Promise(function(_0xf70a3b,_0x1ae8e4){var _0x462db9=new AWS[(_0x126d('0x6f'))]({'accessKeyId':_0x449bc0,'secretAccessKey':_0xeeacb1,'region':_0xc77312});_0x462db9[_0x126d('0x70')]({'TranscriptionJobName':_0x44e393,'LanguageCode':_0x163ade,'Media':{'MediaFileUri':_0x2c483b}},function(_0xe11318,_0x2b9f64){if(_0xe11318){return _0x1ae8e4(_0xe11318);}else{return _0xf70a3b(_0x2b9f64);}});});}function transcribe(_0x5ce971,_0x375ac7,_0x259655,_0x5d601a,_0x39d5d5,_0x193927,_0x2043ed){return new Promise(function(_0x78b3a8,_0x4c1be8){var _0x42e3f2={};logger[_0x126d('0x67')](util[_0x126d('0x35')](_0x126d('0x71'),_0x5ce971,_0x39d5d5));return uploadFile(_0x375ac7,_0x259655,_0x5d601a,_0x39d5d5,path[_0x126d('0x72')](_0x193927),fs[_0x126d('0x73')](_0x193927))[_0x126d('0x2a')](function(_0x1ccdfe){logger['info'](util[_0x126d('0x35')](_0x126d('0x74'),_0x5ce971,_0x39d5d5,_0x1ccdfe[_0x126d('0x75')]));_0x42e3f2[_0x126d('0x76')]=_0x1ccdfe[_0x126d('0x77')];_0x42e3f2[_0x126d('0x78')]=_0x1ccdfe[_0x126d('0x75')];logger['info'](util[_0x126d('0x35')](_0x126d('0x79'),_0x5ce971));return startTranscribe(_0x375ac7,_0x259655,_0x5d601a,uuidv4(),_0x2043ed,_0x1ccdfe[_0x126d('0x75')]);})[_0x126d('0x2a')](function(_0x364c3f){logger['info'](util[_0x126d('0x35')](_0x126d('0x7a'),_0x5ce971,_0x364c3f['TranscriptionJob'][_0x126d('0x7b')]));_0x42e3f2[_0x126d('0x7c')]=_0x364c3f[_0x126d('0x7d')][_0x126d('0x7b')];_0x42e3f2[_0x126d('0x7e')]=_0x364c3f['TranscriptionJob'][_0x126d('0x7f')];return _0x78b3a8(_0x42e3f2);})[_0x126d('0x4c')](function(_0x94af84){return _0x4c1be8(_0x94af84);});});}exports[_0x126d('0x80')]=function(_0x276533,_0x502177,_0x458b5e){var _0x45bec3;var _0x2e94ba;var _0x3788c2;var _0x1cc5a7=require(_0x126d('0x51'));return db['VoiceRecording'][_0x126d('0x81')]({'where':{'id':_0x276533['params']['id']}})[_0x126d('0x2a')](function(_0x357e66){if(_0x357e66){var _0x4f8cb3=util['format'](_0x126d('0x64'),_0x357e66[_0x126d('0x53')]);if(fs[_0x126d('0x65')](_0x4f8cb3)){cypher=!![];return _0x1cc5a7[_0x126d('0x54')](_0x4f8cb3,_0x357e66[_0x126d('0x53')],config[_0x126d('0x55')][_0x126d('0x56')])['then'](function(){return _0x357e66;});}return _0x357e66;}})[_0x126d('0x2a')](function(_0x3f12ce){if(!_0x3f12ce){throw new db[(_0x126d('0x57'))][(_0x126d('0x82'))]('Voice\x20Recording\x20not\x20found');}_0x2e94ba=_0x3f12ce;return db['Setting'][_0x126d('0x81')]({'where':{'id':0x1}});})[_0x126d('0x2a')](handleEntityNotFound(_0x502177,null))[_0x126d('0x2a')](function(_0x54e434){if(_0x54e434){_0x45bec3=_0x54e434;if(!_0x45bec3[_0x126d('0x83')]||!_0x45bec3['transcribeAccountId']||!_0x45bec3[_0x126d('0x84')]||!_0x45bec3[_0x126d('0x85')]||!_0x45bec3[_0x126d('0x76')]){throw new db[(_0x126d('0x57'))][(_0x126d('0x82'))](_0x126d('0x86'));}if(_0x276533[_0x126d('0x4e')][_0x126d('0x87')]&&(!_0x45bec3[_0x126d('0x88')]||!_0x45bec3[_0x126d('0x89')]||!_0x45bec3[_0x126d('0x8a')]||!_0x45bec3[_0x126d('0x85')]||!_0x45bec3['bucket'])){throw new db[(_0x126d('0x57'))][(_0x126d('0x82'))](_0x126d('0x8b'));}return db[_0x126d('0x8c')][_0x126d('0x81')]({'where':{'id':_0x45bec3[_0x126d('0x8d')]}});}})['then'](function(_0x5ad318){if(!_0x5ad318){throw new db[(_0x126d('0x57'))][(_0x126d('0x82'))](_0x126d('0x8e'));}if(!_0x5ad318[_0x126d('0x8f')]||!_0x5ad318['data2']){throw new db[(_0x126d('0x57'))]['ValidationError'](_0x126d('0x90'));}_0x3788c2=_0x5ad318;return getBucketslist(_0x3788c2['data1'],_0x3788c2[_0x126d('0x91')],_0x45bec3[_0x126d('0x84')]);})[_0x126d('0x2a')](function(_0x355b5a){if(_0x355b5a&&_0x355b5a[_0x126d('0x92')]){var _0x3f2e5c=_[_0x126d('0x4f')](_0x355b5a[_0x126d('0x92')],function(_0x456998){return _0x456998[_0x126d('0x93')]===_0x45bec3[_0x126d('0x76')];});if(!_0x3f2e5c){logger[_0x126d('0x67')](util[_0x126d('0x35')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available',_0x276533['params']['id'],_0x45bec3[_0x126d('0x76')]));return createBucket(_0x3788c2[_0x126d('0x8f')],_0x3788c2[_0x126d('0x91')],_0x45bec3[_0x126d('0x84')],_0x45bec3[_0x126d('0x76')]);}logger[_0x126d('0x67')](util[_0x126d('0x35')](_0x126d('0x94'),_0x276533[_0x126d('0x47')]['id'],_0x45bec3['bucket']));return;}})[_0x126d('0x2a')](function(_0x6b4531){if(_0x2e94ba[_0x126d('0x7e')]==='NEW'){return transcribe(_0x276533[_0x126d('0x47')]['id'],_0x3788c2[_0x126d('0x8f')],_0x3788c2[_0x126d('0x91')],_0x45bec3[_0x126d('0x84')],_0x45bec3[_0x126d('0x76')],_0x2e94ba['value'],_0x45bec3[_0x126d('0x85')]);}else{logger[_0x126d('0x67')](util['format']('[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested',_0x276533[_0x126d('0x47')]['id']));return{'transcribeStatus':'IN_PROGRESS'};}})['then'](function(_0x5436fb){if(_0x5436fb){_0x5436fb[_0x126d('0x95')]=_0x276533[_0x126d('0x4e')][_0x126d('0x87')];return _0x2e94ba[_0x126d('0x96')](_0x5436fb);}})[_0x126d('0x2a')](respondWithResult(_0x502177,null))[_0x126d('0x4c')](handleError(_0x502177,null));};function writeFile(_0x1ae3f2,_0x46bc2e){return new Promise(function(_0x42e4dd,_0x599711){fs['writeFile'](_0x46bc2e,_0x1ae3f2,function(_0x31923e,_0x3878af){if(_0x31923e){return _0x599711(_0x31923e);}else{return _0x42e4dd(_0x3878af);}});});}exports['downloadTranscribe']=function(_0x5cf155,_0x4c71e7,_0x485a5b){return db[_0x126d('0x43')]['findOne']({'where':{'id':_0x5cf155[_0x126d('0x47')]['id']}})[_0x126d('0x2a')](handleEntityNotFound(_0x4c71e7))[_0x126d('0x2a')](function(_0x2558bf){if(_0x2558bf&&_0x2558bf[_0x126d('0x97')]){var _0x4f7d40=_0x2558bf[_0x126d('0x97')];var _0x3ad697=config['root']+_0x126d('0x98')+_0x2558bf['id']+_0x126d('0x99');if(fs[_0x126d('0x65')](_0x3ad697)){return _0x3ad697;}return writeFile(_0x4f7d40,_0x3ad697)[_0x126d('0x2a')](function(){return _0x3ad697;});}else{throw new db[(_0x126d('0x57'))]['ValidationError'](_0x126d('0x9a'));}})['then'](function(_0x14a67c){return _0x4c71e7[_0x126d('0x58')](_0x14a67c);})[_0x126d('0x4c')](handleError(_0x4c71e7));}; \ No newline at end of file +var _0x2c7b=['fileText','root','/server/files/transcribes/transcribe_','Transcript\x20not\x20available','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','aws-sdk','uuid/v4','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','VoiceRecording','rawAttributes','type','format','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','sort','where','filter','merge','options','includeAll','include','findAll','show','keys','catch','create','body','find','describe','../../components/encryptor','uniqueid','params','value','decryptFile','recording','Sequelize','download','filename','unlink','message','VoiceRecording\x20not\x20found','Not\x20found','downloads','sequelize','MD5','token','$and','push','%s.cypher','secrets','existsSync','ValidationError','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','unlinkSync','.cypher','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','listBuckets','createBucket','upload','TranscribeService','startTranscriptionJob','basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','bucket','Bucket','location','Location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeName','TranscriptionJobStatus','runTranscribe','findOne','Voice\x20Recording\x20not\x20found','transcribe','transcribeAccountId','transcribeRegion','language','Transcribe\x20not\x20configured','runSentiment','sentimentAccountId','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','data2','Cloud\x20Provider\x20not\x20configured','data1','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','transcribeStatus','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','updateAttributes','downloadTranscribe'];(function(_0x5e3e28,_0x5f2c3c){var _0x6f3528=function(_0x2c5a6c){while(--_0x2c5a6c){_0x5e3e28['push'](_0x5e3e28['shift']());}};_0x6f3528(++_0x5f2c3c);}(_0x2c7b,0x138));var _0xb2c7=function(_0x42245d,_0x51758f){_0x42245d=_0x42245d-0x0;var _0x4b211a=_0x2c7b[_0x42245d];return _0x4b211a;};'use strict';var emlformat=require(_0xb2c7('0x0'));var rimraf=require(_0xb2c7('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb2c7('0x2'));var rp=require(_0xb2c7('0x3'));var moment=require(_0xb2c7('0x4'));var BPromise=require(_0xb2c7('0x5'));var Mustache=require(_0xb2c7('0x6'));var util=require('util');var path=require('path');var sox=require(_0xb2c7('0x7'));var csv=require(_0xb2c7('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb2c7('0x9'));var _=require(_0xb2c7('0xa'));var squel=require('squel');var crypto=require(_0xb2c7('0xb'));var jsforce=require(_0xb2c7('0xc'));var deskjs=require(_0xb2c7('0xd'));var toCsv=require(_0xb2c7('0x8'));var querystring=require(_0xb2c7('0xe'));var Papa=require(_0xb2c7('0xf'));var AWS=require(_0xb2c7('0x10'));var uuidv4=require(_0xb2c7('0x11'));var Redis=require(_0xb2c7('0x12'));var authService=require(_0xb2c7('0x13'));var qs=require(_0xb2c7('0x14'));var as=require(_0xb2c7('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb2c7('0x16'))(_0xb2c7('0x17'));var utils=require(_0xb2c7('0x18'));var config=require(_0xb2c7('0x19'));var licenseUtil=require(_0xb2c7('0x1a'));var db=require(_0xb2c7('0x1b'))['db'];function respondWithStatusCode(_0x371afa,_0x5a5313){_0x5a5313=_0x5a5313||0xcc;return function(_0x22f854){if(_0x22f854){return _0x371afa[_0xb2c7('0x1c')](_0x5a5313);}return _0x371afa[_0xb2c7('0x1d')](_0x5a5313)[_0xb2c7('0x1e')]();};}function respondWithResult(_0x5684d0,_0x775033){_0x775033=_0x775033||0xc8;return function(_0xa410b1){if(_0xa410b1){return _0x5684d0[_0xb2c7('0x1d')](_0x775033)['json'](_0xa410b1);}};}function respondWithFilteredResult(_0x26a1b7,_0x3ae4ab){return function(_0x3525ce){if(_0x3525ce){var _0x54847e=typeof _0x3ae4ab['offset']===_0xb2c7('0x1f')&&typeof _0x3ae4ab[_0xb2c7('0x20')]===_0xb2c7('0x1f');var _0x389fb1=_0x3525ce[_0xb2c7('0x21')];var _0x47308e=_0x54847e?0x0:_0x3ae4ab['offset'];var _0x2caff5=_0x54847e?_0x3525ce[_0xb2c7('0x21')]:_0x3ae4ab[_0xb2c7('0x22')]+_0x3ae4ab[_0xb2c7('0x20')];var _0x37865f;if(_0x2caff5>=_0x389fb1){_0x2caff5=_0x389fb1;_0x37865f=0xc8;}else{_0x37865f=0xce;}_0x26a1b7[_0xb2c7('0x1d')](_0x37865f);return _0x26a1b7['set'](_0xb2c7('0x23'),_0x47308e+'-'+_0x2caff5+'/'+_0x389fb1)[_0xb2c7('0x24')](_0x3525ce);}return null;};}function patchUpdates(_0x351877){return function(_0x30c445){try{jsonpatch[_0xb2c7('0x25')](_0x30c445,_0x351877,!![]);}catch(_0x228384){return BPromise[_0xb2c7('0x26')](_0x228384);}return _0x30c445[_0xb2c7('0x27')]();};}function saveUpdates(_0x523a5e,_0x568940){return function(_0x1d145e){if(_0x1d145e){return _0x1d145e[_0xb2c7('0x28')](_0x523a5e)[_0xb2c7('0x29')](function(_0x3cfc7b){return _0x3cfc7b;});}return null;};}function removeEntity(_0x4722c0,_0x1a7999){return function(_0x91d868){if(_0x91d868){return _0x91d868[_0xb2c7('0x2a')]()[_0xb2c7('0x29')](function(){_0x4722c0[_0xb2c7('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2441fe,_0x13a4f6){return function(_0x5b478b){if(!_0x5b478b){_0x2441fe[_0xb2c7('0x1c')](0x194);}return _0x5b478b;};}function handleError(_0x252a8b,_0x230e04){_0x230e04=_0x230e04||0x1f4;return function(_0x5f1154){logger[_0xb2c7('0x2b')](_0x5f1154[_0xb2c7('0x2c')]);if(_0x5f1154['name']){delete _0x5f1154[_0xb2c7('0x2d')];}_0x252a8b['status'](_0x230e04)[_0xb2c7('0x2e')](_0x5f1154);};}exports[_0xb2c7('0x2f')]=function(_0x4388d4,_0x3fc989){var _0x152914={},_0x43a2ca={},_0xe5d1ad={'count':0x0,'rows':[]};var _0x128164=_['map'](db[_0xb2c7('0x30')][_0xb2c7('0x31')],function(_0x14aadb){return{'name':_0x14aadb['fieldName'],'type':_0x14aadb[_0xb2c7('0x32')]['key']};});_0x43a2ca['model']=_['differenceBy'](_['map'](_0x128164,'name'),[_0xb2c7('0x33')]);_0x43a2ca[_0xb2c7('0x34')]=_['keys'](_0x4388d4['query']);_0x43a2ca[_0xb2c7('0x35')]=_[_0xb2c7('0x36')](_0x43a2ca[_0xb2c7('0x37')],_0x43a2ca[_0xb2c7('0x34')]);_0x152914[_0xb2c7('0x38')]=_[_0xb2c7('0x36')](_0x43a2ca[_0xb2c7('0x37')],qs[_0xb2c7('0x39')](_0x4388d4[_0xb2c7('0x34')][_0xb2c7('0x39')]));_0x152914[_0xb2c7('0x38')]=_0x152914[_0xb2c7('0x38')][_0xb2c7('0x3a')]?_0x152914[_0xb2c7('0x38')]:_0x43a2ca[_0xb2c7('0x37')];if(!_0x4388d4[_0xb2c7('0x34')][_0xb2c7('0x3b')]('nolimit')){_0x152914[_0xb2c7('0x20')]=qs['limit'](_0x4388d4[_0xb2c7('0x34')][_0xb2c7('0x20')]);_0x152914[_0xb2c7('0x22')]=qs['offset'](_0x4388d4[_0xb2c7('0x34')]['offset']);}_0x152914['order']=qs['sort'](_0x4388d4[_0xb2c7('0x34')][_0xb2c7('0x3c')]);_0x152914[_0xb2c7('0x3d')]=qs['filters'](_['pick'](_0x4388d4['query'],_0x43a2ca['filters']),_0x128164);if(_0x4388d4[_0xb2c7('0x34')][_0xb2c7('0x3e')]){_0x152914[_0xb2c7('0x3d')]=_[_0xb2c7('0x3f')](_0x152914[_0xb2c7('0x3d')],{'$or':_['map'](_0x128164,function(_0x3e89dc){if(_0x3e89dc[_0xb2c7('0x32')]!=='VIRTUAL'){var _0x3ae91a={};_0x3ae91a[_0x3e89dc['name']]={'$like':'%'+_0x4388d4[_0xb2c7('0x34')][_0xb2c7('0x3e')]+'%'};return _0x3ae91a;}})});}_0x152914=_[_0xb2c7('0x3f')]({},_0x152914,_0x4388d4[_0xb2c7('0x40')]);var _0x4058cf={'where':_0x152914[_0xb2c7('0x3d')]};return db[_0xb2c7('0x30')][_0xb2c7('0x21')](_0x4058cf)[_0xb2c7('0x29')](function(_0x535150){_0xe5d1ad[_0xb2c7('0x21')]=_0x535150;if(_0x4388d4['query'][_0xb2c7('0x41')]){_0x152914[_0xb2c7('0x42')]=[{'all':!![]}];}return db['VoiceRecording'][_0xb2c7('0x43')](_0x152914);})['then'](function(_0x5c7caa){_0xe5d1ad['rows']=_0x5c7caa;return _0xe5d1ad;})['then'](respondWithFilteredResult(_0x3fc989,_0x152914))['catch'](handleError(_0x3fc989,null));};exports[_0xb2c7('0x44')]=function(_0x442700,_0x49b6ea){var _0x33731e={'raw':![],'where':{'id':_0x442700['params']['id']}},_0x36b4b2={};_0x36b4b2[_0xb2c7('0x37')]=_[_0xb2c7('0x45')](db[_0xb2c7('0x30')][_0xb2c7('0x31')]);_0x36b4b2[_0xb2c7('0x34')]=_[_0xb2c7('0x45')](_0x442700[_0xb2c7('0x34')]);_0x36b4b2[_0xb2c7('0x35')]=_[_0xb2c7('0x36')](_0x36b4b2['model'],_0x36b4b2[_0xb2c7('0x34')]);_0x33731e[_0xb2c7('0x38')]=_[_0xb2c7('0x36')](_0x36b4b2['model'],qs[_0xb2c7('0x39')](_0x442700['query'][_0xb2c7('0x39')]));_0x33731e[_0xb2c7('0x38')]=_0x33731e['attributes'][_0xb2c7('0x3a')]?_0x33731e[_0xb2c7('0x38')]:_0x36b4b2[_0xb2c7('0x37')];if(_0x442700['query'][_0xb2c7('0x41')]){_0x33731e[_0xb2c7('0x42')]=[{'all':!![]}];}_0x33731e=_[_0xb2c7('0x3f')]({},_0x33731e,_0x442700[_0xb2c7('0x40')]);return db[_0xb2c7('0x30')]['find'](_0x33731e)['then'](handleEntityNotFound(_0x49b6ea,null))[_0xb2c7('0x29')](respondWithResult(_0x49b6ea,null))[_0xb2c7('0x46')](handleError(_0x49b6ea,null));};exports['create']=function(_0x229e29,_0x2c8ad6){return db[_0xb2c7('0x30')][_0xb2c7('0x47')](_0x229e29[_0xb2c7('0x48')],{})[_0xb2c7('0x29')](respondWithResult(_0x2c8ad6,0xc9))[_0xb2c7('0x46')](handleError(_0x2c8ad6,null));};exports[_0xb2c7('0x28')]=function(_0x144f50,_0x57dedd){if(_0x144f50[_0xb2c7('0x48')]['id']){delete _0x144f50[_0xb2c7('0x48')]['id'];}return db['VoiceRecording'][_0xb2c7('0x49')]({'where':{'id':_0x144f50['params']['id']}})[_0xb2c7('0x29')](handleEntityNotFound(_0x57dedd,null))['then'](saveUpdates(_0x144f50[_0xb2c7('0x48')],null))['then'](respondWithResult(_0x57dedd,null))[_0xb2c7('0x46')](handleError(_0x57dedd,null));};exports[_0xb2c7('0x4a')]=function(_0x1e9301,_0x18a36c){return db[_0xb2c7('0x30')][_0xb2c7('0x4a')]()[_0xb2c7('0x29')](respondWithResult(_0x18a36c,null))[_0xb2c7('0x46')](handleError(_0x18a36c,null));};exports['download']=function(_0x276ae4,_0x1d9749,_0x529dbf){var _0x114691=require(_0xb2c7('0x4b'));var _0x4719fa=![];var _0x353a16={};if(_0x276ae4[_0xb2c7('0x34')][_0xb2c7('0x32')]&&_0x276ae4['query']['type']===_0xb2c7('0x4c')){_0x353a16[_0xb2c7('0x4c')]=_0x276ae4[_0xb2c7('0x4d')]['id'];}else{_0x353a16['id']=_0x276ae4['params']['id'];}return db[_0xb2c7('0x30')][_0xb2c7('0x49')]({'where':_0x353a16,'attributes':['id',_0xb2c7('0x4e')],'raw':!![]})[_0xb2c7('0x29')](handleEntityNotFound(_0x1d9749,null))[_0xb2c7('0x29')](function(_0x1405e2){if(_0x1405e2){var _0x3337be=_0x1405e2[_0xb2c7('0x4e')];var _0x107312=util[_0xb2c7('0x33')]('%s.cypher',_0x3337be);if(fs['existsSync'](_0x107312)){_0x4719fa=!![];return _0x114691[_0xb2c7('0x4f')](_0x107312,_0x3337be,config['secrets'][_0xb2c7('0x50')])['then'](function(){return _0x1405e2;});}return _0x1405e2;}})['then'](function(_0x38e94b){if(_0x38e94b){var _0xbdb9da=_0x38e94b[_0xb2c7('0x4e')];if(!fs['existsSync'](_0xbdb9da)){throw new db[(_0xb2c7('0x51'))]['ValidationError']('VoiceRecording\x20not\x20found');}if(_0x38e94b['filename']){return _0x1d9749[_0xb2c7('0x52')](_0xbdb9da,_0x38e94b[_0xb2c7('0x53')]+path['extname'](_0xbdb9da),function(){if(_0x4719fa){fs[_0xb2c7('0x54')](_0xbdb9da);}});}else{return _0x1d9749['download'](_0xbdb9da,function(_0x30da07){if(_0x4719fa){fs['unlink'](_0xbdb9da);}});}}})[_0xb2c7('0x46')](function(_0x918632){if(_0x918632[_0xb2c7('0x55')]===_0xb2c7('0x56')){_0x1d9749['status'](0x194)[_0xb2c7('0x2e')](_0xb2c7('0x57'));}else{return handleError(_0x1d9749,null);}});};exports[_0xb2c7('0x58')]=function(_0x43bcc9,_0x30f79a,_0x173f01){var _0x130893=require(_0xb2c7('0x4b'));var _0x57c5f6=![];var _0xc94d80={'$and':[db[_0xb2c7('0x59')][_0xb2c7('0x3d')](db[_0xb2c7('0x59')]['fn'](_0xb2c7('0x5a'),db[_0xb2c7('0x59')]['col'](_0xb2c7('0x4c'))),_0x43bcc9[_0xb2c7('0x34')][_0xb2c7('0x5b')])]};if(_0x43bcc9[_0xb2c7('0x34')][_0xb2c7('0x32')]&&_0x43bcc9['query'][_0xb2c7('0x32')]===_0xb2c7('0x4c')){_0xc94d80[_0xb2c7('0x5c')][_0xb2c7('0x5d')]({'uniqueid':_0x43bcc9[_0xb2c7('0x4d')]['id']});}else{_0xc94d80[_0xb2c7('0x5c')][_0xb2c7('0x5d')]({'id':_0x43bcc9[_0xb2c7('0x4d')]['id']});}return db[_0xb2c7('0x30')][_0xb2c7('0x49')]({'where':_0xc94d80,'attributes':['id','value'],'raw':!![]})[_0xb2c7('0x29')](handleEntityNotFound(_0x30f79a,null))[_0xb2c7('0x29')](function(_0x34de4a){if(_0x34de4a){var _0x16f90f=util[_0xb2c7('0x33')](_0xb2c7('0x5e'),_0x34de4a[_0xb2c7('0x4e')]);if(fs['existsSync'](_0x16f90f)){_0x57c5f6=!![];return _0x130893[_0xb2c7('0x4f')](_0x16f90f,_0x34de4a[_0xb2c7('0x4e')],config[_0xb2c7('0x5f')][_0xb2c7('0x50')])[_0xb2c7('0x29')](function(){return _0x34de4a;});}return _0x34de4a;}})[_0xb2c7('0x29')](function(_0x7bf3d9){if(_0x7bf3d9){if(!fs[_0xb2c7('0x60')](_0x7bf3d9[_0xb2c7('0x4e')])){throw new db[(_0xb2c7('0x51'))][(_0xb2c7('0x61'))](_0xb2c7('0x56'));}if(_0x7bf3d9['filename']){return _0x30f79a[_0xb2c7('0x52')](_0x7bf3d9['value'],_0x7bf3d9[_0xb2c7('0x53')]+path['extname'](_0x7bf3d9[_0xb2c7('0x4e')]),function(){if(_0x57c5f6){fs[_0xb2c7('0x54')](_0x7bf3d9[_0xb2c7('0x4e')]);}});}else{return _0x30f79a[_0xb2c7('0x52')](_0x7bf3d9[_0xb2c7('0x4e')],function(_0x2f9aaf){if(_0x57c5f6){fs[_0xb2c7('0x54')](_0x7bf3d9['value']);}});}}})['catch'](handleError(_0x30f79a,null));};exports[_0xb2c7('0x2a')]=function(_0x555184,_0x2b0566){return db[_0xb2c7('0x30')][_0xb2c7('0x49')]({'where':{'id':_0x555184[_0xb2c7('0x4d')]['id']}})[_0xb2c7('0x29')](function(_0x2b5699){if(_[_0xb2c7('0x62')](_0x2b5699)){throw new ReferenceError(_0xb2c7('0x63'));}return _0x2b5699;})[_0xb2c7('0x29')](function(_0x429359){var _0x402b9e=_0x429359[_0xb2c7('0x4e')];logger[_0xb2c7('0x64')](_0xb2c7('0x65'),_0x402b9e);if(!_['isNil'](_0x429359['value'])&&fs[_0xb2c7('0x60')](_0x402b9e)){logger['info'](_0xb2c7('0x66')+_0x402b9e+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xb2c7('0x67')](_0x402b9e);}_0x402b9e=_0x402b9e+_0xb2c7('0x68');if(!_['isNil'](_0x429359[_0xb2c7('0x4e')])&&fs[_0xb2c7('0x60')](_0x402b9e)){logger[_0xb2c7('0x64')](_0xb2c7('0x66')+_0x402b9e+_0xb2c7('0x69'));fs[_0xb2c7('0x67')](_0x402b9e);}return _0x429359;})[_0xb2c7('0x29')](function(_0x5ac646){if(!_0x5ac646)throw new InternalError();return _0x5ac646[_0xb2c7('0x2a')]();})[_0xb2c7('0x29')](function(){_0x2b0566['status'](0xcc)[_0xb2c7('0x1e')]();})[_0xb2c7('0x46')](handleError(_0x2b0566,null));};function getBucketslist(_0x248106,_0x180ced,_0x18780c){return new Promise(function(_0x2567ed,_0x1284ce){var _0x21fffb=new AWS['S3']({'accessKeyId':_0x180ced,'secretAccessKey':_0x248106,'region':_0x18780c});_0x21fffb[_0xb2c7('0x6a')]({},function(_0x4e2699,_0x2b46ff){if(_0x4e2699){return _0x1284ce(_0x4e2699);}else{return _0x2567ed(_0x2b46ff);}});});}function createBucket(_0x50fa71,_0x1d4e58,_0x3de50b,_0x7f58b4){return new Promise(function(_0x438f8c,_0x2faa0a){var _0x1e4da0=new AWS['S3']({'accessKeyId':_0x1d4e58,'secretAccessKey':_0x50fa71,'region':_0x3de50b});_0x1e4da0[_0xb2c7('0x6b')]({'Bucket':_0x7f58b4},function(_0x171e82,_0xcf14f5){if(_0x171e82){return _0x2faa0a(_0x171e82);}else{return _0x438f8c(_0xcf14f5);}});});}function uploadFile(_0x34fa82,_0x59fcbf,_0xf66aae,_0x487e3e,_0x349dcc,_0x166f8e){return new Promise(function(_0x18c758,_0x4045c9){var _0x53df70=new AWS['S3']({'accessKeyId':_0x59fcbf,'secretAccessKey':_0x34fa82,'region':_0xf66aae});_0x53df70[_0xb2c7('0x6c')]({'Bucket':_0x487e3e,'Key':_0x349dcc,'Body':_0x166f8e},function(_0x155ee6,_0x53d104){if(_0x155ee6){return _0x4045c9(_0x155ee6);}else{return _0x18c758(_0x53d104);}});});}function startTranscribe(_0x557faa,_0x3031b1,_0x5a31fa,_0x4539a2,_0x51d1c2,_0x9d602){return new Promise(function(_0x5dba83,_0x59d002){var _0x2573be=new AWS[(_0xb2c7('0x6d'))]({'accessKeyId':_0x3031b1,'secretAccessKey':_0x557faa,'region':_0x5a31fa});_0x2573be[_0xb2c7('0x6e')]({'TranscriptionJobName':_0x4539a2,'LanguageCode':_0x51d1c2,'Media':{'MediaFileUri':_0x9d602}},function(_0x21957d,_0x251b00){if(_0x21957d){return _0x59d002(_0x21957d);}else{return _0x5dba83(_0x251b00);}});});}function transcribe(_0xf3b151,_0xa53cbe,_0x3fec07,_0x185243,_0x4b55af,_0xe9534e,_0x4e842f){return new Promise(function(_0x387e0e,_0x5e35df){var _0x29b835={};logger[_0xb2c7('0x64')](util[_0xb2c7('0x33')]('[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s',_0xf3b151,_0x4b55af));return uploadFile(_0xa53cbe,_0x3fec07,_0x185243,_0x4b55af,path[_0xb2c7('0x6f')](_0xe9534e),fs[_0xb2c7('0x70')](_0xe9534e))[_0xb2c7('0x29')](function(_0xb1fcb8){logger['info'](util[_0xb2c7('0x33')](_0xb2c7('0x71'),_0xf3b151,_0x4b55af,_0xb1fcb8['Location']));_0x29b835[_0xb2c7('0x72')]=_0xb1fcb8[_0xb2c7('0x73')];_0x29b835[_0xb2c7('0x74')]=_0xb1fcb8[_0xb2c7('0x75')];logger['info'](util[_0xb2c7('0x33')](_0xb2c7('0x76'),_0xf3b151));return startTranscribe(_0xa53cbe,_0x3fec07,_0x185243,uuidv4(),_0x4e842f,_0xb1fcb8[_0xb2c7('0x75')]);})['then'](function(_0x199f77){logger[_0xb2c7('0x64')](util[_0xb2c7('0x33')](_0xb2c7('0x77'),_0xf3b151,_0x199f77[_0xb2c7('0x78')][_0xb2c7('0x79')]));_0x29b835[_0xb2c7('0x7a')]=_0x199f77[_0xb2c7('0x78')][_0xb2c7('0x79')];_0x29b835['transcribeStatus']=_0x199f77[_0xb2c7('0x78')][_0xb2c7('0x7b')];return _0x387e0e(_0x29b835);})[_0xb2c7('0x46')](function(_0x82ae04){return _0x5e35df(_0x82ae04);});});}exports[_0xb2c7('0x7c')]=function(_0x279921,_0x1af7d0,_0x1c536e){var _0x27dd65;var _0x3f7d4c;var _0x48f939;var _0x456abd=require('../../components/encryptor');return db['VoiceRecording'][_0xb2c7('0x7d')]({'where':{'id':_0x279921[_0xb2c7('0x4d')]['id']}})[_0xb2c7('0x29')](function(_0x26486a){if(_0x26486a){var _0x3cff92=util[_0xb2c7('0x33')](_0xb2c7('0x5e'),_0x26486a[_0xb2c7('0x4e')]);if(fs[_0xb2c7('0x60')](_0x3cff92)){cypher=!![];return _0x456abd[_0xb2c7('0x4f')](_0x3cff92,_0x26486a[_0xb2c7('0x4e')],config[_0xb2c7('0x5f')][_0xb2c7('0x50')])['then'](function(){return _0x26486a;});}return _0x26486a;}})[_0xb2c7('0x29')](function(_0x269159){if(!_0x269159){throw new db[(_0xb2c7('0x51'))]['ValidationError'](_0xb2c7('0x7e'));}_0x3f7d4c=_0x269159;return db['Setting'][_0xb2c7('0x7d')]({'where':{'id':0x1}});})[_0xb2c7('0x29')](handleEntityNotFound(_0x1af7d0,null))[_0xb2c7('0x29')](function(_0x4aa128){if(_0x4aa128){_0x27dd65=_0x4aa128;if(!_0x27dd65[_0xb2c7('0x7f')]||!_0x27dd65[_0xb2c7('0x80')]||!_0x27dd65[_0xb2c7('0x81')]||!_0x27dd65[_0xb2c7('0x82')]||!_0x27dd65[_0xb2c7('0x72')]){throw new db[(_0xb2c7('0x51'))][(_0xb2c7('0x61'))](_0xb2c7('0x83'));}if(_0x279921[_0xb2c7('0x48')][_0xb2c7('0x84')]&&(!_0x27dd65['sentiment']||!_0x27dd65[_0xb2c7('0x85')]||!_0x27dd65[_0xb2c7('0x86')]||!_0x27dd65['language']||!_0x27dd65['bucket'])){throw new db[(_0xb2c7('0x51'))]['ValidationError'](_0xb2c7('0x87'));}return db[_0xb2c7('0x88')]['findOne']({'where':{'id':_0x27dd65[_0xb2c7('0x80')]}});}})[_0xb2c7('0x29')](function(_0x14c3da){if(!_0x14c3da){throw new db[(_0xb2c7('0x51'))][(_0xb2c7('0x61'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x14c3da['data1']||!_0x14c3da[_0xb2c7('0x89')]){throw new db[(_0xb2c7('0x51'))][(_0xb2c7('0x61'))](_0xb2c7('0x8a'));}_0x48f939=_0x14c3da;return getBucketslist(_0x48f939[_0xb2c7('0x8b')],_0x48f939[_0xb2c7('0x89')],_0x27dd65[_0xb2c7('0x81')]);})['then'](function(_0x36ec81){if(_0x36ec81&&_0x36ec81[_0xb2c7('0x8c')]){var _0x55381f=_[_0xb2c7('0x49')](_0x36ec81['Buckets'],function(_0x394dee){return _0x394dee[_0xb2c7('0x8d')]===_0x27dd65[_0xb2c7('0x72')];});if(!_0x55381f){logger[_0xb2c7('0x64')](util[_0xb2c7('0x33')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available',_0x279921[_0xb2c7('0x4d')]['id'],_0x27dd65[_0xb2c7('0x72')]));return createBucket(_0x48f939[_0xb2c7('0x8b')],_0x48f939['data2'],_0x27dd65[_0xb2c7('0x81')],_0x27dd65[_0xb2c7('0x72')]);}logger[_0xb2c7('0x64')](util[_0xb2c7('0x33')](_0xb2c7('0x8e'),_0x279921[_0xb2c7('0x4d')]['id'],_0x27dd65[_0xb2c7('0x72')]));return;}})['then'](function(_0x18eebb){if(_0x3f7d4c[_0xb2c7('0x8f')]===_0xb2c7('0x90')){return transcribe(_0x279921[_0xb2c7('0x4d')]['id'],_0x48f939['data1'],_0x48f939['data2'],_0x27dd65['transcribeRegion'],_0x27dd65['bucket'],_0x3f7d4c[_0xb2c7('0x4e')],_0x27dd65[_0xb2c7('0x82')]);}else{logger['info'](util[_0xb2c7('0x33')](_0xb2c7('0x91'),_0x279921[_0xb2c7('0x4d')]['id']));return{'transcribeStatus':_0xb2c7('0x92')};}})['then'](function(_0x1c0551){if(_0x1c0551){_0x1c0551[_0xb2c7('0x93')]=_0x279921[_0xb2c7('0x48')][_0xb2c7('0x84')];return _0x3f7d4c[_0xb2c7('0x94')](_0x1c0551);}})[_0xb2c7('0x29')](respondWithResult(_0x1af7d0,null))[_0xb2c7('0x46')](handleError(_0x1af7d0,null));};function writeFile(_0x269836,_0x31f544){return new Promise(function(_0x368054,_0x37c0aa){fs['writeFile'](_0x31f544,_0x269836,function(_0x14b3fb,_0xe7f0af){if(_0x14b3fb){return _0x37c0aa(_0x14b3fb);}else{return _0x368054(_0xe7f0af);}});});}exports[_0xb2c7('0x95')]=function(_0xbbb534,_0x1a3ae7,_0x36d32a){return db[_0xb2c7('0x30')][_0xb2c7('0x7d')]({'where':{'id':_0xbbb534[_0xb2c7('0x4d')]['id']}})[_0xb2c7('0x29')](handleEntityNotFound(_0x1a3ae7))[_0xb2c7('0x29')](function(_0x128bed){if(_0x128bed&&_0x128bed[_0xb2c7('0x96')]){var _0x45add8=_0x128bed[_0xb2c7('0x96')];var _0xa4beaf=config[_0xb2c7('0x97')]+_0xb2c7('0x98')+_0x128bed['id']+'.txt';if(fs['existsSync'](_0xa4beaf)){return _0xa4beaf;}return writeFile(_0x45add8,_0xa4beaf)[_0xb2c7('0x29')](function(){return _0xa4beaf;});}else{throw new db[(_0xb2c7('0x51'))][(_0xb2c7('0x61'))](_0xb2c7('0x99'));}})['then'](function(_0x588171){return _0x1a3ae7[_0xb2c7('0x52')](_0x588171);})['catch'](handleError(_0x1a3ae7));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index 5554f51..1f77c2f 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 _0x1015=['path','rimraf','exports','define','VoiceRecording','voice_recordings','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x447f78,_0x2eeccb){var _0x2dff53=function(_0x481d3b){while(--_0x481d3b){_0x447f78['push'](_0x447f78['shift']());}};_0x2dff53(++_0x2eeccb);}(_0x1015,0x85));var _0x5101=function(_0x16c987,_0x3d3b9f){_0x16c987=_0x16c987-0x0;var _0x4ce2b1=_0x1015[_0x16c987];return _0x4ce2b1;};'use strict';var _=require(_0x5101('0x0'));var util=require(_0x5101('0x1'));var logger=require(_0x5101('0x2'))(_0x5101('0x3'));var moment=require(_0x5101('0x4'));var BPromise=require(_0x5101('0x5'));var rp=require(_0x5101('0x6'));var fs=require('fs');var path=require(_0x5101('0x7'));var rimraf=require(_0x5101('0x8'));var config=require('../../config/environment');var attributes=require('./voiceRecording.attributes');module[_0x5101('0x9')]=function(_0x324126,_0xdb8775){return _0x324126[_0x5101('0xa')](_0x5101('0xb'),attributes,{'tableName':_0x5101('0xc'),'paranoid':![],'indexes':[{'name':_0x5101('0xd'),'fields':[_0x5101('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xfa60=['path','./voiceRecording.attributes','exports','VoiceRecording','voice_recordings','uniqueid','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x4198d6,_0x332030){var _0x145d70=function(_0x371774){while(--_0x371774){_0x4198d6['push'](_0x4198d6['shift']());}};_0x145d70(++_0x332030);}(_0xfa60,0x8a));var _0x0fa6=function(_0x58573e,_0x274b5a){_0x58573e=_0x58573e-0x0;var _0x1b1e2c=_0xfa60[_0x58573e];return _0x1b1e2c;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x0fa6('0x0'))(_0x0fa6('0x1'));var moment=require(_0x0fa6('0x2'));var BPromise=require(_0x0fa6('0x3'));var rp=require(_0x0fa6('0x4'));var fs=require('fs');var path=require(_0x0fa6('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x0fa6('0x6'));module[_0x0fa6('0x7')]=function(_0x255eae,_0x518e69){return _0x255eae['define'](_0x0fa6('0x8'),attributes,{'tableName':_0x0fa6('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x0fa6('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index 30dc531..610cc4f 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 _0xd943=['info','request\x20sent','VoiceRecording,\x20%s,\x20%s,\x20%s','error','code','VoiceRecording,\x20%s,\x20%s','message','result','catch','UpdateVoiceRecording','VoiceRecording','body','options','raw','where','attributes','debug','stringify','CreateVoiceRecording','../../components/encryptor','Setting','findOne','callRecordingEncryption','existsSync','value','format','secrets','recording','CreateVoiceRecording\x20file\x20encrypted','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','then'];(function(_0x5de237,_0x2058e8){var _0x3b3d4d=function(_0x3debe1){while(--_0x3debe1){_0x5de237['push'](_0x5de237['shift']());}};_0x3b3d4d(++_0x2058e8);}(_0xd943,0x15d));var _0x3d94=function(_0x455610,_0x53d55b){_0x455610=_0x455610-0x0;var _0x160644=_0xd943[_0x455610];return _0x160644;};'use strict';var _=require(_0x3d94('0x0'));var util=require(_0x3d94('0x1'));var moment=require(_0x3d94('0x2'));var BPromise=require(_0x3d94('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3d94('0x4'));var db=require(_0x3d94('0x5'))['db'];var utils=require(_0x3d94('0x6'));var logger=require(_0x3d94('0x7'))(_0x3d94('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3d94('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x54e81f,_0x4d29e7,_0x20f4d1){return new BPromise(function(_0x35d36a,_0x5244c3){return client['request'](_0x54e81f,_0x20f4d1)[_0x3d94('0xa')](function(_0x27e381){logger[_0x3d94('0xb')]('VoiceRecording,\x20%s,\x20%s',_0x4d29e7,_0x3d94('0xc'));logger['debug'](_0x3d94('0xd'),_0x4d29e7,_0x3d94('0xc'),JSON['stringify'](_0x27e381));if(_0x27e381[_0x3d94('0xe')]){if(_0x27e381[_0x3d94('0xe')][_0x3d94('0xf')]===0x1f4){logger[_0x3d94('0xe')](_0x3d94('0x10'),_0x4d29e7,_0x27e381['error'][_0x3d94('0x11')]);return _0x5244c3(_0x27e381[_0x3d94('0xe')][_0x3d94('0x11')]);}logger['error'](_0x3d94('0x10'),_0x4d29e7,_0x27e381[_0x3d94('0xe')][_0x3d94('0x11')]);return _0x35d36a(_0x27e381['error'][_0x3d94('0x11')]);}else{logger[_0x3d94('0xb')](_0x3d94('0x10'),_0x4d29e7,_0x3d94('0xc'));_0x35d36a(_0x27e381[_0x3d94('0x12')][_0x3d94('0x11')]);}})[_0x3d94('0x13')](function(_0x9893cb){logger['error'](_0x3d94('0x10'),_0x4d29e7,_0x9893cb);_0x5244c3(_0x9893cb);});});}exports[_0x3d94('0x14')]=function(_0x2acee3){var _0x1c35a8=this;return new Promise(function(_0x4afc92,_0x3ca0e3){return db[_0x3d94('0x15')]['update'](_0x2acee3[_0x3d94('0x16')],{'raw':_0x2acee3['options']?_0x2acee3[_0x3d94('0x17')][_0x3d94('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2acee3[_0x3d94('0x17')]?_0x2acee3[_0x3d94('0x17')][_0x3d94('0x19')]||null:null,'attributes':_0x2acee3['options']?_0x2acee3['options'][_0x3d94('0x1a')]||null:null,'limit':_0x2acee3[_0x3d94('0x17')]?_0x2acee3[_0x3d94('0x17')]['limit']||null:null})[_0x3d94('0xa')](function(_0x2e8c91){logger[_0x3d94('0xb')](_0x3d94('0x14'),_0x2acee3);logger[_0x3d94('0x1b')](_0x3d94('0x14'),_0x2acee3,JSON[_0x3d94('0x1c')](_0x2e8c91));_0x4afc92(_0x2e8c91);})[_0x3d94('0x13')](function(_0xee7b8d){logger[_0x3d94('0xe')](_0x3d94('0x14'),_0xee7b8d[_0x3d94('0x11')],_0x2acee3);_0x3ca0e3(_0x1c35a8[_0x3d94('0xe')](0x1f4,_0xee7b8d[_0x3d94('0x11')]));});});};exports[_0x3d94('0x1d')]=function(_0x5b3b31){var _0x123183=this;return new Promise(function(_0x558fd2,_0x28a698){var _0x1d0a7a=require(_0x3d94('0x1e'));var _0x439173;return db[_0x3d94('0x1f')][_0x3d94('0x20')]({'attributes':['id',_0x3d94('0x21')],'where':{'id':0x1},'raw':!![]})['then'](function(_0x584c4a){_0x439173=_0x584c4a;return db[_0x3d94('0x15')]['create'](_0x5b3b31['body']);})[_0x3d94('0xa')](function(_0x58c0d0){if(_0x439173[_0x3d94('0x21')]&&fs[_0x3d94('0x22')](_0x58c0d0[_0x3d94('0x23')])){var _0x4cef9c=util[_0x3d94('0x24')]('%s.cypher',_0x58c0d0[_0x3d94('0x23')]);return _0x1d0a7a['encryptFile'](_0x58c0d0[_0x3d94('0x23')],_0x4cef9c,config[_0x3d94('0x25')][_0x3d94('0x26')])[_0x3d94('0xa')](function(){fs['unlink'](_0x58c0d0[_0x3d94('0x23')]);logger['info'](_0x3d94('0x27'));return _0x58c0d0;});}return _0x58c0d0;})[_0x3d94('0xa')](function(_0x51d308){logger['info'](_0x3d94('0x1d'),_0x5b3b31);logger[_0x3d94('0x1b')](_0x3d94('0x1d'),_0x5b3b31,JSON['stringify'](_0x51d308));_0x558fd2(_0x51d308);})[_0x3d94('0x13')](function(_0x3d29fd){logger['error'](_0x3d94('0x1d'),_0x3d29fd[_0x3d94('0x11')],_0x5b3b31);_0x28a698(_0x123183[_0x3d94('0xe')](0x1f4,_0x3d29fd[_0x3d94('0x11')]));});});}; \ No newline at end of file +var _0x68b3=['../../components/encryptor','Setting','findOne','callRecordingEncryption','existsSync','format','%s.cypher','value','encryptFile','secrets','recording','unlink','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','VoiceRecording,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','UpdateVoiceRecording','VoiceRecording','update','body','options','raw','where','attributes','limit','CreateVoiceRecording'];(function(_0xd6165e,_0x2195e1){var _0x207e4f=function(_0xb5ac83){while(--_0xb5ac83){_0xd6165e['push'](_0xd6165e['shift']());}};_0x207e4f(++_0x2195e1);}(_0x68b3,0x1d8));var _0x368b=function(_0x228c78,_0x2612a2){_0x228c78=_0x228c78-0x0;var _0x17215a=_0x68b3[_0x228c78];return _0x17215a;};'use strict';var _=require(_0x368b('0x0'));var util=require(_0x368b('0x1'));var moment=require(_0x368b('0x2'));var BPromise=require(_0x368b('0x3'));var rs=require(_0x368b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x368b('0x5'))['db'];var utils=require(_0x368b('0x6'));var logger=require(_0x368b('0x7'))(_0x368b('0x8'));var config=require('../../config/environment');var jayson=require(_0x368b('0x9'));var client=jayson[_0x368b('0xa')][_0x368b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x23584a,_0x4406c8,_0x127c1e){return new BPromise(function(_0x2dec1c,_0x142d05){return client[_0x368b('0xc')](_0x23584a,_0x127c1e)[_0x368b('0xd')](function(_0x2a7b9f){logger['info'](_0x368b('0xe'),_0x4406c8,_0x368b('0xf'));logger[_0x368b('0x10')]('VoiceRecording,\x20%s,\x20%s,\x20%s',_0x4406c8,_0x368b('0xf'),JSON[_0x368b('0x11')](_0x2a7b9f));if(_0x2a7b9f[_0x368b('0x12')]){if(_0x2a7b9f['error'][_0x368b('0x13')]===0x1f4){logger[_0x368b('0x12')]('VoiceRecording,\x20%s,\x20%s',_0x4406c8,_0x2a7b9f[_0x368b('0x12')][_0x368b('0x14')]);return _0x142d05(_0x2a7b9f[_0x368b('0x12')][_0x368b('0x14')]);}logger[_0x368b('0x12')]('VoiceRecording,\x20%s,\x20%s',_0x4406c8,_0x2a7b9f[_0x368b('0x12')][_0x368b('0x14')]);return _0x2dec1c(_0x2a7b9f['error'][_0x368b('0x14')]);}else{logger[_0x368b('0x15')](_0x368b('0xe'),_0x4406c8,'request\x20sent');_0x2dec1c(_0x2a7b9f[_0x368b('0x16')][_0x368b('0x14')]);}})[_0x368b('0x17')](function(_0x4d6d9d){logger[_0x368b('0x12')](_0x368b('0xe'),_0x4406c8,_0x4d6d9d);_0x142d05(_0x4d6d9d);});});}exports[_0x368b('0x18')]=function(_0x540f57){var _0x5d543e=this;return new Promise(function(_0x3e2e9f,_0x27d2a0){return db[_0x368b('0x19')][_0x368b('0x1a')](_0x540f57[_0x368b('0x1b')],{'raw':_0x540f57['options']?_0x540f57[_0x368b('0x1c')][_0x368b('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x540f57[_0x368b('0x1c')]?_0x540f57[_0x368b('0x1c')][_0x368b('0x1e')]||null:null,'attributes':_0x540f57[_0x368b('0x1c')]?_0x540f57[_0x368b('0x1c')][_0x368b('0x1f')]||null:null,'limit':_0x540f57['options']?_0x540f57[_0x368b('0x1c')][_0x368b('0x20')]||null:null})[_0x368b('0xd')](function(_0xc0f7af){logger[_0x368b('0x15')]('UpdateVoiceRecording',_0x540f57);logger[_0x368b('0x10')](_0x368b('0x18'),_0x540f57,JSON[_0x368b('0x11')](_0xc0f7af));_0x3e2e9f(_0xc0f7af);})[_0x368b('0x17')](function(_0x77a269){logger[_0x368b('0x12')](_0x368b('0x18'),_0x77a269[_0x368b('0x14')],_0x540f57);_0x27d2a0(_0x5d543e[_0x368b('0x12')](0x1f4,_0x77a269[_0x368b('0x14')]));});});};exports[_0x368b('0x21')]=function(_0x344d8a){var _0xceec4b=this;return new Promise(function(_0x376e61,_0x4636f4){var _0x23a83a=require(_0x368b('0x22'));var _0x9f192e;return db[_0x368b('0x23')][_0x368b('0x24')]({'attributes':['id',_0x368b('0x25')],'where':{'id':0x1},'raw':!![]})[_0x368b('0xd')](function(_0x107d2f){_0x9f192e=_0x107d2f;return db[_0x368b('0x19')]['create'](_0x344d8a['body']);})[_0x368b('0xd')](function(_0x2f1d52){if(_0x9f192e[_0x368b('0x25')]&&fs[_0x368b('0x26')](_0x2f1d52['value'])){var _0x12ae59=util[_0x368b('0x27')](_0x368b('0x28'),_0x2f1d52[_0x368b('0x29')]);return _0x23a83a[_0x368b('0x2a')](_0x2f1d52['value'],_0x12ae59,config[_0x368b('0x2b')][_0x368b('0x2c')])[_0x368b('0xd')](function(){fs[_0x368b('0x2d')](_0x2f1d52['value']);logger['info']('CreateVoiceRecording\x20file\x20encrypted');return _0x2f1d52;});}return _0x2f1d52;})[_0x368b('0xd')](function(_0x2bc363){logger[_0x368b('0x15')](_0x368b('0x21'),_0x344d8a);logger[_0x368b('0x10')]('CreateVoiceRecording',_0x344d8a,JSON[_0x368b('0x11')](_0x2bc363));_0x376e61(_0x2bc363);})[_0x368b('0x17')](function(_0x54e7e5){logger[_0x368b('0x12')](_0x368b('0x21'),_0x54e7e5['message'],_0x344d8a);_0x4636f4(_0xceec4b[_0x368b('0x12')](0x1f4,_0x54e7e5[_0x368b('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index 6040ba5..7e553fc 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 _0xfa1d=['../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x433a86,_0x175b5c){var _0x23000c=function(_0x4b1fa0){while(--_0x4b1fa0){_0x433a86['push'](_0x433a86['shift']());}};_0x23000c(++_0x175b5c);}(_0xfa1d,0x76));var _0xdfa1=function(_0x3ee935,_0x293a98){_0x3ee935=_0x3ee935-0x0;var _0x586db7=_0xfa1d[_0x3ee935];return _0x586db7;};'use strict';var multer=require(_0xdfa1('0x0'));var util=require(_0xdfa1('0x1'));var path=require('path');var timeout=require(_0xdfa1('0x2'));var express=require(_0xdfa1('0x3'));var router=express[_0xdfa1('0x4')]();var fs_extra=require(_0xdfa1('0x5'));var auth=require(_0xdfa1('0x6'));var interaction=require(_0xdfa1('0x7'));var config=require(_0xdfa1('0x8'));var controller=require('./voiceTransferReport.controller');router[_0xdfa1('0x9')]('/',auth[_0xdfa1('0xa')](),controller[_0xdfa1('0xb')]);router[_0xdfa1('0x9')](_0xdfa1('0xc'),auth[_0xdfa1('0xa')](),controller[_0xdfa1('0xd')]);router[_0xdfa1('0x9')](_0xdfa1('0xe'),auth[_0xdfa1('0xa')](),controller[_0xdfa1('0xf')]);router[_0xdfa1('0x10')]('/',auth['isAuthenticated'](),controller[_0xdfa1('0x11')]);router[_0xdfa1('0x12')]('/:id',auth[_0xdfa1('0xa')](),controller['update']);router['delete']('/:id',auth[_0xdfa1('0xa')](),controller[_0xdfa1('0x13')]);module[_0xdfa1('0x14')]=router; \ No newline at end of file +var _0xae6e=['../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x4ae6ef,_0xc2af80){var _0x3cbb4e=function(_0x569ad5){while(--_0x569ad5){_0x4ae6ef['push'](_0x4ae6ef['shift']());}};_0x3cbb4e(++_0xc2af80);}(_0xae6e,0x161));var _0xeae6=function(_0x4490d1,_0x1428c3){_0x4490d1=_0x4490d1-0x0;var _0x1d9e5e=_0xae6e[_0x4490d1];return _0x1d9e5e;};'use strict';var multer=require(_0xeae6('0x0'));var util=require(_0xeae6('0x1'));var path=require(_0xeae6('0x2'));var timeout=require(_0xeae6('0x3'));var express=require(_0xeae6('0x4'));var router=express[_0xeae6('0x5')]();var fs_extra=require(_0xeae6('0x6'));var auth=require(_0xeae6('0x7'));var interaction=require(_0xeae6('0x8'));var config=require(_0xeae6('0x9'));var controller=require(_0xeae6('0xa'));router[_0xeae6('0xb')]('/',auth[_0xeae6('0xc')](),controller[_0xeae6('0xd')]);router[_0xeae6('0xb')](_0xeae6('0xe'),auth['isAuthenticated'](),controller[_0xeae6('0xf')]);router[_0xeae6('0xb')](_0xeae6('0x10'),auth['isAuthenticated'](),controller['show']);router[_0xeae6('0x11')]('/',auth[_0xeae6('0xc')](),controller[_0xeae6('0x12')]);router[_0xeae6('0x13')](_0xeae6('0x10'),auth[_0xeae6('0xc')](),controller[_0xeae6('0x14')]);router[_0xeae6('0x15')](_0xeae6('0x10'),auth[_0xeae6('0xc')](),controller[_0xeae6('0x16')]);module[_0xeae6('0x17')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index 35941d4..670c578 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 _0x9717=['attended','STRING','ENUM','sequelize','moment','exports','blind'];(function(_0x1f3bd4,_0x38029f){var _0x41d3d0=function(_0x339ed9){while(--_0x339ed9){_0x1f3bd4['push'](_0x1f3bd4['shift']());}};_0x41d3d0(++_0x38029f);}(_0x9717,0x8f));var _0x7971=function(_0x19b80b,_0x527314){_0x19b80b=_0x19b80b-0x0;var _0x46f8a3=_0x9717[_0x19b80b];return _0x46f8a3;};'use strict';var Sequelize=require(_0x7971('0x0'));var moment=require(_0x7971('0x1'));module[_0x7971('0x2')]={'type':{'type':Sequelize['ENUM'](_0x7971('0x3'),_0x7971('0x4'))},'result':{'type':Sequelize[_0x7971('0x5')]},'transfererchannel':{'type':Sequelize[_0x7971('0x5')]},'transferercalleridnum':{'type':Sequelize['STRING']},'transferercalleridname':{'type':Sequelize[_0x7971('0x5')]},'transfererconnectedlinenum':{'type':Sequelize[_0x7971('0x5')]},'transfererconnectedlinename':{'type':Sequelize[_0x7971('0x5')]},'transfereraccountcode':{'type':Sequelize[_0x7971('0x5')]},'transferercontext':{'type':Sequelize[_0x7971('0x5')]},'transfererexten':{'type':Sequelize[_0x7971('0x5')]},'transfererlinkedid':{'type':Sequelize[_0x7971('0x5')]},'transfereechannel':{'type':Sequelize[_0x7971('0x5')]},'transfereecalleridnum':{'type':Sequelize[_0x7971('0x5')]},'transfereecalleridname':{'type':Sequelize[_0x7971('0x5')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x7971('0x5')]},'transfereeconnectedlinename':{'type':Sequelize[_0x7971('0x5')]},'transfereeaccountcode':{'type':Sequelize['STRING']},'transfereecontext':{'type':Sequelize['STRING']},'transfereeexten':{'type':Sequelize[_0x7971('0x5')]},'transfereelinkedid':{'type':Sequelize[_0x7971('0x5')]},'isexternal':{'type':Sequelize[_0x7971('0x6')]('Yes','No')},'context':{'type':Sequelize[_0x7971('0x5')]},'extension':{'type':Sequelize[_0x7971('0x5')]}}; \ No newline at end of file +var _0x8abf=['Yes','sequelize','moment','ENUM','attended','STRING'];(function(_0x44e96e,_0x3b551a){var _0x27c3a2=function(_0xadb251){while(--_0xadb251){_0x44e96e['push'](_0x44e96e['shift']());}};_0x27c3a2(++_0x3b551a);}(_0x8abf,0xdf));var _0xf8ab=function(_0x2c5ce0,_0x1af33a){_0x2c5ce0=_0x2c5ce0-0x0;var _0x3289d0=_0x8abf[_0x2c5ce0];return _0x3289d0;};'use strict';var Sequelize=require(_0xf8ab('0x0'));var moment=require(_0xf8ab('0x1'));module['exports']={'type':{'type':Sequelize[_0xf8ab('0x2')]('blind',_0xf8ab('0x3'))},'result':{'type':Sequelize[_0xf8ab('0x4')]},'transfererchannel':{'type':Sequelize['STRING']},'transferercalleridnum':{'type':Sequelize[_0xf8ab('0x4')]},'transferercalleridname':{'type':Sequelize[_0xf8ab('0x4')]},'transfererconnectedlinenum':{'type':Sequelize[_0xf8ab('0x4')]},'transfererconnectedlinename':{'type':Sequelize[_0xf8ab('0x4')]},'transfereraccountcode':{'type':Sequelize[_0xf8ab('0x4')]},'transferercontext':{'type':Sequelize['STRING']},'transfererexten':{'type':Sequelize[_0xf8ab('0x4')]},'transfererlinkedid':{'type':Sequelize[_0xf8ab('0x4')]},'transfereechannel':{'type':Sequelize[_0xf8ab('0x4')]},'transfereecalleridnum':{'type':Sequelize[_0xf8ab('0x4')]},'transfereecalleridname':{'type':Sequelize[_0xf8ab('0x4')]},'transfereeconnectedlinenum':{'type':Sequelize[_0xf8ab('0x4')]},'transfereeconnectedlinename':{'type':Sequelize[_0xf8ab('0x4')]},'transfereeaccountcode':{'type':Sequelize[_0xf8ab('0x4')]},'transfereecontext':{'type':Sequelize[_0xf8ab('0x4')]},'transfereeexten':{'type':Sequelize['STRING']},'transfereelinkedid':{'type':Sequelize[_0xf8ab('0x4')]},'isexternal':{'type':Sequelize[_0xf8ab('0x2')](_0xf8ab('0x5'),'No')},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0xf8ab('0x4')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index f02d04d..b64094c 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 _0xf525=['VoiceTransferReport','fieldName','type','key','keys','query','filters','model','intersection','fields','attributes','length','hasOwnProperty','sort','pick','where','VIRTUAL','filter','merge','includeAll','include','findAll','rows','catch','params','find','create','body','destroy','describe','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','sendStatus','error','name','send','index','map'];(function(_0x5b7816,_0x3ecfc7){var _0x4753c7=function(_0x9f39d3){while(--_0x9f39d3){_0x5b7816['push'](_0x5b7816['shift']());}};_0x4753c7(++_0x3ecfc7);}(_0xf525,0x65));var _0x5f52=function(_0x3f5a2c,_0xdaebe0){_0x3f5a2c=_0x3f5a2c-0x0;var _0x1cf291=_0xf525[_0x3f5a2c];return _0x1cf291;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5f52('0x0'));var zipdir=require(_0x5f52('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5f52('0x2'));var moment=require(_0x5f52('0x3'));var BPromise=require(_0x5f52('0x4'));var Mustache=require(_0x5f52('0x5'));var util=require(_0x5f52('0x6'));var path=require(_0x5f52('0x7'));var sox=require('sox');var csv=require(_0x5f52('0x8'));var ejs=require(_0x5f52('0x9'));var fs=require('fs');var fs_extra=require(_0x5f52('0xa'));var _=require(_0x5f52('0xb'));var squel=require(_0x5f52('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x5f52('0xd'));var toCsv=require(_0x5f52('0x8'));var querystring=require(_0x5f52('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x5f52('0xf'));var qs=require(_0x5f52('0x10'));var as=require(_0x5f52('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5f52('0x12'))(_0x5f52('0x13'));var utils=require(_0x5f52('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x5f52('0x15'));var db=require(_0x5f52('0x16'))['db'];function respondWithStatusCode(_0xe9dc7c,_0x662ac6){_0x662ac6=_0x662ac6||0xcc;return function(_0x19bd28){if(_0x19bd28){return _0xe9dc7c['sendStatus'](_0x662ac6);}return _0xe9dc7c[_0x5f52('0x17')](_0x662ac6)['end']();};}function respondWithResult(_0x387d61,_0x54f44b){_0x54f44b=_0x54f44b||0xc8;return function(_0x3ad9fd){if(_0x3ad9fd){return _0x387d61[_0x5f52('0x17')](_0x54f44b)[_0x5f52('0x18')](_0x3ad9fd);}};}function respondWithFilteredResult(_0x4b8ae8,_0x5025fb){return function(_0x5e4165){if(_0x5e4165){var _0x325e66=typeof _0x5025fb[_0x5f52('0x19')]===_0x5f52('0x1a')&&typeof _0x5025fb[_0x5f52('0x1b')]===_0x5f52('0x1a');var _0x378999=_0x5e4165[_0x5f52('0x1c')];var _0x1a5e16=_0x325e66?0x0:_0x5025fb[_0x5f52('0x19')];var _0x2b5ff7=_0x325e66?_0x5e4165[_0x5f52('0x1c')]:_0x5025fb[_0x5f52('0x19')]+_0x5025fb[_0x5f52('0x1b')];var _0x36604e;if(_0x2b5ff7>=_0x378999){_0x2b5ff7=_0x378999;_0x36604e=0xc8;}else{_0x36604e=0xce;}_0x4b8ae8['status'](_0x36604e);return _0x4b8ae8[_0x5f52('0x1d')](_0x5f52('0x1e'),_0x1a5e16+'-'+_0x2b5ff7+'/'+_0x378999)['json'](_0x5e4165);}return null;};}function patchUpdates(_0x225c6c){return function(_0x56f3d5){try{jsonpatch[_0x5f52('0x1f')](_0x56f3d5,_0x225c6c,!![]);}catch(_0x39abc3){return BPromise['reject'](_0x39abc3);}return _0x56f3d5[_0x5f52('0x20')]();};}function saveUpdates(_0x39adf2,_0x1fdb97){return function(_0x2deebe){if(_0x2deebe){return _0x2deebe[_0x5f52('0x21')](_0x39adf2)[_0x5f52('0x22')](function(_0x3f6625){return _0x3f6625;});}return null;};}function removeEntity(_0x2d3856,_0x66e0f5){return function(_0xceeafc){if(_0xceeafc){return _0xceeafc['destroy']()[_0x5f52('0x22')](function(){_0x2d3856[_0x5f52('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x255068,_0x3d24b0){return function(_0x2259f6){if(!_0x2259f6){_0x255068[_0x5f52('0x23')](0x194);}return _0x2259f6;};}function handleError(_0x38f55f,_0x14e291){_0x14e291=_0x14e291||0x1f4;return function(_0x269166){logger[_0x5f52('0x24')](_0x269166['stack']);if(_0x269166[_0x5f52('0x25')]){delete _0x269166[_0x5f52('0x25')];}_0x38f55f[_0x5f52('0x17')](_0x14e291)[_0x5f52('0x26')](_0x269166);};}exports[_0x5f52('0x27')]=function(_0x121b69,_0x4b9945){var _0x21c66a={},_0x4ff18b={},_0x24b454={'count':0x0,'rows':[]};var _0xe7d518=_[_0x5f52('0x28')](db[_0x5f52('0x29')]['rawAttributes'],function(_0x1b63fc){return{'name':_0x1b63fc[_0x5f52('0x2a')],'type':_0x1b63fc[_0x5f52('0x2b')][_0x5f52('0x2c')]};});_0x4ff18b['model']=_[_0x5f52('0x28')](_0xe7d518,'name');_0x4ff18b['query']=_[_0x5f52('0x2d')](_0x121b69[_0x5f52('0x2e')]);_0x4ff18b[_0x5f52('0x2f')]=_['intersection'](_0x4ff18b[_0x5f52('0x30')],_0x4ff18b[_0x5f52('0x2e')]);_0x21c66a['attributes']=_[_0x5f52('0x31')](_0x4ff18b[_0x5f52('0x30')],qs[_0x5f52('0x32')](_0x121b69['query'][_0x5f52('0x32')]));_0x21c66a[_0x5f52('0x33')]=_0x21c66a[_0x5f52('0x33')][_0x5f52('0x34')]?_0x21c66a[_0x5f52('0x33')]:_0x4ff18b[_0x5f52('0x30')];if(!_0x121b69[_0x5f52('0x2e')][_0x5f52('0x35')]('nolimit')){_0x21c66a['limit']=qs['limit'](_0x121b69['query'][_0x5f52('0x1b')]);_0x21c66a[_0x5f52('0x19')]=qs[_0x5f52('0x19')](_0x121b69[_0x5f52('0x2e')]['offset']);}_0x21c66a['order']=qs[_0x5f52('0x36')](_0x121b69[_0x5f52('0x2e')][_0x5f52('0x36')]);_0x21c66a['where']=qs[_0x5f52('0x2f')](_[_0x5f52('0x37')](_0x121b69[_0x5f52('0x2e')],_0x4ff18b[_0x5f52('0x2f')]),_0xe7d518);if(_0x121b69['query']['filter']){_0x21c66a[_0x5f52('0x38')]=_['merge'](_0x21c66a['where'],{'$or':_[_0x5f52('0x28')](_0xe7d518,function(_0x53125d){if(_0x53125d[_0x5f52('0x2b')]!==_0x5f52('0x39')){var _0x2979f5={};_0x2979f5[_0x53125d[_0x5f52('0x25')]]={'$like':'%'+_0x121b69[_0x5f52('0x2e')][_0x5f52('0x3a')]+'%'};return _0x2979f5;}})});}_0x21c66a=_[_0x5f52('0x3b')]({},_0x21c66a,_0x121b69['options']);var _0x4abf79={'where':_0x21c66a[_0x5f52('0x38')]};return db[_0x5f52('0x29')]['count'](_0x4abf79)[_0x5f52('0x22')](function(_0x866070){_0x24b454[_0x5f52('0x1c')]=_0x866070;if(_0x121b69[_0x5f52('0x2e')][_0x5f52('0x3c')]){_0x21c66a[_0x5f52('0x3d')]=[{'all':!![]}];}return db[_0x5f52('0x29')][_0x5f52('0x3e')](_0x21c66a);})[_0x5f52('0x22')](function(_0x9003c8){_0x24b454[_0x5f52('0x3f')]=_0x9003c8;return _0x24b454;})['then'](respondWithFilteredResult(_0x4b9945,_0x21c66a))[_0x5f52('0x40')](handleError(_0x4b9945,null));};exports['show']=function(_0x1501d7,_0x9e1797){var _0x2d849a={'raw':!![],'where':{'id':_0x1501d7[_0x5f52('0x41')]['id']}},_0x4c89f7={};_0x4c89f7[_0x5f52('0x30')]=_['keys'](db['VoiceTransferReport']['rawAttributes']);_0x4c89f7['query']=_['keys'](_0x1501d7[_0x5f52('0x2e')]);_0x4c89f7['filters']=_['intersection'](_0x4c89f7[_0x5f52('0x30')],_0x4c89f7[_0x5f52('0x2e')]);_0x2d849a['attributes']=_[_0x5f52('0x31')](_0x4c89f7[_0x5f52('0x30')],qs[_0x5f52('0x32')](_0x1501d7[_0x5f52('0x2e')][_0x5f52('0x32')]));_0x2d849a['attributes']=_0x2d849a[_0x5f52('0x33')]['length']?_0x2d849a[_0x5f52('0x33')]:_0x4c89f7[_0x5f52('0x30')];if(_0x1501d7['query']['includeAll']){_0x2d849a[_0x5f52('0x3d')]=[{'all':!![]}];}_0x2d849a=_[_0x5f52('0x3b')]({},_0x2d849a,_0x1501d7['options']);return db['VoiceTransferReport'][_0x5f52('0x42')](_0x2d849a)[_0x5f52('0x22')](handleEntityNotFound(_0x9e1797,null))['then'](respondWithResult(_0x9e1797,null))[_0x5f52('0x40')](handleError(_0x9e1797,null));};exports[_0x5f52('0x43')]=function(_0x43496f,_0x2ca3b2){return db['VoiceTransferReport']['create'](_0x43496f[_0x5f52('0x44')],{})[_0x5f52('0x22')](respondWithResult(_0x2ca3b2,0xc9))[_0x5f52('0x40')](handleError(_0x2ca3b2,null));};exports[_0x5f52('0x21')]=function(_0x4c0d6a,_0x5294b4){if(_0x4c0d6a[_0x5f52('0x44')]['id']){delete _0x4c0d6a[_0x5f52('0x44')]['id'];}return db['VoiceTransferReport'][_0x5f52('0x42')]({'where':{'id':_0x4c0d6a[_0x5f52('0x41')]['id']}})[_0x5f52('0x22')](handleEntityNotFound(_0x5294b4,null))[_0x5f52('0x22')](saveUpdates(_0x4c0d6a[_0x5f52('0x44')],null))[_0x5f52('0x22')](respondWithResult(_0x5294b4,null))[_0x5f52('0x40')](handleError(_0x5294b4,null));};exports[_0x5f52('0x45')]=function(_0x1593da,_0x361b7e){return db[_0x5f52('0x29')][_0x5f52('0x42')]({'where':{'id':_0x1593da[_0x5f52('0x41')]['id']}})[_0x5f52('0x22')](handleEntityNotFound(_0x361b7e,null))['then'](removeEntity(_0x361b7e,null))[_0x5f52('0x40')](handleError(_0x361b7e,null));};exports['describe']=function(_0x2396c7,_0x528637){return db[_0x5f52('0x29')][_0x5f52('0x46')]()[_0x5f52('0x22')](respondWithResult(_0x528637,null))['catch'](handleError(_0x528637,null));}; \ No newline at end of file +var _0xb22d=['sort','where','merge','VIRTUAL','filter','findAll','rows','catch','params','rawAttributes','keys','intersection','includeAll','include','options','find','create','body','describe','eml-format','zip-dir','request-promise','moment','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','offset','count','set','Content-Range','save','update','then','destroy','error','stack','name','send','index','map','VoiceTransferReport','type','key','model','query','filters','fields','attributes','length','hasOwnProperty','nolimit','order'];(function(_0x5c49a4,_0x23c8a0){var _0x45076c=function(_0x16e342){while(--_0x16e342){_0x5c49a4['push'](_0x5c49a4['shift']());}};_0x45076c(++_0x23c8a0);}(_0xb22d,0x1db));var _0xdb22=function(_0x57645b,_0x25f73a){_0x57645b=_0x57645b-0x0;var _0xe82f00=_0xb22d[_0x57645b];return _0xe82f00;};'use strict';var emlformat=require(_0xdb22('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xdb22('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xdb22('0x2'));var moment=require(_0xdb22('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xdb22('0x4'));var path=require(_0xdb22('0x5'));var sox=require(_0xdb22('0x6'));var csv=require('to-csv');var ejs=require(_0xdb22('0x7'));var fs=require('fs');var fs_extra=require(_0xdb22('0x8'));var _=require('lodash');var squel=require(_0xdb22('0x9'));var crypto=require(_0xdb22('0xa'));var jsforce=require(_0xdb22('0xb'));var deskjs=require(_0xdb22('0xc'));var toCsv=require(_0xdb22('0xd'));var querystring=require(_0xdb22('0xe'));var Papa=require(_0xdb22('0xf'));var Redis=require(_0xdb22('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xdb22('0x11'));var as=require(_0xdb22('0x12'));var hardwareService=require(_0xdb22('0x13'));var logger=require(_0xdb22('0x14'))(_0xdb22('0x15'));var utils=require('../../config/utils');var config=require(_0xdb22('0x16'));var licenseUtil=require(_0xdb22('0x17'));var db=require(_0xdb22('0x18'))['db'];function respondWithStatusCode(_0x2de374,_0x1af3f0){_0x1af3f0=_0x1af3f0||0xcc;return function(_0x473dab){if(_0x473dab){return _0x2de374[_0xdb22('0x19')](_0x1af3f0);}return _0x2de374['status'](_0x1af3f0)[_0xdb22('0x1a')]();};}function respondWithResult(_0x22fbf9,_0x526571){_0x526571=_0x526571||0xc8;return function(_0x3e4601){if(_0x3e4601){return _0x22fbf9[_0xdb22('0x1b')](_0x526571)[_0xdb22('0x1c')](_0x3e4601);}};}function respondWithFilteredResult(_0x5795bb,_0x3a9067){return function(_0xe5b966){if(_0xe5b966){var _0xe9ac77=typeof _0x3a9067['offset']===_0xdb22('0x1d')&&typeof _0x3a9067[_0xdb22('0x1e')]===_0xdb22('0x1d');var _0x18e852=_0xe5b966['count'];var _0x2dc297=_0xe9ac77?0x0:_0x3a9067[_0xdb22('0x1f')];var _0x3f1b0b=_0xe9ac77?_0xe5b966[_0xdb22('0x20')]:_0x3a9067[_0xdb22('0x1f')]+_0x3a9067['limit'];var _0x449508;if(_0x3f1b0b>=_0x18e852){_0x3f1b0b=_0x18e852;_0x449508=0xc8;}else{_0x449508=0xce;}_0x5795bb[_0xdb22('0x1b')](_0x449508);return _0x5795bb[_0xdb22('0x21')](_0xdb22('0x22'),_0x2dc297+'-'+_0x3f1b0b+'/'+_0x18e852)[_0xdb22('0x1c')](_0xe5b966);}return null;};}function patchUpdates(_0x48eaff){return function(_0x44ba5d){try{jsonpatch['apply'](_0x44ba5d,_0x48eaff,!![]);}catch(_0x2c61f5){return BPromise['reject'](_0x2c61f5);}return _0x44ba5d[_0xdb22('0x23')]();};}function saveUpdates(_0x1a319d,_0x435716){return function(_0x438976){if(_0x438976){return _0x438976[_0xdb22('0x24')](_0x1a319d)[_0xdb22('0x25')](function(_0x2aab20){return _0x2aab20;});}return null;};}function removeEntity(_0x50d585,_0x2373ae){return function(_0x16a6d5){if(_0x16a6d5){return _0x16a6d5[_0xdb22('0x26')]()['then'](function(){_0x50d585['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2efed8,_0x221a51){return function(_0x262d64){if(!_0x262d64){_0x2efed8[_0xdb22('0x19')](0x194);}return _0x262d64;};}function handleError(_0x3870e4,_0x4695e0){_0x4695e0=_0x4695e0||0x1f4;return function(_0x127164){logger[_0xdb22('0x27')](_0x127164[_0xdb22('0x28')]);if(_0x127164[_0xdb22('0x29')]){delete _0x127164[_0xdb22('0x29')];}_0x3870e4[_0xdb22('0x1b')](_0x4695e0)[_0xdb22('0x2a')](_0x127164);};}exports[_0xdb22('0x2b')]=function(_0x482f99,_0x52fe81){var _0x58d3ea={},_0x3d8c87={},_0x469f4c={'count':0x0,'rows':[]};var _0x24afe5=_[_0xdb22('0x2c')](db[_0xdb22('0x2d')]['rawAttributes'],function(_0x161710){return{'name':_0x161710['fieldName'],'type':_0x161710[_0xdb22('0x2e')][_0xdb22('0x2f')]};});_0x3d8c87[_0xdb22('0x30')]=_[_0xdb22('0x2c')](_0x24afe5,_0xdb22('0x29'));_0x3d8c87[_0xdb22('0x31')]=_['keys'](_0x482f99[_0xdb22('0x31')]);_0x3d8c87[_0xdb22('0x32')]=_['intersection'](_0x3d8c87[_0xdb22('0x30')],_0x3d8c87[_0xdb22('0x31')]);_0x58d3ea['attributes']=_['intersection'](_0x3d8c87[_0xdb22('0x30')],qs[_0xdb22('0x33')](_0x482f99[_0xdb22('0x31')][_0xdb22('0x33')]));_0x58d3ea[_0xdb22('0x34')]=_0x58d3ea['attributes'][_0xdb22('0x35')]?_0x58d3ea[_0xdb22('0x34')]:_0x3d8c87[_0xdb22('0x30')];if(!_0x482f99[_0xdb22('0x31')][_0xdb22('0x36')](_0xdb22('0x37'))){_0x58d3ea[_0xdb22('0x1e')]=qs[_0xdb22('0x1e')](_0x482f99[_0xdb22('0x31')][_0xdb22('0x1e')]);_0x58d3ea[_0xdb22('0x1f')]=qs[_0xdb22('0x1f')](_0x482f99[_0xdb22('0x31')][_0xdb22('0x1f')]);}_0x58d3ea[_0xdb22('0x38')]=qs[_0xdb22('0x39')](_0x482f99[_0xdb22('0x31')][_0xdb22('0x39')]);_0x58d3ea[_0xdb22('0x3a')]=qs['filters'](_['pick'](_0x482f99[_0xdb22('0x31')],_0x3d8c87[_0xdb22('0x32')]),_0x24afe5);if(_0x482f99[_0xdb22('0x31')]['filter']){_0x58d3ea[_0xdb22('0x3a')]=_[_0xdb22('0x3b')](_0x58d3ea[_0xdb22('0x3a')],{'$or':_['map'](_0x24afe5,function(_0x10482d){if(_0x10482d[_0xdb22('0x2e')]!==_0xdb22('0x3c')){var _0x30be15={};_0x30be15[_0x10482d[_0xdb22('0x29')]]={'$like':'%'+_0x482f99[_0xdb22('0x31')][_0xdb22('0x3d')]+'%'};return _0x30be15;}})});}_0x58d3ea=_[_0xdb22('0x3b')]({},_0x58d3ea,_0x482f99['options']);var _0x5ccc72={'where':_0x58d3ea[_0xdb22('0x3a')]};return db['VoiceTransferReport']['count'](_0x5ccc72)[_0xdb22('0x25')](function(_0x1414d){_0x469f4c[_0xdb22('0x20')]=_0x1414d;if(_0x482f99[_0xdb22('0x31')]['includeAll']){_0x58d3ea['include']=[{'all':!![]}];}return db['VoiceTransferReport'][_0xdb22('0x3e')](_0x58d3ea);})[_0xdb22('0x25')](function(_0x315fd4){_0x469f4c[_0xdb22('0x3f')]=_0x315fd4;return _0x469f4c;})[_0xdb22('0x25')](respondWithFilteredResult(_0x52fe81,_0x58d3ea))[_0xdb22('0x40')](handleError(_0x52fe81,null));};exports['show']=function(_0x18e62d,_0x51e24f){var _0x353c9b={'raw':!![],'where':{'id':_0x18e62d[_0xdb22('0x41')]['id']}},_0x3b1975={};_0x3b1975[_0xdb22('0x30')]=_['keys'](db[_0xdb22('0x2d')][_0xdb22('0x42')]);_0x3b1975[_0xdb22('0x31')]=_[_0xdb22('0x43')](_0x18e62d[_0xdb22('0x31')]);_0x3b1975['filters']=_[_0xdb22('0x44')](_0x3b1975['model'],_0x3b1975[_0xdb22('0x31')]);_0x353c9b[_0xdb22('0x34')]=_[_0xdb22('0x44')](_0x3b1975[_0xdb22('0x30')],qs[_0xdb22('0x33')](_0x18e62d['query']['fields']));_0x353c9b[_0xdb22('0x34')]=_0x353c9b['attributes'][_0xdb22('0x35')]?_0x353c9b[_0xdb22('0x34')]:_0x3b1975[_0xdb22('0x30')];if(_0x18e62d[_0xdb22('0x31')][_0xdb22('0x45')]){_0x353c9b[_0xdb22('0x46')]=[{'all':!![]}];}_0x353c9b=_[_0xdb22('0x3b')]({},_0x353c9b,_0x18e62d[_0xdb22('0x47')]);return db[_0xdb22('0x2d')][_0xdb22('0x48')](_0x353c9b)['then'](handleEntityNotFound(_0x51e24f,null))[_0xdb22('0x25')](respondWithResult(_0x51e24f,null))[_0xdb22('0x40')](handleError(_0x51e24f,null));};exports[_0xdb22('0x49')]=function(_0x134012,_0x4b08a6){return db[_0xdb22('0x2d')][_0xdb22('0x49')](_0x134012['body'],{})[_0xdb22('0x25')](respondWithResult(_0x4b08a6,0xc9))[_0xdb22('0x40')](handleError(_0x4b08a6,null));};exports['update']=function(_0x2b7d4d,_0x4c7aad){if(_0x2b7d4d['body']['id']){delete _0x2b7d4d[_0xdb22('0x4a')]['id'];}return db[_0xdb22('0x2d')][_0xdb22('0x48')]({'where':{'id':_0x2b7d4d['params']['id']}})[_0xdb22('0x25')](handleEntityNotFound(_0x4c7aad,null))[_0xdb22('0x25')](saveUpdates(_0x2b7d4d[_0xdb22('0x4a')],null))[_0xdb22('0x25')](respondWithResult(_0x4c7aad,null))[_0xdb22('0x40')](handleError(_0x4c7aad,null));};exports[_0xdb22('0x26')]=function(_0x23d9d3,_0x1a7c50){return db[_0xdb22('0x2d')][_0xdb22('0x48')]({'where':{'id':_0x23d9d3['params']['id']}})[_0xdb22('0x25')](handleEntityNotFound(_0x1a7c50,null))[_0xdb22('0x25')](removeEntity(_0x1a7c50,null))[_0xdb22('0x40')](handleError(_0x1a7c50,null));};exports[_0xdb22('0x4b')]=function(_0x542baa,_0x45e6ea){return db[_0xdb22('0x2d')][_0xdb22('0x4b')]()['then'](respondWithResult(_0x45e6ea,null))['catch'](handleError(_0x45e6ea,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index 2ce0991..73dac7e 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 _0x0cde=['report_call_transfer','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','exports','define','VoiceTransferReport'];(function(_0x1fd9e7,_0x24cdbe){var _0x1781f2=function(_0x2bd0a3){while(--_0x2bd0a3){_0x1fd9e7['push'](_0x1fd9e7['shift']());}};_0x1781f2(++_0x24cdbe);}(_0x0cde,0xb1));var _0xe0cd=function(_0x32cf95,_0x22e926){_0x32cf95=_0x32cf95-0x0;var _0x14fcea=_0x0cde[_0x32cf95];return _0x14fcea;};'use strict';var _=require('lodash');var util=require(_0xe0cd('0x0'));var logger=require(_0xe0cd('0x1'))(_0xe0cd('0x2'));var moment=require(_0xe0cd('0x3'));var BPromise=require(_0xe0cd('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xe0cd('0x5'));var config=require(_0xe0cd('0x6'));var attributes=require('./voiceTransferReport.attributes');module[_0xe0cd('0x7')]=function(_0x5c1e0a,_0x16d429){return _0x5c1e0a[_0xe0cd('0x8')](_0xe0cd('0x9'),attributes,{'tableName':_0xe0cd('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0ec2=['rimraf','../../config/environment','define','VoiceTransferReport','report_call_transfer','util','../../config/logger','api','bluebird','path'];(function(_0x1036ef,_0x470bde){var _0x437128=function(_0x1f5931){while(--_0x1f5931){_0x1036ef['push'](_0x1036ef['shift']());}};_0x437128(++_0x470bde);}(_0x0ec2,0x1bd));var _0x20ec=function(_0x126fb9,_0x122c59){_0x126fb9=_0x126fb9-0x0;var _0xc8a3b1=_0x0ec2[_0x126fb9];return _0xc8a3b1;};'use strict';var _=require('lodash');var util=require(_0x20ec('0x0'));var logger=require(_0x20ec('0x1'))(_0x20ec('0x2'));var moment=require('moment');var BPromise=require(_0x20ec('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x20ec('0x4'));var rimraf=require(_0x20ec('0x5'));var config=require(_0x20ec('0x6'));var attributes=require('./voiceTransferReport.attributes');module['exports']=function(_0x50a46e,_0x3f4464){return _0x50a46e[_0x20ec('0x7')](_0x20ec('0x8'),attributes,{'tableName':_0x20ec('0x9'),'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 96c891f..eabc546 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 _0xf5f5=['rpc','jayson/promise','http','request','then','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','VoiceTransferReport','create','body','options','raw','catch','CreateVoiceTransferReport','util','bluebird','randomstring','../../config/logger'];(function(_0x8e8ca7,_0x5a5e07){var _0x561381=function(_0x2f4bda){while(--_0x2f4bda){_0x8e8ca7['push'](_0x8e8ca7['shift']());}};_0x561381(++_0x5a5e07);}(_0xf5f5,0x100));var _0x5f5f=function(_0xa9c3f4,_0x4977bf){_0xa9c3f4=_0xa9c3f4-0x0;var _0x1b6eec=_0xf5f5[_0xa9c3f4];return _0x1b6eec;};'use strict';var _=require('lodash');var util=require(_0x5f5f('0x0'));var moment=require('moment');var BPromise=require(_0x5f5f('0x1'));var rs=require(_0x5f5f('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x5f5f('0x3'))(_0x5f5f('0x4'));var config=require('../../config/environment');var jayson=require(_0x5f5f('0x5'));var client=jayson['client'][_0x5f5f('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x53c026,_0x3f9ad7,_0x5e7453){return new BPromise(function(_0x11b653,_0x5b9e2e){return client[_0x5f5f('0x7')](_0x53c026,_0x5e7453)[_0x5f5f('0x8')](function(_0x47615c){logger[_0x5f5f('0x9')](_0x5f5f('0xa'),_0x3f9ad7,_0x5f5f('0xb'));logger[_0x5f5f('0xc')](_0x5f5f('0xd'),_0x3f9ad7,'request\x20sent',JSON[_0x5f5f('0xe')](_0x47615c));if(_0x47615c[_0x5f5f('0xf')]){if(_0x47615c[_0x5f5f('0xf')][_0x5f5f('0x10')]===0x1f4){logger['error'](_0x5f5f('0xa'),_0x3f9ad7,_0x47615c['error'][_0x5f5f('0x11')]);return _0x5b9e2e(_0x47615c[_0x5f5f('0xf')]['message']);}logger['error'](_0x5f5f('0xa'),_0x3f9ad7,_0x47615c[_0x5f5f('0xf')][_0x5f5f('0x11')]);return _0x11b653(_0x47615c['error'][_0x5f5f('0x11')]);}else{logger[_0x5f5f('0x9')]('VoiceTransferReport,\x20%s,\x20%s',_0x3f9ad7,'request\x20sent');_0x11b653(_0x47615c[_0x5f5f('0x12')][_0x5f5f('0x11')]);}})['catch'](function(_0x5773bc){logger['error']('VoiceTransferReport,\x20%s,\x20%s',_0x3f9ad7,_0x5773bc);_0x5b9e2e(_0x5773bc);});});}exports['CreateVoiceTransferReport']=function(_0x212855){var _0x1a6569=this;return new Promise(function(_0x161f6c,_0x269fed){return db[_0x5f5f('0x13')][_0x5f5f('0x14')](_0x212855[_0x5f5f('0x15')],{'raw':_0x212855[_0x5f5f('0x16')]?_0x212855[_0x5f5f('0x16')][_0x5f5f('0x17')]===undefined?!![]:![]:!![]})[_0x5f5f('0x8')](function(_0x3d5d39){logger[_0x5f5f('0x9')]('CreateVoiceTransferReport',_0x212855);logger[_0x5f5f('0xc')]('CreateVoiceTransferReport',_0x212855,JSON['stringify'](_0x3d5d39));_0x161f6c(_0x3d5d39);})[_0x5f5f('0x18')](function(_0x36fb73){logger['error'](_0x5f5f('0x19'),_0x36fb73['message'],_0x212855);_0x269fed(_0x1a6569[_0x5f5f('0xf')](0x1f4,_0x36fb73[_0x5f5f('0x11')]));});});}; \ No newline at end of file +var _0xd9de=['then','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateVoiceTransferReport','VoiceTransferReport','create','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x441964,_0x1129af){var _0x2bb583=function(_0x542194){while(--_0x542194){_0x441964['push'](_0x441964['shift']());}};_0x2bb583(++_0x1129af);}(_0xd9de,0x138));var _0xed9d=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xd9de[_0x2dafbe];return _0x58a45a;};'use strict';var _=require('lodash');var util=require(_0xed9d('0x0'));var moment=require(_0xed9d('0x1'));var BPromise=require(_0xed9d('0x2'));var rs=require(_0xed9d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xed9d('0x4'))['db'];var utils=require(_0xed9d('0x5'));var logger=require(_0xed9d('0x6'))(_0xed9d('0x7'));var config=require(_0xed9d('0x8'));var jayson=require(_0xed9d('0x9'));var client=jayson[_0xed9d('0xa')][_0xed9d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1d7dee,_0x4d9806,_0xbf9a2e){return new BPromise(function(_0x38bf9e,_0x5f1c7c){return client['request'](_0x1d7dee,_0xbf9a2e)[_0xed9d('0xc')](function(_0x3bbd01){logger[_0xed9d('0xd')](_0xed9d('0xe'),_0x4d9806,_0xed9d('0xf'));logger[_0xed9d('0x10')](_0xed9d('0x11'),_0x4d9806,_0xed9d('0xf'),JSON[_0xed9d('0x12')](_0x3bbd01));if(_0x3bbd01[_0xed9d('0x13')]){if(_0x3bbd01['error'][_0xed9d('0x14')]===0x1f4){logger[_0xed9d('0x13')](_0xed9d('0xe'),_0x4d9806,_0x3bbd01[_0xed9d('0x13')][_0xed9d('0x15')]);return _0x5f1c7c(_0x3bbd01[_0xed9d('0x13')][_0xed9d('0x15')]);}logger[_0xed9d('0x13')](_0xed9d('0xe'),_0x4d9806,_0x3bbd01[_0xed9d('0x13')]['message']);return _0x38bf9e(_0x3bbd01[_0xed9d('0x13')]['message']);}else{logger['info'](_0xed9d('0xe'),_0x4d9806,_0xed9d('0xf'));_0x38bf9e(_0x3bbd01[_0xed9d('0x16')]['message']);}})[_0xed9d('0x17')](function(_0x165a29){logger['error'](_0xed9d('0xe'),_0x4d9806,_0x165a29);_0x5f1c7c(_0x165a29);});});}exports[_0xed9d('0x18')]=function(_0x51c3c2){var _0x5c8bff=this;return new Promise(function(_0x39a63d,_0x1e7264){return db[_0xed9d('0x19')][_0xed9d('0x1a')](_0x51c3c2['body'],{'raw':_0x51c3c2['options']?_0x51c3c2['options']['raw']===undefined?!![]:![]:!![]})[_0xed9d('0xc')](function(_0x3b0583){logger['info'](_0xed9d('0x18'),_0x51c3c2);logger['debug'](_0xed9d('0x18'),_0x51c3c2,JSON[_0xed9d('0x12')](_0x3b0583));_0x39a63d(_0x3b0583);})[_0xed9d('0x17')](function(_0x24a570){logger[_0xed9d('0x13')](_0xed9d('0x18'),_0x24a570[_0xed9d('0x15')],_0x51c3c2);_0x1e7264(_0x5c8bff[_0xed9d('0x13')](0x1f4,_0x24a570[_0xed9d('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index 80a96b1..e779f2a 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 _0xcd34=['/originate','isAuthenticated','/hangup','hangup','canUpdate','answer','/hold','hold','unhold','/calls','calls','transfer','exports','Router','./webbar.controller','post'];(function(_0x156172,_0x346275){var _0x1db8d3=function(_0x40210a){while(--_0x40210a){_0x156172['push'](_0x156172['shift']());}};_0x1db8d3(++_0x346275);}(_0xcd34,0xcd));var _0x4cd3=function(_0xc1bcfc,_0x1a6672){_0xc1bcfc=_0xc1bcfc-0x0;var _0x53cbc0=_0xcd34[_0xc1bcfc];return _0x53cbc0;};'use strict';var express=require('express');var router=express[_0x4cd3('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0x4cd3('0x1'));router[_0x4cd3('0x2')](_0x4cd3('0x3'),auth[_0x4cd3('0x4')](),auth['canUpdate'](),controller['originate']);router[_0x4cd3('0x2')](_0x4cd3('0x5'),auth[_0x4cd3('0x4')](),auth['canUpdate'](),controller[_0x4cd3('0x6')]);router[_0x4cd3('0x2')]('/answer',auth['isAuthenticated'](),auth[_0x4cd3('0x7')](),controller[_0x4cd3('0x8')]);router[_0x4cd3('0x2')](_0x4cd3('0x9'),auth['isAuthenticated'](),auth[_0x4cd3('0x7')](),controller[_0x4cd3('0xa')]);router[_0x4cd3('0x2')]('/unhold',auth['isAuthenticated'](),auth[_0x4cd3('0x7')](),controller[_0x4cd3('0xb')]);router[_0x4cd3('0x2')](_0x4cd3('0xc'),auth[_0x4cd3('0x4')](),auth['canUpdate'](),controller[_0x4cd3('0xd')]);router[_0x4cd3('0x2')]('/transfer',auth[_0x4cd3('0x4')](),auth[_0x4cd3('0x7')](),controller[_0x4cd3('0xe')]);module[_0x4cd3('0xf')]=router; \ No newline at end of file +var _0xbb3c=['exports','express','Router','../../components/auth/service','post','/originate','isAuthenticated','canUpdate','originate','/hangup','/answer','answer','/hold','hold','/unhold','unhold','/calls','calls','/transfer','transfer'];(function(_0x5f49a2,_0x54b7ed){var _0x2e49ac=function(_0x5d3c59){while(--_0x5d3c59){_0x5f49a2['push'](_0x5f49a2['shift']());}};_0x2e49ac(++_0x54b7ed);}(_0xbb3c,0x1cd));var _0xcbb3=function(_0x40d16f,_0x48009c){_0x40d16f=_0x40d16f-0x0;var _0x48e512=_0xbb3c[_0x40d16f];return _0x48e512;};'use strict';var express=require(_0xcbb3('0x0'));var router=express[_0xcbb3('0x1')]();var auth=require(_0xcbb3('0x2'));var controller=require('./webbar.controller');router[_0xcbb3('0x3')](_0xcbb3('0x4'),auth[_0xcbb3('0x5')](),auth[_0xcbb3('0x6')](),controller[_0xcbb3('0x7')]);router[_0xcbb3('0x3')](_0xcbb3('0x8'),auth[_0xcbb3('0x5')](),auth[_0xcbb3('0x6')](),controller['hangup']);router[_0xcbb3('0x3')](_0xcbb3('0x9'),auth[_0xcbb3('0x5')](),auth['canUpdate'](),controller[_0xcbb3('0xa')]);router[_0xcbb3('0x3')](_0xcbb3('0xb'),auth[_0xcbb3('0x5')](),auth[_0xcbb3('0x6')](),controller[_0xcbb3('0xc')]);router['post'](_0xcbb3('0xd'),auth[_0xcbb3('0x5')](),auth[_0xcbb3('0x6')](),controller[_0xcbb3('0xe')]);router[_0xcbb3('0x3')](_0xcbb3('0xf'),auth['isAuthenticated'](),auth[_0xcbb3('0x6')](),controller[_0xcbb3('0x10')]);router['post'](_0xcbb3('0x11'),auth[_0xcbb3('0x5')](),auth['canUpdate'](),controller[_0xcbb3('0x12')]);module[_0xcbb3('0x13')]=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index b36b890..69421c1 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 _0xbf6e=['bluebird','jayson/promise','client','http','webbarapi','ioredis','redis','defaults','localhost','socket.io-emitter','validate','number','userId\x20is\x20required','callNumber\x20is\x20required','string','transferNumber\x20is\x20required','info','stringify','emit','log','stack','name','status','send','NotFound','request','then','error','code','message','result','catch','User','agent','VoiceChannels','all','rows','sessionId','length','sessionId\x20','\x20not\x20found!','originate','originate\x20fired:','body','json','userId','callNumber','callerId','callbackUrl','entityFound:','format','user:%s','webbar:originate','originate\x20executed!','hangup','hangup\x20fired:','webbar:hangup','hangup\x20executed!','answer','webbar:answer','answer\x20executed!','hold','hold\x20fired:','webbar:hold','hold\x20executed!','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls','calls\x20fired:','filter','UserId','conference\x20fired:','webbar:conference','conference\x20executed!','transfer','transfer\x20fired:','transferNumber','webbar:transfer','transfer\x20executed!','../../mysqldb','../../config/environment','util'];(function(_0xbbdd8a,_0x4a89c1){var _0x4c0ec8=function(_0x381a12){while(--_0x381a12){_0xbbdd8a['push'](_0xbbdd8a['shift']());}};_0x4c0ec8(++_0x4a89c1);}(_0xbf6e,0x149));var _0xebf6=function(_0x179a53,_0x1b05d2){_0x179a53=_0x179a53-0x0;var _0x2597d8=_0xbf6e[_0x179a53];return _0x2597d8;};'use strict';var path=require('path');var fs=require('fs');var _=require('lodash');var db=require(_0xebf6('0x0'))['db'];var config=require(_0xebf6('0x1'));var util=require(_0xebf6('0x2'));var BPromise=require(_0xebf6('0x3'));var jayson=require(_0xebf6('0x4'));var amiClient=jayson[_0xebf6('0x5')][_0xebf6('0x6')]({'port':0x232a});var logger=require('../../config/logger')(_0xebf6('0x7'));var Redis=require(_0xebf6('0x8'));config[_0xebf6('0x9')]=_[_0xebf6('0xa')](config[_0xebf6('0x9')],{'host':_0xebf6('0xb'),'port':0x18eb});var io=require(_0xebf6('0xc'))(new Redis(config['redis']));var Schema=require(_0xebf6('0xd'));var originateValidation=new Schema({'userId':{'type':_0xebf6('0xe'),'required':[!![],_0xebf6('0xf')]},'callNumber':{'type':'string','required':[!![],_0xebf6('0x10')]},'callerId':{'type':_0xebf6('0x11')},'callbackUrl':{'type':'string'}});var hangupValidation=new Schema({'userId':{'type':_0xebf6('0xe'),'required':[!![],_0xebf6('0xf')]},'sessionId':{'type':_0xebf6('0x11'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0xebf6('0xe'),'required':[!![],_0xebf6('0xf')]},'sessionId':{'type':_0xebf6('0x11'),'required':![]}});var transferValidation=new Schema({'userId':{'type':'number','required':[!![],_0xebf6('0xf')]},'sessionId':{'type':_0xebf6('0x11'),'required':[!![],'sessionId\x20is\x20required']},'transferNumber':{'type':_0xebf6('0x11'),'required':[!![],_0xebf6('0x12')]}});var holdValidation=new Schema({'userId':{'type':_0xebf6('0xe'),'required':[!![],_0xebf6('0xf')]},'sessionId':{'type':_0xebf6('0x11'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'sessionId':{'type':'string','required':![]}});var callsValidation=new Schema({'userId':{'type':_0xebf6('0xe'),'required':[!![],_0xebf6('0xf')]}});var conferenceValidation=new Schema({'userId':{'type':'number','required':[!![],_0xebf6('0xf')]}});function emit(_0x2c980f,_0xb164a1,_0x642167){logger[_0xebf6('0x13')](_0x2c980f,_0xb164a1,JSON[_0xebf6('0x14')](_0x642167));io['to'](_0x2c980f)[_0xebf6('0x15')](_0xb164a1,_0x642167);}function handleError(_0x2dc96f){return function(_0x2d3984){console[_0xebf6('0x16')]('handleError:',_0x2d3984,_0x2d3984 instanceof RangeError);logger['error'](_0x2d3984[_0xebf6('0x17')]);if(_0x2d3984 instanceof RangeError){if(_0x2d3984[_0xebf6('0x18')]){delete _0x2d3984[_0xebf6('0x18')];}_0x2dc96f[_0xebf6('0x19')](0x194)[_0xebf6('0x1a')](_0x2d3984);}else{if(_0x2d3984[_0xebf6('0x18')]){delete _0x2d3984[_0xebf6('0x18')];}_0x2dc96f[_0xebf6('0x19')](0x1f4)['send'](_0x2d3984);}};}function checkError(){return function(_0xbe39dd){if(!_0xbe39dd){throw new RangeError(_0xebf6('0x1b'));}return _0xbe39dd;};}function respondWithRpcPromise(_0x377934,_0x23d487){return new BPromise(function(_0x6303ac,_0x14c8ac){var _0x2f419e=amiClient;return _0x2f419e[_0xebf6('0x1c')](_0x377934,_0x23d487)[_0xebf6('0x1d')](function(_0x2e32c6){if(_0x2e32c6[_0xebf6('0x1e')]){if(_0x2e32c6[_0xebf6('0x1e')][_0xebf6('0x1f')]===0x1f4){return _0x14c8ac(_0x2e32c6[_0xebf6('0x1e')][_0xebf6('0x20')]);}return _0x6303ac(_0x2e32c6[_0xebf6('0x1e')][_0xebf6('0x20')]);}else{_0x6303ac(_0x2e32c6[_0xebf6('0x21')]);}})[_0xebf6('0x22')](function(_0x4dadf7){_0x14c8ac(_0x4dadf7);});});}function getAgent(_0x58fb66){return db[_0xebf6('0x23')]['findOne']({'where':{'id':_0x58fb66,'role':_0xebf6('0x24')}})[_0xebf6('0x1d')](checkError());}function getAgentCheckSession(_0x5a01ea,_0x4f39eb){return new BPromise(function(_0x37950c,_0x40ae57){var _0x3c3d5c=respondWithRpcPromise(_0xebf6('0x25'));var _0xedaaeb=getAgent(_0x5a01ea);Promise[_0xebf6('0x26')]([_0x3c3d5c,_0xedaaeb])[_0xebf6('0x1d')](function(_0x7551ce){var _0x4c3495=_0x7551ce[0x0];var _0x37cd67=_0x7551ce[0x1];var _0x78cdf0=_['filter'](_0x4c3495[_0xebf6('0x27')],function(_0x28bbea){return _0x28bbea['UserId']==_0x37cd67['id']&&_0x28bbea[_0xebf6('0x28')]==_0x4f39eb;});if(_0x78cdf0[_0xebf6('0x29')]==0x1){_0x37950c(_0x37cd67);}else{_0x40ae57(new RangeError(_0xebf6('0x2a')+_0x4f39eb+_0xebf6('0x2b')));}});});}exports[_0xebf6('0x2c')]=function(_0x41da63,_0x4907d0){logger[_0xebf6('0x13')](_0xebf6('0x2d'),_0x41da63['body']);var _0x534142=originateValidation[_0xebf6('0xd')](_0x41da63[_0xebf6('0x2e')]);if(_0x534142['length']>0x0){return _0x4907d0[_0xebf6('0x19')](0x190)[_0xebf6('0x2f')](_0x534142);}var _0x4d736c=_0x41da63[_0xebf6('0x2e')][_0xebf6('0x30')];var _0x12bd27=_0x41da63['body'][_0xebf6('0x31')];var _0x20192c=_0x41da63[_0xebf6('0x2e')][_0xebf6('0x32')];var _0x4b6d95=_0x41da63['body'][_0xebf6('0x33')];return getAgent(_0x4d736c)[_0xebf6('0x1d')](function(_0x562f76){logger[_0xebf6('0x13')](_0xebf6('0x34'),_0x562f76['name']);emit(util[_0xebf6('0x35')](_0xebf6('0x36'),_0x562f76[_0xebf6('0x18')]),_0xebf6('0x37'),{'callNumber':_0x12bd27,'callerId':_0x20192c,'callbackUrl':_0x4b6d95});return _0x4907d0[_0xebf6('0x19')](0xc8)['json']({'error':![],'message':_0xebf6('0x38')});})['catch'](handleError(_0x4907d0));};exports[_0xebf6('0x39')]=function(_0x54702d,_0xafef4d){logger[_0xebf6('0x13')](_0xebf6('0x3a'),_0x54702d[_0xebf6('0x2e')]);var _0x2f1236=hangupValidation[_0xebf6('0xd')](_0x54702d['body']);if(_0x2f1236[_0xebf6('0x29')]>0x0){return _0xafef4d[_0xebf6('0x19')](0x190)[_0xebf6('0x2f')](_0x2f1236);}var _0x144b41=_0x54702d[_0xebf6('0x2e')][_0xebf6('0x30')];var _0x49f089=_0x54702d[_0xebf6('0x2e')][_0xebf6('0x28')];return getAgent(_0x144b41)[_0xebf6('0x1d')](function(_0x111ff7){logger[_0xebf6('0x13')](_0xebf6('0x34'),_0x111ff7['name']);emit(util['format']('user:%s',_0x111ff7[_0xebf6('0x18')]),_0xebf6('0x3b'),{'sessionId':_0x49f089});return _0xafef4d[_0xebf6('0x19')](0xc8)['json']({'error':![],'message':_0xebf6('0x3c')});})[_0xebf6('0x22')](handleError(_0xafef4d));};exports[_0xebf6('0x3d')]=function(_0x5ca582,_0x8cca55){logger[_0xebf6('0x13')]('answer\x20fired:',_0x5ca582[_0xebf6('0x2e')]);var _0x1de50e=answerValidation[_0xebf6('0xd')](_0x5ca582['body']);if(_0x1de50e[_0xebf6('0x29')]>0x0){return _0x8cca55['status'](0x190)['json'](_0x1de50e);}var _0x256552=_0x5ca582[_0xebf6('0x2e')][_0xebf6('0x30')];var _0x2ac140=_0x5ca582['body'][_0xebf6('0x28')];return getAgent(_0x256552)['then'](function(_0x4483d2){logger[_0xebf6('0x13')](_0xebf6('0x34'),_0x4483d2[_0xebf6('0x18')]);emit(util[_0xebf6('0x35')]('user:%s',_0x4483d2['name']),_0xebf6('0x3e'),{'sessionId':_0x2ac140});return _0x8cca55[_0xebf6('0x19')](0xc8)[_0xebf6('0x2f')]({'error':![],'message':_0xebf6('0x3f')});})['catch'](handleError(_0x8cca55));};exports[_0xebf6('0x40')]=function(_0x21999e,_0x41c4ce){logger[_0xebf6('0x13')](_0xebf6('0x41'),_0x21999e[_0xebf6('0x2e')]);var _0x45e0f1=holdValidation['validate'](_0x21999e[_0xebf6('0x2e')]);if(_0x45e0f1[_0xebf6('0x29')]>0x0){return _0x41c4ce[_0xebf6('0x19')](0x190)[_0xebf6('0x2f')](_0x45e0f1);}var _0x166664=_0x21999e[_0xebf6('0x2e')][_0xebf6('0x30')];var _0x56b26b=_0x21999e[_0xebf6('0x2e')]['sessionId'];return getAgent(_0x166664)[_0xebf6('0x1d')](function(_0x31d8ba){logger['info'](_0xebf6('0x34'),_0x31d8ba['name']);emit(util[_0xebf6('0x35')](_0xebf6('0x36'),_0x31d8ba[_0xebf6('0x18')]),_0xebf6('0x42'),{'sessionId':_0x56b26b});return _0x41c4ce[_0xebf6('0x19')](0xc8)['json']({'error':![],'message':_0xebf6('0x43')});})[_0xebf6('0x22')](handleError(_0x41c4ce));};exports['unhold']=function(_0x1f98fd,_0x2765f2){logger[_0xebf6('0x13')](_0xebf6('0x44'),_0x1f98fd[_0xebf6('0x2e')]);var _0x549892=unholdValidation[_0xebf6('0xd')](_0x1f98fd[_0xebf6('0x2e')]);if(_0x549892[_0xebf6('0x29')]>0x0){return _0x2765f2[_0xebf6('0x19')](0x190)['json'](_0x549892);}var _0x3629aa=_0x1f98fd[_0xebf6('0x2e')][_0xebf6('0x30')];var _0x303997=_0x1f98fd[_0xebf6('0x2e')][_0xebf6('0x28')];return getAgent(_0x3629aa)[_0xebf6('0x1d')](function(_0x9184ce){logger[_0xebf6('0x13')]('entityFound:',_0x9184ce[_0xebf6('0x18')]);emit(util[_0xebf6('0x35')](_0xebf6('0x36'),_0x9184ce['name']),_0xebf6('0x45'),{'sessionId':_0x303997});return _0x2765f2['status'](0xc8)['json']({'error':![],'message':_0xebf6('0x46')});})[_0xebf6('0x22')](handleError(_0x2765f2));};exports[_0xebf6('0x47')]=function(_0x32baee,_0x13c447){logger['info'](_0xebf6('0x48'),_0x13c447['body']);var _0x4ed306=callsValidation['validate'](_0x32baee[_0xebf6('0x2e')]);if(_0x4ed306[_0xebf6('0x29')]>0x0){return _0x13c447['status'](0x190)[_0xebf6('0x2f')](_0x4ed306);}var _0x151476=_0x32baee[_0xebf6('0x2e')][_0xebf6('0x30')];var _0x3a4b20=respondWithRpcPromise(_0xebf6('0x25'));var _0x246f9f=getAgent(_0x151476);return Promise['all']([_0x3a4b20,_0x246f9f])[_0xebf6('0x1d')](function(_0xddf329){var _0x40d85f=_0xddf329[0x0];var _0x3101c2=_0xddf329[0x1];var _0x39637b=_[_0xebf6('0x49')](_0x40d85f['rows'],function(_0x44a46f){return _0x44a46f[_0xebf6('0x4a')]==_0x3101c2['id'];});return _0x13c447[_0xebf6('0x19')](0xc8)[_0xebf6('0x2f')]({'count':_0x39637b[_0xebf6('0x29')],'rows':_0x39637b});})[_0xebf6('0x22')](handleError(_0x13c447));};exports['conference']=function(_0x33c973,_0x193e5b){logger[_0xebf6('0x13')](_0xebf6('0x4b'),_0x33c973[_0xebf6('0x2e')]);var _0x537751=conferenceValidation[_0xebf6('0xd')](_0x33c973[_0xebf6('0x2e')]);if(_0x537751[_0xebf6('0x29')]>0x0){return _0x193e5b[_0xebf6('0x19')](0x190)[_0xebf6('0x2f')](_0x537751);}var _0x6c43e4=_0x33c973[_0xebf6('0x2e')][_0xebf6('0x30')];return getAgent(_0x6c43e4)[_0xebf6('0x1d')](function(_0x3debd2){logger[_0xebf6('0x13')]('entityFound:',_0x3debd2[_0xebf6('0x18')]);emit(util[_0xebf6('0x35')](_0xebf6('0x36'),_0x3debd2[_0xebf6('0x18')]),_0xebf6('0x4c'));return _0x193e5b[_0xebf6('0x19')](0xc8)['json']({'error':![],'message':_0xebf6('0x4d')});})['catch'](handleError(_0x193e5b));};exports[_0xebf6('0x4e')]=function(_0x34fa02,_0x10272b){logger[_0xebf6('0x13')](_0xebf6('0x4f'),_0x34fa02[_0xebf6('0x2e')]);var _0x398074=transferValidation['validate'](_0x34fa02['body']);if(_0x398074[_0xebf6('0x29')]>0x0){return _0x10272b[_0xebf6('0x19')](0x190)['json'](_0x398074);}var _0x3dc02c=_0x34fa02[_0xebf6('0x2e')]['userId'];var _0x3bee09=_0x34fa02[_0xebf6('0x2e')]['sessionId'];var _0x35a5c4=_0x34fa02[_0xebf6('0x2e')][_0xebf6('0x50')];return getAgent(_0x3dc02c)[_0xebf6('0x1d')](function(_0x345763){logger[_0xebf6('0x13')](_0xebf6('0x34'),_0x345763['name']);emit(util[_0xebf6('0x35')](_0xebf6('0x36'),_0x345763[_0xebf6('0x18')]),_0xebf6('0x51'),{'sessionId':_0x3bee09,'transferNumber':_0x35a5c4});return _0x10272b[_0xebf6('0x19')](0xc8)[_0xebf6('0x2f')]({'error':![],'message':_0xebf6('0x52')});})[_0xebf6('0x22')](handleError(_0x10272b));}; \ No newline at end of file +var _0x3a25=['originate','originate\x20fired:','body','userId','callNumber','callerId','user:%s','webbar:originate','originate\x20executed!','hangup','hangup\x20fired:','json','format','webbar:hangup','catch','answer','answer\x20fired:','entityFound:','hold','webbar:hold','hold\x20executed!','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls','calls\x20fired:','conference\x20fired:','webbar:conference','conference\x20executed!','transfer','transferNumber','webbar:transfer','transfer\x20executed!','path','lodash','../../mysqldb','../../config/environment','util','bluebird','jayson/promise','client','http','../../config/logger','webbarapi','ioredis','redis','defaults','socket.io-emitter','validate','number','userId\x20is\x20required','string','callNumber\x20is\x20required','transferNumber\x20is\x20required','info','log','handleError:','error','stack','status','send','name','request','then','code','message','result','User','findOne','agent','VoiceChannels','all','filter','rows','UserId','sessionId','length','sessionId\x20','\x20not\x20found!'];(function(_0x43bfa3,_0xf38911){var _0x349e04=function(_0xbe5b69){while(--_0xbe5b69){_0x43bfa3['push'](_0x43bfa3['shift']());}};_0x349e04(++_0xf38911);}(_0x3a25,0x15d));var _0x53a2=function(_0x649c30,_0x595a71){_0x649c30=_0x649c30-0x0;var _0x40ebea=_0x3a25[_0x649c30];return _0x40ebea;};'use strict';var path=require(_0x53a2('0x0'));var fs=require('fs');var _=require(_0x53a2('0x1'));var db=require(_0x53a2('0x2'))['db'];var config=require(_0x53a2('0x3'));var util=require(_0x53a2('0x4'));var BPromise=require(_0x53a2('0x5'));var jayson=require(_0x53a2('0x6'));var amiClient=jayson[_0x53a2('0x7')][_0x53a2('0x8')]({'port':0x232a});var logger=require(_0x53a2('0x9'))(_0x53a2('0xa'));var Redis=require(_0x53a2('0xb'));config[_0x53a2('0xc')]=_[_0x53a2('0xd')](config[_0x53a2('0xc')],{'host':'localhost','port':0x18eb});var io=require(_0x53a2('0xe'))(new Redis(config['redis']));var Schema=require(_0x53a2('0xf'));var originateValidation=new Schema({'userId':{'type':_0x53a2('0x10'),'required':[!![],_0x53a2('0x11')]},'callNumber':{'type':_0x53a2('0x12'),'required':[!![],_0x53a2('0x13')]},'callerId':{'type':_0x53a2('0x12')},'callbackUrl':{'type':_0x53a2('0x12')}});var hangupValidation=new Schema({'userId':{'type':_0x53a2('0x10'),'required':[!![],_0x53a2('0x11')]},'sessionId':{'type':_0x53a2('0x12'),'required':![]}});var answerValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x53a2('0x12'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x53a2('0x10'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':'string','required':[!![],'sessionId\x20is\x20required']},'transferNumber':{'type':_0x53a2('0x12'),'required':[!![],_0x53a2('0x14')]}});var holdValidation=new Schema({'userId':{'type':_0x53a2('0x10'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':'string','required':![]}});var unholdValidation=new Schema({'userId':{'type':'number','required':[!![],_0x53a2('0x11')]},'sessionId':{'type':_0x53a2('0x12'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x53a2('0x10'),'required':[!![],_0x53a2('0x11')]}});var conferenceValidation=new Schema({'userId':{'type':'number','required':[!![],_0x53a2('0x11')]}});function emit(_0x3343d3,_0x4401b7,_0x42db86){logger[_0x53a2('0x15')](_0x3343d3,_0x4401b7,JSON['stringify'](_0x42db86));io['to'](_0x3343d3)['emit'](_0x4401b7,_0x42db86);}function handleError(_0xeff339){return function(_0x446b71){console[_0x53a2('0x16')](_0x53a2('0x17'),_0x446b71,_0x446b71 instanceof RangeError);logger[_0x53a2('0x18')](_0x446b71[_0x53a2('0x19')]);if(_0x446b71 instanceof RangeError){if(_0x446b71['name']){delete _0x446b71['name'];}_0xeff339[_0x53a2('0x1a')](0x194)[_0x53a2('0x1b')](_0x446b71);}else{if(_0x446b71['name']){delete _0x446b71[_0x53a2('0x1c')];}_0xeff339[_0x53a2('0x1a')](0x1f4)[_0x53a2('0x1b')](_0x446b71);}};}function checkError(){return function(_0x39e384){if(!_0x39e384){throw new RangeError('NotFound');}return _0x39e384;};}function respondWithRpcPromise(_0x32a804,_0x372f7e){return new BPromise(function(_0xd9693c,_0x2cda68){var _0x42df19=amiClient;return _0x42df19[_0x53a2('0x1d')](_0x32a804,_0x372f7e)[_0x53a2('0x1e')](function(_0x3a769d){if(_0x3a769d['error']){if(_0x3a769d['error'][_0x53a2('0x1f')]===0x1f4){return _0x2cda68(_0x3a769d[_0x53a2('0x18')][_0x53a2('0x20')]);}return _0xd9693c(_0x3a769d[_0x53a2('0x18')][_0x53a2('0x20')]);}else{_0xd9693c(_0x3a769d[_0x53a2('0x21')]);}})['catch'](function(_0x2dfa00){_0x2cda68(_0x2dfa00);});});}function getAgent(_0x5072b3){return db[_0x53a2('0x22')][_0x53a2('0x23')]({'where':{'id':_0x5072b3,'role':_0x53a2('0x24')}})[_0x53a2('0x1e')](checkError());}function getAgentCheckSession(_0x21325d,_0x41ae20){return new BPromise(function(_0x2f2062,_0x10e271){var _0x18d6df=respondWithRpcPromise(_0x53a2('0x25'));var _0x262eba=getAgent(_0x21325d);Promise[_0x53a2('0x26')]([_0x18d6df,_0x262eba])[_0x53a2('0x1e')](function(_0xf12019){var _0x437916=_0xf12019[0x0];var _0x5a84de=_0xf12019[0x1];var _0x14b24d=_[_0x53a2('0x27')](_0x437916[_0x53a2('0x28')],function(_0x23374b){return _0x23374b[_0x53a2('0x29')]==_0x5a84de['id']&&_0x23374b[_0x53a2('0x2a')]==_0x41ae20;});if(_0x14b24d[_0x53a2('0x2b')]==0x1){_0x2f2062(_0x5a84de);}else{_0x10e271(new RangeError(_0x53a2('0x2c')+_0x41ae20+_0x53a2('0x2d')));}});});}exports[_0x53a2('0x2e')]=function(_0x21d943,_0x4cb93b){logger[_0x53a2('0x15')](_0x53a2('0x2f'),_0x21d943[_0x53a2('0x30')]);var _0x1b16dc=originateValidation[_0x53a2('0xf')](_0x21d943[_0x53a2('0x30')]);if(_0x1b16dc[_0x53a2('0x2b')]>0x0){return _0x4cb93b[_0x53a2('0x1a')](0x190)['json'](_0x1b16dc);}var _0x5d32c4=_0x21d943[_0x53a2('0x30')][_0x53a2('0x31')];var _0x3c2d7e=_0x21d943['body'][_0x53a2('0x32')];var _0x283ba8=_0x21d943[_0x53a2('0x30')][_0x53a2('0x33')];var _0x218956=_0x21d943[_0x53a2('0x30')]['callbackUrl'];return getAgent(_0x5d32c4)[_0x53a2('0x1e')](function(_0x14f236){logger[_0x53a2('0x15')]('entityFound:',_0x14f236[_0x53a2('0x1c')]);emit(util['format'](_0x53a2('0x34'),_0x14f236[_0x53a2('0x1c')]),_0x53a2('0x35'),{'callNumber':_0x3c2d7e,'callerId':_0x283ba8,'callbackUrl':_0x218956});return _0x4cb93b['status'](0xc8)['json']({'error':![],'message':_0x53a2('0x36')});})['catch'](handleError(_0x4cb93b));};exports[_0x53a2('0x37')]=function(_0x397cfb,_0x18d5d6){logger[_0x53a2('0x15')](_0x53a2('0x38'),_0x397cfb[_0x53a2('0x30')]);var _0x4f7792=hangupValidation[_0x53a2('0xf')](_0x397cfb[_0x53a2('0x30')]);if(_0x4f7792['length']>0x0){return _0x18d5d6['status'](0x190)[_0x53a2('0x39')](_0x4f7792);}var _0x480f35=_0x397cfb[_0x53a2('0x30')][_0x53a2('0x31')];var _0x594961=_0x397cfb[_0x53a2('0x30')][_0x53a2('0x2a')];return getAgent(_0x480f35)[_0x53a2('0x1e')](function(_0x1aa50d){logger[_0x53a2('0x15')]('entityFound:',_0x1aa50d[_0x53a2('0x1c')]);emit(util[_0x53a2('0x3a')]('user:%s',_0x1aa50d[_0x53a2('0x1c')]),_0x53a2('0x3b'),{'sessionId':_0x594961});return _0x18d5d6['status'](0xc8)[_0x53a2('0x39')]({'error':![],'message':'hangup\x20executed!'});})[_0x53a2('0x3c')](handleError(_0x18d5d6));};exports[_0x53a2('0x3d')]=function(_0x41689b,_0x15b50b){logger[_0x53a2('0x15')](_0x53a2('0x3e'),_0x41689b['body']);var _0x71a339=answerValidation[_0x53a2('0xf')](_0x41689b[_0x53a2('0x30')]);if(_0x71a339[_0x53a2('0x2b')]>0x0){return _0x15b50b[_0x53a2('0x1a')](0x190)[_0x53a2('0x39')](_0x71a339);}var _0x3790c1=_0x41689b[_0x53a2('0x30')][_0x53a2('0x31')];var _0x1b5fbe=_0x41689b[_0x53a2('0x30')][_0x53a2('0x2a')];return getAgent(_0x3790c1)[_0x53a2('0x1e')](function(_0x1d1c82){logger[_0x53a2('0x15')](_0x53a2('0x3f'),_0x1d1c82['name']);emit(util[_0x53a2('0x3a')](_0x53a2('0x34'),_0x1d1c82['name']),'webbar:answer',{'sessionId':_0x1b5fbe});return _0x15b50b[_0x53a2('0x1a')](0xc8)['json']({'error':![],'message':'answer\x20executed!'});})[_0x53a2('0x3c')](handleError(_0x15b50b));};exports[_0x53a2('0x40')]=function(_0x37432a,_0x3001e2){logger['info']('hold\x20fired:',_0x37432a['body']);var _0x1984fe=holdValidation['validate'](_0x37432a['body']);if(_0x1984fe[_0x53a2('0x2b')]>0x0){return _0x3001e2[_0x53a2('0x1a')](0x190)[_0x53a2('0x39')](_0x1984fe);}var _0x32a6fd=_0x37432a[_0x53a2('0x30')]['userId'];var _0x26ad44=_0x37432a['body'][_0x53a2('0x2a')];return getAgent(_0x32a6fd)[_0x53a2('0x1e')](function(_0x5baa46){logger[_0x53a2('0x15')](_0x53a2('0x3f'),_0x5baa46[_0x53a2('0x1c')]);emit(util[_0x53a2('0x3a')](_0x53a2('0x34'),_0x5baa46[_0x53a2('0x1c')]),_0x53a2('0x41'),{'sessionId':_0x26ad44});return _0x3001e2['status'](0xc8)[_0x53a2('0x39')]({'error':![],'message':_0x53a2('0x42')});})[_0x53a2('0x3c')](handleError(_0x3001e2));};exports['unhold']=function(_0x36df41,_0x71dbbf){logger[_0x53a2('0x15')](_0x53a2('0x43'),_0x36df41[_0x53a2('0x30')]);var _0x567fce=unholdValidation['validate'](_0x36df41[_0x53a2('0x30')]);if(_0x567fce['length']>0x0){return _0x71dbbf[_0x53a2('0x1a')](0x190)[_0x53a2('0x39')](_0x567fce);}var _0x5314c3=_0x36df41['body'][_0x53a2('0x31')];var _0x382eba=_0x36df41[_0x53a2('0x30')]['sessionId'];return getAgent(_0x5314c3)['then'](function(_0x28cc39){logger[_0x53a2('0x15')](_0x53a2('0x3f'),_0x28cc39[_0x53a2('0x1c')]);emit(util[_0x53a2('0x3a')]('user:%s',_0x28cc39[_0x53a2('0x1c')]),_0x53a2('0x44'),{'sessionId':_0x382eba});return _0x71dbbf[_0x53a2('0x1a')](0xc8)[_0x53a2('0x39')]({'error':![],'message':_0x53a2('0x45')});})[_0x53a2('0x3c')](handleError(_0x71dbbf));};exports[_0x53a2('0x46')]=function(_0x52b7ac,_0x41f025){logger['info'](_0x53a2('0x47'),_0x41f025[_0x53a2('0x30')]);var _0x3b91eb=callsValidation[_0x53a2('0xf')](_0x52b7ac['body']);if(_0x3b91eb[_0x53a2('0x2b')]>0x0){return _0x41f025[_0x53a2('0x1a')](0x190)[_0x53a2('0x39')](_0x3b91eb);}var _0x2b6ab8=_0x52b7ac[_0x53a2('0x30')][_0x53a2('0x31')];var _0x53327b=respondWithRpcPromise(_0x53a2('0x25'));var _0x41a177=getAgent(_0x2b6ab8);return Promise[_0x53a2('0x26')]([_0x53327b,_0x41a177])[_0x53a2('0x1e')](function(_0x19518d){var _0x26c687=_0x19518d[0x0];var _0x22f40d=_0x19518d[0x1];var _0x50acc5=_[_0x53a2('0x27')](_0x26c687['rows'],function(_0x179812){return _0x179812[_0x53a2('0x29')]==_0x22f40d['id'];});return _0x41f025[_0x53a2('0x1a')](0xc8)['json']({'count':_0x50acc5[_0x53a2('0x2b')],'rows':_0x50acc5});})[_0x53a2('0x3c')](handleError(_0x41f025));};exports['conference']=function(_0x1be4ee,_0x4cb008){logger[_0x53a2('0x15')](_0x53a2('0x48'),_0x1be4ee[_0x53a2('0x30')]);var _0x2c1c94=conferenceValidation['validate'](_0x1be4ee[_0x53a2('0x30')]);if(_0x2c1c94[_0x53a2('0x2b')]>0x0){return _0x4cb008[_0x53a2('0x1a')](0x190)[_0x53a2('0x39')](_0x2c1c94);}var _0x3f0c29=_0x1be4ee[_0x53a2('0x30')][_0x53a2('0x31')];return getAgent(_0x3f0c29)[_0x53a2('0x1e')](function(_0x366fe4){logger[_0x53a2('0x15')]('entityFound:',_0x366fe4[_0x53a2('0x1c')]);emit(util['format']('user:%s',_0x366fe4[_0x53a2('0x1c')]),_0x53a2('0x49'));return _0x4cb008['status'](0xc8)['json']({'error':![],'message':_0x53a2('0x4a')});})[_0x53a2('0x3c')](handleError(_0x4cb008));};exports[_0x53a2('0x4b')]=function(_0x3e6374,_0x5b5309){logger[_0x53a2('0x15')]('transfer\x20fired:',_0x3e6374[_0x53a2('0x30')]);var _0x1dad4e=transferValidation[_0x53a2('0xf')](_0x3e6374['body']);if(_0x1dad4e[_0x53a2('0x2b')]>0x0){return _0x5b5309[_0x53a2('0x1a')](0x190)[_0x53a2('0x39')](_0x1dad4e);}var _0x1b186d=_0x3e6374[_0x53a2('0x30')][_0x53a2('0x31')];var _0x9405a2=_0x3e6374[_0x53a2('0x30')][_0x53a2('0x2a')];var _0x18b7c6=_0x3e6374[_0x53a2('0x30')][_0x53a2('0x4c')];return getAgent(_0x1b186d)[_0x53a2('0x1e')](function(_0x43f61a){logger[_0x53a2('0x15')](_0x53a2('0x3f'),_0x43f61a['name']);emit(util[_0x53a2('0x3a')]('user:%s',_0x43f61a[_0x53a2('0x1c')]),_0x53a2('0x4d'),{'sessionId':_0x9405a2,'transferNumber':_0x18b7c6});return _0x5b5309[_0x53a2('0x1a')](0xc8)[_0x53a2('0x39')]({'error':![],'message':_0x53a2('0x4e')});})[_0x53a2('0x3c')](handleError(_0x5b5309));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index ac99db4..0a55cbe 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 _0x57ca=['addDisposition','addAnswer','addApplications','/:id/notify','notify','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./whatsappAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/canned_answers','getAnswers','/:id/users','getAgents','/:id/applications','getApplications','create','post','/:id/dispositions'];(function(_0x467590,_0x935c07){var _0x12ae74=function(_0x155f77){while(--_0x155f77){_0x467590['push'](_0x467590['shift']());}};_0x12ae74(++_0x935c07);}(_0x57ca,0x108));var _0xa57c=function(_0x214efd,_0x3cd6c9){_0x214efd=_0x214efd-0x0;var _0x524cc6=_0x57ca[_0x214efd];return _0x524cc6;};'use strict';var multer=require('multer');var util=require(_0xa57c('0x0'));var path=require(_0xa57c('0x1'));var timeout=require('connect-timeout');var express=require(_0xa57c('0x2'));var router=express[_0xa57c('0x3')]();var fs_extra=require(_0xa57c('0x4'));var auth=require(_0xa57c('0x5'));var interaction=require(_0xa57c('0x6'));var config=require('../../config/environment');var controller=require(_0xa57c('0x7'));router[_0xa57c('0x8')]('/',auth[_0xa57c('0x9')](),controller[_0xa57c('0xa')]);router[_0xa57c('0x8')](_0xa57c('0xb'),auth[_0xa57c('0x9')](),controller[_0xa57c('0xc')]);router['get'](_0xa57c('0xd'),auth['isAuthenticated'](),controller[_0xa57c('0xe')]);router[_0xa57c('0x8')]('/:id/dispositions',auth[_0xa57c('0x9')](),controller['getDispositions']);router[_0xa57c('0x8')](_0xa57c('0xf'),auth['isAuthenticated'](),controller[_0xa57c('0x10')]);router['get'](_0xa57c('0x11'),auth[_0xa57c('0x9')](),controller[_0xa57c('0x12')]);router[_0xa57c('0x8')](_0xa57c('0x13'),auth['isAuthenticated'](),controller[_0xa57c('0x14')]);router['post']('/',auth[_0xa57c('0x9')](),controller[_0xa57c('0x15')]);router[_0xa57c('0x16')](_0xa57c('0x17'),auth[_0xa57c('0x9')](),controller[_0xa57c('0x18')]);router[_0xa57c('0x16')]('/:id/canned_answers',auth[_0xa57c('0x9')](),controller[_0xa57c('0x19')]);router[_0xa57c('0x16')]('/:id/users',auth[_0xa57c('0x9')](),controller['addAgents']);router[_0xa57c('0x16')](_0xa57c('0x13'),auth[_0xa57c('0x9')](),controller[_0xa57c('0x1a')]);router[_0xa57c('0x16')](_0xa57c('0x1b'),controller[_0xa57c('0x1c')]);router[_0xa57c('0x16')]('/:id/send',auth[_0xa57c('0x9')](),controller['send']);router['put'](_0xa57c('0xd'),auth[_0xa57c('0x9')](),controller[_0xa57c('0x1d')]);router[_0xa57c('0x1e')]('/:id',auth[_0xa57c('0x9')](),controller[_0xa57c('0x1f')]);router[_0xa57c('0x1e')](_0xa57c('0x17'),auth[_0xa57c('0x9')](),controller[_0xa57c('0x20')]);router[_0xa57c('0x1e')](_0xa57c('0xf'),auth[_0xa57c('0x9')](),controller[_0xa57c('0x21')]);router[_0xa57c('0x1e')](_0xa57c('0x11'),auth[_0xa57c('0x9')](),controller[_0xa57c('0x22')]);module[_0xa57c('0x23')]=router; \ No newline at end of file +var _0x4991=['isAuthenticated','describe','/:id','/:id/dispositions','getDispositions','getAnswers','getAgents','/:id/applications','getApplications','create','addDisposition','post','addAnswer','/:id/users','addAgents','notify','send','put','update','delete','destroy','removeDispositions','/:id/canned_answers','removeAgents','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','get','index','/describe'];(function(_0x4c09a3,_0x412974){var _0x1d2076=function(_0x59606f){while(--_0x59606f){_0x4c09a3['push'](_0x4c09a3['shift']());}};_0x1d2076(++_0x412974);}(_0x4991,0xf7));var _0x1499=function(_0x42e9b4,_0x5819f2){_0x42e9b4=_0x42e9b4-0x0;var _0x2d836a=_0x4991[_0x42e9b4];return _0x2d836a;};'use strict';var multer=require(_0x1499('0x0'));var util=require('util');var path=require(_0x1499('0x1'));var timeout=require('connect-timeout');var express=require(_0x1499('0x2'));var router=express[_0x1499('0x3')]();var fs_extra=require(_0x1499('0x4'));var auth=require(_0x1499('0x5'));var interaction=require(_0x1499('0x6'));var config=require(_0x1499('0x7'));var controller=require(_0x1499('0x8'));router[_0x1499('0x9')]('/',auth['isAuthenticated'](),controller[_0x1499('0xa')]);router[_0x1499('0x9')](_0x1499('0xb'),auth[_0x1499('0xc')](),controller[_0x1499('0xd')]);router[_0x1499('0x9')](_0x1499('0xe'),auth[_0x1499('0xc')](),controller['show']);router[_0x1499('0x9')](_0x1499('0xf'),auth['isAuthenticated'](),controller[_0x1499('0x10')]);router[_0x1499('0x9')]('/:id/canned_answers',auth[_0x1499('0xc')](),controller[_0x1499('0x11')]);router['get']('/:id/users',auth['isAuthenticated'](),controller[_0x1499('0x12')]);router[_0x1499('0x9')](_0x1499('0x13'),auth[_0x1499('0xc')](),controller[_0x1499('0x14')]);router['post']('/',auth['isAuthenticated'](),controller[_0x1499('0x15')]);router['post'](_0x1499('0xf'),auth[_0x1499('0xc')](),controller[_0x1499('0x16')]);router[_0x1499('0x17')]('/:id/canned_answers',auth[_0x1499('0xc')](),controller[_0x1499('0x18')]);router['post'](_0x1499('0x19'),auth[_0x1499('0xc')](),controller[_0x1499('0x1a')]);router[_0x1499('0x17')](_0x1499('0x13'),auth[_0x1499('0xc')](),controller['addApplications']);router['post']('/:id/notify',controller[_0x1499('0x1b')]);router[_0x1499('0x17')]('/:id/send',auth[_0x1499('0xc')](),controller[_0x1499('0x1c')]);router[_0x1499('0x1d')](_0x1499('0xe'),auth[_0x1499('0xc')](),controller[_0x1499('0x1e')]);router[_0x1499('0x1f')](_0x1499('0xe'),auth[_0x1499('0xc')](),controller[_0x1499('0x20')]);router[_0x1499('0x1f')](_0x1499('0xf'),auth[_0x1499('0xc')](),controller[_0x1499('0x21')]);router[_0x1499('0x1f')](_0x1499('0x22'),auth[_0x1499('0xc')](),controller['removeAnswers']);router[_0x1499('0x1f')](_0x1499('0x19'),auth[_0x1499('0xc')](),controller[_0x1499('0x23')]);module[_0x1499('0x24')]=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index 6aea552..9ccd9d9 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 _0x5f6d=['setDataValue','mandatoryDisposition','sequelize','STRING','ENUM','TEXT','BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue'];(function(_0x35a563,_0x260e8a){var _0x3338d3=function(_0x1ffc5d){while(--_0x1ffc5d){_0x35a563['push'](_0x35a563['shift']());}};_0x3338d3(++_0x260e8a);}(_0x5f6d,0xf5));var _0xd5f6=function(_0x17f389,_0x47acc2){_0x17f389=_0x17f389-0x0;var _0x5b129f=_0x5f6d[_0x17f389];return _0x5b129f;};'use strict';var Sequelize=require(_0xd5f6('0x0'));var rs=require('randomstring');module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize[_0xd5f6('0x1')],'allowNull':![]},'token':{'type':Sequelize[_0xd5f6('0x1')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0xd5f6('0x1')]},'type':{'type':Sequelize[_0xd5f6('0x2')]('twilio')},'accountSid':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0xd5f6('0x3')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0xd5f6('0x4')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xd5f6('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xd5f6('0x4')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xd5f6('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xd5f6('0x5')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xd5f6('0x4')],'defaultValue':![],'comment':_0xd5f6('0x6'),'set':function(_0x3c90fb){if(!_0x3c90fb){this[_0xd5f6('0x7')]('mandatoryDispositionPauseId',null);}this[_0xd5f6('0x7')](_0xd5f6('0x8'),_0x3c90fb);}},'description':{'type':Sequelize[_0xd5f6('0x1')]}}; \ No newline at end of file +var _0x8754=['name','generate','twilio','TEXT','BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','exports','STRING'];(function(_0x21b1f0,_0x306904){var _0x3e9765=function(_0x1b96fa){while(--_0x1b96fa){_0x21b1f0['push'](_0x21b1f0['shift']());}};_0x3e9765(++_0x306904);}(_0x8754,0xe4));var _0x4875=function(_0x39849d,_0x23dbc4){_0x39849d=_0x39849d-0x0;var _0x51fb0a=_0x8754[_0x39849d];return _0x51fb0a;};'use strict';var Sequelize=require('sequelize');var rs=require('randomstring');module[_0x4875('0x0')]={'name':{'type':Sequelize[_0x4875('0x1')],'unique':_0x4875('0x2'),'allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize[_0x4875('0x1')],'allowNull':![]},'token':{'type':Sequelize[_0x4875('0x1')],'defaultValue':function(){return rs[_0x4875('0x3')]();}},'phone':{'type':Sequelize[_0x4875('0x1')]},'type':{'type':Sequelize['ENUM'](_0x4875('0x4'))},'accountSid':{'type':Sequelize[_0x4875('0x1')]},'authToken':{'type':Sequelize[_0x4875('0x1')]},'notificationTemplate':{'type':Sequelize[_0x4875('0x5')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x4875('0x6')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x4875('0x6')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x4875('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x4875('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x4875('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x4875('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x4875('0x6')],'defaultValue':![],'comment':_0x4875('0x8'),'set':function(_0xc444ae){if(!_0xc444ae){this[_0x4875('0x9')]('mandatoryDispositionPauseId',null);}this[_0x4875('0x9')]('mandatoryDisposition',_0xc444ae);}},'description':{'type':Sequelize[_0x4875('0x1')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index 6aaa467..9618e70 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 _0x6289=['WhatsappAccount','rawAttributes','fieldName','key','model','query','keys','intersection','fields','attributes','length','nolimit','order','sort','where','filters','type','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','show','params','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','update','mandatoryDispositionPause','describe','getDispositions','hasOwnProperty','pick','WhatsappAccountId','Disposition','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','removeAnswers','addAgents','omit','spread','emit','removeAgents','isArray','userWhatsappAccount:remove','getAgents','User','addApplications','sequelize','transaction','WhatsappApplication','bulkCreate','priority','getApplications','notify','whatsapp','Applications','orderBy','asc','account','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','from','From','whatsapp:','messageId','MessageSid','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','Contacts','list','defaults','contact','WhatsappInteraction','interaction','created','applications','unmanaged','WhatsappMessage','ContactId','AttachmentId','UserId','unshift','agent','*,*,*,*','startRouting','Start','receiveMessage','WhatsappAccount,\x20%s,\x20%s,\x20%s','entity\x20found','text/xml','\x0a','to\x20is\x20mandatory','CmList','List','DESC','out','Messages','push','dataValues','eml-format','request-promise','moment','bluebird','mustache','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/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','register','jayson/promise','client','http','request','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','status','json','offset','undefined','limit','count','set','apply','then','destroy','end','sendStatus','stack','name','send','Pause','map'];(function(_0x2be3cd,_0x56d8b9){var _0x1f90e8=function(_0x6f4a33){while(--_0x6f4a33){_0x2be3cd['push'](_0x2be3cd['shift']());}};_0x1f90e8(++_0x56d8b9);}(_0x6289,0x1f3));var _0x9628=function(_0x50b850,_0x797ed2){_0x50b850=_0x50b850-0x0;var _0x348619=_0x6289[_0x50b850];return _0x348619;};'use strict';var emlformat=require(_0x9628('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x9628('0x1'));var moment=require(_0x9628('0x2'));var BPromise=require(_0x9628('0x3'));var Mustache=require(_0x9628('0x4'));var util=require('util');var path=require(_0x9628('0x5'));var sox=require(_0x9628('0x6'));var csv=require(_0x9628('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9628('0x8'));var _=require(_0x9628('0x9'));var squel=require(_0x9628('0xa'));var crypto=require(_0x9628('0xb'));var jsforce=require(_0x9628('0xc'));var deskjs=require(_0x9628('0xd'));var toCsv=require(_0x9628('0x7'));var querystring=require(_0x9628('0xe'));var Papa=require(_0x9628('0xf'));var Redis=require(_0x9628('0x10'));var authService=require(_0x9628('0x11'));var qs=require(_0x9628('0x12'));var as=require(_0x9628('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9628('0x14'))(_0x9628('0x15'));var utils=require(_0x9628('0x16'));var config=require(_0x9628('0x17'));var licenseUtil=require(_0x9628('0x18'));var db=require(_0x9628('0x19'))['db'];config[_0x9628('0x1a')]=_['defaults'](config['redis'],{'host':_0x9628('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./whatsappAccount.socket')[_0x9628('0x1c')](socket);var jayson=require(_0x9628('0x1d'));var client=jayson[_0x9628('0x1e')][_0x9628('0x1f')]({'port':0x232c});function respondWithRpcPromise(_0xf93e7d,_0x3e3003,_0x5810d8,_0x5ad985){return new BPromise(function(_0x212384,_0x1aaf32){var _0x5868b6=_0x5ad985||client;return _0x5868b6[_0x9628('0x20')](_0xf93e7d,_0x5810d8)['then'](function(_0x391e29){logger[_0x9628('0x21')](_0x9628('0x22'),_0x3e3003,_0x9628('0x23'));logger[_0x9628('0x24')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x3e3003,'request\x20sent',JSON[_0x9628('0x25')](_0x391e29));if(_0x391e29[_0x9628('0x26')]){if(_0x391e29[_0x9628('0x26')]['code']===0x1f4){logger[_0x9628('0x26')]('WhatsappAccount,\x20%s,\x20%s',_0x3e3003,_0x391e29[_0x9628('0x26')]['message']);return _0x1aaf32(_0x391e29[_0x9628('0x26')][_0x9628('0x27')]);}logger['error'](_0x9628('0x22'),_0x3e3003,_0x391e29[_0x9628('0x26')][_0x9628('0x27')]);return _0x212384(_0x391e29['error'][_0x9628('0x27')]);}else{logger[_0x9628('0x21')]('WhatsappAccount,\x20%s,\x20%s',_0x3e3003,_0x9628('0x23'));_0x212384(_0x391e29[_0x9628('0x28')][_0x9628('0x27')]);}})[_0x9628('0x29')](function(_0x311a0d){logger[_0x9628('0x26')](_0x9628('0x22'),_0x3e3003,_0x311a0d);_0x1aaf32(_0x311a0d);});});}function respondWithStatusCode(_0x1cd3ce,_0x50e471){_0x50e471=_0x50e471||0xcc;return function(_0x59413d){if(_0x59413d){return _0x1cd3ce['sendStatus'](_0x50e471);}return _0x1cd3ce[_0x9628('0x2a')](_0x50e471)['end']();};}function respondWithResult(_0x17753c,_0x182203){_0x182203=_0x182203||0xc8;return function(_0x2844a5){if(_0x2844a5){return _0x17753c[_0x9628('0x2a')](_0x182203)[_0x9628('0x2b')](_0x2844a5);}};}function respondWithFilteredResult(_0x14c7c2,_0x2deb9a){return function(_0x5e218b){if(_0x5e218b){var _0x18843c=typeof _0x2deb9a[_0x9628('0x2c')]===_0x9628('0x2d')&&typeof _0x2deb9a[_0x9628('0x2e')]===_0x9628('0x2d');var _0x125bb5=_0x5e218b['count'];var _0x13cd1e=_0x18843c?0x0:_0x2deb9a[_0x9628('0x2c')];var _0xcd562c=_0x18843c?_0x5e218b[_0x9628('0x2f')]:_0x2deb9a[_0x9628('0x2c')]+_0x2deb9a['limit'];var _0x22b9c8;if(_0xcd562c>=_0x125bb5){_0xcd562c=_0x125bb5;_0x22b9c8=0xc8;}else{_0x22b9c8=0xce;}_0x14c7c2[_0x9628('0x2a')](_0x22b9c8);return _0x14c7c2[_0x9628('0x30')]('Content-Range',_0x13cd1e+'-'+_0xcd562c+'/'+_0x125bb5)[_0x9628('0x2b')](_0x5e218b);}return null;};}function patchUpdates(_0x17ec31){return function(_0x5d1a2c){try{jsonpatch[_0x9628('0x31')](_0x5d1a2c,_0x17ec31,!![]);}catch(_0x1a377d){return BPromise['reject'](_0x1a377d);}return _0x5d1a2c['save']();};}function saveUpdates(_0x31e555,_0x2f2910){return function(_0x82d367){if(_0x82d367){return _0x82d367['update'](_0x31e555)[_0x9628('0x32')](function(_0x1a0605){return _0x1a0605;});}return null;};}function removeEntity(_0x14ab4b,_0x5e9739){return function(_0x1cd5ec){if(_0x1cd5ec){return _0x1cd5ec[_0x9628('0x33')]()[_0x9628('0x32')](function(){var _0x22fb50=_0x1cd5ec['get']({'plain':!![]});var _0x541d31='WhatsappAccounts';return db['UserProfileResource'][_0x9628('0x33')]({'where':{'type':_0x541d31,'resourceId':_0x22fb50['id']}})[_0x9628('0x32')](function(){return _0x1cd5ec;});})[_0x9628('0x32')](function(){_0x14ab4b[_0x9628('0x2a')](0xcc)[_0x9628('0x34')]();});}};}function handleEntityNotFound(_0x2f5b80,_0x3eb58d){return function(_0x5c28be){if(!_0x5c28be){_0x2f5b80[_0x9628('0x35')](0x194);}return _0x5c28be;};}function handleError(_0x57d31e,_0x54c867){_0x54c867=_0x54c867||0x1f4;return function(_0x597e86){logger[_0x9628('0x26')](_0x597e86[_0x9628('0x36')]);if(_0x597e86[_0x9628('0x37')]){delete _0x597e86['name'];}_0x57d31e[_0x9628('0x2a')](_0x54c867)[_0x9628('0x38')](_0x597e86);};}exports['index']=function(_0x2d3244,_0x18956d){var _0x40ef75={'include':[{'model':db[_0x9628('0x39')],'as':'mandatoryDispositionPause'}]},_0xc6eb0e={},_0x31f1ac={'count':0x0,'rows':[]};var _0xb36609=_[_0x9628('0x3a')](db[_0x9628('0x3b')][_0x9628('0x3c')],function(_0x3dacc4){return{'name':_0x3dacc4[_0x9628('0x3d')],'type':_0x3dacc4['type'][_0x9628('0x3e')]};});_0xc6eb0e[_0x9628('0x3f')]=_['map'](_0xb36609,_0x9628('0x37'));_0xc6eb0e[_0x9628('0x40')]=_[_0x9628('0x41')](_0x2d3244['query']);_0xc6eb0e['filters']=_[_0x9628('0x42')](_0xc6eb0e['model'],_0xc6eb0e[_0x9628('0x40')]);_0x40ef75['attributes']=_[_0x9628('0x42')](_0xc6eb0e[_0x9628('0x3f')],qs['fields'](_0x2d3244[_0x9628('0x40')][_0x9628('0x43')]));_0x40ef75[_0x9628('0x44')]=_0x40ef75[_0x9628('0x44')][_0x9628('0x45')]?_0x40ef75[_0x9628('0x44')]:_0xc6eb0e[_0x9628('0x3f')];if(!_0x2d3244[_0x9628('0x40')]['hasOwnProperty'](_0x9628('0x46'))){_0x40ef75[_0x9628('0x2e')]=qs[_0x9628('0x2e')](_0x2d3244[_0x9628('0x40')][_0x9628('0x2e')]);_0x40ef75[_0x9628('0x2c')]=qs[_0x9628('0x2c')](_0x2d3244['query']['offset']);}_0x40ef75[_0x9628('0x47')]=qs[_0x9628('0x48')](_0x2d3244[_0x9628('0x40')][_0x9628('0x48')]);_0x40ef75[_0x9628('0x49')]=qs['filters'](_['pick'](_0x2d3244[_0x9628('0x40')],_0xc6eb0e[_0x9628('0x4a')]),_0xb36609);if(_0x2d3244[_0x9628('0x40')]['filter']){_0x40ef75[_0x9628('0x49')]=_['merge'](_0x40ef75[_0x9628('0x49')],{'$or':_[_0x9628('0x3a')](_0xb36609,function(_0x302842){if(_0x302842[_0x9628('0x4b')]!==_0x9628('0x4c')){var _0x316c9f={};_0x316c9f[_0x302842[_0x9628('0x37')]]={'$like':'%'+_0x2d3244['query'][_0x9628('0x4d')]+'%'};return _0x316c9f;}})});}_0x40ef75=_[_0x9628('0x4e')]({},_0x40ef75,_0x2d3244[_0x9628('0x4f')]);var _0x43a302={'where':_0x40ef75[_0x9628('0x49')]};return db[_0x9628('0x3b')][_0x9628('0x2f')](_0x43a302)[_0x9628('0x32')](function(_0x16a79c){_0x31f1ac[_0x9628('0x2f')]=_0x16a79c;if(_0x2d3244[_0x9628('0x40')][_0x9628('0x50')]){_0x40ef75[_0x9628('0x51')]=[{'all':!![]}];}return db[_0x9628('0x3b')][_0x9628('0x52')](_0x40ef75);})['then'](function(_0x488a99){_0x31f1ac[_0x9628('0x53')]=_0x488a99;return _0x31f1ac;})[_0x9628('0x32')](respondWithFilteredResult(_0x18956d,_0x40ef75))[_0x9628('0x29')](handleError(_0x18956d,null));};exports[_0x9628('0x54')]=function(_0x166dae,_0x4f5dc4){var _0x2e28da={'raw':![],'where':{'id':_0x166dae[_0x9628('0x55')]['id']},'include':[{'model':db[_0x9628('0x39')],'as':'mandatoryDispositionPause'}]},_0x16c5c7={};_0x16c5c7['model']=_[_0x9628('0x41')](db[_0x9628('0x3b')]['rawAttributes']);_0x16c5c7[_0x9628('0x40')]=_['keys'](_0x166dae[_0x9628('0x40')]);_0x16c5c7['filters']=_[_0x9628('0x42')](_0x16c5c7['model'],_0x16c5c7[_0x9628('0x40')]);_0x2e28da[_0x9628('0x44')]=_[_0x9628('0x42')](_0x16c5c7[_0x9628('0x3f')],qs['fields'](_0x166dae['query'][_0x9628('0x43')]));_0x2e28da[_0x9628('0x44')]=_0x2e28da[_0x9628('0x44')][_0x9628('0x45')]?_0x2e28da[_0x9628('0x44')]:_0x16c5c7[_0x9628('0x3f')];if(_0x166dae[_0x9628('0x40')]['includeAll']){_0x2e28da[_0x9628('0x51')]=[{'all':!![]}];}_0x2e28da=_[_0x9628('0x4e')]({},_0x2e28da,_0x166dae['options']);return db['WhatsappAccount'][_0x9628('0x56')](_0x2e28da)[_0x9628('0x32')](handleEntityNotFound(_0x4f5dc4,null))[_0x9628('0x32')](respondWithResult(_0x4f5dc4,null))[_0x9628('0x29')](handleError(_0x4f5dc4,null));};exports[_0x9628('0x57')]=function(_0x441b6d,_0x50e582){return db['WhatsappAccount'][_0x9628('0x57')](_0x441b6d[_0x9628('0x58')],{})[_0x9628('0x32')](function(_0xd3c00e){var _0x25b1c4=_0x441b6d[_0x9628('0x59')][_0x9628('0x5a')]({'plain':!![]});if(!_0x25b1c4)throw new Error(_0x9628('0x5b'));if(_0x25b1c4['role']===_0x9628('0x59')){var _0x534fe7=_0xd3c00e['get']({'plain':!![]});var _0xc811ba='WhatsappAccounts';return db[_0x9628('0x5c')]['find']({'where':{'name':_0xc811ba,'userProfileId':_0x25b1c4[_0x9628('0x5d')]},'raw':!![]})[_0x9628('0x32')](function(_0x3f551a){if(_0x3f551a&&_0x3f551a[_0x9628('0x5e')]===0x0){return db[_0x9628('0x5f')][_0x9628('0x57')]({'name':_0x534fe7[_0x9628('0x37')],'resourceId':_0x534fe7['id'],'type':_0x3f551a[_0x9628('0x37')],'sectionId':_0x3f551a['id']},{})['then'](function(){return _0xd3c00e;});}else{return _0xd3c00e;}})['catch'](function(_0x2ccd7f){logger[_0x9628('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2ccd7f);throw _0x2ccd7f;});}return _0xd3c00e;})['then'](respondWithResult(_0x50e582,0xc9))[_0x9628('0x29')](handleError(_0x50e582,null));};exports[_0x9628('0x60')]=function(_0x7e3c7f,_0x2f6f8a){if(_0x7e3c7f[_0x9628('0x58')]['id']){delete _0x7e3c7f[_0x9628('0x58')]['id'];}return db[_0x9628('0x3b')]['find']({'where':{'id':_0x7e3c7f['params']['id']},'include':[{'model':db['Pause'],'as':_0x9628('0x61')}]})[_0x9628('0x32')](handleEntityNotFound(_0x2f6f8a,null))['then'](saveUpdates(_0x7e3c7f[_0x9628('0x58')],null))[_0x9628('0x32')](respondWithResult(_0x2f6f8a,null))[_0x9628('0x29')](handleError(_0x2f6f8a,null));};exports[_0x9628('0x33')]=function(_0x5b7876,_0x425101){return db[_0x9628('0x3b')]['find']({'where':{'id':_0x5b7876[_0x9628('0x55')]['id']}})[_0x9628('0x32')](handleEntityNotFound(_0x425101,null))[_0x9628('0x32')](removeEntity(_0x425101,null))['catch'](handleError(_0x425101,null));};exports[_0x9628('0x62')]=function(_0x31d1d5,_0x17e6d6){return db[_0x9628('0x3b')][_0x9628('0x62')]()[_0x9628('0x32')](respondWithResult(_0x17e6d6,null))[_0x9628('0x29')](handleError(_0x17e6d6,null));};exports['addDisposition']=function(_0x226218,_0x22f3ef,_0x318976){if(_0x226218[_0x9628('0x58')]['id']){delete _0x226218['body']['id'];}return db[_0x9628('0x3b')][_0x9628('0x56')]({'where':{'id':_0x226218[_0x9628('0x55')]['id']}})[_0x9628('0x32')](handleEntityNotFound(_0x22f3ef,null))[_0x9628('0x32')](function(_0x1a9fee){if(_0x1a9fee){_0x226218[_0x9628('0x58')]['WhatsappAccountId']=_0x1a9fee['id'];return db['Disposition'][_0x9628('0x57')](_0x226218[_0x9628('0x58')]);}})['then'](respondWithResult(_0x22f3ef,null))['catch'](handleError(_0x22f3ef,null));};exports[_0x9628('0x63')]=function(_0x1b59b5,_0x514ee4,_0xf2258c){var _0x5a7e45={'raw':![],'where':{}};var _0x4cdd90={};var _0xe316f5={'count':0x0,'rows':[]};return db[_0x9628('0x3b')]['findOne']({'where':{'id':_0x1b59b5[_0x9628('0x55')]['id']}})[_0x9628('0x32')](handleEntityNotFound(_0x514ee4,null))['then'](function(_0x2c3276){if(_0x2c3276){_0x4cdd90[_0x9628('0x3f')]=_[_0x9628('0x41')](db['Disposition'][_0x9628('0x3c')]);_0x4cdd90[_0x9628('0x40')]=_['keys'](_0x1b59b5['query']);_0x4cdd90[_0x9628('0x4a')]=_[_0x9628('0x42')](_0x4cdd90[_0x9628('0x3f')],_0x4cdd90[_0x9628('0x40')]);_0x5a7e45['attributes']=_[_0x9628('0x42')](_0x4cdd90['model'],qs[_0x9628('0x43')](_0x1b59b5[_0x9628('0x40')][_0x9628('0x43')]));_0x5a7e45['attributes']=_0x5a7e45[_0x9628('0x44')][_0x9628('0x45')]?_0x5a7e45['attributes']:_0x4cdd90[_0x9628('0x3f')];if(!_0x1b59b5[_0x9628('0x40')][_0x9628('0x64')](_0x9628('0x46'))){_0x5a7e45[_0x9628('0x2e')]=qs['limit'](_0x1b59b5['query']['limit']);_0x5a7e45[_0x9628('0x2c')]=qs[_0x9628('0x2c')](_0x1b59b5[_0x9628('0x40')][_0x9628('0x2c')]);}_0x5a7e45[_0x9628('0x47')]=qs[_0x9628('0x48')](_0x1b59b5[_0x9628('0x40')][_0x9628('0x48')]);_0x5a7e45[_0x9628('0x49')]=qs[_0x9628('0x4a')](_[_0x9628('0x65')](_0x1b59b5[_0x9628('0x40')],_0x4cdd90[_0x9628('0x4a')]));_0x5a7e45[_0x9628('0x49')][_0x9628('0x66')]=_0x2c3276['id'];if(_0x1b59b5[_0x9628('0x40')]['filter']){_0x5a7e45['where']=_[_0x9628('0x4e')](_0x5a7e45[_0x9628('0x49')],{'$or':_[_0x9628('0x3a')](_0x5a7e45[_0x9628('0x44')],function(_0x2508f1){var _0x139255={};_0x139255[_0x2508f1]={'$like':'%'+_0x1b59b5[_0x9628('0x40')][_0x9628('0x4d')]+'%'};return _0x139255;})});}_0x5a7e45=_[_0x9628('0x4e')]({},_0x5a7e45,_0x1b59b5[_0x9628('0x4f')]);return db[_0x9628('0x67')][_0x9628('0x2f')]({'where':_0x5a7e45[_0x9628('0x49')]})[_0x9628('0x32')](function(_0x559109){_0xe316f5['count']=_0x559109;if(_0x1b59b5[_0x9628('0x40')][_0x9628('0x50')]){_0x5a7e45[_0x9628('0x51')]=[{'all':!![]}];}return db['Disposition'][_0x9628('0x52')](_0x5a7e45);})[_0x9628('0x32')](function(_0x4ce7e3){_0xe316f5[_0x9628('0x53')]=_0x4ce7e3;return _0xe316f5;});}})[_0x9628('0x32')](respondWithFilteredResult(_0x514ee4,_0x5a7e45))[_0x9628('0x29')](handleError(_0x514ee4,null));};exports[_0x9628('0x68')]=function(_0x11b7b3,_0x5285ec,_0x371c36){return db[_0x9628('0x3b')][_0x9628('0x56')]({'where':{'id':_0x11b7b3[_0x9628('0x55')]['id']}})[_0x9628('0x32')](handleEntityNotFound(_0x5285ec,null))[_0x9628('0x32')](function(_0xedb886){if(_0xedb886){return _0xedb886[_0x9628('0x68')](_0x11b7b3['query'][_0x9628('0x69')]);}})['then'](respondWithStatusCode(_0x5285ec,null))[_0x9628('0x29')](handleError(_0x5285ec,null));};exports[_0x9628('0x6a')]=function(_0x4f988f,_0x5554e8,_0x3a5bd0){if(_0x4f988f[_0x9628('0x58')]['id']){delete _0x4f988f[_0x9628('0x58')]['id'];}return db[_0x9628('0x3b')]['find']({'where':{'id':_0x4f988f[_0x9628('0x55')]['id']}})['then'](handleEntityNotFound(_0x5554e8,null))[_0x9628('0x32')](function(_0x21b8fc){if(_0x21b8fc){_0x4f988f[_0x9628('0x58')]['WhatsappAccountId']=_0x21b8fc['id'];return db[_0x9628('0x6b')][_0x9628('0x57')](_0x4f988f[_0x9628('0x58')]);}})['then'](respondWithResult(_0x5554e8,null))[_0x9628('0x29')](handleError(_0x5554e8,null));};exports[_0x9628('0x6c')]=function(_0x4eb281,_0x33d49a,_0x540205){var _0x2744d={'raw':![],'where':{}};var _0x25864e={};var _0x386457={'count':0x0,'rows':[]};return db[_0x9628('0x3b')][_0x9628('0x6d')]({'where':{'id':_0x4eb281[_0x9628('0x55')]['id']}})[_0x9628('0x32')](handleEntityNotFound(_0x33d49a,null))[_0x9628('0x32')](function(_0x1c444b){if(_0x1c444b){_0x25864e['model']=_[_0x9628('0x41')](db['CannedAnswer'][_0x9628('0x3c')]);_0x25864e[_0x9628('0x40')]=_[_0x9628('0x41')](_0x4eb281[_0x9628('0x40')]);_0x25864e[_0x9628('0x4a')]=_['intersection'](_0x25864e[_0x9628('0x3f')],_0x25864e[_0x9628('0x40')]);_0x2744d[_0x9628('0x44')]=_[_0x9628('0x42')](_0x25864e[_0x9628('0x3f')],qs['fields'](_0x4eb281[_0x9628('0x40')][_0x9628('0x43')]));_0x2744d[_0x9628('0x44')]=_0x2744d[_0x9628('0x44')]['length']?_0x2744d['attributes']:_0x25864e[_0x9628('0x3f')];if(!_0x4eb281[_0x9628('0x40')][_0x9628('0x64')]('nolimit')){_0x2744d[_0x9628('0x2e')]=qs[_0x9628('0x2e')](_0x4eb281[_0x9628('0x40')][_0x9628('0x2e')]);_0x2744d[_0x9628('0x2c')]=qs[_0x9628('0x2c')](_0x4eb281[_0x9628('0x40')][_0x9628('0x2c')]);}_0x2744d[_0x9628('0x47')]=qs['sort'](_0x4eb281[_0x9628('0x40')]['sort']);_0x2744d[_0x9628('0x49')]=qs[_0x9628('0x4a')](_[_0x9628('0x65')](_0x4eb281[_0x9628('0x40')],_0x25864e[_0x9628('0x4a')]));_0x2744d[_0x9628('0x49')][_0x9628('0x66')]=_0x1c444b['id'];if(_0x4eb281[_0x9628('0x40')][_0x9628('0x4d')]){_0x2744d[_0x9628('0x49')]=_['merge'](_0x2744d[_0x9628('0x49')],{'$or':_['map'](_0x2744d['attributes'],function(_0xce0e28){var _0x274ecd={};_0x274ecd[_0xce0e28]={'$like':'%'+_0x4eb281[_0x9628('0x40')][_0x9628('0x4d')]+'%'};return _0x274ecd;})});}_0x2744d=_['merge']({},_0x2744d,_0x4eb281[_0x9628('0x4f')]);return db['CannedAnswer'][_0x9628('0x2f')]({'where':_0x2744d[_0x9628('0x49')]})[_0x9628('0x32')](function(_0x357f20){_0x386457[_0x9628('0x2f')]=_0x357f20;if(_0x4eb281[_0x9628('0x40')][_0x9628('0x50')]){_0x2744d[_0x9628('0x51')]=[{'all':!![]}];}return db[_0x9628('0x6b')][_0x9628('0x52')](_0x2744d);})[_0x9628('0x32')](function(_0x5ca026){_0x386457[_0x9628('0x53')]=_0x5ca026;return _0x386457;});}})[_0x9628('0x32')](respondWithFilteredResult(_0x33d49a,_0x2744d))[_0x9628('0x29')](handleError(_0x33d49a,null));};exports[_0x9628('0x6e')]=function(_0x47df90,_0x537ed2,_0x367ae0){return db[_0x9628('0x3b')]['find']({'where':{'id':_0x47df90[_0x9628('0x55')]['id']}})[_0x9628('0x32')](handleEntityNotFound(_0x537ed2,null))[_0x9628('0x32')](function(_0x461fa5){if(_0x461fa5){return _0x461fa5[_0x9628('0x6e')](_0x47df90[_0x9628('0x40')][_0x9628('0x69')]);}})[_0x9628('0x32')](respondWithStatusCode(_0x537ed2,null))[_0x9628('0x29')](handleError(_0x537ed2,null));};exports['addAgents']=function(_0x3f3bfa,_0x5cf9d3,_0x739d24){return db['WhatsappAccount']['find']({'where':{'id':_0x3f3bfa[_0x9628('0x55')]['id']}})[_0x9628('0x32')](handleEntityNotFound(_0x5cf9d3,null))[_0x9628('0x32')](function(_0x5ed86e){if(_0x5ed86e){return _0x5ed86e[_0x9628('0x6f')](_0x3f3bfa[_0x9628('0x58')][_0x9628('0x69')],_[_0x9628('0x70')](_0x3f3bfa['body'],[_0x9628('0x69'),'id'])||{})[_0x9628('0x71')](function(_0x4fd4b6){for(var _0x4aa6c=0x0;_0x4aa6c<_0x3f3bfa[_0x9628('0x58')][_0x9628('0x69')][_0x9628('0x45')];_0x4aa6c+=0x1){socket[_0x9628('0x72')]('userWhatsappAccount:save',{'UserId':_0x3f3bfa[_0x9628('0x58')][_0x9628('0x69')][_0x4aa6c],'WhatsappAccountId':_0x3f3bfa[_0x9628('0x55')]['id']});}return _0x4fd4b6;});}})[_0x9628('0x32')](respondWithResult(_0x5cf9d3,null))[_0x9628('0x29')](handleError(_0x5cf9d3,null));};exports[_0x9628('0x73')]=function(_0x54b46b,_0x402c35,_0x56717d){return db['WhatsappAccount'][_0x9628('0x56')]({'where':{'id':_0x54b46b[_0x9628('0x55')]['id']}})['then'](handleEntityNotFound(_0x402c35,null))['then'](function(_0x1d6dc5){if(_0x1d6dc5){return _0x1d6dc5['removeAgents'](_0x54b46b[_0x9628('0x40')][_0x9628('0x69')])[_0x9628('0x32')](function(){if(_[_0x9628('0x74')](_0x54b46b[_0x9628('0x40')][_0x9628('0x69')])){for(var _0x5d3718=0x0;_0x5d3718<_0x54b46b[_0x9628('0x40')][_0x9628('0x69')][_0x9628('0x45')];_0x5d3718+=0x1){socket[_0x9628('0x72')](_0x9628('0x75'),{'UserId':Number(_0x54b46b[_0x9628('0x40')][_0x9628('0x69')][_0x5d3718]),'WhatsappAccountId':Number(_0x54b46b[_0x9628('0x55')]['id'])});}}else{socket[_0x9628('0x72')](_0x9628('0x75'),{'UserId':Number(_0x54b46b[_0x9628('0x40')][_0x9628('0x69')]),'WhatsappAccountId':Number(_0x54b46b[_0x9628('0x55')]['id'])});}});}})['then'](respondWithStatusCode(_0x402c35,null))['catch'](handleError(_0x402c35,null));};exports[_0x9628('0x76')]=function(_0x249935,_0x1606f0,_0xd7697c){var _0xcf3158={};var _0x3e2cdb={};var _0x17275e;var _0x58a626;return db[_0x9628('0x3b')][_0x9628('0x6d')]({'where':{'id':_0x249935[_0x9628('0x55')]['id']}})['then'](handleEntityNotFound(_0x1606f0,null))[_0x9628('0x32')](function(_0x264d21){if(_0x264d21){_0x17275e=_0x264d21;_0x3e2cdb[_0x9628('0x3f')]=_[_0x9628('0x41')](db[_0x9628('0x77')][_0x9628('0x3c')]);_0x3e2cdb[_0x9628('0x40')]=_[_0x9628('0x41')](_0x249935[_0x9628('0x40')]);_0x3e2cdb[_0x9628('0x4a')]=_['intersection'](_0x3e2cdb[_0x9628('0x3f')],_0x3e2cdb[_0x9628('0x40')]);_0xcf3158[_0x9628('0x44')]=_[_0x9628('0x42')](_0x3e2cdb[_0x9628('0x3f')],qs['fields'](_0x249935[_0x9628('0x40')][_0x9628('0x43')]));_0xcf3158[_0x9628('0x44')]=_0xcf3158['attributes'][_0x9628('0x45')]?_0xcf3158[_0x9628('0x44')]:_0x3e2cdb[_0x9628('0x3f')];_0xcf3158[_0x9628('0x47')]=qs[_0x9628('0x48')](_0x249935['query'][_0x9628('0x48')]);_0xcf3158[_0x9628('0x49')]=qs[_0x9628('0x4a')](_[_0x9628('0x65')](_0x249935[_0x9628('0x40')],_0x3e2cdb[_0x9628('0x4a')]));if(_0x249935[_0x9628('0x40')]['filter']){_0xcf3158[_0x9628('0x49')]=_[_0x9628('0x4e')](_0xcf3158[_0x9628('0x49')],{'$or':_[_0x9628('0x3a')](_0xcf3158[_0x9628('0x44')],function(_0x5c2133){var _0x3d104c={};_0x3d104c[_0x5c2133]={'$like':'%'+_0x249935[_0x9628('0x40')][_0x9628('0x4d')]+'%'};return _0x3d104c;})});}_0xcf3158=_[_0x9628('0x4e')]({},_0xcf3158,_0x249935[_0x9628('0x4f')]);return _0x17275e[_0x9628('0x76')](_0xcf3158);}})[_0x9628('0x32')](function(_0x489229){if(_0x489229){_0x58a626=_0x489229[_0x9628('0x45')];if(!_0x249935[_0x9628('0x40')][_0x9628('0x64')](_0x9628('0x46'))){_0xcf3158['limit']=qs[_0x9628('0x2e')](_0x249935[_0x9628('0x40')][_0x9628('0x2e')]);_0xcf3158[_0x9628('0x2c')]=qs['offset'](_0x249935['query'][_0x9628('0x2c')]);}return _0x17275e['getAgents'](_0xcf3158);}})['then'](function(_0x136535){if(_0x136535){return _0x136535?{'count':_0x58a626,'rows':_0x136535}:null;}})[_0x9628('0x32')](respondWithResult(_0x1606f0,null))['catch'](handleError(_0x1606f0,null));};exports[_0x9628('0x78')]=function(_0x5e5c8b,_0x4214b1,_0xa4d9d3){return db[_0x9628('0x3b')][_0x9628('0x6d')]({'where':{'id':_0x5e5c8b[_0x9628('0x55')]['id']}})[_0x9628('0x32')](handleEntityNotFound(_0x4214b1,null))[_0x9628('0x32')](function(_0x3850a5){if(_0x3850a5){return db[_0x9628('0x79')][_0x9628('0x7a')](function(_0x329962){return db[_0x9628('0x7b')][_0x9628('0x33')]({'where':{'WhatsappAccountId':_0x5e5c8b['params']['id']},'transaction':_0x329962})[_0x9628('0x32')](function(_0x1e6f04){var _0x44b45b=_[_0x9628('0x3a')](_0x5e5c8b['body'],function(_0x319b3c){_0x319b3c[_0x9628('0x66')]=_0x5e5c8b['params']['id'];return _0x319b3c;});return db['WhatsappApplication'][_0x9628('0x7c')](_0x44b45b,{'transaction':_0x329962});});})[_0x9628('0x32')](function(){return db['WhatsappApplication']['findAndCountAll']({'where':{'WhatsappAccountId':_0x5e5c8b['params']['id']},'order':_0x9628('0x7d')});});}})[_0x9628('0x32')](respondWithResult(_0x4214b1,null))[_0x9628('0x29')](handleError(_0x4214b1,null));};exports[_0x9628('0x7e')]=function(_0x109a1f,_0x37de8f,_0x2b7cba){var _0x3749a3={};var _0x5d42d8={};var _0x670baf;var _0x2f2368;return db[_0x9628('0x3b')][_0x9628('0x6d')]({'where':{'id':_0x109a1f[_0x9628('0x55')]['id']}})['then'](handleEntityNotFound(_0x37de8f,null))[_0x9628('0x32')](function(_0x21eb6b){if(_0x21eb6b){_0x670baf=_0x21eb6b;_0x5d42d8[_0x9628('0x3f')]=_['keys'](db[_0x9628('0x7b')][_0x9628('0x3c')]);_0x5d42d8[_0x9628('0x40')]=_[_0x9628('0x41')](_0x109a1f[_0x9628('0x40')]);_0x5d42d8['filters']=_['intersection'](_0x5d42d8[_0x9628('0x3f')],_0x5d42d8[_0x9628('0x40')]);_0x3749a3[_0x9628('0x44')]=_[_0x9628('0x42')](_0x5d42d8[_0x9628('0x3f')],qs['fields'](_0x109a1f[_0x9628('0x40')][_0x9628('0x43')]));_0x3749a3[_0x9628('0x44')]=_0x3749a3[_0x9628('0x44')][_0x9628('0x45')]?_0x3749a3['attributes']:_0x5d42d8[_0x9628('0x3f')];_0x3749a3[_0x9628('0x47')]=qs['sort'](_0x109a1f[_0x9628('0x40')]['sort']);_0x3749a3['where']=qs['filters'](_[_0x9628('0x65')](_0x109a1f['query'],_0x5d42d8[_0x9628('0x4a')]));if(_0x109a1f[_0x9628('0x40')][_0x9628('0x4d')]){_0x3749a3[_0x9628('0x49')]=_[_0x9628('0x4e')](_0x3749a3[_0x9628('0x49')],{'$or':_[_0x9628('0x3a')](_0x3749a3[_0x9628('0x44')],function(_0x2e41dd){var _0x481e24={};_0x481e24[_0x2e41dd]={'$like':'%'+_0x109a1f[_0x9628('0x40')][_0x9628('0x4d')]+'%'};return _0x481e24;})});}_0x3749a3=_[_0x9628('0x4e')]({},_0x3749a3,_0x109a1f[_0x9628('0x4f')]);return _0x670baf[_0x9628('0x7e')](_0x3749a3);}})['then'](function(_0x21c1d4){if(_0x21c1d4){_0x2f2368=_0x21c1d4[_0x9628('0x45')];if(!_0x109a1f[_0x9628('0x40')][_0x9628('0x64')](_0x9628('0x46'))){_0x3749a3['limit']=qs[_0x9628('0x2e')](_0x109a1f['query'][_0x9628('0x2e')]);_0x3749a3[_0x9628('0x2c')]=qs[_0x9628('0x2c')](_0x109a1f['query'][_0x9628('0x2c')]);}return _0x670baf[_0x9628('0x7e')](_0x3749a3);}})[_0x9628('0x32')](function(_0x47305f){if(_0x47305f){return _0x47305f?{'count':_0x2f2368,'rows':_0x47305f}:null;}})[_0x9628('0x32')](respondWithResult(_0x37de8f,null))['catch'](handleError(_0x37de8f,null));};exports[_0x9628('0x7f')]=function(_0x1583ef,_0x11e347,_0x649096){var _0x55bea3={'channel':_0x9628('0x80')};var _0x5cfcc7=[];var _0x117c89=[];var _0x14c84d={};return db[_0x9628('0x3b')][_0x9628('0x56')]({'where':{'id':_0x1583ef[_0x9628('0x55')]['id']},'include':[{'model':db[_0x9628('0x7b')],'as':_0x9628('0x81')}]})[_0x9628('0x32')](handleEntityNotFound(_0x11e347,null))[_0x9628('0x32')](function(_0x207668){_0x55bea3['account']=_0x207668;_0x55bea3['applications']=_[_0x9628('0x82')](_0x207668['Applications'],['priority'],[_0x9628('0x83')]);if(_0x55bea3[_0x9628('0x84')][_0x9628('0x81')]){delete _0x55bea3[_0x9628('0x84')]['Applications'];}return db[_0x9628('0x85')][_0x9628('0x62')]();})[_0x9628('0x32')](function(_0x145006){if(!_0x145006){throw new db[(_0x9628('0x86'))][(_0x9628('0x87'))](_0x9628('0x88'));}_0x5cfcc7=_[_0x9628('0x89')](_['keys'](_0x145006),[_0x9628('0x8a'),'updatedAt']);_0x117c89=_[_0x9628('0x89')](_[_0x9628('0x41')](_0x145006),[_0x9628('0x8a'),_0x9628('0x8b'),_0x9628('0x8c'),_0x9628('0x8d')]);_0x55bea3[_0x9628('0x58')]={'mapKey':_0x9628('0x8e')};if(_0x55bea3[_0x9628('0x84')][_0x9628('0x4b')]&&_0x55bea3[_0x9628('0x84')][_0x9628('0x4b')]===_0x9628('0x8f')){_0x55bea3['body'][_0x9628('0x90')]=_0x1583ef['body'][_0x9628('0x91')]['replace'](_0x9628('0x92'),'');_0x55bea3[_0x9628('0x58')]['body']=_0x1583ef[_0x9628('0x58')]['Body'];_0x55bea3[_0x9628('0x58')][_0x9628('0x93')]=_0x1583ef[_0x9628('0x58')][_0x9628('0x94')];}if(_0x55bea3['body']['id']){delete _0x55bea3[_0x9628('0x58')]['id'];}if(_[_0x9628('0x95')](_0x55bea3[_0x9628('0x58')]['from'])){throw new db[(_0x9628('0x86'))]['ValidationError'](_0x9628('0x96'));}if(_[_0x9628('0x95')](_0x55bea3[_0x9628('0x58')][_0x9628('0x58')])||_0x55bea3['body'][_0x9628('0x58')]===''){throw new db[(_0x9628('0x86'))]['ValidationError'](_0x9628('0x97'));}if(_[_0x9628('0x95')](_0x55bea3[_0x9628('0x58')][_0x9628('0x98')])){throw new db[(_0x9628('0x86'))]['ValidationError'](_0x9628('0x99')+_0x117c89);}if(!_[_0x9628('0x9a')](_0x117c89,_0x55bea3[_0x9628('0x58')][_0x9628('0x98')])){throw new db[(_0x9628('0x86'))][(_0x9628('0x87'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x117c89);}_0x14c84d[_0x55bea3[_0x9628('0x58')]['mapKey']]=_0x55bea3[_0x9628('0x58')][_0x9628('0x90')];return db['CmList']['find']({'where':{'id':_0x55bea3[_0x9628('0x84')][_0x9628('0x8d')]},'include':[{'model':db[_0x9628('0x85')],'as':_0x9628('0x9b'),'where':_0x14c84d,'limit':0x1,'order':[[_0x9628('0x8b'),'DESC']]}]});})['then'](handleEntityNotFound(_0x11e347,null))[_0x9628('0x32')](function(_0x4e2c1f){if(_0x4e2c1f){_0x55bea3[_0x9628('0x9c')]=_[_0x9628('0x70')](_0x4e2c1f,['Contacts']);if(_0x4e2c1f[_0x9628('0x9b')][_0x9628('0x45')]){return _0x4e2c1f[_0x9628('0x9b')][0x0];}var _0x3e7fe5=_[_0x9628('0x9d')](_0x55bea3[_0x9628('0x58')],{'firstName':_0x55bea3['body'][_0x9628('0x90')],'ListId':_0x4e2c1f['id']});_0x3e7fe5[_0x55bea3[_0x9628('0x58')]['mapKey']]=_0x55bea3[_0x9628('0x58')][_0x9628('0x90')];return db[_0x9628('0x85')]['create'](_0x3e7fe5,{'fields':_0x5cfcc7,'raw':!![]});}})[_0x9628('0x32')](handleEntityNotFound(_0x11e347,null))[_0x9628('0x32')](function(_0x1db596){if(_0x1db596){_0x55bea3[_0x9628('0x9e')]=_0x1db596;var _0x21f9ac={'ContactId':_0x1db596['id'],'phone':_0x55bea3[_0x9628('0x58')][_0x9628('0x90')],'WhatsappAccountId':_0x1583ef[_0x9628('0x55')]['id']};var _0x299b42={'ContactId':_0x1db596['id'],'WhatsappAccountId':_0x1583ef[_0x9628('0x55')]['id'],'closed':![]};return db[_0x9628('0x9f')]['find']({'where':_0x299b42})['then'](function(_0x1b99bd){if(_0x1b99bd){return[_0x1b99bd,![]];}return db['WhatsappInteraction'][_0x9628('0x57')](_0x21f9ac)[_0x9628('0x32')](function(_0x317a43){return[_0x317a43,!![]];});});}})[_0x9628('0x71')](function(_0x2268d2,_0x1ec000){_0x55bea3[_0x9628('0xa0')]=_0x2268d2['get']({'plain':!![]});_0x55bea3[_0x9628('0xa0')][_0x9628('0xa1')]=![];if(_0x1ec000){if(_0x55bea3['account']['autoclose']){_0x55bea3[_0x9628('0xa2')]['push']({'id':0x0,'priority':_0x55bea3['applications'][_0x9628('0x45')]+0x1,'app':'close','appdata':_0x9628('0xa3'),'interval':'*,*,*,*'});}_0x55bea3[_0x9628('0xa0')]['created']=!![];}return db[_0x9628('0xa4')][_0x9628('0x57')]({'phone':_0x55bea3[_0x9628('0x58')][_0x9628('0x90')],'messageId':_0x55bea3[_0x9628('0x58')]['messageId'],'body':_0x55bea3[_0x9628('0x58')][_0x9628('0x58')],'WhatsappAccountId':_0x1583ef[_0x9628('0x55')]['id'],'WhatsappInteractionId':_0x2268d2['id'],'direction':'in','ContactId':_0x2268d2[_0x9628('0xa5')],'AttachmentId':_0x55bea3['body'][_0x9628('0xa6')]});})[_0x9628('0x32')](function(_0x985a61){_0x55bea3['message']=_0x985a61;if(_0x55bea3[_0x9628('0xa0')][_0x9628('0xa7')]){return db[_0x9628('0x77')][_0x9628('0x56')]({'attributes':['id','name'],'where':{'id':_0x55bea3['interaction'][_0x9628('0xa7')]}})[_0x9628('0x32')](function(_0x38166d){if(_0x38166d){_0x55bea3[_0x9628('0xa2')][_0x9628('0xa8')]({'id':0x0,'priority':0x0,'app':_0x9628('0xa9'),'appdata':_0x38166d[_0x9628('0x37')]+','+(_0x55bea3['account']['waitForTheAssignedAgent']||0xa),'interval':_0x9628('0xaa')});}return respondWithRpcPromise('Start',_0x9628('0xab'),_0x55bea3);});}return respondWithRpcPromise(_0x9628('0xac'),_0x9628('0xab'),_0x55bea3);})[_0x9628('0x32')](function(_0xcd6098){if(_0xcd6098){var _0x3702f2=0xc8;var _0x1dbe19=_0x9628('0xad');logger[_0x9628('0x21')](_0x9628('0xae'),_0x1dbe19,_0x3702f2,_0x9628('0xaf'));logger[_0x9628('0x24')]('WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x1dbe19,_0x3702f2,_0x9628('0xaf'),JSON['stringify'](_0xcd6098));if(_0x55bea3[_0x9628('0x84')][_0x9628('0x4b')]==='twilio'){return _0x11e347['status'](_0x3702f2)[_0x9628('0x30')]('Content-Type',_0x9628('0xb0'))[_0x9628('0x38')](_0x9628('0xb1'));}else{return _0x11e347['status'](_0x3702f2)[_0x9628('0x2b')](_0xcd6098);}}})[_0x9628('0x29')](handleError(_0x11e347,null));};exports[_0x9628('0x38')]=function(_0x57c3a8,_0x5d95fa,_0x13368d){var _0x1bc8c8,_0xc50045,_0x5399cf;if(_[_0x9628('0x95')](_0x57c3a8[_0x9628('0x58')]['body'])||_0x57c3a8[_0x9628('0x58')]['body']===''){throw new db[(_0x9628('0x86'))][(_0x9628('0x87'))](_0x9628('0x97'));}if(_[_0x9628('0x95')](_0x57c3a8[_0x9628('0x58')]['to'])){throw new db[(_0x9628('0x86'))][(_0x9628('0x87'))](_0x9628('0xb2'));}_0x1bc8c8=_0x57c3a8[_0x9628('0x58')]['to'];return db[_0x9628('0x3b')][_0x9628('0x56')]({'where':{'id':_0x57c3a8[_0x9628('0x55')]['id']},'include':[{'model':db[_0x9628('0xb3')],'as':_0x9628('0xb4'),'include':[{'model':db[_0x9628('0x85')],'as':_0x9628('0x9b'),'where':{'mobile':_0x1bc8c8},'limit':0x1,'order':[[_0x9628('0x8b'),_0x9628('0xb5')]]}]}]})[_0x9628('0x32')](handleEntityNotFound(_0x5d95fa,null))['then'](function(_0x1e9a18){if(_0x1e9a18&&_0x1e9a18[_0x9628('0xb4')]){_0xc50045=_0x1e9a18[_0x9628('0x5a')]({'plain':!![]});if(_0xc50045[_0x9628('0xb4')]&&_0xc50045[_0x9628('0xb4')][_0x9628('0x9b')][_0x9628('0x45')]){return _0xc50045[_0x9628('0xb4')][_0x9628('0x9b')][0x0];}return db['CmContact'][_0x9628('0x57')](_[_0x9628('0x9d')](_0x57c3a8[_0x9628('0x58')],{'firstName':_0x1bc8c8,'mobile':_0x1bc8c8,'phone':_0x1bc8c8,'ListId':_0xc50045[_0x9628('0x8d')]}));}})[_0x9628('0x32')](handleEntityNotFound(_0x5d95fa,null))['then'](function(_0x3377cc){if(_0x3377cc){_0x5399cf=_0x3377cc;return db[_0x9628('0x9f')][_0x9628('0x56')]({'where':{'ContactId':_0x5399cf['id'],'closed':![],'WhatsappAccountId':_0xc50045['id']}})[_0x9628('0x32')](function(_0x2ea740){if(_0x2ea740){return[_0x2ea740,![]];}return db['WhatsappInteraction'][_0x9628('0x57')]({'UserId':_0x57c3a8['user']['id'],'ContactId':_0x5399cf['id'],'WhatsappAccountId':_0xc50045['id'],'phone':_0x1bc8c8,'firstMsgDirection':_0x9628('0xb6'),'Messages':[_[_0x9628('0x4e')](_0x57c3a8[_0x9628('0x58')],{'read':![],'body':_0x57c3a8['body'][_0x9628('0x58')],'phone':_0x1bc8c8,'WhatsappAccountId':_0xc50045['id'],'UserId':_0x57c3a8['user']['id'],'ContactId':_0x5399cf['id']})]},{'include':[{'model':db[_0x9628('0xa4')],'as':_0x9628('0xb7')}]})[_0x9628('0x32')](function(_0x33812e){return[_0x33812e,!![]];});});}})[_0x9628('0x71')](function(_0x124ee4,_0x59c2be){if(_0x59c2be){return _0x124ee4;}return db[_0x9628('0xa4')][_0x9628('0x57')](_[_0x9628('0x4e')](_0x57c3a8[_0x9628('0x58')],{'read':![],'body':_0x57c3a8['body'][_0x9628('0x58')],'phone':_0x1bc8c8,'WhatsappAccountId':_0xc50045['id'],'WhatsappInteractionId':_0x124ee4['id'],'UserId':_0x57c3a8[_0x9628('0x59')]['id'],'ContactId':_0x5399cf['id']}))[_0x9628('0x32')](function(_0x440c11){_0x124ee4['dataValues']['Messages']=[];_0x124ee4['dataValues'][_0x9628('0xb7')][_0x9628('0xb8')](_0x440c11[_0x9628('0xb9')]);return _0x124ee4;});})[_0x9628('0x32')](respondWithResult(_0x5d95fa,null))['catch'](handleError(_0x5d95fa,null));}; \ No newline at end of file +var _0xe569=['findOne','removeDispositions','ids','getAnswers','CannedAnswer','removeAnswers','addAgents','omit','spread','userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove','emit','getAgents','User','addApplications','sequelize','transaction','WhatsappApplication','findAndCountAll','priority','getApplications','Applications','account','applications','orderBy','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','updatedAt','createdAt','CompanyId','ListId','mobile','from','From','replace','whatsapp:','Body','messageId','MessageSid','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','Contacts','DESC','list','WhatsappInteraction','interaction','autoclose','push','close','*,*,*,*','WhatsappMessage','ContactId','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','Start','startRouting','receiveMessage','WhatsappAccount,\x20%s,\x20%s,\x20%s','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','entity\x20found','Content-Type','text/xml','\x0a','json','CmList','List','Messages','dataValues','eml-format','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','register','jayson/promise','client','http','request','then','info','WhatsappAccount,\x20%s,\x20%s','debug','stringify','error','message','request\x20sent','end','status','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','get','WhatsappAccounts','UserProfileResource','sendStatus','stack','name','send','index','Pause','mandatoryDispositionPause','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','WhatsappAccount','findAll','rows','catch','show','params','find','create','user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','WhatsappAccountId','Disposition','getDispositions'];(function(_0xa983cf,_0x2a909b){var _0x1f80c8=function(_0x1a80b4){while(--_0x1a80b4){_0xa983cf['push'](_0xa983cf['shift']());}};_0x1f80c8(++_0x2a909b);}(_0xe569,0x1c8));var _0x9e56=function(_0x57326a,_0x4682f5){_0x57326a=_0x57326a-0x0;var _0x24b1e7=_0xe569[_0x57326a];return _0x24b1e7;};'use strict';var emlformat=require(_0x9e56('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x9e56('0x1'));var BPromise=require(_0x9e56('0x2'));var Mustache=require(_0x9e56('0x3'));var util=require(_0x9e56('0x4'));var path=require(_0x9e56('0x5'));var sox=require(_0x9e56('0x6'));var csv=require('to-csv');var ejs=require(_0x9e56('0x7'));var fs=require('fs');var fs_extra=require(_0x9e56('0x8'));var _=require(_0x9e56('0x9'));var squel=require(_0x9e56('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x9e56('0xb'));var toCsv=require(_0x9e56('0xc'));var querystring=require(_0x9e56('0xd'));var Papa=require(_0x9e56('0xe'));var Redis=require(_0x9e56('0xf'));var authService=require(_0x9e56('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x9e56('0x11'));var hardwareService=require(_0x9e56('0x12'));var logger=require(_0x9e56('0x13'))(_0x9e56('0x14'));var utils=require('../../config/utils');var config=require(_0x9e56('0x15'));var licenseUtil=require(_0x9e56('0x16'));var db=require('../../mysqldb')['db'];config[_0x9e56('0x17')]=_[_0x9e56('0x18')](config[_0x9e56('0x17')],{'host':_0x9e56('0x19'),'port':0x18eb});var socket=require(_0x9e56('0x1a'))(new Redis(config['redis']));require(_0x9e56('0x1b'))[_0x9e56('0x1c')](socket);var jayson=require(_0x9e56('0x1d'));var client=jayson[_0x9e56('0x1e')][_0x9e56('0x1f')]({'port':0x232c});function respondWithRpcPromise(_0x5ae4c1,_0x13c0a4,_0x24a12a,_0x3e036d){return new BPromise(function(_0x34a138,_0x26814e){var _0x290412=_0x3e036d||client;return _0x290412[_0x9e56('0x20')](_0x5ae4c1,_0x24a12a)[_0x9e56('0x21')](function(_0x46b5b7){logger[_0x9e56('0x22')](_0x9e56('0x23'),_0x13c0a4,'request\x20sent');logger[_0x9e56('0x24')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x13c0a4,'request\x20sent',JSON[_0x9e56('0x25')](_0x46b5b7));if(_0x46b5b7[_0x9e56('0x26')]){if(_0x46b5b7[_0x9e56('0x26')]['code']===0x1f4){logger[_0x9e56('0x26')](_0x9e56('0x23'),_0x13c0a4,_0x46b5b7[_0x9e56('0x26')][_0x9e56('0x27')]);return _0x26814e(_0x46b5b7['error']['message']);}logger[_0x9e56('0x26')]('WhatsappAccount,\x20%s,\x20%s',_0x13c0a4,_0x46b5b7[_0x9e56('0x26')][_0x9e56('0x27')]);return _0x34a138(_0x46b5b7['error'][_0x9e56('0x27')]);}else{logger[_0x9e56('0x22')](_0x9e56('0x23'),_0x13c0a4,_0x9e56('0x28'));_0x34a138(_0x46b5b7['result'][_0x9e56('0x27')]);}})['catch'](function(_0x30db92){logger[_0x9e56('0x26')]('WhatsappAccount,\x20%s,\x20%s',_0x13c0a4,_0x30db92);_0x26814e(_0x30db92);});});}function respondWithStatusCode(_0x5a92f5,_0x5c8f7f){_0x5c8f7f=_0x5c8f7f||0xcc;return function(_0x323d03){if(_0x323d03){return _0x5a92f5['sendStatus'](_0x5c8f7f);}return _0x5a92f5['status'](_0x5c8f7f)[_0x9e56('0x29')]();};}function respondWithResult(_0x32f8e3,_0x117559){_0x117559=_0x117559||0xc8;return function(_0x100203){if(_0x100203){return _0x32f8e3[_0x9e56('0x2a')](_0x117559)['json'](_0x100203);}};}function respondWithFilteredResult(_0x35b424,_0x5534eb){return function(_0x4022eb){if(_0x4022eb){var _0x4f3345=typeof _0x5534eb[_0x9e56('0x2b')]===_0x9e56('0x2c')&&typeof _0x5534eb[_0x9e56('0x2d')]==='undefined';var _0x332ecc=_0x4022eb[_0x9e56('0x2e')];var _0x25ba71=_0x4f3345?0x0:_0x5534eb[_0x9e56('0x2b')];var _0x30d768=_0x4f3345?_0x4022eb[_0x9e56('0x2e')]:_0x5534eb[_0x9e56('0x2b')]+_0x5534eb[_0x9e56('0x2d')];var _0x14d8a1;if(_0x30d768>=_0x332ecc){_0x30d768=_0x332ecc;_0x14d8a1=0xc8;}else{_0x14d8a1=0xce;}_0x35b424['status'](_0x14d8a1);return _0x35b424[_0x9e56('0x2f')](_0x9e56('0x30'),_0x25ba71+'-'+_0x30d768+'/'+_0x332ecc)['json'](_0x4022eb);}return null;};}function patchUpdates(_0x3bba50){return function(_0x2c005d){try{jsonpatch[_0x9e56('0x31')](_0x2c005d,_0x3bba50,!![]);}catch(_0x441af9){return BPromise[_0x9e56('0x32')](_0x441af9);}return _0x2c005d[_0x9e56('0x33')]();};}function saveUpdates(_0x220286,_0x4266b1){return function(_0x413c15){if(_0x413c15){return _0x413c15[_0x9e56('0x34')](_0x220286)['then'](function(_0x425940){return _0x425940;});}return null;};}function removeEntity(_0x515999,_0xd42934){return function(_0x2e3ed6){if(_0x2e3ed6){return _0x2e3ed6[_0x9e56('0x35')]()[_0x9e56('0x21')](function(){var _0xc9854f=_0x2e3ed6[_0x9e56('0x36')]({'plain':!![]});var _0x1ac6b5=_0x9e56('0x37');return db[_0x9e56('0x38')][_0x9e56('0x35')]({'where':{'type':_0x1ac6b5,'resourceId':_0xc9854f['id']}})[_0x9e56('0x21')](function(){return _0x2e3ed6;});})[_0x9e56('0x21')](function(){_0x515999[_0x9e56('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1a9ff9,_0x5a674e){return function(_0x13683c){if(!_0x13683c){_0x1a9ff9[_0x9e56('0x39')](0x194);}return _0x13683c;};}function handleError(_0x217b1e,_0x3cfbb3){_0x3cfbb3=_0x3cfbb3||0x1f4;return function(_0x6a50db){logger[_0x9e56('0x26')](_0x6a50db[_0x9e56('0x3a')]);if(_0x6a50db[_0x9e56('0x3b')]){delete _0x6a50db[_0x9e56('0x3b')];}_0x217b1e[_0x9e56('0x2a')](_0x3cfbb3)[_0x9e56('0x3c')](_0x6a50db);};}exports[_0x9e56('0x3d')]=function(_0x429eb6,_0x1d2354){var _0x54e282={'include':[{'model':db[_0x9e56('0x3e')],'as':_0x9e56('0x3f')}]},_0x91efe3={},_0x1f2197={'count':0x0,'rows':[]};var _0x2aca48=_[_0x9e56('0x40')](db['WhatsappAccount'][_0x9e56('0x41')],function(_0x22cdbf){return{'name':_0x22cdbf[_0x9e56('0x42')],'type':_0x22cdbf[_0x9e56('0x43')][_0x9e56('0x44')]};});_0x91efe3[_0x9e56('0x45')]=_[_0x9e56('0x40')](_0x2aca48,_0x9e56('0x3b'));_0x91efe3[_0x9e56('0x46')]=_[_0x9e56('0x47')](_0x429eb6[_0x9e56('0x46')]);_0x91efe3[_0x9e56('0x48')]=_[_0x9e56('0x49')](_0x91efe3[_0x9e56('0x45')],_0x91efe3[_0x9e56('0x46')]);_0x54e282[_0x9e56('0x4a')]=_[_0x9e56('0x49')](_0x91efe3[_0x9e56('0x45')],qs[_0x9e56('0x4b')](_0x429eb6[_0x9e56('0x46')]['fields']));_0x54e282[_0x9e56('0x4a')]=_0x54e282[_0x9e56('0x4a')][_0x9e56('0x4c')]?_0x54e282['attributes']:_0x91efe3[_0x9e56('0x45')];if(!_0x429eb6[_0x9e56('0x46')][_0x9e56('0x4d')](_0x9e56('0x4e'))){_0x54e282['limit']=qs[_0x9e56('0x2d')](_0x429eb6['query'][_0x9e56('0x2d')]);_0x54e282['offset']=qs[_0x9e56('0x2b')](_0x429eb6['query'][_0x9e56('0x2b')]);}_0x54e282[_0x9e56('0x4f')]=qs[_0x9e56('0x50')](_0x429eb6['query'][_0x9e56('0x50')]);_0x54e282[_0x9e56('0x51')]=qs[_0x9e56('0x48')](_[_0x9e56('0x52')](_0x429eb6[_0x9e56('0x46')],_0x91efe3[_0x9e56('0x48')]),_0x2aca48);if(_0x429eb6[_0x9e56('0x46')]['filter']){_0x54e282[_0x9e56('0x51')]=_[_0x9e56('0x53')](_0x54e282[_0x9e56('0x51')],{'$or':_[_0x9e56('0x40')](_0x2aca48,function(_0x54ec61){if(_0x54ec61['type']!==_0x9e56('0x54')){var _0x13b920={};_0x13b920[_0x54ec61[_0x9e56('0x3b')]]={'$like':'%'+_0x429eb6[_0x9e56('0x46')][_0x9e56('0x55')]+'%'};return _0x13b920;}})});}_0x54e282=_[_0x9e56('0x53')]({},_0x54e282,_0x429eb6[_0x9e56('0x56')]);var _0x410a2b={'where':_0x54e282['where']};return db['WhatsappAccount']['count'](_0x410a2b)['then'](function(_0x21bef6){_0x1f2197[_0x9e56('0x2e')]=_0x21bef6;if(_0x429eb6[_0x9e56('0x46')][_0x9e56('0x57')]){_0x54e282[_0x9e56('0x58')]=[{'all':!![]}];}return db[_0x9e56('0x59')][_0x9e56('0x5a')](_0x54e282);})[_0x9e56('0x21')](function(_0x5b78bc){_0x1f2197[_0x9e56('0x5b')]=_0x5b78bc;return _0x1f2197;})[_0x9e56('0x21')](respondWithFilteredResult(_0x1d2354,_0x54e282))[_0x9e56('0x5c')](handleError(_0x1d2354,null));};exports[_0x9e56('0x5d')]=function(_0x5ed3b9,_0x5ba178){var _0x403243={'raw':![],'where':{'id':_0x5ed3b9[_0x9e56('0x5e')]['id']},'include':[{'model':db['Pause'],'as':_0x9e56('0x3f')}]},_0x57ba31={};_0x57ba31['model']=_[_0x9e56('0x47')](db[_0x9e56('0x59')][_0x9e56('0x41')]);_0x57ba31[_0x9e56('0x46')]=_[_0x9e56('0x47')](_0x5ed3b9[_0x9e56('0x46')]);_0x57ba31[_0x9e56('0x48')]=_[_0x9e56('0x49')](_0x57ba31['model'],_0x57ba31[_0x9e56('0x46')]);_0x403243[_0x9e56('0x4a')]=_[_0x9e56('0x49')](_0x57ba31['model'],qs[_0x9e56('0x4b')](_0x5ed3b9['query'][_0x9e56('0x4b')]));_0x403243[_0x9e56('0x4a')]=_0x403243[_0x9e56('0x4a')][_0x9e56('0x4c')]?_0x403243[_0x9e56('0x4a')]:_0x57ba31[_0x9e56('0x45')];if(_0x5ed3b9[_0x9e56('0x46')]['includeAll']){_0x403243[_0x9e56('0x58')]=[{'all':!![]}];}_0x403243=_['merge']({},_0x403243,_0x5ed3b9[_0x9e56('0x56')]);return db[_0x9e56('0x59')][_0x9e56('0x5f')](_0x403243)['then'](handleEntityNotFound(_0x5ba178,null))[_0x9e56('0x21')](respondWithResult(_0x5ba178,null))[_0x9e56('0x5c')](handleError(_0x5ba178,null));};exports[_0x9e56('0x60')]=function(_0x938d36,_0x2ae3c8){return db[_0x9e56('0x59')][_0x9e56('0x60')](_0x938d36['body'],{})[_0x9e56('0x21')](function(_0x5c7af5){var _0x5be255=_0x938d36[_0x9e56('0x61')][_0x9e56('0x36')]({'plain':!![]});if(!_0x5be255)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5be255[_0x9e56('0x62')]==='user'){var _0x2c6686=_0x5c7af5[_0x9e56('0x36')]({'plain':!![]});var _0x4a4bee=_0x9e56('0x37');return db[_0x9e56('0x63')]['find']({'where':{'name':_0x4a4bee,'userProfileId':_0x5be255[_0x9e56('0x64')]},'raw':!![]})['then'](function(_0x1f61ae){if(_0x1f61ae&&_0x1f61ae['autoAssociation']===0x0){return db[_0x9e56('0x38')]['create']({'name':_0x2c6686[_0x9e56('0x3b')],'resourceId':_0x2c6686['id'],'type':_0x1f61ae['name'],'sectionId':_0x1f61ae['id']},{})[_0x9e56('0x21')](function(){return _0x5c7af5;});}else{return _0x5c7af5;}})[_0x9e56('0x5c')](function(_0x39b380){logger[_0x9e56('0x26')](_0x9e56('0x65'),_0x39b380);throw _0x39b380;});}return _0x5c7af5;})[_0x9e56('0x21')](respondWithResult(_0x2ae3c8,0xc9))[_0x9e56('0x5c')](handleError(_0x2ae3c8,null));};exports['update']=function(_0x1fcf02,_0x442995){if(_0x1fcf02[_0x9e56('0x66')]['id']){delete _0x1fcf02[_0x9e56('0x66')]['id'];}return db[_0x9e56('0x59')][_0x9e56('0x5f')]({'where':{'id':_0x1fcf02[_0x9e56('0x5e')]['id']},'include':[{'model':db[_0x9e56('0x3e')],'as':_0x9e56('0x3f')}]})[_0x9e56('0x21')](handleEntityNotFound(_0x442995,null))['then'](saveUpdates(_0x1fcf02[_0x9e56('0x66')],null))['then'](respondWithResult(_0x442995,null))['catch'](handleError(_0x442995,null));};exports[_0x9e56('0x35')]=function(_0x269722,_0x22f0db){return db['WhatsappAccount']['find']({'where':{'id':_0x269722[_0x9e56('0x5e')]['id']}})['then'](handleEntityNotFound(_0x22f0db,null))[_0x9e56('0x21')](removeEntity(_0x22f0db,null))[_0x9e56('0x5c')](handleError(_0x22f0db,null));};exports[_0x9e56('0x67')]=function(_0x7ba9e6,_0x38b0bb){return db[_0x9e56('0x59')][_0x9e56('0x67')]()['then'](respondWithResult(_0x38b0bb,null))[_0x9e56('0x5c')](handleError(_0x38b0bb,null));};exports[_0x9e56('0x68')]=function(_0x2c978e,_0x12cd5a,_0x3372af){if(_0x2c978e[_0x9e56('0x66')]['id']){delete _0x2c978e['body']['id'];}return db[_0x9e56('0x59')][_0x9e56('0x5f')]({'where':{'id':_0x2c978e[_0x9e56('0x5e')]['id']}})[_0x9e56('0x21')](handleEntityNotFound(_0x12cd5a,null))['then'](function(_0x573d74){if(_0x573d74){_0x2c978e[_0x9e56('0x66')][_0x9e56('0x69')]=_0x573d74['id'];return db[_0x9e56('0x6a')][_0x9e56('0x60')](_0x2c978e[_0x9e56('0x66')]);}})[_0x9e56('0x21')](respondWithResult(_0x12cd5a,null))[_0x9e56('0x5c')](handleError(_0x12cd5a,null));};exports[_0x9e56('0x6b')]=function(_0x254a80,_0x180003,_0x32d5c6){var _0x3af512={'raw':![],'where':{}};var _0x2c4a09={};var _0x3add32={'count':0x0,'rows':[]};return db[_0x9e56('0x59')][_0x9e56('0x6c')]({'where':{'id':_0x254a80[_0x9e56('0x5e')]['id']}})[_0x9e56('0x21')](handleEntityNotFound(_0x180003,null))['then'](function(_0x4dd992){if(_0x4dd992){_0x2c4a09['model']=_[_0x9e56('0x47')](db[_0x9e56('0x6a')]['rawAttributes']);_0x2c4a09[_0x9e56('0x46')]=_[_0x9e56('0x47')](_0x254a80[_0x9e56('0x46')]);_0x2c4a09[_0x9e56('0x48')]=_[_0x9e56('0x49')](_0x2c4a09[_0x9e56('0x45')],_0x2c4a09[_0x9e56('0x46')]);_0x3af512[_0x9e56('0x4a')]=_['intersection'](_0x2c4a09[_0x9e56('0x45')],qs[_0x9e56('0x4b')](_0x254a80['query']['fields']));_0x3af512[_0x9e56('0x4a')]=_0x3af512[_0x9e56('0x4a')][_0x9e56('0x4c')]?_0x3af512[_0x9e56('0x4a')]:_0x2c4a09[_0x9e56('0x45')];if(!_0x254a80[_0x9e56('0x46')][_0x9e56('0x4d')](_0x9e56('0x4e'))){_0x3af512[_0x9e56('0x2d')]=qs[_0x9e56('0x2d')](_0x254a80['query'][_0x9e56('0x2d')]);_0x3af512[_0x9e56('0x2b')]=qs[_0x9e56('0x2b')](_0x254a80['query'][_0x9e56('0x2b')]);}_0x3af512[_0x9e56('0x4f')]=qs['sort'](_0x254a80['query'][_0x9e56('0x50')]);_0x3af512[_0x9e56('0x51')]=qs['filters'](_[_0x9e56('0x52')](_0x254a80[_0x9e56('0x46')],_0x2c4a09['filters']));_0x3af512[_0x9e56('0x51')]['WhatsappAccountId']=_0x4dd992['id'];if(_0x254a80['query'][_0x9e56('0x55')]){_0x3af512[_0x9e56('0x51')]=_[_0x9e56('0x53')](_0x3af512['where'],{'$or':_[_0x9e56('0x40')](_0x3af512[_0x9e56('0x4a')],function(_0x50109f){var _0x27af42={};_0x27af42[_0x50109f]={'$like':'%'+_0x254a80[_0x9e56('0x46')][_0x9e56('0x55')]+'%'};return _0x27af42;})});}_0x3af512=_[_0x9e56('0x53')]({},_0x3af512,_0x254a80['options']);return db[_0x9e56('0x6a')][_0x9e56('0x2e')]({'where':_0x3af512[_0x9e56('0x51')]})[_0x9e56('0x21')](function(_0x2044a8){_0x3add32[_0x9e56('0x2e')]=_0x2044a8;if(_0x254a80[_0x9e56('0x46')]['includeAll']){_0x3af512['include']=[{'all':!![]}];}return db[_0x9e56('0x6a')]['findAll'](_0x3af512);})[_0x9e56('0x21')](function(_0x1cd267){_0x3add32['rows']=_0x1cd267;return _0x3add32;});}})[_0x9e56('0x21')](respondWithFilteredResult(_0x180003,_0x3af512))[_0x9e56('0x5c')](handleError(_0x180003,null));};exports[_0x9e56('0x6d')]=function(_0x1aaaa7,_0x2084a2,_0x29aa7d){return db[_0x9e56('0x59')]['find']({'where':{'id':_0x1aaaa7[_0x9e56('0x5e')]['id']}})[_0x9e56('0x21')](handleEntityNotFound(_0x2084a2,null))[_0x9e56('0x21')](function(_0x50ecd5){if(_0x50ecd5){return _0x50ecd5[_0x9e56('0x6d')](_0x1aaaa7[_0x9e56('0x46')][_0x9e56('0x6e')]);}})['then'](respondWithStatusCode(_0x2084a2,null))[_0x9e56('0x5c')](handleError(_0x2084a2,null));};exports['addAnswer']=function(_0x3effc3,_0x5e3a61,_0x5785c4){if(_0x3effc3[_0x9e56('0x66')]['id']){delete _0x3effc3[_0x9e56('0x66')]['id'];}return db['WhatsappAccount'][_0x9e56('0x5f')]({'where':{'id':_0x3effc3[_0x9e56('0x5e')]['id']}})[_0x9e56('0x21')](handleEntityNotFound(_0x5e3a61,null))[_0x9e56('0x21')](function(_0x53f196){if(_0x53f196){_0x3effc3['body'][_0x9e56('0x69')]=_0x53f196['id'];return db['CannedAnswer'][_0x9e56('0x60')](_0x3effc3['body']);}})[_0x9e56('0x21')](respondWithResult(_0x5e3a61,null))[_0x9e56('0x5c')](handleError(_0x5e3a61,null));};exports[_0x9e56('0x6f')]=function(_0x2ca0dd,_0x14ad84,_0x5cb55d){var _0x4aac7e={'raw':![],'where':{}};var _0x3a9820={};var _0x5aed8f={'count':0x0,'rows':[]};return db[_0x9e56('0x59')][_0x9e56('0x6c')]({'where':{'id':_0x2ca0dd['params']['id']}})[_0x9e56('0x21')](handleEntityNotFound(_0x14ad84,null))[_0x9e56('0x21')](function(_0x2c2790){if(_0x2c2790){_0x3a9820[_0x9e56('0x45')]=_[_0x9e56('0x47')](db['CannedAnswer'][_0x9e56('0x41')]);_0x3a9820['query']=_[_0x9e56('0x47')](_0x2ca0dd[_0x9e56('0x46')]);_0x3a9820[_0x9e56('0x48')]=_[_0x9e56('0x49')](_0x3a9820[_0x9e56('0x45')],_0x3a9820[_0x9e56('0x46')]);_0x4aac7e[_0x9e56('0x4a')]=_[_0x9e56('0x49')](_0x3a9820[_0x9e56('0x45')],qs[_0x9e56('0x4b')](_0x2ca0dd[_0x9e56('0x46')][_0x9e56('0x4b')]));_0x4aac7e[_0x9e56('0x4a')]=_0x4aac7e[_0x9e56('0x4a')]['length']?_0x4aac7e[_0x9e56('0x4a')]:_0x3a9820[_0x9e56('0x45')];if(!_0x2ca0dd[_0x9e56('0x46')]['hasOwnProperty'](_0x9e56('0x4e'))){_0x4aac7e[_0x9e56('0x2d')]=qs['limit'](_0x2ca0dd[_0x9e56('0x46')][_0x9e56('0x2d')]);_0x4aac7e['offset']=qs['offset'](_0x2ca0dd['query'][_0x9e56('0x2b')]);}_0x4aac7e[_0x9e56('0x4f')]=qs[_0x9e56('0x50')](_0x2ca0dd[_0x9e56('0x46')][_0x9e56('0x50')]);_0x4aac7e['where']=qs[_0x9e56('0x48')](_[_0x9e56('0x52')](_0x2ca0dd[_0x9e56('0x46')],_0x3a9820[_0x9e56('0x48')]));_0x4aac7e[_0x9e56('0x51')]['WhatsappAccountId']=_0x2c2790['id'];if(_0x2ca0dd[_0x9e56('0x46')][_0x9e56('0x55')]){_0x4aac7e[_0x9e56('0x51')]=_[_0x9e56('0x53')](_0x4aac7e[_0x9e56('0x51')],{'$or':_[_0x9e56('0x40')](_0x4aac7e[_0x9e56('0x4a')],function(_0x3cc46e){var _0x452419={};_0x452419[_0x3cc46e]={'$like':'%'+_0x2ca0dd['query'][_0x9e56('0x55')]+'%'};return _0x452419;})});}_0x4aac7e=_[_0x9e56('0x53')]({},_0x4aac7e,_0x2ca0dd[_0x9e56('0x56')]);return db[_0x9e56('0x70')][_0x9e56('0x2e')]({'where':_0x4aac7e[_0x9e56('0x51')]})[_0x9e56('0x21')](function(_0x315733){_0x5aed8f['count']=_0x315733;if(_0x2ca0dd[_0x9e56('0x46')]['includeAll']){_0x4aac7e[_0x9e56('0x58')]=[{'all':!![]}];}return db[_0x9e56('0x70')][_0x9e56('0x5a')](_0x4aac7e);})['then'](function(_0x5166c2){_0x5aed8f[_0x9e56('0x5b')]=_0x5166c2;return _0x5aed8f;});}})[_0x9e56('0x21')](respondWithFilteredResult(_0x14ad84,_0x4aac7e))[_0x9e56('0x5c')](handleError(_0x14ad84,null));};exports[_0x9e56('0x71')]=function(_0x3308e7,_0x2ee112,_0x227863){return db[_0x9e56('0x59')]['find']({'where':{'id':_0x3308e7[_0x9e56('0x5e')]['id']}})[_0x9e56('0x21')](handleEntityNotFound(_0x2ee112,null))['then'](function(_0x2499c3){if(_0x2499c3){return _0x2499c3['removeAnswers'](_0x3308e7[_0x9e56('0x46')][_0x9e56('0x6e')]);}})[_0x9e56('0x21')](respondWithStatusCode(_0x2ee112,null))['catch'](handleError(_0x2ee112,null));};exports[_0x9e56('0x72')]=function(_0x45816a,_0x569caf,_0x397e10){return db[_0x9e56('0x59')]['find']({'where':{'id':_0x45816a[_0x9e56('0x5e')]['id']}})[_0x9e56('0x21')](handleEntityNotFound(_0x569caf,null))['then'](function(_0x2d01c1){if(_0x2d01c1){return _0x2d01c1[_0x9e56('0x72')](_0x45816a[_0x9e56('0x66')]['ids'],_[_0x9e56('0x73')](_0x45816a[_0x9e56('0x66')],[_0x9e56('0x6e'),'id'])||{})[_0x9e56('0x74')](function(_0x3a8470){for(var _0xf68280=0x0;_0xf68280<_0x45816a[_0x9e56('0x66')]['ids']['length'];_0xf68280+=0x1){socket['emit'](_0x9e56('0x75'),{'UserId':_0x45816a[_0x9e56('0x66')][_0x9e56('0x6e')][_0xf68280],'WhatsappAccountId':_0x45816a[_0x9e56('0x5e')]['id']});}return _0x3a8470;});}})[_0x9e56('0x21')](respondWithResult(_0x569caf,null))[_0x9e56('0x5c')](handleError(_0x569caf,null));};exports[_0x9e56('0x76')]=function(_0x594664,_0x5c0d04,_0xaf3d5f){return db[_0x9e56('0x59')][_0x9e56('0x5f')]({'where':{'id':_0x594664[_0x9e56('0x5e')]['id']}})[_0x9e56('0x21')](handleEntityNotFound(_0x5c0d04,null))[_0x9e56('0x21')](function(_0x2782b9){if(_0x2782b9){return _0x2782b9[_0x9e56('0x76')](_0x594664['query'][_0x9e56('0x6e')])[_0x9e56('0x21')](function(){if(_[_0x9e56('0x77')](_0x594664[_0x9e56('0x46')][_0x9e56('0x6e')])){for(var _0x50ed46=0x0;_0x50ed46<_0x594664[_0x9e56('0x46')][_0x9e56('0x6e')][_0x9e56('0x4c')];_0x50ed46+=0x1){socket['emit'](_0x9e56('0x78'),{'UserId':Number(_0x594664['query']['ids'][_0x50ed46]),'WhatsappAccountId':Number(_0x594664[_0x9e56('0x5e')]['id'])});}}else{socket[_0x9e56('0x79')]('userWhatsappAccount:remove',{'UserId':Number(_0x594664['query'][_0x9e56('0x6e')]),'WhatsappAccountId':Number(_0x594664[_0x9e56('0x5e')]['id'])});}});}})[_0x9e56('0x21')](respondWithStatusCode(_0x5c0d04,null))[_0x9e56('0x5c')](handleError(_0x5c0d04,null));};exports[_0x9e56('0x7a')]=function(_0xfa1cbc,_0xca7146,_0x387e2e){var _0x3e81fc={};var _0x323ce0={};var _0x21b20d;var _0x2a4dff;return db[_0x9e56('0x59')][_0x9e56('0x6c')]({'where':{'id':_0xfa1cbc[_0x9e56('0x5e')]['id']}})[_0x9e56('0x21')](handleEntityNotFound(_0xca7146,null))['then'](function(_0xb455c2){if(_0xb455c2){_0x21b20d=_0xb455c2;_0x323ce0[_0x9e56('0x45')]=_[_0x9e56('0x47')](db[_0x9e56('0x7b')][_0x9e56('0x41')]);_0x323ce0[_0x9e56('0x46')]=_['keys'](_0xfa1cbc['query']);_0x323ce0[_0x9e56('0x48')]=_[_0x9e56('0x49')](_0x323ce0[_0x9e56('0x45')],_0x323ce0[_0x9e56('0x46')]);_0x3e81fc[_0x9e56('0x4a')]=_[_0x9e56('0x49')](_0x323ce0[_0x9e56('0x45')],qs[_0x9e56('0x4b')](_0xfa1cbc['query'][_0x9e56('0x4b')]));_0x3e81fc['attributes']=_0x3e81fc[_0x9e56('0x4a')][_0x9e56('0x4c')]?_0x3e81fc[_0x9e56('0x4a')]:_0x323ce0[_0x9e56('0x45')];_0x3e81fc[_0x9e56('0x4f')]=qs[_0x9e56('0x50')](_0xfa1cbc[_0x9e56('0x46')][_0x9e56('0x50')]);_0x3e81fc['where']=qs['filters'](_[_0x9e56('0x52')](_0xfa1cbc[_0x9e56('0x46')],_0x323ce0[_0x9e56('0x48')]));if(_0xfa1cbc[_0x9e56('0x46')][_0x9e56('0x55')]){_0x3e81fc['where']=_['merge'](_0x3e81fc['where'],{'$or':_[_0x9e56('0x40')](_0x3e81fc['attributes'],function(_0x21c99c){var _0x239079={};_0x239079[_0x21c99c]={'$like':'%'+_0xfa1cbc[_0x9e56('0x46')][_0x9e56('0x55')]+'%'};return _0x239079;})});}_0x3e81fc=_[_0x9e56('0x53')]({},_0x3e81fc,_0xfa1cbc[_0x9e56('0x56')]);return _0x21b20d['getAgents'](_0x3e81fc);}})['then'](function(_0x3ac9df){if(_0x3ac9df){_0x2a4dff=_0x3ac9df['length'];if(!_0xfa1cbc[_0x9e56('0x46')]['hasOwnProperty'](_0x9e56('0x4e'))){_0x3e81fc[_0x9e56('0x2d')]=qs[_0x9e56('0x2d')](_0xfa1cbc[_0x9e56('0x46')]['limit']);_0x3e81fc[_0x9e56('0x2b')]=qs['offset'](_0xfa1cbc[_0x9e56('0x46')]['offset']);}return _0x21b20d[_0x9e56('0x7a')](_0x3e81fc);}})[_0x9e56('0x21')](function(_0x12cf7c){if(_0x12cf7c){return _0x12cf7c?{'count':_0x2a4dff,'rows':_0x12cf7c}:null;}})['then'](respondWithResult(_0xca7146,null))['catch'](handleError(_0xca7146,null));};exports[_0x9e56('0x7c')]=function(_0x462d57,_0x53d5ea,_0x50fe11){return db['WhatsappAccount']['findOne']({'where':{'id':_0x462d57[_0x9e56('0x5e')]['id']}})[_0x9e56('0x21')](handleEntityNotFound(_0x53d5ea,null))[_0x9e56('0x21')](function(_0x1f2cf1){if(_0x1f2cf1){return db[_0x9e56('0x7d')][_0x9e56('0x7e')](function(_0x3e492c){return db[_0x9e56('0x7f')][_0x9e56('0x35')]({'where':{'WhatsappAccountId':_0x462d57[_0x9e56('0x5e')]['id']},'transaction':_0x3e492c})[_0x9e56('0x21')](function(_0x59d488){var _0x581adf=_['map'](_0x462d57[_0x9e56('0x66')],function(_0x3389f9){_0x3389f9[_0x9e56('0x69')]=_0x462d57['params']['id'];return _0x3389f9;});return db[_0x9e56('0x7f')]['bulkCreate'](_0x581adf,{'transaction':_0x3e492c});});})[_0x9e56('0x21')](function(){return db['WhatsappApplication'][_0x9e56('0x80')]({'where':{'WhatsappAccountId':_0x462d57[_0x9e56('0x5e')]['id']},'order':_0x9e56('0x81')});});}})[_0x9e56('0x21')](respondWithResult(_0x53d5ea,null))[_0x9e56('0x5c')](handleError(_0x53d5ea,null));};exports['getApplications']=function(_0x3044cf,_0x186824,_0x1b38ed){var _0x29bedc={};var _0x29d595={};var _0x37aae5;var _0x412c37;return db[_0x9e56('0x59')][_0x9e56('0x6c')]({'where':{'id':_0x3044cf['params']['id']}})[_0x9e56('0x21')](handleEntityNotFound(_0x186824,null))[_0x9e56('0x21')](function(_0x29facc){if(_0x29facc){_0x37aae5=_0x29facc;_0x29d595['model']=_[_0x9e56('0x47')](db[_0x9e56('0x7f')][_0x9e56('0x41')]);_0x29d595[_0x9e56('0x46')]=_[_0x9e56('0x47')](_0x3044cf['query']);_0x29d595['filters']=_[_0x9e56('0x49')](_0x29d595[_0x9e56('0x45')],_0x29d595[_0x9e56('0x46')]);_0x29bedc['attributes']=_[_0x9e56('0x49')](_0x29d595[_0x9e56('0x45')],qs[_0x9e56('0x4b')](_0x3044cf[_0x9e56('0x46')][_0x9e56('0x4b')]));_0x29bedc[_0x9e56('0x4a')]=_0x29bedc[_0x9e56('0x4a')][_0x9e56('0x4c')]?_0x29bedc['attributes']:_0x29d595[_0x9e56('0x45')];_0x29bedc['order']=qs[_0x9e56('0x50')](_0x3044cf[_0x9e56('0x46')][_0x9e56('0x50')]);_0x29bedc[_0x9e56('0x51')]=qs[_0x9e56('0x48')](_[_0x9e56('0x52')](_0x3044cf[_0x9e56('0x46')],_0x29d595['filters']));if(_0x3044cf[_0x9e56('0x46')][_0x9e56('0x55')]){_0x29bedc[_0x9e56('0x51')]=_[_0x9e56('0x53')](_0x29bedc[_0x9e56('0x51')],{'$or':_[_0x9e56('0x40')](_0x29bedc[_0x9e56('0x4a')],function(_0x247b3f){var _0x137298={};_0x137298[_0x247b3f]={'$like':'%'+_0x3044cf[_0x9e56('0x46')][_0x9e56('0x55')]+'%'};return _0x137298;})});}_0x29bedc=_[_0x9e56('0x53')]({},_0x29bedc,_0x3044cf[_0x9e56('0x56')]);return _0x37aae5[_0x9e56('0x82')](_0x29bedc);}})[_0x9e56('0x21')](function(_0x3ca028){if(_0x3ca028){_0x412c37=_0x3ca028['length'];if(!_0x3044cf['query'][_0x9e56('0x4d')](_0x9e56('0x4e'))){_0x29bedc[_0x9e56('0x2d')]=qs['limit'](_0x3044cf['query'][_0x9e56('0x2d')]);_0x29bedc[_0x9e56('0x2b')]=qs[_0x9e56('0x2b')](_0x3044cf[_0x9e56('0x46')][_0x9e56('0x2b')]);}return _0x37aae5[_0x9e56('0x82')](_0x29bedc);}})['then'](function(_0x560fcf){if(_0x560fcf){return _0x560fcf?{'count':_0x412c37,'rows':_0x560fcf}:null;}})[_0x9e56('0x21')](respondWithResult(_0x186824,null))['catch'](handleError(_0x186824,null));};exports['notify']=function(_0x71bcdd,_0x29fdf0,_0x26708e){var _0x30bf3f={'channel':'whatsapp'};var _0x497482=[];var _0x25d10d=[];var _0xde0d6e={};return db['WhatsappAccount'][_0x9e56('0x5f')]({'where':{'id':_0x71bcdd[_0x9e56('0x5e')]['id']},'include':[{'model':db[_0x9e56('0x7f')],'as':_0x9e56('0x83')}]})[_0x9e56('0x21')](handleEntityNotFound(_0x29fdf0,null))[_0x9e56('0x21')](function(_0x1fc631){_0x30bf3f[_0x9e56('0x84')]=_0x1fc631;_0x30bf3f[_0x9e56('0x85')]=_[_0x9e56('0x86')](_0x1fc631['Applications'],[_0x9e56('0x81')],['asc']);if(_0x30bf3f['account']['Applications']){delete _0x30bf3f['account'][_0x9e56('0x83')];}return db[_0x9e56('0x87')]['describe']();})['then'](function(_0x206d85){if(!_0x206d85){throw new db[(_0x9e56('0x88'))][(_0x9e56('0x89'))](_0x9e56('0x8a'));}_0x497482=_[_0x9e56('0x8b')](_[_0x9e56('0x47')](_0x206d85),['createdAt',_0x9e56('0x8c')]);_0x25d10d=_[_0x9e56('0x8b')](_['keys'](_0x206d85),[_0x9e56('0x8d'),_0x9e56('0x8c'),_0x9e56('0x8e'),_0x9e56('0x8f')]);_0x30bf3f[_0x9e56('0x66')]={'mapKey':_0x9e56('0x90')};if(_0x30bf3f[_0x9e56('0x84')][_0x9e56('0x43')]&&_0x30bf3f[_0x9e56('0x84')][_0x9e56('0x43')]==='twilio'){_0x30bf3f[_0x9e56('0x66')][_0x9e56('0x91')]=_0x71bcdd['body'][_0x9e56('0x92')][_0x9e56('0x93')](_0x9e56('0x94'),'');_0x30bf3f[_0x9e56('0x66')][_0x9e56('0x66')]=_0x71bcdd[_0x9e56('0x66')][_0x9e56('0x95')];_0x30bf3f[_0x9e56('0x66')][_0x9e56('0x96')]=_0x71bcdd[_0x9e56('0x66')][_0x9e56('0x97')];}if(_0x30bf3f[_0x9e56('0x66')]['id']){delete _0x30bf3f[_0x9e56('0x66')]['id'];}if(_['isNil'](_0x30bf3f[_0x9e56('0x66')][_0x9e56('0x91')])){throw new db[(_0x9e56('0x88'))][(_0x9e56('0x89'))](_0x9e56('0x98'));}if(_[_0x9e56('0x99')](_0x30bf3f[_0x9e56('0x66')][_0x9e56('0x66')])||_0x30bf3f[_0x9e56('0x66')]['body']===''){throw new db[(_0x9e56('0x88'))]['ValidationError'](_0x9e56('0x9a'));}if(_[_0x9e56('0x99')](_0x30bf3f[_0x9e56('0x66')]['mapKey'])){throw new db['Sequelize'][(_0x9e56('0x89'))](_0x9e56('0x9b')+_0x25d10d);}if(!_[_0x9e56('0x9c')](_0x25d10d,_0x30bf3f[_0x9e56('0x66')][_0x9e56('0x9d')])){throw new db[(_0x9e56('0x88'))][(_0x9e56('0x89'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x25d10d);}_0xde0d6e[_0x30bf3f[_0x9e56('0x66')][_0x9e56('0x9d')]]=_0x30bf3f[_0x9e56('0x66')][_0x9e56('0x91')];return db['CmList'][_0x9e56('0x5f')]({'where':{'id':_0x30bf3f[_0x9e56('0x84')]['ListId']},'include':[{'model':db[_0x9e56('0x87')],'as':_0x9e56('0x9e'),'where':_0xde0d6e,'limit':0x1,'order':[['updatedAt',_0x9e56('0x9f')]]}]});})[_0x9e56('0x21')](handleEntityNotFound(_0x29fdf0,null))[_0x9e56('0x21')](function(_0x32cc33){if(_0x32cc33){_0x30bf3f[_0x9e56('0xa0')]=_['omit'](_0x32cc33,[_0x9e56('0x9e')]);if(_0x32cc33[_0x9e56('0x9e')]['length']){return _0x32cc33[_0x9e56('0x9e')][0x0];}var _0x5c3a13=_[_0x9e56('0x18')](_0x30bf3f['body'],{'firstName':_0x30bf3f['body']['from'],'ListId':_0x32cc33['id']});_0x5c3a13[_0x30bf3f[_0x9e56('0x66')]['mapKey']]=_0x30bf3f[_0x9e56('0x66')]['from'];return db[_0x9e56('0x87')][_0x9e56('0x60')](_0x5c3a13,{'fields':_0x497482,'raw':!![]});}})[_0x9e56('0x21')](handleEntityNotFound(_0x29fdf0,null))[_0x9e56('0x21')](function(_0x589dd4){if(_0x589dd4){_0x30bf3f['contact']=_0x589dd4;var _0x533c09={'ContactId':_0x589dd4['id'],'phone':_0x30bf3f[_0x9e56('0x66')]['from'],'WhatsappAccountId':_0x71bcdd['params']['id']};var _0x505941={'ContactId':_0x589dd4['id'],'WhatsappAccountId':_0x71bcdd['params']['id'],'closed':![]};return db[_0x9e56('0xa1')][_0x9e56('0x5f')]({'where':_0x505941})['then'](function(_0x1dee31){if(_0x1dee31){return[_0x1dee31,![]];}return db[_0x9e56('0xa1')][_0x9e56('0x60')](_0x533c09)[_0x9e56('0x21')](function(_0x54f31d){return[_0x54f31d,!![]];});});}})[_0x9e56('0x74')](function(_0x5c1e86,_0x1a1356){_0x30bf3f[_0x9e56('0xa2')]=_0x5c1e86[_0x9e56('0x36')]({'plain':!![]});_0x30bf3f[_0x9e56('0xa2')]['created']=![];if(_0x1a1356){if(_0x30bf3f[_0x9e56('0x84')][_0x9e56('0xa3')]){_0x30bf3f['applications'][_0x9e56('0xa4')]({'id':0x0,'priority':_0x30bf3f[_0x9e56('0x85')][_0x9e56('0x4c')]+0x1,'app':_0x9e56('0xa5'),'appdata':'unmanaged','interval':_0x9e56('0xa6')});}_0x30bf3f[_0x9e56('0xa2')]['created']=!![];}return db[_0x9e56('0xa7')][_0x9e56('0x60')]({'phone':_0x30bf3f[_0x9e56('0x66')]['from'],'messageId':_0x30bf3f[_0x9e56('0x66')][_0x9e56('0x96')],'body':_0x30bf3f[_0x9e56('0x66')]['body'],'WhatsappAccountId':_0x71bcdd[_0x9e56('0x5e')]['id'],'WhatsappInteractionId':_0x5c1e86['id'],'direction':'in','ContactId':_0x5c1e86[_0x9e56('0xa8')],'AttachmentId':_0x30bf3f['body'][_0x9e56('0xa9')]});})[_0x9e56('0x21')](function(_0x4d83db){_0x30bf3f[_0x9e56('0x27')]=_0x4d83db;if(_0x30bf3f['interaction'][_0x9e56('0xaa')]){return db[_0x9e56('0x7b')][_0x9e56('0x5f')]({'attributes':['id',_0x9e56('0x3b')],'where':{'id':_0x30bf3f[_0x9e56('0xa2')][_0x9e56('0xaa')]}})[_0x9e56('0x21')](function(_0x2fc0a2){if(_0x2fc0a2){_0x30bf3f[_0x9e56('0x85')][_0x9e56('0xab')]({'id':0x0,'priority':0x0,'app':_0x9e56('0xac'),'appdata':_0x2fc0a2['name']+','+(_0x30bf3f[_0x9e56('0x84')][_0x9e56('0xad')]||0xa),'interval':_0x9e56('0xa6')});}return respondWithRpcPromise(_0x9e56('0xae'),'startRouting',_0x30bf3f);});}return respondWithRpcPromise(_0x9e56('0xae'),_0x9e56('0xaf'),_0x30bf3f);})[_0x9e56('0x21')](function(_0x361720){if(_0x361720){var _0x30864d=0xc8;var _0x1e3564=_0x9e56('0xb0');logger['info'](_0x9e56('0xb1'),_0x1e3564,_0x30864d,'entity\x20found');logger['debug'](_0x9e56('0xb2'),_0x1e3564,_0x30864d,_0x9e56('0xb3'),JSON[_0x9e56('0x25')](_0x361720));if(_0x30bf3f['account'][_0x9e56('0x43')]==='twilio'){return _0x29fdf0[_0x9e56('0x2a')](_0x30864d)[_0x9e56('0x2f')](_0x9e56('0xb4'),_0x9e56('0xb5'))[_0x9e56('0x3c')](_0x9e56('0xb6'));}else{return _0x29fdf0[_0x9e56('0x2a')](_0x30864d)[_0x9e56('0xb7')](_0x361720);}}})[_0x9e56('0x5c')](handleError(_0x29fdf0,null));};exports[_0x9e56('0x3c')]=function(_0x4a7c47,_0x4f311d,_0x40e36c){var _0x3590f6,_0x47ae45,_0x58b018;if(_[_0x9e56('0x99')](_0x4a7c47[_0x9e56('0x66')][_0x9e56('0x66')])||_0x4a7c47[_0x9e56('0x66')][_0x9e56('0x66')]===''){throw new db[(_0x9e56('0x88'))][(_0x9e56('0x89'))](_0x9e56('0x9a'));}if(_[_0x9e56('0x99')](_0x4a7c47[_0x9e56('0x66')]['to'])){throw new db[(_0x9e56('0x88'))]['ValidationError']('to\x20is\x20mandatory');}_0x3590f6=_0x4a7c47[_0x9e56('0x66')]['to'];return db[_0x9e56('0x59')]['find']({'where':{'id':_0x4a7c47['params']['id']},'include':[{'model':db[_0x9e56('0xb8')],'as':_0x9e56('0xb9'),'include':[{'model':db[_0x9e56('0x87')],'as':_0x9e56('0x9e'),'where':{'mobile':_0x3590f6},'limit':0x1,'order':[[_0x9e56('0x8c'),'DESC']]}]}]})[_0x9e56('0x21')](handleEntityNotFound(_0x4f311d,null))[_0x9e56('0x21')](function(_0x489846){if(_0x489846&&_0x489846[_0x9e56('0xb9')]){_0x47ae45=_0x489846[_0x9e56('0x36')]({'plain':!![]});if(_0x47ae45['List']&&_0x47ae45[_0x9e56('0xb9')]['Contacts'][_0x9e56('0x4c')]){return _0x47ae45[_0x9e56('0xb9')][_0x9e56('0x9e')][0x0];}return db[_0x9e56('0x87')][_0x9e56('0x60')](_['defaults'](_0x4a7c47[_0x9e56('0x66')],{'firstName':_0x3590f6,'mobile':_0x3590f6,'phone':_0x3590f6,'ListId':_0x47ae45['ListId']}));}})[_0x9e56('0x21')](handleEntityNotFound(_0x4f311d,null))[_0x9e56('0x21')](function(_0x27cd28){if(_0x27cd28){_0x58b018=_0x27cd28;return db[_0x9e56('0xa1')][_0x9e56('0x5f')]({'where':{'ContactId':_0x58b018['id'],'closed':![],'WhatsappAccountId':_0x47ae45['id']}})['then'](function(_0x28a75f){if(_0x28a75f){return[_0x28a75f,![]];}return db[_0x9e56('0xa1')]['create']({'UserId':_0x4a7c47[_0x9e56('0x61')]['id'],'ContactId':_0x58b018['id'],'WhatsappAccountId':_0x47ae45['id'],'phone':_0x3590f6,'firstMsgDirection':'out','Messages':[_[_0x9e56('0x53')](_0x4a7c47[_0x9e56('0x66')],{'read':![],'body':_0x4a7c47[_0x9e56('0x66')][_0x9e56('0x66')],'phone':_0x3590f6,'WhatsappAccountId':_0x47ae45['id'],'UserId':_0x4a7c47[_0x9e56('0x61')]['id'],'ContactId':_0x58b018['id']})]},{'include':[{'model':db[_0x9e56('0xa7')],'as':_0x9e56('0xba')}]})[_0x9e56('0x21')](function(_0x194ea2){return[_0x194ea2,!![]];});});}})[_0x9e56('0x74')](function(_0x2c64e4,_0x785ee0){if(_0x785ee0){return _0x2c64e4;}return db[_0x9e56('0xa7')][_0x9e56('0x60')](_['merge'](_0x4a7c47[_0x9e56('0x66')],{'read':![],'body':_0x4a7c47['body'][_0x9e56('0x66')],'phone':_0x3590f6,'WhatsappAccountId':_0x47ae45['id'],'WhatsappInteractionId':_0x2c64e4['id'],'UserId':_0x4a7c47[_0x9e56('0x61')]['id'],'ContactId':_0x58b018['id']}))['then'](function(_0x25b6d2){_0x2c64e4[_0x9e56('0xbb')]['Messages']=[];_0x2c64e4[_0x9e56('0xbb')][_0x9e56('0xba')][_0x9e56('0xa4')](_0x25b6d2[_0x9e56('0xbb')]);return _0x2c64e4;});})[_0x9e56('0x21')](respondWithResult(_0x4f311d,null))[_0x9e56('0x5c')](handleError(_0x4f311d,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index 00b3d9f..30610d5 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 _0xaff2=['remove','emit','hook','exports','events','../../mysqldb','setMaxListeners','save'];(function(_0xf078b7,_0x3e8282){var _0x3712c1=function(_0x207c52){while(--_0x207c52){_0xf078b7['push'](_0xf078b7['shift']());}};_0x3712c1(++_0x3e8282);}(_0xaff2,0x12c));var _0x2aff=function(_0x35bad0,_0x21927d){_0x35bad0=_0x35bad0-0x0;var _0x4fe50f=_0xaff2[_0x35bad0];return _0x4fe50f;};'use strict';var EventEmitter=require(_0x2aff('0x0'));var WhatsappAccount=require(_0x2aff('0x1'))['db']['WhatsappAccount'];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x2aff('0x2')](0x0);var events={'afterCreate':_0x2aff('0x3'),'afterUpdate':'update','afterDestroy':_0x2aff('0x4')};function emitEvent(_0x3565ce){return function(_0x2f565e,_0x496490,_0x3e21c2){WhatsappAccountEvents[_0x2aff('0x5')](_0x3565ce+':'+_0x2f565e['id'],_0x2f565e);WhatsappAccountEvents[_0x2aff('0x5')](_0x3565ce,_0x2f565e);_0x3e21c2(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappAccount[_0x2aff('0x6')](e,emitEvent(event));}}module[_0x2aff('0x7')]=WhatsappAccountEvents; \ No newline at end of file +var _0xa45a=['hook','exports','events','../../mysqldb','WhatsappAccount','update','remove','emit','hasOwnProperty'];(function(_0x509425,_0x2dbbf3){var _0x49b131=function(_0x21f122){while(--_0x21f122){_0x509425['push'](_0x509425['shift']());}};_0x49b131(++_0x2dbbf3);}(_0xa45a,0x1bb));var _0xaa45=function(_0x49ab40,_0x41917c){_0x49ab40=_0x49ab40-0x0;var _0x445824=_0xa45a[_0x49ab40];return _0x445824;};'use strict';var EventEmitter=require(_0xaa45('0x0'));var WhatsappAccount=require(_0xaa45('0x1'))['db'][_0xaa45('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xaa45('0x3'),'afterDestroy':_0xaa45('0x4')};function emitEvent(_0x2ed5b4){return function(_0x327256,_0x53fdfa,_0x1ae76d){WhatsappAccountEvents[_0xaa45('0x5')](_0x2ed5b4+':'+_0x327256['id'],_0x327256);WhatsappAccountEvents['emit'](_0x2ed5b4,_0x327256);_0x1ae76d(null);};}for(var e in events){if(events[_0xaa45('0x6')](e)){var event=events[e];WhatsappAccount[_0xaa45('0x7')](e,emitEvent(event));}}module[_0xaa45('0x8')]=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index cf1f8e3..84be103 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 _0x0d72=['../../config/environment','./whatsappAccount.attributes','define','whatsapp_accounts','lodash','../../config/logger','api','moment','bluebird','rimraf'];(function(_0x19210b,_0x30c2eb){var _0x9aa776=function(_0x4b73e4){while(--_0x4b73e4){_0x19210b['push'](_0x19210b['shift']());}};_0x9aa776(++_0x30c2eb);}(_0x0d72,0x1b2));var _0x20d7=function(_0x36684d,_0x1feb17){_0x36684d=_0x36684d-0x0;var _0x2f4d3e=_0x0d72[_0x36684d];return _0x2f4d3e;};'use strict';var _=require(_0x20d7('0x0'));var util=require('util');var logger=require(_0x20d7('0x1'))(_0x20d7('0x2'));var moment=require(_0x20d7('0x3'));var BPromise=require(_0x20d7('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x20d7('0x5'));var config=require(_0x20d7('0x6'));var attributes=require(_0x20d7('0x7'));module['exports']=function(_0x551820,_0x48d874){return _0x551820[_0x20d7('0x8')]('WhatsappAccount',attributes,{'tableName':_0x20d7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb550=['api','moment','bluebird','rimraf','../../config/environment','./whatsappAccount.attributes','exports','define','WhatsappAccount','whatsapp_accounts','util','../../config/logger'];(function(_0x1f625b,_0x276b0e){var _0x748222=function(_0x324a51){while(--_0x324a51){_0x1f625b['push'](_0x1f625b['shift']());}};_0x748222(++_0x276b0e);}(_0xb550,0x15a));var _0x0b55=function(_0x1029d8,_0x5e906d){_0x1029d8=_0x1029d8-0x0;var _0x30385e=_0xb550[_0x1029d8];return _0x30385e;};'use strict';var _=require('lodash');var util=require(_0x0b55('0x0'));var logger=require(_0x0b55('0x1'))(_0x0b55('0x2'));var moment=require(_0x0b55('0x3'));var BPromise=require(_0x0b55('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x0b55('0x5'));var config=require(_0x0b55('0x6'));var attributes=require(_0x0b55('0x7'));module[_0x0b55('0x8')]=function(_0x49bd7c,_0x47fff8){return _0x49bd7c[_0x0b55('0x9')](_0x0b55('0xa'),attributes,{'tableName':_0x0b55('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.rpc.js b/server/api/whatsappAccount/whatsappAccount.rpc.js index 6ca67e7..d5763ac 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 _0xe4e7=['where','attributes','include','map','model','ShowWhatsappAccount','lodash','util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','register','request','then','info','WhatsappAccount,\x20%s,\x20%s','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','WhatsappAccount','find','options','raw'];(function(_0x92724b,_0x18e7d6){var _0x12e4f5=function(_0x406734){while(--_0x406734){_0x92724b['push'](_0x92724b['shift']());}};_0x12e4f5(++_0x18e7d6);}(_0xe4e7,0x78));var _0x7e4e=function(_0x209bb3,_0x500110){_0x209bb3=_0x209bb3-0x0;var _0x4f6ca5=_0xe4e7[_0x209bb3];return _0x4f6ca5;};'use strict';var _=require(_0x7e4e('0x0'));var util=require(_0x7e4e('0x1'));var moment=require(_0x7e4e('0x2'));var BPromise=require(_0x7e4e('0x3'));var rs=require(_0x7e4e('0x4'));var fs=require('fs');var Redis=require(_0x7e4e('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7e4e('0x6'));var config=require(_0x7e4e('0x7'));var jayson=require(_0x7e4e('0x8'));var client=jayson[_0x7e4e('0x9')][_0x7e4e('0xa')]({'port':0x232a});config[_0x7e4e('0xb')]=_[_0x7e4e('0xc')](config[_0x7e4e('0xb')],{'host':_0x7e4e('0xd'),'port':0x18eb});var socket=require(_0x7e4e('0xe'))(new Redis(config[_0x7e4e('0xb')]));require(_0x7e4e('0xf'))[_0x7e4e('0x10')](socket);function respondWithRpcPromise(_0x5f2408,_0x4545c4,_0x5c6c27){return new BPromise(function(_0x204854,_0x5f3098){return client[_0x7e4e('0x11')](_0x5f2408,_0x5c6c27)[_0x7e4e('0x12')](function(_0x570f6a){logger[_0x7e4e('0x13')](_0x7e4e('0x14'),_0x4545c4,'request\x20sent');logger[_0x7e4e('0x15')](_0x7e4e('0x16'),_0x4545c4,_0x7e4e('0x17'),JSON[_0x7e4e('0x18')](_0x570f6a));if(_0x570f6a[_0x7e4e('0x19')]){if(_0x570f6a[_0x7e4e('0x19')]['code']===0x1f4){logger[_0x7e4e('0x19')](_0x7e4e('0x14'),_0x4545c4,_0x570f6a[_0x7e4e('0x19')][_0x7e4e('0x1a')]);return _0x5f3098(_0x570f6a['error']['message']);}logger[_0x7e4e('0x19')](_0x7e4e('0x14'),_0x4545c4,_0x570f6a[_0x7e4e('0x19')][_0x7e4e('0x1a')]);return _0x204854(_0x570f6a['error'][_0x7e4e('0x1a')]);}else{logger[_0x7e4e('0x13')]('WhatsappAccount,\x20%s,\x20%s',_0x4545c4,'request\x20sent');_0x204854(_0x570f6a['result'][_0x7e4e('0x1a')]);}})[_0x7e4e('0x1b')](function(_0xd95ec5){logger[_0x7e4e('0x19')](_0x7e4e('0x14'),_0x4545c4,_0xd95ec5);_0x5f3098(_0xd95ec5);});});}exports['ShowWhatsappAccount']=function(_0xeed836){var _0x32ff29=this;return new Promise(function(_0x58747a,_0x1fea59){return db[_0x7e4e('0x1c')][_0x7e4e('0x1d')]({'raw':_0xeed836[_0x7e4e('0x1e')]?_0xeed836[_0x7e4e('0x1e')][_0x7e4e('0x1f')]===undefined?!![]:![]:!![],'where':_0xeed836['options']?_0xeed836[_0x7e4e('0x1e')][_0x7e4e('0x20')]||null:null,'attributes':_0xeed836['options']?_0xeed836[_0x7e4e('0x1e')][_0x7e4e('0x21')]||null:null,'include':_0xeed836[_0x7e4e('0x1e')]?_0xeed836[_0x7e4e('0x1e')][_0x7e4e('0x22')]?_[_0x7e4e('0x23')](_0xeed836[_0x7e4e('0x1e')][_0x7e4e('0x22')],function(_0x12f381){return{'model':db[_0x12f381[_0x7e4e('0x24')]],'as':_0x12f381['as'],'attributes':_0x12f381[_0x7e4e('0x21')],'include':_0x12f381[_0x7e4e('0x22')]?_['map'](_0x12f381[_0x7e4e('0x22')],function(_0x3758ea){return{'model':db[_0x3758ea[_0x7e4e('0x24')]],'as':_0x3758ea['as'],'attributes':_0x3758ea[_0x7e4e('0x21')],'include':_0x3758ea[_0x7e4e('0x22')]?_[_0x7e4e('0x23')](_0x3758ea[_0x7e4e('0x22')],function(_0x126b3d){return{'model':db[_0x126b3d['model']],'as':_0x126b3d['as'],'attributes':_0x126b3d[_0x7e4e('0x21')]};}):[]};}):[]};}):[]:[]})[_0x7e4e('0x12')](function(_0x4cff12){logger[_0x7e4e('0x13')]('ShowWhatsappAccount',_0xeed836);logger[_0x7e4e('0x15')](_0x7e4e('0x25'),_0xeed836,JSON['stringify'](_0x4cff12));_0x58747a(_0x4cff12);})[_0x7e4e('0x1b')](function(_0x4cf320){logger[_0x7e4e('0x19')](_0x7e4e('0x25'),_0x4cf320[_0x7e4e('0x1a')],_0xeed836);_0x1fea59(_0x32ff29[_0x7e4e('0x19')](0x1f4,_0x4cf320[_0x7e4e('0x1a')]));});});}; \ No newline at end of file +var _0x4d36=['./whatsappAccount.socket','register','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','ShowWhatsappAccount','WhatsappAccount','find','options','raw','where','map','model','attributes','include','stringify','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter'];(function(_0x24db24,_0x1ff6a0){var _0x1c2c6b=function(_0x1014b0){while(--_0x1014b0){_0x24db24['push'](_0x24db24['shift']());}};_0x1c2c6b(++_0x1ff6a0);}(_0x4d36,0x159));var _0x64d3=function(_0x2f2360,_0x151089){_0x2f2360=_0x2f2360-0x0;var _0x1cc8d3=_0x4d36[_0x2f2360];return _0x1cc8d3;};'use strict';var _=require(_0x64d3('0x0'));var util=require(_0x64d3('0x1'));var moment=require(_0x64d3('0x2'));var BPromise=require('bluebird');var rs=require(_0x64d3('0x3'));var fs=require('fs');var Redis=require(_0x64d3('0x4'));var db=require(_0x64d3('0x5'))['db'];var utils=require(_0x64d3('0x6'));var logger=require('../../config/logger')(_0x64d3('0x7'));var config=require(_0x64d3('0x8'));var jayson=require(_0x64d3('0x9'));var client=jayson[_0x64d3('0xa')][_0x64d3('0xb')]({'port':0x232a});config[_0x64d3('0xc')]=_[_0x64d3('0xd')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x64d3('0xe'))(new Redis(config['redis']));require(_0x64d3('0xf'))[_0x64d3('0x10')](socket);function respondWithRpcPromise(_0x9f24fb,_0x50bf70,_0x574112){return new BPromise(function(_0x3bec2e,_0x36f8f7){return client[_0x64d3('0x11')](_0x9f24fb,_0x574112)[_0x64d3('0x12')](function(_0x3a40d7){logger[_0x64d3('0x13')](_0x64d3('0x14'),_0x50bf70,_0x64d3('0x15'));logger[_0x64d3('0x16')](_0x64d3('0x17'),_0x50bf70,'request\x20sent',JSON['stringify'](_0x3a40d7));if(_0x3a40d7['error']){if(_0x3a40d7[_0x64d3('0x18')][_0x64d3('0x19')]===0x1f4){logger[_0x64d3('0x18')](_0x64d3('0x14'),_0x50bf70,_0x3a40d7[_0x64d3('0x18')][_0x64d3('0x1a')]);return _0x36f8f7(_0x3a40d7[_0x64d3('0x18')]['message']);}logger['error'](_0x64d3('0x14'),_0x50bf70,_0x3a40d7[_0x64d3('0x18')]['message']);return _0x3bec2e(_0x3a40d7[_0x64d3('0x18')][_0x64d3('0x1a')]);}else{logger[_0x64d3('0x13')](_0x64d3('0x14'),_0x50bf70,'request\x20sent');_0x3bec2e(_0x3a40d7[_0x64d3('0x1b')][_0x64d3('0x1a')]);}})[_0x64d3('0x1c')](function(_0x2311e2){logger[_0x64d3('0x18')](_0x64d3('0x14'),_0x50bf70,_0x2311e2);_0x36f8f7(_0x2311e2);});});}exports[_0x64d3('0x1d')]=function(_0x6bb729){var _0x1d24b9=this;return new Promise(function(_0x381d7c,_0x5e32b7){return db[_0x64d3('0x1e')][_0x64d3('0x1f')]({'raw':_0x6bb729[_0x64d3('0x20')]?_0x6bb729[_0x64d3('0x20')][_0x64d3('0x21')]===undefined?!![]:![]:!![],'where':_0x6bb729['options']?_0x6bb729[_0x64d3('0x20')][_0x64d3('0x22')]||null:null,'attributes':_0x6bb729[_0x64d3('0x20')]?_0x6bb729[_0x64d3('0x20')]['attributes']||null:null,'include':_0x6bb729[_0x64d3('0x20')]?_0x6bb729[_0x64d3('0x20')]['include']?_[_0x64d3('0x23')](_0x6bb729['options']['include'],function(_0x352ef3){return{'model':db[_0x352ef3[_0x64d3('0x24')]],'as':_0x352ef3['as'],'attributes':_0x352ef3[_0x64d3('0x25')],'include':_0x352ef3[_0x64d3('0x26')]?_[_0x64d3('0x23')](_0x352ef3[_0x64d3('0x26')],function(_0x5134ee){return{'model':db[_0x5134ee[_0x64d3('0x24')]],'as':_0x5134ee['as'],'attributes':_0x5134ee[_0x64d3('0x25')],'include':_0x5134ee['include']?_[_0x64d3('0x23')](_0x5134ee[_0x64d3('0x26')],function(_0x3e5533){return{'model':db[_0x3e5533[_0x64d3('0x24')]],'as':_0x3e5533['as'],'attributes':_0x3e5533[_0x64d3('0x25')]};}):[]};}):[]};}):[]:[]})[_0x64d3('0x12')](function(_0x3bd8f3){logger[_0x64d3('0x13')]('ShowWhatsappAccount',_0x6bb729);logger[_0x64d3('0x16')]('ShowWhatsappAccount',_0x6bb729,JSON[_0x64d3('0x27')](_0x3bd8f3));_0x381d7c(_0x3bd8f3);})[_0x64d3('0x1c')](function(_0xbfcb09){logger[_0x64d3('0x18')](_0x64d3('0x1d'),_0xbfcb09[_0x64d3('0x1a')],_0x6bb729);_0x5e32b7(_0x1d24b9[_0x64d3('0x18')](0x1f4,_0xbfcb09['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index 9938b12..549b708 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 _0x8d1c=['emit','removeListener','register','save','remove','update'];(function(_0x1d1d09,_0x504d77){var _0x8827e=function(_0x4f3128){while(--_0x4f3128){_0x1d1d09['push'](_0x1d1d09['shift']());}};_0x8827e(++_0x504d77);}(_0x8d1c,0x129));var _0xc8d1=function(_0x213b27,_0x3a531a){_0x213b27=_0x213b27-0x0;var _0x2c04ee=_0x8d1c[_0x213b27];return _0x2c04ee;};'use strict';var WhatsappAccountEvents=require('./whatsappAccount.events');var events=[_0xc8d1('0x0'),_0xc8d1('0x1'),_0xc8d1('0x2')];function createListener(_0x361702,_0x464bb5){return function(_0x539d11){_0x464bb5[_0xc8d1('0x3')](_0x361702,_0x539d11);};}function removeListener(_0x13e35d,_0x5f038c){return function(){WhatsappAccountEvents[_0xc8d1('0x4')](_0x13e35d,_0x5f038c);};}exports[_0xc8d1('0x5')]=function(_0x596024){for(var _0x112a8a=0x0,_0x428f43=events['length'];_0x112a8a<_0x428f43;_0x112a8a++){var _0x466158=events[_0x112a8a];var _0x20ac75=createListener('whatsappAccount:'+_0x466158,_0x596024);WhatsappAccountEvents['on'](_0x466158,_0x20ac75);}}; \ No newline at end of file +var _0x6b5d=['whatsappAccount:','./whatsappAccount.events','save','remove','removeListener','register','length'];(function(_0x44676a,_0x3e7b88){var _0x588695=function(_0x168ed1){while(--_0x168ed1){_0x44676a['push'](_0x44676a['shift']());}};_0x588695(++_0x3e7b88);}(_0x6b5d,0x1e4));var _0xd6b5=function(_0x3f05b0,_0x58b220){_0x3f05b0=_0x3f05b0-0x0;var _0x190833=_0x6b5d[_0x3f05b0];return _0x190833;};'use strict';var WhatsappAccountEvents=require(_0xd6b5('0x0'));var events=[_0xd6b5('0x1'),_0xd6b5('0x2'),'update'];function createListener(_0x3ac2ad,_0x4e0b61){return function(_0x2f5fd2){_0x4e0b61['emit'](_0x3ac2ad,_0x2f5fd2);};}function removeListener(_0x26ada9,_0xf3114e){return function(){WhatsappAccountEvents[_0xd6b5('0x3')](_0x26ada9,_0xf3114e);};}exports[_0xd6b5('0x4')]=function(_0x476c13){for(var _0x3888c9=0x0,_0x105ff1=events[_0xd6b5('0x5')];_0x3888c9<_0x105ff1;_0x3888c9++){var _0x58e611=events[_0x3888c9];var _0x1834de=createListener(_0xd6b5('0x6')+_0x58e611,_0x476c13);WhatsappAccountEvents['on'](_0x58e611,_0x1834de);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index d6358f9..2c623f5 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 _0xe70b=['put','/:id','update','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./whatsappApplication.controller','isAuthenticated','index','get','show','post','create'];(function(_0x5257bf,_0xf39844){var _0x30f32b=function(_0x252bff){while(--_0x252bff){_0x5257bf['push'](_0x5257bf['shift']());}};_0x30f32b(++_0xf39844);}(_0xe70b,0x194));var _0xbe70=function(_0x5ec175,_0x19ae84){_0x5ec175=_0x5ec175-0x0;var _0x5a6e6e=_0xe70b[_0x5ec175];return _0x5a6e6e;};'use strict';var multer=require('multer');var util=require(_0xbe70('0x0'));var path=require(_0xbe70('0x1'));var timeout=require(_0xbe70('0x2'));var express=require(_0xbe70('0x3'));var router=express[_0xbe70('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xbe70('0x5'));var interaction=require(_0xbe70('0x6'));var config=require('../../config/environment');var controller=require(_0xbe70('0x7'));router['get']('/',auth[_0xbe70('0x8')](),controller[_0xbe70('0x9')]);router[_0xbe70('0xa')]('/:id',auth[_0xbe70('0x8')](),controller[_0xbe70('0xb')]);router[_0xbe70('0xc')]('/',auth[_0xbe70('0x8')](),controller[_0xbe70('0xd')]);router[_0xbe70('0xe')](_0xbe70('0xf'),auth['isAuthenticated'](),controller[_0xbe70('0x10')]);router['delete'](_0xbe70('0xf'),auth[_0xbe70('0x8')](),controller[_0xbe70('0x11')]);module[_0xbe70('0x12')]=router; \ No newline at end of file +var _0x1bf5=['get','/:id','show','create','put','update','delete','destroy','exports','multer','util','path','fs-extra','../../components/auth/service','./whatsappApplication.controller','isAuthenticated'];(function(_0x2acb77,_0x272b50){var _0x11c4ad=function(_0x371a01){while(--_0x371a01){_0x2acb77['push'](_0x2acb77['shift']());}};_0x11c4ad(++_0x272b50);}(_0x1bf5,0x109));var _0x51bf=function(_0x272ace,_0x25afbb){_0x272ace=_0x272ace-0x0;var _0x478930=_0x1bf5[_0x272ace];return _0x478930;};'use strict';var multer=require(_0x51bf('0x0'));var util=require(_0x51bf('0x1'));var path=require(_0x51bf('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x51bf('0x3'));var auth=require(_0x51bf('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x51bf('0x5'));router['get']('/',auth[_0x51bf('0x6')](),controller['index']);router[_0x51bf('0x7')](_0x51bf('0x8'),auth[_0x51bf('0x6')](),controller[_0x51bf('0x9')]);router['post']('/',auth[_0x51bf('0x6')](),controller[_0x51bf('0xa')]);router[_0x51bf('0xb')]('/:id',auth[_0x51bf('0x6')](),controller[_0x51bf('0xc')]);router[_0x51bf('0xd')](_0x51bf('0x8'),auth[_0x51bf('0x6')](),controller[_0x51bf('0xe')]);module[_0x51bf('0xf')]=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index c1a18fe..372e887 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 _0x1db7=['exports','INTEGER','STRING','sequelize'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0x1db7,0x127));var _0x71db=function(_0x471158,_0x466413){_0x471158=_0x471158-0x0;var _0x49e20c=_0x1db7[_0x471158];return _0x49e20c;};'use strict';var Sequelize=require(_0x71db('0x0'));module[_0x71db('0x1')]={'priority':{'type':Sequelize[_0x71db('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x71db('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x71db('0x3')]},'interval':{'type':Sequelize[_0x71db('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x5685=['TEXT','*,*,*,*','sequelize','STRING','noop'];(function(_0x5b5654,_0x58f38c){var _0xc5619=function(_0x27b247){while(--_0x27b247){_0x5b5654['push'](_0x5b5654['shift']());}};_0xc5619(++_0x58f38c);}(_0x5685,0x16f));var _0x5568=function(_0x57aab0,_0x2432c3){_0x57aab0=_0x57aab0-0x0;var _0x2e2acb=_0x5685[_0x57aab0];return _0x2e2acb;};'use strict';var Sequelize=require(_0x5568('0x0'));module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x5568('0x1')],'allowNull':![],'defaultValue':_0x5568('0x2')},'appdata':{'type':Sequelize[_0x5568('0x3')]()},'description':{'type':Sequelize[_0x5568('0x1')]},'interval':{'type':Sequelize[_0x5568('0x1')],'defaultValue':_0x5568('0x4')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index 05942bc..752c34b 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 _0x3a15=['fields','nolimit','order','sort','filters','pick','filter','where','merge','type','VIRTUAL','options','findAll','rows','catch','params','length','include','find','create','body','eml-format','zip-dir','request-promise','moment','bluebird','path','fs-extra','squel','crypto','jsforce','to-csv','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','destroy','error','stack','name','send','index','map','WhatsappApplication','rawAttributes','fieldName','model','query','keys','attributes','intersection'];(function(_0x42b0d3,_0x38d496){var _0x412ffc=function(_0x339220){while(--_0x339220){_0x42b0d3['push'](_0x42b0d3['shift']());}};_0x412ffc(++_0x38d496);}(_0x3a15,0xde));var _0x53a1=function(_0x58fc03,_0x4f1093){_0x58fc03=_0x58fc03-0x0;var _0x4d27ae=_0x3a15[_0x58fc03];return _0x4d27ae;};'use strict';var emlformat=require(_0x53a1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x53a1('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x53a1('0x2'));var moment=require(_0x53a1('0x3'));var BPromise=require(_0x53a1('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x53a1('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x53a1('0x6'));var _=require('lodash');var squel=require(_0x53a1('0x7'));var crypto=require(_0x53a1('0x8'));var jsforce=require(_0x53a1('0x9'));var deskjs=require('desk.js');var toCsv=require(_0x53a1('0xa'));var querystring=require(_0x53a1('0xb'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x53a1('0xc'));var as=require(_0x53a1('0xd'));var hardwareService=require(_0x53a1('0xe'));var logger=require(_0x53a1('0xf'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x53a1('0x10'));var db=require(_0x53a1('0x11'))['db'];function respondWithStatusCode(_0x50cd84,_0x1a89e9){_0x1a89e9=_0x1a89e9||0xcc;return function(_0x17d23b){if(_0x17d23b){return _0x50cd84[_0x53a1('0x12')](_0x1a89e9);}return _0x50cd84['status'](_0x1a89e9)[_0x53a1('0x13')]();};}function respondWithResult(_0x456144,_0x3d66f5){_0x3d66f5=_0x3d66f5||0xc8;return function(_0x36e275){if(_0x36e275){return _0x456144[_0x53a1('0x14')](_0x3d66f5)[_0x53a1('0x15')](_0x36e275);}};}function respondWithFilteredResult(_0x762aaa,_0x3313fe){return function(_0x474d58){if(_0x474d58){var _0x552306=typeof _0x3313fe[_0x53a1('0x16')]===_0x53a1('0x17')&&typeof _0x3313fe[_0x53a1('0x18')]===_0x53a1('0x17');var _0x153ce9=_0x474d58[_0x53a1('0x19')];var _0x1cb902=_0x552306?0x0:_0x3313fe['offset'];var _0x3c7bed=_0x552306?_0x474d58['count']:_0x3313fe[_0x53a1('0x16')]+_0x3313fe[_0x53a1('0x18')];var _0x6f21f7;if(_0x3c7bed>=_0x153ce9){_0x3c7bed=_0x153ce9;_0x6f21f7=0xc8;}else{_0x6f21f7=0xce;}_0x762aaa[_0x53a1('0x14')](_0x6f21f7);return _0x762aaa[_0x53a1('0x1a')](_0x53a1('0x1b'),_0x1cb902+'-'+_0x3c7bed+'/'+_0x153ce9)['json'](_0x474d58);}return null;};}function patchUpdates(_0x16916f){return function(_0x167671){try{jsonpatch['apply'](_0x167671,_0x16916f,!![]);}catch(_0xcea683){return BPromise[_0x53a1('0x1c')](_0xcea683);}return _0x167671['save']();};}function saveUpdates(_0x2f0f7e,_0x11253c){return function(_0x5173a3){if(_0x5173a3){return _0x5173a3[_0x53a1('0x1d')](_0x2f0f7e)[_0x53a1('0x1e')](function(_0x5f4135){return _0x5f4135;});}return null;};}function removeEntity(_0x1140a0,_0x1a4dab){return function(_0x471e34){if(_0x471e34){return _0x471e34[_0x53a1('0x1f')]()['then'](function(){_0x1140a0[_0x53a1('0x14')](0xcc)[_0x53a1('0x13')]();});}};}function handleEntityNotFound(_0x2a71f1,_0x1027d4){return function(_0x3bf15c){if(!_0x3bf15c){_0x2a71f1[_0x53a1('0x12')](0x194);}return _0x3bf15c;};}function handleError(_0x507a9e,_0xc8a720){_0xc8a720=_0xc8a720||0x1f4;return function(_0xc86808){logger[_0x53a1('0x20')](_0xc86808[_0x53a1('0x21')]);if(_0xc86808[_0x53a1('0x22')]){delete _0xc86808[_0x53a1('0x22')];}_0x507a9e[_0x53a1('0x14')](_0xc8a720)[_0x53a1('0x23')](_0xc86808);};}exports[_0x53a1('0x24')]=function(_0x162bd1,_0x255768){var _0x15a530={},_0x5cb95e={},_0x61d58c={'count':0x0,'rows':[]};var _0x384f20=_[_0x53a1('0x25')](db[_0x53a1('0x26')][_0x53a1('0x27')],function(_0x2da6b5){return{'name':_0x2da6b5[_0x53a1('0x28')],'type':_0x2da6b5['type']['key']};});_0x5cb95e[_0x53a1('0x29')]=_[_0x53a1('0x25')](_0x384f20,_0x53a1('0x22'));_0x5cb95e[_0x53a1('0x2a')]=_[_0x53a1('0x2b')](_0x162bd1[_0x53a1('0x2a')]);_0x5cb95e['filters']=_['intersection'](_0x5cb95e[_0x53a1('0x29')],_0x5cb95e[_0x53a1('0x2a')]);_0x15a530[_0x53a1('0x2c')]=_[_0x53a1('0x2d')](_0x5cb95e[_0x53a1('0x29')],qs[_0x53a1('0x2e')](_0x162bd1[_0x53a1('0x2a')][_0x53a1('0x2e')]));_0x15a530[_0x53a1('0x2c')]=_0x15a530['attributes']['length']?_0x15a530[_0x53a1('0x2c')]:_0x5cb95e[_0x53a1('0x29')];if(!_0x162bd1[_0x53a1('0x2a')]['hasOwnProperty'](_0x53a1('0x2f'))){_0x15a530[_0x53a1('0x18')]=qs[_0x53a1('0x18')](_0x162bd1[_0x53a1('0x2a')][_0x53a1('0x18')]);_0x15a530[_0x53a1('0x16')]=qs['offset'](_0x162bd1[_0x53a1('0x2a')][_0x53a1('0x16')]);}_0x15a530[_0x53a1('0x30')]=qs[_0x53a1('0x31')](_0x162bd1['query'][_0x53a1('0x31')]);_0x15a530['where']=qs[_0x53a1('0x32')](_[_0x53a1('0x33')](_0x162bd1[_0x53a1('0x2a')],_0x5cb95e[_0x53a1('0x32')]),_0x384f20);if(_0x162bd1[_0x53a1('0x2a')][_0x53a1('0x34')]){_0x15a530[_0x53a1('0x35')]=_[_0x53a1('0x36')](_0x15a530[_0x53a1('0x35')],{'$or':_['map'](_0x384f20,function(_0x2ae1f4){if(_0x2ae1f4[_0x53a1('0x37')]!==_0x53a1('0x38')){var _0x2d8216={};_0x2d8216[_0x2ae1f4[_0x53a1('0x22')]]={'$like':'%'+_0x162bd1['query'][_0x53a1('0x34')]+'%'};return _0x2d8216;}})});}_0x15a530=_[_0x53a1('0x36')]({},_0x15a530,_0x162bd1[_0x53a1('0x39')]);var _0x3da61c={'where':_0x15a530[_0x53a1('0x35')]};return db['WhatsappApplication']['count'](_0x3da61c)[_0x53a1('0x1e')](function(_0x3eb628){_0x61d58c[_0x53a1('0x19')]=_0x3eb628;if(_0x162bd1[_0x53a1('0x2a')]['includeAll']){_0x15a530['include']=[{'all':!![]}];}return db['WhatsappApplication'][_0x53a1('0x3a')](_0x15a530);})[_0x53a1('0x1e')](function(_0x45fb6d){_0x61d58c[_0x53a1('0x3b')]=_0x45fb6d;return _0x61d58c;})['then'](respondWithFilteredResult(_0x255768,_0x15a530))[_0x53a1('0x3c')](handleError(_0x255768,null));};exports['show']=function(_0x5c5c15,_0x21f531){var _0x4baec9={'raw':!![],'where':{'id':_0x5c5c15[_0x53a1('0x3d')]['id']}},_0x2e8242={};_0x2e8242['model']=_[_0x53a1('0x2b')](db['WhatsappApplication'][_0x53a1('0x27')]);_0x2e8242['query']=_[_0x53a1('0x2b')](_0x5c5c15['query']);_0x2e8242['filters']=_[_0x53a1('0x2d')](_0x2e8242['model'],_0x2e8242['query']);_0x4baec9[_0x53a1('0x2c')]=_[_0x53a1('0x2d')](_0x2e8242[_0x53a1('0x29')],qs['fields'](_0x5c5c15[_0x53a1('0x2a')][_0x53a1('0x2e')]));_0x4baec9[_0x53a1('0x2c')]=_0x4baec9[_0x53a1('0x2c')][_0x53a1('0x3e')]?_0x4baec9['attributes']:_0x2e8242[_0x53a1('0x29')];if(_0x5c5c15[_0x53a1('0x2a')]['includeAll']){_0x4baec9[_0x53a1('0x3f')]=[{'all':!![]}];}_0x4baec9=_[_0x53a1('0x36')]({},_0x4baec9,_0x5c5c15[_0x53a1('0x39')]);return db[_0x53a1('0x26')][_0x53a1('0x40')](_0x4baec9)['then'](handleEntityNotFound(_0x21f531,null))[_0x53a1('0x1e')](respondWithResult(_0x21f531,null))[_0x53a1('0x3c')](handleError(_0x21f531,null));};exports['create']=function(_0x5aabe1,_0x2d352d){return db[_0x53a1('0x26')][_0x53a1('0x41')](_0x5aabe1[_0x53a1('0x42')],{})[_0x53a1('0x1e')](respondWithResult(_0x2d352d,0xc9))[_0x53a1('0x3c')](handleError(_0x2d352d,null));};exports[_0x53a1('0x1d')]=function(_0x3c4aa3,_0x7dd2ee){if(_0x3c4aa3[_0x53a1('0x42')]['id']){delete _0x3c4aa3['body']['id'];}return db['WhatsappApplication'][_0x53a1('0x40')]({'where':{'id':_0x3c4aa3['params']['id']}})[_0x53a1('0x1e')](handleEntityNotFound(_0x7dd2ee,null))[_0x53a1('0x1e')](saveUpdates(_0x3c4aa3[_0x53a1('0x42')],null))['then'](respondWithResult(_0x7dd2ee,null))[_0x53a1('0x3c')](handleError(_0x7dd2ee,null));};exports[_0x53a1('0x1f')]=function(_0x455527,_0xbfe9aa){return db[_0x53a1('0x26')]['find']({'where':{'id':_0x455527[_0x53a1('0x3d')]['id']}})[_0x53a1('0x1e')](handleEntityNotFound(_0xbfe9aa,null))[_0x53a1('0x1e')](removeEntity(_0xbfe9aa,null))[_0x53a1('0x3c')](handleError(_0xbfe9aa,null));}; \ No newline at end of file +var _0xbff5=['bluebird','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','send','map','WhatsappApplication','rawAttributes','fieldName','key','name','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','params','catch','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x2d49c4,_0x3dd163){var _0x418d3d=function(_0x22a9ad){while(--_0x22a9ad){_0x2d49c4['push'](_0x2d49c4['shift']());}};_0x418d3d(++_0x3dd163);}(_0xbff5,0x1bc));var _0x5bff=function(_0x23e404,_0x47f976){_0x23e404=_0x23e404-0x0;var _0xa846df=_0xbff5[_0x23e404];return _0xa846df;};'use strict';var emlformat=require(_0x5bff('0x0'));var rimraf=require(_0x5bff('0x1'));var zipdir=require(_0x5bff('0x2'));var jsonpatch=require(_0x5bff('0x3'));var rp=require(_0x5bff('0x4'));var moment=require(_0x5bff('0x5'));var BPromise=require(_0x5bff('0x6'));var Mustache=require('mustache');var util=require(_0x5bff('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x5bff('0x8'));var ejs=require(_0x5bff('0x9'));var fs=require('fs');var fs_extra=require(_0x5bff('0xa'));var _=require(_0x5bff('0xb'));var squel=require(_0x5bff('0xc'));var crypto=require(_0x5bff('0xd'));var jsforce=require(_0x5bff('0xe'));var deskjs=require(_0x5bff('0xf'));var toCsv=require(_0x5bff('0x8'));var querystring=require('querystring');var Papa=require(_0x5bff('0x10'));var Redis=require('ioredis');var authService=require(_0x5bff('0x11'));var qs=require(_0x5bff('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5bff('0x13'));var logger=require('../../config/logger')(_0x5bff('0x14'));var utils=require('../../config/utils');var config=require(_0x5bff('0x15'));var licenseUtil=require(_0x5bff('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x132dc9,_0x50e1e9){_0x50e1e9=_0x50e1e9||0xcc;return function(_0x335e78){if(_0x335e78){return _0x132dc9[_0x5bff('0x17')](_0x50e1e9);}return _0x132dc9['status'](_0x50e1e9)[_0x5bff('0x18')]();};}function respondWithResult(_0xa16a3f,_0x5b0d2d){_0x5b0d2d=_0x5b0d2d||0xc8;return function(_0x5f2a55){if(_0x5f2a55){return _0xa16a3f[_0x5bff('0x19')](_0x5b0d2d)[_0x5bff('0x1a')](_0x5f2a55);}};}function respondWithFilteredResult(_0x3a507c,_0x4d883e){return function(_0x2d22ab){if(_0x2d22ab){var _0x4612ec=typeof _0x4d883e[_0x5bff('0x1b')]==='undefined'&&typeof _0x4d883e[_0x5bff('0x1c')]===_0x5bff('0x1d');var _0x38daa0=_0x2d22ab['count'];var _0xc9fbc3=_0x4612ec?0x0:_0x4d883e[_0x5bff('0x1b')];var _0x36653b=_0x4612ec?_0x2d22ab[_0x5bff('0x1e')]:_0x4d883e['offset']+_0x4d883e[_0x5bff('0x1c')];var _0x5357d4;if(_0x36653b>=_0x38daa0){_0x36653b=_0x38daa0;_0x5357d4=0xc8;}else{_0x5357d4=0xce;}_0x3a507c[_0x5bff('0x19')](_0x5357d4);return _0x3a507c['set'](_0x5bff('0x1f'),_0xc9fbc3+'-'+_0x36653b+'/'+_0x38daa0)[_0x5bff('0x1a')](_0x2d22ab);}return null;};}function patchUpdates(_0x2a83ce){return function(_0x6cbfa){try{jsonpatch[_0x5bff('0x20')](_0x6cbfa,_0x2a83ce,!![]);}catch(_0x2012e4){return BPromise[_0x5bff('0x21')](_0x2012e4);}return _0x6cbfa[_0x5bff('0x22')]();};}function saveUpdates(_0x155e16,_0x490bc1){return function(_0x5f2593){if(_0x5f2593){return _0x5f2593[_0x5bff('0x23')](_0x155e16)[_0x5bff('0x24')](function(_0x1e7f8a){return _0x1e7f8a;});}return null;};}function removeEntity(_0x352b1f,_0x31d26b){return function(_0x3913fd){if(_0x3913fd){return _0x3913fd[_0x5bff('0x25')]()['then'](function(){_0x352b1f['status'](0xcc)[_0x5bff('0x18')]();});}};}function handleEntityNotFound(_0x53bd97,_0x220c8f){return function(_0xcc091d){if(!_0xcc091d){_0x53bd97[_0x5bff('0x17')](0x194);}return _0xcc091d;};}function handleError(_0x6f18f1,_0xfa361d){_0xfa361d=_0xfa361d||0x1f4;return function(_0x1140eb){logger[_0x5bff('0x26')](_0x1140eb[_0x5bff('0x27')]);if(_0x1140eb['name']){delete _0x1140eb['name'];}_0x6f18f1[_0x5bff('0x19')](_0xfa361d)[_0x5bff('0x28')](_0x1140eb);};}exports['index']=function(_0x36a7d2,_0x588078){var _0x5470cb={},_0x3eda3a={},_0x5cf207={'count':0x0,'rows':[]};var _0x3ed23b=_[_0x5bff('0x29')](db[_0x5bff('0x2a')][_0x5bff('0x2b')],function(_0x48aee1){return{'name':_0x48aee1[_0x5bff('0x2c')],'type':_0x48aee1['type'][_0x5bff('0x2d')]};});_0x3eda3a['model']=_[_0x5bff('0x29')](_0x3ed23b,_0x5bff('0x2e'));_0x3eda3a[_0x5bff('0x2f')]=_[_0x5bff('0x30')](_0x36a7d2[_0x5bff('0x2f')]);_0x3eda3a[_0x5bff('0x31')]=_['intersection'](_0x3eda3a[_0x5bff('0x32')],_0x3eda3a[_0x5bff('0x2f')]);_0x5470cb[_0x5bff('0x33')]=_[_0x5bff('0x34')](_0x3eda3a[_0x5bff('0x32')],qs[_0x5bff('0x35')](_0x36a7d2[_0x5bff('0x2f')][_0x5bff('0x35')]));_0x5470cb['attributes']=_0x5470cb[_0x5bff('0x33')][_0x5bff('0x36')]?_0x5470cb[_0x5bff('0x33')]:_0x3eda3a[_0x5bff('0x32')];if(!_0x36a7d2['query'][_0x5bff('0x37')](_0x5bff('0x38'))){_0x5470cb['limit']=qs[_0x5bff('0x1c')](_0x36a7d2[_0x5bff('0x2f')][_0x5bff('0x1c')]);_0x5470cb[_0x5bff('0x1b')]=qs['offset'](_0x36a7d2[_0x5bff('0x2f')][_0x5bff('0x1b')]);}_0x5470cb[_0x5bff('0x39')]=qs['sort'](_0x36a7d2[_0x5bff('0x2f')]['sort']);_0x5470cb[_0x5bff('0x3a')]=qs[_0x5bff('0x31')](_[_0x5bff('0x3b')](_0x36a7d2['query'],_0x3eda3a[_0x5bff('0x31')]),_0x3ed23b);if(_0x36a7d2[_0x5bff('0x2f')][_0x5bff('0x3c')]){_0x5470cb['where']=_[_0x5bff('0x3d')](_0x5470cb[_0x5bff('0x3a')],{'$or':_['map'](_0x3ed23b,function(_0x265cdb){if(_0x265cdb[_0x5bff('0x3e')]!==_0x5bff('0x3f')){var _0x77a071={};_0x77a071[_0x265cdb[_0x5bff('0x2e')]]={'$like':'%'+_0x36a7d2['query'][_0x5bff('0x3c')]+'%'};return _0x77a071;}})});}_0x5470cb=_['merge']({},_0x5470cb,_0x36a7d2[_0x5bff('0x40')]);var _0x2fecb9={'where':_0x5470cb[_0x5bff('0x3a')]};return db[_0x5bff('0x2a')][_0x5bff('0x1e')](_0x2fecb9)[_0x5bff('0x24')](function(_0x1d0346){_0x5cf207['count']=_0x1d0346;if(_0x36a7d2['query'][_0x5bff('0x41')]){_0x5470cb[_0x5bff('0x42')]=[{'all':!![]}];}return db[_0x5bff('0x2a')][_0x5bff('0x43')](_0x5470cb);})[_0x5bff('0x24')](function(_0xb7b82a){_0x5cf207[_0x5bff('0x44')]=_0xb7b82a;return _0x5cf207;})[_0x5bff('0x24')](respondWithFilteredResult(_0x588078,_0x5470cb))['catch'](handleError(_0x588078,null));};exports[_0x5bff('0x45')]=function(_0x49676f,_0x3dc13f){var _0x1b8c7f={'raw':!![],'where':{'id':_0x49676f[_0x5bff('0x46')]['id']}},_0x543517={};_0x543517[_0x5bff('0x32')]=_['keys'](db[_0x5bff('0x2a')][_0x5bff('0x2b')]);_0x543517[_0x5bff('0x2f')]=_['keys'](_0x49676f[_0x5bff('0x2f')]);_0x543517[_0x5bff('0x31')]=_[_0x5bff('0x34')](_0x543517['model'],_0x543517[_0x5bff('0x2f')]);_0x1b8c7f[_0x5bff('0x33')]=_[_0x5bff('0x34')](_0x543517[_0x5bff('0x32')],qs['fields'](_0x49676f[_0x5bff('0x2f')]['fields']));_0x1b8c7f['attributes']=_0x1b8c7f[_0x5bff('0x33')][_0x5bff('0x36')]?_0x1b8c7f['attributes']:_0x543517[_0x5bff('0x32')];if(_0x49676f[_0x5bff('0x2f')]['includeAll']){_0x1b8c7f[_0x5bff('0x42')]=[{'all':!![]}];}_0x1b8c7f=_[_0x5bff('0x3d')]({},_0x1b8c7f,_0x49676f[_0x5bff('0x40')]);return db[_0x5bff('0x2a')]['find'](_0x1b8c7f)[_0x5bff('0x24')](handleEntityNotFound(_0x3dc13f,null))[_0x5bff('0x24')](respondWithResult(_0x3dc13f,null))[_0x5bff('0x47')](handleError(_0x3dc13f,null));};exports[_0x5bff('0x48')]=function(_0x1e94c5,_0x2588b8){return db['WhatsappApplication'][_0x5bff('0x48')](_0x1e94c5[_0x5bff('0x49')],{})['then'](respondWithResult(_0x2588b8,0xc9))[_0x5bff('0x47')](handleError(_0x2588b8,null));};exports['update']=function(_0x47fc14,_0x4ff13a){if(_0x47fc14[_0x5bff('0x49')]['id']){delete _0x47fc14[_0x5bff('0x49')]['id'];}return db['WhatsappApplication'][_0x5bff('0x4a')]({'where':{'id':_0x47fc14[_0x5bff('0x46')]['id']}})[_0x5bff('0x24')](handleEntityNotFound(_0x4ff13a,null))[_0x5bff('0x24')](saveUpdates(_0x47fc14[_0x5bff('0x49')],null))['then'](respondWithResult(_0x4ff13a,null))[_0x5bff('0x47')](handleError(_0x4ff13a,null));};exports[_0x5bff('0x25')]=function(_0x5e99f5,_0x16c61e){return db['WhatsappApplication'][_0x5bff('0x4a')]({'where':{'id':_0x5e99f5[_0x5bff('0x46')]['id']}})[_0x5bff('0x24')](handleEntityNotFound(_0x16c61e,null))[_0x5bff('0x24')](removeEntity(_0x16c61e,null))[_0x5bff('0x47')](handleError(_0x16c61e,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index 1f7f7e6..dd087e0 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 _0xeec6=['utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappApplication.attributes','WhatsappApplication','whatsapp_applications'];(function(_0x17df1b,_0x4cf1d7){var _0x297263=function(_0x46c3a5){while(--_0x46c3a5){_0x17df1b['push'](_0x17df1b['shift']());}};_0x297263(++_0x4cf1d7);}(_0xeec6,0x1c2));var _0x6eec=function(_0x599aaf,_0x3d3622){_0x599aaf=_0x599aaf-0x0;var _0xd995f3=_0xeec6[_0x599aaf];return _0xd995f3;};'use strict';var _=require(_0x6eec('0x0'));var util=require(_0x6eec('0x1'));var logger=require(_0x6eec('0x2'))(_0x6eec('0x3'));var moment=require('moment');var BPromise=require(_0x6eec('0x4'));var rp=require(_0x6eec('0x5'));var fs=require('fs');var path=require(_0x6eec('0x6'));var rimraf=require(_0x6eec('0x7'));var config=require(_0x6eec('0x8'));var attributes=require(_0x6eec('0x9'));module['exports']=function(_0x185f31,_0x3c6eda){return _0x185f31['define'](_0x6eec('0xa'),attributes,{'tableName':_0x6eec('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x6eec('0xc'),'collate':_0x6eec('0xd')});}; \ No newline at end of file +var _0x8a28=['utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./whatsappApplication.attributes','exports','WhatsappApplication','utf8mb4'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x8a28,0xfd));var _0x88a2=function(_0x18a79d,_0x57bd2c){_0x18a79d=_0x18a79d-0x0;var _0x4f8848=_0x8a28[_0x18a79d];return _0x4f8848;};'use strict';var _=require(_0x88a2('0x0'));var util=require(_0x88a2('0x1'));var logger=require(_0x88a2('0x2'))(_0x88a2('0x3'));var moment=require(_0x88a2('0x4'));var BPromise=require(_0x88a2('0x5'));var rp=require(_0x88a2('0x6'));var fs=require('fs');var path=require(_0x88a2('0x7'));var rimraf=require('rimraf');var config=require(_0x88a2('0x8'));var attributes=require(_0x88a2('0x9'));module[_0x88a2('0xa')]=function(_0x438e32,_0x29ce92){return _0x438e32['define'](_0x88a2('0xb'),attributes,{'tableName':'whatsapp_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x88a2('0xc'),'collate':_0x88a2('0xd')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index a5bf8af..bb5156b 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 _0x6f0d=['WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','then','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent'];(function(_0x63d097,_0x206ea2){var _0x511c6=function(_0x5a4ec1){while(--_0x5a4ec1){_0x63d097['push'](_0x63d097['shift']());}};_0x511c6(++_0x206ea2);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x9b5e52,_0x4dd23e){_0x9b5e52=_0x9b5e52-0x0;var _0x444f0c=_0x6f0d[_0x9b5e52];return _0x444f0c;};'use strict';var _=require('lodash');var util=require(_0xd6f0('0x0'));var moment=require(_0xd6f0('0x1'));var BPromise=require(_0xd6f0('0x2'));var rs=require(_0xd6f0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd6f0('0x4'))['db'];var utils=require(_0xd6f0('0x5'));var logger=require(_0xd6f0('0x6'))(_0xd6f0('0x7'));var config=require(_0xd6f0('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd6f0('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0xe21ac4,_0x1af29c,_0x8b89a9){return new BPromise(function(_0x1a48a0,_0x4c4916){return client['request'](_0xe21ac4,_0x8b89a9)[_0xd6f0('0xa')](function(_0x272c4e){logger[_0xd6f0('0xb')](_0xd6f0('0xc'),_0x1af29c,_0xd6f0('0xd'));logger['debug'](_0xd6f0('0xe'),_0x1af29c,_0xd6f0('0xd'),JSON[_0xd6f0('0xf')](_0x272c4e));if(_0x272c4e[_0xd6f0('0x10')]){if(_0x272c4e['error'][_0xd6f0('0x11')]===0x1f4){logger[_0xd6f0('0x10')](_0xd6f0('0xc'),_0x1af29c,_0x272c4e[_0xd6f0('0x10')][_0xd6f0('0x12')]);return _0x4c4916(_0x272c4e[_0xd6f0('0x10')][_0xd6f0('0x12')]);}logger[_0xd6f0('0x10')](_0xd6f0('0xc'),_0x1af29c,_0x272c4e['error'][_0xd6f0('0x12')]);return _0x1a48a0(_0x272c4e[_0xd6f0('0x10')]['message']);}else{logger[_0xd6f0('0xb')]('WhatsappApplication,\x20%s,\x20%s',_0x1af29c,_0xd6f0('0xd'));_0x1a48a0(_0x272c4e[_0xd6f0('0x13')][_0xd6f0('0x12')]);}})[_0xd6f0('0x14')](function(_0x64ff5f){logger[_0xd6f0('0x10')](_0xd6f0('0xc'),_0x1af29c,_0x64ff5f);_0x4c4916(_0x64ff5f);});});} \ No newline at end of file +var _0x9957=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x1f6c43,_0xeb5660){var _0x27e746=function(_0x2e2b45){while(--_0x2e2b45){_0x1f6c43['push'](_0x1f6c43['shift']());}};_0x27e746(++_0xeb5660);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('WhatsappApplication,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index ce00130..30b12db 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 _0xb138=['/:id/download','download','post','create','/:id/tags','whatsappinteraction:addtags','addTags','put','whatsapp','whatsappinteraction:update','update','delete','tracked','removeTags','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','isAuthenticated','index','/describe','describe','/:id','/:id/messages','getMessages','get'];(function(_0xafba9a,_0xec1c0f){var _0x190d87=function(_0x52bbc6){while(--_0x52bbc6){_0xafba9a['push'](_0xafba9a['shift']());}};_0x190d87(++_0xec1c0f);}(_0xb138,0x1dd));var _0x8b13=function(_0x4627d7,_0xff25f6){_0x4627d7=_0x4627d7-0x0;var _0x29486a=_0xb138[_0x4627d7];return _0x29486a;};'use strict';var multer=require(_0x8b13('0x0'));var util=require(_0x8b13('0x1'));var path=require(_0x8b13('0x2'));var timeout=require(_0x8b13('0x3'));var express=require(_0x8b13('0x4'));var router=express[_0x8b13('0x5')]();var fs_extra=require(_0x8b13('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x8b13('0x7'));var config=require(_0x8b13('0x8'));var controller=require(_0x8b13('0x9'));router['get']('/',auth[_0x8b13('0xa')](),controller[_0x8b13('0xb')]);router['get'](_0x8b13('0xc'),auth[_0x8b13('0xa')](),controller[_0x8b13('0xd')]);router['get'](_0x8b13('0xe'),auth[_0x8b13('0xa')](),controller['show']);router['get'](_0x8b13('0xf'),auth[_0x8b13('0xa')](),controller[_0x8b13('0x10')]);router[_0x8b13('0x11')](_0x8b13('0x12'),auth['isAuthenticated'](),controller[_0x8b13('0x13')]);router[_0x8b13('0x14')]('/',auth[_0x8b13('0xa')](),controller[_0x8b13('0x15')]);router[_0x8b13('0x14')](_0x8b13('0xf'),auth['isAuthenticated'](),controller['addMessage']);router[_0x8b13('0x14')](_0x8b13('0x16'),auth['isAuthenticated'](),interaction['tracked']('whatsapp',_0x8b13('0x17')),controller[_0x8b13('0x18')]);router[_0x8b13('0x19')](_0x8b13('0xe'),auth[_0x8b13('0xa')](),interaction['tracked'](_0x8b13('0x1a'),_0x8b13('0x1b')),controller[_0x8b13('0x1c')]);router[_0x8b13('0x1d')](_0x8b13('0xe'),auth[_0x8b13('0xa')](),interaction[_0x8b13('0x1e')](_0x8b13('0x1a'),'whatsappinteraction:destroy'),controller['destroy']);router[_0x8b13('0x1d')](_0x8b13('0x16'),auth[_0x8b13('0xa')](),controller[_0x8b13('0x1f')]);module[_0x8b13('0x20')]=router; \ No newline at end of file +var _0xbff5=['addTags','put','tracked','whatsapp','update','delete','whatsappinteraction:destroy','destroy','removeTags','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','post','addMessage','/:id/tags','whatsappinteraction:addtags'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xbff5,0x1bc));var _0x5bff=function(_0x53a1d7,_0x561f2b){_0x53a1d7=_0x53a1d7-0x0;var _0x282f2b=_0xbff5[_0x53a1d7];return _0x282f2b;};'use strict';var multer=require(_0x5bff('0x0'));var util=require(_0x5bff('0x1'));var path=require(_0x5bff('0x2'));var timeout=require(_0x5bff('0x3'));var express=require(_0x5bff('0x4'));var router=express[_0x5bff('0x5')]();var fs_extra=require(_0x5bff('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x5bff('0x7'));var config=require('../../config/environment');var controller=require('./whatsappInteraction.controller');router[_0x5bff('0x8')]('/',auth[_0x5bff('0x9')](),controller[_0x5bff('0xa')]);router[_0x5bff('0x8')](_0x5bff('0xb'),auth[_0x5bff('0x9')](),controller[_0x5bff('0xc')]);router[_0x5bff('0x8')](_0x5bff('0xd'),auth['isAuthenticated'](),controller[_0x5bff('0xe')]);router['get'](_0x5bff('0xf'),auth[_0x5bff('0x9')](),controller['getMessages']);router[_0x5bff('0x8')]('/:id/download',auth[_0x5bff('0x9')](),controller['download']);router[_0x5bff('0x10')]('/',auth[_0x5bff('0x9')](),controller['create']);router[_0x5bff('0x10')]('/:id/messages',auth[_0x5bff('0x9')](),controller[_0x5bff('0x11')]);router['post'](_0x5bff('0x12'),auth[_0x5bff('0x9')](),interaction['tracked']('whatsapp',_0x5bff('0x13')),controller[_0x5bff('0x14')]);router[_0x5bff('0x15')]('/:id',auth[_0x5bff('0x9')](),interaction[_0x5bff('0x16')](_0x5bff('0x17'),'whatsappinteraction:update'),controller[_0x5bff('0x18')]);router[_0x5bff('0x19')](_0x5bff('0xd'),auth['isAuthenticated'](),interaction[_0x5bff('0x16')](_0x5bff('0x17'),_0x5bff('0x1a')),controller[_0x5bff('0x1b')]);router['delete'](_0x5bff('0x12'),auth['isAuthenticated'](),controller[_0x5bff('0x1c')]);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 7373459..efb23cb 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 _0x7217=['out','sequelize','exports','BOOLEAN','DATE','STRING','ENUM'];(function(_0x173441,_0x26b0d9){var _0x2423a8=function(_0x4d96c2){while(--_0x4d96c2){_0x173441['push'](_0x173441['shift']());}};_0x2423a8(++_0x26b0d9);}(_0x7217,0x19e));var _0x7721=function(_0x1b828b,_0x344400){_0x1b828b=_0x1b828b-0x0;var _0x98da1a=_0x7217[_0x1b828b];return _0x98da1a;};'use strict';var Sequelize=require(_0x7721('0x0'));var moment=require('moment');module[_0x7721('0x1')]={'closed':{'type':Sequelize[_0x7721('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x7721('0x3')]},'disposition':{'type':Sequelize[_0x7721('0x4')]},'secondDisposition':{'type':Sequelize[_0x7721('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x7721('0x4')]},'read1stAt':{'type':Sequelize[_0x7721('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x7721('0x5')]('in',_0x7721('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x7721('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x7721('0x5')]('in',_0x7721('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x7721('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x49e5=['out','sequelize','moment','exports','BOOLEAN','DATE','STRING'];(function(_0x569caa,_0x5174ce){var _0x44cb5a=function(_0x456df4){while(--_0x456df4){_0x569caa['push'](_0x569caa['shift']());}};_0x44cb5a(++_0x5174ce);}(_0x49e5,0x71));var _0x549e=function(_0x4b4236,_0x314c37){_0x4b4236=_0x4b4236-0x0;var _0x5171a2=_0x49e5[_0x4b4236];return _0x5171a2;};'use strict';var Sequelize=require(_0x549e('0x0'));var moment=require(_0x549e('0x1'));module[_0x549e('0x2')]={'closed':{'type':Sequelize[_0x549e('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x549e('0x4')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x549e('0x5')]},'thirdDisposition':{'type':Sequelize[_0x549e('0x5')]},'note':{'type':Sequelize[_0x549e('0x5')]},'phone':{'type':Sequelize[_0x549e('0x5')]},'read1stAt':{'type':Sequelize[_0x549e('0x4')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x549e('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x549e('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x549e('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index 779208e..307350a 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 _0x155d=['Contact','operator','$substring','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','start','Tag','map','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','buildExpression','text','body','some','compact','WhatsappAccountId','concat','createdAt','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','contactName','DESC','isEmpty','t.id\x20IN\x20?','resolve','user','role','agent','getWhatsappAccounts','i.WhatsappAccountId\x20IS\x20NULL','toString','keyBy','merge','Account.key','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','Contact.email','Contact.phone','c.mobile','Contact.mobile','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.WhatsappInteractionId\x20IN\x20?','sequelize','WhatsappInteractionId','all','rows','params','includeAll','include','create','update','destroy','describe','addMessage','WhatsappMessage','omit','ids','getMessages','format','findAll','addTags','spread','color','emit','whatsappInteractionTags:save','removeTags','download','unix','root','files','attachments','join','transcript-%d-%s.zip','User','CmContact','firstName','Attachment','Messages','secret','WhatsappAccount','Owner','get','mkdirSync','Whatsapp','Account','N.A.','YYYY-MM-DD\x20HH:mm:ss','closed','disposition','basename','existsSync','createReadStream','pipe','createWriteStream','direction','out','System','lastName','renderFile','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','log','err','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','save','then','error','stack','name','send','Users','fullname','TagIds','split','push','catch','index','WhatsappInteraction','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','select','field','from','tools_tags','u.id','u.fullname','user_has_whatsapp_interactions','left_join','users','u.id\x20=\x20ui.UserId','whatsapp_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','whatsapp_accounts','a.id\x20=\x20i.WhatsappAccountId','whatsapp_messages','me.WhatsappInteractionId\x20=\x20i.id','it.WhatsappInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','conditions','length','find','value','having','`\x20=\x200','`\x20>\x200'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x155d,0x89));var _0xd155=function(_0xc0a3d3,_0x2c8d00){_0xc0a3d3=_0xc0a3d3-0x0;var _0x3386e8=_0x155d[_0xc0a3d3];return _0x3386e8;};'use strict';var emlformat=require(_0xd155('0x0'));var rimraf=require(_0xd155('0x1'));var zipdir=require(_0xd155('0x2'));var jsonpatch=require(_0xd155('0x3'));var rp=require('request-promise');var moment=require(_0xd155('0x4'));var BPromise=require(_0xd155('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xd155('0x6'));var ejs=require(_0xd155('0x7'));var fs=require('fs');var fs_extra=require(_0xd155('0x8'));var _=require(_0xd155('0x9'));var squel=require(_0xd155('0xa'));var crypto=require(_0xd155('0xb'));var jsforce=require(_0xd155('0xc'));var deskjs=require(_0xd155('0xd'));var toCsv=require(_0xd155('0x6'));var querystring=require(_0xd155('0xe'));var Papa=require('papaparse');var Redis=require(_0xd155('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xd155('0x10'));var as=require(_0xd155('0x11'));var pdf=require(_0xd155('0x12'));var hardwareService=require(_0xd155('0x13'));var logger=require(_0xd155('0x14'))(_0xd155('0x15'));var utils=require(_0xd155('0x16'));var config=require(_0xd155('0x17'));var licenseUtil=require(_0xd155('0x18'));var db=require(_0xd155('0x19'))['db'];config[_0xd155('0x1a')]=_[_0xd155('0x1b')](config['redis'],{'host':_0xd155('0x1c'),'port':0x18eb});var socket=require(_0xd155('0x1d'))(new Redis(config['redis']));require('./whatsappInteraction.socket')[_0xd155('0x1e')](socket);function respondWithStatusCode(_0x5094c8,_0x5b4a12){_0x5b4a12=_0x5b4a12||0xcc;return function(_0xb37166){if(_0xb37166){return _0x5094c8[_0xd155('0x1f')](_0x5b4a12);}return _0x5094c8[_0xd155('0x20')](_0x5b4a12)[_0xd155('0x21')]();};}function respondWithResult(_0x44bcec,_0x327c44){_0x327c44=_0x327c44||0xc8;return function(_0x111445){if(_0x111445){return _0x44bcec[_0xd155('0x20')](_0x327c44)[_0xd155('0x22')](_0x111445);}};}function respondWithFilteredResult(_0x4a4658,_0x40d271){return function(_0x5af76e){if(_0x5af76e){var _0x52457c=typeof _0x40d271[_0xd155('0x23')]===_0xd155('0x24')&&typeof _0x40d271[_0xd155('0x25')]==='undefined';var _0x181969=_0x5af76e[_0xd155('0x26')];var _0xd5d623=_0x52457c?0x0:_0x40d271[_0xd155('0x23')];var _0x2169ca=_0x52457c?_0x5af76e[_0xd155('0x26')]:_0x40d271[_0xd155('0x23')]+_0x40d271[_0xd155('0x25')];var _0x5e67c9;if(_0x2169ca>=_0x181969){_0x2169ca=_0x181969;_0x5e67c9=0xc8;}else{_0x5e67c9=0xce;}_0x4a4658[_0xd155('0x20')](_0x5e67c9);return _0x4a4658[_0xd155('0x27')](_0xd155('0x28'),_0xd5d623+'-'+_0x2169ca+'/'+_0x181969)[_0xd155('0x22')](_0x5af76e);}return null;};}function patchUpdates(_0x15751a){return function(_0x45f4d3){try{jsonpatch['apply'](_0x45f4d3,_0x15751a,!![]);}catch(_0x2bda29){return BPromise['reject'](_0x2bda29);}return _0x45f4d3[_0xd155('0x29')]();};}function saveUpdates(_0x1eebef,_0x2ea5f4){return function(_0x1a38a7){if(_0x1a38a7){return _0x1a38a7['update'](_0x1eebef)['then'](function(_0xa1a362){return _0xa1a362;});}return null;};}function removeEntity(_0xd32d53,_0x462f90){return function(_0x3fa6f3){if(_0x3fa6f3){return _0x3fa6f3['destroy']()[_0xd155('0x2a')](function(){_0xd32d53[_0xd155('0x20')](0xcc)[_0xd155('0x21')]();});}};}function handleEntityNotFound(_0x1f243c,_0x431179){return function(_0x2d71b2){if(!_0x2d71b2){_0x1f243c['sendStatus'](0x194);}return _0x2d71b2;};}function handleError(_0x570340,_0x1ec49f){_0x1ec49f=_0x1ec49f||0x1f4;return function(_0x3453e8){logger[_0xd155('0x2b')](_0x3453e8[_0xd155('0x2c')]);if(_0x3453e8['name']){delete _0x3453e8[_0xd155('0x2d')];}_0x570340['status'](_0x1ec49f)[_0xd155('0x2e')](_0x3453e8);};}function getInteractionUsers(_0x50dbfc,_0x462d63){return new BPromise(function(_0x16bec7,_0x5bf18e){try{if(_0x462d63[_0x50dbfc['id']]){_0x50dbfc[_0xd155('0x2f')]=_['map'](_0x462d63[_0x50dbfc['id']],function(_0x44cc00){return{'id':_0x44cc00['id'],'fullname':_0x44cc00[_0xd155('0x30')]};});}}catch(_0x20010a){_0x5bf18e(_0x20010a);}_0x16bec7(_0x50dbfc);});}function getInteractionTags(_0x2b9cdc,_0x5f5104){return new BPromise(function(_0x1622e0,_0x508c3b){try{if(_0x2b9cdc[_0xd155('0x31')]){_0x2b9cdc['Tags']=[];_0x2b9cdc['TagIds'][_0xd155('0x32')](',')['forEach'](function(_0x388479){_0x2b9cdc['Tags'][_0xd155('0x33')](_0x5f5104[_0x388479]);});}delete _0x2b9cdc[_0xd155('0x31')];}catch(_0x2ff78c){_0x508c3b(_0x2ff78c);}_0x1622e0(_0x2b9cdc);});}function updateWhatsappInteraction(_0x27a090,_0x4c4927,_0x324c02){return new BPromise(function(_0x24f45e,_0x442e5c){return getInteractionUsers(_0x27a090,_0x324c02)[_0xd155('0x2a')](function(_0xf7c81b){return getInteractionTags(_0xf7c81b,_0x4c4927);})[_0xd155('0x2a')](function(_0x239b05){_0x24f45e(_0x239b05);})[_0xd155('0x34')](function(_0x9a09ea){_0x442e5c(_0x9a09ea);});});}exports[_0xd155('0x35')]=function(_0x158fbb,_0x1ba4cd){var _0x575020={},_0x8b3d8a={},_0xcb6bfc={'count':0x0,'rows':[]};var _0x2e3684=_['map'](db[_0xd155('0x36')][_0xd155('0x37')],function(_0x13c112){return{'name':_0x13c112['fieldName'],'type':_0x13c112[_0xd155('0x38')][_0xd155('0x39')]};});_0x8b3d8a[_0xd155('0x3a')]=_['map'](_0x2e3684,_0xd155('0x2d'));_0x8b3d8a[_0xd155('0x3b')]=_[_0xd155('0x3c')](_0x158fbb[_0xd155('0x3b')]);_0x8b3d8a[_0xd155('0x3d')]=_[_0xd155('0x3e')](_0x8b3d8a[_0xd155('0x3a')],_0x8b3d8a['query']);_0x575020[_0xd155('0x3f')]=_[_0xd155('0x3e')](_0x8b3d8a[_0xd155('0x3a')],qs[_0xd155('0x40')](_0x158fbb['query'][_0xd155('0x40')]));_0x575020[_0xd155('0x3f')]=_0x575020[_0xd155('0x3f')]['length']?_0x575020['attributes']:_0x8b3d8a[_0xd155('0x3a')];if(!_0x158fbb['query'][_0xd155('0x41')](_0xd155('0x42'))){_0x575020[_0xd155('0x25')]=qs[_0xd155('0x25')](_0x158fbb[_0xd155('0x3b')][_0xd155('0x25')]);_0x575020[_0xd155('0x23')]=qs[_0xd155('0x23')](_0x158fbb[_0xd155('0x3b')][_0xd155('0x23')]);}_0x575020[_0xd155('0x43')]=qs['sort'](_0x158fbb[_0xd155('0x3b')][_0xd155('0x44')]);_0x575020[_0xd155('0x45')]=qs[_0xd155('0x3d')](_[_0xd155('0x46')](_0x158fbb[_0xd155('0x3b')],_0x8b3d8a[_0xd155('0x3d')]),_0x2e3684);var _0x195b92=[];var _0x4076d8=squel[_0xd155('0x47')]()[_0xd155('0x48')]('id')['field']('name')['field']('color')[_0xd155('0x49')](_0xd155('0x4a'));var _0x5d3436=squel[_0xd155('0x47')]()[_0xd155('0x48')](_0xd155('0x4b'))['field'](_0xd155('0x4c'))[_0xd155('0x48')]('ui.WhatsappInteractionId')[_0xd155('0x49')](_0xd155('0x4d'),'ui')[_0xd155('0x4e')](_0xd155('0x4f'),'u',_0xd155('0x50'));var _0x2fd390=squel[_0xd155('0x47')]()[_0xd155('0x49')](_0xd155('0x51'),'i')['left_join'](_0xd155('0x52'),'c',_0xd155('0x53'))[_0xd155('0x4e')](_0xd155('0x4f'),'o',_0xd155('0x54'))['left_join'](_0xd155('0x55'),'a',_0xd155('0x56'))[_0xd155('0x4e')](_0xd155('0x57'),'me',_0xd155('0x58'))[_0xd155('0x4e')]('whatsapp_interaction_has_tags','it',_0xd155('0x59'))['left_join'](_0xd155('0x4a'),'t',_0xd155('0x5a'));var _0x1327a7=squel[_0xd155('0x5b')]();var _0x27c06d=[];var _0xbd7bdc=squel['expr']();var _0x565800;if(_0x158fbb[_0xd155('0x3b')][_0xd155('0x5c')]){_0x565800=as['parseSearch'](_0x158fbb[_0xd155('0x3b')]['search']);var _0x4ab1ce=_0x565800['sqlOperator'];for(var _0xecc122=0x0;_0xecc122<_0x565800[_0xd155('0x5d')][_0xd155('0x5e')];_0xecc122++){var _0x2b6616=_0x565800[_0xd155('0x5d')][_0xecc122];var _0x158f9b='i';var _0x97ff8a=_[_0xd155('0x5f')](_0x2e3684,[_0xd155('0x2d'),_0x2b6616['field']]);if(!_0x97ff8a){switch(_0x2b6616[_0xd155('0x48')]){case'unreadMessages':if(_0x2b6616[_0xd155('0x60')]==0x1){_0x2fd390[_0xd155('0x61')]('`'+_0x2b6616[_0xd155('0x48')]+_0xd155('0x62'));}else{_0x2fd390[_0xd155('0x61')]('`'+_0x2b6616['field']+_0xd155('0x63'));}break;case _0xd155('0x64'):if(_0x2b6616[_0xd155('0x65')]===_0xd155('0x66')){if(_0x2b6616[_0xd155('0x60')][_0xd155('0x32')]('\x20')[_0xd155('0x5e')]>0x1){_0x1327a7[_0x4ab1ce]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xd155('0x67')](_0x2b6616[_0xd155('0x60')]),null);}else{var _0xf160c0='%'+_0x2b6616[_0xd155('0x60')]+'%';_0x1327a7[_0x4ab1ce](_0xd155('0x68'),_0xf160c0,_0xf160c0,_0xf160c0);}}else{_0x97ff8a=_[_0xd155('0x5f')](_0x2e3684,[_0xd155('0x2d'),'ContactId']);_0x2b6616[_0xd155('0x48')]=_0xd155('0x69');_0x2db449=as['buildExpression'](_0x158f9b,_0x97ff8a[_0xd155('0x38')],_0x2b6616);_0x1327a7[_0x4ab1ce](_0x2db449['text'],_0x2db449['value'][_0xd155('0x6a')],_0x2db449[_0xd155('0x60')][_0xd155('0x21')]);}break;case _0xd155('0x6b'):var _0x38747f=_0x2b6616[_0xd155('0x60')][_0xd155('0x32')](',')[_0xd155('0x6c')](function(_0x231421){return Number(_0x231421);});_0x38747f[_0xd155('0x6d')](function(_0x259e9a){_0xbd7bdc['or'](_0xd155('0x6e'),'%,'+_0x259e9a+',%');});_0x27c06d=_['union'](_0x27c06d,_0x38747f);break;case'User':if(_0x2b6616[_0xd155('0x65')]===_0xd155('0x66')){_0x1327a7[_0x4ab1ce](_0xd155('0x6f'),'%'+_0x2b6616[_0xd155('0x60')]+'%',null);}else{_0x97ff8a=_[_0xd155('0x5f')](_0x2e3684,[_0xd155('0x2d'),_0xd155('0x70')]);_0x2b6616[_0xd155('0x48')]='UserId';_0x2db449=as[_0xd155('0x71')](_0x158f9b,_0x97ff8a[_0xd155('0x38')],_0x2b6616);_0x1327a7[_0x4ab1ce](_0x2db449[_0xd155('0x72')],_0x2db449[_0xd155('0x60')][_0xd155('0x6a')],_0x2db449['value']['end']);}break;case _0xd155('0x73'):_0x2db449=as['buildExpression']('me',null,_0x2b6616);_0x1327a7[_0x4ab1ce](_0x2db449['text'],_0x2db449[_0xd155('0x60')]['start'],_0x2db449['value'][_0xd155('0x21')]);break;}}else{var _0x2db449=as[_0xd155('0x71')](_0x158f9b,_0x97ff8a[_0xd155('0x38')],_0x2b6616);_0x1327a7[_0x4ab1ce](_0x2db449[_0xd155('0x72')],_0x2db449['value'][_0xd155('0x6a')],_0x2db449[_0xd155('0x60')][_0xd155('0x21')]);}}}else{var _0x4e7b88=_(_0x158fbb[_0xd155('0x3b')])['keys']()[_0xd155('0x6c')](function(_0xce1397){return _[_0xd155('0x74')](_0x2e3684,[_0xd155('0x2d'),_0xce1397])?_0xce1397:undefined;})[_0xd155('0x75')]()['value']();if(!_['isEmpty'](_0x4e7b88)){_0x4e7b88[_0xd155('0x6d')](function(_0x4d7699){if(_0x4d7699===_0xd155('0x76')){_0x2fd390[_0xd155('0x45')]('i.WhatsappAccountId\x20IN\x20?',[][_0xd155('0x77')](_0x158fbb['query'][_0x4d7699]));}else if(_0x4d7699===_0xd155('0x78')){var _0x51b7fb=JSON[_0xd155('0x79')](_0x158fbb['query'][_0x4d7699])[_0xd155('0x7a')];var _0x5b7f05=JSON[_0xd155('0x79')](_0x158fbb[_0xd155('0x3b')][_0x4d7699])['$lte'];_0x2fd390[_0xd155('0x45')](_0xd155('0x7b'),_0x51b7fb,_0x5b7f05);}else{if(_0x158fbb[_0xd155('0x3b')][_0x4d7699]===_0xd155('0x7c')){_0x2fd390[_0xd155('0x45')]('i.'+_0x4d7699+_0xd155('0x7d'));}else{_0x2fd390[_0xd155('0x45')]('i.'+_0x4d7699+_0xd155('0x7e'),_0x158fbb[_0xd155('0x3b')][_0x4d7699]);}}});}if(_0x158fbb[_0xd155('0x3b')][_0xd155('0x7f')]){if(_0x158fbb[_0xd155('0x3b')][_0xd155('0x7f')]==0x1){_0x2fd390[_0xd155('0x61')](_0xd155('0x80'));}else{_0x2fd390[_0xd155('0x61')](_0xd155('0x81'));}}if(_0x158fbb[_0xd155('0x3b')][_0xd155('0x82')]){_0x27c06d=_[_0xd155('0x83')](_0x158fbb[_0xd155('0x3b')]['tag'])?_0x158fbb[_0xd155('0x3b')]['tag']:new Array(_0x158fbb['query']['tag']);_0x27c06d['forEach'](function(_0x3e9c50){_0xbd7bdc['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x3e9c50+',%');});}if(_0x158fbb[_0xd155('0x3b')]['filter']){var _0x41debf=_0x158fbb[_0xd155('0x3b')][_0xd155('0x84')][_0xd155('0x85')]('\x5c','\x5c\x5c')[_0xd155('0x85')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x41debf)){_0x1327a7['or'](_0xd155('0x86'),_0x41debf+'%')['or'](_0xd155('0x87'),_0x41debf+'%');}else{_0x1327a7['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xd155('0x67')](_0x41debf))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x41debf+'%');}}}_0x2fd390['where'](_0x1327a7);_0x2fd390[_0xd155('0x88')](_0xd155('0x89'));var _0x2e7e43={'type':db[_0xd155('0x8a')][_0xd155('0x8b')]['SELECT'],'raw':!![]};var _0x235a2f=_0x2fd390[_0xd155('0x8c')]();_0x235a2f[_0xd155('0x48')](_0xd155('0x89'));_0x235a2f[_0xd155('0x48')](_0xd155('0x8d'),_0xd155('0x8e'));if(_0x575020[_0xd155('0x43')]){_0x575020[_0xd155('0x43')]['forEach'](function(_0x383b30){var _0x22fcb3=_0x383b30[0x0]===_0xd155('0x8f')?_0x383b30[0x0]:'i.'+_0x383b30[0x0];_0x2fd390[_0xd155('0x43')](_0x22fcb3,_0x383b30[0x1]===_0xd155('0x90')?![]:!![]);});}if(!_[_0xd155('0x91')](_0x27c06d)){_0x2fd390[_0xd155('0x61')](_0xbd7bdc);_0x235a2f[_0xd155('0x45')](_0xd155('0x92'),_0x27c06d);}BPromise[_0xd155('0x93')]()['then'](function(){if(!_0x565800){if(_0x158fbb['query']['WhatsappAccountId'])return;_0x235a2f[_0xd155('0x45')]('i.WhatsappAccountId\x20IS\x20NOT\x20NULL');_0x2fd390[_0xd155('0x45')]('i.WhatsappAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x158fbb[_0xd155('0x94')][_0xd155('0x95')]!==_0xd155('0x96'))return;return _0x158fbb[_0xd155('0x94')][_0xd155('0x97')]({'attributes':['id'],'raw':!![]})[_0xd155('0x2a')](function(_0x23684d){if(_[_0xd155('0x91')](_0x23684d)){_0x235a2f[_0xd155('0x45')](_0xd155('0x98'));_0x2fd390[_0xd155('0x45')]('i.WhatsappAccountId\x20IS\x20NULL');}else{_0x235a2f[_0xd155('0x45')]('i.WhatsappAccountId\x20IN\x20?',_[_0xd155('0x6c')](_0x23684d,'id'));_0x2fd390[_0xd155('0x45')]('i.WhatsappAccountId\x20IN\x20?',_[_0xd155('0x6c')](_0x23684d,'id'));}});})[_0xd155('0x2a')](function(){if(_0x158fbb[_0xd155('0x94')][_0xd155('0x95')]==='agent'&&!_0x565800&&!_0x158fbb[_0xd155('0x3b')]['WhatsappAccountId'])return[];return db['sequelize'][_0xd155('0x3b')](_0x235a2f[_0xd155('0x99')](),_0x2e7e43);})[_0xd155('0x2a')](function(_0xb5bbf0){_0xcb6bfc[_0xd155('0x26')]=_0xb5bbf0[_0xd155('0x5e')];if(_0xcb6bfc[_0xd155('0x26')]===0x0)return[];return db['sequelize'][_0xd155('0x3b')](_0x4076d8[_0xd155('0x99')](),_0x2e7e43)[_0xd155('0x2a')](function(_0x4e814d){_0x195b92=_[_0xd155('0x9a')](_0x4e814d,'id');_0x2e7e43=_[_0xd155('0x9b')](_0x2e7e43,{'model':db[_0xd155('0x36')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x158fbb['query'][_0xd155('0x40')]){_0x575020['attributes'][_0xd155('0x6d')](function(_0x3e34df){_0x2fd390[_0xd155('0x48')]('i.'+_0x3e34df);});}else{_0x2fd390[_0xd155('0x48')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xd155('0x8e'));_0x2fd390[_0xd155('0x48')]('a.key',_0xd155('0x9c'));_0x2fd390[_0xd155('0x48')]('a.mandatoryDisposition','Account.mandatoryDisposition');_0x2fd390[_0xd155('0x48')](_0xd155('0x9d'),'contactName');_0x2fd390[_0xd155('0x48')](_0xd155('0x9e'));_0x2fd390[_0xd155('0x48')](_0xd155('0x9f'),_0xd155('0xa0'));_0x2fd390['field'](_0xd155('0xa1'),_0xd155('0xa2'));_0x2fd390['field']('c.email',_0xd155('0xa3'));_0x2fd390[_0xd155('0x48')]('c.phone',_0xd155('0xa4'));_0x2fd390[_0xd155('0x48')](_0xd155('0xa5'),_0xd155('0xa6'));_0x2fd390[_0xd155('0x48')]('c.fax','Contact.fax');_0x2fd390['field'](_0xd155('0xa7'),_0xd155('0xa8'));_0x2fd390['field'](_0xd155('0xa9'),_0xd155('0xaa'));_0x2fd390[_0xd155('0x48')](_0xd155('0xab'),'TagIds');}if(_0x575020['limit'])_0x2fd390['limit'](_0x575020[_0xd155('0x25')]);if(_0x575020[_0xd155('0x23')])_0x2fd390[_0xd155('0x23')](_0x575020[_0xd155('0x23')]);return db['sequelize'][_0xd155('0x3b')](_0x2fd390[_0xd155('0x99')](),_0x2e7e43);})[_0xd155('0x2a')](function(_0x3405de){if(_0x3405de[_0xd155('0x5e')]>0x0)_0x5d3436[_0xd155('0x45')](_0xd155('0xac'),_[_0xd155('0x6c')](_0x3405de,'id'));return db[_0xd155('0xad')]['query'](_0x5d3436[_0xd155('0x99')](),_0x2e7e43)[_0xd155('0x2a')](function(_0x506a86){var _0x27a77f=_['groupBy'](_0x506a86,_0xd155('0xae'));var _0xc2dc6b=[];_0x3405de[_0xd155('0x6d')](function(_0x35c915){_0xc2dc6b[_0xd155('0x33')](updateWhatsappInteraction(_0x35c915,_0x195b92,_0x27a77f));});return BPromise[_0xd155('0xaf')](_0xc2dc6b);});});})[_0xd155('0x2a')](function(_0x435d13){_0xcb6bfc[_0xd155('0xb0')]=_0x435d13;return _0xcb6bfc;})['then'](respondWithFilteredResult(_0x1ba4cd,_0x575020))[_0xd155('0x34')](handleError(_0x1ba4cd,null));};exports['show']=function(_0xc1a825,_0x1ac093){var _0x3e614c={'raw':![],'where':{'id':_0xc1a825[_0xd155('0xb1')]['id']}},_0x36fcf2={};_0x36fcf2[_0xd155('0x3a')]=_['keys'](db['WhatsappInteraction'][_0xd155('0x37')]);_0x36fcf2[_0xd155('0x3b')]=_[_0xd155('0x3c')](_0xc1a825[_0xd155('0x3b')]);_0x36fcf2[_0xd155('0x3d')]=_[_0xd155('0x3e')](_0x36fcf2[_0xd155('0x3a')],_0x36fcf2[_0xd155('0x3b')]);_0x3e614c[_0xd155('0x3f')]=_['intersection'](_0x36fcf2[_0xd155('0x3a')],qs[_0xd155('0x40')](_0xc1a825[_0xd155('0x3b')]['fields']));_0x3e614c[_0xd155('0x3f')]=_0x3e614c[_0xd155('0x3f')][_0xd155('0x5e')]?_0x3e614c[_0xd155('0x3f')]:_0x36fcf2[_0xd155('0x3a')];if(_0xc1a825['query'][_0xd155('0xb2')]){_0x3e614c[_0xd155('0xb3')]=[{'all':!![]}];}_0x3e614c=_[_0xd155('0x9b')]({},_0x3e614c,_0xc1a825['options']);return db[_0xd155('0x36')][_0xd155('0x5f')](_0x3e614c)[_0xd155('0x2a')](handleEntityNotFound(_0x1ac093,null))[_0xd155('0x2a')](respondWithResult(_0x1ac093,null))['catch'](handleError(_0x1ac093,null));};exports[_0xd155('0xb4')]=function(_0x28be07,_0x279af3){return db[_0xd155('0x36')][_0xd155('0xb4')](_0x28be07['body'],{})[_0xd155('0x2a')](respondWithResult(_0x279af3,0xc9))[_0xd155('0x34')](handleError(_0x279af3,null));};exports[_0xd155('0xb5')]=function(_0x537267,_0x3b92b8){if(_0x537267['body']['id']){delete _0x537267[_0xd155('0x73')]['id'];}return db['WhatsappInteraction'][_0xd155('0x5f')]({'where':{'id':_0x537267[_0xd155('0xb1')]['id']}})[_0xd155('0x2a')](handleEntityNotFound(_0x3b92b8,null))[_0xd155('0x2a')](saveUpdates(_0x537267[_0xd155('0x73')],null))[_0xd155('0x2a')](respondWithResult(_0x3b92b8,null))[_0xd155('0x34')](handleError(_0x3b92b8,null));};exports[_0xd155('0xb6')]=function(_0x1ed0ff,_0x23f9ac){return db[_0xd155('0x36')][_0xd155('0x5f')]({'where':{'id':_0x1ed0ff[_0xd155('0xb1')]['id']}})[_0xd155('0x2a')](handleEntityNotFound(_0x23f9ac,null))[_0xd155('0x2a')](removeEntity(_0x23f9ac,null))[_0xd155('0x34')](handleError(_0x23f9ac,null));};exports['describe']=function(_0xbd7683,_0x3672c2){return db[_0xd155('0x36')][_0xd155('0xb7')]()[_0xd155('0x2a')](respondWithResult(_0x3672c2,null))[_0xd155('0x34')](handleError(_0x3672c2,null));};exports[_0xd155('0xb8')]=function(_0x5555f9,_0xce1432,_0x5d75ad){return db[_0xd155('0xb9')][_0xd155('0x5f')]({'where':{'id':_0x5555f9[_0xd155('0xb1')]['id']}})[_0xd155('0x2a')](handleEntityNotFound(_0xce1432,null))[_0xd155('0x2a')](function(_0x284411){if(_0x284411){return _0x284411[_0xd155('0xb8')](_0x5555f9['body']['ids'],_[_0xd155('0xba')](_0x5555f9[_0xd155('0x73')],[_0xd155('0xbb'),'id'])||{});}})[_0xd155('0x2a')](respondWithResult(_0xce1432,null))[_0xd155('0x34')](handleError(_0xce1432,null));};exports[_0xd155('0xbc')]=function(_0x3cc1ca,_0x517ec4,_0x48e149){var _0x26c156={'raw':![],'where':{}};var _0x23ece3={};var _0x8657cc={'count':0x0,'rows':[]};return db[_0xd155('0x36')]['findOne']({'where':{'id':_0x3cc1ca['params']['id']}})['then'](handleEntityNotFound(_0x517ec4,null))[_0xd155('0x2a')](function(_0x3af97f){if(_0x3af97f){_0x23ece3['model']=_['keys'](db['WhatsappMessage'][_0xd155('0x37')]);_0x23ece3[_0xd155('0x3b')]=_[_0xd155('0x3c')](_0x3cc1ca['query']);_0x23ece3[_0xd155('0x3d')]=_[_0xd155('0x3e')](_0x23ece3[_0xd155('0x3a')],_0x23ece3[_0xd155('0x3b')]);_0x26c156[_0xd155('0x3f')]=_['intersection'](_0x23ece3['model'],qs[_0xd155('0x40')](_0x3cc1ca[_0xd155('0x3b')][_0xd155('0x40')]));_0x26c156[_0xd155('0x3f')]=_0x26c156['attributes'][_0xd155('0x5e')]?_0x26c156[_0xd155('0x3f')]:_0x23ece3['model'];if(!_0x3cc1ca[_0xd155('0x3b')]['hasOwnProperty'](_0xd155('0x42'))){_0x26c156[_0xd155('0x25')]=qs['limit'](_0x3cc1ca[_0xd155('0x3b')][_0xd155('0x25')]);_0x26c156[_0xd155('0x23')]=qs[_0xd155('0x23')](_0x3cc1ca['query']['offset']);}_0x26c156[_0xd155('0x43')]=qs[_0xd155('0x44')](_0x3cc1ca[_0xd155('0x3b')][_0xd155('0x44')]);_0x26c156[_0xd155('0x45')]=qs[_0xd155('0x3d')](_['pick'](_0x3cc1ca['query'],_0x23ece3[_0xd155('0x3d')]));_0x26c156[_0xd155('0x45')]['WhatsappInteractionId']=_0x3af97f['id'];if(_0x3cc1ca['query'][_0xd155('0x84')]){_0x26c156['where']=_[_0xd155('0x9b')](_0x26c156[_0xd155('0x45')],{'$or':_[_0xd155('0x6c')](_0x26c156['attributes'],function(_0x59d8c0){var _0x39ed39={};_0x39ed39[_0x59d8c0]={'$like':'%'+_0x3cc1ca['query'][_0xd155('0x84')]+'%'};return _0x39ed39;})});}if(_0x3cc1ca[_0xd155('0x3b')]['$gte']){var _0x5026eb=_0x3cc1ca[_0xd155('0x3b')][_0xd155('0x7a')][_0xd155('0x32')](',');var _0x5d8d4f={};_0x5d8d4f[_0x5026eb[0x0]]={'$gte':moment(_0x5026eb[0x1])[_0xd155('0xbd')]('YYYY-MM-DD\x20HH:mm:ss')};_0x26c156[_0xd155('0x45')]=_[_0xd155('0x9b')](_0x26c156['where'],_0x5d8d4f);}_0x26c156=_[_0xd155('0x9b')]({},_0x26c156,_0x3cc1ca['options']);return db[_0xd155('0xb9')][_0xd155('0x26')]({'where':_0x26c156[_0xd155('0x45')]})[_0xd155('0x2a')](function(_0x1708ea){_0x8657cc[_0xd155('0x26')]=_0x1708ea;if(_0x3cc1ca[_0xd155('0x3b')][_0xd155('0xb2')]){_0x26c156[_0xd155('0xb3')]=[{'all':!![]}];}return db[_0xd155('0xb9')][_0xd155('0xbe')](_0x26c156);})[_0xd155('0x2a')](function(_0x1146be){_0x8657cc[_0xd155('0xb0')]=_0x1146be;return _0x8657cc;});}})[_0xd155('0x2a')](respondWithFilteredResult(_0x517ec4,_0x26c156))['catch'](handleError(_0x517ec4,null));};exports[_0xd155('0xbf')]=function(_0x2c53b0,_0x48d4ee,_0x465b69){return db['WhatsappInteraction']['find']({'where':{'id':_0x2c53b0[_0xd155('0xb1')]['id']}})[_0xd155('0x2a')](handleEntityNotFound(_0x48d4ee,null))['then'](function(_0x37483f){if(_0x37483f){return _0x37483f['setTags'](_0x2c53b0[_0xd155('0x73')]['ids'],_[_0xd155('0xba')](_0x2c53b0[_0xd155('0x73')],[_0xd155('0xbb'),'id'])||{})[_0xd155('0xc0')](function(){return db[_0xd155('0x6b')][_0xd155('0xbe')]({'attributes':['id','name',_0xd155('0xc1')],'where':{'id':_0x2c53b0[_0xd155('0x73')][_0xd155('0xbb')]}});})['then'](function(_0x1a1c0f){socket[_0xd155('0xc2')](_0xd155('0xc3'),{'id':Number(_0x2c53b0[_0xd155('0xb1')]['id']),'tags':_0x1a1c0f||[]});return{'id':Number(_0x2c53b0[_0xd155('0xb1')]['id']),'tags':_0x1a1c0f||[]};});}})[_0xd155('0x2a')](respondWithResult(_0x48d4ee,null))[_0xd155('0x34')](handleError(_0x48d4ee,null));};exports[_0xd155('0xc4')]=function(_0x2ae1b5,_0x5b72a7,_0x384a73){return db[_0xd155('0x36')][_0xd155('0x5f')]({'where':{'id':_0x2ae1b5[_0xd155('0xb1')]['id']}})[_0xd155('0x2a')](handleEntityNotFound(_0x5b72a7,null))[_0xd155('0x2a')](function(_0x29d927){if(_0x29d927){return _0x29d927['removeTags'](_0x2ae1b5[_0xd155('0x3b')][_0xd155('0xbb')]);}})['then'](respondWithStatusCode(_0x5b72a7,null))[_0xd155('0x34')](handleError(_0x5b72a7,null));};exports[_0xd155('0xc5')]=function(_0x3a8574,_0x4f1987){var _0x16f98b=moment()[_0xd155('0xc6')]()[_0xd155('0x99')]();var _0x27391e=path['join'](config[_0xd155('0xc7')],'server',_0xd155('0xc8'),'tmp');var _0x4f7b95=path['join'](config[_0xd155('0xc7')],'server',_0xd155('0xc8'),_0xd155('0xc9'));var _0x4ac3c4=path[_0xd155('0xca')](_0x27391e,_0x16f98b);var _0x480801=util[_0xd155('0xbd')](_0xd155('0xcb'),_0x3a8574['params']['id'],_0x16f98b);var _0xcaa820=path[_0xd155('0xca')](_0x27391e,_0x480801);var _0x26e193=[];_0x26e193[_0xd155('0x33')]({'model':db[_0xd155('0xcc')],'as':_0xd155('0xcc'),'attributes':['id',_0xd155('0x30')],'raw':!![]});_0x26e193[_0xd155('0x33')]({'model':db[_0xd155('0xcd')],'as':_0xd155('0x64'),'attributes':['id',_0xd155('0xce'),'lastName'],'raw':!![]});if(_0x3a8574[_0xd155('0x3b')]['attachments']){_0x26e193['push']({'model':db[_0xd155('0xcf')],'as':_0xd155('0xcf'),'raw':!![]});}var _0x4f5977=[{'model':db[_0xd155('0xb9')],'as':_0xd155('0xd0'),'attributes':['id','body',_0xd155('0x78'),'direction',_0xd155('0xd1'),_0xd155('0x7f')],'include':_0x26e193}];_0x4f5977[_0xd155('0x33')]({'model':db[_0xd155('0xd2')],'as':'Account','attributes':['id',_0xd155('0x2d')]});_0x4f5977['push']({'model':db[_0xd155('0xcc')],'as':_0xd155('0xd3'),'attributes':['id',_0xd155('0x30')]});return db[_0xd155('0x36')]['find']({'where':{'id':_0x3a8574[_0xd155('0xb1')]['id']},'include':_0x4f5977})[_0xd155('0x2a')](handleEntityNotFound(_0x4f1987,null))[_0xd155('0x2a')](function(_0x3952e8){if(_0x3952e8){var _0x269136=_0x3952e8[_0xd155('0xd4')]({'plain':!![]});fs[_0xd155('0xd5')](_0x4ac3c4);var _0x1aef48={'channel':_0xd155('0xd6'),'account':_0x269136[_0xd155('0xd7')][_0xd155('0x2d')],'agent':_0x269136['Owner']?_0x269136['Owner'][_0xd155('0x30')]:_0xd155('0xd8'),'createdAt':moment(_0x269136[_0xd155('0x78')])[_0xd155('0xbd')](_0xd155('0xd9'))[_0xd155('0x99')](),'closedAt':_0x269136[_0xd155('0xda')]?moment(_0x269136['closedAt'])['format'](_0xd155('0xd9'))[_0xd155('0x99')]():'','disposition':_0x269136[_0xd155('0xdb')],'messages':_(_0x269136[_0xd155('0xd0')])[_0xd155('0x84')]({'secret':![]})['map'](function(_0x244337){if(_0x244337['Attachment']){var _0x3658a6=path[_0xd155('0xca')](_0x4f7b95,_0x244337[_0xd155('0xcf')][_0xd155('0xdc')]);if(fs[_0xd155('0xdd')](_0x3658a6)){fs[_0xd155('0xde')](_0x3658a6)[_0xd155('0xdf')](fs[_0xd155('0xe0')](path[_0xd155('0xca')](_0x4ac3c4,_0x244337[_0xd155('0xcf')][_0xd155('0xdc')])));}}return{'date':moment(_0x244337[_0xd155('0x78')])[_0xd155('0xbd')]('YYYY-MM-DD\x20HH:mm:ss')[_0xd155('0x99')](),'sender':_0x244337[_0xd155('0xe1')]===_0xd155('0xe2')?_0x244337[_0xd155('0xcc')]?_0x244337[_0xd155('0xcc')][_0xd155('0x30')]:_0xd155('0xe3'):_0x244337[_0xd155('0x64')][_0xd155('0xce')]+(_0x244337[_0xd155('0x64')][_0xd155('0xe4')]?'\x20'+_0x244337['Contact'][_0xd155('0xe4')]:''),'body':_0x244337[_0xd155('0xcf')]?_0x244337[_0xd155('0xcf')][_0xd155('0xdc')]:_0x244337[_0xd155('0x73')],'direction':_0x244337[_0xd155('0xe1')]===_0xd155('0xe2')?'A':'C','secret':_0x244337[_0xd155('0xd1')],'read':_0x244337[_0xd155('0x7f')],'attachment':_0x244337['Attachment']};})[_0xd155('0x60')]()};return ejs[_0xd155('0xe5')](path[_0xd155('0xca')](config[_0xd155('0xc7')],'server','views',_0xd155('0xe6')),{'interaction':_0x1aef48})[_0xd155('0x2a')](function(_0x19d07f){var _0x1fa6e1=path[_0xd155('0xca')](_0x4ac3c4,_0xd155('0xe7')+_0x269136['id']+'-'+_0x16f98b+_0xd155('0xe8'));var _0x32601d={'path':_0x1fa6e1,'channel':'Whatsapp','interactionId':_0x269136['id']};return pdf[_0xd155('0xe9')](_0x19d07f,_0x32601d);})[_0xd155('0x2a')](function(){return new BPromise(function(_0x39eb60,_0x479de0){zipdir(_0x4ac3c4,{'saveTo':_0xcaa820},function(_0xa538c5,_0x40b1b7){if(_0xa538c5)return _0x479de0(_0xa538c5);return _0x39eb60(_0x40b1b7);});})['then'](function(){return new BPromise(function(_0x2300bf,_0x51956e){rimraf(_0x4ac3c4,function(_0x559163){if(_0x559163)_0x51956e(_0x559163);return _0x2300bf();});});})[_0xd155('0x2a')](function(){return _0x4f1987['download'](_0xcaa820,_0x480801,function(_0x2879bd){if(_0x2879bd){console[_0xd155('0xea')](_0xd155('0xeb'),_0x2879bd);}else{fs[_0xd155('0xec')](_0xcaa820);}});});});}else{return _0x4f1987[_0xd155('0x1f')](0xc8);}})[_0xd155('0x34')](handleError(_0x4f1987,null));}; \ No newline at end of file +var _0xa3d1=['params','keys','includeAll','include','options','find','create','body','describe','WhatsappMessage','addMessage','ids','omit','getMessages','$gte','YYYY-MM-DD\x20HH:mm:ss','addTags','setTags','spread','emit','whatsappInteractionTags:save','removeTags','download','unix','join','root','server','tmp','files','format','transcript-%d-%s.zip','CmContact','Attachment','Messages','direction','secret','Account','Owner','mkdirSync','closedAt','disposition','basename','existsSync','pipe','out','System','firstName','lastName','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','Whatsapp','createPdfFromHTML','log','err','unlinkSync','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','redis','socket.io-emitter','./whatsappInteraction.socket','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','save','update','then','name','Users','map','fullname','TagIds','Tags','split','forEach','push','catch','index','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','select','field','color','tools_tags','u.fullname','ui.WhatsappInteractionId','from','user_has_whatsapp_interactions','left_join','users','u.id\x20=\x20ui.UserId','whatsapp_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','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','conditions','value','having','`\x20=\x200','Contact','operator','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','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','buildExpression','some','compact','WhatsappAccountId','i.WhatsappAccountId\x20IN\x20?','concat','createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','group','i.id','Sequelize','SELECT','clone','contactName','DESC','isEmpty','t.id\x20IN\x20?','resolve','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','user','getWhatsappAccounts','i.WhatsappAccountId\x20IS\x20NULL','role','agent','sequelize','toString','keyBy','merge','WhatsappInteraction','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','Contact.firstName','c.lastName','Contact.lastName','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.WhatsappInteractionId\x20IN\x20?','groupBy','all','rows'];(function(_0x97a8b2,_0x5dcd8b){var _0xc5586=function(_0x387590){while(--_0x387590){_0x97a8b2['push'](_0x97a8b2['shift']());}};_0xc5586(++_0x5dcd8b);}(_0xa3d1,0x126));var _0x1a3d=function(_0x59d615,_0x5d4363){_0x59d615=_0x59d615-0x0;var _0x28bc2f=_0xa3d1[_0x59d615];return _0x28bc2f;};'use strict';var emlformat=require(_0x1a3d('0x0'));var rimraf=require(_0x1a3d('0x1'));var zipdir=require(_0x1a3d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1a3d('0x3'));var moment=require('moment');var BPromise=require(_0x1a3d('0x4'));var Mustache=require(_0x1a3d('0x5'));var util=require(_0x1a3d('0x6'));var path=require(_0x1a3d('0x7'));var sox=require(_0x1a3d('0x8'));var csv=require(_0x1a3d('0x9'));var ejs=require(_0x1a3d('0xa'));var fs=require('fs');var fs_extra=require(_0x1a3d('0xb'));var _=require('lodash');var squel=require(_0x1a3d('0xc'));var crypto=require('crypto');var jsforce=require(_0x1a3d('0xd'));var deskjs=require(_0x1a3d('0xe'));var toCsv=require(_0x1a3d('0x9'));var querystring=require('querystring');var Papa=require(_0x1a3d('0xf'));var Redis=require(_0x1a3d('0x10'));var authService=require(_0x1a3d('0x11'));var qs=require(_0x1a3d('0x12'));var as=require(_0x1a3d('0x13'));var pdf=require(_0x1a3d('0x14'));var hardwareService=require(_0x1a3d('0x15'));var logger=require(_0x1a3d('0x16'))('api');var utils=require(_0x1a3d('0x17'));var config=require(_0x1a3d('0x18'));var licenseUtil=require(_0x1a3d('0x19'));var db=require('../../mysqldb')['db'];config[_0x1a3d('0x1a')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x1a3d('0x1b'))(new Redis(config['redis']));require(_0x1a3d('0x1c'))['register'](socket);function respondWithStatusCode(_0x4f08ff,_0x1c9c25){_0x1c9c25=_0x1c9c25||0xcc;return function(_0x4ef337){if(_0x4ef337){return _0x4f08ff[_0x1a3d('0x1d')](_0x1c9c25);}return _0x4f08ff[_0x1a3d('0x1e')](_0x1c9c25)[_0x1a3d('0x1f')]();};}function respondWithResult(_0x4ddf56,_0x5bf0ca){_0x5bf0ca=_0x5bf0ca||0xc8;return function(_0xe1e7eb){if(_0xe1e7eb){return _0x4ddf56[_0x1a3d('0x1e')](_0x5bf0ca)['json'](_0xe1e7eb);}};}function respondWithFilteredResult(_0x3c2ead,_0x4a18e7){return function(_0xfc1d1c){if(_0xfc1d1c){var _0x58be3b=typeof _0x4a18e7[_0x1a3d('0x20')]===_0x1a3d('0x21')&&typeof _0x4a18e7[_0x1a3d('0x22')]===_0x1a3d('0x21');var _0x426eb3=_0xfc1d1c[_0x1a3d('0x23')];var _0x4dfcf5=_0x58be3b?0x0:_0x4a18e7[_0x1a3d('0x20')];var _0x54a108=_0x58be3b?_0xfc1d1c['count']:_0x4a18e7[_0x1a3d('0x20')]+_0x4a18e7['limit'];var _0x1902ea;if(_0x54a108>=_0x426eb3){_0x54a108=_0x426eb3;_0x1902ea=0xc8;}else{_0x1902ea=0xce;}_0x3c2ead['status'](_0x1902ea);return _0x3c2ead['set'](_0x1a3d('0x24'),_0x4dfcf5+'-'+_0x54a108+'/'+_0x426eb3)[_0x1a3d('0x25')](_0xfc1d1c);}return null;};}function patchUpdates(_0x1d911c){return function(_0x80b602){try{jsonpatch[_0x1a3d('0x26')](_0x80b602,_0x1d911c,!![]);}catch(_0xf95a7e){return BPromise[_0x1a3d('0x27')](_0xf95a7e);}return _0x80b602[_0x1a3d('0x28')]();};}function saveUpdates(_0x1b65c3,_0x510c41){return function(_0x50e0db){if(_0x50e0db){return _0x50e0db[_0x1a3d('0x29')](_0x1b65c3)[_0x1a3d('0x2a')](function(_0x20255b){return _0x20255b;});}return null;};}function removeEntity(_0x3d4ddb,_0x3cd51c){return function(_0x455e11){if(_0x455e11){return _0x455e11['destroy']()[_0x1a3d('0x2a')](function(){_0x3d4ddb[_0x1a3d('0x1e')](0xcc)[_0x1a3d('0x1f')]();});}};}function handleEntityNotFound(_0x146053,_0x47f37b){return function(_0x2e9589){if(!_0x2e9589){_0x146053[_0x1a3d('0x1d')](0x194);}return _0x2e9589;};}function handleError(_0x2ea9d0,_0x5c7306){_0x5c7306=_0x5c7306||0x1f4;return function(_0x394c22){logger['error'](_0x394c22['stack']);if(_0x394c22[_0x1a3d('0x2b')]){delete _0x394c22['name'];}_0x2ea9d0[_0x1a3d('0x1e')](_0x5c7306)['send'](_0x394c22);};}function getInteractionUsers(_0x34e71c,_0x2ca04d){return new BPromise(function(_0x3851df,_0x2a72d4){try{if(_0x2ca04d[_0x34e71c['id']]){_0x34e71c[_0x1a3d('0x2c')]=_[_0x1a3d('0x2d')](_0x2ca04d[_0x34e71c['id']],function(_0x2bc705){return{'id':_0x2bc705['id'],'fullname':_0x2bc705[_0x1a3d('0x2e')]};});}}catch(_0x5e924e){_0x2a72d4(_0x5e924e);}_0x3851df(_0x34e71c);});}function getInteractionTags(_0x2ab332,_0x22f113){return new BPromise(function(_0x442a98,_0x31d622){try{if(_0x2ab332[_0x1a3d('0x2f')]){_0x2ab332[_0x1a3d('0x30')]=[];_0x2ab332[_0x1a3d('0x2f')][_0x1a3d('0x31')](',')[_0x1a3d('0x32')](function(_0x2ee309){_0x2ab332[_0x1a3d('0x30')][_0x1a3d('0x33')](_0x22f113[_0x2ee309]);});}delete _0x2ab332[_0x1a3d('0x2f')];}catch(_0x228daa){_0x31d622(_0x228daa);}_0x442a98(_0x2ab332);});}function updateWhatsappInteraction(_0x441669,_0x2cb1cf,_0x3f1d44){return new BPromise(function(_0x1a381d,_0x2c0d23){return getInteractionUsers(_0x441669,_0x3f1d44)[_0x1a3d('0x2a')](function(_0x306cc8){return getInteractionTags(_0x306cc8,_0x2cb1cf);})[_0x1a3d('0x2a')](function(_0x22e4a7){_0x1a381d(_0x22e4a7);})[_0x1a3d('0x34')](function(_0x1bc737){_0x2c0d23(_0x1bc737);});});}exports[_0x1a3d('0x35')]=function(_0x385ebc,_0xdb441c){var _0xa29a9d={},_0x180424={},_0x40b9ab={'count':0x0,'rows':[]};var _0x43749a=_['map'](db['WhatsappInteraction'][_0x1a3d('0x36')],function(_0x186bba){return{'name':_0x186bba[_0x1a3d('0x37')],'type':_0x186bba[_0x1a3d('0x38')][_0x1a3d('0x39')]};});_0x180424['model']=_[_0x1a3d('0x2d')](_0x43749a,_0x1a3d('0x2b'));_0x180424[_0x1a3d('0x3a')]=_['keys'](_0x385ebc[_0x1a3d('0x3a')]);_0x180424[_0x1a3d('0x3b')]=_[_0x1a3d('0x3c')](_0x180424[_0x1a3d('0x3d')],_0x180424[_0x1a3d('0x3a')]);_0xa29a9d[_0x1a3d('0x3e')]=_['intersection'](_0x180424[_0x1a3d('0x3d')],qs[_0x1a3d('0x3f')](_0x385ebc[_0x1a3d('0x3a')][_0x1a3d('0x3f')]));_0xa29a9d[_0x1a3d('0x3e')]=_0xa29a9d[_0x1a3d('0x3e')][_0x1a3d('0x40')]?_0xa29a9d[_0x1a3d('0x3e')]:_0x180424[_0x1a3d('0x3d')];if(!_0x385ebc[_0x1a3d('0x3a')][_0x1a3d('0x41')](_0x1a3d('0x42'))){_0xa29a9d[_0x1a3d('0x22')]=qs[_0x1a3d('0x22')](_0x385ebc[_0x1a3d('0x3a')][_0x1a3d('0x22')]);_0xa29a9d[_0x1a3d('0x20')]=qs['offset'](_0x385ebc['query'][_0x1a3d('0x20')]);}_0xa29a9d[_0x1a3d('0x43')]=qs[_0x1a3d('0x44')](_0x385ebc[_0x1a3d('0x3a')][_0x1a3d('0x44')]);_0xa29a9d[_0x1a3d('0x45')]=qs[_0x1a3d('0x3b')](_[_0x1a3d('0x46')](_0x385ebc[_0x1a3d('0x3a')],_0x180424[_0x1a3d('0x3b')]),_0x43749a);var _0x361c71=[];var _0x2bc3b7=squel[_0x1a3d('0x47')]()['field']('id')[_0x1a3d('0x48')](_0x1a3d('0x2b'))[_0x1a3d('0x48')](_0x1a3d('0x49'))['from'](_0x1a3d('0x4a'));var _0x1ffda8=squel[_0x1a3d('0x47')]()['field']('u.id')['field'](_0x1a3d('0x4b'))[_0x1a3d('0x48')](_0x1a3d('0x4c'))[_0x1a3d('0x4d')](_0x1a3d('0x4e'),'ui')[_0x1a3d('0x4f')](_0x1a3d('0x50'),'u',_0x1a3d('0x51'));var _0x50b1cb=squel[_0x1a3d('0x47')]()[_0x1a3d('0x4d')](_0x1a3d('0x52'),'i')[_0x1a3d('0x4f')](_0x1a3d('0x53'),'c',_0x1a3d('0x54'))['left_join'](_0x1a3d('0x50'),'o',_0x1a3d('0x55'))[_0x1a3d('0x4f')]('whatsapp_accounts','a',_0x1a3d('0x56'))[_0x1a3d('0x4f')]('whatsapp_messages','me',_0x1a3d('0x57'))[_0x1a3d('0x4f')](_0x1a3d('0x58'),'it',_0x1a3d('0x59'))[_0x1a3d('0x4f')](_0x1a3d('0x4a'),'t',_0x1a3d('0x5a'));var _0x4d768c=squel[_0x1a3d('0x5b')]();var _0x4fbffc=[];var _0x2fe0e9=squel['expr']();var _0xe4c1ac;if(_0x385ebc[_0x1a3d('0x3a')]['search']){_0xe4c1ac=as['parseSearch'](_0x385ebc[_0x1a3d('0x3a')][_0x1a3d('0x5c')]);var _0x450a2a=_0xe4c1ac['sqlOperator'];for(var _0x36d663=0x0;_0x36d663<_0xe4c1ac['conditions']['length'];_0x36d663++){var _0x589804=_0xe4c1ac[_0x1a3d('0x5d')][_0x36d663];var _0x12ce9d='i';var _0x3d90e9=_['find'](_0x43749a,[_0x1a3d('0x2b'),_0x589804['field']]);if(!_0x3d90e9){switch(_0x589804[_0x1a3d('0x48')]){case'unreadMessages':if(_0x589804[_0x1a3d('0x5e')]==0x1){_0x50b1cb[_0x1a3d('0x5f')]('`'+_0x589804['field']+_0x1a3d('0x60'));}else{_0x50b1cb['having']('`'+_0x589804['field']+'`\x20>\x200');}break;case _0x1a3d('0x61'):if(_0x589804[_0x1a3d('0x62')]==='$substring'){if(_0x589804['value'][_0x1a3d('0x31')]('\x20')[_0x1a3d('0x40')]>0x1){_0x4d768c[_0x450a2a](_0x1a3d('0x63'),qs['getFullTextValue'](_0x589804[_0x1a3d('0x5e')]),null);}else{var _0x587782='%'+_0x589804[_0x1a3d('0x5e')]+'%';_0x4d768c[_0x450a2a](_0x1a3d('0x64'),_0x587782,_0x587782,_0x587782);}}else{_0x3d90e9=_['find'](_0x43749a,[_0x1a3d('0x2b'),_0x1a3d('0x65')]);_0x589804['field']='ContactId';_0x3dca0d=as['buildExpression'](_0x12ce9d,_0x3d90e9[_0x1a3d('0x38')],_0x589804);_0x4d768c[_0x450a2a](_0x3dca0d[_0x1a3d('0x66')],_0x3dca0d['value'][_0x1a3d('0x67')],_0x3dca0d[_0x1a3d('0x5e')][_0x1a3d('0x1f')]);}break;case _0x1a3d('0x68'):var _0x5df004=_0x589804[_0x1a3d('0x5e')][_0x1a3d('0x31')](',')[_0x1a3d('0x2d')](function(_0x3cb987){return Number(_0x3cb987);});_0x5df004['forEach'](function(_0x2ad490){_0x2fe0e9['or'](_0x1a3d('0x69'),'%,'+_0x2ad490+',%');});_0x4fbffc=_['union'](_0x4fbffc,_0x5df004);break;case _0x1a3d('0x6a'):if(_0x589804['operator']===_0x1a3d('0x6b')){_0x4d768c[_0x450a2a](_0x1a3d('0x6c'),'%'+_0x589804['value']+'%',null);}else{_0x3d90e9=_['find'](_0x43749a,[_0x1a3d('0x2b'),'UserId']);_0x589804[_0x1a3d('0x48')]=_0x1a3d('0x6d');_0x3dca0d=as['buildExpression'](_0x12ce9d,_0x3d90e9['type'],_0x589804);_0x4d768c[_0x450a2a](_0x3dca0d[_0x1a3d('0x66')],_0x3dca0d[_0x1a3d('0x5e')][_0x1a3d('0x67')],_0x3dca0d[_0x1a3d('0x5e')][_0x1a3d('0x1f')]);}break;case'body':_0x3dca0d=as['buildExpression']('me',null,_0x589804);_0x4d768c[_0x450a2a](_0x3dca0d[_0x1a3d('0x66')],_0x3dca0d[_0x1a3d('0x5e')][_0x1a3d('0x67')],_0x3dca0d[_0x1a3d('0x5e')][_0x1a3d('0x1f')]);break;}}else{var _0x3dca0d=as[_0x1a3d('0x6e')](_0x12ce9d,_0x3d90e9[_0x1a3d('0x38')],_0x589804);_0x4d768c[_0x450a2a](_0x3dca0d[_0x1a3d('0x66')],_0x3dca0d[_0x1a3d('0x5e')][_0x1a3d('0x67')],_0x3dca0d[_0x1a3d('0x5e')][_0x1a3d('0x1f')]);}}}else{var _0x5d8b58=_(_0x385ebc[_0x1a3d('0x3a')])['keys']()[_0x1a3d('0x2d')](function(_0x39bbcd){return _[_0x1a3d('0x6f')](_0x43749a,['name',_0x39bbcd])?_0x39bbcd:undefined;})[_0x1a3d('0x70')]()[_0x1a3d('0x5e')]();if(!_['isEmpty'](_0x5d8b58)){_0x5d8b58[_0x1a3d('0x32')](function(_0x1085d4){if(_0x1085d4===_0x1a3d('0x71')){_0x50b1cb[_0x1a3d('0x45')](_0x1a3d('0x72'),[][_0x1a3d('0x73')](_0x385ebc[_0x1a3d('0x3a')][_0x1085d4]));}else if(_0x1085d4===_0x1a3d('0x74')){var _0x171d22=JSON[_0x1a3d('0x75')](_0x385ebc['query'][_0x1085d4])['$gte'];var _0x4fc30e=JSON[_0x1a3d('0x75')](_0x385ebc['query'][_0x1085d4])[_0x1a3d('0x76')];_0x50b1cb[_0x1a3d('0x45')](_0x1a3d('0x77'),_0x171d22,_0x4fc30e);}else{if(_0x385ebc['query'][_0x1085d4]===_0x1a3d('0x78')){_0x50b1cb['where']('i.'+_0x1085d4+_0x1a3d('0x79'));}else{_0x50b1cb[_0x1a3d('0x45')]('i.'+_0x1085d4+'\x20=\x20?',_0x385ebc[_0x1a3d('0x3a')][_0x1085d4]);}}});}if(_0x385ebc[_0x1a3d('0x3a')][_0x1a3d('0x7a')]){if(_0x385ebc['query']['read']==0x1){_0x50b1cb[_0x1a3d('0x5f')](_0x1a3d('0x7b'));}else{_0x50b1cb[_0x1a3d('0x5f')](_0x1a3d('0x7c'));}}if(_0x385ebc[_0x1a3d('0x3a')][_0x1a3d('0x7d')]){_0x4fbffc=_[_0x1a3d('0x7e')](_0x385ebc['query'][_0x1a3d('0x7d')])?_0x385ebc[_0x1a3d('0x3a')][_0x1a3d('0x7d')]:new Array(_0x385ebc[_0x1a3d('0x3a')]['tag']);_0x4fbffc['forEach'](function(_0x444073){_0x2fe0e9['or'](_0x1a3d('0x69'),'%,'+_0x444073+',%');});}if(_0x385ebc['query'][_0x1a3d('0x7f')]){var _0x182216=_0x385ebc['query']['filter']['replace']('\x5c','\x5c\x5c')[_0x1a3d('0x80')](/'/g,'\x27\x27');if(qs[_0x1a3d('0x81')](_0x182216)){_0x4d768c['or']('i.id\x20LIKE\x20?',_0x182216+'%')['or'](_0x1a3d('0x82'),_0x182216+'%');}else{_0x4d768c['or'](_0x1a3d('0x83'),qs[_0x1a3d('0x84')](_0x182216))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x182216+'%');}}}_0x50b1cb[_0x1a3d('0x45')](_0x4d768c);_0x50b1cb[_0x1a3d('0x85')](_0x1a3d('0x86'));var _0x2d15fe={'type':db[_0x1a3d('0x87')]['QueryTypes'][_0x1a3d('0x88')],'raw':!![]};var _0x3733f2=_0x50b1cb[_0x1a3d('0x89')]();_0x3733f2[_0x1a3d('0x48')](_0x1a3d('0x86'));_0x3733f2[_0x1a3d('0x48')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');if(_0xa29a9d['order']){_0xa29a9d['order'][_0x1a3d('0x32')](function(_0x152ab7){var _0x5c3a47=_0x152ab7[0x0]===_0x1a3d('0x8a')?_0x152ab7[0x0]:'i.'+_0x152ab7[0x0];_0x50b1cb[_0x1a3d('0x43')](_0x5c3a47,_0x152ab7[0x1]===_0x1a3d('0x8b')?![]:!![]);});}if(!_[_0x1a3d('0x8c')](_0x4fbffc)){_0x50b1cb[_0x1a3d('0x5f')](_0x2fe0e9);_0x3733f2[_0x1a3d('0x45')](_0x1a3d('0x8d'),_0x4fbffc);}BPromise[_0x1a3d('0x8e')]()[_0x1a3d('0x2a')](function(){if(!_0xe4c1ac){if(_0x385ebc['query'][_0x1a3d('0x71')])return;_0x3733f2[_0x1a3d('0x45')](_0x1a3d('0x8f'));_0x50b1cb['where'](_0x1a3d('0x8f'));return;}if(_0x385ebc[_0x1a3d('0x90')]['role']!=='agent')return;return _0x385ebc[_0x1a3d('0x90')][_0x1a3d('0x91')]({'attributes':['id'],'raw':!![]})['then'](function(_0x22a468){if(_['isEmpty'](_0x22a468)){_0x3733f2[_0x1a3d('0x45')](_0x1a3d('0x92'));_0x50b1cb['where']('i.WhatsappAccountId\x20IS\x20NULL');}else{_0x3733f2['where'](_0x1a3d('0x72'),_[_0x1a3d('0x2d')](_0x22a468,'id'));_0x50b1cb['where'](_0x1a3d('0x72'),_[_0x1a3d('0x2d')](_0x22a468,'id'));}});})[_0x1a3d('0x2a')](function(){if(_0x385ebc[_0x1a3d('0x90')][_0x1a3d('0x93')]===_0x1a3d('0x94')&&!_0xe4c1ac&&!_0x385ebc[_0x1a3d('0x3a')][_0x1a3d('0x71')])return[];return db[_0x1a3d('0x95')]['query'](_0x3733f2[_0x1a3d('0x96')](),_0x2d15fe);})[_0x1a3d('0x2a')](function(_0x5c8b83){_0x40b9ab['count']=_0x5c8b83[_0x1a3d('0x40')];if(_0x40b9ab['count']===0x0)return[];return db['sequelize'][_0x1a3d('0x3a')](_0x2bc3b7[_0x1a3d('0x96')](),_0x2d15fe)[_0x1a3d('0x2a')](function(_0x4dc584){_0x361c71=_[_0x1a3d('0x97')](_0x4dc584,'id');_0x2d15fe=_[_0x1a3d('0x98')](_0x2d15fe,{'model':db[_0x1a3d('0x99')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x385ebc['query'][_0x1a3d('0x3f')]){_0xa29a9d['attributes']['forEach'](function(_0x50c85f){_0x50b1cb['field']('i.'+_0x50c85f);});}else{_0x50b1cb[_0x1a3d('0x48')](_0x1a3d('0x9a'),'unreadMessages');_0x50b1cb[_0x1a3d('0x48')](_0x1a3d('0x9b'),_0x1a3d('0x9c'));_0x50b1cb[_0x1a3d('0x48')]('a.mandatoryDisposition',_0x1a3d('0x9d'));_0x50b1cb[_0x1a3d('0x48')](_0x1a3d('0x9e'),_0x1a3d('0x8a'));_0x50b1cb[_0x1a3d('0x48')](_0x1a3d('0x9f'));_0x50b1cb[_0x1a3d('0x48')]('c.firstName',_0x1a3d('0xa0'));_0x50b1cb[_0x1a3d('0x48')](_0x1a3d('0xa1'),_0x1a3d('0xa2'));_0x50b1cb[_0x1a3d('0x48')]('c.email','Contact.email');_0x50b1cb['field'](_0x1a3d('0xa3'),_0x1a3d('0xa4'));_0x50b1cb[_0x1a3d('0x48')](_0x1a3d('0xa5'),_0x1a3d('0xa6'));_0x50b1cb[_0x1a3d('0x48')](_0x1a3d('0xa7'),_0x1a3d('0xa8'));_0x50b1cb[_0x1a3d('0x48')](_0x1a3d('0xa9'),_0x1a3d('0xaa'));_0x50b1cb[_0x1a3d('0x48')](_0x1a3d('0xab'),_0x1a3d('0xac'));_0x50b1cb[_0x1a3d('0x48')](_0x1a3d('0xad'),'TagIds');}if(_0xa29a9d['limit'])_0x50b1cb[_0x1a3d('0x22')](_0xa29a9d[_0x1a3d('0x22')]);if(_0xa29a9d[_0x1a3d('0x20')])_0x50b1cb[_0x1a3d('0x20')](_0xa29a9d[_0x1a3d('0x20')]);return db[_0x1a3d('0x95')][_0x1a3d('0x3a')](_0x50b1cb['toString'](),_0x2d15fe);})[_0x1a3d('0x2a')](function(_0x4bf146){if(_0x4bf146[_0x1a3d('0x40')]>0x0)_0x1ffda8[_0x1a3d('0x45')](_0x1a3d('0xae'),_[_0x1a3d('0x2d')](_0x4bf146,'id'));return db[_0x1a3d('0x95')][_0x1a3d('0x3a')](_0x1ffda8[_0x1a3d('0x96')](),_0x2d15fe)['then'](function(_0xc40400){var _0x3c8439=_[_0x1a3d('0xaf')](_0xc40400,'WhatsappInteractionId');var _0x4dc553=[];_0x4bf146[_0x1a3d('0x32')](function(_0x13ed43){_0x4dc553[_0x1a3d('0x33')](updateWhatsappInteraction(_0x13ed43,_0x361c71,_0x3c8439));});return BPromise[_0x1a3d('0xb0')](_0x4dc553);});});})[_0x1a3d('0x2a')](function(_0xcc3bb8){_0x40b9ab[_0x1a3d('0xb1')]=_0xcc3bb8;return _0x40b9ab;})[_0x1a3d('0x2a')](respondWithFilteredResult(_0xdb441c,_0xa29a9d))[_0x1a3d('0x34')](handleError(_0xdb441c,null));};exports['show']=function(_0x515987,_0x51db58){var _0x1da7f2={'raw':![],'where':{'id':_0x515987[_0x1a3d('0xb2')]['id']}},_0x1d9afd={};_0x1d9afd[_0x1a3d('0x3d')]=_['keys'](db[_0x1a3d('0x99')]['rawAttributes']);_0x1d9afd[_0x1a3d('0x3a')]=_[_0x1a3d('0xb3')](_0x515987[_0x1a3d('0x3a')]);_0x1d9afd['filters']=_[_0x1a3d('0x3c')](_0x1d9afd[_0x1a3d('0x3d')],_0x1d9afd[_0x1a3d('0x3a')]);_0x1da7f2[_0x1a3d('0x3e')]=_[_0x1a3d('0x3c')](_0x1d9afd['model'],qs[_0x1a3d('0x3f')](_0x515987[_0x1a3d('0x3a')]['fields']));_0x1da7f2[_0x1a3d('0x3e')]=_0x1da7f2[_0x1a3d('0x3e')][_0x1a3d('0x40')]?_0x1da7f2[_0x1a3d('0x3e')]:_0x1d9afd['model'];if(_0x515987['query'][_0x1a3d('0xb4')]){_0x1da7f2[_0x1a3d('0xb5')]=[{'all':!![]}];}_0x1da7f2=_[_0x1a3d('0x98')]({},_0x1da7f2,_0x515987[_0x1a3d('0xb6')]);return db[_0x1a3d('0x99')][_0x1a3d('0xb7')](_0x1da7f2)['then'](handleEntityNotFound(_0x51db58,null))[_0x1a3d('0x2a')](respondWithResult(_0x51db58,null))[_0x1a3d('0x34')](handleError(_0x51db58,null));};exports[_0x1a3d('0xb8')]=function(_0x303028,_0xcc3e32){return db['WhatsappInteraction']['create'](_0x303028[_0x1a3d('0xb9')],{})[_0x1a3d('0x2a')](respondWithResult(_0xcc3e32,0xc9))[_0x1a3d('0x34')](handleError(_0xcc3e32,null));};exports['update']=function(_0x4222f7,_0x218c0e){if(_0x4222f7[_0x1a3d('0xb9')]['id']){delete _0x4222f7[_0x1a3d('0xb9')]['id'];}return db[_0x1a3d('0x99')][_0x1a3d('0xb7')]({'where':{'id':_0x4222f7[_0x1a3d('0xb2')]['id']}})[_0x1a3d('0x2a')](handleEntityNotFound(_0x218c0e,null))[_0x1a3d('0x2a')](saveUpdates(_0x4222f7[_0x1a3d('0xb9')],null))[_0x1a3d('0x2a')](respondWithResult(_0x218c0e,null))[_0x1a3d('0x34')](handleError(_0x218c0e,null));};exports['destroy']=function(_0xa7ed31,_0x3f6d00){return db[_0x1a3d('0x99')][_0x1a3d('0xb7')]({'where':{'id':_0xa7ed31['params']['id']}})[_0x1a3d('0x2a')](handleEntityNotFound(_0x3f6d00,null))['then'](removeEntity(_0x3f6d00,null))[_0x1a3d('0x34')](handleError(_0x3f6d00,null));};exports[_0x1a3d('0xba')]=function(_0x8eeb4d,_0xc4ef5b){return db['WhatsappInteraction'][_0x1a3d('0xba')]()['then'](respondWithResult(_0xc4ef5b,null))[_0x1a3d('0x34')](handleError(_0xc4ef5b,null));};exports['addMessage']=function(_0x58f961,_0x44d0d2,_0x128ade){return db[_0x1a3d('0xbb')][_0x1a3d('0xb7')]({'where':{'id':_0x58f961[_0x1a3d('0xb2')]['id']}})[_0x1a3d('0x2a')](handleEntityNotFound(_0x44d0d2,null))[_0x1a3d('0x2a')](function(_0x5f7395){if(_0x5f7395){return _0x5f7395[_0x1a3d('0xbc')](_0x58f961[_0x1a3d('0xb9')][_0x1a3d('0xbd')],_[_0x1a3d('0xbe')](_0x58f961['body'],[_0x1a3d('0xbd'),'id'])||{});}})[_0x1a3d('0x2a')](respondWithResult(_0x44d0d2,null))[_0x1a3d('0x34')](handleError(_0x44d0d2,null));};exports[_0x1a3d('0xbf')]=function(_0x4431f2,_0x5584a8,_0x10c379){var _0xa21e00={'raw':![],'where':{}};var _0x1fd53e={};var _0x4cd95c={'count':0x0,'rows':[]};return db['WhatsappInteraction']['findOne']({'where':{'id':_0x4431f2[_0x1a3d('0xb2')]['id']}})[_0x1a3d('0x2a')](handleEntityNotFound(_0x5584a8,null))['then'](function(_0x7ee0c0){if(_0x7ee0c0){_0x1fd53e[_0x1a3d('0x3d')]=_[_0x1a3d('0xb3')](db['WhatsappMessage'][_0x1a3d('0x36')]);_0x1fd53e[_0x1a3d('0x3a')]=_[_0x1a3d('0xb3')](_0x4431f2[_0x1a3d('0x3a')]);_0x1fd53e[_0x1a3d('0x3b')]=_['intersection'](_0x1fd53e[_0x1a3d('0x3d')],_0x1fd53e[_0x1a3d('0x3a')]);_0xa21e00[_0x1a3d('0x3e')]=_['intersection'](_0x1fd53e[_0x1a3d('0x3d')],qs[_0x1a3d('0x3f')](_0x4431f2['query']['fields']));_0xa21e00[_0x1a3d('0x3e')]=_0xa21e00['attributes']['length']?_0xa21e00[_0x1a3d('0x3e')]:_0x1fd53e[_0x1a3d('0x3d')];if(!_0x4431f2[_0x1a3d('0x3a')][_0x1a3d('0x41')](_0x1a3d('0x42'))){_0xa21e00['limit']=qs['limit'](_0x4431f2[_0x1a3d('0x3a')][_0x1a3d('0x22')]);_0xa21e00[_0x1a3d('0x20')]=qs[_0x1a3d('0x20')](_0x4431f2['query']['offset']);}_0xa21e00[_0x1a3d('0x43')]=qs['sort'](_0x4431f2[_0x1a3d('0x3a')][_0x1a3d('0x44')]);_0xa21e00[_0x1a3d('0x45')]=qs[_0x1a3d('0x3b')](_[_0x1a3d('0x46')](_0x4431f2[_0x1a3d('0x3a')],_0x1fd53e['filters']));_0xa21e00[_0x1a3d('0x45')]['WhatsappInteractionId']=_0x7ee0c0['id'];if(_0x4431f2['query'][_0x1a3d('0x7f')]){_0xa21e00[_0x1a3d('0x45')]=_[_0x1a3d('0x98')](_0xa21e00[_0x1a3d('0x45')],{'$or':_['map'](_0xa21e00[_0x1a3d('0x3e')],function(_0x30bc2d){var _0x407a85={};_0x407a85[_0x30bc2d]={'$like':'%'+_0x4431f2[_0x1a3d('0x3a')]['filter']+'%'};return _0x407a85;})});}if(_0x4431f2[_0x1a3d('0x3a')][_0x1a3d('0xc0')]){var _0x5924a6=_0x4431f2[_0x1a3d('0x3a')][_0x1a3d('0xc0')][_0x1a3d('0x31')](',');var _0x381933={};_0x381933[_0x5924a6[0x0]]={'$gte':moment(_0x5924a6[0x1])['format'](_0x1a3d('0xc1'))};_0xa21e00[_0x1a3d('0x45')]=_[_0x1a3d('0x98')](_0xa21e00['where'],_0x381933);}_0xa21e00=_['merge']({},_0xa21e00,_0x4431f2[_0x1a3d('0xb6')]);return db[_0x1a3d('0xbb')][_0x1a3d('0x23')]({'where':_0xa21e00[_0x1a3d('0x45')]})[_0x1a3d('0x2a')](function(_0x182614){_0x4cd95c['count']=_0x182614;if(_0x4431f2[_0x1a3d('0x3a')][_0x1a3d('0xb4')]){_0xa21e00[_0x1a3d('0xb5')]=[{'all':!![]}];}return db[_0x1a3d('0xbb')]['findAll'](_0xa21e00);})[_0x1a3d('0x2a')](function(_0x50f30f){_0x4cd95c[_0x1a3d('0xb1')]=_0x50f30f;return _0x4cd95c;});}})[_0x1a3d('0x2a')](respondWithFilteredResult(_0x5584a8,_0xa21e00))[_0x1a3d('0x34')](handleError(_0x5584a8,null));};exports[_0x1a3d('0xc2')]=function(_0x589c24,_0x518ff4,_0x5de913){return db[_0x1a3d('0x99')][_0x1a3d('0xb7')]({'where':{'id':_0x589c24[_0x1a3d('0xb2')]['id']}})[_0x1a3d('0x2a')](handleEntityNotFound(_0x518ff4,null))['then'](function(_0x259400){if(_0x259400){return _0x259400[_0x1a3d('0xc3')](_0x589c24[_0x1a3d('0xb9')][_0x1a3d('0xbd')],_[_0x1a3d('0xbe')](_0x589c24[_0x1a3d('0xb9')],['ids','id'])||{})[_0x1a3d('0xc4')](function(){return db[_0x1a3d('0x68')]['findAll']({'attributes':['id',_0x1a3d('0x2b'),_0x1a3d('0x49')],'where':{'id':_0x589c24[_0x1a3d('0xb9')][_0x1a3d('0xbd')]}});})[_0x1a3d('0x2a')](function(_0x265d9a){socket[_0x1a3d('0xc5')](_0x1a3d('0xc6'),{'id':Number(_0x589c24[_0x1a3d('0xb2')]['id']),'tags':_0x265d9a||[]});return{'id':Number(_0x589c24['params']['id']),'tags':_0x265d9a||[]};});}})[_0x1a3d('0x2a')](respondWithResult(_0x518ff4,null))[_0x1a3d('0x34')](handleError(_0x518ff4,null));};exports[_0x1a3d('0xc7')]=function(_0x5b4696,_0x3c5172,_0x9dcc0c){return db[_0x1a3d('0x99')][_0x1a3d('0xb7')]({'where':{'id':_0x5b4696[_0x1a3d('0xb2')]['id']}})[_0x1a3d('0x2a')](handleEntityNotFound(_0x3c5172,null))[_0x1a3d('0x2a')](function(_0x219e94){if(_0x219e94){return _0x219e94[_0x1a3d('0xc7')](_0x5b4696[_0x1a3d('0x3a')][_0x1a3d('0xbd')]);}})[_0x1a3d('0x2a')](respondWithStatusCode(_0x3c5172,null))[_0x1a3d('0x34')](handleError(_0x3c5172,null));};exports[_0x1a3d('0xc8')]=function(_0x43d2f1,_0x1d5aed){var _0x261ee7=moment()[_0x1a3d('0xc9')]()[_0x1a3d('0x96')]();var _0x76f793=path[_0x1a3d('0xca')](config[_0x1a3d('0xcb')],_0x1a3d('0xcc'),'files',_0x1a3d('0xcd'));var _0x10bd83=path['join'](config['root'],_0x1a3d('0xcc'),_0x1a3d('0xce'),'attachments');var _0x3ba468=path[_0x1a3d('0xca')](_0x76f793,_0x261ee7);var _0x215ebf=util[_0x1a3d('0xcf')](_0x1a3d('0xd0'),_0x43d2f1[_0x1a3d('0xb2')]['id'],_0x261ee7);var _0x251d93=path['join'](_0x76f793,_0x215ebf);var _0x1efa71=[];_0x1efa71['push']({'model':db[_0x1a3d('0x6a')],'as':_0x1a3d('0x6a'),'attributes':['id',_0x1a3d('0x2e')],'raw':!![]});_0x1efa71[_0x1a3d('0x33')]({'model':db[_0x1a3d('0xd1')],'as':'Contact','attributes':['id','firstName','lastName'],'raw':!![]});if(_0x43d2f1[_0x1a3d('0x3a')]['attachments']){_0x1efa71[_0x1a3d('0x33')]({'model':db['Attachment'],'as':_0x1a3d('0xd2'),'raw':!![]});}var _0x4d9a2c=[{'model':db['WhatsappMessage'],'as':_0x1a3d('0xd3'),'attributes':['id',_0x1a3d('0xb9'),'createdAt',_0x1a3d('0xd4'),_0x1a3d('0xd5'),_0x1a3d('0x7a')],'include':_0x1efa71}];_0x4d9a2c['push']({'model':db['WhatsappAccount'],'as':_0x1a3d('0xd6'),'attributes':['id',_0x1a3d('0x2b')]});_0x4d9a2c[_0x1a3d('0x33')]({'model':db[_0x1a3d('0x6a')],'as':_0x1a3d('0xd7'),'attributes':['id',_0x1a3d('0x2e')]});return db[_0x1a3d('0x99')][_0x1a3d('0xb7')]({'where':{'id':_0x43d2f1['params']['id']},'include':_0x4d9a2c})['then'](handleEntityNotFound(_0x1d5aed,null))[_0x1a3d('0x2a')](function(_0x2f52ed){if(_0x2f52ed){var _0x35fdf6=_0x2f52ed['get']({'plain':!![]});fs[_0x1a3d('0xd8')](_0x3ba468);var _0x349d1f={'channel':'Whatsapp','account':_0x35fdf6[_0x1a3d('0xd6')][_0x1a3d('0x2b')],'agent':_0x35fdf6[_0x1a3d('0xd7')]?_0x35fdf6[_0x1a3d('0xd7')][_0x1a3d('0x2e')]:'N.A.','createdAt':moment(_0x35fdf6[_0x1a3d('0x74')])[_0x1a3d('0xcf')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'closedAt':_0x35fdf6['closed']?moment(_0x35fdf6[_0x1a3d('0xd9')])[_0x1a3d('0xcf')](_0x1a3d('0xc1'))['toString']():'','disposition':_0x35fdf6[_0x1a3d('0xda')],'messages':_(_0x35fdf6['Messages'])['filter']({'secret':![]})[_0x1a3d('0x2d')](function(_0x4cffbd){if(_0x4cffbd[_0x1a3d('0xd2')]){var _0x4aa6a3=path['join'](_0x10bd83,_0x4cffbd[_0x1a3d('0xd2')][_0x1a3d('0xdb')]);if(fs[_0x1a3d('0xdc')](_0x4aa6a3)){fs['createReadStream'](_0x4aa6a3)[_0x1a3d('0xdd')](fs['createWriteStream'](path[_0x1a3d('0xca')](_0x3ba468,_0x4cffbd['Attachment'][_0x1a3d('0xdb')])));}}return{'date':moment(_0x4cffbd['createdAt'])[_0x1a3d('0xcf')](_0x1a3d('0xc1'))[_0x1a3d('0x96')](),'sender':_0x4cffbd[_0x1a3d('0xd4')]===_0x1a3d('0xde')?_0x4cffbd[_0x1a3d('0x6a')]?_0x4cffbd[_0x1a3d('0x6a')][_0x1a3d('0x2e')]:_0x1a3d('0xdf'):_0x4cffbd[_0x1a3d('0x61')][_0x1a3d('0xe0')]+(_0x4cffbd[_0x1a3d('0x61')][_0x1a3d('0xe1')]?'\x20'+_0x4cffbd[_0x1a3d('0x61')][_0x1a3d('0xe1')]:''),'body':_0x4cffbd[_0x1a3d('0xd2')]?_0x4cffbd[_0x1a3d('0xd2')][_0x1a3d('0xdb')]:_0x4cffbd[_0x1a3d('0xb9')],'direction':_0x4cffbd[_0x1a3d('0xd4')]===_0x1a3d('0xde')?'A':'C','secret':_0x4cffbd[_0x1a3d('0xd5')],'read':_0x4cffbd['read'],'attachment':_0x4cffbd[_0x1a3d('0xd2')]};})['value']()};return ejs[_0x1a3d('0xe2')](path[_0x1a3d('0xca')](config[_0x1a3d('0xcb')],_0x1a3d('0xcc'),_0x1a3d('0xe3'),_0x1a3d('0xe4')),{'interaction':_0x349d1f})['then'](function(_0x2f8365){var _0x4a33ea=path[_0x1a3d('0xca')](_0x3ba468,_0x1a3d('0xe5')+_0x35fdf6['id']+'-'+_0x261ee7+_0x1a3d('0xe6'));var _0x1de600={'path':_0x4a33ea,'channel':_0x1a3d('0xe7'),'interactionId':_0x35fdf6['id']};return pdf[_0x1a3d('0xe8')](_0x2f8365,_0x1de600);})[_0x1a3d('0x2a')](function(){return new BPromise(function(_0x3895d5,_0x1d0068){zipdir(_0x3ba468,{'saveTo':_0x251d93},function(_0x3e5ad3,_0x1ab53c){if(_0x3e5ad3)return _0x1d0068(_0x3e5ad3);return _0x3895d5(_0x1ab53c);});})[_0x1a3d('0x2a')](function(){return new BPromise(function(_0xc244f7,_0x4c7de5){rimraf(_0x3ba468,function(_0x22500e){if(_0x22500e)_0x4c7de5(_0x22500e);return _0xc244f7();});});})['then'](function(){return _0x1d5aed[_0x1a3d('0xc8')](_0x251d93,_0x215ebf,function(_0x4316ff){if(_0x4316ff){console[_0x1a3d('0xe9')](_0x1a3d('0xea'),_0x4316ff);}else{fs[_0x1a3d('0xeb')](_0x251d93);}});});});}else{return _0x1d5aed[_0x1a3d('0x1d')](0xc8);}})[_0x1a3d('0x34')](handleError(_0x1d5aed,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index 3accbf7..661422a 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 _0x682e=['WhatsappInteraction','WhatsappMessage','setMaxListeners','update','remove','getUsers','then','setDataValue','map','findAll','length','emit','hook','exports','events','../../mysqldb'];(function(_0x2842b4,_0x2b1b7b){var _0x2b9521=function(_0x3613b8){while(--_0x3613b8){_0x2842b4['push'](_0x2842b4['shift']());}};_0x2b9521(++_0x2b1b7b);}(_0x682e,0x1ce));var _0xe682=function(_0xcd8e75,_0x4bf1ac){_0xcd8e75=_0xcd8e75-0x0;var _0x3effa8=_0x682e[_0xcd8e75];return _0x3effa8;};'use strict';var EventEmitter=require(_0xe682('0x0'));var WhatsappInteraction=require(_0xe682('0x1'))['db'][_0xe682('0x2')];var WhatsappMessage=require(_0xe682('0x1'))['db'][_0xe682('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0xe682('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0xe682('0x5'),'afterDestroy':_0xe682('0x6')};function emitEvent(_0x3705a2){return function(_0x44f74e,_0x31d6c6,_0x51e786){_0x44f74e[_0xe682('0x7')]({'attributes':['id'],'raw':!![]})[_0xe682('0x8')](function(_0x68a2e3){_0x44f74e[_0xe682('0x9')]('Users',_0x68a2e3[_0xe682('0xa')](function(_0x3dfb81){return{'id':_0x3dfb81['id']};}));return WhatsappMessage[_0xe682('0xb')]({'where':{'WhatsappInteractionId':_0x44f74e['id'],'direction':'in','read':![]},'raw':!![]});})[_0xe682('0x8')](function(_0xd3143e){_0x44f74e[_0xe682('0x9')]('unreadMessages',_0xd3143e[_0xe682('0xc')]);WhatsappInteractionEvents['emit'](_0x3705a2+':'+_0x44f74e['id'],_0x44f74e);WhatsappInteractionEvents[_0xe682('0xd')](_0x3705a2,_0x44f74e);_0x51e786(null);})['catch'](_0x51e786(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappInteraction[_0xe682('0xe')](e,emitEvent(event));}}module[_0xe682('0xf')]=WhatsappInteractionEvents; \ No newline at end of file +var _0x255f=['../../mysqldb','WhatsappMessage','save','update','remove','then','Users','map','findAll','setDataValue','length','emit','catch','hasOwnProperty','exports','events','WhatsappInteraction'];(function(_0x5db720,_0x1d6bdd){var _0x2ab3e2=function(_0x4f3692){while(--_0x4f3692){_0x5db720['push'](_0x5db720['shift']());}};_0x2ab3e2(++_0x1d6bdd);}(_0x255f,0x185));var _0xf255=function(_0x5bc249,_0x487c4a){_0x5bc249=_0x5bc249-0x0;var _0x424d44=_0x255f[_0x5bc249];return _0x424d44;};'use strict';var EventEmitter=require(_0xf255('0x0'));var WhatsappInteraction=require('../../mysqldb')['db'][_0xf255('0x1')];var WhatsappMessage=require(_0xf255('0x2'))['db'][_0xf255('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xf255('0x4'),'afterUpdate':_0xf255('0x5'),'afterDestroy':_0xf255('0x6')};function emitEvent(_0x151b29){return function(_0x42e4a7,_0x674218,_0xc1d19f){_0x42e4a7['getUsers']({'attributes':['id'],'raw':!![]})[_0xf255('0x7')](function(_0x4b98fa){_0x42e4a7['setDataValue'](_0xf255('0x8'),_0x4b98fa[_0xf255('0x9')](function(_0x4f0b20){return{'id':_0x4f0b20['id']};}));return WhatsappMessage[_0xf255('0xa')]({'where':{'WhatsappInteractionId':_0x42e4a7['id'],'direction':'in','read':![]},'raw':!![]});})[_0xf255('0x7')](function(_0x4c6446){_0x42e4a7[_0xf255('0xb')]('unreadMessages',_0x4c6446[_0xf255('0xc')]);WhatsappInteractionEvents[_0xf255('0xd')](_0x151b29+':'+_0x42e4a7['id'],_0x42e4a7);WhatsappInteractionEvents[_0xf255('0xd')](_0x151b29,_0x42e4a7);_0xc1d19f(null);})[_0xf255('0xe')](_0xc1d19f(null));};}for(var e in events){if(events[_0xf255('0xf')](e)){var event=events[e];WhatsappInteraction['hook'](e,emitEvent(event));}}module[_0xf255('0x10')]=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index b5ba85b..57c4c1f 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 _0x41d5=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappInteraction.attributes','exports','define','WhatsappInteraction','whatsapp_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x12bb27,_0x5175d3){var _0x475979=function(_0x8579d8){while(--_0x8579d8){_0x12bb27['push'](_0x12bb27['shift']());}};_0x475979(++_0x5175d3);}(_0x41d5,0x7e));var _0x541d=function(_0xdb912d,_0x3f6cc2){_0xdb912d=_0xdb912d-0x0;var _0x376798=_0x41d5[_0xdb912d];return _0x376798;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x541d('0x0'))(_0x541d('0x1'));var moment=require(_0x541d('0x2'));var BPromise=require(_0x541d('0x3'));var rp=require(_0x541d('0x4'));var fs=require('fs');var path=require(_0x541d('0x5'));var rimraf=require(_0x541d('0x6'));var config=require(_0x541d('0x7'));var attributes=require(_0x541d('0x8'));module[_0x541d('0x9')]=function(_0x48614c,_0x4933a5){return _0x48614c[_0x541d('0xa')](_0x541d('0xb'),attributes,{'tableName':_0x541d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3b1105,_0x2f8e2a,_0x373992){if(_0x3b1105[_0x541d('0xd')](_0x541d('0xe'))){_0x3b1105[_0x541d('0xf')]=moment()[_0x541d('0x10')](_0x541d('0x11'));}_0x373992(null,_0x3b1105);}}});}; \ No newline at end of file +var _0x0005=['../../config/environment','./whatsappInteraction.attributes','exports','define','WhatsappInteraction','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','bluebird','request-promise','rimraf'];(function(_0x501401,_0x2d8737){var _0xfd0a47=function(_0x57decb){while(--_0x57decb){_0x501401['push'](_0x501401['shift']());}};_0xfd0a47(++_0x2d8737);}(_0x0005,0x1d4));var _0x5000=function(_0x27af79,_0x2a8d2a){_0x27af79=_0x27af79-0x0;var _0xa5aa6=_0x0005[_0x27af79];return _0xa5aa6;};'use strict';var _=require('lodash');var util=require(_0x5000('0x0'));var logger=require(_0x5000('0x1'))('api');var moment=require('moment');var BPromise=require(_0x5000('0x2'));var rp=require(_0x5000('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5000('0x4'));var config=require(_0x5000('0x5'));var attributes=require(_0x5000('0x6'));module[_0x5000('0x7')]=function(_0x366122,_0x5792b1){return _0x366122[_0x5000('0x8')](_0x5000('0x9'),attributes,{'tableName':'whatsapp_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xdfb505,_0x32e305,_0x36f941){if(_0xdfb505['changed']('closed')){_0xdfb505['closedAt']=moment()['format'](_0x5000('0xa'));}_0x36f941(null,_0xdfb505);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index 6882648..417dcaf 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 _0x014a=['debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','WhatsappInteraction','update','body','options','raw','where','attributes','UpdateWhatsappInteraction','AddTagsToWhatsappInteraction','find','ids','omit','spread','AddTags','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','request','then','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent'];(function(_0x576a09,_0xa88bac){var _0x3bec24=function(_0x1dc25a){while(--_0x1dc25a){_0x576a09['push'](_0x576a09['shift']());}};_0x3bec24(++_0xa88bac);}(_0x014a,0x187));var _0xa014=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0x014a[_0x411add];return _0x238242;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xa014('0x0'));var BPromise=require(_0xa014('0x1'));var rs=require(_0xa014('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa014('0x3'))['db'];var utils=require(_0xa014('0x4'));var logger=require('../../config/logger')(_0xa014('0x5'));var config=require(_0xa014('0x6'));var jayson=require(_0xa014('0x7'));var client=jayson['client']['http']({'port':0x232a});config[_0xa014('0x8')]=_[_0xa014('0x9')](config['redis'],{'host':_0xa014('0xa'),'port':0x18eb});var socket=require(_0xa014('0xb'))(new Redis(config['redis']));require(_0xa014('0xc'))[_0xa014('0xd')](socket);function respondWithRpcPromise(_0x393367,_0x158769,_0xe61087){return new BPromise(function(_0x17e2f7,_0x50ccf6){return client[_0xa014('0xe')](_0x393367,_0xe61087)[_0xa014('0xf')](function(_0x49d52b){logger[_0xa014('0x10')](_0xa014('0x11'),_0x158769,_0xa014('0x12'));logger[_0xa014('0x13')](_0xa014('0x14'),_0x158769,_0xa014('0x12'),JSON[_0xa014('0x15')](_0x49d52b));if(_0x49d52b[_0xa014('0x16')]){if(_0x49d52b[_0xa014('0x16')][_0xa014('0x17')]===0x1f4){logger[_0xa014('0x16')](_0xa014('0x11'),_0x158769,_0x49d52b['error']['message']);return _0x50ccf6(_0x49d52b[_0xa014('0x16')][_0xa014('0x18')]);}logger[_0xa014('0x16')](_0xa014('0x11'),_0x158769,_0x49d52b[_0xa014('0x16')]['message']);return _0x17e2f7(_0x49d52b[_0xa014('0x16')][_0xa014('0x18')]);}else{logger[_0xa014('0x10')](_0xa014('0x11'),_0x158769,'request\x20sent');_0x17e2f7(_0x49d52b[_0xa014('0x19')]['message']);}})[_0xa014('0x1a')](function(_0x47a467){logger[_0xa014('0x16')](_0xa014('0x11'),_0x158769,_0x47a467);_0x50ccf6(_0x47a467);});});}exports['UpdateWhatsappInteraction']=function(_0x33fe5b){var _0x21ec3f=this;return new Promise(function(_0x43944c,_0xdf55a){return db[_0xa014('0x1b')][_0xa014('0x1c')](_0x33fe5b[_0xa014('0x1d')],{'raw':_0x33fe5b[_0xa014('0x1e')]?_0x33fe5b[_0xa014('0x1e')][_0xa014('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x33fe5b[_0xa014('0x1e')]?_0x33fe5b['options'][_0xa014('0x20')]||null:null,'attributes':_0x33fe5b[_0xa014('0x1e')]?_0x33fe5b['options'][_0xa014('0x21')]||null:null,'limit':_0x33fe5b[_0xa014('0x1e')]?_0x33fe5b[_0xa014('0x1e')]['limit']||null:null})['then'](function(_0x37c004){logger['info'](_0xa014('0x22'),_0x33fe5b);logger['debug']('UpdateWhatsappInteraction',_0x33fe5b,JSON[_0xa014('0x15')](_0x37c004));_0x43944c(_0x37c004);})['catch'](function(_0x58648b){logger[_0xa014('0x16')](_0xa014('0x22'),_0x58648b[_0xa014('0x18')],_0x33fe5b);_0xdf55a(_0x21ec3f[_0xa014('0x16')](0x1f4,_0x58648b[_0xa014('0x18')]));});});};exports[_0xa014('0x23')]=function(_0x320a20){return new Promise(function(_0x4711dc,_0x19c814){return db['WhatsappInteraction'][_0xa014('0x24')]({'where':_0x320a20[_0xa014('0x1e')]?_0x320a20[_0xa014('0x1e')][_0xa014('0x20')]||null:null})[_0xa014('0xf')](function(_0x469f37){if(_0x469f37){return _0x469f37['addTags'](_0x320a20[_0xa014('0x1d')][_0xa014('0x25')],_[_0xa014('0x26')](_0x320a20[_0xa014('0x1d')],[_0xa014('0x25'),'id'])||{});}})[_0xa014('0x27')](function(_0x48c8e8){logger[_0xa014('0x10')](_0xa014('0x28'),_0x320a20);logger[_0xa014('0x13')]('AddTags',_0x320a20,JSON[_0xa014('0x15')](_0x48c8e8));_0x4711dc(_0x48c8e8);})[_0xa014('0x1a')](function(_0x5c44ef){logger[_0xa014('0x16')](_0xa014('0x28'),_0x5c44ef[_0xa014('0x18')],_0x320a20);_0x19c814(_this[_0xa014('0x16')](0x1f4,_0x5c44ef[_0xa014('0x18')]));});});}; \ No newline at end of file +var _0x5e55=['spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','defaults','redis','socket.io-emitter','register','request','then','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','WhatsappInteraction,\x20%s,\x20%s,\x20%s','error','message','catch','UpdateWhatsappInteraction','update','body','options','raw','limit','debug','stringify','WhatsappInteraction','find','where','addTags','ids'];(function(_0x300e64,_0x238f83){var _0x1da2ad=function(_0x25171b){while(--_0x25171b){_0x300e64['push'](_0x300e64['shift']());}};_0x1da2ad(++_0x238f83);}(_0x5e55,0x1e2));var _0x55e5=function(_0x2fef7c,_0x1e72c9){_0x2fef7c=_0x2fef7c-0x0;var _0x3a6212=_0x5e55[_0x2fef7c];return _0x3a6212;};'use strict';var _=require(_0x55e5('0x0'));var util=require(_0x55e5('0x1'));var moment=require(_0x55e5('0x2'));var BPromise=require(_0x55e5('0x3'));var rs=require(_0x55e5('0x4'));var fs=require('fs');var Redis=require(_0x55e5('0x5'));var db=require(_0x55e5('0x6'))['db'];var utils=require(_0x55e5('0x7'));var logger=require(_0x55e5('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0x55e5('0x9'));var client=jayson[_0x55e5('0xa')][_0x55e5('0xb')]({'port':0x232a});config['redis']=_[_0x55e5('0xc')](config[_0x55e5('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x55e5('0xe'))(new Redis(config[_0x55e5('0xd')]));require('./whatsappInteraction.socket')[_0x55e5('0xf')](socket);function respondWithRpcPromise(_0x1560b1,_0x1c62a3,_0x214405){return new BPromise(function(_0x32e67a,_0x4a7ad8){return client[_0x55e5('0x10')](_0x1560b1,_0x214405)[_0x55e5('0x11')](function(_0x34f9a2){logger[_0x55e5('0x12')](_0x55e5('0x13'),_0x1c62a3,_0x55e5('0x14'));logger['debug'](_0x55e5('0x15'),_0x1c62a3,_0x55e5('0x14'),JSON['stringify'](_0x34f9a2));if(_0x34f9a2['error']){if(_0x34f9a2[_0x55e5('0x16')]['code']===0x1f4){logger[_0x55e5('0x16')](_0x55e5('0x13'),_0x1c62a3,_0x34f9a2[_0x55e5('0x16')]['message']);return _0x4a7ad8(_0x34f9a2['error'][_0x55e5('0x17')]);}logger[_0x55e5('0x16')](_0x55e5('0x13'),_0x1c62a3,_0x34f9a2[_0x55e5('0x16')][_0x55e5('0x17')]);return _0x32e67a(_0x34f9a2[_0x55e5('0x16')]['message']);}else{logger[_0x55e5('0x12')]('WhatsappInteraction,\x20%s,\x20%s',_0x1c62a3,_0x55e5('0x14'));_0x32e67a(_0x34f9a2['result'][_0x55e5('0x17')]);}})[_0x55e5('0x18')](function(_0xff490c){logger[_0x55e5('0x16')](_0x55e5('0x13'),_0x1c62a3,_0xff490c);_0x4a7ad8(_0xff490c);});});}exports[_0x55e5('0x19')]=function(_0x306c6f){var _0x3f24bd=this;return new Promise(function(_0x11d4f3,_0x3dadb8){return db['WhatsappInteraction'][_0x55e5('0x1a')](_0x306c6f[_0x55e5('0x1b')],{'raw':_0x306c6f['options']?_0x306c6f[_0x55e5('0x1c')][_0x55e5('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x306c6f[_0x55e5('0x1c')]?_0x306c6f[_0x55e5('0x1c')]['where']||null:null,'attributes':_0x306c6f[_0x55e5('0x1c')]?_0x306c6f[_0x55e5('0x1c')]['attributes']||null:null,'limit':_0x306c6f[_0x55e5('0x1c')]?_0x306c6f[_0x55e5('0x1c')][_0x55e5('0x1e')]||null:null})[_0x55e5('0x11')](function(_0x286066){logger[_0x55e5('0x12')]('UpdateWhatsappInteraction',_0x306c6f);logger[_0x55e5('0x1f')](_0x55e5('0x19'),_0x306c6f,JSON[_0x55e5('0x20')](_0x286066));_0x11d4f3(_0x286066);})[_0x55e5('0x18')](function(_0x29a275){logger['error'](_0x55e5('0x19'),_0x29a275[_0x55e5('0x17')],_0x306c6f);_0x3dadb8(_0x3f24bd[_0x55e5('0x16')](0x1f4,_0x29a275[_0x55e5('0x17')]));});});};exports['AddTagsToWhatsappInteraction']=function(_0x1631f9){return new Promise(function(_0x105f45,_0x4aaa10){return db[_0x55e5('0x21')][_0x55e5('0x22')]({'where':_0x1631f9[_0x55e5('0x1c')]?_0x1631f9[_0x55e5('0x1c')][_0x55e5('0x23')]||null:null})[_0x55e5('0x11')](function(_0x573521){if(_0x573521){return _0x573521[_0x55e5('0x24')](_0x1631f9[_0x55e5('0x1b')][_0x55e5('0x25')],_['omit'](_0x1631f9[_0x55e5('0x1b')],[_0x55e5('0x25'),'id'])||{});}})[_0x55e5('0x26')](function(_0x8cf43d){logger[_0x55e5('0x12')](_0x55e5('0x27'),_0x1631f9);logger[_0x55e5('0x1f')](_0x55e5('0x27'),_0x1631f9,JSON['stringify'](_0x8cf43d));_0x105f45(_0x8cf43d);})[_0x55e5('0x18')](function(_0xf56743){logger['error'](_0x55e5('0x27'),_0xf56743[_0x55e5('0x17')],_0x1631f9);_0x4aaa10(_this[_0x55e5('0x16')](0x1f4,_0xf56743[_0x55e5('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index 70a6ebd..3c84ddf 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 _0xc4a4=['remove','register','length','./whatsappInteraction.events'];(function(_0x44795a,_0x4d5807){var _0x1dbca9=function(_0x2ed1ed){while(--_0x2ed1ed){_0x44795a['push'](_0x44795a['shift']());}};_0x1dbca9(++_0x4d5807);}(_0xc4a4,0x1d3));var _0x4c4a=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xc4a4[_0x2b10c6];return _0x3789d2;};'use strict';var WhatsappInteractionEvents=require(_0x4c4a('0x0'));var events=['save',_0x4c4a('0x1'),'update'];function createListener(_0x8caf24,_0x5391f5){return function(_0x9971f5){_0x5391f5['emit'](_0x8caf24,_0x9971f5);};}function removeListener(_0x7e379f,_0x39a8f1){return function(){WhatsappInteractionEvents['removeListener'](_0x7e379f,_0x39a8f1);};}exports[_0x4c4a('0x2')]=function(_0x36dc80){for(var _0x4b675e=0x0,_0x34996b=events[_0x4c4a('0x3')];_0x4b675e<_0x34996b;_0x4b675e++){var _0x455fe4=events[_0x4b675e];var _0x1ca5e0=createListener('whatsappInteraction:'+_0x455fe4,_0x36dc80);WhatsappInteractionEvents['on'](_0x455fe4,_0x1ca5e0);}}; \ No newline at end of file +var _0xdc0d=['register','length','whatsappInteraction:','save','update','emit','removeListener'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdc0d,0x18b));var _0xddc0=function(_0x5468ab,_0x553411){_0x5468ab=_0x5468ab-0x0;var _0x1d142e=_0xdc0d[_0x5468ab];return _0x1d142e;};'use strict';var WhatsappInteractionEvents=require('./whatsappInteraction.events');var events=[_0xddc0('0x0'),'remove',_0xddc0('0x1')];function createListener(_0x490857,_0x1e66ab){return function(_0x148c80){_0x1e66ab[_0xddc0('0x2')](_0x490857,_0x148c80);};}function removeListener(_0x39609f,_0x2fcba6){return function(){WhatsappInteractionEvents[_0xddc0('0x3')](_0x39609f,_0x2fcba6);};}exports[_0xddc0('0x4')]=function(_0x19987e){for(var _0x37b1ff=0x0,_0x45c4d6=events[_0xddc0('0x5')];_0x37b1ff<_0x45c4d6;_0x37b1ff++){var _0x3085dd=events[_0x37b1ff];var _0x49f029=createListener(_0xddc0('0x6')+_0x3085dd,_0x19987e);WhatsappInteractionEvents['on'](_0x3085dd,_0x49f029);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index ff2eab2..9d4090b 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 _0x796f=['status','put','update','/:id/accept','/:id/reject','reject','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','isAuthenticated','index','get','/:id','show','post','tracked','whatsappmessage:create','create','/:id/status'];(function(_0x5fdc66,_0x373a04){var _0x555761=function(_0x36c67e){while(--_0x36c67e){_0x5fdc66['push'](_0x5fdc66['shift']());}};_0x555761(++_0x373a04);}(_0x796f,0x159));var _0xf796=function(_0x1bda29,_0x4d300f){_0x1bda29=_0x1bda29-0x0;var _0x706cc1=_0x796f[_0x1bda29];return _0x706cc1;};'use strict';var multer=require(_0xf796('0x0'));var util=require('util');var path=require(_0xf796('0x1'));var timeout=require(_0xf796('0x2'));var express=require(_0xf796('0x3'));var router=express[_0xf796('0x4')]();var fs_extra=require(_0xf796('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xf796('0x6'));var config=require(_0xf796('0x7'));var controller=require(_0xf796('0x8'));router['get']('/',auth[_0xf796('0x9')](),controller[_0xf796('0xa')]);router[_0xf796('0xb')]('/describe',auth[_0xf796('0x9')](),controller['describe']);router[_0xf796('0xb')](_0xf796('0xc'),auth[_0xf796('0x9')](),controller[_0xf796('0xd')]);router[_0xf796('0xe')]('/',auth[_0xf796('0x9')](),interaction[_0xf796('0xf')]('whatsapp',_0xf796('0x10')),controller[_0xf796('0x11')]);router[_0xf796('0xe')](_0xf796('0x12'),controller[_0xf796('0x13')]);router[_0xf796('0x14')]('/:id',auth[_0xf796('0x9')](),controller[_0xf796('0x15')]);router['put'](_0xf796('0x16'),auth[_0xf796('0x9')](),controller['accept']);router[_0xf796('0x14')](_0xf796('0x17'),auth['isAuthenticated'](),controller[_0xf796('0x18')]);router[_0xf796('0x19')](_0xf796('0xc'),auth[_0xf796('0x9')](),controller[_0xf796('0x1a')]);module[_0xf796('0x1b')]=router; \ No newline at end of file +var _0xb5f9=['./whatsappMessage.controller','get','isAuthenticated','index','describe','/:id','show','post','tracked','whatsapp','whatsappmessage:create','/:id/status','status','put','update','accept','/:id/reject','reject','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x1b658c,_0x3fa99f){var _0x5f2e32=function(_0x4140ed){while(--_0x4140ed){_0x1b658c['push'](_0x1b658c['shift']());}};_0x5f2e32(++_0x3fa99f);}(_0xb5f9,0x1d4));var _0x9b5f=function(_0x4506ec,_0x44543d){_0x4506ec=_0x4506ec-0x0;var _0x5edc22=_0xb5f9[_0x4506ec];return _0x5edc22;};'use strict';var multer=require(_0x9b5f('0x0'));var util=require(_0x9b5f('0x1'));var path=require(_0x9b5f('0x2'));var timeout=require(_0x9b5f('0x3'));var express=require(_0x9b5f('0x4'));var router=express[_0x9b5f('0x5')]();var fs_extra=require(_0x9b5f('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x9b5f('0x7'));var config=require('../../config/environment');var controller=require(_0x9b5f('0x8'));router[_0x9b5f('0x9')]('/',auth[_0x9b5f('0xa')](),controller[_0x9b5f('0xb')]);router[_0x9b5f('0x9')]('/describe',auth[_0x9b5f('0xa')](),controller[_0x9b5f('0xc')]);router[_0x9b5f('0x9')](_0x9b5f('0xd'),auth[_0x9b5f('0xa')](),controller[_0x9b5f('0xe')]);router[_0x9b5f('0xf')]('/',auth[_0x9b5f('0xa')](),interaction[_0x9b5f('0x10')](_0x9b5f('0x11'),_0x9b5f('0x12')),controller['create']);router[_0x9b5f('0xf')](_0x9b5f('0x13'),controller[_0x9b5f('0x14')]);router[_0x9b5f('0x15')]('/:id',auth[_0x9b5f('0xa')](),controller[_0x9b5f('0x16')]);router['put']('/:id/accept',auth['isAuthenticated'](),controller[_0x9b5f('0x17')]);router[_0x9b5f('0x15')](_0x9b5f('0x18'),auth[_0x9b5f('0xa')](),controller[_0x9b5f('0x19')]);router[_0x9b5f('0x1a')](_0x9b5f('0xd'),auth[_0x9b5f('0xa')](),controller['destroy']);module[_0x9b5f('0x1b')]=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index 547767e..20e021b 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 _0xff00=['exports','TEXT','medium','ENUM','out','STRING','DATE','BOOLEAN','sequelize'];(function(_0x31611f,_0x1e6d20){var _0x3185e6=function(_0x4d8ec1){while(--_0x4d8ec1){_0x31611f['push'](_0x31611f['shift']());}};_0x3185e6(++_0x1e6d20);}(_0xff00,0x1a6));var _0x0ff0=function(_0x48b6a3,_0x330c82){_0x48b6a3=_0x48b6a3-0x0;var _0x2520ce=_0xff00[_0x48b6a3];return _0x2520ce;};'use strict';var Sequelize=require(_0x0ff0('0x0'));module[_0x0ff0('0x1')]={'body':{'type':Sequelize[_0x0ff0('0x2')](_0x0ff0('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x0ff0('0x4')]('in',_0x0ff0('0x5')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0x0ff0('0x6')](0xbe)},'phone':{'type':Sequelize[_0x0ff0('0x6')]},'readAt':{'type':Sequelize[_0x0ff0('0x7')]},'secret':{'type':Sequelize[_0x0ff0('0x8')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x0ff0('0x6')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0xdb4a=['STRING','DATE','sequelize','exports','TEXT','medium','BOOLEAN','out'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xdb4a,0x1ba));var _0xadb4=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xdb4a[_0x4a9fb1];return _0x348672;};'use strict';var Sequelize=require(_0xadb4('0x0'));module[_0xadb4('0x1')]={'body':{'type':Sequelize[_0xadb4('0x2')](_0xadb4('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xadb4('0x4')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xadb4('0x5')),'defaultValue':_0xadb4('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0xadb4('0x6')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0xadb4('0x7')]},'secret':{'type':Sequelize[_0xadb4('0x4')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xadb4('0x6')]},'providerResponse':{'type':Sequelize[_0xadb4('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index 8ce7a93..65cd2e9 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 _0x88a5=['squel','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./whatsappMessage.socket','register','jayson/promise','http','client','request','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','sendStatus','status','end','json','offset','count','limit','set','Content-Range','apply','reject','update','then','stack','name','map','WhatsappMessage','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','options','includeAll','findAll','rows','show','params','keys','rawAttributes','merge','find','create','body','destroy','describe','whatsapp-interactions','accept','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','WhatsappInteractionId','isNil','read1stAt','interaction','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','CmContact','startsWith','cf_','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','contact','manual','interface','SIP/%s','channel','event','EventManager','whatsapp','agent','get','WhatsappInteraction','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','push','SELECT','rejectmessage','WhatsappAccount','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','twilio','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','inspect','rimraf','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash'];(function(_0x42fe9c,_0x8ea8df){var _0xe8737f=function(_0x14c22c){while(--_0x14c22c){_0x42fe9c['push'](_0x42fe9c['shift']());}};_0xe8737f(++_0x8ea8df);}(_0x88a5,0x80));var _0x588a=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0x88a5[_0x2a6809];return _0x11c371;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x588a('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x588a('0x1'));var moment=require(_0x588a('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x588a('0x3'));var util=require(_0x588a('0x4'));var path=require(_0x588a('0x5'));var sox=require(_0x588a('0x6'));var csv=require(_0x588a('0x7'));var ejs=require(_0x588a('0x8'));var fs=require('fs');var fs_extra=require(_0x588a('0x9'));var _=require(_0x588a('0xa'));var squel=require(_0x588a('0xb'));var crypto=require(_0x588a('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x588a('0xd'));var Papa=require('papaparse');var Redis=require(_0x588a('0xe'));var authService=require(_0x588a('0xf'));var qs=require(_0x588a('0x10'));var as=require(_0x588a('0x11'));var hardwareService=require(_0x588a('0x12'));var logger=require(_0x588a('0x13'))('api');var utils=require(_0x588a('0x14'));var config=require(_0x588a('0x15'));var licenseUtil=require(_0x588a('0x16'));var db=require(_0x588a('0x17'))['db'];config[_0x588a('0x18')]=_[_0x588a('0x19')](config[_0x588a('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x588a('0x1a'))(new Redis(config[_0x588a('0x18')]));require(_0x588a('0x1b'))[_0x588a('0x1c')](socket);var jayson=require(_0x588a('0x1d'));var client=jayson['client'][_0x588a('0x1e')]({'port':0x232c});var client9002=jayson[_0x588a('0x1f')][_0x588a('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x28613f,_0x5a3586,_0x3e702f,_0x9cfe4a){return new BPromise(function(_0x4bc466,_0x26d67d){var _0x239085=_0x9cfe4a||client;return _0x239085[_0x588a('0x20')](_0x28613f,_0x3e702f)['then'](function(_0x3497b7){logger['info'](_0x588a('0x21'),_0x5a3586,_0x588a('0x22'));logger[_0x588a('0x23')](_0x588a('0x24'),_0x5a3586,_0x588a('0x22'),JSON['stringify'](_0x3497b7));if(_0x3497b7[_0x588a('0x25')]){if(_0x3497b7['error'][_0x588a('0x26')]===0x1f4){logger[_0x588a('0x25')](_0x588a('0x21'),_0x5a3586,_0x3497b7[_0x588a('0x25')][_0x588a('0x27')]);return _0x26d67d(_0x3497b7[_0x588a('0x25')][_0x588a('0x27')]);}logger[_0x588a('0x25')](_0x588a('0x21'),_0x5a3586,_0x3497b7['error'][_0x588a('0x27')]);return _0x4bc466(_0x3497b7[_0x588a('0x25')][_0x588a('0x27')]);}else{logger[_0x588a('0x28')](_0x588a('0x21'),_0x5a3586,'request\x20sent');_0x4bc466(_0x3497b7[_0x588a('0x29')][_0x588a('0x27')]);}})[_0x588a('0x2a')](function(_0x356610){logger[_0x588a('0x25')]('WhatsappMessage,\x20%s,\x20%s',_0x5a3586,_0x356610);_0x26d67d(_0x356610);});});}function respondWithStatusCode(_0x33685d,_0x314bef){_0x314bef=_0x314bef||0xcc;return function(_0x36da36){if(_0x36da36){return _0x33685d[_0x588a('0x2b')](_0x314bef);}return _0x33685d[_0x588a('0x2c')](_0x314bef)[_0x588a('0x2d')]();};}function respondWithResult(_0x107f5a,_0xe7ac60){_0xe7ac60=_0xe7ac60||0xc8;return function(_0x2751a7){if(_0x2751a7){return _0x107f5a[_0x588a('0x2c')](_0xe7ac60)[_0x588a('0x2e')](_0x2751a7);}};}function respondWithFilteredResult(_0x1c4de2,_0x2c452b){return function(_0x17f9ca){if(_0x17f9ca){var _0x182302=typeof _0x2c452b[_0x588a('0x2f')]==='undefined'&&typeof _0x2c452b['limit']==='undefined';var _0x62b8c6=_0x17f9ca[_0x588a('0x30')];var _0x222201=_0x182302?0x0:_0x2c452b[_0x588a('0x2f')];var _0x289d25=_0x182302?_0x17f9ca[_0x588a('0x30')]:_0x2c452b[_0x588a('0x2f')]+_0x2c452b[_0x588a('0x31')];var _0x425956;if(_0x289d25>=_0x62b8c6){_0x289d25=_0x62b8c6;_0x425956=0xc8;}else{_0x425956=0xce;}_0x1c4de2[_0x588a('0x2c')](_0x425956);return _0x1c4de2[_0x588a('0x32')](_0x588a('0x33'),_0x222201+'-'+_0x289d25+'/'+_0x62b8c6)[_0x588a('0x2e')](_0x17f9ca);}return null;};}function patchUpdates(_0x24143f){return function(_0xeef35c){try{jsonpatch[_0x588a('0x34')](_0xeef35c,_0x24143f,!![]);}catch(_0x537c0e){return BPromise[_0x588a('0x35')](_0x537c0e);}return _0xeef35c['save']();};}function saveUpdates(_0x40b9c4,_0xaea8ad){return function(_0x58a783){if(_0x58a783){return _0x58a783[_0x588a('0x36')](_0x40b9c4)[_0x588a('0x37')](function(_0x61cb1c){return _0x61cb1c;});}return null;};}function removeEntity(_0x56843b,_0x582cad){return function(_0x2a80a1){if(_0x2a80a1){return _0x2a80a1['destroy']()[_0x588a('0x37')](function(){_0x56843b[_0x588a('0x2c')](0xcc)[_0x588a('0x2d')]();});}};}function handleEntityNotFound(_0x27d0a0,_0x2d6259){return function(_0x433c70){if(!_0x433c70){_0x27d0a0[_0x588a('0x2b')](0x194);}return _0x433c70;};}function handleError(_0x5f41dc,_0x4fcd2e){_0x4fcd2e=_0x4fcd2e||0x1f4;return function(_0x1d5844){logger[_0x588a('0x25')](_0x1d5844[_0x588a('0x38')]);if(_0x1d5844[_0x588a('0x39')]){delete _0x1d5844[_0x588a('0x39')];}_0x5f41dc['status'](_0x4fcd2e)['send'](_0x1d5844);};}exports['index']=function(_0x4f56d3,_0x155340){var _0x254e26={},_0x4cbc43={},_0x1d73a4={'count':0x0,'rows':[]};var _0x586c3c=_[_0x588a('0x3a')](db[_0x588a('0x3b')]['rawAttributes'],function(_0x5a715c){return{'name':_0x5a715c[_0x588a('0x3c')],'type':_0x5a715c[_0x588a('0x3d')][_0x588a('0x3e')]};});_0x4cbc43['model']=_[_0x588a('0x3a')](_0x586c3c,'name');_0x4cbc43[_0x588a('0x3f')]=_['keys'](_0x4f56d3[_0x588a('0x3f')]);_0x4cbc43[_0x588a('0x40')]=_[_0x588a('0x41')](_0x4cbc43[_0x588a('0x42')],_0x4cbc43[_0x588a('0x3f')]);_0x254e26[_0x588a('0x43')]=_[_0x588a('0x41')](_0x4cbc43['model'],qs[_0x588a('0x44')](_0x4f56d3[_0x588a('0x3f')][_0x588a('0x44')]));_0x254e26[_0x588a('0x43')]=_0x254e26[_0x588a('0x43')][_0x588a('0x45')]?_0x254e26[_0x588a('0x43')]:_0x4cbc43[_0x588a('0x42')];if(!_0x4f56d3[_0x588a('0x3f')][_0x588a('0x46')](_0x588a('0x47'))){_0x254e26[_0x588a('0x31')]=qs['limit'](_0x4f56d3[_0x588a('0x3f')][_0x588a('0x31')]);_0x254e26['offset']=qs[_0x588a('0x2f')](_0x4f56d3[_0x588a('0x3f')][_0x588a('0x2f')]);}_0x254e26['order']=qs[_0x588a('0x48')](_0x4f56d3[_0x588a('0x3f')][_0x588a('0x48')]);_0x254e26[_0x588a('0x49')]=qs[_0x588a('0x40')](_['pick'](_0x4f56d3['query'],_0x4cbc43[_0x588a('0x40')]),_0x586c3c);if(_0x4f56d3[_0x588a('0x3f')][_0x588a('0x4a')]){_0x254e26[_0x588a('0x49')]=_['merge'](_0x254e26['where'],{'$or':_['map'](_0x586c3c,function(_0x711a9){if(_0x711a9['type']!=='VIRTUAL'){var _0x24f72e={};_0x24f72e[_0x711a9[_0x588a('0x39')]]={'$like':'%'+_0x4f56d3[_0x588a('0x3f')][_0x588a('0x4a')]+'%'};return _0x24f72e;}})});}_0x254e26=_['merge']({},_0x254e26,_0x4f56d3[_0x588a('0x4b')]);var _0x385823={'where':_0x254e26[_0x588a('0x49')]};return db[_0x588a('0x3b')][_0x588a('0x30')](_0x385823)[_0x588a('0x37')](function(_0x18a273){_0x1d73a4[_0x588a('0x30')]=_0x18a273;if(_0x4f56d3['query'][_0x588a('0x4c')]){_0x254e26['include']=[{'all':!![]}];}return db['WhatsappMessage'][_0x588a('0x4d')](_0x254e26);})[_0x588a('0x37')](function(_0x46ad7e){_0x1d73a4[_0x588a('0x4e')]=_0x46ad7e;return _0x1d73a4;})['then'](respondWithFilteredResult(_0x155340,_0x254e26))[_0x588a('0x2a')](handleError(_0x155340,null));};exports[_0x588a('0x4f')]=function(_0x12f19f,_0x475d8d){var _0x1ee2b8={'raw':!![],'where':{'id':_0x12f19f[_0x588a('0x50')]['id']}},_0x26c353={};_0x26c353['model']=_[_0x588a('0x51')](db['WhatsappMessage'][_0x588a('0x52')]);_0x26c353[_0x588a('0x3f')]=_[_0x588a('0x51')](_0x12f19f[_0x588a('0x3f')]);_0x26c353[_0x588a('0x40')]=_[_0x588a('0x41')](_0x26c353['model'],_0x26c353[_0x588a('0x3f')]);_0x1ee2b8['attributes']=_['intersection'](_0x26c353[_0x588a('0x42')],qs[_0x588a('0x44')](_0x12f19f[_0x588a('0x3f')][_0x588a('0x44')]));_0x1ee2b8[_0x588a('0x43')]=_0x1ee2b8[_0x588a('0x43')]['length']?_0x1ee2b8['attributes']:_0x26c353[_0x588a('0x42')];if(_0x12f19f[_0x588a('0x3f')]['includeAll']){_0x1ee2b8['include']=[{'all':!![]}];}_0x1ee2b8=_[_0x588a('0x53')]({},_0x1ee2b8,_0x12f19f[_0x588a('0x4b')]);return db[_0x588a('0x3b')][_0x588a('0x54')](_0x1ee2b8)[_0x588a('0x37')](handleEntityNotFound(_0x475d8d,null))[_0x588a('0x37')](respondWithResult(_0x475d8d,null))['catch'](handleError(_0x475d8d,null));};exports[_0x588a('0x55')]=function(_0x4396e9,_0x49bc9a){return db[_0x588a('0x3b')]['create'](_0x4396e9['body'],{})[_0x588a('0x37')](respondWithResult(_0x49bc9a,0xc9))['catch'](handleError(_0x49bc9a,null));};exports['update']=function(_0x5a3e98,_0x52a07e){if(_0x5a3e98[_0x588a('0x56')]['id']){delete _0x5a3e98[_0x588a('0x56')]['id'];}return db[_0x588a('0x3b')][_0x588a('0x54')]({'where':{'id':_0x5a3e98[_0x588a('0x50')]['id']}})['then'](handleEntityNotFound(_0x52a07e,null))['then'](saveUpdates(_0x5a3e98[_0x588a('0x56')],null))['then'](respondWithResult(_0x52a07e,null))[_0x588a('0x2a')](handleError(_0x52a07e,null));};exports[_0x588a('0x57')]=function(_0x402d30,_0x584abd){return db[_0x588a('0x3b')][_0x588a('0x54')]({'where':{'id':_0x402d30[_0x588a('0x50')]['id']}})['then'](handleEntityNotFound(_0x584abd,null))[_0x588a('0x37')](removeEntity(_0x584abd,null))[_0x588a('0x2a')](handleError(_0x584abd,null));};exports[_0x588a('0x58')]=function(_0x237b8f,_0x29aa65){return db['WhatsappMessage']['describe']()[_0x588a('0x37')](respondWithResult(_0x29aa65,null))[_0x588a('0x2a')](handleError(_0x29aa65,null));};var interaction_log=require(_0x588a('0x13'))(_0x588a('0x59'));exports[_0x588a('0x5a')]=function(_0x39035e,_0xdc2c59,_0x19d812){var _0x5838b9={'agent':{},'channel':'whatsapp'};if(_0x39035e[_0x588a('0x56')]['id']){delete _0x39035e['body']['id'];}_0x39035e[_0x588a('0x56')][_0x588a('0x5b')]=!![];_0x39035e[_0x588a('0x56')][_0x588a('0x5c')]=moment()[_0x588a('0x5d')](_0x588a('0x5e'));_0x39035e[_0x588a('0x56')][_0x588a('0x5f')]=_0x39035e[_0x588a('0x56')][_0x588a('0x5f')]||_0x39035e[_0x588a('0x60')]['id'];_0x5838b9['agent']['id']=_0x39035e[_0x588a('0x56')]['UserId'];return db[_0x588a('0x3b')][_0x588a('0x54')]({'where':{'id':_0x39035e[_0x588a('0x50')]['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':'Contact'}]})[_0x588a('0x37')](handleEntityNotFound(_0xdc2c59,null))[_0x588a('0x37')](saveUpdates(_0x39035e[_0x588a('0x56')],null))[_0x588a('0x37')](function(_0x3d0aac){if(_0x3d0aac){_0x5838b9[_0x588a('0x27')]=_0x3d0aac['get']({'plain':!![]});return db['WhatsappInteraction']['find']({'where':{'id':_0x3d0aac[_0x588a('0x61')]}});}return null;})[_0x588a('0x37')](handleEntityNotFound(_0xdc2c59,null))[_0x588a('0x37')](function(_0x590e33){if(_0x590e33){return _0x590e33[_0x588a('0x36')]({'UserId':_0x39035e[_0x588a('0x56')][_0x588a('0x5f')],'read1stAt':_[_0x588a('0x62')](_0x590e33[_0x588a('0x63')])?moment()[_0x588a('0x5d')](_0x588a('0x5e')):undefined});}return null;})[_0x588a('0x37')](function(_0x28c04a){if(_0x28c04a){_0x5838b9[_0x588a('0x64')]=_0x28c04a['get']({'plain':!![]});interaction_log[_0x588a('0x28')](_0x588a('0x65'),_0x39035e[_0x588a('0x60')]['id'],_0x39035e[_0x588a('0x60')][_0x588a('0x39')],_0x39035e['user'][_0x588a('0x66')],_0x5838b9['interaction']['id'],_0x39035e[_0x588a('0x56')]?JSON['stringify'](_0x39035e[_0x588a('0x56')]):_0x588a('0x67'));return respondWithRpcPromise(_0x588a('0x68'),'acceptMessage',_0x5838b9);}return null;})['then'](function(_0x466713){return db[_0x588a('0x69')][_0x588a('0x58')]()['then'](function(_0xd71e84){var _0x48c197=[];for(var _0x48ff6a=0x0;_0x48ff6a=_0x56d78f){_0x5a54c5=_0x56d78f;_0x52f79c=0xc8;}else{_0x52f79c=0xce;}_0x577f46[_0x4c7a('0x2c')](_0x52f79c);return _0x577f46[_0x4c7a('0x32')](_0x4c7a('0x33'),_0x2a96d6+'-'+_0x5a54c5+'/'+_0x56d78f)[_0x4c7a('0x2d')](_0x5f2cf8);}return null;};}function patchUpdates(_0x35fdc0){return function(_0x1f35d8){try{jsonpatch['apply'](_0x1f35d8,_0x35fdc0,!![]);}catch(_0x79777f){return BPromise[_0x4c7a('0x34')](_0x79777f);}return _0x1f35d8[_0x4c7a('0x35')]();};}function saveUpdates(_0x4f9c56,_0x5e6a25){return function(_0x787d75){if(_0x787d75){return _0x787d75[_0x4c7a('0x36')](_0x4f9c56)[_0x4c7a('0x37')](function(_0x3ba232){return _0x3ba232;});}return null;};}function removeEntity(_0x15569d,_0x2e6517){return function(_0x1e6cdd){if(_0x1e6cdd){return _0x1e6cdd[_0x4c7a('0x38')]()[_0x4c7a('0x37')](function(){_0x15569d[_0x4c7a('0x2c')](0xcc)[_0x4c7a('0x39')]();});}};}function handleEntityNotFound(_0x3d00b6,_0xf6c329){return function(_0x3f1661){if(!_0x3f1661){_0x3d00b6[_0x4c7a('0x3a')](0x194);}return _0x3f1661;};}function handleError(_0xc2990d,_0x443d42){_0x443d42=_0x443d42||0x1f4;return function(_0x5cbac5){logger[_0x4c7a('0x26')](_0x5cbac5[_0x4c7a('0x3b')]);if(_0x5cbac5['name']){delete _0x5cbac5['name'];}_0xc2990d[_0x4c7a('0x2c')](_0x443d42)[_0x4c7a('0x3c')](_0x5cbac5);};}exports[_0x4c7a('0x3d')]=function(_0x5de028,_0x2edf91){var _0x530231={},_0x26155b={},_0x5bc094={'count':0x0,'rows':[]};var _0x1b9906=_[_0x4c7a('0x3e')](db[_0x4c7a('0x3f')][_0x4c7a('0x40')],function(_0x29a399){return{'name':_0x29a399[_0x4c7a('0x41')],'type':_0x29a399[_0x4c7a('0x42')]['key']};});_0x26155b['model']=_[_0x4c7a('0x3e')](_0x1b9906,_0x4c7a('0x43'));_0x26155b[_0x4c7a('0x44')]=_[_0x4c7a('0x45')](_0x5de028['query']);_0x26155b[_0x4c7a('0x46')]=_[_0x4c7a('0x47')](_0x26155b['model'],_0x26155b[_0x4c7a('0x44')]);_0x530231[_0x4c7a('0x48')]=_[_0x4c7a('0x47')](_0x26155b[_0x4c7a('0x49')],qs[_0x4c7a('0x4a')](_0x5de028[_0x4c7a('0x44')][_0x4c7a('0x4a')]));_0x530231['attributes']=_0x530231['attributes']['length']?_0x530231[_0x4c7a('0x48')]:_0x26155b['model'];if(!_0x5de028[_0x4c7a('0x44')][_0x4c7a('0x4b')](_0x4c7a('0x4c'))){_0x530231[_0x4c7a('0x2f')]=qs[_0x4c7a('0x2f')](_0x5de028[_0x4c7a('0x44')][_0x4c7a('0x2f')]);_0x530231[_0x4c7a('0x31')]=qs['offset'](_0x5de028[_0x4c7a('0x44')]['offset']);}_0x530231[_0x4c7a('0x4d')]=qs[_0x4c7a('0x4e')](_0x5de028[_0x4c7a('0x44')][_0x4c7a('0x4e')]);_0x530231['where']=qs[_0x4c7a('0x46')](_[_0x4c7a('0x4f')](_0x5de028[_0x4c7a('0x44')],_0x26155b[_0x4c7a('0x46')]),_0x1b9906);if(_0x5de028[_0x4c7a('0x44')]['filter']){_0x530231[_0x4c7a('0x50')]=_[_0x4c7a('0x51')](_0x530231[_0x4c7a('0x50')],{'$or':_[_0x4c7a('0x3e')](_0x1b9906,function(_0x328bae){if(_0x328bae['type']!=='VIRTUAL'){var _0x3e1d89={};_0x3e1d89[_0x328bae[_0x4c7a('0x43')]]={'$like':'%'+_0x5de028['query'][_0x4c7a('0x52')]+'%'};return _0x3e1d89;}})});}_0x530231=_[_0x4c7a('0x51')]({},_0x530231,_0x5de028[_0x4c7a('0x53')]);var _0x1095ab={'where':_0x530231['where']};return db[_0x4c7a('0x3f')]['count'](_0x1095ab)[_0x4c7a('0x37')](function(_0x5eb22a){_0x5bc094['count']=_0x5eb22a;if(_0x5de028[_0x4c7a('0x44')][_0x4c7a('0x54')]){_0x530231[_0x4c7a('0x55')]=[{'all':!![]}];}return db[_0x4c7a('0x3f')][_0x4c7a('0x56')](_0x530231);})[_0x4c7a('0x37')](function(_0x4f2676){_0x5bc094[_0x4c7a('0x57')]=_0x4f2676;return _0x5bc094;})[_0x4c7a('0x37')](respondWithFilteredResult(_0x2edf91,_0x530231))['catch'](handleError(_0x2edf91,null));};exports[_0x4c7a('0x58')]=function(_0x16ef2d,_0x382355){var _0x50f20b={'raw':!![],'where':{'id':_0x16ef2d['params']['id']}},_0x44230c={};_0x44230c[_0x4c7a('0x49')]=_[_0x4c7a('0x45')](db[_0x4c7a('0x3f')][_0x4c7a('0x40')]);_0x44230c[_0x4c7a('0x44')]=_[_0x4c7a('0x45')](_0x16ef2d[_0x4c7a('0x44')]);_0x44230c[_0x4c7a('0x46')]=_[_0x4c7a('0x47')](_0x44230c[_0x4c7a('0x49')],_0x44230c[_0x4c7a('0x44')]);_0x50f20b[_0x4c7a('0x48')]=_[_0x4c7a('0x47')](_0x44230c['model'],qs[_0x4c7a('0x4a')](_0x16ef2d[_0x4c7a('0x44')][_0x4c7a('0x4a')]));_0x50f20b['attributes']=_0x50f20b[_0x4c7a('0x48')][_0x4c7a('0x59')]?_0x50f20b['attributes']:_0x44230c[_0x4c7a('0x49')];if(_0x16ef2d['query']['includeAll']){_0x50f20b[_0x4c7a('0x55')]=[{'all':!![]}];}_0x50f20b=_[_0x4c7a('0x51')]({},_0x50f20b,_0x16ef2d['options']);return db[_0x4c7a('0x3f')]['find'](_0x50f20b)[_0x4c7a('0x37')](handleEntityNotFound(_0x382355,null))[_0x4c7a('0x37')](respondWithResult(_0x382355,null))[_0x4c7a('0x2b')](handleError(_0x382355,null));};exports['create']=function(_0x425d58,_0x4dbd85){return db[_0x4c7a('0x3f')][_0x4c7a('0x5a')](_0x425d58['body'],{})[_0x4c7a('0x37')](respondWithResult(_0x4dbd85,0xc9))[_0x4c7a('0x2b')](handleError(_0x4dbd85,null));};exports[_0x4c7a('0x36')]=function(_0x32b18a,_0x5b267c){if(_0x32b18a['body']['id']){delete _0x32b18a[_0x4c7a('0x5b')]['id'];}return db[_0x4c7a('0x3f')][_0x4c7a('0x5c')]({'where':{'id':_0x32b18a[_0x4c7a('0x5d')]['id']}})[_0x4c7a('0x37')](handleEntityNotFound(_0x5b267c,null))[_0x4c7a('0x37')](saveUpdates(_0x32b18a['body'],null))[_0x4c7a('0x37')](respondWithResult(_0x5b267c,null))[_0x4c7a('0x2b')](handleError(_0x5b267c,null));};exports[_0x4c7a('0x38')]=function(_0x530aab,_0x447205){return db[_0x4c7a('0x3f')][_0x4c7a('0x5c')]({'where':{'id':_0x530aab[_0x4c7a('0x5d')]['id']}})[_0x4c7a('0x37')](handleEntityNotFound(_0x447205,null))[_0x4c7a('0x37')](removeEntity(_0x447205,null))[_0x4c7a('0x2b')](handleError(_0x447205,null));};exports[_0x4c7a('0x5e')]=function(_0x2ba5d4,_0x3ae44d){return db[_0x4c7a('0x3f')][_0x4c7a('0x5e')]()[_0x4c7a('0x37')](respondWithResult(_0x3ae44d,null))[_0x4c7a('0x2b')](handleError(_0x3ae44d,null));};var interaction_log=require('../../config/logger')(_0x4c7a('0x5f'));exports[_0x4c7a('0x60')]=function(_0x31f680,_0xd2ab54,_0x2dd878){var _0x4d7d5a={'agent':{},'channel':_0x4c7a('0x61')};if(_0x31f680['body']['id']){delete _0x31f680['body']['id'];}_0x31f680[_0x4c7a('0x5b')][_0x4c7a('0x62')]=!![];_0x31f680['body'][_0x4c7a('0x63')]=moment()[_0x4c7a('0x64')]('YYYY-MM-DD\x20HH:mm:ss');_0x31f680[_0x4c7a('0x5b')]['UserId']=_0x31f680[_0x4c7a('0x5b')][_0x4c7a('0x65')]||_0x31f680[_0x4c7a('0x66')]['id'];_0x4d7d5a[_0x4c7a('0x67')]['id']=_0x31f680[_0x4c7a('0x5b')][_0x4c7a('0x65')];return db[_0x4c7a('0x3f')]['find']({'where':{'id':_0x31f680[_0x4c7a('0x5d')]['id'],'UserId':null},'include':[{'model':db[_0x4c7a('0x68')],'as':_0x4c7a('0x69')}]})['then'](handleEntityNotFound(_0xd2ab54,null))[_0x4c7a('0x37')](saveUpdates(_0x31f680['body'],null))[_0x4c7a('0x37')](function(_0x4be8d6){if(_0x4be8d6){_0x4d7d5a[_0x4c7a('0x29')]=_0x4be8d6[_0x4c7a('0x6a')]({'plain':!![]});return db['WhatsappInteraction'][_0x4c7a('0x5c')]({'where':{'id':_0x4be8d6[_0x4c7a('0x6b')]}});}return null;})['then'](handleEntityNotFound(_0xd2ab54,null))['then'](function(_0x2cfe6b){if(_0x2cfe6b){return _0x2cfe6b[_0x4c7a('0x36')]({'UserId':_0x31f680[_0x4c7a('0x5b')][_0x4c7a('0x65')],'read1stAt':_[_0x4c7a('0x6c')](_0x2cfe6b[_0x4c7a('0x6d')])?moment()[_0x4c7a('0x64')](_0x4c7a('0x6e')):undefined});}return null;})[_0x4c7a('0x37')](function(_0x15e596){if(_0x15e596){_0x4d7d5a[_0x4c7a('0x6f')]=_0x15e596[_0x4c7a('0x6a')]({'plain':!![]});interaction_log[_0x4c7a('0x21')](_0x4c7a('0x70'),_0x31f680[_0x4c7a('0x66')]['id'],_0x31f680[_0x4c7a('0x66')][_0x4c7a('0x43')],_0x31f680[_0x4c7a('0x66')]['role'],_0x4d7d5a[_0x4c7a('0x6f')]['id'],_0x31f680[_0x4c7a('0x5b')]?JSON[_0x4c7a('0x25')](_0x31f680[_0x4c7a('0x5b')]):_0x4c7a('0x71'));return respondWithRpcPromise(_0x4c7a('0x72'),_0x4c7a('0x73'),_0x4d7d5a);}return null;})[_0x4c7a('0x37')](function(_0x1a9c8f){return db[_0x4c7a('0x68')][_0x4c7a('0x5e')]()[_0x4c7a('0x37')](function(_0x43f9e2){var _0x45cc07=[];for(var _0x305e1f=0x0;_0x305e1f=_0x23a1ae){_0xd643cc=_0x23a1ae;_0x383d92=0xc8;}else{_0x383d92=0xce;}_0x51590e[_0xa55c('0x1d')](_0x383d92);return _0x51590e['set'](_0xa55c('0x23'),_0x4c0daf+'-'+_0xd643cc+'/'+_0x23a1ae)[_0xa55c('0x1e')](_0x24783b);}return null;};}function patchUpdates(_0x940f28){return function(_0x1965f1){try{jsonpatch[_0xa55c('0x24')](_0x1965f1,_0x940f28,!![]);}catch(_0x49ed04){return BPromise[_0xa55c('0x25')](_0x49ed04);}return _0x1965f1['save']();};}function saveUpdates(_0x5ba836,_0x59d89a){return function(_0x19ae88){if(_0x19ae88){return _0x19ae88['update'](_0x5ba836)[_0xa55c('0x26')](function(_0x190757){return _0x190757;});}return null;};}function removeEntity(_0x3f64de,_0xf0e574){return function(_0x2313a9){if(_0x2313a9){return _0x2313a9[_0xa55c('0x27')]()[_0xa55c('0x26')](function(){var _0x11e7f7=_0x2313a9[_0xa55c('0x28')]({'plain':!![]});var _0x3cd152=_0xa55c('0x29');return db['UserProfileResource'][_0xa55c('0x27')]({'where':{'type':_0x3cd152,'resourceId':_0x11e7f7['id']}})[_0xa55c('0x26')](function(){return _0x2313a9;});})[_0xa55c('0x26')](function(){_0x3f64de[_0xa55c('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1377b0,_0x22f6b6){return function(_0x1b8388){if(!_0x1b8388){_0x1377b0[_0xa55c('0x1b')](0x194);}return _0x1b8388;};}function handleError(_0x45ee8d,_0x3c3cb5){_0x3c3cb5=_0x3c3cb5||0x1f4;return function(_0x52d37f){logger[_0xa55c('0x2a')](_0x52d37f['stack']);if(_0x52d37f[_0xa55c('0x2b')]){delete _0x52d37f[_0xa55c('0x2b')];}_0x45ee8d[_0xa55c('0x1d')](_0x3c3cb5)[_0xa55c('0x2c')](_0x52d37f);};}exports['index']=function(_0x3d28fb,_0x2096ae){var _0x331e58={},_0x20da31={},_0x10f4b7={'count':0x0,'rows':[]};var _0x1225c3=_[_0xa55c('0x2d')](db[_0xa55c('0x2e')][_0xa55c('0x2f')],function(_0xcbaf2e){return{'name':_0xcbaf2e[_0xa55c('0x30')],'type':_0xcbaf2e['type']['key']};});_0x20da31[_0xa55c('0x31')]=_[_0xa55c('0x2d')](_0x1225c3,'name');_0x20da31[_0xa55c('0x32')]=_[_0xa55c('0x33')](_0x3d28fb[_0xa55c('0x32')]);_0x20da31[_0xa55c('0x34')]=_[_0xa55c('0x35')](_0x20da31[_0xa55c('0x31')],_0x20da31[_0xa55c('0x32')]);_0x331e58[_0xa55c('0x36')]=_[_0xa55c('0x35')](_0x20da31['model'],qs['fields'](_0x3d28fb['query'][_0xa55c('0x37')]));_0x331e58[_0xa55c('0x36')]=_0x331e58[_0xa55c('0x36')]['length']?_0x331e58[_0xa55c('0x36')]:_0x20da31['model'];if(!_0x3d28fb[_0xa55c('0x32')]['hasOwnProperty'](_0xa55c('0x38'))){_0x331e58[_0xa55c('0x21')]=qs[_0xa55c('0x21')](_0x3d28fb['query'][_0xa55c('0x21')]);_0x331e58[_0xa55c('0x1f')]=qs['offset'](_0x3d28fb[_0xa55c('0x32')][_0xa55c('0x1f')]);}_0x331e58['order']=qs['sort'](_0x3d28fb[_0xa55c('0x32')]['sort']);_0x331e58[_0xa55c('0x39')]=qs[_0xa55c('0x34')](_['pick'](_0x3d28fb['query'],_0x20da31['filters']),_0x1225c3);if(_0x3d28fb['query'][_0xa55c('0x3a')]){_0x331e58[_0xa55c('0x39')]=_[_0xa55c('0x3b')](_0x331e58[_0xa55c('0x39')],{'$or':_[_0xa55c('0x2d')](_0x1225c3,function(_0x56d17c){if(_0x56d17c[_0xa55c('0x3c')]!==_0xa55c('0x3d')){var _0x77d623={};_0x77d623[_0x56d17c[_0xa55c('0x2b')]]={'$like':'%'+_0x3d28fb[_0xa55c('0x32')][_0xa55c('0x3a')]+'%'};return _0x77d623;}})});}_0x331e58=_['merge']({},_0x331e58,_0x3d28fb[_0xa55c('0x3e')]);var _0x5ee63d={'where':_0x331e58['where']};return db[_0xa55c('0x2e')][_0xa55c('0x22')](_0x5ee63d)['then'](function(_0x2bd98b){_0x10f4b7['count']=_0x2bd98b;if(_0x3d28fb['query'][_0xa55c('0x3f')]){_0x331e58[_0xa55c('0x40')]=[{'all':!![]}];}return db[_0xa55c('0x2e')]['findAll'](_0x331e58);})[_0xa55c('0x26')](function(_0xd5a006){_0x10f4b7['rows']=_0xd5a006;return _0x10f4b7;})[_0xa55c('0x26')](respondWithFilteredResult(_0x2096ae,_0x331e58))['catch'](handleError(_0x2096ae,null));};exports[_0xa55c('0x41')]=function(_0x43a42d,_0x5be43f){var _0x66d1de={'raw':!![],'where':{'id':_0x43a42d['params']['id']}},_0x1dae70={};_0x1dae70[_0xa55c('0x31')]=_[_0xa55c('0x33')](db[_0xa55c('0x2e')]['rawAttributes']);_0x1dae70[_0xa55c('0x32')]=_['keys'](_0x43a42d[_0xa55c('0x32')]);_0x1dae70[_0xa55c('0x34')]=_[_0xa55c('0x35')](_0x1dae70['model'],_0x1dae70[_0xa55c('0x32')]);_0x66d1de[_0xa55c('0x36')]=_['intersection'](_0x1dae70[_0xa55c('0x31')],qs[_0xa55c('0x37')](_0x43a42d['query'][_0xa55c('0x37')]));_0x66d1de[_0xa55c('0x36')]=_0x66d1de['attributes'][_0xa55c('0x42')]?_0x66d1de[_0xa55c('0x36')]:_0x1dae70[_0xa55c('0x31')];if(_0x43a42d[_0xa55c('0x32')]['includeAll']){_0x66d1de[_0xa55c('0x40')]=[{'all':!![]}];}_0x66d1de=_['merge']({},_0x66d1de,_0x43a42d[_0xa55c('0x3e')]);return db[_0xa55c('0x2e')][_0xa55c('0x43')](_0x66d1de)['then'](handleEntityNotFound(_0x5be43f,null))[_0xa55c('0x26')](respondWithResult(_0x5be43f,null))[_0xa55c('0x44')](handleError(_0x5be43f,null));};exports['create']=function(_0x5be06,_0x34de95){return db[_0xa55c('0x2e')][_0xa55c('0x45')](_0x5be06[_0xa55c('0x46')],{})[_0xa55c('0x26')](function(_0x1e1293){var _0x129626=_0x5be06[_0xa55c('0x47')][_0xa55c('0x28')]({'plain':!![]});if(!_0x129626)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x129626[_0xa55c('0x48')]===_0xa55c('0x47')){var _0x216de8=_0x1e1293['get']({'plain':!![]});var _0x4c3095=_0xa55c('0x29');return db['UserProfileSection'][_0xa55c('0x43')]({'where':{'name':_0x4c3095,'userProfileId':_0x129626['userProfileId']},'raw':!![]})[_0xa55c('0x26')](function(_0x228df4){if(_0x228df4&&_0x228df4[_0xa55c('0x49')]===0x0){return db[_0xa55c('0x4a')][_0xa55c('0x45')]({'name':_0x216de8['name'],'resourceId':_0x216de8['id'],'type':_0x228df4[_0xa55c('0x2b')],'sectionId':_0x228df4['id']},{})[_0xa55c('0x26')](function(){return _0x1e1293;});}else{return _0x1e1293;}})['catch'](function(_0x3929a6){logger[_0xa55c('0x2a')](_0xa55c('0x4b'),_0x3929a6);throw _0x3929a6;});}return _0x1e1293;})[_0xa55c('0x26')](respondWithResult(_0x34de95,0xc9))['catch'](handleError(_0x34de95,null));};exports['update']=function(_0x267965,_0x250dea){if(_0x267965[_0xa55c('0x46')]['id']){delete _0x267965[_0xa55c('0x46')]['id'];}return db['WhatsappQueue'][_0xa55c('0x43')]({'where':{'id':_0x267965['params']['id']}})[_0xa55c('0x26')](handleEntityNotFound(_0x250dea,null))[_0xa55c('0x26')](saveUpdates(_0x267965[_0xa55c('0x46')],null))[_0xa55c('0x26')](respondWithResult(_0x250dea,null))[_0xa55c('0x44')](handleError(_0x250dea,null));};exports['destroy']=function(_0x1cb73b,_0x54f776){return db[_0xa55c('0x2e')][_0xa55c('0x43')]({'where':{'id':_0x1cb73b[_0xa55c('0x4c')]['id']}})[_0xa55c('0x26')](handleEntityNotFound(_0x54f776,null))[_0xa55c('0x26')](removeEntity(_0x54f776,null))[_0xa55c('0x44')](handleError(_0x54f776,null));};exports[_0xa55c('0x4d')]=function(_0x53e2be,_0x450567){return db[_0xa55c('0x2e')][_0xa55c('0x4d')]()[_0xa55c('0x26')](respondWithResult(_0x450567,null))[_0xa55c('0x44')](handleError(_0x450567,null));};exports['getMembers']=function(_0xa72718,_0x3cd40d,_0x28bac4){var _0x20e53c={'raw':!![],'where':{}},_0x3cbb63={},_0x493f51;return db[_0xa55c('0x2e')][_0xa55c('0x4e')]({'where':{'id':_0xa72718[_0xa55c('0x4c')]['id']}})[_0xa55c('0x26')](handleEntityNotFound(_0x3cd40d,null))[_0xa55c('0x26')](function(_0x480dfc){if(_0x480dfc){_0x493f51=_0x480dfc[_0xa55c('0x28')]({'plain':!![]});_0x3cbb63['model']=_[_0xa55c('0x33')](db['UserWhatsappQueue'][_0xa55c('0x2f')]);_0x3cbb63['query']=_[_0xa55c('0x33')](_0xa72718[_0xa55c('0x32')]);_0x3cbb63[_0xa55c('0x34')]=_[_0xa55c('0x35')](_0x3cbb63[_0xa55c('0x31')],_0x3cbb63[_0xa55c('0x32')]);_0x20e53c[_0xa55c('0x36')]=_[_0xa55c('0x35')](_0x3cbb63[_0xa55c('0x31')],qs[_0xa55c('0x37')](_0xa72718['query'][_0xa55c('0x37')]));_0x20e53c[_0xa55c('0x36')]=_0x20e53c['attributes'][_0xa55c('0x42')]?_0x20e53c[_0xa55c('0x36')]:_0x3cbb63[_0xa55c('0x31')];if(!_0xa72718[_0xa55c('0x32')][_0xa55c('0x4f')](_0xa55c('0x38'))){_0x20e53c[_0xa55c('0x21')]=qs[_0xa55c('0x21')](_0xa72718['query'][_0xa55c('0x21')]);_0x20e53c[_0xa55c('0x1f')]=qs[_0xa55c('0x1f')](_0xa72718[_0xa55c('0x32')][_0xa55c('0x1f')]);}_0x20e53c[_0xa55c('0x50')]=qs[_0xa55c('0x51')](_0xa72718[_0xa55c('0x32')][_0xa55c('0x51')]);_0x20e53c['where']=qs[_0xa55c('0x34')](_[_0xa55c('0x52')](_0xa72718[_0xa55c('0x32')],_0x3cbb63[_0xa55c('0x34')]));_0x20e53c[_0xa55c('0x39')][_0xa55c('0x53')]=_0x480dfc['id'];if(_0xa72718[_0xa55c('0x32')][_0xa55c('0x3a')]){_0x20e53c[_0xa55c('0x39')]=_[_0xa55c('0x3b')](_0x20e53c[_0xa55c('0x39')],{'$or':_['map'](_0x20e53c[_0xa55c('0x36')],function(_0x531eee){var _0x1228a4={};_0x1228a4[_0x531eee]={'$like':'%'+_0xa72718[_0xa55c('0x32')][_0xa55c('0x3a')]+'%'};return _0x1228a4;})});}_0x20e53c=_['merge']({},_0x20e53c,_0xa72718['options']);return db[_0xa55c('0x54')][_0xa55c('0x55')](_0x20e53c);}})[_0xa55c('0x26')](function(_0x42529f){if(_0x42529f){return db['User'][_0xa55c('0x56')]({'where':{'id':_[_0xa55c('0x2d')](_0x42529f,_0xa55c('0x57')),'role':_0xa55c('0x58')},'attributes':['id',_0xa55c('0x2b'),'whatsappPause','updatedAt',_0xa55c('0x59')]});}})[_0xa55c('0x26')](function(_0x3f9d0a){if(_0x3f9d0a){return{'count':_0x3f9d0a[_0xa55c('0x22')],'rows':_[_0xa55c('0x2d')](_0x3f9d0a['rows'],function(_0x14febc){return{'membername':_0x14febc[_0xa55c('0x2b')],'UserId':_0x14febc['id'],'queue_name':_0x493f51['name'],'WhatsappQueueId':_0x493f51['id'],'interface':util[_0xa55c('0x5a')](_0xa55c('0x5b'),_0xa55c('0x5c'),_0x14febc['name']),'penalty':0x0,'paused':_0x14febc[_0xa55c('0x5d')],'createdAt':_0x14febc[_0xa55c('0x59')],'updatedAt':_0x14febc[_0xa55c('0x5e')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xa55c('0x26')](respondWithFilteredResult(_0x3cd40d,_0x20e53c))[_0xa55c('0x44')](handleError(_0x3cd40d,null));};exports['getTeams']=function(_0x25bd5b,_0x2e2cf6,_0x4bf233){var _0x550dc1={};var _0x194ddc={};var _0x4e1cbd;var _0x752a0f;return db[_0xa55c('0x2e')][_0xa55c('0x4e')]({'where':{'id':_0x25bd5b[_0xa55c('0x4c')]['id']}})[_0xa55c('0x26')](handleEntityNotFound(_0x2e2cf6,null))[_0xa55c('0x26')](function(_0x22b06f){if(_0x22b06f){_0x4e1cbd=_0x22b06f;_0x194ddc[_0xa55c('0x31')]=_[_0xa55c('0x33')](db['Team'][_0xa55c('0x2f')]);_0x194ddc[_0xa55c('0x32')]=_[_0xa55c('0x33')](_0x25bd5b[_0xa55c('0x32')]);_0x194ddc['filters']=_[_0xa55c('0x35')](_0x194ddc[_0xa55c('0x31')],_0x194ddc[_0xa55c('0x32')]);_0x550dc1[_0xa55c('0x36')]=_['intersection'](_0x194ddc['model'],qs[_0xa55c('0x37')](_0x25bd5b[_0xa55c('0x32')][_0xa55c('0x37')]));_0x550dc1[_0xa55c('0x36')]=_0x550dc1['attributes']['length']?_0x550dc1[_0xa55c('0x36')]:_0x194ddc[_0xa55c('0x31')];_0x550dc1[_0xa55c('0x50')]=qs[_0xa55c('0x51')](_0x25bd5b[_0xa55c('0x32')][_0xa55c('0x51')]);_0x550dc1[_0xa55c('0x39')]=qs['filters'](_[_0xa55c('0x52')](_0x25bd5b['query'],_0x194ddc[_0xa55c('0x34')]));if(_0x25bd5b['query'][_0xa55c('0x3a')]){_0x550dc1[_0xa55c('0x39')]=_[_0xa55c('0x3b')](_0x550dc1[_0xa55c('0x39')],{'$or':_[_0xa55c('0x2d')](_0x550dc1[_0xa55c('0x36')],function(_0x1ea5b6){var _0x2c71ca={};_0x2c71ca[_0x1ea5b6]={'$like':'%'+_0x25bd5b['query']['filter']+'%'};return _0x2c71ca;})});}_0x550dc1=_[_0xa55c('0x3b')]({},_0x550dc1,_0x25bd5b[_0xa55c('0x3e')]);return _0x4e1cbd[_0xa55c('0x5f')](_0x550dc1);}})[_0xa55c('0x26')](function(_0x1622cb){if(_0x1622cb){_0x752a0f=_0x1622cb[_0xa55c('0x42')];if(!_0x25bd5b['query'][_0xa55c('0x4f')](_0xa55c('0x38'))){_0x550dc1[_0xa55c('0x21')]=qs[_0xa55c('0x21')](_0x25bd5b[_0xa55c('0x32')][_0xa55c('0x21')]);_0x550dc1[_0xa55c('0x1f')]=qs[_0xa55c('0x1f')](_0x25bd5b['query'][_0xa55c('0x1f')]);}return _0x4e1cbd[_0xa55c('0x5f')](_0x550dc1);}})[_0xa55c('0x26')](function(_0x25e246){if(_0x25e246){return _0x25e246?{'count':_0x752a0f,'rows':_0x25e246}:null;}})[_0xa55c('0x26')](respondWithResult(_0x2e2cf6,null))['catch'](handleError(_0x2e2cf6,null));};exports[_0xa55c('0x60')]=function(_0x2ab1f2,_0x58296a,_0x4863d5){var _0x1f7b00=_0x2ab1f2[_0xa55c('0x46')]['ids'];return db['Team']['findAll']({'where':{'id':_0x1f7b00},'attributes':['id'],'include':[{'model':db['User'],'as':_0xa55c('0x61'),'attributes':['id',_0xa55c('0x2b'),_0xa55c('0x62'),_0xa55c('0x63'),_0xa55c('0x64')],'raw':!![]}]})[_0xa55c('0x26')](function(_0x568a5b){if(_0x568a5b){var _0xf4ea45=_[_0xa55c('0x65')](_0x568a5b,function(_0x2c89b1){var _0x44a388=_0x2c89b1['get']({'plain':!![]});return _0x44a388[_0xa55c('0x61')];});return db[_0xa55c('0x2e')][_0xa55c('0x43')]({'where':{'id':_0x2ab1f2['params']['id']}})[_0xa55c('0x26')](function(_0x4fb0d3){return db['sequelize'][_0xa55c('0x66')](function(_0x413b45){return _0x4fb0d3[_0xa55c('0x60')](_0x1f7b00,{'transaction':_0x413b45})[_0xa55c('0x26')](function(){return BPromise[_0xa55c('0x67')](_0xf4ea45,function(_0x45d068){return db[_0xa55c('0x54')]['findOrCreate']({'where':{'UserId':_0x45d068['id'],'WhatsappQueueId':_0x2ab1f2['params']['id']},'transaction':_0x413b45});});})[_0xa55c('0x26')](function(){_0xf4ea45[_0xa55c('0x68')](function(_0x24a368){socket[_0xa55c('0x69')](_0xa55c('0x6a'),{'UserId':_0x24a368['id'],'WhatsappQueueId':_0x4fb0d3['id']});});});});});}})[_0xa55c('0x26')](respondWithStatusCode(_0x58296a,null))[_0xa55c('0x44')](handleError(_0x58296a,null));};exports[_0xa55c('0x6b')]=function(_0xc79fb8,_0x115fc4,_0x4ae578){return db[_0xa55c('0x6c')][_0xa55c('0x55')]({'where':{'id':_0xc79fb8['query'][_0xa55c('0x6d')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xa55c('0x61'),'attributes':['id'],'raw':!![]}]})[_0xa55c('0x26')](handleEntityNotFound(_0x115fc4,null))[_0xa55c('0x26')](function(_0x314205){var _0x24e0ff=_['map'](_0x314205,'id');var _0x22092a=[];var _0x12e516=[];var _0x1f2f86=squel[_0xa55c('0x6e')]();_0x1f2f86[_0xa55c('0x6f')](_0xa55c('0x70'))[_0xa55c('0x71')]('team_has_whatsapp_queues','tq')['join']('user_has_teams','ut',_0xa55c('0x72'))['where'](_0xa55c('0x73'),_0xc79fb8[_0xa55c('0x4c')]['id']);for(var _0x3f1453=0x0;_0x3f1453<_0x314205[_0xa55c('0x42')];_0x3f1453+=0x1){let _0x26ca90=_0x314205[_0x3f1453];for(var _0x4f8f56=0x0;_0x4f8f56<_0x26ca90[_0xa55c('0x61')]['length'];_0x4f8f56+=0x1){let _0x210db6=_0x26ca90[_0xa55c('0x61')][_0x4f8f56];var _0x430061=_0x1f2f86[_0xa55c('0x74')]();_0x430061['where'](_0xa55c('0x75'),_0x210db6['id']);_0x12e516[_0xa55c('0x76')](db[_0xa55c('0x77')][_0xa55c('0x32')](_0x430061[_0xa55c('0x78')](),{'type':db[_0xa55c('0x77')][_0xa55c('0x79')][_0xa55c('0x7a')]})['then'](function(_0x147962){if(_0x147962[_0xa55c('0x42')]===0x1){return _0x210db6['id'];}else{var _0x32b196=_[_0xa55c('0x7b')](_[_0xa55c('0x2d')](_0x147962,_0xa55c('0x7c')),function(_0x4c6ac5){return _[_0xa55c('0x7d')](_0x24e0ff,_0x4c6ac5);});if(_0x32b196){return _0x210db6['id'];}}}));}}return BPromise['all'](_0x12e516)[_0xa55c('0x26')](function(_0x5f5140){_0x22092a=_(_0x22092a)[_0xa55c('0x7e')](_0x5f5140)[_0xa55c('0x7f')]()[_0xa55c('0x80')]();return db['WhatsappQueue'][_0xa55c('0x43')]({'where':{'id':_0xc79fb8[_0xa55c('0x4c')]['id']}})[_0xa55c('0x26')](function(_0x5133bd){return db[_0xa55c('0x77')]['transaction'](function(_0x777c32){return _0x5133bd[_0xa55c('0x6b')](_0xc79fb8['query'][_0xa55c('0x6d')],{'transaction':_0x777c32})['then'](function(){if(!_[_0xa55c('0x81')](_0x22092a)){return _0x5133bd[_0xa55c('0x82')](_0x22092a,{'transaction':_0x777c32});}})['then'](function(){_0x22092a[_0xa55c('0x68')](function(_0xc4365a){socket['emit'](_0xa55c('0x83'),{'UserId':_0xc4365a,'WhatsappQueueId':_0x5133bd['id']});});});});});});})[_0xa55c('0x26')](respondWithStatusCode(_0x115fc4,null))['catch'](handleError(_0x115fc4,null));};exports[_0xa55c('0x84')]=function(_0x56597c,_0x5c7059,_0x28a26d){return db[_0xa55c('0x2e')][_0xa55c('0x43')]({'where':{'id':_0x56597c[_0xa55c('0x4c')]['id']}})['then'](handleEntityNotFound(_0x5c7059,null))[_0xa55c('0x26')](function(_0x5c08a9){if(_0x5c08a9){return _0x5c08a9[_0xa55c('0x84')](_0x56597c['body']['ids'],_['omit'](_0x56597c[_0xa55c('0x46')],['ids','id'])||{})['spread'](function(_0x28c680){for(var _0x33aa08=0x0;_0x33aa08<_0x56597c[_0xa55c('0x46')][_0xa55c('0x6d')][_0xa55c('0x42')];_0x33aa08+=0x1){socket[_0xa55c('0x69')](_0xa55c('0x6a'),{'UserId':_0x56597c[_0xa55c('0x46')][_0xa55c('0x6d')][_0x33aa08],'WhatsappQueueId':_0x56597c[_0xa55c('0x4c')]['id']});}return _0x28c680;});}})[_0xa55c('0x26')](respondWithResult(_0x5c7059,null))[_0xa55c('0x44')](handleError(_0x5c7059,null));};exports[_0xa55c('0x82')]=function(_0x5d9504,_0xc1f923,_0x4eebbb){return db['WhatsappQueue']['find']({'where':{'id':_0x5d9504[_0xa55c('0x4c')]['id']}})['then'](handleEntityNotFound(_0xc1f923,null))[_0xa55c('0x26')](function(_0x55e447){if(_0x55e447){return _0x55e447[_0xa55c('0x82')](_0x5d9504['query']['ids'])[_0xa55c('0x26')](function(){if(_['isArray'](_0x5d9504['query'][_0xa55c('0x6d')])){for(var _0x1796eb=0x0;_0x1796eb<_0x5d9504['query'][_0xa55c('0x6d')]['length'];_0x1796eb+=0x1){socket[_0xa55c('0x69')](_0xa55c('0x83'),{'UserId':Number(_0x5d9504[_0xa55c('0x32')]['ids'][_0x1796eb]),'WhatsappQueueId':Number(_0x5d9504['params']['id'])});}}else{socket[_0xa55c('0x69')](_0xa55c('0x83'),{'UserId':Number(_0x5d9504[_0xa55c('0x32')][_0xa55c('0x6d')]),'WhatsappQueueId':Number(_0x5d9504[_0xa55c('0x4c')]['id'])});}});}})[_0xa55c('0x26')](respondWithStatusCode(_0xc1f923,null))[_0xa55c('0x44')](handleError(_0xc1f923,null));};exports[_0xa55c('0x85')]=function(_0x519ee5,_0x2f3fb6,_0x1a9a68){var _0x287b91={};var _0x39cc7c={};var _0x7e237d;var _0x1a01de;return db[_0xa55c('0x2e')][_0xa55c('0x4e')]({'where':{'id':_0x519ee5[_0xa55c('0x4c')]['id']}})['then'](handleEntityNotFound(_0x2f3fb6,null))[_0xa55c('0x26')](function(_0xc07b7f){if(_0xc07b7f){_0x7e237d=_0xc07b7f;_0x39cc7c[_0xa55c('0x31')]=_['keys'](db['User']['rawAttributes']);_0x39cc7c[_0xa55c('0x32')]=_['keys'](_0x519ee5[_0xa55c('0x32')]);_0x39cc7c[_0xa55c('0x34')]=_[_0xa55c('0x35')](_0x39cc7c[_0xa55c('0x31')],_0x39cc7c[_0xa55c('0x32')]);_0x287b91[_0xa55c('0x36')]=_[_0xa55c('0x35')](_0x39cc7c[_0xa55c('0x31')],qs[_0xa55c('0x37')](_0x519ee5[_0xa55c('0x32')][_0xa55c('0x37')]));_0x287b91[_0xa55c('0x36')]=_0x287b91[_0xa55c('0x36')][_0xa55c('0x42')]?_0x287b91[_0xa55c('0x36')]:_0x39cc7c[_0xa55c('0x31')];_0x287b91[_0xa55c('0x50')]=qs[_0xa55c('0x51')](_0x519ee5[_0xa55c('0x32')][_0xa55c('0x51')]);_0x287b91[_0xa55c('0x39')]=qs[_0xa55c('0x34')](_[_0xa55c('0x52')](_0x519ee5[_0xa55c('0x32')],_0x39cc7c['filters']));if(_0x519ee5[_0xa55c('0x32')][_0xa55c('0x3a')]){_0x287b91['where']=_[_0xa55c('0x3b')](_0x287b91[_0xa55c('0x39')],{'$or':_[_0xa55c('0x2d')](_0x287b91[_0xa55c('0x36')],function(_0x31767b){var _0x4d9b66={};_0x4d9b66[_0x31767b]={'$like':'%'+_0x519ee5[_0xa55c('0x32')]['filter']+'%'};return _0x4d9b66;})});}_0x287b91=_['merge']({},_0x287b91,_0x519ee5[_0xa55c('0x3e')]);return _0x7e237d[_0xa55c('0x85')](_0x287b91);}})[_0xa55c('0x26')](function(_0x1b5a14){if(_0x1b5a14){_0x1a01de=_0x1b5a14[_0xa55c('0x42')];if(!_0x519ee5[_0xa55c('0x32')][_0xa55c('0x4f')](_0xa55c('0x38'))){_0x287b91[_0xa55c('0x21')]=qs[_0xa55c('0x21')](_0x519ee5[_0xa55c('0x32')][_0xa55c('0x21')]);_0x287b91[_0xa55c('0x1f')]=qs[_0xa55c('0x1f')](_0x519ee5[_0xa55c('0x32')][_0xa55c('0x1f')]);}return _0x7e237d[_0xa55c('0x85')](_0x287b91);}})[_0xa55c('0x26')](function(_0x1073c5){if(_0x1073c5){return _0x1073c5?{'count':_0x1a01de,'rows':_0x1073c5}:null;}})['then'](respondWithResult(_0x2f3fb6,null))['catch'](handleError(_0x2f3fb6,null));}; \ No newline at end of file +var _0x7217=['../../mysqldb','defaults','redis','socket.io-emitter','./whatsappQueue.socket','register','status','offset','undefined','limit','count','set','json','apply','reject','save','update','then','destroy','end','stack','name','send','index','WhatsappQueue','rawAttributes','type','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','options','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','WhatsappQueues','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','findOne','UserWhatsappQueue','nolimit','WhatsappQueueId','User','findAndCountAll','UserId','agent','whatsappPause','createdAt','SIP','updatedAt','getTeams','addTeams','ids','Team','Agents','voicePause','interface','flatMap','sequelize','each','findOrCreate','forEach','userWhatsappQueue:save','removeTeams','field','tq.TeamId','from','team_has_whatsapp_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','value','isEmpty','removeAgents','userWhatsappQueue:remove','addAgents','omit','spread','emit','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x1e09a1,_0x1c14f9){var _0x24ac77=function(_0x272fa1){while(--_0x272fa1){_0x1e09a1['push'](_0x1e09a1['shift']());}};_0x24ac77(++_0x1c14f9);}(_0x7217,0x19e));var _0x7721=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0x7217[_0x3054be];return _0x3df150;};'use strict';var emlformat=require(_0x7721('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7721('0x1'));var jsonpatch=require(_0x7721('0x2'));var rp=require(_0x7721('0x3'));var moment=require(_0x7721('0x4'));var BPromise=require(_0x7721('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x7721('0x6'));var sox=require(_0x7721('0x7'));var csv=require(_0x7721('0x8'));var ejs=require(_0x7721('0x9'));var fs=require('fs');var fs_extra=require(_0x7721('0xa'));var _=require(_0x7721('0xb'));var squel=require(_0x7721('0xc'));var crypto=require(_0x7721('0xd'));var jsforce=require(_0x7721('0xe'));var deskjs=require(_0x7721('0xf'));var toCsv=require(_0x7721('0x8'));var querystring=require(_0x7721('0x10'));var Papa=require(_0x7721('0x11'));var Redis=require(_0x7721('0x12'));var authService=require(_0x7721('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x7721('0x14'));var hardwareService=require(_0x7721('0x15'));var logger=require(_0x7721('0x16'))(_0x7721('0x17'));var utils=require(_0x7721('0x18'));var config=require(_0x7721('0x19'));var licenseUtil=require(_0x7721('0x1a'));var db=require(_0x7721('0x1b'))['db'];config['redis']=_[_0x7721('0x1c')](config[_0x7721('0x1d')],{'host':'localhost','port':0x18eb});var socket=require(_0x7721('0x1e'))(new Redis(config[_0x7721('0x1d')]));require(_0x7721('0x1f'))[_0x7721('0x20')](socket);function respondWithStatusCode(_0x5069da,_0x3cbce8){_0x3cbce8=_0x3cbce8||0xcc;return function(_0x25b1c0){if(_0x25b1c0){return _0x5069da['sendStatus'](_0x3cbce8);}return _0x5069da['status'](_0x3cbce8)['end']();};}function respondWithResult(_0x5ed54,_0x25a628){_0x25a628=_0x25a628||0xc8;return function(_0x3cc909){if(_0x3cc909){return _0x5ed54[_0x7721('0x21')](_0x25a628)['json'](_0x3cc909);}};}function respondWithFilteredResult(_0x20f669,_0x54a838){return function(_0x3fc09e){if(_0x3fc09e){var _0x5cb0e6=typeof _0x54a838[_0x7721('0x22')]===_0x7721('0x23')&&typeof _0x54a838[_0x7721('0x24')]===_0x7721('0x23');var _0x2286e5=_0x3fc09e[_0x7721('0x25')];var _0x402820=_0x5cb0e6?0x0:_0x54a838[_0x7721('0x22')];var _0x3b29ac=_0x5cb0e6?_0x3fc09e[_0x7721('0x25')]:_0x54a838['offset']+_0x54a838[_0x7721('0x24')];var _0x2c1583;if(_0x3b29ac>=_0x2286e5){_0x3b29ac=_0x2286e5;_0x2c1583=0xc8;}else{_0x2c1583=0xce;}_0x20f669[_0x7721('0x21')](_0x2c1583);return _0x20f669[_0x7721('0x26')]('Content-Range',_0x402820+'-'+_0x3b29ac+'/'+_0x2286e5)[_0x7721('0x27')](_0x3fc09e);}return null;};}function patchUpdates(_0x512f31){return function(_0xb9e9dd){try{jsonpatch[_0x7721('0x28')](_0xb9e9dd,_0x512f31,!![]);}catch(_0x3e8a4e){return BPromise[_0x7721('0x29')](_0x3e8a4e);}return _0xb9e9dd[_0x7721('0x2a')]();};}function saveUpdates(_0x395b15,_0x2c6b7b){return function(_0x5b4d74){if(_0x5b4d74){return _0x5b4d74[_0x7721('0x2b')](_0x395b15)[_0x7721('0x2c')](function(_0x125564){return _0x125564;});}return null;};}function removeEntity(_0x1f67c7,_0x40d550){return function(_0x16355a){if(_0x16355a){return _0x16355a[_0x7721('0x2d')]()[_0x7721('0x2c')](function(){var _0x40f367=_0x16355a['get']({'plain':!![]});var _0x258ddf='WhatsappQueues';return db['UserProfileResource'][_0x7721('0x2d')]({'where':{'type':_0x258ddf,'resourceId':_0x40f367['id']}})[_0x7721('0x2c')](function(){return _0x16355a;});})[_0x7721('0x2c')](function(){_0x1f67c7[_0x7721('0x21')](0xcc)[_0x7721('0x2e')]();});}};}function handleEntityNotFound(_0x37b9f0,_0xd7d703){return function(_0x1da2d8){if(!_0x1da2d8){_0x37b9f0['sendStatus'](0x194);}return _0x1da2d8;};}function handleError(_0x471651,_0x2871c5){_0x2871c5=_0x2871c5||0x1f4;return function(_0x497f9f){logger['error'](_0x497f9f[_0x7721('0x2f')]);if(_0x497f9f[_0x7721('0x30')]){delete _0x497f9f['name'];}_0x471651[_0x7721('0x21')](_0x2871c5)[_0x7721('0x31')](_0x497f9f);};}exports[_0x7721('0x32')]=function(_0x58d54b,_0x3d9a32){var _0x1ff31b={},_0x1492d4={},_0x3f15e2={'count':0x0,'rows':[]};var _0xc0f3c4=_['map'](db[_0x7721('0x33')][_0x7721('0x34')],function(_0xb2386d){return{'name':_0xb2386d['fieldName'],'type':_0xb2386d[_0x7721('0x35')][_0x7721('0x36')]};});_0x1492d4['model']=_[_0x7721('0x37')](_0xc0f3c4,'name');_0x1492d4[_0x7721('0x38')]=_[_0x7721('0x39')](_0x58d54b[_0x7721('0x38')]);_0x1492d4[_0x7721('0x3a')]=_[_0x7721('0x3b')](_0x1492d4[_0x7721('0x3c')],_0x1492d4[_0x7721('0x38')]);_0x1ff31b[_0x7721('0x3d')]=_[_0x7721('0x3b')](_0x1492d4[_0x7721('0x3c')],qs[_0x7721('0x3e')](_0x58d54b['query'][_0x7721('0x3e')]));_0x1ff31b['attributes']=_0x1ff31b[_0x7721('0x3d')][_0x7721('0x3f')]?_0x1ff31b[_0x7721('0x3d')]:_0x1492d4[_0x7721('0x3c')];if(!_0x58d54b[_0x7721('0x38')][_0x7721('0x40')]('nolimit')){_0x1ff31b['limit']=qs['limit'](_0x58d54b['query'][_0x7721('0x24')]);_0x1ff31b[_0x7721('0x22')]=qs[_0x7721('0x22')](_0x58d54b[_0x7721('0x38')]['offset']);}_0x1ff31b[_0x7721('0x41')]=qs['sort'](_0x58d54b[_0x7721('0x38')][_0x7721('0x42')]);_0x1ff31b['where']=qs[_0x7721('0x3a')](_[_0x7721('0x43')](_0x58d54b['query'],_0x1492d4['filters']),_0xc0f3c4);if(_0x58d54b[_0x7721('0x38')][_0x7721('0x44')]){_0x1ff31b[_0x7721('0x45')]=_[_0x7721('0x46')](_0x1ff31b['where'],{'$or':_[_0x7721('0x37')](_0xc0f3c4,function(_0x120de9){if(_0x120de9[_0x7721('0x35')]!==_0x7721('0x47')){var _0x196051={};_0x196051[_0x120de9['name']]={'$like':'%'+_0x58d54b[_0x7721('0x38')]['filter']+'%'};return _0x196051;}})});}_0x1ff31b=_[_0x7721('0x46')]({},_0x1ff31b,_0x58d54b['options']);var _0x2333b8={'where':_0x1ff31b[_0x7721('0x45')]};return db[_0x7721('0x33')]['count'](_0x2333b8)[_0x7721('0x2c')](function(_0x11d853){_0x3f15e2[_0x7721('0x25')]=_0x11d853;if(_0x58d54b['query'][_0x7721('0x48')]){_0x1ff31b[_0x7721('0x49')]=[{'all':!![]}];}return db[_0x7721('0x33')][_0x7721('0x4a')](_0x1ff31b);})[_0x7721('0x2c')](function(_0x57d09b){_0x3f15e2[_0x7721('0x4b')]=_0x57d09b;return _0x3f15e2;})['then'](respondWithFilteredResult(_0x3d9a32,_0x1ff31b))['catch'](handleError(_0x3d9a32,null));};exports[_0x7721('0x4c')]=function(_0x1fdc79,_0x421aae){var _0x39a3ad={'raw':!![],'where':{'id':_0x1fdc79[_0x7721('0x4d')]['id']}},_0x335145={};_0x335145[_0x7721('0x3c')]=_[_0x7721('0x39')](db[_0x7721('0x33')][_0x7721('0x34')]);_0x335145['query']=_['keys'](_0x1fdc79[_0x7721('0x38')]);_0x335145[_0x7721('0x3a')]=_[_0x7721('0x3b')](_0x335145[_0x7721('0x3c')],_0x335145['query']);_0x39a3ad[_0x7721('0x3d')]=_[_0x7721('0x3b')](_0x335145['model'],qs[_0x7721('0x3e')](_0x1fdc79['query'][_0x7721('0x3e')]));_0x39a3ad['attributes']=_0x39a3ad[_0x7721('0x3d')][_0x7721('0x3f')]?_0x39a3ad[_0x7721('0x3d')]:_0x335145['model'];if(_0x1fdc79[_0x7721('0x38')][_0x7721('0x48')]){_0x39a3ad['include']=[{'all':!![]}];}_0x39a3ad=_[_0x7721('0x46')]({},_0x39a3ad,_0x1fdc79[_0x7721('0x4e')]);return db[_0x7721('0x33')]['find'](_0x39a3ad)[_0x7721('0x2c')](handleEntityNotFound(_0x421aae,null))['then'](respondWithResult(_0x421aae,null))[_0x7721('0x4f')](handleError(_0x421aae,null));};exports[_0x7721('0x50')]=function(_0x4738ef,_0x443503){return db[_0x7721('0x33')][_0x7721('0x50')](_0x4738ef[_0x7721('0x51')],{})[_0x7721('0x2c')](function(_0x694d2f){var _0x3386aa=_0x4738ef[_0x7721('0x52')][_0x7721('0x53')]({'plain':!![]});if(!_0x3386aa)throw new Error(_0x7721('0x54'));if(_0x3386aa[_0x7721('0x55')]===_0x7721('0x52')){var _0x5b741d=_0x694d2f[_0x7721('0x53')]({'plain':!![]});var _0x2f6f30=_0x7721('0x56');return db[_0x7721('0x57')][_0x7721('0x58')]({'where':{'name':_0x2f6f30,'userProfileId':_0x3386aa[_0x7721('0x59')]},'raw':!![]})[_0x7721('0x2c')](function(_0x57484c){if(_0x57484c&&_0x57484c[_0x7721('0x5a')]===0x0){return db[_0x7721('0x5b')][_0x7721('0x50')]({'name':_0x5b741d[_0x7721('0x30')],'resourceId':_0x5b741d['id'],'type':_0x57484c[_0x7721('0x30')],'sectionId':_0x57484c['id']},{})[_0x7721('0x2c')](function(){return _0x694d2f;});}else{return _0x694d2f;}})[_0x7721('0x4f')](function(_0x33287d){logger[_0x7721('0x5c')](_0x7721('0x5d'),_0x33287d);throw _0x33287d;});}return _0x694d2f;})[_0x7721('0x2c')](respondWithResult(_0x443503,0xc9))['catch'](handleError(_0x443503,null));};exports[_0x7721('0x2b')]=function(_0xadb365,_0x1234bc){if(_0xadb365[_0x7721('0x51')]['id']){delete _0xadb365[_0x7721('0x51')]['id'];}return db[_0x7721('0x33')][_0x7721('0x58')]({'where':{'id':_0xadb365[_0x7721('0x4d')]['id']}})[_0x7721('0x2c')](handleEntityNotFound(_0x1234bc,null))[_0x7721('0x2c')](saveUpdates(_0xadb365[_0x7721('0x51')],null))[_0x7721('0x2c')](respondWithResult(_0x1234bc,null))[_0x7721('0x4f')](handleError(_0x1234bc,null));};exports[_0x7721('0x2d')]=function(_0x300ea4,_0x577f47){return db['WhatsappQueue']['find']({'where':{'id':_0x300ea4[_0x7721('0x4d')]['id']}})['then'](handleEntityNotFound(_0x577f47,null))['then'](removeEntity(_0x577f47,null))['catch'](handleError(_0x577f47,null));};exports['describe']=function(_0x47925a,_0x219181){return db[_0x7721('0x33')]['describe']()[_0x7721('0x2c')](respondWithResult(_0x219181,null))['catch'](handleError(_0x219181,null));};exports['getMembers']=function(_0x484b8e,_0x24d1dc,_0x4f0d38){var _0x48e7e3={'raw':!![],'where':{}},_0x54642a={},_0x160292;return db[_0x7721('0x33')][_0x7721('0x5e')]({'where':{'id':_0x484b8e['params']['id']}})[_0x7721('0x2c')](handleEntityNotFound(_0x24d1dc,null))[_0x7721('0x2c')](function(_0x2c95d0){if(_0x2c95d0){_0x160292=_0x2c95d0[_0x7721('0x53')]({'plain':!![]});_0x54642a[_0x7721('0x3c')]=_[_0x7721('0x39')](db[_0x7721('0x5f')][_0x7721('0x34')]);_0x54642a[_0x7721('0x38')]=_[_0x7721('0x39')](_0x484b8e[_0x7721('0x38')]);_0x54642a[_0x7721('0x3a')]=_[_0x7721('0x3b')](_0x54642a[_0x7721('0x3c')],_0x54642a[_0x7721('0x38')]);_0x48e7e3['attributes']=_[_0x7721('0x3b')](_0x54642a[_0x7721('0x3c')],qs[_0x7721('0x3e')](_0x484b8e[_0x7721('0x38')]['fields']));_0x48e7e3[_0x7721('0x3d')]=_0x48e7e3[_0x7721('0x3d')]['length']?_0x48e7e3[_0x7721('0x3d')]:_0x54642a['model'];if(!_0x484b8e[_0x7721('0x38')][_0x7721('0x40')](_0x7721('0x60'))){_0x48e7e3[_0x7721('0x24')]=qs[_0x7721('0x24')](_0x484b8e[_0x7721('0x38')][_0x7721('0x24')]);_0x48e7e3[_0x7721('0x22')]=qs[_0x7721('0x22')](_0x484b8e['query'][_0x7721('0x22')]);}_0x48e7e3[_0x7721('0x41')]=qs[_0x7721('0x42')](_0x484b8e[_0x7721('0x38')][_0x7721('0x42')]);_0x48e7e3[_0x7721('0x45')]=qs[_0x7721('0x3a')](_['pick'](_0x484b8e[_0x7721('0x38')],_0x54642a[_0x7721('0x3a')]));_0x48e7e3['where'][_0x7721('0x61')]=_0x2c95d0['id'];if(_0x484b8e['query'][_0x7721('0x44')]){_0x48e7e3[_0x7721('0x45')]=_[_0x7721('0x46')](_0x48e7e3[_0x7721('0x45')],{'$or':_[_0x7721('0x37')](_0x48e7e3[_0x7721('0x3d')],function(_0x258c57){var _0x5dca04={};_0x5dca04[_0x258c57]={'$like':'%'+_0x484b8e[_0x7721('0x38')][_0x7721('0x44')]+'%'};return _0x5dca04;})});}_0x48e7e3=_[_0x7721('0x46')]({},_0x48e7e3,_0x484b8e['options']);return db['UserWhatsappQueue']['findAll'](_0x48e7e3);}})['then'](function(_0x5e966f){if(_0x5e966f){return db[_0x7721('0x62')][_0x7721('0x63')]({'where':{'id':_['map'](_0x5e966f,_0x7721('0x64')),'role':_0x7721('0x65')},'attributes':['id',_0x7721('0x30'),_0x7721('0x66'),'updatedAt',_0x7721('0x67')]});}})[_0x7721('0x2c')](function(_0x322afc){if(_0x322afc){return{'count':_0x322afc[_0x7721('0x25')],'rows':_[_0x7721('0x37')](_0x322afc['rows'],function(_0x29ac64){return{'membername':_0x29ac64[_0x7721('0x30')],'UserId':_0x29ac64['id'],'queue_name':_0x160292[_0x7721('0x30')],'WhatsappQueueId':_0x160292['id'],'interface':util['format']('%s/%s',_0x7721('0x68'),_0x29ac64[_0x7721('0x30')]),'penalty':0x0,'paused':_0x29ac64[_0x7721('0x66')],'createdAt':_0x29ac64[_0x7721('0x67')],'updatedAt':_0x29ac64[_0x7721('0x69')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x24d1dc,_0x48e7e3))['catch'](handleError(_0x24d1dc,null));};exports[_0x7721('0x6a')]=function(_0x1bd97e,_0x68de4,_0x3c66b3){var _0x142ec6={};var _0x145a0b={};var _0x34187f;var _0x58f944;return db[_0x7721('0x33')][_0x7721('0x5e')]({'where':{'id':_0x1bd97e[_0x7721('0x4d')]['id']}})['then'](handleEntityNotFound(_0x68de4,null))[_0x7721('0x2c')](function(_0x1a53d6){if(_0x1a53d6){_0x34187f=_0x1a53d6;_0x145a0b[_0x7721('0x3c')]=_[_0x7721('0x39')](db['Team']['rawAttributes']);_0x145a0b[_0x7721('0x38')]=_[_0x7721('0x39')](_0x1bd97e[_0x7721('0x38')]);_0x145a0b[_0x7721('0x3a')]=_[_0x7721('0x3b')](_0x145a0b[_0x7721('0x3c')],_0x145a0b['query']);_0x142ec6[_0x7721('0x3d')]=_[_0x7721('0x3b')](_0x145a0b[_0x7721('0x3c')],qs['fields'](_0x1bd97e[_0x7721('0x38')][_0x7721('0x3e')]));_0x142ec6[_0x7721('0x3d')]=_0x142ec6[_0x7721('0x3d')][_0x7721('0x3f')]?_0x142ec6['attributes']:_0x145a0b[_0x7721('0x3c')];_0x142ec6['order']=qs[_0x7721('0x42')](_0x1bd97e[_0x7721('0x38')][_0x7721('0x42')]);_0x142ec6[_0x7721('0x45')]=qs[_0x7721('0x3a')](_[_0x7721('0x43')](_0x1bd97e[_0x7721('0x38')],_0x145a0b[_0x7721('0x3a')]));if(_0x1bd97e[_0x7721('0x38')][_0x7721('0x44')]){_0x142ec6[_0x7721('0x45')]=_['merge'](_0x142ec6[_0x7721('0x45')],{'$or':_[_0x7721('0x37')](_0x142ec6[_0x7721('0x3d')],function(_0x5eec29){var _0x94af20={};_0x94af20[_0x5eec29]={'$like':'%'+_0x1bd97e[_0x7721('0x38')][_0x7721('0x44')]+'%'};return _0x94af20;})});}_0x142ec6=_[_0x7721('0x46')]({},_0x142ec6,_0x1bd97e[_0x7721('0x4e')]);return _0x34187f['getTeams'](_0x142ec6);}})[_0x7721('0x2c')](function(_0x22f15a){if(_0x22f15a){_0x58f944=_0x22f15a[_0x7721('0x3f')];if(!_0x1bd97e[_0x7721('0x38')][_0x7721('0x40')](_0x7721('0x60'))){_0x142ec6['limit']=qs[_0x7721('0x24')](_0x1bd97e[_0x7721('0x38')]['limit']);_0x142ec6[_0x7721('0x22')]=qs['offset'](_0x1bd97e[_0x7721('0x38')][_0x7721('0x22')]);}return _0x34187f['getTeams'](_0x142ec6);}})[_0x7721('0x2c')](function(_0x5209e1){if(_0x5209e1){return _0x5209e1?{'count':_0x58f944,'rows':_0x5209e1}:null;}})['then'](respondWithResult(_0x68de4,null))['catch'](handleError(_0x68de4,null));};exports[_0x7721('0x6b')]=function(_0x20f12e,_0x21a686,_0x48b701){var _0x4916c2=_0x20f12e['body'][_0x7721('0x6c')];return db[_0x7721('0x6d')][_0x7721('0x4a')]({'where':{'id':_0x4916c2},'attributes':['id'],'include':[{'model':db[_0x7721('0x62')],'as':_0x7721('0x6e'),'attributes':['id',_0x7721('0x30'),'online',_0x7721('0x6f'),_0x7721('0x70')],'raw':!![]}]})[_0x7721('0x2c')](function(_0xcf5304){if(_0xcf5304){var _0x977255=_[_0x7721('0x71')](_0xcf5304,function(_0x342da2){var _0x6252db=_0x342da2[_0x7721('0x53')]({'plain':!![]});return _0x6252db[_0x7721('0x6e')];});return db[_0x7721('0x33')][_0x7721('0x58')]({'where':{'id':_0x20f12e['params']['id']}})['then'](function(_0x40768f){return db[_0x7721('0x72')]['transaction'](function(_0x167e05){return _0x40768f['addTeams'](_0x4916c2,{'transaction':_0x167e05})['then'](function(){return BPromise[_0x7721('0x73')](_0x977255,function(_0x569dad){return db['UserWhatsappQueue'][_0x7721('0x74')]({'where':{'UserId':_0x569dad['id'],'WhatsappQueueId':_0x20f12e[_0x7721('0x4d')]['id']},'transaction':_0x167e05});});})[_0x7721('0x2c')](function(){_0x977255[_0x7721('0x75')](function(_0x6b611){socket['emit'](_0x7721('0x76'),{'UserId':_0x6b611['id'],'WhatsappQueueId':_0x40768f['id']});});});});});}})[_0x7721('0x2c')](respondWithStatusCode(_0x21a686,null))[_0x7721('0x4f')](handleError(_0x21a686,null));};exports[_0x7721('0x77')]=function(_0x4a1749,_0x52fcc1,_0x66ec15){return db[_0x7721('0x6d')]['findAll']({'where':{'id':_0x4a1749[_0x7721('0x38')][_0x7721('0x6c')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x7721('0x2c')](handleEntityNotFound(_0x52fcc1,null))[_0x7721('0x2c')](function(_0x606b4b){var _0x3c4228=_[_0x7721('0x37')](_0x606b4b,'id');var _0x29053e=[];var _0x996071=[];var _0x2dafa0=squel['select']();_0x2dafa0[_0x7721('0x78')](_0x7721('0x79'))[_0x7721('0x7a')](_0x7721('0x7b'),'tq')[_0x7721('0x7c')](_0x7721('0x7d'),'ut',_0x7721('0x7e'))['where'](_0x7721('0x7f'),_0x4a1749[_0x7721('0x4d')]['id']);for(var _0x479834=0x0;_0x479834<_0x606b4b[_0x7721('0x3f')];_0x479834+=0x1){let _0x1cc8ee=_0x606b4b[_0x479834];for(var _0x12ff9e=0x0;_0x12ff9e<_0x1cc8ee[_0x7721('0x6e')][_0x7721('0x3f')];_0x12ff9e+=0x1){let _0x26c139=_0x1cc8ee[_0x7721('0x6e')][_0x12ff9e];var _0xef8270=_0x2dafa0[_0x7721('0x80')]();_0xef8270[_0x7721('0x45')]('ut.UserId\x20=\x20?',_0x26c139['id']);_0x996071[_0x7721('0x81')](db[_0x7721('0x72')][_0x7721('0x38')](_0xef8270[_0x7721('0x82')](),{'type':db[_0x7721('0x72')][_0x7721('0x83')][_0x7721('0x84')]})[_0x7721('0x2c')](function(_0x425327){if(_0x425327[_0x7721('0x3f')]===0x1){return _0x26c139['id'];}else{var _0x29b576=_[_0x7721('0x85')](_[_0x7721('0x37')](_0x425327,_0x7721('0x86')),function(_0x2291fc){return _[_0x7721('0x87')](_0x3c4228,_0x2291fc);});if(_0x29b576){return _0x26c139['id'];}}}));}}return BPromise[_0x7721('0x88')](_0x996071)[_0x7721('0x2c')](function(_0xfe14f3){_0x29053e=_(_0x29053e)[_0x7721('0x89')](_0xfe14f3)['compact']()[_0x7721('0x8a')]();return db['WhatsappQueue'][_0x7721('0x58')]({'where':{'id':_0x4a1749[_0x7721('0x4d')]['id']}})[_0x7721('0x2c')](function(_0x3760e3){return db[_0x7721('0x72')]['transaction'](function(_0x5ade72){return _0x3760e3['removeTeams'](_0x4a1749['query'][_0x7721('0x6c')],{'transaction':_0x5ade72})[_0x7721('0x2c')](function(){if(!_[_0x7721('0x8b')](_0x29053e)){return _0x3760e3[_0x7721('0x8c')](_0x29053e,{'transaction':_0x5ade72});}})[_0x7721('0x2c')](function(){_0x29053e['forEach'](function(_0x123769){socket['emit'](_0x7721('0x8d'),{'UserId':_0x123769,'WhatsappQueueId':_0x3760e3['id']});});});});});});})[_0x7721('0x2c')](respondWithStatusCode(_0x52fcc1,null))[_0x7721('0x4f')](handleError(_0x52fcc1,null));};exports[_0x7721('0x8e')]=function(_0xf061eb,_0x2b0c22,_0x56b916){return db[_0x7721('0x33')]['find']({'where':{'id':_0xf061eb['params']['id']}})[_0x7721('0x2c')](handleEntityNotFound(_0x2b0c22,null))[_0x7721('0x2c')](function(_0x4c7271){if(_0x4c7271){return _0x4c7271[_0x7721('0x8e')](_0xf061eb[_0x7721('0x51')]['ids'],_[_0x7721('0x8f')](_0xf061eb[_0x7721('0x51')],[_0x7721('0x6c'),'id'])||{})[_0x7721('0x90')](function(_0x34ef75){for(var _0x3b79c6=0x0;_0x3b79c6<_0xf061eb[_0x7721('0x51')]['ids'][_0x7721('0x3f')];_0x3b79c6+=0x1){socket[_0x7721('0x91')](_0x7721('0x76'),{'UserId':_0xf061eb[_0x7721('0x51')][_0x7721('0x6c')][_0x3b79c6],'WhatsappQueueId':_0xf061eb['params']['id']});}return _0x34ef75;});}})[_0x7721('0x2c')](respondWithResult(_0x2b0c22,null))[_0x7721('0x4f')](handleError(_0x2b0c22,null));};exports[_0x7721('0x8c')]=function(_0x566a88,_0x250f29,_0x44554b){return db['WhatsappQueue'][_0x7721('0x58')]({'where':{'id':_0x566a88[_0x7721('0x4d')]['id']}})[_0x7721('0x2c')](handleEntityNotFound(_0x250f29,null))[_0x7721('0x2c')](function(_0x5b64de){if(_0x5b64de){return _0x5b64de[_0x7721('0x8c')](_0x566a88['query'][_0x7721('0x6c')])[_0x7721('0x2c')](function(){if(_['isArray'](_0x566a88[_0x7721('0x38')][_0x7721('0x6c')])){for(var _0x4ee4d8=0x0;_0x4ee4d8<_0x566a88[_0x7721('0x38')][_0x7721('0x6c')]['length'];_0x4ee4d8+=0x1){socket[_0x7721('0x91')]('userWhatsappQueue:remove',{'UserId':Number(_0x566a88[_0x7721('0x38')][_0x7721('0x6c')][_0x4ee4d8]),'WhatsappQueueId':Number(_0x566a88[_0x7721('0x4d')]['id'])});}}else{socket['emit'](_0x7721('0x8d'),{'UserId':Number(_0x566a88['query']['ids']),'WhatsappQueueId':Number(_0x566a88[_0x7721('0x4d')]['id'])});}});}})[_0x7721('0x2c')](respondWithStatusCode(_0x250f29,null))[_0x7721('0x4f')](handleError(_0x250f29,null));};exports[_0x7721('0x92')]=function(_0x514b93,_0x4d9fec,_0x669fce){var _0x174e20={};var _0x34e147={};var _0x299472;var _0x42cd58;return db['WhatsappQueue'][_0x7721('0x5e')]({'where':{'id':_0x514b93['params']['id']}})[_0x7721('0x2c')](handleEntityNotFound(_0x4d9fec,null))['then'](function(_0x483d68){if(_0x483d68){_0x299472=_0x483d68;_0x34e147[_0x7721('0x3c')]=_['keys'](db['User'][_0x7721('0x34')]);_0x34e147[_0x7721('0x38')]=_[_0x7721('0x39')](_0x514b93['query']);_0x34e147[_0x7721('0x3a')]=_['intersection'](_0x34e147['model'],_0x34e147['query']);_0x174e20[_0x7721('0x3d')]=_[_0x7721('0x3b')](_0x34e147[_0x7721('0x3c')],qs[_0x7721('0x3e')](_0x514b93[_0x7721('0x38')][_0x7721('0x3e')]));_0x174e20[_0x7721('0x3d')]=_0x174e20[_0x7721('0x3d')][_0x7721('0x3f')]?_0x174e20[_0x7721('0x3d')]:_0x34e147[_0x7721('0x3c')];_0x174e20['order']=qs[_0x7721('0x42')](_0x514b93[_0x7721('0x38')][_0x7721('0x42')]);_0x174e20[_0x7721('0x45')]=qs[_0x7721('0x3a')](_[_0x7721('0x43')](_0x514b93[_0x7721('0x38')],_0x34e147['filters']));if(_0x514b93['query'][_0x7721('0x44')]){_0x174e20[_0x7721('0x45')]=_[_0x7721('0x46')](_0x174e20[_0x7721('0x45')],{'$or':_['map'](_0x174e20[_0x7721('0x3d')],function(_0x4db922){var _0x1b5692={};_0x1b5692[_0x4db922]={'$like':'%'+_0x514b93['query'][_0x7721('0x44')]+'%'};return _0x1b5692;})});}_0x174e20=_[_0x7721('0x46')]({},_0x174e20,_0x514b93[_0x7721('0x4e')]);return _0x299472[_0x7721('0x92')](_0x174e20);}})[_0x7721('0x2c')](function(_0x22f3e6){if(_0x22f3e6){_0x42cd58=_0x22f3e6['length'];if(!_0x514b93['query']['hasOwnProperty'](_0x7721('0x60'))){_0x174e20['limit']=qs[_0x7721('0x24')](_0x514b93[_0x7721('0x38')]['limit']);_0x174e20[_0x7721('0x22')]=qs[_0x7721('0x22')](_0x514b93[_0x7721('0x38')]['offset']);}return _0x299472[_0x7721('0x92')](_0x174e20);}})[_0x7721('0x2c')](function(_0x5652f9){if(_0x5652f9){return _0x5652f9?{'count':_0x42cd58,'rows':_0x5652f9}:null;}})['then'](respondWithResult(_0x4d9fec,null))[_0x7721('0x4f')](handleError(_0x4d9fec,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index 0bfe77a..84462c4 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 _0xdfa5=['hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappQueue','setMaxListeners','save','update','remove','emit'];(function(_0x27dd81,_0x3e3244){var _0x4d7068=function(_0x34a64e){while(--_0x34a64e){_0x27dd81['push'](_0x27dd81['shift']());}};_0x4d7068(++_0x3e3244);}(_0xdfa5,0xb3));var _0x5dfa=function(_0x5a6a1f,_0x5ce170){_0x5a6a1f=_0x5a6a1f-0x0;var _0x1a17bd=_0xdfa5[_0x5a6a1f];return _0x1a17bd;};'use strict';var EventEmitter=require(_0x5dfa('0x0'));var WhatsappQueue=require(_0x5dfa('0x1'))['db'][_0x5dfa('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x5dfa('0x3')](0x0);var events={'afterCreate':_0x5dfa('0x4'),'afterUpdate':_0x5dfa('0x5'),'afterDestroy':_0x5dfa('0x6')};function emitEvent(_0x2e8fd7){return function(_0xb4cd1,_0x28867b,_0x4f7e61){WhatsappQueueEvents['emit'](_0x2e8fd7+':'+_0xb4cd1['id'],_0xb4cd1);WhatsappQueueEvents[_0x5dfa('0x7')](_0x2e8fd7,_0xb4cd1);_0x4f7e61(null);};}for(var e in events){if(events[_0x5dfa('0x8')](e)){var event=events[e];WhatsappQueue[_0x5dfa('0x9')](e,emitEvent(event));}}module[_0x5dfa('0xa')]=WhatsappQueueEvents; \ No newline at end of file +var _0x8715=['emit','exports','WhatsappQueue','save','update'];(function(_0x2510eb,_0x14d129){var _0x28903c=function(_0x500eec){while(--_0x500eec){_0x2510eb['push'](_0x2510eb['shift']());}};_0x28903c(++_0x14d129);}(_0x8715,0xbb));var _0x5871=function(_0x5ae5e7,_0x21508a){_0x5ae5e7=_0x5ae5e7-0x0;var _0x5a764f=_0x8715[_0x5ae5e7];return _0x5a764f;};'use strict';var EventEmitter=require('events');var WhatsappQueue=require('../../mysqldb')['db'][_0x5871('0x0')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x5871('0x1'),'afterUpdate':_0x5871('0x2'),'afterDestroy':'remove'};function emitEvent(_0x18583e){return function(_0x4d3933,_0x1743fb,_0x50d63c){WhatsappQueueEvents[_0x5871('0x3')](_0x18583e+':'+_0x4d3933['id'],_0x4d3933);WhatsappQueueEvents[_0x5871('0x3')](_0x18583e,_0x4d3933);_0x50d63c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappQueue['hook'](e,emitEvent(event));}}module[_0x5871('0x4')]=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index 22f6492..d27399b 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 _0xd3ba=['../../config/logger','api','bluebird','rimraf','../../config/environment','./whatsappQueue.attributes','define','WhatsappQueue','whatsapp_queues','lodash'];(function(_0x33ad1f,_0xfc2fc8){var _0x26ef22=function(_0x58f97c){while(--_0x58f97c){_0x33ad1f['push'](_0x33ad1f['shift']());}};_0x26ef22(++_0xfc2fc8);}(_0xd3ba,0x121));var _0xad3b=function(_0x341e0f,_0x4a09d0){_0x341e0f=_0x341e0f-0x0;var _0x59555a=_0xd3ba[_0x341e0f];return _0x59555a;};'use strict';var _=require(_0xad3b('0x0'));var util=require('util');var logger=require(_0xad3b('0x1'))(_0xad3b('0x2'));var moment=require('moment');var BPromise=require(_0xad3b('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xad3b('0x4'));var config=require(_0xad3b('0x5'));var attributes=require(_0xad3b('0x6'));module['exports']=function(_0xe86a93,_0x3cb41d){return _0xe86a93[_0xad3b('0x7')](_0xad3b('0x8'),attributes,{'tableName':_0xad3b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9f62=['whatsapp_queues','lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','./whatsappQueue.attributes','exports','define','WhatsappQueue'];(function(_0x347e44,_0x43d137){var _0x19288f=function(_0x5db905){while(--_0x5db905){_0x347e44['push'](_0x347e44['shift']());}};_0x19288f(++_0x43d137);}(_0x9f62,0x194));var _0x29f6=function(_0x2b1c05,_0x5180ee){_0x2b1c05=_0x2b1c05-0x0;var _0x3a93e8=_0x9f62[_0x2b1c05];return _0x3a93e8;};'use strict';var _=require(_0x29f6('0x0'));var util=require(_0x29f6('0x1'));var logger=require('../../config/logger')(_0x29f6('0x2'));var moment=require(_0x29f6('0x3'));var BPromise=require(_0x29f6('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x29f6('0x5'));var rimraf=require(_0x29f6('0x6'));var config=require(_0x29f6('0x7'));var attributes=require(_0x29f6('0x8'));module[_0x29f6('0x9')]=function(_0x8a109c,_0x1e104b){return _0x8a109c[_0x29f6('0xa')](_0x29f6('0xb'),attributes,{'tableName':_0x29f6('0xc'),'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 69d88d3..b179be6 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 _0x2301=['WhatsappQueue','findAll','options','raw','where','include','map','attributes','info','ShowWhatsappQueue','find','model','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','register','request','then','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','WhatsappQueue,\x20%s,\x20%s','message','result','catch'];(function(_0x552fce,_0x3f24bc){var _0x3e27a2=function(_0xc91154){while(--_0xc91154){_0x552fce['push'](_0x552fce['shift']());}};_0x3e27a2(++_0x3f24bc);}(_0x2301,0xfc));var _0x1230=function(_0x32b993,_0x1c5989){_0x32b993=_0x32b993-0x0;var _0x482780=_0x2301[_0x32b993];return _0x482780;};'use strict';var _=require(_0x1230('0x0'));var util=require('util');var moment=require(_0x1230('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1230('0x2'));var db=require(_0x1230('0x3'))['db'];var utils=require(_0x1230('0x4'));var logger=require(_0x1230('0x5'))(_0x1230('0x6'));var config=require(_0x1230('0x7'));var jayson=require(_0x1230('0x8'));var client=jayson[_0x1230('0x9')]['http']({'port':0x232a});config[_0x1230('0xa')]=_[_0x1230('0xb')](config['redis'],{'host':_0x1230('0xc'),'port':0x18eb});var socket=require(_0x1230('0xd'))(new Redis(config['redis']));require(_0x1230('0xe'))[_0x1230('0xf')](socket);function respondWithRpcPromise(_0x30bc96,_0x11b01d,_0x204c9e){return new BPromise(function(_0x436f9c,_0x5656de){return client[_0x1230('0x10')](_0x30bc96,_0x204c9e)[_0x1230('0x11')](function(_0x560bce){logger['info']('WhatsappQueue,\x20%s,\x20%s',_0x11b01d,'request\x20sent');logger[_0x1230('0x12')](_0x1230('0x13'),_0x11b01d,_0x1230('0x14'),JSON[_0x1230('0x15')](_0x560bce));if(_0x560bce[_0x1230('0x16')]){if(_0x560bce['error'][_0x1230('0x17')]===0x1f4){logger[_0x1230('0x16')](_0x1230('0x18'),_0x11b01d,_0x560bce[_0x1230('0x16')][_0x1230('0x19')]);return _0x5656de(_0x560bce[_0x1230('0x16')][_0x1230('0x19')]);}logger[_0x1230('0x16')](_0x1230('0x18'),_0x11b01d,_0x560bce['error']['message']);return _0x436f9c(_0x560bce['error'][_0x1230('0x19')]);}else{logger['info']('WhatsappQueue,\x20%s,\x20%s',_0x11b01d,_0x1230('0x14'));_0x436f9c(_0x560bce[_0x1230('0x1a')][_0x1230('0x19')]);}})[_0x1230('0x1b')](function(_0x2e5f75){logger['error'](_0x1230('0x18'),_0x11b01d,_0x2e5f75);_0x5656de(_0x2e5f75);});});}exports['GetWhatsappQueue']=function(_0x1a74fa){var _0x1b2988=this;return new Promise(function(_0x48ab39,_0x10ef1f){return db[_0x1230('0x1c')][_0x1230('0x1d')]({'raw':_0x1a74fa[_0x1230('0x1e')]?_0x1a74fa[_0x1230('0x1e')][_0x1230('0x1f')]===undefined?!![]:![]:!![],'where':_0x1a74fa[_0x1230('0x1e')]?_0x1a74fa[_0x1230('0x1e')][_0x1230('0x20')]||null:null,'attributes':_0x1a74fa['options']?_0x1a74fa['options']['attributes']||null:null,'limit':_0x1a74fa[_0x1230('0x1e')]?_0x1a74fa[_0x1230('0x1e')]['limit']||null:null,'include':_0x1a74fa['options']?_0x1a74fa[_0x1230('0x1e')][_0x1230('0x21')]?_[_0x1230('0x22')](_0x1a74fa[_0x1230('0x1e')][_0x1230('0x21')],function(_0x3b6e76){return{'model':db[_0x3b6e76['model']],'as':_0x3b6e76['as'],'attributes':_0x3b6e76['attributes'],'include':_0x3b6e76[_0x1230('0x21')]?_['map'](_0x3b6e76[_0x1230('0x21')],function(_0x54c69b){return{'model':db[_0x54c69b['model']],'as':_0x54c69b['as'],'attributes':_0x54c69b[_0x1230('0x23')],'include':_0x54c69b[_0x1230('0x21')]?_[_0x1230('0x22')](_0x54c69b['include'],function(_0x5941dd){return{'model':db[_0x5941dd['model']],'as':_0x5941dd['as'],'attributes':_0x5941dd['attributes']};}):[]};}):[]};}):[]:[]})[_0x1230('0x11')](function(_0x359d4d){logger[_0x1230('0x24')]('GetWhatsappQueue',_0x1a74fa);logger[_0x1230('0x12')]('GetWhatsappQueue',_0x1a74fa,JSON[_0x1230('0x15')](_0x359d4d));_0x48ab39(_0x359d4d);})[_0x1230('0x1b')](function(_0x3ae861){logger[_0x1230('0x16')]('GetWhatsappQueue',_0x3ae861[_0x1230('0x19')],_0x1a74fa);_0x10ef1f(_0x1b2988['error'](0x1f4,_0x3ae861[_0x1230('0x19')]));});});};exports[_0x1230('0x25')]=function(_0x42ee14){var _0xd237c7=this;return new Promise(function(_0x4e8712,_0x36a968){return db[_0x1230('0x1c')][_0x1230('0x26')]({'raw':_0x42ee14[_0x1230('0x1e')]?_0x42ee14[_0x1230('0x1e')][_0x1230('0x1f')]===undefined?!![]:![]:!![],'where':_0x42ee14[_0x1230('0x1e')]?_0x42ee14[_0x1230('0x1e')][_0x1230('0x20')]||null:null,'attributes':_0x42ee14[_0x1230('0x1e')]?_0x42ee14['options']['attributes']||null:null,'include':_0x42ee14[_0x1230('0x1e')]?_0x42ee14[_0x1230('0x1e')]['include']?_[_0x1230('0x22')](_0x42ee14['options'][_0x1230('0x21')],function(_0x5c52bc){return{'model':db[_0x5c52bc[_0x1230('0x27')]],'as':_0x5c52bc['as'],'attributes':_0x5c52bc[_0x1230('0x23')],'include':_0x5c52bc[_0x1230('0x21')]?_[_0x1230('0x22')](_0x5c52bc[_0x1230('0x21')],function(_0x2ce60c){return{'model':db[_0x2ce60c[_0x1230('0x27')]],'as':_0x2ce60c['as'],'attributes':_0x2ce60c['attributes'],'include':_0x2ce60c[_0x1230('0x21')]?_['map'](_0x2ce60c[_0x1230('0x21')],function(_0x148a3f){return{'model':db[_0x148a3f[_0x1230('0x27')]],'as':_0x148a3f['as'],'attributes':_0x148a3f[_0x1230('0x23')]};}):[]};}):[]};}):[]:[]})[_0x1230('0x11')](function(_0x59d0ab){logger[_0x1230('0x24')](_0x1230('0x25'),_0x42ee14);logger['debug']('ShowWhatsappQueue',_0x42ee14,JSON['stringify'](_0x59d0ab));_0x4e8712(_0x59d0ab);})[_0x1230('0x1b')](function(_0x19d647){logger[_0x1230('0x16')]('ShowWhatsappQueue',_0x19d647[_0x1230('0x19')],_0x42ee14);_0x36a968(_0xd237c7['error'](0x1f4,_0x19d647['message']));});});}; \ No newline at end of file +var _0xc191=['code','message','catch','GetWhatsappQueue','WhatsappQueue','findAll','options','where','attributes','limit','include','map','model','ShowWhatsappQueue','find','raw','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','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','stringify','error'];(function(_0x4ef125,_0x473bed){var _0x229d6c=function(_0x4cd688){while(--_0x4cd688){_0x4ef125['push'](_0x4ef125['shift']());}};_0x229d6c(++_0x473bed);}(_0xc191,0x128));var _0x1c19=function(_0x344a3f,_0x579a22){_0x344a3f=_0x344a3f-0x0;var _0x264712=_0xc191[_0x344a3f];return _0x264712;};'use strict';var _=require('lodash');var util=require(_0x1c19('0x0'));var moment=require(_0x1c19('0x1'));var BPromise=require(_0x1c19('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1c19('0x3'))['db'];var utils=require(_0x1c19('0x4'));var logger=require(_0x1c19('0x5'))(_0x1c19('0x6'));var config=require('../../config/environment');var jayson=require(_0x1c19('0x7'));var client=jayson[_0x1c19('0x8')][_0x1c19('0x9')]({'port':0x232a});config[_0x1c19('0xa')]=_['defaults'](config[_0x1c19('0xa')],{'host':_0x1c19('0xb'),'port':0x18eb});var socket=require(_0x1c19('0xc'))(new Redis(config[_0x1c19('0xa')]));require(_0x1c19('0xd'))[_0x1c19('0xe')](socket);function respondWithRpcPromise(_0x5abb4c,_0x853560,_0x2f4bb0){return new BPromise(function(_0x918d29,_0x3f87ea){return client[_0x1c19('0xf')](_0x5abb4c,_0x2f4bb0)[_0x1c19('0x10')](function(_0x575175){logger[_0x1c19('0x11')](_0x1c19('0x12'),_0x853560,_0x1c19('0x13'));logger[_0x1c19('0x14')](_0x1c19('0x15'),_0x853560,'request\x20sent',JSON[_0x1c19('0x16')](_0x575175));if(_0x575175[_0x1c19('0x17')]){if(_0x575175['error'][_0x1c19('0x18')]===0x1f4){logger[_0x1c19('0x17')](_0x1c19('0x12'),_0x853560,_0x575175['error'][_0x1c19('0x19')]);return _0x3f87ea(_0x575175[_0x1c19('0x17')][_0x1c19('0x19')]);}logger[_0x1c19('0x17')](_0x1c19('0x12'),_0x853560,_0x575175[_0x1c19('0x17')][_0x1c19('0x19')]);return _0x918d29(_0x575175['error'][_0x1c19('0x19')]);}else{logger[_0x1c19('0x11')]('WhatsappQueue,\x20%s,\x20%s',_0x853560,_0x1c19('0x13'));_0x918d29(_0x575175['result'][_0x1c19('0x19')]);}})[_0x1c19('0x1a')](function(_0x3975ef){logger[_0x1c19('0x17')]('WhatsappQueue,\x20%s,\x20%s',_0x853560,_0x3975ef);_0x3f87ea(_0x3975ef);});});}exports[_0x1c19('0x1b')]=function(_0x5a564e){var _0x50911e=this;return new Promise(function(_0x2b0a50,_0xdc4d19){return db[_0x1c19('0x1c')][_0x1c19('0x1d')]({'raw':_0x5a564e[_0x1c19('0x1e')]?_0x5a564e[_0x1c19('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x5a564e[_0x1c19('0x1e')]?_0x5a564e['options'][_0x1c19('0x1f')]||null:null,'attributes':_0x5a564e['options']?_0x5a564e['options'][_0x1c19('0x20')]||null:null,'limit':_0x5a564e[_0x1c19('0x1e')]?_0x5a564e[_0x1c19('0x1e')][_0x1c19('0x21')]||null:null,'include':_0x5a564e[_0x1c19('0x1e')]?_0x5a564e[_0x1c19('0x1e')][_0x1c19('0x22')]?_[_0x1c19('0x23')](_0x5a564e[_0x1c19('0x1e')]['include'],function(_0x491de2){return{'model':db[_0x491de2[_0x1c19('0x24')]],'as':_0x491de2['as'],'attributes':_0x491de2['attributes'],'include':_0x491de2[_0x1c19('0x22')]?_[_0x1c19('0x23')](_0x491de2[_0x1c19('0x22')],function(_0x4c214b){return{'model':db[_0x4c214b['model']],'as':_0x4c214b['as'],'attributes':_0x4c214b[_0x1c19('0x20')],'include':_0x4c214b['include']?_['map'](_0x4c214b['include'],function(_0x2455b2){return{'model':db[_0x2455b2[_0x1c19('0x24')]],'as':_0x2455b2['as'],'attributes':_0x2455b2[_0x1c19('0x20')]};}):[]};}):[]};}):[]:[]})[_0x1c19('0x10')](function(_0x278fe2){logger[_0x1c19('0x11')]('GetWhatsappQueue',_0x5a564e);logger[_0x1c19('0x14')]('GetWhatsappQueue',_0x5a564e,JSON[_0x1c19('0x16')](_0x278fe2));_0x2b0a50(_0x278fe2);})[_0x1c19('0x1a')](function(_0x47c284){logger[_0x1c19('0x17')]('GetWhatsappQueue',_0x47c284[_0x1c19('0x19')],_0x5a564e);_0xdc4d19(_0x50911e[_0x1c19('0x17')](0x1f4,_0x47c284[_0x1c19('0x19')]));});});};exports[_0x1c19('0x25')]=function(_0x36b210){var _0x227737=this;return new Promise(function(_0x2aadce,_0x26d147){return db[_0x1c19('0x1c')][_0x1c19('0x26')]({'raw':_0x36b210[_0x1c19('0x1e')]?_0x36b210[_0x1c19('0x1e')][_0x1c19('0x27')]===undefined?!![]:![]:!![],'where':_0x36b210['options']?_0x36b210[_0x1c19('0x1e')][_0x1c19('0x1f')]||null:null,'attributes':_0x36b210[_0x1c19('0x1e')]?_0x36b210[_0x1c19('0x1e')][_0x1c19('0x20')]||null:null,'include':_0x36b210['options']?_0x36b210[_0x1c19('0x1e')][_0x1c19('0x22')]?_['map'](_0x36b210[_0x1c19('0x1e')]['include'],function(_0x40adf4){return{'model':db[_0x40adf4[_0x1c19('0x24')]],'as':_0x40adf4['as'],'attributes':_0x40adf4[_0x1c19('0x20')],'include':_0x40adf4[_0x1c19('0x22')]?_[_0x1c19('0x23')](_0x40adf4[_0x1c19('0x22')],function(_0x2ba852){return{'model':db[_0x2ba852[_0x1c19('0x24')]],'as':_0x2ba852['as'],'attributes':_0x2ba852['attributes'],'include':_0x2ba852[_0x1c19('0x22')]?_[_0x1c19('0x23')](_0x2ba852[_0x1c19('0x22')],function(_0xacd076){return{'model':db[_0xacd076[_0x1c19('0x24')]],'as':_0xacd076['as'],'attributes':_0xacd076[_0x1c19('0x20')]};}):[]};}):[]};}):[]:[]})[_0x1c19('0x10')](function(_0x465117){logger[_0x1c19('0x11')]('ShowWhatsappQueue',_0x36b210);logger[_0x1c19('0x14')](_0x1c19('0x25'),_0x36b210,JSON[_0x1c19('0x16')](_0x465117));_0x2aadce(_0x465117);})[_0x1c19('0x1a')](function(_0x2b7a32){logger[_0x1c19('0x17')](_0x1c19('0x25'),_0x2b7a32['message'],_0x36b210);_0x26d147(_0x227737[_0x1c19('0x17')](0x1f4,_0x2b7a32['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index e38f31e..b121248 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 _0x080f=['remove','update','removeListener','register','length','whatsappQueue:','save'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x080f,0x1f0));var _0xf080=function(_0xc38661,_0x3cf94e){_0xc38661=_0xc38661-0x0;var _0x6fd6c8=_0x080f[_0xc38661];return _0x6fd6c8;};'use strict';var WhatsappQueueEvents=require('./whatsappQueue.events');var events=[_0xf080('0x0'),_0xf080('0x1'),_0xf080('0x2')];function createListener(_0x25143e,_0x4dafcd){return function(_0x153001){_0x4dafcd['emit'](_0x25143e,_0x153001);};}function removeListener(_0x1ec65b,_0x5f0e6a){return function(){WhatsappQueueEvents[_0xf080('0x3')](_0x1ec65b,_0x5f0e6a);};}exports[_0xf080('0x4')]=function(_0x2231f5){for(var _0x299b5c=0x0,_0x18cc03=events[_0xf080('0x5')];_0x299b5c<_0x18cc03;_0x299b5c++){var _0x4e4a95=events[_0x299b5c];var _0x47d99e=createListener(_0xf080('0x6')+_0x4e4a95,_0x2231f5);WhatsappQueueEvents['on'](_0x4e4a95,_0x47d99e);}}; \ No newline at end of file +var _0x4ae3=['emit','removeListener','whatsappQueue:','./whatsappQueue.events','save','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4ae3,0xed));var _0x34ae=function(_0x6ff984,_0x52fbd1){_0x6ff984=_0x6ff984-0x0;var _0x1b8400=_0x4ae3[_0x6ff984];return _0x1b8400;};'use strict';var WhatsappQueueEvents=require(_0x34ae('0x0'));var events=[_0x34ae('0x1'),'remove',_0x34ae('0x2')];function createListener(_0x45667d,_0x483070){return function(_0x2218a3){_0x483070[_0x34ae('0x3')](_0x45667d,_0x2218a3);};}function removeListener(_0x42ee6a,_0x35f989){return function(){WhatsappQueueEvents[_0x34ae('0x4')](_0x42ee6a,_0x35f989);};}exports['register']=function(_0x18a859){for(var _0x270fec=0x0,_0x1cf2b6=events['length'];_0x270fec<_0x1cf2b6;_0x270fec++){var _0x62e9c6=events[_0x270fec];var _0x206437=createListener(_0x34ae('0x5')+_0x62e9c6,_0x18a859);WhatsappQueueEvents['on'](_0x62e9c6,_0x206437);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index 826d478..951f546 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 _0xc8c9=['../../components/auth/service','../../components/interaction/service','./whatsappQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','put','delete','destroy','multer','util','path','connect-timeout','express','Router'];(function(_0x310170,_0x391a8a){var _0x11d7f8=function(_0x4921cf){while(--_0x4921cf){_0x310170['push'](_0x310170['shift']());}};_0x11d7f8(++_0x391a8a);}(_0xc8c9,0x176));var _0x9c8c=function(_0x8dc04d,_0xaa7559){_0x8dc04d=_0x8dc04d-0x0;var _0x2f5f28=_0xc8c9[_0x8dc04d];return _0x2f5f28;};'use strict';var multer=require(_0x9c8c('0x0'));var util=require(_0x9c8c('0x1'));var path=require(_0x9c8c('0x2'));var timeout=require(_0x9c8c('0x3'));var express=require(_0x9c8c('0x4'));var router=express[_0x9c8c('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x9c8c('0x6'));var interaction=require(_0x9c8c('0x7'));var config=require('../../config/environment');var controller=require(_0x9c8c('0x8'));router[_0x9c8c('0x9')]('/',auth[_0x9c8c('0xa')](),controller[_0x9c8c('0xb')]);router[_0x9c8c('0x9')](_0x9c8c('0xc'),auth[_0x9c8c('0xa')](),controller[_0x9c8c('0xd')]);router[_0x9c8c('0x9')](_0x9c8c('0xe'),auth[_0x9c8c('0xa')](),controller[_0x9c8c('0xf')]);router[_0x9c8c('0x10')]('/',auth[_0x9c8c('0xa')](),controller['create']);router[_0x9c8c('0x11')](_0x9c8c('0xe'),auth[_0x9c8c('0xa')](),controller['update']);router[_0x9c8c('0x12')]('/:id',auth[_0x9c8c('0xa')](),controller[_0x9c8c('0x13')]);module['exports']=router; \ No newline at end of file +var _0x6a4c=['/:id','show','post','put','update','delete','multer','util','path','express','Router','../../config/environment','./whatsappQueueReport.controller','get','isAuthenticated','index','describe'];(function(_0x68ebe2,_0x43024f){var _0x170218=function(_0x16eb0f){while(--_0x16eb0f){_0x68ebe2['push'](_0x68ebe2['shift']());}};_0x170218(++_0x43024f);}(_0x6a4c,0x17c));var _0xc6a4=function(_0x32b90c,_0xba4e6){_0x32b90c=_0x32b90c-0x0;var _0x3cf23c=_0x6a4c[_0x32b90c];return _0x3cf23c;};'use strict';var multer=require(_0xc6a4('0x0'));var util=require(_0xc6a4('0x1'));var path=require(_0xc6a4('0x2'));var timeout=require('connect-timeout');var express=require(_0xc6a4('0x3'));var router=express[_0xc6a4('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xc6a4('0x5'));var controller=require(_0xc6a4('0x6'));router[_0xc6a4('0x7')]('/',auth[_0xc6a4('0x8')](),controller[_0xc6a4('0x9')]);router['get']('/describe',auth[_0xc6a4('0x8')](),controller[_0xc6a4('0xa')]);router['get'](_0xc6a4('0xb'),auth[_0xc6a4('0x8')](),controller[_0xc6a4('0xc')]);router[_0xc6a4('0xd')]('/',auth[_0xc6a4('0x8')](),controller['create']);router[_0xc6a4('0xe')]('/:id',auth[_0xc6a4('0x8')](),controller[_0xc6a4('0xf')]);router[_0xc6a4('0x10')]('/:id',auth[_0xc6a4('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index 2784428..5eaf7b1 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(_0x193fc1,_0x5a323a){var _0xeaa5a9=function(_0x3586ba){while(--_0x3586ba){_0x193fc1['push'](_0x193fc1['shift']());}};_0xeaa5a9(++_0x5a323a);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'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 _0x7a54=['STRING','DATE','sequelize','exports'];(function(_0x52014c,_0x151491){var _0x5605f8=function(_0x2d02b1){while(--_0x2d02b1){_0x52014c['push'](_0x52014c['shift']());}};_0x5605f8(++_0x151491);}(_0x7a54,0x106));var _0x47a5=function(_0x3485b3,_0xe2c036){_0x3485b3=_0x3485b3-0x0;var _0x2bbf58=_0x7a54[_0x3485b3];return _0x2bbf58;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'uniqueid':{'type':Sequelize[_0x47a5('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x47a5('0x3')]},'leaveAt':{'type':Sequelize[_0x47a5('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x47a5('0x3')]},'reason':{'type':Sequelize[_0x47a5('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js index 7a2e11f..6267c80 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 _0xbee3=['desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../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','map','WhatsappQueueReport','rawAttributes','type','key','model','keys','query','attributes','intersection','fields','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','length','body','find','describe','rimraf','request-promise','moment','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce'];(function(_0x5a776b,_0x46f785){var _0xbbef59=function(_0x38313e){while(--_0x38313e){_0x5a776b['push'](_0x5a776b['shift']());}};_0xbbef59(++_0x46f785);}(_0xbee3,0xd5));var _0x3bee=function(_0x43a706,_0x2c49d9){_0x43a706=_0x43a706-0x0;var _0x4b6f7a=_0xbee3[_0x43a706];return _0x4b6f7a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3bee('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x3bee('0x1'));var moment=require(_0x3bee('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x3bee('0x3'));var util=require(_0x3bee('0x4'));var path=require(_0x3bee('0x5'));var sox=require('sox');var csv=require(_0x3bee('0x6'));var ejs=require(_0x3bee('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3bee('0x8'));var squel=require(_0x3bee('0x9'));var crypto=require(_0x3bee('0xa'));var jsforce=require(_0x3bee('0xb'));var deskjs=require(_0x3bee('0xc'));var toCsv=require(_0x3bee('0x6'));var querystring=require(_0x3bee('0xd'));var Papa=require('papaparse');var Redis=require(_0x3bee('0xe'));var authService=require(_0x3bee('0xf'));var qs=require(_0x3bee('0x10'));var as=require(_0x3bee('0x11'));var hardwareService=require(_0x3bee('0x12'));var logger=require(_0x3bee('0x13'))('api');var utils=require(_0x3bee('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x3bee('0x15'));var db=require(_0x3bee('0x16'))['db'];function respondWithStatusCode(_0x407526,_0x6950d0){_0x6950d0=_0x6950d0||0xcc;return function(_0x410124){if(_0x410124){return _0x407526[_0x3bee('0x17')](_0x6950d0);}return _0x407526[_0x3bee('0x18')](_0x6950d0)['end']();};}function respondWithResult(_0xad01f9,_0x33504d){_0x33504d=_0x33504d||0xc8;return function(_0x31ac52){if(_0x31ac52){return _0xad01f9[_0x3bee('0x18')](_0x33504d)[_0x3bee('0x19')](_0x31ac52);}};}function respondWithFilteredResult(_0x5b9473,_0x558436){return function(_0x346767){if(_0x346767){var _0x515397=typeof _0x558436[_0x3bee('0x1a')]===_0x3bee('0x1b')&&typeof _0x558436['limit']==='undefined';var _0x1582a4=_0x346767[_0x3bee('0x1c')];var _0xfdba3b=_0x515397?0x0:_0x558436[_0x3bee('0x1a')];var _0x49095a=_0x515397?_0x346767[_0x3bee('0x1c')]:_0x558436[_0x3bee('0x1a')]+_0x558436[_0x3bee('0x1d')];var _0x49b32d;if(_0x49095a>=_0x1582a4){_0x49095a=_0x1582a4;_0x49b32d=0xc8;}else{_0x49b32d=0xce;}_0x5b9473[_0x3bee('0x18')](_0x49b32d);return _0x5b9473[_0x3bee('0x1e')](_0x3bee('0x1f'),_0xfdba3b+'-'+_0x49095a+'/'+_0x1582a4)['json'](_0x346767);}return null;};}function patchUpdates(_0x4f36af){return function(_0x1afd0f){try{jsonpatch[_0x3bee('0x20')](_0x1afd0f,_0x4f36af,!![]);}catch(_0x57aba4){return BPromise[_0x3bee('0x21')](_0x57aba4);}return _0x1afd0f[_0x3bee('0x22')]();};}function saveUpdates(_0x2eea75,_0x179e62){return function(_0x28c248){if(_0x28c248){return _0x28c248[_0x3bee('0x23')](_0x2eea75)[_0x3bee('0x24')](function(_0x582fa9){return _0x582fa9;});}return null;};}function removeEntity(_0x8ae4ca,_0x1ed0c1){return function(_0x1fed5a){if(_0x1fed5a){return _0x1fed5a[_0x3bee('0x25')]()['then'](function(){_0x8ae4ca[_0x3bee('0x18')](0xcc)[_0x3bee('0x26')]();});}};}function handleEntityNotFound(_0x1e0111,_0x4b4cd4){return function(_0x5ed022){if(!_0x5ed022){_0x1e0111[_0x3bee('0x17')](0x194);}return _0x5ed022;};}function handleError(_0x479f45,_0x5341e2){_0x5341e2=_0x5341e2||0x1f4;return function(_0x2c0e50){logger[_0x3bee('0x27')](_0x2c0e50[_0x3bee('0x28')]);if(_0x2c0e50['name']){delete _0x2c0e50[_0x3bee('0x29')];}_0x479f45[_0x3bee('0x18')](_0x5341e2)[_0x3bee('0x2a')](_0x2c0e50);};}exports['index']=function(_0x239fa4,_0xf08fb3){var _0x3a3d92={},_0x496abd={},_0x1115ed={'count':0x0,'rows':[]};var _0x24d523=_[_0x3bee('0x2b')](db[_0x3bee('0x2c')][_0x3bee('0x2d')],function(_0x559c2b){return{'name':_0x559c2b['fieldName'],'type':_0x559c2b[_0x3bee('0x2e')][_0x3bee('0x2f')]};});_0x496abd[_0x3bee('0x30')]=_[_0x3bee('0x2b')](_0x24d523,'name');_0x496abd['query']=_[_0x3bee('0x31')](_0x239fa4[_0x3bee('0x32')]);_0x496abd['filters']=_['intersection'](_0x496abd[_0x3bee('0x30')],_0x496abd[_0x3bee('0x32')]);_0x3a3d92[_0x3bee('0x33')]=_[_0x3bee('0x34')](_0x496abd[_0x3bee('0x30')],qs[_0x3bee('0x35')](_0x239fa4[_0x3bee('0x32')][_0x3bee('0x35')]));_0x3a3d92[_0x3bee('0x33')]=_0x3a3d92[_0x3bee('0x33')]['length']?_0x3a3d92['attributes']:_0x496abd[_0x3bee('0x30')];if(!_0x239fa4['query']['hasOwnProperty'](_0x3bee('0x36'))){_0x3a3d92[_0x3bee('0x1d')]=qs[_0x3bee('0x1d')](_0x239fa4[_0x3bee('0x32')][_0x3bee('0x1d')]);_0x3a3d92[_0x3bee('0x1a')]=qs[_0x3bee('0x1a')](_0x239fa4[_0x3bee('0x32')]['offset']);}_0x3a3d92[_0x3bee('0x37')]=qs[_0x3bee('0x38')](_0x239fa4['query'][_0x3bee('0x38')]);_0x3a3d92[_0x3bee('0x39')]=qs[_0x3bee('0x3a')](_[_0x3bee('0x3b')](_0x239fa4[_0x3bee('0x32')],_0x496abd['filters']),_0x24d523);if(_0x239fa4['query'][_0x3bee('0x3c')]){_0x3a3d92[_0x3bee('0x39')]=_[_0x3bee('0x3d')](_0x3a3d92[_0x3bee('0x39')],{'$or':_[_0x3bee('0x2b')](_0x24d523,function(_0x3d9656){if(_0x3d9656[_0x3bee('0x2e')]!==_0x3bee('0x3e')){var _0x2fb349={};_0x2fb349[_0x3d9656[_0x3bee('0x29')]]={'$like':'%'+_0x239fa4[_0x3bee('0x32')][_0x3bee('0x3c')]+'%'};return _0x2fb349;}})});}_0x3a3d92=_['merge']({},_0x3a3d92,_0x239fa4[_0x3bee('0x3f')]);var _0x1b5eca={'where':_0x3a3d92[_0x3bee('0x39')]};return db[_0x3bee('0x2c')][_0x3bee('0x1c')](_0x1b5eca)[_0x3bee('0x24')](function(_0x1622b9){_0x1115ed[_0x3bee('0x1c')]=_0x1622b9;if(_0x239fa4[_0x3bee('0x32')][_0x3bee('0x40')]){_0x3a3d92[_0x3bee('0x41')]=[{'all':!![]}];}return db[_0x3bee('0x2c')][_0x3bee('0x42')](_0x3a3d92);})['then'](function(_0x2b773d){_0x1115ed[_0x3bee('0x43')]=_0x2b773d;return _0x1115ed;})[_0x3bee('0x24')](respondWithFilteredResult(_0xf08fb3,_0x3a3d92))[_0x3bee('0x44')](handleError(_0xf08fb3,null));};exports[_0x3bee('0x45')]=function(_0x44489f,_0x13dd72){var _0xd1140d={'raw':!![],'where':{'id':_0x44489f[_0x3bee('0x46')]['id']}},_0x5d9e1b={};_0x5d9e1b[_0x3bee('0x30')]=_[_0x3bee('0x31')](db['WhatsappQueueReport'][_0x3bee('0x2d')]);_0x5d9e1b['query']=_[_0x3bee('0x31')](_0x44489f['query']);_0x5d9e1b['filters']=_[_0x3bee('0x34')](_0x5d9e1b[_0x3bee('0x30')],_0x5d9e1b[_0x3bee('0x32')]);_0xd1140d[_0x3bee('0x33')]=_[_0x3bee('0x34')](_0x5d9e1b['model'],qs['fields'](_0x44489f[_0x3bee('0x32')]['fields']));_0xd1140d[_0x3bee('0x33')]=_0xd1140d['attributes'][_0x3bee('0x47')]?_0xd1140d['attributes']:_0x5d9e1b[_0x3bee('0x30')];if(_0x44489f[_0x3bee('0x32')][_0x3bee('0x40')]){_0xd1140d[_0x3bee('0x41')]=[{'all':!![]}];}_0xd1140d=_['merge']({},_0xd1140d,_0x44489f['options']);return db[_0x3bee('0x2c')]['find'](_0xd1140d)['then'](handleEntityNotFound(_0x13dd72,null))['then'](respondWithResult(_0x13dd72,null))[_0x3bee('0x44')](handleError(_0x13dd72,null));};exports['create']=function(_0x125fa5,_0x33d615){return db[_0x3bee('0x2c')]['create'](_0x125fa5[_0x3bee('0x48')],{})['then'](respondWithResult(_0x33d615,0xc9))[_0x3bee('0x44')](handleError(_0x33d615,null));};exports['update']=function(_0x26ccd7,_0x16b096){if(_0x26ccd7[_0x3bee('0x48')]['id']){delete _0x26ccd7['body']['id'];}return db[_0x3bee('0x2c')][_0x3bee('0x49')]({'where':{'id':_0x26ccd7[_0x3bee('0x46')]['id']}})['then'](handleEntityNotFound(_0x16b096,null))['then'](saveUpdates(_0x26ccd7[_0x3bee('0x48')],null))[_0x3bee('0x24')](respondWithResult(_0x16b096,null))[_0x3bee('0x44')](handleError(_0x16b096,null));};exports[_0x3bee('0x25')]=function(_0x3b5d7a,_0x21ab40){return db[_0x3bee('0x2c')]['find']({'where':{'id':_0x3b5d7a[_0x3bee('0x46')]['id']}})[_0x3bee('0x24')](handleEntityNotFound(_0x21ab40,null))['then'](removeEntity(_0x21ab40,null))['catch'](handleError(_0x21ab40,null));};exports[_0x3bee('0x4a')]=function(_0x5d4755,_0x1cb54e){return db[_0x3bee('0x2c')][_0x3bee('0x4a')]()['then'](respondWithResult(_0x1cb54e,null))[_0x3bee('0x44')](handleError(_0x1cb54e,null));}; \ No newline at end of file +var _0xe511=['destroy','describe','eml-format','rimraf','fast-json-patch','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','Content-Range','save','update','then','error','name','send','map','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','include','WhatsappQueueReport','findAll','catch','show','params','rawAttributes','find','create','body'];(function(_0x113afe,_0x50d443){var _0x190729=function(_0x44d9e3){while(--_0x44d9e3){_0x113afe['push'](_0x113afe['shift']());}};_0x190729(++_0x50d443);}(_0xe511,0x16f));var _0x1e51=function(_0x42d7f4,_0x5e9ae8){_0x42d7f4=_0x42d7f4-0x0;var _0x49e630=_0xe511[_0x42d7f4];return _0x49e630;};'use strict';var emlformat=require(_0x1e51('0x0'));var rimraf=require(_0x1e51('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1e51('0x2'));var rp=require('request-promise');var moment=require(_0x1e51('0x3'));var BPromise=require(_0x1e51('0x4'));var Mustache=require('mustache');var util=require(_0x1e51('0x5'));var path=require(_0x1e51('0x6'));var sox=require(_0x1e51('0x7'));var csv=require(_0x1e51('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1e51('0x9'));var _=require(_0x1e51('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x1e51('0xb'));var deskjs=require(_0x1e51('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x1e51('0xd'));var Redis=require(_0x1e51('0xe'));var authService=require(_0x1e51('0xf'));var qs=require(_0x1e51('0x10'));var as=require(_0x1e51('0x11'));var hardwareService=require(_0x1e51('0x12'));var logger=require('../../config/logger')(_0x1e51('0x13'));var utils=require(_0x1e51('0x14'));var config=require(_0x1e51('0x15'));var licenseUtil=require(_0x1e51('0x16'));var db=require(_0x1e51('0x17'))['db'];function respondWithStatusCode(_0x3c5330,_0x5544eb){_0x5544eb=_0x5544eb||0xcc;return function(_0x408a77){if(_0x408a77){return _0x3c5330[_0x1e51('0x18')](_0x5544eb);}return _0x3c5330[_0x1e51('0x19')](_0x5544eb)[_0x1e51('0x1a')]();};}function respondWithResult(_0x21bcbd,_0x32945d){_0x32945d=_0x32945d||0xc8;return function(_0x441c70){if(_0x441c70){return _0x21bcbd[_0x1e51('0x19')](_0x32945d)[_0x1e51('0x1b')](_0x441c70);}};}function respondWithFilteredResult(_0xd76fba,_0x5a5c07){return function(_0x3b01b7){if(_0x3b01b7){var _0x24db4f=typeof _0x5a5c07[_0x1e51('0x1c')]==='undefined'&&typeof _0x5a5c07[_0x1e51('0x1d')]==='undefined';var _0x53d222=_0x3b01b7[_0x1e51('0x1e')];var _0x27dcad=_0x24db4f?0x0:_0x5a5c07[_0x1e51('0x1c')];var _0x4785a5=_0x24db4f?_0x3b01b7[_0x1e51('0x1e')]:_0x5a5c07[_0x1e51('0x1c')]+_0x5a5c07['limit'];var _0x39449b;if(_0x4785a5>=_0x53d222){_0x4785a5=_0x53d222;_0x39449b=0xc8;}else{_0x39449b=0xce;}_0xd76fba['status'](_0x39449b);return _0xd76fba[_0x1e51('0x1f')](_0x1e51('0x20'),_0x27dcad+'-'+_0x4785a5+'/'+_0x53d222)[_0x1e51('0x1b')](_0x3b01b7);}return null;};}function patchUpdates(_0x183a95){return function(_0x506f40){try{jsonpatch['apply'](_0x506f40,_0x183a95,!![]);}catch(_0x4e6a49){return BPromise['reject'](_0x4e6a49);}return _0x506f40[_0x1e51('0x21')]();};}function saveUpdates(_0x4f1f56,_0x3f7340){return function(_0x28aacb){if(_0x28aacb){return _0x28aacb[_0x1e51('0x22')](_0x4f1f56)[_0x1e51('0x23')](function(_0x23c85a){return _0x23c85a;});}return null;};}function removeEntity(_0xf9298,_0x270adf){return function(_0x461d3d){if(_0x461d3d){return _0x461d3d['destroy']()['then'](function(){_0xf9298[_0x1e51('0x19')](0xcc)[_0x1e51('0x1a')]();});}};}function handleEntityNotFound(_0x2e42b1,_0x1386db){return function(_0x505d79){if(!_0x505d79){_0x2e42b1['sendStatus'](0x194);}return _0x505d79;};}function handleError(_0x486ad6,_0x1eb83f){_0x1eb83f=_0x1eb83f||0x1f4;return function(_0x2a1561){logger[_0x1e51('0x24')](_0x2a1561['stack']);if(_0x2a1561[_0x1e51('0x25')]){delete _0x2a1561['name'];}_0x486ad6['status'](_0x1eb83f)[_0x1e51('0x26')](_0x2a1561);};}exports['index']=function(_0x170ec6,_0x1eb79f){var _0x56722f={},_0x3e6ef2={},_0x10ee23={'count':0x0,'rows':[]};var _0x71c7af=_[_0x1e51('0x27')](db['WhatsappQueueReport']['rawAttributes'],function(_0x4f67d3){return{'name':_0x4f67d3[_0x1e51('0x28')],'type':_0x4f67d3[_0x1e51('0x29')][_0x1e51('0x2a')]};});_0x3e6ef2[_0x1e51('0x2b')]=_[_0x1e51('0x27')](_0x71c7af,_0x1e51('0x25'));_0x3e6ef2[_0x1e51('0x2c')]=_[_0x1e51('0x2d')](_0x170ec6[_0x1e51('0x2c')]);_0x3e6ef2[_0x1e51('0x2e')]=_[_0x1e51('0x2f')](_0x3e6ef2['model'],_0x3e6ef2[_0x1e51('0x2c')]);_0x56722f[_0x1e51('0x30')]=_[_0x1e51('0x2f')](_0x3e6ef2[_0x1e51('0x2b')],qs[_0x1e51('0x31')](_0x170ec6['query'][_0x1e51('0x31')]));_0x56722f['attributes']=_0x56722f[_0x1e51('0x30')][_0x1e51('0x32')]?_0x56722f[_0x1e51('0x30')]:_0x3e6ef2['model'];if(!_0x170ec6[_0x1e51('0x2c')]['hasOwnProperty'](_0x1e51('0x33'))){_0x56722f['limit']=qs['limit'](_0x170ec6[_0x1e51('0x2c')][_0x1e51('0x1d')]);_0x56722f[_0x1e51('0x1c')]=qs['offset'](_0x170ec6[_0x1e51('0x2c')]['offset']);}_0x56722f[_0x1e51('0x34')]=qs[_0x1e51('0x35')](_0x170ec6['query'][_0x1e51('0x35')]);_0x56722f[_0x1e51('0x36')]=qs[_0x1e51('0x2e')](_[_0x1e51('0x37')](_0x170ec6[_0x1e51('0x2c')],_0x3e6ef2[_0x1e51('0x2e')]),_0x71c7af);if(_0x170ec6['query']['filter']){_0x56722f[_0x1e51('0x36')]=_['merge'](_0x56722f[_0x1e51('0x36')],{'$or':_[_0x1e51('0x27')](_0x71c7af,function(_0x32c41b){if(_0x32c41b[_0x1e51('0x29')]!==_0x1e51('0x38')){var _0x174a24={};_0x174a24[_0x32c41b[_0x1e51('0x25')]]={'$like':'%'+_0x170ec6[_0x1e51('0x2c')][_0x1e51('0x39')]+'%'};return _0x174a24;}})});}_0x56722f=_[_0x1e51('0x3a')]({},_0x56722f,_0x170ec6[_0x1e51('0x3b')]);var _0x5360b3={'where':_0x56722f[_0x1e51('0x36')]};return db['WhatsappQueueReport'][_0x1e51('0x1e')](_0x5360b3)[_0x1e51('0x23')](function(_0x2b287e){_0x10ee23[_0x1e51('0x1e')]=_0x2b287e;if(_0x170ec6[_0x1e51('0x2c')][_0x1e51('0x3c')]){_0x56722f[_0x1e51('0x3d')]=[{'all':!![]}];}return db[_0x1e51('0x3e')][_0x1e51('0x3f')](_0x56722f);})[_0x1e51('0x23')](function(_0xc40fce){_0x10ee23['rows']=_0xc40fce;return _0x10ee23;})['then'](respondWithFilteredResult(_0x1eb79f,_0x56722f))[_0x1e51('0x40')](handleError(_0x1eb79f,null));};exports[_0x1e51('0x41')]=function(_0x3be495,_0x4650e4){var _0x1ef3d3={'raw':!![],'where':{'id':_0x3be495[_0x1e51('0x42')]['id']}},_0x1a9e0d={};_0x1a9e0d[_0x1e51('0x2b')]=_['keys'](db[_0x1e51('0x3e')][_0x1e51('0x43')]);_0x1a9e0d[_0x1e51('0x2c')]=_[_0x1e51('0x2d')](_0x3be495[_0x1e51('0x2c')]);_0x1a9e0d[_0x1e51('0x2e')]=_[_0x1e51('0x2f')](_0x1a9e0d['model'],_0x1a9e0d[_0x1e51('0x2c')]);_0x1ef3d3[_0x1e51('0x30')]=_['intersection'](_0x1a9e0d[_0x1e51('0x2b')],qs[_0x1e51('0x31')](_0x3be495[_0x1e51('0x2c')]['fields']));_0x1ef3d3[_0x1e51('0x30')]=_0x1ef3d3[_0x1e51('0x30')][_0x1e51('0x32')]?_0x1ef3d3[_0x1e51('0x30')]:_0x1a9e0d[_0x1e51('0x2b')];if(_0x3be495[_0x1e51('0x2c')][_0x1e51('0x3c')]){_0x1ef3d3[_0x1e51('0x3d')]=[{'all':!![]}];}_0x1ef3d3=_[_0x1e51('0x3a')]({},_0x1ef3d3,_0x3be495['options']);return db[_0x1e51('0x3e')][_0x1e51('0x44')](_0x1ef3d3)['then'](handleEntityNotFound(_0x4650e4,null))[_0x1e51('0x23')](respondWithResult(_0x4650e4,null))[_0x1e51('0x40')](handleError(_0x4650e4,null));};exports[_0x1e51('0x45')]=function(_0x4f6405,_0x44468a){return db[_0x1e51('0x3e')][_0x1e51('0x45')](_0x4f6405['body'],{})[_0x1e51('0x23')](respondWithResult(_0x44468a,0xc9))['catch'](handleError(_0x44468a,null));};exports['update']=function(_0x54688b,_0x169e6c){if(_0x54688b[_0x1e51('0x46')]['id']){delete _0x54688b['body']['id'];}return db['WhatsappQueueReport'][_0x1e51('0x44')]({'where':{'id':_0x54688b[_0x1e51('0x42')]['id']}})[_0x1e51('0x23')](handleEntityNotFound(_0x169e6c,null))[_0x1e51('0x23')](saveUpdates(_0x54688b[_0x1e51('0x46')],null))[_0x1e51('0x23')](respondWithResult(_0x169e6c,null))['catch'](handleError(_0x169e6c,null));};exports[_0x1e51('0x47')]=function(_0x48a2d0,_0xf6bd35){return db[_0x1e51('0x3e')]['find']({'where':{'id':_0x48a2d0['params']['id']}})['then'](handleEntityNotFound(_0xf6bd35,null))[_0x1e51('0x23')](removeEntity(_0xf6bd35,null))[_0x1e51('0x40')](handleError(_0xf6bd35,null));};exports[_0x1e51('0x48')]=function(_0x4cdfe3,_0x2fdee1){return db[_0x1e51('0x3e')][_0x1e51('0x48')]()[_0x1e51('0x23')](respondWithResult(_0x2fdee1,null))[_0x1e51('0x40')](handleError(_0x2fdee1,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index a5e2492..966f2e6 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 _0x6d83=['define','WhatsappQueueReport','report_whatsapp_queue','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappQueueReport.attributes','exports'];(function(_0x118139,_0x7ce965){var _0x2fece9=function(_0xd145a4){while(--_0xd145a4){_0x118139['push'](_0x118139['shift']());}};_0x2fece9(++_0x7ce965);}(_0x6d83,0xf3));var _0x36d8=function(_0x1fac0a,_0x87483e){_0x1fac0a=_0x1fac0a-0x0;var _0x65b533=_0x6d83[_0x1fac0a];return _0x65b533;};'use strict';var _=require(_0x36d8('0x0'));var util=require(_0x36d8('0x1'));var logger=require(_0x36d8('0x2'))(_0x36d8('0x3'));var moment=require(_0x36d8('0x4'));var BPromise=require(_0x36d8('0x5'));var rp=require(_0x36d8('0x6'));var fs=require('fs');var path=require(_0x36d8('0x7'));var rimraf=require(_0x36d8('0x8'));var config=require(_0x36d8('0x9'));var attributes=require(_0x36d8('0xa'));module[_0x36d8('0xb')]=function(_0x7104b5,_0x17bc30){return _0x7104b5[_0x36d8('0xc')](_0x36d8('0xd'),attributes,{'tableName':_0x36d8('0xe'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x9a5e=['../../config/environment','./whatsappQueueReport.attributes','exports','WhatsappQueueReport','report_whatsapp_queue','uniqueid','lodash','util','api','moment','request-promise','path','rimraf'];(function(_0x2b3c29,_0x52132d){var _0xbf95a7=function(_0x523a64){while(--_0x523a64){_0x2b3c29['push'](_0x2b3c29['shift']());}};_0xbf95a7(++_0x52132d);}(_0x9a5e,0x124));var _0xe9a5=function(_0x2d5b2e,_0x17e2cf){_0x2d5b2e=_0x2d5b2e-0x0;var _0x29ffac=_0x9a5e[_0x2d5b2e];return _0x29ffac;};'use strict';var _=require(_0xe9a5('0x0'));var util=require(_0xe9a5('0x1'));var logger=require('../../config/logger')(_0xe9a5('0x2'));var moment=require(_0xe9a5('0x3'));var BPromise=require('bluebird');var rp=require(_0xe9a5('0x4'));var fs=require('fs');var path=require(_0xe9a5('0x5'));var rimraf=require(_0xe9a5('0x6'));var config=require(_0xe9a5('0x7'));var attributes=require(_0xe9a5('0x8'));module[_0xe9a5('0x9')]=function(_0x3641d2,_0x2b09f4){return _0x3641d2['define'](_0xe9a5('0xa'),attributes,{'tableName':_0xe9a5('0xb'),'paranoid':![],'indexes':[{'name':_0xe9a5('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index 7d7f1e5..448e419 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 _0xe8b9=['../../config/environment','jayson/promise','client','request','then','info','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','WhatsappQueueReport,\x20%s,\x20%s','message','result','catch','create','body','raw','CreateWhatsappQueueReport','UpdateWhatsappQueueReport','WhatsappQueueReport','update','options','where','attributes','limit','lodash','moment','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0xb84c59,_0x55f640){var _0x52ce1b=function(_0x4f4d33){while(--_0x4f4d33){_0xb84c59['push'](_0xb84c59['shift']());}};_0x52ce1b(++_0x55f640);}(_0xe8b9,0x1e9));var _0x9e8b=function(_0x46fdf6,_0x3e1d7b){_0x46fdf6=_0x46fdf6-0x0;var _0x1eb206=_0xe8b9[_0x46fdf6];return _0x1eb206;};'use strict';var _=require(_0x9e8b('0x0'));var util=require('util');var moment=require(_0x9e8b('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9e8b('0x2'));var db=require(_0x9e8b('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x9e8b('0x4'))(_0x9e8b('0x5'));var config=require(_0x9e8b('0x6'));var jayson=require(_0x9e8b('0x7'));var client=jayson[_0x9e8b('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x22d37b,_0x5a2586,_0x26e0aa){return new BPromise(function(_0x278650,_0x29f906){return client[_0x9e8b('0x9')](_0x22d37b,_0x26e0aa)[_0x9e8b('0xa')](function(_0x8d5e80){logger[_0x9e8b('0xb')]('WhatsappQueueReport,\x20%s,\x20%s',_0x5a2586,'request\x20sent');logger[_0x9e8b('0xc')](_0x9e8b('0xd'),_0x5a2586,_0x9e8b('0xe'),JSON[_0x9e8b('0xf')](_0x8d5e80));if(_0x8d5e80[_0x9e8b('0x10')]){if(_0x8d5e80[_0x9e8b('0x10')][_0x9e8b('0x11')]===0x1f4){logger[_0x9e8b('0x10')](_0x9e8b('0x12'),_0x5a2586,_0x8d5e80['error']['message']);return _0x29f906(_0x8d5e80[_0x9e8b('0x10')][_0x9e8b('0x13')]);}logger[_0x9e8b('0x10')](_0x9e8b('0x12'),_0x5a2586,_0x8d5e80['error'][_0x9e8b('0x13')]);return _0x278650(_0x8d5e80[_0x9e8b('0x10')]['message']);}else{logger[_0x9e8b('0xb')](_0x9e8b('0x12'),_0x5a2586,_0x9e8b('0xe'));_0x278650(_0x8d5e80[_0x9e8b('0x14')][_0x9e8b('0x13')]);}})[_0x9e8b('0x15')](function(_0x426888){logger['error'](_0x9e8b('0x12'),_0x5a2586,_0x426888);_0x29f906(_0x426888);});});}exports['CreateWhatsappQueueReport']=function(_0x4cb38c){var _0x49f5ff=this;return new Promise(function(_0x5daeb3,_0x416bbc){return db['WhatsappQueueReport'][_0x9e8b('0x16')](_0x4cb38c[_0x9e8b('0x17')],{'raw':_0x4cb38c['options']?_0x4cb38c['options'][_0x9e8b('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x537739){logger['info'](_0x9e8b('0x19'),_0x4cb38c);logger['debug'](_0x9e8b('0x19'),_0x4cb38c,JSON['stringify'](_0x537739));_0x5daeb3(_0x537739);})['catch'](function(_0x1519a3){logger[_0x9e8b('0x10')](_0x9e8b('0x19'),_0x1519a3[_0x9e8b('0x13')],_0x4cb38c);_0x416bbc(_0x49f5ff[_0x9e8b('0x10')](0x1f4,_0x1519a3[_0x9e8b('0x13')]));});});};exports[_0x9e8b('0x1a')]=function(_0x1acd6d){var _0x125e26=this;return new Promise(function(_0x3ed4be,_0x130efa){return db[_0x9e8b('0x1b')][_0x9e8b('0x1c')](_0x1acd6d[_0x9e8b('0x17')],{'raw':_0x1acd6d[_0x9e8b('0x1d')]?_0x1acd6d[_0x9e8b('0x1d')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1acd6d[_0x9e8b('0x1d')]?_0x1acd6d[_0x9e8b('0x1d')][_0x9e8b('0x1e')]||null:null,'attributes':_0x1acd6d[_0x9e8b('0x1d')]?_0x1acd6d[_0x9e8b('0x1d')][_0x9e8b('0x1f')]||null:null,'limit':_0x1acd6d[_0x9e8b('0x1d')]?_0x1acd6d[_0x9e8b('0x1d')][_0x9e8b('0x20')]||null:null})[_0x9e8b('0xa')](function(_0x5291fa){logger[_0x9e8b('0xb')](_0x9e8b('0x1a'),_0x1acd6d);logger[_0x9e8b('0xc')](_0x9e8b('0x1a'),_0x1acd6d,JSON[_0x9e8b('0xf')](_0x5291fa));_0x3ed4be(_0x5291fa);})['catch'](function(_0x18a0bb){logger['error'](_0x9e8b('0x1a'),_0x18a0bb[_0x9e8b('0x13')],_0x1acd6d);_0x130efa(_0x125e26['error'](0x1f4,_0x18a0bb['message']));});});}; \ No newline at end of file +var _0xfd39=['then','info','WhatsappQueueReport,\x20%s,\x20%s','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','WhatsappQueueReport','options','raw','CreateWhatsappQueueReport','debug','UpdateWhatsappQueueReport','where','attributes','limit','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','client'];(function(_0x102e37,_0x14a181){var _0x35a07c=function(_0x16577f){while(--_0x16577f){_0x102e37['push'](_0x102e37['shift']());}};_0x35a07c(++_0x14a181);}(_0xfd39,0x153));var _0x9fd3=function(_0x478946,_0x172058){_0x478946=_0x478946-0x0;var _0x110d96=_0xfd39[_0x478946];return _0x110d96;};'use strict';var _=require(_0x9fd3('0x0'));var util=require('util');var moment=require(_0x9fd3('0x1'));var BPromise=require(_0x9fd3('0x2'));var rs=require(_0x9fd3('0x3'));var fs=require('fs');var Redis=require(_0x9fd3('0x4'));var db=require(_0x9fd3('0x5'))['db'];var utils=require(_0x9fd3('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x9fd3('0x7'));var client=jayson[_0x9fd3('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4fe332,_0x4d2e02,_0x57b972){return new BPromise(function(_0x3e3b77,_0x12c4be){return client['request'](_0x4fe332,_0x57b972)[_0x9fd3('0x9')](function(_0xdac88b){logger[_0x9fd3('0xa')](_0x9fd3('0xb'),_0x4d2e02,'request\x20sent');logger['debug'](_0x9fd3('0xc'),_0x4d2e02,_0x9fd3('0xd'),JSON[_0x9fd3('0xe')](_0xdac88b));if(_0xdac88b['error']){if(_0xdac88b[_0x9fd3('0xf')][_0x9fd3('0x10')]===0x1f4){logger[_0x9fd3('0xf')]('WhatsappQueueReport,\x20%s,\x20%s',_0x4d2e02,_0xdac88b[_0x9fd3('0xf')][_0x9fd3('0x11')]);return _0x12c4be(_0xdac88b[_0x9fd3('0xf')]['message']);}logger['error']('WhatsappQueueReport,\x20%s,\x20%s',_0x4d2e02,_0xdac88b[_0x9fd3('0xf')][_0x9fd3('0x11')]);return _0x3e3b77(_0xdac88b['error'][_0x9fd3('0x11')]);}else{logger[_0x9fd3('0xa')](_0x9fd3('0xb'),_0x4d2e02,'request\x20sent');_0x3e3b77(_0xdac88b[_0x9fd3('0x12')][_0x9fd3('0x11')]);}})['catch'](function(_0x56cf1a){logger[_0x9fd3('0xf')](_0x9fd3('0xb'),_0x4d2e02,_0x56cf1a);_0x12c4be(_0x56cf1a);});});}exports['CreateWhatsappQueueReport']=function(_0x1a51cc){var _0x330b7e=this;return new Promise(function(_0x57d7f7,_0x4bd74f){return db[_0x9fd3('0x13')]['create'](_0x1a51cc['body'],{'raw':_0x1a51cc[_0x9fd3('0x14')]?_0x1a51cc['options'][_0x9fd3('0x15')]===undefined?!![]:![]:!![]})[_0x9fd3('0x9')](function(_0x560dcd){logger['info'](_0x9fd3('0x16'),_0x1a51cc);logger[_0x9fd3('0x17')](_0x9fd3('0x16'),_0x1a51cc,JSON[_0x9fd3('0xe')](_0x560dcd));_0x57d7f7(_0x560dcd);})['catch'](function(_0x2e8816){logger[_0x9fd3('0xf')]('CreateWhatsappQueueReport',_0x2e8816['message'],_0x1a51cc);_0x4bd74f(_0x330b7e[_0x9fd3('0xf')](0x1f4,_0x2e8816[_0x9fd3('0x11')]));});});};exports[_0x9fd3('0x18')]=function(_0x5e7727){var _0x2ce837=this;return new Promise(function(_0x3d6138,_0x2d8c8b){return db['WhatsappQueueReport']['update'](_0x5e7727['body'],{'raw':_0x5e7727[_0x9fd3('0x14')]?_0x5e7727['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5e7727[_0x9fd3('0x14')]?_0x5e7727[_0x9fd3('0x14')][_0x9fd3('0x19')]||null:null,'attributes':_0x5e7727[_0x9fd3('0x14')]?_0x5e7727[_0x9fd3('0x14')][_0x9fd3('0x1a')]||null:null,'limit':_0x5e7727[_0x9fd3('0x14')]?_0x5e7727[_0x9fd3('0x14')][_0x9fd3('0x1b')]||null:null})[_0x9fd3('0x9')](function(_0x286771){logger[_0x9fd3('0xa')](_0x9fd3('0x18'),_0x5e7727);logger[_0x9fd3('0x17')](_0x9fd3('0x18'),_0x5e7727,JSON[_0x9fd3('0xe')](_0x286771));_0x3d6138(_0x286771);})[_0x9fd3('0x1c')](function(_0x2ca115){logger[_0x9fd3('0xf')](_0x9fd3('0x18'),_0x2ca115[_0x9fd3('0x11')],_0x5e7727);_0x2d8c8b(_0x2ce837[_0x9fd3('0xf')](0x1f4,_0x2ca115[_0x9fd3('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index ded9ed3..3f990de 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 _0x2258=['post','put','update','delete','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show'];(function(_0x338917,_0x471a8f){var _0x45a1fa=function(_0x4d7302){while(--_0x4d7302){_0x338917['push'](_0x338917['shift']());}};_0x45a1fa(++_0x471a8f);}(_0x2258,0x101));var _0x8225=function(_0x3a5904,_0x1725ea){_0x3a5904=_0x3a5904-0x0;var _0x3900bc=_0x2258[_0x3a5904];return _0x3900bc;};'use strict';var multer=require(_0x8225('0x0'));var util=require(_0x8225('0x1'));var path=require('path');var timeout=require(_0x8225('0x2'));var express=require(_0x8225('0x3'));var router=express['Router']();var fs_extra=require(_0x8225('0x4'));var auth=require(_0x8225('0x5'));var interaction=require(_0x8225('0x6'));var config=require(_0x8225('0x7'));var controller=require(_0x8225('0x8'));router[_0x8225('0x9')]('/',auth[_0x8225('0xa')](),controller[_0x8225('0xb')]);router['get'](_0x8225('0xc'),auth['isAuthenticated'](),controller[_0x8225('0xd')]);router[_0x8225('0x9')](_0x8225('0xe'),auth[_0x8225('0xa')](),controller[_0x8225('0xf')]);router[_0x8225('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0x8225('0x11')](_0x8225('0xe'),auth[_0x8225('0xa')](),controller[_0x8225('0x12')]);router[_0x8225('0x13')]('/:id',auth[_0x8225('0xa')](),controller['destroy']);module[_0x8225('0x14')]=router; \ No newline at end of file +var _0xc54a=['multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','destroy'];(function(_0x1a36a5,_0x746928){var _0x746243=function(_0x481966){while(--_0x481966){_0x1a36a5['push'](_0x1a36a5['shift']());}};_0x746243(++_0x746928);}(_0xc54a,0x1f4));var _0xac54=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc54a[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xac54('0x0'));var util=require('util');var path=require(_0xac54('0x1'));var timeout=require('connect-timeout');var express=require(_0xac54('0x2'));var router=express[_0xac54('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xac54('0x4'));var interaction=require(_0xac54('0x5'));var config=require(_0xac54('0x6'));var controller=require(_0xac54('0x7'));router[_0xac54('0x8')]('/',auth[_0xac54('0x9')](),controller[_0xac54('0xa')]);router[_0xac54('0x8')](_0xac54('0xb'),auth['isAuthenticated'](),controller[_0xac54('0xc')]);router[_0xac54('0x8')](_0xac54('0xd'),auth[_0xac54('0x9')](),controller[_0xac54('0xe')]);router[_0xac54('0xf')]('/',auth[_0xac54('0x9')](),controller[_0xac54('0x10')]);router[_0xac54('0x11')]('/:id',auth[_0xac54('0x9')](),controller[_0xac54('0x12')]);router['delete'](_0xac54('0xd'),auth[_0xac54('0x9')](),controller[_0xac54('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index 1bbbfef..78ad399 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 _0x2f8b=['agent','queue','DATE','sequelize','exports','ENUM','account'];(function(_0x1a9db2,_0x32fe5d){var _0x55d20d=function(_0x5971cf){while(--_0x5971cf){_0x1a9db2['push'](_0x1a9db2['shift']());}};_0x55d20d(++_0x32fe5d);}(_0x2f8b,0x96));var _0xb2f8=function(_0x5e36f6,_0x2f51cd){_0x5e36f6=_0x5e36f6-0x0;var _0xae1a31=_0x2f8b[_0x5e36f6];return _0xae1a31;};'use strict';var Sequelize=require(_0xb2f8('0x0'));module[_0xb2f8('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xb2f8('0x2')](_0xb2f8('0x3'),_0xb2f8('0x4'),_0xb2f8('0x5')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0xb2f8('0x6')]}}; \ No newline at end of file +var _0xac35=['DATE','sequelize','exports','STRING','ENUM','account','agent','queue'];(function(_0x3b8c61,_0x39cb00){var _0x34295f=function(_0x57c4e6){while(--_0x57c4e6){_0x3b8c61['push'](_0x3b8c61['shift']());}};_0x34295f(++_0x39cb00);}(_0xac35,0x141));var _0x5ac3=function(_0x30fbf8,_0x5c4f27){_0x30fbf8=_0x30fbf8-0x0;var _0x2a4a0f=_0xac35[_0x30fbf8];return _0x2a4a0f;};'use strict';var Sequelize=require(_0x5ac3('0x0'));module[_0x5ac3('0x1')]={'uniqueid':{'type':Sequelize[_0x5ac3('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x5ac3('0x3')](_0x5ac3('0x4'),_0x5ac3('0x5'),_0x5ac3('0x6')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x5ac3('0x7')]}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index 283f723..b6d64e5 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 _0x62a8=['path','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/environment','../../mysqldb','sendStatus','end','status','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','map','WhatsappTransferReport','rawAttributes','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','includeAll','include','rows','catch','show','params','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache'];(function(_0x26ae05,_0x53e7ea){var _0x1e8338=function(_0x241a59){while(--_0x241a59){_0x26ae05['push'](_0x26ae05['shift']());}};_0x1e8338(++_0x53e7ea);}(_0x62a8,0x16b));var _0x862a=function(_0x4820af,_0x5ea11a){_0x4820af=_0x4820af-0x0;var _0x9da29=_0x62a8[_0x4820af];return _0x9da29;};'use strict';var emlformat=require(_0x862a('0x0'));var rimraf=require(_0x862a('0x1'));var zipdir=require(_0x862a('0x2'));var jsonpatch=require(_0x862a('0x3'));var rp=require(_0x862a('0x4'));var moment=require('moment');var BPromise=require(_0x862a('0x5'));var Mustache=require(_0x862a('0x6'));var util=require('util');var path=require(_0x862a('0x7'));var sox=require('sox');var csv=require(_0x862a('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x862a('0x9'));var _=require('lodash');var squel=require(_0x862a('0xa'));var crypto=require(_0x862a('0xb'));var jsforce=require(_0x862a('0xc'));var deskjs=require(_0x862a('0xd'));var toCsv=require(_0x862a('0x8'));var querystring=require(_0x862a('0xe'));var Papa=require(_0x862a('0xf'));var Redis=require(_0x862a('0x10'));var authService=require(_0x862a('0x11'));var qs=require(_0x862a('0x12'));var as=require(_0x862a('0x13'));var hardwareService=require(_0x862a('0x14'));var logger=require(_0x862a('0x15'))(_0x862a('0x16'));var utils=require('../../config/utils');var config=require(_0x862a('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x862a('0x18'))['db'];function respondWithStatusCode(_0x34f0fe,_0x2c83df){_0x2c83df=_0x2c83df||0xcc;return function(_0x37a770){if(_0x37a770){return _0x34f0fe[_0x862a('0x19')](_0x2c83df);}return _0x34f0fe['status'](_0x2c83df)[_0x862a('0x1a')]();};}function respondWithResult(_0x101545,_0x89c7a1){_0x89c7a1=_0x89c7a1||0xc8;return function(_0x5a03e7){if(_0x5a03e7){return _0x101545[_0x862a('0x1b')](_0x89c7a1)[_0x862a('0x1c')](_0x5a03e7);}};}function respondWithFilteredResult(_0x5c84ef,_0x223c72){return function(_0x4edb39){if(_0x4edb39){var _0x374231=typeof _0x223c72['offset']===_0x862a('0x1d')&&typeof _0x223c72['limit']===_0x862a('0x1d');var _0x817834=_0x4edb39[_0x862a('0x1e')];var _0x5de6e7=_0x374231?0x0:_0x223c72[_0x862a('0x1f')];var _0x35c7b3=_0x374231?_0x4edb39[_0x862a('0x1e')]:_0x223c72[_0x862a('0x1f')]+_0x223c72[_0x862a('0x20')];var _0x2c8f6c;if(_0x35c7b3>=_0x817834){_0x35c7b3=_0x817834;_0x2c8f6c=0xc8;}else{_0x2c8f6c=0xce;}_0x5c84ef[_0x862a('0x1b')](_0x2c8f6c);return _0x5c84ef[_0x862a('0x21')](_0x862a('0x22'),_0x5de6e7+'-'+_0x35c7b3+'/'+_0x817834)[_0x862a('0x1c')](_0x4edb39);}return null;};}function patchUpdates(_0x20f212){return function(_0x5cc286){try{jsonpatch[_0x862a('0x23')](_0x5cc286,_0x20f212,!![]);}catch(_0x580f4f){return BPromise[_0x862a('0x24')](_0x580f4f);}return _0x5cc286[_0x862a('0x25')]();};}function saveUpdates(_0x585465,_0x3179af){return function(_0x163ec2){if(_0x163ec2){return _0x163ec2[_0x862a('0x26')](_0x585465)[_0x862a('0x27')](function(_0x4a6e95){return _0x4a6e95;});}return null;};}function removeEntity(_0x25c85b,_0x49043c){return function(_0x48d42e){if(_0x48d42e){return _0x48d42e[_0x862a('0x28')]()[_0x862a('0x27')](function(){_0x25c85b[_0x862a('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0xa8e60d,_0x1ff334){return function(_0x35fa44){if(!_0x35fa44){_0xa8e60d[_0x862a('0x19')](0x194);}return _0x35fa44;};}function handleError(_0x4f4caf,_0x56a4c1){_0x56a4c1=_0x56a4c1||0x1f4;return function(_0x496ec0){logger[_0x862a('0x29')](_0x496ec0[_0x862a('0x2a')]);if(_0x496ec0['name']){delete _0x496ec0[_0x862a('0x2b')];}_0x4f4caf['status'](_0x56a4c1)['send'](_0x496ec0);};}exports[_0x862a('0x2c')]=function(_0x3a5b83,_0x320310){var _0x21af19={},_0x4c6284={},_0x4e7d92={'count':0x0,'rows':[]};var _0x457554=_[_0x862a('0x2d')](db[_0x862a('0x2e')][_0x862a('0x2f')],function(_0x54260e){return{'name':_0x54260e['fieldName'],'type':_0x54260e['type'][_0x862a('0x30')]};});_0x4c6284[_0x862a('0x31')]=_[_0x862a('0x2d')](_0x457554,_0x862a('0x2b'));_0x4c6284[_0x862a('0x32')]=_[_0x862a('0x33')](_0x3a5b83[_0x862a('0x32')]);_0x4c6284[_0x862a('0x34')]=_[_0x862a('0x35')](_0x4c6284[_0x862a('0x31')],_0x4c6284['query']);_0x21af19['attributes']=_[_0x862a('0x35')](_0x4c6284['model'],qs[_0x862a('0x36')](_0x3a5b83['query'][_0x862a('0x36')]));_0x21af19[_0x862a('0x37')]=_0x21af19[_0x862a('0x37')][_0x862a('0x38')]?_0x21af19[_0x862a('0x37')]:_0x4c6284['model'];if(!_0x3a5b83[_0x862a('0x32')][_0x862a('0x39')](_0x862a('0x3a'))){_0x21af19[_0x862a('0x20')]=qs['limit'](_0x3a5b83[_0x862a('0x32')][_0x862a('0x20')]);_0x21af19['offset']=qs['offset'](_0x3a5b83[_0x862a('0x32')]['offset']);}_0x21af19[_0x862a('0x3b')]=qs[_0x862a('0x3c')](_0x3a5b83[_0x862a('0x32')]['sort']);_0x21af19['where']=qs[_0x862a('0x34')](_[_0x862a('0x3d')](_0x3a5b83['query'],_0x4c6284[_0x862a('0x34')]),_0x457554);if(_0x3a5b83[_0x862a('0x32')]['filter']){_0x21af19[_0x862a('0x3e')]=_[_0x862a('0x3f')](_0x21af19[_0x862a('0x3e')],{'$or':_[_0x862a('0x2d')](_0x457554,function(_0x17890a){if(_0x17890a['type']!=='VIRTUAL'){var _0x1d586b={};_0x1d586b[_0x17890a[_0x862a('0x2b')]]={'$like':'%'+_0x3a5b83[_0x862a('0x32')]['filter']+'%'};return _0x1d586b;}})});}_0x21af19=_['merge']({},_0x21af19,_0x3a5b83['options']);var _0x2ec758={'where':_0x21af19['where']};return db[_0x862a('0x2e')][_0x862a('0x1e')](_0x2ec758)[_0x862a('0x27')](function(_0x2c5adc){_0x4e7d92['count']=_0x2c5adc;if(_0x3a5b83[_0x862a('0x32')][_0x862a('0x40')]){_0x21af19[_0x862a('0x41')]=[{'all':!![]}];}return db[_0x862a('0x2e')]['findAll'](_0x21af19);})[_0x862a('0x27')](function(_0xbf3768){_0x4e7d92[_0x862a('0x42')]=_0xbf3768;return _0x4e7d92;})[_0x862a('0x27')](respondWithFilteredResult(_0x320310,_0x21af19))[_0x862a('0x43')](handleError(_0x320310,null));};exports[_0x862a('0x44')]=function(_0x287151,_0x1fe139){var _0x2335ea={'raw':!![],'where':{'id':_0x287151[_0x862a('0x45')]['id']}},_0x4190e9={};_0x4190e9[_0x862a('0x31')]=_[_0x862a('0x33')](db[_0x862a('0x2e')][_0x862a('0x2f')]);_0x4190e9[_0x862a('0x32')]=_[_0x862a('0x33')](_0x287151['query']);_0x4190e9[_0x862a('0x34')]=_[_0x862a('0x35')](_0x4190e9[_0x862a('0x31')],_0x4190e9[_0x862a('0x32')]);_0x2335ea[_0x862a('0x37')]=_['intersection'](_0x4190e9[_0x862a('0x31')],qs['fields'](_0x287151[_0x862a('0x32')][_0x862a('0x36')]));_0x2335ea[_0x862a('0x37')]=_0x2335ea['attributes'][_0x862a('0x38')]?_0x2335ea[_0x862a('0x37')]:_0x4190e9[_0x862a('0x31')];if(_0x287151['query'][_0x862a('0x40')]){_0x2335ea[_0x862a('0x41')]=[{'all':!![]}];}_0x2335ea=_[_0x862a('0x3f')]({},_0x2335ea,_0x287151['options']);return db['WhatsappTransferReport'][_0x862a('0x46')](_0x2335ea)[_0x862a('0x27')](handleEntityNotFound(_0x1fe139,null))[_0x862a('0x27')](respondWithResult(_0x1fe139,null))[_0x862a('0x43')](handleError(_0x1fe139,null));};exports[_0x862a('0x47')]=function(_0x2bda40,_0x34d458){return db['WhatsappTransferReport'][_0x862a('0x47')](_0x2bda40[_0x862a('0x48')],{})['then'](respondWithResult(_0x34d458,0xc9))['catch'](handleError(_0x34d458,null));};exports[_0x862a('0x26')]=function(_0x176301,_0xd2fe39){if(_0x176301['body']['id']){delete _0x176301[_0x862a('0x48')]['id'];}return db[_0x862a('0x2e')]['find']({'where':{'id':_0x176301[_0x862a('0x45')]['id']}})['then'](handleEntityNotFound(_0xd2fe39,null))[_0x862a('0x27')](saveUpdates(_0x176301[_0x862a('0x48')],null))[_0x862a('0x27')](respondWithResult(_0xd2fe39,null))[_0x862a('0x43')](handleError(_0xd2fe39,null));};exports[_0x862a('0x28')]=function(_0x5e23d3,_0x2516ef){return db['WhatsappTransferReport'][_0x862a('0x46')]({'where':{'id':_0x5e23d3[_0x862a('0x45')]['id']}})['then'](handleEntityNotFound(_0x2516ef,null))[_0x862a('0x27')](removeEntity(_0x2516ef,null))[_0x862a('0x43')](handleError(_0x2516ef,null));};exports[_0x862a('0x49')]=function(_0x365a44,_0x4332cc){return db[_0x862a('0x2e')][_0x862a('0x49')]()[_0x862a('0x27')](respondWithResult(_0x4332cc,null))['catch'](handleError(_0x4332cc,null));}; \ No newline at end of file +var _0xf34f=['type','key','model','query','filters','attributes','intersection','fields','length','sort','where','pick','filter','merge','options','WhatsappTransferReport','includeAll','include','findAll','rows','show','keys','find','create','body','catch','params','describe','eml-format','zip-dir','request-promise','bluebird','mustache','util','sox','ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','rawAttributes','fieldName'];(function(_0x30f9bc,_0x415cbf){var _0x382dd3=function(_0x1859da){while(--_0x1859da){_0x30f9bc['push'](_0x30f9bc['shift']());}};_0x382dd3(++_0x415cbf);}(_0xf34f,0x64));var _0xff34=function(_0x6fcd6a,_0x1c5077){_0x6fcd6a=_0x6fcd6a-0x0;var _0x33b029=_0xf34f[_0x6fcd6a];return _0x33b029;};'use strict';var emlformat=require(_0xff34('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xff34('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xff34('0x2'));var moment=require('moment');var BPromise=require(_0xff34('0x3'));var Mustache=require(_0xff34('0x4'));var util=require(_0xff34('0x5'));var path=require('path');var sox=require(_0xff34('0x6'));var csv=require('to-csv');var ejs=require(_0xff34('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xff34('0x8'));var squel=require('squel');var crypto=require(_0xff34('0x9'));var jsforce=require(_0xff34('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xff34('0xb'));var Papa=require(_0xff34('0xc'));var Redis=require(_0xff34('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xff34('0xe'));var as=require(_0xff34('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xff34('0x10'))(_0xff34('0x11'));var utils=require(_0xff34('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xff34('0x13'));var db=require(_0xff34('0x14'))['db'];function respondWithStatusCode(_0x2e3d0a,_0x3fa22f){_0x3fa22f=_0x3fa22f||0xcc;return function(_0x39ecac){if(_0x39ecac){return _0x2e3d0a[_0xff34('0x15')](_0x3fa22f);}return _0x2e3d0a[_0xff34('0x16')](_0x3fa22f)[_0xff34('0x17')]();};}function respondWithResult(_0x3b0921,_0x275871){_0x275871=_0x275871||0xc8;return function(_0x2fe6b1){if(_0x2fe6b1){return _0x3b0921[_0xff34('0x16')](_0x275871)[_0xff34('0x18')](_0x2fe6b1);}};}function respondWithFilteredResult(_0x3a184e,_0x3bfe1c){return function(_0x11aac2){if(_0x11aac2){var _0x23023f=typeof _0x3bfe1c[_0xff34('0x19')]===_0xff34('0x1a')&&typeof _0x3bfe1c[_0xff34('0x1b')]==='undefined';var _0x95a2b0=_0x11aac2['count'];var _0x2fe34c=_0x23023f?0x0:_0x3bfe1c['offset'];var _0x44260f=_0x23023f?_0x11aac2[_0xff34('0x1c')]:_0x3bfe1c['offset']+_0x3bfe1c['limit'];var _0x1a3a6d;if(_0x44260f>=_0x95a2b0){_0x44260f=_0x95a2b0;_0x1a3a6d=0xc8;}else{_0x1a3a6d=0xce;}_0x3a184e[_0xff34('0x16')](_0x1a3a6d);return _0x3a184e[_0xff34('0x1d')](_0xff34('0x1e'),_0x2fe34c+'-'+_0x44260f+'/'+_0x95a2b0)[_0xff34('0x18')](_0x11aac2);}return null;};}function patchUpdates(_0x26998e){return function(_0x3fb8a9){try{jsonpatch[_0xff34('0x1f')](_0x3fb8a9,_0x26998e,!![]);}catch(_0x2b0891){return BPromise[_0xff34('0x20')](_0x2b0891);}return _0x3fb8a9[_0xff34('0x21')]();};}function saveUpdates(_0x1c76f6,_0x25eb54){return function(_0x244e8f){if(_0x244e8f){return _0x244e8f[_0xff34('0x22')](_0x1c76f6)[_0xff34('0x23')](function(_0x2a988d){return _0x2a988d;});}return null;};}function removeEntity(_0xebe57c,_0x40f14e){return function(_0x1bbcff){if(_0x1bbcff){return _0x1bbcff[_0xff34('0x24')]()['then'](function(){_0xebe57c[_0xff34('0x16')](0xcc)[_0xff34('0x17')]();});}};}function handleEntityNotFound(_0x66df01,_0x266abb){return function(_0x147b68){if(!_0x147b68){_0x66df01['sendStatus'](0x194);}return _0x147b68;};}function handleError(_0x4ee376,_0x293170){_0x293170=_0x293170||0x1f4;return function(_0x24a72f){logger['error'](_0x24a72f[_0xff34('0x25')]);if(_0x24a72f[_0xff34('0x26')]){delete _0x24a72f[_0xff34('0x26')];}_0x4ee376['status'](_0x293170)[_0xff34('0x27')](_0x24a72f);};}exports[_0xff34('0x28')]=function(_0x3939fa,_0x2b28f8){var _0x1038bc={},_0x5c1e72={},_0x3ddd8a={'count':0x0,'rows':[]};var _0xd18630=_[_0xff34('0x29')](db['WhatsappTransferReport'][_0xff34('0x2a')],function(_0x140a50){return{'name':_0x140a50[_0xff34('0x2b')],'type':_0x140a50[_0xff34('0x2c')][_0xff34('0x2d')]};});_0x5c1e72[_0xff34('0x2e')]=_['map'](_0xd18630,'name');_0x5c1e72[_0xff34('0x2f')]=_['keys'](_0x3939fa[_0xff34('0x2f')]);_0x5c1e72[_0xff34('0x30')]=_['intersection'](_0x5c1e72[_0xff34('0x2e')],_0x5c1e72[_0xff34('0x2f')]);_0x1038bc[_0xff34('0x31')]=_[_0xff34('0x32')](_0x5c1e72[_0xff34('0x2e')],qs[_0xff34('0x33')](_0x3939fa[_0xff34('0x2f')][_0xff34('0x33')]));_0x1038bc[_0xff34('0x31')]=_0x1038bc['attributes'][_0xff34('0x34')]?_0x1038bc['attributes']:_0x5c1e72[_0xff34('0x2e')];if(!_0x3939fa[_0xff34('0x2f')]['hasOwnProperty']('nolimit')){_0x1038bc[_0xff34('0x1b')]=qs[_0xff34('0x1b')](_0x3939fa[_0xff34('0x2f')][_0xff34('0x1b')]);_0x1038bc[_0xff34('0x19')]=qs['offset'](_0x3939fa[_0xff34('0x2f')][_0xff34('0x19')]);}_0x1038bc['order']=qs[_0xff34('0x35')](_0x3939fa[_0xff34('0x2f')]['sort']);_0x1038bc[_0xff34('0x36')]=qs['filters'](_[_0xff34('0x37')](_0x3939fa[_0xff34('0x2f')],_0x5c1e72['filters']),_0xd18630);if(_0x3939fa[_0xff34('0x2f')][_0xff34('0x38')]){_0x1038bc[_0xff34('0x36')]=_[_0xff34('0x39')](_0x1038bc[_0xff34('0x36')],{'$or':_[_0xff34('0x29')](_0xd18630,function(_0x2cdc9a){if(_0x2cdc9a['type']!=='VIRTUAL'){var _0x920b2e={};_0x920b2e[_0x2cdc9a[_0xff34('0x26')]]={'$like':'%'+_0x3939fa['query'][_0xff34('0x38')]+'%'};return _0x920b2e;}})});}_0x1038bc=_[_0xff34('0x39')]({},_0x1038bc,_0x3939fa[_0xff34('0x3a')]);var _0x44357f={'where':_0x1038bc[_0xff34('0x36')]};return db[_0xff34('0x3b')][_0xff34('0x1c')](_0x44357f)[_0xff34('0x23')](function(_0xe7a08){_0x3ddd8a[_0xff34('0x1c')]=_0xe7a08;if(_0x3939fa[_0xff34('0x2f')][_0xff34('0x3c')]){_0x1038bc[_0xff34('0x3d')]=[{'all':!![]}];}return db[_0xff34('0x3b')][_0xff34('0x3e')](_0x1038bc);})[_0xff34('0x23')](function(_0x5e33e2){_0x3ddd8a[_0xff34('0x3f')]=_0x5e33e2;return _0x3ddd8a;})[_0xff34('0x23')](respondWithFilteredResult(_0x2b28f8,_0x1038bc))['catch'](handleError(_0x2b28f8,null));};exports[_0xff34('0x40')]=function(_0x2af98c,_0x3bc03d){var _0x173038={'raw':!![],'where':{'id':_0x2af98c['params']['id']}},_0x107c58={};_0x107c58['model']=_[_0xff34('0x41')](db[_0xff34('0x3b')]['rawAttributes']);_0x107c58[_0xff34('0x2f')]=_[_0xff34('0x41')](_0x2af98c[_0xff34('0x2f')]);_0x107c58[_0xff34('0x30')]=_[_0xff34('0x32')](_0x107c58['model'],_0x107c58['query']);_0x173038[_0xff34('0x31')]=_['intersection'](_0x107c58[_0xff34('0x2e')],qs['fields'](_0x2af98c[_0xff34('0x2f')]['fields']));_0x173038[_0xff34('0x31')]=_0x173038['attributes'][_0xff34('0x34')]?_0x173038[_0xff34('0x31')]:_0x107c58['model'];if(_0x2af98c[_0xff34('0x2f')][_0xff34('0x3c')]){_0x173038[_0xff34('0x3d')]=[{'all':!![]}];}_0x173038=_[_0xff34('0x39')]({},_0x173038,_0x2af98c[_0xff34('0x3a')]);return db[_0xff34('0x3b')][_0xff34('0x42')](_0x173038)['then'](handleEntityNotFound(_0x3bc03d,null))[_0xff34('0x23')](respondWithResult(_0x3bc03d,null))['catch'](handleError(_0x3bc03d,null));};exports['create']=function(_0x50966f,_0x46ab53){return db['WhatsappTransferReport'][_0xff34('0x43')](_0x50966f[_0xff34('0x44')],{})[_0xff34('0x23')](respondWithResult(_0x46ab53,0xc9))[_0xff34('0x45')](handleError(_0x46ab53,null));};exports['update']=function(_0x4b63c6,_0x366f66){if(_0x4b63c6[_0xff34('0x44')]['id']){delete _0x4b63c6[_0xff34('0x44')]['id'];}return db['WhatsappTransferReport']['find']({'where':{'id':_0x4b63c6['params']['id']}})[_0xff34('0x23')](handleEntityNotFound(_0x366f66,null))[_0xff34('0x23')](saveUpdates(_0x4b63c6[_0xff34('0x44')],null))['then'](respondWithResult(_0x366f66,null))[_0xff34('0x45')](handleError(_0x366f66,null));};exports['destroy']=function(_0x1fee82,_0x53fa1f){return db[_0xff34('0x3b')][_0xff34('0x42')]({'where':{'id':_0x1fee82[_0xff34('0x46')]['id']}})['then'](handleEntityNotFound(_0x53fa1f,null))[_0xff34('0x23')](removeEntity(_0x53fa1f,null))['catch'](handleError(_0x53fa1f,null));};exports[_0xff34('0x47')]=function(_0x23aece,_0x5e2013){return db[_0xff34('0x3b')][_0xff34('0x47')]()[_0xff34('0x23')](respondWithResult(_0x5e2013,null))['catch'](handleError(_0x5e2013,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index fbcf1da..6087482 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 _0x26bc=['request-promise','path','rimraf','../../config/environment','./whatsappTransferReport.attributes','exports','define','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','lodash','../../config/logger','api','moment','bluebird'];(function(_0x1b8061,_0xc8674f){var _0x39f172=function(_0x5287e0){while(--_0x5287e0){_0x1b8061['push'](_0x1b8061['shift']());}};_0x39f172(++_0xc8674f);}(_0x26bc,0x1ea));var _0xc26b=function(_0x506849,_0x461b4f){_0x506849=_0x506849-0x0;var _0x23a2ca=_0x26bc[_0x506849];return _0x23a2ca;};'use strict';var _=require(_0xc26b('0x0'));var util=require('util');var logger=require(_0xc26b('0x1'))(_0xc26b('0x2'));var moment=require(_0xc26b('0x3'));var BPromise=require(_0xc26b('0x4'));var rp=require(_0xc26b('0x5'));var fs=require('fs');var path=require(_0xc26b('0x6'));var rimraf=require(_0xc26b('0x7'));var config=require(_0xc26b('0x8'));var attributes=require(_0xc26b('0x9'));module[_0xc26b('0xa')]=function(_0x43e67b,_0x1d5d84){return _0x43e67b[_0xc26b('0xb')](_0xc26b('0xc'),attributes,{'tableName':_0xc26b('0xd'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xc26b('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0219=['rimraf','./whatsappTransferReport.attributes','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','../../config/logger','moment','bluebird','request-promise'];(function(_0x511b90,_0x500343){var _0x16e869=function(_0x3bdaef){while(--_0x3bdaef){_0x511b90['push'](_0x511b90['shift']());}};_0x16e869(++_0x500343);}(_0x0219,0xef));var _0x9021=function(_0x22eeea,_0x571ec8){_0x22eeea=_0x22eeea-0x0;var _0x362da0=_0x0219[_0x22eeea];return _0x362da0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x9021('0x0'))('api');var moment=require(_0x9021('0x1'));var BPromise=require(_0x9021('0x2'));var rp=require(_0x9021('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9021('0x4'));var config=require('../../config/environment');var attributes=require(_0x9021('0x5'));module['exports']=function(_0x4a9698,_0x1e5065){return _0x4a9698['define'](_0x9021('0x6'),attributes,{'tableName':_0x9021('0x7'),'paranoid':![],'indexes':[{'name':_0x9021('0x8'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index 534e78d..b2e389b 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 _0x41db=['message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','stringify','code','error'];(function(_0x1ae5ab,_0xc5d441){var _0x1ce001=function(_0x5ef96d){while(--_0x5ef96d){_0x1ae5ab['push'](_0x1ae5ab['shift']());}};_0x1ce001(++_0xc5d441);}(_0x41db,0x76));var _0xb41d=function(_0x3fb5ca,_0x195d1a){_0x3fb5ca=_0x3fb5ca-0x0;var _0xe945d7=_0x41db[_0x3fb5ca];return _0xe945d7;};'use strict';var _=require(_0xb41d('0x0'));var util=require('util');var moment=require(_0xb41d('0x1'));var BPromise=require(_0xb41d('0x2'));var rs=require(_0xb41d('0x3'));var fs=require('fs');var Redis=require(_0xb41d('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xb41d('0x5'));var logger=require(_0xb41d('0x6'))('rpc');var config=require(_0xb41d('0x7'));var jayson=require(_0xb41d('0x8'));var client=jayson[_0xb41d('0x9')][_0xb41d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xcd1a0a,_0x70c786,_0x2b6ac9){return new BPromise(function(_0x382f93,_0x53ba31){return client[_0xb41d('0xb')](_0xcd1a0a,_0x2b6ac9)[_0xb41d('0xc')](function(_0x2009dc){logger[_0xb41d('0xd')](_0xb41d('0xe'),_0x70c786,_0xb41d('0xf'));logger['debug'](_0xb41d('0x10'),_0x70c786,_0xb41d('0xf'),JSON[_0xb41d('0x11')](_0x2009dc));if(_0x2009dc['error']){if(_0x2009dc['error'][_0xb41d('0x12')]===0x1f4){logger[_0xb41d('0x13')](_0xb41d('0xe'),_0x70c786,_0x2009dc[_0xb41d('0x13')][_0xb41d('0x14')]);return _0x53ba31(_0x2009dc[_0xb41d('0x13')][_0xb41d('0x14')]);}logger[_0xb41d('0x13')](_0xb41d('0xe'),_0x70c786,_0x2009dc[_0xb41d('0x13')][_0xb41d('0x14')]);return _0x382f93(_0x2009dc['error'][_0xb41d('0x14')]);}else{logger[_0xb41d('0xd')]('WhatsappTransferReport,\x20%s,\x20%s',_0x70c786,'request\x20sent');_0x382f93(_0x2009dc[_0xb41d('0x15')][_0xb41d('0x14')]);}})[_0xb41d('0x16')](function(_0x3c53c1){logger[_0xb41d('0x13')](_0xb41d('0xe'),_0x70c786,_0x3c53c1);_0x53ba31(_0x3c53c1);});});} \ No newline at end of file +var _0x4587=['client','http','request','info','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x117417,_0x214c67){var _0x5ba86d=function(_0x35ad70){while(--_0x35ad70){_0x117417['push'](_0x117417['shift']());}};_0x5ba86d(++_0x214c67);}(_0x4587,0x1d9));var _0x7458=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4587[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x7458('0x0'));var util=require(_0x7458('0x1'));var moment=require(_0x7458('0x2'));var BPromise=require('bluebird');var rs=require(_0x7458('0x3'));var fs=require('fs');var Redis=require(_0x7458('0x4'));var db=require(_0x7458('0x5'))['db'];var utils=require(_0x7458('0x6'));var logger=require('../../config/logger')(_0x7458('0x7'));var config=require(_0x7458('0x8'));var jayson=require(_0x7458('0x9'));var client=jayson[_0x7458('0xa')][_0x7458('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x56cf21,_0x1aeda0,_0x26b055){return new BPromise(function(_0x762973,_0xdfcd1d){return client[_0x7458('0xc')](_0x56cf21,_0x26b055)['then'](function(_0x3a723c){logger[_0x7458('0xd')](_0x7458('0xe'),_0x1aeda0,_0x7458('0xf'));logger['debug'](_0x7458('0x10'),_0x1aeda0,_0x7458('0xf'),JSON[_0x7458('0x11')](_0x3a723c));if(_0x3a723c[_0x7458('0x12')]){if(_0x3a723c[_0x7458('0x12')][_0x7458('0x13')]===0x1f4){logger[_0x7458('0x12')](_0x7458('0xe'),_0x1aeda0,_0x3a723c[_0x7458('0x12')][_0x7458('0x14')]);return _0xdfcd1d(_0x3a723c[_0x7458('0x12')]['message']);}logger[_0x7458('0x12')](_0x7458('0xe'),_0x1aeda0,_0x3a723c['error']['message']);return _0x762973(_0x3a723c[_0x7458('0x12')][_0x7458('0x14')]);}else{logger[_0x7458('0xd')]('WhatsappTransferReport,\x20%s,\x20%s',_0x1aeda0,_0x7458('0xf'));_0x762973(_0x3a723c[_0x7458('0x15')][_0x7458('0x14')]);}})[_0x7458('0x16')](function(_0x3f9dd1){logger['error'](_0x7458('0xe'),_0x1aeda0,_0x3f9dd1);_0xdfcd1d(_0x3f9dd1);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index ef7bb93..96539a5 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4243=['online','seedDB','./config/seedDB','./config/license','catch','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./rpc','./config/environment','app','./config/pm2/config','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/transcribe','sequelize','sync','then','start','info','Online\x20apps:','map','filter','name','join','Offline\x20apps:','status'];(function(_0x17b623,_0x3483fc){var _0x1cc1f5=function(_0x1f05c5){while(--_0x1f05c5){_0x17b623['push'](_0x17b623['shift']());}};_0x1cc1f5(++_0x3483fc);}(_0x4243,0x104));var _0x3424=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4243[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x3424('0x0'));var mysqldb=require('./mysqldb');var rpc=require(_0x3424('0x1'));var config=require(_0x3424('0x2'));var logger=require('./config/logger')(_0x3424('0x3'));var pm2=require('./config/pm2');var pm2Config=require(_0x3424('0x4'));var schedule=require('./config/schedule');var chat=require(_0x3424('0x5'));var whatsapp=require(_0x3424('0x6'));var transcribe=require(_0x3424('0x7'));function main(){return mysqldb['db'][_0x3424('0x8')][_0x3424('0x9')]()['then'](function(){return rpc['listen']();})[_0x3424('0xa')](function(_0x5cdd7c){logger['info'](_0x5cdd7c);return chat['start']();})[_0x3424('0xa')](function(){return whatsapp[_0x3424('0xb')]();})[_0x3424('0xa')](function(){return schedule[_0x3424('0xb')]();})[_0x3424('0xa')](function(){return transcribe[_0x3424('0xb')]();})[_0x3424('0xa')](function(_0x3e04ad){logger['info'](_0x3e04ad);return pm2['start'](pm2Config);})[_0x3424('0xa')](function(_0x5029b8){logger[_0x3424('0xc')](_0x3424('0xd'),_[_0x3424('0xe')](_[_0x3424('0xf')](_0x5029b8,{'status':'online'}),_0x3424('0x10'))[_0x3424('0x11')]());logger['info'](_0x3424('0x12'),_[_0x3424('0xe')](_[_0x3424('0xf')](_0x5029b8,function(_0x13e0ae){return _0x13e0ae[_0x3424('0x13')]!==_0x3424('0x14');}),_0x3424('0x10'))[_0x3424('0x11')]()||'None');config[_0x3424('0x15')]&&require(_0x3424('0x16'))['default']();require(_0x3424('0x17'))['default']();})[_0x3424('0x18')](function(_0x50a029){logger[_0x3424('0x19')](_0x3424('0x1a'),_0x50a029);process[_0x3424('0x1b')](0x1);});}main(); \ No newline at end of file +var _0xe458=['./config/pm2','./config/pm2/config','./config/schedule/chat','./config/schedule/transcribe','sequelize','then','listen','info','start','map','online','join','Offline\x20apps:','filter','status','name','None','./config/seedDB','catch','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./mysqldb','./rpc','./config/environment','./config/logger','app'];(function(_0x2ec461,_0x5f588a){var _0x28603d=function(_0x21114b){while(--_0x21114b){_0x2ec461['push'](_0x2ec461['shift']());}};_0x28603d(++_0x5f588a);}(_0xe458,0x123));var _0x8e45=function(_0x1376c8,_0x4abba2){_0x1376c8=_0x1376c8-0x0;var _0x23a8bc=_0xe458[_0x1376c8];return _0x23a8bc;};'use strict';var _=require(_0x8e45('0x0'));var mysqldb=require(_0x8e45('0x1'));var rpc=require(_0x8e45('0x2'));var config=require(_0x8e45('0x3'));var logger=require(_0x8e45('0x4'))(_0x8e45('0x5'));var pm2=require(_0x8e45('0x6'));var pm2Config=require(_0x8e45('0x7'));var schedule=require('./config/schedule');var chat=require(_0x8e45('0x8'));var whatsapp=require('./config/schedule/whatsapp');var transcribe=require(_0x8e45('0x9'));function main(){return mysqldb['db'][_0x8e45('0xa')]['sync']()[_0x8e45('0xb')](function(){return rpc[_0x8e45('0xc')]();})[_0x8e45('0xb')](function(_0x4b4fad){logger[_0x8e45('0xd')](_0x4b4fad);return chat[_0x8e45('0xe')]();})[_0x8e45('0xb')](function(){return whatsapp[_0x8e45('0xe')]();})[_0x8e45('0xb')](function(){return schedule[_0x8e45('0xe')]();})[_0x8e45('0xb')](function(){return transcribe['start']();})[_0x8e45('0xb')](function(_0x5169c8){logger[_0x8e45('0xd')](_0x5169c8);return pm2[_0x8e45('0xe')](pm2Config);})[_0x8e45('0xb')](function(_0x34f6a9){logger['info']('Online\x20apps:',_[_0x8e45('0xf')](_['filter'](_0x34f6a9,{'status':_0x8e45('0x10')}),'name')[_0x8e45('0x11')]());logger[_0x8e45('0xd')](_0x8e45('0x12'),_[_0x8e45('0xf')](_[_0x8e45('0x13')](_0x34f6a9,function(_0x177334){return _0x177334[_0x8e45('0x14')]!=='online';}),_0x8e45('0x15'))['join']()||_0x8e45('0x16'));config['seedDB']&&require(_0x8e45('0x17'))['default']();require('./config/license')['default']();})[_0x8e45('0x18')](function(_0x3f0e55){logger['error'](_0x8e45('0x19'),_0x3f0e55);process[_0x8e45('0x1a')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index 017bbf2..d4a2c3a 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 _0xbfaf=['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.','length','splice','unshift','join','sign','secret','payload','options','promisify','verify','toString','hex','floor','now','../../config/environment','../../config/license/hardware','../encryptor','jsonwebtoken','express-jwt','composable-middleware','basic-auth','crypto','util','moment','secrets','session','fullname','name','internal','email','userpic','permissions','md5secret','voicePause','chatPause','smsPause','openchannelPause','lastPauseAt','crudPermissions','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','hotdesk','interface','userProfileId','privacyEnabled','settingsEnabled','wssPort','downloadVoiceRecordings','downloadAttachments','isChatInteractionAuthorized','isAuthenticated','use','user','ChatInteraction','findOne','closed','disposition','then','status','unmanaged','json','Unmanaged.','catch','headers','authorization','User','find','authenticate','pass','Wrong\x20credentials.','startsWith','Bearer','query','apikey','getUuid','sub','Setting','allowedLoginAttempts','isEqual','apiKeyNonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','Invalid\x20API\x20access\x20key','blocked','blockDuration','blockedAt','add','minutes','Unknown\x20authorization\x20format','User\x20not\x20found.','canUpdate','getLicense','isMiddleware','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','role','cookie','motion.token','/dashboards/general','isNil','generateApiKey','apiKeyIat','regenerateApiKey','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','validatePasswordHistory','decryptString','split'];(function(_0x2d4421,_0x15a84f){var _0x2d3b01=function(_0xb9e94c){while(--_0xb9e94c){_0x2d4421['push'](_0x2d4421['shift']());}};_0x2d3b01(++_0x15a84f);}(_0xbfaf,0x89));var _0xfbfa=function(_0x4e0359,_0x205155){_0x4e0359=_0x4e0359-0x0;var _0x450f0a=_0xbfaf[_0x4e0359];return _0x450f0a;};'use strict';var db=require('../../mysqldb')['db'];var config=require(_0xfbfa('0x0'));var hardwareConf=require(_0xfbfa('0x1'));var licenseUtil=require('../../config/license/util');var encryptor=require(_0xfbfa('0x2'));var _=require('lodash');var jwt=require(_0xfbfa('0x3'));var expressJwt=require(_0xfbfa('0x4'));var compose=require(_0xfbfa('0x5'));var basicAuth=require(_0xfbfa('0x6'));var crypto=require(_0xfbfa('0x7'));var BPromise=require('bluebird');var util=require(_0xfbfa('0x8'));var moment=require(_0xfbfa('0x9'));var validateJwt=expressJwt({'secret':config[_0xfbfa('0xa')][_0xfbfa('0xb')]});var userAttributes=['id','role',_0xfbfa('0xc'),_0xfbfa('0xd'),_0xfbfa('0xe'),_0xfbfa('0xf'),_0xfbfa('0x10'),_0xfbfa('0x11'),_0xfbfa('0x12'),_0xfbfa('0x13'),_0xfbfa('0x14'),'mailPause','faxPause',_0xfbfa('0x15'),_0xfbfa('0x16'),'pauseType','showWebBar','lastLoginAt',_0xfbfa('0x17'),_0xfbfa('0x18'),_0xfbfa('0x19'),_0xfbfa('0x1a'),_0xfbfa('0x1b'),_0xfbfa('0x1c'),_0xfbfa('0x1d'),_0xfbfa('0x1e'),'phoneBarEnableRecording',_0xfbfa('0x1f'),_0xfbfa('0x20'),_0xfbfa('0x21'),_0xfbfa('0x22'),'phoneBarRemoteControl','phoneBarRemoteControlPort',_0xfbfa('0x23'),_0xfbfa('0x24'),_0xfbfa('0x25'),_0xfbfa('0x26'),_0xfbfa('0x27'),_0xfbfa('0x28'),_0xfbfa('0x29'),'downloadOmnichannelInteractions',_0xfbfa('0x2a')];exports[_0xfbfa('0x2b')]=function(){return this[_0xfbfa('0x2c')](!![])[_0xfbfa('0x2d')](function(_0x1133c8,_0x349d3e,_0x526811){if(_0x1133c8[_0xfbfa('0x2e')]){_0x526811();}else{return db[_0xfbfa('0x2f')][_0xfbfa('0x30')]({'where':{'id':_0x1133c8['params']['id']},'attributes':['id',_0xfbfa('0x31'),_0xfbfa('0x32')],'raw':!![]})[_0xfbfa('0x33')](function(_0x587f8b){if(_0x587f8b&&_0x587f8b[_0xfbfa('0x31')]){return _0x349d3e[_0xfbfa('0x34')](_0x587f8b[_0xfbfa('0x32')]===_0xfbfa('0x35')?0x195:0x193)[_0xfbfa('0x36')]({'message':_0x587f8b[_0xfbfa('0x32')]===_0xfbfa('0x35')?_0xfbfa('0x37'):'Forbidden.'});}else{_0x526811();}})[_0xfbfa('0x38')](function(_0x14e0eb){_0x526811(_0x14e0eb);});}});};exports[_0xfbfa('0x2c')]=function isAuthenticated(_0x4c1aba){return compose()['use'](function(_0x355ec2,_0x2e66ca,_0x5e309b){var _0x11b80a;if(_0x355ec2[_0xfbfa('0x39')][_0xfbfa('0x3a')]){if(_['startsWith'](_0x355ec2['headers'][_0xfbfa('0x3a')],'Basic')){var _0x4a2ab7=basicAuth(_0x355ec2);db[_0xfbfa('0x3b')][_0xfbfa('0x3c')]({'where':{'name':_0x4a2ab7[_0xfbfa('0xd')]}})[_0xfbfa('0x33')](function(_0x5b6c9b){if(!_0x5b6c9b||!_0x5b6c9b[_0xfbfa('0x3d')](_0x4a2ab7[_0xfbfa('0x3e')])){return _0x2e66ca[_0xfbfa('0x34')](0x191)[_0xfbfa('0x36')]({'message':_0xfbfa('0x3f')});}_0x355ec2[_0xfbfa('0x2e')]={'id':_0x5b6c9b['id']};_0x5e309b();})['catch'](function(_0x4465f9){_0x5e309b(_0x4465f9);});}else if(_[_0xfbfa('0x40')](_0x355ec2[_0xfbfa('0x39')][_0xfbfa('0x3a')],_0xfbfa('0x41'))){validateJwt(_0x355ec2,_0x2e66ca,_0x5e309b);}else{if(_0x4c1aba){_0x5e309b();}else{return _0x2e66ca['status'](0x193)['json']({'message':'Unknown\x20authorization\x20format'});}}}else if(_0x355ec2[_0xfbfa('0x42')][_0xfbfa('0x43')]){try{var _0x2897ae={'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0xfbfa('0x44')]()};verifyJwt(_0x355ec2[_0xfbfa('0x42')]['apikey'],_0x2897ae)[_0xfbfa('0x33')](function(_0x3f6ae9){return db[_0xfbfa('0x3b')]['find']({'where':{'id':_0x3f6ae9[_0xfbfa('0x45')]}})[_0xfbfa('0x33')](function(_0x2efb34){_0x11b80a=_0x2efb34;return db[_0xfbfa('0x46')][_0xfbfa('0x30')]({'where':{'id':0x1},'attributes':[_0xfbfa('0x47'),'blockDuration'],'raw':!![]});})[_0xfbfa('0x33')](function(_0x89083d){if(!_0x11b80a||!_[_0xfbfa('0x48')](_0x11b80a[_0xfbfa('0x49')],_0x3f6ae9['nonce'])){return _0x2e66ca[_0xfbfa('0x34')](0x191)[_0xfbfa('0x36')]({'message':_0xfbfa('0x4a')});}if(_0x11b80a[_0xfbfa('0x4b')]){return _0x2e66ca[_0xfbfa('0x34')](0x191)[_0xfbfa('0x36')]({'message':_0xfbfa('0x4c')});}if(_0x11b80a[_0xfbfa('0x4d')]){if(_0x89083d[_0xfbfa('0x4e')]>0x0){if(moment(_0x11b80a[_0xfbfa('0x4f')])[_0xfbfa('0x50')](_0x89083d[_0xfbfa('0x4e')],_0xfbfa('0x51'))>moment()){return _0x2e66ca[_0xfbfa('0x34')](0x191)[_0xfbfa('0x36')]({'message':_0xfbfa('0x4c')});}}else{return _0x2e66ca['status'](0x191)[_0xfbfa('0x36')]({'message':_0xfbfa('0x4c')});}}_0x355ec2[_0xfbfa('0x2e')]={'id':_0x11b80a['id']};_0x5e309b();});})[_0xfbfa('0x38')](function(){return _0x2e66ca[_0xfbfa('0x34')](0x191)[_0xfbfa('0x36')]({'message':_0xfbfa('0x4c')});});}catch(_0x310e35){_0x5e309b(_0x310e35);}}else if(_0x4c1aba){_0x5e309b();}else{return _0x2e66ca['status'](0x193)['json']({'message':_0xfbfa('0x52')});}})[_0xfbfa('0x2d')](function(_0x5d1472,_0x19f0dd,_0x449f9f){if(_0x5d1472[_0xfbfa('0x2e')]){db[_0xfbfa('0x3b')]['find']({'where':{'id':_0x5d1472[_0xfbfa('0x2e')]['id']},'attributes':userAttributes})['then'](function(_0x5a64d3){if(!_0x5a64d3){return _0x19f0dd[_0xfbfa('0x34')](0x194)[_0xfbfa('0x36')]({'message':_0xfbfa('0x53')});}_0x5d1472['user']=_0x5a64d3;_0x449f9f();})['catch'](function(_0x1edf4c){_0x449f9f(_0x1edf4c);});}else if(_0x4c1aba){_0x449f9f();}else{return _0x19f0dd[_0xfbfa('0x34')](0x194)['json']({'message':'User\x20object\x20not\x20found.'});}});};exports[_0xfbfa('0x54')]=function canUpdate(){return compose()[_0xfbfa('0x2d')](function(_0x2691d1,_0x2d471b,_0x123e2f){return licenseUtil[_0xfbfa('0x55')]()['then'](function(_0x43946c){if(_0x43946c['update']){_0x123e2f();}else{return _0x2d471b[_0xfbfa('0x34')](0x193)[_0xfbfa('0x36')]({'message':'Forbidden'});}})['catch'](function(_0x3b8bf5){_0x123e2f(_0x3b8bf5);});});};exports[_0xfbfa('0x56')]=function(_0x54e6d4,_0x179a60,_0x41510f){_0x54e6d4[_0xfbfa('0x56')]=!![];return _0x41510f();};exports['signToken']=function signToken(_0x30b445){return signJwt(_0x30b445);};exports['setTokenCookie']=function(_0x3a82cc,_0x3eda41){if(!_0x3a82cc[_0xfbfa('0x2e')]){return _0x3eda41[_0xfbfa('0x34')](0x194)[_0xfbfa('0x36')]({'message':_0xfbfa('0x57')});}var _0x5d524b={'payload':{'id':_0x3a82cc[_0xfbfa('0x2e')]['id'],'role':_0x3a82cc[_0xfbfa('0x2e')][_0xfbfa('0x58')]},'options':{'expiresIn':0x15180}};return signJwt(_0x5d524b)[_0xfbfa('0x33')](function(_0x559962){_0x3eda41[_0xfbfa('0x59')](_0xfbfa('0x5a'),_0x559962);_0x3eda41['redirect'](_0xfbfa('0x5b'));})[_0xfbfa('0x38')](function(_0x1895d6){return _0x3eda41[_0xfbfa('0x34')](0x1f4)['send'](_0x1895d6);});};exports['retrieveApiKey']=function(_0x1e5ca3){if(_[_0xfbfa('0x5c')](_0x1e5ca3[_0xfbfa('0x49')])||_[_0xfbfa('0x5c')](_0x1e5ca3['apiKeyIat'])){return null;}else{return createJwt(_0x1e5ca3);}};exports[_0xfbfa('0x5d')]=function(_0x16614f){_0x16614f[_0xfbfa('0x49')]=generateNonce();_0x16614f[_0xfbfa('0x5e')]=generateIssuedAt();return createJwt(_0x16614f);};exports[_0xfbfa('0x5f')]=function(_0x4ddc9a,_0x4be45d){var _0x3ff0d8=_0x4ddc9a[_0xfbfa('0x42')][_0xfbfa('0x43')];if(_0x3ff0d8){var _0x3c8f71={'nonce':_0x4be45d[_0xfbfa('0x49')],'iat':_0x4be45d['apiKeyIat'],'audience':hardwareConf[_0xfbfa('0x44')](),'issuer':hardwareConf[_0xfbfa('0x44')]()};return verifyJwt(_0x3ff0d8,_0x3c8f71)[_0xfbfa('0x33')](function(){return generateApiKey(_0x4be45d);});}else{throw{'message':'Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one'};}};exports['validatePasswordPattern']=function(_0x1f8607){var _0x5df269=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x5df269[_0xfbfa('0x60')](_0x1f8607))throw new db[(_0xfbfa('0x61'))][(_0xfbfa('0x62'))](_0xfbfa('0x63'));return;};exports[_0xfbfa('0x64')]=function(_0x357998,_0x66d3f4,_0x5414e7){var _0x2b514e=encryptor[_0xfbfa('0x65')](_0x66d3f4)[_0xfbfa('0x66')](',');for(var _0x5480fa=0x0;_0x5480fa<_0x5414e7;_0x5480fa++){if(!_0x2b514e[_0x5480fa])break;if(_0x357998[_0xfbfa('0x67')]()===_0x2b514e[_0x5480fa][_0xfbfa('0x67')]()){var _0x57810c=util['format'](_0xfbfa('0x68'),_0x5414e7);if(_0x5414e7===0x1){_0x57810c=_0xfbfa('0x69');}throw new db['Sequelize'][(_0xfbfa('0x62'))](_0x57810c);}}return;};exports['updatePasswordsHistory']=function(_0x22230,_0x229e96){var _0x5ef2c3=_0x229e96?encryptor['decryptString'](_0x229e96)[_0xfbfa('0x66')](','):[];if(_0x5ef2c3[_0xfbfa('0x6a')]===0x5){_0x5ef2c3[_0xfbfa('0x6b')](-0x1,0x1);}_0x5ef2c3[_0xfbfa('0x6c')](_0x22230);return encryptor['encryptString'](_0x5ef2c3[_0xfbfa('0x6d')](','));};function signJwt(_0xc4b6f2){var _0x8bf02=BPromise['promisify'](jwt[_0xfbfa('0x6e')],{'context':jwt});var _0x4bad31=_0xc4b6f2[_0xfbfa('0x6f')]||config['secrets'][_0xfbfa('0xb')];return new BPromise(function(_0x470cb1,_0xf611bd){_0x8bf02(_0xc4b6f2[_0xfbfa('0x70')],_0x4bad31,_0xc4b6f2[_0xfbfa('0x71')])[_0xfbfa('0x33')](function(_0x2545f2){_0x470cb1(_0x2545f2);})[_0xfbfa('0x38')](function(_0x26b53a){_0xf611bd(_0x26b53a);});});}function verifyJwt(_0x384210,_0x4f9de7,_0x335d44){var _0x2100c7=BPromise[_0xfbfa('0x72')](jwt[_0xfbfa('0x73')],{'context':jwt});var _0x55527d=_0x335d44||config['secrets'][_0xfbfa('0xb')];return new BPromise(function(_0x4e2b87,_0x1304cc){_0x2100c7(_0x384210,_0x55527d,_0x4f9de7)['then'](function(_0x19b42a){_0x4e2b87(_0x19b42a);})[_0xfbfa('0x38')](function(_0x3e3bc8){_0x1304cc(_0x3e3bc8);});});}function generateNonce(){return crypto['randomBytes'](0x10)[_0xfbfa('0x74')](_0xfbfa('0x75'));}function generateIssuedAt(){return Math[_0xfbfa('0x76')](Date[_0xfbfa('0x77')]()/0x3e8)[_0xfbfa('0x74')]();}function createJwt(_0x2ccb83){var _0x2d52e3={'payload':{'iat':_0x2ccb83[_0xfbfa('0x5e')],'nonce':_0x2ccb83[_0xfbfa('0x49')]},'options':{'algorithm':'HS512','subject':_0x2ccb83['id'][_0xfbfa('0x74')](),'issuer':hardwareConf[_0xfbfa('0x44')](),'audience':hardwareConf[_0xfbfa('0x44')]()}};return signJwt(_0x2d52e3)[_0xfbfa('0x33')](function(_0x67e6ae){return{'iat':_0x2ccb83[_0xfbfa('0x5e')],'nonce':_0x2ccb83[_0xfbfa('0x49')],'token':_0x67e6ae};});} \ No newline at end of file +var _0xac9a=['getLicense','update','isMiddleware','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','motion.token','redirect','send','retrieveApiKey','isNil','apiKeyIat','apiKeyNonce','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','test','Sequelize','ValidationError','validatePasswordHistory','decryptString','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','updatePasswordsHistory','length','splice','unshift','encryptString','join','promisify','sign','secret','options','verify','randomBytes','toString','hex','floor','now','../../mysqldb','../../config/environment','../../config/license/hardware','../../config/license/util','../encryptor','lodash','jsonwebtoken','express-jwt','composable-middleware','basic-auth','crypto','bluebird','util','moment','secrets','session','role','fullname','internal','email','userpic','permissions','chatPause','mailPause','faxPause','smsPause','openchannelPause','pauseType','showWebBar','lastLoginAt','crudPermissions','allowmessenger','passwordResetAt','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','interface','userProfileId','settingsEnabled','wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions','downloadAttachments','isChatInteractionAuthorized','use','user','ChatInteraction','params','closed','disposition','then','status','unmanaged','json','Unmanaged.','catch','isAuthenticated','startsWith','headers','authorization','Basic','User','find','name','authenticate','pass','Wrong\x20credentials.','Bearer','Unknown\x20authorization\x20format','getUuid','query','sub','Setting','findOne','blockDuration','isEqual','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','Invalid\x20API\x20access\x20key','blocked','blockedAt','add','minutes','canUpdate'];(function(_0x208581,_0x3f12ee){var _0x4ffdea=function(_0x323183){while(--_0x323183){_0x208581['push'](_0x208581['shift']());}};_0x4ffdea(++_0x3f12ee);}(_0xac9a,0x1b3));var _0xaac9=function(_0x9beac5,_0x47172c){_0x9beac5=_0x9beac5-0x0;var _0x318754=_0xac9a[_0x9beac5];return _0x318754;};'use strict';var db=require(_0xaac9('0x0'))['db'];var config=require(_0xaac9('0x1'));var hardwareConf=require(_0xaac9('0x2'));var licenseUtil=require(_0xaac9('0x3'));var encryptor=require(_0xaac9('0x4'));var _=require(_0xaac9('0x5'));var jwt=require(_0xaac9('0x6'));var expressJwt=require(_0xaac9('0x7'));var compose=require(_0xaac9('0x8'));var basicAuth=require(_0xaac9('0x9'));var crypto=require(_0xaac9('0xa'));var BPromise=require(_0xaac9('0xb'));var util=require(_0xaac9('0xc'));var moment=require(_0xaac9('0xd'));var validateJwt=expressJwt({'secret':config[_0xaac9('0xe')][_0xaac9('0xf')]});var userAttributes=['id',_0xaac9('0x10'),_0xaac9('0x11'),'name',_0xaac9('0x12'),_0xaac9('0x13'),_0xaac9('0x14'),_0xaac9('0x15'),'md5secret','voicePause',_0xaac9('0x16'),_0xaac9('0x17'),_0xaac9('0x18'),_0xaac9('0x19'),_0xaac9('0x1a'),_0xaac9('0x1b'),_0xaac9('0x1c'),_0xaac9('0x1d'),'lastPauseAt',_0xaac9('0x1e'),_0xaac9('0x1f'),_0xaac9('0x20'),'alias','phoneBarAutoAnswer',_0xaac9('0x21'),_0xaac9('0x22'),_0xaac9('0x23'),_0xaac9('0x24'),'phoneBarEnableSettings',_0xaac9('0x25'),_0xaac9('0x26'),_0xaac9('0x27'),'phoneBarRemoteControlPort','hotdesk',_0xaac9('0x28'),_0xaac9('0x29'),'privacyEnabled',_0xaac9('0x2a'),_0xaac9('0x2b'),_0xaac9('0x2c'),_0xaac9('0x2d'),_0xaac9('0x2e')];exports[_0xaac9('0x2f')]=function(){return this['isAuthenticated'](!![])[_0xaac9('0x30')](function(_0xab4c2b,_0x2efe36,_0x1551fa){if(_0xab4c2b[_0xaac9('0x31')]){_0x1551fa();}else{return db[_0xaac9('0x32')]['findOne']({'where':{'id':_0xab4c2b[_0xaac9('0x33')]['id']},'attributes':['id',_0xaac9('0x34'),_0xaac9('0x35')],'raw':!![]})[_0xaac9('0x36')](function(_0x1f8ea2){if(_0x1f8ea2&&_0x1f8ea2[_0xaac9('0x34')]){return _0x2efe36[_0xaac9('0x37')](_0x1f8ea2[_0xaac9('0x35')]===_0xaac9('0x38')?0x195:0x193)[_0xaac9('0x39')]({'message':_0x1f8ea2[_0xaac9('0x35')]===_0xaac9('0x38')?_0xaac9('0x3a'):'Forbidden.'});}else{_0x1551fa();}})[_0xaac9('0x3b')](function(_0x3a53f5){_0x1551fa(_0x3a53f5);});}});};exports[_0xaac9('0x3c')]=function isAuthenticated(_0x326634){return compose()[_0xaac9('0x30')](function(_0x17d869,_0x2f23cf,_0x269056){var _0x4385bd;if(_0x17d869['headers']['authorization']){if(_[_0xaac9('0x3d')](_0x17d869[_0xaac9('0x3e')][_0xaac9('0x3f')],_0xaac9('0x40'))){var _0x4fde25=basicAuth(_0x17d869);db[_0xaac9('0x41')][_0xaac9('0x42')]({'where':{'name':_0x4fde25[_0xaac9('0x43')]}})[_0xaac9('0x36')](function(_0x538f59){if(!_0x538f59||!_0x538f59[_0xaac9('0x44')](_0x4fde25[_0xaac9('0x45')])){return _0x2f23cf[_0xaac9('0x37')](0x191)['json']({'message':_0xaac9('0x46')});}_0x17d869[_0xaac9('0x31')]={'id':_0x538f59['id']};_0x269056();})[_0xaac9('0x3b')](function(_0x22178b){_0x269056(_0x22178b);});}else if(_[_0xaac9('0x3d')](_0x17d869[_0xaac9('0x3e')][_0xaac9('0x3f')],_0xaac9('0x47'))){validateJwt(_0x17d869,_0x2f23cf,_0x269056);}else{if(_0x326634){_0x269056();}else{return _0x2f23cf['status'](0x193)[_0xaac9('0x39')]({'message':_0xaac9('0x48')});}}}else if(_0x17d869['query']['apikey']){try{var _0x58b940={'audience':hardwareConf[_0xaac9('0x49')](),'issuer':hardwareConf[_0xaac9('0x49')]()};verifyJwt(_0x17d869[_0xaac9('0x4a')]['apikey'],_0x58b940)[_0xaac9('0x36')](function(_0x5a3ca6){return db[_0xaac9('0x41')]['find']({'where':{'id':_0x5a3ca6[_0xaac9('0x4b')]}})[_0xaac9('0x36')](function(_0x3e02f3){_0x4385bd=_0x3e02f3;return db[_0xaac9('0x4c')][_0xaac9('0x4d')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0xaac9('0x4e')],'raw':!![]});})[_0xaac9('0x36')](function(_0x39a3c8){if(!_0x4385bd||!_[_0xaac9('0x4f')](_0x4385bd['apiKeyNonce'],_0x5a3ca6[_0xaac9('0x50')])){return _0x2f23cf['status'](0x191)[_0xaac9('0x39')]({'message':_0xaac9('0x51')});}if(_0x4385bd[_0xaac9('0x52')]){return _0x2f23cf[_0xaac9('0x37')](0x191)[_0xaac9('0x39')]({'message':_0xaac9('0x53')});}if(_0x4385bd[_0xaac9('0x54')]){if(_0x39a3c8[_0xaac9('0x4e')]>0x0){if(moment(_0x4385bd[_0xaac9('0x55')])[_0xaac9('0x56')](_0x39a3c8[_0xaac9('0x4e')],_0xaac9('0x57'))>moment()){return _0x2f23cf[_0xaac9('0x37')](0x191)[_0xaac9('0x39')]({'message':'Invalid\x20API\x20access\x20key'});}}else{return _0x2f23cf[_0xaac9('0x37')](0x191)[_0xaac9('0x39')]({'message':_0xaac9('0x53')});}}_0x17d869[_0xaac9('0x31')]={'id':_0x4385bd['id']};_0x269056();});})['catch'](function(){return _0x2f23cf[_0xaac9('0x37')](0x191)[_0xaac9('0x39')]({'message':'Invalid\x20API\x20access\x20key'});});}catch(_0x189d7f){_0x269056(_0x189d7f);}}else if(_0x326634){_0x269056();}else{return _0x2f23cf['status'](0x193)[_0xaac9('0x39')]({'message':_0xaac9('0x48')});}})[_0xaac9('0x30')](function(_0x1c74c5,_0x4daf6b,_0x52c9ac){if(_0x1c74c5[_0xaac9('0x31')]){db[_0xaac9('0x41')][_0xaac9('0x42')]({'where':{'id':_0x1c74c5[_0xaac9('0x31')]['id']},'attributes':userAttributes})[_0xaac9('0x36')](function(_0x5e9a55){if(!_0x5e9a55){return _0x4daf6b['status'](0x194)[_0xaac9('0x39')]({'message':'User\x20not\x20found.'});}_0x1c74c5[_0xaac9('0x31')]=_0x5e9a55;_0x52c9ac();})[_0xaac9('0x3b')](function(_0x1b3008){_0x52c9ac(_0x1b3008);});}else if(_0x326634){_0x52c9ac();}else{return _0x4daf6b[_0xaac9('0x37')](0x194)[_0xaac9('0x39')]({'message':'User\x20object\x20not\x20found.'});}});};exports[_0xaac9('0x58')]=function canUpdate(){return compose()[_0xaac9('0x30')](function(_0x21819e,_0x5f0802,_0x409330){return licenseUtil[_0xaac9('0x59')]()[_0xaac9('0x36')](function(_0x37fb27){if(_0x37fb27[_0xaac9('0x5a')]){_0x409330();}else{return _0x5f0802[_0xaac9('0x37')](0x193)['json']({'message':'Forbidden'});}})['catch'](function(_0x4985a8){_0x409330(_0x4985a8);});});};exports[_0xaac9('0x5b')]=function(_0x28b5df,_0x28e7c6,_0x3163d9){_0x28b5df[_0xaac9('0x5b')]=!![];return _0x3163d9();};exports['signToken']=function signToken(_0x5dac13){return signJwt(_0x5dac13);};exports[_0xaac9('0x5c')]=function(_0x304c55,_0x13bb06){if(!_0x304c55[_0xaac9('0x31')]){return _0x13bb06[_0xaac9('0x37')](0x194)['json']({'message':_0xaac9('0x5d')});}var _0x33b136={'payload':{'id':_0x304c55[_0xaac9('0x31')]['id'],'role':_0x304c55[_0xaac9('0x31')]['role']},'options':{'expiresIn':0x15180}};return signJwt(_0x33b136)[_0xaac9('0x36')](function(_0x4ca5ce){_0x13bb06[_0xaac9('0x5e')](_0xaac9('0x5f'),_0x4ca5ce);_0x13bb06[_0xaac9('0x60')]('/dashboards/general');})['catch'](function(_0xa7800d){return _0x13bb06[_0xaac9('0x37')](0x1f4)[_0xaac9('0x61')](_0xa7800d);});};exports[_0xaac9('0x62')]=function(_0x36eb5d){if(_[_0xaac9('0x63')](_0x36eb5d['apiKeyNonce'])||_[_0xaac9('0x63')](_0x36eb5d[_0xaac9('0x64')])){return null;}else{return createJwt(_0x36eb5d);}};exports['generateApiKey']=function(_0xcf90f6){_0xcf90f6[_0xaac9('0x65')]=generateNonce();_0xcf90f6['apiKeyIat']=generateIssuedAt();return createJwt(_0xcf90f6);};exports[_0xaac9('0x66')]=function(_0x573d0e,_0x257095){var _0x7e3887=_0x573d0e[_0xaac9('0x4a')]['apikey'];if(_0x7e3887){var _0x10cd1e={'nonce':_0x257095[_0xaac9('0x65')],'iat':_0x257095['apiKeyIat'],'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0xaac9('0x49')]()};return verifyJwt(_0x7e3887,_0x10cd1e)[_0xaac9('0x36')](function(){return generateApiKey(_0x257095);});}else{throw{'message':_0xaac9('0x67')};}};exports[_0xaac9('0x68')]=function(_0x55d8e4){var _0x1ce8bd=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x1ce8bd[_0xaac9('0x69')](_0x55d8e4))throw new db[(_0xaac9('0x6a'))][(_0xaac9('0x6b'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');return;};exports[_0xaac9('0x6c')]=function(_0x3bb449,_0x798b17,_0x36c262){var _0x49091f=encryptor[_0xaac9('0x6d')](_0x798b17)[_0xaac9('0x6e')](',');for(var _0x7071ff=0x0;_0x7071ff<_0x36c262;_0x7071ff++){if(!_0x49091f[_0x7071ff])break;if(_0x3bb449[_0xaac9('0x6f')]()===_0x49091f[_0x7071ff][_0xaac9('0x6f')]()){var _0xe0e312=util[_0xaac9('0x70')](_0xaac9('0x71'),_0x36c262);if(_0x36c262===0x1){_0xe0e312=_0xaac9('0x72');}throw new db[(_0xaac9('0x6a'))][(_0xaac9('0x6b'))](_0xe0e312);}}return;};exports[_0xaac9('0x73')]=function(_0xf576a,_0x5dc78e){var _0x48b0f2=_0x5dc78e?encryptor[_0xaac9('0x6d')](_0x5dc78e)['split'](','):[];if(_0x48b0f2[_0xaac9('0x74')]===0x5){_0x48b0f2[_0xaac9('0x75')](-0x1,0x1);}_0x48b0f2[_0xaac9('0x76')](_0xf576a);return encryptor[_0xaac9('0x77')](_0x48b0f2[_0xaac9('0x78')](','));};function signJwt(_0x3bf699){var _0x48af9c=BPromise[_0xaac9('0x79')](jwt[_0xaac9('0x7a')],{'context':jwt});var _0x30272a=_0x3bf699[_0xaac9('0x7b')]||config[_0xaac9('0xe')][_0xaac9('0xf')];return new BPromise(function(_0x2b52f2,_0x46402a){_0x48af9c(_0x3bf699['payload'],_0x30272a,_0x3bf699[_0xaac9('0x7c')])[_0xaac9('0x36')](function(_0xe56b7e){_0x2b52f2(_0xe56b7e);})[_0xaac9('0x3b')](function(_0x461b1b){_0x46402a(_0x461b1b);});});}function verifyJwt(_0x3c413c,_0x46ad27,_0x31d9f0){var _0x1614f5=BPromise[_0xaac9('0x79')](jwt[_0xaac9('0x7d')],{'context':jwt});var _0x3b2927=_0x31d9f0||config[_0xaac9('0xe')][_0xaac9('0xf')];return new BPromise(function(_0x4e94c9,_0x2c7950){_0x1614f5(_0x3c413c,_0x3b2927,_0x46ad27)[_0xaac9('0x36')](function(_0x2e13ab){_0x4e94c9(_0x2e13ab);})[_0xaac9('0x3b')](function(_0x417871){_0x2c7950(_0x417871);});});}function generateNonce(){return crypto[_0xaac9('0x7e')](0x10)[_0xaac9('0x7f')](_0xaac9('0x80'));}function generateIssuedAt(){return Math[_0xaac9('0x81')](Date[_0xaac9('0x82')]()/0x3e8)[_0xaac9('0x7f')]();}function createJwt(_0x4644f0){var _0x236e67={'payload':{'iat':_0x4644f0['apiKeyIat'],'nonce':_0x4644f0['apiKeyNonce']},'options':{'algorithm':'HS512','subject':_0x4644f0['id'][_0xaac9('0x7f')](),'issuer':hardwareConf[_0xaac9('0x49')](),'audience':hardwareConf[_0xaac9('0x49')]()}};return signJwt(_0x236e67)[_0xaac9('0x36')](function(_0x2a3e03){return{'iat':_0x4644f0[_0xaac9('0x64')],'nonce':_0x4644f0[_0xaac9('0x65')],'token':_0x2a3e03};});} \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index 46d3573..e61ce3a 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 _0x1104=['decryptFile','createWriteStream','secret','utf8','decryptString','createDecipher','base64','bluebird','lodash','../../config/environment','../../config/logger','app','secrets','aes-256-ctr','aes192','encrypt','algorithm','join','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','filter','indexOf','hasOwnProperty','encryptFile','createReadStream','createCipher','data','update','binary','write','end','final','close','unlink'];(function(_0x3d7465,_0x213f3c){var _0x5c4d95=function(_0x9e61c0){while(--_0x9e61c0){_0x3d7465['push'](_0x3d7465['shift']());}};_0x5c4d95(++_0x213f3c);}(_0x1104,0x19f));var _0x4110=function(_0x167329,_0x17a7a7){_0x167329=_0x167329-0x0;var _0x43a896=_0x1104[_0x167329];return _0x43a896;};'use strict';var crypto=require('crypto');var fs=require('fs');var BPromise=require(_0x4110('0x0'));var _=require(_0x4110('0x1'));var config=require(_0x4110('0x2'));var logger=require(_0x4110('0x3'))(_0x4110('0x4'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x4110('0x5')]['session'],'algorithm':_0x4110('0x6')};const fileOptions={'algorithm':_0x4110('0x7')};if(config[_0x4110('0x8')]&&config[_0x4110('0x8')][_0x4110('0x9')]){var isSupported=isAlgorithmSupported(config[_0x4110('0x8')][_0x4110('0x9')]);if(isSupported){fileOptions['algorithm']=config[_0x4110('0x8')][_0x4110('0x9')];}else{var supportedAlgorithms=getSupportedCiphers()[_0x4110('0xa')](',\x20');logger[_0x4110('0xb')](config['encrypt']['algorithm'],_0x4110('0xc'),supportedAlgorithms);}}function isASupportedCipher(_0x3a9ddf){return AES_SUPPORTED_RX['test'](_0x3a9ddf);}function getSupportedCiphers(){return crypto['getCiphers']()[_0x4110('0xd')](isASupportedCipher);}function isAlgorithmSupported(_0x1295d2){return getSupportedCiphers()[_0x4110('0xe')](_0x1295d2)>-0x1;}function combineOptions(_0x14de2f){var _0x33ad47={};for(var _0x5a309e in fileOptions){if(fileOptions[_0x4110('0xf')](_0x5a309e)){_0x33ad47[_0x5a309e]=fileOptions[_0x5a309e];}}if(_0x14de2f){for(var _0x443835 in _0x14de2f){if(_0x14de2f['hasOwnProperty'](_0x443835)){_0x33ad47[_0x443835]=_0x14de2f[_0x443835];}}}return _0x33ad47;}exports[_0x4110('0x10')]=function(_0x2f438b,_0x529688,_0x4064f7,_0x11d175){return new BPromise(function(_0x21a93a,_0x4569bf){_0x11d175=combineOptions(_0x11d175);var _0x485542=new Buffer(_0x4064f7);var _0x26a99d=fs[_0x4110('0x11')](_0x2f438b);var _0x3bdc8e=fs['createWriteStream'](_0x529688);var _0x1c910f=crypto[_0x4110('0x12')](_0x11d175[_0x4110('0x9')],_0x485542);_0x26a99d['on'](_0x4110('0x13'),function(_0x569ac1){var _0x3e2fcd=new Buffer(_0x1c910f[_0x4110('0x14')](_0x569ac1),_0x4110('0x15'));_0x3bdc8e[_0x4110('0x16')](_0x3e2fcd);});_0x26a99d['on'](_0x4110('0x17'),function(){try{var _0x5e582e=new Buffer(_0x1c910f[_0x4110('0x18')](_0x4110('0x15')),_0x4110('0x15'));_0x3bdc8e[_0x4110('0x16')](_0x5e582e);_0x3bdc8e[_0x4110('0x17')]();_0x3bdc8e['on'](_0x4110('0x19'),function(){return _0x21a93a(_0x529688);});}catch(_0x3e1a43){fs[_0x4110('0x1a')](_0x529688);return _0x4569bf(_0x3e1a43);}});});};exports[_0x4110('0x1b')]=function(_0x53d1fd,_0x1720f4,_0x17acd4,_0x6bb3a0){return new BPromise(function(_0x2cda1a,_0xf4ee44){_0x6bb3a0=combineOptions(_0x6bb3a0);var _0x3746f1=new Buffer(_0x17acd4);var _0x27e9fe=fs[_0x4110('0x11')](_0x53d1fd);var _0x37c884=fs[_0x4110('0x1c')](_0x1720f4);var _0x5d2391=crypto['createDecipher'](_0x6bb3a0[_0x4110('0x9')],_0x3746f1);_0x27e9fe['on'](_0x4110('0x13'),function(_0x5a9700){var _0x1d6ae1=new Buffer(_0x5d2391[_0x4110('0x14')](_0x5a9700),_0x4110('0x15'));_0x37c884[_0x4110('0x16')](_0x1d6ae1);});_0x27e9fe['on'](_0x4110('0x17'),function(){try{var _0x31d260=new Buffer(_0x5d2391[_0x4110('0x18')](_0x4110('0x15')),_0x4110('0x15'));_0x37c884['write'](_0x31d260);_0x37c884['end']();_0x37c884['on'](_0x4110('0x19'),function(){return _0x2cda1a(_0x1720f4);});}catch(_0x565563){fs[_0x4110('0x1a')](_0x1720f4);return _0xf4ee44(_0x565563);}});});};exports['encryptString']=function(_0xb62260,_0x48609e,_0x5b3727){var _0x28719d=_0x5b3727||stringOptions[_0x4110('0x9')];var _0x5ce62e=_0x48609e||stringOptions[_0x4110('0x1d')];var _0x3c01b8=crypto[_0x4110('0x12')](_0x28719d,_0x5ce62e);var _0x4f0bbc=_0x3c01b8[_0x4110('0x14')](_0xb62260,_0x4110('0x1e'),'base64');_0x4f0bbc+=_0x3c01b8[_0x4110('0x18')]('base64');return _0x4f0bbc;};exports[_0x4110('0x1f')]=function(_0x321125,_0x384155,_0x41545f){var _0x1c2816=_0x41545f||stringOptions[_0x4110('0x9')];var _0x5d239c=_0x384155||stringOptions['secret'];var _0x5c2e29=crypto[_0x4110('0x20')](_0x1c2816,_0x5d239c);var _0x2ca087=_0x5c2e29[_0x4110('0x14')](_0x321125,_0x4110('0x21'),_0x4110('0x1e'));_0x2ca087+=_0x5c2e29['final'](_0x4110('0x1e'));return _0x2ca087;}; \ No newline at end of file +var _0x6052=['crypto','bluebird','lodash','../../config/environment','../../config/logger','secrets','encrypt','algorithm','join','error','test','filter','indexOf','hasOwnProperty','encryptFile','createReadStream','createWriteStream','data','final','binary','write','end','close','unlink','decryptFile','createDecipher','update','encryptString','secret','createCipher','utf8','base64','decryptString'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x6052,0x108));var _0x2605=function(_0x37a946,_0x12ef44){_0x37a946=_0x37a946-0x0;var _0x3203b5=_0x6052[_0x37a946];return _0x3203b5;};'use strict';var crypto=require(_0x2605('0x0'));var fs=require('fs');var BPromise=require(_0x2605('0x1'));var _=require(_0x2605('0x2'));var config=require(_0x2605('0x3'));var logger=require(_0x2605('0x4'))('app');const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x2605('0x5')]['session'],'algorithm':'aes-256-ctr'};const fileOptions={'algorithm':'aes192'};if(config[_0x2605('0x6')]&&config[_0x2605('0x6')][_0x2605('0x7')]){var isSupported=isAlgorithmSupported(config[_0x2605('0x6')][_0x2605('0x7')]);if(isSupported){fileOptions['algorithm']=config['encrypt'][_0x2605('0x7')];}else{var supportedAlgorithms=getSupportedCiphers()[_0x2605('0x8')](',\x20');logger[_0x2605('0x9')](config[_0x2605('0x6')][_0x2605('0x7')],'is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:',supportedAlgorithms);}}function isASupportedCipher(_0x3f5b85){return AES_SUPPORTED_RX[_0x2605('0xa')](_0x3f5b85);}function getSupportedCiphers(){return crypto['getCiphers']()[_0x2605('0xb')](isASupportedCipher);}function isAlgorithmSupported(_0x3b11bc){return getSupportedCiphers()[_0x2605('0xc')](_0x3b11bc)>-0x1;}function combineOptions(_0x3a8995){var _0x3e0b11={};for(var _0x5c1ea8 in fileOptions){if(fileOptions[_0x2605('0xd')](_0x5c1ea8)){_0x3e0b11[_0x5c1ea8]=fileOptions[_0x5c1ea8];}}if(_0x3a8995){for(var _0x483e2e in _0x3a8995){if(_0x3a8995[_0x2605('0xd')](_0x483e2e)){_0x3e0b11[_0x483e2e]=_0x3a8995[_0x483e2e];}}}return _0x3e0b11;}exports[_0x2605('0xe')]=function(_0x3764d7,_0x21fdfa,_0x15c757,_0x1bc468){return new BPromise(function(_0x7ee957,_0x645a30){_0x1bc468=combineOptions(_0x1bc468);var _0xc0c4e9=new Buffer(_0x15c757);var _0x270124=fs[_0x2605('0xf')](_0x3764d7);var _0x3a5a2a=fs[_0x2605('0x10')](_0x21fdfa);var _0x1394d0=crypto['createCipher'](_0x1bc468['algorithm'],_0xc0c4e9);_0x270124['on'](_0x2605('0x11'),function(_0x5c8ce4){var _0x310b94=new Buffer(_0x1394d0['update'](_0x5c8ce4),'binary');_0x3a5a2a['write'](_0x310b94);});_0x270124['on']('end',function(){try{var _0x41bda7=new Buffer(_0x1394d0[_0x2605('0x12')]('binary'),_0x2605('0x13'));_0x3a5a2a[_0x2605('0x14')](_0x41bda7);_0x3a5a2a[_0x2605('0x15')]();_0x3a5a2a['on'](_0x2605('0x16'),function(){return _0x7ee957(_0x21fdfa);});}catch(_0x5e890a){fs[_0x2605('0x17')](_0x21fdfa);return _0x645a30(_0x5e890a);}});});};exports[_0x2605('0x18')]=function(_0x3e532f,_0x4241b6,_0x5dae23,_0x240527){return new BPromise(function(_0x1d34af,_0x1d953b){_0x240527=combineOptions(_0x240527);var _0x4ceac3=new Buffer(_0x5dae23);var _0x23d468=fs['createReadStream'](_0x3e532f);var _0x2eeab9=fs['createWriteStream'](_0x4241b6);var _0x37516d=crypto[_0x2605('0x19')](_0x240527[_0x2605('0x7')],_0x4ceac3);_0x23d468['on'](_0x2605('0x11'),function(_0x1dc13a){var _0x1cb1dd=new Buffer(_0x37516d[_0x2605('0x1a')](_0x1dc13a),_0x2605('0x13'));_0x2eeab9[_0x2605('0x14')](_0x1cb1dd);});_0x23d468['on'](_0x2605('0x15'),function(){try{var _0x8dbc4f=new Buffer(_0x37516d[_0x2605('0x12')](_0x2605('0x13')),_0x2605('0x13'));_0x2eeab9[_0x2605('0x14')](_0x8dbc4f);_0x2eeab9[_0x2605('0x15')]();_0x2eeab9['on'](_0x2605('0x16'),function(){return _0x1d34af(_0x4241b6);});}catch(_0x429a29){fs[_0x2605('0x17')](_0x4241b6);return _0x1d953b(_0x429a29);}});});};exports[_0x2605('0x1b')]=function(_0x5aa1f9,_0x342592,_0x3caf9b){var _0x17991a=_0x3caf9b||stringOptions[_0x2605('0x7')];var _0x32627d=_0x342592||stringOptions[_0x2605('0x1c')];var _0x35677e=crypto[_0x2605('0x1d')](_0x17991a,_0x32627d);var _0x58b049=_0x35677e[_0x2605('0x1a')](_0x5aa1f9,_0x2605('0x1e'),'base64');_0x58b049+=_0x35677e[_0x2605('0x12')](_0x2605('0x1f'));return _0x58b049;};exports[_0x2605('0x20')]=function(_0x9aa5,_0x152878,_0x35d275){var _0x1c4a7a=_0x35d275||stringOptions[_0x2605('0x7')];var _0x4612a7=_0x152878||stringOptions[_0x2605('0x1c')];var _0x205359=crypto[_0x2605('0x19')](_0x1c4a7a,_0x4612a7);var _0x5e6de1=_0x205359[_0x2605('0x1a')](_0x9aa5,_0x2605('0x1f'),_0x2605('0x1e'));_0x5e6de1+=_0x205359['final'](_0x2605('0x1e'));return _0x5e6de1;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index 0ff592f..6a748ce 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 _0x9aea=['../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','info','format','CSV','find','split','splitSizeCsv','then','sequelize','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','num','Empty','length','query','%s\x20limit\x20%d\x20OFFSET\x20%d','SELECT','push','dirname','join','mkdirSync','each','%s%d.%s','csv','%s.%s','writeFileSync','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','finally','exit','util','lodash','bluebird','zip-dir'];(function(_0x449da1,_0x879db8){var _0x95991e=function(_0x55cfd4){while(--_0x55cfd4){_0x449da1['push'](_0x449da1['shift']());}};_0x95991e(++_0x879db8);}(_0x9aea,0xdd));var _0xa9ae=function(_0x3c7a49,_0x407528){_0x3c7a49=_0x3c7a49-0x0;var _0x461901=_0x9aea[_0x3c7a49];return _0x461901;};'use strict';var util=require(_0xa9ae('0x0'));var path=require('path');var _=require(_0xa9ae('0x1'));var csv=require('to-csv');var fs=require('fs');var BPromise=require(_0xa9ae('0x2'));var zipdir=require(_0xa9ae('0x3'));var rimraf=require('rimraf');var db=require(_0xa9ae('0x4'))['db'];var dbH=require(_0xa9ae('0x4'))[_0xa9ae('0x5')];var logger=require(_0xa9ae('0x6'))(_0xa9ae('0x7'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0xa9ae('0x8')][0x3];var PATH=process[_0xa9ae('0x8')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x1e57c4,_0x53e52c){var _0x1f2e4b={'status':_0x1e57c4};var _0x3917f0={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x53e52c){_0x1f2e4b[_0xa9ae('0x9')]=_0x53e52c;}return db[_0xa9ae('0xa')][_0xa9ae('0xb')](_0x1f2e4b,_0x3917f0);}function main(){var _0x2d1188=0x1388;var _0x1816c2;logger[_0xa9ae('0xc')](util[_0xa9ae('0xd')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xa9ae('0xe')));return db['Setting'][_0xa9ae('0xf')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xa9ae('0x10'),_0xa9ae('0x11')]})[_0xa9ae('0x12')](function(_0x35f861){if(_0x35f861){_0x1816c2=_0x35f861;_0x2d1188=_0x1816c2[_0xa9ae('0x11')]||0x1388;}})[_0xa9ae('0x12')](function(){return dbH[_0xa9ae('0x13')]['query'](util[_0xa9ae('0xd')](_0xa9ae('0x14'),QUERY),{'type':dbH[_0xa9ae('0x13')][_0xa9ae('0x15')]['SELECT']});})[_0xa9ae('0x12')](function(_0x1ec742){if(!_0x1ec742[0x0][_0xa9ae('0x16')]){return analyticExtractedReport(_0xa9ae('0x17'));}var _0x77b0a4=[];var _0xddb095=0x0;var _0x524bb2=!![];if(_0x1ec742&&_0x1ec742[_0xa9ae('0x18')]){var _0x42a98c=_0x1ec742[0x0][_0xa9ae('0x16')]%(_0xddb095+_0x2d1188);if(_0x1816c2['split']){for(;_0x524bb2;_0xddb095+=_0x2d1188,_0x42a98c=_0x1ec742[0x0]['num']%(_0xddb095+_0x2d1188)){if(_0x42a98c==0x0||_0x42a98c==_0x1ec742[0x0][_0xa9ae('0x16')]){_0x524bb2=![];}_0x77b0a4['push'](dbH['sequelize'][_0xa9ae('0x19')](util[_0xa9ae('0xd')](_0xa9ae('0x1a'),QUERY,_0x2d1188,_0xddb095),{'type':dbH[_0xa9ae('0x13')]['QueryTypes'][_0xa9ae('0x1b')]}));}}else{_0x77b0a4[_0xa9ae('0x1c')](dbH[_0xa9ae('0x13')][_0xa9ae('0x19')](QUERY,{'type':dbH[_0xa9ae('0x13')][_0xa9ae('0x15')][_0xa9ae('0x1b')]}));}}var _0x5a062d=path[_0xa9ae('0x1d')](PATH);var _0x4ca9a9=path['basename'](PATH,'.csv');var _0x478bb7=_0x1816c2[_0xa9ae('0x10')]&&_0x77b0a4['length']>0x1;var _0x13fb05=[];if(!fs['existsSync'](path[_0xa9ae('0x1e')](_0x5a062d,_0x4ca9a9))&&_0x478bb7){fs[_0xa9ae('0x1f')](path[_0xa9ae('0x1e')](_0x5a062d,_0x4ca9a9));}return BPromise[_0xa9ae('0x20')](_0x77b0a4,function(_0x12b061){_0x13fb05[_0xa9ae('0x1c')](_0x12b061);})[_0xa9ae('0x12')](function(){for(var _0x5e82f1=0x0;_0x5e82f1<_0x13fb05[_0xa9ae('0x18')];_0x5e82f1+=0x1){var _0x3873aa;var _0x2aac9e=_0x13fb05[_0x5e82f1];if(_0x478bb7){_0x3873aa=path[_0xa9ae('0x1e')](_0x5a062d,_0x4ca9a9,util[_0xa9ae('0xd')](_0xa9ae('0x21'),_0x4ca9a9,_0x5e82f1,_0xa9ae('0x22')));}else{_0x3873aa=path['join'](_0x5a062d,util['format'](_0xa9ae('0x23'),_0x4ca9a9,_0xa9ae('0x22')));}fs[_0xa9ae('0x24')](_0x3873aa,csv(_0x2aac9e));}})[_0xa9ae('0x12')](function(){if(_0x478bb7){zipdir(path[_0xa9ae('0x1e')](_0x5a062d,_0x4ca9a9),{'saveTo':path['join'](_0x5a062d,util['format'](_0xa9ae('0x23'),_0x4ca9a9,_0xa9ae('0x25')))},function(_0x372ec7,_0x3a48b7){});rimraf(path[_0xa9ae('0x1e')](_0x5a062d,_0x4ca9a9),function(){});}})[_0xa9ae('0x12')](function(){logger['info'](util['format'](_0xa9ae('0x26'),EXTRACTED_REPORT_ID,_0xa9ae('0xe')));return analyticExtractedReport(_0xa9ae('0x27'),_0x478bb7?util[_0xa9ae('0xd')](_0xa9ae('0x23'),_0x4ca9a9,_0x478bb7?_0xa9ae('0x25'):_0xa9ae('0x22')):null);});})[_0xa9ae('0x28')](function(_0x5c4f79){logger[_0xa9ae('0xc')](util['format'](_0xa9ae('0x29'),EXTRACTED_REPORT_ID,_0xa9ae('0xe')),util[_0xa9ae('0x2a')](_0x5c4f79,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0xa9ae('0x2b')](function(){process[_0xa9ae('0x2c')](EXIT_CODE);});}main(); \ No newline at end of file +var _0xb688=['.csv','join','mkdirSync','each','%s%d.%s','csv','writeFileSync','%s.%s','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','path','lodash','to-csv','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','find','split','splitSizeCsv','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','SELECT','length','num','%s\x20limit\x20%d\x20OFFSET\x20%d','push','QueryTypes','dirname','basename'];(function(_0x39c029,_0x58e82f){var _0x499b6c=function(_0x594442){while(--_0x594442){_0x39c029['push'](_0x39c029['shift']());}};_0x499b6c(++_0x58e82f);}(_0xb688,0xcf));var _0x8b68=function(_0x4cdbcb,_0x18d0b0){_0x4cdbcb=_0x4cdbcb-0x0;var _0x2703b3=_0xb688[_0x4cdbcb];return _0x2703b3;};'use strict';var util=require('util');var path=require(_0x8b68('0x0'));var _=require(_0x8b68('0x1'));var csv=require(_0x8b68('0x2'));var fs=require('fs');var BPromise=require(_0x8b68('0x3'));var zipdir=require(_0x8b68('0x4'));var rimraf=require(_0x8b68('0x5'));var db=require('../../mysqldb')['db'];var dbH=require(_0x8b68('0x6'))[_0x8b68('0x7')];var logger=require(_0x8b68('0x8'))(_0x8b68('0x9'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x8b68('0xa')][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x37677d,_0x2bbffd){var _0x130892={'status':_0x37677d};var _0xa5571b={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x2bbffd){_0x130892[_0x8b68('0xb')]=_0x2bbffd;}return db[_0x8b68('0xc')][_0x8b68('0xd')](_0x130892,_0xa5571b);}function main(){var _0x21d944=0x1388;var _0x24e0b0;logger[_0x8b68('0xe')](util[_0x8b68('0xf')](_0x8b68('0x10'),EXTRACTED_REPORT_ID,_0x8b68('0x11')));return db['Setting'][_0x8b68('0x12')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x8b68('0x13'),_0x8b68('0x14')]})[_0x8b68('0x15')](function(_0x1965cf){if(_0x1965cf){_0x24e0b0=_0x1965cf;_0x21d944=_0x24e0b0[_0x8b68('0x14')]||0x1388;}})[_0x8b68('0x15')](function(){return dbH[_0x8b68('0x16')][_0x8b68('0x17')](util['format'](_0x8b68('0x18'),QUERY),{'type':dbH['sequelize']['QueryTypes'][_0x8b68('0x19')]});})[_0x8b68('0x15')](function(_0x27d717){if(!_0x27d717[0x0]['num']){return analyticExtractedReport('Empty');}var _0x23bd52=[];var _0x5c1e44=0x0;var _0x136f1b=!![];if(_0x27d717&&_0x27d717[_0x8b68('0x1a')]){var _0x1df44f=_0x27d717[0x0][_0x8b68('0x1b')]%(_0x5c1e44+_0x21d944);if(_0x24e0b0['split']){for(;_0x136f1b;_0x5c1e44+=_0x21d944,_0x1df44f=_0x27d717[0x0][_0x8b68('0x1b')]%(_0x5c1e44+_0x21d944)){if(_0x1df44f==0x0||_0x1df44f==_0x27d717[0x0][_0x8b68('0x1b')]){_0x136f1b=![];}_0x23bd52['push'](dbH[_0x8b68('0x16')][_0x8b68('0x17')](util[_0x8b68('0xf')](_0x8b68('0x1c'),QUERY,_0x21d944,_0x5c1e44),{'type':dbH[_0x8b68('0x16')]['QueryTypes'][_0x8b68('0x19')]}));}}else{_0x23bd52[_0x8b68('0x1d')](dbH[_0x8b68('0x16')][_0x8b68('0x17')](QUERY,{'type':dbH[_0x8b68('0x16')][_0x8b68('0x1e')]['SELECT']}));}}var _0x571adf=path[_0x8b68('0x1f')](PATH);var _0x59cb26=path[_0x8b68('0x20')](PATH,_0x8b68('0x21'));var _0x13aee5=_0x24e0b0[_0x8b68('0x13')]&&_0x23bd52[_0x8b68('0x1a')]>0x1;var _0x173524=[];if(!fs['existsSync'](path[_0x8b68('0x22')](_0x571adf,_0x59cb26))&&_0x13aee5){fs[_0x8b68('0x23')](path['join'](_0x571adf,_0x59cb26));}return BPromise[_0x8b68('0x24')](_0x23bd52,function(_0x3cf8d2){_0x173524[_0x8b68('0x1d')](_0x3cf8d2);})['then'](function(){for(var _0x511ccf=0x0;_0x511ccf<_0x173524['length'];_0x511ccf+=0x1){var _0x92d186;var _0x448e43=_0x173524[_0x511ccf];if(_0x13aee5){_0x92d186=path[_0x8b68('0x22')](_0x571adf,_0x59cb26,util['format'](_0x8b68('0x25'),_0x59cb26,_0x511ccf,'csv'));}else{_0x92d186=path['join'](_0x571adf,util[_0x8b68('0xf')]('%s.%s',_0x59cb26,_0x8b68('0x26')));}fs[_0x8b68('0x27')](_0x92d186,csv(_0x448e43));}})['then'](function(){if(_0x13aee5){zipdir(path['join'](_0x571adf,_0x59cb26),{'saveTo':path[_0x8b68('0x22')](_0x571adf,util[_0x8b68('0xf')](_0x8b68('0x28'),_0x59cb26,_0x8b68('0x29')))},function(_0x210926,_0x2ad2df){});rimraf(path[_0x8b68('0x22')](_0x571adf,_0x59cb26),function(){});}})['then'](function(){logger[_0x8b68('0xe')](util['format'](_0x8b68('0x2a'),EXTRACTED_REPORT_ID,_0x8b68('0x11')));return analyticExtractedReport('Completed',_0x13aee5?util[_0x8b68('0xf')](_0x8b68('0x28'),_0x59cb26,_0x13aee5?_0x8b68('0x29'):'csv'):null);});})['catch'](function(_0x13c26b){logger[_0x8b68('0xe')](util[_0x8b68('0xf')](_0x8b68('0x2b'),EXTRACTED_REPORT_ID,_0x8b68('0x11')),util[_0x8b68('0x2c')](_0x13c26b,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x8b68('0x2d'));})[_0x8b68('0x2e')](function(){process[_0x8b68('0x2f')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index d83546c..de1b4f9 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 _0xd14e=['pipe','finish','error','end','lodash','path','moment','pdfmake/src/printer','rimraf','jsdom','JSDOM','../../mysqldb','dbH','../../config/logger','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','update','map','tableHeader','pick','toString','value','fill','length','auto','body','push','concat','chunk','forEach','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','startDate','header','pageBreak','before','margin','\x20/\x20','footer','Arial','black','dirname','.pdf','%s.%s','pdf','find','split','splitSizePdf','then','num','%s\x20limit\x20%d\x20OFFSET\x20%d','sequelize','QueryTypes','SELECT','query','existsSync','join','all','flatten','createPdfKitDocument','%s%d.%s','zip','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','CSV','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','PDF','AnalyticExtractedReport','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','channel','YYYY-MM-DD','center','Interaction\x20Transcript','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s'];(function(_0x23f882,_0x523579){var _0x3817ba=function(_0xe313a4){while(--_0xe313a4){_0x23f882['push'](_0x23f882['shift']());}};_0x3817ba(++_0x523579);}(_0xd14e,0x1b7));var _0xed14=function(_0x5d58fc,_0xde80ac){_0x5d58fc=_0x5d58fc-0x0;var _0x4b46a4=_0xd14e[_0x5d58fc];return _0x4b46a4;};'use strict';var _=require(_0xed14('0x0'));var fs=require('fs');var util=require('util');var path=require(_0xed14('0x1'));var moment=require(_0xed14('0x2'));var htmlToPdfmake=require('html-to-pdfmake');var PdfPrinter=require(_0xed14('0x3'));var zipdir=require('zip-dir');var rimraf=require(_0xed14('0x4'));var JSDOM=require(_0xed14('0x5'))[_0xed14('0x6')];var window=new JSDOM('')['window'];var db=require('../../mysqldb')['db'];var dbH=require(_0xed14('0x7'))[_0xed14('0x8')];var logger=require(_0xed14('0x9'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0xed14('0xa')][0x2]);var QUERY=process['argv'][0x3];var PATH=process['argv'][0x4];var NAME=process['argv'][0x5];var FORMAT=_0xed14('0xb');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x273da7,_0x4a94ec){var _0x1c2308={'status':_0x273da7};var _0x4f97a3={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x4a94ec){_0x1c2308[_0xed14('0xc')]=_0x4a94ec;}return db['AnalyticExtractedReport'][_0xed14('0xd')](_0x1c2308,_0x4f97a3);}function getHeaders(_0x4a36ac){return _[_0xed14('0xe')](_0x4a36ac,function(_0xba8eb9){return{'text':_0xba8eb9,'style':_0xed14('0xf')};});}function getRows(_0x70caf7,_0x54b62b){return _[_0xed14('0xe')](_0x54b62b,function(_0x53706e){return _(_0x53706e)[_0xed14('0x10')](_0x70caf7)['map'](function(_0x29b0d1){return _0x29b0d1?_[_0xed14('0x11')](_0x29b0d1):'';})[_0xed14('0x12')]();});}function createTable(_0x4fe9ec,_0xe332fc){var _0x815baa={'widths':_[_0xed14('0x13')](Array(_0x4fe9ec[_0xed14('0x14')]),0x91),'heights':function(_0x59864b){return _0x59864b===0x0?_0xed14('0x15'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x21b4f1=getHeaders(_0x4fe9ec);_0x815baa[_0xed14('0x16')][_0xed14('0x17')](_0x21b4f1);var _0x4a764=getRows(_0x4fe9ec,_0xe332fc);_0x815baa[_0xed14('0x16')]=_0x815baa[_0xed14('0x16')][_0xed14('0x18')](_0x4a764);return _0x815baa;}function createTables(_0x3f205e){var _0x2276ad=[];var _0x3ab573=_[_0xed14('0x19')](Object['keys'](_0x3f205e[0x0]),0x5);_0x3ab573[_0xed14('0x1a')](function(_0x26bb0c){_0x2276ad[_0xed14('0x17')](createTable(_0x26bb0c,_0x3f205e));});return _0x2276ad;}function getPDFDocDefinition(_0x2978a6){var _0x3bfde3=util[_0xed14('0x1b')](_0xed14('0x1c'),NAME,EXTRACTED_REPORT[_0xed14('0x1d')],moment(EXTRACTED_REPORT[_0xed14('0x1e')])['format'](FORMAT),moment(EXTRACTED_REPORT['endDate'])[_0xed14('0x1b')](FORMAT));var _0x3c795d=[];for(var _0x2b2f27=0x0;_0x2b2f27<_0x2978a6[_0xed14('0x14')];_0x2b2f27++){var _0xe7bb3a=[];if(_0x2b2f27===0x0){_0xe7bb3a['push']({'text':_0x3bfde3,'style':_0xed14('0x1f')});}var _0x5e4ad6={'table':_0x2978a6[_0x2b2f27]};if(_0x2b2f27>0x0){_0x5e4ad6[_0xed14('0x20')]=_0xed14('0x21');_0x5e4ad6[_0xed14('0x22')]=[0x0,0x46,0x0,0x0];}_0xe7bb3a['push'](_0x5e4ad6);_0x3c795d[_0xed14('0x17')](_0xe7bb3a);}return{'pageSize':'A4','pageOrientation':'landscape','content':_0x3c795d,'footer':function(_0x5dc403,_0x4965a1){return{'text':_0x5dc403[_0xed14('0x11')]()+_0xed14('0x23')+_0x4965a1,'style':_0xed14('0x24')};},'defaultStyle':{'font':_0xed14('0x25')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0xed14('0x26')},'footer':{'alignment':'right','margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x20b289){var _0x132c0b=0x1388;var _0x5eaeac;if(!_0x20b289[0x0]['num']){return analyticExtractedReport('Empty');}var _0x56ff48=[];var _0x5d217f=0x0;var _0x260eae=!![];var _0x530750=path[_0xed14('0x27')](PATH);var _0x55a75f=path['basename'](PATH,_0xed14('0x28'));var _0x753fda=path['join'](_0x530750,util[_0xed14('0x1b')](_0xed14('0x29'),_0x55a75f,_0xed14('0x2a')));var _0x3c4368=![];return db['Setting'][_0xed14('0x2b')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xed14('0x2c'),_0xed14('0x2d')]})[_0xed14('0x2e')](function(_0x3ffae9){if(_0x3ffae9){_0x5eaeac=_0x3ffae9;_0x132c0b=_0x5eaeac[_0xed14('0x2d')]||0x3e8;}})['then'](function(){if(_0x20b289&&_0x20b289[_0xed14('0x14')]){var _0x3e2a31=_0x20b289[0x0]['num']%(_0x5d217f+_0x132c0b);if(_0x5eaeac[_0xed14('0x2c')]){for(;_0x260eae;_0x5d217f+=_0x132c0b,_0x3e2a31=_0x20b289[0x0][_0xed14('0x2f')]%(_0x5d217f+_0x132c0b)){if(_0x3e2a31==0x0||_0x3e2a31==_0x20b289[0x0][_0xed14('0x2f')]){_0x260eae=![];}_0x56ff48['push'](dbH['sequelize']['query'](util['format'](_0xed14('0x30'),QUERY,_0x132c0b,_0x5d217f),{'type':dbH[_0xed14('0x31')][_0xed14('0x32')][_0xed14('0x33')]}));}}else{_0x56ff48[_0xed14('0x17')](dbH['sequelize'][_0xed14('0x34')](QUERY,{'type':dbH['sequelize'][_0xed14('0x32')]['SELECT']}));}}_0x3c4368=_0x5eaeac[_0xed14('0x2c')]&&_0x56ff48[_0xed14('0x14')]>0x1;if(!fs[_0xed14('0x35')](path[_0xed14('0x36')](_0x530750,_0x55a75f))&&_0x3c4368){fs['mkdirSync'](path[_0xed14('0x36')](_0x530750,_0x55a75f));}return Promise[_0xed14('0x37')](_0x56ff48);})['then'](function(_0x6f306e){return createTables(_[_0xed14('0x38')](_0x6f306e));})[_0xed14('0x2e')](function(_0x359c43){var _0x1ae8f1=getPDFDocDefinition(_0x359c43);var _0x4b20b9=getPDFPrinter();var _0x5428fe=_0x4b20b9[_0xed14('0x39')](_0x1ae8f1);if(_0x3c4368)_0x753fda=path[_0xed14('0x36')](_0x530750,_0x55a75f,util[_0xed14('0x1b')](_0xed14('0x3a'),_0x55a75f,index,_0xed14('0x2a')));return writePDFDocument(_0x5428fe,_0x753fda);})[_0xed14('0x2e')](function(){if(!_0x3c4368)return;zipdir(path[_0xed14('0x36')](_0x530750,_0x55a75f),{'saveTo':path[_0xed14('0x36')](_0x530750,util['format']('%s.%s',_0x55a75f,_0xed14('0x3b')))},function(_0x3bc2af){if(_0x3bc2af)throw _0x3bc2af;return;});})['then'](function(){if(!_0x3c4368)return;rimraf(path[_0xed14('0x36')](_0x530750,_0x55a75f),function(){});})['then'](function(){logger[_0xed14('0x3c')](util[_0xed14('0x1b')](_0xed14('0x3d'),EXTRACTED_REPORT_ID,_0xed14('0x3e')));return analyticExtractedReport('Completed',_0x3c4368?util[_0xed14('0x1b')](_0xed14('0x29'),_0x55a75f,_0x3c4368?'zip':_0xed14('0x2a')):null);});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0xed14('0x3c')](util[_0xed14('0x1b')](_0xed14('0x3f'),EXTRACTED_REPORT_ID,_0xed14('0x40')));return db[_0xed14('0x41')][_0xed14('0x42')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0xed14('0x2e')](function(_0x4b45d7){EXTRACTED_REPORT=_0x4b45d7;return dbH[_0xed14('0x31')][_0xed14('0x34')](util['format'](_0xed14('0x43'),QUERY),{'type':dbH[_0xed14('0x31')][_0xed14('0x32')][_0xed14('0x33')]});})[_0xed14('0x2e')](extractReport)[_0xed14('0x44')](function(_0x418484){logger[_0xed14('0x3c')](util[_0xed14('0x1b')](_0xed14('0x45'),EXTRACTED_REPORT_ID,_0xed14('0x40')),util[_0xed14('0x46')](_0x418484,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xed14('0x47'));})[_0xed14('0x48')](function(){process[_0xed14('0x49')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x22df96=new PdfPrinter({'Arial':{'normal':__dirname+_0xed14('0x4a'),'bold':__dirname+_0xed14('0x4b'),'italics':__dirname+_0xed14('0x4c'),'bolditalics':__dirname+_0xed14('0x4d')}});return _0x22df96;}function getPDFDocDefinitionFromHTML(_0x525e9b,_0x3204e6){var _0x7cb073=util['format']('%s\x20#%d',_0x3204e6[_0xed14('0x4e')],_0x3204e6['interactionId']);var _0x4fef05=moment()[_0xed14('0x1b')](_0xed14('0x4f'))[_0xed14('0x11')]();var _0x219950=htmlToPdfmake(_0x525e9b,{'window':window,'tableAutoSize':!![]});return{'content':[_0x219950],'defaultStyle':{'font':_0xed14('0x25')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':'center','margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0xed14('0x50'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0xed14('0x50')}},'header':function(){return[{'text':_0xed14('0x51'),'style':_0xed14('0x1f')}];},'footer':function(_0xed7a34,_0xf8a7aa){return[{'text':util[_0xed14('0x1b')](_0xed14('0x52'),_0x7cb073,_0xed7a34,_0xf8a7aa,_0x4fef05),'style':_0xed14('0x24')}];}};}function writePDFDocument(_0x58fee7,_0x377747){return new Promise(function(_0x5ba43e,_0x492729){var _0x15c57f=_0x58fee7[_0xed14('0x53')](fs['createWriteStream'](_0x377747));_0x15c57f['on'](_0xed14('0x54'),function(){_0x5ba43e(_0xed14('0x54'));});_0x15c57f['on'](_0xed14('0x55'),function(_0x48e067){_0x492729(_0x48e067);});_0x58fee7[_0xed14('0x56')]();});}exports['createPdfFromHTML']=function(_0x1edc2c,_0x45cfcc){var _0x59ace9=getPDFPrinter();var _0x365ca3=getPDFDocDefinitionFromHTML(_0x1edc2c,_0x45cfcc);var _0x42c4e4=_0x59ace9['createPdfKitDocument'](_0x365ca3);return writePDFDocument(_0x42c4e4,_0x45cfcc[_0xed14('0x1')])['catch'](function(_0x1d0661){throw _0x1d0661;});}; \ No newline at end of file +var _0xbdbb=['/fonts/arial-bold-italic.ttf','%s\x20#%d','channel','interactionId','YYYY-MM-DD','toString','center','Interaction\x20Transcript','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','finish','error','end','createPdfFromHTML','lodash','util','path','moment','html-to-pdfmake','pdfmake/src/printer','zip-dir','rimraf','jsdom','JSDOM','window','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','map','tableHeader','pick','fill','auto','body','push','forEach','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','startDate','endDate','length','header','pageBreak','before','margin','landscape','\x20/\x20','footer','Arial','black','right','num','Empty','basename','join','%s.%s','Setting','split','splitSizePdf','then','sequelize','query','%s\x20limit\x20%d\x20OFFSET\x20%d','SELECT','QueryTypes','existsSync','mkdirSync','flatten','createPdfKitDocument','%s%d.%s','pdf','zip','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','CSV','Completed','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','PDF','findOne','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','exit','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf'];(function(_0x3ac15b,_0x4b0107){var _0x4411a9=function(_0x178e43){while(--_0x178e43){_0x3ac15b['push'](_0x3ac15b['shift']());}};_0x4411a9(++_0x4b0107);}(_0xbdbb,0x1d4));var _0xbbdb=function(_0x145eb2,_0x396cab){_0x145eb2=_0x145eb2-0x0;var _0x447d25=_0xbdbb[_0x145eb2];return _0x447d25;};'use strict';var _=require(_0xbbdb('0x0'));var fs=require('fs');var util=require(_0xbbdb('0x1'));var path=require(_0xbbdb('0x2'));var moment=require(_0xbbdb('0x3'));var htmlToPdfmake=require(_0xbbdb('0x4'));var PdfPrinter=require(_0xbbdb('0x5'));var zipdir=require(_0xbbdb('0x6'));var rimraf=require(_0xbbdb('0x7'));var JSDOM=require(_0xbbdb('0x8'))[_0xbbdb('0x9')];var window=new JSDOM('')[_0xbbdb('0xa')];var db=require(_0xbbdb('0xb'))['db'];var dbH=require(_0xbbdb('0xb'))[_0xbbdb('0xc')];var logger=require(_0xbbdb('0xd'))(_0xbbdb('0xe'));var EXTRACTED_REPORT_ID=Number(process[_0xbbdb('0xf')][0x2]);var QUERY=process[_0xbbdb('0xf')][0x3];var PATH=process[_0xbbdb('0xf')][0x4];var NAME=process[_0xbbdb('0xf')][0x5];var FORMAT='MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a';var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x311254,_0x27d6e3){var _0x33a5fb={'status':_0x311254};var _0xb818a9={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x27d6e3){_0x33a5fb[_0xbbdb('0x10')]=_0x27d6e3;}return db[_0xbbdb('0x11')]['update'](_0x33a5fb,_0xb818a9);}function getHeaders(_0x58bb84){return _[_0xbbdb('0x12')](_0x58bb84,function(_0x4e81e9){return{'text':_0x4e81e9,'style':_0xbbdb('0x13')};});}function getRows(_0x20b54c,_0x5b31a9){return _['map'](_0x5b31a9,function(_0x438fa2){return _(_0x438fa2)[_0xbbdb('0x14')](_0x20b54c)[_0xbbdb('0x12')](function(_0x1e2f7d){return _0x1e2f7d?_['toString'](_0x1e2f7d):'';})['value']();});}function createTable(_0x4802a5,_0x230497){var _0xa84a36={'widths':_[_0xbbdb('0x15')](Array(_0x4802a5['length']),0x91),'heights':function(_0x536c02){return _0x536c02===0x0?_0xbbdb('0x16'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x125409=getHeaders(_0x4802a5);_0xa84a36[_0xbbdb('0x17')][_0xbbdb('0x18')](_0x125409);var _0x57cbb4=getRows(_0x4802a5,_0x230497);_0xa84a36[_0xbbdb('0x17')]=_0xa84a36[_0xbbdb('0x17')]['concat'](_0x57cbb4);return _0xa84a36;}function createTables(_0xb326d6){var _0x16f01e=[];var _0x195f18=_['chunk'](Object['keys'](_0xb326d6[0x0]),0x5);_0x195f18[_0xbbdb('0x19')](function(_0x2d749b){_0x16f01e['push'](createTable(_0x2d749b,_0xb326d6));});return _0x16f01e;}function getPDFDocDefinition(_0xf78f0){var _0x5c09fe=util[_0xbbdb('0x1a')](_0xbbdb('0x1b'),NAME,EXTRACTED_REPORT[_0xbbdb('0x1c')],moment(EXTRACTED_REPORT[_0xbbdb('0x1d')])['format'](FORMAT),moment(EXTRACTED_REPORT[_0xbbdb('0x1e')])[_0xbbdb('0x1a')](FORMAT));var _0x2a9bfd=[];for(var _0xc3af54=0x0;_0xc3af54<_0xf78f0[_0xbbdb('0x1f')];_0xc3af54++){var _0x59f72b=[];if(_0xc3af54===0x0){_0x59f72b['push']({'text':_0x5c09fe,'style':_0xbbdb('0x20')});}var _0x23be81={'table':_0xf78f0[_0xc3af54]};if(_0xc3af54>0x0){_0x23be81[_0xbbdb('0x21')]=_0xbbdb('0x22');_0x23be81[_0xbbdb('0x23')]=[0x0,0x46,0x0,0x0];}_0x59f72b['push'](_0x23be81);_0x2a9bfd[_0xbbdb('0x18')](_0x59f72b);}return{'pageSize':'A4','pageOrientation':_0xbbdb('0x24'),'content':_0x2a9bfd,'footer':function(_0xe32da8,_0xbed891){return{'text':_0xe32da8['toString']()+_0xbbdb('0x25')+_0xbed891,'style':_0xbbdb('0x26')};},'defaultStyle':{'font':_0xbbdb('0x27')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0xbbdb('0x28')},'footer':{'alignment':_0xbbdb('0x29'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x119f6c){var _0xf163b0=0x1388;var _0x40ca0f;if(!_0x119f6c[0x0][_0xbbdb('0x2a')]){return analyticExtractedReport(_0xbbdb('0x2b'));}var _0x18aa96=[];var _0x27f61d=0x0;var _0x5f0100=!![];var _0x4d0ec7=path['dirname'](PATH);var _0x4f4c52=path[_0xbbdb('0x2c')](PATH,'.pdf');var _0x4bb63f=path[_0xbbdb('0x2d')](_0x4d0ec7,util[_0xbbdb('0x1a')](_0xbbdb('0x2e'),_0x4f4c52,'pdf'));var _0x2b07da=![];return db[_0xbbdb('0x2f')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xbbdb('0x30'),_0xbbdb('0x31')]})[_0xbbdb('0x32')](function(_0x335cb4){if(_0x335cb4){_0x40ca0f=_0x335cb4;_0xf163b0=_0x40ca0f[_0xbbdb('0x31')]||0x3e8;}})[_0xbbdb('0x32')](function(){if(_0x119f6c&&_0x119f6c[_0xbbdb('0x1f')]){var _0x32a1ea=_0x119f6c[0x0][_0xbbdb('0x2a')]%(_0x27f61d+_0xf163b0);if(_0x40ca0f[_0xbbdb('0x30')]){for(;_0x5f0100;_0x27f61d+=_0xf163b0,_0x32a1ea=_0x119f6c[0x0][_0xbbdb('0x2a')]%(_0x27f61d+_0xf163b0)){if(_0x32a1ea==0x0||_0x32a1ea==_0x119f6c[0x0][_0xbbdb('0x2a')]){_0x5f0100=![];}_0x18aa96[_0xbbdb('0x18')](dbH[_0xbbdb('0x33')][_0xbbdb('0x34')](util[_0xbbdb('0x1a')](_0xbbdb('0x35'),QUERY,_0xf163b0,_0x27f61d),{'type':dbH[_0xbbdb('0x33')]['QueryTypes'][_0xbbdb('0x36')]}));}}else{_0x18aa96[_0xbbdb('0x18')](dbH[_0xbbdb('0x33')][_0xbbdb('0x34')](QUERY,{'type':dbH[_0xbbdb('0x33')][_0xbbdb('0x37')][_0xbbdb('0x36')]}));}}_0x2b07da=_0x40ca0f[_0xbbdb('0x30')]&&_0x18aa96['length']>0x1;if(!fs[_0xbbdb('0x38')](path[_0xbbdb('0x2d')](_0x4d0ec7,_0x4f4c52))&&_0x2b07da){fs[_0xbbdb('0x39')](path['join'](_0x4d0ec7,_0x4f4c52));}return Promise['all'](_0x18aa96);})['then'](function(_0x12e83a){return createTables(_[_0xbbdb('0x3a')](_0x12e83a));})['then'](function(_0x45efb4){var _0x13744e=getPDFDocDefinition(_0x45efb4);var _0x20740f=getPDFPrinter();var _0x83ec59=_0x20740f[_0xbbdb('0x3b')](_0x13744e);if(_0x2b07da)_0x4bb63f=path[_0xbbdb('0x2d')](_0x4d0ec7,_0x4f4c52,util['format'](_0xbbdb('0x3c'),_0x4f4c52,index,_0xbbdb('0x3d')));return writePDFDocument(_0x83ec59,_0x4bb63f);})['then'](function(){if(!_0x2b07da)return;zipdir(path['join'](_0x4d0ec7,_0x4f4c52),{'saveTo':path[_0xbbdb('0x2d')](_0x4d0ec7,util['format']('%s.%s',_0x4f4c52,_0xbbdb('0x3e')))},function(_0x3c6cc4){if(_0x3c6cc4)throw _0x3c6cc4;return;});})[_0xbbdb('0x32')](function(){if(!_0x2b07da)return;rimraf(path[_0xbbdb('0x2d')](_0x4d0ec7,_0x4f4c52),function(){});})[_0xbbdb('0x32')](function(){logger[_0xbbdb('0x3f')](util[_0xbbdb('0x1a')](_0xbbdb('0x40'),EXTRACTED_REPORT_ID,_0xbbdb('0x41')));return analyticExtractedReport(_0xbbdb('0x42'),_0x2b07da?util[_0xbbdb('0x1a')](_0xbbdb('0x2e'),_0x4f4c52,_0x2b07da?_0xbbdb('0x3e'):_0xbbdb('0x3d')):null);});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0xbbdb('0x3f')](util['format'](_0xbbdb('0x43'),EXTRACTED_REPORT_ID,_0xbbdb('0x44')));return db['AnalyticExtractedReport'][_0xbbdb('0x45')]({'where':{'id':EXTRACTED_REPORT_ID}})['then'](function(_0x461ba5){EXTRACTED_REPORT=_0x461ba5;return dbH[_0xbbdb('0x33')][_0xbbdb('0x34')](util[_0xbbdb('0x1a')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0xbbdb('0x33')]['QueryTypes'][_0xbbdb('0x36')]});})[_0xbbdb('0x32')](extractReport)[_0xbbdb('0x46')](function(_0x173935){logger[_0xbbdb('0x3f')](util['format'](_0xbbdb('0x47'),EXTRACTED_REPORT_ID,_0xbbdb('0x44')),util[_0xbbdb('0x48')](_0x173935,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xbbdb('0x49'));})['finally'](function(){process[_0xbbdb('0x4a')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x48ce36=new PdfPrinter({'Arial':{'normal':__dirname+_0xbbdb('0x4b'),'bold':__dirname+_0xbbdb('0x4c'),'italics':__dirname+_0xbbdb('0x4d'),'bolditalics':__dirname+_0xbbdb('0x4e')}});return _0x48ce36;}function getPDFDocDefinitionFromHTML(_0x3e39f7,_0x448152){var _0x380f8b=util[_0xbbdb('0x1a')](_0xbbdb('0x4f'),_0x448152[_0xbbdb('0x50')],_0x448152[_0xbbdb('0x51')]);var _0x1d78cd=moment()[_0xbbdb('0x1a')](_0xbbdb('0x52'))[_0xbbdb('0x53')]();var _0x51d668=htmlToPdfmake(_0x3e39f7,{'window':window,'tableAutoSize':!![]});return{'content':[_0x51d668],'defaultStyle':{'font':_0xbbdb('0x27')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0xbbdb('0x54'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0xbbdb('0x54'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0xbbdb('0x54')}},'header':function(){return[{'text':_0xbbdb('0x55'),'style':'header'}];},'footer':function(_0x313124,_0x4de3b4){return[{'text':util['format'](_0xbbdb('0x56'),_0x380f8b,_0x313124,_0x4de3b4,_0x1d78cd),'style':'footer'}];}};}function writePDFDocument(_0x33c842,_0x34857b){return new Promise(function(_0x1d3305,_0x4c80fd){var _0x35f9fb=_0x33c842['pipe'](fs['createWriteStream'](_0x34857b));_0x35f9fb['on'](_0xbbdb('0x57'),function(){_0x1d3305(_0xbbdb('0x57'));});_0x35f9fb['on'](_0xbbdb('0x58'),function(_0x54d871){_0x4c80fd(_0x54d871);});_0x33c842[_0xbbdb('0x59')]();});}exports[_0xbbdb('0x5a')]=function(_0x33dd99,_0x3bc8c1){var _0x22f610=getPDFPrinter();var _0x353528=getPDFDocDefinitionFromHTML(_0x33dd99,_0x3bc8c1);var _0x5dd5fd=_0x22f610[_0xbbdb('0x3b')](_0x353528);return writePDFDocument(_0x5dd5fd,_0x3bc8c1[_0xbbdb('0x2')])[_0xbbdb('0x46')](function(_0x14ea4c){throw _0x14ea4c;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index 5d44abb..e564a6f 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 _0x08bc=['writeFileSync','binary','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','zip','catch','inspect','Failed','finally','exit','util','path','lodash','json2xls','bluebird','rimraf','dbH','../../config/logger','argv','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','find','split','splitSizeXlsx','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','SELECT','num','Empty','length','push','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','dirname','basename','.xlsx','existsSync','join','mkdirSync','%s%d.%s','xlsx','%s.%s'];(function(_0x49e2af,_0x455f6d){var _0x636093=function(_0x20073b){while(--_0x20073b){_0x49e2af['push'](_0x49e2af['shift']());}};_0x636093(++_0x455f6d);}(_0x08bc,0x15a));var _0xc08b=function(_0x4c7935,_0x4a53fb){_0x4c7935=_0x4c7935-0x0;var _0x30651d=_0x08bc[_0x4c7935];return _0x30651d;};'use strict';var util=require(_0xc08b('0x0'));var path=require(_0xc08b('0x1'));var _=require(_0xc08b('0x2'));var fs=require('fs');var json2xls=require(_0xc08b('0x3'));var BPromise=require(_0xc08b('0x4'));var zipdir=require('zip-dir');var rimraf=require(_0xc08b('0x5'));var db=require('../../mysqldb')['db'];var dbH=require('../../mysqldb')[_0xc08b('0x6')];var logger=require(_0xc08b('0x7'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0xc08b('0x8')][0x2]);var QUERY=process[_0xc08b('0x8')][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x2fdf60,_0x284e04){var _0x1ae017={'status':_0x2fdf60};var _0x46e6dc={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x284e04){_0x1ae017['savename']=_0x284e04;}return db[_0xc08b('0x9')][_0xc08b('0xa')](_0x1ae017,_0x46e6dc);}function main(){var _0x358e1d=0x1388;var _0x41a91e;logger[_0xc08b('0xb')](util[_0xc08b('0xc')](_0xc08b('0xd'),EXTRACTED_REPORT_ID,_0xc08b('0xe')));return db['Setting'][_0xc08b('0xf')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xc08b('0x10'),_0xc08b('0x11')]})['then'](function(_0xdcc361){if(_0xdcc361){_0x41a91e=_0xdcc361;_0x358e1d=_0x41a91e['splitSizeXlsx']||0x1388;}})[_0xc08b('0x12')](function(){return dbH[_0xc08b('0x13')][_0xc08b('0x14')](util['format'](_0xc08b('0x15'),QUERY),{'type':dbH[_0xc08b('0x13')]['QueryTypes'][_0xc08b('0x16')]});})[_0xc08b('0x12')](function(_0x3e4083){if(!_0x3e4083[0x0][_0xc08b('0x17')]){return analyticExtractedReport(_0xc08b('0x18'));}var _0x52e5eb=[];var _0x571790=0x0;var _0x27d755=!![];if(_0x41a91e[_0xc08b('0x10')]){if(_0x3e4083&&_0x3e4083[_0xc08b('0x19')]){var _0x243e54=_0x3e4083[0x0][_0xc08b('0x17')]%(_0x571790+_0x358e1d);for(;_0x27d755;_0x571790+=_0x358e1d,_0x243e54=_0x3e4083[0x0]['num']%(_0x571790+_0x358e1d)){if(_0x243e54==0x0||_0x243e54==_0x3e4083[0x0][_0xc08b('0x17')]){_0x27d755=![];}_0x52e5eb[_0xc08b('0x1a')](dbH[_0xc08b('0x13')][_0xc08b('0x14')](util[_0xc08b('0xc')](_0xc08b('0x1b'),QUERY,_0x358e1d,_0x571790),{'type':dbH[_0xc08b('0x13')][_0xc08b('0x1c')][_0xc08b('0x16')]}));}}}else{_0x52e5eb[_0xc08b('0x1a')](dbH[_0xc08b('0x13')]['query'](QUERY,{'type':dbH['sequelize']['QueryTypes'][_0xc08b('0x16')]}));}var _0x5e02d1=path[_0xc08b('0x1d')](PATH);var _0x1a8aa6=path[_0xc08b('0x1e')](PATH,_0xc08b('0x1f'));var _0x41843c=_0x41a91e[_0xc08b('0x10')]&&_0x52e5eb[_0xc08b('0x19')]>0x1;var _0x4ae214=[];if(!fs[_0xc08b('0x20')](path[_0xc08b('0x21')](_0x5e02d1,_0x1a8aa6))&&_0x41843c){fs[_0xc08b('0x22')](path['join'](_0x5e02d1,_0x1a8aa6));}return BPromise['each'](_0x52e5eb,function(_0x138b52){_0x4ae214[_0xc08b('0x1a')](_0x138b52);})[_0xc08b('0x12')](function(){for(var _0xe442d1=0x0;_0xe442d1<_0x4ae214[_0xc08b('0x19')];_0xe442d1+=0x1){var _0x1d6afc;var _0x317638=_0x4ae214[_0xe442d1];if(_0x41843c){_0x1d6afc=path[_0xc08b('0x21')](_0x5e02d1,_0x1a8aa6,util[_0xc08b('0xc')](_0xc08b('0x23'),_0x1a8aa6,_0xe442d1,_0xc08b('0x24')));}else{_0x1d6afc=path[_0xc08b('0x21')](_0x5e02d1,util[_0xc08b('0xc')](_0xc08b('0x25'),_0x1a8aa6,_0xc08b('0x24')));}fs[_0xc08b('0x26')](_0x1d6afc,json2xls(_0x317638),_0xc08b('0x27'));}})[_0xc08b('0x12')](function(){if(_0x41843c){zipdir(path['join'](_0x5e02d1,_0x1a8aa6),{'saveTo':path[_0xc08b('0x21')](_0x5e02d1,util[_0xc08b('0xc')](_0xc08b('0x25'),_0x1a8aa6,'zip'))},function(_0x59f9ba,_0x2d015a){});rimraf(path[_0xc08b('0x21')](_0x5e02d1,_0x1a8aa6),function(){});}})[_0xc08b('0x12')](function(){logger[_0xc08b('0xb')](util[_0xc08b('0xc')](_0xc08b('0x28'),EXTRACTED_REPORT_ID,_0xc08b('0xe')));return analyticExtractedReport(_0xc08b('0x29'),_0x41843c?util[_0xc08b('0xc')]('%s.%s',_0x1a8aa6,_0x41843c?_0xc08b('0x2a'):_0xc08b('0x24')):null);});})[_0xc08b('0x2b')](function(_0x15c207){logger['info'](util[_0xc08b('0xc')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xc08b('0xe')),util[_0xc08b('0x2c')](_0x15c207,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xc08b('0x2d'));})[_0xc08b('0x2e')](function(){process[_0xc08b('0x2f')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x7e69=['query','dirname','basename','.xlsx','existsSync','join','mkdirSync','each','%s%d.%s','xlsx','%s.%s','writeFileSync','binary','info','XLSX','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','util','lodash','bluebird','zip-dir','../../mysqldb','../../config/logger','analytics','argv','AnalyticExtractedReport','update','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Setting','find','splitSizeXlsx','then','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','sequelize','QueryTypes','SELECT','num','split','length','push'];(function(_0xf0330b,_0x814253){var _0x538518=function(_0x9c7d43){while(--_0x9c7d43){_0xf0330b['push'](_0xf0330b['shift']());}};_0x538518(++_0x814253);}(_0x7e69,0x12a));var _0x97e6=function(_0x44a573,_0x1e6efc){_0x44a573=_0x44a573-0x0;var _0x4babc6=_0x7e69[_0x44a573];return _0x4babc6;};'use strict';var util=require(_0x97e6('0x0'));var path=require('path');var _=require(_0x97e6('0x1'));var fs=require('fs');var json2xls=require('json2xls');var BPromise=require(_0x97e6('0x2'));var zipdir=require(_0x97e6('0x3'));var rimraf=require('rimraf');var db=require(_0x97e6('0x4'))['db'];var dbH=require(_0x97e6('0x4'))['dbH'];var logger=require(_0x97e6('0x5'))(_0x97e6('0x6'));var EXTRACTED_REPORT_ID=Number(process[_0x97e6('0x7')][0x2]);var QUERY=process[_0x97e6('0x7')][0x3];var PATH=process[_0x97e6('0x7')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x15b507,_0x585dbe){var _0x8455e7={'status':_0x15b507};var _0x2c713e={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x585dbe){_0x8455e7['savename']=_0x585dbe;}return db[_0x97e6('0x8')][_0x97e6('0x9')](_0x8455e7,_0x2c713e);}function main(){var _0x1c4629=0x1388;var _0x1d8e7d;logger['info'](util[_0x97e6('0xa')](_0x97e6('0xb'),EXTRACTED_REPORT_ID,'XLSX'));return db[_0x97e6('0xc')][_0x97e6('0xd')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split','splitSizeXlsx']})['then'](function(_0x36417c){if(_0x36417c){_0x1d8e7d=_0x36417c;_0x1c4629=_0x1d8e7d[_0x97e6('0xe')]||0x1388;}})[_0x97e6('0xf')](function(){return dbH['sequelize']['query'](util[_0x97e6('0xa')](_0x97e6('0x10'),QUERY),{'type':dbH[_0x97e6('0x11')][_0x97e6('0x12')][_0x97e6('0x13')]});})['then'](function(_0x138a6c){if(!_0x138a6c[0x0][_0x97e6('0x14')]){return analyticExtractedReport('Empty');}var _0x2472da=[];var _0x44f5de=0x0;var _0x1daab8=!![];if(_0x1d8e7d[_0x97e6('0x15')]){if(_0x138a6c&&_0x138a6c[_0x97e6('0x16')]){var _0x3782ea=_0x138a6c[0x0][_0x97e6('0x14')]%(_0x44f5de+_0x1c4629);for(;_0x1daab8;_0x44f5de+=_0x1c4629,_0x3782ea=_0x138a6c[0x0]['num']%(_0x44f5de+_0x1c4629)){if(_0x3782ea==0x0||_0x3782ea==_0x138a6c[0x0]['num']){_0x1daab8=![];}_0x2472da[_0x97e6('0x17')](dbH['sequelize']['query'](util[_0x97e6('0xa')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x1c4629,_0x44f5de),{'type':dbH['sequelize'][_0x97e6('0x12')][_0x97e6('0x13')]}));}}}else{_0x2472da[_0x97e6('0x17')](dbH[_0x97e6('0x11')][_0x97e6('0x18')](QUERY,{'type':dbH['sequelize']['QueryTypes'][_0x97e6('0x13')]}));}var _0x46a4a5=path[_0x97e6('0x19')](PATH);var _0x4da8c4=path[_0x97e6('0x1a')](PATH,_0x97e6('0x1b'));var _0x4c870f=_0x1d8e7d[_0x97e6('0x15')]&&_0x2472da[_0x97e6('0x16')]>0x1;var _0x41b763=[];if(!fs[_0x97e6('0x1c')](path[_0x97e6('0x1d')](_0x46a4a5,_0x4da8c4))&&_0x4c870f){fs[_0x97e6('0x1e')](path[_0x97e6('0x1d')](_0x46a4a5,_0x4da8c4));}return BPromise[_0x97e6('0x1f')](_0x2472da,function(_0x22f491){_0x41b763[_0x97e6('0x17')](_0x22f491);})[_0x97e6('0xf')](function(){for(var _0xa1ab42=0x0;_0xa1ab42<_0x41b763[_0x97e6('0x16')];_0xa1ab42+=0x1){var _0x51ee44;var _0x2d44d8=_0x41b763[_0xa1ab42];if(_0x4c870f){_0x51ee44=path[_0x97e6('0x1d')](_0x46a4a5,_0x4da8c4,util[_0x97e6('0xa')](_0x97e6('0x20'),_0x4da8c4,_0xa1ab42,_0x97e6('0x21')));}else{_0x51ee44=path[_0x97e6('0x1d')](_0x46a4a5,util[_0x97e6('0xa')](_0x97e6('0x22'),_0x4da8c4,_0x97e6('0x21')));}fs[_0x97e6('0x23')](_0x51ee44,json2xls(_0x2d44d8),_0x97e6('0x24'));}})['then'](function(){if(_0x4c870f){zipdir(path[_0x97e6('0x1d')](_0x46a4a5,_0x4da8c4),{'saveTo':path[_0x97e6('0x1d')](_0x46a4a5,util[_0x97e6('0xa')](_0x97e6('0x22'),_0x4da8c4,'zip'))},function(_0x37e5e6,_0x59f0ab){});rimraf(path[_0x97e6('0x1d')](_0x46a4a5,_0x4da8c4),function(){});}})[_0x97e6('0xf')](function(){logger[_0x97e6('0x25')](util[_0x97e6('0xa')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0x97e6('0x26')));return analyticExtractedReport(_0x97e6('0x27'),_0x4c870f?util[_0x97e6('0xa')]('%s.%s',_0x4da8c4,_0x4c870f?'zip':_0x97e6('0x21')):null);});})[_0x97e6('0x28')](function(_0x53a65b){logger[_0x97e6('0x25')](util[_0x97e6('0xa')](_0x97e6('0x29'),EXTRACTED_REPORT_ID,'XLSX'),util[_0x97e6('0x2a')](_0x53a65b,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x97e6('0x2b'));})[_0x97e6('0x2c')](function(){process[_0x97e6('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 c1521c8..c7536cd 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 _0x337a=['wav','XCALLY-MOTION-ANSWER=0','length','toLowerCase','createdAt','*,*,*,*','interval','tag','CDR(tag)=','outbound','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','answer','indexOf','app','appType','custom','ExecIf','XCALLY-MOTION-ANSWER=1','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','Hangup','concat','transaction','destroy','sortBy','rewrite','lodash','models','Interval','findAll','intervals','VoiceExtension','IntervalId','then','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','playback','hasOwnProperty','priority','extension','find','push','Set','type','context','cutdigits','extensions','CDR(routeid)=','VoiceExtensionId','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','CDR(prefix)=noprefix','recordingFormat','none'];(function(_0x292ed7,_0x4fe68e){var _0xcfb8a0=function(_0x4d133e){while(--_0x4d133e){_0x292ed7['push'](_0x292ed7['shift']());}};_0xcfb8a0(++_0x4fe68e);}(_0x337a,0x96));var _0xa337=function(_0x1748f6,_0x5c3255){_0x1748f6=_0x1748f6-0x0;var _0x1aad12=_0x337a[_0x1748f6];return _0x1aad12;};'use strict';var _=require(_0xa337('0x0'));var util=require('util');function rewrite(_0x4f4d19,_0x4e690f){var _0x18f239=this;return _0x4f4d19[_0xa337('0x1')][_0xa337('0x2')][_0xa337('0x3')]({'raw':!![]})['then'](function(_0x2e0cbc){_0x18f239[_0xa337('0x4')]=_0x2e0cbc;return _0x4f4d19['models'][_0xa337('0x5')][_0xa337('0x3')]({'where':{'IntervalId':_0x4e690f[_0xa337('0x6')]},'raw':!![]});})[_0xa337('0x7')](function(_0x495945){return _0x4f4d19[_0xa337('0x1')][_0xa337('0x5')][_0xa337('0x3')]({'where':{'exten':{'$in':_[_0xa337('0x8')](_[_0xa337('0x9')](_0x495945,_0xa337('0xa')))}},'order':[{'raw':_0xa337('0xb')}],'raw':!![]});})[_0xa337('0x7')](function(_0x1e9080){var _0x51e59a=_[_0xa337('0xc')](_0x1e9080,{'priority':'1'});var _0x5245bf=_[_0xa337('0xc')](_0x1e9080,{'isApp':0x1});var _0x4446ff=_['groupBy'](_0x5245bf,'exten');var _0x211646=['queue',_0xa337('0xd')];var _0x186bfc=[];var _0x2a3b88=[];for(var _0x55e751 in _0x4446ff){if(_0x4446ff[_0xa337('0xe')](_0x55e751)){_0x18f239[_0xa337('0xf')]=0x2;_0x18f239['extensions']=[];_0x18f239[_0xa337('0x10')]=_[_0xa337('0x11')](_0x51e59a,{'exten':_0x4446ff[_0x55e751][0x0]['exten']});_0x18f239['extensions'][_0xa337('0x12')]({'type':_0x4446ff[_0x55e751][0x0]['type'],'app':_0xa337('0x13'),'appdata':util['format']('CDR(type)=%s',_0x4446ff[_0x55e751][0x0][_0xa337('0x14')]),'context':_0x4446ff[_0x55e751][0x0][_0xa337('0x15')],'exten':_0x4446ff[_0x55e751][0x0]['exten'],'priority':_0x18f239[_0xa337('0xf')]++,'VoiceExtensionId':_0x4446ff[_0x55e751][0x0]['VoiceExtensionId']});if(_0x4446ff[_0x55e751][0x0][_0xa337('0x14')]==='outbound'){if(_0x18f239['extension']){_0x18f239['extensions'][_0xa337('0x12')]({'type':_0x4446ff[_0x55e751][0x0][_0xa337('0x14')],'app':_0xa337('0x13'),'appdata':'CDR(destination)='+(_0x18f239[_0xa337('0x10')][_0xa337('0x16')]?'${EXTEN:'+_0x18f239[_0xa337('0x10')][_0xa337('0x16')]+'}':'${EXTEN}'),'context':_0x4446ff[_0x55e751][0x0]['context'],'exten':_0x4446ff[_0x55e751][0x0][_0xa337('0xa')],'priority':_0x18f239[_0xa337('0xf')]++,'VoiceExtensionId':_0x4446ff[_0x55e751][0x0]['VoiceExtensionId']});}_0x18f239[_0xa337('0x17')]['push']({'type':_0x4446ff[_0x55e751][0x0][_0xa337('0x14')],'app':_0xa337('0x13'),'appdata':_0xa337('0x18')+_0x4446ff[_0x55e751][0x0][_0xa337('0x19')],'context':_0x4446ff[_0x55e751][0x0][_0xa337('0x15')],'exten':_0x4446ff[_0x55e751][0x0]['exten'],'priority':_0x18f239[_0xa337('0xf')]++,'VoiceExtensionId':_0x4446ff[_0x55e751][0x0][_0xa337('0x19')]});var _0x1b1c86=_0x18f239['priority']++;_0x18f239[_0xa337('0x17')][_0xa337('0x12')]({'type':_0x4446ff[_0x55e751][0x0][_0xa337('0x14')],'app':'ExecIf','appdata':_0xa337('0x1a')+(_0x1b1c86+0x2)+'):Goto('+(_0x1b1c86+0x1)+')','context':_0x4446ff[_0x55e751][0x0][_0xa337('0x15')],'exten':_0x4446ff[_0x55e751][0x0][_0xa337('0xa')],'priority':_0x1b1c86,'VoiceExtensionId':_0x4446ff[_0x55e751][0x0][_0xa337('0x19')]});if(_0x18f239[_0xa337('0x10')]){_0x18f239[_0xa337('0x17')]['push']({'type':_0x4446ff[_0x55e751][0x0][_0xa337('0x14')],'app':_0xa337('0x13'),'appdata':_0x18f239[_0xa337('0x10')][_0xa337('0x16')]?'CDR(prefix)=${EXTEN:0:'+_0x18f239[_0xa337('0x10')][_0xa337('0x16')]+'}':_0xa337('0x1b'),'context':_0x4446ff[_0x55e751][0x0]['context'],'exten':_0x4446ff[_0x55e751][0x0]['exten'],'priority':_0x18f239[_0xa337('0xf')]++,'VoiceExtensionId':_0x4446ff[_0x55e751][0x0][_0xa337('0x19')]});}_0x18f239[_0xa337('0x17')][_0xa337('0x12')]({'type':_0x4446ff[_0x55e751][0x0]['type'],'app':_0xa337('0x13'),'appdata':'outboundrouteid='+_0x4446ff[_0x55e751][0x0][_0xa337('0x19')],'context':_0x4446ff[_0x55e751][0x0][_0xa337('0x15')],'exten':_0x4446ff[_0x55e751][0x0]['exten'],'priority':_0x18f239[_0xa337('0xf')]++,'VoiceExtensionId':_0x4446ff[_0x55e751][0x0][_0xa337('0x19')]});if(_0x18f239[_0xa337('0x10')]&&_0x18f239[_0xa337('0x10')]['hasOwnProperty']('recordingFormat')&&_0x18f239['extension'][_0xa337('0x1c')]!==_0xa337('0x1d')){_0x18f239['extensions'][_0xa337('0x12')]({'type':_0x4446ff[_0x55e751][0x0]['type'],'app':'Set','appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x4446ff[_0x55e751][0x0][_0xa337('0x15')],'exten':_0x4446ff[_0x55e751][0x0]['exten'],'priority':_0x18f239['priority']++,'VoiceExtensionId':_0x4446ff[_0x55e751][0x0][_0xa337('0x19')]});_0x18f239[_0xa337('0x17')][_0xa337('0x12')]({'type':_0x4446ff[_0x55e751][0x0][_0xa337('0x14')],'app':_0xa337('0x13'),'appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x18f239[_0xa337('0x10')]['recordingFormat']||_0xa337('0x1e'),'context':_0x4446ff[_0x55e751][0x0][_0xa337('0x15')],'exten':_0x4446ff[_0x55e751][0x0][_0xa337('0xa')],'priority':_0x18f239[_0xa337('0xf')]++,'VoiceExtensionId':_0x4446ff[_0x55e751][0x0][_0xa337('0x19')]});}}_0x18f239[_0xa337('0x17')][_0xa337('0x12')]({'type':_0x4446ff[_0x55e751][0x0]['type'],'app':_0xa337('0x13'),'appdata':_0xa337('0x1f'),'context':_0x4446ff[_0x55e751][0x0][_0xa337('0x15')],'exten':_0x4446ff[_0x55e751][0x0][_0xa337('0xa')],'priority':_0x18f239[_0xa337('0xf')]++,'VoiceExtensionId':_0x4446ff[_0x55e751][0x0][_0xa337('0x19')]});_0x18f239[_0xa337('0x17')]['push']({'type':_0x4446ff[_0x55e751][0x0]['type'],'app':_0xa337('0x13'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x4446ff[_0x55e751][0x0][_0xa337('0x15')],'exten':_0x4446ff[_0x55e751][0x0][_0xa337('0xa')],'priority':_0x18f239[_0xa337('0xf')]++,'VoiceExtensionId':_0x4446ff[_0x55e751][0x0][_0xa337('0x19')]});_0x18f239[_0xa337('0x17')][_0xa337('0x12')]({'type':_0x4446ff[_0x55e751][0x0]['type'],'app':'Set','appdata':'MONITOR_OPTIONS=ab','context':_0x4446ff[_0x55e751][0x0][_0xa337('0x15')],'exten':_0x4446ff[_0x55e751][0x0][_0xa337('0xa')],'priority':_0x18f239[_0xa337('0xf')]++,'VoiceExtensionId':_0x4446ff[_0x55e751][0x0]['VoiceExtensionId']});for(var _0x136e2b=0x0,_0x4061c7=0x0;_0x136e2b<_0x4446ff[_0x55e751][_0xa337('0x20')];_0x136e2b+=0x1,_0x4061c7=0x0){var _0x499fe5=_0x4446ff[_0x55e751][_0x136e2b];if(_0x499fe5[_0xa337('0x14')]){_0x499fe5['type']=_0x499fe5[_0xa337('0x14')][_0xa337('0x21')]();}var _0x315493=[];var _0x271dfe=[];delete _0x499fe5['id'];delete _0x499fe5[_0xa337('0x22')];delete _0x499fe5['updatedAt'];var _0x185067=_0x499fe5['interval']!==_0xa337('0x23')?[_0x499fe5[_0xa337('0x24')]]:_0x499fe5[_0xa337('0x6')]?_['map'](_['filter'](_0x18f239[_0xa337('0x4')],{'IntervalId':_0x499fe5[_0xa337('0x6')]}),_0xa337('0x24')):[];if(_0x499fe5['hasOwnProperty'](_0xa337('0x25'))){if(_0x499fe5['tag']&&_0x499fe5[_0xa337('0x25')]!=='--'){_0x315493[_0xa337('0x12')]({'type':_0x499fe5[_0xa337('0x14')],'app':_0xa337('0x13'),'appdata':_0xa337('0x26')+_0x499fe5[_0xa337('0x25')],'context':_0x499fe5[_0xa337('0x15')],'exten':_0x499fe5[_0xa337('0xa')],'priority':_0x185067[_0xa337('0x20')]+_0x18f239['priority']+_0x4061c7++,'VoiceExtensionId':_0x499fe5['VoiceExtensionId']});}}if(_0x499fe5[_0xa337('0x14')]===_0xa337('0x27')&&_0x499fe5[_0xa337('0xe')](_0xa337('0x28'))){if(_0x499fe5[_0xa337('0x28')]){_0x315493['push']({'type':_0x499fe5[_0xa337('0x14')],'app':'ExecIf','appdata':_0xa337('0x29')+_0x499fe5[_0xa337('0x28')]+')','context':_0x499fe5[_0xa337('0x15')],'exten':_0x499fe5['exten'],'priority':_0x185067[_0xa337('0x20')]+_0x18f239['priority']+_0x4061c7++,'VoiceExtensionId':_0x499fe5[_0xa337('0x19')]});}else{_0x315493[_0xa337('0x12')]({'type':_0x499fe5[_0xa337('0x14')],'app':'ExecIf','appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','context':_0x499fe5['context'],'exten':_0x499fe5['exten'],'priority':_0x185067['length']+_0x18f239[_0xa337('0xf')]+_0x4061c7++,'VoiceExtensionId':_0x499fe5['VoiceExtensionId']});}}if(_0x499fe5[_0xa337('0xe')](_0xa337('0x2a'))){if(_0x211646[_0xa337('0x2b')](_0x499fe5[_0xa337('0x2c')][_0xa337('0x21')]())>=0x0&&_0x499fe5[_0xa337('0x2d')]!==_0xa337('0x2e')){if(_0x499fe5[_0xa337('0x2a')]){_0x315493[_0xa337('0x12')]({'type':_0x499fe5[_0xa337('0x14')],'app':_0xa337('0x2f'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x499fe5[_0xa337('0x15')],'exten':_0x499fe5[_0xa337('0xa')],'priority':_0x185067['length']+_0x18f239['priority']+_0x4061c7++,'VoiceExtensionId':_0x499fe5['VoiceExtensionId']});_0x315493[_0xa337('0x12')]({'type':_0x499fe5[_0xa337('0x14')],'app':_0xa337('0x13'),'appdata':_0xa337('0x30'),'context':_0x499fe5[_0xa337('0x15')],'exten':_0x499fe5[_0xa337('0xa')],'priority':_0x185067[_0xa337('0x20')]+_0x18f239['priority']+_0x4061c7++,'VoiceExtensionId':_0x499fe5[_0xa337('0x19')]});}else{_0x315493[_0xa337('0x12')]({'type':_0x499fe5[_0xa337('0x14')],'app':_0xa337('0x2f'),'appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x499fe5[_0xa337('0x15')],'exten':_0x499fe5[_0xa337('0xa')],'priority':_0x185067['length']+_0x18f239[_0xa337('0xf')]+_0x4061c7++,'VoiceExtensionId':_0x499fe5[_0xa337('0x19')]});_0x315493[_0xa337('0x12')]({'type':_0x499fe5[_0xa337('0x14')],'app':'Set','appdata':_0xa337('0x31'),'context':_0x499fe5[_0xa337('0x15')],'exten':_0x499fe5['exten'],'priority':_0x185067['length']+_0x18f239['priority']+_0x4061c7++,'VoiceExtensionId':_0x499fe5[_0xa337('0x19')]});}}}for(var _0x10c0cf=0x0;_0x10c0cf<_0x185067[_0xa337('0x20')];_0x10c0cf+=0x1){var _0xbb45c6=_0x18f239[_0xa337('0xf')]+_0x185067['length'];var _0x4f7a1d=_0x10c0cf===_0x185067['length']-0x1?_0x18f239[_0xa337('0xf')]+_0x315493['length']+_0x271dfe['length']+0x2:_0x18f239[_0xa337('0xf')]+_0x10c0cf+0x1;_0x315493[_0xa337('0x32')](_0x10c0cf,0x0,{'type':_0x499fe5[_0xa337('0x14')],'app':_0xa337('0x33'),'appdata':_0x185067[_0x10c0cf]+'?'+_0x499fe5['context']+',${EXTEN},'+_0xbb45c6+':'+_0x499fe5['context']+_0xa337('0x34')+_0x4f7a1d,'exten':_0x499fe5['exten'],'context':_0x499fe5[_0xa337('0x15')],'priority':_0x18f239['priority']+_0x10c0cf,'VoiceExtensionId':_0x4446ff[_0x55e751][0x0]['VoiceExtensionId']});}_0x499fe5['priority']=_0x315493[_0xa337('0x20')]?_[_0xa337('0x35')](_0x315493)[_0xa337('0xf')]+0x1:_0x18f239['priority'];_0x18f239[_0xa337('0xf')]=(_0x271dfe[_0xa337('0x20')]?_[_0xa337('0x35')](_0x271dfe)[_0xa337('0xf')]:_0x499fe5[_0xa337('0xf')])+0x1;_0x18f239[_0xa337('0x17')]=_['concat'](_0x18f239[_0xa337('0x17')],_0x315493,[_0x499fe5],_0x271dfe);}_0x18f239[_0xa337('0x17')]['push']({'type':_0x4446ff[_0x55e751][0x0][_0xa337('0x14')],'app':_0xa337('0x36'),'exten':_0x4446ff[_0x55e751][0x0][_0xa337('0xa')],'context':_0x4446ff[_0x55e751][0x0][_0xa337('0x15')],'priority':_0x18f239[_0xa337('0xf')],'VoiceExtensionId':_0x4446ff[_0x55e751][0x0][_0xa337('0x19')]});_0x186bfc[_0xa337('0x12')](_0x4446ff[_0x55e751][0x0][_0xa337('0x19')]);_0x2a3b88=_[_0xa337('0x37')](_0x2a3b88,_0x18f239[_0xa337('0x17')]);}}return _0x4f4d19[_0xa337('0x38')](function(_0x3dd596){return _0x4f4d19['models'][_0xa337('0x5')][_0xa337('0x39')]({'where':{'VoiceExtensionId':{'$in':_0x186bfc}},'transaction':_0x3dd596})[_0xa337('0x7')](function(_0xe9d60){return _0x4f4d19['models'][_0xa337('0x5')]['bulkCreate'](_[_0xa337('0x3a')](_0x2a3b88,_0xa337('0xf')),{'transaction':_0x3dd596});});});})['catch'](function(_0x16448f){console['error'](_0x16448f);});}exports[_0xa337('0x3b')]=rewrite; \ No newline at end of file +var _0xf391=['push','Set','format','CDR(type)=%s','type','outbound','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','context','VoiceExtensionId','CDR(routeid)=','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','none','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','length','toLowerCase','createdAt','updatedAt','*,*,*,*','interval','IntervalId','tag','CDR(tag)=','callerID','ExecIf','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','indexOf','app','appType','custom','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','Hangup','concat','transaction','destroy','bulkCreate','sortBy','catch','error','lodash','models','Interval','findAll','then','VoiceExtension','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','queue','playback','hasOwnProperty','priority','extensions','extension'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xf391,0x7d));var _0x1f39=function(_0x3248e0,_0x5d929b){_0x3248e0=_0x3248e0-0x0;var _0x38ec8e=_0xf391[_0x3248e0];return _0x38ec8e;};'use strict';var _=require(_0x1f39('0x0'));var util=require('util');function rewrite(_0x2d58de,_0x2aeb7d){var _0x16f9d0=this;return _0x2d58de[_0x1f39('0x1')][_0x1f39('0x2')][_0x1f39('0x3')]({'raw':!![]})[_0x1f39('0x4')](function(_0x484240){_0x16f9d0['intervals']=_0x484240;return _0x2d58de['models'][_0x1f39('0x5')][_0x1f39('0x3')]({'where':{'IntervalId':_0x2aeb7d['IntervalId']},'raw':!![]});})[_0x1f39('0x4')](function(_0x85e883){return _0x2d58de[_0x1f39('0x1')][_0x1f39('0x5')][_0x1f39('0x3')]({'where':{'exten':{'$in':_['uniq'](_[_0x1f39('0x6')](_0x85e883,_0x1f39('0x7')))}},'order':[{'raw':_0x1f39('0x8')}],'raw':!![]});})['then'](function(_0x50974e){var _0x4a119c=_[_0x1f39('0x9')](_0x50974e,{'priority':'1'});var _0x486baa=_['filter'](_0x50974e,{'isApp':0x1});var _0x5ea5fd=_[_0x1f39('0xa')](_0x486baa,_0x1f39('0x7'));var _0x1e0e6b=[_0x1f39('0xb'),_0x1f39('0xc')];var _0x4c6325=[];var _0x58a5f6=[];for(var _0x1caca7 in _0x5ea5fd){if(_0x5ea5fd[_0x1f39('0xd')](_0x1caca7)){_0x16f9d0[_0x1f39('0xe')]=0x2;_0x16f9d0[_0x1f39('0xf')]=[];_0x16f9d0[_0x1f39('0x10')]=_['find'](_0x4a119c,{'exten':_0x5ea5fd[_0x1caca7][0x0][_0x1f39('0x7')]});_0x16f9d0['extensions'][_0x1f39('0x11')]({'type':_0x5ea5fd[_0x1caca7][0x0]['type'],'app':_0x1f39('0x12'),'appdata':util[_0x1f39('0x13')](_0x1f39('0x14'),_0x5ea5fd[_0x1caca7][0x0][_0x1f39('0x15')]),'context':_0x5ea5fd[_0x1caca7][0x0]['context'],'exten':_0x5ea5fd[_0x1caca7][0x0][_0x1f39('0x7')],'priority':_0x16f9d0[_0x1f39('0xe')]++,'VoiceExtensionId':_0x5ea5fd[_0x1caca7][0x0]['VoiceExtensionId']});if(_0x5ea5fd[_0x1caca7][0x0][_0x1f39('0x15')]===_0x1f39('0x16')){if(_0x16f9d0['extension']){_0x16f9d0['extensions'][_0x1f39('0x11')]({'type':_0x5ea5fd[_0x1caca7][0x0][_0x1f39('0x15')],'app':_0x1f39('0x12'),'appdata':_0x1f39('0x17')+(_0x16f9d0[_0x1f39('0x10')][_0x1f39('0x18')]?_0x1f39('0x19')+_0x16f9d0[_0x1f39('0x10')][_0x1f39('0x18')]+'}':_0x1f39('0x1a')),'context':_0x5ea5fd[_0x1caca7][0x0][_0x1f39('0x1b')],'exten':_0x5ea5fd[_0x1caca7][0x0][_0x1f39('0x7')],'priority':_0x16f9d0[_0x1f39('0xe')]++,'VoiceExtensionId':_0x5ea5fd[_0x1caca7][0x0][_0x1f39('0x1c')]});}_0x16f9d0[_0x1f39('0xf')][_0x1f39('0x11')]({'type':_0x5ea5fd[_0x1caca7][0x0][_0x1f39('0x15')],'app':_0x1f39('0x12'),'appdata':_0x1f39('0x1d')+_0x5ea5fd[_0x1caca7][0x0][_0x1f39('0x1c')],'context':_0x5ea5fd[_0x1caca7][0x0][_0x1f39('0x1b')],'exten':_0x5ea5fd[_0x1caca7][0x0][_0x1f39('0x7')],'priority':_0x16f9d0['priority']++,'VoiceExtensionId':_0x5ea5fd[_0x1caca7][0x0][_0x1f39('0x1c')]});var _0x29556a=_0x16f9d0[_0x1f39('0xe')]++;_0x16f9d0[_0x1f39('0xf')][_0x1f39('0x11')]({'type':_0x5ea5fd[_0x1caca7][0x0][_0x1f39('0x15')],'app':'ExecIf','appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x29556a+0x2)+'):Goto('+(_0x29556a+0x1)+')','context':_0x5ea5fd[_0x1caca7][0x0][_0x1f39('0x1b')],'exten':_0x5ea5fd[_0x1caca7][0x0][_0x1f39('0x7')],'priority':_0x29556a,'VoiceExtensionId':_0x5ea5fd[_0x1caca7][0x0][_0x1f39('0x1c')]});if(_0x16f9d0[_0x1f39('0x10')]){_0x16f9d0[_0x1f39('0xf')][_0x1f39('0x11')]({'type':_0x5ea5fd[_0x1caca7][0x0][_0x1f39('0x15')],'app':_0x1f39('0x12'),'appdata':_0x16f9d0[_0x1f39('0x10')][_0x1f39('0x18')]?_0x1f39('0x1e')+_0x16f9d0[_0x1f39('0x10')]['cutdigits']+'}':_0x1f39('0x1f'),'context':_0x5ea5fd[_0x1caca7][0x0][_0x1f39('0x1b')],'exten':_0x5ea5fd[_0x1caca7][0x0]['exten'],'priority':_0x16f9d0[_0x1f39('0xe')]++,'VoiceExtensionId':_0x5ea5fd[_0x1caca7][0x0]['VoiceExtensionId']});}_0x16f9d0[_0x1f39('0xf')]['push']({'type':_0x5ea5fd[_0x1caca7][0x0][_0x1f39('0x15')],'app':'Set','appdata':_0x1f39('0x20')+_0x5ea5fd[_0x1caca7][0x0][_0x1f39('0x1c')],'context':_0x5ea5fd[_0x1caca7][0x0]['context'],'exten':_0x5ea5fd[_0x1caca7][0x0][_0x1f39('0x7')],'priority':_0x16f9d0[_0x1f39('0xe')]++,'VoiceExtensionId':_0x5ea5fd[_0x1caca7][0x0][_0x1f39('0x1c')]});if(_0x16f9d0[_0x1f39('0x10')]&&_0x16f9d0['extension'][_0x1f39('0xd')]('recordingFormat')&&_0x16f9d0[_0x1f39('0x10')][_0x1f39('0x21')]!==_0x1f39('0x22')){_0x16f9d0[_0x1f39('0xf')]['push']({'type':_0x5ea5fd[_0x1caca7][0x0][_0x1f39('0x15')],'app':_0x1f39('0x12'),'appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x5ea5fd[_0x1caca7][0x0][_0x1f39('0x1b')],'exten':_0x5ea5fd[_0x1caca7][0x0][_0x1f39('0x7')],'priority':_0x16f9d0[_0x1f39('0xe')]++,'VoiceExtensionId':_0x5ea5fd[_0x1caca7][0x0][_0x1f39('0x1c')]});_0x16f9d0[_0x1f39('0xf')][_0x1f39('0x11')]({'type':_0x5ea5fd[_0x1caca7][0x0][_0x1f39('0x15')],'app':_0x1f39('0x12'),'appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x16f9d0[_0x1f39('0x10')][_0x1f39('0x21')]||_0x1f39('0x23'),'context':_0x5ea5fd[_0x1caca7][0x0][_0x1f39('0x1b')],'exten':_0x5ea5fd[_0x1caca7][0x0]['exten'],'priority':_0x16f9d0['priority']++,'VoiceExtensionId':_0x5ea5fd[_0x1caca7][0x0][_0x1f39('0x1c')]});}}_0x16f9d0['extensions'][_0x1f39('0x11')]({'type':_0x5ea5fd[_0x1caca7][0x0][_0x1f39('0x15')],'app':'Set','appdata':_0x1f39('0x24'),'context':_0x5ea5fd[_0x1caca7][0x0][_0x1f39('0x1b')],'exten':_0x5ea5fd[_0x1caca7][0x0][_0x1f39('0x7')],'priority':_0x16f9d0['priority']++,'VoiceExtensionId':_0x5ea5fd[_0x1caca7][0x0][_0x1f39('0x1c')]});_0x16f9d0[_0x1f39('0xf')][_0x1f39('0x11')]({'type':_0x5ea5fd[_0x1caca7][0x0][_0x1f39('0x15')],'app':_0x1f39('0x12'),'appdata':_0x1f39('0x25'),'context':_0x5ea5fd[_0x1caca7][0x0][_0x1f39('0x1b')],'exten':_0x5ea5fd[_0x1caca7][0x0][_0x1f39('0x7')],'priority':_0x16f9d0[_0x1f39('0xe')]++,'VoiceExtensionId':_0x5ea5fd[_0x1caca7][0x0][_0x1f39('0x1c')]});_0x16f9d0[_0x1f39('0xf')][_0x1f39('0x11')]({'type':_0x5ea5fd[_0x1caca7][0x0]['type'],'app':_0x1f39('0x12'),'appdata':'MONITOR_OPTIONS=ab','context':_0x5ea5fd[_0x1caca7][0x0][_0x1f39('0x1b')],'exten':_0x5ea5fd[_0x1caca7][0x0][_0x1f39('0x7')],'priority':_0x16f9d0[_0x1f39('0xe')]++,'VoiceExtensionId':_0x5ea5fd[_0x1caca7][0x0][_0x1f39('0x1c')]});for(var _0x1386fc=0x0,_0x30d10a=0x0;_0x1386fc<_0x5ea5fd[_0x1caca7][_0x1f39('0x26')];_0x1386fc+=0x1,_0x30d10a=0x0){var _0x3f7d06=_0x5ea5fd[_0x1caca7][_0x1386fc];if(_0x3f7d06[_0x1f39('0x15')]){_0x3f7d06['type']=_0x3f7d06['type'][_0x1f39('0x27')]();}var _0xb0204=[];var _0x856757=[];delete _0x3f7d06['id'];delete _0x3f7d06[_0x1f39('0x28')];delete _0x3f7d06[_0x1f39('0x29')];var _0x364295=_0x3f7d06['interval']!==_0x1f39('0x2a')?[_0x3f7d06[_0x1f39('0x2b')]]:_0x3f7d06['IntervalId']?_['map'](_['filter'](_0x16f9d0['intervals'],{'IntervalId':_0x3f7d06[_0x1f39('0x2c')]}),_0x1f39('0x2b')):[];if(_0x3f7d06[_0x1f39('0xd')](_0x1f39('0x2d'))){if(_0x3f7d06[_0x1f39('0x2d')]&&_0x3f7d06['tag']!=='--'){_0xb0204[_0x1f39('0x11')]({'type':_0x3f7d06['type'],'app':_0x1f39('0x12'),'appdata':_0x1f39('0x2e')+_0x3f7d06[_0x1f39('0x2d')],'context':_0x3f7d06['context'],'exten':_0x3f7d06[_0x1f39('0x7')],'priority':_0x364295[_0x1f39('0x26')]+_0x16f9d0['priority']+_0x30d10a++,'VoiceExtensionId':_0x3f7d06[_0x1f39('0x1c')]});}}if(_0x3f7d06[_0x1f39('0x15')]===_0x1f39('0x16')&&_0x3f7d06[_0x1f39('0xd')]('callerID')){if(_0x3f7d06[_0x1f39('0x2f')]){_0xb0204[_0x1f39('0x11')]({'type':_0x3f7d06['type'],'app':_0x1f39('0x30'),'appdata':_0x1f39('0x31')+_0x3f7d06[_0x1f39('0x2f')]+')','context':_0x3f7d06[_0x1f39('0x1b')],'exten':_0x3f7d06[_0x1f39('0x7')],'priority':_0x364295[_0x1f39('0x26')]+_0x16f9d0[_0x1f39('0xe')]+_0x30d10a++,'VoiceExtensionId':_0x3f7d06['VoiceExtensionId']});}else{_0xb0204[_0x1f39('0x11')]({'type':_0x3f7d06['type'],'app':'ExecIf','appdata':_0x1f39('0x32'),'context':_0x3f7d06[_0x1f39('0x1b')],'exten':_0x3f7d06[_0x1f39('0x7')],'priority':_0x364295[_0x1f39('0x26')]+_0x16f9d0[_0x1f39('0xe')]+_0x30d10a++,'VoiceExtensionId':_0x3f7d06[_0x1f39('0x1c')]});}}if(_0x3f7d06[_0x1f39('0xd')](_0x1f39('0x33'))){if(_0x1e0e6b[_0x1f39('0x34')](_0x3f7d06[_0x1f39('0x35')][_0x1f39('0x27')]())>=0x0&&_0x3f7d06[_0x1f39('0x36')]!==_0x1f39('0x37')){if(_0x3f7d06[_0x1f39('0x33')]){_0xb0204['push']({'type':_0x3f7d06[_0x1f39('0x15')],'app':_0x1f39('0x30'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x3f7d06[_0x1f39('0x1b')],'exten':_0x3f7d06[_0x1f39('0x7')],'priority':_0x364295[_0x1f39('0x26')]+_0x16f9d0['priority']+_0x30d10a++,'VoiceExtensionId':_0x3f7d06[_0x1f39('0x1c')]});_0xb0204[_0x1f39('0x11')]({'type':_0x3f7d06[_0x1f39('0x15')],'app':_0x1f39('0x12'),'appdata':_0x1f39('0x38'),'context':_0x3f7d06['context'],'exten':_0x3f7d06['exten'],'priority':_0x364295[_0x1f39('0x26')]+_0x16f9d0['priority']+_0x30d10a++,'VoiceExtensionId':_0x3f7d06[_0x1f39('0x1c')]});}else{_0xb0204[_0x1f39('0x11')]({'type':_0x3f7d06[_0x1f39('0x15')],'app':_0x1f39('0x30'),'appdata':_0x1f39('0x39'),'context':_0x3f7d06[_0x1f39('0x1b')],'exten':_0x3f7d06[_0x1f39('0x7')],'priority':_0x364295[_0x1f39('0x26')]+_0x16f9d0[_0x1f39('0xe')]+_0x30d10a++,'VoiceExtensionId':_0x3f7d06[_0x1f39('0x1c')]});_0xb0204['push']({'type':_0x3f7d06[_0x1f39('0x15')],'app':_0x1f39('0x12'),'appdata':_0x1f39('0x3a'),'context':_0x3f7d06[_0x1f39('0x1b')],'exten':_0x3f7d06[_0x1f39('0x7')],'priority':_0x364295[_0x1f39('0x26')]+_0x16f9d0[_0x1f39('0xe')]+_0x30d10a++,'VoiceExtensionId':_0x3f7d06[_0x1f39('0x1c')]});}}}for(var _0x203d14=0x0;_0x203d14<_0x364295['length'];_0x203d14+=0x1){var _0x30b4e6=_0x16f9d0[_0x1f39('0xe')]+_0x364295['length'];var _0x43fc69=_0x203d14===_0x364295[_0x1f39('0x26')]-0x1?_0x16f9d0[_0x1f39('0xe')]+_0xb0204[_0x1f39('0x26')]+_0x856757[_0x1f39('0x26')]+0x2:_0x16f9d0[_0x1f39('0xe')]+_0x203d14+0x1;_0xb0204[_0x1f39('0x3b')](_0x203d14,0x0,{'type':_0x3f7d06[_0x1f39('0x15')],'app':_0x1f39('0x3c'),'appdata':_0x364295[_0x203d14]+'?'+_0x3f7d06['context']+',${EXTEN},'+_0x30b4e6+':'+_0x3f7d06[_0x1f39('0x1b')]+_0x1f39('0x3d')+_0x43fc69,'exten':_0x3f7d06[_0x1f39('0x7')],'context':_0x3f7d06[_0x1f39('0x1b')],'priority':_0x16f9d0['priority']+_0x203d14,'VoiceExtensionId':_0x5ea5fd[_0x1caca7][0x0][_0x1f39('0x1c')]});}_0x3f7d06[_0x1f39('0xe')]=_0xb0204[_0x1f39('0x26')]?_[_0x1f39('0x3e')](_0xb0204)[_0x1f39('0xe')]+0x1:_0x16f9d0['priority'];_0x16f9d0[_0x1f39('0xe')]=(_0x856757['length']?_[_0x1f39('0x3e')](_0x856757)[_0x1f39('0xe')]:_0x3f7d06[_0x1f39('0xe')])+0x1;_0x16f9d0[_0x1f39('0xf')]=_['concat'](_0x16f9d0[_0x1f39('0xf')],_0xb0204,[_0x3f7d06],_0x856757);}_0x16f9d0[_0x1f39('0xf')][_0x1f39('0x11')]({'type':_0x5ea5fd[_0x1caca7][0x0][_0x1f39('0x15')],'app':_0x1f39('0x3f'),'exten':_0x5ea5fd[_0x1caca7][0x0][_0x1f39('0x7')],'context':_0x5ea5fd[_0x1caca7][0x0]['context'],'priority':_0x16f9d0[_0x1f39('0xe')],'VoiceExtensionId':_0x5ea5fd[_0x1caca7][0x0][_0x1f39('0x1c')]});_0x4c6325[_0x1f39('0x11')](_0x5ea5fd[_0x1caca7][0x0]['VoiceExtensionId']);_0x58a5f6=_[_0x1f39('0x40')](_0x58a5f6,_0x16f9d0[_0x1f39('0xf')]);}}return _0x2d58de[_0x1f39('0x41')](function(_0x3cf80a){return _0x2d58de[_0x1f39('0x1')][_0x1f39('0x5')][_0x1f39('0x42')]({'where':{'VoiceExtensionId':{'$in':_0x4c6325}},'transaction':_0x3cf80a})['then'](function(_0x3cfc3f){return _0x2d58de[_0x1f39('0x1')][_0x1f39('0x5')][_0x1f39('0x43')](_[_0x1f39('0x44')](_0x58a5f6,_0x1f39('0xe')),{'transaction':_0x3cf80a});});});})[_0x1f39('0x45')](function(_0x580b2d){console[_0x1f39('0x46')](_0x580b2d);});}exports['rewrite']=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index 2acaa07..2aaeb06 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 _0xbd67=['CmContact','createReadStream','parse','bluebird','util','squel','papaparse','../../../mysqldb','../../../config/environment','api','redis','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','error','contact','test','isNil','errors','length','map','message','data','firstName','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','find','duplicate','Duplicate\x20Contact','create','keys','then','push','pick','catch','cmContact','checkHopper','inspect','cm_hopper','fromQuery','scheduledAt','createdAt','updatedAt','select','field','NOW()','ContactId','toString','from','cm_contacts','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','insert','into','ListId','id\x20IN\x20?','calleridnum','cm_hopper_final','str','cm_hopper_black','VoiceQueue','outbound','CmList','Lists','get','dialCheckDuplicateType','always','sequelize','query','VoiceQueueId','onlyIfOpen','all','findAll','Campaign','CampaignId','BlackLists','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','stringify','finally','emit','contact:csv_','resume','resolve','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','info','CSV\x20import\x20process\x20stopped!'];(function(_0x1280ff,_0x11dcbb){var _0x4530be=function(_0x1dbc53){while(--_0x1dbc53){_0x1280ff['push'](_0x1280ff['shift']());}};_0x4530be(++_0x11dcbb);}(_0xbd67,0x1bb));var _0x7bd6=function(_0xaa37af,_0x9c97e7){_0xaa37af=_0xaa37af-0x0;var _0x56d335=_0xbd67[_0xaa37af];return _0x56d335;};'use strict';var BPromise=require(_0x7bd6('0x0'));var util=require(_0x7bd6('0x1'));var _=require('lodash');var fs=require('fs');var squel=require(_0x7bd6('0x2'));var Papa=require(_0x7bd6('0x3'));var Redis=require('ioredis');var db=require(_0x7bd6('0x4'))['db'];var config=require(_0x7bd6('0x5'));var logger=require('../../../config/logger')(_0x7bd6('0x6'));config[_0x7bd6('0x7')]=_['defaults'](config['redis'],{'host':_0x7bd6('0x8'),'port':0x18eb});var socket=require(_0x7bd6('0x9'))(new Redis(config[_0x7bd6('0x7')]));require(_0x7bd6('0xa'))[_0x7bd6('0xb')](socket);try{if(!process[_0x7bd6('0xc')][0x2]||process[_0x7bd6('0xc')][0x2]===_0x7bd6('0xd')||process[_0x7bd6('0xc')][0x2]===_0x7bd6('0xe')){throw new Error(_0x7bd6('0xf'));}var FILEPATH=process[_0x7bd6('0xc')][0x2];if(!process[_0x7bd6('0xc')][0x3]||process[_0x7bd6('0xc')][0x3]==='undefined'||process[_0x7bd6('0xc')][0x3]===_0x7bd6('0xe')||!process[_0x7bd6('0xc')][0x4]||process[_0x7bd6('0xc')][0x4]==='undefined'||process[_0x7bd6('0xc')][0x4]==='null'){throw new Error(_0x7bd6('0x10'));}var FIELDS=_[_0x7bd6('0x11')](process[_0x7bd6('0xc')][0x3][_0x7bd6('0x12')](','),process[_0x7bd6('0xc')][0x4][_0x7bd6('0x12')](','));if(!process[_0x7bd6('0xc')][0x5]||process['argv'][0x5]===_0x7bd6('0xd')||process['argv'][0x5]==='null'){throw new Error(_0x7bd6('0x13'));}var LISTID=process['argv'][0x5];var COMPANYID=process[_0x7bd6('0xc')][0x6]&&process[_0x7bd6('0xc')][0x6]!==_0x7bd6('0xd')&&process[_0x7bd6('0xc')][0x6]!==_0x7bd6('0xe')?process[_0x7bd6('0xc')][0x6]:null;var DUPLICATES=process[_0x7bd6('0xc')][0x7]&&process[_0x7bd6('0xc')][0x7]!==_0x7bd6('0xd')&&process[_0x7bd6('0xc')][0x7]!==_0x7bd6('0xe')?process[_0x7bd6('0xc')][0x7]:null;if(!process[_0x7bd6('0xc')][0x8]||process[_0x7bd6('0xc')][0x8]===_0x7bd6('0xd')||process[_0x7bd6('0xc')][0x8]===_0x7bd6('0xe')){throw new Error(_0x7bd6('0x14'));}var SOCKET_TIMESTAMP=process[_0x7bd6('0xc')][0x8];}catch(_0x5dc4a1){logger[_0x7bd6('0x15')](_0x5dc4a1);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(_0x4b3606,_0x3e7680,_0x4dabbd,_0x56d329){var _0x20f0b9={'message':_0x3e7680};_0x20f0b9[_0x4b3606]=!![];if(_0x4dabbd){_0x20f0b9[_0x7bd6('0x16')]=_0x4dabbd;}if(_0x56d329){_0x20f0b9['index']=_0x56d329;}return _0x20f0b9;}function isEmail(_0x399145){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))*$/[_0x7bd6('0x17')](_0x399145);}function checkRow(_0x102058,_0x1cee7b,_0x24b133){return new BPromise(function(_0x37e010,_0x5783d0){if(_[_0x7bd6('0x18')](_0x102058)){return _0x5783d0(handleCheckRowError(_0x7bd6('0x15'),'The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!',null,_0x24b133));}if(_0x102058['errors']&&_0x102058[_0x7bd6('0x19')][_0x7bd6('0x1a')]){var _0x1ef6ae=_[_0x7bd6('0x1b')](_0x102058[_0x7bd6('0x19')],_0x7bd6('0x1c'))['join'](';');return _0x5783d0(handleCheckRowError('error',_0x1ef6ae,null,_0x24b133));}var _0x408976={};for(var _0x4f1e0c in FIELDS){if(FIELDS['hasOwnProperty'](_0x4f1e0c)&&FIELDS[_0x4f1e0c]){_0x408976[_0x4f1e0c]=_0x102058[_0x7bd6('0x1d')][0x0][FIELDS[_0x4f1e0c]]||_0x102058['data'][0x0]['\ufeff'+FIELDS[_0x4f1e0c]];}}if(!_0x408976[_0x7bd6('0x1e')]){return _0x5783d0(handleCheckRowError(_0x7bd6('0x15'),_0x7bd6('0x1f'),null,_0x24b133));}if(!_0x408976[_0x7bd6('0x20')]){return _0x5783d0(handleCheckRowError('error',_0x7bd6('0x21'),null,_0x24b133));}if(_0x408976[_0x7bd6('0x22')]){var _0x54e956=moment(_0x408976[_0x7bd6('0x22')],_0x7bd6('0x23'));if(!_0x54e956['isValid']()){return _0x5783d0(handleCheckRowError(_0x7bd6('0x15'),_0x7bd6('0x24'),null,_0x24b133));}}if(_0x408976[_0x7bd6('0x25')]){if(!isEmail(_0x408976['email'])){return _0x5783d0(handleCheckRowError(_0x7bd6('0x15'),_0x7bd6('0x26'),null,_0x24b133));}}_0x408976['ListId']=LISTID;_0x408976['CompanyId']=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x7bd6('0x1a')]&&_0x1cee7b){var _0xaf92ad={};for(var _0xcc69ac=0x0,_0x4e4fb0=DUPLICATES[_0x7bd6('0x1a')];_0xcc69ac<_0x4e4fb0;_0xcc69ac+=0x1){_0xaf92ad[DUPLICATES[_0xcc69ac]]=_0x408976[DUPLICATES[_0xcc69ac]];}var _0x2dfa05=_[_0x7bd6('0x27')](_0x1cee7b,_0xaf92ad);if(_0x2dfa05){return _0x5783d0(handleCheckRowError(_0x7bd6('0x28'),_0x7bd6('0x29'),_0x2dfa05,_0x24b133));}}return db['CmContact'][_0x7bd6('0x2a')](_0x408976,{'raw':!![],'hooks':![],'fields':_[_0x7bd6('0x2b')](_0x408976)})[_0x7bd6('0x2c')](function(_0x4cecb0){if(DUPLICATES&&DUPLICATES['length']&&_0x1cee7b){_0x1cee7b[_0x7bd6('0x2d')](_[_0x7bd6('0x2e')](_0x408976,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x4cecb0['id'];return _0x37e010();})[_0x7bd6('0x2f')](function(_0x52e4bc){return _0x5783d0(handleCheckRowError(_0x7bd6('0x15'),'Error\x20while\x20creating\x20contact:\x20'+(_0x52e4bc['message']||JSON['stringify'](_0x52e4bc)),null,_0x24b133));});});}function checkHopper(){function _0x4978a0(){return function(_0x498d46){logger[_0x7bd6('0x15')](_0x7bd6('0x30'),_0x7bd6('0x31'),util[_0x7bd6('0x32')](_0x498d46,{'showHidden':![],'depth':null}));};}var _0x25a25b=function(_0x519f06,_0x363567){var _0x5401e0=squel['insert']()['into'](_0x7bd6('0x33'))[_0x7bd6('0x34')]([_0x7bd6('0x20'),_0x7bd6('0x35'),'ContactId','ListId',_0x363567,_0x7bd6('0x36'),_0x7bd6('0x37')],squel[_0x7bd6('0x38')]()[_0x7bd6('0x39')](_0x7bd6('0x20'),_0x7bd6('0x20'))[_0x7bd6('0x39')](_0x7bd6('0x3a'),_0x7bd6('0x35'))[_0x7bd6('0x39')]('id',_0x7bd6('0x3b'))[_0x7bd6('0x39')](LISTID[_0x7bd6('0x3c')](),'ListId')['field'](_0x519f06['id']['toString'](),_0x363567)['field'](_0x7bd6('0x3a'),_0x7bd6('0x36'))['field'](_0x7bd6('0x3a'),_0x7bd6('0x37'))[_0x7bd6('0x3d')](_0x7bd6('0x3e'))[_0x7bd6('0x3f')](_0x7bd6('0x40'))[_0x7bd6('0x3f')](_0x7bd6('0x41'),LISTID[_0x7bd6('0x3c')]())[_0x7bd6('0x3f')](_0x7bd6('0x42'))[_0x7bd6('0x3f')](_0x7bd6('0x43'),squel[_0x7bd6('0x38')]()[_0x7bd6('0x39')](_0x7bd6('0x20'))[_0x7bd6('0x3d')](_0x7bd6('0x33'))[_0x7bd6('0x3f')](_0x363567+_0x7bd6('0x44'),_0x519f06['id'][_0x7bd6('0x3c')]())))[_0x7bd6('0x3c')]();return _0x5401e0;};var _0x572414=function(_0x189e12,_0x13fcf7){var _0x57713d=squel[_0x7bd6('0x45')]()[_0x7bd6('0x46')]('cm_hopper')[_0x7bd6('0x34')]([_0x7bd6('0x20'),'scheduledAt','ContactId',_0x7bd6('0x47'),_0x13fcf7,_0x7bd6('0x36'),'updatedAt'],squel[_0x7bd6('0x38')]()[_0x7bd6('0x39')](_0x7bd6('0x20'),_0x7bd6('0x20'))[_0x7bd6('0x39')](_0x7bd6('0x3a'),_0x7bd6('0x35'))['field']('id','ContactId')[_0x7bd6('0x39')](LISTID[_0x7bd6('0x3c')](),_0x7bd6('0x47'))[_0x7bd6('0x39')](_0x189e12['id'][_0x7bd6('0x3c')](),_0x13fcf7)[_0x7bd6('0x39')](_0x7bd6('0x3a'),'createdAt')[_0x7bd6('0x39')]('NOW()',_0x7bd6('0x37'))[_0x7bd6('0x3d')](_0x7bd6('0x3e'))[_0x7bd6('0x3f')](_0x7bd6('0x40'))[_0x7bd6('0x3f')](_0x7bd6('0x41'),LISTID['toString']())[_0x7bd6('0x3f')](_0x7bd6('0x48'),squel['str'](hopperContacts))[_0x7bd6('0x3f')](_0x7bd6('0x42'))['where'](_0x7bd6('0x43'),squel[_0x7bd6('0x38')]()[_0x7bd6('0x39')](_0x7bd6('0x49'))[_0x7bd6('0x3d')](_0x7bd6('0x4a'))[_0x7bd6('0x3f')](_0x13fcf7+_0x7bd6('0x44'),_0x189e12['id'][_0x7bd6('0x3c')]()))[_0x7bd6('0x3f')](_0x7bd6('0x43'),squel[_0x7bd6('0x38')]()[_0x7bd6('0x39')](_0x7bd6('0x20'))[_0x7bd6('0x3d')]('cm_hopper')[_0x7bd6('0x3f')](_0x13fcf7+_0x7bd6('0x44'),_0x189e12['id'][_0x7bd6('0x3c')]())))[_0x7bd6('0x3c')]();return _0x57713d;};function _0x1d8c26(_0x14626d,_0x48d8e7){var _0xfbbff5=squel[_0x7bd6('0x45')]()[_0x7bd6('0x46')]('cm_hopper')[_0x7bd6('0x34')]([_0x7bd6('0x20'),_0x7bd6('0x35'),_0x7bd6('0x3b'),_0x7bd6('0x47'),_0x48d8e7,_0x7bd6('0x36'),'updatedAt'],squel[_0x7bd6('0x38')]()['field'](_0x7bd6('0x20'),_0x7bd6('0x20'))[_0x7bd6('0x39')](_0x7bd6('0x3a'),_0x7bd6('0x35'))[_0x7bd6('0x39')]('id','ContactId')[_0x7bd6('0x39')](LISTID['toString'](),_0x7bd6('0x47'))['field'](_0x14626d['id'][_0x7bd6('0x3c')](),_0x48d8e7)[_0x7bd6('0x39')](_0x7bd6('0x3a'),_0x7bd6('0x36'))[_0x7bd6('0x39')](_0x7bd6('0x3a'),_0x7bd6('0x37'))['from'](_0x7bd6('0x3e'))['where'](_0x7bd6('0x40'))[_0x7bd6('0x3f')](_0x7bd6('0x41'),LISTID[_0x7bd6('0x3c')]())[_0x7bd6('0x3f')](_0x7bd6('0x48'),squel[_0x7bd6('0x4b')](hopperContacts))[_0x7bd6('0x3f')](_0x7bd6('0x42')))[_0x7bd6('0x3c')]();return _0xfbbff5;}function _0x45f62b(_0x2c355f,_0x5ec594){var _0xb8f15b=squel[_0x7bd6('0x45')]()[_0x7bd6('0x46')](_0x7bd6('0x4c'))[_0x7bd6('0x34')]([_0x7bd6('0x20'),_0x7bd6('0x3b'),_0x7bd6('0x47'),_0x5ec594,_0x7bd6('0x36'),'updatedAt'],squel[_0x7bd6('0x38')]()['field'](_0x7bd6('0x20'),_0x7bd6('0x20'))[_0x7bd6('0x39')]('id',_0x7bd6('0x3b'))['field'](LISTID[_0x7bd6('0x3c')](),_0x7bd6('0x47'))[_0x7bd6('0x39')](_0x2c355f['id'][_0x7bd6('0x3c')](),_0x5ec594)[_0x7bd6('0x39')](_0x7bd6('0x3a'),_0x7bd6('0x36'))[_0x7bd6('0x39')](_0x7bd6('0x3a'),'updatedAt')['from'](_0x7bd6('0x3e'))['where']('deletedAt\x20IS\x20NULL')[_0x7bd6('0x3f')](_0x7bd6('0x41'),LISTID[_0x7bd6('0x3c')]())[_0x7bd6('0x3f')](_0x7bd6('0x48'),squel['str'](hopperContacts))['where'](_0x7bd6('0x42')))[_0x7bd6('0x3c')]();return _0xb8f15b;}return db[_0x7bd6('0x4d')]['findAll']({'where':{'type':_0x7bd6('0x4e')},'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0x7bd6('0x4f')],'as':_0x7bd6('0x50'),'where':{'id':LISTID}}]})[_0x7bd6('0x2c')](function(_0x50a4d0){var _0x348df8=[];if(_0x50a4d0){var _0x556414;for(var _0x3cabf3=0x0,_0x179355;_0x3cabf3<_0x50a4d0[_0x7bd6('0x1a')];_0x3cabf3+=0x1){_0x179355=_0x50a4d0[_0x3cabf3][_0x7bd6('0x51')]({'plain':!![]});switch(_0x179355[_0x7bd6('0x52')]){case _0x7bd6('0x53'):_0x348df8[_0x7bd6('0x2d')](db[_0x7bd6('0x54')][_0x7bd6('0x55')](_0x572414(_0x179355,_0x7bd6('0x56')))[_0x7bd6('0x2c')](function(){})[_0x7bd6('0x2f')](_0x4978a0()));break;case _0x7bd6('0x57'):_0x348df8[_0x7bd6('0x2d')](db[_0x7bd6('0x54')]['query'](_0x25a25b(_0x179355,_0x7bd6('0x56')))[_0x7bd6('0x2c')](function(){})['catch'](_0x4978a0()));break;default:_0x348df8[_0x7bd6('0x2d')](db[_0x7bd6('0x54')][_0x7bd6('0x55')](_0x1d8c26(_0x179355,'VoiceQueueId'))[_0x7bd6('0x2c')](function(){})['catch'](_0x4978a0()));}}}return _0x348df8;})[_0x7bd6('0x58')]()[_0x7bd6('0x2c')](function(){return db[_0x7bd6('0x4d')][_0x7bd6('0x59')]({'where':{'type':_0x7bd6('0x4e')},'attributes':['id'],'include':[{'model':db[_0x7bd6('0x4f')],'as':'BlackLists','where':{'id':LISTID}}]})[_0x7bd6('0x2c')](function(_0x96d6ab){var _0x3bfe98=[];if(_0x96d6ab){var _0xf665a6;for(var _0x2fb473=0x0,_0x299524;_0x2fb473<_0x96d6ab[_0x7bd6('0x1a')];_0x2fb473+=0x1){_0x299524=_0x96d6ab[_0x2fb473][_0x7bd6('0x51')]({'plain':!![]});_0x3bfe98[_0x7bd6('0x2d')](db[_0x7bd6('0x54')][_0x7bd6('0x55')](_0x45f62b(_0x299524,_0x7bd6('0x56')))['then'](function(){})[_0x7bd6('0x2f')](_0x4978a0()));}}return _0x3bfe98;})['all']();})[_0x7bd6('0x2c')](function(){return db[_0x7bd6('0x5a')][_0x7bd6('0x59')]({'attributes':['id',_0x7bd6('0x52')],'include':[{'model':db[_0x7bd6('0x4f')],'as':_0x7bd6('0x50'),'where':{'id':LISTID}}]})['then'](function(_0x15424f){var _0x5f1e6b=[];if(_0x15424f){for(var _0x21772e=0x0,_0x5e8ffa;_0x21772e<_0x15424f[_0x7bd6('0x1a')];_0x21772e+=0x1){_0x5e8ffa=_0x15424f[_0x21772e][_0x7bd6('0x51')]({'plain':!![]});switch(_0x5e8ffa['dialCheckDuplicateType']){case'always':_0x5f1e6b[_0x7bd6('0x2d')](db['sequelize'][_0x7bd6('0x55')](_0x572414(_0x5e8ffa,_0x7bd6('0x5b')))[_0x7bd6('0x2c')](function(){})[_0x7bd6('0x2f')](_0x4978a0()));break;case _0x7bd6('0x57'):_0x5f1e6b['push'](db['sequelize'][_0x7bd6('0x55')](_0x25a25b(_0x5e8ffa,'CampaignId'))['then'](function(){})[_0x7bd6('0x2f')](_0x4978a0()));break;default:_0x5f1e6b[_0x7bd6('0x2d')](db['sequelize'][_0x7bd6('0x55')](_0x1d8c26(_0x5e8ffa,_0x7bd6('0x5b')))[_0x7bd6('0x2c')](function(){})[_0x7bd6('0x2f')](_0x4978a0()));}}}return _0x5f1e6b;})[_0x7bd6('0x58')]();})[_0x7bd6('0x2c')](function(){return db['Campaign'][_0x7bd6('0x59')]({'attributes':['id'],'include':[{'model':db[_0x7bd6('0x4f')],'as':_0x7bd6('0x5c'),'where':{'id':LISTID}}]})[_0x7bd6('0x2c')](function(_0x32f7f4){var _0x18cc17=[];if(_0x32f7f4){for(var _0x171d97=0x0,_0x2da247;_0x171d97<_0x32f7f4['length'];_0x171d97+=0x1){_0x2da247=_0x32f7f4[_0x171d97][_0x7bd6('0x51')]({'plain':!![]});_0x18cc17[_0x7bd6('0x2d')](db[_0x7bd6('0x54')]['query'](_0x45f62b(_0x2da247,_0x7bd6('0x5b')))[_0x7bd6('0x2c')](function(){})[_0x7bd6('0x2f')](_0x4978a0()));}}return _0x18cc17;})[_0x7bd6('0x58')]();})['catch'](function(_0x455186){logger[_0x7bd6('0x15')](_0x7bd6('0x5d'),_0x7bd6('0x5e'),_0x455186[_0x7bd6('0x1c')]);});}var processPromises=function(_0x26e390){return BPromise[_0x7bd6('0x58')](promises)['then'](function(_0x3a8c82){})[_0x7bd6('0x2f')](function(_0x17c9fe){logger['error'](_0x7bd6('0x5f'),JSON[_0x7bd6('0x60')](_0x17c9fe));})[_0x7bd6('0x61')](function(){socket[_0x7bd6('0x62')](_0x7bd6('0x63')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x26e390){return _0x26e390[_0x7bd6('0x64')]();}});};var endCsv=function(){return BPromise[_0x7bd6('0x65')]()[_0x7bd6('0x2c')](function(){if(hopperContacts){return checkHopper();}})['then'](function(){socket['emit'](_0x7bd6('0x63')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs['unlinkSync'](FILEPATH);}catch(_0x7a558f){logger['error'](_0x7bd6('0x66'),JSON['stringify'](_0x7a558f));}finally{process[_0x7bd6('0x67')](0x0);}});};process['on'](_0x7bd6('0x68'),function(){logger[_0x7bd6('0x69')](_0x7bd6('0x6a'));endCsv();});function main(){return BPromise[_0x7bd6('0x65')]()[_0x7bd6('0x2c')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x7bd6('0x12')](',');return db[_0x7bd6('0x6b')][_0x7bd6('0x59')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x7bd6('0x2c')](function(_0x57c8af){var _0x5f1ece=fs[_0x7bd6('0x6c')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x7bd6('0x6d')](_0x5f1ece,{'header':!![],'skipEmptyLines':!![],'step':function(_0xf0605b,_0x375870){total+=0x1;var _0x330894=total;promises[_0x7bd6('0x2d')](checkRow(_0xf0605b,_0x57c8af,_0x330894)[_0x7bd6('0x2c')](function(){success+=0x1;})['catch'](function(_0x24978b){if(_0x24978b['error']){errors+=0x1;delete _0x24978b[_0x7bd6('0x15')];}else if(_0x24978b[_0x7bd6('0x28')]){duplicates+=0x1;delete _0x24978b[_0x7bd6('0x28')];}rows['push'](_0x24978b);}));if(total%0xc8===0x0){_0x375870['pause']();return processPromises(_0x375870);}},'complete':function(){return processPromises()[_0x7bd6('0x2c')](function(){logger[_0x7bd6('0x69')]('CSV\x20parsed\x20correctly!');endCsv();});},'error':function(_0x43adfb,_0x4b92d4){logger['info']('CSV\x20parse\x20error',JSON['stringify'](_0x43adfb));endCsv();}});})[_0x7bd6('0x2f')](function(_0x223cd4){logger[_0x7bd6('0x15')]('Error\x20executing\x20contact\x20csv\x20import:',JSON[_0x7bd6('0x60')](_0x223cd4));});}main(); \ No newline at end of file +var _0x8d93=['Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','lodash','squel','papaparse','ioredis','../../../config/environment','../../../config/logger','redis','defaults','localhost','socket.io-emitter','register','argv','null','undefined','Missing\x20binding\x20parameters!','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','index','test','isNil','error','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','message','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','length','find','duplicate','Duplicate\x20Contact','CmContact','create','then','push','pick','catch','stringify','cmContact','checkHopper','inspect','insert','into','fromQuery','phone','ContactId','createdAt','select','field','scheduledAt','toString','NOW()','updatedAt','cm_contacts','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','from','cm_hopper','\x20=\x20?','str','id\x20IN\x20?','findAll','outbound','dialCheckDuplicateType','Lists','get','query','VoiceQueueId','sequelize','all','VoiceQueue','BlackLists','Campaign','CmList','CampaignId','cmContact,\x20%s,\x20%s','Error\x20processing\x20rows\x20block:','finally','emit','contact:csv_','resolve','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','CSV\x20import\x20process\x20stopped!','createReadStream','parse','pause','info','CSV\x20parse\x20error'];(function(_0x2ce9c3,_0x1444f9){var _0xc89661=function(_0x1c1190){while(--_0x1c1190){_0x2ce9c3['push'](_0x2ce9c3['shift']());}};_0xc89661(++_0x1444f9);}(_0x8d93,0xd7));var _0x38d9=function(_0x150bf0,_0x3b0466){_0x150bf0=_0x150bf0-0x0;var _0x52698c=_0x8d93[_0x150bf0];return _0x52698c;};'use strict';var BPromise=require(_0x38d9('0x0'));var util=require(_0x38d9('0x1'));var _=require(_0x38d9('0x2'));var fs=require('fs');var squel=require(_0x38d9('0x3'));var Papa=require(_0x38d9('0x4'));var Redis=require(_0x38d9('0x5'));var db=require('../../../mysqldb')['db'];var config=require(_0x38d9('0x6'));var logger=require(_0x38d9('0x7'))('api');config[_0x38d9('0x8')]=_[_0x38d9('0x9')](config[_0x38d9('0x8')],{'host':_0x38d9('0xa'),'port':0x18eb});var socket=require(_0x38d9('0xb'))(new Redis(config[_0x38d9('0x8')]));require('../../../api/cmContact/cmContact.socket')[_0x38d9('0xc')](socket);try{if(!process[_0x38d9('0xd')][0x2]||process[_0x38d9('0xd')][0x2]==='undefined'||process[_0x38d9('0xd')][0x2]===_0x38d9('0xe')){throw new Error('Missing\x20filepath\x20parameter!');}var FILEPATH=process['argv'][0x2];if(!process[_0x38d9('0xd')][0x3]||process[_0x38d9('0xd')][0x3]===_0x38d9('0xf')||process[_0x38d9('0xd')][0x3]===_0x38d9('0xe')||!process['argv'][0x4]||process[_0x38d9('0xd')][0x4]==='undefined'||process['argv'][0x4]===_0x38d9('0xe')){throw new Error(_0x38d9('0x10'));}var FIELDS=_['zipObject'](process[_0x38d9('0xd')][0x3][_0x38d9('0x11')](','),process['argv'][0x4]['split'](','));if(!process[_0x38d9('0xd')][0x5]||process[_0x38d9('0xd')][0x5]===_0x38d9('0xf')||process['argv'][0x5]===_0x38d9('0xe')){throw new Error(_0x38d9('0x12'));}var LISTID=process[_0x38d9('0xd')][0x5];var COMPANYID=process[_0x38d9('0xd')][0x6]&&process[_0x38d9('0xd')][0x6]!==_0x38d9('0xf')&&process['argv'][0x6]!=='null'?process[_0x38d9('0xd')][0x6]:null;var DUPLICATES=process[_0x38d9('0xd')][0x7]&&process[_0x38d9('0xd')][0x7]!==_0x38d9('0xf')&&process[_0x38d9('0xd')][0x7]!==_0x38d9('0xe')?process[_0x38d9('0xd')][0x7]:null;if(!process[_0x38d9('0xd')][0x8]||process[_0x38d9('0xd')][0x8]===_0x38d9('0xf')||process[_0x38d9('0xd')][0x8]==='null'){throw new Error(_0x38d9('0x13'));}var SOCKET_TIMESTAMP=process['argv'][0x8];}catch(_0x31f344){logger['error'](_0x31f344);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(_0x19a947,_0x2eb4e7,_0x5f4252,_0x1b851c){var _0x1687f0={'message':_0x2eb4e7};_0x1687f0[_0x19a947]=!![];if(_0x5f4252){_0x1687f0['contact']=_0x5f4252;}if(_0x1b851c){_0x1687f0[_0x38d9('0x14')]=_0x1b851c;}return _0x1687f0;}function isEmail(_0x45bbeb){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))*$/[_0x38d9('0x15')](_0x45bbeb);}function checkRow(_0x1eedc0,_0x2598cd,_0x124a6b){return new BPromise(function(_0x46a589,_0x56201a){if(_[_0x38d9('0x16')](_0x1eedc0)){return _0x56201a(handleCheckRowError(_0x38d9('0x17'),_0x38d9('0x18'),null,_0x124a6b));}if(_0x1eedc0[_0x38d9('0x19')]&&_0x1eedc0[_0x38d9('0x19')]['length']){var _0x4b2947=_['map'](_0x1eedc0['errors'],_0x38d9('0x1a'))['join'](';');return _0x56201a(handleCheckRowError(_0x38d9('0x17'),_0x4b2947,null,_0x124a6b));}var _0x1979e3={};for(var _0x5b5c41 in FIELDS){if(FIELDS[_0x38d9('0x1b')](_0x5b5c41)&&FIELDS[_0x5b5c41]){_0x1979e3[_0x5b5c41]=_0x1eedc0['data'][0x0][FIELDS[_0x5b5c41]]||_0x1eedc0[_0x38d9('0x1c')][0x0]['\ufeff'+FIELDS[_0x5b5c41]];}}if(!_0x1979e3[_0x38d9('0x1d')]){return _0x56201a(handleCheckRowError('error',_0x38d9('0x1e'),null,_0x124a6b));}if(!_0x1979e3['phone']){return _0x56201a(handleCheckRowError(_0x38d9('0x17'),_0x38d9('0x1f'),null,_0x124a6b));}if(_0x1979e3[_0x38d9('0x20')]){var _0x56f714=moment(_0x1979e3[_0x38d9('0x20')],_0x38d9('0x21'));if(!_0x56f714['isValid']()){return _0x56201a(handleCheckRowError('error',_0x38d9('0x22'),null,_0x124a6b));}}if(_0x1979e3[_0x38d9('0x23')]){if(!isEmail(_0x1979e3[_0x38d9('0x23')])){return _0x56201a(handleCheckRowError(_0x38d9('0x17'),_0x38d9('0x24'),null,_0x124a6b));}}_0x1979e3[_0x38d9('0x25')]=LISTID;_0x1979e3[_0x38d9('0x26')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x38d9('0x27')]&&_0x2598cd){var _0x2848ca={};for(var _0x619240=0x0,_0x4626af=DUPLICATES[_0x38d9('0x27')];_0x619240<_0x4626af;_0x619240+=0x1){_0x2848ca[DUPLICATES[_0x619240]]=_0x1979e3[DUPLICATES[_0x619240]];}var _0x55d006=_[_0x38d9('0x28')](_0x2598cd,_0x2848ca);if(_0x55d006){return _0x56201a(handleCheckRowError(_0x38d9('0x29'),_0x38d9('0x2a'),_0x55d006,_0x124a6b));}}return db[_0x38d9('0x2b')][_0x38d9('0x2c')](_0x1979e3,{'raw':!![],'hooks':![],'fields':_['keys'](_0x1979e3)})[_0x38d9('0x2d')](function(_0x32392e){if(DUPLICATES&&DUPLICATES['length']&&_0x2598cd){_0x2598cd[_0x38d9('0x2e')](_[_0x38d9('0x2f')](_0x1979e3,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x32392e['id'];return _0x46a589();})[_0x38d9('0x30')](function(_0x3f1780){return _0x56201a(handleCheckRowError(_0x38d9('0x17'),'Error\x20while\x20creating\x20contact:\x20'+(_0x3f1780[_0x38d9('0x1a')]||JSON[_0x38d9('0x31')](_0x3f1780)),null,_0x124a6b));});});}function checkHopper(){function _0xded408(){return function(_0x1920f7){logger[_0x38d9('0x17')](_0x38d9('0x32'),_0x38d9('0x33'),util[_0x38d9('0x34')](_0x1920f7,{'showHidden':![],'depth':null}));};}var _0x185c69=function(_0x11cfeb,_0x391dde){var _0x2208d4=squel[_0x38d9('0x35')]()[_0x38d9('0x36')]('cm_hopper')[_0x38d9('0x37')]([_0x38d9('0x38'),'scheduledAt',_0x38d9('0x39'),_0x38d9('0x25'),_0x391dde,_0x38d9('0x3a'),'updatedAt'],squel[_0x38d9('0x3b')]()[_0x38d9('0x3c')]('phone','phone')['field']('NOW()',_0x38d9('0x3d'))[_0x38d9('0x3c')]('id',_0x38d9('0x39'))[_0x38d9('0x3c')](LISTID[_0x38d9('0x3e')](),_0x38d9('0x25'))['field'](_0x11cfeb['id'][_0x38d9('0x3e')](),_0x391dde)[_0x38d9('0x3c')](_0x38d9('0x3f'),_0x38d9('0x3a'))[_0x38d9('0x3c')]('NOW()',_0x38d9('0x40'))['from'](_0x38d9('0x41'))[_0x38d9('0x42')](_0x38d9('0x43'))[_0x38d9('0x42')](_0x38d9('0x44'),LISTID[_0x38d9('0x3e')]())['where'](_0x38d9('0x45'))['where'](_0x38d9('0x46'),squel[_0x38d9('0x3b')]()[_0x38d9('0x3c')](_0x38d9('0x38'))[_0x38d9('0x47')](_0x38d9('0x48'))['where'](_0x391dde+_0x38d9('0x49'),_0x11cfeb['id'][_0x38d9('0x3e')]())))[_0x38d9('0x3e')]();return _0x2208d4;};var _0x24d626=function(_0x2f0a61,_0x296e9e){var _0x33ac9a=squel[_0x38d9('0x35')]()[_0x38d9('0x36')](_0x38d9('0x48'))[_0x38d9('0x37')]([_0x38d9('0x38'),'scheduledAt',_0x38d9('0x39'),_0x38d9('0x25'),_0x296e9e,_0x38d9('0x3a'),_0x38d9('0x40')],squel['select']()[_0x38d9('0x3c')](_0x38d9('0x38'),'phone')[_0x38d9('0x3c')](_0x38d9('0x3f'),'scheduledAt')[_0x38d9('0x3c')]('id',_0x38d9('0x39'))['field'](LISTID['toString'](),_0x38d9('0x25'))[_0x38d9('0x3c')](_0x2f0a61['id'][_0x38d9('0x3e')](),_0x296e9e)[_0x38d9('0x3c')](_0x38d9('0x3f'),_0x38d9('0x3a'))['field']('NOW()','updatedAt')[_0x38d9('0x47')]('cm_contacts')[_0x38d9('0x42')](_0x38d9('0x43'))['where'](_0x38d9('0x44'),LISTID['toString']())[_0x38d9('0x42')]('id\x20IN\x20?',squel[_0x38d9('0x4a')](hopperContacts))[_0x38d9('0x42')](_0x38d9('0x45'))[_0x38d9('0x42')](_0x38d9('0x46'),squel[_0x38d9('0x3b')]()[_0x38d9('0x3c')]('calleridnum')[_0x38d9('0x47')]('cm_hopper_final')[_0x38d9('0x42')](_0x296e9e+_0x38d9('0x49'),_0x2f0a61['id'][_0x38d9('0x3e')]()))[_0x38d9('0x42')]('phone\x20NOT\x20IN\x20(?)',squel[_0x38d9('0x3b')]()[_0x38d9('0x3c')](_0x38d9('0x38'))[_0x38d9('0x47')](_0x38d9('0x48'))[_0x38d9('0x42')](_0x296e9e+'\x20=\x20?',_0x2f0a61['id'][_0x38d9('0x3e')]())))['toString']();return _0x33ac9a;};function _0x41276a(_0x300405,_0x1c1c14){var _0x5000b2=squel['insert']()[_0x38d9('0x36')](_0x38d9('0x48'))[_0x38d9('0x37')]([_0x38d9('0x38'),_0x38d9('0x3d'),'ContactId',_0x38d9('0x25'),_0x1c1c14,_0x38d9('0x3a'),_0x38d9('0x40')],squel[_0x38d9('0x3b')]()[_0x38d9('0x3c')](_0x38d9('0x38'),'phone')[_0x38d9('0x3c')](_0x38d9('0x3f'),_0x38d9('0x3d'))[_0x38d9('0x3c')]('id',_0x38d9('0x39'))['field'](LISTID[_0x38d9('0x3e')](),_0x38d9('0x25'))[_0x38d9('0x3c')](_0x300405['id'][_0x38d9('0x3e')](),_0x1c1c14)[_0x38d9('0x3c')](_0x38d9('0x3f'),_0x38d9('0x3a'))[_0x38d9('0x3c')](_0x38d9('0x3f'),_0x38d9('0x40'))['from']('cm_contacts')['where'](_0x38d9('0x43'))[_0x38d9('0x42')](_0x38d9('0x44'),LISTID[_0x38d9('0x3e')]())[_0x38d9('0x42')](_0x38d9('0x4b'),squel[_0x38d9('0x4a')](hopperContacts))[_0x38d9('0x42')]('phone\x20IS\x20NOT\x20NULL'))['toString']();return _0x5000b2;}function _0x3afdc9(_0x3a9b02,_0x2380ab){var _0x3c8ee3=squel['insert']()[_0x38d9('0x36')]('cm_hopper_black')['fromQuery']([_0x38d9('0x38'),_0x38d9('0x39'),_0x38d9('0x25'),_0x2380ab,_0x38d9('0x3a'),_0x38d9('0x40')],squel[_0x38d9('0x3b')]()[_0x38d9('0x3c')](_0x38d9('0x38'),_0x38d9('0x38'))[_0x38d9('0x3c')]('id',_0x38d9('0x39'))[_0x38d9('0x3c')](LISTID[_0x38d9('0x3e')](),'ListId')[_0x38d9('0x3c')](_0x3a9b02['id'][_0x38d9('0x3e')](),_0x2380ab)[_0x38d9('0x3c')](_0x38d9('0x3f'),_0x38d9('0x3a'))[_0x38d9('0x3c')](_0x38d9('0x3f'),_0x38d9('0x40'))['from']('cm_contacts')[_0x38d9('0x42')](_0x38d9('0x43'))[_0x38d9('0x42')](_0x38d9('0x44'),LISTID[_0x38d9('0x3e')]())[_0x38d9('0x42')]('id\x20IN\x20?',squel[_0x38d9('0x4a')](hopperContacts))[_0x38d9('0x42')](_0x38d9('0x45')))[_0x38d9('0x3e')]();return _0x3c8ee3;}return db['VoiceQueue'][_0x38d9('0x4c')]({'where':{'type':_0x38d9('0x4d')},'attributes':['id',_0x38d9('0x4e')],'include':[{'model':db['CmList'],'as':_0x38d9('0x4f'),'where':{'id':LISTID}}]})['then'](function(_0x2132c4){var _0x1c0bbf=[];if(_0x2132c4){var _0x37b2dc;for(var _0x32b593=0x0,_0x4bb0b8;_0x32b593<_0x2132c4['length'];_0x32b593+=0x1){_0x4bb0b8=_0x2132c4[_0x32b593][_0x38d9('0x50')]({'plain':!![]});switch(_0x4bb0b8[_0x38d9('0x4e')]){case'always':_0x1c0bbf['push'](db['sequelize'][_0x38d9('0x51')](_0x24d626(_0x4bb0b8,_0x38d9('0x52')))[_0x38d9('0x2d')](function(){})['catch'](_0xded408()));break;case'onlyIfOpen':_0x1c0bbf[_0x38d9('0x2e')](db[_0x38d9('0x53')][_0x38d9('0x51')](_0x185c69(_0x4bb0b8,_0x38d9('0x52')))[_0x38d9('0x2d')](function(){})[_0x38d9('0x30')](_0xded408()));break;default:_0x1c0bbf['push'](db[_0x38d9('0x53')][_0x38d9('0x51')](_0x41276a(_0x4bb0b8,_0x38d9('0x52')))[_0x38d9('0x2d')](function(){})[_0x38d9('0x30')](_0xded408()));}}}return _0x1c0bbf;})[_0x38d9('0x54')]()[_0x38d9('0x2d')](function(){return db[_0x38d9('0x55')][_0x38d9('0x4c')]({'where':{'type':'outbound'},'attributes':['id'],'include':[{'model':db['CmList'],'as':_0x38d9('0x56'),'where':{'id':LISTID}}]})['then'](function(_0xa039d6){var _0xe2c7da=[];if(_0xa039d6){var _0x3ad16b;for(var _0x2f7b1f=0x0,_0x380e9a;_0x2f7b1f<_0xa039d6[_0x38d9('0x27')];_0x2f7b1f+=0x1){_0x380e9a=_0xa039d6[_0x2f7b1f][_0x38d9('0x50')]({'plain':!![]});_0xe2c7da['push'](db['sequelize']['query'](_0x3afdc9(_0x380e9a,_0x38d9('0x52')))[_0x38d9('0x2d')](function(){})[_0x38d9('0x30')](_0xded408()));}}return _0xe2c7da;})[_0x38d9('0x54')]();})[_0x38d9('0x2d')](function(){return db[_0x38d9('0x57')][_0x38d9('0x4c')]({'attributes':['id',_0x38d9('0x4e')],'include':[{'model':db[_0x38d9('0x58')],'as':_0x38d9('0x4f'),'where':{'id':LISTID}}]})['then'](function(_0xe8901a){var _0x18dea9=[];if(_0xe8901a){for(var _0x5b5ad5=0x0,_0x467251;_0x5b5ad5<_0xe8901a[_0x38d9('0x27')];_0x5b5ad5+=0x1){_0x467251=_0xe8901a[_0x5b5ad5][_0x38d9('0x50')]({'plain':!![]});switch(_0x467251['dialCheckDuplicateType']){case'always':_0x18dea9[_0x38d9('0x2e')](db[_0x38d9('0x53')][_0x38d9('0x51')](_0x24d626(_0x467251,'CampaignId'))[_0x38d9('0x2d')](function(){})[_0x38d9('0x30')](_0xded408()));break;case'onlyIfOpen':_0x18dea9[_0x38d9('0x2e')](db[_0x38d9('0x53')][_0x38d9('0x51')](_0x185c69(_0x467251,_0x38d9('0x59')))['then'](function(){})[_0x38d9('0x30')](_0xded408()));break;default:_0x18dea9[_0x38d9('0x2e')](db[_0x38d9('0x53')][_0x38d9('0x51')](_0x41276a(_0x467251,_0x38d9('0x59')))[_0x38d9('0x2d')](function(){})[_0x38d9('0x30')](_0xded408()));}}}return _0x18dea9;})[_0x38d9('0x54')]();})['then'](function(){return db[_0x38d9('0x57')][_0x38d9('0x4c')]({'attributes':['id'],'include':[{'model':db['CmList'],'as':_0x38d9('0x56'),'where':{'id':LISTID}}]})[_0x38d9('0x2d')](function(_0xeb8bee){var _0x4bf465=[];if(_0xeb8bee){for(var _0xe3cffc=0x0,_0x49b6b4;_0xe3cffc<_0xeb8bee[_0x38d9('0x27')];_0xe3cffc+=0x1){_0x49b6b4=_0xeb8bee[_0xe3cffc][_0x38d9('0x50')]({'plain':!![]});_0x4bf465[_0x38d9('0x2e')](db[_0x38d9('0x53')]['query'](_0x3afdc9(_0x49b6b4,_0x38d9('0x59')))[_0x38d9('0x2d')](function(){})['catch'](_0xded408()));}}return _0x4bf465;})[_0x38d9('0x54')]();})[_0x38d9('0x30')](function(_0x1c74a9){logger['error'](_0x38d9('0x5a'),'generalCheckHopper',_0x1c74a9['message']);});}var processPromises=function(_0x5899ec){return BPromise[_0x38d9('0x54')](promises)[_0x38d9('0x2d')](function(_0xd3dd3d){})['catch'](function(_0x17aa13){logger['error'](_0x38d9('0x5b'),JSON[_0x38d9('0x31')](_0x17aa13));})[_0x38d9('0x5c')](function(){socket[_0x38d9('0x5d')](_0x38d9('0x5e')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x5899ec){return _0x5899ec['resume']();}});};var endCsv=function(){return BPromise[_0x38d9('0x5f')]()['then'](function(){if(hopperContacts){return checkHopper();}})[_0x38d9('0x2d')](function(){socket[_0x38d9('0x5d')]('contact:csv_'+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x38d9('0x60')](FILEPATH);}catch(_0x109a26){logger[_0x38d9('0x17')](_0x38d9('0x61'),JSON[_0x38d9('0x31')](_0x109a26));}finally{process[_0x38d9('0x62')](0x0);}});};process['on'](_0x38d9('0x63'),function(){logger['info'](_0x38d9('0x64'));endCsv();});function main(){return BPromise[_0x38d9('0x5f')]()[_0x38d9('0x2d')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES['split'](',');return db[_0x38d9('0x2b')][_0x38d9('0x4c')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x38d9('0x2d')](function(_0x143982){var _0x1982bd=fs[_0x38d9('0x65')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x38d9('0x66')](_0x1982bd,{'header':!![],'skipEmptyLines':!![],'step':function(_0x5655c6,_0x3e85db){total+=0x1;var _0x26df29=total;promises[_0x38d9('0x2e')](checkRow(_0x5655c6,_0x143982,_0x26df29)[_0x38d9('0x2d')](function(){success+=0x1;})['catch'](function(_0x4d10be){if(_0x4d10be['error']){errors+=0x1;delete _0x4d10be['error'];}else if(_0x4d10be[_0x38d9('0x29')]){duplicates+=0x1;delete _0x4d10be[_0x38d9('0x29')];}rows['push'](_0x4d10be);}));if(total%0xc8===0x0){_0x3e85db[_0x38d9('0x67')]();return processPromises(_0x3e85db);}},'complete':function(){return processPromises()[_0x38d9('0x2d')](function(){logger[_0x38d9('0x68')]('CSV\x20parsed\x20correctly!');endCsv();});},'error':function(_0x345207,_0x15d4f9){logger[_0x38d9('0x68')](_0x38d9('0x69'),JSON[_0x38d9('0x31')](_0x345207));endCsv();}});})['catch'](function(_0x9c2062){logger[_0x38d9('0x17')](_0x38d9('0x6a'),JSON[_0x38d9('0x31')](_0x9c2062));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index 7d50a7b..e960b52 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 _0x4cf1=['spread','push','catch','main','stringify','send','binding','socket_timestamp','server/files/tmp','.csv','length','rows','data','hasOwnProperty','trim','replace','YYYY-MM-DD\x20HH:mm:ss','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','isNumber','agent\x20not\x20exists','email','dateOfBirth','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','appendFileSync','emit','Abort\x20parser','abort','SystemError','step','duplicates','cm_contacts_','CREATE\x20TABLE\x20','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27','isNil',',\x20scheduledAt\x20=\x20NOW()','voice_queues','VoiceQueueId','voice_queues_has_cm_blacklists','campaigns_has_cm_lists','campaigns','CampaignId','campaigns_has_cm_blacklists','then','finish','affectedRows','contact:import:','unlink','complete','argv','arguments\x20\x20\x20','root','existsSync','file\x20doesn\x27t\x20exists','parse','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','body\x20id\x20mandatory','map','path','lodash','papaparse','util','bluebird','moment','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','redis','defaults','format','test','select','phone','from','join','.id\x20=\x20','\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','cm_contacts.phone','cm_contacts.id','cm_contacts.createdAt','cm_contacts.priority','cm_contacts.UserId','into','cm_hopper','fromQuery','scheduledat','ListId','createdAt','updatedAt','priority','UserId','recallme','fields','cm_contacts','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22onlyIfOpen\x22','\x22always\x22','cm_contacts.ListId','cm_hopper_black','ContactId','cm_contacts.ListId\x20=\x20','field','ListId\x20=\x20?','\x20=\x20?','toString','concat','keys','CompanyId','insert',')\x20NOT\x20IN\x20?','id\x20IN\x20?','min_id','Received\x20SIGINT','error','message','exit','errors','code','info','sequelize','query'];(function(_0x39ac02,_0x3c201b){var _0x66e8b8=function(_0x1ba1d1){while(--_0x1ba1d1){_0x39ac02['push'](_0x39ac02['shift']());}};_0x66e8b8(++_0x3c201b);}(_0x4cf1,0x1ca));var _0x14cf=function(_0x2842b4,_0x2b1b7b){_0x2842b4=_0x2842b4-0x0;var _0x2b9521=_0x4cf1[_0x2842b4];return _0x2b9521;};'use strict';var fs=require('fs');var path=require(_0x14cf('0x0'));var _=require(_0x14cf('0x1'));var Papa=require(_0x14cf('0x2'));var util=require(_0x14cf('0x3'));var BPromise=require(_0x14cf('0x4'));var moment=require(_0x14cf('0x5'));var squel=require(_0x14cf('0x6'));var Redis=require(_0x14cf('0x7'));var db=require(_0x14cf('0x8'))['db'];var config=require(_0x14cf('0x9'));var logger=require(_0x14cf('0xa'))('import');config[_0x14cf('0xb')]=_[_0x14cf('0xc')](config[_0x14cf('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x14cf('0xb')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()[_0x14cf('0xd')]('YYYY-MM-DD\x20HH:mm:ss');function isEmail(_0x1374f9){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))*$/[_0x14cf('0xe')](_0x1374f9);}function selectNotIn(_0x3fd245,_0x4d0ce3,_0x52ea85,_0x31cd58,_0x6635cc){return squel[_0x14cf('0xf')]()['field'](_0x14cf('0x10'))[_0x14cf('0x11')](_0x31cd58)[_0x14cf('0x12')](_0x4d0ce3,null,_0x4d0ce3+_0x14cf('0x13')+_0x31cd58+'.'+_0x52ea85)['where'](_0x31cd58+'.'+_0x52ea85+_0x14cf('0x14')+_0x3fd245+'.'+_0x52ea85)[_0x14cf('0x15')](_0x4d0ce3+_0x14cf('0x16')+_0x6635cc[_0x14cf('0x12')]()+')');}function insertCmHopper(_0x21b7b0,_0x193b71,_0x2cfc94,_0x5b39b8,_0x1e4f90){var _0x401cc8=[_0x14cf('0x17'),'cm_contacts.scheduledat',_0x14cf('0x18'),'cm_contacts.ListId',_0x193b71+'.'+_0x5b39b8,_0x14cf('0x19'),'cm_contacts.updatedAt',_0x14cf('0x1a'),_0x14cf('0x1b'),'\x22'+_0x1e4f90+'\x22'];return squel['insert']()[_0x14cf('0x1c')](_0x14cf('0x1d'))[_0x14cf('0x1e')]([_0x14cf('0x10'),_0x14cf('0x1f'),'ContactId',_0x14cf('0x20'),_0x5b39b8,_0x14cf('0x21'),_0x14cf('0x22'),_0x14cf('0x23'),_0x14cf('0x24'),_0x14cf('0x25')],squel[_0x14cf('0xf')]()[_0x14cf('0x26')](_0x401cc8)[_0x14cf('0x11')](_0x193b71)[_0x14cf('0x12')](_0x14cf('0x27'),null,'cm_contacts.ListId\x20=\x20'+_0x193b71+_0x14cf('0x28'))['join'](_0x2cfc94,null,_0x2cfc94+_0x14cf('0x13')+_0x193b71+'.'+_0x5b39b8)[_0x14cf('0x15')](_0x193b71+_0x14cf('0x29'),_0x21b7b0)[_0x14cf('0x15')](_0x14cf('0x2a'),NOW)[_0x14cf('0x15')](_0x14cf('0x2b'),selectNotIn(_0x193b71,_0x2cfc94,_0x5b39b8,'cm_hopper',['\x22always\x22',_0x14cf('0x2c')]))[_0x14cf('0x15')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x193b71,_0x2cfc94,_0x5b39b8,_0x14cf('0x1d'),[_0x14cf('0x2d')])))['toString']();}function insertCmHopperBlack(_0x19ea33,_0x2c9876,_0x2f2494,_0x37cc06){var _0x1b6dfb=[_0x14cf('0x17'),_0x14cf('0x18'),_0x14cf('0x2e'),_0x2c9876+'.'+_0x37cc06,_0x14cf('0x19'),'cm_contacts.updatedAt'];return squel['insert']()[_0x14cf('0x1c')](_0x14cf('0x2f'))['fromQuery']([_0x14cf('0x10'),_0x14cf('0x30'),_0x14cf('0x20'),_0x37cc06,'createdAt',_0x14cf('0x22')],squel[_0x14cf('0xf')]()[_0x14cf('0x26')](_0x1b6dfb)[_0x14cf('0x11')](_0x2c9876)[_0x14cf('0x12')]('cm_contacts',null,_0x14cf('0x31')+_0x2c9876+_0x14cf('0x28'))['join'](_0x2f2494,null,_0x2f2494+_0x14cf('0x13')+_0x2c9876+'.'+_0x37cc06)[_0x14cf('0x15')](_0x2c9876+'.CmListId\x20=\x20?',_0x19ea33)[_0x14cf('0x15')](_0x14cf('0x2a'),NOW)[_0x14cf('0x15')](_0x14cf('0x2b'),squel['select']()[_0x14cf('0x32')](_0x14cf('0x10'))[_0x14cf('0x11')](_0x14cf('0x2f'))[_0x14cf('0x15')](_0x14cf('0x33'),_0x19ea33)['where'](_0x37cc06+_0x14cf('0x34'),_0x2c9876+'.'+_0x37cc06)))[_0x14cf('0x35')]();}function insertCmContact(_0x3406fb,_0x319997,_0x50da0b,_0x75d21c){var _0x40d0d1=_[_0x14cf('0x36')](_[_0x14cf('0x37')](_0x75d21c),[_0x14cf('0x20'),_0x14cf('0x38'),_0x14cf('0x21'),_0x14cf('0x22')]);return squel[_0x14cf('0x39')]()['into'](_0x14cf('0x27'))['fromQuery'](_0x40d0d1,squel[_0x14cf('0xf')]()[_0x14cf('0x26')](_0x40d0d1)[_0x14cf('0x11')](_0x319997)['where']('('+_0x50da0b[_0x14cf('0x12')](',')+_0x14cf('0x3a'),squel['select']()[_0x14cf('0x26')](_0x50da0b)[_0x14cf('0x11')](_0x14cf('0x27'))[_0x14cf('0x15')](_0x14cf('0x33'),_0x3406fb)[_0x14cf('0x15')]('deletedAt\x20IS\x20NULL'))['where'](_0x14cf('0x3b'),squel[_0x14cf('0xf')]()['field']('MIN(id)',_0x14cf('0x3c'))[_0x14cf('0x11')](_0x319997)['group'](_0x50da0b[_0x14cf('0x12')](','))))['toString']();}function handleStop(){logger['info'](_0x14cf('0x3d'));stopped=!![];}function handleUncaughtException(_0x3c51c3){logger[_0x14cf('0x3e')](_0x3c51c3[_0x14cf('0x3f')]);process[_0x14cf('0x40')](0x1);}function handleError(_0x3d671c,_0x2fcf45){stats[_0x14cf('0x41')]['push']({'name':_0x2fcf45[_0x14cf('0x42')],'message':_0x2fcf45['message'],'row':_0x3d671c});}function handleQuery(_0x3140ea){logger[_0x14cf('0x43')](_0x3140ea);return db[_0x14cf('0x44')][_0x14cf('0x45')](_0x3140ea)[_0x14cf('0x46')](function(_0x4110eb){results[_0x14cf('0x47')](_0x4110eb);})[_0x14cf('0x48')](function(_0x37fa7f){logger['error'](_0x37fa7f['message']);});}function main(_0x14e580,_0x138c8a,_0x16a47a,_0x351b7f){logger[_0x14cf('0x43')](_0x14cf('0x49'),_0x14e580,JSON[_0x14cf('0x4a')](_0x138c8a));process[_0x14cf('0x4b')]('start');var _0x5da4b5=_0x138c8a[_0x14cf('0x4c')];var _0x13409b=_0x138c8a[_0x14cf('0x4d')];var _0xd51435=path[_0x14cf('0x12')](config['root'],_0x14cf('0x4e'),_0x13409b+_0x14cf('0x4f'));var _0x4d9d3f=_['keys'](_0x5da4b5)['join']();logger[_0x14cf('0x43')]('header',_0x4d9d3f);fs['writeFileSync'](_0xd51435,_0x4d9d3f+'\x0a');Papa['parse'](fs['createReadStream'](_0x14e580),{'header':!![],'skipEmptyLines':!![],'step':function(_0x2ac947,_0x23a462){try{for(var _0x365476=0x0,_0x29dc13=[];_0x365476<_0x2ac947['data'][_0x14cf('0x50')];_0x365476++){stats[_0x14cf('0x51')]+=0x1;if(_0x2ac947['errors'][_0x365476]){handleError(_0x2ac947[_0x14cf('0x52')][_0x365476],_0x2ac947['errors'][_0x365476]);}else{var _0x1ddf0e=[];for(var _0x817f1b in _0x5da4b5){if(_0x5da4b5[_0x14cf('0x53')](_0x817f1b)){if(_0x2ac947['data'][_0x365476][_0x5da4b5[_0x817f1b]]){var _0x3c473c=_[_0x14cf('0x54')](_0x2ac947[_0x14cf('0x52')][_0x365476][_0x5da4b5[_0x817f1b]][_0x14cf('0x55')](/"/g,'\x27'));switch(_0x817f1b){case _0x14cf('0x1f'):var _0x6f66a3=moment(_0x3c473c,_0x14cf('0x56'),!![]);if(_0x6f66a3[_0x14cf('0x57')]()){_0x29dc13[_0x14cf('0x47')]('\x22'+_0x3c473c+'\x22');}else{_0x1ddf0e[_0x14cf('0x47')](_0x14cf('0x58'));}break;case _0x14cf('0x23'):var _0x525031=parseInt(_0x3c473c);_0x3c473c=_[_0x14cf('0x59')](_0x525031)||_0x525031<0x0||_0x525031>0x4?_0x351b7f?0x3:0x2:_0x525031;_0x29dc13[_0x14cf('0x47')]('\x22'+_0x3c473c+'\x22');break;case _0x14cf('0x24'):var _0x4e47f3=parseInt(_0x3c473c);if(_[_0x14cf('0x5a')](_0x4e47f3)&&_['includes'](_0x16a47a,_0x4e47f3)){_0x29dc13[_0x14cf('0x47')]('\x22'+_0x4e47f3+'\x22');}else{_0x1ddf0e[_0x14cf('0x47')](_0x14cf('0x5b'));}break;case _0x14cf('0x5c'):if(isEmail(_0x3c473c)){_0x29dc13[_0x14cf('0x47')]('\x22'+_0x3c473c+'\x22');}else{_0x1ddf0e[_0x14cf('0x47')]('email\x20wrong\x20format');}break;case _0x14cf('0x5d'):var _0x4044aa=moment(_0x3c473c,'YYYY-MM-DD',!![]);if(_0x4044aa['isValid']()){_0x29dc13[_0x14cf('0x47')]('\x22'+_0x3c473c+'\x22');}else{_0x1ddf0e[_0x14cf('0x47')](_0x14cf('0x5e'));}break;default:_0x29dc13[_0x14cf('0x47')]('\x22'+_0x3c473c+'\x22');}}else{switch(_0x817f1b){case _0x14cf('0x5f'):case'phone':_0x1ddf0e[_0x14cf('0x47')](_0x817f1b+'\x20not\x20specified');break;default:_0x29dc13['push']('\x22\x22');}}}}if(_0x1ddf0e[_0x14cf('0x50')]){handleError(_0x2ac947['data'][_0x365476],{'code':'SystemRow','message':_0x1ddf0e[_0x14cf('0x12')]()});}else{fs[_0x14cf('0x60')](_0xd51435,_0x29dc13[_0x14cf('0x12')]()+'\x0a');}_0x29dc13=[];}if(!(stats[_0x14cf('0x51')]%0xc8)){socket[_0x14cf('0x61')]('contact:import:'+_0x13409b,stats);stats[_0x14cf('0x41')]=[];}}if(stopped){logger[_0x14cf('0x43')](_0x14cf('0x62'));_0x23a462[_0x14cf('0x63')]();}}catch(_0x57c38c){handleError(_0x2ac947[_0x14cf('0x52')][_0x365476],{'code':_0x14cf('0x64'),'message':_0x57c38c[_0x14cf('0x3f')]});logger[_0x14cf('0x3e')](_0x14cf('0x65'),_0x57c38c[_0x14cf('0x3f')]);}},'complete':function(){try{var _0x1ea0e9=[];var _0x20a6c2=_0x14cf('0x27');if(_0x138c8a['duplicates']&&_0x138c8a[_0x14cf('0x66')][_0x14cf('0x50')]){_0x20a6c2=_0x14cf('0x67')+_0x13409b;_0x1ea0e9[_0x14cf('0x47')](_0x14cf('0x68')+_0x20a6c2+'\x20LIKE\x20cm_contacts;');}var _0x5d6aa3=util[_0x14cf('0xd')](_0x14cf('0x69'),_0xd51435,_0x20a6c2,_0x4d9d3f,_0x138c8a[_0x14cf('0x20')],_0x138c8a['CompanyId']||null,NOW,NOW);if(_[_0x14cf('0x6a')](_0x5da4b5[_0x14cf('0x1f')])){_0x5d6aa3+=_0x14cf('0x6b');}_0x1ea0e9[_0x14cf('0x47')](_0x5d6aa3);if(_0x138c8a['duplicates']&&_0x138c8a[_0x14cf('0x66')][_0x14cf('0x50')]){_0x1ea0e9[_0x14cf('0x47')](insertCmContact(_0x138c8a[_0x14cf('0x20')],_0x20a6c2,_0x138c8a[_0x14cf('0x66')],_0x5da4b5));_0x1ea0e9[_0x14cf('0x47')]('DROP\x20TABLE\x20'+_0x20a6c2+';');}_0x1ea0e9['push'](insertCmHopper(_0x138c8a[_0x14cf('0x20')],'voice_queues_has_cm_lists',_0x14cf('0x6c'),_0x14cf('0x6d'),_0x351b7f));_0x1ea0e9['push'](insertCmHopperBlack(_0x138c8a[_0x14cf('0x20')],_0x14cf('0x6e'),_0x14cf('0x6c'),_0x14cf('0x6d')));_0x1ea0e9[_0x14cf('0x47')](insertCmHopper(_0x138c8a[_0x14cf('0x20')],_0x14cf('0x6f'),_0x14cf('0x70'),_0x14cf('0x71'),_0x351b7f));_0x1ea0e9[_0x14cf('0x47')](insertCmHopperBlack(_0x138c8a[_0x14cf('0x20')],_0x14cf('0x72'),_0x14cf('0x70'),_0x14cf('0x71')));BPromise['each'](_0x1ea0e9,handleQuery)[_0x14cf('0x73')](function(_0xf9d1e9){stats[_0x14cf('0x74')]=!![];stats['affectedRows']=_0x138c8a['duplicates']&&_0x138c8a[_0x14cf('0x66')]['length']?results[0x2]['affectedRows']:results[0x0][_0x14cf('0x75')];socket[_0x14cf('0x61')](_0x14cf('0x76')+_0x13409b,stats);fs[_0x14cf('0x77')](_0x14e580);fs[_0x14cf('0x77')](_0xd51435);process[_0x14cf('0x40')](0x0);})['catch'](function(_0x17df28){logger[_0x14cf('0x3e')](_0x17df28[_0x14cf('0x3f')]);process[_0x14cf('0x40')](0x1);});}catch(_0x242c5e){logger[_0x14cf('0x3e')](_0x14cf('0x78'),_0x242c5e[_0x14cf('0x3f')]);process[_0x14cf('0x40')](0x1);}},'error':function(_0x2c5c70,_0x23e1aa,_0x2b0226,_0x297cf1){throw new Error(_0x297cf1);}});}function validate(){if(process[_0x14cf('0x79')]&&process[_0x14cf('0x79')][_0x14cf('0x50')]<0x4){throw new Error(_0x14cf('0x7a'));}var _0x13b4ea=path['join'](config[_0x14cf('0x7b')],'server/files/tmp',process[_0x14cf('0x79')][0x2]);if(!fs[_0x14cf('0x7c')](_0x13b4ea)){throw new Error(_0x14cf('0x7d'));}var _0x47f3ab={};try{_0x47f3ab=JSON[_0x14cf('0x7e')](process['argv'][0x3]);if(!_0x47f3ab[_0x14cf('0x4c')]){throw new Error(_0x14cf('0x7f'));}if(!_0x47f3ab['binding'][_0x14cf('0x10')]){throw new Error(_0x14cf('0x80'));}if(!_0x47f3ab['binding']['firstName']){throw new Error(_0x14cf('0x81'));}var _0x2ca2b3=0x0;if(_0x47f3ab[_0x14cf('0x4c')][_0x14cf('0x24')]){_0x2ca2b3=0x1;}if(!_0x47f3ab[_0x14cf('0x20')]){throw new Error('ListId\x20is\x20mandatory');}}catch(_0x38abea){throw new Error(_0x14cf('0x82'));}var _0x14d201=[];try{_0x14d201=_[_0x14cf('0x83')](JSON[_0x14cf('0x7e')](process[_0x14cf('0x79')][0x4]),'id');}catch(_0x5bd538){logger[_0x14cf('0x43')]('No\x20agent\x20available');}main(_0x13b4ea,_0x47f3ab,_0x14d201,_0x2ca2b3);}validate();process['on']('SIGINT',handleStop);process['on']('uncaughtException',handleUncaughtException); \ No newline at end of file +var _0x2a9e=['CompanyId','createdAt','deletedAt\x20IS\x20NULL','id\x20IN\x20?','MIN(id)','min_id','group','Received\x20SIGINT','error','message','exit','errors','code','info','sequelize','query','push','catch','send','start','binding','socket_timestamp','root','server/files/tmp','.csv','keys','header','writeFileSync','parse','createReadStream','data','length','hasOwnProperty','trim','replace','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNumber','includes','agent\x20not\x20exists','email','dateOfBirth','YYYY-MM-DD','firstName','appendFileSync','rows','emit','contact:import:','Abort\x20parser','abort','SystemError','step','duplicates','\x20LIKE\x20cm_contacts;','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27','isNil',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','voice_queues_has_cm_lists','voice_queues','VoiceQueueId','voice_queues_has_cm_blacklists','campaigns_has_cm_lists','campaigns','CampaignId','each','then','finish','affectedRows','unlink','complete','argv','arguments\x20\x20\x20','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','path','papaparse','util','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','import','defaults','redis','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','test','select','field','join','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.priority','cm_contacts.UserId','insert','cm_hopper','fromQuery','phone','scheduledat','ContactId','ListId','updatedAt','priority','UserId','recallme','fields','from','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_contacts.id','cm_contacts.updatedAt','into','cm_hopper_black','.CmListId','ListId\x20=\x20?','concat'];(function(_0x364b32,_0x4dec35){var _0x3f3ea0=function(_0x1911a8){while(--_0x1911a8){_0x364b32['push'](_0x364b32['shift']());}};_0x3f3ea0(++_0x4dec35);}(_0x2a9e,0x16e));var _0xe2a9=function(_0x519fe2,_0x356d9d){_0x519fe2=_0x519fe2-0x0;var _0x1c639=_0x2a9e[_0x519fe2];return _0x1c639;};'use strict';var fs=require('fs');var path=require(_0xe2a9('0x0'));var _=require('lodash');var Papa=require(_0xe2a9('0x1'));var util=require(_0xe2a9('0x2'));var BPromise=require('bluebird');var moment=require('moment');var squel=require(_0xe2a9('0x3'));var Redis=require(_0xe2a9('0x4'));var db=require(_0xe2a9('0x5'))['db'];var config=require(_0xe2a9('0x6'));var logger=require(_0xe2a9('0x7'))(_0xe2a9('0x8'));config['redis']=_[_0xe2a9('0x9')](config[_0xe2a9('0xa')],{'host':_0xe2a9('0xb'),'port':0x18eb});var socket=require(_0xe2a9('0xc'))(new Redis(config['redis']));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()[_0xe2a9('0xd')](_0xe2a9('0xe'));function isEmail(_0xff5a65){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))*$/[_0xe2a9('0xf')](_0xff5a65);}function selectNotIn(_0x366cc7,_0x5e65ef,_0x4339bb,_0x587e08,_0x520b92){return squel[_0xe2a9('0x10')]()[_0xe2a9('0x11')]('phone')['from'](_0x587e08)[_0xe2a9('0x12')](_0x5e65ef,null,_0x5e65ef+_0xe2a9('0x13')+_0x587e08+'.'+_0x4339bb)[_0xe2a9('0x14')](_0x587e08+'.'+_0x4339bb+_0xe2a9('0x15')+_0x366cc7+'.'+_0x4339bb)[_0xe2a9('0x14')](_0x5e65ef+_0xe2a9('0x16')+_0x520b92[_0xe2a9('0x12')]()+')');}function insertCmHopper(_0x87c833,_0x3029ba,_0x415167,_0x203338,_0x30c285){var _0x7fe82e=[_0xe2a9('0x17'),_0xe2a9('0x18'),'cm_contacts.id',_0xe2a9('0x19'),_0x3029ba+'.'+_0x203338,_0xe2a9('0x1a'),'cm_contacts.updatedAt',_0xe2a9('0x1b'),_0xe2a9('0x1c'),'\x22'+_0x30c285+'\x22'];return squel[_0xe2a9('0x1d')]()['into'](_0xe2a9('0x1e'))[_0xe2a9('0x1f')]([_0xe2a9('0x20'),_0xe2a9('0x21'),_0xe2a9('0x22'),_0xe2a9('0x23'),_0x203338,'createdAt',_0xe2a9('0x24'),_0xe2a9('0x25'),_0xe2a9('0x26'),_0xe2a9('0x27')],squel[_0xe2a9('0x10')]()[_0xe2a9('0x28')](_0x7fe82e)[_0xe2a9('0x29')](_0x3029ba)['join'](_0xe2a9('0x2a'),null,_0xe2a9('0x2b')+_0x3029ba+'.CmListId')[_0xe2a9('0x12')](_0x415167,null,_0x415167+_0xe2a9('0x13')+_0x3029ba+'.'+_0x203338)[_0xe2a9('0x14')](_0x3029ba+_0xe2a9('0x2c'),_0x87c833)['where'](_0xe2a9('0x2d'),NOW)['where'](_0xe2a9('0x2e'),selectNotIn(_0x3029ba,_0x415167,_0x203338,_0xe2a9('0x1e'),[_0xe2a9('0x2f'),_0xe2a9('0x30')]))[_0xe2a9('0x14')](_0xe2a9('0x2e'),selectNotIn(_0x3029ba,_0x415167,_0x203338,'cm_hopper',[_0xe2a9('0x2f')])))[_0xe2a9('0x31')]();}function insertCmHopperBlack(_0x4e6de8,_0x5193ce,_0x48bac1,_0x57085e){var _0x170817=['cm_contacts.phone',_0xe2a9('0x32'),'cm_contacts.ListId',_0x5193ce+'.'+_0x57085e,_0xe2a9('0x1a'),_0xe2a9('0x33')];return squel[_0xe2a9('0x1d')]()[_0xe2a9('0x34')](_0xe2a9('0x35'))[_0xe2a9('0x1f')]([_0xe2a9('0x20'),_0xe2a9('0x22'),_0xe2a9('0x23'),_0x57085e,'createdAt',_0xe2a9('0x24')],squel[_0xe2a9('0x10')]()[_0xe2a9('0x28')](_0x170817)[_0xe2a9('0x29')](_0x5193ce)[_0xe2a9('0x12')](_0xe2a9('0x2a'),null,_0xe2a9('0x2b')+_0x5193ce+_0xe2a9('0x36'))['join'](_0x48bac1,null,_0x48bac1+_0xe2a9('0x13')+_0x5193ce+'.'+_0x57085e)[_0xe2a9('0x14')](_0x5193ce+_0xe2a9('0x2c'),_0x4e6de8)[_0xe2a9('0x14')](_0xe2a9('0x2d'),NOW)[_0xe2a9('0x14')](_0xe2a9('0x2e'),squel[_0xe2a9('0x10')]()[_0xe2a9('0x11')](_0xe2a9('0x20'))[_0xe2a9('0x29')](_0xe2a9('0x35'))[_0xe2a9('0x14')](_0xe2a9('0x37'),_0x4e6de8)[_0xe2a9('0x14')](_0x57085e+'\x20=\x20?',_0x5193ce+'.'+_0x57085e)))[_0xe2a9('0x31')]();}function insertCmContact(_0x37c243,_0x350a85,_0x5077a3,_0xa384b0){var _0xcffc8=_[_0xe2a9('0x38')](_['keys'](_0xa384b0),[_0xe2a9('0x23'),_0xe2a9('0x39'),_0xe2a9('0x3a'),_0xe2a9('0x24')]);return squel[_0xe2a9('0x1d')]()[_0xe2a9('0x34')](_0xe2a9('0x2a'))[_0xe2a9('0x1f')](_0xcffc8,squel[_0xe2a9('0x10')]()[_0xe2a9('0x28')](_0xcffc8)[_0xe2a9('0x29')](_0x350a85)['where']('('+_0x5077a3[_0xe2a9('0x12')](',')+')\x20NOT\x20IN\x20?',squel[_0xe2a9('0x10')]()['fields'](_0x5077a3)['from'](_0xe2a9('0x2a'))[_0xe2a9('0x14')](_0xe2a9('0x37'),_0x37c243)[_0xe2a9('0x14')](_0xe2a9('0x3b')))[_0xe2a9('0x14')](_0xe2a9('0x3c'),squel[_0xe2a9('0x10')]()[_0xe2a9('0x11')](_0xe2a9('0x3d'),_0xe2a9('0x3e'))[_0xe2a9('0x29')](_0x350a85)[_0xe2a9('0x3f')](_0x5077a3[_0xe2a9('0x12')](','))))['toString']();}function handleStop(){logger['info'](_0xe2a9('0x40'));stopped=!![];}function handleUncaughtException(_0x1ad38c){logger[_0xe2a9('0x41')](_0x1ad38c[_0xe2a9('0x42')]);process[_0xe2a9('0x43')](0x1);}function handleError(_0x67dd78,_0x4b0382){stats[_0xe2a9('0x44')]['push']({'name':_0x4b0382[_0xe2a9('0x45')],'message':_0x4b0382['message'],'row':_0x67dd78});}function handleQuery(_0x409f1c){logger[_0xe2a9('0x46')](_0x409f1c);return db[_0xe2a9('0x47')][_0xe2a9('0x48')](_0x409f1c)['spread'](function(_0x30737e){results[_0xe2a9('0x49')](_0x30737e);})[_0xe2a9('0x4a')](function(_0x37cf6e){logger[_0xe2a9('0x41')](_0x37cf6e['message']);});}function main(_0x5ae1d5,_0x1ed674,_0x14131d,_0x103e18){logger[_0xe2a9('0x46')]('main',_0x5ae1d5,JSON['stringify'](_0x1ed674));process[_0xe2a9('0x4b')](_0xe2a9('0x4c'));var _0x3c1eaf=_0x1ed674[_0xe2a9('0x4d')];var _0x3ee126=_0x1ed674[_0xe2a9('0x4e')];var _0x5c04cc=path[_0xe2a9('0x12')](config[_0xe2a9('0x4f')],_0xe2a9('0x50'),_0x3ee126+_0xe2a9('0x51'));var _0x2724f3=_[_0xe2a9('0x52')](_0x3c1eaf)['join']();logger[_0xe2a9('0x46')](_0xe2a9('0x53'),_0x2724f3);fs[_0xe2a9('0x54')](_0x5c04cc,_0x2724f3+'\x0a');Papa[_0xe2a9('0x55')](fs[_0xe2a9('0x56')](_0x5ae1d5),{'header':!![],'skipEmptyLines':!![],'step':function(_0x5de8b4,_0x4118aa){try{for(var _0x51f946=0x0,_0x14fe14=[];_0x51f946<_0x5de8b4[_0xe2a9('0x57')][_0xe2a9('0x58')];_0x51f946++){stats['rows']+=0x1;if(_0x5de8b4[_0xe2a9('0x44')][_0x51f946]){handleError(_0x5de8b4[_0xe2a9('0x57')][_0x51f946],_0x5de8b4['errors'][_0x51f946]);}else{var _0x3e8f96=[];for(var _0x2574ac in _0x3c1eaf){if(_0x3c1eaf[_0xe2a9('0x59')](_0x2574ac)){if(_0x5de8b4[_0xe2a9('0x57')][_0x51f946][_0x3c1eaf[_0x2574ac]]){var _0x5494d3=_[_0xe2a9('0x5a')](_0x5de8b4[_0xe2a9('0x57')][_0x51f946][_0x3c1eaf[_0x2574ac]][_0xe2a9('0x5b')](/"/g,'\x27'));switch(_0x2574ac){case _0xe2a9('0x21'):var _0x6d3843=moment(_0x5494d3,_0xe2a9('0xe'),!![]);if(_0x6d3843[_0xe2a9('0x5c')]()){_0x14fe14[_0xe2a9('0x49')]('\x22'+_0x5494d3+'\x22');}else{_0x3e8f96['push'](_0xe2a9('0x5d'));}break;case _0xe2a9('0x25'):var _0x47b4be=parseInt(_0x5494d3);_0x5494d3=_['isNaN'](_0x47b4be)||_0x47b4be<0x0||_0x47b4be>0x4?_0x103e18?0x3:0x2:_0x47b4be;_0x14fe14[_0xe2a9('0x49')]('\x22'+_0x5494d3+'\x22');break;case'UserId':var _0x4aa36e=parseInt(_0x5494d3);if(_[_0xe2a9('0x5e')](_0x4aa36e)&&_[_0xe2a9('0x5f')](_0x14131d,_0x4aa36e)){_0x14fe14[_0xe2a9('0x49')]('\x22'+_0x4aa36e+'\x22');}else{_0x3e8f96[_0xe2a9('0x49')](_0xe2a9('0x60'));}break;case _0xe2a9('0x61'):if(isEmail(_0x5494d3)){_0x14fe14[_0xe2a9('0x49')]('\x22'+_0x5494d3+'\x22');}else{_0x3e8f96['push']('email\x20wrong\x20format');}break;case _0xe2a9('0x62'):var _0x58487c=moment(_0x5494d3,_0xe2a9('0x63'),!![]);if(_0x58487c['isValid']()){_0x14fe14[_0xe2a9('0x49')]('\x22'+_0x5494d3+'\x22');}else{_0x3e8f96[_0xe2a9('0x49')]('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;default:_0x14fe14[_0xe2a9('0x49')]('\x22'+_0x5494d3+'\x22');}}else{switch(_0x2574ac){case _0xe2a9('0x64'):case _0xe2a9('0x20'):_0x3e8f96[_0xe2a9('0x49')](_0x2574ac+'\x20not\x20specified');break;default:_0x14fe14[_0xe2a9('0x49')]('\x22\x22');}}}}if(_0x3e8f96[_0xe2a9('0x58')]){handleError(_0x5de8b4[_0xe2a9('0x57')][_0x51f946],{'code':'SystemRow','message':_0x3e8f96[_0xe2a9('0x12')]()});}else{fs[_0xe2a9('0x65')](_0x5c04cc,_0x14fe14[_0xe2a9('0x12')]()+'\x0a');}_0x14fe14=[];}if(!(stats[_0xe2a9('0x66')]%0xc8)){socket[_0xe2a9('0x67')](_0xe2a9('0x68')+_0x3ee126,stats);stats[_0xe2a9('0x44')]=[];}}if(stopped){logger[_0xe2a9('0x46')](_0xe2a9('0x69'));_0x4118aa[_0xe2a9('0x6a')]();}}catch(_0x26d81f){handleError(_0x5de8b4[_0xe2a9('0x57')][_0x51f946],{'code':_0xe2a9('0x6b'),'message':_0x26d81f[_0xe2a9('0x42')]});logger[_0xe2a9('0x41')](_0xe2a9('0x6c'),_0x26d81f[_0xe2a9('0x42')]);}},'complete':function(){try{var _0x5c7c9f=[];var _0x110351=_0xe2a9('0x2a');if(_0x1ed674[_0xe2a9('0x6d')]&&_0x1ed674['duplicates'][_0xe2a9('0x58')]){_0x110351='cm_contacts_'+_0x3ee126;_0x5c7c9f['push']('CREATE\x20TABLE\x20'+_0x110351+_0xe2a9('0x6e'));}var _0x391a56=util[_0xe2a9('0xd')](_0xe2a9('0x6f'),_0x5c04cc,_0x110351,_0x2724f3,_0x1ed674[_0xe2a9('0x23')],_0x1ed674[_0xe2a9('0x39')]||null,NOW,NOW);if(_[_0xe2a9('0x70')](_0x3c1eaf['scheduledat'])){_0x391a56+=_0xe2a9('0x71');}_0x5c7c9f['push'](_0x391a56);if(_0x1ed674['duplicates']&&_0x1ed674[_0xe2a9('0x6d')][_0xe2a9('0x58')]){_0x5c7c9f[_0xe2a9('0x49')](insertCmContact(_0x1ed674[_0xe2a9('0x23')],_0x110351,_0x1ed674['duplicates'],_0x3c1eaf));_0x5c7c9f[_0xe2a9('0x49')](_0xe2a9('0x72')+_0x110351+';');}_0x5c7c9f['push'](insertCmHopper(_0x1ed674[_0xe2a9('0x23')],_0xe2a9('0x73'),_0xe2a9('0x74'),_0xe2a9('0x75'),_0x103e18));_0x5c7c9f['push'](insertCmHopperBlack(_0x1ed674[_0xe2a9('0x23')],_0xe2a9('0x76'),_0xe2a9('0x74'),'VoiceQueueId'));_0x5c7c9f['push'](insertCmHopper(_0x1ed674[_0xe2a9('0x23')],_0xe2a9('0x77'),_0xe2a9('0x78'),_0xe2a9('0x79'),_0x103e18));_0x5c7c9f[_0xe2a9('0x49')](insertCmHopperBlack(_0x1ed674[_0xe2a9('0x23')],'campaigns_has_cm_blacklists','campaigns',_0xe2a9('0x79')));BPromise[_0xe2a9('0x7a')](_0x5c7c9f,handleQuery)[_0xe2a9('0x7b')](function(_0x4ac5f3){stats[_0xe2a9('0x7c')]=!![];stats[_0xe2a9('0x7d')]=_0x1ed674['duplicates']&&_0x1ed674[_0xe2a9('0x6d')]['length']?results[0x2]['affectedRows']:results[0x0]['affectedRows'];socket[_0xe2a9('0x67')](_0xe2a9('0x68')+_0x3ee126,stats);fs['unlink'](_0x5ae1d5);fs[_0xe2a9('0x7e')](_0x5c04cc);process[_0xe2a9('0x43')](0x0);})['catch'](function(_0x587bbd){logger[_0xe2a9('0x41')](_0x587bbd[_0xe2a9('0x42')]);process[_0xe2a9('0x43')](0x1);});}catch(_0xbf960d){logger[_0xe2a9('0x41')](_0xe2a9('0x7f'),_0xbf960d[_0xe2a9('0x42')]);process[_0xe2a9('0x43')](0x1);}},'error':function(_0x31f3b0,_0x441d91,_0x1c6bed,_0x4b1919){throw new Error(_0x4b1919);}});}function validate(){if(process[_0xe2a9('0x80')]&&process[_0xe2a9('0x80')][_0xe2a9('0x58')]<0x4){throw new Error(_0xe2a9('0x81'));}var _0x2e3c92=path[_0xe2a9('0x12')](config[_0xe2a9('0x4f')],_0xe2a9('0x50'),process[_0xe2a9('0x80')][0x2]);if(!fs[_0xe2a9('0x82')](_0x2e3c92)){throw new Error(_0xe2a9('0x83'));}var _0x330a85={};try{_0x330a85=JSON[_0xe2a9('0x55')](process[_0xe2a9('0x80')][0x3]);if(!_0x330a85[_0xe2a9('0x4d')]){throw new Error(_0xe2a9('0x84'));}if(!_0x330a85[_0xe2a9('0x4d')]['phone']){throw new Error(_0xe2a9('0x85'));}if(!_0x330a85[_0xe2a9('0x4d')][_0xe2a9('0x64')]){throw new Error(_0xe2a9('0x86'));}var _0x31a58c=0x0;if(_0x330a85[_0xe2a9('0x4d')]['UserId']){_0x31a58c=0x1;}if(!_0x330a85[_0xe2a9('0x23')]){throw new Error(_0xe2a9('0x87'));}}catch(_0x1ea897){throw new Error(_0xe2a9('0x88'));}var _0x177804=[];try{_0x177804=_[_0xe2a9('0x89')](JSON[_0xe2a9('0x55')](process[_0xe2a9('0x80')][0x4]),'id');}catch(_0x263f9e){logger[_0xe2a9('0x46')](_0xe2a9('0x8a'));}main(_0x2e3c92,_0x330a85,_0x177804,_0x31a58c);}validate();process['on'](_0xe2a9('0x8b'),handleStop);process['on'](_0xe2a9('0x8c'),handleUncaughtException); \ No newline at end of file diff --git a/server/components/integrations/configuration.js b/server/components/integrations/configuration.js index 3f8a6d5..6787a4a 100644 --- a/server/components/integrations/configuration.js +++ b/server/components/integrations/configuration.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5452=['string','***\x20Call\x20Info\x20***','keyValue','calleridnum','Caller\x20Name','calleridname','Queue','queue','UniqueId','uniqueid','agentcalledAt','***\x20Agent\x20Info\x20***','Agent\x20Name','destcalleridname','Agent\x20Number','destcalleridnum','***\x20Time\x20Info\x20***','Agent\x20Ring','agentconnectAt','Agent\x20Complete','agentcompleteAt','Hold\x20Time','holdtime','Talk\x20Time','talktime','Called\x20Number','Member\x20Name','membername','starttime','answertime','Complete\x20Time','Duration','duration','Billable\x20Time','billableseconds','getSubjects','[xCALLY\x20Ticket]','toLowerCase','voice','inbound','variable','outbound','push','Outbound\x20Call','getDescriptions'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x5452,0x131));var _0x2545=function(_0x52e395,_0x1ca7a2){_0x52e395=_0x52e395-0x0;var _0x59600d=_0x5452[_0x52e395];return _0x59600d;};'use strict';exports[_0x2545('0x0')]=function(_0x3839d7,_0x432dc9){var _0x130cf2=[{'type':'string','content':_0x2545('0x1'),'variableName':null}];switch(_0x3839d7[_0x2545('0x2')]()){case _0x2545('0x3'):switch(_0x432dc9['toLowerCase']()){case _0x2545('0x4'):_0x130cf2['push']({'type':_0x2545('0x5'),'content':'','variableName':'queue'});_0x130cf2['push']({'type':_0x2545('0x5'),'content':'','variableName':'calleridnum'});break;case _0x2545('0x6'):_0x130cf2[_0x2545('0x7')]({'type':'string','content':_0x2545('0x8'),'variableName':null});_0x130cf2['push']({'type':_0x2545('0x5'),'content':'','variableName':'destcalleridnum'});break;}}return _0x130cf2;};exports[_0x2545('0x9')]=function(_0x51159c,_0x1d44fe){var _0x10313d=[];switch(_0x51159c[_0x2545('0x2')]()){case _0x2545('0x3'):switch(_0x1d44fe[_0x2545('0x2')]()){case _0x2545('0x4'):_0x10313d=[{'type':_0x2545('0xa'),'content':_0x2545('0xb'),'key':null,'keyType':null,'variableName':null},{'type':_0x2545('0xc'),'content':'','key':'Caller\x20Number','keyType':_0x2545('0x5'),'variableName':_0x2545('0xd')},{'type':_0x2545('0xc'),'content':'','key':_0x2545('0xe'),'keyType':_0x2545('0x5'),'variableName':_0x2545('0xf')},{'type':_0x2545('0xc'),'content':'','key':'Call\x20To','keyType':_0x2545('0x5'),'variableName':'destexten'},{'type':_0x2545('0xc'),'content':'','key':_0x2545('0x10'),'keyType':_0x2545('0x5'),'variableName':_0x2545('0x11')},{'type':_0x2545('0xc'),'content':'','key':_0x2545('0x12'),'keyType':_0x2545('0x5'),'variableName':_0x2545('0x13')},{'type':_0x2545('0xc'),'content':'','key':'Date','keyType':'variable','variableName':_0x2545('0x14')},{'type':'string','content':_0x2545('0x15'),'key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':_0x2545('0x16'),'keyType':_0x2545('0x5'),'variableName':_0x2545('0x17')},{'type':_0x2545('0xc'),'content':'','key':_0x2545('0x18'),'keyType':_0x2545('0x5'),'variableName':_0x2545('0x19')},{'type':'string','content':_0x2545('0x1a'),'key':null,'keyType':null,'variableName':null},{'type':_0x2545('0xc'),'content':'','key':_0x2545('0x1b'),'keyType':_0x2545('0x5'),'variableName':_0x2545('0x14')},{'type':'keyValue','content':'','key':'Agent\x20Connect','keyType':_0x2545('0x5'),'variableName':_0x2545('0x1c')},{'type':_0x2545('0xc'),'content':'','key':_0x2545('0x1d'),'keyType':'variable','variableName':_0x2545('0x1e')},{'type':_0x2545('0xc'),'content':'','key':_0x2545('0x1f'),'keyType':_0x2545('0x5'),'variableName':_0x2545('0x20')},{'type':'keyValue','content':'','key':_0x2545('0x21'),'keyType':_0x2545('0x5'),'variableName':_0x2545('0x22')}];break;case'outbound':_0x10313d=[{'type':_0x2545('0xa'),'content':_0x2545('0xb'),'variableName':null},{'type':'keyValue','content':'','key':_0x2545('0x23'),'keyType':_0x2545('0x5'),'keyContent':'','variableName':_0x2545('0x19')},{'type':_0x2545('0xc'),'content':'','key':_0x2545('0x24'),'keyType':'variable','keyContent':'','variableName':_0x2545('0x25')},{'type':_0x2545('0xc'),'content':'','key':_0x2545('0x12'),'keyType':_0x2545('0x5'),'keyContent':'','variableName':'uniqueid'},{'type':_0x2545('0xc'),'content':'','key':'Date','keyType':'variable','keyContent':'','variableName':_0x2545('0x26')},{'type':'string','content':_0x2545('0x1a')},{'type':_0x2545('0xc'),'content':'','key':'Answer\x20Time','keyType':_0x2545('0x5'),'keyContent':'','variableName':_0x2545('0x27')},{'type':_0x2545('0xc'),'content':'','key':_0x2545('0x28'),'keyType':_0x2545('0x5'),'keyContent':'','variableName':'endtime'},{'type':_0x2545('0xc'),'content':'','key':_0x2545('0x29'),'keyType':_0x2545('0x5'),'keyContent':'','variableName':_0x2545('0x2a')},{'type':'keyValue','content':'','key':_0x2545('0x2b'),'keyType':'variable','keyContent':'','variableName':_0x2545('0x2c')}];break;}}return _0x10313d;}; \ No newline at end of file +var _0x9076=['outbound','destcalleridnum','getDescriptions','***\x20Call\x20Info\x20***','Caller\x20Number','keyValue','Caller\x20Name','calleridname','Call\x20To','destexten','Queue','UniqueId','uniqueid','Date','agentcalledAt','***\x20Agent\x20Info\x20***','Agent\x20Name','destcalleridname','Agent\x20Number','Agent\x20Ring','Agent\x20Connect','agentconnectAt','Agent\x20Complete','agentcompleteAt','Hold\x20Time','holdtime','Talk\x20Time','talktime','starttime','***\x20Time\x20Info\x20***','Answer\x20Time','Complete\x20Time','endtime','duration','billableseconds','getSubjects','string','[xCALLY\x20Ticket]','toLowerCase','voice','inbound','push','variable','queue','calleridnum'];(function(_0x33ef62,_0x248f87){var _0xf44a45=function(_0x4895bc){while(--_0x4895bc){_0x33ef62['push'](_0x33ef62['shift']());}};_0xf44a45(++_0x248f87);}(_0x9076,0x131));var _0x6907=function(_0x35b9ba,_0x54c144){_0x35b9ba=_0x35b9ba-0x0;var _0x326361=_0x9076[_0x35b9ba];return _0x326361;};'use strict';exports[_0x6907('0x0')]=function(_0x497734,_0xf0a9cf){var _0x424180=[{'type':_0x6907('0x1'),'content':_0x6907('0x2'),'variableName':null}];switch(_0x497734[_0x6907('0x3')]()){case _0x6907('0x4'):switch(_0xf0a9cf['toLowerCase']()){case _0x6907('0x5'):_0x424180[_0x6907('0x6')]({'type':_0x6907('0x7'),'content':'','variableName':_0x6907('0x8')});_0x424180[_0x6907('0x6')]({'type':'variable','content':'','variableName':_0x6907('0x9')});break;case _0x6907('0xa'):_0x424180[_0x6907('0x6')]({'type':_0x6907('0x1'),'content':'Outbound\x20Call','variableName':null});_0x424180['push']({'type':_0x6907('0x7'),'content':'','variableName':_0x6907('0xb')});break;}}return _0x424180;};exports[_0x6907('0xc')]=function(_0x432e07,_0x32eeba){var _0x48225b=[];switch(_0x432e07['toLowerCase']()){case _0x6907('0x4'):switch(_0x32eeba[_0x6907('0x3')]()){case _0x6907('0x5'):_0x48225b=[{'type':_0x6907('0x1'),'content':_0x6907('0xd'),'key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':_0x6907('0xe'),'keyType':'variable','variableName':_0x6907('0x9')},{'type':_0x6907('0xf'),'content':'','key':_0x6907('0x10'),'keyType':_0x6907('0x7'),'variableName':_0x6907('0x11')},{'type':'keyValue','content':'','key':_0x6907('0x12'),'keyType':_0x6907('0x7'),'variableName':_0x6907('0x13')},{'type':_0x6907('0xf'),'content':'','key':_0x6907('0x14'),'keyType':_0x6907('0x7'),'variableName':'queue'},{'type':'keyValue','content':'','key':_0x6907('0x15'),'keyType':_0x6907('0x7'),'variableName':_0x6907('0x16')},{'type':_0x6907('0xf'),'content':'','key':_0x6907('0x17'),'keyType':_0x6907('0x7'),'variableName':_0x6907('0x18')},{'type':_0x6907('0x1'),'content':_0x6907('0x19'),'key':null,'keyType':null,'variableName':null},{'type':_0x6907('0xf'),'content':'','key':_0x6907('0x1a'),'keyType':_0x6907('0x7'),'variableName':_0x6907('0x1b')},{'type':_0x6907('0xf'),'content':'','key':_0x6907('0x1c'),'keyType':_0x6907('0x7'),'variableName':_0x6907('0xb')},{'type':_0x6907('0x1'),'content':'***\x20Time\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':_0x6907('0xf'),'content':'','key':_0x6907('0x1d'),'keyType':_0x6907('0x7'),'variableName':_0x6907('0x18')},{'type':_0x6907('0xf'),'content':'','key':_0x6907('0x1e'),'keyType':_0x6907('0x7'),'variableName':_0x6907('0x1f')},{'type':_0x6907('0xf'),'content':'','key':_0x6907('0x20'),'keyType':_0x6907('0x7'),'variableName':_0x6907('0x21')},{'type':'keyValue','content':'','key':_0x6907('0x22'),'keyType':_0x6907('0x7'),'variableName':_0x6907('0x23')},{'type':_0x6907('0xf'),'content':'','key':_0x6907('0x24'),'keyType':_0x6907('0x7'),'variableName':_0x6907('0x25')}];break;case _0x6907('0xa'):_0x48225b=[{'type':_0x6907('0x1'),'content':_0x6907('0xd'),'variableName':null},{'type':'keyValue','content':'','key':'Called\x20Number','keyType':'variable','keyContent':'','variableName':_0x6907('0xb')},{'type':_0x6907('0xf'),'content':'','key':'Member\x20Name','keyType':'variable','keyContent':'','variableName':'membername'},{'type':'keyValue','content':'','key':'UniqueId','keyType':_0x6907('0x7'),'keyContent':'','variableName':_0x6907('0x16')},{'type':_0x6907('0xf'),'content':'','key':_0x6907('0x17'),'keyType':_0x6907('0x7'),'keyContent':'','variableName':_0x6907('0x26')},{'type':_0x6907('0x1'),'content':_0x6907('0x27')},{'type':_0x6907('0xf'),'content':'','key':_0x6907('0x28'),'keyType':_0x6907('0x7'),'keyContent':'','variableName':'answertime'},{'type':_0x6907('0xf'),'content':'','key':_0x6907('0x29'),'keyType':_0x6907('0x7'),'keyContent':'','variableName':_0x6907('0x2a')},{'type':'keyValue','content':'','key':'Duration','keyType':_0x6907('0x7'),'keyContent':'','variableName':_0x6907('0x2b')},{'type':'keyValue','content':'','key':'Billable\x20Time','keyType':_0x6907('0x7'),'keyContent':'','variableName':_0x6907('0x2c')}];break;}}return _0x48225b;}; \ No newline at end of file diff --git a/server/components/interaction/service.js b/server/components/interaction/service.js index debb3bf..ddc2566 100644 --- a/server/components/interaction/service.js +++ b/server/components/interaction/service.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf12f=['stringify','findOne','update','then','info','catch','error','query','clone','omit','html','phone','fax','mobile','../../mysqldb','../../config/logger','mail-interactions','fax-interactions','sms-interactions','chat-interactions','whatsapp-interactions','upperFirst','InteractionId','unknown','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','role'];(function(_0x41c8f8,_0x23be4d){var _0xbc785a=function(_0x5e4b66){while(--_0x5e4b66){_0x41c8f8['push'](_0x41c8f8['shift']());}};_0xbc785a(++_0x23be4d);}(_0xf12f,0x11c));var _0xff12=function(_0xa01484,_0x51ed75){_0xa01484=_0xa01484-0x0;var _0x485337=_0xf12f[_0xa01484];return _0x485337;};'use strict';var _=require('lodash');var db=require(_0xff12('0x0'))['db'];var loggers={'openchannel':require(_0xff12('0x1'))('openchannel-interactions'),'mail':require('../../config/logger')(_0xff12('0x2')),'fax':require(_0xff12('0x1'))(_0xff12('0x3')),'sms':require(_0xff12('0x1'))(_0xff12('0x4')),'chat':require(_0xff12('0x1'))(_0xff12('0x5')),'whatsapp':require('../../config/logger')(_0xff12('0x6'))};function getInteractionId(_0x294e2c,_0x2c5d27,_0x44c7c1){if(_0x294e2c&&_0x294e2c[_[_0xff12('0x7')](_0x44c7c1)+_0xff12('0x8')]){return _0x294e2c[_[_0xff12('0x7')](_0x44c7c1)+_0xff12('0x8')];}else if(_0x294e2c&&_0x294e2c['id']){return _0x294e2c['id'];}else if(_0x2c5d27&&_0x2c5d27['id']){return _0x2c5d27['id'];}else{return _0xff12('0x9');}}function log(_0x1f4104,_0x569c3b,_0x427859,_0x1462a7,_0x5e2420,_0xc4bc8c){loggers[_0x5e2420['toLowerCase']()][_0x1f4104](_0xff12('0xa'),_0xc4bc8c[_0xff12('0xb')](),_0x569c3b?_0x569c3b['id']:null,_0x569c3b?_0x569c3b['name']:null,_0x569c3b?_0x569c3b[_0xff12('0xc')]:null,getInteractionId(_0x427859,_0x1462a7,_0x5e2420),_0x427859?JSON[_0xff12('0xd')](_0x427859):'null');}function updateUser(_0x5e1252,_0x511ea5,_0x3785a8,_0x32ab14,_0x1a4023){db[_['upperFirst'](_0x32ab14)+'Interaction'][_0xff12('0xe')]({'where':{'id':getInteractionId(_0x511ea5,_0x3785a8,_0x32ab14)}})['then'](function(_0x9476fb){if(_0x9476fb){return _0x9476fb[_0xff12('0xf')]({'UserId':_0x5e1252?_0x5e1252['id']:null});}})[_0xff12('0x10')](function(_0x316841){if(_0x316841){log(_0xff12('0x11'),_0x5e1252,_0x511ea5,_0x3785a8,_0x32ab14,_0x1a4023);}})[_0xff12('0x12')](function(){log(_0xff12('0x13'),_0x5e1252,_0x511ea5,_0x3785a8,_0x32ab14,_0x1a4023);});}exports['tracked']=function(_0xec71b8,_0x5dcbe0){return function(_0x32ff12,_0x16deab,_0x30c3a3){var _0x26d500=_0x32ff12['user'];var _0xffbf22={};var _0x33b502=_0x32ff12[_0xff12('0x14')];if(_0xffbf22){_0xffbf22=_[_0xff12('0x15')](_0x32ff12['body']);_0xffbf22=_[_0xff12('0x16')](_0xffbf22,['body',_0xff12('0x17'),_0xff12('0x18'),_0xff12('0x19'),_0xff12('0x1a')]);}updateUser(_0x26d500,_0xffbf22,_0x33b502,_0xec71b8,_0x5dcbe0);_0x30c3a3(null);};}; \ No newline at end of file +var _0x48f7=['user','query','body','omit','html','phone','fax','mobile','lodash','../../mysqldb','../../config/logger','openchannel-interactions','mail-interactions','sms-interactions','whatsapp-interactions','InteractionId','upperFirst','unknown','toLowerCase','toUpperCase','role','findOne','then','info','catch','tracked'];(function(_0x4a6d9a,_0x4e1032){var _0x3495e2=function(_0x2527c8){while(--_0x2527c8){_0x4a6d9a['push'](_0x4a6d9a['shift']());}};_0x3495e2(++_0x4e1032);}(_0x48f7,0x174));var _0x748f=function(_0x4dd1c1,_0x4ad54d){_0x4dd1c1=_0x4dd1c1-0x0;var _0x1923a5=_0x48f7[_0x4dd1c1];return _0x1923a5;};'use strict';var _=require(_0x748f('0x0'));var db=require(_0x748f('0x1'))['db'];var loggers={'openchannel':require(_0x748f('0x2'))(_0x748f('0x3')),'mail':require(_0x748f('0x2'))(_0x748f('0x4')),'fax':require(_0x748f('0x2'))('fax-interactions'),'sms':require(_0x748f('0x2'))(_0x748f('0x5')),'chat':require(_0x748f('0x2'))('chat-interactions'),'whatsapp':require(_0x748f('0x2'))(_0x748f('0x6'))};function getInteractionId(_0x238949,_0x5d06e1,_0x292c28){if(_0x238949&&_0x238949[_['upperFirst'](_0x292c28)+_0x748f('0x7')]){return _0x238949[_[_0x748f('0x8')](_0x292c28)+'InteractionId'];}else if(_0x238949&&_0x238949['id']){return _0x238949['id'];}else if(_0x5d06e1&&_0x5d06e1['id']){return _0x5d06e1['id'];}else{return _0x748f('0x9');}}function log(_0x4db55d,_0x615a7,_0x1f36d3,_0x38411e,_0x1e94f2,_0x2e798d){loggers[_0x1e94f2[_0x748f('0xa')]()][_0x4db55d]('[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x2e798d[_0x748f('0xb')](),_0x615a7?_0x615a7['id']:null,_0x615a7?_0x615a7['name']:null,_0x615a7?_0x615a7[_0x748f('0xc')]:null,getInteractionId(_0x1f36d3,_0x38411e,_0x1e94f2),_0x1f36d3?JSON['stringify'](_0x1f36d3):'null');}function updateUser(_0x309a02,_0x35fa82,_0x4be22f,_0x2ce8e8,_0xcfb972){db[_[_0x748f('0x8')](_0x2ce8e8)+'Interaction'][_0x748f('0xd')]({'where':{'id':getInteractionId(_0x35fa82,_0x4be22f,_0x2ce8e8)}})[_0x748f('0xe')](function(_0x5b2ee8){if(_0x5b2ee8){return _0x5b2ee8['update']({'UserId':_0x309a02?_0x309a02['id']:null});}})[_0x748f('0xe')](function(_0x42d5fe){if(_0x42d5fe){log(_0x748f('0xf'),_0x309a02,_0x35fa82,_0x4be22f,_0x2ce8e8,_0xcfb972);}})[_0x748f('0x10')](function(){log('error',_0x309a02,_0x35fa82,_0x4be22f,_0x2ce8e8,_0xcfb972);});}exports[_0x748f('0x11')]=function(_0x4c0cb5,_0x188934){return function(_0x15eff6,_0x14a166,_0x8129c7){var _0x2d354b=_0x15eff6[_0x748f('0x12')];var _0x48b68c={};var _0xff160a=_0x15eff6[_0x748f('0x13')];if(_0x48b68c){_0x48b68c=_['clone'](_0x15eff6[_0x748f('0x14')]);_0x48b68c=_[_0x748f('0x15')](_0x48b68c,[_0x748f('0x14'),_0x748f('0x16'),_0x748f('0x17'),_0x748f('0x18'),_0x748f('0x19')]);}updateUser(_0x2d354b,_0x48b68c,_0xff160a,_0x4c0cb5,_0x188934);_0x8129c7(null);};}; \ No newline at end of file diff --git a/server/components/license/service.js b/server/components/license/service.js index 931be4d..c4f24ae 100644 --- a/server/components/license/service.js +++ b/server/components/license/service.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xffdd=['admin','user','isUserLimit','crypto','util','composable-middleware','license','data1','split','createDecipher','aes-256-ctr','format','%s:%s:%s','utf8','parse','hasOwnProperty','use','License','findOne','then','status','json','catch','users','User'];(function(_0x4363c0,_0x29f1c1){var _0x13d4d3=function(_0x1beb8b){while(--_0x1beb8b){_0x4363c0['push'](_0x4363c0['shift']());}};_0x13d4d3(++_0x29f1c1);}(_0xffdd,0x193));var _0xdffd=function(_0x5e105b,_0x42a641){_0x5e105b=_0x5e105b-0x0;var _0x3ebfb4=_0xffdd[_0x5e105b];return _0x3ebfb4;};'use strict';var crypto=require(_0xdffd('0x0'));var util=require(_0xdffd('0x1'));var compose=require(_0xdffd('0x2'));var db=require('../../mysqldb')['db'];var config=require('../../config/environment');function getValueFromLicense(_0x2b4099,_0x16447f){if(_0x2b4099&&_0x16447f){if(_0x16447f['data1']&&_0x16447f[_0xdffd('0x3')]){var _0x295cff=_0x16447f[_0xdffd('0x4')];var _0x58606=_0x16447f['license'];var _0x581162=_0x295cff['split']('-')[0x4];var _0x372e34=_0x295cff[_0xdffd('0x5')]('-')[0x0];var _0x1c39c6=crypto[_0xdffd('0x6')](_0xdffd('0x7'),util[_0xdffd('0x8')](_0xdffd('0x9'),_0x581162,_0x295cff,_0x372e34));var _0x5d466a=_0x1c39c6['update'](_0x58606,'base64',_0xdffd('0xa'));_0x5d466a+=_0x1c39c6['final']('utf8');var _0x2e9fe5=JSON[_0xdffd('0xb')](_0x5d466a);return _0x2e9fe5[_0xdffd('0xc')](_0x2b4099)?_0x2e9fe5[_0x2b4099]:null;}}return null;}function isLimit(_0x3107b0,_0x5e9697,_0x5a77c0,_0x38f7c0){var _0x5df90b=_0x5e9697;return compose()[_0xdffd('0xd')](function(_0xf9e961,_0x198ff3,_0x5f4b1f){return db[_0xdffd('0xe')][_0xdffd('0xf')]({'where':{'id':0x1},'raw':!![]})[_0xdffd('0x10')](function(_0x155bd0){var _0x155e89=getValueFromLicense(_0x3107b0,_0x155bd0);return _0x155e89?_0x155e89:_0x5df90b;})[_0xdffd('0x10')](function(_0xa38188){_0x5df90b=_0xa38188;return _0x5a77c0['count'](_0x38f7c0);})[_0xdffd('0x10')](function(_0x4eabab){if(_0x4eabab>=_0x5df90b){return _0x198ff3[_0xdffd('0x11')](0x193)[_0xdffd('0x12')]({'message':util[_0xdffd('0x8')]('Maximum\x20%s\x20limit\x20have\x20been\x20reached',_0x3107b0)});}_0x5f4b1f();})[_0xdffd('0x13')](function(_0x5583ac){_0x5f4b1f(_0x5583ac);});});}function isUserLimit(){return isLimit(_0xdffd('0x14'),0x1,db[_0xdffd('0x15')],{'where':{'$or':[{'role':_0xdffd('0x16')},{'role':_0xdffd('0x17')}]}});}exports[_0xdffd('0x18')]=isUserLimit; \ No newline at end of file +var _0x2d56=['Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','User','user','isUserLimit','crypto','util','composable-middleware','../../config/environment','data1','license','split','createDecipher','aes-256-ctr','%s:%s:%s','update','base64','utf8','final','parse','hasOwnProperty','License','findOne','then','count','status','json','format'];(function(_0x2be7c1,_0x349d92){var _0x19293a=function(_0x24b3a0){while(--_0x24b3a0){_0x2be7c1['push'](_0x2be7c1['shift']());}};_0x19293a(++_0x349d92);}(_0x2d56,0x10b));var _0x62d5=function(_0x11ef4f,_0x65b8c6){_0x11ef4f=_0x11ef4f-0x0;var _0x38a1fe=_0x2d56[_0x11ef4f];return _0x38a1fe;};'use strict';var crypto=require(_0x62d5('0x0'));var util=require(_0x62d5('0x1'));var compose=require(_0x62d5('0x2'));var db=require('../../mysqldb')['db'];var config=require(_0x62d5('0x3'));function getValueFromLicense(_0x59af5d,_0x1d6ac4){if(_0x59af5d&&_0x1d6ac4){if(_0x1d6ac4[_0x62d5('0x4')]&&_0x1d6ac4[_0x62d5('0x5')]){var _0x4770c8=_0x1d6ac4[_0x62d5('0x4')];var _0x40bf0d=_0x1d6ac4[_0x62d5('0x5')];var _0x599500=_0x4770c8['split']('-')[0x4];var _0x404a14=_0x4770c8[_0x62d5('0x6')]('-')[0x0];var _0x5829c1=crypto[_0x62d5('0x7')](_0x62d5('0x8'),util['format'](_0x62d5('0x9'),_0x599500,_0x4770c8,_0x404a14));var _0x5b2ab9=_0x5829c1[_0x62d5('0xa')](_0x40bf0d,_0x62d5('0xb'),_0x62d5('0xc'));_0x5b2ab9+=_0x5829c1[_0x62d5('0xd')](_0x62d5('0xc'));var _0x28819a=JSON[_0x62d5('0xe')](_0x5b2ab9);return _0x28819a[_0x62d5('0xf')](_0x59af5d)?_0x28819a[_0x59af5d]:null;}}return null;}function isLimit(_0x3f7281,_0x45c1f4,_0x3f603f,_0x179141){var _0x2abb90=_0x45c1f4;return compose()['use'](function(_0x263a15,_0x39c7e1,_0xf1afb1){return db[_0x62d5('0x10')][_0x62d5('0x11')]({'where':{'id':0x1},'raw':!![]})[_0x62d5('0x12')](function(_0x32ddee){var _0x63de69=getValueFromLicense(_0x3f7281,_0x32ddee);return _0x63de69?_0x63de69:_0x2abb90;})[_0x62d5('0x12')](function(_0x1b0f65){_0x2abb90=_0x1b0f65;return _0x3f603f[_0x62d5('0x13')](_0x179141);})[_0x62d5('0x12')](function(_0x196aef){if(_0x196aef>=_0x2abb90){return _0x39c7e1[_0x62d5('0x14')](0x193)[_0x62d5('0x15')]({'message':util[_0x62d5('0x16')](_0x62d5('0x17'),_0x3f7281)});}_0xf1afb1();})[_0x62d5('0x18')](function(_0x265227){_0xf1afb1(_0x265227);});});}function isUserLimit(){return isLimit(_0x62d5('0x19'),0x1,db[_0x62d5('0x1a')],{'where':{'$or':[{'role':'admin'},{'role':_0x62d5('0x1b')}]}});}exports[_0x62d5('0x1c')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index 92271a7..f780002 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 _0xb4d5=['[$or]','split','length','slice','forEach','match','filter','indexOf','map','conditions','buildExpression','operator','$eq','$between','value','includes','$gt','$lte','add','days','format','castTo','text','CAST(','field','$ne','$notIn','\x20OR\x20','$in','IN\x20?','=\x20?','<>\x20?','$substring','$startsWith','$endsWith','LIKE\x20?','$lt','<=\x20?','$gte','BETWEEN\x20?\x20AND\x20?','start','shift','DATE','utcOffset','hours','minutes','seconds','lodash','sqlOperator','startsWith','and','replace','[$and]'];(function(_0x5b2a80,_0x4f3935){var _0x522de5=function(_0x441034){while(--_0x441034){_0x5b2a80['push'](_0x5b2a80['shift']());}};_0x522de5(++_0x4f3935);}(_0xb4d5,0x1d7));var _0x5b4d=function(_0x231d81,_0x1d9136){_0x231d81=_0x231d81-0x0;var _0x53e20c=_0xb4d5[_0x231d81];return _0x53e20c;};'use strict';var _=require(_0x5b4d('0x0'));var moment=require('moment');exports['parseSearch']=function(_0x5c5564){var _0x247d4e={'conditions':[]};_0x247d4e[_0x5b4d('0x1')]=_[_0x5b4d('0x2')](_0x5c5564,'[$or]')?'or':_0x5b4d('0x3');var _0x1e3e0a=_0x5c5564[_0x5b4d('0x4')](_0x5b4d('0x5'),'')[_0x5b4d('0x4')](_0x5b4d('0x6'),'')[_0x5b4d('0x7')]('||');for(var _0x3c537b=0x0;_0x3c537b<_0x1e3e0a[_0x5b4d('0x8')];_0x3c537b++){var _0x59e222=_0x1e3e0a[_0x3c537b]['split'](':=');var _0x347d5d=_0x59e222[0x0];var _0x569643=_0x59e222[_0x5b4d('0x9')](0x1);_0x569643[_0x5b4d('0xa')](function(_0x8c9c50){var _0x2057fc=_0x8c9c50['split']('[')['shift']();var _0x448789=_0x8c9c50[_0x5b4d('0xb')](/\[(.*?)\]/g);_0x448789['forEach'](function(_0x475307){var _0x11e431=_0x475307['split']('[')[_0x5b4d('0xc')](function(_0x57c14f){return _0x57c14f[_0x5b4d('0xd')](']')>-0x1;})[_0x5b4d('0xe')](function(_0x46ba69){return _0x46ba69[_0x5b4d('0x7')](']')[0x0];})[0x0];_0x247d4e[_0x5b4d('0xf')]['push']({'field':_0x347d5d,'operator':_0x2057fc,'value':_0x11e431});});});}return _0x247d4e;};exports[_0x5b4d('0x10')]=function(_0x3d95e1,_0x4a730b,_0x21465d){var _0x64e8e8={};if(_0x4a730b==='DATE'){if(_0x21465d[_0x5b4d('0x11')]===_0x5b4d('0x12')){_0x21465d[_0x5b4d('0x11')]=_0x5b4d('0x13');_0x21465d[_0x5b4d('0x14')]+=','+_0x21465d[_0x5b4d('0x14')];}else if(_[_0x5b4d('0x15')]([_0x5b4d('0x16'),_0x5b4d('0x17')],_0x21465d[_0x5b4d('0x11')])){_0x21465d[_0x5b4d('0x14')]=moment(_0x21465d[_0x5b4d('0x14')])[_0x5b4d('0x18')](0x1,_0x5b4d('0x19'))[_0x5b4d('0x1a')]('YYYY-MM-DD');}}if(_0x21465d[_0x5b4d('0x1b')]){_0x4a730b=_0x21465d[_0x5b4d('0x1b')];_0x64e8e8[_0x5b4d('0x1c')]=_0x5b4d('0x1d')+_0x3d95e1+'.'+_0x21465d['field']+'\x20AS\x20'+_0x21465d[_0x5b4d('0x1b')]+')\x20'+parseOperator(_0x21465d[_0x5b4d('0x11')]);}else{_0x64e8e8[_0x5b4d('0x1c')]=_0x3d95e1+'.'+_0x21465d[_0x5b4d('0x1e')]+'\x20'+parseOperator(_0x21465d[_0x5b4d('0x11')]);}if(_['includes']([_0x5b4d('0x1f'),_0x5b4d('0x20')],_0x21465d[_0x5b4d('0x11')]))_0x64e8e8[_0x5b4d('0x1c')]='('+_0x64e8e8[_0x5b4d('0x1c')]+_0x5b4d('0x21')+_0x3d95e1+'.'+_0x21465d[_0x5b4d('0x1e')]+'\x20IS\x20NULL)';_0x64e8e8[_0x5b4d('0x14')]=parseValue(_0x4a730b,_0x21465d['operator'],_0x21465d['value']);return _0x64e8e8;};function parseOperator(_0xf59573){var _0x2d2351;switch(_0xf59573){case _0x5b4d('0x22'):_0x2d2351=_0x5b4d('0x23');break;case _0x5b4d('0x20'):_0x2d2351='NOT\x20IN\x20?';break;case _0x5b4d('0x12'):_0x2d2351=_0x5b4d('0x24');break;case _0x5b4d('0x1f'):_0x2d2351=_0x5b4d('0x25');break;case _0x5b4d('0x26'):case _0x5b4d('0x27'):case _0x5b4d('0x28'):_0x2d2351=_0x5b4d('0x29');break;case _0x5b4d('0x2a'):_0x2d2351='<\x20?';break;case _0x5b4d('0x16'):_0x2d2351='>\x20?';break;case _0x5b4d('0x17'):_0x2d2351=_0x5b4d('0x2b');break;case _0x5b4d('0x2c'):_0x2d2351='>=\x20?';break;case _0x5b4d('0x13'):_0x2d2351=_0x5b4d('0x2d');break;}return _0x2d2351;}function parseValue(_0x434892,_0x45e00d,_0xad4313){var _0x5d1cf9={'start':undefined,'end':undefined};switch(_0x45e00d){case _0x5b4d('0x22'):case _0x5b4d('0x20'):_0x5d1cf9[_0x5b4d('0x2e')]=_0xad4313['split'](',');break;case _0x5b4d('0x26'):_0x5d1cf9[_0x5b4d('0x2e')]='%'+_0xad4313+'%';break;case _0x5b4d('0x27'):_0x5d1cf9[_0x5b4d('0x2e')]=_0xad4313+'%';break;case _0x5b4d('0x28'):_0x5d1cf9[_0x5b4d('0x2e')]='%'+_0xad4313;break;case _0x5b4d('0x13'):var _0x210240=_0xad4313[_0x5b4d('0x7')](',');var _0xad4313=_0x210240[_0x5b4d('0x2f')]();var _0x462ed3=_0x210240['pop']();if(_0x434892===_0x5b4d('0x30')){_0xad4313=moment(_0xad4313)[_0x5b4d('0x31')](0x0,!![])['format']();_0x462ed3=moment(_0x462ed3)[_0x5b4d('0x31')](0x0,!![])[_0x5b4d('0x18')](0x17,_0x5b4d('0x32'))[_0x5b4d('0x18')](0x3b,_0x5b4d('0x33'))[_0x5b4d('0x18')](0x3b,_0x5b4d('0x34'))['format']();}_0x5d1cf9={'start':_0xad4313,'end':_0x462ed3};break;default:_0x5d1cf9['start']=_0xad4313;break;}return _0x5d1cf9;} \ No newline at end of file +var _0x03cc=['LIKE\x20?','$lt','<\x20?','>\x20?','<=\x20?','$gte','>=\x20?','BETWEEN\x20?\x20AND\x20?','start','utcOffset','hours','seconds','parseSearch','sqlOperator','startsWith','[$or]','and','[$and]','replace','split','slice','forEach','shift','match','filter','indexOf','map','conditions','push','DATE','$eq','operator','$between','value','includes','$gt','$lte','add','format','YYYY-MM-DD','castTo','text','CAST(','field','\x20AS\x20','$ne','$notIn','\x20OR\x20','\x20IS\x20NULL)','$in','IN\x20?','<>\x20?','$substring','$startsWith','$endsWith'];(function(_0x16e0c8,_0x4861eb){var _0xe4b5af=function(_0x5248bc){while(--_0x5248bc){_0x16e0c8['push'](_0x16e0c8['shift']());}};_0xe4b5af(++_0x4861eb);}(_0x03cc,0xe8));var _0xc03c=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x03cc[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require('lodash');var moment=require('moment');exports[_0xc03c('0x0')]=function(_0x1e92ce){var _0x32fb5e={'conditions':[]};_0x32fb5e[_0xc03c('0x1')]=_[_0xc03c('0x2')](_0x1e92ce,_0xc03c('0x3'))?'or':_0xc03c('0x4');var _0x448fce=_0x1e92ce['replace'](_0xc03c('0x5'),'')[_0xc03c('0x6')](_0xc03c('0x3'),'')[_0xc03c('0x7')]('||');for(var _0xa8b3d4=0x0;_0xa8b3d4<_0x448fce['length'];_0xa8b3d4++){var _0x58146b=_0x448fce[_0xa8b3d4][_0xc03c('0x7')](':=');var _0x12cadb=_0x58146b[0x0];var _0x1d4b8f=_0x58146b[_0xc03c('0x8')](0x1);_0x1d4b8f[_0xc03c('0x9')](function(_0x1afef8){var _0x2684a7=_0x1afef8[_0xc03c('0x7')]('[')[_0xc03c('0xa')]();var _0x54ca70=_0x1afef8[_0xc03c('0xb')](/\[(.*?)\]/g);_0x54ca70[_0xc03c('0x9')](function(_0x360b1a){var _0x1f9288=_0x360b1a['split']('[')[_0xc03c('0xc')](function(_0x236ee4){return _0x236ee4[_0xc03c('0xd')](']')>-0x1;})[_0xc03c('0xe')](function(_0x61d15b){return _0x61d15b['split'](']')[0x0];})[0x0];_0x32fb5e[_0xc03c('0xf')][_0xc03c('0x10')]({'field':_0x12cadb,'operator':_0x2684a7,'value':_0x1f9288});});});}return _0x32fb5e;};exports['buildExpression']=function(_0x24fbbb,_0x5d6f34,_0x31c6f9){var _0x5811b5={};if(_0x5d6f34===_0xc03c('0x11')){if(_0x31c6f9['operator']===_0xc03c('0x12')){_0x31c6f9[_0xc03c('0x13')]=_0xc03c('0x14');_0x31c6f9['value']+=','+_0x31c6f9[_0xc03c('0x15')];}else if(_[_0xc03c('0x16')]([_0xc03c('0x17'),_0xc03c('0x18')],_0x31c6f9[_0xc03c('0x13')])){_0x31c6f9[_0xc03c('0x15')]=moment(_0x31c6f9['value'])[_0xc03c('0x19')](0x1,'days')[_0xc03c('0x1a')](_0xc03c('0x1b'));}}if(_0x31c6f9[_0xc03c('0x1c')]){_0x5d6f34=_0x31c6f9[_0xc03c('0x1c')];_0x5811b5[_0xc03c('0x1d')]=_0xc03c('0x1e')+_0x24fbbb+'.'+_0x31c6f9[_0xc03c('0x1f')]+_0xc03c('0x20')+_0x31c6f9[_0xc03c('0x1c')]+')\x20'+parseOperator(_0x31c6f9[_0xc03c('0x13')]);}else{_0x5811b5[_0xc03c('0x1d')]=_0x24fbbb+'.'+_0x31c6f9[_0xc03c('0x1f')]+'\x20'+parseOperator(_0x31c6f9[_0xc03c('0x13')]);}if(_[_0xc03c('0x16')]([_0xc03c('0x21'),_0xc03c('0x22')],_0x31c6f9[_0xc03c('0x13')]))_0x5811b5[_0xc03c('0x1d')]='('+_0x5811b5[_0xc03c('0x1d')]+_0xc03c('0x23')+_0x24fbbb+'.'+_0x31c6f9['field']+_0xc03c('0x24');_0x5811b5['value']=parseValue(_0x5d6f34,_0x31c6f9[_0xc03c('0x13')],_0x31c6f9[_0xc03c('0x15')]);return _0x5811b5;};function parseOperator(_0x2c914b){var _0x5e5619;switch(_0x2c914b){case _0xc03c('0x25'):_0x5e5619=_0xc03c('0x26');break;case'$notIn':_0x5e5619='NOT\x20IN\x20?';break;case _0xc03c('0x12'):_0x5e5619='=\x20?';break;case _0xc03c('0x21'):_0x5e5619=_0xc03c('0x27');break;case _0xc03c('0x28'):case _0xc03c('0x29'):case _0xc03c('0x2a'):_0x5e5619=_0xc03c('0x2b');break;case _0xc03c('0x2c'):_0x5e5619=_0xc03c('0x2d');break;case _0xc03c('0x17'):_0x5e5619=_0xc03c('0x2e');break;case _0xc03c('0x18'):_0x5e5619=_0xc03c('0x2f');break;case _0xc03c('0x30'):_0x5e5619=_0xc03c('0x31');break;case _0xc03c('0x14'):_0x5e5619=_0xc03c('0x32');break;}return _0x5e5619;}function parseValue(_0x280d91,_0x269ec1,_0x552d9a){var _0x4d665d={'start':undefined,'end':undefined};switch(_0x269ec1){case _0xc03c('0x25'):case _0xc03c('0x22'):_0x4d665d['start']=_0x552d9a[_0xc03c('0x7')](',');break;case'$substring':_0x4d665d[_0xc03c('0x33')]='%'+_0x552d9a+'%';break;case _0xc03c('0x29'):_0x4d665d[_0xc03c('0x33')]=_0x552d9a+'%';break;case'$endsWith':_0x4d665d[_0xc03c('0x33')]='%'+_0x552d9a;break;case _0xc03c('0x14'):var _0x181d9c=_0x552d9a[_0xc03c('0x7')](',');var _0x552d9a=_0x181d9c[_0xc03c('0xa')]();var _0x2d9e00=_0x181d9c['pop']();if(_0x280d91===_0xc03c('0x11')){_0x552d9a=moment(_0x552d9a)[_0xc03c('0x34')](0x0,!![])[_0xc03c('0x1a')]();_0x2d9e00=moment(_0x2d9e00)[_0xc03c('0x34')](0x0,!![])[_0xc03c('0x19')](0x17,_0xc03c('0x35'))[_0xc03c('0x19')](0x3b,'minutes')[_0xc03c('0x19')](0x3b,_0xc03c('0x36'))[_0xc03c('0x1a')]();}_0x4d665d={'start':_0x552d9a,'end':_0x2d9e00};break;default:_0x4d665d['start']=_0x552d9a;break;}return _0x4d665d;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index c946fe7..dbc4e14 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 _0x2a27=['parse','format','YYYY-MM-DD','utc','$lte','subtract','uniqueid','isArray','limit','offset','sort','priority','cast','col','unsigned','DESC','ASC','omit','length','isObject','isString','unset','isNumeric','isEmail','match','getFullTextValue','replace','includes','push','lodash','sequelize','moment','split','isEmpty','find','DATE','isPlainObject'];(function(_0x1f4f3a,_0x2a9bdf){var _0x2145d1=function(_0x1fd696){while(--_0x1fd696){_0x1f4f3a['push'](_0x1f4f3a['shift']());}};_0x2145d1(++_0x2a9bdf);}(_0x2a27,0x1b4));var _0x72a2=function(_0x18f9ac,_0x30f129){_0x18f9ac=_0x18f9ac-0x0;var _0x36597f=_0x2a27[_0x18f9ac];return _0x36597f;};'use strict';var _=require(_0x72a2('0x0'));var sequelize=require(_0x72a2('0x1'));var moment=require(_0x72a2('0x2'));var LIMIT_VALUE=0xfa;exports['fields']=function(_0x19649c){var _0x30e098=null;if(_0x19649c){_0x30e098=_0x19649c[_0x72a2('0x3')](',');}return _0x30e098;};exports['filters']=function(_0x41e3d9,_0x2ebf47){var _0x46d200={};if(!_[_0x72a2('0x4')](_0x41e3d9)){_['forOwn'](_0x41e3d9,function(_0x49ca5f,_0x89d76){try{if(_0x2ebf47){var _0x389f5e=_[_0x72a2('0x5')](_0x2ebf47,{'name':_0x89d76})||{};if(_0x389f5e['type']===_0x72a2('0x6')&&_[_0x72a2('0x7')](_0x49ca5f)){var _0x257736=JSON[_0x72a2('0x8')](_0x49ca5f);var _0x285496={'$gte':moment(moment(_0x257736['$gte'])[_0x72a2('0x9')](_0x72a2('0xa')))[_0x72a2('0xb')]()[_0x72a2('0x9')](),'$lte':moment(moment(_0x257736[_0x72a2('0xc')])['format'](_0x72a2('0xa')))[_0x72a2('0xb')]()[_0x72a2('0xd')](0x1,'s')['format']()};_0x46d200[_0x89d76]=_0x285496;}else if(_0x389f5e['name']===_0x72a2('0xe')){_0x46d200[_0x89d76]=_0x49ca5f;}else{_0x46d200[_0x89d76]=_[_0x72a2('0xf')](_0x49ca5f)?_0x49ca5f:JSON['parse'](_0x49ca5f);}}else{_0x46d200[_0x89d76]=_[_0x72a2('0xf')](_0x49ca5f)?_0x49ca5f:JSON[_0x72a2('0x8')](_0x49ca5f);}}catch(_0x43665e){_0x46d200[_0x89d76]=_0x49ca5f[_0x72a2('0x3')](',');}});}return _0x46d200;};exports[_0x72a2('0x10')]=function(_0x412f1e){_0x412f1e=parseInt(_0x412f1e,0xa);if(!_0x412f1e||_0x412f1e<0x0){_0x412f1e=LIMIT_VALUE;}return _0x412f1e;};exports[_0x72a2('0x11')]=function(_0x5ddd67){_0x5ddd67=parseInt(_0x5ddd67,0xa);if(!_0x5ddd67||_0x5ddd67<0x0){_0x5ddd67=0x0;}return _0x5ddd67;};exports[_0x72a2('0x12')]=function(_0x1d0ef9){var _0x4de0a8,_0x5e260d=null;if(_0x1d0ef9){_0x4de0a8=_0x1d0ef9['split'](',');_0x5e260d=_['map'](_0x4de0a8,function(_0x4f958e){if(_0x4f958e['indexOf']('-')===0x0){return[_0x4f958e===_0x72a2('0x13')?sequelize[_0x72a2('0x14')](sequelize[_0x72a2('0x15')](_0x72a2('0x13')),_0x72a2('0x16')):_0x4f958e['substr'](0x1),_0x72a2('0x17')];}else{return[_0x4f958e==='priority'?sequelize[_0x72a2('0x14')](sequelize[_0x72a2('0x15')](_0x72a2('0x13')),_0x72a2('0x16')):_0x4f958e,_0x72a2('0x18')];}});}return _0x5e260d;};exports[_0x72a2('0x19')]=function(_0x188202,_0x17ecf2){if(_[_0x72a2('0x4')](_0x188202)){return _0x188202;}if(_[_0x72a2('0xf')](_0x188202)){for(var _0x50fd9f=0x0;_0x50fd9f<_0x188202[_0x72a2('0x1a')];_0x50fd9f+=0x1){_0x188202[_0x50fd9f]=this['omit'](_0x188202[_0x50fd9f],_0x17ecf2);}return _0x188202;}if(!_[_0x72a2('0x1b')](_0x188202)){return _0x188202;}if(_[_0x72a2('0x1c')](_0x17ecf2)){_0x17ecf2=[_0x17ecf2];}if(!_[_0x72a2('0xf')](_0x17ecf2)){return _0x188202;}for(var _0x1f8354=0x0;_0x1f8354<_0x17ecf2[_0x72a2('0x1a')];_0x1f8354+=0x1){_[_0x72a2('0x1d')](_0x188202,_0x17ecf2[_0x1f8354]);}for(var _0x4e1661 in _0x188202){if(_0x188202['hasOwnProperty'](_0x4e1661)){_0x188202[_0x4e1661]=this[_0x72a2('0x19')](_0x188202[_0x4e1661],_0x17ecf2);}}return _0x188202;};exports[_0x72a2('0x1e')]=function(_0x1e54a6){return _0x1e54a6['match'](RegExp('^[+]?[0-9]*$'))?!![]:![];};exports[_0x72a2('0x1f')]=function(_0x57b787){return _0x57b787[_0x72a2('0x20')](/^\S+@\S+$/)?!![]:![];};exports[_0x72a2('0x21')]=function(_0x43b4c1){var _0x1c0804=[];_0x43b4c1[_0x72a2('0x3')](/[ ,]+/)['forEach'](function(_0x41ff3a){_0x41ff3a=_0x41ff3a[_0x72a2('0x22')](/([^:]")"+/g,'$1');_0x41ff3a='+'+_0x41ff3a+'*';if(_0x41ff3a[_0x72a2('0x23')]('@'))_0x41ff3a='\x22'+_0x41ff3a+'\x22';_0x1c0804[_0x72a2('0x24')](_0x41ff3a);});return _0x1c0804['join']('\x20');}; \ No newline at end of file +var _0xfc82=['split','filters','forOwn','find','type','DATE','isPlainObject','YYYY-MM-DD','utc','format','$lte','subtract','name','isArray','parse','limit','sort','map','cast','unsigned','DESC','priority','col','ASC','isEmpty','length','omit','isObject','isString','match','^[+]?[0-9]*$','getFullTextValue','replace','includes','push','join','lodash','moment','fields'];(function(_0x2fc6cf,_0x2bb133){var _0xf2ade3=function(_0x522b04){while(--_0x522b04){_0x2fc6cf['push'](_0x2fc6cf['shift']());}};_0xf2ade3(++_0x2bb133);}(_0xfc82,0x1d1));var _0x2fc8=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xfc82[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0x2fc8('0x0'));var sequelize=require('sequelize');var moment=require(_0x2fc8('0x1'));var LIMIT_VALUE=0xfa;exports[_0x2fc8('0x2')]=function(_0x5bb0fb){var _0x3fa840=null;if(_0x5bb0fb){_0x3fa840=_0x5bb0fb[_0x2fc8('0x3')](',');}return _0x3fa840;};exports[_0x2fc8('0x4')]=function(_0x41a4fb,_0x3a9ef5){var _0x12f5ae={};if(!_['isEmpty'](_0x41a4fb)){_[_0x2fc8('0x5')](_0x41a4fb,function(_0x1a6cf2,_0x5d7cbb){try{if(_0x3a9ef5){var _0x40066e=_[_0x2fc8('0x6')](_0x3a9ef5,{'name':_0x5d7cbb})||{};if(_0x40066e[_0x2fc8('0x7')]===_0x2fc8('0x8')&&_[_0x2fc8('0x9')](_0x1a6cf2)){var _0x22a90b=JSON['parse'](_0x1a6cf2);var _0x46c477={'$gte':moment(moment(_0x22a90b['$gte'])['format'](_0x2fc8('0xa')))[_0x2fc8('0xb')]()[_0x2fc8('0xc')](),'$lte':moment(moment(_0x22a90b[_0x2fc8('0xd')])[_0x2fc8('0xc')](_0x2fc8('0xa')))['utc']()[_0x2fc8('0xe')](0x1,'s')[_0x2fc8('0xc')]()};_0x12f5ae[_0x5d7cbb]=_0x46c477;}else if(_0x40066e[_0x2fc8('0xf')]==='uniqueid'){_0x12f5ae[_0x5d7cbb]=_0x1a6cf2;}else{_0x12f5ae[_0x5d7cbb]=_[_0x2fc8('0x10')](_0x1a6cf2)?_0x1a6cf2:JSON[_0x2fc8('0x11')](_0x1a6cf2);}}else{_0x12f5ae[_0x5d7cbb]=_['isArray'](_0x1a6cf2)?_0x1a6cf2:JSON[_0x2fc8('0x11')](_0x1a6cf2);}}catch(_0x5a95e4){_0x12f5ae[_0x5d7cbb]=_0x1a6cf2['split'](',');}});}return _0x12f5ae;};exports[_0x2fc8('0x12')]=function(_0x29b121){_0x29b121=parseInt(_0x29b121,0xa);if(!_0x29b121||_0x29b121<0x0){_0x29b121=LIMIT_VALUE;}return _0x29b121;};exports['offset']=function(_0x2b7075){_0x2b7075=parseInt(_0x2b7075,0xa);if(!_0x2b7075||_0x2b7075<0x0){_0x2b7075=0x0;}return _0x2b7075;};exports[_0x2fc8('0x13')]=function(_0x1125db){var _0x4264b8,_0x49586a=null;if(_0x1125db){_0x4264b8=_0x1125db[_0x2fc8('0x3')](',');_0x49586a=_[_0x2fc8('0x14')](_0x4264b8,function(_0x96af59){if(_0x96af59['indexOf']('-')===0x0){return[_0x96af59==='priority'?sequelize[_0x2fc8('0x15')](sequelize['col']('priority'),_0x2fc8('0x16')):_0x96af59['substr'](0x1),_0x2fc8('0x17')];}else{return[_0x96af59===_0x2fc8('0x18')?sequelize['cast'](sequelize[_0x2fc8('0x19')]('priority'),_0x2fc8('0x16')):_0x96af59,_0x2fc8('0x1a')];}});}return _0x49586a;};exports['omit']=function(_0x140d0a,_0x12159e){if(_[_0x2fc8('0x1b')](_0x140d0a)){return _0x140d0a;}if(_[_0x2fc8('0x10')](_0x140d0a)){for(var _0x51e071=0x0;_0x51e071<_0x140d0a[_0x2fc8('0x1c')];_0x51e071+=0x1){_0x140d0a[_0x51e071]=this[_0x2fc8('0x1d')](_0x140d0a[_0x51e071],_0x12159e);}return _0x140d0a;}if(!_[_0x2fc8('0x1e')](_0x140d0a)){return _0x140d0a;}if(_[_0x2fc8('0x1f')](_0x12159e)){_0x12159e=[_0x12159e];}if(!_['isArray'](_0x12159e)){return _0x140d0a;}for(var _0x4f61fa=0x0;_0x4f61fa<_0x12159e[_0x2fc8('0x1c')];_0x4f61fa+=0x1){_['unset'](_0x140d0a,_0x12159e[_0x4f61fa]);}for(var _0x22cc42 in _0x140d0a){if(_0x140d0a['hasOwnProperty'](_0x22cc42)){_0x140d0a[_0x22cc42]=this[_0x2fc8('0x1d')](_0x140d0a[_0x22cc42],_0x12159e);}}return _0x140d0a;};exports['isNumeric']=function(_0x5b94d6){return _0x5b94d6[_0x2fc8('0x20')](RegExp(_0x2fc8('0x21')))?!![]:![];};exports['isEmail']=function(_0x642de5){return _0x642de5[_0x2fc8('0x20')](/^\S+@\S+$/)?!![]:![];};exports[_0x2fc8('0x22')]=function(_0x1f3453){var _0x3acd1a=[];_0x1f3453[_0x2fc8('0x3')](/[ ,]+/)['forEach'](function(_0x39708f){_0x39708f=_0x39708f[_0x2fc8('0x23')](/([^:]")"+/g,'$1');_0x39708f='+'+_0x39708f+'*';if(_0x39708f[_0x2fc8('0x24')]('@'))_0x39708f='\x22'+_0x39708f+'\x22';_0x3acd1a[_0x2fc8('0x25')](_0x39708f);});return _0x3acd1a[_0x2fc8('0x26')]('\x20');}; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index 071f016..7bdd401 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2d95=['errorhandler','path','passport','cors','./environment','../mysqldb','default','env','production','appPath','root','public','development','test','set','client','use','toISOString','split','static','get','views','/server/views','html','renderFile','view\x20engine','50mb','json','initialize','express','serve-favicon','body-parser','method-override','cookie-parser'];(function(_0x60df74,_0x458e29){var _0x5ee872=function(_0x356888){while(--_0x356888){_0x60df74['push'](_0x60df74['shift']());}};_0x5ee872(++_0x458e29);}(_0x2d95,0x1b5));var _0x52d9=function(_0x535de9,_0x23e34b){_0x535de9=_0x535de9-0x0;var _0x293138=_0x2d95[_0x535de9];return _0x293138;};'use strict';var express=require(_0x52d9('0x0'));var favicon=require(_0x52d9('0x1'));var bodyParser=require(_0x52d9('0x2'));var methodOverride=require(_0x52d9('0x3'));var cookieParser=require(_0x52d9('0x4'));var errorHandler=require(_0x52d9('0x5'));var path=require(_0x52d9('0x6'));var passport=require(_0x52d9('0x7'));var cors=require(_0x52d9('0x8'));var moment=require('moment');var config=require(_0x52d9('0x9'));var db=require(_0x52d9('0xa'))['db'];exports[_0x52d9('0xb')]=function(_0x44d8f6){var _0x284c60=_0x44d8f6['get'](_0x52d9('0xc'));if(_0x284c60===_0x52d9('0xd')){_0x44d8f6['set'](_0x52d9('0xe'),path['join'](config[_0x52d9('0xf')],_0x52d9('0x10')));}if(_0x284c60===_0x52d9('0x11')||_0x284c60===_0x52d9('0x12')){_0x44d8f6[_0x52d9('0x13')](_0x52d9('0xe'),path['join'](config[_0x52d9('0xf')],_0x52d9('0x14')));_0x44d8f6[_0x52d9('0x15')](errorHandler());}_0x44d8f6[_0x52d9('0x13')]('json\x20replacer',function(_0x1ee20e,_0x58b59b){if(this[_0x1ee20e]instanceof Date){_0x58b59b=this[_0x1ee20e][_0x52d9('0x16')]()[_0x52d9('0x17')]('.')[0x0]+'Z';}return _0x58b59b;});_0x44d8f6[_0x52d9('0x15')](express[_0x52d9('0x18')](_0x44d8f6[_0x52d9('0x19')](_0x52d9('0xe'))));_0x44d8f6['set'](_0x52d9('0x1a'),config[_0x52d9('0xf')]+_0x52d9('0x1b'));_0x44d8f6['engine'](_0x52d9('0x1c'),require('ejs')[_0x52d9('0x1d')]);_0x44d8f6[_0x52d9('0x13')](_0x52d9('0x1e'),'html');_0x44d8f6[_0x52d9('0x15')](bodyParser['urlencoded']({'limit':_0x52d9('0x1f'),'extended':!![]}));_0x44d8f6[_0x52d9('0x15')](bodyParser[_0x52d9('0x20')]({'limit':_0x52d9('0x1f')}));_0x44d8f6[_0x52d9('0x15')](cors());_0x44d8f6[_0x52d9('0x15')](methodOverride());_0x44d8f6[_0x52d9('0x15')](cookieParser());_0x44d8f6[_0x52d9('0x15')](passport[_0x52d9('0x21')]());}; \ No newline at end of file +var _0x2c12=['html','ejs','renderFile','urlencoded','50mb','json','initialize','serve-favicon','method-override','cookie-parser','errorhandler','path','passport','cors','moment','./environment','get','env','production','set','appPath','root','public','development','test','join','client','use','json\x20replacer','toISOString','static','views','/server/views','engine'];(function(_0x51ca80,_0x35aa10){var _0x656024=function(_0x4d9eb1){while(--_0x4d9eb1){_0x51ca80['push'](_0x51ca80['shift']());}};_0x656024(++_0x35aa10);}(_0x2c12,0x1e3));var _0x22c1=function(_0x1dd532,_0x36e81c){_0x1dd532=_0x1dd532-0x0;var _0x3732aa=_0x2c12[_0x1dd532];return _0x3732aa;};'use strict';var express=require('express');var favicon=require(_0x22c1('0x0'));var bodyParser=require('body-parser');var methodOverride=require(_0x22c1('0x1'));var cookieParser=require(_0x22c1('0x2'));var errorHandler=require(_0x22c1('0x3'));var path=require(_0x22c1('0x4'));var passport=require(_0x22c1('0x5'));var cors=require(_0x22c1('0x6'));var moment=require(_0x22c1('0x7'));var config=require(_0x22c1('0x8'));var db=require('../mysqldb')['db'];exports['default']=function(_0x5c9626){var _0x584716=_0x5c9626[_0x22c1('0x9')](_0x22c1('0xa'));if(_0x584716===_0x22c1('0xb')){_0x5c9626[_0x22c1('0xc')](_0x22c1('0xd'),path['join'](config[_0x22c1('0xe')],_0x22c1('0xf')));}if(_0x584716===_0x22c1('0x10')||_0x584716===_0x22c1('0x11')){_0x5c9626[_0x22c1('0xc')](_0x22c1('0xd'),path[_0x22c1('0x12')](config[_0x22c1('0xe')],_0x22c1('0x13')));_0x5c9626[_0x22c1('0x14')](errorHandler());}_0x5c9626[_0x22c1('0xc')](_0x22c1('0x15'),function(_0x6b2185,_0x511fb8){if(this[_0x6b2185]instanceof Date){_0x511fb8=this[_0x6b2185][_0x22c1('0x16')]()['split']('.')[0x0]+'Z';}return _0x511fb8;});_0x5c9626[_0x22c1('0x14')](express[_0x22c1('0x17')](_0x5c9626[_0x22c1('0x9')](_0x22c1('0xd'))));_0x5c9626[_0x22c1('0xc')](_0x22c1('0x18'),config[_0x22c1('0xe')]+_0x22c1('0x19'));_0x5c9626[_0x22c1('0x1a')](_0x22c1('0x1b'),require(_0x22c1('0x1c'))[_0x22c1('0x1d')]);_0x5c9626[_0x22c1('0xc')]('view\x20engine',_0x22c1('0x1b'));_0x5c9626[_0x22c1('0x14')](bodyParser[_0x22c1('0x1e')]({'limit':_0x22c1('0x1f'),'extended':!![]}));_0x5c9626['use'](bodyParser[_0x22c1('0x20')]({'limit':_0x22c1('0x1f')}));_0x5c9626[_0x22c1('0x14')](cors());_0x5c9626[_0x22c1('0x14')](methodOverride());_0x5c9626[_0x22c1('0x14')](cookieParser());_0x5c9626[_0x22c1('0x14')](passport[_0x22c1('0x21')]());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index 323a704..7cd5f0d 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 _0x7b95=['map','model','join','createHash','md5','update','digest','hex','getUuid','platform','licenseToken','test','dmidecode\x20--string\x20system-uuid','replace','hostname','substring','lodash','bimedia-machine-uuid','child_process','execSync','../environment','networkInterfaces','orderBy','keys','filter','family','IPv4','internal','head','mac','address','getFirstInterface','cpus'];(function(_0x134c2e,_0x3573c4){var _0x2825db=function(_0x2a574d){while(--_0x2a574d){_0x134c2e['push'](_0x134c2e['shift']());}};_0x2825db(++_0x3573c4);}(_0x7b95,0x17b));var _0x57b9=function(_0x6d5606,_0x3af225){_0x6d5606=_0x6d5606-0x0;var _0x404033=_0x7b95[_0x6d5606];return _0x404033;};'use strict';var _=require(_0x57b9('0x0'));var os=require('os');var crypto=require('crypto');var machine=require(_0x57b9('0x1'));var exec=require(_0x57b9('0x2'))[_0x57b9('0x3')];var config=require(_0x57b9('0x4'));function getInterfaces(){var _0x85abaa=[];var _0x47b78d=os[_0x57b9('0x5')]();var _0x11752e=_[_0x57b9('0x6')](_[_0x57b9('0x7')](_0x47b78d));for(var _0x5cecce=0x0;_0x5cecce<_0x11752e['length'];_0x5cecce++){var _0xe9d3bc=_0x47b78d[_0x11752e[_0x5cecce]][_0x57b9('0x8')](function(_0x3ee39d){return _0x3ee39d[_0x57b9('0x9')]===_0x57b9('0xa')&&_0x3ee39d[_0x57b9('0xb')]===![];});_0x85abaa=_0x85abaa['concat'](_0xe9d3bc);}return _0x85abaa;}function getFirstInterface(){var _0x259f0a=_[_0x57b9('0xc')](getInterfaces());return{'macAddress':_0x259f0a&&_0x259f0a[_0x57b9('0xd')]?_0x259f0a['mac']:'00:00:00:00:00:00','ipAddress':_0x259f0a&&_0x259f0a[_0x57b9('0xe')]?_0x259f0a['address']:'127.0.0.1'};}exports[_0x57b9('0xf')]=getFirstInterface;function getCPUhash(){var _0x22d173=_[_0x57b9('0x6')](os[_0x57b9('0x10')]()[_0x57b9('0x11')](function(_0xae1020){return _0xae1020[_0x57b9('0x12')];}))[_0x57b9('0x13')](':');return crypto[_0x57b9('0x14')](_0x57b9('0x15'))[_0x57b9('0x16')](_0x22d173)[_0x57b9('0x17')](_0x57b9('0x18'));}exports[_0x57b9('0x19')]=function(){var _0xf37ae5=os[_0x57b9('0x1a')]();var _0x5e62cd=/[0-9a-f-]{36}/;if(config[_0x57b9('0x1b')]&&_0x5e62cd[_0x57b9('0x1c')](config[_0x57b9('0x1b')])){return config[_0x57b9('0x1b')];}else if(_0xf37ae5==='win32'){return exec(_0x57b9('0x1d'),{'encoding':'utf8'})[_0x57b9('0x1e')]('\x0d\x0a','');}else{var _0x556b15=getFirstInterface();var _0x2e6116=getCPUhash();var _0x142af6=_0x2e6116+'|'+os[_0x57b9('0x1f')]()+'|'+_0x556b15['macAddress']+'|'+_0x556b15['ipAddress'];var _0x29ce3b=crypto['createHash'](_0x57b9('0x15'))[_0x57b9('0x16')](_0x142af6)[_0x57b9('0x17')]('hex');return _0x29ce3b[_0x57b9('0x20')](0x0,0x8)+'-'+_0x29ce3b['substring'](0x8,0xc)+'-'+_0x29ce3b[_0x57b9('0x20')](0xc,0x10)+'-'+_0x29ce3b[_0x57b9('0x20')](0x10,0x14)+'-'+_0x29ce3b[_0x57b9('0x20')](0x14);}}; \ No newline at end of file +var _0xc2c1=['00:00:00:00:00:00','address','model','join','createHash','md5','update','hex','getUuid','platform','licenseToken','test','win32','utf8','replace','hostname','ipAddress','substring','lodash','crypto','bimedia-machine-uuid','execSync','../environment','networkInterfaces','filter','internal','concat','mac'];(function(_0x5447fd,_0x52a6b5){var _0x15b28a=function(_0x370d4f){while(--_0x370d4f){_0x5447fd['push'](_0x5447fd['shift']());}};_0x15b28a(++_0x52a6b5);}(_0xc2c1,0x12a));var _0x1c2c=function(_0x431443,_0x4f2c8d){_0x431443=_0x431443-0x0;var _0x2aeac0=_0xc2c1[_0x431443];return _0x2aeac0;};'use strict';var _=require(_0x1c2c('0x0'));var os=require('os');var crypto=require(_0x1c2c('0x1'));var machine=require(_0x1c2c('0x2'));var exec=require('child_process')[_0x1c2c('0x3')];var config=require(_0x1c2c('0x4'));function getInterfaces(){var _0x3e758b=[];var _0x3cfb05=os[_0x1c2c('0x5')]();var _0x3462e2=_['orderBy'](_['keys'](_0x3cfb05));for(var _0x55b803=0x0;_0x55b803<_0x3462e2['length'];_0x55b803++){var _0x91a330=_0x3cfb05[_0x3462e2[_0x55b803]][_0x1c2c('0x6')](function(_0x3370b9){return _0x3370b9['family']==='IPv4'&&_0x3370b9[_0x1c2c('0x7')]===![];});_0x3e758b=_0x3e758b[_0x1c2c('0x8')](_0x91a330);}return _0x3e758b;}function getFirstInterface(){var _0x501119=_['head'](getInterfaces());return{'macAddress':_0x501119&&_0x501119['mac']?_0x501119[_0x1c2c('0x9')]:_0x1c2c('0xa'),'ipAddress':_0x501119&&_0x501119['address']?_0x501119[_0x1c2c('0xb')]:'127.0.0.1'};}exports['getFirstInterface']=getFirstInterface;function getCPUhash(){var _0x366916=_['orderBy'](os['cpus']()['map'](function(_0x2c5985){return _0x2c5985[_0x1c2c('0xc')];}))[_0x1c2c('0xd')](':');return crypto[_0x1c2c('0xe')](_0x1c2c('0xf'))[_0x1c2c('0x10')](_0x366916)['digest'](_0x1c2c('0x11'));}exports[_0x1c2c('0x12')]=function(){var _0x4209af=os[_0x1c2c('0x13')]();var _0x3a7658=/[0-9a-f-]{36}/;if(config[_0x1c2c('0x14')]&&_0x3a7658[_0x1c2c('0x15')](config['licenseToken'])){return config[_0x1c2c('0x14')];}else if(_0x4209af===_0x1c2c('0x16')){return exec('dmidecode\x20--string\x20system-uuid',{'encoding':_0x1c2c('0x17')})[_0x1c2c('0x18')]('\x0d\x0a','');}else{var _0x334c6e=getFirstInterface();var _0x2434e7=getCPUhash();var _0x4878d8=_0x2434e7+'|'+os[_0x1c2c('0x19')]()+'|'+_0x334c6e['macAddress']+'|'+_0x334c6e[_0x1c2c('0x1a')];var _0x180418=crypto[_0x1c2c('0xe')](_0x1c2c('0xf'))[_0x1c2c('0x10')](_0x4878d8)['digest'](_0x1c2c('0x11'));return _0x180418[_0x1c2c('0x1b')](0x0,0x8)+'-'+_0x180418[_0x1c2c('0x1b')](0x8,0xc)+'-'+_0x180418[_0x1c2c('0x1b')](0xc,0x10)+'-'+_0x180418[_0x1c2c('0x1b')](0x10,0x14)+'-'+_0x180418[_0x1c2c('0x1b')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index 96aa8f1..886c334 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 _0x171b=['data1','active','license','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','Disabled','info','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','days','error','message','finally','getUuid','License','findOrCreate','SERVICE\x20LICENSE\x20STARTED\x20%s','default','moment','request-promise','bluebird','pkginfo','version','../../mysqldb','../../components/encryptor','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','then','catch','get','data2'];(function(_0x58139b,_0x4951eb){var _0x66a023=function(_0x1f5067){while(--_0x1f5067){_0x58139b['push'](_0x58139b['shift']());}};_0x66a023(++_0x4951eb);}(_0x171b,0xe0));var _0xb171=function(_0x1aadd8,_0x43bf5d){_0x1aadd8=_0x1aadd8-0x0;var _0x508ec8=_0x171b[_0x1aadd8];return _0x508ec8;};'use strict';var util=require('util');var moment=require(_0xb171('0x0'));var rp=require(_0xb171('0x1'));var BPromise=require(_0xb171('0x2'));var pkginfo=require(_0xb171('0x3'))(module,_0xb171('0x4'));var db=require(_0xb171('0x5'))['db'];var encryptor=require(_0xb171('0x6'));var hardware=require('./hardware');var logger=require('../logger')('license');var HOST=_0xb171('0x7');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x1ab90f){return new BPromise(function(_0x35cfe1,_0x2b18c6){var _0x16ece5=util[_0xb171('0x8')](_0xb171('0x9'),HOST,_0x1ab90f,module[_0xb171('0xa')]['version']);if(oldToken){_0x16ece5=util[_0xb171('0x8')](_0xb171('0xb'),HOST,_0x1ab90f,module[_0xb171('0xa')][_0xb171('0x4')],oldToken);}var _0x927e3d={'uri':_0x16ece5,'method':'GET','timeout':0xea60,'json':!![]};return rp(_0x927e3d)[_0xb171('0xc')](function(_0x821f7b){_0x35cfe1(_0x821f7b);})[_0xb171('0xd')](function(_0x41e3ec){_0x2b18c6(_0x41e3ec);});});}function manageLicense(_0x3b8ce9,_0x50b810){var _0xb919af=_0x50b810[_0xb171('0xe')]({'plain':!![]});if(!isOldTokenSent&&_0xb919af['data1']!==_0x3b8ce9&&!_0xb919af[_0xb171('0xf')]){oldToken=_0xb919af[_0xb171('0x10')];}httpRequest(_0x3b8ce9)[_0xb171('0xc')](function(_0x5434d9){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x5434d9[_0xb171('0x11')]){isOldTokenSent=![];if(!_0xb919af['license']&&_0xb919af[_0xb171('0x12')]!=_0x5434d9[_0xb171('0x12')]||_0xb919af[_0xb171('0x12')]&&_0xb919af[_0xb171('0xf')]){logger['info']('THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED');}if(_0xb919af[_0xb171('0x12')]&&!_0xb919af[_0xb171('0xf')]&&_0xb919af[_0xb171('0x12')]!=_0x5434d9[_0xb171('0x12')]){logger['info'](_0xb171('0x13'));}if(_0xb919af[_0xb171('0x12')]&&!_0xb919af[_0xb171('0xf')]&&_0xb919af[_0xb171('0x12')]==_0x5434d9[_0xb171('0x12')]){return _0x50b810;}return _0x50b810[_0xb171('0x14')]({'data1':_0x3b8ce9,'data2':null,'license':_0x5434d9['license']});}else{if(_0x5434d9[_0xb171('0x12')]||_0xb919af['license']){if(!_0xb919af['data2']){if(_0xb919af[_0xb171('0x10')]==_0x3b8ce9){GRAY_PERIOD_REASON=_0xb171('0x15');logger[_0xb171('0x16')](_0xb171('0x17'));}else{GRAY_PERIOD_REASON=_0xb171('0x18');logger[_0xb171('0x16')](_0xb171('0x19'),_0xb919af[_0xb171('0x10')],_0x3b8ce9);}logger['info'](_0xb171('0x1a'),GRAY_PERIOD_REASON[_0xb171('0x1b')](),moment()[_0xb171('0x8')](_0xb171('0x1c')));return _0x50b810['update']({'data2':encryptor[_0xb171('0x1d')](moment()['format'](_0xb171('0x1c')))});}else{if(moment()[_0xb171('0x1e')](encryptor['decryptString'](_0xb919af[_0xb171('0xf')]),_0xb171('0x1f'))>DAYS){logger['info']('DEMO\x20START\x20AT\x20%s',moment()['format'](_0xb171('0x1c')));isOldTokenSent=![];return _0x50b810[_0xb171('0x14')]({'data1':_0x3b8ce9,'data2':null,'license':null});}}}else{if(_0xb919af[_0xb171('0x10')]!=_0x3b8ce9){logger[_0xb171('0x16')](_0xb171('0x19'),_0xb919af[_0xb171('0x10')],_0x3b8ce9);return _0x50b810[_0xb171('0x14')]({'data1':_0x3b8ce9,'data2':null,'license':null});}}}return _0x50b810;})[_0xb171('0xc')](function(_0x8a6ac6){_0x50b810=_0x8a6ac6;})[_0xb171('0xd')](function(_0x3b4815){logger[_0xb171('0x20')](_0x3b4815[_0xb171('0x21')]);})[_0xb171('0x22')](function(){setTimeout(function(){manageLicense(hardware['getUuid'](),_0x50b810);},TIME);});}function defaultLicense(){var _0x210bd2=hardware[_0xb171('0x23')]();if(_0x210bd2){return db[_0xb171('0x24')][_0xb171('0x25')]({'where':{'id':0x1},'defaults':{'data1':_0x210bd2}})['spread'](function(_0x31d4e4,_0x5b9bdb){logger[_0xb171('0x16')](_0xb171('0x26'),_0x210bd2);manageLicense(_0x210bd2,_0x31d4e4);})[_0xb171('0xd')](function(_0x82a213){logger[_0xb171('0x20')](_0x82a213[_0xb171('0x21')]);});}}exports[_0xb171('0x27')]=defaultLicense; \ No newline at end of file +var _0x2be1=['%s/api/servers/%s/check?version=%s','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','then','data1','data2','active','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','info','update','Disabled','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','encryptString','diff','days','DEMO\x20START\x20AT\x20%s','catch','error','message','getUuid','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','util','moment','request-promise','bluebird','version','../../mysqldb','../../components/encryptor','../logger','license','https://www.xcallymotion.com','format'];(function(_0x570d64,_0x393b25){var _0x28f2da=function(_0x4a3259){while(--_0x4a3259){_0x570d64['push'](_0x570d64['shift']());}};_0x28f2da(++_0x393b25);}(_0x2be1,0x17b));var _0x12be=function(_0x45313f,_0x46caf4){_0x45313f=_0x45313f-0x0;var _0x402910=_0x2be1[_0x45313f];return _0x402910;};'use strict';var util=require(_0x12be('0x0'));var moment=require(_0x12be('0x1'));var rp=require(_0x12be('0x2'));var BPromise=require(_0x12be('0x3'));var pkginfo=require('pkginfo')(module,_0x12be('0x4'));var db=require(_0x12be('0x5'))['db'];var encryptor=require(_0x12be('0x6'));var hardware=require('./hardware');var logger=require(_0x12be('0x7'))(_0x12be('0x8'));var HOST=_0x12be('0x9');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x3015fd){return new BPromise(function(_0x3537b5,_0x4c3567){var _0x20f533=util[_0x12be('0xa')](_0x12be('0xb'),HOST,_0x3015fd,module[_0x12be('0xc')][_0x12be('0x4')]);if(oldToken){_0x20f533=util[_0x12be('0xa')](_0x12be('0xd'),HOST,_0x3015fd,module['exports'][_0x12be('0x4')],oldToken);}var _0x4c9baa={'uri':_0x20f533,'method':_0x12be('0xe'),'timeout':0xea60,'json':!![]};return rp(_0x4c9baa)[_0x12be('0xf')](function(_0x251669){_0x3537b5(_0x251669);})['catch'](function(_0x5c2648){_0x4c3567(_0x5c2648);});});}function manageLicense(_0x5a8baf,_0x5ca378){var _0x46d381=_0x5ca378['get']({'plain':!![]});if(!isOldTokenSent&&_0x46d381[_0x12be('0x10')]!==_0x5a8baf&&!_0x46d381[_0x12be('0x11')]){oldToken=_0x46d381[_0x12be('0x10')];}httpRequest(_0x5a8baf)[_0x12be('0xf')](function(_0x54ad25){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x54ad25[_0x12be('0x12')]){isOldTokenSent=![];if(!_0x46d381[_0x12be('0x8')]&&_0x46d381[_0x12be('0x8')]!=_0x54ad25[_0x12be('0x8')]||_0x46d381[_0x12be('0x8')]&&_0x46d381[_0x12be('0x11')]){logger['info'](_0x12be('0x13'));}if(_0x46d381[_0x12be('0x8')]&&!_0x46d381[_0x12be('0x11')]&&_0x46d381[_0x12be('0x8')]!=_0x54ad25[_0x12be('0x8')]){logger[_0x12be('0x14')]('THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED');}if(_0x46d381[_0x12be('0x8')]&&!_0x46d381[_0x12be('0x11')]&&_0x46d381[_0x12be('0x8')]==_0x54ad25['license']){return _0x5ca378;}return _0x5ca378[_0x12be('0x15')]({'data1':_0x5a8baf,'data2':null,'license':_0x54ad25[_0x12be('0x8')]});}else{if(_0x54ad25[_0x12be('0x8')]||_0x46d381['license']){if(!_0x46d381[_0x12be('0x11')]){if(_0x46d381[_0x12be('0x10')]==_0x5a8baf){GRAY_PERIOD_REASON=_0x12be('0x16');logger[_0x12be('0x14')]('THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED');}else{GRAY_PERIOD_REASON=_0x12be('0x17');logger['info'](_0x12be('0x18'),_0x46d381['data1'],_0x5a8baf);}logger[_0x12be('0x14')](_0x12be('0x19'),GRAY_PERIOD_REASON[_0x12be('0x1a')](),moment()['format'](_0x12be('0x1b')));return _0x5ca378['update']({'data2':encryptor[_0x12be('0x1c')](moment()[_0x12be('0xa')](_0x12be('0x1b')))});}else{if(moment()[_0x12be('0x1d')](encryptor['decryptString'](_0x46d381[_0x12be('0x11')]),_0x12be('0x1e'))>DAYS){logger['info'](_0x12be('0x1f'),moment()[_0x12be('0xa')](_0x12be('0x1b')));isOldTokenSent=![];return _0x5ca378[_0x12be('0x15')]({'data1':_0x5a8baf,'data2':null,'license':null});}}}else{if(_0x46d381[_0x12be('0x10')]!=_0x5a8baf){logger[_0x12be('0x14')](_0x12be('0x18'),_0x46d381['data1'],_0x5a8baf);return _0x5ca378[_0x12be('0x15')]({'data1':_0x5a8baf,'data2':null,'license':null});}}}return _0x5ca378;})[_0x12be('0xf')](function(_0x252be2){_0x5ca378=_0x252be2;})[_0x12be('0x20')](function(_0x320cd){logger[_0x12be('0x21')](_0x320cd[_0x12be('0x22')]);})['finally'](function(){setTimeout(function(){manageLicense(hardware['getUuid'](),_0x5ca378);},TIME);});}function defaultLicense(){var _0x5dfd53=hardware[_0x12be('0x23')]();if(_0x5dfd53){return db['License'][_0x12be('0x24')]({'where':{'id':0x1},'defaults':{'data1':_0x5dfd53}})[_0x12be('0x25')](function(_0x557662,_0x1d2889){logger[_0x12be('0x14')](_0x12be('0x26'),_0x5dfd53);manageLicense(_0x5dfd53,_0x557662);})[_0x12be('0x20')](function(_0x48634d){logger[_0x12be('0x21')](_0x48634d[_0x12be('0x22')]);});}}exports['default']=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index 277e6ef..f92ace7 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 _0x06f2=['forEach','pick','countBy','admin','telephone','License\x20limit\x20reached\x20for\x20users','exports','util','lodash','bluebird','./hardware','../../components/encryptor','../../mysqldb','Demo\x20license','getUuid','2027-01-01T00:00:00.000Z','find','defaults','then','catch','data1','license','isEmpty','License\x20key\x20value\x20not\x20found','data2','split','decryptString','format','%s:%s:%s','demo','uuid','machineUuid','deadline','add','days','grayReason','changed','message','User','role','COUNT','sequelize','count','user','telephones'];(function(_0x38ed82,_0x5cb8d7){var _0xf0b711=function(_0x56ac5d){while(--_0x56ac5d){_0x38ed82['push'](_0x38ed82['shift']());}};_0xf0b711(++_0x5cb8d7);}(_0x06f2,0x16f));var _0x206f=function(_0x244661,_0x2cc7da){_0x244661=_0x244661-0x0;var _0x3cb681=_0x06f2[_0x244661];return _0x3cb681;};'use strict';var util=require(_0x206f('0x0'));var _=require(_0x206f('0x1'));var moment=require('moment');var BPromise=require(_0x206f('0x2'));var hardware=require(_0x206f('0x3'));var encryptor=require(_0x206f('0x4'));var db=require(_0x206f('0x5'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':'2027-01-01T00:00:00.000Z','chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x206f('0x6'),'machineUuid':hardware[_0x206f('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x206f('0x8'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':'Breaking\x20license','machineUuid':hardware[_0x206f('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x3521f3){return new BPromise(function(_0x7d76a8,_0x1f3cb7){return db['License'][_0x206f('0x9')](_[_0x206f('0xa')](_0x3521f3,{'raw':!![],'where':{'id':0x1}}))['then'](function(_0x3fdce0){return checkLicense(_0x3fdce0,null);})[_0x206f('0xb')](function(_0x5a0fe3){_0x7d76a8(_0x5a0fe3);return;})[_0x206f('0xc')](function(_0x4bb7d9){_0x1f3cb7(_0x4bb7d9);});});}function checkLicense(_0x2b45d8,_0x6e63a4){if(!_0x2b45d8){demoLicense['uuid']=_0x2b45d8[_0x206f('0xd')];return demoLicense;}try{var _0x746297=_0x6e63a4||_0x2b45d8[_0x206f('0xe')];if(_[_0x206f('0xf')](_0x746297)){throw new Error(_0x206f('0x10'));}var _0x110b6e=_0x2b45d8[_0x206f('0xd')];var _0xe6fb19=_0x2b45d8[_0x206f('0x11')];var _0xc7d7cd=_0x110b6e[_0x206f('0x12')]('-')[0x4];var _0x4d16c1=_0x110b6e['split']('-')[0x0];var _0x3e4011=encryptor[_0x206f('0x13')](_0x746297,util[_0x206f('0x14')](_0x206f('0x15'),_0xc7d7cd,_0x110b6e,_0x4d16c1));var _0x1e6f92=JSON['parse'](_0x3e4011);_0x1e6f92[_0x206f('0x16')]=![];_0x1e6f92[_0x206f('0x17')]=_0x110b6e;_0x1e6f92[_0x206f('0x18')]=hardware['getUuid']();if(_0xe6fb19){var _0xe7e0ae=encryptor[_0x206f('0x13')](_0xe6fb19);_0x1e6f92['gray']=_0xe7e0ae;_0x1e6f92[_0x206f('0x19')]=moment(_0xe7e0ae)[_0x206f('0x1a')](0x7,_0x206f('0x1b'))[_0x206f('0x14')]();_0x1e6f92[_0x206f('0x1c')]=_0x1e6f92[_0x206f('0x17')]!=_0x1e6f92[_0x206f('0x18')]?_0x206f('0x1d'):'disabled';}return _0x1e6f92;}catch(_0x360413){breakingLicense[_0x206f('0x17')]=_0x2b45d8['data1'];breakingLicense[_0x206f('0x1e')]=_0x360413[_0x206f('0x1e')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x23139e,_0x4b072e){getLicense()[_0x206f('0xb')](function(_0xc96191){return db[_0x206f('0x1f')]['findAll']({'attributes':[_0x206f('0x20'),[db['sequelize']['fn'](_0x206f('0x21'),db[_0x206f('0x22')]['col'](_0x206f('0x20'))),_0x206f('0x23')]],'group':'role','where':{'role':{'$or':['admin',_0x206f('0x24'),'telephone']}},'raw':!![]})['then'](function(_0x561178){var _0x4ad510={'user':_0xc96191['users']||0x0,'telephone':_0xc96191[_0x206f('0x25')]||0x0};_0x561178[_0x206f('0x26')](function(_0x1c83f5){var _0x4e3fcf=_0x1c83f5[_0x206f('0x20')]==='admin'?_0x206f('0x24'):_0x1c83f5[_0x206f('0x20')];_0x4ad510[_0x4e3fcf]-=_0x1c83f5[_0x206f('0x23')];if(_0x4ad510[_0x4e3fcf]<0x0)_0x4ad510[_0x4e3fcf]=0x0;});_0x23139e(_0x4ad510);return;});})[_0x206f('0xc')](function(_0x1bc7b8){_0x4b072e(_0x1bc7b8);});});}function checkUserLimits(_0x4b9297){return new BPromise(function(_0x9c66e6,_0x4c8578){getLimits()[_0x206f('0xb')](function(_0x18698e){var _0x5d2974=_[_0x206f('0x27')](_[_0x206f('0x28')](_0x4b9297,_0x206f('0x20')),[_0x206f('0x29'),_0x206f('0x24'),_0x206f('0x2a')]);var _0x45d211=(_0x5d2974['admin']||0x0)+(_0x5d2974[_0x206f('0x24')]||0x0);var _0x2a7cab=_0x5d2974[_0x206f('0x2a')]||0x0;if(_0x45d211>_0x18698e[_0x206f('0x24')])return _0x4c8578(_0x206f('0x2b'));if(_0x2a7cab>_0x18698e['telephone'])return _0x4c8578('License\x20limit\x20reached\x20for\x20telephones');return _0x9c66e6();})[_0x206f('0xc')](function(_0x230c3a){_0x4c8578(_0x230c3a);});});}module[_0x206f('0x2c')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0xdd97=['../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','Breaking\x20license','License','find','defaults','catch','uuid','license','isEmpty','License\x20key\x20value\x20not\x20found','data1','data2','split','decryptString','format','%s:%s:%s','demo','machineUuid','gray','deadline','add','days','grayReason','changed','disabled','message','User','findAll','role','sequelize','COUNT','count','admin','user','telephone','then','users','forEach','countBy','License\x20limit\x20reached\x20for\x20users','exports','util','lodash','moment','bluebird','./hardware'];(function(_0x5f4148,_0x91dcc3){var _0x4f6100=function(_0xaeada2){while(--_0xaeada2){_0x5f4148['push'](_0x5f4148['shift']());}};_0x4f6100(++_0x91dcc3);}(_0xdd97,0x1bd));var _0x7dd9=function(_0x19dd7a,_0x51de21){_0x19dd7a=_0x19dd7a-0x0;var _0x3feb6a=_0xdd97[_0x19dd7a];return _0x3feb6a;};'use strict';var util=require(_0x7dd9('0x0'));var _=require(_0x7dd9('0x1'));var moment=require(_0x7dd9('0x2'));var BPromise=require(_0x7dd9('0x3'));var hardware=require(_0x7dd9('0x4'));var encryptor=require(_0x7dd9('0x5'));var db=require(_0x7dd9('0x6'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x7dd9('0x7'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x7dd9('0x8'),'machineUuid':hardware[_0x7dd9('0x9')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x7dd9('0x7'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x7dd9('0xa'),'machineUuid':hardware[_0x7dd9('0x9')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x433879){return new BPromise(function(_0x3ea43c,_0x4d0ae3){return db[_0x7dd9('0xb')][_0x7dd9('0xc')](_[_0x7dd9('0xd')](_0x433879,{'raw':!![],'where':{'id':0x1}}))['then'](function(_0x32a77d){return checkLicense(_0x32a77d,null);})['then'](function(_0x1824c0){_0x3ea43c(_0x1824c0);return;})[_0x7dd9('0xe')](function(_0x1a220c){_0x4d0ae3(_0x1a220c);});});}function checkLicense(_0x1cac65,_0x3beaa2){if(!_0x1cac65){demoLicense[_0x7dd9('0xf')]=_0x1cac65['data1'];return demoLicense;}try{var _0x4c1586=_0x3beaa2||_0x1cac65[_0x7dd9('0x10')];if(_[_0x7dd9('0x11')](_0x4c1586)){throw new Error(_0x7dd9('0x12'));}var _0x2cea05=_0x1cac65[_0x7dd9('0x13')];var _0x234a82=_0x1cac65[_0x7dd9('0x14')];var _0x3d8cdd=_0x2cea05[_0x7dd9('0x15')]('-')[0x4];var _0x50d59e=_0x2cea05['split']('-')[0x0];var _0x2e1c30=encryptor[_0x7dd9('0x16')](_0x4c1586,util[_0x7dd9('0x17')](_0x7dd9('0x18'),_0x3d8cdd,_0x2cea05,_0x50d59e));var _0xae1dc2=JSON['parse'](_0x2e1c30);_0xae1dc2[_0x7dd9('0x19')]=![];_0xae1dc2[_0x7dd9('0xf')]=_0x2cea05;_0xae1dc2[_0x7dd9('0x1a')]=hardware[_0x7dd9('0x9')]();if(_0x234a82){var _0x337045=encryptor[_0x7dd9('0x16')](_0x234a82);_0xae1dc2[_0x7dd9('0x1b')]=_0x337045;_0xae1dc2[_0x7dd9('0x1c')]=moment(_0x337045)[_0x7dd9('0x1d')](0x7,_0x7dd9('0x1e'))[_0x7dd9('0x17')]();_0xae1dc2[_0x7dd9('0x1f')]=_0xae1dc2['uuid']!=_0xae1dc2[_0x7dd9('0x1a')]?_0x7dd9('0x20'):_0x7dd9('0x21');}return _0xae1dc2;}catch(_0x1820a1){breakingLicense[_0x7dd9('0xf')]=_0x1cac65[_0x7dd9('0x13')];breakingLicense[_0x7dd9('0x22')]=_0x1820a1['message'];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x472a15,_0x44931f){getLicense()['then'](function(_0x22d397){return db[_0x7dd9('0x23')][_0x7dd9('0x24')]({'attributes':[_0x7dd9('0x25'),[db[_0x7dd9('0x26')]['fn'](_0x7dd9('0x27'),db[_0x7dd9('0x26')]['col'](_0x7dd9('0x25'))),_0x7dd9('0x28')]],'group':_0x7dd9('0x25'),'where':{'role':{'$or':[_0x7dd9('0x29'),_0x7dd9('0x2a'),_0x7dd9('0x2b')]}},'raw':!![]})[_0x7dd9('0x2c')](function(_0x12719b){var _0x3a628b={'user':_0x22d397[_0x7dd9('0x2d')]||0x0,'telephone':_0x22d397['telephones']||0x0};_0x12719b[_0x7dd9('0x2e')](function(_0x55f644){var _0x43472d=_0x55f644[_0x7dd9('0x25')]===_0x7dd9('0x29')?_0x7dd9('0x2a'):_0x55f644[_0x7dd9('0x25')];_0x3a628b[_0x43472d]-=_0x55f644[_0x7dd9('0x28')];if(_0x3a628b[_0x43472d]<0x0)_0x3a628b[_0x43472d]=0x0;});_0x472a15(_0x3a628b);return;});})[_0x7dd9('0xe')](function(_0x85a268){_0x44931f(_0x85a268);});});}function checkUserLimits(_0x52b4ab){return new BPromise(function(_0x4ee615,_0x3aa18b){getLimits()[_0x7dd9('0x2c')](function(_0x27a48b){var _0x2b14d4=_['pick'](_[_0x7dd9('0x2f')](_0x52b4ab,_0x7dd9('0x25')),['admin','user','telephone']);var _0x164d50=(_0x2b14d4[_0x7dd9('0x29')]||0x0)+(_0x2b14d4[_0x7dd9('0x2a')]||0x0);var _0x53cb47=_0x2b14d4[_0x7dd9('0x2b')]||0x0;if(_0x164d50>_0x27a48b[_0x7dd9('0x2a')])return _0x3aa18b(_0x7dd9('0x30'));if(_0x53cb47>_0x27a48b[_0x7dd9('0x2b')])return _0x3aa18b('License\x20limit\x20reached\x20for\x20telephones');return _0x4ee615();})[_0x7dd9('0xe')](function(_0x423b24){_0x3aa18b(_0x423b24);});});}module[_0x7dd9('0x31')]={'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 2272061..1e25ef3 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 _0x5c3c=['myappanuglar-secret','app-id','exports','http://localhost:9000'];(function(_0x4551f6,_0x48151b){var _0x581dc2=function(_0x1842af){while(--_0x1842af){_0x4551f6['push'](_0x4551f6['shift']());}};_0x581dc2(++_0x48151b);}(_0x5c3c,0x132));var _0xc5c3=function(_0x278e3c,_0x1c9cfd){_0x278e3c=_0x278e3c-0x0;var _0x3e2d9b=_0x5c3c[_0x278e3c];return _0x3e2d9b;};'use strict';module[_0xc5c3('0x0')]={'DOMAIN':_0xc5c3('0x1'),'SESSION_SECRET':_0xc5c3('0x2'),'GOOGLE_ID':_0xc5c3('0x3'),'GOOGLE_SECRET':'secret','DEBUG':''}; \ No newline at end of file +var _0x4888=['http://localhost:9000','myappanuglar-secret','app-id','secret'];(function(_0x31b90f,_0x35ef73){var _0x15653b=function(_0x3b992f){while(--_0x3b992f){_0x31b90f['push'](_0x31b90f['shift']());}};_0x15653b(++_0x35ef73);}(_0x4888,0x198));var _0x8488=function(_0x146ef3,_0x1c7bb0){_0x146ef3=_0x146ef3-0x0;var _0x5d9bae=_0x4888[_0x146ef3];return _0x5d9bae;};'use strict';module['exports']={'DOMAIN':_0x8488('0x0'),'SESSION_SECRET':_0x8488('0x1'),'GOOGLE_ID':_0x8488('0x2'),'GOOGLE_SECRET':_0x8488('0x3'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index fe9818e..afe8f1a 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0e5d=['log','xcally','format','message','{{{','}}}','replace','YYYY-MM-DD\x20HH:mm:ss','toUpperCase','exports','Logger','transports','File','%s-%s','error','info','Console','env','debugLevel','moment','winston','util','INFO','join'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x0e5d,0xeb));var _0xd0e5=function(_0x550613,_0x57ef6d){_0x550613=_0x550613-0x0;var _0x53cc30=_0x0e5d[_0x550613];return _0x53cc30;};'use strict';var moment=require(_0xd0e5('0x0'));var winston=require(_0xd0e5('0x1'));var util=require(_0xd0e5('0x2'));var path=require('path');var debugLevel=_0xd0e5('0x3');function filename(_0x1491d8,_0x57a419){return path[_0xd0e5('0x4')]('/var',_0xd0e5('0x5'),_0xd0e5('0x6'),util[_0xd0e5('0x7')]('%s-%s.log',_0x1491d8,_0x57a419));}function formatter(_0x4802bc,_0x175d0e){_0x175d0e['message']=_0x175d0e[_0xd0e5('0x8')]['replace'](/@@{/g,_0xd0e5('0x9'))['replace'](/}@@/g,_0xd0e5('0xa'))[_0xd0e5('0xb')](/@{/g,'{{')[_0xd0e5('0xb')](/}@/g,'}}');return util[_0xd0e5('0x7')]('[%s]\x20[%s]\x20%s\x20-\x20%s',moment()[_0xd0e5('0x7')](_0xd0e5('0xc')),_0x175d0e['level'][_0xd0e5('0xd')](),_0x4802bc,_0x175d0e[_0xd0e5('0x8')]);}module[_0xd0e5('0xe')]=function(_0x517083){return new winston[(_0xd0e5('0xf'))]({'transports':[new winston[(_0xd0e5('0x10'))][(_0xd0e5('0x11'))]({'name':util['format'](_0xd0e5('0x12'),_0x517083,'error'),'filename':filename(_0x517083,'error'),'level':_0xd0e5('0x13'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x1ebaad){return formatter(_0x517083,_0x1ebaad);}}),new winston[(_0xd0e5('0x10'))][(_0xd0e5('0x11'))]({'name':util[_0xd0e5('0x7')](_0xd0e5('0x12'),_0x517083,_0xd0e5('0x14')),'filename':filename(_0x517083,_0xd0e5('0x14')),'level':_0xd0e5('0x14'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x407b50){return formatter(_0x517083,_0x407b50);}}),new winston[(_0xd0e5('0x10'))][(_0xd0e5('0x15'))]({'level':process[_0xd0e5('0x16')][_0xd0e5('0x17')]||debugLevel,'json':![],'formatter':function(_0x58d2b5){return formatter(_0x517083,_0x58d2b5);}})]});}; \ No newline at end of file +var _0x73d7=['transports','info','debugLevel','winston','path','INFO','join','xcally','%s-%s.log','message','replace','}}}','format','[%s]\x20[%s]\x20%s\x20-\x20%s','level','File','%s-%s','error'];(function(_0x5301c4,_0x478ef9){var _0x36bdce=function(_0xdd0f89){while(--_0xdd0f89){_0x5301c4['push'](_0x5301c4['shift']());}};_0x36bdce(++_0x478ef9);}(_0x73d7,0x135));var _0x773d=function(_0x54f7ba,_0xe41988){_0x54f7ba=_0x54f7ba-0x0;var _0x267349=_0x73d7[_0x54f7ba];return _0x267349;};'use strict';var moment=require('moment');var winston=require(_0x773d('0x0'));var util=require('util');var path=require(_0x773d('0x1'));var debugLevel=_0x773d('0x2');function filename(_0x12be39,_0x499fd8){return path[_0x773d('0x3')]('/var','log',_0x773d('0x4'),util['format'](_0x773d('0x5'),_0x12be39,_0x499fd8));}function formatter(_0x404abf,_0x5e2ac3){_0x5e2ac3[_0x773d('0x6')]=_0x5e2ac3['message'][_0x773d('0x7')](/@@{/g,'{{{')['replace'](/}@@/g,_0x773d('0x8'))[_0x773d('0x7')](/@{/g,'{{')[_0x773d('0x7')](/}@/g,'}}');return util[_0x773d('0x9')](_0x773d('0xa'),moment()[_0x773d('0x9')]('YYYY-MM-DD\x20HH:mm:ss'),_0x5e2ac3[_0x773d('0xb')]['toUpperCase'](),_0x404abf,_0x5e2ac3['message']);}module['exports']=function(_0x5087a3){return new winston['Logger']({'transports':[new winston['transports'][(_0x773d('0xc'))]({'name':util[_0x773d('0x9')](_0x773d('0xd'),_0x5087a3,_0x773d('0xe')),'filename':filename(_0x5087a3,_0x773d('0xe')),'level':_0x773d('0xe'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x270cd0){return formatter(_0x5087a3,_0x270cd0);}}),new winston[(_0x773d('0xf'))][(_0x773d('0xc'))]({'name':util[_0x773d('0x9')](_0x773d('0xd'),_0x5087a3,_0x773d('0x10')),'filename':filename(_0x5087a3,_0x773d('0x10')),'level':_0x773d('0x10'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x1a9c94){return formatter(_0x5087a3,_0x1a9c94);}}),new winston['transports']['Console']({'level':process['env'][_0x773d('0x11')]||debugLevel,'json':![],'formatter':function(_0x5494d3){return formatter(_0x5087a3,_0x5494d3);}})]});}; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index 3d018fc..b716757 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 _0xd0fa=['join','../../services/express/index.js','../../services/ami/index.js','agi','../../services/agi/index.js','email','../../services/email/index.js','../../services/routing/index.js','xdr','../../services/xdr/index.js','exports','path'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0xd0fa,0xb3));var _0xad0f=function(_0x2064e5,_0x4f6fa2){_0x2064e5=_0x2064e5-0x0;var _0x21a233=_0xd0fa[_0x2064e5];return _0x21a233;};'use strict';var path=require(_0xad0f('0x0'));var os=require('os');var config={'apps':[{'name':'express','script':path[_0xad0f('0x1')](__dirname,_0xad0f('0x2'))},{'name':'ami','script':path[_0xad0f('0x1')](__dirname,_0xad0f('0x3'))},{'name':_0xad0f('0x4'),'script':path['join'](__dirname,_0xad0f('0x5'))},{'name':_0xad0f('0x6'),'script':path[_0xad0f('0x1')](__dirname,_0xad0f('0x7'))},{'name':'routing','script':path[_0xad0f('0x1')](__dirname,_0xad0f('0x8'))},{'name':_0xad0f('0x9'),'script':path[_0xad0f('0x1')](__dirname,_0xad0f('0xa'))}]};module[_0xad0f('0xb')]=config; \ No newline at end of file +var _0x652a=['express','join','../../services/express/index.js','ami','../../services/ami/index.js','agi','email','../../services/email/index.js','routing','../../services/routing/index.js','exports','path'];(function(_0x151530,_0x3803a9){var _0x550882=function(_0x257835){while(--_0x257835){_0x151530['push'](_0x151530['shift']());}};_0x550882(++_0x3803a9);}(_0x652a,0x1a3));var _0xa652=function(_0x52fe1f,_0x3bfcad){_0x52fe1f=_0x52fe1f-0x0;var _0x2f466a=_0x652a[_0x52fe1f];return _0x2f466a;};'use strict';var path=require(_0xa652('0x0'));var os=require('os');var config={'apps':[{'name':_0xa652('0x1'),'script':path[_0xa652('0x2')](__dirname,_0xa652('0x3'))},{'name':_0xa652('0x4'),'script':path[_0xa652('0x2')](__dirname,_0xa652('0x5'))},{'name':_0xa652('0x6'),'script':path[_0xa652('0x2')](__dirname,'../../services/agi/index.js')},{'name':_0xa652('0x7'),'script':path[_0xa652('0x2')](__dirname,_0xa652('0x8'))},{'name':_0xa652('0x9'),'script':path[_0xa652('0x2')](__dirname,_0xa652('0xa'))},{'name':'xdr','script':path[_0xa652('0x2')](__dirname,'../../services/xdr/index.js')}]};module[_0xa652('0xb')]=config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index ca98773..b7771e6 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 _0x3713=['./config','connect','connected','start','then','stop','restart','disconnect','list','describe','delete','dump','saved','pm2','bluebird'];(function(_0x4397ff,_0x170b84){var _0x405328=function(_0x3d8e15){while(--_0x3d8e15){_0x4397ff['push'](_0x4397ff['shift']());}};_0x405328(++_0x170b84);}(_0x3713,0x175));var _0x3371=function(_0xf6de8e,_0x4f44d2){_0xf6de8e=_0xf6de8e-0x0;var _0x33cd2a=_0x3713[_0xf6de8e];return _0x33cd2a;};'use strict';var pm2=require(_0x3371('0x0'));var BPromise=require(_0x3371('0x1'));var config=require(_0x3371('0x2'));function connect(){return new BPromise(function(_0x3ce7f0,_0x54c362){return pm2[_0x3371('0x3')](function(_0x44713e){if(_0x44713e){return _0x54c362(_0x44713e);}return _0x3ce7f0(_0x3371('0x4'));});});};exports[_0x3371('0x5')]=function(_0x14d4cf){return connect()[_0x3371('0x6')](function(){return new BPromise(function(_0x1c3786,_0x24dd2e){return pm2[_0x3371('0x5')](_0x14d4cf,function(_0x5a0c21,_0x460cfe){if(_0x5a0c21){return _0x24dd2e(_0x5a0c21);}pm2['disconnect']();return _0x1c3786(_0x460cfe);});});});};exports[_0x3371('0x7')]=function(_0x14528c){return connect()['then'](function(){return new BPromise(function(_0x5a26ca,_0x2b2c82){return pm2[_0x3371('0x7')](_0x14528c,function(_0x5e2f56,_0x13b1cb){if(_0x5e2f56){return _0x2b2c82(_0x5e2f56);}pm2['disconnect']();return _0x5a26ca(_0x13b1cb);});});});};exports[_0x3371('0x8')]=function(_0x163597){return connect()['then'](function(){return new BPromise(function(_0x4e574f,_0x3ae235){return pm2[_0x3371('0x8')](_0x163597,function(_0x2d274a,_0xc9e820){if(_0x2d274a){return _0x3ae235(_0x2d274a);}pm2[_0x3371('0x9')]();return _0x4e574f(_0xc9e820);});});});};exports[_0x3371('0xa')]=function(){return connect()['then'](function(){return new BPromise(function(_0x18ba4c,_0x4de04c){return pm2[_0x3371('0xa')](function(_0x2c8115,_0x1ec568){if(_0x2c8115){return _0x4de04c(_0x2c8115);}pm2[_0x3371('0x9')]();return _0x18ba4c(_0x1ec568);});});});};exports[_0x3371('0xb')]=function(_0x4d9a0d){return connect()['then'](function(){return new BPromise(function(_0x4a9dab,_0x48202d){return pm2['describe'](_0x4d9a0d,function(_0x2ef420,_0x34049a){if(_0x2ef420){return _0x48202d(_0x2ef420);}pm2[_0x3371('0x9')]();return _0x4a9dab(_0x34049a);});});});};exports[_0x3371('0xc')]=function(_0x10cf14){return connect()[_0x3371('0x6')](function(){return new BPromise(function(_0x202ad6,_0x4b22f0){return pm2[_0x3371('0xc')](_0x10cf14,function(_0xe7536a,_0x3d0c48){if(_0xe7536a){return _0x4b22f0(_0xe7536a);}pm2[_0x3371('0x9')]();return _0x202ad6(_0x3d0c48);});});});};exports[_0x3371('0xd')]=function(){return connect()[_0x3371('0x6')](function(){return new BPromise(function(_0x32688c,_0xa1138b){return pm2[_0x3371('0xd')](function(_0x3306f1){if(_0x3306f1){return _0xa1138b(_0x3306f1);}return _0x32688c(_0x3371('0xe'));});});});}; \ No newline at end of file +var _0x5fcd=['dump','pm2','./config','connected','start','stop','disconnect','restart','then','list','describe','delete'];(function(_0x93d1e9,_0x2b7bf8){var _0x349a94=function(_0x453a04){while(--_0x453a04){_0x93d1e9['push'](_0x93d1e9['shift']());}};_0x349a94(++_0x2b7bf8);}(_0x5fcd,0x79));var _0xd5fc=function(_0x511421,_0x220fc3){_0x511421=_0x511421-0x0;var _0x1c6dbf=_0x5fcd[_0x511421];return _0x1c6dbf;};'use strict';var pm2=require(_0xd5fc('0x0'));var BPromise=require('bluebird');var config=require(_0xd5fc('0x1'));function connect(){return new BPromise(function(_0x11e55f,_0x4493c9){return pm2['connect'](function(_0x2f0625){if(_0x2f0625){return _0x4493c9(_0x2f0625);}return _0x11e55f(_0xd5fc('0x2'));});});};exports['start']=function(_0x5ab0cc){return connect()['then'](function(){return new BPromise(function(_0x5b9890,_0x2df3c7){return pm2[_0xd5fc('0x3')](_0x5ab0cc,function(_0x23d984,_0x28b79f){if(_0x23d984){return _0x2df3c7(_0x23d984);}pm2['disconnect']();return _0x5b9890(_0x28b79f);});});});};exports[_0xd5fc('0x4')]=function(_0x4efa06){return connect()['then'](function(){return new BPromise(function(_0x11cf6a,_0x222a0b){return pm2[_0xd5fc('0x4')](_0x4efa06,function(_0x1d90be,_0x24c55a){if(_0x1d90be){return _0x222a0b(_0x1d90be);}pm2[_0xd5fc('0x5')]();return _0x11cf6a(_0x24c55a);});});});};exports[_0xd5fc('0x6')]=function(_0x2bfd37){return connect()[_0xd5fc('0x7')](function(){return new BPromise(function(_0x53c634,_0x152918){return pm2[_0xd5fc('0x6')](_0x2bfd37,function(_0x28cbf0,_0x521bcf){if(_0x28cbf0){return _0x152918(_0x28cbf0);}pm2[_0xd5fc('0x5')]();return _0x53c634(_0x521bcf);});});});};exports[_0xd5fc('0x8')]=function(){return connect()['then'](function(){return new BPromise(function(_0x52f485,_0xe2258){return pm2[_0xd5fc('0x8')](function(_0x58d60e,_0x46a77a){if(_0x58d60e){return _0xe2258(_0x58d60e);}pm2['disconnect']();return _0x52f485(_0x46a77a);});});});};exports['describe']=function(_0x1c9b10){return connect()['then'](function(){return new BPromise(function(_0x405454,_0x3cb105){return pm2[_0xd5fc('0x9')](_0x1c9b10,function(_0x1e1fa,_0x3176f2){if(_0x1e1fa){return _0x3cb105(_0x1e1fa);}pm2[_0xd5fc('0x5')]();return _0x405454(_0x3176f2);});});});};exports[_0xd5fc('0xa')]=function(_0x1516c8){return connect()[_0xd5fc('0x7')](function(){return new BPromise(function(_0x7ad0e6,_0x138fb7){return pm2[_0xd5fc('0xa')](_0x1516c8,function(_0x38bc21,_0x3dc2f7){if(_0x38bc21){return _0x138fb7(_0x38bc21);}pm2[_0xd5fc('0x5')]();return _0x7ad0e6(_0x3dc2f7);});});});};exports[_0xd5fc('0xb')]=function(){return connect()['then'](function(){return new BPromise(function(_0x1b9d6f,_0x6c8124){return pm2[_0xd5fc('0xb')](function(_0x310081){if(_0x310081){return _0x6c8124(_0x310081);}return _0x1b9d6f('saved');});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index 14c0449..246ed03 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 _0x600e=['subtract','length','info','update','system','timeout','YYYY-MM-DD\x20HH:mm:ss','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','join','emit','catch','error','inspect','start','lodash','ioredis','../../config/environment','../logger','schedule','redis','localhost','Setting','find','chatTimeout','then','ChatInteraction','findAll','lastMsgAt'];(function(_0x1a12c8,_0x39edad){var _0x173e0f=function(_0x3dbab9){while(--_0x3dbab9){_0x1a12c8['push'](_0x1a12c8['shift']());}};_0x173e0f(++_0x39edad);}(_0x600e,0x196));var _0xe600=function(_0x427fb6,_0x1d77e1){_0x427fb6=_0x427fb6-0x0;var _0x8294f7=_0x600e[_0x427fb6];return _0x8294f7;};'use strict';var _=require(_0xe600('0x0'));var moment=require('moment');var Redis=require(_0xe600('0x1'));var util=require('util');var config=require(_0xe600('0x2'));var db=require('../../mysqldb')['db'];var logger=require(_0xe600('0x3'))(_0xe600('0x4'));config[_0xe600('0x5')]=_['defaults'](config['redis'],{'host':_0xe600('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xe600('0x5')]));function closeInteractions(){var _0x51a8c5=0x0;var _0x1fc559=[];return db[_0xe600('0x7')][_0xe600('0x8')]({'raw':!![],'attributes':['id',_0xe600('0x9')],'where':{'id':0x1}})[_0xe600('0xa')](function(_0x15f564){_0x51a8c5=_0x15f564['chatTimeout'];if(_0x51a8c5){return db[_0xe600('0xb')][_0xe600('0xc')]({'raw':!![],'attributes':['id',_0xe600('0xd')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0xe600('0xe')](_0x15f564[_0xe600('0x9')],'minutes')}}});}else{return[];}})[_0xe600('0xa')](function(_0x65dbc){if(_0x65dbc&&_0x65dbc[_0xe600('0xf')]){_0x1fc559=_['map'](_0x65dbc||[],'id');logger[_0xe600('0x10')]('[CHAT]\x20Interactions\x20to\x20close:',_0x1fc559['join']());return db[_0xe600('0xb')][_0xe600('0x11')]({'closeReason':_0xe600('0x12'),'disposition':_0xe600('0x13'),'closed':!![],'closedAt':moment()['format'](_0xe600('0x14'))},{'where':{'id':_0x1fc559}});}})[_0xe600('0xa')](function(){if(_0x1fc559&&_0x1fc559['length']){logger['info'](_0xe600('0x15'),_0x1fc559[_0xe600('0x16')]());for(var _0xee2dfb=0x0;_0xee2dfb<_0x1fc559[_0xe600('0xf')];_0xee2dfb++){io[_0xe600('0x17')]('chatInteraction:update',{'id':_0x1fc559[_0xee2dfb],'closed':!![]});}}})[_0xe600('0x18')](function(_0x33b92b){logger[_0xe600('0x19')]('[CHAT]\x20Error\x20closing\x20interactions',_0x33b92b?util[_0xe600('0x1a')](_0x33b92b,{'showHidden':![],'depth':null}):'');});}exports[_0xe600('0x1b')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xc436=['minutes','length','map','info','[CHAT]\x20Interactions\x20to\x20close:','join','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','chatInteraction:update','error','start','moment','ioredis','util','schedule','redis','localhost','socket.io-emitter','Setting','find','chatTimeout','then','ChatInteraction','findAll','lastMsgAt','subtract'];(function(_0x230c07,_0x274d2d){var _0x1939e8=function(_0x255c26){while(--_0x255c26){_0x230c07['push'](_0x230c07['shift']());}};_0x1939e8(++_0x274d2d);}(_0xc436,0xf6));var _0x6c43=function(_0x4c60fc,_0x35a259){_0x4c60fc=_0x4c60fc-0x0;var _0x221a30=_0xc436[_0x4c60fc];return _0x221a30;};'use strict';var _=require('lodash');var moment=require(_0x6c43('0x0'));var Redis=require(_0x6c43('0x1'));var util=require(_0x6c43('0x2'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var logger=require('../logger')(_0x6c43('0x3'));config[_0x6c43('0x4')]=_['defaults'](config[_0x6c43('0x4')],{'host':_0x6c43('0x5'),'port':0x18eb});var io=require(_0x6c43('0x6'))(new Redis(config[_0x6c43('0x4')]));function closeInteractions(){var _0x5ec814=0x0;var _0x195ea3=[];return db[_0x6c43('0x7')][_0x6c43('0x8')]({'raw':!![],'attributes':['id',_0x6c43('0x9')],'where':{'id':0x1}})[_0x6c43('0xa')](function(_0x287f30){_0x5ec814=_0x287f30['chatTimeout'];if(_0x5ec814){return db[_0x6c43('0xb')][_0x6c43('0xc')]({'raw':!![],'attributes':['id',_0x6c43('0xd')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x6c43('0xe')](_0x287f30[_0x6c43('0x9')],_0x6c43('0xf'))}}});}else{return[];}})[_0x6c43('0xa')](function(_0x2b3afe){if(_0x2b3afe&&_0x2b3afe[_0x6c43('0x10')]){_0x195ea3=_[_0x6c43('0x11')](_0x2b3afe||[],'id');logger[_0x6c43('0x12')](_0x6c43('0x13'),_0x195ea3[_0x6c43('0x14')]());return db[_0x6c43('0xb')][_0x6c43('0x15')]({'closeReason':_0x6c43('0x16'),'disposition':_0x6c43('0x17'),'closed':!![],'closedAt':moment()[_0x6c43('0x18')](_0x6c43('0x19'))},{'where':{'id':_0x195ea3}});}})[_0x6c43('0xa')](function(){if(_0x195ea3&&_0x195ea3['length']){logger[_0x6c43('0x12')]('[CHAT]\x20Sending\x20updates\x20for\x20interactions:',_0x195ea3['join']());for(var _0x3af75b=0x0;_0x3af75b<_0x195ea3[_0x6c43('0x10')];_0x3af75b++){io['emit'](_0x6c43('0x1a'),{'id':_0x195ea3[_0x3af75b],'closed':!![]});}}})['catch'](function(_0x59cec8){logger[_0x6c43('0x1b')]('[CHAT]\x20Error\x20closing\x20interactions',_0x59cec8?util['inspect'](_0x59cec8,{'showHidden':![],'depth':null}):'');});}exports[_0x6c43('0x1c')]=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 10e8fdc..f354379 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 _0x310d=['Sent','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','email\x20sent','catch','error','error\x20mail','data','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','then','CustomReportId','exec\x20custom\x20report\x20id:%s','no\x20report\x20id','Schedule','findAll','MailServerOut','keys','jobs','toString','keyBy','difference','intersection','length','exists','stop','deleteJob','delete\x20cron','toRun','run\x20job','cron','active','isBetween','startAt','endAt','add','start','add\x20cron','update','run','lodash','moment','cron-job-manager','jayson/promise','bluebird','schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','client','http','info','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','service','Smtp','host','port','secure','authentication','auth','pass','\x22%s\x22\x20<%s>','name','user','bcc','format','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','subtractUnit','join','../../files/reports','savename','basename','zip','status','attachments','message','text','stringify','existsSync'];(function(_0x3acf29,_0x20a64c){var _0x902775=function(_0x23a13d){while(--_0x23a13d){_0x3acf29['push'](_0x3acf29['shift']());}};_0x902775(++_0x20a64c);}(_0x310d,0x137));var _0xd310=function(_0x46483e,_0x356aa2){_0x46483e=_0x46483e-0x0;var _0xecbed5=_0x310d[_0x46483e];return _0xecbed5;};'use strict';var fs=require('fs');var util=require('util');var path=require('path');var _=require(_0xd310('0x0'));var moment=require(_0xd310('0x1'));var CronJobManager=require(_0xd310('0x2'));var jayson=require(_0xd310('0x3'));var BPromise=require(_0xd310('0x4'));var logger=require('../logger')(_0xd310('0x5'));var db=require(_0xd310('0x6'))['db'];var analyticCustomReportController=require(_0xd310('0x7'));var analyticDefaultReportController=require('../../api/analyticDefaultReport/analyticDefaultReport.controller');var client=jayson[_0xd310('0x8')][_0xd310('0x9')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x46736b,_0x3a62d7){return function(){logger[_0xd310('0xa')](_0xd310('0xb'),_0x46736b[_0xd310('0xc')]);var _0x27b9c8=!![];var _0x862a2={'tls':{'rejectUnauthorized':![]}};if(_0x46736b[_0xd310('0xd')]['Smtp']['service']){_0x862a2[_0xd310('0xe')]=_0x46736b[_0xd310('0xd')][_0xd310('0xf')][_0xd310('0xe')];}else{_0x862a2[_0xd310('0x10')]=_0x46736b['MailAccount'][_0xd310('0xf')][_0xd310('0x10')];_0x862a2[_0xd310('0x11')]=_0x46736b[_0xd310('0xd')][_0xd310('0xf')][_0xd310('0x11')];_0x862a2[_0xd310('0x12')]=_0x46736b[_0xd310('0xd')][_0xd310('0xf')][_0xd310('0x12')];}if(_0x46736b[_0xd310('0xd')][_0xd310('0xf')][_0xd310('0x13')]){_0x862a2[_0xd310('0x14')]={'user':_0x46736b['MailAccount'][_0xd310('0xf')]['user'],'pass':_0x46736b[_0xd310('0xd')][_0xd310('0xf')][_0xd310('0x15')]};}var _0x35ee25={'account':_0x862a2,'message':{'from':util['format'](_0xd310('0x16'),_0x46736b[_0xd310('0xd')][_0xd310('0x17')],_0x46736b[_0xd310('0xd')][_0xd310('0xc')]||_0x46736b['MailAccount'][_0xd310('0xf')][_0xd310('0x18')]),'to':_0x46736b[_0xd310('0xc')],'cc':_0x46736b['cc'],'bcc':_0x46736b[_0xd310('0x19')],'subject':util[_0xd310('0x1a')](_0xd310('0x1b'),_0x3a62d7[_0xd310('0x17')],_0x46736b[_0xd310('0x1c')],_0x46736b[_0xd310('0x1d')])}};var _0x5df235=path[_0xd310('0x1e')](__dirname,_0xd310('0x1f'));var _0x221b01=_0x3a62d7[_0xd310('0x20')];var _0x416bb0=util[_0xd310('0x1a')]('%s.%s',path[_0xd310('0x21')](_0x3a62d7['savename'],path['extname'](_0x3a62d7[_0xd310('0x20')])),_0xd310('0x22'));var _0x1e14f3=path['join'](_0x5df235,_0x221b01);var _0x22eb17=path['join'](_0x5df235,_0x416bb0);if(fs['existsSync'](_0x1e14f3)){_0x3a62d7[_0xd310('0x23')]='Sent';_0x35ee25['message'][_0xd310('0x24')]=[{'filename':_0x221b01,'path':_0x1e14f3}];_0x35ee25[_0xd310('0x25')][_0xd310('0x26')]=util[_0xd310('0x1a')]('Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a',JSON[_0xd310('0x27')](_0x3a62d7,null,0x2));}else if(fs[_0xd310('0x28')](_0x22eb17)){_0x3a62d7[_0xd310('0x23')]=_0xd310('0x29');_0x35ee25['message'][_0xd310('0x24')]=[{'filename':_0x416bb0,'path':_0x22eb17}];}else{_0x35ee25[_0xd310('0x25')][_0xd310('0x26')]=_0xd310('0x2a');if(!_0x46736b[_0xd310('0x2b')]){_0x27b9c8=![];logger['info']('empty\x20file,\x20email\x20not\x20sent');}}if(_0x27b9c8){return client['request']('SendMail',_0x35ee25)['then'](function(_0x13f964){if(_0x13f964['error']){return logger['error']('error\x20mail',JSON['stringify'](_0x13f964));}return logger[_0xd310('0xa')](_0xd310('0x2c'));})[_0xd310('0x2d')](function(_0x38d7a1){return logger[_0xd310('0x2e')](_0xd310('0x2f'),JSON[_0xd310('0x27')](_0x38d7a1));});}};}function handleError(){return function(_0x45b164){return logger[_0xd310('0x2e')](JSON[_0xd310('0x27')](_0x45b164));};}function handleResult(_0x4fffd0){return function(_0x17cf7b){logger[_0xd310('0xa')](_0xd310('0x30'),JSON[_0xd310('0x27')](_0x17cf7b));if(_0x4fffd0[_0xd310('0xd')]&&_0x4fffd0[_0xd310('0xd')][_0xd310('0xf')]&&!_[_0xd310('0x31')](_0x4fffd0[_0xd310('0xc')])){setTimeout(handleSendEmail(_0x4fffd0,_0x17cf7b),0x3c*0x3e8);}};}function handleJob(_0x33520d){return function(){try{if(_['isNil'](_0x33520d['subtractNumber'])){return logger['info'](_0xd310('0x32'));}if(_[_0xd310('0x31')](_0x33520d[_0xd310('0x1d')])){return logger[_0xd310('0xa')](_0xd310('0x33'));}var _0x37ab1d={'startDate':moment()[_0xd310('0x34')](_0x33520d[_0xd310('0x1c')],_0x33520d['subtractUnit'])[_0xd310('0x1a')]('YYYY-MM-DD\x20HH:mm:ss'),'endDate':moment()[_0xd310('0x1a')](_0xd310('0x35')),'type':_0xd310('0x36'),'output':_0x33520d['output'],'name':_0x33520d[_0xd310('0x17')]};if(!_[_0xd310('0x31')](_0x33520d[_0xd310('0x37')])){logger[_0xd310('0xa')](_0xd310('0x38'),_0x33520d[_0xd310('0x37')]);return analyticDefaultReportController[_0xd310('0x39')]({'id':_0x33520d['DefaultReportId']},_0x37ab1d)[_0xd310('0x3a')](handleResult(_0x33520d))[_0xd310('0x2d')](handleError());}if(!_[_0xd310('0x31')](_0x33520d[_0xd310('0x3b')])){logger[_0xd310('0xa')](_0xd310('0x3c'),_0x33520d[_0xd310('0x3b')]);return analyticCustomReportController[_0xd310('0x39')]({'id':_0x33520d['CustomReportId']},_0x37ab1d)[_0xd310('0x3a')](handleResult(_0x33520d))[_0xd310('0x2d')](handleError());}}catch(_0x4ad36f){logger[_0xd310('0x2e')](JSON['stringify'](_0x4ad36f));}return logger[_0xd310('0xa')](_0xd310('0x3d'));};}function getJobs(_0x4b107f){var _0x122da1={};if(_0x4b107f){_0x122da1['id']=_0x4b107f;}return db[_0xd310('0x3e')][_0xd310('0x3f')]({'where':_0x122da1,'include':[{'model':db[_0xd310('0xd')],'attributes':['id',_0xd310('0x17'),_0xd310('0xc')],'include':[{'model':db[_0xd310('0x40')],'as':_0xd310('0xf')}]}]})[_0xd310('0x3a')](function(_0x173c8a){var _0x81c794=_[_0xd310('0x41')](manager[_0xd310('0x42')]);var _0x1853a7=_['map'](_0x173c8a,function(_0x20a337){return _0x20a337['id'][_0xd310('0x43')]();});var _0x2619af=_[_0xd310('0x44')](_0x173c8a,function(_0x488dbb){return _0x488dbb['id'][_0xd310('0x43')]();});var _0x220e50=_0x4b107f?_0x1853a7:_[_0xd310('0x45')](_0x1853a7,_0x81c794);var _0x14a986=_[_0xd310('0x46')](_0x1853a7,_0x81c794);var _0x4d73be=_[_0xd310('0x45')](_0x81c794,_0x1853a7);var _0xb48d55;var _0x3a4e57;for(_0xb48d55=0x0;_0xb48d55<_0x4d73be[_0xd310('0x47')]&&!_0x4b107f;_0xb48d55+=0x1){_0x3a4e57=_0x4d73be[_0xb48d55][_0xd310('0x43')]();if(manager[_0xd310('0x48')](_0x3a4e57)){manager[_0xd310('0x49')](_0x3a4e57);manager[_0xd310('0x4a')](_0x3a4e57);logger['info'](_0xd310('0x4b'),_0x3a4e57);}}logger['info'](_0xd310('0x4c'),JSON['stringify'](_0x220e50));for(_0xb48d55=0x0;_0xb48d55<_0x220e50[_0xd310('0x47')];_0xb48d55+=0x1){_0x3a4e57=_0x220e50[_0xb48d55][_0xd310('0x43')]();logger['info']('index',_0x3a4e57);if(_0x4b107f){logger[_0xd310('0xa')]('my\x20id',_0x4b107f);logger[_0xd310('0xa')](JSON[_0xd310('0x27')](_0x2619af[_0x3a4e57]));BPromise['resolve']()[_0xd310('0x3a')](handleJob(_0x2619af[_0x3a4e57]));logger[_0xd310('0xa')](_0xd310('0x4d'),_0x2619af[_0x3a4e57]['name'],_0x2619af[_0x3a4e57][_0xd310('0x4e')]);}else if(_0x2619af[_0x3a4e57]['cron']&&_0x2619af[_0x3a4e57][_0xd310('0x4f')]&&moment()[_0xd310('0x50')](_0x2619af[_0x3a4e57][_0xd310('0x51')],_0x2619af[_0x3a4e57][_0xd310('0x52')])){manager[_0xd310('0x53')](_0x3a4e57,_0x2619af[_0x3a4e57][_0xd310('0x4e')],handleJob(_0x2619af[_0x3a4e57]));manager[_0xd310('0x54')](_0x3a4e57);logger['info'](_0xd310('0x55'),_0x2619af[_0x3a4e57][_0xd310('0x17')],_0x2619af[_0x3a4e57][_0xd310('0x4e')]);}else if(manager[_0xd310('0x48')](_0x3a4e57)){manager['stop'](_0x3a4e57);manager['deleteJob'](_0x3a4e57);logger[_0xd310('0xa')]('stop\x20cron',_0x2619af[_0x3a4e57][_0xd310('0x17')],_0x2619af[_0x3a4e57][_0xd310('0x4e')]);}}for(_0xb48d55=0x0,_0x3a4e57;_0xb48d55<_0x14a986[_0xd310('0x47')]&&!_0x4b107f;_0xb48d55+=0x1){_0x3a4e57=_0x14a986[_0xb48d55][_0xd310('0x43')]();if(manager[_0xd310('0x48')](_0x3a4e57)){if(_0x2619af[_0x3a4e57]['cron']&&_0x2619af[_0x3a4e57][_0xd310('0x4f')]&&moment()['isBetween'](_0x2619af[_0x3a4e57][_0xd310('0x51')],_0x2619af[_0x3a4e57]['endAt'])){manager[_0xd310('0x56')](_0x3a4e57,_0x2619af[_0x3a4e57]['cron'],handleJob(_0x2619af[_0x3a4e57]));logger[_0xd310('0xa')]('update\x20cron',_0x2619af[_0x3a4e57]['name'],_0x2619af[_0x3a4e57][_0xd310('0x4e')]);}else{manager[_0xd310('0x49')](_0x3a4e57);manager[_0xd310('0x4a')](_0x3a4e57);logger['info']('stop\x20cron',_0x2619af[_0x3a4e57][_0xd310('0x17')],_0x2619af[_0x3a4e57][_0xd310('0x4e')]);}}}})[_0xd310('0x2d')](function(_0x3bf0da){logger[_0xd310('0x2e')](JSON[_0xd310('0x27')](_0x3bf0da));});}exports[_0xd310('0x57')]=function(_0x508f11){return getJobs(_0x508f11);};exports[_0xd310('0x54')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0x6f3d=['exec\x20custom\x20report\x20id:%s','no\x20report\x20id','findAll','keys','map','difference','intersection','toString','exists','deleteJob','toRun','my\x20id','resolve','run\x20job','cron','active','isBetween','startAt','endAt','start','add\x20cron','stop','length','update\x20cron','stop\x20cron','run','path','cron-job-manager','jayson/promise','bluebird','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','http','Try\x20to\x20send\x20a\x20mail\x20to','email','Smtp','service','MailAccount','host','port','secure','authentication','auth','user','pass','\x22%s\x22\x20<%s>','name','bcc','format','subtractNumber','subtractUnit','join','../../files/reports','savename','%s.%s','basename','extname','existsSync','Sent','message','attachments','text','stringify','status','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','request','SendMail','then','error','error\x20mail','info','email\x20sent','catch','data','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','runReport','CustomReportId'];(function(_0x2d61b2,_0x142947){var _0x12df89=function(_0x31c717){while(--_0x31c717){_0x2d61b2['push'](_0x2d61b2['shift']());}};_0x12df89(++_0x142947);}(_0x6f3d,0x119));var _0xd6f3=function(_0x4394b6,_0x12357f){_0x4394b6=_0x4394b6-0x0;var _0x360244=_0x6f3d[_0x4394b6];return _0x360244;};'use strict';var fs=require('fs');var util=require('util');var path=require(_0xd6f3('0x0'));var _=require('lodash');var moment=require('moment');var CronJobManager=require(_0xd6f3('0x1'));var jayson=require(_0xd6f3('0x2'));var BPromise=require(_0xd6f3('0x3'));var logger=require('../logger')('schedule');var db=require(_0xd6f3('0x4'))['db'];var analyticCustomReportController=require(_0xd6f3('0x5'));var analyticDefaultReportController=require(_0xd6f3('0x6'));var client=jayson['client'][_0xd6f3('0x7')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x1d1089,_0x5789c6){return function(){logger['info'](_0xd6f3('0x8'),_0x1d1089[_0xd6f3('0x9')]);var _0x1f5421=!![];var _0x15fb15={'tls':{'rejectUnauthorized':![]}};if(_0x1d1089['MailAccount'][_0xd6f3('0xa')]['service']){_0x15fb15[_0xd6f3('0xb')]=_0x1d1089[_0xd6f3('0xc')]['Smtp'][_0xd6f3('0xb')];}else{_0x15fb15[_0xd6f3('0xd')]=_0x1d1089['MailAccount'][_0xd6f3('0xa')][_0xd6f3('0xd')];_0x15fb15[_0xd6f3('0xe')]=_0x1d1089['MailAccount']['Smtp']['port'];_0x15fb15[_0xd6f3('0xf')]=_0x1d1089['MailAccount']['Smtp'][_0xd6f3('0xf')];}if(_0x1d1089[_0xd6f3('0xc')][_0xd6f3('0xa')][_0xd6f3('0x10')]){_0x15fb15[_0xd6f3('0x11')]={'user':_0x1d1089['MailAccount'][_0xd6f3('0xa')][_0xd6f3('0x12')],'pass':_0x1d1089[_0xd6f3('0xc')][_0xd6f3('0xa')][_0xd6f3('0x13')]};}var _0x42bddf={'account':_0x15fb15,'message':{'from':util['format'](_0xd6f3('0x14'),_0x1d1089[_0xd6f3('0xc')][_0xd6f3('0x15')],_0x1d1089['MailAccount'][_0xd6f3('0x9')]||_0x1d1089[_0xd6f3('0xc')][_0xd6f3('0xa')][_0xd6f3('0x12')]),'to':_0x1d1089[_0xd6f3('0x9')],'cc':_0x1d1089['cc'],'bcc':_0x1d1089[_0xd6f3('0x16')],'subject':util[_0xd6f3('0x17')]('Report\x20%s\x20last\x20%s\x20%s',_0x5789c6[_0xd6f3('0x15')],_0x1d1089[_0xd6f3('0x18')],_0x1d1089[_0xd6f3('0x19')])}};var _0xf4f1d7=path[_0xd6f3('0x1a')](__dirname,_0xd6f3('0x1b'));var _0x6b4b5a=_0x5789c6[_0xd6f3('0x1c')];var _0x907b70=util[_0xd6f3('0x17')](_0xd6f3('0x1d'),path[_0xd6f3('0x1e')](_0x5789c6[_0xd6f3('0x1c')],path[_0xd6f3('0x1f')](_0x5789c6[_0xd6f3('0x1c')])),'zip');var _0x16c924=path[_0xd6f3('0x1a')](_0xf4f1d7,_0x6b4b5a);var _0x53f1aa=path['join'](_0xf4f1d7,_0x907b70);if(fs[_0xd6f3('0x20')](_0x16c924)){_0x5789c6['status']=_0xd6f3('0x21');_0x42bddf[_0xd6f3('0x22')][_0xd6f3('0x23')]=[{'filename':_0x6b4b5a,'path':_0x16c924}];_0x42bddf['message'][_0xd6f3('0x24')]=util['format']('Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a',JSON[_0xd6f3('0x25')](_0x5789c6,null,0x2));}else if(fs['existsSync'](_0x53f1aa)){_0x5789c6[_0xd6f3('0x26')]=_0xd6f3('0x21');_0x42bddf[_0xd6f3('0x22')][_0xd6f3('0x23')]=[{'filename':_0x907b70,'path':_0x53f1aa}];}else{_0x42bddf[_0xd6f3('0x22')][_0xd6f3('0x24')]=_0xd6f3('0x27');if(!_0x1d1089['sendIfEmpty']){_0x1f5421=![];logger['info']('empty\x20file,\x20email\x20not\x20sent');}}if(_0x1f5421){return client[_0xd6f3('0x28')](_0xd6f3('0x29'),_0x42bddf)[_0xd6f3('0x2a')](function(_0x4855d8){if(_0x4855d8[_0xd6f3('0x2b')]){return logger[_0xd6f3('0x2b')](_0xd6f3('0x2c'),JSON[_0xd6f3('0x25')](_0x4855d8));}return logger[_0xd6f3('0x2d')](_0xd6f3('0x2e'));})[_0xd6f3('0x2f')](function(_0x24c4d2){return logger[_0xd6f3('0x2b')](_0xd6f3('0x2c'),JSON['stringify'](_0x24c4d2));});}};}function handleError(){return function(_0x1f3967){return logger[_0xd6f3('0x2b')](JSON[_0xd6f3('0x25')](_0x1f3967));};}function handleResult(_0x1c6d17){return function(_0x51ba59){logger[_0xd6f3('0x2d')](_0xd6f3('0x30'),JSON['stringify'](_0x51ba59));if(_0x1c6d17[_0xd6f3('0xc')]&&_0x1c6d17['MailAccount'][_0xd6f3('0xa')]&&!_[_0xd6f3('0x31')](_0x1c6d17[_0xd6f3('0x9')])){setTimeout(handleSendEmail(_0x1c6d17,_0x51ba59),0x3c*0x3e8);}};}function handleJob(_0x4be6a8){return function(){try{if(_[_0xd6f3('0x31')](_0x4be6a8[_0xd6f3('0x18')])){return logger[_0xd6f3('0x2d')](_0xd6f3('0x32'));}if(_[_0xd6f3('0x31')](_0x4be6a8[_0xd6f3('0x19')])){return logger[_0xd6f3('0x2d')](_0xd6f3('0x33'));}var _0x4ca2e0={'startDate':moment()[_0xd6f3('0x34')](_0x4be6a8[_0xd6f3('0x18')],_0x4be6a8[_0xd6f3('0x19')])[_0xd6f3('0x17')](_0xd6f3('0x35')),'endDate':moment()['format'](_0xd6f3('0x35')),'type':_0xd6f3('0x36'),'output':_0x4be6a8[_0xd6f3('0x37')],'name':_0x4be6a8[_0xd6f3('0x15')]};if(!_[_0xd6f3('0x31')](_0x4be6a8[_0xd6f3('0x38')])){logger['info']('exec\x20defaul\x20report\x20id:%s',_0x4be6a8['DefaultReportId']);return analyticDefaultReportController[_0xd6f3('0x39')]({'id':_0x4be6a8[_0xd6f3('0x38')]},_0x4ca2e0)[_0xd6f3('0x2a')](handleResult(_0x4be6a8))[_0xd6f3('0x2f')](handleError());}if(!_['isNil'](_0x4be6a8[_0xd6f3('0x3a')])){logger[_0xd6f3('0x2d')](_0xd6f3('0x3b'),_0x4be6a8[_0xd6f3('0x3a')]);return analyticCustomReportController[_0xd6f3('0x39')]({'id':_0x4be6a8['CustomReportId']},_0x4ca2e0)[_0xd6f3('0x2a')](handleResult(_0x4be6a8))[_0xd6f3('0x2f')](handleError());}}catch(_0x3eb534){logger[_0xd6f3('0x2b')](JSON[_0xd6f3('0x25')](_0x3eb534));}return logger[_0xd6f3('0x2d')](_0xd6f3('0x3c'));};}function getJobs(_0x21ed75){var _0x110329={};if(_0x21ed75){_0x110329['id']=_0x21ed75;}return db['Schedule'][_0xd6f3('0x3d')]({'where':_0x110329,'include':[{'model':db[_0xd6f3('0xc')],'attributes':['id','name',_0xd6f3('0x9')],'include':[{'model':db['MailServerOut'],'as':_0xd6f3('0xa')}]}]})[_0xd6f3('0x2a')](function(_0x5f4369){var _0x4ef973=_[_0xd6f3('0x3e')](manager['jobs']);var _0x8c819a=_[_0xd6f3('0x3f')](_0x5f4369,function(_0x215e62){return _0x215e62['id']['toString']();});var _0x2a0edd=_['keyBy'](_0x5f4369,function(_0x51a43d){return _0x51a43d['id']['toString']();});var _0x560a27=_0x21ed75?_0x8c819a:_[_0xd6f3('0x40')](_0x8c819a,_0x4ef973);var _0x3d1b04=_[_0xd6f3('0x41')](_0x8c819a,_0x4ef973);var _0x531c98=_['difference'](_0x4ef973,_0x8c819a);var _0x47b190;var _0x335bdd;for(_0x47b190=0x0;_0x47b190<_0x531c98['length']&&!_0x21ed75;_0x47b190+=0x1){_0x335bdd=_0x531c98[_0x47b190][_0xd6f3('0x42')]();if(manager[_0xd6f3('0x43')](_0x335bdd)){manager['stop'](_0x335bdd);manager[_0xd6f3('0x44')](_0x335bdd);logger[_0xd6f3('0x2d')]('delete\x20cron',_0x335bdd);}}logger[_0xd6f3('0x2d')](_0xd6f3('0x45'),JSON['stringify'](_0x560a27));for(_0x47b190=0x0;_0x47b190<_0x560a27['length'];_0x47b190+=0x1){_0x335bdd=_0x560a27[_0x47b190][_0xd6f3('0x42')]();logger['info']('index',_0x335bdd);if(_0x21ed75){logger[_0xd6f3('0x2d')](_0xd6f3('0x46'),_0x21ed75);logger[_0xd6f3('0x2d')](JSON[_0xd6f3('0x25')](_0x2a0edd[_0x335bdd]));BPromise[_0xd6f3('0x47')]()[_0xd6f3('0x2a')](handleJob(_0x2a0edd[_0x335bdd]));logger[_0xd6f3('0x2d')](_0xd6f3('0x48'),_0x2a0edd[_0x335bdd][_0xd6f3('0x15')],_0x2a0edd[_0x335bdd][_0xd6f3('0x49')]);}else if(_0x2a0edd[_0x335bdd][_0xd6f3('0x49')]&&_0x2a0edd[_0x335bdd][_0xd6f3('0x4a')]&&moment()[_0xd6f3('0x4b')](_0x2a0edd[_0x335bdd][_0xd6f3('0x4c')],_0x2a0edd[_0x335bdd][_0xd6f3('0x4d')])){manager['add'](_0x335bdd,_0x2a0edd[_0x335bdd][_0xd6f3('0x49')],handleJob(_0x2a0edd[_0x335bdd]));manager[_0xd6f3('0x4e')](_0x335bdd);logger[_0xd6f3('0x2d')](_0xd6f3('0x4f'),_0x2a0edd[_0x335bdd][_0xd6f3('0x15')],_0x2a0edd[_0x335bdd][_0xd6f3('0x49')]);}else if(manager[_0xd6f3('0x43')](_0x335bdd)){manager[_0xd6f3('0x50')](_0x335bdd);manager['deleteJob'](_0x335bdd);logger[_0xd6f3('0x2d')]('stop\x20cron',_0x2a0edd[_0x335bdd][_0xd6f3('0x15')],_0x2a0edd[_0x335bdd]['cron']);}}for(_0x47b190=0x0,_0x335bdd;_0x47b190<_0x3d1b04[_0xd6f3('0x51')]&&!_0x21ed75;_0x47b190+=0x1){_0x335bdd=_0x3d1b04[_0x47b190]['toString']();if(manager[_0xd6f3('0x43')](_0x335bdd)){if(_0x2a0edd[_0x335bdd]['cron']&&_0x2a0edd[_0x335bdd][_0xd6f3('0x4a')]&&moment()[_0xd6f3('0x4b')](_0x2a0edd[_0x335bdd]['startAt'],_0x2a0edd[_0x335bdd][_0xd6f3('0x4d')])){manager['update'](_0x335bdd,_0x2a0edd[_0x335bdd]['cron'],handleJob(_0x2a0edd[_0x335bdd]));logger[_0xd6f3('0x2d')](_0xd6f3('0x52'),_0x2a0edd[_0x335bdd][_0xd6f3('0x15')],_0x2a0edd[_0x335bdd]['cron']);}else{manager[_0xd6f3('0x50')](_0x335bdd);manager[_0xd6f3('0x44')](_0x335bdd);logger[_0xd6f3('0x2d')](_0xd6f3('0x53'),_0x2a0edd[_0x335bdd][_0xd6f3('0x15')],_0x2a0edd[_0x335bdd]['cron']);}}}})['catch'](function(_0xbbf579){logger[_0xd6f3('0x2b')](JSON[_0xd6f3('0x25')](_0xbbf579));});}exports[_0xd6f3('0x54')]=function(_0x596e79){return getJobs(_0x596e79);};exports[_0xd6f3('0x4e')]=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 9c8da2b..4d71feb 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 _0xcd31=['TranscriptionJobStatus','COMPLETED','Transcript','TranscriptFileUri','format','[RECORDING:%d]\x20Get\x20transcript','info','[RECORDING:%d]\x20Transcript\x20downloaded','transcripts','results','length','transcript','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentimentAccountId','language','bucket','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','CloudProvider','Cloud\x20Provider\x20not\x20available','data2','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','Positive','SentimentScore','Negative','Neutral','FAILED','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','tempSentiment','sentiment','sentimentRegion','findOne','Mixed','catch','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Settings\x20not\x20available','transcribeAccountId','Transcribe\x20not\x20configured','Cloud\x20Provider\x20not\x20configured','forEach','push','all','name','start','aws-sdk','request-promise','util','../../mysqldb','../../config/logger','transcribe','getTranscriptionJob','detectSentiment','substring','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','transcribeRegion','then','fileText','TranscriptionJob'];(function(_0x2d9b66,_0x3930bc){var _0x4d8ad5=function(_0x12f111){while(--_0x12f111){_0x2d9b66['push'](_0x2d9b66['shift']());}};_0x4d8ad5(++_0x3930bc);}(_0xcd31,0x15d));var _0x1cd3=function(_0x213165,_0x4f2a23){_0x213165=_0x213165-0x0;var _0x2794df=_0xcd31[_0x213165];return _0x2794df;};var _=require('lodash');var AWS=require(_0x1cd3('0x0'));var rp=require(_0x1cd3('0x1'));var util=require(_0x1cd3('0x2'));var BPromise=require('bluebird');var db=require(_0x1cd3('0x3'))['db'];var logger=require(_0x1cd3('0x4'))(_0x1cd3('0x5'));function getTranscriptionJob(_0x28c67f,_0x295933,_0xf9f49b,_0x5bc77d){return new Promise(function(_0x26ffcb,_0x1ca151){var _0xedb6d1=new AWS['TranscribeService']({'accessKeyId':_0x295933,'secretAccessKey':_0x28c67f,'region':_0xf9f49b});_0xedb6d1[_0x1cd3('0x6')]({'TranscriptionJobName':_0x5bc77d},function(_0x11b139,_0x124659){if(_0x11b139){return _0x1ca151(_0x11b139);}else{return _0x26ffcb(_0x124659);}});});}function sentiment(_0x4a2204,_0x1af2c4,_0x3953d3,_0x17d5c8,_0xb3159f){return new Promise(function(_0x406bc8,_0x3eb8af){var _0x7e5c1a=new AWS['Comprehend']({'accessKeyId':_0x1af2c4,'secretAccessKey':_0x4a2204,'region':_0x3953d3});_0x7e5c1a[_0x1cd3('0x7')]({'Text':_0x17d5c8,'LanguageCode':_0xb3159f[_0x1cd3('0x8')](0x0,0x2)},function(_0x2e460d,_0x44010d){if(_0x2e460d){return _0x3eb8af(_0x2e460d);}else{return _0x406bc8(_0x44010d);}});});}function checkTranscribeJob(_0x5102af,_0xfe288e,_0x4c9c6d){var _0x41016f;return new BPromise(function(_0x35a9ae,_0x3fcc45){logger['info'](util['format'](_0x1cd3('0x9'),_0x5102af['id'],_0x5102af[_0x1cd3('0xa')]));return getTranscriptionJob(_0x4c9c6d[_0x1cd3('0xb')],_0x4c9c6d['data2'],_0xfe288e[_0x1cd3('0xc')],_0x5102af[_0x1cd3('0xa')])[_0x1cd3('0xd')](function(_0x418da3){logger['info'](util['format']('[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s',_0x5102af['id'],_0x5102af['transcribeName'],_0x418da3['TranscriptionJob']['TranscriptionJobStatus']));if(!_0x5102af[_0x1cd3('0xe')]){switch(_0x418da3[_0x1cd3('0xf')][_0x1cd3('0x10')]){case _0x1cd3('0x11'):var _0x359899={'transcribeStatus':_0x418da3[_0x1cd3('0xf')][_0x1cd3('0x10')],'fileUri':_0x418da3[_0x1cd3('0xf')][_0x1cd3('0x12')][_0x1cd3('0x13')]};logger['info'](util[_0x1cd3('0x14')](_0x1cd3('0x15'),_0x5102af['id']));return rp({'uri':_0x418da3['TranscriptionJob'][_0x1cd3('0x12')][_0x1cd3('0x13')],'json':!![]})['then'](function(_0x20cda5){logger[_0x1cd3('0x16')](util[_0x1cd3('0x14')](_0x1cd3('0x17'),_0x5102af['id']));if(_0x20cda5&&_0x20cda5['results']&&_0x20cda5['results'][_0x1cd3('0x18')]&&_0x20cda5[_0x1cd3('0x19')]['transcripts']['length']){_0x359899[_0x1cd3('0xe')]='';for(var _0x44b162=0x0;_0x44b162<_0x20cda5['results']['transcripts'][_0x1cd3('0x1a')];_0x44b162++){_0x359899[_0x1cd3('0xe')]+=_0x20cda5['results']['transcripts'][_0x44b162][_0x1cd3('0x1b')]+'';}}return _0x5102af[_0x1cd3('0x1c')](_0x359899);})[_0x1cd3('0xd')](function(){logger['info'](util['format'](_0x1cd3('0x1d'),_0x5102af['id']));if(!_0x5102af['tempSentiment']){throw new db[(_0x1cd3('0x1e'))][(_0x1cd3('0x1f'))](_0x1cd3('0x20'));}if(!_0xfe288e['sentiment']||!_0xfe288e[_0x1cd3('0x21')]||!_0xfe288e['sentimentRegion']||!_0xfe288e[_0x1cd3('0x22')]||!_0xfe288e[_0x1cd3('0x23')]){throw new db[(_0x1cd3('0x1e'))]['ValidationError'](_0x1cd3('0x24'));}if(!_0x359899[_0x1cd3('0xe')]){throw new Error(_0x1cd3('0x25'));}if(_0xfe288e[_0x1cd3('0x21')]===_0x4c9c6d['id']){return _0x4c9c6d;}else{return db[_0x1cd3('0x26')]['findOne']({'where':{'id':_settings[_0x1cd3('0x21')]}});}})[_0x1cd3('0xd')](function(_0x1412cb){if(!_0x1412cb){throw new db[(_0x1cd3('0x1e'))][(_0x1cd3('0x1f'))](_0x1cd3('0x27'));}if(!_0x1412cb['data1']||!_0x1412cb[_0x1cd3('0x28')]){throw new db[(_0x1cd3('0x1e'))]['ValidationError']('Cloud\x20Provider\x20not\x20configured');}_0x41016f=_0x1412cb;logger[_0x1cd3('0x16')](util[_0x1cd3('0x14')](_0x1cd3('0x29'),_0x5102af['id']));return sentiment(_0x41016f[_0x1cd3('0xb')],_0x41016f[_0x1cd3('0x28')],_0xfe288e['sentimentRegion'],_0x359899[_0x1cd3('0xe')],_0xfe288e['language']);})['then'](function(_0x1633af){logger[_0x1cd3('0x16')](util[_0x1cd3('0x14')](_0x1cd3('0x2a'),_0x5102af['id']));return _0x5102af['update']({'sentiment':_0x1633af[_0x1cd3('0x2b')],'sPositive':_0x1633af['SentimentScore'][_0x1cd3('0x2c')],'sNegative':_0x1633af[_0x1cd3('0x2d')][_0x1cd3('0x2e')],'sMixed':_0x1633af[_0x1cd3('0x2d')]['Mixed'],'sNeutral':_0x1633af['SentimentScore'][_0x1cd3('0x2f')]});})['then'](function(){logger[_0x1cd3('0x16')](util[_0x1cd3('0x14')](_0x1cd3('0x1d'),_0x5102af['id']));_0x35a9ae();});case _0x1cd3('0x30'):return _0x5102af[_0x1cd3('0x1c')]({'transcribeStatus':'FAILED','failureReason':_0x418da3['TranscriptionJob']['FailureReason']})['then'](function(){logger[_0x1cd3('0x16')](util['format'](_0x1cd3('0x1d'),_0x5102af['id']));_0x35a9ae();});default:logger['info'](util[_0x1cd3('0x14')](_0x1cd3('0x31'),_0x5102af['id']));break;}}else{return BPromise['resolve']()[_0x1cd3('0xd')](function(){if(!_0x5102af[_0x1cd3('0x32')]){throw new db[(_0x1cd3('0x1e'))]['ValidationError']('Sentiment\x20Analysis\x20not\x20requested');}if(!_0xfe288e[_0x1cd3('0x33')]||!_0xfe288e[_0x1cd3('0x21')]||!_0xfe288e[_0x1cd3('0x34')]||!_0xfe288e[_0x1cd3('0x22')]||!_0xfe288e[_0x1cd3('0x23')]){throw new db[(_0x1cd3('0x1e'))][(_0x1cd3('0x1f'))](_0x1cd3('0x24'));}if(!_0x5102af[_0x1cd3('0xe')]){throw new Error('Transcript\x20not\x20available');}if(_0xfe288e['sentimentAccountId']===_0x4c9c6d['id']){return _0x4c9c6d;}else{return db['CloudProvider'][_0x1cd3('0x35')]({'where':{'id':_settings[_0x1cd3('0x21')]}});}})['then'](function(_0x2eeea6){if(!_0x2eeea6){throw new db['Sequelize'][(_0x1cd3('0x1f'))](_0x1cd3('0x27'));}if(!_0x2eeea6[_0x1cd3('0xb')]||!_0x2eeea6[_0x1cd3('0x28')]){throw new db['Sequelize']['ValidationError']('Cloud\x20Provider\x20not\x20configured');}_0x41016f=_0x2eeea6;logger[_0x1cd3('0x16')](util['format']('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x5102af['id']));return sentiment(_0x41016f[_0x1cd3('0xb')],_0x41016f['data2'],_0xfe288e[_0x1cd3('0x34')],_0x5102af[_0x1cd3('0xe')],_0xfe288e[_0x1cd3('0x22')]);})[_0x1cd3('0xd')](function(_0x326a80){logger[_0x1cd3('0x16')](util[_0x1cd3('0x14')](_0x1cd3('0x2a'),_0x5102af['id']));return _0x5102af['update']({'sentiment':_0x326a80[_0x1cd3('0x2b')],'sPositive':_0x326a80[_0x1cd3('0x2d')][_0x1cd3('0x2c')],'sNegative':_0x326a80['SentimentScore']['Negative'],'sMixed':_0x326a80[_0x1cd3('0x2d')][_0x1cd3('0x36')],'sNeutral':_0x326a80[_0x1cd3('0x2d')][_0x1cd3('0x2f')],'transcribeStatus':_0x1cd3('0x11')});})[_0x1cd3('0xd')](function(){logger[_0x1cd3('0x16')](util['format'](_0x1cd3('0x1d'),_0x5102af['id']));_0x35a9ae();});}})[_0x1cd3('0x37')](function(_0xbc7fbe){if(_0xbc7fbe){if(!_0xbc7fbe['name']||_0xbc7fbe['name']!==_0x1cd3('0x38')){logger[_0x1cd3('0x39')](util[_0x1cd3('0x14')](_0x1cd3('0x3a'),_0x5102af['id']),util[_0x1cd3('0x3b')](_0xbc7fbe,{'showHidden':![],'depth':null}));}}_0x35a9ae();});});}function checkTranscribe(){var _0x4e746b;var _0x5da126;var _0x500fcf;return db[_0x1cd3('0x3c')][_0x1cd3('0x3d')]({'where':{'transcribeStatus':_0x1cd3('0x3e')}})[_0x1cd3('0xd')](function(_0x1ae177){if(!_0x1ae177||!_0x1ae177['length']){throw new db['Sequelize'][(_0x1cd3('0x1f'))](_0x1cd3('0x3f'));}_0x4e746b=_0x1ae177;return db['Setting'][_0x1cd3('0x35')]({'where':{'id':0x1}});})[_0x1cd3('0xd')](function(_0x2542f6){if(!_0x2542f6){throw new db['Sequelize']['ValidationError'](_0x1cd3('0x40'));}_0x5da126=_0x2542f6;if(!_0x5da126['transcribe']||!_0x5da126[_0x1cd3('0x41')]||!_0x5da126[_0x1cd3('0xc')]||!_0x5da126[_0x1cd3('0x22')]||!_0x5da126[_0x1cd3('0x23')]){throw new db[(_0x1cd3('0x1e'))][(_0x1cd3('0x1f'))](_0x1cd3('0x42'));}return db[_0x1cd3('0x26')]['findOne']({'where':{'id':_0x5da126[_0x1cd3('0x41')]}});})[_0x1cd3('0xd')](function(_0xbd4ea2){if(!_0xbd4ea2){throw new db[(_0x1cd3('0x1e'))]['ValidationError'](_0x1cd3('0x27'));}if(!_0xbd4ea2[_0x1cd3('0xb')]||!_0xbd4ea2[_0x1cd3('0x28')]){throw new db['Sequelize']['ValidationError'](_0x1cd3('0x43'));}_0x500fcf=_0xbd4ea2;var _0x5e31b2=[];_0x4e746b[_0x1cd3('0x44')](function(_0x233ef5){_0x5e31b2[_0x1cd3('0x45')](checkTranscribeJob(_0x233ef5,_0x5da126,_0x500fcf));});return BPromise[_0x1cd3('0x46')](_0x5e31b2);})['catch'](function(_0x12a2d0){if(_0x12a2d0){if(!_0x12a2d0[_0x1cd3('0x47')]||_0x12a2d0[_0x1cd3('0x47')]!==_0x1cd3('0x38')){logger['error'](util[_0x1cd3('0x3b')](_0x12a2d0,{'showHidden':![],'depth':null}));}}});}exports[_0x1cd3('0x48')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0x8109=['SentimentScore','Negative','Mixed','Neutral','FAILED','update','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','tempSentiment','bucket','findOne','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','Positive','catch','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll','IN_PROGRESS','Setting','Settings\x20not\x20available','transcribeAccountId','transcribeRegion','all','start','lodash','request-promise','util','../../mysqldb','../../config/logger','transcribe','TranscribeService','Comprehend','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','data2','then','fileText','TranscriptionJob','TranscriptionJobStatus','COMPLETED','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','Transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','sentimentRegion','language','Sequelize','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','CloudProvider','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment'];(function(_0x725a4c,_0x102507){var _0x37b2cc=function(_0x505fc9){while(--_0x505fc9){_0x725a4c['push'](_0x725a4c['shift']());}};_0x37b2cc(++_0x102507);}(_0x8109,0xa9));var _0x9810=function(_0x18a9b6,_0x47f963){_0x18a9b6=_0x18a9b6-0x0;var _0x588c86=_0x8109[_0x18a9b6];return _0x588c86;};var _=require(_0x9810('0x0'));var AWS=require('aws-sdk');var rp=require(_0x9810('0x1'));var util=require(_0x9810('0x2'));var BPromise=require('bluebird');var db=require(_0x9810('0x3'))['db'];var logger=require(_0x9810('0x4'))(_0x9810('0x5'));function getTranscriptionJob(_0x4314cd,_0x2a93a6,_0xf73940,_0x4435be){return new Promise(function(_0x24baaf,_0x440a10){var _0x150e3f=new AWS[(_0x9810('0x6'))]({'accessKeyId':_0x2a93a6,'secretAccessKey':_0x4314cd,'region':_0xf73940});_0x150e3f['getTranscriptionJob']({'TranscriptionJobName':_0x4435be},function(_0x3b0e0d,_0xafe932){if(_0x3b0e0d){return _0x440a10(_0x3b0e0d);}else{return _0x24baaf(_0xafe932);}});});}function sentiment(_0x331f94,_0x18b72a,_0xd9e6d,_0x57707e,_0x3d2f90){return new Promise(function(_0x275b99,_0x3c225d){var _0x53a6c5=new AWS[(_0x9810('0x7'))]({'accessKeyId':_0x18b72a,'secretAccessKey':_0x331f94,'region':_0xd9e6d});_0x53a6c5['detectSentiment']({'Text':_0x57707e,'LanguageCode':_0x3d2f90['substring'](0x0,0x2)},function(_0x493e1a,_0x2e2f93){if(_0x493e1a){return _0x3c225d(_0x493e1a);}else{return _0x275b99(_0x2e2f93);}});});}function checkTranscribeJob(_0x42443f,_0x215bd1,_0x413c7a){var _0x27f957;return new BPromise(function(_0x48ec14,_0x3fc4af){logger[_0x9810('0x8')](util[_0x9810('0x9')](_0x9810('0xa'),_0x42443f['id'],_0x42443f[_0x9810('0xb')]));return getTranscriptionJob(_0x413c7a[_0x9810('0xc')],_0x413c7a[_0x9810('0xd')],_0x215bd1['transcribeRegion'],_0x42443f[_0x9810('0xb')])[_0x9810('0xe')](function(_0xd6188c){logger[_0x9810('0x8')](util['format']('[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s',_0x42443f['id'],_0x42443f[_0x9810('0xb')],_0xd6188c['TranscriptionJob']['TranscriptionJobStatus']));if(!_0x42443f[_0x9810('0xf')]){switch(_0xd6188c[_0x9810('0x10')][_0x9810('0x11')]){case _0x9810('0x12'):var _0x124719={'transcribeStatus':_0xd6188c[_0x9810('0x10')]['TranscriptionJobStatus'],'fileUri':_0xd6188c['TranscriptionJob']['Transcript'][_0x9810('0x13')]};logger[_0x9810('0x8')](util['format'](_0x9810('0x14'),_0x42443f['id']));return rp({'uri':_0xd6188c[_0x9810('0x10')][_0x9810('0x15')][_0x9810('0x13')],'json':!![]})[_0x9810('0xe')](function(_0x280135){logger['info'](util[_0x9810('0x9')](_0x9810('0x16'),_0x42443f['id']));if(_0x280135&&_0x280135['results']&&_0x280135[_0x9810('0x17')][_0x9810('0x18')]&&_0x280135[_0x9810('0x17')]['transcripts'][_0x9810('0x19')]){_0x124719['fileText']='';for(var _0xb0a3f=0x0;_0xb0a3f<_0x280135['results'][_0x9810('0x18')][_0x9810('0x19')];_0xb0a3f++){_0x124719[_0x9810('0xf')]+=_0x280135[_0x9810('0x17')]['transcripts'][_0xb0a3f]['transcript']+'';}}return _0x42443f['update'](_0x124719);})[_0x9810('0xe')](function(){logger[_0x9810('0x8')](util['format'](_0x9810('0x1a'),_0x42443f['id']));if(!_0x42443f['tempSentiment']){throw new db['Sequelize'][(_0x9810('0x1b'))](_0x9810('0x1c'));}if(!_0x215bd1[_0x9810('0x1d')]||!_0x215bd1[_0x9810('0x1e')]||!_0x215bd1[_0x9810('0x1f')]||!_0x215bd1[_0x9810('0x20')]||!_0x215bd1['bucket']){throw new db[(_0x9810('0x21'))][(_0x9810('0x1b'))](_0x9810('0x22'));}if(!_0x124719['fileText']){throw new Error(_0x9810('0x23'));}if(_0x215bd1['sentimentAccountId']===_0x413c7a['id']){return _0x413c7a;}else{return db[_0x9810('0x24')]['findOne']({'where':{'id':_settings[_0x9810('0x1e')]}});}})[_0x9810('0xe')](function(_0x4310c5){if(!_0x4310c5){throw new db[(_0x9810('0x21'))][(_0x9810('0x1b'))](_0x9810('0x25'));}if(!_0x4310c5['data1']||!_0x4310c5[_0x9810('0xd')]){throw new db[(_0x9810('0x21'))][(_0x9810('0x1b'))](_0x9810('0x26'));}_0x27f957=_0x4310c5;logger['info'](util['format']('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x42443f['id']));return sentiment(_0x27f957['data1'],_0x27f957['data2'],_0x215bd1['sentimentRegion'],_0x124719[_0x9810('0xf')],_0x215bd1[_0x9810('0x20')]);})[_0x9810('0xe')](function(_0x257c3b){logger[_0x9810('0x8')](util['format'](_0x9810('0x27'),_0x42443f['id']));return _0x42443f['update']({'sentiment':_0x257c3b[_0x9810('0x28')],'sPositive':_0x257c3b[_0x9810('0x29')]['Positive'],'sNegative':_0x257c3b[_0x9810('0x29')][_0x9810('0x2a')],'sMixed':_0x257c3b[_0x9810('0x29')][_0x9810('0x2b')],'sNeutral':_0x257c3b[_0x9810('0x29')][_0x9810('0x2c')]});})[_0x9810('0xe')](function(){logger[_0x9810('0x8')](util[_0x9810('0x9')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x42443f['id']));_0x48ec14();});case _0x9810('0x2d'):return _0x42443f[_0x9810('0x2e')]({'transcribeStatus':'FAILED','failureReason':_0xd6188c[_0x9810('0x10')][_0x9810('0x2f')]})[_0x9810('0xe')](function(){logger[_0x9810('0x8')](util[_0x9810('0x9')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x42443f['id']));_0x48ec14();});default:logger[_0x9810('0x8')](util[_0x9810('0x9')](_0x9810('0x30'),_0x42443f['id']));break;}}else{return BPromise[_0x9810('0x31')]()[_0x9810('0xe')](function(){if(!_0x42443f[_0x9810('0x32')]){throw new db[(_0x9810('0x21'))][(_0x9810('0x1b'))](_0x9810('0x1c'));}if(!_0x215bd1[_0x9810('0x1d')]||!_0x215bd1[_0x9810('0x1e')]||!_0x215bd1['sentimentRegion']||!_0x215bd1[_0x9810('0x20')]||!_0x215bd1[_0x9810('0x33')]){throw new db['Sequelize']['ValidationError'](_0x9810('0x22'));}if(!_0x42443f[_0x9810('0xf')]){throw new Error(_0x9810('0x23'));}if(_0x215bd1['sentimentAccountId']===_0x413c7a['id']){return _0x413c7a;}else{return db[_0x9810('0x24')][_0x9810('0x34')]({'where':{'id':_settings[_0x9810('0x1e')]}});}})[_0x9810('0xe')](function(_0x30865d){if(!_0x30865d){throw new db[(_0x9810('0x21'))][(_0x9810('0x1b'))](_0x9810('0x25'));}if(!_0x30865d[_0x9810('0xc')]||!_0x30865d[_0x9810('0xd')]){throw new db[(_0x9810('0x21'))][(_0x9810('0x1b'))]('Cloud\x20Provider\x20not\x20configured');}_0x27f957=_0x30865d;logger['info'](util[_0x9810('0x9')](_0x9810('0x35'),_0x42443f['id']));return sentiment(_0x27f957[_0x9810('0xc')],_0x27f957[_0x9810('0xd')],_0x215bd1[_0x9810('0x1f')],_0x42443f['fileText'],_0x215bd1[_0x9810('0x20')]);})[_0x9810('0xe')](function(_0x5da2f7){logger[_0x9810('0x8')](util[_0x9810('0x9')](_0x9810('0x27'),_0x42443f['id']));return _0x42443f[_0x9810('0x2e')]({'sentiment':_0x5da2f7[_0x9810('0x28')],'sPositive':_0x5da2f7[_0x9810('0x29')][_0x9810('0x36')],'sNegative':_0x5da2f7[_0x9810('0x29')][_0x9810('0x2a')],'sMixed':_0x5da2f7[_0x9810('0x29')][_0x9810('0x2b')],'sNeutral':_0x5da2f7[_0x9810('0x29')][_0x9810('0x2c')],'transcribeStatus':_0x9810('0x12')});})[_0x9810('0xe')](function(){logger[_0x9810('0x8')](util[_0x9810('0x9')](_0x9810('0x1a'),_0x42443f['id']));_0x48ec14();});}})[_0x9810('0x37')](function(_0x4eb0c2){if(_0x4eb0c2){if(!_0x4eb0c2[_0x9810('0x38')]||_0x4eb0c2[_0x9810('0x38')]!==_0x9810('0x39')){logger[_0x9810('0x3a')](util[_0x9810('0x9')](_0x9810('0x3b'),_0x42443f['id']),util[_0x9810('0x3c')](_0x4eb0c2,{'showHidden':![],'depth':null}));}}_0x48ec14();});});}function checkTranscribe(){var _0x282f15;var _0x1f4d1c;var _0x46e69d;return db[_0x9810('0x3d')][_0x9810('0x3e')]({'where':{'transcribeStatus':_0x9810('0x3f')}})[_0x9810('0xe')](function(_0x42192b){if(!_0x42192b||!_0x42192b[_0x9810('0x19')]){throw new db[(_0x9810('0x21'))][(_0x9810('0x1b'))]('No\x20transcribe\x20job\x20to\x20check');}_0x282f15=_0x42192b;return db[_0x9810('0x40')][_0x9810('0x34')]({'where':{'id':0x1}});})[_0x9810('0xe')](function(_0x173480){if(!_0x173480){throw new db[(_0x9810('0x21'))]['ValidationError'](_0x9810('0x41'));}_0x1f4d1c=_0x173480;if(!_0x1f4d1c[_0x9810('0x5')]||!_0x1f4d1c[_0x9810('0x42')]||!_0x1f4d1c[_0x9810('0x43')]||!_0x1f4d1c['language']||!_0x1f4d1c[_0x9810('0x33')]){throw new db[(_0x9810('0x21'))][(_0x9810('0x1b'))]('Transcribe\x20not\x20configured');}return db['CloudProvider'][_0x9810('0x34')]({'where':{'id':_0x1f4d1c[_0x9810('0x42')]}});})[_0x9810('0xe')](function(_0xafef23){if(!_0xafef23){throw new db[(_0x9810('0x21'))][(_0x9810('0x1b'))](_0x9810('0x25'));}if(!_0xafef23[_0x9810('0xc')]||!_0xafef23['data2']){throw new db[(_0x9810('0x21'))][(_0x9810('0x1b'))](_0x9810('0x26'));}_0x46e69d=_0xafef23;var _0x4d5bc6=[];_0x282f15['forEach'](function(_0x586864){_0x4d5bc6['push'](checkTranscribeJob(_0x586864,_0x1f4d1c,_0x46e69d));});return BPromise[_0x9810('0x44')](_0x4d5bc6);})[_0x9810('0x37')](function(_0x4322e6){if(_0x4322e6){if(!_0x4322e6['name']||_0x4322e6['name']!==_0x9810('0x39')){logger[_0x9810('0x3a')](util[_0x9810('0x3c')](_0x4322e6,{'showHidden':![],'depth':null}));}}});}exports[_0x9810('0x45')]=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 91a7fcd..798efcd 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 _0xd000=['redis','defaults','localhost','socket.io-emitter','WhatsappInteraction','findAll','lastMsgAt','subtract','hours','length','map','[WHATSAPP]\x20Interactions\x20to\x20close:','update','timeout','YYYY-MM-DD\x20HH:mm:ss','then','info','join','emit','catch','error','inspect','start','lodash','moment','ioredis','../../config/environment','../../mysqldb','../logger','schedule'];(function(_0x1d046a,_0x30db41){var _0x2c0b0c=function(_0x30a3c5){while(--_0x30a3c5){_0x1d046a['push'](_0x1d046a['shift']());}};_0x2c0b0c(++_0x30db41);}(_0xd000,0x8f));var _0x0d00=function(_0x56741b,_0x3d7bee){_0x56741b=_0x56741b-0x0;var _0x595425=_0xd000[_0x56741b];return _0x595425;};'use strict';var _=require(_0x0d00('0x0'));var moment=require(_0x0d00('0x1'));var Redis=require(_0x0d00('0x2'));var util=require('util');var config=require(_0x0d00('0x3'));var db=require(_0x0d00('0x4'))['db'];var logger=require(_0x0d00('0x5'))(_0x0d00('0x6'));config[_0x0d00('0x7')]=_[_0x0d00('0x8')](config['redis'],{'host':_0x0d00('0x9'),'port':0x18eb});var io=require(_0x0d00('0xa'))(new Redis(config[_0x0d00('0x7')]));function closeInteractions(){var _0x16f617=[];return db[_0x0d00('0xb')][_0x0d00('0xc')]({'raw':!![],'attributes':['id',_0x0d00('0xd')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x0d00('0xe')](0x18,_0x0d00('0xf'))}}})['then'](function(_0x313791){if(_0x313791&&_0x313791[_0x0d00('0x10')]){_0x16f617=_[_0x0d00('0x11')](_0x313791||[],'id');logger['info'](_0x0d00('0x12'),_0x16f617['join']());return db['WhatsappInteraction'][_0x0d00('0x13')]({'closeReason':'system','disposition':_0x0d00('0x14'),'closed':!![],'closedAt':moment()['format'](_0x0d00('0x15'))},{'where':{'id':_0x16f617}});}})[_0x0d00('0x16')](function(){if(_0x16f617&&_0x16f617[_0x0d00('0x10')]){logger[_0x0d00('0x17')]('[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:',_0x16f617[_0x0d00('0x18')]());for(var _0x706cca=0x0;_0x706cca<_0x16f617['length'];_0x706cca++){io[_0x0d00('0x19')]('whatsappInteraction:update',{'id':_0x16f617[_0x706cca],'closed':!![]});}}})[_0x0d00('0x1a')](function(_0x25e776){logger[_0x0d00('0x1b')]('[WHATSAPP]\x20Error\x20closing\x20interactions',_0x25e776?util[_0x0d00('0x1c')](_0x25e776,{'showHidden':![],'depth':null}):'');});}exports[_0x0d00('0x1d')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xdcc3=['schedule','redis','WhatsappInteraction','lastMsgAt','subtract','hours','length','map','[WHATSAPP]\x20Interactions\x20to\x20close:','join','update','system','format','YYYY-MM-DD\x20HH:mm:ss','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment','ioredis','../logger'];(function(_0xa16439,_0xf6687d){var _0x13ed19=function(_0x11e91a){while(--_0x11e91a){_0xa16439['push'](_0xa16439['shift']());}};_0x13ed19(++_0xf6687d);}(_0xdcc3,0xf6));var _0x3dcc=function(_0x571923,_0x1182f6){_0x571923=_0x571923-0x0;var _0x5b6d93=_0xdcc3[_0x571923];return _0x5b6d93;};'use strict';var _=require(_0x3dcc('0x0'));var moment=require(_0x3dcc('0x1'));var Redis=require(_0x3dcc('0x2'));var util=require('util');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var logger=require(_0x3dcc('0x3'))(_0x3dcc('0x4'));config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x3dcc('0x5')]));function closeInteractions(){var _0x5907e7=[];return db[_0x3dcc('0x6')]['findAll']({'raw':!![],'attributes':['id',_0x3dcc('0x7')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x3dcc('0x8')](0x18,_0x3dcc('0x9'))}}})['then'](function(_0x5e9bac){if(_0x5e9bac&&_0x5e9bac[_0x3dcc('0xa')]){_0x5907e7=_[_0x3dcc('0xb')](_0x5e9bac||[],'id');logger['info'](_0x3dcc('0xc'),_0x5907e7[_0x3dcc('0xd')]());return db[_0x3dcc('0x6')][_0x3dcc('0xe')]({'closeReason':_0x3dcc('0xf'),'disposition':'timeout','closed':!![],'closedAt':moment()[_0x3dcc('0x10')](_0x3dcc('0x11'))},{'where':{'id':_0x5907e7}});}})['then'](function(){if(_0x5907e7&&_0x5907e7[_0x3dcc('0xa')]){logger['info'](_0x3dcc('0x12'),_0x5907e7[_0x3dcc('0xd')]());for(var _0x570655=0x0;_0x570655<_0x5907e7[_0x3dcc('0xa')];_0x570655++){io[_0x3dcc('0x13')]('whatsappInteraction:update',{'id':_0x5907e7[_0x570655],'closed':!![]});}}})[_0x3dcc('0x14')](function(_0x2827ab){logger[_0x3dcc('0x15')](_0x3dcc('0x16'),_0x2827ab?util[_0x3dcc('0x17')](_0x2827ab,{'showHidden':![],'depth':null}):'');});}exports[_0x3dcc('0x18')]=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 f8609da..9787448 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb01a=['util','../mysqldb','Innocenzo','Biondo','now','push','innocenzo.biondo','@xcally.com','CmContact','destroy','then','bulkCreate','finished\x20populating','contacts1','CmHopper','log','hopper1','contacts2','catch'];(function(_0x211a1f,_0x138c78){var _0x2b482b=function(_0x4a9805){while(--_0x4a9805){_0x211a1f['push'](_0x211a1f['shift']());}};_0x2b482b(++_0x138c78);}(_0xb01a,0x1ee));var _0xab01=function(_0x119a07,_0x2289f6){_0x119a07=_0x119a07-0x0;var _0x36025c=_0xb01a[_0x119a07];return _0x36025c;};'use strict';var util=require(_0xab01('0x0'));var db=require(_0xab01('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts['push']({'id':i,'firstName':_0xab01('0x2')+i,'lastName':_0xab01('0x3')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+'@xcally.com'});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper['push']({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xab01('0x4')](),'updatedAt':Date[_0xab01('0x4')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0xab01('0x5')]({'id':i,'firstName':_0xab01('0x2')+i,'lastName':_0xab01('0x3')+i,'phone':0xf879fb460+i,'email':_0xab01('0x6')+i+_0xab01('0x7')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2['push']({'id':i,'active':![],'scheduledat':Date[_0xab01('0x4')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xab01('0x4')](),'updatedAt':Date[_0xab01('0x4')]()});}db[_0xab01('0x8')][_0xab01('0x9')]({'where':{}})[_0xab01('0xa')](function(){return db[_0xab01('0x8')][_0xab01('0xb')](contacts);})['then'](function(){console['log'](_0xab01('0xc'),_0xab01('0xd'));return db[_0xab01('0xe')]['destroy']({'where':{}});})['then'](function(){return db[_0xab01('0xe')][_0xab01('0xb')](hopper);})[_0xab01('0xa')](function(){console[_0xab01('0xf')]('finished\x20populating',_0xab01('0x10'));return db[_0xab01('0x8')][_0xab01('0xb')](contacts2);})[_0xab01('0xa')](function(){console['log']('finished\x20populating',_0xab01('0x11'));return db[_0xab01('0xe')][_0xab01('0xb')](hopper2);})[_0xab01('0xa')](function(){console[_0xab01('0xf')]('finished\x20populating','hopper2');})[_0xab01('0x12')](function(_0x26bc8f){console[_0xab01('0xf')](_0x26bc8f);}); \ No newline at end of file +var _0x734c=['innocenzo.biondo','@xcally.com','now','CmContact','destroy','bulkCreate','then','log','finished\x20populating','contacts1','CmHopper','hopper1','contacts2','hopper2','util','push','Innocenzo'];(function(_0x563ac9,_0x11bae9){var _0x138d43=function(_0x657010){while(--_0x657010){_0x563ac9['push'](_0x563ac9['shift']());}};_0x138d43(++_0x11bae9);}(_0x734c,0x173));var _0xc734=function(_0x567494,_0x16556a){_0x567494=_0x567494-0x0;var _0x45eaee=_0x734c[_0x567494];return _0x45eaee;};'use strict';var util=require(_0xc734('0x0'));var db=require('../mysqldb')['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0xc734('0x1')]({'id':i,'firstName':_0xc734('0x2')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0xc734('0x3')+i+_0xc734('0x4')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0xc734('0x1')]({'id':i,'active':![],'scheduledat':Date[_0xc734('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xc734('0x5')](),'updatedAt':Date[_0xc734('0x5')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0xc734('0x1')]({'id':i,'firstName':_0xc734('0x2')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0xc734('0x3')+i+'@xcally.com'});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0xc734('0x1')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xc734('0x5')](),'updatedAt':Date[_0xc734('0x5')]()});}db[_0xc734('0x6')][_0xc734('0x7')]({'where':{}})['then'](function(){return db[_0xc734('0x6')][_0xc734('0x8')](contacts);})[_0xc734('0x9')](function(){console[_0xc734('0xa')](_0xc734('0xb'),_0xc734('0xc'));return db['CmHopper'][_0xc734('0x7')]({'where':{}});})[_0xc734('0x9')](function(){return db[_0xc734('0xd')]['bulkCreate'](hopper);})[_0xc734('0x9')](function(){console['log'](_0xc734('0xb'),_0xc734('0xe'));return db[_0xc734('0x6')][_0xc734('0x8')](contacts2);})['then'](function(){console[_0xc734('0xa')](_0xc734('0xb'),_0xc734('0xf'));return db[_0xc734('0xd')][_0xc734('0x8')](hopper2);})[_0xc734('0x9')](function(){console[_0xc734('0xa')](_0xc734('0xb'),_0xc734('0x10'));})['catch'](function(_0x5179ab){console[_0xc734('0xa')](_0x5179ab);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index c082b61..59de8a8 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc10a=['then','log','catch','util','../mysqldb','push','format','%s%s','agent','%s%s@xcally.com','password','friend','udp','wss','all','ulaw','yes','/etc/pki/tls/certs/motion.crt','\x22%s\x22\x20<%s>','User','bulkCreate'];(function(_0x32e2f6,_0x11e862){var _0x109fa7=function(_0x46232f){while(--_0x46232f){_0x32e2f6['push'](_0x32e2f6['shift']());}};_0x109fa7(++_0x11e862);}(_0xc10a,0x1e6));var _0xac10=function(_0x37b3e5,_0x33b516){_0x37b3e5=_0x37b3e5-0x0;var _0x207f20=_0xc10a[_0x37b3e5];return _0x207f20;};'use strict';var util=require(_0xac10('0x0'));var db=require(_0xac10('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0xac10('0x2')]({'name':util[_0xac10('0x3')](_0xac10('0x4'),_0xac10('0x5'),i),'fullname':util[_0xac10('0x3')]('%s%s',_0xac10('0x5'),i),'email':util[_0xac10('0x3')](_0xac10('0x6'),_0xac10('0x5'),i),'role':_0xac10('0x5'),'password':_0xac10('0x7'),'internal':0xfa0+i,'type':_0xac10('0x8'),'transport':[_0xac10('0x9'),'ws',_0xac10('0xa')],'disallow':[_0xac10('0xb')],'allow':[_0xac10('0xc')],'defaultuser':util[_0xac10('0x3')](_0xac10('0x4'),'agent',i),'encryption':'yes','avpf':_0xac10('0xd'),'force_avp':'yes','icesupport':_0xac10('0xd'),'dtlsenable':_0xac10('0xd'),'dtlsverify':'no','dtlscertfile':_0xac10('0xe'),'dtlsprivatekey':'/etc/pki/tls/private/motion.key','dtlssetup':'actpass','callerid':util[_0xac10('0x3')](_0xac10('0xf'),util[_0xac10('0x3')](_0xac10('0x4'),_0xac10('0x5'),i),0xfa0+i)});}db[_0xac10('0x10')][_0xac10('0x11')](users)[_0xac10('0x12')](function(){console[_0xac10('0x13')]('add\x20user');})[_0xac10('0x14')](function(_0x4104be){console[_0xac10('0x13')](_0x4104be);}); \ No newline at end of file +var _0xcded=['/etc/pki/tls/private/motion.key','actpass','\x22%s\x22\x20<%s>','bulkCreate','then','log','catch','util','format','%s%s','agent','%s%s@xcally.com','password','friend','udp','wss','all','ulaw','/etc/pki/tls/certs/motion.crt'];(function(_0x224c0f,_0xa84f32){var _0x186874=function(_0x32bce4){while(--_0x32bce4){_0x224c0f['push'](_0x224c0f['shift']());}};_0x186874(++_0xa84f32);}(_0xcded,0x66));var _0xdcde=function(_0x111692,_0x19f8a9){_0x111692=_0x111692-0x0;var _0x11836f=_0xcded[_0x111692];return _0x11836f;};'use strict';var util=require(_0xdcde('0x0'));var db=require('../mysqldb')['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users['push']({'name':util[_0xdcde('0x1')](_0xdcde('0x2'),'agent',i),'fullname':util['format'](_0xdcde('0x2'),_0xdcde('0x3'),i),'email':util[_0xdcde('0x1')](_0xdcde('0x4'),_0xdcde('0x3'),i),'role':_0xdcde('0x3'),'password':_0xdcde('0x5'),'internal':0xfa0+i,'type':_0xdcde('0x6'),'transport':[_0xdcde('0x7'),'ws',_0xdcde('0x8')],'disallow':[_0xdcde('0x9')],'allow':[_0xdcde('0xa')],'defaultuser':util['format']('%s%s',_0xdcde('0x3'),i),'encryption':'yes','avpf':'yes','force_avp':'yes','icesupport':'yes','dtlsenable':'yes','dtlsverify':'no','dtlscertfile':_0xdcde('0xb'),'dtlsprivatekey':_0xdcde('0xc'),'dtlssetup':_0xdcde('0xd'),'callerid':util[_0xdcde('0x1')](_0xdcde('0xe'),util[_0xdcde('0x1')](_0xdcde('0x2'),_0xdcde('0x3'),i),0xfa0+i)});}db['User'][_0xdcde('0xf')](users)[_0xdcde('0x10')](function(){console[_0xdcde('0x11')]('add\x20user');})[_0xdcde('0x12')](function(_0x484b3e){console[_0xdcde('0x11')](_0x484b3e);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index 2aae41a..22c6c60 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x85ed=['connectedAt','log','SocketIO\x20','nsp','disconnect','DISCONNECTED','CONNECTED','lodash','./environment','name','Agents','User','agent','UserProfileSection','then','autoAssociation','VoiceQueues','ChatQueues','FaxQueues','SmsQueues','MailQueues','OpenchannelQueues','WhatsappQueues','findAll','IvrCampaigns','UserProfileResource','resourceId','where','role','telephone','Campaign','type','format','length','user:%s','find','userProfileId','handshake','query','ChatInteraction','ChatInteractions','MailInteraction','FaxInteraction','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','voice:inbound','hasOwnProperty','include','push','VoiceQueue','ChatQueue','FaxQueue','SmsQueue','MailQueue','OpenchannelQueue','WhatsappQueue','Trunk','Trunks','voice:outbound','getVoiceQueues','getFaxQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','chat','fax','mail','openchannel','telephone:%s','trunk:%s','leave','map','removeChatInteractions','user_has_chat_interactions:remove','removeMailInteractions','emit','user_has_mail_interactions:remove','removeFaxInteractions','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','default','setMaxListeners','address','request','connection','remotePort'];(function(_0x5f3459,_0x16c66d){var _0x44952a=function(_0x2a5b4b){while(--_0x2a5b4b){_0x5f3459['push'](_0x5f3459['shift']());}};_0x44952a(++_0x16c66d);}(_0x85ed,0x1e7));var _0xd85e=function(_0x1a36a5,_0x746928){_0x1a36a5=_0x1a36a5-0x0;var _0x746243=_0x85ed[_0x1a36a5];return _0x746243;};'use strict';var _=require(_0xd85e('0x0'));var util=require('util');var BPromise=require('bluebird');var db=require('../mysqldb')['db'];var config=require(_0xd85e('0x1'));var queryQueues={'attributes':['id',_0xd85e('0x2')],'include':[{'as':_0xd85e('0x3'),'model':db[_0xd85e('0x4')],'attributes':['id',_0xd85e('0x2'),'role'],'raw':!![],'where':{'role':_0xd85e('0x5')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id','name'],'where':{'role':'telephone'}};var queryTrunks={'raw':!![],'attributes':['id','name']};var queryAgents={'raw':!![],'attributes':['id',_0xd85e('0x2')],'where':{'role':_0xd85e('0x5')}};var queryCampaigns={'raw':!![],'attributes':['id',_0xd85e('0x2'),'type'],'where':{'type':'ivr'}};function getAssociatedResources(_0x38b4ce,_0x4326f9,_0x146a50){return db[_0xd85e('0x6')]['findOne']({'where':{'name':_0x38b4ce,'userProfileId':_0x4326f9},'raw':!![]})[_0xd85e('0x7')](function(_0xf28f6c){if(_0xf28f6c){if(_0xf28f6c[_0xd85e('0x8')]){switch(_0x38b4ce){case _0xd85e('0x9'):case _0xd85e('0xa'):case _0xd85e('0xb'):case _0xd85e('0xc'):case _0xd85e('0xd'):case _0xd85e('0xe'):case _0xd85e('0xf'):return db[_0x146a50][_0xd85e('0x10')](queryQueues);case'Telephones':return db[_0x146a50][_0xd85e('0x10')](queryTelephones);case'Trunks':return db[_0x146a50]['findAll'](queryTrunks);case _0xd85e('0x11'):return db[_0x146a50]['findAll'](queryCampaigns);}}else{return db[_0xd85e('0x12')][_0xd85e('0x10')]({'attributes':[_0xd85e('0x13')],'where':{'sectionId':_0xf28f6c['id']},'raw':!![]})['then'](function(_0xb9bb50){if(_0xb9bb50){var _0xc59173={'where':{'id':_['map'](_0xb9bb50,_0xd85e('0x13'))},'raw':!![]};switch(_0x146a50){case _0xd85e('0x4'):_0xc59173[_0xd85e('0x14')][_0xd85e('0x15')]=_0xd85e('0x16');break;case _0xd85e('0x17'):_0xc59173[_0xd85e('0x14')][_0xd85e('0x18')]='ivr';break;}return db[_0x146a50]['findAll'](_0xc59173);}else{return[];}});}}else{return[];}})[_0xd85e('0x7')](function(_0x6fdf2a){return _0x6fdf2a;});}function joinOrLeaveQueues(_0x3c9982,_0xf25c58,_0x1ab755,_0x311421){_0x3c9982[_0xf25c58](util[_0xd85e('0x19')]('%s:queue:%s',_0x1ab755,_0x311421[_0xd85e('0x2')]));if(_0x311421[_0xd85e('0x3')]){for(var _0x1ab42f=0x0;_0x1ab42f<_0x311421[_0xd85e('0x3')][_0xd85e('0x1a')];_0x1ab42f+=0x1){_0x3c9982[_0xf25c58](util[_0xd85e('0x19')](_0xd85e('0x1b'),_0x311421['Agents'][_0x1ab42f][_0xd85e('0x2')]));}}}function joinOrLeave(_0x3d527c,_0x41f882,_0x548163){var _0x1fd6c9;if(_0x3d527c['handshake']['query']['id']){db[_0xd85e('0x4')][_0xd85e('0x1c')]({'attributes':['id',_0xd85e('0x2'),_0xd85e('0x15'),_0xd85e('0x1d')],'where':{'id':_0x3d527c[_0xd85e('0x1e')][_0xd85e('0x1f')]['id']},'include':[{'model':db[_0xd85e('0x20')],'as':_0xd85e('0x21'),'attributes':['id'],'raw':!![]},{'model':db[_0xd85e('0x22')],'as':'MailInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xd85e('0x23')],'as':_0xd85e('0x24'),'attributes':['id'],'raw':!![]},{'model':db[_0xd85e('0x25')],'as':_0xd85e('0x26'),'attributes':['id'],'raw':!![]},{'model':db[_0xd85e('0x27')],'as':_0xd85e('0x28'),'attributes':['id'],'raw':!![]},{'model':db[_0xd85e('0x29')],'as':_0xd85e('0x2a'),'attributes':['id'],'raw':!![]}]})[_0xd85e('0x7')](function(_0x12e820){if(_0x12e820){_0x1fd6c9=_0x12e820;_0x3d527c[_0x41f882](util[_0xd85e('0x19')]('user:%s',_0x12e820[_0xd85e('0x2')]));var _0x540bd1=[];switch(_0x12e820[_0xd85e('0x15')]){case'admin':_0x3d527c[_0x41f882](_0xd85e('0x2b'));_0x3d527c[_0x41f882]('voice:outbound');if(queryQueues[_0xd85e('0x2c')](_0xd85e('0x2d'))){delete queryQueues[_0xd85e('0x2d')];}_0x540bd1[_0xd85e('0x2e')](db[_0xd85e('0x2f')][_0xd85e('0x10')](queryQueues));_0x540bd1[_0xd85e('0x2e')](db[_0xd85e('0x30')]['findAll'](queryQueues));_0x540bd1[_0xd85e('0x2e')](db[_0xd85e('0x31')][_0xd85e('0x10')](queryQueues));_0x540bd1['push'](db[_0xd85e('0x32')][_0xd85e('0x10')](queryQueues));_0x540bd1['push'](db[_0xd85e('0x33')][_0xd85e('0x10')](queryQueues));_0x540bd1['push'](db[_0xd85e('0x34')]['findAll'](queryQueues));_0x540bd1['push'](db[_0xd85e('0x35')][_0xd85e('0x10')](queryQueues));_0x540bd1[_0xd85e('0x2e')](db[_0xd85e('0x4')][_0xd85e('0x10')](queryTelephones));_0x540bd1[_0xd85e('0x2e')](db[_0xd85e('0x36')][_0xd85e('0x10')](queryTrunks));_0x540bd1[_0xd85e('0x2e')](db[_0xd85e('0x17')][_0xd85e('0x10')](queryCampaigns));_0x540bd1[_0xd85e('0x2e')](db[_0xd85e('0x4')][_0xd85e('0x10')](queryAgents));break;case'user':_0x3d527c[_0x41f882](_0xd85e('0x2b'));_0x3d527c[_0x41f882]('voice:outbound');_0x540bd1[_0xd85e('0x2e')](getAssociatedResources(_0xd85e('0x9'),_0x12e820[_0xd85e('0x1d')],_0xd85e('0x2f')));_0x540bd1[_0xd85e('0x2e')](getAssociatedResources(_0xd85e('0xa'),_0x12e820[_0xd85e('0x1d')],_0xd85e('0x30')));_0x540bd1[_0xd85e('0x2e')](getAssociatedResources(_0xd85e('0xb'),_0x12e820[_0xd85e('0x1d')],_0xd85e('0x31')));_0x540bd1[_0xd85e('0x2e')](getAssociatedResources('SmsQueues',_0x12e820[_0xd85e('0x1d')],_0xd85e('0x32')));_0x540bd1[_0xd85e('0x2e')](getAssociatedResources(_0xd85e('0xd'),_0x12e820[_0xd85e('0x1d')],'MailQueue'));_0x540bd1[_0xd85e('0x2e')](getAssociatedResources(_0xd85e('0xe'),_0x12e820[_0xd85e('0x1d')],_0xd85e('0x34')));_0x540bd1[_0xd85e('0x2e')](getAssociatedResources(_0xd85e('0xf'),_0x12e820[_0xd85e('0x1d')],_0xd85e('0x35')));_0x540bd1[_0xd85e('0x2e')](getAssociatedResources('Telephones',_0x12e820[_0xd85e('0x1d')],_0xd85e('0x4')));_0x540bd1[_0xd85e('0x2e')](getAssociatedResources(_0xd85e('0x37'),_0x12e820[_0xd85e('0x1d')],_0xd85e('0x36')));_0x540bd1[_0xd85e('0x2e')](getAssociatedResources(_0xd85e('0x11'),_0x12e820['userProfileId'],'Campaign'));_0x540bd1['push'](db[_0xd85e('0x4')][_0xd85e('0x10')](queryAgents));break;case _0xd85e('0x5'):_0x3d527c[_0x41f882]('voice:inbound');_0x3d527c[_0x41f882](_0xd85e('0x38'));_0x540bd1[_0xd85e('0x2e')](_0x12e820[_0xd85e('0x39')]({'attributes':['id',_0xd85e('0x2')]}));_0x540bd1[_0xd85e('0x2e')](_0x12e820['getChatQueues']({'attributes':['id',_0xd85e('0x2')]}));_0x540bd1[_0xd85e('0x2e')](_0x12e820[_0xd85e('0x3a')]({'attributes':['id',_0xd85e('0x2')]}));_0x540bd1['push'](_0x12e820[_0xd85e('0x3b')]({'attributes':['id',_0xd85e('0x2')]}));_0x540bd1[_0xd85e('0x2e')](_0x12e820[_0xd85e('0x3c')]({'attributes':['id',_0xd85e('0x2')]}));_0x540bd1['push'](_0x12e820[_0xd85e('0x3d')]({'attributes':['id',_0xd85e('0x2')]}));_0x540bd1['push'](_0x12e820['getWhatsappQueues']({'attributes':['id',_0xd85e('0x2')]}));break;}return BPromise['all'](_0x540bd1);}})[_0xd85e('0x7')](function(_0x3d8e39){if(_0x3d8e39&&_0x3d8e39['length']){for(var _0x26eec0=0x0;_0x26eec0<_0x3d8e39['length'];_0x26eec0+=0x1){for(var _0x4f44a4=0x0;_0x4f44a4<_0x3d8e39[_0x26eec0]['length'];_0x4f44a4+=0x1){switch(_0x26eec0){case 0x0:joinOrLeaveQueues(_0x3d527c,_0x41f882,'voice',_0x3d8e39[_0x26eec0][_0x4f44a4]);break;case 0x1:joinOrLeaveQueues(_0x3d527c,_0x41f882,_0xd85e('0x3e'),_0x3d8e39[_0x26eec0][_0x4f44a4]);break;case 0x2:joinOrLeaveQueues(_0x3d527c,_0x41f882,_0xd85e('0x3f'),_0x3d8e39[_0x26eec0][_0x4f44a4]);break;case 0x3:joinOrLeaveQueues(_0x3d527c,_0x41f882,'sms',_0x3d8e39[_0x26eec0][_0x4f44a4]);break;case 0x4:joinOrLeaveQueues(_0x3d527c,_0x41f882,_0xd85e('0x40'),_0x3d8e39[_0x26eec0][_0x4f44a4]);break;case 0x5:joinOrLeaveQueues(_0x3d527c,_0x41f882,_0xd85e('0x41'),_0x3d8e39[_0x26eec0][_0x4f44a4]);break;case 0x6:joinOrLeaveQueues(_0x3d527c,_0x41f882,'whatsapp',_0x3d8e39[_0x26eec0][_0x4f44a4]);break;case 0x7:if(_0x1fd6c9[_0xd85e('0x15')]!==_0xd85e('0x5'))_0x3d527c[_0x41f882](util[_0xd85e('0x19')](_0xd85e('0x42'),_0x3d8e39[_0x26eec0][_0x4f44a4][_0xd85e('0x2')]));break;case 0x8:if(_0x1fd6c9['role']!==_0xd85e('0x5'))_0x3d527c[_0x41f882](util[_0xd85e('0x19')](_0xd85e('0x43'),_0x3d8e39[_0x26eec0][_0x4f44a4][_0xd85e('0x2')]));break;case 0x9:if(_0x1fd6c9[_0xd85e('0x15')]!==_0xd85e('0x5'))_0x3d527c[_0x41f882](util[_0xd85e('0x19')]('campaign:%s:%s',_0x3d8e39[_0x26eec0][_0x4f44a4]['type'],_0x3d8e39[_0x26eec0][_0x4f44a4]['name']));break;case 0xa:_0x3d527c[_0x41f882](util[_0xd85e('0x19')]('user:%s',_0x3d8e39[_0x26eec0][_0x4f44a4]['name']));break;}}}}})['then'](function(){if(_0x41f882===_0xd85e('0x44')){var _0x2c94f7=_[_0xd85e('0x45')](_0x1fd6c9[_0xd85e('0x21')],'id');return _0x1fd6c9[_0xd85e('0x46')](_0x2c94f7)[_0xd85e('0x7')](function(){for(var _0x3314e6=0x0;_0x3314e6<_0x2c94f7['length'];_0x3314e6+=0x1){_0x548163['emit'](_0xd85e('0x47'),{'ChatInteractionId':Number(_0x2c94f7[_0x3314e6]),'UserId':Number(_0x1fd6c9['id'])});}});}})[_0xd85e('0x7')](function(){if(_0x41f882==='leave'){var _0x39de7a=_['map'](_0x1fd6c9['MailInteractions'],'id');return _0x1fd6c9[_0xd85e('0x48')](_0x39de7a)['then'](function(){for(var _0x4afe9b=0x0;_0x4afe9b<_0x39de7a[_0xd85e('0x1a')];_0x4afe9b+=0x1){_0x548163[_0xd85e('0x49')](_0xd85e('0x4a'),{'MailInteractionId':Number(_0x39de7a[_0x4afe9b]),'UserId':Number(_0x1fd6c9['id'])});}});}})[_0xd85e('0x7')](function(){if(_0x41f882===_0xd85e('0x44')){var _0x47963a=_[_0xd85e('0x45')](_0x1fd6c9[_0xd85e('0x24')],'id');return _0x1fd6c9[_0xd85e('0x4b')](_0x47963a)['then'](function(){for(var _0x1633a2=0x0;_0x1633a2<_0x47963a[_0xd85e('0x1a')];_0x1633a2+=0x1){_0x548163[_0xd85e('0x49')](_0xd85e('0x4c'),{'FaxInteractionId':Number(_0x47963a[_0x1633a2]),'UserId':Number(_0x1fd6c9['id'])});}});}})['then'](function(){if(_0x41f882==='leave'){var _0x17a047=_[_0xd85e('0x45')](_0x1fd6c9[_0xd85e('0x26')],'id');return _0x1fd6c9[_0xd85e('0x4d')](_0x17a047)[_0xd85e('0x7')](function(){for(var _0x4ce0e1=0x0;_0x4ce0e1<_0x17a047['length'];_0x4ce0e1+=0x1){_0x548163['emit'](_0xd85e('0x4e'),{'SmsInteractionId':Number(_0x17a047[_0x4ce0e1]),'UserId':Number(_0x1fd6c9['id'])});}});}})['then'](function(){if(_0x41f882===_0xd85e('0x44')){var _0x533afe=_[_0xd85e('0x45')](_0x1fd6c9[_0xd85e('0x28')],'id');return _0x1fd6c9[_0xd85e('0x4f')](_0x533afe)[_0xd85e('0x7')](function(){for(var _0x635fb4=0x0;_0x635fb4<_0x533afe[_0xd85e('0x1a')];_0x635fb4+=0x1){_0x548163[_0xd85e('0x49')]('user_has_openchannel_interactions:remove',{'OpenchannelInteractionId':Number(_0x533afe[_0x635fb4]),'UserId':Number(_0x1fd6c9['id'])});}});}})[_0xd85e('0x7')](function(){if(_0x41f882==='leave'){var _0x11ccea=_[_0xd85e('0x45')](_0x1fd6c9[_0xd85e('0x2a')],'id');return _0x1fd6c9[_0xd85e('0x50')](_0x11ccea)[_0xd85e('0x7')](function(){for(var _0x553417=0x0;_0x553417<_0x11ccea[_0xd85e('0x1a')];_0x553417+=0x1){_0x548163[_0xd85e('0x49')](_0xd85e('0x51'),{'WhatsappInteractionId':Number(_0x11ccea[_0x553417]),'UserId':Number(_0x1fd6c9['id'])});}});}})[_0xd85e('0x52')](function(_0x2d33a1){_0x3d527c['log'](_0x2d33a1);});}}function onDisconnect(_0x26abbe,_0x356b87){joinOrLeave(_0x26abbe,_0xd85e('0x44'),_0x356b87);}function onConnect(_0x1dcd95){joinOrLeave(_0x1dcd95,'join');}exports[_0xd85e('0x53')]=function(_0x5e35e2){_0x5e35e2['on']('connection',function(_0x23b404){_0x23b404[_0xd85e('0x54')](0x0);_0x23b404[_0xd85e('0x55')]=_0x23b404[_0xd85e('0x56')][_0xd85e('0x57')]['remoteAddress']+':'+_0x23b404[_0xd85e('0x56')][_0xd85e('0x57')][_0xd85e('0x58')];_0x23b404[_0xd85e('0x59')]=new Date();_0x23b404[_0xd85e('0x5a')]=function(_0x1cbc10){console[_0xd85e('0x5a')](_0xd85e('0x5b')+_0x23b404[_0xd85e('0x5c')][_0xd85e('0x2')]+'['+_0x23b404[_0xd85e('0x55')]+']',_0x1cbc10);};_0x23b404['on'](_0xd85e('0x5d'),function(){onDisconnect(_0x23b404,_0x5e35e2);_0x23b404[_0xd85e('0x5a')](_0xd85e('0x5e'));});onConnect(_0x23b404);_0x23b404[_0xd85e('0x5a')](_0xd85e('0x5f'));});}; \ No newline at end of file +var _0x682b=['%s:queue:%s','Agents','length','user:%s','handshake','query','find','userProfileId','MailInteraction','FaxInteraction','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','admin','voice:inbound','voice:outbound','hasOwnProperty','include','push','VoiceQueue','ChatQueue','SmsQueue','MailQueue','OpenchannelQueue','WhatsappQueue','Trunk','user','FaxQueue','getVoiceQueues','getFaxQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','all','voice','fax','sms','whatsapp','trunk:%s','campaign:%s:%s','ChatInteractions','removeChatInteractions','user_has_chat_interactions:remove','leave','MailInteractions','removeMailInteractions','emit','user_has_mail_interactions:remove','removeFaxInteractions','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','catch','log','join','default','connection','setMaxListeners','address','request','remoteAddress','connectedAt','SocketIO\x20','nsp','disconnect','DISCONNECTED','lodash','util','../mysqldb','name','User','role','agent','telephone','ivr','UserProfileSection','then','autoAssociation','VoiceQueues','ChatQueues','FaxQueues','SmsQueues','MailQueues','OpenchannelQueues','findAll','Telephones','Trunks','IvrCampaigns','UserProfileResource','map','resourceId','where','Campaign','type','format'];(function(_0x58bc47,_0xe8dbd){var _0x435287=function(_0x4ae823){while(--_0x4ae823){_0x58bc47['push'](_0x58bc47['shift']());}};_0x435287(++_0xe8dbd);}(_0x682b,0x1e1));var _0xb682=function(_0xc4001c,_0x1bf8f0){_0xc4001c=_0xc4001c-0x0;var _0x49f7bc=_0x682b[_0xc4001c];return _0x49f7bc;};'use strict';var _=require(_0xb682('0x0'));var util=require(_0xb682('0x1'));var BPromise=require('bluebird');var db=require(_0xb682('0x2'))['db'];var config=require('./environment');var queryQueues={'attributes':['id',_0xb682('0x3')],'include':[{'as':'Agents','model':db[_0xb682('0x4')],'attributes':['id','name',_0xb682('0x5')],'raw':!![],'where':{'role':_0xb682('0x6')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0xb682('0x3')],'where':{'role':_0xb682('0x7')}};var queryTrunks={'raw':!![],'attributes':['id','name']};var queryAgents={'raw':!![],'attributes':['id',_0xb682('0x3')],'where':{'role':_0xb682('0x6')}};var queryCampaigns={'raw':!![],'attributes':['id',_0xb682('0x3'),'type'],'where':{'type':_0xb682('0x8')}};function getAssociatedResources(_0x2dbf40,_0x47f117,_0x5e9c1c){return db[_0xb682('0x9')]['findOne']({'where':{'name':_0x2dbf40,'userProfileId':_0x47f117},'raw':!![]})[_0xb682('0xa')](function(_0x341c35){if(_0x341c35){if(_0x341c35[_0xb682('0xb')]){switch(_0x2dbf40){case _0xb682('0xc'):case _0xb682('0xd'):case _0xb682('0xe'):case _0xb682('0xf'):case _0xb682('0x10'):case _0xb682('0x11'):case'WhatsappQueues':return db[_0x5e9c1c][_0xb682('0x12')](queryQueues);case _0xb682('0x13'):return db[_0x5e9c1c][_0xb682('0x12')](queryTelephones);case _0xb682('0x14'):return db[_0x5e9c1c][_0xb682('0x12')](queryTrunks);case _0xb682('0x15'):return db[_0x5e9c1c][_0xb682('0x12')](queryCampaigns);}}else{return db[_0xb682('0x16')]['findAll']({'attributes':['resourceId'],'where':{'sectionId':_0x341c35['id']},'raw':!![]})[_0xb682('0xa')](function(_0x39ded5){if(_0x39ded5){var _0x2b8981={'where':{'id':_[_0xb682('0x17')](_0x39ded5,_0xb682('0x18'))},'raw':!![]};switch(_0x5e9c1c){case _0xb682('0x4'):_0x2b8981[_0xb682('0x19')]['role']=_0xb682('0x7');break;case _0xb682('0x1a'):_0x2b8981['where'][_0xb682('0x1b')]=_0xb682('0x8');break;}return db[_0x5e9c1c][_0xb682('0x12')](_0x2b8981);}else{return[];}});}}else{return[];}})['then'](function(_0x332876){return _0x332876;});}function joinOrLeaveQueues(_0x1d3cbd,_0x2b5b84,_0x4aec63,_0x259616){_0x1d3cbd[_0x2b5b84](util[_0xb682('0x1c')](_0xb682('0x1d'),_0x4aec63,_0x259616['name']));if(_0x259616[_0xb682('0x1e')]){for(var _0x1cad88=0x0;_0x1cad88<_0x259616[_0xb682('0x1e')][_0xb682('0x1f')];_0x1cad88+=0x1){_0x1d3cbd[_0x2b5b84](util[_0xb682('0x1c')](_0xb682('0x20'),_0x259616[_0xb682('0x1e')][_0x1cad88][_0xb682('0x3')]));}}}function joinOrLeave(_0x30f251,_0x3cc515,_0x1532ff){var _0x24aa65;if(_0x30f251[_0xb682('0x21')][_0xb682('0x22')]['id']){db[_0xb682('0x4')][_0xb682('0x23')]({'attributes':['id',_0xb682('0x3'),'role',_0xb682('0x24')],'where':{'id':_0x30f251[_0xb682('0x21')][_0xb682('0x22')]['id']},'include':[{'model':db['ChatInteraction'],'as':'ChatInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xb682('0x25')],'as':'MailInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xb682('0x26')],'as':_0xb682('0x27'),'attributes':['id'],'raw':!![]},{'model':db[_0xb682('0x28')],'as':_0xb682('0x29'),'attributes':['id'],'raw':!![]},{'model':db[_0xb682('0x2a')],'as':_0xb682('0x2b'),'attributes':['id'],'raw':!![]},{'model':db[_0xb682('0x2c')],'as':'WhatsappInteractions','attributes':['id'],'raw':!![]}]})['then'](function(_0x32eaf4){if(_0x32eaf4){_0x24aa65=_0x32eaf4;_0x30f251[_0x3cc515](util[_0xb682('0x1c')](_0xb682('0x20'),_0x32eaf4['name']));var _0x572ac7=[];switch(_0x32eaf4[_0xb682('0x5')]){case _0xb682('0x2d'):_0x30f251[_0x3cc515](_0xb682('0x2e'));_0x30f251[_0x3cc515](_0xb682('0x2f'));if(queryQueues[_0xb682('0x30')]('include')){delete queryQueues[_0xb682('0x31')];}_0x572ac7[_0xb682('0x32')](db[_0xb682('0x33')][_0xb682('0x12')](queryQueues));_0x572ac7[_0xb682('0x32')](db[_0xb682('0x34')][_0xb682('0x12')](queryQueues));_0x572ac7[_0xb682('0x32')](db['FaxQueue'][_0xb682('0x12')](queryQueues));_0x572ac7[_0xb682('0x32')](db[_0xb682('0x35')]['findAll'](queryQueues));_0x572ac7[_0xb682('0x32')](db[_0xb682('0x36')][_0xb682('0x12')](queryQueues));_0x572ac7[_0xb682('0x32')](db[_0xb682('0x37')]['findAll'](queryQueues));_0x572ac7[_0xb682('0x32')](db[_0xb682('0x38')][_0xb682('0x12')](queryQueues));_0x572ac7[_0xb682('0x32')](db[_0xb682('0x4')][_0xb682('0x12')](queryTelephones));_0x572ac7[_0xb682('0x32')](db[_0xb682('0x39')]['findAll'](queryTrunks));_0x572ac7[_0xb682('0x32')](db[_0xb682('0x1a')]['findAll'](queryCampaigns));_0x572ac7[_0xb682('0x32')](db[_0xb682('0x4')][_0xb682('0x12')](queryAgents));break;case _0xb682('0x3a'):_0x30f251[_0x3cc515](_0xb682('0x2e'));_0x30f251[_0x3cc515]('voice:outbound');_0x572ac7[_0xb682('0x32')](getAssociatedResources(_0xb682('0xc'),_0x32eaf4[_0xb682('0x24')],_0xb682('0x33')));_0x572ac7[_0xb682('0x32')](getAssociatedResources(_0xb682('0xd'),_0x32eaf4[_0xb682('0x24')],_0xb682('0x34')));_0x572ac7[_0xb682('0x32')](getAssociatedResources(_0xb682('0xe'),_0x32eaf4[_0xb682('0x24')],_0xb682('0x3b')));_0x572ac7[_0xb682('0x32')](getAssociatedResources(_0xb682('0xf'),_0x32eaf4['userProfileId'],_0xb682('0x35')));_0x572ac7[_0xb682('0x32')](getAssociatedResources(_0xb682('0x10'),_0x32eaf4[_0xb682('0x24')],_0xb682('0x36')));_0x572ac7[_0xb682('0x32')](getAssociatedResources('OpenchannelQueues',_0x32eaf4[_0xb682('0x24')],'OpenchannelQueue'));_0x572ac7['push'](getAssociatedResources('WhatsappQueues',_0x32eaf4['userProfileId'],_0xb682('0x38')));_0x572ac7[_0xb682('0x32')](getAssociatedResources('Telephones',_0x32eaf4[_0xb682('0x24')],'User'));_0x572ac7['push'](getAssociatedResources(_0xb682('0x14'),_0x32eaf4[_0xb682('0x24')],_0xb682('0x39')));_0x572ac7[_0xb682('0x32')](getAssociatedResources(_0xb682('0x15'),_0x32eaf4['userProfileId'],_0xb682('0x1a')));_0x572ac7[_0xb682('0x32')](db['User'][_0xb682('0x12')](queryAgents));break;case _0xb682('0x6'):_0x30f251[_0x3cc515](_0xb682('0x2e'));_0x30f251[_0x3cc515](_0xb682('0x2f'));_0x572ac7['push'](_0x32eaf4[_0xb682('0x3c')]({'attributes':['id',_0xb682('0x3')]}));_0x572ac7[_0xb682('0x32')](_0x32eaf4['getChatQueues']({'attributes':['id',_0xb682('0x3')]}));_0x572ac7[_0xb682('0x32')](_0x32eaf4[_0xb682('0x3d')]({'attributes':['id','name']}));_0x572ac7[_0xb682('0x32')](_0x32eaf4[_0xb682('0x3e')]({'attributes':['id',_0xb682('0x3')]}));_0x572ac7[_0xb682('0x32')](_0x32eaf4[_0xb682('0x3f')]({'attributes':['id',_0xb682('0x3')]}));_0x572ac7[_0xb682('0x32')](_0x32eaf4[_0xb682('0x40')]({'attributes':['id','name']}));_0x572ac7['push'](_0x32eaf4[_0xb682('0x41')]({'attributes':['id',_0xb682('0x3')]}));break;}return BPromise[_0xb682('0x42')](_0x572ac7);}})[_0xb682('0xa')](function(_0x570ac4){if(_0x570ac4&&_0x570ac4['length']){for(var _0x531e03=0x0;_0x531e03<_0x570ac4[_0xb682('0x1f')];_0x531e03+=0x1){for(var _0x1ea1b3=0x0;_0x1ea1b3<_0x570ac4[_0x531e03][_0xb682('0x1f')];_0x1ea1b3+=0x1){switch(_0x531e03){case 0x0:joinOrLeaveQueues(_0x30f251,_0x3cc515,_0xb682('0x43'),_0x570ac4[_0x531e03][_0x1ea1b3]);break;case 0x1:joinOrLeaveQueues(_0x30f251,_0x3cc515,'chat',_0x570ac4[_0x531e03][_0x1ea1b3]);break;case 0x2:joinOrLeaveQueues(_0x30f251,_0x3cc515,_0xb682('0x44'),_0x570ac4[_0x531e03][_0x1ea1b3]);break;case 0x3:joinOrLeaveQueues(_0x30f251,_0x3cc515,_0xb682('0x45'),_0x570ac4[_0x531e03][_0x1ea1b3]);break;case 0x4:joinOrLeaveQueues(_0x30f251,_0x3cc515,'mail',_0x570ac4[_0x531e03][_0x1ea1b3]);break;case 0x5:joinOrLeaveQueues(_0x30f251,_0x3cc515,'openchannel',_0x570ac4[_0x531e03][_0x1ea1b3]);break;case 0x6:joinOrLeaveQueues(_0x30f251,_0x3cc515,_0xb682('0x46'),_0x570ac4[_0x531e03][_0x1ea1b3]);break;case 0x7:if(_0x24aa65[_0xb682('0x5')]!=='agent')_0x30f251[_0x3cc515](util[_0xb682('0x1c')]('telephone:%s',_0x570ac4[_0x531e03][_0x1ea1b3][_0xb682('0x3')]));break;case 0x8:if(_0x24aa65[_0xb682('0x5')]!==_0xb682('0x6'))_0x30f251[_0x3cc515](util[_0xb682('0x1c')](_0xb682('0x47'),_0x570ac4[_0x531e03][_0x1ea1b3][_0xb682('0x3')]));break;case 0x9:if(_0x24aa65[_0xb682('0x5')]!==_0xb682('0x6'))_0x30f251[_0x3cc515](util[_0xb682('0x1c')](_0xb682('0x48'),_0x570ac4[_0x531e03][_0x1ea1b3][_0xb682('0x1b')],_0x570ac4[_0x531e03][_0x1ea1b3][_0xb682('0x3')]));break;case 0xa:_0x30f251[_0x3cc515](util[_0xb682('0x1c')](_0xb682('0x20'),_0x570ac4[_0x531e03][_0x1ea1b3][_0xb682('0x3')]));break;}}}}})['then'](function(){if(_0x3cc515==='leave'){var _0x15d2ab=_[_0xb682('0x17')](_0x24aa65[_0xb682('0x49')],'id');return _0x24aa65[_0xb682('0x4a')](_0x15d2ab)[_0xb682('0xa')](function(){for(var _0x10a310=0x0;_0x10a310<_0x15d2ab[_0xb682('0x1f')];_0x10a310+=0x1){_0x1532ff['emit'](_0xb682('0x4b'),{'ChatInteractionId':Number(_0x15d2ab[_0x10a310]),'UserId':Number(_0x24aa65['id'])});}});}})[_0xb682('0xa')](function(){if(_0x3cc515===_0xb682('0x4c')){var _0x1020ba=_[_0xb682('0x17')](_0x24aa65[_0xb682('0x4d')],'id');return _0x24aa65[_0xb682('0x4e')](_0x1020ba)['then'](function(){for(var _0x5a8219=0x0;_0x5a8219<_0x1020ba['length'];_0x5a8219+=0x1){_0x1532ff[_0xb682('0x4f')](_0xb682('0x50'),{'MailInteractionId':Number(_0x1020ba[_0x5a8219]),'UserId':Number(_0x24aa65['id'])});}});}})[_0xb682('0xa')](function(){if(_0x3cc515==='leave'){var _0x69a923=_[_0xb682('0x17')](_0x24aa65[_0xb682('0x27')],'id');return _0x24aa65[_0xb682('0x51')](_0x69a923)[_0xb682('0xa')](function(){for(var _0xc7b344=0x0;_0xc7b344<_0x69a923['length'];_0xc7b344+=0x1){_0x1532ff['emit'](_0xb682('0x52'),{'FaxInteractionId':Number(_0x69a923[_0xc7b344]),'UserId':Number(_0x24aa65['id'])});}});}})[_0xb682('0xa')](function(){if(_0x3cc515===_0xb682('0x4c')){var _0x38b66a=_['map'](_0x24aa65['SmsInteractions'],'id');return _0x24aa65[_0xb682('0x53')](_0x38b66a)[_0xb682('0xa')](function(){for(var _0x4bdde5=0x0;_0x4bdde5<_0x38b66a['length'];_0x4bdde5+=0x1){_0x1532ff[_0xb682('0x4f')](_0xb682('0x54'),{'SmsInteractionId':Number(_0x38b66a[_0x4bdde5]),'UserId':Number(_0x24aa65['id'])});}});}})[_0xb682('0xa')](function(){if(_0x3cc515===_0xb682('0x4c')){var _0x224c4f=_[_0xb682('0x17')](_0x24aa65[_0xb682('0x2b')],'id');return _0x24aa65[_0xb682('0x55')](_0x224c4f)[_0xb682('0xa')](function(){for(var _0x3486f5=0x0;_0x3486f5<_0x224c4f[_0xb682('0x1f')];_0x3486f5+=0x1){_0x1532ff[_0xb682('0x4f')](_0xb682('0x56'),{'OpenchannelInteractionId':Number(_0x224c4f[_0x3486f5]),'UserId':Number(_0x24aa65['id'])});}});}})[_0xb682('0xa')](function(){if(_0x3cc515===_0xb682('0x4c')){var _0x1b53ad=_['map'](_0x24aa65['WhatsappInteractions'],'id');return _0x24aa65[_0xb682('0x57')](_0x1b53ad)[_0xb682('0xa')](function(){for(var _0x4dd4ec=0x0;_0x4dd4ec<_0x1b53ad[_0xb682('0x1f')];_0x4dd4ec+=0x1){_0x1532ff[_0xb682('0x4f')]('user_has_whatsapp_interactions:remove',{'WhatsappInteractionId':Number(_0x1b53ad[_0x4dd4ec]),'UserId':Number(_0x24aa65['id'])});}});}})[_0xb682('0x58')](function(_0x82dbd6){_0x30f251[_0xb682('0x59')](_0x82dbd6);});}}function onDisconnect(_0x2231cc,_0x7aca88){joinOrLeave(_0x2231cc,_0xb682('0x4c'),_0x7aca88);}function onConnect(_0x5e4f7a){joinOrLeave(_0x5e4f7a,_0xb682('0x5a'));}exports[_0xb682('0x5b')]=function(_0x3c79d1){_0x3c79d1['on'](_0xb682('0x5c'),function(_0x4dd550){_0x4dd550[_0xb682('0x5d')](0x0);_0x4dd550[_0xb682('0x5e')]=_0x4dd550[_0xb682('0x5f')]['connection'][_0xb682('0x60')]+':'+_0x4dd550[_0xb682('0x5f')]['connection']['remotePort'];_0x4dd550[_0xb682('0x61')]=new Date();_0x4dd550[_0xb682('0x59')]=function(_0x932d69){console[_0xb682('0x59')](_0xb682('0x62')+_0x4dd550[_0xb682('0x63')][_0xb682('0x3')]+'['+_0x4dd550[_0xb682('0x5e')]+']',_0x932d69);};_0x4dd550['on'](_0xb682('0x64'),function(){onDisconnect(_0x4dd550,_0x3c79d1);_0x4dd550[_0xb682('0x59')](_0xb682('0x65'));});onConnect(_0x4dd550);_0x4dd550[_0xb682('0x59')]('CONNECTED');});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index 132f076..8d040d7 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 _0x72c2=['ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','UserId','User','name','format','SIP/%s','incomingmessage','CmContact','cf_','query','closed','find','interface','model','hook','callback','toLowerCase','condition','jayson/promise','../logger','triggers','client','http','Chat','ChatInteraction','afterCreate','newinteraction','afterUpdate','closedinteraction','ChatMessage','newmessage','Sms','SmsInteraction','SmsMessage','Whatsapp','WhatsappInteraction','WhatsappMessage','Fax','FaxInteraction','FaxMessage','Mail','MailInteraction','MailMessage','Openchannel','OpenchannelInteraction','OpenchannelMessage','request','EventManager','then','Trigger,\x20%s','error','code','catch','get','channel','event','direction','describe','keys','length','push','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'];(function(_0x8c6eee,_0x21f601){var _0x5a03b5=function(_0x55599d){while(--_0x55599d){_0x8c6eee['push'](_0x8c6eee['shift']());}};_0x5a03b5(++_0x21f601);}(_0x72c2,0x1a9));var _0x272c=function(_0x504bb5,_0x5669d3){_0x504bb5=_0x504bb5-0x0;var _0x5d1c05=_0x72c2[_0x504bb5];return _0x5d1c05;};'use strict';var util=require('util');var db=require('../../mysqldb')['db'];var jayson=require(_0x272c('0x0'));var logger=require(_0x272c('0x1'))(_0x272c('0x2'));var _=require('lodash');var client=jayson[_0x272c('0x3')][_0x272c('0x4')]({'port':0x232a});var triggers=[{'channel':_0x272c('0x5'),'model':_0x272c('0x6'),'event':_0x272c('0x7'),'condition':_0x272c('0x8'),'callback':afterCreate},{'channel':'Chat','model':'ChatInteraction','event':_0x272c('0x9'),'condition':_0x272c('0xa'),'callback':afterUpdate},{'channel':_0x272c('0x5'),'model':_0x272c('0xb'),'event':'afterCreate','condition':_0x272c('0xc'),'callback':afterCreateMessage},{'channel':_0x272c('0xd'),'model':'SmsInteraction','event':'afterCreate','condition':'newinteraction','callback':afterCreate},{'channel':_0x272c('0xd'),'model':_0x272c('0xe'),'event':_0x272c('0x9'),'condition':_0x272c('0xa'),'callback':afterUpdate},{'channel':_0x272c('0xd'),'model':_0x272c('0xf'),'event':_0x272c('0x7'),'condition':_0x272c('0xc'),'callback':afterCreateMessage},{'channel':_0x272c('0x10'),'model':_0x272c('0x11'),'event':'afterCreate','condition':'newinteraction','callback':afterCreate},{'channel':_0x272c('0x10'),'model':_0x272c('0x11'),'event':'afterUpdate','condition':_0x272c('0xa'),'callback':afterUpdate},{'channel':_0x272c('0x10'),'model':_0x272c('0x12'),'event':_0x272c('0x7'),'condition':_0x272c('0xc'),'callback':afterCreateMessage},{'channel':_0x272c('0x13'),'model':_0x272c('0x14'),'event':_0x272c('0x7'),'condition':'newinteraction','callback':afterCreate},{'channel':_0x272c('0x13'),'model':_0x272c('0x14'),'event':_0x272c('0x9'),'condition':_0x272c('0xa'),'callback':afterUpdate},{'channel':_0x272c('0x13'),'model':_0x272c('0x15'),'event':'afterCreate','condition':_0x272c('0xc'),'callback':afterCreateMessage},{'channel':_0x272c('0x16'),'model':_0x272c('0x17'),'event':_0x272c('0x7'),'condition':_0x272c('0x8'),'callback':afterCreate},{'channel':_0x272c('0x16'),'model':_0x272c('0x17'),'event':_0x272c('0x9'),'condition':_0x272c('0xa'),'callback':afterUpdate},{'channel':'Mail','model':_0x272c('0x18'),'event':_0x272c('0x7'),'condition':'newmessage','callback':afterCreateMessage},{'channel':_0x272c('0x19'),'model':_0x272c('0x1a'),'event':'afterCreate','condition':_0x272c('0x8'),'callback':afterCreate},{'channel':_0x272c('0x19'),'model':_0x272c('0x1a'),'event':_0x272c('0x9'),'condition':_0x272c('0xa'),'callback':afterUpdate},{'channel':_0x272c('0x19'),'model':_0x272c('0x1b'),'event':_0x272c('0x7'),'condition':_0x272c('0xc'),'callback':afterCreateMessage}];function request(_0x52b365){return client[_0x272c('0x1c')](_0x272c('0x1d'),_0x52b365)[_0x272c('0x1e')](function(_0x20b2fd){logger['info'](_0x272c('0x1f'),_0x272c('0x1d'),_0x20b2fd);if(_0x20b2fd[_0x272c('0x20')]){if(_0x20b2fd[_0x272c('0x20')][_0x272c('0x21')]===0x1f4){logger[_0x272c('0x20')](_0x272c('0x1f'),_0x272c('0x1d'),_0x20b2fd['error']);}}})[_0x272c('0x22')](function(_0x3c3a04){logger[_0x272c('0x20')]('Trigger,\x20%s',_0x272c('0x1d'),_0x3c3a04);});}function afterCreateMessage(_0xef5560,_0x1bd176){return function(_0x43f74e,_0x2e6fb7){_0x43f74e=_0x43f74e[_0x272c('0x23')]({'plain':!![]});_0x43f74e[_0x272c('0x24')]=_0xef5560;_0x43f74e[_0x272c('0x25')]=_0x43f74e[_0x272c('0x26')];return db['CmContact'][_0x272c('0x27')]()['then'](function(_0x35c451){var _0xcdd874=[];for(var _0x1f55d7=0x0;_0x1f55d7=_0x38e52e[_0xcf34('0x14')]){throw Error(_0xcf34('0x15'));}_0x24dc5d(_0x24642e);})[_0xcf34('0x16')](function(_0x37e261){_0x5ef09c(_0x37e261);});});}; \ No newline at end of file +var _0x7a34=['catch','lodash','bluebird','./license/util','mail','chat','fax','sms','whatsapp','openchannel','getChannels','isValidChannel','toLowerCase','includes','clearBlockUser','isUndefined','blockedAt','updateAttributes','role','agent','User','count','then','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached'];(function(_0x19b1dd,_0x3600f9){var _0x257877=function(_0x2cc9fe){while(--_0x2cc9fe){_0x19b1dd['push'](_0x19b1dd['shift']());}};_0x257877(++_0x3600f9);}(_0x7a34,0x187));var _0x47a3=function(_0x476a67,_0x2a8b3f){_0x476a67=_0x476a67-0x0;var _0x185467=_0x7a34[_0x476a67];return _0x185467;};'use strict';var _=require(_0x47a3('0x0'));var BPromise=require(_0x47a3('0x1'));var db=require('../mysqldb')['db'];var util=require(_0x47a3('0x2'));var channels=['voice',_0x47a3('0x3'),_0x47a3('0x4'),_0x47a3('0x5'),_0x47a3('0x6'),_0x47a3('0x7'),_0x47a3('0x8')];exports[_0x47a3('0x9')]=function(){return channels;};exports[_0x47a3('0xa')]=function(_0x174253){_0x174253=_0x174253[_0x47a3('0xb')]();return _[_0x47a3('0xc')](channels,_0x174253);};exports[_0x47a3('0xd')]=function(_0x47b342,_0x12f74e,_0x1bacff,_0x34820f){var _0x72edbd={'loginAttempts':_0x12f74e,'blocked':_0x1bacff};if(!_[_0x47a3('0xe')](_0x34820f)){_0x72edbd[_0x47a3('0xf')]=_0x34820f;}return _0x47b342[_0x47a3('0x10')](_0x72edbd);};exports['getLicense']=function(_0x3dbb9c){return new BPromise(function(_0x230fc4,_0x256e9a){var _0x34a99b=0x0;if(_0x3dbb9c[_0x47a3('0x11')]!==_0x47a3('0x12')){_0x230fc4(_0x3dbb9c);}db[_0x47a3('0x13')][_0x47a3('0x14')]({'where':{'role':_0x47a3('0x12'),'online':!![],'id':{'$ne':_0x3dbb9c['id']}}})[_0x47a3('0x15')](function(_0x4f6bf5){_0x34a99b=_0x4f6bf5;return util[_0x47a3('0x16')]();})[_0x47a3('0x15')](function(_0x3908a6){if(_0x3908a6&&_0x3908a6[_0x47a3('0x17')]&&_0x34a99b>=_0x3908a6[_0x47a3('0x17')]){throw Error(_0x47a3('0x18'));}_0x230fc4(_0x3dbb9c);})[_0x47a3('0x19')](function(_0x2b9543){_0x256e9a(_0x2b9543);});});}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index 79440dc..bf8d03c 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x602a=['status','send','exports','404'];(function(_0xd55f3e,_0x248879){var _0x2e1c94=function(_0x6896e2){while(--_0x6896e2){_0xd55f3e['push'](_0xd55f3e['shift']());}};_0x2e1c94(++_0x248879);}(_0x602a,0x1de));var _0xa602=function(_0x59309c,_0xd6b876){_0x59309c=_0x59309c-0x0;var _0x52c321=_0x602a[_0x59309c];return _0x52c321;};'use strict';module[_0xa602('0x0')][0x194]=function pageNotFound(_0x5e5dd4,_0x4dd33e){var _0x3a67a5=_0xa602('0x1');var _0x1e9fa4=0x194;var _0x4f8890={'status':_0x1e9fa4};_0x4dd33e[_0xa602('0x2')](_0x4f8890[_0xa602('0x2')]);_0x4dd33e['render'](_0x3a67a5,{},function(_0x2e5169,_0x3777ac){if(_0x2e5169){return _0x4dd33e[_0xa602('0x2')](_0x4f8890[_0xa602('0x2')])['json'](_0x4f8890);}_0x4dd33e[_0xa602('0x3')](_0x3777ac);});}; \ No newline at end of file +var _0x0664=['json','send','404','status','render'];(function(_0x58d5d4,_0x4f05a3){var _0x596a07=function(_0x34a6c6){while(--_0x34a6c6){_0x58d5d4['push'](_0x58d5d4['shift']());}};_0x596a07(++_0x4f05a3);}(_0x0664,0x93));var _0x4066=function(_0x5c86e5,_0x5478df){_0x5c86e5=_0x5c86e5-0x0;var _0x3d3e92=_0x0664[_0x5c86e5];return _0x3d3e92;};'use strict';module['exports'][0x194]=function pageNotFound(_0x111bdc,_0x4a0fa5){var _0x44240a=_0x4066('0x0');var _0x555760=0x194;var _0x42bb0c={'status':_0x555760};_0x4a0fa5[_0x4066('0x1')](_0x42bb0c[_0x4066('0x1')]);_0x4a0fa5[_0x4066('0x2')](_0x44240a,{},function(_0x362a79,_0x325e0e){if(_0x362a79){return _0x4a0fa5[_0x4066('0x1')](_0x42bb0c[_0x4066('0x1')])[_0x4066('0x3')](_0x42bb0c);}_0x4a0fa5[_0x4066('0x4')](_0x325e0e);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index 02e7919..5195e40 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb641=['Tags','mail_interaction_has_tags','ThroughTags','Users','Attachments','Interaction','Account','ChatWebsiteId','ChatOfflineMessageId','restrict','TagId','MailQueueReport','DashboardItem','Items','FaxAccountId','Exntensions','FaxApplication','Owner','fax_interaction_has_tags','FaxInteractionId','SmsAccountId','user_has_sms_accounts','SmsInteractionId','sms_interaction_has_tags','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','AttachmentId','team_has_openchannel_queues','ProactiveActions','ChatApplication','OpenchannelQueueReport','Agent','Queue','Website','ChatInteractionId','chat_interaction_has_tags','ChatOfflineMessage','team_has_chat_queues','ChatGroupId','ChatProactiveAction','Contacts','CompanyId','Company','cm_contact_has_tags','OwnerId','CampaignId','All','OneAll','AutomationAllId','Any','OneAny','AutomationAnyId','AutomationId','ParentId','IntervalId','MailApplications','ChatApplications','DefaultReportId','CustomReportId','Mohs','whatsapp_interaction_has_tags','AllConditions','AllCondition','TriggerAllId','AnyConditions','TriggerAnyId','Actions','TriggerId','AnalyticFieldReport','Fields','MetricId','Configurations','AccountId','Subjects','SubjectId','FieldId','Subject','Description','Field','VariableId','SugarcrmAccount','Descriptions','DescriptionId','int_desk_configuration_has_tags','ZohoField','ZendeskAccount','ZendeskField','int_zendesk_configuration_has_tags','FreshdeskConfiguration','int_freshdesk_configuration_has_tags','Dynamics365Account','ToId','SessionId','SmsQueueReport','JscriptyProject','ProjectId','user_has_teams','MailQueues','WhatsappQueue','TrunkId','campaigns_has_cm_lists','MailTransferReport','FromAccount','FromAgent','ToAgent','ToMailQueueId','ToAccount','FromChatWebsiteId','FromUserId','ToUserId','ToChatQueueId','ToQueue','FaxTransferReport','FromFaxAccountId','ToFaxAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','FromSmsAccountId','ToSmsQueueId','ToSmsAccountId','Queues','voice_queues_has_cm_lists','UserProfileSections','UserProfileResource','Resources','WhatsappAccountId','WhatsappMessage','WhatsappInteractionId','FromWhatsappAccountId','team_has_whatsapp_queues','exports','../config/environment','lodash','jstz','determine','defaultsDeep','sequelize','motion2','xcall','xC@LL1234','127.0.0.1','mysql','utf8mb4','name','sequelizeHistory','utf8','username','password','options','database','User','import','../api/user/user.model','VoiceChanSpy','../api/voiceContext/voiceContext.model','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','VoiceMail','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','../api/memberReport/memberReport.model','Trunk','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','../api/userVoiceQueueRt/userVoiceQueueRt.model','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','../api/userSmsQueue/userSmsQueue.model','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','MailServerOut','../api/mailServerOut/mailServerOut.model','../api/mailAccount/mailAccount.model','../api/mailQueue/mailQueue.model','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','MailInteraction','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailMessage/mailMessage.model','../api/mailApplication/mailApplication.model','Dashboard','../api/dashboard/dashboard.model','FaxAccount','../api/faxAccount/faxAccount.model','../api/faxApplication/faxApplication.model','FaxInteraction','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','SmsApplication','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','SmsQueue','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','OpenchannelQueue','ChatWebsite','../api/chatWebsite/chatWebsite.model','../api/openchannelQueueReport/openchannelQueueReport.model','../api/chatApplication/chatApplication.model','ChatInteraction','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','../api/cmCompany/cmCompany.model','CmContact','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','Action','../api/action/action.model','Automation','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','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Sound','../api/sound/sound.model','../api/tag/tag.model','Template','Trigger','Variable','../api/variable/variable.model','IntegrationReport','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticMetric/analyticMetric.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSalesforceField/intSalesforceField.model','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoConfiguration','../api/intZohoField/intZohoField.model','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','../api/intZendeskField/intZendeskField.model','../api/intFreshdeskAccount/intFreshdeskAccount.model','../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','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','../api/integration/integration.model','Network','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','Setting','../api/setting/setting.model','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareProject/squareProject.model','../api/squareRecording/squareRecording.model','SquareMessage','Team','../api/team/team.model','License','Campaign','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','../api/cmList/cmList.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfile/userProfile.model','UserProfileSection','../api/userProfileSection/userProfileSection.model','../api/userProfileResource/userProfileResource.model','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','hasOne','hasMany','Recordings','UserId','UserVoiceQueueRt','cascade','HopperFinals','HopperHistory','OpenchannelInteractions','ChatInteractions','SmsInteractions','FaxInteractions','WhatsappInteractions','UserNotifications','SenderId','belongsTo','userProfileId','Groups','chat_group_has_users','belongsToMany','cm_user_has_contacts','CmList','Lists','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','MailQueue','ChatQueues','FaxQueues','SmsQueues','OpenchannelQueues','UserOpenchannelQueue','WhatsappQueues','cm_user_has_lists','VoicePrefixes','user_has_voice_prefixes','user_has_chat_websites','MailAccount','user_has_mail_accounts','OpenchannelAccount','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','WhatsappAccounts','user_has_whatsapp_accounts','SquareProjects','user_has_square_projects','VoiceExtension','SpiedAgents','VoiceContext','Applications','Sounds','moh_has_sounds','Members','VoiceQueueId','Hoppers','HopperHistories','HopperBlacks','JscriptySessions','TrunkBackup','TrunkBackupId','mandatoryDispositionPause','mandatoryDispositionPauseId','Teams','BlackLists','voice_queues_has_cm_blacklists','ScreenRecording','Messages','mailbox','mailboxuser','QueueCalls','uniqueid','AgentReports','Contact','ContactId','MailAccountId','Imap','Dispositions','Answers','Interactions','MailApplication','List','ListId','TemplateId','Agents','team_has_mail_queues','MailInteractionId','Tag'];(function(_0x44a31b,_0xc928d0){var _0x108802=function(_0x2b1445){while(--_0x2b1445){_0x44a31b['push'](_0x44a31b['shift']());}};_0x108802(++_0xc928d0);}(_0xb641,0x87));var _0x1b64=function(_0x306b9e,_0x456cf7){_0x306b9e=_0x306b9e-0x0;var _0xbf826e=_0xb641[_0x306b9e];return _0xbf826e;};'use strict';var path=require('path');var config=require(_0x1b64('0x0'));var Sequelize=require('sequelize');var _=require(_0x1b64('0x1'));var jstz=require(_0x1b64('0x2'));var timezone=jstz[_0x1b64('0x3')]();config['sequelize']=_[_0x1b64('0x4')](config[_0x1b64('0x5')],{'database':_0x1b64('0x6'),'username':_0x1b64('0x7'),'password':_0x1b64('0x8'),'options':{'host':_0x1b64('0x9'),'port':0xcea,'dialect':_0x1b64('0xa'),'dialectOptions':{'charset':_0x1b64('0xb')},'logging':![],'timezone':timezone[_0x1b64('0xc')](),'define':{'charset':'utf8','collate':'utf8_general_ci'}}});config['sequelizeHistory']=_[_0x1b64('0x4')](config[_0x1b64('0xd')],{'database':'motion2','username':_0x1b64('0x7'),'password':_0x1b64('0x8'),'options':{'host':'127.0.0.1','port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0x1b64('0xb')},'logging':![],'timezone':timezone[_0x1b64('0xc')](),'define':{'charset':_0x1b64('0xe'),'collate':'utf8_general_ci'}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelize']['database'],config[_0x1b64('0x5')][_0x1b64('0xf')],config[_0x1b64('0x5')][_0x1b64('0x10')],config['sequelize'][_0x1b64('0x11')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelizeHistory'][_0x1b64('0x12')],config[_0x1b64('0xd')][_0x1b64('0xf')],config['sequelizeHistory'][_0x1b64('0x10')],config[_0x1b64('0xd')][_0x1b64('0x11')])};db[_0x1b64('0x13')]=db[_0x1b64('0x5')][_0x1b64('0x14')](_0x1b64('0x15'));db[_0x1b64('0x16')]=db[_0x1b64('0x5')]['import']('../api/voiceChanSpy/voiceChanSpy.model');db['VoiceContext']=db[_0x1b64('0x5')][_0x1b64('0x14')](_0x1b64('0x17'));db['VoiceExtension']=db[_0x1b64('0x5')][_0x1b64('0x14')](_0x1b64('0x18'));db[_0x1b64('0x19')]=db[_0x1b64('0x5')]['import'](_0x1b64('0x1a'));db[_0x1b64('0x1b')]=db[_0x1b64('0x5')][_0x1b64('0x14')](_0x1b64('0x1c'));db[_0x1b64('0x1d')]=db[_0x1b64('0x5')]['import'](_0x1b64('0x1e'));db['ScreenRecording']=db['sequelize'][_0x1b64('0x14')]('../api/screenRecording/screenRecording.model');db[_0x1b64('0x1f')]=db[_0x1b64('0x5')][_0x1b64('0x14')]('../api/voiceMail/voiceMail.model');db[_0x1b64('0x20')]=db[_0x1b64('0x5')][_0x1b64('0x14')](_0x1b64('0x21'));db[_0x1b64('0x22')]=db[_0x1b64('0x5')][_0x1b64('0x14')](_0x1b64('0x23'));db[_0x1b64('0x24')]=db[_0x1b64('0x5')][_0x1b64('0x14')](_0x1b64('0x25'));db[_0x1b64('0x26')]=db[_0x1b64('0x5')][_0x1b64('0x14')]('../api/voiceAgentReport/voiceAgentReport.model');db[_0x1b64('0x27')]=db[_0x1b64('0x5')][_0x1b64('0x14')](_0x1b64('0x28'));db['MemberReport']=db[_0x1b64('0x5')][_0x1b64('0x14')](_0x1b64('0x29'));db[_0x1b64('0x2a')]=db[_0x1b64('0x5')][_0x1b64('0x14')]('../api/trunk/trunk.model');db[_0x1b64('0x2b')]=db[_0x1b64('0x5')]['import'](_0x1b64('0x2c'));db['UserVoiceQueueRt']=db[_0x1b64('0x5')][_0x1b64('0x14')](_0x1b64('0x2d'));db['UserVoiceQueue']=db[_0x1b64('0x5')][_0x1b64('0x14')](_0x1b64('0x2e'));db[_0x1b64('0x2f')]=db['sequelize']['import']('../api/userChatQueue/userChatQueue.model');db[_0x1b64('0x30')]=db[_0x1b64('0x5')][_0x1b64('0x14')](_0x1b64('0x31'));db[_0x1b64('0x32')]=db[_0x1b64('0x5')][_0x1b64('0x14')](_0x1b64('0x33'));db['UserSmsQueue']=db[_0x1b64('0x5')]['import'](_0x1b64('0x34'));db['UserOpenchannelQueue']=db[_0x1b64('0x5')][_0x1b64('0x14')](_0x1b64('0x35'));db[_0x1b64('0x36')]=db[_0x1b64('0x5')][_0x1b64('0x14')](_0x1b64('0x37'));db[_0x1b64('0x38')]=db[_0x1b64('0x5')][_0x1b64('0x14')]('../api/mailServerIn/mailServerIn.model');db[_0x1b64('0x39')]=db[_0x1b64('0x5')][_0x1b64('0x14')](_0x1b64('0x3a'));db['MailAccount']=db[_0x1b64('0x5')][_0x1b64('0x14')](_0x1b64('0x3b'));db['MailQueue']=db[_0x1b64('0x5')][_0x1b64('0x14')](_0x1b64('0x3c'));db[_0x1b64('0x3d')]=db[_0x1b64('0x5')][_0x1b64('0x14')](_0x1b64('0x3e'));db[_0x1b64('0x3f')]=db[_0x1b64('0x5')][_0x1b64('0x14')](_0x1b64('0x40'));db[_0x1b64('0x41')]=db[_0x1b64('0x5')][_0x1b64('0x14')](_0x1b64('0x42'));db['MailApplication']=db[_0x1b64('0x5')][_0x1b64('0x14')](_0x1b64('0x43'));db['MailQueueReport']=db[_0x1b64('0x5')]['import']('../api/mailQueueReport/mailQueueReport.model');db[_0x1b64('0x44')]=db[_0x1b64('0x5')][_0x1b64('0x14')](_0x1b64('0x45'));db['DashboardItem']=db[_0x1b64('0x5')][_0x1b64('0x14')]('../api/dashboardItem/dashboardItem.model');db[_0x1b64('0x46')]=db[_0x1b64('0x5')][_0x1b64('0x14')](_0x1b64('0x47'));db['FaxApplication']=db[_0x1b64('0x5')][_0x1b64('0x14')](_0x1b64('0x48'));db[_0x1b64('0x49')]=db[_0x1b64('0x5')][_0x1b64('0x14')]('../api/faxInteraction/faxInteraction.model');db[_0x1b64('0x4a')]=db[_0x1b64('0x5')][_0x1b64('0x14')](_0x1b64('0x4b'));db[_0x1b64('0x4c')]=db[_0x1b64('0x5')][_0x1b64('0x14')](_0x1b64('0x4d'));db[_0x1b64('0x4e')]=db[_0x1b64('0x5')]['import'](_0x1b64('0x4f'));db[_0x1b64('0x50')]=db[_0x1b64('0x5')]['import']('../api/smsAccount/smsAccount.model');db[_0x1b64('0x51')]=db[_0x1b64('0x5')][_0x1b64('0x14')]('../api/smsApplication/smsApplication.model');db[_0x1b64('0x52')]=db[_0x1b64('0x5')][_0x1b64('0x14')](_0x1b64('0x53'));db[_0x1b64('0x54')]=db['sequelize']['import']('../api/smsMessage/smsMessage.model');db[_0x1b64('0x55')]=db[_0x1b64('0x5')]['import']('../api/smsQueue/smsQueue.model');db['OpenchannelAccount']=db['sequelize'][_0x1b64('0x14')](_0x1b64('0x56'));db[_0x1b64('0x57')]=db[_0x1b64('0x5')][_0x1b64('0x14')](_0x1b64('0x58'));db[_0x1b64('0x59')]=db[_0x1b64('0x5')][_0x1b64('0x14')](_0x1b64('0x5a'));db[_0x1b64('0x5b')]=db[_0x1b64('0x5')][_0x1b64('0x14')]('../api/openchannelMessage/openchannelMessage.model');db[_0x1b64('0x5c')]=db[_0x1b64('0x5')][_0x1b64('0x14')]('../api/openchannelQueue/openchannelQueue.model');db[_0x1b64('0x5d')]=db['sequelize'][_0x1b64('0x14')](_0x1b64('0x5e'));db['OpenchannelQueueReport']=db['sequelize'][_0x1b64('0x14')](_0x1b64('0x5f'));db['ChatApplication']=db[_0x1b64('0x5')][_0x1b64('0x14')](_0x1b64('0x60'));db[_0x1b64('0x61')]=db[_0x1b64('0x5')][_0x1b64('0x14')](_0x1b64('0x62'));db[_0x1b64('0x63')]=db[_0x1b64('0x5')][_0x1b64('0x14')]('../api/chatMessage/chatMessage.model');db['ChatOfflineMessage']=db[_0x1b64('0x5')][_0x1b64('0x14')](_0x1b64('0x64'));db[_0x1b64('0x65')]=db[_0x1b64('0x5')][_0x1b64('0x14')](_0x1b64('0x66'));db[_0x1b64('0x67')]=db[_0x1b64('0x5')]['import']('../api/chatGroup/chatGroup.model');db['ChatProactiveAction']=db[_0x1b64('0x5')][_0x1b64('0x14')](_0x1b64('0x68'));db[_0x1b64('0x69')]=db[_0x1b64('0x5')][_0x1b64('0x14')](_0x1b64('0x6a'));db[_0x1b64('0x6b')]=db['sequelize'][_0x1b64('0x14')](_0x1b64('0x6c'));db[_0x1b64('0x6d')]=db['sequelize']['import'](_0x1b64('0x6e'));db[_0x1b64('0x6f')]=db[_0x1b64('0x5')][_0x1b64('0x14')](_0x1b64('0x70'));db[_0x1b64('0x71')]=db[_0x1b64('0x5')][_0x1b64('0x14')]('../api/cmHopperFinal/cmHopperFinal.model');db[_0x1b64('0x72')]=db[_0x1b64('0x5')][_0x1b64('0x14')](_0x1b64('0x73'));db[_0x1b64('0x74')]=db[_0x1b64('0x5')][_0x1b64('0x14')](_0x1b64('0x75'));db[_0x1b64('0x76')]=db[_0x1b64('0x5')]['import']('../api/cmCustomField/cmCustomField.model');db[_0x1b64('0x77')]=db[_0x1b64('0x5')][_0x1b64('0x14')](_0x1b64('0x78'));db[_0x1b64('0x79')]=db[_0x1b64('0x5')][_0x1b64('0x14')]('../api/automation/automation.model');db[_0x1b64('0x7a')]=db['sequelize'][_0x1b64('0x14')](_0x1b64('0x7b'));db[_0x1b64('0x7c')]=db['sequelize'][_0x1b64('0x14')](_0x1b64('0x7d'));db[_0x1b64('0x7e')]=db[_0x1b64('0x5')][_0x1b64('0x14')](_0x1b64('0x7f'));db[_0x1b64('0x80')]=db[_0x1b64('0x5')][_0x1b64('0x14')](_0x1b64('0x81'));db[_0x1b64('0x82')]=db[_0x1b64('0x5')][_0x1b64('0x14')](_0x1b64('0x83'));db[_0x1b64('0x84')]=db[_0x1b64('0x5')][_0x1b64('0x14')](_0x1b64('0x85'));db[_0x1b64('0x86')]=db[_0x1b64('0x5')]['import'](_0x1b64('0x87'));db[_0x1b64('0x88')]=db['sequelize'][_0x1b64('0x14')](_0x1b64('0x89'));db[_0x1b64('0x8a')]=db[_0x1b64('0x5')][_0x1b64('0x14')](_0x1b64('0x8b'));db['Tag']=db['sequelize'][_0x1b64('0x14')](_0x1b64('0x8c'));db[_0x1b64('0x8d')]=db[_0x1b64('0x5')][_0x1b64('0x14')]('../api/template/template.model');db[_0x1b64('0x8e')]=db['sequelize'][_0x1b64('0x14')]('../api/trigger/trigger.model');db[_0x1b64('0x8f')]=db[_0x1b64('0x5')][_0x1b64('0x14')](_0x1b64('0x90'));db['Integration']=db[_0x1b64('0x5')][_0x1b64('0x14')]('../api/integration/integration.model');db[_0x1b64('0x91')]=db[_0x1b64('0x5')][_0x1b64('0x14')]('../api/integrationReport/integrationReport.model');db[_0x1b64('0x92')]=db[_0x1b64('0x5')][_0x1b64('0x14')](_0x1b64('0x93'));db[_0x1b64('0x94')]=db[_0x1b64('0x5')][_0x1b64('0x14')](_0x1b64('0x95'));db['AnalyticExtractedReport']=db[_0x1b64('0x5')][_0x1b64('0x14')](_0x1b64('0x96'));db[_0x1b64('0x97')]=db[_0x1b64('0x5')]['import'](_0x1b64('0x98'));db['AnalyticFieldReport']=db[_0x1b64('0x5')]['import']('../api/analyticFieldReport/analyticFieldReport.model');db[_0x1b64('0x99')]=db[_0x1b64('0x5')][_0x1b64('0x14')](_0x1b64('0x9a'));db[_0x1b64('0x9b')]=db[_0x1b64('0x5')][_0x1b64('0x14')](_0x1b64('0x9c'));db[_0x1b64('0x9d')]=db[_0x1b64('0x5')][_0x1b64('0x14')](_0x1b64('0x9e'));db[_0x1b64('0x9f')]=db['sequelize'][_0x1b64('0x14')](_0x1b64('0xa0'));db['SugarcrmAccount']=db['sequelize'][_0x1b64('0x14')](_0x1b64('0xa1'));db[_0x1b64('0xa2')]=db[_0x1b64('0x5')][_0x1b64('0x14')](_0x1b64('0xa3'));db[_0x1b64('0xa4')]=db[_0x1b64('0x5')][_0x1b64('0x14')](_0x1b64('0xa5'));db[_0x1b64('0xa6')]=db[_0x1b64('0x5')][_0x1b64('0x14')](_0x1b64('0xa7'));db[_0x1b64('0xa8')]=db[_0x1b64('0x5')][_0x1b64('0x14')](_0x1b64('0xa9'));db[_0x1b64('0xaa')]=db['sequelize'][_0x1b64('0x14')](_0x1b64('0xab'));db['ZohoAccount']=db[_0x1b64('0x5')][_0x1b64('0x14')]('../api/intZohoAccount/intZohoAccount.model');db[_0x1b64('0xac')]=db[_0x1b64('0x5')][_0x1b64('0x14')]('../api/intZohoConfiguration/intZohoConfiguration.model');db['ZohoField']=db[_0x1b64('0x5')][_0x1b64('0x14')](_0x1b64('0xad'));db['ZendeskAccount']=db[_0x1b64('0x5')][_0x1b64('0x14')](_0x1b64('0xae'));db[_0x1b64('0xaf')]=db[_0x1b64('0x5')]['import'](_0x1b64('0xb0'));db['ZendeskField']=db[_0x1b64('0x5')][_0x1b64('0x14')](_0x1b64('0xb1'));db['FreshdeskAccount']=db[_0x1b64('0x5')][_0x1b64('0x14')](_0x1b64('0xb2'));db['FreshdeskConfiguration']=db[_0x1b64('0x5')][_0x1b64('0x14')](_0x1b64('0xb3'));db[_0x1b64('0xb4')]=db[_0x1b64('0x5')][_0x1b64('0x14')](_0x1b64('0xb5'));db[_0x1b64('0xb6')]=db[_0x1b64('0x5')]['import'](_0x1b64('0xb7'));db[_0x1b64('0xb8')]=db[_0x1b64('0x5')]['import'](_0x1b64('0xb9'));db[_0x1b64('0xba')]=db[_0x1b64('0x5')]['import'](_0x1b64('0xbb'));db[_0x1b64('0xbc')]=db[_0x1b64('0x5')][_0x1b64('0x14')](_0x1b64('0xbd'));db[_0x1b64('0xbe')]=db[_0x1b64('0x5')][_0x1b64('0x14')](_0x1b64('0xbf'));db[_0x1b64('0xc0')]=db[_0x1b64('0x5')][_0x1b64('0x14')](_0x1b64('0xc1'));db['Dynamics365Account']=db[_0x1b64('0x5')][_0x1b64('0x14')]('../api/intDynamics365Account/intDynamics365Account.model');db[_0x1b64('0xc2')]=db['sequelize']['import'](_0x1b64('0xc3'));db[_0x1b64('0xc4')]=db['sequelize']['import'](_0x1b64('0xc5'));db[_0x1b64('0xc6')]=db[_0x1b64('0x5')][_0x1b64('0x14')](_0x1b64('0xc7'));db[_0x1b64('0xc8')]=db[_0x1b64('0x5')]['import'](_0x1b64('0xc9'));db[_0x1b64('0xca')]=db['sequelize'][_0x1b64('0x14')](_0x1b64('0xcb'));db['Integration']=db[_0x1b64('0x5')][_0x1b64('0x14')](_0x1b64('0xcc'));db[_0x1b64('0xcd')]=db[_0x1b64('0x5')]['import'](_0x1b64('0xce'));db[_0x1b64('0xcf')]=db[_0x1b64('0x5')]['import'](_0x1b64('0xd0'));db[_0x1b64('0xd1')]=db[_0x1b64('0x5')][_0x1b64('0x14')](_0x1b64('0xd2'));db[_0x1b64('0xd3')]=db['sequelize'][_0x1b64('0x14')](_0x1b64('0xd4'));db[_0x1b64('0xd5')]=db[_0x1b64('0x5')][_0x1b64('0x14')](_0x1b64('0xd6'));db[_0x1b64('0xd7')]=db[_0x1b64('0x5')][_0x1b64('0x14')](_0x1b64('0xd8'));db['SmsQueueReport']=db[_0x1b64('0x5')][_0x1b64('0x14')]('../api/smsQueueReport/smsQueueReport.model');db[_0x1b64('0xd9')]=db['sequelize'][_0x1b64('0x14')](_0x1b64('0xda'));db[_0x1b64('0xdb')]=db['sequelize'][_0x1b64('0x14')](_0x1b64('0xdc'));db['JscriptyProject']=db[_0x1b64('0x5')][_0x1b64('0x14')]('../api/jscriptyProject/jscriptyProject.model');db[_0x1b64('0xdd')]=db[_0x1b64('0x5')][_0x1b64('0x14')](_0x1b64('0xde'));db['SquareOdbc']=db[_0x1b64('0x5')][_0x1b64('0x14')](_0x1b64('0xdf'));db[_0x1b64('0xe0')]=db[_0x1b64('0x5')]['import'](_0x1b64('0xe1'));db['SquareRecording']=db[_0x1b64('0x5')][_0x1b64('0x14')](_0x1b64('0xe2'));db[_0x1b64('0xe3')]=db['sequelize'][_0x1b64('0x14')]('../api/squareMessage/squareMessage.model');db[_0x1b64('0xe4')]=db['sequelize'][_0x1b64('0x14')](_0x1b64('0xe5'));db[_0x1b64('0xe6')]=db[_0x1b64('0x5')][_0x1b64('0x14')]('../api/license/license.model');db[_0x1b64('0xe7')]=db[_0x1b64('0x5')]['import']('../api/campaign/campaign.model');db[_0x1b64('0xe8')]=db[_0x1b64('0x5')][_0x1b64('0x14')](_0x1b64('0xe9'));db[_0x1b64('0xea')]=db['sequelize'][_0x1b64('0x14')](_0x1b64('0xeb'));db[_0x1b64('0xec')]=db['sequelize'][_0x1b64('0x14')](_0x1b64('0xed'));db['MailTransferReport']=db[_0x1b64('0x5')][_0x1b64('0x14')](_0x1b64('0xee'));db[_0x1b64('0xef')]=db['sequelize'][_0x1b64('0x14')](_0x1b64('0xf0'));db['FaxTransferReport']=db['sequelize'][_0x1b64('0x14')](_0x1b64('0xf1'));db[_0x1b64('0xf2')]=db[_0x1b64('0x5')][_0x1b64('0x14')](_0x1b64('0xf3'));db[_0x1b64('0xf4')]=db[_0x1b64('0x5')][_0x1b64('0x14')](_0x1b64('0xf5'));db['CmList']=db[_0x1b64('0x5')]['import'](_0x1b64('0xf6'));db[_0x1b64('0xf7')]=db[_0x1b64('0x5')][_0x1b64('0x14')](_0x1b64('0xf8'));db[_0x1b64('0xf9')]=db[_0x1b64('0x5')]['import'](_0x1b64('0xfa'));db[_0x1b64('0xfb')]=db['sequelize'][_0x1b64('0x14')](_0x1b64('0xfc'));db['UserProfileResource']=db['sequelize']['import'](_0x1b64('0xfd'));db[_0x1b64('0xfe')]=db[_0x1b64('0x5')][_0x1b64('0x14')](_0x1b64('0xff'));db[_0x1b64('0x100')]=db[_0x1b64('0x5')]['import'](_0x1b64('0x101'));db[_0x1b64('0x102')]=db[_0x1b64('0x5')][_0x1b64('0x14')](_0x1b64('0x103'));db[_0x1b64('0x104')]=db[_0x1b64('0x5')][_0x1b64('0x14')](_0x1b64('0x105'));db['WhatsappMessage']=db[_0x1b64('0x5')][_0x1b64('0x14')](_0x1b64('0x106'));db[_0x1b64('0x107')]=db[_0x1b64('0x5')][_0x1b64('0x14')](_0x1b64('0x108'));db[_0x1b64('0x109')]=db['sequelize'][_0x1b64('0x14')]('../api/whatsappTransferReport/whatsappTransferReport.model');db['WhatsappQueue']=db[_0x1b64('0x5')]['import']('../api/whatsappQueue/whatsappQueue.model');db['CloudProvider']=db['sequelize'][_0x1b64('0x14')](_0x1b64('0x10a'));db[_0x1b64('0x10b')]=db[_0x1b64('0x5')][_0x1b64('0x14')]('../api/teamVoiceQueue/teamVoiceQueue.model');db['User'][_0x1b64('0x10c')](db[_0x1b64('0x1f')],{'as':_0x1b64('0x1f'),'onDelete':'cascade','foreignKey':'UserId'});db[_0x1b64('0x13')][_0x1b64('0x10d')](db[_0x1b64('0x1d')],{'as':_0x1b64('0x10e'),'foreignKey':_0x1b64('0x10f')});db[_0x1b64('0x13')]['hasMany'](db[_0x1b64('0x110')],{'as':'VoiceQueuesRt','foreignKey':'UserId'});db[_0x1b64('0x13')]['hasMany'](db['VoiceExtension'],{'as':'Extensions','onDelete':_0x1b64('0x111'),'hooks':!![]});db[_0x1b64('0x13')]['hasMany'](db['CmHopperFinal'],{'as':_0x1b64('0x112'),'foreignKey':_0x1b64('0x10f')});db[_0x1b64('0x13')][_0x1b64('0x10d')](db['CmHopperHistory'],{'as':_0x1b64('0x113'),'foreignKey':_0x1b64('0x10f')});db[_0x1b64('0x13')][_0x1b64('0x10d')](db[_0x1b64('0x74')],{'as':'ReportAgentPreview','foreignKey':_0x1b64('0x10f')});db[_0x1b64('0x13')][_0x1b64('0x10d')](db[_0x1b64('0x59')],{'as':_0x1b64('0x114'),'foreignKey':_0x1b64('0x10f')});db[_0x1b64('0x13')][_0x1b64('0x10d')](db[_0x1b64('0x61')],{'as':_0x1b64('0x115'),'foreignKey':_0x1b64('0x10f')});db['User'][_0x1b64('0x10d')](db[_0x1b64('0x52')],{'as':_0x1b64('0x116'),'foreignKey':_0x1b64('0x10f')});db[_0x1b64('0x13')]['hasMany'](db[_0x1b64('0x49')],{'as':_0x1b64('0x117'),'foreignKey':_0x1b64('0x10f')});db['User'][_0x1b64('0x10d')](db[_0x1b64('0x3f')],{'as':'MailInteractions','foreignKey':_0x1b64('0x10f')});db[_0x1b64('0x13')][_0x1b64('0x10d')](db[_0x1b64('0x104')],{'as':_0x1b64('0x118'),'foreignKey':_0x1b64('0x10f')});db[_0x1b64('0x13')]['hasMany'](db[_0x1b64('0xfe')],{'as':_0x1b64('0x119'),'foreignKey':_0x1b64('0x11a')});db['User'][_0x1b64('0x11b')](db[_0x1b64('0xf9')],{'as':_0x1b64('0xf9'),'foreignKey':_0x1b64('0x11c')});db[_0x1b64('0x13')]['belongsToMany'](db[_0x1b64('0x67')],{'as':_0x1b64('0x11d'),'through':_0x1b64('0x11e')});db[_0x1b64('0x13')][_0x1b64('0x11f')](db[_0x1b64('0x6b')],{'as':'Contacts','through':_0x1b64('0x120')});db[_0x1b64('0x13')][_0x1b64('0x11f')](db[_0x1b64('0x121')],{'as':_0x1b64('0x122'),'through':'cm_user_has_lists'});db[_0x1b64('0x13')][_0x1b64('0x11f')](db[_0x1b64('0xe4')],{'through':'user_has_teams'});db[_0x1b64('0x13')][_0x1b64('0x11f')](db[_0x1b64('0x3f')],{'as':'MailInteractions','through':_0x1b64('0x123')});db[_0x1b64('0x13')]['belongsToMany'](db['ChatInteraction'],{'as':_0x1b64('0x115'),'through':_0x1b64('0x124')});db[_0x1b64('0x13')][_0x1b64('0x11f')](db['FaxInteraction'],{'as':'FaxInteractions','through':_0x1b64('0x125')});db[_0x1b64('0x13')][_0x1b64('0x11f')](db[_0x1b64('0x52')],{'as':_0x1b64('0x116'),'through':_0x1b64('0x126')});db['User'][_0x1b64('0x11f')](db[_0x1b64('0x59')],{'as':_0x1b64('0x114'),'through':_0x1b64('0x127')});db[_0x1b64('0x13')][_0x1b64('0x11f')](db[_0x1b64('0x104')],{'as':_0x1b64('0x118'),'through':_0x1b64('0x128')});db[_0x1b64('0x13')]['belongsToMany'](db[_0x1b64('0x1b')],{'as':_0x1b64('0x129'),'through':'UserVoiceQueue','required':![]});db[_0x1b64('0x13')][_0x1b64('0x11f')](db[_0x1b64('0x12a')],{'as':'MailQueues','through':_0x1b64('0x30'),'required':![]});db['User'][_0x1b64('0x11f')](db[_0x1b64('0x65')],{'as':_0x1b64('0x12b'),'through':_0x1b64('0x2f'),'required':![],'hooks':!![]});db[_0x1b64('0x13')]['belongsToMany'](db['FaxQueue'],{'as':_0x1b64('0x12c'),'through':_0x1b64('0x32'),'required':![]});db[_0x1b64('0x13')][_0x1b64('0x11f')](db[_0x1b64('0x55')],{'as':_0x1b64('0x12d'),'through':'UserSmsQueue','required':![]});db[_0x1b64('0x13')][_0x1b64('0x11f')](db[_0x1b64('0x5c')],{'as':_0x1b64('0x12e'),'through':_0x1b64('0x12f'),'required':![]});db['User'][_0x1b64('0x11f')](db['WhatsappQueue'],{'as':_0x1b64('0x130'),'through':_0x1b64('0x36'),'required':![]});db[_0x1b64('0x13')][_0x1b64('0x11f')](db[_0x1b64('0x121')],{'through':_0x1b64('0x131')});db[_0x1b64('0x13')][_0x1b64('0x11f')](db['VoicePrefix'],{'as':_0x1b64('0x132'),'through':_0x1b64('0x133'),'required':![]});db[_0x1b64('0x13')][_0x1b64('0x11f')](db[_0x1b64('0x5d')],{'as':'ChatWebsites','through':_0x1b64('0x134')});db[_0x1b64('0x13')][_0x1b64('0x11f')](db[_0x1b64('0x46')],{'as':'FaxAccounts','through':'user_has_fax_accounts'});db[_0x1b64('0x13')][_0x1b64('0x11f')](db[_0x1b64('0x135')],{'as':'MailAccounts','through':_0x1b64('0x136')});db[_0x1b64('0x13')][_0x1b64('0x11f')](db[_0x1b64('0x137')],{'as':_0x1b64('0x138'),'through':_0x1b64('0x139')});db[_0x1b64('0x13')][_0x1b64('0x11f')](db[_0x1b64('0x50')],{'as':_0x1b64('0x13a'),'through':'user_has_sms_accounts'});db['User'][_0x1b64('0x11f')](db['WhatsappAccount'],{'as':_0x1b64('0x13b'),'through':_0x1b64('0x13c')});db[_0x1b64('0x13')][_0x1b64('0x11f')](db[_0x1b64('0xe0')],{'as':_0x1b64('0x13d'),'through':_0x1b64('0x13e')});db[_0x1b64('0x16')]['hasMany'](db[_0x1b64('0x13f')],{'as':_0x1b64('0x140'),'onDelete':'cascade','foreignKey':'ChanSpyId'});db[_0x1b64('0x141')][_0x1b64('0x10d')](db[_0x1b64('0x13f')],{'onDelete':_0x1b64('0x111')});db[_0x1b64('0x13f')][_0x1b64('0x10d')](db['VoiceExtension'],{'as':_0x1b64('0x142'),'onDelete':_0x1b64('0x111')});db[_0x1b64('0x19')][_0x1b64('0x11f')](db[_0x1b64('0x8a')],{'as':_0x1b64('0x143'),'through':_0x1b64('0x144')});db['VoiceQueue'][_0x1b64('0x10d')](db[_0x1b64('0x110')],{'as':_0x1b64('0x145'),'foreignKey':_0x1b64('0x146')});db[_0x1b64('0x1b')]['hasMany'](db[_0x1b64('0x6d')],{'as':_0x1b64('0x147'),'foreignKey':'VoiceQueueId'});db['VoiceQueue'][_0x1b64('0x10d')](db[_0x1b64('0x71')],{'as':'HopperFinals','foreignKey':_0x1b64('0x146')});db[_0x1b64('0x1b')][_0x1b64('0x10d')](db[_0x1b64('0x72')],{'as':_0x1b64('0x148'),'foreignKey':_0x1b64('0x146')});db[_0x1b64('0x1b')][_0x1b64('0x10d')](db[_0x1b64('0x74')],{'as':'ReportAgentPreview','foreignKey':_0x1b64('0x146')});db['VoiceQueue']['hasMany'](db['CmHopperBlack'],{'as':_0x1b64('0x149'),'foreignKey':_0x1b64('0x146')});db['VoiceQueue'][_0x1b64('0x10d')](db[_0x1b64('0xd7')],{'as':_0x1b64('0x14a'),'foreignKey':'VoiceQueueId'});db[_0x1b64('0x1b')][_0x1b64('0x11b')](db['Trunk'],{'as':_0x1b64('0x2a'),'foreignKey':'TrunkId'});db[_0x1b64('0x1b')]['belongsTo'](db[_0x1b64('0x2a')],{'as':_0x1b64('0x14b'),'foreignKey':_0x1b64('0x14c')});db[_0x1b64('0x1b')]['belongsTo'](db[_0x1b64('0x80')],{'as':_0x1b64('0x80'),'foreignKey':'IntervalId'});db['VoiceQueue']['belongsTo'](db[_0x1b64('0x82')],{'as':_0x1b64('0x14d'),'foreignKey':_0x1b64('0x14e')});db[_0x1b64('0x1b')][_0x1b64('0x11f')](db[_0x1b64('0x121')],{'as':'Lists','through':'voice_queues_has_cm_lists'});db[_0x1b64('0x1b')][_0x1b64('0x11f')](db[_0x1b64('0x13')],{'as':'Agents','through':'UserVoiceQueue'});db[_0x1b64('0x1b')][_0x1b64('0x11f')](db[_0x1b64('0xe4')],{'as':_0x1b64('0x14f'),'through':'TeamVoiceQueue'});db[_0x1b64('0x1b')][_0x1b64('0x11f')](db['CmList'],{'as':_0x1b64('0x150'),'through':_0x1b64('0x151')});db[_0x1b64('0x1d')][_0x1b64('0x11b')](db[_0x1b64('0x13')],{'as':_0x1b64('0x13'),'foreignKey':_0x1b64('0x10f')});db[_0x1b64('0x152')][_0x1b64('0x11b')](db['User'],{'as':_0x1b64('0x13'),'foreignKey':_0x1b64('0x10f')});db[_0x1b64('0x1f')][_0x1b64('0x10d')](db[_0x1b64('0x20')],{'as':_0x1b64('0x153'),'onDelete':_0x1b64('0x111'),'foreignKey':'mailboxuser','sourceKey':_0x1b64('0x154')});db[_0x1b64('0x20')][_0x1b64('0x11b')](db[_0x1b64('0x1f')],{'foreignKey':_0x1b64('0x155'),'targetKey':_0x1b64('0x154')});db['VoiceCallReport']['hasMany'](db[_0x1b64('0x27')],{'as':_0x1b64('0x156'),'foreignKey':_0x1b64('0x157'),'constraints':![]});db[_0x1b64('0x22')][_0x1b64('0x10d')](db[_0x1b64('0x26')],{'as':_0x1b64('0x158'),'foreignKey':'uniqueid','constraints':![]});db[_0x1b64('0x22')][_0x1b64('0x11b')](db[_0x1b64('0x13')],{'as':_0x1b64('0x13'),'foreignKey':_0x1b64('0x10f')});db[_0x1b64('0x22')][_0x1b64('0x11b')](db[_0x1b64('0x6b')],{'as':_0x1b64('0x159'),'foreignKey':_0x1b64('0x15a')});db[_0x1b64('0x38')][_0x1b64('0x11b')](db[_0x1b64('0x135')],{'as':_0x1b64('0x135'),'foreignKey':_0x1b64('0x15b')});db['MailServerOut'][_0x1b64('0x11b')](db[_0x1b64('0x135')],{'as':_0x1b64('0x135'),'foreignKey':_0x1b64('0x15b')});db[_0x1b64('0x135')][_0x1b64('0x10c')](db[_0x1b64('0x38')],{'as':_0x1b64('0x15c'),'onDelete':'cascade'});db[_0x1b64('0x135')]['hasOne'](db[_0x1b64('0x39')],{'as':'Smtp','onDelete':_0x1b64('0x111')});db['MailAccount'][_0x1b64('0x10d')](db[_0x1b64('0x7c')],{'as':_0x1b64('0x15d'),'foreignKey':'MailAccountId'});db[_0x1b64('0x135')][_0x1b64('0x10d')](db[_0x1b64('0x7a')],{'as':_0x1b64('0x15e'),'foreignKey':'MailAccountId'});db['MailAccount'][_0x1b64('0x10d')](db[_0x1b64('0x41')],{'as':_0x1b64('0x153'),'foreignKey':'MailAccountId'});db[_0x1b64('0x135')]['hasMany'](db[_0x1b64('0x3f')],{'as':_0x1b64('0x15f')});db[_0x1b64('0x135')]['hasMany'](db[_0x1b64('0x160')],{'as':'Applications'});db['MailAccount'][_0x1b64('0x11b')](db[_0x1b64('0x121')],{'as':_0x1b64('0x161'),'foreignKey':_0x1b64('0x162')});db[_0x1b64('0x135')][_0x1b64('0x11b')](db['Template'],{'as':'Template','foreignKey':_0x1b64('0x163')});db[_0x1b64('0x135')]['belongsTo'](db[_0x1b64('0x82')],{'as':_0x1b64('0x14d'),'foreignKey':_0x1b64('0x14e')});db[_0x1b64('0x135')]['belongsToMany'](db[_0x1b64('0x13')],{'as':_0x1b64('0x164'),'through':_0x1b64('0x136')});db[_0x1b64('0x12a')][_0x1b64('0x11f')](db[_0x1b64('0x13')],{'as':_0x1b64('0x164'),'through':_0x1b64('0x30')});db[_0x1b64('0x12a')][_0x1b64('0x11f')](db[_0x1b64('0xe4')],{'through':_0x1b64('0x165'),'as':_0x1b64('0x14f')});db[_0x1b64('0x3f')][_0x1b64('0x10d')](db[_0x1b64('0x41')],{'as':_0x1b64('0x153'),'onDelete':_0x1b64('0x111'),'foreignKey':_0x1b64('0x166')});db['MailInteraction']['belongsTo'](db[_0x1b64('0x135')],{'as':'Account','foreignKey':_0x1b64('0x15b')});db['MailInteraction'][_0x1b64('0x11b')](db[_0x1b64('0x6b')],{'as':_0x1b64('0x159'),'foreignKey':_0x1b64('0x15a')});db[_0x1b64('0x3f')]['belongsTo'](db['User'],{'as':'Owner','foreignKey':_0x1b64('0x10f')});db[_0x1b64('0x3f')]['belongsToMany'](db[_0x1b64('0x167')],{'through':'mail_interaction_has_tags','as':_0x1b64('0x168')});db[_0x1b64('0x3f')][_0x1b64('0x11f')](db[_0x1b64('0x167')],{'through':_0x1b64('0x169'),'as':_0x1b64('0x16a')});db[_0x1b64('0x3f')][_0x1b64('0x11f')](db[_0x1b64('0x13')],{'as':_0x1b64('0x16b'),'through':'user_has_mail_interactions','foreignKey':_0x1b64('0x166')});db[_0x1b64('0x41')][_0x1b64('0x10d')](db[_0x1b64('0xea')],{'as':_0x1b64('0x16c'),'onDelete':_0x1b64('0x111')});db[_0x1b64('0x41')][_0x1b64('0x11b')](db[_0x1b64('0x13')],{'as':_0x1b64('0x13')});db[_0x1b64('0x41')][_0x1b64('0x11b')](db['CmContact'],{'onDelete':_0x1b64('0x111'),'as':_0x1b64('0x159')});db[_0x1b64('0x41')][_0x1b64('0x11b')](db['MailInteraction'],{'as':_0x1b64('0x16d'),'foreignKey':_0x1b64('0x166')});db['MailMessage']['belongsTo'](db['MailAccount'],{'as':_0x1b64('0x16e'),'foreignKey':_0x1b64('0x15b')});db[_0x1b64('0x41')][_0x1b64('0x11b')](db[_0x1b64('0x5d')],{'as':_0x1b64('0x5d'),'foreignKey':_0x1b64('0x16f')});db[_0x1b64('0x41')][_0x1b64('0x11b')](db['ChatOfflineMessage'],{'as':'ChatOfflineMessage','foreignKey':_0x1b64('0x170')});db[_0x1b64('0x160')][_0x1b64('0x11b')](db['User'],{'onDelete':_0x1b64('0x171')});db[_0x1b64('0x160')][_0x1b64('0x11b')](db[_0x1b64('0x12a')],{'onDelete':_0x1b64('0x171')});db[_0x1b64('0x160')]['belongsTo'](db['MailAccount'],{'onDelete':_0x1b64('0x171')});db[_0x1b64('0x160')][_0x1b64('0x11b')](db['Interval'],{'onDelete':_0x1b64('0x171'),'foreignKey':'IntervalId'});db[_0x1b64('0x160')][_0x1b64('0x11b')](db[_0x1b64('0x167')],{'onDelete':_0x1b64('0x171'),'foreignKey':_0x1b64('0x172')});db[_0x1b64('0x173')]['belongsTo'](db[_0x1b64('0x135')],{});db[_0x1b64('0x173')]['belongsTo'](db[_0x1b64('0x121')],{'as':_0x1b64('0x161'),'foreignKey':'ListId'});db[_0x1b64('0x173')]['belongsTo'](db[_0x1b64('0x6b')],{'as':_0x1b64('0x159'),'foreignKey':_0x1b64('0x15a')});db[_0x1b64('0x173')][_0x1b64('0x11b')](db[_0x1b64('0x3f')],{});db[_0x1b64('0x173')][_0x1b64('0x11b')](db[_0x1b64('0x41')],{});db[_0x1b64('0x173')]['belongsTo'](db[_0x1b64('0x13')],{});db['MailQueueReport']['belongsTo'](db[_0x1b64('0x12a')],{});db[_0x1b64('0x44')][_0x1b64('0x10d')](db[_0x1b64('0x174')],{'as':_0x1b64('0x175'),'onDelete':'cascade'});db[_0x1b64('0x46')][_0x1b64('0x10d')](db[_0x1b64('0x7c')],{'as':_0x1b64('0x15d'),'foreignKey':_0x1b64('0x176')});db[_0x1b64('0x46')]['hasMany'](db['CannedAnswer'],{'as':_0x1b64('0x15e'),'foreignKey':_0x1b64('0x176')});db[_0x1b64('0x46')][_0x1b64('0x10d')](db['FaxInteraction'],{'as':_0x1b64('0x15f')});db[_0x1b64('0x46')][_0x1b64('0x10d')](db['FaxApplication'],{'as':_0x1b64('0x142')});db['FaxAccount'][_0x1b64('0x10d')](db['VoiceExtension'],{'as':_0x1b64('0x177'),'onDelete':_0x1b64('0x111')});db[_0x1b64('0x46')][_0x1b64('0x10d')](db['FaxMessage'],{'as':'Messages'});db['FaxAccount'][_0x1b64('0x11b')](db[_0x1b64('0x2a')],{'as':_0x1b64('0x2a')});db[_0x1b64('0x46')][_0x1b64('0x11b')](db['CmList'],{'as':_0x1b64('0x161'),'foreignKey':'ListId'});db[_0x1b64('0x46')][_0x1b64('0x11b')](db[_0x1b64('0x82')],{'as':_0x1b64('0x14d'),'foreignKey':_0x1b64('0x14e')});db[_0x1b64('0x46')][_0x1b64('0x11f')](db[_0x1b64('0x13')],{'as':_0x1b64('0x164'),'through':'user_has_fax_accounts'});db[_0x1b64('0x178')][_0x1b64('0x11b')](db['User'],{'onDelete':_0x1b64('0x171')});db['FaxApplication'][_0x1b64('0x11b')](db['FaxQueue'],{'onDelete':_0x1b64('0x171')});db['FaxApplication']['belongsTo'](db['FaxAccount'],{'onDelete':_0x1b64('0x171')});db[_0x1b64('0x178')][_0x1b64('0x11b')](db['Tag'],{'onDelete':_0x1b64('0x171'),'foreignKey':_0x1b64('0x172')});db['FaxInteraction'][_0x1b64('0x10d')](db[_0x1b64('0x4a')],{'as':'Messages','onDelete':_0x1b64('0x111'),'foreignKey':'FaxInteractionId'});db[_0x1b64('0x49')][_0x1b64('0x11b')](db['FaxAccount'],{'as':_0x1b64('0x16e'),'foreignKey':_0x1b64('0x176')});db[_0x1b64('0x49')][_0x1b64('0x11b')](db[_0x1b64('0x6b')],{'as':'Contact','foreignKey':_0x1b64('0x15a')});db['FaxInteraction'][_0x1b64('0x11b')](db[_0x1b64('0x13')],{'as':_0x1b64('0x179'),'foreignKey':'UserId'});db[_0x1b64('0x49')]['belongsToMany'](db[_0x1b64('0x167')],{'through':_0x1b64('0x17a'),'as':_0x1b64('0x168')});db['FaxInteraction'][_0x1b64('0x11f')](db['Tag'],{'through':_0x1b64('0x17a'),'as':_0x1b64('0x16a')});db[_0x1b64('0x49')][_0x1b64('0x11f')](db[_0x1b64('0x13')],{'as':_0x1b64('0x16b'),'through':_0x1b64('0x125'),'foreignKey':_0x1b64('0x17b')});db[_0x1b64('0x4a')]['belongsTo'](db['User'],{'onDelete':_0x1b64('0x111'),'as':'User'});db['FaxMessage'][_0x1b64('0x11b')](db['FaxInteraction'],{'as':_0x1b64('0x16d'),'foreignKey':'FaxInteractionId'});db[_0x1b64('0x4a')]['belongsTo'](db['CmContact'],{'onDelete':_0x1b64('0x111'),'as':_0x1b64('0x159')});db['FaxMessage']['belongsTo'](db[_0x1b64('0xea')],{'as':_0x1b64('0xea'),'foreignKey':'AttachmentId'});db[_0x1b64('0x4a')][_0x1b64('0x11b')](db[_0x1b64('0x46')],{'as':_0x1b64('0x16e'),'foreignKey':_0x1b64('0x176')});db['FaxQueue'][_0x1b64('0x11f')](db[_0x1b64('0x13')],{'as':_0x1b64('0x164'),'through':'UserFaxQueue'});db[_0x1b64('0x4c')][_0x1b64('0x11f')](db[_0x1b64('0xe4')],{'through':'team_has_fax_queues','as':'Teams'});db[_0x1b64('0x4e')][_0x1b64('0x11b')](db['FaxAccount'],{});db['FaxQueueReport'][_0x1b64('0x11b')](db[_0x1b64('0x121')],{'as':'List','foreignKey':'ListId'});db['FaxQueueReport'][_0x1b64('0x11b')](db[_0x1b64('0x6b')],{'as':'Contact','foreignKey':_0x1b64('0x15a')});db['FaxQueueReport'][_0x1b64('0x11b')](db['FaxInteraction'],{});db[_0x1b64('0x4e')]['belongsTo'](db[_0x1b64('0x4a')],{});db['FaxQueueReport'][_0x1b64('0x11b')](db[_0x1b64('0x13')],{});db[_0x1b64('0x4e')][_0x1b64('0x11b')](db[_0x1b64('0x4c')],{});db[_0x1b64('0x50')][_0x1b64('0x10d')](db['Disposition'],{'as':_0x1b64('0x15d'),'foreignKey':_0x1b64('0x17c')});db[_0x1b64('0x50')][_0x1b64('0x10d')](db[_0x1b64('0x7a')],{'as':_0x1b64('0x15e'),'foreignKey':_0x1b64('0x17c')});db[_0x1b64('0x50')]['hasMany'](db[_0x1b64('0x54')],{'as':_0x1b64('0x153'),'foreignKey':_0x1b64('0x17c')});db[_0x1b64('0x50')][_0x1b64('0x10d')](db[_0x1b64('0x52')],{'as':_0x1b64('0x15f')});db[_0x1b64('0x50')][_0x1b64('0x10d')](db['SmsApplication'],{'as':_0x1b64('0x142')});db[_0x1b64('0x50')][_0x1b64('0x11b')](db[_0x1b64('0x121')],{'as':_0x1b64('0x161'),'foreignKey':_0x1b64('0x162')});db[_0x1b64('0x50')][_0x1b64('0x11b')](db[_0x1b64('0x82')],{'as':_0x1b64('0x14d'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x1b64('0x50')]['belongsToMany'](db[_0x1b64('0x13')],{'as':_0x1b64('0x164'),'through':_0x1b64('0x17d')});db[_0x1b64('0x51')][_0x1b64('0x11b')](db['User'],{'onDelete':_0x1b64('0x171')});db[_0x1b64('0x51')][_0x1b64('0x11b')](db['SmsQueue'],{'onDelete':_0x1b64('0x171')});db[_0x1b64('0x51')][_0x1b64('0x11b')](db[_0x1b64('0x50')],{'onDelete':_0x1b64('0x171')});db[_0x1b64('0x51')]['belongsTo'](db[_0x1b64('0x80')],{'onDelete':'restrict','foreignKey':'IntervalId'});db[_0x1b64('0x51')][_0x1b64('0x11b')](db[_0x1b64('0x167')],{'onDelete':_0x1b64('0x171'),'foreignKey':_0x1b64('0x172')});db[_0x1b64('0x52')][_0x1b64('0x10d')](db[_0x1b64('0x54')],{'as':_0x1b64('0x153'),'onDelete':'cascade','foreignKey':_0x1b64('0x17e')});db['SmsInteraction'][_0x1b64('0x11b')](db['SmsAccount'],{'as':_0x1b64('0x16e'),'foreignKey':_0x1b64('0x17c')});db['SmsInteraction'][_0x1b64('0x11b')](db[_0x1b64('0x6b')],{'as':_0x1b64('0x159'),'foreignKey':_0x1b64('0x15a')});db['SmsInteraction']['belongsTo'](db[_0x1b64('0x13')],{'as':'Owner','foreignKey':_0x1b64('0x10f')});db[_0x1b64('0x52')][_0x1b64('0x11f')](db[_0x1b64('0x167')],{'through':_0x1b64('0x17f'),'as':'Tags'});db[_0x1b64('0x52')][_0x1b64('0x11f')](db[_0x1b64('0x167')],{'through':'sms_interaction_has_tags','as':_0x1b64('0x16a')});db[_0x1b64('0x52')]['belongsToMany'](db['User'],{'as':_0x1b64('0x16b'),'through':'user_has_sms_interactions','foreignKey':_0x1b64('0x17e')});db[_0x1b64('0x54')][_0x1b64('0x11b')](db[_0x1b64('0x13')],{'as':_0x1b64('0x13')});db[_0x1b64('0x54')][_0x1b64('0x11b')](db['CmContact'],{'onDelete':_0x1b64('0x111'),'as':'Contact'});db[_0x1b64('0x54')]['belongsTo'](db[_0x1b64('0x52')],{'onDelete':_0x1b64('0x111'),'as':_0x1b64('0x16d'),'foreignKey':_0x1b64('0x17e')});db[_0x1b64('0x54')][_0x1b64('0x11b')](db[_0x1b64('0x50')],{'as':'Account','foreignKey':_0x1b64('0x17c')});db[_0x1b64('0x55')][_0x1b64('0x11f')](db[_0x1b64('0x13')],{'as':_0x1b64('0x164'),'through':'UserSmsQueue','foreignKey':_0x1b64('0x180')});db[_0x1b64('0x55')][_0x1b64('0x11f')](db[_0x1b64('0xe4')],{'through':_0x1b64('0x181'),'as':'Teams'});db['OpenchannelAccount'][_0x1b64('0x10d')](db['Disposition'],{'as':_0x1b64('0x15d'),'foreignKey':_0x1b64('0x182')});db['OpenchannelAccount'][_0x1b64('0x10d')](db['CannedAnswer'],{'as':_0x1b64('0x15e'),'foreignKey':_0x1b64('0x182')});db[_0x1b64('0x137')][_0x1b64('0x10d')](db[_0x1b64('0x59')],{'as':_0x1b64('0x15f'),'foreignKey':_0x1b64('0x182')});db[_0x1b64('0x137')][_0x1b64('0x10d')](db[_0x1b64('0x5b')],{'as':_0x1b64('0x153'),'foreignKey':_0x1b64('0x182')});db[_0x1b64('0x137')][_0x1b64('0x10d')](db['OpenchannelApplication'],{'as':_0x1b64('0x142'),'foreignKey':_0x1b64('0x182')});db[_0x1b64('0x137')][_0x1b64('0x11b')](db[_0x1b64('0x121')],{'as':_0x1b64('0x161'),'foreignKey':_0x1b64('0x162')});db['OpenchannelAccount'][_0x1b64('0x11b')](db[_0x1b64('0x82')],{'as':_0x1b64('0x14d'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x1b64('0x137')][_0x1b64('0x11f')](db[_0x1b64('0x13')],{'as':_0x1b64('0x164'),'through':'user_has_openchannel_accounts'});db['OpenchannelApplication'][_0x1b64('0x11b')](db[_0x1b64('0x13')],{'onDelete':'restrict'});db[_0x1b64('0x57')][_0x1b64('0x11b')](db[_0x1b64('0x5c')],{'onDelete':_0x1b64('0x171'),'foreignKey':_0x1b64('0x183')});db[_0x1b64('0x57')][_0x1b64('0x11b')](db[_0x1b64('0x137')],{'onDelete':_0x1b64('0x171'),'foreignKey':_0x1b64('0x182')});db[_0x1b64('0x57')][_0x1b64('0x11b')](db[_0x1b64('0x80')],{'onDelete':_0x1b64('0x171'),'foreignKey':'IntervalId'});db[_0x1b64('0x57')][_0x1b64('0x11b')](db[_0x1b64('0x167')],{'onDelete':_0x1b64('0x171'),'foreignKey':'TagId'});db[_0x1b64('0x59')]['hasMany'](db[_0x1b64('0x5b')],{'as':'Messages','onDelete':_0x1b64('0x111'),'foreignKey':_0x1b64('0x184')});db[_0x1b64('0x59')][_0x1b64('0x11b')](db[_0x1b64('0x137')],{'as':'Account','foreignKey':_0x1b64('0x182')});db['OpenchannelInteraction'][_0x1b64('0x11b')](db[_0x1b64('0x6b')],{'as':_0x1b64('0x159'),'foreignKey':_0x1b64('0x15a')});db[_0x1b64('0x59')][_0x1b64('0x11b')](db[_0x1b64('0x13')],{'as':'Owner','foreignKey':'UserId'});db[_0x1b64('0x59')][_0x1b64('0x11f')](db[_0x1b64('0x167')],{'through':_0x1b64('0x185'),'as':_0x1b64('0x168')});db['OpenchannelInteraction'][_0x1b64('0x11f')](db[_0x1b64('0x167')],{'through':_0x1b64('0x185'),'as':'ThroughTags'});db[_0x1b64('0x59')][_0x1b64('0x11f')](db[_0x1b64('0x13')],{'as':'Users','through':_0x1b64('0x127'),'foreignKey':_0x1b64('0x184')});db['OpenchannelMessage'][_0x1b64('0x11b')](db['User'],{'onDelete':_0x1b64('0x111'),'as':_0x1b64('0x13')});db[_0x1b64('0x5b')][_0x1b64('0x11b')](db[_0x1b64('0x6b')],{'onDelete':_0x1b64('0x111'),'as':'Contact'});db[_0x1b64('0x5b')][_0x1b64('0x11b')](db['OpenchannelInteraction'],{'onDelete':_0x1b64('0x111'),'as':'Interaction','foreignKey':'OpenchannelInteractionId'});db[_0x1b64('0x5b')]['belongsTo'](db[_0x1b64('0xea')],{'as':'Attachment','foreignKey':_0x1b64('0x186')});db['OpenchannelMessage']['belongsTo'](db[_0x1b64('0x137')],{'as':_0x1b64('0x16e'),'foreignKey':_0x1b64('0x182')});db[_0x1b64('0x5c')][_0x1b64('0x11f')](db[_0x1b64('0x13')],{'as':_0x1b64('0x164'),'through':_0x1b64('0x12f'),'foreignKey':_0x1b64('0x183')});db[_0x1b64('0x5c')][_0x1b64('0x11f')](db[_0x1b64('0xe4')],{'through':_0x1b64('0x187'),'as':'Teams'});db['ChatWebsite'][_0x1b64('0x10d')](db[_0x1b64('0x7c')],{'as':'Dispositions','foreignKey':'ChatWebsiteId'});db['ChatWebsite'][_0x1b64('0x10d')](db['CannedAnswer'],{'as':'Answers','foreignKey':_0x1b64('0x16f')});db['ChatWebsite'][_0x1b64('0x10d')](db['ChatProactiveAction'],{'as':_0x1b64('0x188')});db[_0x1b64('0x5d')][_0x1b64('0x10d')](db[_0x1b64('0x61')],{'as':_0x1b64('0x15f')});db['ChatWebsite'][_0x1b64('0x10d')](db[_0x1b64('0x189')],{'as':_0x1b64('0x142')});db[_0x1b64('0x5d')][_0x1b64('0x10d')](db[_0x1b64('0x63')],{'as':_0x1b64('0x153')});db['ChatWebsite'][_0x1b64('0x11b')](db[_0x1b64('0x121')],{'as':'List','foreignKey':_0x1b64('0x162')});db['ChatWebsite']['belongsTo'](db[_0x1b64('0x80')],{'as':'Interval','foreignKey':'IntervalId'});db['ChatWebsite']['belongsTo'](db[_0x1b64('0x135')],{'as':'MailAccount','foreignKey':_0x1b64('0x15b')});db['ChatWebsite'][_0x1b64('0x11b')](db[_0x1b64('0x82')],{'as':'mandatoryDispositionPause','foreignKey':_0x1b64('0x14e')});db[_0x1b64('0x5d')][_0x1b64('0x11f')](db['User'],{'as':_0x1b64('0x164'),'through':_0x1b64('0x134')});db['OpenchannelQueueReport'][_0x1b64('0x11b')](db[_0x1b64('0x137')],{});db['OpenchannelQueueReport'][_0x1b64('0x11b')](db[_0x1b64('0x121')],{'as':'List','foreignKey':_0x1b64('0x162')});db[_0x1b64('0x18a')][_0x1b64('0x11b')](db[_0x1b64('0x6b')],{'as':_0x1b64('0x159'),'foreignKey':'ContactId'});db['OpenchannelQueueReport'][_0x1b64('0x11b')](db[_0x1b64('0x59')],{});db['OpenchannelQueueReport'][_0x1b64('0x11b')](db[_0x1b64('0x5b')],{});db[_0x1b64('0x18a')][_0x1b64('0x11b')](db[_0x1b64('0x13')],{});db[_0x1b64('0x18a')][_0x1b64('0x11b')](db['OpenchannelQueue'],{});db['ChatApplication'][_0x1b64('0x11b')](db[_0x1b64('0x13')],{'as':_0x1b64('0x18b'),'foreignKey':_0x1b64('0x10f'),'onDelete':_0x1b64('0x171')});db[_0x1b64('0x189')][_0x1b64('0x11b')](db[_0x1b64('0x65')],{'as':_0x1b64('0x18c'),'foreignKey':'ChatQueueId','onDelete':_0x1b64('0x171')});db[_0x1b64('0x189')][_0x1b64('0x11b')](db[_0x1b64('0x5d')],{'as':_0x1b64('0x18d'),'foreignKey':'ChatWebsiteId','onDelete':_0x1b64('0x171')});db[_0x1b64('0x189')][_0x1b64('0x11b')](db[_0x1b64('0x167')],{'onDelete':_0x1b64('0x171'),'foreignKey':_0x1b64('0x172')});db[_0x1b64('0x61')][_0x1b64('0x10d')](db['ChatMessage'],{'as':_0x1b64('0x153'),'onDelete':_0x1b64('0x111'),'foreignKey':_0x1b64('0x18e')});db[_0x1b64('0x61')][_0x1b64('0x11b')](db['ChatWebsite'],{'as':_0x1b64('0x16e'),'foreignKey':_0x1b64('0x16f')});db[_0x1b64('0x61')][_0x1b64('0x11b')](db[_0x1b64('0x6b')],{'as':_0x1b64('0x159'),'foreignKey':_0x1b64('0x15a')});db['ChatInteraction']['belongsTo'](db[_0x1b64('0x13')],{'as':'Owner','foreignKey':_0x1b64('0x10f')});db['ChatInteraction'][_0x1b64('0x11f')](db[_0x1b64('0x167')],{'through':_0x1b64('0x18f'),'as':_0x1b64('0x168')});db[_0x1b64('0x61')][_0x1b64('0x11f')](db[_0x1b64('0x167')],{'through':'chat_interaction_has_tags','as':_0x1b64('0x16a')});db[_0x1b64('0x61')][_0x1b64('0x11f')](db[_0x1b64('0x13')],{'as':_0x1b64('0x16b'),'through':_0x1b64('0x124'),'foreignKey':_0x1b64('0x18e')});db[_0x1b64('0x63')][_0x1b64('0x11b')](db['User'],{'onDelete':_0x1b64('0x111'),'as':_0x1b64('0x13')});db[_0x1b64('0x63')][_0x1b64('0x11b')](db[_0x1b64('0x6b')],{'onDelete':_0x1b64('0x111'),'as':'Contact','foreignKey':_0x1b64('0x15a')});db[_0x1b64('0x63')][_0x1b64('0x11b')](db[_0x1b64('0x61')],{'onDelete':'cascade','as':_0x1b64('0x16d'),'foreignKey':'ChatInteractionId'});db['ChatMessage'][_0x1b64('0x11b')](db[_0x1b64('0xea')],{'as':'Attachment','foreignKey':_0x1b64('0x186')});db[_0x1b64('0x63')][_0x1b64('0x11b')](db[_0x1b64('0x5d')],{'as':_0x1b64('0x16e'),'foreignKey':_0x1b64('0x16f')});db[_0x1b64('0x190')][_0x1b64('0x10d')](db[_0x1b64('0xea')],{'as':'Attachments','foreignKey':'ChatOfflineMessageId','onDelete':_0x1b64('0x111'),'hooks':!![]});db[_0x1b64('0x190')][_0x1b64('0x11b')](db[_0x1b64('0x6b')],{'onDelete':'cascade','as':_0x1b64('0x159'),'foreignKey':_0x1b64('0x15a')});db[_0x1b64('0x190')][_0x1b64('0x11b')](db[_0x1b64('0x5d')],{'as':'Account','foreignKey':_0x1b64('0x16f')});db[_0x1b64('0x65')][_0x1b64('0x11f')](db[_0x1b64('0x13')],{'as':'Agents','through':'UserChatQueue','hooks':!![]});db[_0x1b64('0x65')][_0x1b64('0x11f')](db[_0x1b64('0xe4')],{'through':_0x1b64('0x191'),'as':_0x1b64('0x14f')});db[_0x1b64('0x67')][_0x1b64('0x10d')](db[_0x1b64('0xd1')],{'as':'Messages','foreignKey':_0x1b64('0x192'),'onDelete':'cascade'});db[_0x1b64('0x67')][_0x1b64('0x11f')](db[_0x1b64('0x13')],{'as':'Members','through':_0x1b64('0x11e')});db[_0x1b64('0x193')]['belongsTo'](db[_0x1b64('0x5d')],{'as':_0x1b64('0x18d'),'foreignKey':_0x1b64('0x16f')});db[_0x1b64('0x69')]['hasMany'](db[_0x1b64('0x6b')],{'as':_0x1b64('0x194'),'foreignKey':_0x1b64('0x195')});db[_0x1b64('0x6b')][_0x1b64('0x10d')](db['CmHopper'],{'as':'Hoppers','foreignKey':_0x1b64('0x15a')});db['CmContact'][_0x1b64('0x10d')](db[_0x1b64('0x71')],{'as':_0x1b64('0x112'),'foreignKey':_0x1b64('0x15a')});db[_0x1b64('0x6b')][_0x1b64('0x10d')](db['CmHopperHistory'],{'as':'HopperHistories','foreignKey':_0x1b64('0x15a')});db['CmContact'][_0x1b64('0x10d')](db[_0x1b64('0x74')],{'as':_0x1b64('0x74'),'foreignKey':_0x1b64('0x15a')});db[_0x1b64('0x6b')]['hasMany'](db[_0x1b64('0xd7')],{'as':_0x1b64('0x14a'),'foreignKey':_0x1b64('0x15a')});db[_0x1b64('0x6b')][_0x1b64('0x10d')](db['OpenchannelInteraction'],{'as':_0x1b64('0x114'),'foreignKey':_0x1b64('0x15a'),'onDelete':_0x1b64('0x171')});db[_0x1b64('0x6b')][_0x1b64('0x10d')](db[_0x1b64('0x61')],{'as':_0x1b64('0x115'),'foreignKey':_0x1b64('0x15a'),'onDelete':_0x1b64('0x171')});db[_0x1b64('0x6b')][_0x1b64('0x10d')](db[_0x1b64('0x52')],{'as':_0x1b64('0x116'),'foreignKey':_0x1b64('0x15a'),'onDelete':'restrict'});db['CmContact'][_0x1b64('0x10d')](db[_0x1b64('0x49')],{'as':'FaxInteractions','foreignKey':_0x1b64('0x15a'),'onDelete':_0x1b64('0x171')});db['CmContact'][_0x1b64('0x10d')](db['MailInteraction'],{'as':'MailInteractions','foreignKey':'ContactId','onDelete':_0x1b64('0x171')});db[_0x1b64('0x6b')]['belongsTo'](db[_0x1b64('0x69')],{'as':_0x1b64('0x196'),'foreignKey':_0x1b64('0x195')});db[_0x1b64('0x6b')]['belongsTo'](db[_0x1b64('0x121')],{'as':_0x1b64('0x161'),'foreignKey':_0x1b64('0x162'),'onDelete':_0x1b64('0x111')});db['CmContact'][_0x1b64('0x11f')](db[_0x1b64('0x13')],{'as':_0x1b64('0x16b'),'through':_0x1b64('0x120')});db[_0x1b64('0x6b')][_0x1b64('0x11f')](db['Tag'],{'as':_0x1b64('0x168'),'through':_0x1b64('0x197')});db[_0x1b64('0x6b')][_0x1b64('0x11f')](db[_0x1b64('0x167')],{'through':'cm_contact_has_tags','as':_0x1b64('0x16a')});db[_0x1b64('0x6d')][_0x1b64('0x11b')](db[_0x1b64('0x6b')],{'as':_0x1b64('0x159'),'foreignKey':_0x1b64('0x15a'),'onDelete':_0x1b64('0x111')});db['CmHopper'][_0x1b64('0x11b')](db[_0x1b64('0x121')],{'as':_0x1b64('0x161'),'foreignKey':_0x1b64('0x162'),'onDelete':_0x1b64('0x111')});db['CmHopper'][_0x1b64('0x11b')](db[_0x1b64('0x13')],{'as':_0x1b64('0x18b'),'foreignKey':_0x1b64('0x10f')});db[_0x1b64('0x6d')][_0x1b64('0x11b')](db['VoiceQueue'],{'as':'Queue','foreignKey':'VoiceQueueId','onDelete':'cascade'});db['CmHopper'][_0x1b64('0x11b')](db[_0x1b64('0xe7')],{'as':_0x1b64('0xe7'),'foreignKey':'CampaignId','onDelete':_0x1b64('0x111')});db['CmHopper'][_0x1b64('0x11b')](db['User'],{'as':'Owner','foreignKey':_0x1b64('0x198')});db[_0x1b64('0x6f')][_0x1b64('0x11b')](db[_0x1b64('0x6b')],{'as':'Contact','foreignKey':_0x1b64('0x15a'),'onDelete':_0x1b64('0x111')});db[_0x1b64('0x6f')][_0x1b64('0x11b')](db[_0x1b64('0x121')],{'as':_0x1b64('0x161'),'foreignKey':_0x1b64('0x162'),'onDelete':_0x1b64('0x111')});db[_0x1b64('0x6f')][_0x1b64('0x11b')](db[_0x1b64('0x1b')],{'as':_0x1b64('0x18c'),'foreignKey':_0x1b64('0x146'),'onDelete':_0x1b64('0x111')});db[_0x1b64('0x6f')]['belongsTo'](db[_0x1b64('0xe7')],{'as':_0x1b64('0xe7'),'foreignKey':_0x1b64('0x199'),'onDelete':'cascade'});db[_0x1b64('0x79')][_0x1b64('0x10d')](db[_0x1b64('0x7e')],{'as':{'plural':_0x1b64('0x19a'),'singular':_0x1b64('0x19b')},'foreignKey':_0x1b64('0x19c'),'onDelete':_0x1b64('0x111'),'hooks':!![]});db[_0x1b64('0x79')]['hasMany'](db[_0x1b64('0x7e')],{'as':{'plural':_0x1b64('0x19d'),'singular':_0x1b64('0x19e')},'foreignKey':_0x1b64('0x19f'),'onDelete':'cascade','hooks':!![]});db[_0x1b64('0x79')][_0x1b64('0x10d')](db[_0x1b64('0x77')],{'as':'Actions','foreignKey':_0x1b64('0x1a0'),'onDelete':_0x1b64('0x111'),'hooks':!![]});db[_0x1b64('0x7c')][_0x1b64('0x10d')](db['Disposition'],{'as':_0x1b64('0x15d'),'foreignKey':_0x1b64('0x1a1'),'onDelete':_0x1b64('0x111')});db[_0x1b64('0x80')]['hasMany'](db[_0x1b64('0x80')],{'as':'Intervals','foreignKey':_0x1b64('0x1a2'),'onDelete':'cascade','hooks':!![],'required':![]});db['Interval']['hasMany'](db[_0x1b64('0x13f')],{'as':'Extensions','foreignKey':_0x1b64('0x1a2'),'onDelete':'restrict'});db['Interval']['hasMany'](db['MailApplication'],{'as':_0x1b64('0x1a3'),'foreignKey':_0x1b64('0x1a2')});db[_0x1b64('0x80')][_0x1b64('0x10d')](db[_0x1b64('0x189')],{'as':_0x1b64('0x1a4'),'foreignKey':_0x1b64('0x1a2')});db[_0x1b64('0x80')][_0x1b64('0x10d')](db[_0x1b64('0x178')],{'as':'FaxApplications','foreignKey':_0x1b64('0x1a2')});db['Interval'][_0x1b64('0x10d')](db[_0x1b64('0x51')],{'as':'SmsApplications','foreignKey':'IntervalId'});db[_0x1b64('0x88')][_0x1b64('0x11b')](db[_0x1b64('0x135')],{});db['Schedule'][_0x1b64('0x11b')](db[_0x1b64('0x94')],{'foreignKey':_0x1b64('0x1a5')});db[_0x1b64('0x88')]['belongsTo'](db[_0x1b64('0x92')],{'foreignKey':_0x1b64('0x1a6')});db[_0x1b64('0x8a')][_0x1b64('0x11f')](db['VoiceMusicOnHold'],{'as':_0x1b64('0x1a7'),'through':_0x1b64('0x144'),'onDelete':'restrict'});db[_0x1b64('0x167')]['belongsToMany'](db[_0x1b64('0x6b')],{'through':_0x1b64('0x197')});db[_0x1b64('0x167')][_0x1b64('0x11f')](db[_0x1b64('0x61')],{'through':_0x1b64('0x18f')});db['Tag'][_0x1b64('0x11f')](db[_0x1b64('0x3f')],{'through':'mail_interaction_has_tags'});db[_0x1b64('0x167')][_0x1b64('0x11f')](db[_0x1b64('0x52')],{'through':_0x1b64('0x17f')});db[_0x1b64('0x167')][_0x1b64('0x11f')](db['FaxInteraction'],{'through':_0x1b64('0x17a')});db[_0x1b64('0x167')][_0x1b64('0x11f')](db[_0x1b64('0x59')],{'through':'openchannel_interaction_has_tags'});db['Tag'][_0x1b64('0x11f')](db[_0x1b64('0x104')],{'through':_0x1b64('0x1a8')});db[_0x1b64('0x8e')]['hasMany'](db[_0x1b64('0x7e')],{'as':{'plural':_0x1b64('0x1a9'),'singular':_0x1b64('0x1aa')},'foreignKey':_0x1b64('0x1ab'),'onDelete':_0x1b64('0x111'),'hooks':!![]});db[_0x1b64('0x8e')][_0x1b64('0x10d')](db[_0x1b64('0x7e')],{'as':{'plural':_0x1b64('0x1ac'),'singular':'AnyCondition'},'foreignKey':_0x1b64('0x1ad'),'onDelete':'cascade','hooks':!![]});db[_0x1b64('0x8e')][_0x1b64('0x10d')](db['Action'],{'as':_0x1b64('0x1ae'),'foreignKey':_0x1b64('0x1af'),'onDelete':_0x1b64('0x111'),'hooks':!![]});db['AnalyticCustomReport'][_0x1b64('0x10d')](db[_0x1b64('0x1b0')],{'as':_0x1b64('0x1b1'),'onDelete':_0x1b64('0x111'),'foreignKey':_0x1b64('0x1a6'),'hooks':!![]});db['AnalyticDefaultReport'][_0x1b64('0x10d')](db['AnalyticFieldReport'],{'as':_0x1b64('0x1b1'),'onDelete':_0x1b64('0x111'),'foreignKey':_0x1b64('0x1a5')});db[_0x1b64('0x97')]['hasMany'](db[_0x1b64('0x1b0')],{'as':'Fields','onDelete':'cascade','foreignKey':_0x1b64('0x1b2')});db[_0x1b64('0x1b0')][_0x1b64('0x11b')](db[_0x1b64('0x97')],{'foreignKey':_0x1b64('0x1b2')});db['SalesforceAccount']['hasMany'](db[_0x1b64('0x9d')],{'as':_0x1b64('0x1b3'),'onDelete':_0x1b64('0x111'),'foreignKey':_0x1b64('0x1b4')});db[_0x1b64('0x9d')]['hasMany'](db['SalesforceField'],{'as':_0x1b64('0x1b5'),'onDelete':_0x1b64('0x111'),'foreignKey':_0x1b64('0x1b6')});db[_0x1b64('0x9d')][_0x1b64('0x10d')](db[_0x1b64('0x9f')],{'as':'Descriptions','onDelete':_0x1b64('0x111'),'foreignKey':'DescriptionId'});db[_0x1b64('0x9d')][_0x1b64('0x10d')](db[_0x1b64('0x9f')],{'as':_0x1b64('0x1b1'),'onDelete':_0x1b64('0x111'),'foreignKey':_0x1b64('0x1b7')});db[_0x1b64('0x9d')]['belongsTo'](db[_0x1b64('0x9b')],{'as':_0x1b64('0x16e'),'foreignKey':'AccountId'});db[_0x1b64('0x9f')][_0x1b64('0x10d')](db[_0x1b64('0x9f')],{'as':_0x1b64('0x1b8'),'foreignKey':'SubjectId'});db[_0x1b64('0x9f')][_0x1b64('0x10d')](db[_0x1b64('0x9f')],{'as':_0x1b64('0x1b9'),'foreignKey':'DescriptionId'});db['SalesforceField']['hasMany'](db[_0x1b64('0x9f')],{'as':_0x1b64('0x1ba'),'foreignKey':'FieldId'});db[_0x1b64('0x9f')][_0x1b64('0x11b')](db[_0x1b64('0x8f')],{'as':_0x1b64('0x8f'),'foreignKey':_0x1b64('0x1bb')});db[_0x1b64('0x1bc')]['hasMany'](db[_0x1b64('0xa2')],{'as':_0x1b64('0x1b3'),'onDelete':_0x1b64('0x111'),'foreignKey':_0x1b64('0x1b4')});db[_0x1b64('0xa2')]['hasMany'](db['SugarcrmField'],{'as':_0x1b64('0x1b5'),'onDelete':_0x1b64('0x111'),'foreignKey':_0x1b64('0x1b6')});db[_0x1b64('0xa2')][_0x1b64('0x10d')](db[_0x1b64('0xa4')],{'as':_0x1b64('0x1bd'),'onDelete':'cascade','foreignKey':_0x1b64('0x1be')});db['SugarcrmConfiguration'][_0x1b64('0x10d')](db[_0x1b64('0xa4')],{'as':'Fields','onDelete':'cascade','foreignKey':_0x1b64('0x1b7')});db[_0x1b64('0xa2')]['belongsTo'](db[_0x1b64('0x1bc')],{'as':_0x1b64('0x16e'),'foreignKey':_0x1b64('0x1b4')});db[_0x1b64('0xa4')]['hasMany'](db[_0x1b64('0xa4')],{'as':_0x1b64('0x1b8'),'foreignKey':_0x1b64('0x1b6')});db[_0x1b64('0xa4')][_0x1b64('0x10d')](db[_0x1b64('0xa4')],{'as':_0x1b64('0x1b9'),'foreignKey':_0x1b64('0x1be')});db['SugarcrmField'][_0x1b64('0x10d')](db['SugarcrmField'],{'as':_0x1b64('0x1ba'),'foreignKey':'FieldId'});db[_0x1b64('0xa4')][_0x1b64('0x11b')](db[_0x1b64('0x8f')],{'as':_0x1b64('0x8f'),'foreignKey':'VariableId'});db[_0x1b64('0xa6')][_0x1b64('0x10d')](db[_0x1b64('0xa8')],{'as':_0x1b64('0x1b3'),'onDelete':'cascade','foreignKey':_0x1b64('0x1b4')});db[_0x1b64('0xa8')][_0x1b64('0x10d')](db['DeskField'],{'as':'Subjects','onDelete':_0x1b64('0x111'),'foreignKey':'SubjectId'});db[_0x1b64('0xa8')][_0x1b64('0x10d')](db['DeskField'],{'as':_0x1b64('0x1bd'),'onDelete':_0x1b64('0x111'),'foreignKey':_0x1b64('0x1be')});db[_0x1b64('0xa8')][_0x1b64('0x10d')](db['DeskField'],{'as':_0x1b64('0x1b1'),'onDelete':_0x1b64('0x111'),'foreignKey':_0x1b64('0x1b7')});db[_0x1b64('0xa8')][_0x1b64('0x11b')](db[_0x1b64('0xa6')],{'as':_0x1b64('0x16e'),'foreignKey':'AccountId'});db['DeskConfiguration'][_0x1b64('0x11f')](db['Tag'],{'through':_0x1b64('0x1bf')});db[_0x1b64('0xaa')][_0x1b64('0x10d')](db[_0x1b64('0xaa')],{'as':_0x1b64('0x1b8'),'foreignKey':_0x1b64('0x1b6')});db[_0x1b64('0xaa')][_0x1b64('0x10d')](db[_0x1b64('0xaa')],{'as':'Description','foreignKey':_0x1b64('0x1be')});db['DeskField'][_0x1b64('0x10d')](db[_0x1b64('0xaa')],{'as':_0x1b64('0x1ba'),'foreignKey':'FieldId'});db[_0x1b64('0xaa')]['belongsTo'](db['Variable'],{'as':_0x1b64('0x8f'),'foreignKey':_0x1b64('0x1bb')});db['ZohoAccount'][_0x1b64('0x10d')](db[_0x1b64('0xac')],{'as':_0x1b64('0x1b3'),'onDelete':_0x1b64('0x111'),'foreignKey':_0x1b64('0x1b4')});db[_0x1b64('0xac')]['hasMany'](db[_0x1b64('0x1c0')],{'as':_0x1b64('0x1b5'),'onDelete':_0x1b64('0x111'),'foreignKey':_0x1b64('0x1b6')});db[_0x1b64('0xac')][_0x1b64('0x10d')](db[_0x1b64('0x1c0')],{'as':_0x1b64('0x1bd'),'onDelete':'cascade','foreignKey':_0x1b64('0x1be')});db['ZohoConfiguration'][_0x1b64('0x10d')](db[_0x1b64('0x1c0')],{'as':_0x1b64('0x1b1'),'onDelete':_0x1b64('0x111'),'foreignKey':_0x1b64('0x1b7')});db[_0x1b64('0xac')]['belongsTo'](db['ZohoAccount'],{'as':'Account','foreignKey':_0x1b64('0x1b4')});db[_0x1b64('0x1c0')][_0x1b64('0x10d')](db['ZohoField'],{'as':_0x1b64('0x1b8'),'foreignKey':_0x1b64('0x1b6')});db[_0x1b64('0x1c0')][_0x1b64('0x10d')](db[_0x1b64('0x1c0')],{'as':'Description','foreignKey':_0x1b64('0x1be')});db['ZohoField']['hasMany'](db['ZohoField'],{'as':_0x1b64('0x1ba'),'foreignKey':_0x1b64('0x1b7')});db[_0x1b64('0x1c0')][_0x1b64('0x11b')](db[_0x1b64('0x8f')],{'as':'Variable','foreignKey':_0x1b64('0x1bb')});db[_0x1b64('0x1c1')][_0x1b64('0x10d')](db[_0x1b64('0xaf')],{'as':_0x1b64('0x1b3'),'onDelete':'cascade','foreignKey':_0x1b64('0x1b4')});db['ZendeskConfiguration'][_0x1b64('0x10d')](db[_0x1b64('0x1c2')],{'as':'Subjects','foreignKey':_0x1b64('0x1b6')});db['ZendeskConfiguration'][_0x1b64('0x10d')](db['ZendeskField'],{'as':_0x1b64('0x1bd'),'foreignKey':_0x1b64('0x1be')});db[_0x1b64('0xaf')][_0x1b64('0x10d')](db[_0x1b64('0x1c2')],{'as':_0x1b64('0x1b1'),'foreignKey':_0x1b64('0x1b7')});db[_0x1b64('0xaf')][_0x1b64('0x11b')](db['ZendeskAccount'],{'as':_0x1b64('0x16e'),'foreignKey':_0x1b64('0x1b4')});db[_0x1b64('0xaf')][_0x1b64('0x11f')](db['Tag'],{'through':_0x1b64('0x1c3')});db[_0x1b64('0x1c2')][_0x1b64('0x10d')](db[_0x1b64('0x1c2')],{'as':_0x1b64('0x1b8'),'foreignKey':_0x1b64('0x1b6')});db[_0x1b64('0x1c2')][_0x1b64('0x10d')](db['ZendeskField'],{'as':_0x1b64('0x1b9'),'foreignKey':_0x1b64('0x1be')});db[_0x1b64('0x1c2')][_0x1b64('0x10d')](db[_0x1b64('0x1c2')],{'as':_0x1b64('0x1ba'),'foreignKey':_0x1b64('0x1b7')});db['ZendeskField'][_0x1b64('0x11b')](db['Variable'],{'as':_0x1b64('0x8f'),'foreignKey':'VariableId'});db['FreshdeskAccount'][_0x1b64('0x10d')](db[_0x1b64('0x1c4')],{'as':_0x1b64('0x1b3'),'onDelete':'cascade','foreignKey':'AccountId'});db[_0x1b64('0x1c4')]['hasMany'](db['FreshdeskField'],{'as':_0x1b64('0x1b5'),'onDelete':'cascade','foreignKey':'SubjectId'});db[_0x1b64('0x1c4')][_0x1b64('0x10d')](db[_0x1b64('0xb4')],{'as':_0x1b64('0x1bd'),'onDelete':_0x1b64('0x111'),'foreignKey':_0x1b64('0x1be')});db['FreshdeskConfiguration']['hasMany'](db[_0x1b64('0xb4')],{'as':_0x1b64('0x1b1'),'onDelete':_0x1b64('0x111'),'foreignKey':_0x1b64('0x1b7')});db[_0x1b64('0x1c4')][_0x1b64('0x11b')](db['FreshdeskAccount'],{'as':'Account','foreignKey':_0x1b64('0x1b4')});db[_0x1b64('0x1c4')][_0x1b64('0x11f')](db[_0x1b64('0x167')],{'through':_0x1b64('0x1c5')});db['FreshdeskField']['hasMany'](db['FreshdeskField'],{'as':_0x1b64('0x1b8'),'foreignKey':_0x1b64('0x1b6')});db[_0x1b64('0xb4')][_0x1b64('0x10d')](db[_0x1b64('0xb4')],{'as':_0x1b64('0x1b9'),'foreignKey':_0x1b64('0x1be')});db[_0x1b64('0xb4')][_0x1b64('0x10d')](db[_0x1b64('0xb4')],{'as':_0x1b64('0x1ba'),'foreignKey':_0x1b64('0x1b7')});db[_0x1b64('0xb4')][_0x1b64('0x11b')](db['Variable'],{'as':_0x1b64('0x8f'),'foreignKey':_0x1b64('0x1bb')});db[_0x1b64('0xb6')][_0x1b64('0x10d')](db[_0x1b64('0xb8')],{'as':_0x1b64('0x1b3'),'onDelete':_0x1b64('0x111'),'foreignKey':_0x1b64('0x1b4')});db[_0x1b64('0xb8')][_0x1b64('0x10d')](db[_0x1b64('0xba')],{'as':_0x1b64('0x1b5'),'foreignKey':_0x1b64('0x1b6')});db['VtigerConfiguration']['hasMany'](db[_0x1b64('0xba')],{'as':_0x1b64('0x1bd'),'foreignKey':_0x1b64('0x1be')});db[_0x1b64('0xb8')]['hasMany'](db['VtigerField'],{'as':_0x1b64('0x1b1'),'foreignKey':_0x1b64('0x1b7')});db[_0x1b64('0xb8')]['belongsTo'](db[_0x1b64('0xb6')],{'as':_0x1b64('0x16e'),'foreignKey':_0x1b64('0x1b4')});db[_0x1b64('0xba')][_0x1b64('0x10d')](db[_0x1b64('0xba')],{'as':_0x1b64('0x1b8'),'foreignKey':'SubjectId'});db[_0x1b64('0xba')][_0x1b64('0x10d')](db[_0x1b64('0xba')],{'as':'Description','foreignKey':_0x1b64('0x1be')});db[_0x1b64('0xba')][_0x1b64('0x10d')](db[_0x1b64('0xba')],{'as':_0x1b64('0x1ba'),'foreignKey':'FieldId'});db['VtigerField'][_0x1b64('0x11b')](db[_0x1b64('0x8f')],{'as':_0x1b64('0x8f'),'foreignKey':_0x1b64('0x1bb')});db[_0x1b64('0xbc')]['hasMany'](db[_0x1b64('0xbe')],{'as':_0x1b64('0x1b3'),'onDelete':_0x1b64('0x111'),'foreignKey':'AccountId'});db[_0x1b64('0xbe')][_0x1b64('0x10d')](db[_0x1b64('0xc0')],{'as':_0x1b64('0x1b5'),'foreignKey':_0x1b64('0x1b6')});db[_0x1b64('0xbe')]['hasMany'](db[_0x1b64('0xc0')],{'as':_0x1b64('0x1bd'),'foreignKey':_0x1b64('0x1be')});db[_0x1b64('0xbe')]['hasMany'](db['ServicenowField'],{'as':_0x1b64('0x1b1'),'foreignKey':_0x1b64('0x1b7')});db[_0x1b64('0xbe')]['belongsTo'](db[_0x1b64('0xbc')],{'as':_0x1b64('0x16e'),'foreignKey':'AccountId'});db[_0x1b64('0xc0')][_0x1b64('0x10d')](db[_0x1b64('0xc0')],{'as':_0x1b64('0x1b8'),'foreignKey':_0x1b64('0x1b6')});db[_0x1b64('0xc0')][_0x1b64('0x10d')](db[_0x1b64('0xc0')],{'as':_0x1b64('0x1b9'),'foreignKey':_0x1b64('0x1be')});db[_0x1b64('0xc0')][_0x1b64('0x10d')](db[_0x1b64('0xc0')],{'as':_0x1b64('0x1ba'),'foreignKey':_0x1b64('0x1b7')});db[_0x1b64('0xc0')][_0x1b64('0x11b')](db['Variable'],{'as':_0x1b64('0x8f'),'foreignKey':_0x1b64('0x1bb')});db[_0x1b64('0x1c6')]['hasMany'](db[_0x1b64('0xc2')],{'as':_0x1b64('0x1b3'),'onDelete':'cascade','foreignKey':_0x1b64('0x1b4')});db[_0x1b64('0xc2')][_0x1b64('0x10d')](db[_0x1b64('0xc4')],{'as':'Subjects','onDelete':_0x1b64('0x111'),'foreignKey':_0x1b64('0x1b6')});db[_0x1b64('0xc2')][_0x1b64('0x10d')](db['Dynamics365Field'],{'as':_0x1b64('0x1bd'),'onDelete':_0x1b64('0x111'),'foreignKey':_0x1b64('0x1be')});db[_0x1b64('0xc2')][_0x1b64('0x10d')](db[_0x1b64('0xc4')],{'as':_0x1b64('0x1b1'),'onDelete':_0x1b64('0x111'),'foreignKey':'FieldId'});db[_0x1b64('0xc2')][_0x1b64('0x11b')](db[_0x1b64('0x1c6')],{'as':'Account','foreignKey':'AccountId'});db['Dynamics365Field'][_0x1b64('0x10d')](db['Dynamics365Field'],{'as':'Subject','foreignKey':_0x1b64('0x1b6')});db[_0x1b64('0xc4')]['hasMany'](db['Dynamics365Field'],{'as':_0x1b64('0x1b9'),'foreignKey':_0x1b64('0x1be')});db['Dynamics365Field']['hasMany'](db[_0x1b64('0xc4')],{'as':_0x1b64('0x1ba'),'foreignKey':_0x1b64('0x1b7')});db[_0x1b64('0xc4')]['belongsTo'](db[_0x1b64('0x8f')],{'as':_0x1b64('0x8f'),'foreignKey':'VariableId'});db[_0x1b64('0xc6')]['hasMany'](db[_0x1b64('0xc8')],{'as':_0x1b64('0x1b3'),'onDelete':_0x1b64('0x111'),'foreignKey':_0x1b64('0x1b4')});db[_0x1b64('0xc8')][_0x1b64('0x10d')](db[_0x1b64('0xca')],{'as':_0x1b64('0x1b5'),'foreignKey':_0x1b64('0x1b6')});db[_0x1b64('0xc8')][_0x1b64('0x10d')](db[_0x1b64('0xca')],{'as':_0x1b64('0x1bd'),'foreignKey':_0x1b64('0x1be')});db[_0x1b64('0xc8')]['hasMany'](db[_0x1b64('0xca')],{'as':'Fields','foreignKey':'FieldId'});db['FreshsalesConfiguration']['belongsTo'](db['FreshsalesAccount'],{'as':_0x1b64('0x16e'),'foreignKey':_0x1b64('0x1b4')});db[_0x1b64('0xca')]['hasMany'](db[_0x1b64('0xca')],{'as':_0x1b64('0x1b8'),'foreignKey':_0x1b64('0x1b6')});db[_0x1b64('0xca')][_0x1b64('0x10d')](db[_0x1b64('0xca')],{'as':_0x1b64('0x1b9'),'foreignKey':_0x1b64('0x1be')});db[_0x1b64('0xca')]['hasMany'](db['FreshsalesField'],{'as':_0x1b64('0x1ba'),'foreignKey':_0x1b64('0x1b7')});db[_0x1b64('0xca')][_0x1b64('0x11b')](db[_0x1b64('0x8f')],{'as':'Variable','foreignKey':'VariableId'});db['ChatQueueReport']['belongsTo'](db[_0x1b64('0x5d')],{});db[_0x1b64('0xcf')][_0x1b64('0x11b')](db[_0x1b64('0x121')],{'as':_0x1b64('0x161'),'foreignKey':_0x1b64('0x162')});db[_0x1b64('0xcf')][_0x1b64('0x11b')](db[_0x1b64('0x6b')],{'as':_0x1b64('0x159'),'foreignKey':_0x1b64('0x15a')});db['ChatQueueReport'][_0x1b64('0x11b')](db[_0x1b64('0x61')],{});db['ChatQueueReport'][_0x1b64('0x11b')](db['ChatMessage'],{});db[_0x1b64('0xcf')]['belongsTo'](db[_0x1b64('0x13')],{});db[_0x1b64('0xcf')][_0x1b64('0x11b')](db['ChatQueue'],{});db[_0x1b64('0xd1')][_0x1b64('0x11b')](db[_0x1b64('0x13')],{'onDelete':_0x1b64('0x111'),'foreignKey':'FromId'});db[_0x1b64('0xd1')][_0x1b64('0x11b')](db[_0x1b64('0x13')],{'onDelete':_0x1b64('0x111'),'foreignKey':_0x1b64('0x1c7')});db[_0x1b64('0xd7')][_0x1b64('0x10d')](db[_0x1b64('0xd5')],{'foreignKey':_0x1b64('0x1c8'),'onDelete':'cascade'});db[_0x1b64('0xd7')][_0x1b64('0x10d')](db[_0x1b64('0xd3')],{'foreignKey':_0x1b64('0x1c8'),'onDelete':'cascade'});db[_0x1b64('0x1c9')][_0x1b64('0x11b')](db['SmsAccount'],{});db[_0x1b64('0x1c9')][_0x1b64('0x11b')](db[_0x1b64('0x121')],{'as':_0x1b64('0x161'),'foreignKey':_0x1b64('0x162')});db[_0x1b64('0x1c9')][_0x1b64('0x11b')](db['CmContact'],{'as':'Contact','foreignKey':_0x1b64('0x15a')});db[_0x1b64('0x1c9')][_0x1b64('0x11b')](db[_0x1b64('0x52')],{});db['SmsQueueReport'][_0x1b64('0x11b')](db[_0x1b64('0x54')],{});db[_0x1b64('0x1c9')][_0x1b64('0x11b')](db['User'],{});db[_0x1b64('0x1c9')][_0x1b64('0x11b')](db[_0x1b64('0x55')],{});db[_0x1b64('0x1ca')]['hasMany'](db[_0x1b64('0xd7')],{'foreignKey':_0x1b64('0x1cb')});db[_0x1b64('0x1ca')][_0x1b64('0x10d')](db[_0x1b64('0xd5')],{'foreignKey':_0x1b64('0x1cb')});db[_0x1b64('0x1ca')][_0x1b64('0x10d')](db[_0x1b64('0xd3')],{'foreignKey':_0x1b64('0x1cb')});db['SquareProject']['belongsToMany'](db[_0x1b64('0x13')],{'as':_0x1b64('0x16b'),'through':_0x1b64('0x13e')});db['Team'][_0x1b64('0x11f')](db[_0x1b64('0x13')],{'as':_0x1b64('0x164'),'through':_0x1b64('0x1cc')});db[_0x1b64('0xe4')]['belongsToMany'](db[_0x1b64('0x1b')],{'through':_0x1b64('0x10b'),'as':'VoiceQueues'});db[_0x1b64('0xe4')][_0x1b64('0x11f')](db['MailQueue'],{'through':'team_has_mail_queues','as':_0x1b64('0x1cd')});db[_0x1b64('0xe4')]['belongsToMany'](db[_0x1b64('0x65')],{'through':_0x1b64('0x191'),'as':_0x1b64('0x12b')});db[_0x1b64('0xe4')][_0x1b64('0x11f')](db['FaxQueue'],{'through':'team_has_fax_queues','as':_0x1b64('0x12c')});db[_0x1b64('0xe4')]['belongsToMany'](db[_0x1b64('0x55')],{'through':'team_has_sms_queues','as':'SmsQueues'});db[_0x1b64('0xe4')]['belongsToMany'](db[_0x1b64('0x5c')],{'through':_0x1b64('0x187'),'as':_0x1b64('0x12e')});db[_0x1b64('0xe4')][_0x1b64('0x11f')](db[_0x1b64('0x1ce')],{'through':'team_has_whatsapp_queues','as':_0x1b64('0x130')});db[_0x1b64('0xe7')]['hasMany'](db[_0x1b64('0x6d')],{'as':'Hoppers','foreignKey':_0x1b64('0x199')});db[_0x1b64('0xe7')]['hasMany'](db[_0x1b64('0x71')],{'as':_0x1b64('0x112'),'foreignKey':_0x1b64('0x199')});db['Campaign'][_0x1b64('0x10d')](db['CmHopperHistory'],{'as':_0x1b64('0x148'),'foreignKey':_0x1b64('0x199')});db[_0x1b64('0xe7')][_0x1b64('0x10d')](db[_0x1b64('0x6f')],{'as':_0x1b64('0x149'),'foreignKey':_0x1b64('0x199')});db[_0x1b64('0xe7')][_0x1b64('0x11b')](db[_0x1b64('0x2a')],{'as':_0x1b64('0x2a'),'foreignKey':_0x1b64('0x1cf')});db['Campaign'][_0x1b64('0x11b')](db['Trunk'],{'as':_0x1b64('0x14b'),'foreignKey':_0x1b64('0x14c')});db['Campaign'][_0x1b64('0x11b')](db[_0x1b64('0x80')],{'as':_0x1b64('0x80'),'foreignKey':_0x1b64('0x1a2')});db[_0x1b64('0xe7')]['belongsTo'](db[_0x1b64('0xe0')],{'as':_0x1b64('0xe0'),'foreignKey':'SquareProjectId'});db[_0x1b64('0xe7')][_0x1b64('0x11f')](db[_0x1b64('0x121')],{'as':'Lists','through':_0x1b64('0x1d0')});db[_0x1b64('0xe7')][_0x1b64('0x11f')](db[_0x1b64('0x121')],{'as':'BlackLists','through':'campaigns_has_cm_blacklists'});db[_0x1b64('0xea')]['belongsTo'](db[_0x1b64('0x190')],{'as':_0x1b64('0x190'),'foreignKey':_0x1b64('0x170')});db[_0x1b64('0x1d1')][_0x1b64('0x11b')](db[_0x1b64('0x41')],{});db[_0x1b64('0x1d1')][_0x1b64('0x11b')](db[_0x1b64('0x3f')],{});db['MailTransferReport'][_0x1b64('0x11b')](db[_0x1b64('0x135')],{'foreignKey':'FromMailAccountId','as':_0x1b64('0x1d2')});db[_0x1b64('0x1d1')][_0x1b64('0x11b')](db['User'],{'foreignKey':'FromUserId','as':_0x1b64('0x1d3')});db[_0x1b64('0x1d1')][_0x1b64('0x11b')](db[_0x1b64('0x13')],{'foreignKey':'ToUserId','as':_0x1b64('0x1d4')});db[_0x1b64('0x1d1')][_0x1b64('0x11b')](db[_0x1b64('0x12a')],{'foreignKey':_0x1b64('0x1d5'),'as':'ToQueue'});db['MailTransferReport']['belongsTo'](db[_0x1b64('0x135')],{'foreignKey':'ToMailAccountId','as':_0x1b64('0x1d6')});db[_0x1b64('0xef')][_0x1b64('0x11b')](db[_0x1b64('0x63')],{});db[_0x1b64('0xef')]['belongsTo'](db[_0x1b64('0x61')],{});db[_0x1b64('0xef')]['belongsTo'](db[_0x1b64('0x5d')],{'foreignKey':_0x1b64('0x1d7'),'as':_0x1b64('0x1d2')});db[_0x1b64('0xef')][_0x1b64('0x11b')](db['User'],{'foreignKey':_0x1b64('0x1d8'),'as':'FromAgent'});db[_0x1b64('0xef')][_0x1b64('0x11b')](db[_0x1b64('0x13')],{'foreignKey':_0x1b64('0x1d9'),'as':_0x1b64('0x1d4')});db['ChatTransferReport']['belongsTo'](db[_0x1b64('0x65')],{'foreignKey':_0x1b64('0x1da'),'as':_0x1b64('0x1db')});db[_0x1b64('0xef')][_0x1b64('0x11b')](db[_0x1b64('0x5d')],{'foreignKey':'ToChatWebsiteId','as':_0x1b64('0x1d6')});db[_0x1b64('0x1dc')][_0x1b64('0x11b')](db[_0x1b64('0x4a')],{});db[_0x1b64('0x1dc')]['belongsTo'](db[_0x1b64('0x49')],{});db['FaxTransferReport'][_0x1b64('0x11b')](db[_0x1b64('0x46')],{'foreignKey':_0x1b64('0x1dd'),'as':'FromAccount'});db[_0x1b64('0x1dc')]['belongsTo'](db[_0x1b64('0x13')],{'foreignKey':_0x1b64('0x1d8'),'as':_0x1b64('0x1d3')});db[_0x1b64('0x1dc')][_0x1b64('0x11b')](db[_0x1b64('0x13')],{'foreignKey':_0x1b64('0x1d9'),'as':_0x1b64('0x1d4')});db[_0x1b64('0x1dc')][_0x1b64('0x11b')](db[_0x1b64('0x4c')],{'foreignKey':'ToFaxQueueId','as':_0x1b64('0x1db')});db[_0x1b64('0x1dc')]['belongsTo'](db[_0x1b64('0x46')],{'foreignKey':_0x1b64('0x1de'),'as':_0x1b64('0x1d6')});db[_0x1b64('0xf2')][_0x1b64('0x11b')](db[_0x1b64('0x5b')],{});db['OpenchannelTransferReport'][_0x1b64('0x11b')](db[_0x1b64('0x59')],{});db[_0x1b64('0xf2')][_0x1b64('0x11b')](db[_0x1b64('0x137')],{'foreignKey':'FromOpenchannelAccountId','as':_0x1b64('0x1d2')});db[_0x1b64('0xf2')][_0x1b64('0x11b')](db['User'],{'foreignKey':_0x1b64('0x1d8'),'as':_0x1b64('0x1d3')});db[_0x1b64('0xf2')][_0x1b64('0x11b')](db['User'],{'foreignKey':'ToUserId','as':_0x1b64('0x1d4')});db[_0x1b64('0xf2')][_0x1b64('0x11b')](db[_0x1b64('0x5c')],{'foreignKey':_0x1b64('0x1df'),'as':_0x1b64('0x1db')});db[_0x1b64('0xf2')][_0x1b64('0x11b')](db[_0x1b64('0x137')],{'foreignKey':_0x1b64('0x1e0'),'as':'ToAccount'});db[_0x1b64('0xf4')]['belongsTo'](db['SmsMessage'],{});db[_0x1b64('0xf4')][_0x1b64('0x11b')](db['SmsInteraction'],{});db[_0x1b64('0xf4')][_0x1b64('0x11b')](db['SmsAccount'],{'foreignKey':_0x1b64('0x1e1'),'as':_0x1b64('0x1d2')});db[_0x1b64('0xf4')][_0x1b64('0x11b')](db['User'],{'foreignKey':'FromUserId','as':_0x1b64('0x1d3')});db[_0x1b64('0xf4')]['belongsTo'](db[_0x1b64('0x13')],{'foreignKey':_0x1b64('0x1d9'),'as':'ToAgent'});db[_0x1b64('0xf4')][_0x1b64('0x11b')](db[_0x1b64('0x55')],{'foreignKey':_0x1b64('0x1e2'),'as':_0x1b64('0x1db')});db[_0x1b64('0xf4')][_0x1b64('0x11b')](db[_0x1b64('0x50')],{'foreignKey':_0x1b64('0x1e3'),'as':_0x1b64('0x1d6')});db[_0x1b64('0x121')][_0x1b64('0x10d')](db[_0x1b64('0x7c')],{'as':_0x1b64('0x15d'),'foreignKey':_0x1b64('0x162')});db[_0x1b64('0x121')][_0x1b64('0x10d')](db[_0x1b64('0x76')],{'as':'CustomFields','foreignKey':_0x1b64('0x162')});db[_0x1b64('0x121')][_0x1b64('0x10d')](db[_0x1b64('0x6b')],{'as':_0x1b64('0x194'),'onDelete':_0x1b64('0x111'),'foreignKey':'ListId'});db[_0x1b64('0x121')][_0x1b64('0x10d')](db[_0x1b64('0x71')],{'as':_0x1b64('0x112'),'foreignKey':'ListId'});db[_0x1b64('0x121')][_0x1b64('0x10d')](db[_0x1b64('0x72')],{'as':_0x1b64('0x113'),'foreignKey':_0x1b64('0x162')});db[_0x1b64('0x121')][_0x1b64('0x10d')](db[_0x1b64('0x74')],{'as':_0x1b64('0x74'),'foreignKey':_0x1b64('0x162')});db['CmList'][_0x1b64('0x11f')](db['VoiceQueue'],{'as':_0x1b64('0x1e4'),'through':_0x1b64('0x1e5')});db['CmList'][_0x1b64('0x11f')](db['User'],{'as':_0x1b64('0x164'),'through':_0x1b64('0x131')});db[_0x1b64('0xf7')][_0x1b64('0x10d')](db[_0x1b64('0x13f')],{'as':'Extensions','onDelete':_0x1b64('0x111')});db[_0x1b64('0xf7')][_0x1b64('0x11f')](db[_0x1b64('0x13')],{'as':'Agents','through':_0x1b64('0x133')});db[_0x1b64('0xf9')][_0x1b64('0x10d')](db[_0x1b64('0x13')],{'as':_0x1b64('0x16b'),'foreignKey':_0x1b64('0x11c')});db[_0x1b64('0xf9')][_0x1b64('0x10d')](db[_0x1b64('0xfb')],{'as':_0x1b64('0x1e6'),'foreignKey':_0x1b64('0x11c'),'onDelete':_0x1b64('0x111')});db[_0x1b64('0xfb')][_0x1b64('0x10d')](db[_0x1b64('0x1e7')],{'as':_0x1b64('0x1e8'),'foreignKey':'sectionId','onDelete':_0x1b64('0x111')});db[_0x1b64('0x100')][_0x1b64('0x10d')](db[_0x1b64('0x7c')],{'as':_0x1b64('0x15d'),'foreignKey':_0x1b64('0x1e9')});db[_0x1b64('0x100')]['hasMany'](db[_0x1b64('0x7a')],{'as':_0x1b64('0x15e'),'foreignKey':_0x1b64('0x1e9')});db[_0x1b64('0x100')][_0x1b64('0x10d')](db['WhatsappMessage'],{'as':_0x1b64('0x153'),'foreignKey':_0x1b64('0x1e9')});db[_0x1b64('0x100')][_0x1b64('0x10d')](db['WhatsappInteraction'],{'as':'Interactions'});db['WhatsappAccount']['hasMany'](db[_0x1b64('0x102')],{'as':_0x1b64('0x142')});db[_0x1b64('0x100')][_0x1b64('0x11b')](db['CmList'],{'as':_0x1b64('0x161'),'foreignKey':_0x1b64('0x162')});db[_0x1b64('0x100')]['belongsTo'](db[_0x1b64('0x82')],{'as':_0x1b64('0x14d'),'foreignKey':_0x1b64('0x14e')});db[_0x1b64('0x100')][_0x1b64('0x11f')](db['User'],{'as':_0x1b64('0x164'),'through':_0x1b64('0x13c')});db[_0x1b64('0x102')]['belongsTo'](db[_0x1b64('0x13')],{'onDelete':_0x1b64('0x171')});db[_0x1b64('0x102')][_0x1b64('0x11b')](db[_0x1b64('0x1ce')],{'onDelete':_0x1b64('0x171')});db[_0x1b64('0x102')][_0x1b64('0x11b')](db[_0x1b64('0x100')],{'onDelete':'restrict'});db[_0x1b64('0x102')][_0x1b64('0x11b')](db[_0x1b64('0x80')],{'onDelete':_0x1b64('0x171'),'foreignKey':_0x1b64('0x1a2')});db[_0x1b64('0x102')][_0x1b64('0x11b')](db[_0x1b64('0x167')],{'onDelete':_0x1b64('0x171'),'foreignKey':_0x1b64('0x172')});db['WhatsappInteraction']['hasMany'](db[_0x1b64('0x1ea')],{'as':_0x1b64('0x153'),'onDelete':'cascade','foreignKey':_0x1b64('0x1eb')});db['WhatsappInteraction'][_0x1b64('0x11b')](db[_0x1b64('0x100')],{'as':_0x1b64('0x16e'),'foreignKey':_0x1b64('0x1e9')});db['WhatsappInteraction'][_0x1b64('0x11b')](db[_0x1b64('0x6b')],{'as':_0x1b64('0x159'),'foreignKey':_0x1b64('0x15a')});db[_0x1b64('0x104')][_0x1b64('0x11b')](db[_0x1b64('0x13')],{'as':'Owner','foreignKey':'UserId'});db[_0x1b64('0x104')][_0x1b64('0x11f')](db[_0x1b64('0x167')],{'through':'whatsapp_interaction_has_tags','as':_0x1b64('0x168')});db[_0x1b64('0x104')][_0x1b64('0x11f')](db[_0x1b64('0x167')],{'through':'whatsapp_interaction_has_tags','as':_0x1b64('0x16a')});db[_0x1b64('0x104')][_0x1b64('0x11f')](db[_0x1b64('0x13')],{'as':'Users','through':_0x1b64('0x128'),'foreignKey':'WhatsappInteractionId'});db[_0x1b64('0x1ea')][_0x1b64('0x11b')](db[_0x1b64('0x13')],{'as':_0x1b64('0x13')});db[_0x1b64('0x1ea')]['belongsTo'](db[_0x1b64('0x6b')],{'onDelete':_0x1b64('0x111'),'as':_0x1b64('0x159')});db[_0x1b64('0x1ea')][_0x1b64('0x11b')](db[_0x1b64('0x104')],{'onDelete':_0x1b64('0x111'),'as':_0x1b64('0x16d'),'foreignKey':'WhatsappInteractionId'});db['WhatsappMessage'][_0x1b64('0x11b')](db[_0x1b64('0x100')],{'as':_0x1b64('0x16e'),'foreignKey':_0x1b64('0x1e9')});db[_0x1b64('0x107')][_0x1b64('0x11b')](db[_0x1b64('0x100')],{});db['WhatsappQueueReport'][_0x1b64('0x11b')](db['CmList'],{'as':_0x1b64('0x161'),'foreignKey':'ListId'});db[_0x1b64('0x107')][_0x1b64('0x11b')](db[_0x1b64('0x6b')],{'as':_0x1b64('0x159'),'foreignKey':'ContactId'});db[_0x1b64('0x107')][_0x1b64('0x11b')](db[_0x1b64('0x104')],{});db[_0x1b64('0x107')][_0x1b64('0x11b')](db[_0x1b64('0x1ce')],{});db['WhatsappQueueReport']['belongsTo'](db[_0x1b64('0x1ea')],{});db[_0x1b64('0x107')]['belongsTo'](db[_0x1b64('0x13')],{});db[_0x1b64('0x109')][_0x1b64('0x11b')](db[_0x1b64('0x1ea')],{});db[_0x1b64('0x109')][_0x1b64('0x11b')](db[_0x1b64('0x104')],{});db[_0x1b64('0x109')]['belongsTo'](db[_0x1b64('0x100')],{'foreignKey':_0x1b64('0x1ec'),'as':_0x1b64('0x1d2')});db[_0x1b64('0x109')][_0x1b64('0x11b')](db[_0x1b64('0x100')],{'foreignKey':'ToWhatsappAccountId','as':_0x1b64('0x1d6')});db['WhatsappTransferReport']['belongsTo'](db['WhatsappQueue'],{'foreignKey':'ToQueueId','as':'ToQueue'});db[_0x1b64('0x109')]['belongsTo'](db[_0x1b64('0x13')],{'foreignKey':_0x1b64('0x1d8'),'as':_0x1b64('0x1d3')});db['WhatsappTransferReport'][_0x1b64('0x11b')](db[_0x1b64('0x13')],{'foreignKey':'ToUserId','as':_0x1b64('0x1d4')});db[_0x1b64('0x1ce')][_0x1b64('0x11f')](db[_0x1b64('0x13')],{'as':'Agents','through':'UserWhatsappQueue','foreignKey':'WhatsappQueueId'});db[_0x1b64('0x1ce')][_0x1b64('0x11f')](db[_0x1b64('0xe4')],{'through':_0x1b64('0x1ed'),'as':'Teams'});module[_0x1b64('0x1ee')]={'db':db,'dbH':dbH}; \ No newline at end of file +var _0xd7a7=['Smtp','Disposition','Dispositions','CannedAnswer','Answers','MailMessage','MailInteraction','Interactions','List','ListId','TemplateId','mandatoryDispositionPauseId','team_has_mail_queues','MailInteractionId','Account','Owner','mail_interaction_has_tags','Tags','ThroughTags','Users','ChatWebsiteId','restrict','TagId','Applications','Exntensions','FaxQueue','FaxInteractionId','FaxAccountId','fax_interaction_has_tags','Interaction','AttachmentId','team_has_fax_queues','SmsAccountId','SmsApplication','sms_interaction_has_tags','SmsInteractionId','OpenchannelAccountId','user_has_openchannel_accounts','OpenchannelQueueId','openchannel_interaction_has_tags','OpenchannelInteractionId','team_has_openchannel_queues','ProactiveActions','OpenchannelQueueReport','Agent','Queue','Website','chat_interaction_has_tags','ChatInteractionId','Attachments','ChatOfflineMessageId','team_has_chat_queues','CmCompany','Contacts','CompanyId','Company','CampaignId','OwnerId','Condition','OneAll','Any','AutomationAnyId','Actions','AutomationId','Extensions','ChatApplications','FaxApplications','SmsApplications','AnalyticDefaultReport','DefaultReportId','AnalyticCustomReport','Mohs','cm_contact_has_tags','whatsapp_interaction_has_tags','AllCondition','AnyConditions','AnyCondition','TriggerAnyId','Trigger','TriggerId','Fields','CustomReportId','AnalyticMetric','MetricId','Configurations','Subjects','SubjectId','Descriptions','DescriptionId','FieldId','AccountId','Subject','Description','Field','Variable','VariableId','int_desk_configuration_has_tags','ZendeskField','int_zendesk_configuration_has_tags','int_freshdesk_configuration_has_tags','Dynamics365Field','ChatQueueReport','FromId','JscriptyProject','ProjectId','user_has_square_projects','VoiceQueues','ChatQueues','team_has_sms_queues','SmsQueues','team_has_whatsapp_queues','FromAccount','FromUserId','FromAgent','ToUserId','ToAgent','ToQueue','ToMailAccountId','ToAccount','ToChatQueueId','ToChatWebsiteId','FaxTransferReport','FromFaxAccountId','ToFaxAccountId','OpenchannelTransferReport','FromOpenchannelAccountId','ToOpenchannelAccountId','SmsTransferReport','FromSmsAccountId','ToSmsQueueId','ToSmsAccountId','CustomFields','HopperHistory','Queues','UserProfileSections','Resources','WhatsappAccountId','WhatsappMessage','WhatsappInteractionId','user_has_whatsapp_interactions','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','exports','path','../config/environment','sequelize','lodash','jstz','determine','motion2','xcall','xC@LL1234','127.0.0.1','mysql','utf8mb4','name','utf8','utf8_general_ci','sequelizeHistory','defaultsDeep','username','password','database','options','User','import','../api/user/user.model','VoiceChanSpy','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','../api/screenRecording/screenRecording.model','VoiceMail','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','VoiceQueueReport','MemberReport','../api/memberReport/memberReport.model','Trunk','../api/trunk/trunk.model','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','../api/userVoiceQueue/userVoiceQueue.model','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','MailServerOut','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','../api/mailSubstatus/mailSubstatus.model','../api/mailInteraction/mailInteraction.model','../api/mailMessage/mailMessage.model','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','Dashboard','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','FaxMessage','../api/faxQueue/faxQueue.model','FaxQueueReport','SmsAccount','../api/smsAccount/smsAccount.model','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','ChatInteraction','ChatMessage','../api/chatMessage/chatMessage.model','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','../api/cmCompany/cmCompany.model','CmContact','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','Action','Automation','../api/automation/automation.model','../api/cannedAnswer/cannedAnswer.model','../api/disposition/disposition.model','../api/condition/condition.model','Interval','../api/interval/interval.model','Pause','Cdr','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','../api/tag/tag.model','Template','../api/template/template.model','../api/trigger/trigger.model','Integration','../api/integration/integration.model','IntegrationReport','../api/analyticCustomReport/analyticCustomReport.model','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Account','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','Network','../api/network/network.model','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyQuestionReport','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','SquareReport','../api/squareReport/squareReport.model','../api/squareReportDetail/squareReportDetail.model','../api/jscriptyProject/jscriptyProject.model','../api/setting/setting.model','../api/squareOdbc/squareOdbc.model','SquareProject','SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','Team','../api/team/team.model','Campaign','../api/campaign/campaign.model','Attachment','../api/attachment/attachment.model','../api/plugin/plugin.model','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','../api/openchannelTransferReport/openchannelTransferReport.model','../api/cmList/cmList.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfile/userProfile.model','UserProfileSection','../api/userProfileSection/userProfileSection.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','WhatsappQueue','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','hasOne','hasMany','Recordings','VoiceQueuesRt','UserId','HopperFinals','ReportAgentPreview','OpenchannelInteractions','SmsInteractions','FaxInteractions','MailInteractions','WhatsappInteractions','UserNotifications','userProfileId','belongsToMany','Groups','chat_group_has_users','cm_user_has_contacts','CmList','user_has_teams','user_has_mail_interactions','ChatInteractions','user_has_chat_interactions','user_has_fax_interactions','user_has_sms_interactions','UserVoiceQueue','MailQueues','FaxQueues','SmsQueue','OpenchannelQueues','WhatsappQueues','VoicePrefixes','user_has_voice_prefixes','ChatWebsites','user_has_chat_websites','FaxAccounts','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','SmsAccounts','user_has_sms_accounts','WhatsappAccounts','user_has_whatsapp_accounts','SquareProjects','cascade','ChanSpyId','VoiceContext','Sounds','moh_has_sounds','Members','VoiceQueueId','Hoppers','HopperHistories','HopperBlacks','JscriptySessions','belongsTo','TrunkId','TrunkBackup','TrunkBackupId','IntervalId','mandatoryDispositionPause','Lists','voice_queues_has_cm_lists','Agents','Teams','BlackLists','ScreenRecording','Messages','mailboxuser','mailbox','QueueCalls','uniqueid','AgentReports','Contact','ContactId','MailAccountId','Imap'];(function(_0x39d39d,_0x5586bd){var _0x577ac3=function(_0x12f9f2){while(--_0x12f9f2){_0x39d39d['push'](_0x39d39d['shift']());}};_0x577ac3(++_0x5586bd);}(_0xd7a7,0x90));var _0x7d7a=function(_0x29eed1,_0x54ecc3){_0x29eed1=_0x29eed1-0x0;var _0x5cc6eb=_0xd7a7[_0x29eed1];return _0x5cc6eb;};'use strict';var path=require(_0x7d7a('0x0'));var config=require(_0x7d7a('0x1'));var Sequelize=require(_0x7d7a('0x2'));var _=require(_0x7d7a('0x3'));var jstz=require(_0x7d7a('0x4'));var timezone=jstz[_0x7d7a('0x5')]();config[_0x7d7a('0x2')]=_['defaultsDeep'](config[_0x7d7a('0x2')],{'database':_0x7d7a('0x6'),'username':_0x7d7a('0x7'),'password':_0x7d7a('0x8'),'options':{'host':_0x7d7a('0x9'),'port':0xcea,'dialect':_0x7d7a('0xa'),'dialectOptions':{'charset':_0x7d7a('0xb')},'logging':![],'timezone':timezone[_0x7d7a('0xc')](),'define':{'charset':_0x7d7a('0xd'),'collate':_0x7d7a('0xe')}}});config[_0x7d7a('0xf')]=_[_0x7d7a('0x10')](config[_0x7d7a('0xf')],{'database':_0x7d7a('0x6'),'username':'xcall','password':_0x7d7a('0x8'),'options':{'host':_0x7d7a('0x9'),'port':0xcea,'dialect':_0x7d7a('0xa'),'dialectOptions':{'charset':_0x7d7a('0xb')},'logging':![],'timezone':timezone['name'](),'define':{'charset':'utf8','collate':_0x7d7a('0xe')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x7d7a('0x2')]['database'],config[_0x7d7a('0x2')][_0x7d7a('0x11')],config[_0x7d7a('0x2')][_0x7d7a('0x12')],config[_0x7d7a('0x2')]['options'])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x7d7a('0xf')][_0x7d7a('0x13')],config[_0x7d7a('0xf')][_0x7d7a('0x11')],config['sequelizeHistory'][_0x7d7a('0x12')],config[_0x7d7a('0xf')][_0x7d7a('0x14')])};db[_0x7d7a('0x15')]=db[_0x7d7a('0x2')][_0x7d7a('0x16')](_0x7d7a('0x17'));db[_0x7d7a('0x18')]=db[_0x7d7a('0x2')]['import']('../api/voiceChanSpy/voiceChanSpy.model');db['VoiceContext']=db[_0x7d7a('0x2')][_0x7d7a('0x16')](_0x7d7a('0x19'));db[_0x7d7a('0x1a')]=db[_0x7d7a('0x2')][_0x7d7a('0x16')](_0x7d7a('0x1b'));db[_0x7d7a('0x1c')]=db[_0x7d7a('0x2')][_0x7d7a('0x16')](_0x7d7a('0x1d'));db[_0x7d7a('0x1e')]=db[_0x7d7a('0x2')][_0x7d7a('0x16')](_0x7d7a('0x1f'));db[_0x7d7a('0x20')]=db[_0x7d7a('0x2')]['import'](_0x7d7a('0x21'));db['ScreenRecording']=db[_0x7d7a('0x2')][_0x7d7a('0x16')](_0x7d7a('0x22'));db[_0x7d7a('0x23')]=db[_0x7d7a('0x2')]['import'](_0x7d7a('0x24'));db[_0x7d7a('0x25')]=db[_0x7d7a('0x2')][_0x7d7a('0x16')](_0x7d7a('0x26'));db[_0x7d7a('0x27')]=db[_0x7d7a('0x2')][_0x7d7a('0x16')](_0x7d7a('0x28'));db[_0x7d7a('0x29')]=db[_0x7d7a('0x2')][_0x7d7a('0x16')](_0x7d7a('0x2a'));db[_0x7d7a('0x2b')]=db[_0x7d7a('0x2')]['import']('../api/voiceAgentReport/voiceAgentReport.model');db[_0x7d7a('0x2c')]=db[_0x7d7a('0x2')][_0x7d7a('0x16')]('../api/voiceQueueReport/voiceQueueReport.model');db[_0x7d7a('0x2d')]=db[_0x7d7a('0x2')][_0x7d7a('0x16')](_0x7d7a('0x2e'));db[_0x7d7a('0x2f')]=db['sequelize'][_0x7d7a('0x16')](_0x7d7a('0x30'));db[_0x7d7a('0x31')]=db[_0x7d7a('0x2')][_0x7d7a('0x16')](_0x7d7a('0x32'));db[_0x7d7a('0x33')]=db[_0x7d7a('0x2')][_0x7d7a('0x16')](_0x7d7a('0x34'));db['UserVoiceQueue']=db['sequelize']['import'](_0x7d7a('0x35'));db['UserChatQueue']=db[_0x7d7a('0x2')][_0x7d7a('0x16')](_0x7d7a('0x36'));db[_0x7d7a('0x37')]=db['sequelize'][_0x7d7a('0x16')](_0x7d7a('0x38'));db[_0x7d7a('0x39')]=db[_0x7d7a('0x2')][_0x7d7a('0x16')](_0x7d7a('0x3a'));db[_0x7d7a('0x3b')]=db[_0x7d7a('0x2')]['import'](_0x7d7a('0x3c'));db[_0x7d7a('0x3d')]=db['sequelize']['import']('../api/userOpenchannelQueue/userOpenchannelQueue.model');db[_0x7d7a('0x3e')]=db[_0x7d7a('0x2')][_0x7d7a('0x16')](_0x7d7a('0x3f'));db[_0x7d7a('0x40')]=db[_0x7d7a('0x2')][_0x7d7a('0x16')](_0x7d7a('0x41'));db[_0x7d7a('0x42')]=db['sequelize'][_0x7d7a('0x16')](_0x7d7a('0x43'));db[_0x7d7a('0x44')]=db[_0x7d7a('0x2')][_0x7d7a('0x16')](_0x7d7a('0x45'));db[_0x7d7a('0x46')]=db['sequelize']['import'](_0x7d7a('0x47'));db['MailSubstatus']=db[_0x7d7a('0x2')]['import'](_0x7d7a('0x48'));db['MailInteraction']=db[_0x7d7a('0x2')]['import'](_0x7d7a('0x49'));db['MailMessage']=db[_0x7d7a('0x2')][_0x7d7a('0x16')](_0x7d7a('0x4a'));db[_0x7d7a('0x4b')]=db[_0x7d7a('0x2')][_0x7d7a('0x16')](_0x7d7a('0x4c'));db[_0x7d7a('0x4d')]=db['sequelize'][_0x7d7a('0x16')](_0x7d7a('0x4e'));db[_0x7d7a('0x4f')]=db[_0x7d7a('0x2')][_0x7d7a('0x16')](_0x7d7a('0x50'));db[_0x7d7a('0x51')]=db['sequelize'][_0x7d7a('0x16')](_0x7d7a('0x52'));db[_0x7d7a('0x53')]=db[_0x7d7a('0x2')]['import'](_0x7d7a('0x54'));db[_0x7d7a('0x55')]=db[_0x7d7a('0x2')][_0x7d7a('0x16')](_0x7d7a('0x56'));db[_0x7d7a('0x57')]=db['sequelize']['import']('../api/faxInteraction/faxInteraction.model');db[_0x7d7a('0x58')]=db['sequelize'][_0x7d7a('0x16')]('../api/faxMessage/faxMessage.model');db['FaxQueue']=db[_0x7d7a('0x2')]['import'](_0x7d7a('0x59'));db[_0x7d7a('0x5a')]=db['sequelize'][_0x7d7a('0x16')]('../api/faxQueueReport/faxQueueReport.model');db[_0x7d7a('0x5b')]=db[_0x7d7a('0x2')][_0x7d7a('0x16')](_0x7d7a('0x5c'));db['SmsApplication']=db['sequelize'][_0x7d7a('0x16')](_0x7d7a('0x5d'));db[_0x7d7a('0x5e')]=db['sequelize'][_0x7d7a('0x16')](_0x7d7a('0x5f'));db[_0x7d7a('0x60')]=db[_0x7d7a('0x2')][_0x7d7a('0x16')](_0x7d7a('0x61'));db['SmsQueue']=db[_0x7d7a('0x2')][_0x7d7a('0x16')](_0x7d7a('0x62'));db[_0x7d7a('0x63')]=db[_0x7d7a('0x2')]['import'](_0x7d7a('0x64'));db[_0x7d7a('0x65')]=db[_0x7d7a('0x2')][_0x7d7a('0x16')](_0x7d7a('0x66'));db[_0x7d7a('0x67')]=db[_0x7d7a('0x2')]['import'](_0x7d7a('0x68'));db[_0x7d7a('0x69')]=db[_0x7d7a('0x2')][_0x7d7a('0x16')](_0x7d7a('0x6a'));db[_0x7d7a('0x6b')]=db[_0x7d7a('0x2')][_0x7d7a('0x16')](_0x7d7a('0x6c'));db[_0x7d7a('0x6d')]=db[_0x7d7a('0x2')]['import']('../api/chatWebsite/chatWebsite.model');db['OpenchannelQueueReport']=db[_0x7d7a('0x2')][_0x7d7a('0x16')](_0x7d7a('0x6e'));db[_0x7d7a('0x6f')]=db['sequelize'][_0x7d7a('0x16')]('../api/chatApplication/chatApplication.model');db[_0x7d7a('0x70')]=db[_0x7d7a('0x2')][_0x7d7a('0x16')]('../api/chatInteraction/chatInteraction.model');db[_0x7d7a('0x71')]=db[_0x7d7a('0x2')][_0x7d7a('0x16')](_0x7d7a('0x72'));db[_0x7d7a('0x73')]=db[_0x7d7a('0x2')][_0x7d7a('0x16')](_0x7d7a('0x74'));db[_0x7d7a('0x75')]=db[_0x7d7a('0x2')]['import'](_0x7d7a('0x76'));db[_0x7d7a('0x77')]=db[_0x7d7a('0x2')][_0x7d7a('0x16')](_0x7d7a('0x78'));db[_0x7d7a('0x79')]=db[_0x7d7a('0x2')][_0x7d7a('0x16')](_0x7d7a('0x7a'));db['CmCompany']=db[_0x7d7a('0x2')][_0x7d7a('0x16')](_0x7d7a('0x7b'));db[_0x7d7a('0x7c')]=db[_0x7d7a('0x2')][_0x7d7a('0x16')](_0x7d7a('0x7d'));db[_0x7d7a('0x7e')]=db[_0x7d7a('0x2')]['import'](_0x7d7a('0x7f'));db[_0x7d7a('0x80')]=db[_0x7d7a('0x2')][_0x7d7a('0x16')](_0x7d7a('0x81'));db[_0x7d7a('0x82')]=db['sequelize'][_0x7d7a('0x16')](_0x7d7a('0x83'));db[_0x7d7a('0x84')]=db[_0x7d7a('0x2')]['import'](_0x7d7a('0x85'));db['ReportAgentPreview']=db['sequelize'][_0x7d7a('0x16')](_0x7d7a('0x86'));db[_0x7d7a('0x87')]=db[_0x7d7a('0x2')][_0x7d7a('0x16')]('../api/cmCustomField/cmCustomField.model');db[_0x7d7a('0x88')]=db[_0x7d7a('0x2')][_0x7d7a('0x16')]('../api/action/action.model');db[_0x7d7a('0x89')]=db['sequelize'][_0x7d7a('0x16')](_0x7d7a('0x8a'));db['CannedAnswer']=db['sequelize'][_0x7d7a('0x16')](_0x7d7a('0x8b'));db['Disposition']=db['sequelize'][_0x7d7a('0x16')](_0x7d7a('0x8c'));db['Condition']=db[_0x7d7a('0x2')][_0x7d7a('0x16')](_0x7d7a('0x8d'));db[_0x7d7a('0x8e')]=db[_0x7d7a('0x2')][_0x7d7a('0x16')](_0x7d7a('0x8f'));db[_0x7d7a('0x90')]=db['sequelize'][_0x7d7a('0x16')]('../api/pause/pause.model');db[_0x7d7a('0x91')]=db[_0x7d7a('0x2')][_0x7d7a('0x16')](_0x7d7a('0x92'));db[_0x7d7a('0x93')]=db[_0x7d7a('0x2')][_0x7d7a('0x16')](_0x7d7a('0x94'));db[_0x7d7a('0x95')]=db[_0x7d7a('0x2')][_0x7d7a('0x16')](_0x7d7a('0x96'));db[_0x7d7a('0x97')]=db[_0x7d7a('0x2')]['import'](_0x7d7a('0x98'));db[_0x7d7a('0x99')]=db[_0x7d7a('0x2')][_0x7d7a('0x16')](_0x7d7a('0x9a'));db[_0x7d7a('0x9b')]=db['sequelize'][_0x7d7a('0x16')](_0x7d7a('0x9c'));db['Trigger']=db[_0x7d7a('0x2')][_0x7d7a('0x16')](_0x7d7a('0x9d'));db['Variable']=db['sequelize'][_0x7d7a('0x16')]('../api/variable/variable.model');db[_0x7d7a('0x9e')]=db[_0x7d7a('0x2')][_0x7d7a('0x16')](_0x7d7a('0x9f'));db[_0x7d7a('0xa0')]=db[_0x7d7a('0x2')][_0x7d7a('0x16')]('../api/integrationReport/integrationReport.model');db['AnalyticCustomReport']=db[_0x7d7a('0x2')][_0x7d7a('0x16')](_0x7d7a('0xa1'));db['AnalyticDefaultReport']=db['sequelize']['import'](_0x7d7a('0xa2'));db[_0x7d7a('0xa3')]=db[_0x7d7a('0x2')][_0x7d7a('0x16')](_0x7d7a('0xa4'));db['AnalyticMetric']=db['sequelize'][_0x7d7a('0x16')](_0x7d7a('0xa5'));db[_0x7d7a('0xa6')]=db[_0x7d7a('0x2')]['import'](_0x7d7a('0xa7'));db[_0x7d7a('0xa8')]=db[_0x7d7a('0x2')]['import'](_0x7d7a('0xa9'));db[_0x7d7a('0xaa')]=db[_0x7d7a('0x2')][_0x7d7a('0x16')](_0x7d7a('0xab'));db[_0x7d7a('0xac')]=db[_0x7d7a('0x2')][_0x7d7a('0x16')](_0x7d7a('0xad'));db[_0x7d7a('0xae')]=db[_0x7d7a('0x2')][_0x7d7a('0x16')]('../api/intSalesforceField/intSalesforceField.model');db[_0x7d7a('0xaf')]=db[_0x7d7a('0x2')][_0x7d7a('0x16')](_0x7d7a('0xb0'));db[_0x7d7a('0xb1')]=db['sequelize'][_0x7d7a('0x16')](_0x7d7a('0xb2'));db[_0x7d7a('0xb3')]=db[_0x7d7a('0x2')]['import'](_0x7d7a('0xb4'));db[_0x7d7a('0xb5')]=db[_0x7d7a('0x2')][_0x7d7a('0x16')](_0x7d7a('0xb6'));db[_0x7d7a('0xb7')]=db[_0x7d7a('0x2')][_0x7d7a('0x16')](_0x7d7a('0xb8'));db[_0x7d7a('0xb9')]=db[_0x7d7a('0x2')][_0x7d7a('0x16')]('../api/intDeskField/intDeskField.model');db[_0x7d7a('0xba')]=db[_0x7d7a('0x2')][_0x7d7a('0x16')](_0x7d7a('0xbb'));db[_0x7d7a('0xbc')]=db[_0x7d7a('0x2')]['import'](_0x7d7a('0xbd'));db[_0x7d7a('0xbe')]=db[_0x7d7a('0x2')][_0x7d7a('0x16')](_0x7d7a('0xbf'));db[_0x7d7a('0xc0')]=db[_0x7d7a('0x2')][_0x7d7a('0x16')](_0x7d7a('0xc1'));db[_0x7d7a('0xc2')]=db['sequelize'][_0x7d7a('0x16')](_0x7d7a('0xc3'));db['ZendeskField']=db[_0x7d7a('0x2')][_0x7d7a('0x16')](_0x7d7a('0xc4'));db[_0x7d7a('0xc5')]=db[_0x7d7a('0x2')][_0x7d7a('0x16')]('../api/intFreshdeskAccount/intFreshdeskAccount.model');db[_0x7d7a('0xc6')]=db[_0x7d7a('0x2')][_0x7d7a('0x16')](_0x7d7a('0xc7'));db[_0x7d7a('0xc8')]=db['sequelize'][_0x7d7a('0x16')]('../api/intFreshdeskField/intFreshdeskField.model');db[_0x7d7a('0xc9')]=db[_0x7d7a('0x2')][_0x7d7a('0x16')](_0x7d7a('0xca'));db[_0x7d7a('0xcb')]=db[_0x7d7a('0x2')]['import'](_0x7d7a('0xcc'));db[_0x7d7a('0xcd')]=db[_0x7d7a('0x2')][_0x7d7a('0x16')]('../api/intVtigerField/intVtigerField.model');db[_0x7d7a('0xce')]=db['sequelize'][_0x7d7a('0x16')](_0x7d7a('0xcf'));db[_0x7d7a('0xd0')]=db[_0x7d7a('0x2')][_0x7d7a('0x16')]('../api/intServicenowConfiguration/intServicenowConfiguration.model');db[_0x7d7a('0xd1')]=db['sequelize'][_0x7d7a('0x16')](_0x7d7a('0xd2'));db[_0x7d7a('0xd3')]=db[_0x7d7a('0x2')][_0x7d7a('0x16')]('../api/intDynamics365Account/intDynamics365Account.model');db[_0x7d7a('0xd4')]=db['sequelize'][_0x7d7a('0x16')](_0x7d7a('0xd5'));db['Dynamics365Field']=db[_0x7d7a('0x2')]['import'](_0x7d7a('0xd6'));db[_0x7d7a('0xd7')]=db['sequelize'][_0x7d7a('0x16')](_0x7d7a('0xd8'));db[_0x7d7a('0xd9')]=db[_0x7d7a('0x2')][_0x7d7a('0x16')](_0x7d7a('0xda'));db[_0x7d7a('0xdb')]=db[_0x7d7a('0x2')][_0x7d7a('0x16')]('../api/intFreshsalesField/intFreshsalesField.model');db[_0x7d7a('0x9e')]=db[_0x7d7a('0x2')][_0x7d7a('0x16')](_0x7d7a('0x9f'));db[_0x7d7a('0xdc')]=db[_0x7d7a('0x2')][_0x7d7a('0x16')](_0x7d7a('0xdd'));db['ChatQueueReport']=db[_0x7d7a('0x2')][_0x7d7a('0x16')](_0x7d7a('0xde'));db[_0x7d7a('0xdf')]=db[_0x7d7a('0x2')]['import'](_0x7d7a('0xe0'));db['JscriptyAnswerReport']=db['sequelize']['import']('../api/jscriptyAnswerReport/jscriptyAnswerReport.model');db[_0x7d7a('0xe1')]=db[_0x7d7a('0x2')][_0x7d7a('0x16')]('../api/jscriptyQuestionReport/jscriptyQuestionReport.model');db[_0x7d7a('0xe2')]=db[_0x7d7a('0x2')][_0x7d7a('0x16')](_0x7d7a('0xe3'));db[_0x7d7a('0xe4')]=db['sequelize'][_0x7d7a('0x16')]('../api/smsQueueReport/smsQueueReport.model');db[_0x7d7a('0xe5')]=db[_0x7d7a('0x2')][_0x7d7a('0x16')](_0x7d7a('0xe6'));db['SquareDetailsReport']=db['sequelize']['import'](_0x7d7a('0xe7'));db['JscriptyProject']=db[_0x7d7a('0x2')][_0x7d7a('0x16')](_0x7d7a('0xe8'));db['Setting']=db[_0x7d7a('0x2')][_0x7d7a('0x16')](_0x7d7a('0xe9'));db['SquareOdbc']=db[_0x7d7a('0x2')][_0x7d7a('0x16')](_0x7d7a('0xea'));db[_0x7d7a('0xeb')]=db[_0x7d7a('0x2')][_0x7d7a('0x16')]('../api/squareProject/squareProject.model');db[_0x7d7a('0xec')]=db['sequelize']['import'](_0x7d7a('0xed'));db[_0x7d7a('0xee')]=db[_0x7d7a('0x2')][_0x7d7a('0x16')](_0x7d7a('0xef'));db[_0x7d7a('0xf0')]=db[_0x7d7a('0x2')][_0x7d7a('0x16')](_0x7d7a('0xf1'));db['License']=db[_0x7d7a('0x2')][_0x7d7a('0x16')]('../api/license/license.model');db[_0x7d7a('0xf2')]=db[_0x7d7a('0x2')][_0x7d7a('0x16')](_0x7d7a('0xf3'));db['Migration']=db[_0x7d7a('0x2')][_0x7d7a('0x16')]('../api/migration/migration.model');db[_0x7d7a('0xf4')]=db[_0x7d7a('0x2')]['import'](_0x7d7a('0xf5'));db['Plugin']=db['sequelize'][_0x7d7a('0x16')](_0x7d7a('0xf6'));db[_0x7d7a('0xf7')]=db['sequelize']['import'](_0x7d7a('0xf8'));db[_0x7d7a('0xf9')]=db[_0x7d7a('0x2')]['import'](_0x7d7a('0xfa'));db['FaxTransferReport']=db[_0x7d7a('0x2')][_0x7d7a('0x16')]('../api/faxTransferReport/faxTransferReport.model');db['OpenchannelTransferReport']=db[_0x7d7a('0x2')]['import'](_0x7d7a('0xfb'));db['SmsTransferReport']=db[_0x7d7a('0x2')][_0x7d7a('0x16')]('../api/smsTransferReport/smsTransferReport.model');db['CmList']=db[_0x7d7a('0x2')][_0x7d7a('0x16')](_0x7d7a('0xfc'));db[_0x7d7a('0xfd')]=db[_0x7d7a('0x2')][_0x7d7a('0x16')](_0x7d7a('0xfe'));db[_0x7d7a('0xff')]=db[_0x7d7a('0x2')]['import'](_0x7d7a('0x100'));db[_0x7d7a('0x101')]=db[_0x7d7a('0x2')][_0x7d7a('0x16')](_0x7d7a('0x102'));db[_0x7d7a('0x103')]=db['sequelize'][_0x7d7a('0x16')](_0x7d7a('0x104'));db[_0x7d7a('0x105')]=db[_0x7d7a('0x2')]['import'](_0x7d7a('0x106'));db[_0x7d7a('0x107')]=db[_0x7d7a('0x2')][_0x7d7a('0x16')]('../api/whatsappAccount/whatsappAccount.model');db[_0x7d7a('0x108')]=db[_0x7d7a('0x2')][_0x7d7a('0x16')](_0x7d7a('0x109'));db[_0x7d7a('0x10a')]=db[_0x7d7a('0x2')][_0x7d7a('0x16')]('../api/whatsappInteraction/whatsappInteraction.model');db['WhatsappMessage']=db[_0x7d7a('0x2')][_0x7d7a('0x16')]('../api/whatsappMessage/whatsappMessage.model');db[_0x7d7a('0x10b')]=db[_0x7d7a('0x2')]['import'](_0x7d7a('0x10c'));db[_0x7d7a('0x10d')]=db['sequelize']['import']('../api/whatsappTransferReport/whatsappTransferReport.model');db[_0x7d7a('0x10e')]=db[_0x7d7a('0x2')][_0x7d7a('0x16')]('../api/whatsappQueue/whatsappQueue.model');db[_0x7d7a('0x10f')]=db[_0x7d7a('0x2')][_0x7d7a('0x16')](_0x7d7a('0x110'));db[_0x7d7a('0x111')]=db[_0x7d7a('0x2')][_0x7d7a('0x16')](_0x7d7a('0x112'));db[_0x7d7a('0x15')][_0x7d7a('0x113')](db[_0x7d7a('0x23')],{'as':_0x7d7a('0x23'),'onDelete':'cascade','foreignKey':'UserId'});db[_0x7d7a('0x15')][_0x7d7a('0x114')](db[_0x7d7a('0x20')],{'as':_0x7d7a('0x115'),'foreignKey':'UserId'});db[_0x7d7a('0x15')]['hasMany'](db[_0x7d7a('0x33')],{'as':_0x7d7a('0x116'),'foreignKey':_0x7d7a('0x117')});db[_0x7d7a('0x15')][_0x7d7a('0x114')](db[_0x7d7a('0x1a')],{'as':'Extensions','onDelete':'cascade','hooks':!![]});db['User'][_0x7d7a('0x114')](db[_0x7d7a('0x82')],{'as':_0x7d7a('0x118'),'foreignKey':_0x7d7a('0x117')});db[_0x7d7a('0x15')][_0x7d7a('0x114')](db[_0x7d7a('0x84')],{'as':'HopperHistory','foreignKey':_0x7d7a('0x117')});db[_0x7d7a('0x15')]['hasMany'](db[_0x7d7a('0x119')],{'as':_0x7d7a('0x119'),'foreignKey':'UserId'});db[_0x7d7a('0x15')]['hasMany'](db['OpenchannelInteraction'],{'as':_0x7d7a('0x11a'),'foreignKey':'UserId'});db[_0x7d7a('0x15')][_0x7d7a('0x114')](db[_0x7d7a('0x70')],{'as':'ChatInteractions','foreignKey':_0x7d7a('0x117')});db[_0x7d7a('0x15')][_0x7d7a('0x114')](db[_0x7d7a('0x5e')],{'as':_0x7d7a('0x11b'),'foreignKey':_0x7d7a('0x117')});db['User'][_0x7d7a('0x114')](db[_0x7d7a('0x57')],{'as':_0x7d7a('0x11c'),'foreignKey':'UserId'});db[_0x7d7a('0x15')][_0x7d7a('0x114')](db['MailInteraction'],{'as':_0x7d7a('0x11d'),'foreignKey':'UserId'});db[_0x7d7a('0x15')]['hasMany'](db['WhatsappInteraction'],{'as':_0x7d7a('0x11e'),'foreignKey':_0x7d7a('0x117')});db[_0x7d7a('0x15')][_0x7d7a('0x114')](db[_0x7d7a('0x105')],{'as':_0x7d7a('0x11f'),'foreignKey':'SenderId'});db[_0x7d7a('0x15')]['belongsTo'](db[_0x7d7a('0xff')],{'as':_0x7d7a('0xff'),'foreignKey':_0x7d7a('0x120')});db['User'][_0x7d7a('0x121')](db[_0x7d7a('0x77')],{'as':_0x7d7a('0x122'),'through':_0x7d7a('0x123')});db[_0x7d7a('0x15')][_0x7d7a('0x121')](db[_0x7d7a('0x7c')],{'as':'Contacts','through':_0x7d7a('0x124')});db[_0x7d7a('0x15')][_0x7d7a('0x121')](db[_0x7d7a('0x125')],{'as':'Lists','through':'cm_user_has_lists'});db[_0x7d7a('0x15')][_0x7d7a('0x121')](db[_0x7d7a('0xf0')],{'through':_0x7d7a('0x126')});db['User'][_0x7d7a('0x121')](db['MailInteraction'],{'as':_0x7d7a('0x11d'),'through':_0x7d7a('0x127')});db[_0x7d7a('0x15')][_0x7d7a('0x121')](db['ChatInteraction'],{'as':_0x7d7a('0x128'),'through':_0x7d7a('0x129')});db[_0x7d7a('0x15')][_0x7d7a('0x121')](db[_0x7d7a('0x57')],{'as':_0x7d7a('0x11c'),'through':_0x7d7a('0x12a')});db[_0x7d7a('0x15')][_0x7d7a('0x121')](db[_0x7d7a('0x5e')],{'as':_0x7d7a('0x11b'),'through':_0x7d7a('0x12b')});db[_0x7d7a('0x15')][_0x7d7a('0x121')](db[_0x7d7a('0x67')],{'as':_0x7d7a('0x11a'),'through':'user_has_openchannel_interactions'});db[_0x7d7a('0x15')][_0x7d7a('0x121')](db['WhatsappInteraction'],{'as':_0x7d7a('0x11e'),'through':'user_has_whatsapp_interactions'});db[_0x7d7a('0x15')]['belongsToMany'](db[_0x7d7a('0x1e')],{'as':'VoiceQueues','through':_0x7d7a('0x12c'),'required':![]});db['User'][_0x7d7a('0x121')](db[_0x7d7a('0x46')],{'as':_0x7d7a('0x12d'),'through':_0x7d7a('0x37'),'required':![]});db[_0x7d7a('0x15')][_0x7d7a('0x121')](db[_0x7d7a('0x75')],{'as':'ChatQueues','through':'UserChatQueue','required':![],'hooks':!![]});db[_0x7d7a('0x15')][_0x7d7a('0x121')](db['FaxQueue'],{'as':_0x7d7a('0x12e'),'through':_0x7d7a('0x39'),'required':![]});db['User'][_0x7d7a('0x121')](db[_0x7d7a('0x12f')],{'as':'SmsQueues','through':_0x7d7a('0x3b'),'required':![]});db[_0x7d7a('0x15')]['belongsToMany'](db[_0x7d7a('0x6b')],{'as':_0x7d7a('0x130'),'through':'UserOpenchannelQueue','required':![]});db[_0x7d7a('0x15')][_0x7d7a('0x121')](db[_0x7d7a('0x10e')],{'as':_0x7d7a('0x131'),'through':'UserWhatsappQueue','required':![]});db[_0x7d7a('0x15')][_0x7d7a('0x121')](db[_0x7d7a('0x125')],{'through':'cm_user_has_lists'});db[_0x7d7a('0x15')][_0x7d7a('0x121')](db[_0x7d7a('0xfd')],{'as':_0x7d7a('0x132'),'through':_0x7d7a('0x133'),'required':![]});db[_0x7d7a('0x15')][_0x7d7a('0x121')](db['ChatWebsite'],{'as':_0x7d7a('0x134'),'through':_0x7d7a('0x135')});db[_0x7d7a('0x15')]['belongsToMany'](db['FaxAccount'],{'as':_0x7d7a('0x136'),'through':_0x7d7a('0x137')});db[_0x7d7a('0x15')]['belongsToMany'](db['MailAccount'],{'as':_0x7d7a('0x138'),'through':_0x7d7a('0x139')});db[_0x7d7a('0x15')][_0x7d7a('0x121')](db['OpenchannelAccount'],{'as':_0x7d7a('0x13a'),'through':'user_has_openchannel_accounts'});db[_0x7d7a('0x15')]['belongsToMany'](db['SmsAccount'],{'as':_0x7d7a('0x13b'),'through':_0x7d7a('0x13c')});db[_0x7d7a('0x15')]['belongsToMany'](db[_0x7d7a('0x107')],{'as':_0x7d7a('0x13d'),'through':_0x7d7a('0x13e')});db['User']['belongsToMany'](db[_0x7d7a('0xeb')],{'as':_0x7d7a('0x13f'),'through':'user_has_square_projects'});db[_0x7d7a('0x18')]['hasMany'](db['VoiceExtension'],{'as':'SpiedAgents','onDelete':_0x7d7a('0x140'),'foreignKey':_0x7d7a('0x141')});db[_0x7d7a('0x142')][_0x7d7a('0x114')](db[_0x7d7a('0x1a')],{'onDelete':_0x7d7a('0x140')});db['VoiceExtension'][_0x7d7a('0x114')](db[_0x7d7a('0x1a')],{'as':'Applications','onDelete':_0x7d7a('0x140')});db[_0x7d7a('0x1c')][_0x7d7a('0x121')](db[_0x7d7a('0x97')],{'as':_0x7d7a('0x143'),'through':_0x7d7a('0x144')});db[_0x7d7a('0x1e')][_0x7d7a('0x114')](db['UserVoiceQueueRt'],{'as':_0x7d7a('0x145'),'foreignKey':_0x7d7a('0x146')});db['VoiceQueue'][_0x7d7a('0x114')](db[_0x7d7a('0x7e')],{'as':_0x7d7a('0x147'),'foreignKey':'VoiceQueueId'});db[_0x7d7a('0x1e')][_0x7d7a('0x114')](db['CmHopperFinal'],{'as':'HopperFinals','foreignKey':_0x7d7a('0x146')});db[_0x7d7a('0x1e')][_0x7d7a('0x114')](db[_0x7d7a('0x84')],{'as':_0x7d7a('0x148'),'foreignKey':'VoiceQueueId'});db[_0x7d7a('0x1e')][_0x7d7a('0x114')](db['ReportAgentPreview'],{'as':_0x7d7a('0x119'),'foreignKey':_0x7d7a('0x146')});db[_0x7d7a('0x1e')][_0x7d7a('0x114')](db[_0x7d7a('0x80')],{'as':_0x7d7a('0x149'),'foreignKey':_0x7d7a('0x146')});db[_0x7d7a('0x1e')][_0x7d7a('0x114')](db[_0x7d7a('0xe2')],{'as':_0x7d7a('0x14a'),'foreignKey':_0x7d7a('0x146')});db[_0x7d7a('0x1e')][_0x7d7a('0x14b')](db[_0x7d7a('0x2f')],{'as':_0x7d7a('0x2f'),'foreignKey':_0x7d7a('0x14c')});db[_0x7d7a('0x1e')]['belongsTo'](db[_0x7d7a('0x2f')],{'as':_0x7d7a('0x14d'),'foreignKey':_0x7d7a('0x14e')});db[_0x7d7a('0x1e')][_0x7d7a('0x14b')](db[_0x7d7a('0x8e')],{'as':'Interval','foreignKey':_0x7d7a('0x14f')});db[_0x7d7a('0x1e')][_0x7d7a('0x14b')](db[_0x7d7a('0x90')],{'as':_0x7d7a('0x150'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x7d7a('0x1e')][_0x7d7a('0x121')](db[_0x7d7a('0x125')],{'as':_0x7d7a('0x151'),'through':_0x7d7a('0x152')});db[_0x7d7a('0x1e')][_0x7d7a('0x121')](db[_0x7d7a('0x15')],{'as':_0x7d7a('0x153'),'through':_0x7d7a('0x12c')});db[_0x7d7a('0x1e')][_0x7d7a('0x121')](db[_0x7d7a('0xf0')],{'as':_0x7d7a('0x154'),'through':_0x7d7a('0x111')});db[_0x7d7a('0x1e')][_0x7d7a('0x121')](db[_0x7d7a('0x125')],{'as':_0x7d7a('0x155'),'through':'voice_queues_has_cm_blacklists'});db[_0x7d7a('0x20')][_0x7d7a('0x14b')](db[_0x7d7a('0x15')],{'as':_0x7d7a('0x15'),'foreignKey':_0x7d7a('0x117')});db[_0x7d7a('0x156')][_0x7d7a('0x14b')](db['User'],{'as':_0x7d7a('0x15'),'foreignKey':_0x7d7a('0x117')});db['VoiceMail'][_0x7d7a('0x114')](db[_0x7d7a('0x25')],{'as':_0x7d7a('0x157'),'onDelete':_0x7d7a('0x140'),'foreignKey':_0x7d7a('0x158'),'sourceKey':_0x7d7a('0x159')});db[_0x7d7a('0x25')][_0x7d7a('0x14b')](db[_0x7d7a('0x23')],{'foreignKey':_0x7d7a('0x158'),'targetKey':_0x7d7a('0x159')});db[_0x7d7a('0x27')][_0x7d7a('0x114')](db[_0x7d7a('0x2c')],{'as':_0x7d7a('0x15a'),'foreignKey':_0x7d7a('0x15b'),'constraints':![]});db['VoiceCallReport']['hasMany'](db['VoiceAgentReport'],{'as':_0x7d7a('0x15c'),'foreignKey':_0x7d7a('0x15b'),'constraints':![]});db[_0x7d7a('0x27')][_0x7d7a('0x14b')](db[_0x7d7a('0x15')],{'as':_0x7d7a('0x15'),'foreignKey':_0x7d7a('0x117')});db[_0x7d7a('0x27')][_0x7d7a('0x14b')](db[_0x7d7a('0x7c')],{'as':_0x7d7a('0x15d'),'foreignKey':_0x7d7a('0x15e')});db['MailServerIn']['belongsTo'](db[_0x7d7a('0x44')],{'as':'MailAccount','foreignKey':_0x7d7a('0x15f')});db[_0x7d7a('0x42')]['belongsTo'](db[_0x7d7a('0x44')],{'as':'MailAccount','foreignKey':_0x7d7a('0x15f')});db[_0x7d7a('0x44')][_0x7d7a('0x113')](db['MailServerIn'],{'as':_0x7d7a('0x160'),'onDelete':_0x7d7a('0x140')});db[_0x7d7a('0x44')][_0x7d7a('0x113')](db['MailServerOut'],{'as':_0x7d7a('0x161'),'onDelete':'cascade'});db[_0x7d7a('0x44')][_0x7d7a('0x114')](db[_0x7d7a('0x162')],{'as':_0x7d7a('0x163'),'foreignKey':_0x7d7a('0x15f')});db[_0x7d7a('0x44')][_0x7d7a('0x114')](db[_0x7d7a('0x164')],{'as':_0x7d7a('0x165'),'foreignKey':_0x7d7a('0x15f')});db[_0x7d7a('0x44')][_0x7d7a('0x114')](db[_0x7d7a('0x166')],{'as':_0x7d7a('0x157'),'foreignKey':_0x7d7a('0x15f')});db[_0x7d7a('0x44')][_0x7d7a('0x114')](db[_0x7d7a('0x167')],{'as':_0x7d7a('0x168')});db['MailAccount']['hasMany'](db[_0x7d7a('0x4b')],{'as':'Applications'});db[_0x7d7a('0x44')]['belongsTo'](db['CmList'],{'as':_0x7d7a('0x169'),'foreignKey':_0x7d7a('0x16a')});db[_0x7d7a('0x44')][_0x7d7a('0x14b')](db[_0x7d7a('0x9b')],{'as':_0x7d7a('0x9b'),'foreignKey':_0x7d7a('0x16b')});db[_0x7d7a('0x44')][_0x7d7a('0x14b')](db[_0x7d7a('0x90')],{'as':_0x7d7a('0x150'),'foreignKey':_0x7d7a('0x16c')});db[_0x7d7a('0x44')]['belongsToMany'](db[_0x7d7a('0x15')],{'as':_0x7d7a('0x153'),'through':'user_has_mail_accounts'});db[_0x7d7a('0x46')][_0x7d7a('0x121')](db[_0x7d7a('0x15')],{'as':'Agents','through':_0x7d7a('0x37')});db[_0x7d7a('0x46')][_0x7d7a('0x121')](db[_0x7d7a('0xf0')],{'through':_0x7d7a('0x16d'),'as':_0x7d7a('0x154')});db[_0x7d7a('0x167')]['hasMany'](db[_0x7d7a('0x166')],{'as':_0x7d7a('0x157'),'onDelete':_0x7d7a('0x140'),'foreignKey':_0x7d7a('0x16e')});db[_0x7d7a('0x167')][_0x7d7a('0x14b')](db[_0x7d7a('0x44')],{'as':_0x7d7a('0x16f'),'foreignKey':'MailAccountId'});db[_0x7d7a('0x167')]['belongsTo'](db[_0x7d7a('0x7c')],{'as':_0x7d7a('0x15d'),'foreignKey':'ContactId'});db[_0x7d7a('0x167')][_0x7d7a('0x14b')](db[_0x7d7a('0x15')],{'as':_0x7d7a('0x170'),'foreignKey':'UserId'});db['MailInteraction'][_0x7d7a('0x121')](db[_0x7d7a('0x99')],{'through':_0x7d7a('0x171'),'as':_0x7d7a('0x172')});db['MailInteraction'][_0x7d7a('0x121')](db[_0x7d7a('0x99')],{'through':'mail_interaction_has_tags','as':_0x7d7a('0x173')});db[_0x7d7a('0x167')][_0x7d7a('0x121')](db[_0x7d7a('0x15')],{'as':_0x7d7a('0x174'),'through':_0x7d7a('0x127'),'foreignKey':_0x7d7a('0x16e')});db[_0x7d7a('0x166')][_0x7d7a('0x114')](db[_0x7d7a('0xf4')],{'as':'Attachments','onDelete':_0x7d7a('0x140')});db['MailMessage'][_0x7d7a('0x14b')](db[_0x7d7a('0x15')],{'as':_0x7d7a('0x15')});db[_0x7d7a('0x166')]['belongsTo'](db['CmContact'],{'onDelete':_0x7d7a('0x140'),'as':_0x7d7a('0x15d')});db[_0x7d7a('0x166')]['belongsTo'](db[_0x7d7a('0x167')],{'as':'Interaction','foreignKey':'MailInteractionId'});db[_0x7d7a('0x166')]['belongsTo'](db[_0x7d7a('0x44')],{'as':_0x7d7a('0x16f'),'foreignKey':_0x7d7a('0x15f')});db[_0x7d7a('0x166')][_0x7d7a('0x14b')](db[_0x7d7a('0x6d')],{'as':'ChatWebsite','foreignKey':_0x7d7a('0x175')});db[_0x7d7a('0x166')][_0x7d7a('0x14b')](db['ChatOfflineMessage'],{'as':_0x7d7a('0x73'),'foreignKey':'ChatOfflineMessageId'});db['MailApplication'][_0x7d7a('0x14b')](db[_0x7d7a('0x15')],{'onDelete':_0x7d7a('0x176')});db[_0x7d7a('0x4b')][_0x7d7a('0x14b')](db[_0x7d7a('0x46')],{'onDelete':_0x7d7a('0x176')});db[_0x7d7a('0x4b')]['belongsTo'](db['MailAccount'],{'onDelete':_0x7d7a('0x176')});db['MailApplication'][_0x7d7a('0x14b')](db[_0x7d7a('0x8e')],{'onDelete':_0x7d7a('0x176'),'foreignKey':_0x7d7a('0x14f')});db[_0x7d7a('0x4b')][_0x7d7a('0x14b')](db[_0x7d7a('0x99')],{'onDelete':_0x7d7a('0x176'),'foreignKey':_0x7d7a('0x177')});db[_0x7d7a('0x4d')][_0x7d7a('0x14b')](db['MailAccount'],{});db['MailQueueReport'][_0x7d7a('0x14b')](db[_0x7d7a('0x125')],{'as':'List','foreignKey':_0x7d7a('0x16a')});db['MailQueueReport']['belongsTo'](db[_0x7d7a('0x7c')],{'as':_0x7d7a('0x15d'),'foreignKey':_0x7d7a('0x15e')});db[_0x7d7a('0x4d')][_0x7d7a('0x14b')](db[_0x7d7a('0x167')],{});db[_0x7d7a('0x4d')][_0x7d7a('0x14b')](db[_0x7d7a('0x166')],{});db[_0x7d7a('0x4d')][_0x7d7a('0x14b')](db[_0x7d7a('0x15')],{});db[_0x7d7a('0x4d')][_0x7d7a('0x14b')](db[_0x7d7a('0x46')],{});db[_0x7d7a('0x4f')][_0x7d7a('0x114')](db[_0x7d7a('0x51')],{'as':'Items','onDelete':_0x7d7a('0x140')});db[_0x7d7a('0x53')][_0x7d7a('0x114')](db[_0x7d7a('0x162')],{'as':_0x7d7a('0x163'),'foreignKey':'FaxAccountId'});db[_0x7d7a('0x53')][_0x7d7a('0x114')](db[_0x7d7a('0x164')],{'as':'Answers','foreignKey':'FaxAccountId'});db['FaxAccount'][_0x7d7a('0x114')](db[_0x7d7a('0x57')],{'as':_0x7d7a('0x168')});db['FaxAccount'][_0x7d7a('0x114')](db[_0x7d7a('0x55')],{'as':_0x7d7a('0x178')});db[_0x7d7a('0x53')][_0x7d7a('0x114')](db[_0x7d7a('0x1a')],{'as':_0x7d7a('0x179'),'onDelete':_0x7d7a('0x140')});db[_0x7d7a('0x53')][_0x7d7a('0x114')](db[_0x7d7a('0x58')],{'as':_0x7d7a('0x157')});db[_0x7d7a('0x53')][_0x7d7a('0x14b')](db[_0x7d7a('0x2f')],{'as':_0x7d7a('0x2f')});db[_0x7d7a('0x53')]['belongsTo'](db[_0x7d7a('0x125')],{'as':_0x7d7a('0x169'),'foreignKey':_0x7d7a('0x16a')});db[_0x7d7a('0x53')][_0x7d7a('0x14b')](db[_0x7d7a('0x90')],{'as':_0x7d7a('0x150'),'foreignKey':_0x7d7a('0x16c')});db[_0x7d7a('0x53')][_0x7d7a('0x121')](db[_0x7d7a('0x15')],{'as':_0x7d7a('0x153'),'through':_0x7d7a('0x137')});db[_0x7d7a('0x55')][_0x7d7a('0x14b')](db['User'],{'onDelete':_0x7d7a('0x176')});db[_0x7d7a('0x55')][_0x7d7a('0x14b')](db[_0x7d7a('0x17a')],{'onDelete':_0x7d7a('0x176')});db[_0x7d7a('0x55')][_0x7d7a('0x14b')](db['FaxAccount'],{'onDelete':_0x7d7a('0x176')});db['FaxApplication'][_0x7d7a('0x14b')](db[_0x7d7a('0x99')],{'onDelete':_0x7d7a('0x176'),'foreignKey':_0x7d7a('0x177')});db['FaxInteraction'][_0x7d7a('0x114')](db[_0x7d7a('0x58')],{'as':_0x7d7a('0x157'),'onDelete':'cascade','foreignKey':_0x7d7a('0x17b')});db[_0x7d7a('0x57')]['belongsTo'](db['FaxAccount'],{'as':'Account','foreignKey':_0x7d7a('0x17c')});db[_0x7d7a('0x57')][_0x7d7a('0x14b')](db[_0x7d7a('0x7c')],{'as':_0x7d7a('0x15d'),'foreignKey':_0x7d7a('0x15e')});db[_0x7d7a('0x57')][_0x7d7a('0x14b')](db[_0x7d7a('0x15')],{'as':_0x7d7a('0x170'),'foreignKey':_0x7d7a('0x117')});db['FaxInteraction']['belongsToMany'](db[_0x7d7a('0x99')],{'through':_0x7d7a('0x17d'),'as':_0x7d7a('0x172')});db['FaxInteraction'][_0x7d7a('0x121')](db['Tag'],{'through':_0x7d7a('0x17d'),'as':_0x7d7a('0x173')});db[_0x7d7a('0x57')]['belongsToMany'](db[_0x7d7a('0x15')],{'as':_0x7d7a('0x174'),'through':'user_has_fax_interactions','foreignKey':_0x7d7a('0x17b')});db[_0x7d7a('0x58')]['belongsTo'](db[_0x7d7a('0x15')],{'onDelete':'cascade','as':_0x7d7a('0x15')});db[_0x7d7a('0x58')][_0x7d7a('0x14b')](db[_0x7d7a('0x57')],{'as':_0x7d7a('0x17e'),'foreignKey':_0x7d7a('0x17b')});db[_0x7d7a('0x58')][_0x7d7a('0x14b')](db[_0x7d7a('0x7c')],{'onDelete':_0x7d7a('0x140'),'as':_0x7d7a('0x15d')});db[_0x7d7a('0x58')][_0x7d7a('0x14b')](db[_0x7d7a('0xf4')],{'as':'Attachment','foreignKey':_0x7d7a('0x17f')});db[_0x7d7a('0x58')]['belongsTo'](db[_0x7d7a('0x53')],{'as':_0x7d7a('0x16f'),'foreignKey':_0x7d7a('0x17c')});db[_0x7d7a('0x17a')][_0x7d7a('0x121')](db['User'],{'as':_0x7d7a('0x153'),'through':_0x7d7a('0x39')});db[_0x7d7a('0x17a')][_0x7d7a('0x121')](db[_0x7d7a('0xf0')],{'through':_0x7d7a('0x180'),'as':_0x7d7a('0x154')});db[_0x7d7a('0x5a')][_0x7d7a('0x14b')](db[_0x7d7a('0x53')],{});db['FaxQueueReport'][_0x7d7a('0x14b')](db['CmList'],{'as':'List','foreignKey':'ListId'});db[_0x7d7a('0x5a')][_0x7d7a('0x14b')](db[_0x7d7a('0x7c')],{'as':_0x7d7a('0x15d'),'foreignKey':_0x7d7a('0x15e')});db[_0x7d7a('0x5a')][_0x7d7a('0x14b')](db[_0x7d7a('0x57')],{});db[_0x7d7a('0x5a')]['belongsTo'](db[_0x7d7a('0x58')],{});db[_0x7d7a('0x5a')][_0x7d7a('0x14b')](db[_0x7d7a('0x15')],{});db[_0x7d7a('0x5a')][_0x7d7a('0x14b')](db[_0x7d7a('0x17a')],{});db[_0x7d7a('0x5b')][_0x7d7a('0x114')](db[_0x7d7a('0x162')],{'as':_0x7d7a('0x163'),'foreignKey':_0x7d7a('0x181')});db[_0x7d7a('0x5b')]['hasMany'](db['CannedAnswer'],{'as':_0x7d7a('0x165'),'foreignKey':_0x7d7a('0x181')});db[_0x7d7a('0x5b')][_0x7d7a('0x114')](db[_0x7d7a('0x60')],{'as':'Messages','foreignKey':_0x7d7a('0x181')});db[_0x7d7a('0x5b')][_0x7d7a('0x114')](db[_0x7d7a('0x5e')],{'as':'Interactions'});db[_0x7d7a('0x5b')][_0x7d7a('0x114')](db['SmsApplication'],{'as':'Applications'});db[_0x7d7a('0x5b')]['belongsTo'](db[_0x7d7a('0x125')],{'as':_0x7d7a('0x169'),'foreignKey':_0x7d7a('0x16a')});db['SmsAccount'][_0x7d7a('0x14b')](db[_0x7d7a('0x90')],{'as':'mandatoryDispositionPause','foreignKey':_0x7d7a('0x16c')});db[_0x7d7a('0x5b')][_0x7d7a('0x121')](db['User'],{'as':_0x7d7a('0x153'),'through':_0x7d7a('0x13c')});db[_0x7d7a('0x182')][_0x7d7a('0x14b')](db[_0x7d7a('0x15')],{'onDelete':'restrict'});db['SmsApplication']['belongsTo'](db[_0x7d7a('0x12f')],{'onDelete':_0x7d7a('0x176')});db[_0x7d7a('0x182')]['belongsTo'](db[_0x7d7a('0x5b')],{'onDelete':'restrict'});db[_0x7d7a('0x182')][_0x7d7a('0x14b')](db[_0x7d7a('0x8e')],{'onDelete':_0x7d7a('0x176'),'foreignKey':_0x7d7a('0x14f')});db[_0x7d7a('0x182')][_0x7d7a('0x14b')](db[_0x7d7a('0x99')],{'onDelete':_0x7d7a('0x176'),'foreignKey':_0x7d7a('0x177')});db[_0x7d7a('0x5e')]['hasMany'](db[_0x7d7a('0x60')],{'as':_0x7d7a('0x157'),'onDelete':_0x7d7a('0x140'),'foreignKey':'SmsInteractionId'});db[_0x7d7a('0x5e')][_0x7d7a('0x14b')](db['SmsAccount'],{'as':'Account','foreignKey':_0x7d7a('0x181')});db[_0x7d7a('0x5e')]['belongsTo'](db[_0x7d7a('0x7c')],{'as':_0x7d7a('0x15d'),'foreignKey':_0x7d7a('0x15e')});db[_0x7d7a('0x5e')][_0x7d7a('0x14b')](db[_0x7d7a('0x15')],{'as':'Owner','foreignKey':_0x7d7a('0x117')});db['SmsInteraction'][_0x7d7a('0x121')](db[_0x7d7a('0x99')],{'through':'sms_interaction_has_tags','as':_0x7d7a('0x172')});db[_0x7d7a('0x5e')][_0x7d7a('0x121')](db[_0x7d7a('0x99')],{'through':_0x7d7a('0x183'),'as':_0x7d7a('0x173')});db['SmsInteraction'][_0x7d7a('0x121')](db[_0x7d7a('0x15')],{'as':'Users','through':_0x7d7a('0x12b'),'foreignKey':_0x7d7a('0x184')});db[_0x7d7a('0x60')][_0x7d7a('0x14b')](db[_0x7d7a('0x15')],{'as':_0x7d7a('0x15')});db['SmsMessage']['belongsTo'](db['CmContact'],{'onDelete':_0x7d7a('0x140'),'as':_0x7d7a('0x15d')});db[_0x7d7a('0x60')][_0x7d7a('0x14b')](db['SmsInteraction'],{'onDelete':_0x7d7a('0x140'),'as':'Interaction','foreignKey':'SmsInteractionId'});db[_0x7d7a('0x60')]['belongsTo'](db[_0x7d7a('0x5b')],{'as':'Account','foreignKey':_0x7d7a('0x181')});db[_0x7d7a('0x12f')][_0x7d7a('0x121')](db[_0x7d7a('0x15')],{'as':_0x7d7a('0x153'),'through':_0x7d7a('0x3b'),'foreignKey':'SmsQueueId'});db[_0x7d7a('0x12f')][_0x7d7a('0x121')](db[_0x7d7a('0xf0')],{'through':'team_has_sms_queues','as':_0x7d7a('0x154')});db[_0x7d7a('0x63')][_0x7d7a('0x114')](db[_0x7d7a('0x162')],{'as':_0x7d7a('0x163'),'foreignKey':_0x7d7a('0x185')});db[_0x7d7a('0x63')][_0x7d7a('0x114')](db[_0x7d7a('0x164')],{'as':_0x7d7a('0x165'),'foreignKey':_0x7d7a('0x185')});db['OpenchannelAccount'][_0x7d7a('0x114')](db[_0x7d7a('0x67')],{'as':_0x7d7a('0x168'),'foreignKey':_0x7d7a('0x185')});db[_0x7d7a('0x63')]['hasMany'](db[_0x7d7a('0x69')],{'as':_0x7d7a('0x157'),'foreignKey':_0x7d7a('0x185')});db['OpenchannelAccount'][_0x7d7a('0x114')](db[_0x7d7a('0x65')],{'as':'Applications','foreignKey':_0x7d7a('0x185')});db[_0x7d7a('0x63')]['belongsTo'](db[_0x7d7a('0x125')],{'as':_0x7d7a('0x169'),'foreignKey':_0x7d7a('0x16a')});db['OpenchannelAccount'][_0x7d7a('0x14b')](db[_0x7d7a('0x90')],{'as':'mandatoryDispositionPause','foreignKey':_0x7d7a('0x16c')});db[_0x7d7a('0x63')][_0x7d7a('0x121')](db[_0x7d7a('0x15')],{'as':'Agents','through':_0x7d7a('0x186')});db[_0x7d7a('0x65')][_0x7d7a('0x14b')](db[_0x7d7a('0x15')],{'onDelete':_0x7d7a('0x176')});db['OpenchannelApplication'][_0x7d7a('0x14b')](db['OpenchannelQueue'],{'onDelete':_0x7d7a('0x176'),'foreignKey':_0x7d7a('0x187')});db[_0x7d7a('0x65')][_0x7d7a('0x14b')](db[_0x7d7a('0x63')],{'onDelete':_0x7d7a('0x176'),'foreignKey':'OpenchannelAccountId'});db[_0x7d7a('0x65')][_0x7d7a('0x14b')](db[_0x7d7a('0x8e')],{'onDelete':'restrict','foreignKey':_0x7d7a('0x14f')});db[_0x7d7a('0x65')]['belongsTo'](db[_0x7d7a('0x99')],{'onDelete':'restrict','foreignKey':_0x7d7a('0x177')});db['OpenchannelInteraction'][_0x7d7a('0x114')](db['OpenchannelMessage'],{'as':_0x7d7a('0x157'),'onDelete':'cascade','foreignKey':'OpenchannelInteractionId'});db[_0x7d7a('0x67')][_0x7d7a('0x14b')](db[_0x7d7a('0x63')],{'as':_0x7d7a('0x16f'),'foreignKey':_0x7d7a('0x185')});db['OpenchannelInteraction']['belongsTo'](db[_0x7d7a('0x7c')],{'as':_0x7d7a('0x15d'),'foreignKey':_0x7d7a('0x15e')});db[_0x7d7a('0x67')][_0x7d7a('0x14b')](db[_0x7d7a('0x15')],{'as':_0x7d7a('0x170'),'foreignKey':_0x7d7a('0x117')});db[_0x7d7a('0x67')][_0x7d7a('0x121')](db[_0x7d7a('0x99')],{'through':_0x7d7a('0x188'),'as':'Tags'});db[_0x7d7a('0x67')][_0x7d7a('0x121')](db['Tag'],{'through':_0x7d7a('0x188'),'as':_0x7d7a('0x173')});db[_0x7d7a('0x67')]['belongsToMany'](db['User'],{'as':_0x7d7a('0x174'),'through':'user_has_openchannel_interactions','foreignKey':_0x7d7a('0x189')});db[_0x7d7a('0x69')]['belongsTo'](db[_0x7d7a('0x15')],{'onDelete':'cascade','as':'User'});db[_0x7d7a('0x69')][_0x7d7a('0x14b')](db[_0x7d7a('0x7c')],{'onDelete':_0x7d7a('0x140'),'as':_0x7d7a('0x15d')});db[_0x7d7a('0x69')][_0x7d7a('0x14b')](db[_0x7d7a('0x67')],{'onDelete':'cascade','as':_0x7d7a('0x17e'),'foreignKey':_0x7d7a('0x189')});db['OpenchannelMessage'][_0x7d7a('0x14b')](db['Attachment'],{'as':_0x7d7a('0xf4'),'foreignKey':_0x7d7a('0x17f')});db[_0x7d7a('0x69')][_0x7d7a('0x14b')](db[_0x7d7a('0x63')],{'as':_0x7d7a('0x16f'),'foreignKey':_0x7d7a('0x185')});db[_0x7d7a('0x6b')][_0x7d7a('0x121')](db[_0x7d7a('0x15')],{'as':_0x7d7a('0x153'),'through':'UserOpenchannelQueue','foreignKey':'OpenchannelQueueId'});db[_0x7d7a('0x6b')][_0x7d7a('0x121')](db[_0x7d7a('0xf0')],{'through':_0x7d7a('0x18a'),'as':_0x7d7a('0x154')});db[_0x7d7a('0x6d')]['hasMany'](db['Disposition'],{'as':'Dispositions','foreignKey':'ChatWebsiteId'});db[_0x7d7a('0x6d')]['hasMany'](db[_0x7d7a('0x164')],{'as':'Answers','foreignKey':_0x7d7a('0x175')});db[_0x7d7a('0x6d')][_0x7d7a('0x114')](db['ChatProactiveAction'],{'as':_0x7d7a('0x18b')});db[_0x7d7a('0x6d')][_0x7d7a('0x114')](db[_0x7d7a('0x70')],{'as':'Interactions'});db[_0x7d7a('0x6d')][_0x7d7a('0x114')](db[_0x7d7a('0x6f')],{'as':'Applications'});db[_0x7d7a('0x6d')][_0x7d7a('0x114')](db[_0x7d7a('0x71')],{'as':_0x7d7a('0x157')});db[_0x7d7a('0x6d')][_0x7d7a('0x14b')](db['CmList'],{'as':'List','foreignKey':_0x7d7a('0x16a')});db[_0x7d7a('0x6d')][_0x7d7a('0x14b')](db['Interval'],{'as':_0x7d7a('0x8e'),'foreignKey':_0x7d7a('0x14f')});db[_0x7d7a('0x6d')]['belongsTo'](db['MailAccount'],{'as':_0x7d7a('0x44'),'foreignKey':_0x7d7a('0x15f')});db[_0x7d7a('0x6d')][_0x7d7a('0x14b')](db[_0x7d7a('0x90')],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db[_0x7d7a('0x6d')][_0x7d7a('0x121')](db[_0x7d7a('0x15')],{'as':_0x7d7a('0x153'),'through':'user_has_chat_websites'});db[_0x7d7a('0x18c')][_0x7d7a('0x14b')](db[_0x7d7a('0x63')],{});db[_0x7d7a('0x18c')][_0x7d7a('0x14b')](db[_0x7d7a('0x125')],{'as':_0x7d7a('0x169'),'foreignKey':_0x7d7a('0x16a')});db['OpenchannelQueueReport'][_0x7d7a('0x14b')](db['CmContact'],{'as':_0x7d7a('0x15d'),'foreignKey':_0x7d7a('0x15e')});db[_0x7d7a('0x18c')][_0x7d7a('0x14b')](db[_0x7d7a('0x67')],{});db[_0x7d7a('0x18c')]['belongsTo'](db[_0x7d7a('0x69')],{});db[_0x7d7a('0x18c')]['belongsTo'](db[_0x7d7a('0x15')],{});db['OpenchannelQueueReport'][_0x7d7a('0x14b')](db['OpenchannelQueue'],{});db[_0x7d7a('0x6f')][_0x7d7a('0x14b')](db[_0x7d7a('0x15')],{'as':_0x7d7a('0x18d'),'foreignKey':_0x7d7a('0x117'),'onDelete':_0x7d7a('0x176')});db[_0x7d7a('0x6f')][_0x7d7a('0x14b')](db[_0x7d7a('0x75')],{'as':_0x7d7a('0x18e'),'foreignKey':'ChatQueueId','onDelete':_0x7d7a('0x176')});db[_0x7d7a('0x6f')]['belongsTo'](db[_0x7d7a('0x6d')],{'as':_0x7d7a('0x18f'),'foreignKey':_0x7d7a('0x175'),'onDelete':'restrict'});db[_0x7d7a('0x6f')][_0x7d7a('0x14b')](db[_0x7d7a('0x99')],{'onDelete':_0x7d7a('0x176'),'foreignKey':_0x7d7a('0x177')});db['ChatInteraction']['hasMany'](db[_0x7d7a('0x71')],{'as':_0x7d7a('0x157'),'onDelete':_0x7d7a('0x140'),'foreignKey':'ChatInteractionId'});db['ChatInteraction']['belongsTo'](db[_0x7d7a('0x6d')],{'as':_0x7d7a('0x16f'),'foreignKey':'ChatWebsiteId'});db[_0x7d7a('0x70')][_0x7d7a('0x14b')](db['CmContact'],{'as':_0x7d7a('0x15d'),'foreignKey':_0x7d7a('0x15e')});db[_0x7d7a('0x70')][_0x7d7a('0x14b')](db['User'],{'as':_0x7d7a('0x170'),'foreignKey':_0x7d7a('0x117')});db['ChatInteraction']['belongsToMany'](db['Tag'],{'through':_0x7d7a('0x190'),'as':_0x7d7a('0x172')});db[_0x7d7a('0x70')]['belongsToMany'](db[_0x7d7a('0x99')],{'through':_0x7d7a('0x190'),'as':_0x7d7a('0x173')});db['ChatInteraction']['belongsToMany'](db[_0x7d7a('0x15')],{'as':_0x7d7a('0x174'),'through':'user_has_chat_interactions','foreignKey':_0x7d7a('0x191')});db['ChatMessage']['belongsTo'](db[_0x7d7a('0x15')],{'onDelete':_0x7d7a('0x140'),'as':_0x7d7a('0x15')});db[_0x7d7a('0x71')][_0x7d7a('0x14b')](db[_0x7d7a('0x7c')],{'onDelete':_0x7d7a('0x140'),'as':_0x7d7a('0x15d'),'foreignKey':_0x7d7a('0x15e')});db[_0x7d7a('0x71')][_0x7d7a('0x14b')](db[_0x7d7a('0x70')],{'onDelete':_0x7d7a('0x140'),'as':_0x7d7a('0x17e'),'foreignKey':_0x7d7a('0x191')});db[_0x7d7a('0x71')][_0x7d7a('0x14b')](db[_0x7d7a('0xf4')],{'as':_0x7d7a('0xf4'),'foreignKey':_0x7d7a('0x17f')});db[_0x7d7a('0x71')][_0x7d7a('0x14b')](db[_0x7d7a('0x6d')],{'as':_0x7d7a('0x16f'),'foreignKey':_0x7d7a('0x175')});db['ChatOfflineMessage'][_0x7d7a('0x114')](db[_0x7d7a('0xf4')],{'as':_0x7d7a('0x192'),'foreignKey':_0x7d7a('0x193'),'onDelete':'cascade','hooks':!![]});db[_0x7d7a('0x73')]['belongsTo'](db[_0x7d7a('0x7c')],{'onDelete':'cascade','as':_0x7d7a('0x15d'),'foreignKey':_0x7d7a('0x15e')});db[_0x7d7a('0x73')]['belongsTo'](db[_0x7d7a('0x6d')],{'as':_0x7d7a('0x16f'),'foreignKey':_0x7d7a('0x175')});db['ChatQueue']['belongsToMany'](db['User'],{'as':_0x7d7a('0x153'),'through':'UserChatQueue','hooks':!![]});db[_0x7d7a('0x75')][_0x7d7a('0x121')](db[_0x7d7a('0xf0')],{'through':_0x7d7a('0x194'),'as':_0x7d7a('0x154')});db[_0x7d7a('0x77')][_0x7d7a('0x114')](db[_0x7d7a('0xdf')],{'as':_0x7d7a('0x157'),'foreignKey':'ChatGroupId','onDelete':_0x7d7a('0x140')});db[_0x7d7a('0x77')]['belongsToMany'](db[_0x7d7a('0x15')],{'as':_0x7d7a('0x145'),'through':'chat_group_has_users'});db[_0x7d7a('0x79')][_0x7d7a('0x14b')](db[_0x7d7a('0x6d')],{'as':_0x7d7a('0x18f'),'foreignKey':_0x7d7a('0x175')});db[_0x7d7a('0x195')][_0x7d7a('0x114')](db[_0x7d7a('0x7c')],{'as':_0x7d7a('0x196'),'foreignKey':_0x7d7a('0x197')});db[_0x7d7a('0x7c')][_0x7d7a('0x114')](db[_0x7d7a('0x7e')],{'as':_0x7d7a('0x147'),'foreignKey':_0x7d7a('0x15e')});db[_0x7d7a('0x7c')][_0x7d7a('0x114')](db[_0x7d7a('0x82')],{'as':_0x7d7a('0x118'),'foreignKey':'ContactId'});db[_0x7d7a('0x7c')][_0x7d7a('0x114')](db['CmHopperHistory'],{'as':'HopperHistories','foreignKey':'ContactId'});db['CmContact'][_0x7d7a('0x114')](db['ReportAgentPreview'],{'as':_0x7d7a('0x119'),'foreignKey':_0x7d7a('0x15e')});db[_0x7d7a('0x7c')]['hasMany'](db[_0x7d7a('0xe2')],{'as':_0x7d7a('0x14a'),'foreignKey':_0x7d7a('0x15e')});db[_0x7d7a('0x7c')][_0x7d7a('0x114')](db[_0x7d7a('0x67')],{'as':_0x7d7a('0x11a'),'foreignKey':_0x7d7a('0x15e'),'onDelete':_0x7d7a('0x176')});db[_0x7d7a('0x7c')][_0x7d7a('0x114')](db[_0x7d7a('0x70')],{'as':_0x7d7a('0x128'),'foreignKey':_0x7d7a('0x15e'),'onDelete':_0x7d7a('0x176')});db[_0x7d7a('0x7c')][_0x7d7a('0x114')](db[_0x7d7a('0x5e')],{'as':'SmsInteractions','foreignKey':'ContactId','onDelete':_0x7d7a('0x176')});db[_0x7d7a('0x7c')]['hasMany'](db[_0x7d7a('0x57')],{'as':_0x7d7a('0x11c'),'foreignKey':'ContactId','onDelete':_0x7d7a('0x176')});db[_0x7d7a('0x7c')][_0x7d7a('0x114')](db['MailInteraction'],{'as':'MailInteractions','foreignKey':_0x7d7a('0x15e'),'onDelete':'restrict'});db[_0x7d7a('0x7c')][_0x7d7a('0x14b')](db[_0x7d7a('0x195')],{'as':_0x7d7a('0x198'),'foreignKey':'CompanyId'});db[_0x7d7a('0x7c')][_0x7d7a('0x14b')](db[_0x7d7a('0x125')],{'as':_0x7d7a('0x169'),'foreignKey':'ListId','onDelete':_0x7d7a('0x140')});db[_0x7d7a('0x7c')][_0x7d7a('0x121')](db['User'],{'as':_0x7d7a('0x174'),'through':_0x7d7a('0x124')});db['CmContact'][_0x7d7a('0x121')](db[_0x7d7a('0x99')],{'as':_0x7d7a('0x172'),'through':'cm_contact_has_tags'});db['CmContact'][_0x7d7a('0x121')](db[_0x7d7a('0x99')],{'through':'cm_contact_has_tags','as':_0x7d7a('0x173')});db[_0x7d7a('0x7e')]['belongsTo'](db[_0x7d7a('0x7c')],{'as':_0x7d7a('0x15d'),'foreignKey':_0x7d7a('0x15e'),'onDelete':_0x7d7a('0x140')});db['CmHopper'][_0x7d7a('0x14b')](db['CmList'],{'as':_0x7d7a('0x169'),'foreignKey':_0x7d7a('0x16a'),'onDelete':_0x7d7a('0x140')});db['CmHopper']['belongsTo'](db[_0x7d7a('0x15')],{'as':_0x7d7a('0x18d'),'foreignKey':_0x7d7a('0x117')});db['CmHopper']['belongsTo'](db[_0x7d7a('0x1e')],{'as':'Queue','foreignKey':_0x7d7a('0x146'),'onDelete':_0x7d7a('0x140')});db[_0x7d7a('0x7e')][_0x7d7a('0x14b')](db[_0x7d7a('0xf2')],{'as':'Campaign','foreignKey':_0x7d7a('0x199'),'onDelete':'cascade'});db[_0x7d7a('0x7e')][_0x7d7a('0x14b')](db[_0x7d7a('0x15')],{'as':_0x7d7a('0x170'),'foreignKey':_0x7d7a('0x19a')});db[_0x7d7a('0x80')][_0x7d7a('0x14b')](db['CmContact'],{'as':'Contact','foreignKey':_0x7d7a('0x15e'),'onDelete':_0x7d7a('0x140')});db['CmHopperBlack']['belongsTo'](db[_0x7d7a('0x125')],{'as':_0x7d7a('0x169'),'foreignKey':_0x7d7a('0x16a'),'onDelete':'cascade'});db[_0x7d7a('0x80')][_0x7d7a('0x14b')](db[_0x7d7a('0x1e')],{'as':'Queue','foreignKey':_0x7d7a('0x146'),'onDelete':_0x7d7a('0x140')});db[_0x7d7a('0x80')][_0x7d7a('0x14b')](db[_0x7d7a('0xf2')],{'as':_0x7d7a('0xf2'),'foreignKey':'CampaignId','onDelete':_0x7d7a('0x140')});db[_0x7d7a('0x89')][_0x7d7a('0x114')](db[_0x7d7a('0x19b')],{'as':{'plural':'All','singular':_0x7d7a('0x19c')},'foreignKey':'AutomationAllId','onDelete':'cascade','hooks':!![]});db['Automation'][_0x7d7a('0x114')](db[_0x7d7a('0x19b')],{'as':{'plural':_0x7d7a('0x19d'),'singular':'OneAny'},'foreignKey':_0x7d7a('0x19e'),'onDelete':_0x7d7a('0x140'),'hooks':!![]});db[_0x7d7a('0x89')][_0x7d7a('0x114')](db['Action'],{'as':_0x7d7a('0x19f'),'foreignKey':_0x7d7a('0x1a0'),'onDelete':_0x7d7a('0x140'),'hooks':!![]});db['Disposition'][_0x7d7a('0x114')](db[_0x7d7a('0x162')],{'as':'Dispositions','foreignKey':'ParentId','onDelete':_0x7d7a('0x140')});db[_0x7d7a('0x8e')]['hasMany'](db[_0x7d7a('0x8e')],{'as':'Intervals','foreignKey':_0x7d7a('0x14f'),'onDelete':_0x7d7a('0x140'),'hooks':!![],'required':![]});db[_0x7d7a('0x8e')]['hasMany'](db[_0x7d7a('0x1a')],{'as':_0x7d7a('0x1a1'),'foreignKey':_0x7d7a('0x14f'),'onDelete':_0x7d7a('0x176')});db[_0x7d7a('0x8e')]['hasMany'](db[_0x7d7a('0x4b')],{'as':'MailApplications','foreignKey':_0x7d7a('0x14f')});db[_0x7d7a('0x8e')][_0x7d7a('0x114')](db[_0x7d7a('0x6f')],{'as':_0x7d7a('0x1a2'),'foreignKey':_0x7d7a('0x14f')});db[_0x7d7a('0x8e')][_0x7d7a('0x114')](db['FaxApplication'],{'as':_0x7d7a('0x1a3'),'foreignKey':_0x7d7a('0x14f')});db[_0x7d7a('0x8e')][_0x7d7a('0x114')](db[_0x7d7a('0x182')],{'as':_0x7d7a('0x1a4'),'foreignKey':'IntervalId'});db[_0x7d7a('0x95')][_0x7d7a('0x14b')](db[_0x7d7a('0x44')],{});db['Schedule'][_0x7d7a('0x14b')](db[_0x7d7a('0x1a5')],{'foreignKey':_0x7d7a('0x1a6')});db[_0x7d7a('0x95')]['belongsTo'](db[_0x7d7a('0x1a7')],{'foreignKey':'CustomReportId'});db['Sound'][_0x7d7a('0x121')](db[_0x7d7a('0x1c')],{'as':_0x7d7a('0x1a8'),'through':_0x7d7a('0x144'),'onDelete':'restrict'});db['Tag'][_0x7d7a('0x121')](db['CmContact'],{'through':_0x7d7a('0x1a9')});db[_0x7d7a('0x99')][_0x7d7a('0x121')](db['ChatInteraction'],{'through':_0x7d7a('0x190')});db[_0x7d7a('0x99')][_0x7d7a('0x121')](db[_0x7d7a('0x167')],{'through':_0x7d7a('0x171')});db[_0x7d7a('0x99')][_0x7d7a('0x121')](db['SmsInteraction'],{'through':'sms_interaction_has_tags'});db[_0x7d7a('0x99')]['belongsToMany'](db['FaxInteraction'],{'through':'fax_interaction_has_tags'});db[_0x7d7a('0x99')][_0x7d7a('0x121')](db[_0x7d7a('0x67')],{'through':'openchannel_interaction_has_tags'});db[_0x7d7a('0x99')][_0x7d7a('0x121')](db[_0x7d7a('0x10a')],{'through':_0x7d7a('0x1aa')});db['Trigger'][_0x7d7a('0x114')](db[_0x7d7a('0x19b')],{'as':{'plural':'AllConditions','singular':_0x7d7a('0x1ab')},'foreignKey':'TriggerAllId','onDelete':_0x7d7a('0x140'),'hooks':!![]});db['Trigger'][_0x7d7a('0x114')](db[_0x7d7a('0x19b')],{'as':{'plural':_0x7d7a('0x1ac'),'singular':_0x7d7a('0x1ad')},'foreignKey':_0x7d7a('0x1ae'),'onDelete':'cascade','hooks':!![]});db[_0x7d7a('0x1af')][_0x7d7a('0x114')](db[_0x7d7a('0x88')],{'as':_0x7d7a('0x19f'),'foreignKey':_0x7d7a('0x1b0'),'onDelete':_0x7d7a('0x140'),'hooks':!![]});db[_0x7d7a('0x1a7')]['hasMany'](db['AnalyticFieldReport'],{'as':_0x7d7a('0x1b1'),'onDelete':_0x7d7a('0x140'),'foreignKey':_0x7d7a('0x1b2'),'hooks':!![]});db[_0x7d7a('0x1a5')]['hasMany'](db[_0x7d7a('0xa6')],{'as':'Fields','onDelete':'cascade','foreignKey':_0x7d7a('0x1a6')});db[_0x7d7a('0x1b3')][_0x7d7a('0x114')](db[_0x7d7a('0xa6')],{'as':_0x7d7a('0x1b1'),'onDelete':'cascade','foreignKey':_0x7d7a('0x1b4')});db[_0x7d7a('0xa6')][_0x7d7a('0x14b')](db[_0x7d7a('0x1b3')],{'foreignKey':_0x7d7a('0x1b4')});db[_0x7d7a('0xaa')][_0x7d7a('0x114')](db[_0x7d7a('0xac')],{'as':_0x7d7a('0x1b5'),'onDelete':'cascade','foreignKey':'AccountId'});db[_0x7d7a('0xac')][_0x7d7a('0x114')](db[_0x7d7a('0xae')],{'as':_0x7d7a('0x1b6'),'onDelete':_0x7d7a('0x140'),'foreignKey':_0x7d7a('0x1b7')});db[_0x7d7a('0xac')][_0x7d7a('0x114')](db[_0x7d7a('0xae')],{'as':_0x7d7a('0x1b8'),'onDelete':_0x7d7a('0x140'),'foreignKey':_0x7d7a('0x1b9')});db['SalesforceConfiguration'][_0x7d7a('0x114')](db[_0x7d7a('0xae')],{'as':_0x7d7a('0x1b1'),'onDelete':_0x7d7a('0x140'),'foreignKey':_0x7d7a('0x1ba')});db['SalesforceConfiguration'][_0x7d7a('0x14b')](db[_0x7d7a('0xaa')],{'as':'Account','foreignKey':_0x7d7a('0x1bb')});db['SalesforceField'][_0x7d7a('0x114')](db[_0x7d7a('0xae')],{'as':_0x7d7a('0x1bc'),'foreignKey':_0x7d7a('0x1b7')});db['SalesforceField'][_0x7d7a('0x114')](db[_0x7d7a('0xae')],{'as':_0x7d7a('0x1bd'),'foreignKey':_0x7d7a('0x1b9')});db[_0x7d7a('0xae')][_0x7d7a('0x114')](db[_0x7d7a('0xae')],{'as':_0x7d7a('0x1be'),'foreignKey':_0x7d7a('0x1ba')});db[_0x7d7a('0xae')][_0x7d7a('0x14b')](db[_0x7d7a('0x1bf')],{'as':_0x7d7a('0x1bf'),'foreignKey':_0x7d7a('0x1c0')});db[_0x7d7a('0xaf')][_0x7d7a('0x114')](db[_0x7d7a('0xb1')],{'as':_0x7d7a('0x1b5'),'onDelete':'cascade','foreignKey':_0x7d7a('0x1bb')});db[_0x7d7a('0xb1')][_0x7d7a('0x114')](db[_0x7d7a('0xb3')],{'as':'Subjects','onDelete':_0x7d7a('0x140'),'foreignKey':_0x7d7a('0x1b7')});db['SugarcrmConfiguration'][_0x7d7a('0x114')](db[_0x7d7a('0xb3')],{'as':_0x7d7a('0x1b8'),'onDelete':'cascade','foreignKey':_0x7d7a('0x1b9')});db[_0x7d7a('0xb1')]['hasMany'](db[_0x7d7a('0xb3')],{'as':_0x7d7a('0x1b1'),'onDelete':_0x7d7a('0x140'),'foreignKey':'FieldId'});db['SugarcrmConfiguration'][_0x7d7a('0x14b')](db['SugarcrmAccount'],{'as':_0x7d7a('0x16f'),'foreignKey':_0x7d7a('0x1bb')});db[_0x7d7a('0xb3')][_0x7d7a('0x114')](db[_0x7d7a('0xb3')],{'as':'Subject','foreignKey':_0x7d7a('0x1b7')});db[_0x7d7a('0xb3')][_0x7d7a('0x114')](db[_0x7d7a('0xb3')],{'as':_0x7d7a('0x1bd'),'foreignKey':_0x7d7a('0x1b9')});db[_0x7d7a('0xb3')][_0x7d7a('0x114')](db[_0x7d7a('0xb3')],{'as':_0x7d7a('0x1be'),'foreignKey':'FieldId'});db[_0x7d7a('0xb3')][_0x7d7a('0x14b')](db[_0x7d7a('0x1bf')],{'as':'Variable','foreignKey':_0x7d7a('0x1c0')});db[_0x7d7a('0xb5')][_0x7d7a('0x114')](db['DeskConfiguration'],{'as':'Configurations','onDelete':_0x7d7a('0x140'),'foreignKey':_0x7d7a('0x1bb')});db[_0x7d7a('0xb7')][_0x7d7a('0x114')](db['DeskField'],{'as':'Subjects','onDelete':_0x7d7a('0x140'),'foreignKey':_0x7d7a('0x1b7')});db[_0x7d7a('0xb7')]['hasMany'](db[_0x7d7a('0xb9')],{'as':_0x7d7a('0x1b8'),'onDelete':_0x7d7a('0x140'),'foreignKey':'DescriptionId'});db[_0x7d7a('0xb7')][_0x7d7a('0x114')](db[_0x7d7a('0xb9')],{'as':_0x7d7a('0x1b1'),'onDelete':_0x7d7a('0x140'),'foreignKey':_0x7d7a('0x1ba')});db[_0x7d7a('0xb7')][_0x7d7a('0x14b')](db[_0x7d7a('0xb5')],{'as':'Account','foreignKey':'AccountId'});db['DeskConfiguration']['belongsToMany'](db[_0x7d7a('0x99')],{'through':_0x7d7a('0x1c1')});db[_0x7d7a('0xb9')]['hasMany'](db[_0x7d7a('0xb9')],{'as':_0x7d7a('0x1bc'),'foreignKey':_0x7d7a('0x1b7')});db[_0x7d7a('0xb9')][_0x7d7a('0x114')](db['DeskField'],{'as':_0x7d7a('0x1bd'),'foreignKey':_0x7d7a('0x1b9')});db['DeskField'][_0x7d7a('0x114')](db[_0x7d7a('0xb9')],{'as':_0x7d7a('0x1be'),'foreignKey':'FieldId'});db[_0x7d7a('0xb9')][_0x7d7a('0x14b')](db[_0x7d7a('0x1bf')],{'as':'Variable','foreignKey':'VariableId'});db[_0x7d7a('0xba')]['hasMany'](db[_0x7d7a('0xbc')],{'as':_0x7d7a('0x1b5'),'onDelete':_0x7d7a('0x140'),'foreignKey':'AccountId'});db['ZohoConfiguration'][_0x7d7a('0x114')](db['ZohoField'],{'as':_0x7d7a('0x1b6'),'onDelete':_0x7d7a('0x140'),'foreignKey':'SubjectId'});db[_0x7d7a('0xbc')]['hasMany'](db[_0x7d7a('0xbe')],{'as':_0x7d7a('0x1b8'),'onDelete':'cascade','foreignKey':_0x7d7a('0x1b9')});db['ZohoConfiguration'][_0x7d7a('0x114')](db['ZohoField'],{'as':_0x7d7a('0x1b1'),'onDelete':'cascade','foreignKey':_0x7d7a('0x1ba')});db[_0x7d7a('0xbc')][_0x7d7a('0x14b')](db['ZohoAccount'],{'as':'Account','foreignKey':_0x7d7a('0x1bb')});db['ZohoField'][_0x7d7a('0x114')](db[_0x7d7a('0xbe')],{'as':_0x7d7a('0x1bc'),'foreignKey':_0x7d7a('0x1b7')});db['ZohoField'][_0x7d7a('0x114')](db['ZohoField'],{'as':_0x7d7a('0x1bd'),'foreignKey':_0x7d7a('0x1b9')});db[_0x7d7a('0xbe')][_0x7d7a('0x114')](db[_0x7d7a('0xbe')],{'as':'Field','foreignKey':'FieldId'});db[_0x7d7a('0xbe')][_0x7d7a('0x14b')](db[_0x7d7a('0x1bf')],{'as':_0x7d7a('0x1bf'),'foreignKey':_0x7d7a('0x1c0')});db[_0x7d7a('0xc0')]['hasMany'](db[_0x7d7a('0xc2')],{'as':'Configurations','onDelete':_0x7d7a('0x140'),'foreignKey':_0x7d7a('0x1bb')});db[_0x7d7a('0xc2')]['hasMany'](db[_0x7d7a('0x1c2')],{'as':_0x7d7a('0x1b6'),'foreignKey':_0x7d7a('0x1b7')});db[_0x7d7a('0xc2')]['hasMany'](db[_0x7d7a('0x1c2')],{'as':_0x7d7a('0x1b8'),'foreignKey':_0x7d7a('0x1b9')});db[_0x7d7a('0xc2')][_0x7d7a('0x114')](db[_0x7d7a('0x1c2')],{'as':_0x7d7a('0x1b1'),'foreignKey':_0x7d7a('0x1ba')});db[_0x7d7a('0xc2')][_0x7d7a('0x14b')](db[_0x7d7a('0xc0')],{'as':_0x7d7a('0x16f'),'foreignKey':_0x7d7a('0x1bb')});db[_0x7d7a('0xc2')]['belongsToMany'](db[_0x7d7a('0x99')],{'through':_0x7d7a('0x1c3')});db['ZendeskField']['hasMany'](db[_0x7d7a('0x1c2')],{'as':_0x7d7a('0x1bc'),'foreignKey':_0x7d7a('0x1b7')});db['ZendeskField'][_0x7d7a('0x114')](db[_0x7d7a('0x1c2')],{'as':_0x7d7a('0x1bd'),'foreignKey':'DescriptionId'});db['ZendeskField'][_0x7d7a('0x114')](db['ZendeskField'],{'as':_0x7d7a('0x1be'),'foreignKey':_0x7d7a('0x1ba')});db['ZendeskField'][_0x7d7a('0x14b')](db['Variable'],{'as':_0x7d7a('0x1bf'),'foreignKey':_0x7d7a('0x1c0')});db[_0x7d7a('0xc5')]['hasMany'](db[_0x7d7a('0xc6')],{'as':_0x7d7a('0x1b5'),'onDelete':_0x7d7a('0x140'),'foreignKey':_0x7d7a('0x1bb')});db[_0x7d7a('0xc6')][_0x7d7a('0x114')](db[_0x7d7a('0xc8')],{'as':'Subjects','onDelete':_0x7d7a('0x140'),'foreignKey':'SubjectId'});db[_0x7d7a('0xc6')][_0x7d7a('0x114')](db['FreshdeskField'],{'as':'Descriptions','onDelete':_0x7d7a('0x140'),'foreignKey':'DescriptionId'});db[_0x7d7a('0xc6')][_0x7d7a('0x114')](db[_0x7d7a('0xc8')],{'as':_0x7d7a('0x1b1'),'onDelete':_0x7d7a('0x140'),'foreignKey':_0x7d7a('0x1ba')});db[_0x7d7a('0xc6')]['belongsTo'](db[_0x7d7a('0xc5')],{'as':'Account','foreignKey':_0x7d7a('0x1bb')});db[_0x7d7a('0xc6')][_0x7d7a('0x121')](db[_0x7d7a('0x99')],{'through':_0x7d7a('0x1c4')});db[_0x7d7a('0xc8')][_0x7d7a('0x114')](db[_0x7d7a('0xc8')],{'as':_0x7d7a('0x1bc'),'foreignKey':_0x7d7a('0x1b7')});db[_0x7d7a('0xc8')][_0x7d7a('0x114')](db['FreshdeskField'],{'as':_0x7d7a('0x1bd'),'foreignKey':_0x7d7a('0x1b9')});db['FreshdeskField']['hasMany'](db[_0x7d7a('0xc8')],{'as':'Field','foreignKey':'FieldId'});db[_0x7d7a('0xc8')][_0x7d7a('0x14b')](db['Variable'],{'as':'Variable','foreignKey':_0x7d7a('0x1c0')});db[_0x7d7a('0xc9')][_0x7d7a('0x114')](db[_0x7d7a('0xcb')],{'as':_0x7d7a('0x1b5'),'onDelete':'cascade','foreignKey':'AccountId'});db['VtigerConfiguration'][_0x7d7a('0x114')](db[_0x7d7a('0xcd')],{'as':_0x7d7a('0x1b6'),'foreignKey':_0x7d7a('0x1b7')});db[_0x7d7a('0xcb')][_0x7d7a('0x114')](db['VtigerField'],{'as':_0x7d7a('0x1b8'),'foreignKey':'DescriptionId'});db[_0x7d7a('0xcb')][_0x7d7a('0x114')](db[_0x7d7a('0xcd')],{'as':'Fields','foreignKey':_0x7d7a('0x1ba')});db[_0x7d7a('0xcb')][_0x7d7a('0x14b')](db[_0x7d7a('0xc9')],{'as':_0x7d7a('0x16f'),'foreignKey':_0x7d7a('0x1bb')});db[_0x7d7a('0xcd')][_0x7d7a('0x114')](db['VtigerField'],{'as':_0x7d7a('0x1bc'),'foreignKey':_0x7d7a('0x1b7')});db['VtigerField'][_0x7d7a('0x114')](db[_0x7d7a('0xcd')],{'as':_0x7d7a('0x1bd'),'foreignKey':_0x7d7a('0x1b9')});db[_0x7d7a('0xcd')][_0x7d7a('0x114')](db[_0x7d7a('0xcd')],{'as':_0x7d7a('0x1be'),'foreignKey':_0x7d7a('0x1ba')});db[_0x7d7a('0xcd')]['belongsTo'](db['Variable'],{'as':_0x7d7a('0x1bf'),'foreignKey':_0x7d7a('0x1c0')});db[_0x7d7a('0xce')][_0x7d7a('0x114')](db[_0x7d7a('0xd0')],{'as':'Configurations','onDelete':'cascade','foreignKey':'AccountId'});db[_0x7d7a('0xd0')]['hasMany'](db[_0x7d7a('0xd1')],{'as':_0x7d7a('0x1b6'),'foreignKey':_0x7d7a('0x1b7')});db[_0x7d7a('0xd0')]['hasMany'](db['ServicenowField'],{'as':_0x7d7a('0x1b8'),'foreignKey':_0x7d7a('0x1b9')});db[_0x7d7a('0xd0')][_0x7d7a('0x114')](db['ServicenowField'],{'as':'Fields','foreignKey':_0x7d7a('0x1ba')});db[_0x7d7a('0xd0')]['belongsTo'](db[_0x7d7a('0xce')],{'as':'Account','foreignKey':_0x7d7a('0x1bb')});db[_0x7d7a('0xd1')][_0x7d7a('0x114')](db['ServicenowField'],{'as':'Subject','foreignKey':_0x7d7a('0x1b7')});db['ServicenowField'][_0x7d7a('0x114')](db[_0x7d7a('0xd1')],{'as':_0x7d7a('0x1bd'),'foreignKey':'DescriptionId'});db['ServicenowField'][_0x7d7a('0x114')](db[_0x7d7a('0xd1')],{'as':_0x7d7a('0x1be'),'foreignKey':'FieldId'});db[_0x7d7a('0xd1')][_0x7d7a('0x14b')](db['Variable'],{'as':_0x7d7a('0x1bf'),'foreignKey':_0x7d7a('0x1c0')});db[_0x7d7a('0xd3')][_0x7d7a('0x114')](db['Dynamics365Configuration'],{'as':_0x7d7a('0x1b5'),'onDelete':_0x7d7a('0x140'),'foreignKey':_0x7d7a('0x1bb')});db[_0x7d7a('0xd4')][_0x7d7a('0x114')](db[_0x7d7a('0x1c5')],{'as':'Subjects','onDelete':'cascade','foreignKey':'SubjectId'});db[_0x7d7a('0xd4')][_0x7d7a('0x114')](db[_0x7d7a('0x1c5')],{'as':_0x7d7a('0x1b8'),'onDelete':_0x7d7a('0x140'),'foreignKey':'DescriptionId'});db[_0x7d7a('0xd4')][_0x7d7a('0x114')](db[_0x7d7a('0x1c5')],{'as':_0x7d7a('0x1b1'),'onDelete':_0x7d7a('0x140'),'foreignKey':_0x7d7a('0x1ba')});db[_0x7d7a('0xd4')]['belongsTo'](db[_0x7d7a('0xd3')],{'as':_0x7d7a('0x16f'),'foreignKey':'AccountId'});db[_0x7d7a('0x1c5')][_0x7d7a('0x114')](db[_0x7d7a('0x1c5')],{'as':_0x7d7a('0x1bc'),'foreignKey':_0x7d7a('0x1b7')});db['Dynamics365Field'][_0x7d7a('0x114')](db[_0x7d7a('0x1c5')],{'as':'Description','foreignKey':_0x7d7a('0x1b9')});db[_0x7d7a('0x1c5')][_0x7d7a('0x114')](db[_0x7d7a('0x1c5')],{'as':_0x7d7a('0x1be'),'foreignKey':_0x7d7a('0x1ba')});db[_0x7d7a('0x1c5')]['belongsTo'](db['Variable'],{'as':_0x7d7a('0x1bf'),'foreignKey':_0x7d7a('0x1c0')});db[_0x7d7a('0xd7')][_0x7d7a('0x114')](db[_0x7d7a('0xd9')],{'as':_0x7d7a('0x1b5'),'onDelete':_0x7d7a('0x140'),'foreignKey':_0x7d7a('0x1bb')});db[_0x7d7a('0xd9')][_0x7d7a('0x114')](db['FreshsalesField'],{'as':'Subjects','foreignKey':_0x7d7a('0x1b7')});db[_0x7d7a('0xd9')][_0x7d7a('0x114')](db[_0x7d7a('0xdb')],{'as':_0x7d7a('0x1b8'),'foreignKey':'DescriptionId'});db[_0x7d7a('0xd9')]['hasMany'](db[_0x7d7a('0xdb')],{'as':_0x7d7a('0x1b1'),'foreignKey':_0x7d7a('0x1ba')});db[_0x7d7a('0xd9')][_0x7d7a('0x14b')](db['FreshsalesAccount'],{'as':_0x7d7a('0x16f'),'foreignKey':_0x7d7a('0x1bb')});db[_0x7d7a('0xdb')][_0x7d7a('0x114')](db[_0x7d7a('0xdb')],{'as':'Subject','foreignKey':_0x7d7a('0x1b7')});db[_0x7d7a('0xdb')][_0x7d7a('0x114')](db['FreshsalesField'],{'as':'Description','foreignKey':_0x7d7a('0x1b9')});db[_0x7d7a('0xdb')]['hasMany'](db['FreshsalesField'],{'as':_0x7d7a('0x1be'),'foreignKey':_0x7d7a('0x1ba')});db[_0x7d7a('0xdb')][_0x7d7a('0x14b')](db[_0x7d7a('0x1bf')],{'as':_0x7d7a('0x1bf'),'foreignKey':_0x7d7a('0x1c0')});db[_0x7d7a('0x1c6')][_0x7d7a('0x14b')](db[_0x7d7a('0x6d')],{});db[_0x7d7a('0x1c6')][_0x7d7a('0x14b')](db[_0x7d7a('0x125')],{'as':_0x7d7a('0x169'),'foreignKey':_0x7d7a('0x16a')});db[_0x7d7a('0x1c6')][_0x7d7a('0x14b')](db[_0x7d7a('0x7c')],{'as':'Contact','foreignKey':'ContactId'});db[_0x7d7a('0x1c6')][_0x7d7a('0x14b')](db['ChatInteraction'],{});db[_0x7d7a('0x1c6')]['belongsTo'](db[_0x7d7a('0x71')],{});db['ChatQueueReport'][_0x7d7a('0x14b')](db['User'],{});db[_0x7d7a('0x1c6')][_0x7d7a('0x14b')](db[_0x7d7a('0x75')],{});db[_0x7d7a('0xdf')][_0x7d7a('0x14b')](db[_0x7d7a('0x15')],{'onDelete':_0x7d7a('0x140'),'foreignKey':_0x7d7a('0x1c7')});db[_0x7d7a('0xdf')][_0x7d7a('0x14b')](db[_0x7d7a('0x15')],{'onDelete':'cascade','foreignKey':'ToId'});db[_0x7d7a('0xe2')]['hasMany'](db[_0x7d7a('0xe1')],{'foreignKey':'SessionId','onDelete':'cascade'});db[_0x7d7a('0xe2')]['hasMany'](db['JscriptyAnswerReport'],{'foreignKey':'SessionId','onDelete':_0x7d7a('0x140')});db[_0x7d7a('0xe4')]['belongsTo'](db[_0x7d7a('0x5b')],{});db['SmsQueueReport'][_0x7d7a('0x14b')](db['CmList'],{'as':'List','foreignKey':'ListId'});db[_0x7d7a('0xe4')][_0x7d7a('0x14b')](db['CmContact'],{'as':'Contact','foreignKey':_0x7d7a('0x15e')});db[_0x7d7a('0xe4')][_0x7d7a('0x14b')](db[_0x7d7a('0x5e')],{});db[_0x7d7a('0xe4')]['belongsTo'](db['SmsMessage'],{});db['SmsQueueReport'][_0x7d7a('0x14b')](db['User'],{});db['SmsQueueReport'][_0x7d7a('0x14b')](db['SmsQueue'],{});db[_0x7d7a('0x1c8')]['hasMany'](db[_0x7d7a('0xe2')],{'foreignKey':_0x7d7a('0x1c9')});db[_0x7d7a('0x1c8')]['hasMany'](db['JscriptyQuestionReport'],{'foreignKey':_0x7d7a('0x1c9')});db['JscriptyProject']['hasMany'](db['JscriptyAnswerReport'],{'foreignKey':'ProjectId'});db[_0x7d7a('0xeb')]['belongsToMany'](db[_0x7d7a('0x15')],{'as':_0x7d7a('0x174'),'through':_0x7d7a('0x1ca')});db[_0x7d7a('0xf0')][_0x7d7a('0x121')](db[_0x7d7a('0x15')],{'as':'Agents','through':_0x7d7a('0x126')});db['Team'][_0x7d7a('0x121')](db[_0x7d7a('0x1e')],{'through':_0x7d7a('0x111'),'as':_0x7d7a('0x1cb')});db[_0x7d7a('0xf0')]['belongsToMany'](db[_0x7d7a('0x46')],{'through':_0x7d7a('0x16d'),'as':_0x7d7a('0x12d')});db[_0x7d7a('0xf0')][_0x7d7a('0x121')](db[_0x7d7a('0x75')],{'through':_0x7d7a('0x194'),'as':_0x7d7a('0x1cc')});db[_0x7d7a('0xf0')][_0x7d7a('0x121')](db['FaxQueue'],{'through':'team_has_fax_queues','as':'FaxQueues'});db[_0x7d7a('0xf0')][_0x7d7a('0x121')](db['SmsQueue'],{'through':_0x7d7a('0x1cd'),'as':_0x7d7a('0x1ce')});db[_0x7d7a('0xf0')][_0x7d7a('0x121')](db[_0x7d7a('0x6b')],{'through':_0x7d7a('0x18a'),'as':'OpenchannelQueues'});db['Team'][_0x7d7a('0x121')](db[_0x7d7a('0x10e')],{'through':_0x7d7a('0x1cf'),'as':_0x7d7a('0x131')});db[_0x7d7a('0xf2')][_0x7d7a('0x114')](db['CmHopper'],{'as':'Hoppers','foreignKey':_0x7d7a('0x199')});db[_0x7d7a('0xf2')]['hasMany'](db['CmHopperFinal'],{'as':'HopperFinals','foreignKey':_0x7d7a('0x199')});db[_0x7d7a('0xf2')]['hasMany'](db[_0x7d7a('0x84')],{'as':'HopperHistories','foreignKey':'CampaignId'});db[_0x7d7a('0xf2')][_0x7d7a('0x114')](db[_0x7d7a('0x80')],{'as':_0x7d7a('0x149'),'foreignKey':_0x7d7a('0x199')});db['Campaign'][_0x7d7a('0x14b')](db[_0x7d7a('0x2f')],{'as':_0x7d7a('0x2f'),'foreignKey':_0x7d7a('0x14c')});db[_0x7d7a('0xf2')][_0x7d7a('0x14b')](db[_0x7d7a('0x2f')],{'as':_0x7d7a('0x14d'),'foreignKey':_0x7d7a('0x14e')});db[_0x7d7a('0xf2')]['belongsTo'](db[_0x7d7a('0x8e')],{'as':_0x7d7a('0x8e'),'foreignKey':'IntervalId'});db[_0x7d7a('0xf2')][_0x7d7a('0x14b')](db[_0x7d7a('0xeb')],{'as':_0x7d7a('0xeb'),'foreignKey':'SquareProjectId'});db['Campaign'][_0x7d7a('0x121')](db['CmList'],{'as':'Lists','through':'campaigns_has_cm_lists'});db['Campaign']['belongsToMany'](db['CmList'],{'as':'BlackLists','through':'campaigns_has_cm_blacklists'});db[_0x7d7a('0xf4')][_0x7d7a('0x14b')](db[_0x7d7a('0x73')],{'as':_0x7d7a('0x73'),'foreignKey':'ChatOfflineMessageId'});db[_0x7d7a('0xf7')]['belongsTo'](db[_0x7d7a('0x166')],{});db[_0x7d7a('0xf7')]['belongsTo'](db[_0x7d7a('0x167')],{});db[_0x7d7a('0xf7')]['belongsTo'](db[_0x7d7a('0x44')],{'foreignKey':'FromMailAccountId','as':_0x7d7a('0x1d0')});db[_0x7d7a('0xf7')][_0x7d7a('0x14b')](db[_0x7d7a('0x15')],{'foreignKey':_0x7d7a('0x1d1'),'as':_0x7d7a('0x1d2')});db[_0x7d7a('0xf7')][_0x7d7a('0x14b')](db[_0x7d7a('0x15')],{'foreignKey':_0x7d7a('0x1d3'),'as':_0x7d7a('0x1d4')});db[_0x7d7a('0xf7')][_0x7d7a('0x14b')](db['MailQueue'],{'foreignKey':'ToMailQueueId','as':_0x7d7a('0x1d5')});db[_0x7d7a('0xf7')][_0x7d7a('0x14b')](db[_0x7d7a('0x44')],{'foreignKey':_0x7d7a('0x1d6'),'as':_0x7d7a('0x1d7')});db[_0x7d7a('0xf9')][_0x7d7a('0x14b')](db[_0x7d7a('0x71')],{});db[_0x7d7a('0xf9')]['belongsTo'](db['ChatInteraction'],{});db[_0x7d7a('0xf9')][_0x7d7a('0x14b')](db[_0x7d7a('0x6d')],{'foreignKey':'FromChatWebsiteId','as':_0x7d7a('0x1d0')});db[_0x7d7a('0xf9')][_0x7d7a('0x14b')](db['User'],{'foreignKey':'FromUserId','as':'FromAgent'});db[_0x7d7a('0xf9')][_0x7d7a('0x14b')](db['User'],{'foreignKey':_0x7d7a('0x1d3'),'as':_0x7d7a('0x1d4')});db[_0x7d7a('0xf9')][_0x7d7a('0x14b')](db[_0x7d7a('0x75')],{'foreignKey':_0x7d7a('0x1d8'),'as':_0x7d7a('0x1d5')});db[_0x7d7a('0xf9')][_0x7d7a('0x14b')](db[_0x7d7a('0x6d')],{'foreignKey':_0x7d7a('0x1d9'),'as':_0x7d7a('0x1d7')});db['FaxTransferReport'][_0x7d7a('0x14b')](db[_0x7d7a('0x58')],{});db[_0x7d7a('0x1da')]['belongsTo'](db['FaxInteraction'],{});db[_0x7d7a('0x1da')]['belongsTo'](db[_0x7d7a('0x53')],{'foreignKey':_0x7d7a('0x1db'),'as':'FromAccount'});db[_0x7d7a('0x1da')][_0x7d7a('0x14b')](db[_0x7d7a('0x15')],{'foreignKey':'FromUserId','as':_0x7d7a('0x1d2')});db[_0x7d7a('0x1da')][_0x7d7a('0x14b')](db[_0x7d7a('0x15')],{'foreignKey':'ToUserId','as':_0x7d7a('0x1d4')});db[_0x7d7a('0x1da')][_0x7d7a('0x14b')](db[_0x7d7a('0x17a')],{'foreignKey':'ToFaxQueueId','as':_0x7d7a('0x1d5')});db[_0x7d7a('0x1da')][_0x7d7a('0x14b')](db['FaxAccount'],{'foreignKey':_0x7d7a('0x1dc'),'as':'ToAccount'});db[_0x7d7a('0x1dd')][_0x7d7a('0x14b')](db[_0x7d7a('0x69')],{});db[_0x7d7a('0x1dd')][_0x7d7a('0x14b')](db[_0x7d7a('0x67')],{});db[_0x7d7a('0x1dd')][_0x7d7a('0x14b')](db[_0x7d7a('0x63')],{'foreignKey':_0x7d7a('0x1de'),'as':'FromAccount'});db[_0x7d7a('0x1dd')][_0x7d7a('0x14b')](db['User'],{'foreignKey':_0x7d7a('0x1d1'),'as':_0x7d7a('0x1d2')});db[_0x7d7a('0x1dd')]['belongsTo'](db[_0x7d7a('0x15')],{'foreignKey':_0x7d7a('0x1d3'),'as':'ToAgent'});db[_0x7d7a('0x1dd')][_0x7d7a('0x14b')](db[_0x7d7a('0x6b')],{'foreignKey':'ToOpenchannelQueueId','as':'ToQueue'});db[_0x7d7a('0x1dd')][_0x7d7a('0x14b')](db[_0x7d7a('0x63')],{'foreignKey':_0x7d7a('0x1df'),'as':_0x7d7a('0x1d7')});db[_0x7d7a('0x1e0')][_0x7d7a('0x14b')](db[_0x7d7a('0x60')],{});db[_0x7d7a('0x1e0')]['belongsTo'](db[_0x7d7a('0x5e')],{});db['SmsTransferReport'][_0x7d7a('0x14b')](db['SmsAccount'],{'foreignKey':_0x7d7a('0x1e1'),'as':'FromAccount'});db[_0x7d7a('0x1e0')][_0x7d7a('0x14b')](db[_0x7d7a('0x15')],{'foreignKey':_0x7d7a('0x1d1'),'as':_0x7d7a('0x1d2')});db[_0x7d7a('0x1e0')][_0x7d7a('0x14b')](db[_0x7d7a('0x15')],{'foreignKey':_0x7d7a('0x1d3'),'as':_0x7d7a('0x1d4')});db['SmsTransferReport'][_0x7d7a('0x14b')](db[_0x7d7a('0x12f')],{'foreignKey':_0x7d7a('0x1e2'),'as':'ToQueue'});db[_0x7d7a('0x1e0')][_0x7d7a('0x14b')](db[_0x7d7a('0x5b')],{'foreignKey':_0x7d7a('0x1e3'),'as':_0x7d7a('0x1d7')});db['CmList'][_0x7d7a('0x114')](db['Disposition'],{'as':'Dispositions','foreignKey':_0x7d7a('0x16a')});db[_0x7d7a('0x125')][_0x7d7a('0x114')](db[_0x7d7a('0x87')],{'as':_0x7d7a('0x1e4'),'foreignKey':_0x7d7a('0x16a')});db[_0x7d7a('0x125')][_0x7d7a('0x114')](db['CmContact'],{'as':'Contacts','onDelete':_0x7d7a('0x140'),'foreignKey':'ListId'});db['CmList'][_0x7d7a('0x114')](db[_0x7d7a('0x82')],{'as':_0x7d7a('0x118'),'foreignKey':_0x7d7a('0x16a')});db[_0x7d7a('0x125')][_0x7d7a('0x114')](db['CmHopperHistory'],{'as':_0x7d7a('0x1e5'),'foreignKey':_0x7d7a('0x16a')});db['CmList'][_0x7d7a('0x114')](db[_0x7d7a('0x119')],{'as':_0x7d7a('0x119'),'foreignKey':_0x7d7a('0x16a')});db['CmList'][_0x7d7a('0x121')](db[_0x7d7a('0x1e')],{'as':_0x7d7a('0x1e6'),'through':_0x7d7a('0x152')});db[_0x7d7a('0x125')][_0x7d7a('0x121')](db[_0x7d7a('0x15')],{'as':_0x7d7a('0x153'),'through':'cm_user_has_lists'});db['VoicePrefix']['hasMany'](db[_0x7d7a('0x1a')],{'as':_0x7d7a('0x1a1'),'onDelete':_0x7d7a('0x140')});db['VoicePrefix'][_0x7d7a('0x121')](db[_0x7d7a('0x15')],{'as':'Agents','through':_0x7d7a('0x133')});db[_0x7d7a('0xff')][_0x7d7a('0x114')](db[_0x7d7a('0x15')],{'as':'Users','foreignKey':_0x7d7a('0x120')});db[_0x7d7a('0xff')][_0x7d7a('0x114')](db[_0x7d7a('0x101')],{'as':_0x7d7a('0x1e7'),'foreignKey':_0x7d7a('0x120'),'onDelete':_0x7d7a('0x140')});db['UserProfileSection'][_0x7d7a('0x114')](db[_0x7d7a('0x103')],{'as':_0x7d7a('0x1e8'),'foreignKey':'sectionId','onDelete':'cascade'});db[_0x7d7a('0x107')][_0x7d7a('0x114')](db['Disposition'],{'as':_0x7d7a('0x163'),'foreignKey':_0x7d7a('0x1e9')});db[_0x7d7a('0x107')]['hasMany'](db[_0x7d7a('0x164')],{'as':_0x7d7a('0x165'),'foreignKey':'WhatsappAccountId'});db['WhatsappAccount']['hasMany'](db[_0x7d7a('0x1ea')],{'as':'Messages','foreignKey':_0x7d7a('0x1e9')});db[_0x7d7a('0x107')]['hasMany'](db[_0x7d7a('0x10a')],{'as':_0x7d7a('0x168')});db[_0x7d7a('0x107')][_0x7d7a('0x114')](db[_0x7d7a('0x108')],{'as':'Applications'});db['WhatsappAccount'][_0x7d7a('0x14b')](db[_0x7d7a('0x125')],{'as':'List','foreignKey':_0x7d7a('0x16a')});db['WhatsappAccount'][_0x7d7a('0x14b')](db['Pause'],{'as':_0x7d7a('0x150'),'foreignKey':_0x7d7a('0x16c')});db[_0x7d7a('0x107')][_0x7d7a('0x121')](db['User'],{'as':'Agents','through':_0x7d7a('0x13e')});db[_0x7d7a('0x108')][_0x7d7a('0x14b')](db[_0x7d7a('0x15')],{'onDelete':_0x7d7a('0x176')});db[_0x7d7a('0x108')][_0x7d7a('0x14b')](db[_0x7d7a('0x10e')],{'onDelete':_0x7d7a('0x176')});db[_0x7d7a('0x108')]['belongsTo'](db[_0x7d7a('0x107')],{'onDelete':_0x7d7a('0x176')});db['WhatsappApplication'][_0x7d7a('0x14b')](db[_0x7d7a('0x8e')],{'onDelete':'restrict','foreignKey':'IntervalId'});db[_0x7d7a('0x108')][_0x7d7a('0x14b')](db[_0x7d7a('0x99')],{'onDelete':_0x7d7a('0x176'),'foreignKey':_0x7d7a('0x177')});db[_0x7d7a('0x10a')][_0x7d7a('0x114')](db[_0x7d7a('0x1ea')],{'as':_0x7d7a('0x157'),'onDelete':'cascade','foreignKey':_0x7d7a('0x1eb')});db[_0x7d7a('0x10a')][_0x7d7a('0x14b')](db[_0x7d7a('0x107')],{'as':_0x7d7a('0x16f'),'foreignKey':_0x7d7a('0x1e9')});db[_0x7d7a('0x10a')][_0x7d7a('0x14b')](db[_0x7d7a('0x7c')],{'as':'Contact','foreignKey':_0x7d7a('0x15e')});db[_0x7d7a('0x10a')][_0x7d7a('0x14b')](db['User'],{'as':_0x7d7a('0x170'),'foreignKey':_0x7d7a('0x117')});db['WhatsappInteraction'][_0x7d7a('0x121')](db[_0x7d7a('0x99')],{'through':_0x7d7a('0x1aa'),'as':'Tags'});db[_0x7d7a('0x10a')][_0x7d7a('0x121')](db[_0x7d7a('0x99')],{'through':'whatsapp_interaction_has_tags','as':_0x7d7a('0x173')});db[_0x7d7a('0x10a')][_0x7d7a('0x121')](db[_0x7d7a('0x15')],{'as':_0x7d7a('0x174'),'through':_0x7d7a('0x1ec'),'foreignKey':_0x7d7a('0x1eb')});db['WhatsappMessage'][_0x7d7a('0x14b')](db[_0x7d7a('0x15')],{'as':_0x7d7a('0x15')});db[_0x7d7a('0x1ea')]['belongsTo'](db[_0x7d7a('0x7c')],{'onDelete':'cascade','as':_0x7d7a('0x15d')});db[_0x7d7a('0x1ea')][_0x7d7a('0x14b')](db[_0x7d7a('0x10a')],{'onDelete':_0x7d7a('0x140'),'as':'Interaction','foreignKey':_0x7d7a('0x1eb')});db['WhatsappMessage']['belongsTo'](db[_0x7d7a('0x107')],{'as':_0x7d7a('0x16f'),'foreignKey':'WhatsappAccountId'});db[_0x7d7a('0x10b')][_0x7d7a('0x14b')](db[_0x7d7a('0x107')],{});db[_0x7d7a('0x10b')][_0x7d7a('0x14b')](db[_0x7d7a('0x125')],{'as':_0x7d7a('0x169'),'foreignKey':_0x7d7a('0x16a')});db['WhatsappQueueReport'][_0x7d7a('0x14b')](db[_0x7d7a('0x7c')],{'as':_0x7d7a('0x15d'),'foreignKey':'ContactId'});db[_0x7d7a('0x10b')][_0x7d7a('0x14b')](db[_0x7d7a('0x10a')],{});db[_0x7d7a('0x10b')][_0x7d7a('0x14b')](db[_0x7d7a('0x10e')],{});db[_0x7d7a('0x10b')]['belongsTo'](db[_0x7d7a('0x1ea')],{});db[_0x7d7a('0x10b')][_0x7d7a('0x14b')](db[_0x7d7a('0x15')],{});db[_0x7d7a('0x10d')][_0x7d7a('0x14b')](db[_0x7d7a('0x1ea')],{});db[_0x7d7a('0x10d')][_0x7d7a('0x14b')](db[_0x7d7a('0x10a')],{});db[_0x7d7a('0x10d')][_0x7d7a('0x14b')](db[_0x7d7a('0x107')],{'foreignKey':_0x7d7a('0x1ed'),'as':_0x7d7a('0x1d0')});db[_0x7d7a('0x10d')]['belongsTo'](db[_0x7d7a('0x107')],{'foreignKey':_0x7d7a('0x1ee'),'as':_0x7d7a('0x1d7')});db[_0x7d7a('0x10d')]['belongsTo'](db['WhatsappQueue'],{'foreignKey':_0x7d7a('0x1ef'),'as':_0x7d7a('0x1d5')});db[_0x7d7a('0x10d')][_0x7d7a('0x14b')](db[_0x7d7a('0x15')],{'foreignKey':_0x7d7a('0x1d1'),'as':'FromAgent'});db['WhatsappTransferReport'][_0x7d7a('0x14b')](db[_0x7d7a('0x15')],{'foreignKey':_0x7d7a('0x1d3'),'as':'ToAgent'});db[_0x7d7a('0x10e')][_0x7d7a('0x121')](db[_0x7d7a('0x15')],{'as':_0x7d7a('0x153'),'through':'UserWhatsappQueue','foreignKey':'WhatsappQueueId'});db[_0x7d7a('0x10e')][_0x7d7a('0x121')](db[_0x7d7a('0xf0')],{'through':_0x7d7a('0x1cf'),'as':'Teams'});module[_0x7d7a('0x1f0')]={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index 538f7fa..0107570 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0b1e=['./api/condition','/api/pauses','/api/sounds','./api/sound','/api/templates','./api/template','./api/trigger','/api/variables','./api/variable','./api/integration','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticExtractedReport','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','/api/integrations/salesforce/fields','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','/api/integrations/desk/accounts','./api/intDeskAccount','./api/intDeskConfiguration','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zoho/fields','/api/integrations/zendesk/accounts','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','./api/intZendeskField','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','/api/integrations/vtiger/accounts','./api/intVtigerConfiguration','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/network','/api/chat/reports/queue','/api/chat/internal/messages','./api/chatInternalMessage','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','./api/smsQueueReport','/api/square/reports','./api/squareReport','/api/square/details/reports','/api/jscripty/projects','/api/settings','./api/setting','/api/square/odbc','./api/squareOdbc','./api/squareProject','/api/square/recordings','./api/squareRecording','/api/square/messages','./api/squareMessage','/api/teams','./api/team','/api/license','/api/campaigns','./api/campaign','/api/attachments','/api/plugins','./api/plugin','/api/mail/reports/transfer','./api/chatTransferReport','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfile','/api/userProfile/sections','/api/userProfile/resources','./api/userProfileResource','/api/whatsapp/accounts','/api/whatsapp/applications','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','/api/auth/local','./api/authLocal','/api/auth/google','./api/authGoogle','/api/jira','./api/jira','/api/rpc','./api/version','/api/system','./api/system','/api/pm2','./api/pm2','./api/webbar','/apidoc','join','root','/www','/demo','/snippet','static','3.0.0','/plugins','/server/files/plugins','route','get','sendFile','resolve','appPath','/index.html','username','password','newPassword','firstName','lastName','street','mobile','email','clientId','clientSecret','securityToken','code','accessKey','tenantId','channelSecret','accessToken','accessTokenSecret','consumerKey','consumerSecret','membername','calleridnum','exten','privateKey','accesskeyid','secretaccesskey','pass','localstationid','secret','registry','oldPassword','isPlainObject','isString','@@{','replace','lodash','path','express','express-winston','util','./errors','./config/logger','api','default','use','logger','isEmpty','\x20body=%s','body','format','method','headers','x-forwarded-for','connection','url','statusCode','responseTime','user','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)','name','other','agent_id','agent_name','test','/api/users','./api/user','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','./api/memberReport','/api/trunks','./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/mailInteraction','./api/mailMessage','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','./api/dashboard','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','/api/fax/applications','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','./api/faxQueue','/api/fax/reports/queue','/api/sms/accounts','./api/smsAccount','/api/sms/applications','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','./api/smsMessage','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelInteraction','./api/openchannelMessage','/api/openchannel/queues','./api/openchannelQueue','/api/chat/websites','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/applications','/api/chat/interactions','./api/chatInteraction','./api/chatMessage','./api/chatQueue','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','/api/cm/contacts','./api/cmContact','/api/cm/hopper','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','./api/cmCustomField','/api/actions','./api/action','/api/automations','./api/automation','/api/canned_answers','./api/cannedAnswer','/api/dispositions','./api/disposition','/api/conditions'];(function(_0x2f91bc,_0x2382d8){var _0x63c4c=function(_0x4b61ac){while(--_0x4b61ac){_0x2f91bc['push'](_0x2f91bc['shift']());}};_0x63c4c(++_0x2382d8);}(_0x0b1e,0x1ef));var _0xe0b1=function(_0x17bb31,_0x2fc6f8){_0x17bb31=_0x17bb31-0x0;var _0x505c71=_0x0b1e[_0x17bb31];return _0x505c71;};'use strict';var _=require(_0xe0b1('0x0'));var path=require(_0xe0b1('0x1'));var express=require(_0xe0b1('0x2'));var ewinston=require(_0xe0b1('0x3'));var util=require(_0xe0b1('0x4'));var errors=require(_0xe0b1('0x5'));var config=require('./config/environment');var logger=require(_0xe0b1('0x6'))(_0xe0b1('0x7'));var authLogger=require(_0xe0b1('0x6'))('auth');exports[_0xe0b1('0x8')]=function(_0x5299f5){_0x5299f5[_0xe0b1('0x9')](ewinston[_0xe0b1('0xa')]({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x4e4275,_0x5c466f){var _0x5a592f='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s';if(!_[_0xe0b1('0xb')](_0x4e4275['body'])){_0x5a592f+=_0xe0b1('0xc');var _0x22176f=_0x4e4275[_0xe0b1('0xd')];maskSensitiveData(_0x22176f);}return util[_0xe0b1('0xe')](_0x5a592f,_0x4e4275[_0xe0b1('0xf')],_0x4e4275[_0xe0b1('0x10')]['x-forwarded-for']?_0x4e4275[_0xe0b1('0x10')][_0xe0b1('0x11')]:_0x4e4275[_0xe0b1('0x12')]['remoteAddress']||_0x4e4275['ip'],_0x4e4275[_0xe0b1('0x13')],_0x5c466f[_0xe0b1('0x14')],_0x5c466f[_0xe0b1('0x15')],_0x4e4275[_0xe0b1('0x16')]?_0x4e4275['user']['id']:null,_0x4e4275['user']?_0x4e4275['user']['name']:null,_0x4e4275[_0xe0b1('0x16')]?_0x4e4275[_0xe0b1('0x16')][_0xe0b1('0x17')]:null,_0x22176f?util[_0xe0b1('0x18')](_0x22176f,![],null):'');}}));_0x5299f5[_0xe0b1('0x9')](ewinston[_0xe0b1('0xa')]({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x225f55,_0x1ce086){var _0x55ba5f=_0xe0b1('0x19');if(_0x225f55['body']&&_0x225f55[_0xe0b1('0xd')][_0xe0b1('0x1a')]&&_0x225f55[_0xe0b1('0xd')]['agent_id']){_0x55ba5f=_0xe0b1('0x1b');}return util['format'](_0x55ba5f,_0x225f55[_0xe0b1('0xf')],_0x225f55['headers']['x-forwarded-for']?_0x225f55[_0xe0b1('0x10')][_0xe0b1('0x11')]:_0x225f55[_0xe0b1('0x12')]['remoteAddress']||_0x225f55['ip'],_0x225f55[_0xe0b1('0x13')],_0x1ce086[_0xe0b1('0x14')],_0x1ce086[_0xe0b1('0x15')],_0x225f55[_0xe0b1('0x16')]?_0x225f55[_0xe0b1('0x16')]['id']:null,_0x225f55[_0xe0b1('0x16')]?_0x225f55[_0xe0b1('0x16')][_0xe0b1('0x1c')]:null,_0x225f55[_0xe0b1('0x16')]?_0x225f55[_0xe0b1('0x16')][_0xe0b1('0x17')]:null,_0x225f55[_0xe0b1('0xd')]&&_0x225f55[_0xe0b1('0xd')]['device']?_0x225f55[_0xe0b1('0xd')][_0xe0b1('0x1a')]:_0xe0b1('0x1d'),_0x225f55[_0xe0b1('0xd')]&&_0x225f55[_0xe0b1('0xd')][_0xe0b1('0x1e')]?_0x225f55['body'][_0xe0b1('0x1e')]:'',_0x225f55[_0xe0b1('0xd')]&&_0x225f55[_0xe0b1('0xd')][_0xe0b1('0x1f')]?_0x225f55[_0xe0b1('0xd')][_0xe0b1('0x1f')]:'');},'ignoreRoute':function(_0x2c5c4d){var _0x8bdf34=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x8bdf34[_0xe0b1('0x20')](_0x2c5c4d['url']);}}));_0x5299f5[_0xe0b1('0x9')](_0xe0b1('0x21'),require(_0xe0b1('0x22')));_0x5299f5['use']('/api/voice/chanspy',require(_0xe0b1('0x23')));_0x5299f5[_0xe0b1('0x9')](_0xe0b1('0x24'),require(_0xe0b1('0x25')));_0x5299f5[_0xe0b1('0x9')](_0xe0b1('0x26'),require(_0xe0b1('0x27')));_0x5299f5[_0xe0b1('0x9')](_0xe0b1('0x28'),require(_0xe0b1('0x29')));_0x5299f5[_0xe0b1('0x9')](_0xe0b1('0x2a'),require(_0xe0b1('0x2b')));_0x5299f5[_0xe0b1('0x9')](_0xe0b1('0x2c'),require(_0xe0b1('0x2d')));_0x5299f5[_0xe0b1('0x9')](_0xe0b1('0x2e'),require('./api/screenRecording'));_0x5299f5[_0xe0b1('0x9')](_0xe0b1('0x2f'),require(_0xe0b1('0x30')));_0x5299f5[_0xe0b1('0x9')](_0xe0b1('0x31'),require(_0xe0b1('0x32')));_0x5299f5[_0xe0b1('0x9')](_0xe0b1('0x33'),require(_0xe0b1('0x34')));_0x5299f5['use'](_0xe0b1('0x35'),require(_0xe0b1('0x36')));_0x5299f5[_0xe0b1('0x9')]('/api/voice/agents/reports',require(_0xe0b1('0x37')));_0x5299f5[_0xe0b1('0x9')](_0xe0b1('0x38'),require(_0xe0b1('0x39')));_0x5299f5[_0xe0b1('0x9')](_0xe0b1('0x3a'),require(_0xe0b1('0x3b')));_0x5299f5[_0xe0b1('0x9')](_0xe0b1('0x3c'),require(_0xe0b1('0x3d')));_0x5299f5[_0xe0b1('0x9')](_0xe0b1('0x3e'),require(_0xe0b1('0x3f')));_0x5299f5[_0xe0b1('0x9')](_0xe0b1('0x40'),require(_0xe0b1('0x41')));_0x5299f5[_0xe0b1('0x9')](_0xe0b1('0x42'),require(_0xe0b1('0x43')));_0x5299f5[_0xe0b1('0x9')](_0xe0b1('0x44'),require(_0xe0b1('0x45')));_0x5299f5[_0xe0b1('0x9')](_0xe0b1('0x46'),require(_0xe0b1('0x47')));_0x5299f5[_0xe0b1('0x9')](_0xe0b1('0x48'),require(_0xe0b1('0x49')));_0x5299f5[_0xe0b1('0x9')]('/api/mail/messages',require(_0xe0b1('0x4a')));_0x5299f5[_0xe0b1('0x9')](_0xe0b1('0x4b'),require(_0xe0b1('0x4c')));_0x5299f5[_0xe0b1('0x9')](_0xe0b1('0x4d'),require(_0xe0b1('0x4e')));_0x5299f5[_0xe0b1('0x9')]('/api/dashboards',require(_0xe0b1('0x4f')));_0x5299f5['use'](_0xe0b1('0x50'),require(_0xe0b1('0x51')));_0x5299f5['use'](_0xe0b1('0x52'),require(_0xe0b1('0x53')));_0x5299f5[_0xe0b1('0x9')](_0xe0b1('0x54'),require(_0xe0b1('0x55')));_0x5299f5[_0xe0b1('0x9')](_0xe0b1('0x56'),require(_0xe0b1('0x57')));_0x5299f5['use']('/api/fax/messages',require('./api/faxMessage'));_0x5299f5['use']('/api/fax/queues',require(_0xe0b1('0x58')));_0x5299f5['use'](_0xe0b1('0x59'),require('./api/faxQueueReport'));_0x5299f5['use'](_0xe0b1('0x5a'),require(_0xe0b1('0x5b')));_0x5299f5[_0xe0b1('0x9')](_0xe0b1('0x5c'),require(_0xe0b1('0x5d')));_0x5299f5['use'](_0xe0b1('0x5e'),require(_0xe0b1('0x5f')));_0x5299f5[_0xe0b1('0x9')](_0xe0b1('0x60'),require(_0xe0b1('0x61')));_0x5299f5[_0xe0b1('0x9')](_0xe0b1('0x62'),require(_0xe0b1('0x63')));_0x5299f5['use'](_0xe0b1('0x64'),require(_0xe0b1('0x65')));_0x5299f5['use'](_0xe0b1('0x66'),require('./api/openchannelApplication'));_0x5299f5[_0xe0b1('0x9')]('/api/openchannel/interactions',require(_0xe0b1('0x67')));_0x5299f5['use']('/api/openchannel/messages',require(_0xe0b1('0x68')));_0x5299f5[_0xe0b1('0x9')](_0xe0b1('0x69'),require(_0xe0b1('0x6a')));_0x5299f5[_0xe0b1('0x9')](_0xe0b1('0x6b'),require('./api/chatWebsite'));_0x5299f5['use'](_0xe0b1('0x6c'),require(_0xe0b1('0x6d')));_0x5299f5['use'](_0xe0b1('0x6e'),require('./api/chatApplication'));_0x5299f5[_0xe0b1('0x9')](_0xe0b1('0x6f'),require(_0xe0b1('0x70')));_0x5299f5[_0xe0b1('0x9')]('/api/chat/messages',require(_0xe0b1('0x71')));_0x5299f5[_0xe0b1('0x9')]('/api/chat/offline_messages',require('./api/chatOfflineMessage'));_0x5299f5[_0xe0b1('0x9')]('/api/chat/queues',require(_0xe0b1('0x72')));_0x5299f5[_0xe0b1('0x9')](_0xe0b1('0x73'),require(_0xe0b1('0x74')));_0x5299f5[_0xe0b1('0x9')](_0xe0b1('0x75'),require(_0xe0b1('0x76')));_0x5299f5[_0xe0b1('0x9')](_0xe0b1('0x77'),require(_0xe0b1('0x78')));_0x5299f5[_0xe0b1('0x9')](_0xe0b1('0x79'),require(_0xe0b1('0x7a')));_0x5299f5[_0xe0b1('0x9')](_0xe0b1('0x7b'),require(_0xe0b1('0x7c')));_0x5299f5[_0xe0b1('0x9')](_0xe0b1('0x7d'),require(_0xe0b1('0x7e')));_0x5299f5[_0xe0b1('0x9')](_0xe0b1('0x7f'),require('./api/cmHopperFinal'));_0x5299f5[_0xe0b1('0x9')](_0xe0b1('0x80'),require(_0xe0b1('0x81')));_0x5299f5[_0xe0b1('0x9')](_0xe0b1('0x82'),require(_0xe0b1('0x83')));_0x5299f5[_0xe0b1('0x9')](_0xe0b1('0x84'),require(_0xe0b1('0x85')));_0x5299f5[_0xe0b1('0x9')](_0xe0b1('0x86'),require(_0xe0b1('0x87')));_0x5299f5['use'](_0xe0b1('0x88'),require(_0xe0b1('0x89')));_0x5299f5[_0xe0b1('0x9')](_0xe0b1('0x8a'),require(_0xe0b1('0x8b')));_0x5299f5[_0xe0b1('0x9')](_0xe0b1('0x8c'),require(_0xe0b1('0x8d')));_0x5299f5[_0xe0b1('0x9')]('/api/intervals',require('./api/interval'));_0x5299f5[_0xe0b1('0x9')](_0xe0b1('0x8e'),require('./api/pause'));_0x5299f5[_0xe0b1('0x9')]('/api/cdr',require('./api/cdr'));_0x5299f5[_0xe0b1('0x9')]('/api/voiceQueuesLog',require('./api/voiceQueuesLog'));_0x5299f5[_0xe0b1('0x9')]('/api/schedules',require('./api/schedule'));_0x5299f5[_0xe0b1('0x9')](_0xe0b1('0x8f'),require(_0xe0b1('0x90')));_0x5299f5['use']('/api/tags',require('./api/tag'));_0x5299f5[_0xe0b1('0x9')](_0xe0b1('0x91'),require(_0xe0b1('0x92')));_0x5299f5[_0xe0b1('0x9')]('/api/triggers',require(_0xe0b1('0x93')));_0x5299f5[_0xe0b1('0x9')](_0xe0b1('0x94'),require(_0xe0b1('0x95')));_0x5299f5['use']('/api/integrations',require(_0xe0b1('0x96')));_0x5299f5[_0xe0b1('0x9')](_0xe0b1('0x97'),require(_0xe0b1('0x98')));_0x5299f5['use'](_0xe0b1('0x99'),require(_0xe0b1('0x9a')));_0x5299f5[_0xe0b1('0x9')](_0xe0b1('0x9b'),require('./api/analyticDefaultReport'));_0x5299f5['use']('/api/analytics/extracted_reports',require(_0xe0b1('0x9c')));_0x5299f5[_0xe0b1('0x9')]('/api/analytics/metrics',require('./api/analyticMetric'));_0x5299f5[_0xe0b1('0x9')]('/api/analytics/field_reports',require(_0xe0b1('0x9d')));_0x5299f5[_0xe0b1('0x9')](_0xe0b1('0x9e'),require(_0xe0b1('0x9f')));_0x5299f5[_0xe0b1('0x9')]('/api/integrations/salesforce/accounts',require(_0xe0b1('0xa0')));_0x5299f5[_0xe0b1('0x9')](_0xe0b1('0xa1'),require('./api/intSalesforceConfiguration'));_0x5299f5[_0xe0b1('0x9')](_0xe0b1('0xa2'),require('./api/intSalesforceField'));_0x5299f5['use'](_0xe0b1('0xa3'),require(_0xe0b1('0xa4')));_0x5299f5[_0xe0b1('0x9')]('/api/integrations/sugarcrm/configurations',require(_0xe0b1('0xa5')));_0x5299f5[_0xe0b1('0x9')](_0xe0b1('0xa6'),require('./api/intSugarcrmField'));_0x5299f5[_0xe0b1('0x9')](_0xe0b1('0xa7'),require(_0xe0b1('0xa8')));_0x5299f5[_0xe0b1('0x9')]('/api/integrations/desk/configurations',require(_0xe0b1('0xa9')));_0x5299f5[_0xe0b1('0x9')]('/api/integrations/desk/fields',require(_0xe0b1('0xaa')));_0x5299f5[_0xe0b1('0x9')](_0xe0b1('0xab'),require(_0xe0b1('0xac')));_0x5299f5[_0xe0b1('0x9')](_0xe0b1('0xad'),require(_0xe0b1('0xae')));_0x5299f5[_0xe0b1('0x9')](_0xe0b1('0xaf'),require('./api/intZohoField'));_0x5299f5[_0xe0b1('0x9')](_0xe0b1('0xb0'),require('./api/intZendeskAccount'));_0x5299f5[_0xe0b1('0x9')](_0xe0b1('0xb1'),require(_0xe0b1('0xb2')));_0x5299f5[_0xe0b1('0x9')]('/api/integrations/zendesk/fields',require(_0xe0b1('0xb3')));_0x5299f5[_0xe0b1('0x9')]('/api/integrations/freshdesk/accounts',require('./api/intFreshdeskAccount'));_0x5299f5[_0xe0b1('0x9')](_0xe0b1('0xb4'),require(_0xe0b1('0xb5')));_0x5299f5[_0xe0b1('0x9')](_0xe0b1('0xb6'),require('./api/intFreshdeskField'));_0x5299f5['use'](_0xe0b1('0xb7'),require('./api/intVtigerAccount'));_0x5299f5[_0xe0b1('0x9')]('/api/integrations/vtiger/configurations',require(_0xe0b1('0xb8')));_0x5299f5['use']('/api/integrations/vtiger/fields',require(_0xe0b1('0xb9')));_0x5299f5['use'](_0xe0b1('0xba'),require(_0xe0b1('0xbb')));_0x5299f5[_0xe0b1('0x9')](_0xe0b1('0xbc'),require(_0xe0b1('0xbd')));_0x5299f5[_0xe0b1('0x9')](_0xe0b1('0xbe'),require(_0xe0b1('0xbf')));_0x5299f5[_0xe0b1('0x9')]('/api/integrations/dynamics365/accounts',require('./api/intDynamics365Account'));_0x5299f5['use'](_0xe0b1('0xc0'),require(_0xe0b1('0xc1')));_0x5299f5['use'](_0xe0b1('0xc2'),require('./api/intDynamics365Field'));_0x5299f5[_0xe0b1('0x9')](_0xe0b1('0xc3'),require(_0xe0b1('0xc4')));_0x5299f5[_0xe0b1('0x9')]('/api/integrations/freshsales/configurations',require(_0xe0b1('0xc5')));_0x5299f5[_0xe0b1('0x9')](_0xe0b1('0xc6'),require('./api/intFreshsalesField'));_0x5299f5['use']('/api/networks',require(_0xe0b1('0xc7')));_0x5299f5[_0xe0b1('0x9')](_0xe0b1('0xc8'),require('./api/chatQueueReport'));_0x5299f5[_0xe0b1('0x9')](_0xe0b1('0xc9'),require(_0xe0b1('0xca')));_0x5299f5[_0xe0b1('0x9')]('/api/jscripty/answers/reports',require(_0xe0b1('0xcb')));_0x5299f5[_0xe0b1('0x9')](_0xe0b1('0xcc'),require(_0xe0b1('0xcd')));_0x5299f5[_0xe0b1('0x9')](_0xe0b1('0xce'),require(_0xe0b1('0xcf')));_0x5299f5['use']('/api/sms/reports/queue',require(_0xe0b1('0xd0')));_0x5299f5[_0xe0b1('0x9')](_0xe0b1('0xd1'),require(_0xe0b1('0xd2')));_0x5299f5[_0xe0b1('0x9')](_0xe0b1('0xd3'),require('./api/squareReportDetail'));_0x5299f5[_0xe0b1('0x9')](_0xe0b1('0xd4'),require('./api/jscriptyProject'));_0x5299f5[_0xe0b1('0x9')](_0xe0b1('0xd5'),require(_0xe0b1('0xd6')));_0x5299f5[_0xe0b1('0x9')](_0xe0b1('0xd7'),require(_0xe0b1('0xd8')));_0x5299f5[_0xe0b1('0x9')]('/api/square/projects',require(_0xe0b1('0xd9')));_0x5299f5[_0xe0b1('0x9')](_0xe0b1('0xda'),require(_0xe0b1('0xdb')));_0x5299f5[_0xe0b1('0x9')](_0xe0b1('0xdc'),require(_0xe0b1('0xdd')));_0x5299f5['use'](_0xe0b1('0xde'),require(_0xe0b1('0xdf')));_0x5299f5[_0xe0b1('0x9')](_0xe0b1('0xe0'),require('./api/license'));_0x5299f5[_0xe0b1('0x9')](_0xe0b1('0xe1'),require(_0xe0b1('0xe2')));_0x5299f5[_0xe0b1('0x9')]('/api/migrations',require('./api/migration'));_0x5299f5[_0xe0b1('0x9')](_0xe0b1('0xe3'),require('./api/attachment'));_0x5299f5[_0xe0b1('0x9')](_0xe0b1('0xe4'),require(_0xe0b1('0xe5')));_0x5299f5[_0xe0b1('0x9')](_0xe0b1('0xe6'),require('./api/mailTransferReport'));_0x5299f5['use']('/api/chat/reports/transfer',require(_0xe0b1('0xe7')));_0x5299f5[_0xe0b1('0x9')]('/api/fax/reports/transfer',require(_0xe0b1('0xe8')));_0x5299f5[_0xe0b1('0x9')](_0xe0b1('0xe9'),require(_0xe0b1('0xea')));_0x5299f5[_0xe0b1('0x9')](_0xe0b1('0xeb'),require(_0xe0b1('0xec')));_0x5299f5[_0xe0b1('0x9')](_0xe0b1('0xed'),require('./api/cmList'));_0x5299f5['use'](_0xe0b1('0xee'),require(_0xe0b1('0xef')));_0x5299f5[_0xe0b1('0x9')](_0xe0b1('0xf0'),require(_0xe0b1('0xf1')));_0x5299f5['use'](_0xe0b1('0xf2'),require('./api/userProfileSection'));_0x5299f5[_0xe0b1('0x9')](_0xe0b1('0xf3'),require(_0xe0b1('0xf4')));_0x5299f5[_0xe0b1('0x9')]('/api/userNotifications',require('./api/userNotification'));_0x5299f5[_0xe0b1('0x9')](_0xe0b1('0xf5'),require('./api/whatsappAccount'));_0x5299f5[_0xe0b1('0x9')](_0xe0b1('0xf6'),require('./api/whatsappApplication'));_0x5299f5[_0xe0b1('0x9')](_0xe0b1('0xf7'),require(_0xe0b1('0xf8')));_0x5299f5['use']('/api/whatsapp/messages',require('./api/whatsappMessage'));_0x5299f5[_0xe0b1('0x9')](_0xe0b1('0xf9'),require(_0xe0b1('0xfa')));_0x5299f5[_0xe0b1('0x9')](_0xe0b1('0xfb'),require('./api/whatsappTransferReport'));_0x5299f5['use'](_0xe0b1('0xfc'),require(_0xe0b1('0xfd')));_0x5299f5[_0xe0b1('0x9')](_0xe0b1('0xfe'),require('./api/cloudProvider'));_0x5299f5[_0xe0b1('0x9')](_0xe0b1('0xff'),require(_0xe0b1('0x100')));_0x5299f5['use'](_0xe0b1('0x101'),require(_0xe0b1('0x102')));_0x5299f5[_0xe0b1('0x9')](_0xe0b1('0x103'),require(_0xe0b1('0x104')));_0x5299f5[_0xe0b1('0x9')](_0xe0b1('0x105'),require('./api/rpc'));_0x5299f5[_0xe0b1('0x9')]('/api/version',require(_0xe0b1('0x106')));_0x5299f5['use'](_0xe0b1('0x107'),require(_0xe0b1('0x108')));_0x5299f5[_0xe0b1('0x9')](_0xe0b1('0x109'),require(_0xe0b1('0x10a')));_0x5299f5['use']('/api/webbar',require(_0xe0b1('0x10b')));_0x5299f5[_0xe0b1('0x9')](_0xe0b1('0x10c'),express['static'](path[_0xe0b1('0x10d')](config[_0xe0b1('0x10e')],'/apidoc')));_0x5299f5[_0xe0b1('0x9')](_0xe0b1('0x10f'),express['static'](path[_0xe0b1('0x10d')](config[_0xe0b1('0x10e')],'/www')));_0x5299f5[_0xe0b1('0x9')](_0xe0b1('0x110'),express['static'](path[_0xe0b1('0x10d')](config['root'],_0xe0b1('0x110'))));_0x5299f5['use'](_0xe0b1('0x111'),express[_0xe0b1('0x112')](path['join'](config[_0xe0b1('0x10e')],'snippet',_0xe0b1('0x113'))));_0x5299f5[_0xe0b1('0x9')](_0xe0b1('0x114'),express[_0xe0b1('0x112')](path[_0xe0b1('0x10d')](config[_0xe0b1('0x10e')],_0xe0b1('0x115'))));_0x5299f5[_0xe0b1('0x116')]('/:url(api|auth|components|app|bower_components|assets)/*')[_0xe0b1('0x117')](errors[0x194]);_0x5299f5[_0xe0b1('0x116')]('/*')['get'](function(_0x1ec11b,_0x5df8cd){_0x5df8cd[_0xe0b1('0x118')](path[_0xe0b1('0x119')](_0x5299f5[_0xe0b1('0x117')](_0xe0b1('0x11a'))+_0xe0b1('0x11b')));});};var sensitiveFields=[_0xe0b1('0x11c'),_0xe0b1('0x11d'),_0xe0b1('0x11e'),'apiKey',_0xe0b1('0x11f'),_0xe0b1('0x120'),_0xe0b1('0x121'),'phone',_0xe0b1('0x122'),'fax',_0xe0b1('0x123'),_0xe0b1('0x124'),_0xe0b1('0x125'),_0xe0b1('0x126'),_0xe0b1('0x127'),_0xe0b1('0x128'),_0xe0b1('0x129'),'token',_0xe0b1('0x12a'),_0xe0b1('0x12b'),_0xe0b1('0x12c'),'authToken',_0xe0b1('0x12d'),_0xe0b1('0x12e'),_0xe0b1('0x12f'),'calleridname',_0xe0b1('0x130'),_0xe0b1('0x131'),'vidaooApiKey','clientEmail',_0xe0b1('0x132'),_0xe0b1('0x133'),_0xe0b1('0x134'),'key',_0xe0b1('0x16'),_0xe0b1('0x135'),'accountSid',_0xe0b1('0x136'),'dsn',_0xe0b1('0x137'),_0xe0b1('0x138'),_0xe0b1('0x139')];function maskSensitiveData(_0x15f14f){var _0x263831=/(?!^)[\s\S](?!$)/g;if(!_[_0xe0b1('0x13a')](_0x15f14f))return;for(var _0x1bdf61 in _0x15f14f){if(_['isArray'](_0x15f14f[_0x1bdf61])){for(var _0x5f2883=0x0;_0x5f2883<_0x15f14f[_0x1bdf61]['length'];_0x5f2883++){maskSensitiveData(_0x15f14f[_0x1bdf61][_0x5f2883]);}}else if(_[_0xe0b1('0x13a')](_0x15f14f[_0x1bdf61])){maskSensitiveData(_0x15f14f[_0x1bdf61]);}else if(_[_0xe0b1('0x13b')](_0x15f14f[_0x1bdf61])){_0x15f14f[_0x1bdf61]=_0x15f14f[_0x1bdf61]['replace'](/{{{/g,_0xe0b1('0x13c'))[_0xe0b1('0x13d')](/}}}/g,'}@@')['replace'](/{{/g,'@{')[_0xe0b1('0x13d')](/}}/g,'}@');if(_['includes'](sensitiveFields,_0x1bdf61)){_0x15f14f[_0x1bdf61]=_0x15f14f[_0x1bdf61][_0xe0b1('0x13d')](_0x263831,'*');}}}} \ No newline at end of file +var _0x3acd=['/api/square/recordings','./api/squareRecording','/api/square/messages','./api/squareMessage','/api/teams','./api/team','/api/license','./api/license','/api/campaigns','/api/migrations','./api/migration','/api/attachments','/api/plugins','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','./api/cmList','./api/voicePrefix','/api/userProfiles','./api/userProfile','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/userNotifications','./api/userNotification','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','/api/auth/google','/api/jira','./api/jira','/api/version','./api/version','/api/pm2','/api/webbar','join','root','/apidoc','/www','static','/demo','/snippet','snippet','3.0.0','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','resolve','/index.html','password','newPassword','apiKey','firstName','street','phone','mobile','fax','email','clientId','code','accessKey','tenantId','token','accessToken','authToken','consumerKey','consumerSecret','membername','calleridname','calleridnum','vidaooApiKey','clientEmail','privateKey','secretaccesskey','key','pass','accountSid','localstationid','dsn','oldPassword','isArray','isString','@@{','replace','}@@','includes','lodash','path','express','express-winston','./errors','./config/environment','./config/logger','api','auth','default','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','\x20body=%s','body','format','headers','x-forwarded-for','connection','remoteAddress','url','statusCode','user','role','inspect','use','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','method','responseTime','device','other','agent_id','agent_name','/api/users','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','/api/voice/recordings','/api/screen/recordings','./api/screenRecording','/api/voice/mails','./api/voiceMail','./api/voiceMailMessage','/api/voice/calls/reports','/api/voice/dials/reports','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','/api/trunks','/api/mail/out_servers','./api/mailServerOut','/api/mail/accounts','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','/api/mail/messages','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','./api/dashboard','/api/fax/accounts','./api/faxAccount','/api/fax/applications','./api/faxApplication','./api/faxInteraction','/api/fax/messages','./api/faxMessage','/api/fax/queues','./api/faxQueue','./api/smsAccount','/api/sms/applications','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','./api/smsMessage','./api/openchannelAccount','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelMessage','/api/openchannel/queues','/api/chat/websites','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','/api/chat/groups','./api/chatGroup','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','/api/cm/contacts','./api/cmContact','./api/cmHopper','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','./api/cmCustomField','/api/actions','/api/automations','./api/automation','/api/canned_answers','./api/cannedAnswer','/api/dispositions','./api/disposition','/api/conditions','/api/intervals','./api/interval','./api/pause','./api/cdr','./api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','/api/tags','./api/template','/api/triggers','./api/trigger','/api/variables','./api/variable','/api/integrations/reports','./api/integrationReport','./api/analyticCustomReport','/api/analytics/default_reports','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','./api/intZohoField','./api/intZendeskAccount','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intVtigerAccount','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/fields','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','./api/intDynamics365Field','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','./api/network','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','/api/settings','/api/square/odbc','./api/squareOdbc','/api/square/projects','./api/squareProject'];(function(_0xce69e7,_0x1b4ae4){var _0x265924=function(_0x350f8d){while(--_0x350f8d){_0xce69e7['push'](_0xce69e7['shift']());}};_0x265924(++_0x1b4ae4);}(_0x3acd,0x69));var _0xd3ac=function(_0x46b8c3,_0x4846b2){_0x46b8c3=_0x46b8c3-0x0;var _0x46c220=_0x3acd[_0x46b8c3];return _0x46c220;};'use strict';var _=require(_0xd3ac('0x0'));var path=require(_0xd3ac('0x1'));var express=require(_0xd3ac('0x2'));var ewinston=require(_0xd3ac('0x3'));var util=require('util');var errors=require(_0xd3ac('0x4'));var config=require(_0xd3ac('0x5'));var logger=require(_0xd3ac('0x6'))(_0xd3ac('0x7'));var authLogger=require(_0xd3ac('0x6'))(_0xd3ac('0x8'));exports[_0xd3ac('0x9')]=function(_0x2c7a09){_0x2c7a09['use'](ewinston[_0xd3ac('0xa')]({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x481db0,_0x840ef){var _0x124e1d=_0xd3ac('0xb');if(!_['isEmpty'](_0x481db0['body'])){_0x124e1d+=_0xd3ac('0xc');var _0x24ae54=_0x481db0[_0xd3ac('0xd')];maskSensitiveData(_0x24ae54);}return util[_0xd3ac('0xe')](_0x124e1d,_0x481db0['method'],_0x481db0[_0xd3ac('0xf')][_0xd3ac('0x10')]?_0x481db0[_0xd3ac('0xf')][_0xd3ac('0x10')]:_0x481db0[_0xd3ac('0x11')][_0xd3ac('0x12')]||_0x481db0['ip'],_0x481db0[_0xd3ac('0x13')],_0x840ef[_0xd3ac('0x14')],_0x840ef['responseTime'],_0x481db0['user']?_0x481db0['user']['id']:null,_0x481db0[_0xd3ac('0x15')]?_0x481db0['user']['name']:null,_0x481db0[_0xd3ac('0x15')]?_0x481db0[_0xd3ac('0x15')][_0xd3ac('0x16')]:null,_0x24ae54?util[_0xd3ac('0x17')](_0x24ae54,![],null):'');}}));_0x2c7a09[_0xd3ac('0x18')](ewinston[_0xd3ac('0xa')]({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x4f63b6,_0xb95d9b){var _0x43f95f=_0xd3ac('0x19');if(_0x4f63b6[_0xd3ac('0xd')]&&_0x4f63b6[_0xd3ac('0xd')]['device']&&_0x4f63b6[_0xd3ac('0xd')]['agent_id']){_0x43f95f='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)';}return util['format'](_0x43f95f,_0x4f63b6[_0xd3ac('0x1a')],_0x4f63b6[_0xd3ac('0xf')]['x-forwarded-for']?_0x4f63b6[_0xd3ac('0xf')][_0xd3ac('0x10')]:_0x4f63b6[_0xd3ac('0x11')][_0xd3ac('0x12')]||_0x4f63b6['ip'],_0x4f63b6[_0xd3ac('0x13')],_0xb95d9b[_0xd3ac('0x14')],_0xb95d9b[_0xd3ac('0x1b')],_0x4f63b6['user']?_0x4f63b6[_0xd3ac('0x15')]['id']:null,_0x4f63b6[_0xd3ac('0x15')]?_0x4f63b6['user']['name']:null,_0x4f63b6[_0xd3ac('0x15')]?_0x4f63b6[_0xd3ac('0x15')][_0xd3ac('0x16')]:null,_0x4f63b6[_0xd3ac('0xd')]&&_0x4f63b6['body']['device']?_0x4f63b6[_0xd3ac('0xd')][_0xd3ac('0x1c')]:_0xd3ac('0x1d'),_0x4f63b6['body']&&_0x4f63b6[_0xd3ac('0xd')]['agent_id']?_0x4f63b6[_0xd3ac('0xd')][_0xd3ac('0x1e')]:'',_0x4f63b6[_0xd3ac('0xd')]&&_0x4f63b6[_0xd3ac('0xd')][_0xd3ac('0x1f')]?_0x4f63b6[_0xd3ac('0xd')][_0xd3ac('0x1f')]:'');},'ignoreRoute':function(_0x2b4c15){var _0x560757=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x560757['test'](_0x2b4c15[_0xd3ac('0x13')]);}}));_0x2c7a09[_0xd3ac('0x18')](_0xd3ac('0x20'),require('./api/user'));_0x2c7a09['use'](_0xd3ac('0x21'),require(_0xd3ac('0x22')));_0x2c7a09['use'](_0xd3ac('0x23'),require(_0xd3ac('0x24')));_0x2c7a09[_0xd3ac('0x18')](_0xd3ac('0x25'),require('./api/voiceExtension'));_0x2c7a09['use'](_0xd3ac('0x26'),require(_0xd3ac('0x27')));_0x2c7a09[_0xd3ac('0x18')](_0xd3ac('0x28'),require('./api/voiceQueue'));_0x2c7a09['use'](_0xd3ac('0x29'),require('./api/voiceRecording'));_0x2c7a09['use'](_0xd3ac('0x2a'),require(_0xd3ac('0x2b')));_0x2c7a09[_0xd3ac('0x18')](_0xd3ac('0x2c'),require(_0xd3ac('0x2d')));_0x2c7a09[_0xd3ac('0x18')]('/api/voice/mails/messages',require(_0xd3ac('0x2e')));_0x2c7a09[_0xd3ac('0x18')](_0xd3ac('0x2f'),require('./api/voiceCallReport'));_0x2c7a09['use'](_0xd3ac('0x30'),require('./api/voiceDialReport'));_0x2c7a09[_0xd3ac('0x18')]('/api/voice/agents/reports',require(_0xd3ac('0x31')));_0x2c7a09['use'](_0xd3ac('0x32'),require(_0xd3ac('0x33')));_0x2c7a09[_0xd3ac('0x18')](_0xd3ac('0x34'),require('./api/memberReport'));_0x2c7a09['use'](_0xd3ac('0x35'),require('./api/trunk'));_0x2c7a09[_0xd3ac('0x18')]('/api/voice/transfers/reports',require('./api/voiceTransferReport'));_0x2c7a09[_0xd3ac('0x18')](_0xd3ac('0x36'),require(_0xd3ac('0x37')));_0x2c7a09[_0xd3ac('0x18')](_0xd3ac('0x38'),require('./api/mailAccount'));_0x2c7a09[_0xd3ac('0x18')](_0xd3ac('0x39'),require(_0xd3ac('0x3a')));_0x2c7a09[_0xd3ac('0x18')](_0xd3ac('0x3b'),require(_0xd3ac('0x3c')));_0x2c7a09[_0xd3ac('0x18')](_0xd3ac('0x3d'),require('./api/mailInteraction'));_0x2c7a09['use'](_0xd3ac('0x3e'),require('./api/mailMessage'));_0x2c7a09[_0xd3ac('0x18')]('/api/mail/applications',require(_0xd3ac('0x3f')));_0x2c7a09[_0xd3ac('0x18')](_0xd3ac('0x40'),require(_0xd3ac('0x41')));_0x2c7a09[_0xd3ac('0x18')](_0xd3ac('0x42'),require(_0xd3ac('0x43')));_0x2c7a09[_0xd3ac('0x18')]('/api/dashboards/items',require('./api/dashboardItem'));_0x2c7a09['use'](_0xd3ac('0x44'),require(_0xd3ac('0x45')));_0x2c7a09['use'](_0xd3ac('0x46'),require(_0xd3ac('0x47')));_0x2c7a09[_0xd3ac('0x18')]('/api/fax/interactions',require(_0xd3ac('0x48')));_0x2c7a09[_0xd3ac('0x18')](_0xd3ac('0x49'),require(_0xd3ac('0x4a')));_0x2c7a09['use'](_0xd3ac('0x4b'),require(_0xd3ac('0x4c')));_0x2c7a09[_0xd3ac('0x18')]('/api/fax/reports/queue',require('./api/faxQueueReport'));_0x2c7a09[_0xd3ac('0x18')]('/api/sms/accounts',require(_0xd3ac('0x4d')));_0x2c7a09[_0xd3ac('0x18')](_0xd3ac('0x4e'),require(_0xd3ac('0x4f')));_0x2c7a09[_0xd3ac('0x18')](_0xd3ac('0x50'),require(_0xd3ac('0x51')));_0x2c7a09[_0xd3ac('0x18')]('/api/sms/messages',require(_0xd3ac('0x52')));_0x2c7a09[_0xd3ac('0x18')]('/api/sms/queues',require('./api/smsQueue'));_0x2c7a09['use']('/api/openchannel/accounts',require(_0xd3ac('0x53')));_0x2c7a09[_0xd3ac('0x18')]('/api/openchannel/applications',require(_0xd3ac('0x54')));_0x2c7a09[_0xd3ac('0x18')](_0xd3ac('0x55'),require('./api/openchannelInteraction'));_0x2c7a09['use']('/api/openchannel/messages',require(_0xd3ac('0x56')));_0x2c7a09[_0xd3ac('0x18')](_0xd3ac('0x57'),require('./api/openchannelQueue'));_0x2c7a09[_0xd3ac('0x18')](_0xd3ac('0x58'),require('./api/chatWebsite'));_0x2c7a09[_0xd3ac('0x18')]('/api/openchannel/reports/queue',require(_0xd3ac('0x59')));_0x2c7a09[_0xd3ac('0x18')](_0xd3ac('0x5a'),require(_0xd3ac('0x5b')));_0x2c7a09[_0xd3ac('0x18')](_0xd3ac('0x5c'),require(_0xd3ac('0x5d')));_0x2c7a09[_0xd3ac('0x18')](_0xd3ac('0x5e'),require('./api/chatMessage'));_0x2c7a09['use'](_0xd3ac('0x5f'),require(_0xd3ac('0x60')));_0x2c7a09['use'](_0xd3ac('0x61'),require('./api/chatQueue'));_0x2c7a09[_0xd3ac('0x18')](_0xd3ac('0x62'),require(_0xd3ac('0x63')));_0x2c7a09['use']('/api/chat/proactive_actions',require(_0xd3ac('0x64')));_0x2c7a09[_0xd3ac('0x18')](_0xd3ac('0x65'),require(_0xd3ac('0x66')));_0x2c7a09[_0xd3ac('0x18')](_0xd3ac('0x67'),require(_0xd3ac('0x68')));_0x2c7a09[_0xd3ac('0x18')]('/api/cm/hopper',require(_0xd3ac('0x69')));_0x2c7a09[_0xd3ac('0x18')]('/api/cm/hopper_black',require(_0xd3ac('0x6a')));_0x2c7a09[_0xd3ac('0x18')](_0xd3ac('0x6b'),require(_0xd3ac('0x6c')));_0x2c7a09[_0xd3ac('0x18')](_0xd3ac('0x6d'),require(_0xd3ac('0x6e')));_0x2c7a09[_0xd3ac('0x18')](_0xd3ac('0x6f'),require(_0xd3ac('0x70')));_0x2c7a09['use'](_0xd3ac('0x71'),require('./api/action'));_0x2c7a09[_0xd3ac('0x18')](_0xd3ac('0x72'),require(_0xd3ac('0x73')));_0x2c7a09[_0xd3ac('0x18')](_0xd3ac('0x74'),require(_0xd3ac('0x75')));_0x2c7a09[_0xd3ac('0x18')](_0xd3ac('0x76'),require(_0xd3ac('0x77')));_0x2c7a09['use'](_0xd3ac('0x78'),require('./api/condition'));_0x2c7a09['use'](_0xd3ac('0x79'),require(_0xd3ac('0x7a')));_0x2c7a09[_0xd3ac('0x18')]('/api/pauses',require(_0xd3ac('0x7b')));_0x2c7a09[_0xd3ac('0x18')]('/api/cdr',require(_0xd3ac('0x7c')));_0x2c7a09[_0xd3ac('0x18')]('/api/voiceQueuesLog',require(_0xd3ac('0x7d')));_0x2c7a09[_0xd3ac('0x18')](_0xd3ac('0x7e'),require(_0xd3ac('0x7f')));_0x2c7a09[_0xd3ac('0x18')](_0xd3ac('0x80'),require('./api/sound'));_0x2c7a09[_0xd3ac('0x18')](_0xd3ac('0x81'),require('./api/tag'));_0x2c7a09[_0xd3ac('0x18')]('/api/templates',require(_0xd3ac('0x82')));_0x2c7a09['use'](_0xd3ac('0x83'),require(_0xd3ac('0x84')));_0x2c7a09[_0xd3ac('0x18')](_0xd3ac('0x85'),require(_0xd3ac('0x86')));_0x2c7a09['use']('/api/integrations',require('./api/integration'));_0x2c7a09[_0xd3ac('0x18')](_0xd3ac('0x87'),require(_0xd3ac('0x88')));_0x2c7a09[_0xd3ac('0x18')]('/api/analytics/custom_reports',require(_0xd3ac('0x89')));_0x2c7a09['use'](_0xd3ac('0x8a'),require('./api/analyticDefaultReport'));_0x2c7a09[_0xd3ac('0x18')](_0xd3ac('0x8b'),require(_0xd3ac('0x8c')));_0x2c7a09['use'](_0xd3ac('0x8d'),require(_0xd3ac('0x8e')));_0x2c7a09[_0xd3ac('0x18')](_0xd3ac('0x8f'),require(_0xd3ac('0x90')));_0x2c7a09[_0xd3ac('0x18')]('/api/analytics/tree_reports',require(_0xd3ac('0x91')));_0x2c7a09[_0xd3ac('0x18')](_0xd3ac('0x92'),require(_0xd3ac('0x93')));_0x2c7a09[_0xd3ac('0x18')]('/api/integrations/salesforce/configurations',require('./api/intSalesforceConfiguration'));_0x2c7a09[_0xd3ac('0x18')](_0xd3ac('0x94'),require(_0xd3ac('0x95')));_0x2c7a09[_0xd3ac('0x18')](_0xd3ac('0x96'),require('./api/intSugarcrmAccount'));_0x2c7a09[_0xd3ac('0x18')]('/api/integrations/sugarcrm/configurations',require(_0xd3ac('0x97')));_0x2c7a09[_0xd3ac('0x18')](_0xd3ac('0x98'),require('./api/intSugarcrmField'));_0x2c7a09[_0xd3ac('0x18')](_0xd3ac('0x99'),require(_0xd3ac('0x9a')));_0x2c7a09[_0xd3ac('0x18')](_0xd3ac('0x9b'),require(_0xd3ac('0x9c')));_0x2c7a09[_0xd3ac('0x18')](_0xd3ac('0x9d'),require(_0xd3ac('0x9e')));_0x2c7a09[_0xd3ac('0x18')]('/api/integrations/zoho/accounts',require(_0xd3ac('0x9f')));_0x2c7a09[_0xd3ac('0x18')](_0xd3ac('0xa0'),require(_0xd3ac('0xa1')));_0x2c7a09[_0xd3ac('0x18')]('/api/integrations/zoho/fields',require(_0xd3ac('0xa2')));_0x2c7a09['use']('/api/integrations/zendesk/accounts',require(_0xd3ac('0xa3')));_0x2c7a09[_0xd3ac('0x18')]('/api/integrations/zendesk/configurations',require(_0xd3ac('0xa4')));_0x2c7a09[_0xd3ac('0x18')](_0xd3ac('0xa5'),require(_0xd3ac('0xa6')));_0x2c7a09[_0xd3ac('0x18')](_0xd3ac('0xa7'),require(_0xd3ac('0xa8')));_0x2c7a09[_0xd3ac('0x18')](_0xd3ac('0xa9'),require(_0xd3ac('0xaa')));_0x2c7a09[_0xd3ac('0x18')](_0xd3ac('0xab'),require('./api/intFreshdeskField'));_0x2c7a09['use']('/api/integrations/vtiger/accounts',require(_0xd3ac('0xac')));_0x2c7a09[_0xd3ac('0x18')]('/api/integrations/vtiger/configurations',require('./api/intVtigerConfiguration'));_0x2c7a09[_0xd3ac('0x18')](_0xd3ac('0xad'),require(_0xd3ac('0xae')));_0x2c7a09[_0xd3ac('0x18')](_0xd3ac('0xaf'),require(_0xd3ac('0xb0')));_0x2c7a09['use']('/api/integrations/servicenow/configurations',require('./api/intServicenowConfiguration'));_0x2c7a09[_0xd3ac('0x18')](_0xd3ac('0xb1'),require('./api/intServicenowField'));_0x2c7a09[_0xd3ac('0x18')](_0xd3ac('0xb2'),require(_0xd3ac('0xb3')));_0x2c7a09[_0xd3ac('0x18')](_0xd3ac('0xb4'),require(_0xd3ac('0xb5')));_0x2c7a09[_0xd3ac('0x18')]('/api/integrations/dynamics365/fields',require(_0xd3ac('0xb6')));_0x2c7a09[_0xd3ac('0x18')]('/api/integrations/freshsales/accounts',require(_0xd3ac('0xb7')));_0x2c7a09[_0xd3ac('0x18')](_0xd3ac('0xb8'),require(_0xd3ac('0xb9')));_0x2c7a09[_0xd3ac('0x18')](_0xd3ac('0xba'),require(_0xd3ac('0xbb')));_0x2c7a09[_0xd3ac('0x18')](_0xd3ac('0xbc'),require(_0xd3ac('0xbd')));_0x2c7a09[_0xd3ac('0x18')](_0xd3ac('0xbe'),require(_0xd3ac('0xbf')));_0x2c7a09[_0xd3ac('0x18')](_0xd3ac('0xc0'),require('./api/chatInternalMessage'));_0x2c7a09[_0xd3ac('0x18')]('/api/jscripty/answers/reports',require(_0xd3ac('0xc1')));_0x2c7a09[_0xd3ac('0x18')](_0xd3ac('0xc2'),require(_0xd3ac('0xc3')));_0x2c7a09['use'](_0xd3ac('0xc4'),require(_0xd3ac('0xc5')));_0x2c7a09[_0xd3ac('0x18')](_0xd3ac('0xc6'),require(_0xd3ac('0xc7')));_0x2c7a09[_0xd3ac('0x18')](_0xd3ac('0xc8'),require(_0xd3ac('0xc9')));_0x2c7a09['use'](_0xd3ac('0xca'),require(_0xd3ac('0xcb')));_0x2c7a09[_0xd3ac('0x18')](_0xd3ac('0xcc'),require(_0xd3ac('0xcd')));_0x2c7a09[_0xd3ac('0x18')](_0xd3ac('0xce'),require('./api/setting'));_0x2c7a09['use'](_0xd3ac('0xcf'),require(_0xd3ac('0xd0')));_0x2c7a09[_0xd3ac('0x18')](_0xd3ac('0xd1'),require(_0xd3ac('0xd2')));_0x2c7a09[_0xd3ac('0x18')](_0xd3ac('0xd3'),require(_0xd3ac('0xd4')));_0x2c7a09['use'](_0xd3ac('0xd5'),require(_0xd3ac('0xd6')));_0x2c7a09[_0xd3ac('0x18')](_0xd3ac('0xd7'),require(_0xd3ac('0xd8')));_0x2c7a09[_0xd3ac('0x18')](_0xd3ac('0xd9'),require(_0xd3ac('0xda')));_0x2c7a09[_0xd3ac('0x18')](_0xd3ac('0xdb'),require('./api/campaign'));_0x2c7a09[_0xd3ac('0x18')](_0xd3ac('0xdc'),require(_0xd3ac('0xdd')));_0x2c7a09[_0xd3ac('0x18')](_0xd3ac('0xde'),require('./api/attachment'));_0x2c7a09[_0xd3ac('0x18')](_0xd3ac('0xdf'),require(_0xd3ac('0xe0')));_0x2c7a09[_0xd3ac('0x18')](_0xd3ac('0xe1'),require(_0xd3ac('0xe2')));_0x2c7a09[_0xd3ac('0x18')](_0xd3ac('0xe3'),require(_0xd3ac('0xe4')));_0x2c7a09['use'](_0xd3ac('0xe5'),require(_0xd3ac('0xe6')));_0x2c7a09[_0xd3ac('0x18')](_0xd3ac('0xe7'),require(_0xd3ac('0xe8')));_0x2c7a09[_0xd3ac('0x18')](_0xd3ac('0xe9'),require(_0xd3ac('0xea')));_0x2c7a09['use'](_0xd3ac('0xeb'),require(_0xd3ac('0xec')));_0x2c7a09[_0xd3ac('0x18')]('/api/voice/prefixes',require(_0xd3ac('0xed')));_0x2c7a09[_0xd3ac('0x18')](_0xd3ac('0xee'),require(_0xd3ac('0xef')));_0x2c7a09[_0xd3ac('0x18')]('/api/userProfile/sections',require(_0xd3ac('0xf0')));_0x2c7a09[_0xd3ac('0x18')](_0xd3ac('0xf1'),require(_0xd3ac('0xf2')));_0x2c7a09['use'](_0xd3ac('0xf3'),require(_0xd3ac('0xf4')));_0x2c7a09[_0xd3ac('0x18')]('/api/whatsapp/accounts',require(_0xd3ac('0xf5')));_0x2c7a09['use'](_0xd3ac('0xf6'),require(_0xd3ac('0xf7')));_0x2c7a09[_0xd3ac('0x18')]('/api/whatsapp/interactions',require(_0xd3ac('0xf8')));_0x2c7a09[_0xd3ac('0x18')](_0xd3ac('0xf9'),require('./api/whatsappMessage'));_0x2c7a09[_0xd3ac('0x18')]('/api/whatsapp/reports/queue',require(_0xd3ac('0xfa')));_0x2c7a09[_0xd3ac('0x18')](_0xd3ac('0xfb'),require(_0xd3ac('0xfc')));_0x2c7a09[_0xd3ac('0x18')]('/api/whatsapp/queues',require(_0xd3ac('0xfd')));_0x2c7a09[_0xd3ac('0x18')](_0xd3ac('0xfe'),require(_0xd3ac('0xff')));_0x2c7a09[_0xd3ac('0x18')]('/api/auth/local',require('./api/authLocal'));_0x2c7a09[_0xd3ac('0x18')](_0xd3ac('0x100'),require('./api/authGoogle'));_0x2c7a09[_0xd3ac('0x18')](_0xd3ac('0x101'),require(_0xd3ac('0x102')));_0x2c7a09[_0xd3ac('0x18')]('/api/rpc',require('./api/rpc'));_0x2c7a09[_0xd3ac('0x18')](_0xd3ac('0x103'),require(_0xd3ac('0x104')));_0x2c7a09[_0xd3ac('0x18')]('/api/system',require('./api/system'));_0x2c7a09['use'](_0xd3ac('0x105'),require('./api/pm2'));_0x2c7a09[_0xd3ac('0x18')](_0xd3ac('0x106'),require('./api/webbar'));_0x2c7a09[_0xd3ac('0x18')]('/apidoc',express['static'](path[_0xd3ac('0x107')](config[_0xd3ac('0x108')],_0xd3ac('0x109'))));_0x2c7a09[_0xd3ac('0x18')](_0xd3ac('0x10a'),express[_0xd3ac('0x10b')](path[_0xd3ac('0x107')](config[_0xd3ac('0x108')],_0xd3ac('0x10a'))));_0x2c7a09[_0xd3ac('0x18')]('/demo',express[_0xd3ac('0x10b')](path[_0xd3ac('0x107')](config['root'],_0xd3ac('0x10c'))));_0x2c7a09[_0xd3ac('0x18')](_0xd3ac('0x10d'),express[_0xd3ac('0x10b')](path[_0xd3ac('0x107')](config[_0xd3ac('0x108')],_0xd3ac('0x10e'),_0xd3ac('0x10f'))));_0x2c7a09[_0xd3ac('0x18')]('/plugins',express['static'](path[_0xd3ac('0x107')](config['root'],_0xd3ac('0x110'))));_0x2c7a09[_0xd3ac('0x111')](_0xd3ac('0x112'))[_0xd3ac('0x113')](errors[0x194]);_0x2c7a09[_0xd3ac('0x111')]('/*')['get'](function(_0x3916fa,_0x3412fc){_0x3412fc[_0xd3ac('0x114')](path[_0xd3ac('0x115')](_0x2c7a09[_0xd3ac('0x113')]('appPath')+_0xd3ac('0x116')));});};var sensitiveFields=['username',_0xd3ac('0x117'),_0xd3ac('0x118'),_0xd3ac('0x119'),_0xd3ac('0x11a'),'lastName',_0xd3ac('0x11b'),_0xd3ac('0x11c'),_0xd3ac('0x11d'),_0xd3ac('0x11e'),_0xd3ac('0x11f'),_0xd3ac('0x120'),'clientSecret','securityToken',_0xd3ac('0x121'),_0xd3ac('0x122'),_0xd3ac('0x123'),_0xd3ac('0x124'),'channelSecret',_0xd3ac('0x125'),'accessTokenSecret',_0xd3ac('0x126'),_0xd3ac('0x127'),_0xd3ac('0x128'),_0xd3ac('0x129'),_0xd3ac('0x12a'),_0xd3ac('0x12b'),'exten',_0xd3ac('0x12c'),_0xd3ac('0x12d'),_0xd3ac('0x12e'),'accesskeyid',_0xd3ac('0x12f'),_0xd3ac('0x130'),_0xd3ac('0x15'),_0xd3ac('0x131'),_0xd3ac('0x132'),_0xd3ac('0x133'),_0xd3ac('0x134'),'secret','registry',_0xd3ac('0x135')];function maskSensitiveData(_0xe16b35){var _0x5a960a=/(?!^)[\s\S](?!$)/g;if(!_['isPlainObject'](_0xe16b35))return;for(var _0x3faee9 in _0xe16b35){if(_[_0xd3ac('0x136')](_0xe16b35[_0x3faee9])){for(var _0x336efc=0x0;_0x336efc<_0xe16b35[_0x3faee9]['length'];_0x336efc++){maskSensitiveData(_0xe16b35[_0x3faee9][_0x336efc]);}}else if(_['isPlainObject'](_0xe16b35[_0x3faee9])){maskSensitiveData(_0xe16b35[_0x3faee9]);}else if(_[_0xd3ac('0x137')](_0xe16b35[_0x3faee9])){_0xe16b35[_0x3faee9]=_0xe16b35[_0x3faee9]['replace'](/{{{/g,_0xd3ac('0x138'))[_0xd3ac('0x139')](/}}}/g,_0xd3ac('0x13a'))['replace'](/{{/g,'@{')[_0xd3ac('0x139')](/}}/g,'}@');if(_[_0xd3ac('0x13b')](sensitiveFields,_0x3faee9)){_0xe16b35[_0x3faee9]=_0xe16b35[_0x3faee9][_0xd3ac('0x139')](_0x5a960a,'*');}}}} \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index f095e1d..9ccab57 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x80d5=['../api/squareReport/squareReport.rpc','../api/setting/setting.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','http','rpc','port','localhost','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','jayson/promise','bluebird','lodash','../config/environment','listen','merge','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.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/smsAccount/smsAccount.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc'];(function(_0xdef995,_0x6d25df){var _0x403e98=function(_0x3678fc){while(--_0x3678fc){_0xdef995['push'](_0xdef995['shift']());}};_0x403e98(++_0x6d25df);}(_0x80d5,0x186));var _0x580d=function(_0x366e55,_0x3113f3){_0x366e55=_0x366e55-0x0;var _0x252473=_0x80d5[_0x366e55];return _0x252473;};'use strict';var jayson=require(_0x580d('0x0'));var BPromise=require(_0x580d('0x1'));var _=require(_0x580d('0x2'));var config=require(_0x580d('0x3'));exports[_0x580d('0x4')]=function(){return new BPromise(function(_0x180a08,_0x142d8f){var _0x1c9eb2={};_0x1c9eb2=_[_0x580d('0x5')](_0x1c9eb2,require(_0x580d('0x6')));_0x1c9eb2=_[_0x580d('0x5')](_0x1c9eb2,require(_0x580d('0x7')));_0x1c9eb2=_['merge'](_0x1c9eb2,require('../api/voiceQueue/voiceQueue.rpc'));_0x1c9eb2=_[_0x580d('0x5')](_0x1c9eb2,require(_0x580d('0x8')));_0x1c9eb2=_[_0x580d('0x5')](_0x1c9eb2,require(_0x580d('0x9')));_0x1c9eb2=_[_0x580d('0x5')](_0x1c9eb2,require(_0x580d('0xa')));_0x1c9eb2=_[_0x580d('0x5')](_0x1c9eb2,require(_0x580d('0xb')));_0x1c9eb2=_[_0x580d('0x5')](_0x1c9eb2,require('../api/voiceQueueReport/voiceQueueReport.rpc'));_0x1c9eb2=_[_0x580d('0x5')](_0x1c9eb2,require(_0x580d('0xc')));_0x1c9eb2=_[_0x580d('0x5')](_0x1c9eb2,require(_0x580d('0xd')));_0x1c9eb2=_[_0x580d('0x5')](_0x1c9eb2,require(_0x580d('0xe')));_0x1c9eb2=_['merge'](_0x1c9eb2,require(_0x580d('0xf')));_0x1c9eb2=_[_0x580d('0x5')](_0x1c9eb2,require('../api/mailServerIn/mailServerIn.rpc'));_0x1c9eb2=_[_0x580d('0x5')](_0x1c9eb2,require(_0x580d('0x10')));_0x1c9eb2=_[_0x580d('0x5')](_0x1c9eb2,require(_0x580d('0x11')));_0x1c9eb2=_[_0x580d('0x5')](_0x1c9eb2,require(_0x580d('0x12')));_0x1c9eb2=_[_0x580d('0x5')](_0x1c9eb2,require(_0x580d('0x13')));_0x1c9eb2=_['merge'](_0x1c9eb2,require(_0x580d('0x14')));_0x1c9eb2=_[_0x580d('0x5')](_0x1c9eb2,require(_0x580d('0x15')));_0x1c9eb2=_[_0x580d('0x5')](_0x1c9eb2,require(_0x580d('0x16')));_0x1c9eb2=_[_0x580d('0x5')](_0x1c9eb2,require(_0x580d('0x17')));_0x1c9eb2=_[_0x580d('0x5')](_0x1c9eb2,require(_0x580d('0x18')));_0x1c9eb2=_['merge'](_0x1c9eb2,require(_0x580d('0x19')));_0x1c9eb2=_[_0x580d('0x5')](_0x1c9eb2,require(_0x580d('0x1a')));_0x1c9eb2=_[_0x580d('0x5')](_0x1c9eb2,require('../api/faxQueueReport/faxQueueReport.rpc'));_0x1c9eb2=_['merge'](_0x1c9eb2,require(_0x580d('0x1b')));_0x1c9eb2=_['merge'](_0x1c9eb2,require('../api/smsInteraction/smsInteraction.rpc'));_0x1c9eb2=_[_0x580d('0x5')](_0x1c9eb2,require(_0x580d('0x1c')));_0x1c9eb2=_[_0x580d('0x5')](_0x1c9eb2,require(_0x580d('0x1d')));_0x1c9eb2=_[_0x580d('0x5')](_0x1c9eb2,require(_0x580d('0x1e')));_0x1c9eb2=_[_0x580d('0x5')](_0x1c9eb2,require(_0x580d('0x1f')));_0x1c9eb2=_[_0x580d('0x5')](_0x1c9eb2,require(_0x580d('0x20')));_0x1c9eb2=_[_0x580d('0x5')](_0x1c9eb2,require('../api/openchannelQueue/openchannelQueue.rpc'));_0x1c9eb2=_['merge'](_0x1c9eb2,require(_0x580d('0x21')));_0x1c9eb2=_[_0x580d('0x5')](_0x1c9eb2,require('../api/chatInteraction/chatInteraction.rpc'));_0x1c9eb2=_['merge'](_0x1c9eb2,require('../api/chatMessage/chatMessage.rpc'));_0x1c9eb2=_[_0x580d('0x5')](_0x1c9eb2,require(_0x580d('0x22')));_0x1c9eb2=_['merge'](_0x1c9eb2,require(_0x580d('0x23')));_0x1c9eb2=_[_0x580d('0x5')](_0x1c9eb2,require(_0x580d('0x24')));_0x1c9eb2=_[_0x580d('0x5')](_0x1c9eb2,require('../api/cmHopperBlack/cmHopperBlack.rpc'));_0x1c9eb2=_[_0x580d('0x5')](_0x1c9eb2,require(_0x580d('0x25')));_0x1c9eb2=_['merge'](_0x1c9eb2,require(_0x580d('0x26')));_0x1c9eb2=_[_0x580d('0x5')](_0x1c9eb2,require(_0x580d('0x27')));_0x1c9eb2=_['merge'](_0x1c9eb2,require(_0x580d('0x28')));_0x1c9eb2=_[_0x580d('0x5')](_0x1c9eb2,require(_0x580d('0x29')));_0x1c9eb2=_[_0x580d('0x5')](_0x1c9eb2,require('../api/sound/sound.rpc'));_0x1c9eb2=_[_0x580d('0x5')](_0x1c9eb2,require(_0x580d('0x2a')));_0x1c9eb2=_[_0x580d('0x5')](_0x1c9eb2,require(_0x580d('0x2b')));_0x1c9eb2=_[_0x580d('0x5')](_0x1c9eb2,require(_0x580d('0x2c')));_0x1c9eb2=_['merge'](_0x1c9eb2,require('../api/intSalesforceAccount/intSalesforceAccount.rpc'));_0x1c9eb2=_[_0x580d('0x5')](_0x1c9eb2,require(_0x580d('0x2d')));_0x1c9eb2=_[_0x580d('0x5')](_0x1c9eb2,require(_0x580d('0x2e')));_0x1c9eb2=_[_0x580d('0x5')](_0x1c9eb2,require(_0x580d('0x2f')));_0x1c9eb2=_[_0x580d('0x5')](_0x1c9eb2,require(_0x580d('0x30')));_0x1c9eb2=_['merge'](_0x1c9eb2,require(_0x580d('0x31')));_0x1c9eb2=_[_0x580d('0x5')](_0x1c9eb2,require('../api/intVtigerAccount/intVtigerAccount.rpc'));_0x1c9eb2=_[_0x580d('0x5')](_0x1c9eb2,require('../api/intServicenowAccount/intServicenowAccount.rpc'));_0x1c9eb2=_[_0x580d('0x5')](_0x1c9eb2,require(_0x580d('0x32')));_0x1c9eb2=_[_0x580d('0x5')](_0x1c9eb2,require(_0x580d('0x33')));_0x1c9eb2=_[_0x580d('0x5')](_0x1c9eb2,require(_0x580d('0x34')));_0x1c9eb2=_[_0x580d('0x5')](_0x1c9eb2,require(_0x580d('0x35')));_0x1c9eb2=_['merge'](_0x1c9eb2,require(_0x580d('0x36')));_0x1c9eb2=_[_0x580d('0x5')](_0x1c9eb2,require('../api/squareReportDetail/squareReportDetail.rpc'));_0x1c9eb2=_[_0x580d('0x5')](_0x1c9eb2,require(_0x580d('0x37')));_0x1c9eb2=_[_0x580d('0x5')](_0x1c9eb2,require(_0x580d('0x38')));_0x1c9eb2=_['merge'](_0x1c9eb2,require(_0x580d('0x39')));_0x1c9eb2=_['merge'](_0x1c9eb2,require('../api/squareRecording/squareRecording.rpc'));_0x1c9eb2=_['merge'](_0x1c9eb2,require(_0x580d('0x3a')));_0x1c9eb2=_[_0x580d('0x5')](_0x1c9eb2,require(_0x580d('0x3b')));_0x1c9eb2=_[_0x580d('0x5')](_0x1c9eb2,require(_0x580d('0x3c')));_0x1c9eb2=_[_0x580d('0x5')](_0x1c9eb2,require(_0x580d('0x3d')));_0x1c9eb2=_[_0x580d('0x5')](_0x1c9eb2,require(_0x580d('0x3e')));_0x1c9eb2=_['merge'](_0x1c9eb2,require(_0x580d('0x3f')));_0x1c9eb2=_['merge'](_0x1c9eb2,require('../api/whatsappMessage/whatsappMessage.rpc'));_0x1c9eb2=_[_0x580d('0x5')](_0x1c9eb2,require(_0x580d('0x40')));_0x1c9eb2=_[_0x580d('0x5')](_0x1c9eb2,require(_0x580d('0x41')));var _0x5de1e3=jayson['server'](_0x1c9eb2)[_0x580d('0x42')]();var _0x5d69c5=config[_0x580d('0x43')][_0x580d('0x44')]||config[_0x580d('0x44')]+0x1;var _0x3aa90c=config[_0x580d('0x43')]['ip']||_0x580d('0x45');_0x5de1e3['on']('error',function(_0x2348e8){return _0x142d8f(_0x2348e8);});_0x5de1e3['listen'](_0x5d69c5,_0x3aa90c,function(){console[_0x580d('0x46')](_0x580d('0x47'),_0x3aa90c,_0x5d69c5);require(_0x580d('0x48'))[_0x580d('0x49')]();return _0x180a08('RPC\x20listening\x20on\x20'+_0x3aa90c+':'+_0x5d69c5);});});}; \ No newline at end of file +var _0x7bc0=['../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/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/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/setting/setting.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','http','port','error','listen','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','RPC\x20listening\x20on\x20','jayson/promise','lodash','../config/environment','../api/user/user.rpc','merge','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/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'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7bc0,0xbf));var _0x07bc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7bc0[_0x3dd15e];return _0x231fd0;};'use strict';var jayson=require(_0x07bc('0x0'));var BPromise=require('bluebird');var _=require(_0x07bc('0x1'));var config=require(_0x07bc('0x2'));exports['listen']=function(){return new BPromise(function(_0x29a771,_0xea1f24){var _0x1a1f7a={};_0x1a1f7a=_['merge'](_0x1a1f7a,require(_0x07bc('0x3')));_0x1a1f7a=_[_0x07bc('0x4')](_0x1a1f7a,require(_0x07bc('0x5')));_0x1a1f7a=_[_0x07bc('0x4')](_0x1a1f7a,require(_0x07bc('0x6')));_0x1a1f7a=_['merge'](_0x1a1f7a,require(_0x07bc('0x7')));_0x1a1f7a=_[_0x07bc('0x4')](_0x1a1f7a,require('../api/voiceCallReport/voiceCallReport.rpc'));_0x1a1f7a=_[_0x07bc('0x4')](_0x1a1f7a,require(_0x07bc('0x8')));_0x1a1f7a=_[_0x07bc('0x4')](_0x1a1f7a,require('../api/voiceAgentReport/voiceAgentReport.rpc'));_0x1a1f7a=_[_0x07bc('0x4')](_0x1a1f7a,require(_0x07bc('0x9')));_0x1a1f7a=_[_0x07bc('0x4')](_0x1a1f7a,require('../api/memberReport/memberReport.rpc'));_0x1a1f7a=_[_0x07bc('0x4')](_0x1a1f7a,require('../api/trunk/trunk.rpc'));_0x1a1f7a=_[_0x07bc('0x4')](_0x1a1f7a,require(_0x07bc('0xa')));_0x1a1f7a=_[_0x07bc('0x4')](_0x1a1f7a,require(_0x07bc('0xb')));_0x1a1f7a=_[_0x07bc('0x4')](_0x1a1f7a,require(_0x07bc('0xc')));_0x1a1f7a=_[_0x07bc('0x4')](_0x1a1f7a,require(_0x07bc('0xd')));_0x1a1f7a=_['merge'](_0x1a1f7a,require('../api/mailQueue/mailQueue.rpc'));_0x1a1f7a=_['merge'](_0x1a1f7a,require(_0x07bc('0xe')));_0x1a1f7a=_[_0x07bc('0x4')](_0x1a1f7a,require(_0x07bc('0xf')));_0x1a1f7a=_[_0x07bc('0x4')](_0x1a1f7a,require('../api/mailApplication/mailApplication.rpc'));_0x1a1f7a=_['merge'](_0x1a1f7a,require(_0x07bc('0x10')));_0x1a1f7a=_[_0x07bc('0x4')](_0x1a1f7a,require(_0x07bc('0x11')));_0x1a1f7a=_['merge'](_0x1a1f7a,require(_0x07bc('0x12')));_0x1a1f7a=_[_0x07bc('0x4')](_0x1a1f7a,require(_0x07bc('0x13')));_0x1a1f7a=_[_0x07bc('0x4')](_0x1a1f7a,require(_0x07bc('0x14')));_0x1a1f7a=_[_0x07bc('0x4')](_0x1a1f7a,require(_0x07bc('0x15')));_0x1a1f7a=_[_0x07bc('0x4')](_0x1a1f7a,require(_0x07bc('0x16')));_0x1a1f7a=_['merge'](_0x1a1f7a,require(_0x07bc('0x17')));_0x1a1f7a=_['merge'](_0x1a1f7a,require(_0x07bc('0x18')));_0x1a1f7a=_[_0x07bc('0x4')](_0x1a1f7a,require(_0x07bc('0x19')));_0x1a1f7a=_[_0x07bc('0x4')](_0x1a1f7a,require(_0x07bc('0x1a')));_0x1a1f7a=_[_0x07bc('0x4')](_0x1a1f7a,require(_0x07bc('0x1b')));_0x1a1f7a=_[_0x07bc('0x4')](_0x1a1f7a,require(_0x07bc('0x1c')));_0x1a1f7a=_[_0x07bc('0x4')](_0x1a1f7a,require('../api/openchannelMessage/openchannelMessage.rpc'));_0x1a1f7a=_[_0x07bc('0x4')](_0x1a1f7a,require(_0x07bc('0x1d')));_0x1a1f7a=_['merge'](_0x1a1f7a,require(_0x07bc('0x1e')));_0x1a1f7a=_[_0x07bc('0x4')](_0x1a1f7a,require(_0x07bc('0x1f')));_0x1a1f7a=_[_0x07bc('0x4')](_0x1a1f7a,require(_0x07bc('0x20')));_0x1a1f7a=_['merge'](_0x1a1f7a,require(_0x07bc('0x21')));_0x1a1f7a=_[_0x07bc('0x4')](_0x1a1f7a,require(_0x07bc('0x22')));_0x1a1f7a=_[_0x07bc('0x4')](_0x1a1f7a,require(_0x07bc('0x23')));_0x1a1f7a=_[_0x07bc('0x4')](_0x1a1f7a,require(_0x07bc('0x24')));_0x1a1f7a=_[_0x07bc('0x4')](_0x1a1f7a,require('../api/cmHopperFinal/cmHopperFinal.rpc'));_0x1a1f7a=_['merge'](_0x1a1f7a,require(_0x07bc('0x25')));_0x1a1f7a=_[_0x07bc('0x4')](_0x1a1f7a,require(_0x07bc('0x26')));_0x1a1f7a=_[_0x07bc('0x4')](_0x1a1f7a,require(_0x07bc('0x27')));_0x1a1f7a=_[_0x07bc('0x4')](_0x1a1f7a,require(_0x07bc('0x28')));_0x1a1f7a=_[_0x07bc('0x4')](_0x1a1f7a,require('../api/sound/sound.rpc'));_0x1a1f7a=_['merge'](_0x1a1f7a,require(_0x07bc('0x29')));_0x1a1f7a=_['merge'](_0x1a1f7a,require(_0x07bc('0x2a')));_0x1a1f7a=_['merge'](_0x1a1f7a,require(_0x07bc('0x2b')));_0x1a1f7a=_[_0x07bc('0x4')](_0x1a1f7a,require(_0x07bc('0x2c')));_0x1a1f7a=_['merge'](_0x1a1f7a,require('../api/intSugarcrmAccount/intSugarcrmAccount.rpc'));_0x1a1f7a=_[_0x07bc('0x4')](_0x1a1f7a,require(_0x07bc('0x2d')));_0x1a1f7a=_[_0x07bc('0x4')](_0x1a1f7a,require(_0x07bc('0x2e')));_0x1a1f7a=_['merge'](_0x1a1f7a,require(_0x07bc('0x2f')));_0x1a1f7a=_['merge'](_0x1a1f7a,require('../api/intFreshdeskAccount/intFreshdeskAccount.rpc'));_0x1a1f7a=_[_0x07bc('0x4')](_0x1a1f7a,require('../api/intVtigerAccount/intVtigerAccount.rpc'));_0x1a1f7a=_[_0x07bc('0x4')](_0x1a1f7a,require(_0x07bc('0x30')));_0x1a1f7a=_[_0x07bc('0x4')](_0x1a1f7a,require(_0x07bc('0x31')));_0x1a1f7a=_[_0x07bc('0x4')](_0x1a1f7a,require(_0x07bc('0x32')));_0x1a1f7a=_[_0x07bc('0x4')](_0x1a1f7a,require(_0x07bc('0x33')));_0x1a1f7a=_['merge'](_0x1a1f7a,require(_0x07bc('0x34')));_0x1a1f7a=_[_0x07bc('0x4')](_0x1a1f7a,require(_0x07bc('0x35')));_0x1a1f7a=_[_0x07bc('0x4')](_0x1a1f7a,require('../api/squareReportDetail/squareReportDetail.rpc'));_0x1a1f7a=_['merge'](_0x1a1f7a,require(_0x07bc('0x36')));_0x1a1f7a=_[_0x07bc('0x4')](_0x1a1f7a,require(_0x07bc('0x37')));_0x1a1f7a=_[_0x07bc('0x4')](_0x1a1f7a,require('../api/squareProject/squareProject.rpc'));_0x1a1f7a=_[_0x07bc('0x4')](_0x1a1f7a,require('../api/squareRecording/squareRecording.rpc'));_0x1a1f7a=_['merge'](_0x1a1f7a,require(_0x07bc('0x38')));_0x1a1f7a=_[_0x07bc('0x4')](_0x1a1f7a,require(_0x07bc('0x39')));_0x1a1f7a=_[_0x07bc('0x4')](_0x1a1f7a,require(_0x07bc('0x3a')));_0x1a1f7a=_[_0x07bc('0x4')](_0x1a1f7a,require(_0x07bc('0x3b')));_0x1a1f7a=_[_0x07bc('0x4')](_0x1a1f7a,require('../api/whatsappAccount/whatsappAccount.rpc'));_0x1a1f7a=_['merge'](_0x1a1f7a,require('../api/whatsappInteraction/whatsappInteraction.rpc'));_0x1a1f7a=_['merge'](_0x1a1f7a,require(_0x07bc('0x3c')));_0x1a1f7a=_['merge'](_0x1a1f7a,require(_0x07bc('0x3d')));_0x1a1f7a=_[_0x07bc('0x4')](_0x1a1f7a,require(_0x07bc('0x3e')));var _0x16b2bc=jayson[_0x07bc('0x3f')](_0x1a1f7a)[_0x07bc('0x40')]();var _0x1245c3=config['rpc'][_0x07bc('0x41')]||config[_0x07bc('0x41')]+0x1;var _0x54b0dc=config['rpc']['ip']||'localhost';_0x16b2bc['on'](_0x07bc('0x42'),function(_0x4c23f1){return _0xea1f24(_0x4c23f1);});_0x16b2bc[_0x07bc('0x43')](_0x1245c3,_0x54b0dc,function(){console[_0x07bc('0x44')](_0x07bc('0x45'),_0x54b0dc,_0x1245c3);require(_0x07bc('0x46'))[_0x07bc('0x47')]();return _0x29a771(_0x07bc('0x48')+_0x54b0dc+':'+_0x1245c3);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index d5d6d72..0e86a08 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 _0xcc13=['isArray','EXEC\x20%s\x20%s','setContext','SET\x20CONTEXT\x20%s','setExtension','SET\x20EXTENSION\x20%s','HANGUP','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','continueAt','extension','setPriority','getVariable','wav','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','agi','AGI','wait','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','exports','events','EventEmitter','./reply','setEncoding','utf8','setTimeout','headers','ready','line','toLowerCase','emit','hangup','substring','520-Invalid','search','520\x20End\x20of\x20proper','function','no\x20code','replace','indexOf','substr','startsWith','length','match','error','code','close','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','write','inherits','command','sync','prototype','answer','sendRequest','getData','beep','format','noop','NO\x20MESSAGE','exec'];(function(_0x2eef84,_0x59c8b7){var _0x3b3381=function(_0x34caec){while(--_0x34caec){_0x2eef84['push'](_0x2eef84['shift']());}};_0x3b3381(++_0x59c8b7);}(_0xcc13,0x190));var _0x3cc1=function(_0x382615,_0x53ff6f){_0x382615=_0x382615-0x0;var _0x4835fe=_0xcc13[_0x382615];return _0x4835fe;};'use strict';var util=require('util');var _=require('lodash');var EventEmitter=require(_0x3cc1('0x0'))[_0x3cc1('0x1')];var AGIReply=require(_0x3cc1('0x2'));var AGIError=require('./error');function AGIChannel(_0x27190c){var _0xcad40f=this,_0x2e3b25=new AGIReply(),_0x1d43f8=![],_0x145875={};EventEmitter['call'](_0xcad40f);_0x27190c[_0x3cc1('0x3')](_0x3cc1('0x4'));_0x27190c[_0x3cc1('0x5')](0x8*0x3c*0x3c*0x3e8);_0x2e3b25[_0x3cc1('0x3')](_0x3cc1('0x4'));_0x2e3b25['on'](_0x3cc1('0x6'),function(_0xfd4b7d){for(var _0x3dd0d0 in _0xfd4b7d){_0xcad40f[_0x3dd0d0]=_0xfd4b7d[_0x3dd0d0];}_0xcad40f['emit'](_0x3cc1('0x7'));});_0x2e3b25['on'](_0x3cc1('0x8'),function(_0x3a013d){if(_0x3a013d[_0x3cc1('0x9')]()=='hangup'){_0xcad40f[_0x3cc1('0xa')](_0x3cc1('0xb'));return;}if(_0x3a013d[_0x3cc1('0xc')](0x0,0xb)==_0x3cc1('0xd')){_0x1d43f8=!![];}if(_0x1d43f8){_0x145875['rx']+=_0x3a013d+'\x0a';if(_0x3a013d[_0x3cc1('0xe')](_0x3cc1('0xf'))!=-0x1){_0x1d43f8=![];}}else{_0x145875['rx']=_0x3a013d;}if(_0x1d43f8){return;}if(typeof _0x145875['cb']==_0x3cc1('0x10')){var _0x19944c=_0x145875['rx'][_0x3cc1('0xc')](0x0,0x3),_0x4ed7a1=null,_0x15263d=null;_0x19944c=parseInt(_0x19944c);if(isNaN(_0x19944c)){_0x145875['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x3cc1('0x11')});return;}if(_0x19944c!=0xc8){_0x145875['cb'](null,{'code':_0x19944c,'result':-0x1,'extra':'KO'});return;}_0x4ed7a1=_0x145875['rx'][_0x3cc1('0xc')](0x4)[_0x3cc1('0x12')]('result=','');if(_0x4ed7a1[_0x3cc1('0x13')]('\x20')!=-0x1){_0x4ed7a1=_0x4ed7a1[_0x3cc1('0x14')](0x0,_0x4ed7a1['indexOf']('\x20'));}if(_[_0x3cc1('0x15')](_0x4ed7a1,'-1')){_0x4ed7a1=parseInt(_0x4ed7a1);}_0x15263d=_0x145875['rx']['split']('\x20');if(_0x15263d[_0x3cc1('0x16')]==0x3){_0x15263d=_0x15263d[0x2][_0x3cc1('0xc')](0x1,_0x15263d[0x2][_0x3cc1('0x16')]-0x1);}else if(_0x15263d['length']>0x3){var _0x2bd394=/\((.+)\)/;var _0xe34f0=_0x145875['rx'][_0x3cc1('0x17')](_0x2bd394);if(_0xe34f0){_0x15263d=_0xe34f0[0x1];}else{_0x15263d=null;}}else{_0x15263d=null;}_0x145875['cb'](null,{'code':_0x19944c,'result':_0x4ed7a1,'extra':_0x15263d});}});_0x27190c['on']('error',function(_0x2dc6b8){_0xcad40f[_0x3cc1('0xa')](_0x3cc1('0x18'),new AGIError('E_AGI_SOCKET_ERROR',_0x2dc6b8[_0x3cc1('0x19')]));});_0x27190c['on'](_0x3cc1('0x1a'),function(){_0xcad40f['emit']('close',new AGIError('E_AGI_SOCKET_CLOSE'));});_0x27190c['on'](_0x3cc1('0x1b'),function(){_0xcad40f[_0x3cc1('0xa')]('timeout',new AGIError(_0x3cc1('0x1c')));_0x27190c[_0x3cc1('0x1d')]();});_0x27190c[_0x3cc1('0x1e')](_0x2e3b25);this['command']=function(_0x254973,_0x2d22d3){var _0x254973=_0x254973||'',_0x2d22d3=typeof _0x2d22d3==_0x3cc1('0x10')?_0x2d22d3:new Function();_0x145875={'tx':_0x254973,'rx':'','cb':_0x2d22d3};_0x27190c[_0x3cc1('0x1f')](_0x254973+'\x0a');},this['close']=function(){_0x27190c[_0x3cc1('0x1d')]();};}util[_0x3cc1('0x20')](AGIChannel,EventEmitter);AGIChannel['prototype']['sendRequest']=function(_0x1021ce){return this[_0x3cc1('0x21')][_0x3cc1('0x22')](this,_0x1021ce);};AGIChannel[_0x3cc1('0x23')][_0x3cc1('0x24')]=function(){return this[_0x3cc1('0x25')]('ANSWER');};AGIChannel['prototype'][_0x3cc1('0x26')]=function(_0x1f96fb,_0x14fade,_0x442ef6){_0x1f96fb=_0x1f96fb===undefined?_0x3cc1('0x27'):_0x1f96fb;_0x14fade=_0x14fade===undefined?'5':_0x14fade;_0x442ef6=_0x442ef6===undefined?'1':_0x442ef6;return this['sendRequest'](util[_0x3cc1('0x28')]('GET\x20DATA\x20\x22%s\x22\x20%s\x20%s',_0x1f96fb,_0x14fade*0x3e8,_0x442ef6));};AGIChannel[_0x3cc1('0x23')][_0x3cc1('0x29')]=function(_0x51c7d){_0x51c7d=_0x51c7d||_0x3cc1('0x2a');return this[_0x3cc1('0x25')](util[_0x3cc1('0x28')]('VERBOSE\x20\x22%s\x22',_0x51c7d));};AGIChannel[_0x3cc1('0x23')][_0x3cc1('0x2b')]=function(_0x290202,_0x38b3ad){if(_[_0x3cc1('0x2c')](_0x38b3ad)){return this[_0x3cc1('0x25')](util[_0x3cc1('0x28')]('EXEC\x20%s\x20%s',_0x290202,_0x38b3ad['join'](',')));}return this['sendRequest'](util[_0x3cc1('0x28')](_0x3cc1('0x2d'),_0x290202,_0x38b3ad));};AGIChannel['prototype'][_0x3cc1('0x2e')]=function(_0x2282c6){return this['sendRequest'](util[_0x3cc1('0x28')](_0x3cc1('0x2f'),_0x2282c6));};AGIChannel[_0x3cc1('0x23')][_0x3cc1('0x30')]=function(_0x2b35f2){return this[_0x3cc1('0x25')](util[_0x3cc1('0x28')](_0x3cc1('0x31'),_0x2b35f2));};AGIChannel[_0x3cc1('0x23')]['setPriority']=function(_0x467b2b){return this[_0x3cc1('0x25')](util[_0x3cc1('0x28')]('SET\x20PRIORITY\x20%s',_0x467b2b));};AGIChannel['prototype'][_0x3cc1('0xb')]=function(){return this[_0x3cc1('0x25')](_0x3cc1('0x32'));};AGIChannel[_0x3cc1('0x23')]['setVariable']=function(_0x3ecf2c,_0xc495a1){var _0x3e91a6=_[_0x3cc1('0x33')](_0xc495a1)||_[_0x3cc1('0x34')](_0xc495a1)?_0xc495a1[_0x3cc1('0x35')]():_0xc495a1;return this['sendRequest'](util['format']('SET\x20VARIABLE\x20%s\x20\x22%s\x22',_0x3ecf2c,_0x3e91a6?_0x3e91a6[_0x3cc1('0x35')]()[_0x3cc1('0x12')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x3cc1('0x23')][_0x3cc1('0x36')]=function(_0x5b4c84,_0x417c42){return this[_0x3cc1('0x25')](util[_0x3cc1('0x28')](_0x3cc1('0x37'),_0x5b4c84,_0x417c42));};AGIChannel[_0x3cc1('0x23')][_0x3cc1('0x38')]=function(_0x26555c,_0x508c72){return this[_0x3cc1('0x25')](util['format'](_0x3cc1('0x39'),_0x26555c,_0x508c72));};AGIChannel['prototype'][_0x3cc1('0x3a')]=function(_0x432ec1,_0x3b105d){return this[_0x3cc1('0x25')](util[_0x3cc1('0x28')](_0x3cc1('0x3b'),_0x432ec1,_0x3b105d));};AGIChannel[_0x3cc1('0x23')][_0x3cc1('0x3c')]=function(_0x51c2aa,_0x1d0dce,_0x3e1440){_0x1d0dce=_0x1d0dce||this[_0x3cc1('0x3d')];_0x3e1440=_0x3e1440||0x1;this[_0x3cc1('0x2e')](_0x51c2aa);this['setExtension'](_0x1d0dce);this[_0x3cc1('0x3e')](_0x3e1440);return this[_0x3cc1('0x29')](util['format']('GOTO\x20%s\x20%s\x20%s',_0x51c2aa,_0x1d0dce,_0x3e1440));};AGIChannel[_0x3cc1('0x23')][_0x3cc1('0x3f')]=function(_0x13ec5e){return this[_0x3cc1('0x25')](util[_0x3cc1('0x28')]('GET\x20VARIABLE\x20\x22%s\x22',_0x13ec5e));};AGIChannel['prototype']['recordFile']=function(_0x4fc9f0,_0x3f2626,_0x58dea3,_0x2c533e,_0x47fe9c,_0x33b022){_0x3f2626=_0x3f2626||_0x3cc1('0x40');_0x58dea3=_0x58dea3||'';_0x2c533e=_0x2c533e===undefined?-0x1:_0x2c533e==='-1'?-0x1:_0x2c533e*0x3e8;_0x47fe9c=_0x47fe9c===undefined?'':'s='+_0x47fe9c;_0x33b022=_0x33b022?_0x3cc1('0x41'):'';return this[_0x3cc1('0x25')](util['format'](_0x3cc1('0x42'),_0x4fc9f0,_0x3f2626,_0x58dea3,_0x2c533e,_0x33b022,_0x47fe9c));};AGIChannel['prototype'][_0x3cc1('0x43')]=function(_0x5bb581,_0x33cc86){_0x33cc86=_0x33cc86||'';return this['sendRequest'](util[_0x3cc1('0x28')]('STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22',_0x5bb581,_0x33cc86));};AGIChannel['prototype'][_0x3cc1('0x44')]=function(_0x2b01ae){return this['exec'](_0x3cc1('0x45'),_0x2b01ae);};AGIChannel['prototype'][_0x3cc1('0x46')]=function(_0x52e0f0){return this[_0x3cc1('0x2b')](_0x3cc1('0x47'),_0x52e0f0);};AGIChannel[_0x3cc1('0x23')][_0x3cc1('0x18')]=function(_0x32bb5c,_0x2fda76){this['noop'](util['format'](_0x3cc1('0x48'),_0x32bb5c['id'],_0x32bb5c['label'],_0x2fda76));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x3cc1('0x49')]=AGIChannel; \ No newline at end of file +var _0x272a=['ready','toLowerCase','emit','hangup','substring','520-Invalid','520\x20End\x20of\x20proper','function','no\x20code','indexOf','substr','startsWith','length','match','error','code','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','write','prototype','sendRequest','command','sync','answer','ANSWER','getData','beep','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','VERBOSE\x20\x22%s\x22','isArray','EXEC\x20%s\x20%s','setContext','SET\x20CONTEXT\x20%s','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isBoolean','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','replace','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension','setExtension','GOTO\x20%s\x20%s\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','wav','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','agi','exec','WAIT','label','exports','util','events','EventEmitter','./reply','./error','call','setEncoding','utf8','setTimeout','headers'];(function(_0x9c2427,_0x17c865){var _0x51984f=function(_0x177af6){while(--_0x177af6){_0x9c2427['push'](_0x9c2427['shift']());}};_0x51984f(++_0x17c865);}(_0x272a,0x132));var _0xa272=function(_0x12aa66,_0x2d35c1){_0x12aa66=_0x12aa66-0x0;var _0x53dfe9=_0x272a[_0x12aa66];return _0x53dfe9;};'use strict';var util=require(_0xa272('0x0'));var _=require('lodash');var EventEmitter=require(_0xa272('0x1'))[_0xa272('0x2')];var AGIReply=require(_0xa272('0x3'));var AGIError=require(_0xa272('0x4'));function AGIChannel(_0x353aef){var _0x136299=this,_0x2341a8=new AGIReply(),_0x16d2ff=![],_0x25484e={};EventEmitter[_0xa272('0x5')](_0x136299);_0x353aef[_0xa272('0x6')](_0xa272('0x7'));_0x353aef[_0xa272('0x8')](0x8*0x3c*0x3c*0x3e8);_0x2341a8[_0xa272('0x6')]('utf8');_0x2341a8['on'](_0xa272('0x9'),function(_0x29f8c8){for(var _0x32de49 in _0x29f8c8){_0x136299[_0x32de49]=_0x29f8c8[_0x32de49];}_0x136299['emit'](_0xa272('0xa'));});_0x2341a8['on']('line',function(_0x5e5218){if(_0x5e5218[_0xa272('0xb')]()=='hangup'){_0x136299[_0xa272('0xc')](_0xa272('0xd'));return;}if(_0x5e5218[_0xa272('0xe')](0x0,0xb)==_0xa272('0xf')){_0x16d2ff=!![];}if(_0x16d2ff){_0x25484e['rx']+=_0x5e5218+'\x0a';if(_0x5e5218['search'](_0xa272('0x10'))!=-0x1){_0x16d2ff=![];}}else{_0x25484e['rx']=_0x5e5218;}if(_0x16d2ff){return;}if(typeof _0x25484e['cb']==_0xa272('0x11')){var _0x434b34=_0x25484e['rx']['substring'](0x0,0x3),_0x44f92e=null,_0x461210=null;_0x434b34=parseInt(_0x434b34);if(isNaN(_0x434b34)){_0x25484e['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0xa272('0x12')});return;}if(_0x434b34!=0xc8){_0x25484e['cb'](null,{'code':_0x434b34,'result':-0x1,'extra':'KO'});return;}_0x44f92e=_0x25484e['rx'][_0xa272('0xe')](0x4)['replace']('result=','');if(_0x44f92e[_0xa272('0x13')]('\x20')!=-0x1){_0x44f92e=_0x44f92e[_0xa272('0x14')](0x0,_0x44f92e['indexOf']('\x20'));}if(_[_0xa272('0x15')](_0x44f92e,'-1')){_0x44f92e=parseInt(_0x44f92e);}_0x461210=_0x25484e['rx']['split']('\x20');if(_0x461210[_0xa272('0x16')]==0x3){_0x461210=_0x461210[0x2]['substring'](0x1,_0x461210[0x2][_0xa272('0x16')]-0x1);}else if(_0x461210[_0xa272('0x16')]>0x3){var _0x2b1e9c=/\((.+)\)/;var _0x417213=_0x25484e['rx'][_0xa272('0x17')](_0x2b1e9c);if(_0x417213){_0x461210=_0x417213[0x1];}else{_0x461210=null;}}else{_0x461210=null;}_0x25484e['cb'](null,{'code':_0x434b34,'result':_0x44f92e,'extra':_0x461210});}});_0x353aef['on'](_0xa272('0x18'),function(_0x8406a3){_0x136299[_0xa272('0xc')]('error',new AGIError('E_AGI_SOCKET_ERROR',_0x8406a3[_0xa272('0x19')]));});_0x353aef['on'](_0xa272('0x1a'),function(){_0x136299['emit'](_0xa272('0x1a'),new AGIError(_0xa272('0x1b')));});_0x353aef['on'](_0xa272('0x1c'),function(){_0x136299['emit'](_0xa272('0x1c'),new AGIError(_0xa272('0x1d')));_0x353aef[_0xa272('0x1e')]();});_0x353aef[_0xa272('0x1f')](_0x2341a8);this['command']=function(_0x1e2e24,_0x5e67a9){var _0x1e2e24=_0x1e2e24||'',_0x5e67a9=typeof _0x5e67a9==_0xa272('0x11')?_0x5e67a9:new Function();_0x25484e={'tx':_0x1e2e24,'rx':'','cb':_0x5e67a9};_0x353aef[_0xa272('0x20')](_0x1e2e24+'\x0a');},this[_0xa272('0x1a')]=function(){_0x353aef[_0xa272('0x1e')]();};}util['inherits'](AGIChannel,EventEmitter);AGIChannel[_0xa272('0x21')][_0xa272('0x22')]=function(_0x140e1a){return this[_0xa272('0x23')][_0xa272('0x24')](this,_0x140e1a);};AGIChannel[_0xa272('0x21')][_0xa272('0x25')]=function(){return this[_0xa272('0x22')](_0xa272('0x26'));};AGIChannel[_0xa272('0x21')][_0xa272('0x27')]=function(_0x24004b,_0x14f29e,_0x27af49){_0x24004b=_0x24004b===undefined?_0xa272('0x28'):_0x24004b;_0x14f29e=_0x14f29e===undefined?'5':_0x14f29e;_0x27af49=_0x27af49===undefined?'1':_0x27af49;return this[_0xa272('0x22')](util[_0xa272('0x29')](_0xa272('0x2a'),_0x24004b,_0x14f29e*0x3e8,_0x27af49));};AGIChannel[_0xa272('0x21')][_0xa272('0x2b')]=function(_0x54f19f){_0x54f19f=_0x54f19f||'NO\x20MESSAGE';return this[_0xa272('0x22')](util[_0xa272('0x29')](_0xa272('0x2c'),_0x54f19f));};AGIChannel['prototype']['exec']=function(_0x5a52cd,_0x37d43b){if(_[_0xa272('0x2d')](_0x37d43b)){return this[_0xa272('0x22')](util['format'](_0xa272('0x2e'),_0x5a52cd,_0x37d43b['join'](',')));}return this[_0xa272('0x22')](util['format'](_0xa272('0x2e'),_0x5a52cd,_0x37d43b));};AGIChannel['prototype'][_0xa272('0x2f')]=function(_0x27794e){return this[_0xa272('0x22')](util[_0xa272('0x29')](_0xa272('0x30'),_0x27794e));};AGIChannel[_0xa272('0x21')]['setExtension']=function(_0xac6ed2){return this[_0xa272('0x22')](util[_0xa272('0x29')](_0xa272('0x31'),_0xac6ed2));};AGIChannel[_0xa272('0x21')][_0xa272('0x32')]=function(_0x34e32e){return this['sendRequest'](util[_0xa272('0x29')](_0xa272('0x33'),_0x34e32e));};AGIChannel[_0xa272('0x21')]['hangup']=function(){return this[_0xa272('0x22')](_0xa272('0x34'));};AGIChannel['prototype'][_0xa272('0x35')]=function(_0x2d42b9,_0x56bd8c){var _0x23eb1e=_[_0xa272('0x36')](_0x56bd8c)||_['isNumber'](_0x56bd8c)?_0x56bd8c[_0xa272('0x37')]():_0x56bd8c;return this[_0xa272('0x22')](util[_0xa272('0x29')](_0xa272('0x38'),_0x2d42b9,_0x23eb1e?_0x23eb1e[_0xa272('0x37')]()[_0xa272('0x39')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0xa272('0x21')][_0xa272('0x3a')]=function(_0x5829a6,_0x17254f){return this[_0xa272('0x22')](util[_0xa272('0x29')](_0xa272('0x3b'),_0x5829a6,_0x17254f));};AGIChannel[_0xa272('0x21')][_0xa272('0x3c')]=function(_0x5e6d4b,_0x3d1b72){return this[_0xa272('0x22')](util[_0xa272('0x29')](_0xa272('0x3d'),_0x5e6d4b,_0x3d1b72));};AGIChannel[_0xa272('0x21')][_0xa272('0x3e')]=function(_0x297625,_0x5f3e91){return this[_0xa272('0x22')](util[_0xa272('0x29')](_0xa272('0x3f'),_0x297625,_0x5f3e91));};AGIChannel['prototype'][_0xa272('0x40')]=function(_0x1eda36,_0x52caf0,_0x150750){_0x52caf0=_0x52caf0||this[_0xa272('0x41')];_0x150750=_0x150750||0x1;this[_0xa272('0x2f')](_0x1eda36);this[_0xa272('0x42')](_0x52caf0);this[_0xa272('0x32')](_0x150750);return this[_0xa272('0x2b')](util['format'](_0xa272('0x43'),_0x1eda36,_0x52caf0,_0x150750));};AGIChannel[_0xa272('0x21')][_0xa272('0x44')]=function(_0x2570fe){return this[_0xa272('0x22')](util['format'](_0xa272('0x45'),_0x2570fe));};AGIChannel[_0xa272('0x21')][_0xa272('0x46')]=function(_0x45ac3a,_0x8ce66c,_0x18b5f0,_0x1cd793,_0x5ea34a,_0x5a1ce3){_0x8ce66c=_0x8ce66c||_0xa272('0x47');_0x18b5f0=_0x18b5f0||'';_0x1cd793=_0x1cd793===undefined?-0x1:_0x1cd793==='-1'?-0x1:_0x1cd793*0x3e8;_0x5ea34a=_0x5ea34a===undefined?'':'s='+_0x5ea34a;_0x5a1ce3=_0x5a1ce3?_0xa272('0x48'):'';return this[_0xa272('0x22')](util[_0xa272('0x29')](_0xa272('0x49'),_0x45ac3a,_0x8ce66c,_0x18b5f0,_0x1cd793,_0x5a1ce3,_0x5ea34a));};AGIChannel[_0xa272('0x21')]['streamFile']=function(_0x6e4440,_0x5c96ff){_0x5c96ff=_0x5c96ff||'';return this['sendRequest'](util[_0xa272('0x29')]('STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22',_0x6e4440,_0x5c96ff));};AGIChannel[_0xa272('0x21')][_0xa272('0x4a')]=function(_0x225804){return this[_0xa272('0x4b')]('AGI',_0x225804);};AGIChannel['prototype']['wait']=function(_0x1fcaae){return this[_0xa272('0x4b')](_0xa272('0x4c'),_0x1fcaae);};AGIChannel[_0xa272('0x21')][_0xa272('0x18')]=function(_0x254d45,_0x36fff9){this[_0xa272('0x2b')](util[_0xa272('0x29')]('ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s',_0x254d45['id'],_0x254d45[_0xa272('0x4d')],_0x36fff9));return{'code':0x1f4,'result':'-1','extra':''};};module[_0xa272('0x4e')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index 35ecffc..45aa53e 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 _0x50b1=['[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.entry\x27\x20menu.','push','format','apply','message','name','util','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.'];(function(_0x2a2eb9,_0x27c7df){var _0x54fe9c=function(_0x5f4fe6){while(--_0x5f4fe6){_0x2a2eb9['push'](_0x2a2eb9['shift']());}};_0x54fe9c(++_0x27c7df);}(_0x50b1,0xd9));var _0x150b=function(_0x1a8814,_0xf24880){_0x1a8814=_0x1a8814-0x0;var _0x5d1c71=_0x50b1[_0x1a8814];return _0x5d1c71;};'use strict';var util=require(_0x150b('0x0'));var error={'E_AGI_UNDEFINED':'Undefined\x20error.','E_AGI_ARGUMENT_PORT':_0x150b('0x1'),'E_AGI_SERVER_ERROR':_0x150b('0x2'),'E_AGI_SERVER_CLOSE':_0x150b('0x3'),'E_AGI_SERVER_MAXCONNECTION':_0x150b('0x4'),'E_AGI_SERVER_VOICE_DISABLED':'[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','E_AGI_SOCKET_ERROR':'Socket\x20error.\x20Code:\x20%s.','E_AGI_SOCKET_CLOSE':'Socket\x20closed.','E_AGI_SOCKET_TIMEOUT':_0x150b('0x5'),'E_AGI_COMMAND_EMPTY':_0x150b('0x6'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':'Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_IVR_ENTRY':_0x150b('0x7')};function AGIError(_0x507bc8){var _0x507bc8=_0x507bc8||null,_0x2c7bfa=_0x2c7bfa||[],_0x221354=0x1,_0x406c4d='';if(!error[_0x507bc8]){_0x507bc8='E_AGI_UNDEFINED';}_0x2c7bfa['push'](error[_0x507bc8]);while(arguments[_0x221354]){_0x2c7bfa[_0x150b('0x8')](arguments[_0x221354]);_0x221354++;}_0x406c4d=util[_0x150b('0x9')][_0x150b('0xa')](util,_0x2c7bfa);this[_0x150b('0xb')]=_0x406c4d;this[_0x150b('0xc')]=_0x507bc8;}module['exports']=AGIError; \ No newline at end of file +var _0xf72a=['Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20closed.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_UNDEFINED','push','name','exports','util','Undefined\x20error.'];(function(_0x5ec809,_0x58ba13){var _0x5bbaf1=function(_0x2a2bb1){while(--_0x2a2bb1){_0x5ec809['push'](_0x5ec809['shift']());}};_0x5bbaf1(++_0x58ba13);}(_0xf72a,0x186));var _0xaf72=function(_0x1596e9,_0x1ee4e5){_0x1596e9=_0x1596e9-0x0;var _0x66ce00=_0xf72a[_0x1596e9];return _0x66ce00;};'use strict';var util=require(_0xaf72('0x0'));var error={'E_AGI_UNDEFINED':_0xaf72('0x1'),'E_AGI_ARGUMENT_PORT':'Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','E_AGI_SERVER_ERROR':_0xaf72('0x2'),'E_AGI_SERVER_CLOSE':_0xaf72('0x3'),'E_AGI_SERVER_MAXCONNECTION':_0xaf72('0x4'),'E_AGI_SERVER_VOICE_DISABLED':_0xaf72('0x5'),'E_AGI_SOCKET_ERROR':'Socket\x20error.\x20Code:\x20%s.','E_AGI_SOCKET_CLOSE':_0xaf72('0x6'),'E_AGI_SOCKET_TIMEOUT':_0xaf72('0x7'),'E_AGI_COMMAND_EMPTY':_0xaf72('0x8'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0xaf72('0x9'),'E_AGI_IVR_ENTRY':'Missing\x20\x27ivr.entry\x27\x20menu.'};function AGIError(_0x29c1b5){var _0x29c1b5=_0x29c1b5||null,_0x502995=_0x502995||[],_0x5449f3=0x1,_0x39527e='';if(!error[_0x29c1b5]){_0x29c1b5=_0xaf72('0xa');}_0x502995[_0xaf72('0xb')](error[_0x29c1b5]);while(arguments[_0x5449f3]){_0x502995[_0xaf72('0xb')](arguments[_0x5449f3]);_0x5449f3++;}_0x39527e=util['format']['apply'](util,_0x502995);this['message']=_0x39527e;this[_0xaf72('0xc')]=_0x29c1b5;}module[_0xaf72('0xd')]=AGIError; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index c2a2ed7..c7f694a 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 _0xad5a=['includes','max\x20retry\x20reach','lodash','../../../config/logger','agi','menu','getdigits','vertices','edges','prototype','addEdge','numberOfEdges','size','relations','getVertex','traverseBFS','info','no\x20vertex\x20found','stop\x20traverse','length','no\x20edge/s\x20available','condition','split','agicommand','vswitch','target','invalid','default\x20on\x20switch\x20not\x20found'];(function(_0x91212f,_0x591735){var _0x8de818=function(_0x3eb0f7){while(--_0x3eb0f7){_0x91212f['push'](_0x91212f['shift']());}};_0x8de818(++_0x591735);}(_0xad5a,0x18a));var _0xaad5=function(_0x26dc8d,_0x55902d){_0x26dc8d=_0x26dc8d-0x0;var _0x1687c5=_0xad5a[_0x26dc8d];return _0x1687c5;};'use strict';var _=require(_0xaad5('0x0'));var logger=require(_0xaad5('0x1'))(_0xaad5('0x2'));var verticesWithRetry=[_0xaad5('0x3'),_0xaad5('0x4'),'getsecretdigits'];var Graph=function(){this[_0xaad5('0x5')]={};this[_0xaad5('0x6')]={};this['numberOfEdges']=0x0;};Graph[_0xaad5('0x7')]['addVertex']=function(_0x5aa18b){this[_0xaad5('0x5')][_0x5aa18b['id']]=_0x5aa18b;this[_0xaad5('0x6')][_0x5aa18b['id']]=[];};Graph[_0xaad5('0x7')][_0xaad5('0x8')]=function(_0x4aa5ad,_0xbdd3fd,_0x19f660){this['edges'][_0x4aa5ad]['push']({'target':_0xbdd3fd,'condition':_0x19f660});this[_0xaad5('0x9')]+=0x1;};Graph['prototype'][_0xaad5('0xa')]=function(){return _[_0xaad5('0xa')](this[_0xaad5('0x5')]);};Graph[_0xaad5('0x7')][_0xaad5('0xb')]=function(){return this[_0xaad5('0x9')];};Graph[_0xaad5('0x7')][_0xaad5('0xc')]=function(_0x4d6635){return this[_0xaad5('0x5')][_0x4d6635];};Graph[_0xaad5('0x7')][_0xaad5('0xd')]=function(_0x55ee3d,_0x379e29){if(!this[_0xaad5('0x5')][_0x55ee3d]){return logger[_0xaad5('0xe')](_0xaad5('0xf'));}var _0x70374d=_0x379e29(this[_0xaad5('0x5')][_0x55ee3d]);if(!_0x70374d){return logger[_0xaad5('0xe')](_0xaad5('0x10'));}if(this[_0xaad5('0x6')][_0x55ee3d][_0xaad5('0x11')]===0x0){return logger[_0xaad5('0xe')](_0xaad5('0x12'));}for(var _0x3456af=0x0,_0x1c1a99=[],_0x27a47f=![];_0x3456af\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','dnid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','toJson','mxGraphModel','root','agicommand','hasOwnProperty','retry','maxRetry','addVertex','omit','mxCell','isArray','length','source','target','addEdge','value','getSquareProject','catch','then','indexOf','substring','debug','variables','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','evtHangup','hangup','production','start','joinAt','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','vertex','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','code','result','isUndefined','toString','agicommand\x20not\x20found','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','finally','clear','stringify','[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','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','[LICENSE]','./server','port','listening','connection','lodash','syncho','util','moment','../../config/environment','../../config/logger','../../config/license/util','./rpc','./mailRpc','./vertices','defaults','127.0.0.1','nextTick'];(function(_0x593bce,_0x484075){var _0x4f56c9=function(_0x583a02){while(--_0x583a02){_0x593bce['push'](_0x593bce['shift']());}};_0x4f56c9(++_0x484075);}(_0xc8b4,0x110));var _0x4c8b=function(_0x21f737,_0x408a86){_0x21f737=_0x21f737-0x0;var _0xabb794=_0xc8b4[_0x21f737];return _0xabb794;};'use strict';var parser=require('xml2json');var _=require(_0x4c8b('0x0'));var syncho=require(_0x4c8b('0x1'));var util=require(_0x4c8b('0x2'));var moment=require(_0x4c8b('0x3'));var config=require(_0x4c8b('0x4'));var logger=require(_0x4c8b('0x5'))('agi');var utilLicense=require(_0x4c8b('0x6'));var rpc=require(_0x4c8b('0x7'));var mailRpc=require(_0x4c8b('0x8'));var Graph=require('./graph');var Vertices=require(_0x4c8b('0x9'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config['agi']=_[_0x4c8b('0xa')](config['agi'],{'ip':_0x4c8b('0xb'),'port':0x11dd});function connectionHandler(_0x2726ae){process[_0x4c8b('0xc')](function(){syncho(function(){try{setChannelVariables(_0x2726ae);agiHandler(_0x2726ae);}catch(_0x31deb0){logger[_0x4c8b('0xd')](_0x31deb0['stack']);}});});}function listeningHandler(){console[_0x4c8b('0xe')]('Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!',config[_0x4c8b('0xf')]['port']);logger[_0x4c8b('0x10')](util[_0x4c8b('0x11')](_0x4c8b('0x12'),config[_0x4c8b('0xf')]['ip'],config[_0x4c8b('0xf')]['port']));}function errorHandler(_0x53a28a){if(_0x53a28a&&_0x53a28a['name']&&_0x53a28a[_0x4c8b('0x13')]){logger[_0x4c8b('0xd')](util[_0x4c8b('0x11')](_0x4c8b('0x14'),_0x53a28a[_0x4c8b('0x15')],_0x53a28a['message']));}else{logger['error'](util['format'](_0x4c8b('0x16'),_0x53a28a[_0x4c8b('0x17')]));}}function closeHandler(){logger[_0x4c8b('0x10')](util[_0x4c8b('0x11')](_0x4c8b('0x18'),this[_0x4c8b('0x19')],this[_0x4c8b('0x1a')],this[_0x4c8b('0x1b')],this[_0x4c8b('0x1c')],this[_0x4c8b('0x1d')]));try{createSquareReport(this);}catch(_0x3fe5fe){logger[_0x4c8b('0xd')](_0x3fe5fe[_0x4c8b('0x17')]);}}function timeoutHandler(){logger[_0x4c8b('0x10')](util[_0x4c8b('0x11')](_0x4c8b('0x1e'),this[_0x4c8b('0x19')],this[_0x4c8b('0x1a')],this['callerid'],this[_0x4c8b('0x1c')],this[_0x4c8b('0x1d')]));}function hangupHandler(){logger[_0x4c8b('0x10')](util[_0x4c8b('0x11')](_0x4c8b('0x1f'),this[_0x4c8b('0x19')],this[_0x4c8b('0x1a')],this[_0x4c8b('0x1b')],this['dnid'],this[_0x4c8b('0x1d')]));this['evtHangup']=!![];}function getRoot(_0x5a9567){return parser[_0x4c8b('0x20')](_0x5a9567,{'object':!![]})[_0x4c8b('0x21')][_0x4c8b('0x22')];}function addVertex(_0x14570e,_0x42a0a2,_0x1f5788){_0x42a0a2[_0x4c8b('0x23')]=_0x1f5788;if(_0x42a0a2[_0x4c8b('0x24')](_0x4c8b('0x25'))){_0x42a0a2[_0x4c8b('0x26')]=parseInt(_0x42a0a2[_0x4c8b('0x25')],0xa);}_0x14570e[_0x4c8b('0x27')](_[_0x4c8b('0x28')](_0x42a0a2,_0x4c8b('0x29')));}function initGraph(_0x27b6a5,_0x3f50a3){var _0x132568=new Graph();for(var _0x10be09 in _0x27b6a5){if(_0x27b6a5[_0x4c8b('0x24')](_0x10be09)){if(_[_0x4c8b('0x2a')](_0x27b6a5[_0x10be09])){for(var _0x2e3c3e=0x0;_0x2e3c3e<_0x27b6a5[_0x10be09][_0x4c8b('0x2b')];_0x2e3c3e+=0x1){addVertex(_0x132568,_0x27b6a5[_0x10be09][_0x2e3c3e],_0x10be09);}}else{addVertex(_0x132568,_0x27b6a5[_0x10be09],_0x10be09);}}}for(var _0x4be8f1=0x0;_0x4be8f1<_0x3f50a3['length'];_0x4be8f1+=0x1){if(_0x3f50a3[_0x4be8f1][_0x4c8b('0x2c')]&&_0x3f50a3[_0x4be8f1][_0x4c8b('0x2d')]){_0x132568[_0x4c8b('0x2e')](_0x3f50a3[_0x4be8f1][_0x4c8b('0x2c')],_0x3f50a3[_0x4be8f1][_0x4c8b('0x2d')],_0x3f50a3[_0x4be8f1][_0x4c8b('0x2f')]);}}return _0x132568;}function getSquareProject(_0x166a90,_0x4d4b49){rpc[_0x4c8b('0x30')](_0x166a90)['then'](function(_0x2f3028){_0x4d4b49(null,_0x2f3028);})[_0x4c8b('0x31')](function(_0xf0536a){_0x4d4b49(null,_0xf0536a);});}function createSquareReport(_0x4581f8,_0x2377aa){rpc['createSquareReport'](_0x4581f8)[_0x4c8b('0x32')](function(_0x3c5068){if(_0x2377aa){_0x2377aa(null,_0x3c5068);}})[_0x4c8b('0x31')](function(_0x206811){if(_0x2377aa){_0x2377aa(null,_0x206811);}});}function setChannelVariables(_0x2b731c){for(var _0x2098f4 in _0x2b731c){if(_0x2b731c[_0x4c8b('0x24')](_0x2098f4)){if(_0x2098f4[_0x4c8b('0x33')]('agi_')===0x0){_0x2b731c[_0x2098f4[_0x4c8b('0x34')](0x4)]=_0x2b731c[_0x2098f4];delete _0x2b731c[_0x2098f4];}}}}function getLogFromObject(_0x5c1df3){return util['inspect'](_0x5c1df3,{'showHidden':![],'depth':null});}function agiHandler(_0x3c4696){var _0x23ee0a,_0x429efa,_0x15ef1,_0x531c9f,_0x234b27;logger[_0x4c8b('0x35')](_0x4c8b('0x36'),JSON['stringify'](_0x3c4696,null,0x2));logger['info'](util[_0x4c8b('0x11')](_0x4c8b('0x37'),_0x3c4696[_0x4c8b('0x19')],_0x3c4696['calleridname'],_0x3c4696[_0x4c8b('0x1b')],_0x3c4696[_0x4c8b('0x1c')],_0x3c4696[_0x4c8b('0x1d')]));_0x3c4696['on'](_0x4c8b('0xd'),errorHandler);_0x3c4696['on'](_0x4c8b('0x38'),closeHandler);_0x3c4696['on'](_0x4c8b('0x39'),timeoutHandler);_0x3c4696[_0x4c8b('0x3a')]=![];_0x3c4696['on'](_0x4c8b('0x3b'),hangupHandler);var _0x1bd402=getSquareProject['sync'](null,_0x3c4696['arg_1']);if(_0x1bd402){if(_0x1bd402[_0x4c8b('0x3c')]){_0x23ee0a=getRoot(_0x1bd402['production']);if(_0x23ee0a&&_0x23ee0a[_0x4c8b('0x3d')]){logger[_0x4c8b('0x35')]('root',JSON['stringify'](_0x23ee0a,null,0x2));_0x3c4696[_0x4c8b('0x3e')]=moment()[_0x4c8b('0x11')](_0x4c8b('0x3f'));_0x429efa=initGraph(_[_0x4c8b('0x28')](_0x23ee0a,'mxCell'),_0x23ee0a[_0x4c8b('0x29')]);_0x15ef1=new Vertices(_0x3c4696,rpc,mailRpc);logger[_0x4c8b('0x10')](util['format'](_0x4c8b('0x40'),_0x3c4696['arg_1'],_0x3c4696[_0x4c8b('0x1a')],_0x3c4696['callerid'],_0x3c4696[_0x4c8b('0x1c')],_0x3c4696[_0x4c8b('0x1d')]));_0x429efa[_0x4c8b('0x41')](_0x23ee0a[_0x4c8b('0x3d')]['id'],function(_0x12b1a4){try{_0x12b1a4=_0x15ef1['clear'](_0x12b1a4);logger['debug'](_0x4c8b('0x42'),JSON['stringify'](_0x12b1a4,null,0x2));if(_0x12b1a4[_0x4c8b('0x23')]==='gotoc'){logger[_0x4c8b('0x10')](_0x4c8b('0x43'));_0x3c4696[_0x4c8b('0x44')]=_0x12b1a4[_0x4c8b('0x44')]||_0x3c4696[_0x4c8b('0x44')];_0x3c4696[_0x4c8b('0x45')]=_0x12b1a4['extension'];_0x3c4696[_0x4c8b('0x46')]=_0x12b1a4['priority']?_0x12b1a4[_0x4c8b('0x46')]-0x1:0x1;return null;}else if(_0x12b1a4&&_0x15ef1[_0x12b1a4['agicommand']]){_0x234b27=_0x15ef1[_0x12b1a4[_0x4c8b('0x23')]](_0x12b1a4);logger[_0x4c8b('0x10')](_0x4c8b('0x47'),JSON['stringify'](_0x234b27,null,0x2));if(_0x234b27&&_0x234b27[_0x4c8b('0x48')]===AGI_CODE_SUCCESS&&_0x234b27[_0x4c8b('0x49')]!==AGI_RESULT_ERROR&&!_0x3c4696[_0x4c8b('0x3a')]){logger[_0x4c8b('0x35')](_0x4c8b('0x47'),getLogFromObject(_0x234b27));return _[_0x4c8b('0x4a')](_0x234b27[_0x4c8b('0x49')])?null:_0x234b27[_0x4c8b('0x49')][_0x4c8b('0x4b')]();}else{logger[_0x4c8b('0xd')](_0x4c8b('0x47'),getLogFromObject(_0x234b27));return null;}}else{logger[_0x4c8b('0xd')](_0x4c8b('0x4c'));return null;}}catch(_0x599dc1){logger['error'](_0x599dc1['stack']);return null;}});if(_0x23ee0a['finally']){logger['info'](util[_0x4c8b('0x11')](_0x4c8b('0x4d'),_0x3c4696['arg_1'],_0x3c4696['calleridname'],_0x3c4696[_0x4c8b('0x1b')],_0x3c4696[_0x4c8b('0x1c')],_0x3c4696['uniqueid']));_0x429efa[_0x4c8b('0x41')](_0x23ee0a[_0x4c8b('0x4e')]['id'],function(_0x4d741d){try{_0x4d741d=_0x15ef1[_0x4c8b('0x4f')](_0x4d741d);logger[_0x4c8b('0x35')](_0x4c8b('0x42'),JSON[_0x4c8b('0x50')](_0x4d741d,null,0x2));if(_0x4d741d&&_0x15ef1[_0x4d741d[_0x4c8b('0x23')]]){_0x234b27=_0x15ef1[_0x4d741d[_0x4c8b('0x23')]](_0x4d741d);if(_0x234b27){logger[_0x4c8b('0x35')]('response',getLogFromObject(_0x234b27));return _[_0x4c8b('0x4a')](_0x234b27[_0x4c8b('0x49')])?null:_0x234b27[_0x4c8b('0x49')][_0x4c8b('0x4b')]();}else{logger[_0x4c8b('0xd')](_0x4c8b('0x47'),getLogFromObject(_0x234b27));return null;}}else{logger['error'](_0x4c8b('0x4c'));return null;}}catch(_0x2d3c5e){logger['error'](_0x2d3c5e['stack']);return null;}});}logger[_0x4c8b('0x10')](util[_0x4c8b('0x11')](_0x4c8b('0x51'),_0x3c4696[_0x4c8b('0x19')],_0x3c4696['calleridname'],_0x3c4696[_0x4c8b('0x1b')],_0x3c4696['dnid'],_0x3c4696['uniqueid']));logger[_0x4c8b('0x10')](util[_0x4c8b('0x11')](_0x4c8b('0x52'),_0x3c4696[_0x4c8b('0x44')],_0x3c4696[_0x4c8b('0x45')],parseInt(_0x3c4696[_0x4c8b('0x46')],0xa)+0x1));_0x3c4696[_0x4c8b('0x53')](_0x3c4696['context'],_0x3c4696[_0x4c8b('0x45')],parseInt(_0x3c4696[_0x4c8b('0x46')],0xa)+0x1);_0x3c4696['close']();}}else{logger[_0x4c8b('0xd')](util[_0x4c8b('0x11')](_0x4c8b('0x54'),_0x3c4696[_0x4c8b('0x19')]));_0x3c4696[_0x4c8b('0x53')](_0x3c4696[_0x4c8b('0x44')],_0x3c4696[_0x4c8b('0x45')],parseInt(_0x3c4696[_0x4c8b('0x46')],0xa)+0x1);_0x3c4696['close']();}}else{logger[_0x4c8b('0xd')](util[_0x4c8b('0x11')]('Project\x20%s\x20not\x20found',_0x3c4696['arg_1']));_0x3c4696['continueAt'](_0x3c4696[_0x4c8b('0x44')],_0x3c4696[_0x4c8b('0x45')],parseInt(_0x3c4696[_0x4c8b('0x46')],0xa)+0x1);_0x3c4696[_0x4c8b('0x38')]();}}function main(){var _0x490372;return utilLicense[_0x4c8b('0x55')]()['then'](function(_0x5efb56){if(_0x5efb56){if(_0x5efb56[_0x4c8b('0x56')]){if(_0x5efb56[_0x4c8b('0x57')]&&_0x5efb56['callysquare']>0x0){logger[_0x4c8b('0x10')](util[_0x4c8b('0x11')]('[LICENSE]\x20CHANNELS:\x20%s',_0x5efb56[_0x4c8b('0x57')]));_0x490372=_0x5efb56[_0x4c8b('0x57')];}else{logger['info'](_0x4c8b('0x58'));}}else{logger[_0x4c8b('0x10')](_0x4c8b('0x59'));_0x490372=-0x1;}}})['catch'](function(_0x9e52a6){logger[_0x4c8b('0xd')](_0x4c8b('0x5a'),_0x9e52a6[_0x4c8b('0x17')]);})[_0x4c8b('0x4e')](function(){var _0x19fd51=require(_0x4c8b('0x5b'))(config[_0x4c8b('0xf')][_0x4c8b('0x5c')],config[_0x4c8b('0xf')]['ip'],_0x490372);_0x19fd51['on']('error',errorHandler);_0x19fd51['on'](_0x4c8b('0x5d'),listeningHandler);_0x19fd51['on'](_0x4c8b('0x5e'),connectionHandler);_0x19fd51['on'](_0x4c8b('0x38'),closeHandler);});}main(); \ No newline at end of file +var _0x90eb=['info','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','name','message','[%s]\x20%s','[ERROR]\x20%s','stack','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','callerid','dnid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','toJson','root','hasOwnProperty','maxRetry','retry','addVertex','omit','mxCell','isArray','length','source','addEdge','target','getSquareProject','catch','createSquareReport','then','indexOf','substring','inspect','debug','variables','stringify','close','timeout','hangup','sync','production','start','joinAt','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','vertex','agicommand','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','priority','response','result','evtHangup','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','clear','[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','extension','Project\x20%s\x20not\x20published','continueAt','Project\x20%s\x20not\x20found','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20VOICE\x20IS\x20DISABLED','[LICENSE]','./server','listening','connection','xml2json','syncho','util','moment','../../config/environment','agi','../../config/license/util','./rpc','./mailRpc','./graph','./vertices','defaults','127.0.0.1','nextTick','error','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port'];(function(_0x5aa16a,_0xb4a0c9){var _0x4359c7=function(_0x55de39){while(--_0x55de39){_0x5aa16a['push'](_0x5aa16a['shift']());}};_0x4359c7(++_0xb4a0c9);}(_0x90eb,0x1d3));var _0xb90e=function(_0x45c8db,_0x2fa197){_0x45c8db=_0x45c8db-0x0;var _0x4ecc2e=_0x90eb[_0x45c8db];return _0x4ecc2e;};'use strict';var parser=require(_0xb90e('0x0'));var _=require('lodash');var syncho=require(_0xb90e('0x1'));var util=require(_0xb90e('0x2'));var moment=require(_0xb90e('0x3'));var config=require(_0xb90e('0x4'));var logger=require('../../config/logger')(_0xb90e('0x5'));var utilLicense=require(_0xb90e('0x6'));var rpc=require(_0xb90e('0x7'));var mailRpc=require(_0xb90e('0x8'));var Graph=require(_0xb90e('0x9'));var Vertices=require(_0xb90e('0xa'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0xb90e('0x5')]=_[_0xb90e('0xb')](config[_0xb90e('0x5')],{'ip':_0xb90e('0xc'),'port':0x11dd});function connectionHandler(_0x244872){process[_0xb90e('0xd')](function(){syncho(function(){try{setChannelVariables(_0x244872);agiHandler(_0x244872);}catch(_0xc01ca1){logger[_0xb90e('0xe')](_0xc01ca1['stack']);}});});}function listeningHandler(){console[_0xb90e('0xf')](_0xb90e('0x10'),config[_0xb90e('0x5')][_0xb90e('0x11')]);logger[_0xb90e('0x12')](util[_0xb90e('0x13')](_0xb90e('0x14'),config[_0xb90e('0x5')]['ip'],config[_0xb90e('0x5')][_0xb90e('0x11')]));}function errorHandler(_0x1fa498){if(_0x1fa498&&_0x1fa498[_0xb90e('0x15')]&&_0x1fa498[_0xb90e('0x16')]){logger[_0xb90e('0xe')](util['format'](_0xb90e('0x17'),_0x1fa498[_0xb90e('0x15')],_0x1fa498[_0xb90e('0x16')]));}else{logger[_0xb90e('0xe')](util[_0xb90e('0x13')](_0xb90e('0x18'),_0x1fa498[_0xb90e('0x19')]));}}function closeHandler(){logger[_0xb90e('0x12')](util[_0xb90e('0x13')](_0xb90e('0x1a'),this[_0xb90e('0x1b')],this['calleridname'],this[_0xb90e('0x1c')],this[_0xb90e('0x1d')],this[_0xb90e('0x1e')]));try{createSquareReport(this);}catch(_0x1a582c){logger[_0xb90e('0xe')](_0x1a582c[_0xb90e('0x19')]);}}function timeoutHandler(){logger[_0xb90e('0x12')](util['format'](_0xb90e('0x1f'),this[_0xb90e('0x1b')],this[_0xb90e('0x20')],this[_0xb90e('0x1c')],this['dnid'],this[_0xb90e('0x1e')]));}function hangupHandler(){logger[_0xb90e('0x12')](util[_0xb90e('0x13')](_0xb90e('0x21'),this[_0xb90e('0x1b')],this[_0xb90e('0x20')],this['callerid'],this[_0xb90e('0x1d')],this[_0xb90e('0x1e')]));this['evtHangup']=!![];}function getRoot(_0x2820fe){return parser[_0xb90e('0x22')](_0x2820fe,{'object':!![]})['mxGraphModel'][_0xb90e('0x23')];}function addVertex(_0x4afedb,_0x471c33,_0x43d9fb){_0x471c33['agicommand']=_0x43d9fb;if(_0x471c33[_0xb90e('0x24')]('retry')){_0x471c33[_0xb90e('0x25')]=parseInt(_0x471c33[_0xb90e('0x26')],0xa);}_0x4afedb[_0xb90e('0x27')](_[_0xb90e('0x28')](_0x471c33,_0xb90e('0x29')));}function initGraph(_0x124ffa,_0xeba67e){var _0x2529fc=new Graph();for(var _0x38cd53 in _0x124ffa){if(_0x124ffa[_0xb90e('0x24')](_0x38cd53)){if(_[_0xb90e('0x2a')](_0x124ffa[_0x38cd53])){for(var _0x1fd228=0x0;_0x1fd228<_0x124ffa[_0x38cd53][_0xb90e('0x2b')];_0x1fd228+=0x1){addVertex(_0x2529fc,_0x124ffa[_0x38cd53][_0x1fd228],_0x38cd53);}}else{addVertex(_0x2529fc,_0x124ffa[_0x38cd53],_0x38cd53);}}}for(var _0x1b448e=0x0;_0x1b448e<_0xeba67e[_0xb90e('0x2b')];_0x1b448e+=0x1){if(_0xeba67e[_0x1b448e][_0xb90e('0x2c')]&&_0xeba67e[_0x1b448e]['target']){_0x2529fc[_0xb90e('0x2d')](_0xeba67e[_0x1b448e][_0xb90e('0x2c')],_0xeba67e[_0x1b448e][_0xb90e('0x2e')],_0xeba67e[_0x1b448e]['value']);}}return _0x2529fc;}function getSquareProject(_0x41a345,_0x47d00f){rpc[_0xb90e('0x2f')](_0x41a345)['then'](function(_0x253738){_0x47d00f(null,_0x253738);})[_0xb90e('0x30')](function(_0x39e17d){_0x47d00f(null,_0x39e17d);});}function createSquareReport(_0x558a96,_0x299a46){rpc[_0xb90e('0x31')](_0x558a96)[_0xb90e('0x32')](function(_0x407324){if(_0x299a46){_0x299a46(null,_0x407324);}})[_0xb90e('0x30')](function(_0x17b10a){if(_0x299a46){_0x299a46(null,_0x17b10a);}});}function setChannelVariables(_0x2eae1c){for(var _0xd1b357 in _0x2eae1c){if(_0x2eae1c[_0xb90e('0x24')](_0xd1b357)){if(_0xd1b357[_0xb90e('0x33')]('agi_')===0x0){_0x2eae1c[_0xd1b357[_0xb90e('0x34')](0x4)]=_0x2eae1c[_0xd1b357];delete _0x2eae1c[_0xd1b357];}}}}function getLogFromObject(_0x4d3e19){return util[_0xb90e('0x35')](_0x4d3e19,{'showHidden':![],'depth':null});}function agiHandler(_0x3ea090){var _0x567461,_0xdcff1a,_0x567d5f,_0xb16dba,_0x52181b;logger[_0xb90e('0x36')](_0xb90e('0x37'),JSON[_0xb90e('0x38')](_0x3ea090,null,0x2));logger[_0xb90e('0x12')](util[_0xb90e('0x13')]('[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x3ea090['arg_1'],_0x3ea090['calleridname'],_0x3ea090[_0xb90e('0x1c')],_0x3ea090[_0xb90e('0x1d')],_0x3ea090[_0xb90e('0x1e')]));_0x3ea090['on'](_0xb90e('0xe'),errorHandler);_0x3ea090['on'](_0xb90e('0x39'),closeHandler);_0x3ea090['on'](_0xb90e('0x3a'),timeoutHandler);_0x3ea090['evtHangup']=![];_0x3ea090['on'](_0xb90e('0x3b'),hangupHandler);var _0x25d2d9=getSquareProject[_0xb90e('0x3c')](null,_0x3ea090[_0xb90e('0x1b')]);if(_0x25d2d9){if(_0x25d2d9[_0xb90e('0x3d')]){_0x567461=getRoot(_0x25d2d9[_0xb90e('0x3d')]);if(_0x567461&&_0x567461[_0xb90e('0x3e')]){logger['debug'](_0xb90e('0x23'),JSON[_0xb90e('0x38')](_0x567461,null,0x2));_0x3ea090[_0xb90e('0x3f')]=moment()[_0xb90e('0x13')](_0xb90e('0x40'));_0xdcff1a=initGraph(_[_0xb90e('0x28')](_0x567461,_0xb90e('0x29')),_0x567461[_0xb90e('0x29')]);_0x567d5f=new Vertices(_0x3ea090,rpc,mailRpc);logger['info'](util[_0xb90e('0x13')](_0xb90e('0x41'),_0x3ea090['arg_1'],_0x3ea090[_0xb90e('0x20')],_0x3ea090[_0xb90e('0x1c')],_0x3ea090[_0xb90e('0x1d')],_0x3ea090[_0xb90e('0x1e')]));_0xdcff1a[_0xb90e('0x42')](_0x567461[_0xb90e('0x3e')]['id'],function(_0x3aaaaa){try{_0x3aaaaa=_0x567d5f['clear'](_0x3aaaaa);logger[_0xb90e('0x36')](_0xb90e('0x43'),JSON[_0xb90e('0x38')](_0x3aaaaa,null,0x2));if(_0x3aaaaa[_0xb90e('0x44')]===_0xb90e('0x45')){logger['info'](_0xb90e('0x46'));_0x3ea090[_0xb90e('0x47')]=_0x3aaaaa[_0xb90e('0x47')]||_0x3ea090['context'];_0x3ea090['extension']=_0x3aaaaa['extension'];_0x3ea090['priority']=_0x3aaaaa[_0xb90e('0x48')]?_0x3aaaaa[_0xb90e('0x48')]-0x1:0x1;return null;}else if(_0x3aaaaa&&_0x567d5f[_0x3aaaaa[_0xb90e('0x44')]]){_0x52181b=_0x567d5f[_0x3aaaaa[_0xb90e('0x44')]](_0x3aaaaa);logger[_0xb90e('0x12')](_0xb90e('0x49'),JSON[_0xb90e('0x38')](_0x52181b,null,0x2));if(_0x52181b&&_0x52181b['code']===AGI_CODE_SUCCESS&&_0x52181b[_0xb90e('0x4a')]!==AGI_RESULT_ERROR&&!_0x3ea090[_0xb90e('0x4b')]){logger[_0xb90e('0x36')](_0xb90e('0x49'),getLogFromObject(_0x52181b));return _[_0xb90e('0x4c')](_0x52181b[_0xb90e('0x4a')])?null:_0x52181b['result'][_0xb90e('0x4d')]();}else{logger[_0xb90e('0xe')]('response',getLogFromObject(_0x52181b));return null;}}else{logger[_0xb90e('0xe')](_0xb90e('0x4e'));return null;}}catch(_0x40b48b){logger[_0xb90e('0xe')](_0x40b48b[_0xb90e('0x19')]);return null;}});if(_0x567461[_0xb90e('0x4f')]){logger[_0xb90e('0x12')](util[_0xb90e('0x13')](_0xb90e('0x50'),_0x3ea090['arg_1'],_0x3ea090[_0xb90e('0x20')],_0x3ea090['callerid'],_0x3ea090['dnid'],_0x3ea090[_0xb90e('0x1e')]));_0xdcff1a[_0xb90e('0x42')](_0x567461[_0xb90e('0x4f')]['id'],function(_0x83412a){try{_0x83412a=_0x567d5f[_0xb90e('0x51')](_0x83412a);logger['debug'](_0xb90e('0x43'),JSON[_0xb90e('0x38')](_0x83412a,null,0x2));if(_0x83412a&&_0x567d5f[_0x83412a[_0xb90e('0x44')]]){_0x52181b=_0x567d5f[_0x83412a[_0xb90e('0x44')]](_0x83412a);if(_0x52181b){logger[_0xb90e('0x36')](_0xb90e('0x49'),getLogFromObject(_0x52181b));return _['isUndefined'](_0x52181b['result'])?null:_0x52181b[_0xb90e('0x4a')]['toString']();}else{logger['error'](_0xb90e('0x49'),getLogFromObject(_0x52181b));return null;}}else{logger[_0xb90e('0xe')](_0xb90e('0x4e'));return null;}}catch(_0x35464e){logger['error'](_0x35464e['stack']);return null;}});}logger[_0xb90e('0x12')](util[_0xb90e('0x13')](_0xb90e('0x52'),_0x3ea090[_0xb90e('0x1b')],_0x3ea090[_0xb90e('0x20')],_0x3ea090[_0xb90e('0x1c')],_0x3ea090[_0xb90e('0x1d')],_0x3ea090[_0xb90e('0x1e')]));logger['info'](util[_0xb90e('0x13')](_0xb90e('0x53'),_0x3ea090[_0xb90e('0x47')],_0x3ea090[_0xb90e('0x54')],parseInt(_0x3ea090[_0xb90e('0x48')],0xa)+0x1));_0x3ea090['continueAt'](_0x3ea090[_0xb90e('0x47')],_0x3ea090[_0xb90e('0x54')],parseInt(_0x3ea090[_0xb90e('0x48')],0xa)+0x1);_0x3ea090['close']();}}else{logger[_0xb90e('0xe')](util['format'](_0xb90e('0x55'),_0x3ea090[_0xb90e('0x1b')]));_0x3ea090[_0xb90e('0x56')](_0x3ea090[_0xb90e('0x47')],_0x3ea090[_0xb90e('0x54')],parseInt(_0x3ea090['priority'],0xa)+0x1);_0x3ea090[_0xb90e('0x39')]();}}else{logger[_0xb90e('0xe')](util[_0xb90e('0x13')](_0xb90e('0x57'),_0x3ea090['arg_1']));_0x3ea090[_0xb90e('0x56')](_0x3ea090[_0xb90e('0x47')],_0x3ea090[_0xb90e('0x54')],parseInt(_0x3ea090[_0xb90e('0x48')],0xa)+0x1);_0x3ea090['close']();}}function main(){var _0x588cfc;return utilLicense[_0xb90e('0x58')]()[_0xb90e('0x32')](function(_0x33f025){if(_0x33f025){if(_0x33f025[_0xb90e('0x59')]){if(_0x33f025['callysquare']&&_0x33f025[_0xb90e('0x5a')]>0x0){logger['info'](util['format'](_0xb90e('0x5b'),_0x33f025[_0xb90e('0x5a')]));_0x588cfc=_0x33f025['callysquare'];}else{logger[_0xb90e('0x12')]('[LICENSE]\x20CHANNELS:\x20UNLIMITED');}}else{logger['info'](_0xb90e('0x5c'));_0x588cfc=-0x1;}}})[_0xb90e('0x30')](function(_0x310968){logger['error'](_0xb90e('0x5d'),_0x310968[_0xb90e('0x19')]);})['finally'](function(){var _0x2270da=require(_0xb90e('0x5e'))(config['agi'][_0xb90e('0x11')],config[_0xb90e('0x5')]['ip'],_0x588cfc);_0x2270da['on'](_0xb90e('0xe'),errorHandler);_0x2270da['on'](_0xb90e('0x5f'),listeningHandler);_0x2270da['on'](_0xb90e('0x60'),connectionHandler);_0x2270da['on'](_0xb90e('0x39'),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 c733941..d1c1e7b 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 _0x3400=['http','request','then','error','catch','sendMailMessage','SendMail','bluebird'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x3400,0x19f));var _0x0340=function(_0x1030ce,_0xbe3f74){_0x1030ce=_0x1030ce-0x0;var _0x3367fd=_0x3400[_0x1030ce];return _0x3367fd;};'use strict';var BPromise=require(_0x0340('0x0'));var jayson=require('jayson/promise');var client=jayson['client'][_0x0340('0x1')]({'port':0x232b});function request(_0x17f458,_0x256063){return new BPromise(function(_0x15e442,_0x164924){return client[_0x0340('0x2')](_0x17f458,_0x256063)[_0x0340('0x3')](function(_0x3a1243){if(_0x3a1243[_0x0340('0x4')]){return _0x164924(_0x3a1243[_0x0340('0x4')]['message']);}else{return _0x15e442(_0x3a1243['result']);}})[_0x0340('0x5')](function(_0x270711){return _0x164924(_0x270711);});});}exports[_0x0340('0x6')]=function(_0x4f4b6a,_0x240c90){return request(_0x0340('0x7'),{'account':_0x4f4b6a,'message':_0x240c90});}; \ No newline at end of file +var _0xb0b1=['request','then','error','message','result','catch','SendMail'];(function(_0x4d1de5,_0x34415f){var _0x30d4ef=function(_0x190e54){while(--_0x190e54){_0x4d1de5['push'](_0x4d1de5['shift']());}};_0x30d4ef(++_0x34415f);}(_0xb0b1,0x93));var _0x1b0b=function(_0x13e5c7,_0x2f2e91){_0x13e5c7=_0x13e5c7-0x0;var _0x5d211f=_0xb0b1[_0x13e5c7];return _0x5d211f;};'use strict';var BPromise=require('bluebird');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232b});function request(_0x4724f3,_0x5c9228){return new BPromise(function(_0xa2ee50,_0x3bb77f){return client[_0x1b0b('0x0')](_0x4724f3,_0x5c9228)[_0x1b0b('0x1')](function(_0x34b6a7){if(_0x34b6a7[_0x1b0b('0x2')]){return _0x3bb77f(_0x34b6a7[_0x1b0b('0x2')][_0x1b0b('0x3')]);}else{return _0xa2ee50(_0x34b6a7[_0x1b0b('0x4')]);}})[_0x1b0b('0x5')](function(_0x147c0b){return _0x3bb77f(_0x147c0b);});});}exports['sendMailMessage']=function(_0x16128a,_0x5720c7){return request(_0x1b0b('0x6'),{'account':_0x16128a,'message':_0x5720c7});}; \ No newline at end of file diff --git a/server/services/agi/reply.js b/server/services/agi/reply.js index 37acd8f..9994e4b 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 _0x9c00=['inherits','prototype','_transform','\x0d\x0a\x0d\x0a','toString','_inBody','indexOf','substring','length','split','slice','trim','emit','headers','line','exports','util','stream','call','_localBuffer'];(function(_0x10e80a,_0x37bc49){var _0xc600ee=function(_0x9494a4){while(--_0x9494a4){_0x10e80a['push'](_0x10e80a['shift']());}};_0xc600ee(++_0x37bc49);}(_0x9c00,0x1a0));var _0x09c0=function(_0x152405,_0x5e8952){_0x152405=_0x152405-0x0;var _0x46647a=_0x9c00[_0x152405];return _0x46647a;};'use strict';var util=require(_0x09c0('0x0'));var Transform=require(_0x09c0('0x1'))['Transform'];function AGIReply(_0x5e32e7){Transform[_0x09c0('0x2')](this,_0x5e32e7);this[_0x09c0('0x3')]='';this['_inBody']=![];}util[_0x09c0('0x4')](AGIReply,Transform);AGIReply[_0x09c0('0x5')][_0x09c0('0x6')]=function(_0x2fd03e,_0x1cbf99,_0x5914eb){var _0x4d5fc3='\x0a',_0x1f3d7e=['\x0a\x0a',_0x09c0('0x7')],_0x17d11f=-0x1,_0x1b633b=-0x1,_0x3187aa='',_0x17cd9d=0x0,_0x49487a='',_0x6558ca='';this[_0x09c0('0x3')]+=_0x2fd03e[_0x09c0('0x8')]();_0x49487a=this[_0x09c0('0x3')];if(!this[_0x09c0('0x9')]){_0x17cd9d=0x0;while(_0x1f3d7e[_0x17cd9d]){while((_0x1b633b=_0x49487a[_0x09c0('0xa')](_0x1f3d7e[_0x17cd9d]))!=-0x1){_0x3187aa=_0x1f3d7e[_0x17cd9d];_0x6558ca=_0x49487a[_0x09c0('0xb')](0x0,_0x1b633b);_0x49487a=_0x49487a[_0x09c0('0xb')](_0x1b633b+_0x3187aa[_0x09c0('0xc')]);var _0x179b1b=_0x6558ca[_0x09c0('0xd')](_0x4d5fc3),_0x2a8262=0x0,_0x2929f1={},_0x144271='',_0x3b95cc='',_0x331905=-0x1;while(_0x179b1b[_0x2a8262]){_0x331905=_0x179b1b[_0x2a8262][_0x09c0('0xa')](':');if(_0x331905!=-0x1){_0x144271=_0x179b1b[_0x2a8262][_0x09c0('0xe')](0x0,_0x331905)[_0x09c0('0xf')]();_0x3b95cc=_0x179b1b[_0x2a8262][_0x09c0('0xe')](_0x331905+0x1)[_0x09c0('0xf')]();if(_0x144271[_0x09c0('0xc')]>0x0){_0x2929f1[_0x144271]=_0x3b95cc;}}else{}_0x2a8262++;}this[_0x09c0('0x10')](_0x09c0('0x11'),_0x2929f1);this[_0x09c0('0x9')]=!![];}_0x17cd9d++;}this['_localBuffer']=_0x49487a;}else{while((_0x17d11f=_0x49487a['indexOf'](_0x4d5fc3))!=-0x1){_0x6558ca=_0x49487a['substring'](0x0,_0x17d11f);this[_0x09c0('0x10')](_0x09c0('0x12'),_0x6558ca);_0x49487a=_0x49487a[_0x09c0('0xb')](_0x17d11f+_0x4d5fc3[_0x09c0('0xc')]);}this['_localBuffer']=_0x49487a;}_0x5914eb();};module[_0x09c0('0x13')]=AGIReply; \ No newline at end of file +var _0x7834=['prototype','_transform','\x0d\x0a\x0d\x0a','toString','indexOf','substring','length','slice','trim','emit','headers','line','exports','util','_localBuffer','_inBody','inherits'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x7834,0x13f));var _0x4783=function(_0x1a8b2d,_0x3e430a){_0x1a8b2d=_0x1a8b2d-0x0;var _0x64034a=_0x7834[_0x1a8b2d];return _0x64034a;};'use strict';var util=require(_0x4783('0x0'));var Transform=require('stream')['Transform'];function AGIReply(_0x3b8f45){Transform['call'](this,_0x3b8f45);this[_0x4783('0x1')]='';this[_0x4783('0x2')]=![];}util[_0x4783('0x3')](AGIReply,Transform);AGIReply[_0x4783('0x4')][_0x4783('0x5')]=function(_0x3ebf06,_0x4150f2,_0x49114c){var _0x1cb674='\x0a',_0xf8c030=['\x0a\x0a',_0x4783('0x6')],_0x518da8=-0x1,_0x2dcf46=-0x1,_0x16c83e='',_0x36c0a7=0x0,_0x112a19='',_0xc8b2d7='';this['_localBuffer']+=_0x3ebf06[_0x4783('0x7')]();_0x112a19=this[_0x4783('0x1')];if(!this[_0x4783('0x2')]){_0x36c0a7=0x0;while(_0xf8c030[_0x36c0a7]){while((_0x2dcf46=_0x112a19[_0x4783('0x8')](_0xf8c030[_0x36c0a7]))!=-0x1){_0x16c83e=_0xf8c030[_0x36c0a7];_0xc8b2d7=_0x112a19[_0x4783('0x9')](0x0,_0x2dcf46);_0x112a19=_0x112a19[_0x4783('0x9')](_0x2dcf46+_0x16c83e[_0x4783('0xa')]);var _0x5b8428=_0xc8b2d7['split'](_0x1cb674),_0x4ef2c7=0x0,_0x1a40c0={},_0x85087d='',_0x4ce944='',_0x2afbdc=-0x1;while(_0x5b8428[_0x4ef2c7]){_0x2afbdc=_0x5b8428[_0x4ef2c7][_0x4783('0x8')](':');if(_0x2afbdc!=-0x1){_0x85087d=_0x5b8428[_0x4ef2c7][_0x4783('0xb')](0x0,_0x2afbdc)[_0x4783('0xc')]();_0x4ce944=_0x5b8428[_0x4ef2c7][_0x4783('0xb')](_0x2afbdc+0x1)[_0x4783('0xc')]();if(_0x85087d['length']>0x0){_0x1a40c0[_0x85087d]=_0x4ce944;}}else{}_0x4ef2c7++;}this[_0x4783('0xd')](_0x4783('0xe'),_0x1a40c0);this[_0x4783('0x2')]=!![];}_0x36c0a7++;}this[_0x4783('0x1')]=_0x112a19;}else{while((_0x518da8=_0x112a19[_0x4783('0x8')](_0x1cb674))!=-0x1){_0xc8b2d7=_0x112a19[_0x4783('0x9')](0x0,_0x518da8);this[_0x4783('0xd')](_0x4783('0xf'),_0xc8b2d7);_0x112a19=_0x112a19[_0x4783('0x9')](_0x518da8+_0x1cb674[_0x4783('0xa')]);}this[_0x4783('0x1')]=_0x112a19;}_0x49114c();};module[_0x4783('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 2e2671e..d92de04 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 _0x58f5=['then','error','message','result','catch','getSquareProject','ShowSquareProject','getMailAccountById','MailServerOut','Smtp','name','email','getSquareProjectById','getVariableById','getSquareOdbcById','ShowSquareOdbc','ShowTrunk','getSoundById','save_name','getIntervalById','Interval','Intervals','getSmsAccountById','ShowSmsAccount','createSmsMessage','CreateSmsMessage','CreateSquareDetailsReport','CreateSquareReport','merge','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ShowCmHopper','phone','ListId','getPauseById','ShowPause','agentLogin','PauseUser','agentUnpause','UnpauseUser','agentLogout','LogoutUser','bluebird','moment','lodash','util','http'];(function(_0x277293,_0x5655a2){var _0x1452aa=function(_0x17d1c2){while(--_0x17d1c2){_0x277293['push'](_0x277293['shift']());}};_0x1452aa(++_0x5655a2);}(_0x58f5,0x1e1));var _0x558f=function(_0x412470,_0x429827){_0x412470=_0x412470-0x0;var _0x50232e=_0x58f5[_0x412470];return _0x50232e;};'use strict';var BPromise=require(_0x558f('0x0'));var moment=require(_0x558f('0x1'));var _=require(_0x558f('0x2'));var util=require(_0x558f('0x3'));var jayson=require('jayson/promise');var client=jayson['client'][_0x558f('0x4')]({'port':0x2329});function request(_0x206aa4,_0x5cb92d){return new BPromise(function(_0x462d9a,_0x257e5e){return client['request'](_0x206aa4,_0x5cb92d)[_0x558f('0x5')](function(_0x3653e7){if(_0x3653e7['error']){return _0x257e5e(_0x3653e7[_0x558f('0x6')][_0x558f('0x7')]);}else{return _0x462d9a(_0x3653e7[_0x558f('0x8')]);}})[_0x558f('0x9')](function(_0x54c879){return _0x257e5e(_0x54c879);});});}exports[_0x558f('0xa')]=function(_0x40d4c8){return request(_0x558f('0xb'),{'options':{'raw':![],'where':{'name':_0x40d4c8},'attributes':['production']}});};exports[_0x558f('0xc')]=function(_0x3b9e2b){return request('ShowMailAccount',{'options':{'raw':![],'where':{'id':_0x3b9e2b},'include':[{'model':_0x558f('0xd'),'as':_0x558f('0xe')}],'attributes':['id',_0x558f('0xf'),_0x558f('0x10')]}});};exports[_0x558f('0x11')]=function(_0x57548f){return request('ShowSquareProject',{'options':{'where':{'id':_0x57548f},'attributes':[_0x558f('0xf')]}});};exports['getVoiceQueueById']=function(_0x182d5b){return request('ShowVoiceQueue',{'options':{'where':{'id':_0x182d5b},'attributes':[_0x558f('0xf')]}});};exports[_0x558f('0x12')]=function(_0x18357a){return request('ShowVariable',{'options':{'where':{'id':_0x18357a},'attributes':[_0x558f('0xf')]}});};exports[_0x558f('0x13')]=function(_0x1aa446){return request(_0x558f('0x14'),{'options':{'where':{'id':_0x1aa446},'attributes':['dsn']}});};exports['getUserById']=function(_0x1bc43d){return request('ShowUser',{'options':{'where':{'id':_0x1bc43d},'attributes':[_0x558f('0xf')]}});};exports['getTrunkById']=function(_0x145bb5){return request(_0x558f('0x15'),{'options':{'where':{'id':_0x145bb5},'attributes':[_0x558f('0xf')]}});};exports[_0x558f('0x16')]=function(_0x4e9b01){return request('ShowSound',{'options':{'where':{'id':_0x4e9b01},'attributes':[_0x558f('0x17')]}});};exports[_0x558f('0x18')]=function(_0x4e577b){return request('ShowInterval',{'options':{'raw':![],'where':{'id':_0x4e577b},'include':[{'model':_0x558f('0x19'),'as':_0x558f('0x1a')}]}});};exports[_0x558f('0x1b')]=function(_0x4b8ee2){return request(_0x558f('0x1c'),{'options':{'where':{'id':_0x4b8ee2},'attributes':['id',_0x558f('0xf')]}});};exports[_0x558f('0x1d')]=function(_0x38a60c){return request(_0x558f('0x1e'),{'body':_0x38a60c});};exports['createSquareDetailsReport']=function(_0x247c40){return request(_0x558f('0x1f'),{'body':_0x247c40});};exports['createSquareReport']=function(_0x51309a){return request(_0x558f('0x20'),{'body':_[_0x558f('0x21')](_0x51309a,{'project_name':_0x51309a[_0x558f('0x22')],'prev_project_name':_0x51309a[_0x558f('0x23')]||'','is_subproject':_0x51309a[_0x558f('0x23')]?!![]:![],'leaveAt':moment()[_0x558f('0x24')](_0x558f('0x25'))})});};exports[_0x558f('0x26')]=function(_0x1f12c6){return request(_0x558f('0x27'),{'body':_0x1f12c6});};exports[_0x558f('0x28')]=function(_0x485b22){return request(_0x558f('0x29'),{'body':_0x485b22});};exports[_0x558f('0x2a')]=function(_0x148728){return request(_0x558f('0x2b'),{'options':{'raw':![],'where':{'phone':_0x148728[_0x558f('0x2c')],'ListId':_0x148728[_0x558f('0x2d')]}}})[_0x558f('0x5')](function(_0xb6e38c){if(_0xb6e38c){return _0xb6e38c;}return request('CreateCmContact',{'body':_0x148728});});};exports[_0x558f('0x2e')]=function(_0x3cb1bf){return request(_0x558f('0x2f'),{'options':{'where':{'id':_0x3cb1bf},'attributes':[_0x558f('0xf')]}});};exports[_0x558f('0x30')]=function(_0x406d08,_0x51d8fc){return request('LoginUser',{'body':{'interface':_0x51d8fc},'options':{'where':_0x406d08}});};exports['agentPause']=function(_0x496865,_0x531e16,_0x2ea565){return request(_0x558f('0x31'),{'body':{'type':_0x531e16,'uniqueid':_0x2ea565},'options':{'where':_0x496865}});};exports[_0x558f('0x32')]=function(_0x3b6c33){return request(_0x558f('0x33'),{'body':{},'options':{'where':_0x3b6c33}});};exports[_0x558f('0x34')]=function(_0x3a4ad7){return request(_0x558f('0x35'),{'body':{},'options':{'where':_0x3a4ad7}});}; \ No newline at end of file +var _0x33da=['getSquareProjectById','getVoiceQueueById','ShowVoiceQueue','ShowVariable','getSquareOdbcById','ShowSquareOdbc','dsn','getUserById','getTrunkById','ShowTrunk','getSoundById','getIntervalById','ShowInterval','Interval','getSmsAccountById','ShowSmsAccount','createSmsMessage','CreateSmsMessage','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_1','arg_2','format','createSquareRecording','CreateSquareMessage','createCmContact','ShowCmHopper','phone','ListId','then','getPauseById','ShowPause','agentLogin','LoginUser','agentPause','PauseUser','agentUnpause','UnpauseUser','LogoutUser','bluebird','moment','util','client','http','request','error','message','result','catch','getSquareProject','ShowSquareProject','production','MailServerOut','Smtp','name'];(function(_0x5ecfc0,_0x2b1d77){var _0x2f0385=function(_0x1f5593){while(--_0x1f5593){_0x5ecfc0['push'](_0x5ecfc0['shift']());}};_0x2f0385(++_0x2b1d77);}(_0x33da,0xd4));var _0xa33d=function(_0x1d39f6,_0x146f4a){_0x1d39f6=_0x1d39f6-0x0;var _0x3dbd7a=_0x33da[_0x1d39f6];return _0x3dbd7a;};'use strict';var BPromise=require(_0xa33d('0x0'));var moment=require(_0xa33d('0x1'));var _=require('lodash');var util=require(_0xa33d('0x2'));var jayson=require('jayson/promise');var client=jayson[_0xa33d('0x3')][_0xa33d('0x4')]({'port':0x2329});function request(_0x3ca4aa,_0x46c55b){return new BPromise(function(_0x18df75,_0x24f340){return client[_0xa33d('0x5')](_0x3ca4aa,_0x46c55b)['then'](function(_0x4017ac){if(_0x4017ac[_0xa33d('0x6')]){return _0x24f340(_0x4017ac['error'][_0xa33d('0x7')]);}else{return _0x18df75(_0x4017ac[_0xa33d('0x8')]);}})[_0xa33d('0x9')](function(_0x91c5d6){return _0x24f340(_0x91c5d6);});});}exports[_0xa33d('0xa')]=function(_0x25266a){return request(_0xa33d('0xb'),{'options':{'raw':![],'where':{'name':_0x25266a},'attributes':[_0xa33d('0xc')]}});};exports['getMailAccountById']=function(_0x3800a5){return request('ShowMailAccount',{'options':{'raw':![],'where':{'id':_0x3800a5},'include':[{'model':_0xa33d('0xd'),'as':_0xa33d('0xe')}],'attributes':['id',_0xa33d('0xf'),'email']}});};exports[_0xa33d('0x10')]=function(_0x472764){return request(_0xa33d('0xb'),{'options':{'where':{'id':_0x472764},'attributes':[_0xa33d('0xf')]}});};exports[_0xa33d('0x11')]=function(_0x14abc4){return request(_0xa33d('0x12'),{'options':{'where':{'id':_0x14abc4},'attributes':['name']}});};exports['getVariableById']=function(_0x426247){return request(_0xa33d('0x13'),{'options':{'where':{'id':_0x426247},'attributes':[_0xa33d('0xf')]}});};exports[_0xa33d('0x14')]=function(_0x4b7a70){return request(_0xa33d('0x15'),{'options':{'where':{'id':_0x4b7a70},'attributes':[_0xa33d('0x16')]}});};exports[_0xa33d('0x17')]=function(_0x1391f7){return request('ShowUser',{'options':{'where':{'id':_0x1391f7},'attributes':[_0xa33d('0xf')]}});};exports[_0xa33d('0x18')]=function(_0x44dc32){return request(_0xa33d('0x19'),{'options':{'where':{'id':_0x44dc32},'attributes':['name']}});};exports[_0xa33d('0x1a')]=function(_0x5c2e2c){return request('ShowSound',{'options':{'where':{'id':_0x5c2e2c},'attributes':['save_name']}});};exports[_0xa33d('0x1b')]=function(_0x4e9b90){return request(_0xa33d('0x1c'),{'options':{'raw':![],'where':{'id':_0x4e9b90},'include':[{'model':_0xa33d('0x1d'),'as':'Intervals'}]}});};exports[_0xa33d('0x1e')]=function(_0x4acfd6){return request(_0xa33d('0x1f'),{'options':{'where':{'id':_0x4acfd6},'attributes':['id',_0xa33d('0xf')]}});};exports[_0xa33d('0x20')]=function(_0x54ddb0){return request(_0xa33d('0x21'),{'body':_0x54ddb0});};exports['createSquareDetailsReport']=function(_0x518e76){return request(_0xa33d('0x22'),{'body':_0x518e76});};exports[_0xa33d('0x23')]=function(_0x2d3bd3){return request(_0xa33d('0x24'),{'body':_[_0xa33d('0x25')](_0x2d3bd3,{'project_name':_0x2d3bd3[_0xa33d('0x26')],'prev_project_name':_0x2d3bd3['arg_2']||'','is_subproject':_0x2d3bd3[_0xa33d('0x27')]?!![]:![],'leaveAt':moment()[_0xa33d('0x28')]('YYYY-MM-DD\x20HH:mm:ss')})});};exports[_0xa33d('0x29')]=function(_0x58f132){return request('CreateSquareRecording',{'body':_0x58f132});};exports['createSquareMessage']=function(_0x3c67eb){return request(_0xa33d('0x2a'),{'body':_0x3c67eb});};exports[_0xa33d('0x2b')]=function(_0xa0dd56){return request(_0xa33d('0x2c'),{'options':{'raw':![],'where':{'phone':_0xa0dd56[_0xa33d('0x2d')],'ListId':_0xa0dd56[_0xa33d('0x2e')]}}})[_0xa33d('0x2f')](function(_0x182271){if(_0x182271){return _0x182271;}return request('CreateCmContact',{'body':_0xa0dd56});});};exports[_0xa33d('0x30')]=function(_0x287ced){return request(_0xa33d('0x31'),{'options':{'where':{'id':_0x287ced},'attributes':[_0xa33d('0xf')]}});};exports[_0xa33d('0x32')]=function(_0x37f786,_0x4ec975){return request(_0xa33d('0x33'),{'body':{'interface':_0x4ec975},'options':{'where':_0x37f786}});};exports[_0xa33d('0x34')]=function(_0x15897c,_0x1f4ea7,_0x48a065){return request(_0xa33d('0x35'),{'body':{'type':_0x1f4ea7,'uniqueid':_0x48a065},'options':{'where':_0x15897c}});};exports[_0xa33d('0x36')]=function(_0x182d29){return request(_0xa33d('0x37'),{'body':{},'options':{'where':_0x182d29}});};exports['agentLogout']=function(_0x3fb1d6){return request(_0xa33d('0x38'),{'body':{},'options':{'where':_0x3fb1d6}});}; \ 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 c2281e2..787c02f 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 _0x199c=['exports'];(function(_0x4b8021,_0x11dd37){var _0x36d34d=function(_0x53767a){while(--_0x53767a){_0x4b8021['push'](_0x4b8021['shift']());}};_0x36d34d(++_0x11dd37);}(_0x199c,0x1d8));var _0xc199=function(_0x358176,_0xc6fbb2){_0x358176=_0x358176-0x0;var _0xd0d366=_0x199c[_0x358176];return _0xd0d366;};var polly=require('./polly');var lex=require('./lex');module[_0xc199('0x0')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0xc1c6=['exports','./polly','./lex'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc1c6,0xf7));var _0x6c1c=function(_0x1ab30e,_0xf5cb91){_0x1ab30e=_0x1ab30e-0x0;var _0x4f0a10=_0xc1c6[_0x1ab30e];return _0x4f0a10;};var polly=require(_0x6c1c('0x0'));var lex=require(_0x6c1c('0x1'));module[_0x6c1c('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 be498f4..94c30d8 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 _0x6e6c=['exports','./lib/api'];(function(_0xdd82b4,_0x5cd8b8){var _0x549bb2=function(_0x426fd9){while(--_0x426fd9){_0xdd82b4['push'](_0xdd82b4['shift']());}};_0x549bb2(++_0x5cd8b8);}(_0x6e6c,0xc3));var _0xc6e6=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x6e6c[_0x2dafbe];return _0x58a45a;};'use strict';var lex=require(_0xc6e6('0x0'));module[_0xc6e6('0x1')]=function(_0x545f2c,_0x370b21,_0x1b63fe,_0x58f303,_0x550e47,_0x2e97f5){return lex(_0x545f2c,_0x370b21,_0x1b63fe,_0x58f303,_0x550e47,_0x2e97f5);}; \ No newline at end of file +var _0xee5b=['./lib/api'];(function(_0x3afac0,_0x249f5e){var _0x4772d3=function(_0x1136fa){while(--_0x1136fa){_0x3afac0['push'](_0x3afac0['shift']());}};_0x4772d3(++_0x249f5e);}(_0xee5b,0x1f4));var _0xbee5=function(_0x5cbed9,_0x56d5a9){_0x5cbed9=_0x5cbed9-0x0;var _0xbd6339=_0xee5b[_0x5cbed9];return _0xbd6339;};'use strict';var lex=require(_0xbee5('0x0'));module['exports']=function(_0x7b2344,_0x203bba,_0x4f850a,_0x1893e4,_0x2b93c2,_0x2eb857){return lex(_0x7b2344,_0x203bba,_0x4f850a,_0x1893e4,_0x2b93c2,_0x2eb857);}; \ 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 82e079a..510aa92 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(_0x319339,_0x231534){var _0x4691fc=function(_0xe0678){while(--_0xe0678){_0x319339['push'](_0x319339['shift']());}};_0x4691fc(++_0x231534);}(_0xa9e0,0x123));var _0x0a9e=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0xa9e0[_0x25bea7];return _0x175952;};'use strict';var BPromise=require(_0x0a9e('0x0'));var AWS=require(_0x0a9e('0x1'));function lexResult(_0x29929c,_0x5dd881){return new BPromise(function(_0x550fbc,_0x18d5c9){_0x29929c['postText'](_0x5dd881,function(_0x333808,_0x432180){if(_0x333808){_0x18d5c9(_0x333808);}if(_0x432180[_0x0a9e('0x2')]){for(const _0x991246 in _0x432180[_0x0a9e('0x2')]){if(_0x432180['slots'][_0x0a9e('0x3')](_0x991246)){var _0x441e3a=_0x432180[_0x0a9e('0x2')][_0x991246];_0x432180['slot_'+_0x991246]=_0x441e3a;}}}_0x550fbc(_0x432180);});});}module['exports']=function(_0xe42b77,_0x56465b,_0x52cace,_0x39753a,_0xf81284,_0x307b3e){var _0x3ab53f=new AWS[(_0x0a9e('0x4'))]({'accessKeyId':_0x56465b,'secretAccessKey':_0x52cace,'region':_0x39753a});var _0xbd1168={'botAlias':'$LATEST','botName':_0x307b3e,'inputText':_0xf81284,'userId':_0xe42b77};return lexResult(_0x3ab53f,_0xbd1168);}; \ No newline at end of file +var _0xa9e0=['LexRuntime','bluebird','aws-sdk','slots','hasOwnProperty'];(function(_0x47ba29,_0x4058fc){var _0x415b5f=function(_0x5b2841){while(--_0x5b2841){_0x47ba29['push'](_0x47ba29['shift']());}};_0x415b5f(++_0x4058fc);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4e1d03,_0x786f3a){_0x4e1d03=_0x4e1d03-0x0;var _0x362d4b=_0xa9e0[_0x4e1d03];return _0x362d4b;};'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 28e1f50..2836a70 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 _0x51b7=['./lib/api','exports'];(function(_0x38cb82,_0xf4145e){var _0xa6db3a=function(_0x1073d1){while(--_0x1073d1){_0x38cb82['push'](_0x38cb82['shift']());}};_0xa6db3a(++_0xf4145e);}(_0x51b7,0xbc));var _0x751b=function(_0x4caa2d,_0xce8ed9){_0x4caa2d=_0x4caa2d-0x0;var _0x55832c=_0x51b7[_0x4caa2d];return _0x55832c;};'use strict';var polly=require(_0x751b('0x0'));module[_0x751b('0x1')]=function(_0x2e128d,_0x4e277e,_0x4ffc7c,_0x3e3d6b,_0x294335,_0x59fe18,_0x5b8075){return polly(_0x2e128d,_0x4e277e,_0x4ffc7c,_0x3e3d6b,_0x294335,_0x59fe18,_0x5b8075);}; \ No newline at end of file +var _0xca29=['./lib/api'];(function(_0x427352,_0x1bce61){var _0x23e0e6=function(_0x2a42a9){while(--_0x2a42a9){_0x427352['push'](_0x427352['shift']());}};_0x23e0e6(++_0x1bce61);}(_0xca29,0x1c5));var _0x9ca2=function(_0x1030ce,_0xbe3f74){_0x1030ce=_0x1030ce-0x0;var _0x3367fd=_0xca29[_0x1030ce];return _0x3367fd;};'use strict';var polly=require(_0x9ca2('0x0'));module['exports']=function(_0x50767e,_0x3ab8a5,_0x841a3,_0x1b7907,_0x2ca9e1,_0x47fab7,_0x576d9d){return polly(_0x50767e,_0x3ab8a5,_0x841a3,_0x1b7907,_0x2ca9e1,_0x47fab7,_0x576d9d);}; \ 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 24c7501..615324b 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 _0xf89e=['text','mp3','path','bluebird','randomstring','aws-sdk','AudioStream','writeFile','Polly'];(function(_0x4dc011,_0x4a1f65){var _0x33b37e=function(_0x2f23dd){while(--_0x2f23dd){_0x4dc011['push'](_0x4dc011['shift']());}};_0x33b37e(++_0x4a1f65);}(_0xf89e,0xfe));var _0xef89=function(_0x402a68,_0x4d844b){_0x402a68=_0x402a68-0x0;var _0x533d65=_0xf89e[_0x402a68];return _0x533d65;};'use strict';var fs=require('fs');var path=require(_0xef89('0x0'));var BPromise=require(_0xef89('0x1'));var rs=require(_0xef89('0x2'));var AWS=require(_0xef89('0x3'));function pollyResult(_0x38f42b,_0x5eef60,_0x1238e1){return new BPromise(function(_0x52a419,_0x3f287e){_0x38f42b['synthesizeSpeech'](_0x5eef60,function(_0x2bdbd7,_0x4f82ee){if(_0x2bdbd7){_0x3f287e(_0x2bdbd7);}else if(_0x4f82ee){if(_0x4f82ee[_0xef89('0x4')]instanceof Buffer){fs[_0xef89('0x5')](_0x1238e1,_0x4f82ee[_0xef89('0x4')],function(_0x135bf9){if(_0x135bf9){_0x3f287e(_0x135bf9);}else{_0x52a419();}});}else{_0x3f287e(new Error('Invalid\x20data\x20response\x20from\x20aws\x20Polly!'));}}else{_0x3f287e(new Error('No\x20data\x20response\x20from\x20aws\x20Polly!'));}});});}module['exports']=function(_0x6026b6,_0x2b263c,_0xd75b72,_0xbfb464,_0x6e3216,_0x5f328d,_0x45e10f){var _0x367873=new AWS[(_0xef89('0x6'))]({'accessKeyId':_0x6026b6,'secretAccessKey':_0x2b263c,'region':_0xd75b72});var _0x2ef29a={'Text':_0x6e3216,'TextType':_0x5f328d||_0xef89('0x7'),'OutputFormat':_0xef89('0x8'),'VoiceId':_0xbfb464};return pollyResult(_0x367873,_0x2ef29a,_0x45e10f);}; \ No newline at end of file +var _0xfac3=['aws-sdk','synthesizeSpeech','AudioStream','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','bluebird','randomstring'];(function(_0x2bbbd5,_0x19e89e){var _0x1c2522=function(_0x14d932){while(--_0x14d932){_0x2bbbd5['push'](_0x2bbbd5['shift']());}};_0x1c2522(++_0x19e89e);}(_0xfac3,0x1c9));var _0x3fac=function(_0x410d89,_0x3cf96a){_0x410d89=_0x410d89-0x0;var _0x3680fe=_0xfac3[_0x410d89];return _0x3680fe;};'use strict';var fs=require('fs');var path=require('path');var BPromise=require(_0x3fac('0x0'));var rs=require(_0x3fac('0x1'));var AWS=require(_0x3fac('0x2'));function pollyResult(_0x28d7d3,_0x2eaed1,_0x269f31){return new BPromise(function(_0x15a781,_0x26243a){_0x28d7d3[_0x3fac('0x3')](_0x2eaed1,function(_0x194da1,_0x578ae9){if(_0x194da1){_0x26243a(_0x194da1);}else if(_0x578ae9){if(_0x578ae9[_0x3fac('0x4')]instanceof Buffer){fs['writeFile'](_0x269f31,_0x578ae9['AudioStream'],function(_0x196b62){if(_0x196b62){_0x26243a(_0x196b62);}else{_0x15a781();}});}else{_0x26243a(new Error(_0x3fac('0x5')));}}else{_0x26243a(new Error(_0x3fac('0x6')));}});});}module[_0x3fac('0x7')]=function(_0x17a38e,_0x42217a,_0x33b74f,_0x48ff05,_0x270a6c,_0x16b395,_0x359f70){var _0x11280a=new AWS[(_0x3fac('0x8'))]({'accessKeyId':_0x17a38e,'secretAccessKey':_0x42217a,'region':_0x33b74f});var _0x1a73e3={'Text':_0x270a6c,'TextType':_0x16b395||'text','OutputFormat':'mp3','VoiceId':_0x48ff05};return pollyResult(_0x11280a,_0x1a73e3,_0x359f70);}; \ 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 4b97a84..826f402 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 _0xf79f=['exports','./lib/api'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf79f,0x8f));var _0xff79=function(_0x1baef6,_0x104b34){_0x1baef6=_0x1baef6-0x0;var _0x5f34a6=_0xf79f[_0x1baef6];return _0x5f34a6;};'use strict';var asr=require(_0xff79('0x0'));module[_0xff79('0x1')]=function(_0x22c56e,_0x1a9ab2,_0xc55842,_0x334596){return asr(_0x22c56e,_0x1a9ab2,_0xc55842);}; \ No newline at end of file +var _0x6b66=['exports','./lib/api'];(function(_0x458d94,_0x1f76c4){var _0x52f237=function(_0x333bdc){while(--_0x333bdc){_0x458d94['push'](_0x458d94['shift']());}};_0x52f237(++_0x1f76c4);}(_0x6b66,0x12f));var _0x66b6=function(_0x4f9c26,_0x98ab50){_0x4f9c26=_0x4f9c26-0x0;var _0x265624=_0x6b66[_0x4f9c26];return _0x265624;};'use strict';var asr=require(_0x66b6('0x0'));module[_0x66b6('0x1')]=function(_0x5e7d59,_0x517946,_0x3f5c03,_0x55df32){return asr(_0x5e7d59,_0x517946,_0x3f5c03);}; \ 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 a661ddc..eb45fd8 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 _0x688a=['filepath\x20should\x20be\x20a\x20string','lang\x20should\x20be\x20a\x20string','base64','/v1/speech:recognize?key=','LINEAR16','8000','url','bluebird','https://speech.googleapis.com','string','length'];(function(_0x156f57,_0x4137da){var _0x4e5cbd=function(_0x131639){while(--_0x131639){_0x156f57['push'](_0x156f57['shift']());}};_0x4e5cbd(++_0x4137da);}(_0x688a,0x124));var _0xa688=function(_0x2df6b3,_0x5eee69){_0x2df6b3=_0x2df6b3-0x0;var _0x31b3ff=_0x688a[_0x2df6b3];return _0x31b3ff;};'use strict';var url=require(_0xa688('0x0'));var BPromise=require(_0xa688('0x1'));var fs=require('fs');var host=_0xa688('0x2');module['exports']=function(_0x43356d,_0x53646f,_0x27bb04){return new BPromise(function(_0x7a3442,_0x517509){var _0x4a9122;if(typeof _0x43356d!==_0xa688('0x3')||_0x43356d[_0xa688('0x4')]===0x0){return _0x517509(_0xa688('0x5'));}if(typeof _0x53646f!==_0xa688('0x3')||_0x53646f[_0xa688('0x4')]===0x0){return _0x517509('key\x20should\x20be\x20a\x20string');}if(typeof _0x27bb04!=='undefined'&&(typeof _0x27bb04!==_0xa688('0x3')||_0x27bb04[_0xa688('0x4')]===0x0)){return _0x517509(_0xa688('0x6'));}try{_0x4a9122=fs['readFileSync'](_0x43356d)['toString'](_0xa688('0x7'));}catch(_0x5ce966){return _0x517509(_0x5ce966);}return _0x7a3442({'method':'POST','uri':host+_0xa688('0x8')+_0x53646f,'body':{'config':{'encoding':_0xa688('0x9'),'sampleRateHertz':_0xa688('0xa'),'languageCode':_0x27bb04},'audio':{'content':_0x4a9122}},'json':!![]});});}; \ No newline at end of file +var _0xcb91=['lang\x20should\x20be\x20a\x20string','base64','POST','/v1/speech:recognize?key=','LINEAR16','https://speech.googleapis.com','exports','string','length','undefined'];(function(_0x2d78a4,_0x362f5){var _0x38d29a=function(_0x314265){while(--_0x314265){_0x2d78a4['push'](_0x2d78a4['shift']());}};_0x38d29a(++_0x362f5);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x4d613c,_0x55f220){_0x4d613c=_0x4d613c-0x0;var _0x301fe3=_0xcb91[_0x4d613c];return _0x301fe3;};'use strict';var url=require('url');var BPromise=require('bluebird');var fs=require('fs');var host=_0x1cb9('0x0');module[_0x1cb9('0x1')]=function(_0x17d4ec,_0x22c4b8,_0x4c37e8){return new BPromise(function(_0x8c392f,_0x2c17b8){var _0x545a34;if(typeof _0x17d4ec!==_0x1cb9('0x2')||_0x17d4ec[_0x1cb9('0x3')]===0x0){return _0x2c17b8('filepath\x20should\x20be\x20a\x20string');}if(typeof _0x22c4b8!==_0x1cb9('0x2')||_0x22c4b8[_0x1cb9('0x3')]===0x0){return _0x2c17b8('key\x20should\x20be\x20a\x20string');}if(typeof _0x4c37e8!==_0x1cb9('0x4')&&(typeof _0x4c37e8!==_0x1cb9('0x2')||_0x4c37e8['length']===0x0)){return _0x2c17b8(_0x1cb9('0x5'));}try{_0x545a34=fs['readFileSync'](_0x17d4ec)['toString'](_0x1cb9('0x6'));}catch(_0x2fa15c){return _0x2c17b8(_0x2fa15c);}return _0x8c392f({'method':_0x1cb9('0x7'),'uri':host+_0x1cb9('0x8')+_0x22c4b8,'body':{'config':{'encoding':_0x1cb9('0x9'),'sampleRateHertz':'8000','languageCode':_0x4c37e8},'audio':{'content':_0x545a34}},'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 5ef69df..c1c6fa4 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 _0xc03c=['./asr','exports'];(function(_0xc2c0c3,_0x2bf8a9){var _0x292acf=function(_0x192b73){while(--_0x192b73){_0xc2c0c3['push'](_0xc2c0c3['shift']());}};_0x292acf(++_0x2bf8a9);}(_0xc03c,0x1f2));var _0xcc03=function(_0x580647,_0x43d2c3){_0x580647=_0x580647-0x0;var _0x5f0792=_0xc03c[_0x580647];return _0x5f0792;};var asr=require(_0xcc03('0x0'));module[_0xcc03('0x1')]={'asr':asr}; \ No newline at end of file +var _0xeac7=['exports'];(function(_0x178668,_0x1ec300){var _0x26107d=function(_0x4c0aa8){while(--_0x4c0aa8){_0x178668['push'](_0x178668['shift']());}};_0x26107d(++_0x1ec300);}(_0xeac7,0x163));var _0x7eac=function(_0x17e7f1,_0x22f761){_0x17e7f1=_0x17e7f1-0x0;var _0x1367a9=_0xeac7[_0x17e7f1];return _0x1367a9;};var asr=require('./asr');module[_0x7eac('0x0')]={'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 5eeaaab..aebf319 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 _0x6a54=['CustomActionData','AudioFromTts','Data','audiofile','dirName','apiai-promise','dialogflow','http','https','path','querystring','request-promise','randomstring','sox','google-tts-api','url','parse','util','./google','./sestek','./tilde','../../../config/logger','https://api.ispeech.org/api/rest','protocol','https:','host','WHAT_EVER','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusCode','statusMessage','createWriteStream','finish','finish\x20download\x20file','close','unlink','download\x20error','pipe','get','data','end','transcode','wav','info','start','resolve','generate','.wav','writeFileSync','base64','then','chmodSync','777','toString','googleCloudTTS','?key=','ssml','input','voice','MP3','text:synthesize','POST','tmp','.mp3','from','audioContent','writeFile','googleCloudTTS\x20path','split','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','application/x-www-form-urlencoded','f.req=','stringify','jQ1olc','null','generic','slice','parse\x20response\x20failed:\x0a','length','lang\x20\x22','\x22\x20might\x20not\x20exist','goggleTTS\x20path','googleASR','asr','uri','results','map','alternatives','join','confidence','googleASR\x20transcription','googleASR\x20confidence','catch','[%s]\x20%s:%s','name','message','textRequest','result','source','resolvedQuery','action','fulfillment','speech','score','status','code','metadata','endConversation','isFallbackIntent','googleDialogflowV2','SessionsClient','sessionPath','Dialogflow\x20V2\x20response:','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','end_conversation','boolValue','intent','displayName','isFallback','languageCode','responseId','fulfillmentText','tildeASR','Tilde\x20ASR\x20transcription','transcript','Tilde\x20ASR\x20confidence','awsPolly','polly','awsLex','lex','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','freeform=3','nda','channelData'];(function(_0x4c578e,_0x185b58){var _0x805133=function(_0x55c54f){while(--_0x55c54f){_0x4c578e['push'](_0x4c578e['shift']());}};_0x805133(++_0x185b58);}(_0x6a54,0x1b2));var _0x46a5=function(_0x5c67a0,_0xa059e7){_0x5c67a0=_0x5c67a0-0x0;var _0x38ce0c=_0x6a54[_0x5c67a0];return _0x38ce0c;};'use strict';var apiai=require(_0x46a5('0x0'));var BPromise=require('bluebird');var dialogflow=require(_0x46a5('0x1'));var fs=require('fs');var http=require(_0x46a5('0x2'));var https=require(_0x46a5('0x3'));var md5=require('md5');var path=require(_0x46a5('0x4'));var querystring=require(_0x46a5('0x5'));var rp=require(_0x46a5('0x6'));var rs=require(_0x46a5('0x7'));var sox=require(_0x46a5('0x8'));var tts=require(_0x46a5('0x9'));var urlParse=require(_0x46a5('0xa'))[_0x46a5('0xb')];var util=require(_0x46a5('0xc'));var aws=require('./aws');var google=require(_0x46a5('0xd'));var sestek=require(_0x46a5('0xe'));var tilde=require(_0x46a5('0xf'));var logger=require(_0x46a5('0x10'))('agi');var ISPEECH_API=_0x46a5('0x11');function downloadFile(_0x419bd7,_0x21ca09){return new BPromise(function(_0x1d0a30,_0x168dd8){var _0x37f9db=urlParse(_0x419bd7);var _0xd8e3c6=_0x37f9db[_0x46a5('0x12')]===_0x46a5('0x13')?https:http;var _0x2216bc={'host':_0x37f9db[_0x46a5('0x14')],'path':_0x37f9db['path'],'headers':{'user-agent':_0x46a5('0x15')}};_0xd8e3c6['get'](_0x2216bc,function(_0x196e81){if(_0x196e81['statusCode']!==0xc8){logger[_0x46a5('0x16')](_0x46a5('0x17')+_0x419bd7+_0x46a5('0x18')+_0x196e81[_0x46a5('0x19')]+'\x20('+_0x196e81[_0x46a5('0x1a')]+')');_0x168dd8(new Error(_0x46a5('0x17')+_0x419bd7+_0x46a5('0x18')+_0x196e81['statusCode']+'\x20('+_0x196e81[_0x46a5('0x1a')]+')'));return;}var _0x16ba0c=fs[_0x46a5('0x1b')](_0x21ca09);_0x16ba0c['on'](_0x46a5('0x1c'),function(){logger['info'](_0x46a5('0x1d'));_0x16ba0c[_0x46a5('0x1e')](_0x1d0a30);});_0x16ba0c['on'](_0x46a5('0x16'),function(_0x53820b){fs[_0x46a5('0x1f')](_0x21ca09);logger[_0x46a5('0x16')](_0x46a5('0x20'),_0x53820b);_0x168dd8(_0x53820b);});_0x196e81[_0x46a5('0x21')](_0x16ba0c);})['on'](_0x46a5('0x16'),function(_0x67d74e){logger[_0x46a5('0x16')](_0x67d74e);_0x168dd8(_0x67d74e);})['end']();});}function uploadFile(_0x1b8bba){return new BPromise(function(_0x5c4374,_0x523f52){var _0xfa1749=urlParse(_0x1b8bba);var _0x1c3ea8=_0xfa1749[_0x46a5('0x12')]===_0x46a5('0x13')?https:http;var _0x5d2a93={'host':_0xfa1749[_0x46a5('0x14')],'path':_0xfa1749[_0x46a5('0x4')],'headers':{'user-agent':_0x46a5('0x15')}};_0x1c3ea8[_0x46a5('0x22')](_0x5d2a93,function(_0x2e0de0){if(_0x2e0de0['statusCode']!==0xc8){_0x523f52(new Error(_0x46a5('0x17')+_0x1b8bba+_0x46a5('0x18')+_0x2e0de0['statusCode']+'\x20('+_0x2e0de0[_0x46a5('0x1a')]+')'));return;}var _0x222580='';_0x2e0de0['on'](_0x46a5('0x23'),function(_0x1a8b5e){_0x222580+=_0x1a8b5e;});_0x2e0de0['on'](_0x46a5('0x24'),function(){_0x5c4374(_0x222580);});})['on'](_0x46a5('0x16'),function(_0x30c7f8){_0x523f52(_0x30c7f8);})[_0x46a5('0x24')]();});}function convertFile(_0xa2c1e3,_0x54cc97){return new BPromise(function(_0xf7f2b3,_0x33656d){var _0x34ad41=sox[_0x46a5('0x25')](_0xa2c1e3,_0x54cc97,{'sampleRate':0x1f40,'format':_0x46a5('0x26'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x34ad41['on'](_0x46a5('0x16'),function(_0x2ecb6b){logger[_0x46a5('0x16')]('error\x20convert',_0x2ecb6b);_0x33656d(_0x2ecb6b);});_0x34ad41['on']('end',function(){logger[_0x46a5('0x27')]('finish\x20to\x20convert');_0xf7f2b3();});_0x34ad41[_0x46a5('0x28')]();});}function base64Decode(_0x44e8b4,_0x2aef27){var _0x25f0be=path[_0x46a5('0x29')](__dirname,'tmp',rs[_0x46a5('0x2a')](0x4)+_0x46a5('0x2b'));fs[_0x46a5('0x2c')](_0x25f0be,_0x44e8b4,_0x46a5('0x2d'));return convertFile(_0x25f0be,_0x2aef27)[_0x46a5('0x2e')](function(){try{fs['unlink'](_0x25f0be);fs[_0x46a5('0x2f')](_0x2aef27,_0x46a5('0x30'));}catch(_0x139f93){logger[_0x46a5('0x16')](_0x139f93);}return _0x2aef27['split']('.')[0x0];});}function base64Encode(_0x3d08e8){var _0x520552=fs['readFileSync'](_0x3d08e8);return new Buffer(_0x520552)[_0x46a5('0x31')]('base64');}exports[_0x46a5('0x32')]=function(_0x67bcb9,_0x3df7f2,_0x4fba08,_0x28406c,_0x4b96f7,_0x257298){var _0x3df431,_0x5d879b;var _0x57f394='https://texttospeech.googleapis.com/v1/';var _0x2952b6=_0x46a5('0x33')+_0x67bcb9;var _0x48e290={};if(_0x3df7f2===_0x46a5('0x34')){_0x48e290[_0x46a5('0x35')]={'ssml':_0x4fba08};}else{_0x48e290['input']={'text':_0x4fba08};};_0x48e290[_0x46a5('0x36')]={'languageCode':_0x28406c,'ssmlGender':_0x4b96f7};_0x48e290['audioConfig']={'audioEncoding':_0x46a5('0x37'),'sampleRateHertz':0x1f40};var _0x1a5a1d={'url':_0x57f394+_0x46a5('0x38')+_0x2952b6,'method':_0x46a5('0x39'),'json':!![],'body':_0x48e290};return rp(_0x1a5a1d)[_0x46a5('0x2e')](function(_0x3a4566){return new BPromise(function(_0x5a1af2,_0x2219ed){_0x3df431=path[_0x46a5('0x29')](__dirname,_0x46a5('0x3a'),rs[_0x46a5('0x2a')](0x4)+_0x46a5('0x3b'));var _0x2a8fa3=Buffer[_0x46a5('0x3c')](_0x3a4566[_0x46a5('0x3d')],_0x46a5('0x2d'));return fs[_0x46a5('0x3e')](_0x3df431,_0x2a8fa3,function(_0x38b9ab){_0x2219ed(_0x38b9ab);},function(_0x29c0d8){fs[_0x46a5('0x2f')](_0x3df431,'777');_0x5a1af2(_0x29c0d8);});});})[_0x46a5('0x2e')](function(_0x441f32){_0x5d879b=path[_0x46a5('0x29')](__dirname,'tmp',rs['generate'](0x4)+'.wav');return convertFile(_0x3df431,_0x5d879b);})[_0x46a5('0x2e')](function(){try{fs[_0x46a5('0x1f')](_0x3df431);fs[_0x46a5('0x2f')](_0x5d879b,_0x46a5('0x30'));}catch(_0x3df03d){logger[_0x46a5('0x16')](_0x3df03d);}logger[_0x46a5('0x27')](_0x46a5('0x3f'),_0x5d879b['split']('.')[0x0]);return _0x5d879b[_0x46a5('0x40')]('.')[0x0];});};exports[_0x46a5('0x41')]=function(_0x328152,_0xb311f5){var _0x37b500=_0x46a5('0x42');var _0x1b8dab,_0x2bd2fd;var _0x44323c;var _0x2fdbb9={'encoding':_0x46a5('0x43'),'method':_0x46a5('0x39'),'timeout':0x2710,'url':_0x37b500,'headers':{'Content-Type':_0x46a5('0x44')},'body':_0x46a5('0x45')+encodeURIComponent(JSON[_0x46a5('0x46')]([[[_0x46a5('0x47'),JSON[_0x46a5('0x46')]([_0x328152,_0xb311f5||'en',![],_0x46a5('0x48')]),null,_0x46a5('0x49')]]]))};return rp(_0x2fdbb9)[_0x46a5('0x2e')](function(_0x1913c3){try{_0x44323c=eval(_0x1913c3[_0x46a5('0x4a')](0x5))[0x0][0x2];}catch(_0x186b12){throw new Error(_0x46a5('0x4b')+_0x1913c3[_0x46a5('0x23')]);}if(!_0x44323c){if(_0x328152[_0x46a5('0x4c')]>0xc8){throw new Error('text\x20length\x20limit\x20reached');}else{throw new Error(_0x46a5('0x4d')+_0xb311f5+_0x46a5('0x4e'));}}try{_0x44323c=eval(_0x44323c)[0x0];}catch(_0x83e3c3){throw new Error(_0x46a5('0x4b')+res[_0x46a5('0x23')]);}const _0x5b9e0e=_0x44323c;_0x1b8dab=path[_0x46a5('0x29')](__dirname,'tmp',rs[_0x46a5('0x2a')](0x4)+_0x46a5('0x3b'));fs[_0x46a5('0x2c')](_0x1b8dab,_0x44323c,{'encoding':_0x46a5('0x2d')});_0x2bd2fd=path[_0x46a5('0x29')](__dirname,_0x46a5('0x3a'),rs[_0x46a5('0x2a')](0x4)+_0x46a5('0x2b'));return convertFile(_0x1b8dab,_0x2bd2fd);})['then'](function(){try{fs[_0x46a5('0x1f')](_0x1b8dab);fs[_0x46a5('0x2f')](_0x2bd2fd,_0x46a5('0x30'));}catch(_0x5200e9){logger['error'](_0x5200e9);}logger[_0x46a5('0x27')](_0x46a5('0x4f'),_0x2bd2fd['split']('.')[0x0]);return _0x2bd2fd['split']('.')[0x0];});};exports[_0x46a5('0x50')]=function(_0x4b5044,_0x3a4a1f,_0x32289e){return google[_0x46a5('0x51')](_0x4b5044,_0x3a4a1f,_0x32289e)[_0x46a5('0x2e')](function(_0x40eef5){logger[_0x46a5('0x27')](_0x40eef5[_0x46a5('0x52')]);return rp(_0x40eef5);})['then'](function(_0x5cf688){var _0x18efe8='';var _0x39c25d=0x0;try{fs[_0x46a5('0x1f')](_0x4b5044);}catch(_0x179c9f){logger[_0x46a5('0x16')](_0x179c9f);}if(_0x5cf688&&_0x5cf688[_0x46a5('0x53')]){_0x18efe8=_0x5cf688[_0x46a5('0x53')][_0x46a5('0x54')](function(_0x4d4640){return _0x4d4640&&_0x4d4640[_0x46a5('0x55')][0x0]&&_0x4d4640['alternatives'][0x0]['transcript']?_0x4d4640[_0x46a5('0x55')][0x0]['transcript']:'';})[_0x46a5('0x56')]('\x0a');_0x39c25d=_0x5cf688[_0x46a5('0x53')][_0x46a5('0x54')](function(_0x3ef0cb){return _0x3ef0cb&&_0x3ef0cb[_0x46a5('0x55')][0x0]&&_0x3ef0cb['alternatives'][0x0][_0x46a5('0x57')]?_0x3ef0cb['alternatives'][0x0][_0x46a5('0x57')]:0x0;})[_0x46a5('0x56')]('\x0a');}logger[_0x46a5('0x27')](_0x46a5('0x58'),_0x18efe8);logger[_0x46a5('0x27')](_0x46a5('0x59'),_0x39c25d);return{'transcript':_0x18efe8,'confidence':_0x39c25d};})[_0x46a5('0x5a')](function(_0x37fc2e){logger[_0x46a5('0x16')](_0x46a5('0x5b'),_0x37fc2e[_0x46a5('0x19')],_0x37fc2e[_0x46a5('0x5c')],_0x37fc2e[_0x46a5('0x5d')]);});};exports['googleDialogflow']=function(_0x2b8745,_0x2d967d,_0x2e80fd,_0x2fbf0e){var _0x56e544=apiai(_0x2d967d,{'language':_0x2fbf0e||'en'});return _0x56e544[_0x46a5('0x5e')](_0x2e80fd,{'sessionId':md5(_0x2b8745)})[_0x46a5('0x2e')](function(_0x462301){logger['info'](JSON[_0x46a5('0x46')](_0x462301));return{'source':_0x462301[_0x46a5('0x5f')][_0x46a5('0x60')],'resolvedQuery':_0x462301[_0x46a5('0x5f')][_0x46a5('0x61')],'action':_0x462301[_0x46a5('0x5f')][_0x46a5('0x62')],'actionIncomplete':_0x462301[_0x46a5('0x5f')]['actionIncomplete'],'speech':_0x462301[_0x46a5('0x5f')][_0x46a5('0x63')][_0x46a5('0x64')],'score':_0x462301['result'][_0x46a5('0x65')],'statusCode':_0x462301[_0x46a5('0x66')][_0x46a5('0x67')],'endConversation':_0x462301[_0x46a5('0x5f')][_0x46a5('0x68')][_0x46a5('0x69')]||![],'isFallbackIntent':_0x462301[_0x46a5('0x5f')]['metadata'][_0x46a5('0x6a')]};});};exports[_0x46a5('0x6b')]=function(_0x5372bc,_0x330d0b,_0x2c2689,_0xb24b66,_0x4672f7,_0x3be50b){var _0x20aacc=_0xb24b66['replace'](/\\n/g,'\x0a');var _0x2dd571={'credentials':{'private_key':_0x20aacc,'client_email':_0x2c2689}};var _0x55858f=new dialogflow[(_0x46a5('0x6c'))](_0x2dd571);var _0x3b164e=_0x55858f[_0x46a5('0x6d')](_0x330d0b,md5(_0x5372bc));var _0x574615={'session':_0x3b164e,'queryInput':{'text':{'text':_0x4672f7,'languageCode':_0x3be50b}}};return _0x55858f['detectIntent'](_0x574615)[_0x46a5('0x2e')](function(_0x4a3edb){if(_0x4a3edb&&_0x4a3edb[_0x46a5('0x4c')]){logger[_0x46a5('0x27')](_0x46a5('0x6e'),JSON[_0x46a5('0x46')](_0x4a3edb));var _0x4abe21=_0x4a3edb[0x0];if(_0x4abe21){var _0x25dbca={'action':_0x4abe21[_0x46a5('0x6f')][_0x46a5('0x62')],'allRequiredParamsPresent':_0x4abe21[_0x46a5('0x6f')][_0x46a5('0x70')],'endConversation':_0x4abe21[_0x46a5('0x6f')][_0x46a5('0x71')]&&_0x4abe21[_0x46a5('0x6f')][_0x46a5('0x71')]['fields']?_0x4abe21[_0x46a5('0x6f')][_0x46a5('0x71')][_0x46a5('0x72')][_0x46a5('0x73')][_0x46a5('0x74')]:![],'fulfillmentText':_0x4abe21['queryResult']['fulfillmentText'],'intentName':_0x4abe21[_0x46a5('0x6f')][_0x46a5('0x75')][_0x46a5('0x5c')],'intentDisplayName':_0x4abe21['queryResult'][_0x46a5('0x75')][_0x46a5('0x76')],'isFallbackIntent':_0x4abe21['queryResult'][_0x46a5('0x75')][_0x46a5('0x77')],'languageCode':_0x4abe21[_0x46a5('0x6f')][_0x46a5('0x78')],'queryText':_0x4abe21[_0x46a5('0x6f')]['queryText'],'responseId':_0x4abe21[_0x46a5('0x79')],'score':_0x4abe21[_0x46a5('0x6f')]['intentDetectionConfidence'],'speech':_0x4abe21[_0x46a5('0x6f')][_0x46a5('0x7a')],'providerResponse':JSON[_0x46a5('0x46')](_0x4a3edb)};return _0x25dbca;}}});};exports[_0x46a5('0x7b')]=function(_0x622271,_0x19ab84,_0x29be89,_0x1ed20f){return tilde[_0x46a5('0x51')](_0x622271,_0x19ab84,_0x29be89,_0x1ed20f)[_0x46a5('0x2e')](function(_0x2fe357){try{fs['unlink'](_0x622271);}catch(_0x8ff8e1){logger[_0x46a5('0x16')](_0x8ff8e1);}logger[_0x46a5('0x27')](_0x46a5('0x7c'),_0x2fe357[_0x46a5('0x7d')]);logger[_0x46a5('0x27')](_0x46a5('0x7e'),_0x2fe357[_0x46a5('0x57')]);return _0x2fe357;});};exports[_0x46a5('0x7f')]=function(_0x51a4da,_0x24305c,_0x41b4fc,_0x53b949,_0x1d25f6,_0x23d728){var _0x1c77a1=path[_0x46a5('0x29')](__dirname,_0x46a5('0x3a'),rs['generate'](0x4)+'.mp3');var _0x44ab1b;return aws[_0x46a5('0x80')](_0x51a4da,_0x24305c,_0x41b4fc,_0x53b949,_0x1d25f6,_0x23d728,_0x1c77a1)[_0x46a5('0x2e')](function(){_0x44ab1b=path['resolve'](__dirname,_0x46a5('0x3a'),rs['generate'](0x4)+_0x46a5('0x2b'));return convertFile(_0x1c77a1,_0x44ab1b);})['then'](function(){try{fs[_0x46a5('0x1f')](_0x1c77a1);fs['chmodSync'](_0x44ab1b,_0x46a5('0x30'));}catch(_0x27865e){logger['error'](_0x27865e);}return _0x44ab1b[_0x46a5('0x40')]('.')[0x0];});};exports[_0x46a5('0x81')]=function(_0x10f8f5,_0x3e7df6,_0x581452,_0x5c7756,_0x25a54c,_0x279aca){return aws[_0x46a5('0x82')](_0x10f8f5,_0x3e7df6,_0x581452,_0x5c7756,_0x25a54c,_0x279aca)[_0x46a5('0x2e')](function(_0xc452e9){logger[_0x46a5('0x27')](JSON[_0x46a5('0x46')](_0xc452e9));return _0xc452e9;});};exports[_0x46a5('0x83')]=function(_0x377fad,_0x1ee3bf,_0x303aa3,_0xc41125){var _0x39980e=util[_0x46a5('0x84')](_0x46a5('0x85'),ISPEECH_API,_0x377fad,encodeURIComponent(_0x1ee3bf),_0x303aa3,_0xc41125);var _0x28dec8=path['resolve'](__dirname,'tmp',rs[_0x46a5('0x2a')](0x4)+_0x46a5('0x3b'));var _0x37f920;return downloadFile(_0x39980e,_0x28dec8)[_0x46a5('0x2e')](function(){_0x37f920=path[_0x46a5('0x29')](__dirname,_0x46a5('0x3a'),rs[_0x46a5('0x2a')](0x4)+_0x46a5('0x2b'));return convertFile(_0x28dec8,_0x37f920);})[_0x46a5('0x2e')](function(){try{fs['unlink'](_0x28dec8);fs[_0x46a5('0x2f')](_0x37f920,_0x46a5('0x30'));}catch(_0x15dd4b){logger['error'](_0x15dd4b);}return _0x37f920['split']('.')[0x0];});};exports['ispeechASR']=function(_0x4cdf6a,_0x14ab01,_0x5e8bbb,_0x1e9b33){var _0x521cc5=util[_0x46a5('0x84')](_0x46a5('0x86'),ISPEECH_API,_0x14ab01,_0x5e8bbb,base64Encode(_0x4cdf6a),_0x1e9b33?util['format']('model=%s',encodeURIComponent(_0x1e9b33)):_0x46a5('0x87'));return uploadFile(_0x521cc5)['then'](function(_0x334fba){return querystring[_0x46a5('0xb')](_0x334fba);});};exports['sestekNDA']=function(_0x5c5a6b,_0x54134d){return sestek[_0x46a5('0x88')](_0x5c5a6b,_0x54134d)[_0x46a5('0x2e')](function(_0x1070e7){logger['info'](JSON[_0x46a5('0x46')](_0x1070e7));var _0x1982b5={'speech':_0x1070e7['text'],'action':_0x1070e7[_0x46a5('0x89')]?_0x1070e7[_0x46a5('0x89')]['CustomAction']:undefined,'actiondata':_0x1070e7[_0x46a5('0x89')]?_0x1070e7['channelData'][_0x46a5('0x8a')]:undefined};if(_0x1070e7[_0x46a5('0x89')]&&_0x1070e7['channelData']['AudioFromTts']){return base64Decode(_0x1070e7[_0x46a5('0x89')][_0x46a5('0x8b')][_0x46a5('0x8c')],path[_0x46a5('0x29')](__dirname,_0x46a5('0x3a'),rs[_0x46a5('0x2a')](0x4)+_0x46a5('0x2b')))[_0x46a5('0x2e')](function(_0x511ddd){_0x1982b5[_0x46a5('0x8d')]=_0x511ddd;return _0x1982b5;});}return _0x1982b5;});};exports[_0x46a5('0x8e')]=function(){return __dirname;}; \ No newline at end of file +var _0xe44f=['asr','uri','results','alternatives','transcript','join','map','confidence','googleASR\x20transcription','catch','[%s]\x20%s:%s','name','message','googleDialogflow','textRequest','source','result','resolvedQuery','action','actionIncomplete','fulfillment','speech','status','endConversation','metadata','googleDialogflowV2','sessionPath','Dialogflow\x20V2\x20response:','queryResult','diagnosticInfo','fields','end_conversation','boolValue','fulfillmentText','intent','isFallback','languageCode','queryText','responseId','intentDetectionConfidence','tildeASR','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','sestekNDA','nda','channelData','AudioFromTts','Data','apiai-promise','bluebird','http','https','md5','path','querystring','request-promise','sox','google-tts-api','url','parse','util','./google','./sestek','./tilde','../../../config/logger','agi','https://api.ispeech.org/api/rest','host','WHAT_EVER','get','statusCode','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','createWriteStream','info','unlink','end','protocol','https:','wav','error\x20convert','finish\x20to\x20convert','tmp','generate','.wav','writeFileSync','base64','chmodSync','777','split','readFileSync','toString','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','voice','audioConfig','text:synthesize','resolve','.mp3','from','audioContent','writeFile','then','googleCloudTTS\x20path','googleTTS','utf8','POST','application/x-www-form-urlencoded','f.req=','stringify','jQ1olc','generic','parse\x20response\x20failed:\x0a','data','lang\x20\x22','\x22\x20might\x20not\x20exist','googleASR'];(function(_0x101cc0,_0xf931c4){var _0x4ccb43=function(_0x96a6a1){while(--_0x96a6a1){_0x101cc0['push'](_0x101cc0['shift']());}};_0x4ccb43(++_0xf931c4);}(_0xe44f,0x13a));var _0xfe44=function(_0x5cd731,_0x37fe69){_0x5cd731=_0x5cd731-0x0;var _0x5c41f3=_0xe44f[_0x5cd731];return _0x5c41f3;};'use strict';var apiai=require(_0xfe44('0x0'));var BPromise=require(_0xfe44('0x1'));var dialogflow=require('dialogflow');var fs=require('fs');var http=require(_0xfe44('0x2'));var https=require(_0xfe44('0x3'));var md5=require(_0xfe44('0x4'));var path=require(_0xfe44('0x5'));var querystring=require(_0xfe44('0x6'));var rp=require(_0xfe44('0x7'));var rs=require('randomstring');var sox=require(_0xfe44('0x8'));var tts=require(_0xfe44('0x9'));var urlParse=require(_0xfe44('0xa'))[_0xfe44('0xb')];var util=require(_0xfe44('0xc'));var aws=require('./aws');var google=require(_0xfe44('0xd'));var sestek=require(_0xfe44('0xe'));var tilde=require(_0xfe44('0xf'));var logger=require(_0xfe44('0x10'))(_0xfe44('0x11'));var ISPEECH_API=_0xfe44('0x12');function downloadFile(_0x1a27c6,_0x170884){return new BPromise(function(_0x119b01,_0x580b9c){var _0x11b64a=urlParse(_0x1a27c6);var _0x398bac=_0x11b64a['protocol']==='https:'?https:http;var _0x439901={'host':_0x11b64a[_0xfe44('0x13')],'path':_0x11b64a[_0xfe44('0x5')],'headers':{'user-agent':_0xfe44('0x14')}};_0x398bac[_0xfe44('0x15')](_0x439901,function(_0x43e4cc){if(_0x43e4cc[_0xfe44('0x16')]!==0xc8){logger[_0xfe44('0x17')](_0xfe44('0x18')+_0x1a27c6+_0xfe44('0x19')+_0x43e4cc[_0xfe44('0x16')]+'\x20('+_0x43e4cc[_0xfe44('0x1a')]+')');_0x580b9c(new Error(_0xfe44('0x18')+_0x1a27c6+_0xfe44('0x19')+_0x43e4cc['statusCode']+'\x20('+_0x43e4cc['statusMessage']+')'));return;}var _0x3015a=fs[_0xfe44('0x1b')](_0x170884);_0x3015a['on']('finish',function(){logger[_0xfe44('0x1c')]('finish\x20download\x20file');_0x3015a['close'](_0x119b01);});_0x3015a['on'](_0xfe44('0x17'),function(_0x31dccd){fs[_0xfe44('0x1d')](_0x170884);logger[_0xfe44('0x17')]('download\x20error',_0x31dccd);_0x580b9c(_0x31dccd);});_0x43e4cc['pipe'](_0x3015a);})['on'](_0xfe44('0x17'),function(_0x321674){logger['error'](_0x321674);_0x580b9c(_0x321674);})[_0xfe44('0x1e')]();});}function uploadFile(_0x415464){return new BPromise(function(_0x16d280,_0x1598b9){var _0x3ed44f=urlParse(_0x415464);var _0x2c4512=_0x3ed44f[_0xfe44('0x1f')]===_0xfe44('0x20')?https:http;var _0x2828ec={'host':_0x3ed44f[_0xfe44('0x13')],'path':_0x3ed44f[_0xfe44('0x5')],'headers':{'user-agent':'WHAT_EVER'}};_0x2c4512[_0xfe44('0x15')](_0x2828ec,function(_0x37546b){if(_0x37546b[_0xfe44('0x16')]!==0xc8){_0x1598b9(new Error('request\x20to\x20'+_0x415464+_0xfe44('0x19')+_0x37546b['statusCode']+'\x20('+_0x37546b['statusMessage']+')'));return;}var _0x40ee58='';_0x37546b['on']('data',function(_0x4885b9){_0x40ee58+=_0x4885b9;});_0x37546b['on'](_0xfe44('0x1e'),function(){_0x16d280(_0x40ee58);});})['on'](_0xfe44('0x17'),function(_0x41752d){_0x1598b9(_0x41752d);})[_0xfe44('0x1e')]();});}function convertFile(_0x1c17b8,_0x53f326){return new BPromise(function(_0x37cdf1,_0x54831e){var _0x1e704e=sox['transcode'](_0x1c17b8,_0x53f326,{'sampleRate':0x1f40,'format':_0xfe44('0x21'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x1e704e['on'](_0xfe44('0x17'),function(_0x725e48){logger[_0xfe44('0x17')](_0xfe44('0x22'),_0x725e48);_0x54831e(_0x725e48);});_0x1e704e['on']('end',function(){logger[_0xfe44('0x1c')](_0xfe44('0x23'));_0x37cdf1();});_0x1e704e['start']();});}function base64Decode(_0xda28cb,_0x5f402d){var _0x46dfc4=path['resolve'](__dirname,_0xfe44('0x24'),rs[_0xfe44('0x25')](0x4)+_0xfe44('0x26'));fs[_0xfe44('0x27')](_0x46dfc4,_0xda28cb,_0xfe44('0x28'));return convertFile(_0x46dfc4,_0x5f402d)['then'](function(){try{fs[_0xfe44('0x1d')](_0x46dfc4);fs[_0xfe44('0x29')](_0x5f402d,_0xfe44('0x2a'));}catch(_0x3e0dc2){logger[_0xfe44('0x17')](_0x3e0dc2);}return _0x5f402d[_0xfe44('0x2b')]('.')[0x0];});}function base64Encode(_0x510d69){var _0xbcb587=fs[_0xfe44('0x2c')](_0x510d69);return new Buffer(_0xbcb587)[_0xfe44('0x2d')](_0xfe44('0x28'));}exports['googleCloudTTS']=function(_0x3b3232,_0x2ccd4e,_0x2ad27b,_0x29190c,_0x4d2ddc,_0x47772f){var _0x3f538f,_0x53c9e8;var _0x385b6b=_0xfe44('0x2e');var _0x22ced4=_0xfe44('0x2f')+_0x3b3232;var _0x4b2ee0={};if(_0x2ccd4e===_0xfe44('0x30')){_0x4b2ee0[_0xfe44('0x31')]={'ssml':_0x2ad27b};}else{_0x4b2ee0[_0xfe44('0x31')]={'text':_0x2ad27b};};_0x4b2ee0[_0xfe44('0x32')]={'languageCode':_0x29190c,'ssmlGender':_0x4d2ddc};_0x4b2ee0[_0xfe44('0x33')]={'audioEncoding':'MP3','sampleRateHertz':0x1f40};var _0x41b909={'url':_0x385b6b+_0xfe44('0x34')+_0x22ced4,'method':'POST','json':!![],'body':_0x4b2ee0};return rp(_0x41b909)['then'](function(_0xdc490f){return new BPromise(function(_0x5b0bd4,_0xf566bc){_0x3f538f=path[_0xfe44('0x35')](__dirname,_0xfe44('0x24'),rs[_0xfe44('0x25')](0x4)+_0xfe44('0x36'));var _0x5be38e=Buffer[_0xfe44('0x37')](_0xdc490f[_0xfe44('0x38')],_0xfe44('0x28'));return fs[_0xfe44('0x39')](_0x3f538f,_0x5be38e,function(_0x5b17d8){_0xf566bc(_0x5b17d8);},function(_0x4a3d89){fs[_0xfe44('0x29')](_0x3f538f,_0xfe44('0x2a'));_0x5b0bd4(_0x4a3d89);});});})[_0xfe44('0x3a')](function(_0x2cdd87){_0x53c9e8=path[_0xfe44('0x35')](__dirname,_0xfe44('0x24'),rs[_0xfe44('0x25')](0x4)+_0xfe44('0x26'));return convertFile(_0x3f538f,_0x53c9e8);})['then'](function(){try{fs[_0xfe44('0x1d')](_0x3f538f);fs['chmodSync'](_0x53c9e8,_0xfe44('0x2a'));}catch(_0x3dc003){logger[_0xfe44('0x17')](_0x3dc003);}logger['info'](_0xfe44('0x3b'),_0x53c9e8['split']('.')[0x0]);return _0x53c9e8[_0xfe44('0x2b')]('.')[0x0];});};exports[_0xfe44('0x3c')]=function(_0xe6660d,_0x1ace59){var _0xde52f5='https://translate.google.com/_/TranslateWebserverUi/data/batchexecute';var _0x3385dc,_0x368d9b;var _0x201005;var _0x5db495={'encoding':_0xfe44('0x3d'),'method':_0xfe44('0x3e'),'timeout':0x2710,'url':_0xde52f5,'headers':{'Content-Type':_0xfe44('0x3f')},'body':_0xfe44('0x40')+encodeURIComponent(JSON[_0xfe44('0x41')]([[[_0xfe44('0x42'),JSON['stringify']([_0xe6660d,_0x1ace59||'en',![],'null']),null,_0xfe44('0x43')]]]))};return rp(_0x5db495)[_0xfe44('0x3a')](function(_0x3ef6af){try{_0x201005=eval(_0x3ef6af['slice'](0x5))[0x0][0x2];}catch(_0x242058){throw new Error(_0xfe44('0x44')+_0x3ef6af[_0xfe44('0x45')]);}if(!_0x201005){if(_0xe6660d['length']>0xc8){throw new Error('text\x20length\x20limit\x20reached');}else{throw new Error(_0xfe44('0x46')+_0x1ace59+_0xfe44('0x47'));}}try{_0x201005=eval(_0x201005)[0x0];}catch(_0xebdb79){throw new Error(_0xfe44('0x44')+res['data']);}const _0x101e7a=_0x201005;_0x3385dc=path[_0xfe44('0x35')](__dirname,'tmp',rs[_0xfe44('0x25')](0x4)+_0xfe44('0x36'));fs[_0xfe44('0x27')](_0x3385dc,_0x201005,{'encoding':_0xfe44('0x28')});_0x368d9b=path['resolve'](__dirname,_0xfe44('0x24'),rs['generate'](0x4)+_0xfe44('0x26'));return convertFile(_0x3385dc,_0x368d9b);})[_0xfe44('0x3a')](function(){try{fs[_0xfe44('0x1d')](_0x3385dc);fs[_0xfe44('0x29')](_0x368d9b,_0xfe44('0x2a'));}catch(_0x4ebcb1){logger[_0xfe44('0x17')](_0x4ebcb1);}logger[_0xfe44('0x1c')]('goggleTTS\x20path',_0x368d9b[_0xfe44('0x2b')]('.')[0x0]);return _0x368d9b[_0xfe44('0x2b')]('.')[0x0];});};exports[_0xfe44('0x48')]=function(_0x190483,_0x8f5811,_0xc213ea){return google[_0xfe44('0x49')](_0x190483,_0x8f5811,_0xc213ea)[_0xfe44('0x3a')](function(_0x2622ea){logger['info'](_0x2622ea[_0xfe44('0x4a')]);return rp(_0x2622ea);})[_0xfe44('0x3a')](function(_0x3309e0){var _0x1f8231='';var _0x2730aa=0x0;try{fs[_0xfe44('0x1d')](_0x190483);}catch(_0x451d24){logger[_0xfe44('0x17')](_0x451d24);}if(_0x3309e0&&_0x3309e0[_0xfe44('0x4b')]){_0x1f8231=_0x3309e0['results']['map'](function(_0x2d9556){return _0x2d9556&&_0x2d9556[_0xfe44('0x4c')][0x0]&&_0x2d9556[_0xfe44('0x4c')][0x0][_0xfe44('0x4d')]?_0x2d9556[_0xfe44('0x4c')][0x0][_0xfe44('0x4d')]:'';})[_0xfe44('0x4e')]('\x0a');_0x2730aa=_0x3309e0[_0xfe44('0x4b')][_0xfe44('0x4f')](function(_0x4c2aef){return _0x4c2aef&&_0x4c2aef[_0xfe44('0x4c')][0x0]&&_0x4c2aef['alternatives'][0x0]['confidence']?_0x4c2aef[_0xfe44('0x4c')][0x0][_0xfe44('0x50')]:0x0;})['join']('\x0a');}logger['info'](_0xfe44('0x51'),_0x1f8231);logger[_0xfe44('0x1c')]('googleASR\x20confidence',_0x2730aa);return{'transcript':_0x1f8231,'confidence':_0x2730aa};})[_0xfe44('0x52')](function(_0x3484b3){logger[_0xfe44('0x17')](_0xfe44('0x53'),_0x3484b3['statusCode'],_0x3484b3[_0xfe44('0x54')],_0x3484b3[_0xfe44('0x55')]);});};exports[_0xfe44('0x56')]=function(_0xbfa664,_0x1521c8,_0x28b73c,_0x52d6d3){var _0x2f0b9b=apiai(_0x1521c8,{'language':_0x52d6d3||'en'});return _0x2f0b9b[_0xfe44('0x57')](_0x28b73c,{'sessionId':md5(_0xbfa664)})['then'](function(_0x56cf24){logger[_0xfe44('0x1c')](JSON[_0xfe44('0x41')](_0x56cf24));return{'source':_0x56cf24['result'][_0xfe44('0x58')],'resolvedQuery':_0x56cf24[_0xfe44('0x59')][_0xfe44('0x5a')],'action':_0x56cf24[_0xfe44('0x59')][_0xfe44('0x5b')],'actionIncomplete':_0x56cf24[_0xfe44('0x59')][_0xfe44('0x5c')],'speech':_0x56cf24[_0xfe44('0x59')][_0xfe44('0x5d')][_0xfe44('0x5e')],'score':_0x56cf24['result']['score'],'statusCode':_0x56cf24[_0xfe44('0x5f')]['code'],'endConversation':_0x56cf24[_0xfe44('0x59')]['metadata'][_0xfe44('0x60')]||![],'isFallbackIntent':_0x56cf24['result'][_0xfe44('0x61')]['isFallbackIntent']};});};exports[_0xfe44('0x62')]=function(_0x24c29c,_0x246381,_0x3e3be8,_0x552fde,_0x5b1010,_0x43c1a3){var _0x4d3dc7=_0x552fde['replace'](/\\n/g,'\x0a');var _0x46453c={'credentials':{'private_key':_0x4d3dc7,'client_email':_0x3e3be8}};var _0x19a562=new dialogflow['SessionsClient'](_0x46453c);var _0x5d56d2=_0x19a562[_0xfe44('0x63')](_0x246381,md5(_0x24c29c));var _0x47c71e={'session':_0x5d56d2,'queryInput':{'text':{'text':_0x5b1010,'languageCode':_0x43c1a3}}};return _0x19a562['detectIntent'](_0x47c71e)[_0xfe44('0x3a')](function(_0xd442f3){if(_0xd442f3&&_0xd442f3['length']){logger[_0xfe44('0x1c')](_0xfe44('0x64'),JSON[_0xfe44('0x41')](_0xd442f3));var _0xa1c71=_0xd442f3[0x0];if(_0xa1c71){var _0x39b0d3={'action':_0xa1c71[_0xfe44('0x65')][_0xfe44('0x5b')],'allRequiredParamsPresent':_0xa1c71[_0xfe44('0x65')]['allRequiredParamsPresent'],'endConversation':_0xa1c71[_0xfe44('0x65')][_0xfe44('0x66')]&&_0xa1c71[_0xfe44('0x65')][_0xfe44('0x66')][_0xfe44('0x67')]?_0xa1c71['queryResult'][_0xfe44('0x66')][_0xfe44('0x67')][_0xfe44('0x68')][_0xfe44('0x69')]:![],'fulfillmentText':_0xa1c71[_0xfe44('0x65')][_0xfe44('0x6a')],'intentName':_0xa1c71[_0xfe44('0x65')][_0xfe44('0x6b')][_0xfe44('0x54')],'intentDisplayName':_0xa1c71[_0xfe44('0x65')][_0xfe44('0x6b')]['displayName'],'isFallbackIntent':_0xa1c71[_0xfe44('0x65')][_0xfe44('0x6b')][_0xfe44('0x6c')],'languageCode':_0xa1c71['queryResult'][_0xfe44('0x6d')],'queryText':_0xa1c71[_0xfe44('0x65')][_0xfe44('0x6e')],'responseId':_0xa1c71[_0xfe44('0x6f')],'score':_0xa1c71[_0xfe44('0x65')][_0xfe44('0x70')],'speech':_0xa1c71['queryResult'][_0xfe44('0x6a')],'providerResponse':JSON[_0xfe44('0x41')](_0xd442f3)};return _0x39b0d3;}}});};exports[_0xfe44('0x71')]=function(_0x5e9176,_0x25459a,_0x4082e1,_0x1786d4){return tilde['asr'](_0x5e9176,_0x25459a,_0x4082e1,_0x1786d4)[_0xfe44('0x3a')](function(_0x9e2ffd){try{fs[_0xfe44('0x1d')](_0x5e9176);}catch(_0xb52e52){logger[_0xfe44('0x17')](_0xb52e52);}logger[_0xfe44('0x1c')]('Tilde\x20ASR\x20transcription',_0x9e2ffd[_0xfe44('0x4d')]);logger[_0xfe44('0x1c')]('Tilde\x20ASR\x20confidence',_0x9e2ffd[_0xfe44('0x50')]);return _0x9e2ffd;});};exports['awsPolly']=function(_0x29fbf5,_0x35319c,_0x361ef6,_0x490568,_0x95870c,_0x41e0be){var _0x4dc7b3=path[_0xfe44('0x35')](__dirname,_0xfe44('0x24'),rs[_0xfe44('0x25')](0x4)+'.mp3');var _0xb1a12d;return aws[_0xfe44('0x72')](_0x29fbf5,_0x35319c,_0x361ef6,_0x490568,_0x95870c,_0x41e0be,_0x4dc7b3)[_0xfe44('0x3a')](function(){_0xb1a12d=path[_0xfe44('0x35')](__dirname,_0xfe44('0x24'),rs[_0xfe44('0x25')](0x4)+'.wav');return convertFile(_0x4dc7b3,_0xb1a12d);})[_0xfe44('0x3a')](function(){try{fs[_0xfe44('0x1d')](_0x4dc7b3);fs['chmodSync'](_0xb1a12d,_0xfe44('0x2a'));}catch(_0x1b7303){logger[_0xfe44('0x17')](_0x1b7303);}return _0xb1a12d[_0xfe44('0x2b')]('.')[0x0];});};exports[_0xfe44('0x73')]=function(_0x3261eb,_0x240c4b,_0x53edd3,_0x3b1537,_0x40ff0c,_0x5c45cb){return aws[_0xfe44('0x74')](_0x3261eb,_0x240c4b,_0x53edd3,_0x3b1537,_0x40ff0c,_0x5c45cb)[_0xfe44('0x3a')](function(_0x93e9ad){logger[_0xfe44('0x1c')](JSON[_0xfe44('0x41')](_0x93e9ad));return _0x93e9ad;});};exports[_0xfe44('0x75')]=function(_0x3b2c47,_0x4844f9,_0x3005b9,_0x20604b){var _0x42d042=util[_0xfe44('0x76')](_0xfe44('0x77'),ISPEECH_API,_0x3b2c47,encodeURIComponent(_0x4844f9),_0x3005b9,_0x20604b);var _0x4278b4=path['resolve'](__dirname,_0xfe44('0x24'),rs['generate'](0x4)+_0xfe44('0x36'));var _0x3bfe94;return downloadFile(_0x42d042,_0x4278b4)[_0xfe44('0x3a')](function(){_0x3bfe94=path[_0xfe44('0x35')](__dirname,'tmp',rs[_0xfe44('0x25')](0x4)+_0xfe44('0x26'));return convertFile(_0x4278b4,_0x3bfe94);})['then'](function(){try{fs[_0xfe44('0x1d')](_0x4278b4);fs[_0xfe44('0x29')](_0x3bfe94,_0xfe44('0x2a'));}catch(_0x112d3f){logger[_0xfe44('0x17')](_0x112d3f);}return _0x3bfe94['split']('.')[0x0];});};exports[_0xfe44('0x78')]=function(_0x5facdf,_0x2e660f,_0x2a632f,_0xeff05f){var _0x5c3514=util[_0xfe44('0x76')](_0xfe44('0x79'),ISPEECH_API,_0x2e660f,_0x2a632f,base64Encode(_0x5facdf),_0xeff05f?util[_0xfe44('0x76')](_0xfe44('0x7a'),encodeURIComponent(_0xeff05f)):_0xfe44('0x7b'));return uploadFile(_0x5c3514)[_0xfe44('0x3a')](function(_0x1f08c2){return querystring[_0xfe44('0xb')](_0x1f08c2);});};exports[_0xfe44('0x7c')]=function(_0xbcbea9,_0x44452c){return sestek[_0xfe44('0x7d')](_0xbcbea9,_0x44452c)[_0xfe44('0x3a')](function(_0x49dcef){logger[_0xfe44('0x1c')](JSON[_0xfe44('0x41')](_0x49dcef));var _0x513862={'speech':_0x49dcef['text'],'action':_0x49dcef['channelData']?_0x49dcef['channelData']['CustomAction']:undefined,'actiondata':_0x49dcef['channelData']?_0x49dcef['channelData']['CustomActionData']:undefined};if(_0x49dcef['channelData']&&_0x49dcef[_0xfe44('0x7e')][_0xfe44('0x7f')]){return base64Decode(_0x49dcef[_0xfe44('0x7e')][_0xfe44('0x7f')][_0xfe44('0x80')],path[_0xfe44('0x35')](__dirname,_0xfe44('0x24'),rs[_0xfe44('0x25')](0x4)+_0xfe44('0x26')))['then'](function(_0x295ab8){_0x513862['audiofile']=_0x295ab8;return _0x513862;});}return _0x513862;});};exports['dirName']=function(){return __dirname;}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/index.js b/server/services/agi/scripts/sestek/index.js index 1518b6b..cbf8ae7 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 _0xa541=['./nda'];(function(_0x24b2f4,_0x461871){var _0xf9a8e0=function(_0x9262de){while(--_0x9262de){_0x24b2f4['push'](_0x24b2f4['shift']());}};_0xf9a8e0(++_0x461871);}(_0xa541,0x7d));var _0x1a54=function(_0x3d6778,_0x55c104){_0x3d6778=_0x3d6778-0x0;var _0x2edcba=_0xa541[_0x3d6778];return _0x2edcba;};var nda=require(_0x1a54('0x0'));module['exports']={'nda':nda}; \ No newline at end of file +var _0xbd26=['exports','./nda'];(function(_0x398550,_0x582ecd){var _0x4cc43f=function(_0x2110a8){while(--_0x2110a8){_0x398550['push'](_0x398550['shift']());}};_0x4cc43f(++_0x582ecd);}(_0xbd26,0x15d));var _0x6bd2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbd26[_0x3dd15e];return _0x231fd0;};var nda=require(_0x6bd2('0x0'));module[_0x6bd2('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 729c043..65e3f24 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 _0x9d9b=['CustomAction','custom_action','custom_action_data','CustomActionData','stringify','url','../../../../../config/logger','exports','POST','ndauth_url','password','username','then','resolve','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','callerid','calleridname','dnid','text','Bearer\x20','project','channelData','ProjectName','ndagenerate_audio','body','AudioOutputSettings','audio/wav'];(function(_0x362b24,_0x4b8e8b){var _0x3ce71d=function(_0x46b04c){while(--_0x46b04c){_0x362b24['push'](_0x362b24['shift']());}};_0x3ce71d(++_0x4b8e8b);}(_0x9d9b,0x1e1));var _0xb9d9=function(_0x5ae238,_0xd4fd48){_0x5ae238=_0x5ae238-0x0;var _0x37d577=_0x9d9b[_0x5ae238];return _0x37d577;};'use strict';var rp=require('request-promise');var url=require(_0xb9d9('0x0'));var logger=require(_0xb9d9('0x1'))('agi');module[_0xb9d9('0x2')]=function(_0x5924bd,_0x29ac5b){var _0x19d86d={'method':_0xb9d9('0x3'),'uri':url['resolve'](_0x29ac5b[_0xb9d9('0x4')],'/token'),'form':{'grant_type':_0xb9d9('0x5'),'username':_0x29ac5b[_0xb9d9('0x6')],'password':_0x29ac5b['password']},'json':!![]};return rp(_0x19d86d)[_0xb9d9('0x7')](function(_0x20e0e5){var _0x184896={'method':_0xb9d9('0x3'),'uri':url[_0xb9d9('0x8')](_0x29ac5b[_0xb9d9('0x9')],_0xb9d9('0xa')),'body':{'type':_0x29ac5b['ndaactivity_type']||'message','channelId':'Nda','conversation':{'id':_0x5924bd['uniqueid']},'from':{'id':_0x5924bd[_0xb9d9('0xb')],'name':_0x5924bd[_0xb9d9('0xc')]},'recipient':{'id':_0x5924bd[_0xb9d9('0xd')],'name':_0x5924bd['extension']},'text':_0x29ac5b[_0xb9d9('0xe')],'channelData':{}},'headers':{'Authorization':_0xb9d9('0xf')+_0x20e0e5['access_token']},'json':!![]};if(_0x29ac5b[_0xb9d9('0x10')]){_0x184896['body'][_0xb9d9('0x11')][_0xb9d9('0x12')]=_0x29ac5b[_0xb9d9('0x10')];}if(_0x29ac5b[_0xb9d9('0x13')]=='1'){_0x184896[_0xb9d9('0x14')][_0xb9d9('0x11')][_0xb9d9('0x15')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0xb9d9('0x16')};}if(_0x29ac5b['custom_action']){_0x184896['body'][_0xb9d9('0x11')][_0xb9d9('0x17')]=_0x29ac5b[_0xb9d9('0x18')];if(_0x29ac5b[_0xb9d9('0x19')]){_0x184896['body']['channelData'][_0xb9d9('0x1a')]=_0x29ac5b['custom_action_data'];}}logger['info'](JSON[_0xb9d9('0x1b')](_0x184896));return rp(_0x184896);});}; \ No newline at end of file +var _0xad13=['ndassistant_url','ndaactivity_type','message','uniqueid','callerid','calleridname','dnid','extension','text','project','body','channelData','ProjectName','ndagenerate_audio','AudioOutputSettings','audio/wav','custom_action','CustomAction','custom_action_data','CustomActionData','info','stringify','request-promise','../../../../../config/logger','agi','exports','POST','resolve','ndauth_url','/token','password','username','then'];(function(_0x4868ab,_0x416ea2){var _0x375401=function(_0x19324b){while(--_0x19324b){_0x4868ab['push'](_0x4868ab['shift']());}};_0x375401(++_0x416ea2);}(_0xad13,0x79));var _0x3ad1=function(_0x3ad5cc,_0x11cf86){_0x3ad5cc=_0x3ad5cc-0x0;var _0x2d951e=_0xad13[_0x3ad5cc];return _0x2d951e;};'use strict';var rp=require(_0x3ad1('0x0'));var url=require('url');var logger=require(_0x3ad1('0x1'))(_0x3ad1('0x2'));module[_0x3ad1('0x3')]=function(_0x38bf8c,_0x501af9){var _0x309032={'method':_0x3ad1('0x4'),'uri':url[_0x3ad1('0x5')](_0x501af9[_0x3ad1('0x6')],_0x3ad1('0x7')),'form':{'grant_type':_0x3ad1('0x8'),'username':_0x501af9[_0x3ad1('0x9')],'password':_0x501af9[_0x3ad1('0x8')]},'json':!![]};return rp(_0x309032)[_0x3ad1('0xa')](function(_0x313ad9){var _0x4d27b0={'method':_0x3ad1('0x4'),'uri':url[_0x3ad1('0x5')](_0x501af9[_0x3ad1('0xb')],'/api/NaturalDialogAssistant/v1/Run'),'body':{'type':_0x501af9[_0x3ad1('0xc')]||_0x3ad1('0xd'),'channelId':'Nda','conversation':{'id':_0x38bf8c[_0x3ad1('0xe')]},'from':{'id':_0x38bf8c[_0x3ad1('0xf')],'name':_0x38bf8c[_0x3ad1('0x10')]},'recipient':{'id':_0x38bf8c[_0x3ad1('0x11')],'name':_0x38bf8c[_0x3ad1('0x12')]},'text':_0x501af9[_0x3ad1('0x13')],'channelData':{}},'headers':{'Authorization':'Bearer\x20'+_0x313ad9['access_token']},'json':!![]};if(_0x501af9[_0x3ad1('0x14')]){_0x4d27b0[_0x3ad1('0x15')][_0x3ad1('0x16')][_0x3ad1('0x17')]=_0x501af9['project'];}if(_0x501af9[_0x3ad1('0x18')]=='1'){_0x4d27b0['body'][_0x3ad1('0x16')][_0x3ad1('0x19')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x3ad1('0x1a')};}if(_0x501af9[_0x3ad1('0x1b')]){_0x4d27b0[_0x3ad1('0x15')][_0x3ad1('0x16')][_0x3ad1('0x1c')]=_0x501af9[_0x3ad1('0x1b')];if(_0x501af9[_0x3ad1('0x1d')]){_0x4d27b0[_0x3ad1('0x15')][_0x3ad1('0x16')][_0x3ad1('0x1e')]=_0x501af9['custom_action_data'];}}logger[_0x3ad1('0x1f')](JSON[_0x3ad1('0x20')](_0x4d27b0));return rp(_0x4d27b0);});}; \ 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 ec464d7..bcd9e41 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 _0xce87=['exports','./lib/api'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xce87,0x1bd));var _0x7ce8=function(_0x58d576,_0x1b0bdf){_0x58d576=_0x58d576-0x0;var _0x15cbf9=_0xce87[_0x58d576];return _0x15cbf9;};'use strict';var asr=require(_0x7ce8('0x0'));module[_0x7ce8('0x1')]=function(_0x5c1c88,_0xf1fe8b,_0x3d8338,_0x319bbd){return asr(_0x5c1c88,_0xf1fe8b,_0x3d8338,_0x319bbd);}; \ No newline at end of file +var _0x3ff4=['exports','./lib/api'];(function(_0x2b1efa,_0x503aa3){var _0x179991=function(_0x306942){while(--_0x306942){_0x2b1efa['push'](_0x2b1efa['shift']());}};_0x179991(++_0x503aa3);}(_0x3ff4,0x69));var _0x43ff=function(_0xbd08b4,_0x4790ed){_0xbd08b4=_0xbd08b4-0x0;var _0x314f1e=_0x3ff4[_0xbd08b4];return _0x314f1e;};'use strict';var asr=require(_0x43ff('0x0'));module[_0x43ff('0x1')]=function(_0x41f550,_0x3c78a2,_0x5302ad,_0x3dd2a7){return asr(_0x41f550,_0x3c78a2,_0x5302ad,_0x3dd2a7);}; \ 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 5ed3081..c3a3907 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 _0xc8d2=['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','isObject','open','bluebird','lodash','crypto','../../../../../../config/logger','agi','exports','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','sha1','update','digest','hex','info','Open\x20Tilde\x20ASR\x20socket','unix','send','stringify','createReadStream','data','close','EOS','parse','status','result','Tilde\x20ASR\x20hypoteses','hypotheses'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc8d2,0x103));var _0x2c8d=function(_0x3018f0,_0x1b2131){_0x3018f0=_0x3018f0-0x0;var _0x59faa4=_0xc8d2[_0x3018f0];return _0x59faa4;};'use strict';var BPromise=require(_0x2c8d('0x0'));var _=require(_0x2c8d('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require('moment');var crypto=require(_0x2c8d('0x2'));var logger=require(_0x2c8d('0x3'))(_0x2c8d('0x4'));module[_0x2c8d('0x5')]=function(_0x3f4eeb,_0x5c7e76,_0x1ff881,_0x2c38ab){return new BPromise(function(_0x51b7be,_0x4863dc){logger['info'](_0x2c8d('0x6'),_0x2c38ab||_0x2c8d('0x7'));var _0xb65eb4=new WebSocket(_0x2c38ab||_0x2c8d('0x7'),{'perMessageDeflate':![]});var _0x3dc09d='';var _0x311532='0';var _0x3fa81d='1';var _0x3a77fb=_0x2c8d('0x8');function _0x4b5546(_0x13dd28){var _0x5a88f6=crypto[_0x2c8d('0x9')](_0x2c8d('0xa'));_0x5a88f6[_0x2c8d('0xb')](_0x13dd28);return _0x5a88f6[_0x2c8d('0xc')](_0x2c8d('0xd'));}function _0x31457b(){try{logger[_0x2c8d('0xe')](_0x2c8d('0xf'));var _0x5cf00c=moment()[_0x2c8d('0x10')]();var _0x4d3795=_0x4b5546(_0x5cf00c+_0x5c7e76+_0x1ff881);_0xb65eb4[_0x2c8d('0x11')](JSON[_0x2c8d('0x12')]({'appID':_0x5c7e76,'timestamp':_0x5cf00c,'appKey':_0x4d3795}));var _0x990d32=fs[_0x2c8d('0x13')](_0x3f4eeb);_0x990d32['on'](_0x2c8d('0x14'),function(_0x3deac4){_0xb65eb4['send'](_0x3deac4);});_0x990d32['on'](_0x2c8d('0x15'),function(){_0xb65eb4[_0x2c8d('0x11')](_0x2c8d('0x16'));});}catch(_0x5adb64){logger['error']('Tilde\x20ASR\x20send\x20error',JSON['stringify'](_0x5adb64));_0xb65eb4['terminate']();}}function _0x572781(_0x2f87c4){try{if(_0x2f87c4){var _0x1435e7=JSON[_0x2c8d('0x17')](_0x2f87c4);switch(_0x1435e7[_0x2c8d('0x18')]){case 0x0:if(_0x1435e7['result']){if(_0x1435e7[_0x2c8d('0x19')]['final']){logger[_0x2c8d('0xe')](_0x2c8d('0x1a'),JSON[_0x2c8d('0x12')](_0x1435e7[_0x2c8d('0x19')][_0x2c8d('0x1b')]));_0x3dc09d=_0x1435e7[_0x2c8d('0x19')][_0x2c8d('0x1b')][0x0][_0x2c8d('0x1c')];_0x311532=_0x1435e7['result'][_0x2c8d('0x1b')][0x0][_0x2c8d('0x1d')];_0x3fa81d='0';_0x3a77fb=_0x2c8d('0x1e');_0xb65eb4[_0x2c8d('0x1f')]();}}break;case 0x1:logger[_0x2c8d('0xe')](_0x2c8d('0x8'));_0x3fa81d='1';_0x3a77fb=_0x2c8d('0x8');break;case 0x2:logger[_0x2c8d('0xe')](_0x2c8d('0x20'));_0x3fa81d='2';_0x3a77fb='Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.';break;case 0x9:logger[_0x2c8d('0xe')](_0x2c8d('0x21'));_0x3fa81d='9';_0x3a77fb='Not\x20available.\x20Max\x20load\x20limit\x20reached.';break;case 0xa:logger[_0x2c8d('0xe')](_0x2c8d('0x22'));_0x3fa81d='10';_0x3a77fb='Authentication\x20failed.';break;case 0xb:logger[_0x2c8d('0xe')](_0x2c8d('0x23'));_0x3fa81d='11';_0x3a77fb='All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.';}}}catch(_0xa9ab16){logger['error'](_0x2c8d('0x24'),JSON[_0x2c8d('0x12')](_0xa9ab16));_0xb65eb4[_0x2c8d('0x1f')]();}}function _0x5ca52f(){logger[_0x2c8d('0xe')](_0x2c8d('0x25'));_0x51b7be({'transcript':_0x3dc09d,'confidence':_0x311532,'status':_0x3fa81d,'status_message':_0x3a77fb});}function _0x4d4291(_0x2aa29c){logger[_0x2c8d('0x26')]('Error\x20Tilde\x20ASR\x20socket');if(!_['isNil'](_0x2aa29c)){logger[_0x2c8d('0x26')](_[_0x2c8d('0x27')](_0x2aa29c)?JSON['stringify'](_0x2aa29c):_0x2aa29c);}}_0xb65eb4['on'](_0x2c8d('0x28'),_0x31457b);_0xb65eb4['on']('message',_0x572781);_0xb65eb4['on'](_0x2c8d('0x15'),_0x5ca52f);_0xb65eb4['on']('error',_0x4d4291);});}; \ No newline at end of file +var _0x6502=['parse','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','likelihood','Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isNil','lodash','moment','crypto','../../../../../../config/logger','agi','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','sha1','update','unix','send','stringify','data','close','EOS','error','terminate'];(function(_0x1f5ee3,_0x42d31b){var _0x2db824=function(_0xa3030b){while(--_0xa3030b){_0x1f5ee3['push'](_0x1f5ee3['shift']());}};_0x2db824(++_0x42d31b);}(_0x6502,0xa0));var _0x2650=function(_0x43cd9f,_0x57d758){_0x43cd9f=_0x43cd9f-0x0;var _0x5cf244=_0x6502[_0x43cd9f];return _0x5cf244;};'use strict';var BPromise=require('bluebird');var _=require(_0x2650('0x0'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x2650('0x1'));var crypto=require(_0x2650('0x2'));var logger=require(_0x2650('0x3'))(_0x2650('0x4'));module['exports']=function(_0x347fa6,_0x59431a,_0x3e5ccb,_0x43831b){return new BPromise(function(_0x21a077,_0x165d45){logger[_0x2650('0x5')](_0x2650('0x6'),_0x43831b||_0x2650('0x7'));var _0x44dbb2=new WebSocket(_0x43831b||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE',{'perMessageDeflate':![]});var _0x46ea6d='';var _0x291590='0';var _0x2fd96d='1';var _0x33308e=_0x2650('0x8');function _0x36c408(_0x48222f){var _0x364b60=crypto[_0x2650('0x9')](_0x2650('0xa'));_0x364b60[_0x2650('0xb')](_0x48222f);return _0x364b60['digest']('hex');}function _0x32f0b6(){try{logger[_0x2650('0x5')]('Open\x20Tilde\x20ASR\x20socket');var _0x148302=moment()[_0x2650('0xc')]();var _0x27f1a4=_0x36c408(_0x148302+_0x59431a+_0x3e5ccb);_0x44dbb2[_0x2650('0xd')](JSON[_0x2650('0xe')]({'appID':_0x59431a,'timestamp':_0x148302,'appKey':_0x27f1a4}));var _0x92ac56=fs['createReadStream'](_0x347fa6);_0x92ac56['on'](_0x2650('0xf'),function(_0x35cef4){_0x44dbb2[_0x2650('0xd')](_0x35cef4);});_0x92ac56['on'](_0x2650('0x10'),function(){_0x44dbb2[_0x2650('0xd')](_0x2650('0x11'));});}catch(_0x4375ff){logger[_0x2650('0x12')]('Tilde\x20ASR\x20send\x20error',JSON['stringify'](_0x4375ff));_0x44dbb2[_0x2650('0x13')]();}}function _0x4b3e40(_0x4cf19c){try{if(_0x4cf19c){var _0x50051c=JSON[_0x2650('0x14')](_0x4cf19c);switch(_0x50051c['status']){case 0x0:if(_0x50051c['result']){if(_0x50051c[_0x2650('0x15')][_0x2650('0x16')]){logger[_0x2650('0x5')](_0x2650('0x17'),JSON[_0x2650('0xe')](_0x50051c['result'][_0x2650('0x18')]));_0x46ea6d=_0x50051c[_0x2650('0x15')]['hypotheses'][0x0][_0x2650('0x19')];_0x291590=_0x50051c[_0x2650('0x15')]['hypotheses'][0x0][_0x2650('0x1a')];_0x2fd96d='0';_0x33308e=_0x2650('0x1b');_0x44dbb2[_0x2650('0x13')]();}}break;case 0x1:logger[_0x2650('0x5')]('No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech');_0x2fd96d='1';_0x33308e=_0x2650('0x8');break;case 0x2:logger[_0x2650('0x5')](_0x2650('0x1c'));_0x2fd96d='2';_0x33308e=_0x2650('0x1c');break;case 0x9:logger[_0x2650('0x5')](_0x2650('0x1d'));_0x2fd96d='9';_0x33308e=_0x2650('0x1d');break;case 0xa:logger[_0x2650('0x5')]('Authentication\x20failed.');_0x2fd96d='10';_0x33308e=_0x2650('0x1e');break;case 0xb:logger[_0x2650('0x5')](_0x2650('0x1f'));_0x2fd96d='11';_0x33308e=_0x2650('0x1f');}}}catch(_0x21997d){logger[_0x2650('0x12')](_0x2650('0x20'),JSON[_0x2650('0xe')](_0x21997d));_0x44dbb2[_0x2650('0x13')]();}}function _0x54cf08(){logger[_0x2650('0x5')](_0x2650('0x21'));_0x21a077({'transcript':_0x46ea6d,'confidence':_0x291590,'status':_0x2fd96d,'status_message':_0x33308e});}function _0x48dc5f(_0x1f0266){logger['error'](_0x2650('0x22'));if(!_[_0x2650('0x23')](_0x1f0266)){logger[_0x2650('0x12')](_['isObject'](_0x1f0266)?JSON['stringify'](_0x1f0266):_0x1f0266);}}_0x44dbb2['on']('open',_0x32f0b6);_0x44dbb2['on']('message',_0x4b3e40);_0x44dbb2['on'](_0x2650('0x10'),_0x54cf08);_0x44dbb2['on']('error',_0x48dc5f);});}; \ 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 718ca9f..bd031ba 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 _0xddc7=['exports','./asr'];(function(_0x3d8669,_0x24811d){var _0x5716e2=function(_0x5765a8){while(--_0x5765a8){_0x3d8669['push'](_0x3d8669['shift']());}};_0x5716e2(++_0x24811d);}(_0xddc7,0x155));var _0x7ddc=function(_0xa16cc0,_0x217e43){_0xa16cc0=_0xa16cc0-0x0;var _0x5b7c04=_0xddc7[_0xa16cc0];return _0x5b7c04;};var asr=require(_0x7ddc('0x0'));module[_0x7ddc('0x1')]={'asr':asr}; \ No newline at end of file +var _0xad55=['./asr','exports'];(function(_0x33fa42,_0x5e8244){var _0x485801=function(_0x2fd9da){while(--_0x2fd9da){_0x33fa42['push'](_0x33fa42['shift']());}};_0x485801(++_0x5e8244);}(_0xad55,0x92));var _0x5ad5=function(_0x494b04,_0x36dacd){_0x494b04=_0x494b04-0x0;var _0x1f5a9b=_0xad55[_0x494b04];return _0x1f5a9b;};var asr=require(_0x5ad5('0x0'));module[_0x5ad5('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index 59f6ca8..98f00e0 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 _0x6fa0=['error','createServer','listening','connection','E_AGI_SERVER_VOICE_DISABLED','destroy','ready','E_AGI_SERVER_ERROR','close','E_AGI_SERVER_CLOSE','nextTick','exports','net','EventEmitter','./error','127.0.0.1','call','emit'];(function(_0x4c72f2,_0x42aba8){var _0xd26d61=function(_0x29aa96){while(--_0x29aa96){_0x4c72f2['push'](_0x4c72f2['shift']());}};_0xd26d61(++_0x42aba8);}(_0x6fa0,0xd2));var _0x06fa=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0x6fa0[_0x2be8c2];return _0x97f531;};'use strict';var util=require('util');var net=require(_0x06fa('0x0'));var EventEmitter=require('events')[_0x06fa('0x1')];var AGIError=require(_0x06fa('0x2'));var AGIChannel=require('./channel');var AGIServer=function(_0x2cdb8e,_0x5ebe6a,_0x41b78c){var _0x413649=this,_0x2cdb8e=_0x2cdb8e||0x11dd,_0x5ebe6a=_0x5ebe6a||_0x06fa('0x3'),_0xe5b79f=null,_0xc8dcea=0x0;EventEmitter[_0x06fa('0x4')](_0x413649);function _0x1eb171(){if(!_0x2cdb8e){_0x413649[_0x06fa('0x5')](_0x06fa('0x6'),new AGIError('E_AGI_ARGUMENT_PORT'));return![];}_0xe5b79f=net[_0x06fa('0x7')]();_0xe5b79f['listen'](_0x2cdb8e,_0x5ebe6a);_0xe5b79f['on'](_0x06fa('0x8'),function(){_0x413649['emit']('listening');});_0xe5b79f['on'](_0x06fa('0x9'),function(_0x6ea2ba){_0xe5b79f['getConnections'](function(_0x2629c2,_0x2e0148){if(_0x2629c2){_0x413649[_0x06fa('0x5')]('error',new AGIError('E_AGI_SERVER_ERROR',_0x2629c2));}else if(_0x41b78c&&_0x41b78c<0x0){_0x413649[_0x06fa('0x5')](_0x06fa('0x6'),new AGIError(_0x06fa('0xa')));_0x6ea2ba[_0x06fa('0xb')]();}else if(_0x41b78c&&_0x41b78c>0x0&&_0x41b78c<_0x2e0148){_0xc8dcea+=0x1;_0x413649[_0x06fa('0x5')](_0x06fa('0x6'),new AGIError('E_AGI_SERVER_MAXCONNECTION',_0xc8dcea));_0x6ea2ba[_0x06fa('0xb')]();}else{var _0x1cadc0=new AGIChannel(_0x6ea2ba);_0x1cadc0['on'](_0x06fa('0xc'),function(){_0x413649[_0x06fa('0x5')]('connection',_0x1cadc0);});}});});_0xe5b79f['on'](_0x06fa('0x6'),function(_0x598214){_0x413649[_0x06fa('0x5')](_0x06fa('0x6'),new AGIError(_0x06fa('0xd'),_0x598214['code']));});_0xe5b79f['on'](_0x06fa('0xe'),function(){_0x413649[_0x06fa('0x5')](_0x06fa('0xe'),new AGIError(_0x06fa('0xf')));});}process[_0x06fa('0x10')](function(){_0x1eb171();});};util['inherits'](AGIServer,EventEmitter);module[_0x06fa('0x11')]=function(_0x25024e,_0x213b6d,_0x5342b1){return new AGIServer(_0x25024e,_0x213b6d,_0x5342b1);}; \ No newline at end of file +var _0x03bd=['code','close','nextTick','exports','util','net','events','EventEmitter','./error','./channel','127.0.0.1','call','error','E_AGI_ARGUMENT_PORT','listen','listening','connection','getConnections','emit','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','E_AGI_SERVER_MAXCONNECTION','destroy','ready'];(function(_0x27f157,_0x5055df){var _0x3d765=function(_0x570fbd){while(--_0x570fbd){_0x27f157['push'](_0x27f157['shift']());}};_0x3d765(++_0x5055df);}(_0x03bd,0x94));var _0xd03b=function(_0x560875,_0x7f5cd1){_0x560875=_0x560875-0x0;var _0x1f8b18=_0x03bd[_0x560875];return _0x1f8b18;};'use strict';var util=require(_0xd03b('0x0'));var net=require(_0xd03b('0x1'));var EventEmitter=require(_0xd03b('0x2'))[_0xd03b('0x3')];var AGIError=require(_0xd03b('0x4'));var AGIChannel=require(_0xd03b('0x5'));var AGIServer=function(_0x1529a8,_0x4b1060,_0x39f773){var _0x5b24a8=this,_0x1529a8=_0x1529a8||0x11dd,_0x4b1060=_0x4b1060||_0xd03b('0x6'),_0x1b7d4f=null,_0x28001f=0x0;EventEmitter[_0xd03b('0x7')](_0x5b24a8);function _0x4b10f3(){if(!_0x1529a8){_0x5b24a8['emit'](_0xd03b('0x8'),new AGIError(_0xd03b('0x9')));return![];}_0x1b7d4f=net['createServer']();_0x1b7d4f[_0xd03b('0xa')](_0x1529a8,_0x4b1060);_0x1b7d4f['on'](_0xd03b('0xb'),function(){_0x5b24a8['emit'](_0xd03b('0xb'));});_0x1b7d4f['on'](_0xd03b('0xc'),function(_0x436dcb){_0x1b7d4f[_0xd03b('0xd')](function(_0x46578e,_0x3fffd7){if(_0x46578e){_0x5b24a8[_0xd03b('0xe')](_0xd03b('0x8'),new AGIError(_0xd03b('0xf'),_0x46578e));}else if(_0x39f773&&_0x39f773<0x0){_0x5b24a8['emit']('error',new AGIError(_0xd03b('0x10')));_0x436dcb['destroy']();}else if(_0x39f773&&_0x39f773>0x0&&_0x39f773<_0x3fffd7){_0x28001f+=0x1;_0x5b24a8[_0xd03b('0xe')](_0xd03b('0x8'),new AGIError(_0xd03b('0x11'),_0x28001f));_0x436dcb[_0xd03b('0x12')]();}else{var _0x45ee78=new AGIChannel(_0x436dcb);_0x45ee78['on'](_0xd03b('0x13'),function(){_0x5b24a8[_0xd03b('0xe')](_0xd03b('0xc'),_0x45ee78);});}});});_0x1b7d4f['on'](_0xd03b('0x8'),function(_0x35f1eb){_0x5b24a8[_0xd03b('0xe')](_0xd03b('0x8'),new AGIError('E_AGI_SERVER_ERROR',_0x35f1eb[_0xd03b('0x14')]));});_0x1b7d4f['on'](_0xd03b('0x15'),function(){_0x5b24a8['emit'](_0xd03b('0x15'),new AGIError('E_AGI_SERVER_CLOSE'));});}process[_0xd03b('0x16')](function(){_0x4b10f3();});};util['inherits'](AGIServer,EventEmitter);module[_0xd03b('0x17')]=function(_0x4b4ed9,_0x2ccb7a,_0x4419ad){return new AGIServer(_0x4b4ed9,_0x2ccb7a,_0x4419ad);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index c82d7d8..fe83a44 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 _0xc584=['Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','%s/recordings/%s','beep','NOBEEP','recordFile','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','context','extension','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','no\x20condition\x20configured','condition','true','false','EVAL\x20CONDITION\x20%s\x20%s','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','findBy','AGENT\x20%s\x20FOUND\x20BY','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','math\x20%s','%s[%s]','variable\x20%s[key]\x20set','no\x20file\x20audio\x20found','response','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','playback','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','macro','gosub','position','record','Enter\x20in\x20RECORD\x20(%s)\x20block','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','Response:','inspect','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','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','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','Smtp','\x22%s\x22\x20<%s>','email','user','subject','service','host','port','secure','authentication','auth','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','sms_account_id','no\x20sms\x20account\x20configured','getSmsAccount','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','START\x20CALLY\x20SQUARE','answer','yes','Answer','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','127.0.0.1','AGI','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','exports','util','lodash','randomstring','mustache','request-promise','../../config/logger','../../config/environment','./scripts','/var/opt/motion2/server/files','rawHeaders','rawBody','channel','rpc','mailRpc','prototype','getVariable','getVariableById','name','getVoiceQueue','then','catch','getSquareProject','getSquareProjectById','getSquareOdbcById','getUser','getTrunkById','getSound','getSoundById','getSoundPath','save_name','getMailAccount','getMailAccountById','sendMailMessage','getIntervalById','IntervalId','interval','format','%s/sounds/converted/%s','open','error','info','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','createSmsMessage','createSquareDetailsReport','createSquareRecording','uniqueid','calleridname','arg_1','createSquareMessage','isEmpty','random','lastName','isNil','phone','scheduledAt','callback','toString','callback_priority','getPauseById','agent','callerid','agentPause','agentUnpause','agentLogout','LOCAL','agentLogin','shellCommand','exec','trim','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','ssmlGender','audioEncoding','MP3','googleTTS','restAPI','url','number','timeout','includes','PUT','toUpperCase','body','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','message','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_voice','Amy','awsLex','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','appsecret','clear','agicommand','clone','hasOwnProperty','isString','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isPlainObject','saveRestApiResult','isArray','length','%s.%s','setVariable','split','replaceAll','getAndSetVariable','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','extra','retry','maxRetry','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','label','noop','no\x20text\x20configured','MRCPSynth','result','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','MRCPRecog','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','Executed\x20command\x20MRCPRecog\x20%s','agi','Enter\x20in\x20AGI\x20(%s)\x20block','command','args','Enter\x20in\x20ANSWER\x20(%s)\x20block','Enter\x20in\x20CALLBACK\x20(%s)\x20block','list_id','no\x20list\x20selected','delay','add','minutes','createCmContact','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','Executed\x20command\x20%s\x20%s','application','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','sestekasr','no\x20grammar\x20configured','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','getSquareOdbc','no\x20odbc\x20database\x20found','query','no\x20query\x20configured','query:\x20%s','getQueryOdbc','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','keys','forEach','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','no\x20user\x20selected','no\x20user\x20found','DIAL','SIP/%s','opts','Executed\x20command\x20%s','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','speech','out','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','client_email','no\x20client_email\x20configured','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','password','no\x20password\x20configured','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','.wav','SestekNDA\x20Result\x20%s','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','getTrunk','no\x20trunk\x20found','trunk_name','SIP/%s/%s','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','getdigits','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','getData','mindigit','maxdigit','hiddendigitsnum','generate','hiddendigitspos','first','substr','getsecretdigits','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','aws\x20Polly\x20%s\x20file\x20created','unlink','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','amazonlex','Amazon\x20Lex\x20Result\x20%s','googleasr'];(function(_0x50592e,_0xfc619c){var _0x9e8b8a=function(_0x45218b){while(--_0x45218b){_0x50592e['push'](_0x50592e['shift']());}};_0x9e8b8a(++_0xfc619c);}(_0xc584,0xa8));var _0x4c58=function(_0x62b58e,_0x46fe1e){_0x62b58e=_0x62b58e-0x0;var _0x37fe84=_0xc584[_0x62b58e];return _0x37fe84;};'use strict';var fs=require('fs');var path=require('path');var util=require(_0x4c58('0x0'));var _=require(_0x4c58('0x1'));var sh=require('shelljs');var odbc=require('odbc')();var rs=require(_0x4c58('0x2'));var moment=require('moment');var Mustache=require(_0x4c58('0x3'));var rp=require(_0x4c58('0x4'));var logger=require(_0x4c58('0x5'))('agi');var config=require(_0x4c58('0x6'));var scripts=require(_0x4c58('0x7'));var FILES_PATH=_0x4c58('0x8');var recursiveMapAttributes=[_0x4c58('0x9'),_0x4c58('0xa')];var verticesWithRetry=['menu','getdigits','getsecretdigits'];var AGIVertices=function(_0x3859a1,_0x46f663,_0x4550da){this[_0x4c58('0xb')]=_0x3859a1;this[_0x4c58('0xc')]=_0x46f663;this[_0x4c58('0xd')]=_0x4550da;};AGIVertices[_0x4c58('0xe')][_0x4c58('0xf')]=function(_0x2b1088,_0x416fa7){this[_0x4c58('0xc')][_0x4c58('0x10')](_0x2b1088)['then'](function(_0x5ed1fc){_0x416fa7(null,_0x5ed1fc?_0x5ed1fc[_0x4c58('0x11')]:![]);})['catch'](function(_0x821dba){_0x416fa7(_0x821dba);});};AGIVertices[_0x4c58('0xe')][_0x4c58('0x12')]=function(_0x105e95,_0x308372){this[_0x4c58('0xc')]['getVoiceQueueById'](_0x105e95)[_0x4c58('0x13')](function(_0x5b8fb3){_0x308372(null,_0x5b8fb3?_0x5b8fb3[_0x4c58('0x11')]:![]);})[_0x4c58('0x14')](function(_0x1831e4){_0x308372(_0x1831e4);});};AGIVertices[_0x4c58('0xe')][_0x4c58('0x15')]=function(_0x2fbd2e,_0x49916c){this[_0x4c58('0xc')][_0x4c58('0x16')](_0x2fbd2e)[_0x4c58('0x13')](function(_0x1dc590){_0x49916c(null,_0x1dc590?_0x1dc590[_0x4c58('0x11')]:![]);})['catch'](function(_0x259ad1){_0x49916c(_0x259ad1);});};AGIVertices[_0x4c58('0xe')]['getSquareOdbc']=function(_0x26631e,_0x76df98){this[_0x4c58('0xc')][_0x4c58('0x17')](_0x26631e)[_0x4c58('0x13')](function(_0x46876f){_0x76df98(null,_0x46876f?_0x46876f['dsn']:![]);})[_0x4c58('0x14')](function(_0x408e30){_0x76df98(_0x408e30);});};AGIVertices[_0x4c58('0xe')][_0x4c58('0x18')]=function(_0xdd2d81,_0x4f189f){this[_0x4c58('0xc')]['getUserById'](_0xdd2d81)[_0x4c58('0x13')](function(_0x368034){_0x4f189f(null,_0x368034?_0x368034['name']:![]);})[_0x4c58('0x14')](function(_0x386c98){_0x4f189f(_0x386c98);});};AGIVertices[_0x4c58('0xe')]['getTrunk']=function(_0x159bf8,_0x229f85){this[_0x4c58('0xc')][_0x4c58('0x19')](_0x159bf8)[_0x4c58('0x13')](function(_0x4ffaf0){_0x229f85(null,_0x4ffaf0?_0x4ffaf0[_0x4c58('0x11')]:![]);})[_0x4c58('0x14')](function(_0x30e4fa){_0x229f85(_0x30e4fa);});};AGIVertices[_0x4c58('0xe')][_0x4c58('0x1a')]=function(_0x15efd1,_0x38b2de){var _0x36de9c=this;this['rpc'][_0x4c58('0x1b')](_0x15efd1)[_0x4c58('0x13')](function(_0x2390a6){_0x38b2de(null,_0x2390a6?_0x36de9c[_0x4c58('0x1c')](_0x2390a6[_0x4c58('0x1d')]):![]);})[_0x4c58('0x14')](function(_0x32fe47){_0x38b2de(_0x32fe47);});};AGIVertices[_0x4c58('0xe')][_0x4c58('0x1e')]=function(_0x437975,_0x13cf99){this[_0x4c58('0xc')][_0x4c58('0x1f')](_0x437975)[_0x4c58('0x13')](function(_0x1531f1){_0x13cf99(null,_0x1531f1?_0x1531f1:![]);})[_0x4c58('0x14')](function(_0x2ed65e){_0x13cf99(_0x2ed65e);});};AGIVertices[_0x4c58('0xe')]['sendMailMessage']=function(_0x540fad,_0x5238c9,_0x282071){this['mailRpc'][_0x4c58('0x20')](_0x540fad,_0x5238c9)['then'](function(){_0x282071(null);})[_0x4c58('0x14')](function(_0x328554){_0x282071(_0x328554);});};AGIVertices[_0x4c58('0xe')]['getIntervals']=function(_0x19f851,_0x97d53b){this[_0x4c58('0xc')][_0x4c58('0x21')](_0x19f851)[_0x4c58('0x13')](function(_0x42a9b5){if(_0x42a9b5){if(_0x42a9b5[_0x4c58('0x22')]){_0x97d53b(null,[_0x42a9b5[_0x4c58('0x23')]]);}else{_0x97d53b(null,_['map'](_0x42a9b5['Intervals'],'interval'));}}else{_0x97d53b(null,![]);}})[_0x4c58('0x14')](function(_0x10ce89){_0x97d53b(_0x10ce89);});};AGIVertices[_0x4c58('0xe')]['getSoundPath']=function(_0x19b8f7){return util[_0x4c58('0x24')](_0x4c58('0x25'),FILES_PATH,_0x19b8f7);};AGIVertices[_0x4c58('0xe')]['getQueryOdbc']=function(_0x1a768b,_0x5c5153,_0x4588a2){odbc[_0x4c58('0x26')](_0x1a768b,function(_0x3090d3){if(_0x3090d3){logger[_0x4c58('0x27')]('Error\x20getting\x20ODBC\x20connection\x20%s',_0x3090d3);_0x4588a2(_0x3090d3);}else{logger[_0x4c58('0x28')]('ODBC\x20connection\x20successfully');odbc['query'](_0x5c5153,function(_0x25ab06,_0x497b9c){if(_0x25ab06){logger[_0x4c58('0x28')](_0x4c58('0x29'),_0x5c5153);_0x4588a2(_0x25ab06);}else{logger[_0x4c58('0x28')](_0x4c58('0x2a'),_0x5c5153);odbc[_0x4c58('0x2b')](function(_0x5ede49){if(_0x5ede49){logger[_0x4c58('0x27')](_0x4c58('0x2c'),_0x5ede49);}_0x4588a2(null,_0x497b9c);});}});}});};AGIVertices['prototype']['getSmsAccount']=function(_0x3276f7,_0xb59516){this[_0x4c58('0xc')]['getSmsAccountById'](_0x3276f7)['then'](function(_0x563f70){_0xb59516(null,_0x563f70?_0x563f70:![]);})[_0x4c58('0x14')](function(_0x5797ae){_0xb59516(_0x5797ae);});};AGIVertices[_0x4c58('0xe')]['createSmsMessage']=function(_0x3e14b2,_0x2f1eec){this[_0x4c58('0xc')][_0x4c58('0x2d')](_0x3e14b2)[_0x4c58('0x13')](function(_0xdf2702){_0x2f1eec(null,_0xdf2702);})[_0x4c58('0x14')](function(_0x10be94){_0x2f1eec(_0x10be94);});};AGIVertices[_0x4c58('0xe')][_0x4c58('0x2e')]=function(_0x1f8d23,_0x2f50cc,_0x31a2ec){this[_0x4c58('0xc')][_0x4c58('0x2e')]({'uniqueid':this[_0x4c58('0xb')]['uniqueid'],'node':_0x1f8d23['label'],'application':_0x1f8d23['agicommand'],'data':_0x2f50cc||null,'project_name':this[_0x4c58('0xb')]['arg_1'],'callerid':this['channel']['callerid']})[_0x4c58('0x13')](function(_0x3c6749){if(_0x31a2ec){_0x31a2ec(null,_0x3c6749);}})[_0x4c58('0x14')](function(_0x1caa96){if(_0x31a2ec){_0x31a2ec(_0x1caa96);}});};AGIVertices[_0x4c58('0xe')]['createSquareRecording']=function(_0x2a6bb8,_0x505081,_0x5b6774,_0x303bf0){this['rpc'][_0x4c58('0x2f')]({'uniqueid':this[_0x4c58('0xb')][_0x4c58('0x30')],'callerid':this['channel']['callerid'],'calleridname':this['channel'][_0x4c58('0x31')],'context':this['channel']['context'],'extension':this[_0x4c58('0xb')]['extension'],'priority':this[_0x4c58('0xb')]['priority'],'accountcode':this[_0x4c58('0xb')]['accountcode'],'dnid':this[_0x4c58('0xb')]['dnid'],'projectName':this[_0x4c58('0xb')][_0x4c58('0x32')],'saveName':_0x505081,'filename':_0x2a6bb8['file']||_0x505081,'savePath':_0x5b6774})[_0x4c58('0x13')](function(_0x2876ad){_0x303bf0(null,_0x2876ad);})['catch'](function(_0x8d3178){_0x303bf0(_0x8d3178);});};AGIVertices[_0x4c58('0xe')][_0x4c58('0x33')]=function(_0x465ca3,_0x635815,_0x47964,_0x480ba0,_0x3c4cb7){this[_0x4c58('0xc')][_0x4c58('0x33')]({'uniqueid':this[_0x4c58('0xb')][_0x4c58('0x30')],'body':_0x465ca3,'direction':_0x635815,'providerName':_0x47964,'providerResponse':_0x480ba0})['then'](function(_0x376c18){if(_0x3c4cb7){_0x3c4cb7(null,_0x376c18);}})[_0x4c58('0x14')](function(_0x246b93){if(_0x3c4cb7){_0x3c4cb7(_0x246b93);}});};AGIVertices['prototype']['createCmContact']=function(_0xd9f55a,_0x3243c0){this[_0x4c58('0xc')]['createCmContact']({'firstName':_[_0x4c58('0x34')](_0xd9f55a[_0x4c58('0x11')])||_['isNil'](_0xd9f55a['name'])?'callback_'+Math[_0x4c58('0x35')]():_0xd9f55a[_0x4c58('0x11')],'lastName':_[_0x4c58('0x34')](_0xd9f55a[_0x4c58('0x36')])||_[_0x4c58('0x37')](_0xd9f55a[_0x4c58('0x36')])?null:_0xd9f55a[_0x4c58('0x36')],'phone':_0xd9f55a[_0x4c58('0x38')],'ListId':_0xd9f55a['list_id'],'scheduledat':_0xd9f55a[_0x4c58('0x39')],'callbackUniqueid':this[_0x4c58('0xb')][_0x4c58('0x30')],'tags':_0x4c58('0x3a'),'description':'Callback\x20scheduled\x20at\x20'+_0xd9f55a['scheduledAt'][_0x4c58('0x3b')](),'priority':_0xd9f55a[_0x4c58('0x3c')]})['then'](function(_0x145c8e){_0x3243c0(null,_0x145c8e);})[_0x4c58('0x14')](function(_0x581089){_0x3243c0(_0x581089);});};AGIVertices[_0x4c58('0xe')]['getPause']=function(_0x316407,_0x386543){this[_0x4c58('0xc')][_0x4c58('0x3d')](_0x316407)[_0x4c58('0x13')](function(_0x1d4eb3){_0x386543(null,_0x1d4eb3?_0x1d4eb3[_0x4c58('0x11')]:![]);})[_0x4c58('0x14')](function(_0x4adba8){_0x386543(_0x4adba8);});};AGIVertices['prototype']['agentPause']=function(_0x545568,_0xb472b3,_0x386660){var _0x578177={'role':_0x4c58('0x3e')};_0x578177[_0x545568]=this['channel'][_0x4c58('0x3f')];this[_0x4c58('0xc')][_0x4c58('0x40')](_0x578177,_0xb472b3,this[_0x4c58('0xb')]['uniqueid'])[_0x4c58('0x13')](function(_0x2b8731){_0x386660(null,_[_0x4c58('0x37')](_0x2b8731)?![]:!![]);})[_0x4c58('0x14')](function(_0xdd08bd){logger[_0x4c58('0x27')](_0xdd08bd);_0x386660(null,![]);});};AGIVertices[_0x4c58('0xe')][_0x4c58('0x41')]=function(_0x458be3,_0x52ba81){var _0x335de6={'role':_0x4c58('0x3e')};_0x335de6[_0x458be3]=this[_0x4c58('0xb')]['callerid'];this[_0x4c58('0xc')][_0x4c58('0x41')](_0x335de6)[_0x4c58('0x13')](function(_0x6f3d60){_0x52ba81(null,_[_0x4c58('0x37')](_0x6f3d60)?![]:!![]);})[_0x4c58('0x14')](function(_0x42df0c){logger[_0x4c58('0x27')](_0x42df0c);_0x52ba81(null,![]);});};AGIVertices[_0x4c58('0xe')][_0x4c58('0x42')]=function(_0x4377e2,_0x22addf){var _0x31bc86={'role':'agent'};_0x31bc86[_0x4377e2]=this[_0x4c58('0xb')][_0x4c58('0x3f')];this[_0x4c58('0xc')][_0x4c58('0x42')](_0x31bc86)[_0x4c58('0x13')](function(_0x3390de){_0x22addf(null,_[_0x4c58('0x37')](_0x3390de)?![]:!![]);})['catch'](function(_0xfb4b0f){logger[_0x4c58('0x27')](_0xfb4b0f);_0x22addf(null,![]);});};AGIVertices[_0x4c58('0xe')]['agentLogin']=function(_0x9d9ff6,_0x46cc47){var _0x17c773={'role':_0x4c58('0x3e')};_0x17c773[_0x9d9ff6]=this[_0x4c58('0xb')][_0x4c58('0x3f')];var _0x55cb84=_0x9d9ff6!='internal'?util[_0x4c58('0x24')]('%s/%s@from-sip/n',_0x4c58('0x43'),this['channel'][_0x4c58('0x3f')]):undefined;this[_0x4c58('0xc')][_0x4c58('0x44')](_0x17c773,_0x55cb84)[_0x4c58('0x13')](function(_0x23bf43){_0x46cc47(null,_[_0x4c58('0x37')](_0x23bf43)?![]:!![]);})[_0x4c58('0x14')](function(_0x21f92e){logger[_0x4c58('0x27')](_0x21f92e);_0x46cc47(null,![]);});};AGIVertices[_0x4c58('0xe')][_0x4c58('0x45')]=function(_0x21a36b,_0x370a50){sh[_0x4c58('0x46')](_[_0x4c58('0x47')](_0x21a36b),function(_0x5ca4fd,_0x9b38fd){var _0x3bb249=_0x9b38fd[_0x4c58('0x48')](/(\r\n|\n|\r)/gm,'');_0x370a50(null,_0x3bb249);});};AGIVertices[_0x4c58('0xe')][_0x4c58('0x49')]=function(_0x582b98,_0x5ab350){scripts['googleCloudTTS'](_0x582b98[_0x4c58('0x4a')],_0x582b98[_0x4c58('0x4b')]||_0x4c58('0x4c'),_0x582b98[_0x4c58('0x4c')],_0x582b98['languageCode']||'en-US',_0x582b98[_0x4c58('0x4d')]||'MALE',_0x582b98[_0x4c58('0x4e')]||_0x4c58('0x4f'))['then'](function(_0xe7eb2e){_0x5ab350(null,_0xe7eb2e);})[_0x4c58('0x14')](function(_0x5bd072){_0x5ab350(_0x5bd072);});};AGIVertices['prototype'][_0x4c58('0x50')]=function(_0x4d36eb,_0xab199c){scripts['googleTTS'](_0x4d36eb[_0x4c58('0x4c')],_0x4d36eb['google_tts_language']||'en',0x1)[_0x4c58('0x13')](function(_0x3153eb){_0xab199c(null,_0x3153eb);})[_0x4c58('0x14')](function(_0x143657){_0xab199c(_0x143657);});};AGIVertices[_0x4c58('0xe')][_0x4c58('0x51')]=function(_0x21c4c8,_0x295cdd){var _0xc4caf2={'uri':_0x21c4c8[_0x4c58('0x52')],'method':_0x21c4c8['method'],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x21c4c8['timeout'])===_0x4c58('0x53')&&parseInt(_0x21c4c8[_0x4c58('0x54')])>=0x1?parseInt(_0x21c4c8[_0x4c58('0x54')])*0x3e8:0x5*0x3e8};if(_[_0x4c58('0x55')](['POST',_0x4c58('0x56')],_0xc4caf2['method'][_0x4c58('0x57')]())){try{_0xc4caf2[_0x4c58('0x58')]=_0x21c4c8['rawBody']?JSON[_0x4c58('0x59')](_0x21c4c8[_0x4c58('0xa')]):{};}catch(_0x3ce1ed){logger['error'](_0x4c58('0x5a'),_0x3ce1ed);}}try{_0xc4caf2[_0x4c58('0x5b')]=_0x21c4c8[_0x4c58('0x9')]?JSON['parse'](_0x21c4c8[_0x4c58('0x9')]):{};}catch(_0x33c472){logger[_0x4c58('0x27')](_0x4c58('0x5c'),_0x33c472);}if(_0x21c4c8[_0x4c58('0x5d')]){try{var _0x173e0e=require(_0x21c4c8[_0x4c58('0x5d')])[_0x4c58('0x5e')](this,_0xc4caf2);_0xc4caf2[_0x4c58('0x5f')]=Mustache['render'](_0x21c4c8[_0x4c58('0x52')],_0x173e0e,{},['$$','$$']);if(_0xc4caf2[_0x4c58('0x5b')]){_0xc4caf2[_0x4c58('0x5b')]=JSON[_0x4c58('0x59')](Mustache['render'](JSON[_0x4c58('0x60')](_0xc4caf2[_0x4c58('0x5b')]),_0x173e0e,{},['$$','$$']));}if(_0xc4caf2[_0x4c58('0x58')]){_0xc4caf2[_0x4c58('0x58')]=JSON[_0x4c58('0x59')](Mustache['render'](JSON[_0x4c58('0x60')](_0xc4caf2[_0x4c58('0x58')]),_0x173e0e,{},['$$','$$']));}}catch(_0x52a2d2){logger[_0x4c58('0x27')](_0x4c58('0x61'),_0x52a2d2);}}rp(_0xc4caf2)[_0x4c58('0x13')](function(_0x1fda5d){var _0x41651c={'statusCode':_0x1fda5d[_0x4c58('0x62')]||0xc8,'statusMessage':_0x1fda5d[_0x4c58('0x63')]||'OK','headers':_0x1fda5d[_0x4c58('0x5b')]||{},'body':_0x1fda5d[_0x4c58('0x58')]||{}};_0x295cdd(null,_0x41651c);})[_0x4c58('0x14')](function(_0x724b32){var _0x3aa30e={'statusCode':_0x724b32[_0x4c58('0x62')]||0x1f4,'statusMessage':_0x724b32[_0x4c58('0x64')]||'500\x20-\x20Internal\x20Server\x20Error','headers':_0x724b32[_0x4c58('0x65')]['headers']||{},'body':_0x724b32[_0x4c58('0x65')]['body']||{}};_0x295cdd(null,_0x3aa30e);});};AGIVertices['prototype'][_0x4c58('0x66')]=function(_0x382164,_0x4156d4){scripts['googleDialogflow'](this[_0x4c58('0xb')][_0x4c58('0x30')],_0x382164[_0x4c58('0x67')],_0x382164['text'],_0x382164[_0x4c58('0x68')]||'en')['then'](function(_0x5c9dac){_0x4156d4(null,_0x5c9dac);})['catch'](function(_0x216d43){_0x4156d4(_0x216d43);});};AGIVertices[_0x4c58('0xe')][_0x4c58('0x69')]=function(_0x4229d9,_0x5d05a0){scripts['googleDialogflowV2'](this[_0x4c58('0xb')][_0x4c58('0x30')],_0x4229d9[_0x4c58('0x6a')],_0x4229d9['client_email'],_0x4229d9[_0x4c58('0x6b')],_0x4229d9['text'],_0x4229d9['dialogflowV2_language']||'en')['then'](function(_0x1804b4){_0x5d05a0(null,_0x1804b4);})['catch'](function(_0xaa171b){_0x5d05a0(_0xaa171b);});};AGIVertices[_0x4c58('0xe')][_0x4c58('0x6c')]=function(_0x5bb1f1,_0x589cdd){scripts[_0x4c58('0x6c')](this[_0x4c58('0xb')],_0x5bb1f1)[_0x4c58('0x13')](function(_0x207e08){_0x589cdd(null,_0x207e08);})['catch'](function(_0x615165){_0x589cdd(_0x615165);});};AGIVertices[_0x4c58('0xe')][_0x4c58('0x6d')]=function(_0x2e96ce,_0x148515){scripts['ispeechTTS'](_0x2e96ce['key'],_0x2e96ce['text'],_0x2e96ce[_0x4c58('0x6e')]||_0x4c58('0x6f'),_0x2e96ce[_0x4c58('0x70')])[_0x4c58('0x13')](function(_0x57eded){_0x148515(null,_0x57eded);})[_0x4c58('0x14')](function(_0x1ccb13){_0x148515(_0x1ccb13);});};AGIVertices['prototype'][_0x4c58('0x71')]=function(_0x5d4ca5,_0x317123,_0x42082b){scripts[_0x4c58('0x71')](_0x317123,_0x5d4ca5['key'],_0x5d4ca5[_0x4c58('0x72')]||_0x4c58('0x6f'),this[_0x4c58('0x73')](_0x5d4ca5[_0x4c58('0x74')])?_0x5d4ca5[_0x4c58('0x74')]:undefined)[_0x4c58('0x13')](function(_0x108f59){_0x42082b(null,_0x108f59);})['catch'](function(_0x36fb52){_0x42082b(_0x36fb52);});};AGIVertices[_0x4c58('0xe')][_0x4c58('0x75')]=function(_0x454b73,_0x3e3463){scripts['awsPolly'](_0x454b73[_0x4c58('0x76')],_0x454b73[_0x4c58('0x77')],_0x454b73['aws_polly_region'],_0x454b73[_0x4c58('0x78')]||_0x4c58('0x79'),_0x454b73[_0x4c58('0x4c')],_0x454b73['aws_text_type']||'text')[_0x4c58('0x13')](function(_0x4f522a){_0x3e3463(null,_0x4f522a);})[_0x4c58('0x14')](function(_0xcdc477){_0x3e3463(_0xcdc477);});};AGIVertices[_0x4c58('0xe')][_0x4c58('0x7a')]=function(_0x51b977,_0x12c9ba){scripts['awsLex'](this[_0x4c58('0xb')]['uniqueid'],_0x51b977[_0x4c58('0x76')],_0x51b977[_0x4c58('0x77')],_0x51b977['aws_lex_region'],_0x51b977[_0x4c58('0x4c')],_0x51b977[_0x4c58('0x7b')])[_0x4c58('0x13')](function(_0x1b64b5){_0x12c9ba(null,_0x1b64b5);})[_0x4c58('0x14')](function(_0x12f519){_0x12c9ba(_0x12f519);});};AGIVertices[_0x4c58('0xe')][_0x4c58('0x7c')]=function(_0x2637cb,_0x41ab5f,_0xf9af8e){scripts['googleASR'](_0x41ab5f,_0x2637cb[_0x4c58('0x67')],_0x2637cb[_0x4c58('0x7d')]||_0x4c58('0x6f'))['then'](function(_0x3329aa){_0xf9af8e(null,_0x3329aa);})[_0x4c58('0x14')](function(_0x4caf6e){_0xf9af8e(_0x4caf6e);});};AGIVertices[_0x4c58('0xe')][_0x4c58('0x7e')]=function(_0x14c70d,_0x318d3e,_0x3bd128){scripts[_0x4c58('0x7e')](_0x318d3e,_0x14c70d[_0x4c58('0x7f')],_0x14c70d[_0x4c58('0x80')],_0x14c70d['uri'])[_0x4c58('0x13')](function(_0x210030){_0x3bd128(null,_0x210030);})['catch'](function(_0x56443e){_0x3bd128(_0x56443e);});};AGIVertices[_0x4c58('0xe')][_0x4c58('0x81')]=function(_0x40ac66){var _0x6029d4=_[_0x4c58('0x55')](verticesWithRetry,_0x40ac66[_0x4c58('0x82')])?_0x40ac66:_[_0x4c58('0x83')](_0x40ac66);for(var _0x454fa6 in _0x6029d4){if(_0x6029d4[_0x4c58('0x84')](_0x454fa6)){if(_0x6029d4[_0x454fa6]&&_[_0x4c58('0x85')](_0x6029d4[_0x454fa6])){if(_['includes'](recursiveMapAttributes,_0x454fa6)){_0x6029d4[_0x454fa6]=this[_0x4c58('0x86')](_0x6029d4[_0x454fa6]);}else{_0x6029d4[_0x454fa6]=this[_0x4c58('0x87')](_0x6029d4[_0x454fa6]);}}}}return _0x6029d4;};AGIVertices[_0x4c58('0xe')][_0x4c58('0x88')]=function(_0x4ee068){for(var _0x3acdc1 in _0x4ee068){if(_0x4ee068[_0x4c58('0x84')](_0x3acdc1)){if(_[_0x4c58('0x89')](_0x4ee068[_0x3acdc1])){this['recursiveNodeIndex'](_0x4ee068[_0x3acdc1]);}else if(_['isArray'](_0x4ee068[_0x3acdc1])){for(var _0x5a7eac=0x0;_0x5a7eac<_0x4ee068[_0x3acdc1]['length'];_0x5a7eac++){this[_0x4c58('0x88')](_0x4ee068[_0x3acdc1][_0x5a7eac]);}}else if(_[_0x4c58('0x85')](_0x4ee068[_0x3acdc1])){_0x4ee068[_0x3acdc1]=this['replaceAllVariables'](_0x4ee068[_0x3acdc1]);}}}};AGIVertices['prototype'][_0x4c58('0x8a')]=function(_0x5b7b03,_0x37a137){for(var _0x486834 in _0x5b7b03){if(_0x5b7b03[_0x4c58('0x84')](_0x486834)){if(_[_0x4c58('0x89')](_0x5b7b03[_0x486834])){if(!_['isEmpty'](_0x5b7b03[_0x486834])){this[_0x4c58('0x8a')](_0x5b7b03[_0x486834],util['format']('%s.%s',_0x37a137,_0x486834));}}else if(_[_0x4c58('0x8b')](_0x5b7b03[_0x486834])){for(var _0x1f419e=0x0;_0x1f419e<_0x5b7b03[_0x486834][_0x4c58('0x8c')];_0x1f419e++){this[_0x4c58('0x8a')](_0x5b7b03[_0x486834][_0x1f419e],util[_0x4c58('0x24')](_0x4c58('0x8d'),_0x37a137,_0x486834+'['+_0x1f419e+']'));}}else{if(!_[_0x4c58('0x37')](_0x5b7b03[_0x486834])){this[_0x4c58('0xb')][_0x4c58('0x8e')](util[_0x4c58('0x24')]('%s.%s',_0x37a137,_0x486834),_0x5b7b03[_0x486834]);}}}}};AGIVertices[_0x4c58('0xe')]['replaceObjectAllVariables']=function(_0x36ca58){try{var _0x49a652=JSON[_0x4c58('0x59')](_0x36ca58);this[_0x4c58('0x88')](_0x49a652);return JSON[_0x4c58('0x60')](_0x49a652);}catch(_0x376ba4){return this[_0x4c58('0x87')](_0x36ca58);}};AGIVertices[_0x4c58('0xe')][_0x4c58('0x87')]=function(_0x592a2e){var _0x11d533=_0x592a2e[_0x4c58('0x8f')]('{');for(var _0x12b6ae=0x1;_0x12b6ae<_0x11d533[_0x4c58('0x8c')];_0x12b6ae+=0x1){var _0x5297f1=_0x11d533[_0x12b6ae]['split']('}');if(_0x5297f1[_0x4c58('0x8c')]>0x1){_0x592a2e=_0x592a2e[_0x4c58('0x90')]('{'+_0x5297f1[0x0]+'}',this[_0x4c58('0xb')][_0x4c58('0xf')](_0x5297f1[0x0])['extra']||_0x5297f1[0x0]);}}if(_0x11d533[_0x4c58('0x8c')]===0x1){return _0x592a2e[_0x4c58('0x3b')]();}return this[_0x4c58('0x87')](_0x592a2e);};AGIVertices[_0x4c58('0xe')][_0x4c58('0x91')]=function(_0x5c5a9e,_0x249b9d){var _0x552b79=this[_0x4c58('0xb')]['getVariable'](_0x5c5a9e);if(_0x552b79['result']===-0x1){return _0x552b79;}logger[_0x4c58('0x28')](util[_0x4c58('0x24')](_0x4c58('0x92'),_0x249b9d,_0x552b79['extra']));return this[_0x4c58('0xb')][_0x4c58('0x8e')](_0x249b9d,_0x552b79[_0x4c58('0x93')]);};AGIVertices[_0x4c58('0xe')][_0x4c58('0x73')]=function(_0x5274a9){return _0x5274a9&&_0x5274a9!=='0'&&_0x5274a9!=='-1'&&_0x5274a9!=='';};AGIVertices[_0x4c58('0xe')]['maxRetry']=function(_0x29b350){this[_0x4c58('0x2e')][_0x4c58('0x5e')](this,_0x29b350,'-');_0x29b350[_0x4c58('0x94')]=_0x29b350[_0x4c58('0x95')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x4c58('0xe')]['mrcpsynth']=function(_0x495b53){logger[_0x4c58('0x28')](util[_0x4c58('0x24')](_0x4c58('0x96'),_0x495b53[_0x4c58('0x97')]));if(!this[_0x4c58('0x73')](_0x495b53[_0x4c58('0x4c')])){return this[_0x4c58('0xb')][_0x4c58('0x98')](_0x4c58('0x99'));}var _0x4f35b8='\x22'+_0x495b53[_0x4c58('0x4c')]+'\x22';if(this['isConfigured'](_0x495b53['options'])){_0x4f35b8+=','+_0x495b53[_0x4c58('0x65')];}var _0x259256=this['channel'][_0x4c58('0x46')](_0x4c58('0x9a'),_0x4f35b8);if(_0x259256[_0x4c58('0x9b')]===-0x1){return _0x259256;}return this['channel'][_0x4c58('0x98')](util[_0x4c58('0x24')](_0x4c58('0x9c'),_0x4f35b8));};AGIVertices[_0x4c58('0xe')][_0x4c58('0x9d')]=function(_0x498989){logger['info'](util[_0x4c58('0x24')](_0x4c58('0x9e'),_0x498989['label']));if(!this[_0x4c58('0x73')](_0x498989[_0x4c58('0x9f')])){return this['channel']['noop']('no\x20grammar\x20configured');}var _0x3970e2=_0x498989[_0x4c58('0x9f')];if(this['isConfigured'](_0x498989[_0x4c58('0x65')])){_0x3970e2+=','+_0x498989[_0x4c58('0x65')];}var _0x14ff0f=this[_0x4c58('0xb')][_0x4c58('0x46')](_0x4c58('0xa0'),_0x3970e2);if(_0x14ff0f['result']===-0x1){return _0x14ff0f;}var _0x311ed2=this[_0x4c58('0x91')](_0x4c58('0xa1'),_0x4c58('0xa2'));if(_0x311ed2['result']===-0x1){return _0x311ed2;}var _0x290a37=this[_0x4c58('0x91')](_0x4c58('0xa3'),_0x4c58('0xa4'));if(_0x290a37[_0x4c58('0x9b')]===-0x1){return _0x290a37;}var _0x3d2d3c=this[_0x4c58('0x91')](_0x4c58('0xa5'),'MRCP_RECOG_INSTANCE');if(_0x3d2d3c[_0x4c58('0x9b')]===-0x1){return _0x3d2d3c;}return this[_0x4c58('0xb')][_0x4c58('0x98')](util[_0x4c58('0x24')](_0x4c58('0xa6'),_0x3970e2));};AGIVertices[_0x4c58('0xe')][_0x4c58('0xa7')]=function(_0xb915b2){logger[_0x4c58('0x28')](util[_0x4c58('0x24')](_0x4c58('0xa8'),_0xb915b2[_0x4c58('0x97')]));return this[_0x4c58('0xb')][_0x4c58('0xa7')]([_0xb915b2[_0x4c58('0xa9')],_0xb915b2[_0x4c58('0xaa')]]);};AGIVertices[_0x4c58('0xe')]['answer']=function(_0x47633b){logger[_0x4c58('0x28')](util[_0x4c58('0x24')](_0x4c58('0xab'),_0x47633b[_0x4c58('0x97')]));if(this[_0x4c58('0x73')](_0x47633b[_0x4c58('0x54')])){logger[_0x4c58('0x28')](util[_0x4c58('0x24')]('Wait\x20%s\x20seconds\x20before\x20answer',_0x47633b[_0x4c58('0x54')]));var _0x46b97c=this['channel']['wait'](_0x47633b[_0x4c58('0x54')]);if(_0x46b97c[_0x4c58('0x9b')]===-0x1){return _0x46b97c;}}return this[_0x4c58('0xb')]['answer']();};AGIVertices[_0x4c58('0xe')][_0x4c58('0x3a')]=function(_0x154a8a){logger['info'](util['format'](_0x4c58('0xac'),_0x154a8a[_0x4c58('0x97')]));if(!this[_0x4c58('0x73')](_0x154a8a[_0x4c58('0xad')])){return this[_0x4c58('0xb')]['error'](_0x154a8a,_0x4c58('0xae'));}_0x154a8a[_0x4c58('0x39')]=moment();if(this[_0x4c58('0x73')](_0x154a8a[_0x4c58('0xaf')])){_0x154a8a['scheduledAt']=moment()[_0x4c58('0xb0')](_0x154a8a['delay'],_0x4c58('0xb1'));}if(!this[_0x4c58('0x73')](_0x154a8a['callback_priority'])){_0x154a8a[_0x4c58('0x3c')]=0x2;}this[_0x4c58('0xb2')][_0x4c58('0x5e')](this,_0x154a8a);return this[_0x4c58('0xb')]['noop'](util[_0x4c58('0x24')](_0x4c58('0xb3'),_0x154a8a['phone'],_0x154a8a[_0x4c58('0xad')],_0x154a8a[_0x4c58('0x39')]));};AGIVertices[_0x4c58('0xe')]['custom_app']=function(_0x3ae72d){logger[_0x4c58('0x28')](util[_0x4c58('0x24')](_0x4c58('0xb4'),_0x3ae72d[_0x4c58('0x97')]));var _0x50dd93=this[_0x4c58('0xb')]['exec'](_0x3ae72d['application'],_0x3ae72d[_0x4c58('0x65')]);if(_0x50dd93[_0x4c58('0x9b')]===-0x1){return _0x50dd93;}return this[_0x4c58('0xb')]['noop'](util[_0x4c58('0x24')](_0x4c58('0xb5'),_0x3ae72d[_0x4c58('0xb6')],_0x3ae72d[_0x4c58('0x65')]));};AGIVertices[_0x4c58('0xe')][_0x4c58('0xb7')]=function(_0x5d0a6d){logger['info'](util[_0x4c58('0x24')](_0x4c58('0xb8'),_0x5d0a6d[_0x4c58('0x97')]));if(!this[_0x4c58('0x73')](_0x5d0a6d['text'])){return this[_0x4c58('0xb')][_0x4c58('0x98')](_0x4c58('0x99'));}var _0xb8b1b9='\x22'+_0x5d0a6d['text']+'\x22';if(this[_0x4c58('0x73')](_0x5d0a6d[_0x4c58('0x65')])){_0xb8b1b9+=','+_0x5d0a6d['options'];}var _0xc74136=this[_0x4c58('0xb')][_0x4c58('0x46')](_0x4c58('0x9a'),_0xb8b1b9);if(_0xc74136[_0x4c58('0x9b')]===-0x1){return _0xc74136;}return this[_0x4c58('0xb')]['noop'](util[_0x4c58('0x24')](_0x4c58('0x9c'),_0xb8b1b9));};AGIVertices['prototype'][_0x4c58('0xb9')]=function(_0x55d3d2){logger[_0x4c58('0x28')](util[_0x4c58('0x24')](_0x4c58('0xba'),_0x55d3d2['label']));if(!this[_0x4c58('0x73')](_0x55d3d2[_0x4c58('0x4c')])){return this[_0x4c58('0xb')]['noop'](_0x4c58('0x99'));}var _0x317a13='\x22'+_0x55d3d2[_0x4c58('0x4c')]+'\x22';if(this[_0x4c58('0x73')](_0x55d3d2[_0x4c58('0x65')])){_0x317a13+=','+_0x55d3d2[_0x4c58('0x65')];}var _0x458140=this[_0x4c58('0xb')][_0x4c58('0x46')]('MRCPSynth',_0x317a13);if(_0x458140['result']===-0x1){return _0x458140;}return this[_0x4c58('0xb')]['noop'](util['format'](_0x4c58('0x9c'),_0x317a13));};AGIVertices['prototype']['lumenvoxasr']=function(_0x1b542e){logger[_0x4c58('0x28')](util[_0x4c58('0x24')]('Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block',_0x1b542e[_0x4c58('0x97')]));if(!this[_0x4c58('0x73')](_0x1b542e[_0x4c58('0x9f')])){return this[_0x4c58('0xb')][_0x4c58('0x98')]('no\x20grammar\x20configured');}var _0x37034a=_0x1b542e[_0x4c58('0x9f')];if(this[_0x4c58('0x73')](_0x1b542e[_0x4c58('0x65')])){_0x37034a+=','+_0x1b542e[_0x4c58('0x65')];}var _0x5e174d=this[_0x4c58('0xb')][_0x4c58('0x46')](_0x4c58('0xa0'),_0x37034a);if(_0x5e174d[_0x4c58('0x9b')]===-0x1){return _0x5e174d;}var _0x58f3f4=this[_0x4c58('0x91')](_0x4c58('0xa1'),_0x4c58('0xbb'));if(_0x58f3f4[_0x4c58('0x9b')]===-0x1){return _0x58f3f4;}var _0x1f458a=this[_0x4c58('0x91')](_0x4c58('0xa3'),_0x4c58('0xbc'));if(_0x1f458a[_0x4c58('0x9b')]===-0x1){return _0x1f458a;}var _0x9f6bec=this['getAndSetVariable'](_0x4c58('0xa5'),_0x4c58('0xbd'));if(_0x9f6bec['result']===-0x1){return _0x9f6bec;}return this[_0x4c58('0xb')]['noop'](util[_0x4c58('0x24')](_0x4c58('0xa6'),_0x37034a));};AGIVertices[_0x4c58('0xe')][_0x4c58('0xbe')]=function(_0x35e16e){logger['info'](util[_0x4c58('0x24')]('Enter\x20in\x20SESTEKASR\x20(%s)\x20block',_0x35e16e[_0x4c58('0x97')]));if(!this[_0x4c58('0x73')](_0x35e16e[_0x4c58('0x9f')])){return this[_0x4c58('0xb')][_0x4c58('0x98')](_0x4c58('0xbf'));}var _0xe1e90b=_0x35e16e['grammar'];if(this[_0x4c58('0x73')](_0x35e16e['options'])){_0xe1e90b+=','+_0x35e16e['options'];}var _0x4a55d5=this[_0x4c58('0xb')][_0x4c58('0x46')](_0x4c58('0xa0'),_0xe1e90b);if(_0x4a55d5[_0x4c58('0x9b')]===-0x1){return _0x4a55d5;}var _0x2195f7=this[_0x4c58('0x91')]('RECOG_CONFIDENCE()',_0x4c58('0xc0'));if(_0x2195f7[_0x4c58('0x9b')]===-0x1){return _0x2195f7;}var _0x428021=this[_0x4c58('0x91')](_0x4c58('0xa3'),'SESTEK_ASR_TRANSCRIPT');if(_0x428021[_0x4c58('0x9b')]===-0x1){return _0x428021;}var _0x5dbef3=this['getAndSetVariable'](_0x4c58('0xa5'),_0x4c58('0xc1'));if(_0x5dbef3[_0x4c58('0x9b')]===-0x1){return _0x5dbef3;}return this[_0x4c58('0xb')]['noop'](util['format'](_0x4c58('0xa6'),_0xe1e90b));};AGIVertices[_0x4c58('0xe')][_0x4c58('0xc2')]=function(_0x19a8a3){logger['info'](util['format'](_0x4c58('0xc3'),_0x19a8a3['label']));if(!this[_0x4c58('0x73')](_0x19a8a3[_0x4c58('0xc4')])){return this[_0x4c58('0xb')][_0x4c58('0x27')](_0x19a8a3,_0x4c58('0xc5'));}var _0x3b7c60=this[_0x4c58('0xc6')][_0x4c58('0x5e')](this,_0x19a8a3[_0x4c58('0xc4')]);if(!_0x3b7c60){return this[_0x4c58('0xb')][_0x4c58('0x27')](_0x19a8a3,_0x4c58('0xc7'));}if(!this[_0x4c58('0x73')](_0x19a8a3[_0x4c58('0xc8')])){return this[_0x4c58('0xb')][_0x4c58('0x27')](_0x19a8a3,_0x4c58('0xc9'));}var _0x22480c=_0x19a8a3['query'][_0x4c58('0x48')](/(\r\n|\n|\r)/gm,'\x20');this[_0x4c58('0xb')][_0x4c58('0x98')](util['format'](_0x4c58('0xca'),_0x22480c));var _0x4c9fcf=this[_0x4c58('0xcb')][_0x4c58('0x5e')](this,_0x3b7c60,_0x22480c);this[_0x4c58('0x2e')][_0x4c58('0x5e')](this,_0x19a8a3,_0x22480c);if(!this['isConfigured'](_0x19a8a3[_0x4c58('0xcc')])){return this[_0x4c58('0xb')][_0x4c58('0x98')](_0x4c58('0xcd'));}var _0x6bf0c=this['getVariable'][_0x4c58('0x5e')](this,_0x19a8a3['variable_id']);if(!_0x6bf0c){return this[_0x4c58('0xb')][_0x4c58('0x27')](_0x19a8a3,_0x4c58('0xce'));}var _0x4a76e0=this;_0x4c9fcf['forEach'](function(_0x4a38f6,_0x2de7e3){Object[_0x4c58('0xcf')](_0x4a38f6)[_0x4c58('0xd0')](function(_0x1ccdd7){_0x4a76e0[_0x4c58('0xb')][_0x4c58('0x8e')](util['format'](_0x4c58('0xd1'),_0x6bf0c,_0x2de7e3,_0x1ccdd7),_0x4a38f6[_0x1ccdd7]);});});this[_0x4c58('0xb')][_0x4c58('0x8e')](util[_0x4c58('0x24')](_0x4c58('0xd2'),_0x6bf0c),_0x4c9fcf[_0x4c58('0x8c')]);return this[_0x4c58('0xb')]['noop'](util[_0x4c58('0x24')](_0x4c58('0xd3'),_0x6bf0c));};AGIVertices[_0x4c58('0xe')][_0x4c58('0xd4')]=function(_0x1838da){logger[_0x4c58('0xd5')](util[_0x4c58('0x24')](_0x4c58('0xd6'),_0x1838da[_0x4c58('0x97')]));if(!this[_0x4c58('0x73')](_0x1838da['sip_id'])){return this[_0x4c58('0xb')][_0x4c58('0x27')](_0x1838da,_0x4c58('0xd7'));}var _0x519b9d=this[_0x4c58('0x18')][_0x4c58('0x5e')](this,_0x1838da['sip_id']);if(!_0x519b9d){return this[_0x4c58('0xb')]['error'](_0x1838da,_0x4c58('0xd8'));}var _0x4026c7=this[_0x4c58('0xb')][_0x4c58('0x46')](_0x4c58('0xd9'),[util[_0x4c58('0x24')](_0x4c58('0xda'),_0x519b9d),_0x1838da[_0x4c58('0x54')],_0x1838da[_0x4c58('0xdb')],_0x1838da[_0x4c58('0x52')]]);if(_0x4026c7['result']===-0x1){return _0x4026c7;}return this[_0x4c58('0xb')][_0x4c58('0x98')](util['format'](_0x4c58('0xdc'),'DIAL'));};AGIVertices[_0x4c58('0xe')][_0x4c58('0xdd')]=function(_0x366c74){logger[_0x4c58('0x28')](util[_0x4c58('0x24')](_0x4c58('0xde'),_0x366c74[_0x4c58('0x97')]));if(!this['isConfigured'](_0x366c74['key'])){return this['channel'][_0x4c58('0x98')](_0x4c58('0xdf'));}if(!this[_0x4c58('0x73')](_0x366c74[_0x4c58('0x4c')])){return this['channel'][_0x4c58('0x98')]('no\x20text\x20configured');}this[_0x4c58('0xb')][_0x4c58('0xe0')]=!![];this[_0x4c58('0x2e')](_0x366c74);this[_0x4c58('0x33')](_0x366c74[_0x4c58('0x4c')],'in','','');this[_0x4c58('0xb')][_0x4c58('0x98')](util[_0x4c58('0x24')](_0x4c58('0xe1'),_0x366c74[_0x4c58('0x4c')]));var _0x4e444a=this[_0x4c58('0x66')][_0x4c58('0x5e')](this,_0x366c74);if(_0x4e444a){for(var _0x174dff in _0x4e444a){if(_0x4e444a[_0x4c58('0x84')](_0x174dff)){this[_0x4c58('0xb')]['setVariable'](util[_0x4c58('0x24')](_0x4c58('0xe2'),_0x174dff['toUpperCase']()),_0x4e444a[_0x174dff]);}}this[_0x4c58('0x33')](_0x4e444a[_0x4c58('0xe3')],_0x4c58('0xe4'),_0x4c58('0xdd'),'');return this[_0x4c58('0xb')]['noop'](util[_0x4c58('0x24')](_0x4c58('0xe5'),_0x4e444a[_0x4c58('0xe3')]));}return this[_0x4c58('0xb')][_0x4c58('0x27')](_0x366c74,_0x4c58('0xe6'));};AGIVertices[_0x4c58('0xe')][_0x4c58('0xe7')]=function(_0x4db150){logger['info'](util[_0x4c58('0x24')](_0x4c58('0xe8'),_0x4db150[_0x4c58('0x97')]));if(!this['isConfigured'](_0x4db150[_0x4c58('0x6a')])){return this[_0x4c58('0xb')][_0x4c58('0x98')]('no\x20project_id\x20configured');}if(!this[_0x4c58('0x73')](_0x4db150[_0x4c58('0xe9')])){return this[_0x4c58('0xb')][_0x4c58('0x98')](_0x4c58('0xea'));}if(!this[_0x4c58('0x73')](_0x4db150[_0x4c58('0x6b')])){return this[_0x4c58('0xb')][_0x4c58('0x98')]('no\x20private_key\x20configured');}if(!this[_0x4c58('0x73')](_0x4db150['dialogflowV2_language'])){return this[_0x4c58('0xb')]['noop'](_0x4c58('0xeb'));}if(!this[_0x4c58('0x73')](_0x4db150[_0x4c58('0x4c')])){return this['channel'][_0x4c58('0x98')](_0x4c58('0x99'));}this[_0x4c58('0xb')]['bot']=!![];this['createSquareDetailsReport'](_0x4db150);this[_0x4c58('0x33')](_0x4db150[_0x4c58('0x4c')],'in','','');this[_0x4c58('0xb')]['noop'](util[_0x4c58('0x24')](_0x4c58('0xec'),_0x4db150[_0x4c58('0x4c')]));var _0x9e3a5a=this[_0x4c58('0x69')][_0x4c58('0x5e')](this,_0x4db150);if(_0x9e3a5a){for(var _0x4a81cf in _0x9e3a5a){if(_0x9e3a5a[_0x4c58('0x84')](_0x4a81cf)){if(_0x4a81cf!=='providerResponse'){this[_0x4c58('0xb')][_0x4c58('0x8e')](util['format'](_0x4c58('0xe2'),_0x4a81cf[_0x4c58('0x57')]()),_0x9e3a5a[_0x4a81cf]);}}}this[_0x4c58('0x33')](_0x9e3a5a['speech'],_0x4c58('0xe4'),_0x4c58('0xe7'),_0x9e3a5a[_0x4c58('0xed')]);return this[_0x4c58('0xb')][_0x4c58('0x98')](util['format'](_0x4c58('0xee'),_0x9e3a5a[_0x4c58('0xe3')]));}return this['channel'][_0x4c58('0x27')](_0x4db150,_0x4c58('0xef'));};AGIVertices[_0x4c58('0xe')]['sesteknda']=function(_0x4fe909){logger[_0x4c58('0x28')](util['format']('Enter\x20in\x20SESTEKNDA\x20(%s)\x20block',_0x4fe909['label']));if(!this[_0x4c58('0x73')](_0x4fe909['ndauth_url'])){return this['channel'][_0x4c58('0x98')](_0x4c58('0xf0'));}if(!this['isConfigured'](_0x4fe909[_0x4c58('0xf1')])){return this[_0x4c58('0xb')][_0x4c58('0x98')](_0x4c58('0xf2'));}if(!this[_0x4c58('0x73')](_0x4fe909[_0x4c58('0xf3')])){return this[_0x4c58('0xb')]['noop'](_0x4c58('0xf4'));}if(!this['isConfigured'](_0x4fe909['ndassistant_url'])){return this[_0x4c58('0xb')]['noop'](_0x4c58('0x99'));}this[_0x4c58('0xb')]['bot']=!![];this['createSquareDetailsReport'](_0x4fe909);this['createSquareMessage'](_0x4fe909[_0x4c58('0x4c')],'in','','');this[_0x4c58('0xb')][_0x4c58('0x98')](util[_0x4c58('0x24')](_0x4c58('0xf5'),_0x4fe909[_0x4c58('0x4c')]));var _0x2f48bd=this[_0x4c58('0x6c')][_0x4c58('0x5e')](this,_0x4fe909);if(_0x2f48bd){for(var _0x34964d in _0x2f48bd){if(_0x2f48bd['hasOwnProperty'](_0x34964d)){this['channel'][_0x4c58('0x8e')](util[_0x4c58('0x24')](_0x4c58('0xf6'),_0x34964d[_0x4c58('0x57')]()),_0x2f48bd[_0x34964d]);}}this[_0x4c58('0x33')](_0x2f48bd[_0x4c58('0xe3')],_0x4c58('0xe4'),'sesteknda','');if(_0x2f48bd[_0x4c58('0xf7')]){this['channel']['noop'](util['format'](_0x4c58('0xf8'),_0x2f48bd[_0x4c58('0xf7')]));var _0x349304=this[_0x4c58('0xb')][_0x4c58('0xf9')](_0x2f48bd['audiofile']);try{fs['unlink'](_0x2f48bd[_0x4c58('0xf7')]+_0x4c58('0xfa'));}catch(_0x1a0599){logger[_0x4c58('0x27')](_0x1a0599);}return _0x349304;}else{return this[_0x4c58('0xb')][_0x4c58('0x98')](util[_0x4c58('0x24')](_0x4c58('0xfb'),_0x2f48bd[_0x4c58('0xe3')]));}}return this[_0x4c58('0xb')][_0x4c58('0x27')](_0x4fe909,'SestekNDA\x20is\x20unreachable');};AGIVertices[_0x4c58('0xe')][_0x4c58('0xfc')]=function(_0x290d15){logger[_0x4c58('0x28')](util['format'](_0x4c58('0xfd'),_0x290d15[_0x4c58('0x97')]));return this[_0x4c58('0xb')][_0x4c58('0x98')]('end');};AGIVertices[_0x4c58('0xe')][_0x4c58('0xfe')]=function(_0x8ecd2a){logger['info'](util[_0x4c58('0x24')](_0x4c58('0xff'),_0x8ecd2a['label']));var _0x18c989='';if(_0x8ecd2a[_0x4c58('0x100')]){if(!this[_0x4c58('0x73')](_0x8ecd2a['trunk_id'])){return this['channel']['error'](_0x8ecd2a,_0x4c58('0x101'));}else{var _0x2b7329=parseInt(_0x8ecd2a['trunk_id'],0xa);if(isNaN(_0x2b7329)){_0x18c989=_0x8ecd2a[_0x4c58('0x100')];}else{_0x18c989=this[_0x4c58('0x102')]['sync'](this,_0x8ecd2a[_0x4c58('0x100')]);if(!_0x18c989){return this[_0x4c58('0xb')][_0x4c58('0x27')](_0x8ecd2a,_0x4c58('0x103'));}}}}else if(_0x8ecd2a['trunk_name']){_0x18c989=_0x8ecd2a[_0x4c58('0x104')];}else{return this[_0x4c58('0xb')][_0x4c58('0x27')](_0x8ecd2a,'no\x20trunk\x20selected');}var _0x3a910f=this[_0x4c58('0xb')][_0x4c58('0x46')](_0x4c58('0xd9'),[util[_0x4c58('0x24')](_0x4c58('0x105'),_0x18c989,_0x8ecd2a['phone']),_0x8ecd2a['timeout'],_0x8ecd2a[_0x4c58('0xdb')],_0x8ecd2a[_0x4c58('0x52')]]);if(_0x3a910f[_0x4c58('0x9b')]===-0x1){return _0x3a910f;}return this[_0x4c58('0xb')]['noop'](util['format'](_0x4c58('0xdc'),_0x4c58('0xd9')));};AGIVertices[_0x4c58('0xe')][_0x4c58('0x106')]=function(_0x328344){logger['info'](util[_0x4c58('0x24')](_0x4c58('0x107'),_0x328344[_0x4c58('0x97')]));return this['channel'][_0x4c58('0x98')](_0x4c58('0x106'));};AGIVertices[_0x4c58('0xe')][_0x4c58('0x108')]=function(_0x459dee){logger['info'](util[_0x4c58('0x24')](_0x4c58('0x109'),_0x459dee[_0x4c58('0x97')]));if(_0x459dee[_0x4c58('0x94')]===0x0){return this[_0x4c58('0x95')](_0x459dee);}_0x459dee[_0x4c58('0x94')]-=0x1;if(!this[_0x4c58('0x73')](_0x459dee[_0x4c58('0x10a')])){return this[_0x4c58('0xb')]['error'](_0x459dee,_0x4c58('0x10b'));}var _0x4e80ef=this[_0x4c58('0x1a')][_0x4c58('0x5e')](this,_0x459dee['file_id']);if(!_0x4e80ef){return this['channel'][_0x4c58('0x27')](_0x459dee,'no\x20file\x20audio\x20found');}if(!this[_0x4c58('0x73')](_0x459dee[_0x4c58('0xcc')])){return this[_0x4c58('0xb')][_0x4c58('0x27')](_0x4c58('0xcd'));}var _0x490572=this[_0x4c58('0xb')][_0x4c58('0x10c')](_0x4e80ef,_0x459dee['response'],_0x459dee['maxdigit']);var _0x59c1d3=_0x490572[_0x4c58('0x9b')]?_0x490572[_0x4c58('0x9b')]['toString']():'';logger[_0x4c58('0x28')]('test',JSON[_0x4c58('0x60')](_0x490572));if(_0x490572['result']===-0x1){this[_0x4c58('0x2e')][_0x4c58('0x5e')](this,_0x459dee,_0x59c1d3);return _0x490572;}else if(_0x490572[_0x4c58('0x93')]===_0x4c58('0x54')){_0x490572[_0x4c58('0x9b')]=_0x59c1d3[_0x4c58('0x8c')]>=parseInt(_0x459dee[_0x4c58('0x10d')])?'x':'i';}else{_0x490572[_0x4c58('0x9b')]=_0x59c1d3[_0x4c58('0x8c')]>=parseInt(_0x459dee[_0x4c58('0x10d')])&&_0x59c1d3['length']<=parseInt(_0x459dee[_0x4c58('0x10e')])?'x':'i';}var _0x42fc8a=this[_0x4c58('0xf')][_0x4c58('0x5e')](this,_0x459dee['variable_id']);if(!_0x42fc8a){return this[_0x4c58('0xb')]['error'](_0x459dee,_0x4c58('0xce'));}this[_0x4c58('0xb')][_0x4c58('0x8e')](_0x42fc8a,_0x59c1d3);if(this['isConfigured'](_0x459dee[_0x4c58('0x10f')])){var _0x10c81b=parseInt(_0x459dee['hiddendigitsnum'],0xa);var _0x1e5cb5=rs[_0x4c58('0x110')]({'charset':'*','length':_0x10c81b});var _0x5147cc=_0x59c1d3['length'];if(_0x5147cc>0x0){if(_0x5147cc>_0x10c81b){this['createSquareDetailsReport'][_0x4c58('0x5e')](this,_0x459dee,_0x459dee[_0x4c58('0x111')]===_0x4c58('0x112')?_0x1e5cb5+_0x59c1d3[_0x4c58('0x113')](_0x10c81b):_0x59c1d3[_0x4c58('0x113')](0x0,_0x5147cc-_0x10c81b)+_0x1e5cb5);}else{this[_0x4c58('0x2e')][_0x4c58('0x5e')](this,_0x459dee,rs[_0x4c58('0x110')]({'charset':'*','length':_0x5147cc}));}}else{this[_0x4c58('0x2e')]['sync'](this,_0x459dee,'');}}else{this[_0x4c58('0x2e')][_0x4c58('0x5e')](this,_0x459dee,_0x59c1d3);}return _0x490572;};AGIVertices[_0x4c58('0xe')][_0x4c58('0x114')]=function(_0x480b46){logger[_0x4c58('0x28')](util['format']('Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block',_0x480b46['label']));return this['getdigits'](_0x480b46);};AGIVertices[_0x4c58('0xe')][_0x4c58('0x115')]=function(_0x5a8a68){logger['info'](util['format'](_0x4c58('0x116'),_0x5a8a68[_0x4c58('0x97')]));this[_0x4c58('0x2e')][_0x4c58('0x5e')](this,_0x5a8a68,_0x5a8a68[_0x4c58('0x117')]);return this[_0x4c58('0xb')][_0x4c58('0x98')](util[_0x4c58('0x24')](_0x4c58('0x118'),_0x5a8a68['goalname']));};AGIVertices[_0x4c58('0xe')][_0x4c58('0x119')]=function(_0x2dfcef){logger[_0x4c58('0x28')](util[_0x4c58('0x24')](_0x4c58('0x11a'),_0x2dfcef[_0x4c58('0x97')]));if(!this['isConfigured'](_0x2dfcef[_0x4c58('0x76')])||!this[_0x4c58('0x73')](_0x2dfcef['aws_secret_access_key'])){return this[_0x4c58('0xb')][_0x4c58('0x98')](_0x4c58('0x11b'));}if(!this['isConfigured'](_0x2dfcef['text'])){return this[_0x4c58('0xb')]['noop']('no\x20text\x20configured');}this[_0x4c58('0xb')]['noop'](util['format'](_0x4c58('0x11c'),_0x2dfcef[_0x4c58('0x4c')]));var _0x4e407d=this[_0x4c58('0x75')]['sync'](this,_0x2dfcef);if(_0x4e407d){this[_0x4c58('0xb')][_0x4c58('0x98')](util[_0x4c58('0x24')](_0x4c58('0x11d'),_0x4e407d));var _0x56e1a4=this[_0x4c58('0xb')][_0x4c58('0xf9')](_0x4e407d);try{fs[_0x4c58('0x11e')](_0x4e407d+_0x4c58('0xfa'));}catch(_0x42d455){logger[_0x4c58('0x27')](_0x42d455);}return _0x56e1a4;}return this[_0x4c58('0xb')][_0x4c58('0x27')](_0x2dfcef,_0x4c58('0x11f'));};AGIVertices['prototype'][_0x4c58('0x120')]=function(_0x110a12){logger[_0x4c58('0x28')](util[_0x4c58('0x24')](_0x4c58('0x121'),_0x110a12[_0x4c58('0x97')]));if(!this['isConfigured'](_0x110a12[_0x4c58('0x76')])||!this[_0x4c58('0x73')](_0x110a12[_0x4c58('0x77')])){return this[_0x4c58('0xb')]['noop']('no\x20valid\x20credentials\x20configured');}if(!this[_0x4c58('0x73')](_0x110a12[_0x4c58('0x7b')])){return this[_0x4c58('0xb')][_0x4c58('0x98')]('no\x20bot\x20name\x20configured');}if(!this[_0x4c58('0x73')](_0x110a12[_0x4c58('0x4c')])){return this[_0x4c58('0xb')]['noop'](_0x4c58('0x99'));}this[_0x4c58('0xb')][_0x4c58('0xe0')]=!![];this[_0x4c58('0x2e')](_0x110a12);this[_0x4c58('0x33')](_0x110a12[_0x4c58('0x4c')],'in','','');this[_0x4c58('0xb')][_0x4c58('0x98')](util[_0x4c58('0x24')](_0x4c58('0x122'),_0x110a12[_0x4c58('0x4c')]));var _0x4fc6cd=this[_0x4c58('0x7a')][_0x4c58('0x5e')](this,_0x110a12);if(_0x4fc6cd){for(var _0x51299a in _0x4fc6cd){if(_0x4fc6cd[_0x4c58('0x84')](_0x51299a)&&_[_0x4c58('0x85')](_0x4fc6cd[_0x51299a])){this['channel']['setVariable'](util['format'](_0x4c58('0x123'),_0x51299a[_0x4c58('0x57')]()),_0x4fc6cd[_0x51299a]);}}if(_[_0x4c58('0x37')](_0x4fc6cd[_0x4c58('0x64')])){return this[_0x4c58('0xb')][_0x4c58('0x98')]('Amazon\x20Lex\x20ready\x20for\x20fulfillment');}else{this[_0x4c58('0x33')](_0x4fc6cd['message'],_0x4c58('0xe4'),_0x4c58('0x124'),'');return this[_0x4c58('0xb')][_0x4c58('0x98')](util[_0x4c58('0x24')](_0x4c58('0x125'),_0x4fc6cd[_0x4c58('0x64')]));}}return this[_0x4c58('0xb')]['error'](_0x110a12,'Amazon\x20Lex\x20is\x20unreachable');};AGIVertices[_0x4c58('0xe')][_0x4c58('0x126')]=function(_0x3a2157){logger[_0x4c58('0x28')](util['format'](_0x4c58('0x127'),_0x3a2157[_0x4c58('0x97')],_0x3a2157[_0x4c58('0x54')]));if(!this['isConfigured'](_0x3a2157[_0x4c58('0x67')])){return this[_0x4c58('0xb')][_0x4c58('0x98')](_0x4c58('0xdf'));}var _0x1873ba=_0x4c58('0x128');var _0x431033=util['format'](_0x4c58('0x129'),FILES_PATH,rs['generate'](0x4));var _0x2e2201=util[_0x4c58('0x24')](_0x4c58('0x8d'),_0x431033,_0x1873ba);var _0x334486=!![];if(_0x3a2157[_0x4c58('0x12a')]===_0x4c58('0x12b')){_0x334486=![];}var _0x32530c=this[_0x4c58('0xb')][_0x4c58('0x12c')](_0x431033,_0x1873ba,_0x3a2157[_0x4c58('0x12d')],_0x3a2157[_0x4c58('0x54')],undefined,_0x334486);if(_0x32530c[_0x4c58('0x9b')]!==-0x1){this[_0x4c58('0xb')][_0x4c58('0x98')](util[_0x4c58('0x24')](_0x4c58('0x12e'),_0x2e2201));var _0x379589=this[_0x4c58('0x7c')][_0x4c58('0x5e')](this,_0x3a2157,_0x2e2201);if(_0x379589){for(var _0x1c8d29 in _0x379589){if(_0x379589[_0x4c58('0x84')](_0x1c8d29)){this[_0x4c58('0xb')][_0x4c58('0x8e')](util[_0x4c58('0x24')](_0x4c58('0x12f'),_0x1c8d29[_0x4c58('0x57')]()),_0x379589[_0x1c8d29]);}}return this[_0x4c58('0xb')][_0x4c58('0x98')](util['format'](_0x4c58('0x130'),JSON['stringify'](_0x379589)));}}return _0x32530c;};AGIVertices[_0x4c58('0xe')][_0x4c58('0x131')]=function(_0x1c8d49){logger['info'](util['format'](_0x4c58('0x132'),_0x1c8d49[_0x4c58('0x97')]));if(!this[_0x4c58('0x73')](_0x1c8d49[_0x4c58('0x7f')])){return this[_0x4c58('0xb')]['noop'](_0x4c58('0x133'));}if(!this[_0x4c58('0x73')](_0x1c8d49[_0x4c58('0x80')])){return this[_0x4c58('0xb')]['noop']('no\x20appsecret\x20configured');}var _0x24542a=_0x4c58('0x128');var _0x4347b0=util['format'](_0x4c58('0x129'),FILES_PATH,rs[_0x4c58('0x110')](0x4));var _0x33cbf3=util['format'](_0x4c58('0x8d'),_0x4347b0,_0x24542a);var _0x30a6f2=!![];if(_0x1c8d49[_0x4c58('0x12a')]==='NOBEEP'){_0x30a6f2=![];}var _0x58baa8=this[_0x4c58('0xb')]['recordFile'](_0x4347b0,_0x24542a,_0x1c8d49['intKey'],_0x1c8d49[_0x4c58('0x54')],undefined,_0x30a6f2);if(_0x58baa8[_0x4c58('0x9b')]!==-0x1){this[_0x4c58('0xb')][_0x4c58('0x98')](util[_0x4c58('0x24')](_0x4c58('0x134'),_0x33cbf3));var _0x4dffbb=this[_0x4c58('0x7e')][_0x4c58('0x5e')](this,_0x1c8d49,_0x33cbf3);if(_0x4dffbb){for(var _0x18d0a0 in _0x4dffbb){if(_0x4dffbb['hasOwnProperty'](_0x18d0a0)){this[_0x4c58('0xb')][_0x4c58('0x8e')](util[_0x4c58('0x24')](_0x4c58('0x135'),_0x18d0a0['toUpperCase']()),_0x4dffbb[_0x18d0a0]);}}return this[_0x4c58('0xb')]['noop'](util[_0x4c58('0x24')]('TildeASR\x20Result\x20%s',JSON[_0x4c58('0x60')](_0x4dffbb)));}}return _0x58baa8;};AGIVertices['prototype'][_0x4c58('0x136')]=function(_0x53584d){logger['info'](util['format'](_0x4c58('0x137'),_0x53584d[_0x4c58('0x97')]));return this['channel'][_0x4c58('0x138')](_0x53584d[_0x4c58('0x139')],_0x53584d[_0x4c58('0x13a')],_0x53584d['priority']);};AGIVertices[_0x4c58('0xe')][_0x4c58('0x13b')]=function(_0x1285c7){logger['info'](util[_0x4c58('0x24')](_0x4c58('0x13c'),_0x1285c7['label']));if(!this[_0x4c58('0x73')](_0x1285c7['condition'])){return this[_0x4c58('0xb')]['error'](_0x1285c7,_0x4c58('0x13d'));}try{var _0x57e0d2=eval(_0x1285c7[_0x4c58('0x13e')])?_0x4c58('0x13f'):_0x4c58('0x140');this[_0x4c58('0xb')][_0x4c58('0x98')](util['format'](_0x4c58('0x141'),_0x1285c7[_0x4c58('0x13e')],_0x57e0d2));return{'code':0xc8,'result':_0x57e0d2};}catch(_0x192d29){return{'code':0xc8,'result':'false'};}};AGIVertices[_0x4c58('0xe')]['gotoiftime']=function(_0x2d0b05){logger[_0x4c58('0x28')](util[_0x4c58('0x24')](_0x4c58('0x142'),_0x2d0b05[_0x4c58('0x97')]));if(!this['isConfigured'](_0x2d0b05['interval_id'])){return this[_0x4c58('0xb')][_0x4c58('0x27')](_0x2d0b05,'no\x20interval\x20configured');}var _0x526026=this['getIntervals'][_0x4c58('0x5e')](this,_0x2d0b05['interval_id']);if(!_0x526026){return this[_0x4c58('0xb')][_0x4c58('0x27')](_0x2d0b05,_0x4c58('0x143'));}for(var _0x4b0e74=0x0;_0x4b0e74<_0x526026[_0x4c58('0x8c')];_0x4b0e74+=0x1){var _0x5ec7c3=this[_0x4c58('0xb')][_0x4c58('0xf')](util[_0x4c58('0x24')](_0x4c58('0x144'),_0x526026[_0x4b0e74]));if(_0x5ec7c3[_0x4c58('0x9b')]===-0x1){return _0x5ec7c3;}logger['info'](util[_0x4c58('0x24')](_0x4c58('0x145'),_0x526026[_0x4b0e74],_0x5ec7c3[_0x4c58('0x93')]));if(_0x5ec7c3['extra']===_0x4c58('0x13f')){logger[_0x4c58('0x28')](util[_0x4c58('0x24')](_0x4c58('0x145'),_0x526026[_0x4b0e74],_0x4c58('0x13f')));this[_0x4c58('0xb')][_0x4c58('0x98')](util['format'](_0x4c58('0x145'),_0x526026[_0x4b0e74],_0x4c58('0x13f')));return{'code':0xc8,'result':_0x4c58('0x13f')};}else{logger['info'](util[_0x4c58('0x24')](_0x4c58('0x145'),_0x526026[_0x4b0e74],_0x4c58('0x140')));this[_0x4c58('0xb')][_0x4c58('0x98')](util[_0x4c58('0x24')]('IFTIME\x20%s\x20%s',_0x526026[_0x4b0e74],_0x4c58('0x140')));}}return{'code':0xc8,'result':_0x4c58('0x140')};};AGIVertices[_0x4c58('0xe')][_0x4c58('0x146')]=function(_0x4a61c6){logger['info'](util[_0x4c58('0x24')](_0x4c58('0x147'),_0x4a61c6[_0x4c58('0x97')]));return this[_0x4c58('0xb')][_0x4c58('0x146')]();};AGIVertices[_0x4c58('0xe')][_0x4c58('0x148')]=function(_0xead2b4){logger[_0x4c58('0x28')](util[_0x4c58('0x24')](_0x4c58('0x149'),_0xead2b4[_0x4c58('0x97')]));if(!this[_0x4c58('0x73')](_0xead2b4['key'])){return this[_0x4c58('0xb')]['noop']('no\x20key\x20configured');}var _0x249d14=_0x4c58('0x128');var _0x1d4007=util[_0x4c58('0x24')](_0x4c58('0x129'),FILES_PATH,rs[_0x4c58('0x110')](0x4));var _0x390e7b=util[_0x4c58('0x24')](_0x4c58('0x8d'),_0x1d4007,_0x249d14);var _0x496868=!![];if(_0xead2b4[_0x4c58('0x12a')]===_0x4c58('0x12b')){_0x496868=![];}var _0x3e4b4f=this[_0x4c58('0xb')]['recordFile'](_0x1d4007,_0x249d14,_0xead2b4['intKey'],_0xead2b4[_0x4c58('0x54')],undefined,_0x496868);if(_0x3e4b4f['result']!==-0x1){this[_0x4c58('0xb')]['noop'](util[_0x4c58('0x24')](_0x4c58('0x14a'),_0x390e7b));var _0x310aa1=this[_0x4c58('0x71')][_0x4c58('0x5e')](this,_0xead2b4,_0x390e7b);if(_0x310aa1){for(var _0x51b517 in _0x310aa1){if(_0x310aa1[_0x4c58('0x84')](_0x51b517)){this[_0x4c58('0xb')][_0x4c58('0x8e')](util[_0x4c58('0x24')](_0x4c58('0x14b'),_0x51b517[_0x4c58('0x57')]()),_0x310aa1[_0x51b517]);}}return this[_0x4c58('0xb')][_0x4c58('0x98')](util[_0x4c58('0x24')](_0x4c58('0x14c'),JSON[_0x4c58('0x60')](_0x310aa1)));}}return _0x3e4b4f;};AGIVertices[_0x4c58('0xe')][_0x4c58('0x14d')]=function(_0x420db5){logger['info'](util[_0x4c58('0x24')](_0x4c58('0x14e'),_0x420db5[_0x4c58('0x97')]));if(!this[_0x4c58('0x73')](_0x420db5[_0x4c58('0x67')])){return this[_0x4c58('0xb')][_0x4c58('0x98')](_0x4c58('0xdf'));}if(!this[_0x4c58('0x73')](_0x420db5[_0x4c58('0x4c')])){return this[_0x4c58('0xb')]['noop']('no\x20text\x20configured');}this['channel'][_0x4c58('0x98')](util['format'](_0x4c58('0x14f'),_0x420db5[_0x4c58('0x4c')]));var _0x560960=this['ispeechTTS']['sync'](this,_0x420db5);if(_0x560960){this['channel'][_0x4c58('0x98')](util['format'](_0x4c58('0x14a'),_0x560960));var _0x2140a6=this['channel'][_0x4c58('0xf9')](_0x560960,_0x420db5['intKey']);try{fs[_0x4c58('0x11e')](_0x560960+'.wav');}catch(_0x4d3332){logger['error'](_0x4d3332);}return _0x2140a6;}return this[_0x4c58('0xb')][_0x4c58('0x27')](_0x420db5,'ispeech\x20TTS\x20is\x20unreachable');};AGIVertices['prototype'][_0x4c58('0x150')]=function(_0x2878e1){logger['info'](util[_0x4c58('0x24')](_0x4c58('0x151'),_0x2878e1[_0x4c58('0x97')]));if(!this['isConfigured'](_0x2878e1['findBy'])){return this[_0x4c58('0xb')][_0x4c58('0x27')](_0x2878e1,_0x4c58('0x152'));}logger['info'](util[_0x4c58('0x24')](_0x4c58('0x153'),this[_0x4c58('0xb')]['callerid'],_0x2878e1['findBy']));var _0x5c3f51=this[_0x4c58('0x44')][_0x4c58('0x5e')](this,_0x2878e1[_0x4c58('0x154')]);if(_0x5c3f51){logger[_0x4c58('0x28')](util[_0x4c58('0x24')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x4c58('0xb')][_0x4c58('0x3f')],_0x2878e1[_0x4c58('0x154')]));this[_0x4c58('0xb')][_0x4c58('0x98')](util[_0x4c58('0x24')](_0x4c58('0x155'),this[_0x4c58('0xb')]['callerid'],_0x2878e1[_0x4c58('0x154')]));return{'code':0xc8,'result':'success'};}else{logger[_0x4c58('0x28')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0x4c58('0x3f')],_0x2878e1[_0x4c58('0x154')]));this[_0x4c58('0xb')]['noop'](util[_0x4c58('0x24')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x4c58('0xb')][_0x4c58('0x3f')],_0x2878e1['findBy']));return{'code':0xc8,'result':_0x4c58('0x156')};}};AGIVertices[_0x4c58('0xe')][_0x4c58('0x157')]=function(_0x5c81ae){logger[_0x4c58('0x28')](util[_0x4c58('0x24')](_0x4c58('0x158'),_0x5c81ae['label']));if(!this[_0x4c58('0x73')](_0x5c81ae[_0x4c58('0x154')])){return this[_0x4c58('0xb')][_0x4c58('0x27')](_0x5c81ae,_0x4c58('0x152'));}logger[_0x4c58('0x28')](util[_0x4c58('0x24')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x4c58('0xb')][_0x4c58('0x3f')],_0x5c81ae['findBy']));var _0xd82766=this['agentLogout'][_0x4c58('0x5e')](this,_0x5c81ae[_0x4c58('0x154')]);if(_0xd82766){logger[_0x4c58('0x28')](util[_0x4c58('0x24')](_0x4c58('0x155'),this[_0x4c58('0xb')][_0x4c58('0x3f')],_0x5c81ae[_0x4c58('0x154')]));this['channel'][_0x4c58('0x98')](util[_0x4c58('0x24')](_0x4c58('0x155'),this[_0x4c58('0xb')]['callerid'],_0x5c81ae['findBy']));return{'code':0xc8,'result':_0x4c58('0x159')};}else{logger[_0x4c58('0x28')](util[_0x4c58('0x24')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x4c58('0xb')][_0x4c58('0x3f')],_0x5c81ae[_0x4c58('0x154')]));this[_0x4c58('0xb')][_0x4c58('0x98')](util[_0x4c58('0x24')](_0x4c58('0x15a'),this['channel'][_0x4c58('0x3f')],_0x5c81ae[_0x4c58('0x154')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x4c58('0xe')][_0x4c58('0x15b')]=function(_0x2bf379){logger[_0x4c58('0x28')](util[_0x4c58('0x24')](_0x4c58('0x15c'),_0x2bf379[_0x4c58('0x97')]));if(!this['isConfigured'](_0x2bf379[_0x4c58('0x15d')])){return this[_0x4c58('0xb')][_0x4c58('0x27')](_0x2bf379,'no\x20operation\x20configured');}this[_0x4c58('0xb')][_0x4c58('0x98')](util[_0x4c58('0x24')](_0x4c58('0x15e'),_0x2bf379['operation']));var _0x4f2e17=eval(_0x2bf379['operation']);if(!this['isConfigured'](_0x2bf379['variable_id'])){return this[_0x4c58('0xb')]['noop'](_0x4c58('0xcd'));}var _0x4a4eb4=this[_0x4c58('0xf')][_0x4c58('0x5e')](this,_0x2bf379[_0x4c58('0xcc')]);if(!_0x4a4eb4){return this['channel'][_0x4c58('0x27')](_0x2bf379,_0x4c58('0xce'));}if(_[_0x4c58('0x8b')](_0x4f2e17)){var _0x23b548=this;_0x4f2e17['forEach'](function(_0x3de04b,_0xf3f37e){_0x23b548['channel'][_0x4c58('0x8e')](util[_0x4c58('0x24')](_0x4c58('0x15f'),_0x4a4eb4,_0xf3f37e),_0x3de04b);});return this[_0x4c58('0xb')][_0x4c58('0x98')](util[_0x4c58('0x24')](_0x4c58('0x160'),_0x4a4eb4));}else{return this[_0x4c58('0xb')][_0x4c58('0x8e')](_0x4a4eb4,_0x4f2e17);}};AGIVertices['prototype']['menu']=function(_0x12f45a){logger[_0x4c58('0x28')](util[_0x4c58('0x24')]('Enter\x20in\x20MENU\x20(%s)\x20block',_0x12f45a['label']));if(_0x12f45a[_0x4c58('0x94')]===0x0){return this[_0x4c58('0x95')](_0x12f45a);}_0x12f45a[_0x4c58('0x94')]-=0x1;if(!this[_0x4c58('0x73')](_0x12f45a['file_id'])){return this[_0x4c58('0xb')]['error'](_0x12f45a,_0x4c58('0x10b'));}var _0x4896bf=this[_0x4c58('0x1a')][_0x4c58('0x5e')](this,_0x12f45a[_0x4c58('0x10a')]);if(!_0x4896bf){return this['channel'][_0x4c58('0x27')](_0x12f45a,_0x4c58('0x161'));}var _0x1ea08e=this[_0x4c58('0xb')][_0x4c58('0x10c')](_0x4896bf,_0x12f45a[_0x4c58('0x162')],_0x12f45a['digit']);var _0x29fe37=_0x1ea08e['result'];if(_0x1ea08e[_0x4c58('0x9b')]===-0x1){this['createSquareDetailsReport'][_0x4c58('0x5e')](this,_0x12f45a,'-1');return _0x1ea08e;}else if(_0x1ea08e[_0x4c58('0x93')]===_0x4c58('0x54')){_0x1ea08e[_0x4c58('0x9b')]=_0x1ea08e[_0x4c58('0x9b')][_0x4c58('0x8c')]>0x0?_0x1ea08e[_0x4c58('0x9b')]:'t';}else if(_[_0x4c58('0x34')](_0x1ea08e[_0x4c58('0x9b')])){_0x1ea08e[_0x4c58('0x9b')]='#';_0x29fe37='#';}if(!this[_0x4c58('0x73')](_0x12f45a['variable_id'])){this[_0x4c58('0xb')]['noop'](_0x4c58('0xcd'));}else{var _0x1ae3ec=this['getVariable'][_0x4c58('0x5e')](this,_0x12f45a[_0x4c58('0xcc')]);if(!_0x1ae3ec){return this['channel'][_0x4c58('0x27')](_0x12f45a,_0x4c58('0xce'));}this[_0x4c58('0xb')][_0x4c58('0x8e')](_0x1ae3ec,_0x29fe37);}this['createSquareDetailsReport'][_0x4c58('0x5e')](this,_0x12f45a,_0x29fe37);return _0x1ea08e;};AGIVertices['prototype'][_0x4c58('0x98')]=function(_0x363689){logger[_0x4c58('0x28')](util['format'](_0x4c58('0x163'),_0x363689[_0x4c58('0x97')]));return this[_0x4c58('0xb')][_0x4c58('0x98')](_0x363689[_0x4c58('0x164')]||_0x363689[_0x4c58('0x97')]);};AGIVertices[_0x4c58('0xe')][_0x4c58('0x165')]=function(_0x3e1ad7){logger[_0x4c58('0x28')](util[_0x4c58('0x24')](_0x4c58('0x166'),_0x3e1ad7[_0x4c58('0x97')]));if(!this[_0x4c58('0x73')](_0x3e1ad7[_0x4c58('0x154')])){return this[_0x4c58('0xb')]['error'](_0x3e1ad7,_0x4c58('0x152'));}logger[_0x4c58('0x28')](util[_0x4c58('0x24')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this['channel'][_0x4c58('0x3f')],_0x3e1ad7['findBy']));var _0x809200=this['getPause'][_0x4c58('0x5e')](this,_0x3e1ad7[_0x4c58('0x167')]);var _0x3ba15a=this[_0x4c58('0x40')][_0x4c58('0x5e')](this,_0x3e1ad7['findBy'],_0x809200);if(_0x3ba15a){logger[_0x4c58('0x28')](util[_0x4c58('0x24')](_0x4c58('0x155'),this[_0x4c58('0xb')]['callerid'],_0x3e1ad7[_0x4c58('0x154')]));this[_0x4c58('0xb')][_0x4c58('0x98')](util[_0x4c58('0x24')](_0x4c58('0x155'),this[_0x4c58('0xb')][_0x4c58('0x3f')],_0x3e1ad7[_0x4c58('0x154')]));return{'code':0xc8,'result':_0x4c58('0x159')};}else{logger[_0x4c58('0x28')](util[_0x4c58('0x24')](_0x4c58('0x15a'),this[_0x4c58('0xb')][_0x4c58('0x3f')],_0x3e1ad7[_0x4c58('0x154')]));this[_0x4c58('0xb')]['noop'](util['format'](_0x4c58('0x155'),this[_0x4c58('0xb')][_0x4c58('0x3f')],_0x3e1ad7[_0x4c58('0x154')]));return{'code':0xc8,'result':_0x4c58('0x156')};}};AGIVertices[_0x4c58('0xe')][_0x4c58('0x168')]=function(_0x556610){logger['info'](util['format']('Enter\x20in\x20PLAYBACK\x20(%s)\x20block',_0x556610[_0x4c58('0x97')]));if(!this[_0x4c58('0x73')](_0x556610['file_id'])){return this['channel'][_0x4c58('0x27')](_0x556610,_0x4c58('0x10b'));}var _0x3361fc=this[_0x4c58('0x1a')][_0x4c58('0x5e')](this,_0x556610['file_id']);if(!_0x3361fc){return this['channel']['error'](_0x556610,_0x4c58('0x161'));}var _0x24dd01=this[_0x4c58('0xb')]['exec'](_0x4c58('0x169'),[_0x3361fc,_0x556610[_0x4c58('0xdb')]]);if(_0x24dd01[_0x4c58('0x9b')]===-0x1){return _0x24dd01;}return this[_0x4c58('0xb')][_0x4c58('0x98')](util[_0x4c58('0x24')](_0x4c58('0xb5'),'PLAYBACK',_0x3361fc));};AGIVertices['prototype'][_0x4c58('0x16a')]=function(_0x45a2f6){logger[_0x4c58('0x28')](util[_0x4c58('0x24')](_0x4c58('0x16b'),_0x45a2f6[_0x4c58('0x97')]));if(!this[_0x4c58('0x73')](_0x45a2f6[_0x4c58('0x16c')])){return this[_0x4c58('0xb')][_0x4c58('0x27')](_0x45a2f6,_0x4c58('0x16d'));}var _0x131912='';var _0x248269=parseInt(_0x45a2f6['queue_id'],0xa);if(isNaN(_0x248269)){_0x131912=_0x45a2f6[_0x4c58('0x16c')];}else{_0x131912=this[_0x4c58('0x12')][_0x4c58('0x5e')](this,_0x45a2f6[_0x4c58('0x16c')]);if(!_0x131912){return this[_0x4c58('0xb')][_0x4c58('0x27')](_0x45a2f6,_0x4c58('0x16e'));}}var _0x48c993='';if(this[_0x4c58('0x73')](_0x45a2f6[_0x4c58('0x10a')])){var _0x2dbdfe=this['getSound'][_0x4c58('0x5e')](this,_0x45a2f6[_0x4c58('0x10a')]);if(_0x2dbdfe){_0x48c993=_0x2dbdfe;}}this[_0x4c58('0x2e')]['sync'](this,_0x45a2f6,_0x131912);if(_0x45a2f6[_0x4c58('0xdb')][_0x4c58('0x16f')]('x')<0x0){_0x45a2f6[_0x4c58('0xdb')]+='x';}if(_0x45a2f6[_0x4c58('0xdb')]['indexOf']('X')<0x0){_0x45a2f6[_0x4c58('0xdb')]+='X';}this[_0x4c58('0xb')][_0x4c58('0x8e')](_0x4c58('0x170'),_0x131912?_0x131912[_0x4c58('0x171')]():'');var _0x36ee28=this[_0x4c58('0xb')][_0x4c58('0x46')](_0x4c58('0x172'),[_0x131912,_0x45a2f6[_0x4c58('0xdb')],_0x45a2f6[_0x4c58('0x52')],_0x48c993,_0x45a2f6[_0x4c58('0x54')],_0x45a2f6[_0x4c58('0xa7')],_0x45a2f6[_0x4c58('0x173')],_0x45a2f6[_0x4c58('0x174')],'',_0x45a2f6[_0x4c58('0x175')]]);if(_0x36ee28[_0x4c58('0x9b')]===-0x1){return _0x36ee28;}return this[_0x4c58('0xb')]['noop'](util[_0x4c58('0x24')]('Executed\x20command\x20%s\x20%s',_0x4c58('0x172'),_0x131912));};AGIVertices[_0x4c58('0xe')][_0x4c58('0x176')]=function(_0x1cc7c2){logger[_0x4c58('0x28')](util['format'](_0x4c58('0x177'),_0x1cc7c2['label']));var _0x636e83=_0x1cc7c2['recordingFormat']||_0x4c58('0x128');var _0x3be53a=util[_0x4c58('0x24')](_0x4c58('0x178'),this[_0x4c58('0xb')][_0x4c58('0x30')],rs['generate'](0x5));var _0x1eb71b=util[_0x4c58('0x24')](_0x4c58('0x179'),FILES_PATH,_0x3be53a,_0x636e83);var _0x24f8ba=util[_0x4c58('0x24')](_0x4c58('0x129'),FILES_PATH,_0x3be53a);this[_0x4c58('0x2f')][_0x4c58('0x5e')](this,_0x1cc7c2,_0x3be53a,_0x1eb71b);this[_0x4c58('0xb')]['setVariable'](_0x4c58('0x17a'),_0x3be53a);logger[_0x4c58('0x28')](_0x4c58('0x17b'),_0x24f8ba,_0x636e83,_0x1cc7c2[_0x4c58('0x17c')],_0x1cc7c2[_0x4c58('0x54')]);return this[_0x4c58('0xb')][_0x4c58('0x12c')](_0x24f8ba,_0x636e83,_0x1cc7c2['escape_digits'],_0x1cc7c2['timeout'],undefined,!![]);};AGIVertices[_0x4c58('0xe')][_0x4c58('0x17d')]=function(_0x1cb35e){logger['info'](util[_0x4c58('0x24')](_0x4c58('0x17e'),_0x1cb35e[_0x4c58('0x97')]));if(!this[_0x4c58('0x73')](_0x1cb35e[_0x4c58('0x52')])){return this[_0x4c58('0xb')][_0x4c58('0x98')]('no\x20url\x20configured');}var _0xbf835=this[_0x4c58('0x51')][_0x4c58('0x5e')](this,_0x1cb35e);logger[_0x4c58('0x28')](util['format'](_0x4c58('0x17f'),util[_0x4c58('0x180')](_0xbf835,{'showHidden':![],'depth':null})));if(!this[_0x4c58('0x73')](_0x1cb35e[_0x4c58('0xcc')])){return this['channel'][_0x4c58('0x98')]('no\x20variable\x20selected\x20for\x20the\x20response');}var _0x25a33d=this[_0x4c58('0xf')][_0x4c58('0x5e')](this,_0x1cb35e['variable_id']);if(!_0x25a33d){return this[_0x4c58('0xb')][_0x4c58('0x27')](_0x1cb35e,_0x4c58('0xce'));}this[_0x4c58('0xb')][_0x4c58('0x8e')](util[_0x4c58('0x24')](_0x4c58('0x181'),_0x25a33d),_0xbf835[_0x4c58('0x62')]?_0xbf835[_0x4c58('0x62')]:_0x4c58('0x182'));this[_0x4c58('0xb')][_0x4c58('0x8e')](util[_0x4c58('0x24')](_0x4c58('0x183'),_0x25a33d),_0xbf835[_0x4c58('0x63')]?_0xbf835['statusMessage']:'OK');if(_0xbf835[_0x4c58('0x58')]){try{this[_0x4c58('0x8a')](_0xbf835[_0x4c58('0x58')],_0x25a33d);}catch(_0x310e1c){logger[_0x4c58('0x27')](util['format'](_0x4c58('0x184'),_0x25a33d));}}return this[_0x4c58('0xb')][_0x4c58('0x98')](util[_0x4c58('0x24')](_0x4c58('0xd3'),_0x25a33d));};AGIVertices[_0x4c58('0xe')][_0x4c58('0x185')]=function(_0x1a741b){logger[_0x4c58('0x28')](util[_0x4c58('0x24')](_0x4c58('0x186'),_0x1a741b[_0x4c58('0x97')]));return this['channel'][_0x4c58('0x187')](_0x1a741b[_0x4c58('0x188')]['replace'](/\s+/g,''),_0x1a741b[_0x4c58('0x17c')]);};AGIVertices[_0x4c58('0xe')][_0x4c58('0x189')]=function(_0x120644){logger[_0x4c58('0x28')](util[_0x4c58('0x24')](_0x4c58('0x18a'),_0x120644['label']));return this[_0x4c58('0xb')][_0x4c58('0x18b')](_0x120644[_0x4c58('0x53')]['replace'](/\s+/g,''),_0x120644[_0x4c58('0x17c')]);};AGIVertices[_0x4c58('0xe')][_0x4c58('0x18c')]=function(_0xdc599d){logger['info'](util[_0x4c58('0x24')](_0x4c58('0x18d'),_0xdc599d[_0x4c58('0x97')]));return this['channel']['sayPhonetic'](_0xdc599d['text'],_0xdc599d[_0x4c58('0x17c')]);};AGIVertices[_0x4c58('0xe')][_0x4c58('0x18e')]=function(_0x5493e4){logger[_0x4c58('0x28')](util['format'](_0x4c58('0x18f'),_0x5493e4[_0x4c58('0x97')]));if(!this[_0x4c58('0x73')](_0x5493e4['account_id'])){return this[_0x4c58('0xb')][_0x4c58('0x98')]('no\x20mail\x20account\x20configured');}var _0x2adcb6=this['getMailAccount'][_0x4c58('0x5e')](this,_0x5493e4[_0x4c58('0x190')]);if(!_0x2adcb6||!_0x2adcb6[_0x4c58('0x191')]){return this['channel']['error'](_0x5493e4,'no\x20mail\x20account\x20found');}var _0x1cfe47={'from':util[_0x4c58('0x24')](_0x4c58('0x192'),_0x2adcb6[_0x4c58('0x11')],_0x2adcb6[_0x4c58('0x193')]||_0x2adcb6['Smtp'][_0x4c58('0x194')]),'to':_0x5493e4['to']||'','cc':_0x5493e4['cc']||'','bcc':_0x5493e4['bcc']||'','subject':_0x5493e4[_0x4c58('0x195')],'html':_0x5493e4[_0x4c58('0x4c')],'text':_0x5493e4['text']};var _0x1afcae={'tls':{'rejectUnauthorized':![]}};if(_0x2adcb6[_0x4c58('0x191')][_0x4c58('0x196')]){_0x1afcae[_0x4c58('0x196')]=_0x2adcb6[_0x4c58('0x191')]['service'];}else{_0x1afcae[_0x4c58('0x197')]=_0x2adcb6['Smtp'][_0x4c58('0x197')];_0x1afcae[_0x4c58('0x198')]=_0x2adcb6[_0x4c58('0x191')][_0x4c58('0x198')];_0x1afcae['secure']=_0x2adcb6['Smtp'][_0x4c58('0x199')];}if(_0x2adcb6[_0x4c58('0x191')][_0x4c58('0x19a')]){_0x1afcae[_0x4c58('0x19b')]={'user':_0x2adcb6['Smtp'][_0x4c58('0x194')],'pass':_0x2adcb6[_0x4c58('0x191')]['pass']};}if(this[_0x4c58('0x73')](_0x5493e4['template_id'])){}logger['debug'](_0x4c58('0x19c'),JSON[_0x4c58('0x60')](_0x1cfe47));this['createSquareDetailsReport']['sync'](this,_0x5493e4,_0x5493e4[_0x4c58('0x190')]);this[_0x4c58('0xb')][_0x4c58('0x98')](util[_0x4c58('0x24')](_0x4c58('0x19d'),_0x2adcb6[_0x4c58('0x11')]));this['sendMailMessage'][_0x4c58('0x5e')](this,_0x1afcae,_0x1cfe47);return this[_0x4c58('0xb')][_0x4c58('0x98')](_0x4c58('0x19e'));};AGIVertices['prototype'][_0x4c58('0x19f')]=function(_0x5943e4){logger['info'](util[_0x4c58('0x24')](_0x4c58('0x1a0'),_0x5943e4[_0x4c58('0x97')]));return this[_0x4c58('0xb')][_0x4c58('0x98')](_0x4c58('0x1a1'));};AGIVertices[_0x4c58('0xe')][_0x4c58('0x1a2')]=function(_0x489f60){logger[_0x4c58('0x28')](util[_0x4c58('0x24')]('Enter\x20in\x20SENDSMS\x20(%s)\x20block',_0x489f60[_0x4c58('0x97')]));if(!this[_0x4c58('0x73')](_0x489f60[_0x4c58('0x1a3')])){return this['channel'][_0x4c58('0x98')](_0x4c58('0x1a4'));}var _0x4c711f=this[_0x4c58('0x1a5')][_0x4c58('0x5e')](this,_0x489f60[_0x4c58('0x1a3')]);if(!_0x4c711f){return this[_0x4c58('0xb')]['error'](_0x489f60,'no\x20sms\x20account\x20found');}var _0xa82c41={'body':_0x489f60[_0x4c58('0x1a6')],'phone':_0x489f60['to']||'','SmsAccountId':_0x4c711f['id']};logger['debug'](_0x4c58('0x1a7'),JSON[_0x4c58('0x60')](_0xa82c41));this['createSquareDetailsReport'][_0x4c58('0x5e')](this,_0x489f60,_0x489f60[_0x4c58('0x1a3')]);this[_0x4c58('0xb')][_0x4c58('0x98')](util['format'](_0x4c58('0x1a8'),_0x4c711f[_0x4c58('0x11')]));this[_0x4c58('0x2d')]['sync'](this,_0xa82c41);return this[_0x4c58('0xb')][_0x4c58('0x98')]('Sms\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0x4c58('0xe')][_0x4c58('0x1a9')]=function(_0x19a8d9){logger[_0x4c58('0x28')](util[_0x4c58('0x24')](_0x4c58('0x1aa'),_0x19a8d9[_0x4c58('0x97')]));if(!this['isConfigured'](_0x19a8d9['variable_id'])){return this['channel'][_0x4c58('0x27')](_0x19a8d9,_0x4c58('0x1ab'));}var _0x2f7984=this[_0x4c58('0xf')][_0x4c58('0x5e')](this,_0x19a8d9['variable_id']);if(!_0x2f7984){return this[_0x4c58('0xb')]['error'](_0x19a8d9,_0x4c58('0xce'));}return this[_0x4c58('0xb')][_0x4c58('0x8e')](_0x2f7984,_0x19a8d9[_0x4c58('0x1ac')]);};AGIVertices[_0x4c58('0xe')]['start']=function(_0x2df644){logger['info'](util[_0x4c58('0x24')]('Enter\x20in\x20START\x20(%s)\x20block',_0x2df644[_0x4c58('0x97')]));this['channel'][_0x4c58('0x98')](_0x4c58('0x1ad'));if(_0x2df644[_0x4c58('0x1ae')]===_0x4c58('0x1af')){this[_0x4c58('0xb')][_0x4c58('0x98')](_0x4c58('0x1b0'));return this[_0x4c58('0xb')][_0x4c58('0x1ae')]();}return this[_0x4c58('0xb')][_0x4c58('0x98')](_0x4c58('0x1b1'));};AGIVertices[_0x4c58('0xe')][_0x4c58('0x1b2')]=function(_0x43b930){logger[_0x4c58('0x28')](util[_0x4c58('0x24')](_0x4c58('0x1b3'),_0x43b930['label']));if(!this[_0x4c58('0x73')](_0x43b930[_0x4c58('0x1b4')])){return this[_0x4c58('0xb')]['error'](_0x43b930,'no\x20subproject\x20selected');}var _0x594d14=this['getSquareProject']['sync'](this,_0x43b930[_0x4c58('0x1b4')]);if(!this[_0x4c58('0x73')](_0x594d14)){return this[_0x4c58('0xb')]['error'](_0x43b930,util[_0x4c58('0x24')](_0x4c58('0x1b5'),_0x43b930[_0x4c58('0x1b4')]));}if(_0x594d14===this[_0x4c58('0xb')][_0x4c58('0x32')]){return this[_0x4c58('0xb')][_0x4c58('0x27')](_0x43b930,_0x4c58('0x1b6'));}this[_0x4c58('0x2e')]['sync'](this,_0x43b930,_0x594d14);var _0x22b948=this[_0x4c58('0xb')]['exec']('AGI',util[_0x4c58('0x24')]('agi://%s/square,\x22%s\x22,\x22%s\x22',config[_0x4c58('0xa7')]['host']||_0x4c58('0x1b7'),_0x594d14,this['channel']['arg_1']));if(_0x22b948['result']===-0x1){return _0x22b948;}return this[_0x4c58('0xb')][_0x4c58('0x98')](util['format'](_0x4c58('0xb5'),_0x4c58('0x1b8'),_0x594d14));};AGIVertices[_0x4c58('0xe')][_0x4c58('0x1b9')]=function(_0x3d3661){logger[_0x4c58('0x28')](util[_0x4c58('0x24')](_0x4c58('0x1ba'),_0x3d3661[_0x4c58('0x97')]));var _0x4d4048=this[_0x4c58('0x45')][_0x4c58('0x5e')](this,_0x3d3661[_0x4c58('0xa9')]);this[_0x4c58('0x2e')][_0x4c58('0x5e')](this,_0x3d3661,_0x3d3661[_0x4c58('0xa9')]);if(this[_0x4c58('0x73')](_0x3d3661[_0x4c58('0xcc')])){var _0x509d1b=this['getVariable'][_0x4c58('0x5e')](this,_0x3d3661[_0x4c58('0xcc')]);if(_0x509d1b){this['channel'][_0x4c58('0x8e')](_0x509d1b,_0x4d4048);return this[_0x4c58('0xb')][_0x4c58('0x98')](util[_0x4c58('0x24')](_0x4c58('0x1bb'),_0x3d3661[_0x4c58('0xa9')],_0x509d1b));}}return this[_0x4c58('0xb')][_0x4c58('0x98')](util[_0x4c58('0x24')](_0x4c58('0x1bc'),_0x3d3661[_0x4c58('0xa9')]));};AGIVertices['prototype'][_0x4c58('0x1bd')]=function(_0x4c9863){logger[_0x4c58('0x28')](util['format'](_0x4c58('0x1be'),_0x4c9863[_0x4c58('0x97')]));_0x4c9863[_0x4c58('0x4c')]=_0x4c9863[_0x4c58('0x4c')][_0x4c58('0x48')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x4c9863['apiKey'])){return this['channel'][_0x4c58('0x98')](_0x4c58('0x1bf'));}if(!this[_0x4c58('0x73')](_0x4c9863['text'])){return this['channel'][_0x4c58('0x98')](_0x4c58('0x99'));}this[_0x4c58('0xb')][_0x4c58('0x98')](util['format']('Trying\x20Google\x20Cloud\x20TTS\x20%s',_0x4c9863[_0x4c58('0x4c')]));var _0x1ac026=this[_0x4c58('0x49')]['sync'](this,_0x4c9863);if(_0x1ac026){this[_0x4c58('0xb')][_0x4c58('0x98')](util[_0x4c58('0x24')](_0x4c58('0x1c0'),_0x1ac026));var _0x321076=this[_0x4c58('0xb')]['streamFile'](_0x1ac026);try{fs['unlink'](_0x1ac026+_0x4c58('0xfa'));}catch(_0x80c6af){logger[_0x4c58('0x27')](_0x80c6af);}return _0x321076;}return this[_0x4c58('0xb')][_0x4c58('0x27')](_0x4c9863,_0x4c58('0x1c1'));};AGIVertices[_0x4c58('0xe')]['tts']=function(_0x2eabee){logger[_0x4c58('0x28')](util[_0x4c58('0x24')](_0x4c58('0x1c2'),_0x2eabee['label']));_0x2eabee[_0x4c58('0x4c')]=_0x2eabee['text'][_0x4c58('0x48')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x4c58('0x73')](_0x2eabee[_0x4c58('0x4c')])){return this[_0x4c58('0xb')]['noop'](_0x4c58('0x99'));}this[_0x4c58('0xb')][_0x4c58('0x98')](util[_0x4c58('0x24')](_0x4c58('0x1c3'),_0x2eabee[_0x4c58('0x4c')]));var _0x9120ee=this[_0x4c58('0x50')][_0x4c58('0x5e')](this,_0x2eabee);if(_0x9120ee){this[_0x4c58('0xb')][_0x4c58('0x98')](util[_0x4c58('0x24')]('Google\x20TTS\x20%s\x20file\x20created',_0x9120ee));var _0x258fac=this[_0x4c58('0xb')][_0x4c58('0xf9')](_0x9120ee);try{fs[_0x4c58('0x11e')](_0x9120ee+_0x4c58('0xfa'));}catch(_0x5300f1){logger[_0x4c58('0x27')](_0x5300f1);}return _0x258fac;}return this['channel'][_0x4c58('0x27')](_0x2eabee,_0x4c58('0x1c4'));};AGIVertices[_0x4c58('0xe')][_0x4c58('0x1c5')]=function(_0x4cad86){logger[_0x4c58('0x28')](util[_0x4c58('0x24')](_0x4c58('0x1c6'),_0x4cad86[_0x4c58('0x97')]));if(!this[_0x4c58('0x73')](_0x4cad86[_0x4c58('0x154')])){return this[_0x4c58('0xb')]['error'](_0x4cad86,'no\x20find\x20by\x20configured');}logger[_0x4c58('0x28')](util['format'](_0x4c58('0x153'),this[_0x4c58('0xb')][_0x4c58('0x3f')],_0x4cad86[_0x4c58('0x154')]));var _0xbdf45d=this[_0x4c58('0x41')]['sync'](this,_0x4cad86[_0x4c58('0x154')]);if(_0xbdf45d){logger[_0x4c58('0x28')](util[_0x4c58('0x24')](_0x4c58('0x155'),this['channel']['callerid'],_0x4cad86[_0x4c58('0x154')]));this['channel'][_0x4c58('0x98')](util[_0x4c58('0x24')](_0x4c58('0x155'),this[_0x4c58('0xb')][_0x4c58('0x3f')],_0x4cad86[_0x4c58('0x154')]));return{'code':0xc8,'result':_0x4c58('0x159')};}else{logger[_0x4c58('0x28')](util[_0x4c58('0x24')](_0x4c58('0x15a'),this[_0x4c58('0xb')]['callerid'],_0x4cad86[_0x4c58('0x154')]));this[_0x4c58('0xb')][_0x4c58('0x98')](util[_0x4c58('0x24')](_0x4c58('0x15a'),this[_0x4c58('0xb')][_0x4c58('0x3f')],_0x4cad86[_0x4c58('0x154')]));return{'code':0xc8,'result':'failure'};}};AGIVertices['prototype'][_0x4c58('0x1c7')]=function(_0x116405){logger[_0x4c58('0x28')](util[_0x4c58('0x24')](_0x4c58('0x1c8'),_0x116405['label']));var _0x1f2813=this[_0x4c58('0xb')][_0x4c58('0x46')](_0x4c58('0x1c9'),[_0x116405['mailbox'],_0x116405['options']]);if(_0x1f2813[_0x4c58('0x9b')]===-0x1){return _0x1f2813;}return this[_0x4c58('0xb')][_0x4c58('0x98')](util[_0x4c58('0x24')](_0x4c58('0xb5'),_0x4c58('0x1c9'),_0x116405[_0x4c58('0x1ca')]));};AGIVertices[_0x4c58('0xe')][_0x4c58('0x1cb')]=function(_0x3afaed){logger[_0x4c58('0x28')](util['format'](_0x4c58('0x1cc'),_0x3afaed[_0x4c58('0x97')]));if(!this['isConfigured'](_0x3afaed[_0x4c58('0xcc')])){return this[_0x4c58('0xb')][_0x4c58('0x27')](_0x3afaed,_0x4c58('0x1ab'));}var _0x256f2c=this['getVariable'][_0x4c58('0x5e')](this,_0x3afaed[_0x4c58('0xcc')]);if(!_0x256f2c){return this[_0x4c58('0xb')]['error'](_0x3afaed,_0x4c58('0xce'));}var _0x3b4feb=this['channel'][_0x4c58('0xf')](_0x256f2c);return{'code':0xc8,'result':_0x3b4feb[_0x4c58('0x93')]?_0x3b4feb[_0x4c58('0x93')]:'-'};};String[_0x4c58('0xe')][_0x4c58('0x90')]=function(_0x466d63,_0x389d9a){return this[_0x4c58('0x8f')](_0x466d63)[_0x4c58('0x1cd')](_0x389d9a);};module[_0x4c58('0x1ce')]=AGIVertices; \ No newline at end of file +var _0x98d1=['aws_lex_region','googleASR','google_asr_language','tildeASR','appid','appsecret','clear','agicommand','clone','hasOwnProperty','isString','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isPlainObject','saveRestApiResult','%s.%s','isArray','setVariable','length','replaceAll','extra','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','retry','maxRetry','mrcpsynth','noop','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','MRCPRecog','MRCP_RECOG_CONFIDENCE','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','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','minutes','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','no\x20text\x20configured','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','no\x20grammar\x20configured','RECOG_CONFIDENCE()','LUMENVOX_ASR_CONFIDENCE','RECOG_INPUT()','LUMENVOX_ASR_TRANSCRIPT','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','getSquareOdbc','no\x20odbc\x20database\x20found','no\x20query\x20configured','query','replace','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','forEach','keys','%s_ROWS_COUNT','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','no\x20user\x20found','DIAL','opts','Executed\x20command\x20%s','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','Dialogflow\x20Result\x20%s','speech','dialogflowV2_project_id','no\x20project_id\x20configured','no\x20private_key\x20configured','no\x20anguage\x20configured','bot','Trying\x20DialogflowV2:\x20%s','providerResponse','out','dialogflowV2','DialogflowV2\x20is\x20unreachable','sesteknda','ndauth_url','no\x20username\x20configured','password','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','unlink','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20found','trunk_name','no\x20trunk\x20selected','SIP/%s/%s','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','getdigits','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','getData','response','maxdigit','test','mindigit','no\x20variable\x20found','hiddendigitsnum','generate','hiddendigitspos','first','substr','getsecretdigits','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','.wav','aws\x20Polly\x20is\x20unreachable','aws_bot_name','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','Amazon\x20Lex\x20Result\x20%s','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','%s/recordings/%s','beep','recordFile','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','no\x20appsecret\x20configured','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','interval_id','no\x20interval\x20configured','getIntervals','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','true','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','NOBEEP','ISPEECH_ASR_%s','ispeechtts','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','no\x20find\x20by\x20configured','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','math\x20%s','%s[%s]','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','agentPause','playback','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','getVoiceQueue','indexOf','XMCS-QUEUE','toLowerCase','macro','gosub','position','record','Enter\x20in\x20RECORD\x20(%s)\x20block','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','Enter\x20in\x20RESTAPI\x20(%s)\x20block','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','200','%s_STATUS_MESSAGE','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','saynumber','sayNumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','Smtp','no\x20mail\x20account\x20found','email','user','bcc','subject','service','host','port','secure','authentication','auth','template_id','sendMail\x20message','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','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','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','start','yes','Answer','Skipped\x20Answer','subproject','project_id','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','googleTTS','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','unpause','FIND\x20AGENT\x20%s\x20BY\x20%s','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','exports','path','lodash','odbc','randomstring','mustache','request-promise','../../config/logger','agi','../../config/environment','/var/opt/motion2/server/files','rawHeaders','rawBody','menu','rpc','mailRpc','prototype','getVariable','getVariableById','then','name','getVoiceQueueById','getSquareProject','getSquareProjectById','catch','dsn','getUser','getUserById','getTrunk','getTrunkById','getSound','getSoundById','getSoundPath','save_name','getMailAccount','getMailAccountById','sendMailMessage','getIntervalById','IntervalId','interval','Intervals','format','%s/sounds/converted/%s','getQueryOdbc','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccountById','createSmsMessage','createSquareDetailsReport','channel','label','arg_1','callerid','createSquareRecording','calleridname','context','extension','accountcode','dnid','createSquareMessage','uniqueid','createCmContact','isNil','isEmpty','lastName','phone','list_id','scheduledAt','callback','toString','callback_priority','getPause','getPauseById','agent','agentUnpause','agentLogout','agentLogin','internal','%s/%s@from-sip/n','LOCAL','shellCommand','exec','trim','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','en-US','MALE','audioEncoding','restAPI','method','number','timeout','includes','POST','PUT','toUpperCase','body','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','parse','sync','uri','render','url','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusMessage','statusCode','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','client_email','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','ispeech_tts_language','speed','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_region','aws_polly_voice','Amy','aws_text_type','awsLex'];(function(_0xf71120,_0x25b7f9){var _0xbe2fd3=function(_0x1acbdd){while(--_0x1acbdd){_0xf71120['push'](_0xf71120['shift']());}};_0xbe2fd3(++_0x25b7f9);}(_0x98d1,0x13e));var _0x198d=function(_0x4f5875,_0x4ed82f){_0x4f5875=_0x4f5875-0x0;var _0x164426=_0x98d1[_0x4f5875];return _0x164426;};'use strict';var fs=require('fs');var path=require(_0x198d('0x0'));var util=require('util');var _=require(_0x198d('0x1'));var sh=require('shelljs');var odbc=require(_0x198d('0x2'))();var rs=require(_0x198d('0x3'));var moment=require('moment');var Mustache=require(_0x198d('0x4'));var rp=require(_0x198d('0x5'));var logger=require(_0x198d('0x6'))(_0x198d('0x7'));var config=require(_0x198d('0x8'));var scripts=require('./scripts');var FILES_PATH=_0x198d('0x9');var recursiveMapAttributes=[_0x198d('0xa'),_0x198d('0xb')];var verticesWithRetry=[_0x198d('0xc'),'getdigits','getsecretdigits'];var AGIVertices=function(_0x4a5f86,_0x3d2248,_0x2c6570){this['channel']=_0x4a5f86;this[_0x198d('0xd')]=_0x3d2248;this[_0x198d('0xe')]=_0x2c6570;};AGIVertices[_0x198d('0xf')][_0x198d('0x10')]=function(_0x28e96b,_0x3f89d5){this[_0x198d('0xd')][_0x198d('0x11')](_0x28e96b)[_0x198d('0x12')](function(_0x4c90d7){_0x3f89d5(null,_0x4c90d7?_0x4c90d7[_0x198d('0x13')]:![]);})['catch'](function(_0x27ced2){_0x3f89d5(_0x27ced2);});};AGIVertices['prototype']['getVoiceQueue']=function(_0x562100,_0x16b365){this[_0x198d('0xd')][_0x198d('0x14')](_0x562100)[_0x198d('0x12')](function(_0x24e60e){_0x16b365(null,_0x24e60e?_0x24e60e[_0x198d('0x13')]:![]);})['catch'](function(_0x377def){_0x16b365(_0x377def);});};AGIVertices[_0x198d('0xf')][_0x198d('0x15')]=function(_0x6b977a,_0x4c6e37){this['rpc'][_0x198d('0x16')](_0x6b977a)['then'](function(_0x535889){_0x4c6e37(null,_0x535889?_0x535889['name']:![]);})[_0x198d('0x17')](function(_0x5f3870){_0x4c6e37(_0x5f3870);});};AGIVertices['prototype']['getSquareOdbc']=function(_0x1a8fd9,_0x4d9868){this[_0x198d('0xd')]['getSquareOdbcById'](_0x1a8fd9)['then'](function(_0x55e911){_0x4d9868(null,_0x55e911?_0x55e911[_0x198d('0x18')]:![]);})[_0x198d('0x17')](function(_0x2ded1f){_0x4d9868(_0x2ded1f);});};AGIVertices[_0x198d('0xf')][_0x198d('0x19')]=function(_0x38d0ab,_0x1f657c){this[_0x198d('0xd')][_0x198d('0x1a')](_0x38d0ab)[_0x198d('0x12')](function(_0x2a7d3d){_0x1f657c(null,_0x2a7d3d?_0x2a7d3d[_0x198d('0x13')]:![]);})[_0x198d('0x17')](function(_0x1bf976){_0x1f657c(_0x1bf976);});};AGIVertices[_0x198d('0xf')][_0x198d('0x1b')]=function(_0x49b30f,_0x2f9d5e){this[_0x198d('0xd')][_0x198d('0x1c')](_0x49b30f)['then'](function(_0x2298bf){_0x2f9d5e(null,_0x2298bf?_0x2298bf[_0x198d('0x13')]:![]);})[_0x198d('0x17')](function(_0x4513cc){_0x2f9d5e(_0x4513cc);});};AGIVertices[_0x198d('0xf')][_0x198d('0x1d')]=function(_0x3a6283,_0x1696ca){var _0x555522=this;this[_0x198d('0xd')][_0x198d('0x1e')](_0x3a6283)[_0x198d('0x12')](function(_0x1fc533){_0x1696ca(null,_0x1fc533?_0x555522[_0x198d('0x1f')](_0x1fc533[_0x198d('0x20')]):![]);})[_0x198d('0x17')](function(_0x37df31){_0x1696ca(_0x37df31);});};AGIVertices['prototype'][_0x198d('0x21')]=function(_0x2755f7,_0x37c1f2){this['rpc'][_0x198d('0x22')](_0x2755f7)[_0x198d('0x12')](function(_0x376f64){_0x37c1f2(null,_0x376f64?_0x376f64:![]);})[_0x198d('0x17')](function(_0x57bad2){_0x37c1f2(_0x57bad2);});};AGIVertices[_0x198d('0xf')][_0x198d('0x23')]=function(_0x5ccef4,_0x11a1cc,_0x62e562){this[_0x198d('0xe')][_0x198d('0x23')](_0x5ccef4,_0x11a1cc)[_0x198d('0x12')](function(){_0x62e562(null);})[_0x198d('0x17')](function(_0xaf681a){_0x62e562(_0xaf681a);});};AGIVertices['prototype']['getIntervals']=function(_0x4fe371,_0x514f65){this[_0x198d('0xd')][_0x198d('0x24')](_0x4fe371)[_0x198d('0x12')](function(_0x17fe49){if(_0x17fe49){if(_0x17fe49[_0x198d('0x25')]){_0x514f65(null,[_0x17fe49[_0x198d('0x26')]]);}else{_0x514f65(null,_['map'](_0x17fe49[_0x198d('0x27')],_0x198d('0x26')));}}else{_0x514f65(null,![]);}})[_0x198d('0x17')](function(_0x46bcf8){_0x514f65(_0x46bcf8);});};AGIVertices[_0x198d('0xf')][_0x198d('0x1f')]=function(_0x55038b){return util[_0x198d('0x28')](_0x198d('0x29'),FILES_PATH,_0x55038b);};AGIVertices[_0x198d('0xf')][_0x198d('0x2a')]=function(_0x6270a,_0x251f99,_0x4195b7){odbc['open'](_0x6270a,function(_0x14e884){if(_0x14e884){logger[_0x198d('0x2b')](_0x198d('0x2c'),_0x14e884);_0x4195b7(_0x14e884);}else{logger[_0x198d('0x2d')]('ODBC\x20connection\x20successfully');odbc['query'](_0x251f99,function(_0x4698c2,_0xb7aca3){if(_0x4698c2){logger[_0x198d('0x2d')](_0x198d('0x2e'),_0x251f99);_0x4195b7(_0x4698c2);}else{logger[_0x198d('0x2d')](_0x198d('0x2f'),_0x251f99);odbc['close'](function(_0x28494e){if(_0x28494e){logger[_0x198d('0x2b')](_0x198d('0x30'),_0x28494e);}_0x4195b7(null,_0xb7aca3);});}});}});};AGIVertices['prototype']['getSmsAccount']=function(_0x47ceef,_0x271080){this[_0x198d('0xd')][_0x198d('0x31')](_0x47ceef)[_0x198d('0x12')](function(_0x37def3){_0x271080(null,_0x37def3?_0x37def3:![]);})[_0x198d('0x17')](function(_0x512690){_0x271080(_0x512690);});};AGIVertices[_0x198d('0xf')]['createSmsMessage']=function(_0x304668,_0x4ce011){this[_0x198d('0xd')][_0x198d('0x32')](_0x304668)['then'](function(_0xc42180){_0x4ce011(null,_0xc42180);})[_0x198d('0x17')](function(_0x5cbeb8){_0x4ce011(_0x5cbeb8);});};AGIVertices['prototype'][_0x198d('0x33')]=function(_0x39e17d,_0xdea649,_0x30d1e1){this['rpc'][_0x198d('0x33')]({'uniqueid':this[_0x198d('0x34')]['uniqueid'],'node':_0x39e17d[_0x198d('0x35')],'application':_0x39e17d['agicommand'],'data':_0xdea649||null,'project_name':this[_0x198d('0x34')][_0x198d('0x36')],'callerid':this['channel'][_0x198d('0x37')]})[_0x198d('0x12')](function(_0x40dfcf){if(_0x30d1e1){_0x30d1e1(null,_0x40dfcf);}})[_0x198d('0x17')](function(_0x3b4564){if(_0x30d1e1){_0x30d1e1(_0x3b4564);}});};AGIVertices[_0x198d('0xf')][_0x198d('0x38')]=function(_0x50b013,_0xe9d23a,_0x1b2575,_0x759278){this[_0x198d('0xd')][_0x198d('0x38')]({'uniqueid':this[_0x198d('0x34')]['uniqueid'],'callerid':this[_0x198d('0x34')][_0x198d('0x37')],'calleridname':this['channel'][_0x198d('0x39')],'context':this[_0x198d('0x34')][_0x198d('0x3a')],'extension':this[_0x198d('0x34')][_0x198d('0x3b')],'priority':this[_0x198d('0x34')]['priority'],'accountcode':this['channel'][_0x198d('0x3c')],'dnid':this['channel'][_0x198d('0x3d')],'projectName':this['channel'][_0x198d('0x36')],'saveName':_0xe9d23a,'filename':_0x50b013['file']||_0xe9d23a,'savePath':_0x1b2575})[_0x198d('0x12')](function(_0x252c8c){_0x759278(null,_0x252c8c);})['catch'](function(_0x5cf5ad){_0x759278(_0x5cf5ad);});};AGIVertices[_0x198d('0xf')][_0x198d('0x3e')]=function(_0xfdb4ab,_0x16fa3a,_0x59bd48,_0x8d804e,_0x57caca){this['rpc'][_0x198d('0x3e')]({'uniqueid':this[_0x198d('0x34')][_0x198d('0x3f')],'body':_0xfdb4ab,'direction':_0x16fa3a,'providerName':_0x59bd48,'providerResponse':_0x8d804e})[_0x198d('0x12')](function(_0x4b7505){if(_0x57caca){_0x57caca(null,_0x4b7505);}})[_0x198d('0x17')](function(_0x1b2b5d){if(_0x57caca){_0x57caca(_0x1b2b5d);}});};AGIVertices[_0x198d('0xf')][_0x198d('0x40')]=function(_0x366ac4,_0x182471){this[_0x198d('0xd')][_0x198d('0x40')]({'firstName':_['isEmpty'](_0x366ac4[_0x198d('0x13')])||_[_0x198d('0x41')](_0x366ac4['name'])?'callback_'+Math['random']():_0x366ac4[_0x198d('0x13')],'lastName':_[_0x198d('0x42')](_0x366ac4[_0x198d('0x43')])||_[_0x198d('0x41')](_0x366ac4[_0x198d('0x43')])?null:_0x366ac4[_0x198d('0x43')],'phone':_0x366ac4[_0x198d('0x44')],'ListId':_0x366ac4[_0x198d('0x45')],'scheduledat':_0x366ac4[_0x198d('0x46')],'callbackUniqueid':this[_0x198d('0x34')][_0x198d('0x3f')],'tags':_0x198d('0x47'),'description':'Callback\x20scheduled\x20at\x20'+_0x366ac4['scheduledAt'][_0x198d('0x48')](),'priority':_0x366ac4[_0x198d('0x49')]})['then'](function(_0x47229){_0x182471(null,_0x47229);})[_0x198d('0x17')](function(_0x463c0e){_0x182471(_0x463c0e);});};AGIVertices[_0x198d('0xf')][_0x198d('0x4a')]=function(_0x3579f0,_0x5937b5){this[_0x198d('0xd')][_0x198d('0x4b')](_0x3579f0)[_0x198d('0x12')](function(_0x498723){_0x5937b5(null,_0x498723?_0x498723[_0x198d('0x13')]:![]);})['catch'](function(_0x5db388){_0x5937b5(_0x5db388);});};AGIVertices[_0x198d('0xf')]['agentPause']=function(_0x7aa147,_0x48a4c8,_0xbcf990){var _0x484bf8={'role':_0x198d('0x4c')};_0x484bf8[_0x7aa147]=this['channel'][_0x198d('0x37')];this[_0x198d('0xd')]['agentPause'](_0x484bf8,_0x48a4c8,this[_0x198d('0x34')][_0x198d('0x3f')])[_0x198d('0x12')](function(_0xf68b44){_0xbcf990(null,_[_0x198d('0x41')](_0xf68b44)?![]:!![]);})[_0x198d('0x17')](function(_0x2c9077){logger['error'](_0x2c9077);_0xbcf990(null,![]);});};AGIVertices[_0x198d('0xf')][_0x198d('0x4d')]=function(_0x4abe9b,_0x456030){var _0x219db9={'role':_0x198d('0x4c')};_0x219db9[_0x4abe9b]=this[_0x198d('0x34')][_0x198d('0x37')];this['rpc']['agentUnpause'](_0x219db9)['then'](function(_0x38c00f){_0x456030(null,_[_0x198d('0x41')](_0x38c00f)?![]:!![]);})[_0x198d('0x17')](function(_0x5e0d7e){logger[_0x198d('0x2b')](_0x5e0d7e);_0x456030(null,![]);});};AGIVertices[_0x198d('0xf')][_0x198d('0x4e')]=function(_0x147922,_0xcba8fe){var _0x51d9df={'role':'agent'};_0x51d9df[_0x147922]=this['channel'][_0x198d('0x37')];this[_0x198d('0xd')][_0x198d('0x4e')](_0x51d9df)[_0x198d('0x12')](function(_0x35f108){_0xcba8fe(null,_[_0x198d('0x41')](_0x35f108)?![]:!![]);})[_0x198d('0x17')](function(_0x1d1dd4){logger[_0x198d('0x2b')](_0x1d1dd4);_0xcba8fe(null,![]);});};AGIVertices['prototype'][_0x198d('0x4f')]=function(_0x733aef,_0x40b9ec){var _0x1cd9ef={'role':_0x198d('0x4c')};_0x1cd9ef[_0x733aef]=this[_0x198d('0x34')][_0x198d('0x37')];var _0x541807=_0x733aef!=_0x198d('0x50')?util[_0x198d('0x28')](_0x198d('0x51'),_0x198d('0x52'),this[_0x198d('0x34')][_0x198d('0x37')]):undefined;this[_0x198d('0xd')][_0x198d('0x4f')](_0x1cd9ef,_0x541807)['then'](function(_0x31cb77){_0x40b9ec(null,_[_0x198d('0x41')](_0x31cb77)?![]:!![]);})['catch'](function(_0x490632){logger[_0x198d('0x2b')](_0x490632);_0x40b9ec(null,![]);});};AGIVertices[_0x198d('0xf')][_0x198d('0x53')]=function(_0x545727,_0x21ca15){sh[_0x198d('0x54')](_[_0x198d('0x55')](_0x545727),function(_0x34da02,_0xbc502c){var _0x52bfb4=_0xbc502c['replace'](/(\r\n|\n|\r)/gm,'');_0x21ca15(null,_0x52bfb4);});};AGIVertices[_0x198d('0xf')]['googleCloudTTS']=function(_0x3bec73,_0x21154b){scripts[_0x198d('0x56')](_0x3bec73[_0x198d('0x57')],_0x3bec73[_0x198d('0x58')]||_0x198d('0x59'),_0x3bec73[_0x198d('0x59')],_0x3bec73[_0x198d('0x5a')]||_0x198d('0x5b'),_0x3bec73['ssmlGender']||_0x198d('0x5c'),_0x3bec73[_0x198d('0x5d')]||'MP3')[_0x198d('0x12')](function(_0x69a8db){_0x21154b(null,_0x69a8db);})[_0x198d('0x17')](function(_0x1b12bf){_0x21154b(_0x1b12bf);});};AGIVertices[_0x198d('0xf')]['googleTTS']=function(_0x5d1018,_0x34556b){scripts['googleTTS'](_0x5d1018[_0x198d('0x59')],_0x5d1018['google_tts_language']||'en',0x1)['then'](function(_0x17740b){_0x34556b(null,_0x17740b);})['catch'](function(_0x12d5e5){_0x34556b(_0x12d5e5);});};AGIVertices['prototype'][_0x198d('0x5e')]=function(_0x431470,_0x2dacc8){var _0x2b9dda={'uri':_0x431470['url'],'method':_0x431470[_0x198d('0x5f')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x431470['timeout'])===_0x198d('0x60')&&parseInt(_0x431470[_0x198d('0x61')])>=0x1?parseInt(_0x431470['timeout'])*0x3e8:0x5*0x3e8};if(_[_0x198d('0x62')]([_0x198d('0x63'),_0x198d('0x64')],_0x2b9dda['method'][_0x198d('0x65')]())){try{_0x2b9dda[_0x198d('0x66')]=_0x431470[_0x198d('0xb')]?JSON['parse'](_0x431470[_0x198d('0xb')]):{};}catch(_0xed4151){logger[_0x198d('0x2b')](_0x198d('0x67'),_0xed4151);}}try{_0x2b9dda[_0x198d('0x68')]=_0x431470[_0x198d('0xa')]?JSON[_0x198d('0x69')](_0x431470[_0x198d('0xa')]):{};}catch(_0x4cfc8){logger[_0x198d('0x2b')]('An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function',_0x4cfc8);}if(_0x431470['computedVariables']){try{var _0x498dfd=require(_0x431470['computedVariables'])[_0x198d('0x6a')](this,_0x2b9dda);_0x2b9dda[_0x198d('0x6b')]=Mustache[_0x198d('0x6c')](_0x431470[_0x198d('0x6d')],_0x498dfd,{},['$$','$$']);if(_0x2b9dda[_0x198d('0x68')]){_0x2b9dda[_0x198d('0x68')]=JSON[_0x198d('0x69')](Mustache['render'](JSON[_0x198d('0x6e')](_0x2b9dda[_0x198d('0x68')]),_0x498dfd,{},['$$','$$']));}if(_0x2b9dda['body']){_0x2b9dda[_0x198d('0x66')]=JSON[_0x198d('0x69')](Mustache['render'](JSON[_0x198d('0x6e')](_0x2b9dda[_0x198d('0x66')]),_0x498dfd,{},['$$','$$']));}}catch(_0x51d320){logger['error'](_0x198d('0x6f'),_0x51d320);}}rp(_0x2b9dda)[_0x198d('0x12')](function(_0x17c986){var _0x400b46={'statusCode':_0x17c986['statusCode']||0xc8,'statusMessage':_0x17c986[_0x198d('0x70')]||'OK','headers':_0x17c986[_0x198d('0x68')]||{},'body':_0x17c986[_0x198d('0x66')]||{}};_0x2dacc8(null,_0x400b46);})[_0x198d('0x17')](function(_0x4b903f){var _0x252773={'statusCode':_0x4b903f[_0x198d('0x71')]||0x1f4,'statusMessage':_0x4b903f['message']||_0x198d('0x72'),'headers':_0x4b903f[_0x198d('0x73')][_0x198d('0x68')]||{},'body':_0x4b903f[_0x198d('0x73')][_0x198d('0x66')]||{}};_0x2dacc8(null,_0x252773);});};AGIVertices['prototype']['googleDialogflow']=function(_0x406ac7,_0x410490){scripts[_0x198d('0x74')](this[_0x198d('0x34')][_0x198d('0x3f')],_0x406ac7[_0x198d('0x75')],_0x406ac7[_0x198d('0x59')],_0x406ac7[_0x198d('0x76')]||'en')[_0x198d('0x12')](function(_0xd0ecf3){_0x410490(null,_0xd0ecf3);})[_0x198d('0x17')](function(_0xe3b8c1){_0x410490(_0xe3b8c1);});};AGIVertices[_0x198d('0xf')][_0x198d('0x77')]=function(_0x4ad03b,_0x1e4799){scripts['googleDialogflowV2'](this[_0x198d('0x34')][_0x198d('0x3f')],_0x4ad03b['dialogflowV2_project_id'],_0x4ad03b[_0x198d('0x78')],_0x4ad03b[_0x198d('0x79')],_0x4ad03b[_0x198d('0x59')],_0x4ad03b[_0x198d('0x7a')]||'en')[_0x198d('0x12')](function(_0x19e0fa){_0x1e4799(null,_0x19e0fa);})[_0x198d('0x17')](function(_0x112828){_0x1e4799(_0x112828);});};AGIVertices[_0x198d('0xf')]['sestekNDA']=function(_0x31b59f,_0x543e8d){scripts[_0x198d('0x7b')](this[_0x198d('0x34')],_0x31b59f)['then'](function(_0x11fd22){_0x543e8d(null,_0x11fd22);})[_0x198d('0x17')](function(_0x38b20a){_0x543e8d(_0x38b20a);});};AGIVertices[_0x198d('0xf')][_0x198d('0x7c')]=function(_0x4dee40,_0x101e1b){scripts[_0x198d('0x7c')](_0x4dee40[_0x198d('0x75')],_0x4dee40[_0x198d('0x59')],_0x4dee40[_0x198d('0x7d')]||_0x198d('0x5b'),_0x4dee40[_0x198d('0x7e')])['then'](function(_0x112c96){_0x101e1b(null,_0x112c96);})[_0x198d('0x17')](function(_0x2782e1){_0x101e1b(_0x2782e1);});};AGIVertices[_0x198d('0xf')][_0x198d('0x7f')]=function(_0x16aa7b,_0x394546,_0xf7310){scripts[_0x198d('0x7f')](_0x394546,_0x16aa7b[_0x198d('0x75')],_0x16aa7b[_0x198d('0x80')]||_0x198d('0x5b'),this[_0x198d('0x81')](_0x16aa7b[_0x198d('0x82')])?_0x16aa7b['model']:undefined)[_0x198d('0x12')](function(_0x385f61){_0xf7310(null,_0x385f61);})['catch'](function(_0x2aac96){_0xf7310(_0x2aac96);});};AGIVertices[_0x198d('0xf')][_0x198d('0x83')]=function(_0x2385e1,_0x2edee1){scripts['awsPolly'](_0x2385e1[_0x198d('0x84')],_0x2385e1[_0x198d('0x85')],_0x2385e1[_0x198d('0x86')],_0x2385e1[_0x198d('0x87')]||_0x198d('0x88'),_0x2385e1[_0x198d('0x59')],_0x2385e1[_0x198d('0x89')]||'text')[_0x198d('0x12')](function(_0x3c0034){_0x2edee1(null,_0x3c0034);})[_0x198d('0x17')](function(_0x565f22){_0x2edee1(_0x565f22);});};AGIVertices['prototype'][_0x198d('0x8a')]=function(_0x25cbff,_0x5b5430){scripts[_0x198d('0x8a')](this['channel'][_0x198d('0x3f')],_0x25cbff[_0x198d('0x84')],_0x25cbff[_0x198d('0x85')],_0x25cbff[_0x198d('0x8b')],_0x25cbff[_0x198d('0x59')],_0x25cbff['aws_bot_name'])[_0x198d('0x12')](function(_0x42a91f){_0x5b5430(null,_0x42a91f);})['catch'](function(_0x41414c){_0x5b5430(_0x41414c);});};AGIVertices[_0x198d('0xf')][_0x198d('0x8c')]=function(_0x322c72,_0x1e9f61,_0x5554bd){scripts[_0x198d('0x8c')](_0x1e9f61,_0x322c72[_0x198d('0x75')],_0x322c72[_0x198d('0x8d')]||_0x198d('0x5b'))[_0x198d('0x12')](function(_0x4c740e){_0x5554bd(null,_0x4c740e);})[_0x198d('0x17')](function(_0x9f7ce8){_0x5554bd(_0x9f7ce8);});};AGIVertices[_0x198d('0xf')]['tildeASR']=function(_0x15dfe6,_0x102108,_0x33f9a5){scripts[_0x198d('0x8e')](_0x102108,_0x15dfe6[_0x198d('0x8f')],_0x15dfe6[_0x198d('0x90')],_0x15dfe6[_0x198d('0x6b')])[_0x198d('0x12')](function(_0x26a82f){_0x33f9a5(null,_0x26a82f);})[_0x198d('0x17')](function(_0x294025){_0x33f9a5(_0x294025);});};AGIVertices[_0x198d('0xf')][_0x198d('0x91')]=function(_0x3320e3){var _0x1d59e0=_['includes'](verticesWithRetry,_0x3320e3[_0x198d('0x92')])?_0x3320e3:_[_0x198d('0x93')](_0x3320e3);for(var _0x3f3f92 in _0x1d59e0){if(_0x1d59e0[_0x198d('0x94')](_0x3f3f92)){if(_0x1d59e0[_0x3f3f92]&&_[_0x198d('0x95')](_0x1d59e0[_0x3f3f92])){if(_[_0x198d('0x62')](recursiveMapAttributes,_0x3f3f92)){_0x1d59e0[_0x3f3f92]=this[_0x198d('0x96')](_0x1d59e0[_0x3f3f92]);}else{_0x1d59e0[_0x3f3f92]=this[_0x198d('0x97')](_0x1d59e0[_0x3f3f92]);}}}}return _0x1d59e0;};AGIVertices[_0x198d('0xf')][_0x198d('0x98')]=function(_0x5d55df){for(var _0x10d495 in _0x5d55df){if(_0x5d55df[_0x198d('0x94')](_0x10d495)){if(_[_0x198d('0x99')](_0x5d55df[_0x10d495])){this[_0x198d('0x98')](_0x5d55df[_0x10d495]);}else if(_['isArray'](_0x5d55df[_0x10d495])){for(var _0x4b17d6=0x0;_0x4b17d6<_0x5d55df[_0x10d495]['length'];_0x4b17d6++){this[_0x198d('0x98')](_0x5d55df[_0x10d495][_0x4b17d6]);}}else if(_[_0x198d('0x95')](_0x5d55df[_0x10d495])){_0x5d55df[_0x10d495]=this[_0x198d('0x97')](_0x5d55df[_0x10d495]);}}}};AGIVertices['prototype']['saveRestApiResult']=function(_0x209abb,_0x53d61a){for(var _0xa324c7 in _0x209abb){if(_0x209abb[_0x198d('0x94')](_0xa324c7)){if(_[_0x198d('0x99')](_0x209abb[_0xa324c7])){if(!_[_0x198d('0x42')](_0x209abb[_0xa324c7])){this[_0x198d('0x9a')](_0x209abb[_0xa324c7],util[_0x198d('0x28')](_0x198d('0x9b'),_0x53d61a,_0xa324c7));}}else if(_[_0x198d('0x9c')](_0x209abb[_0xa324c7])){for(var _0x5a8a31=0x0;_0x5a8a31<_0x209abb[_0xa324c7]['length'];_0x5a8a31++){this[_0x198d('0x9a')](_0x209abb[_0xa324c7][_0x5a8a31],util['format']('%s.%s',_0x53d61a,_0xa324c7+'['+_0x5a8a31+']'));}}else{if(!_[_0x198d('0x41')](_0x209abb[_0xa324c7])){this['channel'][_0x198d('0x9d')](util[_0x198d('0x28')](_0x198d('0x9b'),_0x53d61a,_0xa324c7),_0x209abb[_0xa324c7]);}}}}};AGIVertices[_0x198d('0xf')][_0x198d('0x96')]=function(_0x2c27fc){try{var _0x3b58d3=JSON['parse'](_0x2c27fc);this[_0x198d('0x98')](_0x3b58d3);return JSON[_0x198d('0x6e')](_0x3b58d3);}catch(_0x2212c7){return this[_0x198d('0x97')](_0x2c27fc);}};AGIVertices[_0x198d('0xf')]['replaceAllVariables']=function(_0x516299){var _0x48519a=_0x516299['split']('{');for(var _0x5a892c=0x1;_0x5a892c<_0x48519a[_0x198d('0x9e')];_0x5a892c+=0x1){var _0x172c53=_0x48519a[_0x5a892c]['split']('}');if(_0x172c53['length']>0x1){_0x516299=_0x516299[_0x198d('0x9f')]('{'+_0x172c53[0x0]+'}',this[_0x198d('0x34')][_0x198d('0x10')](_0x172c53[0x0])[_0x198d('0xa0')]||_0x172c53[0x0]);}}if(_0x48519a[_0x198d('0x9e')]===0x1){return _0x516299[_0x198d('0x48')]();}return this[_0x198d('0x97')](_0x516299);};AGIVertices[_0x198d('0xf')][_0x198d('0xa1')]=function(_0x4b1dd0,_0x4c0b3b){var _0x544152=this['channel'][_0x198d('0x10')](_0x4b1dd0);if(_0x544152[_0x198d('0xa2')]===-0x1){return _0x544152;}logger['info'](util[_0x198d('0x28')](_0x198d('0xa3'),_0x4c0b3b,_0x544152['extra']));return this['channel'][_0x198d('0x9d')](_0x4c0b3b,_0x544152[_0x198d('0xa0')]);};AGIVertices[_0x198d('0xf')][_0x198d('0x81')]=function(_0x47890c){return _0x47890c&&_0x47890c!=='0'&&_0x47890c!=='-1'&&_0x47890c!=='';};AGIVertices[_0x198d('0xf')]['maxRetry']=function(_0xc7bc32){this[_0x198d('0x33')][_0x198d('0x6a')](this,_0xc7bc32,'-');_0xc7bc32[_0x198d('0xa4')]=_0xc7bc32[_0x198d('0xa5')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x198d('0xf')][_0x198d('0xa6')]=function(_0x5b1003){logger[_0x198d('0x2d')](util['format']('Enter\x20in\x20MRCPSynth\x20(%s)\x20block',_0x5b1003[_0x198d('0x35')]));if(!this['isConfigured'](_0x5b1003[_0x198d('0x59')])){return this[_0x198d('0x34')][_0x198d('0xa7')]('no\x20text\x20configured');}var _0x34d47a='\x22'+_0x5b1003[_0x198d('0x59')]+'\x22';if(this[_0x198d('0x81')](_0x5b1003[_0x198d('0x73')])){_0x34d47a+=','+_0x5b1003[_0x198d('0x73')];}var _0x5befdb=this[_0x198d('0x34')][_0x198d('0x54')](_0x198d('0xa8'),_0x34d47a);if(_0x5befdb[_0x198d('0xa2')]===-0x1){return _0x5befdb;}return this['channel']['noop'](util[_0x198d('0x28')](_0x198d('0xa9'),_0x34d47a));};AGIVertices[_0x198d('0xf')]['mrcprecog']=function(_0xe42969){logger[_0x198d('0x2d')](util['format'](_0x198d('0xaa'),_0xe42969[_0x198d('0x35')]));if(!this[_0x198d('0x81')](_0xe42969['grammar'])){return this[_0x198d('0x34')][_0x198d('0xa7')]('no\x20grammar\x20configured');}var _0x263bd2=_0xe42969[_0x198d('0xab')];if(this[_0x198d('0x81')](_0xe42969[_0x198d('0x73')])){_0x263bd2+=','+_0xe42969[_0x198d('0x73')];}var _0x41cb0f=this[_0x198d('0x34')][_0x198d('0x54')](_0x198d('0xac'),_0x263bd2);if(_0x41cb0f[_0x198d('0xa2')]===-0x1){return _0x41cb0f;}var _0xdfc645=this['getAndSetVariable']('RECOG_CONFIDENCE()',_0x198d('0xad'));if(_0xdfc645[_0x198d('0xa2')]===-0x1){return _0xdfc645;}var _0x1d8a36=this['getAndSetVariable']('RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT');if(_0x1d8a36[_0x198d('0xa2')]===-0x1){return _0x1d8a36;}var _0x55bfbf=this[_0x198d('0xa1')](_0x198d('0xae'),_0x198d('0xaf'));if(_0x55bfbf[_0x198d('0xa2')]===-0x1){return _0x55bfbf;}return this[_0x198d('0x34')]['noop'](util['format'](_0x198d('0xb0'),_0x263bd2));};AGIVertices['prototype'][_0x198d('0x7')]=function(_0x1c6bd7){logger[_0x198d('0x2d')](util[_0x198d('0x28')](_0x198d('0xb1'),_0x1c6bd7['label']));return this[_0x198d('0x34')][_0x198d('0x7')]([_0x1c6bd7[_0x198d('0xb2')],_0x1c6bd7[_0x198d('0xb3')]]);};AGIVertices[_0x198d('0xf')][_0x198d('0xb4')]=function(_0x2c3256){logger[_0x198d('0x2d')](util[_0x198d('0x28')](_0x198d('0xb5'),_0x2c3256['label']));if(this[_0x198d('0x81')](_0x2c3256[_0x198d('0x61')])){logger['info'](util[_0x198d('0x28')](_0x198d('0xb6'),_0x2c3256[_0x198d('0x61')]));var _0xc7dc52=this['channel'][_0x198d('0xb7')](_0x2c3256[_0x198d('0x61')]);if(_0xc7dc52[_0x198d('0xa2')]===-0x1){return _0xc7dc52;}}return this[_0x198d('0x34')]['answer']();};AGIVertices['prototype'][_0x198d('0x47')]=function(_0x5ef5c0){logger['info'](util[_0x198d('0x28')](_0x198d('0xb8'),_0x5ef5c0[_0x198d('0x35')]));if(!this['isConfigured'](_0x5ef5c0['list_id'])){return this[_0x198d('0x34')][_0x198d('0x2b')](_0x5ef5c0,_0x198d('0xb9'));}_0x5ef5c0[_0x198d('0x46')]=moment();if(this[_0x198d('0x81')](_0x5ef5c0[_0x198d('0xba')])){_0x5ef5c0[_0x198d('0x46')]=moment()[_0x198d('0xbb')](_0x5ef5c0[_0x198d('0xba')],_0x198d('0xbc'));}if(!this['isConfigured'](_0x5ef5c0[_0x198d('0x49')])){_0x5ef5c0[_0x198d('0x49')]=0x2;}this[_0x198d('0x40')][_0x198d('0x6a')](this,_0x5ef5c0);return this['channel'][_0x198d('0xa7')](util['format'](_0x198d('0xbd'),_0x5ef5c0['phone'],_0x5ef5c0['list_id'],_0x5ef5c0[_0x198d('0x46')]));};AGIVertices['prototype']['custom_app']=function(_0x80aa6b){logger[_0x198d('0x2d')](util[_0x198d('0x28')]('Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block',_0x80aa6b[_0x198d('0x35')]));var _0x8b0757=this[_0x198d('0x34')][_0x198d('0x54')](_0x80aa6b[_0x198d('0xbe')],_0x80aa6b['options']);if(_0x8b0757[_0x198d('0xa2')]===-0x1){return _0x8b0757;}return this[_0x198d('0x34')][_0x198d('0xa7')](util['format'](_0x198d('0xbf'),_0x80aa6b[_0x198d('0xbe')],_0x80aa6b[_0x198d('0x73')]));};AGIVertices['prototype'][_0x198d('0xc0')]=function(_0x543325){logger['info'](util[_0x198d('0x28')](_0x198d('0xc1'),_0x543325[_0x198d('0x35')]));if(!this[_0x198d('0x81')](_0x543325['text'])){return this['channel'][_0x198d('0xa7')](_0x198d('0xc2'));}var _0x30e8d2='\x22'+_0x543325[_0x198d('0x59')]+'\x22';if(this[_0x198d('0x81')](_0x543325[_0x198d('0x73')])){_0x30e8d2+=','+_0x543325[_0x198d('0x73')];}var _0x5ecdec=this['channel'][_0x198d('0x54')](_0x198d('0xa8'),_0x30e8d2);if(_0x5ecdec['result']===-0x1){return _0x5ecdec;}return this[_0x198d('0x34')][_0x198d('0xa7')](util[_0x198d('0x28')](_0x198d('0xa9'),_0x30e8d2));};AGIVertices[_0x198d('0xf')][_0x198d('0xc3')]=function(_0x4e4cdd){logger['info'](util[_0x198d('0x28')](_0x198d('0xc4'),_0x4e4cdd[_0x198d('0x35')]));if(!this[_0x198d('0x81')](_0x4e4cdd[_0x198d('0x59')])){return this['channel'][_0x198d('0xa7')](_0x198d('0xc2'));}var _0x36d168='\x22'+_0x4e4cdd[_0x198d('0x59')]+'\x22';if(this[_0x198d('0x81')](_0x4e4cdd[_0x198d('0x73')])){_0x36d168+=','+_0x4e4cdd[_0x198d('0x73')];}var _0x294ffa=this[_0x198d('0x34')]['exec'](_0x198d('0xa8'),_0x36d168);if(_0x294ffa[_0x198d('0xa2')]===-0x1){return _0x294ffa;}return this[_0x198d('0x34')][_0x198d('0xa7')](util[_0x198d('0x28')]('Executed\x20command\x20MRCPSynth\x20%s',_0x36d168));};AGIVertices[_0x198d('0xf')]['lumenvoxasr']=function(_0x521c3e){logger[_0x198d('0x2d')](util['format'](_0x198d('0xc5'),_0x521c3e['label']));if(!this[_0x198d('0x81')](_0x521c3e['grammar'])){return this[_0x198d('0x34')]['noop'](_0x198d('0xc6'));}var _0x1dfbbd=_0x521c3e[_0x198d('0xab')];if(this['isConfigured'](_0x521c3e[_0x198d('0x73')])){_0x1dfbbd+=','+_0x521c3e['options'];}var _0x36d0c5=this[_0x198d('0x34')]['exec'](_0x198d('0xac'),_0x1dfbbd);if(_0x36d0c5[_0x198d('0xa2')]===-0x1){return _0x36d0c5;}var _0x3e1da5=this['getAndSetVariable'](_0x198d('0xc7'),_0x198d('0xc8'));if(_0x3e1da5['result']===-0x1){return _0x3e1da5;}var _0x8dcf39=this[_0x198d('0xa1')](_0x198d('0xc9'),_0x198d('0xca'));if(_0x8dcf39[_0x198d('0xa2')]===-0x1){return _0x8dcf39;}var _0x363557=this[_0x198d('0xa1')]('RECOG_INSTANCE()','LUMENVOX_ASR_INSTANCE');if(_0x363557[_0x198d('0xa2')]===-0x1){return _0x363557;}return this[_0x198d('0x34')][_0x198d('0xa7')](util[_0x198d('0x28')](_0x198d('0xb0'),_0x1dfbbd));};AGIVertices[_0x198d('0xf')]['sestekasr']=function(_0x1ebc16){logger['info'](util[_0x198d('0x28')](_0x198d('0xcb'),_0x1ebc16[_0x198d('0x35')]));if(!this['isConfigured'](_0x1ebc16[_0x198d('0xab')])){return this[_0x198d('0x34')][_0x198d('0xa7')]('no\x20grammar\x20configured');}var _0x4f9cd4=_0x1ebc16[_0x198d('0xab')];if(this['isConfigured'](_0x1ebc16[_0x198d('0x73')])){_0x4f9cd4+=','+_0x1ebc16['options'];}var _0x1007e1=this['channel'][_0x198d('0x54')](_0x198d('0xac'),_0x4f9cd4);if(_0x1007e1[_0x198d('0xa2')]===-0x1){return _0x1007e1;}var _0x4fbd28=this[_0x198d('0xa1')](_0x198d('0xc7'),_0x198d('0xcc'));if(_0x4fbd28[_0x198d('0xa2')]===-0x1){return _0x4fbd28;}var _0x335104=this[_0x198d('0xa1')]('RECOG_INPUT()',_0x198d('0xcd'));if(_0x335104['result']===-0x1){return _0x335104;}var _0x35b342=this[_0x198d('0xa1')](_0x198d('0xae'),'SESTEK_ASR_INSTANCE');if(_0x35b342[_0x198d('0xa2')]===-0x1){return _0x35b342;}return this[_0x198d('0x34')][_0x198d('0xa7')](util[_0x198d('0x28')](_0x198d('0xb0'),_0x4f9cd4));};AGIVertices[_0x198d('0xf')]['database']=function(_0x3ef101){logger['info'](util[_0x198d('0x28')](_0x198d('0xce'),_0x3ef101[_0x198d('0x35')]));if(!this['isConfigured'](_0x3ef101[_0x198d('0xcf')])){return this[_0x198d('0x34')][_0x198d('0x2b')](_0x3ef101,_0x198d('0xd0'));}var _0x19da2f=this[_0x198d('0xd1')]['sync'](this,_0x3ef101[_0x198d('0xcf')]);if(!_0x19da2f){return this['channel'][_0x198d('0x2b')](_0x3ef101,_0x198d('0xd2'));}if(!this[_0x198d('0x81')](_0x3ef101['query'])){return this['channel'][_0x198d('0x2b')](_0x3ef101,_0x198d('0xd3'));}var _0x4c82c8=_0x3ef101[_0x198d('0xd4')][_0x198d('0xd5')](/(\r\n|\n|\r)/gm,'\x20');this[_0x198d('0x34')]['noop'](util[_0x198d('0x28')]('query:\x20%s',_0x4c82c8));var _0x4ff646=this[_0x198d('0x2a')]['sync'](this,_0x19da2f,_0x4c82c8);this[_0x198d('0x33')][_0x198d('0x6a')](this,_0x3ef101,_0x4c82c8);if(!this[_0x198d('0x81')](_0x3ef101[_0x198d('0xd6')])){return this[_0x198d('0x34')]['noop'](_0x198d('0xd7'));}var _0x3aba6f=this['getVariable']['sync'](this,_0x3ef101[_0x198d('0xd6')]);if(!_0x3aba6f){return this[_0x198d('0x34')]['error'](_0x3ef101,'no\x20variable\x20found');}var _0x143572=this;_0x4ff646[_0x198d('0xd8')](function(_0x1dffe1,_0x365fc2){Object[_0x198d('0xd9')](_0x1dffe1)['forEach'](function(_0x1b70fd){_0x143572[_0x198d('0x34')]['setVariable'](util[_0x198d('0x28')]('%s[%s][%s]',_0x3aba6f,_0x365fc2,_0x1b70fd),_0x1dffe1[_0x1b70fd]);});});this[_0x198d('0x34')][_0x198d('0x9d')](util[_0x198d('0x28')](_0x198d('0xda'),_0x3aba6f),_0x4ff646[_0x198d('0x9e')]);return this['channel']['noop'](util[_0x198d('0x28')]('variable\x20%s\x20set',_0x3aba6f));};AGIVertices['prototype'][_0x198d('0xdb')]=function(_0x4191d3){logger[_0x198d('0xdc')](util[_0x198d('0x28')](_0x198d('0xdd'),_0x4191d3[_0x198d('0x35')]));if(!this['isConfigured'](_0x4191d3[_0x198d('0xde')])){return this[_0x198d('0x34')][_0x198d('0x2b')](_0x4191d3,_0x198d('0xdf'));}var _0x579d6d=this['getUser'][_0x198d('0x6a')](this,_0x4191d3[_0x198d('0xde')]);if(!_0x579d6d){return this[_0x198d('0x34')]['error'](_0x4191d3,_0x198d('0xe0'));}var _0x53ec8f=this['channel'][_0x198d('0x54')](_0x198d('0xe1'),[util[_0x198d('0x28')]('SIP/%s',_0x579d6d),_0x4191d3[_0x198d('0x61')],_0x4191d3[_0x198d('0xe2')],_0x4191d3[_0x198d('0x6d')]]);if(_0x53ec8f[_0x198d('0xa2')]===-0x1){return _0x53ec8f;}return this['channel'][_0x198d('0xa7')](util[_0x198d('0x28')](_0x198d('0xe3'),_0x198d('0xe1')));};AGIVertices['prototype'][_0x198d('0xe4')]=function(_0x589b09){logger[_0x198d('0x2d')](util['format'](_0x198d('0xe5'),_0x589b09[_0x198d('0x35')]));if(!this[_0x198d('0x81')](_0x589b09[_0x198d('0x75')])){return this[_0x198d('0x34')]['noop'](_0x198d('0xe6'));}if(!this[_0x198d('0x81')](_0x589b09[_0x198d('0x59')])){return this[_0x198d('0x34')][_0x198d('0xa7')]('no\x20text\x20configured');}this[_0x198d('0x34')]['bot']=!![];this[_0x198d('0x33')](_0x589b09);this['createSquareMessage'](_0x589b09['text'],'in','','');this[_0x198d('0x34')]['noop'](util[_0x198d('0x28')](_0x198d('0xe7'),_0x589b09[_0x198d('0x59')]));var _0x56b665=this[_0x198d('0x74')][_0x198d('0x6a')](this,_0x589b09);if(_0x56b665){for(var _0x5e4875 in _0x56b665){if(_0x56b665[_0x198d('0x94')](_0x5e4875)){this['channel'][_0x198d('0x9d')](util[_0x198d('0x28')](_0x198d('0xe8'),_0x5e4875[_0x198d('0x65')]()),_0x56b665[_0x5e4875]);}}this[_0x198d('0x3e')](_0x56b665['speech'],'out',_0x198d('0xe4'),'');return this['channel'][_0x198d('0xa7')](util[_0x198d('0x28')](_0x198d('0xe9'),_0x56b665[_0x198d('0xea')]));}return this[_0x198d('0x34')][_0x198d('0x2b')](_0x589b09,'Dialogflow\x20is\x20unreachable');};AGIVertices[_0x198d('0xf')]['dialogflowV2']=function(_0x49ca8e){logger['info'](util[_0x198d('0x28')]('Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block',_0x49ca8e[_0x198d('0x35')]));if(!this[_0x198d('0x81')](_0x49ca8e[_0x198d('0xeb')])){return this[_0x198d('0x34')][_0x198d('0xa7')](_0x198d('0xec'));}if(!this[_0x198d('0x81')](_0x49ca8e['client_email'])){return this['channel'][_0x198d('0xa7')]('no\x20client_email\x20configured');}if(!this[_0x198d('0x81')](_0x49ca8e[_0x198d('0x79')])){return this[_0x198d('0x34')][_0x198d('0xa7')](_0x198d('0xed'));}if(!this[_0x198d('0x81')](_0x49ca8e['dialogflowV2_language'])){return this[_0x198d('0x34')][_0x198d('0xa7')](_0x198d('0xee'));}if(!this['isConfigured'](_0x49ca8e[_0x198d('0x59')])){return this[_0x198d('0x34')][_0x198d('0xa7')](_0x198d('0xc2'));}this[_0x198d('0x34')][_0x198d('0xef')]=!![];this[_0x198d('0x33')](_0x49ca8e);this[_0x198d('0x3e')](_0x49ca8e[_0x198d('0x59')],'in','','');this[_0x198d('0x34')][_0x198d('0xa7')](util[_0x198d('0x28')](_0x198d('0xf0'),_0x49ca8e[_0x198d('0x59')]));var _0x3db80a=this[_0x198d('0x77')][_0x198d('0x6a')](this,_0x49ca8e);if(_0x3db80a){for(var _0x2af329 in _0x3db80a){if(_0x3db80a[_0x198d('0x94')](_0x2af329)){if(_0x2af329!==_0x198d('0xf1')){this[_0x198d('0x34')][_0x198d('0x9d')](util[_0x198d('0x28')](_0x198d('0xe8'),_0x2af329['toUpperCase']()),_0x3db80a[_0x2af329]);}}}this[_0x198d('0x3e')](_0x3db80a[_0x198d('0xea')],_0x198d('0xf2'),_0x198d('0xf3'),_0x3db80a[_0x198d('0xf1')]);return this['channel'][_0x198d('0xa7')](util[_0x198d('0x28')]('DialogflowV2\x20Result\x20%s',_0x3db80a[_0x198d('0xea')]));}return this[_0x198d('0x34')][_0x198d('0x2b')](_0x49ca8e,_0x198d('0xf4'));};AGIVertices[_0x198d('0xf')][_0x198d('0xf5')]=function(_0x41a3b5){logger[_0x198d('0x2d')](util[_0x198d('0x28')]('Enter\x20in\x20SESTEKNDA\x20(%s)\x20block',_0x41a3b5['label']));if(!this[_0x198d('0x81')](_0x41a3b5[_0x198d('0xf6')])){return this[_0x198d('0x34')][_0x198d('0xa7')]('no\x20ndauth\x20url\x20configured');}if(!this[_0x198d('0x81')](_0x41a3b5['username'])){return this[_0x198d('0x34')][_0x198d('0xa7')](_0x198d('0xf7'));}if(!this[_0x198d('0x81')](_0x41a3b5[_0x198d('0xf8')])){return this['channel'][_0x198d('0xa7')]('no\x20password\x20configured');}if(!this[_0x198d('0x81')](_0x41a3b5['ndassistant_url'])){return this[_0x198d('0x34')]['noop'](_0x198d('0xc2'));}this[_0x198d('0x34')][_0x198d('0xef')]=!![];this['createSquareDetailsReport'](_0x41a3b5);this[_0x198d('0x3e')](_0x41a3b5[_0x198d('0x59')],'in','','');this['channel'][_0x198d('0xa7')](util[_0x198d('0x28')]('Trying\x20SestekNDA:\x20%s',_0x41a3b5['text']));var _0x368f36=this[_0x198d('0x7b')][_0x198d('0x6a')](this,_0x41a3b5);if(_0x368f36){for(var _0x53e852 in _0x368f36){if(_0x368f36[_0x198d('0x94')](_0x53e852)){this[_0x198d('0x34')][_0x198d('0x9d')](util[_0x198d('0x28')]('SESTEK_NDA_%s',_0x53e852[_0x198d('0x65')]()),_0x368f36[_0x53e852]);}}this[_0x198d('0x3e')](_0x368f36['speech'],_0x198d('0xf2'),'sesteknda','');if(_0x368f36[_0x198d('0xf9')]){this[_0x198d('0x34')]['noop'](util['format'](_0x198d('0xfa'),_0x368f36['audiofile']));var _0x114603=this[_0x198d('0x34')][_0x198d('0xfb')](_0x368f36['audiofile']);try{fs[_0x198d('0xfc')](_0x368f36[_0x198d('0xf9')]+'.wav');}catch(_0x44dd58){logger[_0x198d('0x2b')](_0x44dd58);}return _0x114603;}else{return this[_0x198d('0x34')][_0x198d('0xa7')](util[_0x198d('0x28')](_0x198d('0xfd'),_0x368f36[_0x198d('0xea')]));}}return this[_0x198d('0x34')][_0x198d('0x2b')](_0x41a3b5,_0x198d('0xfe'));};AGIVertices[_0x198d('0xf')][_0x198d('0xff')]=function(_0x507736){logger[_0x198d('0x2d')](util[_0x198d('0x28')](_0x198d('0x100'),_0x507736[_0x198d('0x35')]));return this[_0x198d('0x34')][_0x198d('0xa7')](_0x198d('0xff'));};AGIVertices[_0x198d('0xf')]['ext_dial']=function(_0x26ff55){logger[_0x198d('0x2d')](util[_0x198d('0x28')](_0x198d('0x101'),_0x26ff55['label']));var _0x5ada51='';if(_0x26ff55['trunk_id']){if(!this[_0x198d('0x81')](_0x26ff55[_0x198d('0x102')])){return this['channel'][_0x198d('0x2b')](_0x26ff55,'no\x20trunk\x20selected');}else{var _0x25749f=parseInt(_0x26ff55[_0x198d('0x102')],0xa);if(isNaN(_0x25749f)){_0x5ada51=_0x26ff55[_0x198d('0x102')];}else{_0x5ada51=this['getTrunk']['sync'](this,_0x26ff55[_0x198d('0x102')]);if(!_0x5ada51){return this['channel']['error'](_0x26ff55,_0x198d('0x103'));}}}}else if(_0x26ff55[_0x198d('0x104')]){_0x5ada51=_0x26ff55[_0x198d('0x104')];}else{return this[_0x198d('0x34')]['error'](_0x26ff55,_0x198d('0x105'));}var _0x24135b=this['channel'][_0x198d('0x54')]('DIAL',[util[_0x198d('0x28')](_0x198d('0x106'),_0x5ada51,_0x26ff55[_0x198d('0x44')]),_0x26ff55[_0x198d('0x61')],_0x26ff55[_0x198d('0xe2')],_0x26ff55[_0x198d('0x6d')]]);if(_0x24135b[_0x198d('0xa2')]===-0x1){return _0x24135b;}return this[_0x198d('0x34')][_0x198d('0xa7')](util[_0x198d('0x28')](_0x198d('0xe3'),_0x198d('0xe1')));};AGIVertices[_0x198d('0xf')][_0x198d('0x107')]=function(_0x24d0a1){logger[_0x198d('0x2d')](util[_0x198d('0x28')](_0x198d('0x108'),_0x24d0a1[_0x198d('0x35')]));return this[_0x198d('0x34')][_0x198d('0xa7')]('finally');};AGIVertices[_0x198d('0xf')][_0x198d('0x109')]=function(_0xa52d20){logger[_0x198d('0x2d')](util['format'](_0x198d('0x10a'),_0xa52d20[_0x198d('0x35')]));if(_0xa52d20[_0x198d('0xa4')]===0x0){return this[_0x198d('0xa5')](_0xa52d20);}_0xa52d20[_0x198d('0xa4')]-=0x1;if(!this[_0x198d('0x81')](_0xa52d20[_0x198d('0x10b')])){return this['channel'][_0x198d('0x2b')](_0xa52d20,'no\x20file\x20audio\x20selected');}var _0x5f3614=this[_0x198d('0x1d')]['sync'](this,_0xa52d20[_0x198d('0x10b')]);if(!_0x5f3614){return this[_0x198d('0x34')][_0x198d('0x2b')](_0xa52d20,'no\x20file\x20audio\x20found');}if(!this[_0x198d('0x81')](_0xa52d20[_0x198d('0xd6')])){return this[_0x198d('0x34')][_0x198d('0x2b')](_0x198d('0xd7'));}var _0x161621=this['channel'][_0x198d('0x10c')](_0x5f3614,_0xa52d20[_0x198d('0x10d')],_0xa52d20[_0x198d('0x10e')]);var _0x116f52=_0x161621[_0x198d('0xa2')]?_0x161621[_0x198d('0xa2')]['toString']():'';logger['info'](_0x198d('0x10f'),JSON[_0x198d('0x6e')](_0x161621));if(_0x161621['result']===-0x1){this[_0x198d('0x33')]['sync'](this,_0xa52d20,_0x116f52);return _0x161621;}else if(_0x161621[_0x198d('0xa0')]===_0x198d('0x61')){_0x161621[_0x198d('0xa2')]=_0x116f52['length']>=parseInt(_0xa52d20[_0x198d('0x110')])?'x':'i';}else{_0x161621[_0x198d('0xa2')]=_0x116f52['length']>=parseInt(_0xa52d20[_0x198d('0x110')])&&_0x116f52['length']<=parseInt(_0xa52d20[_0x198d('0x10e')])?'x':'i';}var _0x31a73c=this[_0x198d('0x10')][_0x198d('0x6a')](this,_0xa52d20[_0x198d('0xd6')]);if(!_0x31a73c){return this[_0x198d('0x34')]['error'](_0xa52d20,_0x198d('0x111'));}this['channel']['setVariable'](_0x31a73c,_0x116f52);if(this[_0x198d('0x81')](_0xa52d20[_0x198d('0x112')])){var _0x2e61c7=parseInt(_0xa52d20['hiddendigitsnum'],0xa);var _0x1764f2=rs[_0x198d('0x113')]({'charset':'*','length':_0x2e61c7});var _0x1840f7=_0x116f52[_0x198d('0x9e')];if(_0x1840f7>0x0){if(_0x1840f7>_0x2e61c7){this['createSquareDetailsReport'][_0x198d('0x6a')](this,_0xa52d20,_0xa52d20[_0x198d('0x114')]===_0x198d('0x115')?_0x1764f2+_0x116f52[_0x198d('0x116')](_0x2e61c7):_0x116f52[_0x198d('0x116')](0x0,_0x1840f7-_0x2e61c7)+_0x1764f2);}else{this[_0x198d('0x33')]['sync'](this,_0xa52d20,rs[_0x198d('0x113')]({'charset':'*','length':_0x1840f7}));}}else{this[_0x198d('0x33')][_0x198d('0x6a')](this,_0xa52d20,'');}}else{this['createSquareDetailsReport'][_0x198d('0x6a')](this,_0xa52d20,_0x116f52);}return _0x161621;};AGIVertices[_0x198d('0xf')][_0x198d('0x117')]=function(_0x4058fe){logger[_0x198d('0x2d')](util['format'](_0x198d('0x118'),_0x4058fe[_0x198d('0x35')]));return this[_0x198d('0x109')](_0x4058fe);};AGIVertices[_0x198d('0xf')][_0x198d('0x119')]=function(_0x4ca0d){logger[_0x198d('0x2d')](util[_0x198d('0x28')](_0x198d('0x11a'),_0x4ca0d[_0x198d('0x35')]));this[_0x198d('0x33')]['sync'](this,_0x4ca0d,_0x4ca0d[_0x198d('0x11b')]);return this[_0x198d('0x34')][_0x198d('0xa7')](util[_0x198d('0x28')]('GOAL\x20%s',_0x4ca0d[_0x198d('0x11b')]));};AGIVertices[_0x198d('0xf')]['awspolly']=function(_0x5277ad){logger[_0x198d('0x2d')](util[_0x198d('0x28')](_0x198d('0x11c'),_0x5277ad['label']));if(!this[_0x198d('0x81')](_0x5277ad[_0x198d('0x84')])||!this['isConfigured'](_0x5277ad['aws_secret_access_key'])){return this['channel'][_0x198d('0xa7')](_0x198d('0x11d'));}if(!this[_0x198d('0x81')](_0x5277ad[_0x198d('0x59')])){return this[_0x198d('0x34')][_0x198d('0xa7')]('no\x20text\x20configured');}this[_0x198d('0x34')]['noop'](util[_0x198d('0x28')](_0x198d('0x11e'),_0x5277ad[_0x198d('0x59')]));var _0x1a30bb=this[_0x198d('0x83')]['sync'](this,_0x5277ad);if(_0x1a30bb){this['channel'][_0x198d('0xa7')](util[_0x198d('0x28')](_0x198d('0x11f'),_0x1a30bb));var _0x1f051f=this[_0x198d('0x34')][_0x198d('0xfb')](_0x1a30bb);try{fs[_0x198d('0xfc')](_0x1a30bb+_0x198d('0x120'));}catch(_0x1c8459){logger['error'](_0x1c8459);}return _0x1f051f;}return this['channel'][_0x198d('0x2b')](_0x5277ad,_0x198d('0x121'));};AGIVertices[_0x198d('0xf')]['awslex']=function(_0x13331){logger[_0x198d('0x2d')](util[_0x198d('0x28')]('Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block',_0x13331[_0x198d('0x35')]));if(!this[_0x198d('0x81')](_0x13331[_0x198d('0x84')])||!this[_0x198d('0x81')](_0x13331[_0x198d('0x85')])){return this['channel'][_0x198d('0xa7')](_0x198d('0x11d'));}if(!this['isConfigured'](_0x13331[_0x198d('0x122')])){return this[_0x198d('0x34')]['noop'](_0x198d('0x123'));}if(!this['isConfigured'](_0x13331[_0x198d('0x59')])){return this[_0x198d('0x34')][_0x198d('0xa7')](_0x198d('0xc2'));}this[_0x198d('0x34')][_0x198d('0xef')]=!![];this['createSquareDetailsReport'](_0x13331);this[_0x198d('0x3e')](_0x13331[_0x198d('0x59')],'in','','');this[_0x198d('0x34')]['noop'](util['format'](_0x198d('0x124'),_0x13331[_0x198d('0x59')]));var _0x3bd5ed=this[_0x198d('0x8a')][_0x198d('0x6a')](this,_0x13331);if(_0x3bd5ed){for(var _0x13092b in _0x3bd5ed){if(_0x3bd5ed[_0x198d('0x94')](_0x13092b)&&_[_0x198d('0x95')](_0x3bd5ed[_0x13092b])){this[_0x198d('0x34')]['setVariable'](util[_0x198d('0x28')](_0x198d('0x125'),_0x13092b[_0x198d('0x65')]()),_0x3bd5ed[_0x13092b]);}}if(_[_0x198d('0x41')](_0x3bd5ed['message'])){return this[_0x198d('0x34')][_0x198d('0xa7')](_0x198d('0x126'));}else{this[_0x198d('0x3e')](_0x3bd5ed['message'],_0x198d('0xf2'),'amazonlex','');return this[_0x198d('0x34')][_0x198d('0xa7')](util[_0x198d('0x28')](_0x198d('0x127'),_0x3bd5ed['message']));}}return this[_0x198d('0x34')][_0x198d('0x2b')](_0x13331,'Amazon\x20Lex\x20is\x20unreachable');};AGIVertices[_0x198d('0xf')][_0x198d('0x128')]=function(_0x139d71){logger[_0x198d('0x2d')](util[_0x198d('0x28')](_0x198d('0x129'),_0x139d71[_0x198d('0x35')],_0x139d71[_0x198d('0x61')]));if(!this['isConfigured'](_0x139d71['key'])){return this[_0x198d('0x34')]['noop'](_0x198d('0xe6'));}var _0x27cb65=_0x198d('0x12a');var _0xaf04c4=util[_0x198d('0x28')](_0x198d('0x12b'),FILES_PATH,rs[_0x198d('0x113')](0x4));var _0xb949d5=util[_0x198d('0x28')]('%s.%s',_0xaf04c4,_0x27cb65);var _0x4294db=!![];if(_0x139d71[_0x198d('0x12c')]==='NOBEEP'){_0x4294db=![];}var _0x552ff6=this['channel'][_0x198d('0x12d')](_0xaf04c4,_0x27cb65,_0x139d71[_0x198d('0x12e')],_0x139d71[_0x198d('0x61')],undefined,_0x4294db);if(_0x552ff6[_0x198d('0xa2')]!==-0x1){this[_0x198d('0x34')][_0x198d('0xa7')](util[_0x198d('0x28')](_0x198d('0x12f'),_0xb949d5));var _0x30acc8=this[_0x198d('0x8c')]['sync'](this,_0x139d71,_0xb949d5);if(_0x30acc8){for(var _0x14a74e in _0x30acc8){if(_0x30acc8[_0x198d('0x94')](_0x14a74e)){this['channel']['setVariable'](util[_0x198d('0x28')](_0x198d('0x130'),_0x14a74e['toUpperCase']()),_0x30acc8[_0x14a74e]);}}return this[_0x198d('0x34')][_0x198d('0xa7')](util['format'](_0x198d('0x131'),JSON[_0x198d('0x6e')](_0x30acc8)));}}return _0x552ff6;};AGIVertices['prototype']['tildeasr']=function(_0x4a7cff){logger['info'](util[_0x198d('0x28')]('Enter\x20in\x20TILDEASR\x20(%s)\x20block',_0x4a7cff[_0x198d('0x35')]));if(!this[_0x198d('0x81')](_0x4a7cff[_0x198d('0x8f')])){return this[_0x198d('0x34')][_0x198d('0xa7')]('no\x20appid\x20configured');}if(!this[_0x198d('0x81')](_0x4a7cff[_0x198d('0x90')])){return this[_0x198d('0x34')][_0x198d('0xa7')](_0x198d('0x132'));}var _0x15e002=_0x198d('0x12a');var _0x266a0d=util[_0x198d('0x28')](_0x198d('0x12b'),FILES_PATH,rs[_0x198d('0x113')](0x4));var _0x2a78d0=util[_0x198d('0x28')](_0x198d('0x9b'),_0x266a0d,_0x15e002);var _0x5336cc=!![];if(_0x4a7cff[_0x198d('0x12c')]==='NOBEEP'){_0x5336cc=![];}var _0x2ceb71=this[_0x198d('0x34')][_0x198d('0x12d')](_0x266a0d,_0x15e002,_0x4a7cff['intKey'],_0x4a7cff['timeout'],undefined,_0x5336cc);if(_0x2ceb71[_0x198d('0xa2')]!==-0x1){this['channel'][_0x198d('0xa7')](util[_0x198d('0x28')](_0x198d('0x133'),_0x2a78d0));var _0x22b15b=this[_0x198d('0x8e')][_0x198d('0x6a')](this,_0x4a7cff,_0x2a78d0);if(_0x22b15b){for(var _0x24e282 in _0x22b15b){if(_0x22b15b[_0x198d('0x94')](_0x24e282)){this[_0x198d('0x34')][_0x198d('0x9d')](util[_0x198d('0x28')](_0x198d('0x134'),_0x24e282[_0x198d('0x65')]()),_0x22b15b[_0x24e282]);}}return this[_0x198d('0x34')][_0x198d('0xa7')](util['format']('TildeASR\x20Result\x20%s',JSON[_0x198d('0x6e')](_0x22b15b)));}}return _0x2ceb71;};AGIVertices['prototype']['gotoc']=function(_0x55825e){logger['info'](util[_0x198d('0x28')](_0x198d('0x135'),_0x55825e[_0x198d('0x35')]));return this[_0x198d('0x34')][_0x198d('0x136')](_0x55825e[_0x198d('0x3a')],_0x55825e[_0x198d('0x3b')],_0x55825e['priority']);};AGIVertices[_0x198d('0xf')][_0x198d('0x137')]=function(_0x4265f5){logger[_0x198d('0x2d')](util[_0x198d('0x28')](_0x198d('0x138'),_0x4265f5[_0x198d('0x35')]));if(!this['isConfigured'](_0x4265f5[_0x198d('0x139')])){return this[_0x198d('0x34')][_0x198d('0x2b')](_0x4265f5,_0x198d('0x13a'));}try{var _0x396119=eval(_0x4265f5[_0x198d('0x139')])?'true':_0x198d('0x13b');this[_0x198d('0x34')][_0x198d('0xa7')](util[_0x198d('0x28')](_0x198d('0x13c'),_0x4265f5['condition'],_0x396119));return{'code':0xc8,'result':_0x396119};}catch(_0x280c57){return{'code':0xc8,'result':_0x198d('0x13b')};}};AGIVertices[_0x198d('0xf')][_0x198d('0x13d')]=function(_0x36d3d3){logger[_0x198d('0x2d')](util[_0x198d('0x28')]('Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block',_0x36d3d3[_0x198d('0x35')]));if(!this[_0x198d('0x81')](_0x36d3d3[_0x198d('0x13e')])){return this[_0x198d('0x34')][_0x198d('0x2b')](_0x36d3d3,_0x198d('0x13f'));}var _0x3aca74=this[_0x198d('0x140')][_0x198d('0x6a')](this,_0x36d3d3[_0x198d('0x13e')]);if(!_0x3aca74){return this[_0x198d('0x34')][_0x198d('0x2b')](_0x36d3d3,_0x198d('0x141'));}for(var _0x51c2ff=0x0;_0x51c2ff<_0x3aca74['length'];_0x51c2ff+=0x1){var _0x321c33=this['channel']['getVariable'](util[_0x198d('0x28')](_0x198d('0x142'),_0x3aca74[_0x51c2ff]));if(_0x321c33[_0x198d('0xa2')]===-0x1){return _0x321c33;}logger['info'](util[_0x198d('0x28')](_0x198d('0x143'),_0x3aca74[_0x51c2ff],_0x321c33['extra']));if(_0x321c33[_0x198d('0xa0')]===_0x198d('0x144')){logger[_0x198d('0x2d')](util[_0x198d('0x28')](_0x198d('0x143'),_0x3aca74[_0x51c2ff],'true'));this[_0x198d('0x34')][_0x198d('0xa7')](util[_0x198d('0x28')]('IFTIME\x20%s\x20%s',_0x3aca74[_0x51c2ff],_0x198d('0x144')));return{'code':0xc8,'result':_0x198d('0x144')};}else{logger[_0x198d('0x2d')](util[_0x198d('0x28')](_0x198d('0x143'),_0x3aca74[_0x51c2ff],_0x198d('0x13b')));this[_0x198d('0x34')][_0x198d('0xa7')](util['format'](_0x198d('0x143'),_0x3aca74[_0x51c2ff],_0x198d('0x13b')));}}return{'code':0xc8,'result':_0x198d('0x13b')};};AGIVertices[_0x198d('0xf')][_0x198d('0x145')]=function(_0x3558e2){logger[_0x198d('0x2d')](util[_0x198d('0x28')](_0x198d('0x146'),_0x3558e2[_0x198d('0x35')]));return this[_0x198d('0x34')]['hangup']();};AGIVertices['prototype'][_0x198d('0x147')]=function(_0x55983c){logger[_0x198d('0x2d')](util['format']('Enter\x20in\x20ISPEECHASR\x20(%s)\x20block',_0x55983c[_0x198d('0x35')]));if(!this[_0x198d('0x81')](_0x55983c[_0x198d('0x75')])){return this[_0x198d('0x34')][_0x198d('0xa7')](_0x198d('0xe6'));}var _0x53274a=_0x198d('0x12a');var _0x3a2b12=util[_0x198d('0x28')](_0x198d('0x12b'),FILES_PATH,rs[_0x198d('0x113')](0x4));var _0x1c618a=util[_0x198d('0x28')]('%s.%s',_0x3a2b12,_0x53274a);var _0x1c8c60=!![];if(_0x55983c[_0x198d('0x12c')]===_0x198d('0x148')){_0x1c8c60=![];}var _0x28fbc0=this[_0x198d('0x34')][_0x198d('0x12d')](_0x3a2b12,_0x53274a,_0x55983c[_0x198d('0x12e')],_0x55983c[_0x198d('0x61')],undefined,_0x1c8c60);if(_0x28fbc0['result']!==-0x1){this[_0x198d('0x34')][_0x198d('0xa7')](util[_0x198d('0x28')]('ispeech\x20%s\x20file\x20created',_0x1c618a));var _0x2fa089=this[_0x198d('0x7f')]['sync'](this,_0x55983c,_0x1c618a);if(_0x2fa089){for(var _0x3b3800 in _0x2fa089){if(_0x2fa089[_0x198d('0x94')](_0x3b3800)){this[_0x198d('0x34')][_0x198d('0x9d')](util['format'](_0x198d('0x149'),_0x3b3800[_0x198d('0x65')]()),_0x2fa089[_0x3b3800]);}}return this[_0x198d('0x34')]['noop'](util[_0x198d('0x28')]('IspeechASR\x20Result\x20%s',JSON[_0x198d('0x6e')](_0x2fa089)));}}return _0x28fbc0;};AGIVertices[_0x198d('0xf')][_0x198d('0x14a')]=function(_0x1418f2){logger[_0x198d('0x2d')](util[_0x198d('0x28')]('Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block',_0x1418f2[_0x198d('0x35')]));if(!this['isConfigured'](_0x1418f2[_0x198d('0x75')])){return this[_0x198d('0x34')][_0x198d('0xa7')]('no\x20key\x20configured');}if(!this[_0x198d('0x81')](_0x1418f2[_0x198d('0x59')])){return this[_0x198d('0x34')][_0x198d('0xa7')]('no\x20text\x20configured');}this[_0x198d('0x34')][_0x198d('0xa7')](util[_0x198d('0x28')](_0x198d('0x14b'),_0x1418f2['text']));var _0x599c1e=this[_0x198d('0x7c')][_0x198d('0x6a')](this,_0x1418f2);if(_0x599c1e){this[_0x198d('0x34')][_0x198d('0xa7')](util[_0x198d('0x28')]('ispeech\x20%s\x20file\x20created',_0x599c1e));var _0x5ba38c=this[_0x198d('0x34')][_0x198d('0xfb')](_0x599c1e,_0x1418f2[_0x198d('0x12e')]);try{fs[_0x198d('0xfc')](_0x599c1e+_0x198d('0x120'));}catch(_0x1f7edf){logger['error'](_0x1f7edf);}return _0x5ba38c;}return this[_0x198d('0x34')][_0x198d('0x2b')](_0x1418f2,_0x198d('0x14c'));};AGIVertices[_0x198d('0xf')][_0x198d('0x14d')]=function(_0x2f0bab){logger[_0x198d('0x2d')](util['format'](_0x198d('0x14e'),_0x2f0bab[_0x198d('0x35')]));if(!this[_0x198d('0x81')](_0x2f0bab['findBy'])){return this[_0x198d('0x34')][_0x198d('0x2b')](_0x2f0bab,'no\x20find\x20by\x20configured');}logger[_0x198d('0x2d')](util[_0x198d('0x28')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this['channel'][_0x198d('0x37')],_0x2f0bab[_0x198d('0x14f')]));var _0x81cdad=this[_0x198d('0x4f')]['sync'](this,_0x2f0bab[_0x198d('0x14f')]);if(_0x81cdad){logger[_0x198d('0x2d')](util[_0x198d('0x28')]('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0x198d('0x37')],_0x2f0bab['findBy']));this['channel'][_0x198d('0xa7')](util[_0x198d('0x28')](_0x198d('0x150'),this[_0x198d('0x34')]['callerid'],_0x2f0bab[_0x198d('0x14f')]));return{'code':0xc8,'result':_0x198d('0x151')};}else{logger[_0x198d('0x2d')](util[_0x198d('0x28')](_0x198d('0x152'),this[_0x198d('0x34')][_0x198d('0x37')],_0x2f0bab['findBy']));this[_0x198d('0x34')][_0x198d('0xa7')](util[_0x198d('0x28')](_0x198d('0x152'),this[_0x198d('0x34')][_0x198d('0x37')],_0x2f0bab[_0x198d('0x14f')]));return{'code':0xc8,'result':_0x198d('0x153')};}};AGIVertices[_0x198d('0xf')][_0x198d('0x154')]=function(_0x592e20){logger[_0x198d('0x2d')](util[_0x198d('0x28')](_0x198d('0x155'),_0x592e20[_0x198d('0x35')]));if(!this[_0x198d('0x81')](_0x592e20[_0x198d('0x14f')])){return this[_0x198d('0x34')][_0x198d('0x2b')](_0x592e20,_0x198d('0x156'));}logger['info'](util['format']('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x198d('0x34')][_0x198d('0x37')],_0x592e20[_0x198d('0x14f')]));var _0x153e58=this[_0x198d('0x4e')][_0x198d('0x6a')](this,_0x592e20[_0x198d('0x14f')]);if(_0x153e58){logger[_0x198d('0x2d')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0x198d('0x34')]['callerid'],_0x592e20['findBy']));this[_0x198d('0x34')][_0x198d('0xa7')](util[_0x198d('0x28')](_0x198d('0x150'),this['channel'][_0x198d('0x37')],_0x592e20[_0x198d('0x14f')]));return{'code':0xc8,'result':_0x198d('0x151')};}else{logger[_0x198d('0x2d')](util[_0x198d('0x28')](_0x198d('0x152'),this['channel'][_0x198d('0x37')],_0x592e20[_0x198d('0x14f')]));this['channel'][_0x198d('0xa7')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x198d('0x34')][_0x198d('0x37')],_0x592e20[_0x198d('0x14f')]));return{'code':0xc8,'result':_0x198d('0x153')};}};AGIVertices['prototype'][_0x198d('0x157')]=function(_0x91d4c4){logger[_0x198d('0x2d')](util[_0x198d('0x28')](_0x198d('0x158'),_0x91d4c4['label']));if(!this['isConfigured'](_0x91d4c4[_0x198d('0x159')])){return this['channel']['error'](_0x91d4c4,'no\x20operation\x20configured');}this[_0x198d('0x34')]['noop'](util['format'](_0x198d('0x15a'),_0x91d4c4[_0x198d('0x159')]));var _0x53508a=eval(_0x91d4c4['operation']);if(!this['isConfigured'](_0x91d4c4['variable_id'])){return this[_0x198d('0x34')][_0x198d('0xa7')](_0x198d('0xd7'));}var _0x1676b5=this[_0x198d('0x10')][_0x198d('0x6a')](this,_0x91d4c4[_0x198d('0xd6')]);if(!_0x1676b5){return this[_0x198d('0x34')]['error'](_0x91d4c4,_0x198d('0x111'));}if(_[_0x198d('0x9c')](_0x53508a)){var _0x1d2df8=this;_0x53508a[_0x198d('0xd8')](function(_0x57c248,_0xb9d24a){_0x1d2df8[_0x198d('0x34')][_0x198d('0x9d')](util[_0x198d('0x28')](_0x198d('0x15b'),_0x1676b5,_0xb9d24a),_0x57c248);});return this[_0x198d('0x34')][_0x198d('0xa7')](util[_0x198d('0x28')](_0x198d('0x15c'),_0x1676b5));}else{return this[_0x198d('0x34')][_0x198d('0x9d')](_0x1676b5,_0x53508a);}};AGIVertices['prototype'][_0x198d('0xc')]=function(_0x1b47f6){logger[_0x198d('0x2d')](util[_0x198d('0x28')](_0x198d('0x15d'),_0x1b47f6[_0x198d('0x35')]));if(_0x1b47f6[_0x198d('0xa4')]===0x0){return this['maxRetry'](_0x1b47f6);}_0x1b47f6[_0x198d('0xa4')]-=0x1;if(!this[_0x198d('0x81')](_0x1b47f6[_0x198d('0x10b')])){return this[_0x198d('0x34')][_0x198d('0x2b')](_0x1b47f6,_0x198d('0x15e'));}var _0x3be77c=this['getSound'][_0x198d('0x6a')](this,_0x1b47f6['file_id']);if(!_0x3be77c){return this[_0x198d('0x34')][_0x198d('0x2b')](_0x1b47f6,_0x198d('0x15f'));}var _0x3ea551=this[_0x198d('0x34')]['getData'](_0x3be77c,_0x1b47f6[_0x198d('0x10d')],_0x1b47f6['digit']);var _0x63a265=_0x3ea551[_0x198d('0xa2')];if(_0x3ea551[_0x198d('0xa2')]===-0x1){this[_0x198d('0x33')][_0x198d('0x6a')](this,_0x1b47f6,'-1');return _0x3ea551;}else if(_0x3ea551[_0x198d('0xa0')]===_0x198d('0x61')){_0x3ea551[_0x198d('0xa2')]=_0x3ea551[_0x198d('0xa2')][_0x198d('0x9e')]>0x0?_0x3ea551['result']:'t';}else if(_[_0x198d('0x42')](_0x3ea551['result'])){_0x3ea551['result']='#';_0x63a265='#';}if(!this['isConfigured'](_0x1b47f6[_0x198d('0xd6')])){this[_0x198d('0x34')][_0x198d('0xa7')](_0x198d('0xd7'));}else{var _0x6f2900=this[_0x198d('0x10')][_0x198d('0x6a')](this,_0x1b47f6[_0x198d('0xd6')]);if(!_0x6f2900){return this['channel'][_0x198d('0x2b')](_0x1b47f6,'no\x20variable\x20found');}this[_0x198d('0x34')][_0x198d('0x9d')](_0x6f2900,_0x63a265);}this['createSquareDetailsReport'][_0x198d('0x6a')](this,_0x1b47f6,_0x63a265);return _0x3ea551;};AGIVertices[_0x198d('0xf')]['noop']=function(_0x168c1e){logger[_0x198d('0x2d')](util[_0x198d('0x28')](_0x198d('0x160'),_0x168c1e[_0x198d('0x35')]));return this['channel'][_0x198d('0xa7')](_0x168c1e[_0x198d('0x161')]||_0x168c1e[_0x198d('0x35')]);};AGIVertices[_0x198d('0xf')][_0x198d('0x162')]=function(_0x467a95){logger['info'](util[_0x198d('0x28')](_0x198d('0x163'),_0x467a95[_0x198d('0x35')]));if(!this['isConfigured'](_0x467a95[_0x198d('0x14f')])){return this[_0x198d('0x34')][_0x198d('0x2b')](_0x467a95,'no\x20find\x20by\x20configured');}logger[_0x198d('0x2d')](util[_0x198d('0x28')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x198d('0x34')][_0x198d('0x37')],_0x467a95[_0x198d('0x14f')]));var _0x1ff291=this['getPause'][_0x198d('0x6a')](this,_0x467a95[_0x198d('0x164')]);var _0x58ed64=this[_0x198d('0x165')]['sync'](this,_0x467a95[_0x198d('0x14f')],_0x1ff291);if(_0x58ed64){logger[_0x198d('0x2d')](util['format'](_0x198d('0x150'),this[_0x198d('0x34')]['callerid'],_0x467a95[_0x198d('0x14f')]));this[_0x198d('0x34')]['noop'](util[_0x198d('0x28')](_0x198d('0x150'),this[_0x198d('0x34')]['callerid'],_0x467a95['findBy']));return{'code':0xc8,'result':_0x198d('0x151')};}else{logger[_0x198d('0x2d')](util[_0x198d('0x28')](_0x198d('0x152'),this['channel'][_0x198d('0x37')],_0x467a95[_0x198d('0x14f')]));this['channel'][_0x198d('0xa7')](util[_0x198d('0x28')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x198d('0x34')][_0x198d('0x37')],_0x467a95[_0x198d('0x14f')]));return{'code':0xc8,'result':_0x198d('0x153')};}};AGIVertices[_0x198d('0xf')][_0x198d('0x166')]=function(_0x3e619e){logger[_0x198d('0x2d')](util[_0x198d('0x28')]('Enter\x20in\x20PLAYBACK\x20(%s)\x20block',_0x3e619e[_0x198d('0x35')]));if(!this['isConfigured'](_0x3e619e[_0x198d('0x10b')])){return this[_0x198d('0x34')][_0x198d('0x2b')](_0x3e619e,'no\x20file\x20audio\x20selected');}var _0x27d003=this[_0x198d('0x1d')]['sync'](this,_0x3e619e['file_id']);if(!_0x27d003){return this[_0x198d('0x34')][_0x198d('0x2b')](_0x3e619e,_0x198d('0x15f'));}var _0x45960d=this[_0x198d('0x34')][_0x198d('0x54')](_0x198d('0x167'),[_0x27d003,_0x3e619e[_0x198d('0xe2')]]);if(_0x45960d['result']===-0x1){return _0x45960d;}return this[_0x198d('0x34')][_0x198d('0xa7')](util[_0x198d('0x28')](_0x198d('0xbf'),'PLAYBACK',_0x27d003));};AGIVertices[_0x198d('0xf')][_0x198d('0x168')]=function(_0xf44280){logger[_0x198d('0x2d')](util[_0x198d('0x28')](_0x198d('0x169'),_0xf44280['label']));if(!this[_0x198d('0x81')](_0xf44280[_0x198d('0x16a')])){return this[_0x198d('0x34')][_0x198d('0x2b')](_0xf44280,_0x198d('0x16b'));}var _0x433e82='';var _0x3fc72a=parseInt(_0xf44280['queue_id'],0xa);if(isNaN(_0x3fc72a)){_0x433e82=_0xf44280[_0x198d('0x16a')];}else{_0x433e82=this[_0x198d('0x16c')][_0x198d('0x6a')](this,_0xf44280[_0x198d('0x16a')]);if(!_0x433e82){return this['channel'][_0x198d('0x2b')](_0xf44280,'no\x20queue\x20found');}}var _0x3445c3='';if(this['isConfigured'](_0xf44280['file_id'])){var _0x58b439=this[_0x198d('0x1d')]['sync'](this,_0xf44280[_0x198d('0x10b')]);if(_0x58b439){_0x3445c3=_0x58b439;}}this['createSquareDetailsReport'][_0x198d('0x6a')](this,_0xf44280,_0x433e82);if(_0xf44280[_0x198d('0xe2')][_0x198d('0x16d')]('x')<0x0){_0xf44280['opts']+='x';}if(_0xf44280['opts'][_0x198d('0x16d')]('X')<0x0){_0xf44280[_0x198d('0xe2')]+='X';}this[_0x198d('0x34')][_0x198d('0x9d')](_0x198d('0x16e'),_0x433e82?_0x433e82[_0x198d('0x16f')]():'');var _0x49564c=this[_0x198d('0x34')]['exec']('QUEUE',[_0x433e82,_0xf44280[_0x198d('0xe2')],_0xf44280[_0x198d('0x6d')],_0x3445c3,_0xf44280[_0x198d('0x61')],_0xf44280['agi'],_0xf44280[_0x198d('0x170')],_0xf44280[_0x198d('0x171')],'',_0xf44280[_0x198d('0x172')]]);if(_0x49564c[_0x198d('0xa2')]===-0x1){return _0x49564c;}return this[_0x198d('0x34')][_0x198d('0xa7')](util['format']('Executed\x20command\x20%s\x20%s','QUEUE',_0x433e82));};AGIVertices[_0x198d('0xf')][_0x198d('0x173')]=function(_0xd6ac69){logger[_0x198d('0x2d')](util[_0x198d('0x28')](_0x198d('0x174'),_0xd6ac69[_0x198d('0x35')]));var _0x48bf46=_0xd6ac69['recordingFormat']||_0x198d('0x12a');var _0x10219e=util[_0x198d('0x28')](_0x198d('0x175'),this['channel'][_0x198d('0x3f')],rs[_0x198d('0x113')](0x5));var _0x4e5e80=util[_0x198d('0x28')](_0x198d('0x176'),FILES_PATH,_0x10219e,_0x48bf46);var _0x2af98d=util[_0x198d('0x28')](_0x198d('0x12b'),FILES_PATH,_0x10219e);this[_0x198d('0x38')]['sync'](this,_0xd6ac69,_0x10219e,_0x4e5e80);this[_0x198d('0x34')]['setVariable'](_0x198d('0x177'),_0x10219e);logger[_0x198d('0x2d')](_0x198d('0x178'),_0x2af98d,_0x48bf46,_0xd6ac69[_0x198d('0x179')],_0xd6ac69[_0x198d('0x61')]);return this[_0x198d('0x34')]['recordFile'](_0x2af98d,_0x48bf46,_0xd6ac69[_0x198d('0x179')],_0xd6ac69[_0x198d('0x61')],undefined,!![]);};AGIVertices['prototype']['restapi']=function(_0x57a4d2){logger[_0x198d('0x2d')](util[_0x198d('0x28')](_0x198d('0x17a'),_0x57a4d2['label']));if(!this[_0x198d('0x81')](_0x57a4d2['url'])){return this['channel'][_0x198d('0xa7')]('no\x20url\x20configured');}var _0x2b645d=this[_0x198d('0x5e')][_0x198d('0x6a')](this,_0x57a4d2);logger[_0x198d('0x2d')](util[_0x198d('0x28')](_0x198d('0x17b'),util[_0x198d('0x17c')](_0x2b645d,{'showHidden':![],'depth':null})));if(!this['isConfigured'](_0x57a4d2[_0x198d('0xd6')])){return this[_0x198d('0x34')]['noop'](_0x198d('0x17d'));}var _0x47dd27=this[_0x198d('0x10')][_0x198d('0x6a')](this,_0x57a4d2['variable_id']);if(!_0x47dd27){return this['channel'][_0x198d('0x2b')](_0x57a4d2,_0x198d('0x111'));}this[_0x198d('0x34')][_0x198d('0x9d')](util[_0x198d('0x28')]('%s_STATUS_CODE',_0x47dd27),_0x2b645d['statusCode']?_0x2b645d[_0x198d('0x71')]:_0x198d('0x17e'));this[_0x198d('0x34')][_0x198d('0x9d')](util['format'](_0x198d('0x17f'),_0x47dd27),_0x2b645d['statusMessage']?_0x2b645d[_0x198d('0x70')]:'OK');if(_0x2b645d[_0x198d('0x66')]){try{this[_0x198d('0x9a')](_0x2b645d[_0x198d('0x66')],_0x47dd27);}catch(_0x23d97a){logger['error'](util[_0x198d('0x28')]('Unable\x20to\x20set\x20result\x20in\x20variable\x20%s',_0x47dd27));}}return this['channel'][_0x198d('0xa7')](util[_0x198d('0x28')]('variable\x20%s\x20set',_0x47dd27));};AGIVertices[_0x198d('0xf')]['saydigits']=function(_0x12a315){logger[_0x198d('0x2d')](util[_0x198d('0x28')](_0x198d('0x180'),_0x12a315[_0x198d('0x35')]));return this['channel'][_0x198d('0x181')](_0x12a315[_0x198d('0x182')]['replace'](/\s+/g,''),_0x12a315[_0x198d('0x179')]);};AGIVertices[_0x198d('0xf')][_0x198d('0x183')]=function(_0x563089){logger['info'](util[_0x198d('0x28')]('Enter\x20in\x20SAYNUMBER\x20(%s)\x20block',_0x563089[_0x198d('0x35')]));return this[_0x198d('0x34')][_0x198d('0x184')](_0x563089[_0x198d('0x60')][_0x198d('0xd5')](/\s+/g,''),_0x563089[_0x198d('0x179')]);};AGIVertices[_0x198d('0xf')][_0x198d('0x185')]=function(_0x28f0c7){logger[_0x198d('0x2d')](util[_0x198d('0x28')](_0x198d('0x186'),_0x28f0c7[_0x198d('0x35')]));return this[_0x198d('0x34')][_0x198d('0x187')](_0x28f0c7[_0x198d('0x59')],_0x28f0c7[_0x198d('0x179')]);};AGIVertices[_0x198d('0xf')][_0x198d('0x188')]=function(_0x43763e){logger[_0x198d('0x2d')](util['format'](_0x198d('0x189'),_0x43763e[_0x198d('0x35')]));if(!this[_0x198d('0x81')](_0x43763e['account_id'])){return this[_0x198d('0x34')][_0x198d('0xa7')]('no\x20mail\x20account\x20configured');}var _0x451ea2=this['getMailAccount']['sync'](this,_0x43763e[_0x198d('0x18a')]);if(!_0x451ea2||!_0x451ea2[_0x198d('0x18b')]){return this['channel'][_0x198d('0x2b')](_0x43763e,_0x198d('0x18c'));}var _0x5a61c9={'from':util[_0x198d('0x28')]('\x22%s\x22\x20<%s>',_0x451ea2[_0x198d('0x13')],_0x451ea2[_0x198d('0x18d')]||_0x451ea2[_0x198d('0x18b')][_0x198d('0x18e')]),'to':_0x43763e['to']||'','cc':_0x43763e['cc']||'','bcc':_0x43763e[_0x198d('0x18f')]||'','subject':_0x43763e[_0x198d('0x190')],'html':_0x43763e[_0x198d('0x59')],'text':_0x43763e['text']};var _0x35b638={'tls':{'rejectUnauthorized':![]}};if(_0x451ea2[_0x198d('0x18b')][_0x198d('0x191')]){_0x35b638[_0x198d('0x191')]=_0x451ea2[_0x198d('0x18b')]['service'];}else{_0x35b638['host']=_0x451ea2[_0x198d('0x18b')][_0x198d('0x192')];_0x35b638[_0x198d('0x193')]=_0x451ea2[_0x198d('0x18b')][_0x198d('0x193')];_0x35b638['secure']=_0x451ea2[_0x198d('0x18b')][_0x198d('0x194')];}if(_0x451ea2[_0x198d('0x18b')][_0x198d('0x195')]){_0x35b638[_0x198d('0x196')]={'user':_0x451ea2['Smtp'][_0x198d('0x18e')],'pass':_0x451ea2[_0x198d('0x18b')]['pass']};}if(this[_0x198d('0x81')](_0x43763e[_0x198d('0x197')])){}logger[_0x198d('0xdc')](_0x198d('0x198'),JSON[_0x198d('0x6e')](_0x5a61c9));this[_0x198d('0x33')][_0x198d('0x6a')](this,_0x43763e,_0x43763e[_0x198d('0x18a')]);this[_0x198d('0x34')]['noop'](util[_0x198d('0x28')]('Trying\x20SendMail\x20with\x20account\x20%s',_0x451ea2[_0x198d('0x13')]));this['sendMailMessage'][_0x198d('0x6a')](this,_0x35b638,_0x5a61c9);return this[_0x198d('0x34')][_0x198d('0xa7')](_0x198d('0x199'));};AGIVertices['prototype'][_0x198d('0x19a')]=function(_0x581f51){logger[_0x198d('0x2d')](util[_0x198d('0x28')](_0x198d('0x19b'),_0x581f51[_0x198d('0x35')]));return this[_0x198d('0x34')][_0x198d('0xa7')](_0x198d('0x19c'));};AGIVertices[_0x198d('0xf')]['sendSMS']=function(_0x19fd0b){logger[_0x198d('0x2d')](util[_0x198d('0x28')](_0x198d('0x19d'),_0x19fd0b['label']));if(!this[_0x198d('0x81')](_0x19fd0b[_0x198d('0x19e')])){return this[_0x198d('0x34')][_0x198d('0xa7')](_0x198d('0x19f'));}var _0x36a45b=this[_0x198d('0x1a0')][_0x198d('0x6a')](this,_0x19fd0b[_0x198d('0x19e')]);if(!_0x36a45b){return this[_0x198d('0x34')][_0x198d('0x2b')](_0x19fd0b,'no\x20sms\x20account\x20found');}var _0x4e7d9b={'body':_0x19fd0b[_0x198d('0x1a1')],'phone':_0x19fd0b['to']||'','SmsAccountId':_0x36a45b['id']};logger[_0x198d('0xdc')](_0x198d('0x1a2'),JSON[_0x198d('0x6e')](_0x4e7d9b));this['createSquareDetailsReport'][_0x198d('0x6a')](this,_0x19fd0b,_0x19fd0b['sms_account_id']);this[_0x198d('0x34')][_0x198d('0xa7')](util[_0x198d('0x28')](_0x198d('0x1a3'),_0x36a45b[_0x198d('0x13')]));this[_0x198d('0x32')][_0x198d('0x6a')](this,_0x4e7d9b);return this[_0x198d('0x34')][_0x198d('0xa7')](_0x198d('0x1a4'));};AGIVertices['prototype'][_0x198d('0x1a5')]=function(_0x27879b){logger[_0x198d('0x2d')](util[_0x198d('0x28')](_0x198d('0x1a6'),_0x27879b[_0x198d('0x35')]));if(!this[_0x198d('0x81')](_0x27879b[_0x198d('0xd6')])){return this[_0x198d('0x34')][_0x198d('0x2b')](_0x27879b,_0x198d('0x1a7'));}var _0x100cf4=this[_0x198d('0x10')]['sync'](this,_0x27879b[_0x198d('0xd6')]);if(!_0x100cf4){return this['channel'][_0x198d('0x2b')](_0x27879b,_0x198d('0x111'));}return this[_0x198d('0x34')]['setVariable'](_0x100cf4,_0x27879b[_0x198d('0x1a8')]);};AGIVertices[_0x198d('0xf')][_0x198d('0x1a9')]=function(_0x416340){logger['info'](util[_0x198d('0x28')]('Enter\x20in\x20START\x20(%s)\x20block',_0x416340[_0x198d('0x35')]));this[_0x198d('0x34')][_0x198d('0xa7')]('START\x20CALLY\x20SQUARE');if(_0x416340[_0x198d('0xb4')]===_0x198d('0x1aa')){this[_0x198d('0x34')]['noop'](_0x198d('0x1ab'));return this[_0x198d('0x34')][_0x198d('0xb4')]();}return this[_0x198d('0x34')]['noop'](_0x198d('0x1ac'));};AGIVertices[_0x198d('0xf')][_0x198d('0x1ad')]=function(_0x30e89e){logger[_0x198d('0x2d')](util[_0x198d('0x28')]('Enter\x20in\x20SUBPROJECT\x20(%s)\x20block',_0x30e89e[_0x198d('0x35')]));if(!this[_0x198d('0x81')](_0x30e89e[_0x198d('0x1ae')])){return this[_0x198d('0x34')][_0x198d('0x2b')](_0x30e89e,'no\x20subproject\x20selected');}var _0x1650e8=this[_0x198d('0x15')][_0x198d('0x6a')](this,_0x30e89e[_0x198d('0x1ae')]);if(!this['isConfigured'](_0x1650e8)){return this[_0x198d('0x34')][_0x198d('0x2b')](_0x30e89e,util[_0x198d('0x28')]('no\x20subproject\x20found\x20with\x20id\x20%d',_0x30e89e['project_id']));}if(_0x1650e8===this[_0x198d('0x34')][_0x198d('0x36')]){return this[_0x198d('0x34')][_0x198d('0x2b')](_0x30e89e,'project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project');}this[_0x198d('0x33')][_0x198d('0x6a')](this,_0x30e89e,_0x1650e8);var _0x31c1c6=this[_0x198d('0x34')][_0x198d('0x54')](_0x198d('0x1af'),util[_0x198d('0x28')](_0x198d('0x1b0'),config[_0x198d('0x7')][_0x198d('0x192')]||'127.0.0.1',_0x1650e8,this[_0x198d('0x34')][_0x198d('0x36')]));if(_0x31c1c6[_0x198d('0xa2')]===-0x1){return _0x31c1c6;}return this['channel']['noop'](util['format'](_0x198d('0xbf'),_0x198d('0x1af'),_0x1650e8));};AGIVertices[_0x198d('0xf')][_0x198d('0x1b1')]=function(_0x494aa7){logger[_0x198d('0x2d')](util[_0x198d('0x28')](_0x198d('0x1b2'),_0x494aa7['label']));var _0x37fc93=this['shellCommand'][_0x198d('0x6a')](this,_0x494aa7[_0x198d('0xb2')]);this['createSquareDetailsReport']['sync'](this,_0x494aa7,_0x494aa7['command']);if(this[_0x198d('0x81')](_0x494aa7[_0x198d('0xd6')])){var _0x2a0083=this[_0x198d('0x10')][_0x198d('0x6a')](this,_0x494aa7['variable_id']);if(_0x2a0083){this[_0x198d('0x34')]['setVariable'](_0x2a0083,_0x37fc93);return this[_0x198d('0x34')]['noop'](util[_0x198d('0x28')](_0x198d('0x1b3'),_0x494aa7[_0x198d('0xb2')],_0x2a0083));}}return this['channel'][_0x198d('0xa7')](util['format'](_0x198d('0x1b4'),_0x494aa7[_0x198d('0xb2')]));};AGIVertices[_0x198d('0xf')][_0x198d('0x1b5')]=function(_0x154c29){logger['info'](util[_0x198d('0x28')](_0x198d('0x1b6'),_0x154c29[_0x198d('0x35')]));_0x154c29[_0x198d('0x59')]=_0x154c29[_0x198d('0x59')][_0x198d('0xd5')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x198d('0x81')](_0x154c29[_0x198d('0x57')])){return this[_0x198d('0x34')][_0x198d('0xa7')](_0x198d('0x1b7'));}if(!this[_0x198d('0x81')](_0x154c29[_0x198d('0x59')])){return this[_0x198d('0x34')][_0x198d('0xa7')](_0x198d('0xc2'));}this[_0x198d('0x34')]['noop'](util[_0x198d('0x28')](_0x198d('0x1b8'),_0x154c29['text']));var _0x330826=this[_0x198d('0x56')][_0x198d('0x6a')](this,_0x154c29);if(_0x330826){this[_0x198d('0x34')][_0x198d('0xa7')](util[_0x198d('0x28')](_0x198d('0x1b9'),_0x330826));var _0x2b60d9=this[_0x198d('0x34')][_0x198d('0xfb')](_0x330826);try{fs[_0x198d('0xfc')](_0x330826+'.wav');}catch(_0x14d5ca){logger[_0x198d('0x2b')](_0x14d5ca);}return _0x2b60d9;}return this['channel'][_0x198d('0x2b')](_0x154c29,'Google\x20Cloud\x20TTS\x20is\x20unreachable');};AGIVertices[_0x198d('0xf')][_0x198d('0x1ba')]=function(_0x3aad24){logger[_0x198d('0x2d')](util[_0x198d('0x28')](_0x198d('0x1bb'),_0x3aad24[_0x198d('0x35')]));_0x3aad24['text']=_0x3aad24[_0x198d('0x59')][_0x198d('0xd5')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x3aad24['text'])){return this[_0x198d('0x34')][_0x198d('0xa7')](_0x198d('0xc2'));}this[_0x198d('0x34')]['noop'](util['format'](_0x198d('0x1bc'),_0x3aad24[_0x198d('0x59')]));var _0x5e3772=this[_0x198d('0x1bd')][_0x198d('0x6a')](this,_0x3aad24);if(_0x5e3772){this['channel'][_0x198d('0xa7')](util['format'](_0x198d('0x1be'),_0x5e3772));var _0x1a79ad=this[_0x198d('0x34')][_0x198d('0xfb')](_0x5e3772);try{fs['unlink'](_0x5e3772+_0x198d('0x120'));}catch(_0x23f601){logger[_0x198d('0x2b')](_0x23f601);}return _0x1a79ad;}return this['channel'][_0x198d('0x2b')](_0x3aad24,_0x198d('0x1bf'));};AGIVertices[_0x198d('0xf')][_0x198d('0x1c0')]=function(_0x3a6e61){logger[_0x198d('0x2d')](util[_0x198d('0x28')]('Enter\x20in\x20UNPAUSE\x20(%s)\x20block',_0x3a6e61[_0x198d('0x35')]));if(!this[_0x198d('0x81')](_0x3a6e61['findBy'])){return this[_0x198d('0x34')]['error'](_0x3a6e61,'no\x20find\x20by\x20configured');}logger[_0x198d('0x2d')](util['format'](_0x198d('0x1c1'),this['channel']['callerid'],_0x3a6e61[_0x198d('0x14f')]));var _0x5e9431=this[_0x198d('0x4d')][_0x198d('0x6a')](this,_0x3a6e61['findBy']);if(_0x5e9431){logger['info'](util[_0x198d('0x28')](_0x198d('0x150'),this['channel'][_0x198d('0x37')],_0x3a6e61[_0x198d('0x14f')]));this[_0x198d('0x34')][_0x198d('0xa7')](util[_0x198d('0x28')](_0x198d('0x150'),this[_0x198d('0x34')][_0x198d('0x37')],_0x3a6e61[_0x198d('0x14f')]));return{'code':0xc8,'result':'success'};}else{logger['info'](util[_0x198d('0x28')](_0x198d('0x152'),this['channel']['callerid'],_0x3a6e61[_0x198d('0x14f')]));this[_0x198d('0x34')][_0x198d('0xa7')](util[_0x198d('0x28')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x198d('0x34')]['callerid'],_0x3a6e61[_0x198d('0x14f')]));return{'code':0xc8,'result':_0x198d('0x153')};}};AGIVertices['prototype'][_0x198d('0x1c2')]=function(_0x59e9f3){logger[_0x198d('0x2d')](util[_0x198d('0x28')](_0x198d('0x1c3'),_0x59e9f3[_0x198d('0x35')]));var _0x52eb39=this['channel'][_0x198d('0x54')](_0x198d('0x1c4'),[_0x59e9f3[_0x198d('0x1c5')],_0x59e9f3[_0x198d('0x73')]]);if(_0x52eb39['result']===-0x1){return _0x52eb39;}return this[_0x198d('0x34')][_0x198d('0xa7')](util[_0x198d('0x28')](_0x198d('0xbf'),_0x198d('0x1c4'),_0x59e9f3[_0x198d('0x1c5')]));};AGIVertices[_0x198d('0xf')][_0x198d('0x1c6')]=function(_0x2112ff){logger['info'](util[_0x198d('0x28')](_0x198d('0x1c7'),_0x2112ff[_0x198d('0x35')]));if(!this[_0x198d('0x81')](_0x2112ff['variable_id'])){return this[_0x198d('0x34')][_0x198d('0x2b')](_0x2112ff,_0x198d('0x1a7'));}var _0x188528=this[_0x198d('0x10')][_0x198d('0x6a')](this,_0x2112ff[_0x198d('0xd6')]);if(!_0x188528){return this[_0x198d('0x34')][_0x198d('0x2b')](_0x2112ff,'no\x20variable\x20found');}var _0x39bf8c=this['channel']['getVariable'](_0x188528);return{'code':0xc8,'result':_0x39bf8c['extra']?_0x39bf8c['extra']:'-'};};String[_0x198d('0xf')][_0x198d('0x9f')]=function(_0x34ddd5,_0x5b7830){return this['split'](_0x34ddd5)['join'](_0x5b7830);};module[_0x198d('0x1c8')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index 0c23bbf..880ed5e 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 _0xe076=['moment','../ami','../../../config/logger','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','agentconnect','syncAgentConnect','bind','hanguprequest','syncHangupRequest','hangup','agentringnoanswer','attendedtransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','seconds','prototype','startAcw','channels','interface','ACW','name','then','getAgent','info','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','acwTimeout','timer','stopAcw','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','queue','updateAcw','lastPauseAt','update','[%s][UPDATE][ACWTIME:%s]','catch','error','[%s][UPDATE][ERRORS:%s]','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','finally','[ACW][START]\x20%s','message','[%s][TIMER][STOP][AGENT:%s]','[ACW][TIMERS]','stringify','acw','mandatoryDisposition','isUndefined','[%s][HANGUP:UNIQUEID]','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','syncHangup','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','syncAttendedTransfer','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','isNil','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','[%s][BLINDTRANSFER:LINKEDID]','transfererlinkedid','[ACW][syncBlindTransfer]\x20%s','syncAgentRingNoAnswer','autopause','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','util','lodash'];(function(_0x3d92cb,_0x11aa36){var _0x50026d=function(_0x43df54){while(--_0x43df54){_0x3d92cb['push'](_0x3d92cb['shift']());}};_0x50026d(++_0x11aa36);}(_0xe076,0x15e));var _0x6e07=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0xe076[_0x40ac5e];return _0x2839d6;};'use strict';var util=require(_0x6e07('0x0'));var _=require(_0x6e07('0x1'));var moment=require(_0x6e07('0x2'));var ami=require(_0x6e07('0x3'));var logger=require(_0x6e07('0x4'))('acw');var RpcUser=require(_0x6e07('0x5'));var RpcVoiceAgentReport=require(_0x6e07('0x6'));function Acw(_0x507932){this['voiceQueues']=_0x507932[_0x6e07('0x7')];this['agents']=_0x507932[_0x6e07('0x8')];this[_0x6e07('0x9')]=_0x507932[_0x6e07('0x9')];this['channels']={};ami['on'](_0x6e07('0xa'),this[_0x6e07('0xb')][_0x6e07('0xc')](this));ami['on'](_0x6e07('0xd'),this[_0x6e07('0xe')][_0x6e07('0xc')](this));ami['on'](_0x6e07('0xf'),this['syncHangup']['bind'](this));ami['on'](_0x6e07('0x10'),this['syncAgentRingNoAnswer'][_0x6e07('0xc')](this));ami['on'](_0x6e07('0x11'),this['syncAttendedTransfer'][_0x6e07('0xc')](this));ami['on'](_0x6e07('0x12'),this[_0x6e07('0x13')][_0x6e07('0xc')](this));ami['on'](_0x6e07('0x14'),this[_0x6e07('0x15')][_0x6e07('0xc')](this));}function getDiff(_0x3c9094){var _0x1b1ec8=moment()[_0x6e07('0x16')](0x0);var _0x4ce5ae=moment(_0x3c9094)[_0x6e07('0x16')](0x0);return _0x1b1ec8[_0x6e07('0x17')](_0x4ce5ae,_0x6e07('0x18'));}Acw[_0x6e07('0x19')][_0x6e07('0x1a')]=function(_0xe01f85){try{var _0x154372=this;var _0x16c92e=this[_0x6e07('0x1b')][_0xe01f85][_0x6e07('0x1c')];var _0x1b7f8e=this['channels'][_0xe01f85]['queue'];var _0x450459=this[_0x6e07('0x7')][_0x1b7f8e];var _0x15b4e1=![];var _0x47451a=_0x6e07('0x1d');if(_0x450459['mandatoryDisposition']){if(_0x450459['mandatoryDispositionPause'][_0x6e07('0x1e')]){_0x15b4e1=!![];_0x47451a=_0x450459['mandatoryDispositionPause'][_0x6e07('0x1e')];}}ami['Action']({'action':'QueuePause','interface':_0x16c92e,'paused':!![],'reason':_0x47451a})[_0x6e07('0x1f')](function(_0x3ba56a){if(_0x154372[_0x6e07('0x8')][_0x16c92e]){return RpcUser[_0x6e07('0x20')](_0x154372['agents'][_0x16c92e]['id'])[_0x6e07('0x1f')](function(_0x97b90c){if(_0x97b90c&&!_0x97b90c['voicePause']){logger[_0x6e07('0x21')](_0x6e07('0x22'),_0xe01f85,_0x16c92e,_0x1b7f8e);var _0x3bf02a=_0x154372[_0x6e07('0x1b')][_0xe01f85][_0x6e07('0x23')]&&_0x154372[_0x6e07('0x1b')][_0xe01f85][_0x6e07('0x24')]?_0x154372[_0x6e07('0x1b')][_0xe01f85][_0x6e07('0x24')]:_0xe01f85;return RpcUser[_0x6e07('0x25')](_0x154372[_0x6e07('0x8')][_0x16c92e],_0x47451a,_0x3bf02a)['then'](function(_0x3b3dcc){if(!_0x15b4e1){_0x154372[_0x6e07('0x9')][_0x16c92e]={};logger[_0x6e07('0x21')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0xe01f85,_0x154372[_0x6e07('0x7')][_0x1b7f8e][_0x6e07('0x26')],_0x16c92e,_0x1b7f8e);_0x154372[_0x6e07('0x9')][_0x16c92e][_0x6e07('0x27')]=setTimeout(_0x154372[_0x6e07('0x28')]['bind'](_0x154372,_0x16c92e),_0x154372['voiceQueues'][_0x1b7f8e][_0x6e07('0x26')]*0x3e8);_0x154372['timers'][_0x16c92e]['lastPauseAt']=moment()[_0x6e07('0x29')](_0x6e07('0x2a'));_0x154372[_0x6e07('0x9')][_0x16c92e][_0x6e07('0x2b')]=_0xe01f85;_0x154372[_0x6e07('0x9')][_0x16c92e][_0x6e07('0x2c')]=_0x1b7f8e;_0x154372[_0x6e07('0x9')][_0x16c92e][_0x6e07('0x2d')]=function(){var _0xf48a99=getDiff(_0x154372[_0x6e07('0x9')][_0x16c92e][_0x6e07('0x2e')]);clearTimeout(_0x154372[_0x6e07('0x9')][_0x16c92e]['timer']);_0x154372[_0x6e07('0x9')][_0x16c92e][_0x6e07('0x27')]=![];RpcVoiceAgentReport[_0x6e07('0x2f')]({'acwtime':_0xf48a99},_0x154372['timers'][_0x16c92e][_0x6e07('0x2b')],_0x16c92e)[_0x6e07('0x1f')](function(_0x4f2aad){logger['info'](_0x6e07('0x30'),_0xe01f85,_0xf48a99,_0x4f2aad);})[_0x6e07('0x31')](function(_0x28dc98){logger[_0x6e07('0x32')](_0x6e07('0x33'),_0xe01f85,_0x28dc98);});delete _0x154372[_0x6e07('0x9')][_0x16c92e];};}});}else{logger[_0x6e07('0x21')]('[%s][INPAUSE][AGENT:%s][QUEUE:%s]',_0xe01f85,_0x16c92e,_0x1b7f8e);}});}})[_0x6e07('0x31')](function(_0x219bab){logger[_0x6e07('0x32')](_0x6e07('0x34'),_0xe01f85,_0x154372[_0x6e07('0x7')][_0x1b7f8e][_0x6e07('0x26')],_0x16c92e,_0x1b7f8e);})[_0x6e07('0x35')](function(){delete _0x154372['channels'][_0xe01f85];});}catch(_0x5ef2f8){logger[_0x6e07('0x32')](_0x6e07('0x36'),_0x5ef2f8[_0x6e07('0x37')]);}};Acw['prototype'][_0x6e07('0x28')]=function(_0x51d3bc){try{var _0x8e95d6=this;if(_0x8e95d6[_0x6e07('0x9')][_0x51d3bc]){_0x8e95d6[_0x6e07('0x9')][_0x51d3bc][_0x6e07('0x27')]=![];var _0x1fd82e=_0x8e95d6[_0x6e07('0x9')][_0x51d3bc][_0x6e07('0x2b')];var _0x50ac71=_0x8e95d6['timers'][_0x51d3bc][_0x6e07('0x2c')];var _0x557e65=_0x8e95d6['voiceQueues'][_0x50ac71][_0x6e07('0x26')];logger[_0x6e07('0x21')](_0x6e07('0x38'),_0x1fd82e,_0x51d3bc);RpcUser['saveUnpause'](this[_0x6e07('0x8')][_0x51d3bc]);RpcVoiceAgentReport['update']({'acwtime':_0x557e65,'agentacw':!![]},_0x1fd82e,_0x51d3bc)['then'](function(_0x27a0a4){logger[_0x6e07('0x21')](_0x6e07('0x30'),_0x1fd82e,_0x557e65,_0x27a0a4);})[_0x6e07('0x31')](function(_0x1f8099){logger[_0x6e07('0x32')](_0x6e07('0x33'),_0x1fd82e,_0x1f8099);});}else{logger[_0x6e07('0x32')]('[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer',_0x51d3bc);if(_0x8e95d6['timers']){logger[_0x6e07('0x21')](_0x6e07('0x39'),JSON[_0x6e07('0x3a')](_0x8e95d6['timers']));}}}catch(_0x299301){logger[_0x6e07('0x32')]('[ACW][STOP]\x20%s',_0x299301[_0x6e07('0x37')]);}};Acw[_0x6e07('0x19')][_0x6e07('0xb')]=function(_0x415e7e){try{if(this[_0x6e07('0x7')][_0x415e7e[_0x6e07('0x2c')]]&&(this[_0x6e07('0x7')][_0x415e7e['queue']][_0x6e07('0x3b')]||this[_0x6e07('0x7')][_0x415e7e['queue']][_0x6e07('0x3c')])){if(this[_0x6e07('0x8')][_0x415e7e[_0x6e07('0x1c')]]){this[_0x6e07('0x1b')][_0x415e7e['uniqueid']]={'queue':_0x415e7e['queue'],'interface':_0x415e7e[_0x6e07('0x1c')],'destlinkedid':_0x415e7e[_0x6e07('0x24')]};}}}catch(_0x482c1f){logger[_0x6e07('0x32')]('[ACW][syncAgentConnect]\x20%s',_0x482c1f[_0x6e07('0x37')]);}};Acw[_0x6e07('0x19')]['syncAgentConnectPreview']=function(_0xe357f8){try{if(this[_0x6e07('0x7')][_0xe357f8[_0x6e07('0x2c')]]&&(this[_0x6e07('0x7')][_0xe357f8[_0x6e07('0x2c')]][_0x6e07('0x3b')]||this[_0x6e07('0x7')][_0xe357f8[_0x6e07('0x2c')]][_0x6e07('0x3c')])){if(this[_0x6e07('0x8')][_0xe357f8[_0x6e07('0x1c')]]){this['channels'][_0xe357f8[_0x6e07('0x2b')]]={'queue':_0xe357f8[_0x6e07('0x2c')],'interface':_0xe357f8[_0x6e07('0x1c')]};}}}catch(_0x55ab89){logger[_0x6e07('0x32')]('[ACW][syncAgentConnectPreview]\x20%s',_0x55ab89['message']);}};Acw[_0x6e07('0x19')][_0x6e07('0xe')]=function(_0x4c0e55){try{if(this[_0x6e07('0x1b')][_0x4c0e55[_0x6e07('0x2b')]]&&_[_0x6e07('0x3d')](this['channels'][_0x4c0e55[_0x6e07('0x2b')]][_0x6e07('0x23')])){logger['info'](_0x6e07('0x3e'),_0x4c0e55['uniqueid']);this[_0x6e07('0x1a')](_0x4c0e55[_0x6e07('0x2b')]);}else if(this[_0x6e07('0x1b')][_0x4c0e55[_0x6e07('0x3f')]]&&_[_0x6e07('0x3d')](this[_0x6e07('0x1b')][_0x4c0e55[_0x6e07('0x3f')]]['attended'])){logger[_0x6e07('0x21')](_0x6e07('0x40'),_0x4c0e55['linkedid']);this[_0x6e07('0x1a')](_0x4c0e55['linkedid']);}}catch(_0x1eda61){logger[_0x6e07('0x32')](_0x6e07('0x41'),_0x1eda61['message']);}};Acw[_0x6e07('0x19')][_0x6e07('0x42')]=function(_0x4c690a){try{if(this[_0x6e07('0x1b')][_0x4c690a['uniqueid']]&&this[_0x6e07('0x1b')][_0x4c690a[_0x6e07('0x2b')]][_0x6e07('0x23')]){logger[_0x6e07('0x21')](_0x6e07('0x43'),_0x4c690a[_0x6e07('0x2b')]);this['startAcw'](_0x4c690a[_0x6e07('0x2b')]);}else if(this[_0x6e07('0x1b')][_0x4c690a[_0x6e07('0x3f')]]&&this['channels'][_0x4c690a['linkedid']][_0x6e07('0x23')]){logger[_0x6e07('0x21')](_0x6e07('0x44'),_0x4c690a[_0x6e07('0x3f')]);this[_0x6e07('0x1a')](_0x4c690a[_0x6e07('0x3f')]);}}catch(_0x46ef0a){logger[_0x6e07('0x32')](_0x6e07('0x45'),_0x46ef0a[_0x6e07('0x37')]);}};Acw['prototype'][_0x6e07('0x46')]=function(_0x47f6e6){try{if(!_['isNil'](this[_0x6e07('0x1b')][_0x47f6e6[_0x6e07('0x47')]])){this[_0x6e07('0x1a')](_0x47f6e6[_0x6e07('0x47')]);if(this['channels'][_0x47f6e6[_0x6e07('0x48')]]){this['channels'][_0x47f6e6[_0x6e07('0x48')]][_0x6e07('0x23')]=!![];this[_0x6e07('0x1b')][_0x47f6e6[_0x6e07('0x49')]]=this[_0x6e07('0x1b')][_0x47f6e6[_0x6e07('0x48')]];delete this[_0x6e07('0x1b')][_0x47f6e6[_0x6e07('0x48')]];}}else if(!_[_0x6e07('0x4a')](this[_0x6e07('0x1b')][_0x47f6e6[_0x6e07('0x49')]])){this[_0x6e07('0x1a')](_0x47f6e6[_0x6e07('0x49')]);if(this[_0x6e07('0x1b')][_0x47f6e6['origtransfereruniqueid']]){this[_0x6e07('0x1b')][_0x47f6e6[_0x6e07('0x4b')]][_0x6e07('0x23')]=!![];this[_0x6e07('0x1b')][_0x47f6e6[_0x6e07('0x47')]]=this[_0x6e07('0x1b')][_0x47f6e6[_0x6e07('0x4b')]];delete this[_0x6e07('0x1b')][_0x47f6e6['origtransfereruniqueid']];}}}catch(_0x1f41a2){logger[_0x6e07('0x32')](_0x6e07('0x4c'),_0x1f41a2[_0x6e07('0x37')]);}};Acw[_0x6e07('0x19')][_0x6e07('0x13')]=function(_0x3442ab){try{if(this[_0x6e07('0x1b')][_0x3442ab[_0x6e07('0x4d')]]){logger[_0x6e07('0x21')](_0x6e07('0x4e'),JSON[_0x6e07('0x3a')](_0x3442ab[_0x6e07('0x4d')]));this[_0x6e07('0x1a')](_0x3442ab[_0x6e07('0x4d')]);}else if(this[_0x6e07('0x1b')][_0x3442ab['transfererlinkedid']]){logger[_0x6e07('0x21')](_0x6e07('0x4f'),JSON['stringify'](_0x3442ab[_0x6e07('0x50')]));this['startAcw'](_0x3442ab[_0x6e07('0x50')]);}}catch(_0x2c6c9e){logger['error'](_0x6e07('0x51'),_0x2c6c9e['message']);}};Acw['prototype'][_0x6e07('0x52')]=function(_0x220150){try{if(this[_0x6e07('0x7')][_0x220150[_0x6e07('0x2c')]]&&this['voiceQueues'][_0x220150[_0x6e07('0x2c')]][_0x6e07('0x53')]==='all'){if(this[_0x6e07('0x8')][_0x220150['interface']]){logger[_0x6e07('0x21')](_0x6e07('0x54'),_0x220150['uniqueid'],_0x220150[_0x6e07('0x1c')],_0x220150[_0x6e07('0x2c')]);return RpcUser[_0x6e07('0x25')](this[_0x6e07('0x8')][_0x220150[_0x6e07('0x1c')]],_0x6e07('0x55'),_0x220150['uniqueid']);}}}catch(_0x46dc99){logger[_0x6e07('0x32')](_0x6e07('0x56'),_0x46dc99[_0x6e07('0x37')]);}};module[_0x6e07('0x57')]=Acw; \ No newline at end of file +var _0x754f=['timer','[%s][UPDATE][ACWTIME:%s]','catch','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','error','finally','message','stopAcw','[%s][TIMER][STOP][AGENT:%s]','saveUnpause','update','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','uniqueid','destlinkedid','syncAgentConnectPreview','isUndefined','attended','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','prototype','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','isNil','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','syncBlindTransfer','transfereruniqueid','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','exports','util','lodash','moment','../ami','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','timers','channels','agentconnect','syncAgentConnect','bind','hanguprequest','syncHangupRequest','hangup','syncHangup','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','blindtransfer','custom:agentConnectPreview','milliseconds','diff','seconds','startAcw','interface','queue','mandatoryDisposition','mandatoryDispositionPause','name','Action','QueuePause','then','agents','getAgent','voicePause','info','[%s][START][AGENT:%s][QUEUE:%s]','savePause','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','lastPauseAt','YYYY-MM-DD\x20HH:mm:ss','updateAcw'];(function(_0x28832a,_0x426323){var _0x45383a=function(_0x13ee4c){while(--_0x13ee4c){_0x28832a['push'](_0x28832a['shift']());}};_0x45383a(++_0x426323);}(_0x754f,0x7f));var _0xf754=function(_0x1fda2d,_0x37eb81){_0x1fda2d=_0x1fda2d-0x0;var _0x28e556=_0x754f[_0x1fda2d];return _0x28e556;};'use strict';var util=require(_0xf754('0x0'));var _=require(_0xf754('0x1'));var moment=require(_0xf754('0x2'));var ami=require(_0xf754('0x3'));var logger=require('../../../config/logger')(_0xf754('0x4'));var RpcUser=require(_0xf754('0x5'));var RpcVoiceAgentReport=require(_0xf754('0x6'));function Acw(_0x3bebd9){this[_0xf754('0x7')]=_0x3bebd9['voiceQueues'];this['agents']=_0x3bebd9['agents'];this['timers']=_0x3bebd9[_0xf754('0x8')];this[_0xf754('0x9')]={};ami['on'](_0xf754('0xa'),this[_0xf754('0xb')][_0xf754('0xc')](this));ami['on'](_0xf754('0xd'),this[_0xf754('0xe')][_0xf754('0xc')](this));ami['on'](_0xf754('0xf'),this[_0xf754('0x10')][_0xf754('0xc')](this));ami['on']('agentringnoanswer',this[_0xf754('0x11')]['bind'](this));ami['on'](_0xf754('0x12'),this[_0xf754('0x13')]['bind'](this));ami['on'](_0xf754('0x14'),this['syncBlindTransfer'][_0xf754('0xc')](this));ami['on'](_0xf754('0x15'),this['syncAgentConnectPreview'][_0xf754('0xc')](this));}function getDiff(_0x552736){var _0x4c3550=moment()[_0xf754('0x16')](0x0);var _0x352704=moment(_0x552736)[_0xf754('0x16')](0x0);return _0x4c3550[_0xf754('0x17')](_0x352704,_0xf754('0x18'));}Acw['prototype'][_0xf754('0x19')]=function(_0x8b0cc1){try{var _0xaf9f2a=this;var _0x2ffe2b=this['channels'][_0x8b0cc1][_0xf754('0x1a')];var _0x579a6e=this[_0xf754('0x9')][_0x8b0cc1][_0xf754('0x1b')];var _0x3c329d=this['voiceQueues'][_0x579a6e];var _0x2a5347=![];var _0x27ca19='ACW';if(_0x3c329d[_0xf754('0x1c')]){if(_0x3c329d[_0xf754('0x1d')][_0xf754('0x1e')]){_0x2a5347=!![];_0x27ca19=_0x3c329d['mandatoryDispositionPause'][_0xf754('0x1e')];}}ami[_0xf754('0x1f')]({'action':_0xf754('0x20'),'interface':_0x2ffe2b,'paused':!![],'reason':_0x27ca19})[_0xf754('0x21')](function(_0x34b6eb){if(_0xaf9f2a[_0xf754('0x22')][_0x2ffe2b]){return RpcUser[_0xf754('0x23')](_0xaf9f2a[_0xf754('0x22')][_0x2ffe2b]['id'])[_0xf754('0x21')](function(_0x48dda6){if(_0x48dda6&&!_0x48dda6[_0xf754('0x24')]){logger[_0xf754('0x25')](_0xf754('0x26'),_0x8b0cc1,_0x2ffe2b,_0x579a6e);var _0x5e0b82=_0xaf9f2a['channels'][_0x8b0cc1]['attended']&&_0xaf9f2a[_0xf754('0x9')][_0x8b0cc1]['destlinkedid']?_0xaf9f2a[_0xf754('0x9')][_0x8b0cc1]['destlinkedid']:_0x8b0cc1;return RpcUser[_0xf754('0x27')](_0xaf9f2a[_0xf754('0x22')][_0x2ffe2b],_0x27ca19,_0x5e0b82)['then'](function(_0xcfdfd9){if(!_0x2a5347){_0xaf9f2a[_0xf754('0x8')][_0x2ffe2b]={};logger[_0xf754('0x25')](_0xf754('0x28'),_0x8b0cc1,_0xaf9f2a[_0xf754('0x7')][_0x579a6e][_0xf754('0x29')],_0x2ffe2b,_0x579a6e);_0xaf9f2a[_0xf754('0x8')][_0x2ffe2b]['timer']=setTimeout(_0xaf9f2a['stopAcw']['bind'](_0xaf9f2a,_0x2ffe2b),_0xaf9f2a['voiceQueues'][_0x579a6e][_0xf754('0x29')]*0x3e8);_0xaf9f2a['timers'][_0x2ffe2b][_0xf754('0x2a')]=moment()['format'](_0xf754('0x2b'));_0xaf9f2a[_0xf754('0x8')][_0x2ffe2b]['uniqueid']=_0x8b0cc1;_0xaf9f2a['timers'][_0x2ffe2b][_0xf754('0x1b')]=_0x579a6e;_0xaf9f2a['timers'][_0x2ffe2b][_0xf754('0x2c')]=function(){var _0x2eb4e8=getDiff(_0xaf9f2a[_0xf754('0x8')][_0x2ffe2b][_0xf754('0x2a')]);clearTimeout(_0xaf9f2a[_0xf754('0x8')][_0x2ffe2b][_0xf754('0x2d')]);_0xaf9f2a[_0xf754('0x8')][_0x2ffe2b]['timer']=![];RpcVoiceAgentReport['update']({'acwtime':_0x2eb4e8},_0xaf9f2a[_0xf754('0x8')][_0x2ffe2b]['uniqueid'],_0x2ffe2b)[_0xf754('0x21')](function(_0x2c6297){logger[_0xf754('0x25')](_0xf754('0x2e'),_0x8b0cc1,_0x2eb4e8,_0x2c6297);})[_0xf754('0x2f')](function(_0x482c47){logger['error'](_0xf754('0x30'),_0x8b0cc1,_0x482c47);});delete _0xaf9f2a['timers'][_0x2ffe2b];};}});}else{logger['info'](_0xf754('0x31'),_0x8b0cc1,_0x2ffe2b,_0x579a6e);}});}})['catch'](function(_0xd8be62){logger[_0xf754('0x32')](_0xf754('0x28'),_0x8b0cc1,_0xaf9f2a['voiceQueues'][_0x579a6e][_0xf754('0x29')],_0x2ffe2b,_0x579a6e);})[_0xf754('0x33')](function(){delete _0xaf9f2a['channels'][_0x8b0cc1];});}catch(_0x3d9b1c){logger['error']('[ACW][START]\x20%s',_0x3d9b1c[_0xf754('0x34')]);}};Acw['prototype'][_0xf754('0x35')]=function(_0x21eb2d){try{var _0x5404a6=this;if(_0x5404a6[_0xf754('0x8')][_0x21eb2d]){_0x5404a6[_0xf754('0x8')][_0x21eb2d][_0xf754('0x2d')]=![];var _0x4187ed=_0x5404a6[_0xf754('0x8')][_0x21eb2d]['uniqueid'];var _0x2ad467=_0x5404a6[_0xf754('0x8')][_0x21eb2d][_0xf754('0x1b')];var _0x1c0271=_0x5404a6['voiceQueues'][_0x2ad467][_0xf754('0x29')];logger[_0xf754('0x25')](_0xf754('0x36'),_0x4187ed,_0x21eb2d);RpcUser[_0xf754('0x37')](this[_0xf754('0x22')][_0x21eb2d]);RpcVoiceAgentReport[_0xf754('0x38')]({'acwtime':_0x1c0271,'agentacw':!![]},_0x4187ed,_0x21eb2d)[_0xf754('0x21')](function(_0x1faee1){logger['info']('[%s][UPDATE][ACWTIME:%s]',_0x4187ed,_0x1c0271,_0x1faee1);})['catch'](function(_0x8942e6){logger[_0xf754('0x32')](_0xf754('0x30'),_0x4187ed,_0x8942e6);});}else{logger[_0xf754('0x32')]('[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer',_0x21eb2d);if(_0x5404a6[_0xf754('0x8')]){logger[_0xf754('0x25')](_0xf754('0x39'),JSON[_0xf754('0x3a')](_0x5404a6['timers']));}}}catch(_0x2c2cbd){logger[_0xf754('0x32')](_0xf754('0x3b'),_0x2c2cbd[_0xf754('0x34')]);}};Acw['prototype'][_0xf754('0xb')]=function(_0x107964){try{if(this[_0xf754('0x7')][_0x107964[_0xf754('0x1b')]]&&(this[_0xf754('0x7')][_0x107964[_0xf754('0x1b')]][_0xf754('0x4')]||this['voiceQueues'][_0x107964['queue']][_0xf754('0x1c')])){if(this[_0xf754('0x22')][_0x107964[_0xf754('0x1a')]]){this[_0xf754('0x9')][_0x107964[_0xf754('0x3c')]]={'queue':_0x107964[_0xf754('0x1b')],'interface':_0x107964[_0xf754('0x1a')],'destlinkedid':_0x107964[_0xf754('0x3d')]};}}}catch(_0x260d21){logger[_0xf754('0x32')]('[ACW][syncAgentConnect]\x20%s',_0x260d21[_0xf754('0x34')]);}};Acw['prototype'][_0xf754('0x3e')]=function(_0x58f4e8){try{if(this[_0xf754('0x7')][_0x58f4e8['queue']]&&(this['voiceQueues'][_0x58f4e8['queue']][_0xf754('0x4')]||this[_0xf754('0x7')][_0x58f4e8[_0xf754('0x1b')]][_0xf754('0x1c')])){if(this[_0xf754('0x22')][_0x58f4e8[_0xf754('0x1a')]]){this[_0xf754('0x9')][_0x58f4e8[_0xf754('0x3c')]]={'queue':_0x58f4e8[_0xf754('0x1b')],'interface':_0x58f4e8[_0xf754('0x1a')]};}}}catch(_0x3a8abc){logger[_0xf754('0x32')]('[ACW][syncAgentConnectPreview]\x20%s',_0x3a8abc[_0xf754('0x34')]);}};Acw['prototype']['syncHangupRequest']=function(_0xdef842){try{if(this[_0xf754('0x9')][_0xdef842[_0xf754('0x3c')]]&&_[_0xf754('0x3f')](this['channels'][_0xdef842[_0xf754('0x3c')]][_0xf754('0x40')])){logger[_0xf754('0x25')]('[%s][HANGUP:UNIQUEID]',_0xdef842[_0xf754('0x3c')]);this[_0xf754('0x19')](_0xdef842['uniqueid']);}else if(this['channels'][_0xdef842[_0xf754('0x41')]]&&_[_0xf754('0x3f')](this[_0xf754('0x9')][_0xdef842['linkedid']][_0xf754('0x40')])){logger[_0xf754('0x25')](_0xf754('0x42'),_0xdef842[_0xf754('0x41')]);this[_0xf754('0x19')](_0xdef842['linkedid']);}}catch(_0x3ecf29){logger['error'](_0xf754('0x43'),_0x3ecf29[_0xf754('0x34')]);}};Acw['prototype'][_0xf754('0x10')]=function(_0x5a728b){try{if(this['channels'][_0x5a728b[_0xf754('0x3c')]]&&this[_0xf754('0x9')][_0x5a728b[_0xf754('0x3c')]][_0xf754('0x40')]){logger[_0xf754('0x25')]('[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]',_0x5a728b[_0xf754('0x3c')]);this[_0xf754('0x19')](_0x5a728b[_0xf754('0x3c')]);}else if(this[_0xf754('0x9')][_0x5a728b[_0xf754('0x41')]]&&this[_0xf754('0x9')][_0x5a728b['linkedid']]['attended']){logger[_0xf754('0x25')](_0xf754('0x44'),_0x5a728b[_0xf754('0x41')]);this['startAcw'](_0x5a728b[_0xf754('0x41')]);}}catch(_0x852cdf){logger[_0xf754('0x32')](_0xf754('0x45'),_0x852cdf[_0xf754('0x34')]);}};Acw[_0xf754('0x46')]['syncAttendedTransfer']=function(_0x2cbfae){try{if(!_['isNil'](this[_0xf754('0x9')][_0x2cbfae['transfereeuniqueid']])){this[_0xf754('0x19')](_0x2cbfae[_0xf754('0x47')]);if(this[_0xf754('0x9')][_0x2cbfae[_0xf754('0x48')]]){this[_0xf754('0x9')][_0x2cbfae[_0xf754('0x48')]][_0xf754('0x40')]=!![];this['channels'][_0x2cbfae[_0xf754('0x49')]]=this['channels'][_0x2cbfae[_0xf754('0x48')]];delete this[_0xf754('0x9')][_0x2cbfae[_0xf754('0x48')]];}}else if(!_[_0xf754('0x4a')](this[_0xf754('0x9')][_0x2cbfae[_0xf754('0x49')]])){this[_0xf754('0x19')](_0x2cbfae['transfertargetuniqueid']);if(this[_0xf754('0x9')][_0x2cbfae[_0xf754('0x4b')]]){this[_0xf754('0x9')][_0x2cbfae['origtransfereruniqueid']][_0xf754('0x40')]=!![];this['channels'][_0x2cbfae[_0xf754('0x47')]]=this['channels'][_0x2cbfae['origtransfereruniqueid']];delete this['channels'][_0x2cbfae['origtransfereruniqueid']];}}}catch(_0xeb77ae){logger[_0xf754('0x32')](_0xf754('0x4c'),_0xeb77ae[_0xf754('0x34')]);}};Acw[_0xf754('0x46')][_0xf754('0x4d')]=function(_0x3f011d){try{if(this[_0xf754('0x9')][_0x3f011d[_0xf754('0x4e')]]){logger[_0xf754('0x25')]('[%s][BLINDTRANSFER:UNIQUEID]',JSON[_0xf754('0x3a')](_0x3f011d[_0xf754('0x4e')]));this['startAcw'](_0x3f011d[_0xf754('0x4e')]);}else if(this['channels'][_0x3f011d[_0xf754('0x4f')]]){logger[_0xf754('0x25')](_0xf754('0x50'),JSON[_0xf754('0x3a')](_0x3f011d['transfererlinkedid']));this[_0xf754('0x19')](_0x3f011d['transfererlinkedid']);}}catch(_0x3e14e7){logger[_0xf754('0x32')](_0xf754('0x51'),_0x3e14e7[_0xf754('0x34')]);}};Acw[_0xf754('0x46')][_0xf754('0x11')]=function(_0x287ea0){try{if(this[_0xf754('0x7')][_0x287ea0['queue']]&&this[_0xf754('0x7')][_0x287ea0['queue']][_0xf754('0x52')]===_0xf754('0x53')){if(this[_0xf754('0x22')][_0x287ea0[_0xf754('0x1a')]]){logger[_0xf754('0x25')](_0xf754('0x54'),_0x287ea0[_0xf754('0x3c')],_0x287ea0[_0xf754('0x1a')],_0x287ea0[_0xf754('0x1b')]);return RpcUser[_0xf754('0x27')](this[_0xf754('0x22')][_0x287ea0[_0xf754('0x1a')]],'Auto-Pause',_0x287ea0[_0xf754('0x3c')]);}}}catch(_0x5911bc){logger['error']('[ACW][syncAgentRingNoAnswer]\x20%s',_0x5911bc[_0xf754('0x34')]);}};module[_0xf754('0x55')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index d09d033..3df8287 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 _0x2c17=['sipshowregistry','actionDeviceStateList','actionQueueSummary','queuesummary','actionCoreShowChannels','coreshowchannels','info','format','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','resolve','then','catch','log','exports','asterisk-manager','bluebird','util','lodash','../../config/logger','ami','../../config/environment','asterisk','username','password','keepConnected','Action','action','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','error','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','port','actionSipShowRegistry'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x2c17,0x184));var _0x72c1=function(_0x2318a7,_0x290ede){_0x2318a7=_0x2318a7-0x0;var _0x1e1713=_0x2c17[_0x2318a7];return _0x1e1713;};'use strict';var Manager=require(_0x72c1('0x0'));var BPromise=require(_0x72c1('0x1'));var moment=require('moment');var util=require(_0x72c1('0x2'));var _=require(_0x72c1('0x3'));var logger=require(_0x72c1('0x4'))(_0x72c1('0x5'));var config=require(_0x72c1('0x6'));var ami=new Manager(config[_0x72c1('0x7')]['port'],config[_0x72c1('0x7')]['ip'],config['asterisk'][_0x72c1('0x8')],config[_0x72c1('0x7')][_0x72c1('0x9')],!![]);ami[_0x72c1('0xa')]();ami[_0x72c1('0xb')]=BPromise['promisify'](ami[_0x72c1('0xc')]);function error(_0x1b5e6b){logger['error'](util['format'](_0x72c1('0xd'),config[_0x72c1('0x7')]['username'],config[_0x72c1('0x7')]['ip'],config[_0x72c1('0x7')]['port'],util[_0x72c1('0xe')](_0x1b5e6b,![],null)));}function close(){logger[_0x72c1('0xf')](util['format'](_0x72c1('0x10'),config[_0x72c1('0x7')][_0x72c1('0x8')],config['asterisk']['ip'],config[_0x72c1('0x7')][_0x72c1('0x11')]));}ami[_0x72c1('0x12')]=function(){return function(){return ami[_0x72c1('0xb')]({'action':_0x72c1('0x13')});};};ami[_0x72c1('0x14')]=function(){return function(){return ami[_0x72c1('0xb')]({'action':'devicestatelist'});};};ami['actionSipPeerStatus']=function(){return function(){return ami[_0x72c1('0xb')]({'action':'sippeerstatus'});};};ami[_0x72c1('0x15')]=function(){return function(){return ami['Action']({'action':_0x72c1('0x16')});};};ami[_0x72c1('0x17')]=function(){return function(){return ami[_0x72c1('0xb')]({'action':_0x72c1('0x18')});};};function connect(_0x128d17){logger[_0x72c1('0x19')](util[_0x72c1('0x1a')](_0x72c1('0x1b'),config[_0x72c1('0x7')][_0x72c1('0x8')],config[_0x72c1('0x7')]['ip'],config[_0x72c1('0x7')][_0x72c1('0x11')]));ami[_0x72c1('0x1c')](_0x72c1('0xf'),error);ami['once'](_0x72c1('0x1d'),close);}ami['on']('connect',connect);ami['on'](_0x72c1('0x1e'),function(_0x3bc6c5){logger[_0x72c1('0x19')](util[_0x72c1('0x1a')](_0x72c1('0x1f'),config['asterisk'][_0x72c1('0x8')],config[_0x72c1('0x7')]['ip'],config[_0x72c1('0x7')]['port'],util[_0x72c1('0xe')](_0x3bc6c5,![],null)));});ami['on']('fullybooted',function(_0x2e6da3){logger[_0x72c1('0x19')](util[_0x72c1('0x1a')]('Fullybooted\x20\x22%s\x22\x20to\x20%s:%s',config['asterisk']['username'],config[_0x72c1('0x7')]['ip'],config[_0x72c1('0x7')]['port']));return BPromise[_0x72c1('0x20')]()[_0x72c1('0x21')](ami[_0x72c1('0x12')]())[_0x72c1('0x21')](ami['actionDeviceStateList']())[_0x72c1('0x21')](ami['actionSipPeerStatus']())[_0x72c1('0x21')](ami[_0x72c1('0x15')]())[_0x72c1('0x21')](ami[_0x72c1('0x17')]())[_0x72c1('0x22')](function(_0x2f6b07){console[_0x72c1('0x23')](_0x2f6b07);});});ami[_0x72c1('0x1c')]('error',error);ami[_0x72c1('0x1c')]('close',close);module[_0x72c1('0x24')]=ami; \ No newline at end of file +var _0x6b30=['then','catch','log','once','exports','asterisk-manager','bluebird','util','lodash','../../config/logger','../../config/environment','asterisk','port','username','keepConnected','promisify','action','error','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','format','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','Action','sipshowregistry','actionDeviceStateList','devicestatelist','actionSipPeerStatus','sippeerstatus','actionQueueSummary','actionCoreShowChannels','coreshowchannels','info','close','connect','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve'];(function(_0x15ec4e,_0x40b7e0){var _0xb5e5dd=function(_0x42bdd7){while(--_0x42bdd7){_0x15ec4e['push'](_0x15ec4e['shift']());}};_0xb5e5dd(++_0x40b7e0);}(_0x6b30,0x10f));var _0x06b3=function(_0x94dd49,_0x2661bc){_0x94dd49=_0x94dd49-0x0;var _0x44571f=_0x6b30[_0x94dd49];return _0x44571f;};'use strict';var Manager=require(_0x06b3('0x0'));var BPromise=require(_0x06b3('0x1'));var moment=require('moment');var util=require(_0x06b3('0x2'));var _=require(_0x06b3('0x3'));var logger=require(_0x06b3('0x4'))('ami');var config=require(_0x06b3('0x5'));var ami=new Manager(config[_0x06b3('0x6')][_0x06b3('0x7')],config[_0x06b3('0x6')]['ip'],config[_0x06b3('0x6')][_0x06b3('0x8')],config[_0x06b3('0x6')]['password'],!![]);ami[_0x06b3('0x9')]();ami['Action']=BPromise[_0x06b3('0xa')](ami[_0x06b3('0xb')]);function error(_0x1480e0){logger[_0x06b3('0xc')](util['format'](_0x06b3('0xd'),config[_0x06b3('0x6')]['username'],config[_0x06b3('0x6')]['ip'],config[_0x06b3('0x6')][_0x06b3('0x7')],util[_0x06b3('0xe')](_0x1480e0,![],null)));}function close(){logger['error'](util[_0x06b3('0xf')](_0x06b3('0x10'),config[_0x06b3('0x6')][_0x06b3('0x8')],config[_0x06b3('0x6')]['ip'],config[_0x06b3('0x6')][_0x06b3('0x7')]));}ami[_0x06b3('0x11')]=function(){return function(){return ami[_0x06b3('0x12')]({'action':_0x06b3('0x13')});};};ami[_0x06b3('0x14')]=function(){return function(){return ami[_0x06b3('0x12')]({'action':_0x06b3('0x15')});};};ami[_0x06b3('0x16')]=function(){return function(){return ami['Action']({'action':_0x06b3('0x17')});};};ami[_0x06b3('0x18')]=function(){return function(){return ami[_0x06b3('0x12')]({'action':'queuesummary'});};};ami[_0x06b3('0x19')]=function(){return function(){return ami['Action']({'action':_0x06b3('0x1a')});};};function connect(_0xea7a61){logger[_0x06b3('0x1b')](util['format']('Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s',config[_0x06b3('0x6')][_0x06b3('0x8')],config[_0x06b3('0x6')]['ip'],config[_0x06b3('0x6')]['port']));ami['once'](_0x06b3('0xc'),error);ami['once'](_0x06b3('0x1c'),close);}ami['on'](_0x06b3('0x1d'),connect);ami['on']('shutdown',function(_0x41862d){logger[_0x06b3('0x1b')](util[_0x06b3('0xf')](_0x06b3('0x1e'),config[_0x06b3('0x6')]['username'],config[_0x06b3('0x6')]['ip'],config[_0x06b3('0x6')][_0x06b3('0x7')],util[_0x06b3('0xe')](_0x41862d,![],null)));});ami['on']('fullybooted',function(_0x82d8cf){logger[_0x06b3('0x1b')](util[_0x06b3('0xf')](_0x06b3('0x1f'),config[_0x06b3('0x6')]['username'],config[_0x06b3('0x6')]['ip'],config[_0x06b3('0x6')][_0x06b3('0x7')]));return BPromise[_0x06b3('0x20')]()[_0x06b3('0x21')](ami[_0x06b3('0x11')]())['then'](ami[_0x06b3('0x14')]())[_0x06b3('0x21')](ami[_0x06b3('0x16')]())[_0x06b3('0x21')](ami['actionQueueSummary']())[_0x06b3('0x21')](ami[_0x06b3('0x19')]())[_0x06b3('0x22')](function(_0x462402){console[_0x06b3('0x23')](_0x462402);});});ami[_0x06b3('0x24')](_0x06b3('0xc'),error);ami['once']('close',close);module[_0x06b3('0x25')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index 6f30891..92f32e3 100644 --- a/server/services/ami/client.js +++ b/server/services/ami/client.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['result','catch','exports','jayson/promise','bluebird','../../config/logger','http','request','debug','rpc','error','message'];(function(_0x4a209a,_0x575ff9){var _0x4b3c20=function(_0x1a50c1){while(--_0x1a50c1){_0x4a209a['push'](_0x4a209a['shift']());}};_0x4b3c20(++_0x575ff9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xa9e0[_0x376b45];return _0x2341b3;};'use strict';var jayson=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('ami');var client=jayson['client'][_0x0a9e('0x3')]({'port':0x2329});client['Request']=function(_0x333808,_0x432180){return new BPromise(function(_0x2ab90b,_0x991246){return client[_0x0a9e('0x4')](_0x333808,_0x432180)['then'](function(_0x219af0){logger[_0x0a9e('0x5')](_0x0a9e('0x6'),'memberReport',_0x333808,_0x432180,_0x219af0);if(_0x219af0['error']){logger[_0x0a9e('0x7')]('rpc','memberReport',_0x333808,_0x219af0[_0x0a9e('0x7')][_0x0a9e('0x8')],_0x432180);return _0x991246(_0x219af0[_0x0a9e('0x7')][_0x0a9e('0x8')]);}else{return _0x2ab90b(_0x219af0[_0x0a9e('0x9')]);}})[_0x0a9e('0xa')](function(_0x4a4c56){logger['error']('rpc','memberReport',_0x333808,_0x4a4c56,_0x432180);return _0x991246(_0x4a4c56);});});};module[_0x0a9e('0xb')]=client; \ No newline at end of file +var _0xcb91=['request','debug','memberReport','error','rpc','message','result','catch','exports','../../config/logger','ami','client','http'];(function(_0x1ae5ab,_0xc5d441){var _0x1ce001=function(_0x5ef96d){while(--_0x5ef96d){_0x1ae5ab['push'](_0x1ae5ab['shift']());}};_0x1ce001(++_0xc5d441);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x4551f6,_0x48151b){_0x4551f6=_0x4551f6-0x0;var _0x581dc2=_0xcb91[_0x4551f6];return _0x581dc2;};'use strict';var jayson=require('jayson/promise');var BPromise=require('bluebird');var logger=require(_0x1cb9('0x0'))(_0x1cb9('0x1'));var client=jayson[_0x1cb9('0x2')][_0x1cb9('0x3')]({'port':0x2329});client['Request']=function(_0x8c392f,_0x2c17b8){return new BPromise(function(_0x545a34,_0x13d5fd){return client[_0x1cb9('0x4')](_0x8c392f,_0x2c17b8)['then'](function(_0x226b69){logger[_0x1cb9('0x5')]('rpc',_0x1cb9('0x6'),_0x8c392f,_0x2c17b8,_0x226b69);if(_0x226b69[_0x1cb9('0x7')]){logger['error'](_0x1cb9('0x8'),'memberReport',_0x8c392f,_0x226b69['error'][_0x1cb9('0x9')],_0x2c17b8);return _0x13d5fd(_0x226b69[_0x1cb9('0x7')][_0x1cb9('0x9')]);}else{return _0x545a34(_0x226b69[_0x1cb9('0xa')]);}})[_0x1cb9('0xb')](function(_0x50ce71){logger[_0x1cb9('0x7')](_0x1cb9('0x8'),_0x1cb9('0x6'),_0x8c392f,_0x50ce71,_0x2c17b8);return _0x13d5fd(_0x50ce71);});});};module[_0x1cb9('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 4d09e72..64eca21 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 _0x901c=['moment','isNil','string','voiceQueue','uniqueid','Contact','firstName','lastName','phone','name','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ListId','UserId','VoiceQueueId','CampaignId','idHopper','starttime','format','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','getCaller','dialCutDigit','number','substring','prototype','util','lodash'];(function(_0xea8947,_0x1b573d){var _0x2455e9=function(_0x18771e){while(--_0x18771e){_0xea8947['push'](_0xea8947['shift']());}};_0x2455e9(++_0x1b573d);}(_0x901c,0x1cc));var _0xc901=function(_0x36ddd8,_0x1dac4e){_0x36ddd8=_0x36ddd8-0x0;var _0x1b5787=_0x901c[_0x36ddd8];return _0x1b5787;};'use strict';var util=require(_0xc901('0x0'));var _=require(_0xc901('0x1'));var moment=require(_0xc901('0x2'));function checkNameSurname(_0x235c2e,_0xfbae77,_0x407f90){var _0x554f3d='';if(!_[_0xc901('0x3')](_0xfbae77)&&_0xc901('0x4')===typeof _0xfbae77){_0x554f3d+=_0xfbae77;}if(!_[_0xc901('0x3')](_0x407f90)&&'string'===typeof _0x407f90){_0x554f3d+='\x20'+_0x407f90;}if(_0x554f3d!==''){return _0x554f3d;}return _0x235c2e;}function Action(_0x16b6a5,_0xbcc38e,_0x25caf3){this[_0xc901('0x5')]=_0x16b6a5;this[_0xc901('0x6')]=_0x25caf3||undefined;this['name']=checkNameSurname(_0xbcc38e['Contact']['phone'],_0xbcc38e[_0xc901('0x7')][_0xc901('0x8')],_0xbcc38e[_0xc901('0x7')][_0xc901('0x9')]);this['number']=_0xbcc38e[_0xc901('0x7')][_0xc901('0xa')];this['queue']=_0x16b6a5[_0xc901('0xb')];this[_0xc901('0xc')]=_0xbcc38e[_0xc901('0xc')]||![];this[_0xc901('0xd')]=_0x16b6a5[_0xc901('0xd')];this[_0xc901('0xe')]=_0x16b6a5[_0xc901('0xe')]||0x3;this['scheduledat']=_0xbcc38e[_0xc901('0xf')];this[_0xc901('0x10')]=_0xbcc38e[_0xc901('0x10')];this[_0xc901('0x11')]=_0xbcc38e[_0xc901('0x11')];this['countnoanswerretry']=_0xbcc38e[_0xc901('0x12')];this['countnosuchnumberretry']=_0xbcc38e[_0xc901('0x13')];this[_0xc901('0x14')]=_0xbcc38e[_0xc901('0x14')];this[_0xc901('0x15')]=_0xbcc38e[_0xc901('0x15')];this[_0xc901('0x16')]=_0xbcc38e[_0xc901('0x16')];this[_0xc901('0x17')]=_0xbcc38e[_0xc901('0x17')];this['ContactId']=_0xbcc38e['ContactId'];this[_0xc901('0x18')]=_0xbcc38e['ListId'];this[_0xc901('0x19')]=_0xbcc38e[_0xc901('0x19')];this[_0xc901('0x1a')]=_0xbcc38e[_0xc901('0x1a')];this[_0xc901('0x1b')]=_0xbcc38e[_0xc901('0x1b')];this[_0xc901('0x1c')]=_0xbcc38e['id'];this['ContactFirstName']=_0xbcc38e[_0xc901('0x7')]['firstName']||'';this[_0xc901('0x1d')]=moment()[_0xc901('0x1e')]('YYYY-MM-DD\x20HH:mm:ss');this['callback']=_0xbcc38e[_0xc901('0x1f')];this['callbackuniqueid']=_0xbcc38e[_0xc901('0x20')];this[_0xc901('0x21')]=_0xbcc38e['callbackat'];this[_0xc901('0x22')]=_0xbcc38e[_0xc901('0x22')];this[_0xc901('0x23')]='';this[_0xc901('0x24')]='';}Action['prototype'][_0xc901('0x25')]=function(){return util[_0xc901('0x1e')]('\x22%s\x22\x20<%s>',this[_0xc901('0xb')],this[_0xc901('0x5')][_0xc901('0x26')]>0x0?this[_0xc901('0x27')][_0xc901('0x28')](this[_0xc901('0x5')]['dialCutDigit']):this[_0xc901('0x27')]);};Action[_0xc901('0x29')]['getQueue']=function(){return this['queue'];};module['exports']=Action; \ No newline at end of file +var _0x2cc7=['isNil','string','voiceQueue','uniqueid','name','Contact','phone','lastName','number','queue','active','dialQueueTimeout','scheduledat','countbusyretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','firstName','starttime','format','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','prototype','getCaller','dialCutDigit','substring','getQueue','exports','util','lodash','moment'];(function(_0x36c6a0,_0x1e753b){var _0x2af80e=function(_0x584649){while(--_0x584649){_0x36c6a0['push'](_0x36c6a0['shift']());}};_0x2af80e(++_0x1e753b);}(_0x2cc7,0xde));var _0x72cc=function(_0x3e3952,_0x2444bd){_0x3e3952=_0x3e3952-0x0;var _0x4f3a81=_0x2cc7[_0x3e3952];return _0x4f3a81;};'use strict';var util=require(_0x72cc('0x0'));var _=require(_0x72cc('0x1'));var moment=require(_0x72cc('0x2'));function checkNameSurname(_0x3380c4,_0x5a6302,_0x3b1da9){var _0xdf157d='';if(!_[_0x72cc('0x3')](_0x5a6302)&&_0x72cc('0x4')===typeof _0x5a6302){_0xdf157d+=_0x5a6302;}if(!_[_0x72cc('0x3')](_0x3b1da9)&&_0x72cc('0x4')===typeof _0x3b1da9){_0xdf157d+='\x20'+_0x3b1da9;}if(_0xdf157d!==''){return _0xdf157d;}return _0x3380c4;}function Action(_0x59d553,_0x1c197a,_0x2bd149){this[_0x72cc('0x5')]=_0x59d553;this[_0x72cc('0x6')]=_0x2bd149||undefined;this[_0x72cc('0x7')]=checkNameSurname(_0x1c197a[_0x72cc('0x8')][_0x72cc('0x9')],_0x1c197a[_0x72cc('0x8')]['firstName'],_0x1c197a[_0x72cc('0x8')][_0x72cc('0xa')]);this[_0x72cc('0xb')]=_0x1c197a[_0x72cc('0x8')][_0x72cc('0x9')];this[_0x72cc('0xc')]=_0x59d553[_0x72cc('0x7')];this[_0x72cc('0xd')]=_0x1c197a[_0x72cc('0xd')]||![];this['type']=_0x59d553['type'];this[_0x72cc('0xe')]=_0x59d553[_0x72cc('0xe')]||0x3;this[_0x72cc('0xf')]=_0x1c197a[_0x72cc('0xf')];this[_0x72cc('0x10')]=_0x1c197a[_0x72cc('0x10')];this['countcongestionretry']=_0x1c197a['countcongestionretry'];this[_0x72cc('0x11')]=_0x1c197a[_0x72cc('0x11')];this[_0x72cc('0x12')]=_0x1c197a['countnosuchnumberretry'];this[_0x72cc('0x13')]=_0x1c197a[_0x72cc('0x13')];this['countabandonedretry']=_0x1c197a[_0x72cc('0x14')];this[_0x72cc('0x15')]=_0x1c197a['countmachineretry'];this[_0x72cc('0x16')]=_0x1c197a[_0x72cc('0x16')];this[_0x72cc('0x17')]=_0x1c197a[_0x72cc('0x17')];this['ListId']=_0x1c197a[_0x72cc('0x18')];this[_0x72cc('0x19')]=_0x1c197a[_0x72cc('0x19')];this[_0x72cc('0x1a')]=_0x1c197a[_0x72cc('0x1a')];this['CampaignId']=_0x1c197a[_0x72cc('0x1b')];this[_0x72cc('0x1c')]=_0x1c197a['id'];this[_0x72cc('0x1d')]=_0x1c197a[_0x72cc('0x8')][_0x72cc('0x1e')]||'';this[_0x72cc('0x1f')]=moment()[_0x72cc('0x20')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x72cc('0x21')]=_0x1c197a['callback'];this[_0x72cc('0x22')]=_0x1c197a[_0x72cc('0x22')];this['callbackat']=_0x1c197a[_0x72cc('0x23')];this[_0x72cc('0x24')]=_0x1c197a[_0x72cc('0x24')];this[_0x72cc('0x25')]='';this[_0x72cc('0x26')]='';}Action[_0x72cc('0x27')][_0x72cc('0x28')]=function(){return util[_0x72cc('0x20')]('\x22%s\x22\x20<%s>',this[_0x72cc('0x7')],this[_0x72cc('0x5')][_0x72cc('0x29')]>0x0?this[_0x72cc('0xb')][_0x72cc('0x2a')](this['voiceQueue'][_0x72cc('0x29')]):this[_0x72cc('0xb')]);};Action[_0x72cc('0x27')][_0x72cc('0x2b')]=function(){return this['queue'];};module[_0x72cc('0x2c')]=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/agentComplete.js b/server/services/ami/dialer/agentComplete.js index 22e7627..87150ca 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 _0x9281=['calleridnum','responsetime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','starttime','holdtime','talktime','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','uniqueid','calleridname','name'];(function(_0x5225bf,_0x2e76e1){var _0x37339d=function(_0x3801e7){while(--_0x3801e7){_0x5225bf['push'](_0x5225bf['shift']());}};_0x37339d(++_0x2e76e1);}(_0x9281,0x13d));var _0x1928=function(_0x10bc93,_0x3df37a){_0x10bc93=_0x10bc93-0x0;var _0x356940=_0x9281[_0x10bc93];return _0x356940;};'use strict';var util=require(_0x1928('0x0'));var _=require(_0x1928('0x1'));var moment=require(_0x1928('0x2'));function getSeconds(_0x222fa1,_0x1cf008){var _0x5aebe4=moment(_0x222fa1)[_0x1928('0x3')](0x0);var _0x50e3b3=moment(_0x1cf008)[_0x1928('0x3')](0x0);return _0x5aebe4[_0x1928('0x4')](_0x50e3b3,_0x1928('0x5'));}function AgentComplete(_0x2924d6,_0xa68e5){this[_0x1928('0x6')]=0x4;this[_0x1928('0x7')]=_0x1928('0x8');this['scheduledat']=_0x2924d6[_0x1928('0x9')];this[_0x1928('0xa')]=_0x2924d6[_0x1928('0xa')];this[_0x1928('0xb')]=_0x2924d6[_0x1928('0xa')]===_0x1928('0xc')?_0x1928('0xd'):_0x2924d6[_0x1928('0xa')];this[_0x1928('0xe')]=_0x2924d6[_0x1928('0xe')];this[_0x1928('0xf')]=_0x2924d6[_0x1928('0xf')];this[_0x1928('0x10')]=_0x2924d6['countnoanswerretry'];this[_0x1928('0x11')]=_0x2924d6['countbusyretry']+_0x2924d6[_0x1928('0xf')]+_0x2924d6['countnoanswerretry']+_0x2924d6[_0x1928('0x12')]+_0x2924d6[_0x1928('0x13')]+_0x2924d6[_0x1928('0x14')]+_0x2924d6['countmachineretry']+_0x2924d6[_0x1928('0x15')];this['countnosuchnumberretry']=_0x2924d6[_0x1928('0x12')];this[_0x1928('0x13')]=_0x2924d6['countdropretry'];this[_0x1928('0x14')]=_0x2924d6[_0x1928('0x14')];this['countmachineretry']=_0x2924d6[_0x1928('0x16')];this[_0x1928('0x15')]=_0x2924d6[_0x1928('0x15')];this[_0x1928('0x17')]=_0xa68e5[_0x1928('0x17')];this[_0x1928('0x18')]=_0x2924d6[_0x1928('0x19')];this[_0x1928('0x1a')]=_0x2924d6['number'];this['starttime']=_0x2924d6['starttime'];this['responsetime']=_0x2924d6[_0x1928('0x1b')];this[_0x1928('0x1c')]=_0x2924d6[_0x1928('0x1c')];this[_0x1928('0x1d')]=moment()[_0x1928('0x1e')](_0x1928('0x1f'));this[_0x1928('0x20')]=getSeconds(_0x2924d6[_0x1928('0x1b')],_0x2924d6[_0x1928('0x21')]);this[_0x1928('0x22')]=getSeconds(_0x2924d6[_0x1928('0x1c')],_0x2924d6[_0x1928('0x1b')]);this[_0x1928('0x23')]=getSeconds(this[_0x1928('0x1d')],_0x2924d6[_0x1928('0x1c')]);this[_0x1928('0xd')]=_0xa68e5[_0x1928('0xd')];this['membername']=_0xa68e5['membername'];this[_0x1928('0x24')]=_0xa68e5[_0x1928('0x24')];this[_0x1928('0x25')]=_0x2924d6[_0x1928('0x25')];this[_0x1928('0x26')]=_0x2924d6[_0x1928('0x26')];this[_0x1928('0x27')]=_0x2924d6[_0x1928('0x27')];this[_0x1928('0x28')]=_0x2924d6['recallme'];this[_0x1928('0x29')]=_0x2924d6[_0x1928('0x29')];this['ListId']=_0x2924d6[_0x1928('0x2a')];this[_0x1928('0x2b')]=_0x2924d6[_0x1928('0x2b')];this[_0x1928('0x2c')]=_0x2924d6[_0x1928('0x2c')];this[_0x1928('0x2d')]=_0x2924d6[_0x1928('0x2d')];this[_0x1928('0x2e')]=_0x2924d6['originatecalleridnum']||'';this[_0x1928('0x2f')]=_0x2924d6[_0x1928('0x2f')]||'';}module[_0x1928('0x30')]=AgentComplete; \ No newline at end of file +var _0xee42=['starttime','holdtime','talktime','membername','reason','callback','callbackuniqueid','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','lodash','diff','seconds','statedesc','Answer','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','uniqueid','calleridname','name','responsetime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x4a9537,_0x5e4547){var _0x327609=function(_0x5d16de){while(--_0x5d16de){_0x4a9537['push'](_0x4a9537['shift']());}};_0x327609(++_0x5e4547);}(_0xee42,0xe2));var _0x2ee4=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0xee42[_0x2be8c2];return _0x97f531;};'use strict';var util=require('util');var _=require(_0x2ee4('0x0'));var moment=require('moment');function getSeconds(_0x4862b5,_0x314795){var _0x51aa05=moment(_0x4862b5)['milliseconds'](0x0);var _0x1bffae=moment(_0x314795)['milliseconds'](0x0);return _0x51aa05[_0x2ee4('0x1')](_0x1bffae,_0x2ee4('0x2'));}function AgentComplete(_0xf53b77,_0x1cf3c5){this['state']=0x4;this[_0x2ee4('0x3')]=_0x2ee4('0x4');this['scheduledat']=_0xf53b77[_0x2ee4('0x5')];this['type']=_0xf53b77[_0x2ee4('0x6')];this[_0x2ee4('0x7')]=_0xf53b77[_0x2ee4('0x6')]==='outbound'?_0x2ee4('0x8'):_0xf53b77[_0x2ee4('0x6')];this[_0x2ee4('0x9')]=_0xf53b77[_0x2ee4('0x9')];this['countcongestionretry']=_0xf53b77[_0x2ee4('0xa')];this[_0x2ee4('0xb')]=_0xf53b77[_0x2ee4('0xb')];this[_0x2ee4('0xc')]=_0xf53b77['countbusyretry']+_0xf53b77['countcongestionretry']+_0xf53b77[_0x2ee4('0xb')]+_0xf53b77[_0x2ee4('0xd')]+_0xf53b77[_0x2ee4('0xe')]+_0xf53b77[_0x2ee4('0xf')]+_0xf53b77['countmachineretry']+_0xf53b77[_0x2ee4('0x10')];this[_0x2ee4('0xd')]=_0xf53b77[_0x2ee4('0xd')];this[_0x2ee4('0xe')]=_0xf53b77[_0x2ee4('0xe')];this[_0x2ee4('0xf')]=_0xf53b77['countabandonedretry'];this[_0x2ee4('0x11')]=_0xf53b77[_0x2ee4('0x11')];this[_0x2ee4('0x10')]=_0xf53b77['countagentrejectretry'];this[_0x2ee4('0x12')]=_0x1cf3c5[_0x2ee4('0x12')];this[_0x2ee4('0x13')]=_0xf53b77[_0x2ee4('0x14')];this['calleridnum']=_0xf53b77['number'];this['starttime']=_0xf53b77['starttime'];this[_0x2ee4('0x15')]=_0xf53b77[_0x2ee4('0x15')];this[_0x2ee4('0x16')]=_0xf53b77[_0x2ee4('0x16')];this[_0x2ee4('0x17')]=moment()[_0x2ee4('0x18')](_0x2ee4('0x19'));this['ringtime']=getSeconds(_0xf53b77['responsetime'],_0xf53b77[_0x2ee4('0x1a')]);this[_0x2ee4('0x1b')]=getSeconds(_0xf53b77['answertime'],_0xf53b77['responsetime']);this[_0x2ee4('0x1c')]=getSeconds(this[_0x2ee4('0x17')],_0xf53b77[_0x2ee4('0x16')]);this['queue']=_0x1cf3c5[_0x2ee4('0x8')];this['membername']=_0x1cf3c5[_0x2ee4('0x1d')];this[_0x2ee4('0x1e')]=_0x1cf3c5[_0x2ee4('0x1e')];this[_0x2ee4('0x1f')]=_0xf53b77[_0x2ee4('0x1f')];this['callbackuniqueid']=_0xf53b77[_0x2ee4('0x20')];this['callbackat']=_0xf53b77['callbackat'];this[_0x2ee4('0x21')]=_0xf53b77[_0x2ee4('0x21')];this[_0x2ee4('0x22')]=_0xf53b77[_0x2ee4('0x22')];this[_0x2ee4('0x23')]=_0xf53b77[_0x2ee4('0x23')];this[_0x2ee4('0x24')]=_0xf53b77[_0x2ee4('0x24')];this[_0x2ee4('0x25')]=_0xf53b77[_0x2ee4('0x25')];this['CampaignId']=_0xf53b77[_0x2ee4('0x26')];this[_0x2ee4('0x27')]=_0xf53b77[_0x2ee4('0x27')]||'';this[_0x2ee4('0x28')]=_0xf53b77['originatecalleridname']||'';}module[_0x2ee4('0x29')]=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/final.js b/server/services/ami/dialer/final.js index 3fe44a8..2fc0aba 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 _0x84e7=['scheduledat','type','outbound','queue','countcongestionretry','countnoanswerretry','countbusyretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','lodash','moment','milliseconds','diff','seconds','uniqueid'];(function(_0x185e5e,_0x81c63d){var _0xaa0c15=function(_0x360b46){while(--_0x360b46){_0x185e5e['push'](_0x185e5e['shift']());}};_0xaa0c15(++_0x81c63d);}(_0x84e7,0x122));var _0x784e=function(_0x36a865,_0x102382){_0x36a865=_0x36a865-0x0;var _0x215519=_0x84e7[_0x36a865];return _0x215519;};'use strict';var util=require('util');var _=require(_0x784e('0x0'));var moment=require(_0x784e('0x1'));function getSeconds(_0x5861e2,_0x3548d2){var _0x2c1d96=moment(_0x5861e2)['milliseconds'](0x0);var _0x45e3ad=moment(_0x3548d2)[_0x784e('0x2')](0x0);return _0x2c1d96[_0x784e('0x3')](_0x45e3ad,_0x784e('0x4'));}function Final(_0x42993b){this[_0x784e('0x5')]=_0x42993b['uniqueid'];this[_0x784e('0x6')]=_0x42993b['scheduledat'];this[_0x784e('0x7')]=_0x42993b[_0x784e('0x7')];this['campaigntype']=_0x42993b[_0x784e('0x7')]===_0x784e('0x8')?_0x784e('0x9'):_0x42993b[_0x784e('0x7')];this['countbusyretry']=_0x42993b['countbusyretry'];this[_0x784e('0xa')]=_0x42993b[_0x784e('0xa')];this[_0x784e('0xb')]=_0x42993b[_0x784e('0xb')];this['countglobal']=_0x42993b[_0x784e('0xc')]+_0x42993b[_0x784e('0xa')]+_0x42993b[_0x784e('0xb')]+_0x42993b[_0x784e('0xd')]+_0x42993b[_0x784e('0xe')]+_0x42993b[_0x784e('0xf')]+_0x42993b['countmachineretry']+_0x42993b[_0x784e('0x10')];this['countnosuchnumberretry']=_0x42993b[_0x784e('0xd')];this[_0x784e('0xe')]=_0x42993b[_0x784e('0xe')];this[_0x784e('0xf')]=_0x42993b[_0x784e('0xf')];this[_0x784e('0x11')]=_0x42993b[_0x784e('0x11')];this[_0x784e('0x10')]=_0x42993b[_0x784e('0x10')];this['queue']=_0x42993b['queue'];this[_0x784e('0x12')]=_0x42993b[_0x784e('0x12')];this[_0x784e('0x13')]=_0x42993b[_0x784e('0x13')];this[_0x784e('0x14')]=_0x42993b[_0x784e('0x14')];this[_0x784e('0x15')]=_0x42993b['responsetime'];this[_0x784e('0x16')]=_0x42993b[_0x784e('0x15')];this[_0x784e('0x17')]=_0x42993b[_0x784e('0x17')]||0x0;this[_0x784e('0x18')]=_0x42993b[_0x784e('0x18')]||0x0;this[_0x784e('0x19')]=_0x42993b['talktime']||0x0;this['callback']=_0x42993b[_0x784e('0x1a')];this['callbackuniqueid']=_0x42993b[_0x784e('0x1b')];this[_0x784e('0x1c')]=_0x42993b['callbackat'];this['recallme']=_0x42993b[_0x784e('0x1d')];this[_0x784e('0x1e')]=_0x42993b[_0x784e('0x1e')];this[_0x784e('0x1f')]=_0x42993b['ListId'];this['UserId']=_0x42993b['UserId'];this[_0x784e('0x20')]=_0x42993b[_0x784e('0x20')];this['CampaignId']=_0x42993b[_0x784e('0x21')];this['originatecalleridnum']=_0x42993b[_0x784e('0x22')]||'';this['originatecalleridname']=_0x42993b[_0x784e('0x23')]||'';}module[_0x784e('0x24')]=Final; \ No newline at end of file +var _0x1db9=['util','lodash','moment','milliseconds','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','queue','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1db9,0x176));var _0x91db=function(_0x1babbe,_0x44d8e6){_0x1babbe=_0x1babbe-0x0;var _0x28ece1=_0x1db9[_0x1babbe];return _0x28ece1;};'use strict';var util=require(_0x91db('0x0'));var _=require(_0x91db('0x1'));var moment=require(_0x91db('0x2'));function getSeconds(_0x340fb6,_0xcdfaed){var _0xb6de0b=moment(_0x340fb6)['milliseconds'](0x0);var _0x95a17d=moment(_0xcdfaed)[_0x91db('0x3')](0x0);return _0xb6de0b['diff'](_0x95a17d,'seconds');}function Final(_0x379fa9){this['uniqueid']=_0x379fa9['uniqueid'];this[_0x91db('0x4')]=_0x379fa9[_0x91db('0x4')];this[_0x91db('0x5')]=_0x379fa9[_0x91db('0x5')];this[_0x91db('0x6')]=_0x379fa9['type']===_0x91db('0x7')?'queue':_0x379fa9[_0x91db('0x5')];this[_0x91db('0x8')]=_0x379fa9[_0x91db('0x8')];this['countcongestionretry']=_0x379fa9[_0x91db('0x9')];this['countnoanswerretry']=_0x379fa9['countnoanswerretry'];this['countglobal']=_0x379fa9[_0x91db('0x8')]+_0x379fa9[_0x91db('0x9')]+_0x379fa9['countnoanswerretry']+_0x379fa9['countnosuchnumberretry']+_0x379fa9[_0x91db('0xa')]+_0x379fa9[_0x91db('0xb')]+_0x379fa9[_0x91db('0xc')]+_0x379fa9[_0x91db('0xd')];this[_0x91db('0xe')]=_0x379fa9['countnosuchnumberretry'];this[_0x91db('0xa')]=_0x379fa9[_0x91db('0xa')];this[_0x91db('0xb')]=_0x379fa9[_0x91db('0xb')];this[_0x91db('0xc')]=_0x379fa9[_0x91db('0xc')];this[_0x91db('0xd')]=_0x379fa9[_0x91db('0xd')];this[_0x91db('0xf')]=_0x379fa9[_0x91db('0xf')];this[_0x91db('0x10')]=_0x379fa9[_0x91db('0x10')];this['calleridnum']=_0x379fa9[_0x91db('0x11')];this[_0x91db('0x12')]=_0x379fa9[_0x91db('0x12')];this[_0x91db('0x13')]=_0x379fa9[_0x91db('0x13')];this[_0x91db('0x14')]=_0x379fa9['responsetime'];this['ringtime']=_0x379fa9[_0x91db('0x15')]||0x0;this[_0x91db('0x16')]=_0x379fa9[_0x91db('0x16')]||0x0;this[_0x91db('0x17')]=_0x379fa9['talktime']||0x0;this[_0x91db('0x18')]=_0x379fa9[_0x91db('0x18')];this[_0x91db('0x19')]=_0x379fa9[_0x91db('0x19')];this[_0x91db('0x1a')]=_0x379fa9[_0x91db('0x1a')];this[_0x91db('0x1b')]=_0x379fa9[_0x91db('0x1b')];this[_0x91db('0x1c')]=_0x379fa9[_0x91db('0x1c')];this['ListId']=_0x379fa9['ListId'];this[_0x91db('0x1d')]=_0x379fa9[_0x91db('0x1d')];this['VoiceQueueId']=_0x379fa9[_0x91db('0x1e')];this[_0x91db('0x1f')]=_0x379fa9[_0x91db('0x1f')];this[_0x91db('0x20')]=_0x379fa9[_0x91db('0x20')]||'';this['originatecalleridname']=_0x379fa9['originatecalleridname']||'';}module[_0x91db('0x21')]=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/hangup.js b/server/services/ami/dialer/hangup.js index a336da5..061751d 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 _0xa0e2=['countdropretry','uniqueid','calleridname','name','calleridnum','starttime','responsetime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','talktime','endtime','queue','membername','IVR','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','util','lodash','moment','milliseconds','diff','seconds','state','statedesc','scheduledat','type','campaigntype','countbusyretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry'];(function(_0x2224a6,_0x1ac650){var _0x7d920a=function(_0x2b1f57){while(--_0x2b1f57){_0x2224a6['push'](_0x2224a6['shift']());}};_0x7d920a(++_0x1ac650);}(_0xa0e2,0x73));var _0x2a0e=function(_0x32824c,_0x187b0a){_0x32824c=_0x32824c-0x0;var _0x170e27=_0xa0e2[_0x32824c];return _0x170e27;};'use strict';var util=require(_0x2a0e('0x0'));var _=require(_0x2a0e('0x1'));var moment=require(_0x2a0e('0x2'));function getSeconds(_0x154dfb,_0x38eb85){var _0x1612b8=moment(_0x154dfb)[_0x2a0e('0x3')](0x0);var _0x5325c=moment(_0x38eb85)[_0x2a0e('0x3')](0x0);return _0x1612b8[_0x2a0e('0x4')](_0x5325c,_0x2a0e('0x5'));}function Hangup(_0x4ca5e7,_0x52581c){this[_0x2a0e('0x6')]=0x4;this[_0x2a0e('0x7')]='Answer';this['scheduledat']=_0x4ca5e7[_0x2a0e('0x8')];this[_0x2a0e('0x9')]=_0x4ca5e7[_0x2a0e('0x9')];this[_0x2a0e('0xa')]=_0x4ca5e7[_0x2a0e('0x9')]==='outbound'?'queue':_0x4ca5e7['type'];this['countbusyretry']=_0x4ca5e7[_0x2a0e('0xb')];this['countcongestionretry']=_0x4ca5e7['countcongestionretry'];this[_0x2a0e('0xc')]=_0x4ca5e7[_0x2a0e('0xc')];this['countglobal']=_0x4ca5e7[_0x2a0e('0xb')]+_0x4ca5e7['countcongestionretry']+_0x4ca5e7['countnoanswerretry']+_0x4ca5e7[_0x2a0e('0xd')]+_0x4ca5e7['countdropretry']+_0x4ca5e7[_0x2a0e('0xe')]+_0x4ca5e7[_0x2a0e('0xf')]+_0x4ca5e7[_0x2a0e('0x10')];this['countnosuchnumberretry']=_0x4ca5e7[_0x2a0e('0xd')];this[_0x2a0e('0x11')]=_0x4ca5e7[_0x2a0e('0x11')];this[_0x2a0e('0xe')]=_0x4ca5e7[_0x2a0e('0xe')];this[_0x2a0e('0xf')]=_0x4ca5e7['countmachineretry'];this[_0x2a0e('0x10')]=_0x4ca5e7['countagentrejectretry'];this[_0x2a0e('0x12')]=_0x52581c[_0x2a0e('0x12')];this[_0x2a0e('0x13')]=_0x4ca5e7[_0x2a0e('0x14')];this[_0x2a0e('0x15')]=_0x4ca5e7['number'];this[_0x2a0e('0x16')]=_0x4ca5e7['starttime'];this[_0x2a0e('0x17')]=_0x4ca5e7[_0x2a0e('0x17')];this['endtime']=moment()[_0x2a0e('0x18')](_0x2a0e('0x19'));this[_0x2a0e('0x1a')]=getSeconds(_0x4ca5e7[_0x2a0e('0x17')],_0x4ca5e7['starttime']);this[_0x2a0e('0x1b')]=0x0;this[_0x2a0e('0x1c')]=getSeconds(this[_0x2a0e('0x1d')],_0x4ca5e7[_0x2a0e('0x17')]);this[_0x2a0e('0x1e')]=_0x4ca5e7[_0x2a0e('0x1e')];this[_0x2a0e('0x1f')]=_0x2a0e('0x20');this['reason']=_0x52581c[_0x2a0e('0x21')];this[_0x2a0e('0x22')]=_0x4ca5e7['callback'];this[_0x2a0e('0x23')]=_0x4ca5e7[_0x2a0e('0x23')];this[_0x2a0e('0x24')]=_0x4ca5e7[_0x2a0e('0x24')];this['recallme']=_0x4ca5e7[_0x2a0e('0x25')];this[_0x2a0e('0x26')]=_0x4ca5e7['ContactId'];this['ListId']=_0x4ca5e7[_0x2a0e('0x27')];this['UserId']=_0x4ca5e7[_0x2a0e('0x28')];this[_0x2a0e('0x29')]=_0x4ca5e7[_0x2a0e('0x29')];this[_0x2a0e('0x2a')]=_0x4ca5e7['CampaignId'];}module[_0x2a0e('0x2b')]=Hangup; \ No newline at end of file +var _0xed71=['name','starttime','responsetime','endtime','YYYY-MM-DD\x20HH:mm:ss','ringtime','talktime','queue','membername','IVR','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','util','lodash','milliseconds','diff','seconds','state','statedesc','Answer','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countmachineretry','countnosuchnumberretry','countabandonedretry','countagentrejectretry','uniqueid','calleridname'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xed71,0x1c3));var _0x1ed7=function(_0x4b7124,_0x206b7b){_0x4b7124=_0x4b7124-0x0;var _0x23e16d=_0xed71[_0x4b7124];return _0x23e16d;};'use strict';var util=require(_0x1ed7('0x0'));var _=require(_0x1ed7('0x1'));var moment=require('moment');function getSeconds(_0x5ad347,_0x5ed734){var _0xcc5b8d=moment(_0x5ad347)[_0x1ed7('0x2')](0x0);var _0x290959=moment(_0x5ed734)['milliseconds'](0x0);return _0xcc5b8d[_0x1ed7('0x3')](_0x290959,_0x1ed7('0x4'));}function Hangup(_0x5e7ff7,_0x544b81){this[_0x1ed7('0x5')]=0x4;this[_0x1ed7('0x6')]=_0x1ed7('0x7');this['scheduledat']=_0x5e7ff7['scheduledat'];this[_0x1ed7('0x8')]=_0x5e7ff7['type'];this[_0x1ed7('0x9')]=_0x5e7ff7[_0x1ed7('0x8')]===_0x1ed7('0xa')?'queue':_0x5e7ff7[_0x1ed7('0x8')];this[_0x1ed7('0xb')]=_0x5e7ff7[_0x1ed7('0xb')];this[_0x1ed7('0xc')]=_0x5e7ff7[_0x1ed7('0xc')];this[_0x1ed7('0xd')]=_0x5e7ff7[_0x1ed7('0xd')];this[_0x1ed7('0xe')]=_0x5e7ff7['countbusyretry']+_0x5e7ff7[_0x1ed7('0xc')]+_0x5e7ff7[_0x1ed7('0xd')]+_0x5e7ff7['countnosuchnumberretry']+_0x5e7ff7[_0x1ed7('0xf')]+_0x5e7ff7['countabandonedretry']+_0x5e7ff7[_0x1ed7('0x10')]+_0x5e7ff7['countagentrejectretry'];this[_0x1ed7('0x11')]=_0x5e7ff7[_0x1ed7('0x11')];this[_0x1ed7('0xf')]=_0x5e7ff7[_0x1ed7('0xf')];this[_0x1ed7('0x12')]=_0x5e7ff7[_0x1ed7('0x12')];this[_0x1ed7('0x10')]=_0x5e7ff7['countmachineretry'];this[_0x1ed7('0x13')]=_0x5e7ff7[_0x1ed7('0x13')];this['uniqueid']=_0x544b81[_0x1ed7('0x14')];this[_0x1ed7('0x15')]=_0x5e7ff7[_0x1ed7('0x16')];this['calleridnum']=_0x5e7ff7['number'];this[_0x1ed7('0x17')]=_0x5e7ff7[_0x1ed7('0x17')];this[_0x1ed7('0x18')]=_0x5e7ff7[_0x1ed7('0x18')];this[_0x1ed7('0x19')]=moment()['format'](_0x1ed7('0x1a'));this[_0x1ed7('0x1b')]=getSeconds(_0x5e7ff7[_0x1ed7('0x18')],_0x5e7ff7[_0x1ed7('0x17')]);this['holdtime']=0x0;this[_0x1ed7('0x1c')]=getSeconds(this[_0x1ed7('0x19')],_0x5e7ff7[_0x1ed7('0x18')]);this[_0x1ed7('0x1d')]=_0x5e7ff7[_0x1ed7('0x1d')];this[_0x1ed7('0x1e')]=_0x1ed7('0x1f');this[_0x1ed7('0x20')]=_0x544b81['cause-txt'];this[_0x1ed7('0x21')]=_0x5e7ff7[_0x1ed7('0x21')];this[_0x1ed7('0x22')]=_0x5e7ff7[_0x1ed7('0x22')];this[_0x1ed7('0x23')]=_0x5e7ff7[_0x1ed7('0x23')];this[_0x1ed7('0x24')]=_0x5e7ff7['recallme'];this[_0x1ed7('0x25')]=_0x5e7ff7[_0x1ed7('0x25')];this[_0x1ed7('0x26')]=_0x5e7ff7[_0x1ed7('0x26')];this[_0x1ed7('0x27')]=_0x5e7ff7[_0x1ed7('0x27')];this[_0x1ed7('0x28')]=_0x5e7ff7['VoiceQueueId'];this[_0x1ed7('0x29')]=_0x5e7ff7[_0x1ed7('0x29')];}module[_0x1ed7('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 07ed204..68638fe 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 _0x96fc=['countmachineretry','countnosuchnumberretry','countagentrejectretry','calleridname','name','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry'];(function(_0x4b1dba,_0x95be5d){var _0x4609bc=function(_0x26f3fe){while(--_0x26f3fe){_0x4b1dba['push'](_0x4b1dba['shift']());}};_0x4609bc(++_0x95be5d);}(_0x96fc,0x177));var _0xc96f=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x96fc[_0x178e48];return _0x440d7e;};'use strict';var util=require(_0xc96f('0x0'));var _=require('lodash');var moment=require('moment');function getSeconds(_0x1e42f8,_0x286be7){var _0xef8240=moment(_0x1e42f8)[_0xc96f('0x1')](0x0);var _0x472ce8=moment(_0x286be7)[_0xc96f('0x1')](0x0);return _0xef8240[_0xc96f('0x2')](_0x472ce8,_0xc96f('0x3'));}function History(_0x537c87){this[_0xc96f('0x4')]=_0x537c87[_0xc96f('0x4')];this[_0xc96f('0x5')]=_0x537c87[_0xc96f('0x5')]||undefined;this[_0xc96f('0x6')]=_0x537c87[_0xc96f('0x6')];this[_0xc96f('0x7')]=_0x537c87[_0xc96f('0x6')]==='outbound'?_0xc96f('0x8'):_0x537c87[_0xc96f('0x6')];this[_0xc96f('0x9')]=_0x537c87[_0xc96f('0x9')];this[_0xc96f('0xa')]=_0x537c87['countcongestionretry'];this[_0xc96f('0xb')]=_0x537c87['countnoanswerretry'];this[_0xc96f('0xc')]=_0x537c87[_0xc96f('0x9')]+_0x537c87['countcongestionretry']+_0x537c87[_0xc96f('0xb')]+_0x537c87['countnosuchnumberretry']+_0x537c87[_0xc96f('0xd')]+_0x537c87[_0xc96f('0xe')]+_0x537c87[_0xc96f('0xf')]+_0x537c87['countagentrejectretry'];this[_0xc96f('0x10')]=_0x537c87[_0xc96f('0x10')];this[_0xc96f('0xd')]=_0x537c87['countdropretry'];this[_0xc96f('0xe')]=_0x537c87[_0xc96f('0xe')];this[_0xc96f('0xf')]=_0x537c87[_0xc96f('0xf')];this[_0xc96f('0x11')]=_0x537c87[_0xc96f('0x11')];this[_0xc96f('0x8')]=_0x537c87[_0xc96f('0x8')];this[_0xc96f('0x12')]=_0x537c87[_0xc96f('0x13')];this[_0xc96f('0x14')]=_0x537c87['number'];this['starttime']=_0x537c87[_0xc96f('0x15')];this[_0xc96f('0x16')]=_0x537c87[_0xc96f('0x16')];this[_0xc96f('0x17')]=_0x537c87[_0xc96f('0x16')];this[_0xc96f('0x18')]=getSeconds(_0x537c87['responsetime'],_0x537c87['starttime']);this[_0xc96f('0x19')]=0x0;this[_0xc96f('0x1a')]=0x0;this[_0xc96f('0x1b')]=_0x537c87[_0xc96f('0x1b')];this[_0xc96f('0x1c')]=_0x537c87[_0xc96f('0x1c')];this[_0xc96f('0x1d')]=_0x537c87['callbackat'];this[_0xc96f('0x1e')]=_0x537c87[_0xc96f('0x1e')];this[_0xc96f('0x1f')]=_0x537c87[_0xc96f('0x1f')];this[_0xc96f('0x20')]=_0x537c87['ListId'];this[_0xc96f('0x21')]=_0x537c87[_0xc96f('0x21')];this[_0xc96f('0x22')]=_0x537c87['VoiceQueueId'];this[_0xc96f('0x23')]=_0x537c87['CampaignId'];this[_0xc96f('0x24')]=_0x537c87[_0xc96f('0x24')]||'';this[_0xc96f('0x25')]=_0x537c87[_0xc96f('0x25')]||'';}module[_0xc96f('0x26')]=History; \ No newline at end of file +var _0x7bef=['holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','util','lodash','milliseconds','diff','uniqueid','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','queue','name','calleridnum','number','responsetime','endtime','ringtime','starttime'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x7bef,0xe4));var _0xf7be=function(_0x334763,_0x575eff){_0x334763=_0x334763-0x0;var _0x566db0=_0x7bef[_0x334763];return _0x566db0;};'use strict';var util=require(_0xf7be('0x0'));var _=require(_0xf7be('0x1'));var moment=require('moment');function getSeconds(_0xf17330,_0x283eb2){var _0xd41070=moment(_0xf17330)['milliseconds'](0x0);var _0x46eba5=moment(_0x283eb2)[_0xf7be('0x2')](0x0);return _0xd41070[_0xf7be('0x3')](_0x46eba5,'seconds');}function History(_0x33124a){this['uniqueid']=_0x33124a[_0xf7be('0x4')];this['scheduledat']=_0x33124a['scheduledat']||undefined;this[_0xf7be('0x5')]=_0x33124a['type'];this[_0xf7be('0x6')]=_0x33124a[_0xf7be('0x5')]===_0xf7be('0x7')?'queue':_0x33124a['type'];this['countbusyretry']=_0x33124a[_0xf7be('0x8')];this[_0xf7be('0x9')]=_0x33124a[_0xf7be('0x9')];this[_0xf7be('0xa')]=_0x33124a['countnoanswerretry'];this['countglobal']=_0x33124a[_0xf7be('0x8')]+_0x33124a[_0xf7be('0x9')]+_0x33124a['countnoanswerretry']+_0x33124a['countnosuchnumberretry']+_0x33124a[_0xf7be('0xb')]+_0x33124a[_0xf7be('0xc')]+_0x33124a[_0xf7be('0xd')]+_0x33124a[_0xf7be('0xe')];this['countnosuchnumberretry']=_0x33124a[_0xf7be('0xf')];this[_0xf7be('0xb')]=_0x33124a['countdropretry'];this[_0xf7be('0xc')]=_0x33124a[_0xf7be('0xc')];this['countmachineretry']=_0x33124a['countmachineretry'];this['countagentrejectretry']=_0x33124a[_0xf7be('0xe')];this[_0xf7be('0x10')]=_0x33124a[_0xf7be('0x10')];this['calleridname']=_0x33124a[_0xf7be('0x11')];this[_0xf7be('0x12')]=_0x33124a[_0xf7be('0x13')];this['starttime']=_0x33124a['starttime'];this[_0xf7be('0x14')]=_0x33124a[_0xf7be('0x14')];this[_0xf7be('0x15')]=_0x33124a['responsetime'];this[_0xf7be('0x16')]=getSeconds(_0x33124a[_0xf7be('0x14')],_0x33124a[_0xf7be('0x17')]);this[_0xf7be('0x18')]=0x0;this[_0xf7be('0x19')]=0x0;this[_0xf7be('0x1a')]=_0x33124a[_0xf7be('0x1a')];this[_0xf7be('0x1b')]=_0x33124a['callbackuniqueid'];this['callbackat']=_0x33124a[_0xf7be('0x1c')];this['recallme']=_0x33124a[_0xf7be('0x1d')];this[_0xf7be('0x1e')]=_0x33124a['ContactId'];this[_0xf7be('0x1f')]=_0x33124a[_0xf7be('0x1f')];this[_0xf7be('0x20')]=_0x33124a[_0xf7be('0x20')];this[_0xf7be('0x21')]=_0x33124a[_0xf7be('0x21')];this[_0xf7be('0x22')]=_0x33124a[_0xf7be('0x22')];this[_0xf7be('0x23')]=_0x33124a['originatecalleridnum']||'';this['originatecalleridname']=_0x33124a['originatecalleridname']||'';}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 371b349..e18ea3f 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 _0xcff8=['getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','createHistory','[createHistory]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','pick','ContactId','ListId','UserId','VoiceQueueId','CampaignId','[emptyContact][createHistory]','[emptyContact]','isSuccess','Success','isTrunkReachable','SIP/%s','reachable','unmonitored','saveInDb','uniqueid','isNil','variable','dialAMDActive','value','HANGUP','membername','AMD','custom:amd','amd','MACHINE','countmachineretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','dialGlobalMaxRetry','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','add','dialMachineRetryFrequency','[rescheduleContact][Machine]','HangupInAMD','buildObj','[syncHangupInAMDIvr]','Machine','countglobal','[syncAgentComplete][createHistory][0]','countbusyretry','minutes','YYYY-MM-DD\x20HH:mm:ss','ivrAnswerCallsDay','[syncHangupIvr]','dialQueueProject','AGI','[syncHangupIvr][createHistory]','cause-txt','Unknow','agent','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','[syncAgentComplete][createHistory]','[syncAgentComplete]','syncAgentConnect','answertime','queueCallerAbandonCreateState','syncQueueCallerAbandon','droptime','responsetime','dialQueueTimeout','predictiveIntervalErlangCallsDroppedCalls','Drop','TIMEOUT','dialDropMaxRetry','dialDropRetryFrequency','[rescheduleContact][Drop]','endtime','calleridname','calleridnum','Abandoned','dropreason','CALLEREXIT','rescheduleContact','dialAbandonedRetryFrequency','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','actionid','locked','paused','stateinterface','agents','rrmemory','push','queueStatusComplete','[unlockQueueStatus][undefined]','stringify','idHopper','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','_rr','length','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','[booked][RR][finaly]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','loopCampaigns','syncCampaigns','checkIsTrunkReachable','TRUNK_IS_NOT_REACHABLE','checkIfTime','ifTime','checkIfTimeIntervals','\x20Intervals\x20is\x20null\x20','INTERVAL_IS_EMPTY','Failure','\x20Timezone\x20unknow\x20','command','iftime\x20%s,%s','interval','timezones','content','true','indexOf','all','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Global:\x20','Timezone:\x20','dialMethod','progressive','handlePower','power','dialPowerLevel','Queue','method\x20not\x20recognized','launchHandleIvr','handleIvr','dialTimezone','[syncQueueSummary]','[syncCampaigns]','random','match','actionOriginate','originate','voiceQueue\x20is\x20undefine','Contact','phone','contact\x20is\x20undefine','\x22agi://%s/square,%s\x22','NONE','dialer','getCaller','ACTIVE','xcally-motion-dialer','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','XMD-AMDMAXIMUMNUMBEROFWORDS','XMD-AMDSILENCETHRESHOLD','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','createdAt','updatedAt','%s%s','XMD-','toUpper','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','TrunkBackup','XMD-ORIGINATECALLERIDNAME','originatecalleridname','XMD-ORIGINATECALLERIDNUM','originatecalleridnum','SIP/%s/%s%s','trim','dialCutDigit','[originate][error]','originate\x20action\x20Error','response','callProgressDetecting','[callProgressDetecting]\x20','countagentrejectretry','dialNoAnswerMaxRetry','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','[rescheduleContact][NoSuchNumber]','dialAbandonedMaxRetry','dialAgentRejectMaxRetry','[rescheduleContact][AgentReject]','[callProgressDetecting]','entity\x20is\x20undefine','outboundNoSuchCallsDay','NoSuchNumber','custom:agentnosuchnumber','checkRetriveMax','dialNoSuchNumberMaxRetry','reason\x200\x20no\x20such\x20number....','NoAnswer','custom:agentnoanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','stateGlobal','Busy','custom:agentbusy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','Congestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','outboundRejectCallsDay','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','reason','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','round','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','started\x20in\x20predictive\x20at','getDataPredictive','startMethodPredictive','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','dialPredictiveOptimizationPercentage','abandonmentRate','agentBusyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','outboundQueuePauses','[CatchErlangB]','predictiveIntervalAnsweredCalls','busyFactor','erlangCallToSecond','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','Agent','voicePause','outboundReCallsDay','[rescheduleContact][dialRecallInQueue]','RECALLINQUEUE','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALLFAILEDTIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','outboundBlacklistCallsDay','BLACKLIST','Blacklist','[Originate][historyBlacklist]','limitCalls','dialOrderByScheduledAt','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','[actionOriginate]\x20','Contact.phone','[actionOriginateIvr]\x20','[getContactCampaign2]','booked','dialLimitQueue','not_inuse','tryOriginatePredictive','[handlePredictive][limitChannel]','[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]','Ts\x20=\x20','interval\x20=\x20','----\x20Agent\x20Busy\x20Factor\x20----','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','m\x20=\x20','p\x20=\x20','exports','util','bluebird','uuid','md5','ioredis','../preview/util/util','../../../config/environment/','../../../config/logger','predictive','predictiveCalls','syncQueueSummary','../ami','defaults','redis','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','./action','./final','./agentComplete','./queueCallerAbandon','./hangup','env','127.0.0.1','roundrobin','prototype','enqueue','tail','finally','sequence','preview','voiceQueues','campaigns','trunks','maxNumberOriginate','channels','actions','contactsId','optionPredictive','startPredictive','startProgressive','ivrOriginated','queueBooked','queueBookedRR','agentconnect','bind','queuecallerabandon','syncOriginateResponse','agentcomplete','syncAgentComplete','custom:queuesummary','syncHangup','newexten','syncNewExten','varset','syncVarSet','queuemember','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','isUndefined','AGENTS_NOT_LOGGED','\x20AGENTS\x20NOT\x20LOGGED','message','\x20NOT\x20Active','Interval','INTERVAL_IS_NULL','Intervals','name','\x20INTERVAL_IS_NULL','isEmpty','[ifTime][Action]','Error','milliseconds','seconds','emit','type','outbound','strategy','available','loggedIn','pTalking','sumBillable','sumHoldTime','talking','total','abandoned','waiting','dialActive','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundOriginateFailureCallsDay','outboundUnknownCallsDay','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalHitRate','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangAbandonmentRate','Trunk','active','format','voice:queue:%s','voice_queue:save','ivr','campaign:ivr:%s','campaign:save','-----\x20Stats\x20Predictive\x20---','info','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','merge','clearing\x20variable\x20start\x20predictive','handlePredictive','clearing\x20variable\x20handle\x20predictive','string','\x22%s\x22\x20<%s>','error','inspect','stack','undefined','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','RESCHEDULED_CONTACTS','contacts','AVAILABLE_CONTACTS_FINISHED','[getContactDialer2][Empty]','sendMessageOneNotActive','NOT_ACTIVE','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','IS_DISACTIVED','is\x20disactive','state','statedesc','starttime','loopClearZombieChannels','clearZombieChannels','uniqueId','[uniqueid]','Action','status','channel','catch','No\x20such\x20channel','updateOriginated','queue','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','countReScheduled','then','[countReScheduled]\x20','checkIsBlackList','[checkIsBlackList]\x20','checkIsBlackListIvr','resolve','[checkIsBlackListIvr]\x20','averageHandleTime','avgHandleTime','[averageHandleTime]\x20','[rescheduleContact]\x20','unlockContact','getContactDialer','temp','[getContactDialer]\x20','getContactDialerIvr','[getContactDialerIvr]\x20'];(function(_0x265aa2,_0x220072){var _0x447a3a=function(_0x1512cc){while(--_0x1512cc){_0x265aa2['push'](_0x265aa2['shift']());}};_0x447a3a(++_0x220072);}(_0xcff8,0x14b));var _0x8cff=function(_0x559d28,_0xb3ed0b){_0x559d28=_0x559d28-0x0;var _0x57ddfe=_0xcff8[_0x559d28];return _0x57ddfe;};'use strict';var util=require(_0x8cff('0x0'));var _=require('lodash');var BPromise=require(_0x8cff('0x1'));var uuid=require(_0x8cff('0x2'));var moment=require('moment');var rr=require('rr');var md5=require(_0x8cff('0x3'));var Redis=require(_0x8cff('0x4'));var ut=require(_0x8cff('0x5'));var config=require(_0x8cff('0x6'));var logger=require('../../../config/logger')('dialer');var loggerBooked=require('../../../config/logger')('booked');var loggerPredictive=require(_0x8cff('0x7'))(_0x8cff('0x8'));var loggerPredictiveCalls=require(_0x8cff('0x7'))(_0x8cff('0x9'));var loggerSyncQueueSummary=require(_0x8cff('0x7'))(_0x8cff('0xa'));var ami=require(_0x8cff('0xb'));config['redis']=_[_0x8cff('0xc')](config[_0x8cff('0xd')],{'host':_0x8cff('0xe'),'port':0x18eb});var io=require(_0x8cff('0xf'))(new Redis(config['redis']));var cmHopper=require(_0x8cff('0x10'));var cmHopperHistory=require(_0x8cff('0x11'));var cmHopperBlack=require(_0x8cff('0x12'));var voiceQueueRt=require(_0x8cff('0x13'));var Action=require(_0x8cff('0x14'));var History=require('./history');var Final=require(_0x8cff('0x15'));var AgentComplete=require(_0x8cff('0x16'));var QueueCallerAbandon=require(_0x8cff('0x17'));var Hangup=require(_0x8cff('0x18'));var ipAgi=process[_0x8cff('0x19')]['XCALLY_IP_AGI']||_0x8cff('0x1a');var strategy={'rrmemory':'rrmemory','roundrobin':_0x8cff('0x1b')};var Sequence=function(){};Sequence[_0x8cff('0x1c')][_0x8cff('0x1d')]=function(_0x210ad8){this[_0x8cff('0x1e')]=this[_0x8cff('0x1e')]?this[_0x8cff('0x1e')][_0x8cff('0x1f')](_0x210ad8):_0x210ad8();};function Dialer(_0xd3cbe9,_0x11305e){this[_0x8cff('0x20')]=new Sequence();this[_0x8cff('0x21')]=_0x11305e;this[_0x8cff('0x22')]=_0xd3cbe9[_0x8cff('0x22')];this['campaigns']=_0xd3cbe9[_0x8cff('0x23')];this['agents']=_0xd3cbe9['agents'];this['trunks']=_0xd3cbe9[_0x8cff('0x24')];this['maxNumberOriginate']=config[_0x8cff('0x25')]||0x2;this[_0x8cff('0x26')]={};this[_0x8cff('0x27')]={};this[_0x8cff('0x28')]={};this['uniqueId']={};this[_0x8cff('0x29')]={};this[_0x8cff('0x2a')]={};this[_0x8cff('0x2b')]={};this[_0x8cff('0x2c')]={};this[_0x8cff('0x2d')]={};this[_0x8cff('0x2e')]={};ami['on'](_0x8cff('0x2f'),this['syncAgentConnect'][_0x8cff('0x30')](this));ami['on'](_0x8cff('0x31'),this['syncQueueCallerAbandon']['bind'](this));ami['on']('originateresponse',this[_0x8cff('0x32')][_0x8cff('0x30')](this));ami['on'](_0x8cff('0x33'),this[_0x8cff('0x34')][_0x8cff('0x30')](this));ami['on'](_0x8cff('0x35'),this[_0x8cff('0xa')][_0x8cff('0x30')](this));ami['on']('hangup',this[_0x8cff('0x36')]['bind'](this));ami['on'](_0x8cff('0x37'),this[_0x8cff('0x38')][_0x8cff('0x30')](this));ami['on'](_0x8cff('0x39'),this[_0x8cff('0x3a')][_0x8cff('0x30')](this));ami['on'](_0x8cff('0x3b'),this[_0x8cff('0x3c')][_0x8cff('0x30')](this));ami['on'](_0x8cff('0x3d'),this[_0x8cff('0x3e')][_0x8cff('0x30')](this));this['loopCampaigns']();this['loopClearZombieChannels']();}function isNotNull(_0x41ea22){return _0x41ea22!==null&&!_[_0x8cff('0x3f')](_0x41ea22);}function checkIsLoggedIn(_0x43d693,_0x2f7e49){return function(){if(_0x2f7e49<=0x0){_0x43d693['message']=_0x8cff('0x40');throw _0x43d693['name']+_0x8cff('0x41');}};}function isActive(_0x5bdd63){return _0x5bdd63;}function checkIsActive(_0x1d56fd,_0x5dc6c9){return function(){if(!isActive(_0x5dc6c9)){_0x1d56fd[_0x8cff('0x42')]='NOT_ACTIVE';throw _0x1d56fd['name']+_0x8cff('0x43');}};}function checkInterval(_0x4f1f44){return function(){if(!isNotNull(_0x4f1f44[_0x8cff('0x44')])){_0x4f1f44['message']=_0x8cff('0x45');throw _0x4f1f44['name']+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_0x4f1f44[_0x8cff('0x44')][_0x8cff('0x46')])){_0x4f1f44[_0x8cff('0x42')]=_0x8cff('0x45');throw _0x4f1f44[_0x8cff('0x47')]+_0x8cff('0x48');}if(!isNotNull(_[_0x8cff('0x49')](_0x4f1f44[_0x8cff('0x44')][_0x8cff('0x46')]))){_0x4f1f44[_0x8cff('0x42')]=_0x8cff('0x45');throw _0x4f1f44['name']+_0x8cff('0x48');}};}function msgResponse(_0x31ccb4,_0x57cc90,_0xfd275b){return{'action':_0x31ccb4,'response':_0x57cc90,'message':_0xfd275b,'stack':_0xfd275b};}function myreject(_0x2faf1d){return function(_0x358a8a){return _0x2faf1d(msgResponse(_0x8cff('0x4a'),_0x8cff('0x4b'),JSON['stringify'](_0x358a8a)));};}function getSeconds(_0x15b5a9,_0x4de7e4){var _0x3dfc86=moment(_0x15b5a9)[_0x8cff('0x4c')](0x0);var _0x3b64d6=moment(_0x4de7e4)[_0x8cff('0x4c')](0x0);return _0x3dfc86['diff'](_0x3b64d6,_0x8cff('0x4d'));}function emit(_0x5b6be2,_0x2c9157,_0x373fe3){io['to'](_0x5b6be2)[_0x8cff('0x4e')](_0x2c9157,_0x373fe3);}function emitVoiceQueueSummary(_0x4591a1){if(_0x4591a1[_0x8cff('0x4f')]===_0x8cff('0x50')){var _0x4095cd={'id':_0x4591a1['id'],'name':_0x4591a1['name'],'strategy':_0x4591a1[_0x8cff('0x51')],'answered':_0x4591a1['answered'],'available':_0x4591a1[_0x8cff('0x52')],'loggedIn':_0x4591a1[_0x8cff('0x53')],'pTalking':_0x4591a1[_0x8cff('0x54')],'sumBillable':_0x4591a1[_0x8cff('0x55')],'sumDuration':_0x4591a1['sumDuration'],'sumHoldTime':_0x4591a1[_0x8cff('0x56')]||0x0,'talking':_0x4591a1[_0x8cff('0x57')],'total':_0x4591a1[_0x8cff('0x58')],'type':_0x4591a1[_0x8cff('0x4f')],'unmanaged':_0x4591a1['unmanaged'],'abandoned':_0x4591a1[_0x8cff('0x59')],'waiting':_0x4591a1[_0x8cff('0x5a')],'loggedInDb':_0x4591a1['loggedInDb'],'dialActive':_0x4591a1[_0x8cff('0x5b')],'dialMethod':_0x4591a1['dialMethod'],'dialOriginateCallerIdName':_0x4591a1['dialOriginateCallerIdName'],'dialOriginateCallerIdNumber':_0x4591a1[_0x8cff('0x5c')],'dialOriginateTimeout':_0x4591a1[_0x8cff('0x5d')],'dialPrefix':_0x4591a1[_0x8cff('0x5e')],'outboundAnswerAgiCallsDay':_0x4591a1[_0x8cff('0x5f')],'outboundAnswerCallsDay':_0x4591a1[_0x8cff('0x60')],'outboundBlacklistCallsDay':_0x4591a1['outboundBlacklistCallsDay'],'outboundBusyCallsDay':_0x4591a1[_0x8cff('0x61')],'outboundCongestionCallsDay':_0x4591a1[_0x8cff('0x62')],'outboundDropCallsDayACS':_0x4591a1[_0x8cff('0x63')],'outboundDropCallsDayCallersExit':_0x4591a1[_0x8cff('0x64')],'outboundDropCallsDayTimeout':_0x4591a1[_0x8cff('0x65')],'outboundNoAnswerCallsDay':_0x4591a1['outboundNoAnswerCallsDay'],'outboundNoSuchCallsDay':_0x4591a1['outboundNoSuchCallsDay'],'outboundOriginateFailureCallsDay':_0x4591a1[_0x8cff('0x66')],'outboundReCallsDay':_0x4591a1['outboundReCallsDay'],'outboundRejectCallsDay':_0x4591a1['outboundRejectCallsDay'],'outboundUnknownCallsDay':_0x4591a1[_0x8cff('0x67')],'predictiveIntervalAnsweredCalls':_0x4591a1['predictiveIntervalAnsweredCalls'],'predictiveIntervalAvgHoldtime':_0x4591a1[_0x8cff('0x68')],'predictiveIntervalAvgTalktime':_0x4591a1[_0x8cff('0x69')],'predictiveIntervalDroppedCallsCallersExit':_0x4591a1[_0x8cff('0x6a')],'predictiveIntervalDroppedCallsTimeout':_0x4591a1[_0x8cff('0x6b')],'predictiveIntervalErlangCalls':_0x4591a1[_0x8cff('0x6c')],'predictiveIntervalErlangCallsDroppedCalls':_0x4591a1['predictiveIntervalErlangCallsDroppedCalls'],'predictiveIntervalHitRate':_0x4591a1[_0x8cff('0x6d')],'predictiveIntervalMultiplicativeFactor':_0x4591a1['predictiveIntervalMultiplicativeFactor'],'predictiveIntervalPauses':_0x4591a1[_0x8cff('0x6e')],'predictiveIntervalAvailable':_0x4591a1[_0x8cff('0x6f')],'predictiveIntervalTotalCalls':_0x4591a1[_0x8cff('0x70')],'message':_0x4591a1['message'],'originated':_0x4591a1[_0x8cff('0x71')],'erlangCalls':_0x4591a1[_0x8cff('0x72')],'erlangCallToSecond':_0x4591a1['erlangCallToSecond'],'erlangAbandonmentRate':_0x4591a1[_0x8cff('0x73')],'erlangBusyFactor':_0x4591a1['erlangBusyFactor'],'startPredictive':_0x4591a1['startPredictive'],'startProgressive':_0x4591a1[_0x8cff('0x2b')]};if(_0x4591a1['Trunk']){_0x4095cd[_0x8cff('0x74')]={'id':_0x4591a1[_0x8cff('0x74')]['id'],'name':_0x4591a1['Trunk'][_0x8cff('0x47')],'active':_0x4591a1['Trunk'][_0x8cff('0x75')],'callerid':_0x4591a1['Trunk']['callerid']};}if(_0x4591a1['Interval']){_0x4095cd[_0x8cff('0x44')]={'id':_0x4591a1[_0x8cff('0x44')]['id'],'name':_0x4591a1[_0x8cff('0x44')][_0x8cff('0x47')]};}var _0x3501c5=md5(JSON['stringify'](_0x4095cd));if(_0x4591a1[_0x8cff('0x3')]!==_0x3501c5){_0x4591a1[_0x8cff('0x3')]=_0x3501c5;emit(util[_0x8cff('0x76')](_0x8cff('0x77'),_0x4095cd['name']),_0x8cff('0x78'),_0x4095cd);}}}function emitCampaignSummary(_0x5b3dc1){if(_0x5b3dc1[_0x8cff('0x4f')]===_0x8cff('0x79')){emit(util['format'](_0x8cff('0x7a'),_0x5b3dc1[_0x8cff('0x47')]),_0x8cff('0x7b'),_0x5b3dc1);}}function checkGetDataPredictive(_0x565a75){if(isNotNull(_0x565a75)&&!_[_0x8cff('0x49')](_0x565a75)){loggerPredictive['info'](_0x8cff('0x7c'));loggerPredictive[_0x8cff('0x7d')]('Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x565a75['predictiveIntervalTotalCalls']);loggerPredictive['info']('Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x565a75['predictiveIntervalAnsweredCalls']);loggerPredictive['info'](_0x8cff('0x7e'),_0x565a75[_0x8cff('0x6b')]);loggerPredictive['info'](_0x8cff('0x7f'),_0x565a75[_0x8cff('0x6a')]);loggerPredictive[_0x8cff('0x7d')](_0x8cff('0x80'),_0x565a75[_0x8cff('0x68')]);loggerPredictive[_0x8cff('0x7d')]('AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x565a75['predictiveIntervalAvgTalktime']);loggerPredictive[_0x8cff('0x7d')](_0x8cff('0x81'));if(_0x565a75[_0x8cff('0x70')]>0x0){if(!_[_0x8cff('0x3f')](_0x565a75[_0x8cff('0x69')])&&_0x565a75[_0x8cff('0x69')]>0x0){return!![];}loggerPredictive[_0x8cff('0x7d')]('Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive');if(!_[_0x8cff('0x3f')](_0x565a75[_0x8cff('0x68')])&&_0x565a75[_0x8cff('0x68')]>0x0){return!![];}loggerPredictive[_0x8cff('0x7d')]('Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive');}else{loggerPredictive[_0x8cff('0x7d')](_0x8cff('0x82'));}}else{loggerPredictive[_0x8cff('0x7d')](_0x8cff('0x83'));}return![];}function mergeDataErlangB(_0x4cb7d7){return function(_0x321c03){loggerPredictive[_0x8cff('0x7d')]('---------\x20ErlangB\x20---------');loggerPredictive[_0x8cff('0x7d')]('Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x321c03[_0x8cff('0x72')]);loggerPredictive['info'](_0x8cff('0x84'),_0x321c03['erlangCallToSecond']);loggerPredictive[_0x8cff('0x7d')](_0x8cff('0x85'),_0x321c03[_0x8cff('0x73')]);loggerPredictive[_0x8cff('0x7d')](_0x8cff('0x86'),_0x321c03['erlangBusyFactor']);loggerPredictive[_0x8cff('0x7d')](_0x8cff('0x85'),_0x321c03[_0x8cff('0x73')]);loggerPredictive[_0x8cff('0x7d')]('---------------------------');_[_0x8cff('0x87')](_0x4cb7d7,_0x321c03);};}function getDiff(_0x462952){var _0x1f0f1a=moment()[_0x8cff('0x4c')](0x0);var _0x28a337=moment(_0x462952)['milliseconds'](0x0);return _0x1f0f1a['diff'](_0x28a337,_0x8cff('0x4d'));}function ifInterval(_0x247ca2,_0x19c223){if(_[_0x8cff('0x3f')](_0x19c223)){return![];}return getDiff(_0x19c223)<_0x247ca2*0x3c;}function freeVariablesPredictive(_0x3cc9bf){if(isNotNull(_0x3cc9bf)){if(!_[_0x8cff('0x3f')](_0x3cc9bf['startProgressive'])){_0x3cc9bf[_0x8cff('0x2b')]=undefined;loggerPredictive[_0x8cff('0x7d')](_0x3cc9bf['name'],'clearing\x20variable\x20start\x20progressive');}if(!_[_0x8cff('0x3f')](_0x3cc9bf[_0x8cff('0x2a')])){_0x3cc9bf[_0x8cff('0x2a')]=undefined;loggerPredictive[_0x8cff('0x7d')](_0x3cc9bf[_0x8cff('0x47')],_0x8cff('0x88'));}if(!_['isUndefined'](_0x3cc9bf['handlePredictive'])){clearInterval(_0x3cc9bf[_0x8cff('0x89')]);_0x3cc9bf[_0x8cff('0x89')]=undefined;loggerPredictive[_0x8cff('0x7d')](_0x3cc9bf['name'],_0x8cff('0x8a'));}}}function erlangb(_0x4109d2,_0x5ba5e6){if(_0x5ba5e6===0x0){return 0x0;}var _0x5bbf49=0x1;for(var _0x2fa01f=0x1;_0x2fa01f<=_0x5ba5e6;_0x2fa01f+=0x1){_0x5bbf49=0x1+_0x5bbf49*_0x2fa01f/_0x4109d2;}return 0x1/_0x5bbf49;}function isVoiceQueueOutbound(_0x26acd3){return _0x26acd3==='outbound';}function isNotPreview(_0x4e99e5){return _0x4e99e5!==_0x8cff('0x21');}function isCampaignIvr(_0x5a9000){return _0x5a9000===_0x8cff('0x79');}function getCallerId(_0x5c5f7a,_0x52a92e,_0x2e60b1){if(!_['isUndefined'](_0x2e60b1)&&typeof _0x2e60b1===_0x8cff('0x8b')&&!_[_0x8cff('0x49')](_0x2e60b1)){if(!_['isUndefined'](_0x52a92e)&&typeof _0x52a92e===_0x8cff('0x8b')&&!_[_0x8cff('0x49')](_0x52a92e)){return util[_0x8cff('0x76')](_0x8cff('0x8c'),_0x52a92e,_0x2e60b1);}return util[_0x8cff('0x76')](_0x8cff('0x8c'),_0x2e60b1,_0x2e60b1);}if(!_[_0x8cff('0x3f')](_0x5c5f7a)&&typeof _0x5c5f7a===_0x8cff('0x8b')&&!_['isEmpty'](_0x5c5f7a)){return _0x5c5f7a;}return'\x22\x22\x20<>';}function loggerCatchQueueSummary(_0x2e51ff,_0x5e924e){return function(_0x5a1be6){freeVariablesPredictive(_0x5e924e);emitVoiceQueueSummary(_0x5e924e);emitCampaignSummary(_0x5e924e);loggerSyncQueueSummary[_0x8cff('0x8d')](_0x2e51ff,util[_0x8cff('0x8e')](_0x5a1be6,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x37bc92,_0x1a00c1){return function(_0x385ea0){loggerPredictive['error'](_0x1a00c1['name'],_0x37bc92);loggerPredictive[_0x8cff('0x8d')](_0x385ea0[_0x8cff('0x8f')]);freeVariablesPredictive(_0x1a00c1);};}function loggerCatch(_0x22a8bc){return function(_0x434ff9){logger[_0x8cff('0x8d')](_0x22a8bc,util[_0x8cff('0x8e')](_0x434ff9,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x52f139){return _0x52f139&&!_[_0x8cff('0x3f')](_0x52f139)&&_0x52f139['length']>0x0;}function decremetOriginate(_0x20c2e7){if(!_[_0x8cff('0x3f')](_0x20c2e7)&&_0x20c2e7!==null){if(typeof _0x20c2e7[_0x8cff('0x71')]!==_0x8cff('0x90')){if(_0x20c2e7['originated']>0x0){_0x20c2e7[_0x8cff('0x71')]-=0x1;}else{logger[_0x8cff('0x8d')](_0x8cff('0x91'));}}}else{logger[_0x8cff('0x8d')](_0x8cff('0x92'));}}function checkContactLowerLimitOriginate(_0x463a38,_0x3e965e,_0xbd5d9b){if(_0x3e965e>_0xbd5d9b){for(var _0x5b820f=0x0;_0x5b820f<_0x3e965e-_0xbd5d9b;_0x5b820f+=0x1){decremetOriginate(_0x463a38);}}}function loggerGetContactDialer(_0x33a62f,_0x194544,_0x12ae6c){return function(_0x322b15){checkContactLowerLimitOriginate(_0x194544,_0x12ae6c,0x0);logger[_0x8cff('0x8d')](_0x33a62f,util['inspect'](_0x322b15,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x4181e0){return function(_0x44769){if(isNotNull(_0x44769)&&isNotNull(_0x44769[0x0])){if(_0x44769[0x0]['contactsRescheduled']>0x0){_0x4181e0[_0x8cff('0x42')]=_0x8cff('0x93');logger[_0x8cff('0x7d')]('[getContactDialer2][ReScheduled]'+_0x4181e0[_0x8cff('0x47')],_0x44769[0x0]['contactsRescheduled'],_0x8cff('0x94'));}else{_0x4181e0[_0x8cff('0x42')]=_0x8cff('0x95');logger['info'](_0x8cff('0x96')+_0x4181e0['name']);}}};}function notSendMessagesQueue(_0x7c1167){if(_0x7c1167[_0x8cff('0x97')]){freeVariablesPredictive(_0x7c1167);if(_0x7c1167[_0x8cff('0x71')]===0x0&&_0x7c1167[_0x8cff('0x57')]===0x0&&_0x7c1167['waiting']===0x0&&(_0x7c1167['pTalking']||0x0)===0x0){_0x7c1167['sendMessageOneNotActive']=![];_0x7c1167[_0x8cff('0x52')]=0x0;_0x7c1167[_0x8cff('0x42')]=_0x8cff('0x98');loggerSyncQueueSummary[_0x8cff('0x8d')](_0x8cff('0x99'),_0x7c1167[_0x8cff('0x47')],_0x8cff('0x9a'));}else{_0x7c1167[_0x8cff('0x42')]='IS_DISACTIVED';loggerSyncQueueSummary[_0x8cff('0x8d')](_0x8cff('0x99'),_0x7c1167[_0x8cff('0x47')],'is\x20disactive');}emitVoiceQueueSummary(_0x7c1167);}}function notSendMessagesCampaign(_0x5279a3){if(_0x5279a3[_0x8cff('0x97')]){if(_0x5279a3[_0x8cff('0x71')]===0x0){_0x5279a3['sendMessageOneNotActive']=![];_0x5279a3['message']=_0x8cff('0x98');loggerSyncQueueSummary[_0x8cff('0x8d')](_0x8cff('0x9b'),_0x5279a3[_0x8cff('0x47')],'is\x20not\x20active');}else{_0x5279a3[_0x8cff('0x42')]=_0x8cff('0x9c');loggerSyncQueueSummary[_0x8cff('0x8d')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x5279a3[_0x8cff('0x47')],_0x8cff('0x9d'));}emitCampaignSummary(_0x5279a3);}}function createObjHistory(_0x3ce267,_0x55525c,_0x6f17af,_0x52ae59,_0x529f0b){_0x3ce267[_0x8cff('0x42')]=_0x6f17af;var _0x3aed24=new Action(_0x3ce267,_0x55525c);var _0x320837=new History(_0x3aed24);_0x320837[_0x8cff('0x9e')]=_0x52ae59;_0x320837[_0x8cff('0x9f')]=_0x529f0b;_0x320837['endtime']=_0x3aed24[_0x8cff('0xa0')];return _0x320837;}Dialer['prototype'][_0x8cff('0xa1')]=function(){var _0x134a20=this;setInterval(function(){_0x134a20[_0x8cff('0xa2')](_0x134a20[_0x8cff('0xa3')],_0x8cff('0xa4'));_0x134a20[_0x8cff('0xa2')](_0x134a20['actions'],'[actions]');},0x32c8);};Dialer[_0x8cff('0x1c')][_0x8cff('0xa2')]=function(_0x4616c7,_0x3d9733){var _0x189d0d=this;for(var _0x1fdb59 in _0x4616c7){if(typeof _0x4616c7[_0x1fdb59]!==_0x8cff('0x90')){this['sequence'][_0x8cff('0x1d')](function(){if(!_['isNil'](_0x4616c7[_0x1fdb59])){return ami[_0x8cff('0xa5')]({'action':_0x8cff('0xa6'),'channel':_0x4616c7[_0x1fdb59][_0x8cff('0xa7')]})[_0x8cff('0xa8')](function(_0x56473f){if(_0x56473f['message']===_0x8cff('0xa9')){setTimeout(function(){if(_0x4616c7[_0x1fdb59]&&_0x4616c7[_0x1fdb59][_0x8cff('0x4f')]!==_0x8cff('0x79')){_0x189d0d[_0x8cff('0xaa')](_0x189d0d['voiceQueues'][_0x4616c7[_0x1fdb59][_0x8cff('0xab')]]);logger['error'](_0x8cff('0xac'),_0x3d9733,_0x1fdb59,_0x4616c7[_0x1fdb59][_0x8cff('0xab')]);delete _0x4616c7[_0x1fdb59];}if(_0x4616c7[_0x1fdb59]&&_0x4616c7[_0x1fdb59]['type']===_0x8cff('0x79')){_0x189d0d[_0x8cff('0xaa')](_0x189d0d[_0x8cff('0x23')][_0x4616c7[_0x1fdb59][_0x8cff('0xab')]]);logger['error'](_0x8cff('0xad'),_0x3d9733,_0x1fdb59,_0x4616c7[_0x1fdb59]['queue']);delete _0x4616c7[_0x1fdb59];}},0x2328);}});}});}}};Dialer[_0x8cff('0x1c')][_0x8cff('0xae')]=function(_0x54e875){return BPromise['resolve']()[_0x8cff('0xaf')](cmHopper[_0x8cff('0xae')](_0x54e875))[_0x8cff('0xa8')](loggerCatch(_0x8cff('0xb0')));};Dialer[_0x8cff('0x1c')][_0x8cff('0xb1')]=function(_0x2ce50b){return BPromise['resolve']()['then'](cmHopperBlack[_0x8cff('0xb1')](_0x2ce50b))[_0x8cff('0xa8')](loggerCatch(_0x8cff('0xb2')));};Dialer[_0x8cff('0x1c')][_0x8cff('0xb3')]=function(_0x5d2883){return BPromise[_0x8cff('0xb4')]()[_0x8cff('0xaf')](cmHopperBlack[_0x8cff('0xb3')](_0x5d2883))['catch'](loggerCatch(_0x8cff('0xb5')));};Dialer['prototype'][_0x8cff('0xb6')]=function(_0x3a19c2){return BPromise['resolve']()[_0x8cff('0xaf')](cmHopperHistory[_0x8cff('0xb7')](_0x3a19c2))[_0x8cff('0xa8')](loggerCatch(_0x8cff('0xb8')));};Dialer[_0x8cff('0x1c')]['rescheduleContact']=function(_0x211065){return BPromise[_0x8cff('0xb4')]()['then'](cmHopper['rescheduleContact'](_0x211065))['catch'](loggerCatch(_0x8cff('0xb9')));};Dialer[_0x8cff('0x1c')][_0x8cff('0xba')]=function(_0x2769cc,_0x598640,_0x3475b6){return BPromise[_0x8cff('0xb4')]()[_0x8cff('0xaf')](cmHopper[_0x8cff('0xba')](_0x2769cc,_0x598640,_0x3475b6))['catch'](loggerCatch('[unlockContact]\x20'));};Dialer[_0x8cff('0x1c')][_0x8cff('0xbb')]=function(_0x5b4ab3,_0x29b077,_0x51241b,_0x3c818f,_0x182b44){return BPromise[_0x8cff('0xb4')]()[_0x8cff('0xaf')](cmHopper[_0x8cff('0xbb')](_0x5b4ab3,_0x29b077,_0x51241b,_0x3c818f))[_0x8cff('0xa8')](function(_0x41529c){_0x182b44['temp']-=_0x51241b;_0x182b44['temp']=_0x182b44[_0x8cff('0xbc')]>0x0?_0x182b44[_0x8cff('0xbc')]:0x0;loggerCatch(_0x8cff('0xbd'))(_0x41529c);});};Dialer[_0x8cff('0x1c')]['getContactDialerIvr']=function(_0x1f1758,_0x56674f,_0x388f6c,_0x341303){return BPromise[_0x8cff('0xb4')]()[_0x8cff('0xaf')](cmHopper[_0x8cff('0xbe')](_0x1f1758,_0x56674f,_0x388f6c))[_0x8cff('0xa8')](function(_0xedca42){_0x341303[_0x8cff('0xbc')]-=_0x56674f;_0x341303[_0x8cff('0xbc')]=_0x341303[_0x8cff('0xbc')]>0x0?_0x341303[_0x8cff('0xbc')]:0x0;loggerCatch(_0x8cff('0xbf'))(_0xedca42);});};Dialer[_0x8cff('0x1c')][_0x8cff('0xc0')]=function(_0x221d5d){return BPromise['resolve']()[_0x8cff('0xaf')](voiceQueueRt[_0x8cff('0xc0')](_0x221d5d))[_0x8cff('0xa8')](loggerCatch(_0x8cff('0xc1')));};Dialer['prototype']['moveContactManagedDialer']=function(_0x5a7822){return BPromise[_0x8cff('0xb4')]()[_0x8cff('0xaf')](cmHopper[_0x8cff('0xc2')](_0x5a7822))[_0x8cff('0xa8')](loggerCatch('[moveContactManagedDialer]\x20'));};Dialer[_0x8cff('0x1c')]['createHistory']=function(_0x1834a2){return BPromise['resolve']()[_0x8cff('0xaf')](cmHopperHistory[_0x8cff('0xc3')](_0x1834a2))[_0x8cff('0xa8')](loggerCatch(_0x8cff('0xc4')));};Dialer['prototype'][_0x8cff('0xaa')]=function(_0x325069){if(!_['isUndefined'](_0x325069)&&_0x325069!==null){if(typeof _0x325069[_0x8cff('0x71')]!==_0x8cff('0x90')){if(_0x325069[_0x8cff('0x71')]>0x0){_0x325069[_0x8cff('0x71')]-=0x1;}else{logger[_0x8cff('0x8d')](_0x8cff('0xc5'));}}}else{logger[_0x8cff('0x8d')](_0x8cff('0xc6'));}};Dialer[_0x8cff('0x1c')][_0x8cff('0xc7')]=function(_0x46ded3,_0x5bbce1){var _0x4ec289=this;return function(_0x57de9c){_0x4ec289[_0x8cff('0xaa')](_0x5bbce1);logger[_0x8cff('0x8d')](_0x46ded3,util[_0x8cff('0x8e')](_0x57de9c,{'showHidden':![],'depth':null}));};};Dialer[_0x8cff('0x1c')][_0x8cff('0xc8')]=function(_0x3cfa2c,_0x158562,_0x237be6){var _0x5d3875={'state':0x19,'statedesc':'notFound'};this[_0x8cff('0xaa')](_0x158562);this['saveInDb'](_['merge'](_0x5d3875,_[_0x8cff('0xc9')](_0x237be6,[_0x8cff('0xca'),_0x8cff('0xcb'),_0x8cff('0xcc'),_0x8cff('0xcd'),_0x8cff('0xce')])),_0x8cff('0xcf'),_0x8cff('0xd0'));logger[_0x8cff('0x8d')](_0x3cfa2c);};Dialer[_0x8cff('0x1c')][_0x8cff('0xd1')]=function(_0x41dd8c){return _0x41dd8c===_0x8cff('0xd2');};Dialer['prototype'][_0x8cff('0xd3')]=function(_0x1d9479){return!_[_0x8cff('0x3f')](_0x1d9479)&&_0x1d9479&&!_[_0x8cff('0x3f')](_0x1d9479[_0x8cff('0x47')])&&!_[_0x8cff('0x3f')](_0x1d9479[_0x8cff('0x75')])&&_0x1d9479[_0x8cff('0x75')]&&(this['trunks'][util['format'](_0x8cff('0xd4'),_0x1d9479[_0x8cff('0x47')])][_0x8cff('0xa6')]===_0x8cff('0xd5')||this[_0x8cff('0x24')][util['format'](_0x8cff('0xd4'),_0x1d9479[_0x8cff('0x47')])][_0x8cff('0xa6')]===_0x8cff('0xd6'));};Dialer[_0x8cff('0x1c')][_0x8cff('0xd7')]=function(_0x268e01,_0x4fc11d,_0x3e96c2){this['createHistory'](_0x268e01)[_0x8cff('0xa8')](loggerCatch(_0x4fc11d));this[_0x8cff('0xc2')](_0x268e01)[_0x8cff('0xa8')](loggerCatch(_0x3e96c2));};Dialer[_0x8cff('0x1c')][_0x8cff('0x3a')]=function(_0x6552cc){var _0x282e29=this[_0x8cff('0xa3')][_0x6552cc[_0x8cff('0xd8')]];var _0x37529d;if(!_[_0x8cff('0xd9')](_0x6552cc)&&!_[_0x8cff('0xd9')](_0x6552cc[_0x8cff('0xda')])&&!_[_0x8cff('0xd9')](_0x6552cc['variable']['amdstatus'])&&_0x6552cc['exten']==='xcally-motion-dialer'&&_0x282e29){if(_0x282e29[_0x8cff('0x4f')]!==_0x8cff('0x79')&&this[_0x8cff('0x22')][_0x282e29[_0x8cff('0xab')]][_0x8cff('0xdb')]&&_0x6552cc[_0x8cff('0xdc')]===_0x8cff('0xdd')){delete this['uniqueId'][_0x6552cc['uniqueid']];this[_0x8cff('0xaa')](this[_0x8cff('0x22')][_0x282e29[_0x8cff('0xab')]]);this[_0x8cff('0x22')][_0x282e29[_0x8cff('0xab')]]['outboundAnswerCallsDay']+=0x1;this[_0x8cff('0x22')][_0x282e29[_0x8cff('0xab')]][_0x8cff('0x5f')]+=0x1;_0x37529d=new Hangup(_0x282e29,_0x6552cc);_0x37529d[_0x8cff('0x9e')]=0x12;_0x37529d['statedesc']='HangupInAMD';_0x37529d[_0x8cff('0xde')]=_0x8cff('0xdf');ami[_0x8cff('0x4e')](_0x8cff('0xe0'),ut['buildObj'](_0x37529d,_0x8cff('0xe1')));this[_0x8cff('0xd7')](_0x37529d,'[syncHangupInAMD][createHistory]','[syncHangupInAMD]');}if(_0x282e29[_0x8cff('0x4f')]!=='ivr'&&this['voiceQueues'][_0x282e29['queue']]['dialAMDActive']&&_0x6552cc[_0x8cff('0xdc')]===_0x8cff('0xe2')){var _0x3042b0=this;return new BPromise(function(_0x59d6f8,_0x51de38){delete _0x3042b0[_0x8cff('0xa3')][_0x6552cc['uniqueid']];_0x3042b0[_0x8cff('0xaa')](_0x3042b0[_0x8cff('0x22')][_0x282e29[_0x8cff('0xab')]]);_0x3042b0['voiceQueues'][_0x282e29[_0x8cff('0xab')]][_0x8cff('0x60')]+=0x1;_0x3042b0[_0x8cff('0x22')][_0x282e29[_0x8cff('0xab')]][_0x8cff('0x5f')]+=0x1;var _0x4b6de2=_0x3042b0[_0x8cff('0x22')][_0x282e29['queue']];var _0x281dce=new Hangup(_0x282e29,_0x6552cc);_0x281dce[_0x8cff('0x9e')]=0x13;_0x281dce['statedesc']='Machine';_0x281dce[_0x8cff('0xde')]=_0x8cff('0xdf');_0x281dce[_0x8cff('0xe3')]+=0x1;_0x281dce['countglobal']+=0x1;_0x281dce[_0x8cff('0xe1')]=!![];ami[_0x8cff('0x4e')]('custom:amd',ut['buildObj'](_0x281dce,_0x8cff('0xe1')));_0x3042b0[_0x8cff('0xc3')](_0x281dce)[_0x8cff('0xa8')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x281dce['countbusyretry']+_0x281dce[_0x8cff('0xe4')]+_0x281dce[_0x8cff('0xe5')]+_0x281dce[_0x8cff('0xe6')]+_0x281dce[_0x8cff('0xe7')]+_0x281dce[_0x8cff('0xe8')]+_0x281dce[_0x8cff('0xe3')]+_0x281dce['countagentrejectretry']>=_0x4b6de2[_0x8cff('0xe9')]){_0x3042b0['stateGlobal'](_0x281dce,_0x59d6f8,_0x51de38,_0x8cff('0xea'));}else{if(_0x281dce[_0x8cff('0xe3')]>=_0x4b6de2[_0x8cff('0xeb')]){_0x3042b0[_0x8cff('0xec')](_0x281dce,_0x59d6f8,_0x51de38,_0x8cff('0xed'));}else{_0x3042b0['rescheduleContact']({'active':![],'countmachineretry':_0x281dce[_0x8cff('0xe3')],'scheduledat':moment()[_0x8cff('0xee')](_0x4b6de2[_0x8cff('0xef')],'minutes')[_0x8cff('0x76')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x281dce['ContactId'],'ListId':_0x281dce[_0x8cff('0xcb')],'VoiceQueueId':_0x281dce[_0x8cff('0xcd')]||undefined,'CampaignId':_0x281dce[_0x8cff('0xce')]||undefined})['catch'](loggerCatch(_0x8cff('0xf0')));_0x59d6f8({'reschedule':0x1});}}});}if(_0x282e29[_0x8cff('0x4f')]===_0x8cff('0x79')&&this[_0x8cff('0x23')][_0x282e29['queue']][_0x8cff('0xdb')]&&_0x6552cc[_0x8cff('0xdc')]==='HANGUP'){delete this['uniqueId'][_0x6552cc['uniqueid']];this['updateOriginated'](this[_0x8cff('0x23')][_0x282e29[_0x8cff('0xab')]]);_0x37529d=new Hangup(_0x282e29,_0x6552cc);_0x37529d[_0x8cff('0x9e')]=0x12;_0x37529d[_0x8cff('0x9f')]=_0x8cff('0xf1');_0x37529d[_0x8cff('0xde')]=_0x8cff('0xdf');ami['emit'](_0x8cff('0xe0'),ut[_0x8cff('0xf2')](_0x37529d,_0x8cff('0xe1')));this[_0x8cff('0xd7')](_0x37529d,'[syncHangupInAMDIvr][createHistory]',_0x8cff('0xf3'));}if(_0x282e29[_0x8cff('0x4f')]===_0x8cff('0x79')&&this['campaigns'][_0x282e29[_0x8cff('0xab')]]['dialAMDActive']&&_0x6552cc['value']===_0x8cff('0xe2')){var _0x3042b0=this;return new BPromise(function(_0x590271,_0xcfb422){delete _0x3042b0[_0x8cff('0xa3')][_0x6552cc[_0x8cff('0xd8')]];_0x3042b0[_0x8cff('0xaa')](_0x3042b0[_0x8cff('0x23')][_0x282e29[_0x8cff('0xab')]]);_0x3042b0[_0x8cff('0x23')][_0x282e29['queue']][_0x8cff('0x60')]+=0x1;_0x3042b0[_0x8cff('0x23')][_0x282e29[_0x8cff('0xab')]][_0x8cff('0x5f')]+=0x1;var _0x2ec28e=_0x3042b0[_0x8cff('0x23')][_0x282e29[_0x8cff('0xab')]];var _0x50e4db=new Hangup(_0x282e29,_0x6552cc);_0x50e4db[_0x8cff('0x9e')]=0x13;_0x50e4db[_0x8cff('0x9f')]=_0x8cff('0xf4');_0x50e4db[_0x8cff('0xde')]=_0x8cff('0xdf');_0x50e4db[_0x8cff('0xe3')]+=0x1;_0x50e4db[_0x8cff('0xf5')]+=0x1;_0x50e4db[_0x8cff('0xe1')]=!![];ami[_0x8cff('0x4e')](_0x8cff('0xe0'),ut[_0x8cff('0xf2')](_0x50e4db,_0x8cff('0xe1')));_0x3042b0[_0x8cff('0xc3')](_0x50e4db)[_0x8cff('0xa8')](loggerCatch(_0x8cff('0xf6')));if(_0x50e4db[_0x8cff('0xf7')]+_0x50e4db['countcongestionretry']+_0x50e4db[_0x8cff('0xe5')]+_0x50e4db[_0x8cff('0xe6')]+_0x50e4db[_0x8cff('0xe7')]+_0x50e4db[_0x8cff('0xe8')]+_0x50e4db['countmachineretry']+_0x50e4db['countagentrejectretry']>=_0x2ec28e[_0x8cff('0xe9')]){_0x3042b0['stateGlobal'](_0x50e4db,_0x590271,_0xcfb422,'reason19\x20machine....');}else{if(_0x50e4db[_0x8cff('0xe3')]>=_0x2ec28e[_0x8cff('0xeb')]){_0x3042b0[_0x8cff('0xec')](_0x50e4db,_0x590271,_0xcfb422,'reason\x2019\x20machine....');}else{_0x3042b0['rescheduleContact']({'active':![],'countmachineretry':_0x50e4db[_0x8cff('0xe3')],'scheduledat':moment()['add'](_0x2ec28e[_0x8cff('0xef')],_0x8cff('0xf8'))[_0x8cff('0x76')](_0x8cff('0xf9')),'ContactId':_0x50e4db[_0x8cff('0xca')],'ListId':_0x50e4db[_0x8cff('0xcb')],'VoiceQueueId':_0x50e4db[_0x8cff('0xcd')]||undefined,'CampaignId':_0x50e4db['CampaignId']||undefined})[_0x8cff('0xa8')](loggerCatch('[rescheduleContact][Machine]'));_0x590271({'reschedule':0x1});}}});}}};Dialer[_0x8cff('0x1c')]['syncHangup']=function(_0x217070){var _0x4d2411=this[_0x8cff('0xa3')][_0x217070[_0x8cff('0xd8')]];var _0x48d1b=this;var _0x2ae117;if(_0x4d2411&&_0x4d2411['type']===_0x8cff('0x79')){delete this['uniqueId'][_0x217070[_0x8cff('0xd8')]];this['updateOriginated'](this[_0x8cff('0x23')][_0x4d2411[_0x8cff('0xab')]]);this[_0x8cff('0x23')][_0x4d2411[_0x8cff('0xab')]][_0x8cff('0xfa')]+=0x1;_0x2ae117=new Hangup(_0x4d2411,_0x217070);this[_0x8cff('0xc3')](_0x2ae117)[_0x8cff('0xa8')](loggerCatch('[syncHangupIvr][createHistory]'));this['moveContactManagedDialer'](_0x2ae117)[_0x8cff('0xa8')](loggerCatch(_0x8cff('0xfb')));}if(_0x4d2411&&_0x4d2411[_0x8cff('0x4f')]!=='ivr'&&isNotNull(this[_0x8cff('0x22')][_0x4d2411[_0x8cff('0xab')]][_0x8cff('0xfc')])){delete this[_0x8cff('0xa3')][_0x217070[_0x8cff('0xd8')]];this[_0x8cff('0xaa')](this[_0x8cff('0x22')][_0x4d2411['queue']]);this['voiceQueues'][_0x4d2411[_0x8cff('0xab')]][_0x8cff('0x60')]+=0x1;this[_0x8cff('0x22')][_0x4d2411[_0x8cff('0xab')]][_0x8cff('0x5f')]+=0x1;_0x2ae117=new Hangup(_0x4d2411,_0x217070);_0x2ae117[_0x8cff('0x9e')]=0x10;_0x2ae117[_0x8cff('0x9f')]='AnswerAGI';_0x2ae117[_0x8cff('0xde')]=_0x8cff('0xfd');this['createHistory'](_0x2ae117)[_0x8cff('0xa8')](loggerCatch(_0x8cff('0xfe')));this['moveContactManagedDialer'](_0x2ae117)[_0x8cff('0xa8')](loggerCatch('[syncHangupIvr]'));}if(_0x4d2411&&_0x4d2411['type']!==_0x8cff('0x79')&&!isNotNull(this[_0x8cff('0x22')][_0x4d2411[_0x8cff('0xab')]][_0x8cff('0xfc')])){delete this['uniqueId'][_0x217070[_0x8cff('0xd8')]];this[_0x8cff('0xaa')](this[_0x8cff('0x22')][_0x4d2411[_0x8cff('0xab')]]);this[_0x8cff('0x22')][_0x4d2411[_0x8cff('0xab')]][_0x8cff('0x67')]+=0x1;_0x2ae117=new Hangup(_0x4d2411,_0x217070);_0x2ae117[_0x8cff('0x9e')]=0xc;_0x2ae117[_0x8cff('0x9f')]=_0x217070[_0x8cff('0xff')];_0x2ae117[_0x8cff('0xde')]=_0x8cff('0x100');this[_0x8cff('0xc3')](_0x2ae117)[_0x8cff('0xa8')](loggerCatch('[syncHangupIvr][createHistory]'));this[_0x8cff('0xc2')](_0x2ae117)[_0x8cff('0xa8')](loggerCatch(_0x8cff('0xfb')));}};Dialer[_0x8cff('0x1c')][_0x8cff('0x34')]=function(_0x2ea360){var _0x231b92=this[_0x8cff('0xa3')][_0x2ea360[_0x8cff('0xd8')]];var _0x34295c=this;if(this[_0x8cff('0x22')][_0x2ea360[_0x8cff('0xab')]]){if(_0x231b92&&_0x231b92['type']!==_0x8cff('0x79')){delete this[_0x8cff('0xa3')][_0x2ea360[_0x8cff('0xd8')]];this[_0x8cff('0x22')][_0x2ea360[_0x8cff('0xab')]][_0x8cff('0x60')]+=0x1;var _0x9aaf7d=new AgentComplete(_0x231b92,_0x2ea360);if(_0x2ea360['reason']===_0x8cff('0x101')){_0x9aaf7d[_0x8cff('0x102')]=this['voiceQueues'][_0x2ea360[_0x8cff('0xab')]][_0x8cff('0x103')]&&this[_0x8cff('0x22')][_0x2ea360[_0x8cff('0xab')]][_0x8cff('0x104')]?moment()[_0x8cff('0x76')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;}this[_0x8cff('0xc3')](_0x9aaf7d)[_0x8cff('0xa8')](loggerCatch(_0x8cff('0x105')));this[_0x8cff('0xc2')](_0x9aaf7d)[_0x8cff('0xa8')](loggerCatch(_0x8cff('0x106')));}}};Dialer[_0x8cff('0x1c')][_0x8cff('0x107')]=function(_0x39385){if(this['voiceQueues'][_0x39385[_0x8cff('0xab')]]){if(this['uniqueId'][_0x39385[_0x8cff('0xd8')]]&&this['uniqueId'][_0x39385[_0x8cff('0xd8')]][_0x8cff('0x4f')]!=='ivr'){this[_0x8cff('0xaa')](this[_0x8cff('0x22')][_0x39385[_0x8cff('0xab')]]);this[_0x8cff('0xa3')][_0x39385[_0x8cff('0xd8')]][_0x8cff('0x108')]=moment()[_0x8cff('0x76')](_0x8cff('0xf9'));}}};Dialer[_0x8cff('0x1c')][_0x8cff('0x109')]=function(_0x41f41a){this['createHistory'](_0x41f41a)[_0x8cff('0xa8')](loggerCatch(_0x8cff('0x105')));this[_0x8cff('0xc2')](_0x41f41a)['catch'](loggerCatch('[syncQueueCallerAbandon]\x20[Drop]'));};Dialer[_0x8cff('0x1c')][_0x8cff('0x10a')]=function(_0x3746fa){var _0xf11041=this[_0x8cff('0xa3')][_0x3746fa[_0x8cff('0xd8')]];var _0x1d68a4=this;if(this[_0x8cff('0x22')][_0x3746fa['queue']]){if(_0xf11041&&_0xf11041[_0x8cff('0x4f')]!=='ivr'){delete this[_0x8cff('0xa3')][_0x3746fa[_0x8cff('0xd8')]];this['updateOriginated'](this[_0x8cff('0x22')][_0x3746fa['queue']]);_0xf11041[_0x8cff('0x10b')]=moment()['format'](_0x8cff('0xf9'));var _0x1ec6a5=new QueueCallerAbandon(_0xf11041,_0x3746fa);if(getSeconds(_0xf11041['droptime'],_0xf11041[_0x8cff('0x10c')])>=_0xf11041[_0x8cff('0x10d')]){this[_0x8cff('0x22')][_0x3746fa[_0x8cff('0xab')]][_0x8cff('0x6b')]+=0x1;this[_0x8cff('0x22')][_0x3746fa[_0x8cff('0xab')]][_0x8cff('0x65')]+=0x1;this['voiceQueues'][_0x3746fa[_0x8cff('0xab')]][_0x8cff('0x10e')]+=0x1;_0x1ec6a5['state']=0xa;_0x1ec6a5['statedesc']=_0x8cff('0x10f');_0x1ec6a5['dropreason']=_0x8cff('0x110');_0x1ec6a5[_0x8cff('0x102')]=this[_0x8cff('0x22')][_0x3746fa[_0x8cff('0xab')]][_0x8cff('0x103')]?moment()[_0x8cff('0x76')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;_0x1ec6a5['countdropretry']+=0x1;_0x1ec6a5[_0x8cff('0xf5')]+=0x1;if(_0x1ec6a5[_0x8cff('0xe7')]>=this['voiceQueues'][_0x3746fa[_0x8cff('0xab')]][_0x8cff('0x111')]){this[_0x8cff('0x109')](_0x1ec6a5);}else{this['rescheduleContact']({'active':![],'countdropretry':_0x1ec6a5[_0x8cff('0xe7')],'scheduledat':moment()['add'](this[_0x8cff('0x22')][_0x3746fa[_0x8cff('0xab')]][_0x8cff('0x112')],_0x8cff('0xf8'))['format'](_0x8cff('0xf9')),'ContactId':_0xf11041[_0x8cff('0xca')],'ListId':_0xf11041[_0x8cff('0xcb')],'VoiceQueueId':_0xf11041[_0x8cff('0xcd')]||undefined,'CampaignId':_0xf11041[_0x8cff('0xce')]||undefined})[_0x8cff('0xa8')](loggerCatch(_0x8cff('0x113')));var _0x5d6d64=new History(_0x1ec6a5);_0x5d6d64[_0x8cff('0x9e')]=0xa;_0x5d6d64[_0x8cff('0x9f')]=_0x8cff('0x10f');_0x5d6d64[_0x8cff('0xa0')]=moment()[_0x8cff('0x76')](_0x8cff('0xf9'));_0x5d6d64[_0x8cff('0x114')]=_0x5d6d64[_0x8cff('0xa0')];_0x5d6d64['calleridname']=_0x1ec6a5[_0x8cff('0x115')];_0x5d6d64['calleridnum']=_0x1ec6a5[_0x8cff('0x116')];this[_0x8cff('0xc3')](_0x5d6d64)[_0x8cff('0xa8')](loggerCatch('[syncAgentComplete][createHistory][10]'));}}else{this[_0x8cff('0x22')][_0x3746fa[_0x8cff('0xab')]][_0x8cff('0x6a')]+=0x1;this[_0x8cff('0x22')][_0x3746fa[_0x8cff('0xab')]][_0x8cff('0x64')]+=0x1;_0x1ec6a5['state']=0xb;_0x1ec6a5[_0x8cff('0x9f')]=_0x8cff('0x117');_0x1ec6a5[_0x8cff('0x118')]=_0x8cff('0x119');_0x1ec6a5[_0x8cff('0xe8')]+=0x1;_0x1ec6a5[_0x8cff('0xf5')]+=0x1;if(_0x1ec6a5['countabandonedretry']>=this[_0x8cff('0x22')][_0x3746fa['queue']]['dialAbandonedMaxRetry']){this[_0x8cff('0x109')](_0x1ec6a5);}else{this[_0x8cff('0x11a')]({'active':![],'countabandonedretry':_0x1ec6a5[_0x8cff('0xe8')],'scheduledat':moment()['add'](this[_0x8cff('0x22')][_0x3746fa[_0x8cff('0xab')]][_0x8cff('0x11b')],'minutes')[_0x8cff('0x76')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0xf11041['ContactId'],'ListId':_0xf11041['ListId'],'VoiceQueueId':_0xf11041[_0x8cff('0xcd')]||undefined,'CampaignId':_0xf11041[_0x8cff('0xce')]||undefined})['catch'](loggerCatch(_0x8cff('0x11c')));var _0x5d6d64=new History(_0x1ec6a5);_0x5d6d64['state']=0xb;_0x5d6d64[_0x8cff('0x9f')]=_0x8cff('0x117');_0x5d6d64[_0x8cff('0xa0')]=moment()['format'](_0x8cff('0xf9'));_0x5d6d64[_0x8cff('0x114')]=_0x5d6d64['starttime'];_0x5d6d64[_0x8cff('0x115')]=_0x1ec6a5[_0x8cff('0x115')];_0x5d6d64[_0x8cff('0x116')]=_0x1ec6a5[_0x8cff('0x116')];this[_0x8cff('0xc3')](_0x5d6d64)[_0x8cff('0xa8')](loggerCatch(_0x8cff('0x11d')));}}}}};Dialer[_0x8cff('0x1c')][_0x8cff('0x38')]=function(_0x2bc8ce){if(this[_0x8cff('0x27')][_0x2bc8ce['uniqueid']]){this[_0x8cff('0x27')][_0x2bc8ce[_0x8cff('0xd8')]][_0x8cff('0xa7')]=_0x2bc8ce[_0x8cff('0xa7')];}if(this['uniqueId'][_0x2bc8ce[_0x8cff('0xd8')]]){this[_0x8cff('0xa3')][_0x2bc8ce['uniqueid']][_0x8cff('0xa7')]=_0x2bc8ce['channel'];}};Dialer[_0x8cff('0x1c')][_0x8cff('0x3c')]=function(_0x4760f1){if(strategy[this[_0x8cff('0x22')][this[_0x8cff('0x27')][_0x4760f1['actionid']]['queue']][_0x8cff('0x51')]]===_0x8cff('0x1b')){if(this['actions'][_0x4760f1[_0x8cff('0x11e')]]&&_[_0x8cff('0xd9')](this[_0x8cff('0x27')][_0x4760f1['actionid']][_0x8cff('0x11f')])&&_0x4760f1['status']==='1'&&_0x4760f1[_0x8cff('0x120')]==='0'){if(this['agents'][_0x4760f1[_0x8cff('0x121')]]){if(!this[_0x8cff('0x122')][_0x4760f1['stateinterface']][_0x8cff('0x11f')]){this[_0x8cff('0x122')][_0x4760f1[_0x8cff('0x121')]][_0x8cff('0x11f')]=!![];this[_0x8cff('0x27')][_0x4760f1['actionid']]['locked']=!![];this[_0x8cff('0x27')][_0x4760f1[_0x8cff('0x11e')]][_0x8cff('0x121')]=_0x4760f1[_0x8cff('0x121')];}}}}else if((strategy[this[_0x8cff('0x22')][this['actions'][_0x4760f1[_0x8cff('0x11e')]][_0x8cff('0xab')]]['strategy']]||_0x8cff('0x123'))===_0x8cff('0x123')){if(this[_0x8cff('0x27')][_0x4760f1[_0x8cff('0x11e')]]){if(this[_0x8cff('0x122')][_0x4760f1[_0x8cff('0x121')]]){this[_0x8cff('0x27')][_0x4760f1[_0x8cff('0x11e')]][_0x8cff('0x121')]=_0x4760f1[_0x8cff('0x121')];if(_[_0x8cff('0xd9')](this['queueBooked'][this[_0x8cff('0x27')][_0x4760f1['actionid']][_0x8cff('0xab')]])){this['queueBooked'][this['actions'][_0x4760f1['actionid']]['queue']]=[];}this[_0x8cff('0x2d')][this[_0x8cff('0x27')][_0x4760f1['actionid']][_0x8cff('0xab')]][_0x8cff('0x124')](_[_0x8cff('0x87')](_['pick'](this[_0x8cff('0x27')][_0x4760f1[_0x8cff('0x11e')]],['idHopper',_0x8cff('0x121')]),{'status':_0x4760f1['status'],'paused':_0x4760f1[_0x8cff('0x120')]}));}}}};function unlockQueueStatus(_0x2d7577,_0x2cce78){setTimeout(function(){if(_['isUndefined'](_0x2d7577[_0x8cff('0x125')])){loggerBooked['error'](_0x8cff('0x126'),_0x2cce78);}_0x2d7577['queueStatusComplete']=!![];loggerBooked[_0x8cff('0x7d')]('[booked][unlockQueueStatus]',_0x2cce78,JSON[_0x8cff('0x127')](_['pick'](_0x2d7577,[_0x8cff('0x47'),_0x8cff('0x125')])));},0x1f3);}Dialer['prototype'][_0x8cff('0x3e')]=function(_0x25dd37){var _0x12fdb4=this;var _0x5dc98c=_0x12fdb4[_0x8cff('0x22')][_0x12fdb4[_0x8cff('0x27')][_0x25dd37[_0x8cff('0x11e')]][_0x8cff('0xab')]];if(strategy[this[_0x8cff('0x22')][this[_0x8cff('0x27')][_0x25dd37[_0x8cff('0x11e')]][_0x8cff('0xab')]]['strategy']]===_0x8cff('0x1b')){if(this['actions'][_0x25dd37[_0x8cff('0x11e')]]&&this[_0x8cff('0x27')][_0x25dd37['actionid']][_0x8cff('0x121')]){this[_0x8cff('0x21')]['run'](this[_0x8cff('0x27')][_0x25dd37['actionid']][_0x8cff('0x128')],this[_0x8cff('0x27')][_0x25dd37[_0x8cff('0x11e')]]['stateinterface'])['catch'](function(_0x311449){logger[_0x8cff('0x8d')](_0x8cff('0x129'),util[_0x8cff('0x8e')](_0x311449,{'showHidden':![],'depth':null}));})[_0x8cff('0x1f')](function(){_0x12fdb4[_0x8cff('0xaa')](_0x12fdb4['voiceQueues'][_0x12fdb4[_0x8cff('0x27')][_0x25dd37[_0x8cff('0x11e')]][_0x8cff('0xab')]]);_0x12fdb4[_0x8cff('0x122')][_0x12fdb4[_0x8cff('0x27')][_0x25dd37['actionid']][_0x8cff('0x121')]][_0x8cff('0x11f')]=![];delete _0x12fdb4[_0x8cff('0x27')][_0x25dd37[_0x8cff('0x11e')]];unlockQueueStatus(_0x5dc98c);});}else{this[_0x8cff('0xaa')](this[_0x8cff('0x22')][this['actions'][_0x25dd37[_0x8cff('0x11e')]]['queue']]);this[_0x8cff('0x11a')]({'active':![],'ContactId':this['actions'][_0x25dd37[_0x8cff('0x11e')]]['ContactId'],'ListId':this[_0x8cff('0x27')][_0x25dd37[_0x8cff('0x11e')]][_0x8cff('0xcb')],'VoiceQueueId':this[_0x8cff('0x27')][_0x25dd37[_0x8cff('0x11e')]][_0x8cff('0xcd')]||undefined,'CampaignId':this['actions'][_0x25dd37['actionid']]['CampaignId']||undefined})[_0x8cff('0xa8')](loggerCatch(_0x8cff('0x12a')));delete this[_0x8cff('0x27')][_0x25dd37[_0x8cff('0x11e')]];unlockQueueStatus(_0x5dc98c);}}else if((strategy[this['voiceQueues'][this[_0x8cff('0x27')][_0x25dd37[_0x8cff('0x11e')]][_0x8cff('0xab')]][_0x8cff('0x51')]]||_0x8cff('0x123'))===_0x8cff('0x123')){var _0x1aea2c;if(this[_0x8cff('0x27')][_0x25dd37[_0x8cff('0x11e')]]&&!_[_0x8cff('0x49')](this[_0x8cff('0x2d')][this[_0x8cff('0x27')][_0x25dd37[_0x8cff('0x11e')]][_0x8cff('0xab')]])){if(this[_0x8cff('0x2e')][_0x12fdb4[_0x8cff('0x27')][_0x25dd37[_0x8cff('0x11e')]][_0x8cff('0xab')]]){this[_0x8cff('0x2e')][_0x12fdb4['actions'][_0x25dd37[_0x8cff('0x11e')]]['queue']]=this[_0x8cff('0x2e')][this[_0x8cff('0x27')][_0x25dd37[_0x8cff('0x11e')]][_0x8cff('0xab')]]?this[_0x8cff('0x2e')][this['actions'][_0x25dd37[_0x8cff('0x11e')]][_0x8cff('0xab')]]:this[_0x8cff('0x2d')][this['actions'][_0x25dd37[_0x8cff('0x11e')]][_0x8cff('0xab')]]?this['queueBooked'][this[_0x8cff('0x27')][_0x25dd37[_0x8cff('0x11e')]]['queue']][_0x8cff('0x12b')]||0x0:0x0;}this[_0x8cff('0x2d')][this[_0x8cff('0x27')][_0x25dd37[_0x8cff('0x11e')]][_0x8cff('0xab')]][_0x8cff('0x12b')]=this['queueBookedRR'][this[_0x8cff('0x27')][_0x25dd37[_0x8cff('0x11e')]]['queue']];for(var _0x4a8c04=0x0;_0x4a8c04=0x0;})[_0x8cff('0xa8')](myreject(_0x3cdb4b)));}}else{_0x11a786[_0x8cff('0x124')](ami[_0x8cff('0xa5')]({'action':_0x8cff('0x141'),'command':util[_0x8cff('0x76')]('iftime\x20%s,%s',_0x36cda2,!_[_0x8cff('0x3f')](config['timezones'][_0x496835])?_0x496835:'')})[_0x8cff('0xaf')](function(_0x2668f4){return _0x2668f4[_0x8cff('0x145')][_0x8cff('0x147')]('true')>=0x0;})[_0x8cff('0xa8')](myreject(_0x3cdb4b)));}BPromise[_0x8cff('0x148')](_0x11a786)[_0x8cff('0xaf')](function(_0x2472d3){var _0x9d8637=_['some'](_0x2472d3);if(_0x9d8637){return _0x49b659(_0x9d8637);}else{_0x4b8eff[_0x8cff('0x42')]=_0x14a1ef?'GLOBAL_INTERVAL_IS_OVERTIME':_0x8cff('0x149');return _0x3cdb4b(msgResponse(_0x8cff('0x14a'),_0x8cff('0x13f'),_0x8cff('0x14b')+_0x14a1ef+'\x20'+_0x45abc1+'\x20Interval\x20is\x20overtime:\x20'+util[_0x8cff('0x8e')](_0x36cda2,{'showHidden':![],'depth':null})+_0x8cff('0x14c')+_0x496835));}})['catch'](function(_0x3b85e6){return _0x3cdb4b(msgResponse(_0x8cff('0x13b'),_0x8cff('0x13f'),JSON[_0x8cff('0x127')](_0x3b85e6)));});});};Dialer[_0x8cff('0x1c')]['checkDialMethod']=function(_0x975ca){var _0x108bbf=this;return function(){switch(_0x975ca[_0x8cff('0x14d')]){case _0x8cff('0x14e'):freeVariablesPredictive(_0x975ca);_0x108bbf[_0x8cff('0x14f')](_0x975ca,0x1);break;case _0x8cff('0x150'):freeVariablesPredictive(_0x975ca);_0x108bbf[_0x8cff('0x14f')](_0x975ca,_0x975ca[_0x8cff('0x151')]);break;case _0x8cff('0x8'):_0x108bbf['predictive'](_0x975ca);break;case'booked':freeVariablesPredictive(_0x975ca);_0x108bbf['handlePower'](_0x975ca,0x1);break;default:freeVariablesPredictive(_0x975ca);logger['error'](_0x8cff('0x152'),_0x975ca[_0x8cff('0x47')],_0x8cff('0x153'));}};};Dialer[_0x8cff('0x1c')][_0x8cff('0x154')]=function(_0x34e55f){var _0x961827=this;return function(){_0x961827[_0x8cff('0x155')](_0x34e55f);};};Dialer[_0x8cff('0x1c')][_0x8cff('0xa')]=function(_0x5214eb){var _0x460e6b=this;if(isNotPreview(_0x5214eb[_0x8cff('0x14d')])){if(isVoiceQueueOutbound(_0x5214eb[_0x8cff('0x4f')])&&isActive(_0x5214eb[_0x8cff('0x5b')])){_0x5214eb[_0x8cff('0x97')]=!![];BPromise[_0x8cff('0xb4')]()[_0x8cff('0xaf')](checkIsLoggedIn(_0x5214eb,_0x5214eb[_0x8cff('0x53')]))[_0x8cff('0xaf')](checkIsActive(_0x5214eb,_0x5214eb['dialActive']))[_0x8cff('0xaf')](checkInterval(_0x5214eb))[_0x8cff('0xaf')](_0x460e6b['checkIsTrunkReachable'](_0x5214eb))[_0x8cff('0xaf')](_0x460e6b[_0x8cff('0x13a')](_0x5214eb['dialGlobalInterval'],_0x5214eb[_0x8cff('0x156')],_0x5214eb[_0x8cff('0x47')],_0x5214eb))['then'](_0x460e6b[_0x8cff('0x13c')](_0x5214eb[_0x8cff('0x44')],_0x5214eb[_0x8cff('0x156')],_0x5214eb[_0x8cff('0x47')],_0x5214eb))[_0x8cff('0xaf')](_0x460e6b['checkDialMethod'](_0x5214eb))[_0x8cff('0xa8')](loggerCatchQueueSummary(_0x8cff('0x157'),_0x5214eb));}else{notSendMessagesQueue(_0x5214eb);}}else{freeVariablesPredictive(_0x5214eb);}};Dialer[_0x8cff('0x1c')][_0x8cff('0x137')]=function(){var _0x43cf14=this;var _0xd17e52;for(var _0x1fcbce in this[_0x8cff('0x23')]){if(typeof this[_0x8cff('0x23')][_0x1fcbce]!==_0x8cff('0x90')){_0xd17e52=this[_0x8cff('0x23')][_0x1fcbce];if(isCampaignIvr(_0xd17e52[_0x8cff('0x4f')])&&isActive(_0xd17e52[_0x8cff('0x75')])){_0xd17e52[_0x8cff('0x97')]=!![];BPromise[_0x8cff('0xb4')]()['then'](checkIsActive(_0xd17e52,_0xd17e52[_0x8cff('0x75')]))['then'](checkInterval(_0xd17e52))[_0x8cff('0xaf')](_0x43cf14[_0x8cff('0x138')](_0xd17e52))[_0x8cff('0xaf')](_0x43cf14[_0x8cff('0x13a')](_0xd17e52['dialGlobalInterval'],_0xd17e52[_0x8cff('0x156')],_0xd17e52['name'],_0xd17e52))[_0x8cff('0xaf')](_0x43cf14[_0x8cff('0x13c')](_0xd17e52[_0x8cff('0x44')],_0xd17e52[_0x8cff('0x156')],_0xd17e52[_0x8cff('0x47')],_0xd17e52))['then'](_0x43cf14[_0x8cff('0x154')](_0xd17e52))['catch'](loggerCatchQueueSummary(_0x8cff('0x158'),_0xd17e52));}else{notSendMessagesCampaign(_0xd17e52);}}}};function getCallerIdRandom(_0x265eb1,_0x260add){var _0x42f0ae;var _0x2fc413;var _0x309ef8;if(_0x260add<=0x0){_0x260add=0x1;}_0x42f0ae=new RegExp('\x5cw{0,'+_0x260add+'}$');_0x2fc413=Math['pow'](0xa,_0x260add-0x1);_0x309ef8=Math['pow'](0xa,_0x260add)-0x1;return util[_0x8cff('0x76')]('%s',_['replace'](_0x265eb1,_0x42f0ae,_[_0x8cff('0x159')](_0x2fc413,_0x309ef8)));}function extractCalleridName(_0x477839){var _0x30b8f8=_0x477839[_0x8cff('0x15a')](/"(.*?)"/);return _0x30b8f8?_0x30b8f8[0x1]:_0x477839;}function extractCalleridNumber(_0x24ebf7){var _0x420b7b=_0x24ebf7[_0x8cff('0x15a')](/<(.*?)>/);return _0x420b7b?_0x420b7b[0x1]:_0x24ebf7;}Dialer['prototype'][_0x8cff('0x15b')]=function(_0xf0b537,_0x4c67b7){var _0x1cac73=this;var _0x4869fa=uuid['v4']();this[_0x8cff('0x27')][_0x4869fa]=new Action(_0xf0b537,_0x4c67b7,_0x4869fa);return new BPromise(function(_0x3f41c8,_0xdd3bdd){if(_['isUndefined'](_0xf0b537)&&typeof _0xf0b537!=='object'){return _0xdd3bdd(msgResponse(_0x8cff('0x15c'),_0x8cff('0x13f'),_0x8cff('0x15d')));}if(_[_0x8cff('0x3f')](_0x4c67b7[_0x8cff('0x15e')]['phone'])||_0x4c67b7[_0x8cff('0x15e')][_0x8cff('0x15f')]===null){return _0xdd3bdd(msgResponse('originate','Failure',_0x8cff('0x160')));}var _0x28b05f={'XMD-CALLERID':_0x1cac73[_0x8cff('0x27')][_0x4869fa]['getCaller'](),'XMD-AGI':_0xf0b537['dialQueueProject']?util['format'](_0x8cff('0x161'),ipAgi,_0xf0b537[_0x8cff('0xfc')]):'NONE','XMD-AGIAFTER':_0xf0b537[_0x8cff('0x103')]?util[_0x8cff('0x76')]('\x22agi://%s/square,%s\x22',ipAgi,_0xf0b537[_0x8cff('0x103')]):_0x8cff('0x162'),'XMD-QUEUE':_0xf0b537[_0x8cff('0x4f')]===_0x8cff('0x50')?util['format']('\x22%s,%s%s,,,%s\x22',_0xf0b537[_0x8cff('0x47')],_0xf0b537['dialQueueOptions']||'',_0xf0b537[_0x8cff('0x104')]?'c':'',_0xf0b537[_0x8cff('0x10d')]||0x3):_0x8cff('0x162'),'XMD-CONTACTID':_0x4c67b7[_0x8cff('0xca')],'XMD-CDRTYPE':_0x8cff('0x163'),'CALLERID(all)':_0x1cac73['actions'][_0x4869fa][_0x8cff('0x164')](),'XMD-AMD':_0xf0b537['dialAMDActive']?_0x8cff('0x165'):'NONE','XMD-DESTINATION':_0x8cff('0x166')};if(_0xf0b537['dialAMDActive']){_0x28b05f[_0x8cff('0x167')]=_0xf0b537[_0x8cff('0x168')]||0x9c4;_0x28b05f['XMD-AMDGREETING']=_0xf0b537[_0x8cff('0x169')]||0x5dc;_0x28b05f[_0x8cff('0x16a')]=_0xf0b537[_0x8cff('0x16b')]||0x320;_0x28b05f[_0x8cff('0x16c')]=_0xf0b537[_0x8cff('0x16d')]||0x1388;_0x28b05f['XMD-AMDMINWORDLENGTH']=_0xf0b537[_0x8cff('0x16e')]||0x64;_0x28b05f[_0x8cff('0x16f')]=_0xf0b537['dialAMDBetweenWordsSilence']||0x32;_0x28b05f[_0x8cff('0x170')]=_0xf0b537['dialAMDMaximumNumberOfWords']||0x3;_0x28b05f[_0x8cff('0x171')]=_0xf0b537['dialAMDSilenceThreshold']||0x100;_0x28b05f['XMD-AMDMAXIMUMWORDLENGTH']=_0xf0b537[_0x8cff('0x172')]||0x1388;}if(_0xf0b537[_0x8cff('0x4f')]==='outbound'){_0x28b05f[_0x8cff('0x173')]=_0x4c67b7[_0x8cff('0xcd')];}else{_0x28b05f['XMD-CAMPAIGNID']=_0x4c67b7[_0x8cff('0xce')];}for(var _0x292ec0 in _0x4c67b7[_0x8cff('0x15e')]){if(typeof _0x4c67b7[_0x8cff('0x15e')][_0x292ec0]!==_0x8cff('0x90')){if(isNotNull(_0x4c67b7[_0x8cff('0x15e')][_0x292ec0])&&_0x292ec0!=='id'&&_0x292ec0!=='tags'&&_0x292ec0!==_0x8cff('0x174')&&_0x292ec0!==_0x8cff('0x175')){_0x28b05f[util[_0x8cff('0x76')](_0x8cff('0x176'),_0x8cff('0x177'),_[_0x8cff('0x178')](_0x292ec0))]=_0x4c67b7['Contact'][_0x292ec0];}}}var _0x35335d=_0x1cac73[_0x8cff('0xd3')](_0xf0b537[_0x8cff('0x74')])?getCallerId(_0xf0b537['Trunk'][_0x8cff('0x179')],_0xf0b537[_0x8cff('0x17a')],_0xf0b537[_0x8cff('0x17b')]>0x0?getCallerIdRandom(_0xf0b537[_0x8cff('0x5c')],_0xf0b537[_0x8cff('0x17b')]):_0xf0b537[_0x8cff('0x5c')]):getCallerId(_[_0x8cff('0xd9')](_0xf0b537[_0x8cff('0x17c')])?_0xf0b537['Trunk'][_0x8cff('0x179')]:_0xf0b537[_0x8cff('0x17c')][_0x8cff('0x179')],_0xf0b537[_0x8cff('0x17a')],_0xf0b537[_0x8cff('0x17b')]>0x0?getCallerIdRandom(_0xf0b537[_0x8cff('0x5c')],_0xf0b537[_0x8cff('0x17b')]):_0xf0b537[_0x8cff('0x5c')]);if(_0x35335d){_0x28b05f[_0x8cff('0x17d')]=_0x1cac73[_0x8cff('0x27')][_0x4869fa][_0x8cff('0x17e')]=extractCalleridName(_0x35335d);_0x28b05f[_0x8cff('0x17f')]=_0x1cac73[_0x8cff('0x27')][_0x4869fa][_0x8cff('0x180')]=extractCalleridNumber(_0x35335d);}return ami[_0x8cff('0xa5')]({'actionid':_0x4869fa,'action':_0x8cff('0x15c'),'channel':_0x1cac73[_0x8cff('0xd3')](_0xf0b537[_0x8cff('0x74')])?util['format'](_0x8cff('0x181'),_0xf0b537[_0x8cff('0x74')][_0x8cff('0x47')],isNotNull(_0xf0b537[_0x8cff('0x5e')])?_0xf0b537[_0x8cff('0x5e')][_0x8cff('0x182')]()||'':'',_0xf0b537[_0x8cff('0x183')]>0x0?_0x4c67b7[_0x8cff('0x15e')][_0x8cff('0x15f')]['substring'](_0xf0b537['dialCutDigit']):_0x4c67b7[_0x8cff('0x15e')][_0x8cff('0x15f')]):util[_0x8cff('0x76')](_0x8cff('0x181'),_[_0x8cff('0xd9')](_0xf0b537[_0x8cff('0x17c')])?_0xf0b537['Trunk'][_0x8cff('0x47')]:_0xf0b537[_0x8cff('0x17c')]['name'],isNotNull(_0xf0b537['dialPrefix'])?_0xf0b537[_0x8cff('0x5e')][_0x8cff('0x182')]()||'':'',_0xf0b537['dialCutDigit']>0x0?_0x4c67b7[_0x8cff('0x15e')]['phone']['substring'](_0xf0b537['dialCutDigit']):_0x4c67b7[_0x8cff('0x15e')][_0x8cff('0x15f')]),'callerid':_0x35335d,'Exten':_0x8cff('0x166'),'Context':'from-sip','Priority':'1','variable':_0x28b05f,'timeout':(_0xf0b537[_0x8cff('0x5d')]||0x1e)*0x3e8,'async':!![],'channelid':_0x4869fa})[_0x8cff('0xaf')](function(_0x52765a){return _0x3f41c8(_0x52765a);})[_0x8cff('0xa8')](function(_0x463a89){_0xf0b537[_0x8cff('0x66')]+=0x1;var _0x1253b7=new History(_0x1cac73[_0x8cff('0x27')][_0x4869fa]);logger[_0x8cff('0x8d')](util[_0x8cff('0x76')]('[originateError]:\x20%s',JSON[_0x8cff('0x127')](_0x463a89)));_0x1253b7[_0x8cff('0x9e')]=0xe;_0x1253b7['statedesc']='OriginateError';_0x1253b7['starttime']=moment()[_0x8cff('0x76')]('YYYY-MM-DD\x20HH:mm:ss');_0x1253b7[_0x8cff('0x114')]=_0x1253b7[_0x8cff('0xa0')];_0x1cac73['createHistory'](_0x1253b7)['catch'](loggerCatch('[originate][error]'));_0x1cac73[_0x8cff('0xc2')](_0x1253b7)[_0x8cff('0xa8')](loggerCatch(_0x8cff('0x184')))['finally'](function(){delete _0x1cac73[_0x8cff('0x27')][_0x4869fa];return _0xdd3bdd(msgResponse(_0x8cff('0x15c'),_0x8cff('0x4b'),_0x8cff('0x185')));});});});};Dialer['prototype'][_0x8cff('0x32')]=function(_0x645d3c){var _0x19471f=this[_0x8cff('0x27')][_0x645d3c[_0x8cff('0x11e')]];if(_0x19471f){delete this[_0x8cff('0x27')][_0x645d3c[_0x8cff('0x11e')]];_0x19471f[_0x8cff('0x10c')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');var _0x9db19f=_0x19471f[_0x8cff('0x4f')]===_0x8cff('0x79')?this['campaigns'][_0x19471f['queue']]:this[_0x8cff('0x22')][_0x19471f['getQueue']()];if(!this[_0x8cff('0xd1')](_0x645d3c[_0x8cff('0x186')])){this[_0x8cff('0xaa')](_0x9db19f);return this[_0x8cff('0x187')](_0x19471f,_0x9db19f,_0x645d3c)[_0x8cff('0xa8')](loggerCatch(_0x8cff('0x188')));}this[_0x8cff('0xa3')][_0x645d3c[_0x8cff('0xd8')]]=_0x19471f;}};Dialer[_0x8cff('0x1c')]['checkRetriveMax']=function(_0x4a16f5,_0x476bf5,_0x4e97a9){var _0x253422=new History(_0x476bf5);if(_0x253422[_0x8cff('0xf7')]+_0x253422[_0x8cff('0xe4')]+_0x253422[_0x8cff('0xe5')]+_0x253422[_0x8cff('0xe6')]+_0x253422[_0x8cff('0xe7')]+_0x253422[_0x8cff('0xe8')]+_0x253422['countmachineretry']+_0x253422[_0x8cff('0x189')]>=_0x4e97a9[_0x8cff('0xe9')]-0x1){return!![];}switch(_0x4a16f5){case 0x3:if(_0x253422[_0x8cff('0xe5')]>=_0x4e97a9[_0x8cff('0x18a')]-0x1){return!![];}this[_0x8cff('0x11a')]({'active':![],'countnoanswerretry':_0x253422[_0x8cff('0xe5')]+=0x1,'scheduledat':moment()['add'](_0x4e97a9['dialNoAnswerRetryFrequency'],_0x8cff('0xf8'))[_0x8cff('0x76')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x253422[_0x8cff('0xca')],'ListId':_0x253422['ListId'],'VoiceQueueId':_0x253422[_0x8cff('0xcd')]||undefined,'CampaignId':_0x253422[_0x8cff('0xce')]||undefined})['catch'](loggerCatch(_0x8cff('0x18b')));break;case 0x5:if(_0x253422['countbusyretry']>=_0x4e97a9[_0x8cff('0x18c')]-0x1){return!![];}this[_0x8cff('0x11a')]({'active':![],'countbusyretry':_0x253422['countbusyretry']+=0x1,'scheduledat':moment()[_0x8cff('0xee')](_0x4e97a9[_0x8cff('0x18d')],'minutes')[_0x8cff('0x76')](_0x8cff('0xf9')),'ContactId':_0x253422['ContactId'],'ListId':_0x253422[_0x8cff('0xcb')],'VoiceQueueId':_0x253422[_0x8cff('0xcd')]||undefined,'CampaignId':_0x253422[_0x8cff('0xce')]||undefined})[_0x8cff('0xa8')](loggerCatch(_0x8cff('0x18e')));break;case 0x8:if(_0x253422[_0x8cff('0xe4')]>=_0x4e97a9[_0x8cff('0x18f')]-0x1){return!![];}this[_0x8cff('0x11a')]({'active':![],'countcongestionretry':_0x253422[_0x8cff('0xe4')]+=0x1,'scheduledat':moment()['add'](_0x4e97a9[_0x8cff('0x190')],_0x8cff('0xf8'))[_0x8cff('0x76')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x253422[_0x8cff('0xca')],'ListId':_0x253422[_0x8cff('0xcb')],'VoiceQueueId':_0x253422['VoiceQueueId']||undefined,'CampaignId':_0x253422[_0x8cff('0xce')]||undefined})['catch'](loggerCatch(_0x8cff('0x191')));break;case 0x0:if(_0x253422['countnosuchnumberretry']>=_0x4e97a9['dialNoSuchNumberMaxRetry']-0x1){return!![];}else{this[_0x8cff('0x11a')]({'active':![],'countnosuchnumberretry':_0x253422[_0x8cff('0xe6')]+=0x1,'scheduledat':moment()[_0x8cff('0xee')](_0x4e97a9['dialNoSuchNumberRetryFrequency'],'minutes')['format'](_0x8cff('0xf9')),'ContactId':_0x253422[_0x8cff('0xca')],'ListId':_0x253422[_0x8cff('0xcb')],'VoiceQueueId':_0x253422[_0x8cff('0xcd')]||undefined,'CampaignId':_0x253422[_0x8cff('0xce')]||undefined})[_0x8cff('0xa8')](loggerCatch(_0x8cff('0x192')));}break;case 0xa:if(_0x253422[_0x8cff('0xe7')]>=_0x4e97a9[_0x8cff('0x111')]-0x1){return!![];}this[_0x8cff('0x11a')]({'active':![],'countdropretry':_0x253422[_0x8cff('0xe7')]+=0x1,'scheduledat':moment()[_0x8cff('0xee')](_0x4e97a9[_0x8cff('0x112')],_0x8cff('0xf8'))[_0x8cff('0x76')](_0x8cff('0xf9')),'ContactId':_0x253422[_0x8cff('0xca')],'ListId':_0x253422['ListId'],'VoiceQueueId':_0x253422[_0x8cff('0xcd')]||undefined,'CampaignId':_0x253422['CampaignId']||undefined})[_0x8cff('0xa8')](loggerCatch(_0x8cff('0x113')));break;case 0xb:if(_0x253422[_0x8cff('0xe8')]>=_0x4e97a9[_0x8cff('0x193')]-0x1){return!![];}this[_0x8cff('0x11a')]({'active':![],'countabandonedretry':_0x253422['countabandonedretry']+=0x1,'scheduledat':moment()[_0x8cff('0xee')](_0x4e97a9[_0x8cff('0x11b')],_0x8cff('0xf8'))['format'](_0x8cff('0xf9')),'ContactId':_0x253422['ContactId'],'ListId':_0x253422['ListId'],'VoiceQueueId':_0x253422[_0x8cff('0xcd')]||undefined,'CampaignId':_0x253422[_0x8cff('0xce')]||undefined})['catch'](loggerCatch(_0x8cff('0x11c')));break;case 0x13:if(_0x253422[_0x8cff('0xe3')]>=_0x4e97a9[_0x8cff('0xeb')]-0x1){return!![];}this[_0x8cff('0x11a')]({'active':![],'countmachineretry':_0x253422[_0x8cff('0xe3')]+=0x1,'scheduledat':moment()[_0x8cff('0xee')](_0x4e97a9[_0x8cff('0xef')],_0x8cff('0xf8'))[_0x8cff('0x76')](_0x8cff('0xf9')),'ContactId':_0x253422[_0x8cff('0xca')],'ListId':_0x253422[_0x8cff('0xcb')],'VoiceQueueId':_0x253422[_0x8cff('0xcd')]||undefined,'CampaignId':_0x253422[_0x8cff('0xce')]||undefined})[_0x8cff('0xa8')](loggerCatch(_0x8cff('0xf0')));break;case 0x14:if(_0x253422[_0x8cff('0x189')]>=_0x4e97a9[_0x8cff('0x194')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countagentrejectretry':_0x253422[_0x8cff('0x189')]+=0x1,'scheduledat':moment()[_0x8cff('0xee')](_0x4e97a9['dialAgentRejectRetryFrequency'],_0x8cff('0xf8'))[_0x8cff('0x76')](_0x8cff('0xf9')),'ContactId':_0x253422[_0x8cff('0xca')],'ListId':_0x253422[_0x8cff('0xcb')],'VoiceQueueId':_0x253422[_0x8cff('0xcd')]||undefined,'CampaignId':_0x253422[_0x8cff('0xce')]||undefined})[_0x8cff('0xa8')](loggerCatch(_0x8cff('0x195')));break;default:return!![];}};Dialer[_0x8cff('0x1c')]['callProgressDetecting']=function(_0x5009ad,_0x14cd33,_0x4a782e){var _0x356870=this;var _0x23a9b8=new History(_0x5009ad);return new BPromise(function(_0x1d4d9e,_0x5a780d){if(_[_0x8cff('0x3f')](_0x14cd33)&&typeof _0x14cd33!=='object'){return _0x5a780d(msgResponse(_0x8cff('0x196'),_0x8cff('0x13f'),_0x8cff('0x197')));}if(_[_0x8cff('0x3f')](_0x4a782e)&&typeof _0x4a782e!=='object'){return _0x5a780d(msgResponse(_0x8cff('0x196'),_0x8cff('0x13f'),'evt\x20is\x20undefine'));}switch(_0x4a782e['reason']){case'0':_0x14cd33[_0x8cff('0x198')]+=0x1;_0x23a9b8['state']=0x0;_0x23a9b8[_0x8cff('0x9f')]=_0x8cff('0x199');_0x23a9b8[_0x8cff('0xe6')]+=0x1;_0x23a9b8['countglobal']+=0x1;ami[_0x8cff('0x4e')](_0x8cff('0x19a'),ut[_0x8cff('0xf2')](_0x5009ad,'nosuchnumber'));_0x356870[_0x8cff('0xc3')](_0x23a9b8)[_0x8cff('0xa8')](loggerCatch(_0x8cff('0xf6')));if(_0x356870[_0x8cff('0x19b')](0x0,_0x5009ad,_0x14cd33)){if(_0x23a9b8[_0x8cff('0xe6')]>=_0x14cd33[_0x8cff('0x19c')]){_0x356870['createStateFinal'](_0x23a9b8,_0x1d4d9e,_0x5a780d,_0x8cff('0x19d'));}else{_0x356870['stateGlobal'](_0x23a9b8,_0x1d4d9e,_0x5a780d,_0x8cff('0x19d'));}}break;case'3':_0x14cd33['outboundNoAnswerCallsDay']+=0x1;_0x23a9b8[_0x8cff('0x9e')]=0x3;_0x23a9b8[_0x8cff('0x9f')]=_0x8cff('0x19e');_0x23a9b8[_0x8cff('0xe5')]+=0x1;_0x23a9b8[_0x8cff('0xf5')]+=0x1;ami[_0x8cff('0x4e')](_0x8cff('0x19f'),ut[_0x8cff('0xf2')](_0x5009ad,'noanswer'));_0x356870[_0x8cff('0xc3')](_0x23a9b8)[_0x8cff('0xa8')](loggerCatch(_0x8cff('0x1a0')));if(_0x356870['checkRetriveMax'](0x3,_0x5009ad,_0x14cd33)){if(_0x23a9b8[_0x8cff('0xe5')]>=_0x14cd33[_0x8cff('0x18a')]){_0x356870[_0x8cff('0xec')](_0x23a9b8,_0x1d4d9e,_0x5a780d,_0x8cff('0x1a1'));}else{_0x356870[_0x8cff('0x1a2')](_0x23a9b8,_0x1d4d9e,_0x5a780d,_0x8cff('0x1a1'));}}break;case'5':_0x14cd33[_0x8cff('0x61')]+=0x1;_0x23a9b8['state']=0x5;_0x23a9b8['statedesc']=_0x8cff('0x1a3');_0x23a9b8[_0x8cff('0xf7')]+=0x1;_0x23a9b8[_0x8cff('0xf5')]+=0x1;ami['emit'](_0x8cff('0x1a4'),ut[_0x8cff('0xf2')](_0x5009ad,'busy'));_0x356870[_0x8cff('0xc3')](_0x23a9b8)[_0x8cff('0xa8')](loggerCatch(_0x8cff('0x1a5')));if(_0x356870[_0x8cff('0x19b')](0x5,_0x5009ad,_0x14cd33)){if(_0x23a9b8[_0x8cff('0xf7')]>=_0x14cd33[_0x8cff('0x18c')]){_0x356870[_0x8cff('0xec')](_0x23a9b8,_0x1d4d9e,_0x5a780d,_0x8cff('0x1a6'));}else{_0x356870['stateGlobal'](_0x23a9b8,_0x1d4d9e,_0x5a780d,_0x8cff('0x1a6'));}}break;case'8':_0x14cd33['outboundCongestionCallsDay']+=0x1;_0x23a9b8[_0x8cff('0x9e')]=0x8;_0x23a9b8[_0x8cff('0x9f')]=_0x8cff('0x1a7');_0x23a9b8[_0x8cff('0xe4')]+=0x1;_0x23a9b8[_0x8cff('0xf5')]+=0x1;ami['emit']('custom:agentcongestion',ut[_0x8cff('0xf2')](_0x5009ad,_0x8cff('0x1a8')));_0x356870[_0x8cff('0xc3')](_0x23a9b8)[_0x8cff('0xa8')](loggerCatch(_0x8cff('0x1a9')));if(_0x356870[_0x8cff('0x19b')](0x8,_0x5009ad,_0x14cd33)){if(_0x23a9b8[_0x8cff('0xe4')]>=_0x14cd33['dialCongestionMaxRetry']){_0x356870[_0x8cff('0xec')](_0x23a9b8,_0x1d4d9e,_0x5a780d,_0x8cff('0x1aa'));}else{_0x356870[_0x8cff('0x1a2')](_0x23a9b8,_0x1d4d9e,_0x5a780d,'reason\x208\x20congestion');}}break;case'11':_0x14cd33[_0x8cff('0x1ab')]+=0x1;_0x23a9b8[_0x8cff('0x9e')]=0xb;_0x23a9b8[_0x8cff('0x9f')]='Abandoned';_0x23a9b8['countabandonedretry']+=0x1;_0x23a9b8['countglobal']+=0x1;_0x356870[_0x8cff('0xc3')](_0x23a9b8)[_0x8cff('0xa8')](loggerCatch(_0x8cff('0x11d')));if(_0x356870[_0x8cff('0x19b')](0xb,_0x5009ad,_0x14cd33)){if(_0x23a9b8[_0x8cff('0xe8')]>=_0x14cd33['dialAbandonedMaxRetry']){_0x356870['createStateFinal'](_0x23a9b8,_0x1d4d9e,_0x5a780d,_0x8cff('0x1ac'));}else{_0x356870['stateGlobal'](_0x23a9b8,_0x1d4d9e,_0x5a780d,_0x8cff('0x1ac'));}}break;case'20':_0x14cd33[_0x8cff('0x1ad')]+=0x1;_0x23a9b8[_0x8cff('0x9e')]=0x14;_0x23a9b8[_0x8cff('0x9f')]='AgentReject';_0x23a9b8['countagentrejectretry']+=0x1;_0x23a9b8[_0x8cff('0xf5')]+=0x1;ami[_0x8cff('0x4e')]('custom:agentreject',ut[_0x8cff('0xf2')](_0x5009ad,_0x8cff('0x1ae')));_0x356870[_0x8cff('0xc3')](_0x23a9b8)[_0x8cff('0xa8')](loggerCatch(_0x8cff('0x1af')));if(_0x356870[_0x8cff('0x19b')](0x14,_0x5009ad,_0x14cd33)){if(_0x23a9b8[_0x8cff('0x189')]>=_0x14cd33[_0x8cff('0x194')]){_0x356870[_0x8cff('0xec')](_0x23a9b8,_0x1d4d9e,_0x5a780d,_0x8cff('0x1b0'));}else{_0x356870[_0x8cff('0x1a2')](_0x23a9b8,_0x1d4d9e,_0x5a780d,_0x8cff('0x1b0'));}}break;default:_0x14cd33[_0x8cff('0x67')]+=0x1;_0x23a9b8[_0x8cff('0x9e')]=0xc;_0x23a9b8['statedesc']=_0x4a782e[_0x8cff('0x1b1')];_0x356870['createHistory'](_0x23a9b8)['catch'](loggerCatch('[syncAgentComplete][createHistory][?]'));if(_0x356870[_0x8cff('0x19b')](_0x4a782e[_0x8cff('0x1b1')],_0x5009ad,_0x14cd33)){if(_0x23a9b8[_0x8cff('0xf7')]+_0x23a9b8[_0x8cff('0xe4')]+_0x23a9b8[_0x8cff('0xe5')]+_0x23a9b8[_0x8cff('0xe6')]+_0x23a9b8['countdropretry']+_0x23a9b8[_0x8cff('0xe8')]+_0x23a9b8['countmachineretry']+_0x23a9b8[_0x8cff('0x189')]>=_0x14cd33[_0x8cff('0xe9')]){_0x356870[_0x8cff('0x1a2')](_0x23a9b8,_0x1d4d9e,_0x5a780d,_0x4a782e[_0x8cff('0x1b1')]);}else{_0x356870[_0x8cff('0xec')](_0x23a9b8,_0x1d4d9e,_0x5a780d,_0x4a782e['reason']);}}}});};Dialer[_0x8cff('0x1c')][_0x8cff('0x1a2')]=function(_0x181e4a,_0x3d087a,_0x117c41,_0x1be886){var _0x394b36=new Final(_0x181e4a);_0x394b36[_0x8cff('0x9e')]=0xf;_0x394b36[_0x8cff('0x9f')]=_0x8cff('0x1b2');this[_0x8cff('0xec')](_0x394b36,_0x3d087a,_0x117c41,_0x1be886);};Dialer[_0x8cff('0x1c')][_0x8cff('0xec')]=function(_0x5a627d,_0x49d09f,_0x2b73df,_0x335d5b){this[_0x8cff('0xc2')](_0x5a627d)['then'](function(){return _0x49d09f(msgResponse(_0x8cff('0x196'),_0x8cff('0xd2'),_0x335d5b));})[_0x8cff('0xa8')](function(){return _0x2b73df(msgResponse(_0x8cff('0x1b3'),_0x8cff('0x13f'),_0x8cff('0x1b4')));});};Dialer['prototype'][_0x8cff('0x8')]=function(_0x513ea2){var _0x1de43c=_0x513ea2['dialPredictiveOptimizationPercentage']/0x64;var _0x2c0d6d=_0x513ea2['outboundDropCallsDayTimeout']/(_0x513ea2[_0x8cff('0x65')]+_0x513ea2['outboundAnswerCallsDay']);var _0x4dd4ba=Math[_0x8cff('0x1b5')](_0x513ea2[_0x8cff('0x6f')]*(_0x513ea2[_0x8cff('0x1b6')]/0x64));var _0x50eb53=Math[_0x8cff('0x1b5')](_0x513ea2[_0x8cff('0x6f')]*(_0x513ea2[_0x8cff('0x1b7')]/0x64));var _0x41350c=_0x513ea2[_0x8cff('0x52')]+_0x513ea2[_0x8cff('0x57')];var _0x5c7cce=Math['floor'](_0x513ea2[_0x8cff('0x72')]*_0x513ea2[_0x8cff('0x73')]*_0x513ea2[_0x8cff('0x6d')]*_0x513ea2['predictiveIntervalMultiplicativeFactor']);if(_['isUndefined'](_0x513ea2[_0x8cff('0x2b')])){if(!_[_0x8cff('0x3f')](_0x513ea2['startPredictive'])){_0x513ea2[_0x8cff('0x2a')]=undefined;loggerPredictive[_0x8cff('0x8d')](_0x8cff('0x1b8'),'check\x20predictive\x20is\x20not\x20undefine');}if(!_[_0x8cff('0x3f')](_0x513ea2[_0x8cff('0x89')])){loggerPredictive['error'](_0x8cff('0x1b8'),_0x8cff('0x1b9'));clearInterval(_0x513ea2[_0x8cff('0x89')]);_0x513ea2[_0x8cff('0x89')]=undefined;}_0x513ea2['startProgressive']=moment()[_0x8cff('0x76')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x8cff('0x7d')](_0x513ea2[_0x8cff('0x47')],_0x8cff('0x1ba'),_0x513ea2[_0x8cff('0x2b')]);this[_0x8cff('0x14f')](_0x513ea2,0x1);}else if(ifInterval(_0x513ea2[_0x8cff('0x1bb')],_0x513ea2[_0x8cff('0x2b')])){this[_0x8cff('0x14f')](_0x513ea2,0x1);loggerPredictiveCalls[_0x8cff('0x7d')](_0x8cff('0x1bc'),_0x513ea2[_0x8cff('0x2b')],_0x513ea2[_0x8cff('0x47')]);_0x513ea2[_0x8cff('0x72')]=0x0;_0x513ea2[_0x8cff('0x10e')]=0x0;}else if(_0x1de43c<_0x2c0d6d&&_0x513ea2['dialPredictiveOptimization']==='dropRate'){freeVariablesPredictive(_0x513ea2);loggerPredictive['info'](_0x8cff('0x1bd'),_0x8cff('0x1be'),_0x2c0d6d,_0x8cff('0x2b'),_0x513ea2[_0x8cff('0x47')]);}else if(_0x5c7cce<_0x513ea2[_0x8cff('0x10e')]&&_0x513ea2[_0x8cff('0x1bf')]===_0x8cff('0x1c0')){freeVariablesPredictive(_0x513ea2);loggerPredictive['info'](_0x8cff('0x1c1'),_0x8cff('0x1c2'),_0x5c7cce,'Drop\x20in\x20this\x20interval',_0x513ea2[_0x8cff('0x10e')],_0x8cff('0x2b'),_0x513ea2['name']);}else if(!ifInterval(_0x513ea2['dialPredictiveInterval'],_0x513ea2['startProgressive'])&&_[_0x8cff('0x3f')](_0x513ea2[_0x8cff('0x2a')])&&!_[_0x8cff('0x3f')](_0x513ea2[_0x8cff('0x2b')])){_0x513ea2[_0x8cff('0x2a')]=moment()[_0x8cff('0x76')](_0x8cff('0xf9'));loggerPredictive['info'](_0x513ea2[_0x8cff('0x47')],_0x8cff('0x1c3'),_0x513ea2['startPredictive']);this[_0x8cff('0xb6')](_0x513ea2[_0x8cff('0x1bb')])[_0x8cff('0xaf')](this[_0x8cff('0x1c4')](_0x513ea2))['then'](mergeDataErlangB(_0x513ea2))['then'](this[_0x8cff('0x1c5')](_0x513ea2))[_0x8cff('0xa8')](loggerCatchPredictive('Predictive\x20after\x20first\x20interval',_0x513ea2));}else if(!ifInterval(_0x513ea2['dialPredictiveInterval'],_0x513ea2[_0x8cff('0x2a')])){_0x513ea2[_0x8cff('0x10e')]=0x0;_0x513ea2['startPredictive']=moment()[_0x8cff('0x76')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive['info'](_0x513ea2['name'],'recalculate\x20predictive\x20at',_0x513ea2[_0x8cff('0x2a')]);clearInterval(_0x513ea2[_0x8cff('0x89')]);_0x513ea2[_0x8cff('0x89')]=undefined;this[_0x8cff('0xb6')](_0x513ea2['dialPredictiveInterval'])['then'](this['getDataPredictive'](_0x513ea2))[_0x8cff('0xaf')](mergeDataErlangB(_0x513ea2))[_0x8cff('0xaf')](this[_0x8cff('0x1c5')](_0x513ea2))['catch'](loggerCatchPredictive(_0x8cff('0x1c6'),_0x513ea2));}else if(_0x513ea2[_0x8cff('0x6f')]&&_0x41350c<_0x513ea2[_0x8cff('0x6f')]-_0x50eb53){freeVariablesPredictive(_0x513ea2);loggerPredictive['info'](_0x513ea2[_0x8cff('0x47')],_0x8cff('0x1c7'),_0x41350c,_0x8cff('0x1c8'),_0x513ea2['predictiveIntervalAvailable'],'-',_0x50eb53,'=',_0x513ea2['predictiveIntervalAvailable']-_0x50eb53,')');}else if(_0x513ea2[_0x8cff('0x6f')]&&_0x41350c>_0x513ea2[_0x8cff('0x6f')]+_0x4dd4ba){freeVariablesPredictive(_0x513ea2);loggerPredictive[_0x8cff('0x7d')](_0x513ea2[_0x8cff('0x47')],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x41350c,_0x8cff('0x1c9'),_0x513ea2[_0x8cff('0x6f')],'+',_0x4dd4ba,'=',_0x513ea2[_0x8cff('0x6f')]+_0x4dd4ba,')');}};Dialer['prototype'][_0x8cff('0x1c4')]=function(_0x31bc5a){var _0x28d1d4=this;return function(_0x44783e){return new BPromise(function(_0x440e39,_0x537cdd){_[_0x8cff('0x87')](_0x31bc5a,_0x44783e[0x0]);if(checkGetDataPredictive(_0x44783e[0x0])){var _0x22a566=_0x31bc5a['predictiveIntervalAvailable']=_0x31bc5a[_0x8cff('0x57')]+_0x31bc5a[_0x8cff('0x52')];var _0x11a488=_0x31bc5a[_0x8cff('0x1bb')]*0x3c;var _0x543098=_0x44783e[0x0][_0x8cff('0x69')]+_0x44783e[0x0]['predictiveIntervalAvgHoldtime'];var _0x8d5c0f=(_0x44783e[0x0]['predictiveIntervalAnsweredCalls']+_0x44783e[0x0][_0x8cff('0x6b')]+_0x44783e[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x44783e[0x0][_0x8cff('0x70')];_0x31bc5a[_0x8cff('0x6d')]=_0x8d5c0f>0x0?_0x8d5c0f:0x1;switch(_0x31bc5a[_0x8cff('0x1bf')]){case'dropRate':var _0x2d5c0d=_0x31bc5a[_0x8cff('0x1ca')]/0x64;return _0x28d1d4[_0x8cff('0x1cb')](_0x22a566,_0x11a488,_0x543098,_0x8d5c0f,_0x2d5c0d)['then'](function(_0x47a4f0){return _0x440e39(_0x47a4f0);});case _0x8cff('0x1cc'):var _0x254b8c=_0x31bc5a[_0x8cff('0x1ca')]/0x64;return _0x28d1d4['busyFactor'](_0x22a566,_0x11a488,_0x543098,_0x8d5c0f,_0x254b8c)[_0x8cff('0xaf')](function(_0x55e2e9){return _0x440e39(_0x55e2e9);});default:return _0x537cdd(msgResponse(_0x8cff('0x1cd'),_0x8cff('0x13f'),_0x8cff('0x1ce')));}}else{return _0x537cdd(msgResponse('[getDataPredictive]',_0x8cff('0x13f'),_0x8cff('0x1cf')));}});};};Dialer[_0x8cff('0x1c')]['getDataPredictiveOld']=function(_0x56fabd){var _0x32b97a=this;return function(_0x1a57bf){return new BPromise(function(_0x2d2f56,_0xe67634){_['merge'](_0x56fabd,_0x1a57bf[0x0]);if(checkGetDataPredictive(_0x1a57bf[0x0])){loggerPredictive[_0x8cff('0x7d')](JSON[_0x8cff('0x127')](_0x1a57bf[0x0]));if(_0x56fabd[_0x8cff('0x1bf')]===_0x8cff('0x1c0')){return _0x32b97a[_0x8cff('0xc0')](_0x56fabd['id'])[_0x8cff('0xaf')](function(_0x29d76b){var _0x875c76=_0x56fabd['loggedIn']-_0x29d76b[0x0][_0x8cff('0x1d0')];var _0x2a4e58=_0x56fabd[_0x8cff('0x1bb')]*0x3c;var _0x1a37f7=_0x1a57bf[0x0]['predictiveIntervalAvgTalktime']+_0x1a57bf[0x0]['predictiveIntervalAvgHoldtime'];var _0x2bac56=(_0x1a57bf[0x0]['predictiveIntervalAnsweredCalls']+_0x1a57bf[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x1a57bf[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x1a57bf[0x0][_0x8cff('0x70')];var _0x5d3bba=_0x56fabd[_0x8cff('0x1ca')]/0x64;_0x56fabd[_0x8cff('0x6e')]=_0x29d76b[0x0][_0x8cff('0x1d0')]||0x0;_0x56fabd['predictiveIntervalHitRate']=_0x2bac56>0x0?_0x2bac56:0x1;return _0x32b97a['abandonmentRate'](_0x875c76,_0x2a4e58,_0x1a37f7,_0x2bac56,_0x5d3bba);})['then'](function(_0x30b902){return _0x2d2f56(_0x30b902);})[_0x8cff('0xa8')](function(_0x1f1ffd){return _0xe67634(msgResponse(_0x8cff('0x1d1'),_0x8cff('0x13f'),JSON[_0x8cff('0x127')](_0x1f1ffd)));});}if(_0x56fabd[_0x8cff('0x1bf')]===_0x8cff('0x1cc')){return _0x32b97a[_0x8cff('0xc0')](_0x56fabd['id'])['then'](function(_0x326208){var _0x19f249=_0x56fabd[_0x8cff('0x53')]-_0x326208[0x0]['outboundQueuePauses'];var _0xd3381e=_0x56fabd['dialPredictiveInterval']*0x3c;var _0x17234a=_0x1a57bf[0x0][_0x8cff('0x69')]+_0x1a57bf[0x0]['predictiveIntervalAvgHoldtime'];var _0x30335a=(_0x1a57bf[0x0][_0x8cff('0x1d2')]+_0x1a57bf[0x0][_0x8cff('0x6b')]+_0x1a57bf[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x1a57bf[0x0][_0x8cff('0x70')];var _0x3b31bd=_0x56fabd[_0x8cff('0x1ca')]/0x64;_0x56fabd[_0x8cff('0x6e')]=_0x326208[0x0]['outboundQueuePauses']||0x0;_0x56fabd['predictiveIntervalHitRate']=_0x30335a>0x0?_0x30335a:0x1;return _0x32b97a[_0x8cff('0x1d3')](_0x19f249,_0xd3381e,_0x17234a,_0x30335a,_0x3b31bd);})[_0x8cff('0xaf')](function(_0x1d6751){return _0x2d2f56(_0x1d6751);})['catch'](function(_0x12a387){return _0xe67634(msgResponse(_0x8cff('0x1d1'),_0x8cff('0x13f'),JSON[_0x8cff('0x127')](_0x12a387)));});}}else{return _0xe67634(msgResponse(_0x8cff('0x1cd'),'Failure',_0x8cff('0x1cf')));}});};};Dialer[_0x8cff('0x1c')][_0x8cff('0x1c5')]=function(_0x5d04e2){var _0x5176be=this;return function(){var _0x1458ba=0x0;var _0x152354=Math['floor'](_0x5d04e2[_0x8cff('0x1d4')]*0x3e8);if(_0x152354>0x0){_0x152354=_0x152354<0x64?0x64:_0x152354;loggerPredictive[_0x8cff('0x7d')](_0x5d04e2[_0x8cff('0x47')],'one\x20call\x20every:',_0x152354,_0x8cff('0x4c'));_0x5d04e2[_0x8cff('0x89')]=setInterval(function(){_0x5176be[_0x8cff('0x89')](_0x5d04e2);loggerPredictiveCalls['info'](_0x8cff('0x1d5'),_0x1458ba+=0x1);},_0x152354);}else{loggerPredictive[_0x8cff('0x7d')](_0x5d04e2[_0x8cff('0x47')],_0x8cff('0x1d6'));}};};Dialer['prototype'][_0x8cff('0x1d7')]=function(_0x32ac29,_0x4296da){var _0x443988=this;return function(_0xdfaed4){if(_['isEmpty'](_0xdfaed4)){if(_[_0x8cff('0xd9')](_0x4296da[_0x8cff('0xcc')])||!_0x4296da[_0x8cff('0x1d8')]){if(_0x32ac29[_0x8cff('0x14d')]==='booked'){_0x32ac29['queueStatusComplete']=_[_0x8cff('0x3f')](_0x32ac29[_0x8cff('0x125')])?!![]:_0x32ac29[_0x8cff('0x125')];var _0x3488d8=uuid['v4']();_0x443988[_0x8cff('0x27')][_0x3488d8]=new Action(_0x32ac29,_0x4296da,_0x3488d8);loggerBooked[_0x8cff('0x7d')](_0x8cff('0x1d9'),_0x3488d8,_0x8cff('0x1da'),JSON[_0x8cff('0x127')](_0x32ac29[_0x8cff('0x125')]),_0x8cff('0x1db'),_0x32ac29[_0x8cff('0x47')]);if(_0x32ac29[_0x8cff('0x125')]){_0x32ac29[_0x8cff('0x125')]=![];_0x443988['queueBooked'][_0x443988['actions'][_0x3488d8][_0x8cff('0xab')]]=[];ami[_0x8cff('0xa5')]({'actionid':_0x3488d8,'action':_0x8cff('0x1dc'),'queue':_0x32ac29[_0x8cff('0x47')]})[_0x8cff('0xa8')](function(){_0x443988[_0x8cff('0xaa')](_0x32ac29);_0x443988[_0x8cff('0x11a')]({'active':![],'ContactId':_0x443988[_0x8cff('0x27')][_0x3488d8][_0x8cff('0xca')],'ListId':_0x443988[_0x8cff('0x27')][_0x3488d8][_0x8cff('0xcb')],'VoiceQueueId':_0x443988[_0x8cff('0x27')][_0x3488d8][_0x8cff('0xcd')]||undefined,'CampaignId':_0x443988[_0x8cff('0x27')][_0x3488d8][_0x8cff('0xce')]||undefined})[_0x8cff('0xa8')](loggerCatch(_0x8cff('0x1dd')));delete _0x443988[_0x8cff('0x27')][_0x3488d8];});}else{loggerBooked[_0x8cff('0x7d')](_0x8cff('0x1de'),JSON[_0x8cff('0x127')](_0x32ac29['queueStatusComplete']),'Queue:\x20',_0x32ac29[_0x8cff('0x47')]);_0x443988[_0x8cff('0xaa')](_0x32ac29);_0x443988[_0x8cff('0x11a')]({'active':![],'ContactId':_0x443988[_0x8cff('0x27')][_0x3488d8][_0x8cff('0xca')],'ListId':_0x443988[_0x8cff('0x27')][_0x3488d8][_0x8cff('0xcb')],'VoiceQueueId':_0x443988['actions'][_0x3488d8]['VoiceQueueId']||undefined,'CampaignId':_0x443988['actions'][_0x3488d8][_0x8cff('0xce')]||undefined})[_0x8cff('0xa8')](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x443988[_0x8cff('0x27')][_0x3488d8];}}else{return _0x443988[_0x8cff('0x15b')](_0x32ac29,_0x4296da);}}else{if(getDiff(_0x4296da['scheduledat'])<_0x32ac29['dialRecallMeTimeout']*0x3c){if(_0x4296da[_0x8cff('0x1df')]&&!_0x4296da[_0x8cff('0x1df')][_0x8cff('0x1e0')]){_0x443988[_0x8cff('0x21')]['run'](_0x4296da['id'])['finally'](function(){_0x443988[_0x8cff('0xaa')](_0x32ac29);});}else{_0x443988[_0x8cff('0xba')]({'active':![]},_0x4296da['id'],0x1)['finally'](function(){_0x443988[_0x8cff('0xaa')](_0x32ac29);});}}else{_0x32ac29[_0x8cff('0x1e1')]+=0x1;_0x443988[_0x8cff('0xaa')](_0x32ac29);if(_0x32ac29['dialRecallInQueue']){_0x443988[_0x8cff('0x11a')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x4296da[_0x8cff('0xca')],'ListId':_0x4296da[_0x8cff('0xcb')],'VoiceQueueId':_0x4296da[_0x8cff('0xcd')]||undefined,'CampaignId':_0x4296da[_0x8cff('0xce')]||undefined})[_0x8cff('0xa8')](loggerCatch(_0x8cff('0x1e2')));_0x443988['createHistory'](createObjHistory(_0x32ac29,_0x4296da,_0x8cff('0x1e3'),0x17,_0x8cff('0x1e4')))[_0x8cff('0xa8')](loggerCatch(_0x8cff('0x1e5')));}else{_0x443988[_0x8cff('0xd7')](createObjHistory(_0x32ac29,_0x4296da,_0x8cff('0x1e6'),0x16,_0x8cff('0x1e7')),_0x8cff('0x1e8'),'[Originate][HistoryRecallClose]');}}}}else{_0x32ac29[_0x8cff('0x1e9')]+=0x1;_0x443988[_0x8cff('0xd7')](createObjHistory(_0x32ac29,_0x4296da,_0x8cff('0x1ea'),0xd,_0x8cff('0x1eb')),_0x8cff('0x1ec'),'[Originate][MoveBlacklist]');throw'inBlackList';}};};Dialer[_0x8cff('0x1c')]['handleIvr']=function(_0x1bb8bd){var _0x125cf6=this;var _0x111b3c=_0x1bb8bd[_0x8cff('0x1ed')]-_0x1bb8bd[_0x8cff('0x71')]-_0x1bb8bd['temp'];emitCampaignSummary(_0x1bb8bd);if(_0x111b3c>0x0){if(_0x111b3c>this[_0x8cff('0x25')]){_0x111b3c=this[_0x8cff('0x25')];}_0x1bb8bd['temp']+=_0x111b3c;this[_0x8cff('0xbe')](_0x1bb8bd['id'],_0x111b3c,_0x1bb8bd[_0x8cff('0x1ee')],_0x1bb8bd)['then'](function(_0x4959b6){_0x1bb8bd[_0x8cff('0xbc')]-=_0x111b3c;_0x1bb8bd[_0x8cff('0xbc')]=_0x1bb8bd[_0x8cff('0xbc')]>0x0?_0x1bb8bd[_0x8cff('0xbc')]:0x0;if(!checkContactEmpty(_0x4959b6)){_0x1bb8bd[_0x8cff('0x42')]=_0x8cff('0x95');logger['info'](_0x8cff('0x1ef')+_0x1bb8bd[_0x8cff('0x47')]);}else{_0x1bb8bd[_0x8cff('0x71')]+=_0x4959b6['length'];_0x1bb8bd[_0x8cff('0x42')]=_0x8cff('0x1f0');for(var _0x418aef=0x0;_0x418aef<_0x4959b6[_0x8cff('0x12c')];_0x418aef+=0x1){_0x1bb8bd[_0x8cff('0x1f1')]+=0x1;if(_[_0x8cff('0xd9')](_0x4959b6[_0x418aef])||_[_0x8cff('0xd9')](_0x4959b6[_0x418aef][_0x8cff('0x15e')])||_['isNil'](_0x4959b6[_0x418aef][_0x8cff('0x15e')]['phone'])){_0x125cf6[_0x8cff('0xc8')](_0x8cff('0x1f2'),_0x1bb8bd,_0x4959b6[_0x418aef]);}else{_0x125cf6[_0x8cff('0xb3')](_[_0x8cff('0xc9')](_0x4959b6[_0x418aef],['CampaignId',_0x8cff('0x1f3')]))[_0x8cff('0xaf')](_0x125cf6['checkContactBlack'](_0x1bb8bd,_0x4959b6[_0x418aef]))[_0x8cff('0xa8')](_0x125cf6['loggerHandler'](_0x8cff('0x1f4'),_0x1bb8bd));}}}})['catch'](loggerGetContactDialer(_0x8cff('0x1f5'),_0x1bb8bd,_0x111b3c));}};Dialer[_0x8cff('0x1c')]['handlePower']=function(_0x49198e,_0x7bbffd){var _0x342e22=this;var _0x3062cb=[];var _0x53d039=_0x7bbffd>=0x1?_0x7bbffd:0x1;if(_0x49198e[_0x8cff('0x14d')]===_0x8cff('0x1f6')){_0x53d039=0x1;}var _0x54048f=Math['floor'](_0x49198e['available']*_0x53d039)-_0x49198e[_0x8cff('0x71')]-_0x49198e[_0x8cff('0xbc')];emitVoiceQueueSummary(_0x49198e);if(_0x49198e[_0x8cff('0x1f7')]>0x0){var _0xcf38ba=_0x49198e[_0x8cff('0x1f7')]-_0x49198e[_0x8cff('0x71')]-_0x49198e[_0x8cff('0x57')]-_0x49198e['temp']-_0x49198e[_0x8cff('0x54')];if(_0x54048f>_0xcf38ba){_0x54048f=_0xcf38ba;}}if(_0x54048f>0x0){if(_0x49198e[_0x8cff('0x14d')]===_0x8cff('0x1f6')){_0x54048f=0x1;}if(_0x54048f>this[_0x8cff('0x25')]){_0x54048f=this['maxNumberOriginate'];}_0x49198e['temp']+=_0x54048f;for(var _0x525933 in this[_0x8cff('0x122')]){if(typeof this[_0x8cff('0x122')][_0x525933]!==_0x8cff('0x90')){if(this[_0x8cff('0x122')][_0x525933][_0x8cff('0x9e')]===_0x8cff('0x1f8')&&this[_0x8cff('0x122')][_0x525933]['status']===_0x8cff('0xd5')){_0x3062cb[_0x8cff('0x124')](this[_0x8cff('0x122')][_0x525933]['id']);}}}this[_0x8cff('0xbb')](_0x49198e['id'],_0x3062cb,_0x54048f,_0x49198e[_0x8cff('0x1ee')],_0x49198e)['then'](function(_0x49d217){_0x49198e[_0x8cff('0xbc')]-=_0x54048f;_0x49198e[_0x8cff('0xbc')]=_0x49198e[_0x8cff('0xbc')]>0x0?_0x49198e['temp']:0x0;if(!checkContactEmpty(_0x49d217)){_0x342e22[_0x8cff('0xae')](_0x49198e)[_0x8cff('0xaf')](sendMessageReschedule(_0x49198e))[_0x8cff('0xa8')](loggerCatch(_0x8cff('0xb0')));}else{_0x49198e[_0x8cff('0x71')]+=_0x49d217['length'];_0x49198e['message']=_0x49198e[_0x8cff('0x14d')]===_0x8cff('0x1f6')?_0x8cff('0x165'):_0x8cff('0x1f0');for(var _0x569ccc=0x0;_0x569ccc<_0x49d217[_0x8cff('0x12c')];_0x569ccc+=0x1){if(_[_0x8cff('0xd9')](_0x49d217[_0x569ccc])||_[_0x8cff('0xd9')](_0x49d217[_0x569ccc][_0x8cff('0x15e')])||_[_0x8cff('0xd9')](_0x49d217[_0x569ccc][_0x8cff('0x15e')][_0x8cff('0x15f')])){_0x342e22[_0x8cff('0xc8')](_0x8cff('0x1f2'),_0x49198e,_0x49d217[_0x569ccc]);}else{_0x342e22[_0x8cff('0xb1')](_[_0x8cff('0xc9')](_0x49d217[_0x569ccc],['VoiceQueueId',_0x8cff('0x1f3')]))[_0x8cff('0xaf')](_0x342e22[_0x8cff('0x1d7')](_0x49198e,_0x49d217[_0x569ccc]))['catch'](_0x342e22[_0x8cff('0xc7')](_0x8cff('0x1f2'),_0x49198e));}}}})[_0x8cff('0xa8')](loggerGetContactDialer('[getContactDialer2]',_0x49198e,_0x54048f));}};Dialer[_0x8cff('0x1c')][_0x8cff('0x89')]=function(_0x3ddb03){if(_0x3ddb03[_0x8cff('0x1f7')]>0x0){var _0x327818=_0x3ddb03['dialLimitQueue']-_0x3ddb03[_0x8cff('0x71')]-_0x3ddb03[_0x8cff('0x57')];if(_0x327818>0x0){this[_0x8cff('0x1f9')](_0x3ddb03);}else{loggerPredictiveCalls[_0x8cff('0x7d')](_0x8cff('0x1fa'));}}else{this[_0x8cff('0x1f9')](_0x3ddb03);}};Dialer[_0x8cff('0x1c')][_0x8cff('0x1f9')]=function(_0x3122a9){var _0xd0f350=this;var _0x9c1268=[];_0x3122a9[_0x8cff('0x71')]+=0x1;for(var _0x4a0e2d in this['agents']){if(typeof this[_0x8cff('0x122')][_0x4a0e2d]!=='undefined'){if(this[_0x8cff('0x122')][_0x4a0e2d]['state']===_0x8cff('0x1f8')&&this[_0x8cff('0x122')][_0x4a0e2d][_0x8cff('0xa6')]===_0x8cff('0xd5')){_0x9c1268[_0x8cff('0x124')](this['agents'][_0x4a0e2d]['id']);}}}this['getContactDialer'](_0x3122a9['id'],_0x9c1268,0x1,_0x3122a9['dialOrderByScheduledAt'],_0x3122a9)[_0x8cff('0xaf')](function(_0xb83fe3){if(!checkContactEmpty(_0xb83fe3)){checkContactLowerLimitOriginate(_0x3122a9,0x1,0x0);_0xd0f350['countReScheduled'](_0x3122a9)[_0x8cff('0xaf')](sendMessageReschedule(_0x3122a9))[_0x8cff('0xa8')](loggerCatch(_0x8cff('0xb0')));}else{_0x3122a9[_0x8cff('0x42')]='RUNNING';if(_[_0x8cff('0xd9')](_0xb83fe3[0x0])||_[_0x8cff('0xd9')](_0xb83fe3[0x0][_0x8cff('0x15e')])||_[_0x8cff('0xd9')](_0xb83fe3[0x0][_0x8cff('0x15e')]['phone'])){_0xd0f350['emptyContact'](_0x8cff('0x1f2'),_0x3122a9,_0xb83fe3[0x0]);}else{_0xd0f350[_0x8cff('0xb1')](_[_0x8cff('0xc9')](_0xb83fe3[0x0],[_0x8cff('0xcd'),_0x8cff('0x1f3')]))[_0x8cff('0xaf')](_0xd0f350[_0x8cff('0x1d7')](_0x3122a9,_0xb83fe3[0x0]))['catch'](_0xd0f350[_0x8cff('0xc7')]('[actionOriginatePredictive]\x20',_0x3122a9));}}})[_0x8cff('0xa8')](loggerGetContactDialer(_0x8cff('0x1fb'),_0x3122a9,0x1));emitVoiceQueueSummary(_0x3122a9);};Dialer[_0x8cff('0x1c')][_0x8cff('0x1cb')]=function(_0x4fd4a6,_0x31f6af,_0x13fef2,_0x2e4c22,_0x311680,_0x2df635){loggerPredictive[_0x8cff('0x7d')](_0x8cff('0x1fc'));loggerPredictive[_0x8cff('0x7d')](_0x8cff('0x1fd'),_0x4fd4a6);loggerPredictive['info'](_0x8cff('0x1fe'),_0x31f6af);loggerPredictive[_0x8cff('0x7d')](_0x8cff('0x1ff'),_0x13fef2);loggerPredictive[_0x8cff('0x7d')](_0x8cff('0x200'),_0x2e4c22);loggerPredictive['info'](_0x8cff('0x201'),_0x311680);loggerPredictive['info'](_0x8cff('0x81'));return new BPromise(function(_0x5ec169,_0x3af992){if(_0x4fd4a6<=0x0||isNaN(_0x4fd4a6)){return _0x3af992(msgResponse('[abandonmentRate]',_0x8cff('0x4b'),'m\x20=\x20'+_0x4fd4a6));}if(_0x13fef2<=0x0||isNaN(_0x13fef2)){return _0x3af992(msgResponse(_0x8cff('0x202'),_0x8cff('0x4b'),_0x8cff('0x203')+_0x13fef2));}if(_0x2e4c22<=0x0||isNaN(_0x2e4c22)){return _0x3af992(msgResponse(_0x8cff('0x202'),_0x8cff('0x4b'),'p\x20=\x20'+_0x2e4c22));}if(_0x31f6af<=0x0||isNaN(_0x31f6af)){return _0x3af992(msgResponse(_0x8cff('0x202'),'Error',_0x8cff('0x204')+_0x31f6af));}if(_0x311680<=0x0||isNaN(_0x311680)){return _0x3af992(msgResponse(_0x8cff('0x202'),_0x8cff('0x4b'),'Amax\x20=\x20'+_0x311680));}_0x2df635=_0x2df635||0x0;var _0x500fe9=0x1/_0x13fef2;var _0x14358b=0x0;var _0x4abea9=0x0;var _0x4a96c4=0x0;var _0x2f5162=0x0;for(var _0x416297=0x0;_0x4a96c4<_0x311680;_0x416297+=0x1){_0x4abea9=_0x416297/_0x31f6af;_0x14358b=(_0x2e4c22*_0x4abea9+_0x2df635)/_0x500fe9;_0x4a96c4=erlangb(_0x14358b,_0x4fd4a6);_0x2f5162=_0x14358b/_0x4fd4a6*(0x1-erlangb(_0x14358b,_0x4fd4a6));}return _0x5ec169({'erlangCalls':_0x416297,'erlangCallToSecond':_0x31f6af/_0x416297,'erlangAbandonmentRate':_0x4a96c4,'erlangBusyFactor':_0x2f5162});});};Dialer[_0x8cff('0x1c')]['busyFactor']=function(_0x542b6f,_0x5aeb4f,_0x2383c8,_0x3a0638,_0x13a9ea,_0x41ea61){loggerPredictive[_0x8cff('0x7d')](_0x8cff('0x205'));loggerPredictive['info'](_0x8cff('0x1fd'),_0x542b6f);loggerPredictive[_0x8cff('0x7d')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x5aeb4f);loggerPredictive['info']('Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x2383c8);loggerPredictive[_0x8cff('0x7d')](_0x8cff('0x200'),_0x3a0638);loggerPredictive[_0x8cff('0x7d')](_0x8cff('0x206'),_0x13a9ea);loggerPredictive[_0x8cff('0x7d')](_0x8cff('0x81'));return new BPromise(function(_0x3ceef2,_0x531148){if(_0x542b6f<=0x0||isNaN(_0x542b6f)){return _0x531148(msgResponse(_0x8cff('0x207'),_0x8cff('0x4b'),_0x8cff('0x208')+_0x542b6f));}if(_0x2383c8<=0x0||isNaN(_0x2383c8)){return _0x531148(msgResponse('[busyFactor]',_0x8cff('0x4b'),_0x8cff('0x203')+_0x2383c8));}if(_0x3a0638<=0x0||isNaN(_0x3a0638)){return _0x531148(msgResponse('[busyFactor]','Error',_0x8cff('0x209')+_0x3a0638));}if(_0x5aeb4f<=0x0||isNaN(_0x5aeb4f)){return _0x531148(msgResponse(_0x8cff('0x207'),'Error',_0x8cff('0x204')+_0x5aeb4f));}if(_0x13a9ea<=0x0||isNaN(_0x13a9ea)){return _0x531148(msgResponse(_0x8cff('0x207'),_0x8cff('0x4b'),'Umin\x20=\x20'+_0x13a9ea));}_0x41ea61=_0x41ea61||0x0;var _0x1e55a6=0x1/_0x2383c8;var _0x25b894=0x0;var _0x483d82=0x0;var _0x319e88=0x0;var _0x6afb54=0x0;for(var _0xea22b7=0x0;_0x6afb54<_0x13a9ea;_0xea22b7+=0x1){_0x483d82=_0xea22b7/_0x5aeb4f;_0x25b894=(_0x3a0638*_0x483d82+_0x41ea61)/_0x1e55a6;_0x319e88=erlangb(_0x25b894,_0x542b6f);_0x6afb54=_0x25b894/_0x542b6f*(0x1-erlangb(_0x25b894,_0x542b6f));}return _0x3ceef2({'erlangCalls':_0xea22b7,'erlangCallToSecond':_0x5aeb4f/_0xea22b7,'erlangAbandonmentRate':_0x319e88,'erlangBusyFactor':_0x6afb54});});};module[_0x8cff('0x20a')]=Dialer; \ No newline at end of file +var _0x4711=['reason\x2019\x20machine....','YYYY-MM-DD\x20HH:mm:ss','ivrAnswerCallsDay','[syncHangupIvr]','dialQueueProject','AnswerAGI','AGI','[syncHangupIvr][createHistory]','outboundUnknownCallsDay','reason','agent','agiafterat','dialQueueProject2','[syncAgentComplete]','answertime','queueCallerAbandonCreateState','[syncAgentComplete][createHistory]','[syncQueueCallerAbandon]\x20[Drop]','responsetime','dialQueueTimeout','Drop','dropreason','TIMEOUT','[rescheduleContact][Drop]','endtime','calleridname','calleridnum','CALLEREXIT','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','[rescheduleContact][Abandoned]','actionid','locked','paused','stateinterface','push','idHopper','queueStatusComplete','[unlockQueueStatus][undefined]','syncQueueStatusComplete','run','[unlock][syncQueueStatusComplete]','_rr','unlockRR','contactAgent-idHopper:\x20','[booked][RR][finaly]','Agent:\x20','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','loopCampaigns','syncCampaigns','checkIsTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTime','checkIfTimeIntervals','Failure','TIMEZONE_UNKNOW','isArray','Action','command','interval','timezones','content','indexOf','true','iftime\x20%s,%s','all','some','GLOBAL_INTERVAL_IS_OVERTIME','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','progressive','power','handlePower','dialPowerLevel','Queue','method\x20not\x20recognized','launchHandleIvr','handleIvr','dialGlobalInterval','dialTimezone','checkDialMethod','[syncCampaigns]','\x5cw{0,','random','match','actionOriginate','object','voiceQueue\x20is\x20undefine','phone','Contact','originate','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','dialQueueOptions','dialAgiAfterHangupAgent','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','createdAt','%s%s','XMD-','toUpper','dialRandomLastDigitCallerIdNumber','XMD-ORIGINATECALLERIDNAME','XMD-ORIGINATECALLERIDNUM','trim','dialCutDigit','SIP/%s/%s%s','from-sip','outboundOriginateFailureCallsDay','[originateError]:\x20%s','OriginateError','[originate][error]','Error','originate\x20action\x20Error','isSuccess','response','callProgressDetecting','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialAgentRejectMaxRetry','[rescheduleContact][AgentReject]','[callProgressDetecting]','entity\x20is\x20undefine','NoSuchNumber','custom:agentnosuchnumber','checkRetriveMax','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','NoAnswer','custom:agentnoanswer','noanswer','reason\x203\x20ringing\x20no\x20answer','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','Congestion','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','Abandoned','[syncAgentComplete][createHistory][11]','reason\x2011\x20abandoned','AgentReject','custom:agentreject','agentreject','reason\x2020\x20agentreject','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','floor','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Drop\x20in\x20this\x20interval','dialPredictiveInterval','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','abandonmentRate','agentBusyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','outboundQueuePauses','[CatchErlangB]','busyFactor','one\x20call\x20every:','[handlePredictive]','[booked][checkContactBlack]','queueStatusComplete:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','Queue:\x20','scheduledat','dialRecallMeTimeout','Agent','voicePause','outboundReCallsDay','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RECALLINQUEUE','RecallInQueue','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','BLACKLIST','Blacklist','inBlackList','dialOrderByScheduledAt','[getContactCampaign2][Empty]','[actionOriginate]\x20','Contact.phone','checkContactBlack','[getContactCampaign2]','dialLimitQueue','not_inuse','reachable','ACTIVE','RUNNING','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','[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','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','m\x20=\x20','Ts\x20=\x20','p\x20=\x20','Amax\x20=\x20','----\x20Agent\x20Busy\x20Factor\x20----','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','[busyFactor]','interval\x20=\x20','Umin\x20=\x20','util','lodash','bluebird','uuid','moment','md5','ioredis','../../../config/environment/','dialer','../../../config/logger','booked','predictive','predictiveCalls','syncQueueSummary','../ami','redis','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','./action','./final','./agentComplete','./queueCallerAbandon','./hangup','env','127.0.0.1','rrmemory','roundrobin','enqueue','tail','finally','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','actions','contactsId','uniqueId','optionPredictive','startPredictive','startProgressive','ivrOriginated','queueBooked','queueBookedRR','agentconnect','syncAgentConnect','bind','queuecallerabandon','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','agentcomplete','syncAgentComplete','custom:queuesummary','hangup','syncHangup','newexten','syncNewExten','syncVarSet','queuemember','syncQueueMember','isUndefined','message','AGENTS_NOT_LOGGED','\x20AGENTS\x20NOT\x20LOGGED','NOT_ACTIVE','\x20NOT\x20Active','Interval','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','name','isEmpty','Intervals','[ifTime][Action]','stringify','milliseconds','diff','seconds','emit','type','outbound','strategy','answered','available','loggedIn','sumBillable','sumDuration','sumHoldTime','talking','unmanaged','abandoned','waiting','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialPrefix','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundRejectCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCallToSecond','erlangAbandonmentRate','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','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsTimeout','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgHoldtime','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCalls','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','merge','clearing\x20variable\x20start\x20progressive','clearing\x20variable\x20start\x20predictive','handlePredictive','clearing\x20variable\x20handle\x20predictive','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','error','inspect','length','originated','undefined','[decremetOriginate]\x20is\x20null\x20or\x20undefined','RESCHEDULED_CONTACTS','[getContactDialer2][ReScheduled]','contacts','AVAILABLE_CONTACTS_FINISHED','[getContactDialer2][Empty]','pTalking','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','IS_DISACTIVED','is\x20disactive','sendMessageOneNotActive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','state','starttime','prototype','loopClearZombieChannels','clearZombieChannels','[uniqueid]','channel','catch','[Dialer][checkChannel]','queue','updateOriginated','[Dialer][checkChannel][ivr]','countReScheduled','resolve','then','[countReScheduled]\x20','checkIsBlackList','checkIsBlackListIvr','averageHandleTime','avgHandleTime','[averageHandleTime]\x20','rescheduleContact','[rescheduleContact]\x20','unlockContact','[unlockContact]\x20','getContactDialer','temp','[getContactDialer]\x20','getContactDialerIvr','[getContactDialerIvr]\x20','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','createHistory','[createHistory]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','notFound','saveInDb','pick','UserId','VoiceQueueId','[emptyContact][createHistory]','[emptyContact]','Success','isTrunkReachable','status','unmonitored','uniqueid','isNil','variable','amdstatus','exten','xcally-motion-dialer','value','outboundAnswerAgiCallsDay','HangupInAMD','AMD','buildObj','amd','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','MACHINE','statedesc','Machine','countglobal','custom:amd','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','add','dialMachineRetryFrequency','minutes','ContactId','ListId','CampaignId','[rescheduleContact][Machine]','dialAMDActive','HANGUP','membername','[syncHangupInAMDIvr][createHistory]','[syncAgentComplete][createHistory][0]'];(function(_0x22aa2e,_0x3b5c84){var _0x5b7674=function(_0x35e106){while(--_0x35e106){_0x22aa2e['push'](_0x22aa2e['shift']());}};_0x5b7674(++_0x3b5c84);}(_0x4711,0x10c));var _0x1471=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x4711[_0x321bb2];return _0x9c12ed;};'use strict';var util=require(_0x1471('0x0'));var _=require(_0x1471('0x1'));var BPromise=require(_0x1471('0x2'));var uuid=require(_0x1471('0x3'));var moment=require(_0x1471('0x4'));var rr=require('rr');var md5=require(_0x1471('0x5'));var Redis=require(_0x1471('0x6'));var ut=require('../preview/util/util');var config=require(_0x1471('0x7'));var logger=require('../../../config/logger')(_0x1471('0x8'));var loggerBooked=require(_0x1471('0x9'))(_0x1471('0xa'));var loggerPredictive=require(_0x1471('0x9'))(_0x1471('0xb'));var loggerPredictiveCalls=require('../../../config/logger')(_0x1471('0xc'));var loggerSyncQueueSummary=require(_0x1471('0x9'))(_0x1471('0xd'));var ami=require(_0x1471('0xe'));config[_0x1471('0xf')]=_['defaults'](config['redis'],{'host':_0x1471('0x10'),'port':0x18eb});var io=require(_0x1471('0x11'))(new Redis(config[_0x1471('0xf')]));var cmHopper=require(_0x1471('0x12'));var cmHopperHistory=require(_0x1471('0x13'));var cmHopperBlack=require(_0x1471('0x14'));var voiceQueueRt=require(_0x1471('0x15'));var Action=require(_0x1471('0x16'));var History=require('./history');var Final=require(_0x1471('0x17'));var AgentComplete=require(_0x1471('0x18'));var QueueCallerAbandon=require(_0x1471('0x19'));var Hangup=require(_0x1471('0x1a'));var ipAgi=process[_0x1471('0x1b')]['XCALLY_IP_AGI']||_0x1471('0x1c');var strategy={'rrmemory':_0x1471('0x1d'),'roundrobin':_0x1471('0x1e')};var Sequence=function(){};Sequence['prototype'][_0x1471('0x1f')]=function(_0x2bab8a){this[_0x1471('0x20')]=this[_0x1471('0x20')]?this[_0x1471('0x20')][_0x1471('0x21')](_0x2bab8a):_0x2bab8a();};function Dialer(_0x33a6fc,_0x594cf2){this[_0x1471('0x22')]=new Sequence();this[_0x1471('0x23')]=_0x594cf2;this[_0x1471('0x24')]=_0x33a6fc['voiceQueues'];this[_0x1471('0x25')]=_0x33a6fc[_0x1471('0x25')];this[_0x1471('0x26')]=_0x33a6fc[_0x1471('0x26')];this[_0x1471('0x27')]=_0x33a6fc[_0x1471('0x27')];this[_0x1471('0x28')]=config[_0x1471('0x28')]||0x2;this['channels']={};this[_0x1471('0x29')]={};this[_0x1471('0x2a')]={};this[_0x1471('0x2b')]={};this[_0x1471('0x2c')]={};this[_0x1471('0x2d')]={};this[_0x1471('0x2e')]={};this[_0x1471('0x2f')]={};this[_0x1471('0x30')]={};this[_0x1471('0x31')]={};ami['on'](_0x1471('0x32'),this[_0x1471('0x33')][_0x1471('0x34')](this));ami['on'](_0x1471('0x35'),this[_0x1471('0x36')]['bind'](this));ami['on'](_0x1471('0x37'),this[_0x1471('0x38')]['bind'](this));ami['on'](_0x1471('0x39'),this[_0x1471('0x3a')][_0x1471('0x34')](this));ami['on'](_0x1471('0x3b'),this['syncQueueSummary']['bind'](this));ami['on'](_0x1471('0x3c'),this[_0x1471('0x3d')][_0x1471('0x34')](this));ami['on'](_0x1471('0x3e'),this[_0x1471('0x3f')][_0x1471('0x34')](this));ami['on']('varset',this[_0x1471('0x40')]['bind'](this));ami['on'](_0x1471('0x41'),this[_0x1471('0x42')][_0x1471('0x34')](this));ami['on']('queuestatuscomplete',this['syncQueueStatusComplete'][_0x1471('0x34')](this));this['loopCampaigns']();this['loopClearZombieChannels']();}function isNotNull(_0x3fbf7d){return _0x3fbf7d!==null&&!_[_0x1471('0x43')](_0x3fbf7d);}function checkIsLoggedIn(_0x1fa8dd,_0x134472){return function(){if(_0x134472<=0x0){_0x1fa8dd[_0x1471('0x44')]=_0x1471('0x45');throw _0x1fa8dd['name']+_0x1471('0x46');}};}function isActive(_0x1bbc5c){return _0x1bbc5c;}function checkIsActive(_0x3327ae,_0x1e0c8a){return function(){if(!isActive(_0x1e0c8a)){_0x3327ae[_0x1471('0x44')]=_0x1471('0x47');throw _0x3327ae['name']+_0x1471('0x48');}};}function checkInterval(_0x44ea25){return function(){if(!isNotNull(_0x44ea25[_0x1471('0x49')])){_0x44ea25[_0x1471('0x44')]=_0x1471('0x4a');throw _0x44ea25['name']+_0x1471('0x4b');}if(!isNotNull(_0x44ea25[_0x1471('0x49')]['Intervals'])){_0x44ea25[_0x1471('0x44')]=_0x1471('0x4a');throw _0x44ea25[_0x1471('0x4c')]+_0x1471('0x4b');}if(!isNotNull(_[_0x1471('0x4d')](_0x44ea25[_0x1471('0x49')][_0x1471('0x4e')]))){_0x44ea25['message']=_0x1471('0x4a');throw _0x44ea25[_0x1471('0x4c')]+'\x20INTERVAL_IS_NULL';}};}function msgResponse(_0x45fe12,_0x5c32f1,_0x1b70da){return{'action':_0x45fe12,'response':_0x5c32f1,'message':_0x1b70da,'stack':_0x1b70da};}function myreject(_0x9c917b){return function(_0x1d2dcd){return _0x9c917b(msgResponse(_0x1471('0x4f'),'Error',JSON[_0x1471('0x50')](_0x1d2dcd)));};}function getSeconds(_0x53401f,_0x1e7965){var _0x510b39=moment(_0x53401f)[_0x1471('0x51')](0x0);var _0x4c4394=moment(_0x1e7965)[_0x1471('0x51')](0x0);return _0x510b39[_0x1471('0x52')](_0x4c4394,_0x1471('0x53'));}function emit(_0x263678,_0x50eaa1,_0x4ff24b){io['to'](_0x263678)[_0x1471('0x54')](_0x50eaa1,_0x4ff24b);}function emitVoiceQueueSummary(_0x4e78f6){if(_0x4e78f6[_0x1471('0x55')]===_0x1471('0x56')){var _0x78d154={'id':_0x4e78f6['id'],'name':_0x4e78f6['name'],'strategy':_0x4e78f6[_0x1471('0x57')],'answered':_0x4e78f6[_0x1471('0x58')],'available':_0x4e78f6[_0x1471('0x59')],'loggedIn':_0x4e78f6[_0x1471('0x5a')],'pTalking':_0x4e78f6['pTalking'],'sumBillable':_0x4e78f6[_0x1471('0x5b')],'sumDuration':_0x4e78f6[_0x1471('0x5c')],'sumHoldTime':_0x4e78f6[_0x1471('0x5d')]||0x0,'talking':_0x4e78f6[_0x1471('0x5e')],'total':_0x4e78f6['total'],'type':_0x4e78f6['type'],'unmanaged':_0x4e78f6[_0x1471('0x5f')],'abandoned':_0x4e78f6[_0x1471('0x60')],'waiting':_0x4e78f6[_0x1471('0x61')],'loggedInDb':_0x4e78f6['loggedInDb'],'dialActive':_0x4e78f6[_0x1471('0x62')],'dialMethod':_0x4e78f6[_0x1471('0x63')],'dialOriginateCallerIdName':_0x4e78f6[_0x1471('0x64')],'dialOriginateCallerIdNumber':_0x4e78f6[_0x1471('0x65')],'dialOriginateTimeout':_0x4e78f6['dialOriginateTimeout'],'dialPrefix':_0x4e78f6[_0x1471('0x66')],'outboundAnswerAgiCallsDay':_0x4e78f6['outboundAnswerAgiCallsDay'],'outboundAnswerCallsDay':_0x4e78f6[_0x1471('0x67')],'outboundBlacklistCallsDay':_0x4e78f6[_0x1471('0x68')],'outboundBusyCallsDay':_0x4e78f6[_0x1471('0x69')],'outboundCongestionCallsDay':_0x4e78f6[_0x1471('0x6a')],'outboundDropCallsDayACS':_0x4e78f6[_0x1471('0x6b')],'outboundDropCallsDayCallersExit':_0x4e78f6[_0x1471('0x6c')],'outboundDropCallsDayTimeout':_0x4e78f6[_0x1471('0x6d')],'outboundNoAnswerCallsDay':_0x4e78f6['outboundNoAnswerCallsDay'],'outboundNoSuchCallsDay':_0x4e78f6['outboundNoSuchCallsDay'],'outboundOriginateFailureCallsDay':_0x4e78f6['outboundOriginateFailureCallsDay'],'outboundReCallsDay':_0x4e78f6['outboundReCallsDay'],'outboundRejectCallsDay':_0x4e78f6[_0x1471('0x6e')],'outboundUnknownCallsDay':_0x4e78f6['outboundUnknownCallsDay'],'predictiveIntervalAnsweredCalls':_0x4e78f6[_0x1471('0x6f')],'predictiveIntervalAvgHoldtime':_0x4e78f6['predictiveIntervalAvgHoldtime'],'predictiveIntervalAvgTalktime':_0x4e78f6[_0x1471('0x70')],'predictiveIntervalDroppedCallsCallersExit':_0x4e78f6[_0x1471('0x71')],'predictiveIntervalDroppedCallsTimeout':_0x4e78f6['predictiveIntervalDroppedCallsTimeout'],'predictiveIntervalErlangCalls':_0x4e78f6[_0x1471('0x72')],'predictiveIntervalErlangCallsDroppedCalls':_0x4e78f6[_0x1471('0x73')],'predictiveIntervalHitRate':_0x4e78f6[_0x1471('0x74')],'predictiveIntervalMultiplicativeFactor':_0x4e78f6[_0x1471('0x75')],'predictiveIntervalPauses':_0x4e78f6[_0x1471('0x76')],'predictiveIntervalAvailable':_0x4e78f6[_0x1471('0x77')],'predictiveIntervalTotalCalls':_0x4e78f6[_0x1471('0x78')],'message':_0x4e78f6[_0x1471('0x44')],'originated':_0x4e78f6['originated'],'erlangCalls':_0x4e78f6['erlangCalls'],'erlangCallToSecond':_0x4e78f6[_0x1471('0x79')],'erlangAbandonmentRate':_0x4e78f6[_0x1471('0x7a')],'erlangBusyFactor':_0x4e78f6[_0x1471('0x7b')],'startPredictive':_0x4e78f6[_0x1471('0x2d')],'startProgressive':_0x4e78f6[_0x1471('0x2e')]};if(_0x4e78f6[_0x1471('0x7c')]){_0x78d154[_0x1471('0x7c')]={'id':_0x4e78f6[_0x1471('0x7c')]['id'],'name':_0x4e78f6[_0x1471('0x7c')][_0x1471('0x4c')],'active':_0x4e78f6[_0x1471('0x7c')][_0x1471('0x7d')],'callerid':_0x4e78f6[_0x1471('0x7c')][_0x1471('0x7e')]};}if(_0x4e78f6[_0x1471('0x49')]){_0x78d154[_0x1471('0x49')]={'id':_0x4e78f6['Interval']['id'],'name':_0x4e78f6[_0x1471('0x49')][_0x1471('0x4c')]};}var _0x240f67=md5(JSON[_0x1471('0x50')](_0x78d154));if(_0x4e78f6[_0x1471('0x5')]!==_0x240f67){_0x4e78f6['md5']=_0x240f67;emit(util[_0x1471('0x7f')](_0x1471('0x80'),_0x78d154[_0x1471('0x4c')]),_0x1471('0x81'),_0x78d154);}}}function emitCampaignSummary(_0xc234f8){if(_0xc234f8['type']===_0x1471('0x82')){emit(util[_0x1471('0x7f')](_0x1471('0x83'),_0xc234f8['name']),_0x1471('0x84'),_0xc234f8);}}function checkGetDataPredictive(_0x41a985){if(isNotNull(_0x41a985)&&!_['isEmpty'](_0x41a985)){loggerPredictive[_0x1471('0x85')](_0x1471('0x86'));loggerPredictive[_0x1471('0x85')](_0x1471('0x87'),_0x41a985['predictiveIntervalTotalCalls']);loggerPredictive['info']('Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x41a985[_0x1471('0x6f')]);loggerPredictive[_0x1471('0x85')](_0x1471('0x88'),_0x41a985[_0x1471('0x89')]);loggerPredictive[_0x1471('0x85')](_0x1471('0x8a'),_0x41a985['predictiveIntervalDroppedCallsCallersExit']);loggerPredictive[_0x1471('0x85')]('AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x41a985[_0x1471('0x8b')]);loggerPredictive[_0x1471('0x85')](_0x1471('0x8c'),_0x41a985[_0x1471('0x70')]);loggerPredictive[_0x1471('0x85')]('---------------------------');if(_0x41a985[_0x1471('0x78')]>0x0){if(!_[_0x1471('0x43')](_0x41a985['predictiveIntervalAvgTalktime'])&&_0x41a985[_0x1471('0x70')]>0x0){return!![];}loggerPredictive[_0x1471('0x85')]('Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive');if(!_[_0x1471('0x43')](_0x41a985[_0x1471('0x8b')])&&_0x41a985[_0x1471('0x8b')]>0x0){return!![];}loggerPredictive[_0x1471('0x85')](_0x1471('0x8d'));}else{loggerPredictive[_0x1471('0x85')]('Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive');}}else{loggerPredictive[_0x1471('0x85')]('History\x20information\x20are\x20empty');}return![];}function mergeDataErlangB(_0x5863a2){return function(_0x298ef4){loggerPredictive['info'](_0x1471('0x8e'));loggerPredictive[_0x1471('0x85')](_0x1471('0x8f'),_0x298ef4[_0x1471('0x90')]);loggerPredictive[_0x1471('0x85')](_0x1471('0x91'),_0x298ef4[_0x1471('0x79')]);loggerPredictive[_0x1471('0x85')](_0x1471('0x92'),_0x298ef4[_0x1471('0x7a')]);loggerPredictive[_0x1471('0x85')]('Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x298ef4[_0x1471('0x7b')]);loggerPredictive[_0x1471('0x85')](_0x1471('0x92'),_0x298ef4[_0x1471('0x7a')]);loggerPredictive['info'](_0x1471('0x93'));_[_0x1471('0x94')](_0x5863a2,_0x298ef4);};}function getDiff(_0xcb0395){var _0x325e02=moment()['milliseconds'](0x0);var _0x580d8d=moment(_0xcb0395)['milliseconds'](0x0);return _0x325e02[_0x1471('0x52')](_0x580d8d,'seconds');}function ifInterval(_0x49e21d,_0x17d75c){if(_[_0x1471('0x43')](_0x17d75c)){return![];}return getDiff(_0x17d75c)<_0x49e21d*0x3c;}function freeVariablesPredictive(_0xdad242){if(isNotNull(_0xdad242)){if(!_['isUndefined'](_0xdad242['startProgressive'])){_0xdad242[_0x1471('0x2e')]=undefined;loggerPredictive[_0x1471('0x85')](_0xdad242['name'],_0x1471('0x95'));}if(!_[_0x1471('0x43')](_0xdad242[_0x1471('0x2d')])){_0xdad242[_0x1471('0x2d')]=undefined;loggerPredictive[_0x1471('0x85')](_0xdad242['name'],_0x1471('0x96'));}if(!_[_0x1471('0x43')](_0xdad242[_0x1471('0x97')])){clearInterval(_0xdad242[_0x1471('0x97')]);_0xdad242[_0x1471('0x97')]=undefined;loggerPredictive[_0x1471('0x85')](_0xdad242[_0x1471('0x4c')],_0x1471('0x98'));}}}function erlangb(_0x119318,_0x51a052){if(_0x51a052===0x0){return 0x0;}var _0x4a9c01=0x1;for(var _0x36a921=0x1;_0x36a921<=_0x51a052;_0x36a921+=0x1){_0x4a9c01=0x1+_0x4a9c01*_0x36a921/_0x119318;}return 0x1/_0x4a9c01;}function isVoiceQueueOutbound(_0x1992fe){return _0x1992fe===_0x1471('0x56');}function isNotPreview(_0x2c4b02){return _0x2c4b02!==_0x1471('0x23');}function isCampaignIvr(_0x3857f1){return _0x3857f1==='ivr';}function getCallerId(_0x488171,_0x2d1123,_0x1d83bd){if(!_[_0x1471('0x43')](_0x1d83bd)&&typeof _0x1d83bd==='string'&&!_[_0x1471('0x4d')](_0x1d83bd)){if(!_[_0x1471('0x43')](_0x2d1123)&&typeof _0x2d1123===_0x1471('0x99')&&!_[_0x1471('0x4d')](_0x2d1123)){return util[_0x1471('0x7f')]('\x22%s\x22\x20<%s>',_0x2d1123,_0x1d83bd);}return util[_0x1471('0x7f')](_0x1471('0x9a'),_0x1d83bd,_0x1d83bd);}if(!_[_0x1471('0x43')](_0x488171)&&typeof _0x488171===_0x1471('0x99')&&!_[_0x1471('0x4d')](_0x488171)){return _0x488171;}return _0x1471('0x9b');}function loggerCatchQueueSummary(_0x3e4db8,_0x14440f){return function(_0x131f7f){freeVariablesPredictive(_0x14440f);emitVoiceQueueSummary(_0x14440f);emitCampaignSummary(_0x14440f);loggerSyncQueueSummary[_0x1471('0x9c')](_0x3e4db8,util[_0x1471('0x9d')](_0x131f7f,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x361f9a,_0x3b69ca){return function(_0xa2acd4){loggerPredictive[_0x1471('0x9c')](_0x3b69ca[_0x1471('0x4c')],_0x361f9a);loggerPredictive[_0x1471('0x9c')](_0xa2acd4['stack']);freeVariablesPredictive(_0x3b69ca);};}function loggerCatch(_0x2a10fb){return function(_0x10403c){logger['error'](_0x2a10fb,util[_0x1471('0x9d')](_0x10403c,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x37dd02){return _0x37dd02&&!_[_0x1471('0x43')](_0x37dd02)&&_0x37dd02[_0x1471('0x9e')]>0x0;}function decremetOriginate(_0x9e9e9c){if(!_[_0x1471('0x43')](_0x9e9e9c)&&_0x9e9e9c!==null){if(typeof _0x9e9e9c[_0x1471('0x9f')]!==_0x1471('0xa0')){if(_0x9e9e9c[_0x1471('0x9f')]>0x0){_0x9e9e9c['originated']-=0x1;}else{logger[_0x1471('0x9c')]('[decremetOriginate]\x20object\x20originated\x20is\x20negative');}}}else{logger[_0x1471('0x9c')](_0x1471('0xa1'));}}function checkContactLowerLimitOriginate(_0x11f08e,_0x2d76b6,_0x3fac01){if(_0x2d76b6>_0x3fac01){for(var _0x4b7504=0x0;_0x4b7504<_0x2d76b6-_0x3fac01;_0x4b7504+=0x1){decremetOriginate(_0x11f08e);}}}function loggerGetContactDialer(_0x152ddc,_0x4a9b80,_0x390b46){return function(_0x4b3599){checkContactLowerLimitOriginate(_0x4a9b80,_0x390b46,0x0);logger['error'](_0x152ddc,util[_0x1471('0x9d')](_0x4b3599,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x13de2f){return function(_0x14b2e0){if(isNotNull(_0x14b2e0)&&isNotNull(_0x14b2e0[0x0])){if(_0x14b2e0[0x0]['contactsRescheduled']>0x0){_0x13de2f[_0x1471('0x44')]=_0x1471('0xa2');logger[_0x1471('0x85')](_0x1471('0xa3')+_0x13de2f['name'],_0x14b2e0[0x0]['contactsRescheduled'],_0x1471('0xa4'));}else{_0x13de2f['message']=_0x1471('0xa5');logger[_0x1471('0x85')](_0x1471('0xa6')+_0x13de2f[_0x1471('0x4c')]);}}};}function notSendMessagesQueue(_0x2a7c15){if(_0x2a7c15['sendMessageOneNotActive']){freeVariablesPredictive(_0x2a7c15);if(_0x2a7c15[_0x1471('0x9f')]===0x0&&_0x2a7c15['talking']===0x0&&_0x2a7c15[_0x1471('0x61')]===0x0&&(_0x2a7c15[_0x1471('0xa7')]||0x0)===0x0){_0x2a7c15['sendMessageOneNotActive']=![];_0x2a7c15[_0x1471('0x59')]=0x0;_0x2a7c15[_0x1471('0x44')]=_0x1471('0x47');loggerSyncQueueSummary['error'](_0x1471('0xa8'),_0x2a7c15[_0x1471('0x4c')],_0x1471('0xa9'));}else{_0x2a7c15[_0x1471('0x44')]=_0x1471('0xaa');loggerSyncQueueSummary[_0x1471('0x9c')](_0x1471('0xa8'),_0x2a7c15[_0x1471('0x4c')],_0x1471('0xab'));}emitVoiceQueueSummary(_0x2a7c15);}}function notSendMessagesCampaign(_0x5664a3){if(_0x5664a3[_0x1471('0xac')]){if(_0x5664a3[_0x1471('0x9f')]===0x0){_0x5664a3['sendMessageOneNotActive']=![];_0x5664a3[_0x1471('0x44')]='NOT_ACTIVE';loggerSyncQueueSummary['error'](_0x1471('0xad'),_0x5664a3['name'],_0x1471('0xa9'));}else{_0x5664a3[_0x1471('0x44')]='IS_DISACTIVED';loggerSyncQueueSummary[_0x1471('0x9c')](_0x1471('0xad'),_0x5664a3[_0x1471('0x4c')],'is\x20disactive');}emitCampaignSummary(_0x5664a3);}}function createObjHistory(_0x1b5538,_0x55af72,_0x2ee809,_0x26c103,_0x5a27c7){_0x1b5538[_0x1471('0x44')]=_0x2ee809;var _0x1bc221=new Action(_0x1b5538,_0x55af72);var _0x49061d=new History(_0x1bc221);_0x49061d[_0x1471('0xae')]=_0x26c103;_0x49061d['statedesc']=_0x5a27c7;_0x49061d['endtime']=_0x1bc221[_0x1471('0xaf')];return _0x49061d;}Dialer[_0x1471('0xb0')][_0x1471('0xb1')]=function(){var _0x337185=this;setInterval(function(){_0x337185[_0x1471('0xb2')](_0x337185['uniqueId'],_0x1471('0xb3'));_0x337185[_0x1471('0xb2')](_0x337185[_0x1471('0x29')],'[actions]');},0x32c8);};Dialer['prototype'][_0x1471('0xb2')]=function(_0x1301df,_0x4ab37d){var _0xc84541=this;for(var _0xc4aeeb in _0x1301df){if(typeof _0x1301df[_0xc4aeeb]!==_0x1471('0xa0')){this['sequence'][_0x1471('0x1f')](function(){if(!_['isNil'](_0x1301df[_0xc4aeeb])){return ami['Action']({'action':'status','channel':_0x1301df[_0xc4aeeb][_0x1471('0xb4')]})[_0x1471('0xb5')](function(_0x2f09a8){if(_0x2f09a8['message']==='No\x20such\x20channel'){setTimeout(function(){if(_0x1301df[_0xc4aeeb]&&_0x1301df[_0xc4aeeb][_0x1471('0x55')]!==_0x1471('0x82')){_0xc84541['updateOriginated'](_0xc84541['voiceQueues'][_0x1301df[_0xc4aeeb]['queue']]);logger[_0x1471('0x9c')](_0x1471('0xb6'),_0x4ab37d,_0xc4aeeb,_0x1301df[_0xc4aeeb][_0x1471('0xb7')]);delete _0x1301df[_0xc4aeeb];}if(_0x1301df[_0xc4aeeb]&&_0x1301df[_0xc4aeeb][_0x1471('0x55')]===_0x1471('0x82')){_0xc84541[_0x1471('0xb8')](_0xc84541[_0x1471('0x25')][_0x1301df[_0xc4aeeb][_0x1471('0xb7')]]);logger['error'](_0x1471('0xb9'),_0x4ab37d,_0xc4aeeb,_0x1301df[_0xc4aeeb][_0x1471('0xb7')]);delete _0x1301df[_0xc4aeeb];}},0x2328);}});}});}}};Dialer['prototype'][_0x1471('0xba')]=function(_0x199809){return BPromise[_0x1471('0xbb')]()[_0x1471('0xbc')](cmHopper[_0x1471('0xba')](_0x199809))[_0x1471('0xb5')](loggerCatch(_0x1471('0xbd')));};Dialer[_0x1471('0xb0')][_0x1471('0xbe')]=function(_0x3f2d09){return BPromise[_0x1471('0xbb')]()['then'](cmHopperBlack['checkIsBlackList'](_0x3f2d09))[_0x1471('0xb5')](loggerCatch('[checkIsBlackList]\x20'));};Dialer[_0x1471('0xb0')][_0x1471('0xbf')]=function(_0x1a4d4e){return BPromise['resolve']()[_0x1471('0xbc')](cmHopperBlack[_0x1471('0xbf')](_0x1a4d4e))[_0x1471('0xb5')](loggerCatch('[checkIsBlackListIvr]\x20'));};Dialer[_0x1471('0xb0')][_0x1471('0xc0')]=function(_0x497cd8){return BPromise[_0x1471('0xbb')]()[_0x1471('0xbc')](cmHopperHistory[_0x1471('0xc1')](_0x497cd8))['catch'](loggerCatch(_0x1471('0xc2')));};Dialer[_0x1471('0xb0')][_0x1471('0xc3')]=function(_0x216eac){return BPromise[_0x1471('0xbb')]()['then'](cmHopper[_0x1471('0xc3')](_0x216eac))[_0x1471('0xb5')](loggerCatch(_0x1471('0xc4')));};Dialer['prototype'][_0x1471('0xc5')]=function(_0x2eeb66,_0x441cd4,_0x423676){return BPromise[_0x1471('0xbb')]()[_0x1471('0xbc')](cmHopper['unlockContact'](_0x2eeb66,_0x441cd4,_0x423676))['catch'](loggerCatch(_0x1471('0xc6')));};Dialer['prototype']['getContactDialer']=function(_0x58c443,_0x2b9bc9,_0x15bc96,_0x1a52d1,_0x1f8e11){return BPromise[_0x1471('0xbb')]()[_0x1471('0xbc')](cmHopper[_0x1471('0xc7')](_0x58c443,_0x2b9bc9,_0x15bc96,_0x1a52d1))[_0x1471('0xb5')](function(_0x4ad30d){_0x1f8e11['temp']-=_0x15bc96;_0x1f8e11[_0x1471('0xc8')]=_0x1f8e11[_0x1471('0xc8')]>0x0?_0x1f8e11[_0x1471('0xc8')]:0x0;loggerCatch(_0x1471('0xc9'))(_0x4ad30d);});};Dialer['prototype'][_0x1471('0xca')]=function(_0x1852d8,_0x4a0656,_0x1bbadc,_0x191f62){return BPromise[_0x1471('0xbb')]()[_0x1471('0xbc')](cmHopper[_0x1471('0xca')](_0x1852d8,_0x4a0656,_0x1bbadc))[_0x1471('0xb5')](function(_0x3a96b2){_0x191f62['temp']-=_0x4a0656;_0x191f62[_0x1471('0xc8')]=_0x191f62[_0x1471('0xc8')]>0x0?_0x191f62[_0x1471('0xc8')]:0x0;loggerCatch(_0x1471('0xcb'))(_0x3a96b2);});};Dialer[_0x1471('0xb0')][_0x1471('0xcc')]=function(_0x5cf568){return BPromise[_0x1471('0xbb')]()[_0x1471('0xbc')](voiceQueueRt[_0x1471('0xcc')](_0x5cf568))[_0x1471('0xb5')](loggerCatch(_0x1471('0xcd')));};Dialer[_0x1471('0xb0')][_0x1471('0xce')]=function(_0x4017c5){return BPromise[_0x1471('0xbb')]()[_0x1471('0xbc')](cmHopper['moveContactManagedDialer'](_0x4017c5))[_0x1471('0xb5')](loggerCatch('[moveContactManagedDialer]\x20'));};Dialer[_0x1471('0xb0')][_0x1471('0xcf')]=function(_0x3399d4){return BPromise[_0x1471('0xbb')]()[_0x1471('0xbc')](cmHopperHistory[_0x1471('0xcf')](_0x3399d4))[_0x1471('0xb5')](loggerCatch(_0x1471('0xd0')));};Dialer[_0x1471('0xb0')][_0x1471('0xb8')]=function(_0x2323d1){if(!_[_0x1471('0x43')](_0x2323d1)&&_0x2323d1!==null){if(typeof _0x2323d1[_0x1471('0x9f')]!==_0x1471('0xa0')){if(_0x2323d1[_0x1471('0x9f')]>0x0){_0x2323d1[_0x1471('0x9f')]-=0x1;}else{logger[_0x1471('0x9c')](_0x1471('0xd1'));}}}else{logger[_0x1471('0x9c')](_0x1471('0xd2'));}};Dialer[_0x1471('0xb0')][_0x1471('0xd3')]=function(_0x5ae359,_0x5c41f3){var _0x30cdf3=this;return function(_0x38d9c8){_0x30cdf3[_0x1471('0xb8')](_0x5c41f3);logger[_0x1471('0x9c')](_0x5ae359,util[_0x1471('0x9d')](_0x38d9c8,{'showHidden':![],'depth':null}));};};Dialer['prototype'][_0x1471('0xd4')]=function(_0x2a167,_0x248feb,_0x1f751c){var _0x2af51b={'state':0x19,'statedesc':_0x1471('0xd5')};this[_0x1471('0xb8')](_0x248feb);this[_0x1471('0xd6')](_['merge'](_0x2af51b,_[_0x1471('0xd7')](_0x1f751c,['ContactId','ListId',_0x1471('0xd8'),_0x1471('0xd9'),'CampaignId'])),_0x1471('0xda'),_0x1471('0xdb'));logger['error'](_0x2a167);};Dialer['prototype']['isSuccess']=function(_0x1c0700){return _0x1c0700===_0x1471('0xdc');};Dialer['prototype'][_0x1471('0xdd')]=function(_0x397ff8){return!_[_0x1471('0x43')](_0x397ff8)&&_0x397ff8&&!_[_0x1471('0x43')](_0x397ff8[_0x1471('0x4c')])&&!_['isUndefined'](_0x397ff8[_0x1471('0x7d')])&&_0x397ff8[_0x1471('0x7d')]&&(this[_0x1471('0x27')][util[_0x1471('0x7f')]('SIP/%s',_0x397ff8[_0x1471('0x4c')])]['status']==='reachable'||this[_0x1471('0x27')][util[_0x1471('0x7f')]('SIP/%s',_0x397ff8[_0x1471('0x4c')])][_0x1471('0xde')]===_0x1471('0xdf'));};Dialer['prototype'][_0x1471('0xd6')]=function(_0x20922a,_0x5caaac,_0x274e9a){this['createHistory'](_0x20922a)[_0x1471('0xb5')](loggerCatch(_0x5caaac));this['moveContactManagedDialer'](_0x20922a)[_0x1471('0xb5')](loggerCatch(_0x274e9a));};Dialer[_0x1471('0xb0')][_0x1471('0x40')]=function(_0x3d5493){var _0x4681ac=this[_0x1471('0x2b')][_0x3d5493[_0x1471('0xe0')]];var _0x7932c9;if(!_[_0x1471('0xe1')](_0x3d5493)&&!_[_0x1471('0xe1')](_0x3d5493[_0x1471('0xe2')])&&!_[_0x1471('0xe1')](_0x3d5493[_0x1471('0xe2')][_0x1471('0xe3')])&&_0x3d5493[_0x1471('0xe4')]===_0x1471('0xe5')&&_0x4681ac){if(_0x4681ac['type']!=='ivr'&&this[_0x1471('0x24')][_0x4681ac['queue']]['dialAMDActive']&&_0x3d5493[_0x1471('0xe6')]==='HANGUP'){delete this[_0x1471('0x2b')][_0x3d5493['uniqueid']];this[_0x1471('0xb8')](this[_0x1471('0x24')][_0x4681ac[_0x1471('0xb7')]]);this['voiceQueues'][_0x4681ac[_0x1471('0xb7')]][_0x1471('0x67')]+=0x1;this[_0x1471('0x24')][_0x4681ac[_0x1471('0xb7')]][_0x1471('0xe7')]+=0x1;_0x7932c9=new Hangup(_0x4681ac,_0x3d5493);_0x7932c9[_0x1471('0xae')]=0x12;_0x7932c9['statedesc']=_0x1471('0xe8');_0x7932c9['membername']=_0x1471('0xe9');ami[_0x1471('0x54')]('custom:amd',ut[_0x1471('0xea')](_0x7932c9,_0x1471('0xeb')));this[_0x1471('0xd6')](_0x7932c9,_0x1471('0xec'),_0x1471('0xed'));}if(_0x4681ac[_0x1471('0x55')]!=='ivr'&&this[_0x1471('0x24')][_0x4681ac[_0x1471('0xb7')]]['dialAMDActive']&&_0x3d5493[_0x1471('0xe6')]===_0x1471('0xee')){var _0xd9bd3f=this;return new BPromise(function(_0x2fe52a,_0x4fbae1){delete _0xd9bd3f['uniqueId'][_0x3d5493[_0x1471('0xe0')]];_0xd9bd3f['updateOriginated'](_0xd9bd3f['voiceQueues'][_0x4681ac[_0x1471('0xb7')]]);_0xd9bd3f[_0x1471('0x24')][_0x4681ac[_0x1471('0xb7')]]['outboundAnswerCallsDay']+=0x1;_0xd9bd3f[_0x1471('0x24')][_0x4681ac[_0x1471('0xb7')]][_0x1471('0xe7')]+=0x1;var _0x16b66c=_0xd9bd3f[_0x1471('0x24')][_0x4681ac[_0x1471('0xb7')]];var _0x1bcb74=new Hangup(_0x4681ac,_0x3d5493);_0x1bcb74['state']=0x13;_0x1bcb74[_0x1471('0xef')]=_0x1471('0xf0');_0x1bcb74['membername']=_0x1471('0xe9');_0x1bcb74['countmachineretry']+=0x1;_0x1bcb74[_0x1471('0xf1')]+=0x1;_0x1bcb74['amd']=!![];ami[_0x1471('0x54')](_0x1471('0xf2'),ut[_0x1471('0xea')](_0x1bcb74,_0x1471('0xeb')));_0xd9bd3f['createHistory'](_0x1bcb74)[_0x1471('0xb5')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x1bcb74[_0x1471('0xf3')]+_0x1bcb74[_0x1471('0xf4')]+_0x1bcb74[_0x1471('0xf5')]+_0x1bcb74[_0x1471('0xf6')]+_0x1bcb74[_0x1471('0xf7')]+_0x1bcb74[_0x1471('0xf8')]+_0x1bcb74[_0x1471('0xf9')]+_0x1bcb74[_0x1471('0xfa')]>=_0x16b66c[_0x1471('0xfb')]){_0xd9bd3f[_0x1471('0xfc')](_0x1bcb74,_0x2fe52a,_0x4fbae1,_0x1471('0xfd'));}else{if(_0x1bcb74[_0x1471('0xf9')]>=_0x16b66c[_0x1471('0xfe')]){_0xd9bd3f[_0x1471('0xff')](_0x1bcb74,_0x2fe52a,_0x4fbae1,'reason\x2019\x20machine....');}else{_0xd9bd3f[_0x1471('0xc3')]({'active':![],'countmachineretry':_0x1bcb74[_0x1471('0xf9')],'scheduledat':moment()[_0x1471('0x100')](_0x16b66c[_0x1471('0x101')],_0x1471('0x102'))[_0x1471('0x7f')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x1bcb74[_0x1471('0x103')],'ListId':_0x1bcb74[_0x1471('0x104')],'VoiceQueueId':_0x1bcb74[_0x1471('0xd9')]||undefined,'CampaignId':_0x1bcb74[_0x1471('0x105')]||undefined})[_0x1471('0xb5')](loggerCatch(_0x1471('0x106')));_0x2fe52a({'reschedule':0x1});}}});}if(_0x4681ac[_0x1471('0x55')]===_0x1471('0x82')&&this[_0x1471('0x25')][_0x4681ac[_0x1471('0xb7')]][_0x1471('0x107')]&&_0x3d5493['value']===_0x1471('0x108')){delete this[_0x1471('0x2b')][_0x3d5493[_0x1471('0xe0')]];this['updateOriginated'](this['campaigns'][_0x4681ac[_0x1471('0xb7')]]);_0x7932c9=new Hangup(_0x4681ac,_0x3d5493);_0x7932c9[_0x1471('0xae')]=0x12;_0x7932c9[_0x1471('0xef')]=_0x1471('0xe8');_0x7932c9[_0x1471('0x109')]=_0x1471('0xe9');ami[_0x1471('0x54')](_0x1471('0xf2'),ut[_0x1471('0xea')](_0x7932c9,_0x1471('0xeb')));this[_0x1471('0xd6')](_0x7932c9,_0x1471('0x10a'),'[syncHangupInAMDIvr]');}if(_0x4681ac[_0x1471('0x55')]==='ivr'&&this['campaigns'][_0x4681ac[_0x1471('0xb7')]]['dialAMDActive']&&_0x3d5493['value']===_0x1471('0xee')){var _0xd9bd3f=this;return new BPromise(function(_0x13e016,_0x46dde3){delete _0xd9bd3f[_0x1471('0x2b')][_0x3d5493['uniqueid']];_0xd9bd3f[_0x1471('0xb8')](_0xd9bd3f[_0x1471('0x25')][_0x4681ac[_0x1471('0xb7')]]);_0xd9bd3f['campaigns'][_0x4681ac[_0x1471('0xb7')]][_0x1471('0x67')]+=0x1;_0xd9bd3f['campaigns'][_0x4681ac[_0x1471('0xb7')]]['outboundAnswerAgiCallsDay']+=0x1;var _0x2adb87=_0xd9bd3f[_0x1471('0x25')][_0x4681ac['queue']];var _0x13c01=new Hangup(_0x4681ac,_0x3d5493);_0x13c01['state']=0x13;_0x13c01[_0x1471('0xef')]=_0x1471('0xf0');_0x13c01['membername']=_0x1471('0xe9');_0x13c01[_0x1471('0xf9')]+=0x1;_0x13c01[_0x1471('0xf1')]+=0x1;_0x13c01[_0x1471('0xeb')]=!![];ami['emit']('custom:amd',ut[_0x1471('0xea')](_0x13c01,_0x1471('0xeb')));_0xd9bd3f[_0x1471('0xcf')](_0x13c01)[_0x1471('0xb5')](loggerCatch(_0x1471('0x10b')));if(_0x13c01[_0x1471('0xf3')]+_0x13c01[_0x1471('0xf4')]+_0x13c01[_0x1471('0xf5')]+_0x13c01[_0x1471('0xf6')]+_0x13c01[_0x1471('0xf7')]+_0x13c01['countabandonedretry']+_0x13c01[_0x1471('0xf9')]+_0x13c01[_0x1471('0xfa')]>=_0x2adb87['dialGlobalMaxRetry']){_0xd9bd3f[_0x1471('0xfc')](_0x13c01,_0x13e016,_0x46dde3,_0x1471('0xfd'));}else{if(_0x13c01['countmachineretry']>=_0x2adb87[_0x1471('0xfe')]){_0xd9bd3f[_0x1471('0xff')](_0x13c01,_0x13e016,_0x46dde3,_0x1471('0x10c'));}else{_0xd9bd3f[_0x1471('0xc3')]({'active':![],'countmachineretry':_0x13c01['countmachineretry'],'scheduledat':moment()['add'](_0x2adb87[_0x1471('0x101')],_0x1471('0x102'))['format'](_0x1471('0x10d')),'ContactId':_0x13c01[_0x1471('0x103')],'ListId':_0x13c01['ListId'],'VoiceQueueId':_0x13c01['VoiceQueueId']||undefined,'CampaignId':_0x13c01[_0x1471('0x105')]||undefined})['catch'](loggerCatch(_0x1471('0x106')));_0x13e016({'reschedule':0x1});}}});}}};Dialer['prototype'][_0x1471('0x3d')]=function(_0x3ebda6){var _0x559945=this['uniqueId'][_0x3ebda6[_0x1471('0xe0')]];var _0x2fde96=this;var _0xa413db;if(_0x559945&&_0x559945[_0x1471('0x55')]===_0x1471('0x82')){delete this[_0x1471('0x2b')][_0x3ebda6[_0x1471('0xe0')]];this['updateOriginated'](this['campaigns'][_0x559945[_0x1471('0xb7')]]);this[_0x1471('0x25')][_0x559945[_0x1471('0xb7')]][_0x1471('0x10e')]+=0x1;_0xa413db=new Hangup(_0x559945,_0x3ebda6);this[_0x1471('0xcf')](_0xa413db)[_0x1471('0xb5')](loggerCatch('[syncHangupIvr][createHistory]'));this[_0x1471('0xce')](_0xa413db)['catch'](loggerCatch(_0x1471('0x10f')));}if(_0x559945&&_0x559945[_0x1471('0x55')]!==_0x1471('0x82')&&isNotNull(this[_0x1471('0x24')][_0x559945[_0x1471('0xb7')]][_0x1471('0x110')])){delete this[_0x1471('0x2b')][_0x3ebda6[_0x1471('0xe0')]];this[_0x1471('0xb8')](this[_0x1471('0x24')][_0x559945[_0x1471('0xb7')]]);this[_0x1471('0x24')][_0x559945[_0x1471('0xb7')]][_0x1471('0x67')]+=0x1;this[_0x1471('0x24')][_0x559945['queue']][_0x1471('0xe7')]+=0x1;_0xa413db=new Hangup(_0x559945,_0x3ebda6);_0xa413db[_0x1471('0xae')]=0x10;_0xa413db[_0x1471('0xef')]=_0x1471('0x111');_0xa413db[_0x1471('0x109')]=_0x1471('0x112');this['createHistory'](_0xa413db)[_0x1471('0xb5')](loggerCatch(_0x1471('0x113')));this['moveContactManagedDialer'](_0xa413db)[_0x1471('0xb5')](loggerCatch('[syncHangupIvr]'));}if(_0x559945&&_0x559945[_0x1471('0x55')]!=='ivr'&&!isNotNull(this[_0x1471('0x24')][_0x559945[_0x1471('0xb7')]][_0x1471('0x110')])){delete this[_0x1471('0x2b')][_0x3ebda6[_0x1471('0xe0')]];this[_0x1471('0xb8')](this['voiceQueues'][_0x559945[_0x1471('0xb7')]]);this[_0x1471('0x24')][_0x559945['queue']][_0x1471('0x114')]+=0x1;_0xa413db=new Hangup(_0x559945,_0x3ebda6);_0xa413db[_0x1471('0xae')]=0xc;_0xa413db[_0x1471('0xef')]=_0x3ebda6['cause-txt'];_0xa413db[_0x1471('0x109')]='Unknow';this[_0x1471('0xcf')](_0xa413db)['catch'](loggerCatch('[syncHangupIvr][createHistory]'));this[_0x1471('0xce')](_0xa413db)[_0x1471('0xb5')](loggerCatch(_0x1471('0x10f')));}};Dialer[_0x1471('0xb0')]['syncAgentComplete']=function(_0x28c486){var _0x3114b0=this[_0x1471('0x2b')][_0x28c486[_0x1471('0xe0')]];var _0x5e479a=this;if(this['voiceQueues'][_0x28c486['queue']]){if(_0x3114b0&&_0x3114b0[_0x1471('0x55')]!==_0x1471('0x82')){delete this[_0x1471('0x2b')][_0x28c486[_0x1471('0xe0')]];this[_0x1471('0x24')][_0x28c486['queue']][_0x1471('0x67')]+=0x1;var _0x1842bf=new AgentComplete(_0x3114b0,_0x28c486);if(_0x28c486[_0x1471('0x115')]===_0x1471('0x116')){_0x1842bf[_0x1471('0x117')]=this[_0x1471('0x24')][_0x28c486[_0x1471('0xb7')]][_0x1471('0x118')]&&this[_0x1471('0x24')][_0x28c486[_0x1471('0xb7')]]['dialAgiAfterHangupAgent']?moment()[_0x1471('0x7f')](_0x1471('0x10d')):undefined;}this[_0x1471('0xcf')](_0x1842bf)[_0x1471('0xb5')](loggerCatch('[syncAgentComplete][createHistory]'));this[_0x1471('0xce')](_0x1842bf)['catch'](loggerCatch(_0x1471('0x119')));}}};Dialer['prototype'][_0x1471('0x33')]=function(_0x334896){if(this['voiceQueues'][_0x334896[_0x1471('0xb7')]]){if(this[_0x1471('0x2b')][_0x334896[_0x1471('0xe0')]]&&this['uniqueId'][_0x334896[_0x1471('0xe0')]][_0x1471('0x55')]!==_0x1471('0x82')){this['updateOriginated'](this[_0x1471('0x24')][_0x334896[_0x1471('0xb7')]]);this[_0x1471('0x2b')][_0x334896[_0x1471('0xe0')]][_0x1471('0x11a')]=moment()[_0x1471('0x7f')](_0x1471('0x10d'));}}};Dialer[_0x1471('0xb0')][_0x1471('0x11b')]=function(_0x23746d){this[_0x1471('0xcf')](_0x23746d)[_0x1471('0xb5')](loggerCatch(_0x1471('0x11c')));this['moveContactManagedDialer'](_0x23746d)[_0x1471('0xb5')](loggerCatch(_0x1471('0x11d')));};Dialer['prototype'][_0x1471('0x36')]=function(_0xd20d49){var _0xfd9755=this[_0x1471('0x2b')][_0xd20d49[_0x1471('0xe0')]];var _0x5d2b18=this;if(this[_0x1471('0x24')][_0xd20d49[_0x1471('0xb7')]]){if(_0xfd9755&&_0xfd9755[_0x1471('0x55')]!==_0x1471('0x82')){delete this[_0x1471('0x2b')][_0xd20d49[_0x1471('0xe0')]];this[_0x1471('0xb8')](this[_0x1471('0x24')][_0xd20d49[_0x1471('0xb7')]]);_0xfd9755['droptime']=moment()[_0x1471('0x7f')]('YYYY-MM-DD\x20HH:mm:ss');var _0x30bf14=new QueueCallerAbandon(_0xfd9755,_0xd20d49);if(getSeconds(_0xfd9755['droptime'],_0xfd9755[_0x1471('0x11e')])>=_0xfd9755[_0x1471('0x11f')]){this[_0x1471('0x24')][_0xd20d49[_0x1471('0xb7')]][_0x1471('0x89')]+=0x1;this[_0x1471('0x24')][_0xd20d49[_0x1471('0xb7')]][_0x1471('0x6d')]+=0x1;this[_0x1471('0x24')][_0xd20d49[_0x1471('0xb7')]][_0x1471('0x73')]+=0x1;_0x30bf14['state']=0xa;_0x30bf14['statedesc']=_0x1471('0x120');_0x30bf14[_0x1471('0x121')]=_0x1471('0x122');_0x30bf14['agiafterat']=this[_0x1471('0x24')][_0xd20d49[_0x1471('0xb7')]][_0x1471('0x118')]?moment()['format'](_0x1471('0x10d')):undefined;_0x30bf14[_0x1471('0xf7')]+=0x1;_0x30bf14[_0x1471('0xf1')]+=0x1;if(_0x30bf14[_0x1471('0xf7')]>=this['voiceQueues'][_0xd20d49[_0x1471('0xb7')]]['dialDropMaxRetry']){this[_0x1471('0x11b')](_0x30bf14);}else{this[_0x1471('0xc3')]({'active':![],'countdropretry':_0x30bf14['countdropretry'],'scheduledat':moment()[_0x1471('0x100')](this['voiceQueues'][_0xd20d49[_0x1471('0xb7')]]['dialDropRetryFrequency'],_0x1471('0x102'))[_0x1471('0x7f')](_0x1471('0x10d')),'ContactId':_0xfd9755['ContactId'],'ListId':_0xfd9755[_0x1471('0x104')],'VoiceQueueId':_0xfd9755['VoiceQueueId']||undefined,'CampaignId':_0xfd9755[_0x1471('0x105')]||undefined})['catch'](loggerCatch(_0x1471('0x123')));var _0x1f78ee=new History(_0x30bf14);_0x1f78ee[_0x1471('0xae')]=0xa;_0x1f78ee[_0x1471('0xef')]=_0x1471('0x120');_0x1f78ee[_0x1471('0xaf')]=moment()[_0x1471('0x7f')](_0x1471('0x10d'));_0x1f78ee[_0x1471('0x124')]=_0x1f78ee[_0x1471('0xaf')];_0x1f78ee[_0x1471('0x125')]=_0x30bf14[_0x1471('0x125')];_0x1f78ee[_0x1471('0x126')]=_0x30bf14[_0x1471('0x126')];this[_0x1471('0xcf')](_0x1f78ee)['catch'](loggerCatch('[syncAgentComplete][createHistory][10]'));}}else{this[_0x1471('0x24')][_0xd20d49[_0x1471('0xb7')]][_0x1471('0x71')]+=0x1;this[_0x1471('0x24')][_0xd20d49['queue']][_0x1471('0x6c')]+=0x1;_0x30bf14[_0x1471('0xae')]=0xb;_0x30bf14[_0x1471('0xef')]='Abandoned';_0x30bf14[_0x1471('0x121')]=_0x1471('0x127');_0x30bf14[_0x1471('0xf8')]+=0x1;_0x30bf14[_0x1471('0xf1')]+=0x1;if(_0x30bf14[_0x1471('0xf8')]>=this[_0x1471('0x24')][_0xd20d49[_0x1471('0xb7')]][_0x1471('0x128')]){this['queueCallerAbandonCreateState'](_0x30bf14);}else{this[_0x1471('0xc3')]({'active':![],'countabandonedretry':_0x30bf14[_0x1471('0xf8')],'scheduledat':moment()[_0x1471('0x100')](this['voiceQueues'][_0xd20d49['queue']][_0x1471('0x129')],_0x1471('0x102'))[_0x1471('0x7f')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0xfd9755[_0x1471('0x103')],'ListId':_0xfd9755[_0x1471('0x104')],'VoiceQueueId':_0xfd9755[_0x1471('0xd9')]||undefined,'CampaignId':_0xfd9755['CampaignId']||undefined})[_0x1471('0xb5')](loggerCatch(_0x1471('0x12a')));var _0x1f78ee=new History(_0x30bf14);_0x1f78ee['state']=0xb;_0x1f78ee[_0x1471('0xef')]='Abandoned';_0x1f78ee[_0x1471('0xaf')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x1f78ee[_0x1471('0x124')]=_0x1f78ee[_0x1471('0xaf')];_0x1f78ee[_0x1471('0x125')]=_0x30bf14[_0x1471('0x125')];_0x1f78ee[_0x1471('0x126')]=_0x30bf14[_0x1471('0x126')];this['createHistory'](_0x1f78ee)['catch'](loggerCatch('[syncAgentComplete][createHistory][11]'));}}}}};Dialer['prototype']['syncNewExten']=function(_0x43eff3){if(this['actions'][_0x43eff3[_0x1471('0xe0')]]){this[_0x1471('0x29')][_0x43eff3[_0x1471('0xe0')]][_0x1471('0xb4')]=_0x43eff3[_0x1471('0xb4')];}if(this[_0x1471('0x2b')][_0x43eff3[_0x1471('0xe0')]]){this[_0x1471('0x2b')][_0x43eff3[_0x1471('0xe0')]][_0x1471('0xb4')]=_0x43eff3[_0x1471('0xb4')];}};Dialer[_0x1471('0xb0')]['syncQueueMember']=function(_0x1cc306){if(strategy[this[_0x1471('0x24')][this[_0x1471('0x29')][_0x1cc306[_0x1471('0x12b')]][_0x1471('0xb7')]][_0x1471('0x57')]]==='roundrobin'){if(this['actions'][_0x1cc306[_0x1471('0x12b')]]&&_[_0x1471('0xe1')](this['actions'][_0x1cc306[_0x1471('0x12b')]][_0x1471('0x12c')])&&_0x1cc306['status']==='1'&&_0x1cc306[_0x1471('0x12d')]==='0'){if(this[_0x1471('0x26')][_0x1cc306[_0x1471('0x12e')]]){if(!this['agents'][_0x1cc306[_0x1471('0x12e')]][_0x1471('0x12c')]){this['agents'][_0x1cc306[_0x1471('0x12e')]]['locked']=!![];this[_0x1471('0x29')][_0x1cc306[_0x1471('0x12b')]][_0x1471('0x12c')]=!![];this[_0x1471('0x29')][_0x1cc306['actionid']]['stateinterface']=_0x1cc306[_0x1471('0x12e')];}}}}else if((strategy[this['voiceQueues'][this[_0x1471('0x29')][_0x1cc306[_0x1471('0x12b')]][_0x1471('0xb7')]][_0x1471('0x57')]]||_0x1471('0x1d'))===_0x1471('0x1d')){if(this['actions'][_0x1cc306[_0x1471('0x12b')]]){if(this[_0x1471('0x26')][_0x1cc306[_0x1471('0x12e')]]){this['actions'][_0x1cc306[_0x1471('0x12b')]][_0x1471('0x12e')]=_0x1cc306[_0x1471('0x12e')];if(_['isNil'](this['queueBooked'][this[_0x1471('0x29')][_0x1cc306['actionid']]['queue']])){this[_0x1471('0x30')][this[_0x1471('0x29')][_0x1cc306[_0x1471('0x12b')]]['queue']]=[];}this['queueBooked'][this[_0x1471('0x29')][_0x1cc306['actionid']]['queue']][_0x1471('0x12f')](_[_0x1471('0x94')](_[_0x1471('0xd7')](this[_0x1471('0x29')][_0x1cc306[_0x1471('0x12b')]],[_0x1471('0x130'),_0x1471('0x12e')]),{'status':_0x1cc306['status'],'paused':_0x1cc306[_0x1471('0x12d')]}));}}}};function unlockQueueStatus(_0x4b0680,_0x485fa7){setTimeout(function(){if(_[_0x1471('0x43')](_0x4b0680[_0x1471('0x131')])){loggerBooked[_0x1471('0x9c')](_0x1471('0x132'),_0x485fa7);}_0x4b0680[_0x1471('0x131')]=!![];loggerBooked['info']('[booked][unlockQueueStatus]',_0x485fa7,JSON[_0x1471('0x50')](_[_0x1471('0xd7')](_0x4b0680,[_0x1471('0x4c'),_0x1471('0x131')])));},0x1f3);}Dialer[_0x1471('0xb0')][_0x1471('0x133')]=function(_0x4e8336){var _0x5a08bc=this;var _0x1f1949=_0x5a08bc[_0x1471('0x24')][_0x5a08bc[_0x1471('0x29')][_0x4e8336[_0x1471('0x12b')]][_0x1471('0xb7')]];if(strategy[this[_0x1471('0x24')][this[_0x1471('0x29')][_0x4e8336[_0x1471('0x12b')]][_0x1471('0xb7')]][_0x1471('0x57')]]===_0x1471('0x1e')){if(this[_0x1471('0x29')][_0x4e8336['actionid']]&&this['actions'][_0x4e8336[_0x1471('0x12b')]][_0x1471('0x12e')]){this[_0x1471('0x23')][_0x1471('0x134')](this[_0x1471('0x29')][_0x4e8336[_0x1471('0x12b')]]['idHopper'],this[_0x1471('0x29')][_0x4e8336[_0x1471('0x12b')]][_0x1471('0x12e')])[_0x1471('0xb5')](function(_0x384f4e){logger['error']('[Catch][Preview][syncQueueStatusComplete]',util[_0x1471('0x9d')](_0x384f4e,{'showHidden':![],'depth':null}));})[_0x1471('0x21')](function(){_0x5a08bc[_0x1471('0xb8')](_0x5a08bc[_0x1471('0x24')][_0x5a08bc[_0x1471('0x29')][_0x4e8336[_0x1471('0x12b')]][_0x1471('0xb7')]]);_0x5a08bc[_0x1471('0x26')][_0x5a08bc[_0x1471('0x29')][_0x4e8336[_0x1471('0x12b')]][_0x1471('0x12e')]][_0x1471('0x12c')]=![];delete _0x5a08bc[_0x1471('0x29')][_0x4e8336[_0x1471('0x12b')]];unlockQueueStatus(_0x1f1949);});}else{this[_0x1471('0xb8')](this[_0x1471('0x24')][this[_0x1471('0x29')][_0x4e8336['actionid']][_0x1471('0xb7')]]);this['rescheduleContact']({'active':![],'ContactId':this[_0x1471('0x29')][_0x4e8336['actionid']][_0x1471('0x103')],'ListId':this['actions'][_0x4e8336[_0x1471('0x12b')]]['ListId'],'VoiceQueueId':this[_0x1471('0x29')][_0x4e8336[_0x1471('0x12b')]]['VoiceQueueId']||undefined,'CampaignId':this[_0x1471('0x29')][_0x4e8336[_0x1471('0x12b')]]['CampaignId']||undefined})[_0x1471('0xb5')](loggerCatch(_0x1471('0x135')));delete this[_0x1471('0x29')][_0x4e8336[_0x1471('0x12b')]];unlockQueueStatus(_0x1f1949);}}else if((strategy[this[_0x1471('0x24')][this['actions'][_0x4e8336[_0x1471('0x12b')]][_0x1471('0xb7')]]['strategy']]||_0x1471('0x1d'))===_0x1471('0x1d')){var _0x30f704;if(this[_0x1471('0x29')][_0x4e8336['actionid']]&&!_[_0x1471('0x4d')](this[_0x1471('0x30')][this[_0x1471('0x29')][_0x4e8336[_0x1471('0x12b')]]['queue']])){if(this['queueBookedRR'][_0x5a08bc['actions'][_0x4e8336[_0x1471('0x12b')]][_0x1471('0xb7')]]){this[_0x1471('0x31')][_0x5a08bc['actions'][_0x4e8336[_0x1471('0x12b')]][_0x1471('0xb7')]]=this[_0x1471('0x31')][this['actions'][_0x4e8336[_0x1471('0x12b')]][_0x1471('0xb7')]]?this[_0x1471('0x31')][this['actions'][_0x4e8336[_0x1471('0x12b')]][_0x1471('0xb7')]]:this[_0x1471('0x30')][this[_0x1471('0x29')][_0x4e8336[_0x1471('0x12b')]][_0x1471('0xb7')]]?this[_0x1471('0x30')][this[_0x1471('0x29')][_0x4e8336[_0x1471('0x12b')]]['queue']]['_rr']||0x0:0x0;}this[_0x1471('0x30')][this['actions'][_0x4e8336[_0x1471('0x12b')]][_0x1471('0xb7')]][_0x1471('0x136')]=this[_0x1471('0x31')][this[_0x1471('0x29')][_0x4e8336[_0x1471('0x12b')]]['queue']];for(var _0x5ce312=0x0;_0x5ce312=0x0;})[_0x1471('0xb5')](myreject(_0x53efb5)));}}else{_0x330545['push'](ami[_0x1471('0x14c')]({'action':'command','command':util[_0x1471('0x7f')](_0x1471('0x153'),_0x4cd09b,!_['isUndefined'](config[_0x1471('0x14f')][_0x4bb81e])?_0x4bb81e:'')})[_0x1471('0xbc')](function(_0x191ac4){return _0x191ac4['content'][_0x1471('0x151')](_0x1471('0x152'))>=0x0;})[_0x1471('0xb5')](myreject(_0x53efb5)));}BPromise[_0x1471('0x154')](_0x330545)[_0x1471('0xbc')](function(_0x4febe9){var _0x2d9a7c=_[_0x1471('0x155')](_0x4febe9);if(_0x2d9a7c){return _0x36d16d(_0x2d9a7c);}else{_0x52142a[_0x1471('0x44')]=_0x8c573f?_0x1471('0x156'):_0x1471('0x157');return _0x53efb5(msgResponse(_0x1471('0x158'),_0x1471('0x149'),_0x1471('0x159')+_0x8c573f+'\x20'+_0x2a88af+_0x1471('0x15a')+util[_0x1471('0x9d')](_0x4cd09b,{'showHidden':![],'depth':null})+_0x1471('0x15b')+_0x4bb81e));}})[_0x1471('0xb5')](function(_0x3b7b5a){return _0x53efb5(msgResponse(_0x1471('0x147'),_0x1471('0x149'),JSON[_0x1471('0x50')](_0x3b7b5a)));});});};Dialer[_0x1471('0xb0')]['checkDialMethod']=function(_0x50b07e){var _0x45d3e9=this;return function(){switch(_0x50b07e[_0x1471('0x63')]){case _0x1471('0x15c'):freeVariablesPredictive(_0x50b07e);_0x45d3e9['handlePower'](_0x50b07e,0x1);break;case _0x1471('0x15d'):freeVariablesPredictive(_0x50b07e);_0x45d3e9[_0x1471('0x15e')](_0x50b07e,_0x50b07e[_0x1471('0x15f')]);break;case _0x1471('0xb'):_0x45d3e9[_0x1471('0xb')](_0x50b07e);break;case _0x1471('0xa'):freeVariablesPredictive(_0x50b07e);_0x45d3e9[_0x1471('0x15e')](_0x50b07e,0x1);break;default:freeVariablesPredictive(_0x50b07e);logger[_0x1471('0x9c')](_0x1471('0x160'),_0x50b07e[_0x1471('0x4c')],_0x1471('0x161'));}};};Dialer[_0x1471('0xb0')][_0x1471('0x162')]=function(_0x56f47d){var _0x199313=this;return function(){_0x199313[_0x1471('0x163')](_0x56f47d);};};Dialer[_0x1471('0xb0')][_0x1471('0xd')]=function(_0x5891ce){var _0x9a7951=this;if(isNotPreview(_0x5891ce[_0x1471('0x63')])){if(isVoiceQueueOutbound(_0x5891ce[_0x1471('0x55')])&&isActive(_0x5891ce['dialActive'])){_0x5891ce[_0x1471('0xac')]=!![];BPromise[_0x1471('0xbb')]()['then'](checkIsLoggedIn(_0x5891ce,_0x5891ce[_0x1471('0x5a')]))['then'](checkIsActive(_0x5891ce,_0x5891ce[_0x1471('0x62')]))[_0x1471('0xbc')](checkInterval(_0x5891ce))[_0x1471('0xbc')](_0x9a7951[_0x1471('0x142')](_0x5891ce))['then'](_0x9a7951[_0x1471('0x146')](_0x5891ce[_0x1471('0x164')],_0x5891ce['dialTimezone'],_0x5891ce['name'],_0x5891ce))[_0x1471('0xbc')](_0x9a7951[_0x1471('0x148')](_0x5891ce['Interval'],_0x5891ce[_0x1471('0x165')],_0x5891ce['name'],_0x5891ce))[_0x1471('0xbc')](_0x9a7951[_0x1471('0x166')](_0x5891ce))[_0x1471('0xb5')](loggerCatchQueueSummary('[syncQueueSummary]',_0x5891ce));}else{notSendMessagesQueue(_0x5891ce);}}else{freeVariablesPredictive(_0x5891ce);}};Dialer['prototype'][_0x1471('0x141')]=function(){var _0x4194d0=this;var _0x1e1a39;for(var _0x4d6f6a in this[_0x1471('0x25')]){if(typeof this[_0x1471('0x25')][_0x4d6f6a]!==_0x1471('0xa0')){_0x1e1a39=this[_0x1471('0x25')][_0x4d6f6a];if(isCampaignIvr(_0x1e1a39[_0x1471('0x55')])&&isActive(_0x1e1a39[_0x1471('0x7d')])){_0x1e1a39[_0x1471('0xac')]=!![];BPromise[_0x1471('0xbb')]()[_0x1471('0xbc')](checkIsActive(_0x1e1a39,_0x1e1a39[_0x1471('0x7d')]))[_0x1471('0xbc')](checkInterval(_0x1e1a39))[_0x1471('0xbc')](_0x4194d0['checkIsTrunkReachable'](_0x1e1a39))[_0x1471('0xbc')](_0x4194d0[_0x1471('0x146')](_0x1e1a39[_0x1471('0x164')],_0x1e1a39['dialTimezone'],_0x1e1a39['name'],_0x1e1a39))[_0x1471('0xbc')](_0x4194d0[_0x1471('0x148')](_0x1e1a39[_0x1471('0x49')],_0x1e1a39[_0x1471('0x165')],_0x1e1a39[_0x1471('0x4c')],_0x1e1a39))[_0x1471('0xbc')](_0x4194d0[_0x1471('0x162')](_0x1e1a39))[_0x1471('0xb5')](loggerCatchQueueSummary(_0x1471('0x167'),_0x1e1a39));}else{notSendMessagesCampaign(_0x1e1a39);}}}};function getCallerIdRandom(_0x564099,_0x24cce9){var _0x59134a;var _0x468a86;var _0x55dc21;if(_0x24cce9<=0x0){_0x24cce9=0x1;}_0x59134a=new RegExp(_0x1471('0x168')+_0x24cce9+'}$');_0x468a86=Math['pow'](0xa,_0x24cce9-0x1);_0x55dc21=Math['pow'](0xa,_0x24cce9)-0x1;return util['format']('%s',_['replace'](_0x564099,_0x59134a,_[_0x1471('0x169')](_0x468a86,_0x55dc21)));}function extractCalleridName(_0x4619bc){var _0x352d42=_0x4619bc[_0x1471('0x16a')](/"(.*?)"/);return _0x352d42?_0x352d42[0x1]:_0x4619bc;}function extractCalleridNumber(_0x1eb5aa){var _0x7de717=_0x1eb5aa['match'](/<(.*?)>/);return _0x7de717?_0x7de717[0x1]:_0x1eb5aa;}Dialer[_0x1471('0xb0')][_0x1471('0x16b')]=function(_0x599fc7,_0x3f461f){var _0x5e5835=this;var _0x1aa0bd=uuid['v4']();this[_0x1471('0x29')][_0x1aa0bd]=new Action(_0x599fc7,_0x3f461f,_0x1aa0bd);return new BPromise(function(_0x5f376f,_0x25dfb6){if(_[_0x1471('0x43')](_0x599fc7)&&typeof _0x599fc7!==_0x1471('0x16c')){return _0x25dfb6(msgResponse('originate',_0x1471('0x149'),_0x1471('0x16d')));}if(_['isUndefined'](_0x3f461f['Contact'][_0x1471('0x16e')])||_0x3f461f[_0x1471('0x16f')][_0x1471('0x16e')]===null){return _0x25dfb6(msgResponse(_0x1471('0x170'),'Failure',_0x1471('0x171')));}var _0xdd1b20={'XMD-CALLERID':_0x5e5835[_0x1471('0x29')][_0x1aa0bd][_0x1471('0x172')](),'XMD-AGI':_0x599fc7['dialQueueProject']?util[_0x1471('0x7f')](_0x1471('0x173'),ipAgi,_0x599fc7['dialQueueProject']):_0x1471('0x174'),'XMD-AGIAFTER':_0x599fc7[_0x1471('0x118')]?util['format'](_0x1471('0x173'),ipAgi,_0x599fc7['dialQueueProject2']):_0x1471('0x174'),'XMD-QUEUE':_0x599fc7[_0x1471('0x55')]===_0x1471('0x56')?util[_0x1471('0x7f')](_0x1471('0x175'),_0x599fc7[_0x1471('0x4c')],_0x599fc7[_0x1471('0x176')]||'',_0x599fc7[_0x1471('0x177')]?'c':'',_0x599fc7['dialQueueTimeout']||0x3):_0x1471('0x174'),'XMD-CONTACTID':_0x3f461f[_0x1471('0x103')],'XMD-CDRTYPE':_0x1471('0x8'),'CALLERID(all)':_0x5e5835[_0x1471('0x29')][_0x1aa0bd][_0x1471('0x172')](),'XMD-AMD':_0x599fc7[_0x1471('0x107')]?'ACTIVE':'NONE','XMD-DESTINATION':_0x1471('0xe5')};if(_0x599fc7[_0x1471('0x107')]){_0xdd1b20[_0x1471('0x178')]=_0x599fc7[_0x1471('0x179')]||0x9c4;_0xdd1b20[_0x1471('0x17a')]=_0x599fc7[_0x1471('0x17b')]||0x5dc;_0xdd1b20['XMD-AMDAFTERGREETINGSILENCE']=_0x599fc7[_0x1471('0x17c')]||0x320;_0xdd1b20[_0x1471('0x17d')]=_0x599fc7[_0x1471('0x17e')]||0x1388;_0xdd1b20[_0x1471('0x17f')]=_0x599fc7[_0x1471('0x180')]||0x64;_0xdd1b20[_0x1471('0x181')]=_0x599fc7[_0x1471('0x182')]||0x32;_0xdd1b20[_0x1471('0x183')]=_0x599fc7[_0x1471('0x184')]||0x3;_0xdd1b20[_0x1471('0x185')]=_0x599fc7[_0x1471('0x186')]||0x100;_0xdd1b20[_0x1471('0x187')]=_0x599fc7['dialAMDMaximumWordLength']||0x1388;}if(_0x599fc7[_0x1471('0x55')]===_0x1471('0x56')){_0xdd1b20[_0x1471('0x188')]=_0x3f461f[_0x1471('0xd9')];}else{_0xdd1b20[_0x1471('0x189')]=_0x3f461f[_0x1471('0x105')];}for(var _0x2529df in _0x3f461f['Contact']){if(typeof _0x3f461f['Contact'][_0x2529df]!==_0x1471('0xa0')){if(isNotNull(_0x3f461f[_0x1471('0x16f')][_0x2529df])&&_0x2529df!=='id'&&_0x2529df!=='tags'&&_0x2529df!==_0x1471('0x18a')&&_0x2529df!=='updatedAt'){_0xdd1b20[util['format'](_0x1471('0x18b'),_0x1471('0x18c'),_[_0x1471('0x18d')](_0x2529df))]=_0x3f461f['Contact'][_0x2529df];}}}var _0x1ff306=_0x5e5835['isTrunkReachable'](_0x599fc7[_0x1471('0x7c')])?getCallerId(_0x599fc7[_0x1471('0x7c')][_0x1471('0x7e')],_0x599fc7[_0x1471('0x64')],_0x599fc7[_0x1471('0x18e')]>0x0?getCallerIdRandom(_0x599fc7['dialOriginateCallerIdNumber'],_0x599fc7[_0x1471('0x18e')]):_0x599fc7[_0x1471('0x65')]):getCallerId(_[_0x1471('0xe1')](_0x599fc7[_0x1471('0x143')])?_0x599fc7[_0x1471('0x7c')]['callerid']:_0x599fc7[_0x1471('0x143')]['callerid'],_0x599fc7['dialOriginateCallerIdName'],_0x599fc7['dialRandomLastDigitCallerIdNumber']>0x0?getCallerIdRandom(_0x599fc7[_0x1471('0x65')],_0x599fc7[_0x1471('0x18e')]):_0x599fc7[_0x1471('0x65')]);if(_0x1ff306){_0xdd1b20[_0x1471('0x18f')]=_0x5e5835['actions'][_0x1aa0bd]['originatecalleridname']=extractCalleridName(_0x1ff306);_0xdd1b20[_0x1471('0x190')]=_0x5e5835[_0x1471('0x29')][_0x1aa0bd]['originatecalleridnum']=extractCalleridNumber(_0x1ff306);}return ami[_0x1471('0x14c')]({'actionid':_0x1aa0bd,'action':_0x1471('0x170'),'channel':_0x5e5835[_0x1471('0xdd')](_0x599fc7[_0x1471('0x7c')])?util[_0x1471('0x7f')]('SIP/%s/%s%s',_0x599fc7[_0x1471('0x7c')][_0x1471('0x4c')],isNotNull(_0x599fc7[_0x1471('0x66')])?_0x599fc7[_0x1471('0x66')][_0x1471('0x191')]()||'':'',_0x599fc7[_0x1471('0x192')]>0x0?_0x3f461f[_0x1471('0x16f')][_0x1471('0x16e')]['substring'](_0x599fc7[_0x1471('0x192')]):_0x3f461f[_0x1471('0x16f')][_0x1471('0x16e')]):util['format'](_0x1471('0x193'),_[_0x1471('0xe1')](_0x599fc7[_0x1471('0x143')])?_0x599fc7[_0x1471('0x7c')][_0x1471('0x4c')]:_0x599fc7[_0x1471('0x143')]['name'],isNotNull(_0x599fc7[_0x1471('0x66')])?_0x599fc7[_0x1471('0x66')]['trim']()||'':'',_0x599fc7[_0x1471('0x192')]>0x0?_0x3f461f[_0x1471('0x16f')][_0x1471('0x16e')]['substring'](_0x599fc7[_0x1471('0x192')]):_0x3f461f['Contact']['phone']),'callerid':_0x1ff306,'Exten':_0x1471('0xe5'),'Context':_0x1471('0x194'),'Priority':'1','variable':_0xdd1b20,'timeout':(_0x599fc7['dialOriginateTimeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x1aa0bd})['then'](function(_0x2e7605){return _0x5f376f(_0x2e7605);})['catch'](function(_0x1428e6){_0x599fc7[_0x1471('0x195')]+=0x1;var _0x458454=new History(_0x5e5835[_0x1471('0x29')][_0x1aa0bd]);logger[_0x1471('0x9c')](util[_0x1471('0x7f')](_0x1471('0x196'),JSON[_0x1471('0x50')](_0x1428e6)));_0x458454[_0x1471('0xae')]=0xe;_0x458454[_0x1471('0xef')]=_0x1471('0x197');_0x458454[_0x1471('0xaf')]=moment()[_0x1471('0x7f')](_0x1471('0x10d'));_0x458454[_0x1471('0x124')]=_0x458454[_0x1471('0xaf')];_0x5e5835[_0x1471('0xcf')](_0x458454)[_0x1471('0xb5')](loggerCatch(_0x1471('0x198')));_0x5e5835[_0x1471('0xce')](_0x458454)[_0x1471('0xb5')](loggerCatch(_0x1471('0x198')))[_0x1471('0x21')](function(){delete _0x5e5835[_0x1471('0x29')][_0x1aa0bd];return _0x25dfb6(msgResponse('originate',_0x1471('0x199'),_0x1471('0x19a')));});});});};Dialer[_0x1471('0xb0')][_0x1471('0x38')]=function(_0x311535){var _0x235d43=this[_0x1471('0x29')][_0x311535[_0x1471('0x12b')]];if(_0x235d43){delete this[_0x1471('0x29')][_0x311535[_0x1471('0x12b')]];_0x235d43[_0x1471('0x11e')]=moment()[_0x1471('0x7f')](_0x1471('0x10d'));var _0x463a2b=_0x235d43['type']==='ivr'?this[_0x1471('0x25')][_0x235d43[_0x1471('0xb7')]]:this['voiceQueues'][_0x235d43['getQueue']()];if(!this[_0x1471('0x19b')](_0x311535[_0x1471('0x19c')])){this[_0x1471('0xb8')](_0x463a2b);return this[_0x1471('0x19d')](_0x235d43,_0x463a2b,_0x311535)[_0x1471('0xb5')](loggerCatch('[callProgressDetecting]\x20'));}this[_0x1471('0x2b')][_0x311535[_0x1471('0xe0')]]=_0x235d43;}};Dialer[_0x1471('0xb0')]['checkRetriveMax']=function(_0x125682,_0xe042e1,_0x158723){var _0x23528d=new History(_0xe042e1);if(_0x23528d[_0x1471('0xf3')]+_0x23528d[_0x1471('0xf4')]+_0x23528d['countnoanswerretry']+_0x23528d[_0x1471('0xf6')]+_0x23528d[_0x1471('0xf7')]+_0x23528d[_0x1471('0xf8')]+_0x23528d['countmachineretry']+_0x23528d[_0x1471('0xfa')]>=_0x158723[_0x1471('0xfb')]-0x1){return!![];}switch(_0x125682){case 0x3:if(_0x23528d[_0x1471('0xf5')]>=_0x158723[_0x1471('0x19e')]-0x1){return!![];}this[_0x1471('0xc3')]({'active':![],'countnoanswerretry':_0x23528d[_0x1471('0xf5')]+=0x1,'scheduledat':moment()[_0x1471('0x100')](_0x158723[_0x1471('0x19f')],_0x1471('0x102'))[_0x1471('0x7f')](_0x1471('0x10d')),'ContactId':_0x23528d['ContactId'],'ListId':_0x23528d[_0x1471('0x104')],'VoiceQueueId':_0x23528d[_0x1471('0xd9')]||undefined,'CampaignId':_0x23528d[_0x1471('0x105')]||undefined})[_0x1471('0xb5')](loggerCatch(_0x1471('0x1a0')));break;case 0x5:if(_0x23528d[_0x1471('0xf3')]>=_0x158723[_0x1471('0x1a1')]-0x1){return!![];}this[_0x1471('0xc3')]({'active':![],'countbusyretry':_0x23528d['countbusyretry']+=0x1,'scheduledat':moment()[_0x1471('0x100')](_0x158723['dialBusyRetryFrequency'],_0x1471('0x102'))['format'](_0x1471('0x10d')),'ContactId':_0x23528d['ContactId'],'ListId':_0x23528d[_0x1471('0x104')],'VoiceQueueId':_0x23528d[_0x1471('0xd9')]||undefined,'CampaignId':_0x23528d[_0x1471('0x105')]||undefined})[_0x1471('0xb5')](loggerCatch(_0x1471('0x1a2')));break;case 0x8:if(_0x23528d['countcongestionretry']>=_0x158723[_0x1471('0x1a3')]-0x1){return!![];}this[_0x1471('0xc3')]({'active':![],'countcongestionretry':_0x23528d[_0x1471('0xf4')]+=0x1,'scheduledat':moment()[_0x1471('0x100')](_0x158723['dialCongestionRetryFrequency'],_0x1471('0x102'))['format'](_0x1471('0x10d')),'ContactId':_0x23528d['ContactId'],'ListId':_0x23528d[_0x1471('0x104')],'VoiceQueueId':_0x23528d[_0x1471('0xd9')]||undefined,'CampaignId':_0x23528d[_0x1471('0x105')]||undefined})['catch'](loggerCatch(_0x1471('0x1a4')));break;case 0x0:if(_0x23528d['countnosuchnumberretry']>=_0x158723[_0x1471('0x1a5')]-0x1){return!![];}else{this['rescheduleContact']({'active':![],'countnosuchnumberretry':_0x23528d[_0x1471('0xf6')]+=0x1,'scheduledat':moment()['add'](_0x158723[_0x1471('0x1a6')],_0x1471('0x102'))[_0x1471('0x7f')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x23528d[_0x1471('0x103')],'ListId':_0x23528d[_0x1471('0x104')],'VoiceQueueId':_0x23528d[_0x1471('0xd9')]||undefined,'CampaignId':_0x23528d['CampaignId']||undefined})[_0x1471('0xb5')](loggerCatch(_0x1471('0x1a7')));}break;case 0xa:if(_0x23528d[_0x1471('0xf7')]>=_0x158723['dialDropMaxRetry']-0x1){return!![];}this['rescheduleContact']({'active':![],'countdropretry':_0x23528d['countdropretry']+=0x1,'scheduledat':moment()[_0x1471('0x100')](_0x158723['dialDropRetryFrequency'],_0x1471('0x102'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x23528d[_0x1471('0x103')],'ListId':_0x23528d[_0x1471('0x104')],'VoiceQueueId':_0x23528d['VoiceQueueId']||undefined,'CampaignId':_0x23528d['CampaignId']||undefined})[_0x1471('0xb5')](loggerCatch(_0x1471('0x123')));break;case 0xb:if(_0x23528d['countabandonedretry']>=_0x158723[_0x1471('0x128')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countabandonedretry':_0x23528d[_0x1471('0xf8')]+=0x1,'scheduledat':moment()['add'](_0x158723[_0x1471('0x129')],_0x1471('0x102'))[_0x1471('0x7f')](_0x1471('0x10d')),'ContactId':_0x23528d[_0x1471('0x103')],'ListId':_0x23528d[_0x1471('0x104')],'VoiceQueueId':_0x23528d['VoiceQueueId']||undefined,'CampaignId':_0x23528d['CampaignId']||undefined})['catch'](loggerCatch('[rescheduleContact][Abandoned]'));break;case 0x13:if(_0x23528d[_0x1471('0xf9')]>=_0x158723[_0x1471('0xfe')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countmachineretry':_0x23528d['countmachineretry']+=0x1,'scheduledat':moment()[_0x1471('0x100')](_0x158723[_0x1471('0x101')],'minutes')['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x23528d[_0x1471('0x103')],'ListId':_0x23528d['ListId'],'VoiceQueueId':_0x23528d[_0x1471('0xd9')]||undefined,'CampaignId':_0x23528d[_0x1471('0x105')]||undefined})[_0x1471('0xb5')](loggerCatch(_0x1471('0x106')));break;case 0x14:if(_0x23528d['countagentrejectretry']>=_0x158723[_0x1471('0x1a8')]-0x1){return!![];}this[_0x1471('0xc3')]({'active':![],'countagentrejectretry':_0x23528d[_0x1471('0xfa')]+=0x1,'scheduledat':moment()[_0x1471('0x100')](_0x158723['dialAgentRejectRetryFrequency'],_0x1471('0x102'))[_0x1471('0x7f')](_0x1471('0x10d')),'ContactId':_0x23528d[_0x1471('0x103')],'ListId':_0x23528d[_0x1471('0x104')],'VoiceQueueId':_0x23528d[_0x1471('0xd9')]||undefined,'CampaignId':_0x23528d[_0x1471('0x105')]||undefined})['catch'](loggerCatch(_0x1471('0x1a9')));break;default:return!![];}};Dialer[_0x1471('0xb0')][_0x1471('0x19d')]=function(_0x2844cf,_0x25e172,_0x462bd6){var _0x76e178=this;var _0x3c9dd4=new History(_0x2844cf);return new BPromise(function(_0x262ac6,_0x791d9c){if(_[_0x1471('0x43')](_0x25e172)&&typeof _0x25e172!==_0x1471('0x16c')){return _0x791d9c(msgResponse(_0x1471('0x1aa'),_0x1471('0x149'),_0x1471('0x1ab')));}if(_[_0x1471('0x43')](_0x462bd6)&&typeof _0x462bd6!==_0x1471('0x16c')){return _0x791d9c(msgResponse(_0x1471('0x1aa'),_0x1471('0x149'),'evt\x20is\x20undefine'));}switch(_0x462bd6[_0x1471('0x115')]){case'0':_0x25e172['outboundNoSuchCallsDay']+=0x1;_0x3c9dd4[_0x1471('0xae')]=0x0;_0x3c9dd4[_0x1471('0xef')]=_0x1471('0x1ac');_0x3c9dd4[_0x1471('0xf6')]+=0x1;_0x3c9dd4[_0x1471('0xf1')]+=0x1;ami[_0x1471('0x54')](_0x1471('0x1ad'),ut[_0x1471('0xea')](_0x2844cf,'nosuchnumber'));_0x76e178['createHistory'](_0x3c9dd4)[_0x1471('0xb5')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x76e178[_0x1471('0x1ae')](0x0,_0x2844cf,_0x25e172)){if(_0x3c9dd4[_0x1471('0xf6')]>=_0x25e172[_0x1471('0x1a5')]){_0x76e178[_0x1471('0xff')](_0x3c9dd4,_0x262ac6,_0x791d9c,'reason\x200\x20no\x20such\x20number....');}else{_0x76e178['stateGlobal'](_0x3c9dd4,_0x262ac6,_0x791d9c,_0x1471('0x1af'));}}break;case'3':_0x25e172[_0x1471('0x1b0')]+=0x1;_0x3c9dd4[_0x1471('0xae')]=0x3;_0x3c9dd4[_0x1471('0xef')]=_0x1471('0x1b1');_0x3c9dd4[_0x1471('0xf5')]+=0x1;_0x3c9dd4['countglobal']+=0x1;ami[_0x1471('0x54')](_0x1471('0x1b2'),ut[_0x1471('0xea')](_0x2844cf,_0x1471('0x1b3')));_0x76e178[_0x1471('0xcf')](_0x3c9dd4)[_0x1471('0xb5')](loggerCatch('[syncAgentComplete][createHistory][3]'));if(_0x76e178[_0x1471('0x1ae')](0x3,_0x2844cf,_0x25e172)){if(_0x3c9dd4[_0x1471('0xf5')]>=_0x25e172[_0x1471('0x19e')]){_0x76e178[_0x1471('0xff')](_0x3c9dd4,_0x262ac6,_0x791d9c,_0x1471('0x1b4'));}else{_0x76e178['stateGlobal'](_0x3c9dd4,_0x262ac6,_0x791d9c,_0x1471('0x1b4'));}}break;case'5':_0x25e172[_0x1471('0x69')]+=0x1;_0x3c9dd4[_0x1471('0xae')]=0x5;_0x3c9dd4[_0x1471('0xef')]='Busy';_0x3c9dd4[_0x1471('0xf3')]+=0x1;_0x3c9dd4[_0x1471('0xf1')]+=0x1;ami[_0x1471('0x54')]('custom:agentbusy',ut[_0x1471('0xea')](_0x2844cf,_0x1471('0x1b5')));_0x76e178[_0x1471('0xcf')](_0x3c9dd4)[_0x1471('0xb5')](loggerCatch(_0x1471('0x1b6')));if(_0x76e178[_0x1471('0x1ae')](0x5,_0x2844cf,_0x25e172)){if(_0x3c9dd4[_0x1471('0xf3')]>=_0x25e172[_0x1471('0x1a1')]){_0x76e178[_0x1471('0xff')](_0x3c9dd4,_0x262ac6,_0x791d9c,_0x1471('0x1b7'));}else{_0x76e178[_0x1471('0xfc')](_0x3c9dd4,_0x262ac6,_0x791d9c,_0x1471('0x1b7'));}}break;case'8':_0x25e172[_0x1471('0x6a')]+=0x1;_0x3c9dd4[_0x1471('0xae')]=0x8;_0x3c9dd4['statedesc']=_0x1471('0x1b8');_0x3c9dd4[_0x1471('0xf4')]+=0x1;_0x3c9dd4[_0x1471('0xf1')]+=0x1;ami[_0x1471('0x54')](_0x1471('0x1b9'),ut[_0x1471('0xea')](_0x2844cf,_0x1471('0x1ba')));_0x76e178[_0x1471('0xcf')](_0x3c9dd4)[_0x1471('0xb5')](loggerCatch(_0x1471('0x1bb')));if(_0x76e178[_0x1471('0x1ae')](0x8,_0x2844cf,_0x25e172)){if(_0x3c9dd4['countcongestionretry']>=_0x25e172[_0x1471('0x1a3')]){_0x76e178[_0x1471('0xff')](_0x3c9dd4,_0x262ac6,_0x791d9c,_0x1471('0x1bc'));}else{_0x76e178[_0x1471('0xfc')](_0x3c9dd4,_0x262ac6,_0x791d9c,_0x1471('0x1bc'));}}break;case'11':_0x25e172[_0x1471('0x1bd')]+=0x1;_0x3c9dd4[_0x1471('0xae')]=0xb;_0x3c9dd4[_0x1471('0xef')]=_0x1471('0x1be');_0x3c9dd4['countabandonedretry']+=0x1;_0x3c9dd4['countglobal']+=0x1;_0x76e178[_0x1471('0xcf')](_0x3c9dd4)['catch'](loggerCatch(_0x1471('0x1bf')));if(_0x76e178[_0x1471('0x1ae')](0xb,_0x2844cf,_0x25e172)){if(_0x3c9dd4['countabandonedretry']>=_0x25e172[_0x1471('0x128')]){_0x76e178[_0x1471('0xff')](_0x3c9dd4,_0x262ac6,_0x791d9c,_0x1471('0x1c0'));}else{_0x76e178['stateGlobal'](_0x3c9dd4,_0x262ac6,_0x791d9c,'reason\x2011\x20abandoned');}}break;case'20':_0x25e172[_0x1471('0x6e')]+=0x1;_0x3c9dd4[_0x1471('0xae')]=0x14;_0x3c9dd4[_0x1471('0xef')]=_0x1471('0x1c1');_0x3c9dd4[_0x1471('0xfa')]+=0x1;_0x3c9dd4[_0x1471('0xf1')]+=0x1;ami[_0x1471('0x54')](_0x1471('0x1c2'),ut[_0x1471('0xea')](_0x2844cf,_0x1471('0x1c3')));_0x76e178[_0x1471('0xcf')](_0x3c9dd4)[_0x1471('0xb5')](loggerCatch('[syncAgentComplete][createHistory][20]'));if(_0x76e178[_0x1471('0x1ae')](0x14,_0x2844cf,_0x25e172)){if(_0x3c9dd4['countagentrejectretry']>=_0x25e172[_0x1471('0x1a8')]){_0x76e178[_0x1471('0xff')](_0x3c9dd4,_0x262ac6,_0x791d9c,'reason\x2020\x20agentreject');}else{_0x76e178[_0x1471('0xfc')](_0x3c9dd4,_0x262ac6,_0x791d9c,_0x1471('0x1c4'));}}break;default:_0x25e172[_0x1471('0x114')]+=0x1;_0x3c9dd4[_0x1471('0xae')]=0xc;_0x3c9dd4['statedesc']=_0x462bd6[_0x1471('0x115')];_0x76e178[_0x1471('0xcf')](_0x3c9dd4)[_0x1471('0xb5')](loggerCatch('[syncAgentComplete][createHistory][?]'));if(_0x76e178[_0x1471('0x1ae')](_0x462bd6[_0x1471('0x115')],_0x2844cf,_0x25e172)){if(_0x3c9dd4['countbusyretry']+_0x3c9dd4[_0x1471('0xf4')]+_0x3c9dd4[_0x1471('0xf5')]+_0x3c9dd4['countnosuchnumberretry']+_0x3c9dd4['countdropretry']+_0x3c9dd4[_0x1471('0xf8')]+_0x3c9dd4[_0x1471('0xf9')]+_0x3c9dd4['countagentrejectretry']>=_0x25e172[_0x1471('0xfb')]){_0x76e178[_0x1471('0xfc')](_0x3c9dd4,_0x262ac6,_0x791d9c,_0x462bd6[_0x1471('0x115')]);}else{_0x76e178[_0x1471('0xff')](_0x3c9dd4,_0x262ac6,_0x791d9c,_0x462bd6[_0x1471('0x115')]);}}}});};Dialer['prototype'][_0x1471('0xfc')]=function(_0x4b19c0,_0x18a20e,_0x2cc320,_0x31a515){var _0x140864=new Final(_0x4b19c0);_0x140864[_0x1471('0xae')]=0xf;_0x140864['statedesc']=_0x1471('0x1c5');this[_0x1471('0xff')](_0x140864,_0x18a20e,_0x2cc320,_0x31a515);};Dialer['prototype'][_0x1471('0xff')]=function(_0x11d705,_0x8fe640,_0x4bcda0,_0x4af2f3){this['moveContactManagedDialer'](_0x11d705)['then'](function(){return _0x8fe640(msgResponse(_0x1471('0x1aa'),_0x1471('0xdc'),_0x4af2f3));})[_0x1471('0xb5')](function(){return _0x4bcda0(msgResponse(_0x1471('0x1c6'),'Failure',_0x1471('0x1c7')));});};Dialer['prototype']['predictive']=function(_0x56d0c8){var _0x2e3211=_0x56d0c8[_0x1471('0x1c8')]/0x64;var _0x5a73d4=_0x56d0c8[_0x1471('0x6d')]/(_0x56d0c8[_0x1471('0x6d')]+_0x56d0c8[_0x1471('0x67')]);var _0x548434=Math[_0x1471('0x1c9')](_0x56d0c8[_0x1471('0x77')]*(_0x56d0c8[_0x1471('0x1ca')]/0x64));var _0x22cb42=Math[_0x1471('0x1c9')](_0x56d0c8[_0x1471('0x77')]*(_0x56d0c8[_0x1471('0x1cb')]/0x64));var _0x20bea6=_0x56d0c8[_0x1471('0x59')]+_0x56d0c8[_0x1471('0x5e')];var _0xafe72a=Math[_0x1471('0x1cc')](_0x56d0c8[_0x1471('0x90')]*_0x56d0c8[_0x1471('0x7a')]*_0x56d0c8[_0x1471('0x74')]*_0x56d0c8[_0x1471('0x75')]);if(_[_0x1471('0x43')](_0x56d0c8['startProgressive'])){if(!_['isUndefined'](_0x56d0c8['startPredictive'])){_0x56d0c8[_0x1471('0x2d')]=undefined;loggerPredictive[_0x1471('0x9c')]('[startMethodPredictive][StartProgressive]',_0x1471('0x1cd'));}if(!_['isUndefined'](_0x56d0c8[_0x1471('0x97')])){loggerPredictive['error']('[startMethodPredictive][StartProgressive]',_0x1471('0x1ce'));clearInterval(_0x56d0c8[_0x1471('0x97')]);_0x56d0c8[_0x1471('0x97')]=undefined;}_0x56d0c8[_0x1471('0x2e')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x1471('0x85')](_0x56d0c8[_0x1471('0x4c')],_0x1471('0x1cf'),_0x56d0c8[_0x1471('0x2e')]);this[_0x1471('0x15e')](_0x56d0c8,0x1);}else if(ifInterval(_0x56d0c8['dialPredictiveInterval'],_0x56d0c8[_0x1471('0x2e')])){this[_0x1471('0x15e')](_0x56d0c8,0x1);loggerPredictiveCalls[_0x1471('0x85')](_0x1471('0x1d0'),_0x56d0c8[_0x1471('0x2e')],_0x56d0c8[_0x1471('0x4c')]);_0x56d0c8[_0x1471('0x90')]=0x0;_0x56d0c8[_0x1471('0x73')]=0x0;}else if(_0x2e3211<_0x5a73d4&&_0x56d0c8[_0x1471('0x1d1')]===_0x1471('0x1d2')){freeVariablesPredictive(_0x56d0c8);loggerPredictive[_0x1471('0x85')](_0x1471('0x1d3'),'Dropped\x20calls\x20day',_0x5a73d4,_0x1471('0x2e'),_0x56d0c8['name']);}else if(_0xafe72a<_0x56d0c8[_0x1471('0x73')]&&_0x56d0c8[_0x1471('0x1d1')]==='dropRate'){freeVariablesPredictive(_0x56d0c8);loggerPredictive[_0x1471('0x85')]('[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20',_0xafe72a,_0x1471('0x1d4'),_0x56d0c8[_0x1471('0x73')],'startProgressive',_0x56d0c8[_0x1471('0x4c')]);}else if(!ifInterval(_0x56d0c8[_0x1471('0x1d5')],_0x56d0c8[_0x1471('0x2e')])&&_[_0x1471('0x43')](_0x56d0c8[_0x1471('0x2d')])&&!_[_0x1471('0x43')](_0x56d0c8['startProgressive'])){_0x56d0c8[_0x1471('0x2d')]=moment()[_0x1471('0x7f')](_0x1471('0x10d'));loggerPredictive[_0x1471('0x85')](_0x56d0c8['name'],'started\x20in\x20predictive\x20at',_0x56d0c8[_0x1471('0x2d')]);this[_0x1471('0xc0')](_0x56d0c8[_0x1471('0x1d5')])[_0x1471('0xbc')](this[_0x1471('0x1d6')](_0x56d0c8))[_0x1471('0xbc')](mergeDataErlangB(_0x56d0c8))[_0x1471('0xbc')](this[_0x1471('0x1d7')](_0x56d0c8))[_0x1471('0xb5')](loggerCatchPredictive(_0x1471('0x1d8'),_0x56d0c8));}else if(!ifInterval(_0x56d0c8[_0x1471('0x1d5')],_0x56d0c8[_0x1471('0x2d')])){_0x56d0c8[_0x1471('0x73')]=0x0;_0x56d0c8[_0x1471('0x2d')]=moment()[_0x1471('0x7f')](_0x1471('0x10d'));loggerPredictive[_0x1471('0x85')](_0x56d0c8['name'],'recalculate\x20predictive\x20at',_0x56d0c8[_0x1471('0x2d')]);clearInterval(_0x56d0c8[_0x1471('0x97')]);_0x56d0c8[_0x1471('0x97')]=undefined;this['averageHandleTime'](_0x56d0c8[_0x1471('0x1d5')])[_0x1471('0xbc')](this[_0x1471('0x1d6')](_0x56d0c8))[_0x1471('0xbc')](mergeDataErlangB(_0x56d0c8))[_0x1471('0xbc')](this[_0x1471('0x1d7')](_0x56d0c8))[_0x1471('0xb5')](loggerCatchPredictive('Predictive\x20for\x20every\x20interval',_0x56d0c8));}else if(_0x56d0c8[_0x1471('0x77')]&&_0x20bea6<_0x56d0c8[_0x1471('0x77')]-_0x22cb42){freeVariablesPredictive(_0x56d0c8);loggerPredictive['info'](_0x56d0c8[_0x1471('0x4c')],_0x1471('0x1d9'),_0x20bea6,_0x1471('0x1da'),_0x56d0c8[_0x1471('0x77')],'-',_0x22cb42,'=',_0x56d0c8[_0x1471('0x77')]-_0x22cb42,')');}else if(_0x56d0c8[_0x1471('0x77')]&&_0x20bea6>_0x56d0c8[_0x1471('0x77')]+_0x548434){freeVariablesPredictive(_0x56d0c8);loggerPredictive[_0x1471('0x85')](_0x56d0c8[_0x1471('0x4c')],_0x1471('0x1d9'),_0x20bea6,_0x1471('0x1db'),_0x56d0c8[_0x1471('0x77')],'+',_0x548434,'=',_0x56d0c8['predictiveIntervalAvailable']+_0x548434,')');}};Dialer[_0x1471('0xb0')]['getDataPredictive']=function(_0x22406c){var _0x1d7199=this;return function(_0x3b5448){return new BPromise(function(_0x280b8a,_0x618e34){_[_0x1471('0x94')](_0x22406c,_0x3b5448[0x0]);if(checkGetDataPredictive(_0x3b5448[0x0])){var _0xa256e=_0x22406c[_0x1471('0x77')]=_0x22406c['talking']+_0x22406c['available'];var _0x249906=_0x22406c[_0x1471('0x1d5')]*0x3c;var _0x152774=_0x3b5448[0x0][_0x1471('0x70')]+_0x3b5448[0x0][_0x1471('0x8b')];var _0x2fb242=(_0x3b5448[0x0][_0x1471('0x6f')]+_0x3b5448[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x3b5448[0x0][_0x1471('0x71')])/_0x3b5448[0x0][_0x1471('0x78')];_0x22406c[_0x1471('0x74')]=_0x2fb242>0x0?_0x2fb242:0x1;switch(_0x22406c[_0x1471('0x1d1')]){case _0x1471('0x1d2'):var _0x2a3276=_0x22406c['dialPredictiveOptimizationPercentage']/0x64;return _0x1d7199[_0x1471('0x1dc')](_0xa256e,_0x249906,_0x152774,_0x2fb242,_0x2a3276)[_0x1471('0xbc')](function(_0x3281e0){return _0x280b8a(_0x3281e0);});case _0x1471('0x1dd'):var _0x4b4eaf=_0x22406c[_0x1471('0x1c8')]/0x64;return _0x1d7199['busyFactor'](_0xa256e,_0x249906,_0x152774,_0x2fb242,_0x4b4eaf)[_0x1471('0xbc')](function(_0x28348e){return _0x280b8a(_0x28348e);});default:return _0x618e34(msgResponse(_0x1471('0x1de'),_0x1471('0x149'),_0x1471('0x1df')));}}else{return _0x618e34(msgResponse('[getDataPredictive]','Failure',_0x1471('0x1e0')));}});};};Dialer[_0x1471('0xb0')]['getDataPredictiveOld']=function(_0x32d944){var _0x25bdaf=this;return function(_0x1bfed1){return new BPromise(function(_0x3ef411,_0x1d51fa){_['merge'](_0x32d944,_0x1bfed1[0x0]);if(checkGetDataPredictive(_0x1bfed1[0x0])){loggerPredictive[_0x1471('0x85')](JSON['stringify'](_0x1bfed1[0x0]));if(_0x32d944[_0x1471('0x1d1')]===_0x1471('0x1d2')){return _0x25bdaf['getVoiceQueueRtPauses'](_0x32d944['id'])[_0x1471('0xbc')](function(_0x55a6cf){var _0x3f59ca=_0x32d944['loggedIn']-_0x55a6cf[0x0][_0x1471('0x1e1')];var _0x5a86e1=_0x32d944[_0x1471('0x1d5')]*0x3c;var _0x347968=_0x1bfed1[0x0][_0x1471('0x70')]+_0x1bfed1[0x0]['predictiveIntervalAvgHoldtime'];var _0x30930b=(_0x1bfed1[0x0][_0x1471('0x6f')]+_0x1bfed1[0x0][_0x1471('0x89')]+_0x1bfed1[0x0][_0x1471('0x71')])/_0x1bfed1[0x0][_0x1471('0x78')];var _0xc61416=_0x32d944[_0x1471('0x1c8')]/0x64;_0x32d944[_0x1471('0x76')]=_0x55a6cf[0x0][_0x1471('0x1e1')]||0x0;_0x32d944[_0x1471('0x74')]=_0x30930b>0x0?_0x30930b:0x1;return _0x25bdaf['abandonmentRate'](_0x3f59ca,_0x5a86e1,_0x347968,_0x30930b,_0xc61416);})[_0x1471('0xbc')](function(_0x2b94a6){return _0x3ef411(_0x2b94a6);})[_0x1471('0xb5')](function(_0x455f5c){return _0x1d51fa(msgResponse(_0x1471('0x1e2'),_0x1471('0x149'),JSON[_0x1471('0x50')](_0x455f5c)));});}if(_0x32d944[_0x1471('0x1d1')]===_0x1471('0x1dd')){return _0x25bdaf[_0x1471('0xcc')](_0x32d944['id'])[_0x1471('0xbc')](function(_0x46de84){var _0x5793b8=_0x32d944[_0x1471('0x5a')]-_0x46de84[0x0][_0x1471('0x1e1')];var _0xd3e31=_0x32d944['dialPredictiveInterval']*0x3c;var _0x5b37a9=_0x1bfed1[0x0][_0x1471('0x70')]+_0x1bfed1[0x0][_0x1471('0x8b')];var _0x2b13e1=(_0x1bfed1[0x0][_0x1471('0x6f')]+_0x1bfed1[0x0][_0x1471('0x89')]+_0x1bfed1[0x0][_0x1471('0x71')])/_0x1bfed1[0x0]['predictiveIntervalTotalCalls'];var _0x5a02c6=_0x32d944[_0x1471('0x1c8')]/0x64;_0x32d944['predictiveIntervalPauses']=_0x46de84[0x0][_0x1471('0x1e1')]||0x0;_0x32d944['predictiveIntervalHitRate']=_0x2b13e1>0x0?_0x2b13e1:0x1;return _0x25bdaf[_0x1471('0x1e3')](_0x5793b8,_0xd3e31,_0x5b37a9,_0x2b13e1,_0x5a02c6);})['then'](function(_0x5c1044){return _0x3ef411(_0x5c1044);})[_0x1471('0xb5')](function(_0x90ff68){return _0x1d51fa(msgResponse('[CatchErlangB]',_0x1471('0x149'),JSON[_0x1471('0x50')](_0x90ff68)));});}}else{return _0x1d51fa(msgResponse(_0x1471('0x1de'),_0x1471('0x149'),_0x1471('0x1e0')));}});};};Dialer[_0x1471('0xb0')][_0x1471('0x1d7')]=function(_0x3f1564){var _0x4d4ec9=this;return function(){var _0x91a707=0x0;var _0x2c9c92=Math[_0x1471('0x1cc')](_0x3f1564[_0x1471('0x79')]*0x3e8);if(_0x2c9c92>0x0){_0x2c9c92=_0x2c9c92<0x64?0x64:_0x2c9c92;loggerPredictive['info'](_0x3f1564[_0x1471('0x4c')],_0x1471('0x1e4'),_0x2c9c92,_0x1471('0x51'));_0x3f1564[_0x1471('0x97')]=setInterval(function(){_0x4d4ec9['handlePredictive'](_0x3f1564);loggerPredictiveCalls[_0x1471('0x85')](_0x1471('0x1e5'),_0x91a707+=0x1);},_0x2c9c92);}else{loggerPredictive['info'](_0x3f1564[_0x1471('0x4c')],'fail\x20to\x20scheduled\x20calls');}};};Dialer[_0x1471('0xb0')]['checkContactBlack']=function(_0x4fdb77,_0x3abb74){var _0x3c1ff7=this;return function(_0x35fc12){if(_['isEmpty'](_0x35fc12)){if(_[_0x1471('0xe1')](_0x3abb74[_0x1471('0xd8')])||!_0x3abb74['recallme']){if(_0x4fdb77[_0x1471('0x63')]==='booked'){_0x4fdb77[_0x1471('0x131')]=_['isUndefined'](_0x4fdb77[_0x1471('0x131')])?!![]:_0x4fdb77[_0x1471('0x131')];var _0x8a2649=uuid['v4']();_0x3c1ff7['actions'][_0x8a2649]=new Action(_0x4fdb77,_0x3abb74,_0x8a2649);loggerBooked[_0x1471('0x85')](_0x1471('0x1e6'),_0x8a2649,_0x1471('0x1e7'),JSON[_0x1471('0x50')](_0x4fdb77['queueStatusComplete']),'Queue:\x20',_0x4fdb77['name']);if(_0x4fdb77[_0x1471('0x131')]){_0x4fdb77[_0x1471('0x131')]=![];_0x3c1ff7['queueBooked'][_0x3c1ff7['actions'][_0x8a2649]['queue']]=[];ami[_0x1471('0x14c')]({'actionid':_0x8a2649,'action':_0x1471('0x1e8'),'queue':_0x4fdb77[_0x1471('0x4c')]})[_0x1471('0xb5')](function(){_0x3c1ff7[_0x1471('0xb8')](_0x4fdb77);_0x3c1ff7[_0x1471('0xc3')]({'active':![],'ContactId':_0x3c1ff7[_0x1471('0x29')][_0x8a2649]['ContactId'],'ListId':_0x3c1ff7[_0x1471('0x29')][_0x8a2649]['ListId'],'VoiceQueueId':_0x3c1ff7[_0x1471('0x29')][_0x8a2649][_0x1471('0xd9')]||undefined,'CampaignId':_0x3c1ff7['actions'][_0x8a2649][_0x1471('0x105')]||undefined})[_0x1471('0xb5')](loggerCatch(_0x1471('0x1e9')));delete _0x3c1ff7[_0x1471('0x29')][_0x8a2649];});}else{loggerBooked[_0x1471('0x85')](_0x1471('0x1ea'),JSON[_0x1471('0x50')](_0x4fdb77[_0x1471('0x131')]),_0x1471('0x1eb'),_0x4fdb77[_0x1471('0x4c')]);_0x3c1ff7[_0x1471('0xb8')](_0x4fdb77);_0x3c1ff7[_0x1471('0xc3')]({'active':![],'ContactId':_0x3c1ff7[_0x1471('0x29')][_0x8a2649]['ContactId'],'ListId':_0x3c1ff7[_0x1471('0x29')][_0x8a2649][_0x1471('0x104')],'VoiceQueueId':_0x3c1ff7[_0x1471('0x29')][_0x8a2649][_0x1471('0xd9')]||undefined,'CampaignId':_0x3c1ff7[_0x1471('0x29')][_0x8a2649]['CampaignId']||undefined})['catch'](loggerCatch(_0x1471('0x1e9')));delete _0x3c1ff7[_0x1471('0x29')][_0x8a2649];}}else{return _0x3c1ff7[_0x1471('0x16b')](_0x4fdb77,_0x3abb74);}}else{if(getDiff(_0x3abb74[_0x1471('0x1ec')])<_0x4fdb77[_0x1471('0x1ed')]*0x3c){if(_0x3abb74[_0x1471('0x1ee')]&&!_0x3abb74[_0x1471('0x1ee')][_0x1471('0x1ef')]){_0x3c1ff7[_0x1471('0x23')]['run'](_0x3abb74['id'])[_0x1471('0x21')](function(){_0x3c1ff7[_0x1471('0xb8')](_0x4fdb77);});}else{_0x3c1ff7['unlockContact']({'active':![]},_0x3abb74['id'],0x1)[_0x1471('0x21')](function(){_0x3c1ff7['updateOriginated'](_0x4fdb77);});}}else{_0x4fdb77[_0x1471('0x1f0')]+=0x1;_0x3c1ff7['updateOriginated'](_0x4fdb77);if(_0x4fdb77[_0x1471('0x1f1')]){_0x3c1ff7[_0x1471('0xc3')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x3abb74[_0x1471('0x103')],'ListId':_0x3abb74[_0x1471('0x104')],'VoiceQueueId':_0x3abb74[_0x1471('0xd9')]||undefined,'CampaignId':_0x3abb74[_0x1471('0x105')]||undefined})[_0x1471('0xb5')](loggerCatch(_0x1471('0x1f2')));_0x3c1ff7[_0x1471('0xcf')](createObjHistory(_0x4fdb77,_0x3abb74,_0x1471('0x1f3'),0x17,_0x1471('0x1f4')))[_0x1471('0xb5')](loggerCatch('[Originate][HistoryDialRecallInQueue][historyCatch]'));}else{_0x3c1ff7[_0x1471('0xd6')](createObjHistory(_0x4fdb77,_0x3abb74,'RECALLFAILEDTIMEOUT',0x16,_0x1471('0x1f5')),_0x1471('0x1f6'),'[Originate][HistoryRecallClose]');}}}}else{_0x4fdb77['outboundBlacklistCallsDay']+=0x1;_0x3c1ff7[_0x1471('0xd6')](createObjHistory(_0x4fdb77,_0x3abb74,_0x1471('0x1f7'),0xd,_0x1471('0x1f8')),'[Originate][historyBlacklist]','[Originate][MoveBlacklist]');throw _0x1471('0x1f9');}};};Dialer[_0x1471('0xb0')]['handleIvr']=function(_0x58cdb5){var _0x4d40a1=this;var _0x22487f=_0x58cdb5['limitCalls']-_0x58cdb5[_0x1471('0x9f')]-_0x58cdb5[_0x1471('0xc8')];emitCampaignSummary(_0x58cdb5);if(_0x22487f>0x0){if(_0x22487f>this[_0x1471('0x28')]){_0x22487f=this[_0x1471('0x28')];}_0x58cdb5[_0x1471('0xc8')]+=_0x22487f;this[_0x1471('0xca')](_0x58cdb5['id'],_0x22487f,_0x58cdb5[_0x1471('0x1fa')],_0x58cdb5)['then'](function(_0x4e7e0c){_0x58cdb5[_0x1471('0xc8')]-=_0x22487f;_0x58cdb5[_0x1471('0xc8')]=_0x58cdb5[_0x1471('0xc8')]>0x0?_0x58cdb5['temp']:0x0;if(!checkContactEmpty(_0x4e7e0c)){_0x58cdb5[_0x1471('0x44')]='AVAILABLE_CONTACTS_FINISHED';logger[_0x1471('0x85')](_0x1471('0x1fb')+_0x58cdb5[_0x1471('0x4c')]);}else{_0x58cdb5[_0x1471('0x9f')]+=_0x4e7e0c[_0x1471('0x9e')];_0x58cdb5[_0x1471('0x44')]='RUNNING';for(var _0x4db23c=0x0;_0x4db23c<_0x4e7e0c[_0x1471('0x9e')];_0x4db23c+=0x1){_0x58cdb5['ivrTotalCallsDays']+=0x1;if(_[_0x1471('0xe1')](_0x4e7e0c[_0x4db23c])||_[_0x1471('0xe1')](_0x4e7e0c[_0x4db23c][_0x1471('0x16f')])||_[_0x1471('0xe1')](_0x4e7e0c[_0x4db23c][_0x1471('0x16f')]['phone'])){_0x4d40a1['emptyContact'](_0x1471('0x1fc'),_0x58cdb5,_0x4e7e0c[_0x4db23c]);}else{_0x4d40a1[_0x1471('0xbf')](_['pick'](_0x4e7e0c[_0x4db23c],[_0x1471('0x105'),_0x1471('0x1fd')]))[_0x1471('0xbc')](_0x4d40a1[_0x1471('0x1fe')](_0x58cdb5,_0x4e7e0c[_0x4db23c]))[_0x1471('0xb5')](_0x4d40a1[_0x1471('0xd3')]('[actionOriginateIvr]\x20',_0x58cdb5));}}}})[_0x1471('0xb5')](loggerGetContactDialer(_0x1471('0x1ff'),_0x58cdb5,_0x22487f));}};Dialer[_0x1471('0xb0')][_0x1471('0x15e')]=function(_0x24c628,_0x3f4542){var _0x4e8589=this;var _0x535998=[];var _0x2dce4d=_0x3f4542>=0x1?_0x3f4542:0x1;if(_0x24c628[_0x1471('0x63')]===_0x1471('0xa')){_0x2dce4d=0x1;}var _0x203dfd=Math['floor'](_0x24c628['available']*_0x2dce4d)-_0x24c628[_0x1471('0x9f')]-_0x24c628[_0x1471('0xc8')];emitVoiceQueueSummary(_0x24c628);if(_0x24c628['dialLimitQueue']>0x0){var _0x29833f=_0x24c628[_0x1471('0x200')]-_0x24c628[_0x1471('0x9f')]-_0x24c628['talking']-_0x24c628[_0x1471('0xc8')]-_0x24c628['pTalking'];if(_0x203dfd>_0x29833f){_0x203dfd=_0x29833f;}}if(_0x203dfd>0x0){if(_0x24c628[_0x1471('0x63')]==='booked'){_0x203dfd=0x1;}if(_0x203dfd>this[_0x1471('0x28')]){_0x203dfd=this[_0x1471('0x28')];}_0x24c628[_0x1471('0xc8')]+=_0x203dfd;for(var _0x851c18 in this['agents']){if(typeof this[_0x1471('0x26')][_0x851c18]!==_0x1471('0xa0')){if(this[_0x1471('0x26')][_0x851c18]['state']===_0x1471('0x201')&&this[_0x1471('0x26')][_0x851c18]['status']===_0x1471('0x202')){_0x535998[_0x1471('0x12f')](this[_0x1471('0x26')][_0x851c18]['id']);}}}this['getContactDialer'](_0x24c628['id'],_0x535998,_0x203dfd,_0x24c628[_0x1471('0x1fa')],_0x24c628)[_0x1471('0xbc')](function(_0x12c2ac){_0x24c628[_0x1471('0xc8')]-=_0x203dfd;_0x24c628['temp']=_0x24c628['temp']>0x0?_0x24c628[_0x1471('0xc8')]:0x0;if(!checkContactEmpty(_0x12c2ac)){_0x4e8589[_0x1471('0xba')](_0x24c628)[_0x1471('0xbc')](sendMessageReschedule(_0x24c628))['catch'](loggerCatch(_0x1471('0xbd')));}else{_0x24c628[_0x1471('0x9f')]+=_0x12c2ac[_0x1471('0x9e')];_0x24c628[_0x1471('0x44')]=_0x24c628[_0x1471('0x63')]===_0x1471('0xa')?_0x1471('0x203'):_0x1471('0x204');for(var _0x1b2706=0x0;_0x1b2706<_0x12c2ac[_0x1471('0x9e')];_0x1b2706+=0x1){if(_[_0x1471('0xe1')](_0x12c2ac[_0x1b2706])||_[_0x1471('0xe1')](_0x12c2ac[_0x1b2706][_0x1471('0x16f')])||_[_0x1471('0xe1')](_0x12c2ac[_0x1b2706][_0x1471('0x16f')][_0x1471('0x16e')])){_0x4e8589[_0x1471('0xd4')]('[actionOriginate]\x20',_0x24c628,_0x12c2ac[_0x1b2706]);}else{_0x4e8589[_0x1471('0xbe')](_['pick'](_0x12c2ac[_0x1b2706],[_0x1471('0xd9'),_0x1471('0x1fd')]))[_0x1471('0xbc')](_0x4e8589['checkContactBlack'](_0x24c628,_0x12c2ac[_0x1b2706]))[_0x1471('0xb5')](_0x4e8589['loggerHandler'](_0x1471('0x1fc'),_0x24c628));}}}})[_0x1471('0xb5')](loggerGetContactDialer(_0x1471('0x205'),_0x24c628,_0x203dfd));}};Dialer[_0x1471('0xb0')]['handlePredictive']=function(_0x46bd5e){if(_0x46bd5e[_0x1471('0x200')]>0x0){var _0x4bd13e=_0x46bd5e[_0x1471('0x200')]-_0x46bd5e[_0x1471('0x9f')]-_0x46bd5e['talking'];if(_0x4bd13e>0x0){this[_0x1471('0x206')](_0x46bd5e);}else{loggerPredictiveCalls[_0x1471('0x85')](_0x1471('0x207'));}}else{this[_0x1471('0x206')](_0x46bd5e);}};Dialer[_0x1471('0xb0')][_0x1471('0x206')]=function(_0x52a18d){var _0xd3c7cb=this;var _0x536f86=[];_0x52a18d[_0x1471('0x9f')]+=0x1;for(var _0x21172f in this[_0x1471('0x26')]){if(typeof this[_0x1471('0x26')][_0x21172f]!=='undefined'){if(this[_0x1471('0x26')][_0x21172f]['state']===_0x1471('0x201')&&this['agents'][_0x21172f][_0x1471('0xde')]===_0x1471('0x202')){_0x536f86[_0x1471('0x12f')](this[_0x1471('0x26')][_0x21172f]['id']);}}}this[_0x1471('0xc7')](_0x52a18d['id'],_0x536f86,0x1,_0x52a18d[_0x1471('0x1fa')],_0x52a18d)[_0x1471('0xbc')](function(_0x4b86c4){if(!checkContactEmpty(_0x4b86c4)){checkContactLowerLimitOriginate(_0x52a18d,0x1,0x0);_0xd3c7cb[_0x1471('0xba')](_0x52a18d)[_0x1471('0xbc')](sendMessageReschedule(_0x52a18d))[_0x1471('0xb5')](loggerCatch(_0x1471('0xbd')));}else{_0x52a18d[_0x1471('0x44')]=_0x1471('0x204');if(_[_0x1471('0xe1')](_0x4b86c4[0x0])||_[_0x1471('0xe1')](_0x4b86c4[0x0][_0x1471('0x16f')])||_['isNil'](_0x4b86c4[0x0][_0x1471('0x16f')][_0x1471('0x16e')])){_0xd3c7cb[_0x1471('0xd4')]('[actionOriginate]\x20',_0x52a18d,_0x4b86c4[0x0]);}else{_0xd3c7cb['checkIsBlackList'](_['pick'](_0x4b86c4[0x0],[_0x1471('0xd9'),_0x1471('0x1fd')]))[_0x1471('0xbc')](_0xd3c7cb[_0x1471('0x1fe')](_0x52a18d,_0x4b86c4[0x0]))[_0x1471('0xb5')](_0xd3c7cb['loggerHandler']('[actionOriginatePredictive]\x20',_0x52a18d));}}})['catch'](loggerGetContactDialer(_0x1471('0x208'),_0x52a18d,0x1));emitVoiceQueueSummary(_0x52a18d);};Dialer['prototype'][_0x1471('0x1dc')]=function(_0x2a893e,_0x52e585,_0x2118fb,_0x232ea0,_0x5261ab,_0x1c3375){loggerPredictive[_0x1471('0x85')](_0x1471('0x209'));loggerPredictive[_0x1471('0x85')](_0x1471('0x20a'),_0x2a893e);loggerPredictive[_0x1471('0x85')](_0x1471('0x20b'),_0x52e585);loggerPredictive[_0x1471('0x85')]('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',_0x2118fb);loggerPredictive[_0x1471('0x85')]('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',_0x232ea0);loggerPredictive[_0x1471('0x85')](_0x1471('0x20c'),_0x5261ab);loggerPredictive[_0x1471('0x85')](_0x1471('0x93'));return new BPromise(function(_0x8ed3ee,_0x223ded){if(_0x2a893e<=0x0||isNaN(_0x2a893e)){return _0x223ded(msgResponse(_0x1471('0x20d'),_0x1471('0x199'),_0x1471('0x20e')+_0x2a893e));}if(_0x2118fb<=0x0||isNaN(_0x2118fb)){return _0x223ded(msgResponse(_0x1471('0x20d'),'Error',_0x1471('0x20f')+_0x2118fb));}if(_0x232ea0<=0x0||isNaN(_0x232ea0)){return _0x223ded(msgResponse(_0x1471('0x20d'),'Error',_0x1471('0x210')+_0x232ea0));}if(_0x52e585<=0x0||isNaN(_0x52e585)){return _0x223ded(msgResponse(_0x1471('0x20d'),_0x1471('0x199'),'interval\x20=\x20'+_0x52e585));}if(_0x5261ab<=0x0||isNaN(_0x5261ab)){return _0x223ded(msgResponse(_0x1471('0x20d'),'Error',_0x1471('0x211')+_0x5261ab));}_0x1c3375=_0x1c3375||0x0;var _0x450139=0x1/_0x2118fb;var _0xa8cc5b=0x0;var _0xe24ceb=0x0;var _0x4dc697=0x0;var _0x572075=0x0;for(var _0xdaa56b=0x0;_0x4dc697<_0x5261ab;_0xdaa56b+=0x1){_0xe24ceb=_0xdaa56b/_0x52e585;_0xa8cc5b=(_0x232ea0*_0xe24ceb+_0x1c3375)/_0x450139;_0x4dc697=erlangb(_0xa8cc5b,_0x2a893e);_0x572075=_0xa8cc5b/_0x2a893e*(0x1-erlangb(_0xa8cc5b,_0x2a893e));}return _0x8ed3ee({'erlangCalls':_0xdaa56b,'erlangCallToSecond':_0x52e585/_0xdaa56b,'erlangAbandonmentRate':_0x4dc697,'erlangBusyFactor':_0x572075});});};Dialer[_0x1471('0xb0')]['busyFactor']=function(_0x45f698,_0x40542e,_0x4c7bee,_0x8edceb,_0x1bca20,_0x369bea){loggerPredictive[_0x1471('0x85')](_0x1471('0x212'));loggerPredictive[_0x1471('0x85')](_0x1471('0x20a'),_0x45f698);loggerPredictive[_0x1471('0x85')](_0x1471('0x20b'),_0x40542e);loggerPredictive[_0x1471('0x85')](_0x1471('0x213'),_0x4c7bee);loggerPredictive[_0x1471('0x85')](_0x1471('0x214'),_0x8edceb);loggerPredictive['info']('Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1bca20);loggerPredictive['info'](_0x1471('0x93'));return new BPromise(function(_0x3335ee,_0x167f50){if(_0x45f698<=0x0||isNaN(_0x45f698)){return _0x167f50(msgResponse(_0x1471('0x215'),_0x1471('0x199'),'m\x20=\x20'+_0x45f698));}if(_0x4c7bee<=0x0||isNaN(_0x4c7bee)){return _0x167f50(msgResponse(_0x1471('0x215'),_0x1471('0x199'),'Ts\x20=\x20'+_0x4c7bee));}if(_0x8edceb<=0x0||isNaN(_0x8edceb)){return _0x167f50(msgResponse(_0x1471('0x215'),_0x1471('0x199'),'p\x20=\x20'+_0x8edceb));}if(_0x40542e<=0x0||isNaN(_0x40542e)){return _0x167f50(msgResponse('[busyFactor]',_0x1471('0x199'),_0x1471('0x216')+_0x40542e));}if(_0x1bca20<=0x0||isNaN(_0x1bca20)){return _0x167f50(msgResponse(_0x1471('0x215'),_0x1471('0x199'),_0x1471('0x217')+_0x1bca20));}_0x369bea=_0x369bea||0x0;var _0x400307=0x1/_0x4c7bee;var _0x4e4792=0x0;var _0x123386=0x0;var _0x4deadd=0x0;var _0xdef282=0x0;for(var _0x2936d9=0x0;_0xdef282<_0x1bca20;_0x2936d9+=0x1){_0x123386=_0x2936d9/_0x40542e;_0x4e4792=(_0x8edceb*_0x123386+_0x369bea)/_0x400307;_0x4deadd=erlangb(_0x4e4792,_0x45f698);_0xdef282=_0x4e4792/_0x45f698*(0x1-erlangb(_0x4e4792,_0x45f698));}return _0x3335ee({'erlangCalls':_0x2936d9,'erlangCallToSecond':_0x40542e/_0x2936d9,'erlangAbandonmentRate':_0x4deadd,'erlangBusyFactor':_0xdef282});});};module['exports']=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/queueCallerAbandon.js b/server/services/ami/dialer/queueCallerAbandon.js index 04a0228..3a49e8d 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 _0x1d55=['countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','uniqueid','name','calleridnum','number','starttime','responsetime','droptime','endtime','ringtime','holdtime','talktime','membername','connectedlinename','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','milliseconds','seconds','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x1d55,0xf6));var _0x51d5=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0x1d55[_0x13e741];return _0x3f8bb3;};'use strict';var util=require(_0x51d5('0x0'));var _=require(_0x51d5('0x1'));var moment=require('moment');function getSeconds(_0x569817,_0x30ba89){var _0x1fe509=moment(_0x569817)[_0x51d5('0x2')](0x0);var _0x1e7e57=moment(_0x30ba89)[_0x51d5('0x2')](0x0);return _0x1fe509['diff'](_0x1e7e57,_0x51d5('0x3'));}function QueueCallerAbandon(_0x2660ca,_0x47cc94){this[_0x51d5('0x4')]=_0x2660ca[_0x51d5('0x4')];this[_0x51d5('0x5')]=_0x2660ca[_0x51d5('0x5')];this[_0x51d5('0x6')]=_0x2660ca[_0x51d5('0x5')]===_0x51d5('0x7')?_0x51d5('0x8'):_0x2660ca[_0x51d5('0x5')];this[_0x51d5('0x9')]=_0x2660ca[_0x51d5('0x9')];this[_0x51d5('0xa')]=_0x2660ca[_0x51d5('0xa')];this[_0x51d5('0xb')]=_0x2660ca['countnoanswerretry'];this[_0x51d5('0xc')]=_0x2660ca[_0x51d5('0x9')]+_0x2660ca[_0x51d5('0xa')]+_0x2660ca['countnoanswerretry']+_0x2660ca[_0x51d5('0xd')]+_0x2660ca['countdropretry']+_0x2660ca[_0x51d5('0xe')]+_0x2660ca[_0x51d5('0xf')]+_0x2660ca[_0x51d5('0x10')];this[_0x51d5('0xd')]=_0x2660ca[_0x51d5('0xd')];this['countdropretry']=_0x2660ca[_0x51d5('0x11')];this[_0x51d5('0xe')]=_0x2660ca[_0x51d5('0xe')];this[_0x51d5('0xf')]=_0x2660ca['countmachineretry'];this[_0x51d5('0x10')]=_0x2660ca[_0x51d5('0x10')];this[_0x51d5('0x12')]=_0x47cc94['uniqueid'];this['calleridname']=_0x2660ca[_0x51d5('0x13')];this[_0x51d5('0x14')]=_0x2660ca[_0x51d5('0x15')];this['starttime']=_0x2660ca[_0x51d5('0x16')];this[_0x51d5('0x17')]=_0x2660ca[_0x51d5('0x17')];this[_0x51d5('0x18')]=_0x2660ca[_0x51d5('0x18')];this[_0x51d5('0x19')]=this[_0x51d5('0x18')];this[_0x51d5('0x1a')]=getSeconds(_0x2660ca[_0x51d5('0x17')],_0x2660ca[_0x51d5('0x16')]);this[_0x51d5('0x1b')]=getSeconds(this[_0x51d5('0x18')],_0x2660ca[_0x51d5('0x17')]);this[_0x51d5('0x1c')]=0x0;this[_0x51d5('0x8')]=_0x47cc94[_0x51d5('0x8')];this[_0x51d5('0x1d')]=_0x47cc94[_0x51d5('0x1e')];this['reason']=_0x47cc94['reason'];this[_0x51d5('0x1f')]=_0x2660ca[_0x51d5('0x1f')];this[_0x51d5('0x20')]=_0x2660ca['callbackuniqueid'];this[_0x51d5('0x21')]=_0x2660ca[_0x51d5('0x21')];this['recallme']=_0x2660ca[_0x51d5('0x22')];this[_0x51d5('0x23')]=_0x2660ca[_0x51d5('0x23')];this[_0x51d5('0x24')]=_0x2660ca['ListId'];this[_0x51d5('0x25')]=_0x2660ca[_0x51d5('0x25')];this[_0x51d5('0x26')]=_0x2660ca[_0x51d5('0x26')];this[_0x51d5('0x27')]=_0x2660ca[_0x51d5('0x27')];this['originatecalleridnum']=_0x2660ca[_0x51d5('0x28')]||'';this[_0x51d5('0x29')]=_0x2660ca['originatecalleridname']||'';}module[_0x51d5('0x2a')]=QueueCallerAbandon; \ No newline at end of file +var _0xebd7=['moment','milliseconds','diff','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countagentrejectretry','countdropretry','countmachineretry','uniqueid','calleridname','name','number','starttime','responsetime','droptime','holdtime','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','CampaignId','originatecalleridname','exports','util','lodash'];(function(_0x13c913,_0x19b5d2){var _0x179629=function(_0x1e5f0c){while(--_0x1e5f0c){_0x13c913['push'](_0x13c913['shift']());}};_0x179629(++_0x19b5d2);}(_0xebd7,0x108));var _0x7ebd=function(_0x154a20,_0xd0aded){_0x154a20=_0x154a20-0x0;var _0xbb1b6f=_0xebd7[_0x154a20];return _0xbb1b6f;};'use strict';var util=require(_0x7ebd('0x0'));var _=require(_0x7ebd('0x1'));var moment=require(_0x7ebd('0x2'));function getSeconds(_0x18552f,_0x30ee6c){var _0x332b24=moment(_0x18552f)[_0x7ebd('0x3')](0x0);var _0x18103b=moment(_0x30ee6c)[_0x7ebd('0x3')](0x0);return _0x332b24[_0x7ebd('0x4')](_0x18103b,'seconds');}function QueueCallerAbandon(_0x5591db,_0x469068){this[_0x7ebd('0x5')]=_0x5591db[_0x7ebd('0x5')];this[_0x7ebd('0x6')]=_0x5591db['type'];this['campaigntype']=_0x5591db[_0x7ebd('0x6')]===_0x7ebd('0x7')?_0x7ebd('0x8'):_0x5591db['type'];this[_0x7ebd('0x9')]=_0x5591db[_0x7ebd('0x9')];this[_0x7ebd('0xa')]=_0x5591db[_0x7ebd('0xa')];this[_0x7ebd('0xb')]=_0x5591db['countnoanswerretry'];this['countglobal']=_0x5591db[_0x7ebd('0x9')]+_0x5591db[_0x7ebd('0xa')]+_0x5591db[_0x7ebd('0xb')]+_0x5591db[_0x7ebd('0xc')]+_0x5591db['countdropretry']+_0x5591db[_0x7ebd('0xd')]+_0x5591db['countmachineretry']+_0x5591db[_0x7ebd('0xe')];this[_0x7ebd('0xc')]=_0x5591db[_0x7ebd('0xc')];this[_0x7ebd('0xf')]=_0x5591db[_0x7ebd('0xf')];this[_0x7ebd('0xd')]=_0x5591db[_0x7ebd('0xd')];this['countmachineretry']=_0x5591db[_0x7ebd('0x10')];this[_0x7ebd('0xe')]=_0x5591db[_0x7ebd('0xe')];this[_0x7ebd('0x11')]=_0x469068[_0x7ebd('0x11')];this[_0x7ebd('0x12')]=_0x5591db[_0x7ebd('0x13')];this['calleridnum']=_0x5591db[_0x7ebd('0x14')];this[_0x7ebd('0x15')]=_0x5591db['starttime'];this['responsetime']=_0x5591db[_0x7ebd('0x16')];this['droptime']=_0x5591db[_0x7ebd('0x17')];this['endtime']=this[_0x7ebd('0x17')];this['ringtime']=getSeconds(_0x5591db[_0x7ebd('0x16')],_0x5591db[_0x7ebd('0x15')]);this[_0x7ebd('0x18')]=getSeconds(this[_0x7ebd('0x17')],_0x5591db[_0x7ebd('0x16')]);this['talktime']=0x0;this[_0x7ebd('0x8')]=_0x469068[_0x7ebd('0x8')];this[_0x7ebd('0x19')]=_0x469068[_0x7ebd('0x1a')];this[_0x7ebd('0x1b')]=_0x469068[_0x7ebd('0x1b')];this[_0x7ebd('0x1c')]=_0x5591db['callback'];this[_0x7ebd('0x1d')]=_0x5591db['callbackuniqueid'];this['callbackat']=_0x5591db[_0x7ebd('0x1e')];this[_0x7ebd('0x1f')]=_0x5591db[_0x7ebd('0x1f')];this['ContactId']=_0x5591db[_0x7ebd('0x20')];this[_0x7ebd('0x21')]=_0x5591db['ListId'];this['UserId']=_0x5591db[_0x7ebd('0x22')];this['VoiceQueueId']=_0x5591db['VoiceQueueId'];this[_0x7ebd('0x23')]=_0x5591db['CampaignId'];this['originatecalleridnum']=_0x5591db['originatecalleridnum']||'';this[_0x7ebd('0x24')]=_0x5591db['originatecalleridname']||'';}module[_0x7ebd('0x25')]=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index e4fb579..9045577 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(_0x30cef0,_0x4df02c){var _0x566246=function(_0x267796){while(--_0x267796){_0x30cef0['push'](_0x30cef0['shift']());}};_0x566246(++_0x4df02c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0xa9e0[_0x4ea69d];return _0x5318e0;};'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(_0x1fe99b,_0x205d2e){var _0x473fad=function(_0x2b695a){while(--_0x2b695a){_0x1fe99b['push'](_0x1fe99b['shift']());}};_0x473fad(++_0x205d2e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0xa9e0[_0x34bf97];return _0x292719;};'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 57298a6..6a6e2a6 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 _0x1664=['[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','SUCCESS','updateStatus','SENDING\x20FAILED:\x20','send','execOriginate','FaxAccountId','[Fax][execOriginate][success]','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','checkTrunk','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','XMF-PATH','Convert\x20pdf\x20to\x20tif','variablesAction','Action','addVariables','ext','isTrunkReachable','isNil','active','SIP/%s','reachable','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20work]','\x20Trunk\x20is\x20not\x20active','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','Empty\x20path','Is\x20Valid','exports','util','lodash','uuid','moment','path','tiff2pdf','./util/gs','fax','../ami','./rpcDb','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','faxAccounts','trunks','actions','newchannel','syncNewchannel','bind','newstate','syncNewState','newexten','syncNewExten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','hangup','syncHangup','prototype','context','from-voip-provider','exten','localstationid','channels','uniqueid','channel','name','info','\x20syncNewchannel\x20','syncVarSet','variable','hasOwnProperty','value','channelstate','channelstatedesc','operation','status','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','create','.pdf','application/pdf','then','notify','parse','catch','stringify','error','\x20receiveFax\x20','syncOriginateResponse','merge','pick','response','reason','AttachmentId','logger','[Fax][Message][Error][Updated]','update','[Fax][Message][NoUpdate1]'];(function(_0x1d6a82,_0x37c315){var _0x5834ac=function(_0x2402ba){while(--_0x2402ba){_0x1d6a82['push'](_0x1d6a82['shift']());}};_0x5834ac(++_0x37c315);}(_0x1664,0x186));var _0x4166=function(_0x3070dc,_0x40cf11){_0x3070dc=_0x3070dc-0x0;var _0x431489=_0x1664[_0x3070dc];return _0x431489;};'use strict';var util=require(_0x4166('0x0'));var _=require(_0x4166('0x1'));var BPromise=require('bluebird');var uuid=require(_0x4166('0x2'));var moment=require(_0x4166('0x3'));var path=require(_0x4166('0x4'));var tiff2pdf=require(_0x4166('0x5'));var gs=require(_0x4166('0x6'));var logger=require('../../../config/logger')(_0x4166('0x7'));var ami=require(_0x4166('0x8'));var rpcDb=require(_0x4166('0x9'));var Channel=require('./channel');var ut=require('./util/util');var Action=require('./action');var faxAccount=require(_0x4166('0xa'));var attachment=require(_0x4166('0xb'));var faxMessage=require(_0x4166('0xc'));function Fax(_0x1535f6){this['channels']={};this[_0x4166('0xd')]=_0x1535f6[_0x4166('0xd')];this[_0x4166('0xe')]=_0x1535f6['trunks'];this[_0x4166('0xf')]={};ami['on'](_0x4166('0x10'),this[_0x4166('0x11')][_0x4166('0x12')](this));ami['on']('varset',this['syncVarSet'][_0x4166('0x12')](this));ami['on'](_0x4166('0x13'),this[_0x4166('0x14')][_0x4166('0x12')](this));ami['on'](_0x4166('0x15'),this[_0x4166('0x16')][_0x4166('0x12')](this));ami['on'](_0x4166('0x17'),this[_0x4166('0x18')][_0x4166('0x12')](this));ami['on'](_0x4166('0x19'),this[_0x4166('0x1a')][_0x4166('0x12')](this));ami['on'](_0x4166('0x1b'),this[_0x4166('0x1c')][_0x4166('0x12')](this));ami['on']('originateresponse',this['syncOriginateResponse'][_0x4166('0x12')](this));}Fax[_0x4166('0x1d')][_0x4166('0x11')]=function(_0x1ab3ca){if(_0x1ab3ca[_0x4166('0x1e')]===_0x4166('0x1f')){for(var _0x3504f5 in this[_0x4166('0xd')]){if(this[_0x4166('0xd')]['hasOwnProperty'](_0x3504f5)){if(_0x1ab3ca[_0x4166('0x20')]===this[_0x4166('0xd')][_0x3504f5][_0x4166('0x21')]){this[_0x4166('0x22')][_0x1ab3ca[_0x4166('0x23')]]={};this['channels'][_0x1ab3ca[_0x4166('0x23')]]['channel']=_0x1ab3ca[_0x4166('0x24')];this[_0x4166('0x22')][_0x1ab3ca[_0x4166('0x23')]]['id']=this[_0x4166('0xd')][_0x3504f5]['id'];this[_0x4166('0x22')][_0x1ab3ca[_0x4166('0x23')]][_0x4166('0x25')]=this[_0x4166('0xd')][_0x3504f5][_0x4166('0x25')];logger[_0x4166('0x26')](_0x1ab3ca[_0x4166('0x23')],_0x4166('0x27'));}}}}if(this[_0x4166('0xf')][_0x1ab3ca[_0x4166('0x23')]]){this[_0x4166('0x22')][_0x1ab3ca[_0x4166('0x23')]]={};this[_0x4166('0x22')][_0x1ab3ca[_0x4166('0x23')]][_0x4166('0x24')]=_0x1ab3ca[_0x4166('0x24')];logger[_0x4166('0x26')](_0x1ab3ca[_0x4166('0x23')],_0x4166('0x27'));}};Fax['prototype'][_0x4166('0x28')]=function(_0x529c5c){if(this[_0x4166('0x22')][_0x529c5c['uniqueid']]){for(var _0x2859df in _0x529c5c[_0x4166('0x29')]){if(_0x529c5c[_0x4166('0x29')][_0x4166('0x2a')](_0x2859df)){this['channels'][_0x529c5c[_0x4166('0x23')]][_0x2859df]=_0x529c5c[_0x4166('0x2b')];}}}};Fax['prototype'][_0x4166('0x14')]=function(_0x4d8195){if(this[_0x4166('0x22')][_0x4d8195[_0x4166('0x23')]]){this[_0x4166('0x22')][_0x4d8195[_0x4166('0x23')]][_0x4166('0x2c')]=_0x4d8195[_0x4166('0x2c')];this[_0x4166('0x22')][_0x4d8195[_0x4166('0x23')]]['channelstatedesc']=_0x4d8195[_0x4166('0x2d')];}};Fax['prototype'][_0x4166('0x16')]=function(_0x371ca7){if(this[_0x4166('0x22')][_0x371ca7[_0x4166('0x23')]]){for(var _0x27a69d in _0x371ca7[_0x4166('0x29')]){if(_0x371ca7[_0x4166('0x29')]['hasOwnProperty'](_0x27a69d)){this[_0x4166('0x22')][_0x371ca7[_0x4166('0x23')]][_0x27a69d]=_0x371ca7[_0x4166('0x2b')];}}}};Fax[_0x4166('0x1d')][_0x4166('0x18')]=function(_0x495f0d){if(this[_0x4166('0x22')][_0x495f0d[_0x4166('0x23')]]){this[_0x4166('0x22')][_0x495f0d['uniqueid']][_0x4166('0x2e')]=_0x495f0d[_0x4166('0x2e')];this[_0x4166('0x22')][_0x495f0d[_0x4166('0x23')]]['status']=_0x495f0d[_0x4166('0x2f')];this[_0x4166('0x22')][_0x495f0d[_0x4166('0x23')]][_0x4166('0x21')]=_0x495f0d[_0x4166('0x21')];this[_0x4166('0x22')][_0x495f0d['uniqueid']][_0x4166('0x30')]=_0x495f0d[_0x4166('0x30')];logger[_0x4166('0x26')](_0x495f0d[_0x4166('0x23')],_0x4166('0x31'));}};Fax[_0x4166('0x1d')][_0x4166('0x1a')]=function(_0x5062d2){var _0x1fefe3=this;if(this[_0x4166('0x22')][_0x5062d2['uniqueid']]){var _0x4ecedf=this[_0x4166('0x22')][_0x5062d2[_0x4166('0x23')]]['id'];this[_0x4166('0x22')][_0x5062d2['uniqueid']]['remotestationid']=_0x5062d2[_0x4166('0x32')];this['channels'][_0x5062d2['uniqueid']][_0x4166('0x33')]=_0x5062d2[_0x4166('0x33')];this[_0x4166('0x22')][_0x5062d2['uniqueid']][_0x4166('0x21')]=_0x5062d2[_0x4166('0x21')];this[_0x4166('0x22')][_0x5062d2['uniqueid']][_0x4166('0x34')]=_0x5062d2['resolution'];this[_0x4166('0x22')][_0x5062d2[_0x4166('0x23')]][_0x4166('0x35')]=_0x5062d2[_0x4166('0x35')];this['channels'][_0x5062d2[_0x4166('0x23')]]['filename']=_0x5062d2[_0x4166('0x30')];this['channels'][_0x5062d2[_0x4166('0x23')]][_0x4166('0x36')]=_0x5062d2['calleridnum'];if(this[_0x4166('0x22')][_0x5062d2[_0x4166('0x23')]][_0x4166('0x33')]>0x0){tiff2pdf(_0x5062d2[_0x4166('0x30')],_0x4166('0x37'),function(_0x43be1a){logger[_0x4166('0x26')](_0x5062d2[_0x4166('0x23')],_0x4166('0x38'),_0x43be1a[_0x4166('0x39')]);attachment[_0x4166('0x3a')]({'name':path['parse'](_0x5062d2[_0x4166('0x30')])['name'],'basename':path['parse'](_0x5062d2[_0x4166('0x30')])[_0x4166('0x25')]+_0x4166('0x3b'),'type':_0x4166('0x3c')})[_0x4166('0x3d')](function(_0x413dd5){faxAccount[_0x4166('0x3e')](_0x4ecedf,{'from':_0x5062d2[_0x4166('0x36')],'mapKey':_0x4166('0x7'),'body':path[_0x4166('0x3f')](_0x5062d2[_0x4166('0x30')])[_0x4166('0x25')]+_0x4166('0x3b'),'AttachmentId':_0x413dd5['id']})[_0x4166('0x40')](function(_0x45f5c9){logger['error'](_0x5062d2[_0x4166('0x23')],'\x20notify\x20',JSON[_0x4166('0x41')](_0x45f5c9));});})['catch'](function(_0x57bbb1){logger[_0x4166('0x42')](_0x5062d2[_0x4166('0x23')],_0x4166('0x43'),JSON[_0x4166('0x41')](_0x57bbb1));});});}logger['info'](_0x5062d2[_0x4166('0x23')],_0x4166('0x43'));}};Fax[_0x4166('0x1d')][_0x4166('0x44')]=function(_0x156b29){if(this['actions'][_0x156b29[_0x4166('0x23')]]){_[_0x4166('0x45')](this[_0x4166('0x22')][_0x156b29[_0x4166('0x23')]],_[_0x4166('0x46')](_0x156b29,[_0x4166('0x47'),_0x4166('0x48')]));}};function updateStatus(_0x1cb31e){if(_0x1cb31e['AttachmentId']){faxMessage['update'](_0x1cb31e[_0x4166('0x49')],{'failMessage':'SENDING\x20FAILED\x20'})[_0x4166('0x3d')](function(_0x490704){ut[_0x4166('0x4a')](_0x4166('0x4b'),_0x490704);})['catch'](function(_0xed6039){ut[_0x4166('0x4a')]('[Fax][Message][Error][NoUpdate1]',_0xed6039);});}else{ut[_0x4166('0x4a')]('[Fax][Message][Error][NoUpdate2]');}}Fax[_0x4166('0x1d')]['updateStatus']=function(_0x605996,_0x11cfb7,_0x4bb71f){var _0x216627=this;var _0x8360a8={};if(_0x11cfb7){_0x8360a8={'read':_0x11cfb7};}else{_0x8360a8={'failMessage':_0x4bb71f};}if(this[_0x4166('0xf')][_0x605996][_0x4166('0x49')]){faxMessage[_0x4166('0x4c')](this[_0x4166('0xf')][_0x605996]['AttachmentId'],_0x8360a8)[_0x4166('0x3d')](function(_0x5d6a8b){ut[_0x4166('0x4a')]('[Fax][Message][Updated]',_0x5d6a8b);})[_0x4166('0x40')](function(_0x1d4983){ut[_0x4166('0x4a')](_0x4166('0x4d'),_0x1d4983);})['finally'](function(){delete _0x216627['channels'][_0x605996];delete _0x216627[_0x4166('0xf')][_0x605996];});}else{ut['logger'](_0x4166('0x4e'));delete this[_0x4166('0x22')][_0x605996];delete this[_0x4166('0xf')][_0x605996];}};Fax[_0x4166('0x1d')]['syncHangup']=function(_0x3bcdeb){var _0x1fb97f=this;if(this[_0x4166('0x22')][_0x3bcdeb[_0x4166('0x23')]]){if(this[_0x4166('0xf')][_0x3bcdeb['uniqueid']]){this['channels'][_0x3bcdeb['uniqueid']]['id']=this['actions'][_0x3bcdeb[_0x4166('0x23')]]['id'];this[_0x4166('0x22')][_0x3bcdeb[_0x4166('0x23')]]['name']=this['actions'][_0x3bcdeb[_0x4166('0x23')]][_0x4166('0x25')];}logger[_0x4166('0x26')](_0x3bcdeb[_0x4166('0x23')],this[_0x4166('0xf')][_0x3bcdeb[_0x4166('0x23')]]?_0x4166('0x4f'):_0x4166('0x50'),JSON[_0x4166('0x41')](this['channels'][_0x3bcdeb['uniqueid']]));if(this[_0x4166('0xf')][_0x3bcdeb['uniqueid']]){if(this['channels'][_0x3bcdeb['uniqueid']][_0x4166('0x51')]>0x0&&this[_0x4166('0x22')][_0x3bcdeb[_0x4166('0x23')]][_0x4166('0x17')]===_0x4166('0x52')){this[_0x4166('0x53')](_0x3bcdeb[_0x4166('0x23')],!![]);}else{this[_0x4166('0x53')](_0x3bcdeb[_0x4166('0x23')],![],this[_0x4166('0x22')][_0x3bcdeb[_0x4166('0x23')]]['faxstatusstring']?_0x4166('0x54')+this['channels'][_0x3bcdeb[_0x4166('0x23')]]['faxstatusstring']:'SENDING\x20FAILED');}}}};Fax[_0x4166('0x1d')][_0x4166('0x55')]=function(_0x32a267){var _0x461669=this;return new BPromise(function(_0x475de0,_0x30029e){_0x461669[_0x4166('0x56')](_0x32a267,_0x461669[_0x4166('0xd')][_0x32a267[_0x4166('0x57')]])[_0x4166('0x3d')](function(_0x512609){ut['logger'](_0x4166('0x58'),_0x512609);_0x475de0(ut['message']('Fax\x20received'));})[_0x4166('0x40')](function(_0x4bf4fb){ut['logger'](_0x4166('0x59'),_0x4bf4fb);updateStatus(_0x32a267);_0x30029e(ut[_0x4166('0x39')](_0x4166('0x5a')));});});};Fax[_0x4166('0x1d')][_0x4166('0x5b')]=function(_0x2c77d8){var _0x2a35bf=this;return new BPromise(function(_0x141301,_0x247274){var _0x2c0c43=_0x2a35bf[_0x4166('0x5c')](_0x2a35bf[_0x4166('0xd')][_0x2c77d8[_0x4166('0x57')]]['Trunk'],_0x2c77d8);if(_0x2c0c43[_0x4166('0x5d')]){_0x141301(ut[_0x4166('0x39')](_0x4166('0x5e')));}else{_0x247274(ut[_0x4166('0x39')](_0x2c0c43['message']));}});};function originate(_0x486887,_0x5f4821,_0x3970a1){return new BPromise(function(_0x452050,_0x2d9ff3){if(_0x3970a1){var _0x17a900=util[_0x4166('0x5f')](_0x4166('0x60'),path['parse'](_0x486887[_0x4166('0x4')])['name'],_0x486887[_0x4166('0x4')]);gs[_0x4166('0x61')](_0x17a900)['then'](function(){_0x486887[_0x4166('0x4')]=util[_0x4166('0x5f')]('%s/%s.tif',path[_0x4166('0x3f')](_0x486887[_0x4166('0x4')])['dir'],path['parse'](_0x486887[_0x4166('0x4')])[_0x4166('0x25')]);_0x5f4821[_0x4166('0x62')]=_0x486887['path'];ut[_0x4166('0x4a')](_0x4166('0x63'),'');ami['Action'](ut[_0x4166('0x64')](_0x486887,_0x5f4821))['then'](function(_0x430ae5){_0x452050(_0x430ae5);})[_0x4166('0x40')](function(_0xae110d){_0x2d9ff3(_0xae110d);});})[_0x4166('0x40')](function(_0x1a0c46){_0x2d9ff3(_0x1a0c46);});}else{ami[_0x4166('0x65')](ut['variablesAction'](_0x486887,_0x5f4821))[_0x4166('0x3d')](function(_0x28a001){_0x452050(_0x28a001);})[_0x4166('0x40')](function(_0x3c0447){_0x2d9ff3(_0x3c0447);});}});}Fax['prototype'][_0x4166('0x56')]=function(_0x5bcef6,_0x43ecb2){var _0xe52b8c=this;return new BPromise(function(_0x3847dc,_0x4c9e8b){var _0x5725f8=uuid['v4']();var _0x5f26c6=ut[_0x4166('0x66')](_0x5bcef6,_0x43ecb2);_0xe52b8c[_0x4166('0xf')][_0x5725f8]=new Action(_0x5725f8,_0x43ecb2,_0x5bcef6);var _0x30f73b=_0xe52b8c[_0x4166('0xf')][_0x5725f8];if(path[_0x4166('0x3f')](_0x5bcef6[_0x4166('0x4')])[_0x4166('0x67')]===_0x4166('0x3b')){originate(_0x30f73b,_0x5f26c6,!![])['then'](function(_0x4acadc){_0x3847dc(_0x4acadc);})[_0x4166('0x40')](function(_0x577249){_0x4c9e8b(_0x577249);});}else{originate(_0x30f73b,_0x5f26c6,![])[_0x4166('0x3d')](function(_0x1149fb){_0x3847dc(_0x1149fb);})[_0x4166('0x40')](function(_0x363238){_0x4c9e8b(_0x363238);});}});};Fax[_0x4166('0x1d')][_0x4166('0x68')]=function(_0x3cb25c){return!_[_0x4166('0x69')](_0x3cb25c)&&!_[_0x4166('0x69')](_0x3cb25c['name'])&&!_[_0x4166('0x69')](_0x3cb25c[_0x4166('0x6a')])&&_0x3cb25c[_0x4166('0x6a')]&&!_[_0x4166('0x69')](this[_0x4166('0xe')][util[_0x4166('0x5f')](_0x4166('0x6b'),_0x3cb25c[_0x4166('0x25')])])&&!_[_0x4166('0x69')](this['trunks'][util[_0x4166('0x5f')](_0x4166('0x6b'),_0x3cb25c[_0x4166('0x25')])][_0x4166('0x2f')])&&(this[_0x4166('0xe')][util['format'](_0x4166('0x6b'),_0x3cb25c[_0x4166('0x25')])][_0x4166('0x2f')]===_0x4166('0x6c')||this[_0x4166('0xe')][util[_0x4166('0x5f')](_0x4166('0x6b'),_0x3cb25c[_0x4166('0x25')])][_0x4166('0x2f')]===_0x4166('0x6d'));};Fax[_0x4166('0x1d')][_0x4166('0x5c')]=function(_0x433af0,_0x329502){if(!this[_0x4166('0x68')](_0x433af0)){ut['logger'](_0x4166('0x6e'),_[_0x4166('0x69')](_0x433af0)?'':_0x433af0[_0x4166('0x25')]+_0x4166('0x6f'));return{'isValid':![],'message':'Trunk\x20not\x20working'};}if(_[_0x4166('0x69')](_0x329502['fax'])){ut[_0x4166('0x4a')](_0x4166('0x70'),JSON[_0x4166('0x41')](_0x329502));return{'isValid':![],'message':_0x4166('0x71')};}if(_['isNil'](_0x329502[_0x4166('0x4')])){ut[_0x4166('0x4a')]('[Fax][checkTrunk][Empty\x20path]',JSON[_0x4166('0x41')](_0x329502));return{'isValid':![],'message':_0x4166('0x72')};}return{'isValid':!![],'message':_0x4166('0x73')};};module[_0x4166('0x74')]=Fax; \ No newline at end of file +var _0x0e4f=['syncFaxStatus','syncReceiveFax','syncOriginateResponse','context','hasOwnProperty','exten','localstationid','uniqueid','channel','name','\x20syncNewchannel\x20','info','prototype','variable','value','channelstate','channelstatedesc','operation','status','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','\x20result\x20conversion\x20file\x20','create','parse','then','.pdf','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','merge','pick','response','reason','update','AttachmentId','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','[Fax][Message][NoUpdate2]','syncHangup','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','SUCCESS','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','FaxAccountId','[Fax][execOriginate][success]','Fax\x20received','message','Fax\x20failed','checkAfterSend','checkTrunk','Trunk','isValid','Trunk\x20Reachable','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','execute','%s/%s.tif','dir','Convert\x20pdf\x20to\x20tif','Action','execOriginate','addVariables','isTrunkReachable','isNil','active','SIP/%s','reachable','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20work]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','Empty\x20path','Is\x20Valid','lodash','uuid','moment','path','tiff2pdf','fax','../ami','./util/util','./action','../rpc/faxAccount','../rpc/attachment','channels','faxAccounts','trunks','actions','newchannel','syncNewchannel','bind','varset','syncVarSet','newstate','syncNewState','newexten','syncNewExten','faxstatus'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x0e4f,0xcd));var _0xf0e4=function(_0x530296,_0x50a4d7){_0x530296=_0x530296-0x0;var _0x4342a4=_0x0e4f[_0x530296];return _0x4342a4;};'use strict';var util=require('util');var _=require(_0xf0e4('0x0'));var BPromise=require('bluebird');var uuid=require(_0xf0e4('0x1'));var moment=require(_0xf0e4('0x2'));var path=require(_0xf0e4('0x3'));var tiff2pdf=require(_0xf0e4('0x4'));var gs=require('./util/gs');var logger=require('../../../config/logger')(_0xf0e4('0x5'));var ami=require(_0xf0e4('0x6'));var rpcDb=require('./rpcDb');var Channel=require('./channel');var ut=require(_0xf0e4('0x7'));var Action=require(_0xf0e4('0x8'));var faxAccount=require(_0xf0e4('0x9'));var attachment=require(_0xf0e4('0xa'));var faxMessage=require('../rpc/faxMessage');function Fax(_0x3f1a39){this[_0xf0e4('0xb')]={};this[_0xf0e4('0xc')]=_0x3f1a39['faxAccounts'];this[_0xf0e4('0xd')]=_0x3f1a39[_0xf0e4('0xd')];this[_0xf0e4('0xe')]={};ami['on'](_0xf0e4('0xf'),this[_0xf0e4('0x10')][_0xf0e4('0x11')](this));ami['on'](_0xf0e4('0x12'),this[_0xf0e4('0x13')][_0xf0e4('0x11')](this));ami['on'](_0xf0e4('0x14'),this[_0xf0e4('0x15')][_0xf0e4('0x11')](this));ami['on'](_0xf0e4('0x16'),this[_0xf0e4('0x17')][_0xf0e4('0x11')](this));ami['on'](_0xf0e4('0x18'),this[_0xf0e4('0x19')][_0xf0e4('0x11')](this));ami['on']('receivefax',this[_0xf0e4('0x1a')][_0xf0e4('0x11')](this));ami['on']('hangup',this['syncHangup'][_0xf0e4('0x11')](this));ami['on']('originateresponse',this[_0xf0e4('0x1b')][_0xf0e4('0x11')](this));}Fax['prototype'][_0xf0e4('0x10')]=function(_0x129dc3){if(_0x129dc3[_0xf0e4('0x1c')]==='from-voip-provider'){for(var _0x4aa2d9 in this[_0xf0e4('0xc')]){if(this[_0xf0e4('0xc')][_0xf0e4('0x1d')](_0x4aa2d9)){if(_0x129dc3[_0xf0e4('0x1e')]===this['faxAccounts'][_0x4aa2d9][_0xf0e4('0x1f')]){this[_0xf0e4('0xb')][_0x129dc3[_0xf0e4('0x20')]]={};this[_0xf0e4('0xb')][_0x129dc3[_0xf0e4('0x20')]][_0xf0e4('0x21')]=_0x129dc3[_0xf0e4('0x21')];this[_0xf0e4('0xb')][_0x129dc3[_0xf0e4('0x20')]]['id']=this[_0xf0e4('0xc')][_0x4aa2d9]['id'];this[_0xf0e4('0xb')][_0x129dc3[_0xf0e4('0x20')]][_0xf0e4('0x22')]=this['faxAccounts'][_0x4aa2d9][_0xf0e4('0x22')];logger['info'](_0x129dc3[_0xf0e4('0x20')],_0xf0e4('0x23'));}}}}if(this[_0xf0e4('0xe')][_0x129dc3[_0xf0e4('0x20')]]){this[_0xf0e4('0xb')][_0x129dc3[_0xf0e4('0x20')]]={};this[_0xf0e4('0xb')][_0x129dc3[_0xf0e4('0x20')]]['channel']=_0x129dc3[_0xf0e4('0x21')];logger[_0xf0e4('0x24')](_0x129dc3[_0xf0e4('0x20')],_0xf0e4('0x23'));}};Fax[_0xf0e4('0x25')][_0xf0e4('0x13')]=function(_0x52d041){if(this[_0xf0e4('0xb')][_0x52d041[_0xf0e4('0x20')]]){for(var _0x4f95ad in _0x52d041[_0xf0e4('0x26')]){if(_0x52d041[_0xf0e4('0x26')][_0xf0e4('0x1d')](_0x4f95ad)){this[_0xf0e4('0xb')][_0x52d041[_0xf0e4('0x20')]][_0x4f95ad]=_0x52d041[_0xf0e4('0x27')];}}}};Fax[_0xf0e4('0x25')][_0xf0e4('0x15')]=function(_0x1e8f4e){if(this[_0xf0e4('0xb')][_0x1e8f4e[_0xf0e4('0x20')]]){this[_0xf0e4('0xb')][_0x1e8f4e[_0xf0e4('0x20')]][_0xf0e4('0x28')]=_0x1e8f4e[_0xf0e4('0x28')];this[_0xf0e4('0xb')][_0x1e8f4e[_0xf0e4('0x20')]][_0xf0e4('0x29')]=_0x1e8f4e['channelstatedesc'];}};Fax['prototype'][_0xf0e4('0x17')]=function(_0x3657f6){if(this[_0xf0e4('0xb')][_0x3657f6[_0xf0e4('0x20')]]){for(var _0x2c1dc3 in _0x3657f6[_0xf0e4('0x26')]){if(_0x3657f6['variable'][_0xf0e4('0x1d')](_0x2c1dc3)){this[_0xf0e4('0xb')][_0x3657f6[_0xf0e4('0x20')]][_0x2c1dc3]=_0x3657f6[_0xf0e4('0x27')];}}}};Fax[_0xf0e4('0x25')][_0xf0e4('0x19')]=function(_0x25918e){if(this[_0xf0e4('0xb')][_0x25918e[_0xf0e4('0x20')]]){this[_0xf0e4('0xb')][_0x25918e[_0xf0e4('0x20')]][_0xf0e4('0x2a')]=_0x25918e[_0xf0e4('0x2a')];this[_0xf0e4('0xb')][_0x25918e[_0xf0e4('0x20')]][_0xf0e4('0x2b')]=_0x25918e[_0xf0e4('0x2b')];this[_0xf0e4('0xb')][_0x25918e[_0xf0e4('0x20')]][_0xf0e4('0x1f')]=_0x25918e[_0xf0e4('0x1f')];this[_0xf0e4('0xb')][_0x25918e['uniqueid']][_0xf0e4('0x2c')]=_0x25918e[_0xf0e4('0x2c')];logger['info'](_0x25918e[_0xf0e4('0x20')],_0xf0e4('0x2d'));}};Fax[_0xf0e4('0x25')][_0xf0e4('0x1a')]=function(_0x5d4298){var _0x4ee687=this;if(this[_0xf0e4('0xb')][_0x5d4298['uniqueid']]){var _0x4d7474=this[_0xf0e4('0xb')][_0x5d4298[_0xf0e4('0x20')]]['id'];this[_0xf0e4('0xb')][_0x5d4298[_0xf0e4('0x20')]][_0xf0e4('0x2e')]=_0x5d4298[_0xf0e4('0x2e')];this[_0xf0e4('0xb')][_0x5d4298[_0xf0e4('0x20')]][_0xf0e4('0x2f')]=_0x5d4298[_0xf0e4('0x2f')];this[_0xf0e4('0xb')][_0x5d4298[_0xf0e4('0x20')]][_0xf0e4('0x1f')]=_0x5d4298[_0xf0e4('0x1f')];this[_0xf0e4('0xb')][_0x5d4298[_0xf0e4('0x20')]][_0xf0e4('0x30')]=_0x5d4298[_0xf0e4('0x30')];this['channels'][_0x5d4298[_0xf0e4('0x20')]][_0xf0e4('0x31')]=_0x5d4298['transferrate'];this[_0xf0e4('0xb')][_0x5d4298[_0xf0e4('0x20')]][_0xf0e4('0x2c')]=_0x5d4298['filename'];this[_0xf0e4('0xb')][_0x5d4298[_0xf0e4('0x20')]][_0xf0e4('0x32')]=_0x5d4298[_0xf0e4('0x32')];if(this[_0xf0e4('0xb')][_0x5d4298[_0xf0e4('0x20')]]['pagestransferred']>0x0){tiff2pdf(_0x5d4298[_0xf0e4('0x2c')],'/var/opt/motion2/server/files/attachments/',function(_0x3ad145){logger['info'](_0x5d4298['uniqueid'],_0xf0e4('0x33'),_0x3ad145['message']);attachment[_0xf0e4('0x34')]({'name':path[_0xf0e4('0x35')](_0x5d4298[_0xf0e4('0x2c')])[_0xf0e4('0x22')],'basename':path[_0xf0e4('0x35')](_0x5d4298['filename'])[_0xf0e4('0x22')]+'.pdf','type':'application/pdf'})[_0xf0e4('0x36')](function(_0x4f8b3d){faxAccount['notify'](_0x4d7474,{'from':_0x5d4298[_0xf0e4('0x32')],'mapKey':_0xf0e4('0x5'),'body':path[_0xf0e4('0x35')](_0x5d4298[_0xf0e4('0x2c')])[_0xf0e4('0x22')]+_0xf0e4('0x37'),'AttachmentId':_0x4f8b3d['id']})[_0xf0e4('0x38')](function(_0xc9b823){logger[_0xf0e4('0x39')](_0x5d4298[_0xf0e4('0x20')],_0xf0e4('0x3a'),JSON[_0xf0e4('0x3b')](_0xc9b823));});})[_0xf0e4('0x38')](function(_0x524847){logger[_0xf0e4('0x39')](_0x5d4298[_0xf0e4('0x20')],_0xf0e4('0x3c'),JSON['stringify'](_0x524847));});});}logger['info'](_0x5d4298[_0xf0e4('0x20')],'\x20receiveFax\x20');}};Fax['prototype'][_0xf0e4('0x1b')]=function(_0x54848c){if(this[_0xf0e4('0xe')][_0x54848c['uniqueid']]){_[_0xf0e4('0x3d')](this[_0xf0e4('0xb')][_0x54848c['uniqueid']],_[_0xf0e4('0x3e')](_0x54848c,[_0xf0e4('0x3f'),_0xf0e4('0x40')]));}};function updateStatus(_0x5743d3){if(_0x5743d3['AttachmentId']){faxMessage[_0xf0e4('0x41')](_0x5743d3[_0xf0e4('0x42')],{'failMessage':_0xf0e4('0x43')})[_0xf0e4('0x36')](function(_0x13a5d2){ut[_0xf0e4('0x44')](_0xf0e4('0x45'),_0x13a5d2);})[_0xf0e4('0x38')](function(_0x397bc3){ut[_0xf0e4('0x44')]('[Fax][Message][Error][NoUpdate1]',_0x397bc3);});}else{ut[_0xf0e4('0x44')](_0xf0e4('0x46'));}}Fax[_0xf0e4('0x25')][_0xf0e4('0x47')]=function(_0x22e000,_0x5b75ed,_0xbc0e6e){var _0x2aaa21=this;var _0x410b4f={};if(_0x5b75ed){_0x410b4f={'read':_0x5b75ed};}else{_0x410b4f={'failMessage':_0xbc0e6e};}if(this[_0xf0e4('0xe')][_0x22e000][_0xf0e4('0x42')]){faxMessage[_0xf0e4('0x41')](this['actions'][_0x22e000][_0xf0e4('0x42')],_0x410b4f)['then'](function(_0x175821){ut[_0xf0e4('0x44')](_0xf0e4('0x48'),_0x175821);})[_0xf0e4('0x38')](function(_0x3efdff){ut[_0xf0e4('0x44')](_0xf0e4('0x49'),_0x3efdff);})['finally'](function(){delete _0x2aaa21[_0xf0e4('0xb')][_0x22e000];delete _0x2aaa21[_0xf0e4('0xe')][_0x22e000];});}else{ut[_0xf0e4('0x44')](_0xf0e4('0x4a'));delete this['channels'][_0x22e000];delete this[_0xf0e4('0xe')][_0x22e000];}};Fax['prototype'][_0xf0e4('0x4b')]=function(_0x5753ef){var _0x119330=this;if(this['channels'][_0x5753ef['uniqueid']]){if(this[_0xf0e4('0xe')][_0x5753ef['uniqueid']]){this[_0xf0e4('0xb')][_0x5753ef[_0xf0e4('0x20')]]['id']=this[_0xf0e4('0xe')][_0x5753ef[_0xf0e4('0x20')]]['id'];this[_0xf0e4('0xb')][_0x5753ef[_0xf0e4('0x20')]][_0xf0e4('0x22')]=this[_0xf0e4('0xe')][_0x5753ef[_0xf0e4('0x20')]][_0xf0e4('0x22')];}logger['info'](_0x5753ef['uniqueid'],this[_0xf0e4('0xe')][_0x5753ef['uniqueid']]?_0xf0e4('0x4c'):_0xf0e4('0x4d'),JSON[_0xf0e4('0x3b')](this['channels'][_0x5753ef[_0xf0e4('0x20')]]));if(this[_0xf0e4('0xe')][_0x5753ef[_0xf0e4('0x20')]]){if(this[_0xf0e4('0xb')][_0x5753ef[_0xf0e4('0x20')]][_0xf0e4('0x4e')]>0x0&&this['channels'][_0x5753ef[_0xf0e4('0x20')]]['faxstatus']===_0xf0e4('0x4f')){this[_0xf0e4('0x47')](_0x5753ef[_0xf0e4('0x20')],!![]);}else{this[_0xf0e4('0x47')](_0x5753ef[_0xf0e4('0x20')],![],this[_0xf0e4('0xb')][_0x5753ef[_0xf0e4('0x20')]][_0xf0e4('0x50')]?_0xf0e4('0x51')+this[_0xf0e4('0xb')][_0x5753ef[_0xf0e4('0x20')]]['faxstatusstring']:_0xf0e4('0x52'));}}}};Fax[_0xf0e4('0x25')]['send']=function(_0x573c32){var _0x5410e9=this;return new BPromise(function(_0x4bb36b,_0x1a503b){_0x5410e9['execOriginate'](_0x573c32,_0x5410e9[_0xf0e4('0xc')][_0x573c32[_0xf0e4('0x53')]])['then'](function(_0x3bed31){ut[_0xf0e4('0x44')](_0xf0e4('0x54'),_0x3bed31);_0x4bb36b(ut['message'](_0xf0e4('0x55')));})[_0xf0e4('0x38')](function(_0x4266cb){ut[_0xf0e4('0x44')]('[Fax][execOriginate][failure]',_0x4266cb);updateStatus(_0x573c32);_0x1a503b(ut[_0xf0e4('0x56')](_0xf0e4('0x57')));});});};Fax[_0xf0e4('0x25')][_0xf0e4('0x58')]=function(_0x43b091){var _0x3b74b4=this;return new BPromise(function(_0x1959b6,_0x51fea0){var _0x468082=_0x3b74b4[_0xf0e4('0x59')](_0x3b74b4[_0xf0e4('0xc')][_0x43b091[_0xf0e4('0x53')]][_0xf0e4('0x5a')],_0x43b091);if(_0x468082[_0xf0e4('0x5b')]){_0x1959b6(ut[_0xf0e4('0x56')](_0xf0e4('0x5c')));}else{_0x51fea0(ut[_0xf0e4('0x56')](_0x468082[_0xf0e4('0x56')]));}});};function originate(_0x127f6d,_0x170283,_0x5198bb){return new BPromise(function(_0x3bbd96,_0x250f89){if(_0x5198bb){var _0x589dfe=util[_0xf0e4('0x5d')](_0xf0e4('0x5e'),path[_0xf0e4('0x35')](_0x127f6d[_0xf0e4('0x3')])[_0xf0e4('0x22')],_0x127f6d['path']);gs[_0xf0e4('0x5f')](_0x589dfe)['then'](function(){_0x127f6d[_0xf0e4('0x3')]=util['format'](_0xf0e4('0x60'),path[_0xf0e4('0x35')](_0x127f6d[_0xf0e4('0x3')])[_0xf0e4('0x61')],path[_0xf0e4('0x35')](_0x127f6d[_0xf0e4('0x3')])[_0xf0e4('0x22')]);_0x170283['XMF-PATH']=_0x127f6d[_0xf0e4('0x3')];ut['logger'](_0xf0e4('0x62'),'');ami[_0xf0e4('0x63')](ut['variablesAction'](_0x127f6d,_0x170283))['then'](function(_0x8b70d1){_0x3bbd96(_0x8b70d1);})[_0xf0e4('0x38')](function(_0x410dd4){_0x250f89(_0x410dd4);});})[_0xf0e4('0x38')](function(_0x5bb3f1){_0x250f89(_0x5bb3f1);});}else{ami[_0xf0e4('0x63')](ut['variablesAction'](_0x127f6d,_0x170283))['then'](function(_0x143a4c){_0x3bbd96(_0x143a4c);})[_0xf0e4('0x38')](function(_0x24993f){_0x250f89(_0x24993f);});}});}Fax[_0xf0e4('0x25')][_0xf0e4('0x64')]=function(_0x3eaf78,_0x358684){var _0x4df216=this;return new BPromise(function(_0x413cd1,_0xde9b4c){var _0x4519bc=uuid['v4']();var _0x341a18=ut[_0xf0e4('0x65')](_0x3eaf78,_0x358684);_0x4df216[_0xf0e4('0xe')][_0x4519bc]=new Action(_0x4519bc,_0x358684,_0x3eaf78);var _0x54fe91=_0x4df216[_0xf0e4('0xe')][_0x4519bc];if(path[_0xf0e4('0x35')](_0x3eaf78[_0xf0e4('0x3')])['ext']===_0xf0e4('0x37')){originate(_0x54fe91,_0x341a18,!![])['then'](function(_0x1c82a6){_0x413cd1(_0x1c82a6);})[_0xf0e4('0x38')](function(_0x856ea4){_0xde9b4c(_0x856ea4);});}else{originate(_0x54fe91,_0x341a18,![])[_0xf0e4('0x36')](function(_0x3de0ff){_0x413cd1(_0x3de0ff);})[_0xf0e4('0x38')](function(_0x36c121){_0xde9b4c(_0x36c121);});}});};Fax['prototype'][_0xf0e4('0x66')]=function(_0x564238){return!_[_0xf0e4('0x67')](_0x564238)&&!_[_0xf0e4('0x67')](_0x564238[_0xf0e4('0x22')])&&!_[_0xf0e4('0x67')](_0x564238[_0xf0e4('0x68')])&&_0x564238['active']&&!_[_0xf0e4('0x67')](this[_0xf0e4('0xd')][util[_0xf0e4('0x5d')](_0xf0e4('0x69'),_0x564238[_0xf0e4('0x22')])])&&!_[_0xf0e4('0x67')](this[_0xf0e4('0xd')][util['format']('SIP/%s',_0x564238[_0xf0e4('0x22')])][_0xf0e4('0x2b')])&&(this[_0xf0e4('0xd')][util['format'](_0xf0e4('0x69'),_0x564238[_0xf0e4('0x22')])]['status']===_0xf0e4('0x6a')||this[_0xf0e4('0xd')][util[_0xf0e4('0x5d')](_0xf0e4('0x69'),_0x564238[_0xf0e4('0x22')])][_0xf0e4('0x2b')]===_0xf0e4('0x6b'));};Fax[_0xf0e4('0x25')][_0xf0e4('0x59')]=function(_0x53c28d,_0x5acaa5){if(!this[_0xf0e4('0x66')](_0x53c28d)){ut[_0xf0e4('0x44')](_0xf0e4('0x6c'),_[_0xf0e4('0x67')](_0x53c28d)?'':_0x53c28d[_0xf0e4('0x22')]+_0xf0e4('0x6d'));return{'isValid':![],'message':_0xf0e4('0x6e')};}if(_['isNil'](_0x5acaa5[_0xf0e4('0x5')])){ut['logger'](_0xf0e4('0x6f'),JSON[_0xf0e4('0x3b')](_0x5acaa5));return{'isValid':![],'message':_0xf0e4('0x70')};}if(_['isNil'](_0x5acaa5[_0xf0e4('0x3')])){ut['logger']('[Fax][checkTrunk][Empty\x20path]',JSON[_0xf0e4('0x3b')](_0x5acaa5));return{'isValid':![],'message':_0xf0e4('0x71')};}return{'isValid':!![],'message':_0xf0e4('0x72')};};module['exports']=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index d588354..ade5e62 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 _0x1f28=['preview','inspect','resolve','then','notify','[Notify]\x20','util','bluebird','../../../config/logger'];(function(_0xa03344,_0x581292){var _0x38acfd=function(_0x1b1e8c){while(--_0x1b1e8c){_0xa03344['push'](_0xa03344['shift']());}};_0x38acfd(++_0x581292);}(_0x1f28,0x153));var _0x81f2=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x1f28[_0xfae23b];return _0x200640;};'use strict';var util=require(_0x81f2('0x0'));var BPromise=require(_0x81f2('0x1'));var logger=require(_0x81f2('0x2'))(_0x81f2('0x3'));var _=require('lodash');var faxAccount=require('../rpc/faxAccount');function loggerCatch(_0x44d30a){return function(_0x316282){logger['error'](_0x44d30a,util[_0x81f2('0x4')](_0x316282,{'showHidden':![],'depth':null}));};}exports['notify']=function(_0x360c9e,_0x4bcf83){return BPromise[_0x81f2('0x5')]()[_0x81f2('0x6')](faxAccount[_0x81f2('0x7')](_0x360c9e,_0x4bcf83))['catch'](loggerCatch(_0x81f2('0x8')));}; \ No newline at end of file +var _0x37f7=['notify','catch','[Notify]\x20','util','bluebird','preview','lodash','error','resolve'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x37f7,0x1b3));var _0x737f=function(_0x41fe15,_0x247482){_0x41fe15=_0x41fe15-0x0;var _0x3e82ac=_0x37f7[_0x41fe15];return _0x3e82ac;};'use strict';var util=require(_0x737f('0x0'));var BPromise=require(_0x737f('0x1'));var logger=require('../../../config/logger')(_0x737f('0x2'));var _=require(_0x737f('0x3'));var faxAccount=require('../rpc/faxAccount');function loggerCatch(_0x36487e){return function(_0x354d68){logger[_0x737f('0x4')](_0x36487e,util['inspect'](_0x354d68,{'showHidden':![],'depth':null}));};}exports['notify']=function(_0x4bd8de,_0x28d997){return BPromise[_0x737f('0x5')]()['then'](faxAccount[_0x737f('0x6')](_0x4bd8de,_0x28d997))[_0x737f('0x7')](loggerCatch(_0x737f('0x8')));}; \ 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 7c49d2f..673aca8 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 _0xd54d=['Exec\x20gs','info','\x20Error\x20:','inspect','util','fax','bluebird','child_process','exec','execute'];(function(_0x5afd56,_0x5f2e2b){var _0x4c204a=function(_0x8a64b1){while(--_0x8a64b1){_0x5afd56['push'](_0x5afd56['shift']());}};_0x4c204a(++_0x5f2e2b);}(_0xd54d,0x126));var _0xdd54=function(_0x47e7be,_0x41fef0){_0x47e7be=_0x47e7be-0x0;var _0x2476c4=_0xd54d[_0x47e7be];return _0x2476c4;};'use strict';var util=require(_0xdd54('0x0'));var logger=require('../../../../config/logger')(_0xdd54('0x1'));var BPromise=require(_0xdd54('0x2'));var exec=require(_0xdd54('0x3'))[_0xdd54('0x4')];exports[_0xdd54('0x5')]=function(_0x588022){return new BPromise(function(_0x44b98,_0x356df8){exec(_0x588022,function(_0x184e4f,_0x1f000a,_0x247831){logger['info'](_0xdd54('0x6'),_0x1f000a);if(_0x184e4f){logger[_0xdd54('0x7')](_0xdd54('0x6'),_0xdd54('0x8'),util[_0xdd54('0x9')](_0x184e4f,{'showHidden':![],'depth':null}),_0x1f000a,_0x247831);_0x356df8(_0x184e4f);}_0x44b98(_0x1f000a);});});}; \ No newline at end of file +var _0xb067=['bluebird','child_process','exec','execute','info','\x20Error\x20:','inspect','util','fax'];(function(_0x2eb779,_0x1193ab){var _0x1fa827=function(_0x56023f){while(--_0x56023f){_0x2eb779['push'](_0x2eb779['shift']());}};_0x1fa827(++_0x1193ab);}(_0xb067,0x127));var _0x7b06=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xb067[_0x321bb2];return _0x9c12ed;};'use strict';var util=require(_0x7b06('0x0'));var logger=require('../../../../config/logger')(_0x7b06('0x1'));var BPromise=require(_0x7b06('0x2'));var exec=require(_0x7b06('0x3'))[_0x7b06('0x4')];exports[_0x7b06('0x5')]=function(_0x1d5a6c){return new BPromise(function(_0xa76afa,_0x30844f){exec(_0x1d5a6c,function(_0x514ff5,_0x2a6101,_0xb9acb3){logger[_0x7b06('0x6')]('Exec\x20gs',_0x2a6101);if(_0x514ff5){logger[_0x7b06('0x6')]('Exec\x20gs',_0x7b06('0x7'),util[_0x7b06('0x8')](_0x514ff5,{'showHidden':![],'depth':null}),_0x2a6101,_0xb9acb3);_0x30844f(_0x514ff5);}_0xa76afa(_0x2a6101);});});}; \ 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 73dad97..048eb71 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 _0x61ec=['t38timeout','localstationid','uniqueid','xcally-motion-fax','from-sip','\x22%s\x22\x20<%s>','util','lodash','fax','logger','info','addVariables','ecm','headerinfo','minrate','format','\x22%s\x22','modem','gateway','faxdetect'];(function(_0x5783f4,_0x4a9e0a){var _0x28e380=function(_0x1ffc49){while(--_0x1ffc49){_0x5783f4['push'](_0x5783f4['shift']());}};_0x28e380(++_0x4a9e0a);}(_0x61ec,0x182));var _0xc61e=function(_0x11c9a3,_0x3f0eca){_0x11c9a3=_0x11c9a3-0x0;var _0x33d27a=_0x61ec[_0x11c9a3];return _0x33d27a;};'use strict';var util=require(_0xc61e('0x0'));var _=require(_0xc61e('0x1'));var moment=require('moment');var logger=require('../../../../config/logger')(_0xc61e('0x2'));exports['message']=function(_0x3a9869){return{'message':_0x3a9869};};exports[_0xc61e('0x3')]=function(_0x411059,_0x4ca157){logger[_0xc61e('0x4')](_0x411059,util['inspect'](_0x4ca157,{'showHidden':![],'depth':null}));};exports[_0xc61e('0x5')]=function(_0x5719a3,_0x568818){var _0x5a7dd1={'XMF-ECM':_0x568818[_0xc61e('0x6')],'XMF-HEADERINFO':_0x568818[_0xc61e('0x7')],'XMF-MINRATE':_0x568818[_0xc61e('0x8')],'XMF-MAXRATE':_0x568818['maxrate'],'XMF-MODEM':util[_0xc61e('0x9')](_0xc61e('0xa'),_0x568818[_0xc61e('0xb')]),'XMF-GATEWAY':_0x568818[_0xc61e('0xc')],'XMF-FAXDETECT':_0x568818[_0xc61e('0xd')],'XMF-T38TIMEOUT':_0x568818[_0xc61e('0xe')],'XMF-LOCALSTATIONID':_0x568818[_0xc61e('0xf')],'XMF-PATH':_0x5719a3['path']};return _0x5a7dd1;};exports['variablesAction']=function(_0x4a51c1,_0x43fd44){return{'actionid':_0x4a51c1[_0xc61e('0x10')],'action':'originate','channel':_0x4a51c1['channel'],'Exten':_0xc61e('0x11'),'Context':_0xc61e('0x12'),'Priority':'1','callerid':util[_0xc61e('0x9')](_0xc61e('0x13'),_0x4a51c1[_0xc61e('0x7')]?_0x4a51c1[_0xc61e('0x7')]:'',_0x4a51c1[_0xc61e('0xf')]),'variable':_0x43fd44,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x4a51c1[_0xc61e('0x10')]};}; \ No newline at end of file +var _0xd59c=['path','variablesAction','uniqueid','channel','xcally-motion-fax','from-sip','format','\x22%s\x22\x20<%s>','util','lodash','moment','message','info','inspect','addVariables','ecm','headerinfo','maxrate','\x22%s\x22','gateway','faxdetect','t38timeout','localstationid'];(function(_0xa1e3e3,_0x29fe0e){var _0xc980e9=function(_0x1f5adc){while(--_0x1f5adc){_0xa1e3e3['push'](_0xa1e3e3['shift']());}};_0xc980e9(++_0x29fe0e);}(_0xd59c,0x161));var _0xcd59=function(_0xb3e564,_0x1b9798){_0xb3e564=_0xb3e564-0x0;var _0x9ce3=_0xd59c[_0xb3e564];return _0x9ce3;};'use strict';var util=require(_0xcd59('0x0'));var _=require(_0xcd59('0x1'));var moment=require(_0xcd59('0x2'));var logger=require('../../../../config/logger')('fax');exports[_0xcd59('0x3')]=function(_0x23238b){return{'message':_0x23238b};};exports['logger']=function(_0x2e93aa,_0x427111){logger[_0xcd59('0x4')](_0x2e93aa,util[_0xcd59('0x5')](_0x427111,{'showHidden':![],'depth':null}));};exports[_0xcd59('0x6')]=function(_0x5027ff,_0x11eda1){var _0x9dad9f={'XMF-ECM':_0x11eda1[_0xcd59('0x7')],'XMF-HEADERINFO':_0x11eda1[_0xcd59('0x8')],'XMF-MINRATE':_0x11eda1['minrate'],'XMF-MAXRATE':_0x11eda1[_0xcd59('0x9')],'XMF-MODEM':util['format'](_0xcd59('0xa'),_0x11eda1['modem']),'XMF-GATEWAY':_0x11eda1[_0xcd59('0xb')],'XMF-FAXDETECT':_0x11eda1[_0xcd59('0xc')],'XMF-T38TIMEOUT':_0x11eda1[_0xcd59('0xd')],'XMF-LOCALSTATIONID':_0x11eda1[_0xcd59('0xe')],'XMF-PATH':_0x5027ff[_0xcd59('0xf')]};return _0x9dad9f;};exports[_0xcd59('0x10')]=function(_0x20cc71,_0x391dee){return{'actionid':_0x20cc71[_0xcd59('0x11')],'action':'originate','channel':_0x20cc71[_0xcd59('0x12')],'Exten':_0xcd59('0x13'),'Context':_0xcd59('0x14'),'Priority':'1','callerid':util[_0xcd59('0x15')](_0xcd59('0x16'),_0x20cc71['headerinfo']?_0x20cc71[_0xcd59('0x8')]:'',_0x20cc71[_0xcd59('0xe')]),'variable':_0x391dee,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x20cc71[_0xcd59('0x11')]};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index 974621f..aaf3324 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 _0x39a3=['getDeskAccounts','initDeskAccounts','getZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','initFaxAccounts','getVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getCampaignHopperHistory','getVoiceCallReports','catch','log','listen','sync','bluebird','util','moment','./server','./realtime','./report','./acw','./trigger','./dialer','./preview','./fax','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/trunk','./rpc/template','./rpc/cmHopperHistory','./rpc/voiceExtension','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','get','hour','then','initAgents','getTelephones','initTelephones','getTrunks','initTrunks','getTriggers','initTriggers','getTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts'];(function(_0x1f27df,_0x4f1a64){var _0x286ee2=function(_0x255ea7){while(--_0x255ea7){_0x1f27df['push'](_0x1f27df['shift']());}};_0x286ee2(++_0x4f1a64);}(_0x39a3,0x117));var _0x339a=function(_0x39428c,_0x34b23a){_0x39428c=_0x39428c-0x0;var _0x52d069=_0x39a3[_0x39428c];return _0x52d069;};'use strict';var BPromise=require(_0x339a('0x0'));var util=require(_0x339a('0x1'));var moment=require(_0x339a('0x2'));var server=require(_0x339a('0x3'));var Realtime=require(_0x339a('0x4'));var Report=require(_0x339a('0x5'));var Acw=require(_0x339a('0x6'));var Trigger=require(_0x339a('0x7'));var Dialer=require(_0x339a('0x8'));var Preview=require(_0x339a('0x9'));var Fax=require(_0x339a('0xa'));var user=require('./rpc/user');var voiceQueue=require(_0x339a('0xb'));var voiceQueueReport=require(_0x339a('0xc'));var voiceCallReport=require('./rpc/voiceCallReport');var trunk=require(_0x339a('0xd'));var trigger=require('./rpc/trigger');var template=require(_0x339a('0xe'));var cmHopperHistory=require(_0x339a('0xf'));var campaign=require('./rpc/campaign');var voiceExtension=require(_0x339a('0x10'));var faxAccount=require('./rpc/faxAccount');var zendesk=require(_0x339a('0x11'));var salesforce=require(_0x339a('0x12'));var sugarcrm=require('./rpc/integrations/sugarcrm');var freshdesk=require('./rpc/integrations/freshdesk');var desk=require('./rpc/integrations/desk');var zoho=require('./rpc/integrations/zoho');var vtiger=require('./rpc/integrations/vtiger');var freshsales=require(_0x339a('0x13'));var servicenow=require(_0x339a('0x14'));var dynamics365=require(_0x339a('0x15'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()['get']('hour')===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x339a('0x16')](_0x339a('0x17'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise['resolve']()['then'](user['getAgents']())[_0x339a('0x18')](realtime[_0x339a('0x19')]())[_0x339a('0x18')](user[_0x339a('0x1a')]())[_0x339a('0x18')](realtime[_0x339a('0x1b')]())['then'](trunk[_0x339a('0x1c')]())[_0x339a('0x18')](realtime[_0x339a('0x1d')]())[_0x339a('0x18')](voiceQueue['getVoiceQueues']())[_0x339a('0x18')](realtime['initVoiceQueues']())[_0x339a('0x18')](trigger[_0x339a('0x1e')]())[_0x339a('0x18')](realtime[_0x339a('0x1f')]())['then'](template[_0x339a('0x20')]())[_0x339a('0x18')](realtime['initTemplates']())[_0x339a('0x18')](zendesk[_0x339a('0x21')]())[_0x339a('0x18')](realtime[_0x339a('0x22')]())[_0x339a('0x18')](salesforce[_0x339a('0x23')]())[_0x339a('0x18')](realtime[_0x339a('0x24')]())['then'](sugarcrm[_0x339a('0x25')]())[_0x339a('0x18')](realtime[_0x339a('0x26')]())[_0x339a('0x18')](freshdesk[_0x339a('0x27')]())[_0x339a('0x18')](realtime[_0x339a('0x28')]())[_0x339a('0x18')](desk[_0x339a('0x29')]())['then'](realtime[_0x339a('0x2a')]())[_0x339a('0x18')](zoho[_0x339a('0x2b')]())['then'](realtime['initZohoAccounts']())[_0x339a('0x18')](vtiger[_0x339a('0x2c')]())[_0x339a('0x18')](realtime[_0x339a('0x2d')]())['then'](freshsales[_0x339a('0x2e')]())[_0x339a('0x18')](realtime[_0x339a('0x2f')]())['then'](servicenow[_0x339a('0x30')]())[_0x339a('0x18')](realtime[_0x339a('0x31')]())[_0x339a('0x18')](dynamics365[_0x339a('0x32')]())[_0x339a('0x18')](realtime['initDynamics365Accounts']())[_0x339a('0x18')](campaign['getCampaigns']())[_0x339a('0x18')](realtime['initCampaigns']())[_0x339a('0x18')](voiceExtension[_0x339a('0x33')]())[_0x339a('0x18')](realtime[_0x339a('0x34')]())['then'](faxAccount[_0x339a('0x35')]())[_0x339a('0x18')](realtime[_0x339a('0x36')]())[_0x339a('0x18')](function(){return realtime;});}function initParams(){return BPromise['resolve']()['then'](voiceQueueReport[_0x339a('0x37')]())['then'](realtime['initVoiceQueueReports']())[_0x339a('0x18')](cmHopperHistory[_0x339a('0x38')]())[_0x339a('0x18')](realtime[_0x339a('0x39')]())[_0x339a('0x18')](cmHopperHistory[_0x339a('0x3a')]())['then'](realtime['initCampaignHopperHistory']())[_0x339a('0x18')](voiceCallReport[_0x339a('0x3b')]())[_0x339a('0x18')](realtime['initVoiceCallReports']())['then'](function(_0x4ba1d5){})[_0x339a('0x3c')](function(_0x14ab9a){console[_0x339a('0x3d')](_0x14ab9a);});}function main(){return server[_0x339a('0x3e')](realtime,preview,fax)[_0x339a('0x18')](function(_0x10eda6){return initRealtime();})[_0x339a('0x18')](function(){return initParams();})['then'](function(){report[_0x339a('0x3f')]();setInterval(initRealtime,0x1388);})['catch'](function(_0x1036b2){console[_0x339a('0x3d')](_0x1036b2);});}main(); \ No newline at end of file +var _0x4837=['getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','initVoiceExtensions','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','log','listen','sync','util','moment','./server','./realtime','./acw','./dialer','./preview','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/faxAccount','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','get','hour','resolve','then','getAgents','initAgents','getTelephones','initTelephones','initTrunks','getVoiceQueues','initVoiceQueues','getTriggers','initTriggers','getTemplates','initTemplates','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts'];(function(_0x279de9,_0x325dbb){var _0x37c059=function(_0x317054){while(--_0x317054){_0x279de9['push'](_0x279de9['shift']());}};_0x37c059(++_0x325dbb);}(_0x4837,0x128));var _0x7483=function(_0x1b4cc9,_0x413f3b){_0x1b4cc9=_0x1b4cc9-0x0;var _0xae7f27=_0x4837[_0x1b4cc9];return _0xae7f27;};'use strict';var BPromise=require('bluebird');var util=require(_0x7483('0x0'));var moment=require(_0x7483('0x1'));var server=require(_0x7483('0x2'));var Realtime=require(_0x7483('0x3'));var Report=require('./report');var Acw=require(_0x7483('0x4'));var Trigger=require('./trigger');var Dialer=require(_0x7483('0x5'));var Preview=require(_0x7483('0x6'));var Fax=require('./fax');var user=require(_0x7483('0x7'));var voiceQueue=require(_0x7483('0x8'));var voiceQueueReport=require(_0x7483('0x9'));var voiceCallReport=require(_0x7483('0xa'));var trunk=require(_0x7483('0xb'));var trigger=require(_0x7483('0xc'));var template=require(_0x7483('0xd'));var cmHopperHistory=require(_0x7483('0xe'));var campaign=require(_0x7483('0xf'));var voiceExtension=require('./rpc/voiceExtension');var faxAccount=require(_0x7483('0x10'));var zendesk=require('./rpc/integrations/zendesk');var salesforce=require('./rpc/integrations/salesforce');var sugarcrm=require(_0x7483('0x11'));var freshdesk=require(_0x7483('0x12'));var desk=require(_0x7483('0x13'));var zoho=require(_0x7483('0x14'));var vtiger=require(_0x7483('0x15'));var freshsales=require('./rpc/integrations/freshsales');var servicenow=require(_0x7483('0x16'));var dynamics365=require(_0x7483('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()[_0x7483('0x18')](_0x7483('0x19'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()['get'](_0x7483('0x19'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0x7483('0x1a')]()[_0x7483('0x1b')](user[_0x7483('0x1c')]())['then'](realtime[_0x7483('0x1d')]())['then'](user[_0x7483('0x1e')]())[_0x7483('0x1b')](realtime[_0x7483('0x1f')]())[_0x7483('0x1b')](trunk['getTrunks']())['then'](realtime[_0x7483('0x20')]())[_0x7483('0x1b')](voiceQueue[_0x7483('0x21')]())['then'](realtime[_0x7483('0x22')]())[_0x7483('0x1b')](trigger[_0x7483('0x23')]())[_0x7483('0x1b')](realtime[_0x7483('0x24')]())[_0x7483('0x1b')](template[_0x7483('0x25')]())[_0x7483('0x1b')](realtime[_0x7483('0x26')]())[_0x7483('0x1b')](zendesk['getZendeskAccounts']())['then'](realtime[_0x7483('0x27')]())[_0x7483('0x1b')](salesforce[_0x7483('0x28')]())[_0x7483('0x1b')](realtime[_0x7483('0x29')]())[_0x7483('0x1b')](sugarcrm[_0x7483('0x2a')]())['then'](realtime[_0x7483('0x2b')]())['then'](freshdesk[_0x7483('0x2c')]())['then'](realtime[_0x7483('0x2d')]())[_0x7483('0x1b')](desk[_0x7483('0x2e')]())[_0x7483('0x1b')](realtime['initDeskAccounts']())[_0x7483('0x1b')](zoho[_0x7483('0x2f')]())[_0x7483('0x1b')](realtime[_0x7483('0x30')]())[_0x7483('0x1b')](vtiger[_0x7483('0x31')]())[_0x7483('0x1b')](realtime[_0x7483('0x32')]())['then'](freshsales[_0x7483('0x33')]())['then'](realtime['initFreshsalesAccounts']())[_0x7483('0x1b')](servicenow[_0x7483('0x34')]())['then'](realtime[_0x7483('0x35')]())[_0x7483('0x1b')](dynamics365[_0x7483('0x36')]())['then'](realtime[_0x7483('0x37')]())[_0x7483('0x1b')](campaign[_0x7483('0x38')]())[_0x7483('0x1b')](realtime[_0x7483('0x39')]())[_0x7483('0x1b')](voiceExtension[_0x7483('0x3a')]())['then'](realtime[_0x7483('0x3b')]())[_0x7483('0x1b')](faxAccount['getFaxAccounts']())[_0x7483('0x1b')](realtime['initFaxAccounts']())[_0x7483('0x1b')](function(){return realtime;});}function initParams(){return BPromise[_0x7483('0x1a')]()[_0x7483('0x1b')](voiceQueueReport['getVoiceQueueReports']())[_0x7483('0x1b')](realtime['initVoiceQueueReports']())[_0x7483('0x1b')](cmHopperHistory[_0x7483('0x3c')]())[_0x7483('0x1b')](realtime[_0x7483('0x3d')]())[_0x7483('0x1b')](cmHopperHistory[_0x7483('0x3e')]())[_0x7483('0x1b')](realtime[_0x7483('0x3f')]())[_0x7483('0x1b')](voiceCallReport[_0x7483('0x40')]())[_0x7483('0x1b')](realtime[_0x7483('0x41')]())[_0x7483('0x1b')](function(_0xa50567){})[_0x7483('0x42')](function(_0x314a13){console[_0x7483('0x43')](_0x314a13);});}function main(){return server[_0x7483('0x44')](realtime,preview,fax)[_0x7483('0x1b')](function(_0x1adda8){return initRealtime();})[_0x7483('0x1b')](function(){return initParams();})['then'](function(){report[_0x7483('0x45')]();setInterval(initRealtime,0x1388);})[_0x7483('0x42')](function(_0x376c60){console[_0x7483('0x43')](_0x376c60);});}main(); \ No newline at end of file diff --git a/server/services/ami/model/agent.js b/server/services/ami/model/agent.js index 812a377..f187ab3 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 _0xedd9=['phone','mobile','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','onhold','prototype','updateStatusRealtime','state','toLowerCase','idle','inuse','talking','statePause','toNumber','interface','format','user:%s','user:save','emit','user:presence','exports','util','moment','md5','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','email','accountcode','fullname','unknown','status'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0xedd9,0xfc));var _0x9edd=function(_0x59686d,_0x1225bd){_0x59686d=_0x59686d-0x0;var _0x5e941e=_0xedd9[_0x59686d];return _0x5e941e;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var moment=require(_0x9edd('0x1'));var md5=require(_0x9edd('0x2'));var Redis=require(_0x9edd('0x3'));var config=require(_0x9edd('0x4'));config[_0x9edd('0x5')]=_[_0x9edd('0x6')](config[_0x9edd('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x9edd('0x7'))(new Redis(config[_0x9edd('0x5')]));function Agent(_0x268f9e){this['id']=_0x268f9e['id']||0x0;this[_0x9edd('0x8')]=_0x268f9e['name']||'';this[_0x9edd('0x9')]=_0x268f9e['email']||'';this[_0x9edd('0xa')]=_0x268f9e[_0x9edd('0xa')]||'';this[_0x9edd('0xb')]=_0x268f9e[_0x9edd('0xb')]||'';this['state']=_0x9edd('0xc');this['stateTime']=0x0;this[_0x9edd('0xd')]=_0x9edd('0xc');this['address']='';this[_0x9edd('0xe')]='';this[_0x9edd('0xf')]='';this['interface']='';this[_0x9edd('0x10')]=_0x268f9e[_0x9edd('0x10')]||![];this[_0x9edd('0x11')]=_0x9edd('0xc');this[_0x9edd('0x12')]=0x0;this[_0x9edd('0x13')]='';this[_0x9edd('0x14')]='';this[_0x9edd('0x15')]=![];this['local']=![];this[_0x9edd('0x2')]='';}Agent[_0x9edd('0x16')][_0x9edd('0x17')]=function(_0x4d9a7){var _0x13b6b6;if(_0x4d9a7&&_0x4d9a7[_0x9edd('0x18')]){_0x13b6b6=_0x4d9a7[_0x9edd('0x18')][_0x9edd('0x19')]();switch(_0x13b6b6){case'not_inuse':_0x13b6b6=_0x9edd('0x1a');break;case _0x9edd('0x1b'):_0x13b6b6=_0x9edd('0x1c');break;}}if(_0x13b6b6&&this['voiceStatus']!==_0x13b6b6||_0x4d9a7[_0x9edd('0x1d')]){this[_0x9edd('0x12')]=_[_0x9edd('0x1e')](moment()['format']('x'));}if(_0x13b6b6){this[_0x9edd('0x11')]=_0x13b6b6;}var _0x5d879c={'id':this['id'],'name':this[_0x9edd('0x8')],'email':this[_0x9edd('0x9')],'accountcode':this['accountcode'],'fullname':this['fullname'],'state':this[_0x9edd('0x18')],'stateTime':this['stateTime'],'status':this[_0x9edd('0xd')],'address':this['address'],'online':this['online'],'voiceStatus':this[_0x9edd('0x11')],'voiceStatusTime':this[_0x9edd('0x12')],'voiceStatusCallerIdNumber':this['voiceStatusCallerIdNumber'],'voiceStatusQueue':this['voiceStatusQueue'],'interface':this[_0x9edd('0x1f')],'onhold':this[_0x9edd('0x15')]};var _0x477878=md5(JSON['stringify'](_0x5d879c));if(this[_0x9edd('0x2')]!==_0x477878){this[_0x9edd('0x2')]=_0x477878;io['to'](util[_0x9edd('0x20')](_0x9edd('0x21'),_0x5d879c[_0x9edd('0x8')]))['emit'](_0x9edd('0x22'),_0x5d879c);io[_0x9edd('0x23')](_0x9edd('0x24'),_0x5d879c);}};module[_0x9edd('0x25')]=Agent; \ No newline at end of file +var _0x0713=['idle','inuse','talking','voiceStatusTime','toNumber','format','voiceStatusQueue','stringify','user:%s','emit','user:save','user:presence','exports','moment','md5','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','email','accountcode','fullname','unknown','stateTime','status','address','mobile','interface','online','voiceStatus','voiceStatusCallerIdNumber','onhold','local','prototype','state','toLowerCase','not_inuse'];(function(_0xd2b73e,_0x661b02){var _0x49bec8=function(_0x2f1dae){while(--_0x2f1dae){_0xd2b73e['push'](_0xd2b73e['shift']());}};_0x49bec8(++_0x661b02);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3071('0x0'));var md5=require(_0x3071('0x1'));var Redis=require(_0x3071('0x2'));var config=require(_0x3071('0x3'));config[_0x3071('0x4')]=_['defaults'](config[_0x3071('0x4')],{'host':_0x3071('0x5'),'port':0x18eb});var io=require(_0x3071('0x6'))(new Redis(config[_0x3071('0x4')]));function Agent(_0xabd7b6){this['id']=_0xabd7b6['id']||0x0;this[_0x3071('0x7')]=_0xabd7b6[_0x3071('0x7')]||'';this[_0x3071('0x8')]=_0xabd7b6[_0x3071('0x8')]||'';this[_0x3071('0x9')]=_0xabd7b6[_0x3071('0x9')]||'';this[_0x3071('0xa')]=_0xabd7b6[_0x3071('0xa')]||'';this['state']=_0x3071('0xb');this[_0x3071('0xc')]=0x0;this[_0x3071('0xd')]=_0x3071('0xb');this[_0x3071('0xe')]='';this['phone']='';this[_0x3071('0xf')]='';this[_0x3071('0x10')]='';this[_0x3071('0x11')]=_0xabd7b6[_0x3071('0x11')]||![];this[_0x3071('0x12')]='unknown';this['voiceStatusTime']=0x0;this[_0x3071('0x13')]='';this['voiceStatusQueue']='';this[_0x3071('0x14')]=![];this[_0x3071('0x15')]=![];this['md5']='';}Agent[_0x3071('0x16')]['updateStatusRealtime']=function(_0x2fc15d){var _0x45c93b;if(_0x2fc15d&&_0x2fc15d[_0x3071('0x17')]){_0x45c93b=_0x2fc15d[_0x3071('0x17')][_0x3071('0x18')]();switch(_0x45c93b){case _0x3071('0x19'):_0x45c93b=_0x3071('0x1a');break;case _0x3071('0x1b'):_0x45c93b=_0x3071('0x1c');break;}}if(_0x45c93b&&this[_0x3071('0x12')]!==_0x45c93b||_0x2fc15d['statePause']){this[_0x3071('0x1d')]=_[_0x3071('0x1e')](moment()[_0x3071('0x1f')]('x'));}if(_0x45c93b){this[_0x3071('0x12')]=_0x45c93b;}var _0x3acf0e={'id':this['id'],'name':this[_0x3071('0x7')],'email':this[_0x3071('0x8')],'accountcode':this[_0x3071('0x9')],'fullname':this['fullname'],'state':this[_0x3071('0x17')],'stateTime':this[_0x3071('0xc')],'status':this[_0x3071('0xd')],'address':this['address'],'online':this[_0x3071('0x11')],'voiceStatus':this['voiceStatus'],'voiceStatusTime':this[_0x3071('0x1d')],'voiceStatusCallerIdNumber':this[_0x3071('0x13')],'voiceStatusQueue':this[_0x3071('0x20')],'interface':this[_0x3071('0x10')],'onhold':this[_0x3071('0x14')]};var _0x34c50e=md5(JSON[_0x3071('0x21')](_0x3acf0e));if(this[_0x3071('0x1')]!==_0x34c50e){this['md5']=_0x34c50e;io['to'](util['format'](_0x3071('0x22'),_0x3acf0e[_0x3071('0x7')]))[_0x3071('0x23')](_0x3071('0x24'),_0x3acf0e);io[_0x3071('0x23')](_0x3071('0x25'),_0x3acf0e);}};module[_0x3071('0x26')]=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index cbb0d10..70f8968 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 _0x2f01=['sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','campaign','originated','temp','ivrTotalCallsDays','message'];(function(_0x519cb2,_0x3f0214){var _0x40e6f9=function(_0x3ef852){while(--_0x3ef852){_0x519cb2['push'](_0x519cb2['shift']());}};_0x40e6f9(++_0x3f0214);}(_0x2f01,0x192));var _0x12f0=function(_0x384c37,_0x4d6411){_0x384c37=_0x384c37-0x0;var _0x112ac0=_0x2f01[_0x384c37];return _0x112ac0;};'use strict';function Campaign(_0x2edbc4){this['id']=_0x2edbc4['id']||0x0;this[_0x12f0('0x0')]=_0x2edbc4['name']||'';this['type']=_0x2edbc4['type']||_0x12f0('0x1');this[_0x12f0('0x2')]=0x0;this[_0x12f0('0x3')]=0x0;this['ivrAnswerCallsDay']=0x0;this[_0x12f0('0x4')]=0x0;this[_0x12f0('0x5')]='';this[_0x12f0('0x6')]=!![];this[_0x12f0('0x7')]=_0x2edbc4[_0x12f0('0x7')];this[_0x12f0('0x8')]=_0x2edbc4[_0x12f0('0x8')];this[_0x12f0('0x9')]=_0x2edbc4[_0x12f0('0x9')]||null;this[_0x12f0('0xa')]=_0x2edbc4[_0x12f0('0xa')]?_0x2edbc4['dialGlobalInterval']:null;this[_0x12f0('0xb')]=_0x2edbc4['dialOriginateCallerIdName'];this[_0x12f0('0xc')]=_0x2edbc4[_0x12f0('0xc')];this[_0x12f0('0xd')]=_0x2edbc4[_0x12f0('0xd')]||0x1e;this[_0x12f0('0xe')]=_0x2edbc4[_0x12f0('0xe')];this[_0x12f0('0xf')]=_0x2edbc4['dialCongestionRetryFrequency'];this[_0x12f0('0x10')]=_0x2edbc4[_0x12f0('0x10')];this[_0x12f0('0x11')]=_0x2edbc4[_0x12f0('0x11')];this[_0x12f0('0x12')]=_0x2edbc4[_0x12f0('0x12')];this[_0x12f0('0x13')]=_0x2edbc4['dialNoAnswerRetryFrequency'];this[_0x12f0('0x14')]=_0x2edbc4[_0x12f0('0x14')];this[_0x12f0('0x15')]=_0x2edbc4[_0x12f0('0x15')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0x2edbc4[_0x12f0('0x16')]||0x96;this[_0x12f0('0x17')]=_0x2edbc4[_0x12f0('0x17')]||0x3;this[_0x12f0('0x18')]=_0x2edbc4[_0x12f0('0x18')]||0x96;this[_0x12f0('0x19')]=_0x2edbc4[_0x12f0('0x19')]||0x3;this[_0x12f0('0x1a')]=_0x2edbc4[_0x12f0('0x1a')]||0x96;this[_0x12f0('0x1b')]=_0x2edbc4[_0x12f0('0x1b')]||0x3;this[_0x12f0('0x1c')]=_0x2edbc4[_0x12f0('0x1c')]||0x96;this[_0x12f0('0x1d')]=_0x2edbc4[_0x12f0('0x1d')]||0x3;this['dialAgentRejectRetryFrequency']=_0x2edbc4[_0x12f0('0x1e')]||0x96;this[_0x12f0('0x1f')]=_0x2edbc4[_0x12f0('0x1f')]||'DESC';this[_0x12f0('0x20')]=_0x2edbc4['dialPrefix']||undefined;this[_0x12f0('0x21')]=_0x2edbc4[_0x12f0('0x21')]||undefined;this[_0x12f0('0x22')]=_0x2edbc4[_0x12f0('0x22')]||undefined;this[_0x12f0('0x23')]=_0x2edbc4[_0x12f0('0x23')]?_0x2edbc4[_0x12f0('0x23')]:undefined;this['Trunk']=_0x2edbc4[_0x12f0('0x24')]?_0x2edbc4['Trunk']:undefined;this['Interval']=_0x2edbc4['Interval']?_0x2edbc4[_0x12f0('0x25')]:undefined;this[_0x12f0('0x26')]=_0x2edbc4[_0x12f0('0x26')]?_0x2edbc4[_0x12f0('0x26')]:undefined;this[_0x12f0('0x27')]=_0x2edbc4[_0x12f0('0x26')]?_0x2edbc4[_0x12f0('0x26')][_0x12f0('0x0')]:undefined;this['dialAMDActive']=_0x2edbc4[_0x12f0('0x28')]||![];this['dialAMDInitialSilence']=_0x2edbc4[_0x12f0('0x29')];this['dialAMDGreeting']=_0x2edbc4[_0x12f0('0x2a')];this[_0x12f0('0x2b')]=_0x2edbc4[_0x12f0('0x2b')];this[_0x12f0('0x2c')]=_0x2edbc4['dialAMDTotalAnalysisTime'];this[_0x12f0('0x2d')]=_0x2edbc4[_0x12f0('0x2d')];this['dialAMDBetweenWordsSilence']=_0x2edbc4[_0x12f0('0x2e')];this[_0x12f0('0x2f')]=_0x2edbc4['dialAMDMaximumNumberOfWords'];this[_0x12f0('0x30')]=_0x2edbc4[_0x12f0('0x30')];this['dialAMDMaximumWordLength']=_0x2edbc4[_0x12f0('0x31')];}module[_0x12f0('0x32')]=Campaign; \ No newline at end of file +var _0x47ac=['temp','ivrTotalCallsDays','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','originated'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x47ac,0xc4));var _0xc47a=function(_0x15ed39,_0x3778e9){_0x15ed39=_0x15ed39-0x0;var _0x14b681=_0x47ac[_0x15ed39];return _0x14b681;};'use strict';function Campaign(_0xddb1ce){this['id']=_0xddb1ce['id']||0x0;this[_0xc47a('0x0')]=_0xddb1ce[_0xc47a('0x0')]||'';this[_0xc47a('0x1')]=_0xddb1ce[_0xc47a('0x1')]||_0xc47a('0x2');this[_0xc47a('0x3')]=0x0;this[_0xc47a('0x4')]=0x0;this['ivrAnswerCallsDay']=0x0;this[_0xc47a('0x5')]=0x0;this[_0xc47a('0x6')]='';this[_0xc47a('0x7')]=!![];this[_0xc47a('0x8')]=_0xddb1ce['active'];this[_0xc47a('0x9')]=_0xddb1ce[_0xc47a('0x9')];this[_0xc47a('0xa')]=_0xddb1ce['dialTimezone']||null;this[_0xc47a('0xb')]=_0xddb1ce['dialGlobalInterval']?_0xddb1ce['dialGlobalInterval']:null;this[_0xc47a('0xc')]=_0xddb1ce['dialOriginateCallerIdName'];this['dialOriginateCallerIdNumber']=_0xddb1ce['dialOriginateCallerIdNumber'];this[_0xc47a('0xd')]=_0xddb1ce[_0xc47a('0xd')]||0x1e;this[_0xc47a('0xe')]=_0xddb1ce['dialCongestionMaxRetry'];this[_0xc47a('0xf')]=_0xddb1ce[_0xc47a('0xf')];this[_0xc47a('0x10')]=_0xddb1ce['dialBusyMaxRetry'];this['dialBusyRetryFrequency']=_0xddb1ce[_0xc47a('0x11')];this['dialNoAnswerMaxRetry']=_0xddb1ce[_0xc47a('0x12')];this[_0xc47a('0x13')]=_0xddb1ce[_0xc47a('0x13')];this[_0xc47a('0x14')]=_0xddb1ce[_0xc47a('0x14')];this['dialNoSuchNumberMaxRetry']=_0xddb1ce[_0xc47a('0x15')]||0x3;this[_0xc47a('0x16')]=_0xddb1ce[_0xc47a('0x16')]||0x96;this[_0xc47a('0x17')]=_0xddb1ce[_0xc47a('0x17')]||0x3;this['dialDropRetryFrequency']=_0xddb1ce[_0xc47a('0x18')]||0x96;this[_0xc47a('0x19')]=_0xddb1ce[_0xc47a('0x19')]||0x3;this[_0xc47a('0x1a')]=_0xddb1ce['dialAbandonedRetryFrequency']||0x96;this['dialMachineMaxRetry']=_0xddb1ce['dialMachineMaxRetry']||0x3;this['dialMachineRetryFrequency']=_0xddb1ce[_0xc47a('0x1b')]||0x96;this[_0xc47a('0x1c')]=_0xddb1ce[_0xc47a('0x1c')]||0x3;this['dialAgentRejectRetryFrequency']=_0xddb1ce[_0xc47a('0x1d')]||0x96;this[_0xc47a('0x1e')]=_0xddb1ce[_0xc47a('0x1e')]||_0xc47a('0x1f');this[_0xc47a('0x20')]=_0xddb1ce[_0xc47a('0x20')]||undefined;this['dialRandomLastDigitCallerIdNumber']=_0xddb1ce['dialRandomLastDigitCallerIdNumber']||undefined;this[_0xc47a('0x21')]=_0xddb1ce[_0xc47a('0x21')]||undefined;this[_0xc47a('0x22')]=_0xddb1ce[_0xc47a('0x22')]?_0xddb1ce['TrunkBackup']:undefined;this[_0xc47a('0x23')]=_0xddb1ce['Trunk']?_0xddb1ce['Trunk']:undefined;this[_0xc47a('0x24')]=_0xddb1ce[_0xc47a('0x24')]?_0xddb1ce['Interval']:undefined;this[_0xc47a('0x25')]=_0xddb1ce[_0xc47a('0x25')]?_0xddb1ce[_0xc47a('0x25')]:undefined;this[_0xc47a('0x26')]=_0xddb1ce[_0xc47a('0x25')]?_0xddb1ce[_0xc47a('0x25')][_0xc47a('0x0')]:undefined;this[_0xc47a('0x27')]=_0xddb1ce['dialAMDActive']||![];this[_0xc47a('0x28')]=_0xddb1ce[_0xc47a('0x28')];this[_0xc47a('0x29')]=_0xddb1ce[_0xc47a('0x29')];this[_0xc47a('0x2a')]=_0xddb1ce['dialAMDAfterGreetingSilence'];this[_0xc47a('0x2b')]=_0xddb1ce[_0xc47a('0x2b')];this[_0xc47a('0x2c')]=_0xddb1ce[_0xc47a('0x2c')];this[_0xc47a('0x2d')]=_0xddb1ce['dialAMDBetweenWordsSilence'];this[_0xc47a('0x2e')]=_0xddb1ce[_0xc47a('0x2e')];this[_0xc47a('0x2f')]=_0xddb1ce[_0xc47a('0x2f')];this['dialAMDMaximumWordLength']=_0xddb1ce[_0xc47a('0x30')];}module[_0xc47a('0x31')]=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index 5f54f03..eada57d 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 _0x1a0a=['exports','starttime','destinationchannel','calleridnum','connectedlinenum','connectedlinename','context','uniqueid','linkedid','exten','answered','answertime','endtime','unmanaged','abandoned','lastapplication','lastdata','billableseconds','type','disposition','monitor','monitorFilename','queue','monitors','transfercalleridnum','transferconnectedlinenum','mohtime'];(function(_0x186e7c,_0x542c10){var _0x1715e3=function(_0x165e08){while(--_0x165e08){_0x186e7c['push'](_0x186e7c['shift']());}};_0x1715e3(++_0x542c10);}(_0x1a0a,0x196));var _0xa1a0=function(_0x54fe4e,_0x153ebc){_0x54fe4e=_0x54fe4e-0x0;var _0x21ceae=_0x1a0a[_0x54fe4e];return _0x21ceae;};'use strict';function Channel(){this[_0xa1a0('0x0')]=null;this['channel']='';this[_0xa1a0('0x1')]='';this[_0xa1a0('0x2')]=0x0;this['calleridname']='';this[_0xa1a0('0x3')]=undefined;this[_0xa1a0('0x4')]=undefined;this['accountcode']=0x0;this[_0xa1a0('0x5')]='';this[_0xa1a0('0x6')]=0x0;this[_0xa1a0('0x7')]=0x0;this[_0xa1a0('0x8')]=0x0;this[_0xa1a0('0x9')]=![];this[_0xa1a0('0xa')]=null;this[_0xa1a0('0xb')]=null;this[_0xa1a0('0xc')]=![];this[_0xa1a0('0xd')]=![];this[_0xa1a0('0xe')]='';this[_0xa1a0('0xf')]='';this['duration']=0x0;this[_0xa1a0('0x10')]=0x0;this['holdtime']=0x0;this[_0xa1a0('0x11')]=null;this['tag']=null;this[_0xa1a0('0x12')]=null;this[_0xa1a0('0x13')]=![];this[_0xa1a0('0x14')]=null;this[_0xa1a0('0x15')]=null;this[_0xa1a0('0x16')]=[];this[_0xa1a0('0x17')]=undefined;this[_0xa1a0('0x18')]=undefined;this['transferType']=undefined;this[_0xa1a0('0x19')]=0x0;}module[_0xa1a0('0x1a')]=Channel; \ No newline at end of file +var _0x1691=['endtime','abandoned','lastapplication','duration','billableseconds','holdtime','type','tag','monitor','monitorFilename','monitors','transferconnectedlinenum','transferType','starttime','channel','calleridnum','calleridname','connectedlinenum','connectedlinename','accountcode','context','uniqueid','linkedid','answered'];(function(_0x3d15be,_0x3453fe){var _0x240f80=function(_0x5f4ec5){while(--_0x5f4ec5){_0x3d15be['push'](_0x3d15be['shift']());}};_0x240f80(++_0x3453fe);}(_0x1691,0x1ed));var _0x1169=function(_0x119d13,_0x263cd2){_0x119d13=_0x119d13-0x0;var _0x333c35=_0x1691[_0x119d13];return _0x333c35;};'use strict';function Channel(){this[_0x1169('0x0')]=null;this[_0x1169('0x1')]='';this['destinationchannel']='';this[_0x1169('0x2')]=0x0;this[_0x1169('0x3')]='';this[_0x1169('0x4')]=undefined;this[_0x1169('0x5')]=undefined;this[_0x1169('0x6')]=0x0;this[_0x1169('0x7')]='';this[_0x1169('0x8')]=0x0;this[_0x1169('0x9')]=0x0;this['exten']=0x0;this[_0x1169('0xa')]=![];this['answertime']=null;this[_0x1169('0xb')]=null;this['unmanaged']=![];this[_0x1169('0xc')]=![];this[_0x1169('0xd')]='';this['lastdata']='';this[_0x1169('0xe')]=0x0;this[_0x1169('0xf')]=0x0;this[_0x1169('0x10')]=0x0;this[_0x1169('0x11')]=null;this[_0x1169('0x12')]=null;this['disposition']=null;this[_0x1169('0x13')]=![];this[_0x1169('0x14')]=null;this['queue']=null;this[_0x1169('0x15')]=[];this['transfercalleridnum']=undefined;this[_0x1169('0x16')]=undefined;this[_0x1169('0x17')]=undefined;this['mohtime']=0x0;}module['exports']=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index 6560bdd..9bfeebe 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 _0x3b68=['Configurations','name','username','remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl'];(function(_0x1059b0,_0x2cca83){var _0x5f21ed=function(_0x5c616a){while(--_0x5c616a){_0x1059b0['push'](_0x1059b0['shift']());}};_0x5f21ed(++_0x2cca83);}(_0x3b68,0x151));var _0x83b6=function(_0x4af9af,_0x1c7087){_0x4af9af=_0x4af9af-0x0;var _0x5ed61d=_0x3b68[_0x4af9af];return _0x5ed61d;};'use strict';function DeskAccount(_0xc207f9){this['id']=_0xc207f9['id']||0x0;this[_0x83b6('0x0')]=_0xc207f9[_0x83b6('0x0')]||'';this[_0x83b6('0x1')]=_0xc207f9['username']||'';this[_0x83b6('0x2')]=_0xc207f9[_0x83b6('0x2')]||'';this[_0x83b6('0x3')]=_0xc207f9[_0x83b6('0x3')]||'';this['password']=_0xc207f9[_0x83b6('0x4')]||'';this[_0x83b6('0x5')]=_0xc207f9['consumerKey']||'';this[_0x83b6('0x6')]=_0xc207f9['consumerSecret']||'';this[_0x83b6('0x7')]=_0xc207f9[_0x83b6('0x7')]||'';this[_0x83b6('0x8')]=_0xc207f9[_0x83b6('0x8')]||'';this[_0x83b6('0x9')]=_0xc207f9[_0x83b6('0x9')]||'';this[_0x83b6('0xa')]=_0xc207f9[_0x83b6('0xa')]||'';this[_0x83b6('0xb')]=_0xc207f9[_0x83b6('0xb')]||{};}module['exports']=DeskAccount; \ No newline at end of file +var _0x03a8=['token','tokenSecret','type','serverUrl','name','username','remoteUri','authType','password','consumerKey','consumerSecret'];(function(_0xbde34a,_0x50dc9b){var _0x31d11d=function(_0x595ad3){while(--_0x595ad3){_0xbde34a['push'](_0xbde34a['shift']());}};_0x31d11d(++_0x50dc9b);}(_0x03a8,0x138));var _0x803a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x03a8[_0x3dd15e];return _0x231fd0;};'use strict';function DeskAccount(_0x3c2bb2){this['id']=_0x3c2bb2['id']||0x0;this[_0x803a('0x0')]=_0x3c2bb2[_0x803a('0x0')]||'';this[_0x803a('0x1')]=_0x3c2bb2[_0x803a('0x1')]||'';this[_0x803a('0x2')]=_0x3c2bb2[_0x803a('0x2')]||'';this[_0x803a('0x3')]=_0x3c2bb2[_0x803a('0x3')]||'';this[_0x803a('0x4')]=_0x3c2bb2[_0x803a('0x4')]||'';this['consumerKey']=_0x3c2bb2[_0x803a('0x5')]||'';this[_0x803a('0x6')]=_0x3c2bb2[_0x803a('0x6')]||'';this['token']=_0x3c2bb2[_0x803a('0x7')]||'';this['tokenSecret']=_0x3c2bb2[_0x803a('0x8')]||'';this[_0x803a('0x9')]=_0x3c2bb2['type']||'';this['serverUrl']=_0x3c2bb2[_0x803a('0xa')]||'';this['Configurations']=_0x3c2bb2['Configurations']||{};}module['exports']=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index d0cab9b..bd0e8be 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 _0x9354=['name','username','password','remoteUri','tenantId','clientId','clientSecret','serverUrl','Configurations','exports'];(function(_0x3b8bb8,_0xdaeeb6){var _0x272397=function(_0x1a1e89){while(--_0x1a1e89){_0x3b8bb8['push'](_0x3b8bb8['shift']());}};_0x272397(++_0xdaeeb6);}(_0x9354,0x96));var _0x4935=function(_0x2dacca,_0x3b55a5){_0x2dacca=_0x2dacca-0x0;var _0x4e8745=_0x9354[_0x2dacca];return _0x4e8745;};'use strict';function Dynamics365Account(_0x487ab6){this['id']=_0x487ab6['id']||0x0;this[_0x4935('0x0')]=_0x487ab6[_0x4935('0x0')]||'';this['username']=_0x487ab6[_0x4935('0x1')]||'';this[_0x4935('0x2')]=_0x487ab6[_0x4935('0x2')]||'';this[_0x4935('0x3')]=_0x487ab6['remoteUri']||'';this[_0x4935('0x4')]=_0x487ab6[_0x4935('0x4')]||'';this[_0x4935('0x5')]=_0x487ab6[_0x4935('0x5')]||'';this[_0x4935('0x6')]=_0x487ab6[_0x4935('0x6')]||{};this[_0x4935('0x7')]=_0x487ab6[_0x4935('0x7')]||'';this[_0x4935('0x8')]=_0x487ab6['Configurations']||{};}module[_0x4935('0x9')]=Dynamics365Account; \ No newline at end of file +var _0x1339=['serverUrl','Configurations','exports','name','username','password','remoteUri','tenantId','clientId','clientSecret'];(function(_0x3d1ba3,_0x58816a){var _0xc2fa6=function(_0x546936){while(--_0x546936){_0x3d1ba3['push'](_0x3d1ba3['shift']());}};_0xc2fa6(++_0x58816a);}(_0x1339,0x1ed));var _0x9133=function(_0x444cf1,_0x397c21){_0x444cf1=_0x444cf1-0x0;var _0x317ecd=_0x1339[_0x444cf1];return _0x317ecd;};'use strict';function Dynamics365Account(_0x421620){this['id']=_0x421620['id']||0x0;this['name']=_0x421620[_0x9133('0x0')]||'';this[_0x9133('0x1')]=_0x421620[_0x9133('0x1')]||'';this[_0x9133('0x2')]=_0x421620[_0x9133('0x2')]||'';this[_0x9133('0x3')]=_0x421620[_0x9133('0x3')]||'';this[_0x9133('0x4')]=_0x421620['tenantId']||'';this[_0x9133('0x5')]=_0x421620[_0x9133('0x5')]||'';this[_0x9133('0x6')]=_0x421620['clientSecret']||{};this[_0x9133('0x7')]=_0x421620[_0x9133('0x7')]||'';this[_0x9133('0x8')]=_0x421620[_0x9133('0x8')]||{};}module[_0x9133('0x9')]=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index d49a059..893d562 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 _0x0e89=['name','description','ecm','headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','t38timeout','tech','Trunk','ListId','key','exports'];(function(_0x4e1242,_0x39d47d){var _0x8430b4=function(_0x1a75df){while(--_0x1a75df){_0x4e1242['push'](_0x4e1242['shift']());}};_0x8430b4(++_0x39d47d);}(_0x0e89,0x180));var _0x90e8=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x0e89[_0x465028];return _0xb783d4;};'use strict';function FaxAccount(_0xcfb728){this['id']=_0xcfb728['id']||0x0;this[_0x90e8('0x0')]=_0xcfb728[_0x90e8('0x0')]||'';this[_0x90e8('0x1')]=_0xcfb728['description'];this[_0x90e8('0x2')]=_0xcfb728[_0x90e8('0x2')];this[_0x90e8('0x3')]=_0xcfb728[_0x90e8('0x3')];this[_0x90e8('0x4')]=_0xcfb728[_0x90e8('0x4')];this[_0x90e8('0x5')]=_0xcfb728[_0x90e8('0x5')]||0x960;this['maxrate']=_0xcfb728[_0x90e8('0x6')]||0x3840;this[_0x90e8('0x7')]=_0xcfb728[_0x90e8('0x7')]||_0x90e8('0x8');this[_0x90e8('0x9')]=_0xcfb728[_0x90e8('0x9')]||'no';this['faxdetect']=_0xcfb728['faxdetect']||'no';this[_0x90e8('0xa')]=_0xcfb728[_0x90e8('0xa')]||0x1388;this[_0x90e8('0xb')]=_0xcfb728[_0x90e8('0xb')]||'SIP';this[_0x90e8('0xc')]=_0xcfb728[_0x90e8('0xc')]?_0xcfb728['Trunk']:undefined;this[_0x90e8('0xd')]=_0xcfb728['ListId'];this['key']=_0xcfb728[_0x90e8('0xe')];}module[_0x90e8('0xf')]=FaxAccount; \ No newline at end of file +var _0xb24e=['key','exports','name','description','ecm','headerinfo','localstationid','minrate','maxrate','modem','gateway','faxdetect','t38timeout','tech','SIP','Trunk','ListId'];(function(_0x1e4ddb,_0x21d533){var _0x45307b=function(_0x4d9125){while(--_0x4d9125){_0x1e4ddb['push'](_0x1e4ddb['shift']());}};_0x45307b(++_0x21d533);}(_0xb24e,0x1bc));var _0xeb24=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xb24e[_0x321bb2];return _0x9c12ed;};'use strict';function FaxAccount(_0x34ff78){this['id']=_0x34ff78['id']||0x0;this['name']=_0x34ff78[_0xeb24('0x0')]||'';this['description']=_0x34ff78[_0xeb24('0x1')];this[_0xeb24('0x2')]=_0x34ff78[_0xeb24('0x2')];this['headerinfo']=_0x34ff78[_0xeb24('0x3')];this[_0xeb24('0x4')]=_0x34ff78['localstationid'];this[_0xeb24('0x5')]=_0x34ff78[_0xeb24('0x5')]||0x960;this[_0xeb24('0x6')]=_0x34ff78[_0xeb24('0x6')]||0x3840;this[_0xeb24('0x7')]=_0x34ff78['modem']||'v17,v27,v29';this['gateway']=_0x34ff78[_0xeb24('0x8')]||'no';this[_0xeb24('0x9')]=_0x34ff78['faxdetect']||'no';this[_0xeb24('0xa')]=_0x34ff78[_0xeb24('0xa')]||0x1388;this[_0xeb24('0xb')]=_0x34ff78['tech']||_0xeb24('0xc');this['Trunk']=_0x34ff78['Trunk']?_0x34ff78[_0xeb24('0xd')]:undefined;this[_0xeb24('0xe')]=_0x34ff78[_0xeb24('0xe')];this[_0xeb24('0xf')]=_0x34ff78[_0xeb24('0xf')];}module[_0xeb24('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 9c056f0..8ac5521 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 _0x3079=['serverUrl','Configurations','exports','name','username','apiKey','remoteUri'];(function(_0x548627,_0x4ec392){var _0x844a84=function(_0x2ffdd2){while(--_0x2ffdd2){_0x548627['push'](_0x548627['shift']());}};_0x844a84(++_0x4ec392);}(_0x3079,0x1ed));var _0x9307=function(_0x43b624,_0x18168d){_0x43b624=_0x43b624-0x0;var _0x29e970=_0x3079[_0x43b624];return _0x29e970;};'use strict';function FreshdeskAccount(_0x5c88df){this['id']=_0x5c88df['id']||0x0;this[_0x9307('0x0')]=_0x5c88df[_0x9307('0x0')]||'';this[_0x9307('0x1')]=_0x5c88df[_0x9307('0x1')]||'';this[_0x9307('0x2')]=_0x5c88df['token']||'';this['remoteUri']=_0x5c88df[_0x9307('0x3')]||'';this['serverUrl']=_0x5c88df[_0x9307('0x4')]||'';this['Configurations']=_0x5c88df[_0x9307('0x5')]||{};}module[_0x9307('0x6')]=FreshdeskAccount; \ No newline at end of file +var _0x2ac3=['username','apiKey','serverUrl','Configurations','exports','name'];(function(_0x4d8dc3,_0x585fd1){var _0x9b03d9=function(_0x7a31d5){while(--_0x7a31d5){_0x4d8dc3['push'](_0x4d8dc3['shift']());}};_0x9b03d9(++_0x585fd1);}(_0x2ac3,0x89));var _0x32ac=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x2ac3[_0x126558];return _0x1f6d14;};'use strict';function FreshdeskAccount(_0x241bde){this['id']=_0x241bde['id']||0x0;this[_0x32ac('0x0')]=_0x241bde[_0x32ac('0x0')]||'';this[_0x32ac('0x1')]=_0x241bde[_0x32ac('0x1')]||'';this[_0x32ac('0x2')]=_0x241bde['token']||'';this['remoteUri']=_0x241bde['remoteUri']||'';this[_0x32ac('0x3')]=_0x241bde['serverUrl']||'';this[_0x32ac('0x4')]=_0x241bde['Configurations']||{};}module[_0x32ac('0x5')]=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index 34c5919..c02c8e0 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 _0x90b5=['apiKey','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x3635cd,_0x5a317e){var _0x144083=function(_0x419fc8){while(--_0x419fc8){_0x3635cd['push'](_0x3635cd['shift']());}};_0x144083(++_0x5a317e);}(_0x90b5,0x139));var _0x590b=function(_0x49157b,_0x5d8601){_0x49157b=_0x49157b-0x0;var _0x3ea5d4=_0x90b5[_0x49157b];return _0x3ea5d4;};'use strict';function FreshsalesAccount(_0x31c9b2){this['id']=_0x31c9b2['id']||0x0;this['name']=_0x31c9b2[_0x590b('0x0')]||'';this[_0x590b('0x1')]=_0x31c9b2[_0x590b('0x1')]||'';this[_0x590b('0x2')]=_0x31c9b2['token']||'';this['remoteUri']=_0x31c9b2[_0x590b('0x3')]||'';this[_0x590b('0x4')]=_0x31c9b2['serverUrl']||'';this[_0x590b('0x5')]=_0x31c9b2[_0x590b('0x5')]||{};}module[_0x590b('0x6')]=FreshsalesAccount; \ No newline at end of file +var _0x9b69=['exports','name','apiKey','remoteUri','serverUrl','Configurations'];(function(_0x4cb6ca,_0x4c5a64){var _0x1369e7=function(_0x160f73){while(--_0x160f73){_0x4cb6ca['push'](_0x4cb6ca['shift']());}};_0x1369e7(++_0x4c5a64);}(_0x9b69,0xa3));var _0x99b6=function(_0x1619c1,_0x1cf51d){_0x1619c1=_0x1619c1-0x0;var _0x7c06a8=_0x9b69[_0x1619c1];return _0x7c06a8;};'use strict';function FreshsalesAccount(_0x42aff3){this['id']=_0x42aff3['id']||0x0;this[_0x99b6('0x0')]=_0x42aff3[_0x99b6('0x0')]||'';this['username']=_0x42aff3['username']||'';this[_0x99b6('0x1')]=_0x42aff3['token']||'';this[_0x99b6('0x2')]=_0x42aff3[_0x99b6('0x2')]||'';this[_0x99b6('0x3')]=_0x42aff3['serverUrl']||'';this[_0x99b6('0x4')]=_0x42aff3['Configurations']||{};}module[_0x99b6('0x5')]=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index 15ded99..4cdaf1f 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 _0x5ad8=['queuecallerexit','originalposition','channel','connectedlinenum','connectedlinename','accountcode','context','exten','priority','holdtime','assigned','lastAssignedTo','variables','exports','type','inbound','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','count','queuecallerabandonAt','queuecallercompleteAt'];(function(_0x43aa6d,_0x55dd48){var _0x4d38ff=function(_0x4492ff){while(--_0x4492ff){_0x43aa6d['push'](_0x43aa6d['shift']());}};_0x4d38ff(++_0x55dd48);}(_0x5ad8,0xbd));var _0x85ad=function(_0x475eac,_0x2fa495){_0x475eac=_0x475eac-0x0;var _0x4ad158=_0x5ad8[_0x475eac];return _0x4ad158;};'use strict';function QueueReport(){this[_0x85ad('0x0')]=_0x85ad('0x1');this[_0x85ad('0x2')]='';this[_0x85ad('0x3')]='';this[_0x85ad('0x4')]='';this[_0x85ad('0x5')]='';this[_0x85ad('0x6')]=null;this[_0x85ad('0x7')]=null;this['position']=0x1;this[_0x85ad('0x8')]=0x1;this['queuecallerabandon']=![];this[_0x85ad('0x9')]=null;this['queuecallercomplete']=![];this[_0x85ad('0xa')]=null;this[_0x85ad('0xb')]=![];this['queuecallerexitAt']=null;this[_0x85ad('0xc')]=0x1;this[_0x85ad('0xd')]='';this[_0x85ad('0xe')]='';this[_0x85ad('0xf')]='';this[_0x85ad('0x10')]='';this[_0x85ad('0x11')]='';this[_0x85ad('0x12')]='';this[_0x85ad('0x13')]='';this[_0x85ad('0x14')]=0x0;this[_0x85ad('0x15')]=![];this[_0x85ad('0x16')]='';this['mohtime']=0x0;this[_0x85ad('0x17')]={};}module[_0x85ad('0x18')]=QueueReport; \ No newline at end of file +var _0x5bbd=['queuecallerexit','originalposition','channel','connectedlinenum','connectedlinename','accountcode','exten','holdtime','assigned','lastAssignedTo','mohtime','variables','type','inbound','uniqueid','calleridnum','calleridname','queuecallerjoinAt','queuecallerleaveAt','position','count','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt'];(function(_0x58666a,_0x33d8b7){var _0x4d2990=function(_0x1f8a2b){while(--_0x1f8a2b){_0x58666a['push'](_0x58666a['shift']());}};_0x4d2990(++_0x33d8b7);}(_0x5bbd,0xd4));var _0xd5bb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5bbd[_0x3dd15e];return _0x231fd0;};'use strict';function QueueReport(){this[_0xd5bb('0x0')]=_0xd5bb('0x1');this[_0xd5bb('0x2')]='';this[_0xd5bb('0x3')]='';this[_0xd5bb('0x4')]='';this['queue']='';this[_0xd5bb('0x5')]=null;this[_0xd5bb('0x6')]=null;this[_0xd5bb('0x7')]=0x1;this[_0xd5bb('0x8')]=0x1;this[_0xd5bb('0x9')]=![];this[_0xd5bb('0xa')]=null;this[_0xd5bb('0xb')]=![];this[_0xd5bb('0xc')]=null;this[_0xd5bb('0xd')]=![];this['queuecallerexitAt']=null;this[_0xd5bb('0xe')]=0x1;this[_0xd5bb('0xf')]='';this[_0xd5bb('0x10')]='';this[_0xd5bb('0x11')]='';this[_0xd5bb('0x12')]='';this['context']='';this[_0xd5bb('0x13')]='';this['priority']='';this[_0xd5bb('0x14')]=0x0;this[_0xd5bb('0x15')]=![];this[_0xd5bb('0x16')]='';this[_0xd5bb('0x17')]=0x0;this[_0xd5bb('0x18')]={};}module['exports']=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index 99b6557..94074e6 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 _0xf5da=['serverUrl','Configurations','name','username','remoteUri','password','clientId','securityToken','type','integrationTab'];(function(_0x23e7c1,_0x35110c){var _0x1add43=function(_0x238918){while(--_0x238918){_0x23e7c1['push'](_0x23e7c1['shift']());}};_0x1add43(++_0x35110c);}(_0xf5da,0x1a6));var _0xaf5d=function(_0x299784,_0xb0918f){_0x299784=_0x299784-0x0;var _0x5ab008=_0xf5da[_0x299784];return _0x5ab008;};'use strict';function SalesforceAccount(_0x30a688){this['id']=_0x30a688['id']||0x0;this[_0xaf5d('0x0')]=_0x30a688[_0xaf5d('0x0')]||'';this[_0xaf5d('0x1')]=_0x30a688[_0xaf5d('0x1')]||'';this[_0xaf5d('0x2')]=_0x30a688['remoteUri']||'';this[_0xaf5d('0x3')]=_0x30a688[_0xaf5d('0x3')]||'';this[_0xaf5d('0x4')]=_0x30a688['clientId']||'';this['clientSecret']=_0x30a688['clientSecret']||'';this['securityToken']=_0x30a688[_0xaf5d('0x5')]||'';this[_0xaf5d('0x6')]=_0x30a688['type']||_0xaf5d('0x7');this[_0xaf5d('0x8')]=_0x30a688[_0xaf5d('0x8')]||'';this[_0xaf5d('0x9')]=_0x30a688[_0xaf5d('0x9')]||{};}module['exports']=SalesforceAccount; \ No newline at end of file +var _0xe277=['remoteUri','password','clientId','clientSecret','securityToken','type','serverUrl','Configurations','exports','name','username'];(function(_0x15a3b2,_0x550b4a){var _0x2f4d07=function(_0x15e700){while(--_0x15e700){_0x15a3b2['push'](_0x15a3b2['shift']());}};_0x2f4d07(++_0x550b4a);}(_0xe277,0x15e));var _0x7e27=function(_0x2c3326,_0x590f89){_0x2c3326=_0x2c3326-0x0;var _0x381be3=_0xe277[_0x2c3326];return _0x381be3;};'use strict';function SalesforceAccount(_0x4883a6){this['id']=_0x4883a6['id']||0x0;this[_0x7e27('0x0')]=_0x4883a6['name']||'';this[_0x7e27('0x1')]=_0x4883a6[_0x7e27('0x1')]||'';this[_0x7e27('0x2')]=_0x4883a6[_0x7e27('0x2')]||'';this[_0x7e27('0x3')]=_0x4883a6['password']||'';this[_0x7e27('0x4')]=_0x4883a6[_0x7e27('0x4')]||'';this[_0x7e27('0x5')]=_0x4883a6[_0x7e27('0x5')]||'';this['securityToken']=_0x4883a6[_0x7e27('0x6')]||'';this[_0x7e27('0x7')]=_0x4883a6[_0x7e27('0x7')]||'integrationTab';this[_0x7e27('0x8')]=_0x4883a6[_0x7e27('0x8')]||'';this[_0x7e27('0x9')]=_0x4883a6[_0x7e27('0x9')]||{};}module[_0x7e27('0xa')]=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index d394a53..be6c244 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 _0x798b=['remoteUri','serverUrl','Configurations','name','username','password'];(function(_0x37842f,_0x197d54){var _0xe0cf3c=function(_0x48759f){while(--_0x48759f){_0x37842f['push'](_0x37842f['shift']());}};_0xe0cf3c(++_0x197d54);}(_0x798b,0x1ad));var _0xb798=function(_0x26a918,_0x4fb120){_0x26a918=_0x26a918-0x0;var _0x43e01c=_0x798b[_0x26a918];return _0x43e01c;};'use strict';function ServicenowAccount(_0x211537){this['id']=_0x211537['id']||0x0;this[_0xb798('0x0')]=_0x211537[_0xb798('0x0')]||'';this[_0xb798('0x1')]=_0x211537[_0xb798('0x1')]||'';this['password']=_0x211537[_0xb798('0x2')]||'';this[_0xb798('0x3')]=_0x211537[_0xb798('0x3')]||'';this[_0xb798('0x4')]=_0x211537[_0xb798('0x4')]||'';this[_0xb798('0x5')]=_0x211537[_0xb798('0x5')]||{};}module['exports']=ServicenowAccount; \ No newline at end of file +var _0xde18=['username','password','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0xde18,0x125));var _0x8de1=function(_0x56738d,_0x1221b6){_0x56738d=_0x56738d-0x0;var _0x468ab5=_0xde18[_0x56738d];return _0x468ab5;};'use strict';function ServicenowAccount(_0x57bd98){this['id']=_0x57bd98['id']||0x0;this[_0x8de1('0x0')]=_0x57bd98[_0x8de1('0x0')]||'';this[_0x8de1('0x1')]=_0x57bd98['username']||'';this[_0x8de1('0x2')]=_0x57bd98[_0x8de1('0x2')]||'';this[_0x8de1('0x3')]=_0x57bd98[_0x8de1('0x3')]||'';this[_0x8de1('0x4')]=_0x57bd98[_0x8de1('0x4')]||'';this[_0x8de1('0x5')]=_0x57bd98[_0x8de1('0x5')]||{};}module[_0x8de1('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 e18696d..0cb5e6f 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 _0xb08f=['name','password','remoteUri','serverUrl','Configurations','exports'];(function(_0x36df69,_0x49997){var _0x11aae9=function(_0x131eed){while(--_0x131eed){_0x36df69['push'](_0x36df69['shift']());}};_0x11aae9(++_0x49997);}(_0xb08f,0xc0));var _0xfb08=function(_0xf19f90,_0x237482){_0xf19f90=_0xf19f90-0x0;var _0x1eece3=_0xb08f[_0xf19f90];return _0x1eece3;};'use strict';function SugarcrmAccount(_0xd8f163){this['id']=_0xd8f163['id']||0x0;this[_0xfb08('0x0')]=_0xd8f163[_0xfb08('0x0')]||'';this['username']=_0xd8f163['username']||'';this['password']=_0xd8f163[_0xfb08('0x1')]||'';this[_0xfb08('0x2')]=_0xd8f163['remoteUri']||'';this[_0xfb08('0x3')]=_0xd8f163[_0xfb08('0x3')]||'';this[_0xfb08('0x4')]=_0xd8f163[_0xfb08('0x4')]||{};}module[_0xfb08('0x5')]=SugarcrmAccount; \ No newline at end of file +var _0xc089=['name','username','password','remoteUri','serverUrl','Configurations','exports'];(function(_0x5d780f,_0xca612d){var _0xdea064=function(_0x3d00e6){while(--_0x3d00e6){_0x5d780f['push'](_0x5d780f['shift']());}};_0xdea064(++_0xca612d);}(_0xc089,0x85));var _0x9c08=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xc089[_0x19950b];return _0x3c6b41;};'use strict';function SugarcrmAccount(_0x459195){this['id']=_0x459195['id']||0x0;this['name']=_0x459195[_0x9c08('0x0')]||'';this[_0x9c08('0x1')]=_0x459195['username']||'';this[_0x9c08('0x2')]=_0x459195[_0x9c08('0x2')]||'';this[_0x9c08('0x3')]=_0x459195['remoteUri']||'';this['serverUrl']=_0x459195[_0x9c08('0x4')]||'';this[_0x9c08('0x5')]=_0x459195[_0x9c08('0x5')]||{};}module[_0x9c08('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 efd4599..de5415e 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 _0xb77e=['state','unknown','stateTime','status','address','exports','name','accountcode'];(function(_0x491c18,_0x48b793){var _0x49f609=function(_0x59fc78){while(--_0x59fc78){_0x491c18['push'](_0x491c18['shift']());}};_0x49f609(++_0x48b793);}(_0xb77e,0x1e6));var _0xeb77=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0xb77e[_0x550d12];return _0x12103d;};'use strict';function Telephone(_0x3d6339){this['id']=_0x3d6339['id']||0x0;this[_0xeb77('0x0')]=_0x3d6339[_0xeb77('0x0')]||'';this[_0xeb77('0x1')]=_0x3d6339[_0xeb77('0x1')]||'';this[_0xeb77('0x2')]=_0xeb77('0x3');this[_0xeb77('0x4')]=0x0;this[_0xeb77('0x5')]=_0xeb77('0x3');this[_0xeb77('0x6')]='';}module[_0xeb77('0x7')]=Telephone; \ No newline at end of file +var _0x75e4=['stateTime','status','unknown','address','name','accountcode','state'];(function(_0x2d07d7,_0x474e93){var _0x3dd6ac=function(_0x498617){while(--_0x498617){_0x2d07d7['push'](_0x2d07d7['shift']());}};_0x3dd6ac(++_0x474e93);}(_0x75e4,0x1cb));var _0x475e=function(_0x1762b4,_0x33d836){_0x1762b4=_0x1762b4-0x0;var _0x29beda=_0x75e4[_0x1762b4];return _0x29beda;};'use strict';function Telephone(_0x5482e3){this['id']=_0x5482e3['id']||0x0;this[_0x475e('0x0')]=_0x5482e3[_0x475e('0x0')]||'';this[_0x475e('0x1')]=_0x5482e3[_0x475e('0x1')]||'';this[_0x475e('0x2')]='unknown';this[_0x475e('0x3')]=0x0;this[_0x475e('0x4')]=_0x475e('0x5');this[_0x475e('0x6')]='';}module['exports']=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index 982f064..d91f7e2 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(_0x129fa7,_0x264d87){var _0x5d2208=function(_0x1b2019){while(--_0x1b2019){_0x129fa7['push'](_0x129fa7['shift']());}};_0x5d2208(++_0x264d87);}(_0xa9e0,0x123));var _0x0a9e=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0xa9e0[_0x139a3c];return _0x2b375b;};'use strict';function template(_0x1f0015){this['id']=_0x1f0015['id']||0x0;this[_0x0a9e('0x0')]=_0x1f0015[_0x0a9e('0x0')]||'';this['html']=_0x1f0015['html']||'';}module[_0x0a9e('0x1')]=template; \ No newline at end of file +var _0xb10b=['name','html'];(function(_0x2ce6b9,_0x58094d){var _0x2e6651=function(_0x428310){while(--_0x428310){_0x2ce6b9['push'](_0x2ce6b9['shift']());}};_0x2e6651(++_0x58094d);}(_0xb10b,0x12a));var _0xbb10=function(_0x1d75dc,_0x333bdd){_0x1d75dc=_0x1d75dc-0x0;var _0x8375ad=_0xb10b[_0x1d75dc];return _0x8375ad;};'use strict';function template(_0x13ce8d){this['id']=_0x13ce8d['id']||0x0;this['name']=_0x13ce8d[_0xbb10('0x0')]||'';this[_0xbb10('0x1')]=_0x13ce8d[_0xbb10('0x1')]||'';}module['exports']=template; \ No newline at end of file diff --git a/server/services/ami/model/trigger.js b/server/services/ami/model/trigger.js index f749a7d..d5e86f5 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 _0xb7e7=['Actions','exports','name','channel','status','AllConditions','AnyConditions'];(function(_0x593da6,_0x839a8d){var _0x1169de=function(_0xfbea48){while(--_0xfbea48){_0x593da6['push'](_0x593da6['shift']());}};_0x1169de(++_0x839a8d);}(_0xb7e7,0x121));var _0x7b7e=function(_0x1abb09,_0x18ee91){_0x1abb09=_0x1abb09-0x0;var _0xea1c07=_0xb7e7[_0x1abb09];return _0xea1c07;};'use strict';function Trigger(_0x2e5e07){this['id']=_0x2e5e07['id']||0x0;this['name']=_0x2e5e07[_0x7b7e('0x0')]||'';this['channel']=_0x2e5e07[_0x7b7e('0x1')]||'voice';this[_0x7b7e('0x2')]=_0x2e5e07['status']||![];this[_0x7b7e('0x3')]=_0x2e5e07[_0x7b7e('0x3')]||[];this[_0x7b7e('0x4')]=_0x2e5e07['AnyConditions']||[];this['Actions']=_0x2e5e07[_0x7b7e('0x5')]||[];}module[_0x7b7e('0x6')]=Trigger; \ No newline at end of file +var _0x2032=['exports','name','channel','voice','status','AllConditions','AnyConditions','Actions'];(function(_0xfb1735,_0x48b96c){var _0x54d1f8=function(_0x2da5ac){while(--_0x2da5ac){_0xfb1735['push'](_0xfb1735['shift']());}};_0x54d1f8(++_0x48b96c);}(_0x2032,0xd9));var _0x2203=function(_0x4883db,_0x122a6f){_0x4883db=_0x4883db-0x0;var _0x361e39=_0x2032[_0x4883db];return _0x361e39;};'use strict';function Trigger(_0x4d6c97){this['id']=_0x4d6c97['id']||0x0;this[_0x2203('0x0')]=_0x4d6c97[_0x2203('0x0')]||'';this[_0x2203('0x1')]=_0x4d6c97['channel']||_0x2203('0x2');this[_0x2203('0x3')]=_0x4d6c97['status']||![];this[_0x2203('0x4')]=_0x4d6c97[_0x2203('0x4')]||[];this[_0x2203('0x5')]=_0x4d6c97[_0x2203('0x5')]||[];this[_0x2203('0x6')]=_0x4d6c97[_0x2203('0x6')]||[];}module[_0x2203('0x7')]=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index 5aae7ec..cc2cfb2 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 _0x4e03=['state','unknown','stateTime','status','registry','split','host','port','domain','domainport','refresh','registrationtime','address','defaultuser','exports','active','name'];(function(_0x917317,_0x98a1f5){var _0x4125e6=function(_0x173711){while(--_0x173711){_0x917317['push'](_0x917317['shift']());}};_0x4125e6(++_0x98a1f5);}(_0x4e03,0x163));var _0x34e0=function(_0x37e6b3,_0xcd36f){_0x37e6b3=_0x37e6b3-0x0;var _0x24a7ea=_0x4e03[_0x37e6b3];return _0x24a7ea;};'use strict';function Trunk(_0x433e4f){this['id']=_0x433e4f['id']||0x0;this[_0x34e0('0x0')]=_0x433e4f[_0x34e0('0x0')]||![];this[_0x34e0('0x1')]=_0x433e4f[_0x34e0('0x1')]||'';this[_0x34e0('0x2')]=_0x34e0('0x3');this[_0x34e0('0x4')]=0x0;this[_0x34e0('0x5')]=_0x34e0('0x3');this[_0x34e0('0x6')]=_0x433e4f[_0x34e0('0x6')]&&_0x433e4f['registry']['indexOf'](':')?_0x433e4f[_0x34e0('0x6')][_0x34e0('0x7')](':')[0x0]:'';this[_0x34e0('0x8')]='';this[_0x34e0('0x9')]='';this[_0x34e0('0xa')]='';this[_0x34e0('0xb')]='';this[_0x34e0('0xc')]='';this['stateRegistry']=_0x34e0('0x3');this[_0x34e0('0xd')]='';this[_0x34e0('0xe')]='';this[_0x34e0('0xf')]=_0x433e4f[_0x34e0('0xf')]||'';}module[_0x34e0('0x10')]=Trunk; \ No newline at end of file +var _0x56c8=['active','name','state','unknown','stateTime','status','registry','split','host','domainport','refresh','registrationtime','address','defaultuser','exports'];(function(_0x4daebe,_0x229154){var _0x3802fa=function(_0x15aa85){while(--_0x15aa85){_0x4daebe['push'](_0x4daebe['shift']());}};_0x3802fa(++_0x229154);}(_0x56c8,0x10e));var _0x856c=function(_0x1e4403,_0x5b02d4){_0x1e4403=_0x1e4403-0x0;var _0x5a9dd7=_0x56c8[_0x1e4403];return _0x5a9dd7;};'use strict';function Trunk(_0x47a90e){this['id']=_0x47a90e['id']||0x0;this[_0x856c('0x0')]=_0x47a90e[_0x856c('0x0')]||![];this[_0x856c('0x1')]=_0x47a90e[_0x856c('0x1')]||'';this[_0x856c('0x2')]=_0x856c('0x3');this[_0x856c('0x4')]=0x0;this[_0x856c('0x5')]='unknown';this[_0x856c('0x6')]=_0x47a90e[_0x856c('0x6')]&&_0x47a90e[_0x856c('0x6')]['indexOf'](':')?_0x47a90e[_0x856c('0x6')][_0x856c('0x7')](':')[0x0]:'';this[_0x856c('0x8')]='';this['port']='';this['domain']='';this[_0x856c('0x9')]='';this[_0x856c('0xa')]='';this['stateRegistry']=_0x856c('0x3');this[_0x856c('0xb')]='';this[_0x856c('0xc')]='';this[_0x856c('0xd')]=_0x47a90e['defaultuser']||'';}module[_0x856c('0xe')]=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index ba6e949..e34ef8c 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 _0x2bd4=['none','mandatoryDisposition','exten','recordingFormat'];(function(_0x38d0e9,_0x33f3f4){var _0x184a6c=function(_0x21e2dc){while(--_0x21e2dc){_0x38d0e9['push'](_0x38d0e9['shift']());}};_0x184a6c(++_0x33f3f4);}(_0x2bd4,0x1ca));var _0x42bd=function(_0xc970e0,_0x3f2b5a){_0xc970e0=_0xc970e0-0x0;var _0x310803=_0x2bd4[_0xc970e0];return _0x310803;};'use strict';function voiceExtension(_0x46b7f9){this['id']=_0x46b7f9['id']||0x0;this[_0x42bd('0x0')]=_0x46b7f9['exten']||'';this[_0x42bd('0x1')]=_0x46b7f9[_0x42bd('0x1')]||_0x42bd('0x2');this[_0x42bd('0x3')]=_0x46b7f9[_0x42bd('0x3')]||![];}module['exports']=voiceExtension; \ No newline at end of file +var _0x4d40=['none','mandatoryDisposition','exten','recordingFormat'];(function(_0x5cc0eb,_0x386085){var _0x292670=function(_0x2395de){while(--_0x2395de){_0x5cc0eb['push'](_0x5cc0eb['shift']());}};_0x292670(++_0x386085);}(_0x4d40,0x82));var _0x04d4=function(_0x203f90,_0x1f112d){_0x203f90=_0x203f90-0x0;var _0x3f8714=_0x4d40[_0x203f90];return _0x3f8714;};'use strict';function voiceExtension(_0x3b6bac){this['id']=_0x3b6bac['id']||0x0;this[_0x04d4('0x0')]=_0x3b6bac['exten']||'';this[_0x04d4('0x1')]=_0x3b6bac['recordingFormat']||_0x04d4('0x2');this[_0x04d4('0x3')]=_0x3b6bac[_0x04d4('0x3')]||![];}module['exports']=voiceExtension; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueue.js b/server/services/ami/model/voiceQueue.js index ab2b8f9..8da0d19 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 _0x9127=['dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdNumber','anonymous','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundReCallsDay','outboundAbandonedDay','startProgressive','startPredictive','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','not_inuse','inuse','busy','unavailable','ringinuse','onhold','wav','gsm','rrmemory','roundrobin','name','monitor_format','type','inbound','waiting','total','sumDuration','unmanaged','loggedIn','available','acw','acwTimeout','autopause','sendMessageOneNotActive','message','originated','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization'];(function(_0x549490,_0xea5dd0){var _0x3a8791=function(_0x4930d4){while(--_0x4930d4){_0x549490['push'](_0x549490['shift']());}};_0x3a8791(++_0xea5dd0);}(_0x9127,0x1b9));var _0x7912=function(_0x48b5e0,_0xb3826){_0x48b5e0=_0x48b5e0-0x0;var _0x4287ea=_0x9127[_0x48b5e0];return _0x4287ea;};'use strict';var statusDesc=['unknown',_0x7912('0x0'),_0x7912('0x1'),_0x7912('0x2'),'invalid',_0x7912('0x3'),'ringing',_0x7912('0x4'),_0x7912('0x5')];var monitorFormat={'wav':_0x7912('0x6'),'wav49':'wav49','gsm':_0x7912('0x7')};var strategy={'rrmemory':_0x7912('0x8'),'roundrobin':_0x7912('0x9')};function VoiceQueue(_0x365964){this['id']=_0x365964['id']||0x0;this[_0x7912('0xa')]=_0x365964['name']||'';this[_0x7912('0xb')]=_0x365964['monitor_format']||'';this[_0x7912('0xc')]=_0x365964['type']||_0x7912('0xd');this[_0x7912('0xe')]=0x0;this['talking']=0x0;this[_0x7912('0xf')]=0x0;this['answered']=0x0;this[_0x7912('0x10')]=0x0;this['sumHoldTime']=0x0;this['sumBillable']=0x0;this[_0x7912('0x11')]=0x0;this['abandoned']=0x0;this[_0x7912('0x12')]=0x0;this[_0x7912('0x13')]=0x0;this[_0x7912('0x14')]=_0x365964[_0x7912('0x14')]||![];this[_0x7912('0x15')]=_0x365964[_0x7912('0x15')]||0xa;this[_0x7912('0x16')]=_0x365964[_0x7912('0x16')]||'no';this[_0x7912('0x17')]=!![];this[_0x7912('0x18')]='';this[_0x7912('0x19')]=0x0;this['temp']=0x0;this[_0x7912('0x1a')]=_0x365964[_0x7912('0x1a')]||null;this[_0x7912('0x1b')]=_0x365964[_0x7912('0x1b')]?_0x365964[_0x7912('0x1b')]:null;this[_0x7912('0x1c')]=_0x365964[_0x7912('0x1c')];this[_0x7912('0x1d')]=_0x365964['dialMethod']||_0x7912('0x1e');this[_0x7912('0x1f')]=_0x365964[_0x7912('0x1f')]||0x0;this[_0x7912('0x20')]=_0x365964[_0x7912('0x20')]||0x0;this[_0x7912('0x21')]=_0x365964[_0x7912('0x21')]||0x1;this[_0x7912('0x22')]=_0x365964[_0x7912('0x22')]||_0x7912('0x23');this[_0x7912('0x24')]=_0x365964[_0x7912('0x24')]||0.03;this[_0x7912('0x25')]=_0x365964[_0x7912('0x25')]||0x258;this['dialOriginateCallerIdName']=_0x365964['dialOriginateCallerIdName']||'anonymous';this[_0x7912('0x26')]=_0x365964[_0x7912('0x26')]||_0x7912('0x27');this[_0x7912('0x28')]=_0x365964[_0x7912('0x28')]||0x1e;this[_0x7912('0x29')]=_0x365964[_0x7912('0x29')]||_0x7912('0x2a');this[_0x7912('0x2b')]=_0x365964[_0x7912('0x2b')]||0x3;this['dialQueueProject']=_0x365964[_0x7912('0x2c')]||undefined;this[_0x7912('0x2d')]=_0x365964['dialCongestionMaxRetry']||0x3;this['dialCongestionRetryFrequency']=_0x365964[_0x7912('0x2e')]||0x96;this[_0x7912('0x2f')]=_0x365964[_0x7912('0x2f')]||0x3;this[_0x7912('0x30')]=_0x365964[_0x7912('0x30')]||0x96;this[_0x7912('0x31')]=_0x365964[_0x7912('0x31')]||0x3;this[_0x7912('0x32')]=_0x365964['dialNoAnswerRetryFrequency']||0x96;this[_0x7912('0x33')]=_0x365964[_0x7912('0x33')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0x365964['dialNoSuchNumberRetryFrequency']||0x96;this[_0x7912('0x34')]=_0x365964[_0x7912('0x34')]||0x3;this[_0x7912('0x35')]=_0x365964[_0x7912('0x35')]||0x96;this[_0x7912('0x36')]=_0x365964[_0x7912('0x36')]||0x3;this[_0x7912('0x37')]=_0x365964['dialAbandonedRetryFrequency']||0x96;this[_0x7912('0x38')]=_0x365964[_0x7912('0x38')]||0x3;this[_0x7912('0x39')]=_0x365964[_0x7912('0x39')]||0x96;this[_0x7912('0x3a')]=_0x365964['dialAgentRejectMaxRetry']||0x3;this['dialAgentRejectRetryFrequency']=_0x365964[_0x7912('0x3b')]||0x96;this['dialGlobalMaxRetry']=_0x365964[_0x7912('0x3c')]||0x4;this[_0x7912('0x3d')]=_0x365964['Trunk']?_0x365964[_0x7912('0x3d')]:undefined;this['TrunkBackup']=_0x365964[_0x7912('0x3e')]?_0x365964[_0x7912('0x3e')]:undefined;this[_0x7912('0x3f')]=_0x365964[_0x7912('0x3f')]||undefined;this['Interval']=_0x365964['Interval']?_0x365964[_0x7912('0x40')]:undefined;this[_0x7912('0x41')]=_0x365964[_0x7912('0x41')]||'DESC';this[_0x7912('0x42')]=_0x365964[_0x7912('0x42')]||undefined;this[_0x7912('0x43')]=_0x365964[_0x7912('0x43')]||undefined;this['strategy']=strategy[_0x365964[_0x7912('0x44')]]||_0x7912('0x8');this['queueStatusComplete']=!![];this[_0x7912('0x45')]=_0x365964[_0x7912('0x45')]||![];this[_0x7912('0x46')]=_0x365964[_0x7912('0x46')];this[_0x7912('0x47')]=_0x365964[_0x7912('0x47')];this[_0x7912('0x48')]=_0x365964[_0x7912('0x48')];this[_0x7912('0x49')]=_0x365964[_0x7912('0x49')];this[_0x7912('0x4a')]=_0x365964[_0x7912('0x4a')];this[_0x7912('0x4b')]=_0x365964[_0x7912('0x4b')];this['dialAMDMaximumNumberOfWords']=_0x365964[_0x7912('0x4c')];this[_0x7912('0x4d')]=_0x365964[_0x7912('0x4d')];this[_0x7912('0x4e')]=_0x365964['dialAMDMaximumWordLength'];this[_0x7912('0x4f')]=0x0;this['pTalking']=0x0;this[_0x7912('0x50')]=_0x365964[_0x7912('0x50')];this[_0x7912('0x51')]=0x0;this[_0x7912('0x52')]=0x0;this[_0x7912('0x53')]=0x0;this['outboundBusyCallsDay']=0x0;this[_0x7912('0x54')]=0x0;this[_0x7912('0x55')]=0x0;this[_0x7912('0x56')]=0x0;this[_0x7912('0x57')]=0x0;this[_0x7912('0x58')]=0x0;this[_0x7912('0x59')]=0x0;this[_0x7912('0x5a')]=0x0;this['outboundDropCallsDayACS']=0x0;this[_0x7912('0x5b')]=0x0;this[_0x7912('0x5c')]=0x0;this[_0x7912('0x5d')]=undefined;this[_0x7912('0x5e')]=undefined;this['handlePredictive']=undefined;this['predictiveIntervalMultiplicativeFactor']=1.05;this[_0x7912('0x5f')]=0x0;this[_0x7912('0x60')]=0x0;this[_0x7912('0x61')]=0x0;this['predictiveIntervalDroppedCallsTimeout']=0x0;this[_0x7912('0x62')]=0x0;this[_0x7912('0x63')]=0x0;this[_0x7912('0x64')]=0x0;this[_0x7912('0x65')]=0x0;this[_0x7912('0x66')]=_0x365964[_0x7912('0x67')]||0x14;this[_0x7912('0x68')]=_0x365964[_0x7912('0x67')]||0xa;this[_0x7912('0x69')]=0x0;this[_0x7912('0x6a')]=0x0;this[_0x7912('0x6b')]=0x1;this[_0x7912('0x6c')]=0x0;this[_0x7912('0x6d')]=0x0;this['erlangAbandonmentRate']=0x0;this[_0x7912('0x6e')]=0x0;this[_0x7912('0x6f')]=_0x365964['dialRecallMeTimeout']||0x1e;this[_0x7912('0x70')]=_0x365964['dialRecallInQueue']||![];this[_0x7912('0x71')]=_0x365964['dialQueueProject2']||undefined;this[_0x7912('0x72')]=_0x365964[_0x7912('0x72')]||![];this[_0x7912('0x73')]=_0x365964[_0x7912('0x73')]||![];this[_0x7912('0xb')]=monitorFormat[_0x365964[_0x7912('0xb')]]?monitorFormat[_0x365964[_0x7912('0xb')]]:undefined;this[_0x7912('0x74')]=_0x365964[_0x7912('0x74')]||![];this[_0x7912('0x75')]=_0x365964[_0x7912('0x75')]?_0x365964[_0x7912('0x75')]:undefined;}module[_0x7912('0x76')]=VoiceQueue; \ No newline at end of file +var _0x0607=['outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundAbandonedDay','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvailable','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangAbandonmentRate','dialRecallMeTimeout','dialRecallInQueue','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','monitor_format','mandatoryDisposition','mandatoryDispositionPause','exports','unknown','not_inuse','inuse','invalid','unavailable','ringing','onhold','wav','wav49','rrmemory','roundrobin','name','type','inbound','waiting','talking','sumDuration','sumHoldTime','sumBillable','unmanaged','abandoned','available','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','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','timeout'];(function(_0xef4ef0,_0x3c72f9){var _0x39b60b=function(_0x1d824c){while(--_0x1d824c){_0xef4ef0['push'](_0xef4ef0['shift']());}};_0x39b60b(++_0x3c72f9);}(_0x0607,0x99));var _0x7060=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0607[_0x3dd15e];return _0x231fd0;};'use strict';var statusDesc=[_0x7060('0x0'),_0x7060('0x1'),_0x7060('0x2'),'busy',_0x7060('0x3'),_0x7060('0x4'),_0x7060('0x5'),'ringinuse',_0x7060('0x6')];var monitorFormat={'wav':_0x7060('0x7'),'wav49':_0x7060('0x8'),'gsm':'gsm'};var strategy={'rrmemory':_0x7060('0x9'),'roundrobin':_0x7060('0xa')};function VoiceQueue(_0x390fef){this['id']=_0x390fef['id']||0x0;this[_0x7060('0xb')]=_0x390fef['name']||'';this['monitor_format']=_0x390fef['monitor_format']||'';this[_0x7060('0xc')]=_0x390fef[_0x7060('0xc')]||_0x7060('0xd');this[_0x7060('0xe')]=0x0;this[_0x7060('0xf')]=0x0;this['total']=0x0;this['answered']=0x0;this[_0x7060('0x10')]=0x0;this[_0x7060('0x11')]=0x0;this[_0x7060('0x12')]=0x0;this[_0x7060('0x13')]=0x0;this[_0x7060('0x14')]=0x0;this['loggedIn']=0x0;this[_0x7060('0x15')]=0x0;this['acw']=_0x390fef['acw']||![];this['acwTimeout']=_0x390fef[_0x7060('0x16')]||0xa;this['autopause']=_0x390fef[_0x7060('0x17')]||'no';this[_0x7060('0x18')]=!![];this[_0x7060('0x19')]='';this[_0x7060('0x1a')]=0x0;this[_0x7060('0x1b')]=0x0;this[_0x7060('0x1c')]=_0x390fef[_0x7060('0x1c')]||null;this[_0x7060('0x1d')]=_0x390fef[_0x7060('0x1d')]?_0x390fef[_0x7060('0x1d')]:null;this[_0x7060('0x1e')]=_0x390fef[_0x7060('0x1e')];this[_0x7060('0x1f')]=_0x390fef[_0x7060('0x1f')]||_0x7060('0x20');this['dialLimitChannel']=_0x390fef[_0x7060('0x21')]||0x0;this['dialLimitQueue']=_0x390fef[_0x7060('0x22')]||0x0;this[_0x7060('0x23')]=_0x390fef[_0x7060('0x23')]||0x1;this[_0x7060('0x24')]=_0x390fef[_0x7060('0x24')]||'dropRate';this['dialPredictiveOptimizationPercentage']=_0x390fef[_0x7060('0x25')]||0.03;this[_0x7060('0x26')]=_0x390fef[_0x7060('0x26')]||0x258;this[_0x7060('0x27')]=_0x390fef[_0x7060('0x27')]||_0x7060('0x28');this[_0x7060('0x29')]=_0x390fef[_0x7060('0x29')]||_0x7060('0x28');this[_0x7060('0x2a')]=_0x390fef['dialOriginateTimeout']||0x1e;this[_0x7060('0x2b')]=_0x390fef['dialQueueOptions']||'tTxX';this[_0x7060('0x2c')]=_0x390fef[_0x7060('0x2c')]||0x3;this[_0x7060('0x2d')]=_0x390fef[_0x7060('0x2d')]||undefined;this[_0x7060('0x2e')]=_0x390fef[_0x7060('0x2e')]||0x3;this[_0x7060('0x2f')]=_0x390fef['dialCongestionRetryFrequency']||0x96;this[_0x7060('0x30')]=_0x390fef[_0x7060('0x30')]||0x3;this[_0x7060('0x31')]=_0x390fef[_0x7060('0x31')]||0x96;this[_0x7060('0x32')]=_0x390fef['dialNoAnswerMaxRetry']||0x3;this[_0x7060('0x33')]=_0x390fef[_0x7060('0x33')]||0x96;this[_0x7060('0x34')]=_0x390fef[_0x7060('0x34')]||0x3;this[_0x7060('0x35')]=_0x390fef[_0x7060('0x35')]||0x96;this[_0x7060('0x36')]=_0x390fef['dialDropMaxRetry']||0x3;this[_0x7060('0x37')]=_0x390fef[_0x7060('0x37')]||0x96;this[_0x7060('0x38')]=_0x390fef[_0x7060('0x38')]||0x3;this[_0x7060('0x39')]=_0x390fef[_0x7060('0x39')]||0x96;this['dialMachineMaxRetry']=_0x390fef[_0x7060('0x3a')]||0x3;this[_0x7060('0x3b')]=_0x390fef[_0x7060('0x3b')]||0x96;this[_0x7060('0x3c')]=_0x390fef[_0x7060('0x3c')]||0x3;this[_0x7060('0x3d')]=_0x390fef[_0x7060('0x3d')]||0x96;this[_0x7060('0x3e')]=_0x390fef[_0x7060('0x3e')]||0x4;this['Trunk']=_0x390fef['Trunk']?_0x390fef[_0x7060('0x3f')]:undefined;this[_0x7060('0x40')]=_0x390fef[_0x7060('0x40')]?_0x390fef['TrunkBackup']:undefined;this[_0x7060('0x41')]=_0x390fef[_0x7060('0x41')]||undefined;this[_0x7060('0x42')]=_0x390fef[_0x7060('0x42')]?_0x390fef[_0x7060('0x42')]:undefined;this[_0x7060('0x43')]=_0x390fef[_0x7060('0x43')]||'DESC';this['dialRandomLastDigitCallerIdNumber']=_0x390fef['dialRandomLastDigitCallerIdNumber']||undefined;this[_0x7060('0x44')]=_0x390fef[_0x7060('0x44')]||undefined;this[_0x7060('0x45')]=strategy[_0x390fef[_0x7060('0x45')]]||_0x7060('0x9');this[_0x7060('0x46')]=!![];this['dialAMDActive']=_0x390fef[_0x7060('0x47')]||![];this[_0x7060('0x48')]=_0x390fef[_0x7060('0x48')];this[_0x7060('0x49')]=_0x390fef[_0x7060('0x49')];this[_0x7060('0x4a')]=_0x390fef[_0x7060('0x4a')];this['dialAMDTotalAnalysisTime']=_0x390fef[_0x7060('0x4b')];this[_0x7060('0x4c')]=_0x390fef[_0x7060('0x4c')];this[_0x7060('0x4d')]=_0x390fef[_0x7060('0x4d')];this['dialAMDMaximumNumberOfWords']=_0x390fef[_0x7060('0x4e')];this['dialAMDSilenceThreshold']=_0x390fef[_0x7060('0x4f')];this[_0x7060('0x50')]=_0x390fef[_0x7060('0x50')];this[_0x7060('0x51')]=0x0;this['pTalking']=0x0;this[_0x7060('0x52')]=_0x390fef['timeout'];this[_0x7060('0x53')]=0x0;this[_0x7060('0x54')]=0x0;this[_0x7060('0x55')]=0x0;this[_0x7060('0x56')]=0x0;this[_0x7060('0x57')]=0x0;this[_0x7060('0x58')]=0x0;this[_0x7060('0x59')]=0x0;this[_0x7060('0x5a')]=0x0;this['outboundOriginateFailureCallsDay']=0x0;this[_0x7060('0x5b')]=0x0;this[_0x7060('0x5c')]=0x0;this[_0x7060('0x5d')]=0x0;this['outboundReCallsDay']=0x0;this[_0x7060('0x5e')]=0x0;this['startProgressive']=undefined;this[_0x7060('0x5f')]=undefined;this[_0x7060('0x60')]=undefined;this[_0x7060('0x61')]=1.05;this[_0x7060('0x62')]=0x0;this['predictiveIntervalAnsweredCalls']=0x0;this[_0x7060('0x63')]=0x0;this[_0x7060('0x64')]=0x0;this[_0x7060('0x65')]=0x0;this['predictiveIntervalAvgTalktime']=0x0;this['predictiveIntervalPauses']=0x0;this[_0x7060('0x66')]=0x0;this['predictiveIntervalMaxThreshold']=_0x390fef[_0x7060('0x67')]||0x14;this[_0x7060('0x68')]=_0x390fef['dialPredictiveIntervalMaxThreshold']||0xa;this[_0x7060('0x69')]=0x0;this[_0x7060('0x6a')]=0x0;this[_0x7060('0x6b')]=0x1;this[_0x7060('0x6c')]=0x0;this['erlangCallToSecond']=0x0;this[_0x7060('0x6d')]=0x0;this['erlangBusyFactor']=0x0;this['dialRecallMeTimeout']=_0x390fef[_0x7060('0x6e')]||0x1e;this[_0x7060('0x6f')]=_0x390fef[_0x7060('0x6f')]||![];this['dialQueueProject2']=_0x390fef['dialQueueProject2']||undefined;this['dialAgiAfterHangupClient']=_0x390fef[_0x7060('0x70')]||![];this[_0x7060('0x71')]=_0x390fef[_0x7060('0x71')]||![];this[_0x7060('0x72')]=monitorFormat[_0x390fef['monitor_format']]?monitorFormat[_0x390fef[_0x7060('0x72')]]:undefined;this[_0x7060('0x73')]=_0x390fef['mandatoryDisposition']||![];this[_0x7060('0x74')]=_0x390fef[_0x7060('0x74')]?_0x390fef[_0x7060('0x74')]:undefined;}module[_0x7060('0x75')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index 85fdbb6..158039a 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 _0xd04b=['username','accessKey','remoteUri','serverUrl','Configurations','name'];(function(_0x25817c,_0x449876){var _0x652ca=function(_0x226345){while(--_0x226345){_0x25817c['push'](_0x25817c['shift']());}};_0x652ca(++_0x449876);}(_0xd04b,0x173));var _0xbd04=function(_0x3e5c72,_0x51df34){_0x3e5c72=_0x3e5c72-0x0;var _0x4e3bc3=_0xd04b[_0x3e5c72];return _0x4e3bc3;};'use strict';function VtigerAccount(_0x11bbf7){this['id']=_0x11bbf7['id']||0x0;this[_0xbd04('0x0')]=_0x11bbf7[_0xbd04('0x0')]||'';this[_0xbd04('0x1')]=_0x11bbf7[_0xbd04('0x1')]||'';this[_0xbd04('0x2')]=_0x11bbf7[_0xbd04('0x2')]||'';this['remoteUri']=_0x11bbf7[_0xbd04('0x3')]||'';this['serverUrl']=_0x11bbf7[_0xbd04('0x4')]||'';this[_0xbd04('0x5')]=_0x11bbf7[_0xbd04('0x5')]||{};}module['exports']=VtigerAccount; \ No newline at end of file +var _0xe825=['serverUrl','Configurations','exports','name','username','accessKey','remoteUri'];(function(_0x4c3ae3,_0x14085e){var _0x25063b=function(_0x19a3af){while(--_0x19a3af){_0x4c3ae3['push'](_0x4c3ae3['shift']());}};_0x25063b(++_0x14085e);}(_0xe825,0x16f));var _0x5e82=function(_0x38e9cc,_0x4c0f16){_0x38e9cc=_0x38e9cc-0x0;var _0x3e4b1d=_0xe825[_0x38e9cc];return _0x3e4b1d;};'use strict';function VtigerAccount(_0x2479ff){this['id']=_0x2479ff['id']||0x0;this[_0x5e82('0x0')]=_0x2479ff[_0x5e82('0x0')]||'';this[_0x5e82('0x1')]=_0x2479ff['username']||'';this['accessKey']=_0x2479ff[_0x5e82('0x2')]||'';this[_0x5e82('0x3')]=_0x2479ff[_0x5e82('0x3')]||'';this[_0x5e82('0x4')]=_0x2479ff[_0x5e82('0x4')]||'';this[_0x5e82('0x5')]=_0x2479ff[_0x5e82('0x5')]||{};}module[_0x5e82('0x6')]=VtigerAccount; \ No newline at end of file diff --git a/server/services/ami/model/zendeskAccount.js b/server/services/ami/model/zendeskAccount.js index 41516c3..54fdac9 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 _0x41b0=['username','password','remoteUri','authType','type','integrationTab','serverUrl','Configurations','name'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x41b0,0x1af));var _0x041b=function(_0x1f99a0,_0x50b73d){_0x1f99a0=_0x1f99a0-0x0;var _0x1e0849=_0x41b0[_0x1f99a0];return _0x1e0849;};'use strict';function ZendeskAccount(_0x1f27ae){this['id']=_0x1f27ae['id']||0x0;this[_0x041b('0x0')]=_0x1f27ae['name']||'';this[_0x041b('0x1')]=_0x1f27ae[_0x041b('0x1')]||'';this[_0x041b('0x2')]=_0x1f27ae['password']||'';this['token']=_0x1f27ae['token']||'';this[_0x041b('0x3')]=_0x1f27ae[_0x041b('0x3')]||'';this['authType']=_0x1f27ae[_0x041b('0x4')]||'';this[_0x041b('0x5')]=_0x1f27ae['type']||_0x041b('0x6');this[_0x041b('0x7')]=_0x1f27ae[_0x041b('0x7')]||'';this[_0x041b('0x8')]=_0x1f27ae['Configurations']||{};}module['exports']=ZendeskAccount; \ No newline at end of file +var _0xd002=['password','token','remoteUri','authType','type','integrationTab','serverUrl','Configurations','exports','name','username'];(function(_0x3a58f9,_0x4810b9){var _0x1bcd94=function(_0x1dbd3e){while(--_0x1dbd3e){_0x3a58f9['push'](_0x3a58f9['shift']());}};_0x1bcd94(++_0x4810b9);}(_0xd002,0x13d));var _0x2d00=function(_0x88c29e,_0x1e283b){_0x88c29e=_0x88c29e-0x0;var _0x4453ab=_0xd002[_0x88c29e];return _0x4453ab;};'use strict';function ZendeskAccount(_0x449d3e){this['id']=_0x449d3e['id']||0x0;this[_0x2d00('0x0')]=_0x449d3e[_0x2d00('0x0')]||'';this[_0x2d00('0x1')]=_0x449d3e[_0x2d00('0x1')]||'';this[_0x2d00('0x2')]=_0x449d3e[_0x2d00('0x2')]||'';this[_0x2d00('0x3')]=_0x449d3e['token']||'';this[_0x2d00('0x4')]=_0x449d3e['remoteUri']||'';this[_0x2d00('0x5')]=_0x449d3e[_0x2d00('0x5')]||'';this['type']=_0x449d3e[_0x2d00('0x6')]||_0x2d00('0x7');this[_0x2d00('0x8')]=_0x449d3e['serverUrl']||'';this['Configurations']=_0x449d3e[_0x2d00('0x9')]||{};}module[_0x2d00('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 7c3fedd..2df1bbf 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 _0x92d8=['zone','clientId','clientSecret','serverUrl','code','refreshToken','Configurations','exports','name','description','host'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x92d8,0x1e1));var _0x892d=function(_0x4266b2,_0x4feeb6){_0x4266b2=_0x4266b2-0x0;var _0x4511cb=_0x92d8[_0x4266b2];return _0x4511cb;};'use strict';function ZohoAccount(_0x50f8cd){this['id']=_0x50f8cd['id']||0x0;this[_0x892d('0x0')]=_0x50f8cd[_0x892d('0x0')]||'';this[_0x892d('0x1')]=_0x50f8cd['description']||'';this['host']=_0x50f8cd[_0x892d('0x2')]||'';this[_0x892d('0x3')]=_0x50f8cd[_0x892d('0x3')]||'';this[_0x892d('0x4')]=_0x50f8cd[_0x892d('0x4')]||'';this[_0x892d('0x5')]=_0x50f8cd[_0x892d('0x5')]||'';this[_0x892d('0x6')]=_0x50f8cd[_0x892d('0x6')]||'';this['code']=_0x50f8cd[_0x892d('0x7')]||'';this[_0x892d('0x8')]=_0x50f8cd[_0x892d('0x8')]||'';this[_0x892d('0x9')]=_0x50f8cd[_0x892d('0x9')]||{};}module[_0x892d('0xa')]=ZohoAccount; \ No newline at end of file +var _0xea19=['Configurations','exports','name','description','zone','clientId','clientSecret','serverUrl','code','refreshToken'];(function(_0x39812f,_0x657124){var _0x2ee3ed=function(_0x3f9c6f){while(--_0x3f9c6f){_0x39812f['push'](_0x39812f['shift']());}};_0x2ee3ed(++_0x657124);}(_0xea19,0x156));var _0x9ea1=function(_0x4e93a9,_0x413f30){_0x4e93a9=_0x4e93a9-0x0;var _0x43013c=_0xea19[_0x4e93a9];return _0x43013c;};'use strict';function ZohoAccount(_0x3b6d8e){this['id']=_0x3b6d8e['id']||0x0;this['name']=_0x3b6d8e[_0x9ea1('0x0')]||'';this[_0x9ea1('0x1')]=_0x3b6d8e[_0x9ea1('0x1')]||'';this['host']=_0x3b6d8e['host']||'';this[_0x9ea1('0x2')]=_0x3b6d8e['zone']||'';this[_0x9ea1('0x3')]=_0x3b6d8e[_0x9ea1('0x3')]||'';this[_0x9ea1('0x4')]=_0x3b6d8e[_0x9ea1('0x4')]||'';this[_0x9ea1('0x5')]=_0x3b6d8e[_0x9ea1('0x5')]||'';this[_0x9ea1('0x6')]=_0x3b6d8e[_0x9ea1('0x6')]||'';this[_0x9ea1('0x7')]=_0x3b6d8e[_0x9ea1('0x7')]||'';this[_0x9ea1('0x8')]=_0x3b6d8e[_0x9ea1('0x8')]||{};}module[_0x9ea1('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 d5a3fdc..2dd8ac1 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 _0xa9af=['countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','prototype','getCaller','exports','util','lodash','isNil','string','uniqueid','idContact','name','type','campaigntype','queue','membername','Agent','channelAgent','format','SIP/%s','calleridname','phone','firstName','Contact','lastName','active','countbusyretry','countcongestionretry','countnoanswerretry'];(function(_0x11f5ff,_0xa0ef18){var _0x46eefb=function(_0x51872a){while(--_0x51872a){_0x11f5ff['push'](_0x11f5ff['shift']());}};_0x46eefb(++_0xa0ef18);}(_0xa9af,0x115));var _0xfa9a=function(_0x571af9,_0x4d5932){_0x571af9=_0x571af9-0x0;var _0x827624=_0xa9af[_0x571af9];return _0x827624;};'use strict';var util=require(_0xfa9a('0x0'));var _=require(_0xfa9a('0x1'));var moment=require('moment');function checkNameSurname(_0x3df133,_0x4d1f70,_0x4cef6c){var _0x51de7c='';if(!_[_0xfa9a('0x2')](_0x4d1f70)&&'string'===typeof _0x4d1f70){_0x51de7c+=_0x4d1f70;}if(!_[_0xfa9a('0x2')](_0x4cef6c)&&_0xfa9a('0x3')===typeof _0x4cef6c){_0x51de7c+='\x20'+_0x4cef6c;}if(_0x51de7c!==''){return _0x51de7c;}return _0x3df133;}function Action(_0x13be9a,_0x5e77fb,_0x554701,_0x545640,_0x5103bf){this[_0xfa9a('0x4')]=_0x554701||undefined;this[_0xfa9a('0x5')]=_0x13be9a['id'];this['queue']=_0x5e77fb[_0xfa9a('0x6')];this[_0xfa9a('0x7')]=_0x5e77fb[_0xfa9a('0x7')];this[_0xfa9a('0x8')]=_0xfa9a('0x9');this['dialAnswer']=![];this[_0xfa9a('0xa')]=_[_0xfa9a('0x2')](_0x13be9a[_0xfa9a('0xb')])?undefined:_0x13be9a[_0xfa9a('0xb')][_0xfa9a('0x6')];this[_0xfa9a('0xc')]=this['membername']?util[_0xfa9a('0xd')](_0xfa9a('0xe'),this[_0xfa9a('0xa')]):_0x545640||undefined;this[_0xfa9a('0xf')]=checkNameSurname(_0x13be9a['Contact'][_0xfa9a('0x10')],_0x13be9a['Contact'][_0xfa9a('0x11')],_0x13be9a[_0xfa9a('0x12')][_0xfa9a('0x13')]);this[_0xfa9a('0x14')]=_0x13be9a[_0xfa9a('0x14')]||![];this['calleridnum']=_0x13be9a[_0xfa9a('0x12')][_0xfa9a('0x10')];this['scheduledat']=_0x13be9a['scheduledat'];this[_0xfa9a('0x15')]=_0x13be9a[_0xfa9a('0x15')]||0x0;this[_0xfa9a('0x16')]=_0x13be9a[_0xfa9a('0x16')]||0x0;this['countnoanswerretry']=_0x13be9a[_0xfa9a('0x17')]||0x0;this[_0xfa9a('0x18')]=(_0x13be9a[_0xfa9a('0x15')]||0x0)+(_0x13be9a[_0xfa9a('0x16')]||0x0)+(_0x13be9a['countnoanswerretry']||0x0)+(_0x13be9a[_0xfa9a('0x19')]||0x0)+(_0x13be9a[_0xfa9a('0x1a')]||0x0)+(_0x13be9a[_0xfa9a('0x1b')]||0x0)+(_0x13be9a['countmachineretry']||0x0)+(_0x13be9a[_0xfa9a('0x1c')]||0x0);this[_0xfa9a('0x19')]=_0x13be9a[_0xfa9a('0x19')]||0x0;this['countdropretry']=_0x13be9a[_0xfa9a('0x1a')]||0x0;this[_0xfa9a('0x1b')]=_0x13be9a[_0xfa9a('0x1b')]||0x0;this['countmachineretry']=_0x13be9a[_0xfa9a('0x1d')]||0x0;this[_0xfa9a('0x1c')]=_0x13be9a[_0xfa9a('0x1c')]||0x0;this[_0xfa9a('0x1e')]=_0x13be9a[_0xfa9a('0x1e')];this[_0xfa9a('0x1f')]=_0x13be9a[_0xfa9a('0x1f')];this['callbackat']=_0x13be9a[_0xfa9a('0x20')];this[_0xfa9a('0x21')]=_0x13be9a[_0xfa9a('0x21')];this['ContactId']=_0x13be9a[_0xfa9a('0x22')];this[_0xfa9a('0x23')]=_0x13be9a[_0xfa9a('0x23')];this[_0xfa9a('0x24')]=_['isNil'](_0x13be9a[_0xfa9a('0xb')])?_0x13be9a['UserId']:_0x13be9a[_0xfa9a('0xb')]['id'];this[_0xfa9a('0x25')]=_0x13be9a[_0xfa9a('0x25')];this[_0xfa9a('0x26')]='';this[_0xfa9a('0x27')]='';}Action[_0xfa9a('0x28')][_0xfa9a('0x29')]=function(){return util[_0xfa9a('0xd')]('\x22%s\x22\x20<%s>',this[_0xfa9a('0xf')],this['number']);};module[_0xfa9a('0x2a')]=Action; \ No newline at end of file +var _0xce76=['ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','number','exports','util','lodash','moment','isNil','string','uniqueid','idContact','queue','name','type','campaigntype','dialAnswer','Agent','channelAgent','format','membername','calleridname','phone','Contact','firstName','lastName','active','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','callback','callbackuniqueid','callbackat','ContactId'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xce76,0xeb));var _0x6ce7=function(_0x55a217,_0xbc6e47){_0x55a217=_0x55a217-0x0;var _0x8a780b=_0xce76[_0x55a217];return _0x8a780b;};'use strict';var util=require(_0x6ce7('0x0'));var _=require(_0x6ce7('0x1'));var moment=require(_0x6ce7('0x2'));function checkNameSurname(_0x517189,_0x203daf,_0x1d345c){var _0x567874='';if(!_[_0x6ce7('0x3')](_0x203daf)&&_0x6ce7('0x4')===typeof _0x203daf){_0x567874+=_0x203daf;}if(!_[_0x6ce7('0x3')](_0x1d345c)&&_0x6ce7('0x4')===typeof _0x1d345c){_0x567874+='\x20'+_0x1d345c;}if(_0x567874!==''){return _0x567874;}return _0x517189;}function Action(_0x2d89b9,_0x55957c,_0x32397,_0x245608,_0x17cdd1){this[_0x6ce7('0x5')]=_0x32397||undefined;this[_0x6ce7('0x6')]=_0x2d89b9['id'];this[_0x6ce7('0x7')]=_0x55957c[_0x6ce7('0x8')];this[_0x6ce7('0x9')]=_0x55957c[_0x6ce7('0x9')];this[_0x6ce7('0xa')]='queue';this[_0x6ce7('0xb')]=![];this['membername']=_[_0x6ce7('0x3')](_0x2d89b9[_0x6ce7('0xc')])?undefined:_0x2d89b9[_0x6ce7('0xc')][_0x6ce7('0x8')];this[_0x6ce7('0xd')]=this['membername']?util[_0x6ce7('0xe')]('SIP/%s',this[_0x6ce7('0xf')]):_0x245608||undefined;this[_0x6ce7('0x10')]=checkNameSurname(_0x2d89b9['Contact'][_0x6ce7('0x11')],_0x2d89b9[_0x6ce7('0x12')][_0x6ce7('0x13')],_0x2d89b9[_0x6ce7('0x12')][_0x6ce7('0x14')]);this[_0x6ce7('0x15')]=_0x2d89b9[_0x6ce7('0x15')]||![];this['calleridnum']=_0x2d89b9[_0x6ce7('0x12')][_0x6ce7('0x11')];this[_0x6ce7('0x16')]=_0x2d89b9['scheduledat'];this['countbusyretry']=_0x2d89b9[_0x6ce7('0x17')]||0x0;this[_0x6ce7('0x18')]=_0x2d89b9[_0x6ce7('0x18')]||0x0;this[_0x6ce7('0x19')]=_0x2d89b9['countnoanswerretry']||0x0;this['countglobal']=(_0x2d89b9['countbusyretry']||0x0)+(_0x2d89b9[_0x6ce7('0x18')]||0x0)+(_0x2d89b9[_0x6ce7('0x19')]||0x0)+(_0x2d89b9[_0x6ce7('0x1a')]||0x0)+(_0x2d89b9[_0x6ce7('0x1b')]||0x0)+(_0x2d89b9[_0x6ce7('0x1c')]||0x0)+(_0x2d89b9[_0x6ce7('0x1d')]||0x0)+(_0x2d89b9[_0x6ce7('0x1e')]||0x0);this[_0x6ce7('0x1a')]=_0x2d89b9['countnosuchnumberretry']||0x0;this['countdropretry']=_0x2d89b9['countdropretry']||0x0;this[_0x6ce7('0x1c')]=_0x2d89b9[_0x6ce7('0x1c')]||0x0;this[_0x6ce7('0x1d')]=_0x2d89b9[_0x6ce7('0x1d')]||0x0;this['countagentrejectretry']=_0x2d89b9[_0x6ce7('0x1e')]||0x0;this[_0x6ce7('0x1f')]=_0x2d89b9[_0x6ce7('0x1f')];this[_0x6ce7('0x20')]=_0x2d89b9[_0x6ce7('0x20')];this[_0x6ce7('0x21')]=_0x2d89b9[_0x6ce7('0x21')];this['recallme']=_0x2d89b9['recallme'];this[_0x6ce7('0x22')]=_0x2d89b9[_0x6ce7('0x22')];this[_0x6ce7('0x23')]=_0x2d89b9[_0x6ce7('0x23')];this[_0x6ce7('0x24')]=_['isNil'](_0x2d89b9[_0x6ce7('0xc')])?_0x2d89b9['UserId']:_0x2d89b9[_0x6ce7('0xc')]['id'];this[_0x6ce7('0x25')]=_0x2d89b9[_0x6ce7('0x25')];this[_0x6ce7('0x26')]='';this[_0x6ce7('0x27')]='';}Action[_0x6ce7('0x28')][_0x6ce7('0x29')]=function(){return util['format'](_0x6ce7('0x2a'),this[_0x6ce7('0x10')],this[_0x6ce7('0x2b')]);};module[_0x6ce7('0x2c')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index c682ca8..b0aa9a8 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 _0x5e69=['prototype','enqueue','tail','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','bind','hangup','hanguprequest','syncHangupRequest','dialend','syncDialEnd','newexten','syncNewExten','varset','syncVarSet','syncAttendedTransfer','blindtransfer','loopCampaigns','emit','outbound','name','strategy','answered','available','loggedIn','pTalking','sumHoldTime','total','type','abandoned','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalTotalCalls','message','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startProgressive','Trunk','active','Interval','format','voice:queue:%s','voice_queue:save','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','stringify','voice_queue_presence:remove','sendMessageOneNotActive','paused','NOT_ACTIVE','logger','\x20is\x20not\x20active','IS_DISACTIVED','[CampaignPreview]\x20Campaign\x20Queue:\x20','syncCampaigns','hasOwnProperty','clearZombieChannels','setMessage','recallMe','clearZombieChannel','sequence','[clearZombieChannels][talking]','Queue','queue','originated:\x20','pTalking:\x20','pick','VoiceQueueId','ListId','channel','[clearZombieChannel]','dialAnswer','[Dialer][checkChannel][pTalking][Preview]','loggerError','[Dialer][checkChannel][Preview]','[action]','size','getContactRecallMe','then','isNil','length','scheduledat','Agent','voicePause','run','[RecallMe]','catch','logger2','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','logCustomer','RecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[HistoryRecallClose]','createCustomerFinal','[getContactRecallMe]','IsNotLoggedIn','AGENTS_NOT_LOGGED','isActive','isTrunkReachable','TRUNK_IS_NOT_REACHABLE','ACTIVE','callProgressDetectingCustomer','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','custom:agentnosuchnumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','cloneAction','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','scheduledAt','dialNoSuchNumberRetryFrequency','unlockAgent','linkedid','ANSWER','responsetime','uniqueid','\x20Queue','connect','acw','custom:agentConnectPreview','buildAcw','custom:agentcomplete','complete','decrementTalkink','[16]','Answer','crateCustomerReportQueue','sumDuration','talktime','sumBillable','[syncHangup][talking][decrement]','BUSY','countbusyretry','Busy','custom:agentbusy','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','[callProgressDetectingCustomer][logBusy]','rescheduleContact','dialBusyRetryFrequency','activeContact','NOANSWER','NoAnswer','custom:agentnoanswer','noanswer','[callProgressDetectingCustomer][logNoAnswer]','dialGlobalMaxRetry','countnoanswerretry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','outboundCongestionCallsDay','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','countcongestionretry','dialCongestionMaxRetry','CANCEL','countagentrejectretry','AgentReject','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','ABANDONED','outboundAbandonedCallsDay','countabandonedretry','Abandoned','countabandonedetry','[callProgressDetectingCustomer][logAbandoned]','cause-txt','dialstatus','custom:amd','[callProgressDetectingCustomer][hangupInAMD]','amd','[callProgressDetectingCustomer][machine]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknownGlobal]','updateOriginated','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','callProgressDetectingAgent','isUndefined','object','createAgentHistory','logAgent','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','[callProgressDetectingAgent]','checkInBlack','Contact','Contact\x20is\x20undefined','lookAgent','isEmpty','execCall','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','idContact','custom:agentcalled','Calling','[Preview][execCall][failure]','Call\x20failed','[Blacklist][error]','Contact\x20in\x20black\x20List','SIP/%s','status','execRun','unlock','unlockContact','recallme','isValid','checkIsBlackList','Contact.phone','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][validateContact][Empty\x20Contact]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20work]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','TrunkBackup','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20work','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','SIP/%s/%s%s','trim','dialCutDigit','phone','substring','callerid','dialRandomLastDigitCallerIdNumber','getCallerId','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','merge','toLowerVariables','Action','variablesAction','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','syncOriginateResponse','actionid','logLookAgent','clone','isFailure','response','rejected','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','[syncHangup][talking][cause]','statedesc','reason','channelstate','transfer','[syncHangup][talking][transfer]','destuniqueid','addVariable','variables','filterKey','variable','keys','[syncVarSet][Preview]','inspect','transfertargetlinkedid','syncBlindTransfer','util','bluebird','uuid','md5','ioredis','../../../config/logger','preview','actionPreview','../ami','./rpcDb','redis','localhost','socket.io-emitter'];(function(_0x1afabf,_0x56fdcc){var _0x497ff1=function(_0x2f6104){while(--_0x2f6104){_0x1afabf['push'](_0x1afabf['shift']());}};_0x497ff1(++_0x56fdcc);}(_0x5e69,0x13d));var _0x95e6=function(_0xc8f5a3,_0x4a02a5){_0xc8f5a3=_0xc8f5a3-0x0;var _0x55041a=_0x5e69[_0xc8f5a3];return _0x55041a;};'use strict';var util=require(_0x95e6('0x0'));var _=require('lodash');var BPromise=require(_0x95e6('0x1'));var uuid=require(_0x95e6('0x2'));var moment=require('moment');var md5=require(_0x95e6('0x3'));var Redis=require(_0x95e6('0x4'));var config=require('../../../config/environment');var logger=require(_0x95e6('0x5'))(_0x95e6('0x6'));var loggerAction=require(_0x95e6('0x5'))(_0x95e6('0x7'));var ami=require(_0x95e6('0x8'));var rpcDb=require(_0x95e6('0x9'));var Action=require('./action');var ut=require('./util/util');config[_0x95e6('0xa')]=_['defaults'](config['redis'],{'host':_0x95e6('0xb'),'port':0x18eb});var io=require(_0x95e6('0xc'))(new Redis(config['redis']));var Sequence=function(){};Sequence[_0x95e6('0xd')][_0x95e6('0xe')]=function(_0x25ca29){this[_0x95e6('0xf')]=this[_0x95e6('0xf')]?this['tail']['finally'](_0x25ca29):_0x25ca29();};function Preview(_0x321c27){this['sequence']=new Sequence();this[_0x95e6('0x10')]=_0x321c27[_0x95e6('0x11')];this[_0x95e6('0x12')]=_0x321c27[_0x95e6('0x12')];this[_0x95e6('0x13')]={};this[_0x95e6('0x14')]=_0x321c27[_0x95e6('0x14')];this[_0x95e6('0x15')]=0x0;ami['on'](_0x95e6('0x16'),this['syncOriginateResponse'][_0x95e6('0x17')](this));ami['on'](_0x95e6('0x18'),this['syncHangup']['bind'](this));ami['on'](_0x95e6('0x19'),this[_0x95e6('0x1a')][_0x95e6('0x17')](this));ami['on'](_0x95e6('0x1b'),this[_0x95e6('0x1c')]['bind'](this));ami['on'](_0x95e6('0x1d'),this[_0x95e6('0x1e')]['bind'](this));ami['on'](_0x95e6('0x1f'),this[_0x95e6('0x20')][_0x95e6('0x17')](this));ami['on']('attendedtransfer',this[_0x95e6('0x21')][_0x95e6('0x17')](this));ami['on'](_0x95e6('0x22'),this['syncBlindTransfer']['bind'](this));this[_0x95e6('0x23')](this[_0x95e6('0x10')]);}function emit(_0x5c85f0,_0x19b636,_0x4940e5){io['to'](_0x5c85f0)[_0x95e6('0x24')](_0x19b636,_0x4940e5);}function emitCampaignPreview(_0x1c601e){if(_0x1c601e['type']===_0x95e6('0x25')){var _0x24821f={'id':_0x1c601e['id'],'name':_0x1c601e[_0x95e6('0x26')],'strategy':_0x1c601e[_0x95e6('0x27')],'answered':_0x1c601e[_0x95e6('0x28')],'available':_0x1c601e[_0x95e6('0x29')],'loggedIn':_0x1c601e[_0x95e6('0x2a')],'pTalking':_0x1c601e[_0x95e6('0x2b')],'sumBillable':_0x1c601e['sumBillable'],'sumDuration':_0x1c601e['sumDuration'],'sumHoldTime':_0x1c601e[_0x95e6('0x2c')]||0x0,'talking':_0x1c601e['talking'],'total':_0x1c601e[_0x95e6('0x2d')],'type':_0x1c601e[_0x95e6('0x2e')],'unmanaged':_0x1c601e['unmanaged'],'abandoned':_0x1c601e[_0x95e6('0x2f')],'waiting':_0x1c601e[_0x95e6('0x30')],'loggedInDb':_0x1c601e[_0x95e6('0x31')],'dialActive':_0x1c601e[_0x95e6('0x32')],'dialMethod':_0x1c601e[_0x95e6('0x33')],'dialOriginateCallerIdName':_0x1c601e[_0x95e6('0x34')],'dialOriginateCallerIdNumber':_0x1c601e[_0x95e6('0x35')],'dialOriginateTimeout':_0x1c601e[_0x95e6('0x36')],'dialPrefix':_0x1c601e[_0x95e6('0x37')],'outboundAnswerAgiCallsDay':_0x1c601e[_0x95e6('0x38')],'outboundAnswerCallsDay':_0x1c601e[_0x95e6('0x39')],'outboundBlacklistCallsDay':_0x1c601e[_0x95e6('0x3a')],'outboundBusyCallsDay':_0x1c601e[_0x95e6('0x3b')],'outboundCongestionCallsDay':_0x1c601e['outboundCongestionCallsDay'],'outboundDropCallsDayACS':_0x1c601e[_0x95e6('0x3c')],'outboundDropCallsDayCallersExit':_0x1c601e[_0x95e6('0x3d')],'outboundDropCallsDayTimeout':_0x1c601e['outboundDropCallsDayTimeout'],'outboundNoAnswerCallsDay':_0x1c601e['outboundNoAnswerCallsDay'],'outboundNoSuchCallsDay':_0x1c601e[_0x95e6('0x3e')],'outboundOriginateFailureCallsDay':_0x1c601e[_0x95e6('0x3f')],'outboundReCallsDay':_0x1c601e[_0x95e6('0x40')],'outboundRejectCallsDay':_0x1c601e[_0x95e6('0x41')],'outboundUnknownCallsDay':_0x1c601e[_0x95e6('0x42')],'outboundAbandonedCallsDay':_0x1c601e['outboundAbandonedCallsDay'],'predictiveIntervalAnsweredCalls':_0x1c601e['predictiveIntervalAnsweredCalls'],'predictiveIntervalAvgHoldtime':_0x1c601e['predictiveIntervalAvgHoldtime'],'predictiveIntervalAvgTalktime':_0x1c601e['predictiveIntervalAvgTalktime'],'predictiveIntervalDroppedCallsCallersExit':_0x1c601e[_0x95e6('0x43')],'predictiveIntervalDroppedCallsTimeout':_0x1c601e[_0x95e6('0x44')],'predictiveIntervalErlangCalls':_0x1c601e['predictiveIntervalErlangCalls'],'predictiveIntervalErlangCallsDroppedCalls':_0x1c601e['predictiveIntervalErlangCallsDroppedCalls'],'predictiveIntervalHitRate':_0x1c601e['predictiveIntervalHitRate'],'predictiveIntervalMultiplicativeFactor':_0x1c601e[_0x95e6('0x45')],'predictiveIntervalPauses':_0x1c601e[_0x95e6('0x46')],'predictiveIntervalAvailable':_0x1c601e['predictiveIntervalAvailable'],'predictiveIntervalTotalCalls':_0x1c601e[_0x95e6('0x47')],'message':_0x1c601e[_0x95e6('0x48')],'originated':_0x1c601e[_0x95e6('0x49')],'erlangCalls':_0x1c601e[_0x95e6('0x4a')],'erlangCallToSecond':_0x1c601e[_0x95e6('0x4b')],'erlangAbandonmentRate':_0x1c601e[_0x95e6('0x4c')],'erlangBusyFactor':_0x1c601e[_0x95e6('0x4d')],'startPredictive':_0x1c601e['startPredictive'],'startProgressive':_0x1c601e[_0x95e6('0x4e')]};if(_0x1c601e[_0x95e6('0x4f')]){_0x24821f[_0x95e6('0x4f')]={'id':_0x1c601e[_0x95e6('0x4f')]['id'],'name':_0x1c601e['Trunk']['name'],'active':_0x1c601e['Trunk'][_0x95e6('0x50')],'callerid':_0x1c601e[_0x95e6('0x4f')]['callerid']};}if(_0x1c601e['Interval']){_0x24821f['Interval']={'id':_0x1c601e[_0x95e6('0x51')]['id'],'name':_0x1c601e[_0x95e6('0x51')][_0x95e6('0x26')]};}var _0x1b3851=md5(JSON['stringify'](_0x24821f));if(_0x1c601e[_0x95e6('0x3')]!==_0x1b3851){_0x1c601e['md5']=_0x1b3851;emit(util[_0x95e6('0x52')](_0x95e6('0x53'),_0x24821f['name']),_0x95e6('0x54'),_0x24821f);}}}function emitVoiceQueueChannelRemove(_0x544299){logger[_0x95e6('0x55')](_0x95e6('0x56'),JSON[_0x95e6('0x57')](_0x544299));emit(util[_0x95e6('0x52')](_0x95e6('0x53'),_0x544299['name']),'voice_queue_channel:remove',_0x544299);io[_0x95e6('0x24')](_0x95e6('0x58'),_0x544299);}function notSendMessagesQueue(_0x52b112){if(_0x52b112[_0x95e6('0x59')]){if(_0x52b112['originated']===0x0&&_0x52b112[_0x95e6('0x2b')]===0x0){_0x52b112[_0x95e6('0x59')]=![];_0x52b112['available']=0x0;_0x52b112[_0x95e6('0x5a')]=0x0;_0x52b112[_0x95e6('0x48')]=_0x95e6('0x5b');ut[_0x95e6('0x5c')]('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x52b112[_0x95e6('0x26')]+_0x95e6('0x5d'));}else{_0x52b112[_0x95e6('0x48')]=_0x95e6('0x5e');ut['logger'](_0x95e6('0x5f'),_0x52b112[_0x95e6('0x26')]+'\x20is\x20disactive');}emitCampaignPreview(_0x52b112);}}Preview['prototype'][_0x95e6('0x23')]=function(){var _0x3acf9f=this;setInterval(function(){_0x3acf9f[_0x95e6('0x60')]();},0x7cf);};Preview[_0x95e6('0xd')]['syncCampaigns']=function(){var _0x137c65=this[_0x95e6('0x10')];this['clockClearZombieChannels']+=0x1;for(var _0xea82b3 in _0x137c65){if(_0x137c65[_0x95e6('0x61')](_0xea82b3)&&(_0x137c65[_0xea82b3][_0x95e6('0x33')]===_0x95e6('0x6')||_0x137c65[_0xea82b3][_0x95e6('0x33')]==='booked')&&_0x137c65[_0xea82b3][_0x95e6('0x2e')]===_0x95e6('0x25')){if(this[_0x95e6('0x15')]>0x7){this[_0x95e6('0x15')]=0x0;this[_0x95e6('0x62')]();}}if(_0x137c65[_0x95e6('0x61')](_0xea82b3)&&_0x137c65[_0xea82b3][_0x95e6('0x33')]===_0x95e6('0x6')&&_0x137c65[_0xea82b3]['type']===_0x95e6('0x25')){if(_0x137c65[_0xea82b3][_0x95e6('0x32')]){this[_0x95e6('0x63')](_0x137c65[_0xea82b3]);this[_0x95e6('0x64')](_0x137c65[_0xea82b3]);}else{notSendMessagesQueue(_0x137c65[_0xea82b3]);}}}};Preview[_0x95e6('0xd')][_0x95e6('0x65')]=function(_0xab017){var _0x5970d1=this;this[_0x95e6('0x66')][_0x95e6('0xe')](function(){if(!_['isNil'](_0x5970d1[_0x95e6('0x13')][_0xab017])){loggerAction[_0x95e6('0x55')](_0x95e6('0x67'),_0xab017,_0x95e6('0x68'),_0x5970d1[_0x95e6('0x13')][_0xab017][_0x95e6('0x69')],_0x95e6('0x6a'),JSON[_0x95e6('0x57')](_0x5970d1[_0x95e6('0x10')][_0x5970d1[_0x95e6('0x13')][_0xab017]['queue']][_0x95e6('0x49')]),_0x95e6('0x6b'),JSON[_0x95e6('0x57')](_0x5970d1[_0x95e6('0x10')][_0x5970d1[_0x95e6('0x13')][_0xab017][_0x95e6('0x69')]][_0x95e6('0x2b')]),JSON[_0x95e6('0x57')](_0x5970d1[_0x95e6('0x13')][_0xab017]['dialAnswer']),JSON[_0x95e6('0x57')](_[_0x95e6('0x6c')](_0x5970d1[_0x95e6('0x13')][_0xab017],['contactId','UserId',_0x95e6('0x6d'),_0x95e6('0x6e')])));return ami['Action']({'action':'status','channel':_0x5970d1[_0x95e6('0x13')][_0xab017][_0x95e6('0x6f')]})['catch'](function(_0x28c941){if(_0x28c941[_0x95e6('0x48')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x5970d1['actions'][_0xab017]){ut['updateOriginated'](_0x5970d1[_0x95e6('0x10')][_0x5970d1[_0x95e6('0x13')][_0xab017][_0x95e6('0x69')]],_0x95e6('0x70'));if(_0x5970d1[_0x95e6('0x13')][_0xab017][_0x95e6('0x71')]===!![]){ut['decrementTalkink'](_0x5970d1[_0x95e6('0x10')][_0x5970d1[_0x95e6('0x13')][_0xab017][_0x95e6('0x69')]],_0x95e6('0x70'));ut['loggerError'](_0x95e6('0x72')+_0xab017,_0x5970d1['actions'][_0xab017][_0x95e6('0x69')]);}ut[_0x95e6('0x73')](_0x95e6('0x74')+_0xab017,_0x5970d1['actions'][_0xab017][_0x95e6('0x69')]);delete _0x5970d1['actions'][_0xab017];}},0x2328);}});}});};Preview[_0x95e6('0xd')][_0x95e6('0x62')]=function(){var _0x146598=this;loggerAction[_0x95e6('0x55')](_0x95e6('0x75'),_[_0x95e6('0x76')](this[_0x95e6('0x13')]));for(var _0x79c7e0 in this[_0x95e6('0x13')]){if(_0x146598[_0x95e6('0x13')][_0x95e6('0x61')](_0x79c7e0)){_0x146598[_0x95e6('0x65')](_0x79c7e0);}}};Preview[_0x95e6('0xd')][_0x95e6('0x64')]=function(_0x5c0b05){var _0x1efeb3=this;rpcDb[_0x95e6('0x77')](_0x5c0b05['id'],ut['agentReadyId'](this[_0x95e6('0x14')]))[_0x95e6('0x78')](function(_0x2b32d3){if(!_[_0x95e6('0x79')](_0x2b32d3)){for(var _0x196a1b=0x0;_0x196a1b<_0x2b32d3[_0x95e6('0x7a')];_0x196a1b+=0x1){if(ut['getDiff'](_0x2b32d3[_0x196a1b][_0x95e6('0x7b')])<_0x5c0b05['dialRecallMeTimeout']*0x3c){if(_0x2b32d3[_0x196a1b][_0x95e6('0x7c')]&&!_0x2b32d3[_0x196a1b][_0x95e6('0x7c')][_0x95e6('0x7d')]){_0x1efeb3[_0x95e6('0x7e')](_0x2b32d3[_0x196a1b]['id'])[_0x95e6('0x78')](ut['logger2'](_0x95e6('0x7f')))[_0x95e6('0x80')](ut[_0x95e6('0x81')](_0x95e6('0x7f')));}else{rpcDb[_0x95e6('0x82')](_0x2b32d3[_0x196a1b]['id']);}}else{var _0x3f2d23=new Action(_0x2b32d3[_0x196a1b],_0x5c0b05);_0x3f2d23[_0x95e6('0x83')]=moment()[_0x95e6('0x52')](_0x95e6('0x84'));_0x5c0b05[_0x95e6('0x40')]+=0x1;ut[_0x95e6('0x85')](_0x3f2d23,0x17,_0x95e6('0x86'));if(_0x5c0b05['dialRecallInQueue']){rpcDb[_0x95e6('0x87')](ut[_0x95e6('0x88')](_0x2b32d3[_0x196a1b]));rpcDb[_0x95e6('0x89')](_0x3f2d23,_0x95e6('0x8a'));}else{ut[_0x95e6('0x85')](_0x3f2d23,0x16,_0x95e6('0x8b'));rpcDb[_0x95e6('0x89')](_0x3f2d23,_0x95e6('0x8c'));rpcDb[_0x95e6('0x8d')](_0x3f2d23,'[HistoryRecallClose]');}}}}})[_0x95e6('0x80')](ut['logger2'](_0x95e6('0x8e')));};Preview[_0x95e6('0xd')][_0x95e6('0x63')]=function(_0x322228){_0x322228['sendMessageOneNotActive']=!![];if(ut[_0x95e6('0x8f')](_0x322228[_0x95e6('0x2a')])){_0x322228[_0x95e6('0x48')]=_0x95e6('0x90');}else if(!ut[_0x95e6('0x91')](_0x322228['dialActive'])){_0x322228[_0x95e6('0x48')]=_0x95e6('0x5b');}else if(!this[_0x95e6('0x92')](_0x322228[_0x95e6('0x4f')])){if(!this[_0x95e6('0x92')](_0x322228['TrunkBackup'])){_0x322228['message']=_0x95e6('0x93');}else{_0x322228[_0x95e6('0x48')]=_0x95e6('0x94');}}else{_0x322228['message']='ACTIVE';}emitCampaignPreview(_0x322228);};Preview['prototype'][_0x95e6('0x95')]=function(_0x516ec7,_0x57ed44,_0x1f208c){var _0x560c0d=this;var _0x2bf983=this[_0x95e6('0x13')][_0x57ed44];var _0x5e4138=this[_0x95e6('0x10')][_0x2bf983[_0x95e6('0x69')]];var _0x1d4efc;if(_0x5e4138){switch(_0x1f208c){case'1':_0x5e4138['outboundNoSuchCallsDay']+=0x1;_0x2bf983[_0x95e6('0x96')]+=0x1;_0x2bf983[_0x95e6('0x97')]=ut[_0x95e6('0x98')](_0x2bf983);ut[_0x95e6('0x85')](_0x2bf983,0x0,_0x95e6('0x99'));ami['emit'](_0x95e6('0x9a'),ut[_0x95e6('0x9b')](_0x2bf983,_0x95e6('0x9c')));rpcDb[_0x95e6('0x89')](_0x2bf983,_0x95e6('0x9d'));if(ut['totalGlobal'](_0x2bf983)>=_0x5e4138['dialGlobalMaxRetry']){_0x1d4efc=ut[_0x95e6('0x9e')](_0x2bf983,0xf,_0x95e6('0x9f'));rpcDb['createCustomerFinal'](_0x1d4efc,_0x95e6('0xa0'));}else{if(_0x2bf983[_0x95e6('0x96')]>=_0x5e4138[_0x95e6('0xa1')]){rpcDb['createCustomerFinal'](_0x2bf983,_0x95e6('0xa0'));}else{rpcDb['rescheduleContact'](ut[_0x95e6('0xa2')](_0x2bf983,_0x95e6('0x96'),_0x5e4138[_0x95e6('0xa3')]),_0x2bf983[_0x95e6('0xa4')],_0x2bf983['activeContact']);}}delete this['actions'][_0x516ec7[_0x95e6('0xa5')]];break;case _0x95e6('0xa6'):var _0x27713f=moment()[_0x95e6('0x52')](_0x95e6('0x84'));_0x2bf983[_0x95e6('0xa7')]=_0x27713f;_0x2bf983['answertime']=_0x27713f;_0x2bf983[_0x95e6('0x71')]=!![];_0x5e4138[_0x95e6('0x2b')]+=0x1;logger[_0x95e6('0x55')]('[syncHangup][talking][increment]',_0x2bf983[_0x95e6('0xa8')],_0x95e6('0xa9'),_0x5e4138[_0x95e6('0x26')],_0x95e6('0x6b'),_0x5e4138[_0x95e6('0x2b')]);ami[_0x95e6('0x24')]('custom:agentconnect',ut[_0x95e6('0x9b')](_0x2bf983,_0x95e6('0xaa'),this[_0x95e6('0x10')][_0x2bf983[_0x95e6('0x69')]]));if(_0x5e4138[_0x95e6('0xab')]){ami[_0x95e6('0x24')](_0x95e6('0xac'),ut[_0x95e6('0xad')](_0x2bf983));}break;case'16':ami[_0x95e6('0x24')](_0x95e6('0xae'),ut[_0x95e6('0x9b')](_0x2bf983,_0x95e6('0xaf'),this['campaignsPreview'][_0x2bf983[_0x95e6('0x69')]]));emitVoiceQueueChannelRemove(ut[_0x95e6('0x9b')](_0x2bf983,_0x95e6('0xaf')));_0x5e4138[_0x95e6('0x39')]+=0x1;_0x5e4138[_0x95e6('0x2d')]+=0x1;_0x5e4138[_0x95e6('0x28')]+=0x1;ut[_0x95e6('0xb0')](_0x5e4138,_0x95e6('0xb1'));_0x2bf983[_0x95e6('0x97')]=ut[_0x95e6('0x98')](_0x2bf983);ut['logCustomer'](_0x2bf983,0x4,_0x95e6('0xb2'));rpcDb[_0x95e6('0x89')](_0x2bf983,'[callProgressDetectingCustomer][logAnswer]');rpcDb['createCustomerFinal'](_0x2bf983,'[callProgressDetectingCustomer][logAnswerGlobal]');rpcDb[_0x95e6('0xb3')](_0x2bf983);_0x5e4138[_0x95e6('0xb4')]+=_0x2bf983[_0x95e6('0xb5')];_0x5e4138[_0x95e6('0xb6')]+=_0x2bf983[_0x95e6('0xb5')];logger[_0x95e6('0x55')](_0x95e6('0xb7'),_0x2bf983['uniqueid'],'\x20Queue',_0x5e4138[_0x95e6('0x26')],'pTalking:\x20',_0x5e4138[_0x95e6('0x2b')]);delete this[_0x95e6('0x13')][_0x516ec7[_0x95e6('0xa5')]];break;case _0x95e6('0xb8'):_0x5e4138[_0x95e6('0x3b')]+=0x1;_0x2bf983[_0x95e6('0xb9')]+=0x1;_0x2bf983[_0x95e6('0x97')]=ut[_0x95e6('0x98')](_0x2bf983);ut[_0x95e6('0x85')](_0x2bf983,0x5,_0x95e6('0xba'));ami[_0x95e6('0x24')](_0x95e6('0xbb'),ut[_0x95e6('0x9b')](_0x2bf983,'busy'));rpcDb[_0x95e6('0x89')](_0x2bf983,'[callProgressDetectingCustomer][logBusy]');if(ut[_0x95e6('0x98')](_0x2bf983)>=_0x5e4138['dialGlobalMaxRetry']){_0x1d4efc=ut[_0x95e6('0x9e')](_0x2bf983,0xf,'Global');rpcDb[_0x95e6('0x8d')](_0x1d4efc,_0x95e6('0xbc'));}else{if(_0x2bf983[_0x95e6('0xb9')]>=_0x5e4138[_0x95e6('0xbd')]){rpcDb[_0x95e6('0x8d')](_0x2bf983,_0x95e6('0xbe'));}else{rpcDb[_0x95e6('0xbf')](ut['scheduledAt'](_0x2bf983,'countbusyretry',_0x5e4138[_0x95e6('0xc0')]),_0x2bf983['unlockAgent'],_0x2bf983[_0x95e6('0xc1')]);}}break;case _0x95e6('0xc2'):_0x5e4138['outboundNoAnswerCallsDay']+=0x1;_0x2bf983['countnoanswerretry']+=0x1;_0x2bf983[_0x95e6('0x97')]=ut[_0x95e6('0x98')](_0x2bf983);ut[_0x95e6('0x85')](_0x2bf983,0x3,_0x95e6('0xc3'));ami['emit'](_0x95e6('0xc4'),ut['buildObj'](_0x2bf983,_0x95e6('0xc5')));rpcDb[_0x95e6('0x89')](_0x2bf983,_0x95e6('0xc6'));if(ut[_0x95e6('0x98')](_0x2bf983)>=_0x5e4138[_0x95e6('0xc7')]){_0x1d4efc=ut['cloneAction'](_0x2bf983,0xf,_0x95e6('0x9f'));rpcDb[_0x95e6('0x8d')](_0x1d4efc,'[callProgressDetectingCustomer][logNoAnswerGlobal]');}else{if(_0x2bf983[_0x95e6('0xc8')]>=_0x5e4138[_0x95e6('0xc9')]){rpcDb[_0x95e6('0x8d')](_0x2bf983,_0x95e6('0xc6'));}else{rpcDb[_0x95e6('0xbf')](ut[_0x95e6('0xa2')](_0x2bf983,_0x95e6('0xc8'),_0x5e4138[_0x95e6('0xca')]),_0x2bf983[_0x95e6('0xa4')],_0x2bf983[_0x95e6('0xc1')]);}}break;case'CONGESTION':_0x5e4138[_0x95e6('0xcb')]+=0x1;_0x2bf983['countcongestionretry']+=0x1;_0x2bf983[_0x95e6('0x97')]=ut[_0x95e6('0x98')](_0x2bf983);ut[_0x95e6('0x85')](_0x2bf983,0x8,_0x95e6('0xcc'));ami[_0x95e6('0x24')](_0x95e6('0xcd'),ut[_0x95e6('0x9b')](_0x2bf983,_0x95e6('0xce')));rpcDb['createCustomerHistory'](_0x2bf983,_0x95e6('0xcf'));if(ut['totalGlobal'](_0x2bf983)>=_0x5e4138[_0x95e6('0xc7')]){_0x1d4efc=ut[_0x95e6('0x9e')](_0x2bf983,0xf,_0x95e6('0x9f'));rpcDb['createCustomerFinal'](_0x1d4efc,_0x95e6('0xd0'));}else{if(_0x2bf983[_0x95e6('0xd1')]>=_0x5e4138[_0x95e6('0xd2')]){rpcDb[_0x95e6('0x8d')](_0x2bf983,'[callProgressDetectingCustomer][logCongestion]');}else{rpcDb[_0x95e6('0xbf')](ut[_0x95e6('0xa2')](_0x2bf983,_0x95e6('0xd1'),_0x5e4138[_0x95e6('0xc0')]),_0x2bf983['unlockAgent'],_0x2bf983[_0x95e6('0xc1')]);}}break;case _0x95e6('0xd3'):_0x5e4138[_0x95e6('0x41')]+=0x1;_0x2bf983[_0x95e6('0xd4')]+=0x1;_0x2bf983['countglobal']=ut[_0x95e6('0x98')](_0x2bf983);ut[_0x95e6('0x85')](_0x2bf983,0x14,_0x95e6('0xd5'));ami[_0x95e6('0x24')](_0x95e6('0xd6'),ut['buildObj'](_0x2bf983,_0x95e6('0xd7')));rpcDb[_0x95e6('0x89')](_0x2bf983,_0x95e6('0xd8'));if(ut['totalGlobal'](_0x2bf983)>=_0x5e4138[_0x95e6('0xc7')]){_0x1d4efc=ut[_0x95e6('0x9e')](_0x2bf983,0x14,_0x95e6('0xd5'));rpcDb[_0x95e6('0x8d')](_0x1d4efc,_0x95e6('0xd9'));}else{if(_0x2bf983[_0x95e6('0xd4')]>=_0x5e4138[_0x95e6('0xda')]){rpcDb[_0x95e6('0x8d')](_0x2bf983,_0x95e6('0xd9'));}else{rpcDb[_0x95e6('0xbf')](ut[_0x95e6('0xa2')](_0x2bf983,_0x95e6('0xd4'),_0x5e4138[_0x95e6('0xdb')]),_0x2bf983[_0x95e6('0xa4')],_0x2bf983[_0x95e6('0xc1')]);}}break;case _0x95e6('0xdc'):_0x5e4138[_0x95e6('0xdd')]+=0x1;_0x2bf983[_0x95e6('0xde')]+=0x1;_0x2bf983[_0x95e6('0x97')]=ut['totalGlobal'](_0x2bf983);ut[_0x95e6('0x85')](_0x2bf983,0xb,_0x95e6('0xdf'));rpcDb[_0x95e6('0x89')](_0x2bf983,'[callProgressDetectingCustomer][logAbandoned]');if(ut['totalGlobal'](_0x2bf983)>=_0x5e4138[_0x95e6('0xc7')]){_0x1d4efc=ut['cloneAction'](_0x2bf983,0xf,_0x95e6('0x9f'));rpcDb[_0x95e6('0x8d')](_0x1d4efc,'[callProgressDetectingCustomer][logAbandoned]');}else{if(_0x2bf983[_0x95e6('0xe0')]>=_0x5e4138['dialAbandonedMaxRety']){rpcDb['createCustomerFinal'](_0x2bf983,_0x95e6('0xe1'));}else{rpcDb['rescheduleContact'](ut[_0x95e6('0xa2')](_0x2bf983,_0x95e6('0xde'),_0x5e4138['dialAbandonedRetryFrequency']),_0x2bf983['unlockAgent'],_0x2bf983['activeContact']);}}break;case'18':_0x5e4138[_0x95e6('0x42')]+=0x1;_0x2bf983['countmachineretry']+=0x1;_0x2bf983['countglobal']=ut[_0x95e6('0x98')](_0x2bf983);ut['logCustomer'](_0x2bf983,0x12,_0x516ec7[_0x95e6('0xe2')]||_0x516ec7[_0x95e6('0xe3')]);ami[_0x95e6('0x24')](_0x95e6('0xe4'),ut[_0x95e6('0x9b')](_0x2bf983,'amd'));rpcDb['createCustomerHistory'](_0x2bf983,_0x95e6('0xe5'));if(ut[_0x95e6('0x98')](_0x2bf983)>=_0x5e4138[_0x95e6('0xc7')]){_0x1d4efc=ut[_0x95e6('0x9e')](_0x2bf983,0xf,_0x95e6('0x9f'));rpcDb[_0x95e6('0x8d')](_0x1d4efc,'[callProgressDetectingCustomer][hangupInAMD]');}else{rpcDb['createCustomerFinal'](_0x2bf983,_0x95e6('0xe5'));}delete this['actions'][_0x516ec7[_0x95e6('0xa5')]];break;case'19':_0x5e4138[_0x95e6('0x42')]+=0x1;_0x2bf983[_0x95e6('0x97')]=ut[_0x95e6('0x98')](_0x2bf983);ut[_0x95e6('0x85')](_0x2bf983,0x13,_0x516ec7[_0x95e6('0xe2')]||_0x516ec7[_0x95e6('0xe3')]);ami[_0x95e6('0x24')]('custom:amd',ut[_0x95e6('0x9b')](_0x2bf983,_0x95e6('0xe6')));rpcDb[_0x95e6('0x89')](_0x2bf983,_0x95e6('0xe7'));if(ut[_0x95e6('0x98')](_0x2bf983)>=_0x5e4138[_0x95e6('0xc7')]){_0x1d4efc=ut['cloneAction'](_0x2bf983,0xf,_0x95e6('0x9f'));rpcDb['createCustomerFinal'](_0x1d4efc,_0x95e6('0xe7'));}else{rpcDb[_0x95e6('0x8d')](_0x2bf983,_0x95e6('0xe7'));}delete this['actions'][_0x516ec7[_0x95e6('0xa5')]];break;default:if(_0x2bf983[_0x95e6('0x71')]){ut[_0x95e6('0xb0')](_0x5e4138,'[default]');ut['loggerError'](_0x95e6('0xe8')+_0x5e4138[_0x95e6('0x26')],_0x516ec7);}_0x5e4138['outboundUnknownCallsDay']+=0x1;_0x2bf983['countglobal']=ut[_0x95e6('0x98')](_0x2bf983);ut[_0x95e6('0x85')](_0x2bf983,0xc,_0x516ec7[_0x95e6('0xe2')]||_0x516ec7[_0x95e6('0xe3')]);rpcDb[_0x95e6('0x89')](_0x2bf983,'[callProgressDetectingCustomer][logUnknown]');if(ut[_0x95e6('0x98')](_0x2bf983)>=_0x5e4138[_0x95e6('0xc7')]){_0x1d4efc=ut[_0x95e6('0x9e')](_0x2bf983,0xf,_0x95e6('0x9f'));rpcDb[_0x95e6('0x8d')](_0x1d4efc,'[callProgressDetectingCustomer][logUnknownGlobal]');}else{rpcDb['createCustomerFinal'](_0x2bf983,_0x95e6('0xe9'));}delete this['actions'][_0x516ec7['linkedid']];}if(!(_0x2bf983['dialAnswer']&&_0x1f208c==='16')){ut[_0x95e6('0xea')](_0x5e4138,_0x95e6('0xeb'));logger[_0x95e6('0x55')](_0x95e6('0xec'),_0x2bf983[_0x95e6('0xa8')],'\x20Queue',_0x5e4138[_0x95e6('0x26')],_0x95e6('0x6a'),_0x5e4138['originated']);}if(_0x1f208c!==_0x95e6('0xa6')){delete this[_0x95e6('0x13')][_0x516ec7[_0x95e6('0xa5')]];delete this[_0x95e6('0x13')][_0x516ec7[_0x95e6('0xed')]];}}};Preview[_0x95e6('0xd')][_0x95e6('0xee')]=function(_0x10f900,_0x4accea,_0x1bfa14){if(_[_0x95e6('0xef')](_0x4accea)&&_0x95e6('0xf0')!==typeof _0x4accea){return;}if(_[_0x95e6('0xef')](_0x1bfa14)&&'object'!==typeof _0x1bfa14){return;}switch(_0x1bfa14['reason']){case'0':ut['logAgent'](_0x10f900,0x0,_0x95e6('0x99'));rpcDb[_0x95e6('0xf1')](_0x10f900,'[callProgressDetectingAgent][logNoSuch]');break;case'3':ut[_0x95e6('0xf2')](_0x10f900,0x3,'NoAnswer');rpcDb[_0x95e6('0xf1')](_0x10f900,_0x95e6('0xf3'));break;case'5':ut[_0x95e6('0xf2')](_0x10f900,0x5,_0x95e6('0xba'));rpcDb['createAgentHistory'](_0x10f900,_0x95e6('0xf4'));break;case'8':ut[_0x95e6('0xf2')](_0x10f900,0x8,_0x95e6('0xcc'));rpcDb[_0x95e6('0xf1')](_0x10f900,_0x95e6('0xf5'));break;case'22':ut[_0x95e6('0xf2')](_0x10f900,0x16,'AnswerAGI');rpcDb[_0x95e6('0xf1')](_0x10f900,'[callProgressDetectingAgent][logAnswerAGI]');break;default:ut[_0x95e6('0xf2')](_0x10f900,0xc,_0x1bfa14['reason']);rpcDb[_0x95e6('0xf1')](_0x10f900,_0x95e6('0xf5'));}ut[_0x95e6('0xea')](_0x4accea,_0x95e6('0xf6'));logger['info']('[originated][decrement][callProgressDetectingAgent]',_0x10f900[_0x95e6('0xa8')],_0x95e6('0xa9'),_0x4accea['name'],_0x95e6('0x6a'),_0x4accea[_0x95e6('0x49')]);delete this[_0x95e6('0x13')][_0x10f900[_0x95e6('0xa8')]];};Preview['prototype'][_0x95e6('0xf7')]=function(_0x28161e,_0x56f64c,_0x94b16b,_0x4486d3,_0x19496b){var _0x2593bc=this;return new BPromise(function(_0xf22bd3,_0xc1f0dc){if(_[_0x95e6('0x79')](_0x56f64c)||_[_0x95e6('0x79')](_0x56f64c[_0x95e6('0xf8')])||_[_0x95e6('0x79')](_0x56f64c[_0x95e6('0xf8')]['phone'])||_[_0x95e6('0x79')](_0x56f64c[_0x95e6('0x6d')])){_0xc1f0dc(ut[_0x95e6('0x48')](_0x95e6('0xf9'),_0x4486d3,_0x19496b));return;}var _0x248915=uuid['v4']();var _0x45d3b8=_0x2593bc['campaignsPreview'][_0x56f64c[_0x95e6('0x68')]['name']];var _0x3339ec=_0x94b16b?_0x2593bc[_0x95e6('0x14')][_0x94b16b]['id']:undefined;_0x2593bc['actions'][_0x248915]=new Action(_0x56f64c,_0x45d3b8,_0x248915,_0x94b16b,_0x3339ec);var _0xa799a7=_0x2593bc[_0x95e6('0x13')][_0x248915];_0xa799a7[_0x95e6('0xa4')]=_0x4486d3;_0xa799a7[_0x95e6('0xc1')]=_0x19496b;_0xa799a7[_0x95e6('0xfa')]=_0x94b16b;if(_[_0x95e6('0xfb')](_0x28161e)){_0x2593bc[_0x95e6('0xfc')](_0xa799a7,_0x45d3b8,_0x56f64c,_0x94b16b)[_0x95e6('0x78')](function(_0x48a78f){logger[_0x95e6('0x55')](_0x95e6('0xfd'),_0x95e6('0xfe')+_0xa799a7[_0x95e6('0x69')]+_0x95e6('0xff')+_0xa799a7[_0x95e6('0x100')],JSON[_0x95e6('0x57')](_0x48a78f));ami['emit'](_0x95e6('0x101'),ut[_0x95e6('0x9b')](_0xa799a7,'called',_0x2593bc[_0x95e6('0x10')][_0xa799a7['queue']]));_0xf22bd3(ut[_0x95e6('0x48')](_0x95e6('0x102')));})['catch'](function(_0x13e3d3){ut[_0x95e6('0x5c')](_0x95e6('0x103'),_0x13e3d3);_0xc1f0dc(ut['message'](_0x95e6('0x104'),_0x4486d3,_0x19496b));});}else{_0x45d3b8[_0x95e6('0x3a')]+=0x1;ut['logBlacklist'](_0xa799a7);rpcDb['createHistory'](_0xa799a7,_0x95e6('0x105'));delete _0x2593bc[_0x95e6('0x13')][_0x248915];_0xc1f0dc(ut[_0x95e6('0x48')](_0x95e6('0x106'),_0x4486d3,_0x19496b));}});};Preview[_0x95e6('0xd')][_0x95e6('0x92')]=function(_0x468e9a){return!_[_0x95e6('0x79')](_0x468e9a)&&!_[_0x95e6('0x79')](_0x468e9a['name'])&&!_['isNil'](_0x468e9a[_0x95e6('0x50')])&&_0x468e9a['active']&&!_[_0x95e6('0x79')](this['trunks'][util[_0x95e6('0x52')](_0x95e6('0x107'),_0x468e9a['name'])])&&!_[_0x95e6('0x79')](this['trunks'][util[_0x95e6('0x52')](_0x95e6('0x107'),_0x468e9a[_0x95e6('0x26')])][_0x95e6('0x108')])&&(this['trunks'][util[_0x95e6('0x52')](_0x95e6('0x107'),_0x468e9a[_0x95e6('0x26')])][_0x95e6('0x108')]==='reachable'||this[_0x95e6('0x12')][util[_0x95e6('0x52')](_0x95e6('0x107'),_0x468e9a[_0x95e6('0x26')])]['status']==='unmonitored');};Preview[_0x95e6('0xd')][_0x95e6('0x7e')]=function(_0x501af5,_0x197230){var _0x4e9615=this;return new BPromise(function(_0x4bef6d,_0x532f27){_0x4e9615[_0x95e6('0x109')](_0x501af5,_0x197230)[_0x95e6('0x78')](function(_0x214ce8){_0x4bef6d(_[_0x95e6('0x6c')](_0x214ce8,[_0x95e6('0x48')]));})['catch'](function(_0x78000d){if(_0x78000d[_0x95e6('0x10a')]){rpcDb[_0x95e6('0x10b')](_0x501af5);}if(_0x78000d['active']){rpcDb[_0x95e6('0x82')](_0x501af5);}_0x532f27(_[_0x95e6('0x6c')](_0x78000d,['message']));});});};Preview['prototype']['execRun']=function(_0x4258a6,_0x451389){var _0x576ec9=this;return new BPromise(function(_0x8ea318,_0x65e77d){var _0x5c0c31,_0x39cbc0;rpcDb['getContactPreview'](_0x4258a6)[_0x95e6('0x78')](function(_0x5149ef){if(!_['isNil'](_0x5149ef[0x0])){_0x39cbc0=_0x5149ef[0x0][_0x95e6('0x10c')]?![]:!![];_0x5c0c31=_0x5149ef[0x0][_0x95e6('0x10c')]?!![]:![];_0x5c0c31=_0x451389?!![]:_0x5c0c31;}var _0x19b023=_0x576ec9['validateContact'](_0x5149ef);if(_0x19b023[_0x95e6('0x10d')]){rpcDb[_0x95e6('0x10e')](_['pick'](_0x5149ef[0x0],[_0x95e6('0x6d'),_0x95e6('0x10f')]))['then'](function(_0x33b851){_0x576ec9['checkInBlack'](_0x33b851,_0x5149ef[0x0],_0x451389,_0x39cbc0,_0x5c0c31)['then'](function(_0x1cf6f6){_0x8ea318(_0x1cf6f6);})[_0x95e6('0x80')](function(_0x36fc8b){_0x65e77d(_0x36fc8b);});})[_0x95e6('0x80')](function(_0x236cd7){ut['logger'](_0x95e6('0x110'),_0x236cd7);_0x65e77d(ut[_0x95e6('0x48')](_0x95e6('0x111'),_0x39cbc0,_0x5c0c31));});}else{_0x65e77d(ut['message'](_0x19b023[_0x95e6('0x48')],_0x39cbc0,_0x5c0c31));}})[_0x95e6('0x80')](function(_0x214db4){ut[_0x95e6('0x5c')]('[Preview][getContactPreview]',_0x214db4);_0x65e77d(ut['message'](_0x95e6('0x111'),![],!![]));});});};Preview[_0x95e6('0xd')]['validateContact']=function(_0x5b9a1e){if(_[_0x95e6('0x79')](_0x5b9a1e)||_['isEmpty'](_0x5b9a1e)||!_['isNil'](_0x5b9a1e[0x0]['Agent'])&&_[_0x95e6('0x79')](_0x5b9a1e[0x0][_0x95e6('0x7c')][_0x95e6('0x26')])){ut[_0x95e6('0x5c')](_0x95e6('0x112'),_0x5b9a1e);return{'isValid':![],'message':'Empty\x20Contact'};}var _0x1cb4bb=this['campaignsPreview'][_0x5b9a1e[0x0][_0x95e6('0x68')][_0x95e6('0x26')]];_0x1cb4bb['message']=_0x95e6('0x94');if(_[_0x95e6('0x79')](_0x1cb4bb)){ut[_0x95e6('0x5c')]('[Preview][validateContact][Empty\x20Campaign]',_0x1cb4bb);return{'isValid':![],'message':_0x95e6('0x113')};}if(!this['isTrunkReachable'](_0x1cb4bb[_0x95e6('0x4f')])){ut['logger'](_0x95e6('0x114'),_0x95e6('0x115')+_0x1cb4bb[_0x95e6('0x26')]+_0x95e6('0x116'));if(!this[_0x95e6('0x92')](_0x1cb4bb[_0x95e6('0x117')])){ut['logger'](_0x95e6('0x114'),_0x1cb4bb[_0x95e6('0x26')]+_0x95e6('0x118'));return{'isValid':![],'message':_0x95e6('0x119')};}}if(!ut[_0x95e6('0x91')](_0x1cb4bb[_0x95e6('0x32')])){ut[_0x95e6('0x5c')](_0x95e6('0x11a'),_0x1cb4bb[_0x95e6('0x26')]+'\x20Not\x20Active');return{'isValid':![],'message':_0x95e6('0x115')+_0x1cb4bb[_0x95e6('0x26')]+_0x95e6('0x11b')};}return{'isValid':!![],'message':_0x95e6('0x11c')};};Preview['prototype']['execCall']=function(_0x3c10fc,_0x3e8a52,_0x10093b,_0x434934){var _0x2c760c=this;return new BPromise(function(_0x4f1add,_0xd7dde0){var _0x4f4e7d=_0x3c10fc[_0x95e6('0xa8')];var _0x3f929b=_0x2c760c[_0x95e6('0x92')](_0x3e8a52[_0x95e6('0x4f')])?util[_0x95e6('0x52')](_0x95e6('0x11d'),_0x3e8a52[_0x95e6('0x4f')][_0x95e6('0x26')],_[_0x95e6('0x79')](_0x3e8a52[_0x95e6('0x37')])?'':_0x3e8a52[_0x95e6('0x37')][_0x95e6('0x11e')]()||'',_0x3e8a52[_0x95e6('0x11f')]>0x0?_0x10093b['Contact'][_0x95e6('0x120')]['substring'](_0x3e8a52[_0x95e6('0x11f')]):_0x10093b[_0x95e6('0xf8')][_0x95e6('0x120')]):util[_0x95e6('0x52')](_0x95e6('0x11d'),_[_0x95e6('0x79')](_0x3e8a52[_0x95e6('0x117')])?_0x3e8a52[_0x95e6('0x4f')][_0x95e6('0x26')]:_0x3e8a52[_0x95e6('0x117')][_0x95e6('0x26')],_[_0x95e6('0x79')](_0x3e8a52[_0x95e6('0x37')])?'':_0x3e8a52[_0x95e6('0x37')][_0x95e6('0x11e')]()||'',_0x3e8a52[_0x95e6('0x11f')]>0x0?_0x10093b[_0x95e6('0xf8')][_0x95e6('0x120')][_0x95e6('0x121')](_0x3e8a52[_0x95e6('0x11f')]):_0x10093b[_0x95e6('0xf8')]['phone']);var _0x5c2de0=_0x2c760c[_0x95e6('0x92')](_0x3e8a52[_0x95e6('0x4f')])?ut['getCallerId'](_0x3e8a52[_0x95e6('0x4f')][_0x95e6('0x122')],_0x3e8a52[_0x95e6('0x34')],_0x3e8a52[_0x95e6('0x123')]>0x0?ut['getCallerIdRandom'](_0x3e8a52[_0x95e6('0x35')],_0x3e8a52[_0x95e6('0x123')]):_0x3e8a52['dialOriginateCallerIdNumber']):ut[_0x95e6('0x124')](_[_0x95e6('0x79')](_0x3e8a52[_0x95e6('0x117')])?_0x3e8a52['Trunk']['callerid']:_0x3e8a52[_0x95e6('0x117')][_0x95e6('0x122')],_0x3e8a52[_0x95e6('0x34')],_0x3e8a52['dialRandomLastDigitCallerIdNumber']>0x0?ut['getCallerIdRandom'](_0x3e8a52['dialOriginateCallerIdNumber'],_0x3e8a52[_0x95e6('0x123')]):_0x3e8a52[_0x95e6('0x35')]);if(_0x5c2de0){_0x3c10fc[_0x95e6('0x125')]=ut[_0x95e6('0x126')](_0x5c2de0);_0x3c10fc[_0x95e6('0x127')]=ut[_0x95e6('0x128')](_0x5c2de0);}var _0x26a6db=ut['addVariables'](_0x3e8a52,_0x10093b,_0x3f929b,_0x5c2de0,_0x4f4e7d,_0x3c10fc);_[_0x95e6('0x129')](_0x3c10fc,ut[_0x95e6('0x12a')](_0x26a6db));_0x3c10fc['starttime']=moment()[_0x95e6('0x52')](_0x95e6('0x84'));ami[_0x95e6('0x12b')](ut[_0x95e6('0x12c')](_0x3c10fc,_0x3e8a52,_0x26a6db,_0x3c10fc['activeContact'],_0x434934))['then'](function(_0xec25e3){_0x3e8a52[_0x95e6('0x49')]+=0x1;logger[_0x95e6('0x55')](_0x95e6('0x12d'),_0x4f4e7d,_0x95e6('0xa9'),_0x3e8a52['name'],_0x95e6('0x6a'),_0x3e8a52[_0x95e6('0x49')]);_0x4f1add(_0xec25e3);})['catch'](function(_0x2cec15){ut[_0x95e6('0xf2')](_0x3c10fc,0xe,_0x95e6('0x12e'));rpcDb['createAgentHistory'](_0x3c10fc,_0x95e6('0x12f'));_0xd7dde0(_0x2cec15);});});};Preview[_0x95e6('0xd')]['syncNewExten']=function(_0x940cbf){if(this[_0x95e6('0x13')][_0x940cbf[_0x95e6('0xa5')]]){this[_0x95e6('0x13')][_0x940cbf[_0x95e6('0xa5')]][_0x95e6('0x6f')]=_0x940cbf[_0x95e6('0x6f')];}};Preview['prototype'][_0x95e6('0x130')]=function(_0x321b96){var _0x2a804d=this;var _0x215d5c=this[_0x95e6('0x13')][_0x321b96[_0x95e6('0x131')]];if(_0x215d5c){if(_0x215d5c['lookAgent']&&this[_0x95e6('0x14')][_0x215d5c['lookAgent']]){ut[_0x95e6('0x132')](_0x215d5c,this[_0x95e6('0x14')][_0x215d5c[_0x95e6('0xfa')]][_0x95e6('0x26')],this[_0x95e6('0x14')][_0x215d5c['lookAgent']]['id']);}var _0x5f582d=_[_0x95e6('0x133')](_0x215d5c);_0x5f582d[_0x95e6('0xa7')]=moment()['format'](_0x95e6('0x84'));var _0x5ea510=_0x2a804d['campaignsPreview'][_0x215d5c[_0x95e6('0x69')]];if(ut[_0x95e6('0x134')](_0x321b96[_0x95e6('0x135')])){if(_0x215d5c['unlockAgent']){rpcDb[_0x95e6('0x10b')](_0x215d5c[_0x95e6('0x100')]);}if(_0x215d5c[_0x95e6('0xc1')]){rpcDb[_0x95e6('0x82')](_0x215d5c[_0x95e6('0x100')]);}ami[_0x95e6('0x24')]('custom:agentringnoanswer',ut[_0x95e6('0x9b')](_0x215d5c,_0x95e6('0x136'),this[_0x95e6('0x10')][_0x215d5c[_0x95e6('0x69')]]));this['callProgressDetectingAgent'](_0x5f582d,_0x5ea510,_0x321b96);}else{_0x215d5c['starttime']=moment()['format'](_0x95e6('0x84'));ut['logAgent'](_0x5f582d,0x4,'Answer');rpcDb[_0x95e6('0xf1')](_0x5f582d,_0x95e6('0x137'));}}};Preview[_0x95e6('0xd')]['syncHangup']=function(_0xe64b6d){var _0x534743=this;var _0x5ee43b=this[_0x95e6('0x13')][_0xe64b6d[_0x95e6('0xa5')]];var _0xd69d41;if(_0x5ee43b){_0xd69d41=this[_0x95e6('0x10')][_0x5ee43b[_0x95e6('0x69')]];logger['info'](_0x95e6('0x138'),_0xe64b6d['linkedid'],'\x20Queue',_0xd69d41[_0x95e6('0x26')],_0x95e6('0x6b'),_0xd69d41['pTalking']);}if(this[_0x95e6('0x13')][_0xe64b6d[_0x95e6('0xa5')]]&&_0xe64b6d[_0x95e6('0xa5')]!==_0xe64b6d[_0x95e6('0xa8')]){if(_0xe64b6d[_0x95e6('0x139')]==='16'&&this['actions'][_0xe64b6d['linkedid']][_0x95e6('0x71')]){this[_0x95e6('0x95')](_0xe64b6d,_0xe64b6d['linkedid'],_0xe64b6d['cause']);}else if(this['actions'][_0xe64b6d[_0x95e6('0xa5')]]['dialAnswer']){logger[_0x95e6('0x55')](_0x95e6('0x13a'),_0xe64b6d[_0x95e6('0xa5')],_0xe64b6d[_0x95e6('0x139')],_0x95e6('0xa9'),_0xd69d41[_0x95e6('0x26')],_0x95e6('0x6b'),_0xd69d41[_0x95e6('0x2b')]);this['callProgressDetectingCustomer'](_0xe64b6d,_0xe64b6d[_0x95e6('0xa5')],_0xe64b6d[_0x95e6('0x139')]);}}else if(_0x5ee43b&&_['isNil'](_0x5ee43b[_0x95e6('0x13b')])&&_0xd69d41['dialQueueProject']&&_0xe64b6d['linkedid']===_0xe64b6d[_0x95e6('0xa8')]&&_[_0x95e6('0x79')](_0xe64b6d[_0x95e6('0x13c')])&&_0xe64b6d[_0x95e6('0x139')]==='16'&&_0xe64b6d[_0x95e6('0x13d')]==='6'&&_['isUndefined'](_0x5ee43b[_0x95e6('0x13e')])){if(_0x5ee43b[_0x95e6('0xa4')]){rpcDb[_0x95e6('0x10b')](_0x5ee43b[_0x95e6('0x100')]);}if(_0x5ee43b[_0x95e6('0xc1')]){rpcDb['disableContact'](_0x5ee43b[_0x95e6('0x100')]);}_0xe64b6d['reason']='22';this['callProgressDetectingAgent'](_0x5ee43b,_0xd69d41,_0xe64b6d);}else if(_0x5ee43b&&_0x5ee43b[_0x95e6('0x13e')]){if(_0xe64b6d[_0x95e6('0x139')]==='16'&&this['actions'][_0xe64b6d['linkedid']][_0x95e6('0x71')]){logger[_0x95e6('0x55')](_0x95e6('0x13f'),_0xe64b6d[_0x95e6('0xa5')],_0xe64b6d[_0x95e6('0x139')],_0x95e6('0xa9'),_0xd69d41[_0x95e6('0x26')],_0x95e6('0x6b'),_0xd69d41[_0x95e6('0x2b')]);this[_0x95e6('0x95')](_0xe64b6d,_0xe64b6d[_0x95e6('0xa5')],_0xe64b6d[_0x95e6('0x139')]);}else if(this[_0x95e6('0x13')][_0xe64b6d[_0x95e6('0xa5')]][_0x95e6('0x71')]){logger[_0x95e6('0x55')](_0x95e6('0x13a'),_0xe64b6d['linkedid'],_0xe64b6d[_0x95e6('0x139')],_0x95e6('0xa9'),_0xd69d41[_0x95e6('0x26')],'pTalking:\x20',_0xd69d41['pTalking']);this[_0x95e6('0x95')](_0xe64b6d,_0xe64b6d['linkedid'],_0xe64b6d[_0x95e6('0x139')]);}}};Preview['prototype'][_0x95e6('0x1c')]=function(_0x5b3801){if(this[_0x95e6('0x13')][_0x5b3801[_0x95e6('0xed')]]&&_0x5b3801[_0x95e6('0xed')]!==_0x5b3801[_0x95e6('0x140')]){this[_0x95e6('0x95')](_0x5b3801,_0x5b3801[_0x95e6('0xed')],_0x5b3801[_0x95e6('0xe3')]);}};Preview[_0x95e6('0xd')][_0x95e6('0x1a')]=function(_0x42810d){if(this[_0x95e6('0x13')][_0x42810d[_0x95e6('0xa5')]]&&_0x42810d[_0x95e6('0xa5')]!==_0x42810d[_0x95e6('0xa8')]&&!this[_0x95e6('0x13')][_0x42810d['linkedid']][_0x95e6('0x71')]){if(_0x42810d[_0x95e6('0x139')]==='1'){this[_0x95e6('0x95')](_0x42810d,_0x42810d[_0x95e6('0xa5')],_0x42810d['cause']);}}};Preview[_0x95e6('0xd')][_0x95e6('0x141')]=function(_0x245fb5,_0x18df34,_0x2f9344){if(this['actions'][_0x245fb5]){if(_[_0x95e6('0x79')](this[_0x95e6('0x13')][_0x245fb5][_0x95e6('0x142')])){this[_0x95e6('0x13')][_0x245fb5]['variables']={};}this[_0x95e6('0x13')][_0x245fb5][_0x95e6('0x142')][_0x18df34]=_0x2f9344;}};Preview[_0x95e6('0xd')]['syncVarSet']=function(_0x88f56d){try{if(!_[_0x95e6('0x79')](_0x88f56d)){if(ut[_0x95e6('0x143')](_['keys'](_0x88f56d[_0x95e6('0x144')])[0x0])){this[_0x95e6('0x141')](_0x88f56d['uniqueid'],_[_0x95e6('0x145')](_0x88f56d[_0x95e6('0x144')])[0x0],_0x88f56d['value']);}}}catch(_0x37d52d){logger['error'](_0x95e6('0x146'),util[_0x95e6('0x147')](_0x37d52d,{'showHidden':![],'depth':null}));}};Preview['prototype']['syncAttendedTransfer']=function(_0x2f410c){if(_0x2f410c){if(this[_0x95e6('0x13')][_0x2f410c[_0x95e6('0x148')]]){this[_0x95e6('0x13')][_0x2f410c[_0x95e6('0x148')]][_0x95e6('0x13e')]=!![];}}};Preview[_0x95e6('0xd')][_0x95e6('0x149')]=function(_0x509594){if(_0x509594){if(this[_0x95e6('0x13')][_0x509594['transfererlinkedid']]){this[_0x95e6('0x13')][_0x509594['transfererlinkedid']][_0x95e6('0x13e')]=!![];}}};module['exports']=Preview; \ No newline at end of file +var _0xc513=['predictiveIntervalTotalCalls','message','originated','erlangCalls','erlangBusyFactor','startPredictive','Trunk','Interval','stringify','voice:queue:%s','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','format','sendMessageOneNotActive','paused','NOT_ACTIVE','logger','\x20is\x20not\x20active','IS_DISACTIVED','\x20is\x20disactive','syncCampaigns','hasOwnProperty','booked','type','clearZombieChannels','recallMe','clearZombieChannel','isNil','Queue','queue','originated:\x20','pTalking:\x20','dialAnswer','pick','contactId','UserId','VoiceQueueId','ListId','Action','status','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','decrementTalkink','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','[action]','size','getContactRecallMe','agentReadyId','length','scheduledat','dialRecallMeTimeout','Agent','voicePause','run','then','catch','logger2','[RecallMe]','disableContact','starttime','outboundReCallsDay','logCustomer','dialRecallInQueue','createBody','createCustomerHistory','RecallFailedTimeout','createCustomerFinal','[HistoryRecallClose]','setMessage','IsNotLoggedIn','isActive','isTrunkReachable','TrunkBackup','ACTIVE','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','custom:agentnosuchnumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','dialGlobalMaxRetry','cloneAction','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','rescheduleContact','dialNoSuchNumberRetryFrequency','activeContact','linkedid','ANSWER','YYYY-MM-DD\x20HH:mm:ss','responsetime','answertime','uniqueid','custom:agentconnect','connect','custom:agentConnectPreview','buildAcw','custom:agentcomplete','[16]','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','talktime','\x20Queue','BUSY','countbusyretry','Busy','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','scheduledAt','dialBusyRetryFrequency','unlockAgent','countnoanswerretry','NoAnswer','custom:agentnoanswer','[callProgressDetectingCustomer][logNoAnswer]','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','countcongestionretry','Congestion','congestion','[callProgressDetectingCustomer][logCongestion]','dialCongestionMaxRetry','CANCEL','countagentrejectretry','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','ABANDONED','countabandonedretry','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','dialAbandonedRetryFrequency','outboundUnknownCallsDay','dialstatus','amd','[callProgressDetectingCustomer][hangupInAMD]','cause-txt','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','destlinkedid','callProgressDetectingAgent','isUndefined','object','reason','logAgent','[callProgressDetectingAgent][logNoSuch]','createAgentHistory','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent][logCongestion]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','checkInBlack','Contact','phone','Contact\x20is\x20undefined','execCall','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','custom:agentcalled','called','Calling','Call\x20failed','createHistory','[Blacklist][error]','active','SIP/%s','reachable','unmonitored','execRun','unlock','validateContact','checkIsBlackList','Contact.phone','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','[Preview][validateContact][Empty\x20Contact]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20work]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20work','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','SIP/%s/%s%s','trim','dialCutDigit','substring','getCallerId','callerid','getCallerIdRandom','dialRandomLastDigitCallerIdNumber','originatecalleridname','originatecalleridnum','addVariables','toLowerVariables','variablesAction','[originated][increment]','OriginateError','channel','lookAgent','clone','response','unlockContact','idContact','rejected','Answer','[callProgressDetectingAgent][logAnswer]','cause','callProgressDetectingCustomer','[syncHangup][talking][cause]','statedesc','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','destuniqueid','addVariable','variables','filterKey','keys','variable','value','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','bluebird','uuid','moment','md5','ioredis','../../../config/environment','../../../config/logger','preview','actionPreview','./rpcDb','./action','./util/util','redis','defaults','prototype','enqueue','tail','finally','sequence','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','hangup','syncHangup','hanguprequest','syncHangupRequest','syncDialEnd','newexten','syncNewExten','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopCampaigns','emit','outbound','name','strategy','answered','available','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','talking','total','unmanaged','abandoned','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundAbandonedCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable'];(function(_0x47a349,_0x4699d9){var _0x18ab75=function(_0x210796){while(--_0x210796){_0x47a349['push'](_0x47a349['shift']());}};_0x18ab75(++_0x4699d9);}(_0xc513,0xfa));var _0x3c51=function(_0xdaf1ab,_0x365b63){_0xdaf1ab=_0xdaf1ab-0x0;var _0x325bc5=_0xc513[_0xdaf1ab];return _0x325bc5;};'use strict';var util=require(_0x3c51('0x0'));var _=require(_0x3c51('0x1'));var BPromise=require(_0x3c51('0x2'));var uuid=require(_0x3c51('0x3'));var moment=require(_0x3c51('0x4'));var md5=require(_0x3c51('0x5'));var Redis=require(_0x3c51('0x6'));var config=require(_0x3c51('0x7'));var logger=require(_0x3c51('0x8'))(_0x3c51('0x9'));var loggerAction=require('../../../config/logger')(_0x3c51('0xa'));var ami=require('../ami');var rpcDb=require(_0x3c51('0xb'));var Action=require(_0x3c51('0xc'));var ut=require(_0x3c51('0xd'));config[_0x3c51('0xe')]=_[_0x3c51('0xf')](config[_0x3c51('0xe')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x3c51('0xe')]));var Sequence=function(){};Sequence[_0x3c51('0x10')][_0x3c51('0x11')]=function(_0x561ee0){this['tail']=this[_0x3c51('0x12')]?this[_0x3c51('0x12')][_0x3c51('0x13')](_0x561ee0):_0x561ee0();};function Preview(_0xbc3b98){this[_0x3c51('0x14')]=new Sequence();this[_0x3c51('0x15')]=_0xbc3b98[_0x3c51('0x16')];this[_0x3c51('0x17')]=_0xbc3b98[_0x3c51('0x17')];this[_0x3c51('0x18')]={};this[_0x3c51('0x19')]=_0xbc3b98[_0x3c51('0x19')];this[_0x3c51('0x1a')]=0x0;ami['on'](_0x3c51('0x1b'),this[_0x3c51('0x1c')][_0x3c51('0x1d')](this));ami['on'](_0x3c51('0x1e'),this[_0x3c51('0x1f')][_0x3c51('0x1d')](this));ami['on'](_0x3c51('0x20'),this[_0x3c51('0x21')][_0x3c51('0x1d')](this));ami['on']('dialend',this[_0x3c51('0x22')][_0x3c51('0x1d')](this));ami['on'](_0x3c51('0x23'),this[_0x3c51('0x24')]['bind'](this));ami['on']('varset',this[_0x3c51('0x25')][_0x3c51('0x1d')](this));ami['on'](_0x3c51('0x26'),this[_0x3c51('0x27')][_0x3c51('0x1d')](this));ami['on'](_0x3c51('0x28'),this[_0x3c51('0x29')][_0x3c51('0x1d')](this));this[_0x3c51('0x2a')](this['campaignsPreview']);}function emit(_0x192a2d,_0x17ecb2,_0x1cc07e){io['to'](_0x192a2d)[_0x3c51('0x2b')](_0x17ecb2,_0x1cc07e);}function emitCampaignPreview(_0x186c59){if(_0x186c59['type']===_0x3c51('0x2c')){var _0x50143a={'id':_0x186c59['id'],'name':_0x186c59[_0x3c51('0x2d')],'strategy':_0x186c59[_0x3c51('0x2e')],'answered':_0x186c59[_0x3c51('0x2f')],'available':_0x186c59[_0x3c51('0x30')],'loggedIn':_0x186c59[_0x3c51('0x31')],'pTalking':_0x186c59[_0x3c51('0x32')],'sumBillable':_0x186c59[_0x3c51('0x33')],'sumDuration':_0x186c59[_0x3c51('0x34')],'sumHoldTime':_0x186c59[_0x3c51('0x35')]||0x0,'talking':_0x186c59[_0x3c51('0x36')],'total':_0x186c59[_0x3c51('0x37')],'type':_0x186c59['type'],'unmanaged':_0x186c59[_0x3c51('0x38')],'abandoned':_0x186c59[_0x3c51('0x39')],'waiting':_0x186c59['waiting'],'loggedInDb':_0x186c59['loggedInDb'],'dialActive':_0x186c59[_0x3c51('0x3a')],'dialMethod':_0x186c59[_0x3c51('0x3b')],'dialOriginateCallerIdName':_0x186c59[_0x3c51('0x3c')],'dialOriginateCallerIdNumber':_0x186c59[_0x3c51('0x3d')],'dialOriginateTimeout':_0x186c59[_0x3c51('0x3e')],'dialPrefix':_0x186c59[_0x3c51('0x3f')],'outboundAnswerAgiCallsDay':_0x186c59['outboundAnswerAgiCallsDay'],'outboundAnswerCallsDay':_0x186c59[_0x3c51('0x40')],'outboundBlacklistCallsDay':_0x186c59[_0x3c51('0x41')],'outboundBusyCallsDay':_0x186c59[_0x3c51('0x42')],'outboundCongestionCallsDay':_0x186c59[_0x3c51('0x43')],'outboundDropCallsDayACS':_0x186c59[_0x3c51('0x44')],'outboundDropCallsDayCallersExit':_0x186c59['outboundDropCallsDayCallersExit'],'outboundDropCallsDayTimeout':_0x186c59[_0x3c51('0x45')],'outboundNoAnswerCallsDay':_0x186c59[_0x3c51('0x46')],'outboundNoSuchCallsDay':_0x186c59[_0x3c51('0x47')],'outboundOriginateFailureCallsDay':_0x186c59[_0x3c51('0x48')],'outboundReCallsDay':_0x186c59['outboundReCallsDay'],'outboundRejectCallsDay':_0x186c59[_0x3c51('0x49')],'outboundUnknownCallsDay':_0x186c59['outboundUnknownCallsDay'],'outboundAbandonedCallsDay':_0x186c59[_0x3c51('0x4a')],'predictiveIntervalAnsweredCalls':_0x186c59[_0x3c51('0x4b')],'predictiveIntervalAvgHoldtime':_0x186c59[_0x3c51('0x4c')],'predictiveIntervalAvgTalktime':_0x186c59[_0x3c51('0x4d')],'predictiveIntervalDroppedCallsCallersExit':_0x186c59[_0x3c51('0x4e')],'predictiveIntervalDroppedCallsTimeout':_0x186c59[_0x3c51('0x4f')],'predictiveIntervalErlangCalls':_0x186c59['predictiveIntervalErlangCalls'],'predictiveIntervalErlangCallsDroppedCalls':_0x186c59['predictiveIntervalErlangCallsDroppedCalls'],'predictiveIntervalHitRate':_0x186c59[_0x3c51('0x50')],'predictiveIntervalMultiplicativeFactor':_0x186c59[_0x3c51('0x51')],'predictiveIntervalPauses':_0x186c59[_0x3c51('0x52')],'predictiveIntervalAvailable':_0x186c59[_0x3c51('0x53')],'predictiveIntervalTotalCalls':_0x186c59[_0x3c51('0x54')],'message':_0x186c59[_0x3c51('0x55')],'originated':_0x186c59[_0x3c51('0x56')],'erlangCalls':_0x186c59[_0x3c51('0x57')],'erlangCallToSecond':_0x186c59['erlangCallToSecond'],'erlangAbandonmentRate':_0x186c59['erlangAbandonmentRate'],'erlangBusyFactor':_0x186c59[_0x3c51('0x58')],'startPredictive':_0x186c59[_0x3c51('0x59')],'startProgressive':_0x186c59['startProgressive']};if(_0x186c59[_0x3c51('0x5a')]){_0x50143a[_0x3c51('0x5a')]={'id':_0x186c59[_0x3c51('0x5a')]['id'],'name':_0x186c59[_0x3c51('0x5a')][_0x3c51('0x2d')],'active':_0x186c59[_0x3c51('0x5a')]['active'],'callerid':_0x186c59[_0x3c51('0x5a')]['callerid']};}if(_0x186c59['Interval']){_0x50143a[_0x3c51('0x5b')]={'id':_0x186c59[_0x3c51('0x5b')]['id'],'name':_0x186c59[_0x3c51('0x5b')][_0x3c51('0x2d')]};}var _0xf6c8d2=md5(JSON[_0x3c51('0x5c')](_0x50143a));if(_0x186c59['md5']!==_0xf6c8d2){_0x186c59['md5']=_0xf6c8d2;emit(util['format'](_0x3c51('0x5d'),_0x50143a['name']),'voice_queue:save',_0x50143a);}}}function emitVoiceQueueChannelRemove(_0x8a911e){logger[_0x3c51('0x5e')](_0x3c51('0x5f'),JSON[_0x3c51('0x5c')](_0x8a911e));emit(util[_0x3c51('0x60')]('voice:queue:%s',_0x8a911e[_0x3c51('0x2d')]),'voice_queue_channel:remove',_0x8a911e);io[_0x3c51('0x2b')]('voice_queue_presence:remove',_0x8a911e);}function notSendMessagesQueue(_0xfca432){if(_0xfca432[_0x3c51('0x61')]){if(_0xfca432[_0x3c51('0x56')]===0x0&&_0xfca432[_0x3c51('0x32')]===0x0){_0xfca432['sendMessageOneNotActive']=![];_0xfca432[_0x3c51('0x30')]=0x0;_0xfca432[_0x3c51('0x62')]=0x0;_0xfca432[_0x3c51('0x55')]=_0x3c51('0x63');ut[_0x3c51('0x64')]('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0xfca432['name']+_0x3c51('0x65'));}else{_0xfca432[_0x3c51('0x55')]=_0x3c51('0x66');ut[_0x3c51('0x64')]('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0xfca432[_0x3c51('0x2d')]+_0x3c51('0x67'));}emitCampaignPreview(_0xfca432);}}Preview[_0x3c51('0x10')][_0x3c51('0x2a')]=function(){var _0x48ec67=this;setInterval(function(){_0x48ec67[_0x3c51('0x68')]();},0x7cf);};Preview[_0x3c51('0x10')][_0x3c51('0x68')]=function(){var _0x263465=this['campaignsPreview'];this[_0x3c51('0x1a')]+=0x1;for(var _0x3d9fb7 in _0x263465){if(_0x263465[_0x3c51('0x69')](_0x3d9fb7)&&(_0x263465[_0x3d9fb7][_0x3c51('0x3b')]==='preview'||_0x263465[_0x3d9fb7]['dialMethod']===_0x3c51('0x6a'))&&_0x263465[_0x3d9fb7][_0x3c51('0x6b')]==='outbound'){if(this['clockClearZombieChannels']>0x7){this['clockClearZombieChannels']=0x0;this[_0x3c51('0x6c')]();}}if(_0x263465[_0x3c51('0x69')](_0x3d9fb7)&&_0x263465[_0x3d9fb7][_0x3c51('0x3b')]===_0x3c51('0x9')&&_0x263465[_0x3d9fb7][_0x3c51('0x6b')]===_0x3c51('0x2c')){if(_0x263465[_0x3d9fb7][_0x3c51('0x3a')]){this['setMessage'](_0x263465[_0x3d9fb7]);this[_0x3c51('0x6d')](_0x263465[_0x3d9fb7]);}else{notSendMessagesQueue(_0x263465[_0x3d9fb7]);}}}};Preview[_0x3c51('0x10')][_0x3c51('0x6e')]=function(_0x2eb183){var _0x5656b6=this;this[_0x3c51('0x14')][_0x3c51('0x11')](function(){if(!_[_0x3c51('0x6f')](_0x5656b6[_0x3c51('0x18')][_0x2eb183])){loggerAction[_0x3c51('0x5e')]('[clearZombieChannels][talking]',_0x2eb183,_0x3c51('0x70'),_0x5656b6[_0x3c51('0x18')][_0x2eb183][_0x3c51('0x71')],_0x3c51('0x72'),JSON[_0x3c51('0x5c')](_0x5656b6[_0x3c51('0x15')][_0x5656b6[_0x3c51('0x18')][_0x2eb183][_0x3c51('0x71')]][_0x3c51('0x56')]),_0x3c51('0x73'),JSON[_0x3c51('0x5c')](_0x5656b6[_0x3c51('0x15')][_0x5656b6[_0x3c51('0x18')][_0x2eb183]['queue']][_0x3c51('0x32')]),JSON[_0x3c51('0x5c')](_0x5656b6[_0x3c51('0x18')][_0x2eb183][_0x3c51('0x74')]),JSON[_0x3c51('0x5c')](_[_0x3c51('0x75')](_0x5656b6['actions'][_0x2eb183],[_0x3c51('0x76'),_0x3c51('0x77'),_0x3c51('0x78'),_0x3c51('0x79')])));return ami[_0x3c51('0x7a')]({'action':_0x3c51('0x7b'),'channel':_0x5656b6[_0x3c51('0x18')][_0x2eb183]['channel']})['catch'](function(_0x4498dd){if(_0x4498dd[_0x3c51('0x55')]===_0x3c51('0x7c')){setTimeout(function(){if(_0x5656b6[_0x3c51('0x18')][_0x2eb183]){ut[_0x3c51('0x7d')](_0x5656b6['campaignsPreview'][_0x5656b6[_0x3c51('0x18')][_0x2eb183]['queue']],_0x3c51('0x7e'));if(_0x5656b6[_0x3c51('0x18')][_0x2eb183]['dialAnswer']===!![]){ut[_0x3c51('0x7f')](_0x5656b6[_0x3c51('0x15')][_0x5656b6[_0x3c51('0x18')][_0x2eb183]['queue']],_0x3c51('0x7e'));ut[_0x3c51('0x80')](_0x3c51('0x81')+_0x2eb183,_0x5656b6[_0x3c51('0x18')][_0x2eb183][_0x3c51('0x71')]);}ut['loggerError'](_0x3c51('0x82')+_0x2eb183,_0x5656b6[_0x3c51('0x18')][_0x2eb183]['queue']);delete _0x5656b6[_0x3c51('0x18')][_0x2eb183];}},0x2328);}});}});};Preview['prototype'][_0x3c51('0x6c')]=function(){var _0x846caf=this;loggerAction[_0x3c51('0x5e')](_0x3c51('0x83'),_[_0x3c51('0x84')](this[_0x3c51('0x18')]));for(var _0x1ecc93 in this[_0x3c51('0x18')]){if(_0x846caf[_0x3c51('0x18')][_0x3c51('0x69')](_0x1ecc93)){_0x846caf[_0x3c51('0x6e')](_0x1ecc93);}}};Preview[_0x3c51('0x10')]['recallMe']=function(_0x3cae7e){var _0x18b6f5=this;rpcDb[_0x3c51('0x85')](_0x3cae7e['id'],ut[_0x3c51('0x86')](this[_0x3c51('0x19')]))['then'](function(_0x395510){if(!_[_0x3c51('0x6f')](_0x395510)){for(var _0x305cdb=0x0;_0x305cdb<_0x395510[_0x3c51('0x87')];_0x305cdb+=0x1){if(ut['getDiff'](_0x395510[_0x305cdb][_0x3c51('0x88')])<_0x3cae7e[_0x3c51('0x89')]*0x3c){if(_0x395510[_0x305cdb][_0x3c51('0x8a')]&&!_0x395510[_0x305cdb]['Agent'][_0x3c51('0x8b')]){_0x18b6f5[_0x3c51('0x8c')](_0x395510[_0x305cdb]['id'])[_0x3c51('0x8d')](ut['logger2']('[RecallMe]'))[_0x3c51('0x8e')](ut[_0x3c51('0x8f')](_0x3c51('0x90')));}else{rpcDb[_0x3c51('0x91')](_0x395510[_0x305cdb]['id']);}}else{var _0x1f6566=new Action(_0x395510[_0x305cdb],_0x3cae7e);_0x1f6566[_0x3c51('0x92')]=moment()[_0x3c51('0x60')]('YYYY-MM-DD\x20HH:mm:ss');_0x3cae7e[_0x3c51('0x93')]+=0x1;ut[_0x3c51('0x94')](_0x1f6566,0x17,'RecallInQueue');if(_0x3cae7e[_0x3c51('0x95')]){rpcDb['rescheduleContactInQueue'](ut[_0x3c51('0x96')](_0x395510[_0x305cdb]));rpcDb[_0x3c51('0x97')](_0x1f6566,'[HistoryDialRecallInQueue][historyCatch]');}else{ut[_0x3c51('0x94')](_0x1f6566,0x16,_0x3c51('0x98'));rpcDb[_0x3c51('0x97')](_0x1f6566,'[HistoryRecallClose]');rpcDb[_0x3c51('0x99')](_0x1f6566,_0x3c51('0x9a'));}}}}})[_0x3c51('0x8e')](ut[_0x3c51('0x8f')]('[getContactRecallMe]'));};Preview[_0x3c51('0x10')][_0x3c51('0x9b')]=function(_0x2508ba){_0x2508ba['sendMessageOneNotActive']=!![];if(ut[_0x3c51('0x9c')](_0x2508ba[_0x3c51('0x31')])){_0x2508ba['message']='AGENTS_NOT_LOGGED';}else if(!ut[_0x3c51('0x9d')](_0x2508ba[_0x3c51('0x3a')])){_0x2508ba[_0x3c51('0x55')]=_0x3c51('0x63');}else if(!this[_0x3c51('0x9e')](_0x2508ba[_0x3c51('0x5a')])){if(!this[_0x3c51('0x9e')](_0x2508ba[_0x3c51('0x9f')])){_0x2508ba['message']='TRUNK_IS_NOT_REACHABLE';}else{_0x2508ba[_0x3c51('0x55')]=_0x3c51('0xa0');}}else{_0x2508ba[_0x3c51('0x55')]='ACTIVE';}emitCampaignPreview(_0x2508ba);};Preview[_0x3c51('0x10')]['callProgressDetectingCustomer']=function(_0x14969b,_0x35c04e,_0x5d9d48){var _0x25e7d9=this;var _0x22bf3b=this[_0x3c51('0x18')][_0x35c04e];var _0x16f434=this['campaignsPreview'][_0x22bf3b[_0x3c51('0x71')]];var _0x3f5c21;if(_0x16f434){switch(_0x5d9d48){case'1':_0x16f434['outboundNoSuchCallsDay']+=0x1;_0x22bf3b[_0x3c51('0xa1')]+=0x1;_0x22bf3b[_0x3c51('0xa2')]=ut[_0x3c51('0xa3')](_0x22bf3b);ut['logCustomer'](_0x22bf3b,0x0,_0x3c51('0xa4'));ami[_0x3c51('0x2b')](_0x3c51('0xa5'),ut[_0x3c51('0xa6')](_0x22bf3b,_0x3c51('0xa7')));rpcDb[_0x3c51('0x97')](_0x22bf3b,_0x3c51('0xa8'));if(ut[_0x3c51('0xa3')](_0x22bf3b)>=_0x16f434[_0x3c51('0xa9')]){_0x3f5c21=ut[_0x3c51('0xaa')](_0x22bf3b,0xf,_0x3c51('0xab'));rpcDb[_0x3c51('0x99')](_0x3f5c21,_0x3c51('0xac'));}else{if(_0x22bf3b[_0x3c51('0xa1')]>=_0x16f434[_0x3c51('0xad')]){rpcDb[_0x3c51('0x99')](_0x22bf3b,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{rpcDb[_0x3c51('0xae')](ut['scheduledAt'](_0x22bf3b,_0x3c51('0xa1'),_0x16f434[_0x3c51('0xaf')]),_0x22bf3b['unlockAgent'],_0x22bf3b[_0x3c51('0xb0')]);}}delete this['actions'][_0x14969b[_0x3c51('0xb1')]];break;case _0x3c51('0xb2'):var _0x13a098=moment()['format'](_0x3c51('0xb3'));_0x22bf3b[_0x3c51('0xb4')]=_0x13a098;_0x22bf3b[_0x3c51('0xb5')]=_0x13a098;_0x22bf3b[_0x3c51('0x74')]=!![];_0x16f434['pTalking']+=0x1;logger['info']('[syncHangup][talking][increment]',_0x22bf3b[_0x3c51('0xb6')],'\x20Queue',_0x16f434[_0x3c51('0x2d')],'pTalking:\x20',_0x16f434[_0x3c51('0x32')]);ami[_0x3c51('0x2b')](_0x3c51('0xb7'),ut[_0x3c51('0xa6')](_0x22bf3b,_0x3c51('0xb8'),this[_0x3c51('0x15')][_0x22bf3b['queue']]));if(_0x16f434['acw']){ami[_0x3c51('0x2b')](_0x3c51('0xb9'),ut[_0x3c51('0xba')](_0x22bf3b));}break;case'16':ami['emit'](_0x3c51('0xbb'),ut['buildObj'](_0x22bf3b,'complete',this['campaignsPreview'][_0x22bf3b['queue']]));emitVoiceQueueChannelRemove(ut['buildObj'](_0x22bf3b,'complete'));_0x16f434[_0x3c51('0x40')]+=0x1;_0x16f434['total']+=0x1;_0x16f434['answered']+=0x1;ut[_0x3c51('0x7f')](_0x16f434,_0x3c51('0xbc'));_0x22bf3b[_0x3c51('0xa2')]=ut[_0x3c51('0xa3')](_0x22bf3b);ut['logCustomer'](_0x22bf3b,0x4,'Answer');rpcDb[_0x3c51('0x97')](_0x22bf3b,_0x3c51('0xbd'));rpcDb['createCustomerFinal'](_0x22bf3b,_0x3c51('0xbe'));rpcDb[_0x3c51('0xbf')](_0x22bf3b);_0x16f434[_0x3c51('0x34')]+=_0x22bf3b['talktime'];_0x16f434[_0x3c51('0x33')]+=_0x22bf3b[_0x3c51('0xc0')];logger[_0x3c51('0x5e')]('[syncHangup][talking][decrement]',_0x22bf3b['uniqueid'],_0x3c51('0xc1'),_0x16f434[_0x3c51('0x2d')],'pTalking:\x20',_0x16f434[_0x3c51('0x32')]);delete this[_0x3c51('0x18')][_0x14969b[_0x3c51('0xb1')]];break;case _0x3c51('0xc2'):_0x16f434['outboundBusyCallsDay']+=0x1;_0x22bf3b[_0x3c51('0xc3')]+=0x1;_0x22bf3b[_0x3c51('0xa2')]=ut[_0x3c51('0xa3')](_0x22bf3b);ut[_0x3c51('0x94')](_0x22bf3b,0x5,_0x3c51('0xc4'));ami[_0x3c51('0x2b')](_0x3c51('0xc5'),ut[_0x3c51('0xa6')](_0x22bf3b,_0x3c51('0xc6')));rpcDb[_0x3c51('0x97')](_0x22bf3b,_0x3c51('0xc7'));if(ut[_0x3c51('0xa3')](_0x22bf3b)>=_0x16f434[_0x3c51('0xa9')]){_0x3f5c21=ut[_0x3c51('0xaa')](_0x22bf3b,0xf,_0x3c51('0xab'));rpcDb['createCustomerFinal'](_0x3f5c21,_0x3c51('0xc8'));}else{if(_0x22bf3b[_0x3c51('0xc3')]>=_0x16f434[_0x3c51('0xc9')]){rpcDb['createCustomerFinal'](_0x22bf3b,'[callProgressDetectingCustomer][logBusy]');}else{rpcDb[_0x3c51('0xae')](ut[_0x3c51('0xca')](_0x22bf3b,_0x3c51('0xc3'),_0x16f434[_0x3c51('0xcb')]),_0x22bf3b[_0x3c51('0xcc')],_0x22bf3b[_0x3c51('0xb0')]);}}break;case'NOANSWER':_0x16f434[_0x3c51('0x46')]+=0x1;_0x22bf3b[_0x3c51('0xcd')]+=0x1;_0x22bf3b['countglobal']=ut['totalGlobal'](_0x22bf3b);ut[_0x3c51('0x94')](_0x22bf3b,0x3,_0x3c51('0xce'));ami[_0x3c51('0x2b')](_0x3c51('0xcf'),ut[_0x3c51('0xa6')](_0x22bf3b,'noanswer'));rpcDb[_0x3c51('0x97')](_0x22bf3b,_0x3c51('0xd0'));if(ut['totalGlobal'](_0x22bf3b)>=_0x16f434[_0x3c51('0xa9')]){_0x3f5c21=ut['cloneAction'](_0x22bf3b,0xf,_0x3c51('0xab'));rpcDb[_0x3c51('0x99')](_0x3f5c21,'[callProgressDetectingCustomer][logNoAnswerGlobal]');}else{if(_0x22bf3b[_0x3c51('0xcd')]>=_0x16f434[_0x3c51('0xd1')]){rpcDb['createCustomerFinal'](_0x22bf3b,'[callProgressDetectingCustomer][logNoAnswer]');}else{rpcDb['rescheduleContact'](ut[_0x3c51('0xca')](_0x22bf3b,_0x3c51('0xcd'),_0x16f434[_0x3c51('0xd2')]),_0x22bf3b[_0x3c51('0xcc')],_0x22bf3b[_0x3c51('0xb0')]);}}break;case'CONGESTION':_0x16f434[_0x3c51('0x43')]+=0x1;_0x22bf3b[_0x3c51('0xd3')]+=0x1;_0x22bf3b[_0x3c51('0xa2')]=ut['totalGlobal'](_0x22bf3b);ut[_0x3c51('0x94')](_0x22bf3b,0x8,_0x3c51('0xd4'));ami[_0x3c51('0x2b')]('custom:agentcongestion',ut[_0x3c51('0xa6')](_0x22bf3b,_0x3c51('0xd5')));rpcDb[_0x3c51('0x97')](_0x22bf3b,_0x3c51('0xd6'));if(ut[_0x3c51('0xa3')](_0x22bf3b)>=_0x16f434[_0x3c51('0xa9')]){_0x3f5c21=ut['cloneAction'](_0x22bf3b,0xf,'Global');rpcDb[_0x3c51('0x99')](_0x3f5c21,'[callProgressDetectingCustomer][logCongestionGlobal]');}else{if(_0x22bf3b[_0x3c51('0xd3')]>=_0x16f434[_0x3c51('0xd7')]){rpcDb[_0x3c51('0x99')](_0x22bf3b,_0x3c51('0xd6'));}else{rpcDb[_0x3c51('0xae')](ut['scheduledAt'](_0x22bf3b,_0x3c51('0xd3'),_0x16f434['dialBusyRetryFrequency']),_0x22bf3b['unlockAgent'],_0x22bf3b[_0x3c51('0xb0')]);}}break;case _0x3c51('0xd8'):_0x16f434['outboundRejectCallsDay']+=0x1;_0x22bf3b[_0x3c51('0xd9')]+=0x1;_0x22bf3b[_0x3c51('0xa2')]=ut[_0x3c51('0xa3')](_0x22bf3b);ut[_0x3c51('0x94')](_0x22bf3b,0x14,'AgentReject');ami['emit'](_0x3c51('0xda'),ut[_0x3c51('0xa6')](_0x22bf3b,_0x3c51('0xdb')));rpcDb[_0x3c51('0x97')](_0x22bf3b,_0x3c51('0xdc'));if(ut[_0x3c51('0xa3')](_0x22bf3b)>=_0x16f434['dialGlobalMaxRetry']){_0x3f5c21=ut[_0x3c51('0xaa')](_0x22bf3b,0x14,'AgentReject');rpcDb['createCustomerFinal'](_0x3f5c21,'[callProgressDetectingCustomer][logAgentReject]');}else{if(_0x22bf3b[_0x3c51('0xd9')]>=_0x16f434[_0x3c51('0xdd')]){rpcDb[_0x3c51('0x99')](_0x22bf3b,'[callProgressDetectingCustomer][logAgentReject]');}else{rpcDb['rescheduleContact'](ut[_0x3c51('0xca')](_0x22bf3b,_0x3c51('0xd9'),_0x16f434[_0x3c51('0xde')]),_0x22bf3b[_0x3c51('0xcc')],_0x22bf3b[_0x3c51('0xb0')]);}}break;case _0x3c51('0xdf'):_0x16f434[_0x3c51('0x4a')]+=0x1;_0x22bf3b[_0x3c51('0xe0')]+=0x1;_0x22bf3b[_0x3c51('0xa2')]=ut[_0x3c51('0xa3')](_0x22bf3b);ut[_0x3c51('0x94')](_0x22bf3b,0xb,'Abandoned');rpcDb[_0x3c51('0x97')](_0x22bf3b,_0x3c51('0xe1'));if(ut[_0x3c51('0xa3')](_0x22bf3b)>=_0x16f434[_0x3c51('0xa9')]){_0x3f5c21=ut[_0x3c51('0xaa')](_0x22bf3b,0xf,_0x3c51('0xab'));rpcDb[_0x3c51('0x99')](_0x3f5c21,_0x3c51('0xe1'));}else{if(_0x22bf3b[_0x3c51('0xe2')]>=_0x16f434[_0x3c51('0xe3')]){rpcDb[_0x3c51('0x99')](_0x22bf3b,_0x3c51('0xe1'));}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x22bf3b,_0x3c51('0xe0'),_0x16f434[_0x3c51('0xe4')]),_0x22bf3b[_0x3c51('0xcc')],_0x22bf3b[_0x3c51('0xb0')]);}}break;case'18':_0x16f434[_0x3c51('0xe5')]+=0x1;_0x22bf3b['countmachineretry']+=0x1;_0x22bf3b['countglobal']=ut[_0x3c51('0xa3')](_0x22bf3b);ut[_0x3c51('0x94')](_0x22bf3b,0x12,_0x14969b['cause-txt']||_0x14969b[_0x3c51('0xe6')]);ami['emit']('custom:amd',ut['buildObj'](_0x22bf3b,_0x3c51('0xe7')));rpcDb[_0x3c51('0x97')](_0x22bf3b,_0x3c51('0xe8'));if(ut[_0x3c51('0xa3')](_0x22bf3b)>=_0x16f434[_0x3c51('0xa9')]){_0x3f5c21=ut[_0x3c51('0xaa')](_0x22bf3b,0xf,_0x3c51('0xab'));rpcDb[_0x3c51('0x99')](_0x3f5c21,_0x3c51('0xe8'));}else{rpcDb[_0x3c51('0x99')](_0x22bf3b,'[callProgressDetectingCustomer][hangupInAMD]');}delete this[_0x3c51('0x18')][_0x14969b[_0x3c51('0xb1')]];break;case'19':_0x16f434[_0x3c51('0xe5')]+=0x1;_0x22bf3b[_0x3c51('0xa2')]=ut[_0x3c51('0xa3')](_0x22bf3b);ut[_0x3c51('0x94')](_0x22bf3b,0x13,_0x14969b[_0x3c51('0xe9')]||_0x14969b['dialstatus']);ami['emit']('custom:amd',ut[_0x3c51('0xa6')](_0x22bf3b,_0x3c51('0xe7')));rpcDb[_0x3c51('0x97')](_0x22bf3b,'[callProgressDetectingCustomer][machine]');if(ut[_0x3c51('0xa3')](_0x22bf3b)>=_0x16f434['dialGlobalMaxRetry']){_0x3f5c21=ut[_0x3c51('0xaa')](_0x22bf3b,0xf,_0x3c51('0xab'));rpcDb[_0x3c51('0x99')](_0x3f5c21,_0x3c51('0xea'));}else{rpcDb[_0x3c51('0x99')](_0x22bf3b,_0x3c51('0xea'));}delete this['actions'][_0x14969b[_0x3c51('0xb1')]];break;default:if(_0x22bf3b['dialAnswer']){ut['decrementTalkink'](_0x16f434,_0x3c51('0xeb'));ut[_0x3c51('0x80')](_0x3c51('0xec')+_0x16f434[_0x3c51('0x2d')],_0x14969b);}_0x16f434['outboundUnknownCallsDay']+=0x1;_0x22bf3b[_0x3c51('0xa2')]=ut[_0x3c51('0xa3')](_0x22bf3b);ut[_0x3c51('0x94')](_0x22bf3b,0xc,_0x14969b['cause-txt']||_0x14969b['dialstatus']);rpcDb[_0x3c51('0x97')](_0x22bf3b,_0x3c51('0xed'));if(ut['totalGlobal'](_0x22bf3b)>=_0x16f434['dialGlobalMaxRetry']){_0x3f5c21=ut[_0x3c51('0xaa')](_0x22bf3b,0xf,_0x3c51('0xab'));rpcDb[_0x3c51('0x99')](_0x3f5c21,_0x3c51('0xee'));}else{rpcDb[_0x3c51('0x99')](_0x22bf3b,_0x3c51('0xee'));}delete this[_0x3c51('0x18')][_0x14969b['linkedid']];}if(!(_0x22bf3b[_0x3c51('0x74')]&&_0x5d9d48==='16')){ut[_0x3c51('0x7d')](_0x16f434,_0x3c51('0xef'));logger[_0x3c51('0x5e')]('[originated][decrement][callProgressDetectingCustomer]',_0x22bf3b['uniqueid'],_0x3c51('0xc1'),_0x16f434[_0x3c51('0x2d')],_0x3c51('0x72'),_0x16f434['originated']);}if(_0x5d9d48!=='ANSWER'){delete this[_0x3c51('0x18')][_0x14969b[_0x3c51('0xb1')]];delete this[_0x3c51('0x18')][_0x14969b[_0x3c51('0xf0')]];}}};Preview[_0x3c51('0x10')][_0x3c51('0xf1')]=function(_0x55d412,_0x2b2ba2,_0x3f37fb){if(_[_0x3c51('0xf2')](_0x2b2ba2)&&_0x3c51('0xf3')!==typeof _0x2b2ba2){return;}if(_['isUndefined'](_0x3f37fb)&&_0x3c51('0xf3')!==typeof _0x3f37fb){return;}switch(_0x3f37fb[_0x3c51('0xf4')]){case'0':ut[_0x3c51('0xf5')](_0x55d412,0x0,_0x3c51('0xa4'));rpcDb['createAgentHistory'](_0x55d412,_0x3c51('0xf6'));break;case'3':ut[_0x3c51('0xf5')](_0x55d412,0x3,_0x3c51('0xce'));rpcDb[_0x3c51('0xf7')](_0x55d412,'[callProgressDetectingAgent][logNoAnswer]');break;case'5':ut[_0x3c51('0xf5')](_0x55d412,0x5,'Busy');rpcDb[_0x3c51('0xf7')](_0x55d412,'[callProgressDetectingAgent][logBusy]');break;case'8':ut['logAgent'](_0x55d412,0x8,_0x3c51('0xd4'));rpcDb[_0x3c51('0xf7')](_0x55d412,'[callProgressDetectingAgent][logCongestion]');break;case'22':ut['logAgent'](_0x55d412,0x16,_0x3c51('0xf8'));rpcDb[_0x3c51('0xf7')](_0x55d412,_0x3c51('0xf9'));break;default:ut['logAgent'](_0x55d412,0xc,_0x3f37fb[_0x3c51('0xf4')]);rpcDb[_0x3c51('0xf7')](_0x55d412,_0x3c51('0xfa'));}ut[_0x3c51('0x7d')](_0x2b2ba2,_0x3c51('0xfb'));logger[_0x3c51('0x5e')](_0x3c51('0xfc'),_0x55d412[_0x3c51('0xb6')],_0x3c51('0xc1'),_0x2b2ba2[_0x3c51('0x2d')],_0x3c51('0x72'),_0x2b2ba2[_0x3c51('0x56')]);delete this[_0x3c51('0x18')][_0x55d412[_0x3c51('0xb6')]];};Preview[_0x3c51('0x10')][_0x3c51('0xfd')]=function(_0x376c17,_0x41bef4,_0x3054dc,_0x5048fd,_0x2d7c8a){var _0xd53905=this;return new BPromise(function(_0x4d6477,_0x4a69a1){if(_[_0x3c51('0x6f')](_0x41bef4)||_[_0x3c51('0x6f')](_0x41bef4['Contact'])||_[_0x3c51('0x6f')](_0x41bef4[_0x3c51('0xfe')][_0x3c51('0xff')])||_['isNil'](_0x41bef4['VoiceQueueId'])){_0x4a69a1(ut[_0x3c51('0x55')](_0x3c51('0x100'),_0x5048fd,_0x2d7c8a));return;}var _0x20c8a8=uuid['v4']();var _0x18e099=_0xd53905[_0x3c51('0x15')][_0x41bef4['Queue'][_0x3c51('0x2d')]];var _0x2883ac=_0x3054dc?_0xd53905[_0x3c51('0x19')][_0x3054dc]['id']:undefined;_0xd53905[_0x3c51('0x18')][_0x20c8a8]=new Action(_0x41bef4,_0x18e099,_0x20c8a8,_0x3054dc,_0x2883ac);var _0x5b0f65=_0xd53905[_0x3c51('0x18')][_0x20c8a8];_0x5b0f65['unlockAgent']=_0x5048fd;_0x5b0f65[_0x3c51('0xb0')]=_0x2d7c8a;_0x5b0f65['lookAgent']=_0x3054dc;if(_['isEmpty'](_0x376c17)){_0xd53905[_0x3c51('0x101')](_0x5b0f65,_0x18e099,_0x41bef4,_0x3054dc)[_0x3c51('0x8d')](function(_0x3016d3){logger['info'](_0x3c51('0x102'),_0x3c51('0x103')+_0x5b0f65[_0x3c51('0x71')]+_0x3c51('0x104')+_0x5b0f65['idContact'],JSON[_0x3c51('0x5c')](_0x3016d3));ami[_0x3c51('0x2b')](_0x3c51('0x105'),ut[_0x3c51('0xa6')](_0x5b0f65,_0x3c51('0x106'),_0xd53905[_0x3c51('0x15')][_0x5b0f65[_0x3c51('0x71')]]));_0x4d6477(ut[_0x3c51('0x55')](_0x3c51('0x107')));})[_0x3c51('0x8e')](function(_0x99433a){ut[_0x3c51('0x64')]('[Preview][execCall][failure]',_0x99433a);_0x4a69a1(ut[_0x3c51('0x55')](_0x3c51('0x108'),_0x5048fd,_0x2d7c8a));});}else{_0x18e099['outboundBlacklistCallsDay']+=0x1;ut['logBlacklist'](_0x5b0f65);rpcDb[_0x3c51('0x109')](_0x5b0f65,_0x3c51('0x10a'));delete _0xd53905[_0x3c51('0x18')][_0x20c8a8];_0x4a69a1(ut['message']('Contact\x20in\x20black\x20List',_0x5048fd,_0x2d7c8a));}});};Preview[_0x3c51('0x10')][_0x3c51('0x9e')]=function(_0x52f316){return!_[_0x3c51('0x6f')](_0x52f316)&&!_[_0x3c51('0x6f')](_0x52f316['name'])&&!_[_0x3c51('0x6f')](_0x52f316[_0x3c51('0x10b')])&&_0x52f316[_0x3c51('0x10b')]&&!_[_0x3c51('0x6f')](this['trunks'][util[_0x3c51('0x60')](_0x3c51('0x10c'),_0x52f316[_0x3c51('0x2d')])])&&!_['isNil'](this['trunks'][util[_0x3c51('0x60')]('SIP/%s',_0x52f316[_0x3c51('0x2d')])][_0x3c51('0x7b')])&&(this[_0x3c51('0x17')][util[_0x3c51('0x60')]('SIP/%s',_0x52f316['name'])][_0x3c51('0x7b')]===_0x3c51('0x10d')||this[_0x3c51('0x17')][util[_0x3c51('0x60')](_0x3c51('0x10c'),_0x52f316[_0x3c51('0x2d')])]['status']===_0x3c51('0x10e'));};Preview[_0x3c51('0x10')][_0x3c51('0x8c')]=function(_0x4dcd2c,_0xdcf70c){var _0x2ef11a=this;return new BPromise(function(_0x5d8fc8,_0x4c6df7){_0x2ef11a[_0x3c51('0x10f')](_0x4dcd2c,_0xdcf70c)['then'](function(_0x586ce7){_0x5d8fc8(_[_0x3c51('0x75')](_0x586ce7,['message']));})['catch'](function(_0x28f9b3){if(_0x28f9b3[_0x3c51('0x110')]){rpcDb['unlockContact'](_0x4dcd2c);}if(_0x28f9b3[_0x3c51('0x10b')]){rpcDb[_0x3c51('0x91')](_0x4dcd2c);}_0x4c6df7(_[_0x3c51('0x75')](_0x28f9b3,[_0x3c51('0x55')]));});});};Preview[_0x3c51('0x10')][_0x3c51('0x10f')]=function(_0x2b1c3a,_0x5e8d2b){var _0x2389fb=this;return new BPromise(function(_0x2a94a3,_0x1cf084){var _0x510826,_0xd769f2;rpcDb['getContactPreview'](_0x2b1c3a)[_0x3c51('0x8d')](function(_0x427305){if(!_[_0x3c51('0x6f')](_0x427305[0x0])){_0xd769f2=_0x427305[0x0]['recallme']?![]:!![];_0x510826=_0x427305[0x0]['recallme']?!![]:![];_0x510826=_0x5e8d2b?!![]:_0x510826;}var _0x267f2a=_0x2389fb[_0x3c51('0x111')](_0x427305);if(_0x267f2a['isValid']){rpcDb[_0x3c51('0x112')](_['pick'](_0x427305[0x0],[_0x3c51('0x78'),_0x3c51('0x113')]))['then'](function(_0x1d365b){_0x2389fb[_0x3c51('0xfd')](_0x1d365b,_0x427305[0x0],_0x5e8d2b,_0xd769f2,_0x510826)['then'](function(_0x33d6ab){_0x2a94a3(_0x33d6ab);})['catch'](function(_0x423af5){_0x1cf084(_0x423af5);});})[_0x3c51('0x8e')](function(_0x15deae){ut['logger'](_0x3c51('0x114'),_0x15deae);_0x1cf084(ut[_0x3c51('0x55')](_0x3c51('0x115'),_0xd769f2,_0x510826));});}else{_0x1cf084(ut[_0x3c51('0x55')](_0x267f2a[_0x3c51('0x55')],_0xd769f2,_0x510826));}})[_0x3c51('0x8e')](function(_0x49d3f5){ut['logger'](_0x3c51('0x116'),_0x49d3f5);_0x1cf084(ut['message'](_0x3c51('0x115'),![],!![]));});});};Preview[_0x3c51('0x10')][_0x3c51('0x111')]=function(_0x48505c){if(_[_0x3c51('0x6f')](_0x48505c)||_['isEmpty'](_0x48505c)||!_[_0x3c51('0x6f')](_0x48505c[0x0]['Agent'])&&_[_0x3c51('0x6f')](_0x48505c[0x0][_0x3c51('0x8a')][_0x3c51('0x2d')])){ut['logger'](_0x3c51('0x117'),_0x48505c);return{'isValid':![],'message':'Empty\x20Contact'};}var _0x2bb7f4=this['campaignsPreview'][_0x48505c[0x0][_0x3c51('0x70')][_0x3c51('0x2d')]];_0x2bb7f4['message']=_0x3c51('0xa0');if(_[_0x3c51('0x6f')](_0x2bb7f4)){ut['logger']('[Preview][validateContact][Empty\x20Campaign]',_0x2bb7f4);return{'isValid':![],'message':_0x3c51('0x118')};}if(!this[_0x3c51('0x9e')](_0x2bb7f4['Trunk'])){ut[_0x3c51('0x64')](_0x3c51('0x119'),_0x3c51('0x11a')+_0x2bb7f4[_0x3c51('0x2d')]+_0x3c51('0x11b'));if(!this['isTrunkReachable'](_0x2bb7f4[_0x3c51('0x9f')])){ut['logger'](_0x3c51('0x119'),_0x2bb7f4['name']+_0x3c51('0x11c'));return{'isValid':![],'message':_0x3c51('0x11d')};}}if(!ut[_0x3c51('0x9d')](_0x2bb7f4[_0x3c51('0x3a')])){ut[_0x3c51('0x64')](_0x3c51('0x11e'),_0x2bb7f4['name']+_0x3c51('0x11f'));return{'isValid':![],'message':_0x3c51('0x11a')+_0x2bb7f4[_0x3c51('0x2d')]+_0x3c51('0x11f')};}return{'isValid':!![],'message':_0x3c51('0x120')};};Preview['prototype'][_0x3c51('0x101')]=function(_0x21d339,_0x4b5a5b,_0x11a5ea,_0x2ab815){var _0x3bb20d=this;return new BPromise(function(_0x4e957f,_0x9b8dd5){var _0x96f9d4=_0x21d339['uniqueid'];var _0x24f22a=_0x3bb20d[_0x3c51('0x9e')](_0x4b5a5b[_0x3c51('0x5a')])?util[_0x3c51('0x60')](_0x3c51('0x121'),_0x4b5a5b['Trunk'][_0x3c51('0x2d')],_[_0x3c51('0x6f')](_0x4b5a5b[_0x3c51('0x3f')])?'':_0x4b5a5b[_0x3c51('0x3f')][_0x3c51('0x122')]()||'',_0x4b5a5b[_0x3c51('0x123')]>0x0?_0x11a5ea[_0x3c51('0xfe')]['phone'][_0x3c51('0x124')](_0x4b5a5b[_0x3c51('0x123')]):_0x11a5ea[_0x3c51('0xfe')][_0x3c51('0xff')]):util['format'](_0x3c51('0x121'),_['isNil'](_0x4b5a5b[_0x3c51('0x9f')])?_0x4b5a5b[_0x3c51('0x5a')]['name']:_0x4b5a5b[_0x3c51('0x9f')][_0x3c51('0x2d')],_[_0x3c51('0x6f')](_0x4b5a5b[_0x3c51('0x3f')])?'':_0x4b5a5b['dialPrefix']['trim']()||'',_0x4b5a5b['dialCutDigit']>0x0?_0x11a5ea[_0x3c51('0xfe')][_0x3c51('0xff')][_0x3c51('0x124')](_0x4b5a5b['dialCutDigit']):_0x11a5ea[_0x3c51('0xfe')]['phone']);var _0x35e486=_0x3bb20d['isTrunkReachable'](_0x4b5a5b['Trunk'])?ut[_0x3c51('0x125')](_0x4b5a5b['Trunk'][_0x3c51('0x126')],_0x4b5a5b[_0x3c51('0x3c')],_0x4b5a5b['dialRandomLastDigitCallerIdNumber']>0x0?ut[_0x3c51('0x127')](_0x4b5a5b[_0x3c51('0x3d')],_0x4b5a5b['dialRandomLastDigitCallerIdNumber']):_0x4b5a5b['dialOriginateCallerIdNumber']):ut['getCallerId'](_[_0x3c51('0x6f')](_0x4b5a5b[_0x3c51('0x9f')])?_0x4b5a5b[_0x3c51('0x5a')]['callerid']:_0x4b5a5b[_0x3c51('0x9f')][_0x3c51('0x126')],_0x4b5a5b[_0x3c51('0x3c')],_0x4b5a5b[_0x3c51('0x128')]>0x0?ut[_0x3c51('0x127')](_0x4b5a5b[_0x3c51('0x3d')],_0x4b5a5b[_0x3c51('0x128')]):_0x4b5a5b[_0x3c51('0x3d')]);if(_0x35e486){_0x21d339[_0x3c51('0x129')]=ut['extractCalleridName'](_0x35e486);_0x21d339[_0x3c51('0x12a')]=ut['extractCalleridNumber'](_0x35e486);}var _0x55e38f=ut[_0x3c51('0x12b')](_0x4b5a5b,_0x11a5ea,_0x24f22a,_0x35e486,_0x96f9d4,_0x21d339);_['merge'](_0x21d339,ut[_0x3c51('0x12c')](_0x55e38f));_0x21d339[_0x3c51('0x92')]=moment()[_0x3c51('0x60')]('YYYY-MM-DD\x20HH:mm:ss');ami[_0x3c51('0x7a')](ut[_0x3c51('0x12d')](_0x21d339,_0x4b5a5b,_0x55e38f,_0x21d339['activeContact'],_0x2ab815))['then'](function(_0x179398){_0x4b5a5b[_0x3c51('0x56')]+=0x1;logger[_0x3c51('0x5e')](_0x3c51('0x12e'),_0x96f9d4,'\x20Queue',_0x4b5a5b['name'],_0x3c51('0x72'),_0x4b5a5b[_0x3c51('0x56')]);_0x4e957f(_0x179398);})[_0x3c51('0x8e')](function(_0x349c33){ut[_0x3c51('0xf5')](_0x21d339,0xe,_0x3c51('0x12f'));rpcDb[_0x3c51('0xf7')](_0x21d339,'[originateFailure][logOriginateFailure]');_0x9b8dd5(_0x349c33);});});};Preview[_0x3c51('0x10')]['syncNewExten']=function(_0x1eb7db){if(this[_0x3c51('0x18')][_0x1eb7db[_0x3c51('0xb1')]]){this[_0x3c51('0x18')][_0x1eb7db[_0x3c51('0xb1')]]['channel']=_0x1eb7db[_0x3c51('0x130')];}};Preview[_0x3c51('0x10')]['syncOriginateResponse']=function(_0x15b434){var _0x2c4549=this;var _0x2f8ec5=this[_0x3c51('0x18')][_0x15b434['actionid']];if(_0x2f8ec5){if(_0x2f8ec5[_0x3c51('0x131')]&&this[_0x3c51('0x19')][_0x2f8ec5[_0x3c51('0x131')]]){ut['logLookAgent'](_0x2f8ec5,this[_0x3c51('0x19')][_0x2f8ec5[_0x3c51('0x131')]][_0x3c51('0x2d')],this[_0x3c51('0x19')][_0x2f8ec5['lookAgent']]['id']);}var _0x440a0e=_[_0x3c51('0x132')](_0x2f8ec5);_0x440a0e[_0x3c51('0xb4')]=moment()[_0x3c51('0x60')]('YYYY-MM-DD\x20HH:mm:ss');var _0x5eec33=_0x2c4549[_0x3c51('0x15')][_0x2f8ec5[_0x3c51('0x71')]];if(ut['isFailure'](_0x15b434[_0x3c51('0x133')])){if(_0x2f8ec5[_0x3c51('0xcc')]){rpcDb[_0x3c51('0x134')](_0x2f8ec5[_0x3c51('0x135')]);}if(_0x2f8ec5[_0x3c51('0xb0')]){rpcDb[_0x3c51('0x91')](_0x2f8ec5[_0x3c51('0x135')]);}ami[_0x3c51('0x2b')]('custom:agentringnoanswer',ut[_0x3c51('0xa6')](_0x2f8ec5,_0x3c51('0x136'),this[_0x3c51('0x15')][_0x2f8ec5[_0x3c51('0x71')]]));this[_0x3c51('0xf1')](_0x440a0e,_0x5eec33,_0x15b434);}else{_0x2f8ec5[_0x3c51('0x92')]=moment()[_0x3c51('0x60')]('YYYY-MM-DD\x20HH:mm:ss');ut[_0x3c51('0xf5')](_0x440a0e,0x4,_0x3c51('0x137'));rpcDb['createAgentHistory'](_0x440a0e,_0x3c51('0x138'));}}};Preview[_0x3c51('0x10')][_0x3c51('0x1f')]=function(_0x358160){var _0x32f465=this;var _0x25e002=this[_0x3c51('0x18')][_0x358160['linkedid']];var _0x205ba0;if(_0x25e002){_0x205ba0=this[_0x3c51('0x15')][_0x25e002[_0x3c51('0x71')]];logger[_0x3c51('0x5e')]('[syncHangup][talking]',_0x358160[_0x3c51('0xb1')],_0x3c51('0xc1'),_0x205ba0['name'],_0x3c51('0x73'),_0x205ba0[_0x3c51('0x32')]);}if(this[_0x3c51('0x18')][_0x358160[_0x3c51('0xb1')]]&&_0x358160['linkedid']!==_0x358160[_0x3c51('0xb6')]){if(_0x358160[_0x3c51('0x139')]==='16'&&this[_0x3c51('0x18')][_0x358160[_0x3c51('0xb1')]][_0x3c51('0x74')]){this[_0x3c51('0x13a')](_0x358160,_0x358160[_0x3c51('0xb1')],_0x358160[_0x3c51('0x139')]);}else if(this[_0x3c51('0x18')][_0x358160[_0x3c51('0xb1')]][_0x3c51('0x74')]){logger[_0x3c51('0x5e')](_0x3c51('0x13b'),_0x358160['linkedid'],_0x358160[_0x3c51('0x139')],_0x3c51('0xc1'),_0x205ba0[_0x3c51('0x2d')],'pTalking:\x20',_0x205ba0[_0x3c51('0x32')]);this[_0x3c51('0x13a')](_0x358160,_0x358160[_0x3c51('0xb1')],_0x358160[_0x3c51('0x139')]);}}else if(_0x25e002&&_[_0x3c51('0x6f')](_0x25e002[_0x3c51('0x13c')])&&_0x205ba0[_0x3c51('0x13d')]&&_0x358160[_0x3c51('0xb1')]===_0x358160[_0x3c51('0xb6')]&&_[_0x3c51('0x6f')](_0x358160['reason'])&&_0x358160[_0x3c51('0x139')]==='16'&&_0x358160[_0x3c51('0x13e')]==='6'&&_['isUndefined'](_0x25e002[_0x3c51('0x13f')])){if(_0x25e002['unlockAgent']){rpcDb[_0x3c51('0x134')](_0x25e002[_0x3c51('0x135')]);}if(_0x25e002[_0x3c51('0xb0')]){rpcDb[_0x3c51('0x91')](_0x25e002[_0x3c51('0x135')]);}_0x358160[_0x3c51('0xf4')]='22';this[_0x3c51('0xf1')](_0x25e002,_0x205ba0,_0x358160);}else if(_0x25e002&&_0x25e002[_0x3c51('0x13f')]){if(_0x358160[_0x3c51('0x139')]==='16'&&this[_0x3c51('0x18')][_0x358160[_0x3c51('0xb1')]]['dialAnswer']){logger['info'](_0x3c51('0x140'),_0x358160['linkedid'],_0x358160[_0x3c51('0x139')],_0x3c51('0xc1'),_0x205ba0[_0x3c51('0x2d')],_0x3c51('0x73'),_0x205ba0['pTalking']);this[_0x3c51('0x13a')](_0x358160,_0x358160[_0x3c51('0xb1')],_0x358160['cause']);}else if(this[_0x3c51('0x18')][_0x358160[_0x3c51('0xb1')]]['dialAnswer']){logger[_0x3c51('0x5e')]('[syncHangup][talking][cause]',_0x358160[_0x3c51('0xb1')],_0x358160[_0x3c51('0x139')],_0x3c51('0xc1'),_0x205ba0['name'],_0x3c51('0x73'),_0x205ba0['pTalking']);this[_0x3c51('0x13a')](_0x358160,_0x358160[_0x3c51('0xb1')],_0x358160[_0x3c51('0x139')]);}}};Preview[_0x3c51('0x10')]['syncDialEnd']=function(_0x45493a){if(this['actions'][_0x45493a[_0x3c51('0xf0')]]&&_0x45493a[_0x3c51('0xf0')]!==_0x45493a[_0x3c51('0x141')]){this[_0x3c51('0x13a')](_0x45493a,_0x45493a[_0x3c51('0xf0')],_0x45493a['dialstatus']);}};Preview[_0x3c51('0x10')]['syncHangupRequest']=function(_0x5d7039){if(this[_0x3c51('0x18')][_0x5d7039['linkedid']]&&_0x5d7039[_0x3c51('0xb1')]!==_0x5d7039['uniqueid']&&!this[_0x3c51('0x18')][_0x5d7039[_0x3c51('0xb1')]][_0x3c51('0x74')]){if(_0x5d7039[_0x3c51('0x139')]==='1'){this['callProgressDetectingCustomer'](_0x5d7039,_0x5d7039['linkedid'],_0x5d7039[_0x3c51('0x139')]);}}};Preview[_0x3c51('0x10')][_0x3c51('0x142')]=function(_0x439062,_0x1373fd,_0x22587){if(this[_0x3c51('0x18')][_0x439062]){if(_['isNil'](this[_0x3c51('0x18')][_0x439062][_0x3c51('0x143')])){this[_0x3c51('0x18')][_0x439062]['variables']={};}this[_0x3c51('0x18')][_0x439062][_0x3c51('0x143')][_0x1373fd]=_0x22587;}};Preview[_0x3c51('0x10')][_0x3c51('0x25')]=function(_0x35d4f7){try{if(!_[_0x3c51('0x6f')](_0x35d4f7)){if(ut[_0x3c51('0x144')](_[_0x3c51('0x145')](_0x35d4f7['variable'])[0x0])){this['addVariable'](_0x35d4f7[_0x3c51('0xb6')],_['keys'](_0x35d4f7[_0x3c51('0x146')])[0x0],_0x35d4f7[_0x3c51('0x147')]);}}}catch(_0x2d9984){logger[_0x3c51('0x148')](_0x3c51('0x149'),util[_0x3c51('0x14a')](_0x2d9984,{'showHidden':![],'depth':null}));}};Preview[_0x3c51('0x10')][_0x3c51('0x27')]=function(_0x1909f7){if(_0x1909f7){if(this[_0x3c51('0x18')][_0x1909f7[_0x3c51('0x14b')]]){this[_0x3c51('0x18')][_0x1909f7[_0x3c51('0x14b')]][_0x3c51('0x13f')]=!![];}}};Preview[_0x3c51('0x10')][_0x3c51('0x29')]=function(_0x39858c){if(_0x39858c){if(this['actions'][_0x39858c[_0x3c51('0x14c')]]){this[_0x3c51('0x18')][_0x39858c['transfererlinkedid']]['transfer']=!![];}}};module[_0x3c51('0x14d')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index f0faa20..c8980d7 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 _0x5769=['[countReScheduled]\x20','unlockContact','disableContact','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallercomplete','queuecallercompleteAt','endtime','membername','context','from-sip','exten','holdtime','lastAssignedTo','queuecallerexitreason','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','bluebird','../../../config/logger','lodash','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','inspect','resolve','createHistory','catch','[createHistory]\x20','then','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','getContactPreview','createAgentHistory','rescheduleContact','active'];(function(_0x505bfb,_0x4c78cc){var _0x102e62=function(_0x2711d7){while(--_0x2711d7){_0x505bfb['push'](_0x505bfb['shift']());}};_0x102e62(++_0x4c78cc);}(_0x5769,0x116));var _0x9576=function(_0x245c43,_0x362b30){_0x245c43=_0x245c43-0x0;var _0x19209b=_0x5769[_0x245c43];return _0x19209b;};'use strict';var util=require('util');var BPromise=require(_0x9576('0x0'));var logger=require(_0x9576('0x1'))('preview');var _=require(_0x9576('0x2'));var cmHopper=require(_0x9576('0x3'));var cmHopperFinal=require('../rpc/cmHopperFinal');var cmHopperHistory=require(_0x9576('0x4'));var cmHopperBlack=require(_0x9576('0x5'));var voiceQueueRt=require('../rpc/voiceQueueRt');var agentReportPreview=require(_0x9576('0x6'));var voiceQueueReport=require(_0x9576('0x7'));function loggerCatch(_0x2436a9){return function(_0x2defad){logger[_0x9576('0x8')](_0x2436a9,util[_0x9576('0x9')](_0x2defad,{'showHidden':![],'depth':null}));};}function create(_0x175645){return BPromise[_0x9576('0xa')]()['then'](cmHopperHistory[_0x9576('0xb')](_0x175645))[_0x9576('0xc')](loggerCatch(_0x9576('0xd')));}function createAgent(_0x57c6fe){return BPromise[_0x9576('0xa')]()[_0x9576('0xe')](agentReportPreview[_0x9576('0xb')](_0x57c6fe))[_0x9576('0xc')](loggerCatch(_0x9576('0xd')));}function moveContact(_0x5c0fe9){return BPromise[_0x9576('0xa')]()[_0x9576('0xe')](cmHopper[_0x9576('0xf')](_0x5c0fe9,!![]))[_0x9576('0xc')](loggerCatch(_0x9576('0x10')));}exports[_0x9576('0x11')]=function(_0x5e0d45){return BPromise['resolve']()[_0x9576('0xe')](cmHopperBlack[_0x9576('0x11')](_0x5e0d45))['catch'](loggerCatch('[checkIsBlackList]\x20'));};exports[_0x9576('0x12')]=function(_0x12637c){return BPromise[_0x9576('0xa')]()['then'](cmHopper[_0x9576('0x12')](_0x12637c))[_0x9576('0xc')](loggerCatch('[getContactPreview]\x20'));};exports[_0x9576('0xb')]=function(_0x58f4f1,_0x253c5e){create(_0x58f4f1)['catch'](loggerCatch(_0x253c5e));moveContact(_0x58f4f1)['catch'](loggerCatch(_0x253c5e));};exports[_0x9576('0x13')]=function(_0x2e09f2,_0x295c1a){createAgent(_0x2e09f2)[_0x9576('0xc')](loggerCatch(_0x295c1a));};exports['createCustomerHistory']=function(_0x6642b3,_0x53cffd){create(_0x6642b3)['catch'](loggerCatch(_0x53cffd));};exports['createCustomerFinal']=function(_0x1b8b43,_0x5b2fa8){moveContact(_0x1b8b43)[_0x9576('0xc')](loggerCatch(_0x5b2fa8));};exports[_0x9576('0x14')]=function(_0x33ee74,_0x36dd62,_0xcef152){if(_0x36dd62){_0x33ee74['UserId']=null;}if(_0xcef152){_0x33ee74[_0x9576('0x15')]=![];}return BPromise[_0x9576('0xa')]()[_0x9576('0xe')](cmHopper[_0x9576('0x14')](_0x33ee74))[_0x9576('0xc')](loggerCatch('[rescheduleContact]\x20'));};exports['countReScheduled']=function(_0xb8a83e){return BPromise[_0x9576('0xa')]()[_0x9576('0xe')](cmHopper['countReScheduled'](_0xb8a83e))[_0x9576('0xc')](loggerCatch(_0x9576('0x16')));};exports[_0x9576('0x17')]=function(_0x533615){return BPromise['resolve']()['then'](cmHopper[_0x9576('0x17')]({'UserId':null},_0x533615,0x1))[_0x9576('0xc')](loggerCatch('[unlockContact]\x20'));};exports[_0x9576('0x18')]=function(_0x2c9482){return BPromise['resolve']()[_0x9576('0xe')](cmHopper[_0x9576('0x17')]({'active':![]},_0x2c9482,0x1))['catch'](loggerCatch('[activeContact]\x20'));};exports[_0x9576('0x19')]=function(_0x4529a1){var _0x25abd7={};_0x25abd7[_0x9576('0x1a')]=_0x4529a1[_0x9576('0x1a')];_0x25abd7[_0x9576('0x1b')]=_0x4529a1[_0x9576('0x1b')];_0x25abd7[_0x9576('0x1c')]=_0x4529a1[_0x9576('0x1c')];_0x25abd7['calleridname']=_0x4529a1[_0x9576('0x1d')];_0x25abd7[_0x9576('0x1e')]=_0x4529a1['queue'];_0x25abd7[_0x9576('0x1f')]=_0x4529a1['answertime'];_0x25abd7['queuecallerleaveAt']=_0x4529a1[_0x9576('0x20')];_0x25abd7[_0x9576('0x21')]=0x1;_0x25abd7[_0x9576('0x22')]=_0x4529a1[_0x9576('0x23')];_0x25abd7['connectedlinename']=_0x4529a1[_0x9576('0x24')];_0x25abd7[_0x9576('0x25')]=_0x9576('0x26');_0x25abd7[_0x9576('0x27')]='xcally-motion-preview';_0x25abd7[_0x9576('0x28')]=0x0;_0x25abd7['assigned']=0x1;_0x25abd7[_0x9576('0x29')]=_0x4529a1[_0x9576('0x24')];_0x25abd7[_0x9576('0x2a')]=_0x9576('0x2b');return BPromise[_0x9576('0xa')]()[_0x9576('0xe')](voiceQueueReport[_0x9576('0x2c')](_0x25abd7))['catch'](loggerCatch(_0x9576('0x2d')));};exports[_0x9576('0x2e')]=function(_0x4ab56a,_0x2130f0){return BPromise['resolve']()[_0x9576('0xe')](cmHopper['getContactRecallMe'](_0x4ab56a,_0x2130f0))['catch'](loggerCatch(_0x9576('0x2f')));};exports[_0x9576('0x30')]=function(_0x2ca491){return BPromise[_0x9576('0xa')]()[_0x9576('0xe')](cmHopper[_0x9576('0x14')](_0x2ca491,!![],!![]))['catch'](loggerCatch(_0x9576('0x31')));}; \ No newline at end of file +var _0x9f36=['type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallercomplete','queuecallercompleteAt','endtime','context','from-sip','exten','xcally-motion-preview','holdtime','assigned','lastAssignedTo','membername','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','rescheduleContactInQueue','bluebird','../../../config/logger','lodash','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/voiceQueueReport','inspect','resolve','then','createHistory','catch','[createHistory]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','createCustomerFinal','UserId','active','rescheduleContact','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','[activeContact]\x20','crateCustomerReportQueue'];(function(_0x5edcb1,_0x54a8a3){var _0x156116=function(_0x5a57e6){while(--_0x5a57e6){_0x5edcb1['push'](_0x5edcb1['shift']());}};_0x156116(++_0x54a8a3);}(_0x9f36,0x19f));var _0x69f3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9f36[_0x3dd15e];return _0x231fd0;};'use strict';var util=require('util');var BPromise=require(_0x69f3('0x0'));var logger=require(_0x69f3('0x1'))('preview');var _=require(_0x69f3('0x2'));var cmHopper=require(_0x69f3('0x3'));var cmHopperFinal=require(_0x69f3('0x4'));var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require(_0x69f3('0x5'));var voiceQueueRt=require(_0x69f3('0x6'));var agentReportPreview=require('../rpc/agentReportPreview');var voiceQueueReport=require(_0x69f3('0x7'));function loggerCatch(_0x1f067b){return function(_0xbea6c2){logger['error'](_0x1f067b,util[_0x69f3('0x8')](_0xbea6c2,{'showHidden':![],'depth':null}));};}function create(_0x23038f){return BPromise[_0x69f3('0x9')]()[_0x69f3('0xa')](cmHopperHistory[_0x69f3('0xb')](_0x23038f))[_0x69f3('0xc')](loggerCatch(_0x69f3('0xd')));}function createAgent(_0x1b27b3){return BPromise[_0x69f3('0x9')]()[_0x69f3('0xa')](agentReportPreview[_0x69f3('0xb')](_0x1b27b3))[_0x69f3('0xc')](loggerCatch(_0x69f3('0xd')));}function moveContact(_0xaa4e9b){return BPromise['resolve']()[_0x69f3('0xa')](cmHopper[_0x69f3('0xe')](_0xaa4e9b,!![]))[_0x69f3('0xc')](loggerCatch(_0x69f3('0xf')));}exports[_0x69f3('0x10')]=function(_0x470d44){return BPromise[_0x69f3('0x9')]()[_0x69f3('0xa')](cmHopperBlack['checkIsBlackList'](_0x470d44))[_0x69f3('0xc')](loggerCatch(_0x69f3('0x11')));};exports['getContactPreview']=function(_0x5e3f1c){return BPromise[_0x69f3('0x9')]()[_0x69f3('0xa')](cmHopper[_0x69f3('0x12')](_0x5e3f1c))[_0x69f3('0xc')](loggerCatch(_0x69f3('0x13')));};exports['createHistory']=function(_0x3ee82d,_0xca1846){create(_0x3ee82d)[_0x69f3('0xc')](loggerCatch(_0xca1846));moveContact(_0x3ee82d)[_0x69f3('0xc')](loggerCatch(_0xca1846));};exports[_0x69f3('0x14')]=function(_0xc17adf,_0x1a5c05){createAgent(_0xc17adf)[_0x69f3('0xc')](loggerCatch(_0x1a5c05));};exports[_0x69f3('0x15')]=function(_0x15d044,_0x5d8d28){create(_0x15d044)[_0x69f3('0xc')](loggerCatch(_0x5d8d28));};exports[_0x69f3('0x16')]=function(_0x6818f8,_0xd44e67){moveContact(_0x6818f8)['catch'](loggerCatch(_0xd44e67));};exports['rescheduleContact']=function(_0x532271,_0x10f035,_0x42182f){if(_0x10f035){_0x532271[_0x69f3('0x17')]=null;}if(_0x42182f){_0x532271[_0x69f3('0x18')]=![];}return BPromise['resolve']()['then'](cmHopper[_0x69f3('0x19')](_0x532271))[_0x69f3('0xc')](loggerCatch(_0x69f3('0x1a')));};exports[_0x69f3('0x1b')]=function(_0x2f3b66){return BPromise['resolve']()[_0x69f3('0xa')](cmHopper[_0x69f3('0x1b')](_0x2f3b66))[_0x69f3('0xc')](loggerCatch(_0x69f3('0x1c')));};exports[_0x69f3('0x1d')]=function(_0x118369){return BPromise[_0x69f3('0x9')]()['then'](cmHopper[_0x69f3('0x1d')]({'UserId':null},_0x118369,0x1))[_0x69f3('0xc')](loggerCatch(_0x69f3('0x1e')));};exports['disableContact']=function(_0x1ff312){return BPromise[_0x69f3('0x9')]()[_0x69f3('0xa')](cmHopper[_0x69f3('0x1d')]({'active':![]},_0x1ff312,0x1))[_0x69f3('0xc')](loggerCatch(_0x69f3('0x1f')));};exports[_0x69f3('0x20')]=function(_0x476feb){var _0x1f9e8b={};_0x1f9e8b[_0x69f3('0x21')]=_0x476feb[_0x69f3('0x21')];_0x1f9e8b[_0x69f3('0x22')]=_0x476feb[_0x69f3('0x22')];_0x1f9e8b[_0x69f3('0x23')]=_0x476feb[_0x69f3('0x23')];_0x1f9e8b[_0x69f3('0x24')]=_0x476feb[_0x69f3('0x24')];_0x1f9e8b['queue']=_0x476feb[_0x69f3('0x25')];_0x1f9e8b[_0x69f3('0x26')]=_0x476feb[_0x69f3('0x27')];_0x1f9e8b['queuecallerleaveAt']=_0x476feb[_0x69f3('0x27')];_0x1f9e8b[_0x69f3('0x28')]=0x1;_0x1f9e8b[_0x69f3('0x29')]=_0x476feb[_0x69f3('0x2a')];_0x1f9e8b['connectedlinename']=_0x476feb['membername'];_0x1f9e8b[_0x69f3('0x2b')]=_0x69f3('0x2c');_0x1f9e8b[_0x69f3('0x2d')]=_0x69f3('0x2e');_0x1f9e8b[_0x69f3('0x2f')]=0x0;_0x1f9e8b[_0x69f3('0x30')]=0x1;_0x1f9e8b[_0x69f3('0x31')]=_0x476feb[_0x69f3('0x32')];_0x1f9e8b['queuecallerexitreason']=_0x69f3('0x33');return BPromise[_0x69f3('0x9')]()['then'](voiceQueueReport[_0x69f3('0x34')](_0x1f9e8b))['catch'](loggerCatch(_0x69f3('0x35')));};exports[_0x69f3('0x36')]=function(_0x1c7f5,_0x19c157){return BPromise[_0x69f3('0x9')]()[_0x69f3('0xa')](cmHopper[_0x69f3('0x36')](_0x1c7f5,_0x19c157))[_0x69f3('0xc')](loggerCatch('[GetContactRecallMe]\x20'));};exports[_0x69f3('0x37')]=function(_0x1c051a){return BPromise[_0x69f3('0x9')]()[_0x69f3('0xa')](cmHopper[_0x69f3('0x19')](_0x1c051a,!![],!![]))[_0x69f3('0xc')](loggerCatch('[rescheduleContactInQueue]\x20'));}; \ No newline at end of file diff --git a/server/services/ami/preview/util/util.js b/server/services/ami/preview/util/util.js index d3f7e85..3a31cef 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 _0x124f=['seconds','loggerCatch','info','inspect','loggerError','error','logger2','message','getCallerId','isUndefined','string','isEmpty','\x22%s\x22\x20<%s>','format','\x22\x22\x20<>','addVariables','Queue','name','calleridname','calleridnum','ContactId','dialer','VoiceQueueId','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','_XCALLY_MIXMONITOR_UNIQUEID','Contact','createdAt','updatedAt','toUpper','toLowerVariables','hasOwnProperty','toLower','updateOriginated','isNil','originated','[updateOriginated]\x20is\x20null\x20or\x20undefined','state','statedesc','starttime','responsetime','logAgent','YYYY-MM-DD\x20HH:mm:ss','membername','UserId','endtime','ringtime','talktime','answertime','isFailure','Failure','variablesAction','BOOKED','originate','channelAgent','xcally-motion-preview','from-sip','timeout','uniqueid','countbusyretry','countcongestionretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','cloneAction','clone','Global','scheduledAt','active','add','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','buildObj','lastevent','queue','interface','mandatoryDisposition','buildAcw','agentReadyId','not_inuse','status','reachable','createBody','CampaignId','filterKey','type','campaigntype','scheduledat','countglobal','callback','callbackuniqueid','callbackat','recallme','xmd-voicequeueid','xmd-phone','xmd-listid','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','bridgepeer','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','replace','random','extractCalleridName','match','util','moment','../../../../config/logger','env','XCALLY_IP_AGI','127.0.0.1','milliseconds','diff'];(function(_0x1d24eb,_0x12295b){var _0x1dc576=function(_0x4d5770){while(--_0x4d5770){_0x1d24eb['push'](_0x1d24eb['shift']());}};_0x1dc576(++_0x12295b);}(_0x124f,0x83));var _0xf124=function(_0x4045d1,_0x1ac7e3){_0x4045d1=_0x4045d1-0x0;var _0x574a54=_0x124f[_0x4045d1];return _0x574a54;};'use strict';var util=require(_0xf124('0x0'));var _=require('lodash');var moment=require(_0xf124('0x1'));var logger=require(_0xf124('0x2'))('preview');var ipAgi=process[_0xf124('0x3')][_0xf124('0x4')]||_0xf124('0x5');function getSeconds(_0xa93e7b,_0x5180b8){var _0x216cfa=moment(_0xa93e7b)['milliseconds'](0x0);var _0xe5528d=moment(_0x5180b8)[_0xf124('0x6')](0x0);return _0x216cfa[_0xf124('0x7')](_0xe5528d,_0xf124('0x8'));}exports[_0xf124('0x9')]=function(_0x2f4a67){return function(_0x46eeda){logger['error'](_0x2f4a67,util['inspect'](_0x46eeda,{'showHidden':![],'depth':null}));};};exports['logger']=function(_0x38c69b,_0x584f49){logger[_0xf124('0xa')](_0x38c69b,util[_0xf124('0xb')](_0x584f49,{'showHidden':![],'depth':null}));};exports[_0xf124('0xc')]=function(_0x47c7ab,_0x305f6c){logger[_0xf124('0xd')](_0x47c7ab,util['inspect'](_0x305f6c,{'showHidden':![],'depth':null}));};exports[_0xf124('0xe')]=function(_0x15808c){return function(_0xdbc03f){logger[_0xf124('0xa')](_0x15808c,util[_0xf124('0xb')](_0xdbc03f,{'showHidden':![],'depth':null}));};};exports[_0xf124('0xf')]=function(_0x37301b,_0x3389d4,_0x23d4da){return{'message':_0x37301b,'unlock':_0x3389d4,'active':_0x23d4da};};exports[_0xf124('0x10')]=function(_0x2556d4,_0x45d9da,_0x5a1c8c){if(!_[_0xf124('0x11')](_0x5a1c8c)&&_0xf124('0x12')===typeof _0x5a1c8c&&!_[_0xf124('0x13')](_0x5a1c8c)){if(!_[_0xf124('0x11')](_0x45d9da)&&_0xf124('0x12')===typeof _0x45d9da&&!_[_0xf124('0x13')](_0x45d9da)){return util['format'](_0xf124('0x14'),_0x45d9da,_0x5a1c8c);}return util[_0xf124('0x15')]('\x22%s\x22\x20<%s>',_0x5a1c8c,_0x5a1c8c);}if(!_[_0xf124('0x11')](_0x2556d4)&&'string'===typeof _0x2556d4&&!_[_0xf124('0x13')](_0x2556d4)){return _0x2556d4;}return _0xf124('0x16');};exports['isActive']=function(_0x1a6344){if(_['isNil'](_0x1a6344)){return![];}return _0x1a6344;};exports[_0xf124('0x17')]=function(_0x523507,_0x3cdf2f,_0x2fb9b0,_0x2957be,_0x294846,_0xceec06){var _0x50c953={'XMD-QUEUE':_0x3cdf2f['Queue']?_0x3cdf2f[_0xf124('0x18')][_0xf124('0x19')]:'','XMD-CALLERID':_0x2957be,'XMD-CALLERID-PREVIEW':_0xceec06?util[_0xf124('0x15')](_0xf124('0x14'),_0xceec06[_0xf124('0x1a')],_0xceec06[_0xf124('0x1b')]):_0x2957be,'XMD-DIALID':_0x294846,'XMD-CONTACTID':_0x3cdf2f[_0xf124('0x1c')],'XMD-CDRTYPE':_0xf124('0x1d'),'CALLERID(all)':_0x2957be,'XMD-VOICEQUEUEID':_0x3cdf2f[_0xf124('0x1e')],'XMD-DIALCHANNEL':_0x2fb9b0,'XMD-DIALTIMEOUT':_0x523507['dialOriginateTimeout']||0x1e,'XMD-DIALOPTIONS':util['format'](_0xf124('0x1f'),_0x523507[_0xf124('0x20')]?'g':'',_[_0xf124('0x13')](_0x523507[_0xf124('0x21')])?'':_0xf124('0x22')),'XMD-DIALURL':_0x523507[_0xf124('0x23')]||'','XMD-AGI':_0x523507[_0xf124('0x24')]?util[_0xf124('0x15')](_0xf124('0x25'),ipAgi,_0x523507[_0xf124('0x24')]):_0xf124('0x26'),'XMD-AGIAFTER':_0x523507['dialQueueProject2']?util[_0xf124('0x15')](_0xf124('0x25'),ipAgi,_0x523507[_0xf124('0x20')]):_0xf124('0x26'),'XMD-ORIGINATECALLERIDNUM':_0xceec06?_0xceec06['originatecalleridnum']:'','XMD-ORIGINATECALLERIDNAME':_0xceec06?_0xceec06['originatecalleridname']:'','XMD-DESTINATION':'xcally-motion-preview'};if(!_['isEmpty'](_0x523507[_0xf124('0x21')])){_0x50c953[util['format']('%s','_XCALLY_MIXMONITOR_FORMAT')]=_0x523507[_0xf124('0x21')];_0x50c953[util[_0xf124('0x15')]('%s',_0xf124('0x27'))]=_0x294846;}if(_0x3cdf2f&&_0x3cdf2f[_0xf124('0x28')]){for(var _0x1fcb1e in _0x3cdf2f[_0xf124('0x28')]){if(_0x3cdf2f[_0xf124('0x28')]['hasOwnProperty'](_0x1fcb1e)){if(!_['isNil'](_0x3cdf2f[_0xf124('0x28')][_0x1fcb1e])&&_0x1fcb1e!=='id'&&_0x1fcb1e!=='tags'&&_0x1fcb1e!==_0xf124('0x29')&&_0x1fcb1e!==_0xf124('0x2a')){_0x50c953[util[_0xf124('0x15')]('%s%s','XMD-',_[_0xf124('0x2b')](_0x1fcb1e))]=_0x3cdf2f['Contact'][_0x1fcb1e];}}}}return _0x50c953;};exports[_0xf124('0x2c')]=function(_0x38b1e5){var _0x4b1051={};for(var _0x3ed1f0 in _0x38b1e5){if(_0x38b1e5[_0xf124('0x2d')](_0x3ed1f0)){_0x4b1051[util['format']('%s',_[_0xf124('0x2e')](_0x3ed1f0))]=_0x38b1e5[_0x3ed1f0];}}return{'variables':_0x4b1051};};exports[_0xf124('0x2f')]=function(_0x233903,_0x14ffa8){if(!_[_0xf124('0x30')](_0x233903)){if(_0x233903[_0xf124('0x2d')](_0xf124('0x31'))){if(_0x233903[_0xf124('0x31')]>0x0){_0x233903[_0xf124('0x31')]-=0x1;}else{logger['error']('[updateOriginated]\x20object\x20originated\x20is\x20negative',_0x14ffa8);}}}else{logger['error'](_0xf124('0x32'),_0x14ffa8);}};exports['logBlacklist']=function(_0x3dc409){var _0x58c831=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x3dc409[_0xf124('0x33')]=0xd;_0x3dc409[_0xf124('0x34')]='Blacklist';_0x3dc409[_0xf124('0x35')]=_0x58c831;_0x3dc409[_0xf124('0x36')]=_0x58c831;_0x3dc409['endtime']=_0x58c831;};exports[_0xf124('0x37')]=function(_0x4e82c0,_0x2b832d,_0x15f982){var _0x546ae5=moment()[_0xf124('0x15')](_0xf124('0x38'));_0x4e82c0[_0xf124('0x33')]=_0x2b832d;_0x4e82c0['statedesc']=_0x15f982;_0x4e82c0[_0xf124('0x36')]=_0x546ae5;_0x4e82c0['ringtime']=getSeconds(_0x4e82c0[_0xf124('0x36')],_0x4e82c0[_0xf124('0x35')]);};exports['logLookAgent']=function(_0x3747df,_0x25c82e,_0x4e31ac){_0x3747df[_0xf124('0x39')]=_0x25c82e;_0x3747df[_0xf124('0x3a')]=_0x4e31ac;};exports['logCustomer']=function(_0x262e19,_0x45a205,_0x4e43c4){var _0x1d4f89=moment()['format'](_0xf124('0x38'));_0x262e19['state']=_0x45a205;_0x262e19['statedesc']=_0x4e43c4;_0x262e19['responsetime']=_0x262e19['responsetime']?_0x262e19['responsetime']:_0x1d4f89;_0x262e19['endtime']=_0x262e19[_0xf124('0x3b')]?_0x262e19['endtime']:_0x1d4f89;_0x262e19[_0xf124('0x3c')]=getSeconds(_0x262e19[_0xf124('0x36')]||0x0,_0x262e19[_0xf124('0x35')]||0x0);_0x262e19[_0xf124('0x3d')]=_0x262e19['answertime']?getSeconds(_0x262e19[_0xf124('0x3b')],_0x262e19[_0xf124('0x3e')]):0x0;};exports[_0xf124('0x3f')]=function(_0x21fff3){return _0x21fff3===_0xf124('0x40');};exports[_0xf124('0x41')]=function(_0x4183b5,_0x49ede1,_0x27f7bd,_0x11e9cf,_0x2caeb9){var _0x2dd3f8=_0x11e9cf?'RECALL':_0x4183b5[_0xf124('0x1a')];_0x2dd3f8=_0x2caeb9?_0xf124('0x42'):_0x2dd3f8;return{'actionid':_0x4183b5['uniqueid'],'action':_0xf124('0x43'),'channel':_0x4183b5[_0xf124('0x44')],'callerid':util['format'](_0xf124('0x14'),_0x2dd3f8,_0x4183b5[_0xf124('0x1b')]),'Exten':_0xf124('0x45'),'Context':_0xf124('0x46'),'Priority':'1','variable':_0x27f7bd,'timeout':(_0x49ede1[_0xf124('0x47')]||0x1e)*0x3e8,'async':!![],'channelid':_0x4183b5[_0xf124('0x48')]};};exports['totalGlobal']=function(_0x3c866d){return _0x3c866d[_0xf124('0x49')]+_0x3c866d[_0xf124('0x4a')]+_0x3c866d[_0xf124('0x4b')]+_0x3c866d[_0xf124('0x4c')]+_0x3c866d[_0xf124('0x4d')];};exports[_0xf124('0x4e')]=function(_0x1325b1){var _0x4feeb9=_[_0xf124('0x4f')](_0x1325b1);_0x4feeb9['state']=0xf;_0x4feeb9[_0xf124('0x34')]=_0xf124('0x50');return _0x4feeb9;};exports[_0xf124('0x51')]=function(_0x11160c,_0x275471,_0x58d6e6){var _0x502440={};_0x502440[_0x275471]=_0x11160c[_0x275471];_0x502440[_0xf124('0x52')]=![];_0x502440['scheduledat']=moment()[_0xf124('0x53')](_0x58d6e6,'minutes')[_0xf124('0x15')](_0xf124('0x38'));_0x502440['ContactId']=_0x11160c[_0xf124('0x1c')];_0x502440[_0xf124('0x54')]=_0x11160c[_0xf124('0x54')];_0x502440[_0xf124('0x1e')]=_0x11160c[_0xf124('0x1e')]||undefined;return _0x502440;};exports[_0xf124('0x55')]=function(_0x5a4291,_0xca3a4d){if(!_[_0xf124('0x30')](_0x5a4291)){if(_0x5a4291[_0xf124('0x56')]>0x0){_0x5a4291['pTalking']-=0x1;}else{logger[_0xf124('0xd')](_0xca3a4d,_0xf124('0x57'));}}else{logger[_0xf124('0xd')](_0xca3a4d,_0xf124('0x58'));}};exports[_0xf124('0x59')]=function(_0x12c0b6){if(_0x12c0b6<=0x0){return!![];}return![];};exports[_0xf124('0x5a')]=function(_0x465526,_0x17a8b6,_0x2ed714){_0x465526[_0xf124('0x5b')]=_0x17a8b6;_0x465526['name']=_0x465526[_0xf124('0x5c')];_0x465526[_0xf124('0x5d')]=_0x465526['channelAgent'];if(_0x2ed714){_0x465526[_0xf124('0x5e')]=_0x2ed714[_0xf124('0x5e')];}return _0x465526;};exports[_0xf124('0x5f')]=function(_0x48a3d7){var _0x1118e2={};_0x1118e2['queue']=_0x48a3d7[_0xf124('0x5c')];_0x1118e2[_0xf124('0x5d')]=_0x48a3d7[_0xf124('0x44')];_0x1118e2[_0xf124('0x48')]=_0x48a3d7[_0xf124('0x48')];return _0x1118e2;};exports[_0xf124('0x60')]=function(_0x419b13){var _0x2bf4f3=[];for(var _0x36b3ee in _0x419b13){if(_0x419b13['hasOwnProperty'](_0x36b3ee)){if(!_[_0xf124('0x30')](_0x419b13[_0x36b3ee])&&_0x419b13[_0x36b3ee][_0xf124('0x33')]===_0xf124('0x61')&&_0x419b13[_0x36b3ee][_0xf124('0x62')]===_0xf124('0x63')){_0x2bf4f3['push'](_0x419b13[_0x36b3ee]['id']);}}}return _0x2bf4f3;};exports['getDiff']=function(_0x255288){var _0x180e03=moment()[_0xf124('0x6')](0x0);var _0x1345fb=moment(_0x255288)[_0xf124('0x6')](0x0);return _0x180e03[_0xf124('0x7')](_0x1345fb,_0xf124('0x8'));};exports[_0xf124('0x64')]=function(_0x53801a){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x53801a['ContactId'],'ListId':_0x53801a[_0xf124('0x54')],'VoiceQueueId':_0x53801a[_0xf124('0x1e')]||undefined,'CampaignId':_0x53801a[_0xf124('0x65')]||undefined};};exports[_0xf124('0x66')]=function(_0x521490){if(_0x521490===_0xf124('0x48')||_0x521490==='idContact'||_0x521490==='queue'||_0x521490===_0xf124('0x67')||_0x521490===_0xf124('0x68')||_0x521490==='dialAnswer'||_0x521490===_0xf124('0x39')||_0x521490==='channelAgent'||_0x521490===_0xf124('0x1a')||_0x521490===_0xf124('0x52')||_0x521490===_0xf124('0x1b')||_0x521490===_0xf124('0x69')||_0x521490===_0xf124('0x49')||_0x521490===_0xf124('0x4a')||_0x521490==='countnoanswerretry'||_0x521490===_0xf124('0x6a')||_0x521490===_0xf124('0x6b')||_0x521490===_0xf124('0x6c')||_0x521490===_0xf124('0x6d')||_0x521490===_0xf124('0x6e')||_0x521490===_0xf124('0x1c')||_0x521490===_0xf124('0x54')||_0x521490===_0xf124('0x3a')||_0x521490===_0xf124('0x1e')||_0x521490==='sipcallid'||_0x521490===_0xf124('0x6f')||_0x521490==='xmd-queue'||_0x521490===_0xf124('0x70')||_0x521490===_0xf124('0x71')||_0x521490==='xmd-dialurl'||_0x521490===_0xf124('0x72')||_0x521490===_0xf124('0x73')||_0x521490===_0xf124('0x74')||_0x521490==='xmd-dialchannel'||_0x521490===_0xf124('0x75')||_0x521490===_0xf124('0x76')||_0x521490===_0xf124('0x77')||_0x521490===_0xf124('0x78')||_0x521490===_0xf124('0x79')||_0x521490===_0xf124('0x7a')||_0x521490===_0xf124('0x7b')||_0x521490===_0xf124('0x7c')||_0x521490===_0xf124('0x7d')||_0x521490===_0xf124('0x7e')||_0x521490===_0xf124('0x7f')||_0x521490===_0xf124('0x80')||_0x521490==='rtpaudioqosrttbridged'||_0x521490===_0xf124('0x7a')||_0x521490===_0xf124('0x7b')||_0x521490==='rtpaudioqosjitter'||_0x521490===_0xf124('0x7d')||_0x521490==='rtpaudioqosloss'||_0x521490===_0xf124('0x7f')||_0x521490==='rtpaudioqosrtt'||_0x521490===_0xf124('0x81')||_0x521490===_0xf124('0x82')||_0x521490===_0xf124('0x83')||_0x521490===_0xf124('0x33')||_0x521490===_0xf124('0x34')){return![];}return!![];};exports[_0xf124('0x84')]=function(_0x1f5df3,_0x127eb1){var _0x394194,_0x52268d,_0x1393f9;if(_0x127eb1<=0x0){_0x127eb1=0x1;}_0x394194=new RegExp(_0xf124('0x85')+_0x127eb1+'}$');_0x52268d=Math[_0xf124('0x86')](0xa,_0x127eb1-0x1);_0x1393f9=Math[_0xf124('0x86')](0xa,_0x127eb1)-0x1;return util[_0xf124('0x15')]('%s',_[_0xf124('0x87')](_0x1f5df3,_0x394194,_[_0xf124('0x88')](_0x52268d,_0x1393f9)));};exports[_0xf124('0x89')]=function(_0xc1ff32){var _0x38ca59=_0xc1ff32[_0xf124('0x8a')](/"(.*?)"/);return _0x38ca59?_0x38ca59[0x1]:_0xc1ff32;};exports['extractCalleridNumber']=function(_0x5b7e88){var _0xf6b3e2=_0x5b7e88['match'](/<(.*?)>/);return _0xf6b3e2?_0xf6b3e2[0x1]:_0x5b7e88;}; \ No newline at end of file +var _0x6e81=['rtpaudioqosrttbridged','rtpaudioqos','rtpaudioqosjitterbridged','rtpaudioqosrtt','bridgepeer','bridgepvtcallid','\x5cw{0,','pow','random','extractCalleridName','match','util','../../../../config/logger','preview','XCALLY_IP_AGI','127.0.0.1','diff','loggerCatch','error','logger','inspect','logger2','info','message','getCallerId','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','addVariables','Queue','name','calleridname','calleridnum','ContactId','dialer','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','dialQueueProject2','originatecalleridnum','originatecalleridname','xcally-motion-preview','Contact','isNil','tags','createdAt','%s%s','XMD-','toUpper','hasOwnProperty','toLower','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','Blacklist','starttime','responsetime','logAgent','logLookAgent','logCustomer','endtime','ringtime','talktime','answertime','isFailure','Failure','variablesAction','BOOKED','channelAgent','from-sip','totalGlobal','countbusyretry','countcongestionretry','countnoanswerretry','countagentrejectretry','Global','scheduledAt','active','scheduledat','add','minutes','ListId','VoiceQueueId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','IsNotLoggedIn','buildObj','lastevent','interface','mandatoryDisposition','buildAcw','queue','uniqueid','agentReadyId','not_inuse','reachable','getDiff','milliseconds','seconds','CampaignId','filterKey','idContact','type','campaigntype','membername','callback','callbackuniqueid','callbackat','recallme','UserId','sipcallid','xmd-voicequeueid','xmd-queue','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agi','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqoslossbridged'];(function(_0x38d8d3,_0x30efad){var _0x2a6f7e=function(_0x2e2a12){while(--_0x2e2a12){_0x38d8d3['push'](_0x38d8d3['shift']());}};_0x2a6f7e(++_0x30efad);}(_0x6e81,0x1a3));var _0x16e8=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0x6e81[_0x1d1779];return _0x2377e9;};'use strict';var util=require(_0x16e8('0x0'));var _=require('lodash');var moment=require('moment');var logger=require(_0x16e8('0x1'))(_0x16e8('0x2'));var ipAgi=process['env'][_0x16e8('0x3')]||_0x16e8('0x4');function getSeconds(_0x1a6b70,_0x723dcb){var _0x3fdd93=moment(_0x1a6b70)['milliseconds'](0x0);var _0x34c2f8=moment(_0x723dcb)['milliseconds'](0x0);return _0x3fdd93[_0x16e8('0x5')](_0x34c2f8,'seconds');}exports[_0x16e8('0x6')]=function(_0x202690){return function(_0x281562){logger[_0x16e8('0x7')](_0x202690,util['inspect'](_0x281562,{'showHidden':![],'depth':null}));};};exports[_0x16e8('0x8')]=function(_0xe7aa75,_0x382599){logger['info'](_0xe7aa75,util[_0x16e8('0x9')](_0x382599,{'showHidden':![],'depth':null}));};exports['loggerError']=function(_0x2ae08f,_0x37704d){logger[_0x16e8('0x7')](_0x2ae08f,util[_0x16e8('0x9')](_0x37704d,{'showHidden':![],'depth':null}));};exports[_0x16e8('0xa')]=function(_0x1d231e){return function(_0x20e4fa){logger[_0x16e8('0xb')](_0x1d231e,util[_0x16e8('0x9')](_0x20e4fa,{'showHidden':![],'depth':null}));};};exports[_0x16e8('0xc')]=function(_0x31a3c2,_0x873ac9,_0x36b8a0){return{'message':_0x31a3c2,'unlock':_0x873ac9,'active':_0x36b8a0};};exports[_0x16e8('0xd')]=function(_0x171138,_0x1362cd,_0x2cd443){if(!_[_0x16e8('0xe')](_0x2cd443)&&_0x16e8('0xf')===typeof _0x2cd443&&!_['isEmpty'](_0x2cd443)){if(!_[_0x16e8('0xe')](_0x1362cd)&&_0x16e8('0xf')===typeof _0x1362cd&&!_[_0x16e8('0x10')](_0x1362cd)){return util[_0x16e8('0x11')](_0x16e8('0x12'),_0x1362cd,_0x2cd443);}return util[_0x16e8('0x11')](_0x16e8('0x12'),_0x2cd443,_0x2cd443);}if(!_['isUndefined'](_0x171138)&&_0x16e8('0xf')===typeof _0x171138&&!_[_0x16e8('0x10')](_0x171138)){return _0x171138;}return _0x16e8('0x13');};exports[_0x16e8('0x14')]=function(_0x484e3b){if(_['isNil'](_0x484e3b)){return![];}return _0x484e3b;};exports[_0x16e8('0x15')]=function(_0x26f4c4,_0x307573,_0x24737c,_0x3fa841,_0x34a966,_0x46221b){var _0x4a6e63={'XMD-QUEUE':_0x307573[_0x16e8('0x16')]?_0x307573[_0x16e8('0x16')][_0x16e8('0x17')]:'','XMD-CALLERID':_0x3fa841,'XMD-CALLERID-PREVIEW':_0x46221b?util['format']('\x22%s\x22\x20<%s>',_0x46221b[_0x16e8('0x18')],_0x46221b[_0x16e8('0x19')]):_0x3fa841,'XMD-DIALID':_0x34a966,'XMD-CONTACTID':_0x307573[_0x16e8('0x1a')],'XMD-CDRTYPE':_0x16e8('0x1b'),'CALLERID(all)':_0x3fa841,'XMD-VOICEQUEUEID':_0x307573['VoiceQueueId'],'XMD-DIALCHANNEL':_0x24737c,'XMD-DIALTIMEOUT':_0x26f4c4['dialOriginateTimeout']||0x1e,'XMD-DIALOPTIONS':util[_0x16e8('0x11')]('\x22rtTxX%s%s\x22',_0x26f4c4['dialQueueProject2']?'g':'',_[_0x16e8('0x10')](_0x26f4c4[_0x16e8('0x1c')])?'':_0x16e8('0x1d')),'XMD-DIALURL':_0x26f4c4[_0x16e8('0x1e')]||'','XMD-AGI':_0x26f4c4[_0x16e8('0x1f')]?util['format'](_0x16e8('0x20'),ipAgi,_0x26f4c4[_0x16e8('0x1f')]):_0x16e8('0x21'),'XMD-AGIAFTER':_0x26f4c4[_0x16e8('0x22')]?util[_0x16e8('0x11')](_0x16e8('0x20'),ipAgi,_0x26f4c4[_0x16e8('0x22')]):_0x16e8('0x21'),'XMD-ORIGINATECALLERIDNUM':_0x46221b?_0x46221b[_0x16e8('0x23')]:'','XMD-ORIGINATECALLERIDNAME':_0x46221b?_0x46221b[_0x16e8('0x24')]:'','XMD-DESTINATION':_0x16e8('0x25')};if(!_[_0x16e8('0x10')](_0x26f4c4['monitor_format'])){_0x4a6e63[util['format']('%s','_XCALLY_MIXMONITOR_FORMAT')]=_0x26f4c4[_0x16e8('0x1c')];_0x4a6e63[util['format']('%s','_XCALLY_MIXMONITOR_UNIQUEID')]=_0x34a966;}if(_0x307573&&_0x307573['Contact']){for(var _0x4f8892 in _0x307573['Contact']){if(_0x307573[_0x16e8('0x26')]['hasOwnProperty'](_0x4f8892)){if(!_[_0x16e8('0x27')](_0x307573[_0x16e8('0x26')][_0x4f8892])&&_0x4f8892!=='id'&&_0x4f8892!==_0x16e8('0x28')&&_0x4f8892!==_0x16e8('0x29')&&_0x4f8892!=='updatedAt'){_0x4a6e63[util[_0x16e8('0x11')](_0x16e8('0x2a'),_0x16e8('0x2b'),_[_0x16e8('0x2c')](_0x4f8892))]=_0x307573[_0x16e8('0x26')][_0x4f8892];}}}}return _0x4a6e63;};exports['toLowerVariables']=function(_0x9bc528){var _0x1da38b={};for(var _0x216eab in _0x9bc528){if(_0x9bc528[_0x16e8('0x2d')](_0x216eab)){_0x1da38b[util[_0x16e8('0x11')]('%s',_[_0x16e8('0x2e')](_0x216eab))]=_0x9bc528[_0x216eab];}}return{'variables':_0x1da38b};};exports[_0x16e8('0x2f')]=function(_0x2b23a1,_0x4f1e3b){if(!_[_0x16e8('0x27')](_0x2b23a1)){if(_0x2b23a1[_0x16e8('0x2d')](_0x16e8('0x30'))){if(_0x2b23a1[_0x16e8('0x30')]>0x0){_0x2b23a1[_0x16e8('0x30')]-=0x1;}else{logger[_0x16e8('0x7')](_0x16e8('0x31'),_0x4f1e3b);}}}else{logger[_0x16e8('0x7')]('[updateOriginated]\x20is\x20null\x20or\x20undefined',_0x4f1e3b);}};exports[_0x16e8('0x32')]=function(_0x324e6e){var _0x118df2=moment()[_0x16e8('0x11')](_0x16e8('0x33'));_0x324e6e[_0x16e8('0x34')]=0xd;_0x324e6e[_0x16e8('0x35')]=_0x16e8('0x36');_0x324e6e[_0x16e8('0x37')]=_0x118df2;_0x324e6e[_0x16e8('0x38')]=_0x118df2;_0x324e6e['endtime']=_0x118df2;};exports[_0x16e8('0x39')]=function(_0x40faa7,_0x55d3d8,_0x11c33b){var _0x39cef0=moment()[_0x16e8('0x11')](_0x16e8('0x33'));_0x40faa7[_0x16e8('0x34')]=_0x55d3d8;_0x40faa7[_0x16e8('0x35')]=_0x11c33b;_0x40faa7['responsetime']=_0x39cef0;_0x40faa7['ringtime']=getSeconds(_0x40faa7[_0x16e8('0x38')],_0x40faa7[_0x16e8('0x37')]);};exports[_0x16e8('0x3a')]=function(_0x365770,_0x6dd60d,_0x3d53fe){_0x365770['membername']=_0x6dd60d;_0x365770['UserId']=_0x3d53fe;};exports[_0x16e8('0x3b')]=function(_0x4631c5,_0x4d0733,_0x236796){var _0x2cfd40=moment()['format'](_0x16e8('0x33'));_0x4631c5['state']=_0x4d0733;_0x4631c5[_0x16e8('0x35')]=_0x236796;_0x4631c5[_0x16e8('0x38')]=_0x4631c5[_0x16e8('0x38')]?_0x4631c5['responsetime']:_0x2cfd40;_0x4631c5[_0x16e8('0x3c')]=_0x4631c5['endtime']?_0x4631c5[_0x16e8('0x3c')]:_0x2cfd40;_0x4631c5[_0x16e8('0x3d')]=getSeconds(_0x4631c5[_0x16e8('0x38')]||0x0,_0x4631c5['starttime']||0x0);_0x4631c5[_0x16e8('0x3e')]=_0x4631c5[_0x16e8('0x3f')]?getSeconds(_0x4631c5[_0x16e8('0x3c')],_0x4631c5['answertime']):0x0;};exports[_0x16e8('0x40')]=function(_0x53bcb8){return _0x53bcb8===_0x16e8('0x41');};exports[_0x16e8('0x42')]=function(_0x39e295,_0x465136,_0x3553b7,_0x444f48,_0xe79816){var _0x22bc5d=_0x444f48?'RECALL':_0x39e295['calleridname'];_0x22bc5d=_0xe79816?_0x16e8('0x43'):_0x22bc5d;return{'actionid':_0x39e295['uniqueid'],'action':'originate','channel':_0x39e295[_0x16e8('0x44')],'callerid':util[_0x16e8('0x11')](_0x16e8('0x12'),_0x22bc5d,_0x39e295[_0x16e8('0x19')]),'Exten':_0x16e8('0x25'),'Context':_0x16e8('0x45'),'Priority':'1','variable':_0x3553b7,'timeout':(_0x465136['timeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x39e295['uniqueid']};};exports[_0x16e8('0x46')]=function(_0x51a578){return _0x51a578[_0x16e8('0x47')]+_0x51a578[_0x16e8('0x48')]+_0x51a578[_0x16e8('0x49')]+_0x51a578[_0x16e8('0x4a')]+_0x51a578['countnosuchnumberretry'];};exports['cloneAction']=function(_0x5c6183){var _0x2b6a85=_['clone'](_0x5c6183);_0x2b6a85[_0x16e8('0x34')]=0xf;_0x2b6a85[_0x16e8('0x35')]=_0x16e8('0x4b');return _0x2b6a85;};exports[_0x16e8('0x4c')]=function(_0x4664de,_0x488780,_0x47fc8f){var _0x159e02={};_0x159e02[_0x488780]=_0x4664de[_0x488780];_0x159e02[_0x16e8('0x4d')]=![];_0x159e02[_0x16e8('0x4e')]=moment()[_0x16e8('0x4f')](_0x47fc8f,_0x16e8('0x50'))['format']('YYYY-MM-DD\x20HH:mm:ss');_0x159e02[_0x16e8('0x1a')]=_0x4664de['ContactId'];_0x159e02[_0x16e8('0x51')]=_0x4664de[_0x16e8('0x51')];_0x159e02['VoiceQueueId']=_0x4664de[_0x16e8('0x52')]||undefined;return _0x159e02;};exports[_0x16e8('0x53')]=function(_0x375b59,_0xfa41f1){if(!_[_0x16e8('0x27')](_0x375b59)){if(_0x375b59[_0x16e8('0x54')]>0x0){_0x375b59[_0x16e8('0x54')]-=0x1;}else{logger['error'](_0xfa41f1,_0x16e8('0x55'));}}else{logger['error'](_0xfa41f1,'[decrementTalkink]\x20is\x20null\x20or\x20undefined');}};exports[_0x16e8('0x56')]=function(_0x54ac93){if(_0x54ac93<=0x0){return!![];}return![];};exports[_0x16e8('0x57')]=function(_0x39a804,_0x30314b,_0x4398a8){_0x39a804[_0x16e8('0x58')]=_0x30314b;_0x39a804['name']=_0x39a804['queue'];_0x39a804[_0x16e8('0x59')]=_0x39a804[_0x16e8('0x44')];if(_0x4398a8){_0x39a804[_0x16e8('0x5a')]=_0x4398a8[_0x16e8('0x5a')];}return _0x39a804;};exports[_0x16e8('0x5b')]=function(_0x1c4a9d){var _0x164464={};_0x164464[_0x16e8('0x5c')]=_0x1c4a9d[_0x16e8('0x5c')];_0x164464[_0x16e8('0x59')]=_0x1c4a9d[_0x16e8('0x44')];_0x164464[_0x16e8('0x5d')]=_0x1c4a9d[_0x16e8('0x5d')];return _0x164464;};exports[_0x16e8('0x5e')]=function(_0x49d7a9){var _0x49510f=[];for(var _0x5820e3 in _0x49d7a9){if(_0x49d7a9['hasOwnProperty'](_0x5820e3)){if(!_['isNil'](_0x49d7a9[_0x5820e3])&&_0x49d7a9[_0x5820e3][_0x16e8('0x34')]===_0x16e8('0x5f')&&_0x49d7a9[_0x5820e3]['status']===_0x16e8('0x60')){_0x49510f['push'](_0x49d7a9[_0x5820e3]['id']);}}}return _0x49510f;};exports[_0x16e8('0x61')]=function(_0x248816){var _0x1cbb47=moment()[_0x16e8('0x62')](0x0);var _0x559674=moment(_0x248816)['milliseconds'](0x0);return _0x1cbb47[_0x16e8('0x5')](_0x559674,_0x16e8('0x63'));};exports['createBody']=function(_0x513071){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x513071[_0x16e8('0x1a')],'ListId':_0x513071[_0x16e8('0x51')],'VoiceQueueId':_0x513071[_0x16e8('0x52')]||undefined,'CampaignId':_0x513071[_0x16e8('0x64')]||undefined};};exports[_0x16e8('0x65')]=function(_0x272e5e){if(_0x272e5e===_0x16e8('0x5d')||_0x272e5e===_0x16e8('0x66')||_0x272e5e===_0x16e8('0x5c')||_0x272e5e===_0x16e8('0x67')||_0x272e5e===_0x16e8('0x68')||_0x272e5e==='dialAnswer'||_0x272e5e===_0x16e8('0x69')||_0x272e5e===_0x16e8('0x44')||_0x272e5e===_0x16e8('0x18')||_0x272e5e==='active'||_0x272e5e===_0x16e8('0x19')||_0x272e5e==='scheduledat'||_0x272e5e===_0x16e8('0x47')||_0x272e5e==='countcongestionretry'||_0x272e5e===_0x16e8('0x49')||_0x272e5e==='countglobal'||_0x272e5e===_0x16e8('0x6a')||_0x272e5e===_0x16e8('0x6b')||_0x272e5e===_0x16e8('0x6c')||_0x272e5e===_0x16e8('0x6d')||_0x272e5e===_0x16e8('0x1a')||_0x272e5e==='ListId'||_0x272e5e===_0x16e8('0x6e')||_0x272e5e==='VoiceQueueId'||_0x272e5e===_0x16e8('0x6f')||_0x272e5e===_0x16e8('0x70')||_0x272e5e===_0x16e8('0x71')||_0x272e5e==='xmd-phone'||_0x272e5e==='xmd-listid'||_0x272e5e==='xmd-dialurl'||_0x272e5e==='xmd-dialtimeout'||_0x272e5e===_0x16e8('0x72')||_0x272e5e===_0x16e8('0x73')||_0x272e5e===_0x16e8('0x74')||_0x272e5e===_0x16e8('0x75')||_0x272e5e===_0x16e8('0x76')||_0x272e5e===_0x16e8('0x77')||_0x272e5e==='xmd-agiafter'||_0x272e5e===_0x16e8('0x78')||_0x272e5e==='rtpaudioqos'||_0x272e5e===_0x16e8('0x79')||_0x272e5e===_0x16e8('0x7a')||_0x272e5e==='rtpaudioqosjitterbridged'||_0x272e5e===_0x16e8('0x7b')||_0x272e5e===_0x16e8('0x7c')||_0x272e5e==='rtpaudioqosrtt'||_0x272e5e===_0x16e8('0x7d')||_0x272e5e===_0x16e8('0x7e')||_0x272e5e===_0x16e8('0x79')||_0x272e5e==='rtpaudioqosjitter'||_0x272e5e===_0x16e8('0x7f')||_0x272e5e===_0x16e8('0x7b')||_0x272e5e===_0x16e8('0x7c')||_0x272e5e===_0x16e8('0x80')||_0x272e5e==='rtpaudioqosrttbridged'||_0x272e5e===_0x16e8('0x81')||_0x272e5e===_0x16e8('0x82')||_0x272e5e===_0x16e8('0x34')||_0x272e5e===_0x16e8('0x35')){return![];}return!![];};exports['getCallerIdRandom']=function(_0x3c10e6,_0x26c6a9){var _0x2fa2c1,_0x57ae64,_0x222fa9;if(_0x26c6a9<=0x0){_0x26c6a9=0x1;}_0x2fa2c1=new RegExp(_0x16e8('0x83')+_0x26c6a9+'}$');_0x57ae64=Math['pow'](0xa,_0x26c6a9-0x1);_0x222fa9=Math[_0x16e8('0x84')](0xa,_0x26c6a9)-0x1;return util[_0x16e8('0x11')]('%s',_['replace'](_0x3c10e6,_0x2fa2c1,_[_0x16e8('0x85')](_0x57ae64,_0x222fa9)));};exports[_0x16e8('0x86')]=function(_0x366352){var _0x26298a=_0x366352[_0x16e8('0x87')](/"(.*?)"/);return _0x26298a?_0x26298a[0x1]:_0x366352;};exports['extractCalleridNumber']=function(_0x447fce){var _0x3d39e6=_0x447fce['match'](/<(.*?)>/);return _0x3d39e6?_0x3d39e6[0x1]:_0x447fce;}; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index be58d1c..6af3573 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 _0xb882=['string','number','boolean','queueremove','queuepause','reload','voicequeuechannel','voicechannel','voicequeuechannelhangup','voicequeuechannelredirect'];(function(_0x2f06b3,_0x12feb6){var _0x270d4d=function(_0x5e3720){while(--_0x5e3720){_0x2f06b3['push'](_0x2f06b3['shift']());}};_0x270d4d(++_0x12feb6);}(_0xb882,0x19a));var _0x2b88=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0xb882[_0x34bc30];return _0x5706de;};'use strict';exports['queueadd']={'queue':{'type':'string','required':!![]},'interface':{'type':_0x2b88('0x0'),'required':!![]},'membername':{'type':_0x2b88('0x0'),'required':!![]},'penalty':{'type':_0x2b88('0x1'),'required':![]},'paused':{'type':_0x2b88('0x2'),'required':![]}};exports[_0x2b88('0x3')]={'queue':{'type':'string','required':!![]},'interface':{'type':_0x2b88('0x0'),'required':!![]}};exports[_0x2b88('0x4')]={'interface':{'type':_0x2b88('0x0'),'required':!![]},'paused':{'type':'boolean'},'reason':{'type':_0x2b88('0x0'),'required':![]}};exports[_0x2b88('0x5')]={'module':{'type':'string','required':![]}};exports[_0x2b88('0x6')]={'uniqueid':{'type':_0x2b88('0x0'),'required':!![]}};exports[_0x2b88('0x7')]={'uniqueid':{'type':'string','required':!![]},'filename':{'type':_0x2b88('0x0')},'format':{'type':_0x2b88('0x0')},'mixmonitorid':{'type':_0x2b88('0x0')}};exports[_0x2b88('0x8')]={'uniqueid':{'type':_0x2b88('0x0'),'required':!![]}};exports[_0x2b88('0x9')]={'uniqueid':{'type':_0x2b88('0x0'),'required':!![]},'exten':{'type':'string','required':!![]},'context':{'type':_0x2b88('0x0')}}; \ No newline at end of file +var _0x7f1f=['number','boolean','queueremove','queuepause','reload','voicequeuechannel','voicequeuechannelredirect','string'];(function(_0x416644,_0x2c7cbf){var _0x3f8f40=function(_0x56bdd6){while(--_0x56bdd6){_0x416644['push'](_0x416644['shift']());}};_0x3f8f40(++_0x2c7cbf);}(_0x7f1f,0x177));var _0xf7f1=function(_0xb0f7c3,_0x4eae95){_0xb0f7c3=_0xb0f7c3-0x0;var _0x28ea68=_0x7f1f[_0xb0f7c3];return _0x28ea68;};'use strict';exports['queueadd']={'queue':{'type':_0xf7f1('0x0'),'required':!![]},'interface':{'type':_0xf7f1('0x0'),'required':!![]},'membername':{'type':_0xf7f1('0x0'),'required':!![]},'penalty':{'type':_0xf7f1('0x1'),'required':![]},'paused':{'type':_0xf7f1('0x2'),'required':![]}};exports[_0xf7f1('0x3')]={'queue':{'type':_0xf7f1('0x0'),'required':!![]},'interface':{'type':'string','required':!![]}};exports[_0xf7f1('0x4')]={'interface':{'type':_0xf7f1('0x0'),'required':!![]},'paused':{'type':_0xf7f1('0x2')},'reason':{'type':_0xf7f1('0x0'),'required':![]}};exports[_0xf7f1('0x5')]={'module':{'type':_0xf7f1('0x0'),'required':![]}};exports[_0xf7f1('0x6')]={'uniqueid':{'type':'string','required':!![]}};exports['voicechannel']={'uniqueid':{'type':_0xf7f1('0x0'),'required':!![]},'filename':{'type':_0xf7f1('0x0')},'format':{'type':_0xf7f1('0x0')},'mixmonitorid':{'type':_0xf7f1('0x0')}};exports['voicequeuechannelhangup']={'uniqueid':{'type':_0xf7f1('0x0'),'required':!![]}};exports[_0xf7f1('0x7')]={'uniqueid':{'type':_0xf7f1('0x0'),'required':!![]},'exten':{'type':'string','required':!![]},'context':{'type':'string'}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index 01525af..b9fb76f 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 _0x922b=['sumBillable','isEmpty','ivrTotalCallsDays','ivrAnswerCallsDay','answered','unmanaged','abandoned','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundAnswerCallsDay','queueStatusComplete','mergeFromDatabase','prototype','initAgents','length','isUndefined','initVoiceQueues','initTriggers','triggers','initZendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','zohoAccounts','initDeskAccounts','initVtigerAccounts','initServicenowAccounts','initDynamics365Accounts','merge','initVoiceQueueReports','groupBy','queue','queuecallerabandon','queuecallerleaveAt','seconds','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','diff','queuecallerjoinAt','queuecallercomplete','disposition','ANSWERED','duration','billableseconds','initCampaigns','dialQueueProject','SquareProject','initVoiceExtensions','initCampaignHopperHistory','initFaxAccounts','faxAccounts','exports','bluebird','util','../model/trunk','../model/trigger','../model/voiceExtension','../model/zendeskAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','agents','telephones','trunks','voiceQueues','campaigns','templates','outbound','voiceExtensions','channels','settings','zendeskAccounts','salesforceAccounts','sugarcrmAccounts','freshdeskAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','mapKeys','hasOwnProperty','format','SIP/%s','name','isNil','interface','total','sumHoldTime','sumDuration'];(function(_0x548003,_0x19cd0e){var _0x459a44=function(_0x1057c3){while(--_0x1057c3){_0x548003['push'](_0x548003['shift']());}};_0x459a44(++_0x19cd0e);}(_0x922b,0x175));var _0xb922=function(_0x57cd53,_0x29bfcd){_0x57cd53=_0x57cd53-0x0;var _0xc7c329=_0x922b[_0x57cd53];return _0xc7c329;};'use strict';var BPromise=require(_0xb922('0x0'));var util=require(_0xb922('0x1'));var _=require('lodash');var moment=require('moment');var Agent=require('../model/agent');var Telephone=require('../model/telephone');var Trunk=require(_0xb922('0x2'));var VoiceQueue=require('../model/voiceQueue');var Trigger=require(_0xb922('0x3'));var Template=require('../model/template');var Campaign=require('../model/campaign');var VoiceExtension=require(_0xb922('0x4'));var ZendeskAccount=require(_0xb922('0x5'));var SalesforceAccount=require('../model/salesforceAccount');var FreshdeskAccount=require(_0xb922('0x6'));var SugarcrmAccount=require(_0xb922('0x7'));var ZohoAccount=require('../model/zohoAccount');var DeskAccount=require(_0xb922('0x8'));var VtigerAccount=require(_0xb922('0x9'));var ServicenowAccount=require(_0xb922('0xa'));var Dynamics365Account=require(_0xb922('0xb'));var FreshsalesAccount=require(_0xb922('0xc'));var FaxAccount=require(_0xb922('0xd'));var Realtime=function(){this[_0xb922('0xe')]={};this[_0xb922('0xf')]={};this[_0xb922('0x10')]={};this[_0xb922('0x11')]={};this['triggers']={};this[_0xb922('0x12')]={};this[_0xb922('0x13')]={};this[_0xb922('0x14')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0xb922('0x15')]={};this[_0xb922('0x16')]={};this['queueChannels']={};this['outboundChannels']={};this['timers']={};this[_0xb922('0x17')]={};this[_0xb922('0x18')]={};this[_0xb922('0x19')]={};this[_0xb922('0x1a')]={};this[_0xb922('0x1b')]={};this['zohoAccounts']={};this[_0xb922('0x1c')]={};this[_0xb922('0x1d')]={};this[_0xb922('0x1e')]={};this[_0xb922('0x1f')]={};this[_0xb922('0x20')]={};this['faxAccounts']={};};function freeIsNotKey(_0x38531f,_0x207063,_0x23eb63){var _0x21c71e=_[_0xb922('0x21')](_0x38531f,function(_0x201255,_0x5cf917){return _0x201255[_0x23eb63];});for(var _0x32b63f in _0x207063){if(_0x207063[_0xb922('0x22')](_0x32b63f)){if(!_0x21c71e[_0x32b63f]){delete _0x207063[_0x32b63f];}}}}function freeIsNotKeySip(_0x3d0490,_0x11896a){var _0xca1d51=_['mapKeys'](_0x3d0490,function(_0x449d80,_0x1624a7){return util[_0xb922('0x23')](_0xb922('0x24'),_0x449d80[_0xb922('0x25')]);});for(var _0x50a0dd in _0x11896a){if(_0x11896a[_0xb922('0x22')](_0x50a0dd)){if(!_0xca1d51[_0x50a0dd]){delete _0x11896a[_0x50a0dd];}}}}function freeIsNotKeyAgent(_0x133ab6,_0x207820){var _0x36f8c1=_[_0xb922('0x21')](_0x133ab6,function(_0x514cc8,_0x4aac9b){var _0x2e4d2d=_[_0xb922('0x26')](_0x514cc8[_0xb922('0x27')])?util[_0xb922('0x23')](_0xb922('0x24'),_0x514cc8[_0xb922('0x25')]):_0x514cc8[_0xb922('0x27')];return _0x2e4d2d;});for(var _0x44a862 in _0x207820){if(_0x207820[_0xb922('0x22')](_0x44a862)){if(!_0x36f8c1[_0x44a862]){delete _0x207820[_0x44a862];}}}}function clearVoiceCallReports(_0x1c083c){_0x1c083c[_0xb922('0x28')]=0x0;_0x1c083c['answered']=0x0;_0x1c083c[_0xb922('0x29')]=0x0;_0x1c083c[_0xb922('0x2a')]=0x0;_0x1c083c[_0xb922('0x2b')]=0x0;}function clearCampaigns(_0x565d18){if(!_[_0xb922('0x2c')](_0x565d18)){for(var _0x1a9672 in _0x565d18){if(_0x565d18[_0xb922('0x22')](_0x1a9672)){_0x565d18[_0x1a9672][_0xb922('0x2d')]=0x0;_0x565d18[_0x1a9672][_0xb922('0x2e')]=0x0;}}}}function clearVoiceQueues(_0x373714){if(!_[_0xb922('0x2c')](_0x373714)){for(var _0x22f3f4 in _0x373714){if(_0x373714[_0xb922('0x22')](_0x22f3f4)){_0x373714[_0x22f3f4][_0xb922('0x28')]=0x0;_0x373714[_0x22f3f4][_0xb922('0x2f')]=0x0;_0x373714[_0x22f3f4][_0xb922('0x30')]=0x0;_0x373714[_0x22f3f4][_0xb922('0x31')]=0x0;_0x373714[_0x22f3f4][_0xb922('0x29')]=0x0;_0x373714[_0x22f3f4][_0xb922('0x2a')]=0x0;_0x373714[_0x22f3f4]['sumBillable']=0x0;_0x373714[_0x22f3f4][_0xb922('0x32')]=0x0;_0x373714[_0x22f3f4][_0xb922('0x33')]=0x0;_0x373714[_0x22f3f4][_0xb922('0x34')]=0x0;_0x373714[_0x22f3f4][_0xb922('0x35')]=0x0;_0x373714[_0x22f3f4][_0xb922('0x36')]=0x0;_0x373714[_0x22f3f4][_0xb922('0x37')]=0x0;_0x373714[_0x22f3f4][_0xb922('0x38')]=0x0;_0x373714[_0x22f3f4][_0xb922('0x39')]=0x0;_0x373714[_0x22f3f4][_0xb922('0x3a')]=0x0;_0x373714[_0x22f3f4][_0xb922('0x3b')]=0x0;_0x373714[_0x22f3f4][_0xb922('0x3c')]=0x0;_0x373714[_0x22f3f4]['outboundReCallsDay']=0x0;_0x373714[_0x22f3f4][_0xb922('0x32')]=0x0;_0x373714[_0x22f3f4][_0xb922('0x3d')]=0x0;_0x373714[_0x22f3f4][_0xb922('0x3e')]=!![];}}}}Realtime['prototype'][_0xb922('0x3f')]=function(_0x92a1b5,_0x4bb593){for(var _0x150c3e in _0x4bb593){if(_0x92a1b5[_0xb922('0x22')](_0x150c3e)){_0x92a1b5[_0x150c3e]=_0x4bb593[_0x150c3e];}}};Realtime[_0xb922('0x40')][_0xb922('0x41')]=function(){var _0x38ee2e=this;return function(_0x2fc7fd){if(_0x2fc7fd){freeIsNotKeyAgent(_0x2fc7fd,_0x38ee2e[_0xb922('0xe')]);for(var _0x436290=0x0,_0x2c99c8={},_0x192ccd={};_0x436290<_0x2fc7fd[_0xb922('0x42')];_0x436290+=0x1){_0x2c99c8=_0x2fc7fd[_0x436290];var _0x1b9833=_[_0xb922('0x26')](_0x2c99c8['interface'])?util[_0xb922('0x23')](_0xb922('0x24'),_0x2c99c8[_0xb922('0x25')]):_0x2c99c8[_0xb922('0x27')];if(_[_0xb922('0x43')](_0x38ee2e[_0xb922('0xe')][_0x1b9833])){_0x38ee2e[_0xb922('0xe')][_0x1b9833]=new Agent(_0x2c99c8);}else{_0x38ee2e['mergeFromDatabase'](_0x38ee2e['agents'][_0x1b9833],_0x2c99c8);}}}return _0x38ee2e[_0xb922('0xe')];};};Realtime['prototype']['initTelephones']=function(){var _0x116d6a=this;return function(_0x4d1d61){if(_0x4d1d61){freeIsNotKeySip(_0x4d1d61,_0x116d6a[_0xb922('0xf')]);for(var _0x128f62=0x0,_0x337c0b={},_0xb1b0db={};_0x128f62<_0x4d1d61[_0xb922('0x42')];_0x128f62+=0x1){_0x337c0b=_0x4d1d61[_0x128f62];if(_[_0xb922('0x43')](_0x116d6a[_0xb922('0xf')][util['format'](_0xb922('0x24'),_0x337c0b[_0xb922('0x25')])])){_0x116d6a[_0xb922('0xf')][util[_0xb922('0x23')](_0xb922('0x24'),_0x337c0b[_0xb922('0x25')])]=new Telephone(_0x337c0b);}else{_0x116d6a[_0xb922('0x3f')](_0x116d6a['telephones'][util[_0xb922('0x23')](_0xb922('0x24'),_0x337c0b['name'])],_0x337c0b);}}}return _0x116d6a[_0xb922('0xf')];};};Realtime[_0xb922('0x40')]['initTrunks']=function(){var _0x181be0=this;return function(_0x48e8ff){if(_0x48e8ff){freeIsNotKeySip(_0x48e8ff,_0x181be0['trunks']);for(var _0x57e822=0x0,_0x353f38={},_0x124377={};_0x57e822<_0x48e8ff[_0xb922('0x42')];_0x57e822+=0x1){_0x353f38=_0x48e8ff[_0x57e822];if(_[_0xb922('0x43')](_0x181be0[_0xb922('0x10')][util[_0xb922('0x23')]('SIP/%s',_0x353f38[_0xb922('0x25')])])){_0x181be0[_0xb922('0x10')][util[_0xb922('0x23')](_0xb922('0x24'),_0x353f38[_0xb922('0x25')])]=new Trunk(_0x353f38);}else{_0x181be0[_0xb922('0x3f')](_0x181be0['trunks'][util[_0xb922('0x23')]('SIP/%s',_0x353f38[_0xb922('0x25')])],_0x353f38);}}}return _0x181be0[_0xb922('0x10')];};};Realtime[_0xb922('0x40')][_0xb922('0x44')]=function(){var _0x391cbf=this;return function(_0x224181){if(_0x224181){freeIsNotKey(_0x224181,_0x391cbf[_0xb922('0x11')],_0xb922('0x25'));for(var _0x5c78b0=0x0,_0x3a7029={},_0x5579a6={};_0x5c78b0<_0x224181[_0xb922('0x42')];_0x5c78b0+=0x1){_0x3a7029=_0x224181[_0x5c78b0];if(_['isUndefined'](_0x391cbf['voiceQueues'][_0x3a7029[_0xb922('0x25')]])){_0x391cbf['voiceQueues'][_0x3a7029[_0xb922('0x25')]]=new VoiceQueue(_0x3a7029);}else{_0x391cbf[_0xb922('0x3f')](_0x391cbf[_0xb922('0x11')][_0x3a7029[_0xb922('0x25')]],_0x3a7029);}}}return _0x391cbf[_0xb922('0x11')];};};Realtime[_0xb922('0x40')][_0xb922('0x45')]=function(){var _0x5b4868=this;return function(_0x4821e8){if(_0x4821e8){freeIsNotKey(_0x4821e8,_0x5b4868[_0xb922('0x46')],'id');for(var _0x3dd60f=0x0,_0x3dfaf0={},_0x452785={};_0x3dd60f<_0x4821e8[_0xb922('0x42')];_0x3dd60f+=0x1){_0x3dfaf0=_0x4821e8[_0x3dd60f];if(_[_0xb922('0x43')](_0x5b4868[_0xb922('0x46')][_0x3dfaf0['id']])){_0x5b4868[_0xb922('0x46')][_0x3dfaf0['id']]=new Trigger(_0x3dfaf0);}else{_0x5b4868[_0xb922('0x3f')](_0x5b4868[_0xb922('0x46')][_0x3dfaf0['id']],_0x3dfaf0);}}}return _0x5b4868[_0xb922('0x46')];};};Realtime[_0xb922('0x40')]['initTemplates']=function(){var _0x4647c9=this;return function(_0x5e1256){if(_0x5e1256){freeIsNotKey(_0x5e1256,_0x4647c9[_0xb922('0x13')],'id');for(var _0x2c3408=0x0,_0x178530={},_0x1e0e9e={};_0x2c3408<_0x5e1256['length'];_0x2c3408+=0x1){_0x178530=_0x5e1256[_0x2c3408];if(_[_0xb922('0x43')](_0x4647c9[_0xb922('0x13')][_0x178530['id']])){_0x4647c9[_0xb922('0x13')][_0x178530['id']]=new Template(_0x178530);}else{_0x4647c9[_0xb922('0x3f')](_0x4647c9[_0xb922('0x13')][_0x178530['id']],_0x178530);}}}return _0x4647c9['templates'];};};Realtime[_0xb922('0x40')][_0xb922('0x47')]=function(){var _0x3d185c=this;return function(_0x5af2b0){if(_0x5af2b0){freeIsNotKey(_0x5af2b0,_0x3d185c[_0xb922('0x18')],'id');for(var _0x3748ee=0x0,_0x1bf4f1={},_0x567785={};_0x3748ee<_0x5af2b0[_0xb922('0x42')];_0x3748ee+=0x1){_0x1bf4f1=_0x5af2b0[_0x3748ee];if(_[_0xb922('0x43')](_0x3d185c[_0xb922('0x18')][_0x1bf4f1['id']])){_0x3d185c['zendeskAccounts'][_0x1bf4f1['id']]=new ZendeskAccount(_0x1bf4f1);}else{_0x3d185c[_0xb922('0x3f')](_0x3d185c[_0xb922('0x18')][_0x1bf4f1['id']],_0x1bf4f1);}}}return _0x3d185c[_0xb922('0x18')];};};Realtime[_0xb922('0x40')][_0xb922('0x48')]=function(){var _0x43791a=this;return function(_0x5b5298){if(_0x5b5298){freeIsNotKey(_0x5b5298,_0x43791a['salesforceAccounts'],'id');for(var _0x57356d=0x0,_0xf61c61={},_0x1a5289={};_0x57356d<_0x5b5298[_0xb922('0x42')];_0x57356d+=0x1){_0xf61c61=_0x5b5298[_0x57356d];if(_[_0xb922('0x43')](_0x43791a[_0xb922('0x19')][_0xf61c61['id']])){_0x43791a[_0xb922('0x19')][_0xf61c61['id']]=new SalesforceAccount(_0xf61c61);}else{_0x43791a[_0xb922('0x3f')](_0x43791a[_0xb922('0x19')][_0xf61c61['id']],_0xf61c61);}}}return _0x43791a[_0xb922('0x19')];};};Realtime['prototype'][_0xb922('0x49')]=function(){var _0x1433a5=this;return function(_0x3d8cb1){if(_0x3d8cb1){freeIsNotKey(_0x3d8cb1,_0x1433a5[_0xb922('0x1b')],'id');for(var _0x8857a=0x0,_0x311b53={},_0x3ac268={};_0x8857a<_0x3d8cb1[_0xb922('0x42')];_0x8857a+=0x1){_0x311b53=_0x3d8cb1[_0x8857a];if(_['isUndefined'](_0x1433a5[_0xb922('0x1b')][_0x311b53['id']])){_0x1433a5[_0xb922('0x1b')][_0x311b53['id']]=new FreshdeskAccount(_0x311b53);}else{_0x1433a5[_0xb922('0x3f')](_0x1433a5[_0xb922('0x1b')][_0x311b53['id']],_0x311b53);}}}return _0x1433a5['freshdeskAccounts'];};};Realtime[_0xb922('0x40')]['initZohoAccounts']=function(){var _0x1bc5fc=this;return function(_0xea141b){if(_0xea141b){freeIsNotKey(_0xea141b,_0x1bc5fc[_0xb922('0x4a')],'id');for(var _0x3080e6=0x0,_0x5cd587={},_0x1548e1={};_0x3080e6<_0xea141b[_0xb922('0x42')];_0x3080e6+=0x1){_0x5cd587=_0xea141b[_0x3080e6];if(_[_0xb922('0x43')](_0x1bc5fc[_0xb922('0x4a')][_0x5cd587['id']])){_0x1bc5fc[_0xb922('0x4a')][_0x5cd587['id']]=new ZohoAccount(_0x5cd587);}else{_0x1bc5fc[_0xb922('0x3f')](_0x1bc5fc[_0xb922('0x4a')][_0x5cd587['id']],_0x5cd587);}}}return _0x1bc5fc['zohoAccounts'];};};Realtime[_0xb922('0x40')][_0xb922('0x4b')]=function(){var _0x50515d=this;return function(_0x46e81f){if(_0x46e81f){freeIsNotKey(_0x46e81f,_0x50515d[_0xb922('0x1c')],'id');for(var _0x42d216=0x0,_0x2ae067={},_0x3237cd={};_0x42d216<_0x46e81f[_0xb922('0x42')];_0x42d216+=0x1){_0x2ae067=_0x46e81f[_0x42d216];if(_[_0xb922('0x43')](_0x50515d['deskAccounts'][_0x2ae067['id']])){_0x50515d[_0xb922('0x1c')][_0x2ae067['id']]=new DeskAccount(_0x2ae067);}else{_0x50515d[_0xb922('0x3f')](_0x50515d[_0xb922('0x1c')][_0x2ae067['id']],_0x2ae067);}}}return _0x50515d[_0xb922('0x1c')];};};Realtime[_0xb922('0x40')]['initSugarcrmAccounts']=function(){var _0xa2964b=this;return function(_0x10e5a8){if(_0x10e5a8){freeIsNotKey(_0x10e5a8,_0xa2964b[_0xb922('0x1a')],'id');for(var _0x22a78f=0x0,_0x5455a7={},_0x3849ab={};_0x22a78f<_0x10e5a8[_0xb922('0x42')];_0x22a78f+=0x1){_0x5455a7=_0x10e5a8[_0x22a78f];if(_[_0xb922('0x43')](_0xa2964b[_0xb922('0x1a')][_0x5455a7['id']])){_0xa2964b[_0xb922('0x1a')][_0x5455a7['id']]=new SugarcrmAccount(_0x5455a7);}else{_0xa2964b[_0xb922('0x3f')](_0xa2964b[_0xb922('0x1a')][_0x5455a7['id']],_0x5455a7);}}}return _0xa2964b['sugarcrmAccounts'];};};Realtime[_0xb922('0x40')][_0xb922('0x4c')]=function(){var _0x3baf53=this;return function(_0x4d7cd4){if(_0x4d7cd4){freeIsNotKey(_0x4d7cd4,_0x3baf53[_0xb922('0x1d')],'id');for(var _0x4fbca9=0x0,_0xf3cdd5={},_0x2fb7c3={};_0x4fbca9<_0x4d7cd4[_0xb922('0x42')];_0x4fbca9+=0x1){_0xf3cdd5=_0x4d7cd4[_0x4fbca9];if(_[_0xb922('0x43')](_0x3baf53['vtigerAccounts'][_0xf3cdd5['id']])){_0x3baf53[_0xb922('0x1d')][_0xf3cdd5['id']]=new VtigerAccount(_0xf3cdd5);}else{_0x3baf53['mergeFromDatabase'](_0x3baf53[_0xb922('0x1d')][_0xf3cdd5['id']],_0xf3cdd5);}}}return _0x3baf53[_0xb922('0x1d')];};};Realtime['prototype'][_0xb922('0x4d')]=function(){var _0x1e06b5=this;return function(_0x42c612){if(_0x42c612){freeIsNotKey(_0x42c612,_0x1e06b5['servicenowAccounts'],'id');for(var _0x4d1678=0x0,_0x4b2b71={},_0x51b886={};_0x4d1678<_0x42c612[_0xb922('0x42')];_0x4d1678+=0x1){_0x4b2b71=_0x42c612[_0x4d1678];if(_[_0xb922('0x43')](_0x1e06b5['servicenowAccounts'][_0x4b2b71['id']])){_0x1e06b5[_0xb922('0x1e')][_0x4b2b71['id']]=new ServicenowAccount(_0x4b2b71);}else{_0x1e06b5['mergeFromDatabase'](_0x1e06b5['servicenowAccounts'][_0x4b2b71['id']],_0x4b2b71);}}}return _0x1e06b5[_0xb922('0x1e')];};};Realtime['prototype'][_0xb922('0x4e')]=function(){var _0x4d8526=this;return function(_0x4cd507){if(_0x4cd507){freeIsNotKey(_0x4cd507,_0x4d8526[_0xb922('0x1f')],'id');for(var _0x3388d6=0x0,_0x287cd9={},_0x3bbe52={};_0x3388d6<_0x4cd507['length'];_0x3388d6+=0x1){_0x287cd9=_0x4cd507[_0x3388d6];if(_[_0xb922('0x43')](_0x4d8526['dynamics365Accounts'][_0x287cd9['id']])){_0x4d8526[_0xb922('0x1f')][_0x287cd9['id']]=new Dynamics365Account(_0x287cd9);}else{_0x4d8526[_0xb922('0x3f')](_0x4d8526['dynamics365Accounts'][_0x287cd9['id']],_0x287cd9);}}}return _0x4d8526[_0xb922('0x1f')];};};Realtime['prototype']['initFreshsalesAccounts']=function(){var _0x5aa987=this;return function(_0x2c03dd){if(_0x2c03dd){freeIsNotKey(_0x2c03dd,_0x5aa987[_0xb922('0x20')],'id');for(var _0x462837=0x0,_0x3258de={},_0x158ae8={};_0x462837<_0x2c03dd[_0xb922('0x42')];_0x462837+=0x1){_0x3258de=_0x2c03dd[_0x462837];if(_[_0xb922('0x43')](_0x5aa987['freshsalesAccounts'][_0x3258de['id']])){_0x5aa987[_0xb922('0x20')][_0x3258de['id']]=new FreshsalesAccount(_0x3258de);}else{_0x5aa987[_0xb922('0x3f')](_0x5aa987[_0xb922('0x20')][_0x3258de['id']],_0x3258de);}}}return _0x5aa987[_0xb922('0x20')];};};Realtime[_0xb922('0x40')]['initVoiceQueueHopperHistory']=function(){var _0xdc2a49=this;return function(_0x3c2222){for(var _0x295fd2=0x0;_0x295fd2<_0x3c2222['length'];_0x295fd2+=0x1){_[_0xb922('0x4f')](_0xdc2a49[_0xb922('0x11')][_0x3c2222[_0x295fd2]['name']],_0x3c2222[_0x295fd2]);}return _0xdc2a49[_0xb922('0x11')];};};Realtime[_0xb922('0x40')][_0xb922('0x50')]=function(){var _0x2ba20b=this;return function(_0x3646e7){clearVoiceQueues(_0x2ba20b[_0xb922('0x11')]);if(_0x3646e7){_0x3646e7=_[_0xb922('0x51')](_0x3646e7,'uniqueid');for(var _0x452280 in _0x3646e7){if(_0x3646e7['hasOwnProperty'](_0x452280)){var _0x2a8f11={};for(var _0x318660=0x0;_0x318660<_0x3646e7[_0x452280][_0xb922('0x42')];_0x318660+=0x1){var _0x251352=_0x3646e7[_0x452280][_0x318660][_0xb922('0x52')];if(_0x2ba20b[_0xb922('0x11')][_0x251352]){if(_0x3646e7[_0x452280][_0x318660]['queuecallerexit']){_0x2ba20b[_0xb922('0x11')][_0x251352]['unmanaged']+=0x1;}if(_0x3646e7[_0x452280][_0x318660][_0xb922('0x53')]){_0x2ba20b[_0xb922('0x11')][_0x251352][_0xb922('0x31')]+=0x1;}_0x2ba20b['voiceQueues'][_0x251352][_0xb922('0x29')]+=moment(_0x3646e7[_0x452280][_0x318660][_0xb922('0x54')])['diff'](moment(_0x3646e7[_0x452280][_0x318660]['queuecallerjoinAt']),_0xb922('0x55'))||0x0;if(_0x318660===_0x3646e7[_0x452280][_0xb922('0x42')]-0x1){_0x2ba20b[_0xb922('0x11')][_0x251352][_0xb922('0x2a')]+=moment(_0x3646e7[_0x452280][_0x318660][_0xb922('0x56')]||_0x3646e7[_0x452280][_0x318660][_0xb922('0x57')]||_0x3646e7[_0x452280][_0x318660][_0xb922('0x58')])[_0xb922('0x59')](moment(_0x3646e7[_0x452280][_0x318660][_0xb922('0x5a')]),_0xb922('0x55'))||0x0;_0x2ba20b[_0xb922('0x11')][_0x251352][_0xb922('0x28')]+=0x1;if(_0x3646e7[_0x452280][_0x318660][_0xb922('0x5b')]){_0x2ba20b[_0xb922('0x11')][_0x251352][_0xb922('0x2f')]+=0x1;_0x2ba20b['voiceQueues'][_0x251352][_0xb922('0x2b')]+=moment(_0x3646e7[_0x452280][_0x318660]['queuecallercompleteAt'])['diff'](moment(_0x3646e7[_0x452280][_0x318660]['queuecallerleaveAt']),_0xb922('0x55'))||0x0;}}else{_0x2ba20b['voiceQueues'][_0x251352][_0xb922('0x2a')]+=_0x2ba20b[_0xb922('0x11')][_0x251352][_0xb922('0x29')]||0x0;}}}}}}return _0x2ba20b[_0xb922('0x11')];};};Realtime['prototype']['initVoiceCallReports']=function(){var _0x31a827=this;return function(_0x2a22b0){clearVoiceCallReports(_0x31a827['outbound']);if(_0x2a22b0){for(var _0x404d44=0x0;_0x404d44<_0x2a22b0[_0xb922('0x42')];_0x404d44+=0x1){_0x31a827[_0xb922('0x14')][_0xb922('0x28')]+=0x1;_0x31a827[_0xb922('0x14')]['sumDuration']+=_0x2a22b0[_0x404d44]['duration'];if(_0x2a22b0[_0x404d44][_0xb922('0x5c')]===_0xb922('0x5d')){_0x31a827[_0xb922('0x14')][_0xb922('0x2f')]+=0x1;_0x31a827[_0xb922('0x14')][_0xb922('0x29')]+=_0x2a22b0[_0x404d44][_0xb922('0x5e')]-_0x2a22b0[_0x404d44][_0xb922('0x5f')]||0x0;_0x31a827[_0xb922('0x14')]['sumBillable']+=_0x2a22b0[_0x404d44]['billableseconds'];}}}return _0x31a827[_0xb922('0x14')];};};Realtime[_0xb922('0x40')][_0xb922('0x60')]=function(){var _0x37f062=this;return function(_0x515ff3){if(_0x515ff3){freeIsNotKey(_0x515ff3,_0x37f062['campaigns'],_0xb922('0x25'));for(var _0x293bba=0x0,_0x414027={};_0x293bba<_0x515ff3[_0xb922('0x42')];_0x293bba+=0x1){_0x414027=_0x515ff3[_0x293bba];if(_['isUndefined'](_0x37f062['campaigns'][_0x414027['name']])){_0x37f062[_0xb922('0x12')][_0x414027[_0xb922('0x25')]]=new Campaign(_0x414027);}else{_0x37f062[_0xb922('0x3f')](_0x37f062['campaigns'][_0x414027['name']],_0x414027);_0x37f062[_0xb922('0x12')][_0x414027['name']][_0xb922('0x61')]=_0x414027['SquareProject']?_0x414027[_0xb922('0x62')]['name']:undefined;}}}return _0x37f062[_0xb922('0x12')];};};Realtime[_0xb922('0x40')][_0xb922('0x63')]=function(){var _0x40c89b=this;return function(_0x241573){if(_0x241573){freeIsNotKey(_0x241573,_0x40c89b[_0xb922('0x15')],'id');for(var _0x5899d3=0x0,_0x2ff6fb={};_0x5899d3<_0x241573[_0xb922('0x42')];_0x5899d3+=0x1){_0x2ff6fb=_0x241573[_0x5899d3];if(_[_0xb922('0x43')](_0x40c89b['voiceExtensions'][_0x2ff6fb['id']])){_0x40c89b[_0xb922('0x15')][_0x2ff6fb['id']]=new VoiceExtension(_0x2ff6fb);}else{_0x40c89b[_0xb922('0x3f')](_0x40c89b[_0xb922('0x15')][_0x2ff6fb['id']],_0x2ff6fb);}}}return _0x40c89b['voiceExtensions'];};};Realtime[_0xb922('0x40')][_0xb922('0x64')]=function(){var _0xcc2aad=this;return function(_0xe121f){clearCampaigns(_0xcc2aad['campaigns']);for(var _0x19bbd8=0x0;_0x19bbd8<_0xe121f[_0xb922('0x42')];_0x19bbd8+=0x1){_['merge'](_0xcc2aad[_0xb922('0x12')][_0xe121f[_0x19bbd8][_0xb922('0x25')]],_0xe121f[_0x19bbd8]);}return _0xcc2aad['campaigns'];};};Realtime[_0xb922('0x40')][_0xb922('0x65')]=function(){var _0x2c22eb=this;return function(_0x3ba93c){if(_0x3ba93c){freeIsNotKey(_0x3ba93c,_0x2c22eb[_0xb922('0x66')],'id');for(var _0x48e942=0x0,_0x19e087={},_0x584c90={};_0x48e942<_0x3ba93c[_0xb922('0x42')];_0x48e942+=0x1){_0x19e087=_0x3ba93c[_0x48e942];if(_[_0xb922('0x43')](_0x2c22eb[_0xb922('0x66')][_0x19e087['id']])){_0x2c22eb['faxAccounts'][_0x19e087['id']]=new FaxAccount(_0x19e087);}else{_0x2c22eb[_0xb922('0x3f')](_0x2c22eb['faxAccounts'][_0x19e087['id']],_0x19e087);}}}return _0x2c22eb['faxAccounts'];};};module[_0xb922('0x67')]=Realtime; \ No newline at end of file +var _0x3300=['interface','total','answered','sumHoldTime','sumDuration','sumBillable','ivrTotalCallsDays','ivrAnswerCallsDay','isEmpty','unmanaged','abandoned','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundAnswerCallsDay','mergeFromDatabase','prototype','initAgents','agents','length','isUndefined','SIP/%s','telephones','voiceQueues','initTriggers','triggers','initTemplates','initZendeskAccounts','initFreshdeskAccounts','zohoAccounts','initDeskAccounts','initVtigerAccounts','initDynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','merge','queue','queuecallerexit','queuecallerabandon','diff','queuecallerjoinAt','queuecallercompleteAt','queuecallerexitAt','seconds','disposition','ANSWERED','duration','billableseconds','initCampaigns','SquareProject','initVoiceExtensions','initCampaignHopperHistory','exports','bluebird','util','moment','../model/agent','../model/trunk','../model/trigger','../model/template','../model/campaign','../model/salesforceAccount','../model/freshdeskAccount','../model/zohoAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/faxAccount','trunks','campaigns','templates','outbound','voiceExtensions','queueChannels','outboundChannels','settings','zendeskAccounts','salesforceAccounts','sugarcrmAccounts','freshdeskAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','hasOwnProperty','mapKeys','format','name','isNil'];(function(_0x2156bb,_0x2f6592){var _0xd10389=function(_0x269dcc){while(--_0x269dcc){_0x2156bb['push'](_0x2156bb['shift']());}};_0xd10389(++_0x2f6592);}(_0x3300,0x9c));var _0x0330=function(_0x2e092e,_0x1bbef3){_0x2e092e=_0x2e092e-0x0;var _0x4d4f52=_0x3300[_0x2e092e];return _0x4d4f52;};'use strict';var BPromise=require(_0x0330('0x0'));var util=require(_0x0330('0x1'));var _=require('lodash');var moment=require(_0x0330('0x2'));var Agent=require(_0x0330('0x3'));var Telephone=require('../model/telephone');var Trunk=require(_0x0330('0x4'));var VoiceQueue=require('../model/voiceQueue');var Trigger=require(_0x0330('0x5'));var Template=require(_0x0330('0x6'));var Campaign=require(_0x0330('0x7'));var VoiceExtension=require('../model/voiceExtension');var ZendeskAccount=require('../model/zendeskAccount');var SalesforceAccount=require(_0x0330('0x8'));var FreshdeskAccount=require(_0x0330('0x9'));var SugarcrmAccount=require('../model/sugarcrmAccount');var ZohoAccount=require(_0x0330('0xa'));var DeskAccount=require('../model/deskAccount');var VtigerAccount=require(_0x0330('0xb'));var ServicenowAccount=require(_0x0330('0xc'));var Dynamics365Account=require(_0x0330('0xd'));var FreshsalesAccount=require('../model/freshsalesAccount');var FaxAccount=require(_0x0330('0xe'));var Realtime=function(){this['agents']={};this['telephones']={};this[_0x0330('0xf')]={};this['voiceQueues']={};this['triggers']={};this[_0x0330('0x10')]={};this[_0x0330('0x11')]={};this[_0x0330('0x12')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0x0330('0x13')]={};this['channels']={};this[_0x0330('0x14')]={};this[_0x0330('0x15')]={};this['timers']={};this[_0x0330('0x16')]={};this[_0x0330('0x17')]={};this[_0x0330('0x18')]={};this[_0x0330('0x19')]={};this[_0x0330('0x1a')]={};this['zohoAccounts']={};this[_0x0330('0x1b')]={};this[_0x0330('0x1c')]={};this[_0x0330('0x1d')]={};this[_0x0330('0x1e')]={};this[_0x0330('0x1f')]={};this[_0x0330('0x20')]={};};function freeIsNotKey(_0x4391fd,_0x3f2fe6,_0x560659){var _0x21c3b8=_['mapKeys'](_0x4391fd,function(_0x901b0b,_0xf709f5){return _0x901b0b[_0x560659];});for(var _0x5ed839 in _0x3f2fe6){if(_0x3f2fe6[_0x0330('0x21')](_0x5ed839)){if(!_0x21c3b8[_0x5ed839]){delete _0x3f2fe6[_0x5ed839];}}}}function freeIsNotKeySip(_0x9213c2,_0xdf750d){var _0x37d477=_[_0x0330('0x22')](_0x9213c2,function(_0x4ae0b2,_0xc10048){return util[_0x0330('0x23')]('SIP/%s',_0x4ae0b2[_0x0330('0x24')]);});for(var _0x5c3a6f in _0xdf750d){if(_0xdf750d[_0x0330('0x21')](_0x5c3a6f)){if(!_0x37d477[_0x5c3a6f]){delete _0xdf750d[_0x5c3a6f];}}}}function freeIsNotKeyAgent(_0xe350c8,_0x400e40){var _0x1adb59=_[_0x0330('0x22')](_0xe350c8,function(_0x3e6213,_0x3da432){var _0x4edad8=_[_0x0330('0x25')](_0x3e6213[_0x0330('0x26')])?util[_0x0330('0x23')]('SIP/%s',_0x3e6213['name']):_0x3e6213['interface'];return _0x4edad8;});for(var _0x2ad246 in _0x400e40){if(_0x400e40[_0x0330('0x21')](_0x2ad246)){if(!_0x1adb59[_0x2ad246]){delete _0x400e40[_0x2ad246];}}}}function clearVoiceCallReports(_0x74060b){_0x74060b[_0x0330('0x27')]=0x0;_0x74060b[_0x0330('0x28')]=0x0;_0x74060b[_0x0330('0x29')]=0x0;_0x74060b[_0x0330('0x2a')]=0x0;_0x74060b[_0x0330('0x2b')]=0x0;}function clearCampaigns(_0x9253e2){if(!_['isEmpty'](_0x9253e2)){for(var _0xad90f6 in _0x9253e2){if(_0x9253e2[_0x0330('0x21')](_0xad90f6)){_0x9253e2[_0xad90f6][_0x0330('0x2c')]=0x0;_0x9253e2[_0xad90f6][_0x0330('0x2d')]=0x0;}}}}function clearVoiceQueues(_0x3eb077){if(!_[_0x0330('0x2e')](_0x3eb077)){for(var _0x4936e5 in _0x3eb077){if(_0x3eb077[_0x0330('0x21')](_0x4936e5)){_0x3eb077[_0x4936e5][_0x0330('0x27')]=0x0;_0x3eb077[_0x4936e5]['answered']=0x0;_0x3eb077[_0x4936e5][_0x0330('0x2f')]=0x0;_0x3eb077[_0x4936e5][_0x0330('0x30')]=0x0;_0x3eb077[_0x4936e5]['sumHoldTime']=0x0;_0x3eb077[_0x4936e5][_0x0330('0x2a')]=0x0;_0x3eb077[_0x4936e5][_0x0330('0x2b')]=0x0;_0x3eb077[_0x4936e5][_0x0330('0x31')]=0x0;_0x3eb077[_0x4936e5][_0x0330('0x32')]=0x0;_0x3eb077[_0x4936e5][_0x0330('0x33')]=0x0;_0x3eb077[_0x4936e5][_0x0330('0x34')]=0x0;_0x3eb077[_0x4936e5][_0x0330('0x35')]=0x0;_0x3eb077[_0x4936e5][_0x0330('0x36')]=0x0;_0x3eb077[_0x4936e5][_0x0330('0x37')]=0x0;_0x3eb077[_0x4936e5]['outboundDropCallsDayCallersExit']=0x0;_0x3eb077[_0x4936e5]['outboundBlacklistCallsDay']=0x0;_0x3eb077[_0x4936e5][_0x0330('0x38')]=0x0;_0x3eb077[_0x4936e5]['outboundRejectCallsDay']=0x0;_0x3eb077[_0x4936e5][_0x0330('0x39')]=0x0;_0x3eb077[_0x4936e5][_0x0330('0x31')]=0x0;_0x3eb077[_0x4936e5][_0x0330('0x3a')]=0x0;_0x3eb077[_0x4936e5]['queueStatusComplete']=!![];}}}}Realtime['prototype'][_0x0330('0x3b')]=function(_0x43fc67,_0x3a2d97){for(var _0x1b03a1 in _0x3a2d97){if(_0x43fc67[_0x0330('0x21')](_0x1b03a1)){_0x43fc67[_0x1b03a1]=_0x3a2d97[_0x1b03a1];}}};Realtime[_0x0330('0x3c')][_0x0330('0x3d')]=function(){var _0xcae67e=this;return function(_0x13ec62){if(_0x13ec62){freeIsNotKeyAgent(_0x13ec62,_0xcae67e[_0x0330('0x3e')]);for(var _0x5adfbd=0x0,_0x3147c0={},_0x557bc3={};_0x5adfbd<_0x13ec62[_0x0330('0x3f')];_0x5adfbd+=0x1){_0x3147c0=_0x13ec62[_0x5adfbd];var _0x5cc9eb=_['isNil'](_0x3147c0[_0x0330('0x26')])?util[_0x0330('0x23')]('SIP/%s',_0x3147c0[_0x0330('0x24')]):_0x3147c0[_0x0330('0x26')];if(_['isUndefined'](_0xcae67e['agents'][_0x5cc9eb])){_0xcae67e['agents'][_0x5cc9eb]=new Agent(_0x3147c0);}else{_0xcae67e[_0x0330('0x3b')](_0xcae67e[_0x0330('0x3e')][_0x5cc9eb],_0x3147c0);}}}return _0xcae67e[_0x0330('0x3e')];};};Realtime[_0x0330('0x3c')]['initTelephones']=function(){var _0x40ace0=this;return function(_0xd85c85){if(_0xd85c85){freeIsNotKeySip(_0xd85c85,_0x40ace0['telephones']);for(var _0x38564c=0x0,_0x5b6e87={},_0x1b27b6={};_0x38564c<_0xd85c85[_0x0330('0x3f')];_0x38564c+=0x1){_0x5b6e87=_0xd85c85[_0x38564c];if(_[_0x0330('0x40')](_0x40ace0['telephones'][util[_0x0330('0x23')](_0x0330('0x41'),_0x5b6e87[_0x0330('0x24')])])){_0x40ace0[_0x0330('0x42')][util[_0x0330('0x23')](_0x0330('0x41'),_0x5b6e87[_0x0330('0x24')])]=new Telephone(_0x5b6e87);}else{_0x40ace0['mergeFromDatabase'](_0x40ace0[_0x0330('0x42')][util[_0x0330('0x23')]('SIP/%s',_0x5b6e87['name'])],_0x5b6e87);}}}return _0x40ace0['telephones'];};};Realtime[_0x0330('0x3c')]['initTrunks']=function(){var _0x29a8f1=this;return function(_0x2bae13){if(_0x2bae13){freeIsNotKeySip(_0x2bae13,_0x29a8f1[_0x0330('0xf')]);for(var _0x162704=0x0,_0x3405c1={},_0x40f6c4={};_0x162704<_0x2bae13['length'];_0x162704+=0x1){_0x3405c1=_0x2bae13[_0x162704];if(_[_0x0330('0x40')](_0x29a8f1[_0x0330('0xf')][util[_0x0330('0x23')]('SIP/%s',_0x3405c1[_0x0330('0x24')])])){_0x29a8f1[_0x0330('0xf')][util['format'](_0x0330('0x41'),_0x3405c1['name'])]=new Trunk(_0x3405c1);}else{_0x29a8f1['mergeFromDatabase'](_0x29a8f1[_0x0330('0xf')][util['format']('SIP/%s',_0x3405c1[_0x0330('0x24')])],_0x3405c1);}}}return _0x29a8f1['trunks'];};};Realtime[_0x0330('0x3c')]['initVoiceQueues']=function(){var _0xb80c07=this;return function(_0x343aca){if(_0x343aca){freeIsNotKey(_0x343aca,_0xb80c07['voiceQueues'],_0x0330('0x24'));for(var _0x143397=0x0,_0x4afb34={},_0x2e46f6={};_0x143397<_0x343aca[_0x0330('0x3f')];_0x143397+=0x1){_0x4afb34=_0x343aca[_0x143397];if(_[_0x0330('0x40')](_0xb80c07[_0x0330('0x43')][_0x4afb34[_0x0330('0x24')]])){_0xb80c07[_0x0330('0x43')][_0x4afb34['name']]=new VoiceQueue(_0x4afb34);}else{_0xb80c07['mergeFromDatabase'](_0xb80c07[_0x0330('0x43')][_0x4afb34[_0x0330('0x24')]],_0x4afb34);}}}return _0xb80c07[_0x0330('0x43')];};};Realtime['prototype'][_0x0330('0x44')]=function(){var _0x328c7f=this;return function(_0x54212b){if(_0x54212b){freeIsNotKey(_0x54212b,_0x328c7f[_0x0330('0x45')],'id');for(var _0x4a3cba=0x0,_0x3dacf9={},_0x2faaa0={};_0x4a3cba<_0x54212b[_0x0330('0x3f')];_0x4a3cba+=0x1){_0x3dacf9=_0x54212b[_0x4a3cba];if(_[_0x0330('0x40')](_0x328c7f[_0x0330('0x45')][_0x3dacf9['id']])){_0x328c7f['triggers'][_0x3dacf9['id']]=new Trigger(_0x3dacf9);}else{_0x328c7f[_0x0330('0x3b')](_0x328c7f[_0x0330('0x45')][_0x3dacf9['id']],_0x3dacf9);}}}return _0x328c7f[_0x0330('0x45')];};};Realtime[_0x0330('0x3c')][_0x0330('0x46')]=function(){var _0x462bbe=this;return function(_0x5d3cb0){if(_0x5d3cb0){freeIsNotKey(_0x5d3cb0,_0x462bbe['templates'],'id');for(var _0x4dba6f=0x0,_0xdec9a4={},_0x5ddf5d={};_0x4dba6f<_0x5d3cb0[_0x0330('0x3f')];_0x4dba6f+=0x1){_0xdec9a4=_0x5d3cb0[_0x4dba6f];if(_[_0x0330('0x40')](_0x462bbe[_0x0330('0x11')][_0xdec9a4['id']])){_0x462bbe[_0x0330('0x11')][_0xdec9a4['id']]=new Template(_0xdec9a4);}else{_0x462bbe['mergeFromDatabase'](_0x462bbe[_0x0330('0x11')][_0xdec9a4['id']],_0xdec9a4);}}}return _0x462bbe[_0x0330('0x11')];};};Realtime['prototype'][_0x0330('0x47')]=function(){var _0x369dba=this;return function(_0x11c893){if(_0x11c893){freeIsNotKey(_0x11c893,_0x369dba[_0x0330('0x17')],'id');for(var _0x3de7d2=0x0,_0xb038c0={},_0x3a8c68={};_0x3de7d2<_0x11c893[_0x0330('0x3f')];_0x3de7d2+=0x1){_0xb038c0=_0x11c893[_0x3de7d2];if(_[_0x0330('0x40')](_0x369dba[_0x0330('0x17')][_0xb038c0['id']])){_0x369dba['zendeskAccounts'][_0xb038c0['id']]=new ZendeskAccount(_0xb038c0);}else{_0x369dba[_0x0330('0x3b')](_0x369dba[_0x0330('0x17')][_0xb038c0['id']],_0xb038c0);}}}return _0x369dba[_0x0330('0x17')];};};Realtime[_0x0330('0x3c')]['initSalesforceAccounts']=function(){var _0x1a9015=this;return function(_0xde3220){if(_0xde3220){freeIsNotKey(_0xde3220,_0x1a9015[_0x0330('0x18')],'id');for(var _0x3a2bb0=0x0,_0x26e38d={},_0x43c992={};_0x3a2bb0<_0xde3220[_0x0330('0x3f')];_0x3a2bb0+=0x1){_0x26e38d=_0xde3220[_0x3a2bb0];if(_[_0x0330('0x40')](_0x1a9015[_0x0330('0x18')][_0x26e38d['id']])){_0x1a9015['salesforceAccounts'][_0x26e38d['id']]=new SalesforceAccount(_0x26e38d);}else{_0x1a9015[_0x0330('0x3b')](_0x1a9015[_0x0330('0x18')][_0x26e38d['id']],_0x26e38d);}}}return _0x1a9015['salesforceAccounts'];};};Realtime[_0x0330('0x3c')][_0x0330('0x48')]=function(){var _0x49fffb=this;return function(_0xb4866){if(_0xb4866){freeIsNotKey(_0xb4866,_0x49fffb['freshdeskAccounts'],'id');for(var _0x1fcf6e=0x0,_0x140936={},_0x4ac8de={};_0x1fcf6e<_0xb4866[_0x0330('0x3f')];_0x1fcf6e+=0x1){_0x140936=_0xb4866[_0x1fcf6e];if(_[_0x0330('0x40')](_0x49fffb[_0x0330('0x1a')][_0x140936['id']])){_0x49fffb[_0x0330('0x1a')][_0x140936['id']]=new FreshdeskAccount(_0x140936);}else{_0x49fffb[_0x0330('0x3b')](_0x49fffb[_0x0330('0x1a')][_0x140936['id']],_0x140936);}}}return _0x49fffb['freshdeskAccounts'];};};Realtime[_0x0330('0x3c')]['initZohoAccounts']=function(){var _0x2955f6=this;return function(_0x4b4050){if(_0x4b4050){freeIsNotKey(_0x4b4050,_0x2955f6[_0x0330('0x49')],'id');for(var _0x2c5bb9=0x0,_0x4c7c4c={},_0x488ca4={};_0x2c5bb9<_0x4b4050[_0x0330('0x3f')];_0x2c5bb9+=0x1){_0x4c7c4c=_0x4b4050[_0x2c5bb9];if(_[_0x0330('0x40')](_0x2955f6[_0x0330('0x49')][_0x4c7c4c['id']])){_0x2955f6[_0x0330('0x49')][_0x4c7c4c['id']]=new ZohoAccount(_0x4c7c4c);}else{_0x2955f6[_0x0330('0x3b')](_0x2955f6[_0x0330('0x49')][_0x4c7c4c['id']],_0x4c7c4c);}}}return _0x2955f6['zohoAccounts'];};};Realtime[_0x0330('0x3c')][_0x0330('0x4a')]=function(){var _0x454f19=this;return function(_0x1af896){if(_0x1af896){freeIsNotKey(_0x1af896,_0x454f19[_0x0330('0x1b')],'id');for(var _0x2e1ea7=0x0,_0x2d5836={},_0x7226ea={};_0x2e1ea7<_0x1af896[_0x0330('0x3f')];_0x2e1ea7+=0x1){_0x2d5836=_0x1af896[_0x2e1ea7];if(_[_0x0330('0x40')](_0x454f19[_0x0330('0x1b')][_0x2d5836['id']])){_0x454f19[_0x0330('0x1b')][_0x2d5836['id']]=new DeskAccount(_0x2d5836);}else{_0x454f19['mergeFromDatabase'](_0x454f19['deskAccounts'][_0x2d5836['id']],_0x2d5836);}}}return _0x454f19[_0x0330('0x1b')];};};Realtime[_0x0330('0x3c')]['initSugarcrmAccounts']=function(){var _0x33fe60=this;return function(_0x4ece61){if(_0x4ece61){freeIsNotKey(_0x4ece61,_0x33fe60[_0x0330('0x19')],'id');for(var _0x582fd7=0x0,_0x2bb4fb={},_0x103c42={};_0x582fd7<_0x4ece61['length'];_0x582fd7+=0x1){_0x2bb4fb=_0x4ece61[_0x582fd7];if(_['isUndefined'](_0x33fe60[_0x0330('0x19')][_0x2bb4fb['id']])){_0x33fe60[_0x0330('0x19')][_0x2bb4fb['id']]=new SugarcrmAccount(_0x2bb4fb);}else{_0x33fe60[_0x0330('0x3b')](_0x33fe60['sugarcrmAccounts'][_0x2bb4fb['id']],_0x2bb4fb);}}}return _0x33fe60['sugarcrmAccounts'];};};Realtime[_0x0330('0x3c')][_0x0330('0x4b')]=function(){var _0x1418bd=this;return function(_0x1af748){if(_0x1af748){freeIsNotKey(_0x1af748,_0x1418bd[_0x0330('0x1c')],'id');for(var _0x20a437=0x0,_0x44d74e={},_0x50e727={};_0x20a437<_0x1af748[_0x0330('0x3f')];_0x20a437+=0x1){_0x44d74e=_0x1af748[_0x20a437];if(_[_0x0330('0x40')](_0x1418bd[_0x0330('0x1c')][_0x44d74e['id']])){_0x1418bd['vtigerAccounts'][_0x44d74e['id']]=new VtigerAccount(_0x44d74e);}else{_0x1418bd['mergeFromDatabase'](_0x1418bd['vtigerAccounts'][_0x44d74e['id']],_0x44d74e);}}}return _0x1418bd[_0x0330('0x1c')];};};Realtime[_0x0330('0x3c')]['initServicenowAccounts']=function(){var _0x23846d=this;return function(_0x44ba5d){if(_0x44ba5d){freeIsNotKey(_0x44ba5d,_0x23846d[_0x0330('0x1d')],'id');for(var _0x9b75d=0x0,_0x143d31={},_0x3e79f1={};_0x9b75d<_0x44ba5d['length'];_0x9b75d+=0x1){_0x143d31=_0x44ba5d[_0x9b75d];if(_[_0x0330('0x40')](_0x23846d['servicenowAccounts'][_0x143d31['id']])){_0x23846d['servicenowAccounts'][_0x143d31['id']]=new ServicenowAccount(_0x143d31);}else{_0x23846d[_0x0330('0x3b')](_0x23846d[_0x0330('0x1d')][_0x143d31['id']],_0x143d31);}}}return _0x23846d[_0x0330('0x1d')];};};Realtime['prototype'][_0x0330('0x4c')]=function(){var _0x49a9f0=this;return function(_0x210b97){if(_0x210b97){freeIsNotKey(_0x210b97,_0x49a9f0['dynamics365Accounts'],'id');for(var _0x20ed4c=0x0,_0x4e5219={},_0x3a3ccb={};_0x20ed4c<_0x210b97[_0x0330('0x3f')];_0x20ed4c+=0x1){_0x4e5219=_0x210b97[_0x20ed4c];if(_[_0x0330('0x40')](_0x49a9f0[_0x0330('0x1e')][_0x4e5219['id']])){_0x49a9f0[_0x0330('0x1e')][_0x4e5219['id']]=new Dynamics365Account(_0x4e5219);}else{_0x49a9f0['mergeFromDatabase'](_0x49a9f0['dynamics365Accounts'][_0x4e5219['id']],_0x4e5219);}}}return _0x49a9f0[_0x0330('0x1e')];};};Realtime[_0x0330('0x3c')][_0x0330('0x4d')]=function(){var _0x4744e0=this;return function(_0x251ebe){if(_0x251ebe){freeIsNotKey(_0x251ebe,_0x4744e0[_0x0330('0x1f')],'id');for(var _0x3a0960=0x0,_0x148582={},_0x693eb1={};_0x3a0960<_0x251ebe[_0x0330('0x3f')];_0x3a0960+=0x1){_0x148582=_0x251ebe[_0x3a0960];if(_['isUndefined'](_0x4744e0[_0x0330('0x1f')][_0x148582['id']])){_0x4744e0['freshsalesAccounts'][_0x148582['id']]=new FreshsalesAccount(_0x148582);}else{_0x4744e0['mergeFromDatabase'](_0x4744e0[_0x0330('0x1f')][_0x148582['id']],_0x148582);}}}return _0x4744e0[_0x0330('0x1f')];};};Realtime[_0x0330('0x3c')][_0x0330('0x4e')]=function(){var _0x110d1f=this;return function(_0x481f6d){for(var _0x5750fd=0x0;_0x5750fd<_0x481f6d[_0x0330('0x3f')];_0x5750fd+=0x1){_[_0x0330('0x4f')](_0x110d1f[_0x0330('0x43')][_0x481f6d[_0x5750fd][_0x0330('0x24')]],_0x481f6d[_0x5750fd]);}return _0x110d1f[_0x0330('0x43')];};};Realtime[_0x0330('0x3c')]['initVoiceQueueReports']=function(){var _0x5cad04=this;return function(_0x5ba32f){clearVoiceQueues(_0x5cad04[_0x0330('0x43')]);if(_0x5ba32f){_0x5ba32f=_['groupBy'](_0x5ba32f,'uniqueid');for(var _0x298d3d in _0x5ba32f){if(_0x5ba32f[_0x0330('0x21')](_0x298d3d)){var _0x4044a2={};for(var _0x26f918=0x0;_0x26f918<_0x5ba32f[_0x298d3d][_0x0330('0x3f')];_0x26f918+=0x1){var _0x5bae8e=_0x5ba32f[_0x298d3d][_0x26f918][_0x0330('0x50')];if(_0x5cad04[_0x0330('0x43')][_0x5bae8e]){if(_0x5ba32f[_0x298d3d][_0x26f918][_0x0330('0x51')]){_0x5cad04[_0x0330('0x43')][_0x5bae8e][_0x0330('0x2f')]+=0x1;}if(_0x5ba32f[_0x298d3d][_0x26f918][_0x0330('0x52')]){_0x5cad04[_0x0330('0x43')][_0x5bae8e][_0x0330('0x30')]+=0x1;}_0x5cad04['voiceQueues'][_0x5bae8e][_0x0330('0x29')]+=moment(_0x5ba32f[_0x298d3d][_0x26f918]['queuecallerleaveAt'])[_0x0330('0x53')](moment(_0x5ba32f[_0x298d3d][_0x26f918][_0x0330('0x54')]),'seconds')||0x0;if(_0x26f918===_0x5ba32f[_0x298d3d]['length']-0x1){_0x5cad04[_0x0330('0x43')][_0x5bae8e][_0x0330('0x2a')]+=moment(_0x5ba32f[_0x298d3d][_0x26f918][_0x0330('0x55')]||_0x5ba32f[_0x298d3d][_0x26f918]['queuecallerabandonAt']||_0x5ba32f[_0x298d3d][_0x26f918][_0x0330('0x56')])[_0x0330('0x53')](moment(_0x5ba32f[_0x298d3d][_0x26f918][_0x0330('0x54')]),_0x0330('0x57'))||0x0;_0x5cad04[_0x0330('0x43')][_0x5bae8e]['total']+=0x1;if(_0x5ba32f[_0x298d3d][_0x26f918]['queuecallercomplete']){_0x5cad04[_0x0330('0x43')][_0x5bae8e][_0x0330('0x28')]+=0x1;_0x5cad04[_0x0330('0x43')][_0x5bae8e][_0x0330('0x2b')]+=moment(_0x5ba32f[_0x298d3d][_0x26f918][_0x0330('0x55')])['diff'](moment(_0x5ba32f[_0x298d3d][_0x26f918]['queuecallerleaveAt']),_0x0330('0x57'))||0x0;}}else{_0x5cad04[_0x0330('0x43')][_0x5bae8e]['sumDuration']+=_0x5cad04[_0x0330('0x43')][_0x5bae8e][_0x0330('0x29')]||0x0;}}}}}}return _0x5cad04['voiceQueues'];};};Realtime[_0x0330('0x3c')]['initVoiceCallReports']=function(){var _0x486662=this;return function(_0x4ddb86){clearVoiceCallReports(_0x486662[_0x0330('0x12')]);if(_0x4ddb86){for(var _0x2642f5=0x0;_0x2642f5<_0x4ddb86[_0x0330('0x3f')];_0x2642f5+=0x1){_0x486662[_0x0330('0x12')][_0x0330('0x27')]+=0x1;_0x486662[_0x0330('0x12')][_0x0330('0x2a')]+=_0x4ddb86[_0x2642f5]['duration'];if(_0x4ddb86[_0x2642f5][_0x0330('0x58')]===_0x0330('0x59')){_0x486662[_0x0330('0x12')][_0x0330('0x28')]+=0x1;_0x486662['outbound'][_0x0330('0x29')]+=_0x4ddb86[_0x2642f5][_0x0330('0x5a')]-_0x4ddb86[_0x2642f5][_0x0330('0x5b')]||0x0;_0x486662[_0x0330('0x12')][_0x0330('0x2b')]+=_0x4ddb86[_0x2642f5]['billableseconds'];}}}return _0x486662[_0x0330('0x12')];};};Realtime[_0x0330('0x3c')][_0x0330('0x5c')]=function(){var _0xabd8=this;return function(_0x2fd52c){if(_0x2fd52c){freeIsNotKey(_0x2fd52c,_0xabd8[_0x0330('0x10')],_0x0330('0x24'));for(var _0x46113d=0x0,_0x427ac1={};_0x46113d<_0x2fd52c['length'];_0x46113d+=0x1){_0x427ac1=_0x2fd52c[_0x46113d];if(_[_0x0330('0x40')](_0xabd8[_0x0330('0x10')][_0x427ac1[_0x0330('0x24')]])){_0xabd8[_0x0330('0x10')][_0x427ac1[_0x0330('0x24')]]=new Campaign(_0x427ac1);}else{_0xabd8[_0x0330('0x3b')](_0xabd8[_0x0330('0x10')][_0x427ac1[_0x0330('0x24')]],_0x427ac1);_0xabd8[_0x0330('0x10')][_0x427ac1[_0x0330('0x24')]]['dialQueueProject']=_0x427ac1[_0x0330('0x5d')]?_0x427ac1['SquareProject'][_0x0330('0x24')]:undefined;}}}return _0xabd8['campaigns'];};};Realtime['prototype'][_0x0330('0x5e')]=function(){var _0x337472=this;return function(_0x3ba92f){if(_0x3ba92f){freeIsNotKey(_0x3ba92f,_0x337472[_0x0330('0x13')],'id');for(var _0x210c7b=0x0,_0x220843={};_0x210c7b<_0x3ba92f[_0x0330('0x3f')];_0x210c7b+=0x1){_0x220843=_0x3ba92f[_0x210c7b];if(_['isUndefined'](_0x337472['voiceExtensions'][_0x220843['id']])){_0x337472[_0x0330('0x13')][_0x220843['id']]=new VoiceExtension(_0x220843);}else{_0x337472['mergeFromDatabase'](_0x337472[_0x0330('0x13')][_0x220843['id']],_0x220843);}}}return _0x337472['voiceExtensions'];};};Realtime['prototype'][_0x0330('0x5f')]=function(){var _0x31cfea=this;return function(_0x23746d){clearCampaigns(_0x31cfea[_0x0330('0x10')]);for(var _0x3f29df=0x0;_0x3f29df<_0x23746d[_0x0330('0x3f')];_0x3f29df+=0x1){_[_0x0330('0x4f')](_0x31cfea['campaigns'][_0x23746d[_0x3f29df][_0x0330('0x24')]],_0x23746d[_0x3f29df]);}return _0x31cfea[_0x0330('0x10')];};};Realtime['prototype']['initFaxAccounts']=function(){var _0x4fc60c=this;return function(_0x48acc0){if(_0x48acc0){freeIsNotKey(_0x48acc0,_0x4fc60c[_0x0330('0x20')],'id');for(var _0x5d8e30=0x0,_0x1444bb={},_0x2f799a={};_0x5d8e30<_0x48acc0['length'];_0x5d8e30+=0x1){_0x1444bb=_0x48acc0[_0x5d8e30];if(_[_0x0330('0x40')](_0x4fc60c[_0x0330('0x20')][_0x1444bb['id']])){_0x4fc60c['faxAccounts'][_0x1444bb['id']]=new FaxAccount(_0x1444bb);}else{_0x4fc60c['mergeFromDatabase'](_0x4fc60c[_0x0330('0x20')][_0x1444bb['id']],_0x1444bb);}}}return _0x4fc60c[_0x0330('0x20')];};};module[_0x0330('0x60')]=Realtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index 4a87d71..ae2a6c2 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 _0x1797=['lastdata','context','xcally-motion-preview','calleridnum','channel','callerid','calleridpreview','originatecalleridnum','disposition','\x22%s\x22\x20<%s>','calleridname','transfers','linkedid','transfereelinkedid','uniqueid','create','monitor','monitors','filename','createdAt','membername','xcally-motion-dialer','isArray','forEach','startsWith','Local','substring','indexOf','mobile','phone','lastIndexOf','transfererlinkedid','exports','lodash','moment','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceAgentReport','./voiceDialReport','./userReport','realtime','agents','telephones','prototype','sync','xdr','custom:voiceQueueReport','voiceQueueReport','bind','custom:voiceCallReport','voiceCallReport','custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','attendedTransfer','findAgent','accountcode','name','isNil','find','interface','format','SIP/%s','length','connectedlinenum','assigned','queuecallercomplete','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','match','destination','exten','dialer','lastapplication','queue'];(function(_0x4baf36,_0x4e3e17){var _0x5a029f=function(_0x1dfd9e){while(--_0x1dfd9e){_0x4baf36['push'](_0x4baf36['shift']());}};_0x5a029f(++_0x4e3e17);}(_0x1797,0x78));var _0x7179=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0x1797[_0x2763f2];return _0x3ef471;};'use strict';var _=require(_0x7179('0x0'));var moment=require(_0x7179('0x1'));var util=require('util');var config=require('../../../config/environment');var ami=require(_0x7179('0x2'));var RpcVoiceAgentReport=require(_0x7179('0x3'));var RpcVoiceCallReport=require(_0x7179('0x4'));var RpcVoiceDialReport=require(_0x7179('0x5'));var RpcMemberReport=require(_0x7179('0x6'));var RpcVoiceQueueReport=require(_0x7179('0x7'));var RpcVoiceRecording=require(_0x7179('0x8'));var RpcVoiceTransferReport=require(_0x7179('0x9'));var VoiceQueueReport=require(_0x7179('0xa'));var VoiceCallReport=require('./voiceCallReport');var VoiceAgentReport=require(_0x7179('0xb'));var VoiceDialReport=require(_0x7179('0xc'));var UserReport=require(_0x7179('0xd'));function Report(_0x433987){this[_0x7179('0xe')]=_0x433987;this[_0x7179('0xf')]=_0x433987[_0x7179('0xf')];this[_0x7179('0x10')]=_0x433987['telephones'];}Report[_0x7179('0x11')][_0x7179('0x12')]=function(_0x415cb8){var _0x315efd=new VoiceQueueReport(this[_0x7179('0xe')]);var _0x3fdf1a=new VoiceAgentReport(this[_0x7179('0xe')]);var _0x274575=new VoiceDialReport(this['realtime']);var _0x2f7715=new VoiceCallReport(this['realtime']);var _0x1a70b9=new UserReport(this[_0x7179('0xe')]);if(config[_0x7179('0x13')]&&config['xdr']['disabled']){ami['on'](_0x7179('0x14'),this[_0x7179('0x15')][_0x7179('0x16')](this));ami['on'](_0x7179('0x17'),this[_0x7179('0x18')][_0x7179('0x16')](this));ami['on'](_0x7179('0x19'),this[_0x7179('0x1a')][_0x7179('0x16')](this));ami['on'](_0x7179('0x1b'),this[_0x7179('0x1c')][_0x7179('0x16')](this));ami['on'](_0x7179('0x1d'),this[_0x7179('0x1e')][_0x7179('0x16')](this));ami['on'](_0x7179('0x1f'),this[_0x7179('0x20')][_0x7179('0x16')](this));}};Report[_0x7179('0x11')][_0x7179('0x21')]=function(_0x29155a){var _0x3a5e3b;_0x3a5e3b=_['find'](this[_0x7179('0xf')],function(_0x4210d7){return _0x4210d7[_0x7179('0x22')]==_0x29155a||_0x4210d7[_0x7179('0x23')]==_0x29155a;});if(_[_0x7179('0x24')](_0x3a5e3b)){var _0xe05d80=_[_0x7179('0x25')](this['telephones'],function(_0x2f59b4){return _0x2f59b4[_0x7179('0x22')]==_0x29155a||_0x2f59b4['name']==_0x29155a;});if(_0xe05d80){_0x3a5e3b=_[_0x7179('0x25')](this[_0x7179('0xf')],function(_0xd14034){return _0xd14034[_0x7179('0x26')]==util[_0x7179('0x27')](_0x7179('0x28'),_0xe05d80[_0x7179('0x23')]);});}}return _0x3a5e3b;};Report['prototype'][_0x7179('0x15')]=function(_0x1daa1e){for(var _0x26503f=0x0;_0x26503f<_0x1daa1e[_0x7179('0x29')];_0x26503f+=0x1){var _0xe12f79=this[_0x7179('0x21')](_0x1daa1e[_0x26503f][_0x7179('0x2a')]);if(_0xe12f79){_0x1daa1e[_0x26503f]['accountcode']=_0xe12f79[_0x7179('0x22')];_0x1daa1e[_0x26503f][_0x7179('0x2b')]=!![];_0x1daa1e[_0x26503f]['lastAssignedTo']=_0xe12f79[_0x7179('0x23')];_0x1daa1e[_0x26503f][_0x7179('0x26')]=_[_0x7179('0x24')](_0xe12f79[_0x7179('0x26')])?util[_0x7179('0x27')](_0x7179('0x28'),_0xe12f79[_0x7179('0x23')]):_0xe12f79[_0x7179('0x26')];if(_0x1daa1e[_0x26503f][_0x7179('0x2c')]){_0x1daa1e[_0x26503f]['queuecallercompleteAt']=moment()[_0x7179('0x27')](_0x7179('0x2d'));}if(_0x1daa1e[_0x26503f][_0x7179('0x2e')]){_0x1daa1e[_0x26503f][_0x7179('0x2f')]=moment()[_0x7179('0x27')]('YYYY-MM-DD\x20HH:mm:ss');}RpcMemberReport[_0x7179('0x15')](_0x1daa1e[_0x26503f]);}RpcVoiceQueueReport['create'](_0x1daa1e[_0x26503f]);}};function extractCalleridNumber(_0x53b7aa){var _0x5e1da9=_0x53b7aa[_0x7179('0x30')](/<(.*?)>/);return _0x5e1da9?_0x5e1da9[0x1]:_0x53b7aa;}Report[_0x7179('0x11')][_0x7179('0x18')]=function(_0x2625b1){_0x2625b1[_0x7179('0x31')]=_0x2625b1['destination']||_0x2625b1[_0x7179('0x32')];if(_0x2625b1['type']==_0x7179('0x33')){_0x2625b1[_0x7179('0x34')]=_0x7179('0x35');_0x2625b1[_0x7179('0x36')]=_0x2625b1[_0x7179('0x35')];if(_0x2625b1[_0x7179('0x37')]=='from-voip-provider'){_0x2625b1[_0x7179('0x22')]='';_0x2625b1[_0x7179('0x31')]=extractCalleridNumber(_0x2625b1['callerid']);}else if(_0x2625b1[_0x7179('0x37')]=='from-sip'){if(_0x2625b1[_0x7179('0x31')]==_0x7179('0x38')){_0x2625b1['destination']=extractCalleridNumber(_0x2625b1['calleridpreview']);_0x2625b1[_0x7179('0x39')]=_0x2625b1['originatecalleridnum'];_0x2625b1['destinationchannel']=[_0x2625b1[_0x7179('0x3a')],_0x2625b1[_0x7179('0x3a')]=_0x2625b1['destinationchannel']][0x0];_0x2625b1[_0x7179('0x3b')]=_0x2625b1[_0x7179('0x3c')];}else{_0x2625b1['destination']=_0x2625b1[_0x7179('0x39')];_0x2625b1[_0x7179('0x39')]=_0x2625b1[_0x7179('0x3d')];if(_0x2625b1[_0x7179('0x3e')]=='ANSWERED'){_0x2625b1[_0x7179('0x22')]=_0x2625b1[_0x7179('0x2a')];}else{_0x2625b1['accountcode']='';}}}}else{_0x2625b1[_0x7179('0x3b')]=util[_0x7179('0x27')](_0x7179('0x3f'),_0x2625b1[_0x7179('0x40')],_0x2625b1['calleridnum']);}if(RpcVoiceTransferReport[_0x7179('0x41')][_0x2625b1[_0x7179('0x42')]]){var _0x1abcb3=RpcVoiceTransferReport[_0x7179('0x41')][_0x2625b1[_0x7179('0x42')]];_0x1abcb3[_0x7179('0x43')]=_0x2625b1[_0x7179('0x44')];RpcVoiceTransferReport[_0x7179('0x1e')](_0x1abcb3);delete RpcVoiceTransferReport[_0x7179('0x41')][_0x2625b1[_0x7179('0x42')]];}RpcVoiceCallReport[_0x7179('0x45')](_0x2625b1);if(_0x2625b1[_0x7179('0x46')]){for(var _0x44f947=0x0;_0x44f947<_0x2625b1[_0x7179('0x47')][_0x7179('0x29')];_0x44f947+=0x1){_0x2625b1['monitorFilename']=_0x2625b1[_0x7179('0x47')][_0x44f947][_0x7179('0x48')];_0x2625b1[_0x7179('0x49')]=_0x2625b1[_0x7179('0x47')][_0x44f947][_0x7179('0x49')];if(_0x2625b1[_0x7179('0x32')]==_0x7179('0x38')){_0x2625b1[_0x7179('0x39')]=_0x2625b1[_0x7179('0x2a')];_0x2625b1[_0x7179('0x40')]=_0x2625b1['connectedlinename'];_0x2625b1['connectedlinenum']=_0x2625b1[_0x7179('0x22')];_0x2625b1['connectedlinename']=_0x2625b1[_0x7179('0x4a')];_0x2625b1[_0x7179('0x32')]=_0x2625b1[_0x7179('0x3d')];}else if(_0x2625b1[_0x7179('0x32')]==_0x7179('0x4b')){_0x2625b1[_0x7179('0x39')]=_0x2625b1[_0x7179('0x31')];_0x2625b1['exten']=_0x2625b1['originatecalleridnum'];}RpcVoiceRecording['create'](_0x2625b1);}}};Report[_0x7179('0x11')]['voiceAgentReport']=function(_0x8c000d){if(_[_0x7179('0x4c')](_0x8c000d)){_0x8c000d[_0x7179('0x4d')](function(_0x259852){RpcVoiceAgentReport['create'](_0x259852);});}else{RpcVoiceAgentReport['create'](_0x8c000d);}};Report['prototype'][_0x7179('0x1c')]=function(_0x363f72){RpcVoiceDialReport[_0x7179('0x45')](_0x363f72);var _0xee2e5f;var _0x311766;var _0x55f671=_0x363f72['channel'];if(_[_0x7179('0x4e')](_0x55f671,_0x7179('0x4f'))){_0x311766=_0x55f671[_0x7179('0x50')](_0x55f671['indexOf']('/')+0x1,_0x55f671[_0x7179('0x51')]('@'));_0xee2e5f=_[_0x7179('0x25')](this[_0x7179('0xf')],function(_0x2a2efc){return _0x2a2efc[_0x7179('0x52')]==_0x311766||_0x2a2efc[_0x7179('0x53')]==_0x311766||_0x2a2efc[_0x7179('0x22')]==_0x311766;});}else{_0x311766=_0x55f671[_0x7179('0x50')](_0x55f671[_0x7179('0x51')]('/')+0x1,_0x55f671[_0x7179('0x54')]('-'));_0xee2e5f=this['findAgent'](_0x311766);}if(_0xee2e5f){_0x363f72['interface']=_[_0x7179('0x24')](_0xee2e5f[_0x7179('0x26')])?util[_0x7179('0x27')](_0x7179('0x28'),_0xee2e5f[_0x7179('0x23')]):_0xee2e5f[_0x7179('0x26')];_0x363f72[_0x7179('0x4a')]=_0xee2e5f[_0x7179('0x23')];_0x363f72[_0x7179('0x22')]=_0xee2e5f['accountcode'];RpcMemberReport[_0x7179('0x1c')](_0x363f72);}};Report['prototype'][_0x7179('0x1e')]=function(_0x3c6452){RpcVoiceTransferReport[_0x7179('0x41')][_0x3c6452[_0x7179('0x55')]]=_0x3c6452;};Report[_0x7179('0x11')][_0x7179('0x20')]=function(_0x2f2bf9){RpcVoiceTransferReport[_0x7179('0x20')](_0x2f2bf9);};module[_0x7179('0x56')]=Report; \ No newline at end of file +var _0xb80a=['calleridpreview','originatecalleridnum','destinationchannel','channel','calleridnum','disposition','ANSWERED','calleridname','transfers','linkedid','transfereelinkedid','monitor','monitorFilename','monitors','filename','createdAt','connectedlinename','membername','voiceAgentReport','isArray','startsWith','substring','indexOf','mobile','lastIndexOf','attendedTransfer','exports','lodash','moment','util','../../../config/environment','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceAgentReport','./userReport','agents','telephones','sync','realtime','xdr','disabled','custom:voiceQueueReport','voiceQueueReport','bind','voiceCallReport','custom:voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','prototype','findAgent','find','accountcode','name','isNil','interface','SIP/%s','length','connectedlinenum','assigned','format','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexitAt','create','match','destination','exten','type','dialer','lastapplication','queue','lastdata','context','callerid','xcally-motion-preview'];(function(_0x17e771,_0x55fd17){var _0x1f3a6d=function(_0x346ee3){while(--_0x346ee3){_0x17e771['push'](_0x17e771['shift']());}};_0x1f3a6d(++_0x55fd17);}(_0xb80a,0x1c9));var _0xab80=function(_0x48afa5,_0x5b4f4c){_0x48afa5=_0x48afa5-0x0;var _0x1af4a4=_0xb80a[_0x48afa5];return _0x1af4a4;};'use strict';var _=require(_0xab80('0x0'));var moment=require(_0xab80('0x1'));var util=require(_0xab80('0x2'));var config=require(_0xab80('0x3'));var ami=require(_0xab80('0x4'));var RpcVoiceAgentReport=require(_0xab80('0x5'));var RpcVoiceCallReport=require(_0xab80('0x6'));var RpcVoiceDialReport=require(_0xab80('0x7'));var RpcMemberReport=require(_0xab80('0x8'));var RpcVoiceQueueReport=require(_0xab80('0x9'));var RpcVoiceRecording=require(_0xab80('0xa'));var RpcVoiceTransferReport=require(_0xab80('0xb'));var VoiceQueueReport=require(_0xab80('0xc'));var VoiceCallReport=require('./voiceCallReport');var VoiceAgentReport=require(_0xab80('0xd'));var VoiceDialReport=require('./voiceDialReport');var UserReport=require(_0xab80('0xe'));function Report(_0x332678){this['realtime']=_0x332678;this[_0xab80('0xf')]=_0x332678[_0xab80('0xf')];this[_0xab80('0x10')]=_0x332678[_0xab80('0x10')];}Report['prototype'][_0xab80('0x11')]=function(_0x6c1e0c){var _0x2581c0=new VoiceQueueReport(this['realtime']);var _0x4d089a=new VoiceAgentReport(this[_0xab80('0x12')]);var _0x25274e=new VoiceDialReport(this['realtime']);var _0x3c6d2c=new VoiceCallReport(this[_0xab80('0x12')]);var _0x421ff4=new UserReport(this[_0xab80('0x12')]);if(config[_0xab80('0x13')]&&config[_0xab80('0x13')][_0xab80('0x14')]){ami['on'](_0xab80('0x15'),this[_0xab80('0x16')][_0xab80('0x17')](this));ami['on']('custom:voiceCallReport',this[_0xab80('0x18')][_0xab80('0x17')](this));ami['on'](_0xab80('0x19'),this['voiceAgentReport']['bind'](this));ami['on'](_0xab80('0x1a'),this[_0xab80('0x1b')][_0xab80('0x17')](this));ami['on'](_0xab80('0x1c'),this[_0xab80('0x1d')][_0xab80('0x17')](this));ami['on'](_0xab80('0x1e'),this['attendedTransfer'][_0xab80('0x17')](this));}};Report[_0xab80('0x1f')][_0xab80('0x20')]=function(_0x52b028){var _0x422ba3;_0x422ba3=_[_0xab80('0x21')](this[_0xab80('0xf')],function(_0x3e0676){return _0x3e0676[_0xab80('0x22')]==_0x52b028||_0x3e0676[_0xab80('0x23')]==_0x52b028;});if(_[_0xab80('0x24')](_0x422ba3)){var _0x1eca82=_[_0xab80('0x21')](this[_0xab80('0x10')],function(_0x4b5162){return _0x4b5162['accountcode']==_0x52b028||_0x4b5162[_0xab80('0x23')]==_0x52b028;});if(_0x1eca82){_0x422ba3=_[_0xab80('0x21')](this[_0xab80('0xf')],function(_0x40fbdf){return _0x40fbdf[_0xab80('0x25')]==util['format'](_0xab80('0x26'),_0x1eca82[_0xab80('0x23')]);});}}return _0x422ba3;};Report[_0xab80('0x1f')][_0xab80('0x16')]=function(_0x4e4ff6){for(var _0x388fc7=0x0;_0x388fc7<_0x4e4ff6[_0xab80('0x27')];_0x388fc7+=0x1){var _0x3a135d=this[_0xab80('0x20')](_0x4e4ff6[_0x388fc7][_0xab80('0x28')]);if(_0x3a135d){_0x4e4ff6[_0x388fc7][_0xab80('0x22')]=_0x3a135d['accountcode'];_0x4e4ff6[_0x388fc7][_0xab80('0x29')]=!![];_0x4e4ff6[_0x388fc7]['lastAssignedTo']=_0x3a135d[_0xab80('0x23')];_0x4e4ff6[_0x388fc7]['interface']=_[_0xab80('0x24')](_0x3a135d[_0xab80('0x25')])?util[_0xab80('0x2a')](_0xab80('0x26'),_0x3a135d[_0xab80('0x23')]):_0x3a135d[_0xab80('0x25')];if(_0x4e4ff6[_0x388fc7][_0xab80('0x2b')]){_0x4e4ff6[_0x388fc7][_0xab80('0x2c')]=moment()[_0xab80('0x2a')](_0xab80('0x2d'));}if(_0x4e4ff6[_0x388fc7]['queuecallerexit']){_0x4e4ff6[_0x388fc7][_0xab80('0x2e')]=moment()[_0xab80('0x2a')]('YYYY-MM-DD\x20HH:mm:ss');}RpcMemberReport[_0xab80('0x16')](_0x4e4ff6[_0x388fc7]);}RpcVoiceQueueReport[_0xab80('0x2f')](_0x4e4ff6[_0x388fc7]);}};function extractCalleridNumber(_0x19f98f){var _0x3c1e6b=_0x19f98f[_0xab80('0x30')](/<(.*?)>/);return _0x3c1e6b?_0x3c1e6b[0x1]:_0x19f98f;}Report[_0xab80('0x1f')][_0xab80('0x18')]=function(_0x59b505){_0x59b505[_0xab80('0x31')]=_0x59b505[_0xab80('0x31')]||_0x59b505[_0xab80('0x32')];if(_0x59b505[_0xab80('0x33')]==_0xab80('0x34')){_0x59b505[_0xab80('0x35')]=_0xab80('0x36');_0x59b505[_0xab80('0x37')]=_0x59b505[_0xab80('0x36')];if(_0x59b505[_0xab80('0x38')]=='from-voip-provider'){_0x59b505['accountcode']='';_0x59b505[_0xab80('0x31')]=extractCalleridNumber(_0x59b505[_0xab80('0x39')]);}else if(_0x59b505[_0xab80('0x38')]=='from-sip'){if(_0x59b505[_0xab80('0x31')]==_0xab80('0x3a')){_0x59b505[_0xab80('0x31')]=extractCalleridNumber(_0x59b505[_0xab80('0x3b')]);_0x59b505['calleridnum']=_0x59b505[_0xab80('0x3c')];_0x59b505[_0xab80('0x3d')]=[_0x59b505[_0xab80('0x3e')],_0x59b505[_0xab80('0x3e')]=_0x59b505['destinationchannel']][0x0];_0x59b505[_0xab80('0x39')]=_0x59b505['calleridpreview'];}else{_0x59b505[_0xab80('0x31')]=_0x59b505[_0xab80('0x3f')];_0x59b505[_0xab80('0x3f')]=_0x59b505[_0xab80('0x3c')];if(_0x59b505[_0xab80('0x40')]==_0xab80('0x41')){_0x59b505[_0xab80('0x22')]=_0x59b505['connectedlinenum'];}else{_0x59b505['accountcode']='';}}}}else{_0x59b505['callerid']=util[_0xab80('0x2a')]('\x22%s\x22\x20<%s>',_0x59b505[_0xab80('0x42')],_0x59b505[_0xab80('0x3f')]);}if(RpcVoiceTransferReport[_0xab80('0x43')][_0x59b505[_0xab80('0x44')]]){var _0x35c411=RpcVoiceTransferReport[_0xab80('0x43')][_0x59b505[_0xab80('0x44')]];_0x35c411[_0xab80('0x45')]=_0x59b505['uniqueid'];RpcVoiceTransferReport[_0xab80('0x1d')](_0x35c411);delete RpcVoiceTransferReport[_0xab80('0x43')][_0x59b505[_0xab80('0x44')]];}RpcVoiceCallReport[_0xab80('0x2f')](_0x59b505);if(_0x59b505[_0xab80('0x46')]){for(var _0x54749e=0x0;_0x54749e<_0x59b505['monitors'][_0xab80('0x27')];_0x54749e+=0x1){_0x59b505[_0xab80('0x47')]=_0x59b505[_0xab80('0x48')][_0x54749e][_0xab80('0x49')];_0x59b505[_0xab80('0x4a')]=_0x59b505[_0xab80('0x48')][_0x54749e][_0xab80('0x4a')];if(_0x59b505[_0xab80('0x32')]==_0xab80('0x3a')){_0x59b505[_0xab80('0x3f')]=_0x59b505['connectedlinenum'];_0x59b505['calleridname']=_0x59b505[_0xab80('0x4b')];_0x59b505['connectedlinenum']=_0x59b505[_0xab80('0x22')];_0x59b505['connectedlinename']=_0x59b505[_0xab80('0x4c')];_0x59b505['exten']=_0x59b505[_0xab80('0x3c')];}else if(_0x59b505['exten']=='xcally-motion-dialer'){_0x59b505[_0xab80('0x3f')]=_0x59b505[_0xab80('0x31')];_0x59b505[_0xab80('0x32')]=_0x59b505[_0xab80('0x3c')];}RpcVoiceRecording['create'](_0x59b505);}}};Report['prototype'][_0xab80('0x4d')]=function(_0x268e8f){if(_[_0xab80('0x4e')](_0x268e8f)){_0x268e8f['forEach'](function(_0x2beeb8){RpcVoiceAgentReport[_0xab80('0x2f')](_0x2beeb8);});}else{RpcVoiceAgentReport[_0xab80('0x2f')](_0x268e8f);}};Report[_0xab80('0x1f')][_0xab80('0x1b')]=function(_0x455262){RpcVoiceDialReport['create'](_0x455262);var _0x84d979;var _0xb6cccb;var _0x4b5cdc=_0x455262[_0xab80('0x3e')];if(_[_0xab80('0x4f')](_0x4b5cdc,'Local')){_0xb6cccb=_0x4b5cdc[_0xab80('0x50')](_0x4b5cdc[_0xab80('0x51')]('/')+0x1,_0x4b5cdc[_0xab80('0x51')]('@'));_0x84d979=_[_0xab80('0x21')](this[_0xab80('0xf')],function(_0x29037e){return _0x29037e[_0xab80('0x52')]==_0xb6cccb||_0x29037e['phone']==_0xb6cccb||_0x29037e[_0xab80('0x22')]==_0xb6cccb;});}else{_0xb6cccb=_0x4b5cdc[_0xab80('0x50')](_0x4b5cdc[_0xab80('0x51')]('/')+0x1,_0x4b5cdc[_0xab80('0x53')]('-'));_0x84d979=this[_0xab80('0x20')](_0xb6cccb);}if(_0x84d979){_0x455262[_0xab80('0x25')]=_[_0xab80('0x24')](_0x84d979[_0xab80('0x25')])?util['format'](_0xab80('0x26'),_0x84d979[_0xab80('0x23')]):_0x84d979[_0xab80('0x25')];_0x455262[_0xab80('0x4c')]=_0x84d979[_0xab80('0x23')];_0x455262[_0xab80('0x22')]=_0x84d979[_0xab80('0x22')];RpcMemberReport[_0xab80('0x1b')](_0x455262);}};Report[_0xab80('0x1f')][_0xab80('0x1d')]=function(_0x1d52b4){RpcVoiceTransferReport[_0xab80('0x43')][_0x1d52b4['transfererlinkedid']]=_0x1d52b4;};Report[_0xab80('0x1f')][_0xab80('0x54')]=function(_0x445fb1){RpcVoiceTransferReport[_0xab80('0x54')](_0x445fb1);};module[_0xab80('0x55')]=Report; \ No newline at end of file diff --git a/server/services/ami/report/userReport.js b/server/services/ami/report/userReport.js index 2655fea..77343e8 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 _0x5f2c=['status','[userReport][peerstatus]\x20sending\x20telephone:save\x20event:','telephone:save','[userReport][peerstatus]\x20sending\x20trunk:save\x20event:','exports','lodash','util','ioredis','bluebird','../../../config/environment','../../../config/logger','ami','../ami','redis','socket.io-emitter','trunks','agents','telephones','registryentry','syncRegistry','bind','syncDeviceState','peerstatus','syncPeerStatus','syncRealtimeShow','resolve','then','actionSipShowRegistry','catch','[userReport][sipshowregistry]','actionDeviceStateList','error','[userReport][devicestatelist]','inspect','actionSipPeerStatus','[userReport][sippeerstatus]','prototype','isNotNull','isUndefined','emit','info','[userReport][registry]\x20registry:%s\x20state:%s','username','state','debug','[userReport][registry]','merge','omit','event','actionid','trunk:%s','name','trunk:save','[userReport][devicestatechange]\x20device:%s\x20state:%s','device','local','inuse','stateTime','toNumber','format','toLowerCase','updateStatusRealtime','telephone:%s','[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:','startsWith','Local','substring','indexOf','find','mobile','phone','accountcode','[userReport][devicestatechange]','[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s','peer','address','registered'];(function(_0x5c18c4,_0x5b21c1){var _0x3c7644=function(_0x14f7a6){while(--_0x14f7a6){_0x5c18c4['push'](_0x5c18c4['shift']());}};_0x3c7644(++_0x5b21c1);}(_0x5f2c,0xec));var _0xc5f2=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x5f2c[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0xc5f2('0x0'));var moment=require('moment');var util=require(_0xc5f2('0x1'));var Redis=require(_0xc5f2('0x2'));var BPromise=require(_0xc5f2('0x3'));var config=require(_0xc5f2('0x4'));var logger=require(_0xc5f2('0x5'))(_0xc5f2('0x6'));var ami=require(_0xc5f2('0x7'));config['redis']=_['defaults'](config[_0xc5f2('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0xc5f2('0x9'))(new Redis(config['redis']));function UserReport(_0xb610f7){this[_0xc5f2('0xa')]=_0xb610f7[_0xc5f2('0xa')];this[_0xc5f2('0xb')]=_0xb610f7[_0xc5f2('0xb')];this[_0xc5f2('0xc')]=_0xb610f7[_0xc5f2('0xc')];ami['on'](_0xc5f2('0xd'),this[_0xc5f2('0xe')]['bind'](this));ami['on']('registry',this[_0xc5f2('0xe')][_0xc5f2('0xf')](this));ami['on']('devicestatechange',this[_0xc5f2('0x10')][_0xc5f2('0xf')](this));ami['on'](_0xc5f2('0x11'),this[_0xc5f2('0x12')]['bind'](this));return this[_0xc5f2('0x13')]();}function showSipRegistrations(){Promise[_0xc5f2('0x14')]()[_0xc5f2('0x15')](ami[_0xc5f2('0x16')]())[_0xc5f2('0x17')](function(_0x1de794){logger['error'](_0xc5f2('0x18'),util['inspect'](_0x1de794,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise[_0xc5f2('0x14')]()[_0xc5f2('0x15')](ami[_0xc5f2('0x19')]())[_0xc5f2('0x17')](function(_0x5522a1){logger[_0xc5f2('0x1a')](_0xc5f2('0x1b'),util[_0xc5f2('0x1c')](_0x5522a1,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise[_0xc5f2('0x14')]()[_0xc5f2('0x15')](ami[_0xc5f2('0x1d')]())[_0xc5f2('0x17')](function(_0x353811){logger[_0xc5f2('0x1a')](_0xc5f2('0x1e'),util[_0xc5f2('0x1c')](_0x353811,{'showHidden':![],'depth':null}));});}UserReport[_0xc5f2('0x1f')]['syncRealtimeShow']=function(){setInterval(function(){BPromise[_0xc5f2('0x14')]()[_0xc5f2('0x15')](showSipRegistrations())[_0xc5f2('0x15')](listDeviceStates())[_0xc5f2('0x15')](showPeersStatus());},0x32c8);};UserReport[_0xc5f2('0x1f')][_0xc5f2('0x20')]=function(_0x44d952){return _0x44d952!==null&&!_[_0xc5f2('0x21')](_0x44d952);};UserReport['prototype'][_0xc5f2('0x22')]=function(_0x269217,_0x418466,_0x142a9b){io['to'](_0x269217)[_0xc5f2('0x22')](_0x418466,_0x142a9b);};UserReport['prototype'][_0xc5f2('0xe')]=function(_0x304801){try{if(this[_0xc5f2('0x20')](_0x304801)){logger[_0xc5f2('0x23')](_0xc5f2('0x24'),_0x304801[_0xc5f2('0x25')],_0x304801[_0xc5f2('0x26')]);logger[_0xc5f2('0x27')](_0xc5f2('0x28'),util[_0xc5f2('0x1c')](_0x304801,{'showHidden':![],'depth':null}));var _0x4b8078=_['find'](this[_0xc5f2('0xa')],{'defaultuser':_0x304801[_0xc5f2('0x25')]});if(_0x4b8078){_0x304801['stateRegistry']=_0x304801['state'];_[_0xc5f2('0x29')](_0x4b8078,_[_0xc5f2('0x2a')](_0x304801,[_0xc5f2('0x2b'),_0xc5f2('0x2c'),_0xc5f2('0x25'),_0xc5f2('0x26')]));logger[_0xc5f2('0x27')]('[userReport][registry]\x20sending\x20trunk:save\x20event:',util[_0xc5f2('0x1c')](_0x4b8078,{'showHidden':![],'depth':null}));this[_0xc5f2('0x22')](util['format'](_0xc5f2('0x2d'),_0x4b8078[_0xc5f2('0x2e')]),_0xc5f2('0x2f'),_0x4b8078);}}}catch(_0x10c937){logger[_0xc5f2('0x1a')](_0xc5f2('0x28'),util[_0xc5f2('0x1c')](_0x10c937,{'showHidden':![],'depth':null}));}};UserReport[_0xc5f2('0x1f')][_0xc5f2('0x10')]=function(_0x57e918){try{if(this[_0xc5f2('0x20')](_0x57e918)){logger[_0xc5f2('0x23')](_0xc5f2('0x30'),_0x57e918[_0xc5f2('0x31')],_0x57e918[_0xc5f2('0x26')]);logger['debug']('[userReport][devicestatechange]',util['inspect'](_0x57e918,{'showHidden':![],'depth':null}));if(this[_0xc5f2('0xb')][_0x57e918[_0xc5f2('0x31')]]){if(!this[_0xc5f2('0xb')][_0x57e918['device']][_0xc5f2('0x32')]||_0x57e918[_0xc5f2('0x26')]['toLowerCase']()==_0xc5f2('0x33')){this['agents'][_0x57e918[_0xc5f2('0x31')]]['local']=![];if(this[_0xc5f2('0xb')][_0x57e918['device']][_0xc5f2('0x26')]!==_0x57e918[_0xc5f2('0x26')]['toLowerCase']()){this[_0xc5f2('0xb')][_0x57e918[_0xc5f2('0x31')]][_0xc5f2('0x34')]=_[_0xc5f2('0x35')](moment()[_0xc5f2('0x36')]('x'));}this[_0xc5f2('0xb')][_0x57e918[_0xc5f2('0x31')]]['state']=_0x57e918[_0xc5f2('0x26')][_0xc5f2('0x37')]();this['agents'][_0x57e918[_0xc5f2('0x31')]][_0xc5f2('0x38')](_0x57e918);}}else if(this[_0xc5f2('0xc')][_0x57e918[_0xc5f2('0x31')]]){if(this[_0xc5f2('0xc')][_0x57e918[_0xc5f2('0x31')]][_0xc5f2('0x26')]!==_0x57e918[_0xc5f2('0x26')][_0xc5f2('0x37')]()){this[_0xc5f2('0xc')][_0x57e918['device']][_0xc5f2('0x34')]=_[_0xc5f2('0x35')](moment()[_0xc5f2('0x36')]('x'));}this['telephones'][_0x57e918[_0xc5f2('0x31')]][_0xc5f2('0x26')]=_0x57e918[_0xc5f2('0x26')][_0xc5f2('0x37')]();logger['debug']('[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:',util[_0xc5f2('0x1c')](this[_0xc5f2('0xc')][_0x57e918[_0xc5f2('0x31')]],{'showHidden':![],'depth':null}));this[_0xc5f2('0x22')](util[_0xc5f2('0x36')](_0xc5f2('0x39'),this['telephones'][_0x57e918['device']][_0xc5f2('0x2e')]),'telephone:save',this['telephones'][_0x57e918[_0xc5f2('0x31')]]);}else if(this[_0xc5f2('0xa')][_0x57e918['device']]){if(this[_0xc5f2('0xa')][_0x57e918['device']][_0xc5f2('0x26')]!==_0x57e918[_0xc5f2('0x26')]['toLowerCase']()){this[_0xc5f2('0xa')][_0x57e918[_0xc5f2('0x31')]][_0xc5f2('0x34')]=_[_0xc5f2('0x35')](moment()[_0xc5f2('0x36')]('x'));}this['trunks'][_0x57e918[_0xc5f2('0x31')]]['state']=_0x57e918['state']['toLowerCase']();logger['debug'](_0xc5f2('0x3a'),util['inspect'](this[_0xc5f2('0xa')][_0x57e918[_0xc5f2('0x31')]],{'showHidden':![],'depth':null}));this[_0xc5f2('0x22')](util[_0xc5f2('0x36')](_0xc5f2('0x2d'),this[_0xc5f2('0xa')][_0x57e918[_0xc5f2('0x31')]][_0xc5f2('0x2e')]),_0xc5f2('0x2f'),this[_0xc5f2('0xa')][_0x57e918[_0xc5f2('0x31')]]);}else if(_[_0xc5f2('0x3b')](_0x57e918[_0xc5f2('0x31')],_0xc5f2('0x3c'))){var _0x8dc7a4=_0x57e918[_0xc5f2('0x31')];var _0x3b3a17=_0x8dc7a4[_0xc5f2('0x3d')](_0x8dc7a4[_0xc5f2('0x3e')]('/')+0x1,_0x8dc7a4['indexOf']('@'));var _0x1dd1b7=_[_0xc5f2('0x3f')](this[_0xc5f2('0xb')],function(_0x368b36){return _0x368b36[_0xc5f2('0x40')]==_0x3b3a17||_0x368b36[_0xc5f2('0x41')]==_0x3b3a17||_0x368b36[_0xc5f2('0x42')]==_0x3b3a17;});if(_0x1dd1b7){if(_0x1dd1b7[_0xc5f2('0x26')]!==_0x57e918[_0xc5f2('0x26')][_0xc5f2('0x37')]()){_0x1dd1b7[_0xc5f2('0x34')]=_[_0xc5f2('0x35')](moment()[_0xc5f2('0x36')]('x'));}_0x1dd1b7[_0xc5f2('0x26')]=_0x57e918[_0xc5f2('0x26')][_0xc5f2('0x37')]();_0x1dd1b7[_0xc5f2('0x32')]=!![];_0x1dd1b7[_0xc5f2('0x38')](_0x57e918);}}}}catch(_0x123d65){logger['error'](_0xc5f2('0x43'),util[_0xc5f2('0x1c')](_0x123d65,{'showHidden':![],'depth':null}));}};UserReport['prototype'][_0xc5f2('0x12')]=function(_0x2196c7){try{if(this['isNotNull'](_0x2196c7)&&this['isNotNull'](_0x2196c7[_0xc5f2('0x11')])){logger['info'](_0xc5f2('0x44'),_0x2196c7[_0xc5f2('0x45')],_0x2196c7[_0xc5f2('0x46')],_0x2196c7['peerstatus']);logger[_0xc5f2('0x27')]('[userReport][peerstatus]',util[_0xc5f2('0x1c')](_0x2196c7,{'showHidden':![],'depth':null}));if(this[_0xc5f2('0xb')][_0x2196c7['peer']]){if(!this[_0xc5f2('0xb')][_0x2196c7[_0xc5f2('0x45')]][_0xc5f2('0x32')]||_0x2196c7[_0xc5f2('0x11')][_0xc5f2('0x37')]()==_0xc5f2('0x47')){this['agents'][_0x2196c7['peer']]['local']=![];this[_0xc5f2('0xb')][_0x2196c7[_0xc5f2('0x45')]][_0xc5f2('0x48')]=_0x2196c7['peerstatus'][_0xc5f2('0x37')]();this[_0xc5f2('0xb')][_0x2196c7[_0xc5f2('0x45')]][_0xc5f2('0x46')]=_0x2196c7[_0xc5f2('0x46')];this[_0xc5f2('0xb')][_0x2196c7[_0xc5f2('0x45')]][_0xc5f2('0x38')](_0x2196c7);}}else if(this[_0xc5f2('0xc')][_0x2196c7['peer']]){this['telephones'][_0x2196c7[_0xc5f2('0x45')]][_0xc5f2('0x48')]=_0x2196c7[_0xc5f2('0x11')][_0xc5f2('0x37')]();this['telephones'][_0x2196c7[_0xc5f2('0x45')]][_0xc5f2('0x46')]=_0x2196c7[_0xc5f2('0x46')];logger['debug'](_0xc5f2('0x49'),util[_0xc5f2('0x1c')](this['telephones'][_0x2196c7[_0xc5f2('0x45')]],{'showHidden':![],'depth':null}));this[_0xc5f2('0x22')](util['format'](_0xc5f2('0x39'),this['telephones'][_0x2196c7[_0xc5f2('0x45')]][_0xc5f2('0x2e')]),_0xc5f2('0x4a'),this[_0xc5f2('0xc')][_0x2196c7['peer']]);}else if(this[_0xc5f2('0xa')][_0x2196c7[_0xc5f2('0x45')]]){this['trunks'][_0x2196c7['peer']][_0xc5f2('0x48')]=_0x2196c7[_0xc5f2('0x11')]['toLowerCase']();this[_0xc5f2('0xa')][_0x2196c7[_0xc5f2('0x45')]][_0xc5f2('0x46')]=_0x2196c7[_0xc5f2('0x46')];logger[_0xc5f2('0x27')](_0xc5f2('0x4b'),util[_0xc5f2('0x1c')](this[_0xc5f2('0xa')][_0x2196c7['peer']],{'showHidden':![],'depth':null}));this[_0xc5f2('0x22')](util['format'](_0xc5f2('0x2d'),this[_0xc5f2('0xa')][_0x2196c7[_0xc5f2('0x45')]]['name']),_0xc5f2('0x2f'),this['trunks'][_0x2196c7[_0xc5f2('0x45')]]);}}}catch(_0x21af31){logger[_0xc5f2('0x1a')]('[userReport][peerstatus]',util[_0xc5f2('0x1c')](_0x21af31,{'showHidden':![],'depth':null}));}};module[_0xc5f2('0x4c')]=UserReport; \ No newline at end of file +var _0x1a28=['lodash','moment','util','ioredis','../../../config/environment','../../../config/logger','ami','../ami','redis','localhost','socket.io-emitter','trunks','agents','telephones','registryentry','syncRegistry','registry','bind','peerstatus','syncPeerStatus','resolve','then','actionSipShowRegistry','catch','error','[userReport][sipshowregistry]','inspect','actionDeviceStateList','[userReport][devicestatelist]','actionSipPeerStatus','[userReport][sippeerstatus]','prototype','isNotNull','isUndefined','emit','info','[userReport][registry]\x20registry:%s\x20state:%s','debug','find','username','stateRegistry','state','omit','event','actionid','[userReport][registry]\x20sending\x20trunk:save\x20event:','trunk:%s','name','trunk:save','[userReport][registry]','syncDeviceState','[userReport][devicestatechange]\x20device:%s\x20state:%s','device','local','toLowerCase','stateTime','toNumber','format','updateStatusRealtime','[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:','telephone:%s','telephone:save','[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:','startsWith','Local','substring','indexOf','phone','accountcode','[userReport][devicestatechange]','[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s','peer','address','[userReport][peerstatus]','registered','status','[userReport][peerstatus]\x20sending\x20telephone:save\x20event:','[userReport][peerstatus]\x20sending\x20trunk:save\x20event:','exports'];(function(_0x310817,_0x1e2db9){var _0x3822fc=function(_0x23321a){while(--_0x23321a){_0x310817['push'](_0x310817['shift']());}};_0x3822fc(++_0x1e2db9);}(_0x1a28,0x18b));var _0x81a2=function(_0xb0de07,_0x3ca2a0){_0xb0de07=_0xb0de07-0x0;var _0x4633d8=_0x1a28[_0xb0de07];return _0x4633d8;};'use strict';var _=require(_0x81a2('0x0'));var moment=require(_0x81a2('0x1'));var util=require(_0x81a2('0x2'));var Redis=require(_0x81a2('0x3'));var BPromise=require('bluebird');var config=require(_0x81a2('0x4'));var logger=require(_0x81a2('0x5'))(_0x81a2('0x6'));var ami=require(_0x81a2('0x7'));config[_0x81a2('0x8')]=_['defaults'](config['redis'],{'host':_0x81a2('0x9'),'port':0x18eb});var io=require(_0x81a2('0xa'))(new Redis(config['redis']));function UserReport(_0x197ea8){this['trunks']=_0x197ea8[_0x81a2('0xb')];this[_0x81a2('0xc')]=_0x197ea8['agents'];this[_0x81a2('0xd')]=_0x197ea8[_0x81a2('0xd')];ami['on'](_0x81a2('0xe'),this[_0x81a2('0xf')]['bind'](this));ami['on'](_0x81a2('0x10'),this[_0x81a2('0xf')][_0x81a2('0x11')](this));ami['on']('devicestatechange',this['syncDeviceState'][_0x81a2('0x11')](this));ami['on'](_0x81a2('0x12'),this[_0x81a2('0x13')][_0x81a2('0x11')](this));return this['syncRealtimeShow']();}function showSipRegistrations(){Promise[_0x81a2('0x14')]()[_0x81a2('0x15')](ami[_0x81a2('0x16')]())[_0x81a2('0x17')](function(_0x1049e7){logger[_0x81a2('0x18')](_0x81a2('0x19'),util[_0x81a2('0x1a')](_0x1049e7,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise[_0x81a2('0x14')]()['then'](ami[_0x81a2('0x1b')]())[_0x81a2('0x17')](function(_0x97be4f){logger['error'](_0x81a2('0x1c'),util[_0x81a2('0x1a')](_0x97be4f,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise[_0x81a2('0x14')]()[_0x81a2('0x15')](ami[_0x81a2('0x1d')]())[_0x81a2('0x17')](function(_0x169f44){logger[_0x81a2('0x18')](_0x81a2('0x1e'),util[_0x81a2('0x1a')](_0x169f44,{'showHidden':![],'depth':null}));});}UserReport['prototype']['syncRealtimeShow']=function(){setInterval(function(){BPromise[_0x81a2('0x14')]()['then'](showSipRegistrations())['then'](listDeviceStates())[_0x81a2('0x15')](showPeersStatus());},0x32c8);};UserReport[_0x81a2('0x1f')][_0x81a2('0x20')]=function(_0x2fd22d){return _0x2fd22d!==null&&!_[_0x81a2('0x21')](_0x2fd22d);};UserReport['prototype'][_0x81a2('0x22')]=function(_0x3237ce,_0x33815f,_0x3071ad){io['to'](_0x3237ce)[_0x81a2('0x22')](_0x33815f,_0x3071ad);};UserReport['prototype']['syncRegistry']=function(_0x1c1be0){try{if(this[_0x81a2('0x20')](_0x1c1be0)){logger[_0x81a2('0x23')](_0x81a2('0x24'),_0x1c1be0['username'],_0x1c1be0['state']);logger[_0x81a2('0x25')]('[userReport][registry]',util[_0x81a2('0x1a')](_0x1c1be0,{'showHidden':![],'depth':null}));var _0x2aaa96=_[_0x81a2('0x26')](this[_0x81a2('0xb')],{'defaultuser':_0x1c1be0[_0x81a2('0x27')]});if(_0x2aaa96){_0x1c1be0[_0x81a2('0x28')]=_0x1c1be0[_0x81a2('0x29')];_['merge'](_0x2aaa96,_[_0x81a2('0x2a')](_0x1c1be0,[_0x81a2('0x2b'),_0x81a2('0x2c'),'username',_0x81a2('0x29')]));logger[_0x81a2('0x25')](_0x81a2('0x2d'),util[_0x81a2('0x1a')](_0x2aaa96,{'showHidden':![],'depth':null}));this[_0x81a2('0x22')](util['format'](_0x81a2('0x2e'),_0x2aaa96[_0x81a2('0x2f')]),_0x81a2('0x30'),_0x2aaa96);}}}catch(_0x4deac3){logger[_0x81a2('0x18')](_0x81a2('0x31'),util[_0x81a2('0x1a')](_0x4deac3,{'showHidden':![],'depth':null}));}};UserReport[_0x81a2('0x1f')][_0x81a2('0x32')]=function(_0x2ea705){try{if(this[_0x81a2('0x20')](_0x2ea705)){logger[_0x81a2('0x23')](_0x81a2('0x33'),_0x2ea705[_0x81a2('0x34')],_0x2ea705['state']);logger[_0x81a2('0x25')]('[userReport][devicestatechange]',util[_0x81a2('0x1a')](_0x2ea705,{'showHidden':![],'depth':null}));if(this[_0x81a2('0xc')][_0x2ea705[_0x81a2('0x34')]]){if(!this[_0x81a2('0xc')][_0x2ea705[_0x81a2('0x34')]][_0x81a2('0x35')]||_0x2ea705[_0x81a2('0x29')]['toLowerCase']()=='inuse'){this[_0x81a2('0xc')][_0x2ea705['device']]['local']=![];if(this[_0x81a2('0xc')][_0x2ea705[_0x81a2('0x34')]][_0x81a2('0x29')]!==_0x2ea705['state'][_0x81a2('0x36')]()){this[_0x81a2('0xc')][_0x2ea705[_0x81a2('0x34')]][_0x81a2('0x37')]=_[_0x81a2('0x38')](moment()[_0x81a2('0x39')]('x'));}this['agents'][_0x2ea705[_0x81a2('0x34')]][_0x81a2('0x29')]=_0x2ea705['state']['toLowerCase']();this[_0x81a2('0xc')][_0x2ea705['device']][_0x81a2('0x3a')](_0x2ea705);}}else if(this['telephones'][_0x2ea705[_0x81a2('0x34')]]){if(this[_0x81a2('0xd')][_0x2ea705[_0x81a2('0x34')]][_0x81a2('0x29')]!==_0x2ea705[_0x81a2('0x29')]['toLowerCase']()){this[_0x81a2('0xd')][_0x2ea705[_0x81a2('0x34')]][_0x81a2('0x37')]=_['toNumber'](moment()[_0x81a2('0x39')]('x'));}this['telephones'][_0x2ea705[_0x81a2('0x34')]][_0x81a2('0x29')]=_0x2ea705['state'][_0x81a2('0x36')]();logger[_0x81a2('0x25')](_0x81a2('0x3b'),util[_0x81a2('0x1a')](this[_0x81a2('0xd')][_0x2ea705[_0x81a2('0x34')]],{'showHidden':![],'depth':null}));this[_0x81a2('0x22')](util[_0x81a2('0x39')](_0x81a2('0x3c'),this[_0x81a2('0xd')][_0x2ea705[_0x81a2('0x34')]][_0x81a2('0x2f')]),_0x81a2('0x3d'),this[_0x81a2('0xd')][_0x2ea705['device']]);}else if(this[_0x81a2('0xb')][_0x2ea705[_0x81a2('0x34')]]){if(this[_0x81a2('0xb')][_0x2ea705['device']][_0x81a2('0x29')]!==_0x2ea705[_0x81a2('0x29')][_0x81a2('0x36')]()){this['trunks'][_0x2ea705[_0x81a2('0x34')]][_0x81a2('0x37')]=_[_0x81a2('0x38')](moment()['format']('x'));}this[_0x81a2('0xb')][_0x2ea705[_0x81a2('0x34')]][_0x81a2('0x29')]=_0x2ea705['state'][_0x81a2('0x36')]();logger[_0x81a2('0x25')](_0x81a2('0x3e'),util[_0x81a2('0x1a')](this[_0x81a2('0xb')][_0x2ea705[_0x81a2('0x34')]],{'showHidden':![],'depth':null}));this[_0x81a2('0x22')](util[_0x81a2('0x39')](_0x81a2('0x2e'),this[_0x81a2('0xb')][_0x2ea705[_0x81a2('0x34')]][_0x81a2('0x2f')]),_0x81a2('0x30'),this[_0x81a2('0xb')][_0x2ea705[_0x81a2('0x34')]]);}else if(_[_0x81a2('0x3f')](_0x2ea705[_0x81a2('0x34')],_0x81a2('0x40'))){var _0x572fca=_0x2ea705[_0x81a2('0x34')];var _0x52f5bf=_0x572fca[_0x81a2('0x41')](_0x572fca[_0x81a2('0x42')]('/')+0x1,_0x572fca[_0x81a2('0x42')]('@'));var _0x13cdda=_['find'](this[_0x81a2('0xc')],function(_0x1fedec){return _0x1fedec['mobile']==_0x52f5bf||_0x1fedec[_0x81a2('0x43')]==_0x52f5bf||_0x1fedec[_0x81a2('0x44')]==_0x52f5bf;});if(_0x13cdda){if(_0x13cdda[_0x81a2('0x29')]!==_0x2ea705[_0x81a2('0x29')][_0x81a2('0x36')]()){_0x13cdda[_0x81a2('0x37')]=_[_0x81a2('0x38')](moment()[_0x81a2('0x39')]('x'));}_0x13cdda['state']=_0x2ea705[_0x81a2('0x29')][_0x81a2('0x36')]();_0x13cdda['local']=!![];_0x13cdda[_0x81a2('0x3a')](_0x2ea705);}}}}catch(_0x5927f4){logger['error'](_0x81a2('0x45'),util[_0x81a2('0x1a')](_0x5927f4,{'showHidden':![],'depth':null}));}};UserReport[_0x81a2('0x1f')]['syncPeerStatus']=function(_0x14cfea){try{if(this[_0x81a2('0x20')](_0x14cfea)&&this[_0x81a2('0x20')](_0x14cfea[_0x81a2('0x12')])){logger[_0x81a2('0x23')](_0x81a2('0x46'),_0x14cfea[_0x81a2('0x47')],_0x14cfea[_0x81a2('0x48')],_0x14cfea[_0x81a2('0x12')]);logger[_0x81a2('0x25')](_0x81a2('0x49'),util['inspect'](_0x14cfea,{'showHidden':![],'depth':null}));if(this[_0x81a2('0xc')][_0x14cfea['peer']]){if(!this['agents'][_0x14cfea[_0x81a2('0x47')]][_0x81a2('0x35')]||_0x14cfea[_0x81a2('0x12')][_0x81a2('0x36')]()==_0x81a2('0x4a')){this['agents'][_0x14cfea[_0x81a2('0x47')]][_0x81a2('0x35')]=![];this['agents'][_0x14cfea[_0x81a2('0x47')]][_0x81a2('0x4b')]=_0x14cfea[_0x81a2('0x12')][_0x81a2('0x36')]();this['agents'][_0x14cfea[_0x81a2('0x47')]][_0x81a2('0x48')]=_0x14cfea[_0x81a2('0x48')];this[_0x81a2('0xc')][_0x14cfea[_0x81a2('0x47')]][_0x81a2('0x3a')](_0x14cfea);}}else if(this[_0x81a2('0xd')][_0x14cfea[_0x81a2('0x47')]]){this[_0x81a2('0xd')][_0x14cfea[_0x81a2('0x47')]]['status']=_0x14cfea['peerstatus'][_0x81a2('0x36')]();this[_0x81a2('0xd')][_0x14cfea[_0x81a2('0x47')]][_0x81a2('0x48')]=_0x14cfea[_0x81a2('0x48')];logger['debug'](_0x81a2('0x4c'),util[_0x81a2('0x1a')](this[_0x81a2('0xd')][_0x14cfea[_0x81a2('0x47')]],{'showHidden':![],'depth':null}));this[_0x81a2('0x22')](util[_0x81a2('0x39')](_0x81a2('0x3c'),this['telephones'][_0x14cfea[_0x81a2('0x47')]]['name']),_0x81a2('0x3d'),this[_0x81a2('0xd')][_0x14cfea[_0x81a2('0x47')]]);}else if(this['trunks'][_0x14cfea[_0x81a2('0x47')]]){this[_0x81a2('0xb')][_0x14cfea[_0x81a2('0x47')]]['status']=_0x14cfea[_0x81a2('0x12')][_0x81a2('0x36')]();this[_0x81a2('0xb')][_0x14cfea[_0x81a2('0x47')]][_0x81a2('0x48')]=_0x14cfea[_0x81a2('0x48')];logger[_0x81a2('0x25')](_0x81a2('0x4d'),util[_0x81a2('0x1a')](this[_0x81a2('0xb')][_0x14cfea[_0x81a2('0x47')]],{'showHidden':![],'depth':null}));this['emit'](util[_0x81a2('0x39')](_0x81a2('0x2e'),this[_0x81a2('0xb')][_0x14cfea[_0x81a2('0x47')]][_0x81a2('0x2f')]),'trunk:save',this[_0x81a2('0xb')][_0x14cfea[_0x81a2('0x47')]]);}}}catch(_0x5ec18c){logger['error'](_0x81a2('0x49'),util[_0x81a2('0x1a')](_0x5ec18c,{'showHidden':![],'depth':null}));}};module[_0x81a2('0x4e')]=UserReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceAgentReport.js b/server/services/ami/report/voiceAgentReport.js index ec7537c..38ebc0d 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 _0xc5b9=['variables','agentcalled','syncAgentCalled','bind','syncAgentConnect','agentringnoanswer','syncAgentRingNoAnswer','queuecallerabandon','syncQueueCallerAbandon','agentcomplete','syncAgentComplete','varset','syncVarSet','hangup','syncHangup','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','syncAttendedTransfer','blindtransfer','syncBlindTransfer','prototype','emit','isUndefined','isNotNull','info','[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','uniqueid','destuniqueid','debug','[%s][voiceAgentReport][agentcalled]\x20event:','inspect','YYYY-MM-DD\x20HH:mm:ss','called','queue','inbound','merge','omit','event','privilege','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','custom:agentcalled','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:','format','user:%s','membername','user:called','error','[%s][voiceAgentReport][agentcalled]','hasOwnProperty','connectedlinename','connectedlinenum','destchannelstate','destchannelstatedesc','holdtime','lastevent','interface','pick','destconnectedlinenum','custom:agentconnect','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:agentconnect\x20event:','user:agentconnect','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere','agentringnoanswerAt','answeredelsewheredestinationuniqueid','reason','custom:agentansweredelsewhere','[%s][voiceAgentReport][agentconnect]','[%s][voiceAgentReport][agentringnoanswer]\x20event:','[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected','rejected','[%s][voiceAgentReport][agentringnoanswer]','[%s][voiceAgentReport][queuecallerabandon]\x20event:','abandoned','[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:','custom:agentqueuecallerabandon','agentconnectAt','[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','transfer','agent','talktime','acwTimeout','custom:agentcomplete','user:agentcomplete','[%s][voiceAgentReport][agentcomplete]','[%s][voiceAgentReport][varset]\x20event:','keys','variable','[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s','value','[%s][voiceAgentReport][varset]','addVariable','rtpaudioqos','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','sipcallid','sipuri','bridgepeer','membercalls','memberdynamic','memberinterface','memberpenalty','memberrealtime','isNil','includes','[%s][voiceAgentReport][hangup]\x20event:','[%s][voiceAgentReport][hangup]\x20destuniqueid:%s','values','[%s][voiceAgentReport][hangup]','[%s][voiceAgentReport][attendedtransfer]\x20event:','transfereeuniqueid','origtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','complete','diff','seconds','secondtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]','[%s][voiceAgentReport][musiconholdstart]\x20event:','substring','channel','lastIndexOf','[%s][voiceAgentReport][musiconholdstart]\x20interface:%s','[%s][voiceAgentReport][musiconholdstart]','[%s][voiceAgentReport][musiconholdstop]\x20event:','[%s][voiceAgentReport][musiconholdstop]\x20interface:%s','onhold','[%s][voiceAgentReport][musiconholdstop]','lodash','moment','util','ioredis','../../../config/environment','../../../config/logger','../ami','redis','defaults','localhost','channels','voiceQueues','agents'];(function(_0x35d126,_0x4ab04a){var _0x59b658=function(_0x49f156){while(--_0x49f156){_0x35d126['push'](_0x35d126['shift']());}};_0x59b658(++_0x4ab04a);}(_0xc5b9,0x84));var _0x9c5b=function(_0x382d47,_0x46843e){_0x382d47=_0x382d47-0x0;var _0x3fa02c=_0xc5b9[_0x382d47];return _0x3fa02c;};'use strict';var _=require(_0x9c5b('0x0'));var moment=require(_0x9c5b('0x1'));var util=require(_0x9c5b('0x2'));var Redis=require(_0x9c5b('0x3'));var config=require(_0x9c5b('0x4'));var logger=require(_0x9c5b('0x5'))('ami');var ami=require(_0x9c5b('0x6'));config[_0x9c5b('0x7')]=_[_0x9c5b('0x8')](config[_0x9c5b('0x7')],{'host':_0x9c5b('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x9c5b('0x7')]));function VoiceAgentReport(_0x4fe106){this[_0x9c5b('0xa')]={};this[_0x9c5b('0xb')]=_0x4fe106[_0x9c5b('0xb')];this['agents']=_0x4fe106[_0x9c5b('0xc')];this[_0x9c5b('0xd')]={};ami['on'](_0x9c5b('0xe'),this[_0x9c5b('0xf')][_0x9c5b('0x10')](this));ami['on']('agentconnect',this[_0x9c5b('0x11')]['bind'](this));ami['on'](_0x9c5b('0x12'),this[_0x9c5b('0x13')][_0x9c5b('0x10')](this));ami['on'](_0x9c5b('0x14'),this[_0x9c5b('0x15')]['bind'](this));ami['on'](_0x9c5b('0x16'),this[_0x9c5b('0x17')]['bind'](this));ami['on'](_0x9c5b('0x18'),this[_0x9c5b('0x19')][_0x9c5b('0x10')](this));ami['on'](_0x9c5b('0x1a'),this[_0x9c5b('0x1b')][_0x9c5b('0x10')](this));ami['on'](_0x9c5b('0x1c'),this[_0x9c5b('0x1d')][_0x9c5b('0x10')](this));ami['on'](_0x9c5b('0x1e'),this[_0x9c5b('0x1f')][_0x9c5b('0x10')](this));ami['on']('attendedtransfer',this[_0x9c5b('0x20')][_0x9c5b('0x10')](this));ami['on'](_0x9c5b('0x21'),this[_0x9c5b('0x22')][_0x9c5b('0x10')](this));}VoiceAgentReport[_0x9c5b('0x23')]['emit']=function(_0x3756a0,_0x16add3,_0x11406f){io['to'](_0x3756a0)[_0x9c5b('0x24')](_0x16add3,_0x11406f);};VoiceAgentReport['prototype']['isNotNull']=function(_0x1a0c6d){return _0x1a0c6d!==null&&!_[_0x9c5b('0x25')](_0x1a0c6d);};VoiceAgentReport['prototype'][_0x9c5b('0xf')]=function(_0x4e3aa6){try{if(this[_0x9c5b('0x26')](_0x4e3aa6)){logger[_0x9c5b('0x27')](_0x9c5b('0x28'),_0x4e3aa6[_0x9c5b('0x29')],_0x4e3aa6['membername'],_0x4e3aa6[_0x9c5b('0x2a')]);logger[_0x9c5b('0x2b')](_0x9c5b('0x2c'),_0x4e3aa6[_0x9c5b('0x29')],util[_0x9c5b('0x2d')](_0x4e3aa6,{'showHidden':![],'depth':null}));if(_['isUndefined'](this[_0x9c5b('0xa')][_0x4e3aa6['uniqueid']])){this[_0x9c5b('0xa')][_0x4e3aa6[_0x9c5b('0x29')]]={};}if(_[_0x9c5b('0x25')](this[_0x9c5b('0xa')][_0x4e3aa6['uniqueid']][_0x4e3aa6[_0x9c5b('0x2a')]])){this[_0x9c5b('0xa')][_0x4e3aa6[_0x9c5b('0x29')]][_0x4e3aa6[_0x9c5b('0x2a')]]={'agentcalledAt':moment()['format'](_0x9c5b('0x2e')),'lastevent':_0x9c5b('0x2f'),'mandatoryDisposition':this[_0x9c5b('0xb')][_0x4e3aa6['queue']]?this[_0x9c5b('0xb')][_0x4e3aa6[_0x9c5b('0x30')]]['mandatoryDisposition']||![]:![],'type':this[_0x9c5b('0xb')][_0x4e3aa6[_0x9c5b('0x30')]]?this['voiceQueues'][_0x4e3aa6[_0x9c5b('0x30')]]['type']||_0x9c5b('0x31'):_0x9c5b('0x31'),'variables':this[_0x9c5b('0xd')][_0x4e3aa6[_0x9c5b('0x29')]]};}_[_0x9c5b('0x32')](this[_0x9c5b('0xa')][_0x4e3aa6[_0x9c5b('0x29')]][_0x4e3aa6[_0x9c5b('0x2a')]],_[_0x9c5b('0x33')](_0x4e3aa6,[_0x9c5b('0x34'),_0x9c5b('0x35')]));logger[_0x9c5b('0x2b')](_0x9c5b('0x36'),_0x4e3aa6[_0x9c5b('0x29')],util[_0x9c5b('0x2d')](this['channels'][_0x4e3aa6['uniqueid']][_0x4e3aa6[_0x9c5b('0x2a')]],{'showHidden':![],'depth':null}));ami[_0x9c5b('0x24')](_0x9c5b('0x37'),this[_0x9c5b('0xa')][_0x4e3aa6['uniqueid']][_0x4e3aa6['destuniqueid']]);logger[_0x9c5b('0x2b')](_0x9c5b('0x38'),_0x4e3aa6['uniqueid'],util['inspect'](this[_0x9c5b('0xa')][_0x4e3aa6[_0x9c5b('0x29')]][_0x4e3aa6[_0x9c5b('0x2a')]],{'showHidden':![],'depth':null}));this[_0x9c5b('0x24')](util[_0x9c5b('0x39')](_0x9c5b('0x3a'),_0x4e3aa6[_0x9c5b('0x3b')]),_0x9c5b('0x3c'),this['channels'][_0x4e3aa6[_0x9c5b('0x29')]][_0x4e3aa6['destuniqueid']]);}}catch(_0x40e43a){logger[_0x9c5b('0x3d')](_0x9c5b('0x3e'),_0x4e3aa6[_0x9c5b('0x29')],util['inspect'](_0x40e43a,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x9c5b('0x23')][_0x9c5b('0x11')]=function(_0xe4eddb){try{if(this['isNotNull'](_0xe4eddb)){if(this[_0x9c5b('0xa')][_0xe4eddb[_0x9c5b('0x29')]]){logger[_0x9c5b('0x2b')]('[%s][voiceAgentReport][agentconnect]\x20event:',_0xe4eddb[_0x9c5b('0x29')],util[_0x9c5b('0x2d')](_0xe4eddb,{'showHidden':![],'depth':null}));for(var _0x2e0f62 in this[_0x9c5b('0xa')][_0xe4eddb[_0x9c5b('0x29')]]){if(this[_0x9c5b('0xa')][_0xe4eddb[_0x9c5b('0x29')]][_0x9c5b('0x3f')](_0x2e0f62)){if(_0xe4eddb[_0x9c5b('0x2a')]===_0x2e0f62){logger['info']('[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect',_0xe4eddb[_0x9c5b('0x29')],_0xe4eddb['membername'],_0xe4eddb[_0x9c5b('0x2a')]);this['channels'][_0xe4eddb[_0x9c5b('0x29')]][_0x2e0f62]['agentconnectAt']=moment()[_0x9c5b('0x39')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x9c5b('0xa')][_0xe4eddb[_0x9c5b('0x29')]][_0x2e0f62][_0x9c5b('0x40')]=_0xe4eddb[_0x9c5b('0x40')];this[_0x9c5b('0xa')][_0xe4eddb['uniqueid']][_0x2e0f62][_0x9c5b('0x41')]=_0xe4eddb['connectedlinenum'];this[_0x9c5b('0xa')][_0xe4eddb[_0x9c5b('0x29')]][_0x2e0f62]['destchannelstate']=_0xe4eddb[_0x9c5b('0x42')];this[_0x9c5b('0xa')][_0xe4eddb[_0x9c5b('0x29')]][_0x2e0f62][_0x9c5b('0x43')]=_0xe4eddb[_0x9c5b('0x43')];this[_0x9c5b('0xa')][_0xe4eddb[_0x9c5b('0x29')]][_0x2e0f62]['holdtime']=_0xe4eddb[_0x9c5b('0x44')];this[_0x9c5b('0xa')][_0xe4eddb[_0x9c5b('0x29')]][_0x2e0f62][_0x9c5b('0x45')]='connect';_[_0x9c5b('0x32')](this[_0x9c5b('0xc')][_0xe4eddb[_0x9c5b('0x46')]],_[_0x9c5b('0x47')](_0xe4eddb,[_0x9c5b('0x30'),_0x9c5b('0x48')]));logger[_0x9c5b('0x2b')]('[%s][voiceAgentReport][agentconnect]\x20sending\x20agentconnect\x20event:',_0xe4eddb[_0x9c5b('0x29')],util[_0x9c5b('0x2d')](this[_0x9c5b('0xa')][_0xe4eddb[_0x9c5b('0x29')]][_0xe4eddb[_0x9c5b('0x2a')]],{'showHidden':![],'depth':null}));ami['emit'](_0x9c5b('0x49'),this[_0x9c5b('0xa')][_0xe4eddb['uniqueid']][_0xe4eddb[_0x9c5b('0x2a')]]);logger[_0x9c5b('0x2b')](_0x9c5b('0x4a'),_0xe4eddb[_0x9c5b('0x29')],util[_0x9c5b('0x2d')](this[_0x9c5b('0xa')][_0xe4eddb[_0x9c5b('0x29')]][_0xe4eddb[_0x9c5b('0x2a')]],{'showHidden':![],'depth':null}));this[_0x9c5b('0x24')](util[_0x9c5b('0x39')](_0x9c5b('0x3a'),_0xe4eddb[_0x9c5b('0x3b')]),_0x9c5b('0x4b'),this[_0x9c5b('0xa')][_0xe4eddb[_0x9c5b('0x29')]][_0xe4eddb[_0x9c5b('0x2a')]]);}else if(!this[_0x9c5b('0xa')][_0xe4eddb['uniqueid']][_0x2e0f62][_0x9c5b('0x12')]&&!this['channels'][_0xe4eddb[_0x9c5b('0x29')]][_0x2e0f62][_0x9c5b('0x16')]){logger[_0x9c5b('0x27')](_0x9c5b('0x4c'),_0xe4eddb[_0x9c5b('0x29')],this[_0x9c5b('0xa')][_0xe4eddb[_0x9c5b('0x29')]][_0x2e0f62][_0x9c5b('0x3b')],_0x2e0f62);this[_0x9c5b('0xa')][_0xe4eddb['uniqueid']][_0x2e0f62][_0x9c5b('0x12')]=!![];this[_0x9c5b('0xa')][_0xe4eddb[_0x9c5b('0x29')]][_0x2e0f62][_0x9c5b('0x4d')]=moment()[_0x9c5b('0x39')](_0x9c5b('0x2e'));this[_0x9c5b('0xa')][_0xe4eddb[_0x9c5b('0x29')]][_0x2e0f62][_0x9c5b('0x4e')]=_0xe4eddb[_0x9c5b('0x2a')];this[_0x9c5b('0xa')][_0xe4eddb[_0x9c5b('0x29')]][_0x2e0f62]['answeredelsewheremembername']=_0xe4eddb[_0x9c5b('0x3b')];this[_0x9c5b('0xa')][_0xe4eddb['uniqueid']][_0x2e0f62]['lastevent']='answered_elsewhere';this[_0x9c5b('0xa')][_0xe4eddb[_0x9c5b('0x29')]][_0x2e0f62][_0x9c5b('0x4f')]='answered_elsewhere';logger[_0x9c5b('0x2b')]('[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:',_0xe4eddb[_0x9c5b('0x29')],util['inspect'](this[_0x9c5b('0xa')][_0xe4eddb['uniqueid']][_0x2e0f62],{'showHidden':![],'depth':null}));ami[_0x9c5b('0x24')](_0x9c5b('0x50'),this[_0x9c5b('0xa')][_0xe4eddb[_0x9c5b('0x29')]][_0x2e0f62]);}}}}}}catch(_0x53cfb0){logger[_0x9c5b('0x3d')](_0x9c5b('0x51'),_0xe4eddb['uniqueid'],util[_0x9c5b('0x2d')](_0x53cfb0,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x9c5b('0x23')][_0x9c5b('0x13')]=function(_0x2f7bf6){try{if(this[_0x9c5b('0x26')](_0x2f7bf6)){logger[_0x9c5b('0x2b')](_0x9c5b('0x52'),_0x2f7bf6[_0x9c5b('0x29')],util[_0x9c5b('0x2d')](_0x2f7bf6,{'showHidden':![],'depth':null}));if(this[_0x9c5b('0xa')][_0x2f7bf6[_0x9c5b('0x29')]]&&this['channels'][_0x2f7bf6['uniqueid']][_0x2f7bf6[_0x9c5b('0x2a')]]){logger[_0x9c5b('0x27')](_0x9c5b('0x53'),_0x2f7bf6[_0x9c5b('0x29')],_0x2f7bf6['membername'],_0x2f7bf6[_0x9c5b('0x2a')]);this[_0x9c5b('0xa')][_0x2f7bf6['uniqueid']][_0x2f7bf6[_0x9c5b('0x2a')]][_0x9c5b('0x12')]=!![];this[_0x9c5b('0xa')][_0x2f7bf6[_0x9c5b('0x29')]][_0x2f7bf6[_0x9c5b('0x2a')]]['agentringnoanswerAt']=moment()[_0x9c5b('0x39')](_0x9c5b('0x2e'));this[_0x9c5b('0xa')][_0x2f7bf6['uniqueid']][_0x2f7bf6[_0x9c5b('0x2a')]]['lastevent']=_0x9c5b('0x54');this[_0x9c5b('0xa')][_0x2f7bf6[_0x9c5b('0x29')]][_0x2f7bf6[_0x9c5b('0x2a')]][_0x9c5b('0x4f')]=_0x9c5b('0x54');logger[_0x9c5b('0x2b')]('[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:',_0x2f7bf6['uniqueid'],util[_0x9c5b('0x2d')](this[_0x9c5b('0xa')][_0x2f7bf6['uniqueid']][_0x2f7bf6[_0x9c5b('0x2a')]],{'showHidden':![],'depth':null}));ami['emit']('custom:agentringnoanswer',this['channels'][_0x2f7bf6[_0x9c5b('0x29')]][_0x2f7bf6[_0x9c5b('0x2a')]]);}}}catch(_0x40b033){logger[_0x9c5b('0x3d')](_0x9c5b('0x55'),_0x2f7bf6[_0x9c5b('0x29')],util['inspect'](_0x40b033,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x9c5b('0x15')]=function(_0x300172){try{if(this[_0x9c5b('0x26')](_0x300172)){logger[_0x9c5b('0x2b')](_0x9c5b('0x56'),_0x300172[_0x9c5b('0x29')],util[_0x9c5b('0x2d')](_0x300172,{'showHidden':![],'depth':null}));if(this['channels'][_0x300172[_0x9c5b('0x29')]]){for(var _0x157855 in this[_0x9c5b('0xa')][_0x300172[_0x9c5b('0x29')]]){if(this['channels'][_0x300172[_0x9c5b('0x29')]][_0x9c5b('0x3f')](_0x157855)&&!this['channels'][_0x300172[_0x9c5b('0x29')]][_0x157855][_0x9c5b('0x12')]&&!this['channels'][_0x300172[_0x9c5b('0x29')]][_0x157855][_0x9c5b('0x16')]){logger[_0x9c5b('0x27')]('[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0x300172['uniqueid'],this[_0x9c5b('0xa')][_0x300172[_0x9c5b('0x29')]][_0x157855]['membername'],_0x157855);this['channels'][_0x300172[_0x9c5b('0x29')]][_0x157855]['agentringnoanswer']=!![];this['channels'][_0x300172[_0x9c5b('0x29')]][_0x157855][_0x9c5b('0x4d')]=moment()[_0x9c5b('0x39')](_0x9c5b('0x2e'));this[_0x9c5b('0xa')][_0x300172[_0x9c5b('0x29')]][_0x157855][_0x9c5b('0x45')]=_0x9c5b('0x57');this['channels'][_0x300172[_0x9c5b('0x29')]][_0x157855][_0x9c5b('0x4f')]=_0x9c5b('0x57');logger[_0x9c5b('0x2b')](_0x9c5b('0x58'),_0x300172['uniqueid'],util[_0x9c5b('0x2d')](this[_0x9c5b('0xa')][_0x300172[_0x9c5b('0x29')]][_0x157855],{'showHidden':![],'depth':null}));ami[_0x9c5b('0x24')](_0x9c5b('0x59'),this[_0x9c5b('0xa')][_0x300172[_0x9c5b('0x29')]][_0x157855]);}}}}}catch(_0x5cf3ea){logger[_0x9c5b('0x3d')]('[%s][voiceAgentReport][queuecallerabandon]',_0x300172[_0x9c5b('0x29')],util[_0x9c5b('0x2d')](_0x5cf3ea,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x9c5b('0x23')][_0x9c5b('0x17')]=function(_0x2994d6){try{if(this['isNotNull'](_0x2994d6)){logger[_0x9c5b('0x2b')]('[%s][voiceAgentReport][agentcomplete]\x20event:',_0x2994d6['uniqueid'],util[_0x9c5b('0x2d')](_0x2994d6,{'showHidden':![],'depth':null}));if(this[_0x9c5b('0xa')][_0x2994d6['uniqueid']]){for(var _0x87e458 in this[_0x9c5b('0xa')][_0x2994d6[_0x9c5b('0x29')]]){if(this['channels'][_0x2994d6[_0x9c5b('0x29')]][_0x9c5b('0x3f')](_0x87e458)){if(this[_0x9c5b('0xa')][_0x2994d6[_0x9c5b('0x29')]][_0x87e458][_0x9c5b('0x5a')]&&!this[_0x9c5b('0xa')][_0x2994d6[_0x9c5b('0x29')]][_0x87e458][_0x9c5b('0x16')]){logger[_0x9c5b('0x27')](_0x9c5b('0x5b'),_0x2994d6[_0x9c5b('0x29')],this[_0x9c5b('0xa')][_0x2994d6[_0x9c5b('0x29')]][_0x87e458][_0x9c5b('0x3b')],_0x87e458);this['channels'][_0x2994d6[_0x9c5b('0x29')]][_0x87e458][_0x9c5b('0x16')]=!![];this[_0x9c5b('0xa')][_0x2994d6[_0x9c5b('0x29')]][_0x87e458][_0x9c5b('0x5c')]=moment()[_0x9c5b('0x39')](_0x9c5b('0x2e'));this[_0x9c5b('0xa')][_0x2994d6[_0x9c5b('0x29')]][_0x87e458][_0x9c5b('0x45')]='complete';this[_0x9c5b('0xa')][_0x2994d6[_0x9c5b('0x29')]][_0x87e458][_0x9c5b('0x4f')]=_0x2994d6[_0x9c5b('0x4f')]==_0x9c5b('0x5d')?_0x9c5b('0x5e'):_0x2994d6[_0x9c5b('0x4f')];this[_0x9c5b('0xa')][_0x2994d6[_0x9c5b('0x29')]][_0x87e458][_0x9c5b('0x5f')]=_0x2994d6[_0x9c5b('0x5f')];if(this[_0x9c5b('0xb')][_0x2994d6[_0x9c5b('0x30')]]&&this[_0x9c5b('0xb')][_0x2994d6[_0x9c5b('0x30')]]['acw']){this[_0x9c5b('0xa')][_0x2994d6['uniqueid']][_0x87e458]['acwtime']=this['voiceQueues'][_0x2994d6['queue']][_0x9c5b('0x60')];this[_0x9c5b('0xa')][_0x2994d6['uniqueid']][_0x87e458]['agentacw']=!![];}this[_0x9c5b('0xc')][_0x2994d6['interface']]=_['omit'](this[_0x9c5b('0xc')][_0x2994d6[_0x9c5b('0x46')]],[_0x9c5b('0x30'),'destconnectedlinenum']);logger[_0x9c5b('0x2b')]('[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:',_0x2994d6[_0x9c5b('0x29')],util['inspect'](this['channels'][_0x2994d6[_0x9c5b('0x29')]][_0x87e458],{'showHidden':![],'depth':null}));ami['emit'](_0x9c5b('0x61'),this[_0x9c5b('0xa')][_0x2994d6[_0x9c5b('0x29')]][_0x87e458]);logger[_0x9c5b('0x2b')]('[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:',_0x2994d6[_0x9c5b('0x29')],util[_0x9c5b('0x2d')](this['channels'][_0x2994d6[_0x9c5b('0x29')]][_0x87e458],{'showHidden':![],'depth':null}));this['emit'](util[_0x9c5b('0x39')](_0x9c5b('0x3a'),_0x2994d6[_0x9c5b('0x3b')]),_0x9c5b('0x62'),this[_0x9c5b('0xa')][_0x2994d6[_0x9c5b('0x29')]][_0x87e458]);}}}}}}catch(_0x54736f){logger[_0x9c5b('0x3d')](_0x9c5b('0x63'),_0x2994d6[_0x9c5b('0x29')],util[_0x9c5b('0x2d')](_0x54736f,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x9c5b('0x23')][_0x9c5b('0x19')]=function(_0x2936a6){try{if(this['isNotNull'](_0x2936a6)){logger[_0x9c5b('0x2b')](_0x9c5b('0x64'),_0x2936a6[_0x9c5b('0x29')],util[_0x9c5b('0x2d')](_0x2936a6,{'showHidden':![],'depth':null}));this['addVariable'](_0x2936a6[_0x9c5b('0x29')],_[_0x9c5b('0x65')](_0x2936a6[_0x9c5b('0x66')])[0x0],_0x2936a6['value']);if(this[_0x9c5b('0xa')][_0x2936a6[_0x9c5b('0x29')]]){for(var _0xd1770e in this[_0x9c5b('0xa')][_0x2936a6[_0x9c5b('0x29')]]){if(this['channels'][_0x2936a6[_0x9c5b('0x29')]][_0x9c5b('0x3f')](_0xd1770e)){logger[_0x9c5b('0x27')](_0x9c5b('0x67'),_0x2936a6[_0x9c5b('0x29')],_0xd1770e,_['keys'](_0x2936a6[_0x9c5b('0x66')])[0x0],_0x2936a6[_0x9c5b('0x68')]);if(_[_0x9c5b('0x25')](this[_0x9c5b('0xa')][_0x2936a6[_0x9c5b('0x29')]][_0xd1770e][_0x9c5b('0xd')])){this[_0x9c5b('0xa')][_0x2936a6[_0x9c5b('0x29')]][_0xd1770e][_0x9c5b('0xd')]={};}this[_0x9c5b('0xa')][_0x2936a6[_0x9c5b('0x29')]][_0xd1770e][_0x9c5b('0xd')]=this[_0x9c5b('0xd')][_0x2936a6[_0x9c5b('0x29')]];}}}}}catch(_0x2ee52d){logger['error'](_0x9c5b('0x69'),_0x2936a6['uniqueid'],util[_0x9c5b('0x2d')](_0x2ee52d,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x9c5b('0x23')][_0x9c5b('0x6a')]=function(_0x2d7de6,_0x402b1e,_0x4c028e){var _0x350e5d=[_0x9c5b('0x6b'),'rtpaudioqosbridged','rtpaudioqosjitter',_0x9c5b('0x6c'),_0x9c5b('0x6d'),_0x9c5b('0x6e'),_0x9c5b('0x6f'),'rtpaudioqosrttbridged',_0x9c5b('0x70'),_0x9c5b('0x71'),_0x9c5b('0x72'),'bridgepvtcallid',_0x9c5b('0x73'),_0x9c5b('0x74'),_0x9c5b('0x75'),'memberlastcall',_0x9c5b('0x3b'),_0x9c5b('0x76'),_0x9c5b('0x77')];if(!_[_0x9c5b('0x78')](_0x402b1e)&&!_[_0x9c5b('0x79')](_0x350e5d,_0x402b1e)){if(_[_0x9c5b('0x25')](this[_0x9c5b('0xd')][_0x2d7de6])){this[_0x9c5b('0xd')][_0x2d7de6]={};}this[_0x9c5b('0xd')][_0x2d7de6][_0x402b1e]=_0x4c028e;}};VoiceAgentReport['prototype'][_0x9c5b('0x1b')]=function(_0x30bacf){try{if(this['isNotNull'](_0x30bacf)){logger[_0x9c5b('0x2b')](_0x9c5b('0x7a'),_0x30bacf[_0x9c5b('0x29')],util[_0x9c5b('0x2d')](_0x30bacf,{'showHidden':![],'depth':null}));if(this[_0x9c5b('0xa')][_0x30bacf['uniqueid']]){for(var _0x3e2dd2 in this[_0x9c5b('0xa')][_0x30bacf[_0x9c5b('0x29')]]){if(this[_0x9c5b('0xa')][_0x30bacf['uniqueid']][_0x9c5b('0x3f')](_0x3e2dd2)){if(this[_0x9c5b('0xa')][_0x30bacf[_0x9c5b('0x29')]][_0x3e2dd2][_0x9c5b('0x4f')]=='transfer'&&this[_0x9c5b('0xa')][_0x30bacf[_0x9c5b('0x29')]][_0x3e2dd2]['agentcomplete']){logger['info'](_0x9c5b('0x7b'),_0x30bacf['uniqueid'],_0x3e2dd2);this[_0x9c5b('0xa')][_0x30bacf[_0x9c5b('0x29')]][_0x3e2dd2]['agentcompleteAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}}}logger[_0x9c5b('0x2b')]('[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:',_0x30bacf[_0x9c5b('0x29')],util['inspect'](_[_0x9c5b('0x7c')](this[_0x9c5b('0xa')][_0x30bacf[_0x9c5b('0x29')]]),{'showHidden':![],'depth':null}));ami[_0x9c5b('0x24')]('custom:voiceAgentReport',_[_0x9c5b('0x7c')](this[_0x9c5b('0xa')][_0x30bacf[_0x9c5b('0x29')]]));delete this['channels'][_0x30bacf[_0x9c5b('0x29')]];}if(this[_0x9c5b('0xd')][_0x30bacf[_0x9c5b('0x29')]]){delete this[_0x9c5b('0xd')][_0x30bacf[_0x9c5b('0x29')]];}}}catch(_0x124148){logger[_0x9c5b('0x3d')](_0x9c5b('0x7d'),_0x30bacf[_0x9c5b('0x29')],util[_0x9c5b('0x2d')](_0x124148,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x9c5b('0x20')]=function(_0x5d7372){try{if(this['isNotNull'](_0x5d7372)){logger[_0x9c5b('0x2b')](_0x9c5b('0x7e'),_0x5d7372[_0x9c5b('0x29')],util[_0x9c5b('0x2d')](_0x5d7372,{'showHidden':![],'depth':null}));if(this['channels'][_0x5d7372['transfereeuniqueid']]){for(var _0x4c8b55 in this['channels'][_0x5d7372[_0x9c5b('0x7f')]]){if(this[_0x9c5b('0xa')][_0x5d7372['transfereeuniqueid']][_0x9c5b('0x3f')](_0x4c8b55)){if(_0x5d7372[_0x9c5b('0x80')]===_0x4c8b55){logger[_0x9c5b('0x27')](_0x9c5b('0x81'),_0x5d7372[_0x9c5b('0x29')],this[_0x9c5b('0xa')][_0x5d7372[_0x9c5b('0x7f')]][_0x4c8b55][_0x9c5b('0x3b')],_0x4c8b55);var _0x114b36=moment();this[_0x9c5b('0xa')][_0x5d7372['transfereeuniqueid']][_0x4c8b55][_0x9c5b('0x16')]=!![];this[_0x9c5b('0xa')][_0x5d7372['transfereeuniqueid']][_0x4c8b55][_0x9c5b('0x5c')]=moment()['format'](_0x9c5b('0x2e'));this['channels'][_0x5d7372['transfereeuniqueid']][_0x4c8b55][_0x9c5b('0x45')]=_0x9c5b('0x82');this[_0x9c5b('0xa')][_0x5d7372['transfereeuniqueid']][_0x4c8b55][_0x9c5b('0x4f')]=_0x9c5b('0x5d');this[_0x9c5b('0xa')][_0x5d7372[_0x9c5b('0x7f')]][_0x4c8b55]['talktime']=_0x114b36[_0x9c5b('0x83')](this[_0x9c5b('0xa')][_0x5d7372[_0x9c5b('0x7f')]][_0x4c8b55][_0x9c5b('0x5a')],_0x9c5b('0x84'));}}}}if(this[_0x9c5b('0xa')][_0x5d7372[_0x9c5b('0x85')]]){var _0x90518f=this[_0x9c5b('0xa')][_0x5d7372[_0x9c5b('0x85')]];this['channels'][_0x5d7372['secondtransfereruniqueid']]=this[_0x9c5b('0xa')][_0x5d7372[_0x9c5b('0x7f')]];this[_0x9c5b('0xa')][_0x5d7372[_0x9c5b('0x7f')]]=_0x90518f;}}}catch(_0x1bdc80){logger[_0x9c5b('0x3d')](_0x9c5b('0x86'),_0x5d7372[_0x9c5b('0x29')],util[_0x9c5b('0x2d')](_0x1bdc80,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x9c5b('0x22')]=function(_0x443bcd){try{if(this[_0x9c5b('0x26')](_0x443bcd)){logger[_0x9c5b('0x2b')]('[%s][voiceAgentReport][blindtransfer]\x20event:',_0x443bcd['uniqueid'],util['inspect'](_0x443bcd,{'showHidden':![],'depth':null}));if(this[_0x9c5b('0xa')][_0x443bcd[_0x9c5b('0x7f')]]){for(var _0xb61136 in this[_0x9c5b('0xa')][_0x443bcd[_0x9c5b('0x7f')]]){if(this[_0x9c5b('0xa')][_0x443bcd[_0x9c5b('0x7f')]][_0x9c5b('0x3f')](_0xb61136)){if(_0x443bcd['transfereruniqueid']===_0xb61136){logger[_0x9c5b('0x27')]('[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x443bcd[_0x9c5b('0x29')],this['channels'][_0x443bcd[_0x9c5b('0x7f')]][_0xb61136][_0x9c5b('0x3b')],_0xb61136);var _0x48438a=moment();this[_0x9c5b('0xa')][_0x443bcd[_0x9c5b('0x7f')]][_0xb61136]['agentcomplete']=!![];this[_0x9c5b('0xa')][_0x443bcd['transfereeuniqueid']][_0xb61136][_0x9c5b('0x5c')]=_0x48438a;this[_0x9c5b('0xa')][_0x443bcd[_0x9c5b('0x7f')]][_0xb61136][_0x9c5b('0x45')]='complete';this['channels'][_0x443bcd[_0x9c5b('0x7f')]][_0xb61136][_0x9c5b('0x4f')]=_0x9c5b('0x5d');this[_0x9c5b('0xa')][_0x443bcd[_0x9c5b('0x7f')]][_0xb61136][_0x9c5b('0x5f')]=_0x48438a['diff'](this['channels'][_0x443bcd[_0x9c5b('0x7f')]][_0xb61136][_0x9c5b('0x5a')],_0x9c5b('0x84'));}}}}}}catch(_0x274c5a){logger[_0x9c5b('0x3d')]('[%s][voiceAgentReport][blindtransfer]',_0x443bcd[_0x9c5b('0x29')],util['inspect'](_0x274c5a,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x9c5b('0x23')]['syncMusicOnHoldStart']=function(_0xe49710){var _0x43930c='';try{if(this[_0x9c5b('0x26')](_0xe49710)){logger['debug'](_0x9c5b('0x87'),_0xe49710[_0x9c5b('0x29')],util[_0x9c5b('0x2d')](_0xe49710,{'showHidden':![],'depth':null}));if(_0xe49710['channel']){_0x43930c=_0xe49710['channel'][_0x9c5b('0x88')](0x0,_0xe49710[_0x9c5b('0x89')][_0x9c5b('0x8a')]('-'));if(this['agents'][_0x43930c]){logger['info'](_0x9c5b('0x8b'),_0xe49710[_0x9c5b('0x29')],_0x43930c);this[_0x9c5b('0xc')][_0x43930c]['onhold']=!![];}}}}catch(_0x55bb30){logger['error'](_0x9c5b('0x8c'),_0xe49710['uniqueid'],util[_0x9c5b('0x2d')](_0x55bb30,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x9c5b('0x23')][_0x9c5b('0x1f')]=function(_0x2518cc){var _0x18b6aa='';try{if(this[_0x9c5b('0x26')](_0x2518cc)){logger[_0x9c5b('0x2b')](_0x9c5b('0x8d'),_0x2518cc[_0x9c5b('0x29')],util[_0x9c5b('0x2d')](_0x2518cc,{'showHidden':![],'depth':null}));if(_0x2518cc['channel']){_0x18b6aa=_0x2518cc[_0x9c5b('0x89')][_0x9c5b('0x88')](0x0,_0x2518cc[_0x9c5b('0x89')][_0x9c5b('0x8a')]('-'));if(this[_0x9c5b('0xc')][_0x18b6aa]){logger[_0x9c5b('0x27')](_0x9c5b('0x8e'),_0x2518cc[_0x9c5b('0x29')],_0x18b6aa);this['agents'][_0x18b6aa][_0x9c5b('0x8f')]=![];}}}}catch(_0x175a6a){logger['error'](_0x9c5b('0x90'),_0x2518cc['uniqueid'],util[_0x9c5b('0x2d')](_0x175a6a,{'showHidden':![],'depth':null}));}};module['exports']=VoiceAgentReport; \ No newline at end of file +var _0xaed2=['isUndefined','info','[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','uniqueid','membername','destuniqueid','[%s][voiceAgentReport][agentcalled]\x20event:','inspect','format','YYYY-MM-DD\x20HH:mm:ss','called','queue','type','inbound','merge','omit','event','privilege','debug','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','custom:agentcalled','user:%s','user:called','error','[%s][voiceAgentReport][agentconnect]\x20event:','agentconnectAt','connectedlinename','connectedlinenum','destchannelstate','destchannelstatedesc','holdtime','connect','interface','pick','destconnectedlinenum','custom:agentconnect','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:agentconnect\x20event:','user:agentconnect','agentringnoanswer','agentringnoanswerAt','answeredelsewheredestinationuniqueid','answeredelsewheremembername','lastevent','answered_elsewhere','reason','[%s][voiceAgentReport][agentconnect]','[%s][voiceAgentReport][agentringnoanswer]\x20event:','[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected','[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:','custom:agentringnoanswer','syncQueueCallerAbandon','hasOwnProperty','[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:','custom:agentqueuecallerabandon','[%s][voiceAgentReport][queuecallerabandon]','[%s][voiceAgentReport][agentcomplete]\x20event:','[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agent','talktime','acwtime','acwTimeout','agentacw','[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:','custom:agentcomplete','user:agentcomplete','[%s][voiceAgentReport][agentcomplete]','syncVarSet','[%s][voiceAgentReport][varset]\x20event:','addVariable','keys','variable','value','[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s','[%s][voiceAgentReport][varset]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','sipcallid','sipuri','bridgepeer','membercalls','memberdynamic','memberpenalty','memberrealtime','isNil','includes','transfer','[%s][voiceAgentReport][hangup]\x20destuniqueid:%s','[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:','values','[%s][voiceAgentReport][hangup]','[%s][voiceAgentReport][attendedtransfer]\x20event:','transfereeuniqueid','origtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','complete','diff','seconds','secondtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]','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]','exports','lodash','util','ioredis','../../../config/environment','../../../config/logger','ami','../ami','redis','socket.io-emitter','channels','voiceQueues','agents','variables','agentcalled','syncAgentCalled','bind','agentconnect','syncAgentConnect','syncAgentRingNoAnswer','queuecallerabandon','agentcomplete','syncAgentComplete','varset','syncHangup','musiconholdstart','syncMusicOnHoldStart','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','prototype','emit','isNotNull'];(function(_0x104297,_0x45200f){var _0x194246=function(_0x4ddc2d){while(--_0x4ddc2d){_0x104297['push'](_0x104297['shift']());}};_0x194246(++_0x45200f);}(_0xaed2,0x10d));var _0x2aed=function(_0x4e0471,_0x55a1ca){_0x4e0471=_0x4e0471-0x0;var _0x5d3b2c=_0xaed2[_0x4e0471];return _0x5d3b2c;};'use strict';var _=require(_0x2aed('0x0'));var moment=require('moment');var util=require(_0x2aed('0x1'));var Redis=require(_0x2aed('0x2'));var config=require(_0x2aed('0x3'));var logger=require(_0x2aed('0x4'))(_0x2aed('0x5'));var ami=require(_0x2aed('0x6'));config[_0x2aed('0x7')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x2aed('0x8'))(new Redis(config['redis']));function VoiceAgentReport(_0x4f13c2){this[_0x2aed('0x9')]={};this[_0x2aed('0xa')]=_0x4f13c2[_0x2aed('0xa')];this[_0x2aed('0xb')]=_0x4f13c2[_0x2aed('0xb')];this[_0x2aed('0xc')]={};ami['on'](_0x2aed('0xd'),this[_0x2aed('0xe')][_0x2aed('0xf')](this));ami['on'](_0x2aed('0x10'),this[_0x2aed('0x11')][_0x2aed('0xf')](this));ami['on']('agentringnoanswer',this[_0x2aed('0x12')][_0x2aed('0xf')](this));ami['on'](_0x2aed('0x13'),this['syncQueueCallerAbandon']['bind'](this));ami['on'](_0x2aed('0x14'),this[_0x2aed('0x15')][_0x2aed('0xf')](this));ami['on'](_0x2aed('0x16'),this['syncVarSet']['bind'](this));ami['on']('hangup',this[_0x2aed('0x17')]['bind'](this));ami['on'](_0x2aed('0x18'),this[_0x2aed('0x19')][_0x2aed('0xf')](this));ami['on']('musiconholdstop',this[_0x2aed('0x1a')][_0x2aed('0xf')](this));ami['on'](_0x2aed('0x1b'),this[_0x2aed('0x1c')][_0x2aed('0xf')](this));ami['on']('blindtransfer',this[_0x2aed('0x1d')][_0x2aed('0xf')](this));}VoiceAgentReport[_0x2aed('0x1e')][_0x2aed('0x1f')]=function(_0x4778b7,_0xda8e83,_0x361b11){io['to'](_0x4778b7)[_0x2aed('0x1f')](_0xda8e83,_0x361b11);};VoiceAgentReport[_0x2aed('0x1e')][_0x2aed('0x20')]=function(_0x1f5322){return _0x1f5322!==null&&!_[_0x2aed('0x21')](_0x1f5322);};VoiceAgentReport[_0x2aed('0x1e')][_0x2aed('0xe')]=function(_0x1be5c8){try{if(this[_0x2aed('0x20')](_0x1be5c8)){logger[_0x2aed('0x22')](_0x2aed('0x23'),_0x1be5c8[_0x2aed('0x24')],_0x1be5c8[_0x2aed('0x25')],_0x1be5c8[_0x2aed('0x26')]);logger['debug'](_0x2aed('0x27'),_0x1be5c8[_0x2aed('0x24')],util[_0x2aed('0x28')](_0x1be5c8,{'showHidden':![],'depth':null}));if(_[_0x2aed('0x21')](this[_0x2aed('0x9')][_0x1be5c8['uniqueid']])){this['channels'][_0x1be5c8[_0x2aed('0x24')]]={};}if(_[_0x2aed('0x21')](this[_0x2aed('0x9')][_0x1be5c8[_0x2aed('0x24')]][_0x1be5c8[_0x2aed('0x26')]])){this[_0x2aed('0x9')][_0x1be5c8[_0x2aed('0x24')]][_0x1be5c8[_0x2aed('0x26')]]={'agentcalledAt':moment()[_0x2aed('0x29')](_0x2aed('0x2a')),'lastevent':_0x2aed('0x2b'),'mandatoryDisposition':this[_0x2aed('0xa')][_0x1be5c8['queue']]?this['voiceQueues'][_0x1be5c8[_0x2aed('0x2c')]]['mandatoryDisposition']||![]:![],'type':this[_0x2aed('0xa')][_0x1be5c8[_0x2aed('0x2c')]]?this['voiceQueues'][_0x1be5c8['queue']][_0x2aed('0x2d')]||'inbound':_0x2aed('0x2e'),'variables':this['variables'][_0x1be5c8[_0x2aed('0x24')]]};}_[_0x2aed('0x2f')](this[_0x2aed('0x9')][_0x1be5c8[_0x2aed('0x24')]][_0x1be5c8[_0x2aed('0x26')]],_[_0x2aed('0x30')](_0x1be5c8,[_0x2aed('0x31'),_0x2aed('0x32')]));logger[_0x2aed('0x33')](_0x2aed('0x34'),_0x1be5c8[_0x2aed('0x24')],util['inspect'](this[_0x2aed('0x9')][_0x1be5c8[_0x2aed('0x24')]][_0x1be5c8[_0x2aed('0x26')]],{'showHidden':![],'depth':null}));ami[_0x2aed('0x1f')](_0x2aed('0x35'),this[_0x2aed('0x9')][_0x1be5c8['uniqueid']][_0x1be5c8[_0x2aed('0x26')]]);logger[_0x2aed('0x33')]('[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:',_0x1be5c8['uniqueid'],util[_0x2aed('0x28')](this['channels'][_0x1be5c8['uniqueid']][_0x1be5c8['destuniqueid']],{'showHidden':![],'depth':null}));this[_0x2aed('0x1f')](util[_0x2aed('0x29')](_0x2aed('0x36'),_0x1be5c8[_0x2aed('0x25')]),_0x2aed('0x37'),this[_0x2aed('0x9')][_0x1be5c8[_0x2aed('0x24')]][_0x1be5c8[_0x2aed('0x26')]]);}}catch(_0x401739){logger[_0x2aed('0x38')]('[%s][voiceAgentReport][agentcalled]',_0x1be5c8[_0x2aed('0x24')],util[_0x2aed('0x28')](_0x401739,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x2aed('0x1e')]['syncAgentConnect']=function(_0x2ba2eb){try{if(this['isNotNull'](_0x2ba2eb)){if(this[_0x2aed('0x9')][_0x2ba2eb[_0x2aed('0x24')]]){logger[_0x2aed('0x33')](_0x2aed('0x39'),_0x2ba2eb['uniqueid'],util[_0x2aed('0x28')](_0x2ba2eb,{'showHidden':![],'depth':null}));for(var _0x108a61 in this['channels'][_0x2ba2eb[_0x2aed('0x24')]]){if(this[_0x2aed('0x9')][_0x2ba2eb[_0x2aed('0x24')]]['hasOwnProperty'](_0x108a61)){if(_0x2ba2eb['destuniqueid']===_0x108a61){logger['info']('[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect',_0x2ba2eb[_0x2aed('0x24')],_0x2ba2eb[_0x2aed('0x25')],_0x2ba2eb['destuniqueid']);this[_0x2aed('0x9')][_0x2ba2eb[_0x2aed('0x24')]][_0x108a61][_0x2aed('0x3a')]=moment()['format'](_0x2aed('0x2a'));this['channels'][_0x2ba2eb['uniqueid']][_0x108a61]['connectedlinename']=_0x2ba2eb[_0x2aed('0x3b')];this[_0x2aed('0x9')][_0x2ba2eb['uniqueid']][_0x108a61][_0x2aed('0x3c')]=_0x2ba2eb[_0x2aed('0x3c')];this['channels'][_0x2ba2eb[_0x2aed('0x24')]][_0x108a61][_0x2aed('0x3d')]=_0x2ba2eb[_0x2aed('0x3d')];this[_0x2aed('0x9')][_0x2ba2eb[_0x2aed('0x24')]][_0x108a61][_0x2aed('0x3e')]=_0x2ba2eb[_0x2aed('0x3e')];this[_0x2aed('0x9')][_0x2ba2eb[_0x2aed('0x24')]][_0x108a61][_0x2aed('0x3f')]=_0x2ba2eb[_0x2aed('0x3f')];this[_0x2aed('0x9')][_0x2ba2eb[_0x2aed('0x24')]][_0x108a61]['lastevent']=_0x2aed('0x40');_[_0x2aed('0x2f')](this[_0x2aed('0xb')][_0x2ba2eb[_0x2aed('0x41')]],_[_0x2aed('0x42')](_0x2ba2eb,[_0x2aed('0x2c'),_0x2aed('0x43')]));logger['debug']('[%s][voiceAgentReport][agentconnect]\x20sending\x20agentconnect\x20event:',_0x2ba2eb['uniqueid'],util[_0x2aed('0x28')](this['channels'][_0x2ba2eb[_0x2aed('0x24')]][_0x2ba2eb['destuniqueid']],{'showHidden':![],'depth':null}));ami[_0x2aed('0x1f')](_0x2aed('0x44'),this[_0x2aed('0x9')][_0x2ba2eb[_0x2aed('0x24')]][_0x2ba2eb[_0x2aed('0x26')]]);logger[_0x2aed('0x33')](_0x2aed('0x45'),_0x2ba2eb[_0x2aed('0x24')],util['inspect'](this['channels'][_0x2ba2eb['uniqueid']][_0x2ba2eb[_0x2aed('0x26')]],{'showHidden':![],'depth':null}));this[_0x2aed('0x1f')](util[_0x2aed('0x29')](_0x2aed('0x36'),_0x2ba2eb[_0x2aed('0x25')]),_0x2aed('0x46'),this[_0x2aed('0x9')][_0x2ba2eb['uniqueid']][_0x2ba2eb[_0x2aed('0x26')]]);}else if(!this[_0x2aed('0x9')][_0x2ba2eb['uniqueid']][_0x108a61]['agentringnoanswer']&&!this[_0x2aed('0x9')][_0x2ba2eb[_0x2aed('0x24')]][_0x108a61][_0x2aed('0x14')]){logger[_0x2aed('0x22')]('[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere',_0x2ba2eb['uniqueid'],this['channels'][_0x2ba2eb[_0x2aed('0x24')]][_0x108a61][_0x2aed('0x25')],_0x108a61);this['channels'][_0x2ba2eb[_0x2aed('0x24')]][_0x108a61][_0x2aed('0x47')]=!![];this[_0x2aed('0x9')][_0x2ba2eb[_0x2aed('0x24')]][_0x108a61][_0x2aed('0x48')]=moment()[_0x2aed('0x29')](_0x2aed('0x2a'));this['channels'][_0x2ba2eb[_0x2aed('0x24')]][_0x108a61][_0x2aed('0x49')]=_0x2ba2eb[_0x2aed('0x26')];this[_0x2aed('0x9')][_0x2ba2eb[_0x2aed('0x24')]][_0x108a61][_0x2aed('0x4a')]=_0x2ba2eb[_0x2aed('0x25')];this[_0x2aed('0x9')][_0x2ba2eb[_0x2aed('0x24')]][_0x108a61][_0x2aed('0x4b')]=_0x2aed('0x4c');this[_0x2aed('0x9')][_0x2ba2eb[_0x2aed('0x24')]][_0x108a61][_0x2aed('0x4d')]=_0x2aed('0x4c');logger[_0x2aed('0x33')]('[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:',_0x2ba2eb[_0x2aed('0x24')],util['inspect'](this['channels'][_0x2ba2eb[_0x2aed('0x24')]][_0x108a61],{'showHidden':![],'depth':null}));ami[_0x2aed('0x1f')]('custom:agentansweredelsewhere',this[_0x2aed('0x9')][_0x2ba2eb['uniqueid']][_0x108a61]);}}}}}}catch(_0x41026f){logger[_0x2aed('0x38')](_0x2aed('0x4e'),_0x2ba2eb[_0x2aed('0x24')],util['inspect'](_0x41026f,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x2aed('0x1e')][_0x2aed('0x12')]=function(_0x39f726){try{if(this[_0x2aed('0x20')](_0x39f726)){logger[_0x2aed('0x33')](_0x2aed('0x4f'),_0x39f726[_0x2aed('0x24')],util[_0x2aed('0x28')](_0x39f726,{'showHidden':![],'depth':null}));if(this[_0x2aed('0x9')][_0x39f726['uniqueid']]&&this[_0x2aed('0x9')][_0x39f726['uniqueid']][_0x39f726[_0x2aed('0x26')]]){logger[_0x2aed('0x22')](_0x2aed('0x50'),_0x39f726['uniqueid'],_0x39f726[_0x2aed('0x25')],_0x39f726['destuniqueid']);this[_0x2aed('0x9')][_0x39f726['uniqueid']][_0x39f726[_0x2aed('0x26')]]['agentringnoanswer']=!![];this[_0x2aed('0x9')][_0x39f726[_0x2aed('0x24')]][_0x39f726['destuniqueid']][_0x2aed('0x48')]=moment()[_0x2aed('0x29')]('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x39f726[_0x2aed('0x24')]][_0x39f726[_0x2aed('0x26')]][_0x2aed('0x4b')]='rejected';this[_0x2aed('0x9')][_0x39f726[_0x2aed('0x24')]][_0x39f726[_0x2aed('0x26')]][_0x2aed('0x4d')]='rejected';logger[_0x2aed('0x33')](_0x2aed('0x51'),_0x39f726[_0x2aed('0x24')],util[_0x2aed('0x28')](this[_0x2aed('0x9')][_0x39f726['uniqueid']][_0x39f726[_0x2aed('0x26')]],{'showHidden':![],'depth':null}));ami[_0x2aed('0x1f')](_0x2aed('0x52'),this[_0x2aed('0x9')][_0x39f726['uniqueid']][_0x39f726[_0x2aed('0x26')]]);}}}catch(_0xe4422c){logger['error']('[%s][voiceAgentReport][agentringnoanswer]',_0x39f726['uniqueid'],util[_0x2aed('0x28')](_0xe4422c,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x2aed('0x1e')][_0x2aed('0x53')]=function(_0x27fd13){try{if(this[_0x2aed('0x20')](_0x27fd13)){logger[_0x2aed('0x33')]('[%s][voiceAgentReport][queuecallerabandon]\x20event:',_0x27fd13[_0x2aed('0x24')],util[_0x2aed('0x28')](_0x27fd13,{'showHidden':![],'depth':null}));if(this['channels'][_0x27fd13[_0x2aed('0x24')]]){for(var _0x2ad326 in this[_0x2aed('0x9')][_0x27fd13[_0x2aed('0x24')]]){if(this['channels'][_0x27fd13[_0x2aed('0x24')]][_0x2aed('0x54')](_0x2ad326)&&!this['channels'][_0x27fd13[_0x2aed('0x24')]][_0x2ad326][_0x2aed('0x47')]&&!this[_0x2aed('0x9')][_0x27fd13[_0x2aed('0x24')]][_0x2ad326][_0x2aed('0x14')]){logger['info'](_0x2aed('0x55'),_0x27fd13[_0x2aed('0x24')],this[_0x2aed('0x9')][_0x27fd13[_0x2aed('0x24')]][_0x2ad326][_0x2aed('0x25')],_0x2ad326);this[_0x2aed('0x9')][_0x27fd13[_0x2aed('0x24')]][_0x2ad326][_0x2aed('0x47')]=!![];this[_0x2aed('0x9')][_0x27fd13[_0x2aed('0x24')]][_0x2ad326][_0x2aed('0x48')]=moment()[_0x2aed('0x29')](_0x2aed('0x2a'));this[_0x2aed('0x9')][_0x27fd13[_0x2aed('0x24')]][_0x2ad326][_0x2aed('0x4b')]=_0x2aed('0x56');this['channels'][_0x27fd13[_0x2aed('0x24')]][_0x2ad326][_0x2aed('0x4d')]='abandoned';logger[_0x2aed('0x33')](_0x2aed('0x57'),_0x27fd13[_0x2aed('0x24')],util[_0x2aed('0x28')](this[_0x2aed('0x9')][_0x27fd13[_0x2aed('0x24')]][_0x2ad326],{'showHidden':![],'depth':null}));ami['emit'](_0x2aed('0x58'),this[_0x2aed('0x9')][_0x27fd13[_0x2aed('0x24')]][_0x2ad326]);}}}}}catch(_0x2aaf3d){logger[_0x2aed('0x38')](_0x2aed('0x59'),_0x27fd13[_0x2aed('0x24')],util[_0x2aed('0x28')](_0x2aaf3d,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x2aed('0x1e')]['syncAgentComplete']=function(_0x4b377b){try{if(this[_0x2aed('0x20')](_0x4b377b)){logger[_0x2aed('0x33')](_0x2aed('0x5a'),_0x4b377b[_0x2aed('0x24')],util['inspect'](_0x4b377b,{'showHidden':![],'depth':null}));if(this[_0x2aed('0x9')][_0x4b377b[_0x2aed('0x24')]]){for(var _0x2e54bc in this['channels'][_0x4b377b[_0x2aed('0x24')]]){if(this[_0x2aed('0x9')][_0x4b377b[_0x2aed('0x24')]][_0x2aed('0x54')](_0x2e54bc)){if(this[_0x2aed('0x9')][_0x4b377b[_0x2aed('0x24')]][_0x2e54bc][_0x2aed('0x3a')]&&!this['channels'][_0x4b377b[_0x2aed('0x24')]][_0x2e54bc][_0x2aed('0x14')]){logger[_0x2aed('0x22')](_0x2aed('0x5b'),_0x4b377b[_0x2aed('0x24')],this[_0x2aed('0x9')][_0x4b377b[_0x2aed('0x24')]][_0x2e54bc][_0x2aed('0x25')],_0x2e54bc);this[_0x2aed('0x9')][_0x4b377b[_0x2aed('0x24')]][_0x2e54bc][_0x2aed('0x14')]=!![];this['channels'][_0x4b377b[_0x2aed('0x24')]][_0x2e54bc]['agentcompleteAt']=moment()['format'](_0x2aed('0x2a'));this['channels'][_0x4b377b[_0x2aed('0x24')]][_0x2e54bc][_0x2aed('0x4b')]='complete';this[_0x2aed('0x9')][_0x4b377b['uniqueid']][_0x2e54bc][_0x2aed('0x4d')]=_0x4b377b['reason']=='transfer'?_0x2aed('0x5c'):_0x4b377b[_0x2aed('0x4d')];this[_0x2aed('0x9')][_0x4b377b[_0x2aed('0x24')]][_0x2e54bc][_0x2aed('0x5d')]=_0x4b377b['talktime'];if(this['voiceQueues'][_0x4b377b[_0x2aed('0x2c')]]&&this[_0x2aed('0xa')][_0x4b377b['queue']]['acw']){this[_0x2aed('0x9')][_0x4b377b[_0x2aed('0x24')]][_0x2e54bc][_0x2aed('0x5e')]=this[_0x2aed('0xa')][_0x4b377b[_0x2aed('0x2c')]][_0x2aed('0x5f')];this[_0x2aed('0x9')][_0x4b377b[_0x2aed('0x24')]][_0x2e54bc][_0x2aed('0x60')]=!![];}this['agents'][_0x4b377b[_0x2aed('0x41')]]=_[_0x2aed('0x30')](this[_0x2aed('0xb')][_0x4b377b[_0x2aed('0x41')]],[_0x2aed('0x2c'),_0x2aed('0x43')]);logger['debug'](_0x2aed('0x61'),_0x4b377b[_0x2aed('0x24')],util['inspect'](this[_0x2aed('0x9')][_0x4b377b[_0x2aed('0x24')]][_0x2e54bc],{'showHidden':![],'depth':null}));ami[_0x2aed('0x1f')](_0x2aed('0x62'),this[_0x2aed('0x9')][_0x4b377b['uniqueid']][_0x2e54bc]);logger[_0x2aed('0x33')]('[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:',_0x4b377b[_0x2aed('0x24')],util['inspect'](this['channels'][_0x4b377b[_0x2aed('0x24')]][_0x2e54bc],{'showHidden':![],'depth':null}));this[_0x2aed('0x1f')](util[_0x2aed('0x29')](_0x2aed('0x36'),_0x4b377b[_0x2aed('0x25')]),_0x2aed('0x63'),this[_0x2aed('0x9')][_0x4b377b[_0x2aed('0x24')]][_0x2e54bc]);}}}}}}catch(_0x401a23){logger[_0x2aed('0x38')](_0x2aed('0x64'),_0x4b377b[_0x2aed('0x24')],util[_0x2aed('0x28')](_0x401a23,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x2aed('0x1e')][_0x2aed('0x65')]=function(_0x479617){try{if(this[_0x2aed('0x20')](_0x479617)){logger[_0x2aed('0x33')](_0x2aed('0x66'),_0x479617[_0x2aed('0x24')],util[_0x2aed('0x28')](_0x479617,{'showHidden':![],'depth':null}));this[_0x2aed('0x67')](_0x479617['uniqueid'],_[_0x2aed('0x68')](_0x479617[_0x2aed('0x69')])[0x0],_0x479617[_0x2aed('0x6a')]);if(this[_0x2aed('0x9')][_0x479617[_0x2aed('0x24')]]){for(var _0x7ed65a in this[_0x2aed('0x9')][_0x479617[_0x2aed('0x24')]]){if(this[_0x2aed('0x9')][_0x479617[_0x2aed('0x24')]]['hasOwnProperty'](_0x7ed65a)){logger[_0x2aed('0x22')](_0x2aed('0x6b'),_0x479617[_0x2aed('0x24')],_0x7ed65a,_['keys'](_0x479617[_0x2aed('0x69')])[0x0],_0x479617['value']);if(_[_0x2aed('0x21')](this[_0x2aed('0x9')][_0x479617[_0x2aed('0x24')]][_0x7ed65a][_0x2aed('0xc')])){this['channels'][_0x479617[_0x2aed('0x24')]][_0x7ed65a][_0x2aed('0xc')]={};}this[_0x2aed('0x9')][_0x479617[_0x2aed('0x24')]][_0x7ed65a][_0x2aed('0xc')]=this[_0x2aed('0xc')][_0x479617['uniqueid']];}}}}}catch(_0x404e34){logger[_0x2aed('0x38')](_0x2aed('0x6c'),_0x479617[_0x2aed('0x24')],util['inspect'](_0x404e34,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x2aed('0x1e')][_0x2aed('0x67')]=function(_0x37265c,_0x506a85,_0x103fc8){var _0x21833b=[_0x2aed('0x6d'),_0x2aed('0x6e'),_0x2aed('0x6f'),_0x2aed('0x70'),_0x2aed('0x71'),_0x2aed('0x72'),_0x2aed('0x73'),'rtpaudioqosrttbridged',_0x2aed('0x74'),_0x2aed('0x75'),_0x2aed('0x76'),'bridgepvtcallid',_0x2aed('0x77'),_0x2aed('0x78'),'memberinterface','memberlastcall',_0x2aed('0x25'),_0x2aed('0x79'),_0x2aed('0x7a')];if(!_[_0x2aed('0x7b')](_0x506a85)&&!_[_0x2aed('0x7c')](_0x21833b,_0x506a85)){if(_['isUndefined'](this['variables'][_0x37265c])){this[_0x2aed('0xc')][_0x37265c]={};}this[_0x2aed('0xc')][_0x37265c][_0x506a85]=_0x103fc8;}};VoiceAgentReport[_0x2aed('0x1e')][_0x2aed('0x17')]=function(_0x5a0947){try{if(this[_0x2aed('0x20')](_0x5a0947)){logger[_0x2aed('0x33')]('[%s][voiceAgentReport][hangup]\x20event:',_0x5a0947['uniqueid'],util[_0x2aed('0x28')](_0x5a0947,{'showHidden':![],'depth':null}));if(this[_0x2aed('0x9')][_0x5a0947[_0x2aed('0x24')]]){for(var _0x1b1772 in this[_0x2aed('0x9')][_0x5a0947[_0x2aed('0x24')]]){if(this[_0x2aed('0x9')][_0x5a0947[_0x2aed('0x24')]][_0x2aed('0x54')](_0x1b1772)){if(this[_0x2aed('0x9')][_0x5a0947[_0x2aed('0x24')]][_0x1b1772][_0x2aed('0x4d')]==_0x2aed('0x7d')&&this[_0x2aed('0x9')][_0x5a0947[_0x2aed('0x24')]][_0x1b1772][_0x2aed('0x14')]){logger[_0x2aed('0x22')](_0x2aed('0x7e'),_0x5a0947[_0x2aed('0x24')],_0x1b1772);this[_0x2aed('0x9')][_0x5a0947[_0x2aed('0x24')]][_0x1b1772]['agentcompleteAt']=moment()[_0x2aed('0x29')](_0x2aed('0x2a'));}}}logger[_0x2aed('0x33')](_0x2aed('0x7f'),_0x5a0947['uniqueid'],util['inspect'](_['values'](this[_0x2aed('0x9')][_0x5a0947['uniqueid']]),{'showHidden':![],'depth':null}));ami[_0x2aed('0x1f')]('custom:voiceAgentReport',_[_0x2aed('0x80')](this[_0x2aed('0x9')][_0x5a0947['uniqueid']]));delete this['channels'][_0x5a0947[_0x2aed('0x24')]];}if(this[_0x2aed('0xc')][_0x5a0947[_0x2aed('0x24')]]){delete this[_0x2aed('0xc')][_0x5a0947[_0x2aed('0x24')]];}}}catch(_0x5743ed){logger[_0x2aed('0x38')](_0x2aed('0x81'),_0x5a0947[_0x2aed('0x24')],util[_0x2aed('0x28')](_0x5743ed,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x2aed('0x1c')]=function(_0x98acc2){try{if(this[_0x2aed('0x20')](_0x98acc2)){logger[_0x2aed('0x33')](_0x2aed('0x82'),_0x98acc2[_0x2aed('0x24')],util[_0x2aed('0x28')](_0x98acc2,{'showHidden':![],'depth':null}));if(this[_0x2aed('0x9')][_0x98acc2[_0x2aed('0x83')]]){for(var _0x4d2b25 in this['channels'][_0x98acc2['transfereeuniqueid']]){if(this[_0x2aed('0x9')][_0x98acc2[_0x2aed('0x83')]][_0x2aed('0x54')](_0x4d2b25)){if(_0x98acc2[_0x2aed('0x84')]===_0x4d2b25){logger[_0x2aed('0x22')](_0x2aed('0x85'),_0x98acc2[_0x2aed('0x24')],this[_0x2aed('0x9')][_0x98acc2[_0x2aed('0x83')]][_0x4d2b25][_0x2aed('0x25')],_0x4d2b25);var _0x42e9e8=moment();this[_0x2aed('0x9')][_0x98acc2[_0x2aed('0x83')]][_0x4d2b25][_0x2aed('0x14')]=!![];this['channels'][_0x98acc2[_0x2aed('0x83')]][_0x4d2b25][_0x2aed('0x86')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x2aed('0x9')][_0x98acc2[_0x2aed('0x83')]][_0x4d2b25][_0x2aed('0x4b')]=_0x2aed('0x87');this[_0x2aed('0x9')][_0x98acc2['transfereeuniqueid']][_0x4d2b25][_0x2aed('0x4d')]=_0x2aed('0x7d');this['channels'][_0x98acc2[_0x2aed('0x83')]][_0x4d2b25]['talktime']=_0x42e9e8[_0x2aed('0x88')](this['channels'][_0x98acc2[_0x2aed('0x83')]][_0x4d2b25][_0x2aed('0x3a')],_0x2aed('0x89'));}}}}if(this[_0x2aed('0x9')][_0x98acc2['secondtransfereruniqueid']]){var _0x2198f1=this[_0x2aed('0x9')][_0x98acc2[_0x2aed('0x8a')]];this[_0x2aed('0x9')][_0x98acc2[_0x2aed('0x8a')]]=this[_0x2aed('0x9')][_0x98acc2[_0x2aed('0x83')]];this[_0x2aed('0x9')][_0x98acc2[_0x2aed('0x83')]]=_0x2198f1;}}}catch(_0x2e1196){logger[_0x2aed('0x38')](_0x2aed('0x8b'),_0x98acc2[_0x2aed('0x24')],util[_0x2aed('0x28')](_0x2e1196,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x2aed('0x1e')]['syncBlindTransfer']=function(_0x1f8241){try{if(this['isNotNull'](_0x1f8241)){logger[_0x2aed('0x33')]('[%s][voiceAgentReport][blindtransfer]\x20event:',_0x1f8241[_0x2aed('0x24')],util[_0x2aed('0x28')](_0x1f8241,{'showHidden':![],'depth':null}));if(this[_0x2aed('0x9')][_0x1f8241[_0x2aed('0x83')]]){for(var _0x271f4b in this[_0x2aed('0x9')][_0x1f8241[_0x2aed('0x83')]]){if(this[_0x2aed('0x9')][_0x1f8241[_0x2aed('0x83')]][_0x2aed('0x54')](_0x271f4b)){if(_0x1f8241[_0x2aed('0x8c')]===_0x271f4b){logger[_0x2aed('0x22')](_0x2aed('0x8d'),_0x1f8241[_0x2aed('0x24')],this[_0x2aed('0x9')][_0x1f8241[_0x2aed('0x83')]][_0x271f4b][_0x2aed('0x25')],_0x271f4b);var _0x803153=moment();this['channels'][_0x1f8241[_0x2aed('0x83')]][_0x271f4b][_0x2aed('0x14')]=!![];this[_0x2aed('0x9')][_0x1f8241[_0x2aed('0x83')]][_0x271f4b][_0x2aed('0x86')]=_0x803153;this[_0x2aed('0x9')][_0x1f8241[_0x2aed('0x83')]][_0x271f4b][_0x2aed('0x4b')]='complete';this[_0x2aed('0x9')][_0x1f8241[_0x2aed('0x83')]][_0x271f4b][_0x2aed('0x4d')]='transfer';this[_0x2aed('0x9')][_0x1f8241['transfereeuniqueid']][_0x271f4b][_0x2aed('0x5d')]=_0x803153[_0x2aed('0x88')](this[_0x2aed('0x9')][_0x1f8241[_0x2aed('0x83')]][_0x271f4b]['agentconnectAt'],_0x2aed('0x89'));}}}}}}catch(_0x122645){logger[_0x2aed('0x38')](_0x2aed('0x8e'),_0x1f8241[_0x2aed('0x24')],util[_0x2aed('0x28')](_0x122645,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x2aed('0x1e')]['syncMusicOnHoldStart']=function(_0x1abf24){var _0x5c44b5='';try{if(this[_0x2aed('0x20')](_0x1abf24)){logger[_0x2aed('0x33')]('[%s][voiceAgentReport][musiconholdstart]\x20event:',_0x1abf24[_0x2aed('0x24')],util['inspect'](_0x1abf24,{'showHidden':![],'depth':null}));if(_0x1abf24[_0x2aed('0x8f')]){_0x5c44b5=_0x1abf24[_0x2aed('0x8f')][_0x2aed('0x90')](0x0,_0x1abf24[_0x2aed('0x8f')][_0x2aed('0x91')]('-'));if(this['agents'][_0x5c44b5]){logger[_0x2aed('0x22')](_0x2aed('0x92'),_0x1abf24[_0x2aed('0x24')],_0x5c44b5);this[_0x2aed('0xb')][_0x5c44b5][_0x2aed('0x93')]=!![];}}}}catch(_0x667bce){logger[_0x2aed('0x38')](_0x2aed('0x94'),_0x1abf24[_0x2aed('0x24')],util[_0x2aed('0x28')](_0x667bce,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x2aed('0x1e')][_0x2aed('0x1a')]=function(_0x50bc14){var _0x5981a1='';try{if(this['isNotNull'](_0x50bc14)){logger[_0x2aed('0x33')]('[%s][voiceAgentReport][musiconholdstop]\x20event:',_0x50bc14['uniqueid'],util[_0x2aed('0x28')](_0x50bc14,{'showHidden':![],'depth':null}));if(_0x50bc14['channel']){_0x5981a1=_0x50bc14[_0x2aed('0x8f')][_0x2aed('0x90')](0x0,_0x50bc14[_0x2aed('0x8f')][_0x2aed('0x91')]('-'));if(this['agents'][_0x5981a1]){logger[_0x2aed('0x22')]('[%s][voiceAgentReport][musiconholdstop]\x20interface:%s',_0x50bc14['uniqueid'],_0x5981a1);this['agents'][_0x5981a1]['onhold']=![];}}}}catch(_0x183057){logger[_0x2aed('0x38')](_0x2aed('0x95'),_0x50bc14[_0x2aed('0x24')],util['inspect'](_0x183057,{'showHidden':![],'depth':null}));}};module[_0x2aed('0x96')]=VoiceAgentReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceCallReport.js b/server/services/ami/report/voiceCallReport.js index 12a3729..8b42fbd 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 _0x9957=['[voiceCallReport][coreshowchannels]','inspect','isNotNull','isUndefined','prototype','emit','calleridname','calleridnum','debug','[%s][voiceCallReport][newcallerid]\x20event:','uniqueid','merge','pick','syncNewChannel','[%s][voiceCallReport][newchannel]\x20event:','OutgoingSpoolFailed','info','[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s','context','format','YYYY-MM-DD\x20HH:mm:ss','disposition','toNumber','keys','from-sip','channel','split','destconnectedlinenum','exten','accountcode','user:%s','name','user:agentconnect','[%s][voiceCallReport][newexten]\x20event:','linkedid','application','applicationdata','appdata','toLowerCase','starttime','duration','seconds','includes','lastapplication','startsWith','cdr(','match','[%s][voiceCallReport][newexten]','syncNewState','channelstate','answered','answertime','diff','xcally-motion-preview','connectedlinenum','connectedlinename','UserId','membername','monitor','.wav49','replace','.WAV','monitorFilename','find','monitors','isNil','push','rec','[%s][voiceCallReport][mixMonitorFilename]','[%s][voiceCallReport][varset]\x20event:','variable','mixmonitor_filename','value','syncMixMonitorFilename','xmd-phone','[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s','[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s','callerid','xmd-cdrtype','[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s','xmd-queue','[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s','xmd-originatecalleridnum','[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s','destination','[%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','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','syncHangup','[%s][voiceCallReport][hangup]\x20event:','[%s][voiceCallReport][hangup]\x20reason:%s','billableseconds','holdtime','omit','[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','resolve','transferType','getSettings','then','Action','StopMixMonitor','destinationchannel','catch','finally','webbar:stopmonitors','event','BlindTransfer','type','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','custom:voiceCallReport','[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','origtransferercalleridnum','transfertargetcalleridnum','[%s][voiceCallReport][attendedtransfer]\x20event:','transfereeuniqueid','transfercalleridnum','transferconnectedlinenum','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','some','origtransfererlinkedid','outbound','routeid','ATTENDED','[%s][voiceCallReport][attendedtransfer]','[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','transfereecalleridnum','extension','BLIND','transfererchannel','transfereruniqueid','[%s][voiceCallReport][blindtransfer]','[%s][voiceCallReport][musiconholdstart]\x20event:','mohstarttime','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceCallReport][musiconholdstop]\x20event:','mohtime','milliseconds','[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s','exports','bluebird','lodash','moment','util','ioredis','../../../config/environment','../../../config/logger','ami','../model/channel','../rpc/setting','unknown','not_inuse','inuse','busy','unavailable','ringing','onhold','set','queue','agi','dial','playback','voicemail','FAILED','NO\x20ANSWER','ANSWERED','BUSY','redis','localhost','socket.io-emitter','channels','agents','blindTransfers','syncNewExten','bind','newexten','newchannel','newstate','varset','syncVarSet','hangup','newcallerid','syncNewCallerId','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','[voiceCallReport][coreshowchannels]\x20started','actionCoreShowChannels','error'];(function(_0x3654ad,_0x5c7cf7){var _0x862000=function(_0x3d96f8){while(--_0x3d96f8){_0x3654ad['push'](_0x3654ad['shift']());}};_0x862000(++_0x5c7cf7);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var BPromise=require(_0x7995('0x0'));var _=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var util=require(_0x7995('0x3'));var path=require('path');var Redis=require(_0x7995('0x4'));var config=require(_0x7995('0x5'));var logger=require(_0x7995('0x6'))(_0x7995('0x7'));var ami=require('../ami');var Channel=require(_0x7995('0x8'));var RpcSetting=require(_0x7995('0x9'));var statusDesc=[_0x7995('0xa'),_0x7995('0xb'),_0x7995('0xc'),_0x7995('0xd'),'invalid',_0x7995('0xe'),_0x7995('0xf'),'ringinuse',_0x7995('0x10')];var applications=[_0x7995('0x11'),_0x7995('0x12'),_0x7995('0x13'),_0x7995('0x14'),_0x7995('0x15'),_0x7995('0x16')];var dispositions=['NO\x20ANSWER',_0x7995('0x17'),_0x7995('0x17'),'NO\x20ANSWER',_0x7995('0x18'),_0x7995('0x18'),_0x7995('0x19'),_0x7995('0x1a'),_0x7995('0x17'),_0x7995('0x17'),_0x7995('0x17')];var actions={};config['redis']=_['defaults'](config[_0x7995('0x1b')],{'host':_0x7995('0x1c'),'port':0x18eb});var io=require(_0x7995('0x1d'))(new Redis(config[_0x7995('0x1b')]));function VoiceCallReport(_0x3f1d3e){this[_0x7995('0x1e')]=_0x3f1d3e[_0x7995('0x1e')];this[_0x7995('0x1f')]=_0x3f1d3e['agents'];this[_0x7995('0x20')]={};ami['on']('coreshowchannel',this[_0x7995('0x21')][_0x7995('0x22')](this));ami['on'](_0x7995('0x23'),this[_0x7995('0x21')][_0x7995('0x22')](this));ami['on'](_0x7995('0x24'),this['syncNewChannel']['bind'](this));ami['on'](_0x7995('0x25'),this['syncNewState']['bind'](this));ami['on'](_0x7995('0x26'),this[_0x7995('0x27')]['bind'](this));ami['on'](_0x7995('0x28'),this['syncHangup']['bind'](this));ami['on'](_0x7995('0x29'),this[_0x7995('0x2a')][_0x7995('0x22')](this));ami['on'](_0x7995('0x2b'),this[_0x7995('0x2c')][_0x7995('0x22')](this));ami['on']('blindtransfer',this[_0x7995('0x2d')][_0x7995('0x22')](this));ami['on'](_0x7995('0x2e'),this[_0x7995('0x2f')][_0x7995('0x22')](this));ami['on'](_0x7995('0x30'),this[_0x7995('0x31')][_0x7995('0x22')](this));try{logger['info'](_0x7995('0x32'));ami[_0x7995('0x33')]();}catch(_0x401dc3){logger[_0x7995('0x34')](_0x7995('0x35'),util[_0x7995('0x36')](_0x401dc3,{'showHidden':![],'depth':null}));}}VoiceCallReport['prototype'][_0x7995('0x37')]=function(_0x5911c3){return _0x5911c3!==null&&!_[_0x7995('0x38')](_0x5911c3);};VoiceCallReport[_0x7995('0x39')][_0x7995('0x3a')]=function(_0x132a42,_0x11c1eb,_0x4b6f99){io['to'](_0x132a42)[_0x7995('0x3a')](_0x11c1eb,_0x4b6f99);};VoiceCallReport['prototype'][_0x7995('0x2a')]=function(_0x3250e0){try{if(this[_0x7995('0x37')](_0x3250e0)){logger['info']('[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s',_0x3250e0['uniqueid'],_0x3250e0[_0x7995('0x3b')],_0x3250e0[_0x7995('0x3c')]);logger[_0x7995('0x3d')](_0x7995('0x3e'),_0x3250e0[_0x7995('0x3f')],util[_0x7995('0x36')](_0x3250e0,{'showHidden':![],'depth':null}));if(_0x3250e0['uniqueid']===_0x3250e0['linkedid']){if(!_[_0x7995('0x38')](this['channels'][_0x3250e0[_0x7995('0x3f')]])){_[_0x7995('0x40')](this[_0x7995('0x1e')][_0x3250e0[_0x7995('0x3f')]],_[_0x7995('0x41')](_0x3250e0,_['keys'](this[_0x7995('0x1e')][_0x3250e0[_0x7995('0x3f')]])));}}}}catch(_0x5dd802){logger['error']('[%s][voiceCallReport][newcallerid]',_0x3250e0[_0x7995('0x3f')],util[_0x7995('0x36')](_0x5dd802,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x7995('0x42')]=function(_0x51b95d){try{if(this[_0x7995('0x37')](_0x51b95d)){logger[_0x7995('0x3d')](_0x7995('0x43'),_0x51b95d['uniqueid'],util['inspect'](_0x51b95d,{'showHidden':![],'depth':null}));if(_0x51b95d[_0x7995('0x3f')]===_0x51b95d['linkedid']&&_0x51b95d['channel']!=_0x7995('0x44')){if(_[_0x7995('0x38')](this['channels'][_0x51b95d[_0x7995('0x3f')]])){logger[_0x7995('0x45')](_0x7995('0x46'),_0x51b95d[_0x7995('0x3f')],_0x51b95d[_0x7995('0x47')],_0x51b95d['exten']);this[_0x7995('0x1e')][_0x51b95d[_0x7995('0x3f')]]=new Channel();this[_0x7995('0x1e')][_0x51b95d[_0x7995('0x3f')]]['starttime']=moment()[_0x7995('0x48')](_0x7995('0x49'));this[_0x7995('0x1e')][_0x51b95d[_0x7995('0x3f')]][_0x7995('0x4a')]=dispositions[_[_0x7995('0x4b')](_0x51b95d['channelstate'])];_[_0x7995('0x40')](this[_0x7995('0x1e')][_0x51b95d[_0x7995('0x3f')]],_[_0x7995('0x41')](_0x51b95d,_[_0x7995('0x4c')](this[_0x7995('0x1e')][_0x51b95d[_0x7995('0x3f')]])));if(_0x51b95d[_0x7995('0x47')]===_0x7995('0x4d')){if(this[_0x7995('0x1f')][_0x51b95d[_0x7995('0x4e')][_0x7995('0x4f')]('-')[0x0]]){this[_0x7995('0x1f')][_0x51b95d['channel']['split']('-')[0x0]][_0x7995('0x50')]=_0x51b95d[_0x7995('0x51')];logger['debug']('[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:',_0x51b95d[_0x7995('0x3f')],util['inspect']({'destaccountcode':this['agents'][_0x51b95d[_0x7995('0x4e')][_0x7995('0x4f')]('-')[0x0]][_0x7995('0x52')],'destconnectedlinenum':_0x51b95d['exten']},{'showHidden':![],'depth':null}));this[_0x7995('0x3a')](util['format'](_0x7995('0x53'),this['agents'][_0x51b95d['channel'][_0x7995('0x4f')]('-')[0x0]][_0x7995('0x54')]),_0x7995('0x55'),{'destaccountcode':this[_0x7995('0x1f')][_0x51b95d['channel'][_0x7995('0x4f')]('-')[0x0]][_0x7995('0x52')],'destconnectedlinenum':_0x51b95d[_0x7995('0x51')]});}}}}}}catch(_0x6c7bec){logger['error']('[%s][voiceCallReport][newchannel]',_0x51b95d[_0x7995('0x3f')],util['inspect'](_0x6c7bec,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x7995('0x39')]['syncNewExten']=function(_0x2f435e){try{if(this['isNotNull'](_0x2f435e)){logger[_0x7995('0x3d')](_0x7995('0x56'),_0x2f435e['uniqueid'],util[_0x7995('0x36')](_0x2f435e,{'showHidden':![],'depth':null}));if(_0x2f435e[_0x7995('0x3f')]===_0x2f435e[_0x7995('0x57')]&&_0x2f435e[_0x7995('0x51')]!='h'&&_0x2f435e['channel']!=_0x7995('0x44')){_0x2f435e[_0x7995('0x58')]=_0x2f435e[_0x7995('0x58')]['toLowerCase']();_0x2f435e[_0x7995('0x59')]=(_0x2f435e[_0x7995('0x5a')]||_0x2f435e[_0x7995('0x59')])[_0x7995('0x5b')]();logger[_0x7995('0x45')]('[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s',_0x2f435e[_0x7995('0x3f')],_0x2f435e[_0x7995('0x58')],_0x2f435e['applicationdata']);if(_[_0x7995('0x38')](this['channels'][_0x2f435e[_0x7995('0x3f')]])){this[_0x7995('0x1e')][_0x2f435e[_0x7995('0x3f')]]=new Channel();this[_0x7995('0x1e')][_0x2f435e[_0x7995('0x3f')]][_0x7995('0x5c')]=_0x2f435e[_0x7995('0x5d')]?moment()['subtract'](moment[_0x7995('0x5d')](_0x2f435e[_0x7995('0x5d')])[_0x7995('0x5e')](),'seconds')[_0x7995('0x48')](_0x7995('0x49')):moment()[_0x7995('0x48')]('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x2f435e['uniqueid']][_0x7995('0x4a')]=_0x7995('0x18');}_['merge'](this[_0x7995('0x1e')][_0x2f435e[_0x7995('0x3f')]],_[_0x7995('0x41')](_0x2f435e,_[_0x7995('0x4c')](this[_0x7995('0x1e')][_0x2f435e['uniqueid']])));if(_[_0x7995('0x5f')](applications,_0x2f435e['application'])){this[_0x7995('0x1e')][_0x2f435e[_0x7995('0x3f')]][_0x7995('0x60')]=_0x2f435e['application'];this['channels'][_0x2f435e['uniqueid']]['lastdata']=_0x2f435e[_0x7995('0x59')];if(_0x2f435e[_0x7995('0x58')]===_0x7995('0x11')&&_[_0x7995('0x61')](_0x2f435e[_0x7995('0x59')],_0x7995('0x62'))){var _0x1f4270=_0x2f435e[_0x7995('0x59')][_0x7995('0x4f')]('=');var _0x17ecd3=_0x1f4270[0x0][_0x7995('0x63')](/cdr\((.*)\)/);if(_0x17ecd3){this[_0x7995('0x1e')][_0x2f435e[_0x7995('0x3f')]][_0x17ecd3[0x1]]=_0x1f4270[0x1];}}else if(_0x2f435e[_0x7995('0x58')]===_0x7995('0x12')){this[_0x7995('0x1e')][_0x2f435e[_0x7995('0x3f')]][_0x7995('0x12')]=_0x2f435e[_0x7995('0x59')]['split'](',')[0x0];}}}}}catch(_0x56a374){logger[_0x7995('0x34')](_0x7995('0x64'),_0x2f435e[_0x7995('0x3f')],util['inspect'](_0x56a374,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x7995('0x65')]=function(_0x197b52){try{if(this[_0x7995('0x37')](_0x197b52)){logger[_0x7995('0x45')]('[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s',_0x197b52[_0x7995('0x3f')],_0x197b52[_0x7995('0x57')],_0x197b52[_0x7995('0x3b')],_0x197b52[_0x7995('0x3c')]);logger['debug']('[%s][voiceCallReport][newstate]\x20event:',_0x197b52[_0x7995('0x3f')],util[_0x7995('0x36')](_0x197b52,{'showHidden':![],'depth':null}));if(_0x197b52[_0x7995('0x3f')]!==_0x197b52[_0x7995('0x57')]){if(this[_0x7995('0x1e')][_0x197b52[_0x7995('0x57')]]){if(_0x197b52[_0x7995('0x66')]==='6'){if(!this[_0x7995('0x1e')][_0x197b52[_0x7995('0x57')]]['answered']){var _0x18f230=moment();this[_0x7995('0x1e')][_0x197b52[_0x7995('0x57')]][_0x7995('0x67')]=!![];this['channels'][_0x197b52['linkedid']][_0x7995('0x68')]=_0x18f230[_0x7995('0x48')]('YYYY-MM-DD\x20HH:mm:ss');if(this[_0x7995('0x1e')][_0x197b52[_0x7995('0x57')]][_0x7995('0x5c')]){this[_0x7995('0x1e')][_0x197b52[_0x7995('0x57')]]['holdtime']=_0x18f230[_0x7995('0x69')](this['channels'][_0x197b52[_0x7995('0x57')]][_0x7995('0x5c')],_0x7995('0x5e'));}}this[_0x7995('0x1e')][_0x197b52[_0x7995('0x57')]][_0x7995('0x57')]=_0x197b52[_0x7995('0x3f')];if(_0x197b52[_0x7995('0x3c')]!==_0x7995('0x6a')){this[_0x7995('0x1e')][_0x197b52[_0x7995('0x57')]][_0x7995('0x6b')]=_0x197b52['calleridnum'];}this[_0x7995('0x1e')][_0x197b52[_0x7995('0x57')]][_0x7995('0x6c')]=_0x197b52[_0x7995('0x3b')];this[_0x7995('0x1e')][_0x197b52['linkedid']]['destinationchannel']=_0x197b52[_0x7995('0x4e')];this[_0x7995('0x1e')][_0x197b52[_0x7995('0x57')]][_0x7995('0x4a')]=dispositions[_['toNumber'](_0x197b52[_0x7995('0x66')])];if(this['agents'][_0x197b52['channel'][_0x7995('0x4f')]('-')[0x0]]){this[_0x7995('0x1e')][_0x197b52[_0x7995('0x57')]][_0x7995('0x6d')]=this[_0x7995('0x1f')][_0x197b52[_0x7995('0x4e')][_0x7995('0x4f')]('-')[0x0]]['id'];this[_0x7995('0x1e')][_0x197b52[_0x7995('0x57')]][_0x7995('0x6e')]=this['agents'][_0x197b52[_0x7995('0x4e')][_0x7995('0x4f')]('-')[0x0]][_0x7995('0x54')];}}}}else{if(this['channels'][_0x197b52[_0x7995('0x3f')]]){if(_0x197b52[_0x7995('0x66')]==='6'){if(this[_0x7995('0x1f')][_0x197b52[_0x7995('0x4e')][_0x7995('0x4f')]('-')[0x0]]){this[_0x7995('0x1e')][_0x197b52[_0x7995('0x3f')]][_0x7995('0x6d')]=this[_0x7995('0x1f')][_0x197b52[_0x7995('0x4e')][_0x7995('0x4f')]('-')[0x0]]['id'];this['channels'][_0x197b52['uniqueid']][_0x7995('0x6e')]=this[_0x7995('0x1f')][_0x197b52[_0x7995('0x4e')][_0x7995('0x4f')]('-')[0x0]]['name'];}}}}}}catch(_0x3b45e8){logger[_0x7995('0x34')]('[%s][voiceCallReport][newstate]',_0x197b52['uniqueid'],util[_0x7995('0x36')](_0x3b45e8,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x7995('0x39')]['syncMixMonitorFilename']=function(_0x228de1,_0x5b1cba){try{if(this[_0x7995('0x1e')][_0x228de1]){logger[_0x7995('0x45')]('[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s',_0x228de1,_0x5b1cba);this['channels'][_0x228de1][_0x7995('0x6f')]=!![];if(_['endsWith'](_0x5b1cba,_0x7995('0x70'))){_0x5b1cba=_0x5b1cba[_0x7995('0x71')](_0x7995('0x70'),_0x7995('0x72'));}this[_0x7995('0x1e')][_0x228de1][_0x7995('0x73')]=_0x5b1cba;var _0x8af865=_[_0x7995('0x74')](this[_0x7995('0x1e')][_0x228de1][_0x7995('0x75')],{'filename':_0x5b1cba});if(_[_0x7995('0x76')](_0x8af865)){this[_0x7995('0x1e')][_0x228de1][_0x7995('0x75')][_0x7995('0x77')]({'filename':_0x5b1cba,'createdAt':moment()[_0x7995('0x48')](_0x7995('0x49')),'mixmonitorid':'','status':_0x7995('0x78')});}}}catch(_0x251490){logger[_0x7995('0x34')](_0x7995('0x79'),_0x228de1,util[_0x7995('0x36')](_0x251490,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x7995('0x39')][_0x7995('0x27')]=function(_0x280fbb){try{if(this[_0x7995('0x37')](_0x280fbb)){logger[_0x7995('0x3d')](_0x7995('0x7a'),_0x280fbb[_0x7995('0x3f')],util['inspect'](_0x280fbb,{'showHidden':![],'depth':null}));if(this[_0x7995('0x1e')][_0x280fbb[_0x7995('0x3f')]]&&_0x280fbb['channel']!='OutgoingSpoolFailed'){if(this[_0x7995('0x37')](_0x280fbb[_0x7995('0x7b')])){if(this[_0x7995('0x37')](_0x280fbb[_0x7995('0x7b')][_0x7995('0x7c')])){logger[_0x7995('0x45')]('[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s',_0x280fbb[_0x7995('0x3f')],_0x280fbb[_0x7995('0x7d')]);this[_0x7995('0x7e')](_0x280fbb[_0x7995('0x3f')],_0x280fbb[_0x7995('0x7d')]);}else if(this[_0x7995('0x37')](_0x280fbb[_0x7995('0x7b')][_0x7995('0x7f')])){logger['info'](_0x7995('0x80'),_0x280fbb[_0x7995('0x3f')],_0x280fbb['value']);this['channels'][_0x280fbb[_0x7995('0x3f')]][_0x7995('0x3c')]=_0x280fbb[_0x7995('0x7d')];}else if(this[_0x7995('0x37')](_0x280fbb[_0x7995('0x7b')]['xmd-callerid'])){logger[_0x7995('0x45')](_0x7995('0x81'),_0x280fbb['uniqueid'],_0x280fbb[_0x7995('0x7d')]);this[_0x7995('0x1e')][_0x280fbb['uniqueid']][_0x7995('0x82')]=_0x280fbb['value'];}else if(this[_0x7995('0x37')](_0x280fbb[_0x7995('0x7b')][_0x7995('0x83')])){logger[_0x7995('0x45')](_0x7995('0x84'),_0x280fbb['uniqueid'],_0x280fbb[_0x7995('0x7d')]);this[_0x7995('0x1e')][_0x280fbb[_0x7995('0x3f')]]['type']=_0x280fbb[_0x7995('0x7d')];}else if(this[_0x7995('0x37')](_0x280fbb[_0x7995('0x7b')][_0x7995('0x85')])){logger['info'](_0x7995('0x86'),_0x280fbb[_0x7995('0x3f')],_0x280fbb[_0x7995('0x7d')]['split'](',')[0x0]);this['channels'][_0x280fbb[_0x7995('0x3f')]][_0x7995('0x12')]=_0x280fbb['value']['split'](',')[0x0];}else if(this[_0x7995('0x37')](_0x280fbb[_0x7995('0x7b')][_0x7995('0x87')])){logger[_0x7995('0x45')](_0x7995('0x88'),_0x280fbb['uniqueid'],_0x280fbb['value']);this[_0x7995('0x1e')][_0x280fbb['uniqueid']]['originatecalleridnum']=_0x280fbb[_0x7995('0x7d')];}else if(this[_0x7995('0x37')](_0x280fbb[_0x7995('0x7b')]['xmd-destination'])){logger[_0x7995('0x45')](_0x7995('0x89'),_0x280fbb[_0x7995('0x3f')],_0x280fbb[_0x7995('0x7d')]);this[_0x7995('0x1e')][_0x280fbb['uniqueid']][_0x7995('0x8a')]=_0x280fbb[_0x7995('0x7d')];}else if(this[_0x7995('0x37')](_0x280fbb[_0x7995('0x7b')]['xmd-callerid-preview'])){logger[_0x7995('0x45')](_0x7995('0x8b'),_0x280fbb['uniqueid'],_0x280fbb[_0x7995('0x7d')]);this[_0x7995('0x1e')][_0x280fbb['uniqueid']][_0x7995('0x8c')]=_0x280fbb['value'];}else if(this[_0x7995('0x37')](_0x280fbb['variable'][_0x7995('0x8d')])){logger['info'](_0x7995('0x8e'),_0x280fbb[_0x7995('0x3f')],_0x280fbb['value']);this[_0x7995('0x1e')][_0x280fbb['uniqueid']]['queue']=_0x280fbb[_0x7995('0x7d')];}else if(this[_0x7995('0x37')](_0x280fbb[_0x7995('0x7b')][_0x7995('0x8f')])){logger['info'](_0x7995('0x90'),_0x280fbb[_0x7995('0x3f')],_0x280fbb['value']);this['channels'][_0x280fbb[_0x7995('0x3f')]]['sipcalluniqueid']=_0x280fbb[_0x7995('0x7d')];}}}else if(this[_0x7995('0x37')](_0x280fbb[_0x7995('0x7b')]['mixmonitor_filename'])){if(_0x280fbb['value']){var _0x2b7852=path['parse'](_0x280fbb[_0x7995('0x7d')])[_0x7995('0x54')];logger[_0x7995('0x45')](_0x7995('0x91'),_0x2b7852,_0x280fbb['value']);this['syncMixMonitorFilename'](_0x2b7852,_0x280fbb['value']);}}else if(this[_0x7995('0x1e')][_0x280fbb[_0x7995('0x57')]]){if(this[_0x7995('0x37')](_0x280fbb[_0x7995('0x7b')])){if(this[_0x7995('0x37')](_0x280fbb[_0x7995('0x7b')]['sipcallid'])){logger['info'](_0x7995('0x90'),_0x280fbb['linkedid'],_0x280fbb['value']);this[_0x7995('0x1e')][_0x280fbb['linkedid']]['sipcalllinkedid']=_0x280fbb[_0x7995('0x7d')];}}}}}catch(_0x3541d7){logger[_0x7995('0x34')]('[%s][voiceCallReport][varset]',_0x280fbb[_0x7995('0x3f')],util[_0x7995('0x36')](_0x3541d7,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x7995('0x39')][_0x7995('0x92')]=function(_0x227372){try{if(this[_0x7995('0x37')](_0x227372)){logger[_0x7995('0x3d')](_0x7995('0x93'),_0x227372[_0x7995('0x3f')],util['inspect'](_0x227372,{'showHidden':![],'depth':null}));if(this[_0x7995('0x1e')][_0x227372[_0x7995('0x3f')]]){logger[_0x7995('0x45')](_0x7995('0x94'),_0x227372[_0x7995('0x3f')],_0x227372['cause-txt']);var _0x1ea316=moment();this[_0x7995('0x1e')][_0x227372[_0x7995('0x3f')]]['endtime']=_0x1ea316['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x7995('0x1e')][_0x227372[_0x7995('0x3f')]][_0x7995('0x5d')]=_0x1ea316[_0x7995('0x69')](this[_0x7995('0x1e')][_0x227372[_0x7995('0x3f')]]['starttime'],_0x7995('0x5e'));if(this['channels'][_0x227372[_0x7995('0x3f')]][_0x7995('0x67')]){this[_0x7995('0x1e')][_0x227372[_0x7995('0x3f')]][_0x7995('0x95')]=_0x1ea316[_0x7995('0x69')](this[_0x7995('0x1e')][_0x227372[_0x7995('0x3f')]][_0x7995('0x68')],_0x7995('0x5e'));this[_0x7995('0x1e')][_0x227372['uniqueid']][_0x7995('0x96')]=this['channels'][_0x227372[_0x7995('0x3f')]][_0x7995('0x5d')]-this['channels'][_0x227372['uniqueid']][_0x7995('0x95')];}if(_0x227372[_0x7995('0x47')]===_0x7995('0x4d')){if(this[_0x7995('0x1f')][_0x227372[_0x7995('0x4e')][_0x7995('0x4f')]('-')[0x0]]){this[_0x7995('0x1f')][_0x227372[_0x7995('0x4e')][_0x7995('0x4f')]('-')[0x0]]=_[_0x7995('0x97')](this[_0x7995('0x1f')][_0x227372[_0x7995('0x4e')]['split']('-')[0x0]],['destconnectedlinenum']);logger[_0x7995('0x3d')](_0x7995('0x98'),_0x227372[_0x7995('0x3f')],util[_0x7995('0x36')]({'destaccountcode':this[_0x7995('0x1f')][_0x227372['channel'][_0x7995('0x4f')]('-')[0x0]][_0x7995('0x52')]},{'showHidden':![],'depth':null}));this['emit'](util[_0x7995('0x48')]('user:%s',this[_0x7995('0x1f')][_0x227372[_0x7995('0x4e')][_0x7995('0x4f')]('-')[0x0]]['name']),_0x7995('0x99'),{'destaccountcode':this[_0x7995('0x1f')][_0x227372[_0x7995('0x4e')][_0x7995('0x4f')]('-')[0x0]][_0x7995('0x52')]});}}var _0x8a5aa8=this;Promise[_0x7995('0x9a')]()['then'](function(){var _0x4c0a67=_0x8a5aa8['channels'][_0x227372[_0x7995('0x3f')]];if(typeof _0x4c0a67[_0x7995('0x9b')]==='undefined')return;if(_['isEmpty'](_0x4c0a67[_0x7995('0x75')]))return;return RpcSetting[_0x7995('0x9c')]()['then'](function(_0x4b07de){if(!_0x4b07de['stopRecordingOnTransfer'])return;return Promise['resolve']()[_0x7995('0x9d')](function(){return ami[_0x7995('0x9e')]({'action':_0x7995('0x9f'),'channel':_0x4c0a67[_0x7995('0x4e')]})['catch'](function(){});})[_0x7995('0x9d')](function(){return ami[_0x7995('0x9e')]({'action':'StopMixMonitor','channel':_0x4c0a67[_0x7995('0xa0')]})[_0x7995('0xa1')](function(){})[_0x7995('0xa2')](function(){var _0x580917=_0x8a5aa8[_0x7995('0x1f')][_0x4c0a67[_0x7995('0xa0')]['split']('-')[0x0]];if(!_0x580917)return;io[_0x7995('0x3a')](_0x7995('0xa3'),{'agentId':_0x580917['id'],'uniqueid':_0x4c0a67[_0x7995('0x3f')]});});});});})[_0x7995('0x9d')](function(){if(_0x227372[_0x7995('0xa4')]===_0x7995('0xa5')){_0x8a5aa8[_0x7995('0x20')][_0x227372[_0x7995('0x3f')]]=_0x8a5aa8[_0x7995('0x1e')][_0x227372[_0x7995('0x3f')]];}else{if(_0x8a5aa8[_0x7995('0x1e')][_0x227372[_0x7995('0x3f')]][_0x7995('0xa6')]==='outbound'&&_0x8a5aa8[_0x7995('0x20')][_0x227372[_0x7995('0x3f')]]){_0x8a5aa8[_0x7995('0x1e')][_0x227372[_0x7995('0x3f')]]['uniqueid']=[_0x8a5aa8[_0x7995('0x1e')][_0x227372[_0x7995('0x3f')]][_0x7995('0x57')],_0x8a5aa8['channels'][_0x227372[_0x7995('0x3f')]][_0x7995('0x57')]=_0x8a5aa8[_0x7995('0x1e')][_0x227372[_0x7995('0x3f')]][_0x7995('0x3f')]][0x0];delete _0x8a5aa8[_0x7995('0x20')][_0x227372[_0x7995('0x3f')]];}}logger['debug'](_0x7995('0xa7'),_0x227372['uniqueid'],util[_0x7995('0x36')](_0x8a5aa8[_0x7995('0x1e')][_0x227372[_0x7995('0x3f')]],{'showHidden':![],'depth':null}));ami['emit'](_0x7995('0xa8'),_0x8a5aa8['channels'][_0x227372['uniqueid']]);delete _0x8a5aa8['channels'][_0x227372['uniqueid']];});}}}catch(_0x31cbe6){logger[_0x7995('0x34')]('[%s][voiceCallReport][hangup]',_0x227372[_0x7995('0x3f')],util[_0x7995('0x36')](_0x31cbe6,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x7995('0x2c')]=function(_0xb80394){try{if(this[_0x7995('0x37')](_0xb80394)){logger[_0x7995('0x45')](_0x7995('0xa9'),_0xb80394['uniqueid'],_0xb80394[_0x7995('0xaa')],_0xb80394[_0x7995('0xab')]);logger[_0x7995('0x3d')](_0x7995('0xac'),_0xb80394['uniqueid'],util[_0x7995('0x36')](_0xb80394,{'showHidden':![],'depth':null}));if(this[_0x7995('0x1e')][_0xb80394[_0x7995('0xad')]]){this[_0x7995('0x1e')][_0xb80394[_0x7995('0xad')]][_0x7995('0xae')]=_0xb80394[_0x7995('0xaa')];this[_0x7995('0x1e')][_0xb80394[_0x7995('0xad')]][_0x7995('0xaf')]=_0xb80394['transfertargetcalleridnum'];if(this[_0x7995('0x1e')][_0xb80394['secondtransfereruniqueid']]){var _0x139204=this[_0x7995('0x1e')][_0xb80394[_0x7995('0xb0')]];this['channels'][_0xb80394['secondtransfereruniqueid']]=this[_0x7995('0x1e')][_0xb80394[_0x7995('0xad')]];this['channels'][_0xb80394[_0x7995('0xad')]]=_0x139204;}}else if(this['channels'][_0xb80394[_0x7995('0xb1')]]){this[_0x7995('0x1e')][_0xb80394[_0x7995('0xb1')]][_0x7995('0xae')]=_0xb80394['origtransferercalleridnum'];this['channels'][_0xb80394[_0x7995('0xb1')]][_0x7995('0xaf')]=_0xb80394[_0x7995('0xab')];if(this[_0x7995('0x1e')][_0xb80394['origtransfereruniqueid']]){var _0x139204=this[_0x7995('0x1e')][_0xb80394[_0x7995('0xb2')]];this[_0x7995('0x1e')][_0xb80394[_0x7995('0xb2')]]=this['channels'][_0xb80394['transfertargetuniqueid']];this['channels'][_0xb80394[_0x7995('0xb1')]]=_0x139204;}}if((this[_0x7995('0x1e')][_0xb80394['origtransfereruniqueid']]||this[_0x7995('0x1e')][_0xb80394['origtransfererlinkedid']])&&this[_0x7995('0x1e')][_0xb80394[_0x7995('0xb0')]]){var _0x1e7398=_[_0x7995('0xb3')]([this['channels'][_0xb80394[_0x7995('0xb2')]],this[_0x7995('0x1e')][_0xb80394[_0x7995('0xb4')]],this[_0x7995('0x1e')][_0xb80394[_0x7995('0xb0')]]],function(_0x197adc){return _0x197adc&&_0x197adc[_0x7995('0xa6')]===_0x7995('0xb5')&&_0x197adc[_0x7995('0xb6')];});if(_0x1e7398){if(this[_0x7995('0x1e')][_0xb80394[_0x7995('0xb2')]])this[_0x7995('0x1e')][_0xb80394[_0x7995('0xb2')]][_0x7995('0x9b')]='ATTENDED';if(this[_0x7995('0x1e')][_0xb80394['origtransfererlinkedid']])this[_0x7995('0x1e')][_0xb80394[_0x7995('0xb4')]]['transferType']=_0x7995('0xb7');this['channels'][_0xb80394[_0x7995('0xb0')]][_0x7995('0x9b')]='ATTENDED';}}}}catch(_0x4985f3){logger['error'](_0x7995('0xb8'),_0xb80394[_0x7995('0x3f')],util[_0x7995('0x36')](_0x4985f3,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x7995('0x39')]['syncBlindTransfer']=function(_0x1ce3ff){try{if(this[_0x7995('0x37')](_0x1ce3ff)){logger[_0x7995('0x45')](_0x7995('0xb9'),_0x1ce3ff[_0x7995('0x3f')],_0x1ce3ff[_0x7995('0xba')],_0x1ce3ff[_0x7995('0xbb')]);logger[_0x7995('0x3d')]('[%s][voiceCallReport][blindtransfer]\x20event:',_0x1ce3ff[_0x7995('0x3f')],util[_0x7995('0x36')](_0x1ce3ff,{'showHidden':![],'depth':null}));if(this[_0x7995('0x1e')][_0x1ce3ff[_0x7995('0xad')]]){this['channels'][_0x1ce3ff[_0x7995('0xad')]][_0x7995('0xae')]=_0x1ce3ff[_0x7995('0xba')];this[_0x7995('0x1e')][_0x1ce3ff[_0x7995('0xad')]][_0x7995('0xaf')]=_0x1ce3ff['extension'];this[_0x7995('0x1e')][_0x1ce3ff[_0x7995('0xad')]][_0x7995('0x9b')]=_0x7995('0xbc');this[_0x7995('0x92')]({'event':_0x7995('0xa5'),'uniqueid':_0x1ce3ff[_0x7995('0xad')],'context':_0x1ce3ff[_0x7995('0x47')],'channel':_0x1ce3ff[_0x7995('0xbd')]});}else{this[_0x7995('0x1e')][_0x1ce3ff[_0x7995('0xbe')]][_0x7995('0x9b')]=_0x7995('0xbc');}}}catch(_0x789f7a){logger[_0x7995('0x34')](_0x7995('0xbf'),_0x1ce3ff[_0x7995('0x3f')],util[_0x7995('0x36')](_0x789f7a,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x7995('0x39')][_0x7995('0x2f')]=function(_0x37e69d){try{if(this['isNotNull'](_0x37e69d)){logger['debug'](_0x7995('0xc0'),_0x37e69d[_0x7995('0x3f')],util['inspect'](_0x37e69d,{'showHidden':![],'depth':null}));if(this[_0x7995('0x1e')][_0x37e69d['uniqueid']]){if(!_[_0x7995('0x76')](this['channels'][_0x37e69d[_0x7995('0x3f')]][_0x7995('0x68')])){this[_0x7995('0x1e')][_0x37e69d[_0x7995('0x3f')]][_0x7995('0xc1')]=moment()[_0x7995('0x48')](_0x7995('0x49'));logger[_0x7995('0x45')](_0x7995('0xc2'),_0x37e69d[_0x7995('0x3f')],this['channels'][_0x37e69d[_0x7995('0x3f')]][_0x7995('0xc1')]);}}}}catch(_0x1d0481){logger[_0x7995('0x34')]('[%s][voiceCallReport][musiconholdstart]',_0x37e69d[_0x7995('0x3f')],util[_0x7995('0x36')](_0x1d0481,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x7995('0x39')][_0x7995('0x31')]=function(_0x4d19b8){try{if(this[_0x7995('0x37')](_0x4d19b8)){logger[_0x7995('0x3d')](_0x7995('0xc3'),_0x4d19b8[_0x7995('0x3f')],util[_0x7995('0x36')](_0x4d19b8,{'showHidden':![],'depth':null}));if(this[_0x7995('0x1e')][_0x4d19b8[_0x7995('0x3f')]]){if(!_[_0x7995('0x76')](this[_0x7995('0x1e')][_0x4d19b8['uniqueid']][_0x7995('0xc1')])){this['channels'][_0x4d19b8[_0x7995('0x3f')]][_0x7995('0xc4')]+=moment()[_0x7995('0xc5')](0x0)[_0x7995('0x69')](this['channels'][_0x4d19b8[_0x7995('0x3f')]][_0x7995('0xc1')],_0x7995('0x5e'));logger[_0x7995('0x45')](_0x7995('0xc6'),_0x4d19b8[_0x7995('0x3f')],this[_0x7995('0x1e')][_0x4d19b8[_0x7995('0x3f')]][_0x7995('0xc4')]);delete this[_0x7995('0x1e')][_0x4d19b8[_0x7995('0x3f')]][_0x7995('0xc1')];}}}}catch(_0x7d14e2){logger[_0x7995('0x34')]('[%s][voiceCallReport][musiconholdstop]',_0x4d19b8['uniqueid'],util[_0x7995('0x36')](_0x7d14e2,{'showHidden':![],'depth':null}));}};module[_0x7995('0xc7')]=VoiceCallReport; \ No newline at end of file +var _0x7217=['isNil','mohstarttime','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceCallReport][musiconholdstart]','syncMusicOnHoldStop','[%s][voiceCallReport][musiconholdstop]\x20event:','mohtime','milliseconds','[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s','[%s][voiceCallReport][musiconholdstop]','bluebird','moment','util','path','ioredis','../../../config/environment','../ami','../model/channel','../rpc/setting','unknown','not_inuse','inuse','busy','invalid','unavailable','ringing','ringinuse','onhold','set','queue','agi','playback','voicemail','NO\x20ANSWER','FAILED','BUSY','redis','defaults','socket.io-emitter','agents','blindTransfers','coreshowchannel','bind','syncNewExten','newchannel','syncNewChannel','newstate','syncNewState','varset','syncVarSet','hangup','newcallerid','syncNewCallerId','syncAttendedTransfer','blindtransfer','syncBlindTransfer','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','info','[voiceCallReport][coreshowchannels]\x20started','actionCoreShowChannels','error','[voiceCallReport][coreshowchannels]','inspect','prototype','emit','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','calleridnum','debug','uniqueid','isUndefined','channels','merge','pick','keys','isNotNull','[%s][voiceCallReport][newchannel]\x20event:','linkedid','channel','[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s','context','exten','starttime','format','YYYY-MM-DD\x20HH:mm:ss','disposition','channelstate','from-sip','split','destconnectedlinenum','name','user:agentconnect','[%s][voiceCallReport][newchannel]','OutgoingSpoolFailed','application','applicationdata','toLowerCase','duration','subtract','seconds','lastapplication','lastdata','cdr(','match','[%s][voiceCallReport][newexten]','answered','answertime','holdtime','diff','xcally-motion-preview','connectedlinenum','connectedlinename','calleridname','destinationchannel','toNumber','UserId','membername','[%s][voiceCallReport][newstate]','syncMixMonitorFilename','[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s','monitor','endsWith','.wav49','.WAV','find','monitors','push','rec','[%s][voiceCallReport][mixMonitorFilename]','[%s][voiceCallReport][varset]\x20event:','variable','mixmonitor_filename','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','value','xmd-phone','[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s','xmd-callerid','[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s','callerid','xmd-queue','[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s','xmd-originatecalleridnum','[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','originatecalleridnum','destination','xmd-callerid-preview','[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s','[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s','sipcallid','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','sipcalluniqueid','parse','sipcalllinkedid','[%s][voiceCallReport][varset]','[%s][voiceCallReport][hangup]\x20event:','[%s][voiceCallReport][hangup]\x20reason:%s','cause-txt','endtime','billableseconds','omit','user:agentcomplete','resolve','then','transferType','undefined','isEmpty','getSettings','StopMixMonitor','Action','catch','webbar:stopmonitors','event','BlindTransfer','type','outbound','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','custom:voiceCallReport','[%s][voiceCallReport][hangup]','origtransferercalleridnum','transfereeuniqueid','transfercalleridnum','transferconnectedlinenum','transfertargetcalleridnum','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','origtransfererlinkedid','some','routeid','ATTENDED','[%s][voiceCallReport][attendedtransfer]','[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','transfereecalleridnum','extension','[%s][voiceCallReport][blindtransfer]\x20event:','BLIND','syncHangup','transfererchannel','transfereruniqueid','[%s][voiceCallReport][blindtransfer]','[%s][voiceCallReport][musiconholdstart]\x20event:'];(function(_0x5d4636,_0x4f20e9){var _0x268926=function(_0x4020ba){while(--_0x4020ba){_0x5d4636['push'](_0x5d4636['shift']());}};_0x268926(++_0x4f20e9);}(_0x7217,0x19e));var _0x7721=function(_0x21aec3,_0x5c97e9){_0x21aec3=_0x21aec3-0x0;var _0x288bbc=_0x7217[_0x21aec3];return _0x288bbc;};'use strict';var BPromise=require(_0x7721('0x0'));var _=require('lodash');var moment=require(_0x7721('0x1'));var util=require(_0x7721('0x2'));var path=require(_0x7721('0x3'));var Redis=require(_0x7721('0x4'));var config=require(_0x7721('0x5'));var logger=require('../../../config/logger')('ami');var ami=require(_0x7721('0x6'));var Channel=require(_0x7721('0x7'));var RpcSetting=require(_0x7721('0x8'));var statusDesc=[_0x7721('0x9'),_0x7721('0xa'),_0x7721('0xb'),_0x7721('0xc'),_0x7721('0xd'),_0x7721('0xe'),_0x7721('0xf'),_0x7721('0x10'),_0x7721('0x11')];var applications=[_0x7721('0x12'),_0x7721('0x13'),_0x7721('0x14'),'dial',_0x7721('0x15'),_0x7721('0x16')];var dispositions=[_0x7721('0x17'),_0x7721('0x18'),_0x7721('0x18'),_0x7721('0x17'),_0x7721('0x17'),_0x7721('0x17'),'ANSWERED',_0x7721('0x19'),_0x7721('0x18'),'FAILED',_0x7721('0x18')];var actions={};config[_0x7721('0x1a')]=_[_0x7721('0x1b')](config[_0x7721('0x1a')],{'host':'localhost','port':0x18eb});var io=require(_0x7721('0x1c'))(new Redis(config[_0x7721('0x1a')]));function VoiceCallReport(_0x534f1b){this['channels']=_0x534f1b['channels'];this[_0x7721('0x1d')]=_0x534f1b[_0x7721('0x1d')];this[_0x7721('0x1e')]={};ami['on'](_0x7721('0x1f'),this['syncNewExten'][_0x7721('0x20')](this));ami['on']('newexten',this[_0x7721('0x21')]['bind'](this));ami['on'](_0x7721('0x22'),this[_0x7721('0x23')][_0x7721('0x20')](this));ami['on'](_0x7721('0x24'),this[_0x7721('0x25')][_0x7721('0x20')](this));ami['on'](_0x7721('0x26'),this[_0x7721('0x27')][_0x7721('0x20')](this));ami['on'](_0x7721('0x28'),this['syncHangup'][_0x7721('0x20')](this));ami['on'](_0x7721('0x29'),this[_0x7721('0x2a')][_0x7721('0x20')](this));ami['on']('attendedtransfer',this[_0x7721('0x2b')]['bind'](this));ami['on'](_0x7721('0x2c'),this[_0x7721('0x2d')][_0x7721('0x20')](this));ami['on'](_0x7721('0x2e'),this[_0x7721('0x2f')][_0x7721('0x20')](this));ami['on'](_0x7721('0x30'),this['syncMusicOnHoldStop'][_0x7721('0x20')](this));try{logger[_0x7721('0x31')](_0x7721('0x32'));ami[_0x7721('0x33')]();}catch(_0x40d550){logger[_0x7721('0x34')](_0x7721('0x35'),util[_0x7721('0x36')](_0x40d550,{'showHidden':![],'depth':null}));}}VoiceCallReport[_0x7721('0x37')]['isNotNull']=function(_0x258ddf){return _0x258ddf!==null&&!_['isUndefined'](_0x258ddf);};VoiceCallReport['prototype'][_0x7721('0x38')]=function(_0x343c19,_0x53c904,_0x158d98){io['to'](_0x343c19)[_0x7721('0x38')](_0x53c904,_0x158d98);};VoiceCallReport[_0x7721('0x37')][_0x7721('0x2a')]=function(_0x1da2d8){try{if(this['isNotNull'](_0x1da2d8)){logger[_0x7721('0x31')](_0x7721('0x39'),_0x1da2d8['uniqueid'],_0x1da2d8['calleridname'],_0x1da2d8[_0x7721('0x3a')]);logger[_0x7721('0x3b')]('[%s][voiceCallReport][newcallerid]\x20event:',_0x1da2d8[_0x7721('0x3c')],util[_0x7721('0x36')](_0x1da2d8,{'showHidden':![],'depth':null}));if(_0x1da2d8[_0x7721('0x3c')]===_0x1da2d8['linkedid']){if(!_[_0x7721('0x3d')](this[_0x7721('0x3e')][_0x1da2d8[_0x7721('0x3c')]])){_[_0x7721('0x3f')](this[_0x7721('0x3e')][_0x1da2d8['uniqueid']],_[_0x7721('0x40')](_0x1da2d8,_[_0x7721('0x41')](this[_0x7721('0x3e')][_0x1da2d8['uniqueid']])));}}}}catch(_0x35de7a){logger[_0x7721('0x34')]('[%s][voiceCallReport][newcallerid]',_0x1da2d8[_0x7721('0x3c')],util['inspect'](_0x35de7a,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x7721('0x37')][_0x7721('0x23')]=function(_0x19d082){try{if(this[_0x7721('0x42')](_0x19d082)){logger[_0x7721('0x3b')](_0x7721('0x43'),_0x19d082[_0x7721('0x3c')],util[_0x7721('0x36')](_0x19d082,{'showHidden':![],'depth':null}));if(_0x19d082[_0x7721('0x3c')]===_0x19d082[_0x7721('0x44')]&&_0x19d082[_0x7721('0x45')]!='OutgoingSpoolFailed'){if(_[_0x7721('0x3d')](this['channels'][_0x19d082[_0x7721('0x3c')]])){logger[_0x7721('0x31')](_0x7721('0x46'),_0x19d082[_0x7721('0x3c')],_0x19d082[_0x7721('0x47')],_0x19d082[_0x7721('0x48')]);this['channels'][_0x19d082['uniqueid']]=new Channel();this['channels'][_0x19d082['uniqueid']][_0x7721('0x49')]=moment()[_0x7721('0x4a')](_0x7721('0x4b'));this[_0x7721('0x3e')][_0x19d082['uniqueid']][_0x7721('0x4c')]=dispositions[_['toNumber'](_0x19d082[_0x7721('0x4d')])];_[_0x7721('0x3f')](this['channels'][_0x19d082[_0x7721('0x3c')]],_[_0x7721('0x40')](_0x19d082,_['keys'](this['channels'][_0x19d082[_0x7721('0x3c')]])));if(_0x19d082[_0x7721('0x47')]===_0x7721('0x4e')){if(this[_0x7721('0x1d')][_0x19d082['channel'][_0x7721('0x4f')]('-')[0x0]]){this[_0x7721('0x1d')][_0x19d082[_0x7721('0x45')][_0x7721('0x4f')]('-')[0x0]][_0x7721('0x50')]=_0x19d082['exten'];logger[_0x7721('0x3b')]('[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:',_0x19d082[_0x7721('0x3c')],util['inspect']({'destaccountcode':this[_0x7721('0x1d')][_0x19d082[_0x7721('0x45')][_0x7721('0x4f')]('-')[0x0]]['accountcode'],'destconnectedlinenum':_0x19d082[_0x7721('0x48')]},{'showHidden':![],'depth':null}));this[_0x7721('0x38')](util[_0x7721('0x4a')]('user:%s',this[_0x7721('0x1d')][_0x19d082[_0x7721('0x45')][_0x7721('0x4f')]('-')[0x0]][_0x7721('0x51')]),_0x7721('0x52'),{'destaccountcode':this[_0x7721('0x1d')][_0x19d082[_0x7721('0x45')]['split']('-')[0x0]]['accountcode'],'destconnectedlinenum':_0x19d082[_0x7721('0x48')]});}}}}}}catch(_0x1fdc79){logger[_0x7721('0x34')](_0x7721('0x53'),_0x19d082[_0x7721('0x3c')],util[_0x7721('0x36')](_0x1fdc79,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x7721('0x37')][_0x7721('0x21')]=function(_0xa601bc){try{if(this[_0x7721('0x42')](_0xa601bc)){logger['debug']('[%s][voiceCallReport][newexten]\x20event:',_0xa601bc[_0x7721('0x3c')],util[_0x7721('0x36')](_0xa601bc,{'showHidden':![],'depth':null}));if(_0xa601bc[_0x7721('0x3c')]===_0xa601bc[_0x7721('0x44')]&&_0xa601bc['exten']!='h'&&_0xa601bc[_0x7721('0x45')]!=_0x7721('0x54')){_0xa601bc['application']=_0xa601bc[_0x7721('0x55')]['toLowerCase']();_0xa601bc[_0x7721('0x56')]=(_0xa601bc['appdata']||_0xa601bc[_0x7721('0x56')])[_0x7721('0x57')]();logger[_0x7721('0x31')]('[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s',_0xa601bc[_0x7721('0x3c')],_0xa601bc[_0x7721('0x55')],_0xa601bc['applicationdata']);if(_[_0x7721('0x3d')](this[_0x7721('0x3e')][_0xa601bc[_0x7721('0x3c')]])){this['channels'][_0xa601bc[_0x7721('0x3c')]]=new Channel();this['channels'][_0xa601bc[_0x7721('0x3c')]][_0x7721('0x49')]=_0xa601bc[_0x7721('0x58')]?moment()[_0x7721('0x59')](moment[_0x7721('0x58')](_0xa601bc[_0x7721('0x58')])[_0x7721('0x5a')](),_0x7721('0x5a'))[_0x7721('0x4a')](_0x7721('0x4b')):moment()[_0x7721('0x4a')](_0x7721('0x4b'));this[_0x7721('0x3e')][_0xa601bc[_0x7721('0x3c')]][_0x7721('0x4c')]='NO\x20ANSWER';}_[_0x7721('0x3f')](this[_0x7721('0x3e')][_0xa601bc[_0x7721('0x3c')]],_[_0x7721('0x40')](_0xa601bc,_[_0x7721('0x41')](this[_0x7721('0x3e')][_0xa601bc[_0x7721('0x3c')]])));if(_['includes'](applications,_0xa601bc[_0x7721('0x55')])){this[_0x7721('0x3e')][_0xa601bc[_0x7721('0x3c')]][_0x7721('0x5b')]=_0xa601bc[_0x7721('0x55')];this[_0x7721('0x3e')][_0xa601bc[_0x7721('0x3c')]][_0x7721('0x5c')]=_0xa601bc[_0x7721('0x56')];if(_0xa601bc[_0x7721('0x55')]===_0x7721('0x12')&&_['startsWith'](_0xa601bc[_0x7721('0x56')],_0x7721('0x5d'))){var _0x1234bc=_0xa601bc[_0x7721('0x56')][_0x7721('0x4f')]('=');var _0x3e7918=_0x1234bc[0x0][_0x7721('0x5e')](/cdr\((.*)\)/);if(_0x3e7918){this[_0x7721('0x3e')][_0xa601bc[_0x7721('0x3c')]][_0x3e7918[0x1]]=_0x1234bc[0x1];}}else if(_0xa601bc[_0x7721('0x55')]===_0x7721('0x13')){this[_0x7721('0x3e')][_0xa601bc[_0x7721('0x3c')]][_0x7721('0x13')]=_0xa601bc[_0x7721('0x56')]['split'](',')[0x0];}}}}}catch(_0x50e9e9){logger['error'](_0x7721('0x5f'),_0xa601bc['uniqueid'],util['inspect'](_0x50e9e9,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype']['syncNewState']=function(_0x47925a){try{if(this[_0x7721('0x42')](_0x47925a)){logger[_0x7721('0x31')]('[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s',_0x47925a[_0x7721('0x3c')],_0x47925a['linkedid'],_0x47925a['calleridname'],_0x47925a['calleridnum']);logger[_0x7721('0x3b')]('[%s][voiceCallReport][newstate]\x20event:',_0x47925a['uniqueid'],util['inspect'](_0x47925a,{'showHidden':![],'depth':null}));if(_0x47925a[_0x7721('0x3c')]!==_0x47925a[_0x7721('0x44')]){if(this[_0x7721('0x3e')][_0x47925a['linkedid']]){if(_0x47925a[_0x7721('0x4d')]==='6'){if(!this[_0x7721('0x3e')][_0x47925a[_0x7721('0x44')]][_0x7721('0x60')]){var _0x6b7c1e=moment();this[_0x7721('0x3e')][_0x47925a[_0x7721('0x44')]][_0x7721('0x60')]=!![];this[_0x7721('0x3e')][_0x47925a[_0x7721('0x44')]][_0x7721('0x61')]=_0x6b7c1e[_0x7721('0x4a')](_0x7721('0x4b'));if(this[_0x7721('0x3e')][_0x47925a[_0x7721('0x44')]]['starttime']){this[_0x7721('0x3e')][_0x47925a[_0x7721('0x44')]][_0x7721('0x62')]=_0x6b7c1e[_0x7721('0x63')](this['channels'][_0x47925a[_0x7721('0x44')]][_0x7721('0x49')],'seconds');}}this[_0x7721('0x3e')][_0x47925a['linkedid']][_0x7721('0x44')]=_0x47925a[_0x7721('0x3c')];if(_0x47925a[_0x7721('0x3a')]!==_0x7721('0x64')){this[_0x7721('0x3e')][_0x47925a[_0x7721('0x44')]][_0x7721('0x65')]=_0x47925a[_0x7721('0x3a')];}this[_0x7721('0x3e')][_0x47925a['linkedid']][_0x7721('0x66')]=_0x47925a[_0x7721('0x67')];this[_0x7721('0x3e')][_0x47925a[_0x7721('0x44')]][_0x7721('0x68')]=_0x47925a[_0x7721('0x45')];this[_0x7721('0x3e')][_0x47925a['linkedid']][_0x7721('0x4c')]=dispositions[_[_0x7721('0x69')](_0x47925a['channelstate'])];if(this[_0x7721('0x1d')][_0x47925a['channel'][_0x7721('0x4f')]('-')[0x0]]){this[_0x7721('0x3e')][_0x47925a[_0x7721('0x44')]][_0x7721('0x6a')]=this[_0x7721('0x1d')][_0x47925a[_0x7721('0x45')][_0x7721('0x4f')]('-')[0x0]]['id'];this['channels'][_0x47925a[_0x7721('0x44')]][_0x7721('0x6b')]=this[_0x7721('0x1d')][_0x47925a['channel']['split']('-')[0x0]]['name'];}}}}else{if(this['channels'][_0x47925a['uniqueid']]){if(_0x47925a[_0x7721('0x4d')]==='6'){if(this[_0x7721('0x1d')][_0x47925a['channel'][_0x7721('0x4f')]('-')[0x0]]){this[_0x7721('0x3e')][_0x47925a[_0x7721('0x3c')]][_0x7721('0x6a')]=this['agents'][_0x47925a[_0x7721('0x45')][_0x7721('0x4f')]('-')[0x0]]['id'];this[_0x7721('0x3e')][_0x47925a[_0x7721('0x3c')]][_0x7721('0x6b')]=this['agents'][_0x47925a[_0x7721('0x45')][_0x7721('0x4f')]('-')[0x0]][_0x7721('0x51')];}}}}}}catch(_0x5f515e){logger['error'](_0x7721('0x6c'),_0x47925a[_0x7721('0x3c')],util[_0x7721('0x36')](_0x5f515e,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x7721('0x37')][_0x7721('0x6d')]=function(_0x52a614,_0x4ba35e){try{if(this[_0x7721('0x3e')][_0x52a614]){logger[_0x7721('0x31')](_0x7721('0x6e'),_0x52a614,_0x4ba35e);this[_0x7721('0x3e')][_0x52a614][_0x7721('0x6f')]=!![];if(_[_0x7721('0x70')](_0x4ba35e,_0x7721('0x71'))){_0x4ba35e=_0x4ba35e['replace'](_0x7721('0x71'),_0x7721('0x72'));}this[_0x7721('0x3e')][_0x52a614]['monitorFilename']=_0x4ba35e;var _0xdc60ee=_[_0x7721('0x73')](this[_0x7721('0x3e')][_0x52a614][_0x7721('0x74')],{'filename':_0x4ba35e});if(_['isNil'](_0xdc60ee)){this['channels'][_0x52a614][_0x7721('0x74')][_0x7721('0x75')]({'filename':_0x4ba35e,'createdAt':moment()[_0x7721('0x4a')](_0x7721('0x4b')),'mixmonitorid':'','status':_0x7721('0x76')});}}}catch(_0x2581b3){logger['error'](_0x7721('0x77'),_0x52a614,util[_0x7721('0x36')](_0x2581b3,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x7721('0x37')]['syncVarSet']=function(_0x3f68ae){try{if(this[_0x7721('0x42')](_0x3f68ae)){logger[_0x7721('0x3b')](_0x7721('0x78'),_0x3f68ae[_0x7721('0x3c')],util['inspect'](_0x3f68ae,{'showHidden':![],'depth':null}));if(this[_0x7721('0x3e')][_0x3f68ae['uniqueid']]&&_0x3f68ae[_0x7721('0x45')]!=_0x7721('0x54')){if(this[_0x7721('0x42')](_0x3f68ae[_0x7721('0x79')])){if(this[_0x7721('0x42')](_0x3f68ae[_0x7721('0x79')][_0x7721('0x7a')])){logger[_0x7721('0x31')](_0x7721('0x7b'),_0x3f68ae[_0x7721('0x3c')],_0x3f68ae[_0x7721('0x7c')]);this['syncMixMonitorFilename'](_0x3f68ae[_0x7721('0x3c')],_0x3f68ae[_0x7721('0x7c')]);}else if(this[_0x7721('0x42')](_0x3f68ae['variable'][_0x7721('0x7d')])){logger[_0x7721('0x31')](_0x7721('0x7e'),_0x3f68ae[_0x7721('0x3c')],_0x3f68ae[_0x7721('0x7c')]);this['channels'][_0x3f68ae[_0x7721('0x3c')]][_0x7721('0x3a')]=_0x3f68ae[_0x7721('0x7c')];}else if(this[_0x7721('0x42')](_0x3f68ae[_0x7721('0x79')][_0x7721('0x7f')])){logger['info'](_0x7721('0x80'),_0x3f68ae[_0x7721('0x3c')],_0x3f68ae['value']);this[_0x7721('0x3e')][_0x3f68ae['uniqueid']][_0x7721('0x81')]=_0x3f68ae[_0x7721('0x7c')];}else if(this['isNotNull'](_0x3f68ae[_0x7721('0x79')]['xmd-cdrtype'])){logger['info']('[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s',_0x3f68ae[_0x7721('0x3c')],_0x3f68ae[_0x7721('0x7c')]);this[_0x7721('0x3e')][_0x3f68ae['uniqueid']]['type']=_0x3f68ae['value'];}else if(this[_0x7721('0x42')](_0x3f68ae[_0x7721('0x79')][_0x7721('0x82')])){logger[_0x7721('0x31')](_0x7721('0x83'),_0x3f68ae[_0x7721('0x3c')],_0x3f68ae['value'][_0x7721('0x4f')](',')[0x0]);this[_0x7721('0x3e')][_0x3f68ae[_0x7721('0x3c')]][_0x7721('0x13')]=_0x3f68ae[_0x7721('0x7c')][_0x7721('0x4f')](',')[0x0];}else if(this[_0x7721('0x42')](_0x3f68ae[_0x7721('0x79')][_0x7721('0x84')])){logger[_0x7721('0x31')](_0x7721('0x85'),_0x3f68ae[_0x7721('0x3c')],_0x3f68ae['value']);this['channels'][_0x3f68ae[_0x7721('0x3c')]][_0x7721('0x86')]=_0x3f68ae['value'];}else if(this[_0x7721('0x42')](_0x3f68ae['variable']['xmd-destination'])){logger[_0x7721('0x31')]('[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s',_0x3f68ae['uniqueid'],_0x3f68ae[_0x7721('0x7c')]);this[_0x7721('0x3e')][_0x3f68ae[_0x7721('0x3c')]][_0x7721('0x87')]=_0x3f68ae[_0x7721('0x7c')];}else if(this['isNotNull'](_0x3f68ae[_0x7721('0x79')][_0x7721('0x88')])){logger[_0x7721('0x31')](_0x7721('0x89'),_0x3f68ae['uniqueid'],_0x3f68ae['value']);this[_0x7721('0x3e')][_0x3f68ae[_0x7721('0x3c')]]['calleridpreview']=_0x3f68ae[_0x7721('0x7c')];}else if(this[_0x7721('0x42')](_0x3f68ae['variable']['xmcs-queue'])){logger[_0x7721('0x31')](_0x7721('0x8a'),_0x3f68ae[_0x7721('0x3c')],_0x3f68ae[_0x7721('0x7c')]);this[_0x7721('0x3e')][_0x3f68ae[_0x7721('0x3c')]][_0x7721('0x13')]=_0x3f68ae[_0x7721('0x7c')];}else if(this['isNotNull'](_0x3f68ae[_0x7721('0x79')][_0x7721('0x8b')])){logger[_0x7721('0x31')](_0x7721('0x8c'),_0x3f68ae[_0x7721('0x3c')],_0x3f68ae[_0x7721('0x7c')]);this[_0x7721('0x3e')][_0x3f68ae['uniqueid']][_0x7721('0x8d')]=_0x3f68ae[_0x7721('0x7c')];}}}else if(this['isNotNull'](_0x3f68ae[_0x7721('0x79')][_0x7721('0x7a')])){if(_0x3f68ae[_0x7721('0x7c')]){var _0xb8547a=path[_0x7721('0x8e')](_0x3f68ae[_0x7721('0x7c')])[_0x7721('0x51')];logger[_0x7721('0x31')](_0x7721('0x7b'),_0xb8547a,_0x3f68ae[_0x7721('0x7c')]);this['syncMixMonitorFilename'](_0xb8547a,_0x3f68ae[_0x7721('0x7c')]);}}else if(this[_0x7721('0x3e')][_0x3f68ae[_0x7721('0x44')]]){if(this[_0x7721('0x42')](_0x3f68ae[_0x7721('0x79')])){if(this[_0x7721('0x42')](_0x3f68ae[_0x7721('0x79')][_0x7721('0x8b')])){logger[_0x7721('0x31')](_0x7721('0x8c'),_0x3f68ae[_0x7721('0x44')],_0x3f68ae[_0x7721('0x7c')]);this[_0x7721('0x3e')][_0x3f68ae[_0x7721('0x44')]][_0x7721('0x8f')]=_0x3f68ae[_0x7721('0x7c')];}}}}}catch(_0xea9824){logger[_0x7721('0x34')](_0x7721('0x90'),_0x3f68ae[_0x7721('0x3c')],util['inspect'](_0xea9824,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x7721('0x37')]['syncHangup']=function(_0xacbefb){try{if(this[_0x7721('0x42')](_0xacbefb)){logger[_0x7721('0x3b')](_0x7721('0x91'),_0xacbefb[_0x7721('0x3c')],util['inspect'](_0xacbefb,{'showHidden':![],'depth':null}));if(this['channels'][_0xacbefb['uniqueid']]){logger['info'](_0x7721('0x92'),_0xacbefb[_0x7721('0x3c')],_0xacbefb[_0x7721('0x93')]);var _0x43e4ff=moment();this[_0x7721('0x3e')][_0xacbefb['uniqueid']][_0x7721('0x94')]=_0x43e4ff['format'](_0x7721('0x4b'));this[_0x7721('0x3e')][_0xacbefb[_0x7721('0x3c')]][_0x7721('0x58')]=_0x43e4ff[_0x7721('0x63')](this[_0x7721('0x3e')][_0xacbefb['uniqueid']][_0x7721('0x49')],'seconds');if(this['channels'][_0xacbefb[_0x7721('0x3c')]][_0x7721('0x60')]){this[_0x7721('0x3e')][_0xacbefb[_0x7721('0x3c')]][_0x7721('0x95')]=_0x43e4ff['diff'](this[_0x7721('0x3e')][_0xacbefb[_0x7721('0x3c')]][_0x7721('0x61')],_0x7721('0x5a'));this[_0x7721('0x3e')][_0xacbefb[_0x7721('0x3c')]][_0x7721('0x62')]=this['channels'][_0xacbefb[_0x7721('0x3c')]][_0x7721('0x58')]-this[_0x7721('0x3e')][_0xacbefb[_0x7721('0x3c')]][_0x7721('0x95')];}if(_0xacbefb['context']===_0x7721('0x4e')){if(this[_0x7721('0x1d')][_0xacbefb[_0x7721('0x45')]['split']('-')[0x0]]){this[_0x7721('0x1d')][_0xacbefb[_0x7721('0x45')]['split']('-')[0x0]]=_[_0x7721('0x96')](this[_0x7721('0x1d')][_0xacbefb[_0x7721('0x45')][_0x7721('0x4f')]('-')[0x0]],['destconnectedlinenum']);logger[_0x7721('0x3b')]('[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:',_0xacbefb[_0x7721('0x3c')],util[_0x7721('0x36')]({'destaccountcode':this['agents'][_0xacbefb[_0x7721('0x45')][_0x7721('0x4f')]('-')[0x0]]['accountcode']},{'showHidden':![],'depth':null}));this[_0x7721('0x38')](util[_0x7721('0x4a')]('user:%s',this[_0x7721('0x1d')][_0xacbefb['channel'][_0x7721('0x4f')]('-')[0x0]][_0x7721('0x51')]),_0x7721('0x97'),{'destaccountcode':this['agents'][_0xacbefb[_0x7721('0x45')]['split']('-')[0x0]]['accountcode']});}}var _0x287d61=this;Promise[_0x7721('0x98')]()[_0x7721('0x99')](function(){var _0x335852=_0x287d61[_0x7721('0x3e')][_0xacbefb['uniqueid']];if(typeof _0x335852[_0x7721('0x9a')]===_0x7721('0x9b'))return;if(_[_0x7721('0x9c')](_0x335852[_0x7721('0x74')]))return;return RpcSetting[_0x7721('0x9d')]()['then'](function(_0x22f899){if(!_0x22f899['stopRecordingOnTransfer'])return;return Promise[_0x7721('0x98')]()['then'](function(){return ami['Action']({'action':_0x7721('0x9e'),'channel':_0x335852['channel']})['catch'](function(){});})[_0x7721('0x99')](function(){return ami[_0x7721('0x9f')]({'action':_0x7721('0x9e'),'channel':_0x335852['destinationchannel']})[_0x7721('0xa0')](function(){})['finally'](function(){var _0x4ac09d=_0x287d61['agents'][_0x335852[_0x7721('0x68')][_0x7721('0x4f')]('-')[0x0]];if(!_0x4ac09d)return;io[_0x7721('0x38')](_0x7721('0xa1'),{'agentId':_0x4ac09d['id'],'uniqueid':_0x335852[_0x7721('0x3c')]});});});});})[_0x7721('0x99')](function(){if(_0xacbefb[_0x7721('0xa2')]===_0x7721('0xa3')){_0x287d61[_0x7721('0x1e')][_0xacbefb[_0x7721('0x3c')]]=_0x287d61[_0x7721('0x3e')][_0xacbefb['uniqueid']];}else{if(_0x287d61[_0x7721('0x3e')][_0xacbefb[_0x7721('0x3c')]][_0x7721('0xa4')]===_0x7721('0xa5')&&_0x287d61[_0x7721('0x1e')][_0xacbefb[_0x7721('0x3c')]]){_0x287d61[_0x7721('0x3e')][_0xacbefb['uniqueid']]['uniqueid']=[_0x287d61[_0x7721('0x3e')][_0xacbefb[_0x7721('0x3c')]][_0x7721('0x44')],_0x287d61[_0x7721('0x3e')][_0xacbefb['uniqueid']][_0x7721('0x44')]=_0x287d61['channels'][_0xacbefb[_0x7721('0x3c')]]['uniqueid']][0x0];delete _0x287d61[_0x7721('0x1e')][_0xacbefb[_0x7721('0x3c')]];}}logger[_0x7721('0x3b')](_0x7721('0xa6'),_0xacbefb[_0x7721('0x3c')],util[_0x7721('0x36')](_0x287d61['channels'][_0xacbefb['uniqueid']],{'showHidden':![],'depth':null}));ami['emit'](_0x7721('0xa7'),_0x287d61['channels'][_0xacbefb[_0x7721('0x3c')]]);delete _0x287d61[_0x7721('0x3e')][_0xacbefb['uniqueid']];});}}}catch(_0x340926){logger[_0x7721('0x34')](_0x7721('0xa8'),_0xacbefb['uniqueid'],util[_0x7721('0x36')](_0x340926,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x7721('0x37')]['syncAttendedTransfer']=function(_0x483a1e){try{if(this[_0x7721('0x42')](_0x483a1e)){logger[_0x7721('0x31')]('[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s',_0x483a1e[_0x7721('0x3c')],_0x483a1e[_0x7721('0xa9')],_0x483a1e['transfertargetcalleridnum']);logger['debug']('[%s][voiceCallReport][attendedtransfer]\x20event:',_0x483a1e['uniqueid'],util[_0x7721('0x36')](_0x483a1e,{'showHidden':![],'depth':null}));if(this[_0x7721('0x3e')][_0x483a1e[_0x7721('0xaa')]]){this['channels'][_0x483a1e['transfereeuniqueid']][_0x7721('0xab')]=_0x483a1e[_0x7721('0xa9')];this[_0x7721('0x3e')][_0x483a1e[_0x7721('0xaa')]][_0x7721('0xac')]=_0x483a1e[_0x7721('0xad')];if(this[_0x7721('0x3e')][_0x483a1e[_0x7721('0xae')]]){var _0x315093=this['channels'][_0x483a1e['secondtransfereruniqueid']];this[_0x7721('0x3e')][_0x483a1e['secondtransfereruniqueid']]=this[_0x7721('0x3e')][_0x483a1e['transfereeuniqueid']];this[_0x7721('0x3e')][_0x483a1e['transfereeuniqueid']]=_0x315093;}}else if(this[_0x7721('0x3e')][_0x483a1e[_0x7721('0xaf')]]){this['channels'][_0x483a1e['transfertargetuniqueid']][_0x7721('0xab')]=_0x483a1e[_0x7721('0xa9')];this[_0x7721('0x3e')][_0x483a1e[_0x7721('0xaf')]][_0x7721('0xac')]=_0x483a1e['transfertargetcalleridnum'];if(this[_0x7721('0x3e')][_0x483a1e[_0x7721('0xb0')]]){var _0x315093=this['channels'][_0x483a1e[_0x7721('0xb0')]];this[_0x7721('0x3e')][_0x483a1e[_0x7721('0xb0')]]=this[_0x7721('0x3e')][_0x483a1e[_0x7721('0xaf')]];this[_0x7721('0x3e')][_0x483a1e[_0x7721('0xaf')]]=_0x315093;}}if((this[_0x7721('0x3e')][_0x483a1e[_0x7721('0xb0')]]||this[_0x7721('0x3e')][_0x483a1e[_0x7721('0xb1')]])&&this['channels'][_0x483a1e[_0x7721('0xae')]]){var _0x3e319e=_[_0x7721('0xb2')]([this[_0x7721('0x3e')][_0x483a1e[_0x7721('0xb0')]],this[_0x7721('0x3e')][_0x483a1e[_0x7721('0xb1')]],this['channels'][_0x483a1e[_0x7721('0xae')]]],function(_0x5391c3){return _0x5391c3&&_0x5391c3[_0x7721('0xa4')]===_0x7721('0xa5')&&_0x5391c3[_0x7721('0xb3')];});if(_0x3e319e){if(this[_0x7721('0x3e')][_0x483a1e[_0x7721('0xb0')]])this[_0x7721('0x3e')][_0x483a1e['origtransfereruniqueid']][_0x7721('0x9a')]='ATTENDED';if(this[_0x7721('0x3e')][_0x483a1e[_0x7721('0xb1')]])this[_0x7721('0x3e')][_0x483a1e['origtransfererlinkedid']][_0x7721('0x9a')]=_0x7721('0xb4');this[_0x7721('0x3e')][_0x483a1e[_0x7721('0xae')]]['transferType']=_0x7721('0xb4');}}}}catch(_0x767a4c){logger[_0x7721('0x34')](_0x7721('0xb5'),_0x483a1e['uniqueid'],util[_0x7721('0x36')](_0x767a4c,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x7721('0x37')][_0x7721('0x2d')]=function(_0x11acd6){try{if(this['isNotNull'](_0x11acd6)){logger[_0x7721('0x31')](_0x7721('0xb6'),_0x11acd6[_0x7721('0x3c')],_0x11acd6[_0x7721('0xb7')],_0x11acd6[_0x7721('0xb8')]);logger[_0x7721('0x3b')](_0x7721('0xb9'),_0x11acd6[_0x7721('0x3c')],util[_0x7721('0x36')](_0x11acd6,{'showHidden':![],'depth':null}));if(this['channels'][_0x11acd6[_0x7721('0xaa')]]){this[_0x7721('0x3e')][_0x11acd6[_0x7721('0xaa')]][_0x7721('0xab')]=_0x11acd6[_0x7721('0xb7')];this[_0x7721('0x3e')][_0x11acd6[_0x7721('0xaa')]][_0x7721('0xac')]=_0x11acd6[_0x7721('0xb8')];this[_0x7721('0x3e')][_0x11acd6[_0x7721('0xaa')]][_0x7721('0x9a')]=_0x7721('0xba');this[_0x7721('0xbb')]({'event':_0x7721('0xa3'),'uniqueid':_0x11acd6[_0x7721('0xaa')],'context':_0x11acd6['context'],'channel':_0x11acd6[_0x7721('0xbc')]});}else{this[_0x7721('0x3e')][_0x11acd6[_0x7721('0xbd')]][_0x7721('0x9a')]=_0x7721('0xba');}}}catch(_0x857c38){logger[_0x7721('0x34')](_0x7721('0xbe'),_0x11acd6[_0x7721('0x3c')],util[_0x7721('0x36')](_0x857c38,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x7721('0x37')][_0x7721('0x2f')]=function(_0x5ea8a2){try{if(this['isNotNull'](_0x5ea8a2)){logger[_0x7721('0x3b')](_0x7721('0xbf'),_0x5ea8a2[_0x7721('0x3c')],util[_0x7721('0x36')](_0x5ea8a2,{'showHidden':![],'depth':null}));if(this[_0x7721('0x3e')][_0x5ea8a2['uniqueid']]){if(!_[_0x7721('0xc0')](this[_0x7721('0x3e')][_0x5ea8a2[_0x7721('0x3c')]][_0x7721('0x61')])){this[_0x7721('0x3e')][_0x5ea8a2[_0x7721('0x3c')]][_0x7721('0xc1')]=moment()[_0x7721('0x4a')](_0x7721('0x4b'));logger[_0x7721('0x31')](_0x7721('0xc2'),_0x5ea8a2[_0x7721('0x3c')],this['channels'][_0x5ea8a2[_0x7721('0x3c')]][_0x7721('0xc1')]);}}}}catch(_0x16e0cd){logger['error'](_0x7721('0xc3'),_0x5ea8a2[_0x7721('0x3c')],util[_0x7721('0x36')](_0x16e0cd,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x7721('0xc4')]=function(_0x48b8b6){try{if(this['isNotNull'](_0x48b8b6)){logger[_0x7721('0x3b')](_0x7721('0xc5'),_0x48b8b6[_0x7721('0x3c')],util[_0x7721('0x36')](_0x48b8b6,{'showHidden':![],'depth':null}));if(this['channels'][_0x48b8b6[_0x7721('0x3c')]]){if(!_[_0x7721('0xc0')](this[_0x7721('0x3e')][_0x48b8b6[_0x7721('0x3c')]][_0x7721('0xc1')])){this['channels'][_0x48b8b6[_0x7721('0x3c')]][_0x7721('0xc6')]+=moment()[_0x7721('0xc7')](0x0)[_0x7721('0x63')](this[_0x7721('0x3e')][_0x48b8b6[_0x7721('0x3c')]][_0x7721('0xc1')],_0x7721('0x5a'));logger[_0x7721('0x31')](_0x7721('0xc8'),_0x48b8b6[_0x7721('0x3c')],this[_0x7721('0x3e')][_0x48b8b6[_0x7721('0x3c')]][_0x7721('0xc6')]);delete this[_0x7721('0x3e')][_0x48b8b6[_0x7721('0x3c')]][_0x7721('0xc1')];}}}}catch(_0x344dc3){logger[_0x7721('0x34')](_0x7721('0xc9'),_0x48b8b6[_0x7721('0x3c')],util[_0x7721('0x36')](_0x344dc3,{'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 165c6c4..948a0b6 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 _0x7398=['channel','substring','lastIndexOf','omit','event','privilege','info','[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called','membername','interface','voice:outbound','voice_outbound_channel:save','[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:','custom:dialbegin','error','[%s][voiceDialReport][dialbegin]','[%s][voiceDialReport][dialend]\x20event:','dialstatus','ANSWER','connectedlinenum','connectedlinename','answertime','lastevent','connect','[%s][voiceDialReport][dialend]\x20agent:%s\x20lastevent:connect','custom:dialconnect','[%s][voiceDialReport][dialend]','[%s][voiceDialReport][varset]\x20event:','addVariable','keys','variable','outboundrouteid','value','[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s','[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:','[%s][voiceDialReport][varset]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberlastcall','memberpenalty','memberrealtime','isNil','includes','isUndefined','syncHangup','[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete','diff','seconds','complete','total','answered','holdtime','starttime','billableseconds','sumHoldTime','sumBillable','[%s][voiceDialReport][hangup]\x20sending\x20voiceDialReport\x20event:','custom:voiceDialReport','custom:dialend','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound:save\x20event:','voice_outbound:save','[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound_channel:remove\x20event:','voice_outbound_channel:remove','linkedid','destuniqueid','[%s][voiceDialReport][hangup]','exports','lodash','moment','util','../../../config/environment','ami','../ami','redis','defaults','localhost','socket.io-emitter','channels','outboundChannels','outbound','variables','dialbegin','syncDialBegin','bind','dialend','syncDialEnd','varset','syncVarSet','hangup','prototype','isNotNull','emit','debug','[%s][voiceDialReport][dialbegin]\x20event:','uniqueid','inspect','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x16f5d5,_0x184bb0){var _0x1b9f8c=function(_0x224d6d){while(--_0x224d6d){_0x16f5d5['push'](_0x16f5d5['shift']());}};_0x1b9f8c(++_0x184bb0);}(_0x7398,0x12b));var _0x8739=function(_0x3d42d8,_0x4cffaa){_0x3d42d8=_0x3d42d8-0x0;var _0x27fc41=_0x7398[_0x3d42d8];return _0x27fc41;};'use strict';var _=require(_0x8739('0x0'));var moment=require(_0x8739('0x1'));var util=require(_0x8739('0x2'));var Redis=require('ioredis');var config=require(_0x8739('0x3'));var logger=require('../../../config/logger')(_0x8739('0x4'));var ami=require(_0x8739('0x5'));config[_0x8739('0x6')]=_[_0x8739('0x7')](config['redis'],{'host':_0x8739('0x8'),'port':0x18eb});var io=require(_0x8739('0x9'))(new Redis(config[_0x8739('0x6')]));function VoiceDialReport(_0x4ebfc2){this[_0x8739('0xa')]=_0x4ebfc2[_0x8739('0xb')];this[_0x8739('0xc')]=_0x4ebfc2[_0x8739('0xc')];this[_0x8739('0xd')]={};ami['on'](_0x8739('0xe'),this[_0x8739('0xf')][_0x8739('0x10')](this));ami['on'](_0x8739('0x11'),this[_0x8739('0x12')][_0x8739('0x10')](this));ami['on'](_0x8739('0x13'),this[_0x8739('0x14')]['bind'](this));ami['on'](_0x8739('0x15'),this['syncHangup'][_0x8739('0x10')](this));}VoiceDialReport[_0x8739('0x16')][_0x8739('0x17')]=function(_0x2ea462){return _0x2ea462!==null&&!_['isUndefined'](_0x2ea462);};VoiceDialReport[_0x8739('0x16')][_0x8739('0x18')]=function(_0x182bbe,_0x182627,_0x295bf1){io['to'](_0x182bbe)[_0x8739('0x18')](_0x182627,_0x295bf1);};VoiceDialReport['prototype'][_0x8739('0xf')]=function(_0x46b7b4){try{if(this[_0x8739('0x17')](_0x46b7b4)){logger[_0x8739('0x19')](_0x8739('0x1a'),_0x46b7b4[_0x8739('0x1b')],util[_0x8739('0x1c')](_0x46b7b4,{'showHidden':![],'depth':null}));if(this[_0x8739('0xa')][_0x46b7b4[_0x8739('0x1b')]]){_['merge'](this[_0x8739('0xa')][_0x46b7b4['uniqueid']],{'starttime':moment()[_0x8739('0x1d')](_0x8739('0x1e')),'lastevent':'called','interface':_0x46b7b4[_0x8739('0x1f')][_0x8739('0x20')](0x0,_0x46b7b4[_0x8739('0x1f')]['lastIndexOf']('-')),'membername':_0x46b7b4[_0x8739('0x1f')][_0x8739('0x20')](_0x46b7b4[_0x8739('0x1f')][_0x8739('0x21')]('/')+0x1,_0x46b7b4['channel']['lastIndexOf']('-'))},_[_0x8739('0x22')](_0x46b7b4,[_0x8739('0x23'),_0x8739('0x24')]));logger[_0x8739('0x25')](_0x8739('0x26'),_0x46b7b4['uniqueid'],this[_0x8739('0xa')][_0x46b7b4['uniqueid']][_0x8739('0x27')],this['channels'][_0x46b7b4['uniqueid']][_0x8739('0x28')]);logger['debug']('[%s][voiceDialReport][dialbegin]\x20sending\x20voice_outbound_channel:save\x20event:',_0x46b7b4['uniqueid'],util[_0x8739('0x1c')](this[_0x8739('0xa')][_0x46b7b4[_0x8739('0x1b')]],{'showHidden':![],'depth':null}));this['emit'](_0x8739('0x29'),_0x8739('0x2a'),this[_0x8739('0xa')][_0x46b7b4['uniqueid']]);logger['debug'](_0x8739('0x2b'),_0x46b7b4[_0x8739('0x1b')],util[_0x8739('0x1c')](this[_0x8739('0xa')][_0x46b7b4['uniqueid']],{'showHidden':![],'depth':null}));ami[_0x8739('0x18')](_0x8739('0x2c'),this[_0x8739('0xa')][_0x46b7b4[_0x8739('0x1b')]]);}}}catch(_0x5dd335){logger[_0x8739('0x2d')](_0x8739('0x2e'),_0x46b7b4[_0x8739('0x1b')],util[_0x8739('0x1c')](_0x5dd335,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x8739('0x16')]['syncDialEnd']=function(_0xc062a8){try{if(this[_0x8739('0x17')](_0xc062a8)){logger['debug'](_0x8739('0x2f'),_0xc062a8['uniqueid'],util['inspect'](_0xc062a8,{'showHidden':![],'depth':null}));if(this['channels'][_0xc062a8['uniqueid']]){this[_0x8739('0xa')][_0xc062a8['uniqueid']][_0x8739('0x30')]=_0xc062a8[_0x8739('0x30')];if(_0xc062a8[_0x8739('0x30')]===_0x8739('0x31')){this[_0x8739('0xa')][_0xc062a8[_0x8739('0x1b')]][_0x8739('0x32')]=_0xc062a8[_0x8739('0x32')];this[_0x8739('0xa')][_0xc062a8[_0x8739('0x1b')]]['connectedlinename']=_0xc062a8[_0x8739('0x33')];this[_0x8739('0xa')][_0xc062a8[_0x8739('0x1b')]][_0x8739('0x34')]=moment()[_0x8739('0x1d')](_0x8739('0x1e'));this['channels'][_0xc062a8[_0x8739('0x1b')]][_0x8739('0x35')]=_0x8739('0x36');logger[_0x8739('0x25')](_0x8739('0x37'),_0xc062a8[_0x8739('0x1b')],_0xc062a8[_0x8739('0x1f')][_0x8739('0x20')](_0xc062a8[_0x8739('0x1f')][_0x8739('0x21')]('/')+0x1,_0xc062a8[_0x8739('0x1f')][_0x8739('0x21')]('-')));logger[_0x8739('0x19')]('[%s][voiceDialReport][dialend]\x20sending\x20dialconnect\x20event:',_0xc062a8[_0x8739('0x1b')],util['inspect'](this[_0x8739('0xa')][_0xc062a8['uniqueid']],{'showHidden':![],'depth':null}));ami[_0x8739('0x18')](_0x8739('0x38'),this['channels'][_0xc062a8[_0x8739('0x1b')]]);}logger['debug']('[%s][voiceDialReport][dialend]\x20sending\x20voice_outbound_channel:save\x20event:',_0xc062a8['uniqueid'],util[_0x8739('0x1c')](this[_0x8739('0xa')][_0xc062a8[_0x8739('0x1b')]],{'showHidden':![],'depth':null}));this['emit'](_0x8739('0x29'),'voice_outbound_channel:save',this[_0x8739('0xa')][_0xc062a8[_0x8739('0x1b')]]);}}}catch(_0x1ace05){logger['error'](_0x8739('0x39'),_0xc062a8[_0x8739('0x1b')],util[_0x8739('0x1c')](_0x1ace05,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x8739('0x16')][_0x8739('0x14')]=function(_0x1f7203){try{if(this[_0x8739('0x17')](_0x1f7203)){logger[_0x8739('0x19')](_0x8739('0x3a'),_0x1f7203[_0x8739('0x1b')],util[_0x8739('0x1c')](_0x1f7203,{'showHidden':![],'depth':null}));this[_0x8739('0x3b')](_0x1f7203[_0x8739('0x1b')],_[_0x8739('0x3c')](_0x1f7203[_0x8739('0x3d')])[0x0],_0x1f7203['value']);if(this[_0x8739('0x17')](_0x1f7203['variable'])&&this[_0x8739('0x17')](_0x1f7203['variable'][_0x8739('0x3e')])){if(_['isUndefined'](this['channels'][_0x1f7203[_0x8739('0x1b')]])){this[_0x8739('0xa')][_0x1f7203[_0x8739('0x1b')]]={'routeId':_0x1f7203[_0x8739('0x3f')],'variables':this['variables'][_0x1f7203[_0x8739('0x1b')]]};logger[_0x8739('0x25')](_0x8739('0x40'),_0x1f7203[_0x8739('0x1b')],_0x1f7203[_0x8739('0x3d')][_0x8739('0x3e')],_[_0x8739('0x3c')](_0x1f7203[_0x8739('0x3d')])[0x0],_0x1f7203[_0x8739('0x3f')]);logger[_0x8739('0x19')](_0x8739('0x41'),_0x1f7203[_0x8739('0x1b')],util[_0x8739('0x1c')](this[_0x8739('0xa')][_0x1f7203[_0x8739('0x1b')]],{'showHidden':![],'depth':null}));this['emit'](_0x8739('0x29'),_0x8739('0x2a'),this[_0x8739('0xa')][_0x1f7203[_0x8739('0x1b')]]);}}}}catch(_0x484965){logger['error'](_0x8739('0x42'),_0x1f7203['uniqueid'],util[_0x8739('0x1c')](_0x484965,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x8739('0x16')]['addVariable']=function(_0x34533d,_0x321830,_0x425402){var _0x2bfe22=[_0x8739('0x43'),_0x8739('0x44'),_0x8739('0x45'),_0x8739('0x46'),_0x8739('0x47'),'rtpaudioqoslossbridged',_0x8739('0x48'),_0x8739('0x49'),_0x8739('0x4a'),_0x8739('0x4b'),_0x8739('0x4c'),_0x8739('0x4d'),_0x8739('0x4e'),_0x8739('0x4f'),'memberinterface',_0x8739('0x50'),_0x8739('0x27'),_0x8739('0x51'),_0x8739('0x52')];if(!_[_0x8739('0x53')](_0x321830)&&!_[_0x8739('0x54')](_0x2bfe22,_0x321830)){if(_[_0x8739('0x55')](this[_0x8739('0xd')][_0x34533d])){this[_0x8739('0xd')][_0x34533d]={};}this['variables'][_0x34533d][_0x321830]=_0x425402;}};VoiceDialReport[_0x8739('0x16')][_0x8739('0x56')]=function(_0x25cdc7){try{if(this[_0x8739('0x17')](_0x25cdc7)){logger['debug']('[%s][voiceDialReport][hangup]\x20event:',_0x25cdc7[_0x8739('0x1b')],util[_0x8739('0x1c')](_0x25cdc7,{'showHidden':![],'depth':null}));if(this[_0x8739('0xa')][_0x25cdc7[_0x8739('0x1b')]]){logger[_0x8739('0x25')](_0x8739('0x57'),_0x25cdc7[_0x8739('0x1b')],_0x25cdc7['cause-txt']);this[_0x8739('0xa')][_0x25cdc7[_0x8739('0x1b')]]['endtime']=moment()[_0x8739('0x1d')](_0x8739('0x1e'));this['channels'][_0x25cdc7[_0x8739('0x1b')]]['duration']=moment(this[_0x8739('0xa')][_0x25cdc7['uniqueid']]['endtime'])[_0x8739('0x58')](this['channels'][_0x25cdc7['uniqueid']]['starttime'],_0x8739('0x59'));this['channels'][_0x25cdc7[_0x8739('0x1b')]][_0x8739('0x35')]=_0x8739('0x5a');this[_0x8739('0xc')][_0x8739('0x5b')]+=0x1;if(this[_0x8739('0xa')][_0x25cdc7['uniqueid']][_0x8739('0x34')]){this[_0x8739('0xc')][_0x8739('0x5c')]+=0x1;this[_0x8739('0xa')][_0x25cdc7[_0x8739('0x1b')]][_0x8739('0x5d')]=moment(this[_0x8739('0xa')][_0x25cdc7[_0x8739('0x1b')]][_0x8739('0x34')])[_0x8739('0x58')](this[_0x8739('0xa')][_0x25cdc7['uniqueid']][_0x8739('0x5e')],_0x8739('0x59'));this[_0x8739('0xa')][_0x25cdc7[_0x8739('0x1b')]][_0x8739('0x5f')]=moment(this[_0x8739('0xa')][_0x25cdc7[_0x8739('0x1b')]]['endtime'])['diff'](this['channels'][_0x25cdc7[_0x8739('0x1b')]]['answertime'],_0x8739('0x59'));this[_0x8739('0xc')][_0x8739('0x60')]+=this['channels'][_0x25cdc7[_0x8739('0x1b')]][_0x8739('0x5d')]||0x0;this[_0x8739('0xc')][_0x8739('0x61')]+=this['channels'][_0x25cdc7[_0x8739('0x1b')]][_0x8739('0x5f')];}this[_0x8739('0xc')]['sumDuration']+=this['channels'][_0x25cdc7[_0x8739('0x1b')]]['duration'];logger[_0x8739('0x19')](_0x8739('0x62'),_0x25cdc7['uniqueid'],util[_0x8739('0x1c')](this[_0x8739('0xa')][_0x25cdc7[_0x8739('0x1b')]],{'showHidden':![],'depth':null}));ami['emit'](_0x8739('0x63'),this[_0x8739('0xa')][_0x25cdc7[_0x8739('0x1b')]]);logger[_0x8739('0x19')]('[%s][voiceDialReport][hangup]\x20sending\x20dialend\x20event:',_0x25cdc7[_0x8739('0x1b')],util[_0x8739('0x1c')](this[_0x8739('0xa')][_0x25cdc7[_0x8739('0x1b')]],{'showHidden':![],'depth':null}));ami[_0x8739('0x18')](_0x8739('0x64'),this[_0x8739('0xa')][_0x25cdc7[_0x8739('0x1b')]]);logger['debug'](_0x8739('0x65'),_0x25cdc7[_0x8739('0x1b')],util[_0x8739('0x1c')](this[_0x8739('0xa')][_0x25cdc7[_0x8739('0x1b')]],{'showHidden':![],'depth':null}));this[_0x8739('0x18')](_0x8739('0x29'),_0x8739('0x66'),this[_0x8739('0xc')]);logger['info'](_0x8739('0x67'),JSON['stringify'](this[_0x8739('0xa')][_0x25cdc7[_0x8739('0x1b')]]));logger[_0x8739('0x19')](_0x8739('0x68'),_0x25cdc7['uniqueid'],util[_0x8739('0x1c')](this[_0x8739('0xa')][_0x25cdc7[_0x8739('0x1b')]],{'showHidden':![],'depth':null}));this['emit'](_0x8739('0x29'),_0x8739('0x69'),this[_0x8739('0xa')][_0x25cdc7[_0x8739('0x1b')]]);delete this[_0x8739('0xa')][_0x25cdc7[_0x8739('0x1b')]];}else if(this[_0x8739('0xa')][_0x25cdc7[_0x8739('0x6a')]]){this[_0x8739('0xa')][_0x25cdc7['linkedid']][_0x8739('0x1b')]=this[_0x8739('0xa')][_0x25cdc7[_0x8739('0x6a')]][_0x8739('0x6b')];}if(this[_0x8739('0xd')][_0x25cdc7[_0x8739('0x1b')]]){delete this['variables'][_0x25cdc7[_0x8739('0x1b')]];}}}catch(_0xb17fca){logger[_0x8739('0x2d')](_0x8739('0x6c'),_0x25cdc7[_0x8739('0x1b')],util[_0x8739('0x1c')](_0xb17fca,{'showHidden':![],'depth':null}));}};module[_0x8739('0x6d')]=VoiceDialReport; \ No newline at end of file +var _0x7f89=['rtpaudioqosrtt','rtpaudioqosrttbridged','bridgepeer','bridgepvtcallid','memberdynamic','memberlastcall','memberpenalty','memberrealtime','isNil','includes','[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete','cause-txt','endtime','duration','starttime','seconds','holdtime','diff','sumHoldTime','sumBillable','billableseconds','sumDuration','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:','linkedid','destuniqueid','[%s][voiceDialReport][hangup]','exports','moment','util','../../../config/environment','ami','../ami','redis','defaults','localhost','socket.io-emitter','channels','outboundChannels','outbound','variables','dialbegin','bind','dialend','syncDialEnd','varset','syncVarSet','hangup','prototype','isNotNull','isUndefined','emit','debug','[%s][voiceDialReport][dialbegin]\x20event:','uniqueid','inspect','YYYY-MM-DD\x20HH:mm:ss','called','substring','channel','lastIndexOf','privilege','info','membername','interface','[%s][voiceDialReport][dialbegin]\x20sending\x20voice_outbound_channel:save\x20event:','voice:outbound','voice_outbound_channel:save','[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:','error','dialstatus','connectedlinenum','connectedlinename','answertime','format','lastevent','connect','[%s][voiceDialReport][dialend]\x20agent:%s\x20lastevent:connect','[%s][voiceDialReport][dialend]\x20sending\x20voice_outbound_channel:save\x20event:','[%s][voiceDialReport][dialend]','[%s][voiceDialReport][varset]\x20event:','addVariable','keys','variable','value','outboundrouteid','[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s','[%s][voiceDialReport][varset]','rtpaudioqos','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged'];(function(_0x355fb0,_0x491add){var _0x207bcf=function(_0x41ff06){while(--_0x41ff06){_0x355fb0['push'](_0x355fb0['shift']());}};_0x207bcf(++_0x491add);}(_0x7f89,0xe8));var _0x97f8=function(_0x28b9dd,_0x2f2c7e){_0x28b9dd=_0x28b9dd-0x0;var _0x3c56ee=_0x7f89[_0x28b9dd];return _0x3c56ee;};'use strict';var _=require('lodash');var moment=require(_0x97f8('0x0'));var util=require(_0x97f8('0x1'));var Redis=require('ioredis');var config=require(_0x97f8('0x2'));var logger=require('../../../config/logger')(_0x97f8('0x3'));var ami=require(_0x97f8('0x4'));config[_0x97f8('0x5')]=_[_0x97f8('0x6')](config['redis'],{'host':_0x97f8('0x7'),'port':0x18eb});var io=require(_0x97f8('0x8'))(new Redis(config[_0x97f8('0x5')]));function VoiceDialReport(_0xdb861f){this[_0x97f8('0x9')]=_0xdb861f[_0x97f8('0xa')];this[_0x97f8('0xb')]=_0xdb861f[_0x97f8('0xb')];this[_0x97f8('0xc')]={};ami['on'](_0x97f8('0xd'),this['syncDialBegin'][_0x97f8('0xe')](this));ami['on'](_0x97f8('0xf'),this[_0x97f8('0x10')][_0x97f8('0xe')](this));ami['on'](_0x97f8('0x11'),this[_0x97f8('0x12')][_0x97f8('0xe')](this));ami['on'](_0x97f8('0x13'),this['syncHangup'][_0x97f8('0xe')](this));}VoiceDialReport[_0x97f8('0x14')][_0x97f8('0x15')]=function(_0x229b94){return _0x229b94!==null&&!_[_0x97f8('0x16')](_0x229b94);};VoiceDialReport[_0x97f8('0x14')][_0x97f8('0x17')]=function(_0x4e0e0f,_0x5334c9,_0x5a6c15){io['to'](_0x4e0e0f)['emit'](_0x5334c9,_0x5a6c15);};VoiceDialReport['prototype']['syncDialBegin']=function(_0x67bb40){try{if(this[_0x97f8('0x15')](_0x67bb40)){logger[_0x97f8('0x18')](_0x97f8('0x19'),_0x67bb40[_0x97f8('0x1a')],util[_0x97f8('0x1b')](_0x67bb40,{'showHidden':![],'depth':null}));if(this[_0x97f8('0x9')][_0x67bb40[_0x97f8('0x1a')]]){_['merge'](this[_0x97f8('0x9')][_0x67bb40[_0x97f8('0x1a')]],{'starttime':moment()['format'](_0x97f8('0x1c')),'lastevent':_0x97f8('0x1d'),'interface':_0x67bb40['channel'][_0x97f8('0x1e')](0x0,_0x67bb40[_0x97f8('0x1f')]['lastIndexOf']('-')),'membername':_0x67bb40[_0x97f8('0x1f')][_0x97f8('0x1e')](_0x67bb40[_0x97f8('0x1f')]['lastIndexOf']('/')+0x1,_0x67bb40['channel'][_0x97f8('0x20')]('-'))},_['omit'](_0x67bb40,['event',_0x97f8('0x21')]));logger[_0x97f8('0x22')]('[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called',_0x67bb40[_0x97f8('0x1a')],this[_0x97f8('0x9')][_0x67bb40[_0x97f8('0x1a')]][_0x97f8('0x23')],this[_0x97f8('0x9')][_0x67bb40['uniqueid']][_0x97f8('0x24')]);logger['debug'](_0x97f8('0x25'),_0x67bb40['uniqueid'],util[_0x97f8('0x1b')](this['channels'][_0x67bb40['uniqueid']],{'showHidden':![],'depth':null}));this[_0x97f8('0x17')](_0x97f8('0x26'),_0x97f8('0x27'),this[_0x97f8('0x9')][_0x67bb40['uniqueid']]);logger['debug'](_0x97f8('0x28'),_0x67bb40['uniqueid'],util[_0x97f8('0x1b')](this[_0x97f8('0x9')][_0x67bb40[_0x97f8('0x1a')]],{'showHidden':![],'depth':null}));ami[_0x97f8('0x17')]('custom:dialbegin',this[_0x97f8('0x9')][_0x67bb40[_0x97f8('0x1a')]]);}}}catch(_0x5f3f4d){logger[_0x97f8('0x29')]('[%s][voiceDialReport][dialbegin]',_0x67bb40['uniqueid'],util[_0x97f8('0x1b')](_0x5f3f4d,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x97f8('0x14')][_0x97f8('0x10')]=function(_0x1e70e8){try{if(this['isNotNull'](_0x1e70e8)){logger['debug']('[%s][voiceDialReport][dialend]\x20event:',_0x1e70e8[_0x97f8('0x1a')],util[_0x97f8('0x1b')](_0x1e70e8,{'showHidden':![],'depth':null}));if(this[_0x97f8('0x9')][_0x1e70e8[_0x97f8('0x1a')]]){this['channels'][_0x1e70e8[_0x97f8('0x1a')]][_0x97f8('0x2a')]=_0x1e70e8['dialstatus'];if(_0x1e70e8[_0x97f8('0x2a')]==='ANSWER'){this[_0x97f8('0x9')][_0x1e70e8[_0x97f8('0x1a')]][_0x97f8('0x2b')]=_0x1e70e8[_0x97f8('0x2b')];this['channels'][_0x1e70e8['uniqueid']]['connectedlinename']=_0x1e70e8[_0x97f8('0x2c')];this['channels'][_0x1e70e8['uniqueid']][_0x97f8('0x2d')]=moment()[_0x97f8('0x2e')](_0x97f8('0x1c'));this[_0x97f8('0x9')][_0x1e70e8['uniqueid']][_0x97f8('0x2f')]=_0x97f8('0x30');logger[_0x97f8('0x22')](_0x97f8('0x31'),_0x1e70e8[_0x97f8('0x1a')],_0x1e70e8['channel'][_0x97f8('0x1e')](_0x1e70e8[_0x97f8('0x1f')][_0x97f8('0x20')]('/')+0x1,_0x1e70e8['channel'][_0x97f8('0x20')]('-')));logger['debug']('[%s][voiceDialReport][dialend]\x20sending\x20dialconnect\x20event:',_0x1e70e8[_0x97f8('0x1a')],util[_0x97f8('0x1b')](this[_0x97f8('0x9')][_0x1e70e8[_0x97f8('0x1a')]],{'showHidden':![],'depth':null}));ami['emit']('custom:dialconnect',this[_0x97f8('0x9')][_0x1e70e8['uniqueid']]);}logger[_0x97f8('0x18')](_0x97f8('0x32'),_0x1e70e8[_0x97f8('0x1a')],util[_0x97f8('0x1b')](this[_0x97f8('0x9')][_0x1e70e8[_0x97f8('0x1a')]],{'showHidden':![],'depth':null}));this[_0x97f8('0x17')]('voice:outbound','voice_outbound_channel:save',this[_0x97f8('0x9')][_0x1e70e8['uniqueid']]);}}}catch(_0x3ec898){logger[_0x97f8('0x29')](_0x97f8('0x33'),_0x1e70e8['uniqueid'],util[_0x97f8('0x1b')](_0x3ec898,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype'][_0x97f8('0x12')]=function(_0x4785a2){try{if(this[_0x97f8('0x15')](_0x4785a2)){logger['debug'](_0x97f8('0x34'),_0x4785a2[_0x97f8('0x1a')],util[_0x97f8('0x1b')](_0x4785a2,{'showHidden':![],'depth':null}));this[_0x97f8('0x35')](_0x4785a2[_0x97f8('0x1a')],_[_0x97f8('0x36')](_0x4785a2[_0x97f8('0x37')])[0x0],_0x4785a2[_0x97f8('0x38')]);if(this[_0x97f8('0x15')](_0x4785a2[_0x97f8('0x37')])&&this['isNotNull'](_0x4785a2['variable'][_0x97f8('0x39')])){if(_['isUndefined'](this[_0x97f8('0x9')][_0x4785a2[_0x97f8('0x1a')]])){this[_0x97f8('0x9')][_0x4785a2[_0x97f8('0x1a')]]={'routeId':_0x4785a2[_0x97f8('0x38')],'variables':this[_0x97f8('0xc')][_0x4785a2[_0x97f8('0x1a')]]};logger[_0x97f8('0x22')](_0x97f8('0x3a'),_0x4785a2[_0x97f8('0x1a')],_0x4785a2[_0x97f8('0x37')]['outboundrouteid'],_[_0x97f8('0x36')](_0x4785a2['variable'])[0x0],_0x4785a2[_0x97f8('0x38')]);logger[_0x97f8('0x18')]('[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:',_0x4785a2[_0x97f8('0x1a')],util[_0x97f8('0x1b')](this[_0x97f8('0x9')][_0x4785a2[_0x97f8('0x1a')]],{'showHidden':![],'depth':null}));this[_0x97f8('0x17')](_0x97f8('0x26'),'voice_outbound_channel:save',this[_0x97f8('0x9')][_0x4785a2['uniqueid']]);}}}}catch(_0x4bea23){logger[_0x97f8('0x29')](_0x97f8('0x3b'),_0x4785a2['uniqueid'],util[_0x97f8('0x1b')](_0x4bea23,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype'][_0x97f8('0x35')]=function(_0x2dc146,_0x51eed7,_0x3870da){var _0x213b68=[_0x97f8('0x3c'),'rtpaudioqosbridged',_0x97f8('0x3d'),_0x97f8('0x3e'),_0x97f8('0x3f'),_0x97f8('0x40'),_0x97f8('0x41'),_0x97f8('0x42'),'sipcallid','sipuri',_0x97f8('0x43'),_0x97f8('0x44'),'membercalls',_0x97f8('0x45'),'memberinterface',_0x97f8('0x46'),'membername',_0x97f8('0x47'),_0x97f8('0x48')];if(!_[_0x97f8('0x49')](_0x51eed7)&&!_[_0x97f8('0x4a')](_0x213b68,_0x51eed7)){if(_[_0x97f8('0x16')](this[_0x97f8('0xc')][_0x2dc146])){this[_0x97f8('0xc')][_0x2dc146]={};}this[_0x97f8('0xc')][_0x2dc146][_0x51eed7]=_0x3870da;}};VoiceDialReport[_0x97f8('0x14')]['syncHangup']=function(_0x13f091){try{if(this['isNotNull'](_0x13f091)){logger[_0x97f8('0x18')]('[%s][voiceDialReport][hangup]\x20event:',_0x13f091['uniqueid'],util[_0x97f8('0x1b')](_0x13f091,{'showHidden':![],'depth':null}));if(this[_0x97f8('0x9')][_0x13f091[_0x97f8('0x1a')]]){logger[_0x97f8('0x22')](_0x97f8('0x4b'),_0x13f091[_0x97f8('0x1a')],_0x13f091[_0x97f8('0x4c')]);this[_0x97f8('0x9')][_0x13f091[_0x97f8('0x1a')]][_0x97f8('0x4d')]=moment()[_0x97f8('0x2e')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x97f8('0x9')][_0x13f091[_0x97f8('0x1a')]][_0x97f8('0x4e')]=moment(this[_0x97f8('0x9')][_0x13f091[_0x97f8('0x1a')]]['endtime'])['diff'](this['channels'][_0x13f091['uniqueid']][_0x97f8('0x4f')],_0x97f8('0x50'));this[_0x97f8('0x9')][_0x13f091[_0x97f8('0x1a')]][_0x97f8('0x2f')]='complete';this[_0x97f8('0xb')]['total']+=0x1;if(this[_0x97f8('0x9')][_0x13f091[_0x97f8('0x1a')]][_0x97f8('0x2d')]){this[_0x97f8('0xb')]['answered']+=0x1;this['channels'][_0x13f091['uniqueid']][_0x97f8('0x51')]=moment(this[_0x97f8('0x9')][_0x13f091[_0x97f8('0x1a')]][_0x97f8('0x2d')])[_0x97f8('0x52')](this['channels'][_0x13f091[_0x97f8('0x1a')]][_0x97f8('0x4f')],_0x97f8('0x50'));this[_0x97f8('0x9')][_0x13f091[_0x97f8('0x1a')]]['billableseconds']=moment(this[_0x97f8('0x9')][_0x13f091['uniqueid']][_0x97f8('0x4d')])[_0x97f8('0x52')](this[_0x97f8('0x9')][_0x13f091[_0x97f8('0x1a')]][_0x97f8('0x2d')],'seconds');this[_0x97f8('0xb')][_0x97f8('0x53')]+=this[_0x97f8('0x9')][_0x13f091['uniqueid']]['holdtime']||0x0;this[_0x97f8('0xb')][_0x97f8('0x54')]+=this[_0x97f8('0x9')][_0x13f091['uniqueid']][_0x97f8('0x55')];}this['outbound'][_0x97f8('0x56')]+=this[_0x97f8('0x9')][_0x13f091[_0x97f8('0x1a')]][_0x97f8('0x4e')];logger[_0x97f8('0x18')]('[%s][voiceDialReport][hangup]\x20sending\x20voiceDialReport\x20event:',_0x13f091[_0x97f8('0x1a')],util[_0x97f8('0x1b')](this[_0x97f8('0x9')][_0x13f091[_0x97f8('0x1a')]],{'showHidden':![],'depth':null}));ami[_0x97f8('0x17')](_0x97f8('0x57'),this[_0x97f8('0x9')][_0x13f091['uniqueid']]);logger[_0x97f8('0x18')](_0x97f8('0x58'),_0x13f091['uniqueid'],util[_0x97f8('0x1b')](this[_0x97f8('0x9')][_0x13f091['uniqueid']],{'showHidden':![],'depth':null}));ami['emit'](_0x97f8('0x59'),this['channels'][_0x13f091['uniqueid']]);logger['debug'](_0x97f8('0x5a'),_0x13f091['uniqueid'],util[_0x97f8('0x1b')](this[_0x97f8('0x9')][_0x13f091[_0x97f8('0x1a')]],{'showHidden':![],'depth':null}));this[_0x97f8('0x17')](_0x97f8('0x26'),_0x97f8('0x5b'),this['outbound']);logger[_0x97f8('0x22')](_0x97f8('0x5c'),JSON[_0x97f8('0x5d')](this['channels'][_0x13f091[_0x97f8('0x1a')]]));logger[_0x97f8('0x18')](_0x97f8('0x5e'),_0x13f091['uniqueid'],util[_0x97f8('0x1b')](this['channels'][_0x13f091[_0x97f8('0x1a')]],{'showHidden':![],'depth':null}));this[_0x97f8('0x17')]('voice:outbound','voice_outbound_channel:remove',this[_0x97f8('0x9')][_0x13f091['uniqueid']]);delete this['channels'][_0x13f091[_0x97f8('0x1a')]];}else if(this[_0x97f8('0x9')][_0x13f091['linkedid']]){this[_0x97f8('0x9')][_0x13f091['linkedid']][_0x97f8('0x1a')]=this[_0x97f8('0x9')][_0x13f091[_0x97f8('0x5f')]][_0x97f8('0x60')];}if(this['variables'][_0x13f091[_0x97f8('0x1a')]]){delete this[_0x97f8('0xc')][_0x13f091[_0x97f8('0x1a')]];}}}catch(_0x13f4f4){logger[_0x97f8('0x29')](_0x97f8('0x61'),_0x13f091['uniqueid'],util['inspect'](_0x13f4f4,{'showHidden':![],'depth':null}));}};module[_0x97f8('0x62')]=VoiceDialReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceQueueReport.js b/server/services/ami/report/voiceQueueReport.js index 0a0e779..2c4d978 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 _0xac34=['campaigns','variables','bind','syncQueueCallerJoin','queuecallerabandon','queuecallerleave','syncQueueCallerLeave','agentcomplete','syncAgentComplete','agentconnect','syncAgentConnect','varset','hangup','syncHangup','syncFullyBooted','musiconholdstart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopQueueShow','isEmpty','hasOwnProperty','originated','talking','waiting','queueStatusComplete','unlockRR','clearZombieChannels','switch','sequence','isNil','Action','status','channel','catch','message','No\x20such\x20channel','error','[%s][voiceQueueReport][checkQueueReport]','inspect','clearQueueReport','emitVoiceQueueChannelRemove','clearqueuereport','emit','emitVoiceQueueChannelSave','[%s][voiceQueueReport][',']\x20sending\x20voice_queue_channel:save\x20event:','uniqueid','format','voice:queue:%s','voice_queue_presence:save','debug',']\x20sending\x20voice_queue_channel:remove\x20event:','name','voice_queue_presence:remove','type','inbound','answered','available','loggedIn','pTalking','total','abandoned','Trunk','callerid','Interval','[voiceQueueReport][',']\x20sending\x20voice_queue:save\x20event:','voice_queue:save','isNotNull','queues','loopQueueSummary','queuesummary','[voiceQueueReport][queuesummary]','queue','[voiceQueueReport][queuesummary]\x20event:','info','[voiceQueueReport][queuesummary]\x20name:%s','countBy','callers','toNumber','loggedin','[voiceQueueReport][queuesummary]\x20sending\x20queuesummary\x20event:','custom:queuesummary','syncQueueSummaryComplete','[%s][voiceQueueReport][queuecallerjoin]','isUndefined','queuecallerjoinAt','position','merge','pick','keys','push','syncQueueCallerAbandon','[%s][voiceQueueReport][queuecallerabandon]','last','holdtime','originalposition','queuecallerabandonAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexitreason','ABANDONED','[%s][voiceQueueReport][queuecallerleave]','connectedlinenum','connectedlinename','[%s][voiceQueueReport][agentconnect]','queuecallercomplete','[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT','[%s][voiceQueueReport][agentcomplete]','assigned','lastAssignedTo','membername','queuecallerexit','queuecallerexitAt','transfer','reason','COMPLETED','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED','toLowerCase','local/','linkedid','seconds','FORWARDTRANSFER','transfertype','transferexten','destexten','transferuniqueid','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER','COMPLETEDBY','toUpperCase','syncVarSet','[%s][voiceQueueReport][varset]','addVariable','variable','value','queuestatus','CONTINUE','TIMEOUT','lastevent','timeout','queuecallerleaveAt','[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:','custom:timeout','EXITWITHKEY','[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','bridgepvtcallid','membercalls','memberdynamic','memberlastcall','memberpenalty','memberrealtime','length','sumHoldTime','sumDuration','milliseconds','diff','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerunmanaged\x20event:','custom:queuecallerunmanaged','custom:queuecallerabandon','[%s][voiceQueueReport][hangup]\x20name:%s\x20type:%s\x20reason:%s','cause-txt','emitVoiceQueueSummary','[%s][voiceQueueReport][hangup]\x20sending\x20voiceQueueReport\x20event:','custom:voiceQueueReport','[%s][voiceQueueReport][hangup]','[%s][voiceQueueReport][attendedtransfer]','transfereeuniqueid','secondtransfererexten','secondtransfereruniqueid','[%s][voiceQueueReport][attendedTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','transfertargetuniqueid','origtransfererexten','origtransfereruniqueid','ATTENDED','[%s][voiceQueueReport][blindtransfer]','BLINDTRANSFER','BLIND','extension','[%s][voiceQueueReport][blindTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','BlindTransfer','transfererchannel','[%s][voiceQueueReport][musiconholdstart]','mohstarttime','mohtime','[%s][voiceQueueReport][musiconholdstop]\x20mohtime:%s','[%s][voiceQueueReport][musiconholdstop]','moment','md5','ioredis','../../../config/logger','ami','../ami','../model/queueReport','defaults','redis','localhost','socket.io-emitter','prototype','enqueue','tail','queueReports','agents','channels','queueChannels','voiceQueues','flagQueueSummary'];(function(_0x29d94e,_0xf386d6){var _0x106237=function(_0x327501){while(--_0x327501){_0x29d94e['push'](_0x29d94e['shift']());}};_0x106237(++_0xf386d6);}(_0xac34,0xc6));var _0x4ac3=function(_0x52b0f1,_0x1d6ed9){_0x52b0f1=_0x52b0f1-0x0;var _0x303212=_0xac34[_0x52b0f1];return _0x303212;};'use strict';var _=require('lodash');var moment=require(_0x4ac3('0x0'));var util=require('util');var md5=require(_0x4ac3('0x1'));var Redis=require(_0x4ac3('0x2'));var config=require('../../../config/environment');var logger=require(_0x4ac3('0x3'))(_0x4ac3('0x4'));var ami=require(_0x4ac3('0x5'));var QueueReport=require(_0x4ac3('0x6'));config['redis']=_[_0x4ac3('0x7')](config[_0x4ac3('0x8')],{'host':_0x4ac3('0x9'),'port':0x18eb});var io=require(_0x4ac3('0xa'))(new Redis(config[_0x4ac3('0x8')]));var Sequence=function(){};Sequence[_0x4ac3('0xb')][_0x4ac3('0xc')]=function(_0x22cd44){this['tail']=this[_0x4ac3('0xd')]?this['tail']['finally'](_0x22cd44):_0x22cd44();};function VoiceQueueReport(_0x3b0328){this['sequence']=new Sequence();this[_0x4ac3('0xe')]={};this[_0x4ac3('0xf')]=_0x3b0328[_0x4ac3('0xf')];this[_0x4ac3('0x10')]=_0x3b0328[_0x4ac3('0x11')];this[_0x4ac3('0x12')]=_0x3b0328[_0x4ac3('0x12')];this[_0x4ac3('0x13')]=!![];this['campaigns']=_0x3b0328[_0x4ac3('0x14')];this[_0x4ac3('0x15')]={};ami['on']('queuesummary',this['syncQueueSummary']['bind'](this));ami['on']('queuesummarycomplete',this['syncQueueSummaryComplete'][_0x4ac3('0x16')](this));ami['on']('queuecallerjoin',this[_0x4ac3('0x17')][_0x4ac3('0x16')](this));ami['on'](_0x4ac3('0x18'),this['syncQueueCallerAbandon'][_0x4ac3('0x16')](this));ami['on'](_0x4ac3('0x19'),this[_0x4ac3('0x1a')][_0x4ac3('0x16')](this));ami['on'](_0x4ac3('0x1b'),this[_0x4ac3('0x1c')][_0x4ac3('0x16')](this));ami['on'](_0x4ac3('0x1d'),this[_0x4ac3('0x1e')][_0x4ac3('0x16')](this));ami['on'](_0x4ac3('0x1f'),this['syncVarSet'][_0x4ac3('0x16')](this));ami['on'](_0x4ac3('0x20'),this[_0x4ac3('0x21')]['bind'](this));ami['on']('fullybooted',this[_0x4ac3('0x22')]['bind'](this));ami['on'](_0x4ac3('0x23'),this['syncMusicOnHoldStart'][_0x4ac3('0x16')](this));ami['on'](_0x4ac3('0x24'),this[_0x4ac3('0x25')][_0x4ac3('0x16')](this));ami['on'](_0x4ac3('0x26'),this[_0x4ac3('0x27')]['bind'](this));ami['on'](_0x4ac3('0x28'),this[_0x4ac3('0x29')][_0x4ac3('0x16')](this));this['loopQueueSummary']();this[_0x4ac3('0x2a')]();}function clearChannels(_0xe21a8b){if(!_[_0x4ac3('0x2b')](_0xe21a8b)){for(var _0x2725b7 in _0xe21a8b){if(_0xe21a8b['hasOwnProperty'](_0x2725b7)){delete _0xe21a8b[_0x2725b7];}}}}function clearCampaigns(_0x444af9){if(!_[_0x4ac3('0x2b')](_0x444af9)){for(var _0x21f583 in _0x444af9){if(_0x444af9[_0x4ac3('0x2c')](_0x21f583)){_0x444af9[_0x21f583][_0x4ac3('0x2d')]=0x0;}}}}function clearVoiceQueues(_0x50c99f){if(!_['isEmpty'](_0x50c99f)){for(var _0x364c25 in _0x50c99f){if(_0x50c99f[_0x4ac3('0x2c')](_0x364c25)){_0x50c99f[_0x364c25][_0x4ac3('0x2d')]=0x0;_0x50c99f[_0x364c25][_0x4ac3('0x2e')]=0x0;_0x50c99f[_0x364c25]['pTalking']=0x0;_0x50c99f[_0x364c25][_0x4ac3('0x2f')]=0x0;_0x50c99f[_0x364c25][_0x4ac3('0x30')]=!![];}}}}function clearAgentBooked(_0x4e0aac){if(!_[_0x4ac3('0x2b')](_0x4e0aac)){for(var _0x4e5413 in _0x4e0aac){if(_0x4e0aac['hasOwnProperty'](_0x4e5413)){_0x4e0aac[_0x4e5413][_0x4ac3('0x31')]=!![];}}}}VoiceQueueReport[_0x4ac3('0xb')][_0x4ac3('0x32')]=function(){var _0x4c28b8=this;for(var _0x7e4a73 in this[_0x4ac3('0x10')]){if(this['channels'][_0x4ac3('0x2c')](_0x7e4a73)&&!this[_0x4ac3('0x10')][_0x7e4a73][_0x4ac3('0x33')]){this[_0x4ac3('0x34')][_0x4ac3('0xc')](function(){if(!_[_0x4ac3('0x35')](_0x4c28b8[_0x4ac3('0x10')][_0x7e4a73])){return ami[_0x4ac3('0x36')]({'action':_0x4ac3('0x37'),'channel':_0x4c28b8[_0x4ac3('0x10')][_0x7e4a73][_0x4ac3('0x38')]})[_0x4ac3('0x39')](function(_0x57b493){if(_0x57b493[_0x4ac3('0x3a')]===_0x4ac3('0x3b')){setTimeout(function(){if(_0x4c28b8[_0x4ac3('0x10')][_0x7e4a73]){delete _0x4c28b8['channels'][_0x7e4a73];logger[_0x4ac3('0x3c')]('[%s][voiceQueueReport][checkChannel]',_0x7e4a73,util['inspect'](_0x57b493,{'showHidden':![],'depth':null}));}if(_0x4c28b8[_0x4ac3('0xe')][_0x7e4a73]){delete _0x4c28b8[_0x4ac3('0xe')][_0x7e4a73];logger[_0x4ac3('0x3c')](_0x4ac3('0x3d'),_0x7e4a73,util['inspect'](_0x57b493,{'showHidden':![],'depth':null}));}if(_0x4c28b8[_0x4ac3('0x15')][_0x7e4a73]){delete _0x4c28b8['variables'][_0x7e4a73];logger[_0x4ac3('0x3c')]('[%s][voiceQueueReport][checkVariables]',_0x7e4a73,util[_0x4ac3('0x3e')](_0x57b493,{'showHidden':![],'depth':null}));}},0x1f40);}});}});}}};VoiceQueueReport[_0x4ac3('0xb')][_0x4ac3('0x22')]=function(){logger['error']('[FullyBooted]\x20clear\x20realtime');clearChannels(this['channels']);this[_0x4ac3('0x3f')](this[_0x4ac3('0xe')]);clearAgentBooked(this[_0x4ac3('0xf')]);clearVoiceQueues(this[_0x4ac3('0x12')]);clearCampaigns(this[_0x4ac3('0x14')]);};VoiceQueueReport[_0x4ac3('0xb')][_0x4ac3('0x3f')]=function(_0xb17348){var _0x3cedb8=this;if(!_[_0x4ac3('0x2b')](_0xb17348)){for(var _0x51655 in _0xb17348){if(_0xb17348['hasOwnProperty'](_0x51655)){_0x3cedb8[_0x4ac3('0x40')](_0xb17348[_0x51655],_0x4ac3('0x41'));delete _0xb17348[_0x51655];}}}};VoiceQueueReport[_0x4ac3('0xb')][_0x4ac3('0x42')]=function(_0x4386b6,_0x479778,_0x27b0c9){io['to'](_0x4386b6)['emit'](_0x479778,_0x27b0c9);};VoiceQueueReport['prototype'][_0x4ac3('0x43')]=function(_0x42f178,_0x454701){logger['debug'](_0x4ac3('0x44')+_0x454701+_0x4ac3('0x45'),_0x42f178[_0x4ac3('0x46')],util[_0x4ac3('0x3e')](_0x42f178,{'showHidden':![],'depth':null}));this[_0x4ac3('0x42')](util[_0x4ac3('0x47')](_0x4ac3('0x48'),_0x42f178['name']),'voice_queue_channel:save',_0x42f178);io[_0x4ac3('0x42')](_0x4ac3('0x49'),_0x42f178);};VoiceQueueReport['prototype'][_0x4ac3('0x40')]=function(_0x8bafb0,_0x5b444b){logger[_0x4ac3('0x4a')]('[%s][voiceQueueReport]['+_0x5b444b+_0x4ac3('0x4b'),_0x8bafb0['uniqueid'],util['inspect'](_0x8bafb0,{'showHidden':![],'depth':null}));this[_0x4ac3('0x42')](util[_0x4ac3('0x47')](_0x4ac3('0x48'),_0x8bafb0[_0x4ac3('0x4c')]),'voice_queue_channel:remove',_0x8bafb0);io[_0x4ac3('0x42')](_0x4ac3('0x4d'),_0x8bafb0);};VoiceQueueReport[_0x4ac3('0xb')]['emitVoiceQueueSummary']=function(_0x4f0850,_0x5f52b4){if(_0x4f0850[_0x4ac3('0x4e')]===_0x4ac3('0x4f')){var _0x2fec68={'id':_0x4f0850['id'],'name':_0x4f0850[_0x4ac3('0x4c')],'strategy':_0x4f0850['strategy'],'answered':_0x4f0850[_0x4ac3('0x50')],'available':_0x4f0850[_0x4ac3('0x51')],'loggedIn':_0x4f0850[_0x4ac3('0x52')],'pTalking':_0x4f0850[_0x4ac3('0x53')],'sumBillable':_0x4f0850['sumBillable'],'sumDuration':_0x4f0850['sumDuration'],'sumHoldTime':_0x4f0850['sumHoldTime']||0x0,'talking':_0x4f0850[_0x4ac3('0x2e')],'total':_0x4f0850[_0x4ac3('0x54')],'type':_0x4f0850[_0x4ac3('0x4e')],'unmanaged':_0x4f0850['unmanaged'],'abandoned':_0x4f0850[_0x4ac3('0x55')],'waiting':_0x4f0850[_0x4ac3('0x2f')]};if(_0x4f0850[_0x4ac3('0x56')]){_0x2fec68[_0x4ac3('0x56')]={'id':_0x4f0850['Trunk']['id'],'name':_0x4f0850[_0x4ac3('0x56')][_0x4ac3('0x4c')],'active':_0x4f0850[_0x4ac3('0x56')]['active'],'callerid':_0x4f0850[_0x4ac3('0x56')][_0x4ac3('0x57')]};}if(_0x4f0850['Interval']){_0x2fec68[_0x4ac3('0x58')]={'id':_0x4f0850[_0x4ac3('0x58')]['id'],'name':_0x4f0850['Interval'][_0x4ac3('0x4c')]};}var _0x208b1a=md5(JSON['stringify'](_0x2fec68));if(_0x4f0850[_0x4ac3('0x1')]!==_0x208b1a){_0x4f0850[_0x4ac3('0x1')]=_0x208b1a;logger[_0x4ac3('0x4a')](_0x4ac3('0x59')+_0x5f52b4+_0x4ac3('0x5a'),util[_0x4ac3('0x3e')](_0x2fec68,{'showHidden':![],'depth':null}));this['emit'](util[_0x4ac3('0x47')]('voice:queue:%s',_0x2fec68[_0x4ac3('0x4c')]),_0x4ac3('0x5b'),_0x2fec68);}}};VoiceQueueReport[_0x4ac3('0xb')][_0x4ac3('0x5c')]=function(_0x40d0cb){return _0x40d0cb!==null&&!_['isUndefined'](_0x40d0cb);};VoiceQueueReport[_0x4ac3('0xb')][_0x4ac3('0x2a')]=function(){var _0x36f69a=this;setInterval(function(){_0x36f69a[_0x4ac3('0x32')]();ami['Action']({'action':_0x4ac3('0x5d')})[_0x4ac3('0x39')](function(_0x1bb989){logger[_0x4ac3('0x3c')]('[voiceQueueReport][queues]',util[_0x4ac3('0x3e')](_0x1bb989,{'showHidden':![],'depth':null}));});},0x2710);};VoiceQueueReport[_0x4ac3('0xb')][_0x4ac3('0x5e')]=function(){var _0x43fac9=this;setInterval(function(){if(_0x43fac9[_0x4ac3('0x13')]){return ami[_0x4ac3('0x36')]({'action':_0x4ac3('0x5f')})['then'](function(_0x2d9eb9){_0x43fac9[_0x4ac3('0x13')]=![];})[_0x4ac3('0x39')](function(_0x2aa312){logger['error'](_0x4ac3('0x60'),util[_0x4ac3('0x3e')](_0x2aa312,{'showHidden':![],'depth':null}));});}},0x3e8);};VoiceQueueReport[_0x4ac3('0xb')]['syncQueueSummary']=function(_0x1fb223){try{if(this[_0x4ac3('0x5c')](_0x1fb223)&&this[_0x4ac3('0x5c')](_0x1fb223[_0x4ac3('0x61')])){logger[_0x4ac3('0x4a')](_0x4ac3('0x62'),util['inspect'](_0x1fb223,{'showHidden':![],'depth':null}));if(this[_0x4ac3('0x12')][_0x1fb223[_0x4ac3('0x61')]]){logger[_0x4ac3('0x63')](_0x4ac3('0x64'),_0x1fb223[_0x4ac3('0x61')]);var _0x1e5495=_[_0x4ac3('0x65')](this[_0x4ac3('0x10')],_0x4ac3('0x61'))[_0x1fb223[_0x4ac3('0x61')]]||0x0;var _0x2200ad=_0x1e5495-_0x1fb223[_0x4ac3('0x66')];if(this[_0x4ac3('0x12')][_0x1fb223[_0x4ac3('0x61')]]['waiting']!==_[_0x4ac3('0x67')](_0x1fb223[_0x4ac3('0x66')])||this[_0x4ac3('0x12')][_0x1fb223['queue']][_0x4ac3('0x52')]!==_[_0x4ac3('0x67')](_0x1fb223['loggedin'])||this['voiceQueues'][_0x1fb223[_0x4ac3('0x61')]][_0x4ac3('0x51')]!==_[_0x4ac3('0x67')](_0x1fb223['available'])||this[_0x4ac3('0x12')][_0x1fb223[_0x4ac3('0x61')]][_0x4ac3('0x2e')]!==_0x2200ad){this[_0x4ac3('0x12')][_0x1fb223[_0x4ac3('0x61')]][_0x4ac3('0x2f')]=_[_0x4ac3('0x67')](_0x1fb223[_0x4ac3('0x66')]);this[_0x4ac3('0x12')][_0x1fb223[_0x4ac3('0x61')]][_0x4ac3('0x52')]=_[_0x4ac3('0x67')](_0x1fb223['loggedin']);this[_0x4ac3('0x12')][_0x1fb223[_0x4ac3('0x61')]][_0x4ac3('0x51')]=_[_0x4ac3('0x67')](_0x1fb223[_0x4ac3('0x51')]);this[_0x4ac3('0x12')][_0x1fb223['queue']][_0x4ac3('0x2e')]=_0x2200ad>0x0?_0x2200ad:0x0;this[_0x4ac3('0x12')][_0x1fb223[_0x4ac3('0x61')]][_0x4ac3('0x2e')]=this[_0x4ac3('0x12')][_0x1fb223[_0x4ac3('0x61')]][_0x4ac3('0x2e')]>_[_0x4ac3('0x67')](_0x1fb223['loggedin'])?_[_0x4ac3('0x67')](_0x1fb223[_0x4ac3('0x68')]):this[_0x4ac3('0x12')][_0x1fb223[_0x4ac3('0x61')]][_0x4ac3('0x2e')];this['emitVoiceQueueSummary'](this['voiceQueues'][_0x1fb223[_0x4ac3('0x61')]],_0x4ac3('0x5f'));}logger[_0x4ac3('0x4a')](_0x4ac3('0x69'),util['inspect'](this[_0x4ac3('0x12')][_0x1fb223[_0x4ac3('0x61')]],{'showHidden':![],'depth':null}));ami[_0x4ac3('0x42')](_0x4ac3('0x6a'),this['voiceQueues'][_0x1fb223['queue']]);}}}catch(_0x2b423a){logger[_0x4ac3('0x3c')]('[voiceQueueReport][queuesummary]',util[_0x4ac3('0x3e')](_0x2b423a,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x4ac3('0xb')][_0x4ac3('0x6b')]=function(_0x5c15a1){logger[_0x4ac3('0x4a')]('[voiceQueueReport][queuesummarycomplete]\x20event:',util['inspect'](_0x5c15a1,{'showHidden':![],'depth':null}));this[_0x4ac3('0x13')]=!![];};VoiceQueueReport[_0x4ac3('0xb')]['syncQueueCallerJoin']=function(_0x1fa377){try{if(this['isNotNull'](_0x1fa377)){logger[_0x4ac3('0x4a')](_0x4ac3('0x6c'),_0x1fa377['uniqueid'],util[_0x4ac3('0x3e')](_0x1fa377,{'showHidden':![],'depth':null}));if(_[_0x4ac3('0x6d')](this[_0x4ac3('0xe')][_0x1fa377[_0x4ac3('0x46')]])){this['queueReports'][_0x1fa377[_0x4ac3('0x46')]]=[];this[_0x4ac3('0x10')][_0x1fa377['uniqueid']]={};}var _0x232b2a=new QueueReport();_0x232b2a[_0x4ac3('0x4c')]=_0x1fa377[_0x4ac3('0x61')];_0x232b2a[_0x4ac3('0x4e')]=this[_0x4ac3('0x12')][_0x232b2a[_0x4ac3('0x4c')]]&&this[_0x4ac3('0x12')][_0x232b2a['name']][_0x4ac3('0x4e')]?this[_0x4ac3('0x12')][_0x232b2a['name']][_0x4ac3('0x4e')]||'inbound':_0x4ac3('0x4f');_0x232b2a[_0x4ac3('0x61')]=_0x1fa377[_0x4ac3('0x61')];_0x232b2a[_0x4ac3('0x6e')]=moment()[_0x4ac3('0x47')]('YYYY-MM-DD\x20HH:mm:ss');_0x232b2a['position']=_0x1fa377[_0x4ac3('0x6f')];_0x232b2a['count']=_0x1fa377['count'];_0x232b2a['uniqueid']=_0x1fa377[_0x4ac3('0x46')];logger[_0x4ac3('0x63')]('[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s',_0x232b2a[_0x4ac3('0x4c')],_0x232b2a[_0x4ac3('0x4e')]);_[_0x4ac3('0x70')](_0x232b2a,_[_0x4ac3('0x71')](_0x1fa377,_[_0x4ac3('0x72')](_0x232b2a)));this[_0x4ac3('0xe')][_0x1fa377['uniqueid']][_0x4ac3('0x73')](_0x232b2a);this[_0x4ac3('0x10')][_0x1fa377[_0x4ac3('0x46')]]=_0x232b2a;this[_0x4ac3('0x43')](_0x232b2a,'queuecallerjoin');}}catch(_0x1a5ebc){logger['error'](_0x4ac3('0x6c'),_0x1fa377[_0x4ac3('0x46')],util[_0x4ac3('0x3e')](_0x1a5ebc,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x4ac3('0xb')][_0x4ac3('0x74')]=function(_0x4da66d){try{if(this['isNotNull'](_0x4da66d)){logger['debug'](_0x4ac3('0x75'),_0x4da66d['uniqueid'],util[_0x4ac3('0x3e')](_0x4da66d,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x4da66d[_0x4ac3('0x46')]]){var _0x30ee37=_[_0x4ac3('0x76')](this[_0x4ac3('0xe')][_0x4da66d[_0x4ac3('0x46')]]);_0x30ee37['queuecallercomplete']=![];_0x30ee37['queuecallercompleteAt']=null;_0x30ee37[_0x4ac3('0x77')]=_0x4da66d[_0x4ac3('0x77')];_0x30ee37[_0x4ac3('0x78')]=_0x4da66d[_0x4ac3('0x78')];_0x30ee37[_0x4ac3('0x18')]=!![];_0x30ee37[_0x4ac3('0x79')]=moment()['format'](_0x4ac3('0x7a'));_0x30ee37[_0x4ac3('0x7b')]=_0x4ac3('0x7c');_0x30ee37['lastAssignedTo']=null;logger[_0x4ac3('0x63')]('[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s',_0x30ee37[_0x4ac3('0x4c')],_0x30ee37[_0x4ac3('0x4e')]);this[_0x4ac3('0x10')][_0x4da66d[_0x4ac3('0x46')]]=_0x30ee37;this['emitVoiceQueueChannelRemove'](_0x30ee37,_0x4ac3('0x18'));}}}catch(_0x340832){logger[_0x4ac3('0x3c')](_0x4ac3('0x75'),_0x4da66d[_0x4ac3('0x46')],util[_0x4ac3('0x3e')](_0x340832,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x4ac3('0xb')][_0x4ac3('0x1a')]=function(_0x55380b){try{if(this[_0x4ac3('0x5c')](_0x55380b)){logger[_0x4ac3('0x4a')](_0x4ac3('0x7d'),_0x55380b[_0x4ac3('0x46')],util[_0x4ac3('0x3e')](_0x55380b,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x55380b[_0x4ac3('0x46')]]){var _0x2061f9=_[_0x4ac3('0x76')](this[_0x4ac3('0xe')][_0x55380b['uniqueid']]);_0x2061f9['queuecallerleaveAt']=moment()[_0x4ac3('0x47')](_0x4ac3('0x7a'));_0x2061f9[_0x4ac3('0x7e')]=_0x55380b[_0x4ac3('0x7e')];_0x2061f9[_0x4ac3('0x7f')]=_0x55380b['connectedlinename'];logger[_0x4ac3('0x63')]('[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x2061f9['name'],_0x2061f9[_0x4ac3('0x4e')],_0x55380b[_0x4ac3('0x7e')],_0x55380b[_0x4ac3('0x7f')]);this[_0x4ac3('0x10')][_0x55380b[_0x4ac3('0x46')]]=_0x2061f9;this[_0x4ac3('0x43')](_0x2061f9,_0x4ac3('0x19'));}}}catch(_0x40906a){logger[_0x4ac3('0x3c')](_0x4ac3('0x7d'),_0x55380b[_0x4ac3('0x46')],util[_0x4ac3('0x3e')](_0x40906a,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x4ac3('0xb')]['syncAgentConnect']=function(_0x3f77c1){try{if(this[_0x4ac3('0x5c')](_0x3f77c1)){logger['debug'](_0x4ac3('0x80'),_0x3f77c1['uniqueid'],util['inspect'](_0x3f77c1,{'showHidden':![],'depth':null}));if(this[_0x4ac3('0xe')][_0x3f77c1[_0x4ac3('0x46')]]){var _0x37fcc2=_['last'](this[_0x4ac3('0xe')][_0x3f77c1['uniqueid']]);_0x37fcc2[_0x4ac3('0x81')]=!![];_0x37fcc2[_0x4ac3('0x7b')]='COMPLETEDBYAGENT';logger[_0x4ac3('0x63')](_0x4ac3('0x82'),_0x37fcc2[_0x4ac3('0x4c')],_0x37fcc2[_0x4ac3('0x4e')]);}}}catch(_0x24e7ff){logger[_0x4ac3('0x3c')](_0x4ac3('0x80'),_0x3f77c1[_0x4ac3('0x46')],util[_0x4ac3('0x3e')](_0x24e7ff,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x4ac3('0xb')]['syncAgentComplete']=function(_0x399688){try{if(this[_0x4ac3('0x5c')](_0x399688)){logger[_0x4ac3('0x4a')](_0x4ac3('0x83'),_0x399688['uniqueid'],util[_0x4ac3('0x3e')](_0x399688,{'showHidden':![],'depth':null}));if(this[_0x4ac3('0xe')][_0x399688['uniqueid']]){var _0x23bd0d=_[_0x4ac3('0x76')](this[_0x4ac3('0xe')][_0x399688[_0x4ac3('0x46')]]);_0x23bd0d[_0x4ac3('0x18')]=![];_0x23bd0d[_0x4ac3('0x79')]=null;_0x23bd0d[_0x4ac3('0x84')]=!![];_0x23bd0d[_0x4ac3('0x85')]=_0x399688[_0x4ac3('0x86')];_0x23bd0d[_0x4ac3('0x77')]=_0x399688['holdtime'];_0x23bd0d['queuecallercomplete']=!![];_0x23bd0d[_0x4ac3('0x87')]=![];_0x23bd0d[_0x4ac3('0x88')]=null;if(!_0x23bd0d[_0x4ac3('0x89')]){if(_0x399688[_0x4ac3('0x8a')]==_0x4ac3('0x89')){_0x23bd0d[_0x4ac3('0x7b')]=_0x4ac3('0x8b');logger[_0x4ac3('0x63')](_0x4ac3('0x8c'),_0x23bd0d[_0x4ac3('0x4c')],_0x23bd0d[_0x4ac3('0x4e')]);}else{if(_['startsWith'](_0x399688[_0x4ac3('0x38')][_0x4ac3('0x8d')](),_0x4ac3('0x8e'))){if(this[_0x4ac3('0xe')][_0x399688[_0x4ac3('0x8f')]]){var _0x5cc011=_[_0x4ac3('0x76')](this[_0x4ac3('0xe')][_0x399688['linkedid']]);_0x5cc011[_0x4ac3('0x81')]=![];_0x5cc011[_0x4ac3('0x87')]=!![];_0x5cc011[_0x4ac3('0x88')]=moment(_0x23bd0d[_0x4ac3('0x6e')])['add'](_0x399688[_0x4ac3('0x77')],_0x4ac3('0x90'))[_0x4ac3('0x47')](_0x4ac3('0x7a'));_0x5cc011[_0x4ac3('0x7b')]=_0x4ac3('0x91');_0x5cc011[_0x4ac3('0x89')]=!![];_0x5cc011[_0x4ac3('0x92')]='FORWARD';_0x5cc011[_0x4ac3('0x93')]=_0x399688[_0x4ac3('0x94')];_0x5cc011[_0x4ac3('0x95')]=_0x399688[_0x4ac3('0x46')];logger[_0x4ac3('0x63')](_0x4ac3('0x96'),_0x5cc011['name'],_0x5cc011[_0x4ac3('0x4e')]);var _0xc66ecd=this[_0x4ac3('0xe')][_0x399688[_0x4ac3('0x8f')]];this[_0x4ac3('0xe')][_0x399688[_0x4ac3('0x8f')]]=this[_0x4ac3('0xe')][_0x399688[_0x4ac3('0x46')]];this['queueReports'][_0x399688[_0x4ac3('0x46')]]=_0xc66ecd;}}else{_0x23bd0d[_0x4ac3('0x7b')]=_0x4ac3('0x97')+_0x399688['reason'][_0x4ac3('0x98')]();logger['info']('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s',_0x23bd0d['name'],_0x23bd0d['type'],_0x23bd0d[_0x4ac3('0x7b')]);}}}this['channels'][_0x399688[_0x4ac3('0x46')]]=_0x23bd0d;this[_0x4ac3('0x40')](_0x23bd0d,_0x4ac3('0x1b'));}}}catch(_0x2f4d05){logger[_0x4ac3('0x3c')](_0x4ac3('0x83'),_0x399688[_0x4ac3('0x46')],util[_0x4ac3('0x3e')](_0x2f4d05,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x4ac3('0x99')]=function(_0x379e56){try{if(this[_0x4ac3('0x5c')](_0x379e56)){logger[_0x4ac3('0x4a')](_0x4ac3('0x9a'),_0x379e56['uniqueid'],util[_0x4ac3('0x3e')](_0x379e56,{'showHidden':![],'depth':null}));this[_0x4ac3('0x9b')](_0x379e56['uniqueid'],_[_0x4ac3('0x72')](_0x379e56[_0x4ac3('0x9c')])[0x0],_0x379e56[_0x4ac3('0x9d')]);if(this[_0x4ac3('0xe')][_0x379e56[_0x4ac3('0x46')]]){var _0x3a11f1=_[_0x4ac3('0x76')](this[_0x4ac3('0xe')][_0x379e56[_0x4ac3('0x46')]]);if(_0x3a11f1){if(this[_0x4ac3('0x5c')](_0x379e56['variable'])&&this[_0x4ac3('0x5c')](_0x379e56[_0x4ac3('0x9c')][_0x4ac3('0x9e')])){switch(_0x379e56[_0x4ac3('0x9d')]){case _0x4ac3('0x9f'):_0x3a11f1[_0x4ac3('0x87')]=![];_0x3a11f1[_0x4ac3('0x88')]=null;break;case _0x4ac3('0xa0'):_0x3a11f1[_0x4ac3('0xa1')]=_0x4ac3('0xa2');_0x3a11f1[_0x4ac3('0x87')]=!![];_0x3a11f1[_0x4ac3('0x88')]=moment()['format'](_0x4ac3('0x7a'));_0x3a11f1[_0x4ac3('0xa3')]=moment()[_0x4ac3('0x47')]('YYYY-MM-DD\x20HH:mm:ss');logger[_0x4ac3('0x4a')](_0x4ac3('0xa4'),_0x379e56[_0x4ac3('0x46')],util[_0x4ac3('0x3e')](_0x3a11f1,{'showHidden':![],'depth':null}));ami[_0x4ac3('0x42')](_0x4ac3('0xa5'),_0x3a11f1);break;default:_0x3a11f1[_0x4ac3('0x87')]=!![];_0x3a11f1['queuecallerexitAt']=moment()[_0x4ac3('0x47')](_0x4ac3('0x7a'));_0x3a11f1[_0x4ac3('0xa3')]=moment()['format'](_0x4ac3('0x7a'));}_0x3a11f1[_0x4ac3('0x18')]=![];_0x3a11f1['queuecallerabandonAt']=null;_0x3a11f1[_0x4ac3('0x7b')]=_0x379e56[_0x4ac3('0x9d')];this['channels'][_0x379e56[_0x4ac3('0x46')]]=_0x3a11f1;this[_0x4ac3('0x40')](_0x3a11f1,_0x4ac3('0x1f'));}else if(this[_0x4ac3('0x5c')](_0x379e56[_0x4ac3('0x9c')])&&this['isNotNull'](_0x379e56[_0x4ac3('0x9c')]['queueposition'])){if(!_0x3a11f1[_0x4ac3('0x18')]){_0x3a11f1[_0x4ac3('0x87')]=!![];_0x3a11f1[_0x4ac3('0x88')]=moment()[_0x4ac3('0x47')](_0x4ac3('0x7a'));_0x3a11f1[_0x4ac3('0x7b')]=_0x4ac3('0xa6');_0x3a11f1[_0x4ac3('0xa3')]=moment()[_0x4ac3('0x47')](_0x4ac3('0x7a'));this[_0x4ac3('0x10')][_0x379e56[_0x4ac3('0x46')]]=_0x3a11f1;}}logger[_0x4ac3('0x63')](_0x4ac3('0xa7'),_0x379e56[_0x4ac3('0x46')],_0x3a11f1[_0x4ac3('0x4c')],_0x3a11f1['type'],_['keys'](_0x379e56[_0x4ac3('0x9c')])[0x0],_0x379e56[_0x4ac3('0x9d')]);_0x3a11f1[_0x4ac3('0x15')]=this[_0x4ac3('0x15')][_0x379e56[_0x4ac3('0x46')]];}}}}catch(_0x35c573){logger[_0x4ac3('0x3c')]('[%s][voiceQueueReport][varset]',_0x379e56[_0x4ac3('0x46')],util[_0x4ac3('0x3e')](_0x35c573,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x4ac3('0xb')][_0x4ac3('0x9b')]=function(_0x1ca244,_0x1483ad,_0x4bcd8c){var _0x1c6820=[_0x4ac3('0xa8'),_0x4ac3('0xa9'),_0x4ac3('0xaa'),_0x4ac3('0xab'),_0x4ac3('0xac'),_0x4ac3('0xad'),_0x4ac3('0xae'),_0x4ac3('0xaf'),_0x4ac3('0xb0'),'sipuri','bridgepeer',_0x4ac3('0xb1'),_0x4ac3('0xb2'),_0x4ac3('0xb3'),'memberinterface',_0x4ac3('0xb4'),_0x4ac3('0x86'),_0x4ac3('0xb5'),_0x4ac3('0xb6')];if(!_[_0x4ac3('0x35')](_0x1483ad)&&!_['includes'](_0x1c6820,_0x1483ad)){if(_[_0x4ac3('0x6d')](this[_0x4ac3('0x15')][_0x1ca244])){this[_0x4ac3('0x15')][_0x1ca244]={};}this[_0x4ac3('0x15')][_0x1ca244][_0x1483ad]=_0x4bcd8c;}};VoiceQueueReport[_0x4ac3('0xb')][_0x4ac3('0x21')]=function(_0x689a9a){try{if(this[_0x4ac3('0x5c')](_0x689a9a)){logger[_0x4ac3('0x4a')]('[%s][voiceQueueReport][hangup]',_0x689a9a[_0x4ac3('0x46')],util['inspect'](_0x689a9a,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x689a9a[_0x4ac3('0x46')]]){for(var _0x394ff7=0x0,_0x56990d={};_0x394ff70x0?_0x272f18:0x0;this[_0xfefe('0x3d')][_0xa6a917['queue']][_0xfefe('0x2b')]=this[_0xfefe('0x3d')][_0xa6a917[_0xfefe('0x67')]][_0xfefe('0x2b')]>_[_0xfefe('0x6c')](_0xa6a917[_0xfefe('0x6d')])?_['toNumber'](_0xa6a917[_0xfefe('0x6d')]):this[_0xfefe('0x3d')][_0xa6a917[_0xfefe('0x67')]][_0xfefe('0x2b')];this[_0xfefe('0x4d')](this[_0xfefe('0x3d')][_0xa6a917[_0xfefe('0x67')]],_0xfefe('0x64'));}logger[_0xfefe('0x4a')](_0xfefe('0x6e'),util[_0xfefe('0x39')](this[_0xfefe('0x3d')][_0xa6a917[_0xfefe('0x67')]],{'showHidden':![],'depth':null}));ami[_0xfefe('0x40')](_0xfefe('0x6f'),this[_0xfefe('0x3d')][_0xa6a917[_0xfefe('0x67')]]);}}}catch(_0x538940){logger[_0xfefe('0x37')]('[voiceQueueReport][queuesummary]',util[_0xfefe('0x39')](_0x538940,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xfefe('0x18')]=function(_0x1d1b4e){logger['debug'](_0xfefe('0x70'),util[_0xfefe('0x39')](_0x1d1b4e,{'showHidden':![],'depth':null}));this['flagQueueSummary']=!![];};VoiceQueueReport[_0xfefe('0xc')][_0xfefe('0x71')]=function(_0x33d8e0){try{if(this['isNotNull'](_0x33d8e0)){logger[_0xfefe('0x4a')]('[%s][voiceQueueReport][queuecallerjoin]',_0x33d8e0[_0xfefe('0x44')],util[_0xfefe('0x39')](_0x33d8e0,{'showHidden':![],'depth':null}));if(_[_0xfefe('0x60')](this[_0xfefe('0xe')][_0x33d8e0[_0xfefe('0x44')]])){this[_0xfefe('0xe')][_0x33d8e0[_0xfefe('0x44')]]=[];this[_0xfefe('0x10')][_0x33d8e0[_0xfefe('0x44')]]={};}var _0x2e9d7d=new QueueReport();_0x2e9d7d[_0xfefe('0x47')]=_0x33d8e0[_0xfefe('0x67')];_0x2e9d7d[_0xfefe('0x4e')]=this['voiceQueues'][_0x2e9d7d['name']]&&this[_0xfefe('0x3d')][_0x2e9d7d['name']][_0xfefe('0x4e')]?this[_0xfefe('0x3d')][_0x2e9d7d['name']][_0xfefe('0x4e')]||'inbound':_0xfefe('0x72');_0x2e9d7d[_0xfefe('0x67')]=_0x33d8e0[_0xfefe('0x67')];_0x2e9d7d['queuecallerjoinAt']=moment()[_0xfefe('0x45')](_0xfefe('0x73'));_0x2e9d7d[_0xfefe('0x74')]=_0x33d8e0['position'];_0x2e9d7d['count']=_0x33d8e0[_0xfefe('0x75')];_0x2e9d7d[_0xfefe('0x44')]=_0x33d8e0[_0xfefe('0x44')];logger['info']('[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s',_0x2e9d7d[_0xfefe('0x47')],_0x2e9d7d[_0xfefe('0x4e')]);_[_0xfefe('0x76')](_0x2e9d7d,_[_0xfefe('0x77')](_0x33d8e0,_[_0xfefe('0x78')](_0x2e9d7d)));this[_0xfefe('0xe')][_0x33d8e0[_0xfefe('0x44')]]['push'](_0x2e9d7d);this[_0xfefe('0x10')][_0x33d8e0['uniqueid']]=_0x2e9d7d;this[_0xfefe('0x41')](_0x2e9d7d,_0xfefe('0x79'));}}catch(_0x958385){logger[_0xfefe('0x37')](_0xfefe('0x7a'),_0x33d8e0['uniqueid'],util[_0xfefe('0x39')](_0x958385,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xfefe('0xc')]['syncQueueCallerAbandon']=function(_0x4c1f1c){try{if(this[_0xfefe('0x5f')](_0x4c1f1c)){logger[_0xfefe('0x4a')](_0xfefe('0x7b'),_0x4c1f1c[_0xfefe('0x44')],util[_0xfefe('0x39')](_0x4c1f1c,{'showHidden':![],'depth':null}));if(this[_0xfefe('0xe')][_0x4c1f1c[_0xfefe('0x44')]]){var _0x5a20d5=_[_0xfefe('0x7c')](this['queueReports'][_0x4c1f1c[_0xfefe('0x44')]]);_0x5a20d5['queuecallercomplete']=![];_0x5a20d5[_0xfefe('0x7d')]=null;_0x5a20d5[_0xfefe('0x7e')]=_0x4c1f1c[_0xfefe('0x7e')];_0x5a20d5[_0xfefe('0x7f')]=_0x4c1f1c[_0xfefe('0x7f')];_0x5a20d5[_0xfefe('0x19')]=!![];_0x5a20d5['queuecallerabandonAt']=moment()[_0xfefe('0x45')](_0xfefe('0x73'));_0x5a20d5['queuecallerexitreason']='ABANDONED';_0x5a20d5['lastAssignedTo']=null;logger[_0xfefe('0x69')]('[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s',_0x5a20d5[_0xfefe('0x47')],_0x5a20d5[_0xfefe('0x4e')]);this[_0xfefe('0x10')][_0x4c1f1c[_0xfefe('0x44')]]=_0x5a20d5;this[_0xfefe('0x3e')](_0x5a20d5,'queuecallerabandon');}}}catch(_0x21f297){logger[_0xfefe('0x37')](_0xfefe('0x7b'),_0x4c1f1c['uniqueid'],util[_0xfefe('0x39')](_0x21f297,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xfefe('0xc')]['syncQueueCallerLeave']=function(_0x3fa477){try{if(this[_0xfefe('0x5f')](_0x3fa477)){logger[_0xfefe('0x4a')]('[%s][voiceQueueReport][queuecallerleave]',_0x3fa477[_0xfefe('0x44')],util[_0xfefe('0x39')](_0x3fa477,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x3fa477['uniqueid']]){var _0x2d2adc=_['last'](this[_0xfefe('0xe')][_0x3fa477[_0xfefe('0x44')]]);_0x2d2adc[_0xfefe('0x80')]=moment()[_0xfefe('0x45')](_0xfefe('0x73'));_0x2d2adc[_0xfefe('0x81')]=_0x3fa477[_0xfefe('0x81')];_0x2d2adc[_0xfefe('0x82')]=_0x3fa477[_0xfefe('0x82')];logger['info'](_0xfefe('0x83'),_0x2d2adc[_0xfefe('0x47')],_0x2d2adc[_0xfefe('0x4e')],_0x3fa477['connectedlinenum'],_0x3fa477[_0xfefe('0x82')]);this[_0xfefe('0x10')][_0x3fa477[_0xfefe('0x44')]]=_0x2d2adc;this[_0xfefe('0x41')](_0x2d2adc,_0xfefe('0x1b'));}}}catch(_0xda9482){logger[_0xfefe('0x37')](_0xfefe('0x84'),_0x3fa477[_0xfefe('0x44')],util['inspect'](_0xda9482,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xfefe('0xc')]['syncAgentConnect']=function(_0x206e8b){try{if(this['isNotNull'](_0x206e8b)){logger[_0xfefe('0x4a')](_0xfefe('0x85'),_0x206e8b[_0xfefe('0x44')],util[_0xfefe('0x39')](_0x206e8b,{'showHidden':![],'depth':null}));if(this[_0xfefe('0xe')][_0x206e8b[_0xfefe('0x44')]]){var _0x1be9a5=_[_0xfefe('0x7c')](this[_0xfefe('0xe')][_0x206e8b[_0xfefe('0x44')]]);_0x1be9a5[_0xfefe('0x86')]=!![];_0x1be9a5['queuecallerexitreason']=_0xfefe('0x87');logger[_0xfefe('0x69')](_0xfefe('0x88'),_0x1be9a5[_0xfefe('0x47')],_0x1be9a5[_0xfefe('0x4e')]);}}}catch(_0x292e47){logger[_0xfefe('0x37')](_0xfefe('0x85'),_0x206e8b[_0xfefe('0x44')],util[_0xfefe('0x39')](_0x292e47,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xfefe('0xc')]['syncAgentComplete']=function(_0x4ca741){try{if(this[_0xfefe('0x5f')](_0x4ca741)){logger[_0xfefe('0x4a')]('[%s][voiceQueueReport][agentcomplete]',_0x4ca741['uniqueid'],util[_0xfefe('0x39')](_0x4ca741,{'showHidden':![],'depth':null}));if(this[_0xfefe('0xe')][_0x4ca741[_0xfefe('0x44')]]){var _0x4b4cc0=_['last'](this['queueReports'][_0x4ca741[_0xfefe('0x44')]]);_0x4b4cc0[_0xfefe('0x19')]=![];_0x4b4cc0[_0xfefe('0x89')]=null;_0x4b4cc0[_0xfefe('0x8a')]=!![];_0x4b4cc0[_0xfefe('0x8b')]=_0x4ca741['membername'];_0x4b4cc0[_0xfefe('0x7e')]=_0x4ca741[_0xfefe('0x7e')];_0x4b4cc0[_0xfefe('0x86')]=!![];_0x4b4cc0[_0xfefe('0x8c')]=![];_0x4b4cc0['queuecallerexitAt']=null;if(!_0x4b4cc0[_0xfefe('0x8d')]){if(_0x4ca741['reason']==_0xfefe('0x8d')){_0x4b4cc0[_0xfefe('0x8e')]=_0xfefe('0x8f');logger[_0xfefe('0x69')](_0xfefe('0x90'),_0x4b4cc0[_0xfefe('0x47')],_0x4b4cc0[_0xfefe('0x4e')]);}else{if(_['startsWith'](_0x4ca741[_0xfefe('0x33')][_0xfefe('0x91')](),_0xfefe('0x92'))){if(this['queueReports'][_0x4ca741[_0xfefe('0x93')]]){var _0x3333c5=_[_0xfefe('0x7c')](this[_0xfefe('0xe')][_0x4ca741[_0xfefe('0x93')]]);_0x3333c5[_0xfefe('0x86')]=![];_0x3333c5['queuecallerexit']=!![];_0x3333c5[_0xfefe('0x94')]=moment(_0x4b4cc0[_0xfefe('0x95')])[_0xfefe('0x96')](_0x4ca741[_0xfefe('0x7e')],_0xfefe('0x97'))[_0xfefe('0x45')]('YYYY-MM-DD\x20HH:mm:ss');_0x3333c5['queuecallerexitreason']=_0xfefe('0x98');_0x3333c5[_0xfefe('0x8d')]=!![];_0x3333c5[_0xfefe('0x99')]=_0xfefe('0x9a');_0x3333c5['transferexten']=_0x4ca741[_0xfefe('0x9b')];_0x3333c5[_0xfefe('0x9c')]=_0x4ca741[_0xfefe('0x44')];logger[_0xfefe('0x69')](_0xfefe('0x9d'),_0x3333c5['name'],_0x3333c5['type']);var _0x506198=this[_0xfefe('0xe')][_0x4ca741[_0xfefe('0x93')]];this[_0xfefe('0xe')][_0x4ca741[_0xfefe('0x93')]]=this[_0xfefe('0xe')][_0x4ca741[_0xfefe('0x44')]];this[_0xfefe('0xe')][_0x4ca741[_0xfefe('0x44')]]=_0x506198;}}else{_0x4b4cc0[_0xfefe('0x8e')]=_0xfefe('0x9e')+_0x4ca741['reason'][_0xfefe('0x9f')]();logger[_0xfefe('0x69')](_0xfefe('0xa0'),_0x4b4cc0[_0xfefe('0x47')],_0x4b4cc0['type'],_0x4b4cc0['queuecallerexitreason']);}}}this[_0xfefe('0x10')][_0x4ca741[_0xfefe('0x44')]]=_0x4b4cc0;this[_0xfefe('0x3e')](_0x4b4cc0,'agentcomplete');}}}catch(_0x4a9b7b){logger[_0xfefe('0x37')]('[%s][voiceQueueReport][agentcomplete]',_0x4ca741['uniqueid'],util[_0xfefe('0x39')](_0x4a9b7b,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xfefe('0xc')][_0xfefe('0xa1')]=function(_0x4540b6){try{if(this[_0xfefe('0x5f')](_0x4540b6)){logger[_0xfefe('0x4a')]('[%s][voiceQueueReport][varset]',_0x4540b6['uniqueid'],util[_0xfefe('0x39')](_0x4540b6,{'showHidden':![],'depth':null}));this['addVariable'](_0x4540b6[_0xfefe('0x44')],_[_0xfefe('0x78')](_0x4540b6[_0xfefe('0xa2')])[0x0],_0x4540b6[_0xfefe('0xa3')]);if(this[_0xfefe('0xe')][_0x4540b6[_0xfefe('0x44')]]){var _0x1326d4=_[_0xfefe('0x7c')](this[_0xfefe('0xe')][_0x4540b6[_0xfefe('0x44')]]);if(_0x1326d4){if(this[_0xfefe('0x5f')](_0x4540b6['variable'])&&this['isNotNull'](_0x4540b6[_0xfefe('0xa2')][_0xfefe('0xa4')])){switch(_0x4540b6[_0xfefe('0xa3')]){case _0xfefe('0xa5'):_0x1326d4[_0xfefe('0x8c')]=![];_0x1326d4[_0xfefe('0x94')]=null;break;case _0xfefe('0xa6'):_0x1326d4['lastevent']=_0xfefe('0xa7');_0x1326d4[_0xfefe('0x8c')]=!![];_0x1326d4['queuecallerexitAt']=moment()[_0xfefe('0x45')](_0xfefe('0x73'));_0x1326d4['queuecallerleaveAt']=moment()[_0xfefe('0x45')]('YYYY-MM-DD\x20HH:mm:ss');logger['debug'](_0xfefe('0xa8'),_0x4540b6[_0xfefe('0x44')],util[_0xfefe('0x39')](_0x1326d4,{'showHidden':![],'depth':null}));ami['emit'](_0xfefe('0xa9'),_0x1326d4);break;default:_0x1326d4[_0xfefe('0x8c')]=!![];_0x1326d4[_0xfefe('0x94')]=moment()[_0xfefe('0x45')]('YYYY-MM-DD\x20HH:mm:ss');_0x1326d4[_0xfefe('0x80')]=moment()[_0xfefe('0x45')](_0xfefe('0x73'));}_0x1326d4[_0xfefe('0x19')]=![];_0x1326d4[_0xfefe('0x89')]=null;_0x1326d4['queuecallerexitreason']=_0x4540b6[_0xfefe('0xa3')];this['channels'][_0x4540b6[_0xfefe('0x44')]]=_0x1326d4;this['emitVoiceQueueChannelRemove'](_0x1326d4,'varset');}else if(this[_0xfefe('0x5f')](_0x4540b6[_0xfefe('0xa2')])&&this[_0xfefe('0x5f')](_0x4540b6[_0xfefe('0xa2')][_0xfefe('0xaa')])){if(!_0x1326d4[_0xfefe('0x19')]){_0x1326d4[_0xfefe('0x8c')]=!![];_0x1326d4[_0xfefe('0x94')]=moment()['format'](_0xfefe('0x73'));_0x1326d4[_0xfefe('0x8e')]='EXITWITHKEY';_0x1326d4[_0xfefe('0x80')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0xfefe('0x10')][_0x4540b6[_0xfefe('0x44')]]=_0x1326d4;}}logger[_0xfefe('0x69')](_0xfefe('0xab'),_0x4540b6[_0xfefe('0x44')],_0x1326d4[_0xfefe('0x47')],_0x1326d4[_0xfefe('0x4e')],_['keys'](_0x4540b6[_0xfefe('0xa2')])[0x0],_0x4540b6['value']);_0x1326d4[_0xfefe('0x14')]=this[_0xfefe('0x14')][_0x4540b6['uniqueid']];}}}}catch(_0x303261){logger['error']('[%s][voiceQueueReport][varset]',_0x4540b6['uniqueid'],util[_0xfefe('0x39')](_0x303261,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xfefe('0xac')]=function(_0x3c5e58,_0x3d484e,_0x289fa3){var _0x25c6a9=['rtpaudioqos',_0xfefe('0xad'),_0xfefe('0xae'),_0xfefe('0xaf'),_0xfefe('0xb0'),'rtpaudioqoslossbridged',_0xfefe('0xb1'),_0xfefe('0xb2'),_0xfefe('0xb3'),_0xfefe('0xb4'),_0xfefe('0xb5'),_0xfefe('0xb6'),'membercalls',_0xfefe('0xb7'),'memberinterface','memberlastcall',_0xfefe('0xb8'),'memberpenalty',_0xfefe('0xb9')];if(!_[_0xfefe('0x30')](_0x3d484e)&&!_['includes'](_0x25c6a9,_0x3d484e)){if(_[_0xfefe('0x60')](this[_0xfefe('0x14')][_0x3c5e58])){this[_0xfefe('0x14')][_0x3c5e58]={};}this[_0xfefe('0x14')][_0x3c5e58][_0x3d484e]=_0x289fa3;}};VoiceQueueReport[_0xfefe('0xc')][_0xfefe('0x1e')]=function(_0x4d3b87){try{if(this[_0xfefe('0x5f')](_0x4d3b87)){logger[_0xfefe('0x4a')]('[%s][voiceQueueReport][hangup]',_0x4d3b87['uniqueid'],util[_0xfefe('0x39')](_0x4d3b87,{'showHidden':![],'depth':null}));if(this[_0xfefe('0xe')][_0x4d3b87[_0xfefe('0x44')]]){for(var _0x15cdbc=0x0,_0x37534c={};_0x15cdbc=0x0?moment(_0x29172c[_0x5d4e('0x16')])[_0x5d4e('0xd')](_0x29172c[_0x5d4e('0x15')],'seconds'):null,'data1':_0x5d4e('0x17'),'data2':_0x29172c[_0x5d4e('0x11')],'data3':_0x29172c[_0x5d4e('0xe')],'data4':_0x29172c[_0x5d4e('0x18')]||null,'role':_0x5d4e('0x10'),'internal':_0x29172c[_0x5d4e('0x11')]?_[_0x5d4e('0x19')](_0x29172c[_0x5d4e('0x11')]):undefined,'uniqueid':_0x29172c[_0x5d4e('0x12')]},'log':_0x5d4e('0x5')});}; \ No newline at end of file +var _0x8617=['voiceQueueReport','queuecallercompleteAt','queuecallerexitAt','Request','CreateMemberReport','voice','isNil','interface','format','lastAssignedTo','TALKING','queuecallerleaveAt','diff','seconds','calleridnum','exten','queue','agent','accountcode','toNumber','voiceDialReport','membername','starttime','endtime','outbound','dialstring','uniqueid','moment','lodash','util','../client'];(function(_0x3b753d,_0x5ad7a1){var _0x3a654d=function(_0x2f5ddf){while(--_0x2f5ddf){_0x3b753d['push'](_0x3b753d['shift']());}};_0x3a654d(++_0x5ad7a1);}(_0x8617,0x1ec));var _0x7861=function(_0x1ca903,_0x4be79c){_0x1ca903=_0x1ca903-0x0;var _0x2e6620=_0x8617[_0x1ca903];return _0x2e6620;};'use strict';var moment=require(_0x7861('0x0'));var _=require(_0x7861('0x1'));var util=require(_0x7861('0x2'));var client=require(_0x7861('0x3'));exports[_0x7861('0x4')]=function(_0x12e14b){var _0x45a3d7=_0x12e14b[_0x7861('0x5')]||_0x12e14b[_0x7861('0x6')];return client[_0x7861('0x7')](_0x7861('0x8'),{'body':{'channel':_0x7861('0x9'),'membername':_0x12e14b['lastAssignedTo'],'interface':_[_0x7861('0xa')](_0x12e14b[_0x7861('0xb')])?util[_0x7861('0xc')]('SIP/%s',_0x12e14b[_0x7861('0xd')]):_0x12e14b[_0x7861('0xb')],'type':_0x7861('0xe'),'enterAt':_0x12e14b[_0x7861('0xf')],'exitAt':_0x45a3d7,'duration':moment(_0x45a3d7)[_0x7861('0x10')](_0x12e14b[_0x7861('0xf')],_0x7861('0x11')),'data1':'inbound','data2':_0x12e14b[_0x7861('0x12')],'data3':_0x12e14b[_0x7861('0x13')],'data4':null,'data5':_0x12e14b[_0x7861('0x14')],'role':_0x7861('0x15'),'internal':_0x12e14b[_0x7861('0x16')]?_[_0x7861('0x17')](_0x12e14b[_0x7861('0x16')]):undefined,'uniqueid':_0x12e14b['uniqueid']},'log':_0x7861('0x8')});};exports[_0x7861('0x18')]=function(_0x122334){return client[_0x7861('0x7')](_0x7861('0x8'),{'body':{'channel':'voice','membername':_0x122334[_0x7861('0x19')],'interface':_0x122334[_0x7861('0xb')],'type':_0x7861('0xe'),'enterAt':_0x122334[_0x7861('0x1a')],'exitAt':_0x122334[_0x7861('0x1b')],'duration':moment(_0x122334[_0x7861('0x1b')])[_0x7861('0x10')](_0x122334[_0x7861('0x1a')],_0x7861('0x11'))>=0x0?moment(_0x122334[_0x7861('0x1b')])[_0x7861('0x10')](_0x122334['starttime'],'seconds'):null,'data1':_0x7861('0x1c'),'data2':_0x122334[_0x7861('0x16')],'data3':_0x122334[_0x7861('0x13')],'data4':_0x122334[_0x7861('0x1d')]||null,'role':_0x7861('0x15'),'internal':_0x122334[_0x7861('0x16')]?_['toNumber'](_0x122334[_0x7861('0x16')]):undefined,'uniqueid':_0x122334[_0x7861('0x1e')]},'log':_0x7861('0x8')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index 2f47042..2343367 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 _0xc2af=['../client','Request','stopRecordingOnTransfer','GetSettings'];(function(_0x230327,_0x42a080){var _0x396eac=function(_0x5c4c4c){while(--_0x5c4c4c){_0x230327['push'](_0x230327['shift']());}};_0x396eac(++_0x42a080);}(_0xc2af,0x1bc));var _0xfc2a=function(_0x4605f2,_0x21c0ea){_0x4605f2=_0x4605f2-0x0;var _0x1566e1=_0xc2af[_0x4605f2];return _0x1566e1;};'use strict';var client=require(_0xfc2a('0x0'));exports['getSettings']=function(){return client[_0xfc2a('0x1')]('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xfc2a('0x2')]},'log':_0xfc2a('0x3')});}; \ No newline at end of file +var _0xb32d=['getSettings','Request','ShowSetting','stopRecordingOnTransfer','../client'];(function(_0x18373b,_0x4509c1){var _0x3306e3=function(_0x2787e1){while(--_0x2787e1){_0x18373b['push'](_0x18373b['shift']());}};_0x3306e3(++_0x4509c1);}(_0xb32d,0x1da));var _0xdb32=function(_0x32497d,_0x2d305a){_0x32497d=_0x32497d-0x0;var _0x5e05aa=_0xb32d[_0x32497d];return _0x5e05aa;};'use strict';var client=require(_0xdb32('0x0'));exports[_0xdb32('0x1')]=function(){return client[_0xdb32('0x2')](_0xdb32('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xdb32('0x4')]},'log':'GetSettings'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index 8324811..fe6b8cc 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 _0x012d=['GetTemplate','Request','name'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x012d,0x14e));var _0xd012=function(_0x26ccb3,_0x5984be){_0x26ccb3=_0x26ccb3-0x0;var _0x259ea0=_0x012d[_0x26ccb3];return _0x259ea0;};'use strict';var client=require('../client');exports['getTemplates']=function(_0x4e70c8){return function(_0xca421){return client[_0xd012('0x0')]('GetTemplate',{'options':{'raw':!![],'attributes':['id',_0xd012('0x1'),'html']},'log':_0xd012('0x2')});};}; \ No newline at end of file +var _0x6123=['GetTemplate','html','getTemplates','Request'];(function(_0x1fd798,_0x528bfa){var _0x41d95e=function(_0x4ba2e9){while(--_0x4ba2e9){_0x1fd798['push'](_0x1fd798['shift']());}};_0x41d95e(++_0x528bfa);}(_0x6123,0x1e2));var _0x3612=function(_0x386ab9,_0x3a3234){_0x386ab9=_0x386ab9-0x0;var _0x407220=_0x6123[_0x386ab9];return _0x407220;};'use strict';var client=require('../client');exports[_0x3612('0x0')]=function(_0x411ebf){return function(_0x526ec2){return client[_0x3612('0x1')](_0x3612('0x2'),{'options':{'raw':!![],'attributes':['id','name',_0x3612('0x3')]},'log':_0x3612('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index 7065cef..f7bf45f 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 _0xd14f=['action','data3','data4','data5','data6','data7','../client','getTriggers','Request','GetTrigger','name','Condition','AllConditions','field','operator','AnyConditions','value','Action','Actions'];(function(_0x35a9c6,_0x47074c){var _0x34cd9c=function(_0x4cb0a1){while(--_0x4cb0a1){_0x35a9c6['push'](_0x35a9c6['shift']());}};_0x34cd9c(++_0x47074c);}(_0xd14f,0x1ce));var _0xfd14=function(_0x49afd2,_0x4f9b61){_0x49afd2=_0x49afd2-0x0;var _0x3e09a0=_0xd14f[_0x49afd2];return _0x3e09a0;};'use strict';var client=require(_0xfd14('0x0'));exports[_0xfd14('0x1')]=function(_0x2d644b){return function(_0x5bb8bb){return client[_0xfd14('0x2')](_0xfd14('0x3'),{'options':{'raw':![],'attributes':['id',_0xfd14('0x4'),'channel','status'],'include':[{'model':_0xfd14('0x5'),'as':_0xfd14('0x6'),'attributes':['id',_0xfd14('0x7'),_0xfd14('0x8'),'value']},{'model':_0xfd14('0x5'),'as':_0xfd14('0x9'),'attributes':['id',_0xfd14('0x7'),_0xfd14('0x8'),_0xfd14('0xa')]},{'model':_0xfd14('0xb'),'as':_0xfd14('0xc'),'attributes':['id',_0xfd14('0xd'),'data1','data2',_0xfd14('0xe'),_0xfd14('0xf'),_0xfd14('0x10'),_0xfd14('0x11'),_0xfd14('0x12')]}]},'log':'GetTrigger'});};}; \ No newline at end of file +var _0x63da=['Request','GetTrigger','name','status','Condition','field','operator','value','AnyConditions','Action','Actions','data2','data4','../client'];(function(_0x9dfc10,_0x19c2d5){var _0x4f938a=function(_0x12b1e5){while(--_0x12b1e5){_0x9dfc10['push'](_0x9dfc10['shift']());}};_0x4f938a(++_0x19c2d5);}(_0x63da,0x141));var _0xa63d=function(_0xe8c1d,_0x29fbc4){_0xe8c1d=_0xe8c1d-0x0;var _0x2680b8=_0x63da[_0xe8c1d];return _0x2680b8;};'use strict';var client=require(_0xa63d('0x0'));exports['getTriggers']=function(_0x1b3bea){return function(_0x4583ba){return client[_0xa63d('0x1')](_0xa63d('0x2'),{'options':{'raw':![],'attributes':['id',_0xa63d('0x3'),'channel',_0xa63d('0x4')],'include':[{'model':_0xa63d('0x5'),'as':'AllConditions','attributes':['id',_0xa63d('0x6'),_0xa63d('0x7'),_0xa63d('0x8')]},{'model':'Condition','as':_0xa63d('0x9'),'attributes':['id',_0xa63d('0x6'),_0xa63d('0x7'),_0xa63d('0x8')]},{'model':_0xa63d('0xa'),'as':_0xa63d('0xb'),'attributes':['id','action','data1',_0xa63d('0xc'),'data3',_0xa63d('0xd'),'data5','data6','data7']}]},'log':_0xa63d('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index 746ba2f..bdc5c88 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 _0xcf95=['getTrunks','GetTrunk','name','registry','defaultuser','../client'];(function(_0x25caa4,_0x31e71f){var _0x92b96d=function(_0x52e1a4){while(--_0x52e1a4){_0x25caa4['push'](_0x25caa4['shift']());}};_0x92b96d(++_0x31e71f);}(_0xcf95,0xa1));var _0x5cf9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcf95[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x5cf9('0x0'));exports[_0x5cf9('0x1')]=function(_0x4a9fcc){return function(_0x47be5e){return client['Request'](_0x5cf9('0x2'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x5cf9('0x3'),_0x5cf9('0x4'),_0x5cf9('0x5')]},'log':'GetTrunk'});};}; \ No newline at end of file +var _0x20ce=['name','registry','defaultuser','../client','getTrunks','Request','GetTrunk'];(function(_0x2fdc25,_0x7c1103){var _0x10666c=function(_0x34b8b8){while(--_0x34b8b8){_0x2fdc25['push'](_0x2fdc25['shift']());}};_0x10666c(++_0x7c1103);}(_0x20ce,0x10d));var _0xe20c=function(_0x5e65dc,_0x47dc40){_0x5e65dc=_0x5e65dc-0x0;var _0x33dd4c=_0x20ce[_0x5e65dc];return _0x33dd4c;};'use strict';var client=require(_0xe20c('0x0'));exports[_0xe20c('0x1')]=function(_0x29e017){return function(_0x597c57){return client[_0xe20c('0x2')](_0xe20c('0x3'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0xe20c('0x4'),_0xe20c('0x5'),_0xe20c('0x6')]},'log':_0xe20c('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index 9016665..09e251c 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 _0xa9e0=['agent','lastPauseAt','interface','../client','getAgents','Request','name','accountcode','fullname','online','lastLoginAt','pauseType','voicePause','phone','mobile','getTelephones','telephone','internal','savePause','PauseUser','saveUnpause','UnpauseUser','getAgent','ShowUser'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xa9e0,0x123));var _0x0a9e=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0xa9e0[_0xa1e3e3];return _0xc980e9;};'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'),'email',_0x0a9e('0x4'),_0x0a9e('0x5'),_0x0a9e('0x6'),_0x0a9e('0x7'),_0x0a9e('0x8'),'lastPauseAt',_0x0a9e('0x9'),_0x0a9e('0xa'),_0x0a9e('0xb'),'interface']},'log':'getAgents'});};};exports[_0x0a9e('0xc')]=function(){return function(){return client['Request']('GetUser',{'options':{'raw':!![],'where':{'role':_0x0a9e('0xd')},'attributes':['id',_0x0a9e('0x3'),_0x0a9e('0x4'),_0x0a9e('0xe')]},'log':_0x0a9e('0xc')});};};exports[_0x0a9e('0xf')]=function(_0x4a4c56,_0x50dfb2,_0x527cdd){return client['Request'](_0x0a9e('0x10'),{'body':{'type':_0x50dfb2,'uniqueid':_0x527cdd},'options':{'where':{'id':_0x4a4c56['id']}},'log':_0x0a9e('0xf')});};exports[_0x0a9e('0x11')]=function(_0x26d672){return client[_0x0a9e('0x2')](_0x0a9e('0x12'),{'body':{},'options':{'where':{'id':_0x26d672['id']}},'log':'savePause'});};exports[_0x0a9e('0x13')]=function(_0x239b12){return client[_0x0a9e('0x2')](_0x0a9e('0x14'),{'options':{'raw':![],'where':{'role':_0x0a9e('0x15'),'id':_0x239b12},'attributes':['id',_0x0a9e('0x3'),'email',_0x0a9e('0x4'),'fullname',_0x0a9e('0x6'),'lastLoginAt',_0x0a9e('0x8'),_0x0a9e('0x16'),'voicePause',_0x0a9e('0x17')]},'log':'getAgent'});}; \ 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(_0x208d2c,_0x1c2cf5){var _0x4a670b=function(_0x2aee52){while(--_0x2aee52){_0x208d2c['push'](_0x208d2c['shift']());}};_0x4a670b(++_0x1c2cf5);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x5a7112,_0x1f9492){_0x5a7112=_0x5a7112-0x0;var _0x3147f7=_0xcb91[_0x5a7112];return _0x3147f7;};'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 571428a..f48dfcd 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 _0x70c4=['Request','CreateVoiceAgentReport','update'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x70c4,0xf6));var _0x470c=function(_0xedc0f3,_0x3501f0){_0xedc0f3=_0xedc0f3-0x0;var _0x5adba5=_0x70c4[_0xedc0f3];return _0x5adba5;};'use strict';var client=require('../client');exports['create']=function(_0x4e91c5){return client[_0x470c('0x0')](_0x470c('0x1'),{'body':_0x4e91c5,'log':_0x470c('0x1')});};exports[_0x470c('0x2')]=function(_0x17b538,_0x8b564a,_0x396831){return client[_0x470c('0x0')]('UpdateVoiceAgentReport',{'body':_0x17b538,'options':{'where':{'uniqueid':_0x8b564a,'interface':_0x396831,'agentcomplete':!![]}},'log':'UpdateVoiceAgentReport'});}; \ No newline at end of file +var _0x5f5b=['UpdateVoiceAgentReport','create','CreateVoiceAgentReport','Request'];(function(_0x5b3b9b,_0x1c71b0){var _0x47c1d7=function(_0x34c20b){while(--_0x34c20b){_0x5b3b9b['push'](_0x5b3b9b['shift']());}};_0x47c1d7(++_0x1c71b0);}(_0x5f5b,0x16d));var _0xb5f5=function(_0xd60857,_0x1aa733){_0xd60857=_0xd60857-0x0;var _0x516870=_0x5f5b[_0xd60857];return _0x516870;};'use strict';var client=require('../client');exports[_0xb5f5('0x0')]=function(_0xc0da2e){return client['Request'](_0xb5f5('0x1'),{'body':_0xc0da2e,'log':_0xb5f5('0x1')});};exports['update']=function(_0x1476ef,_0x53acc3,_0x3fc188){return client[_0xb5f5('0x2')](_0xb5f5('0x3'),{'body':_0x1476ef,'options':{'where':{'uniqueid':_0x53acc3,'interface':_0x3fc188,'agentcomplete':!![]}},'log':'UpdateVoiceAgentReport'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index 20b951d..99ea28e 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 _0x533b=['startOf','format','YYYY-MM-DD\x20HH:mm:ss','day','type','disposition','duration','billableseconds','moment','util','lodash','../client','create','CreateVoiceCallReport','calleridnum','context','callerid','DOCUMENTATION','getVoiceCallReports','GetVoiceCallReport','outbound'];(function(_0x34da1f,_0x37a259){var _0x4897cc=function(_0x24cf35){while(--_0x24cf35){_0x34da1f['push'](_0x34da1f['shift']());}};_0x4897cc(++_0x37a259);}(_0x533b,0x143));var _0xb533=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x533b[_0x14add3];return _0x4a174f;};'use strict';var moment=require(_0xb533('0x0'));var util=require(_0xb533('0x1'));var _=require(_0xb533('0x2'));var client=require(_0xb533('0x3'));exports[_0xb533('0x4')]=function(_0x4698fa){return client['Request'](_0xb533('0x5'),{'body':_['merge'](_0x4698fa,{'source':_0x4698fa[_0xb533('0x6')],'destinationcontext':_0x4698fa[_0xb533('0x7')],'callerid':_0x4698fa[_0xb533('0x8')],'amaflags':_0xb533('0x9')}),'log':_0xb533('0x5')});};exports[_0xb533('0xa')]=function(){return function(){return client['Request'](_0xb533('0xb'),{'options':{'where':{'type':[_0xb533('0xc')],'createdAt':{'$between':[moment()[_0xb533('0xd')]('day')[_0xb533('0xe')](_0xb533('0xf')),moment()['endOf'](_0xb533('0x10'))[_0xb533('0xe')](_0xb533('0xf'))]}},'attributes':[_0xb533('0x11'),_0xb533('0x12'),_0xb533('0x13'),_0xb533('0x14')]},'log':'GetVoiceCallReports'});};}; \ No newline at end of file +var _0x975d=['util','../client','create','Request','CreateVoiceCallReport','merge','calleridnum','callerid','DOCUMENTATION','getVoiceCallReports','GetVoiceCallReport','outbound','format','YYYY-MM-DD\x20HH:mm:ss','day','type','disposition','duration','GetVoiceCallReports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x975d,0xe4));var _0xd975=function(_0x3a1921,_0x1be33c){_0x3a1921=_0x3a1921-0x0;var _0x4c5293=_0x975d[_0x3a1921];return _0x4c5293;};'use strict';var moment=require('moment');var util=require(_0xd975('0x0'));var _=require('lodash');var client=require(_0xd975('0x1'));exports[_0xd975('0x2')]=function(_0x2bd2c6){return client[_0xd975('0x3')](_0xd975('0x4'),{'body':_[_0xd975('0x5')](_0x2bd2c6,{'source':_0x2bd2c6[_0xd975('0x6')],'destinationcontext':_0x2bd2c6['context'],'callerid':_0x2bd2c6[_0xd975('0x7')],'amaflags':_0xd975('0x8')}),'log':_0xd975('0x4')});};exports[_0xd975('0x9')]=function(){return function(){return client[_0xd975('0x3')](_0xd975('0xa'),{'options':{'where':{'type':[_0xd975('0xb')],'createdAt':{'$between':[moment()['startOf']('day')[_0xd975('0xc')](_0xd975('0xd')),moment()['endOf'](_0xd975('0xe'))[_0xd975('0xc')](_0xd975('0xd'))]}},'attributes':[_0xd975('0xf'),_0xd975('0x10'),_0xd975('0x11'),'billableseconds']},'log':_0xd975('0x12')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index 891a3d2..4123437 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 _0xed58=['../client','Request','CreateVoiceDialReport'];(function(_0x326e0f,_0x3ed176){var _0x5dd34a=function(_0x5eec95){while(--_0x5eec95){_0x326e0f['push'](_0x326e0f['shift']());}};_0x5dd34a(++_0x3ed176);}(_0xed58,0xab));var _0x8ed5=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xed58[_0x432682];return _0x463d05;};'use strict';var client=require(_0x8ed5('0x0'));exports['create']=function(_0x3f5e4e){return client[_0x8ed5('0x1')]('CreateVoiceDialReport',{'body':_0x3f5e4e,'log':_0x8ed5('0x2')});}; \ No newline at end of file +var _0xf066=['Request','CreateVoiceDialReport','../client'];(function(_0x2351c4,_0x1dca54){var _0x1dd3f8=function(_0x4c3fa2){while(--_0x4c3fa2){_0x2351c4['push'](_0x2351c4['shift']());}};_0x1dd3f8(++_0x1dca54);}(_0xf066,0x1d0));var _0x6f06=function(_0x3f4cd0,_0x303070){_0x3f4cd0=_0x3f4cd0-0x0;var _0x3f9f01=_0xf066[_0x3f4cd0];return _0x3f9f01;};'use strict';var client=require(_0x6f06('0x0'));exports['create']=function(_0x3e80a5){return client[_0x6f06('0x1')](_0x6f06('0x2'),{'body':_0x3e80a5,'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 a18e34d..dd7d62a 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 _0xe87e=['exten','../client','getVoiceExtensions','Request','GetVoiceExtension'];(function(_0x528511,_0x815fd3){var _0xd1b2b7=function(_0x3bf131){while(--_0x3bf131){_0x528511['push'](_0x528511['shift']());}};_0xd1b2b7(++_0x815fd3);}(_0xe87e,0x17d));var _0xee87=function(_0x631a3c,_0x1b61b6){_0x631a3c=_0x631a3c-0x0;var _0x2bdfa3=_0xe87e[_0x631a3c];return _0x2bdfa3;};'use strict';var client=require(_0xee87('0x0'));exports[_0xee87('0x1')]=function(){return function(){return client[_0xee87('0x2')](_0xee87('0x3'),{'options':{'raw':!![],'attributes':['id',_0xee87('0x4'),'recordingFormat'],'where':{'VoiceExtensionId':null}},'log':_0xee87('0x1')});};}; \ No newline at end of file +var _0x0427=['GetVoiceExtension','recordingFormat','getVoiceExtensions','Request'];(function(_0x2df13f,_0x3a3921){var _0x5c8a3f=function(_0x38aba4){while(--_0x38aba4){_0x2df13f['push'](_0x2df13f['shift']());}};_0x5c8a3f(++_0x3a3921);}(_0x0427,0x137));var _0x7042=function(_0x5e06f0,_0x57018e){_0x5e06f0=_0x5e06f0-0x0;var _0x46e4ab=_0x0427[_0x5e06f0];return _0x46e4ab;};'use strict';var client=require('../client');exports['getVoiceExtensions']=function(){return function(){return client[_0x7042('0x0')](_0x7042('0x1'),{'options':{'raw':!![],'attributes':['id','exten',_0x7042('0x2')],'where':{'VoiceExtensionId':null}},'log':_0x7042('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index 84ecb4e..e10c81e 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 _0x23ce=['name','acw','monitor_format','type','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDSilenceThreshold','dialAgiAfterHangupClient','dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber','dialNoSuchNumberMaxRetry','dialDropMaxRetry','dialAbandonedMaxRetry','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','Trunk','callerid','active','Pause','Interval','Intervals','interval','getVoiceQueues'];(function(_0x5a9c0c,_0x4ec485){var _0x53c77d=function(_0x1cf384){while(--_0x1cf384){_0x5a9c0c['push'](_0x5a9c0c['shift']());}};_0x53c77d(++_0x4ec485);}(_0x23ce,0x150));var _0xe23c=function(_0x5f2c0d,_0x109202){_0x5f2c0d=_0x5f2c0d-0x0;var _0x56549f=_0x23ce[_0x5f2c0d];return _0x56549f;};'use strict';var client=require('../client');exports['getVoiceQueues']=function(){return function(){return client['Request']('GetVoiceQueue',{'options':{'raw':![],'attributes':['id',_0xe23c('0x0'),_0xe23c('0x1'),'acwTimeout','autopause',_0xe23c('0x2'),_0xe23c('0x3'),_0xe23c('0x4'),_0xe23c('0x5'),_0xe23c('0x6'),_0xe23c('0x7'),_0xe23c('0x8'),_0xe23c('0x9'),_0xe23c('0xa'),'dialPredictiveInterval',_0xe23c('0xb'),_0xe23c('0xc'),_0xe23c('0xd'),_0xe23c('0xe'),_0xe23c('0xf'),_0xe23c('0x10'),_0xe23c('0x11'),_0xe23c('0x12'),_0xe23c('0x13'),_0xe23c('0x14'),_0xe23c('0x15'),_0xe23c('0x16'),_0xe23c('0x17'),_0xe23c('0x18'),_0xe23c('0x19'),_0xe23c('0x1a'),_0xe23c('0x1b'),_0xe23c('0x1c'),_0xe23c('0x1d'),_0xe23c('0x1e'),'dialAMDAfterGreetingSilence',_0xe23c('0x1f'),_0xe23c('0x20'),'dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords',_0xe23c('0x21'),'dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent',_0xe23c('0x22'),_0xe23c('0x23'),'monitor_format',_0xe23c('0x24'),_0xe23c('0x25'),'dialCutDigit',_0xe23c('0x26'),'dialNoSuchNumberRetryFrequency',_0xe23c('0x27'),'dialDropRetryFrequency',_0xe23c('0x28'),'dialAbandonedRetryFrequency',_0xe23c('0x29'),_0xe23c('0x2a'),_0xe23c('0x2b'),_0xe23c('0x2c'),_0xe23c('0x2d'),_0xe23c('0x2e'),_0xe23c('0x2f')],'include':[{'model':_0xe23c('0x30'),'as':_0xe23c('0x30'),'attributes':['id',_0xe23c('0x0'),_0xe23c('0x31'),_0xe23c('0x32')]},{'model':_0xe23c('0x33'),'as':'mandatoryDispositionPause','attributes':['id',_0xe23c('0x0')]},{'model':_0xe23c('0x30'),'as':'TrunkBackup','attributes':['id',_0xe23c('0x0'),_0xe23c('0x31'),_0xe23c('0x32')]},{'model':_0xe23c('0x34'),'as':_0xe23c('0x34'),'attributes':['id',_0xe23c('0x0')],'include':[{'model':'Interval','as':_0xe23c('0x35'),'attributes':['id',_0xe23c('0x0'),_0xe23c('0x36')]}]}]},'log':_0xe23c('0x37')});};}; \ No newline at end of file +var _0x0ee9=['dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','strategy','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropRetryFrequency','dialAbandonedMaxRetry','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','Trunk','callerid','mandatoryDispositionPause','name','active','Interval','Intervals','interval','../client','getVoiceQueues','Request','acw','autopause','monitor_format','type','dialActive','dialMethod','dialLimitQueue','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerRetryFrequency','dialTimezone','dialGlobalInterval','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialRecallMeTimeout'];(function(_0x44946b,_0xf874ec){var _0x249bc4=function(_0x40a23e){while(--_0x40a23e){_0x44946b['push'](_0x44946b['shift']());}};_0x249bc4(++_0xf874ec);}(_0x0ee9,0x8c));var _0x90ee=function(_0x35bea0,_0x31686b){_0x35bea0=_0x35bea0-0x0;var _0x43df95=_0x0ee9[_0x35bea0];return _0x43df95;};'use strict';var client=require(_0x90ee('0x0'));exports[_0x90ee('0x1')]=function(){return function(){return client[_0x90ee('0x2')]('GetVoiceQueue',{'options':{'raw':![],'attributes':['id','name',_0x90ee('0x3'),'acwTimeout',_0x90ee('0x4'),_0x90ee('0x5'),_0x90ee('0x6'),_0x90ee('0x7'),_0x90ee('0x8'),'dialLimitChannel',_0x90ee('0x9'),'dialPowerLevel',_0x90ee('0xa'),_0x90ee('0xb'),_0x90ee('0xc'),_0x90ee('0xd'),_0x90ee('0xe'),_0x90ee('0xf'),_0x90ee('0x10'),_0x90ee('0x11'),_0x90ee('0x12'),_0x90ee('0x13'),'dialCongestionRetryFrequency',_0x90ee('0x14'),_0x90ee('0x15'),'dialNoAnswerMaxRetry',_0x90ee('0x16'),'dialGlobalMaxRetry',_0x90ee('0x17'),_0x90ee('0x18'),'dialPrefix','dialCheckDuplicateType',_0x90ee('0x19'),_0x90ee('0x1a'),_0x90ee('0x1b'),_0x90ee('0x1c'),'dialAMDTotalAnalysisTime',_0x90ee('0x1d'),_0x90ee('0x1e'),_0x90ee('0x1f'),_0x90ee('0x20'),'dialAMDMaximumWordLength','timeout',_0x90ee('0x21'),_0x90ee('0x22'),_0x90ee('0x23'),_0x90ee('0x24'),_0x90ee('0x25'),_0x90ee('0x26'),'monitor_format',_0x90ee('0x27'),'dialRandomLastDigitCallerIdNumber','dialCutDigit',_0x90ee('0x28'),_0x90ee('0x29'),'dialDropMaxRetry',_0x90ee('0x2a'),_0x90ee('0x2b'),'dialAbandonedRetryFrequency',_0x90ee('0x2c'),_0x90ee('0x2d'),_0x90ee('0x2e'),'dialAgentRejectRetryFrequency',_0x90ee('0x2f'),_0x90ee('0x30'),_0x90ee('0x31')],'include':[{'model':_0x90ee('0x32'),'as':_0x90ee('0x32'),'attributes':['id','name',_0x90ee('0x33'),'active']},{'model':'Pause','as':_0x90ee('0x34'),'attributes':['id',_0x90ee('0x35')]},{'model':'Trunk','as':'TrunkBackup','attributes':['id',_0x90ee('0x35'),_0x90ee('0x33'),_0x90ee('0x36')]},{'model':_0x90ee('0x37'),'as':_0x90ee('0x37'),'attributes':['id',_0x90ee('0x35')],'include':[{'model':'Interval','as':_0x90ee('0x38'),'attributes':['id','name',_0x90ee('0x39')]}]}]},'log':_0x90ee('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index 7c96736..f222925 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(_0x517047,_0x3893a3){var _0x178903=function(_0x5d1775){while(--_0x5d1775){_0x517047['push'](_0x517047['shift']());}};_0x178903(++_0x3893a3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xa9e0[_0x6c993a];return _0x27f547;};'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(_0x26aafa,_0x100c92){var _0x13b20e=function(_0x3f6216){while(--_0x3f6216){_0x26aafa['push'](_0x26aafa['shift']());}};_0x13b20e(++_0x100c92);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0xa9e0[_0x1ddedd];return _0xa3e1ac;};'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 775e2ac..a54ff88 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 _0x951e=['getVoiceQueueRtPauses','GetVoiceQueueRtPauses'];(function(_0x5b1a74,_0x492502){var _0x42aee9=function(_0xbaf62e){while(--_0xbaf62e){_0x5b1a74['push'](_0x5b1a74['shift']());}};_0x42aee9(++_0x492502);}(_0x951e,0x169));var _0xe951=function(_0x48ce4d,_0x1331c6){_0x48ce4d=_0x48ce4d-0x0;var _0x582890=_0x951e[_0x48ce4d];return _0x582890;};'use strict';var client=require('../client');exports['getVoiceQueueRtPauses']=function(_0xc4aa7c){return function(){return client['Request'](_0xe951('0x0'),{'options':{'where':{'VoiceQueueId':_0xc4aa7c,'paused':!![]},'raw':!![]},'log':_0xe951('0x1')});};}; \ No newline at end of file +var _0x3ff1=['getVoiceQueueRtPauses','Request'];(function(_0x4a58b6,_0x3f91){var _0x33f6e3=function(_0x121e2a){while(--_0x121e2a){_0x4a58b6['push'](_0x4a58b6['shift']());}};_0x33f6e3(++_0x3f91);}(_0x3ff1,0xab));var _0x13ff=function(_0x4a66b9,_0x5cefed){_0x4a66b9=_0x4a66b9-0x0;var _0x4d1a81=_0x3ff1[_0x4a66b9];return _0x4d1a81;};'use strict';var client=require('../client');exports['getVoiceQueueRtPauses']=function(_0x3d238a){return function(){return client[_0x13ff('0x0')]('GetVoiceQueueRtPauses',{'options':{'where':{'VoiceQueueId':_0x3d238a,'paused':!![]},'raw':!![]},'log':_0x13ff('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index f01390e..86b292c 100644 --- a/server/services/ami/rpc/voiceRecording.js +++ b/server/services/ami/rpc/voiceRecording.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['CreateVoiceRecording','merge','monitorFilename','lodash','../client','create'];(function(_0x37a9b0,_0x5d876e){var _0x2791a5=function(_0xe47638){while(--_0xe47638){_0x37a9b0['push'](_0x37a9b0['shift']());}};_0x2791a5(++_0x5d876e);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x7995('0x0'));var client=require(_0x7995('0x1'));exports[_0x7995('0x2')]=function(_0x10a05d){return client['Request'](_0x7995('0x3'),{'body':_[_0x7995('0x4')](_0x10a05d,{'value':_0x10a05d[_0x7995('0x5')]}),'log':_0x7995('0x3')});}; \ No newline at end of file +var _0x9957=['CreateVoiceRecording','merge','monitorFilename','lodash','../client','create'];(function(_0xb2c8cf,_0x329887){var _0x3a85a3=function(_0xa94f39){while(--_0xa94f39){_0xb2c8cf['push'](_0xb2c8cf['shift']());}};_0x3a85a3(++_0x329887);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'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 16745b5..ea76da4 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 _0x2443=['context','extension','blind','CreateVoiceTransferReport','attendedTransfer','origtransfererchannel','origtransferercalleridnum','secondtransfererconnectedlinenum','secondtransfererexten','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','origtransferercontext','origtransfererexten','attended','../client','transfers','blindTransfer','Request','result','transfererchannel','transferercalleridnum','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererlinkedid','transfereechannel','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereeexten','transfereelinkedid','isexternal'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x2443,0xaf));var _0x3244=function(_0x3416d5,_0xe139cb){_0x3416d5=_0x3416d5-0x0;var _0x10c4cf=_0x2443[_0x3416d5];return _0x10c4cf;};'use strict';var client=require(_0x3244('0x0'));exports[_0x3244('0x1')]={};exports[_0x3244('0x2')]=function(_0x2f6984){return client[_0x3244('0x3')]('CreateVoiceTransferReport',{'body':{'result':_0x2f6984[_0x3244('0x4')],'transfererchannel':_0x2f6984[_0x3244('0x5')],'transferercalleridnum':_0x2f6984[_0x3244('0x6')],'transferercalleridname':_0x2f6984['transferercalleridname'],'transfererconnectedlinenum':_0x2f6984[_0x3244('0x7')],'transfererconnectedlinename':_0x2f6984[_0x3244('0x8')],'transfereraccountcode':_0x2f6984[_0x3244('0x9')],'transferercontext':_0x2f6984[_0x3244('0xa')],'transfererexten':_0x2f6984['transfererexten'],'transfererlinkedid':_0x2f6984[_0x3244('0xb')],'transfereechannel':_0x2f6984[_0x3244('0xc')],'transfereecalleridnum':_0x2f6984['transfereecalleridnum'],'transfereecalleridname':_0x2f6984['transfereecalleridname'],'transfereeconnectedlinenum':_0x2f6984[_0x3244('0xd')],'transfereeconnectedlinename':_0x2f6984[_0x3244('0xe')],'transfereeaccountcode':_0x2f6984[_0x3244('0xf')],'transfereecontext':_0x2f6984[_0x3244('0x10')],'transfereeexten':_0x2f6984[_0x3244('0x11')],'transfereelinkedid':_0x2f6984[_0x3244('0x12')],'isexternal':_0x2f6984[_0x3244('0x13')],'context':_0x2f6984[_0x3244('0x14')],'extension':_0x2f6984[_0x3244('0x15')],'type':_0x3244('0x16')},'log':_0x3244('0x17')});};exports[_0x3244('0x18')]=function(_0x5f4d4c){return client['Request'](_0x3244('0x17'),{'body':{'result':_0x5f4d4c['result'],'transfererchannel':_0x5f4d4c[_0x3244('0x19')],'transferercalleridnum':_0x5f4d4c[_0x3244('0x1a')],'transferercalleridname':_0x5f4d4c['origtransferercalleridname'],'transfererconnectedlinenum':_0x5f4d4c[_0x3244('0x1b')],'transfererconnectedlinename':_0x5f4d4c['secondtransfererconnectedlinename'],'transfereraccountcode':_0x5f4d4c['origtransfereraccountcode'],'transferercontext':_0x5f4d4c['secondtransferercontext'],'transfererexten':_0x5f4d4c[_0x3244('0x1c')],'transfererlinkedid':_0x5f4d4c['origtransfererlinkedid'],'transfereechannel':_0x5f4d4c[_0x3244('0x1d')],'transfereecalleridnum':_0x5f4d4c[_0x3244('0x1e')],'transfereecalleridname':_0x5f4d4c[_0x3244('0x1f')],'transfereeconnectedlinenum':_0x5f4d4c[_0x3244('0x20')],'transfereeconnectedlinename':_0x5f4d4c[_0x3244('0x21')],'transfereeaccountcode':_0x5f4d4c[_0x3244('0x22')],'transfereecontext':_0x5f4d4c[_0x3244('0x23')],'transfereeexten':_0x5f4d4c['transfertargetexten'],'transfereelinkedid':_0x5f4d4c['transfertargetlinkedid'],'isexternal':_0x5f4d4c[_0x3244('0x13')],'context':_0x5f4d4c[_0x3244('0x24')],'extension':_0x5f4d4c[_0x3244('0x25')],'type':_0x3244('0x26')},'log':_0x3244('0x17')});}; \ No newline at end of file +var _0xda79=['transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeaccountcode','transfereeexten','transfereelinkedid','isexternal','context','blind','attendedTransfer','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','origtransfererexten','attended','../client','blindTransfer','Request','CreateVoiceTransferReport','result','transfererchannel'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xda79,0x191));var _0x9da7=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xda79[_0x5ddb1c];return _0x354adc;};'use strict';var client=require(_0x9da7('0x0'));exports['transfers']={};exports[_0x9da7('0x1')]=function(_0x2ce015){return client[_0x9da7('0x2')](_0x9da7('0x3'),{'body':{'result':_0x2ce015[_0x9da7('0x4')],'transfererchannel':_0x2ce015[_0x9da7('0x5')],'transferercalleridnum':_0x2ce015[_0x9da7('0x6')],'transferercalleridname':_0x2ce015[_0x9da7('0x7')],'transfererconnectedlinenum':_0x2ce015[_0x9da7('0x8')],'transfererconnectedlinename':_0x2ce015[_0x9da7('0x9')],'transfereraccountcode':_0x2ce015[_0x9da7('0xa')],'transferercontext':_0x2ce015['transferercontext'],'transfererexten':_0x2ce015['transfererexten'],'transfererlinkedid':_0x2ce015['transfererlinkedid'],'transfereechannel':_0x2ce015[_0x9da7('0xb')],'transfereecalleridnum':_0x2ce015[_0x9da7('0xc')],'transfereecalleridname':_0x2ce015[_0x9da7('0xd')],'transfereeconnectedlinenum':_0x2ce015[_0x9da7('0xe')],'transfereeconnectedlinename':_0x2ce015['transfereeconnectedlinename'],'transfereeaccountcode':_0x2ce015[_0x9da7('0xf')],'transfereecontext':_0x2ce015['transfereecontext'],'transfereeexten':_0x2ce015[_0x9da7('0x10')],'transfereelinkedid':_0x2ce015[_0x9da7('0x11')],'isexternal':_0x2ce015[_0x9da7('0x12')],'context':_0x2ce015[_0x9da7('0x13')],'extension':_0x2ce015['extension'],'type':_0x9da7('0x14')},'log':_0x9da7('0x3')});};exports[_0x9da7('0x15')]=function(_0x327a16){return client[_0x9da7('0x2')](_0x9da7('0x3'),{'body':{'result':_0x327a16[_0x9da7('0x4')],'transfererchannel':_0x327a16[_0x9da7('0x16')],'transferercalleridnum':_0x327a16[_0x9da7('0x17')],'transferercalleridname':_0x327a16[_0x9da7('0x18')],'transfererconnectedlinenum':_0x327a16[_0x9da7('0x19')],'transfererconnectedlinename':_0x327a16[_0x9da7('0x1a')],'transfereraccountcode':_0x327a16[_0x9da7('0x1b')],'transferercontext':_0x327a16[_0x9da7('0x1c')],'transfererexten':_0x327a16[_0x9da7('0x1d')],'transfererlinkedid':_0x327a16[_0x9da7('0x1e')],'transfereechannel':_0x327a16['transfertargetchannel'],'transfereecalleridnum':_0x327a16[_0x9da7('0x1f')],'transfereecalleridname':_0x327a16[_0x9da7('0x20')],'transfereeconnectedlinenum':_0x327a16[_0x9da7('0x21')],'transfereeconnectedlinename':_0x327a16[_0x9da7('0x22')],'transfereeaccountcode':_0x327a16['transfertargetaccountcode'],'transfereecontext':_0x327a16['transfertargetcontext'],'transfereeexten':_0x327a16['transfertargetexten'],'transfereelinkedid':_0x327a16['transfertargetlinkedid'],'isexternal':_0x327a16[_0x9da7('0x12')],'context':_0x327a16['origtransferercontext'],'extension':_0x327a16[_0x9da7('0x23')],'type':_0x9da7('0x24')},'log':_0x9da7('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index ef24eb2..4101c37 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 _0x15ef=['timer','agents','updateStatusRealtime','pause','isConnected','error','asterisk','username','ami\x20disconnected','join','pick','module','action','Action','then','command','Command','content','voiceQueues','name','strategy','answered','available','loggedIn','pTalking','sumBillable','sumDuration','talking','total','type','abandoned','waiting','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','message','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','length','find','omit','undefined','validate','channels','uniqueid','channel','filename','wav','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','toLowerCase','isNil','push','rec','mixmonitorid','MixMonitor\x20Success','catch','voicechannel','StopMixMonitor','destinationchannel','stop','%s.%s','status','StopMixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','values','queueChannels','voicequeuechannelhangup','map','exten','context','telephones','trunks','outboundChannels','campaigns','run','event','Event\x20name\x20mandatory','emit','custom:','faxAccounts','send','checkAfterSend','server','http','listen','127.0.0.1','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','util','jayson/promise','bluebird','moment','../../../config/environment','../properties','../ami','format','%s/%s','SIP','timers'];(function(_0x543084,_0x4337f5){var _0x306a57=function(_0x2769ed){while(--_0x2769ed){_0x543084['push'](_0x543084['shift']());}};_0x306a57(++_0x4337f5);}(_0x15ef,0x80));var _0xf15e=function(_0x51dc97,_0x469010){_0x51dc97=_0x51dc97-0x0;var _0x32f1c=_0x15ef[_0x51dc97];return _0x32f1c;};'use strict';var _=require('lodash');var util=require(_0xf15e('0x0'));var jayson=require(_0xf15e('0x1'));var schema=require('validate');var BPromise=require(_0xf15e('0x2'));var moment=require(_0xf15e('0x3'));var config=require(_0xf15e('0x4'));var properties=require(_0xf15e('0x5'));var ami=require(_0xf15e('0x6'));exports['listen']=function(_0x1b9a24,_0x5c0553,_0x5e96b4){return new BPromise(function(_0x5ba863,_0x66708e){var _0x232359={'QueuePause':function(_0x490097){return new Promise(function(_0x2d6e94,_0x4daf89){var _0x1168c3=util[_0xf15e('0x7')](_0xf15e('0x8'),_0xf15e('0x9'),_0x490097['name']);if(_0x1b9a24['timers']&&_0x1b9a24['timers'][_0x1168c3]&&_0x1b9a24[_0xf15e('0xa')][_0x1168c3][_0xf15e('0xb')]){_0x1b9a24['timers'][_0x1168c3]['updateAcw']();}if(_0x1b9a24['agents'][_0x1168c3]){_0x1b9a24[_0xf15e('0xc')][_0x1168c3][_0xf15e('0xd')]({'statePause':_0x490097[_0xf15e('0xe')]?!![]:![]});}_0x2d6e94({'code':0xc8,'message':'QueuePause'});});},'Reload':function(_0x442d51){var _0x1b8543=this;return new Promise(function(_0x16a04a,_0x5da521){if(ami[_0xf15e('0xf')]()==![]){return _0x5da521(_0x1b8543[_0xf15e('0x10')](0x1f4,[config[_0xf15e('0x11')]['ip'],config[_0xf15e('0x11')][_0xf15e('0x12')],_0xf15e('0x13')][_0xf15e('0x14')]('\x20')));}_0x442d51=_[_0xf15e('0x15')](_0x442d51,_['keys'](properties[_0xf15e('0x16')]));_0x442d51[_0xf15e('0x17')]='Reload';return ami[_0xf15e('0x18')](_0x442d51)[_0xf15e('0x19')](function(_0x45e418){_0x16a04a({'code':0xc8,'message':_0x45e418['message']});})['catch'](function(_0x3ad067){_0x5da521(_0x1b8543[_0xf15e('0x10')](0x1f5,_0x3ad067['message']));});});},'Command':function(_0x86d14f){var _0x1f1f33=this;return new Promise(function(_0xa47259,_0x4b144c){if(ami['isConnected']()==![]){return _0x4b144c(_0x1f1f33[_0xf15e('0x10')](0x1f4,[config[_0xf15e('0x11')]['ip'],config['asterisk'][_0xf15e('0x12')],'ami\x20disconnected']['join']('\x20')));}_0x86d14f=_[_0xf15e('0x15')](_0x86d14f,_0xf15e('0x1a'));_0x86d14f[_0xf15e('0x17')]=_0xf15e('0x1b');return ami['Action'](_0x86d14f)[_0xf15e('0x19')](function(_0xa09c0c){_0xa47259({'code':0xc8,'message':_0xa09c0c[_0xf15e('0x1c')]});})['catch'](function(_0x248c4b){_0x4b144c(_0x1f1f33[_0xf15e('0x10')](0x1f5,_0x248c4b['message']));});});},'VoiceQueues':function(_0x5d381a){return new Promise(function(_0x2e6d94,_0xb36af){var _0x1fd237=[];for(var _0x471079 in _0x1b9a24[_0xf15e('0x1d')]){if(_0x1b9a24['voiceQueues']['hasOwnProperty'](_0x471079)){var _0x3f9d64=_0x1b9a24[_0xf15e('0x1d')][_0x471079];var _0x4a83e5={'id':_0x3f9d64['id'],'name':_0x3f9d64[_0xf15e('0x1e')],'strategy':_0x3f9d64[_0xf15e('0x1f')],'answered':_0x3f9d64[_0xf15e('0x20')],'available':_0x3f9d64[_0xf15e('0x21')],'loggedIn':_0x3f9d64[_0xf15e('0x22')],'pTalking':_0x3f9d64[_0xf15e('0x23')],'sumBillable':_0x3f9d64[_0xf15e('0x24')],'sumDuration':_0x3f9d64[_0xf15e('0x25')],'sumHoldTime':_0x3f9d64['sumHoldTime']||0x0,'talking':_0x3f9d64[_0xf15e('0x26')],'total':_0x3f9d64[_0xf15e('0x27')],'type':_0x3f9d64[_0xf15e('0x28')],'unmanaged':_0x3f9d64['unmanaged'],'abandoned':_0x3f9d64[_0xf15e('0x29')],'waiting':_0x3f9d64[_0xf15e('0x2a')],'loggedInDb':_0x3f9d64['loggedInDb']};if(_0x3f9d64[_0xf15e('0x28')]===_0xf15e('0x2b')){_0x4a83e5[_0xf15e('0x2c')]=_0x3f9d64['dialActive'];_0x4a83e5[_0xf15e('0x2d')]=_0x3f9d64[_0xf15e('0x2d')];_0x4a83e5[_0xf15e('0x2e')]=_0x3f9d64[_0xf15e('0x2e')];_0x4a83e5['dialOriginateCallerIdNumber']=_0x3f9d64[_0xf15e('0x2f')];_0x4a83e5[_0xf15e('0x30')]=_0x3f9d64['dialOriginateTimeout'];_0x4a83e5[_0xf15e('0x31')]=_0x3f9d64[_0xf15e('0x31')];_0x4a83e5[_0xf15e('0x32')]=_0x3f9d64['temp'];_0x4a83e5[_0xf15e('0x33')]=_0x3f9d64[_0xf15e('0x33')];_0x4a83e5['outboundAnswerCallsDay']=_0x3f9d64[_0xf15e('0x34')];_0x4a83e5['outboundBlacklistCallsDay']=_0x3f9d64[_0xf15e('0x35')];_0x4a83e5[_0xf15e('0x36')]=_0x3f9d64['outboundBusyCallsDay'];_0x4a83e5['outboundCongestionCallsDay']=_0x3f9d64[_0xf15e('0x37')];_0x4a83e5[_0xf15e('0x38')]=_0x3f9d64['outboundDropCallsDayACS'];_0x4a83e5[_0xf15e('0x39')]=_0x3f9d64[_0xf15e('0x39')];_0x4a83e5[_0xf15e('0x3a')]=_0x3f9d64[_0xf15e('0x3a')];_0x4a83e5[_0xf15e('0x3b')]=_0x3f9d64[_0xf15e('0x3b')];_0x4a83e5['outboundNoSuchCallsDay']=_0x3f9d64[_0xf15e('0x3c')];_0x4a83e5[_0xf15e('0x3d')]=_0x3f9d64[_0xf15e('0x3d')];_0x4a83e5[_0xf15e('0x3e')]=_0x3f9d64[_0xf15e('0x3e')];_0x4a83e5[_0xf15e('0x3f')]=_0x3f9d64[_0xf15e('0x3f')];_0x4a83e5[_0xf15e('0x40')]=_0x3f9d64['outboundUnknownCallsDay'];_0x4a83e5[_0xf15e('0x41')]=_0x3f9d64['predictiveIntervalAnsweredCalls'];_0x4a83e5[_0xf15e('0x42')]=_0x3f9d64[_0xf15e('0x42')];_0x4a83e5[_0xf15e('0x43')]=_0x3f9d64[_0xf15e('0x43')];_0x4a83e5[_0xf15e('0x44')]=_0x3f9d64[_0xf15e('0x44')];_0x4a83e5['predictiveIntervalDroppedCallsTimeout']=_0x3f9d64[_0xf15e('0x45')];_0x4a83e5[_0xf15e('0x46')]=_0x3f9d64[_0xf15e('0x46')];_0x4a83e5[_0xf15e('0x47')]=_0x3f9d64['predictiveIntervalErlangCallsDroppedCalls'];_0x4a83e5['predictiveIntervalHitRate']=_0x3f9d64[_0xf15e('0x48')];_0x4a83e5[_0xf15e('0x49')]=_0x3f9d64[_0xf15e('0x49')];_0x4a83e5['predictiveIntervalPauses']=_0x3f9d64['predictiveIntervalPauses'];_0x4a83e5['predictiveIntervalAvailable']=_0x3f9d64['predictiveIntervalAvailable'];_0x4a83e5['predictiveIntervalTotalCalls']=_0x3f9d64[_0xf15e('0x4a')];_0x4a83e5[_0xf15e('0x4b')]=_0x3f9d64[_0xf15e('0x4b')];_0x4a83e5['originated']=_0x3f9d64[_0xf15e('0x4c')];_0x4a83e5['erlangCalls']=_0x3f9d64[_0xf15e('0x4d')];_0x4a83e5[_0xf15e('0x4e')]=_0x3f9d64[_0xf15e('0x4e')];_0x4a83e5[_0xf15e('0x4f')]=_0x3f9d64['erlangAbandonmentRate'];_0x4a83e5[_0xf15e('0x50')]=_0x3f9d64[_0xf15e('0x50')];_0x4a83e5[_0xf15e('0x51')]=_0x3f9d64[_0xf15e('0x51')];_0x4a83e5[_0xf15e('0x52')]=_0x3f9d64['startProgressive'];}if(_0x3f9d64[_0xf15e('0x53')]){_0x4a83e5[_0xf15e('0x53')]={'id':_0x3f9d64[_0xf15e('0x53')]['id'],'name':_0x3f9d64[_0xf15e('0x53')][_0xf15e('0x1e')],'active':_0x3f9d64[_0xf15e('0x53')][_0xf15e('0x54')],'callerid':_0x3f9d64['Trunk'][_0xf15e('0x55')]};}if(_0x3f9d64[_0xf15e('0x56')]){_0x4a83e5['Interval']={'id':_0x3f9d64['Interval']['id'],'name':_0x3f9d64[_0xf15e('0x56')]['name']};}_0x1fd237['push'](_0x4a83e5);}}_0x2e6d94({'count':_0x1fd237[_0xf15e('0x57')],'rows':_0x1fd237});});},'UpdateVoiceQueue':function(_0x3d99f8){return new Promise(function(_0x4cdfa6,_0x4becd6){var _0x1f2e17=_[_0xf15e('0x58')](_0x1b9a24[_0xf15e('0x1d')],{'id':parseInt(_0x3d99f8['id'])});var _0x33df95=_[_0xf15e('0x59')](_0x3d99f8,['id']);if(_0x1f2e17){for(var _0x31a916 in _0x33df95){if(typeof _0x33df95[_0x31a916]!==_0xf15e('0x5a')&&typeof _0x1f2e17[_0x31a916]!==_0xf15e('0x5a')){_0x1f2e17[_0x31a916]=_0x33df95[_0x31a916];}}_0x4cdfa6(_0x1f2e17);}else{_0x4becd6();}});},'VoiceChannels':function(_0x4fd67c){return new Promise(function(_0x1dba1c,_0x44f075){var _0x3b79a8=_['values'](_0x1b9a24['channels']);_0x1dba1c({'count':_0x3b79a8[_0xf15e('0x57')],'rows':_0x3b79a8});});},'VoiceChannelMixMonitor':function(_0x368a1f){var _0x382ae5=this;return new Promise(function(_0x3da6fe,_0x1cb428){if(ami[_0xf15e('0xf')]()==![]){return _0x1cb428(_0x382ae5[_0xf15e('0x10')](0x1f4,[config[_0xf15e('0x11')]['ip'],config['asterisk'][_0xf15e('0x12')],_0xf15e('0x13')]['join']('\x20')));}var _0x378492=schema(properties['voicechannel'])[_0xf15e('0x5b')](_0x368a1f);if(_0x378492[_0xf15e('0x57')]>0x0){return _0x1cb428(_0x382ae5[_0xf15e('0x10')](0x1f4,_['map'](_0x378492,_0xf15e('0x4b'))[_0xf15e('0x14')](',\x20')));}var _0x30c8ac=_[_0xf15e('0x58')](_0x1b9a24[_0xf15e('0x5c')],{'uniqueid':_0x368a1f[_0xf15e('0x5d')]});if(_0x30c8ac&&_0x30c8ac[_0xf15e('0x5e')]){var _0x2507b3=util[_0xf15e('0x7')]('%s.%s',_0x368a1f[_0xf15e('0x5f')]||_0x368a1f[_0xf15e('0x5d')],_0x368a1f[_0xf15e('0x7')]||_0xf15e('0x60'));return ami[_0xf15e('0x18')]({'action':'MixMonitor','channel':_0x30c8ac[_0xf15e('0x5e')],'file':_0x2507b3,'options':_0xf15e('0x61')})[_0xf15e('0x19')](function(_0x25827b){var _0x3235d8=_[_0xf15e('0x58')](_0x30c8ac[_0xf15e('0x62')],{'filename':_0xf15e('0x63')+_0x2507b3[_0xf15e('0x64')]()});if(_[_0xf15e('0x65')](_0x3235d8)){_0x30c8ac[_0xf15e('0x62')][_0xf15e('0x66')]({'filename':'/var/spool/asterisk/monitor/'+_0x2507b3[_0xf15e('0x64')](),'createdAt':moment()[_0xf15e('0x7')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x25827b['mixmonitorid'],'status':_0xf15e('0x67')});}else{_0x3235d8[_0xf15e('0x68')]=_0x25827b['mixmonitorid'];_0x3235d8['status']=_0xf15e('0x67');}_0x3da6fe({'code':0xc8,'message':[_0x368a1f[_0xf15e('0x5d')],_0xf15e('0x69'),_0x25827b[_0xf15e('0x68')]][_0xf15e('0x14')]('\x20'),'mixmonitorid':_0x25827b[_0xf15e('0x68')]});})[_0xf15e('0x6a')](function(_0x54efa8){_0x1cb428(_0x382ae5['error'](0x1f5,[_0x368a1f[_0xf15e('0x5d')],_0x54efa8['message'][_0xf15e('0x64')]()][_0xf15e('0x14')]('\x20')));});}else{return _0x1cb428(_0x382ae5[_0xf15e('0x10')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceChannelStopMixMonitor':function(_0x30b2f3){var _0x295d49=this;return new Promise(function(_0x469a1b,_0x13837c){if(ami['isConnected']()==![]){return _0x13837c(_0x295d49['error'](0x1f4,[config[_0xf15e('0x11')]['ip'],config[_0xf15e('0x11')]['username'],'ami\x20disconnected'][_0xf15e('0x14')]('\x20')));}var _0x1eec69=schema(properties[_0xf15e('0x6b')])[_0xf15e('0x5b')](_0x30b2f3);if(_0x1eec69['length']>0x0){return _0x13837c(_0x295d49['error'](0x1f4,_['map'](_0x1eec69,_0xf15e('0x4b'))[_0xf15e('0x14')](',\x20')));}var _0x5f1121=_['find'](_0x1b9a24[_0xf15e('0x5c')],{'uniqueid':_0x30b2f3['uniqueid']});if(_0x5f1121){return BPromise['resolve']()['then'](function(){if(_0x5f1121['channel']){return ami['Action']({'action':_0xf15e('0x6c'),'channel':_0x5f1121[_0xf15e('0x5e')],'mixmonitorid':_0x30b2f3[_0xf15e('0x68')]})['catch'](function(_0x4979fd){});}})[_0xf15e('0x19')](function(){if(_0x5f1121[_0xf15e('0x6d')]){return ami['Action']({'action':'StopMixMonitor','channel':_0x5f1121[_0xf15e('0x6d')],'mixmonitorid':_0x30b2f3[_0xf15e('0x68')]})[_0xf15e('0x6a')](function(_0x532f5b){});}})['then'](function(_0x37e0b2){var _0x44cefb=_['find'](_0x5f1121['monitors'],{'mixmonitorid':_0x30b2f3['mixmonitorid']});if(_0x44cefb){_0x44cefb['status']=_0xf15e('0x6e');}})[_0xf15e('0x19')](function(){var _0x53630b=util['format'](_0xf15e('0x6f'),_0x30b2f3['filename']||_0x30b2f3[_0xf15e('0x5d')],_0x30b2f3['format']||_0xf15e('0x60'));var _0x2a3255=_[_0xf15e('0x58')](_0x5f1121['monitors'],{'filename':_0xf15e('0x63')+_0x53630b['toLowerCase']()});if(_0x2a3255){_0x2a3255[_0xf15e('0x70')]=_0xf15e('0x6e');}})[_0xf15e('0x19')](function(){_0x469a1b({'code':0xc8,'message':[_0x30b2f3[_0xf15e('0x5d')],_0xf15e('0x71')][_0xf15e('0x14')]('\x20')});})[_0xf15e('0x6a')](function(_0x2ea42f){_0x13837c(_0x295d49['error'](0x1f5,[_0x30b2f3[_0xf15e('0x5d')],_0x2ea42f['message']['toLowerCase']()][_0xf15e('0x14')]('\x20')));});}else{return _0x13837c(_0x295d49['error'](0x1f5,_0xf15e('0x72')));}});},'VoiceQueuesChannels':function(_0x37ed48){return new Promise(function(_0x2cff3a,_0x2cf9f7){var _0x45a25a=_[_0xf15e('0x73')](_0x1b9a24[_0xf15e('0x74')]);_0x2cff3a({'count':_0x45a25a[_0xf15e('0x57')],'rows':_0x45a25a});});},'VoiceQueuesChannel':function(_0x18b2d2){var _0x8c9b10=this;return new Promise(function(_0x4f57f5,_0x5df791){var _0x72d9b6=schema(properties['voicequeuechannel'])['validate'](_0x18b2d2);if(_0x72d9b6[_0xf15e('0x57')]>0x0){return _0x5df791(_0x8c9b10[_0xf15e('0x10')](0x1f4,_['map'](_0x72d9b6,_0xf15e('0x4b'))[_0xf15e('0x14')](',\x20')));}var _0x574403=_['find'](_0x1b9a24[_0xf15e('0x74')],{'uniqueid':_0x18b2d2['uniqueid']});if(_0x574403){_0x4f57f5(_0x574403);}else{return _0x5df791(_0x8c9b10[_0xf15e('0x10')](0x1f5,_0xf15e('0x72')));}});},'VoiceQueuesChannelHangup':function(_0x30cf00){var _0x380fb2=this;return new Promise(function(_0x19890b,_0x340451){if(ami['isConnected']()==![]){return _0x340451(_0x380fb2[_0xf15e('0x10')](0x1f4,[config['asterisk']['ip'],config['asterisk'][_0xf15e('0x12')],_0xf15e('0x13')][_0xf15e('0x14')]('\x20')));}var _0xbf57fb=schema(properties[_0xf15e('0x75')])['validate'](_0x30cf00);if(_0xbf57fb[_0xf15e('0x57')]>0x0){return _0x340451(_0x380fb2[_0xf15e('0x10')](0x1f4,_[_0xf15e('0x76')](_0xbf57fb,_0xf15e('0x4b'))[_0xf15e('0x14')](',\x20')));}var _0x482082=_['find'](_0x1b9a24[_0xf15e('0x74')],{'uniqueid':_0x30cf00[_0xf15e('0x5d')]});if(_0x482082&&_0x482082[_0xf15e('0x5e')]){return ami['Action']({'action':'Hangup','channel':_0x482082[_0xf15e('0x5e')]})['then'](function(_0x449164){_0x19890b({'code':0xc8,'message':[_0x30cf00[_0xf15e('0x5d')],_0x449164['message'][_0xf15e('0x64')]()][_0xf15e('0x14')]('\x20')});})['catch'](function(_0x8c5913){_0x340451(_0x380fb2['error'](0x1f5,[_0x30cf00[_0xf15e('0x5d')],_0x8c5913[_0xf15e('0x4b')][_0xf15e('0x64')]()][_0xf15e('0x14')]('\x20')));});}else{return _0x340451(_0x380fb2[_0xf15e('0x10')](0x1f5,_0xf15e('0x72')));}});},'VoiceQueuesChannelRedirect':function(_0x4d320f){var _0x5025bb=this;return new Promise(function(_0x3c1ac2,_0x18bc85){if(ami['isConnected']()==![]){return _0x18bc85(_0x5025bb['error'](0x1f4,[config[_0xf15e('0x11')]['ip'],config['asterisk'][_0xf15e('0x12')],'ami\x20disconnected'][_0xf15e('0x14')]('\x20')));}var _0x474c24=schema(properties['voicequeuechannelredirect'])[_0xf15e('0x5b')](_0x4d320f);if(_0x474c24['length']>0x0){return _0x18bc85(_0x5025bb[_0xf15e('0x10')](0x1f4,_[_0xf15e('0x76')](_0x474c24,_0xf15e('0x4b'))['join'](',\x20')));}var _0x40beaf=_[_0xf15e('0x58')](_0x1b9a24[_0xf15e('0x74')],{'uniqueid':_0x4d320f[_0xf15e('0x5d')]});if(_0x40beaf&&_0x40beaf[_0xf15e('0x5e')]){return ami['Action']({'action':'Redirect','channel':_0x40beaf[_0xf15e('0x5e')],'exten':_0x4d320f[_0xf15e('0x77')],'context':_0x4d320f[_0xf15e('0x78')]||_0x40beaf['context'],'priority':0x1})[_0xf15e('0x19')](function(_0x346ed4){_0x3c1ac2({'code':0xc8,'message':[_0x4d320f[_0xf15e('0x5d')],_0x346ed4[_0xf15e('0x4b')]['toLowerCase']()][_0xf15e('0x14')]('\x20')});})[_0xf15e('0x6a')](function(_0x91a322){_0x18bc85(_0x5025bb[_0xf15e('0x10')](0x1f5,[_0x4d320f[_0xf15e('0x5d')],_0x91a322[_0xf15e('0x4b')][_0xf15e('0x64')]()][_0xf15e('0x14')]('\x20')));});}else{return _0x18bc85(_0x5025bb[_0xf15e('0x10')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'Agents':function(_0x34ee2f){return new Promise(function(_0x56e37c,_0x1484a4){var _0x1108bd=_[_0xf15e('0x73')](_0x1b9a24[_0xf15e('0xc')]);_0x56e37c({'count':_0x1108bd['length'],'rows':_0x1108bd});});},'Telephones':function(_0x4f251c){return new Promise(function(_0x4a6ea5,_0x4ba658){var _0x532693=_[_0xf15e('0x73')](_0x1b9a24[_0xf15e('0x79')]);_0x4a6ea5({'count':_0x532693[_0xf15e('0x57')],'rows':_0x532693});});},'Trunks':function(_0x2450b1){return new Promise(function(_0x459d82,_0xcee4f5){var _0x387a2c=_[_0xf15e('0x73')](_0x1b9a24[_0xf15e('0x7a')]);_0x459d82({'count':_0x387a2c['length'],'rows':_0x387a2c});});},'OutboundChannels':function(_0x425290){return new Promise(function(_0x10406e,_0x4a3a36){var _0x299be3=_[_0xf15e('0x73')](_0x1b9a24[_0xf15e('0x7b')]);_0x10406e({'count':_0x299be3[_0xf15e('0x57')],'rows':_0x299be3});});},'Outbound':function(_0x48414e){return new Promise(function(_0x44c30b,_0x40f151){_0x44c30b(_0x1b9a24[_0xf15e('0x2b')]);});},'Campaigns':function(_0x39f9ce){return new Promise(function(_0x426b4b,_0x1bf82a){var _0xdf7775=_['values'](_0x1b9a24[_0xf15e('0x7c')]);_0x426b4b({'count':_0xdf7775[_0xf15e('0x57')],'rows':_0xdf7775});});},'VoiceQueuesPreview':function(_0x51d84b){var _0x295a21=this;return new Promise(function(_0x402613,_0x5b1c88){_0x5c0553[_0xf15e('0x7d')](_0x51d84b['id'])[_0xf15e('0x19')](function(_0x228a23){_0x402613({'code':0xc8,'message':_0x228a23['message']});})[_0xf15e('0x6a')](function(_0x8f566e){_0x5b1c88(_0x295a21[_0xf15e('0x10')](0x1f4,_0x8f566e[_0xf15e('0x4b')]));});});},'EventManager':function(_0x412200){var _0x3a9705=this;return new Promise(function(_0x1c2891,_0x4ee137){if(!_0x412200[_0xf15e('0x7e')]){return _0x4ee137(_0x3a9705[_0xf15e('0x10')](0x1f4,_0xf15e('0x7f')));}ami[_0xf15e('0x80')](_0xf15e('0x81')+_0x412200['event'],_0x412200['message']);_0x1c2891({'code':0xc8,'message':_0x412200});});},'FaxAccounts':function(_0x51819f){return new Promise(function(_0x26591d,_0x1a9e87){var _0x863deb=_[_0xf15e('0x73')](_0x1b9a24[_0xf15e('0x82')]);_0x26591d({'count':_0x863deb[_0xf15e('0x57')],'rows':_0x863deb});});},'SendFax':function(_0x22f526){var _0x49f1b4=this;return new Promise(function(_0x3daaf6,_0x27f242){_0x5e96b4[_0xf15e('0x83')](_0x22f526)['then'](function(_0x528d11){_0x3daaf6({'code':0xc8,'message':_0x528d11['message']});})[_0xf15e('0x6a')](function(_0x3f9a36){_0x27f242(_0x49f1b4[_0xf15e('0x10')](0x1f4,_0x3f9a36[_0xf15e('0x4b')]));});});},'CheckAfterSend':function(_0x369af7){var _0x29f953=this;return new Promise(function(_0x3a9b61,_0x38851f){_0x5e96b4[_0xf15e('0x84')](_0x369af7)[_0xf15e('0x19')](function(_0x17d407){_0x3a9b61({'code':0xc8,'message':_0x17d407[_0xf15e('0x4b')]});})[_0xf15e('0x6a')](function(_0x40b26e){_0x38851f(_0x29f953[_0xf15e('0x10')](0x1f4,_0x40b26e['message']));});});}};var _0x3f1966=jayson[_0xf15e('0x85')](_0x232359)[_0xf15e('0x86')]();_0x3f1966['on']('error',function(_0xd854c8){return _0x66708e(_0xd854c8);});_0x3f1966[_0xf15e('0x87')](0x232a,_0xf15e('0x88'),function(){console['log'](_0xf15e('0x89'),0x232a);return _0x5ba863(_0xf15e('0x8a')+0x232a);});});}; \ No newline at end of file +var _0x31c2=['wav','MixMonitor','channel','ai(mixmonitorid)','monitors','toLowerCase','isNil','push','/var/spool/asterisk/monitor/','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','rec','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','resolve','destinationchannel','stop','StopMixMonitor\x20Success','queueChannels','voicequeuechannel','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','Redirect','exten','context','telephones','outboundChannels','outbound','campaigns','run','event','Event\x20name\x20mandatory','emit','faxAccounts','send','checkAfterSend','server','http','127.0.0.1','log','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','validate','bluebird','moment','../../../config/environment','../properties','%s/%s','SIP','name','timers','timer','updateAcw','agents','updateStatusRealtime','pause','QueuePause','isConnected','error','asterisk','username','ami\x20disconnected','join','pick','keys','module','action','Reload','Action','message','catch','command','Command','then','content','voiceQueues','hasOwnProperty','strategy','available','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','talking','type','unmanaged','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','length','find','omit','undefined','values','channels','voicechannel','map','uniqueid','format','%s.%s','filename'];(function(_0x1d6f7c,_0x41bfdc){var _0x1e6c6b=function(_0x244838){while(--_0x244838){_0x1d6f7c['push'](_0x1d6f7c['shift']());}};_0x1e6c6b(++_0x41bfdc);}(_0x31c2,0x1e1));var _0x231c=function(_0x2e6bb4,_0x1742cb){_0x2e6bb4=_0x2e6bb4-0x0;var _0x468d5b=_0x31c2[_0x2e6bb4];return _0x468d5b;};'use strict';var _=require(_0x231c('0x0'));var util=require(_0x231c('0x1'));var jayson=require(_0x231c('0x2'));var schema=require(_0x231c('0x3'));var BPromise=require(_0x231c('0x4'));var moment=require(_0x231c('0x5'));var config=require(_0x231c('0x6'));var properties=require(_0x231c('0x7'));var ami=require('../ami');exports['listen']=function(_0x2b7d5f,_0x1b9d64,_0x1f3f7d){return new BPromise(function(_0x219c3f,_0x48bfb2){var _0x111bf9={'QueuePause':function(_0x49ff9e){return new Promise(function(_0x439df8,_0x38b3b9){var _0x1000c9=util['format'](_0x231c('0x8'),_0x231c('0x9'),_0x49ff9e[_0x231c('0xa')]);if(_0x2b7d5f[_0x231c('0xb')]&&_0x2b7d5f[_0x231c('0xb')][_0x1000c9]&&_0x2b7d5f[_0x231c('0xb')][_0x1000c9][_0x231c('0xc')]){_0x2b7d5f['timers'][_0x1000c9][_0x231c('0xd')]();}if(_0x2b7d5f[_0x231c('0xe')][_0x1000c9]){_0x2b7d5f['agents'][_0x1000c9][_0x231c('0xf')]({'statePause':_0x49ff9e[_0x231c('0x10')]?!![]:![]});}_0x439df8({'code':0xc8,'message':_0x231c('0x11')});});},'Reload':function(_0x1aa3fe){var _0x284280=this;return new Promise(function(_0x1404bc,_0x2c4f75){if(ami[_0x231c('0x12')]()==![]){return _0x2c4f75(_0x284280[_0x231c('0x13')](0x1f4,[config[_0x231c('0x14')]['ip'],config[_0x231c('0x14')][_0x231c('0x15')],_0x231c('0x16')][_0x231c('0x17')]('\x20')));}_0x1aa3fe=_[_0x231c('0x18')](_0x1aa3fe,_[_0x231c('0x19')](properties[_0x231c('0x1a')]));_0x1aa3fe[_0x231c('0x1b')]=_0x231c('0x1c');return ami[_0x231c('0x1d')](_0x1aa3fe)['then'](function(_0x599cd6){_0x1404bc({'code':0xc8,'message':_0x599cd6[_0x231c('0x1e')]});})[_0x231c('0x1f')](function(_0xadea80){_0x2c4f75(_0x284280[_0x231c('0x13')](0x1f5,_0xadea80[_0x231c('0x1e')]));});});},'Command':function(_0x3c3ea6){var _0x172d50=this;return new Promise(function(_0x2890e3,_0x1c9c85){if(ami['isConnected']()==![]){return _0x1c9c85(_0x172d50[_0x231c('0x13')](0x1f4,[config['asterisk']['ip'],config[_0x231c('0x14')]['username'],_0x231c('0x16')][_0x231c('0x17')]('\x20')));}_0x3c3ea6=_[_0x231c('0x18')](_0x3c3ea6,_0x231c('0x20'));_0x3c3ea6[_0x231c('0x1b')]=_0x231c('0x21');return ami[_0x231c('0x1d')](_0x3c3ea6)[_0x231c('0x22')](function(_0x54566f){_0x2890e3({'code':0xc8,'message':_0x54566f[_0x231c('0x23')]});})[_0x231c('0x1f')](function(_0x4af49b){_0x1c9c85(_0x172d50[_0x231c('0x13')](0x1f5,_0x4af49b[_0x231c('0x1e')]));});});},'VoiceQueues':function(_0x5c569a){return new Promise(function(_0x318dad,_0x564939){var _0x3ea0cd=[];for(var _0x454f70 in _0x2b7d5f[_0x231c('0x24')]){if(_0x2b7d5f[_0x231c('0x24')][_0x231c('0x25')](_0x454f70)){var _0x131cfd=_0x2b7d5f[_0x231c('0x24')][_0x454f70];var _0x4caf68={'id':_0x131cfd['id'],'name':_0x131cfd[_0x231c('0xa')],'strategy':_0x131cfd[_0x231c('0x26')],'answered':_0x131cfd['answered'],'available':_0x131cfd[_0x231c('0x27')],'loggedIn':_0x131cfd[_0x231c('0x28')],'pTalking':_0x131cfd[_0x231c('0x29')],'sumBillable':_0x131cfd[_0x231c('0x2a')],'sumDuration':_0x131cfd[_0x231c('0x2b')],'sumHoldTime':_0x131cfd[_0x231c('0x2c')]||0x0,'talking':_0x131cfd[_0x231c('0x2d')],'total':_0x131cfd['total'],'type':_0x131cfd[_0x231c('0x2e')],'unmanaged':_0x131cfd[_0x231c('0x2f')],'abandoned':_0x131cfd['abandoned'],'waiting':_0x131cfd['waiting'],'loggedInDb':_0x131cfd['loggedInDb']};if(_0x131cfd[_0x231c('0x2e')]==='outbound'){_0x4caf68[_0x231c('0x30')]=_0x131cfd['dialActive'];_0x4caf68[_0x231c('0x31')]=_0x131cfd[_0x231c('0x31')];_0x4caf68[_0x231c('0x32')]=_0x131cfd[_0x231c('0x32')];_0x4caf68['dialOriginateCallerIdNumber']=_0x131cfd[_0x231c('0x33')];_0x4caf68[_0x231c('0x34')]=_0x131cfd[_0x231c('0x34')];_0x4caf68[_0x231c('0x35')]=_0x131cfd[_0x231c('0x35')];_0x4caf68[_0x231c('0x36')]=_0x131cfd[_0x231c('0x36')];_0x4caf68[_0x231c('0x37')]=_0x131cfd['outboundAnswerAgiCallsDay'];_0x4caf68['outboundAnswerCallsDay']=_0x131cfd[_0x231c('0x38')];_0x4caf68[_0x231c('0x39')]=_0x131cfd[_0x231c('0x39')];_0x4caf68[_0x231c('0x3a')]=_0x131cfd[_0x231c('0x3a')];_0x4caf68[_0x231c('0x3b')]=_0x131cfd['outboundCongestionCallsDay'];_0x4caf68[_0x231c('0x3c')]=_0x131cfd[_0x231c('0x3c')];_0x4caf68['outboundDropCallsDayCallersExit']=_0x131cfd['outboundDropCallsDayCallersExit'];_0x4caf68[_0x231c('0x3d')]=_0x131cfd['outboundDropCallsDayTimeout'];_0x4caf68[_0x231c('0x3e')]=_0x131cfd['outboundNoAnswerCallsDay'];_0x4caf68[_0x231c('0x3f')]=_0x131cfd[_0x231c('0x3f')];_0x4caf68['outboundOriginateFailureCallsDay']=_0x131cfd[_0x231c('0x40')];_0x4caf68[_0x231c('0x41')]=_0x131cfd[_0x231c('0x41')];_0x4caf68['outboundRejectCallsDay']=_0x131cfd[_0x231c('0x42')];_0x4caf68[_0x231c('0x43')]=_0x131cfd[_0x231c('0x43')];_0x4caf68[_0x231c('0x44')]=_0x131cfd[_0x231c('0x44')];_0x4caf68[_0x231c('0x45')]=_0x131cfd[_0x231c('0x45')];_0x4caf68[_0x231c('0x46')]=_0x131cfd[_0x231c('0x46')];_0x4caf68[_0x231c('0x47')]=_0x131cfd[_0x231c('0x47')];_0x4caf68[_0x231c('0x48')]=_0x131cfd[_0x231c('0x48')];_0x4caf68['predictiveIntervalErlangCalls']=_0x131cfd[_0x231c('0x49')];_0x4caf68[_0x231c('0x4a')]=_0x131cfd[_0x231c('0x4a')];_0x4caf68[_0x231c('0x4b')]=_0x131cfd[_0x231c('0x4b')];_0x4caf68['predictiveIntervalMultiplicativeFactor']=_0x131cfd[_0x231c('0x4c')];_0x4caf68[_0x231c('0x4d')]=_0x131cfd[_0x231c('0x4d')];_0x4caf68['predictiveIntervalAvailable']=_0x131cfd[_0x231c('0x4e')];_0x4caf68[_0x231c('0x4f')]=_0x131cfd[_0x231c('0x4f')];_0x4caf68[_0x231c('0x1e')]=_0x131cfd[_0x231c('0x1e')];_0x4caf68[_0x231c('0x50')]=_0x131cfd['originated'];_0x4caf68[_0x231c('0x51')]=_0x131cfd[_0x231c('0x51')];_0x4caf68[_0x231c('0x52')]=_0x131cfd[_0x231c('0x52')];_0x4caf68['erlangAbandonmentRate']=_0x131cfd[_0x231c('0x53')];_0x4caf68['erlangBusyFactor']=_0x131cfd[_0x231c('0x54')];_0x4caf68['startPredictive']=_0x131cfd[_0x231c('0x55')];_0x4caf68[_0x231c('0x56')]=_0x131cfd[_0x231c('0x56')];}if(_0x131cfd[_0x231c('0x57')]){_0x4caf68[_0x231c('0x57')]={'id':_0x131cfd[_0x231c('0x57')]['id'],'name':_0x131cfd['Trunk'][_0x231c('0xa')],'active':_0x131cfd[_0x231c('0x57')][_0x231c('0x58')],'callerid':_0x131cfd['Trunk'][_0x231c('0x59')]};}if(_0x131cfd[_0x231c('0x5a')]){_0x4caf68[_0x231c('0x5a')]={'id':_0x131cfd[_0x231c('0x5a')]['id'],'name':_0x131cfd['Interval'][_0x231c('0xa')]};}_0x3ea0cd['push'](_0x4caf68);}}_0x318dad({'count':_0x3ea0cd[_0x231c('0x5b')],'rows':_0x3ea0cd});});},'UpdateVoiceQueue':function(_0x446cf1){return new Promise(function(_0x4c1451,_0x436907){var _0x3d88d3=_[_0x231c('0x5c')](_0x2b7d5f[_0x231c('0x24')],{'id':parseInt(_0x446cf1['id'])});var _0x27ab66=_[_0x231c('0x5d')](_0x446cf1,['id']);if(_0x3d88d3){for(var _0x450f70 in _0x27ab66){if(typeof _0x27ab66[_0x450f70]!==_0x231c('0x5e')&&typeof _0x3d88d3[_0x450f70]!==_0x231c('0x5e')){_0x3d88d3[_0x450f70]=_0x27ab66[_0x450f70];}}_0x4c1451(_0x3d88d3);}else{_0x436907();}});},'VoiceChannels':function(_0x80ef81){return new Promise(function(_0x373fc7,_0x53f33d){var _0x18aaca=_[_0x231c('0x5f')](_0x2b7d5f[_0x231c('0x60')]);_0x373fc7({'count':_0x18aaca[_0x231c('0x5b')],'rows':_0x18aaca});});},'VoiceChannelMixMonitor':function(_0x25500d){var _0x565493=this;return new Promise(function(_0x5b096d,_0x317c11){if(ami['isConnected']()==![]){return _0x317c11(_0x565493[_0x231c('0x13')](0x1f4,[config[_0x231c('0x14')]['ip'],config[_0x231c('0x14')]['username'],_0x231c('0x16')]['join']('\x20')));}var _0x2c9336=schema(properties[_0x231c('0x61')])['validate'](_0x25500d);if(_0x2c9336[_0x231c('0x5b')]>0x0){return _0x317c11(_0x565493[_0x231c('0x13')](0x1f4,_[_0x231c('0x62')](_0x2c9336,'message')['join'](',\x20')));}var _0x4a93af=_[_0x231c('0x5c')](_0x2b7d5f[_0x231c('0x60')],{'uniqueid':_0x25500d[_0x231c('0x63')]});if(_0x4a93af&&_0x4a93af['channel']){var _0x228615=util[_0x231c('0x64')](_0x231c('0x65'),_0x25500d[_0x231c('0x66')]||_0x25500d[_0x231c('0x63')],_0x25500d[_0x231c('0x64')]||_0x231c('0x67'));return ami[_0x231c('0x1d')]({'action':_0x231c('0x68'),'channel':_0x4a93af[_0x231c('0x69')],'file':_0x228615,'options':_0x231c('0x6a')})['then'](function(_0xd29a0d){var _0x27cecf=_['find'](_0x4a93af[_0x231c('0x6b')],{'filename':'/var/spool/asterisk/monitor/'+_0x228615[_0x231c('0x6c')]()});if(_[_0x231c('0x6d')](_0x27cecf)){_0x4a93af[_0x231c('0x6b')][_0x231c('0x6e')]({'filename':_0x231c('0x6f')+_0x228615[_0x231c('0x6c')](),'createdAt':moment()[_0x231c('0x64')](_0x231c('0x70')),'mixmonitorid':_0xd29a0d[_0x231c('0x71')],'status':_0x231c('0x72')});}else{_0x27cecf['mixmonitorid']=_0xd29a0d[_0x231c('0x71')];_0x27cecf[_0x231c('0x73')]=_0x231c('0x72');}_0x5b096d({'code':0xc8,'message':[_0x25500d['uniqueid'],_0x231c('0x74'),_0xd29a0d[_0x231c('0x71')]]['join']('\x20'),'mixmonitorid':_0xd29a0d[_0x231c('0x71')]});})['catch'](function(_0x14f28b){_0x317c11(_0x565493[_0x231c('0x13')](0x1f5,[_0x25500d[_0x231c('0x63')],_0x14f28b[_0x231c('0x1e')][_0x231c('0x6c')]()]['join']('\x20')));});}else{return _0x317c11(_0x565493[_0x231c('0x13')](0x1f5,_0x231c('0x75')));}});},'VoiceChannelStopMixMonitor':function(_0xd016a9){var _0x2bd806=this;return new Promise(function(_0x2889fb,_0x29ceda){if(ami[_0x231c('0x12')]()==![]){return _0x29ceda(_0x2bd806['error'](0x1f4,[config['asterisk']['ip'],config['asterisk'][_0x231c('0x15')],_0x231c('0x16')]['join']('\x20')));}var _0x28ce15=schema(properties['voicechannel'])[_0x231c('0x3')](_0xd016a9);if(_0x28ce15[_0x231c('0x5b')]>0x0){return _0x29ceda(_0x2bd806[_0x231c('0x13')](0x1f4,_[_0x231c('0x62')](_0x28ce15,'message')[_0x231c('0x17')](',\x20')));}var _0x586866=_[_0x231c('0x5c')](_0x2b7d5f['channels'],{'uniqueid':_0xd016a9['uniqueid']});if(_0x586866){return BPromise[_0x231c('0x76')]()['then'](function(){if(_0x586866[_0x231c('0x69')]){return ami[_0x231c('0x1d')]({'action':'StopMixMonitor','channel':_0x586866[_0x231c('0x69')],'mixmonitorid':_0xd016a9[_0x231c('0x71')]})[_0x231c('0x1f')](function(_0x163561){});}})[_0x231c('0x22')](function(){if(_0x586866[_0x231c('0x77')]){return ami['Action']({'action':'StopMixMonitor','channel':_0x586866['destinationchannel'],'mixmonitorid':_0xd016a9[_0x231c('0x71')]})[_0x231c('0x1f')](function(_0xfed294){});}})[_0x231c('0x22')](function(_0xb72644){var _0x58b010=_['find'](_0x586866[_0x231c('0x6b')],{'mixmonitorid':_0xd016a9[_0x231c('0x71')]});if(_0x58b010){_0x58b010[_0x231c('0x73')]='stop';}})[_0x231c('0x22')](function(){var _0x1d2afa=util[_0x231c('0x64')](_0x231c('0x65'),_0xd016a9['filename']||_0xd016a9['uniqueid'],_0xd016a9['format']||_0x231c('0x67'));var _0x330f0e=_['find'](_0x586866[_0x231c('0x6b')],{'filename':_0x231c('0x6f')+_0x1d2afa[_0x231c('0x6c')]()});if(_0x330f0e){_0x330f0e[_0x231c('0x73')]=_0x231c('0x78');}})[_0x231c('0x22')](function(){_0x2889fb({'code':0xc8,'message':[_0xd016a9['uniqueid'],_0x231c('0x79')][_0x231c('0x17')]('\x20')});})[_0x231c('0x1f')](function(_0x496dc3){_0x29ceda(_0x2bd806[_0x231c('0x13')](0x1f5,[_0xd016a9[_0x231c('0x63')],_0x496dc3[_0x231c('0x1e')]['toLowerCase']()][_0x231c('0x17')]('\x20')));});}else{return _0x29ceda(_0x2bd806[_0x231c('0x13')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannels':function(_0x58b86c){return new Promise(function(_0x1d4227,_0x413e39){var _0x182d15=_[_0x231c('0x5f')](_0x2b7d5f[_0x231c('0x7a')]);_0x1d4227({'count':_0x182d15[_0x231c('0x5b')],'rows':_0x182d15});});},'VoiceQueuesChannel':function(_0x323111){var _0x5eef4d=this;return new Promise(function(_0x5734c7,_0x23f255){var _0x4a2f3a=schema(properties[_0x231c('0x7b')])[_0x231c('0x3')](_0x323111);if(_0x4a2f3a['length']>0x0){return _0x23f255(_0x5eef4d[_0x231c('0x13')](0x1f4,_[_0x231c('0x62')](_0x4a2f3a,'message')[_0x231c('0x17')](',\x20')));}var _0x5e98a9=_[_0x231c('0x5c')](_0x2b7d5f[_0x231c('0x7a')],{'uniqueid':_0x323111['uniqueid']});if(_0x5e98a9){_0x5734c7(_0x5e98a9);}else{return _0x23f255(_0x5eef4d[_0x231c('0x13')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelHangup':function(_0x18393c){var _0x6098ec=this;return new Promise(function(_0x4ece82,_0x13a7ac){if(ami['isConnected']()==![]){return _0x13a7ac(_0x6098ec[_0x231c('0x13')](0x1f4,[config[_0x231c('0x14')]['ip'],config[_0x231c('0x14')][_0x231c('0x15')],_0x231c('0x16')][_0x231c('0x17')]('\x20')));}var _0x3ba0e0=schema(properties[_0x231c('0x7c')])[_0x231c('0x3')](_0x18393c);if(_0x3ba0e0[_0x231c('0x5b')]>0x0){return _0x13a7ac(_0x6098ec[_0x231c('0x13')](0x1f4,_[_0x231c('0x62')](_0x3ba0e0,_0x231c('0x1e'))[_0x231c('0x17')](',\x20')));}var _0x55cc9a=_[_0x231c('0x5c')](_0x2b7d5f[_0x231c('0x7a')],{'uniqueid':_0x18393c[_0x231c('0x63')]});if(_0x55cc9a&&_0x55cc9a[_0x231c('0x69')]){return ami[_0x231c('0x1d')]({'action':_0x231c('0x7d'),'channel':_0x55cc9a[_0x231c('0x69')]})[_0x231c('0x22')](function(_0x53bbb9){_0x4ece82({'code':0xc8,'message':[_0x18393c[_0x231c('0x63')],_0x53bbb9['message'][_0x231c('0x6c')]()][_0x231c('0x17')]('\x20')});})[_0x231c('0x1f')](function(_0x39f291){_0x13a7ac(_0x6098ec['error'](0x1f5,[_0x18393c['uniqueid'],_0x39f291['message'][_0x231c('0x6c')]()][_0x231c('0x17')]('\x20')));});}else{return _0x13a7ac(_0x6098ec['error'](0x1f5,_0x231c('0x75')));}});},'VoiceQueuesChannelRedirect':function(_0x2f2f40){var _0x5ec9b3=this;return new Promise(function(_0x16a8a3,_0x4b3e84){if(ami[_0x231c('0x12')]()==![]){return _0x4b3e84(_0x5ec9b3[_0x231c('0x13')](0x1f4,[config[_0x231c('0x14')]['ip'],config[_0x231c('0x14')][_0x231c('0x15')],'ami\x20disconnected']['join']('\x20')));}var _0x42b9ce=schema(properties[_0x231c('0x7e')])[_0x231c('0x3')](_0x2f2f40);if(_0x42b9ce['length']>0x0){return _0x4b3e84(_0x5ec9b3[_0x231c('0x13')](0x1f4,_[_0x231c('0x62')](_0x42b9ce,'message')[_0x231c('0x17')](',\x20')));}var _0x2d037f=_['find'](_0x2b7d5f[_0x231c('0x7a')],{'uniqueid':_0x2f2f40[_0x231c('0x63')]});if(_0x2d037f&&_0x2d037f[_0x231c('0x69')]){return ami[_0x231c('0x1d')]({'action':_0x231c('0x7f'),'channel':_0x2d037f[_0x231c('0x69')],'exten':_0x2f2f40[_0x231c('0x80')],'context':_0x2f2f40['context']||_0x2d037f[_0x231c('0x81')],'priority':0x1})[_0x231c('0x22')](function(_0x263717){_0x16a8a3({'code':0xc8,'message':[_0x2f2f40[_0x231c('0x63')],_0x263717[_0x231c('0x1e')][_0x231c('0x6c')]()][_0x231c('0x17')]('\x20')});})['catch'](function(_0x205f3a){_0x4b3e84(_0x5ec9b3[_0x231c('0x13')](0x1f5,[_0x2f2f40[_0x231c('0x63')],_0x205f3a[_0x231c('0x1e')][_0x231c('0x6c')]()][_0x231c('0x17')]('\x20')));});}else{return _0x4b3e84(_0x5ec9b3[_0x231c('0x13')](0x1f5,_0x231c('0x75')));}});},'Agents':function(_0x2205c3){return new Promise(function(_0x46f6f1,_0x32d698){var _0x130165=_[_0x231c('0x5f')](_0x2b7d5f['agents']);_0x46f6f1({'count':_0x130165[_0x231c('0x5b')],'rows':_0x130165});});},'Telephones':function(_0x40812b){return new Promise(function(_0x507086,_0x47d826){var _0x991169=_[_0x231c('0x5f')](_0x2b7d5f[_0x231c('0x82')]);_0x507086({'count':_0x991169[_0x231c('0x5b')],'rows':_0x991169});});},'Trunks':function(_0x5d94fe){return new Promise(function(_0x202041,_0x4e72df){var _0x3fbd53=_[_0x231c('0x5f')](_0x2b7d5f['trunks']);_0x202041({'count':_0x3fbd53[_0x231c('0x5b')],'rows':_0x3fbd53});});},'OutboundChannels':function(_0x5e8657){return new Promise(function(_0x286551,_0x55f136){var _0x160bbc=_[_0x231c('0x5f')](_0x2b7d5f[_0x231c('0x83')]);_0x286551({'count':_0x160bbc[_0x231c('0x5b')],'rows':_0x160bbc});});},'Outbound':function(_0x170273){return new Promise(function(_0x59b622,_0x54f22b){_0x59b622(_0x2b7d5f[_0x231c('0x84')]);});},'Campaigns':function(_0x237b23){return new Promise(function(_0xc2e4a0,_0x55d370){var _0x37aff9=_[_0x231c('0x5f')](_0x2b7d5f[_0x231c('0x85')]);_0xc2e4a0({'count':_0x37aff9[_0x231c('0x5b')],'rows':_0x37aff9});});},'VoiceQueuesPreview':function(_0x1d9e00){var _0x52712a=this;return new Promise(function(_0x1e2b62,_0x24a405){_0x1b9d64[_0x231c('0x86')](_0x1d9e00['id'])[_0x231c('0x22')](function(_0x537a53){_0x1e2b62({'code':0xc8,'message':_0x537a53[_0x231c('0x1e')]});})['catch'](function(_0xd36d2c){_0x24a405(_0x52712a[_0x231c('0x13')](0x1f4,_0xd36d2c[_0x231c('0x1e')]));});});},'EventManager':function(_0x2cfe62){var _0x4a8527=this;return new Promise(function(_0x20dd2a,_0x5e0f80){if(!_0x2cfe62[_0x231c('0x87')]){return _0x5e0f80(_0x4a8527[_0x231c('0x13')](0x1f4,_0x231c('0x88')));}ami[_0x231c('0x89')]('custom:'+_0x2cfe62[_0x231c('0x87')],_0x2cfe62[_0x231c('0x1e')]);_0x20dd2a({'code':0xc8,'message':_0x2cfe62});});},'FaxAccounts':function(_0x3a270c){return new Promise(function(_0xb3890e,_0x5c1c52){var _0xf73db2=_[_0x231c('0x5f')](_0x2b7d5f[_0x231c('0x8a')]);_0xb3890e({'count':_0xf73db2[_0x231c('0x5b')],'rows':_0xf73db2});});},'SendFax':function(_0x31a8c5){var _0x47366e=this;return new Promise(function(_0x283fd1,_0x4693e8){_0x1f3f7d[_0x231c('0x8b')](_0x31a8c5)['then'](function(_0x279c82){_0x283fd1({'code':0xc8,'message':_0x279c82['message']});})[_0x231c('0x1f')](function(_0xb67ff7){_0x4693e8(_0x47366e['error'](0x1f4,_0xb67ff7['message']));});});},'CheckAfterSend':function(_0x487e4b){var _0x4a2e1a=this;return new Promise(function(_0x393ab8,_0x46b070){_0x1f3f7d[_0x231c('0x8c')](_0x487e4b)[_0x231c('0x22')](function(_0x2ecf43){_0x393ab8({'code':0xc8,'message':_0x2ecf43[_0x231c('0x1e')]});})['catch'](function(_0x5f18d9){_0x46b070(_0x4a2e1a['error'](0x1f4,_0x5f18d9['message']));});});}};var _0x35e570=jayson[_0x231c('0x8d')](_0x111bf9)[_0x231c('0x8e')]();_0x35e570['on'](_0x231c('0x13'),function(_0x143838){return _0x48bfb2(_0x143838);});_0x35e570['listen'](0x232a,_0x231c('0x8f'),function(){console[_0x231c('0x90')]('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x219c3f(_0x231c('0x91')+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 4bd84c2..ff35fe7 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 _0x14f9=['join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','[CM][%s][%s]\x20Autocreate\x20enabled','calleridnum','destcalleridnum','isNil','firstName','calleridname','','Unknown','destcalleridname','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','format','user:%s','name','action','toLowerCase','lodash','bluebird','util','../../../../config/environment','../../../../config/logger','trigger','../../rpc/cmContact','redis','defaults','localhost','socket.io-emitter','info','stringify','emit','exec','data1','data2','xmd-contactid','ListId','data3','split','phone','$or','routeId','lastName','mobile','createdAt','scheduledAt','resolve','then','length','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','map'];(function(_0x580576,_0x2f107d){var _0x3f55a0=function(_0x2e180b){while(--_0x2e180b){_0x580576['push'](_0x580576['shift']());}};_0x3f55a0(++_0x2f107d);}(_0x14f9,0x85));var _0x914f=function(_0x58432c,_0x60b449){_0x58432c=_0x58432c-0x0;var _0x39c8bf=_0x14f9[_0x58432c];return _0x39c8bf;};'use strict';var _=require(_0x914f('0x0'));var BPromise=require(_0x914f('0x1'));var Redis=require('ioredis');var util=require(_0x914f('0x2'));var config=require(_0x914f('0x3'));var logger=require(_0x914f('0x4'))(_0x914f('0x5'));var cmContactRpc=require(_0x914f('0x6'));config[_0x914f('0x7')]=_[_0x914f('0x8')](config[_0x914f('0x7')],{'host':_0x914f('0x9'),'port':0x18eb});var io=require(_0x914f('0xa'))(new Redis(config[_0x914f('0x7')]));function emit(_0x26e2a1,_0x51ae87,_0x1fa85d,_0x164f2b,_0x2f8622){logger[_0x914f('0xb')]('[CM][%s][%s]',_0x26e2a1,_0x51ae87['id'],_0x1fa85d,_0x164f2b,JSON[_0x914f('0xc')](_0x2f8622));io['to'](_0x1fa85d)[_0x914f('0xd')](_0x164f2b,_0x2f8622);}exports[_0x914f('0xe')]=function(_0x10c8ad,_0xf4691e,_0x50cb66,_0x1efc26){var _0x56cc44,_0x369259;var _0x2e13da={};var _0x30e609=Number(_0x50cb66[_0x914f('0xf')]);var _0x2ac19a=_0x50cb66[_0x914f('0x10')]?Boolean(Number(_0x50cb66[_0x914f('0x10')])):![];var _0x2ef96b;if(_0x1efc26[_0x914f('0x11')]){_0x2e13da['id']=_0x1efc26[_0x914f('0x11')];}if(!_0x2e13da['id']){_0x2e13da[_0x914f('0x12')]=_0x30e609;_0x2ef96b=_0x50cb66['data3']&&_0x50cb66[_0x914f('0x13')]!=='0'?_0x50cb66[_0x914f('0x13')][_0x914f('0x14')](','):[_0x914f('0x15')];_0x2e13da[_0x914f('0x16')]=_['map'](_0x2ef96b,function(_0xaa8ec9){var _0x1d50a0={};_0x1d50a0[_0xaa8ec9]=_0x1efc26[_0x914f('0x17')]?_0x1efc26['destcalleridnum']:_0x1efc26['calleridnum'];return _0x1d50a0;});}var _0x4215d2=['id','firstName',_0x914f('0x18'),'phone',_0x914f('0x19'),'fax','ListId',_0x914f('0x1a'),_0x914f('0x1b'),'updatedAt'];var _0x41563d=_['union'](_0x4215d2,_0x2ef96b);BPromise[_0x914f('0x1c')]()[_0x914f('0x1d')](cmContactRpc['getContacts']({'attributes':_0x41563d,'where':_0x2e13da}))[_0x914f('0x1d')](function(_0x43a6e9){_0x369259=_0x43a6e9;if(!_['isEmpty'](_0x369259)){if(_0x369259[_0x914f('0x1e')]===0x1){_0x56cc44=_0x369259[0x0];logger[_0x914f('0xb')](_0x914f('0x1f'),_0x1efc26[_0x914f('0x20')],_0xf4691e['id'],_0x56cc44['id']);}else{logger[_0x914f('0xb')](_0x914f('0x21'),_0x1efc26[_0x914f('0x20')],_0xf4691e['id'],_[_0x914f('0x22')](_0x369259,'id')[_0x914f('0x23')](','));}return;}else{logger[_0x914f('0xb')](_0x914f('0x24'),_0x1efc26[_0x914f('0x20')],_0xf4691e['id']);var _0x5432f8={'ListId':_0x30e609};var _0x48782c=_0x50cb66[_0x914f('0x25')]&&_0x50cb66['data4']!=='0'?_0x50cb66[_0x914f('0x25')]:'phone';if(_0x2ac19a){logger[_0x914f('0xb')](_0x914f('0x26'),_0x1efc26[_0x914f('0x20')],_0xf4691e['id']);_0x5432f8[_0x48782c]=_['isNil'](_0x1efc26[_0x914f('0x17')])?_0x1efc26[_0x914f('0x27')]:_0x1efc26[_0x914f('0x28')];if(_[_0x914f('0x29')](_0x1efc26['routeId'])){_0x5432f8[_0x914f('0x2a')]=_0x1efc26[_0x914f('0x2b')]&&_0x1efc26[_0x914f('0x2b')]!==_0x914f('0x2c')?_0x1efc26[_0x914f('0x2b')]:_0x914f('0x2d');}else{_0x5432f8[_0x914f('0x2a')]=_0x1efc26['destcalleridname']&&_0x1efc26[_0x914f('0x2e')]!==_0x914f('0x2c')?_0x1efc26['destcalleridname']:_0x914f('0x2d');}return BPromise['resolve']()['then'](cmContactRpc[_0x914f('0x2f')](_0x5432f8))[_0x914f('0x1d')](function(_0x46c76c){_0x56cc44=_0x46c76c;_0x369259[_0x914f('0x30')](_0x46c76c);if(_0x56cc44){logger[_0x914f('0xb')](_0x914f('0x31'),_0x1efc26[_0x914f('0x20')],_0xf4691e['id'],_0x56cc44['id']);}return;});}else{logger[_0x914f('0xb')](_0x914f('0x32'),_0x1efc26[_0x914f('0x20')],_0xf4691e['id']);_0x5432f8[_0x48782c]=_[_0x914f('0x29')](_0x1efc26[_0x914f('0x17')])?_0x1efc26['calleridnum']:_0x1efc26[_0x914f('0x28')];if(_[_0x914f('0x29')](_0x1efc26[_0x914f('0x17')])){_0x5432f8[_0x914f('0x2a')]=_0x1efc26[_0x914f('0x2b')]&&_0x1efc26['calleridname']!==_0x914f('0x2c')?_0x1efc26['calleridname']:_0x914f('0x2d');}else{_0x5432f8['firstName']=_0x1efc26[_0x914f('0x2e')]&&_0x1efc26['destcalleridname']!==_0x914f('0x2c')?_0x1efc26['destcalleridname']:_0x914f('0x2d');}_0x56cc44=_0x5432f8;_0x369259[_0x914f('0x30')](_0x5432f8);return;}}})[_0x914f('0x1d')](function(){if(_0x10c8ad){emit(_0x1efc26[_0x914f('0x20')],_0xf4691e,util[_0x914f('0x33')](_0x914f('0x34'),_0x10c8ad[_0x914f('0x35')]),util[_0x914f('0x33')]('trigger:%s',_0x50cb66[_0x914f('0x36')][_0x914f('0x37')]()),{'evt':_['merge'](_0x1efc26,{'autoCreate':_0x2ac19a}),'contact':_0x56cc44===undefined?{}:_0x56cc44,'contacts':_0x369259[_0x914f('0x1e')]===0x0?undefined:_0x369259});}});}; \ No newline at end of file +var _0x8e26=['xmd-contactid','ListId','data3','split','phone','map','routeId','destcalleridnum','firstName','fax','scheduledAt','updatedAt','union','resolve','then','isEmpty','length','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','isNil','calleridnum','calleridname','','destcalleridname','Unknown','push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','format','user:%s','name','trigger:%s','action','toLowerCase','merge','lodash','bluebird','ioredis','../../../../config/environment','../../../../config/logger','../../rpc/cmContact','defaults','socket.io-emitter','info','[CM][%s][%s]','stringify','emit','exec','data1','data2'];(function(_0x7490e4,_0x4f5920){var _0x523e71=function(_0x190eb8){while(--_0x190eb8){_0x7490e4['push'](_0x7490e4['shift']());}};_0x523e71(++_0x4f5920);}(_0x8e26,0xc5));var _0x68e2=function(_0x193264,_0x45b9a2){_0x193264=_0x193264-0x0;var _0x56812c=_0x8e26[_0x193264];return _0x56812c;};'use strict';var _=require(_0x68e2('0x0'));var BPromise=require(_0x68e2('0x1'));var Redis=require(_0x68e2('0x2'));var util=require('util');var config=require(_0x68e2('0x3'));var logger=require(_0x68e2('0x4'))('trigger');var cmContactRpc=require(_0x68e2('0x5'));config['redis']=_[_0x68e2('0x6')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x68e2('0x7'))(new Redis(config['redis']));function emit(_0x5f0bcb,_0x1b4128,_0x254cd5,_0x5edce5,_0xa82c8){logger[_0x68e2('0x8')](_0x68e2('0x9'),_0x5f0bcb,_0x1b4128['id'],_0x254cd5,_0x5edce5,JSON[_0x68e2('0xa')](_0xa82c8));io['to'](_0x254cd5)[_0x68e2('0xb')](_0x5edce5,_0xa82c8);}exports[_0x68e2('0xc')]=function(_0x3998a2,_0x4caa8a,_0x4e3bc7,_0x165c38){var _0x4f72e3,_0x5dd72f;var _0x58a1ca={};var _0x24073e=Number(_0x4e3bc7[_0x68e2('0xd')]);var _0x48029a=_0x4e3bc7[_0x68e2('0xe')]?Boolean(Number(_0x4e3bc7[_0x68e2('0xe')])):![];var _0x287b59;if(_0x165c38[_0x68e2('0xf')]){_0x58a1ca['id']=_0x165c38[_0x68e2('0xf')];}if(!_0x58a1ca['id']){_0x58a1ca[_0x68e2('0x10')]=_0x24073e;_0x287b59=_0x4e3bc7[_0x68e2('0x11')]&&_0x4e3bc7[_0x68e2('0x11')]!=='0'?_0x4e3bc7['data3'][_0x68e2('0x12')](','):[_0x68e2('0x13')];_0x58a1ca['$or']=_[_0x68e2('0x14')](_0x287b59,function(_0x45f1c0){var _0x6ba6ee={};_0x6ba6ee[_0x45f1c0]=_0x165c38[_0x68e2('0x15')]?_0x165c38[_0x68e2('0x16')]:_0x165c38['calleridnum'];return _0x6ba6ee;});}var _0x472c22=['id',_0x68e2('0x17'),'lastName','phone','mobile',_0x68e2('0x18'),_0x68e2('0x10'),'createdAt',_0x68e2('0x19'),_0x68e2('0x1a')];var _0x5d87da=_[_0x68e2('0x1b')](_0x472c22,_0x287b59);BPromise[_0x68e2('0x1c')]()[_0x68e2('0x1d')](cmContactRpc['getContacts']({'attributes':_0x5d87da,'where':_0x58a1ca}))[_0x68e2('0x1d')](function(_0x3d20f8){_0x5dd72f=_0x3d20f8;if(!_[_0x68e2('0x1e')](_0x5dd72f)){if(_0x5dd72f[_0x68e2('0x1f')]===0x1){_0x4f72e3=_0x5dd72f[0x0];logger['info'](_0x68e2('0x20'),_0x165c38[_0x68e2('0x21')],_0x4caa8a['id'],_0x4f72e3['id']);}else{logger[_0x68e2('0x8')]('[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]',_0x165c38[_0x68e2('0x21')],_0x4caa8a['id'],_[_0x68e2('0x14')](_0x5dd72f,'id')[_0x68e2('0x22')](','));}return;}else{logger[_0x68e2('0x8')](_0x68e2('0x23'),_0x165c38[_0x68e2('0x21')],_0x4caa8a['id']);var _0x274fcd={'ListId':_0x24073e};var _0x1032fb=_0x4e3bc7[_0x68e2('0x24')]&&_0x4e3bc7[_0x68e2('0x24')]!=='0'?_0x4e3bc7[_0x68e2('0x24')]:_0x68e2('0x13');if(_0x48029a){logger[_0x68e2('0x8')]('[CM][%s][%s]\x20Autocreate\x20enabled',_0x165c38[_0x68e2('0x21')],_0x4caa8a['id']);_0x274fcd[_0x1032fb]=_[_0x68e2('0x25')](_0x165c38['routeId'])?_0x165c38[_0x68e2('0x26')]:_0x165c38['destcalleridnum'];if(_[_0x68e2('0x25')](_0x165c38[_0x68e2('0x15')])){_0x274fcd[_0x68e2('0x17')]=_0x165c38[_0x68e2('0x27')]&&_0x165c38['calleridname']!==_0x68e2('0x28')?_0x165c38[_0x68e2('0x27')]:'Unknown';}else{_0x274fcd['firstName']=_0x165c38[_0x68e2('0x29')]&&_0x165c38[_0x68e2('0x29')]!==_0x68e2('0x28')?_0x165c38['destcalleridname']:_0x68e2('0x2a');}return BPromise[_0x68e2('0x1c')]()[_0x68e2('0x1d')](cmContactRpc['createContact'](_0x274fcd))[_0x68e2('0x1d')](function(_0x1f9309){_0x4f72e3=_0x1f9309;_0x5dd72f[_0x68e2('0x2b')](_0x1f9309);if(_0x4f72e3){logger[_0x68e2('0x8')](_0x68e2('0x2c'),_0x165c38['uniqueid'],_0x4caa8a['id'],_0x4f72e3['id']);}return;});}else{logger[_0x68e2('0x8')](_0x68e2('0x2d'),_0x165c38[_0x68e2('0x21')],_0x4caa8a['id']);_0x274fcd[_0x1032fb]=_[_0x68e2('0x25')](_0x165c38['routeId'])?_0x165c38[_0x68e2('0x26')]:_0x165c38[_0x68e2('0x16')];if(_[_0x68e2('0x25')](_0x165c38[_0x68e2('0x15')])){_0x274fcd[_0x68e2('0x17')]=_0x165c38[_0x68e2('0x27')]&&_0x165c38[_0x68e2('0x27')]!==_0x68e2('0x28')?_0x165c38[_0x68e2('0x27')]:'Unknown';}else{_0x274fcd[_0x68e2('0x17')]=_0x165c38[_0x68e2('0x29')]&&_0x165c38[_0x68e2('0x29')]!==_0x68e2('0x28')?_0x165c38[_0x68e2('0x29')]:_0x68e2('0x2a');}_0x4f72e3=_0x274fcd;_0x5dd72f[_0x68e2('0x2b')](_0x274fcd);return;}}})[_0x68e2('0x1d')](function(){if(_0x3998a2){emit(_0x165c38[_0x68e2('0x21')],_0x4caa8a,util[_0x68e2('0x2e')](_0x68e2('0x2f'),_0x3998a2[_0x68e2('0x30')]),util[_0x68e2('0x2e')](_0x68e2('0x31'),_0x4e3bc7[_0x68e2('0x32')][_0x68e2('0x33')]()),{'evt':_[_0x68e2('0x34')](_0x165c38,{'autoCreate':_0x48029a}),'contact':_0x4f72e3===undefined?{}:_0x4f72e3,'contacts':_0x5dd72f[_0x68e2('0x1f')]===0x0?undefined:_0x5dd72f});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index 3d6af7a..94af492 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 _0xc12b=['prototype','stringify','clone','checkTriggers','interface','triggers','hasOwnProperty','status','merge','length','Actions','action','contactmanager','motionbar','browser','data1','html','data2','render','uri','data3','isNil','data4','location','uriLocation','windowWidth','800','data5','windowHeight','data6','winApplication','winArguments','format','name','trigger:%s:%s','jscripty','emit','user:%s','toLowerCase','trigger:%s','exec','queue','routeId','urlforward','script','buildUri','parse','search','replace','checkTrigger','AllConditions','every','checkConditions','channel','AnyConditions','some','field','account','chat','ChatWebsiteId','operator','value','AccountId','upperFirst','interaction','message','event','agent','membername','lastevent','exports','util','lodash','url','ioredis','./urlforward','./cmContact','../../../config/environment','../../../config/logger','trigger','../ami','redis','defaults','localhost','popup','winapp','agents','voiceQueues','templates','voiceExtensions','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','accounts','zendeskAccounts','custom:agentcalled','syncCustomEvent','bind','custom:agentconnect','custom:agentringnoanswer','custom:agentnosuchnumber','custom:agentnoanswer','custom:agentbusy','custom:agentreject','custom:amd','custom:timeout','custom:dialbegin','custom:dialconnect','syncAgentDial','custom:dialend','custom:newinteraction','custom:incomingmessage','custom:outgoingmessage','custom:acceptmessage'];(function(_0x48bb34,_0x4a99e4){var _0x516233=function(_0x4d0ae9){while(--_0x4d0ae9){_0x48bb34['push'](_0x48bb34['shift']());}};_0x516233(++_0x4a99e4);}(_0xc12b,0x1af));var _0xbc12=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc12b[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0xbc12('0x0'));var _=require(_0xbc12('0x1'));var url=require(_0xbc12('0x2'));var Mustache=require('mustache');var Redis=require(_0xbc12('0x3'));var urlforward=require(_0xbc12('0x4'));var integration=require('./integration');var cmContact=require(_0xbc12('0x5'));var script=require('./script');var config=require(_0xbc12('0x6'));var logger=require(_0xbc12('0x7'))(_0xbc12('0x8'));var ami=require(_0xbc12('0x9'));config[_0xbc12('0xa')]=_[_0xbc12('0xb')](config['redis'],{'host':_0xbc12('0xc'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xbc12('0xa')]));var operators={'equals':function(_0x59f8b1,_0x4373c2){return _0x59f8b1==_0x4373c2;},'not_equals':function(_0x14ab01,_0x26d3af){return _0x14ab01!=_0x26d3af;}};var barAndWebActions=[_0xbc12('0xd'),_0xbc12('0x2'),_0xbc12('0xe')];function Trigger(_0x11c79d){this['triggers']=_0x11c79d['triggers'];this[_0xbc12('0xf')]=_0x11c79d['agents'];this[_0xbc12('0x10')]=_0x11c79d[_0xbc12('0x10')];this[_0xbc12('0x11')]=_0x11c79d[_0xbc12('0x11')];this[_0xbc12('0x12')]=_0x11c79d[_0xbc12('0x12')];this['zendeskAccounts']=_0x11c79d['zendeskAccounts'];this['freshdeskAccounts']=_0x11c79d[_0xbc12('0x13')];this[_0xbc12('0x14')]=_0x11c79d[_0xbc12('0x14')];this[_0xbc12('0x15')]=_0x11c79d[_0xbc12('0x15')];this['zohoAccounts']=_0x11c79d[_0xbc12('0x16')];this[_0xbc12('0x17')]=_0x11c79d[_0xbc12('0x17')];this[_0xbc12('0x18')]=_0x11c79d[_0xbc12('0x18')];this[_0xbc12('0x19')]=_0x11c79d['servicenowAccounts'];this['dynamics365Accounts']=_0x11c79d[_0xbc12('0x1a')];this[_0xbc12('0x1b')]=_0x11c79d['freshsalesAccounts'];this[_0xbc12('0x1c')]={'zendesk':this[_0xbc12('0x1d')],'salesforce':this['salesforceAccounts'],'freshdesk':this[_0xbc12('0x13')],'sugarcrm':this[_0xbc12('0x15')],'zoho':this[_0xbc12('0x16')],'desk':this[_0xbc12('0x17')],'vtiger':this['vtigerAccounts'],'dynamics365':this[_0xbc12('0x1a')],'freshsales':this[_0xbc12('0x1b')],'servicenow':this[_0xbc12('0x19')]};ami['on'](_0xbc12('0x1e'),this[_0xbc12('0x1f')][_0xbc12('0x20')](this));ami['on'](_0xbc12('0x21'),this['syncCustomEvent']['bind'](this));ami['on'](_0xbc12('0x22'),this[_0xbc12('0x1f')][_0xbc12('0x20')](this));ami['on']('custom:agentcomplete',this[_0xbc12('0x1f')][_0xbc12('0x20')](this));ami['on'](_0xbc12('0x23'),this['syncCustomEvent'][_0xbc12('0x20')](this));ami['on'](_0xbc12('0x24'),this[_0xbc12('0x1f')][_0xbc12('0x20')](this));ami['on'](_0xbc12('0x25'),this[_0xbc12('0x1f')][_0xbc12('0x20')](this));ami['on']('custom:agentcongestion',this[_0xbc12('0x1f')][_0xbc12('0x20')](this));ami['on'](_0xbc12('0x26'),this[_0xbc12('0x1f')][_0xbc12('0x20')](this));ami['on'](_0xbc12('0x27'),this[_0xbc12('0x1f')][_0xbc12('0x20')](this));ami['on']('custom:queuecallerabandon',this['syncCustomEvent'][_0xbc12('0x20')](this));ami['on'](_0xbc12('0x28'),this['syncCustomEvent'][_0xbc12('0x20')](this));ami['on'](_0xbc12('0x29'),this['syncAgentDial'][_0xbc12('0x20')](this));ami['on'](_0xbc12('0x2a'),this[_0xbc12('0x2b')][_0xbc12('0x20')](this));ami['on'](_0xbc12('0x2c'),this[_0xbc12('0x2b')]['bind'](this));ami['on'](_0xbc12('0x2d'),this[_0xbc12('0x1f')][_0xbc12('0x20')](this));ami['on']('custom:closedinteraction',this['syncCustomEvent']['bind'](this));ami['on'](_0xbc12('0x2e'),this[_0xbc12('0x1f')]['bind'](this));ami['on'](_0xbc12('0x2f'),this[_0xbc12('0x1f')][_0xbc12('0x20')](this));ami['on'](_0xbc12('0x30'),this['syncCustomEvent'][_0xbc12('0x20')](this));ami['on']('custom:rejectmessage',this[_0xbc12('0x1f')][_0xbc12('0x20')](this));}Trigger[_0xbc12('0x31')]['emit']=function(_0x3246c2,_0xfc282c,_0x20e58c){logger['info'](_0x3246c2,_0xfc282c,JSON[_0xbc12('0x32')](_0x20e58c));io['to'](_0x3246c2)['emit'](_0xfc282c,_0x20e58c);};Trigger[_0xbc12('0x31')]['syncCustomEvent']=function(_0x23c118){var _0x57f8f6=_[_0xbc12('0x33')](_0x23c118);this[_0xbc12('0x34')](_0x57f8f6);};Trigger['prototype'][_0xbc12('0x2b')]=function(_0x41e8d2){if(this[_0xbc12('0xf')][_0x41e8d2[_0xbc12('0x35')]]){this[_0xbc12('0x1f')](_0x41e8d2);}};Trigger[_0xbc12('0x31')]['checkTriggers']=function(_0x8de4b9){var _0x1ebeb8;for(var _0x1b66e5 in this['triggers']){if(this[_0xbc12('0x36')][_0xbc12('0x37')](_0x1b66e5)){if(this['triggers'][_0x1b66e5][_0xbc12('0x38')]){_0x1ebeb8=this['checkTrigger'](this[_0xbc12('0x36')][_0x1b66e5],_0x8de4b9);if(_0x1ebeb8){_[_0xbc12('0x39')](_0x8de4b9,_0x8de4b9['variables']);for(var _0x5905dc=0x0,_0x1d6d76,_0x66c5a2,_0x5295c1;_0x5905dc0x0){_0x11c1eb=_[_0x7995('0x2b')](_0xf16cc2,_0x132a42);}return _0x11c1eb;}function getCustomFields(_0x514445,_0x456a28){var _0x3250e0=[];var _0x4253e5={'custom_fields':{}};if(_0x514445['length']>0x0){_['forEach'](_0x514445,function(_0x48e573){if(_[_0x7995('0x2c')]([_0x7995('0x2d'),_0x7995('0x2e')],_0x48e573[_0x7995('0x2f')])&&_0x48e573[_0x7995('0x30')]&&!_0x48e573[_0x7995('0x31')]){_0x4253e5[_0x48e573['nameField']['toLowerCase']()]=_0x48e573[_0x7995('0x32')]['toString']();}else if(_[_0x7995('0x2c')]([_0x7995('0x2d'),_0x7995('0x2e')],_0x48e573[_0x7995('0x2f')])&&_0x48e573[_0x7995('0x33')]&&_0x48e573['customField']){_0x4253e5[_0x7995('0x34')][_0x48e573[_0x7995('0x33')]]=_0x48e573['content']['toString']();}else if(_0x48e573['type']===_0x7995('0x35')&&_0x48e573[_0x7995('0x36')]&&_0x48e573['idField']&&_0x48e573[_0x7995('0x31')]){_0x456a28[_0x48e573['variableName']]&&(_0x4253e5[_0x7995('0x34')][_0x48e573[_0x7995('0x33')]]=_0x456a28[_0x48e573[_0x7995('0x36')]]['toString']());}else if(_0x48e573['type']===_0x7995('0x37')&&_0x48e573['Variable']&&_0x48e573['Variable'][_0x7995('0x38')]&&_0x48e573[_0x7995('0x33')]&&_0x48e573['customField']){_0x456a28[_0x48e573[_0x7995('0x39')][_0x7995('0x38')][_0x7995('0x3a')]()]&&(_0x4253e5[_0x7995('0x34')][_0x48e573[_0x7995('0x33')]]=_0x456a28[_0x48e573['Variable'][_0x7995('0x38')][_0x7995('0x3a')]()][_0x7995('0x22')]());}});}if(_0x4253e5[_0x7995('0x3b')]){_0x4253e5['priority']=Number(_0x4253e5[_0x7995('0x3b')]);}return _0x4253e5;}function getTicket(_0x235df7,_0x3eb04f,_0xe5ea43,_0x1f5bee,_0x1035dc){logger['info'](_0x7995('0x3c'));var _0x3be298=_[_0x7995('0x3d')]({'subject':intUtil[_0x7995('0x3e')](_0x1f5bee[_0x7995('0x3f')],_0x1035dc,'\x20'),'type':_0x7995('0x40'),'status':_0x7995('0x41'),'labels':[_0x7995('0x42'),_0x7995('0x43'),_0x7995('0x44')][_0x7995('0x45')](getTags(_0x1f5bee[_0x7995('0x46')],_0x7995('0x38'))),'description':intUtil['getString'](_0x1f5bee['Descriptions'],_0x1035dc,'\x0a'),'_links':{'assigned_user':{'href':util[_0x7995('0x11')](_0x7995('0x47'),_0x3eb04f['id']),'class':'user'}},'message':{'direction':'in','body':intUtil['getString'](_0x1f5bee[_0x7995('0x48')],_0x1035dc,'\x0a')}},getCustomFields(_0x1f5bee['Fields'],_0x1035dc));return request({'uri':util['format'](_0x7995('0x49'),_0x235df7[_0x7995('0x12')],_0xe5ea43['id']),'method':_0x7995('0x29'),'body':_0x3be298});}exports['queue']=function(_0x46ac4f,_0x5e85b9,_0x3993b5,_0x5a8881,_0x493066,_0x39c5b8){var _0x403f54,_0xc04e5;_0x39c5b8[_0x7995('0x12')]=intUtil['stripTrailingSlash'](_0x39c5b8[_0x7995('0x12')]);_0x39c5b8[_0x7995('0x4a')]=intUtil[_0x7995('0x4b')](_0x39c5b8[_0x7995('0x4a')]);if(_0x493066&&_0x493066['monitor_format']){logger['info'](_0x7995('0x4c'),'Recording\x20is\x20enabled!');_0x5e85b9[_0x7995('0x4d')]=util['format'](_0x7995('0x4e'),_0x39c5b8['serverUrl'],_0x5e85b9[_0x7995('0x4f')],md5(_0x5e85b9[_0x7995('0x4f')]));}else{_0x5e85b9['recordingURL']='';}headers[_0x7995('0x50')]=getAuth(_0x39c5b8);return getUser(_0x39c5b8,_0x5a8881[_0x7995('0x51')])[_0x7995('0x13')](function(_0xb70a51){_0x403f54=_0xb70a51;logger['info'](_0x7995('0x52'),_0x403f54['id']);return getEndUser(_0x39c5b8,_0x5e85b9[_0x7995('0x53')],_0x5e85b9[_0x7995('0x54')]);})['then'](function(_0xe228a5){_0xc04e5=_0xe228a5;logger[_0x7995('0xf')](_0x7995('0x55'),_0xc04e5['id']);return getTicket(_0x39c5b8,_0x403f54,_0xc04e5,_0x3993b5,_0x5e85b9);})[_0x7995('0x13')](function(_0x255313){if(_0x255313){logger['info'](_0x7995('0x56'));logger[_0x7995('0xf')]('The\x20Ticket\x20ID\x20is:',_0x255313['id']);switch(_0x39c5b8[_0x7995('0x2f')]){case'integrationTab':logger[_0x7995('0xf')](_0x7995('0x4c'),_0x7995('0x57'));emit(util[_0x7995('0x11')](_0x7995('0x58'),_0x5a8881[_0x7995('0x38')]),_0x7995('0x59'),{'recordId':_0x255313['id']});break;case'newTab':logger[_0x7995('0xf')](_0x7995('0x4c'),_0x7995('0x5a'));emit(util['format'](_0x7995('0x58'),_0x5a8881[_0x7995('0x38')]),_0x7995('0x5b'),{'uri':util['format']('https://xcally.desk.com/web/agent/case/%d',_0x255313['id'])});break;default:logger['error'](_0x7995('0x4c'),_0x7995('0x5c'));}}})['catch'](function(_0x1cd85){console[_0x7995('0x5d')](_0x1cd85);logger[_0x7995('0x5d')](_0x7995('0x4c'),JSON[_0x7995('0x1c')](_0x1cd85));});};exports['outbound']=function(_0x29ee32,_0x4ab09f,_0x14fe7f,_0x33c801,_0x206d2a,_0x50c7b5,_0x5e1f34){var _0x54e2b1,_0x563f8e;_0x50c7b5[_0x7995('0x12')]=intUtil[_0x7995('0x4b')](_0x50c7b5[_0x7995('0x12')]);_0x50c7b5[_0x7995('0x4a')]=intUtil[_0x7995('0x4b')](_0x50c7b5[_0x7995('0x4a')]);if(_0x5e1f34&&_0x5e1f34[_0x7995('0x5e')]&&_0x5e1f34[_0x7995('0x5e')]!==_0x7995('0x5f')){logger[_0x7995('0xf')](_0x7995('0x60'),_0x7995('0x61'));_0x4ab09f[_0x7995('0x4d')]=util[_0x7995('0x11')](_0x7995('0x4e'),_0x50c7b5[_0x7995('0x4a')],_0x4ab09f[_0x7995('0x4f')],md5(_0x4ab09f[_0x7995('0x4f')]));}headers[_0x7995('0x50')]=getAuth(_0x50c7b5);return getUser(_0x50c7b5,_0x33c801['email'])[_0x7995('0x13')](function(_0x630737){_0x54e2b1=_0x630737;logger[_0x7995('0xf')](_0x7995('0x52'),_0x54e2b1['id']);return getEndUser(_0x50c7b5,_0x4ab09f['destcalleridname'],_0x4ab09f['destcalleridnum']);})[_0x7995('0x13')](function(_0x197b52){_0x563f8e=_0x197b52;logger[_0x7995('0xf')](_0x7995('0x55'),_0x563f8e['id']);return getTicket(_0x50c7b5,_0x54e2b1,_0x563f8e,_0x14fe7f,_0x4ab09f);})['then'](function(_0x13cd7b){if(_0x13cd7b){logger[_0x7995('0xf')](_0x7995('0x56'));logger[_0x7995('0xf')]('The\x20Ticket\x20ID\x20is:',_0x13cd7b['id']);switch(_0x50c7b5['type']){case _0x7995('0x62'):logger[_0x7995('0xf')](_0x7995('0x4c'),_0x7995('0x57'));emit(util[_0x7995('0x11')](_0x7995('0x58'),_0x33c801[_0x7995('0x38')]),_0x7995('0x59'),{'recordId':_0x13cd7b['id']});break;case _0x7995('0x63'):logger['info'](_0x7995('0x4c'),_0x7995('0x5a'));emit(util[_0x7995('0x11')](_0x7995('0x58'),_0x33c801['name']),'trigger:browser:url',{'uri':util[_0x7995('0x11')](_0x7995('0x64'),_0x50c7b5['remoteUri'],_0x13cd7b['id'])});break;default:logger[_0x7995('0x5d')](_0x7995('0x60'),_0x7995('0x5c'));}}})[_0x7995('0x65')](function(_0x32cb04){logger['error'](_0x7995('0x60'),JSON['stringify'](_0x32cb04));});};exports[_0x7995('0x66')]=function(_0xe31dcb,_0x1722e2,_0x25b534,_0x4388c1,_0xeb8920,_0x2b3c1d){var _0x44372a,_0x10f012;_0x2b3c1d[_0x7995('0x12')]=intUtil[_0x7995('0x4b')](_0x2b3c1d[_0x7995('0x12')]);_0x2b3c1d['serverUrl']=intUtil[_0x7995('0x4b')](_0x2b3c1d[_0x7995('0x4a')]);if(_0xeb8920&&_0xeb8920[_0x7995('0x67')]){logger[_0x7995('0xf')]('['+_0x1722e2[_0x7995('0x68')]['toUpperCase']()+']','Recording\x20is\x20enabled!');_0x1722e2[_0x7995('0x4d')]=util[_0x7995('0x11')](_0x7995('0x4e'),_0x2b3c1d[_0x7995('0x4a')],_0x1722e2['uniqueid'],md5(_0x1722e2[_0x7995('0x4f')]));}else{_0x1722e2['recordingURL']='';}headers['Authorization']=getAuth(_0x2b3c1d);return getUser(_0x2b3c1d)[_0x7995('0x13')](function(_0x36d27d){_0x44372a=_0x36d27d;logger[_0x7995('0xf')](_0x7995('0x52'),_0x44372a['id']);return getEndUser(_0x2b3c1d,_0x1722e2[_0x7995('0x53')],_0x1722e2[_0x7995('0x54')]);})[_0x7995('0x13')](function(_0x13dc73){_0x10f012=_0x13dc73;logger[_0x7995('0xf')](_0x7995('0x55'),_0x10f012['id']);return getTicket(_0x2b3c1d,_0x44372a,_0x10f012,_0x25b534,_0x1722e2);})['then'](function(_0x2dc1f7){if(_0x2dc1f7){logger[_0x7995('0xf')](_0x7995('0x56'));logger['info'](_0x7995('0x69'),_0x2dc1f7['id']);}})[_0x7995('0x65')](function(_0x705f0){logger[_0x7995('0x5d')]('['+_0x1722e2[_0x7995('0x68')][_0x7995('0x6a')]()+']',JSON[_0x7995('0x1c')](_0x705f0));});}; \ No newline at end of file +var _0x55ca=['debug','[HTTP]','stringify','GET','authType','basic','%s:%s','username','token','%s/token:%s','toString','base64','Searching\x20enduser\x20with\x20phone','Enduser\x20found!','_embedded','entries','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/customers','POST','length','forEach','includes','picklist','type','nameField','customField','toLowerCase','content','string','idField','custom_fields','variable','variableName','customVariable','Variable','name','priority','merge','xCALLY','Motion','CTI','concat','Tags','getString','Descriptions','/api/v2/users/%d','user','Fields','stripTrailingSlash','serverUrl','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','calleridname','calleridnum','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','integrationTab','user:%s','trigger:desk:display','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','error','Desk\x20account\x20type\x20not\x20recognized','outbound','recordingFormat','none','[OUTBOUND]','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent...','%s/agent/tickets/%s','catch','unmanaged','monitor_format','lastevent','toUpperCase','Recording\x20is\x20enabled!','lodash','request-promise','./util','../../../../config/environment','desk','redis','defaults','localhost','socket.io-emitter','application/json','validateEmail','info','Getting\x20agent\x20with\x20email','format','%s/users','remoteUri','then','total_entries','find','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me'];(function(_0x3b05e5,_0x426198){var _0x55d175=function(_0x2bc6ad){while(--_0x2bc6ad){_0x3b05e5['push'](_0x3b05e5['shift']());}};_0x55d175(++_0x426198);}(_0x55ca,0x126));var _0xa55c=function(_0x4fa0ea,_0x2cd534){_0x4fa0ea=_0x4fa0ea-0x0;var _0x51d027=_0x55ca[_0x4fa0ea];return _0x51d027;};'use strict';var _=require(_0xa55c('0x0'));var rp=require(_0xa55c('0x1'));var md5=require('md5');var util=require('util');var Redis=require('ioredis');var intUtil=require(_0xa55c('0x2'));var config=require(_0xa55c('0x3'));var logger=require('../../../../config/logger')(_0xa55c('0x4'));config[_0xa55c('0x5')]=_[_0xa55c('0x6')](config[_0xa55c('0x5')],{'host':_0xa55c('0x7'),'port':0x18eb});var io=require(_0xa55c('0x8'))(new Redis(config[_0xa55c('0x5')]));function emit(_0x4d0624,_0x2121fd,_0x2537f0){io['to'](_0x4d0624)['emit'](_0x2121fd,_0x2537f0);}var headers={'Content-Type':_0xa55c('0x9'),'Accept':_0xa55c('0x9')};function getUser(_0x52a3bc,_0x5849ad){if(intUtil[_0xa55c('0xa')](_0x5849ad)===!![]){logger[_0xa55c('0xb')](_0xa55c('0xc'),_0x5849ad);return request({'uri':util[_0xa55c('0xd')](_0xa55c('0xe'),_0x52a3bc[_0xa55c('0xf')])})[_0xa55c('0x10')](function(_0x70c2de){if(_0x70c2de[_0xa55c('0x11')]){return _[_0xa55c('0x12')](_0x70c2de['_embedded']['entries'],{'email':_0x5849ad});}})[_0xa55c('0x10')](function(_0x576044){if(_0x576044){logger['info']('Agent\x20found!');return _0x576044;}else{logger[_0xa55c('0xb')](_0xa55c('0x13'));return request({'uri':util[_0xa55c('0xd')](_0xa55c('0x14'),_0x52a3bc[_0xa55c('0xf')])});}});}else{logger[_0xa55c('0xb')]('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xa55c('0xd')](_0xa55c('0x14'),_0x52a3bc[_0xa55c('0xf')])});}}function request(_0x31e10d){logger[_0xa55c('0x15')](_0xa55c('0x16'),JSON[_0xa55c('0x17')](_0x31e10d));return rp(_[_0xa55c('0x6')](_0x31e10d,{'method':_0xa55c('0x18'),'headers':headers,'json':!![]}));}function getAuth(_0x4cee3c){var _0x3d4c9e;if(_0x4cee3c[_0xa55c('0x19')]===_0xa55c('0x1a')){_0x3d4c9e=util[_0xa55c('0xd')](_0xa55c('0x1b'),_0x4cee3c[_0xa55c('0x1c')],_0x4cee3c['password']);}else if(_0x4cee3c['authType']===_0xa55c('0x1d')){_0x3d4c9e=util[_0xa55c('0xd')](_0xa55c('0x1e'),_0x4cee3c['username'],_0x4cee3c[_0xa55c('0x1d')]);}return util[_0xa55c('0xd')]('Basic\x20%s',new Buffer(_0x3d4c9e)[_0xa55c('0x1f')](_0xa55c('0x20')));}function getEndUser(_0x940f28,_0x1965f1,_0x234372){logger['info'](_0xa55c('0x21'),_0x234372);return request({'uri':util['format']('%s/customers/search',_0x940f28['remoteUri']),'qs':{'phone':_0x234372}})[_0xa55c('0x10')](function(_0x54b038){if(_0x54b038[_0xa55c('0x11')]){logger[_0xa55c('0xb')](_0xa55c('0x22'));return _0x54b038[_0xa55c('0x23')][_0xa55c('0x24')][0x0];}else{logger[_0xa55c('0xb')](_0xa55c('0x25'));return request({'uri':util[_0xa55c('0xd')](_0xa55c('0x26'),_0x940f28[_0xa55c('0xf')]),'method':_0xa55c('0x27'),'body':{'first_name':_0x1965f1,'title':_0x1965f1,'phone_numbers':[{'type':'work','value':_0x234372}]}});}});}function getTags(_0x430d55,_0x28814f){var _0x1c9f6b=[];if(_0x430d55&&_0x430d55[_0xa55c('0x28')]>0x0){_0x1c9f6b=_['map'](_0x430d55,_0x28814f);}return _0x1c9f6b;}function getCustomFields(_0x1377b0,_0x22f6b6){var _0x1b8388=[];var _0x201941={'custom_fields':{}};if(_0x1377b0[_0xa55c('0x28')]>0x0){_[_0xa55c('0x29')](_0x1377b0,function(_0x52d37f){if(_[_0xa55c('0x2a')](['string',_0xa55c('0x2b')],_0x52d37f[_0xa55c('0x2c')])&&_0x52d37f[_0xa55c('0x2d')]&&!_0x52d37f[_0xa55c('0x2e')]){_0x201941[_0x52d37f['nameField'][_0xa55c('0x2f')]()]=_0x52d37f[_0xa55c('0x30')][_0xa55c('0x1f')]();}else if(_[_0xa55c('0x2a')]([_0xa55c('0x31'),_0xa55c('0x2b')],_0x52d37f[_0xa55c('0x2c')])&&_0x52d37f[_0xa55c('0x32')]&&_0x52d37f[_0xa55c('0x2e')]){_0x201941[_0xa55c('0x33')][_0x52d37f[_0xa55c('0x32')]]=_0x52d37f['content']['toString']();}else if(_0x52d37f[_0xa55c('0x2c')]===_0xa55c('0x34')&&_0x52d37f['variableName']&&_0x52d37f[_0xa55c('0x32')]&&_0x52d37f[_0xa55c('0x2e')]){_0x22f6b6[_0x52d37f[_0xa55c('0x35')]]&&(_0x201941[_0xa55c('0x33')][_0x52d37f[_0xa55c('0x32')]]=_0x22f6b6[_0x52d37f[_0xa55c('0x35')]][_0xa55c('0x1f')]());}else if(_0x52d37f[_0xa55c('0x2c')]===_0xa55c('0x36')&&_0x52d37f['Variable']&&_0x52d37f['Variable']['name']&&_0x52d37f[_0xa55c('0x32')]&&_0x52d37f[_0xa55c('0x2e')]){_0x22f6b6[_0x52d37f[_0xa55c('0x37')]['name'][_0xa55c('0x2f')]()]&&(_0x201941['custom_fields'][_0x52d37f[_0xa55c('0x32')]]=_0x22f6b6[_0x52d37f['Variable'][_0xa55c('0x38')][_0xa55c('0x2f')]()][_0xa55c('0x1f')]());}});}if(_0x201941['priority']){_0x201941[_0xa55c('0x39')]=Number(_0x201941[_0xa55c('0x39')]);}return _0x201941;}function getTicket(_0x47e93c,_0x6f9c4c,_0x194e78,_0x4d9083,_0x529ff8){logger[_0xa55c('0xb')]('Creating\x20new\x20ticket...');var _0x1e75dc=_[_0xa55c('0x3a')]({'subject':intUtil['getString'](_0x4d9083['Subjects'],_0x529ff8,'\x20'),'type':'phone','status':'new','labels':[_0xa55c('0x3b'),_0xa55c('0x3c'),_0xa55c('0x3d')][_0xa55c('0x3e')](getTags(_0x4d9083[_0xa55c('0x3f')],'name')),'description':intUtil[_0xa55c('0x40')](_0x4d9083[_0xa55c('0x41')],_0x529ff8,'\x0a'),'_links':{'assigned_user':{'href':util[_0xa55c('0xd')](_0xa55c('0x42'),_0x6f9c4c['id']),'class':_0xa55c('0x43')}},'message':{'direction':'in','body':intUtil[_0xa55c('0x40')](_0x4d9083['Descriptions'],_0x529ff8,'\x0a')}},getCustomFields(_0x4d9083[_0xa55c('0x44')],_0x529ff8));return request({'uri':util['format']('%s/customers/%d/cases',_0x47e93c[_0xa55c('0xf')],_0x194e78['id']),'method':_0xa55c('0x27'),'body':_0x1e75dc});}exports['queue']=function(_0x2bd98b,_0x508bd3,_0x5f25f7,_0x2f8449,_0x3fea03,_0x1630ac){var _0x540337,_0x1b2708;_0x1630ac[_0xa55c('0xf')]=intUtil['stripTrailingSlash'](_0x1630ac[_0xa55c('0xf')]);_0x1630ac['serverUrl']=intUtil[_0xa55c('0x45')](_0x1630ac[_0xa55c('0x46')]);if(_0x3fea03&&_0x3fea03['monitor_format']){logger[_0xa55c('0xb')](_0xa55c('0x47'),'Recording\x20is\x20enabled!');_0x508bd3[_0xa55c('0x48')]=util[_0xa55c('0xd')](_0xa55c('0x49'),_0x1630ac['serverUrl'],_0x508bd3[_0xa55c('0x4a')],md5(_0x508bd3['uniqueid']));}else{_0x508bd3[_0xa55c('0x48')]='';}headers[_0xa55c('0x4b')]=getAuth(_0x1630ac);return getUser(_0x1630ac,_0x2f8449[_0xa55c('0x4c')])['then'](function(_0x41eab1){_0x540337=_0x41eab1;logger[_0xa55c('0xb')]('The\x20User\x20ID\x20is:',_0x540337['id']);return getEndUser(_0x1630ac,_0x508bd3[_0xa55c('0x4d')],_0x508bd3[_0xa55c('0x4e')]);})['then'](function(_0x11ff1d){_0x1b2708=_0x11ff1d;logger[_0xa55c('0xb')]('The\x20Enduser\x20ID\x20is:',_0x1b2708['id']);return getTicket(_0x1630ac,_0x540337,_0x1b2708,_0x5f25f7,_0x508bd3);})[_0xa55c('0x10')](function(_0x81cee8){if(_0x81cee8){logger[_0xa55c('0xb')](_0xa55c('0x4f'));logger['info'](_0xa55c('0x50'),_0x81cee8['id']);switch(_0x1630ac['type']){case _0xa55c('0x51'):logger[_0xa55c('0xb')](_0xa55c('0x47'),'Displaying\x20ticket\x20to\x20agent...');emit(util[_0xa55c('0xd')](_0xa55c('0x52'),_0x2f8449['name']),_0xa55c('0x53'),{'recordId':_0x81cee8['id']});break;case _0xa55c('0x54'):logger[_0xa55c('0xb')](_0xa55c('0x47'),_0xa55c('0x55'));emit(util[_0xa55c('0xd')](_0xa55c('0x52'),_0x2f8449[_0xa55c('0x38')]),_0xa55c('0x56'),{'uri':util[_0xa55c('0xd')]('https://xcally.desk.com/web/agent/case/%d',_0x81cee8['id'])});break;default:logger[_0xa55c('0x57')](_0xa55c('0x47'),_0xa55c('0x58'));}}})['catch'](function(_0x4c3095){console[_0xa55c('0x57')](_0x4c3095);logger['error'](_0xa55c('0x47'),JSON['stringify'](_0x4c3095));});};exports[_0xa55c('0x59')]=function(_0x228df4,_0x181802,_0x3f9313,_0x2ecf79,_0x5b1cf3,_0x44b7c1,_0x4607ca){var _0x4b85cc,_0x3929a6;_0x44b7c1[_0xa55c('0xf')]=intUtil[_0xa55c('0x45')](_0x44b7c1[_0xa55c('0xf')]);_0x44b7c1['serverUrl']=intUtil['stripTrailingSlash'](_0x44b7c1[_0xa55c('0x46')]);if(_0x4607ca&&_0x4607ca[_0xa55c('0x5a')]&&_0x4607ca[_0xa55c('0x5a')]!==_0xa55c('0x5b')){logger['info'](_0xa55c('0x5c'),'Recording\x20is\x20enabled!');_0x181802[_0xa55c('0x48')]=util[_0xa55c('0xd')](_0xa55c('0x49'),_0x44b7c1[_0xa55c('0x46')],_0x181802[_0xa55c('0x4a')],md5(_0x181802['uniqueid']));}headers[_0xa55c('0x4b')]=getAuth(_0x44b7c1);return getUser(_0x44b7c1,_0x2ecf79['email'])[_0xa55c('0x10')](function(_0x157afe){_0x4b85cc=_0x157afe;logger[_0xa55c('0xb')](_0xa55c('0x5d'),_0x4b85cc['id']);return getEndUser(_0x44b7c1,_0x181802[_0xa55c('0x5e')],_0x181802[_0xa55c('0x5f')]);})[_0xa55c('0x10')](function(_0x53e2be){_0x3929a6=_0x53e2be;logger[_0xa55c('0xb')](_0xa55c('0x60'),_0x3929a6['id']);return getTicket(_0x44b7c1,_0x4b85cc,_0x3929a6,_0x3f9313,_0x181802);})[_0xa55c('0x10')](function(_0x23a30e){if(_0x23a30e){logger[_0xa55c('0xb')]('Ticket\x20created!');logger[_0xa55c('0xb')](_0xa55c('0x50'),_0x23a30e['id']);switch(_0x44b7c1[_0xa55c('0x2c')]){case _0xa55c('0x51'):logger[_0xa55c('0xb')]('[QUEUE]',_0xa55c('0x61'));emit(util[_0xa55c('0xd')](_0xa55c('0x52'),_0x2ecf79[_0xa55c('0x38')]),_0xa55c('0x53'),{'recordId':_0x23a30e['id']});break;case'newTab':logger[_0xa55c('0xb')]('[QUEUE]',_0xa55c('0x55'));emit(util['format'](_0xa55c('0x52'),_0x2ecf79['name']),_0xa55c('0x56'),{'uri':util[_0xa55c('0xd')](_0xa55c('0x62'),_0x44b7c1[_0xa55c('0xf')],_0x23a30e['id'])});break;default:logger[_0xa55c('0x57')](_0xa55c('0x5c'),_0xa55c('0x58'));}}})[_0xa55c('0x63')](function(_0x14b515){logger[_0xa55c('0x57')]('[OUTBOUND]',JSON[_0xa55c('0x17')](_0x14b515));});};exports[_0xa55c('0x64')]=function(_0x4ef914,_0x18b928,_0x2b8b88,_0x3e3b4b,_0x9fe234,_0x1b8b06){var _0xa38271,_0x3cef1f;_0x1b8b06[_0xa55c('0xf')]=intUtil['stripTrailingSlash'](_0x1b8b06[_0xa55c('0xf')]);_0x1b8b06[_0xa55c('0x46')]=intUtil[_0xa55c('0x45')](_0x1b8b06[_0xa55c('0x46')]);if(_0x9fe234&&_0x9fe234[_0xa55c('0x65')]){logger[_0xa55c('0xb')]('['+_0x18b928[_0xa55c('0x66')][_0xa55c('0x67')]()+']',_0xa55c('0x68'));_0x18b928['recordingURL']=util[_0xa55c('0xd')](_0xa55c('0x49'),_0x1b8b06[_0xa55c('0x46')],_0x18b928[_0xa55c('0x4a')],md5(_0x18b928[_0xa55c('0x4a')]));}else{_0x18b928[_0xa55c('0x48')]='';}headers[_0xa55c('0x4b')]=getAuth(_0x1b8b06);return getUser(_0x1b8b06)[_0xa55c('0x10')](function(_0x2e4cf7){_0xa38271=_0x2e4cf7;logger[_0xa55c('0xb')](_0xa55c('0x5d'),_0xa38271['id']);return getEndUser(_0x1b8b06,_0x18b928['calleridname'],_0x18b928[_0xa55c('0x4e')]);})['then'](function(_0x1228a4){_0x3cef1f=_0x1228a4;logger[_0xa55c('0xb')](_0xa55c('0x60'),_0x3cef1f['id']);return getTicket(_0x1b8b06,_0xa38271,_0x3cef1f,_0x2b8b88,_0x18b928);})['then'](function(_0x4d9722){if(_0x4d9722){logger[_0xa55c('0xb')](_0xa55c('0x4f'));logger[_0xa55c('0xb')](_0xa55c('0x50'),_0x4d9722['id']);}})['catch'](function(_0x149cb9){logger[_0xa55c('0x57')]('['+_0x18b928[_0xa55c('0x66')][_0xa55c('0x67')]()+']',JSON[_0xa55c('0x17')](_0x149cb9));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/dynamics365.js b/server/services/ami/trigger/integration/dynamics365.js index 3ced81b..b8bf6d1 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 _0x2f38=['incident','incidents','assign','Subjects','getString','/contacts(','Fields','ticketType','phonecall','phonecalls','Descriptions','callDirection','queue','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','emit','stripTrailingSlash','serverUrl','unmanaged','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:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','name','inspect','bluebird','util','./util','md5','ioredis','../../../../config/logger','dynamics365','redis','localhost','socket.io-emitter','POST','clientId','remoteUri','username','password','then','access_token','catch','error','toUpperCase','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','value','isNil','validateEmail','email','length','internalemailaddress','info',']\x20Agent\x20found\x20','systemuserid','userId','userEmail','toLowerCase','outbound','destcalleridnum','calleridnum','contacts','/systemusers(','headers','odata-entityid','substring','lastIndexOf','message','enduserId','contactid',']\x20Enduser\x20created!',']\x20Enduser\x20Created!','forEach','includes','picklist','customField','idField','indexOf','content'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x2f38,0x1a7));var _0x82f3=function(_0x5d93f6,_0x4fb100){_0x5d93f6=_0x5d93f6-0x0;var _0x56fbee=_0x2f38[_0x5d93f6];return _0x56fbee;};'use strict';var _=require('lodash');var BPromise=require(_0x82f3('0x0'));var rp=require('request-promise');var util=require(_0x82f3('0x1'));var intUtil=require(_0x82f3('0x2'));var md5=require(_0x82f3('0x3'));var Redis=require(_0x82f3('0x4'));var logger=require(_0x82f3('0x5'))(_0x82f3('0x6'));var config=require('../../../../config/environment');config[_0x82f3('0x7')]=_['defaults'](config['redis'],{'host':_0x82f3('0x8'),'port':0x18eb});var io=require(_0x82f3('0x9'))(new Redis(config[_0x82f3('0x7')]));function getAuthToken(_0x2c69d2,_0x659a85,_0x427ef6){var _0x45dc0b={'method':_0x82f3('0xa'),'uri':_0x659a85,'form':{'client_id':_0x2c69d2[_0x82f3('0xb')],'resource':_0x2c69d2[_0x82f3('0xc')],'username':_0x2c69d2[_0x82f3('0xd')],'password':_0x2c69d2[_0x82f3('0xe')],'grant_type':_0x82f3('0xe'),'client_secret':_0x2c69d2['clientSecret']},'json':!![]};return rp(_0x45dc0b)[_0x82f3('0xf')](function(_0x1219d7){return _0x1219d7[_0x82f3('0x10')];})[_0x82f3('0x11')](function(_0x37c286){logger[_0x82f3('0x12')]('['+[_0x427ef6[_0x82f3('0x13')]()]+']\x20Wrong\x20credentials!');return _0x37c286['message'];});}function getUser(_0x19f218,_0x1b8e30,_0x5a86e5,_0x18d4b5,_0x2cca50,_0x3d34b2){return new BPromise(function(_0xf7faa1,_0x385aca){return getAuthToken(_0x1b8e30,_0x18d4b5,_0x3d34b2)[_0x82f3('0xf')](function(_0x4ad50f){var _0x2621ae={'method':_0x82f3('0x14'),'uri':_0x2cca50+_0x82f3('0x15'),'headers':{'Authorization':_0x82f3('0x16')+_0x4ad50f,'OData-Version':_0x82f3('0x17')},'json':!![]};return rp(_0x2621ae);})[_0x82f3('0xf')](function(_0x4ad7c3){var _0x588386=_0x4ad7c3[_0x82f3('0x18')];var _0x1cbb52=![];var _0x15c508=null;if(!_[_0x82f3('0x19')](_0x5a86e5)){if(intUtil[_0x82f3('0x1a')](_0x5a86e5[_0x82f3('0x1b')])){_0x19f218['userEmail']=_0x5a86e5['email'];for(_0x15c508=0x0;_0x15c508<_0x588386[_0x82f3('0x1c')];_0x15c508++){if(_0x588386[_0x15c508][_0x82f3('0x1d')]===_0x5a86e5['email']&&!_0x588386[_0x15c508]['isdisabled']){_0x1cbb52=!![];logger[_0x82f3('0x1e')]('['+[_0x3d34b2[_0x82f3('0x13')]()]+_0x82f3('0x1f')+_0x588386[_0x15c508][_0x82f3('0x20')]+'!');_0x19f218[_0x82f3('0x21')]=_0x588386[_0x15c508][_0x82f3('0x20')];}}}}if(!_0x1cbb52){logger[_0x82f3('0x1e')]('['+[_0x3d34b2[_0x82f3('0x13')]()]+']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');_0x19f218[_0x82f3('0x22')]=_0x1b8e30[_0x82f3('0xd')];for(_0x15c508=0x0;_0x15c508<_0x588386['length'];_0x15c508++){if(_0x588386[_0x15c508]['internalemailaddress']===_0x1b8e30[_0x82f3('0xd')]){_0x19f218['userId']=_0x588386[_0x15c508][_0x82f3('0x20')];}}}_0xf7faa1(_0x19f218);})[_0x82f3('0x11')](function(_0x26aa47){_0x385aca(_0x26aa47['message']);});});}function createEndUser(_0x402bff,_0xcd0d7,_0xe66683,_0x590d4b,_0x3021d7,_0x48b7d3){return new BPromise(function(_0x405f1c,_0x3c8980){return getAuthToken(_0xcd0d7,_0xe66683,_0x48b7d3)[_0x82f3('0xf')](function(_0x4fe4ca){var _0x179ab2=_0x48b7d3[_0x82f3('0x23')]()===_0x82f3('0x24')?_0x3021d7[_0x82f3('0x25')]:_0x3021d7[_0x82f3('0x26')];var _0x11141f={'method':_0x82f3('0xa'),'uri':_0x590d4b+_0x82f3('0x27'),'body':{'telephone1':_0x179ab2,'fullname':_0x179ab2,'firstname':_0x179ab2,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x82f3('0x28')+_0x402bff[_0x82f3('0x21')]+')'},'headers':{'Authorization':_0x82f3('0x16')+_0x4fe4ca,'OData-Version':_0x82f3('0x17')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x11141f);})[_0x82f3('0xf')](function(_0x1b0f43){var _0x398b36=_0x1b0f43[_0x82f3('0x29')][_0x82f3('0x2a')];var _0x2d2ae3=_0x398b36[_0x82f3('0x2b')](_0x398b36['lastIndexOf']('(')+0x1,_0x398b36[_0x82f3('0x2c')](')'));_0x402bff['enduserId']=_0x2d2ae3;_0x405f1c(_0x402bff);})[_0x82f3('0x11')](function(_0x33e188){_0x3c8980(_0x33e188[_0x82f3('0x2d')]);});});}function getEndUser(_0x211544,_0xd50c86,_0x5210bd,_0x1d4d29,_0x3e082a,_0xd51103){return new BPromise(function(_0xe7046f,_0x1eaa12){return getAuthToken(_0xd50c86,_0x5210bd,_0xd51103)['then'](function(_0x14d7f1){var _0x56b683={'method':_0x82f3('0x14'),'uri':_0x1d4d29+'contacts?$select=telephone1','headers':{'Authorization':_0x82f3('0x16')+_0x14d7f1,'If-None-Match':null,'OData-Version':_0x82f3('0x17')},'json':!![]};return rp(_0x56b683);})[_0x82f3('0xf')](function(_0x561239){var _0x503c77=null;if(_0x561239){var _0x517862=_0x561239[_0x82f3('0x18')];var _0x212425=![];for(_0x503c77=0x0;_0x503c77<_0x517862[_0x82f3('0x1c')];_0x503c77++){var _0x39403a=_0xd51103[_0x82f3('0x23')]()===_0x82f3('0x24')?_0x3e082a[_0x82f3('0x25')]:_0x3e082a[_0x82f3('0x26')];if(_0x517862[_0x503c77]['telephone1']===_0x39403a){_0x212425=!![];_0x211544[_0x82f3('0x2e')]=_0x517862[_0x503c77][_0x82f3('0x2f')];}}if(_0x212425){_0xe7046f(_0x211544);}else{return createEndUser(_0x211544,_0xd50c86,_0x5210bd,_0x1d4d29,_0x3e082a,_0xd51103)[_0x82f3('0xf')](function(_0x5a9e24){logger[_0x82f3('0x1e')]('['+[_0xd51103[_0x82f3('0x13')]()]+_0x82f3('0x30'),_0x5a9e24[_0x82f3('0x2e')]);_0xe7046f(_0x5a9e24);});}}else{return createEndUser(_0x211544,_0xd50c86,_0x5210bd,_0x1d4d29,_0x3e082a,_0xd51103)['then'](function(_0x187653){logger[_0x82f3('0x1e')]('['+[_0xd51103['toUpperCase']()]+_0x82f3('0x31'),_0x187653['enduserId']);_0xe7046f(_0x187653);});}});});}function getCustomFields(_0x1035f8,_0x31c373,_0x4491a5){var _0x122dc2={};if(_0x1035f8[_0x82f3('0x1c')]>0x0){_[_0x82f3('0x32')](_0x1035f8,function(_0x19ac5b){if(_[_0x82f3('0x33')](['string',_0x82f3('0x34')],_0x19ac5b['type'])&&_0x19ac5b['nameField']&&!_0x19ac5b[_0x82f3('0x35')]){var _0x15492a=_0x19ac5b[_0x82f3('0x36')]['toLowerCase']();var _0x1e01c4=_0x15492a[_0x82f3('0x2b')](0x0,_0x15492a[_0x82f3('0x37')]('_'));var _0x114dab=_0x15492a[_0x82f3('0x2b')](_0x15492a['indexOf']('_')+0x1);if(_0x1e01c4===_0x4491a5){_0x122dc2[_0x114dab]=_0x19ac5b[_0x82f3('0x38')];}}});}return _0x122dc2;}function getTicket(_0x3ecd87,_0x23e765,_0xbfa034,_0x1cc602,_0x20f934,_0x473adc,_0x13c87f){return new BPromise(function(_0x101b85,_0x4d1f50){var _0x30e656;return getAuthToken(_0x23e765,_0xbfa034,_0x13c87f)[_0x82f3('0xf')](function(_0x271923){if(_0x473adc['ticketType']===_0x82f3('0x39')){_0x30e656={'method':_0x82f3('0xa'),'uri':_0x1cc602+_0x82f3('0x3a'),'body':Object[_0x82f3('0x3b')]({},{'title':intUtil['getString'](_0x473adc[_0x82f3('0x3c')],_0x20f934,'\x20'),'description':intUtil[_0x82f3('0x3d')](_0x473adc['Descriptions'],_0x20f934,'\x0a'),'customerid_contact@odata.bind':_0x82f3('0x3e')+_0x3ecd87['enduserId']+')','ownerid@odata.bind':_0x82f3('0x28')+_0x3ecd87[_0x82f3('0x21')]+')','caseorigincode':'1'},getCustomFields(_0x473adc[_0x82f3('0x3f')],_0x20f934,_0x473adc[_0x82f3('0x40')])),'headers':{'Authorization':_0x82f3('0x16')+_0x271923,'OData-Version':_0x82f3('0x17')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x473adc[_0x82f3('0x40')]===_0x82f3('0x41')){_0x30e656={'method':_0x82f3('0xa'),'uri':_0x1cc602+_0x82f3('0x42'),'body':Object[_0x82f3('0x3b')]({},{'subject':intUtil[_0x82f3('0x3d')](_0x473adc[_0x82f3('0x3c')],_0x20f934,'\x20'),'phonenumber':String(_0x20f934[_0x82f3('0x26')]),'description':intUtil[_0x82f3('0x3d')](_0x473adc[_0x82f3('0x43')],_0x20f934,'\x0a'),'regardingobjectid_contact@odata.bind':'/contacts('+_0x3ecd87['enduserId']+')','ownerid@odata.bind':'/systemusers('+_0x3ecd87['userId']+')','directioncode':_0x3ecd87['callDirection']==='queue'?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':'/systemusers('+_0x3ecd87[_0x82f3('0x21')]+')','participationtypemask':_0x3ecd87[_0x82f3('0x44')]===_0x82f3('0x45')?0x2:0x1},{'partyid_contact@odata.bind':'/contacts('+_0x3ecd87[_0x82f3('0x2e')]+')','participationtypemask':_0x3ecd87[_0x82f3('0x44')]===_0x82f3('0x45')?0x1:0x2}]},getCustomFields(_0x473adc[_0x82f3('0x3f')],_0x20f934,_0x473adc[_0x82f3('0x40')])),'headers':{'Authorization':_0x82f3('0x16')+_0x271923,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x30e656);})[_0x82f3('0xf')](function(_0x127692){var _0x3a578b=_0x127692['headers'][_0x82f3('0x2a')];var _0x4545cf=_0x3a578b[_0x82f3('0x2b')](_0x3a578b['lastIndexOf']('(')+0x1,_0x3a578b[_0x82f3('0x2c')](')'));_0x3ecd87[_0x82f3('0x46')]=_0x4545cf;_0x101b85(_0x3ecd87);})[_0x82f3('0x11')](function(_0x36bb99){_0x4d1f50(_0x36bb99[_0x82f3('0x2d')]);});});}function emit(_0x52279a,_0x29b6aa,_0x30e55d,_0x8f83ac){var _0xf2231b={'uri':util[_0x82f3('0x47')](_0x82f3('0x48'),_0x52279a,_0x30e55d,_0x8f83ac)};io['to'](util[_0x82f3('0x47')](_0x82f3('0x49'),_0x29b6aa))[_0x82f3('0x4a')]('trigger:browser:url',_0xf2231b);}exports['cs']=function(_0x2549ad,_0x1557ae,_0x289d81,_0x148162,_0x51212c,_0x58e65e,_0x4751fe,_0x6e5f44){var _0x379e61={};_0x58e65e['remoteUri']=intUtil[_0x82f3('0x4b')](_0x58e65e[_0x82f3('0xc')]);_0x58e65e[_0x82f3('0x4c')]=intUtil['stripTrailingSlash'](_0x58e65e[_0x82f3('0x4c')]);_0x379e61[_0x82f3('0x44')]=_0x6e5f44==='queue'||_0x6e5f44===_0x82f3('0x4d')?_0x82f3('0x45'):_0x82f3('0x24');var _0x330c66=util[_0x82f3('0x47')]('%s/api/data/v9.0/',_0x58e65e[_0x82f3('0xc')]);var _0x44e91c=util[_0x82f3('0x47')]('https://login.microsoftonline.com/%s/oauth2/token',_0x58e65e[_0x82f3('0x4e')]);var _0x5a6722=util[_0x82f3('0x47')](_0x82f3('0x4f'),_0x58e65e['serverUrl'],_0x1557ae['uniqueid'],md5(_0x1557ae[_0x82f3('0x50')]));if(_0x51212c&&_0x51212c[_0x82f3('0x51')]){logger[_0x82f3('0x1e')](_0x82f3('0x52'),_0x82f3('0x53'));_0x1557ae[_0x82f3('0x54')]=_0x5a6722;}else if(_0x4751fe&&_0x4751fe[_0x82f3('0x55')]&&_0x4751fe[_0x82f3('0x55')]!==_0x82f3('0x56')){logger[_0x82f3('0x1e')](_0x82f3('0x57'),'Recording\x20is\x20enabled!');_0x1557ae[_0x82f3('0x54')]=_0x5a6722;}else{_0x1557ae[_0x82f3('0x54')]='';}return getUser(_0x379e61,_0x58e65e,_0x148162,_0x44e91c,_0x330c66,_0x6e5f44)[_0x82f3('0xf')](function(_0x5a4b8c){logger['info']('['+_0x6e5f44[_0x82f3('0x13')]()+_0x82f3('0x58'),_0x5a4b8c[_0x82f3('0x21')]);logger[_0x82f3('0x1e')]('['+_0x6e5f44['toUpperCase']()+_0x82f3('0x59'),_0x5a4b8c[_0x82f3('0x22')]);return getEndUser(_0x5a4b8c,_0x58e65e,_0x44e91c,_0x330c66,_0x1557ae,_0x6e5f44);})['then'](function(_0x241f9b){logger['info']('['+_0x6e5f44['toUpperCase']()+_0x82f3('0x5a'),_0x241f9b[_0x82f3('0x2e')]);logger['info']('['+_0x6e5f44['toUpperCase']()+']\x20The\x20Enduser\x20phone\x20is:',_0x1557ae[_0x82f3('0x26')]);return getTicket(_0x241f9b,_0x58e65e,_0x44e91c,_0x330c66,_0x1557ae,_0x289d81,_0x6e5f44);})[_0x82f3('0xf')](function(_0xe12c00){logger[_0x82f3('0x1e')](util['format']('['+_0x6e5f44[_0x82f3('0x13')]()+_0x82f3('0x5b'),_0x289d81[_0x82f3('0x40')],_0xe12c00['ticketId']));logger[_0x82f3('0x1e')](util[_0x82f3('0x47')]('['+_0x6e5f44[_0x82f3('0x13')]()+_0x82f3('0x5c'),_0x6e5f44));if(_0x6e5f44!==_0x82f3('0x4d')){logger[_0x82f3('0x1e')]('['+_0x6e5f44[_0x82f3('0x13')]()+']',_0x82f3('0x5d'));emit(_0x58e65e['remoteUri'],_0x148162[_0x82f3('0x5e')],_0x289d81[_0x82f3('0x40')],_0xe12c00[_0x82f3('0x46')]);}})[_0x82f3('0x11')](function(_0x24c248){logger[_0x82f3('0x12')]('['+_0x6e5f44[_0x82f3('0x13')]()+']\x20Error\x20running\x20Dynamics365\x20integration',util[_0x82f3('0x5f')](_0x24c248,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xe7c2=['dynamics365','defaults','localhost','socket.io-emitter','redis','POST','remoteUri','username','password','clientSecret','then','access_token','catch','error','toUpperCase',']\x20Wrong\x20credentials!','message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','value','isNil','validateEmail','email','length','internalemailaddress','isdisabled','info','systemuserid','userId','outbound','destcalleridnum','contacts','/systemusers(','headers','lastIndexOf','enduserId','contacts?$select=telephone1','calleridnum','telephone1','contactid',']\x20Enduser\x20created!','forEach','includes','string','picklist','type','nameField','customField','toLowerCase','indexOf','substring','content','ticketType','incident','incidents','assign','getString','Subjects','Descriptions','Fields','phonecall','phonecalls','queue','callDirection','/contacts(','odata-entityid','ticketId','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','emit','trigger:browser:url','serverUrl','stripTrailingSlash','unmanaged','format','%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]','recordingURL','recordingFormat','[OUTBOUND]','Recording\x20is\x20enabled!',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:','userEmail',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20Dynamics365\x20integration','inspect','lodash','bluebird','request-promise','util','./util','md5','ioredis','../../../../config/logger'];(function(_0x355130,_0x156192){var _0x456d3b=function(_0x2ca132){while(--_0x2ca132){_0x355130['push'](_0x355130['shift']());}};_0x456d3b(++_0x156192);}(_0xe7c2,0xc8));var _0x2e7c=function(_0x19fdd3,_0x3f9adb){_0x19fdd3=_0x19fdd3-0x0;var _0x306a93=_0xe7c2[_0x19fdd3];return _0x306a93;};'use strict';var _=require(_0x2e7c('0x0'));var BPromise=require(_0x2e7c('0x1'));var rp=require(_0x2e7c('0x2'));var util=require(_0x2e7c('0x3'));var intUtil=require(_0x2e7c('0x4'));var md5=require(_0x2e7c('0x5'));var Redis=require(_0x2e7c('0x6'));var logger=require(_0x2e7c('0x7'))(_0x2e7c('0x8'));var config=require('../../../../config/environment');config['redis']=_[_0x2e7c('0x9')](config['redis'],{'host':_0x2e7c('0xa'),'port':0x18eb});var io=require(_0x2e7c('0xb'))(new Redis(config[_0x2e7c('0xc')]));function getAuthToken(_0x5bbaaa,_0x2bbbbc,_0x205aec){var _0x4f894e={'method':_0x2e7c('0xd'),'uri':_0x2bbbbc,'form':{'client_id':_0x5bbaaa['clientId'],'resource':_0x5bbaaa[_0x2e7c('0xe')],'username':_0x5bbaaa[_0x2e7c('0xf')],'password':_0x5bbaaa[_0x2e7c('0x10')],'grant_type':'password','client_secret':_0x5bbaaa[_0x2e7c('0x11')]},'json':!![]};return rp(_0x4f894e)[_0x2e7c('0x12')](function(_0x54fb30){return _0x54fb30[_0x2e7c('0x13')];})[_0x2e7c('0x14')](function(_0x4c7b22){logger[_0x2e7c('0x15')]('['+[_0x205aec[_0x2e7c('0x16')]()]+_0x2e7c('0x17'));return _0x4c7b22[_0x2e7c('0x18')];});}function getUser(_0xecbdf8,_0x15a425,_0x3355cc,_0x292afa,_0x2e6af0,_0x21f8bc){return new BPromise(function(_0x5bfa56,_0x2678a6){return getAuthToken(_0x15a425,_0x292afa,_0x21f8bc)[_0x2e7c('0x12')](function(_0x558690){var _0x179580={'method':_0x2e7c('0x19'),'uri':_0x2e6af0+_0x2e7c('0x1a'),'headers':{'Authorization':_0x2e7c('0x1b')+_0x558690,'OData-Version':_0x2e7c('0x1c')},'json':!![]};return rp(_0x179580);})[_0x2e7c('0x12')](function(_0x5e7d70){var _0x5b9f5c=_0x5e7d70[_0x2e7c('0x1d')];var _0x336ffc=![];var _0x22cac0=null;if(!_[_0x2e7c('0x1e')](_0x3355cc)){if(intUtil[_0x2e7c('0x1f')](_0x3355cc[_0x2e7c('0x20')])){_0xecbdf8['userEmail']=_0x3355cc[_0x2e7c('0x20')];for(_0x22cac0=0x0;_0x22cac0<_0x5b9f5c[_0x2e7c('0x21')];_0x22cac0++){if(_0x5b9f5c[_0x22cac0][_0x2e7c('0x22')]===_0x3355cc[_0x2e7c('0x20')]&&!_0x5b9f5c[_0x22cac0][_0x2e7c('0x23')]){_0x336ffc=!![];logger[_0x2e7c('0x24')]('['+[_0x21f8bc[_0x2e7c('0x16')]()]+']\x20Agent\x20found\x20'+_0x5b9f5c[_0x22cac0][_0x2e7c('0x25')]+'!');_0xecbdf8['userId']=_0x5b9f5c[_0x22cac0]['systemuserid'];}}}}if(!_0x336ffc){logger[_0x2e7c('0x24')]('['+[_0x21f8bc[_0x2e7c('0x16')]()]+']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');_0xecbdf8['userEmail']=_0x15a425['username'];for(_0x22cac0=0x0;_0x22cac0<_0x5b9f5c[_0x2e7c('0x21')];_0x22cac0++){if(_0x5b9f5c[_0x22cac0][_0x2e7c('0x22')]===_0x15a425[_0x2e7c('0xf')]){_0xecbdf8[_0x2e7c('0x26')]=_0x5b9f5c[_0x22cac0][_0x2e7c('0x25')];}}}_0x5bfa56(_0xecbdf8);})[_0x2e7c('0x14')](function(_0x5be640){_0x2678a6(_0x5be640[_0x2e7c('0x18')]);});});}function createEndUser(_0x175a11,_0x2c5969,_0x1a4156,_0x23e94e,_0x1ae4ba,_0x442eef){return new BPromise(function(_0x5299d,_0x7d0761){return getAuthToken(_0x2c5969,_0x1a4156,_0x442eef)[_0x2e7c('0x12')](function(_0x54889f){var _0x3658b5=_0x442eef['toLowerCase']()===_0x2e7c('0x27')?_0x1ae4ba[_0x2e7c('0x28')]:_0x1ae4ba['calleridnum'];var _0x5ba9d7={'method':'POST','uri':_0x23e94e+_0x2e7c('0x29'),'body':{'telephone1':_0x3658b5,'fullname':_0x3658b5,'firstname':_0x3658b5,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x2e7c('0x2a')+_0x175a11['userId']+')'},'headers':{'Authorization':_0x2e7c('0x1b')+_0x54889f,'OData-Version':_0x2e7c('0x1c')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x5ba9d7);})[_0x2e7c('0x12')](function(_0x2908f7){var _0x3526f7=_0x2908f7[_0x2e7c('0x2b')]['odata-entityid'];var _0x1377c7=_0x3526f7['substring'](_0x3526f7[_0x2e7c('0x2c')]('(')+0x1,_0x3526f7[_0x2e7c('0x2c')](')'));_0x175a11[_0x2e7c('0x2d')]=_0x1377c7;_0x5299d(_0x175a11);})['catch'](function(_0x1f8ac4){_0x7d0761(_0x1f8ac4[_0x2e7c('0x18')]);});});}function getEndUser(_0x3c3235,_0x1f190e,_0x31cb89,_0x5d8bc8,_0x2d7434,_0x58a0d4){return new BPromise(function(_0x59be20,_0x37f312){return getAuthToken(_0x1f190e,_0x31cb89,_0x58a0d4)['then'](function(_0xc23697){var _0x3f1068={'method':_0x2e7c('0x19'),'uri':_0x5d8bc8+_0x2e7c('0x2e'),'headers':{'Authorization':_0x2e7c('0x1b')+_0xc23697,'If-None-Match':null,'OData-Version':_0x2e7c('0x1c')},'json':!![]};return rp(_0x3f1068);})['then'](function(_0x33832e){var _0x3c9a13=null;if(_0x33832e){var _0x476408=_0x33832e[_0x2e7c('0x1d')];var _0x578d0c=![];for(_0x3c9a13=0x0;_0x3c9a13<_0x476408[_0x2e7c('0x21')];_0x3c9a13++){var _0x2f737a=_0x58a0d4['toLowerCase']()===_0x2e7c('0x27')?_0x2d7434[_0x2e7c('0x28')]:_0x2d7434[_0x2e7c('0x2f')];if(_0x476408[_0x3c9a13][_0x2e7c('0x30')]===_0x2f737a){_0x578d0c=!![];_0x3c3235[_0x2e7c('0x2d')]=_0x476408[_0x3c9a13][_0x2e7c('0x31')];}}if(_0x578d0c){_0x59be20(_0x3c3235);}else{return createEndUser(_0x3c3235,_0x1f190e,_0x31cb89,_0x5d8bc8,_0x2d7434,_0x58a0d4)[_0x2e7c('0x12')](function(_0x137851){logger[_0x2e7c('0x24')]('['+[_0x58a0d4[_0x2e7c('0x16')]()]+_0x2e7c('0x32'),_0x137851[_0x2e7c('0x2d')]);_0x59be20(_0x137851);});}}else{return createEndUser(_0x3c3235,_0x1f190e,_0x31cb89,_0x5d8bc8,_0x2d7434,_0x58a0d4)[_0x2e7c('0x12')](function(_0x301e0d){logger['info']('['+[_0x58a0d4[_0x2e7c('0x16')]()]+']\x20Enduser\x20Created!',_0x301e0d[_0x2e7c('0x2d')]);_0x59be20(_0x301e0d);});}});});}function getCustomFields(_0x43dba9,_0x1fa9ae,_0x15eb27){var _0x9fa79e={};if(_0x43dba9[_0x2e7c('0x21')]>0x0){_[_0x2e7c('0x33')](_0x43dba9,function(_0x397648){if(_[_0x2e7c('0x34')]([_0x2e7c('0x35'),_0x2e7c('0x36')],_0x397648[_0x2e7c('0x37')])&&_0x397648[_0x2e7c('0x38')]&&!_0x397648[_0x2e7c('0x39')]){var _0x5a594a=_0x397648['idField'][_0x2e7c('0x3a')]();var _0x1342fe=_0x5a594a['substring'](0x0,_0x5a594a[_0x2e7c('0x3b')]('_'));var _0x41fd52=_0x5a594a[_0x2e7c('0x3c')](_0x5a594a[_0x2e7c('0x3b')]('_')+0x1);if(_0x1342fe===_0x15eb27){_0x9fa79e[_0x41fd52]=_0x397648[_0x2e7c('0x3d')];}}});}return _0x9fa79e;}function getTicket(_0xe477b2,_0x4301dd,_0x146ed7,_0x2524c1,_0x4a810f,_0x9f7fbc,_0x4d35cb){return new BPromise(function(_0x485f14,_0x4c7a5e){var _0x4f03a1;return getAuthToken(_0x4301dd,_0x146ed7,_0x4d35cb)[_0x2e7c('0x12')](function(_0x316cee){if(_0x9f7fbc[_0x2e7c('0x3e')]===_0x2e7c('0x3f')){_0x4f03a1={'method':_0x2e7c('0xd'),'uri':_0x2524c1+_0x2e7c('0x40'),'body':Object[_0x2e7c('0x41')]({},{'title':intUtil[_0x2e7c('0x42')](_0x9f7fbc[_0x2e7c('0x43')],_0x4a810f,'\x20'),'description':intUtil[_0x2e7c('0x42')](_0x9f7fbc[_0x2e7c('0x44')],_0x4a810f,'\x0a'),'customerid_contact@odata.bind':'/contacts('+_0xe477b2[_0x2e7c('0x2d')]+')','ownerid@odata.bind':'/systemusers('+_0xe477b2[_0x2e7c('0x26')]+')','caseorigincode':'1'},getCustomFields(_0x9f7fbc[_0x2e7c('0x45')],_0x4a810f,_0x9f7fbc['ticketType'])),'headers':{'Authorization':'Bearer\x20'+_0x316cee,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}if(_0x9f7fbc[_0x2e7c('0x3e')]===_0x2e7c('0x46')){_0x4f03a1={'method':'POST','uri':_0x2524c1+_0x2e7c('0x47'),'body':Object[_0x2e7c('0x41')]({},{'subject':intUtil[_0x2e7c('0x42')](_0x9f7fbc[_0x2e7c('0x43')],_0x4a810f,'\x20'),'phonenumber':String(_0x4a810f['calleridnum']),'description':intUtil[_0x2e7c('0x42')](_0x9f7fbc[_0x2e7c('0x44')],_0x4a810f,'\x0a'),'regardingobjectid_contact@odata.bind':'/contacts('+_0xe477b2['enduserId']+')','ownerid@odata.bind':_0x2e7c('0x2a')+_0xe477b2[_0x2e7c('0x26')]+')','directioncode':_0xe477b2['callDirection']===_0x2e7c('0x48')?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':_0x2e7c('0x2a')+_0xe477b2[_0x2e7c('0x26')]+')','participationtypemask':_0xe477b2[_0x2e7c('0x49')]===_0x2e7c('0x48')?0x2:0x1},{'partyid_contact@odata.bind':_0x2e7c('0x4a')+_0xe477b2[_0x2e7c('0x2d')]+')','participationtypemask':_0xe477b2[_0x2e7c('0x49')]===_0x2e7c('0x48')?0x1:0x2}]},getCustomFields(_0x9f7fbc[_0x2e7c('0x45')],_0x4a810f,_0x9f7fbc[_0x2e7c('0x3e')])),'headers':{'Authorization':'Bearer\x20'+_0x316cee,'OData-Version':_0x2e7c('0x1c')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x4f03a1);})[_0x2e7c('0x12')](function(_0x2da92d){var _0x330875=_0x2da92d[_0x2e7c('0x2b')][_0x2e7c('0x4b')];var _0x135ffa=_0x330875[_0x2e7c('0x3c')](_0x330875[_0x2e7c('0x2c')]('(')+0x1,_0x330875['lastIndexOf'](')'));_0xe477b2[_0x2e7c('0x4c')]=_0x135ffa;_0x485f14(_0xe477b2);})[_0x2e7c('0x14')](function(_0x1491f7){_0x4c7a5e(_0x1491f7[_0x2e7c('0x18')]);});});}function emit(_0x6535be,_0x4a1c20,_0x47f14b,_0x4f8c1f){var _0x57ca6d={'uri':util['format'](_0x2e7c('0x4d'),_0x6535be,_0x47f14b,_0x4f8c1f)};io['to'](util['format']('user:%s',_0x4a1c20))[_0x2e7c('0x4e')](_0x2e7c('0x4f'),_0x57ca6d);}exports['cs']=function(_0x53e2e7,_0x3cbf29,_0x28b386,_0x444325,_0x234d74,_0x11087b,_0x1f2aa2,_0x2662cd){var _0x4b3435={};_0x11087b[_0x2e7c('0xe')]=intUtil['stripTrailingSlash'](_0x11087b[_0x2e7c('0xe')]);_0x11087b[_0x2e7c('0x50')]=intUtil[_0x2e7c('0x51')](_0x11087b[_0x2e7c('0x50')]);_0x4b3435['callDirection']=_0x2662cd===_0x2e7c('0x48')||_0x2662cd===_0x2e7c('0x52')?_0x2e7c('0x48'):_0x2e7c('0x27');var _0x373a9f=util[_0x2e7c('0x53')](_0x2e7c('0x54'),_0x11087b[_0x2e7c('0xe')]);var _0x44cb3e=util[_0x2e7c('0x53')](_0x2e7c('0x55'),_0x11087b[_0x2e7c('0x56')]);var _0x10ce74=util['format'](_0x2e7c('0x57'),_0x11087b[_0x2e7c('0x50')],_0x3cbf29[_0x2e7c('0x58')],md5(_0x3cbf29[_0x2e7c('0x58')]));if(_0x234d74&&_0x234d74[_0x2e7c('0x59')]){logger[_0x2e7c('0x24')](_0x2e7c('0x5a'),'Recording\x20is\x20enabled!');_0x3cbf29[_0x2e7c('0x5b')]=_0x10ce74;}else if(_0x1f2aa2&&_0x1f2aa2[_0x2e7c('0x5c')]&&_0x1f2aa2[_0x2e7c('0x5c')]!=='none'){logger[_0x2e7c('0x24')](_0x2e7c('0x5d'),_0x2e7c('0x5e'));_0x3cbf29[_0x2e7c('0x5b')]=_0x10ce74;}else{_0x3cbf29[_0x2e7c('0x5b')]='';}return getUser(_0x4b3435,_0x11087b,_0x444325,_0x44cb3e,_0x373a9f,_0x2662cd)[_0x2e7c('0x12')](function(_0x4caa0a){logger['info']('['+_0x2662cd[_0x2e7c('0x16')]()+_0x2e7c('0x5f'),_0x4caa0a[_0x2e7c('0x26')]);logger[_0x2e7c('0x24')]('['+_0x2662cd[_0x2e7c('0x16')]()+_0x2e7c('0x60'),_0x4caa0a[_0x2e7c('0x61')]);return getEndUser(_0x4caa0a,_0x11087b,_0x44cb3e,_0x373a9f,_0x3cbf29,_0x2662cd);})[_0x2e7c('0x12')](function(_0x4fd3ba){logger[_0x2e7c('0x24')]('['+_0x2662cd[_0x2e7c('0x16')]()+']\x20The\x20Enduser\x20ID\x20is:',_0x4fd3ba[_0x2e7c('0x2d')]);logger['info']('['+_0x2662cd[_0x2e7c('0x16')]()+_0x2e7c('0x62'),_0x3cbf29[_0x2e7c('0x2f')]);return getTicket(_0x4fd3ba,_0x11087b,_0x44cb3e,_0x373a9f,_0x3cbf29,_0x28b386,_0x2662cd);})['then'](function(_0x3b8509){logger[_0x2e7c('0x24')](util[_0x2e7c('0x53')]('['+_0x2662cd['toUpperCase']()+_0x2e7c('0x63'),_0x28b386[_0x2e7c('0x3e')],_0x3b8509[_0x2e7c('0x4c')]));logger[_0x2e7c('0x24')](util[_0x2e7c('0x53')]('['+_0x2662cd['toUpperCase']()+_0x2e7c('0x64'),_0x2662cd));if(_0x2662cd!==_0x2e7c('0x52')){logger['info']('['+_0x2662cd[_0x2e7c('0x16')]()+']',_0x2e7c('0x65'));emit(_0x11087b['remoteUri'],_0x444325['name'],_0x28b386[_0x2e7c('0x3e')],_0x3b8509['ticketId']);}})[_0x2e7c('0x14')](function(_0xe64209){logger[_0x2e7c('0x15')]('['+_0x2662cd[_0x2e7c('0x16')]()+_0x2e7c('0x66'),util[_0x2e7c('0x67')](_0xe64209,{'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 afa4c27..b64a15f 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 _0xdb42=['getString','
','name','Fields','custom_fields','mapValues','value','%s/api/v2/tickets','then','Ticket\x20created!','%s/api/v2/agents','remoteUri','length','find','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20found!','POST','Enduser\x20created.','Basic\x20%s','apiKey','toString','base64','debug','[HTTP]','stringify','GET','map','includes','string','picklist','type','nameField','customField','toLowerCase','idField','push','content','variable','variableName','customVariable','Variable','queue','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','catch','outbound','recordingFormat','none','[OUTBOUND]','recordingURL','destcalleridname','destcalleridnum','%s/helpdesk/tickets/%d','monitor_format','lastevent','toUpperCase','calleridname','error','request-promise','util','./util','../../../../config/environment','../../../../config/logger','freshdesk','redis','defaults','socket.io-emitter','emit','info','Creating\x20new\x20ticket...','merge','format','Caller\x20-\x20%s','calleridnum'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xdb42,0xfe));var _0x2db4=function(_0x5c3825,_0x23e911){_0x5c3825=_0x5c3825-0x0;var _0x2a4ea0=_0xdb42[_0x5c3825];return _0x2a4ea0;};'use strict';var _=require('lodash');var rp=require(_0x2db4('0x0'));var md5=require('md5');var util=require(_0x2db4('0x1'));var Redis=require('ioredis');var intUtil=require(_0x2db4('0x2'));var config=require(_0x2db4('0x3'));var logger=require(_0x2db4('0x4'))(_0x2db4('0x5'));config[_0x2db4('0x6')]=_[_0x2db4('0x7')](config[_0x2db4('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0x2db4('0x8'))(new Redis(config[_0x2db4('0x6')]));var headers={'Content-Type':'application/json','Accept':'application/json'};function emit(_0x5ffe93,_0x609552,_0x54f1a8){io['to'](_0x5ffe93)[_0x2db4('0x9')](_0x609552,_0x54f1a8);}function getTicket(_0x16d23e,_0x588976,_0x3195d7,_0x15f77d,_0x5c77c8){logger[_0x2db4('0xa')](_0x2db4('0xb'));var _0x28dd83=_[_0x2db4('0xc')]({'responder_id':_0x588976['id'],'requester_id':_0x3195d7['id'],'name':util[_0x2db4('0xd')](_0x2db4('0xe'),_0x5c77c8['calleridname']),'phone':_0x5c77c8[_0x2db4('0xf')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x2db4('0x10')](_0x15f77d['Subjects'],_0x5c77c8,'\x20'),'description':intUtil[_0x2db4('0x10')](_0x15f77d['Descriptions'],_0x5c77c8,_0x2db4('0x11')),'tags':getTags(_0x15f77d['Tags'],_0x2db4('0x12'))},getCustomFields(_0x15f77d[_0x2db4('0x13')],_0x5c77c8));_0x28dd83[_0x2db4('0x14')]=_[_0x2db4('0x15')](_['keyBy'](_0x28dd83[_0x2db4('0x14')],'id'),_0x2db4('0x16'));return request({'uri':util[_0x2db4('0xd')](_0x2db4('0x17'),_0x16d23e['remoteUri']),'method':'POST','body':_0x28dd83})[_0x2db4('0x18')](function(_0x46b147){logger[_0x2db4('0xa')](_0x2db4('0x19'));return _0x46b147;});}function getUser(_0x383552,_0x1283d6){if(intUtil['validateEmail'](_0x1283d6)){return request({'uri':util['format'](_0x2db4('0x1a'),_0x383552[_0x2db4('0x1b')]),'qs':{'email':_0x1283d6}})[_0x2db4('0x18')](function(_0x20a070){if(_0x20a070[_0x2db4('0x1c')]){logger[_0x2db4('0xa')]('Agent\x20found!');return _[_0x2db4('0x1d')](_0x20a070,function(_0x586df2){return _0x586df2['contact'][_0x2db4('0x1e')]===_0x1283d6;});}else{logger['info'](_0x2db4('0x1f'));return request({'uri':util[_0x2db4('0xd')](_0x2db4('0x20'),_0x383552[_0x2db4('0x1b')])})[_0x2db4('0x18')](function(_0x1a9995){logger[_0x2db4('0xa')]('Admin\x20account\x20selected.');return _0x1a9995;});}});}else{logger[_0x2db4('0xa')]('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x2db4('0xd')]('%s/api/v2/agents/me',_0x383552[_0x2db4('0x1b')])})[_0x2db4('0x18')](function(_0x2c3f1c){logger[_0x2db4('0xa')](_0x2db4('0x21'));return _0x2c3f1c;});}}function getEndUser(_0x13597f,_0x42e778,_0x2cd2be){logger['info'](_0x2db4('0x22'),_0x2cd2be);return request({'uri':util['format'](_0x2db4('0x23'),_0x13597f[_0x2db4('0x1b')]),'qs':{'phone':_0x2cd2be}})[_0x2db4('0x18')](function(_0x33b19b){if(_0x33b19b[_0x2db4('0x1c')]){logger[_0x2db4('0xa')](_0x2db4('0x24'));return _[_0x2db4('0x1d')](_0x33b19b,{'phone':_0x2cd2be});}else{logger[_0x2db4('0xa')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0x2db4('0xd')](_0x2db4('0x23'),_0x13597f[_0x2db4('0x1b')]),'method':_0x2db4('0x25'),'body':{'name':_0x42e778,'phone':_0x2cd2be}})[_0x2db4('0x18')](function(_0x3b297c){logger[_0x2db4('0xa')](_0x2db4('0x26'));return _0x3b297c;});}});}function getAuth(_0x10cde7){return util[_0x2db4('0xd')](_0x2db4('0x27'),new Buffer(_0x10cde7[_0x2db4('0x28')]+':X')[_0x2db4('0x29')](_0x2db4('0x2a')));}function request(_0x15bcbd){logger[_0x2db4('0x2b')](_0x2db4('0x2c'),JSON[_0x2db4('0x2d')](_0x15bcbd));return rp(_[_0x2db4('0x7')](_0x15bcbd,{'method':_0x2db4('0x2e'),'headers':headers,'json':!![]}));}function getTags(_0x4394b3,_0x2f1c38){var _0x2d3e4e=[];if(_0x4394b3&&_0x4394b3['length']>0x0){_0x2d3e4e=_[_0x2db4('0x2f')](_0x4394b3,_0x2f1c38);}return _0x2d3e4e;}function getCustomFields(_0x27f34d,_0x5d9641){var _0x2fbfba=[];var _0x4bc7a0={'custom_fields':[]};if(_0x27f34d[_0x2db4('0x1c')]>0x0){_['forEach'](_0x27f34d,function(_0x46b72c){if(_[_0x2db4('0x30')]([_0x2db4('0x31'),_0x2db4('0x32')],_0x46b72c[_0x2db4('0x33')])&&_0x46b72c[_0x2db4('0x34')]&&!_0x46b72c[_0x2db4('0x35')]){_0x4bc7a0[_0x46b72c[_0x2db4('0x34')][_0x2db4('0x36')]()]=_0x46b72c['content'][_0x2db4('0x29')]();}else if(_[_0x2db4('0x30')]([_0x2db4('0x31'),_0x2db4('0x32')],_0x46b72c[_0x2db4('0x33')])&&_0x46b72c[_0x2db4('0x37')]&&_0x46b72c[_0x2db4('0x35')]){_0x4bc7a0['custom_fields'][_0x2db4('0x38')]({'id':_0x46b72c['idField'],'value':_0x46b72c[_0x2db4('0x39')][_0x2db4('0x29')]()});}else if(_0x46b72c['type']===_0x2db4('0x3a')&&_0x46b72c[_0x2db4('0x3b')]&&_0x46b72c[_0x2db4('0x37')]&&_0x46b72c[_0x2db4('0x35')]){_0x5d9641[_0x46b72c[_0x2db4('0x3b')]]&&_0x4bc7a0[_0x2db4('0x14')][_0x2db4('0x38')]({'id':_0x46b72c['idField'],'value':_0x5d9641[_0x46b72c[_0x2db4('0x3b')]][_0x2db4('0x29')]()});}else if(_0x46b72c[_0x2db4('0x33')]===_0x2db4('0x3c')&&_0x46b72c['Variable']&&_0x46b72c[_0x2db4('0x3d')][_0x2db4('0x12')]&&_0x46b72c['idField']&&_0x46b72c[_0x2db4('0x35')]){_0x5d9641[_0x46b72c[_0x2db4('0x3d')][_0x2db4('0x12')][_0x2db4('0x36')]()]&&_0x4bc7a0[_0x2db4('0x14')]['push']({'id':_0x46b72c[_0x2db4('0x37')],'value':_0x5d9641[_0x46b72c[_0x2db4('0x3d')][_0x2db4('0x12')][_0x2db4('0x36')]()][_0x2db4('0x29')]()});}});}return _0x4bc7a0;}exports[_0x2db4('0x3e')]=function(_0x3fb953,_0x2567fd,_0x1f1cab,_0x30c3dd,_0x19df82,_0x224a50){var _0x57a8dc,_0x769b51;_0x224a50['remoteUri']=intUtil[_0x2db4('0x3f')](_0x224a50[_0x2db4('0x1b')]);_0x224a50[_0x2db4('0x40')]=intUtil[_0x2db4('0x3f')](_0x224a50[_0x2db4('0x40')]);if(_0x19df82&&_0x19df82['monitor_format']){logger['info'](_0x2db4('0x41'),_0x2db4('0x42'));_0x2567fd['recordingURL']=util[_0x2db4('0xd')](_0x2db4('0x43'),_0x224a50['serverUrl'],_0x2567fd['uniqueid'],md5(_0x2567fd[_0x2db4('0x44')]));}else{_0x2567fd['recordingURL']='';}headers[_0x2db4('0x45')]=getAuth(_0x224a50);return getUser(_0x224a50,_0x30c3dd[_0x2db4('0x1e')])['then'](function(_0x28f890){_0x57a8dc=_0x28f890;logger['info'](_0x2db4('0x46'),_0x57a8dc['id']);return getEndUser(_0x224a50,_0x2567fd['calleridname'],_0x2567fd[_0x2db4('0xf')]);})[_0x2db4('0x18')](function(_0x2dd9e5){_0x769b51=_0x2dd9e5;logger[_0x2db4('0xa')](_0x2db4('0x47'),_0x769b51['id']);return getTicket(_0x224a50,_0x57a8dc,_0x769b51,_0x1f1cab,_0x2567fd);})['then'](function(_0x14a2a4){if(_0x14a2a4&&_0x14a2a4['id']){logger['info'](_0x2db4('0x19'));logger[_0x2db4('0xa')](_0x2db4('0x48'),_0x14a2a4['id']);logger[_0x2db4('0xa')](_0x2db4('0x41'),_0x2db4('0x49'));emit(util['format'](_0x2db4('0x4a'),_0x30c3dd['name']),_0x2db4('0x4b'),{'uri':util[_0x2db4('0xd')]('%s/helpdesk/tickets/%d',_0x224a50[_0x2db4('0x1b')],_0x14a2a4['id'])});}})[_0x2db4('0x4c')](function(_0x2cab3c){logger['error'](_0x2db4('0x41'),JSON['stringify'](_0x2cab3c));});};exports[_0x2db4('0x4d')]=function(_0x14a930,_0x3ac5dd,_0x52d6c7,_0x7e57b6,_0x2b545d,_0x8d74d3,_0x12868f){var _0xa7b8f2,_0x5b9bea;_0x8d74d3[_0x2db4('0x1b')]=intUtil['stripTrailingSlash'](_0x8d74d3[_0x2db4('0x1b')]);_0x8d74d3[_0x2db4('0x40')]=intUtil[_0x2db4('0x3f')](_0x8d74d3[_0x2db4('0x40')]);if(_0x12868f&&_0x12868f['recordingFormat']&&_0x12868f[_0x2db4('0x4e')]!==_0x2db4('0x4f')){logger['info'](_0x2db4('0x50'),'Recording\x20is\x20enabled!');_0x3ac5dd[_0x2db4('0x51')]=util[_0x2db4('0xd')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x8d74d3['serverUrl'],_0x3ac5dd['uniqueid'],md5(_0x3ac5dd[_0x2db4('0x44')]));}headers['Authorization']=getAuth(_0x8d74d3);return getUser(_0x8d74d3,_0x7e57b6[_0x2db4('0x1e')])['then'](function(_0x162fa0){_0xa7b8f2=_0x162fa0;logger[_0x2db4('0xa')](_0x2db4('0x46'),_0xa7b8f2['id']);return getEndUser(_0x8d74d3,_0x3ac5dd[_0x2db4('0x52')],_0x3ac5dd[_0x2db4('0x53')]);})[_0x2db4('0x18')](function(_0x1970f7){_0x5b9bea=_0x1970f7;logger[_0x2db4('0xa')](_0x2db4('0x47'),_0x5b9bea['id']);return getTicket(_0x8d74d3,_0xa7b8f2,_0x5b9bea,_0x52d6c7,_0x3ac5dd);})[_0x2db4('0x18')](function(_0x1725f2){if(_0x1725f2&&_0x1725f2['id']){logger[_0x2db4('0xa')](_0x2db4('0x19'));logger['info'](_0x2db4('0x48'),_0x1725f2['id']);logger[_0x2db4('0xa')]('[OUTBOUND]',_0x2db4('0x49'));emit(util[_0x2db4('0xd')](_0x2db4('0x4a'),_0x7e57b6[_0x2db4('0x12')]),'trigger:browser:url',{'uri':util[_0x2db4('0xd')](_0x2db4('0x54'),_0x8d74d3[_0x2db4('0x1b')],_0x1725f2['id'])});}})[_0x2db4('0x4c')](function(_0x7b0864){logger['error']('[OUTBOUND]',JSON[_0x2db4('0x2d')](_0x7b0864));});};exports['unmanaged']=function(_0x48d029,_0x1cf551,_0x22d6d0,_0x3c6ce3,_0xbd79d0,_0xde4063){var _0x27edc5,_0x473a3c;_0xde4063[_0x2db4('0x1b')]=intUtil[_0x2db4('0x3f')](_0xde4063[_0x2db4('0x1b')]);_0xde4063[_0x2db4('0x40')]=intUtil[_0x2db4('0x3f')](_0xde4063[_0x2db4('0x40')]);if(_0xbd79d0&&_0xbd79d0[_0x2db4('0x55')]){logger['info']('['+_0x1cf551[_0x2db4('0x56')][_0x2db4('0x57')]()+']',_0x2db4('0x42'));_0x1cf551[_0x2db4('0x51')]=util[_0x2db4('0xd')](_0x2db4('0x43'),_0xde4063[_0x2db4('0x40')],_0x1cf551[_0x2db4('0x44')],md5(_0x1cf551['uniqueid']));}else{_0x1cf551['recordingURL']='';}headers[_0x2db4('0x45')]=getAuth(_0xde4063);return getUser(_0xde4063,'')[_0x2db4('0x18')](function(_0x496109){_0x27edc5=_0x496109;logger[_0x2db4('0xa')]('The\x20User\x20ID\x20is:',_0x27edc5['id']);return getEndUser(_0xde4063,_0x1cf551[_0x2db4('0x58')],_0x1cf551[_0x2db4('0xf')]);})['then'](function(_0x1aad80){_0x473a3c=_0x1aad80;logger[_0x2db4('0xa')](_0x2db4('0x47'),_0x473a3c['id']);return getTicket(_0xde4063,_0x27edc5,_0x473a3c,_0x22d6d0,_0x1cf551);})[_0x2db4('0x18')](function(_0x50653e){if(_0x50653e){logger['info'](_0x2db4('0x19'));logger['info'](_0x2db4('0x48'),_0x50653e['id']);}})[_0x2db4('0x4c')](function(_0x9a2dbf){logger[_0x2db4('0x59')]('['+_0x1cf551[_0x2db4('0x56')]['toUpperCase']()+']',JSON[_0x2db4('0x2d')](_0x9a2dbf));});}; \ No newline at end of file +var _0x65c0=['defaults','localhost','socket.io-emitter','application/json','emit','info','Creating\x20new\x20ticket...','merge','format','calleridname','calleridnum','getString','Subjects','Descriptions','Tags','name','Fields','custom_fields','mapValues','keyBy','%s/api/v2/tickets','remoteUri','POST','then','Ticket\x20created!','%s/api/v2/agents','length','Agent\x20found!','contact','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/api/v2/contacts','Enduser\x20created.','apiKey','toString','base64','debug','stringify','map','forEach','includes','picklist','nameField','customField','toLowerCase','string','type','idField','content','variable','variableName','push','customVariable','Variable','queue','stripTrailingSlash','serverUrl','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','%s/helpdesk/tickets/%d','error','outbound','recordingFormat','none','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','[OUTBOUND]','trigger:browser:url','catch','monitor_format','lastevent','The\x20Enduser\x20ID\x20is:','toUpperCase','lodash','request-promise','md5','util','./util','../../../../config/environment','../../../../config/logger','freshdesk','redis'];(function(_0x13b370,_0x4353f4){var _0x56b62a=function(_0x3cf12f){while(--_0x3cf12f){_0x13b370['push'](_0x13b370['shift']());}};_0x56b62a(++_0x4353f4);}(_0x65c0,0xb5));var _0x065c=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x65c0[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x065c('0x0'));var rp=require(_0x065c('0x1'));var md5=require(_0x065c('0x2'));var util=require(_0x065c('0x3'));var Redis=require('ioredis');var intUtil=require(_0x065c('0x4'));var config=require(_0x065c('0x5'));var logger=require(_0x065c('0x6'))(_0x065c('0x7'));config[_0x065c('0x8')]=_[_0x065c('0x9')](config[_0x065c('0x8')],{'host':_0x065c('0xa'),'port':0x18eb});var io=require(_0x065c('0xb'))(new Redis(config[_0x065c('0x8')]));var headers={'Content-Type':_0x065c('0xc'),'Accept':'application/json'};function emit(_0x46d959,_0x3d66bf,_0x316981){io['to'](_0x46d959)[_0x065c('0xd')](_0x3d66bf,_0x316981);}function getTicket(_0x234086,_0x57248a,_0x592894,_0x44c877,_0x1a1bf3){logger[_0x065c('0xe')](_0x065c('0xf'));var _0x42ac73=_[_0x065c('0x10')]({'responder_id':_0x57248a['id'],'requester_id':_0x592894['id'],'name':util[_0x065c('0x11')]('Caller\x20-\x20%s',_0x1a1bf3[_0x065c('0x12')]),'phone':_0x1a1bf3[_0x065c('0x13')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x065c('0x14')](_0x44c877[_0x065c('0x15')],_0x1a1bf3,'\x20'),'description':intUtil[_0x065c('0x14')](_0x44c877[_0x065c('0x16')],_0x1a1bf3,'
'),'tags':getTags(_0x44c877[_0x065c('0x17')],_0x065c('0x18'))},getCustomFields(_0x44c877[_0x065c('0x19')],_0x1a1bf3));_0x42ac73[_0x065c('0x1a')]=_[_0x065c('0x1b')](_[_0x065c('0x1c')](_0x42ac73['custom_fields'],'id'),'value');return request({'uri':util[_0x065c('0x11')](_0x065c('0x1d'),_0x234086[_0x065c('0x1e')]),'method':_0x065c('0x1f'),'body':_0x42ac73})[_0x065c('0x20')](function(_0x30b2d6){logger[_0x065c('0xe')](_0x065c('0x21'));return _0x30b2d6;});}function getUser(_0x3cb3b2,_0x496577){if(intUtil['validateEmail'](_0x496577)){return request({'uri':util['format'](_0x065c('0x22'),_0x3cb3b2[_0x065c('0x1e')]),'qs':{'email':_0x496577}})['then'](function(_0x26eb7f){if(_0x26eb7f[_0x065c('0x23')]){logger[_0x065c('0xe')](_0x065c('0x24'));return _['find'](_0x26eb7f,function(_0x459449){return _0x459449[_0x065c('0x25')]['email']===_0x496577;});}else{logger[_0x065c('0xe')](_0x065c('0x26'));return request({'uri':util['format']('%s/api/v2/agents/me',_0x3cb3b2[_0x065c('0x1e')])})[_0x065c('0x20')](function(_0x3a2b23){logger[_0x065c('0xe')]('Admin\x20account\x20selected.');return _0x3a2b23;});}});}else{logger[_0x065c('0xe')]('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x065c('0x11')](_0x065c('0x27'),_0x3cb3b2[_0x065c('0x1e')])})[_0x065c('0x20')](function(_0x1e2312){logger[_0x065c('0xe')](_0x065c('0x28'));return _0x1e2312;});}}function getEndUser(_0x1e12fa,_0x20cac8,_0x22034c){logger['info'](_0x065c('0x29'),_0x22034c);return request({'uri':util[_0x065c('0x11')]('%s/api/v2/contacts',_0x1e12fa['remoteUri']),'qs':{'phone':_0x22034c}})[_0x065c('0x20')](function(_0x3e5fce){if(_0x3e5fce[_0x065c('0x23')]){logger[_0x065c('0xe')](_0x065c('0x2a'));return _['find'](_0x3e5fce,{'phone':_0x22034c});}else{logger[_0x065c('0xe')](_0x065c('0x2b'));return request({'uri':util[_0x065c('0x11')](_0x065c('0x2c'),_0x1e12fa[_0x065c('0x1e')]),'method':_0x065c('0x1f'),'body':{'name':_0x20cac8,'phone':_0x22034c}})[_0x065c('0x20')](function(_0x29c1af){logger[_0x065c('0xe')](_0x065c('0x2d'));return _0x29c1af;});}});}function getAuth(_0x285649){return util[_0x065c('0x11')]('Basic\x20%s',new Buffer(_0x285649[_0x065c('0x2e')]+':X')[_0x065c('0x2f')](_0x065c('0x30')));}function request(_0x372fdf){logger[_0x065c('0x31')]('[HTTP]',JSON[_0x065c('0x32')](_0x372fdf));return rp(_[_0x065c('0x9')](_0x372fdf,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x26f61d,_0x5e7dc8){var _0x44c13f=[];if(_0x26f61d&&_0x26f61d['length']>0x0){_0x44c13f=_[_0x065c('0x33')](_0x26f61d,_0x5e7dc8);}return _0x44c13f;}function getCustomFields(_0x29f6d6,_0x4055b9){var _0x798986=[];var _0x2e776f={'custom_fields':[]};if(_0x29f6d6[_0x065c('0x23')]>0x0){_[_0x065c('0x34')](_0x29f6d6,function(_0x1f0968){if(_[_0x065c('0x35')](['string',_0x065c('0x36')],_0x1f0968['type'])&&_0x1f0968[_0x065c('0x37')]&&!_0x1f0968[_0x065c('0x38')]){_0x2e776f[_0x1f0968[_0x065c('0x37')][_0x065c('0x39')]()]=_0x1f0968['content'][_0x065c('0x2f')]();}else if(_[_0x065c('0x35')]([_0x065c('0x3a'),_0x065c('0x36')],_0x1f0968[_0x065c('0x3b')])&&_0x1f0968[_0x065c('0x3c')]&&_0x1f0968[_0x065c('0x38')]){_0x2e776f[_0x065c('0x1a')]['push']({'id':_0x1f0968['idField'],'value':_0x1f0968[_0x065c('0x3d')][_0x065c('0x2f')]()});}else if(_0x1f0968[_0x065c('0x3b')]===_0x065c('0x3e')&&_0x1f0968[_0x065c('0x3f')]&&_0x1f0968[_0x065c('0x3c')]&&_0x1f0968[_0x065c('0x38')]){_0x4055b9[_0x1f0968[_0x065c('0x3f')]]&&_0x2e776f[_0x065c('0x1a')][_0x065c('0x40')]({'id':_0x1f0968[_0x065c('0x3c')],'value':_0x4055b9[_0x1f0968['variableName']][_0x065c('0x2f')]()});}else if(_0x1f0968[_0x065c('0x3b')]===_0x065c('0x41')&&_0x1f0968['Variable']&&_0x1f0968[_0x065c('0x42')][_0x065c('0x18')]&&_0x1f0968[_0x065c('0x3c')]&&_0x1f0968['customField']){_0x4055b9[_0x1f0968['Variable'][_0x065c('0x18')][_0x065c('0x39')]()]&&_0x2e776f[_0x065c('0x1a')]['push']({'id':_0x1f0968[_0x065c('0x3c')],'value':_0x4055b9[_0x1f0968[_0x065c('0x42')][_0x065c('0x18')]['toLowerCase']()]['toString']()});}});}return _0x2e776f;}exports[_0x065c('0x43')]=function(_0x7a48f0,_0x53cc0f,_0x311964,_0x2d6869,_0x370ad5,_0x1a78e8){var _0xc356b0,_0x1c6a95;_0x1a78e8[_0x065c('0x1e')]=intUtil[_0x065c('0x44')](_0x1a78e8['remoteUri']);_0x1a78e8[_0x065c('0x45')]=intUtil['stripTrailingSlash'](_0x1a78e8['serverUrl']);if(_0x370ad5&&_0x370ad5['monitor_format']){logger[_0x065c('0xe')](_0x065c('0x46'),'Recording\x20is\x20enabled!');_0x53cc0f[_0x065c('0x47')]=util[_0x065c('0x11')](_0x065c('0x48'),_0x1a78e8[_0x065c('0x45')],_0x53cc0f[_0x065c('0x49')],md5(_0x53cc0f[_0x065c('0x49')]));}else{_0x53cc0f[_0x065c('0x47')]='';}headers[_0x065c('0x4a')]=getAuth(_0x1a78e8);return getUser(_0x1a78e8,_0x2d6869[_0x065c('0x4b')])[_0x065c('0x20')](function(_0x28a7f3){_0xc356b0=_0x28a7f3;logger[_0x065c('0xe')](_0x065c('0x4c'),_0xc356b0['id']);return getEndUser(_0x1a78e8,_0x53cc0f[_0x065c('0x12')],_0x53cc0f['calleridnum']);})[_0x065c('0x20')](function(_0x1086e0){_0x1c6a95=_0x1086e0;logger[_0x065c('0xe')]('The\x20Enduser\x20ID\x20is:',_0x1c6a95['id']);return getTicket(_0x1a78e8,_0xc356b0,_0x1c6a95,_0x311964,_0x53cc0f);})['then'](function(_0x30c2b2){if(_0x30c2b2&&_0x30c2b2['id']){logger[_0x065c('0xe')](_0x065c('0x21'));logger[_0x065c('0xe')](_0x065c('0x4d'),_0x30c2b2['id']);logger[_0x065c('0xe')]('[QUEUE]',_0x065c('0x4e'));emit(util['format'](_0x065c('0x4f'),_0x2d6869[_0x065c('0x18')]),'trigger:browser:url',{'uri':util[_0x065c('0x11')](_0x065c('0x50'),_0x1a78e8[_0x065c('0x1e')],_0x30c2b2['id'])});}})['catch'](function(_0x32efb6){logger[_0x065c('0x51')](_0x065c('0x46'),JSON[_0x065c('0x32')](_0x32efb6));});};exports[_0x065c('0x52')]=function(_0x44e4db,_0x27833f,_0x1fd4ab,_0x2ee3cb,_0x3baea0,_0xf643c8,_0x2b3268){var _0x3314c5,_0x307ff4;_0xf643c8[_0x065c('0x1e')]=intUtil[_0x065c('0x44')](_0xf643c8[_0x065c('0x1e')]);_0xf643c8[_0x065c('0x45')]=intUtil['stripTrailingSlash'](_0xf643c8[_0x065c('0x45')]);if(_0x2b3268&&_0x2b3268[_0x065c('0x53')]&&_0x2b3268['recordingFormat']!==_0x065c('0x54')){logger[_0x065c('0xe')]('[OUTBOUND]',_0x065c('0x55'));_0x27833f['recordingURL']=util[_0x065c('0x11')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0xf643c8[_0x065c('0x45')],_0x27833f[_0x065c('0x49')],md5(_0x27833f[_0x065c('0x49')]));}headers[_0x065c('0x4a')]=getAuth(_0xf643c8);return getUser(_0xf643c8,_0x2ee3cb['email'])[_0x065c('0x20')](function(_0x281924){_0x3314c5=_0x281924;logger[_0x065c('0xe')](_0x065c('0x4c'),_0x3314c5['id']);return getEndUser(_0xf643c8,_0x27833f[_0x065c('0x56')],_0x27833f[_0x065c('0x57')]);})[_0x065c('0x20')](function(_0x35c513){_0x307ff4=_0x35c513;logger[_0x065c('0xe')]('The\x20Enduser\x20ID\x20is:',_0x307ff4['id']);return getTicket(_0xf643c8,_0x3314c5,_0x307ff4,_0x1fd4ab,_0x27833f);})['then'](function(_0x391c18){if(_0x391c18&&_0x391c18['id']){logger[_0x065c('0xe')]('Ticket\x20created!');logger[_0x065c('0xe')]('The\x20Ticket\x20ID\x20is:',_0x391c18['id']);logger['info'](_0x065c('0x58'),_0x065c('0x4e'));emit(util[_0x065c('0x11')]('user:%s',_0x2ee3cb[_0x065c('0x18')]),_0x065c('0x59'),{'uri':util['format']('%s/helpdesk/tickets/%d',_0xf643c8[_0x065c('0x1e')],_0x391c18['id'])});}})[_0x065c('0x5a')](function(_0x106b9d){logger[_0x065c('0x51')](_0x065c('0x58'),JSON['stringify'](_0x106b9d));});};exports['unmanaged']=function(_0x2f76de,_0x5baa16,_0x3b96b7,_0x3059f3,_0xc888bf,_0x2009f9){var _0x176593,_0x2ed295;_0x2009f9[_0x065c('0x1e')]=intUtil[_0x065c('0x44')](_0x2009f9['remoteUri']);_0x2009f9[_0x065c('0x45')]=intUtil['stripTrailingSlash'](_0x2009f9[_0x065c('0x45')]);if(_0xc888bf&&_0xc888bf[_0x065c('0x5b')]){logger[_0x065c('0xe')]('['+_0x5baa16[_0x065c('0x5c')]['toUpperCase']()+']','Recording\x20is\x20enabled!');_0x5baa16[_0x065c('0x47')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2009f9[_0x065c('0x45')],_0x5baa16['uniqueid'],md5(_0x5baa16[_0x065c('0x49')]));}else{_0x5baa16[_0x065c('0x47')]='';}headers['Authorization']=getAuth(_0x2009f9);return getUser(_0x2009f9,'')[_0x065c('0x20')](function(_0x41fcb2){_0x176593=_0x41fcb2;logger[_0x065c('0xe')](_0x065c('0x4c'),_0x176593['id']);return getEndUser(_0x2009f9,_0x5baa16['calleridname'],_0x5baa16['calleridnum']);})[_0x065c('0x20')](function(_0x514636){_0x2ed295=_0x514636;logger['info'](_0x065c('0x5d'),_0x2ed295['id']);return getTicket(_0x2009f9,_0x176593,_0x2ed295,_0x3b96b7,_0x5baa16);})[_0x065c('0x20')](function(_0xed38c7){if(_0xed38c7){logger[_0x065c('0xe')](_0x065c('0x21'));logger[_0x065c('0xe')](_0x065c('0x4d'),_0xed38c7['id']);}})[_0x065c('0x5a')](function(_0x1ac808){logger['error']('['+_0x5baa16[_0x065c('0x5c')][_0x065c('0x5e')]()+']',JSON[_0x065c('0x32')](_0x1ac808));});}; \ 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 ca8888d..b22c022 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 _0xd975=['Getting\x20user\x20list','agentEmail','Getting\x20user\x20with\x20email','userEmail','User\x20found:','userId','Admin\x20selected','catch','/api/lookup?q=','&entities=contact','find','contacts','contactNumber','mobile_number','Contact\x20found\x20mobile_number:','endUserId','work_number','Contact\x20created:','/api/contacts','format','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','POST','/api/tasks','getString','Subjects','Contact','ticketId','/contacts/','user:%s','emit','trigger:browser:url','Token\x20token=','apiKey','remoteUri','stripTrailingSlash','serverUrl','toLowerCase','outbound','destcalleridnum','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','monitor_format','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','request-promise','md5','util','bluebird','ioredis','../../../../config/logger','freshsales','redis','defaults','localhost','GET','/api/selector/owners','headers','info','then','users','length','email','adminEmail','adminId','Requested\x20Resource\x20not\x20Found','error','toUpperCase','message'];(function(_0x16230c,_0x2c11ed){var _0xe2294e=function(_0x15b45a){while(--_0x15b45a){_0x16230c['push'](_0x16230c['shift']());}};_0xe2294e(++_0x2c11ed);}(_0xd975,0xe0));var _0x5d97=function(_0x117bc8,_0x2a4cdc){_0x117bc8=_0x117bc8-0x0;var _0x22d6c1=_0xd975[_0x117bc8];return _0x22d6c1;};'use strict';var _=require(_0x5d97('0x0'));var rp=require(_0x5d97('0x1'));var md5=require(_0x5d97('0x2'));var util=require(_0x5d97('0x3'));var moment=require('moment');var Promise=require(_0x5d97('0x4'));var Redis=require(_0x5d97('0x5'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0x5d97('0x6'))(_0x5d97('0x7'));config[_0x5d97('0x8')]=_[_0x5d97('0x9')](config['redis'],{'host':_0x5d97('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function getAdminId(_0x5e9b62,_0x157556,_0x3c49c9,_0x59d640){return new Promise(function(_0x3e9df2,_0x3d8096){var _0x43771e=![];var _0x1ad0c7={'method':_0x5d97('0xb'),'uri':_0x59d640+_0x5d97('0xc'),'json':!![]};_0x1ad0c7[_0x5d97('0xd')]=_0x3c49c9;logger[_0x5d97('0xe')]('Getting\x20admin\x20information');return rp(_0x1ad0c7)[_0x5d97('0xf')](function(_0x34e216){if(_0x34e216){var _0x2e3095=_0x34e216[_0x5d97('0x10')];var _0x2a3e8d=null;for(_0x2a3e8d=0x0;_0x2a3e8d<_0x2e3095[_0x5d97('0x11')];_0x2a3e8d++){if(_0x2e3095[_0x2a3e8d][_0x5d97('0x12')]===_0x5e9b62[_0x5d97('0x13')]){_0x5e9b62['adminId']=_0x2e3095[_0x2a3e8d]['id'];_0x43771e=!![];}}if(_0x43771e){logger[_0x5d97('0xe')]('Admin\x20found:',_0x5e9b62[_0x5d97('0x14')]);_0x3e9df2(_0x5e9b62);}else{_0x3d8096({'statusCode':0x194,'message':_0x5d97('0x15')});}}else{_0x3d8096({'statusCode':0x194,'message':_0x5d97('0x15')});}})['catch'](function(_0x2d2e97){logger[_0x5d97('0x16')]('['+[_0x157556[_0x5d97('0x17')]()]+']',_0x2d2e97[_0x5d97('0x18')]);_0x3d8096(_0x2d2e97);});});}function getUser(_0x1d4fcb,_0x455c3c,_0x4b6e79){return function(_0x14bff5){return new Promise(function(_0x463434,_0x29e9c9){var _0x2733d7={'method':_0x5d97('0xb'),'uri':_0x4b6e79+_0x5d97('0xc'),'json':!![]};_0x2733d7['headers']=_0x455c3c;logger[_0x5d97('0xe')](_0x5d97('0x19'));return rp(_0x2733d7)[_0x5d97('0xf')](function(_0x4a4997){if(_0x4a4997){var _0x4511a7=_0x4a4997[_0x5d97('0x10')];var _0x8f4991=![];var _0x28e4dd=null;if(_0x14bff5[_0x5d97('0x1a')]!==null){logger[_0x5d97('0xe')](_0x5d97('0x1b'),_0x14bff5['agentEmail']);_0x14bff5[_0x5d97('0x1c')]=_0x14bff5['agentEmail'];for(_0x28e4dd=0x0;_0x28e4dd<_0x4511a7['length'];_0x28e4dd++){if(_0x4511a7[_0x28e4dd][_0x5d97('0x12')]===_0x14bff5['agentEmail']){_0x8f4991=!![];_0x14bff5['userId']=_0x4511a7[_0x28e4dd]['id'];logger[_0x5d97('0xe')](_0x5d97('0x1d'),_0x14bff5[_0x5d97('0x1e')]);}}}if(!_0x8f4991){logger[_0x5d97('0xe')](_0x5d97('0x1f'));_0x14bff5[_0x5d97('0x1c')]=_0x14bff5[_0x5d97('0x13')];_0x14bff5[_0x5d97('0x1e')]=_0x14bff5[_0x5d97('0x14')];_0x8f4991=!![];}if(_0x8f4991){_0x463434(_0x14bff5);}else{_0x29e9c9({'statusCode':0x194,'message':_0x5d97('0x15')});}}else{_0x29e9c9({'statusCode':0x194,'message':_0x5d97('0x15')});}})[_0x5d97('0x20')](function(_0xc2b7aa){logger[_0x5d97('0x16')]('['+[_0x1d4fcb[_0x5d97('0x17')]()]+']',_0xc2b7aa[_0x5d97('0x18')]);_0x29e9c9(_0xc2b7aa);});});};}function searchContact(_0x4ab6f6,_0x239244,_0x828724,_0x4c3821){return new Promise(function(_0x258cb8,_0x39fe7c){var _0x16f946={'method':_0x5d97('0xb'),'headers':_0x239244,'uri':_0x4ab6f6+_0x5d97('0x21')+_0x4c3821+'&f='+_0x828724+_0x5d97('0x22'),'json':!![]};rp(_0x16f946)[_0x5d97('0xf')](function(_0x51cb71){var _0x2641e1=_[_0x5d97('0x23')](_0x51cb71[_0x5d97('0x24')][_0x5d97('0x24')],[_0x828724,_0x4c3821]);_0x258cb8(_0x2641e1);})[_0x5d97('0x20')](function(_0x605f9b){_0x39fe7c(_0x605f9b);});});}function getEndUser(_0x338e79,_0x3cac2e,_0x26a360){return function(_0x82dae5){return new Promise(function(_0x568603,_0x53d34e){logger['info'](util['format']('Searching\x20contact\x20with\x20phone\x20%s',_0x82dae5[_0x5d97('0x25')]));searchContact(_0x26a360,_0x3cac2e,_0x5d97('0x26'),_0x82dae5['contactNumber'])[_0x5d97('0xf')](function(_0x4a4d05){if(_0x4a4d05){_0x82dae5['endUserId']=_0x4a4d05['id'];logger[_0x5d97('0xe')](_0x5d97('0x27'),_0x82dae5[_0x5d97('0x28')]);return _0x568603(_0x82dae5);}searchContact(_0x26a360,_0x3cac2e,_0x5d97('0x29'),_0x82dae5[_0x5d97('0x25')])[_0x5d97('0xf')](function(_0x1a93c2){if(_0x1a93c2){_0x82dae5[_0x5d97('0x28')]=_0x1a93c2['id'];logger['info']('Contact\x20found\x20work_number:',_0x82dae5['endUserId']);return _0x568603(_0x82dae5);}createEndUser(_0x82dae5,_0x338e79,_0x3cac2e,_0x26a360)[_0x5d97('0xf')](function(_0x256a41){logger[_0x5d97('0xe')](_0x5d97('0x2a'),_0x256a41[_0x5d97('0x28')]);return _0x568603(_0x256a41);});});})[_0x5d97('0x20')](function(_0x35e0b7){_0x53d34e(_0x35e0b7);});});};}function createEndUser(_0x2d303f,_0x359c9e,_0x351d2b,_0x43053f){return new Promise(function(_0x528411,_0x52752b){var _0x5476c5=moment();var _0x1c6707={'method':'POST','uri':_0x43053f+_0x5d97('0x2b'),'body':{'contact':{'last_name':_0x2d303f['contactNumber'],'work_number':_0x2d303f[_0x5d97('0x25')],'mobile_number':_0x2d303f[_0x5d97('0x25')],'owner_id':_0x2d303f[_0x5d97('0x1e')],'created_at':_0x5476c5[_0x5d97('0x2c')](_0x5d97('0x2d'))}},'json':!![]};_0x1c6707['headers']=_0x351d2b;logger[_0x5d97('0xe')](_0x5d97('0x2e'));return rp(_0x1c6707)[_0x5d97('0xf')](function(_0x4f9702){_0x2d303f['endUserId']=_0x4f9702[_0x5d97('0x2f')]['id'];_0x528411(_0x2d303f);})[_0x5d97('0x20')](function(_0x463b2d){logger[_0x5d97('0x16')]('['+[_0x359c9e[_0x5d97('0x17')]()]+']',_0x463b2d[_0x5d97('0x18')]);_0x52752b(_0x463b2d[_0x5d97('0x18')]);});});}function getTicket(_0x39f092,_0x53286b,_0x2f48f2,_0x160d5e,_0x3aae04){return function(_0x5a6cbe){logger['info'](_0x5d97('0x30'));return new Promise(function(_0x18f840,_0x5d6019){var _0x193725=moment();var _0x426715={'method':_0x5d97('0x31'),'uri':_0x2f48f2+_0x5d97('0x32'),'body':{'title':intUtil[_0x5d97('0x33')](_0x160d5e[_0x5d97('0x34')],_0x3aae04,'\x20'),'description':intUtil[_0x5d97('0x33')](_0x160d5e['Descriptions'],_0x3aae04,'\x0a'),'owner_id':_0x5a6cbe[_0x5d97('0x1e')],'creater_id':_0x5a6cbe[_0x5d97('0x14')],'targetable_id':_0x5a6cbe['endUserId'],'targetable_type':_0x5d97('0x35'),'created_at':_0x193725[_0x5d97('0x2c')]('YYYY-MM-DDTHH:mm:ss'),'due_date':_0x193725['add'](0x1e,'m')[_0x5d97('0x2c')](_0x5d97('0x2d'))},'json':!![]};_0x426715[_0x5d97('0xd')]=_0x53286b;return rp(_0x426715)[_0x5d97('0xf')](function(_0x5342a8){_0x5a6cbe['ticketId']=_0x5342a8['task']['id'];logger[_0x5d97('0xe')]('Task\x20created:',_0x5a6cbe[_0x5d97('0x36')]);_0x18f840(_0x5a6cbe);})['catch'](function(_0x1180f6){logger[_0x5d97('0x16')]('['+[_0x39f092[_0x5d97('0x17')]()]+']',_0x1180f6['message']);_0x5d6019(_0x1180f6[_0x5d97('0x18')]);});});};}function emit(_0x536328,_0x1d8e6b,_0x4b1fac){var _0xde6530={'uri':_0x536328+_0x5d97('0x37')+_0x4b1fac};io['to'](util[_0x5d97('0x2c')](_0x5d97('0x38'),_0x1d8e6b))[_0x5d97('0x39')](_0x5d97('0x3a'),_0xde6530);}exports['cs']=function(_0x432849,_0x16723a,_0x265073,_0x185041,_0x4e2f96,_0xd2dcb9,_0x5d5322,_0x302b20){var _0x2f604c={};var _0x28a2a4={'Authorization':_0x5d97('0x3b')+_0xd2dcb9[_0x5d97('0x3c')]};_0xd2dcb9['remoteUri']=intUtil['stripTrailingSlash'](_0xd2dcb9[_0x5d97('0x3d')]);_0xd2dcb9['serverUrl']=intUtil[_0x5d97('0x3e')](_0xd2dcb9[_0x5d97('0x3f')]);var _0x5a1614=_0xd2dcb9[_0x5d97('0x3d')];_0x2f604c[_0x5d97('0x13')]=_0xd2dcb9['username'];_0x2f604c[_0x5d97('0x25')]=_0x302b20[_0x5d97('0x40')]()===_0x5d97('0x41')?_0x16723a[_0x5d97('0x42')]:_0x16723a[_0x5d97('0x43')];_0x2f604c[_0x5d97('0x44')]=_0x302b20===_0x5d97('0x45')||_0x302b20===_0x5d97('0x46')?_0x5d97('0x45'):_0x5d97('0x41');if(_0x185041){_0x2f604c[_0x5d97('0x1a')]=_0x185041[_0x5d97('0x12')];}var _0x491be6=util[_0x5d97('0x2c')](_0x5d97('0x47'),_0xd2dcb9[_0x5d97('0x3f')],_0x16723a['uniqueid'],md5(_0x16723a['uniqueid']));if(_0x4e2f96&&_0x4e2f96[_0x5d97('0x48')]){logger[_0x5d97('0xe')]('[QUEUE]',_0x5d97('0x49'));_0x16723a[_0x5d97('0x4a')]=_0x491be6;}else if(_0x5d5322&&_0x5d5322[_0x5d97('0x4b')]&&_0x5d5322['recordingFormat']!==_0x5d97('0x4c')){logger['info'](_0x5d97('0x4d'),'Recording\x20is\x20enabled!');_0x16723a[_0x5d97('0x4a')]=_0x491be6;}else{_0x16723a[_0x5d97('0x4a')]='';}return getAdminId(_0x2f604c,_0x302b20,_0x28a2a4,_0x5a1614)[_0x5d97('0xf')](getUser(_0x302b20,_0x28a2a4,_0x5a1614))['then'](getEndUser(_0x302b20,_0x28a2a4,_0x5a1614))['then'](getTicket(_0x302b20,_0x28a2a4,_0x5a1614,_0x265073,_0x16723a))[_0x5d97('0xf')](function(_0x2f51ad){logger[_0x5d97('0xe')](util['format'](_0x5d97('0x4e'),_0x2f51ad[_0x5d97('0x36')]));if(_0x302b20!=='unmanaged'){logger[_0x5d97('0xe')]('['+[_0x302b20[_0x5d97('0x17')]()]+']',_0x5d97('0x4f'));emit(_0x5a1614,_0x185041[_0x5d97('0x50')],_0x2f51ad['endUserId']);}})['catch'](function(_0x7f8cd7){logger[_0x5d97('0x16')]('['+[_0x302b20[_0x5d97('0x17')]()]+_0x5d97('0x51'),util[_0x5d97('0x52')](_0x7f8cd7,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xc86c=['remoteUri','serverUrl','stripTrailingSlash','username','toLowerCase','outbound','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','recordingURL','recordingFormat','none','Recording\x20is\x20enabled!','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','request-promise','md5','util','moment','ioredis','./util','../../../../config/environment','../../../../config/logger','freshsales','redis','defaults','socket.io-emitter','/api/selector/owners','headers','info','Getting\x20admin\x20information','users','length','email','adminEmail','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','message','GET','Getting\x20user\x20list','agentEmail','Getting\x20user\x20with\x20email','userEmail','userId','User\x20found:','Admin\x20selected','/api/lookup?q=','&f=','then','contacts','Searching\x20contact\x20with\x20phone\x20%s','mobile_number','contactNumber','endUserId','Contact\x20found\x20mobile_number:','work_number','Contact\x20found\x20work_number:','Contact\x20created:','POST','format','YYYY-MM-DDTHH:mm:ss','/api/tasks','getString','Subjects','Contact','add','task','Task\x20created:','ticketId','/contacts/','user:%s','emit','trigger:browser:url','apiKey'];(function(_0x2298d3,_0x10defb){var _0x2ceb13=function(_0x42473f){while(--_0x42473f){_0x2298d3['push'](_0x2298d3['shift']());}};_0x2ceb13(++_0x10defb);}(_0xc86c,0x1b9));var _0xcc86=function(_0x59ccae,_0x46dfe4){_0x59ccae=_0x59ccae-0x0;var _0x403d30=_0xc86c[_0x59ccae];return _0x403d30;};'use strict';var _=require('lodash');var rp=require(_0xcc86('0x0'));var md5=require(_0xcc86('0x1'));var util=require(_0xcc86('0x2'));var moment=require(_0xcc86('0x3'));var Promise=require('bluebird');var Redis=require(_0xcc86('0x4'));var intUtil=require(_0xcc86('0x5'));var config=require(_0xcc86('0x6'));var logger=require(_0xcc86('0x7'))(_0xcc86('0x8'));config[_0xcc86('0x9')]=_[_0xcc86('0xa')](config[_0xcc86('0x9')],{'host':'localhost','port':0x18eb});var io=require(_0xcc86('0xb'))(new Redis(config[_0xcc86('0x9')]));function getAdminId(_0x48026f,_0x3a6476,_0x12949f,_0x53a433){return new Promise(function(_0x4b9f4a,_0x5b5ae2){var _0x1652b9=![];var _0x432b1f={'method':'GET','uri':_0x53a433+_0xcc86('0xc'),'json':!![]};_0x432b1f[_0xcc86('0xd')]=_0x12949f;logger[_0xcc86('0xe')](_0xcc86('0xf'));return rp(_0x432b1f)['then'](function(_0xae791){if(_0xae791){var _0x29bb44=_0xae791[_0xcc86('0x10')];var _0x187d77=null;for(_0x187d77=0x0;_0x187d77<_0x29bb44[_0xcc86('0x11')];_0x187d77++){if(_0x29bb44[_0x187d77][_0xcc86('0x12')]===_0x48026f[_0xcc86('0x13')]){_0x48026f[_0xcc86('0x14')]=_0x29bb44[_0x187d77]['id'];_0x1652b9=!![];}}if(_0x1652b9){logger['info'](_0xcc86('0x15'),_0x48026f[_0xcc86('0x14')]);_0x4b9f4a(_0x48026f);}else{_0x5b5ae2({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x5b5ae2({'statusCode':0x194,'message':_0xcc86('0x16')});}})[_0xcc86('0x17')](function(_0x1a97af){logger[_0xcc86('0x18')]('['+[_0x3a6476[_0xcc86('0x19')]()]+']',_0x1a97af[_0xcc86('0x1a')]);_0x5b5ae2(_0x1a97af);});});}function getUser(_0x1439d4,_0x12768e,_0x5ef480){return function(_0x45bba0){return new Promise(function(_0x505334,_0x37057a){var _0x5ea4aa={'method':_0xcc86('0x1b'),'uri':_0x5ef480+_0xcc86('0xc'),'json':!![]};_0x5ea4aa[_0xcc86('0xd')]=_0x12768e;logger[_0xcc86('0xe')](_0xcc86('0x1c'));return rp(_0x5ea4aa)['then'](function(_0x4a0201){if(_0x4a0201){var _0x101988=_0x4a0201['users'];var _0x38eca2=![];var _0x5f1e51=null;if(_0x45bba0[_0xcc86('0x1d')]!==null){logger[_0xcc86('0xe')](_0xcc86('0x1e'),_0x45bba0['agentEmail']);_0x45bba0[_0xcc86('0x1f')]=_0x45bba0[_0xcc86('0x1d')];for(_0x5f1e51=0x0;_0x5f1e51<_0x101988[_0xcc86('0x11')];_0x5f1e51++){if(_0x101988[_0x5f1e51]['email']===_0x45bba0[_0xcc86('0x1d')]){_0x38eca2=!![];_0x45bba0[_0xcc86('0x20')]=_0x101988[_0x5f1e51]['id'];logger['info'](_0xcc86('0x21'),_0x45bba0[_0xcc86('0x20')]);}}}if(!_0x38eca2){logger[_0xcc86('0xe')](_0xcc86('0x22'));_0x45bba0[_0xcc86('0x1f')]=_0x45bba0[_0xcc86('0x13')];_0x45bba0[_0xcc86('0x20')]=_0x45bba0[_0xcc86('0x14')];_0x38eca2=!![];}if(_0x38eca2){_0x505334(_0x45bba0);}else{_0x37057a({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x37057a({'statusCode':0x194,'message':_0xcc86('0x16')});}})['catch'](function(_0x1f8e6c){logger[_0xcc86('0x18')]('['+[_0x1439d4[_0xcc86('0x19')]()]+']',_0x1f8e6c['message']);_0x37057a(_0x1f8e6c);});});};}function searchContact(_0x5a1f4d,_0xc961ac,_0x304146,_0x3b62af){return new Promise(function(_0x26c9d1,_0x4747f9){var _0x5dbbcb={'method':_0xcc86('0x1b'),'headers':_0xc961ac,'uri':_0x5a1f4d+_0xcc86('0x23')+_0x3b62af+_0xcc86('0x24')+_0x304146+'&entities=contact','json':!![]};rp(_0x5dbbcb)[_0xcc86('0x25')](function(_0x28b985){var _0x421ba4=_['find'](_0x28b985[_0xcc86('0x26')][_0xcc86('0x26')],[_0x304146,_0x3b62af]);_0x26c9d1(_0x421ba4);})['catch'](function(_0x4d88dd){_0x4747f9(_0x4d88dd);});});}function getEndUser(_0x27ff55,_0x59a8fe,_0x1a1eef){return function(_0x540e61){return new Promise(function(_0x35c5d2,_0x2ad23d){logger[_0xcc86('0xe')](util['format'](_0xcc86('0x27'),_0x540e61['contactNumber']));searchContact(_0x1a1eef,_0x59a8fe,_0xcc86('0x28'),_0x540e61[_0xcc86('0x29')])[_0xcc86('0x25')](function(_0x4ac09){if(_0x4ac09){_0x540e61[_0xcc86('0x2a')]=_0x4ac09['id'];logger[_0xcc86('0xe')](_0xcc86('0x2b'),_0x540e61[_0xcc86('0x2a')]);return _0x35c5d2(_0x540e61);}searchContact(_0x1a1eef,_0x59a8fe,_0xcc86('0x2c'),_0x540e61[_0xcc86('0x29')])[_0xcc86('0x25')](function(_0x16325d){if(_0x16325d){_0x540e61['endUserId']=_0x16325d['id'];logger[_0xcc86('0xe')](_0xcc86('0x2d'),_0x540e61[_0xcc86('0x2a')]);return _0x35c5d2(_0x540e61);}createEndUser(_0x540e61,_0x27ff55,_0x59a8fe,_0x1a1eef)['then'](function(_0x3d5f78){logger[_0xcc86('0xe')](_0xcc86('0x2e'),_0x3d5f78[_0xcc86('0x2a')]);return _0x35c5d2(_0x3d5f78);});});})['catch'](function(_0x46b7c8){_0x2ad23d(_0x46b7c8);});});};}function createEndUser(_0xfb1f55,_0x5203ab,_0x2a893f,_0x76eacb){return new Promise(function(_0x2ffef1,_0x2165d9){var _0x423da3=moment();var _0x1fe354={'method':_0xcc86('0x2f'),'uri':_0x76eacb+'/api/contacts','body':{'contact':{'last_name':_0xfb1f55[_0xcc86('0x29')],'work_number':_0xfb1f55[_0xcc86('0x29')],'mobile_number':_0xfb1f55[_0xcc86('0x29')],'owner_id':_0xfb1f55[_0xcc86('0x20')],'created_at':_0x423da3[_0xcc86('0x30')](_0xcc86('0x31'))}},'json':!![]};_0x1fe354[_0xcc86('0xd')]=_0x2a893f;logger[_0xcc86('0xe')]('Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact');return rp(_0x1fe354)[_0xcc86('0x25')](function(_0x1a76fd){_0xfb1f55[_0xcc86('0x2a')]=_0x1a76fd['contact']['id'];_0x2ffef1(_0xfb1f55);})[_0xcc86('0x17')](function(_0x49be3b){logger[_0xcc86('0x18')]('['+[_0x5203ab[_0xcc86('0x19')]()]+']',_0x49be3b['message']);_0x2165d9(_0x49be3b[_0xcc86('0x1a')]);});});}function getTicket(_0x33114e,_0x153523,_0x1844c8,_0x353ba6,_0x597f08){return function(_0x35cae5){logger[_0xcc86('0xe')]('Creating\x20new\x20task');return new Promise(function(_0x13d73e,_0x3eabe5){var _0x20b6d3=moment();var _0x4d7da4={'method':'POST','uri':_0x1844c8+_0xcc86('0x32'),'body':{'title':intUtil[_0xcc86('0x33')](_0x353ba6[_0xcc86('0x34')],_0x597f08,'\x20'),'description':intUtil[_0xcc86('0x33')](_0x353ba6['Descriptions'],_0x597f08,'\x0a'),'owner_id':_0x35cae5['userId'],'creater_id':_0x35cae5[_0xcc86('0x14')],'targetable_id':_0x35cae5[_0xcc86('0x2a')],'targetable_type':_0xcc86('0x35'),'created_at':_0x20b6d3[_0xcc86('0x30')](_0xcc86('0x31')),'due_date':_0x20b6d3[_0xcc86('0x36')](0x1e,'m')['format'](_0xcc86('0x31'))},'json':!![]};_0x4d7da4[_0xcc86('0xd')]=_0x153523;return rp(_0x4d7da4)['then'](function(_0x3861b0){_0x35cae5['ticketId']=_0x3861b0[_0xcc86('0x37')]['id'];logger['info'](_0xcc86('0x38'),_0x35cae5[_0xcc86('0x39')]);_0x13d73e(_0x35cae5);})[_0xcc86('0x17')](function(_0xd186c8){logger[_0xcc86('0x18')]('['+[_0x33114e[_0xcc86('0x19')]()]+']',_0xd186c8[_0xcc86('0x1a')]);_0x3eabe5(_0xd186c8[_0xcc86('0x1a')]);});});};}function emit(_0x5c259c,_0x5deb67,_0x31f47e){var _0x5d5272={'uri':_0x5c259c+_0xcc86('0x3a')+_0x31f47e};io['to'](util[_0xcc86('0x30')](_0xcc86('0x3b'),_0x5deb67))[_0xcc86('0x3c')](_0xcc86('0x3d'),_0x5d5272);}exports['cs']=function(_0x5c0ee3,_0x5ad05f,_0x16b5b5,_0x2398be,_0x140192,_0x4d6562,_0x38aa34,_0x29b2ba){var _0x384f7f={};var _0x5d6a8c={'Authorization':'Token\x20token='+_0x4d6562[_0xcc86('0x3e')]};_0x4d6562[_0xcc86('0x3f')]=intUtil['stripTrailingSlash'](_0x4d6562['remoteUri']);_0x4d6562[_0xcc86('0x40')]=intUtil[_0xcc86('0x41')](_0x4d6562[_0xcc86('0x40')]);var _0x254a60=_0x4d6562['remoteUri'];_0x384f7f[_0xcc86('0x13')]=_0x4d6562[_0xcc86('0x42')];_0x384f7f[_0xcc86('0x29')]=_0x29b2ba[_0xcc86('0x43')]()===_0xcc86('0x44')?_0x5ad05f['destcalleridnum']:_0x5ad05f['calleridnum'];_0x384f7f['callDirection']=_0x29b2ba===_0xcc86('0x45')||_0x29b2ba===_0xcc86('0x46')?_0xcc86('0x45'):'outbound';if(_0x2398be){_0x384f7f[_0xcc86('0x1d')]=_0x2398be[_0xcc86('0x12')];}var _0x43494d=util['format'](_0xcc86('0x47'),_0x4d6562['serverUrl'],_0x5ad05f[_0xcc86('0x48')],md5(_0x5ad05f[_0xcc86('0x48')]));if(_0x140192&&_0x140192[_0xcc86('0x49')]){logger[_0xcc86('0xe')](_0xcc86('0x4a'),'Recording\x20is\x20enabled!');_0x5ad05f[_0xcc86('0x4b')]=_0x43494d;}else if(_0x38aa34&&_0x38aa34[_0xcc86('0x4c')]&&_0x38aa34[_0xcc86('0x4c')]!==_0xcc86('0x4d')){logger[_0xcc86('0xe')]('[OUTBOUND]',_0xcc86('0x4e'));_0x5ad05f[_0xcc86('0x4b')]=_0x43494d;}else{_0x5ad05f[_0xcc86('0x4b')]='';}return getAdminId(_0x384f7f,_0x29b2ba,_0x5d6a8c,_0x254a60)[_0xcc86('0x25')](getUser(_0x29b2ba,_0x5d6a8c,_0x254a60))['then'](getEndUser(_0x29b2ba,_0x5d6a8c,_0x254a60))[_0xcc86('0x25')](getTicket(_0x29b2ba,_0x5d6a8c,_0x254a60,_0x16b5b5,_0x5ad05f))[_0xcc86('0x25')](function(_0x104d5f){logger[_0xcc86('0xe')](util[_0xcc86('0x30')](_0xcc86('0x4f'),_0x104d5f[_0xcc86('0x39')]));if(_0x29b2ba!==_0xcc86('0x46')){logger[_0xcc86('0xe')]('['+[_0x29b2ba[_0xcc86('0x19')]()]+']',_0xcc86('0x50'));emit(_0x254a60,_0x2398be[_0xcc86('0x51')],_0x104d5f[_0xcc86('0x2a')]);}})[_0xcc86('0x17')](function(_0x540e02){logger[_0xcc86('0x18')]('['+[_0x29b2ba[_0xcc86('0x19')]()]+_0xcc86('0x52'),util[_0xcc86('0x53')](_0x540e02,{'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 6188739..2e2e384 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 _0x630c=['routeId','outbound','log','unmanaged','sugarcrm','desk','unknown\x20integration','../../../../config/logger','error','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','%s\x20account\x20#%s\x20not\x20found','lodash','./zendesk','./salesforce','./sugarcrm','./freshdesk','./zoho','./vtiger','./servicenow','./dynamics365','./freshsales','zendesk','salesforce','freshdesk','zoho','vtiger','dynamics365','exec','includes','toLowerCase','data1','data2','data3','queue'];(function(_0x5cc8b9,_0x20e3c3){var _0x58892e=function(_0x87457a){while(--_0x87457a){_0x5cc8b9['push'](_0x5cc8b9['shift']());}};_0x58892e(++_0x20e3c3);}(_0x630c,0x9d));var _0xc630=function(_0x3e3df2,_0x374822){_0x3e3df2=_0x3e3df2-0x0;var _0x3c70d3=_0x630c[_0x3e3df2];return _0x3c70d3;};'use strict';var _=require(_0xc630('0x0'));var util=require('util');var zendesk=require(_0xc630('0x1'));var salesforce=require(_0xc630('0x2'));var sugarcrm=require(_0xc630('0x3'));var freshdesk=require(_0xc630('0x4'));var zoho=require(_0xc630('0x5'));var desk=require('./desk');var vtiger=require(_0xc630('0x6'));var servicenow=require(_0xc630('0x7'));var dynamics365=require(_0xc630('0x8'));var freshsales=require(_0xc630('0x9'));var integrations=[_0xc630('0xa'),_0xc630('0xb'),'sugarcrm',_0xc630('0xc'),_0xc630('0xd'),'desk',_0xc630('0xe'),_0xc630('0xf'),'freshsales','servicenow'];exports[_0xc630('0x10')]=function(_0x11912c,_0x1c71d3,_0x57ce61,_0x49c364,_0x431c7c,_0x4f3b6e){if(_0x57ce61){if(_[_0xc630('0x11')](integrations,_0x11912c['data1'][_0xc630('0x12')]())){try{var _0x4eaf3b=null;var _0x165904='';var _0x76820f=_0x57ce61[_0x11912c[_0xc630('0x13')]['toLowerCase']()];if(_0x76820f){var _0x4c8336=_0x76820f[_0x11912c[_0xc630('0x14')]];if(_0x4c8336){var _0x48896f=_['find'](_0x4c8336['Configurations'],{'id':parseInt(_0x11912c[_0xc630('0x15')],0xa)});if(_0x48896f){if(_0x49c364){if(_0x431c7c&&_0x1c71d3[_0xc630('0x16')]){_0x165904=_0xc630('0x16');}else if(_0x1c71d3[_0xc630('0x17')]){_0x165904=_0xc630('0x18');}else{console[_0xc630('0x19')]('EVENT\x20UNKNOWN',_0x1c71d3);}}else{_0x165904=_0xc630('0x1a');}switch(_0x11912c['data1'][_0xc630('0x12')]()){case _0xc630('0xa'):zendesk[_0x165904](_0x11912c,_0x1c71d3,_0x48896f,_0x49c364,_0x431c7c,_0x4c8336,_0x4f3b6e);break;case _0xc630('0xb'):salesforce[_0x165904](_0x11912c,_0x1c71d3,_0x48896f,_0x49c364,_0x431c7c,_0x4c8336,_0x4f3b6e);break;case _0xc630('0x1b'):sugarcrm[_0x165904](_0x11912c,_0x1c71d3,_0x48896f,_0x49c364,_0x431c7c,_0x4c8336,_0x4f3b6e);break;case _0xc630('0xc'):freshdesk[_0x165904](_0x11912c,_0x1c71d3,_0x48896f,_0x49c364,_0x431c7c,_0x4c8336,_0x4f3b6e);break;case _0xc630('0xd'):zoho[_0x165904](_0x11912c,_0x1c71d3,_0x48896f,_0x49c364,_0x431c7c,_0x4c8336,_0x4f3b6e);break;case _0xc630('0x1c'):desk[_0x165904](_0x11912c,_0x1c71d3,_0x48896f,_0x49c364,_0x431c7c,_0x4c8336,_0x4f3b6e);break;case _0xc630('0xe'):vtiger[_0x165904](_0x11912c,_0x1c71d3,_0x48896f,_0x49c364,_0x431c7c,_0x4c8336,_0x4f3b6e);break;case'freshsales':freshsales['cs'](_0x11912c,_0x1c71d3,_0x48896f,_0x49c364,_0x431c7c,_0x4c8336,_0x4f3b6e,_0x165904);break;case'servicenow':servicenow['cs'](_0x11912c,_0x1c71d3,_0x48896f,_0x49c364,_0x431c7c,_0x4c8336,_0x4f3b6e,_0x165904);break;case _0xc630('0xf'):dynamics365['cs'](_0x11912c,_0x1c71d3,_0x48896f,_0x49c364,_0x431c7c,_0x4c8336,_0x4f3b6e,_0x165904);break;default:console[_0xc630('0x19')](_0xc630('0x1d'));}}else{_0x4eaf3b=require(_0xc630('0x1e'))(_0x11912c[_0xc630('0x13')][_0xc630('0x12')]());_0x4eaf3b[_0xc630('0x1f')](_0xc630('0x20'),util[_0xc630('0x21')](_0xc630('0x22'),_0x11912c[_0xc630('0x13')]['toLowerCase'](),_0x11912c[_0xc630('0x15')]));}}else{_0x4eaf3b=require(_0xc630('0x1e'))(_0x11912c[_0xc630('0x13')][_0xc630('0x12')]());_0x4eaf3b['error'](_0xc630('0x20'),util[_0xc630('0x21')](_0xc630('0x23'),_0x11912c[_0xc630('0x13')]['toLowerCase'](),_0x11912c[_0xc630('0x14')]));}}else{}}catch(_0x46da15){console[_0xc630('0x1f')](_0x46da15);}}}}; \ No newline at end of file +var _0xa69f=['outbound','log','EVENT\x20UNKNOWN','freshdesk','zoho','dynamics365','unknown\x20integration','../../../../config/logger','error','%s\x20configuration\x20#%s\x20not\x20found','[EXEC]','format','%s\x20account\x20#%s\x20not\x20found','./zendesk','./salesforce','./sugarcrm','./zoho','./desk','./vtiger','./dynamics365','zendesk','salesforce','sugarcrm','desk','vtiger','freshsales','servicenow','includes','data1','toLowerCase','data2','Configurations','data3','queue','routeId'];(function(_0x4cfe5a,_0x115f7f){var _0x213a84=function(_0x4daeca){while(--_0x4daeca){_0x4cfe5a['push'](_0x4cfe5a['shift']());}};_0x213a84(++_0x115f7f);}(_0xa69f,0x76));var _0xfa69=function(_0x23458a,_0x3bb49d){_0x23458a=_0x23458a-0x0;var _0x52c43a=_0xa69f[_0x23458a];return _0x52c43a;};'use strict';var _=require('lodash');var util=require('util');var zendesk=require(_0xfa69('0x0'));var salesforce=require(_0xfa69('0x1'));var sugarcrm=require(_0xfa69('0x2'));var freshdesk=require('./freshdesk');var zoho=require(_0xfa69('0x3'));var desk=require(_0xfa69('0x4'));var vtiger=require(_0xfa69('0x5'));var servicenow=require('./servicenow');var dynamics365=require(_0xfa69('0x6'));var freshsales=require('./freshsales');var integrations=[_0xfa69('0x7'),_0xfa69('0x8'),_0xfa69('0x9'),'freshdesk','zoho',_0xfa69('0xa'),_0xfa69('0xb'),'dynamics365',_0xfa69('0xc'),_0xfa69('0xd')];exports['exec']=function(_0xdedacd,_0x415f5d,_0x22fe9f,_0x444e04,_0x366271,_0x3fa76a){if(_0x22fe9f){if(_[_0xfa69('0xe')](integrations,_0xdedacd[_0xfa69('0xf')]['toLowerCase']())){try{var _0x1dcab4=null;var _0x25206f='';var _0x3a089c=_0x22fe9f[_0xdedacd[_0xfa69('0xf')][_0xfa69('0x10')]()];if(_0x3a089c){var _0x2ea19b=_0x3a089c[_0xdedacd[_0xfa69('0x11')]];if(_0x2ea19b){var _0x4298b9=_['find'](_0x2ea19b[_0xfa69('0x12')],{'id':parseInt(_0xdedacd[_0xfa69('0x13')],0xa)});if(_0x4298b9){if(_0x444e04){if(_0x366271&&_0x415f5d[_0xfa69('0x14')]){_0x25206f=_0xfa69('0x14');}else if(_0x415f5d[_0xfa69('0x15')]){_0x25206f=_0xfa69('0x16');}else{console[_0xfa69('0x17')](_0xfa69('0x18'),_0x415f5d);}}else{_0x25206f='unmanaged';}switch(_0xdedacd['data1']['toLowerCase']()){case _0xfa69('0x7'):zendesk[_0x25206f](_0xdedacd,_0x415f5d,_0x4298b9,_0x444e04,_0x366271,_0x2ea19b,_0x3fa76a);break;case _0xfa69('0x8'):salesforce[_0x25206f](_0xdedacd,_0x415f5d,_0x4298b9,_0x444e04,_0x366271,_0x2ea19b,_0x3fa76a);break;case _0xfa69('0x9'):sugarcrm[_0x25206f](_0xdedacd,_0x415f5d,_0x4298b9,_0x444e04,_0x366271,_0x2ea19b,_0x3fa76a);break;case _0xfa69('0x19'):freshdesk[_0x25206f](_0xdedacd,_0x415f5d,_0x4298b9,_0x444e04,_0x366271,_0x2ea19b,_0x3fa76a);break;case _0xfa69('0x1a'):zoho[_0x25206f](_0xdedacd,_0x415f5d,_0x4298b9,_0x444e04,_0x366271,_0x2ea19b,_0x3fa76a);break;case _0xfa69('0xa'):desk[_0x25206f](_0xdedacd,_0x415f5d,_0x4298b9,_0x444e04,_0x366271,_0x2ea19b,_0x3fa76a);break;case _0xfa69('0xb'):vtiger[_0x25206f](_0xdedacd,_0x415f5d,_0x4298b9,_0x444e04,_0x366271,_0x2ea19b,_0x3fa76a);break;case'freshsales':freshsales['cs'](_0xdedacd,_0x415f5d,_0x4298b9,_0x444e04,_0x366271,_0x2ea19b,_0x3fa76a,_0x25206f);break;case _0xfa69('0xd'):servicenow['cs'](_0xdedacd,_0x415f5d,_0x4298b9,_0x444e04,_0x366271,_0x2ea19b,_0x3fa76a,_0x25206f);break;case _0xfa69('0x1b'):dynamics365['cs'](_0xdedacd,_0x415f5d,_0x4298b9,_0x444e04,_0x366271,_0x2ea19b,_0x3fa76a,_0x25206f);break;default:console[_0xfa69('0x17')](_0xfa69('0x1c'));}}else{_0x1dcab4=require(_0xfa69('0x1d'))(_0xdedacd[_0xfa69('0xf')][_0xfa69('0x10')]());_0x1dcab4[_0xfa69('0x1e')]('[EXEC]',util['format'](_0xfa69('0x1f'),_0xdedacd[_0xfa69('0xf')][_0xfa69('0x10')](),_0xdedacd[_0xfa69('0x13')]));}}else{_0x1dcab4=require(_0xfa69('0x1d'))(_0xdedacd[_0xfa69('0xf')][_0xfa69('0x10')]());_0x1dcab4[_0xfa69('0x1e')](_0xfa69('0x20'),util[_0xfa69('0x21')](_0xfa69('0x22'),_0xdedacd[_0xfa69('0xf')][_0xfa69('0x10')](),_0xdedacd[_0xfa69('0x11')]));}}else{}}catch(_0x3f1110){console[_0xfa69('0x1e')](_0x3f1110);}}}}; \ 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 747897c..bc82505 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 _0xc6a9=['getString','Descriptions','ticketType','Task','ActivityDate','IsRecurrence','endUserType','contact','lead','WhoId','WhatId','Case','ContactId','account','leadId','info','create','isNil','sobject','User','find','then','length','Email','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','user_id','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','merge','$or','execute','additionalSearchLead','Lead','additionalSearchAccount','Contact','Account','first','Phone','type','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','','Caller\x20-\x20%s','format','Company','No\x20Company','upperFirst','string','idField','content','toString','variable','variableName','customVariable','Variable','name','password','concat','Connection','remoteUri','https://login.salesforce.com','clientSecret','login','username','Connection\x20established.','queue','serverUrl','stripTrailingSlash','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridname','calleridnum','Fields','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','trigger:salesforce:display','trigger:browser:url','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','outbound','recordingFormat','none','Recording\x20is\x20enabled!','destcalleridnum','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','instanceUrl','Salesforce\x20account\x20type\x20not\x20recognized','[OUTBOUND]','unmanaged','monitor_format','lastevent','toUpperCase',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','moment','bluebird','util','ioredis','./util','../../../../config/environment','../../../../config/logger','salesforce','redis','defaults','localhost','assign'];(function(_0xaf208a,_0x3fce84){var _0x4e1170=function(_0x233b7b){while(--_0x233b7b){_0xaf208a['push'](_0xaf208a['shift']());}};_0x4e1170(++_0x3fce84);}(_0xc6a9,0x160));var _0x9c6a=function(_0xaba9df,_0x5b322f){_0xaba9df=_0xaba9df-0x0;var _0x26e668=_0xc6a9[_0xaba9df];return _0x26e668;};'use strict';var _=require(_0x9c6a('0x0'));var rp=require(_0x9c6a('0x1'));var moment=require(_0x9c6a('0x2'));var BPromise=require(_0x9c6a('0x3'));var md5=require('md5');var jsforce=require('jsforce');var util=require(_0x9c6a('0x4'));var Redis=require(_0x9c6a('0x5'));var intUtil=require(_0x9c6a('0x6'));var config=require(_0x9c6a('0x7'));var logger=require(_0x9c6a('0x8'))(_0x9c6a('0x9'));config[_0x9c6a('0xa')]=_[_0x9c6a('0xb')](config['redis'],{'host':_0x9c6a('0xc'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x9c6a('0xa')]));function emit(_0x396ba1,_0x57924c,_0x194014){io['to'](_0x396ba1)['emit'](_0x57924c,_0x194014);}function getTicket(_0x4f30f5,_0x13f37d,_0x28e838,_0x223333,_0x8c3629,_0xc61731,_0x32ffd1,_0x506297){var _0x5c4a62=Object[_0x9c6a('0xd')]({},{'OwnerId':_0x13f37d['id'],'Subject':intUtil[_0x9c6a('0xe')](_0x223333['Subjects'],_0x8c3629,'\x20'),'Description':intUtil[_0x9c6a('0xe')](_0x223333[_0x9c6a('0xf')],_0x8c3629,'\x0a')},getCustomFields(_0xc61731,_0x8c3629));if(_0x28e838){if(_0x223333[_0x9c6a('0x10')]===_0x9c6a('0x11')){_0x5c4a62[_0x9c6a('0x12')]=moment['utc']();_0x5c4a62['IsReminderSet']=![];_0x5c4a62[_0x9c6a('0x13')]=![];if(_0x28e838[_0x9c6a('0x14')]===_0x9c6a('0x15')||_0x28e838[_0x9c6a('0x14')]===_0x9c6a('0x16')){_0x5c4a62[_0x9c6a('0x17')]=_0x28e838['id'];}else if(_0x28e838[_0x9c6a('0x14')]==='account'){_0x5c4a62[_0x9c6a('0x18')]=_0x28e838['id'];}}else if(_0x223333[_0x9c6a('0x10')]===_0x9c6a('0x19')){if(_0x28e838[_0x9c6a('0x14')]===_0x9c6a('0x15')){_0x5c4a62[_0x9c6a('0x1a')]=_0x28e838['id'];}else if(_0x28e838[_0x9c6a('0x14')]===_0x9c6a('0x1b')){_0x5c4a62['AccountId']=_0x28e838['id'];}else if(_0x28e838[_0x9c6a('0x14')]===_0x9c6a('0x16')&&_0x223333[_0x9c6a('0x1c')]){_0x5c4a62[_0x223333[_0x9c6a('0x1c')]]=_0x28e838['id'];}else{logger[_0x9c6a('0x1d')]('Association\x20between\x20Case\x20and\x20Lead\x20skipped');}}}return _0x32ffd1['sobject'](_0x223333[_0x9c6a('0x10')])[_0x9c6a('0x1e')](_0x5c4a62);}function getUser(_0x27e4d7,_0x31d625,_0x3db761){if(!_[_0x9c6a('0x1f')](_0x31d625)&&intUtil['validateEmail'](_0x31d625)){var _0x324b85={'Email':_0x31d625};var _0x40de32={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x3db761[_0x9c6a('0x20')](_0x9c6a('0x21'))[_0x9c6a('0x22')](_0x324b85,_0x40de32)['execute']()[_0x9c6a('0x23')](function(_0x26284f){if(_0x26284f[_0x9c6a('0x24')]){var _0x4a1830=_[_0x9c6a('0x22')](_0x26284f,function(_0x230573){return _0x230573[_0x9c6a('0x25')]===_0x31d625;});if(_0x4a1830){logger[_0x9c6a('0x1d')]('Agent\x20%s\x20found.',_0x31d625);return BPromise[_0x9c6a('0x26')]({'id':_0x4a1830['Id'],'name':_0x4a1830[_0x9c6a('0x27')]});}}else{logger[_0x9c6a('0x1d')](_0x9c6a('0x28'),_0x31d625);return _0x3db761[_0x9c6a('0x29')]()[_0x9c6a('0x23')](function(_0x4dd9c8){return BPromise['resolve']({'id':_0x4dd9c8[_0x9c6a('0x2a')],'name':_0x4dd9c8[_0x9c6a('0x2b')]});});}});}else{logger[_0x9c6a('0x1d')](_0x9c6a('0x28'),_0x31d625);return _0x3db761['identity']()[_0x9c6a('0x23')](function(_0x32ac22){return BPromise[_0x9c6a('0x26')]({'id':_0x32ac22[_0x9c6a('0x2a')],'name':_0x32ac22[_0x9c6a('0x2b')]});});}}function getEndUser(_0x3b96f4,_0x339307,_0x20bfb9,_0x4490a8,_0x11a30b){var _0x499d47={'$or':{'Phone':_0x4490a8}};var _0xe03cb7={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x9c6a('0x26')]()[_0x9c6a('0x23')](function(){logger[_0x9c6a('0x1d')](_0x9c6a('0x2c'),_0x4490a8,_0x339307['moduleSearch']);switch(_0x339307[_0x9c6a('0x2d')]){case _0x9c6a('0x2e'):var _0x107c4e=_[_0x9c6a('0x2f')](_0x499d47);if(_0x339307[_0x9c6a('0x30')]){var _0x143fc8={};_0x143fc8[_0x339307[_0x9c6a('0x30')]]=_0x4490a8;_[_0x9c6a('0x31')](_0x107c4e[_0x9c6a('0x32')],_0x143fc8);}return _0x11a30b[_0x9c6a('0x20')]('Contact')[_0x9c6a('0x22')](_0x107c4e,_0xe03cb7)[_0x9c6a('0x33')]()[_0x9c6a('0x23')](function(_0x372742){if(_0x372742&&_0x372742['length']){return _0x372742;}else{var _0x1bf7da=_['cloneDeep'](_0x499d47);if(_0x339307['additionalSearchLead']){var _0xc99a17={};_0xc99a17[_0x339307[_0x9c6a('0x34')]]=_0x4490a8;_[_0x9c6a('0x31')](_0x1bf7da['$or'],_0xc99a17);}return _0x11a30b[_0x9c6a('0x20')](_0x9c6a('0x35'))[_0x9c6a('0x22')](_0x1bf7da,_0xe03cb7);}});case'account_contact_lead':var _0x7b6223=_[_0x9c6a('0x2f')](_0x499d47);if(_0x339307['additionalSearchAccount']){var _0x143fc8={};_0x143fc8[_0x339307[_0x9c6a('0x36')]]=_0x4490a8;_[_0x9c6a('0x31')](_0x7b6223['$or'],_0x143fc8);}return _0x11a30b[_0x9c6a('0x20')]('Account')['find'](_0x7b6223,_0xe03cb7)[_0x9c6a('0x33')]()[_0x9c6a('0x23')](function(_0x42c869){if(_0x42c869&&_0x42c869[_0x9c6a('0x24')]){return _0x42c869;}else{var _0x3eb35a=_[_0x9c6a('0x2f')](_0x499d47);if(_0x339307['additionalSearchContact']){var _0x545568={};_0x545568[_0x339307[_0x9c6a('0x30')]]=_0x4490a8;_[_0x9c6a('0x31')](_0x3eb35a['$or'],_0x545568);}return _0x11a30b[_0x9c6a('0x20')](_0x9c6a('0x37'))[_0x9c6a('0x22')](_0x3eb35a,_0xe03cb7)[_0x9c6a('0x23')](function(_0x30cb08){if(_0x30cb08&&_0x30cb08[_0x9c6a('0x24')]){return _0x30cb08;}else{var _0x17353b=_[_0x9c6a('0x2f')](_0x499d47);if(_0x339307[_0x9c6a('0x34')]){var _0x1c344d={};_0x1c344d[_0x339307[_0x9c6a('0x34')]]=_0x4490a8;_[_0x9c6a('0x31')](_0x17353b[_0x9c6a('0x32')],_0x1c344d);}return _0x11a30b['sobject']('Lead')[_0x9c6a('0x22')](_0x17353b,_0xe03cb7);}});}});case _0x9c6a('0x15'):var _0x107c4e=_['cloneDeep'](_0x499d47);if(_0x339307[_0x9c6a('0x30')]){var _0x143fc8={};_0x143fc8[_0x339307[_0x9c6a('0x30')]]=_0x4490a8;_['merge'](_0x107c4e[_0x9c6a('0x32')],_0x143fc8);}return _0x11a30b[_0x9c6a('0x20')]('Contact')[_0x9c6a('0x22')](_0x107c4e,_0xe03cb7)['execute']();case _0x9c6a('0x16'):var _0x375f21=_['cloneDeep'](_0x499d47);if(_0x339307[_0x9c6a('0x34')]){var _0x143fc8={};_0x143fc8[_0x339307[_0x9c6a('0x34')]]=_0x4490a8;_[_0x9c6a('0x31')](_0x375f21[_0x9c6a('0x32')],_0x143fc8);}return _0x11a30b[_0x9c6a('0x20')]('Lead')['find'](_0x375f21,_0xe03cb7);case _0x9c6a('0x1b'):var _0x7b6223=_[_0x9c6a('0x2f')](_0x499d47);if(_0x339307[_0x9c6a('0x36')]){var _0x143fc8={};_0x143fc8[_0x339307[_0x9c6a('0x36')]]=_0x4490a8;_[_0x9c6a('0x31')](_0x7b6223[_0x9c6a('0x32')],_0x143fc8);}return _0x11a30b[_0x9c6a('0x20')](_0x9c6a('0x38'))['find'](_0x7b6223,_0xe03cb7);default:return null;}})[_0x9c6a('0x23')](function(_0x1d9882){if(_0x1d9882&&_0x1d9882['length']){var _0x25e6a1=_[_0x9c6a('0x39')](_0x1d9882);if(_0x25e6a1){return BPromise[_0x9c6a('0x26')]({'id':_0x25e6a1['Id'],'name':_0x25e6a1[_0x9c6a('0x27')],'phone':_0x25e6a1[_0x9c6a('0x3a')],'endUserType':_0x25e6a1['attributes'][_0x9c6a('0x3b')][_0x9c6a('0x3c')]()});}}})[_0x9c6a('0x23')](function(_0x4538b0){if(_0x4538b0){logger[_0x9c6a('0x1d')](_0x9c6a('0x3d'),_0x4538b0[_0x9c6a('0x14')],_0x4490a8);return BPromise[_0x9c6a('0x26')](_0x4538b0);}else{logger[_0x9c6a('0x1d')](_0x9c6a('0x3e'),_0x4490a8);var _0x223c78={'Phone':_0x4490a8};if(_0x339307[_0x9c6a('0x3f')]){if(_0x339307['moduleCreate']==='contact'){logger[_0x9c6a('0x1d')](_0x9c6a('0x40'),_0x4490a8,_0x339307[_0x9c6a('0x3f')]);_0x223c78[_0x9c6a('0x41')]=_0x20bfb9!==_0x9c6a('0x42')?_0x20bfb9:util['format'](_0x9c6a('0x43'),_0x4490a8);}else if(_0x339307[_0x9c6a('0x3f')]==='lead'){logger[_0x9c6a('0x1d')](_0x9c6a('0x40'),_0x4490a8,_0x339307[_0x9c6a('0x3f')]);_0x223c78[_0x9c6a('0x41')]=_0x20bfb9!==_0x9c6a('0x42')?_0x20bfb9:util[_0x9c6a('0x44')](_0x9c6a('0x43'),_0x4490a8);_0x223c78[_0x9c6a('0x45')]=_0x9c6a('0x46');}else if(_0x339307['moduleCreate']===_0x9c6a('0x1b')){logger[_0x9c6a('0x1d')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x4490a8,_0x339307[_0x9c6a('0x3f')]);_0x223c78[_0x9c6a('0x27')]=_0x20bfb9!==_0x9c6a('0x42')?_0x20bfb9:util[_0x9c6a('0x44')]('Caller\x20-\x20%s',_0x4490a8);}else{return null;}}return _0x11a30b[_0x9c6a('0x20')](_[_0x9c6a('0x47')](_0x339307[_0x9c6a('0x3f')]))[_0x9c6a('0x1e')](_0x223c78)[_0x9c6a('0x23')](function(_0x4cd47c){return BPromise[_0x9c6a('0x26')]({'id':_0x4cd47c['id'],'endUserType':_0x339307['moduleCreate']});});}});}function getCustomFields(_0x1ffbfe,_0x16680c){var _0x5dbaf6={};if(_0x1ffbfe[_0x9c6a('0x24')]>0x0){_['forEach'](_0x1ffbfe,function(_0x1b8cd0){if(_['includes']([_0x9c6a('0x48'),'picklist'],_0x1b8cd0[_0x9c6a('0x3b')])&&_0x1b8cd0[_0x9c6a('0x49')]){_0x5dbaf6[_0x1b8cd0[_0x9c6a('0x49')]]=_0x1b8cd0[_0x9c6a('0x4a')][_0x9c6a('0x4b')]();}else if(_0x1b8cd0['type']===_0x9c6a('0x4c')&&_0x1b8cd0['variableName']&&_0x1b8cd0[_0x9c6a('0x49')]){_0x16680c[_0x1b8cd0[_0x9c6a('0x4d')]]&&(_0x5dbaf6[_0x1b8cd0['idField']]=_0x16680c[_0x1b8cd0['variableName']]['toString']());}else if(_0x1b8cd0['type']===_0x9c6a('0x4e')&&_0x1b8cd0['Variable']&&_0x1b8cd0[_0x9c6a('0x4f')][_0x9c6a('0x50')]&&_0x1b8cd0[_0x9c6a('0x49')]){_0x16680c[_0x1b8cd0[_0x9c6a('0x4f')]['name'][_0x9c6a('0x3c')]()]&&(_0x5dbaf6[_0x1b8cd0[_0x9c6a('0x49')]]=_0x16680c[_0x1b8cd0[_0x9c6a('0x4f')][_0x9c6a('0x50')][_0x9c6a('0x3c')]()][_0x9c6a('0x4b')]());}});}return _0x5dbaf6;}function getConnection(_0x3c5f29){var _0x28065c=_0x3c5f29[_0x9c6a('0x51')][_0x9c6a('0x52')](_0x3c5f29['securityToken']);var _0x476257=new jsforce[(_0x9c6a('0x53'))]({'oauth2':{'loginUrl':_0x3c5f29[_0x9c6a('0x54')]||_0x9c6a('0x55'),'clientId':_0x3c5f29['clientId'],'clientSecret':_0x3c5f29[_0x9c6a('0x56')]}});return _0x476257[_0x9c6a('0x57')](_0x3c5f29[_0x9c6a('0x58')],_0x28065c)[_0x9c6a('0x23')](function(){logger['info'](_0x9c6a('0x59'));return _0x476257;});}exports[_0x9c6a('0x5a')]=function(_0xa7a967,_0x28210d,_0x5040a2,_0x1a38b9,_0x20d632,_0x36083a){var _0x10b58c,_0x25a8bb,_0x78b2b6,_0x31e03b;_0x36083a[_0x9c6a('0x5b')]=intUtil[_0x9c6a('0x5c')](_0x36083a[_0x9c6a('0x5b')]);_0x36083a[_0x9c6a('0x54')]=intUtil[_0x9c6a('0x5c')](_0x36083a[_0x9c6a('0x54')]);if(_0x20d632&&_0x20d632['monitor_format']){logger[_0x9c6a('0x1d')](_0x9c6a('0x5d'),'Recording\x20is\x20enabled!');_0x28210d[_0x9c6a('0x5e')]=util[_0x9c6a('0x44')](_0x9c6a('0x5f'),_0x36083a[_0x9c6a('0x5b')],_0x28210d[_0x9c6a('0x60')],md5(_0x28210d[_0x9c6a('0x60')]));}else{_0x28210d[_0x9c6a('0x5e')]='';}return getConnection(_0x36083a)[_0x9c6a('0x23')](function(_0x38cd36){_0x31e03b=_0x38cd36;return getUser(_0x36083a,_0x1a38b9[_0x9c6a('0x61')],_0x31e03b);})[_0x9c6a('0x23')](function(_0x67b871){_0x10b58c=_0x67b871;return getEndUser(_0x36083a,_0x5040a2,_0x28210d[_0x9c6a('0x62')],_0x28210d[_0x9c6a('0x63')],_0x31e03b);})['then'](function(_0x391fa2){_0x25a8bb=_0x391fa2;return getTicket(_0x36083a,_0x10b58c,_0x25a8bb,_0x5040a2,_0x28210d,_0x5040a2[_0x9c6a('0x64')],_0x31e03b,_0x9c6a('0x5a'));})[_0x9c6a('0x23')](function(_0x3b884c){_0x78b2b6=_0x3b884c;logger['info']('[QUEUE]\x20Ticket\x20%s\x20created',_0x78b2b6['id']);logger[_0x9c6a('0x1d')](_0x9c6a('0x65'),_0x78b2b6['id'],_0x1a38b9[_0x9c6a('0x50')],_0x36083a['type']);switch(_0x36083a[_0x9c6a('0x3b')]){case _0x9c6a('0x66'):emit(util['format']('user:%s',_0x1a38b9[_0x9c6a('0x50')]),_0x9c6a('0x67'),{'recordId':_0x78b2b6['id']});break;case'newTab':emit(util[_0x9c6a('0x44')]('user:%s',_0x1a38b9[_0x9c6a('0x50')]),_0x9c6a('0x68'),{'uri':util[_0x9c6a('0x44')]('%s/%s/e',_0x31e03b['instanceUrl'],_0x78b2b6['id'])});break;default:logger[_0x9c6a('0x69')](_0x9c6a('0x6a'));}})[_0x9c6a('0x6b')](function(_0xb2c15b){logger[_0x9c6a('0x69')](_0x9c6a('0x5d'),_0xb2c15b);});};exports[_0x9c6a('0x6c')]=function(_0x3b6af0,_0x3f699e,_0x525e3b,_0x1d8881,_0x5811fc,_0x2d18d7,_0x23d20a){var _0x8e4045,_0x3f2d48,_0x46143e,_0x4496c7;_0x2d18d7[_0x9c6a('0x5b')]=intUtil['stripTrailingSlash'](_0x2d18d7[_0x9c6a('0x5b')]);_0x2d18d7[_0x9c6a('0x54')]=intUtil[_0x9c6a('0x5c')](_0x2d18d7[_0x9c6a('0x54')]);if(_0x23d20a&&_0x23d20a[_0x9c6a('0x6d')]&&_0x23d20a[_0x9c6a('0x6d')]!==_0x9c6a('0x6e')){logger[_0x9c6a('0x1d')]('[OUTBOUND]',_0x9c6a('0x6f'));_0x3f699e[_0x9c6a('0x5e')]=util[_0x9c6a('0x44')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2d18d7['serverUrl'],_0x3f699e[_0x9c6a('0x60')],md5(_0x3f699e['uniqueid']));}return getConnection(_0x2d18d7)[_0x9c6a('0x23')](function(_0x28bd25){_0x4496c7=_0x28bd25;return getUser(_0x2d18d7,_0x1d8881[_0x9c6a('0x61')],_0x4496c7);})[_0x9c6a('0x23')](function(_0x384353){_0x8e4045=_0x384353;return getEndUser(_0x2d18d7,_0x525e3b,_0x3f699e['destcalleridname'],_0x3f699e[_0x9c6a('0x70')],_0x4496c7);})['then'](function(_0x37d766){_0x3f2d48=_0x37d766;return getTicket(_0x2d18d7,_0x8e4045,_0x3f2d48,_0x525e3b,_0x3f699e,_0x525e3b[_0x9c6a('0x64')],_0x4496c7,'outbound');})[_0x9c6a('0x23')](function(_0x5e27ce){_0x46143e=_0x5e27ce;logger['info']('[OUTBOUND]\x20Ticket\x20%s\x20created.',_0x46143e['id']);logger[_0x9c6a('0x1d')](_0x9c6a('0x71'),_0x46143e['id'],_0x1d8881[_0x9c6a('0x50')],_0x2d18d7['type']);switch(_0x2d18d7[_0x9c6a('0x3b')]){case _0x9c6a('0x66'):emit(util[_0x9c6a('0x44')]('user:%s',_0x1d8881[_0x9c6a('0x50')]),'trigger:salesforce:display',{'recordId':_0x46143e['id']});break;case'newTab':emit(util['format']('user:%s',_0x1d8881[_0x9c6a('0x50')]),'trigger:browser:url',{'uri':util['format']('%s/%s/e',_0x4496c7[_0x9c6a('0x72')],_0x46143e['id'])});break;default:logger[_0x9c6a('0x69')]('[OUTBOUND]',_0x9c6a('0x73'));}})['catch'](function(_0x221766){logger['error'](_0x9c6a('0x74'),_0x221766);});};exports[_0x9c6a('0x75')]=function(_0x1a5c47,_0x405f59,_0x409008,_0x25e6ae,_0x5b126c,_0x49d591){var _0x193ad6,_0x5c75f3,_0x14c9cd,_0xc24285;_0x49d591[_0x9c6a('0x5b')]=intUtil[_0x9c6a('0x5c')](_0x49d591[_0x9c6a('0x5b')]);_0x49d591['remoteUri']=intUtil[_0x9c6a('0x5c')](_0x49d591[_0x9c6a('0x54')]);if(_0x5b126c&&_0x5b126c[_0x9c6a('0x76')]){logger[_0x9c6a('0x1d')]('['+_0x405f59[_0x9c6a('0x77')]['toUpperCase']()+']',_0x9c6a('0x6f'));_0x405f59[_0x9c6a('0x5e')]=util[_0x9c6a('0x44')](_0x9c6a('0x5f'),_0x49d591[_0x9c6a('0x5b')],_0x405f59[_0x9c6a('0x60')],md5(_0x405f59[_0x9c6a('0x60')]));}else{_0x405f59[_0x9c6a('0x5e')]='';}return getConnection(_0x49d591)['then'](function(_0x170c89){_0xc24285=_0x170c89;if(!_[_0x9c6a('0x1f')](_0x25e6ae)){return getUser(_0x49d591,_0x25e6ae[_0x9c6a('0x50')],_0xc24285);}else{return getUser(_0x49d591,null,_0xc24285);}})[_0x9c6a('0x23')](function(_0x1235d6){_0x193ad6=_0x1235d6;return getEndUser(_0x49d591,_0x409008,_0x405f59[_0x9c6a('0x62')],_0x405f59['calleridnum'],_0xc24285);})[_0x9c6a('0x23')](function(_0x30b25f){_0x5c75f3=_0x30b25f;return getTicket(_0x49d591,_0x193ad6,_0x5c75f3,_0x409008,_0x405f59,_0x409008['Fields'],_0xc24285);})[_0x9c6a('0x23')](function(_0x4ebac4){_0x14c9cd=_0x4ebac4;logger[_0x9c6a('0x1d')]('['+_0x405f59[_0x9c6a('0x77')][_0x9c6a('0x78')]()+']\x20Ticket\x20%s\x20created.',_0x14c9cd['id']);logger[_0x9c6a('0x1d')]('['+_0x405f59[_0x9c6a('0x77')][_0x9c6a('0x78')]()+_0x9c6a('0x79'),_0x49d591[_0x9c6a('0x3b')]);})[_0x9c6a('0x6b')](function(_0x4de46a){logger[_0x9c6a('0x69')]('['+_0x405f59[_0x9c6a('0x77')][_0x9c6a('0x78')]()+']',_0x4de46a);});}; \ No newline at end of file +var _0xfbdf=['destcalleridnum','outbound','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','%s/%s/e','[OUTBOUND]','Salesforce\x20account\x20type\x20not\x20recognized','monitor_format','toUpperCase','isNil','calleridname','calleridnum','lastevent',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','lodash','moment','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','defaults','redis','localhost','socket.io-emitter','getString','Subjects','Descriptions','ticketType','Task','ActivityDate','utc','IsReminderSet','endUserType','lead','account','WhatId','Case','contact','ContactId','AccountId','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','create','validateEmail','User','find','execute','then','length','Agent\x20%s\x20found.','resolve','Name','identity','display_name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','cloneDeep','additionalSearchContact','$or','Contact','additionalSearchLead','Lead','account_contact_lead','additionalSearchAccount','merge','Account','first','Phone','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.','','format','Caller\x20-\x20%s','Company','upperFirst','forEach','string','picklist','content','variable','variableName','idField','Variable','name','toLowerCase','toString','password','concat','securityToken','Connection','https://login.salesforce.com','clientId','login','username','queue','serverUrl','stripTrailingSlash','remoteUri','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','Fields','[QUEUE]\x20Ticket\x20%s\x20created','trigger:salesforce:display','newTab','user:%s','trigger:browser:url','instanceUrl','error','catch','none','destcalleridname'];(function(_0x3783f3,_0x12ba60){var _0xaf8ccd=function(_0x196808){while(--_0x196808){_0x3783f3['push'](_0x3783f3['shift']());}};_0xaf8ccd(++_0x12ba60);}(_0xfbdf,0x8e));var _0xffbd=function(_0x1bb80c,_0x26d406){_0x1bb80c=_0x1bb80c-0x0;var _0x368f16=_0xfbdf[_0x1bb80c];return _0x368f16;};'use strict';var _=require(_0xffbd('0x0'));var rp=require('request-promise');var moment=require(_0xffbd('0x1'));var BPromise=require('bluebird');var md5=require(_0xffbd('0x2'));var jsforce=require('jsforce');var util=require(_0xffbd('0x3'));var Redis=require(_0xffbd('0x4'));var intUtil=require(_0xffbd('0x5'));var config=require(_0xffbd('0x6'));var logger=require(_0xffbd('0x7'))('salesforce');config['redis']=_[_0xffbd('0x8')](config[_0xffbd('0x9')],{'host':_0xffbd('0xa'),'port':0x18eb});var io=require(_0xffbd('0xb'))(new Redis(config['redis']));function emit(_0x237e28,_0x2e3e93,_0x5a042d){io['to'](_0x237e28)['emit'](_0x2e3e93,_0x5a042d);}function getTicket(_0x44ea50,_0xe37a9e,_0xc11193,_0x1dbd23,_0xa33210,_0x2d2f16,_0x1cc921,_0x1fca51){var _0x2ba64=Object['assign']({},{'OwnerId':_0xe37a9e['id'],'Subject':intUtil[_0xffbd('0xc')](_0x1dbd23[_0xffbd('0xd')],_0xa33210,'\x20'),'Description':intUtil['getString'](_0x1dbd23[_0xffbd('0xe')],_0xa33210,'\x0a')},getCustomFields(_0x2d2f16,_0xa33210));if(_0xc11193){if(_0x1dbd23[_0xffbd('0xf')]===_0xffbd('0x10')){_0x2ba64[_0xffbd('0x11')]=moment[_0xffbd('0x12')]();_0x2ba64[_0xffbd('0x13')]=![];_0x2ba64['IsRecurrence']=![];if(_0xc11193[_0xffbd('0x14')]==='contact'||_0xc11193[_0xffbd('0x14')]===_0xffbd('0x15')){_0x2ba64['WhoId']=_0xc11193['id'];}else if(_0xc11193[_0xffbd('0x14')]===_0xffbd('0x16')){_0x2ba64[_0xffbd('0x17')]=_0xc11193['id'];}}else if(_0x1dbd23['ticketType']===_0xffbd('0x18')){if(_0xc11193[_0xffbd('0x14')]===_0xffbd('0x19')){_0x2ba64[_0xffbd('0x1a')]=_0xc11193['id'];}else if(_0xc11193[_0xffbd('0x14')]===_0xffbd('0x16')){_0x2ba64[_0xffbd('0x1b')]=_0xc11193['id'];}else if(_0xc11193[_0xffbd('0x14')]===_0xffbd('0x15')&&_0x1dbd23['leadId']){_0x2ba64[_0x1dbd23[_0xffbd('0x1c')]]=_0xc11193['id'];}else{logger[_0xffbd('0x1d')](_0xffbd('0x1e'));}}}return _0x1cc921[_0xffbd('0x1f')](_0x1dbd23[_0xffbd('0xf')])[_0xffbd('0x20')](_0x2ba64);}function getUser(_0x395bbc,_0x54a75e,_0x552a89){if(!_['isNil'](_0x54a75e)&&intUtil[_0xffbd('0x21')](_0x54a75e)){var _0x140b24={'Email':_0x54a75e};var _0xde92a6={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x552a89[_0xffbd('0x1f')](_0xffbd('0x22'))[_0xffbd('0x23')](_0x140b24,_0xde92a6)[_0xffbd('0x24')]()[_0xffbd('0x25')](function(_0x2d2ead){if(_0x2d2ead[_0xffbd('0x26')]){var _0x4502cf=_[_0xffbd('0x23')](_0x2d2ead,function(_0x47bb48){return _0x47bb48['Email']===_0x54a75e;});if(_0x4502cf){logger[_0xffbd('0x1d')](_0xffbd('0x27'),_0x54a75e);return BPromise[_0xffbd('0x28')]({'id':_0x4502cf['Id'],'name':_0x4502cf[_0xffbd('0x29')]});}}else{logger[_0xffbd('0x1d')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x54a75e);return _0x552a89[_0xffbd('0x2a')]()[_0xffbd('0x25')](function(_0x280492){return BPromise[_0xffbd('0x28')]({'id':_0x280492['user_id'],'name':_0x280492[_0xffbd('0x2b')]});});}});}else{logger[_0xffbd('0x1d')](_0xffbd('0x2c'),_0x54a75e);return _0x552a89[_0xffbd('0x2a')]()[_0xffbd('0x25')](function(_0x2f03de){return BPromise[_0xffbd('0x28')]({'id':_0x2f03de['user_id'],'name':_0x2f03de[_0xffbd('0x2b')]});});}}function getEndUser(_0x544089,_0x508843,_0x57656d,_0x1ceefa,_0x3ec460){var _0x51c757={'$or':{'Phone':_0x1ceefa}};var _0x40ca83={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0xffbd('0x28')]()['then'](function(){logger[_0xffbd('0x1d')](_0xffbd('0x2d'),_0x1ceefa,_0x508843[_0xffbd('0x2e')]);switch(_0x508843[_0xffbd('0x2e')]){case'contact_lead':var _0xe3ede4=_[_0xffbd('0x2f')](_0x51c757);if(_0x508843[_0xffbd('0x30')]){var _0x31f1b6={};_0x31f1b6[_0x508843['additionalSearchContact']]=_0x1ceefa;_['merge'](_0xe3ede4[_0xffbd('0x31')],_0x31f1b6);}return _0x3ec460[_0xffbd('0x1f')](_0xffbd('0x32'))['find'](_0xe3ede4,_0x40ca83)[_0xffbd('0x24')]()[_0xffbd('0x25')](function(_0x4dd9ba){if(_0x4dd9ba&&_0x4dd9ba[_0xffbd('0x26')]){return _0x4dd9ba;}else{var _0x1affe2=_[_0xffbd('0x2f')](_0x51c757);if(_0x508843[_0xffbd('0x33')]){var _0x56f889={};_0x56f889[_0x508843[_0xffbd('0x33')]]=_0x1ceefa;_['merge'](_0x1affe2[_0xffbd('0x31')],_0x56f889);}return _0x3ec460[_0xffbd('0x1f')](_0xffbd('0x34'))['find'](_0x1affe2,_0x40ca83);}});case _0xffbd('0x35'):var _0x4d04ca=_['cloneDeep'](_0x51c757);if(_0x508843['additionalSearchAccount']){var _0x31f1b6={};_0x31f1b6[_0x508843[_0xffbd('0x36')]]=_0x1ceefa;_[_0xffbd('0x37')](_0x4d04ca[_0xffbd('0x31')],_0x31f1b6);}return _0x3ec460[_0xffbd('0x1f')]('Account')['find'](_0x4d04ca,_0x40ca83)[_0xffbd('0x24')]()[_0xffbd('0x25')](function(_0x43f235){if(_0x43f235&&_0x43f235['length']){return _0x43f235;}else{var _0x2341d8=_[_0xffbd('0x2f')](_0x51c757);if(_0x508843[_0xffbd('0x30')]){var _0x5d12e4={};_0x5d12e4[_0x508843[_0xffbd('0x30')]]=_0x1ceefa;_[_0xffbd('0x37')](_0x2341d8[_0xffbd('0x31')],_0x5d12e4);}return _0x3ec460[_0xffbd('0x1f')](_0xffbd('0x32'))['find'](_0x2341d8,_0x40ca83)[_0xffbd('0x25')](function(_0x39bbc9){if(_0x39bbc9&&_0x39bbc9[_0xffbd('0x26')]){return _0x39bbc9;}else{var _0x4938a1=_['cloneDeep'](_0x51c757);if(_0x508843[_0xffbd('0x33')]){var _0x362ecb={};_0x362ecb[_0x508843[_0xffbd('0x33')]]=_0x1ceefa;_[_0xffbd('0x37')](_0x4938a1['$or'],_0x362ecb);}return _0x3ec460[_0xffbd('0x1f')](_0xffbd('0x34'))[_0xffbd('0x23')](_0x4938a1,_0x40ca83);}});}});case'contact':var _0xe3ede4=_['cloneDeep'](_0x51c757);if(_0x508843[_0xffbd('0x30')]){var _0x31f1b6={};_0x31f1b6[_0x508843[_0xffbd('0x30')]]=_0x1ceefa;_[_0xffbd('0x37')](_0xe3ede4['$or'],_0x31f1b6);}return _0x3ec460[_0xffbd('0x1f')](_0xffbd('0x32'))[_0xffbd('0x23')](_0xe3ede4,_0x40ca83)[_0xffbd('0x24')]();case _0xffbd('0x15'):var _0x55427e=_[_0xffbd('0x2f')](_0x51c757);if(_0x508843[_0xffbd('0x33')]){var _0x31f1b6={};_0x31f1b6[_0x508843[_0xffbd('0x33')]]=_0x1ceefa;_[_0xffbd('0x37')](_0x55427e['$or'],_0x31f1b6);}return _0x3ec460[_0xffbd('0x1f')]('Lead')['find'](_0x55427e,_0x40ca83);case _0xffbd('0x16'):var _0x4d04ca=_['cloneDeep'](_0x51c757);if(_0x508843[_0xffbd('0x36')]){var _0x31f1b6={};_0x31f1b6[_0x508843['additionalSearchAccount']]=_0x1ceefa;_[_0xffbd('0x37')](_0x4d04ca[_0xffbd('0x31')],_0x31f1b6);}return _0x3ec460[_0xffbd('0x1f')](_0xffbd('0x38'))[_0xffbd('0x23')](_0x4d04ca,_0x40ca83);default:return null;}})[_0xffbd('0x25')](function(_0x55eb4f){if(_0x55eb4f&&_0x55eb4f[_0xffbd('0x26')]){var _0x45a0dd=_[_0xffbd('0x39')](_0x55eb4f);if(_0x45a0dd){return BPromise[_0xffbd('0x28')]({'id':_0x45a0dd['Id'],'name':_0x45a0dd[_0xffbd('0x29')],'phone':_0x45a0dd[_0xffbd('0x3a')],'endUserType':_0x45a0dd[_0xffbd('0x3b')][_0xffbd('0x3c')]['toLowerCase']()});}}})['then'](function(_0x40db65){if(_0x40db65){logger[_0xffbd('0x1d')](_0xffbd('0x3d'),_0x40db65[_0xffbd('0x14')],_0x1ceefa);return BPromise[_0xffbd('0x28')](_0x40db65);}else{logger[_0xffbd('0x1d')](_0xffbd('0x3e'),_0x1ceefa);var _0x19fa91={'Phone':_0x1ceefa};if(_0x508843['moduleCreate']){if(_0x508843[_0xffbd('0x3f')]===_0xffbd('0x19')){logger[_0xffbd('0x1d')](_0xffbd('0x40'),_0x1ceefa,_0x508843['moduleCreate']);_0x19fa91['LastName']=_0x57656d!==_0xffbd('0x41')?_0x57656d:util[_0xffbd('0x42')]('Caller\x20-\x20%s',_0x1ceefa);}else if(_0x508843[_0xffbd('0x3f')]===_0xffbd('0x15')){logger[_0xffbd('0x1d')](_0xffbd('0x40'),_0x1ceefa,_0x508843[_0xffbd('0x3f')]);_0x19fa91['LastName']=_0x57656d!==''?_0x57656d:util['format'](_0xffbd('0x43'),_0x1ceefa);_0x19fa91[_0xffbd('0x44')]='No\x20Company';}else if(_0x508843['moduleCreate']===_0xffbd('0x16')){logger['info'](_0xffbd('0x40'),_0x1ceefa,_0x508843['moduleCreate']);_0x19fa91[_0xffbd('0x29')]=_0x57656d!==_0xffbd('0x41')?_0x57656d:util[_0xffbd('0x42')](_0xffbd('0x43'),_0x1ceefa);}else{return null;}}return _0x3ec460[_0xffbd('0x1f')](_[_0xffbd('0x45')](_0x508843['moduleCreate']))[_0xffbd('0x20')](_0x19fa91)[_0xffbd('0x25')](function(_0x2dd85f){return BPromise[_0xffbd('0x28')]({'id':_0x2dd85f['id'],'endUserType':_0x508843['moduleCreate']});});}});}function getCustomFields(_0x36f1fa,_0x26e94c){var _0x321909={};if(_0x36f1fa[_0xffbd('0x26')]>0x0){_[_0xffbd('0x46')](_0x36f1fa,function(_0x4e8a97){if(_['includes']([_0xffbd('0x47'),_0xffbd('0x48')],_0x4e8a97[_0xffbd('0x3c')])&&_0x4e8a97['idField']){_0x321909[_0x4e8a97['idField']]=_0x4e8a97[_0xffbd('0x49')]['toString']();}else if(_0x4e8a97['type']===_0xffbd('0x4a')&&_0x4e8a97[_0xffbd('0x4b')]&&_0x4e8a97[_0xffbd('0x4c')]){_0x26e94c[_0x4e8a97[_0xffbd('0x4b')]]&&(_0x321909[_0x4e8a97[_0xffbd('0x4c')]]=_0x26e94c[_0x4e8a97[_0xffbd('0x4b')]]['toString']());}else if(_0x4e8a97['type']==='customVariable'&&_0x4e8a97[_0xffbd('0x4d')]&&_0x4e8a97[_0xffbd('0x4d')][_0xffbd('0x4e')]&&_0x4e8a97['idField']){_0x26e94c[_0x4e8a97[_0xffbd('0x4d')][_0xffbd('0x4e')][_0xffbd('0x4f')]()]&&(_0x321909[_0x4e8a97[_0xffbd('0x4c')]]=_0x26e94c[_0x4e8a97['Variable']['name']['toLowerCase']()][_0xffbd('0x50')]());}});}return _0x321909;}function getConnection(_0x3d369c){var _0x226f68=_0x3d369c[_0xffbd('0x51')][_0xffbd('0x52')](_0x3d369c[_0xffbd('0x53')]);var _0x7630c=new jsforce[(_0xffbd('0x54'))]({'oauth2':{'loginUrl':_0x3d369c['remoteUri']||_0xffbd('0x55'),'clientId':_0x3d369c[_0xffbd('0x56')],'clientSecret':_0x3d369c['clientSecret']}});return _0x7630c[_0xffbd('0x57')](_0x3d369c[_0xffbd('0x58')],_0x226f68)['then'](function(){logger[_0xffbd('0x1d')]('Connection\x20established.');return _0x7630c;});}exports[_0xffbd('0x59')]=function(_0x10c6de,_0x232e5b,_0x27dea3,_0x314183,_0xaf8c1,_0xa9ecec){var _0x5435a2,_0x26d517,_0x2789a8,_0x3f67a1;_0xa9ecec[_0xffbd('0x5a')]=intUtil[_0xffbd('0x5b')](_0xa9ecec[_0xffbd('0x5a')]);_0xa9ecec[_0xffbd('0x5c')]=intUtil[_0xffbd('0x5b')](_0xa9ecec['remoteUri']);if(_0xaf8c1&&_0xaf8c1['monitor_format']){logger[_0xffbd('0x1d')](_0xffbd('0x5d'),_0xffbd('0x5e'));_0x232e5b[_0xffbd('0x5f')]=util[_0xffbd('0x42')](_0xffbd('0x60'),_0xa9ecec[_0xffbd('0x5a')],_0x232e5b[_0xffbd('0x61')],md5(_0x232e5b[_0xffbd('0x61')]));}else{_0x232e5b[_0xffbd('0x5f')]='';}return getConnection(_0xa9ecec)['then'](function(_0x2d58b6){_0x3f67a1=_0x2d58b6;return getUser(_0xa9ecec,_0x314183[_0xffbd('0x62')],_0x3f67a1);})[_0xffbd('0x25')](function(_0x5a98ba){_0x5435a2=_0x5a98ba;return getEndUser(_0xa9ecec,_0x27dea3,_0x232e5b['calleridname'],_0x232e5b['calleridnum'],_0x3f67a1);})[_0xffbd('0x25')](function(_0x55e586){_0x26d517=_0x55e586;return getTicket(_0xa9ecec,_0x5435a2,_0x26d517,_0x27dea3,_0x232e5b,_0x27dea3[_0xffbd('0x63')],_0x3f67a1,_0xffbd('0x59'));})[_0xffbd('0x25')](function(_0x1b3ad6){_0x2789a8=_0x1b3ad6;logger[_0xffbd('0x1d')](_0xffbd('0x64'),_0x2789a8['id']);logger[_0xffbd('0x1d')]('[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x2789a8['id'],_0x314183[_0xffbd('0x4e')],_0xa9ecec[_0xffbd('0x3c')]);switch(_0xa9ecec[_0xffbd('0x3c')]){case'integrationTab':emit(util['format']('user:%s',_0x314183[_0xffbd('0x4e')]),_0xffbd('0x65'),{'recordId':_0x2789a8['id']});break;case _0xffbd('0x66'):emit(util['format'](_0xffbd('0x67'),_0x314183['name']),_0xffbd('0x68'),{'uri':util[_0xffbd('0x42')]('%s/%s/e',_0x3f67a1[_0xffbd('0x69')],_0x2789a8['id'])});break;default:logger[_0xffbd('0x6a')]('[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.');}})[_0xffbd('0x6b')](function(_0x20e6bd){logger[_0xffbd('0x6a')](_0xffbd('0x5d'),_0x20e6bd);});};exports['outbound']=function(_0x559e81,_0x3d5ed1,_0x9ea736,_0x4239ba,_0x214726,_0x4bad0f,_0x43cc19){var _0x512ea2,_0x155a5d,_0x42a3d5,_0xf66c5a;_0x4bad0f[_0xffbd('0x5a')]=intUtil[_0xffbd('0x5b')](_0x4bad0f['serverUrl']);_0x4bad0f[_0xffbd('0x5c')]=intUtil[_0xffbd('0x5b')](_0x4bad0f[_0xffbd('0x5c')]);if(_0x43cc19&&_0x43cc19['recordingFormat']&&_0x43cc19['recordingFormat']!==_0xffbd('0x6c')){logger[_0xffbd('0x1d')]('[OUTBOUND]',_0xffbd('0x5e'));_0x3d5ed1[_0xffbd('0x5f')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4bad0f['serverUrl'],_0x3d5ed1['uniqueid'],md5(_0x3d5ed1[_0xffbd('0x61')]));}return getConnection(_0x4bad0f)[_0xffbd('0x25')](function(_0xbfde4e){_0xf66c5a=_0xbfde4e;return getUser(_0x4bad0f,_0x4239ba[_0xffbd('0x62')],_0xf66c5a);})[_0xffbd('0x25')](function(_0x36e713){_0x512ea2=_0x36e713;return getEndUser(_0x4bad0f,_0x9ea736,_0x3d5ed1[_0xffbd('0x6d')],_0x3d5ed1[_0xffbd('0x6e')],_0xf66c5a);})['then'](function(_0x3921ae){_0x155a5d=_0x3921ae;return getTicket(_0x4bad0f,_0x512ea2,_0x155a5d,_0x9ea736,_0x3d5ed1,_0x9ea736[_0xffbd('0x63')],_0xf66c5a,_0xffbd('0x6f'));})[_0xffbd('0x25')](function(_0x24a1e7){_0x42a3d5=_0x24a1e7;logger[_0xffbd('0x1d')](_0xffbd('0x70'),_0x42a3d5['id']);logger[_0xffbd('0x1d')](_0xffbd('0x71'),_0x42a3d5['id'],_0x4239ba[_0xffbd('0x4e')],_0x4bad0f[_0xffbd('0x3c')]);switch(_0x4bad0f[_0xffbd('0x3c')]){case _0xffbd('0x72'):emit(util[_0xffbd('0x42')](_0xffbd('0x67'),_0x4239ba[_0xffbd('0x4e')]),'trigger:salesforce:display',{'recordId':_0x42a3d5['id']});break;case _0xffbd('0x66'):emit(util['format'](_0xffbd('0x67'),_0x4239ba['name']),_0xffbd('0x68'),{'uri':util['format'](_0xffbd('0x73'),_0xf66c5a['instanceUrl'],_0x42a3d5['id'])});break;default:logger[_0xffbd('0x6a')](_0xffbd('0x74'),_0xffbd('0x75'));}})[_0xffbd('0x6b')](function(_0x1cb1bb){logger[_0xffbd('0x6a')](_0xffbd('0x74'),_0x1cb1bb);});};exports['unmanaged']=function(_0x5efe0f,_0x2a9f30,_0x28a814,_0xcfc76c,_0x57c70e,_0x5c71c5){var _0x5cb235,_0x3db8f0,_0x5ba2a0,_0x45c931;_0x5c71c5[_0xffbd('0x5a')]=intUtil['stripTrailingSlash'](_0x5c71c5[_0xffbd('0x5a')]);_0x5c71c5[_0xffbd('0x5c')]=intUtil[_0xffbd('0x5b')](_0x5c71c5[_0xffbd('0x5c')]);if(_0x57c70e&&_0x57c70e[_0xffbd('0x76')]){logger[_0xffbd('0x1d')]('['+_0x2a9f30['lastevent'][_0xffbd('0x77')]()+']',_0xffbd('0x5e'));_0x2a9f30['recordingURL']=util[_0xffbd('0x42')](_0xffbd('0x60'),_0x5c71c5[_0xffbd('0x5a')],_0x2a9f30[_0xffbd('0x61')],md5(_0x2a9f30[_0xffbd('0x61')]));}else{_0x2a9f30[_0xffbd('0x5f')]='';}return getConnection(_0x5c71c5)[_0xffbd('0x25')](function(_0x3c43bf){_0x45c931=_0x3c43bf;if(!_[_0xffbd('0x78')](_0xcfc76c)){return getUser(_0x5c71c5,_0xcfc76c['name'],_0x45c931);}else{return getUser(_0x5c71c5,null,_0x45c931);}})['then'](function(_0x5e6109){_0x5cb235=_0x5e6109;return getEndUser(_0x5c71c5,_0x28a814,_0x2a9f30[_0xffbd('0x79')],_0x2a9f30[_0xffbd('0x7a')],_0x45c931);})[_0xffbd('0x25')](function(_0xddff80){_0x3db8f0=_0xddff80;return getTicket(_0x5c71c5,_0x5cb235,_0x3db8f0,_0x28a814,_0x2a9f30,_0x28a814['Fields'],_0x45c931);})[_0xffbd('0x25')](function(_0x2da8ad){_0x5ba2a0=_0x2da8ad;logger[_0xffbd('0x1d')]('['+_0x2a9f30[_0xffbd('0x7b')][_0xffbd('0x77')]()+_0xffbd('0x7c'),_0x5ba2a0['id']);logger[_0xffbd('0x1d')]('['+_0x2a9f30[_0xffbd('0x7b')][_0xffbd('0x77')]()+_0xffbd('0x7d'),_0x5c71c5[_0xffbd('0x3c')]);})[_0xffbd('0x6b')](function(_0x270257){logger[_0xffbd('0x6a')]('['+_0x2a9f30[_0xffbd('0x7b')][_0xffbd('0x77')]()+']',_0x270257);});}; \ 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 249bc02..ac74a8c 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 _0xd2f2=['map','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','user:%s','username','password','sysparm_limit=1','sysparm_display_value=true','remoteUri','serverUrl','%s/api/now/table/','isNil','email','calleridnum','callDirection','queue','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','format','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','inspect','lodash','bluebird','request-promise','util','ioredis','./util','../../../../config/environment','../../../../config/logger','servicenow','defaults','redis','socket.io-emitter','GET','sys_user?sysparm_query=user_name%3Dadmin','then','result','adminId','sys_id','info','],\x20getAdminUser\x20crm','catch','error','toUpperCase','message','],\x20getUser\x20input\x20crm','validateEmail','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','active','true','userId',']\x20using\x20admin\x20profile','adminEmail','],\x20createEndUser\x20input\x20crm','POST','endUserNumber','user','System','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','length','forEach','includes','string','picklist','type','nameField','customField','toLowerCase','content','toString','idField','variable','variableName','Variable','name',']\x20getTicket\x20input\x20crm','outbound','Subjects','getString','Descriptions','ticketId','ticketNumber','number','label','?sysparm_query=name%3D','incident','Incident','Incident\x20-\x20','push','all','Tags'];(function(_0x5a490f,_0x52860e){var _0x21d772=function(_0x1d8269){while(--_0x1d8269){_0x5a490f['push'](_0x5a490f['shift']());}};_0x21d772(++_0x52860e);}(_0xd2f2,0x1c5));var _0x2d2f=function(_0x4b241a,_0x3267c4){_0x4b241a=_0x4b241a-0x0;var _0x16e18f=_0xd2f2[_0x4b241a];return _0x16e18f;};'use strict';var _=require(_0x2d2f('0x0'));var Promise=require(_0x2d2f('0x1'));var rp=require(_0x2d2f('0x2'));var util=require(_0x2d2f('0x3'));var md5=require('md5');var Redis=require(_0x2d2f('0x4'));var intUtil=require(_0x2d2f('0x5'));var config=require(_0x2d2f('0x6'));var logger=require(_0x2d2f('0x7'))(_0x2d2f('0x8'));config['redis']=_[_0x2d2f('0x9')](config[_0x2d2f('0xa')],{'host':'localhost','port':0x18eb});var io=require(_0x2d2f('0xb'))(new Redis(config[_0x2d2f('0xa')]));function getAdminUser(_0x347245,_0x594732,_0x7a5268,_0xbac73a,_0x519c8f,_0xa2c615){return new Promise(function(_0x4b73e4,_0x35411c){var _0x2b8bfc={'method':_0x2d2f('0xc'),'uri':_0xbac73a+_0x2d2f('0xd')+'&'+_0x519c8f+'&'+_0xa2c615,'auth':_0x594732,'json':!![]};return rp(_0x2b8bfc)[_0x2d2f('0xe')](function(_0x1eb27e){if(_0x1eb27e[_0x2d2f('0xf')]['length']>0x0){_0x7a5268[_0x2d2f('0x10')]=_0x1eb27e[_0x2d2f('0xf')][0x0][_0x2d2f('0x11')];}logger[_0x2d2f('0x12')]('['+[_0x347245['toUpperCase']()]+_0x2d2f('0x13'),_0x7a5268);_0x4b73e4(_0x7a5268);})[_0x2d2f('0x14')](function(_0xfcd1d9){logger[_0x2d2f('0x15')]('['+[_0x347245[_0x2d2f('0x16')]()]+']',_0xfcd1d9[_0x2d2f('0x17')]);_0x35411c(_0xfcd1d9['message']);});});}function getUser(_0x58e7ff,_0xa5fda0,_0x303975,_0x45d4f9,_0x337900){return function(_0x32630d){logger[_0x2d2f('0x12')]('['+[_0x58e7ff[_0x2d2f('0x16')]()]+_0x2d2f('0x18'),_0x32630d);return new Promise(function(_0x2b67b6,_0x4d5439){if(intUtil[_0x2d2f('0x19')](_0x32630d[_0x2d2f('0x1a')])){var _0x43500d={'method':_0x2d2f('0xc'),'uri':_0x303975+_0x2d2f('0x1b')+_0x32630d['userEmail']+'&'+_0x45d4f9+'&'+_0x337900,'auth':_0xa5fda0,'json':!![]};logger[_0x2d2f('0x12')]('['+[_0x58e7ff[_0x2d2f('0x16')]()]+_0x2d2f('0x1c'),_0x43500d);return rp(_0x43500d)[_0x2d2f('0xe')](function(_0x17bc55){logger[_0x2d2f('0x12')]('['+[_0x58e7ff['toUpperCase']()]+_0x2d2f('0x1d'),_0x17bc55);if(_0x17bc55[_0x2d2f('0xf')]['length']>0x0&&String(_0x17bc55['result'][0x0][_0x2d2f('0x1e')])===_0x2d2f('0x1f')){_0x32630d[_0x2d2f('0x20')]=_0x17bc55['result'][0x0][_0x2d2f('0x11')];}else{_0x32630d[_0x2d2f('0x20')]=_0x32630d[_0x2d2f('0x10')];_0x32630d['userEmail']=_0x32630d['adminEmail'];}logger['info']('['+[_0x58e7ff[_0x2d2f('0x16')]()]+'],\x20getUser\x20crm',_0x32630d);_0x2b67b6(_0x32630d);})['catch'](function(_0x1ad286){logger[_0x2d2f('0x15')]('['+[_0x58e7ff[_0x2d2f('0x16')]()]+']',_0x1ad286[_0x2d2f('0x17')]);_0x4d5439(_0x1ad286[_0x2d2f('0x17')]);});}else{logger[_0x2d2f('0x12')]('['+[_0x58e7ff[_0x2d2f('0x16')]()]+_0x2d2f('0x21'));_0x32630d[_0x2d2f('0x20')]=_0x32630d['adminId'];_0x32630d[_0x2d2f('0x1a')]=_0x32630d[_0x2d2f('0x22')];_0x2b67b6(_0x32630d);}});};}function createEndUser(_0x12713b,_0x35ef94,_0x26e60e,_0x1f1190,_0x5d4d9a){logger[_0x2d2f('0x12')]('['+[_0x12713b[_0x2d2f('0x16')]()]+_0x2d2f('0x23'),_0x26e60e);return new Promise(function(_0x41a592,_0x23e016){var _0x5c9e26={'method':_0x2d2f('0x24'),'uri':_0x1f1190+'sys_user?'+_0x5d4d9a,'body':{'user_name':_0x26e60e[_0x2d2f('0x25')],'roles':_0x2d2f('0x26'),'first_name':_0x26e60e[_0x2d2f('0x25')],'active':_0x2d2f('0x1f'),'date_format':_0x2d2f('0x27'),'phone':_0x26e60e['endUserNumber']},'auth':_0x35ef94,'json':!![]};return rp(_0x5c9e26)[_0x2d2f('0xe')](function(_0x462179){logger['info']('['+[_0x12713b[_0x2d2f('0x16')]()]+_0x2d2f('0x28'),_0x462179[_0x2d2f('0xf')]);_0x26e60e[_0x2d2f('0x29')]=_0x462179[_0x2d2f('0xf')][_0x2d2f('0x11')];_0x41a592(_0x26e60e);})['catch'](function(_0x5b31a7){logger[_0x2d2f('0x15')]('['+[_0x12713b[_0x2d2f('0x16')]()]+']',_0x5b31a7[_0x2d2f('0x17')]);_0x23e016(_0x5b31a7[_0x2d2f('0x17')]);});});}function getEndUser(_0x267d69,_0x3e3952,_0x18356c,_0x4c4a8f,_0x51d6f0){return function(_0x15d55e){logger[_0x2d2f('0x12')]('['+[_0x267d69[_0x2d2f('0x16')]()]+_0x2d2f('0x2a'),_0x15d55e);return new Promise(function(_0x3276b9,_0x4900f7){var _0x491306={'method':'GET','uri':_0x18356c+'sys_user?sysparm_query=phone%3D'+_0x15d55e[_0x2d2f('0x25')]+'&'+_0x4c4a8f+'&'+_0x51d6f0,'auth':_0x3e3952,'json':!![]};return rp(_0x491306)['then'](function(_0x47102e){if(_0x47102e[_0x2d2f('0xf')]['length']>0x0){_0x15d55e[_0x2d2f('0x29')]=_0x47102e[_0x2d2f('0xf')][0x0]['sys_id'];logger[_0x2d2f('0x12')]('['+[_0x267d69[_0x2d2f('0x16')]()]+_0x2d2f('0x2b'),_0x15d55e);_0x3276b9(_0x15d55e);}else{return createEndUser(_0x267d69,_0x3e3952,_0x15d55e,_0x18356c,_0x4c4a8f)[_0x2d2f('0xe')](function(_0x14cd44){logger[_0x2d2f('0x12')]('['+[_0x267d69[_0x2d2f('0x16')]()]+_0x2d2f('0x2c'),_0x14cd44);_0x3276b9(_0x14cd44);});}})[_0x2d2f('0x14')](function(_0x5783fa){logger[_0x2d2f('0x15')]('['+[_0x267d69['toUpperCase']()]+']',_0x5783fa[_0x2d2f('0x17')]);_0x4900f7(_0x5783fa[_0x2d2f('0x17')]);});});};}function getCustomFields(_0x15d7ad,_0x13885e){var _0x3f4ecf={};if(_0x15d7ad[_0x2d2f('0x2d')]>0x0){_[_0x2d2f('0x2e')](_0x15d7ad,function(_0x5d4408){if(_[_0x2d2f('0x2f')]([_0x2d2f('0x30'),_0x2d2f('0x31')],_0x5d4408[_0x2d2f('0x32')])&&_0x5d4408[_0x2d2f('0x33')]&&!_0x5d4408[_0x2d2f('0x34')]){_0x3f4ecf[_0x5d4408['nameField'][_0x2d2f('0x35')]()]=_0x5d4408[_0x2d2f('0x36')][_0x2d2f('0x37')]();}else if(_[_0x2d2f('0x2f')](['string',_0x2d2f('0x31')],_0x5d4408[_0x2d2f('0x32')])&&_0x5d4408[_0x2d2f('0x38')]&&_0x5d4408[_0x2d2f('0x34')]){_0x3f4ecf[_0x5d4408['idField'][_0x2d2f('0x35')]()]=_0x5d4408[_0x2d2f('0x36')][_0x2d2f('0x37')]();}else if(_0x5d4408[_0x2d2f('0x32')]===_0x2d2f('0x39')&&_0x5d4408['variableName']&&_0x5d4408[_0x2d2f('0x38')]&&_0x5d4408[_0x2d2f('0x34')]){_0x3f4ecf[_0x5d4408['idField'][_0x2d2f('0x35')]()]=_0x13885e[_0x5d4408[_0x2d2f('0x3a')]]['toString']();}else if(_0x5d4408[_0x2d2f('0x32')]==='customVariable'&&_0x5d4408[_0x2d2f('0x3b')]&&_0x5d4408['Variable'][_0x2d2f('0x3c')]&&_0x5d4408[_0x2d2f('0x38')]&&_0x5d4408[_0x2d2f('0x34')]){_0x3f4ecf[_0x5d4408[_0x2d2f('0x38')][_0x2d2f('0x35')]()]=_0x13885e[_0x5d4408[_0x2d2f('0x3b')][_0x2d2f('0x3c')][_0x2d2f('0x35')]()][_0x2d2f('0x37')]();}});}return _0x3f4ecf;}function getTicket(_0x37455c,_0x4049f6,_0x11038b,_0x113f29,_0x1ce75f,_0x317c00){return function(_0x2970fa){logger[_0x2d2f('0x12')]('['+[_0x37455c[_0x2d2f('0x16')]()]+_0x2d2f('0x3d'),_0x2970fa);return new Promise(function(_0x483f2e,_0x27b196){var _0x3dc893=_0x37455c['toLowerCase']()===_0x2d2f('0x3e')?_0x2970fa['userId']:_0x2970fa['endUserId'];var _0x1071b5={'method':_0x2d2f('0x24'),'uri':_0x11038b+'incident'+'?'+_0x317c00,'body':Object['assign']({},{'active':_0x2d2f('0x1f'),'caller_id':_0x3dc893,'assigned_to':_0x2970fa[_0x2d2f('0x20')],'short_description':intUtil['getString'](_0x113f29[_0x2d2f('0x3f')],_0x1ce75f,'\x20'),'description':intUtil[_0x2d2f('0x40')](_0x113f29[_0x2d2f('0x41')],_0x1ce75f,'\x0a')},getCustomFields(_0x113f29['Fields'],_0x1ce75f)),'auth':_0x4049f6,'json':!![]};return rp(_0x1071b5)['then'](function(_0x32de36){logger[_0x2d2f('0x12')]('['+[_0x37455c[_0x2d2f('0x16')]()]+']\x20POST\x20incident\x20entity\x20schema',_0x32de36['result']);_0x2970fa[_0x2d2f('0x42')]=_0x32de36[_0x2d2f('0xf')]['sys_id'];_0x2970fa[_0x2d2f('0x43')]=_0x32de36[_0x2d2f('0xf')][_0x2d2f('0x44')];logger['info']('['+[_0x37455c[_0x2d2f('0x16')]()]+']\x20getTicket\x20crm',_0x2970fa);_0x483f2e(_0x2970fa);})[_0x2d2f('0x14')](function(_0x114965){logger[_0x2d2f('0x15')]('['+[_0x37455c[_0x2d2f('0x16')]()]+']',_0x114965[_0x2d2f('0x17')]);_0x27b196(_0x114965[_0x2d2f('0x17')]);});});};}function createRemoteTag(_0x3aad55,_0x3c1487,_0x1e8752,_0x4e0d5c){return new Promise(function(_0x43f51a,_0x47d51d){var _0x5e5b8d={'method':'POST','uri':_0x1e8752+_0x2d2f('0x45')+'?'+_0x4e0d5c,'body':{'short_description':_0x3aad55,'global':!![],'active':!![],'name':_0x3aad55},'auth':_0x3c1487,'json':!![]};return rp(_0x5e5b8d)['then'](function(_0x264ff0){var _0x3908a8=_0x264ff0[_0x2d2f('0xf')][_0x2d2f('0x11')];_0x43f51a(_0x3908a8);});});}function getRemoteTag(_0x342945,_0x9790b1,_0x3dd618,_0x450e12,_0xd77bbc){return new Promise(function(_0x290c93,_0x464f42){var _0x29de4e={'method':_0x2d2f('0xc'),'uri':_0x3dd618+_0x2d2f('0x45')+_0x2d2f('0x46')+_0x342945+'&'+_0x450e12,'auth':_0x9790b1,'json':!![]};return rp(_0x29de4e)[_0x2d2f('0xe')](function(_0x142e19){if(_0x142e19[_0x2d2f('0xf')][_0x2d2f('0x2d')]>0x0){var _0x2de39d=_0x142e19['result'][0x0][_0x2d2f('0x11')];_0x290c93(_0x2de39d);}else{return createRemoteTag(_0x342945,_0x9790b1,_0x3dd618,_0x450e12)[_0x2d2f('0xe')](function(_0x4d3976){_0x290c93(_0x4d3976);});}});});}function assignTagToIncident(_0x4f7a48,_0x15f2f1,_0x16195b,_0x775b67,_0x39cd98){return new Promise(function(_0x161be0,_0x4494d1){var _0x48aa6f={'method':'POST','uri':_0x16195b+'label_entry'+'?'+_0x39cd98,'body':{'label':_0x4f7a48,'table':_0x2d2f('0x47'),'id_type':_0x2d2f('0x48'),'table_key':_0x775b67[_0x2d2f('0x42')],'title':_0x2d2f('0x49')+_0x775b67[_0x2d2f('0x43')],'id_display':_0x775b67[_0x2d2f('0x43')]},'auth':_0x15f2f1,'json':!![]};return rp(_0x48aa6f)[_0x2d2f('0xe')](function(_0x1aa97f){_0x161be0();})[_0x2d2f('0x14')](function(){_0x161be0();});});}function manageTags(_0x42fcd8,_0x52db62,_0x357a0a,_0x331775,_0x4515d1,_0x2580ad,_0x593612){return new Promise(function(_0x1242e7,_0x407c96){var _0x3ade62=[];_0x52db62[_0x2d2f('0x2e')](function(_0xc1b962){_0x3ade62[_0x2d2f('0x4a')](getRemoteTag(_0xc1b962,_0x357a0a,_0x331775,_0x2580ad,_0x593612));});return Promise['all'](_0x3ade62)[_0x2d2f('0xe')](function(_0x39437c){if(_0x39437c[_0x2d2f('0x2d')]){logger['info']('['+[_0x42fcd8['toUpperCase']()]+']\x20arrayPromises:\x20IDs\x20in\x20table\x20label',_0x39437c);var _0x1fd2e9=[];_0x39437c['forEach'](function(_0x49bf4f){_0x1fd2e9['push'](assignTagToIncident(_0x49bf4f,_0x357a0a,_0x331775,_0x4515d1,_0x2580ad));});return Promise[_0x2d2f('0x4b')](_0x1fd2e9)['then'](function(){_0x1242e7();})[_0x2d2f('0x14')](function(){_0x1242e7();});}else{_0x1242e7();}});});}function getTags(_0x2541ae,_0x43528d,_0x47c1c8,_0x2f2fe9,_0x59594c,_0x1a6551){return function(_0x486c31){return new Promise(function(_0x4603bd,_0x230d41){var _0x41245b=[];var _0x2ae573=_0x2f2fe9[_0x2d2f('0x4c')];if(_0x2ae573&&_0x2ae573[_0x2d2f('0x2d')]>0x0){_0x41245b=_[_0x2d2f('0x4d')](_0x2ae573,_0x2d2f('0x3c'));}if(_0x41245b[_0x2d2f('0x2d')]>0x0){return manageTags(_0x2541ae,_0x41245b,_0x43528d,_0x47c1c8,_0x486c31,_0x59594c,_0x1a6551)[_0x2d2f('0xe')](function(){_0x4603bd(_0x486c31);});}else{_0x4603bd(_0x486c31);}});};}function emit(_0xe48de2,_0x28e005,_0x4a43ab){var _0x517079=_0x2d2f('0x4e')+_0x2d2f('0x4f')+_0x2d2f('0x50')+_0x2d2f('0x51');var _0x56fb4f={'uri':_0xe48de2+_0x2d2f('0x52')+_0x4a43ab+_0x517079};io['to'](util['format'](_0x2d2f('0x53'),_0x28e005))['emit']('trigger:browser:url',_0x56fb4f);}exports['cs']=function(_0x29fc66,_0x2c779b,_0x37f70d,_0x5b1082,_0x2a9319,_0xd34730,_0x13b478,_0x549d8a){var _0x1fba18={};var _0x340f6a={'user':_0xd34730[_0x2d2f('0x54')],'pass':_0xd34730[_0x2d2f('0x55')]};var _0xbad746=_0x2d2f('0x56');var _0x778a93=_0x2d2f('0x57');_0xd34730[_0x2d2f('0x58')]=intUtil['stripTrailingSlash'](_0xd34730['remoteUri']);_0xd34730[_0x2d2f('0x59')]=intUtil['stripTrailingSlash'](_0xd34730[_0x2d2f('0x59')]);var _0x7ac6d9=util['format'](_0x2d2f('0x5a'),_0xd34730['remoteUri']);_0x1fba18[_0x2d2f('0x1a')]=!_[_0x2d2f('0x5b')](_0x5b1082)?_0x5b1082[_0x2d2f('0x5c')]:null;_0x1fba18[_0x2d2f('0x22')]=_0xd34730[_0x2d2f('0x5c')];_0x1fba18[_0x2d2f('0x25')]=_0x549d8a['toLowerCase']()===_0x2d2f('0x3e')?_0x2c779b['destcalleridnum']:_0x2c779b[_0x2d2f('0x5d')];_0x1fba18[_0x2d2f('0x5e')]=_0x549d8a===_0x2d2f('0x5f')||_0x549d8a==='unmanaged'?_0x2d2f('0x5f'):_0x2d2f('0x3e');var _0x5395a9=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0xd34730[_0x2d2f('0x59')],_0x2c779b[_0x2d2f('0x60')],md5(_0x2c779b[_0x2d2f('0x60')]));if(_0x2a9319&&_0x2a9319['monitor_format']){logger[_0x2d2f('0x12')](_0x2d2f('0x61'),_0x2d2f('0x62'));_0x2c779b[_0x2d2f('0x63')]=_0x5395a9;}else if(_0x13b478&&_0x13b478[_0x2d2f('0x64')]&&_0x13b478[_0x2d2f('0x64')]!==_0x2d2f('0x65')){logger[_0x2d2f('0x12')]('[OUTBOUND]',_0x2d2f('0x62'));_0x2c779b[_0x2d2f('0x63')]=_0x5395a9;}else{_0x2c779b[_0x2d2f('0x63')]='';}return getAdminUser(_0x549d8a,_0x340f6a,_0x1fba18,_0x7ac6d9,_0x778a93,_0xbad746)['then'](getUser(_0x549d8a,_0x340f6a,_0x7ac6d9,_0x778a93,_0xbad746))[_0x2d2f('0xe')](getEndUser(_0x549d8a,_0x340f6a,_0x7ac6d9,_0x778a93,_0xbad746))[_0x2d2f('0xe')](getTicket(_0x549d8a,_0x340f6a,_0x7ac6d9,_0x37f70d,_0x2c779b,_0x778a93))[_0x2d2f('0xe')](function(_0x53ed57){logger[_0x2d2f('0x12')](util[_0x2d2f('0x66')]('The\x20ticket\x20ID\x20is:\x20%s',_0x53ed57[_0x2d2f('0x42')]));logger[_0x2d2f('0x12')](util['format'](_0x2d2f('0x67'),_0x549d8a));if(_0x549d8a!=='unmanaged'){logger[_0x2d2f('0x12')]('['+[_0x549d8a[_0x2d2f('0x16')]()]+']',_0x2d2f('0x68'));emit(_0xd34730['remoteUri'],_0x5b1082[_0x2d2f('0x3c')],_0x53ed57[_0x2d2f('0x42')]);}})[_0x2d2f('0x14')](function(_0x3c4de3){logger[_0x2d2f('0x15')]('['+[_0x549d8a[_0x2d2f('0x16')]()]+']\x20Error\x20running\x20ServiceNow\x20integration',util[_0x2d2f('0x69')](_0x3c4de3,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x051c=['%255EORDERBYDESCnumber','user:%s','trigger:browser:url','username','sysparm_limit=1','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','format','isNil','email','destcalleridnum','calleridnum','callDirection','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s','unmanaged','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','lodash','bluebird','request-promise','ioredis','./util','../../../../config/environment','../../../../config/logger','servicenow','redis','defaults','localhost','GET','sys_user?sysparm_query=user_name%3Dadmin','then','adminId','result','sys_id','info','toUpperCase','],\x20getAdminUser\x20crm','catch','message','],\x20getUser\x20input\x20crm','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','length','userId','],\x20getUser\x20crm','error',']\x20using\x20admin\x20profile','adminEmail','],\x20createEndUser\x20input\x20crm','POST','endUserNumber','user','true','],\x20EndUser\x20schema','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','forEach','includes','string','picklist','type','nameField','customField','toLowerCase','toString','idField','content','variable','variableName','Variable','name',']\x20getTicket\x20input\x20crm','assign','getString','Subjects','Descriptions','ticketNumber','label','?sysparm_query=name%3D','label_entry','incident','Incident','ticketId','Incident\x20-\x20','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue'];(function(_0x3e2fcf,_0x579110){var _0x497db7=function(_0x2f713d){while(--_0x2f713d){_0x3e2fcf['push'](_0x3e2fcf['shift']());}};_0x497db7(++_0x579110);}(_0x051c,0x1cb));var _0xc051=function(_0x4b5686,_0x3cc180){_0x4b5686=_0x4b5686-0x0;var _0x3067d5=_0x051c[_0x4b5686];return _0x3067d5;};'use strict';var _=require(_0xc051('0x0'));var Promise=require(_0xc051('0x1'));var rp=require(_0xc051('0x2'));var util=require('util');var md5=require('md5');var Redis=require(_0xc051('0x3'));var intUtil=require(_0xc051('0x4'));var config=require(_0xc051('0x5'));var logger=require(_0xc051('0x6'))(_0xc051('0x7'));config[_0xc051('0x8')]=_[_0xc051('0x9')](config[_0xc051('0x8')],{'host':_0xc051('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xc051('0x8')]));function getAdminUser(_0x34f74d,_0x20ef4a,_0x5e4991,_0x4105cf,_0x2c7f3c,_0x5f162c){return new Promise(function(_0xa9defc,_0x24b607){var _0x407402={'method':_0xc051('0xb'),'uri':_0x4105cf+_0xc051('0xc')+'&'+_0x2c7f3c+'&'+_0x5f162c,'auth':_0x20ef4a,'json':!![]};return rp(_0x407402)[_0xc051('0xd')](function(_0x2dd841){if(_0x2dd841['result']['length']>0x0){_0x5e4991[_0xc051('0xe')]=_0x2dd841[_0xc051('0xf')][0x0][_0xc051('0x10')];}logger[_0xc051('0x11')]('['+[_0x34f74d[_0xc051('0x12')]()]+_0xc051('0x13'),_0x5e4991);_0xa9defc(_0x5e4991);})[_0xc051('0x14')](function(_0x27ae4f){logger['error']('['+[_0x34f74d['toUpperCase']()]+']',_0x27ae4f[_0xc051('0x15')]);_0x24b607(_0x27ae4f['message']);});});}function getUser(_0x57e16f,_0x445cc0,_0x49a35c,_0x1c8637,_0x1da235){return function(_0x309f3a){logger[_0xc051('0x11')]('['+[_0x57e16f[_0xc051('0x12')]()]+_0xc051('0x16'),_0x309f3a);return new Promise(function(_0x55bafc,_0x32656c){if(intUtil['validateEmail'](_0x309f3a[_0xc051('0x17')])){var _0x1e8e0d={'method':_0xc051('0xb'),'uri':_0x49a35c+_0xc051('0x18')+_0x309f3a[_0xc051('0x17')]+'&'+_0x1c8637+'&'+_0x1da235,'auth':_0x445cc0,'json':!![]};logger[_0xc051('0x11')]('['+[_0x57e16f['toUpperCase']()]+_0xc051('0x19'),_0x1e8e0d);return rp(_0x1e8e0d)[_0xc051('0xd')](function(_0x46cd6d){logger['info']('['+[_0x57e16f['toUpperCase']()]+_0xc051('0x1a'),_0x46cd6d);if(_0x46cd6d[_0xc051('0xf')][_0xc051('0x1b')]>0x0&&String(_0x46cd6d['result'][0x0]['active'])==='true'){_0x309f3a[_0xc051('0x1c')]=_0x46cd6d[_0xc051('0xf')][0x0][_0xc051('0x10')];}else{_0x309f3a[_0xc051('0x1c')]=_0x309f3a[_0xc051('0xe')];_0x309f3a['userEmail']=_0x309f3a['adminEmail'];}logger[_0xc051('0x11')]('['+[_0x57e16f[_0xc051('0x12')]()]+_0xc051('0x1d'),_0x309f3a);_0x55bafc(_0x309f3a);})['catch'](function(_0x2523f4){logger[_0xc051('0x1e')]('['+[_0x57e16f[_0xc051('0x12')]()]+']',_0x2523f4[_0xc051('0x15')]);_0x32656c(_0x2523f4[_0xc051('0x15')]);});}else{logger[_0xc051('0x11')]('['+[_0x57e16f[_0xc051('0x12')]()]+_0xc051('0x1f'));_0x309f3a[_0xc051('0x1c')]=_0x309f3a[_0xc051('0xe')];_0x309f3a[_0xc051('0x17')]=_0x309f3a[_0xc051('0x20')];_0x55bafc(_0x309f3a);}});};}function createEndUser(_0x596c83,_0x3c33d4,_0x28443a,_0x4af47d,_0x13e5bc){logger['info']('['+[_0x596c83['toUpperCase']()]+_0xc051('0x21'),_0x28443a);return new Promise(function(_0x2b9b5b,_0x474192){var _0x39e2c2={'method':_0xc051('0x22'),'uri':_0x4af47d+'sys_user?'+_0x13e5bc,'body':{'user_name':_0x28443a[_0xc051('0x23')],'roles':_0xc051('0x24'),'first_name':_0x28443a[_0xc051('0x23')],'active':_0xc051('0x25'),'date_format':'System','phone':_0x28443a['endUserNumber']},'auth':_0x3c33d4,'json':!![]};return rp(_0x39e2c2)[_0xc051('0xd')](function(_0x1cf93e){logger[_0xc051('0x11')]('['+[_0x596c83[_0xc051('0x12')]()]+_0xc051('0x26'),_0x1cf93e[_0xc051('0xf')]);_0x28443a['endUserId']=_0x1cf93e[_0xc051('0xf')]['sys_id'];_0x2b9b5b(_0x28443a);})[_0xc051('0x14')](function(_0x3995e2){logger[_0xc051('0x1e')]('['+[_0x596c83[_0xc051('0x12')]()]+']',_0x3995e2[_0xc051('0x15')]);_0x474192(_0x3995e2[_0xc051('0x15')]);});});}function getEndUser(_0x44c80f,_0x55255b,_0x125b33,_0x393563,_0x964d88){return function(_0x195e81){logger[_0xc051('0x11')]('['+[_0x44c80f['toUpperCase']()]+_0xc051('0x27'),_0x195e81);return new Promise(function(_0x60ea7e,_0x33051c){var _0x59be00={'method':_0xc051('0xb'),'uri':_0x125b33+_0xc051('0x28')+_0x195e81['endUserNumber']+'&'+_0x393563+'&'+_0x964d88,'auth':_0x55255b,'json':!![]};return rp(_0x59be00)[_0xc051('0xd')](function(_0x1641dd){if(_0x1641dd[_0xc051('0xf')][_0xc051('0x1b')]>0x0){_0x195e81['endUserId']=_0x1641dd[_0xc051('0xf')][0x0]['sys_id'];logger[_0xc051('0x11')]('['+[_0x44c80f[_0xc051('0x12')]()]+_0xc051('0x29'),_0x195e81);_0x60ea7e(_0x195e81);}else{return createEndUser(_0x44c80f,_0x55255b,_0x195e81,_0x125b33,_0x393563)[_0xc051('0xd')](function(_0x55a362){logger[_0xc051('0x11')]('['+[_0x44c80f[_0xc051('0x12')]()]+'],\x20createEndUser\x20crm',_0x55a362);_0x60ea7e(_0x55a362);});}})[_0xc051('0x14')](function(_0x4ae794){logger['error']('['+[_0x44c80f[_0xc051('0x12')]()]+']',_0x4ae794[_0xc051('0x15')]);_0x33051c(_0x4ae794[_0xc051('0x15')]);});});};}function getCustomFields(_0x150cb1,_0xedae41){var _0x45f580={};if(_0x150cb1[_0xc051('0x1b')]>0x0){_[_0xc051('0x2a')](_0x150cb1,function(_0x5a9ad5){if(_[_0xc051('0x2b')]([_0xc051('0x2c'),_0xc051('0x2d')],_0x5a9ad5[_0xc051('0x2e')])&&_0x5a9ad5[_0xc051('0x2f')]&&!_0x5a9ad5[_0xc051('0x30')]){_0x45f580[_0x5a9ad5['nameField'][_0xc051('0x31')]()]=_0x5a9ad5['content'][_0xc051('0x32')]();}else if(_[_0xc051('0x2b')]([_0xc051('0x2c'),_0xc051('0x2d')],_0x5a9ad5[_0xc051('0x2e')])&&_0x5a9ad5[_0xc051('0x33')]&&_0x5a9ad5[_0xc051('0x30')]){_0x45f580[_0x5a9ad5['idField'][_0xc051('0x31')]()]=_0x5a9ad5[_0xc051('0x34')]['toString']();}else if(_0x5a9ad5[_0xc051('0x2e')]===_0xc051('0x35')&&_0x5a9ad5[_0xc051('0x36')]&&_0x5a9ad5['idField']&&_0x5a9ad5[_0xc051('0x30')]){_0x45f580[_0x5a9ad5['idField'][_0xc051('0x31')]()]=_0xedae41[_0x5a9ad5['variableName']][_0xc051('0x32')]();}else if(_0x5a9ad5['type']==='customVariable'&&_0x5a9ad5[_0xc051('0x37')]&&_0x5a9ad5['Variable'][_0xc051('0x38')]&&_0x5a9ad5[_0xc051('0x33')]&&_0x5a9ad5[_0xc051('0x30')]){_0x45f580[_0x5a9ad5[_0xc051('0x33')][_0xc051('0x31')]()]=_0xedae41[_0x5a9ad5[_0xc051('0x37')][_0xc051('0x38')][_0xc051('0x31')]()][_0xc051('0x32')]();}});}return _0x45f580;}function getTicket(_0x8c2c7b,_0x126a9f,_0x520ea6,_0x5a782a,_0x17350d,_0x214305){return function(_0x388faf){logger[_0xc051('0x11')]('['+[_0x8c2c7b[_0xc051('0x12')]()]+_0xc051('0x39'),_0x388faf);return new Promise(function(_0x51bf25,_0x1e4bdb){var _0x44e109=_0x8c2c7b['toLowerCase']()==='outbound'?_0x388faf[_0xc051('0x1c')]:_0x388faf['endUserId'];var _0x669b13={'method':_0xc051('0x22'),'uri':_0x520ea6+'incident'+'?'+_0x214305,'body':Object[_0xc051('0x3a')]({},{'active':'true','caller_id':_0x44e109,'assigned_to':_0x388faf[_0xc051('0x1c')],'short_description':intUtil[_0xc051('0x3b')](_0x5a782a[_0xc051('0x3c')],_0x17350d,'\x20'),'description':intUtil[_0xc051('0x3b')](_0x5a782a[_0xc051('0x3d')],_0x17350d,'\x0a')},getCustomFields(_0x5a782a['Fields'],_0x17350d)),'auth':_0x126a9f,'json':!![]};return rp(_0x669b13)[_0xc051('0xd')](function(_0x3141c5){logger[_0xc051('0x11')]('['+[_0x8c2c7b[_0xc051('0x12')]()]+']\x20POST\x20incident\x20entity\x20schema',_0x3141c5['result']);_0x388faf['ticketId']=_0x3141c5[_0xc051('0xf')][_0xc051('0x10')];_0x388faf[_0xc051('0x3e')]=_0x3141c5['result']['number'];logger[_0xc051('0x11')]('['+[_0x8c2c7b[_0xc051('0x12')]()]+']\x20getTicket\x20crm',_0x388faf);_0x51bf25(_0x388faf);})[_0xc051('0x14')](function(_0xd69f55){logger[_0xc051('0x1e')]('['+[_0x8c2c7b[_0xc051('0x12')]()]+']',_0xd69f55[_0xc051('0x15')]);_0x1e4bdb(_0xd69f55[_0xc051('0x15')]);});});};}function createRemoteTag(_0x29fa05,_0xc8b139,_0x14e724,_0x46427f){return new Promise(function(_0x532744,_0x598f60){var _0x11568d={'method':'POST','uri':_0x14e724+_0xc051('0x3f')+'?'+_0x46427f,'body':{'short_description':_0x29fa05,'global':!![],'active':!![],'name':_0x29fa05},'auth':_0xc8b139,'json':!![]};return rp(_0x11568d)[_0xc051('0xd')](function(_0xd0a2e0){var _0x4b85be=_0xd0a2e0['result']['sys_id'];_0x532744(_0x4b85be);});});}function getRemoteTag(_0x3f24df,_0x540b92,_0xa2996a,_0x47c156,_0x217669){return new Promise(function(_0x11361b,_0x47ca66){var _0x295be5={'method':_0xc051('0xb'),'uri':_0xa2996a+'label'+_0xc051('0x40')+_0x3f24df+'&'+_0x47c156,'auth':_0x540b92,'json':!![]};return rp(_0x295be5)['then'](function(_0x3478fb){if(_0x3478fb[_0xc051('0xf')][_0xc051('0x1b')]>0x0){var _0x39efcc=_0x3478fb[_0xc051('0xf')][0x0]['sys_id'];_0x11361b(_0x39efcc);}else{return createRemoteTag(_0x3f24df,_0x540b92,_0xa2996a,_0x47c156)[_0xc051('0xd')](function(_0x356204){_0x11361b(_0x356204);});}});});}function assignTagToIncident(_0x4b110e,_0x4a06ca,_0x395f18,_0x44f852,_0x57e209){return new Promise(function(_0x2c8008,_0x5c8eaa){var _0x7303e7={'method':_0xc051('0x22'),'uri':_0x395f18+_0xc051('0x41')+'?'+_0x57e209,'body':{'label':_0x4b110e,'table':_0xc051('0x42'),'id_type':_0xc051('0x43'),'table_key':_0x44f852[_0xc051('0x44')],'title':_0xc051('0x45')+_0x44f852[_0xc051('0x3e')],'id_display':_0x44f852[_0xc051('0x3e')]},'auth':_0x4a06ca,'json':!![]};return rp(_0x7303e7)['then'](function(_0x605763){_0x2c8008();})[_0xc051('0x14')](function(){_0x2c8008();});});}function manageTags(_0x388b23,_0x11996f,_0x483dca,_0x4a2685,_0x1b22da,_0x29ee50,_0x8f275){return new Promise(function(_0x26689b,_0x4a5a56){var _0x47b30b=[];_0x11996f[_0xc051('0x2a')](function(_0x1c576d){_0x47b30b[_0xc051('0x46')](getRemoteTag(_0x1c576d,_0x483dca,_0x4a2685,_0x29ee50,_0x8f275));});return Promise[_0xc051('0x47')](_0x47b30b)[_0xc051('0xd')](function(_0x4d28bb){if(_0x4d28bb[_0xc051('0x1b')]){logger['info']('['+[_0x388b23[_0xc051('0x12')]()]+_0xc051('0x48'),_0x4d28bb);var _0x53f79f=[];_0x4d28bb[_0xc051('0x2a')](function(_0x5261fb){_0x53f79f[_0xc051('0x46')](assignTagToIncident(_0x5261fb,_0x483dca,_0x4a2685,_0x1b22da,_0x29ee50));});return Promise[_0xc051('0x47')](_0x53f79f)['then'](function(){_0x26689b();})['catch'](function(){_0x26689b();});}else{_0x26689b();}});});}function getTags(_0x1872f8,_0x56e9db,_0x2fef03,_0x48f26d,_0x25932e,_0x19f21f){return function(_0x51305d){return new Promise(function(_0x413933,_0x1ebae7){var _0x11dd07=[];var _0x9906da=_0x48f26d['Tags'];if(_0x9906da&&_0x9906da[_0xc051('0x1b')]>0x0){_0x11dd07=_['map'](_0x9906da,_0xc051('0x38'));}if(_0x11dd07['length']>0x0){return manageTags(_0x1872f8,_0x11dd07,_0x56e9db,_0x2fef03,_0x51305d,_0x25932e,_0x19f21f)[_0xc051('0xd')](function(){_0x413933(_0x51305d);});}else{_0x413933(_0x51305d);}});};}function emit(_0x3ce3f6,_0x1d8ec3,_0x23c343){var _0x58b74c=_0xc051('0x49')+_0xc051('0x4a')+_0xc051('0x4b')+_0xc051('0x4c');var _0x217f96={'uri':_0x3ce3f6+'/nav_to.do?uri=incident.do?sys_id%3D'+_0x23c343+_0x58b74c};io['to'](util['format'](_0xc051('0x4d'),_0x1d8ec3))['emit'](_0xc051('0x4e'),_0x217f96);}exports['cs']=function(_0xcf35ac,_0x54d4dc,_0x5b621e,_0x43e81d,_0x4f9f9f,_0x11bb50,_0x1df458,_0x338602){var _0x19425={};var _0x427b10={'user':_0x11bb50[_0xc051('0x4f')],'pass':_0x11bb50['password']};var _0x3cfa41=_0xc051('0x50');var _0x66eceb=_0xc051('0x51');_0x11bb50[_0xc051('0x52')]=intUtil[_0xc051('0x53')](_0x11bb50[_0xc051('0x52')]);_0x11bb50[_0xc051('0x54')]=intUtil[_0xc051('0x53')](_0x11bb50[_0xc051('0x54')]);var _0x3a7ef5=util[_0xc051('0x55')]('%s/api/now/table/',_0x11bb50[_0xc051('0x52')]);_0x19425['userEmail']=!_[_0xc051('0x56')](_0x43e81d)?_0x43e81d[_0xc051('0x57')]:null;_0x19425['adminEmail']=_0x11bb50['email'];_0x19425[_0xc051('0x23')]=_0x338602[_0xc051('0x31')]()==='outbound'?_0x54d4dc[_0xc051('0x58')]:_0x54d4dc[_0xc051('0x59')];_0x19425[_0xc051('0x5a')]=_0x338602===_0xc051('0x5b')||_0x338602==='unmanaged'?_0xc051('0x5b'):'outbound';var _0x3aeb5d=util[_0xc051('0x55')](_0xc051('0x5c'),_0x11bb50[_0xc051('0x54')],_0x54d4dc['uniqueid'],md5(_0x54d4dc[_0xc051('0x5d')]));if(_0x4f9f9f&&_0x4f9f9f[_0xc051('0x5e')]){logger[_0xc051('0x11')](_0xc051('0x5f'),_0xc051('0x60'));_0x54d4dc[_0xc051('0x61')]=_0x3aeb5d;}else if(_0x1df458&&_0x1df458[_0xc051('0x62')]&&_0x1df458[_0xc051('0x62')]!==_0xc051('0x63')){logger[_0xc051('0x11')](_0xc051('0x64'),'Recording\x20is\x20enabled!');_0x54d4dc['recordingURL']=_0x3aeb5d;}else{_0x54d4dc['recordingURL']='';}return getAdminUser(_0x338602,_0x427b10,_0x19425,_0x3a7ef5,_0x66eceb,_0x3cfa41)[_0xc051('0xd')](getUser(_0x338602,_0x427b10,_0x3a7ef5,_0x66eceb,_0x3cfa41))[_0xc051('0xd')](getEndUser(_0x338602,_0x427b10,_0x3a7ef5,_0x66eceb,_0x3cfa41))[_0xc051('0xd')](getTicket(_0x338602,_0x427b10,_0x3a7ef5,_0x5b621e,_0x54d4dc,_0x66eceb))['then'](function(_0x36a135){logger['info'](util[_0xc051('0x55')](_0xc051('0x65'),_0x36a135[_0xc051('0x44')]));logger[_0xc051('0x11')](util[_0xc051('0x55')](_0xc051('0x66'),_0x338602));if(_0x338602!==_0xc051('0x67')){logger[_0xc051('0x11')]('['+[_0x338602[_0xc051('0x12')]()]+']',_0xc051('0x68'));emit(_0x11bb50[_0xc051('0x52')],_0x43e81d[_0xc051('0x38')],_0x36a135['ticketId']);}})['catch'](function(_0x5a6966){logger[_0xc051('0x1e')]('['+[_0x338602[_0xc051('0x12')]()]+_0xc051('0x69'),util[_0xc051('0x6a')](_0x5a6966,{'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 36f964f..09e1f39 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 _0xf199=['Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','contacts','version','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','catch','error','uri','recordingFormat','none','[OUTBOUND]','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','Outbound','user:%s','trigger:browser:url','unmanaged','lastevent','toUpperCase','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','lodash','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','redis','socket.io-emitter','POST','emit','Creating\x20new\x20ticket...','name','getString','Subjects','assigned_user_id','description','slice','duration_minutes','parent_id','parent_type','Contacts','parent_name','direction','forEach','variableName','idField','set_entry','JSON','stringify','Calls','format','Basic\x20%s','toString','base64','get_server_info','isNil','info','Getting\x20agent\x20with\x20name','get_entry_list','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','entry_list','length','name_value_list','value','Agent\x20found!','resolve','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','then','find','Enduser\x20found!','first_name','','Caller\x20-\x20%s','debug','[HTTP]','merge','map','nameField','customField','toLowerCase','content','string','custom_fields','type','variable','push','Variable','username','password','PLAIN','Account\x20%d\x20is\x20not\x20valid','set_relationship','queue','remoteUri','stripTrailingSlash','serverUrl','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Inbound'];(function(_0x2a0ccc,_0x424cc4){var _0x1fb9fa=function(_0x175462){while(--_0x175462){_0x2a0ccc['push'](_0x2a0ccc['shift']());}};_0x1fb9fa(++_0x424cc4);}(_0xf199,0x177));var _0x9f19=function(_0x4bfe08,_0x48ae7b){_0x4bfe08=_0x4bfe08-0x0;var _0x1f9125=_0xf199[_0x4bfe08];return _0x1f9125;};'use strict';var _=require(_0x9f19('0x0'));var rp=require('request-promise');var BPromise=require('bluebird');var md5=require(_0x9f19('0x1'));var util=require(_0x9f19('0x2'));var Redis=require(_0x9f19('0x3'));var intUtil=require(_0x9f19('0x4'));var config=require(_0x9f19('0x5'));var logger=require(_0x9f19('0x6'))('sugarcrm');config[_0x9f19('0x7')]=_['defaults'](config[_0x9f19('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0x9f19('0x8'))(new Redis(config['redis']));var def={'method':_0x9f19('0x9'),'json':!![]};function emit(_0x5cf049,_0x249dd4,_0x539f04){io['to'](_0x5cf049)[_0x9f19('0xa')](_0x249dd4,_0x539f04);}function getTicket(_0x1f955b,_0x4da415,_0x318661,_0x1fa13e,_0x34ad4,_0x5eb244,_0x1c0a0d,_0x2e4a52){logger['info'](_0x9f19('0xb'));var _0x2144d0=new Date();var _0x3b6d23=[{'name':_0x9f19('0xc'),'value':intUtil[_0x9f19('0xd')](_0x1fa13e[_0x9f19('0xe')],_0x34ad4,'\x20')},{'name':_0x9f19('0xf'),'value':_0x4da415['id']},{'name':'created_by','value':_0x4da415['id']},{'name':_0x9f19('0x10'),'value':intUtil[_0x9f19('0xd')](_0x1fa13e['Descriptions'],_0x34ad4,'\x0a')},{'name':'date_start','value':_0x2144d0['toISOString']()[_0x9f19('0x11')](0x0,0x13)['replace']('T','\x20')},{'name':'duration_hours','value':'0'},{'name':_0x9f19('0x12'),'value':'15'},{'name':_0x9f19('0x13'),'value':_0x318661['id']},{'name':_0x9f19('0x14'),'value':_0x9f19('0x15')},{'name':_0x9f19('0x16'),'value':_0x318661[_0x9f19('0xc')]},{'name':_0x9f19('0x17'),'value':_0x2e4a52}];if(_0x5eb244['length']){_[_0x9f19('0x18')](_0x5eb244,function(_0x4d4175){if(_0x34ad4[_0x4d4175[_0x9f19('0x19')]]){_0x3b6d23['push']({'name':_0x4d4175[_0x9f19('0x1a')],'value':_0x34ad4[_0x4d4175[_0x9f19('0x19')]]});}});}return request({'form':{'method':_0x9f19('0x1b'),'input_type':_0x9f19('0x1c'),'response_type':_0x9f19('0x1c'),'rest_data':JSON[_0x9f19('0x1d')]({'session':_0x1c0a0d['id'],'module_name':_0x9f19('0x1e'),'name_value_list':_0x3b6d23})}});}function getAuth(_0x3251fb){return util[_0x9f19('0x1f')](_0x9f19('0x20'),new Buffer(_0x3251fb['apiKey']+':X')[_0x9f19('0x21')](_0x9f19('0x22')));}function getServerInfo(_0x3e9968){return request({'form':{'method':_0x9f19('0x23'),'input_type':_0x9f19('0x1c'),'response_type':_0x9f19('0x1c'),'rest_data':JSON[_0x9f19('0x1d')]({'session':_0x3e9968['id']})}});}function getUser(_0x561d6e,_0x1ab366,_0x3b965b){if(!_[_0x9f19('0x24')](_0x1ab366)){logger[_0x9f19('0x25')](_0x9f19('0x26'),_0x1ab366);return request({'form':{'method':_0x9f19('0x27'),'input_type':_0x9f19('0x1c'),'response_type':_0x9f19('0x1c'),'rest_data':JSON[_0x9f19('0x1d')]({'session':_0x3b965b['id'],'module_name':'Employees','query':util['format'](_0x9f19('0x28'),_0x1ab366),'order_by':'','offset':'0','select_fields':['id','name',_0x9f19('0x29')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x44001c){if(_0x44001c[_0x9f19('0x2a')][_0x9f19('0x2b')]){var _0x33db1c=_['find'](_0x44001c[_0x9f19('0x2a')],function(_0x4aa586){return _0x4aa586[_0x9f19('0x2c')][_0x9f19('0x29')][_0x9f19('0x2d')]===_0x1ab366;});if(_0x33db1c){logger['info'](_0x9f19('0x2e'));return BPromise[_0x9f19('0x2f')]({'id':_0x33db1c[_0x9f19('0x2c')]['id'][_0x9f19('0x2d')],'name':_0x33db1c[_0x9f19('0x2c')][_0x9f19('0xc')][_0x9f19('0x2d')]});}}logger[_0x9f19('0x25')](_0x9f19('0x30'));return BPromise['resolve']({'id':_0x3b965b['name_value_list'][_0x9f19('0x31')][_0x9f19('0x2d')],'name':_0x3b965b[_0x9f19('0x2c')][_0x9f19('0x29')]['value']});});}else{logger[_0x9f19('0x25')](_0x9f19('0x32'));return BPromise[_0x9f19('0x2f')]({'id':_0x3b965b[_0x9f19('0x2c')][_0x9f19('0x31')]['value'],'name':_0x3b965b[_0x9f19('0x2c')][_0x9f19('0x29')][_0x9f19('0x2d')]});}}function getEndUser(_0x5e9e48,_0x3b5ec7,_0x1f6a97,_0x46e2a2){logger[_0x9f19('0x25')]('Searching\x20enduser\x20with\x20phone',_0x1f6a97);return request({'form':{'method':_0x9f19('0x27'),'input_type':_0x9f19('0x1c'),'response_type':_0x9f19('0x1c'),'rest_data':JSON[_0x9f19('0x1d')]({'session':_0x46e2a2['id'],'module_name':_0x9f19('0x15'),'query':util['format'](_0x9f19('0x33'),_0x1f6a97),'order_by':'','offset':'0','select_fields':['id',_0x9f19('0xc'),_0x9f19('0x34')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x9f19('0x35')](function(_0x1d0ebf){if(_0x1d0ebf[_0x9f19('0x2a')]['length']){var _0x5e06b0=_[_0x9f19('0x36')](_0x1d0ebf[_0x9f19('0x2a')],function(_0x5a156e){return _0x5a156e[_0x9f19('0x2c')][_0x9f19('0x34')][_0x9f19('0x2d')]===_0x1f6a97;});if(_0x5e06b0){logger[_0x9f19('0x25')](_0x9f19('0x37'));return BPromise['resolve']({'id':_0x5e06b0[_0x9f19('0x2c')]['id'][_0x9f19('0x2d')],'name':_0x5e06b0[_0x9f19('0x2c')]['name'][_0x9f19('0x2d')],'phone':_0x5e06b0[_0x9f19('0x2c')][_0x9f19('0x34')][_0x9f19('0x2d')]});}}else{logger[_0x9f19('0x25')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'form':{'method':_0x9f19('0x1b'),'input_type':'JSON','response_type':_0x9f19('0x1c'),'rest_data':JSON[_0x9f19('0x1d')]({'session':_0x46e2a2['id'],'module_name':_0x9f19('0x15'),'name_value_list':[{'name':_0x9f19('0x38'),'value':_0x3b5ec7!==_0x9f19('0x39')?_0x3b5ec7:util[_0x9f19('0x1f')](_0x9f19('0x3a'),_0x1f6a97)},{'name':_0x9f19('0x34'),'value':_0x1f6a97}]})}})[_0x9f19('0x35')](function(_0x861ab5){logger[_0x9f19('0x25')]('Enduser\x20created.');return BPromise[_0x9f19('0x2f')]({'id':_0x861ab5['id'],'name':_0x861ab5[_0x9f19('0x2a')]['first_name'][_0x9f19('0x2d')],'phone':_0x861ab5['entry_list'][_0x9f19('0x34')][_0x9f19('0x2d')]});});}});}function request(_0x148430){logger[_0x9f19('0x3b')](_0x9f19('0x3c'),JSON[_0x9f19('0x1d')](_0x148430));return rp(_[_0x9f19('0x3d')](def,_0x148430));}function getTags(_0x43b812,_0x448ddf){var _0x17ca9d=[];if(_0x43b812&&_0x43b812['length']>0x0){_0x17ca9d=_[_0x9f19('0x3e')](_0x43b812,_0x448ddf);}return _0x17ca9d;}function getCustomFields(_0x1d4c36,_0x1d7333){var _0x4cfcaa=[];var _0x5db057={'custom_fields':[]};if(_0x1d4c36[_0x9f19('0x2b')]>0x0){_[_0x9f19('0x18')](_0x1d4c36,function(_0x551c46){if(_0x551c46['type']==='string'&&_0x551c46[_0x9f19('0x3f')]&&!_0x551c46[_0x9f19('0x40')]){_0x5db057[_0x551c46['nameField'][_0x9f19('0x41')]()]=_0x551c46[_0x9f19('0x42')][_0x9f19('0x21')]();}else if(_0x551c46['type']===_0x9f19('0x43')&&_0x551c46[_0x9f19('0x1a')]&&_0x551c46['customField']){_0x5db057[_0x9f19('0x44')]['push']({'id':_0x551c46['idField'],'value':_0x551c46[_0x9f19('0x42')][_0x9f19('0x21')]()});}else if(_0x551c46[_0x9f19('0x45')]===_0x9f19('0x46')&&_0x551c46[_0x9f19('0x19')]&&_0x551c46[_0x9f19('0x1a')]&&_0x551c46['customField']){_0x1d7333[_0x551c46[_0x9f19('0x19')]]&&_0x5db057['custom_fields'][_0x9f19('0x47')]({'id':_0x551c46[_0x9f19('0x1a')],'value':_0x1d7333[_0x551c46['variableName']][_0x9f19('0x21')]()});}else if(_0x551c46[_0x9f19('0x45')]==='customVariable'&&_0x551c46[_0x9f19('0x48')]&&_0x551c46[_0x9f19('0x48')]['name']&&_0x551c46[_0x9f19('0x1a')]&&_0x551c46[_0x9f19('0x40')]){_0x1d7333[_0x551c46[_0x9f19('0x48')][_0x9f19('0xc')]['toLowerCase']()]&&_0x5db057[_0x9f19('0x44')][_0x9f19('0x47')]({'id':_0x551c46[_0x9f19('0x1a')],'value':_0x1d7333[_0x551c46['Variable'][_0x9f19('0xc')]['toLowerCase']()][_0x9f19('0x21')]()});}});}return _0x5db057;}function getConnection(_0x1b0354){return request({'method':_0x9f19('0x9'),'form':{'method':'login','input_type':'JSON','response_type':'JSON','rest_data':JSON[_0x9f19('0x1d')]({'user_auth':{'user_name':_0x1b0354[_0x9f19('0x49')],'password':_0x1b0354[_0x9f19('0x4a')],'encryption':_0x9f19('0x4b')},'application':'xCALLY\x20Motion\x20integration'})}})[_0x9f19('0x35')](function(_0x4073c5){var _0x5a77f4=_0x4073c5;if(_0x5a77f4['id']){def['sessionID']=_0x5a77f4['id'];return BPromise['resolve'](_0x5a77f4);}else{throw new Error(util[_0x9f19('0x1f')](_0x9f19('0x4c'),_0x1b0354['id']));}});}function setRelationship(_0x73d082,_0x1436f3,_0x1309f0,_0x777731){return request({'form':{'method':_0x9f19('0x4d'),'input_type':_0x9f19('0x1c'),'response_type':_0x9f19('0x1c'),'rest_data':JSON['stringify']({'session':_0x73d082['id'],'module_name':_0x9f19('0x1e'),'module_id':_0x1309f0['id'],'link_field_name':_0x777731,'related_ids':[_0x1436f3['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x9f19('0x4e')]=function(_0x53e057,_0x2aaec5,_0x4bb53d,_0x125e47,_0x3bd163,_0x4c401f){var _0x4c5a3f,_0x25ec4c,_0x2c17fd,_0x4881be;_0x4c401f[_0x9f19('0x4f')]=intUtil[_0x9f19('0x50')](_0x4c401f[_0x9f19('0x4f')]);_0x4c401f[_0x9f19('0x51')]=intUtil[_0x9f19('0x50')](_0x4c401f['serverUrl']);def['uri']=util[_0x9f19('0x1f')](_0x9f19('0x52'),_0x4c401f[_0x9f19('0x4f')]);if(_0x3bd163&&_0x3bd163[_0x9f19('0x53')]){logger[_0x9f19('0x25')](_0x9f19('0x54'),_0x9f19('0x55'));_0x2aaec5[_0x9f19('0x56')]=util[_0x9f19('0x1f')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4c401f['serverUrl'],_0x2aaec5[_0x9f19('0x57')],md5(_0x2aaec5[_0x9f19('0x57')]));}else{_0x2aaec5[_0x9f19('0x56')]='';}return getConnection(_0x4c401f)[_0x9f19('0x35')](function(_0x3fa147){_0x4881be=_0x3fa147;return getUser(_0x4c401f,_0x125e47[_0x9f19('0xc')],_0x4881be);})[_0x9f19('0x35')](function(_0x5787bd){_0x4c5a3f=_0x5787bd;logger[_0x9f19('0x25')]('The\x20User\x20ID\x20is:',_0x4c5a3f['id']);return getEndUser(_0x4c401f,_0x2aaec5[_0x9f19('0x58')],_0x2aaec5[_0x9f19('0x59')],_0x4881be);})['then'](function(_0x468187){_0x25ec4c=_0x468187;logger[_0x9f19('0x25')](_0x9f19('0x5a'),_0x25ec4c['id']);return getTicket(_0x4c401f,_0x4c5a3f,_0x25ec4c,_0x4bb53d,_0x2aaec5,_0x4bb53d[_0x9f19('0x5b')],_0x4881be,_0x9f19('0x5c'));})[_0x9f19('0x35')](function(_0x52210c){_0x2c17fd=_0x52210c;logger[_0x9f19('0x25')](_0x9f19('0x5d'));logger['info'](_0x9f19('0x5e'),_0x2c17fd['id']);return setRelationship(_0x4881be,_0x4c5a3f,_0x2c17fd,_0x9f19('0x5f'));})[_0x9f19('0x35')](function(){return setRelationship(_0x4881be,_0x25ec4c,_0x2c17fd,_0x9f19('0x60'));})[_0x9f19('0x35')](function(){return getServerInfo(_0x4881be);})['then'](function(_0x4d9238){var _0x2137a6=parseInt(_0x4d9238[_0x9f19('0x61')][_0x9f19('0x62')](0x0));var _0x118825=util[_0x9f19('0x1f')](_0x9f19('0x63'),_0x4c401f['remoteUri'],_0x2c17fd['id']);if(_0x2137a6>0x6){_0x118825=util['format']('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x4c401f[_0x9f19('0x4f')],_0x2c17fd['id']);}logger[_0x9f19('0x25')](_0x9f19('0x54'),_0x9f19('0x64'));emit(util[_0x9f19('0x1f')]('user:%s',_0x125e47[_0x9f19('0xc')]),'trigger:browser:url',{'uri':_0x118825});})[_0x9f19('0x65')](function(_0x19740c){logger[_0x9f19('0x66')](_0x9f19('0x54'),JSON[_0x9f19('0x1d')](_0x19740c));});};exports['outbound']=function(_0xb3e52a,_0x4a5006,_0x273dcc,_0xaad19a,_0x3ee01d,_0x474cb8,_0x3d9bb5){var _0x27b339,_0x38b2ac,_0x430d95,_0x8e325b;_0x474cb8[_0x9f19('0x4f')]=intUtil['stripTrailingSlash'](_0x474cb8[_0x9f19('0x4f')]);_0x474cb8[_0x9f19('0x51')]=intUtil[_0x9f19('0x50')](_0x474cb8[_0x9f19('0x51')]);def[_0x9f19('0x67')]=util[_0x9f19('0x1f')](_0x9f19('0x52'),_0x474cb8[_0x9f19('0x4f')]);if(_0x3d9bb5&&_0x3d9bb5[_0x9f19('0x68')]&&_0x3d9bb5['recordingFormat']!==_0x9f19('0x69')){logger['info'](_0x9f19('0x6a'),_0x9f19('0x55'));_0x4a5006[_0x9f19('0x56')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x474cb8['serverUrl'],_0x4a5006[_0x9f19('0x57')],md5(_0x4a5006[_0x9f19('0x57')]));}return getConnection(_0x474cb8)['then'](function(_0x293679){_0x8e325b=_0x293679;return getUser(_0x474cb8,_0xaad19a[_0x9f19('0xc')],_0x8e325b);})[_0x9f19('0x35')](function(_0x39cc91){_0x27b339=_0x39cc91;logger[_0x9f19('0x25')](_0x9f19('0x6b'),_0x27b339['id']);return getEndUser(_0x474cb8,_0x4a5006[_0x9f19('0x6c')],_0x4a5006[_0x9f19('0x6d')],_0x8e325b);})['then'](function(_0x37b15c){_0x38b2ac=_0x37b15c;logger[_0x9f19('0x25')](_0x9f19('0x5a'),_0x38b2ac['id']);return getTicket(_0x474cb8,_0x27b339,_0x38b2ac,_0x273dcc,_0x4a5006,_0x273dcc['Fields'],_0x8e325b,_0x9f19('0x6e'));})[_0x9f19('0x35')](function(_0x53e660){_0x430d95=_0x53e660;logger[_0x9f19('0x25')](_0x9f19('0x5d'));logger[_0x9f19('0x25')]('The\x20Ticket\x20ID\x20is:',_0x430d95['id']);return setRelationship(_0x8e325b,_0x27b339,_0x430d95,_0x9f19('0x5f'));})[_0x9f19('0x35')](function(){return setRelationship(_0x8e325b,_0x38b2ac,_0x430d95,_0x9f19('0x60'));})['then'](function(){return getServerInfo(_0x8e325b);})[_0x9f19('0x35')](function(_0x5a2e63){var _0x495992=parseInt(_0x5a2e63[_0x9f19('0x61')][_0x9f19('0x62')](0x0));var _0x103768=util[_0x9f19('0x1f')]('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x474cb8['remoteUri'],_0x430d95['id']);if(_0x495992>0x6){_0x103768=util[_0x9f19('0x1f')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x474cb8['remoteUri'],_0x430d95['id']);}logger[_0x9f19('0x25')]('[OUTBOUND]',_0x9f19('0x64'));emit(util[_0x9f19('0x1f')](_0x9f19('0x6f'),_0xaad19a[_0x9f19('0xc')]),_0x9f19('0x70'),{'uri':_0x103768});})[_0x9f19('0x65')](function(_0x3193f7){logger[_0x9f19('0x66')](_0x9f19('0x6a'),JSON[_0x9f19('0x1d')](_0x3193f7));});};exports[_0x9f19('0x71')]=function(_0x18c3ca,_0x22eee7,_0x5b7f2a,_0x4450d9,_0x2b6242,_0x57fa90){var _0x5256b4,_0x3c1812,_0x110739,_0x3e9407;_0x57fa90[_0x9f19('0x4f')]=intUtil['stripTrailingSlash'](_0x57fa90[_0x9f19('0x4f')]);_0x57fa90[_0x9f19('0x51')]=intUtil[_0x9f19('0x50')](_0x57fa90['serverUrl']);def[_0x9f19('0x67')]=util[_0x9f19('0x1f')](_0x9f19('0x52'),_0x57fa90['remoteUri']);if(_0x2b6242&&_0x2b6242[_0x9f19('0x53')]){logger[_0x9f19('0x25')]('['+_0x22eee7[_0x9f19('0x72')][_0x9f19('0x73')]()+']','Recording\x20is\x20enabled!');_0x22eee7['recordingURL']=util[_0x9f19('0x1f')](_0x9f19('0x74'),_0x57fa90['serverUrl'],_0x22eee7[_0x9f19('0x57')],md5(_0x22eee7[_0x9f19('0x57')]));}else{_0x22eee7[_0x9f19('0x56')]='';}return getConnection(_0x57fa90)[_0x9f19('0x35')](function(_0x577f25){_0x3e9407=_0x577f25;if(!_['isNil'](_0x4450d9)){return getUser(_0x57fa90,_0x4450d9[_0x9f19('0xc')],_0x3e9407);}else{return getUser(_0x57fa90,null,_0x3e9407);}})['then'](function(_0x76f3da){_0x5256b4=_0x76f3da;logger['info'](_0x9f19('0x6b'),_0x5256b4['id']);return getEndUser(_0x57fa90,_0x22eee7[_0x9f19('0x58')],_0x22eee7[_0x9f19('0x59')],_0x3e9407);})[_0x9f19('0x35')](function(_0x57f880){_0x3c1812=_0x57f880;logger[_0x9f19('0x25')](_0x9f19('0x5a'),_0x3c1812['id']);return getTicket(_0x57fa90,_0x5256b4,_0x3c1812,_0x5b7f2a,_0x22eee7,_0x5b7f2a['Fields'],_0x3e9407,_0x9f19('0x5c'));})[_0x9f19('0x35')](function(_0x419afa){_0x110739=_0x419afa;logger[_0x9f19('0x25')](_0x9f19('0x5d'));logger[_0x9f19('0x25')]('The\x20Ticket\x20ID\x20is:',_0x110739['id']);return setRelationship(_0x3e9407,_0x5256b4,_0x110739,_0x9f19('0x5f'));})[_0x9f19('0x35')](function(){return setRelationship(_0x3e9407,_0x3c1812,_0x110739,_0x9f19('0x60'));})[_0x9f19('0x35')](function(){return getServerInfo(_0x3e9407);})['catch'](function(_0x4bef2b){logger[_0x9f19('0x66')]('['+_0x22eee7[_0x9f19('0x72')][_0x9f19('0x73')]()+']',JSON[_0x9f19('0x1d')](_0x4bef2b));});}; \ No newline at end of file +var _0xda73=['ioredis','./util','../../../../config/logger','sugarcrm','defaults','socket.io-emitter','redis','POST','emit','info','Creating\x20new\x20ticket...','getString','Subjects','description','Descriptions','date_start','slice','replace','duration_hours','parent_id','parent_type','Contacts','name','direction','length','forEach','variableName','push','idField','set_entry','JSON','Calls','format','Basic\x20%s','apiKey','toString','base64','get_server_info','stringify','isNil','Getting\x20agent\x20with\x20name','get_entry_list','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','entry_list','find','value','resolve','name_value_list','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','then','','Caller\x20-\x20%s','Enduser\x20created.','first_name','debug','[HTTP]','merge','map','type','string','customField','nameField','toLowerCase','content','custom_fields','variable','customVariable','Variable','login','PLAIN','xCALLY\x20Motion\x20integration','Account\x20%d\x20is\x20not\x20valid','set_relationship','queue','remoteUri','serverUrl','stripTrailingSlash','uri','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','contacts','version','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','catch','error','outbound','recordingFormat','none','[OUTBOUND]','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','Fields','Outbound','charAt','unmanaged','%s/service/v4_1/rest.php','lastevent','toUpperCase','lodash','bluebird','md5','util'];(function(_0x253e53,_0xe34b8){var _0x50dfa4=function(_0x54f1dc){while(--_0x54f1dc){_0x253e53['push'](_0x253e53['shift']());}};_0x50dfa4(++_0xe34b8);}(_0xda73,0x173));var _0x3da7=function(_0x4d2505,_0xcd54e7){_0x4d2505=_0x4d2505-0x0;var _0x13aa7f=_0xda73[_0x4d2505];return _0x13aa7f;};'use strict';var _=require(_0x3da7('0x0'));var rp=require('request-promise');var BPromise=require(_0x3da7('0x1'));var md5=require(_0x3da7('0x2'));var util=require(_0x3da7('0x3'));var Redis=require(_0x3da7('0x4'));var intUtil=require(_0x3da7('0x5'));var config=require('../../../../config/environment');var logger=require(_0x3da7('0x6'))(_0x3da7('0x7'));config['redis']=_[_0x3da7('0x8')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x3da7('0x9'))(new Redis(config[_0x3da7('0xa')]));var def={'method':_0x3da7('0xb'),'json':!![]};function emit(_0x3747d1,_0xcf293e,_0x5017ba){io['to'](_0x3747d1)[_0x3da7('0xc')](_0xcf293e,_0x5017ba);}function getTicket(_0x139358,_0x17ebd9,_0x49d15e,_0x22d165,_0xdda4b4,_0x1cd2cd,_0x543417,_0xe47027){logger[_0x3da7('0xd')](_0x3da7('0xe'));var _0x37ccda=new Date();var _0x34588c=[{'name':'name','value':intUtil[_0x3da7('0xf')](_0x22d165[_0x3da7('0x10')],_0xdda4b4,'\x20')},{'name':'assigned_user_id','value':_0x17ebd9['id']},{'name':'created_by','value':_0x17ebd9['id']},{'name':_0x3da7('0x11'),'value':intUtil[_0x3da7('0xf')](_0x22d165[_0x3da7('0x12')],_0xdda4b4,'\x0a')},{'name':_0x3da7('0x13'),'value':_0x37ccda['toISOString']()[_0x3da7('0x14')](0x0,0x13)[_0x3da7('0x15')]('T','\x20')},{'name':_0x3da7('0x16'),'value':'0'},{'name':'duration_minutes','value':'15'},{'name':_0x3da7('0x17'),'value':_0x49d15e['id']},{'name':_0x3da7('0x18'),'value':_0x3da7('0x19')},{'name':'parent_name','value':_0x49d15e[_0x3da7('0x1a')]},{'name':_0x3da7('0x1b'),'value':_0xe47027}];if(_0x1cd2cd[_0x3da7('0x1c')]){_[_0x3da7('0x1d')](_0x1cd2cd,function(_0x18a7fd){if(_0xdda4b4[_0x18a7fd[_0x3da7('0x1e')]]){_0x34588c[_0x3da7('0x1f')]({'name':_0x18a7fd[_0x3da7('0x20')],'value':_0xdda4b4[_0x18a7fd[_0x3da7('0x1e')]]});}});}return request({'form':{'method':_0x3da7('0x21'),'input_type':_0x3da7('0x22'),'response_type':_0x3da7('0x22'),'rest_data':JSON['stringify']({'session':_0x543417['id'],'module_name':_0x3da7('0x23'),'name_value_list':_0x34588c})}});}function getAuth(_0x13fe6f){return util[_0x3da7('0x24')](_0x3da7('0x25'),new Buffer(_0x13fe6f[_0x3da7('0x26')]+':X')[_0x3da7('0x27')](_0x3da7('0x28')));}function getServerInfo(_0x4f171d){return request({'form':{'method':_0x3da7('0x29'),'input_type':_0x3da7('0x22'),'response_type':_0x3da7('0x22'),'rest_data':JSON[_0x3da7('0x2a')]({'session':_0x4f171d['id']})}});}function getUser(_0x4ba85d,_0x501542,_0x58cd27){if(!_[_0x3da7('0x2b')](_0x501542)){logger[_0x3da7('0xd')](_0x3da7('0x2c'),_0x501542);return request({'form':{'method':_0x3da7('0x2d'),'input_type':_0x3da7('0x22'),'response_type':_0x3da7('0x22'),'rest_data':JSON[_0x3da7('0x2a')]({'session':_0x58cd27['id'],'module_name':_0x3da7('0x2e'),'query':util[_0x3da7('0x24')](_0x3da7('0x2f'),_0x501542),'order_by':'','offset':'0','select_fields':['id','name',_0x3da7('0x30')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x303028){if(_0x303028[_0x3da7('0x31')][_0x3da7('0x1c')]){var _0x1ca1b2=_[_0x3da7('0x32')](_0x303028['entry_list'],function(_0x32ca65){return _0x32ca65['name_value_list'][_0x3da7('0x30')][_0x3da7('0x33')]===_0x501542;});if(_0x1ca1b2){logger[_0x3da7('0xd')]('Agent\x20found!');return BPromise[_0x3da7('0x34')]({'id':_0x1ca1b2[_0x3da7('0x35')]['id'][_0x3da7('0x33')],'name':_0x1ca1b2[_0x3da7('0x35')][_0x3da7('0x1a')][_0x3da7('0x33')]});}}logger['info'](_0x3da7('0x36'));return BPromise[_0x3da7('0x34')]({'id':_0x58cd27[_0x3da7('0x35')][_0x3da7('0x37')][_0x3da7('0x33')],'name':_0x58cd27['name_value_list'][_0x3da7('0x30')]['value']});});}else{logger[_0x3da7('0xd')](_0x3da7('0x38'));return BPromise[_0x3da7('0x34')]({'id':_0x58cd27[_0x3da7('0x35')][_0x3da7('0x37')][_0x3da7('0x33')],'name':_0x58cd27[_0x3da7('0x35')][_0x3da7('0x30')][_0x3da7('0x33')]});}}function getEndUser(_0x27edab,_0x3a6643,_0x533e01,_0x24810a){logger[_0x3da7('0xd')](_0x3da7('0x39'),_0x533e01);return request({'form':{'method':_0x3da7('0x2d'),'input_type':_0x3da7('0x22'),'response_type':_0x3da7('0x22'),'rest_data':JSON['stringify']({'session':_0x24810a['id'],'module_name':_0x3da7('0x19'),'query':util[_0x3da7('0x24')](_0x3da7('0x3a'),_0x533e01),'order_by':'','offset':'0','select_fields':['id','name',_0x3da7('0x3b')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x3da7('0x3c')](function(_0x18c4be){if(_0x18c4be[_0x3da7('0x31')][_0x3da7('0x1c')]){var _0x482594=_[_0x3da7('0x32')](_0x18c4be[_0x3da7('0x31')],function(_0x2d17b6){return _0x2d17b6[_0x3da7('0x35')][_0x3da7('0x3b')][_0x3da7('0x33')]===_0x533e01;});if(_0x482594){logger[_0x3da7('0xd')]('Enduser\x20found!');return BPromise[_0x3da7('0x34')]({'id':_0x482594[_0x3da7('0x35')]['id']['value'],'name':_0x482594['name_value_list'][_0x3da7('0x1a')]['value'],'phone':_0x482594[_0x3da7('0x35')][_0x3da7('0x3b')]['value']});}}else{logger['info']('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'form':{'method':_0x3da7('0x21'),'input_type':_0x3da7('0x22'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0x24810a['id'],'module_name':_0x3da7('0x19'),'name_value_list':[{'name':'first_name','value':_0x3a6643!==_0x3da7('0x3d')?_0x3a6643:util['format'](_0x3da7('0x3e'),_0x533e01)},{'name':_0x3da7('0x3b'),'value':_0x533e01}]})}})[_0x3da7('0x3c')](function(_0x46bdcb){logger[_0x3da7('0xd')](_0x3da7('0x3f'));return BPromise['resolve']({'id':_0x46bdcb['id'],'name':_0x46bdcb['entry_list'][_0x3da7('0x40')][_0x3da7('0x33')],'phone':_0x46bdcb[_0x3da7('0x31')]['phone_home'][_0x3da7('0x33')]});});}});}function request(_0x46071e){logger[_0x3da7('0x41')](_0x3da7('0x42'),JSON[_0x3da7('0x2a')](_0x46071e));return rp(_[_0x3da7('0x43')](def,_0x46071e));}function getTags(_0x4f6da6,_0x20591f){var _0x368907=[];if(_0x4f6da6&&_0x4f6da6[_0x3da7('0x1c')]>0x0){_0x368907=_[_0x3da7('0x44')](_0x4f6da6,_0x20591f);}return _0x368907;}function getCustomFields(_0x20bd9d,_0x50ad58){var _0x4c5f69=[];var _0x2b7dbf={'custom_fields':[]};if(_0x20bd9d[_0x3da7('0x1c')]>0x0){_[_0x3da7('0x1d')](_0x20bd9d,function(_0x2a27f9){if(_0x2a27f9[_0x3da7('0x45')]===_0x3da7('0x46')&&_0x2a27f9['nameField']&&!_0x2a27f9[_0x3da7('0x47')]){_0x2b7dbf[_0x2a27f9[_0x3da7('0x48')][_0x3da7('0x49')]()]=_0x2a27f9[_0x3da7('0x4a')][_0x3da7('0x27')]();}else if(_0x2a27f9['type']===_0x3da7('0x46')&&_0x2a27f9[_0x3da7('0x20')]&&_0x2a27f9[_0x3da7('0x47')]){_0x2b7dbf[_0x3da7('0x4b')][_0x3da7('0x1f')]({'id':_0x2a27f9[_0x3da7('0x20')],'value':_0x2a27f9[_0x3da7('0x4a')][_0x3da7('0x27')]()});}else if(_0x2a27f9[_0x3da7('0x45')]===_0x3da7('0x4c')&&_0x2a27f9[_0x3da7('0x1e')]&&_0x2a27f9['idField']&&_0x2a27f9[_0x3da7('0x47')]){_0x50ad58[_0x2a27f9[_0x3da7('0x1e')]]&&_0x2b7dbf[_0x3da7('0x4b')][_0x3da7('0x1f')]({'id':_0x2a27f9['idField'],'value':_0x50ad58[_0x2a27f9['variableName']][_0x3da7('0x27')]()});}else if(_0x2a27f9[_0x3da7('0x45')]===_0x3da7('0x4d')&&_0x2a27f9['Variable']&&_0x2a27f9[_0x3da7('0x4e')][_0x3da7('0x1a')]&&_0x2a27f9[_0x3da7('0x20')]&&_0x2a27f9[_0x3da7('0x47')]){_0x50ad58[_0x2a27f9[_0x3da7('0x4e')][_0x3da7('0x1a')][_0x3da7('0x49')]()]&&_0x2b7dbf[_0x3da7('0x4b')][_0x3da7('0x1f')]({'id':_0x2a27f9[_0x3da7('0x20')],'value':_0x50ad58[_0x2a27f9[_0x3da7('0x4e')]['name'][_0x3da7('0x49')]()][_0x3da7('0x27')]()});}});}return _0x2b7dbf;}function getConnection(_0x26b426){return request({'method':_0x3da7('0xb'),'form':{'method':_0x3da7('0x4f'),'input_type':_0x3da7('0x22'),'response_type':_0x3da7('0x22'),'rest_data':JSON[_0x3da7('0x2a')]({'user_auth':{'user_name':_0x26b426['username'],'password':_0x26b426['password'],'encryption':_0x3da7('0x50')},'application':_0x3da7('0x51')})}})['then'](function(_0x3f3a51){var _0x3449b4=_0x3f3a51;if(_0x3449b4['id']){def['sessionID']=_0x3449b4['id'];return BPromise['resolve'](_0x3449b4);}else{throw new Error(util['format'](_0x3da7('0x52'),_0x26b426['id']));}});}function setRelationship(_0x398822,_0x50bfef,_0x3d3baa,_0x27c27a){return request({'form':{'method':_0x3da7('0x53'),'input_type':_0x3da7('0x22'),'response_type':_0x3da7('0x22'),'rest_data':JSON[_0x3da7('0x2a')]({'session':_0x398822['id'],'module_name':_0x3da7('0x23'),'module_id':_0x3d3baa['id'],'link_field_name':_0x27c27a,'related_ids':[_0x50bfef['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x3da7('0x54')]=function(_0x3ec697,_0x2b325f,_0x4ca229,_0x4c87ca,_0x4e3413,_0x28242b){var _0x491314,_0x41c4d5,_0x3d9221,_0x412b96;_0x28242b[_0x3da7('0x55')]=intUtil['stripTrailingSlash'](_0x28242b[_0x3da7('0x55')]);_0x28242b[_0x3da7('0x56')]=intUtil[_0x3da7('0x57')](_0x28242b['serverUrl']);def[_0x3da7('0x58')]=util[_0x3da7('0x24')]('%s/service/v4_1/rest.php',_0x28242b[_0x3da7('0x55')]);if(_0x4e3413&&_0x4e3413[_0x3da7('0x59')]){logger[_0x3da7('0xd')]('[QUEUE]',_0x3da7('0x5a'));_0x2b325f[_0x3da7('0x5b')]=util[_0x3da7('0x24')](_0x3da7('0x5c'),_0x28242b[_0x3da7('0x56')],_0x2b325f[_0x3da7('0x5d')],md5(_0x2b325f[_0x3da7('0x5d')]));}else{_0x2b325f[_0x3da7('0x5b')]='';}return getConnection(_0x28242b)[_0x3da7('0x3c')](function(_0x3c069c){_0x412b96=_0x3c069c;return getUser(_0x28242b,_0x4c87ca[_0x3da7('0x1a')],_0x412b96);})[_0x3da7('0x3c')](function(_0xe579dc){_0x491314=_0xe579dc;logger[_0x3da7('0xd')]('The\x20User\x20ID\x20is:',_0x491314['id']);return getEndUser(_0x28242b,_0x2b325f[_0x3da7('0x5e')],_0x2b325f[_0x3da7('0x5f')],_0x412b96);})[_0x3da7('0x3c')](function(_0x540882){_0x41c4d5=_0x540882;logger[_0x3da7('0xd')](_0x3da7('0x60'),_0x41c4d5['id']);return getTicket(_0x28242b,_0x491314,_0x41c4d5,_0x4ca229,_0x2b325f,_0x4ca229['Fields'],_0x412b96,_0x3da7('0x61'));})['then'](function(_0x469365){_0x3d9221=_0x469365;logger['info'](_0x3da7('0x62'));logger[_0x3da7('0xd')](_0x3da7('0x63'),_0x3d9221['id']);return setRelationship(_0x412b96,_0x491314,_0x3d9221,_0x3da7('0x64'));})[_0x3da7('0x3c')](function(){return setRelationship(_0x412b96,_0x41c4d5,_0x3d9221,_0x3da7('0x65'));})['then'](function(){return getServerInfo(_0x412b96);})[_0x3da7('0x3c')](function(_0x49ceaa){var _0x2fc7a9=parseInt(_0x49ceaa[_0x3da7('0x66')]['charAt'](0x0));var _0x577188=util[_0x3da7('0x24')](_0x3da7('0x67'),_0x28242b[_0x3da7('0x55')],_0x3d9221['id']);if(_0x2fc7a9>0x6){_0x577188=util['format'](_0x3da7('0x68'),_0x28242b[_0x3da7('0x55')],_0x3d9221['id']);}logger[_0x3da7('0xd')](_0x3da7('0x69'),_0x3da7('0x6a'));emit(util[_0x3da7('0x24')](_0x3da7('0x6b'),_0x4c87ca['name']),_0x3da7('0x6c'),{'uri':_0x577188});})[_0x3da7('0x6d')](function(_0x189af0){logger[_0x3da7('0x6e')](_0x3da7('0x69'),JSON[_0x3da7('0x2a')](_0x189af0));});};exports[_0x3da7('0x6f')]=function(_0x2b9379,_0x2ccaa7,_0x4018a2,_0x3437ef,_0x47e3fb,_0x531222,_0x1ba4ad){var _0x165590,_0xe9fe23,_0x5596b3,_0x5a7083;_0x531222[_0x3da7('0x55')]=intUtil['stripTrailingSlash'](_0x531222[_0x3da7('0x55')]);_0x531222[_0x3da7('0x56')]=intUtil[_0x3da7('0x57')](_0x531222[_0x3da7('0x56')]);def['uri']=util[_0x3da7('0x24')]('%s/service/v4_1/rest.php',_0x531222[_0x3da7('0x55')]);if(_0x1ba4ad&&_0x1ba4ad[_0x3da7('0x70')]&&_0x1ba4ad['recordingFormat']!==_0x3da7('0x71')){logger[_0x3da7('0xd')](_0x3da7('0x72'),_0x3da7('0x5a'));_0x2ccaa7[_0x3da7('0x5b')]=util[_0x3da7('0x24')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x531222['serverUrl'],_0x2ccaa7['uniqueid'],md5(_0x2ccaa7['uniqueid']));}return getConnection(_0x531222)[_0x3da7('0x3c')](function(_0x403843){_0x5a7083=_0x403843;return getUser(_0x531222,_0x3437ef[_0x3da7('0x1a')],_0x5a7083);})[_0x3da7('0x3c')](function(_0x490c28){_0x165590=_0x490c28;logger[_0x3da7('0xd')](_0x3da7('0x73'),_0x165590['id']);return getEndUser(_0x531222,_0x2ccaa7[_0x3da7('0x74')],_0x2ccaa7[_0x3da7('0x75')],_0x5a7083);})[_0x3da7('0x3c')](function(_0x3c67d7){_0xe9fe23=_0x3c67d7;logger[_0x3da7('0xd')]('The\x20Enduser\x20ID\x20is:',_0xe9fe23['id']);return getTicket(_0x531222,_0x165590,_0xe9fe23,_0x4018a2,_0x2ccaa7,_0x4018a2[_0x3da7('0x76')],_0x5a7083,_0x3da7('0x77'));})[_0x3da7('0x3c')](function(_0x34b1e2){_0x5596b3=_0x34b1e2;logger[_0x3da7('0xd')](_0x3da7('0x62'));logger[_0x3da7('0xd')]('The\x20Ticket\x20ID\x20is:',_0x5596b3['id']);return setRelationship(_0x5a7083,_0x165590,_0x5596b3,_0x3da7('0x64'));})['then'](function(){return setRelationship(_0x5a7083,_0xe9fe23,_0x5596b3,_0x3da7('0x65'));})[_0x3da7('0x3c')](function(){return getServerInfo(_0x5a7083);})[_0x3da7('0x3c')](function(_0x19e431){var _0x173b9d=parseInt(_0x19e431[_0x3da7('0x66')][_0x3da7('0x78')](0x0));var _0x2cc850=util[_0x3da7('0x24')](_0x3da7('0x67'),_0x531222['remoteUri'],_0x5596b3['id']);if(_0x173b9d>0x6){_0x2cc850=util['format']('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x531222[_0x3da7('0x55')],_0x5596b3['id']);}logger['info']('[OUTBOUND]',_0x3da7('0x6a'));emit(util[_0x3da7('0x24')](_0x3da7('0x6b'),_0x3437ef[_0x3da7('0x1a')]),_0x3da7('0x6c'),{'uri':_0x2cc850});})[_0x3da7('0x6d')](function(_0x5c2c10){logger['error'](_0x3da7('0x72'),JSON['stringify'](_0x5c2c10));});};exports[_0x3da7('0x79')]=function(_0x330daa,_0x548e01,_0x9e26e6,_0x525488,_0xa31575,_0x57ea36){var _0x471d3d,_0x1ed47e,_0x79ad50,_0x394a85;_0x57ea36[_0x3da7('0x55')]=intUtil['stripTrailingSlash'](_0x57ea36[_0x3da7('0x55')]);_0x57ea36[_0x3da7('0x56')]=intUtil[_0x3da7('0x57')](_0x57ea36[_0x3da7('0x56')]);def[_0x3da7('0x58')]=util[_0x3da7('0x24')](_0x3da7('0x7a'),_0x57ea36[_0x3da7('0x55')]);if(_0xa31575&&_0xa31575[_0x3da7('0x59')]){logger[_0x3da7('0xd')]('['+_0x548e01[_0x3da7('0x7b')]['toUpperCase']()+']',_0x3da7('0x5a'));_0x548e01[_0x3da7('0x5b')]=util[_0x3da7('0x24')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x57ea36['serverUrl'],_0x548e01[_0x3da7('0x5d')],md5(_0x548e01[_0x3da7('0x5d')]));}else{_0x548e01[_0x3da7('0x5b')]='';}return getConnection(_0x57ea36)['then'](function(_0x37ff5f){_0x394a85=_0x37ff5f;if(!_[_0x3da7('0x2b')](_0x525488)){return getUser(_0x57ea36,_0x525488[_0x3da7('0x1a')],_0x394a85);}else{return getUser(_0x57ea36,null,_0x394a85);}})[_0x3da7('0x3c')](function(_0xa88a82){_0x471d3d=_0xa88a82;logger['info'](_0x3da7('0x73'),_0x471d3d['id']);return getEndUser(_0x57ea36,_0x548e01[_0x3da7('0x5e')],_0x548e01[_0x3da7('0x5f')],_0x394a85);})[_0x3da7('0x3c')](function(_0x425ab5){_0x1ed47e=_0x425ab5;logger['info']('The\x20Enduser\x20ID\x20is:',_0x1ed47e['id']);return getTicket(_0x57ea36,_0x471d3d,_0x1ed47e,_0x9e26e6,_0x548e01,_0x9e26e6['Fields'],_0x394a85,'Inbound');})[_0x3da7('0x3c')](function(_0x5de38f){_0x79ad50=_0x5de38f;logger['info']('Ticket\x20created!');logger[_0x3da7('0xd')]('The\x20Ticket\x20ID\x20is:',_0x79ad50['id']);return setRelationship(_0x394a85,_0x471d3d,_0x79ad50,'users');})[_0x3da7('0x3c')](function(){return setRelationship(_0x394a85,_0x1ed47e,_0x79ad50,_0x3da7('0x65'));})[_0x3da7('0x3c')](function(){return getServerInfo(_0x394a85);})[_0x3da7('0x6d')](function(_0x172506){logger[_0x3da7('0x6e')]('['+_0x548e01[_0x3da7('0x7b')][_0x3da7('0x7c')]()+']',JSON[_0x3da7('0x2a')](_0x172506));});}; \ 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 c6d4a51..1e37563 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 _0xc9d0=['variable','variableName','toString','type','customVariable','Variable','name','toLowerCase','keyValue','keyType','key','format','%s:\x20%s','keyContent','join','stripTrailingSlash','slice','substring','lastIndexOf','validateEmail','isNil','test','lodash','util','getString','length','sortBy','string','push','content'];(function(_0x429aef,_0x354389){var _0x2e6ebc=function(_0x544a6d){while(--_0x544a6d){_0x429aef['push'](_0x429aef['shift']());}};_0x2e6ebc(++_0x354389);}(_0xc9d0,0x142));var _0x0c9d=function(_0x4340ca,_0x590b87){_0x4340ca=_0x4340ca-0x0;var _0x163acb=_0xc9d0[_0x4340ca];return _0x163acb;};'use strict';var _=require(_0x0c9d('0x0'));var util=require(_0x0c9d('0x1'));exports[_0x0c9d('0x2')]=function(_0x5074dd,_0x3162c4,_0x518902){var _0x5a8390=[];if(_0x5074dd[_0x0c9d('0x3')]>0x0){var _0x13a1f6=_[_0x0c9d('0x4')](_0x5074dd,['id']);for(var _0x22e4ac=0x0;_0x22e4ac<_0x13a1f6['length'];_0x22e4ac++){var _0x4f945d=_0x13a1f6[_0x22e4ac];if(_0x4f945d['type']===_0x0c9d('0x5')){_0x5a8390[_0x0c9d('0x6')](_0x4f945d[_0x0c9d('0x7')]);}else if(_0x4f945d['type']===_0x0c9d('0x8')&&_0x4f945d[_0x0c9d('0x9')]){_0x3162c4[_0x4f945d[_0x0c9d('0x9')]]&&_0x5a8390[_0x0c9d('0x6')](_0x3162c4[_0x4f945d[_0x0c9d('0x9')]][_0x0c9d('0xa')]());}else if(_0x4f945d[_0x0c9d('0xb')]===_0x0c9d('0xc')&&_0x4f945d[_0x0c9d('0xd')]&&_0x4f945d['Variable'][_0x0c9d('0xe')]){_0x3162c4[_0x4f945d[_0x0c9d('0xd')][_0x0c9d('0xe')][_0x0c9d('0xf')]()]&&_0x5a8390[_0x0c9d('0x6')](_0x3162c4[_0x4f945d[_0x0c9d('0xd')][_0x0c9d('0xe')][_0x0c9d('0xf')]()]['toString']());}else if(_0x4f945d[_0x0c9d('0xb')]===_0x0c9d('0x10')){if(_0x4f945d[_0x0c9d('0x11')]===_0x0c9d('0x5')&&_0x4f945d[_0x0c9d('0x12')]){_0x5a8390[_0x0c9d('0x6')](util[_0x0c9d('0x13')](_0x0c9d('0x14'),_0x4f945d['key'],_0x4f945d[_0x0c9d('0x15')]));}else if(_0x4f945d['keyType']===_0x0c9d('0x8')&&_0x4f945d[_0x0c9d('0x9')]&&_0x4f945d[_0x0c9d('0x12')]){_0x3162c4[_0x4f945d[_0x0c9d('0x9')]]&&_0x5a8390[_0x0c9d('0x6')](util[_0x0c9d('0x13')](_0x0c9d('0x14'),_0x4f945d[_0x0c9d('0x12')],_0x3162c4[_0x4f945d[_0x0c9d('0x9')]]));}else if(_0x4f945d['keyType']===_0x0c9d('0xc')&&_0x4f945d[_0x0c9d('0xd')]&&_0x4f945d[_0x0c9d('0xd')][_0x0c9d('0xe')]&&_0x4f945d[_0x0c9d('0x12')]){_0x3162c4[_0x4f945d[_0x0c9d('0xd')]['name'][_0x0c9d('0xf')]()]&&_0x5a8390[_0x0c9d('0x6')](util[_0x0c9d('0x13')](_0x0c9d('0x14'),_0x4f945d[_0x0c9d('0x12')],_0x3162c4[_0x4f945d[_0x0c9d('0xd')]['name'][_0x0c9d('0xf')]()]));}}}}return _0x5a8390[_0x0c9d('0x16')](_0x518902);};exports[_0x0c9d('0x17')]=function(_0x2e9833){var _0x2fe2c7=_0x2e9833[_0x0c9d('0x18')](-0x1);if(_0x2fe2c7==='/'){_0x2e9833=_0x2e9833[_0x0c9d('0x19')](0x0,_0x2e9833[_0x0c9d('0x1a')](_0x2fe2c7));}return _0x2e9833;};exports[_0x0c9d('0x1b')]=function(_0x1f07a4){if(!_[_0x0c9d('0x1c')](_0x1f07a4)&&_0x1f07a4!==''){var _0x12bd1f=/^(([^<>()\[\]\\.,;:\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 _0x12bd1f[_0x0c9d('0x1d')](String(_0x1f07a4)['toLowerCase']());}else{return![];}}; \ No newline at end of file +var _0xc502=['getString','length','type','string','push','content','variable','variableName','toString','customVariable','Variable','name','toLowerCase','keyValue','keyType','key','keyContent','%s:\x20%s','format','join','stripTrailingSlash','slice','lastIndexOf','validateEmail','isNil','test','lodash','util'];(function(_0x5d8bf3,_0x2577f0){var _0x22e400=function(_0x271f9f){while(--_0x271f9f){_0x5d8bf3['push'](_0x5d8bf3['shift']());}};_0x22e400(++_0x2577f0);}(_0xc502,0x8a));var _0x2c50=function(_0x5dff12,_0x13c07f){_0x5dff12=_0x5dff12-0x0;var _0x292e58=_0xc502[_0x5dff12];return _0x292e58;};'use strict';var _=require(_0x2c50('0x0'));var util=require(_0x2c50('0x1'));exports[_0x2c50('0x2')]=function(_0xff737f,_0x471cce,_0x2c8881){var _0x2e937a=[];if(_0xff737f[_0x2c50('0x3')]>0x0){var _0x2fc90c=_['sortBy'](_0xff737f,['id']);for(var _0x113328=0x0;_0x113328<_0x2fc90c[_0x2c50('0x3')];_0x113328++){var _0x262084=_0x2fc90c[_0x113328];if(_0x262084[_0x2c50('0x4')]===_0x2c50('0x5')){_0x2e937a[_0x2c50('0x6')](_0x262084[_0x2c50('0x7')]);}else if(_0x262084['type']===_0x2c50('0x8')&&_0x262084['variableName']){_0x471cce[_0x262084[_0x2c50('0x9')]]&&_0x2e937a['push'](_0x471cce[_0x262084[_0x2c50('0x9')]][_0x2c50('0xa')]());}else if(_0x262084[_0x2c50('0x4')]===_0x2c50('0xb')&&_0x262084[_0x2c50('0xc')]&&_0x262084[_0x2c50('0xc')][_0x2c50('0xd')]){_0x471cce[_0x262084['Variable'][_0x2c50('0xd')]['toLowerCase']()]&&_0x2e937a[_0x2c50('0x6')](_0x471cce[_0x262084[_0x2c50('0xc')]['name'][_0x2c50('0xe')]()][_0x2c50('0xa')]());}else if(_0x262084[_0x2c50('0x4')]===_0x2c50('0xf')){if(_0x262084[_0x2c50('0x10')]===_0x2c50('0x5')&&_0x262084[_0x2c50('0x11')]){_0x2e937a[_0x2c50('0x6')](util['format']('%s:\x20%s',_0x262084['key'],_0x262084[_0x2c50('0x12')]));}else if(_0x262084['keyType']===_0x2c50('0x8')&&_0x262084['variableName']&&_0x262084[_0x2c50('0x11')]){_0x471cce[_0x262084[_0x2c50('0x9')]]&&_0x2e937a['push'](util['format'](_0x2c50('0x13'),_0x262084[_0x2c50('0x11')],_0x471cce[_0x262084[_0x2c50('0x9')]]));}else if(_0x262084[_0x2c50('0x10')]===_0x2c50('0xb')&&_0x262084['Variable']&&_0x262084[_0x2c50('0xc')][_0x2c50('0xd')]&&_0x262084[_0x2c50('0x11')]){_0x471cce[_0x262084['Variable']['name'][_0x2c50('0xe')]()]&&_0x2e937a[_0x2c50('0x6')](util[_0x2c50('0x14')](_0x2c50('0x13'),_0x262084[_0x2c50('0x11')],_0x471cce[_0x262084[_0x2c50('0xc')][_0x2c50('0xd')]['toLowerCase']()]));}}}}return _0x2e937a[_0x2c50('0x15')](_0x2c8881);};exports[_0x2c50('0x16')]=function(_0x220a1f){var _0x55e265=_0x220a1f[_0x2c50('0x17')](-0x1);if(_0x55e265==='/'){_0x220a1f=_0x220a1f['substring'](0x0,_0x220a1f[_0x2c50('0x18')](_0x55e265));}return _0x220a1f;};exports[_0x2c50('0x19')]=function(_0x8bb1d4){if(!_[_0x2c50('0x1a')](_0x8bb1d4)&&_0x8bb1d4!==''){var _0x331aad=/^(([^<>()\[\]\\.,;:\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 _0x331aad[_0x2c50('0x1b')](String(_0x8bb1d4)['toLowerCase']());}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 2b57eed..9f9d17b 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(_0x609b0c,_0x309893){var _0x300ca0=function(_0x4f1474){while(--_0x4f1474){_0x609b0c['push'](_0x609b0c['shift']());}};_0x300ca0(++_0x309893);}(_0x9c44,0x178));var _0x49c4=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0x9c44[_0x160c73];return _0xd9302;};'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 _0x34e8=['redis','defaults','localhost','emit','length','forEach','includes','string','picklist','type','idField','toString','variableName','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','getString','Subjects','POST','format','remoteUri','create','sessionName','HelpDesk','stringify','success','error','catch','statusCode','Getting\x20agent\x20with\x20email','GET','%s/webservice.php','query','username','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','result','Agent\x20found!','resolve','email1','first_name','last_name','userId','[vTiger],\x20%s,\x20%s,\x20%s','getUser','admin','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','phone','getEndUser','accessKey','getchallenge','then','login','token','Account\x20%d\x20is\x20not\x20valid','getConnection','[HTTP]','queue','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','recordingURL','email','The\x20User\x20ID\x20is:','calleridnum','Fields','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','outbound','stripTrailingSlash','recordingFormat','none','[OUTBOUND]','uniqueid','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','split','unmanaged','lastevent','toUpperCase','calleridname','lodash','request-promise','bluebird','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','vTiger'];(function(_0x26c30e,_0x23f6ed){var _0x5efa2f=function(_0x41fb6a){while(--_0x41fb6a){_0x26c30e['push'](_0x26c30e['shift']());}};_0x5efa2f(++_0x23f6ed);}(_0x34e8,0x12c));var _0x834e=function(_0x509354,_0x1886d4){_0x509354=_0x509354-0x0;var _0x3dd637=_0x34e8[_0x509354];return _0x3dd637;};'use strict';var _=require(_0x834e('0x0'));var rp=require(_0x834e('0x1'));var BPromise=require(_0x834e('0x2'));var md5=require(_0x834e('0x3'));var util=require('util');var Redis=require(_0x834e('0x4'));var intUtil=require(_0x834e('0x5'));var config=require(_0x834e('0x6'));var logger=require(_0x834e('0x7'))(_0x834e('0x8'));config[_0x834e('0x9')]=_[_0x834e('0xa')](config['redis'],{'host':_0x834e('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x834e('0x9')]));function emit(_0x3cc2e3,_0x3a3ef6,_0x2e69e2){io['to'](_0x3cc2e3)[_0x834e('0xc')](_0x3a3ef6,_0x2e69e2);}function getCustomFields(_0x23501c,_0x363786){var _0x1af45a={};if(_0x23501c[_0x834e('0xd')]>0x0){_[_0x834e('0xe')](_0x23501c,function(_0x1e41fe){if(_[_0x834e('0xf')]([_0x834e('0x10'),_0x834e('0x11')],_0x1e41fe[_0x834e('0x12')])&&_0x1e41fe[_0x834e('0x13')]){_0x1af45a[_0x1e41fe[_0x834e('0x13')]]=_0x1e41fe['content'][_0x834e('0x14')]();}else if(_0x1e41fe[_0x834e('0x12')]==='variable'&&_0x1e41fe[_0x834e('0x15')]&&_0x1e41fe[_0x834e('0x13')]&&_0x363786[_0x1e41fe[_0x834e('0x15')]]){_0x1af45a[_0x1e41fe[_0x834e('0x13')]]=_0x363786[_0x1e41fe['variableName']][_0x834e('0x14')]();}else if(_0x1e41fe[_0x834e('0x12')]==='customVariable'&&_0x1e41fe[_0x834e('0x16')]&&_0x1e41fe['Variable'][_0x834e('0x17')]&&_0x1e41fe[_0x834e('0x13')]&&_0x363786[_0x1e41fe['Variable'][_0x834e('0x17')][_0x834e('0x18')]()]){_0x1af45a[_0x1e41fe[_0x834e('0x13')]]=_0x363786[_0x1e41fe['Variable'][_0x834e('0x17')][_0x834e('0x18')]()][_0x834e('0x14')]();}});}return _0x1af45a;}function createTicket(_0xb993a1,_0x237947,_0x254677,_0x1dd214,_0x595515,_0x2545b4,_0x1fd2c6){logger[_0x834e('0x19')](_0x834e('0x1a'));var _0x4ab05d=_[_0x834e('0x1b')]({'parent_id':'','assigned_user_id':_0x237947['id'],'ticketpriorities':_0x834e('0x1c'),'ticketstatus':'Open','ticket_title':intUtil[_0x834e('0x1d')](_0x1dd214[_0x834e('0x1e')],_0x595515,'\x20'),'description':intUtil[_0x834e('0x1d')](_0x1dd214['Descriptions'],_0x595515,'\x0a'),'contact_id':_0x254677['id']},getCustomFields(_0x2545b4,_0x595515));var _0x4e3f48={'method':_0x834e('0x1f'),'uri':util[_0x834e('0x20')]('%s/webservice.php',_0xb993a1[_0x834e('0x21')]),'form':{'operation':_0x834e('0x22'),'username':_0xb993a1['username'],'sessionName':_0x1fd2c6[_0x834e('0x23')],'elementType':_0x834e('0x24'),'element':JSON[_0x834e('0x25')](_0x4ab05d)},'json':!![]};return request(_0x4e3f48)['then'](function(_0x24fcf7){if(_0x24fcf7[_0x834e('0x26')]){return BPromise['resolve']({'id':_0x24fcf7['result']['id']});}else{throw new Error(util[_0x834e('0x20')]('Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s',JSON[_0x834e('0x25')](_0x24fcf7[_0x834e('0x27')])));}})[_0x834e('0x28')](function(_0x2cc2eb){var _0x3cd928=_0x2cc2eb[_0x834e('0x29')]||0x1f4;logger['error']('[vTiger],\x20%s,\x20%s,\x20%s','createTicket',_0x3cd928,JSON['stringify'](_0x2cc2eb));});}function getUser(_0x2c7a8d,_0x567cea,_0x106d6a){if(intUtil['validateEmail'](_0x567cea)){logger[_0x834e('0x19')](_0x834e('0x2a'),_0x567cea);return request({'method':_0x834e('0x2b'),'uri':util[_0x834e('0x20')](_0x834e('0x2c'),_0x2c7a8d[_0x834e('0x21')]),'qs':{'operation':_0x834e('0x2d'),'username':_0x2c7a8d[_0x834e('0x2e')],'sessionName':_0x106d6a[_0x834e('0x23')],'query':util['format'](_0x834e('0x2f'),_0x567cea)},'json':!![]})['then'](function(_0x2c75c2){if(_0x2c75c2[_0x834e('0x26')]&&_0x2c75c2[_0x834e('0x30')][_0x834e('0xd')]){logger[_0x834e('0x19')](_0x834e('0x31'));return BPromise[_0x834e('0x32')]({'id':_0x2c75c2[_0x834e('0x30')][0x0]['id'],'email':_0x2c75c2[_0x834e('0x30')][0x0][_0x834e('0x33')],'name':_0x2c75c2['result'][0x0][_0x834e('0x34')]+'\x20'+_0x2c75c2[_0x834e('0x30')][_0x834e('0x35')]});}else{logger[_0x834e('0x19')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x834e('0x32')]({'id':_0x106d6a[_0x834e('0x36')],'email':_0x2c7a8d['username'],'name':'admin'});}})['catch'](function(_0x3e58fa){var _0x41bf4d=_0x3e58fa[_0x834e('0x29')]||0x1f4;logger[_0x834e('0x27')](_0x834e('0x37'),_0x834e('0x38'),_0x41bf4d,JSON['stringify'](_0x3e58fa));});}else{logger[_0x834e('0x19')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x834e('0x32')]({'id':_0x106d6a[_0x834e('0x36')],'email':_0x2c7a8d['username'],'name':_0x834e('0x39')})[_0x834e('0x28')](function(_0x491c28){var _0x481f70=_0x491c28[_0x834e('0x29')]||0x1f4;logger[_0x834e('0x27')](_0x834e('0x37'),_0x834e('0x38'),_0x481f70,JSON[_0x834e('0x25')](_0x491c28));});}}function getEndUser(_0x4ca43c,_0x1c5ed6,_0x548d1d,_0x50c243){logger[_0x834e('0x19')]('Searching\x20end\x20user\x20with\x20phone',_0x548d1d);return request({'method':_0x834e('0x2b'),'uri':util[_0x834e('0x20')](_0x834e('0x2c'),_0x4ca43c[_0x834e('0x21')]),'qs':{'operation':_0x834e('0x2d'),'username':_0x4ca43c['username'],'sessionName':_0x50c243[_0x834e('0x23')],'query':util[_0x834e('0x20')](_0x834e('0x3a'),_0x548d1d,_0x548d1d,_0x548d1d,_0x548d1d,_0x548d1d)},'json':!![]})['then'](function(_0x35380e){if(_0x35380e[_0x834e('0x26')]&&_0x35380e['result'][_0x834e('0xd')]){logger['info'](_0x834e('0x3b'));return BPromise[_0x834e('0x32')]({'id':_0x35380e['result'][0x0]['id'],'name':_0x35380e['result'][0x0][_0x834e('0x3c')]+'\x20'+_0x35380e[_0x834e('0x30')][0x0][_0x834e('0x3d')],'phone':_0x548d1d});}else{logger[_0x834e('0x19')](_0x834e('0x3e'));return request({'method':_0x834e('0x1f'),'uri':util[_0x834e('0x20')]('%s/webservice.php',_0x4ca43c[_0x834e('0x21')]),'form':{'operation':'create','sessionName':_0x50c243[_0x834e('0x23')],'elementType':'Contacts','element':JSON[_0x834e('0x25')]({'lastname':_0x1c5ed6,'phone':_0x548d1d,'assigned_user_id':'\x20'})},'json':!![]})['then'](function(_0x361f60){logger[_0x834e('0x19')]('Enduser\x20created.');return BPromise[_0x834e('0x32')]({'id':_0x361f60[_0x834e('0x30')]['id'],'name':_0x361f60[_0x834e('0x30')][_0x834e('0x3d')],'phone':_0x361f60[_0x834e('0x30')][_0x834e('0x3f')]});})[_0x834e('0x28')](function(_0x3ccd8e){var _0x5dc63b=_0x3ccd8e[_0x834e('0x29')]||0x1f4;logger['error'](_0x834e('0x37'),_0x834e('0x40'),_0x5dc63b,JSON['stringify'](_0x3ccd8e));});}});}function getConnection(_0x112306){var _0x42fd90=_0x112306[_0x834e('0x2e')];var _0x2112d5=_0x112306[_0x834e('0x41')];return request({'method':_0x834e('0x2b'),'uri':util['format']('%s/webservice.php',_0x112306[_0x834e('0x21')]),'qs':{'operation':_0x834e('0x42'),'username':_0x42fd90},'json':!![]})[_0x834e('0x43')](function(_0x40ff5a){if(_0x40ff5a[_0x834e('0x26')]){return request({'method':_0x834e('0x1f'),'uri':util[_0x834e('0x20')](_0x834e('0x2c'),_0x112306[_0x834e('0x21')]),'form':{'operation':_0x834e('0x44'),'username':_0x42fd90,'accessKey':md5(_0x40ff5a[_0x834e('0x30')][_0x834e('0x45')]+_0x2112d5)},'json':!![]});}})[_0x834e('0x43')](function(_0x1a3237){if(_0x1a3237[_0x834e('0x26')]){return BPromise[_0x834e('0x32')](_0x1a3237[_0x834e('0x30')]);}else{throw new Error(util[_0x834e('0x20')](_0x834e('0x46'),_0x112306['id']));}})[_0x834e('0x28')](function(_0x4cfacd){var _0x1cc0b8=_0x4cfacd[_0x834e('0x29')]||0x1f4;logger['error'](_0x834e('0x37'),_0x834e('0x47'),_0x1cc0b8,JSON['stringify'](_0x4cfacd));});}function request(_0x3dcca3){logger[_0x834e('0x19')](_0x834e('0x48'),JSON[_0x834e('0x25')](_0x3dcca3));return rp(_0x3dcca3);}exports[_0x834e('0x49')]=function(_0xb77aab,_0x4549ba,_0x4a8b32,_0x1ad7fe,_0x8bc6c6,_0x3e0550){var _0x363675,_0x86ad2b,_0x396bbe,_0x344b51;_0x3e0550[_0x834e('0x21')]=intUtil['stripTrailingSlash'](_0x3e0550[_0x834e('0x21')]);if(_0x8bc6c6&&_0x8bc6c6['monitor_format']){logger[_0x834e('0x19')]('[QUEUE]',_0x834e('0x4a'));_0x4549ba['recordingURL']=util['format'](_0x834e('0x4b'),_0x3e0550[_0x834e('0x4c')],_0x4549ba['uniqueid'],md5(_0x4549ba['uniqueid']));}else{_0x4549ba[_0x834e('0x4d')]='';}return getConnection(_0x3e0550)[_0x834e('0x43')](function(_0x138ed2){_0x344b51=_0x138ed2;return getUser(_0x3e0550,_0x1ad7fe[_0x834e('0x4e')],_0x344b51);})[_0x834e('0x43')](function(_0x315858){_0x363675=_0x315858;logger[_0x834e('0x19')](_0x834e('0x4f'),_0x363675['id']);return getEndUser(_0x3e0550,_0x4549ba['calleridname'],_0x4549ba[_0x834e('0x50')],_0x344b51);})[_0x834e('0x43')](function(_0x5d5ac2){_0x86ad2b=_0x5d5ac2;logger[_0x834e('0x19')]('The\x20Enduser\x20ID\x20is:',_0x86ad2b['id']);return createTicket(_0x3e0550,_0x363675,_0x86ad2b,_0x4a8b32,_0x4549ba,_0x4a8b32[_0x834e('0x51')],_0x344b51);})[_0x834e('0x43')](function(_0x5160c4){_0x396bbe=_0x5160c4;logger[_0x834e('0x19')](_0x834e('0x52'));logger[_0x834e('0x19')](_0x834e('0x53'),_0x396bbe['id']);var _0x5a2924=util[_0x834e('0x20')](_0x834e('0x54'),_0x3e0550[_0x834e('0x21')],_['split'](_0x396bbe['id'],'x')[0x1]);logger[_0x834e('0x19')](_0x834e('0x55'),_0x834e('0x56'));emit(util[_0x834e('0x20')](_0x834e('0x57'),_0x1ad7fe[_0x834e('0x17')]),_0x834e('0x58'),{'uri':_0x5a2924});})[_0x834e('0x28')](function(_0x208c21){logger[_0x834e('0x27')](_0x834e('0x55'),JSON[_0x834e('0x25')](_0x208c21));});};exports[_0x834e('0x59')]=function(_0x1659c8,_0x460a7a,_0x17b8e3,_0x297cce,_0x14ed83,_0x193a15,_0x3e3467){var _0xed4081,_0x2cb233,_0x5c83eb,_0x2145cf;_0x193a15[_0x834e('0x21')]=intUtil[_0x834e('0x5a')](_0x193a15[_0x834e('0x21')]);_0x193a15['serverUrl']=intUtil[_0x834e('0x5a')](_0x193a15['serverUrl']);if(_0x3e3467&&_0x3e3467['recordingFormat']&&_0x3e3467[_0x834e('0x5b')]!==_0x834e('0x5c')){logger[_0x834e('0x19')](_0x834e('0x5d'),_0x834e('0x4a'));_0x460a7a[_0x834e('0x4d')]=util[_0x834e('0x20')](_0x834e('0x4b'),_0x193a15['serverUrl'],_0x460a7a[_0x834e('0x5e')],md5(_0x460a7a['uniqueid']));}return getConnection(_0x193a15)[_0x834e('0x43')](function(_0xd35dda){_0x2145cf=_0xd35dda;return getUser(_0x193a15,_0x297cce['email'],_0x2145cf);})['then'](function(_0x4a4def){_0xed4081=_0x4a4def;logger[_0x834e('0x19')](_0x834e('0x4f'),_0xed4081['id']);return getEndUser(_0x193a15,_0x460a7a[_0x834e('0x5f')],_0x460a7a[_0x834e('0x60')],_0x2145cf);})['then'](function(_0x2b0d93){_0x2cb233=_0x2b0d93;logger[_0x834e('0x19')](_0x834e('0x61'),_0x2cb233['id']);return createTicket(_0x193a15,_0xed4081,_0x2cb233,_0x17b8e3,_0x460a7a,_0x17b8e3[_0x834e('0x51')],_0x2145cf);})[_0x834e('0x43')](function(_0x28b5c9){_0x5c83eb=_0x28b5c9;logger[_0x834e('0x19')](_0x834e('0x52'));logger[_0x834e('0x19')](_0x834e('0x53'),_0x5c83eb['id']);var _0x5b2bf6=util[_0x834e('0x20')](_0x834e('0x54'),_0x193a15[_0x834e('0x21')],_[_0x834e('0x62')](_0x5c83eb['id'],'x')[0x1]);logger['info'](_0x834e('0x5d'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format']('user:%s',_0x297cce[_0x834e('0x17')]),_0x834e('0x58'),{'uri':_0x5b2bf6});})['catch'](function(_0x2645df){logger[_0x834e('0x27')]('[OUTBOUND]',JSON[_0x834e('0x25')](_0x2645df));});};exports[_0x834e('0x63')]=function(_0x4b88e7,_0x5df169,_0x346be5,_0x2a42a3,_0x8bc7d9,_0x44c909){var _0x1d8e7,_0x493239,_0x264a6f,_0x520367;_0x44c909[_0x834e('0x21')]=intUtil[_0x834e('0x5a')](_0x44c909[_0x834e('0x21')]);_0x44c909['serverUrl']=intUtil[_0x834e('0x5a')](_0x44c909[_0x834e('0x4c')]);if(_0x8bc7d9&&_0x8bc7d9['monitor_format']){logger[_0x834e('0x19')]('['+_0x5df169[_0x834e('0x64')][_0x834e('0x65')]()+']','Recording\x20is\x20enabled!');_0x5df169[_0x834e('0x4d')]=util[_0x834e('0x20')](_0x834e('0x4b'),_0x44c909[_0x834e('0x4c')],_0x5df169[_0x834e('0x5e')],md5(_0x5df169[_0x834e('0x5e')]));}else{_0x5df169[_0x834e('0x4d')]='';}return getConnection(_0x44c909)[_0x834e('0x43')](function(_0xd49002){_0x520367=_0xd49002;return getUser(_0x44c909,'',_0x520367);})[_0x834e('0x43')](function(_0x57d898){_0x1d8e7=_0x57d898;logger['info']('The\x20User\x20ID\x20is:',_0x1d8e7['id']);return getEndUser(_0x44c909,_0x5df169[_0x834e('0x66')],_0x5df169[_0x834e('0x50')],_0x520367);})[_0x834e('0x43')](function(_0x37fa2c){_0x493239=_0x37fa2c;logger[_0x834e('0x19')]('The\x20Enduser\x20ID\x20is:',_0x493239['id']);return createTicket(_0x44c909,_0x1d8e7,_0x493239,_0x346be5,_0x5df169,_0x346be5['Fields'],_0x520367);})[_0x834e('0x43')](function(_0x1ad428){_0x264a6f=_0x1ad428;logger[_0x834e('0x19')](_0x834e('0x52'));logger[_0x834e('0x19')]('The\x20Ticket\x20ID\x20is:',_0x264a6f['id']);})[_0x834e('0x28')](function(_0x2b162a){logger[_0x834e('0x27')]('['+_0x5df169['lastevent'][_0x834e('0x65')]()+']',JSON[_0x834e('0x25')](_0x2b162a));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/zendesk.js b/server/services/ami/trigger/integration/zendesk.js index 85f6478..a000f8a 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 _0x3825=['[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','lastevent','The\x20Enduser\x20ID\x20is:','\x20Error\x20running\x20Zendesk\x20integration','lodash','util','ioredis','../../../../config/environment','../../../../config/logger','zendesk','redis','defaults','localhost','emit','application/json','Creating\x20new\x20ticket...','format','remoteUri','POST','merge','Tags','getString','Subjects','Descriptions','then','info','Ticket\x20created!','ticket','validateEmail','Getting\x20agent\x20with\x20email','%s/search.json','type:user\x20role:agent\x20email:%s','Agent\x20found!','find','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','length','filter','end-user','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Caller\x20-\x20%s','Enduser\x20created.','password','username','token','%s/token:%s','Basic\x20%s','toString','base64','[HTTP]','stringify','GET','map','forEach','includes','string','type','customField','nameField','picklist','custom_fields','push','variable','idField','variableName','Variable','name','toLowerCase','stripTrailingSlash','serverUrl','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Ticket\x20ID\x20is:','integrationTab','[QUEUE]','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','replace','/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','trigger:browser:url','%s/agent/tickets/%s'];(function(_0x330327,_0x52c6cb){var _0x38d3d0=function(_0x4864eb){while(--_0x4864eb){_0x330327['push'](_0x330327['shift']());}};_0x38d3d0(++_0x52c6cb);}(_0x3825,0x14f));var _0x5382=function(_0x53f608,_0x256def){_0x53f608=_0x53f608-0x0;var _0x495b7d=_0x3825[_0x53f608];return _0x495b7d;};'use strict';var _=require(_0x5382('0x0'));var rp=require('request-promise');var md5=require('md5');var util=require(_0x5382('0x1'));var Redis=require(_0x5382('0x2'));var intUtil=require('./util');var config=require(_0x5382('0x3'));var logger=require(_0x5382('0x4'))(_0x5382('0x5'));config[_0x5382('0x6')]=_[_0x5382('0x7')](config[_0x5382('0x6')],{'host':_0x5382('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x5382('0x6')]));function emit(_0x589b10,_0x28bed3,_0x7380e2){io['to'](_0x589b10)[_0x5382('0x9')](_0x28bed3,_0x7380e2);}var headers={'Content-Type':_0x5382('0xa'),'Accept':_0x5382('0xa')};function getTicket(_0x176ba2,_0x2f7491,_0x4cee77,_0x11ed5b,_0x14cc4f){logger['info'](_0x5382('0xb'));return request({'uri':util[_0x5382('0xc')]('%s/tickets.json',_0x176ba2[_0x5382('0xd')]),'method':_0x5382('0xe'),'body':{'ticket':_[_0x5382('0xf')]({'requester_id':_0x4cee77['id'],'submitter_id':_0x2f7491?_0x2f7491['id']:undefined,'assignee_id':_0x2f7491?_0x2f7491['id']:undefined,'tags':getTags(_0x11ed5b[_0x5382('0x10')],'name'),'subject':intUtil[_0x5382('0x11')](_0x11ed5b[_0x5382('0x12')],_0x14cc4f,'\x20'),'description':intUtil[_0x5382('0x11')](_0x11ed5b[_0x5382('0x13')],_0x14cc4f,'\x0a'),'comment':{'public':![],'body':intUtil['getString'](_0x11ed5b[_0x5382('0x13')],_0x14cc4f,'\x0a')}},getCustomFields(_0x11ed5b['Fields'],_0x14cc4f))}})[_0x5382('0x14')](function(_0x532cf7){logger[_0x5382('0x15')](_0x5382('0x16'));return _0x532cf7[_0x5382('0x17')];});}function getUser(_0x356b57,_0x33764e){if(intUtil[_0x5382('0x18')](_0x33764e)){logger[_0x5382('0x15')](_0x5382('0x19'),_0x33764e);return request({'uri':util[_0x5382('0xc')](_0x5382('0x1a'),_0x356b57[_0x5382('0xd')]),'qs':{'query':util['format'](_0x5382('0x1b'),_0x33764e)}})[_0x5382('0x14')](function(_0x47a1ba){if(_0x47a1ba['count']){logger['info'](_0x5382('0x1c'));return _[_0x5382('0x1d')](_0x47a1ba[_0x5382('0x1e')],{'email':_0x33764e,'role':_0x5382('0x1f')});}else{logger[_0x5382('0x15')](_0x5382('0x20'));return request({'uri':util['format'](_0x5382('0x21'),_0x356b57['remoteUri'])})[_0x5382('0x14')](function(_0x5b4164){logger[_0x5382('0x15')](_0x5382('0x22'));return _0x5b4164['user'];});}});}else{logger[_0x5382('0x15')](_0x5382('0x20'));return request({'uri':util[_0x5382('0xc')]('%s/users/me.json',_0x356b57[_0x5382('0xd')])})[_0x5382('0x14')](function(_0x3d4a0c){logger['info'](_0x5382('0x22'));return _0x3d4a0c[_0x5382('0x23')];});}}function getEndUser(_0x355404,_0xcbb733,_0x23626a){logger[_0x5382('0x15')](_0x5382('0x24'),_0x23626a);return request({'uri':util['format']('%s/search.json',_0x355404[_0x5382('0xd')]),'qs':{'query':util[_0x5382('0xc')](_0x5382('0x25'),_0x23626a)}})['then'](function(_0x389970){var _0x1b8421;if(_0x389970[_0x5382('0x1e')][_0x5382('0x26')]){_0x389970[_0x5382('0x1e')]=_[_0x5382('0x27')](_0x389970[_0x5382('0x1e')],{'suspended':![],'role':_0x5382('0x28')});if(_0x389970[_0x5382('0x1e')][_0x5382('0x26')]){_0x1b8421=_['first'](_0x389970[_0x5382('0x1e')]);}}if(_0x1b8421){logger[_0x5382('0x15')]('Enduser\x20found!');return _0x1b8421;}else{logger[_0x5382('0x15')](_0x5382('0x29'));return request({'uri':util[_0x5382('0xc')](_0x5382('0x2a'),_0x355404['remoteUri']),'method':_0x5382('0xe'),'body':{'user':{'role':_0x5382('0x28'),'name':util[_0x5382('0xc')](_0x5382('0x2b'),_0xcbb733||_0x23626a),'phone':_0x23626a}}})[_0x5382('0x14')](function(_0x59b1a1){logger['info'](_0x5382('0x2c'));return _0x59b1a1[_0x5382('0x23')];});}});}function getAuth(_0x54d8de){var _0x20184b;if(_0x54d8de['authType']===_0x5382('0x2d')){_0x20184b=util[_0x5382('0xc')]('%s:%s',_0x54d8de[_0x5382('0x2e')],_0x54d8de[_0x5382('0x2d')]);}else if(_0x54d8de['authType']===_0x5382('0x2f')){_0x20184b=util[_0x5382('0xc')](_0x5382('0x30'),_0x54d8de[_0x5382('0x2e')],_0x54d8de[_0x5382('0x2f')]);}return util[_0x5382('0xc')](_0x5382('0x31'),new Buffer(_0x20184b)[_0x5382('0x32')](_0x5382('0x33')));}function request(_0x54b574){logger['debug'](_0x5382('0x34'),JSON[_0x5382('0x35')](_0x54b574));return rp(_[_0x5382('0x7')](_0x54b574,{'method':_0x5382('0x36'),'headers':headers,'json':!![]}));}function getTags(_0x1bc073,_0x2720fe){var _0x927e6d=[];if(_0x1bc073&&_0x1bc073['length']>0x0){_0x927e6d=_[_0x5382('0x37')](_0x1bc073,_0x2720fe);}return _0x927e6d;}function getCustomFields(_0x21967c,_0x518959){var _0x5de212=[];var _0x18de83={'custom_fields':[]};if(_0x21967c['length']>0x0){_[_0x5382('0x38')](_0x21967c,function(_0x16690f){if(_[_0x5382('0x39')]([_0x5382('0x3a'),'picklist'],_0x16690f[_0x5382('0x3b')])&&_0x16690f['nameField']&&!_0x16690f[_0x5382('0x3c')]){_0x18de83[_0x16690f[_0x5382('0x3d')]['toLowerCase']()]=_0x16690f['content']['toString']();}else if(_[_0x5382('0x39')](['string',_0x5382('0x3e')],_0x16690f[_0x5382('0x3b')])&&_0x16690f['idField']&&_0x16690f['customField']){_0x18de83[_0x5382('0x3f')][_0x5382('0x40')]({'id':_0x16690f['idField'],'value':_0x16690f['content'][_0x5382('0x32')]()});}else if(_0x16690f[_0x5382('0x3b')]===_0x5382('0x41')&&_0x16690f['variableName']&&_0x16690f['idField']&&_0x16690f[_0x5382('0x3c')]){_0x518959[_0x16690f['variableName']]&&_0x18de83[_0x5382('0x3f')][_0x5382('0x40')]({'id':_0x16690f[_0x5382('0x42')],'value':_0x518959[_0x16690f[_0x5382('0x43')]]['toString']()});}else if(_0x16690f[_0x5382('0x3b')]==='customVariable'&&_0x16690f[_0x5382('0x44')]&&_0x16690f['Variable'][_0x5382('0x45')]&&_0x16690f[_0x5382('0x42')]&&_0x16690f[_0x5382('0x3c')]){_0x518959[_0x16690f[_0x5382('0x44')][_0x5382('0x45')]['toLowerCase']()]&&_0x18de83['custom_fields']['push']({'id':_0x16690f[_0x5382('0x42')],'value':_0x518959[_0x16690f[_0x5382('0x44')][_0x5382('0x45')][_0x5382('0x46')]()]['toString']()});}});}return _0x18de83;}exports['queue']=function(_0x54c510,_0x32dd34,_0x4387a9,_0xec1274,_0x307c5d,_0x3e60fd){var _0x42b2f0,_0x1e2681;_0x3e60fd[_0x5382('0xd')]=intUtil[_0x5382('0x47')](_0x3e60fd[_0x5382('0xd')]);_0x3e60fd[_0x5382('0x48')]=intUtil[_0x5382('0x47')](_0x3e60fd['serverUrl']);if(_0x307c5d&&_0x307c5d[_0x5382('0x49')]){logger[_0x5382('0x15')]('[QUEUE]',_0x5382('0x4a'));_0x32dd34[_0x5382('0x4b')]=util[_0x5382('0xc')](_0x5382('0x4c'),_0x3e60fd[_0x5382('0x48')],_0x32dd34[_0x5382('0x4d')],md5(_0x32dd34['uniqueid']));}else{_0x32dd34[_0x5382('0x4b')]='';}headers[_0x5382('0x4e')]=getAuth(_0x3e60fd);return getUser(_0x3e60fd,_0xec1274['email'])[_0x5382('0x14')](function(_0x186d61){_0x42b2f0=_0x186d61;logger[_0x5382('0x15')](_0x5382('0x4f'),_0x42b2f0['id']);return getEndUser(_0x3e60fd,_0x32dd34[_0x5382('0x50')],_0x32dd34[_0x5382('0x51')]);})[_0x5382('0x14')](function(_0x5f504a){_0x1e2681=_0x5f504a;logger[_0x5382('0x15')]('The\x20Enduser\x20ID\x20is:',_0x1e2681['id']);return getTicket(_0x3e60fd,_0x42b2f0,_0x1e2681,_0x4387a9,_0x32dd34);})[_0x5382('0x14')](function(_0x353fa7){if(_0x353fa7){logger[_0x5382('0x15')](_0x5382('0x52'),_0x353fa7['id']);switch(_0x3e60fd[_0x5382('0x3b')]){case _0x5382('0x53'):logger[_0x5382('0x15')](_0x5382('0x54'),_0x5382('0x55'));return request({'uri':util[_0x5382('0xc')](_0x5382('0x56'),_0x3e60fd['remoteUri'],_0x42b2f0['id'],_0x353fa7['id']),'method':_0x5382('0xe')});case _0x5382('0x57'):logger[_0x5382('0x15')](_0x5382('0x54'),_0x5382('0x58'));emit(util['format'](_0x5382('0x59'),_0xec1274[_0x5382('0x45')]),'trigger:browser:url',{'uri':util[_0x5382('0xc')]('%s/agent/tickets/%s',_0x3e60fd[_0x5382('0xd')][_0x5382('0x5a')](_0x5382('0x5b'),''),_0x353fa7['id'])});break;default:logger[_0x5382('0x5c')]('[QUEUE]',_0x5382('0x5d'));}}})[_0x5382('0x5e')](function(_0x288201){logger['error'](_0x5382('0x5f'),util[_0x5382('0x60')](_0x288201,{'showHidden':!![],'depth':null}));});};exports[_0x5382('0x61')]=function(_0x375b60,_0xee74,_0x194329,_0xed4248,_0x274597,_0x242609,_0x18252f){var _0x27352c,_0x2a7c65;_0x242609[_0x5382('0xd')]=intUtil[_0x5382('0x47')](_0x242609[_0x5382('0xd')]);_0x242609['serverUrl']=intUtil[_0x5382('0x47')](_0x242609[_0x5382('0x48')]);if(_0x18252f&&_0x18252f['recordingFormat']&&_0x18252f[_0x5382('0x62')]!==_0x5382('0x63')){logger[_0x5382('0x15')](_0x5382('0x64'),'Recording\x20is\x20enabled!');_0xee74[_0x5382('0x4b')]=util[_0x5382('0xc')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x242609[_0x5382('0x48')],_0xee74[_0x5382('0x4d')],md5(_0xee74[_0x5382('0x4d')]));}headers[_0x5382('0x4e')]=getAuth(_0x242609);return getUser(_0x242609,_0xed4248['email'])['then'](function(_0x2693c7){_0x27352c=_0x2693c7;logger[_0x5382('0x15')]('The\x20User\x20ID\x20is:',_0x27352c['id']);return getEndUser(_0x242609,_0xee74[_0x5382('0x65')],_0xee74[_0x5382('0x66')]);})[_0x5382('0x14')](function(_0x2935c8){_0x2a7c65=_0x2935c8;logger[_0x5382('0x15')]('The\x20Enduser\x20ID\x20is:',_0x2a7c65['id']);return getTicket(_0x242609,_0x27352c,_0x2a7c65,_0x194329,_0xee74);})['then'](function(_0x16d8e1){if(_0x16d8e1){logger[_0x5382('0x15')]('The\x20Ticket\x20ID\x20is:',_0x16d8e1['id']);switch(_0x242609[_0x5382('0x3b')]){case _0x5382('0x53'):logger[_0x5382('0x15')](_0x5382('0x64'),_0x5382('0x55'));return request({'uri':util[_0x5382('0xc')](_0x5382('0x56'),_0x242609[_0x5382('0xd')],_0x27352c['id'],_0x16d8e1['id']),'method':_0x5382('0xe')});case _0x5382('0x57'):logger[_0x5382('0x15')](_0x5382('0x64'),_0x5382('0x58'));emit(util[_0x5382('0xc')](_0x5382('0x59'),_0xed4248[_0x5382('0x45')]),_0x5382('0x67'),{'uri':util['format'](_0x5382('0x68'),_0x242609[_0x5382('0xd')][_0x5382('0x5a')](_0x5382('0x5b'),''),_0x16d8e1['id'])});break;default:logger['error'](_0x5382('0x64'),_0x5382('0x5d'));}}})['catch'](function(_0x52c766){logger[_0x5382('0x5c')](_0x5382('0x69'),util[_0x5382('0x60')](_0x52c766,{'showHidden':!![],'depth':null}));});};exports[_0x5382('0x6a')]=function(_0x3421d9,_0x2cf407,_0x47c68a,_0x13985c,_0x4b25a1,_0x294ad2){var _0x233d37,_0x3d5a50;_0x294ad2[_0x5382('0xd')]=intUtil[_0x5382('0x47')](_0x294ad2[_0x5382('0xd')]);_0x294ad2[_0x5382('0x48')]=intUtil[_0x5382('0x47')](_0x294ad2[_0x5382('0x48')]);if(_0x4b25a1&&_0x4b25a1[_0x5382('0x49')]){logger['info']('['+_0x2cf407[_0x5382('0x6b')]['toUpperCase']()+']',_0x5382('0x4a'));_0x2cf407['recordingURL']=util[_0x5382('0xc')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x294ad2[_0x5382('0x48')],_0x2cf407[_0x5382('0x4d')],md5(_0x2cf407[_0x5382('0x4d')]));}else{_0x2cf407[_0x5382('0x4b')]='';}headers[_0x5382('0x4e')]=getAuth(_0x294ad2);return getUser(_0x294ad2)[_0x5382('0x14')](function(_0x2f3d5d){_0x233d37=_0x2f3d5d;logger[_0x5382('0x15')](_0x5382('0x4f'),_0x233d37['id']);return getEndUser(_0x294ad2,_0x2cf407[_0x5382('0x50')],_0x2cf407[_0x5382('0x51')]);})[_0x5382('0x14')](function(_0x49f956){_0x3d5a50=_0x49f956;logger[_0x5382('0x15')](_0x5382('0x6c'),_0x3d5a50['id']);return getTicket(_0x294ad2,_0x233d37,_0x3d5a50,_0x47c68a,_0x2cf407);})[_0x5382('0x14')](function(_0x5cd7c6){if(_0x5cd7c6){logger[_0x5382('0x15')](_0x5382('0x52'),_0x5cd7c6['id']);}})[_0x5382('0x5e')](function(_0x49878f){logger[_0x5382('0x5c')]('['+_0x2cf407[_0x5382('0x6b')]['toUpperCase']()+']'+_0x5382('0x6d'),util[_0x5382('0x60')](_0x49878f,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xdd33=['recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','Authorization','email','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','[QUEUE]','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/agent/tickets/%s','replace','/api/v2','error','catch','outbound','recordingFormat','[OUTBOUND]','Recording\x20is\x20enabled!','uniqueid','The\x20User\x20ID\x20is:','Zendesk\x20account\x20type\x20not\x20recognized','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','inspect','unmanaged','lastevent','toUpperCase','lodash','request-promise','ioredis','./util','../../../../config/environment','../../../../config/logger','zendesk','redis','socket.io-emitter','application/json','info','Creating\x20new\x20ticket...','format','%s/tickets.json','remoteUri','POST','merge','Tags','getString','Descriptions','then','Ticket\x20created!','validateEmail','Getting\x20agent\x20with\x20email','%s/search.json','Agent\x20found!','find','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Admin\x20account\x20selected.','user','type:user\x20role:end-user\x20phone:%s','results','length','filter','end-user','first','Enduser\x20found!','%s/users.json','Enduser\x20created.','authType','password','%s:%s','username','token','%s/token:%s','Basic\x20%s','base64','debug','[HTTP]','stringify','GET','map','forEach','includes','string','picklist','nameField','toLowerCase','content','toString','type','idField','customField','custom_fields','push','variable','variableName','customVariable','Variable','name','stripTrailingSlash','serverUrl','monitor_format'];(function(_0x11f226,_0x491e30){var _0x30be77=function(_0x2049bd){while(--_0x2049bd){_0x11f226['push'](_0x11f226['shift']());}};_0x30be77(++_0x491e30);}(_0xdd33,0x165));var _0x3dd3=function(_0x59e989,_0x48d10){_0x59e989=_0x59e989-0x0;var _0x1cdc8e=_0xdd33[_0x59e989];return _0x1cdc8e;};'use strict';var _=require(_0x3dd3('0x0'));var rp=require(_0x3dd3('0x1'));var md5=require('md5');var util=require('util');var Redis=require(_0x3dd3('0x2'));var intUtil=require(_0x3dd3('0x3'));var config=require(_0x3dd3('0x4'));var logger=require(_0x3dd3('0x5'))(_0x3dd3('0x6'));config[_0x3dd3('0x7')]=_['defaults'](config[_0x3dd3('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0x3dd3('0x8'))(new Redis(config[_0x3dd3('0x7')]));function emit(_0x5a11e0,_0x1419bc,_0x2399a1){io['to'](_0x5a11e0)['emit'](_0x1419bc,_0x2399a1);}var headers={'Content-Type':'application/json','Accept':_0x3dd3('0x9')};function getTicket(_0x45203e,_0x271d6d,_0x155c58,_0xa0928b,_0x2fc1cf){logger[_0x3dd3('0xa')](_0x3dd3('0xb'));return request({'uri':util[_0x3dd3('0xc')](_0x3dd3('0xd'),_0x45203e[_0x3dd3('0xe')]),'method':_0x3dd3('0xf'),'body':{'ticket':_[_0x3dd3('0x10')]({'requester_id':_0x155c58['id'],'submitter_id':_0x271d6d?_0x271d6d['id']:undefined,'assignee_id':_0x271d6d?_0x271d6d['id']:undefined,'tags':getTags(_0xa0928b[_0x3dd3('0x11')],'name'),'subject':intUtil[_0x3dd3('0x12')](_0xa0928b['Subjects'],_0x2fc1cf,'\x20'),'description':intUtil[_0x3dd3('0x12')](_0xa0928b[_0x3dd3('0x13')],_0x2fc1cf,'\x0a'),'comment':{'public':![],'body':intUtil[_0x3dd3('0x12')](_0xa0928b[_0x3dd3('0x13')],_0x2fc1cf,'\x0a')}},getCustomFields(_0xa0928b['Fields'],_0x2fc1cf))}})[_0x3dd3('0x14')](function(_0x3724da){logger[_0x3dd3('0xa')](_0x3dd3('0x15'));return _0x3724da['ticket'];});}function getUser(_0x3ee2e4,_0x57beff){if(intUtil[_0x3dd3('0x16')](_0x57beff)){logger[_0x3dd3('0xa')](_0x3dd3('0x17'),_0x57beff);return request({'uri':util[_0x3dd3('0xc')](_0x3dd3('0x18'),_0x3ee2e4[_0x3dd3('0xe')]),'qs':{'query':util[_0x3dd3('0xc')]('type:user\x20role:agent\x20email:%s',_0x57beff)}})[_0x3dd3('0x14')](function(_0x5cb71a){if(_0x5cb71a['count']){logger[_0x3dd3('0xa')](_0x3dd3('0x19'));return _[_0x3dd3('0x1a')](_0x5cb71a['results'],{'email':_0x57beff,'role':_0x3dd3('0x1b')});}else{logger[_0x3dd3('0xa')](_0x3dd3('0x1c'));return request({'uri':util[_0x3dd3('0xc')](_0x3dd3('0x1d'),_0x3ee2e4[_0x3dd3('0xe')])})[_0x3dd3('0x14')](function(_0x416456){logger[_0x3dd3('0xa')](_0x3dd3('0x1e'));return _0x416456[_0x3dd3('0x1f')];});}});}else{logger[_0x3dd3('0xa')](_0x3dd3('0x1c'));return request({'uri':util[_0x3dd3('0xc')]('%s/users/me.json',_0x3ee2e4[_0x3dd3('0xe')])})[_0x3dd3('0x14')](function(_0x3dd141){logger[_0x3dd3('0xa')](_0x3dd3('0x1e'));return _0x3dd141[_0x3dd3('0x1f')];});}}function getEndUser(_0x38a59f,_0x547e97,_0xb2660d){logger['info']('Searching\x20enduser\x20with\x20phone',_0xb2660d);return request({'uri':util[_0x3dd3('0xc')](_0x3dd3('0x18'),_0x38a59f[_0x3dd3('0xe')]),'qs':{'query':util['format'](_0x3dd3('0x20'),_0xb2660d)}})[_0x3dd3('0x14')](function(_0x4d39a3){var _0x576ad2;if(_0x4d39a3[_0x3dd3('0x21')][_0x3dd3('0x22')]){_0x4d39a3[_0x3dd3('0x21')]=_[_0x3dd3('0x23')](_0x4d39a3['results'],{'suspended':![],'role':_0x3dd3('0x24')});if(_0x4d39a3[_0x3dd3('0x21')]['length']){_0x576ad2=_[_0x3dd3('0x25')](_0x4d39a3[_0x3dd3('0x21')]);}}if(_0x576ad2){logger['info'](_0x3dd3('0x26'));return _0x576ad2;}else{logger[_0x3dd3('0xa')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util['format'](_0x3dd3('0x27'),_0x38a59f['remoteUri']),'method':_0x3dd3('0xf'),'body':{'user':{'role':'end-user','name':util[_0x3dd3('0xc')]('Caller\x20-\x20%s',_0x547e97||_0xb2660d),'phone':_0xb2660d}}})[_0x3dd3('0x14')](function(_0x22c2c4){logger[_0x3dd3('0xa')](_0x3dd3('0x28'));return _0x22c2c4[_0x3dd3('0x1f')];});}});}function getAuth(_0xa139b8){var _0x348896;if(_0xa139b8[_0x3dd3('0x29')]===_0x3dd3('0x2a')){_0x348896=util['format'](_0x3dd3('0x2b'),_0xa139b8[_0x3dd3('0x2c')],_0xa139b8[_0x3dd3('0x2a')]);}else if(_0xa139b8[_0x3dd3('0x29')]===_0x3dd3('0x2d')){_0x348896=util['format'](_0x3dd3('0x2e'),_0xa139b8[_0x3dd3('0x2c')],_0xa139b8[_0x3dd3('0x2d')]);}return util[_0x3dd3('0xc')](_0x3dd3('0x2f'),new Buffer(_0x348896)['toString'](_0x3dd3('0x30')));}function request(_0x25b368){logger[_0x3dd3('0x31')](_0x3dd3('0x32'),JSON[_0x3dd3('0x33')](_0x25b368));return rp(_['defaults'](_0x25b368,{'method':_0x3dd3('0x34'),'headers':headers,'json':!![]}));}function getTags(_0x144fca,_0x1cab96){var _0x286582=[];if(_0x144fca&&_0x144fca['length']>0x0){_0x286582=_[_0x3dd3('0x35')](_0x144fca,_0x1cab96);}return _0x286582;}function getCustomFields(_0x32afc9,_0x1a38d5){var _0x3836be=[];var _0x38c8cb={'custom_fields':[]};if(_0x32afc9['length']>0x0){_[_0x3dd3('0x36')](_0x32afc9,function(_0x9dc9f){if(_[_0x3dd3('0x37')]([_0x3dd3('0x38'),_0x3dd3('0x39')],_0x9dc9f['type'])&&_0x9dc9f[_0x3dd3('0x3a')]&&!_0x9dc9f['customField']){_0x38c8cb[_0x9dc9f['nameField'][_0x3dd3('0x3b')]()]=_0x9dc9f[_0x3dd3('0x3c')][_0x3dd3('0x3d')]();}else if(_[_0x3dd3('0x37')](['string','picklist'],_0x9dc9f[_0x3dd3('0x3e')])&&_0x9dc9f[_0x3dd3('0x3f')]&&_0x9dc9f[_0x3dd3('0x40')]){_0x38c8cb[_0x3dd3('0x41')][_0x3dd3('0x42')]({'id':_0x9dc9f[_0x3dd3('0x3f')],'value':_0x9dc9f[_0x3dd3('0x3c')][_0x3dd3('0x3d')]()});}else if(_0x9dc9f['type']===_0x3dd3('0x43')&&_0x9dc9f[_0x3dd3('0x44')]&&_0x9dc9f['idField']&&_0x9dc9f[_0x3dd3('0x40')]){_0x1a38d5[_0x9dc9f['variableName']]&&_0x38c8cb[_0x3dd3('0x41')][_0x3dd3('0x42')]({'id':_0x9dc9f[_0x3dd3('0x3f')],'value':_0x1a38d5[_0x9dc9f[_0x3dd3('0x44')]][_0x3dd3('0x3d')]()});}else if(_0x9dc9f[_0x3dd3('0x3e')]===_0x3dd3('0x45')&&_0x9dc9f[_0x3dd3('0x46')]&&_0x9dc9f[_0x3dd3('0x46')][_0x3dd3('0x47')]&&_0x9dc9f[_0x3dd3('0x3f')]&&_0x9dc9f[_0x3dd3('0x40')]){_0x1a38d5[_0x9dc9f[_0x3dd3('0x46')]['name'][_0x3dd3('0x3b')]()]&&_0x38c8cb[_0x3dd3('0x41')]['push']({'id':_0x9dc9f[_0x3dd3('0x3f')],'value':_0x1a38d5[_0x9dc9f[_0x3dd3('0x46')]['name'][_0x3dd3('0x3b')]()][_0x3dd3('0x3d')]()});}});}return _0x38c8cb;}exports['queue']=function(_0x10e5ca,_0x2aa92b,_0x158708,_0x3d7e8e,_0x52406b,_0x32b292){var _0x410dca,_0x43ccfa;_0x32b292[_0x3dd3('0xe')]=intUtil[_0x3dd3('0x48')](_0x32b292[_0x3dd3('0xe')]);_0x32b292[_0x3dd3('0x49')]=intUtil[_0x3dd3('0x48')](_0x32b292[_0x3dd3('0x49')]);if(_0x52406b&&_0x52406b[_0x3dd3('0x4a')]){logger['info']('[QUEUE]','Recording\x20is\x20enabled!');_0x2aa92b[_0x3dd3('0x4b')]=util['format'](_0x3dd3('0x4c'),_0x32b292['serverUrl'],_0x2aa92b['uniqueid'],md5(_0x2aa92b['uniqueid']));}else{_0x2aa92b[_0x3dd3('0x4b')]='';}headers[_0x3dd3('0x4d')]=getAuth(_0x32b292);return getUser(_0x32b292,_0x3d7e8e[_0x3dd3('0x4e')])['then'](function(_0x47b3a1){_0x410dca=_0x47b3a1;logger[_0x3dd3('0xa')]('The\x20User\x20ID\x20is:',_0x410dca['id']);return getEndUser(_0x32b292,_0x2aa92b[_0x3dd3('0x4f')],_0x2aa92b[_0x3dd3('0x50')]);})[_0x3dd3('0x14')](function(_0x5d96ef){_0x43ccfa=_0x5d96ef;logger[_0x3dd3('0xa')](_0x3dd3('0x51'),_0x43ccfa['id']);return getTicket(_0x32b292,_0x410dca,_0x43ccfa,_0x158708,_0x2aa92b);})['then'](function(_0x240c1a){if(_0x240c1a){logger['info'](_0x3dd3('0x52'),_0x240c1a['id']);switch(_0x32b292[_0x3dd3('0x3e')]){case _0x3dd3('0x53'):logger[_0x3dd3('0xa')](_0x3dd3('0x54'),_0x3dd3('0x55'));return request({'uri':util[_0x3dd3('0xc')](_0x3dd3('0x56'),_0x32b292[_0x3dd3('0xe')],_0x410dca['id'],_0x240c1a['id']),'method':_0x3dd3('0xf')});case _0x3dd3('0x57'):logger[_0x3dd3('0xa')](_0x3dd3('0x54'),_0x3dd3('0x58'));emit(util[_0x3dd3('0xc')](_0x3dd3('0x59'),_0x3d7e8e['name']),_0x3dd3('0x5a'),{'uri':util[_0x3dd3('0xc')](_0x3dd3('0x5b'),_0x32b292[_0x3dd3('0xe')][_0x3dd3('0x5c')](_0x3dd3('0x5d'),''),_0x240c1a['id'])});break;default:logger[_0x3dd3('0x5e')](_0x3dd3('0x54'),'Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0x3dd3('0x5f')](function(_0xd8ded0){logger['error']('[QUEUE]\x20Error\x20running\x20Zendesk\x20integration',util['inspect'](_0xd8ded0,{'showHidden':!![],'depth':null}));});};exports[_0x3dd3('0x60')]=function(_0x401345,_0x499ea3,_0x47aaab,_0x1e32e6,_0x3e7020,_0x51df02,_0x5ab9e6){var _0x59a3e8,_0xdcc83f;_0x51df02[_0x3dd3('0xe')]=intUtil[_0x3dd3('0x48')](_0x51df02[_0x3dd3('0xe')]);_0x51df02[_0x3dd3('0x49')]=intUtil['stripTrailingSlash'](_0x51df02[_0x3dd3('0x49')]);if(_0x5ab9e6&&_0x5ab9e6[_0x3dd3('0x61')]&&_0x5ab9e6[_0x3dd3('0x61')]!=='none'){logger['info'](_0x3dd3('0x62'),_0x3dd3('0x63'));_0x499ea3[_0x3dd3('0x4b')]=util['format'](_0x3dd3('0x4c'),_0x51df02['serverUrl'],_0x499ea3['uniqueid'],md5(_0x499ea3[_0x3dd3('0x64')]));}headers['Authorization']=getAuth(_0x51df02);return getUser(_0x51df02,_0x1e32e6[_0x3dd3('0x4e')])['then'](function(_0x557356){_0x59a3e8=_0x557356;logger['info'](_0x3dd3('0x65'),_0x59a3e8['id']);return getEndUser(_0x51df02,_0x499ea3['destcalleridname'],_0x499ea3['destcalleridnum']);})[_0x3dd3('0x14')](function(_0x2d3d23){_0xdcc83f=_0x2d3d23;logger[_0x3dd3('0xa')](_0x3dd3('0x51'),_0xdcc83f['id']);return getTicket(_0x51df02,_0x59a3e8,_0xdcc83f,_0x47aaab,_0x499ea3);})['then'](function(_0x321655){if(_0x321655){logger[_0x3dd3('0xa')](_0x3dd3('0x52'),_0x321655['id']);switch(_0x51df02[_0x3dd3('0x3e')]){case _0x3dd3('0x53'):logger['info'](_0x3dd3('0x62'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0x3dd3('0xc')](_0x3dd3('0x56'),_0x51df02[_0x3dd3('0xe')],_0x59a3e8['id'],_0x321655['id']),'method':_0x3dd3('0xf')});case _0x3dd3('0x57'):logger['info'](_0x3dd3('0x62'),_0x3dd3('0x58'));emit(util[_0x3dd3('0xc')]('user:%s',_0x1e32e6[_0x3dd3('0x47')]),'trigger:browser:url',{'uri':util[_0x3dd3('0xc')](_0x3dd3('0x5b'),_0x51df02[_0x3dd3('0xe')][_0x3dd3('0x5c')](_0x3dd3('0x5d'),''),_0x321655['id'])});break;default:logger[_0x3dd3('0x5e')]('[OUTBOUND]',_0x3dd3('0x66'));}}})[_0x3dd3('0x5f')](function(_0x3401db){logger[_0x3dd3('0x5e')](_0x3dd3('0x67'),util[_0x3dd3('0x68')](_0x3401db,{'showHidden':!![],'depth':null}));});};exports[_0x3dd3('0x69')]=function(_0x125941,_0x21a5c5,_0x319812,_0x112fc8,_0x58f3e1,_0x5002ed){var _0x49bcc6,_0x5be670;_0x5002ed['remoteUri']=intUtil[_0x3dd3('0x48')](_0x5002ed[_0x3dd3('0xe')]);_0x5002ed['serverUrl']=intUtil[_0x3dd3('0x48')](_0x5002ed[_0x3dd3('0x49')]);if(_0x58f3e1&&_0x58f3e1[_0x3dd3('0x4a')]){logger[_0x3dd3('0xa')]('['+_0x21a5c5[_0x3dd3('0x6a')]['toUpperCase']()+']',_0x3dd3('0x63'));_0x21a5c5['recordingURL']=util[_0x3dd3('0xc')](_0x3dd3('0x4c'),_0x5002ed[_0x3dd3('0x49')],_0x21a5c5[_0x3dd3('0x64')],md5(_0x21a5c5['uniqueid']));}else{_0x21a5c5['recordingURL']='';}headers[_0x3dd3('0x4d')]=getAuth(_0x5002ed);return getUser(_0x5002ed)['then'](function(_0x3cfabd){_0x49bcc6=_0x3cfabd;logger[_0x3dd3('0xa')]('The\x20User\x20ID\x20is:',_0x49bcc6['id']);return getEndUser(_0x5002ed,_0x21a5c5[_0x3dd3('0x4f')],_0x21a5c5[_0x3dd3('0x50')]);})[_0x3dd3('0x14')](function(_0x1bcfe3){_0x5be670=_0x1bcfe3;logger['info'](_0x3dd3('0x51'),_0x5be670['id']);return getTicket(_0x5002ed,_0x49bcc6,_0x5be670,_0x319812,_0x21a5c5);})['then'](function(_0x66d128){if(_0x66d128){logger[_0x3dd3('0xa')](_0x3dd3('0x52'),_0x66d128['id']);}})['catch'](function(_0x2e86ed){logger[_0x3dd3('0x5e')]('['+_0x21a5c5['lastevent'][_0x3dd3('0x6b')]()+']'+'\x20Error\x20running\x20Zendesk\x20integration',util['inspect'](_0x2e86ed,{'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 2b11cb8..dabbf93 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 _0x696b=['stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','/downloads?type=uniqueid&token=','uniqueid','zoho.eu','com','calleridname','calleridnum','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','[OUTBOUND]','The\x20User\x20ID\x20is:','destcalleridname','Outbound','toUpperCase','lodash','request-promise','md5','moment','ioredis','bluebird','../../../../config/environment','../../../../config/logger','zoho','redis','localhost','socket.io-emitter','emit','debug','stringify','length','forEach','includes','string','type','idField','content','toString','variable','variableName','customVariable','Variable','name','toLowerCase','indexOf','split','isNil','isBefore','expires_in','access_token','zone','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','then','add','catch','error','Failing\x20creating\x20the\x20access_token','stack','Search\x20user','GET','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','users','findIndex','email','info','Agent\x20found!','Using\x20the\x20admin\x20account!','profile','Administrator','user','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','enduserType','https://www.zohoapis.','/crm/v2/','moduleCreate','role','first_name','last_name','Zoho-oauthtoken\x20','code','SUCCESS','details','startCase','Error:\x20','log','moduleSearch','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','contact','nothing','lead','Creating\x20new\x20call...','Owner','Subject','getString','Subjects','Description','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','What_Id','$se_module','format','answertime','endtime','Call_Duration','utc','YYYY-MM-DDTHH:mm:ss','lastevent','called','Call_Result','Called','complete','connect','Answered','rejected','abandoned','Abandoned','timeout','Timeout','Call_Start_Time','outbound','agentcalledAt','Call_Type','Inbound','Fields','/crm/v2/Calls','Call\x20created!','err','queue','host'];(function(_0x163cd0,_0x461c03){var _0x166213=function(_0x450910){while(--_0x450910){_0x163cd0['push'](_0x163cd0['shift']());}};_0x166213(++_0x461c03);}(_0x696b,0xb7));var _0xb696=function(_0x539d15,_0xfc5203){_0x539d15=_0x539d15-0x0;var _0x4e440a=_0x696b[_0x539d15];return _0x4e440a;};'use strict';var _=require(_0xb696('0x0'));var rp=require(_0xb696('0x1'));var md5=require(_0xb696('0x2'));var util=require('util');var intUtil=require('./util');var moment=require(_0xb696('0x3'));var Redis=require(_0xb696('0x4'));var BPromise=require(_0xb696('0x5'));var config=require(_0xb696('0x6'));var logger=require(_0xb696('0x7'))(_0xb696('0x8'));config['redis']=_['defaults'](config[_0xb696('0x9')],{'host':_0xb696('0xa'),'port':0x18eb});var io=require(_0xb696('0xb'))(new Redis(config['redis']));function emit(_0x47c14c,_0x1b0905,_0x39d298){io['to'](_0x47c14c)[_0xb696('0xc')](_0x1b0905,_0x39d298);}function request(_0xc35f5c){logger[_0xb696('0xd')]('[HTTP]',JSON[_0xb696('0xe')](_0xc35f5c));return rp(_0xc35f5c);}function getCustomFields(_0x558975,_0x77fa2b){var _0x1bca0f={};if(_0x558975[_0xb696('0xf')]>0x0){_[_0xb696('0x10')](_0x558975,function(_0x12cd7c){if(_[_0xb696('0x11')]([_0xb696('0x12'),'picklist'],_0x12cd7c[_0xb696('0x13')])&&_0x12cd7c[_0xb696('0x14')]){_0x1bca0f[_0x12cd7c[_0xb696('0x14')]]=_0x12cd7c[_0xb696('0x15')][_0xb696('0x16')]();}else if(_0x12cd7c[_0xb696('0x13')]===_0xb696('0x17')&&_0x12cd7c['variableName']&&_0x12cd7c[_0xb696('0x14')]&&_0x77fa2b[_0x12cd7c[_0xb696('0x18')]]){_0x1bca0f[_0x12cd7c[_0xb696('0x14')]]=_0x77fa2b[_0x12cd7c[_0xb696('0x18')]][_0xb696('0x16')]();}else if(_0x12cd7c['type']===_0xb696('0x19')&&_0x12cd7c[_0xb696('0x1a')]&&_0x12cd7c[_0xb696('0x1a')][_0xb696('0x1b')]&&_0x12cd7c[_0xb696('0x14')]&&_0x77fa2b[_0x12cd7c[_0xb696('0x1a')]['name'][_0xb696('0x1c')]()]){_0x1bca0f[_0x12cd7c[_0xb696('0x14')]]=_0x77fa2b[_0x12cd7c['Variable'][_0xb696('0x1b')][_0xb696('0x1c')]()][_0xb696('0x16')]();}});}return _0x1bca0f;}function getName(_0x142144){if(_0x142144[_0xb696('0x1d')]('\x20')>0x0){var _0x409e77=_0x142144[_0xb696('0x1e')](/ (.+)/);if(_0x409e77[0x1]){return _0x409e77;}}return[_0x142144,_0x142144];}var accountsTokens={};function getAccessToken(_0x3a9072){return new Promise(function(_0x1e52d7,_0x944c4e){if(!_[_0xb696('0x1f')](accountsTokens[_0x3a9072['id']])&&!_['isNil'](accountsTokens[_0x3a9072['id']]['access_token'])){if(moment()[_0xb696('0x20')](accountsTokens[_0x3a9072['id']][_0xb696('0x21')])){_0x1e52d7(accountsTokens[_0x3a9072['id']][_0xb696('0x22')]);}}var _0x58564b;switch(_0x3a9072[_0xb696('0x23')]){case'US':_0x58564b='https://accounts.zoho.com';break;case'AU':_0x58564b=_0xb696('0x24');break;case'EU':_0x58564b=_0xb696('0x25');break;case'IN':_0x58564b=_0xb696('0x26');break;case'CN':_0x58564b=_0xb696('0x27');break;default:_0x58564b=_0xb696('0x25');break;}var _0x5ce426={'method':_0xb696('0x28'),'uri':_0x58564b+_0xb696('0x29'),'qs':{'refresh_token':_0x3a9072[_0xb696('0x2a')],'client_id':_0x3a9072[_0xb696('0x2b')],'client_secret':_0x3a9072[_0xb696('0x2c')],'grant_type':_0xb696('0x2d')},'json':!![]};return rp(_0x5ce426)[_0xb696('0x2e')](function(_0x4a69a3){accountsTokens[_0x3a9072['id']]={'access_token':_0x4a69a3[_0xb696('0x22')],'expires_in':moment()[_0xb696('0x2f')](_0x4a69a3[_0xb696('0x21')],'seconds')};_0x1e52d7(_0x4a69a3[_0xb696('0x22')]);})[_0xb696('0x30')](function(_0x3674b1){logger[_0xb696('0x31')](_0xb696('0x32'),_0x3674b1[_0xb696('0x33')]);_0x944c4e(_0x3674b1);});});}function getUser(_0x589511,_0x3687dd,_0x308208,_0x743841){logger['info'](_0xb696('0x34'));return request({'method':_0xb696('0x35'),'uri':util['format'](_0xb696('0x36'),_0x3687dd),'qs':{'type':_0xb696('0x37')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x589511},'json':!![]})[_0xb696('0x2e')](function(_0x1ee662){if(_0x1ee662[_0xb696('0x38')]){var _0x5852e0=-0x1;if(_['isArrayLikeObject'](_0x1ee662[_0xb696('0x38')])){if(!_[_0xb696('0x1f')](_0x743841)){_0x5852e0=_[_0xb696('0x39')](_0x1ee662[_0xb696('0x38')],function(_0x448724){return _0x448724[_0xb696('0x3a')]===_0x743841;});}if(_0x5852e0>=0x0){logger[_0xb696('0x3b')](_0xb696('0x3c'));}else{logger['info'](_0xb696('0x3d'));_0x5852e0=_['findIndex'](_0x1ee662[_0xb696('0x38')],function(_0x29c53f){return _0x29c53f[_0xb696('0x3e')][_0xb696('0x1b')]===_0xb696('0x3f');});}return _0x1ee662[_0xb696('0x38')][_0x5852e0];}else{if(_0x1ee662[_0xb696('0x40')][_0xb696('0x3e')][_0xb696('0x1b')]===_0xb696('0x3f')){logger[_0xb696('0x3b')](_0xb696('0x3d'));user=_0x1ee662[_0xb696('0x40')];return user;}else{logger[_0xb696('0x31')](_0xb696('0x41'),JSON[_0xb696('0xe')](_0x1ee662));throw new Error(_0xb696('0x42')+JSON['stringify'](_0x1ee662));}}}else{logger[_0xb696('0x31')](_0xb696('0x41'),JSON[_0xb696('0xe')](_0x1ee662));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON['stringify'](_0x1ee662));}})[_0xb696('0x30')](function(_0x153ecd){console[_0xb696('0x31')](_0x153ecd);});}function getZohoUser(_0x4cb739,_0x1a53f8){return new BPromise(function(_0xa5c5a9,_0x3665a4){request(_0x4cb739)[_0xb696('0x2e')](function(_0x419e58){var _0x4783f1=null;if(_0x419e58){_0x4783f1=_0x419e58[_0xb696('0x43')][0x0];_0x4783f1[_0xb696('0x44')]=_0x1a53f8;}_0xa5c5a9(_0x4783f1);})['catch'](function(_0x4ffda9){_0x3665a4(_0x4ffda9);});});}function createEndUser(_0x4428fd,_0x5bc6fd,_0x14f4be,_0x7f107e,_0x3816e1,_0x3a9bea){var _0x14f4be=getName(_0x14f4be);return request({'method':_0xb696('0x28'),'uri':_0xb696('0x45')+_0x5bc6fd+_0xb696('0x46')+_['startCase'](_0x3a9bea[_0xb696('0x47')])+'s','body':{'data':[{'Last_Name':_0x14f4be[0x1],'First_Name':_0x14f4be[0x0],'Phone':_0x7f107e,'Owner':{'name':!_[_0xb696('0x1f')](_0x3816e1['role']['name'])?_0x3816e1[_0xb696('0x48')]['name']:!_[_0xb696('0x1f')](_0x3816e1[_0xb696('0x49')])?_0x3816e1[_0xb696('0x49')]+'\x20'+_0x3816e1[_0xb696('0x4a')]:_0x3816e1[_0xb696('0x4a')],'id':_0x3816e1['id']}}]},'headers':{'Authorization':_0xb696('0x4b')+_0x4428fd},'json':!![]})[_0xb696('0x2e')](function(_0x2776a6){if(_0x2776a6&&_0x2776a6[_0xb696('0x43')][0x0][_0xb696('0x4c')]===_0xb696('0x4d')){var _0x3382cf=_0x2776a6['data'][0x0][_0xb696('0x4e')];_0x3382cf[_0xb696('0x44')]=_[_0xb696('0x4f')](_0x3a9bea[_0xb696('0x47')])+'s';return _0x3382cf;}logger['error']('The\x20failing\x20result\x20is',JSON[_0xb696('0xe')](data));throw new Error(_0xb696('0x50')+JSON['stringify'](data));})['catch'](function(_0x1e2605){console[_0xb696('0x51')]('CREATE\x20ERROR',_0x1e2605);});}function getEndUser(_0x45de52,_0x78d222,_0x5cd9c8,_0x343760,_0x55b3c0,_0xfd6d79,_0x35cc9b){var _0x27dac3={'method':_0xb696('0x35'),'uri':'','headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x45de52},'json':!![]};switch(_0x35cc9b[_0xb696('0x52')]){case'contact_lead':_0x27dac3[_0xb696('0x53')]=_0xb696('0x45')+_0x78d222+_0xb696('0x54')+_0x55b3c0+'))';return getZohoUser(_0x27dac3,_0xb696('0x55'))[_0xb696('0x2e')](function(_0x24876e){if(_0x24876e)return _0x24876e;_0x27dac3['uri']=_0xb696('0x45')+_0x78d222+_0xb696('0x56')+_0x55b3c0+'))';return getZohoUser(_0x27dac3,_0xb696('0x57'))[_0xb696('0x2e')](function(_0x502ff5){if(_0x502ff5)return _0x502ff5;if(_0x35cc9b[_0xb696('0x47')]!='nothing'){return createEndUser(_0x45de52,_0x78d222,_0x343760,_0x55b3c0,_0xfd6d79,_0x35cc9b);}else{return{};}});});break;case _0xb696('0x58'):_0x27dac3['uri']='https://www.zohoapis.'+_0x78d222+_0xb696('0x54')+_0x55b3c0+'))';return getZohoUser(_0x27dac3,_0xb696('0x55'))[_0xb696('0x2e')](function(_0x1e268c){if(_0x1e268c)return _0x1e268c;if(_0x35cc9b[_0xb696('0x47')]!=_0xb696('0x59')){return createEndUser(_0x45de52,_0x78d222,_0x343760,_0x55b3c0,_0xfd6d79,_0x35cc9b);}else{return{};}});break;case _0xb696('0x5a'):_0x27dac3[_0xb696('0x53')]=_0xb696('0x45')+_0x78d222+_0xb696('0x56')+_0x55b3c0+'))';return getZohoUser(_0x27dac3,_0xb696('0x57'))[_0xb696('0x2e')](function(_0x3d35c9){if(_0x3d35c9)return _0x3d35c9;if(_0x35cc9b['moduleCreate']!=_0xb696('0x59')){return createEndUser(_0x45de52,_0x78d222,_0x343760,_0x55b3c0,_0xfd6d79,_0x35cc9b);}else{return{};}});break;}}function getCall(_0x425b3f,_0x4db713,_0x5b3df2,_0x3f5d1d,_0x1b53e6,_0x5997a7,_0x343163,_0x35c50d){logger[_0xb696('0x3b')](_0xb696('0x5b'));var _0x3c8b85={};_0x3c8b85[_0xb696('0x5c')]={'name':!_[_0xb696('0x1f')](_0x3f5d1d[_0xb696('0x48')][_0xb696('0x1b')])&&!_[_0xb696('0x1f')](_0x3f5d1d[_0xb696('0x3e')][_0xb696('0x1b')])&&_0x3f5d1d['profile'][_0xb696('0x1b')]==='administrator'?_0x3f5d1d['role'][_0xb696('0x1b')]:!_['isNil'](_0x3f5d1d[_0xb696('0x49')])?_0x3f5d1d[_0xb696('0x49')]+'\x20'+_0x3f5d1d[_0xb696('0x4a')]:_0x3f5d1d[_0xb696('0x4a')],'id':_0x3f5d1d['id']};_0x3c8b85[_0xb696('0x5d')]=intUtil[_0xb696('0x5e')](_0x5997a7[_0xb696('0x5f')],_0x343163,'\x20');_0x3c8b85[_0xb696('0x60')]=intUtil[_0xb696('0x5e')](_0x5997a7[_0xb696('0x61')],_0x343163,'\x0a');if(_0x1b53e6[_0xb696('0x44')]===_0xb696('0x55')){_0x3c8b85[_0xb696('0x62')]={'name':!_['isNil'](_0x1b53e6[_0xb696('0x63')])?_0x1b53e6[_0xb696('0x63')]:!_[_0xb696('0x1f')](_0x1b53e6[_0xb696('0x64')])?_0x1b53e6[_0xb696('0x64')]+'\x20'+_0x1b53e6['Last_Name']:_0x1b53e6[_0xb696('0x65')],'id':_0x1b53e6['id']};}if(_0x1b53e6['enduserType']===_0xb696('0x57')){_0x3c8b85[_0xb696('0x66')]={'name':!_[_0xb696('0x1f')](_0x1b53e6['Full_Name'])?_0x1b53e6[_0xb696('0x63')]:!_[_0xb696('0x1f')](_0x1b53e6[_0xb696('0x64')])?_0x1b53e6[_0xb696('0x64')]+'\x20'+_0x1b53e6[_0xb696('0x65')]:_0x1b53e6[_0xb696('0x65')],'id':_0x1b53e6['id']};_0x3c8b85[_0xb696('0x67')]=_['startCase'](_0x1b53e6[_0xb696('0x44')]);}if(_0x343163['talktime']){_0x3c8b85['Call_Duration']=moment['utc'](parseInt(_0x343163['talktime'])*0x3e8)[_0xb696('0x68')]('mm:ss');}else if(_0x343163[_0xb696('0x69')]&&_0x343163[_0xb696('0x6a')]){_0x3c8b85[_0xb696('0x6b')]=moment[_0xb696('0x6c')](moment(_0x343163[_0xb696('0x6a')],_0xb696('0x6d'))['diff'](moment(_0x343163['starttime'],_0xb696('0x6d'))))['format']('mm:ss');}switch(_0x343163[_0xb696('0x6e')]){case _0xb696('0x6f'):_0x3c8b85[_0xb696('0x70')]=_0xb696('0x71');break;case _0xb696('0x72'):case _0xb696('0x73'):_0x3c8b85[_0xb696('0x70')]=_0xb696('0x74');break;case _0xb696('0x75'):_0x3c8b85[_0xb696('0x70')]='Rejected';break;case _0xb696('0x76'):_0x3c8b85['Call_Result']=_0xb696('0x77');break;case _0xb696('0x78'):_0x3c8b85[_0xb696('0x70')]=_0xb696('0x79');default:}_0x3c8b85[_0xb696('0x7a')]=(_0x35c50d===_0xb696('0x7b')?moment(_0x343163['starttime'])['format'](_0xb696('0x6d')):moment(_0x343163[_0xb696('0x7c')])[_0xb696('0x68')](_0xb696('0x6d')))||moment()['format'](_0xb696('0x6d'));_0x3c8b85[_0xb696('0x7d')]=_0x35c50d||_0xb696('0x7e');_0x3c8b85=_['merge'](_0x3c8b85,getCustomFields(_0x5997a7[_0xb696('0x7f')],_0x343163));return request({'method':_0xb696('0x28'),'uri':'https://www.zohoapis.'+_0x4db713+_0xb696('0x80'),'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x425b3f},'body':{'data':[_0x3c8b85]},'json':!![]})['then'](function(_0x507f5f){if(_0x507f5f&&_0x507f5f[_0xb696('0x43')][0x0][_0xb696('0x4c')]===_0xb696('0x4d')){logger[_0xb696('0x3b')](_0xb696('0x81'));return{'id':_0x507f5f[_0xb696('0x43')][0x0][_0xb696('0x4e')]['id']};}})[_0xb696('0x30')](function(_0x33becf){logger['info']('err',_0x33becf['stack']);console[_0xb696('0x51')](_0xb696('0x82'),_0x33becf);});}exports[_0xb696('0x83')]=function(_0x4ac141,_0x295215,_0x4d55cf,_0x47f0c8,_0x1551bf,_0x59bb54){var _0x42e4a2,_0x31f8d2,_0x1936a2;_0x59bb54[_0xb696('0x84')]=intUtil[_0xb696('0x85')](_0x59bb54[_0xb696('0x84')]);_0x59bb54[_0xb696('0x86')]=intUtil[_0xb696('0x85')](_0x59bb54[_0xb696('0x86')]);if(_0x1551bf&&_0x1551bf[_0xb696('0x87')]){logger[_0xb696('0x3b')](_0xb696('0x88'),_0xb696('0x89'));_0x295215[_0xb696('0x8a')]=_0x59bb54['serverUrl']+_0xb696('0x8b')+_0x295215['uniqueid']+_0xb696('0x8c')+md5(_0x295215[_0xb696('0x8d')]);}else{_0x295215[_0xb696('0x8a')]='';}var _0x751eb9=_0x59bb54[_0xb696('0x84')]===_0xb696('0x8e')?'eu':_0xb696('0x8f');return getAccessToken(_0x59bb54)['then'](function(_0x1e85e2){_0x1936a2=_0x1e85e2;return getUser(_0x1936a2,_0x751eb9,_0x59bb54,_0x47f0c8[_0xb696('0x3a')]);})[_0xb696('0x2e')](function(_0x11b781){_0x42e4a2=_0x11b781;logger[_0xb696('0x3b')]('The\x20User\x20ID\x20is:',_0x42e4a2['id']);return getEndUser(_0x1936a2,_0x751eb9,_0x59bb54,_0x295215[_0xb696('0x90')],_0x295215[_0xb696('0x91')],_0x42e4a2,_0x4d55cf);})[_0xb696('0x2e')](function(_0x249016){_0x31f8d2=_0x249016;return getCall(_0x1936a2,_0x751eb9,_0x59bb54,_0x42e4a2,_0x31f8d2,_0x4d55cf,_0x295215,_0xb696('0x7e'));})['then'](function(_0x3cfdbc){if(_0x3cfdbc){logger['info'](_0xb696('0x92'),_0x3cfdbc['id']);logger['info'](_0xb696('0x88'),_0xb696('0x93'));emit(util[_0xb696('0x68')](_0xb696('0x94'),_0x47f0c8[_0xb696('0x1b')]),_0xb696('0x95'),{'uri':'https://crm.'+_0x59bb54[_0xb696('0x84')]+_0xb696('0x96')+_0x3cfdbc['id']});}})[_0xb696('0x30')](function(_0x1a3ffd){logger[_0xb696('0x31')](_0xb696('0x88'),JSON[_0xb696('0xe')](_0x1a3ffd));});};exports[_0xb696('0x7b')]=function(_0x3e6d52,_0x4565c4,_0x15ae82,_0x241b4f,_0x4e0c0f,_0x3b50b7,_0x3d51fb){var _0x35da10,_0x55b58c,_0x48707c;_0x3b50b7['host']=intUtil[_0xb696('0x85')](_0x3b50b7['host']);_0x3b50b7['serverUrl']=intUtil['stripTrailingSlash'](_0x3b50b7[_0xb696('0x86')]);if(_0x3d51fb&&_0x3d51fb['recordingFormat']&&_0x3d51fb[_0xb696('0x97')]!==_0xb696('0x98')){logger[_0xb696('0x3b')](_0xb696('0x99'),_0xb696('0x89'));_0x4565c4[_0xb696('0x8a')]=_0x3b50b7[_0xb696('0x86')]+_0xb696('0x8b')+_0x4565c4[_0xb696('0x8d')]+_0xb696('0x8c')+md5(_0x4565c4[_0xb696('0x8d')]);}var _0x348447=_0x3b50b7['host']==='zoho.eu'?'eu':'com';return getAccessToken(_0x3b50b7)[_0xb696('0x2e')](function(_0x101d35){_0x48707c=_0x101d35;return getUser(_0x48707c,_0x348447,_0x3b50b7,_0x241b4f[_0xb696('0x3a')]);})[_0xb696('0x2e')](function(_0x5b538f){_0x35da10=_0x5b538f;logger[_0xb696('0x3b')](_0xb696('0x9a'),_0x35da10['id']);return getEndUser(_0x48707c,_0x348447,_0x3b50b7,_0x4565c4[_0xb696('0x9b')],_0x4565c4['destcalleridnum'],_0x35da10,_0x15ae82);})[_0xb696('0x2e')](function(_0x5c95da){_0x55b58c=_0x5c95da;return getCall(_0x48707c,_0x348447,_0x3b50b7,_0x35da10,_0x55b58c,_0x15ae82,_0x4565c4,_0xb696('0x9c'));})[_0xb696('0x2e')](function(_0x46b1e9){if(_0x46b1e9){logger[_0xb696('0x3b')](_0xb696('0x92'),_0x46b1e9['id']);logger[_0xb696('0x3b')](_0xb696('0x99'),'Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xb696('0x68')](_0xb696('0x94'),_0x241b4f['name']),_0xb696('0x95'),{'uri':'https://crm.'+_0x3b50b7[_0xb696('0x84')]+_0xb696('0x96')+_0x46b1e9['id']});}})[_0xb696('0x30')](function(_0x15f4f4){logger[_0xb696('0x31')](_0xb696('0x99'),JSON[_0xb696('0xe')](_0x15f4f4));});};exports['unmanaged']=function(_0x1734f6,_0x3ab2d3,_0x554c80,_0x5de1a2,_0x26d5f0,_0xa9ab7a){var _0x48bd6a,_0x4d8fb7,_0x5e737b;_0xa9ab7a[_0xb696('0x84')]=intUtil[_0xb696('0x85')](_0xa9ab7a[_0xb696('0x84')]);_0xa9ab7a[_0xb696('0x86')]=intUtil['stripTrailingSlash'](_0xa9ab7a[_0xb696('0x86')]);if(_0x26d5f0&&_0x26d5f0[_0xb696('0x87')]){logger['info']('['+_0x3ab2d3[_0xb696('0x6e')][_0xb696('0x9d')]()+']','Recording\x20is\x20enabled!');_0x3ab2d3[_0xb696('0x8a')]=_0xa9ab7a[_0xb696('0x86')]+_0xb696('0x8b')+_0x3ab2d3[_0xb696('0x8d')]+_0xb696('0x8c')+md5(_0x3ab2d3[_0xb696('0x8d')]);}else{_0x3ab2d3[_0xb696('0x8a')]='';}var _0x5227eb=_0xa9ab7a[_0xb696('0x84')]===_0xb696('0x8e')?'eu':_0xb696('0x8f');return getAccessToken(_0xa9ab7a)['then'](function(_0x53c6f4){_0x5e737b=_0x53c6f4;return getUser(_0x5e737b,_0x5227eb,_0xa9ab7a);})['then'](function(_0x952ad5){_0x48bd6a=_0x952ad5;logger['info'](_0xb696('0x9a'),_0x48bd6a['id']);return getEndUser(_0x5e737b,_0x5227eb,_0xa9ab7a,_0x3ab2d3[_0xb696('0x90')],_0x3ab2d3['calleridnum'],_0x48bd6a,_0x554c80);})['then'](function(_0xc2faa3){_0x4d8fb7=_0xc2faa3;return getCall(_0x5e737b,_0x5227eb,_0xa9ab7a,_0x48bd6a,_0x4d8fb7,_0x554c80,_0x3ab2d3,'Inbound');})[_0xb696('0x2e')](function(_0x475430){if(_0x475430){logger[_0xb696('0x3b')](_0xb696('0x92'),_0x475430['id']);}})[_0xb696('0x30')](function(_0x310d7a){logger[_0xb696('0x31')]('['+_0x3ab2d3['lastevent'][_0xb696('0x9d')]()+']',JSON[_0xb696('0xe')](_0x310d7a));});}; \ No newline at end of file +var _0x6e67=['https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','refreshToken','clientSecret','refresh_token','then','add','expires_in','seconds','error','stack','info','Search\x20user','GET','format','ActiveUsers','Zoho-oauthtoken\x20','users','isArrayLikeObject','isNil','Agent\x20found!','Using\x20the\x20admin\x20account!','findIndex','profile','Administrator','user','The\x20failing\x20result\x20is','stringify','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','catch','https://www.zohoapis.','startCase','role','first_name','last_name','data','SUCCESS','details','Error:\x20','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','moduleCreate','nothing','contact','lead','Creating\x20new\x20call...','Owner','Subject','getString','Descriptions','Contacts','Full_Name','First_Name','Last_Name','enduserType','What_Id','$se_module','talktime','Call_Duration','utc','mm:ss','answertime','endtime','diff','starttime','YYYY-MM-DDTHH:mm:ss','lastevent','Call_Result','Called','complete','Answered','rejected','Rejected','abandoned','Abandoned','timeout','Timeout','Call_Start_Time','agentcalledAt','Call_Type','Inbound','merge','Fields','/crm/v2/Calls','code','err','log','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','recordingURL','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','host','zoho.eu','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','com','destcalleridname','unmanaged','toUpperCase','lodash','request-promise','md5','util','./util','moment','bluebird','../../../../config/environment','../../../../config/logger','zoho','redis','defaults','localhost','emit','debug','[HTTP]','length','forEach','string','picklist','idField','content','toString','type','variable','variableName','customVariable','Variable','name','toLowerCase','access_token','isBefore','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in'];(function(_0x3eb92c,_0x165d03){var _0x289360=function(_0x16742e){while(--_0x16742e){_0x3eb92c['push'](_0x3eb92c['shift']());}};_0x289360(++_0x165d03);}(_0x6e67,0x114));var _0x76e6=function(_0x631577,_0x38e35d){_0x631577=_0x631577-0x0;var _0x517397=_0x6e67[_0x631577];return _0x517397;};'use strict';var _=require(_0x76e6('0x0'));var rp=require(_0x76e6('0x1'));var md5=require(_0x76e6('0x2'));var util=require(_0x76e6('0x3'));var intUtil=require(_0x76e6('0x4'));var moment=require(_0x76e6('0x5'));var Redis=require('ioredis');var BPromise=require(_0x76e6('0x6'));var config=require(_0x76e6('0x7'));var logger=require(_0x76e6('0x8'))(_0x76e6('0x9'));config[_0x76e6('0xa')]=_[_0x76e6('0xb')](config['redis'],{'host':_0x76e6('0xc'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function emit(_0x16f03b,_0x2149ea,_0x2e30b0){io['to'](_0x16f03b)[_0x76e6('0xd')](_0x2149ea,_0x2e30b0);}function request(_0x2f4951){logger[_0x76e6('0xe')](_0x76e6('0xf'),JSON['stringify'](_0x2f4951));return rp(_0x2f4951);}function getCustomFields(_0xe306a1,_0x59637c){var _0x18c199={};if(_0xe306a1[_0x76e6('0x10')]>0x0){_[_0x76e6('0x11')](_0xe306a1,function(_0x532012){if(_['includes']([_0x76e6('0x12'),_0x76e6('0x13')],_0x532012['type'])&&_0x532012['idField']){_0x18c199[_0x532012[_0x76e6('0x14')]]=_0x532012[_0x76e6('0x15')][_0x76e6('0x16')]();}else if(_0x532012[_0x76e6('0x17')]===_0x76e6('0x18')&&_0x532012[_0x76e6('0x19')]&&_0x532012[_0x76e6('0x14')]&&_0x59637c[_0x532012[_0x76e6('0x19')]]){_0x18c199[_0x532012[_0x76e6('0x14')]]=_0x59637c[_0x532012[_0x76e6('0x19')]][_0x76e6('0x16')]();}else if(_0x532012[_0x76e6('0x17')]===_0x76e6('0x1a')&&_0x532012[_0x76e6('0x1b')]&&_0x532012[_0x76e6('0x1b')][_0x76e6('0x1c')]&&_0x532012['idField']&&_0x59637c[_0x532012['Variable'][_0x76e6('0x1c')][_0x76e6('0x1d')]()]){_0x18c199[_0x532012[_0x76e6('0x14')]]=_0x59637c[_0x532012['Variable'][_0x76e6('0x1c')][_0x76e6('0x1d')]()][_0x76e6('0x16')]();}});}return _0x18c199;}function getName(_0x43018e){if(_0x43018e['indexOf']('\x20')>0x0){var _0x26e094=_0x43018e['split'](/ (.+)/);if(_0x26e094[0x1]){return _0x26e094;}}return[_0x43018e,_0x43018e];}var accountsTokens={};function getAccessToken(_0x1e0ea8){return new Promise(function(_0x1516a9,_0x468dcd){if(!_['isNil'](accountsTokens[_0x1e0ea8['id']])&&!_['isNil'](accountsTokens[_0x1e0ea8['id']][_0x76e6('0x1e')])){if(moment()[_0x76e6('0x1f')](accountsTokens[_0x1e0ea8['id']]['expires_in'])){_0x1516a9(accountsTokens[_0x1e0ea8['id']]['access_token']);}}var _0x39ec34;switch(_0x1e0ea8[_0x76e6('0x20')]){case'US':_0x39ec34=_0x76e6('0x21');break;case'AU':_0x39ec34=_0x76e6('0x22');break;case'EU':_0x39ec34='https://accounts.zoho.eu';break;case'IN':_0x39ec34=_0x76e6('0x23');break;case'CN':_0x39ec34=_0x76e6('0x24');break;default:_0x39ec34=_0x76e6('0x25');break;}var _0x56fc40={'method':_0x76e6('0x26'),'uri':_0x39ec34+'/oauth/v2/token','qs':{'refresh_token':_0x1e0ea8[_0x76e6('0x27')],'client_id':_0x1e0ea8['clientId'],'client_secret':_0x1e0ea8[_0x76e6('0x28')],'grant_type':_0x76e6('0x29')},'json':!![]};return rp(_0x56fc40)[_0x76e6('0x2a')](function(_0x22ec79){accountsTokens[_0x1e0ea8['id']]={'access_token':_0x22ec79[_0x76e6('0x1e')],'expires_in':moment()[_0x76e6('0x2b')](_0x22ec79[_0x76e6('0x2c')],_0x76e6('0x2d'))};_0x1516a9(_0x22ec79['access_token']);})['catch'](function(_0x422177){logger[_0x76e6('0x2e')]('Failing\x20creating\x20the\x20access_token',_0x422177[_0x76e6('0x2f')]);_0x468dcd(_0x422177);});});}function getUser(_0x2b001c,_0x2ce488,_0x47daaf,_0x526383){logger[_0x76e6('0x30')](_0x76e6('0x31'));return request({'method':_0x76e6('0x32'),'uri':util[_0x76e6('0x33')]('https://www.zohoapis.%s/crm/v2/users',_0x2ce488),'qs':{'type':_0x76e6('0x34')},'headers':{'Authorization':_0x76e6('0x35')+_0x2b001c},'json':!![]})[_0x76e6('0x2a')](function(_0x2c46b9){if(_0x2c46b9[_0x76e6('0x36')]){var _0x4371a2=-0x1;if(_[_0x76e6('0x37')](_0x2c46b9[_0x76e6('0x36')])){if(!_[_0x76e6('0x38')](_0x526383)){_0x4371a2=_['findIndex'](_0x2c46b9[_0x76e6('0x36')],function(_0x305a81){return _0x305a81['email']===_0x526383;});}if(_0x4371a2>=0x0){logger[_0x76e6('0x30')](_0x76e6('0x39'));}else{logger['info'](_0x76e6('0x3a'));_0x4371a2=_[_0x76e6('0x3b')](_0x2c46b9[_0x76e6('0x36')],function(_0x55d794){return _0x55d794[_0x76e6('0x3c')]['name']===_0x76e6('0x3d');});}return _0x2c46b9[_0x76e6('0x36')][_0x4371a2];}else{if(_0x2c46b9[_0x76e6('0x3e')][_0x76e6('0x3c')][_0x76e6('0x1c')]===_0x76e6('0x3d')){logger['info'](_0x76e6('0x3a'));user=_0x2c46b9[_0x76e6('0x3e')];return user;}else{logger['error'](_0x76e6('0x3f'),JSON[_0x76e6('0x40')](_0x2c46b9));throw new Error(_0x76e6('0x41')+JSON[_0x76e6('0x40')](_0x2c46b9));}}}else{logger['error'](_0x76e6('0x3f'),JSON['stringify'](_0x2c46b9));throw new Error(_0x76e6('0x41')+JSON['stringify'](_0x2c46b9));}})[_0x76e6('0x42')](function(_0x2373d0){console['error'](_0x2373d0);});}function getZohoUser(_0x8bd4e5,_0x2f74a4){return new BPromise(function(_0x40db6e,_0x5022c9){request(_0x8bd4e5)[_0x76e6('0x2a')](function(_0x24d90f){var _0x3cb054=null;if(_0x24d90f){_0x3cb054=_0x24d90f['data'][0x0];_0x3cb054['enduserType']=_0x2f74a4;}_0x40db6e(_0x3cb054);})[_0x76e6('0x42')](function(_0x2caad2){_0x5022c9(_0x2caad2);});});}function createEndUser(_0x4766e0,_0x31dd91,_0x4a2a24,_0x5cc5ce,_0x226db0,_0xf07854){var _0x4a2a24=getName(_0x4a2a24);return request({'method':'POST','uri':_0x76e6('0x43')+_0x31dd91+'/crm/v2/'+_[_0x76e6('0x44')](_0xf07854['moduleCreate'])+'s','body':{'data':[{'Last_Name':_0x4a2a24[0x1],'First_Name':_0x4a2a24[0x0],'Phone':_0x5cc5ce,'Owner':{'name':!_[_0x76e6('0x38')](_0x226db0[_0x76e6('0x45')][_0x76e6('0x1c')])?_0x226db0['role'][_0x76e6('0x1c')]:!_['isNil'](_0x226db0[_0x76e6('0x46')])?_0x226db0['first_name']+'\x20'+_0x226db0[_0x76e6('0x47')]:_0x226db0[_0x76e6('0x47')],'id':_0x226db0['id']}}]},'headers':{'Authorization':_0x76e6('0x35')+_0x4766e0},'json':!![]})['then'](function(_0x1e2e6b){if(_0x1e2e6b&&_0x1e2e6b[_0x76e6('0x48')][0x0]['code']===_0x76e6('0x49')){var _0x11adc4=_0x1e2e6b['data'][0x0][_0x76e6('0x4a')];_0x11adc4['enduserType']=_[_0x76e6('0x44')](_0xf07854['moduleCreate'])+'s';return _0x11adc4;}logger[_0x76e6('0x2e')](_0x76e6('0x3f'),JSON['stringify'](data));throw new Error(_0x76e6('0x4b')+JSON[_0x76e6('0x40')](data));})[_0x76e6('0x42')](function(_0x24c35c){console['log']('CREATE\x20ERROR',_0x24c35c);});}function getEndUser(_0x25e3f2,_0x4ff4c3,_0x630ac5,_0x4cec01,_0x129e52,_0x1c04ad,_0x299daf){var _0x9ff669={'method':_0x76e6('0x32'),'uri':'','headers':{'Authorization':_0x76e6('0x35')+_0x25e3f2},'json':!![]};switch(_0x299daf['moduleSearch']){case'contact_lead':_0x9ff669[_0x76e6('0x4c')]=_0x76e6('0x43')+_0x4ff4c3+_0x76e6('0x4d')+_0x129e52+'))';return getZohoUser(_0x9ff669,'Contacts')[_0x76e6('0x2a')](function(_0x132e52){if(_0x132e52)return _0x132e52;_0x9ff669[_0x76e6('0x4c')]='https://www.zohoapis.'+_0x4ff4c3+_0x76e6('0x4e')+_0x129e52+'))';return getZohoUser(_0x9ff669,_0x76e6('0x4f'))[_0x76e6('0x2a')](function(_0x25bcf2){if(_0x25bcf2)return _0x25bcf2;if(_0x299daf[_0x76e6('0x50')]!=_0x76e6('0x51')){return createEndUser(_0x25e3f2,_0x4ff4c3,_0x4cec01,_0x129e52,_0x1c04ad,_0x299daf);}else{return{};}});});break;case _0x76e6('0x52'):_0x9ff669[_0x76e6('0x4c')]=_0x76e6('0x43')+_0x4ff4c3+_0x76e6('0x4d')+_0x129e52+'))';return getZohoUser(_0x9ff669,'Contacts')['then'](function(_0x1cbedc){if(_0x1cbedc)return _0x1cbedc;if(_0x299daf[_0x76e6('0x50')]!='nothing'){return createEndUser(_0x25e3f2,_0x4ff4c3,_0x4cec01,_0x129e52,_0x1c04ad,_0x299daf);}else{return{};}});break;case _0x76e6('0x53'):_0x9ff669[_0x76e6('0x4c')]=_0x76e6('0x43')+_0x4ff4c3+_0x76e6('0x4e')+_0x129e52+'))';return getZohoUser(_0x9ff669,_0x76e6('0x4f'))[_0x76e6('0x2a')](function(_0x538c20){if(_0x538c20)return _0x538c20;if(_0x299daf[_0x76e6('0x50')]!=_0x76e6('0x51')){return createEndUser(_0x25e3f2,_0x4ff4c3,_0x4cec01,_0x129e52,_0x1c04ad,_0x299daf);}else{return{};}});break;}}function getCall(_0x31f006,_0x4dc2cb,_0x306145,_0x14f99f,_0x46e2db,_0x52ae8e,_0x1a14ff,_0x16afea){logger['info'](_0x76e6('0x54'));var _0x1597a6={};_0x1597a6[_0x76e6('0x55')]={'name':!_['isNil'](_0x14f99f[_0x76e6('0x45')][_0x76e6('0x1c')])&&!_['isNil'](_0x14f99f[_0x76e6('0x3c')][_0x76e6('0x1c')])&&_0x14f99f[_0x76e6('0x3c')][_0x76e6('0x1c')]==='administrator'?_0x14f99f[_0x76e6('0x45')]['name']:!_[_0x76e6('0x38')](_0x14f99f[_0x76e6('0x46')])?_0x14f99f[_0x76e6('0x46')]+'\x20'+_0x14f99f['last_name']:_0x14f99f['last_name'],'id':_0x14f99f['id']};_0x1597a6[_0x76e6('0x56')]=intUtil[_0x76e6('0x57')](_0x52ae8e['Subjects'],_0x1a14ff,'\x20');_0x1597a6['Description']=intUtil[_0x76e6('0x57')](_0x52ae8e[_0x76e6('0x58')],_0x1a14ff,'\x0a');if(_0x46e2db['enduserType']===_0x76e6('0x59')){_0x1597a6['Who_Id']={'name':!_[_0x76e6('0x38')](_0x46e2db['Full_Name'])?_0x46e2db[_0x76e6('0x5a')]:!_[_0x76e6('0x38')](_0x46e2db[_0x76e6('0x5b')])?_0x46e2db[_0x76e6('0x5b')]+'\x20'+_0x46e2db[_0x76e6('0x5c')]:_0x46e2db['Last_Name'],'id':_0x46e2db['id']};}if(_0x46e2db[_0x76e6('0x5d')]===_0x76e6('0x4f')){_0x1597a6[_0x76e6('0x5e')]={'name':!_[_0x76e6('0x38')](_0x46e2db['Full_Name'])?_0x46e2db[_0x76e6('0x5a')]:!_[_0x76e6('0x38')](_0x46e2db['First_Name'])?_0x46e2db['First_Name']+'\x20'+_0x46e2db[_0x76e6('0x5c')]:_0x46e2db[_0x76e6('0x5c')],'id':_0x46e2db['id']};_0x1597a6[_0x76e6('0x5f')]=_['startCase'](_0x46e2db[_0x76e6('0x5d')]);}if(_0x1a14ff[_0x76e6('0x60')]){_0x1597a6[_0x76e6('0x61')]=moment[_0x76e6('0x62')](parseInt(_0x1a14ff[_0x76e6('0x60')])*0x3e8)[_0x76e6('0x33')](_0x76e6('0x63'));}else if(_0x1a14ff[_0x76e6('0x64')]&&_0x1a14ff[_0x76e6('0x65')]){_0x1597a6['Call_Duration']=moment[_0x76e6('0x62')](moment(_0x1a14ff[_0x76e6('0x65')],'YYYY-MM-DDTHH:mm:ss')[_0x76e6('0x66')](moment(_0x1a14ff[_0x76e6('0x67')],_0x76e6('0x68'))))[_0x76e6('0x33')](_0x76e6('0x63'));}switch(_0x1a14ff[_0x76e6('0x69')]){case'called':_0x1597a6[_0x76e6('0x6a')]=_0x76e6('0x6b');break;case _0x76e6('0x6c'):case'connect':_0x1597a6['Call_Result']=_0x76e6('0x6d');break;case _0x76e6('0x6e'):_0x1597a6['Call_Result']=_0x76e6('0x6f');break;case _0x76e6('0x70'):_0x1597a6['Call_Result']=_0x76e6('0x71');break;case _0x76e6('0x72'):_0x1597a6['Call_Result']=_0x76e6('0x73');default:}_0x1597a6[_0x76e6('0x74')]=(_0x16afea==='outbound'?moment(_0x1a14ff[_0x76e6('0x67')])[_0x76e6('0x33')]('YYYY-MM-DDTHH:mm:ss'):moment(_0x1a14ff[_0x76e6('0x75')])['format'](_0x76e6('0x68')))||moment()[_0x76e6('0x33')]('YYYY-MM-DDTHH:mm:ss');_0x1597a6[_0x76e6('0x76')]=_0x16afea||_0x76e6('0x77');_0x1597a6=_[_0x76e6('0x78')](_0x1597a6,getCustomFields(_0x52ae8e[_0x76e6('0x79')],_0x1a14ff));return request({'method':_0x76e6('0x26'),'uri':_0x76e6('0x43')+_0x4dc2cb+_0x76e6('0x7a'),'headers':{'Authorization':_0x76e6('0x35')+_0x31f006},'body':{'data':[_0x1597a6]},'json':!![]})['then'](function(_0x428d07){if(_0x428d07&&_0x428d07[_0x76e6('0x48')][0x0][_0x76e6('0x7b')]===_0x76e6('0x49')){logger[_0x76e6('0x30')]('Call\x20created!');return{'id':_0x428d07[_0x76e6('0x48')][0x0][_0x76e6('0x4a')]['id']};}})[_0x76e6('0x42')](function(_0x5d8c95){logger[_0x76e6('0x30')](_0x76e6('0x7c'),_0x5d8c95[_0x76e6('0x2f')]);console[_0x76e6('0x7d')](_0x76e6('0x7c'),_0x5d8c95);});}exports[_0x76e6('0x7e')]=function(_0xd4cd28,_0x3d464,_0x92935b,_0xb214b4,_0x5d6b0a,_0xdf30d5){var _0x237e00,_0x92858,_0xfc7f47;_0xdf30d5['host']=intUtil[_0x76e6('0x7f')](_0xdf30d5['host']);_0xdf30d5[_0x76e6('0x80')]=intUtil['stripTrailingSlash'](_0xdf30d5[_0x76e6('0x80')]);if(_0x5d6b0a&&_0x5d6b0a[_0x76e6('0x81')]){logger[_0x76e6('0x30')](_0x76e6('0x82'),'Recording\x20is\x20enabled!');_0x3d464[_0x76e6('0x83')]=_0xdf30d5[_0x76e6('0x80')]+_0x76e6('0x84')+_0x3d464[_0x76e6('0x85')]+_0x76e6('0x86')+md5(_0x3d464[_0x76e6('0x85')]);}else{_0x3d464['recordingURL']='';}var _0x51277b=_0xdf30d5[_0x76e6('0x87')]===_0x76e6('0x88')?'eu':'com';return getAccessToken(_0xdf30d5)[_0x76e6('0x2a')](function(_0x50c270){_0xfc7f47=_0x50c270;return getUser(_0xfc7f47,_0x51277b,_0xdf30d5,_0xb214b4[_0x76e6('0x89')]);})[_0x76e6('0x2a')](function(_0x238311){_0x237e00=_0x238311;logger[_0x76e6('0x30')](_0x76e6('0x8a'),_0x237e00['id']);return getEndUser(_0xfc7f47,_0x51277b,_0xdf30d5,_0x3d464[_0x76e6('0x8b')],_0x3d464[_0x76e6('0x8c')],_0x237e00,_0x92935b);})[_0x76e6('0x2a')](function(_0x40df21){_0x92858=_0x40df21;return getCall(_0xfc7f47,_0x51277b,_0xdf30d5,_0x237e00,_0x92858,_0x92935b,_0x3d464,'Inbound');})['then'](function(_0x396c98){if(_0x396c98){logger[_0x76e6('0x30')](_0x76e6('0x8d'),_0x396c98['id']);logger[_0x76e6('0x30')]('[QUEUE]',_0x76e6('0x8e'));emit(util[_0x76e6('0x33')](_0x76e6('0x8f'),_0xb214b4[_0x76e6('0x1c')]),_0x76e6('0x90'),{'uri':_0x76e6('0x91')+_0xdf30d5[_0x76e6('0x87')]+_0x76e6('0x92')+_0x396c98['id']});}})[_0x76e6('0x42')](function(_0x180a29){logger[_0x76e6('0x2e')](_0x76e6('0x82'),JSON[_0x76e6('0x40')](_0x180a29));});};exports[_0x76e6('0x93')]=function(_0x13de5e,_0x521c7c,_0x3e6845,_0x353760,_0x3e9876,_0x2b8e66,_0x472c95){var _0x533613,_0x3233ae,_0x2dabf9;_0x2b8e66[_0x76e6('0x87')]=intUtil[_0x76e6('0x7f')](_0x2b8e66[_0x76e6('0x87')]);_0x2b8e66[_0x76e6('0x80')]=intUtil[_0x76e6('0x7f')](_0x2b8e66[_0x76e6('0x80')]);if(_0x472c95&&_0x472c95['recordingFormat']&&_0x472c95[_0x76e6('0x94')]!==_0x76e6('0x95')){logger[_0x76e6('0x30')](_0x76e6('0x96'),_0x76e6('0x97'));_0x521c7c[_0x76e6('0x83')]=_0x2b8e66[_0x76e6('0x80')]+_0x76e6('0x84')+_0x521c7c[_0x76e6('0x85')]+_0x76e6('0x86')+md5(_0x521c7c[_0x76e6('0x85')]);}var _0x4f42d1=_0x2b8e66['host']===_0x76e6('0x88')?'eu':_0x76e6('0x98');return getAccessToken(_0x2b8e66)[_0x76e6('0x2a')](function(_0x337a59){_0x2dabf9=_0x337a59;return getUser(_0x2dabf9,_0x4f42d1,_0x2b8e66,_0x353760[_0x76e6('0x89')]);})[_0x76e6('0x2a')](function(_0x43a2ba){_0x533613=_0x43a2ba;logger['info'](_0x76e6('0x8a'),_0x533613['id']);return getEndUser(_0x2dabf9,_0x4f42d1,_0x2b8e66,_0x521c7c[_0x76e6('0x99')],_0x521c7c['destcalleridnum'],_0x533613,_0x3e6845);})[_0x76e6('0x2a')](function(_0x2991ae){_0x3233ae=_0x2991ae;return getCall(_0x2dabf9,_0x4f42d1,_0x2b8e66,_0x533613,_0x3233ae,_0x3e6845,_0x521c7c,'Outbound');})[_0x76e6('0x2a')](function(_0x5ae72b){if(_0x5ae72b){logger[_0x76e6('0x30')](_0x76e6('0x8d'),_0x5ae72b['id']);logger[_0x76e6('0x30')](_0x76e6('0x96'),_0x76e6('0x8e'));emit(util[_0x76e6('0x33')](_0x76e6('0x8f'),_0x353760[_0x76e6('0x1c')]),_0x76e6('0x90'),{'uri':_0x76e6('0x91')+_0x2b8e66[_0x76e6('0x87')]+_0x76e6('0x92')+_0x5ae72b['id']});}})[_0x76e6('0x42')](function(_0xeb376d){logger[_0x76e6('0x2e')](_0x76e6('0x96'),JSON[_0x76e6('0x40')](_0xeb376d));});};exports[_0x76e6('0x9a')]=function(_0x145876,_0x47f4c2,_0x932d4,_0x2f762b,_0x421fc4,_0x2a9bb1){var _0x3964f3,_0x25fd78,_0x2b230b;_0x2a9bb1[_0x76e6('0x87')]=intUtil[_0x76e6('0x7f')](_0x2a9bb1[_0x76e6('0x87')]);_0x2a9bb1['serverUrl']=intUtil[_0x76e6('0x7f')](_0x2a9bb1[_0x76e6('0x80')]);if(_0x421fc4&&_0x421fc4[_0x76e6('0x81')]){logger['info']('['+_0x47f4c2[_0x76e6('0x69')][_0x76e6('0x9b')]()+']','Recording\x20is\x20enabled!');_0x47f4c2[_0x76e6('0x83')]=_0x2a9bb1[_0x76e6('0x80')]+_0x76e6('0x84')+_0x47f4c2[_0x76e6('0x85')]+_0x76e6('0x86')+md5(_0x47f4c2['uniqueid']);}else{_0x47f4c2[_0x76e6('0x83')]='';}var _0x456750=_0x2a9bb1[_0x76e6('0x87')]==='zoho.eu'?'eu':_0x76e6('0x98');return getAccessToken(_0x2a9bb1)[_0x76e6('0x2a')](function(_0x1e671f){_0x2b230b=_0x1e671f;return getUser(_0x2b230b,_0x456750,_0x2a9bb1);})[_0x76e6('0x2a')](function(_0x24c15d){_0x3964f3=_0x24c15d;logger['info']('The\x20User\x20ID\x20is:',_0x3964f3['id']);return getEndUser(_0x2b230b,_0x456750,_0x2a9bb1,_0x47f4c2['calleridname'],_0x47f4c2['calleridnum'],_0x3964f3,_0x932d4);})[_0x76e6('0x2a')](function(_0x50e8e0){_0x25fd78=_0x50e8e0;return getCall(_0x2b230b,_0x456750,_0x2a9bb1,_0x3964f3,_0x25fd78,_0x932d4,_0x47f4c2,_0x76e6('0x77'));})[_0x76e6('0x2a')](function(_0xdb0bf7){if(_0xdb0bf7){logger[_0x76e6('0x30')]('The\x20Call\x20ID\x20is:',_0xdb0bf7['id']);}})[_0x76e6('0x42')](function(_0x29d94d){logger[_0x76e6('0x2e')]('['+_0x47f4c2[_0x76e6('0x69')][_0x76e6('0x9b')]()+']',JSON['stringify'](_0x29d94d));});}; \ 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 94a21e9..f868430 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 _0x11f4=['render','error','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','format','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','shelljs','trigger','exec','data2','Script','data3'];(function(_0x5726fc,_0x84450c){var _0x87e084=function(_0x30650e){while(--_0x30650e){_0x5726fc['push'](_0x5726fc['shift']());}};_0x87e084(++_0x84450c);}(_0x11f4,0x1cd));var _0x411f=function(_0xeed09a,_0x463e45){_0xeed09a=_0xeed09a-0x0;var _0x4ce84e=_0x11f4[_0xeed09a];return _0x4ce84e;};'use strict';var util=require(_0x411f('0x0'));var sh=require(_0x411f('0x1'));var Mustache=require('mustache');var logger=require('../../../../config/logger')(_0x411f('0x2'));exports[_0x411f('0x3')]=function(_0x330c0e,_0x3ecd74){var _0x487a99=_0x330c0e[_0x411f('0x4')]?_0x330c0e['data2']:_0x411f('0x5');var _0xac917c=_0x330c0e[_0x411f('0x6')]?Mustache[_0x411f('0x7')](_0x330c0e['data3'],_0x3ecd74):_0x3ecd74;sh['exec'](_0xac917c,function(_0x3b2823,_0x1dbff3,_0x3b4345){if(_0x3b2823!==0x0){logger[_0x411f('0x8')](util['format'](_0x411f('0x9'),_0x487a99,_0xac917c,_0x3b2823,_0x3b4345));}else{logger[_0x411f('0xa')](util[_0x411f('0xb')](_0x411f('0xc'),_0x487a99,_0xac917c,_0x1dbff3));}});}; \ No newline at end of file +var _0xfa19=['data2','Script','data3','render','format','util','mustache','../../../../config/logger','trigger','exec'];(function(_0x4b7895,_0x3c4f5d){var _0x264180=function(_0xe0e861){while(--_0xe0e861){_0x4b7895['push'](_0x4b7895['shift']());}};_0x264180(++_0x3c4f5d);}(_0xfa19,0xcd));var _0x9fa1=function(_0x13b30e,_0x535048){_0x13b30e=_0x13b30e-0x0;var _0x244848=_0xfa19[_0x13b30e];return _0x244848;};'use strict';var util=require(_0x9fa1('0x0'));var sh=require('shelljs');var Mustache=require(_0x9fa1('0x1'));var logger=require(_0x9fa1('0x2'))(_0x9fa1('0x3'));exports[_0x9fa1('0x4')]=function(_0x515715,_0x16a83b){var _0x5ca80f=_0x515715[_0x9fa1('0x5')]?_0x515715[_0x9fa1('0x5')]:_0x9fa1('0x6');var _0x4a7573=_0x515715[_0x9fa1('0x7')]?Mustache[_0x9fa1('0x8')](_0x515715['data3'],_0x16a83b):_0x16a83b;sh[_0x9fa1('0x4')](_0x4a7573,function(_0x28656f,_0x575893,_0x4b26cb){if(_0x28656f!==0x0){logger['error'](util[_0x9fa1('0x9')]('%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s',_0x5ca80f,_0x4a7573,_0x28656f,_0x4b26cb));}else{logger['info'](util[_0x9fa1('0x9')]('%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s',_0x5ca80f,_0x4a7573,_0x575893));}});}; \ 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 65035cb..a7a0613 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 _0x5f1c=['exec','data1','data2','data5','number','data6','parse','render','error','stack','toUpperCase','GET','DELETE','POST','PUT','body','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify','then',',\x20request\x20body:\x20','object','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','request-promise','util','mustache'];(function(_0x614caf,_0x2ecfdd){var _0x54c61e=function(_0x1725f8){while(--_0x1725f8){_0x614caf['push'](_0x614caf['shift']());}};_0x54c61e(++_0x2ecfdd);}(_0x5f1c,0x152));var _0xc5f1=function(_0x10c06e,_0xe886cb){_0x10c06e=_0x10c06e-0x0;var _0x5014e6=_0x5f1c[_0x10c06e];return _0x5014e6;};'use strict';var rp=require(_0xc5f1('0x0'));var util=require(_0xc5f1('0x1'));var _=require('lodash');var Mustache=require(_0xc5f1('0x2'));var logger=require('../../../../config/logger')('trigger');exports[_0xc5f1('0x3')]=function(_0x57ab44,_0x55828f){var _0x440c15,_0x254c13;var _0x2e0060={'method':_0x57ab44[_0xc5f1('0x4')]['toUpperCase'](),'uri':Mustache['render'](_0x57ab44[_0xc5f1('0x5')],_0x55828f),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x57ab44[_0xc5f1('0x6')])===_0xc5f1('0x7')&&parseInt(_0x57ab44[_0xc5f1('0x6')])>=0x1&&parseInt(_0x57ab44[_0xc5f1('0x6')])<=0xa?parseInt(_0x57ab44[_0xc5f1('0x6')])*0x3e8:0x5*0x3e8};try{_0x2e0060['headers']=_0x57ab44[_0xc5f1('0x8')]?JSON[_0xc5f1('0x9')](Mustache[_0xc5f1('0xa')](_0x57ab44[_0xc5f1('0x8')],_0x55828f)):{};}catch(_0xce89b){logger[_0xc5f1('0xb')](_0xce89b[_0xc5f1('0xc')]);}switch(_0x57ab44['data1'][_0xc5f1('0xd')]()){case _0xc5f1('0xe'):case _0xc5f1('0xf'):_0x440c15=null;_0x2e0060['qs']=_0x55828f;break;case _0xc5f1('0x10'):case _0xc5f1('0x11'):if(_0x57ab44['data7']){try{_0x440c15=JSON[_0xc5f1('0x9')](Mustache[_0xc5f1('0xa')](_0x57ab44['data7'],_0x55828f));_0x2e0060[_0xc5f1('0x12')]=_0x440c15;}catch(_0x2c1a30){logger[_0xc5f1('0xb')](_0x2c1a30[_0xc5f1('0xc')]);logger['error'](_0xc5f1('0x13'));}}else{_0x440c15=_0x55828f;_0x2e0060['body']=_0x440c15;}break;}logger[_0xc5f1('0x14')](util[_0xc5f1('0x15')](_0xc5f1('0x16'),_0x57ab44[_0xc5f1('0x4')],_0x57ab44[_0xc5f1('0x5')],JSON[_0xc5f1('0x17')](_0x2e0060)));rp(_0x2e0060)[_0xc5f1('0x18')](function(_0x50b312){_0x440c15=!_['isNil'](_0x440c15)?_0xc5f1('0x19')+_0x440c15:'';_0x254c13=typeof _0x50b312['body']===_0xc5f1('0x1a')?JSON[_0xc5f1('0x17')](_0x50b312['body']):_0x50b312['body'];logger['info'](util[_0xc5f1('0x15')](_0xc5f1('0x1b'),_0x57ab44[_0xc5f1('0x4')],_0x57ab44[_0xc5f1('0x5')],_0x50b312[_0xc5f1('0x1c')],_0x254c13));})[_0xc5f1('0x1d')](function(_0x1c95cb){logger[_0xc5f1('0xb')](util[_0xc5f1('0x15')](_0xc5f1('0x1e'),_0x57ab44[_0xc5f1('0x4')],_0x57ab44[_0xc5f1('0x5')],_0x1c95cb[_0xc5f1('0x1c')],_0x1c95cb['name'],_0x1c95cb['message']));});}; \ No newline at end of file +var _0x9bd8=['stringify','then','isNil','object','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','catch','message','util','lodash','trigger','exec','data1','toUpperCase','render','data2','data5','data6','parse','error','stack','POST','PUT','data7','body','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s'];(function(_0x324b75,_0x65704b){var _0x438f2f=function(_0x57bc49){while(--_0x57bc49){_0x324b75['push'](_0x324b75['shift']());}};_0x438f2f(++_0x65704b);}(_0x9bd8,0x10d));var _0x89bd=function(_0x2f8d56,_0x376c64){_0x2f8d56=_0x2f8d56-0x0;var _0x36081d=_0x9bd8[_0x2f8d56];return _0x36081d;};'use strict';var rp=require('request-promise');var util=require(_0x89bd('0x0'));var _=require(_0x89bd('0x1'));var Mustache=require('mustache');var logger=require('../../../../config/logger')(_0x89bd('0x2'));exports[_0x89bd('0x3')]=function(_0x1bf6d3,_0x40d6c7){var _0x4805ee,_0x28f903;var _0x37502a={'method':_0x1bf6d3[_0x89bd('0x4')][_0x89bd('0x5')](),'uri':Mustache[_0x89bd('0x6')](_0x1bf6d3[_0x89bd('0x7')],_0x40d6c7),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x1bf6d3[_0x89bd('0x8')])==='number'&&parseInt(_0x1bf6d3[_0x89bd('0x8')])>=0x1&&parseInt(_0x1bf6d3[_0x89bd('0x8')])<=0xa?parseInt(_0x1bf6d3[_0x89bd('0x8')])*0x3e8:0x5*0x3e8};try{_0x37502a['headers']=_0x1bf6d3[_0x89bd('0x9')]?JSON[_0x89bd('0xa')](Mustache[_0x89bd('0x6')](_0x1bf6d3[_0x89bd('0x9')],_0x40d6c7)):{};}catch(_0x211753){logger[_0x89bd('0xb')](_0x211753[_0x89bd('0xc')]);}switch(_0x1bf6d3[_0x89bd('0x4')][_0x89bd('0x5')]()){case'GET':case'DELETE':_0x4805ee=null;_0x37502a['qs']=_0x40d6c7;break;case _0x89bd('0xd'):case _0x89bd('0xe'):if(_0x1bf6d3[_0x89bd('0xf')]){try{_0x4805ee=JSON[_0x89bd('0xa')](Mustache['render'](_0x1bf6d3[_0x89bd('0xf')],_0x40d6c7));_0x37502a[_0x89bd('0x10')]=_0x4805ee;}catch(_0x3c6074){logger['error'](_0x3c6074[_0x89bd('0xc')]);logger['error'](_0x89bd('0x11'));}}else{_0x4805ee=_0x40d6c7;_0x37502a[_0x89bd('0x10')]=_0x4805ee;}break;}logger[_0x89bd('0x12')](util[_0x89bd('0x13')](_0x89bd('0x14'),_0x1bf6d3['data1'],_0x1bf6d3[_0x89bd('0x7')],JSON[_0x89bd('0x15')](_0x37502a)));rp(_0x37502a)[_0x89bd('0x16')](function(_0x390642){_0x4805ee=!_[_0x89bd('0x17')](_0x4805ee)?',\x20request\x20body:\x20'+_0x4805ee:'';_0x28f903=typeof _0x390642[_0x89bd('0x10')]===_0x89bd('0x18')?JSON['stringify'](_0x390642[_0x89bd('0x10')]):_0x390642[_0x89bd('0x10')];logger[_0x89bd('0x12')](util[_0x89bd('0x13')](_0x89bd('0x19'),_0x1bf6d3[_0x89bd('0x4')],_0x1bf6d3['data2'],_0x390642[_0x89bd('0x1a')],_0x28f903));})[_0x89bd('0x1b')](function(_0x3f0ffa){logger[_0x89bd('0xb')](util[_0x89bd('0x13')]('%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s',_0x1bf6d3[_0x89bd('0x4')],_0x1bf6d3[_0x89bd('0x7')],_0x3f0ffa[_0x89bd('0x1a')],_0x3f0ffa['name'],_0x3f0ffa[_0x89bd('0x1c')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index 86c8ad8..4b98c41 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 _0x744f=['rpc','message','catch','exports','jayson/promise','bluebird','../../config/logger','routing','client','http','Request','request','then','debug','error'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x744f,0xf4));var _0xf744=function(_0x3d6050,_0x36c5f2){_0x3d6050=_0x3d6050-0x0;var _0x3402a3=_0x744f[_0x3d6050];return _0x3402a3;};'use strict';var jayson=require(_0xf744('0x0'));var BPromise=require(_0xf744('0x1'));var logger=require(_0xf744('0x2'))(_0xf744('0x3'));var client=jayson[_0xf744('0x4')][_0xf744('0x5')]({'port':0x2329});client[_0xf744('0x6')]=function(_0x400cdb,_0x3ae41a){return new BPromise(function(_0x51c0ff,_0x3100f4){return client[_0xf744('0x7')](_0x400cdb,_0x3ae41a)[_0xf744('0x8')](function(_0x107852){logger[_0xf744('0x9')]('rpc',_0xf744('0x3'),_0x400cdb,_0x3ae41a,_0x107852);if(_0x107852['error']){logger[_0xf744('0xa')](_0xf744('0xb'),_0xf744('0x3'),_0x400cdb,_0x107852[_0xf744('0xa')][_0xf744('0xc')],_0x3ae41a);return _0x3100f4(_0x107852[_0xf744('0xa')]['message']);}else{return _0x51c0ff(_0x107852['result']);}})[_0xf744('0xd')](function(_0x48f03e){logger[_0xf744('0xa')](_0xf744('0xb'),_0xf744('0x3'),_0x400cdb,_0x48f03e,_0x3ae41a);return _0x3100f4(_0x48f03e);});});};module[_0xf744('0xe')]=client; \ No newline at end of file +var _0xd753=['message','result','catch','exports','jayson/promise','bluebird','http','Request','request','then','debug','rpc','routing','error'];(function(_0x4e0c31,_0x208e9f){var _0x3fd7df=function(_0x5ee817){while(--_0x5ee817){_0x4e0c31['push'](_0x4e0c31['shift']());}};_0x3fd7df(++_0x208e9f);}(_0xd753,0x154));var _0x3d75=function(_0x26df6b,_0x4c93f8){_0x26df6b=_0x26df6b-0x0;var _0x2e2959=_0xd753[_0x26df6b];return _0x2e2959;};'use strict';var jayson=require(_0x3d75('0x0'));var BPromise=require(_0x3d75('0x1'));var logger=require('../../config/logger')('routing');var client=jayson['client'][_0x3d75('0x2')]({'port':0x2329});client[_0x3d75('0x3')]=function(_0x1bb638,_0x29ee1c){return new BPromise(function(_0x593200,_0x32ad83){return client[_0x3d75('0x4')](_0x1bb638,_0x29ee1c)[_0x3d75('0x5')](function(_0x4697be){logger[_0x3d75('0x6')](_0x3d75('0x7'),_0x3d75('0x8'),_0x1bb638,_0x29ee1c,_0x4697be);if(_0x4697be[_0x3d75('0x9')]){logger[_0x3d75('0x9')]('rpc','routing',_0x1bb638,_0x4697be[_0x3d75('0x9')][_0x3d75('0xa')],_0x29ee1c);return _0x32ad83(_0x4697be[_0x3d75('0x9')]['message']);}else{return _0x593200(_0x4697be[_0x3d75('0xb')]);}})[_0x3d75('0xc')](function(_0x5bf09f){logger[_0x3d75('0x9')]('rpc','routing',_0x1bb638,_0x5bf09f,_0x29ee1c);return _0x32ad83(_0x5bf09f);});});};module[_0x3d75('0xd')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index 098ab90..ce0972f 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 _0xa8d0=['getSettings','loginMailFrequency','catch','log','./server','./realtime','./lib/email','./rpc/setting','resolve','then','getMailAccounts','initMailAccounts','mailAccounts','listen'];(function(_0x520684,_0x1f9b65){var _0x48f6b0=function(_0x2736e5){while(--_0x2736e5){_0x520684['push'](_0x520684['shift']());}};_0x48f6b0(++_0x1f9b65);}(_0xa8d0,0x11c));var _0x0a8d=function(_0x1b1b30,_0x565567){_0x1b1b30=_0x1b1b30-0x0;var _0x278955=_0xa8d0[_0x1b1b30];return _0x278955;};'use strict';var BPromise=require('bluebird');var server=require(_0x0a8d('0x0'));var Realtime=require(_0x0a8d('0x1'));var EmailChannel=require(_0x0a8d('0x2'));var mailAccount=require('./rpc/mailAccount');var setting=require(_0x0a8d('0x3'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return BPromise[_0x0a8d('0x4')]()[_0x0a8d('0x5')](mailAccount[_0x0a8d('0x6')]())['then'](realtime[_0x0a8d('0x7')]())[_0x0a8d('0x5')](function(){email['refresh'](realtime[_0x0a8d('0x8')]);return realtime;});}function main(){return server[_0x0a8d('0x9')](realtime,email)[_0x0a8d('0x5')](function(){return initRealtime();})['then'](function(){return setting[_0x0a8d('0xa')]();})['then'](function(_0x250a7a){return setInterval(initRealtime,_0x250a7a[_0x0a8d('0xb')]*0x3e8);})[_0x0a8d('0xc')](function(_0x163f81){console[_0x0a8d('0xd')](_0x163f81);});}main(); \ No newline at end of file +var _0x0764=['./lib/email','./rpc/mailAccount','resolve','then','getMailAccounts','initMailAccounts','refresh','listen','getSettings','loginMailFrequency','catch','log','bluebird','./server','./realtime'];(function(_0x314ccd,_0xb410af){var _0x27ed35=function(_0x35fd09){while(--_0x35fd09){_0x314ccd['push'](_0x314ccd['shift']());}};_0x27ed35(++_0xb410af);}(_0x0764,0x174));var _0x4076=function(_0x278765,_0x2ef0a7){_0x278765=_0x278765-0x0;var _0x5d0119=_0x0764[_0x278765];return _0x5d0119;};'use strict';var BPromise=require(_0x4076('0x0'));var server=require(_0x4076('0x1'));var Realtime=require(_0x4076('0x2'));var EmailChannel=require(_0x4076('0x3'));var mailAccount=require(_0x4076('0x4'));var setting=require('./rpc/setting');var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return BPromise[_0x4076('0x5')]()[_0x4076('0x6')](mailAccount[_0x4076('0x7')]())[_0x4076('0x6')](realtime[_0x4076('0x8')]())['then'](function(){email[_0x4076('0x9')](realtime['mailAccounts']);return realtime;});}function main(){return server[_0x4076('0xa')](realtime,email)[_0x4076('0x6')](function(){return initRealtime();})[_0x4076('0x6')](function(){return setting[_0x4076('0xb')]();})[_0x4076('0x6')](function(_0x5a8c85){return setInterval(initRealtime,_0x5a8c85[_0x4076('0xc')]*0x3e8);})[_0x4076('0xd')](function(_0x487962){console[_0x4076('0xe')](_0x487962);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index 93e4a34..b010843 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 _0x60ce=['smtp','Smtp','lastSync','verify','verified','exports','lodash','moment','md5','../../../config/environment','../../../config/logger','email','redis','defaults','socket.io-emitter','./imap','./smtp','../rpc/mailAccount','start\x20email\x20channel','imapAccounts','emit','mailAccounts','name','key','active','Imap','status','messageStatus','isNil','stringify','mailAccount:update','prototype','refresh','hasOwnProperty','box','handleImapBox','bind','handleImapEmail','end','handleImapEnd','handleImapError','disabled','connected','total','messages','info','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','from','then','Mail\x20accepted\x20from\x20routing','catch','error','Mail\x20not\x20accepted\x20from\x20routing\x20%s','sendMail'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x60ce,0x187));var _0xe60c=function(_0xe4e9dd,_0x3d3064){_0xe4e9dd=_0xe4e9dd-0x0;var _0x4012ec=_0x60ce[_0xe4e9dd];return _0x4012ec;};'use strict';var _=require(_0xe60c('0x0'));var moment=require(_0xe60c('0x1'));var BPromise=require('bluebird');var md5=require(_0xe60c('0x2'));var Redis=require('ioredis');var config=require(_0xe60c('0x3'));var logger=require(_0xe60c('0x4'))(_0xe60c('0x5'));config[_0xe60c('0x6')]=_[_0xe60c('0x7')](config[_0xe60c('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0xe60c('0x8'))(new Redis(config[_0xe60c('0x6')]));var EmailImap=require(_0xe60c('0x9'));var EmailSmtp=require(_0xe60c('0xa'));var mailAccount=require(_0xe60c('0xb'));var md5Accounts={};function EmailChannel(_0x4768f7){logger['info'](_0xe60c('0xc'));this['mailAccounts']=_0x4768f7['mailAccounts'];this[_0xe60c('0xd')]={};this['smtp']=new EmailSmtp();}EmailChannel['prototype'][_0xe60c('0xe')]=function(_0x4b8613){var _0x223077=this[_0xe60c('0xf')][_0x4b8613];var _0x55513f={'id':_0x223077['id'],'name':_0x223077[_0xe60c('0x10')],'key':_0x223077[_0xe60c('0x11')],'active':_0x223077[_0xe60c('0x12')],'Imap':{'status':_0x223077[_0xe60c('0x13')][_0xe60c('0x14')],'messageStatus':_0x223077[_0xe60c('0x13')][_0xe60c('0x15')],'total':_0x223077[_0xe60c('0x13')]['total']}};if(_[_0xe60c('0x16')](md5Accounts[_0x4b8613])){md5Accounts[_0x4b8613]={};}var _0x54bfbf=md5(JSON[_0xe60c('0x17')](_0x55513f));if(md5Accounts[_0x4b8613][_0xe60c('0x2')]!==_0x54bfbf){md5Accounts[_0x4b8613]['md5']=_0x54bfbf;io[_0xe60c('0xe')](_0xe60c('0x18'),_0x55513f);}};EmailChannel[_0xe60c('0x19')][_0xe60c('0x1a')]=function(_0x403d0c){for(var _0x429d5d in _0x403d0c){if(_0x403d0c[_0xe60c('0x1b')](_0x429d5d)){if(_0x403d0c[_0x429d5d][_0xe60c('0x13')]&&_0x403d0c[_0x429d5d][_0xe60c('0x12')]){var _0x1cf289=_0x403d0c[_0x429d5d]['Imap'];if(!this[_0xe60c('0xd')]['hasOwnProperty'](_0x1cf289['id'])){this['imapAccounts'][_0x1cf289['id']]=new EmailImap(_0x1cf289,_0x403d0c[_0x429d5d][_0xe60c('0x5')]);this[_0xe60c('0xd')][_0x1cf289['id']]['on'](_0xe60c('0x1c'),this[_0xe60c('0x1d')][_0xe60c('0x1e')](this,_0x429d5d));this[_0xe60c('0xd')][_0x1cf289['id']]['on'](_0xe60c('0x5'),this[_0xe60c('0x1f')]['bind'](this,_0x429d5d));this['imapAccounts'][_0x1cf289['id']]['on'](_0xe60c('0x20'),this[_0xe60c('0x21')][_0xe60c('0x1e')](this,_0x429d5d));this[_0xe60c('0xd')][_0x1cf289['id']]['on']('error',this[_0xe60c('0x22')][_0xe60c('0x1e')](this,_0x429d5d));}}else{if(_[_0xe60c('0x16')](this[_0xe60c('0xf')][_0x429d5d][_0xe60c('0x13')])){this[_0xe60c('0xf')][_0x429d5d][_0xe60c('0x13')]={};}this[_0xe60c('0xf')][_0x429d5d]['Imap'][_0xe60c('0x14')]=_0xe60c('0x23');this[_0xe60c('0xf')][_0x429d5d][_0xe60c('0x13')][_0xe60c('0x15')]='';this['emit'](_0x429d5d);}}}};EmailChannel['prototype'][_0xe60c('0x1d')]=function(_0x1e23db,_0x1cd9e9){if(this[_0xe60c('0xf')][_0x1e23db]){this[_0xe60c('0xf')][_0x1e23db][_0xe60c('0x13')][_0xe60c('0x14')]=_0xe60c('0x24');this[_0xe60c('0xf')][_0x1e23db][_0xe60c('0x13')][_0xe60c('0x15')]=_0x1cd9e9['name'];if(_0x1cd9e9['messages']){this['mailAccounts'][_0x1e23db][_0xe60c('0x13')][_0xe60c('0x25')]=_0x1cd9e9[_0xe60c('0x26')]['total'];}return this[_0xe60c('0xe')](_0x1e23db);}};EmailChannel[_0xe60c('0x19')][_0xe60c('0x1f')]=function(_0x9f46cc,_0x38c517){logger[_0xe60c('0x27')](_0xe60c('0x28'),_0x38c517[_0xe60c('0x29')],_0x38c517['lastName'],_0x38c517[_0xe60c('0x2a')],_0x9f46cc);if(this['mailAccounts'][_0x9f46cc]){return mailAccount['notify'](_0x9f46cc,_0x38c517)[_0xe60c('0x2b')](function(_0x2c9284){if(_0x2c9284){logger[_0xe60c('0x27')](_0xe60c('0x2c'));}})[_0xe60c('0x2d')](function(_0x4c840c){logger[_0xe60c('0x2e')](_0xe60c('0x2f'),JSON[_0xe60c('0x17')](_0x4c840c));});}};EmailChannel[_0xe60c('0x19')][_0xe60c('0x21')]=function(_0x4a784e){if(this['mailAccounts'][_0x4a784e]&&this[_0xe60c('0xf')][_0x4a784e]['Imap']){if(this[_0xe60c('0xd')][this[_0xe60c('0xf')][_0x4a784e][_0xe60c('0x13')]['id']]){delete this[_0xe60c('0xd')][this[_0xe60c('0xf')][_0x4a784e][_0xe60c('0x13')]['id']];}this[_0xe60c('0xf')][_0x4a784e][_0xe60c('0x13')]['lastSync']=moment();this[_0xe60c('0xe')](_0x4a784e);}};EmailChannel[_0xe60c('0x19')][_0xe60c('0x22')]=function(_0x309de4,_0x4c120b){if(this[_0xe60c('0xf')][_0x309de4]){this[_0xe60c('0xf')][_0x309de4]['Imap'][_0xe60c('0x14')]='error';this[_0xe60c('0xf')][_0x309de4][_0xe60c('0x13')]['messageStatus']=_0x4c120b;return this[_0xe60c('0xe')](_0x309de4);}};EmailChannel['prototype'][_0xe60c('0x30')]=function(_0x203987,_0x4e1038){return this[_0xe60c('0x31')]['send'](_0x203987,_0x4e1038);};EmailChannel[_0xe60c('0x19')]['verifySmtp']=function(_0x45d575){var _0x34cd45=this;if(this['mailAccounts'][_0x45d575['id']]){if(_['isNil'](this[_0xe60c('0xf')][_0x45d575['id']]['Smtp'])){this['mailAccounts'][_0x45d575['id']]['Smtp']={};}this['mailAccounts'][_0x45d575['id']][_0xe60c('0x32')][_0xe60c('0x33')]=moment();return new BPromise(function(_0x4e604f,_0x5bedf2){return _0x34cd45[_0xe60c('0x31')][_0xe60c('0x34')](_0x45d575)[_0xe60c('0x2b')](function(_0x46446a){_0x34cd45[_0xe60c('0xf')][_0x45d575['id']][_0xe60c('0x32')][_0xe60c('0x14')]=_0xe60c('0x35');_0x34cd45[_0xe60c('0xf')][_0x45d575['id']][_0xe60c('0x32')][_0xe60c('0x15')]='';_0x34cd45[_0xe60c('0xe')](_0x45d575['id']);_0x4e604f(_0x46446a);})[_0xe60c('0x2d')](function(_0x184c9){_0x34cd45[_0xe60c('0xf')][_0x45d575['id']][_0xe60c('0x32')][_0xe60c('0x14')]='error';_0x34cd45[_0xe60c('0xf')][_0x45d575['id']]['Smtp'][_0xe60c('0x15')]=_0x184c9;_0x34cd45[_0xe60c('0xe')](_0x45d575['id']);_0x5bedf2(_0x184c9);});});}return this[_0xe60c('0x31')][_0xe60c('0x34')](_0x45d575);};module[_0xe60c('0x36')]=EmailChannel; \ No newline at end of file +var _0x1fdf=['from','notify','Mail\x20accepted\x20from\x20routing','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','send','verifySmtp','Smtp','verify','then','verified','exports','bluebird','md5','ioredis','../../../config/environment','../../../config/logger','redis','defaults','localhost','socket.io-emitter','./smtp','../rpc/mailAccount','info','start\x20email\x20channel','mailAccounts','smtp','emit','name','key','active','Imap','status','isNil','stringify','mailAccount:update','prototype','refresh','hasOwnProperty','imapAccounts','email','handleImapBox','bind','handleImapEmail','end','handleImapEnd','error','handleImapError','messageStatus','total','messages','firstName','lastName'];(function(_0x1085c5,_0x502ffa){var _0x1a1f8c=function(_0x174f66){while(--_0x174f66){_0x1085c5['push'](_0x1085c5['shift']());}};_0x1a1f8c(++_0x502ffa);}(_0x1fdf,0x187));var _0xf1fd=function(_0x39106e,_0x586f3d){_0x39106e=_0x39106e-0x0;var _0x892aec=_0x1fdf[_0x39106e];return _0x892aec;};'use strict';var _=require('lodash');var moment=require('moment');var BPromise=require(_0xf1fd('0x0'));var md5=require(_0xf1fd('0x1'));var Redis=require(_0xf1fd('0x2'));var config=require(_0xf1fd('0x3'));var logger=require(_0xf1fd('0x4'))('email');config[_0xf1fd('0x5')]=_[_0xf1fd('0x6')](config[_0xf1fd('0x5')],{'host':_0xf1fd('0x7'),'port':0x18eb});var io=require(_0xf1fd('0x8'))(new Redis(config[_0xf1fd('0x5')]));var EmailImap=require('./imap');var EmailSmtp=require(_0xf1fd('0x9'));var mailAccount=require(_0xf1fd('0xa'));var md5Accounts={};function EmailChannel(_0xf37945){logger[_0xf1fd('0xb')](_0xf1fd('0xc'));this[_0xf1fd('0xd')]=_0xf37945[_0xf1fd('0xd')];this['imapAccounts']={};this[_0xf1fd('0xe')]=new EmailSmtp();}EmailChannel['prototype'][_0xf1fd('0xf')]=function(_0x3a0803){var _0x349213=this[_0xf1fd('0xd')][_0x3a0803];var _0x5564d3={'id':_0x349213['id'],'name':_0x349213[_0xf1fd('0x10')],'key':_0x349213[_0xf1fd('0x11')],'active':_0x349213[_0xf1fd('0x12')],'Imap':{'status':_0x349213[_0xf1fd('0x13')][_0xf1fd('0x14')],'messageStatus':_0x349213[_0xf1fd('0x13')]['messageStatus'],'total':_0x349213[_0xf1fd('0x13')]['total']}};if(_[_0xf1fd('0x15')](md5Accounts[_0x3a0803])){md5Accounts[_0x3a0803]={};}var _0x5eb160=md5(JSON[_0xf1fd('0x16')](_0x5564d3));if(md5Accounts[_0x3a0803][_0xf1fd('0x1')]!==_0x5eb160){md5Accounts[_0x3a0803][_0xf1fd('0x1')]=_0x5eb160;io[_0xf1fd('0xf')](_0xf1fd('0x17'),_0x5564d3);}};EmailChannel[_0xf1fd('0x18')][_0xf1fd('0x19')]=function(_0x4c2273){for(var _0x22d558 in _0x4c2273){if(_0x4c2273[_0xf1fd('0x1a')](_0x22d558)){if(_0x4c2273[_0x22d558][_0xf1fd('0x13')]&&_0x4c2273[_0x22d558][_0xf1fd('0x12')]){var _0x4d020d=_0x4c2273[_0x22d558][_0xf1fd('0x13')];if(!this[_0xf1fd('0x1b')][_0xf1fd('0x1a')](_0x4d020d['id'])){this[_0xf1fd('0x1b')][_0x4d020d['id']]=new EmailImap(_0x4d020d,_0x4c2273[_0x22d558][_0xf1fd('0x1c')]);this[_0xf1fd('0x1b')][_0x4d020d['id']]['on']('box',this[_0xf1fd('0x1d')][_0xf1fd('0x1e')](this,_0x22d558));this[_0xf1fd('0x1b')][_0x4d020d['id']]['on'](_0xf1fd('0x1c'),this[_0xf1fd('0x1f')][_0xf1fd('0x1e')](this,_0x22d558));this[_0xf1fd('0x1b')][_0x4d020d['id']]['on'](_0xf1fd('0x20'),this[_0xf1fd('0x21')][_0xf1fd('0x1e')](this,_0x22d558));this[_0xf1fd('0x1b')][_0x4d020d['id']]['on'](_0xf1fd('0x22'),this[_0xf1fd('0x23')]['bind'](this,_0x22d558));}}else{if(_[_0xf1fd('0x15')](this[_0xf1fd('0xd')][_0x22d558][_0xf1fd('0x13')])){this[_0xf1fd('0xd')][_0x22d558][_0xf1fd('0x13')]={};}this[_0xf1fd('0xd')][_0x22d558][_0xf1fd('0x13')]['status']='disabled';this[_0xf1fd('0xd')][_0x22d558][_0xf1fd('0x13')][_0xf1fd('0x24')]='';this[_0xf1fd('0xf')](_0x22d558);}}}};EmailChannel[_0xf1fd('0x18')][_0xf1fd('0x1d')]=function(_0xa8fb7b,_0x366ba8){if(this['mailAccounts'][_0xa8fb7b]){this['mailAccounts'][_0xa8fb7b][_0xf1fd('0x13')][_0xf1fd('0x14')]='connected';this[_0xf1fd('0xd')][_0xa8fb7b]['Imap'][_0xf1fd('0x24')]=_0x366ba8[_0xf1fd('0x10')];if(_0x366ba8['messages']){this[_0xf1fd('0xd')][_0xa8fb7b][_0xf1fd('0x13')][_0xf1fd('0x25')]=_0x366ba8[_0xf1fd('0x26')][_0xf1fd('0x25')];}return this[_0xf1fd('0xf')](_0xa8fb7b);}};EmailChannel['prototype'][_0xf1fd('0x1f')]=function(_0x98f1f7,_0x2c9a94){logger[_0xf1fd('0xb')]('New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s',_0x2c9a94[_0xf1fd('0x27')],_0x2c9a94[_0xf1fd('0x28')],_0x2c9a94[_0xf1fd('0x29')],_0x98f1f7);if(this[_0xf1fd('0xd')][_0x98f1f7]){return mailAccount[_0xf1fd('0x2a')](_0x98f1f7,_0x2c9a94)['then'](function(_0xa61ac8){if(_0xa61ac8){logger[_0xf1fd('0xb')](_0xf1fd('0x2b'));}})[_0xf1fd('0x2c')](function(_0x323d8a){logger['error'](_0xf1fd('0x2d'),JSON[_0xf1fd('0x16')](_0x323d8a));});}};EmailChannel[_0xf1fd('0x18')]['handleImapEnd']=function(_0x30c4e){if(this[_0xf1fd('0xd')][_0x30c4e]&&this['mailAccounts'][_0x30c4e][_0xf1fd('0x13')]){if(this[_0xf1fd('0x1b')][this[_0xf1fd('0xd')][_0x30c4e][_0xf1fd('0x13')]['id']]){delete this[_0xf1fd('0x1b')][this[_0xf1fd('0xd')][_0x30c4e][_0xf1fd('0x13')]['id']];}this[_0xf1fd('0xd')][_0x30c4e][_0xf1fd('0x13')][_0xf1fd('0x2e')]=moment();this[_0xf1fd('0xf')](_0x30c4e);}};EmailChannel[_0xf1fd('0x18')]['handleImapError']=function(_0x1d782b,_0xcc4aaa){if(this['mailAccounts'][_0x1d782b]){this['mailAccounts'][_0x1d782b][_0xf1fd('0x13')][_0xf1fd('0x14')]=_0xf1fd('0x22');this['mailAccounts'][_0x1d782b][_0xf1fd('0x13')][_0xf1fd('0x24')]=_0xcc4aaa;return this[_0xf1fd('0xf')](_0x1d782b);}};EmailChannel[_0xf1fd('0x18')]['sendMail']=function(_0x4ef726,_0x5b8a5e){return this['smtp'][_0xf1fd('0x2f')](_0x4ef726,_0x5b8a5e);};EmailChannel['prototype'][_0xf1fd('0x30')]=function(_0x2c98f8){var _0x55b066=this;if(this['mailAccounts'][_0x2c98f8['id']]){if(_['isNil'](this[_0xf1fd('0xd')][_0x2c98f8['id']][_0xf1fd('0x31')])){this[_0xf1fd('0xd')][_0x2c98f8['id']]['Smtp']={};}this['mailAccounts'][_0x2c98f8['id']][_0xf1fd('0x31')][_0xf1fd('0x2e')]=moment();return new BPromise(function(_0x4c2515,_0x213703){return _0x55b066[_0xf1fd('0xe')][_0xf1fd('0x32')](_0x2c98f8)[_0xf1fd('0x33')](function(_0x3c0e0d){_0x55b066[_0xf1fd('0xd')][_0x2c98f8['id']][_0xf1fd('0x31')][_0xf1fd('0x14')]=_0xf1fd('0x34');_0x55b066[_0xf1fd('0xd')][_0x2c98f8['id']]['Smtp'][_0xf1fd('0x24')]='';_0x55b066[_0xf1fd('0xf')](_0x2c98f8['id']);_0x4c2515(_0x3c0e0d);})[_0xf1fd('0x2c')](function(_0x4473fb){_0x55b066[_0xf1fd('0xd')][_0x2c98f8['id']]['Smtp'][_0xf1fd('0x14')]=_0xf1fd('0x22');_0x55b066['mailAccounts'][_0x2c98f8['id']][_0xf1fd('0x31')][_0xf1fd('0x24')]=_0x4473fb;_0x55b066['emit'](_0x2c98f8['id']);_0x213703(_0x4473fb);});});}return this[_0xf1fd('0xe')]['verify'](_0x2c98f8);};module[_0xf1fd('0x35')]=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index a9d8188..8bc689c 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 _0x8d0e=['end','handleEnd','bind','handleError','connect','connTimeout','authTimeout','service','authentication','user','host','port','tls','autotls','password','getHost','prototype','handleReady','openBox','handleOpenBox','emit','box','handleCloseBox','readUnseen','search','UNSEEN','handleReadUnseen','length','message','error','handleFetchError','handleFetchEnd','closeBox','handleFetchMessage','handleMessageBody','attributes','handleMessageAttributes','handleMessageEnd','handleSimpleParser','parser','stringify','textCode','hasOwnProperty','exports','path','util','imap','lodash','randomstring','mailparser','simpleParser','iconv','Iconv','EventEmitter','email','mailbox','INBOX','account','getAccount','once','ready'];(function(_0x8af54b,_0x280be5){var _0x27d8f0=function(_0x559734){while(--_0x559734){_0x8af54b['push'](_0x8af54b['shift']());}};_0x27d8f0(++_0x280be5);}(_0x8d0e,0x1d7));var _0xe8d0=function(_0x53c1b3,_0x3eecdf){_0x53c1b3=_0x53c1b3-0x0;var _0x3f8979=_0x8d0e[_0x53c1b3];return _0x3f8979;};'use strict';var fs=require('fs');var path=require(_0xe8d0('0x0'));var util=require(_0xe8d0('0x1'));var Imap=require(_0xe8d0('0x2'));var _=require(_0xe8d0('0x3'));var rs=require(_0xe8d0('0x4'));var simpleParser=require(_0xe8d0('0x5'))[_0xe8d0('0x6')];var Iconv=require(_0xe8d0('0x7'))[_0xe8d0('0x8')];var EventEmitter=require('events')[_0xe8d0('0x9')];var utils=require('./utils');var logger=require('../../../config/logger')(_0xe8d0('0xa'));function EmailImap(_0x92483d,_0x469d37){this[_0xe8d0('0xb')]=_0xe8d0('0xc');this[_0xe8d0('0xd')]=this[_0xe8d0('0xe')](_0x92483d,_0x469d37);this[_0xe8d0('0x2')]=new Imap(this['account']);this[_0xe8d0('0x2')][_0xe8d0('0xf')](_0xe8d0('0x10'),this['handleReady']['bind'](this));this[_0xe8d0('0x2')][_0xe8d0('0xf')](_0xe8d0('0x11'),this[_0xe8d0('0x12')][_0xe8d0('0x13')](this));this[_0xe8d0('0x2')]['on']('error',this[_0xe8d0('0x14')][_0xe8d0('0x13')](this));this['imap'][_0xe8d0('0x15')]();}util['inherits'](EmailImap,EventEmitter);EmailImap['prototype'][_0xe8d0('0xe')]=function(_0x2aa906,_0x1aa725){var _0x291b49={'connTimeout':_0x2aa906[_0xe8d0('0x16')]?_0x2aa906[_0xe8d0('0x16')]*0x3e8:0x2710,'authTimeout':_0x2aa906['authTimeout']?_0x2aa906[_0xe8d0('0x17')]*0x3e8:0x1388};if(_['isNil'](_0x2aa906[_0xe8d0('0x18')])){if(_0x2aa906[_0xe8d0('0x19')]){_0x291b49[_0xe8d0('0x1a')]=_0x2aa906['user'];_0x291b49['password']=_0x2aa906['password'];}_0x291b49[_0xe8d0('0x1b')]=_0x2aa906[_0xe8d0('0x1b')];_0x291b49[_0xe8d0('0x1c')]=_0x2aa906[_0xe8d0('0x1c')]||0x3e1;if(_0x2aa906[_0xe8d0('0x1d')]){_0x291b49['tls']=!![];}else{_0x291b49[_0xe8d0('0x1d')]=![];_0x291b49[_0xe8d0('0x1e')]='required';}}else{_0x291b49['user']=_0x2aa906['user'];_0x291b49[_0xe8d0('0x1f')]=_0x2aa906[_0xe8d0('0x1f')];_0x291b49[_0xe8d0('0x1b')]=utils[_0xe8d0('0x20')](_0x2aa906[_0xe8d0('0x18')]);_0x291b49[_0xe8d0('0x1c')]=0x3e1;_0x291b49[_0xe8d0('0x1d')]=!![];}_0x291b49[_0xe8d0('0xa')]=_0x1aa725||_0x2aa906[_0xe8d0('0x1a')]||'anonymous@xcally.com';return _0x291b49;};EmailImap[_0xe8d0('0x21')][_0xe8d0('0x22')]=function(){this['imap'][_0xe8d0('0x23')](this[_0xe8d0('0xb')],![],this[_0xe8d0('0x24')][_0xe8d0('0x13')](this));};EmailImap[_0xe8d0('0x21')][_0xe8d0('0x24')]=function(_0x31519b,_0x32f0c1){if(_0x31519b){this[_0xe8d0('0x14')](_0x31519b,!![]);}else{this[_0xe8d0('0x25')](_0xe8d0('0x26'),_0x32f0c1);this['readUnseen']();}};EmailImap[_0xe8d0('0x21')][_0xe8d0('0x27')]=function(_0x10dec2){if(_0x10dec2){this['handleError'](_0x10dec2,!![]);}else{this[_0xe8d0('0x2')][_0xe8d0('0x11')]();}};EmailImap['prototype'][_0xe8d0('0x28')]=function(){this[_0xe8d0('0x2')][_0xe8d0('0x29')]([_0xe8d0('0x2a')],this[_0xe8d0('0x2b')]['bind'](this));};EmailImap[_0xe8d0('0x21')]['handleReadUnseen']=function(_0x5d3276,_0x50ad3c){if(_0x5d3276){this[_0xe8d0('0x14')](_0x5d3276,!![]);}else{if(_0x50ad3c[_0xe8d0('0x2c')]){try{var _0x36ccec=this['imap']['fetch'](_0x50ad3c,{'bodies':'','markSeen':!![]});_0x36ccec['on'](_0xe8d0('0x2d'),this['handleFetchMessage'][_0xe8d0('0x13')](this));_0x36ccec[_0xe8d0('0xf')](_0xe8d0('0x2e'),this[_0xe8d0('0x2f')][_0xe8d0('0x13')](this));_0x36ccec['once'](_0xe8d0('0x11'),this[_0xe8d0('0x30')][_0xe8d0('0x13')](this));}catch(_0x145ddb){logger['error'](_0x145ddb);}}else{this[_0xe8d0('0x2')][_0xe8d0('0x31')](!![],this['handleCloseBox'][_0xe8d0('0x13')](this));}}};EmailImap['prototype'][_0xe8d0('0x32')]=function(_0x5dc4ca,_0x197e01){_0x5dc4ca['on']('body',this[_0xe8d0('0x33')][_0xe8d0('0x13')](this));_0x5dc4ca[_0xe8d0('0xf')](_0xe8d0('0x34'),this['handleMessageAttributes'][_0xe8d0('0x13')](this));_0x5dc4ca[_0xe8d0('0xf')](_0xe8d0('0x11'),this['handleMessageEnd'][_0xe8d0('0x13')](this));};EmailImap[_0xe8d0('0x21')][_0xe8d0('0x33')]=function(_0x9cb99b,_0x1ecd41){simpleParser(_0x9cb99b,{'Iconv':Iconv},this['handleSimpleParser'][_0xe8d0('0x13')](this));};EmailImap[_0xe8d0('0x21')][_0xe8d0('0x35')]=function(_0x3d76d5){};EmailImap[_0xe8d0('0x21')][_0xe8d0('0x36')]=function(){};EmailImap[_0xe8d0('0x21')][_0xe8d0('0x37')]=function(_0x4edb3d,_0x5dff14){if(_0x4edb3d){logger[_0xe8d0('0x2e')](_0x4edb3d);}else{var _0x1248cb=this;utils[_0xe8d0('0x38')](this[_0xe8d0('0xd')],_0x5dff14,function(_0x36f9ee){_0x1248cb['emit'](_0xe8d0('0xa'),_0x36f9ee);});}};EmailImap['prototype'][_0xe8d0('0x30')]=function(){this[_0xe8d0('0x2')][_0xe8d0('0x31')](!![],this['handleCloseBox'][_0xe8d0('0x13')](this));};EmailImap[_0xe8d0('0x21')][_0xe8d0('0x2f')]=function(_0x230a90){this[_0xe8d0('0x14')](_0x230a90);this['imap']['closeBox'](!![],this['handleCloseBox']['bind'](this));};EmailImap[_0xe8d0('0x21')]['handleEnd']=function(){this[_0xe8d0('0x25')](_0xe8d0('0x11'));};EmailImap[_0xe8d0('0x21')][_0xe8d0('0x14')]=function(_0x2fd21e,_0x1156da){logger[_0xe8d0('0x2e')](_0xe8d0('0x14'),this['account'][_0xe8d0('0xa')],JSON[_0xe8d0('0x39')](_0x2fd21e));var _0x4a3740='';if(_0x2fd21e){if(_0x2fd21e['textCode']){_0x4a3740=_0x2fd21e[_0xe8d0('0x3a')];}else{for(var _0x18a478 in _0x2fd21e){if(_0x2fd21e[_0xe8d0('0x3b')](_0x18a478)){_0x4a3740+=_['upperFirst'](_0x18a478)+':\x20'+_0x2fd21e[_0x18a478]+'\x0a';}}}}if(_0x1156da){this[_0xe8d0('0x2')][_0xe8d0('0x11')]();}else{this['emit'](_0xe8d0('0x2e'),_0x4a3740);this[_0xe8d0('0x25')]('end');}};module[_0xe8d0('0x3c')]=EmailImap; \ No newline at end of file +var _0xe181=['handleError','inherits','getAccount','connTimeout','authTimeout','isNil','service','authentication','user','password','host','port','tls','autotls','required','getHost','anonymous@xcally.com','prototype','openBox','handleOpenBox','emit','box','readUnseen','handleCloseBox','search','UNSEEN','handleReadUnseen','length','fetch','handleFetchMessage','handleFetchError','closeBox','body','handleMessageBody','attributes','handleMessageAttributes','handleMessageEnd','handleSimpleParser','parser','textCode','upperFirst','exports','path','imap','lodash','randomstring','mailparser','simpleParser','iconv','Iconv','EventEmitter','email','mailbox','INBOX','account','once','ready','handleReady','end','handleEnd','bind','error'];(function(_0x12eb12,_0x4fa4ea){var _0x22f83f=function(_0xcc17f2){while(--_0xcc17f2){_0x12eb12['push'](_0x12eb12['shift']());}};_0x22f83f(++_0x4fa4ea);}(_0xe181,0x68));var _0x1e18=function(_0x5a2065,_0x19c4fb){_0x5a2065=_0x5a2065-0x0;var _0x218567=_0xe181[_0x5a2065];return _0x218567;};'use strict';var fs=require('fs');var path=require(_0x1e18('0x0'));var util=require('util');var Imap=require(_0x1e18('0x1'));var _=require(_0x1e18('0x2'));var rs=require(_0x1e18('0x3'));var simpleParser=require(_0x1e18('0x4'))[_0x1e18('0x5')];var Iconv=require(_0x1e18('0x6'))[_0x1e18('0x7')];var EventEmitter=require('events')[_0x1e18('0x8')];var utils=require('./utils');var logger=require('../../../config/logger')(_0x1e18('0x9'));function EmailImap(_0x182c98,_0x46ba95){this[_0x1e18('0xa')]=_0x1e18('0xb');this[_0x1e18('0xc')]=this['getAccount'](_0x182c98,_0x46ba95);this[_0x1e18('0x1')]=new Imap(this[_0x1e18('0xc')]);this[_0x1e18('0x1')][_0x1e18('0xd')](_0x1e18('0xe'),this[_0x1e18('0xf')]['bind'](this));this[_0x1e18('0x1')][_0x1e18('0xd')](_0x1e18('0x10'),this[_0x1e18('0x11')][_0x1e18('0x12')](this));this[_0x1e18('0x1')]['on'](_0x1e18('0x13'),this[_0x1e18('0x14')]['bind'](this));this[_0x1e18('0x1')]['connect']();}util[_0x1e18('0x15')](EmailImap,EventEmitter);EmailImap['prototype'][_0x1e18('0x16')]=function(_0x36b583,_0x162744){var _0x2f1265={'connTimeout':_0x36b583[_0x1e18('0x17')]?_0x36b583[_0x1e18('0x17')]*0x3e8:0x2710,'authTimeout':_0x36b583[_0x1e18('0x18')]?_0x36b583[_0x1e18('0x18')]*0x3e8:0x1388};if(_[_0x1e18('0x19')](_0x36b583[_0x1e18('0x1a')])){if(_0x36b583[_0x1e18('0x1b')]){_0x2f1265[_0x1e18('0x1c')]=_0x36b583[_0x1e18('0x1c')];_0x2f1265[_0x1e18('0x1d')]=_0x36b583[_0x1e18('0x1d')];}_0x2f1265['host']=_0x36b583[_0x1e18('0x1e')];_0x2f1265[_0x1e18('0x1f')]=_0x36b583[_0x1e18('0x1f')]||0x3e1;if(_0x36b583[_0x1e18('0x20')]){_0x2f1265[_0x1e18('0x20')]=!![];}else{_0x2f1265[_0x1e18('0x20')]=![];_0x2f1265[_0x1e18('0x21')]=_0x1e18('0x22');}}else{_0x2f1265[_0x1e18('0x1c')]=_0x36b583[_0x1e18('0x1c')];_0x2f1265[_0x1e18('0x1d')]=_0x36b583[_0x1e18('0x1d')];_0x2f1265[_0x1e18('0x1e')]=utils[_0x1e18('0x23')](_0x36b583[_0x1e18('0x1a')]);_0x2f1265[_0x1e18('0x1f')]=0x3e1;_0x2f1265[_0x1e18('0x20')]=!![];}_0x2f1265['email']=_0x162744||_0x36b583[_0x1e18('0x1c')]||_0x1e18('0x24');return _0x2f1265;};EmailImap[_0x1e18('0x25')]['handleReady']=function(){this[_0x1e18('0x1')][_0x1e18('0x26')](this[_0x1e18('0xa')],![],this[_0x1e18('0x27')]['bind'](this));};EmailImap['prototype'][_0x1e18('0x27')]=function(_0x53f9d7,_0x5bb03c){if(_0x53f9d7){this['handleError'](_0x53f9d7,!![]);}else{this[_0x1e18('0x28')](_0x1e18('0x29'),_0x5bb03c);this[_0x1e18('0x2a')]();}};EmailImap[_0x1e18('0x25')][_0x1e18('0x2b')]=function(_0x38fca8){if(_0x38fca8){this[_0x1e18('0x14')](_0x38fca8,!![]);}else{this[_0x1e18('0x1')][_0x1e18('0x10')]();}};EmailImap[_0x1e18('0x25')][_0x1e18('0x2a')]=function(){this[_0x1e18('0x1')][_0x1e18('0x2c')]([_0x1e18('0x2d')],this['handleReadUnseen'][_0x1e18('0x12')](this));};EmailImap['prototype'][_0x1e18('0x2e')]=function(_0x1baf4f,_0x1f75cd){if(_0x1baf4f){this[_0x1e18('0x14')](_0x1baf4f,!![]);}else{if(_0x1f75cd[_0x1e18('0x2f')]){try{var _0x93dd11=this[_0x1e18('0x1')][_0x1e18('0x30')](_0x1f75cd,{'bodies':'','markSeen':!![]});_0x93dd11['on']('message',this[_0x1e18('0x31')][_0x1e18('0x12')](this));_0x93dd11['once'](_0x1e18('0x13'),this[_0x1e18('0x32')][_0x1e18('0x12')](this));_0x93dd11['once'](_0x1e18('0x10'),this['handleFetchEnd']['bind'](this));}catch(_0x5ad10d){logger[_0x1e18('0x13')](_0x5ad10d);}}else{this['imap'][_0x1e18('0x33')](!![],this[_0x1e18('0x2b')][_0x1e18('0x12')](this));}}};EmailImap['prototype']['handleFetchMessage']=function(_0x2dd8ad,_0x3a7779){_0x2dd8ad['on'](_0x1e18('0x34'),this[_0x1e18('0x35')][_0x1e18('0x12')](this));_0x2dd8ad[_0x1e18('0xd')](_0x1e18('0x36'),this[_0x1e18('0x37')][_0x1e18('0x12')](this));_0x2dd8ad[_0x1e18('0xd')](_0x1e18('0x10'),this[_0x1e18('0x38')]['bind'](this));};EmailImap['prototype'][_0x1e18('0x35')]=function(_0x267213,_0x34dfe4){simpleParser(_0x267213,{'Iconv':Iconv},this['handleSimpleParser'][_0x1e18('0x12')](this));};EmailImap['prototype'][_0x1e18('0x37')]=function(_0x58c7bd){};EmailImap['prototype'][_0x1e18('0x38')]=function(){};EmailImap[_0x1e18('0x25')][_0x1e18('0x39')]=function(_0x206b44,_0x248485){if(_0x206b44){logger[_0x1e18('0x13')](_0x206b44);}else{var _0x4e2ca3=this;utils[_0x1e18('0x3a')](this[_0x1e18('0xc')],_0x248485,function(_0x395868){_0x4e2ca3[_0x1e18('0x28')]('email',_0x395868);});}};EmailImap[_0x1e18('0x25')]['handleFetchEnd']=function(){this[_0x1e18('0x1')][_0x1e18('0x33')](!![],this['handleCloseBox'][_0x1e18('0x12')](this));};EmailImap[_0x1e18('0x25')]['handleFetchError']=function(_0x57d0a9){this['handleError'](_0x57d0a9);this[_0x1e18('0x1')][_0x1e18('0x33')](!![],this[_0x1e18('0x2b')][_0x1e18('0x12')](this));};EmailImap[_0x1e18('0x25')][_0x1e18('0x11')]=function(){this[_0x1e18('0x28')](_0x1e18('0x10'));};EmailImap[_0x1e18('0x25')][_0x1e18('0x14')]=function(_0x16ee40,_0x4821f9){logger[_0x1e18('0x13')]('handleError',this[_0x1e18('0xc')][_0x1e18('0x9')],JSON['stringify'](_0x16ee40));var _0x4ad2ba='';if(_0x16ee40){if(_0x16ee40['textCode']){_0x4ad2ba=_0x16ee40[_0x1e18('0x3b')];}else{for(var _0x20dcab in _0x16ee40){if(_0x16ee40['hasOwnProperty'](_0x20dcab)){_0x4ad2ba+=_[_0x1e18('0x3c')](_0x20dcab)+':\x20'+_0x16ee40[_0x20dcab]+'\x0a';}}}}if(_0x4821f9){this[_0x1e18('0x1')]['end']();}else{this['emit'](_0x1e18('0x13'),_0x4ad2ba);this[_0x1e18('0x28')](_0x1e18('0x10'));}};module[_0x1e18('0x3d')]=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index cc5cb2b..e375a1e 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 _0x73bd=['createTransport','use','compile','sendMail','toString','prototype','verify','Not\x20verifired','exports','nodemailer','bluebird','send'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x73bd,0xf9));var _0xd73b=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x73bd[_0x17d9e3];return _0x14192d;};'use strict';var nodemailer=require(_0xd73b('0x0'));var BPromise=require(_0xd73b('0x1'));var inlineBase64=require('nodemailer-plugin-inline-base64');function EmailSmtp(){}EmailSmtp['prototype'][_0xd73b('0x2')]=function(_0x2a8519,_0x189548){return new BPromise(function(_0x145a5d,_0x355152){var _0x390479=nodemailer[_0xd73b('0x3')](_0x2a8519);_0x390479[_0xd73b('0x4')](_0xd73b('0x5'),inlineBase64());_0x390479[_0xd73b('0x6')](_0x189548,function(_0x558fe6,_0x27f930){if(_0x558fe6){_0x355152(_0x558fe6[_0xd73b('0x7')]());}else{_0x145a5d(_0x27f930);}});});};EmailSmtp[_0xd73b('0x8')][_0xd73b('0x9')]=function(_0xba9251){return new BPromise(function(_0x492fb6,_0x53b9a7){var _0x1119f5=nodemailer['createTransport'](_0xba9251);_0x1119f5['verify'](function(_0x44605a,_0x95db15){if(_0x44605a){_0x53b9a7(_0x44605a[_0xd73b('0x7')]());}else{if(_0x95db15){_0x492fb6(_0x95db15);}else{_0x53b9a7(_0xd73b('0xa'));}}});});};module[_0xd73b('0xb')]=EmailSmtp; \ No newline at end of file +var _0x1323=['toString','Not\x20verifired','exports','nodemailer','bluebird','nodemailer-plugin-inline-base64','prototype','send','createTransport','verify'];(function(_0x353974,_0x24b06c){var _0x5aa851=function(_0x5ccc3a){while(--_0x5ccc3a){_0x353974['push'](_0x353974['shift']());}};_0x5aa851(++_0x24b06c);}(_0x1323,0x189));var _0x3132=function(_0x57e975,_0x3a01bc){_0x57e975=_0x57e975-0x0;var _0x2302a6=_0x1323[_0x57e975];return _0x2302a6;};'use strict';var nodemailer=require(_0x3132('0x0'));var BPromise=require(_0x3132('0x1'));var inlineBase64=require(_0x3132('0x2'));function EmailSmtp(){}EmailSmtp[_0x3132('0x3')][_0x3132('0x4')]=function(_0x7501d4,_0x25fe69){return new BPromise(function(_0x50585c,_0x2b2958){var _0x68cfaf=nodemailer[_0x3132('0x5')](_0x7501d4);_0x68cfaf['use']('compile',inlineBase64());_0x68cfaf['sendMail'](_0x25fe69,function(_0x60f6f0,_0x52356d){if(_0x60f6f0){_0x2b2958(_0x60f6f0['toString']());}else{_0x50585c(_0x52356d);}});});};EmailSmtp['prototype'][_0x3132('0x6')]=function(_0xf47e1e){return new BPromise(function(_0x3c78c4,_0x55a9b8){var _0x3a7575=nodemailer[_0x3132('0x5')](_0xf47e1e);_0x3a7575[_0x3132('0x6')](function(_0x1f6a98,_0x358d91){if(_0x1f6a98){_0x55a9b8(_0x1f6a98[_0x3132('0x7')]());}else{if(_0x358d91){_0x3c78c4(_0x358d91);}else{_0x55a9b8(_0x3132('0x8'));}}});});};module[_0x3132('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 c85c7b2..249768d 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 _0x5f66=['outlook.office365.com','127.0.0.1','moment','path','util','node-tnef','../../../config/logger','email','head','value','anonymous','generate','@xcally.com','name','split','length','join','pop','isEmpty','address','html','test','replace','\x20[Attachment:\x20','body','Empty\x20message

','Attachments','Title','Data','getHost','gmail','imap.gmail.com','imap.mail.yahoo.com','imap-mail.outlook.com','outlook365'];(function(_0x47643e,_0x337374){var _0x2aa5db=function(_0x5dcbf2){while(--_0x5dcbf2){_0x47643e['push'](_0x47643e['shift']());}};_0x2aa5db(++_0x337374);}(_0x5f66,0x1a0));var _0x65f6=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0x5f66[_0x580576];return _0x3f55a0;};'use strict';var _=require('lodash');var moment=require(_0x65f6('0x0'));var random=require('randomstring');var fs=require('fs');var path=require(_0x65f6('0x1'));var util=require(_0x65f6('0x2'));var tnef=require(_0x65f6('0x3'));var logger=require(_0x65f6('0x4'))(_0x65f6('0x5'));var config=require('../../../config/environment');function getAddress(_0x3c5029){var _0x5150c8=_[_0x65f6('0x6')](_0x3c5029[_0x65f6('0x7')]);return _0x5150c8&&_0x5150c8['address']?_0x5150c8['address']:_0x65f6('0x8')+random[_0x65f6('0x9')](0x6)+_0x65f6('0xa');}function getFirstName(_0x8f6451){var _0xc44c70=_[_0x65f6('0x6')](_0x8f6451['value']);if(_0xc44c70&&_0xc44c70['name']){var _0x18fea1=_0xc44c70[_0x65f6('0xb')][_0x65f6('0xc')](/\s+/);return _0x18fea1[_0x65f6('0xd')]?_0x18fea1['slice'](0x0,-0x1)[_0x65f6('0xe')]('\x20'):_0xc44c70['name'];}return'Anonymous';}function getLastName(_0x2d2dfa){var _0x576875=_[_0x65f6('0x6')](_0x2d2dfa['value']);if(_0x576875&&_0x576875[_0x65f6('0xb')]){var _0x186a6a=_0x576875[_0x65f6('0xb')][_0x65f6('0xc')](/\s+/);return _0x186a6a[_0x65f6('0xd')]>0x1?_0x186a6a[_0x65f6('0xf')]():'';}return'';}function getMails(_0x44144b,_0xb1d40a){var _0x46dbc6='';for(var _0x3440af=0x0;_0x3440af<_0xb1d40a['value'][_0x65f6('0xd')];_0x3440af+=0x1){if(_0xb1d40a['value'][_0x3440af]['address']!==_0x44144b){if(!_[_0x65f6('0x10')](_0x46dbc6)){_0x46dbc6+=',';}_0x46dbc6+=_0xb1d40a[_0x65f6('0x7')][_0x3440af][_0x65f6('0xb')]||_0xb1d40a[_0x65f6('0x7')][_0x3440af][_0x65f6('0x11')]||'';_0x46dbc6+='\x20<';_0x46dbc6+=_0xb1d40a[_0x65f6('0x7')][_0x3440af][_0x65f6('0x11')]?_0xb1d40a[_0x65f6('0x7')][_0x3440af]['address']:'anonymous'+random[_0x65f6('0x9')](0x6)+'@xcally.com';_0x46dbc6+='>';}}return _0x46dbc6;}function parseEmail(_0x4c81f3,_0x5c5b91,_0x365159){if(_0x5c5b91[_0x65f6('0x12')]){var _0x5114a4=/)<[^<]*)*<\/script>/gi;while(_0x5114a4[_0x65f6('0x13')](_0x5c5b91[_0x65f6('0x12')])){_0x5c5b91[_0x65f6('0x12')]=_0x5c5b91[_0x65f6('0x12')][_0x65f6('0x14')](_0x5114a4,'');}if(_0x5c5b91[_0x65f6('0x12')]['includes'](_0x65f6('0x15'))){var _0x4bb39e=[];_0x5c5b91['attachments'][_0x65f6('0x16')](_0xd173f4=>{_0x4bb39e['push'](_0xd173f4[_0x65f6('0x17')]);});var _0x471a33=/]+>/g;var _0x2317ce=/src=\"data:image\/([a-zA-Z]*);base64,([^\"]*)\"/g;var _0x2774a1=_0x5c5b91['html'][_0x65f6('0x14')](_0x2317ce,_0x65f6('0x18'));var _0x20a161=_0x2774a1['replace'](_0x471a33,'_IMG');for(let _0x4fde2f=0x0;_0x4fde2f<_0x4bb39e[_0x65f6('0xd')];_0x4fde2f++){var _0x16cde8=_0x20a161['replace'](_0x65f6('0x19'),_0x65f6('0x1a')+_0x4bb39e[_0x4fde2f]+'\x20]');_0x20a161=_0x16cde8;}_0x5c5b91[_0x65f6('0x12')]=_0x20a161;}_0x365159[_0x65f6('0x1b')]=_0x5c5b91[_0x65f6('0x12')];}else{_0x365159['body']=_0x5c5b91['textAsHtml'];}if(_0x365159['body']){_0x365159[_0x65f6('0x1b')]=_0x365159[_0x65f6('0x1b')][_0x65f6('0x14')](/\x20[Attachment:\x20','body','textAsHtml','Empty\x20message

','Attachments','Data','getHost','gmail','imap.gmail.com','yahoo','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook365','outlook.office365.com','127.0.0.1','lodash','moment','randomstring','path'];(function(_0x3840c9,_0x48c1e3){var _0x2d3611=function(_0x1d859e){while(--_0x1d859e){_0x3840c9['push'](_0x3840c9['shift']());}};_0x2d3611(++_0x48c1e3);}(_0x1c7c,0x164));var _0xc1c7=function(_0x33b2c8,_0x59c2fa){_0x33b2c8=_0x33b2c8-0x0;var _0x752b63=_0x1c7c[_0x33b2c8];return _0x752b63;};'use strict';var _=require(_0xc1c7('0x0'));var moment=require(_0xc1c7('0x1'));var random=require(_0xc1c7('0x2'));var fs=require('fs');var path=require(_0xc1c7('0x3'));var util=require('util');var tnef=require(_0xc1c7('0x4'));var logger=require('../../../config/logger')(_0xc1c7('0x5'));var config=require(_0xc1c7('0x6'));function getAddress(_0xbb9da0){var _0x2a0383=_[_0xc1c7('0x7')](_0xbb9da0[_0xc1c7('0x8')]);return _0x2a0383&&_0x2a0383[_0xc1c7('0x9')]?_0x2a0383[_0xc1c7('0x9')]:_0xc1c7('0xa')+random[_0xc1c7('0xb')](0x6)+_0xc1c7('0xc');}function getFirstName(_0x11c7ef){var _0x92e892=_[_0xc1c7('0x7')](_0x11c7ef[_0xc1c7('0x8')]);if(_0x92e892&&_0x92e892[_0xc1c7('0xd')]){var _0x25a669=_0x92e892['name'][_0xc1c7('0xe')](/\s+/);return _0x25a669[_0xc1c7('0xf')]?_0x25a669['slice'](0x0,-0x1)[_0xc1c7('0x10')]('\x20'):_0x92e892[_0xc1c7('0xd')];}return _0xc1c7('0x11');}function getLastName(_0x5d58e5){var _0x473248=_[_0xc1c7('0x7')](_0x5d58e5[_0xc1c7('0x8')]);if(_0x473248&&_0x473248[_0xc1c7('0xd')]){var _0x2dad6e=_0x473248[_0xc1c7('0xd')][_0xc1c7('0xe')](/\s+/);return _0x2dad6e[_0xc1c7('0xf')]>0x1?_0x2dad6e[_0xc1c7('0x12')]():'';}return'';}function getMails(_0x1b6905,_0x99b874){var _0x34d392='';for(var _0x49576d=0x0;_0x49576d<_0x99b874[_0xc1c7('0x8')][_0xc1c7('0xf')];_0x49576d+=0x1){if(_0x99b874[_0xc1c7('0x8')][_0x49576d]['address']!==_0x1b6905){if(!_[_0xc1c7('0x13')](_0x34d392)){_0x34d392+=',';}_0x34d392+=_0x99b874[_0xc1c7('0x8')][_0x49576d][_0xc1c7('0xd')]||_0x99b874[_0xc1c7('0x8')][_0x49576d][_0xc1c7('0x9')]||'';_0x34d392+='\x20<';_0x34d392+=_0x99b874[_0xc1c7('0x8')][_0x49576d][_0xc1c7('0x9')]?_0x99b874[_0xc1c7('0x8')][_0x49576d]['address']:_0xc1c7('0xa')+random[_0xc1c7('0xb')](0x6)+_0xc1c7('0xc');_0x34d392+='>';}}return _0x34d392;}function parseEmail(_0x1bc9d,_0x4b706e,_0x124fd8){if(_0x4b706e['html']){var _0x5e7e4a=/)<[^<]*)*<\/script>/gi;while(_0x5e7e4a[_0xc1c7('0x14')](_0x4b706e['html'])){_0x4b706e['html']=_0x4b706e[_0xc1c7('0x15')][_0xc1c7('0x16')](_0x5e7e4a,'');}if(_0x4b706e[_0xc1c7('0x15')]['includes'](_0xc1c7('0x17'))){var _0x341b41=[];_0x4b706e[_0xc1c7('0x18')][_0xc1c7('0x19')](_0x2e64c4=>{_0x341b41[_0xc1c7('0x1a')](_0x2e64c4[_0xc1c7('0x1b')]);});var _0x120168=/]+>/g;var _0x22b654=/src=\"data:image\/([a-zA-Z]*);base64,([^\"]*)\"/g;var _0x1540c1=_0x4b706e[_0xc1c7('0x15')][_0xc1c7('0x16')](_0x22b654,_0xc1c7('0x1c'));var _0x260a3f=_0x1540c1[_0xc1c7('0x16')](_0x120168,_0xc1c7('0x1d'));for(let _0x5edb34=0x0;_0x5edb34<_0x341b41[_0xc1c7('0xf')];_0x5edb34++){var _0x13a1f9=_0x260a3f['replace']('_IMG',_0xc1c7('0x1e')+_0x341b41[_0x5edb34]+'\x20]');_0x260a3f=_0x13a1f9;}_0x4b706e['html']=_0x260a3f;}_0x124fd8[_0xc1c7('0x1f')]=_0x4b706e[_0xc1c7('0x15')];}else{_0x124fd8[_0xc1c7('0x1f')]=_0x4b706e[_0xc1c7('0x20')];}if(_0x124fd8[_0xc1c7('0x1f')]){_0x124fd8['body']=_0x124fd8['body'][_0xc1c7('0x16')](/0x0){if(this[_0x5b0be0+'Capacity']>0x0&&this[_0x5b0be0+_0x25b1('0x28')]>=this[_0x5b0be0+_0x25b1('0x29')]){return'maxcapacity';}else{return _0x25b1('0x2a');}}else{return _0x25b1('0x2b');}};Agent[_0x25b1('0x2c')][_0x25b1('0x26')]=function(){var _0x1aabbb=['mail',_0x25b1('0x2d'),_0x25b1('0x2e'),_0x25b1('0x2f'),_0x25b1('0x30'),_0x25b1('0x31')];for(var _0x1292bf=0x0;_0x1292bf<_0x1aabbb['length'];_0x1292bf+=0x1){var _0x3c05c6=this[_0x25b1('0x27')](_0x1aabbb[_0x1292bf]);if(this[_0x1aabbb[_0x1292bf]+_0x25b1('0x32')]!==_0x3c05c6){this[_0x1aabbb[_0x1292bf]+'StatusTime']=_[_0x25b1('0x33')](moment()[_0x25b1('0x34')]('x'));}this[_0x1aabbb[_0x1292bf]+_0x25b1('0x32')]=_0x3c05c6;}var _0x584357={'id':this['id'],'name':this[_0x25b1('0x7')],'online':this['online'],'voicePause':this[_0x25b1('0x9')],'chatPause':this[_0x25b1('0xa')],'mailPause':this[_0x25b1('0xb')],'smsPause':this[_0x25b1('0xd')],'faxPause':this[_0x25b1('0xc')],'openchannelPause':this[_0x25b1('0xe')],'chatStatus':this[_0x25b1('0xf')],'chatStatusTime':this['chatStatusTime'],'chatCapacity':this[_0x25b1('0x12')],'chatCurrentCapacity':this[_0x25b1('0x13')],'mailStatus':this[_0x25b1('0x14')],'mailStatusTime':this[_0x25b1('0x15')],'mailCapacity':this[_0x25b1('0x16')],'mailCurrentCapacity':this['mailCurrentCapacity'],'faxStatus':this[_0x25b1('0x35')],'faxStatusTime':this[_0x25b1('0x18')],'faxCapacity':this[_0x25b1('0x19')],'faxCurrentCapacity':this[_0x25b1('0x1a')],'smsStatus':this[_0x25b1('0x1b')],'smsStatusTime':this['smsStatusTime'],'smsCapacity':this['smsCapacity'],'smsCurrentCapacity':this[_0x25b1('0x1d')],'whatsappStatus':this['whatsappStatus'],'whatsappStatusTime':this[_0x25b1('0x1f')],'whatsappCapacity':this[_0x25b1('0x20')],'whatsappCurrentCapacity':this[_0x25b1('0x21')],'openchannelStatus':this['openchannelStatus'],'openchannelStatusTime':this['openchannelStatusTime'],'openchannelCapacity':this[_0x25b1('0x23')],'openchannelCurrentCapacity':this[_0x25b1('0x24')],'busy':this[_0x25b1('0x36')],'busyQueue':this['busyQueue']};var _0x2bc8c4=md5(JSON[_0x25b1('0x37')](_0x584357));if(this[_0x25b1('0x2')]!==_0x2bc8c4){this[_0x25b1('0x2')]=_0x2bc8c4;io['emit'](_0x25b1('0x38'),_0x584357);}};module[_0x25b1('0x39')]=Agent; \ No newline at end of file +var _0x4feb=['faxStatusTime','smsStatus','whatsappStatus','openchannelStatus','openchannelCurrentCapacity','busy','stringify','emit','user:save','exports','lodash','moment','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','faxCapacity','faxCurrentCapacity','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatusTime','openchannelCapacity','busyQueue','updateRealtime','getChannelStatus','Capacity','CurrentCapacity','maxcapacity','working','idle','prototype','mail','chat','openchannel','fax','sms','whatsapp','Status','toNumber','format'];(function(_0x1a4ab1,_0x44198d){var _0x45fcde=function(_0x469ce0){while(--_0x469ce0){_0x1a4ab1['push'](_0x1a4ab1['shift']());}};_0x45fcde(++_0x44198d);}(_0x4feb,0x190));var _0xb4fe=function(_0x5ca5af,_0x97d661){_0x5ca5af=_0x5ca5af-0x0;var _0x1906f4=_0x4feb[_0x5ca5af];return _0x1906f4;};'use strict';var _=require(_0xb4fe('0x0'));var moment=require(_0xb4fe('0x1'));var md5=require(_0xb4fe('0x2'));var Redis=require(_0xb4fe('0x3'));var config=require(_0xb4fe('0x4'));config[_0xb4fe('0x5')]=_[_0xb4fe('0x6')](config[_0xb4fe('0x5')],{'host':_0xb4fe('0x7'),'port':0x18eb});var io=require(_0xb4fe('0x8'))(new Redis(config['redis']));function Agent(_0x130d26){this['id']=_0x130d26['id']||0x0;this[_0xb4fe('0x9')]=_0x130d26[_0xb4fe('0x9')]||'';this[_0xb4fe('0xa')]=_0x130d26['online']||!![];this[_0xb4fe('0xb')]=_0x130d26['voicePause']||![];this[_0xb4fe('0xc')]=_0x130d26[_0xb4fe('0xc')]||![];this['mailPause']=_0x130d26[_0xb4fe('0xd')]||![];this[_0xb4fe('0xe')]=_0x130d26[_0xb4fe('0xe')]||![];this['smsPause']=_0x130d26[_0xb4fe('0xf')]||![];this[_0xb4fe('0x10')]=_0x130d26[_0xb4fe('0x10')]||![];this[_0xb4fe('0x11')]=_0xb4fe('0x12');this[_0xb4fe('0x13')]=0x0;this[_0xb4fe('0x14')]=_0x130d26['chatCapacity']||0x0;this[_0xb4fe('0x15')]=0x0;this[_0xb4fe('0x16')]=_0xb4fe('0x12');this[_0xb4fe('0x17')]=0x0;this[_0xb4fe('0x18')]=_0x130d26['mailCapacity']||0x0;this[_0xb4fe('0x19')]=0x0;this[_0xb4fe('0x1a')]=_0xb4fe('0x12');this['faxStatusTime']=0x0;this[_0xb4fe('0x1b')]=_0x130d26[_0xb4fe('0x1b')]||0x0;this[_0xb4fe('0x1c')]=0x0;this['smsStatus']=_0xb4fe('0x12');this[_0xb4fe('0x1d')]=0x0;this[_0xb4fe('0x1e')]=_0x130d26[_0xb4fe('0x1e')]||0x0;this[_0xb4fe('0x1f')]=0x0;this['whatsappStatus']=_0xb4fe('0x12');this[_0xb4fe('0x20')]=0x0;this[_0xb4fe('0x21')]=_0x130d26['whatsappCapacity']||0x0;this[_0xb4fe('0x22')]=0x0;this['openchannelStatus']=_0xb4fe('0x12');this[_0xb4fe('0x23')]=0x0;this['openchannelCapacity']=_0x130d26[_0xb4fe('0x24')]||0x0;this['openchannelCurrentCapacity']=0x0;this['busy']=![];this[_0xb4fe('0x25')]=undefined;this[_0xb4fe('0x2')]='';this[_0xb4fe('0x26')]();}Agent['prototype'][_0xb4fe('0x27')]=function(_0x49f61c){if(this[_0x49f61c+'CurrentCapacity']>0x0){if(this[_0x49f61c+_0xb4fe('0x28')]>0x0&&this[_0x49f61c+_0xb4fe('0x29')]>=this[_0x49f61c+_0xb4fe('0x28')]){return _0xb4fe('0x2a');}else{return _0xb4fe('0x2b');}}else{return _0xb4fe('0x2c');}};Agent[_0xb4fe('0x2d')][_0xb4fe('0x26')]=function(){var _0x480054=[_0xb4fe('0x2e'),_0xb4fe('0x2f'),_0xb4fe('0x30'),_0xb4fe('0x31'),_0xb4fe('0x32'),_0xb4fe('0x33')];for(var _0xac63a5=0x0;_0xac63a5<_0x480054['length'];_0xac63a5+=0x1){var _0x2d2071=this[_0xb4fe('0x27')](_0x480054[_0xac63a5]);if(this[_0x480054[_0xac63a5]+_0xb4fe('0x34')]!==_0x2d2071){this[_0x480054[_0xac63a5]+'StatusTime']=_[_0xb4fe('0x35')](moment()[_0xb4fe('0x36')]('x'));}this[_0x480054[_0xac63a5]+'Status']=_0x2d2071;}var _0x4ee3ef={'id':this['id'],'name':this[_0xb4fe('0x9')],'online':this['online'],'voicePause':this[_0xb4fe('0xb')],'chatPause':this[_0xb4fe('0xc')],'mailPause':this[_0xb4fe('0xd')],'smsPause':this[_0xb4fe('0xf')],'faxPause':this[_0xb4fe('0xe')],'openchannelPause':this[_0xb4fe('0x10')],'chatStatus':this[_0xb4fe('0x11')],'chatStatusTime':this['chatStatusTime'],'chatCapacity':this['chatCapacity'],'chatCurrentCapacity':this[_0xb4fe('0x15')],'mailStatus':this[_0xb4fe('0x16')],'mailStatusTime':this[_0xb4fe('0x17')],'mailCapacity':this[_0xb4fe('0x18')],'mailCurrentCapacity':this[_0xb4fe('0x19')],'faxStatus':this['faxStatus'],'faxStatusTime':this[_0xb4fe('0x37')],'faxCapacity':this['faxCapacity'],'faxCurrentCapacity':this[_0xb4fe('0x1c')],'smsStatus':this[_0xb4fe('0x38')],'smsStatusTime':this['smsStatusTime'],'smsCapacity':this[_0xb4fe('0x1e')],'smsCurrentCapacity':this[_0xb4fe('0x1f')],'whatsappStatus':this[_0xb4fe('0x39')],'whatsappStatusTime':this['whatsappStatusTime'],'whatsappCapacity':this[_0xb4fe('0x21')],'whatsappCurrentCapacity':this[_0xb4fe('0x22')],'openchannelStatus':this[_0xb4fe('0x3a')],'openchannelStatusTime':this[_0xb4fe('0x23')],'openchannelCapacity':this[_0xb4fe('0x24')],'openchannelCurrentCapacity':this[_0xb4fe('0x3b')],'busy':this[_0xb4fe('0x3c')],'busyQueue':this[_0xb4fe('0x25')]};var _0x71a969=md5(JSON[_0xb4fe('0x3d')](_0x4ee3ef));if(this[_0xb4fe('0x2')]!==_0x71a969){this[_0xb4fe('0x2')]=_0x71a969;io[_0xb4fe('0x3e')](_0xb4fe('0x3f'),_0x4ee3ef);}};module[_0xb4fe('0x40')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index ec5792a..fa259fe 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 _0xbc27=['redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','mapAgentsId','waiting','updateRealtime','prototype','updateRouting','_rr','Agents','loggedIn','paused','online','chatPause','available','stringify','format','chat:queue:%s','chat_queue:save','lodash','md5','util','ioredis','../../../config/environment','defaults'];(function(_0x5c2232,_0x2e9903){var _0x5aae84=function(_0x40f05e){while(--_0x40f05e){_0x5c2232['push'](_0x5c2232['shift']());}};_0x5aae84(++_0x2e9903);}(_0xbc27,0xff));var _0x7bc2=function(_0x4ef0d7,_0x14fcb0){_0x4ef0d7=_0x4ef0d7-0x0;var _0xdf507b=_0xbc27[_0x4ef0d7];return _0xdf507b;};'use strict';var _=require(_0x7bc2('0x0'));var md5=require(_0x7bc2('0x1'));var util=require(_0x7bc2('0x2'));var Redis=require(_0x7bc2('0x3'));var config=require(_0x7bc2('0x4'));config['redis']=_[_0x7bc2('0x5')](config[_0x7bc2('0x6')],{'host':_0x7bc2('0x7'),'port':0x18eb});var io=require(_0x7bc2('0x8'))(new Redis(config[_0x7bc2('0x6')]));function ChatQueue(_0x54fd88){this['id']=_0x54fd88['id']||0x0;this[_0x7bc2('0x9')]=_0x54fd88[_0x7bc2('0x9')]||'';this[_0x7bc2('0xa')]=_0x54fd88['timeout']||0xa;this['strategy']=_0x54fd88[_0x7bc2('0xb')]||_0x7bc2('0xc');this['Agents']=_0x54fd88['Agents'];this[_0x7bc2('0xd')]={};this[_0x7bc2('0xe')]=0x0;this[_0x7bc2('0x1')]='';this['updateRouting']();this[_0x7bc2('0xf')]();}ChatQueue[_0x7bc2('0x10')][_0x7bc2('0x11')]=function(){var _0x4629b2=this[_0x7bc2('0xd')][_0x7bc2('0x12')];this[_0x7bc2('0xd')]=_['map'](this[_0x7bc2('0x13')],'id');this['mapAgentsId'][_0x7bc2('0x12')]=_0x4629b2;};ChatQueue[_0x7bc2('0x10')][_0x7bc2('0xf')]=function(){this[_0x7bc2('0x14')]=0x0;this[_0x7bc2('0x15')]=0x0;for(var _0x34ac1a=0x0;_0x34ac1a=0x0?this[_0x7bc2('0x18')]:0x0;var _0x14fd67={'id':this['id'],'available':this[_0x7bc2('0x18')],'loggedIn':this['loggedIn'],'name':this[_0x7bc2('0x9')],'paused':this[_0x7bc2('0x15')],'waiting':this[_0x7bc2('0xe')]};var _0x4afb6a=md5(JSON[_0x7bc2('0x19')](_0x14fd67));if(this['md5']!==_0x4afb6a){this[_0x7bc2('0x1')]=_0x4afb6a;io['to'](util[_0x7bc2('0x1a')](_0x7bc2('0x1b'),_0x14fd67[_0x7bc2('0x9')]))['emit'](_0x7bc2('0x1c'),_0x14fd67);}};module['exports']=ChatQueue; \ No newline at end of file +var _0x0a98=['chatPause','available','waiting','md5','chat:queue:%s','emit','chat_queue:save','exports','lodash','util','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','updateRealtime','updateRouting','mapAgentsId','map','_rr','prototype','loggedIn','paused','length'];(function(_0x4a7f3c,_0x74b703){var _0x89d3ae=function(_0x1ae014){while(--_0x1ae014){_0x4a7f3c['push'](_0x4a7f3c['shift']());}};_0x89d3ae(++_0x74b703);}(_0x0a98,0x7c));var _0x80a9=function(_0x39cf54,_0x23606f){_0x39cf54=_0x39cf54-0x0;var _0x17a94f=_0x0a98[_0x39cf54];return _0x17a94f;};'use strict';var _=require(_0x80a9('0x0'));var md5=require('md5');var util=require(_0x80a9('0x1'));var Redis=require('ioredis');var config=require(_0x80a9('0x2'));config[_0x80a9('0x3')]=_[_0x80a9('0x4')](config['redis'],{'host':_0x80a9('0x5'),'port':0x18eb});var io=require(_0x80a9('0x6'))(new Redis(config[_0x80a9('0x3')]));function ChatQueue(_0x2329d8){this['id']=_0x2329d8['id']||0x0;this[_0x80a9('0x7')]=_0x2329d8[_0x80a9('0x7')]||'';this['timeout']=_0x2329d8[_0x80a9('0x8')]||0xa;this['strategy']=_0x2329d8[_0x80a9('0x9')]||_0x80a9('0xa');this['Agents']=_0x2329d8[_0x80a9('0xb')];this['mapAgentsId']={};this['waiting']=0x0;this['md5']='';this['updateRouting']();this[_0x80a9('0xc')]();}ChatQueue['prototype'][_0x80a9('0xd')]=function(){var _0x354cf5=this[_0x80a9('0xe')]['_rr'];this[_0x80a9('0xe')]=_[_0x80a9('0xf')](this[_0x80a9('0xb')],'id');this[_0x80a9('0xe')][_0x80a9('0x10')]=_0x354cf5;};ChatQueue[_0x80a9('0x11')]['updateRealtime']=function(){this[_0x80a9('0x12')]=0x0;this[_0x80a9('0x13')]=0x0;for(var _0x404d94=0x0;_0x404d94=0x0?this[_0x80a9('0x16')]:0x0;var _0x19ce73={'id':this['id'],'available':this[_0x80a9('0x16')],'loggedIn':this[_0x80a9('0x12')],'name':this['name'],'paused':this[_0x80a9('0x13')],'waiting':this[_0x80a9('0x17')]};var _0x37e9d9=md5(JSON['stringify'](_0x19ce73));if(this[_0x80a9('0x18')]!==_0x37e9d9){this['md5']=_0x37e9d9;io['to'](util['format'](_0x80a9('0x19'),_0x19ce73[_0x80a9('0x7')]))[_0x80a9('0x1a')](_0x80a9('0x1b'),_0x19ce73);}};module[_0x80a9('0x1c')]=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index 787ec1a..6f5e9c1 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 _0xefb5=['localhost','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','length','online','faxPause','available','stringify','format','fax:queue:%s','fax_queue:save','exports','md5','../../../config/environment','redis','defaults'];(function(_0x2253ea,_0x6320e){var _0x2d046c=function(_0x707761){while(--_0x707761){_0x2253ea['push'](_0x2253ea['shift']());}};_0x2d046c(++_0x6320e);}(_0xefb5,0x125));var _0x5efb=function(_0x367361,_0x311488){_0x367361=_0x367361-0x0;var _0x195d2d=_0xefb5[_0x367361];return _0x195d2d;};'use strict';var _=require('lodash');var md5=require(_0x5efb('0x0'));var util=require('util');var Redis=require('ioredis');var config=require(_0x5efb('0x1'));config[_0x5efb('0x2')]=_[_0x5efb('0x3')](config['redis'],{'host':_0x5efb('0x4'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x5efb('0x2')]));function FaxQueue(_0x2147c6){this['id']=_0x2147c6['id']||0x0;this['name']=_0x2147c6[_0x5efb('0x5')]||'';this[_0x5efb('0x6')]=_0x2147c6['timeout']||0xa;this[_0x5efb('0x7')]=_0x2147c6[_0x5efb('0x7')]||'beepall';this[_0x5efb('0x8')]=_0x2147c6[_0x5efb('0x8')];this[_0x5efb('0x9')]={};this[_0x5efb('0xa')]=0x0;this[_0x5efb('0x0')]='';this[_0x5efb('0xb')]();this[_0x5efb('0xc')]();}FaxQueue[_0x5efb('0xd')][_0x5efb('0xb')]=function(){var _0x1ba024=this[_0x5efb('0x9')][_0x5efb('0xe')];this[_0x5efb('0x9')]=_[_0x5efb('0xf')](this[_0x5efb('0x8')],'id');this['mapAgentsId'][_0x5efb('0xe')]=_0x1ba024;};FaxQueue[_0x5efb('0xd')][_0x5efb('0xc')]=function(){this[_0x5efb('0x10')]=0x0;this[_0x5efb('0x11')]=0x0;for(var _0x3123db=0x0;_0x3123db=0x0?this[_0x5efb('0x15')]:0x0;var _0x23c808={'id':this['id'],'available':this[_0x5efb('0x15')],'loggedIn':this[_0x5efb('0x10')],'name':this[_0x5efb('0x5')],'paused':this['paused'],'waiting':this[_0x5efb('0xa')]};var _0xc01c59=md5(JSON[_0x5efb('0x16')](_0x23c808));if(this[_0x5efb('0x0')]!==_0xc01c59){this['md5']=_0xc01c59;io['to'](util[_0x5efb('0x17')](_0x5efb('0x18'),_0x23c808[_0x5efb('0x5')]))['emit'](_0x5efb('0x19'),_0x23c808);}};module[_0x5efb('0x1a')]=FaxQueue; \ No newline at end of file +var _0x4b67=['emit','fax_queue:save','exports','md5','util','ioredis','../../../config/environment','defaults','redis','localhost','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRealtime','prototype','updateRouting','_rr','map','loggedIn','paused','online','faxPause','available','stringify','format'];(function(_0x2a453b,_0x479c50){var _0x132f79=function(_0x5e3d83){while(--_0x5e3d83){_0x2a453b['push'](_0x2a453b['shift']());}};_0x132f79(++_0x479c50);}(_0x4b67,0x199));var _0x74b6=function(_0xac46e1,_0x2eee58){_0xac46e1=_0xac46e1-0x0;var _0x3a84d0=_0x4b67[_0xac46e1];return _0x3a84d0;};'use strict';var _=require('lodash');var md5=require(_0x74b6('0x0'));var util=require(_0x74b6('0x1'));var Redis=require(_0x74b6('0x2'));var config=require(_0x74b6('0x3'));config['redis']=_[_0x74b6('0x4')](config[_0x74b6('0x5')],{'host':_0x74b6('0x6'),'port':0x18eb});var io=require(_0x74b6('0x7'))(new Redis(config[_0x74b6('0x5')]));function FaxQueue(_0x378033){this['id']=_0x378033['id']||0x0;this[_0x74b6('0x8')]=_0x378033['name']||'';this[_0x74b6('0x9')]=_0x378033[_0x74b6('0x9')]||0xa;this[_0x74b6('0xa')]=_0x378033[_0x74b6('0xa')]||'beepall';this[_0x74b6('0xb')]=_0x378033[_0x74b6('0xb')];this[_0x74b6('0xc')]={};this[_0x74b6('0xd')]=0x0;this[_0x74b6('0x0')]='';this['updateRouting']();this[_0x74b6('0xe')]();}FaxQueue[_0x74b6('0xf')][_0x74b6('0x10')]=function(){var _0x58ef75=this['mapAgentsId'][_0x74b6('0x11')];this['mapAgentsId']=_[_0x74b6('0x12')](this[_0x74b6('0xb')],'id');this[_0x74b6('0xc')][_0x74b6('0x11')]=_0x58ef75;};FaxQueue[_0x74b6('0xf')][_0x74b6('0xe')]=function(){this[_0x74b6('0x13')]=0x0;this[_0x74b6('0x14')]=0x0;for(var _0x2ff146=0x0;_0x2ff146=0x0?this[_0x74b6('0x17')]:0x0;var _0x84acf0={'id':this['id'],'available':this[_0x74b6('0x17')],'loggedIn':this[_0x74b6('0x13')],'name':this['name'],'paused':this['paused'],'waiting':this[_0x74b6('0xd')]};var _0x445b67=md5(JSON[_0x74b6('0x18')](_0x84acf0));if(this[_0x74b6('0x0')]!==_0x445b67){this[_0x74b6('0x0')]=_0x445b67;io['to'](util[_0x74b6('0x19')]('fax:queue:%s',_0x84acf0[_0x74b6('0x8')]))[_0x74b6('0x1a')](_0x74b6('0x1b'),_0x84acf0);}};module[_0x74b6('0x1c')]=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index 32c48d0..70dc535 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 _0xbf6f=['name','Intervals','exports'];(function(_0x21ad72,_0x392dcb){var _0x57a812=function(_0x5d8948){while(--_0x5d8948){_0x21ad72['push'](_0x21ad72['shift']());}};_0x57a812(++_0x392dcb);}(_0xbf6f,0x141));var _0xfbf6=function(_0x14c28b,_0x4e327b){_0x14c28b=_0x14c28b-0x0;var _0x218d19=_0xbf6f[_0x14c28b];return _0x218d19;};'use strict';function Interval(_0x9ef9c1){this['id']=_0x9ef9c1['id']||0x0;this[_0xfbf6('0x0')]=_0x9ef9c1[_0xfbf6('0x0')]||'';this[_0xfbf6('0x1')]=_0x9ef9c1[_0xfbf6('0x1')]||{};}module[_0xfbf6('0x2')]=Interval; \ No newline at end of file +var _0xf072=['name','Intervals','exports'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xf072,0xff));var _0x2f07=function(_0x199401,_0x3e0898){_0x199401=_0x199401-0x0;var _0x3f272a=_0xf072[_0x199401];return _0x3f272a;};'use strict';function Interval(_0x2bb34d){this['id']=_0x2bb34d['id']||0x0;this[_0x2f07('0x0')]=_0x2bb34d['name']||'';this[_0x2f07('0x1')]=_0x2bb34d[_0x2f07('0x1')]||{};}module[_0x2f07('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 9b814b5..1ae2a82 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 _0xb400=['socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','md5','updateRealtime','prototype','updateRouting','_rr','loggedIn','online','mailPause','paused','available','format','mail:queue:%s','emit','mail_queue:save','exports','lodash','util','ioredis','../../../config/environment','redis','defaults','localhost'];(function(_0x3c0c96,_0x449674){var _0x1780ec=function(_0x395465){while(--_0x395465){_0x3c0c96['push'](_0x3c0c96['shift']());}};_0x1780ec(++_0x449674);}(_0xb400,0x1d9));var _0x0b40=function(_0x3d110d,_0x52beb2){_0x3d110d=_0x3d110d-0x0;var _0x1a9a33=_0xb400[_0x3d110d];return _0x1a9a33;};'use strict';var _=require(_0x0b40('0x0'));var md5=require('md5');var util=require(_0x0b40('0x1'));var Redis=require(_0x0b40('0x2'));var config=require(_0x0b40('0x3'));config[_0x0b40('0x4')]=_[_0x0b40('0x5')](config['redis'],{'host':_0x0b40('0x6'),'port':0x18eb});var io=require(_0x0b40('0x7'))(new Redis(config[_0x0b40('0x4')]));function MailQueue(_0x153fb4){this['id']=_0x153fb4['id']||0x0;this['name']=_0x153fb4[_0x0b40('0x8')]||'';this[_0x0b40('0x9')]=_0x153fb4['timeout']||0xa;this[_0x0b40('0xa')]=_0x153fb4[_0x0b40('0xa')]||_0x0b40('0xb');this[_0x0b40('0xc')]=_0x153fb4[_0x0b40('0xc')];this[_0x0b40('0xd')]={};this[_0x0b40('0xe')]=0x0;this[_0x0b40('0xf')]='';this['updateRouting']();this[_0x0b40('0x10')]();}MailQueue[_0x0b40('0x11')][_0x0b40('0x12')]=function(){var _0x270a2d=this[_0x0b40('0xd')][_0x0b40('0x13')];this['mapAgentsId']=_['map'](this['Agents'],'id');this[_0x0b40('0xd')][_0x0b40('0x13')]=_0x270a2d;};MailQueue[_0x0b40('0x11')][_0x0b40('0x10')]=function(){this[_0x0b40('0x14')]=0x0;this['paused']=0x0;for(var _0x33d162=0x0;_0x33d162=0x0?this[_0x0b40('0x18')]:0x0;var _0x511e34={'id':this['id'],'available':this[_0x0b40('0x18')],'loggedIn':this['loggedIn'],'name':this[_0x0b40('0x8')],'paused':this[_0x0b40('0x17')],'waiting':this['waiting']};var _0x188923=md5(JSON['stringify'](_0x511e34));if(this[_0x0b40('0xf')]!==_0x188923){this[_0x0b40('0xf')]=_0x188923;io['to'](util[_0x0b40('0x19')](_0x0b40('0x1a'),_0x511e34[_0x0b40('0x8')]))[_0x0b40('0x1b')](_0x0b40('0x1c'),_0x511e34);}};module[_0x0b40('0x1d')]=MailQueue; \ No newline at end of file +var _0x05c9=['online','mailPause','loggedIn','available','stringify','format','emit','exports','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRealtime','prototype','updateRouting','_rr','map','paused','length'];(function(_0x418799,_0x14f50a){var _0x408715=function(_0x2114c1){while(--_0x2114c1){_0x418799['push'](_0x418799['shift']());}};_0x408715(++_0x14f50a);}(_0x05c9,0x18e));var _0x905c=function(_0x1e342c,_0x688878){_0x1e342c=_0x1e342c-0x0;var _0x1d451b=_0x05c9[_0x1e342c];return _0x1d451b;};'use strict';var _=require(_0x905c('0x0'));var md5=require(_0x905c('0x1'));var util=require(_0x905c('0x2'));var Redis=require(_0x905c('0x3'));var config=require(_0x905c('0x4'));config[_0x905c('0x5')]=_[_0x905c('0x6')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x905c('0x7'))(new Redis(config[_0x905c('0x5')]));function MailQueue(_0x1f41ad){this['id']=_0x1f41ad['id']||0x0;this[_0x905c('0x8')]=_0x1f41ad[_0x905c('0x8')]||'';this[_0x905c('0x9')]=_0x1f41ad[_0x905c('0x9')]||0xa;this[_0x905c('0xa')]=_0x1f41ad[_0x905c('0xa')]||_0x905c('0xb');this[_0x905c('0xc')]=_0x1f41ad['Agents'];this[_0x905c('0xd')]={};this[_0x905c('0xe')]=0x0;this['md5']='';this['updateRouting']();this[_0x905c('0xf')]();}MailQueue[_0x905c('0x10')][_0x905c('0x11')]=function(){var _0x294f32=this[_0x905c('0xd')][_0x905c('0x12')];this[_0x905c('0xd')]=_[_0x905c('0x13')](this[_0x905c('0xc')],'id');this['mapAgentsId'][_0x905c('0x12')]=_0x294f32;};MailQueue[_0x905c('0x10')][_0x905c('0xf')]=function(){this['loggedIn']=0x0;this[_0x905c('0x14')]=0x0;for(var _0x2f0535=0x0;_0x2f0535=0x0?this['available']:0x0;var _0x5b83e1={'id':this['id'],'available':this[_0x905c('0x19')],'loggedIn':this[_0x905c('0x18')],'name':this['name'],'paused':this[_0x905c('0x14')],'waiting':this[_0x905c('0xe')]};var _0x3f0a48=md5(JSON[_0x905c('0x1a')](_0x5b83e1));if(this[_0x905c('0x1')]!==_0x3f0a48){this[_0x905c('0x1')]=_0x3f0a48;io['to'](util[_0x905c('0x1b')]('mail:queue:%s',_0x5b83e1[_0x905c('0x8')]))[_0x905c('0x1c')]('mail_queue:save',_0x5b83e1);}};module[_0x905c('0x1d')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index a8011ab..7439f5d 100644 --- a/server/services/routing/model/openchannelQueue.js +++ b/server/services/routing/model/openchannelQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2ef3=['stringify','format','openchannel_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','localhost','timeout','strategy','beepall','Agents','mapAgentsId','waiting','prototype','updateRouting','_rr','paused','length','online','available','loggedIn','name'];(function(_0x3be2e2,_0x5c166d){var _0x53b9c5=function(_0x248aa7){while(--_0x248aa7){_0x3be2e2['push'](_0x3be2e2['shift']());}};_0x53b9c5(++_0x5c166d);}(_0x2ef3,0xba));var _0x32ef=function(_0x54f37a,_0x20e29a){_0x54f37a=_0x54f37a-0x0;var _0x409806=_0x2ef3[_0x54f37a];return _0x409806;};'use strict';var _=require(_0x32ef('0x0'));var md5=require(_0x32ef('0x1'));var util=require(_0x32ef('0x2'));var Redis=require(_0x32ef('0x3'));var config=require(_0x32ef('0x4'));config[_0x32ef('0x5')]=_['defaults'](config[_0x32ef('0x5')],{'host':_0x32ef('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x32ef('0x5')]));function OpenchannelQueue(_0x37dd1d){this['id']=_0x37dd1d['id']||0x0;this['name']=_0x37dd1d['name']||'';this[_0x32ef('0x7')]=_0x37dd1d[_0x32ef('0x7')]||0xa;this[_0x32ef('0x8')]=_0x37dd1d[_0x32ef('0x8')]||_0x32ef('0x9');this[_0x32ef('0xa')]=_0x37dd1d[_0x32ef('0xa')];this[_0x32ef('0xb')]={};this[_0x32ef('0xc')]=0x0;this[_0x32ef('0x1')]='';this['updateRouting']();this['updateRealtime']();}OpenchannelQueue[_0x32ef('0xd')][_0x32ef('0xe')]=function(){var _0x45bfd5=this[_0x32ef('0xb')]['_rr'];this[_0x32ef('0xb')]=_['map'](this[_0x32ef('0xa')],'id');this['mapAgentsId'][_0x32ef('0xf')]=_0x45bfd5;};OpenchannelQueue[_0x32ef('0xd')]['updateRealtime']=function(){this['loggedIn']=0x0;this[_0x32ef('0x10')]=0x0;for(var _0x4d8009=0x0;_0x4d8009=0x0?this[_0x32ef('0x13')]:0x0;var _0x286bfb={'id':this['id'],'available':this['available'],'loggedIn':this[_0x32ef('0x14')],'name':this[_0x32ef('0x15')],'paused':this['paused'],'waiting':this[_0x32ef('0xc')]};var _0x314ef1=md5(JSON[_0x32ef('0x16')](_0x286bfb));if(this[_0x32ef('0x1')]!==_0x314ef1){this[_0x32ef('0x1')]=_0x314ef1;io['to'](util[_0x32ef('0x17')]('openchannel:queue:%s',_0x286bfb[_0x32ef('0x15')]))['emit'](_0x32ef('0x18'),_0x286bfb);}};module[_0x32ef('0x19')]=OpenchannelQueue; \ No newline at end of file +var _0x814b=['prototype','map','_rr','loggedIn','paused','length','online','openchannelPause','available','format','openchannel_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime'];(function(_0xfc077a,_0x380d5c){var _0x1988a4=function(_0x116532){while(--_0x116532){_0xfc077a['push'](_0xfc077a['shift']());}};_0x1988a4(++_0x380d5c);}(_0x814b,0x1a2));var _0xb814=function(_0x51f4fc,_0x1fe3ef){_0x51f4fc=_0x51f4fc-0x0;var _0x4d96fc=_0x814b[_0x51f4fc];return _0x4d96fc;};'use strict';var _=require(_0xb814('0x0'));var md5=require(_0xb814('0x1'));var util=require(_0xb814('0x2'));var Redis=require(_0xb814('0x3'));var config=require(_0xb814('0x4'));config[_0xb814('0x5')]=_['defaults'](config[_0xb814('0x5')],{'host':_0xb814('0x6'),'port':0x18eb});var io=require(_0xb814('0x7'))(new Redis(config[_0xb814('0x5')]));function OpenchannelQueue(_0x44931c){this['id']=_0x44931c['id']||0x0;this[_0xb814('0x8')]=_0x44931c['name']||'';this[_0xb814('0x9')]=_0x44931c[_0xb814('0x9')]||0xa;this['strategy']=_0x44931c[_0xb814('0xa')]||_0xb814('0xb');this[_0xb814('0xc')]=_0x44931c[_0xb814('0xc')];this[_0xb814('0xd')]={};this[_0xb814('0xe')]=0x0;this[_0xb814('0x1')]='';this[_0xb814('0xf')]();this[_0xb814('0x10')]();}OpenchannelQueue[_0xb814('0x11')][_0xb814('0xf')]=function(){var _0x4b5f14=this[_0xb814('0xd')]['_rr'];this[_0xb814('0xd')]=_[_0xb814('0x12')](this[_0xb814('0xc')],'id');this[_0xb814('0xd')][_0xb814('0x13')]=_0x4b5f14;};OpenchannelQueue[_0xb814('0x11')][_0xb814('0x10')]=function(){this[_0xb814('0x14')]=0x0;this[_0xb814('0x15')]=0x0;for(var _0x2ab627=0x0;_0x2ab627=0x0?this['available']:0x0;var _0x270598={'id':this['id'],'available':this[_0xb814('0x19')],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this['paused'],'waiting':this[_0xb814('0xe')]};var _0x4d5276=md5(JSON['stringify'](_0x270598));if(this[_0xb814('0x1')]!==_0x4d5276){this[_0xb814('0x1')]=_0x4d5276;io['to'](util[_0xb814('0x1a')]('openchannel:queue:%s',_0x270598[_0xb814('0x8')]))['emit'](_0xb814('0x1b'),_0x270598);}};module[_0xb814('0x1c')]=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index 4838e0a..ee77a47 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 _0x5c37=['../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','Agents','waiting','updateRouting','updateRealtime','prototype','_rr','mapAgentsId','map','loggedIn','paused','length','online','smsPause','available','stringify','format','emit','sms_queue:save','lodash','md5','util','ioredis'];(function(_0xed9568,_0x1a4e18){var _0x391ee5=function(_0x4cce92){while(--_0x4cce92){_0xed9568['push'](_0xed9568['shift']());}};_0x391ee5(++_0x1a4e18);}(_0x5c37,0x11e));var _0x75c3=function(_0x14d896,_0x53578b){_0x14d896=_0x14d896-0x0;var _0x28679a=_0x5c37[_0x14d896];return _0x28679a;};'use strict';var _=require(_0x75c3('0x0'));var md5=require(_0x75c3('0x1'));var util=require(_0x75c3('0x2'));var Redis=require(_0x75c3('0x3'));var config=require(_0x75c3('0x4'));config[_0x75c3('0x5')]=_['defaults'](config[_0x75c3('0x5')],{'host':_0x75c3('0x6'),'port':0x18eb});var io=require(_0x75c3('0x7'))(new Redis(config['redis']));function SmsQueue(_0x190aae){this['id']=_0x190aae['id']||0x0;this[_0x75c3('0x8')]=_0x190aae[_0x75c3('0x8')]||'';this[_0x75c3('0x9')]=_0x190aae['timeout']||0xa;this[_0x75c3('0xa')]=_0x190aae['strategy']||'beepall';this[_0x75c3('0xb')]=_0x190aae[_0x75c3('0xb')];this['mapAgentsId']={};this[_0x75c3('0xc')]=0x0;this[_0x75c3('0x1')]='';this[_0x75c3('0xd')]();this[_0x75c3('0xe')]();}SmsQueue[_0x75c3('0xf')][_0x75c3('0xd')]=function(){var _0x536ff4=this['mapAgentsId'][_0x75c3('0x10')];this[_0x75c3('0x11')]=_[_0x75c3('0x12')](this[_0x75c3('0xb')],'id');this[_0x75c3('0x11')]['_rr']=_0x536ff4;};SmsQueue[_0x75c3('0xf')][_0x75c3('0xe')]=function(){this[_0x75c3('0x13')]=0x0;this[_0x75c3('0x14')]=0x0;for(var _0x5a33d1=0x0;_0x5a33d1=0x0?this[_0x75c3('0x18')]:0x0;var _0x2577b8={'id':this['id'],'available':this[_0x75c3('0x18')],'loggedIn':this[_0x75c3('0x13')],'name':this[_0x75c3('0x8')],'paused':this[_0x75c3('0x14')],'waiting':this[_0x75c3('0xc')]};var _0x5421fe=md5(JSON[_0x75c3('0x19')](_0x2577b8));if(this[_0x75c3('0x1')]!==_0x5421fe){this['md5']=_0x5421fe;io['to'](util[_0x75c3('0x1a')]('sms:queue:%s',_0x2577b8[_0x75c3('0x8')]))[_0x75c3('0x1b')](_0x75c3('0x1c'),_0x2577b8);}};module['exports']=SmsQueue; \ No newline at end of file +var _0xb717=['updateRouting','updateRealtime','map','_rr','paused','length','online','smsPause','available','loggedIn','stringify','format','sms:queue:%s','emit','sms_queue:save','exports','lodash','util','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','md5'];(function(_0x261e29,_0x10fffd){var _0x25ef43=function(_0x21b8e7){while(--_0x21b8e7){_0x261e29['push'](_0x261e29['shift']());}};_0x25ef43(++_0x10fffd);}(_0xb717,0x1b4));var _0x7b71=function(_0x6b8291,_0x13f1e8){_0x6b8291=_0x6b8291-0x0;var _0x4c41fe=_0xb717[_0x6b8291];return _0x4c41fe;};'use strict';var _=require(_0x7b71('0x0'));var md5=require('md5');var util=require(_0x7b71('0x1'));var Redis=require('ioredis');var config=require(_0x7b71('0x2'));config[_0x7b71('0x3')]=_[_0x7b71('0x4')](config['redis'],{'host':_0x7b71('0x5'),'port':0x18eb});var io=require(_0x7b71('0x6'))(new Redis(config[_0x7b71('0x3')]));function SmsQueue(_0x26044f){this['id']=_0x26044f['id']||0x0;this[_0x7b71('0x7')]=_0x26044f['name']||'';this[_0x7b71('0x8')]=_0x26044f[_0x7b71('0x8')]||0xa;this[_0x7b71('0x9')]=_0x26044f[_0x7b71('0x9')]||_0x7b71('0xa');this['Agents']=_0x26044f[_0x7b71('0xb')];this[_0x7b71('0xc')]={};this['waiting']=0x0;this[_0x7b71('0xd')]='';this[_0x7b71('0xe')]();this[_0x7b71('0xf')]();}SmsQueue['prototype'][_0x7b71('0xe')]=function(){var _0x4a39d4=this[_0x7b71('0xc')]['_rr'];this[_0x7b71('0xc')]=_[_0x7b71('0x10')](this[_0x7b71('0xb')],'id');this[_0x7b71('0xc')][_0x7b71('0x11')]=_0x4a39d4;};SmsQueue['prototype'][_0x7b71('0xf')]=function(){this['loggedIn']=0x0;this[_0x7b71('0x12')]=0x0;for(var _0x22114a=0x0;_0x22114a=0x0?this['available']:0x0;var _0x1fd67d={'id':this['id'],'available':this[_0x7b71('0x16')],'loggedIn':this[_0x7b71('0x17')],'name':this[_0x7b71('0x7')],'paused':this[_0x7b71('0x12')],'waiting':this['waiting']};var _0xa1ba78=md5(JSON[_0x7b71('0x18')](_0x1fd67d));if(this[_0x7b71('0xd')]!==_0xa1ba78){this[_0x7b71('0xd')]=_0xa1ba78;io['to'](util[_0x7b71('0x19')](_0x7b71('0x1a'),_0x1fd67d['name']))[_0x7b71('0x1b')](_0x7b71('0x1c'),_0x1fd67d);}};module[_0x7b71('0x1d')]=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index 9e98a36..8c903d0 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 _0xc786=['whatsapp:queue:%s','emit','whatsapp_queue:save','exports','lodash','md5','util','../../../config/environment','redis','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','length','online','whatsappPause','available','stringify','format'];(function(_0x48ede8,_0x58d2e4){var _0xc2aea5=function(_0x37a4c0){while(--_0x37a4c0){_0x48ede8['push'](_0x48ede8['shift']());}};_0xc2aea5(++_0x58d2e4);}(_0xc786,0xf4));var _0x6c78=function(_0x260cf6,_0x4366ab){_0x260cf6=_0x260cf6-0x0;var _0x53aac5=_0xc786[_0x260cf6];return _0x53aac5;};'use strict';var _=require(_0x6c78('0x0'));var md5=require(_0x6c78('0x1'));var util=require(_0x6c78('0x2'));var Redis=require('ioredis');var config=require(_0x6c78('0x3'));config['redis']=_['defaults'](config[_0x6c78('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x6c78('0x5'))(new Redis(config[_0x6c78('0x4')]));function WhatsappQueue(_0x516bbd){this['id']=_0x516bbd['id']||0x0;this[_0x6c78('0x6')]=_0x516bbd[_0x6c78('0x6')]||'';this[_0x6c78('0x7')]=_0x516bbd['timeout']||0xa;this['strategy']=_0x516bbd[_0x6c78('0x8')]||_0x6c78('0x9');this[_0x6c78('0xa')]=_0x516bbd[_0x6c78('0xa')];this[_0x6c78('0xb')]={};this[_0x6c78('0xc')]=0x0;this['md5']='';this[_0x6c78('0xd')]();this[_0x6c78('0xe')]();}WhatsappQueue[_0x6c78('0xf')][_0x6c78('0xd')]=function(){var _0x5ed7f0=this[_0x6c78('0xb')][_0x6c78('0x10')];this['mapAgentsId']=_[_0x6c78('0x11')](this[_0x6c78('0xa')],'id');this[_0x6c78('0xb')][_0x6c78('0x10')]=_0x5ed7f0;};WhatsappQueue['prototype']['updateRealtime']=function(){this[_0x6c78('0x12')]=0x0;this[_0x6c78('0x13')]=0x0;for(var _0x16b52c=0x0;_0x16b52c=0x0?this['available']:0x0;var _0x29f1a6={'id':this['id'],'available':this['available'],'loggedIn':this[_0x6c78('0x12')],'name':this[_0x6c78('0x6')],'paused':this[_0x6c78('0x13')],'waiting':this[_0x6c78('0xc')]};var _0x4dffaf=md5(JSON[_0x6c78('0x18')](_0x29f1a6));if(this[_0x6c78('0x1')]!==_0x4dffaf){this[_0x6c78('0x1')]=_0x4dffaf;io['to'](util[_0x6c78('0x19')](_0x6c78('0x1a'),_0x29f1a6[_0x6c78('0x6')]))[_0x6c78('0x1b')](_0x6c78('0x1c'),_0x29f1a6);}};module[_0x6c78('0x1d')]=WhatsappQueue; \ No newline at end of file +var _0xedd7=['strategy','beepall','Agents','mapAgentsId','updateRouting','updateRealtime','_rr','prototype','paused','length','loggedIn','available','stringify','whatsapp:queue:%s','emit','whatsapp_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout'];(function(_0x12c47f,_0x217d5d){var _0x4b95b1=function(_0x4063c4){while(--_0x4063c4){_0x12c47f['push'](_0x12c47f['shift']());}};_0x4b95b1(++_0x217d5d);}(_0xedd7,0x1ed));var _0x7edd=function(_0x31b5a5,_0x44376a){_0x31b5a5=_0x31b5a5-0x0;var _0x364cc9=_0xedd7[_0x31b5a5];return _0x364cc9;};'use strict';var _=require(_0x7edd('0x0'));var md5=require(_0x7edd('0x1'));var util=require(_0x7edd('0x2'));var Redis=require(_0x7edd('0x3'));var config=require(_0x7edd('0x4'));config[_0x7edd('0x5')]=_[_0x7edd('0x6')](config[_0x7edd('0x5')],{'host':_0x7edd('0x7'),'port':0x18eb});var io=require(_0x7edd('0x8'))(new Redis(config['redis']));function WhatsappQueue(_0x839e85){this['id']=_0x839e85['id']||0x0;this['name']=_0x839e85[_0x7edd('0x9')]||'';this['timeout']=_0x839e85[_0x7edd('0xa')]||0xa;this[_0x7edd('0xb')]=_0x839e85['strategy']||_0x7edd('0xc');this[_0x7edd('0xd')]=_0x839e85[_0x7edd('0xd')];this[_0x7edd('0xe')]={};this['waiting']=0x0;this[_0x7edd('0x1')]='';this[_0x7edd('0xf')]();this[_0x7edd('0x10')]();}WhatsappQueue['prototype'][_0x7edd('0xf')]=function(){var _0x494a85=this[_0x7edd('0xe')][_0x7edd('0x11')];this[_0x7edd('0xe')]=_['map'](this['Agents'],'id');this['mapAgentsId'][_0x7edd('0x11')]=_0x494a85;};WhatsappQueue[_0x7edd('0x12')][_0x7edd('0x10')]=function(){this['loggedIn']=0x0;this[_0x7edd('0x13')]=0x0;for(var _0x4b800e=0x0;_0x4b800e=0x0?this[_0x7edd('0x16')]:0x0;var _0x503497={'id':this['id'],'available':this[_0x7edd('0x16')],'loggedIn':this[_0x7edd('0x15')],'name':this[_0x7edd('0x9')],'paused':this[_0x7edd('0x13')],'waiting':this['waiting']};var _0x11b3f7=md5(JSON[_0x7edd('0x17')](_0x503497));if(this[_0x7edd('0x1')]!==_0x11b3f7){this[_0x7edd('0x1')]=_0x11b3f7;io['to'](util['format'](_0x7edd('0x18'),_0x503497[_0x7edd('0x9')]))[_0x7edd('0x19')](_0x7edd('0x1a'),_0x503497);}};module[_0x7edd('0x1b')]=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index 348746a..94c7605 100644 --- a/server/services/routing/realtime/index.js +++ b/server/services/routing/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['isUndefined','initIntervals','updateRealtime','updateRouting','initSmsQueues','smsQueues','initMailQueues','mailQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','lodash','../model/interval','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','chatQueues','faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','length'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1cfa0d,_0x4391f2){_0x1cfa0d=_0x1cfa0d-0x0;var _0xe33279=_0xa9e0[_0x1cfa0d];return _0xe33279;};'use strict';var BPromise=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var moment=require('moment');var Agent=require('../model/agent');var Interval=require(_0x0a9e('0x3'));var OpenchannelQueue=require('../model/openchannelQueue');var ChatQueue=require(_0x0a9e('0x4'));var SmsQueue=require(_0x0a9e('0x5'));var MailQueue=require(_0x0a9e('0x6'));var FaxQueue=require(_0x0a9e('0x7'));var WhatsappQueue=require(_0x0a9e('0x8'));var Realtime=function(){this['agents']={};this[_0x0a9e('0x9')]={};this[_0x0a9e('0xa')]={};this[_0x0a9e('0xb')]={};this['smsQueues']={};this['mailQueues']={};this[_0x0a9e('0xc')]={};this['whatsappQueues']={};this['chatQueuesWaitingInteractions']={};this[_0x0a9e('0xd')]={};this[_0x0a9e('0xe')]={};this[_0x0a9e('0xf')]={};this[_0x0a9e('0x10')]={};this[_0x0a9e('0x11')]={};};function freeIsNotKey(_0xbd1168,_0x4a4c56,_0x50dfb2){var _0x527cdd=_['mapKeys'](_0xbd1168,function(_0x273d4d,_0x36471c){return _0x273d4d[_0x50dfb2];});for(var _0xd5b662 in _0x4a4c56){if(_0x4a4c56[_0x0a9e('0x12')](_0xd5b662)){if(!_0x527cdd[_0xd5b662]){delete _0x4a4c56[_0xd5b662];}}}}Realtime[_0x0a9e('0x13')][_0x0a9e('0x14')]=function(_0x5db4b0,_0x4283ce){for(var _0x239b12 in _0x4283ce){if(_0x5db4b0[_0x0a9e('0x12')](_0x239b12)){_0x5db4b0[_0x239b12]=_0x4283ce[_0x239b12];}}};Realtime[_0x0a9e('0x13')][_0x0a9e('0x15')]=function(){var _0x4d5611=this;return function(_0x52a03d){if(_0x52a03d){freeIsNotKey(_0x52a03d,_0x4d5611[_0x0a9e('0x16')],'id');for(var _0x5d0880=0x0,_0x1985b6={},_0x519dfd={};_0x5d0880<_0x52a03d[_0x0a9e('0x17')];_0x5d0880+=0x1){_0x1985b6=_0x52a03d[_0x5d0880];if(_[_0x0a9e('0x18')](_0x4d5611['agents'][_0x1985b6['id']])){_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']]=new Agent(_0x1985b6);}else{_0x4d5611['mergeFromDatabase'](_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']],_0x1985b6);}}}return _0x4d5611[_0x0a9e('0x16')];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x19')]=function(){var _0x31b1ca=this;return function(_0x2eb11f){if(_0x2eb11f){freeIsNotKey(_0x2eb11f,_0x31b1ca[_0x0a9e('0x9')],'id');for(var _0x20559e=0x0,_0x1314ae={},_0x112016={};_0x20559e<_0x2eb11f[_0x0a9e('0x17')];_0x20559e+=0x1){_0x1314ae=_0x2eb11f[_0x20559e];if(_[_0x0a9e('0x18')](_0x31b1ca['intervals'][_0x1314ae['id']])){_0x31b1ca[_0x0a9e('0x9')][_0x1314ae['id']]=new Interval(_0x1314ae);}else{_0x31b1ca[_0x0a9e('0x14')](_0x31b1ca['intervals'][_0x1314ae['id']],_0x1314ae);}}}return _0x31b1ca[_0x0a9e('0x9')];};};Realtime['prototype']['initOpenchannelQueues']=function(){var _0x3a02e1=this;return function(_0x432e56){if(_0x432e56){freeIsNotKey(_0x432e56,_0x3a02e1[_0x0a9e('0xa')],'id');for(var _0x30bae6=0x0,_0x4abc77={},_0xfb6e48={};_0x30bae6<_0x432e56[_0x0a9e('0x17')];_0x30bae6+=0x1){_0x4abc77=_0x432e56[_0x30bae6];if(_[_0x0a9e('0x18')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']])){_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']]=new OpenchannelQueue(_0x4abc77);}else{_0x3a02e1[_0x0a9e('0x14')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']],_0x4abc77);}_0x3a02e1['openchannelQueues'][_0x4abc77['id']]['updateRouting']();_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']][_0x0a9e('0x1a')]();}}return _0x3a02e1[_0x0a9e('0xa')];};};Realtime[_0x0a9e('0x13')]['initChatQueues']=function(){var _0x384319=this;return function(_0x479bc4){if(_0x479bc4){freeIsNotKey(_0x479bc4,_0x384319[_0x0a9e('0xb')],'id');for(var _0x5bfb33=0x0,_0x1dc186={},_0x34dc65={};_0x5bfb33<_0x479bc4[_0x0a9e('0x17')];_0x5bfb33+=0x1){_0x1dc186=_0x479bc4[_0x5bfb33];if(_[_0x0a9e('0x18')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']])){_0x384319[_0x0a9e('0xb')][_0x1dc186['id']]=new ChatQueue(_0x1dc186);}else{_0x384319[_0x0a9e('0x14')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']],_0x1dc186);}_0x384319['chatQueues'][_0x1dc186['id']][_0x0a9e('0x1b')]();_0x384319[_0x0a9e('0xb')][_0x1dc186['id']][_0x0a9e('0x1a')]();}}return _0x384319[_0x0a9e('0xb')];};};Realtime['prototype'][_0x0a9e('0x1c')]=function(){var _0x40e7a3=this;return function(_0x1843b2){if(_0x1843b2){freeIsNotKey(_0x1843b2,_0x40e7a3[_0x0a9e('0x1d')],'id');for(var _0x58b06f=0x0,_0x563b45={},_0x296f41={};_0x58b06f<_0x1843b2[_0x0a9e('0x17')];_0x58b06f+=0x1){_0x563b45=_0x1843b2[_0x58b06f];if(_[_0x0a9e('0x18')](_0x40e7a3['smsQueues'][_0x563b45['id']])){_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']]=new SmsQueue(_0x563b45);}else{_0x40e7a3['mergeFromDatabase'](_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']],_0x563b45);}_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1b')]();_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1a')]();}}return _0x40e7a3['smsQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x1e')]=function(){var _0x40cb85=this;return function(_0x2da5c0){if(_0x2da5c0){freeIsNotKey(_0x2da5c0,_0x40cb85[_0x0a9e('0x1f')],'id');for(var _0x409319=0x0,_0x332d35={},_0x39e565={};_0x409319<_0x2da5c0['length'];_0x409319+=0x1){_0x332d35=_0x2da5c0[_0x409319];if(_[_0x0a9e('0x18')](_0x40cb85['mailQueues'][_0x332d35['id']])){_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]=new MailQueue(_0x332d35);}else{_0x40cb85[_0x0a9e('0x14')](_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']],_0x332d35);}_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]['updateRouting']();_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']][_0x0a9e('0x1a')]();}}return _0x40cb85[_0x0a9e('0x1f')];};};Realtime[_0x0a9e('0x13')]['initFaxQueues']=function(){var _0x54135e=this;return function(_0x1e8694){if(_0x1e8694){freeIsNotKey(_0x1e8694,_0x54135e['faxQueues'],'id');for(var _0x24936a=0x0,_0x3d9717={},_0x381c37={};_0x24936a<_0x1e8694[_0x0a9e('0x17')];_0x24936a+=0x1){_0x3d9717=_0x1e8694[_0x24936a];if(_['isUndefined'](_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']])){_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]=new FaxQueue(_0x3d9717);}else{_0x54135e[_0x0a9e('0x14')](_0x54135e['faxQueues'][_0x3d9717['id']],_0x3d9717);}_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']][_0x0a9e('0x1b')]();_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]['updateRealtime']();}}return _0x54135e['faxQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x20')]=function(){var _0x5adda1=this;return function(_0x2b814e){if(_0x2b814e){freeIsNotKey(_0x2b814e,_0x5adda1[_0x0a9e('0x21')],'id');for(var _0x2e1b3a=0x0,_0x148f55={},_0x4b38d9={};_0x2e1b3a<_0x2b814e['length'];_0x2e1b3a+=0x1){_0x148f55=_0x2b814e[_0x2e1b3a];if(_[_0x0a9e('0x18')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']])){_0x5adda1['whatsappQueues'][_0x148f55['id']]=new WhatsappQueue(_0x148f55);}else{_0x5adda1[_0x0a9e('0x14')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']],_0x148f55);}_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']]['updateRouting']();_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']][_0x0a9e('0x1a')]();}}return _0x5adda1[_0x0a9e('0x21')];};};module[_0x0a9e('0x22')]=Realtime; \ No newline at end of file +var _0xa9e0=['isUndefined','initIntervals','updateRealtime','updateRouting','initSmsQueues','smsQueues','initMailQueues','mailQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','lodash','../model/interval','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','chatQueues','faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','length'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa9e0,0x123));var _0x0a9e=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0xa9e0[_0x491a7f];return _0x3d8f44;};'use strict';var BPromise=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var moment=require('moment');var Agent=require('../model/agent');var Interval=require(_0x0a9e('0x3'));var OpenchannelQueue=require('../model/openchannelQueue');var ChatQueue=require(_0x0a9e('0x4'));var SmsQueue=require(_0x0a9e('0x5'));var MailQueue=require(_0x0a9e('0x6'));var FaxQueue=require(_0x0a9e('0x7'));var WhatsappQueue=require(_0x0a9e('0x8'));var Realtime=function(){this['agents']={};this[_0x0a9e('0x9')]={};this[_0x0a9e('0xa')]={};this[_0x0a9e('0xb')]={};this['smsQueues']={};this['mailQueues']={};this[_0x0a9e('0xc')]={};this['whatsappQueues']={};this['chatQueuesWaitingInteractions']={};this[_0x0a9e('0xd')]={};this[_0x0a9e('0xe')]={};this[_0x0a9e('0xf')]={};this[_0x0a9e('0x10')]={};this[_0x0a9e('0x11')]={};};function freeIsNotKey(_0xbd1168,_0x4a4c56,_0x50dfb2){var _0x527cdd=_['mapKeys'](_0xbd1168,function(_0x273d4d,_0x36471c){return _0x273d4d[_0x50dfb2];});for(var _0xd5b662 in _0x4a4c56){if(_0x4a4c56[_0x0a9e('0x12')](_0xd5b662)){if(!_0x527cdd[_0xd5b662]){delete _0x4a4c56[_0xd5b662];}}}}Realtime[_0x0a9e('0x13')][_0x0a9e('0x14')]=function(_0x5db4b0,_0x4283ce){for(var _0x239b12 in _0x4283ce){if(_0x5db4b0[_0x0a9e('0x12')](_0x239b12)){_0x5db4b0[_0x239b12]=_0x4283ce[_0x239b12];}}};Realtime[_0x0a9e('0x13')][_0x0a9e('0x15')]=function(){var _0x4d5611=this;return function(_0x52a03d){if(_0x52a03d){freeIsNotKey(_0x52a03d,_0x4d5611[_0x0a9e('0x16')],'id');for(var _0x5d0880=0x0,_0x1985b6={},_0x519dfd={};_0x5d0880<_0x52a03d[_0x0a9e('0x17')];_0x5d0880+=0x1){_0x1985b6=_0x52a03d[_0x5d0880];if(_[_0x0a9e('0x18')](_0x4d5611['agents'][_0x1985b6['id']])){_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']]=new Agent(_0x1985b6);}else{_0x4d5611['mergeFromDatabase'](_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']],_0x1985b6);}}}return _0x4d5611[_0x0a9e('0x16')];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x19')]=function(){var _0x31b1ca=this;return function(_0x2eb11f){if(_0x2eb11f){freeIsNotKey(_0x2eb11f,_0x31b1ca[_0x0a9e('0x9')],'id');for(var _0x20559e=0x0,_0x1314ae={},_0x112016={};_0x20559e<_0x2eb11f[_0x0a9e('0x17')];_0x20559e+=0x1){_0x1314ae=_0x2eb11f[_0x20559e];if(_[_0x0a9e('0x18')](_0x31b1ca['intervals'][_0x1314ae['id']])){_0x31b1ca[_0x0a9e('0x9')][_0x1314ae['id']]=new Interval(_0x1314ae);}else{_0x31b1ca[_0x0a9e('0x14')](_0x31b1ca['intervals'][_0x1314ae['id']],_0x1314ae);}}}return _0x31b1ca[_0x0a9e('0x9')];};};Realtime['prototype']['initOpenchannelQueues']=function(){var _0x3a02e1=this;return function(_0x432e56){if(_0x432e56){freeIsNotKey(_0x432e56,_0x3a02e1[_0x0a9e('0xa')],'id');for(var _0x30bae6=0x0,_0x4abc77={},_0xfb6e48={};_0x30bae6<_0x432e56[_0x0a9e('0x17')];_0x30bae6+=0x1){_0x4abc77=_0x432e56[_0x30bae6];if(_[_0x0a9e('0x18')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']])){_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']]=new OpenchannelQueue(_0x4abc77);}else{_0x3a02e1[_0x0a9e('0x14')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']],_0x4abc77);}_0x3a02e1['openchannelQueues'][_0x4abc77['id']]['updateRouting']();_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']][_0x0a9e('0x1a')]();}}return _0x3a02e1[_0x0a9e('0xa')];};};Realtime[_0x0a9e('0x13')]['initChatQueues']=function(){var _0x384319=this;return function(_0x479bc4){if(_0x479bc4){freeIsNotKey(_0x479bc4,_0x384319[_0x0a9e('0xb')],'id');for(var _0x5bfb33=0x0,_0x1dc186={},_0x34dc65={};_0x5bfb33<_0x479bc4[_0x0a9e('0x17')];_0x5bfb33+=0x1){_0x1dc186=_0x479bc4[_0x5bfb33];if(_[_0x0a9e('0x18')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']])){_0x384319[_0x0a9e('0xb')][_0x1dc186['id']]=new ChatQueue(_0x1dc186);}else{_0x384319[_0x0a9e('0x14')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']],_0x1dc186);}_0x384319['chatQueues'][_0x1dc186['id']][_0x0a9e('0x1b')]();_0x384319[_0x0a9e('0xb')][_0x1dc186['id']][_0x0a9e('0x1a')]();}}return _0x384319[_0x0a9e('0xb')];};};Realtime['prototype'][_0x0a9e('0x1c')]=function(){var _0x40e7a3=this;return function(_0x1843b2){if(_0x1843b2){freeIsNotKey(_0x1843b2,_0x40e7a3[_0x0a9e('0x1d')],'id');for(var _0x58b06f=0x0,_0x563b45={},_0x296f41={};_0x58b06f<_0x1843b2[_0x0a9e('0x17')];_0x58b06f+=0x1){_0x563b45=_0x1843b2[_0x58b06f];if(_[_0x0a9e('0x18')](_0x40e7a3['smsQueues'][_0x563b45['id']])){_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']]=new SmsQueue(_0x563b45);}else{_0x40e7a3['mergeFromDatabase'](_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']],_0x563b45);}_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1b')]();_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1a')]();}}return _0x40e7a3['smsQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x1e')]=function(){var _0x40cb85=this;return function(_0x2da5c0){if(_0x2da5c0){freeIsNotKey(_0x2da5c0,_0x40cb85[_0x0a9e('0x1f')],'id');for(var _0x409319=0x0,_0x332d35={},_0x39e565={};_0x409319<_0x2da5c0['length'];_0x409319+=0x1){_0x332d35=_0x2da5c0[_0x409319];if(_[_0x0a9e('0x18')](_0x40cb85['mailQueues'][_0x332d35['id']])){_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]=new MailQueue(_0x332d35);}else{_0x40cb85[_0x0a9e('0x14')](_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']],_0x332d35);}_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]['updateRouting']();_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']][_0x0a9e('0x1a')]();}}return _0x40cb85[_0x0a9e('0x1f')];};};Realtime[_0x0a9e('0x13')]['initFaxQueues']=function(){var _0x54135e=this;return function(_0x1e8694){if(_0x1e8694){freeIsNotKey(_0x1e8694,_0x54135e['faxQueues'],'id');for(var _0x24936a=0x0,_0x3d9717={},_0x381c37={};_0x24936a<_0x1e8694[_0x0a9e('0x17')];_0x24936a+=0x1){_0x3d9717=_0x1e8694[_0x24936a];if(_['isUndefined'](_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']])){_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]=new FaxQueue(_0x3d9717);}else{_0x54135e[_0x0a9e('0x14')](_0x54135e['faxQueues'][_0x3d9717['id']],_0x3d9717);}_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']][_0x0a9e('0x1b')]();_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]['updateRealtime']();}}return _0x54135e['faxQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x20')]=function(){var _0x5adda1=this;return function(_0x2b814e){if(_0x2b814e){freeIsNotKey(_0x2b814e,_0x5adda1[_0x0a9e('0x21')],'id');for(var _0x2e1b3a=0x0,_0x148f55={},_0x4b38d9={};_0x2e1b3a<_0x2b814e['length'];_0x2e1b3a+=0x1){_0x148f55=_0x2b814e[_0x2e1b3a];if(_[_0x0a9e('0x18')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']])){_0x5adda1['whatsappQueues'][_0x148f55['id']]=new WhatsappQueue(_0x148f55);}else{_0x5adda1[_0x0a9e('0x14')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']],_0x148f55);}_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']]['updateRouting']();_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']][_0x0a9e('0x1a')]();}}return _0x5adda1[_0x0a9e('0x21')];};};module[_0x0a9e('0x22')]=Realtime; \ No newline at end of file diff --git a/server/services/routing/rpc/chatInteraction.js b/server/services/routing/rpc/chatInteraction.js index 28d9d28..d7e4f93 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 _0xde32=['addTags','AddTagsToChatInteraction','addTagsToChatInteraction','update','UpdateChatInteraction'];(function(_0x4ae400,_0x3a857c){var _0xdb027f=function(_0x10b462){while(--_0x10b462){_0x4ae400['push'](_0x4ae400['shift']());}};_0xdb027f(++_0x3a857c);}(_0xde32,0x120));var _0x2de3=function(_0xee9db6,_0x52bf11){_0xee9db6=_0xee9db6-0x0;var _0x591412=_0xde32[_0xee9db6];return _0x591412;};'use strict';var client=require('../client');exports[_0x2de3('0x0')]=function(_0x242767,_0x3b512b){return client['Request'](_0x2de3('0x1'),{'body':_0x3b512b,'options':{'where':{'id':_0x242767}},'log':'updateChatInteraction'});};exports[_0x2de3('0x2')]=function(_0x4aceb9,_0xb997cc){return client['Request'](_0x2de3('0x3'),{'body':_0xb997cc,'options':{'where':{'id':_0x4aceb9}},'log':_0x2de3('0x4')});}; \ No newline at end of file +var _0x2911=['addTagsToChatInteraction','Request','UpdateChatInteraction','updateChatInteraction','AddTagsToChatInteraction'];(function(_0x43ed38,_0x507af1){var _0x181497=function(_0x153d8e){while(--_0x153d8e){_0x43ed38['push'](_0x43ed38['shift']());}};_0x181497(++_0x507af1);}(_0x2911,0x1a5));var _0x1291=function(_0x15bc31,_0x14f70c){_0x15bc31=_0x15bc31-0x0;var _0x1989fe=_0x2911[_0x15bc31];return _0x1989fe;};'use strict';var client=require('../client');exports['update']=function(_0x555623,_0x525139){return client[_0x1291('0x0')](_0x1291('0x1'),{'body':_0x525139,'options':{'where':{'id':_0x555623}},'log':_0x1291('0x2')});};exports['addTags']=function(_0x15e83e,_0x3d485c){return client['Request'](_0x1291('0x3'),{'body':_0x3d485c,'options':{'where':{'id':_0x15e83e}},'log':_0x1291('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index 2dcc3a7..e561f96 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 _0x8fb6=['createChatMessage','../client','create'];(function(_0x3071a4,_0x39eedc){var _0x2b42d7=function(_0x45cdc5){while(--_0x45cdc5){_0x3071a4['push'](_0x3071a4['shift']());}};_0x2b42d7(++_0x39eedc);}(_0x8fb6,0x181));var _0x68fb=function(_0x35733c,_0x3721bb){_0x35733c=_0x35733c-0x0;var _0x6c3a72=_0x8fb6[_0x35733c];return _0x6c3a72;};'use strict';var client=require(_0x68fb('0x0'));exports[_0x68fb('0x1')]=function(_0x9ef4ac){return client['Request']('CreateChatMessage',{'body':_0x9ef4ac,'log':_0x68fb('0x2')});}; \ No newline at end of file +var _0x096f=['createChatMessage','../client','create','Request','CreateChatMessage'];(function(_0x1d24eb,_0x12295b){var _0x1dc576=function(_0x4d5770){while(--_0x4d5770){_0x1d24eb['push'](_0x1d24eb['shift']());}};_0x1dc576(++_0x12295b);}(_0x096f,0x1be));var _0xf096=function(_0x43716f,_0x419d38){_0x43716f=_0x43716f-0x0;var _0x5a454c=_0x096f[_0x43716f];return _0x5a454c;};'use strict';var client=require(_0xf096('0x0'));exports[_0xf096('0x1')]=function(_0x14accd){return client[_0xf096('0x2')](_0xf096('0x3'),{'body':_0x14accd,'log':_0xf096('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index 4efeee6..99b9d86 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 _0x14f5=['name','timeout','User','Agents','online','chatPause','getChatQueues','GetChatQueue'];(function(_0x1602af,_0x15f0c4){var _0x39133a=function(_0x1ab294){while(--_0x1ab294){_0x1602af['push'](_0x1602af['shift']());}};_0x39133a(++_0x15f0c4);}(_0x14f5,0xae));var _0x514f=function(_0x27766b,_0x155221){_0x27766b=_0x27766b-0x0;var _0x3de10e=_0x14f5[_0x27766b];return _0x3de10e;};'use strict';var client=require('../client');exports[_0x514f('0x0')]=function(){return function(){return client['Request'](_0x514f('0x1'),{'options':{'raw':![],'attributes':['id',_0x514f('0x2'),_0x514f('0x3'),'strategy'],'include':[{'model':_0x514f('0x4'),'as':_0x514f('0x5'),'attributes':['id','name',_0x514f('0x6'),_0x514f('0x7')]}]},'log':_0x514f('0x0')});};}; \ No newline at end of file +var _0x0845=['online','chatPause','getChatQueues','../client','GetChatQueue','name','timeout','strategy','User','Agents'];(function(_0x21c9c9,_0x106d72){var _0xd63c3a=function(_0x2d2779){while(--_0x2d2779){_0x21c9c9['push'](_0x21c9c9['shift']());}};_0xd63c3a(++_0x106d72);}(_0x0845,0x125));var _0x5084=function(_0x573b6b,_0x14b1e5){_0x573b6b=_0x573b6b-0x0;var _0x834a85=_0x0845[_0x573b6b];return _0x834a85;};'use strict';var client=require(_0x5084('0x0'));exports['getChatQueues']=function(){return function(){return client['Request'](_0x5084('0x1'),{'options':{'raw':![],'attributes':['id',_0x5084('0x2'),_0x5084('0x3'),_0x5084('0x4')],'include':[{'model':_0x5084('0x5'),'as':_0x5084('0x6'),'attributes':['id','name',_0x5084('0x7'),_0x5084('0x8')]}]},'log':_0x5084('0x9')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index f0bf736..a81e9d0 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 _0x280f=['CreateChatQueueReport','update','UpdateChatQueueReport','DESC','../client','Request'];(function(_0x4f3380,_0x492932){var _0xb5fb95=function(_0x3e872b){while(--_0x3e872b){_0x4f3380['push'](_0x4f3380['shift']());}};_0xb5fb95(++_0x492932);}(_0x280f,0xe2));var _0xf280=function(_0x57a50d,_0x2871f8){_0x57a50d=_0x57a50d-0x0;var _0x1b25b3=_0x280f[_0x57a50d];return _0x1b25b3;};'use strict';var client=require(_0xf280('0x0'));exports['create']=function(_0x412811){return client[_0xf280('0x1')](_0xf280('0x2'),{'body':_0x412811,'log':_0xf280('0x2')});};exports[_0xf280('0x3')]=function(_0x348341,_0xffc0f1){return client['Request'](_0xf280('0x4'),{'body':_0xffc0f1,'options':{'where':{'uniqueid':_0x348341},'order':[['id',_0xf280('0x5')]],'limit':0x1},'log':_0xf280('0x4')});}; \ No newline at end of file +var _0xb43b=['create','Request','CreateChatQueueReport','UpdateChatQueueReport','../client'];(function(_0x2ef03f,_0x225a98){var _0x58278d=function(_0x41ddfd){while(--_0x41ddfd){_0x2ef03f['push'](_0x2ef03f['shift']());}};_0x58278d(++_0x225a98);}(_0xb43b,0x1b2));var _0xbb43=function(_0x4fab7a,_0x2b741d){_0x4fab7a=_0x4fab7a-0x0;var _0x55f5df=_0xb43b[_0x4fab7a];return _0x55f5df;};'use strict';var client=require(_0xbb43('0x0'));exports[_0xbb43('0x1')]=function(_0x5c45dd){return client[_0xbb43('0x2')](_0xbb43('0x3'),{'body':_0x5c45dd,'log':_0xbb43('0x3')});};exports['update']=function(_0x131e9e,_0x41aff6){return client[_0xbb43('0x2')](_0xbb43('0x4'),{'body':_0x41aff6,'options':{'where':{'uniqueid':_0x131e9e},'order':[['id','DESC']],'limit':0x1},'log':'UpdateChatQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index 3ea49b2..fc030ed 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(_0x6f1a87,_0x5d5bcf){var _0x2495c7=function(_0x1c6733){while(--_0x1c6733){_0x6f1a87['push'](_0x6f1a87['shift']());}};_0x2495c7(++_0x5d5bcf);}(_0x7a54,0x106));var _0x47a5=function(_0x5c722c,_0x2b06e6){_0x5c722c=_0x5c722c-0x0;var _0x2899d8=_0x7a54[_0x5c722c];return _0x2899d8;};'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(_0x52f159,_0x419d8a){var _0x156799=function(_0xf168e8){while(--_0xf168e8){_0x52f159['push'](_0x52f159['shift']());}};_0x156799(++_0x419d8a);}(_0x7a54,0x106));var _0x47a5=function(_0x3c0ccd,_0x6d2659){_0x3c0ccd=_0x3c0ccd-0x0;var _0x3bb61b=_0x7a54[_0x3c0ccd];return _0x3bb61b;};'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 97dd6ac..c2dd339 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 _0x37a7=['createFaxMessage','create','Request','CreateFaxMessage'];(function(_0x1b6eba,_0x96bf07){var _0x3aac69=function(_0x5b2d7b){while(--_0x5b2d7b){_0x1b6eba['push'](_0x1b6eba['shift']());}};_0x3aac69(++_0x96bf07);}(_0x37a7,0xcd));var _0x737a=function(_0x33b505,_0x4d09fb){_0x33b505=_0x33b505-0x0;var _0x6c7821=_0x37a7[_0x33b505];return _0x6c7821;};'use strict';var client=require('../client');exports[_0x737a('0x0')]=function(_0x590c1e){return client[_0x737a('0x1')](_0x737a('0x2'),{'body':_0x590c1e,'log':_0x737a('0x3')});}; \ No newline at end of file +var _0x5dda=['createFaxMessage','create','Request'];(function(_0x456992,_0x47eb6f){var _0x324a28=function(_0x3b24a7){while(--_0x3b24a7){_0x456992['push'](_0x456992['shift']());}};_0x324a28(++_0x47eb6f);}(_0x5dda,0xbe));var _0xa5dd=function(_0xdd33d8,_0x33aeed){_0xdd33d8=_0xdd33d8-0x0;var _0x33fe79=_0x5dda[_0xdd33d8];return _0x33fe79;};'use strict';var client=require('../client');exports[_0xa5dd('0x0')]=function(_0xe591e7){return client[_0xa5dd('0x1')]('CreateFaxMessage',{'body':_0xe591e7,'log':_0xa5dd('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index 4736297..051ab7a 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 _0x0dca=['../client','getFaxQueues','GetFaxQueue','name','timeout','User','Agents','online','faxPause'];(function(_0x18f592,_0x415349){var _0x59182c=function(_0x31c68d){while(--_0x31c68d){_0x18f592['push'](_0x18f592['shift']());}};_0x59182c(++_0x415349);}(_0x0dca,0x87));var _0xa0dc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0dca[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0xa0dc('0x0'));exports[_0xa0dc('0x1')]=function(){return function(){return client['Request'](_0xa0dc('0x2'),{'options':{'raw':![],'attributes':['id',_0xa0dc('0x3'),_0xa0dc('0x4'),'strategy'],'include':[{'model':_0xa0dc('0x5'),'as':_0xa0dc('0x6'),'attributes':['id',_0xa0dc('0x3'),_0xa0dc('0x7'),_0xa0dc('0x8')]}]},'log':_0xa0dc('0x1')});};}; \ No newline at end of file +var _0xd43a=['name','timeout','strategy','User','Agents','faxPause','getFaxQueues','../client','GetFaxQueue'];(function(_0x40911a,_0x55ec99){var _0x27e8e3=function(_0x2ba910){while(--_0x2ba910){_0x40911a['push'](_0x40911a['shift']());}};_0x27e8e3(++_0x55ec99);}(_0xd43a,0x97));var _0xad43=function(_0x2349ef,_0x27f764){_0x2349ef=_0x2349ef-0x0;var _0x327974=_0xd43a[_0x2349ef];return _0x327974;};'use strict';var client=require(_0xad43('0x0'));exports['getFaxQueues']=function(){return function(){return client['Request'](_0xad43('0x1'),{'options':{'raw':![],'attributes':['id',_0xad43('0x2'),_0xad43('0x3'),_0xad43('0x4')],'include':[{'model':_0xad43('0x5'),'as':_0xad43('0x6'),'attributes':['id',_0xad43('0x2'),'online',_0xad43('0x7')]}]},'log':_0xad43('0x8')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index dd26024..308fe5e 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 _0x3116=['UpdateFaxQueueReport','DESC','../client','create','Request','CreateFaxQueueReport','update'];(function(_0x26a39a,_0x55dad0){var _0x21ed8e=function(_0x17afc2){while(--_0x17afc2){_0x26a39a['push'](_0x26a39a['shift']());}};_0x21ed8e(++_0x55dad0);}(_0x3116,0x1bb));var _0x6311=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0x3116[_0x30ae5e];return _0x1f2e93;};'use strict';var client=require(_0x6311('0x0'));exports[_0x6311('0x1')]=function(_0x35ed5e){return client[_0x6311('0x2')](_0x6311('0x3'),{'body':_0x35ed5e,'log':_0x6311('0x3')});};exports[_0x6311('0x4')]=function(_0xecd150,_0x37a9d3){return client[_0x6311('0x2')](_0x6311('0x5'),{'body':_0x37a9d3,'options':{'where':{'uniqueid':_0xecd150},'order':[['id',_0x6311('0x6')]],'limit':0x1},'log':_0x6311('0x5')});}; \ No newline at end of file +var _0x0e2f=['create','Request','CreateFaxQueueReport','update','UpdateFaxQueueReport','DESC','../client'];(function(_0xb2e8a1,_0xb182c1){var _0x485fd1=function(_0x588416){while(--_0x588416){_0xb2e8a1['push'](_0xb2e8a1['shift']());}};_0x485fd1(++_0xb182c1);}(_0x0e2f,0x1db));var _0xf0e2=function(_0x4b454f,_0x36fdc5){_0x4b454f=_0x4b454f-0x0;var _0x4cfb53=_0x0e2f[_0x4b454f];return _0x4cfb53;};'use strict';var client=require(_0xf0e2('0x0'));exports[_0xf0e2('0x1')]=function(_0x1eee15){return client[_0xf0e2('0x2')](_0xf0e2('0x3'),{'body':_0x1eee15,'log':_0xf0e2('0x3')});};exports[_0xf0e2('0x4')]=function(_0x10c487,_0x2bbd61){return client['Request'](_0xf0e2('0x5'),{'body':_0x2bbd61,'options':{'where':{'uniqueid':_0x10c487},'order':[['id',_0xf0e2('0x6')]],'limit':0x1},'log':_0xf0e2('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index 5c047cd..b5a3575 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 _0x7f4d=['name','../client','getIntervals'];(function(_0x236681,_0x40042d){var _0x309e3a=function(_0x22e8d5){while(--_0x22e8d5){_0x236681['push'](_0x236681['shift']());}};_0x309e3a(++_0x40042d);}(_0x7f4d,0xac));var _0xd7f4=function(_0x47a08f,_0x3e3387){_0x47a08f=_0x47a08f-0x0;var _0x23f254=_0x7f4d[_0x47a08f];return _0x23f254;};'use strict';var client=require(_0xd7f4('0x0'));exports[_0xd7f4('0x1')]=function(){return function(){return client['Request']('GetInterval',{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0xd7f4('0x2')],'include':[{'model':'Interval','as':'Intervals','attributes':['id',_0xd7f4('0x2'),'interval']}]},'log':_0xd7f4('0x1')});};}; \ No newline at end of file +var _0x7a1f=['GetInterval','name','Interval','Intervals','interval','../client','getIntervals','Request'];(function(_0x1be0b8,_0x2fed13){var _0x5960fd=function(_0x5d8e0b){while(--_0x5d8e0b){_0x1be0b8['push'](_0x1be0b8['shift']());}};_0x5960fd(++_0x2fed13);}(_0x7a1f,0x15d));var _0xf7a1=function(_0x31e5cb,_0x2f5adf){_0x31e5cb=_0x31e5cb-0x0;var _0x4170df=_0x7a1f[_0x31e5cb];return _0x4170df;};'use strict';var client=require(_0xf7a1('0x0'));exports[_0xf7a1('0x1')]=function(){return function(){return client[_0xf7a1('0x2')](_0xf7a1('0x3'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0xf7a1('0x4')],'include':[{'model':_0xf7a1('0x5'),'as':_0xf7a1('0x6'),'attributes':['id','name',_0xf7a1('0x7')]}]},'log':_0xf7a1('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index c6f705c..e910a6a 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 _0x5c3c=['AddTagsToMailInteraction','addTagsToChatInteraction','../client','update','UpdateMailInteraction','updateMailInteraction','addTags','Request'];(function(_0x27ad17,_0x57a014){var _0x136909=function(_0x2855e7){while(--_0x2855e7){_0x27ad17['push'](_0x27ad17['shift']());}};_0x136909(++_0x57a014);}(_0x5c3c,0x132));var _0xc5c3=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0x5c3c[_0x2f3848];return _0x102668;};'use strict';var client=require(_0xc5c3('0x0'));exports[_0xc5c3('0x1')]=function(_0x11705d,_0x32103c){return client['Request'](_0xc5c3('0x2'),{'body':_0x32103c,'options':{'where':{'id':_0x11705d}},'log':_0xc5c3('0x3')});};exports[_0xc5c3('0x4')]=function(_0x2a3649,_0x2535e0){return client[_0xc5c3('0x5')](_0xc5c3('0x6'),{'body':_0x2535e0,'options':{'where':{'id':_0x2a3649}},'log':_0xc5c3('0x7')});}; \ No newline at end of file +var _0xb78e=['addTags','addTagsToChatInteraction','../client','update','Request','UpdateMailInteraction','updateMailInteraction'];(function(_0xf7ad09,_0x1b65c0){var _0x22f373=function(_0x43e88e){while(--_0x43e88e){_0xf7ad09['push'](_0xf7ad09['shift']());}};_0x22f373(++_0x1b65c0);}(_0xb78e,0x1c9));var _0xeb78=function(_0x1f1d36,_0x301368){_0x1f1d36=_0x1f1d36-0x0;var _0x4f537c=_0xb78e[_0x1f1d36];return _0x4f537c;};'use strict';var client=require(_0xeb78('0x0'));exports[_0xeb78('0x1')]=function(_0x4b8534,_0x1570f5){return client[_0xeb78('0x2')](_0xeb78('0x3'),{'body':_0x1570f5,'options':{'where':{'id':_0x4b8534}},'log':_0xeb78('0x4')});};exports[_0xeb78('0x5')]=function(_0x308d12,_0x13ef9d){return client[_0xeb78('0x2')]('AddTagsToMailInteraction',{'body':_0x13ef9d,'options':{'where':{'id':_0x308d12}},'log':_0xeb78('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index fffd450..b62f35f 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 _0x341a=['create','createMailMessage'];(function(_0x3b14ce,_0x266022){var _0x4d4217=function(_0x32b1f7){while(--_0x32b1f7){_0x3b14ce['push'](_0x3b14ce['shift']());}};_0x4d4217(++_0x266022);}(_0x341a,0x146));var _0xa341=function(_0x294b0c,_0x459794){_0x294b0c=_0x294b0c-0x0;var _0x31f487=_0x341a[_0x294b0c];return _0x31f487;};'use strict';var client=require('../client');exports[_0xa341('0x0')]=function(_0x274db4){return client['Request']('CreateMailMessage',{'body':_0x274db4,'log':_0xa341('0x1')});}; \ No newline at end of file +var _0x369f=['Request','createMailMessage','create'];(function(_0x5375fd,_0x50887f){var _0x142671=function(_0x1f6139){while(--_0x1f6139){_0x5375fd['push'](_0x5375fd['shift']());}};_0x142671(++_0x50887f);}(_0x369f,0x74));var _0xf369=function(_0xf08d5,_0x18a9bf){_0xf08d5=_0xf08d5-0x0;var _0x4f8c83=_0x369f[_0xf08d5];return _0x4f8c83;};'use strict';var client=require('../client');exports[_0xf369('0x0')]=function(_0xd8aeca){return client[_0xf369('0x1')]('CreateMailMessage',{'body':_0xd8aeca,'log':_0xf369('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index d4b7b8f..faaf5d6 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 _0x39af=['timeout','strategy','User','Agents','online','../client','getMailQueues','Request','name'];(function(_0x307086,_0x3bfe4e){var _0x699043=function(_0x1a7677){while(--_0x1a7677){_0x307086['push'](_0x307086['shift']());}};_0x699043(++_0x3bfe4e);}(_0x39af,0xc2));var _0xf39a=function(_0x448bbd,_0x2133ba){_0x448bbd=_0x448bbd-0x0;var _0x148d81=_0x39af[_0x448bbd];return _0x148d81;};'use strict';var client=require(_0xf39a('0x0'));exports[_0xf39a('0x1')]=function(){return function(){return client[_0xf39a('0x2')]('GetMailQueue',{'options':{'raw':![],'attributes':['id',_0xf39a('0x3'),_0xf39a('0x4'),_0xf39a('0x5')],'include':[{'model':_0xf39a('0x6'),'as':_0xf39a('0x7'),'attributes':['id',_0xf39a('0x3'),_0xf39a('0x8'),'mailPause']}]},'log':_0xf39a('0x1')});};}; \ No newline at end of file +var _0x5d1b=['Agents','online','mailPause','GetMailQueue','name','timeout','strategy'];(function(_0xa8f24a,_0x48d7d3){var _0x3a1471=function(_0x281470){while(--_0x281470){_0xa8f24a['push'](_0xa8f24a['shift']());}};_0x3a1471(++_0x48d7d3);}(_0x5d1b,0x176));var _0xb5d1=function(_0x134350,_0x4052ce){_0x134350=_0x134350-0x0;var _0x23ba4e=_0x5d1b[_0x134350];return _0x23ba4e;};'use strict';var client=require('../client');exports['getMailQueues']=function(){return function(){return client['Request'](_0xb5d1('0x0'),{'options':{'raw':![],'attributes':['id',_0xb5d1('0x1'),_0xb5d1('0x2'),_0xb5d1('0x3')],'include':[{'model':'User','as':_0xb5d1('0x4'),'attributes':['id','name',_0xb5d1('0x5'),_0xb5d1('0x6')]}]},'log':'getMailQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index 6c24b61..bc4c622 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 _0x4771=['UpdateMailQueueReport','create','Request','CreateMailQueueReport'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x4771,0xe1));var _0x1477=function(_0x12f688,_0x585c25){_0x12f688=_0x12f688-0x0;var _0x59c3de=_0x4771[_0x12f688];return _0x59c3de;};'use strict';var client=require('../client');exports[_0x1477('0x0')]=function(_0x8f6c46){return client[_0x1477('0x1')]('CreateMailQueueReport',{'body':_0x8f6c46,'log':_0x1477('0x2')});};exports['update']=function(_0x32f3df,_0x26f676){return client['Request'](_0x1477('0x3'),{'body':_0x26f676,'options':{'where':{'uniqueid':_0x32f3df},'order':[['id','DESC']],'limit':0x1},'log':'UpdateMailQueueReport'});}; \ No newline at end of file +var _0x0d1d=['update','UpdateMailQueueReport','../client','Request','CreateMailQueueReport'];(function(_0xc5da07,_0x4cd1ce){var _0x1afaf4=function(_0x19cf5f){while(--_0x19cf5f){_0xc5da07['push'](_0xc5da07['shift']());}};_0x1afaf4(++_0x4cd1ce);}(_0x0d1d,0x1c4));var _0xd0d1=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x0d1d[_0x14add3];return _0x4a174f;};'use strict';var client=require(_0xd0d1('0x0'));exports['create']=function(_0x1a7ee8){return client[_0xd0d1('0x1')](_0xd0d1('0x2'),{'body':_0x1a7ee8,'log':'CreateMailQueueReport'});};exports[_0xd0d1('0x3')]=function(_0x4745e5,_0xb618fe){return client[_0xd0d1('0x1')](_0xd0d1('0x4'),{'body':_0xb618fe,'options':{'where':{'uniqueid':_0x4745e5},'order':[['id','DESC']],'limit':0x1},'log':_0xd0d1('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index 767bd18..2e4eb97 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 _0xbf34=['../client','update','Request','UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTags','AddTagsToOpenchannelInteraction'];(function(_0x3562bc,_0x3a3622){var _0x27e1d=function(_0x235ddf){while(--_0x235ddf){_0x3562bc['push'](_0x3562bc['shift']());}};_0x27e1d(++_0x3a3622);}(_0xbf34,0x85));var _0x4bf3=function(_0x28f0f7,_0x5e43cb){_0x28f0f7=_0x28f0f7-0x0;var _0x14eabb=_0xbf34[_0x28f0f7];return _0x14eabb;};'use strict';var client=require(_0x4bf3('0x0'));exports[_0x4bf3('0x1')]=function(_0x49eed5,_0x1543b3){return client[_0x4bf3('0x2')](_0x4bf3('0x3'),{'body':_0x1543b3,'options':{'where':{'id':_0x49eed5}},'log':_0x4bf3('0x4')});};exports[_0x4bf3('0x5')]=function(_0x46c160,_0x286976){return client[_0x4bf3('0x2')](_0x4bf3('0x6'),{'body':_0x286976,'options':{'where':{'id':_0x46c160}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file +var _0x601d=['AddTagsToOpenchannelInteraction','UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTags'];(function(_0x5949eb,_0x58de4b){var _0x2ce355=function(_0x90a51){while(--_0x90a51){_0x5949eb['push'](_0x5949eb['shift']());}};_0x2ce355(++_0x58de4b);}(_0x601d,0x1a5));var _0xd601=function(_0x28e671,_0x35bcdd){_0x28e671=_0x28e671-0x0;var _0x231c0e=_0x601d[_0x28e671];return _0x231c0e;};'use strict';var client=require('../client');exports['update']=function(_0x58ca5f,_0x439cd3){return client['Request'](_0xd601('0x0'),{'body':_0x439cd3,'options':{'where':{'id':_0x58ca5f}},'log':_0xd601('0x1')});};exports[_0xd601('0x2')]=function(_0x5c3964,_0x27700b){return client['Request'](_0xd601('0x3'),{'body':_0x27700b,'options':{'where':{'id':_0x5c3964}},'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 91bf1d3..902c5f2 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 _0x51eb=['create','Request','CreateOpenchannelMessage','createOpenchannelMessage','../client'];(function(_0x3ab9ee,_0x4a74b8){var _0x82ee88=function(_0x6ccc7e){while(--_0x6ccc7e){_0x3ab9ee['push'](_0x3ab9ee['shift']());}};_0x82ee88(++_0x4a74b8);}(_0x51eb,0x1b7));var _0xb51e=function(_0x1db1ba,_0x5cb627){_0x1db1ba=_0x1db1ba-0x0;var _0x26902b=_0x51eb[_0x1db1ba];return _0x26902b;};'use strict';var client=require(_0xb51e('0x0'));exports[_0xb51e('0x1')]=function(_0x138518){return client[_0xb51e('0x2')](_0xb51e('0x3'),{'body':_0x138518,'log':_0xb51e('0x4')});}; \ No newline at end of file +var _0x523c=['createOpenchannelMessage','../client','create','Request','CreateOpenchannelMessage'];(function(_0x28df95,_0x5f2cc6){var _0x208531=function(_0x100823){while(--_0x100823){_0x28df95['push'](_0x28df95['shift']());}};_0x208531(++_0x5f2cc6);}(_0x523c,0xdd));var _0xc523=function(_0x3a132d,_0x2de36f){_0x3a132d=_0x3a132d-0x0;var _0x8c554e=_0x523c[_0x3a132d];return _0x8c554e;};'use strict';var client=require(_0xc523('0x0'));exports[_0xc523('0x1')]=function(_0x1c0457){return client[_0xc523('0x2')](_0xc523('0x3'),{'body':_0x1c0457,'log':_0xc523('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index e826beb..864741f 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 _0xbe99=['openchannelPause','../client','getOpenchannelQueues','Request','GetOpenchannelQueue','name','strategy','Agents','online'];(function(_0x336b42,_0x347fa1){var _0x125eab=function(_0x5daa98){while(--_0x5daa98){_0x336b42['push'](_0x336b42['shift']());}};_0x125eab(++_0x347fa1);}(_0xbe99,0x196));var _0x9be9=function(_0x3e451f,_0x10500d){_0x3e451f=_0x3e451f-0x0;var _0x57978f=_0xbe99[_0x3e451f];return _0x57978f;};'use strict';var client=require(_0x9be9('0x0'));exports[_0x9be9('0x1')]=function(){return function(){return client[_0x9be9('0x2')](_0x9be9('0x3'),{'options':{'raw':![],'attributes':['id',_0x9be9('0x4'),'timeout',_0x9be9('0x5')],'include':[{'model':'User','as':_0x9be9('0x6'),'attributes':['id',_0x9be9('0x4'),_0x9be9('0x7'),_0x9be9('0x8')]}]},'log':'getOpenchannelQueues'});};}; \ No newline at end of file +var _0x914c=['../client','getOpenchannelQueues','Request','GetOpenchannelQueue','name','timeout','strategy','User','Agents','online'];(function(_0x2a026a,_0x22d20a){var _0x1fac8f=function(_0x12173c){while(--_0x12173c){_0x2a026a['push'](_0x2a026a['shift']());}};_0x1fac8f(++_0x22d20a);}(_0x914c,0x122));var _0xc914=function(_0x262323,_0x4a81f1){_0x262323=_0x262323-0x0;var _0xa963c3=_0x914c[_0x262323];return _0xa963c3;};'use strict';var client=require(_0xc914('0x0'));exports[_0xc914('0x1')]=function(){return function(){return client[_0xc914('0x2')](_0xc914('0x3'),{'options':{'raw':![],'attributes':['id',_0xc914('0x4'),_0xc914('0x5'),_0xc914('0x6')],'include':[{'model':_0xc914('0x7'),'as':_0xc914('0x8'),'attributes':['id',_0xc914('0x4'),_0xc914('0x9'),'openchannelPause']}]},'log':_0xc914('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index fefa848..a83e905 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 _0xa149=['CreateOpenchannelQueueReport','update','UpdateOpenchannelQueueReport','DESC','../client','create','Request'];(function(_0x4387d1,_0x3fba5e){var _0x254bc7=function(_0x18aa2d){while(--_0x18aa2d){_0x4387d1['push'](_0x4387d1['shift']());}};_0x254bc7(++_0x3fba5e);}(_0xa149,0x18c));var _0x9a14=function(_0x383323,_0x370b99){_0x383323=_0x383323-0x0;var _0x48a642=_0xa149[_0x383323];return _0x48a642;};'use strict';var client=require(_0x9a14('0x0'));exports[_0x9a14('0x1')]=function(_0x2e9626){return client[_0x9a14('0x2')](_0x9a14('0x3'),{'body':_0x2e9626,'log':_0x9a14('0x3')});};exports[_0x9a14('0x4')]=function(_0x3262b2,_0x3b061a){return client['Request'](_0x9a14('0x5'),{'body':_0x3b061a,'options':{'where':{'uniqueid':_0x3262b2},'order':[['id',_0x9a14('0x6')]],'limit':0x1},'log':'UpdateOpenchannelQueueReport'});}; \ No newline at end of file +var _0x34f9=['UpdateOpenchannelQueueReport','../client','create','Request','CreateOpenchannelQueueReport'];(function(_0xb7938,_0x21ca5e){var _0x33ec18=function(_0x3af2d4){while(--_0x3af2d4){_0xb7938['push'](_0xb7938['shift']());}};_0x33ec18(++_0x21ca5e);}(_0x34f9,0xfb));var _0x934f=function(_0x1337e2,_0x48ac4f){_0x1337e2=_0x1337e2-0x0;var _0x3405a9=_0x34f9[_0x1337e2];return _0x3405a9;};'use strict';var client=require(_0x934f('0x0'));exports[_0x934f('0x1')]=function(_0x92df74){return client[_0x934f('0x2')](_0x934f('0x3'),{'body':_0x92df74,'log':_0x934f('0x3')});};exports['update']=function(_0x10c358,_0x3a473b){return client[_0x934f('0x2')](_0x934f('0x4'),{'body':_0x3a473b,'options':{'where':{'uniqueid':_0x10c358},'order':[['id','DESC']],'limit':0x1},'log':_0x934f('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index a59dfb1..d65edeb 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 _0xbe22=['addTagsToSmsInteraction','../client','update','Request','UpdateSmsInteraction','updateSmsInteraction','addTags','AddTagsToSmsInteraction'];(function(_0x309131,_0x162b59){var _0x5d0236=function(_0x3a408e){while(--_0x3a408e){_0x309131['push'](_0x309131['shift']());}};_0x5d0236(++_0x162b59);}(_0xbe22,0x1c1));var _0x2be2=function(_0x25047d,_0x36f237){_0x25047d=_0x25047d-0x0;var _0x1e65eb=_0xbe22[_0x25047d];return _0x1e65eb;};'use strict';var client=require(_0x2be2('0x0'));exports[_0x2be2('0x1')]=function(_0x501bc2,_0x49a0a2){return client[_0x2be2('0x2')](_0x2be2('0x3'),{'body':_0x49a0a2,'options':{'where':{'id':_0x501bc2}},'log':_0x2be2('0x4')});};exports[_0x2be2('0x5')]=function(_0x1729d7,_0x250c97){return client[_0x2be2('0x2')](_0x2be2('0x6'),{'body':_0x250c97,'options':{'where':{'id':_0x1729d7}},'log':_0x2be2('0x7')});}; \ No newline at end of file +var _0x202c=['addTagsToSmsInteraction','../client','Request','UpdateSmsInteraction','addTags'];(function(_0x2c0ded,_0x3de22c){var _0x4473e5=function(_0x3705bc){while(--_0x3705bc){_0x2c0ded['push'](_0x2c0ded['shift']());}};_0x4473e5(++_0x3de22c);}(_0x202c,0x178));var _0xc202=function(_0x2ce5b1,_0x5c0e63){_0x2ce5b1=_0x2ce5b1-0x0;var _0x363b4b=_0x202c[_0x2ce5b1];return _0x363b4b;};'use strict';var client=require(_0xc202('0x0'));exports['update']=function(_0x5c306e,_0x1cf3fd){return client[_0xc202('0x1')](_0xc202('0x2'),{'body':_0x1cf3fd,'options':{'where':{'id':_0x5c306e}},'log':'updateSmsInteraction'});};exports[_0xc202('0x3')]=function(_0x155c3b,_0x1763f5){return client[_0xc202('0x1')]('AddTagsToSmsInteraction',{'body':_0x1763f5,'options':{'where':{'id':_0x155c3b}},'log':_0xc202('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index 0b45b43..4780b93 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 _0x875c=['CreateSmsMessage','../client','create','Request'];(function(_0x158c70,_0x3b5fd2){var _0x31880a=function(_0x5bc2dd){while(--_0x5bc2dd){_0x158c70['push'](_0x158c70['shift']());}};_0x31880a(++_0x3b5fd2);}(_0x875c,0x121));var _0xc875=function(_0x322229,_0x1e0a9c){_0x322229=_0x322229-0x0;var _0x5ab73d=_0x875c[_0x322229];return _0x5ab73d;};'use strict';var client=require(_0xc875('0x0'));exports[_0xc875('0x1')]=function(_0x2deff4){return client[_0xc875('0x2')](_0xc875('0x3'),{'body':_0x2deff4,'log':'createSmsMessage'});}; \ No newline at end of file +var _0x7025=['CreateSmsMessage','create','Request'];(function(_0x46f6fb,_0x1c6ec3){var _0xf3de6a=function(_0x48ce5e){while(--_0x48ce5e){_0x46f6fb['push'](_0x46f6fb['shift']());}};_0xf3de6a(++_0x1c6ec3);}(_0x7025,0x1b1));var _0x5702=function(_0x1ba9ba,_0x1d6ee1){_0x1ba9ba=_0x1ba9ba-0x0;var _0x5f2277=_0x7025[_0x1ba9ba];return _0x5f2277;};'use strict';var client=require('../client');exports[_0x5702('0x0')]=function(_0x54db3e){return client[_0x5702('0x1')](_0x5702('0x2'),{'body':_0x54db3e,'log':'createSmsMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index ebfc2a0..d451c71 100644 --- a/server/services/routing/rpc/smsQueue.js +++ b/server/services/routing/rpc/smsQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb7e7=['online','../client','Request','name','strategy','Agents'];(function(_0x35dcb7,_0x5a7582){var _0x59ff2d=function(_0x47f039){while(--_0x47f039){_0x35dcb7['push'](_0x35dcb7['shift']());}};_0x59ff2d(++_0x5a7582);}(_0xb7e7,0x121));var _0x7b7e=function(_0x164eca,_0x555e28){_0x164eca=_0x164eca-0x0;var _0x2ce562=_0xb7e7[_0x164eca];return _0x2ce562;};'use strict';var client=require(_0x7b7e('0x0'));exports['getSmsQueues']=function(){return function(){return client[_0x7b7e('0x1')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id',_0x7b7e('0x2'),'timeout',_0x7b7e('0x3')],'include':[{'model':'User','as':_0x7b7e('0x4'),'attributes':['id',_0x7b7e('0x2'),_0x7b7e('0x5'),'smsPause']}]},'log':'getSmsQueues'});};}; \ No newline at end of file +var _0x9c44=['Request','GetSmsQueue','name','timeout','strategy','User','online','getSmsQueues'];(function(_0x33c9ad,_0x325903){var _0x25b1a1=function(_0x1e23fa){while(--_0x1e23fa){_0x33c9ad['push'](_0x33c9ad['shift']());}};_0x25b1a1(++_0x325903);}(_0x9c44,0x178));var _0x49c4=function(_0x3b0731,_0xcf9925){_0x3b0731=_0x3b0731-0x0;var _0x4204d7=_0x9c44[_0x3b0731];return _0x4204d7;};'use strict';var client=require('../client');exports['getSmsQueues']=function(){return function(){return client[_0x49c4('0x0')](_0x49c4('0x1'),{'options':{'raw':![],'attributes':['id',_0x49c4('0x2'),_0x49c4('0x3'),_0x49c4('0x4')],'include':[{'model':_0x49c4('0x5'),'as':'Agents','attributes':['id','name',_0x49c4('0x6'),'smsPause']}]},'log':_0x49c4('0x7')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index c8156a7..969792b 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(_0x3b407d,_0x19cbdb){var _0x1fec09=function(_0x50c9e4){while(--_0x50c9e4){_0x3b407d['push'](_0x3b407d['shift']());}};_0x1fec09(++_0x19cbdb);}(_0x008c,0x188));var _0xc008=function(_0x12b71a,_0x5a0f68){_0x12b71a=_0x12b71a-0x0;var _0xfa09c6=_0x008c[_0x12b71a];return _0xfa09c6;};'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 _0x55ca=['../client','create','CreateSmsQueueReport','update','Request','UpdateSmsQueueReport','DESC'];(function(_0xeef58d,_0x595f6c){var _0x32fe9d=function(_0x2ed2d8){while(--_0x2ed2d8){_0xeef58d['push'](_0xeef58d['shift']());}};_0x32fe9d(++_0x595f6c);}(_0x55ca,0x126));var _0xa55c=function(_0x49052b,_0x3ba709){_0x49052b=_0x49052b-0x0;var _0x48c045=_0x55ca[_0x49052b];return _0x48c045;};'use strict';var client=require(_0xa55c('0x0'));exports[_0xa55c('0x1')]=function(_0x4e78b4){return client['Request']('CreateSmsQueueReport',{'body':_0x4e78b4,'log':_0xa55c('0x2')});};exports[_0xa55c('0x3')]=function(_0x5dc716,_0x3b478a){return client[_0xa55c('0x4')](_0xa55c('0x5'),{'body':_0x3b478a,'options':{'where':{'uniqueid':_0x5dc716},'order':[['id',_0xa55c('0x6')]],'limit':0x1},'log':_0xa55c('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index 14b18a9..bc0583a 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(_0x5908b8,_0x544699){var _0xe24a76=function(_0x2bd33f){while(--_0x2bd33f){_0x5908b8['push'](_0x5908b8['shift']());}};_0xe24a76(++_0x544699);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xa9e0[_0x3947c9];return _0x2e7871;};'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(_0xedfbda,_0x1523fd){var _0x2b06fd=function(_0x4e32a9){while(--_0x4e32a9){_0xedfbda['push'](_0xedfbda['shift']());}};_0x2b06fd(++_0x1523fd);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2160a9,_0x3cbd9e){_0x2160a9=_0x2160a9-0x0;var _0xa88cf7=_0xa9e0[_0x2160a9];return _0xa88cf7;};'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 51933f4..b0f18a1 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 _0xaf11=['Request','AddTagsToWhatsappInteraction','../client','update','UpdateWhatsappInteraction','updateWhatsappInteraction','addTags'];(function(_0x5ac84c,_0x287781){var _0x3c53d2=function(_0x40cde0){while(--_0x40cde0){_0x5ac84c['push'](_0x5ac84c['shift']());}};_0x3c53d2(++_0x287781);}(_0xaf11,0x12f));var _0x1af1=function(_0x1ddcb1,_0x871729){_0x1ddcb1=_0x1ddcb1-0x0;var _0x5b742c=_0xaf11[_0x1ddcb1];return _0x5b742c;};'use strict';var client=require(_0x1af1('0x0'));exports[_0x1af1('0x1')]=function(_0x326da9,_0x1d0736){return client['Request'](_0x1af1('0x2'),{'body':_0x1d0736,'options':{'where':{'id':_0x326da9}},'log':_0x1af1('0x3')});};exports[_0x1af1('0x4')]=function(_0x53af48,_0xb0ace){return client[_0x1af1('0x5')](_0x1af1('0x6'),{'body':_0xb0ace,'options':{'where':{'id':_0x53af48}},'log':'addTagsToWhatsappInteraction'});}; \ No newline at end of file +var _0x0e4b=['../client','update','Request','addTagsToWhatsappInteraction'];(function(_0x499bcb,_0x2bc1c6){var _0x51c87f=function(_0x1cc9df){while(--_0x1cc9df){_0x499bcb['push'](_0x499bcb['shift']());}};_0x51c87f(++_0x2bc1c6);}(_0x0e4b,0xdc));var _0xb0e4=function(_0x546781,_0x151a58){_0x546781=_0x546781-0x0;var _0x366373=_0x0e4b[_0x546781];return _0x366373;};'use strict';var client=require(_0xb0e4('0x0'));exports[_0xb0e4('0x1')]=function(_0x65d4d1,_0x4dceb8){return client[_0xb0e4('0x2')]('UpdateWhatsappInteraction',{'body':_0x4dceb8,'options':{'where':{'id':_0x65d4d1}},'log':'updateWhatsappInteraction'});};exports['addTags']=function(_0x538147,_0x79717e){return client[_0xb0e4('0x2')]('AddTagsToWhatsappInteraction',{'body':_0x79717e,'options':{'where':{'id':_0x538147}},'log':_0xb0e4('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index d70506f..a6eddae 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 _0x9ed7=['CreateWhatsappMessage','createWhatsappMessage','create'];(function(_0x1f82e8,_0x1fb92f){var _0x522a64=function(_0x109071){while(--_0x109071){_0x1f82e8['push'](_0x1f82e8['shift']());}};_0x522a64(++_0x1fb92f);}(_0x9ed7,0x1c7));var _0x79ed=function(_0x4fdc46,_0x2a3759){_0x4fdc46=_0x4fdc46-0x0;var _0x2c178a=_0x9ed7[_0x4fdc46];return _0x2c178a;};'use strict';var client=require('../client');exports[_0x79ed('0x0')]=function(_0x142c7b){return client['Request'](_0x79ed('0x1'),{'body':_0x142c7b,'log':_0x79ed('0x2')});}; \ No newline at end of file +var _0x6427=['Request','../client','create'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x6427,0x9d));var _0x7642=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x6427[_0x618414];return _0x21c19a;};'use strict';var client=require(_0x7642('0x0'));exports[_0x7642('0x1')]=function(_0x54078f){return client[_0x7642('0x2')]('CreateWhatsappMessage',{'body':_0x54078f,'log':'createWhatsappMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index c2c55cd..25d2357 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 _0xaa3b=['GetWhatsappQueue','name','whatsappPause','../client','getWhatsappQueues'];(function(_0x1b3235,_0x39d7ff){var _0x4af933=function(_0x1ff9c5){while(--_0x1ff9c5){_0x1b3235['push'](_0x1b3235['shift']());}};_0x4af933(++_0x39d7ff);}(_0xaa3b,0xf8));var _0xbaa3=function(_0x7f1644,_0x268f86){_0x7f1644=_0x7f1644-0x0;var _0x5518b0=_0xaa3b[_0x7f1644];return _0x5518b0;};'use strict';var client=require(_0xbaa3('0x0'));exports[_0xbaa3('0x1')]=function(){return function(){return client['Request'](_0xbaa3('0x2'),{'options':{'raw':![],'attributes':['id',_0xbaa3('0x3'),'timeout','strategy'],'include':[{'model':'User','as':'Agents','attributes':['id',_0xbaa3('0x3'),'online',_0xbaa3('0x4')]}]},'log':_0xbaa3('0x1')});};}; \ No newline at end of file +var _0x5d57=['User','Agents','whatsappPause','getWhatsappQueues','Request','GetWhatsappQueue','name','timeout','strategy'];(function(_0x4d8ed9,_0x2ae284){var _0x1e2140=function(_0x9cca89){while(--_0x9cca89){_0x4d8ed9['push'](_0x4d8ed9['shift']());}};_0x1e2140(++_0x2ae284);}(_0x5d57,0x186));var _0x75d5=function(_0x217361,_0x3162e2){_0x217361=_0x217361-0x0;var _0x2fd76b=_0x5d57[_0x217361];return _0x2fd76b;};'use strict';var client=require('../client');exports[_0x75d5('0x0')]=function(){return function(){return client[_0x75d5('0x1')](_0x75d5('0x2'),{'options':{'raw':![],'attributes':['id',_0x75d5('0x3'),_0x75d5('0x4'),_0x75d5('0x5')],'include':[{'model':_0x75d5('0x6'),'as':_0x75d5('0x7'),'attributes':['id',_0x75d5('0x3'),'online',_0x75d5('0x8')]}]},'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 0c2d91e..efda046 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 _0xb061=['create','Request','update','UpdateWhatsappQueueReport','DESC','../client'];(function(_0x4f9652,_0x13a982){var _0x9a85e4=function(_0x1048da){while(--_0x1048da){_0x4f9652['push'](_0x4f9652['shift']());}};_0x9a85e4(++_0x13a982);}(_0xb061,0xd1));var _0x1b06=function(_0x170a07,_0x4917dc){_0x170a07=_0x170a07-0x0;var _0x4525f7=_0xb061[_0x170a07];return _0x4525f7;};'use strict';var client=require(_0x1b06('0x0'));exports[_0x1b06('0x1')]=function(_0x16545a){return client[_0x1b06('0x2')]('CreateWhatsappQueueReport',{'body':_0x16545a,'log':'CreateWhatsappQueueReport'});};exports[_0x1b06('0x3')]=function(_0x4bedf0,_0x5f1f98){return client[_0x1b06('0x2')](_0x1b06('0x4'),{'body':_0x5f1f98,'options':{'where':{'uniqueid':_0x4bedf0},'order':[['id',_0x1b06('0x5')]],'limit':0x1},'log':'UpdateWhatsappQueueReport'});}; \ No newline at end of file +var _0x1bd2=['CreateWhatsappQueueReport','update','Request','UpdateWhatsappQueueReport','DESC','../client'];(function(_0x41e311,_0x451253){var _0x24750e=function(_0x567006){while(--_0x567006){_0x41e311['push'](_0x41e311['shift']());}};_0x24750e(++_0x451253);}(_0x1bd2,0x7d));var _0x21bd=function(_0x1deb03,_0xd05ad8){_0x1deb03=_0x1deb03-0x0;var _0x189fe7=_0x1bd2[_0x1deb03];return _0x189fe7;};'use strict';var client=require(_0x21bd('0x0'));exports['create']=function(_0x5f08b0){return client['Request']('CreateWhatsappQueueReport',{'body':_0x5f08b0,'log':_0x21bd('0x1')});};exports[_0x21bd('0x2')]=function(_0x354dc5,_0x2e4b52){return client[_0x21bd('0x3')](_0x21bd('0x4'),{'body':_0x2e4b52,'options':{'where':{'uniqueid':_0x354dc5},'order':[['id',_0x21bd('0x5')]],'limit':0x1},'log':_0x21bd('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 88e3a0a..1624381 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 _0x3055=['name','toLowerCase','length','error','map','message','join','stop','agents','timeout','channel','START:%s','end','[%s][AGENT]\x20ROUTING\x20STOPPED','close','rules','[%s][AGENT]\x20ROUTING\x20END','next','agent','log','[%s][QUEUE]\x20%s','stack','validate','lodash','util','routing','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','info','format','[%s][AGENT][NAME:%s][STATUS:%s]'];(function(_0x4866d2,_0x26e1bc){var _0x59e86b=function(_0x2327d9){while(--_0x2327d9){_0x4866d2['push'](_0x4866d2['shift']());}};_0x59e86b(++_0x26e1bc);}(_0x3055,0x79));var _0x5305=function(_0x1b65eb,_0x3f511f){_0x1b65eb=_0x1b65eb-0x0;var _0x33ff7b=_0x3055[_0x1b65eb];return _0x33ff7b;};'use strict';var schema=require(_0x5305('0x0'));var _=require(_0x5305('0x1'));var util=require(_0x5305('0x2'));var seqqueue=require('seq-queue');var logger=require('../../../../config/logger')(_0x5305('0x3'));var strategy=require(_0x5305('0x4'));var queue=schema({'name':{'type':_0x5305('0x5'),'required':!![],'message':_0x5305('0x6')},'timeout':{'type':_0x5305('0x7'),'message':'timeout\x20is\x20a\x20number'}});function writeLog(_0x41ab9c,_0x1d23f9,_0x31cb85){return logger[_0x5305('0x8')](util[_0x5305('0x9')](_0x5305('0xa'),_0x41ab9c,_0x1d23f9['name'],_0x31cb85));}function handleFindAgent(_0x366263){return function(_0x346a18){return _0x346a18[_0x5305('0xb')][_0x5305('0xc')]()===_0x366263[_0x5305('0xc')]();};}exports['consequence']=function(_0x4cde5f,_0x104ddb,_0x3446fa,_0x223111){return function(_0x34ca4e){try{var _0x3f67c5={'name':_0x104ddb[0x0],'timeout':_0x104ddb[0x1]};var _0x385f88=queue[_0x5305('0x0')](_0x3f67c5,{'typecast':!![]});if(_0x385f88[_0x5305('0xd')]){logger[_0x5305('0xe')]('[%s][AGENT]\x20%s',_0x4cde5f,_[_0x5305('0xf')](_0x385f88,_0x5305('0x10'))[_0x5305('0x11')](',\x20'));_0x34ca4e[_0x5305('0x12')]();}else{var _0x1d772c=_['find'](_0x3446fa[_0x5305('0x13')],handleFindAgent(_0x3f67c5[_0x5305('0xb')]));if(_0x1d772c){var _0x5184a1=(_0x3f67c5[_0x5305('0x14')]||0xa)*0x3e8;var _0x4e6ee8,_0x4b21f3;var _0x2b9f42=seqqueue['createQueue'](_0x5184a1);_0x2b9f42['id']=_0x4cde5f;_0x2b9f42['atimeout']=_0x5184a1;_0x2b9f42['channel']=_0x223111[_0x5305('0x15')];writeLog(_0x4cde5f,_0x1d772c,util[_0x5305('0x9')](_0x5305('0x16'),_0x5184a1));_0x3446fa['rules'][_0x4cde5f]['on'](_0x5305('0x17'),function(){logger['info'](_0x5305('0x18'),_0x4cde5f);clearTimeout(_0x4b21f3);_0x4b21f3=undefined;_0x2b9f42[_0x5305('0x19')]();if(_0x3446fa[_0x5305('0x1a')][_0x4cde5f]){delete _0x3446fa[_0x5305('0x1a')][_0x4cde5f];}_0x34ca4e[_0x5305('0x12')]();});_0x3446fa[_0x5305('0x1a')][_0x4cde5f]['on']('complete',function(){if(_0x3446fa[_0x5305('0x1a')][_0x4cde5f]){delete _0x3446fa[_0x5305('0x1a')][_0x4cde5f];}});_0x4b21f3=setTimeout(function(){logger[_0x5305('0x8')](_0x5305('0x1b'),_0x4cde5f);clearTimeout(_0x4b21f3);_0x2b9f42['close']();_0x34ca4e[_0x5305('0x1c')]();},_0x5184a1);strategy[_0x5305('0x1d')](_0x2b9f42,_0x1d772c,_0x3446fa,_0x223111);}else{logger[_0x5305('0xe')]('[%s][AGENT]\x20agent\x20not\x20found\x20%s',_0x4cde5f,_0x3f67c5[_0x5305('0xb')]);_0x34ca4e[_0x5305('0x12')]();}}}catch(_0x2009df){console[_0x5305('0x1e')](_0x2009df);logger[_0x5305('0xe')](_0x5305('0x1f'),_0x4cde5f,_0x2009df[_0x5305('0x20')]);_0x34ca4e[_0x5305('0x12')]();}};}; \ No newline at end of file +var _0x81fa=['length','error','[%s][AGENT]\x20%s','map','message','stop','find','agents','timeout','createQueue','channel','format','START:%s','info','[%s][AGENT]\x20ROUTING\x20STOPPED','close','rules','complete','next','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','stack','validate','lodash','util','seq-queue','../../../../config/logger','routing','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence'];(function(_0x1aa981,_0x45eb1a){var _0x332fd6=function(_0x4f155c){while(--_0x4f155c){_0x1aa981['push'](_0x1aa981['shift']());}};_0x332fd6(++_0x45eb1a);}(_0x81fa,0xab));var _0xa81f=function(_0x3cc751,_0x38b8ff){_0x3cc751=_0x3cc751-0x0;var _0x3956a2=_0x81fa[_0x3cc751];return _0x3956a2;};'use strict';var schema=require(_0xa81f('0x0'));var _=require(_0xa81f('0x1'));var util=require(_0xa81f('0x2'));var seqqueue=require(_0xa81f('0x3'));var logger=require(_0xa81f('0x4'))(_0xa81f('0x5'));var strategy=require(_0xa81f('0x6'));var queue=schema({'name':{'type':_0xa81f('0x7'),'required':!![],'message':_0xa81f('0x8')},'timeout':{'type':_0xa81f('0x9'),'message':'timeout\x20is\x20a\x20number'}});function writeLog(_0x45ddd9,_0x58257b,_0x31f4b1){return logger['info'](util['format'](_0xa81f('0xa'),_0x45ddd9,_0x58257b[_0xa81f('0xb')],_0x31f4b1));}function handleFindAgent(_0x32035f){return function(_0x7d2be4){return _0x7d2be4[_0xa81f('0xb')][_0xa81f('0xc')]()===_0x32035f[_0xa81f('0xc')]();};}exports[_0xa81f('0xd')]=function(_0x4546ff,_0x127c41,_0x5c1659,_0x31158b){return function(_0x5eeca4){try{var _0x58df82={'name':_0x127c41[0x0],'timeout':_0x127c41[0x1]};var _0x1ac41c=queue['validate'](_0x58df82,{'typecast':!![]});if(_0x1ac41c[_0xa81f('0xe')]){logger[_0xa81f('0xf')](_0xa81f('0x10'),_0x4546ff,_[_0xa81f('0x11')](_0x1ac41c,_0xa81f('0x12'))['join'](',\x20'));_0x5eeca4[_0xa81f('0x13')]();}else{var _0x4993f0=_[_0xa81f('0x14')](_0x5c1659[_0xa81f('0x15')],handleFindAgent(_0x58df82['name']));if(_0x4993f0){var _0x1d80af=(_0x58df82[_0xa81f('0x16')]||0xa)*0x3e8;var _0x329a83,_0x2fa034;var _0x431345=seqqueue[_0xa81f('0x17')](_0x1d80af);_0x431345['id']=_0x4546ff;_0x431345['atimeout']=_0x1d80af;_0x431345[_0xa81f('0x18')]=_0x31158b['channel'];writeLog(_0x4546ff,_0x4993f0,util[_0xa81f('0x19')](_0xa81f('0x1a'),_0x1d80af));_0x5c1659['rules'][_0x4546ff]['on']('end',function(){logger[_0xa81f('0x1b')](_0xa81f('0x1c'),_0x4546ff);clearTimeout(_0x2fa034);_0x2fa034=undefined;_0x431345[_0xa81f('0x1d')]();if(_0x5c1659[_0xa81f('0x1e')][_0x4546ff]){delete _0x5c1659[_0xa81f('0x1e')][_0x4546ff];}_0x5eeca4[_0xa81f('0x13')]();});_0x5c1659[_0xa81f('0x1e')][_0x4546ff]['on'](_0xa81f('0x1f'),function(){if(_0x5c1659[_0xa81f('0x1e')][_0x4546ff]){delete _0x5c1659[_0xa81f('0x1e')][_0x4546ff];}});_0x2fa034=setTimeout(function(){logger[_0xa81f('0x1b')]('[%s][AGENT]\x20ROUTING\x20END',_0x4546ff);clearTimeout(_0x2fa034);_0x431345[_0xa81f('0x1d')]();_0x5eeca4[_0xa81f('0x20')]();},_0x1d80af);strategy[_0xa81f('0x21')](_0x431345,_0x4993f0,_0x5c1659,_0x31158b);}else{logger[_0xa81f('0xf')](_0xa81f('0x22'),_0x4546ff,_0x58df82[_0xa81f('0xb')]);_0x5eeca4[_0xa81f('0x13')]();}}}catch(_0x5214d3){console[_0xa81f('0x23')](_0x5214d3);logger[_0xa81f('0xf')]('[%s][QUEUE]\x20%s',_0x4546ff,_0x5214d3[_0xa81f('0x24')]);_0x5eeca4['stop']();}};}; \ 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 3b289a0..dc79f44 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 _0x0377=['then','dialogState','Failed','moment','aws-sdk','../../../../config/logger','routing','../../rpc/smsMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','out','channel','whatsapp','phone','ChatWebsiteId','account','upperFirst','InteractionId','created','isEmpty','Message','body','catch','error','stringify','finally','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','$LATEST','message','amazonlex','providerName'];(function(_0x7932a3,_0x162645){var _0x4605ff=function(_0x3e81ed){while(--_0x3e81ed){_0x7932a3['push'](_0x7932a3['shift']());}};_0x4605ff(++_0x162645);}(_0x0377,0xa3));var _0x7037=function(_0x2bc395,_0x2af85c){_0x2bc395=_0x2bc395-0x0;var _0x1664cf=_0x0377[_0x2bc395];return _0x1664cf;};'use strict';var _=require('lodash');var moment=require(_0x7037('0x0'));var AWS=require(_0x7037('0x1'));var utils=require('./utils');var logger=require(_0x7037('0x2'))(_0x7037('0x3'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x7037('0x4')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x7037('0x5'))};exports[_0x7037('0x6')]=function(_0xef4de0,_0x56ad76){return function(_0x5cc833){try{if(!_[_0x7037('0x7')](this[_0x7037('0x8')][_0x7037('0x9')])){logger[_0x7037('0xa')](_0x7037('0xb'),_0xef4de0,_0x7037('0xc'));return _0x5cc833[_0x7037('0xd')]();}var _0x3a1dcb={'ContactId':this[_0x7037('0xe')]['id'],'sentAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x7037('0xf')};if(this['channel']==='sms'||this[_0x7037('0x10')]===_0x7037('0x11')){_0x3a1dcb[_0x7037('0x12')]=this[_0x7037('0x8')][_0x7037('0x12')];}var _0x2c5dc9=this[_0x7037('0x10')];if(_0x2c5dc9==='chat'){_0x3a1dcb[_0x7037('0x13')]=this[_0x7037('0x14')]['id'];}else{_0x3a1dcb[_['upperFirst'](_0x2c5dc9)+'AccountId']=this[_0x7037('0x14')]['id'];}_0x3a1dcb[_[_0x7037('0x15')](_0x2c5dc9)+_0x7037('0x16')]=this[_0x7037('0x8')]['id'];if(this[_0x7037('0x8')][_0x7037('0x17')]){var _0x2937b2=_0x56ad76[0x4];if(!_[_0x7037('0x18')](_0x2937b2)){_0x3a1dcb['body']=utils['getMustacheRender'](_0x2937b2,this);return rpc[_0x2c5dc9+_0x7037('0x19')]['create'](_0x3a1dcb)['then'](function(_0x5c60fd){logger[_0x7037('0xa')](_0x7037('0xb'),_0xef4de0,_0x3a1dcb[_0x7037('0x1a')]);})[_0x7037('0x1b')](function(_0x5adb5a){logger[_0x7037('0x1c')]('[%s][AMAZONLEX]\x20%s',_0xef4de0,JSON[_0x7037('0x1d')](_0x5adb5a));})[_0x7037('0x1e')](function(){logger[_0x7037('0xa')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0xef4de0);_0x5cc833[_0x7037('0x1f')]();});}else{logger[_0x7037('0xa')](_0x7037('0x20'),_0xef4de0);_0x5cc833[_0x7037('0x1f')]();}}else{var _0x6b5cc2=this;var _0x1996fc=new AWS['LexRuntime']({'accessKeyId':_0x56ad76[0x0],'secretAccessKey':_0x56ad76[0x1],'region':_0x56ad76[0x2]});var _0x44c7f8={'botAlias':_0x7037('0x21'),'botName':_0x56ad76[0x3],'inputText':this[_0x7037('0x22')][_0x7037('0x1a')],'userId':this[_0x7037('0x10')]+':'+this[_0x7037('0x8')]['id']['toString']()};_0x1996fc['postText'](_0x44c7f8,function(_0x42d743,_0x32b812){if(_0x42d743){logger[_0x7037('0x1c')](_0x7037('0xb'),_0xef4de0,_0x42d743[_0x7037('0x22')]);_0x5cc833[_0x7037('0xd')]();}else if(_0x32b812&&_0x32b812[_0x7037('0x22')]){_0x6b5cc2['body'][_0x7037('0x23')]=_0x32b812;_0x3a1dcb[_0x7037('0x1a')]=_0x32b812[_0x7037('0x22')];_0x3a1dcb[_0x7037('0x24')]=_0x7037('0x23');_0x3a1dcb['providerResponse']=JSON['stringify'](_0x32b812);return rpc[_0x2c5dc9+_0x7037('0x19')]['create'](_0x3a1dcb)[_0x7037('0x25')](function(_0xe29774){logger['info']('[%s][AMAZONLEX]\x20%s',_0xef4de0,_0x3a1dcb[_0x7037('0x1a')]);if(_0x32b812[_0x7037('0x26')]==_0x7037('0x27')){_0x5cc833[_0x7037('0xd')]();}else{_0x5cc833[_0x7037('0x1f')]();}})['catch'](function(_0x488832){logger['error'](_0x7037('0xb'),_0xef4de0,JSON[_0x7037('0x1d')](_0x488832));_0x5cc833['next']();});}else{_0x5cc833['next']();}});}}catch(_0x2695f2){logger[_0x7037('0x1c')](_0x7037('0xb'),_0xef4de0,JSON[_0x7037('0x1d')](_0x2695f2));_0x5cc833['stop']();}};}; \ No newline at end of file +var _0xef69=['error','amazonlex','providerName','providerResponse','Message','create','then','dialogState','moment','aws-sdk','./utils','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','consequence','isNil','interaction','info','[%s][AMAZONLEX]\x20%s','next','out','sms','channel','whatsapp','phone','chat','ChatWebsiteId','AccountId','created','body','getMustacheRender','catch','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','postText'];(function(_0x517aba,_0x4814e5){var _0x246abe=function(_0x36b7a9){while(--_0x36b7a9){_0x517aba['push'](_0x517aba['shift']());}};_0x246abe(++_0x4814e5);}(_0xef69,0x89));var _0x9ef6=function(_0x4b1665,_0xb0c095){_0x4b1665=_0x4b1665-0x0;var _0x5850c0=_0xef69[_0x4b1665];return _0x5850c0;};'use strict';var _=require('lodash');var moment=require(_0x9ef6('0x0'));var AWS=require(_0x9ef6('0x1'));var utils=require(_0x9ef6('0x2'));var logger=require('../../../../config/logger')(_0x9ef6('0x3'));var rpc={'chatMessage':require(_0x9ef6('0x4')),'openchannelMessage':require(_0x9ef6('0x5')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x9ef6('0x6')),'faxMessage':require(_0x9ef6('0x7')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0x9ef6('0x8')]=function(_0x455ede,_0x5d2694){return function(_0x8cb5ba){try{if(!_[_0x9ef6('0x9')](this[_0x9ef6('0xa')]['UserId'])){logger[_0x9ef6('0xb')](_0x9ef6('0xc'),_0x455ede,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x8cb5ba[_0x9ef6('0xd')]();}var _0x435ee6={'ContactId':this['contact']['id'],'sentAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x9ef6('0xe')};if(this['channel']===_0x9ef6('0xf')||this[_0x9ef6('0x10')]===_0x9ef6('0x11')){_0x435ee6[_0x9ef6('0x12')]=this['interaction'][_0x9ef6('0x12')];}var _0x2d7432=this[_0x9ef6('0x10')];if(_0x2d7432===_0x9ef6('0x13')){_0x435ee6[_0x9ef6('0x14')]=this['account']['id'];}else{_0x435ee6[_['upperFirst'](_0x2d7432)+_0x9ef6('0x15')]=this['account']['id'];}_0x435ee6[_['upperFirst'](_0x2d7432)+'InteractionId']=this['interaction']['id'];if(this[_0x9ef6('0xa')][_0x9ef6('0x16')]){var _0x4e120f=_0x5d2694[0x4];if(!_['isEmpty'](_0x4e120f)){_0x435ee6[_0x9ef6('0x17')]=utils[_0x9ef6('0x18')](_0x4e120f,this);return rpc[_0x2d7432+'Message']['create'](_0x435ee6)['then'](function(_0x1a6e52){logger[_0x9ef6('0xb')](_0x9ef6('0xc'),_0x455ede,_0x435ee6[_0x9ef6('0x17')]);})[_0x9ef6('0x19')](function(_0x45f602){logger['error'](_0x9ef6('0xc'),_0x455ede,JSON[_0x9ef6('0x1a')](_0x45f602));})[_0x9ef6('0x1b')](function(){logger['info'](_0x9ef6('0x1c'),_0x455ede);_0x8cb5ba[_0x9ef6('0x1d')]();});}else{logger[_0x9ef6('0xb')](_0x9ef6('0x1e'),_0x455ede);_0x8cb5ba['stop']();}}else{var _0x3f4554=this;var _0x2e68c5=new AWS[(_0x9ef6('0x1f'))]({'accessKeyId':_0x5d2694[0x0],'secretAccessKey':_0x5d2694[0x1],'region':_0x5d2694[0x2]});var _0x1253eb={'botAlias':_0x9ef6('0x20'),'botName':_0x5d2694[0x3],'inputText':this[_0x9ef6('0x21')][_0x9ef6('0x17')],'userId':this[_0x9ef6('0x10')]+':'+this[_0x9ef6('0xa')]['id']['toString']()};_0x2e68c5[_0x9ef6('0x22')](_0x1253eb,function(_0x39293a,_0x356b94){if(_0x39293a){logger[_0x9ef6('0x23')](_0x9ef6('0xc'),_0x455ede,_0x39293a['message']);_0x8cb5ba[_0x9ef6('0xd')]();}else if(_0x356b94&&_0x356b94['message']){_0x3f4554[_0x9ef6('0x17')][_0x9ef6('0x24')]=_0x356b94;_0x435ee6[_0x9ef6('0x17')]=_0x356b94[_0x9ef6('0x21')];_0x435ee6[_0x9ef6('0x25')]=_0x9ef6('0x24');_0x435ee6[_0x9ef6('0x26')]=JSON[_0x9ef6('0x1a')](_0x356b94);return rpc[_0x2d7432+_0x9ef6('0x27')][_0x9ef6('0x28')](_0x435ee6)[_0x9ef6('0x29')](function(_0x5b5df7){logger[_0x9ef6('0xb')](_0x9ef6('0xc'),_0x455ede,_0x435ee6[_0x9ef6('0x17')]);if(_0x356b94[_0x9ef6('0x2a')]=='Failed'){_0x8cb5ba[_0x9ef6('0xd')]();}else{_0x8cb5ba['stop']();}})[_0x9ef6('0x19')](function(_0x120985){logger[_0x9ef6('0x23')]('[%s][AMAZONLEX]\x20%s',_0x455ede,JSON[_0x9ef6('0x1a')](_0x120985));_0x8cb5ba[_0x9ef6('0xd')]();});}else{_0x8cb5ba['next']();}});}}catch(_0x178414){logger[_0x9ef6('0x23')](_0x9ef6('0xc'),_0x455ede,JSON[_0x9ef6('0x1a')](_0x178414));_0x8cb5ba['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/autoreply.js b/server/services/routing/server/applications/autoreply.js index a1c510e..eeee710 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 _0x204a=['stop','lodash','moment','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/whatsappInteraction','../../mailRpc','isNil','interaction','created','Autoreply\x20already\x20sent','next','autoreplyExecuted','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','One\x20Time\x20already\x20sent','channel','contact','YYYY-MM-DD\x20HH:mm:ss','out','body','getMustacheRender','message','from','mail','phone','read','subject','Re:\x20','chat','account','upperFirst','AccountId','Message','Smtp','service','host','port','secure','authentication','auth','user','pass','inReplyTo','messageId','html','','','headers','auto-replied','All','auto_reply','sendMailMessage','then','info','create','[%s][AUTOREPLY]\x20%s','stringify','error','[RPC][%s][AUTOREPLY]\x20%s','resolve','Interaction','update','catch','finally','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s'];(function(_0x1addc7,_0x1c11b6){var _0x3784df=function(_0xc15213){while(--_0xc15213){_0x1addc7['push'](_0x1addc7['shift']());}};_0x3784df(++_0x1c11b6);}(_0x204a,0x17d));var _0xa204=function(_0xfc16d1,_0x2ea5fe){_0xfc16d1=_0xfc16d1-0x0;var _0x4e2241=_0x204a[_0xfc16d1];return _0x4e2241;};'use strict';var _=require(_0xa204('0x0'));var moment=require(_0xa204('0x1'));var utils=require(_0xa204('0x2'));var logger=require(_0xa204('0x3'))(_0xa204('0x4'));var rpc={'chatMessage':require(_0xa204('0x5')),'openchannelMessage':require(_0xa204('0x6')),'mailMessage':require(_0xa204('0x7')),'smsMessage':require(_0xa204('0x8')),'faxMessage':require(_0xa204('0x9')),'whatsappMessage':require(_0xa204('0xa')),'chatInteraction':require(_0xa204('0xb')),'openchannelInteraction':require(_0xa204('0xc')),'mailInteraction':require('../../rpc/mailInteraction'),'smsInteraction':require(_0xa204('0xd')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0xa204('0xe'))};var mailRpc=require(_0xa204('0xf'));exports['consequence']=function(_0x3719ea,_0x39d459){return function(_0x3e572c){try{if(_0x39d459[0x0]==='1'&&(_[_0xa204('0x10')](this[_0xa204('0x11')][_0xa204('0x12')])||!this['interaction'][_0xa204('0x12')])){logger['info']('[%s][AUTOREPLY]\x20%s',_0x3719ea,_0xa204('0x13'));return _0x3e572c[_0xa204('0x14')]();}if(_0x39d459[0x0]==='2'&&this['interaction'][_0xa204('0x15')]){logger['info'](_0xa204('0x16'),_0x3719ea,_0xa204('0x17'));return _0x3e572c[_0xa204('0x14')]();}var _0x6ccac1=this[_0xa204('0x18')];var _0x2aeb01={'ContactId':this[_0xa204('0x19')]['id'],'sentAt':moment()['format'](_0xa204('0x1a')),'direction':_0xa204('0x1b')};if(this[_0xa204('0x18')]==='mail'){_0x2aeb01[_0xa204('0x1c')]=utils[_0xa204('0x1d')](_0x39d459[0x2],this);}else{_0x2aeb01[_0xa204('0x1c')]=utils[_0xa204('0x1d')](_0x39d459[0x1],this);}if(this[_0xa204('0x1e')]){_0x2aeb01['to']=this[_0xa204('0x1e')][_0xa204('0x1f')]||'';if(this[_0xa204('0x18')]===_0xa204('0x20')&&_0x39d459[0x1]==='1'){_0x2aeb01['cc']=this[_0xa204('0x1e')]['cc']||'';}_0x2aeb01['from']=this[_0xa204('0x1e')]['to']||'';_0x2aeb01[_0xa204('0x21')]=this[_0xa204('0x1e')][_0xa204('0x21')]||'';_0x2aeb01[_0xa204('0x22')]=!![];if(this[_0xa204('0x1e')]['subject']){_0x2aeb01[_0xa204('0x23')]='';_0x2aeb01[_0xa204('0x23')]+=_['startsWith'](this[_0xa204('0x1e')][_0xa204('0x23')],'Re:')?'':_0xa204('0x24');_0x2aeb01[_0xa204('0x23')]+=this[_0xa204('0x1e')][_0xa204('0x23')];}}if(this['channel']===_0xa204('0x25')){_0x2aeb01['ChatWebsiteId']=this[_0xa204('0x26')]['id'];}else{_0x2aeb01[_[_0xa204('0x27')](this[_0xa204('0x18')])+_0xa204('0x28')]=this['account']['id'];}_0x2aeb01[_[_0xa204('0x27')](this[_0xa204('0x18')])+'InteractionId']=this[_0xa204('0x11')]['id'];var _0xaf19ff=this['interaction'];if(rpc[this[_0xa204('0x18')]+_0xa204('0x29')]){if(this[_0xa204('0x18')]==='mail'){var _0x135653={'tls':{'rejectUnauthorized':![]}};if(this['account'][_0xa204('0x2a')][_0xa204('0x2b')]){_0x135653[_0xa204('0x2b')]=this['account'][_0xa204('0x2a')]['service'];}else{_0x135653[_0xa204('0x2c')]=this[_0xa204('0x26')][_0xa204('0x2a')][_0xa204('0x2c')];_0x135653[_0xa204('0x2d')]=this[_0xa204('0x26')][_0xa204('0x2a')][_0xa204('0x2d')];_0x135653[_0xa204('0x2e')]=this[_0xa204('0x26')]['Smtp'][_0xa204('0x2e')];}if(this[_0xa204('0x26')][_0xa204('0x2a')][_0xa204('0x2f')]){_0x135653[_0xa204('0x30')]={'user':this[_0xa204('0x26')]['Smtp'][_0xa204('0x31')],'pass':this[_0xa204('0x26')][_0xa204('0x2a')][_0xa204('0x32')]};}_0x2aeb01[_0xa204('0x33')]=this['message'][_0xa204('0x34')];_0x2aeb01[_0xa204('0x35')]=_0xa204('0x36')+_['replace'](_0x2aeb01[_0xa204('0x1c')],'','auto-replied','All','then','create','catch','[RPC][%s][AUTOREPLY]\x20%s','stringify','finally','resolve','error','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','Message','Interaction','update','stop'];(function(_0x3ed477,_0x86b279){var _0xfbadeb=function(_0x2a3541){while(--_0x2a3541){_0x3ed477['push'](_0x3ed477['shift']());}};_0xfbadeb(++_0x86b279);}(_0xab99,0x1ea));var _0x9ab9=function(_0x3d7c4d,_0x460275){_0x3d7c4d=_0x3d7c4d-0x0;var _0x11bd26=_0xab99[_0x3d7c4d];return _0x11bd26;};'use strict';var _=require(_0x9ab9('0x0'));var moment=require(_0x9ab9('0x1'));var utils=require(_0x9ab9('0x2'));var logger=require(_0x9ab9('0x3'))('routing');var rpc={'chatMessage':require(_0x9ab9('0x4')),'openchannelMessage':require(_0x9ab9('0x5')),'mailMessage':require(_0x9ab9('0x6')),'smsMessage':require(_0x9ab9('0x7')),'faxMessage':require(_0x9ab9('0x8')),'whatsappMessage':require(_0x9ab9('0x9')),'chatInteraction':require(_0x9ab9('0xa')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'mailInteraction':require('../../rpc/mailInteraction'),'smsInteraction':require(_0x9ab9('0xb')),'faxInteraction':require(_0x9ab9('0xc')),'whatsappInteraction':require(_0x9ab9('0xd'))};var mailRpc=require(_0x9ab9('0xe'));exports['consequence']=function(_0x2d328a,_0x268395){return function(_0x1f401f){try{if(_0x268395[0x0]==='1'&&(_[_0x9ab9('0xf')](this[_0x9ab9('0x10')]['created'])||!this[_0x9ab9('0x10')]['created'])){logger[_0x9ab9('0x11')](_0x9ab9('0x12'),_0x2d328a,'Autoreply\x20already\x20sent');return _0x1f401f[_0x9ab9('0x13')]();}if(_0x268395[0x0]==='2'&&this[_0x9ab9('0x10')][_0x9ab9('0x14')]){logger[_0x9ab9('0x11')](_0x9ab9('0x15'),_0x2d328a,_0x9ab9('0x16'));return _0x1f401f[_0x9ab9('0x13')]();}var _0x3013eb=this['channel'];var _0x15676d={'ContactId':this[_0x9ab9('0x17')]['id'],'sentAt':moment()[_0x9ab9('0x18')](_0x9ab9('0x19')),'direction':'out'};if(this[_0x9ab9('0x1a')]===_0x9ab9('0x1b')){_0x15676d[_0x9ab9('0x1c')]=utils['getMustacheRender'](_0x268395[0x2],this);}else{_0x15676d[_0x9ab9('0x1c')]=utils[_0x9ab9('0x1d')](_0x268395[0x1],this);}if(this[_0x9ab9('0x1e')]){_0x15676d['to']=this['message'][_0x9ab9('0x1f')]||'';if(this[_0x9ab9('0x1a')]===_0x9ab9('0x1b')&&_0x268395[0x1]==='1'){_0x15676d['cc']=this[_0x9ab9('0x1e')]['cc']||'';}_0x15676d[_0x9ab9('0x1f')]=this[_0x9ab9('0x1e')]['to']||'';_0x15676d[_0x9ab9('0x20')]=this['message']['phone']||'';_0x15676d[_0x9ab9('0x21')]=!![];if(this['message'][_0x9ab9('0x22')]){_0x15676d['subject']='';_0x15676d[_0x9ab9('0x22')]+=_[_0x9ab9('0x23')](this[_0x9ab9('0x1e')]['subject'],_0x9ab9('0x24'))?'':_0x9ab9('0x25');_0x15676d[_0x9ab9('0x22')]+=this[_0x9ab9('0x1e')][_0x9ab9('0x22')];}}if(this[_0x9ab9('0x1a')]==='chat'){_0x15676d[_0x9ab9('0x26')]=this['account']['id'];}else{_0x15676d[_[_0x9ab9('0x27')](this[_0x9ab9('0x1a')])+_0x9ab9('0x28')]=this[_0x9ab9('0x29')]['id'];}_0x15676d[_[_0x9ab9('0x27')](this[_0x9ab9('0x1a')])+_0x9ab9('0x2a')]=this[_0x9ab9('0x10')]['id'];var _0x3aca86=this[_0x9ab9('0x10')];if(rpc[this[_0x9ab9('0x1a')]+'Message']){if(this['channel']==='mail'){var _0x282aa3={'tls':{'rejectUnauthorized':![]}};if(this[_0x9ab9('0x29')][_0x9ab9('0x2b')]['service']){_0x282aa3['service']=this[_0x9ab9('0x29')][_0x9ab9('0x2b')]['service'];}else{_0x282aa3[_0x9ab9('0x2c')]=this[_0x9ab9('0x29')][_0x9ab9('0x2b')][_0x9ab9('0x2c')];_0x282aa3[_0x9ab9('0x2d')]=this['account']['Smtp'][_0x9ab9('0x2d')];_0x282aa3[_0x9ab9('0x2e')]=this[_0x9ab9('0x29')][_0x9ab9('0x2b')][_0x9ab9('0x2e')];}if(this[_0x9ab9('0x29')][_0x9ab9('0x2b')][_0x9ab9('0x2f')]){_0x282aa3[_0x9ab9('0x30')]={'user':this[_0x9ab9('0x29')]['Smtp'][_0x9ab9('0x31')],'pass':this['account'][_0x9ab9('0x2b')][_0x9ab9('0x32')]};}_0x15676d[_0x9ab9('0x33')]=this[_0x9ab9('0x1e')][_0x9ab9('0x34')];_0x15676d[_0x9ab9('0x35')]=''+_['replace'](_0x15676d[_0x9ab9('0x1c')],']+(>|$)/g,''),'priorityTrue':_0x4c35a2[0x1],'priorityFalse':_0x4c35a2[0x2]};var _0x273aa4=gotoif['validate'](_0x289533,{'typecast':!![]});if(_0x273aa4['length']){logger['error'](_0x9bad('0xd'),_0x549dd4,_[_0x9bad('0xe')](_0x273aa4,_0x9bad('0xf'))[_0x9bad('0x10')](',\x20'));_0x1ab6ba[_0x9bad('0x11')]();}else{try{var _0x587233=eval('('+_0x289533['condition']+')');var _0x368197=_0x587233?_0x289533[_0x9bad('0x12')]:_0x289533[_0x9bad('0x13')];logger[_0x9bad('0x14')](_0x9bad('0x15'),_0x549dd4,_0x289533['condition'],_0x587233,_0x368197||_0x9bad('0x16'));if(_0x368197){var _0x50d338=_[_0x9bad('0x17')](_0x1ab6ba[_0x9bad('0x18')](),{'p':_0x368197});if(_0x50d338>=0x0){logger[_0x9bad('0x14')](_0x9bad('0x19'),_0x549dd4,_0x368197||_0x9bad('0x16'),_0x50d338);_0x1ab6ba['next'](_0x50d338);}else{logger[_0x9bad('0x14')](_0x9bad('0x1a'),_0x549dd4,_0x368197||'next');_0x1ab6ba[_0x9bad('0x11')]();}}else{_0x1ab6ba[_0x9bad('0x16')]();}}catch(_0x2625ac){logger[_0x9bad('0x1b')](_0x9bad('0x1c'),_0x549dd4,_0x2625ac[_0x9bad('0xf')]);_0x1ab6ba[_0x9bad('0x11')]();}}}catch(_0xc9e859){logger[_0x9bad('0x1b')](_0x9bad('0xd'),_0x549dd4,JSON[_0x9bad('0x1d')](_0xc9e859));_0x1ab6ba[_0x9bad('0x11')]();}};}; \ No newline at end of file +var _0x06b9=['priority\x20false\x20is\x20a\x20number','fromString','getMustacheRender','replace','error','[%s][GOTOIF]\x20%s','message','join','stop','priorityTrue','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','condition','next','findIndex','rules','info','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','stringify','validate','lodash','./utils','routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number'];(function(_0x5b58ba,_0x16159f){var _0xc67099=function(_0x1c5b8a){while(--_0x1c5b8a){_0x5b58ba['push'](_0x5b58ba['shift']());}};_0xc67099(++_0x16159f);}(_0x06b9,0x130));var _0x906b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x06b9[_0x3dd15e];return _0x231fd0;};'use strict';var schema=require(_0x906b('0x0'));var _=require(_0x906b('0x1'));var htmlToText=require('html-to-text');var utils=require(_0x906b('0x2'));var logger=require('../../../../config/logger')(_0x906b('0x3'));var gotoif=schema({'condition':{'type':_0x906b('0x4'),'required':!![],'message':_0x906b('0x5')},'priorityTrue':{'type':_0x906b('0x6'),'message':_0x906b('0x7')},'priorityFalse':{'type':_0x906b('0x6'),'message':_0x906b('0x8')}});exports['consequence']=function(_0x33dd25,_0x522464){return function(_0x498a6a){try{var _0x211915={'condition':htmlToText[_0x906b('0x9')](utils[_0x906b('0xa')](_0x522464[0x0],this),{'wordwrap':![]})[_0x906b('0xb')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x522464[0x1],'priorityFalse':_0x522464[0x2]};var _0x4a2264=gotoif[_0x906b('0x0')](_0x211915,{'typecast':!![]});if(_0x4a2264['length']){logger[_0x906b('0xc')](_0x906b('0xd'),_0x33dd25,_['map'](_0x4a2264,_0x906b('0xe'))[_0x906b('0xf')](',\x20'));_0x498a6a[_0x906b('0x10')]();}else{try{var _0x54aff3=eval('('+_0x211915['condition']+')');var _0x30e088=_0x54aff3?_0x211915[_0x906b('0x11')]:_0x211915['priorityFalse'];logger['info'](_0x906b('0x12'),_0x33dd25,_0x211915[_0x906b('0x13')],_0x54aff3,_0x30e088||_0x906b('0x14'));if(_0x30e088){var _0x2d1f92=_[_0x906b('0x15')](_0x498a6a[_0x906b('0x16')](),{'p':_0x30e088});if(_0x2d1f92>=0x0){logger['info']('[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x33dd25,_0x30e088||_0x906b('0x14'),_0x2d1f92);_0x498a6a[_0x906b('0x14')](_0x2d1f92);}else{logger[_0x906b('0x17')](_0x906b('0x18'),_0x33dd25,_0x30e088||_0x906b('0x14'));_0x498a6a['stop']();}}else{_0x498a6a[_0x906b('0x14')]();}}catch(_0x18d3cb){logger[_0x906b('0xc')]('[%s][GOTOIF]\x20eval\x20error:\x20%s',_0x33dd25,_0x18d3cb[_0x906b('0xe')]);_0x498a6a[_0x906b('0x10')]();}}}catch(_0x3c8d42){logger[_0x906b('0xc')](_0x906b('0xd'),_0x33dd25,JSON[_0x906b('0x19')](_0x3c8d42));_0x498a6a[_0x906b('0x10')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotop.js b/server/services/routing/server/applications/gotop.js index c39273e..f17cf0e 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 _0xb32d=['../../../../config/logger','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','validate','length','error','[%s][GOTOP]\x20%s','message','stop','info','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stringify'];(function(_0x24c504,_0x208f8a){var _0x4666d7=function(_0x347fb1){while(--_0x347fb1){_0x24c504['push'](_0x24c504['shift']());}};_0x4666d7(++_0x208f8a);}(_0xb32d,0x154));var _0xdb32=function(_0x593a37,_0x20ac5b){_0x593a37=_0x593a37-0x0;var _0x4bde96=_0xb32d[_0x593a37];return _0x4bde96;};'use strict';var schema=require('validate');var _=require('lodash');var logger=require(_0xdb32('0x0'))(_0xdb32('0x1'));var gotop=schema({'priority':{'type':_0xdb32('0x2'),'required':!![],'message':_0xdb32('0x3')}});exports[_0xdb32('0x4')]=function(_0x8ec4a2,_0x3134fa){return function(_0x47c049){try{var _0x26e778={'priority':_0x3134fa[0x0]};var _0x1faf48=gotop[_0xdb32('0x5')](_0x26e778,{'typecast':!![]});if(_0x1faf48[_0xdb32('0x6')]){logger[_0xdb32('0x7')](_0xdb32('0x8'),_0x8ec4a2,_['map'](_0x1faf48,_0xdb32('0x9'))['join'](',\x20'));_0x47c049[_0xdb32('0xa')]();}else{logger[_0xdb32('0xb')](_0xdb32('0xc'),_0x8ec4a2,_0x26e778['priority']);if(_0x26e778[_0xdb32('0xd')]){var _0x1ffbbf=_[_0xdb32('0xe')](_0x47c049[_0xdb32('0xf')](),{'p':_0x26e778[_0xdb32('0xd')]});if(_0x1ffbbf>=0x0){logger[_0xdb32('0xb')](_0xdb32('0x10'),_0x8ec4a2,_0x26e778[_0xdb32('0xd')]||_0xdb32('0x11'),_0x1ffbbf);_0x47c049[_0xdb32('0x11')](_0x1ffbbf);}else{logger[_0xdb32('0xb')](_0xdb32('0x12'),_0x8ec4a2,_0x26e778[_0xdb32('0xd')]||_0xdb32('0x11'));_0x47c049[_0xdb32('0xa')]();}}else{_0x47c049['next']();}}}catch(_0x594d27){logger[_0xdb32('0x7')](_0xdb32('0x8'),_0x8ec4a2,JSON[_0xdb32('0x13')](_0x594d27));_0x47c049[_0xdb32('0xa')]();}};}; \ No newline at end of file +var _0xb936=['next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stringify','validate','../../../../config/logger','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','length','[%s][GOTOP]\x20%s','map','message','stop','info','priority','findIndex','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s'];(function(_0x3844ab,_0x461e40){var _0x2a3276=function(_0x1d1176){while(--_0x1d1176){_0x3844ab['push'](_0x3844ab['shift']());}};_0x2a3276(++_0x461e40);}(_0xb936,0x1b8));var _0x6b93=function(_0x236dab,_0x15009a){_0x236dab=_0x236dab-0x0;var _0x5d987a=_0xb936[_0x236dab];return _0x5d987a;};'use strict';var schema=require(_0x6b93('0x0'));var _=require('lodash');var logger=require(_0x6b93('0x1'))(_0x6b93('0x2'));var gotop=schema({'priority':{'type':_0x6b93('0x3'),'required':!![],'message':_0x6b93('0x4')}});exports[_0x6b93('0x5')]=function(_0x5f59a6,_0x42143b){return function(_0x54ea4b){try{var _0x49222c={'priority':_0x42143b[0x0]};var _0x4061db=gotop['validate'](_0x49222c,{'typecast':!![]});if(_0x4061db[_0x6b93('0x6')]){logger['error'](_0x6b93('0x7'),_0x5f59a6,_[_0x6b93('0x8')](_0x4061db,_0x6b93('0x9'))['join'](',\x20'));_0x54ea4b[_0x6b93('0xa')]();}else{logger[_0x6b93('0xb')]('[%s][GOTOP]\x20priority\x20%s',_0x5f59a6,_0x49222c[_0x6b93('0xc')]);if(_0x49222c['priority']){var _0x361a6c=_[_0x6b93('0xd')](_0x54ea4b[_0x6b93('0xe')](),{'p':_0x49222c[_0x6b93('0xc')]});if(_0x361a6c>=0x0){logger[_0x6b93('0xb')](_0x6b93('0xf'),_0x5f59a6,_0x49222c[_0x6b93('0xc')]||'next',_0x361a6c);_0x54ea4b[_0x6b93('0x10')](_0x361a6c);}else{logger['info'](_0x6b93('0x11'),_0x5f59a6,_0x49222c[_0x6b93('0xc')]||_0x6b93('0x10'));_0x54ea4b['stop']();}}else{_0x54ea4b['next']();}}}catch(_0x5eb208){logger['error'](_0x6b93('0x7'),_0x5f59a6,JSON[_0x6b93('0x12')](_0x5eb208));_0x54ea4b[_0x6b93('0xa')]();}};}; \ 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 cb51373..2c27f1e 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 _0x6372=['lodash','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','channel','account','upperFirst','InteractionId','interaction','Message','create','info','[%s][MESSAGE]\x20%s','next','catch','error','stringify','stop'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6372,0x1b8));var _0x2637=function(_0x46dc18,_0x50a222){_0x46dc18=_0x46dc18-0x0;var _0x134c63=_0x6372[_0x46dc18];return _0x134c63;};'use strict';var _=require(_0x2637('0x0'));var utils=require('./utils');var logger=require(_0x2637('0x1'))('routing');var rpc={'chatMessage':require(_0x2637('0x2')),'openchannelMessage':require(_0x2637('0x3')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x2637('0x4')),'faxMessage':require(_0x2637('0x5')),'whatsappMessage':require(_0x2637('0x6'))};exports[_0x2637('0x7')]=function(_0x24ab39,_0x5da891){return function(_0x33d56c){try{var _0x54bdd1={'body':utils['getMustacheRender'](_0x5da891[0x0],this),'ContactId':this['contact']['id']};if(this[_0x2637('0x8')]==='chat'){_0x54bdd1['ChatWebsiteId']=this[_0x2637('0x9')]['id'];}else{_0x54bdd1[_[_0x2637('0xa')](this[_0x2637('0x8')])+'AccountId']=this['account']['id'];}_0x54bdd1[_[_0x2637('0xa')](this[_0x2637('0x8')])+_0x2637('0xb')]=this[_0x2637('0xc')]['id'];if(rpc[this[_0x2637('0x8')]+_0x2637('0xd')]){return rpc[this[_0x2637('0x8')]+_0x2637('0xd')][_0x2637('0xe')](_0x54bdd1)['then'](function(_0x2e1052){logger[_0x2637('0xf')](_0x2637('0x10'),_0x24ab39,_0x54bdd1['body']);_0x33d56c[_0x2637('0x11')]();})[_0x2637('0x12')](function(_0x4630fe){logger[_0x2637('0x13')]('[%s][MESSAGE]\x20%s',_0x24ab39,JSON[_0x2637('0x14')](_0x4630fe));_0x33d56c[_0x2637('0x15')]();});}}catch(_0x3f69d9){logger[_0x2637('0x13')](_0x2637('0x10'),_0x24ab39,JSON[_0x2637('0x14')](_0x3f69d9));_0x33d56c['stop']();}};}; \ No newline at end of file +var _0x26f9=['./utils','routing','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','consequence','getMustacheRender','contact','channel','chat','account','AccountId','upperFirst','InteractionId','interaction','Message','create','then','info','[%s][MESSAGE]\x20%s','error','stringify','lodash'];(function(_0x2c792a,_0x3cbefc){var _0x459840=function(_0x8b0178){while(--_0x8b0178){_0x2c792a['push'](_0x2c792a['shift']());}};_0x459840(++_0x3cbefc);}(_0x26f9,0x16f));var _0x926f=function(_0x4a4a32,_0x2ba798){_0x4a4a32=_0x4a4a32-0x0;var _0x154d37=_0x26f9[_0x4a4a32];return _0x154d37;};'use strict';var _=require(_0x926f('0x0'));var utils=require(_0x926f('0x1'));var logger=require('../../../../config/logger')(_0x926f('0x2'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x926f('0x3')),'smsMessage':require(_0x926f('0x4')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x926f('0x5'))};exports[_0x926f('0x6')]=function(_0x4232b5,_0x66dbcf){return function(_0x46ff8e){try{var _0x3d2ded={'body':utils[_0x926f('0x7')](_0x66dbcf[0x0],this),'ContactId':this[_0x926f('0x8')]['id']};if(this[_0x926f('0x9')]===_0x926f('0xa')){_0x3d2ded['ChatWebsiteId']=this[_0x926f('0xb')]['id'];}else{_0x3d2ded[_['upperFirst'](this[_0x926f('0x9')])+_0x926f('0xc')]=this['account']['id'];}_0x3d2ded[_[_0x926f('0xd')](this[_0x926f('0x9')])+_0x926f('0xe')]=this[_0x926f('0xf')]['id'];if(rpc[this[_0x926f('0x9')]+'Message']){return rpc[this[_0x926f('0x9')]+_0x926f('0x10')][_0x926f('0x11')](_0x3d2ded)[_0x926f('0x12')](function(_0x44f5da){logger[_0x926f('0x13')](_0x926f('0x14'),_0x4232b5,_0x3d2ded['body']);_0x46ff8e['next']();})['catch'](function(_0x11197b){logger[_0x926f('0x15')](_0x926f('0x14'),_0x4232b5,JSON[_0x926f('0x16')](_0x11197b));_0x46ff8e['stop']();});}}catch(_0x37035c){logger[_0x926f('0x15')]('[%s][MESSAGE]\x20%s',_0x4232b5,JSON[_0x926f('0x16')](_0x37035c));_0x46ff8e['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/noop.js b/server/services/routing/server/applications/noop.js index 5a218df..21656d9 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 _0x9c97=['getMustacheRender','error','stringify','stop','routing','consequence','[%s][NOOP]\x20%s'];(function(_0x3efce5,_0x4b85c3){var _0xa6d417=function(_0x475892){while(--_0x475892){_0x3efce5['push'](_0x3efce5['shift']());}};_0xa6d417(++_0x4b85c3);}(_0x9c97,0xcf));var _0x79c9=function(_0x1794fa,_0x25f853){_0x1794fa=_0x1794fa-0x0;var _0x36cc1a=_0x9c97[_0x1794fa];return _0x36cc1a;};'use strict';var utils=require('./utils');var logger=require('../../../../config/logger')(_0x79c9('0x0'));exports[_0x79c9('0x1')]=function(_0xb94787,_0x59e28b){return function(_0x10d4a3){try{logger['info'](_0x79c9('0x2'),_0xb94787,utils[_0x79c9('0x3')](_0x59e28b[0x0],this));_0x10d4a3['next']();}catch(_0x4cf976){logger[_0x79c9('0x4')](_0x79c9('0x2'),_0xb94787,JSON[_0x79c9('0x5')](_0x4cf976));_0x10d4a3[_0x79c9('0x6')]();}};}; \ No newline at end of file +var _0xf3ba=['next','[%s][NOOP]\x20%s','stringify','stop','./utils','../../../../config/logger','routing','consequence','getMustacheRender'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xf3ba,0x82));var _0xaf3b=function(_0x23e7c1,_0x35110c){_0x23e7c1=_0x23e7c1-0x0;var _0x1add43=_0xf3ba[_0x23e7c1];return _0x1add43;};'use strict';var utils=require(_0xaf3b('0x0'));var logger=require(_0xaf3b('0x1'))(_0xaf3b('0x2'));exports[_0xaf3b('0x3')]=function(_0x2ec7b5,_0x43d065){return function(_0x59aeba){try{logger['info']('[%s][NOOP]\x20%s',_0x2ec7b5,utils[_0xaf3b('0x4')](_0x43d065[0x0],this));_0x59aeba[_0xaf3b('0x5')]();}catch(_0x49750f){logger['error'](_0xaf3b('0x6'),_0x2ec7b5,JSON[_0xaf3b('0x7')](_0x49750f));_0x59aeba[_0xaf3b('0x8')]();}};}; \ 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 c6491ef..ad7fc34 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 _0x5a95=['queue','from','clone','format','pick','%sQueuesWaitingInteractions','%s:queue:%s','%s_queue_waiting_interaction:%s','remove','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/smsQueueReport','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','waiting','body','contact','list','QueueId','InteractionId','interaction','upperFirst','channel','message','chat','AccountId','WebsiteId','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','catch','create\x20queue\x20report','YYYY-MM-DD\x20HH:mm:ss','[%s][STOP:QUEUE][NAME:%s]','update','error','timeout','info','toLowerCase','validate','length','[%s][QUEUE]\x20%s','map','join','stop','find','Queues','createQueue','atimeout','qtimeout','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','[%s][QUEUE]\x20APPLICATION\x20END','close','next','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','stack','lodash','util','seq-queue','ioredis','../../../../config/environment','../../../../config/logger','routing','redis','defaults','localhost','socket.io-emitter','queue_id','account'];(function(_0x2a1e44,_0x36f108){var _0x57186c=function(_0x9c2bb1){while(--_0x9c2bb1){_0x2a1e44['push'](_0x2a1e44['shift']());}};_0x57186c(++_0x36f108);}(_0x5a95,0x8b));var _0x55a9=function(_0x4a77a7,_0x526a0e){_0x4a77a7=_0x4a77a7-0x0;var _0x4cdcae=_0x5a95[_0x4a77a7];return _0x4cdcae;};'use strict';var schema=require('validate');var _=require(_0x55a9('0x0'));var util=require(_0x55a9('0x1'));var seqqueue=require(_0x55a9('0x2'));var moment=require('moment');var Redis=require(_0x55a9('0x3'));var config=require(_0x55a9('0x4'));var logger=require(_0x55a9('0x5'))(_0x55a9('0x6'));var strategy=require('./strategy');config[_0x55a9('0x7')]=_[_0x55a9('0x8')](config[_0x55a9('0x7')],{'host':_0x55a9('0x9'),'port':0x18eb});var io=require(_0x55a9('0xa'))(new Redis(config[_0x55a9('0x7')]));var attributes=['id',_0x55a9('0xb'),_0x55a9('0xc'),_0x55a9('0xd'),_0x55a9('0xe'),'joinAt'];function emit(_0x2f6021,_0x439d94,_0x1a4b1e){io['to'](_0x2f6021)['emit'](_0x439d94,_0x1a4b1e);}function emitChannelQueueInteraction(_0x3113e7,_0x36c6cf,_0x2d4d3e,_0x587d31,_0x43d044,_0x2e8fb5,_0x4d8c92,_0x2c5236){var _0x995781=_[_0x55a9('0xf')](_0x2d4d3e);_0x995781[_0x55a9('0xb')]=_0x2c5236;_0x995781[_0x55a9('0xd')]=_0x36c6cf;_0x995781[_0x55a9('0xc')]=_0x587d31;_0x995781['id']=_0x43d044;if(_0x2e8fb5){_0x4d8c92[util[_0x55a9('0x10')]('%sQueuesWaitingInteractions',_0x3113e7)][_0x43d044]=_[_0x55a9('0x11')](_0x995781,attributes);}else{delete _0x4d8c92[util['format'](_0x55a9('0x12'),_0x3113e7)][_0x43d044];}emit(util[_0x55a9('0x10')](_0x55a9('0x13'),_0x3113e7,_0x36c6cf),util[_0x55a9('0x10')](_0x55a9('0x14'),_0x3113e7,_0x2e8fb5?'save':_0x55a9('0x15')),_[_0x55a9('0x11')](_0x995781,attributes));}var rpc={'openchannelQueueReport':require(_0x55a9('0x16')),'mailQueueReport':require(_0x55a9('0x17')),'chatQueueReport':require('../../rpc/chatQueueReport'),'smsQueueReport':require(_0x55a9('0x18')),'faxQueueReport':require('../../rpc/faxQueueReport'),'whatsappQueueReport':require('../../rpc/whatsappQueueReport')};var queue=schema({'name':{'type':'string','required':!![],'message':_0x55a9('0x19')},'timeout':{'type':_0x55a9('0x1a'),'message':'timeout\x20is\x20a\x20number'}});function startRouting(_0x489723,_0x12cd73,_0x44484f,_0x58ab72){if(_0x489723&&_0x12cd73&&_0x44484f){_0x12cd73[_0x55a9('0x1b')]+=0x1;var _0x56c866={'uniqueid':_0x489723,'from':_0x44484f[_0x55a9('0x1c')]?_0x44484f[_0x55a9('0x1c')]['from']:'','joinAt':moment()[_0x55a9('0x10')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x44484f[_0x55a9('0x1d')]?_0x44484f[_0x55a9('0x1d')]['id']:null,'ListId':_0x44484f[_0x55a9('0x1e')]?_0x44484f[_0x55a9('0x1e')]['id']:null};_0x56c866[_['upperFirst'](_0x44484f['channel'])+_0x55a9('0x1f')]=_0x12cd73['id']||null;_0x56c866[_['upperFirst'](_0x44484f['channel'])+_0x55a9('0x20')]=_0x44484f[_0x55a9('0x21')]?_0x44484f[_0x55a9('0x21')]['id']:null;_0x56c866[_[_0x55a9('0x22')](_0x44484f[_0x55a9('0x23')])+'MessageId']=_0x44484f[_0x55a9('0x24')]?_0x44484f[_0x55a9('0x24')]['id']:null;_0x56c866[_[_0x55a9('0x22')](_0x44484f['channel'])+(_0x44484f['channel']!==_0x55a9('0x25')?_0x55a9('0x26'):_0x55a9('0x27'))]=_0x44484f[_0x55a9('0xc')]?_0x44484f[_0x55a9('0xc')]['id']:null;logger['info'](util['format'](_0x55a9('0x28'),_0x489723,_0x12cd73['name']));emitChannelQueueInteraction(_0x44484f['channel'],_0x12cd73[_0x55a9('0x29')],_0x56c866,_0x44484f[_0x55a9('0xc')]['name'],_0x44484f[_0x55a9('0x24')]['id'],!![],_0x58ab72,_0x12cd73['id']);if(rpc[_0x44484f[_0x55a9('0x23')]+_0x55a9('0x2a')]){return rpc[_0x44484f[_0x55a9('0x23')]+_0x55a9('0x2a')][_0x55a9('0x2b')](_0x56c866)[_0x55a9('0x2c')](function(_0x56ab68){logger['error'](_0x55a9('0x2d'));});}}}function stopRouting(_0x18590a,_0xb9ad11,_0x3a13b3,_0x19a099){if(_0x18590a&&_0xb9ad11){_0xb9ad11[_0x55a9('0x1b')]-=0x1;var _0x4ab6b1={'leaveAt':moment()[_0x55a9('0x10')](_0x55a9('0x2e')),'acceptAt':moment()[_0x55a9('0x10')](_0x55a9('0x2e')),'reason':'accepted'};logger['info'](util[_0x55a9('0x10')](_0x55a9('0x2f'),_0x18590a,_0xb9ad11[_0x55a9('0x29')]));emitChannelQueueInteraction(_0x3a13b3[_0x55a9('0x23')],_0xb9ad11[_0x55a9('0x29')],_0x3a13b3[_0x55a9('0x1c')],_0x3a13b3['account'][_0x55a9('0x29')],_0x3a13b3[_0x55a9('0x24')]['id'],![],_0x19a099,_0xb9ad11['id']);if(rpc[_0x3a13b3[_0x55a9('0x23')]+_0x55a9('0x2a')]){return rpc[_0x3a13b3[_0x55a9('0x23')]+'QueueReport'][_0x55a9('0x30')](_0x18590a,_0x4ab6b1)[_0x55a9('0x2c')](function(_0x558601){logger[_0x55a9('0x31')]('update\x20queue\x20report');});}}}function endRouting(_0x488967,_0x29640d,_0xd5a915,_0x1b2eb6){if(_0x488967&&_0x29640d){_0x29640d[_0x55a9('0x1b')]-=0x1;var _0x55cd8e={'leaveAt':moment()['format'](_0x55a9('0x2e')),'exitAt':moment()[_0x55a9('0x10')](_0x55a9('0x2e')),'reason':_0x55a9('0x32')};logger[_0x55a9('0x33')](util[_0x55a9('0x10')]('[%s][END:QUEUE][NAME:%s]',_0x488967,_0x29640d[_0x55a9('0x29')]));emitChannelQueueInteraction(_0xd5a915[_0x55a9('0x23')],_0x29640d[_0x55a9('0x29')],_0xd5a915[_0x55a9('0x1c')],_0xd5a915[_0x55a9('0xc')][_0x55a9('0x29')],_0xd5a915[_0x55a9('0x24')]['id'],![],_0x1b2eb6);if(rpc[_0xd5a915[_0x55a9('0x23')]+_0x55a9('0x2a')]){return rpc[_0xd5a915[_0x55a9('0x23')]+_0x55a9('0x2a')][_0x55a9('0x30')](_0x488967,_0x55cd8e)[_0x55a9('0x2c')](function(_0x33181f){logger[_0x55a9('0x31')]('update\x20queue\x20report');});}}}function handleFindQueue(_0x2a4e7e){return function(_0x3f4888){return _0x3f4888[_0x55a9('0x29')][_0x55a9('0x34')]()===_0x2a4e7e[_0x55a9('0x34')]();};}exports['consequence']=function(_0x14f6cc,_0x4d7ebe,_0x206f00,_0x186059){return function(_0x17c227){try{var _0x2c1432={'name':_0x4d7ebe[0x0],'timeout':_0x4d7ebe[0x1]};var _0x32efc5=queue[_0x55a9('0x35')](_0x2c1432,{'typecast':!![]});if(_0x32efc5[_0x55a9('0x36')]){logger[_0x55a9('0x31')](_0x55a9('0x37'),_0x14f6cc,_[_0x55a9('0x38')](_0x32efc5,_0x55a9('0x24'))[_0x55a9('0x39')](',\x20'));_0x17c227[_0x55a9('0x3a')]();}else{var _0x5a96d0=_[_0x55a9('0x3b')](_0x206f00[_0x186059[_0x55a9('0x23')]+_0x55a9('0x3c')],handleFindQueue(_0x2c1432[_0x55a9('0x29')]));if(_0x5a96d0){startRouting(_0x14f6cc,_0x5a96d0,_0x186059,_0x206f00);var _0xc66b31=(_0x5a96d0['timeout']||0xa)*0x3e8;var _0x43acc6=(_0x2c1432[_0x55a9('0x32')]||0x14)*0x3e8;var _0x154374,_0x18c4d7;if(_0xc66b31>_0x43acc6){_0x43acc6=_0xc66b31;}var _0x25941a=seqqueue[_0x55a9('0x3d')](_0xc66b31);_0x25941a['id']=_0x14f6cc;_0x25941a[_0x55a9('0x3e')]=_0xc66b31;_0x25941a[_0x55a9('0x3f')]=_0x43acc6;_0x25941a[_0x55a9('0x23')]=_0x186059[_0x55a9('0x23')];_0x206f00[_0x55a9('0x40')][_0x14f6cc]['on'](_0x55a9('0x41'),function(){logger[_0x55a9('0x33')](_0x55a9('0x42'),_0x14f6cc);stopRouting(_0x14f6cc,_0x5a96d0,_0x186059,_0x206f00);clearTimeout(_0x154374);_0x154374=undefined;_0x25941a['close'](!![]);if(_0x206f00[_0x55a9('0x40')][_0x14f6cc]){delete _0x206f00['rules'][_0x14f6cc];}_0x17c227[_0x55a9('0x3a')]();});_0x206f00['rules'][_0x14f6cc]['on']('complete',function(){if(_0x206f00[_0x55a9('0x40')][_0x14f6cc]){delete _0x206f00[_0x55a9('0x40')][_0x14f6cc];}});_0x154374=setTimeout(function(){logger[_0x55a9('0x33')](_0x55a9('0x43'),_0x14f6cc);endRouting(_0x14f6cc,_0x5a96d0,_0x186059,_0x206f00);clearTimeout(_0x154374);_0x25941a[_0x55a9('0x44')](!![]);_0x17c227[_0x55a9('0x45')]();},_0x43acc6);switch(_0x5a96d0[_0x55a9('0x46')]){case'rrmemory':strategy[_0x55a9('0x47')](_0x25941a,_0x5a96d0,_0x206f00,_0x186059);break;default:strategy[_0x55a9('0x48')](_0x25941a,_0x5a96d0,_0x206f00,_0x186059);}}else{logger[_0x55a9('0x31')](_0x55a9('0x49'),_0x14f6cc,_0x2c1432[_0x55a9('0x29')]);_0x17c227[_0x55a9('0x3a')]();}}}catch(_0x20ebda){console[_0x55a9('0x4a')](_0x20ebda);logger['error'](_0x55a9('0x37'),_0x14f6cc,_0x20ebda[_0x55a9('0x4b')]);_0x17c227['stop']();}};}; \ No newline at end of file +var _0x84bc=['rules','complete','[%s][QUEUE]\x20APPLICATION\x20END','next','strategy','rrmemory','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','validate','lodash','util','../../../../config/environment','../../../../config/logger','routing','./strategy','redis','localhost','socket.io-emitter','queue_id','account','queue','from','joinAt','emit','clone','format','%sQueuesWaitingInteractions','%s:queue:%s','%s_queue_waiting_interaction:%s','save','remove','pick','../../rpc/openchannelQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','body','contact','list','upperFirst','channel','InteractionId','interaction','message','chat','AccountId','WebsiteId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','catch','error','create\x20queue\x20report','YYYY-MM-DD\x20HH:mm:ss','accepted','[%s][STOP:QUEUE][NAME:%s]','update','update\x20queue\x20report','waiting','timeout','toLowerCase','consequence','[%s][QUEUE]\x20%s','map','join','stop','find','Queues','createQueue','atimeout','[%s][QUEUE]\x20ROUTING\x20STOPPED'];(function(_0x565ed7,_0x398228){var _0x183ad7=function(_0x5a43d7){while(--_0x5a43d7){_0x565ed7['push'](_0x565ed7['shift']());}};_0x183ad7(++_0x398228);}(_0x84bc,0xee));var _0xc84b=function(_0x2e12a6,_0x28269e){_0x2e12a6=_0x2e12a6-0x0;var _0x45d137=_0x84bc[_0x2e12a6];return _0x45d137;};'use strict';var schema=require(_0xc84b('0x0'));var _=require(_0xc84b('0x1'));var util=require(_0xc84b('0x2'));var seqqueue=require('seq-queue');var moment=require('moment');var Redis=require('ioredis');var config=require(_0xc84b('0x3'));var logger=require(_0xc84b('0x4'))(_0xc84b('0x5'));var strategy=require(_0xc84b('0x6'));config[_0xc84b('0x7')]=_['defaults'](config['redis'],{'host':_0xc84b('0x8'),'port':0x18eb});var io=require(_0xc84b('0x9'))(new Redis(config[_0xc84b('0x7')]));var attributes=['id',_0xc84b('0xa'),_0xc84b('0xb'),_0xc84b('0xc'),_0xc84b('0xd'),_0xc84b('0xe')];function emit(_0x233b4d,_0xe4a482,_0x2d869d){io['to'](_0x233b4d)[_0xc84b('0xf')](_0xe4a482,_0x2d869d);}function emitChannelQueueInteraction(_0x1fca69,_0x423fb0,_0x989f56,_0x2b4b5b,_0xb05abd,_0x28aeda,_0xd6826f,_0x16ade9){var _0x38029b=_[_0xc84b('0x10')](_0x989f56);_0x38029b[_0xc84b('0xa')]=_0x16ade9;_0x38029b[_0xc84b('0xc')]=_0x423fb0;_0x38029b[_0xc84b('0xb')]=_0x2b4b5b;_0x38029b['id']=_0xb05abd;if(_0x28aeda){_0xd6826f[util[_0xc84b('0x11')](_0xc84b('0x12'),_0x1fca69)][_0xb05abd]=_['pick'](_0x38029b,attributes);}else{delete _0xd6826f[util[_0xc84b('0x11')](_0xc84b('0x12'),_0x1fca69)][_0xb05abd];}emit(util[_0xc84b('0x11')](_0xc84b('0x13'),_0x1fca69,_0x423fb0),util[_0xc84b('0x11')](_0xc84b('0x14'),_0x1fca69,_0x28aeda?_0xc84b('0x15'):_0xc84b('0x16')),_[_0xc84b('0x17')](_0x38029b,attributes));}var rpc={'openchannelQueueReport':require(_0xc84b('0x18')),'mailQueueReport':require('../../rpc/mailQueueReport'),'chatQueueReport':require(_0xc84b('0x19')),'smsQueueReport':require(_0xc84b('0x1a')),'faxQueueReport':require(_0xc84b('0x1b')),'whatsappQueueReport':require(_0xc84b('0x1c'))};var queue=schema({'name':{'type':_0xc84b('0x1d'),'required':!![],'message':_0xc84b('0x1e')},'timeout':{'type':_0xc84b('0x1f'),'message':_0xc84b('0x20')}});function startRouting(_0x3a21e7,_0xdce6ff,_0x2e407e,_0x30bc30){if(_0x3a21e7&&_0xdce6ff&&_0x2e407e){_0xdce6ff['waiting']+=0x1;var _0x244b27={'uniqueid':_0x3a21e7,'from':_0x2e407e[_0xc84b('0x21')]?_0x2e407e[_0xc84b('0x21')][_0xc84b('0xd')]:'','joinAt':moment()[_0xc84b('0x11')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x2e407e['contact']?_0x2e407e[_0xc84b('0x22')]['id']:null,'ListId':_0x2e407e['list']?_0x2e407e[_0xc84b('0x23')]['id']:null};_0x244b27[_[_0xc84b('0x24')](_0x2e407e[_0xc84b('0x25')])+'QueueId']=_0xdce6ff['id']||null;_0x244b27[_['upperFirst'](_0x2e407e[_0xc84b('0x25')])+_0xc84b('0x26')]=_0x2e407e['interaction']?_0x2e407e[_0xc84b('0x27')]['id']:null;_0x244b27[_[_0xc84b('0x24')](_0x2e407e[_0xc84b('0x25')])+'MessageId']=_0x2e407e[_0xc84b('0x28')]?_0x2e407e[_0xc84b('0x28')]['id']:null;_0x244b27[_['upperFirst'](_0x2e407e[_0xc84b('0x25')])+(_0x2e407e['channel']!==_0xc84b('0x29')?_0xc84b('0x2a'):_0xc84b('0x2b'))]=_0x2e407e[_0xc84b('0xb')]?_0x2e407e[_0xc84b('0xb')]['id']:null;logger[_0xc84b('0x2c')](util['format'](_0xc84b('0x2d'),_0x3a21e7,_0xdce6ff[_0xc84b('0x2e')]));emitChannelQueueInteraction(_0x2e407e[_0xc84b('0x25')],_0xdce6ff[_0xc84b('0x2e')],_0x244b27,_0x2e407e[_0xc84b('0xb')]['name'],_0x2e407e[_0xc84b('0x28')]['id'],!![],_0x30bc30,_0xdce6ff['id']);if(rpc[_0x2e407e[_0xc84b('0x25')]+'QueueReport']){return rpc[_0x2e407e['channel']+_0xc84b('0x2f')][_0xc84b('0x30')](_0x244b27)[_0xc84b('0x31')](function(_0x355494){logger[_0xc84b('0x32')](_0xc84b('0x33'));});}}}function stopRouting(_0x1d15b3,_0x1d5a42,_0xfb0bc9,_0x422b93){if(_0x1d15b3&&_0x1d5a42){_0x1d5a42['waiting']-=0x1;var _0x212c3f={'leaveAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'acceptAt':moment()['format'](_0xc84b('0x34')),'reason':_0xc84b('0x35')};logger[_0xc84b('0x2c')](util[_0xc84b('0x11')](_0xc84b('0x36'),_0x1d15b3,_0x1d5a42[_0xc84b('0x2e')]));emitChannelQueueInteraction(_0xfb0bc9[_0xc84b('0x25')],_0x1d5a42[_0xc84b('0x2e')],_0xfb0bc9[_0xc84b('0x21')],_0xfb0bc9[_0xc84b('0xb')][_0xc84b('0x2e')],_0xfb0bc9['message']['id'],![],_0x422b93,_0x1d5a42['id']);if(rpc[_0xfb0bc9[_0xc84b('0x25')]+_0xc84b('0x2f')]){return rpc[_0xfb0bc9['channel']+_0xc84b('0x2f')][_0xc84b('0x37')](_0x1d15b3,_0x212c3f)[_0xc84b('0x31')](function(_0x1c2c57){logger[_0xc84b('0x32')](_0xc84b('0x38'));});}}}function endRouting(_0x1a0944,_0x83f60d,_0x428338,_0x2a26ba){if(_0x1a0944&&_0x83f60d){_0x83f60d[_0xc84b('0x39')]-=0x1;var _0x33e010={'leaveAt':moment()[_0xc84b('0x11')](_0xc84b('0x34')),'exitAt':moment()[_0xc84b('0x11')](_0xc84b('0x34')),'reason':_0xc84b('0x3a')};logger[_0xc84b('0x2c')](util['format']('[%s][END:QUEUE][NAME:%s]',_0x1a0944,_0x83f60d['name']));emitChannelQueueInteraction(_0x428338[_0xc84b('0x25')],_0x83f60d[_0xc84b('0x2e')],_0x428338[_0xc84b('0x21')],_0x428338['account']['name'],_0x428338[_0xc84b('0x28')]['id'],![],_0x2a26ba);if(rpc[_0x428338[_0xc84b('0x25')]+_0xc84b('0x2f')]){return rpc[_0x428338[_0xc84b('0x25')]+_0xc84b('0x2f')][_0xc84b('0x37')](_0x1a0944,_0x33e010)[_0xc84b('0x31')](function(_0x3d8045){logger['error']('update\x20queue\x20report');});}}}function handleFindQueue(_0x27262c){return function(_0x45fb9d){return _0x45fb9d['name'][_0xc84b('0x3b')]()===_0x27262c[_0xc84b('0x3b')]();};}exports[_0xc84b('0x3c')]=function(_0x143678,_0x3f7a7e,_0x4d801e,_0x2062d8){return function(_0x1675a1){try{var _0x3cb472={'name':_0x3f7a7e[0x0],'timeout':_0x3f7a7e[0x1]};var _0x5ee2e7=queue[_0xc84b('0x0')](_0x3cb472,{'typecast':!![]});if(_0x5ee2e7['length']){logger[_0xc84b('0x32')](_0xc84b('0x3d'),_0x143678,_[_0xc84b('0x3e')](_0x5ee2e7,_0xc84b('0x28'))[_0xc84b('0x3f')](',\x20'));_0x1675a1[_0xc84b('0x40')]();}else{var _0x375e73=_[_0xc84b('0x41')](_0x4d801e[_0x2062d8['channel']+_0xc84b('0x42')],handleFindQueue(_0x3cb472[_0xc84b('0x2e')]));if(_0x375e73){startRouting(_0x143678,_0x375e73,_0x2062d8,_0x4d801e);var _0x3bb8b2=(_0x375e73[_0xc84b('0x3a')]||0xa)*0x3e8;var _0x216947=(_0x3cb472[_0xc84b('0x3a')]||0x14)*0x3e8;var _0xccb16a,_0x5d281a;if(_0x3bb8b2>_0x216947){_0x216947=_0x3bb8b2;}var _0x569844=seqqueue[_0xc84b('0x43')](_0x3bb8b2);_0x569844['id']=_0x143678;_0x569844[_0xc84b('0x44')]=_0x3bb8b2;_0x569844['qtimeout']=_0x216947;_0x569844['channel']=_0x2062d8[_0xc84b('0x25')];_0x4d801e['rules'][_0x143678]['on']('end',function(){logger[_0xc84b('0x2c')](_0xc84b('0x45'),_0x143678);stopRouting(_0x143678,_0x375e73,_0x2062d8,_0x4d801e);clearTimeout(_0xccb16a);_0xccb16a=undefined;_0x569844['close'](!![]);if(_0x4d801e['rules'][_0x143678]){delete _0x4d801e[_0xc84b('0x46')][_0x143678];}_0x1675a1[_0xc84b('0x40')]();});_0x4d801e[_0xc84b('0x46')][_0x143678]['on'](_0xc84b('0x47'),function(){if(_0x4d801e[_0xc84b('0x46')][_0x143678]){delete _0x4d801e[_0xc84b('0x46')][_0x143678];}});_0xccb16a=setTimeout(function(){logger[_0xc84b('0x2c')](_0xc84b('0x48'),_0x143678);endRouting(_0x143678,_0x375e73,_0x2062d8,_0x4d801e);clearTimeout(_0xccb16a);_0x569844['close'](!![]);_0x1675a1[_0xc84b('0x49')]();},_0x216947);switch(_0x375e73[_0xc84b('0x4a')]){case'rrmemory':strategy[_0xc84b('0x4b')](_0x569844,_0x375e73,_0x4d801e,_0x2062d8);break;default:strategy['beepall'](_0x569844,_0x375e73,_0x4d801e,_0x2062d8);}}else{logger[_0xc84b('0x32')](_0xc84b('0x4c'),_0x143678,_0x3cb472[_0xc84b('0x2e')]);_0x1675a1['stop']();}}}catch(_0x51b941){console['log'](_0x51b941);logger['error']('[%s][QUEUE]\x20%s',_0x143678,_0x51b941['stack']);_0x1675a1['stop']();}};}; \ 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 4258f93..b278aeb 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 _0xeacb=['busy','busyQueue','showNotification','writeLog','forcedOwnership','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','lodash','uuid','./util','routing','notificationId','squeue','agent','realtime','push','handleRun','bind','handleTimeout','timeout','drained','prototype','handleDrained','[%s][AGENT]\x20try\x20with\x20%s','isNil','info','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','agents'];(function(_0xc71feb,_0x2a2505){var _0x52041f=function(_0x2b1228){while(--_0x2b1228){_0xc71feb['push'](_0xc71feb['shift']());}};_0x52041f(++_0x2a2505);}(_0xeacb,0xbc));var _0xbeac=function(_0x197a63,_0x2eec14){_0x197a63=_0x197a63-0x0;var _0x137fd5=_0xeacb[_0x197a63];return _0x137fd5;};'use strict';var _=require(_0xbeac('0x0'));var uuid=require(_0xbeac('0x1'));var util=require(_0xbeac('0x2'));var logger=require('../../../../../config/logger')(_0xbeac('0x3'));var Agent=function(_0x569a1f,_0x3050bb,_0x1e5e93,_0xb3099f){this[_0xbeac('0x4')]=uuid['v4']();this[_0xbeac('0x5')]=_0x569a1f;this[_0xbeac('0x6')]=_0x3050bb;this[_0xbeac('0x7')]=_0x1e5e93;this[_0xbeac('0x3')]=_0xb3099f;this[_0xbeac('0x5')][_0xbeac('0x8')](this[_0xbeac('0x9')][_0xbeac('0xa')](this),this[_0xbeac('0xb')][_0xbeac('0xa')](this));this[_0xbeac('0x5')]['on'](_0xbeac('0xc'),this[_0xbeac('0xb')][_0xbeac('0xa')](this));this[_0xbeac('0x5')]['on'](_0xbeac('0xd'),this['handleDrained'][_0xbeac('0xa')](this));};Agent[_0xbeac('0xe')][_0xbeac('0x8')]=function(){this[_0xbeac('0x5')]['push'](this[_0xbeac('0x9')][_0xbeac('0xa')](this),this['handleTimeout'][_0xbeac('0xa')](this));};Agent[_0xbeac('0xe')][_0xbeac('0xf')]=function(){this[_0xbeac('0xb')](!![]);};Agent[_0xbeac('0xe')][_0xbeac('0x9')]=function(_0x26180a){logger['info'](_0xbeac('0x10'),this[_0xbeac('0x5')]['id'],this[_0xbeac('0x6')]['id']);if(_[_0xbeac('0x11')](this[_0xbeac('0x7')]['agents'][this[_0xbeac('0x6')]['id']])){logger[_0xbeac('0x12')](_0xbeac('0x13'),this[_0xbeac('0x5')]['id'],this[_0xbeac('0x6')]['id']);setTimeout(this[_0xbeac('0x8')]['bind'](this),0x3e8);}else{if(this[_0xbeac('0x3')]['forcedOwnership']||util[_0xbeac('0x14')](this['squeue']['id'],this[_0xbeac('0x7')][_0xbeac('0x15')][this[_0xbeac('0x6')]['id']],this[_0xbeac('0x5')]['channel'],![])){this['realtime'][_0xbeac('0x15')][this['agent']['id']][_0xbeac('0x16')]=!![];this['realtime'][_0xbeac('0x15')][this[_0xbeac('0x6')]['id']][_0xbeac('0x17')]=undefined;util[_0xbeac('0x18')](this[_0xbeac('0x4')],this[_0xbeac('0x5')]['id'],this[_0xbeac('0x7')][_0xbeac('0x15')][this['agent']['id']],null,this['routing']);util[_0xbeac('0x19')](this[_0xbeac('0x5')]['id'],this[_0xbeac('0x7')][_0xbeac('0x15')][this[_0xbeac('0x6')]['id']],'RINGING'+(this['routing'][_0xbeac('0x1a')]?':FORCED':''));}else{logger['info'](_0xbeac('0x1b'),this[_0xbeac('0x5')]['id'],this[_0xbeac('0x6')]['id']);setTimeout(this['push'][_0xbeac('0xa')](this),0x3e8);}}};Agent[_0xbeac('0xe')]['handleTimeout']=function(_0xd41eb9){if(_[_0xbeac('0x11')](this[_0xbeac('0x7')][_0xbeac('0x15')][this['agent']['id']])){return logger[_0xbeac('0x12')](_0xbeac('0x13'),this[_0xbeac('0x5')]['id'],this['agent']['id']);}else{logger['info'](_0xbeac('0x1c'),this[_0xbeac('0x5')]['id'],this[_0xbeac('0x6')]['id']);util[_0xbeac('0x1d')](this[_0xbeac('0x4')],this[_0xbeac('0x5')]['id'],this['realtime'][_0xbeac('0x15')][this[_0xbeac('0x6')]['id']],null,this['routing']);this[_0xbeac('0x7')][_0xbeac('0x15')][this[_0xbeac('0x6')]['id']][_0xbeac('0x16')]=![];this[_0xbeac('0x7')][_0xbeac('0x15')][this['agent']['id']][_0xbeac('0x17')]=undefined;util[_0xbeac('0x19')](this['squeue']['id'],this[_0xbeac('0x7')][_0xbeac('0x15')][this['agent']['id']],_0xd41eb9?'STOP':'TIMEOUT');}if(!_0xd41eb9){setTimeout(this[_0xbeac('0x8')][_0xbeac('0xa')](this),0x3e8);}};function agent(_0xe0cc67,_0x24db1f,_0x5434f4,_0x2bae6b){return new Agent(_0xe0cc67,_0x24db1f,_0x5434f4,_0x2bae6b);}module['exports']=agent; \ No newline at end of file +var _0x41e8=['showNotification','writeLog','RINGING',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','hideNotification','STOP','TIMEOUT','exports','lodash','uuid','../../../../../config/logger','routing','notificationId','squeue','agent','realtime','push','handleRun','bind','handleTimeout','timeout','drained','handleDrained','prototype','info','[%s][AGENT]\x20try\x20with\x20%s','isNil','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable','channel','busy'];(function(_0x57cbaa,_0x2086c0){var _0x58cef9=function(_0x1dad8d){while(--_0x1dad8d){_0x57cbaa['push'](_0x57cbaa['shift']());}};_0x58cef9(++_0x2086c0);}(_0x41e8,0xd5));var _0x841e=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0x41e8[_0x2a6809];return _0x11c371;};'use strict';var _=require(_0x841e('0x0'));var uuid=require(_0x841e('0x1'));var util=require('./util');var logger=require(_0x841e('0x2'))(_0x841e('0x3'));var Agent=function(_0x58b3aa,_0x107e6b,_0xf0ccab,_0x474fcd){this[_0x841e('0x4')]=uuid['v4']();this[_0x841e('0x5')]=_0x58b3aa;this[_0x841e('0x6')]=_0x107e6b;this[_0x841e('0x7')]=_0xf0ccab;this[_0x841e('0x3')]=_0x474fcd;this[_0x841e('0x5')][_0x841e('0x8')](this[_0x841e('0x9')][_0x841e('0xa')](this),this[_0x841e('0xb')]['bind'](this));this[_0x841e('0x5')]['on'](_0x841e('0xc'),this[_0x841e('0xb')][_0x841e('0xa')](this));this[_0x841e('0x5')]['on'](_0x841e('0xd'),this[_0x841e('0xe')][_0x841e('0xa')](this));};Agent['prototype'][_0x841e('0x8')]=function(){this[_0x841e('0x5')][_0x841e('0x8')](this[_0x841e('0x9')]['bind'](this),this[_0x841e('0xb')][_0x841e('0xa')](this));};Agent[_0x841e('0xf')][_0x841e('0xe')]=function(){this[_0x841e('0xb')](!![]);};Agent[_0x841e('0xf')][_0x841e('0x9')]=function(_0xba49b7){logger[_0x841e('0x10')](_0x841e('0x11'),this[_0x841e('0x5')]['id'],this[_0x841e('0x6')]['id']);if(_[_0x841e('0x12')](this[_0x841e('0x7')][_0x841e('0x13')][this[_0x841e('0x6')]['id']])){logger['info'](_0x841e('0x14'),this[_0x841e('0x5')]['id'],this[_0x841e('0x6')]['id']);setTimeout(this['push'][_0x841e('0xa')](this),0x3e8);}else{if(this[_0x841e('0x3')][_0x841e('0x15')]||util[_0x841e('0x16')](this[_0x841e('0x5')]['id'],this[_0x841e('0x7')][_0x841e('0x13')][this[_0x841e('0x6')]['id']],this[_0x841e('0x5')][_0x841e('0x17')],![])){this['realtime'][_0x841e('0x13')][this[_0x841e('0x6')]['id']][_0x841e('0x18')]=!![];this[_0x841e('0x7')][_0x841e('0x13')][this[_0x841e('0x6')]['id']]['busyQueue']=undefined;util[_0x841e('0x19')](this[_0x841e('0x4')],this[_0x841e('0x5')]['id'],this[_0x841e('0x7')][_0x841e('0x13')][this['agent']['id']],null,this[_0x841e('0x3')]);util[_0x841e('0x1a')](this[_0x841e('0x5')]['id'],this[_0x841e('0x7')][_0x841e('0x13')][this[_0x841e('0x6')]['id']],_0x841e('0x1b')+(this['routing']['forcedOwnership']?_0x841e('0x1c'):''));}else{logger[_0x841e('0x10')](_0x841e('0x1d'),this[_0x841e('0x5')]['id'],this['agent']['id']);setTimeout(this[_0x841e('0x8')][_0x841e('0xa')](this),0x3e8);}}};Agent[_0x841e('0xf')][_0x841e('0xb')]=function(_0x5ae58c){if(_['isNil'](this[_0x841e('0x7')][_0x841e('0x13')][this[_0x841e('0x6')]['id']])){return logger['info'](_0x841e('0x14'),this['squeue']['id'],this[_0x841e('0x6')]['id']);}else{logger['info']('[%s][AGENT]\x20timeout\x20with\x20%s',this[_0x841e('0x5')]['id'],this[_0x841e('0x6')]['id']);util[_0x841e('0x1e')](this['notificationId'],this['squeue']['id'],this[_0x841e('0x7')]['agents'][this[_0x841e('0x6')]['id']],null,this[_0x841e('0x3')]);this[_0x841e('0x7')][_0x841e('0x13')][this[_0x841e('0x6')]['id']][_0x841e('0x18')]=![];this[_0x841e('0x7')][_0x841e('0x13')][this[_0x841e('0x6')]['id']]['busyQueue']=undefined;util[_0x841e('0x1a')](this[_0x841e('0x5')]['id'],this['realtime'][_0x841e('0x13')][this[_0x841e('0x6')]['id']],_0x5ae58c?_0x841e('0x1f'):_0x841e('0x20'));}if(!_0x5ae58c){setTimeout(this['push'][_0x841e('0xa')](this),0x3e8);}};function agent(_0x5f2a1b,_0x38291e,_0x4de454,_0xc05cef){return new Agent(_0x5f2a1b,_0x38291e,_0x4de454,_0xc05cef);}module[_0x841e('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 4cb6e9a..a49c915 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 _0x8a8b=['length','isAgentAvailable','agents','writeLog','busy','notificationId','info','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','[%s][QUEUE]\x20EMPTY','STOP','busyQueue','exports','lodash','../../../../../config/logger','routing','squeue','queue','realtime','handleRun','handleTimeout','bind','drained','handleDrained','prototype','push','isNil','Agents'];(function(_0x575057,_0x14baf3){var _0x49dbc8=function(_0x23599a){while(--_0x23599a){_0x575057['push'](_0x575057['shift']());}};_0x49dbc8(++_0x14baf3);}(_0x8a8b,0xae));var _0xb8a8=function(_0x5d3d0f,_0x57f431){_0x5d3d0f=_0x5d3d0f-0x0;var _0x5d8679=_0x8a8b[_0x5d3d0f];return _0x5d8679;};'use strict';var _=require(_0xb8a8('0x0'));var uuid=require('uuid');var util=require('./util');var logger=require(_0xb8a8('0x1'))(_0xb8a8('0x2'));var Beepall=function(_0x4f56d4,_0x13bc8b,_0x5710bc,_0xca9854){this['notificationId']=uuid['v4']();this[_0xb8a8('0x3')]=_0x4f56d4;this[_0xb8a8('0x4')]=_0x13bc8b;this[_0xb8a8('0x5')]=_0x5710bc;this['routing']=_0xca9854;this[_0xb8a8('0x3')]['push'](this[_0xb8a8('0x6')]['bind'](this),this[_0xb8a8('0x7')][_0xb8a8('0x8')](this));this[_0xb8a8('0x3')]['on']('timeout',this[_0xb8a8('0x7')][_0xb8a8('0x8')](this));this[_0xb8a8('0x3')]['on'](_0xb8a8('0x9'),this[_0xb8a8('0xa')][_0xb8a8('0x8')](this));};Beepall[_0xb8a8('0xb')][_0xb8a8('0xc')]=function(){this[_0xb8a8('0x3')][_0xb8a8('0xc')](this[_0xb8a8('0x6')][_0xb8a8('0x8')](this),this[_0xb8a8('0x7')]['bind'](this));};Beepall[_0xb8a8('0xb')][_0xb8a8('0xa')]=function(_0x37d54b){this[_0xb8a8('0x7')](!![]);};Beepall[_0xb8a8('0xb')][_0xb8a8('0x6')]=function(_0x3cf353){var _0x15436d=!![];if(!_[_0xb8a8('0xd')](this[_0xb8a8('0x4')])&&!_[_0xb8a8('0xd')](this['queue'][_0xb8a8('0xe')])&&this['queue'][_0xb8a8('0xe')][_0xb8a8('0xf')]>0x0){for(var _0x412041=0x0,_0x72df;_0x4120410x0){for(var _0x443443=0x0,_0x21248a;_0x4434430x0&&_0x1e512d[_0x219be1+_0x5474('0x26')]>=_0x1e512d[_0x219be1+'Capacity']){writeLog(_0xe4850d,_0x1e512d,_0x219be1[_0x5474('0x27')]()+'\x20MAXCAPACITY');return![];}}return!![];};exports[_0x5474('0x28')]=function(_0x1384e4,_0x2a8730,_0x5865fe,_0x574ed6,_0x42b99a){return sendNotification(!![],_0x1384e4,_0x2a8730,_0x5865fe,_0x574ed6,_0x42b99a);};exports['hideNotification']=function(_0x57731b,_0x5d2381,_0x492a31,_0x168dee,_0x1b8adb){return sendNotification(![],_0x57731b,_0x5d2381,_0x492a31,_0x168dee,_0x1b8adb);};exports['writeLog']=writeLog; \ No newline at end of file +var _0x27a0=['writeLog','util','../utils','mustache','ioredis','../../../../../config/environment','redis','localhost','socket.io-emitter','emit','user:%s','name','user:save','split','\x20interaction','account','notificationShake','body','queue','getMustacheRender','msg','I\x20can\x27t\x20render\x20your\x20template','error','format','message','notification:%s','info','[%s][QUEUE][AGENT:%s][STATUS:%s]','isAgentAvailable','busy','online','Pause','PAUSE','hasOwnProperty','Capacity','CurrentCapacity','toUpperCase','showNotification'];(function(_0x456676,_0x26cba9){var _0x11d866=function(_0x21c605){while(--_0x21c605){_0x456676['push'](_0x456676['shift']());}};_0x11d866(++_0x26cba9);}(_0x27a0,0xbf));var _0x027a=function(_0x5eaaa8,_0x49fc36){_0x5eaaa8=_0x5eaaa8-0x0;var _0x5b7a35=_0x27a0[_0x5eaaa8];return _0x5b7a35;};'use strict';var _=require('lodash');var util=require(_0x027a('0x0'));var utils=require(_0x027a('0x1'));var Mustache=require(_0x027a('0x2'));var Redis=require(_0x027a('0x3'));var config=require(_0x027a('0x4'));var logger=require('../../../../../config/logger')('routing');config['redis']=_['defaults'](config[_0x027a('0x5')],{'host':_0x027a('0x6'),'port':0x18eb});var io=require(_0x027a('0x7'))(new Redis(config[_0x027a('0x5')]));function emit(_0xe233ed,_0x3c7d67,_0x550fbb){io['to'](_0xe233ed)[_0x027a('0x8')](_0x3c7d67,_0x550fbb);}function sendNotification(_0x271dfe,_0x277f49,_0x4ccee2,_0x44c56a,_0x42ccac,_0x2d13a2){io['to'](util['format'](_0x027a('0x9'),_0x44c56a[_0x027a('0xa')]))[_0x027a('0x8')](_0x027a('0xb'),_0x44c56a);var _0x172eb4=_0x2d13a2||{};var _0x267afc=_0x4ccee2[_0x027a('0xc')]('.');var _0x874d2d={'uniqueid':_0x277f49,'channel':_0x267afc[0x0],'id':_0x267afc[0x1],'title':_0x267afc[0x0]+_0x027a('0xd'),'interactionId':_0x267afc[0x2],'queue':_0x42ccac?_0x42ccac[_0x027a('0xa')]:null,'sound':_0x172eb4[_0x027a('0xe')]['notificationSound'],'shake':_0x172eb4[_0x027a('0xe')][_0x027a('0xf')]};try{if(!_0x172eb4[_0x027a('0x10')]){_0x172eb4[_0x027a('0x10')]={};}if(_0x42ccac){_0x172eb4[_0x027a('0x10')]['queue']=_0x42ccac;}else if(_0x172eb4['body'][_0x027a('0x11')]){delete _0x172eb4['body'][_0x027a('0x11')];}_0x874d2d['msg']=utils[_0x027a('0x12')](_0x172eb4['account']['notificationTemplate'],_0x172eb4);}catch(_0x47ceb7){_0x874d2d[_0x027a('0x13')]=_0x027a('0x14');logger[_0x027a('0x15')](util[_0x027a('0x16')]('[%s][QUEUE]\x20%s',_0x277f49,_0x47ceb7[_0x027a('0x17')]));}io['to'](util[_0x027a('0x16')]('user:%s',_0x44c56a['name']))[_0x027a('0x8')](util['format'](_0x027a('0x18'),_0x271dfe?'save':'remove'),_0x874d2d);}function writeLog(_0x58b129,_0x4b4f90,_0x18efe7){return logger[_0x027a('0x19')](util[_0x027a('0x16')](_0x027a('0x1a'),_0x58b129,_0x4b4f90['name'],_0x18efe7));}exports[_0x027a('0x1b')]=function(_0x119a5c,_0x20e2da,_0x3dee99,_0x178ed8){if(_0x20e2da[_0x027a('0x1c')]){writeLog(_0x119a5c,_0x20e2da,'BUSY');return![];}if(!_0x20e2da[_0x027a('0x1d')]){writeLog(_0x119a5c,_0x20e2da,'OFFLINE');return![];}if(_0x20e2da[_0x3dee99+_0x027a('0x1e')]){writeLog(_0x119a5c,_0x20e2da,_0x027a('0x1f'));return![];}if(_0x178ed8&&_0x20e2da[_0x027a('0x20')](_0x3dee99+_0x027a('0x21'))&&_0x20e2da['hasOwnProperty'](_0x3dee99+'CurrentCapacity')){if(_0x20e2da[_0x3dee99+_0x027a('0x21')]>0x0&&_0x20e2da[_0x3dee99+_0x027a('0x22')]>=_0x20e2da[_0x3dee99+_0x027a('0x21')]){writeLog(_0x119a5c,_0x20e2da,_0x3dee99[_0x027a('0x23')]()+'\x20MAXCAPACITY');return![];}}return!![];};exports[_0x027a('0x24')]=function(_0x55a8cd,_0x953887,_0x488920,_0x2be389,_0x4d5a25){return sendNotification(!![],_0x55a8cd,_0x953887,_0x488920,_0x2be389,_0x4d5a25);};exports['hideNotification']=function(_0x31385d,_0x5782ac,_0x47a365,_0x448ba0,_0x52ca99){return sendNotification(![],_0x31385d,_0x5782ac,_0x47a365,_0x448ba0,_0x52ca99);};exports[_0x027a('0x25')]=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 d60407d..1e49129 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 _0x8c32=['isObject','stringify','validate','shelljs','lodash','./utils','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','length','error','[%s][SYSTEM]\x20%s','map','message','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s'];(function(_0x1be69b,_0x528369){var _0x5b9375=function(_0x1ca607){while(--_0x1ca607){_0x1be69b['push'](_0x1be69b['shift']());}};_0x5b9375(++_0x528369);}(_0x8c32,0x89));var _0x28c3=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x8c32[_0x1cc8fe];return _0x230054;};'use strict';var schema=require(_0x28c3('0x0'));var sh=require(_0x28c3('0x1'));var _=require(_0x28c3('0x2'));var utils=require(_0x28c3('0x3'));var logger=require('../../../../config/logger')(_0x28c3('0x4'));var system=schema({'command':{'type':_0x28c3('0x5'),'required':!![],'message':_0x28c3('0x6')}});exports['consequence']=function(_0x2df593,_0x257e9b){return function(_0x4824cf){try{var _0x893928={'command':_0x257e9b[0x0]};var _0x32a8aa=system[_0x28c3('0x0')](_0x893928,{'typecast':!![]});if(_0x32a8aa[_0x28c3('0x7')]){logger[_0x28c3('0x8')](_0x28c3('0x9'),_0x2df593,_[_0x28c3('0xa')](_0x32a8aa,_0x28c3('0xb'))[_0x28c3('0xc')](',\x20'));logger[_0x28c3('0xd')](_0x28c3('0xe'),_0x2df593);_0x4824cf[_0x28c3('0xf')]();}else{var _0x162f76=this;var _0x341a37=utils[_0x28c3('0x10')](_0x257e9b[0x0],this);logger[_0x28c3('0xd')]('[%s][SYSTEM]\x20commnad:\x20%s',_0x2df593,_0x341a37);sh[_0x28c3('0x11')](_[_0x28c3('0x12')](_0x341a37),function(_0x58b3af,_0x4ae211){logger[_0x28c3('0xd')](_0x28c3('0x13'),_0x2df593,_0x58b3af);if(_0x58b3af==0x0){var _0x943fdd=_0x4ae211['replace'](/(\r\n|\n|\r)/gm,'');if(_[_0x28c3('0x14')](_0x257e9b[0x1])||_[_0x28c3('0x15')](_0x257e9b[0x1])){logger['info'](_0x28c3('0x16'),_0x2df593);_0x162f76[_0x28c3('0x17')][_0x257e9b[0x1]]=_0x943fdd;}else{logger[_0x28c3('0xd')](_0x28c3('0x18'),_0x2df593,_0x257e9b[0x1],_0x943fdd);_0x162f76[_0x28c3('0x17')][_0x257e9b[0x1]]=_0x943fdd;}}_0x4824cf[_0x28c3('0xf')]();});}}catch(_0x5eb4c8){logger['error'](_0x28c3('0x9'),_0x2df593,_[_0x28c3('0x19')](_0x5eb4c8)?JSON[_0x28c3('0x1a')](_0x5eb4c8):_0x5eb4c8);logger['info'](_0x28c3('0xe'),_0x2df593);_0x4824cf[_0x28c3('0xf')]();}};}; \ No newline at end of file +var _0xce56=['[%s][SYSTEM]\x20commnad:\x20%s','exec','trim','replace','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','error','isObject','validate','shelljs','lodash','./utils','routing','length','[%s][SYSTEM]\x20%s','message','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender'];(function(_0x544867,_0x10dcd7){var _0x14a5fb=function(_0x152bab){while(--_0x152bab){_0x544867['push'](_0x544867['shift']());}};_0x14a5fb(++_0x10dcd7);}(_0xce56,0x173));var _0x6ce5=function(_0x117f4c,_0x36a9b1){_0x117f4c=_0x117f4c-0x0;var _0x2b24e9=_0xce56[_0x117f4c];return _0x2b24e9;};'use strict';var schema=require(_0x6ce5('0x0'));var sh=require(_0x6ce5('0x1'));var _=require(_0x6ce5('0x2'));var utils=require(_0x6ce5('0x3'));var logger=require('../../../../config/logger')(_0x6ce5('0x4'));var system=schema({'command':{'type':'string','required':!![],'message':'command\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports['consequence']=function(_0x36185f,_0x502fd2){return function(_0x133b50){try{var _0x2ebd64={'command':_0x502fd2[0x0]};var _0x4f1fbd=system[_0x6ce5('0x0')](_0x2ebd64,{'typecast':!![]});if(_0x4f1fbd[_0x6ce5('0x5')]){logger['error'](_0x6ce5('0x6'),_0x36185f,_['map'](_0x4f1fbd,_0x6ce5('0x7'))[_0x6ce5('0x8')](',\x20'));logger[_0x6ce5('0x9')](_0x6ce5('0xa'),_0x36185f);_0x133b50[_0x6ce5('0xb')]();}else{var _0x16e700=this;var _0x3de28f=utils[_0x6ce5('0xc')](_0x502fd2[0x0],this);logger['info'](_0x6ce5('0xd'),_0x36185f,_0x3de28f);sh[_0x6ce5('0xe')](_[_0x6ce5('0xf')](_0x3de28f),function(_0x4325f7,_0x1a7947){logger[_0x6ce5('0x9')]('[%s][SYSTEM]\x20result\x20code:\x20%s',_0x36185f,_0x4325f7);if(_0x4325f7==0x0){var _0x291b56=_0x1a7947[_0x6ce5('0x10')](/(\r\n|\n|\r)/gm,'');if(_[_0x6ce5('0x11')](_0x502fd2[0x1])||_[_0x6ce5('0x12')](_0x502fd2[0x1])){logger[_0x6ce5('0x9')](_0x6ce5('0x13'),_0x36185f);_0x16e700[_0x6ce5('0x14')][_0x502fd2[0x1]]=_0x291b56;}else{logger[_0x6ce5('0x9')](_0x6ce5('0x15'),_0x36185f,_0x502fd2[0x1],_0x291b56);_0x16e700[_0x6ce5('0x14')][_0x502fd2[0x1]]=_0x291b56;}}_0x133b50['next']();});}}catch(_0x2b6f49){logger[_0x6ce5('0x16')](_0x6ce5('0x6'),_0x36185f,_[_0x6ce5('0x17')](_0x2b6f49)?JSON['stringify'](_0x2b6f49):_0x2b6f49);logger['info'](_0x6ce5('0xa'),_0x36185f);_0x133b50[_0x6ce5('0xb')]();}};}; \ 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 66fbefb..576bd4e 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 _0xd006=['number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][TAG]\x20%s','map','message','join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel','Interaction','addTags','then','interaction','stringify','isObject','validate','../../rpc/chatInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../../../config/logger','routing'];(function(_0x1d6539,_0xab393d){var _0x16781f=function(_0x1b0354){while(--_0x1b0354){_0x1d6539['push'](_0x1d6539['shift']());}};_0x16781f(++_0xab393d);}(_0xd006,0x1de));var _0x6d00=function(_0x419e17,_0x7fe78c){_0x419e17=_0x419e17-0x0;var _0x1f2044=_0xd006[_0x419e17];return _0x1f2044;};'use strict';var schema=require(_0x6d00('0x0'));var _=require('lodash');var rpc={'chatInteraction':require(_0x6d00('0x1')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0x6d00('0x2')),'mailInteraction':require(_0x6d00('0x3')),'faxInteraction':require(_0x6d00('0x4')),'whatsappInteraction':require(_0x6d00('0x5'))};var logger=require(_0x6d00('0x6'))(_0x6d00('0x7'));var tag=schema({'tag':{'type':_0x6d00('0x8'),'required':!![],'message':_0x6d00('0x9')}});exports[_0x6d00('0xa')]=function(_0x5110d8,_0x1c2696,_0x137693,_0x29aab7){return function(_0x25be9f){try{var _0x111db4={'tag':_0x1c2696[0x0]};var _0x89808=tag[_0x6d00('0x0')](_0x111db4,{'typecast':!![]});if(_0x89808[_0x6d00('0xb')]){logger[_0x6d00('0xc')](_0x6d00('0xd'),_0x5110d8,_[_0x6d00('0xe')](_0x89808,_0x6d00('0xf'))[_0x6d00('0x10')](',\x20'));logger[_0x6d00('0x11')](_0x6d00('0x12'),_0x5110d8);_0x25be9f[_0x6d00('0x13')]();}else{var _0x48fe1d={'ids':[_0x1c2696[0x0]]};if(rpc[_0x29aab7[_0x6d00('0x14')]+'Interaction']){rpc[_0x29aab7[_0x6d00('0x14')]+_0x6d00('0x15')][_0x6d00('0x16')](_0x29aab7['interaction']['id'],_0x48fe1d)[_0x6d00('0x17')](function(_0x3bde73){logger[_0x6d00('0x11')]('[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s',_0x5110d8,_0x1c2696[0x1],_0x29aab7[_0x6d00('0x14')],_0x29aab7[_0x6d00('0x18')]['id']);})['catch'](function(_0x168e74){logger[_0x6d00('0xc')]('[%s][TAG]\x20%s',_0x5110d8,JSON[_0x6d00('0x19')](_0x168e74));logger[_0x6d00('0x11')](_0x6d00('0x12'),_0x5110d8);})['finally'](function(){_0x25be9f[_0x6d00('0x13')]();});}}}catch(_0x42c928){logger[_0x6d00('0xc')](_0x6d00('0xd'),_0x5110d8,_[_0x6d00('0x1a')](_0x42c928)?JSON[_0x6d00('0x19')](_0x42c928):_0x42c928);logger['info'](_0x6d00('0x12'),_0x5110d8);_0x25be9f[_0x6d00('0x13')]();}};}; \ No newline at end of file +var _0xc2a5=['info','finally','isObject','lodash','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../../../config/logger','routing','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','validate','error','[%s][TAG]\x20%s','map','message','join','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel','Interaction','then','catch'];(function(_0x304386,_0x319535){var _0x2696b2=function(_0x8a098){while(--_0x8a098){_0x304386['push'](_0x304386['shift']());}};_0x2696b2(++_0x319535);}(_0xc2a5,0x12e));var _0x5c2a=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xc2a5[_0x17d9e3];return _0x14192d;};'use strict';var schema=require('validate');var _=require(_0x5c2a('0x0'));var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0x5c2a('0x1')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require(_0x5c2a('0x2')),'faxInteraction':require(_0x5c2a('0x3')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var logger=require(_0x5c2a('0x4'))(_0x5c2a('0x5'));var tag=schema({'tag':{'type':'number','required':!![],'message':_0x5c2a('0x6')}});exports[_0x5c2a('0x7')]=function(_0x246773,_0x4ca93d,_0x496667,_0x1c2af8){return function(_0x3386ad){try{var _0x557f3a={'tag':_0x4ca93d[0x0]};var _0x8050f3=tag[_0x5c2a('0x8')](_0x557f3a,{'typecast':!![]});if(_0x8050f3['length']){logger[_0x5c2a('0x9')](_0x5c2a('0xa'),_0x246773,_[_0x5c2a('0xb')](_0x8050f3,_0x5c2a('0xc'))[_0x5c2a('0xd')](',\x20'));logger['info'](_0x5c2a('0xe'),_0x246773);_0x3386ad[_0x5c2a('0xf')]();}else{var _0x98e672={'ids':[_0x4ca93d[0x0]]};if(rpc[_0x1c2af8[_0x5c2a('0x10')]+_0x5c2a('0x11')]){rpc[_0x1c2af8[_0x5c2a('0x10')]+_0x5c2a('0x11')]['addTags'](_0x1c2af8['interaction']['id'],_0x98e672)[_0x5c2a('0x12')](function(_0x1dd661){logger['info']('[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s',_0x246773,_0x4ca93d[0x1],_0x1c2af8[_0x5c2a('0x10')],_0x1c2af8['interaction']['id']);})[_0x5c2a('0x13')](function(_0x3b2db6){logger[_0x5c2a('0x9')](_0x5c2a('0xa'),_0x246773,JSON['stringify'](_0x3b2db6));logger[_0x5c2a('0x14')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x246773);})[_0x5c2a('0x15')](function(){_0x3386ad[_0x5c2a('0xf')]();});}}}catch(_0x4494fe){logger[_0x5c2a('0x9')](_0x5c2a('0xa'),_0x246773,_[_0x5c2a('0x16')](_0x4494fe)?JSON['stringify'](_0x4494fe):_0x4494fe);logger[_0x5c2a('0x14')](_0x5c2a('0xe'),_0x246773);_0x3386ad[_0x5c2a('0xf')]();}};}; \ 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 79994e9..cddfcd0 100644 --- a/server/services/routing/server/applications/utils.js +++ b/server/services/routing/server/applications/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['message','account','interaction','mustache','lodash','exports','render','body','contact'];(function(_0x3d0958,_0x2e5044){var _0x4eec7e=function(_0x29b1b0){while(--_0x29b1b0){_0x3d0958['push'](_0x3d0958['shift']());}};_0x4eec7e(++_0x2e5044);}(_0xa9e0,0x123));var _0x0a9e=function(_0x36dfbd,_0x5bfe2d){_0x36dfbd=_0x36dfbd-0x0;var _0x4ecad9=_0xa9e0[_0x36dfbd];return _0x4ecad9;};'use strict';var Mustache=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'getMustacheRender':function(_0x5dd881,_0x550fbc){return Mustache[_0x0a9e('0x3')](_0x5dd881,_['merge'](_0x550fbc[_0x0a9e('0x4')],{'contact':_0x550fbc[_0x0a9e('0x5')],'message':_0x550fbc[_0x0a9e('0x6')],'account':_0x550fbc[_0x0a9e('0x7')],'interaction':_0x550fbc[_0x0a9e('0x8')],'list':_0x550fbc['list']}))||'';}}; \ No newline at end of file +var _0xe706=['exports','render','merge','body','contact','message','account','interaction','list','mustache','lodash'];(function(_0x4bdc81,_0x343b72){var _0x150762=function(_0x40c507){while(--_0x40c507){_0x4bdc81['push'](_0x4bdc81['shift']());}};_0x150762(++_0x343b72);}(_0xe706,0xa3));var _0x6e70=function(_0x49dd7e,_0x48b1e5){_0x49dd7e=_0x49dd7e-0x0;var _0x4c4f6e=_0xe706[_0x49dd7e];return _0x4c4f6e;};'use strict';var Mustache=require(_0x6e70('0x0'));var _=require(_0x6e70('0x1'));module[_0x6e70('0x2')]={'getMustacheRender':function(_0x5e8446,_0x2cae77){return Mustache[_0x6e70('0x3')](_0x5e8446,_[_0x6e70('0x4')](_0x2cae77[_0x6e70('0x5')],{'contact':_0x2cae77[_0x6e70('0x6')],'message':_0x2cae77[_0x6e70('0x7')],'account':_0x2cae77[_0x6e70('0x8')],'interaction':_0x2cae77[_0x6e70('0x9')],'list':_0x2cae77[_0x6e70('0xa')]}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index 9485882..ef0603c 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 _0xd884=['rules','channel','message','interaction','applications','isArray','length','existsSync','.js','toLowerCase','autoreply','appdata','split','push','slice','join','dialogflow','dialogflowv2','tag','TagId','%s:%s:%s','app','intervals','./applications/','consequence','priority','info','Push\x20new\x20rule','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','execute','Applications\x20executed','stringify','emit','complete','No\x20applications\x20to\x20execute','stack','routing\x20is\x20empty','agent','agents','busy','busyQueue','end','QueueReport','update','UserId','catch','message\x20is\x20empty','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','chatQueues','available','loggedIn','waiting','mailQueues','paused','openchannelQueues','name','smsQueues','faxQueues','whatsappQueues','values','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','path','jayson/promise','bluebird','uuid','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','%s.%s.%s','isNil','IntervalId','map','Intervals','interval','listen'];(function(_0xe51596,_0x314d5b){var _0x22c705=function(_0x4c6f94){while(--_0x4c6f94){_0xe51596['push'](_0xe51596['shift']());}};_0x22c705(++_0x314d5b);}(_0xd884,0x1d4));var _0x4d88=function(_0x14eae5,_0x216db4){_0x14eae5=_0x14eae5-0x0;var _0x3ebd1e=_0xd884[_0x14eae5];return _0x3ebd1e;};'use strict';var _=require(_0x4d88('0x0'));var util=require(_0x4d88('0x1'));var path=require(_0x4d88('0x2'));var fs=require('fs');var jayson=require(_0x4d88('0x3'));var BPromise=require(_0x4d88('0x4'));var uuid=require(_0x4d88('0x5'));var config=require('../../../config/environment');var logger=require(_0x4d88('0x6'))(_0x4d88('0x7'));var rpc={'openchannelQueueReport':require(_0x4d88('0x8')),'mailQueueReport':require(_0x4d88('0x9')),'chatQueueReport':require(_0x4d88('0xa')),'smsQueueReport':require(_0x4d88('0xb')),'faxQueueReport':require('../rpc/faxQueueReport'),'whatsappQueueReport':require(_0x4d88('0xc'))};var RuleEngine=require(_0x4d88('0xd'));function getId(_0x526341,_0x287e86,_0x218a8d){return util[_0x4d88('0xe')](_0x4d88('0xf'),_0x526341,_0x287e86||0x0,_0x218a8d||0x0);}function getIntervals(_0x47f53a,_0x69dfd7){var _0x2e6fdd=[];if(!_[_0x4d88('0x10')](_0x69dfd7[_0x4d88('0x11')])&&!_['isNil'](_0x47f53a[_0x69dfd7[_0x4d88('0x11')]])&&!_[_0x4d88('0x10')](_0x47f53a[_0x69dfd7[_0x4d88('0x11')]]['Intervals'])){_0x2e6fdd=_[_0x4d88('0x12')](_0x47f53a[_0x69dfd7[_0x4d88('0x11')]][_0x4d88('0x13')],_0x4d88('0x14'));}else if(!_[_0x4d88('0x10')](_0x69dfd7[_0x4d88('0x14')])){_0x2e6fdd=[_0x69dfd7['interval']];}return _0x2e6fdd;}exports[_0x4d88('0x15')]=function(_0x27c9ac){_0x27c9ac[_0x4d88('0x16')]={};return new BPromise(function(_0x1c9aad,_0x14b9a5){var _0x5d705b={'Start':function(_0x4cb54b){var _0x5b92c8=this;return new Promise(function(_0x45c18e,_0x56e7fb){if(_0x4cb54b){try{var _0x42b512=[];var _0x455baa=getId(_0x4cb54b[_0x4d88('0x17')],_0x4cb54b['message']?_0x4cb54b[_0x4d88('0x18')]['id']:0x0,_0x4cb54b[_0x4d88('0x19')]?_0x4cb54b[_0x4d88('0x19')]['id']:0x0);if(_0x4cb54b[_0x4d88('0x1a')]&&_[_0x4d88('0x1b')](_0x4cb54b[_0x4d88('0x1a')])&&_0x4cb54b[_0x4d88('0x1a')]['length']){for(var _0xec6776=0x0;_0xec6776<_0x4cb54b['applications'][_0x4d88('0x1c')];_0xec6776+=0x1){var _0x3b57d4=_0x4cb54b['applications'][_0xec6776];if(fs[_0x4d88('0x1d')](path['join'](__dirname,_0x4d88('0x1a'),_0x3b57d4['app']+_0x4d88('0x1e')))){var _0x40e349=[];switch(_0x3b57d4['app'][_0x4d88('0x1f')]()){case _0x4d88('0x20'):var _0x13a7f2=_0x3b57d4[_0x4d88('0x21')][_0x4d88('0x22')](',');if(_0x4cb54b[_0x4d88('0x17')]==='mail'){_0x40e349[_0x4d88('0x23')](_0x13a7f2[0x0]);_0x40e349[_0x4d88('0x23')](_0x13a7f2[0x1]);_0x40e349[_0x4d88('0x23')](_0x13a7f2[_0x4d88('0x24')](0x2,_0x13a7f2[_0x4d88('0x1c')])['join'](','));}else{_0x40e349[_0x4d88('0x23')](_0x13a7f2[0x0]);_0x40e349['push'](_0x13a7f2['slice'](0x1,_0x13a7f2[_0x4d88('0x1c')])[_0x4d88('0x25')](','));}break;case _0x4d88('0x26'):var _0x3d477c=_0x3b57d4[_0x4d88('0x21')][_0x4d88('0x22')](',');_0x40e349[_0x4d88('0x23')](_0x3d477c[0x0]);_0x40e349[_0x4d88('0x23')](_0x3d477c[0x1]);_0x40e349[_0x4d88('0x23')](_0x3d477c[_0x4d88('0x24')](0x2,_0x3d477c['length'])[_0x4d88('0x25')](','));break;case _0x4d88('0x27'):var _0x1d5eac=_0x3b57d4['appdata'][_0x4d88('0x22')](',');_0x40e349[_0x4d88('0x23')](_0x1d5eac[0x0]);_0x40e349[_0x4d88('0x23')](_0x1d5eac[0x1]);_0x40e349[_0x4d88('0x23')](_0x1d5eac[0x2]);_0x40e349[_0x4d88('0x23')](_0x1d5eac[0x3]);_0x40e349[_0x4d88('0x23')](_0x1d5eac[_0x4d88('0x24')](0x4,_0x1d5eac['length'])[_0x4d88('0x25')](','));break;case'amazonlex':var _0x3db9a4=_0x3b57d4[_0x4d88('0x21')][_0x4d88('0x22')](',');_0x40e349[_0x4d88('0x23')](_0x3db9a4[0x0]);_0x40e349[_0x4d88('0x23')](_0x3db9a4[0x1]);_0x40e349[_0x4d88('0x23')](_0x3db9a4[0x2]);_0x40e349[_0x4d88('0x23')](_0x3db9a4[0x3]);_0x40e349[_0x4d88('0x23')](_0x3db9a4[_0x4d88('0x24')](0x4,_0x3db9a4[_0x4d88('0x1c')])[_0x4d88('0x25')](','));break;case _0x4d88('0x18'):_0x40e349[_0x4d88('0x23')](_0x3b57d4[_0x4d88('0x21')]);break;case _0x4d88('0x28'):_0x40e349['push'](_0x3b57d4[_0x4d88('0x29')]);_0x40e349[_0x4d88('0x23')](_0x3b57d4[_0x4d88('0x21')]);break;default:_0x40e349=_[_0x4d88('0x10')](_0x3b57d4[_0x4d88('0x21')])?[]:_0x3b57d4[_0x4d88('0x21')][_0x4d88('0x22')](',');}var _0x5d0384={'id':util[_0x4d88('0xe')](_0x4d88('0x2a'),_0x455baa,_0x3b57d4['id'],_0x3b57d4[_0x4d88('0x2b')]),'condition':require('./interval')['condition'](_0x455baa,getIntervals(_0x27c9ac[_0x4d88('0x2c')],_0x3b57d4),_0x27c9ac),'consequence':require(_0x4d88('0x2d')+_0x3b57d4[_0x4d88('0x2b')])[_0x4d88('0x2e')](_0x455baa,_0x40e349,_0x27c9ac,_0x4cb54b),'p':_0x3b57d4[_0x4d88('0x2f')]||0x0};logger[_0x4d88('0x30')](_0x4d88('0x31'),_0x5d0384['id'],'on\x20interval',getIntervals(_0x27c9ac[_0x4d88('0x2c')],_0x3b57d4)[_0x4d88('0x25')](_0x4d88('0x32')));_0x42b512[_0x4d88('0x23')](_0x5d0384);}else{logger[_0x4d88('0x33')](_0x4d88('0x34'),path[_0x4d88('0x25')](__dirname,_0x4d88('0x1a'),_0x3b57d4[_0x4d88('0x2b')]+'.js'));}}_0x27c9ac[_0x4d88('0x16')][_0x455baa]=new RuleEngine(_0x42b512);_0x27c9ac['rules'][_0x455baa][_0x4d88('0x35')](_0x4cb54b,function(_0x418fcc){logger[_0x4d88('0x30')](_0x4d88('0x36'),JSON[_0x4d88('0x37')](_0x418fcc['matchPath']));if(_0x27c9ac[_0x4d88('0x16')][_0x455baa]){_0x27c9ac[_0x4d88('0x16')][_0x455baa][_0x4d88('0x38')](_0x4d88('0x39'));}});return _0x45c18e({'code':0xc8,'message':_0x4cb54b});}else{logger['info'](_0x4d88('0x3a'));return _0x45c18e({'code':0xc8,'message':_0x4cb54b});}}catch(_0xce640){logger['error'](_0xce640[_0x4d88('0x3b')]);return _0x56e7fb(_0x5b92c8[_0x4d88('0x33')](0x1f4,_0xce640));}}return _0x56e7fb(_0x4d88('0x3c'));});},'AcceptMessage':function(_0x18b0d3){var _0x4e2922=this;return new Promise(function(_0x4568e3,_0x4d7412){if(_0x18b0d3[_0x4d88('0x3d')]&&_0x18b0d3['agent']['id']){if(_0x27c9ac['agents'][_0x18b0d3['agent']['id']]){_0x27c9ac[_0x4d88('0x3e')][_0x18b0d3[_0x4d88('0x3d')]['id']][_0x4d88('0x3f')]=![];_0x27c9ac[_0x4d88('0x3e')][_0x18b0d3['agent']['id']][_0x4d88('0x40')]=undefined;}}if(_0x18b0d3[_0x4d88('0x18')]&&_0x18b0d3[_0x4d88('0x18')]['id']){try{var _0x42398b=getId(_0x18b0d3[_0x4d88('0x17')],_0x18b0d3[_0x4d88('0x18')]?_0x18b0d3[_0x4d88('0x18')]['id']:0x0,_0x18b0d3['interaction']?_0x18b0d3[_0x4d88('0x19')]['id']:0x0);if(_0x27c9ac[_0x4d88('0x16')][_0x42398b]){_0x27c9ac[_0x4d88('0x16')][_0x42398b][_0x4d88('0x38')](_0x4d88('0x41'));if(rpc[_0x18b0d3['channel']+_0x4d88('0x42')]){rpc[_0x18b0d3[_0x4d88('0x17')]+_0x4d88('0x42')][_0x4d88('0x43')](_0x42398b,{'UserId':_0x18b0d3[_0x4d88('0x18')][_0x4d88('0x44')]})[_0x4d88('0x45')](function(_0x1c7440){logger[_0x4d88('0x33')]('error\x20update\x20queue\x20report');});}}return _0x4568e3({'code':0xc8,'message':_0x18b0d3});}catch(_0x3e9fe2){logger['error'](_0x3e9fe2[_0x4d88('0x3b')]);return _0x4d7412(_0x4e2922[_0x4d88('0x33')](0x1f4,_0x3e9fe2));}}logger['error']('message\x20is\x20empty');return _0x4d7412(_0x4e2922[_0x4d88('0x33')](0x1f4,'message\x20is\x20empty'));});},'RejectMessage':function(_0xeccac3){var _0x4e9389=this;return new Promise(function(_0x1034c3,_0x4a1cbd){if(_0xeccac3[_0x4d88('0x3d')]&&_0xeccac3[_0x4d88('0x3d')]['id']){try{if(_0x27c9ac[_0x4d88('0x3e')][_0xeccac3[_0x4d88('0x3d')]['id']]){_0x27c9ac['agents'][_0xeccac3['agent']['id']][_0x4d88('0x3f')]=![];_0x27c9ac[_0x4d88('0x3e')][_0xeccac3[_0x4d88('0x3d')]['id']][_0x4d88('0x40')]=undefined;}return _0x1034c3({'code':0xc8,'message':_0xeccac3});}catch(_0x5f3ea7){logger[_0x4d88('0x33')](_0x5f3ea7[_0x4d88('0x3b')]);return _0x4a1cbd(_0x4e9389[_0x4d88('0x33')](0x1f4,_0x5f3ea7));}}logger[_0x4d88('0x33')](_0x4d88('0x46'));return _0x4a1cbd(_0x4e9389[_0x4d88('0x33')](0x1f4,_0x4d88('0x46')));});},'AbandonInteraction':function(_0x3a53c4){var _0x268801=this;return new Promise(function(_0x532216,_0x32de0b){if(_0x3a53c4['channel']&&_0x3a53c4['interaction']&&_0x3a53c4['interaction']['id']){try{var _0xce26ba=getId(_0x3a53c4[_0x4d88('0x17')],_0x3a53c4[_0x4d88('0x18')]?_0x3a53c4['message']['id']:0x0,_0x3a53c4['interaction']?_0x3a53c4['interaction']['id']:0x0);if(_0x27c9ac[_0x4d88('0x16')][_0xce26ba]){_0x27c9ac[_0x4d88('0x16')][_0xce26ba][_0x4d88('0x38')](_0x4d88('0x41'));}return _0x532216({'code':0xc8,'message':_0x3a53c4});}catch(_0x37bac2){logger['error'](_0x37bac2['stack']);return _0x32de0b(_0x268801[_0x4d88('0x33')](0x1f4,_0x37bac2));}}logger[_0x4d88('0x33')](_0x4d88('0x46'));return _0x32de0b(_0x268801[_0x4d88('0x33')](0x1f4,_0x4d88('0x46')));});},'AgentCapacity':function(_0xfe0a2c){var _0x1f03f3=this;return new Promise(function(_0x5489fe,_0xb41e32){if(_0x27c9ac[_0x4d88('0x3e')][_0x4d88('0x47')](_0xfe0a2c['id'])){for(var _0x35674d in _0xfe0a2c['capacity']){if(_0xfe0a2c[_0x4d88('0x48')]['hasOwnProperty'](_0x35674d)){if(_0x27c9ac[_0x4d88('0x3e')][_0xfe0a2c['id']]['hasOwnProperty'](_0x35674d+_0x4d88('0x49'))){_0x27c9ac[_0x4d88('0x3e')][_0xfe0a2c['id']][_0x35674d+_0x4d88('0x49')]=parseInt(_0xfe0a2c[_0x4d88('0x48')][_0x35674d],0xa);}}}_0x27c9ac[_0x4d88('0x3e')][_0xfe0a2c['id']][_0x4d88('0x4a')]();return _0x5489fe({'code':0xc8,'message':_0x27c9ac['agents'][_0xfe0a2c['id']]});}else{return _0xb41e32(_0x1f03f3[_0x4d88('0x33')](0x1f4,_0x4d88('0x4b')));}});},'Agents':function(_0x5e241c){return new Promise(function(_0x46ad00,_0x5bde0d){var _0xb677dc=_['values'](_0x27c9ac['agents']);_0x46ad00({'count':_0xb677dc[_0x4d88('0x1c')],'rows':_0xb677dc});});},'ChatQueues':function(_0x32df7b){return new Promise(function(_0xba4ebb,_0x4b5120){var _0x2de45e=[];for(var _0x48d6eb in _0x27c9ac[_0x4d88('0x4c')]){if(_0x27c9ac[_0x4d88('0x4c')][_0x4d88('0x47')](_0x48d6eb)){var _0x3a155a=_0x27c9ac[_0x4d88('0x4c')][_0x48d6eb];var _0x5f7a77={'id':_0x3a155a['id'],'available':_0x3a155a[_0x4d88('0x4d')],'loggedIn':_0x3a155a[_0x4d88('0x4e')],'name':_0x3a155a['name'],'paused':_0x3a155a['paused'],'waiting':_0x3a155a[_0x4d88('0x4f')]};_0x2de45e[_0x4d88('0x23')](_0x5f7a77);}}_0xba4ebb({'count':_0x2de45e['length'],'rows':_0x2de45e});});},'MailQueues':function(_0x41dc67){return new Promise(function(_0x180643,_0x29869c){var _0x1e2460=[];for(var _0x262100 in _0x27c9ac[_0x4d88('0x50')]){if(_0x27c9ac[_0x4d88('0x50')][_0x4d88('0x47')](_0x262100)){var _0x54ea08=_0x27c9ac[_0x4d88('0x50')][_0x262100];var _0x1aa056={'id':_0x54ea08['id'],'available':_0x54ea08[_0x4d88('0x4d')],'loggedIn':_0x54ea08[_0x4d88('0x4e')],'name':_0x54ea08['name'],'paused':_0x54ea08[_0x4d88('0x51')],'waiting':_0x54ea08['waiting']};_0x1e2460[_0x4d88('0x23')](_0x1aa056);}}_0x180643({'count':_0x1e2460[_0x4d88('0x1c')],'rows':_0x1e2460});});},'OpenchannelQueues':function(_0x1544a8){return new Promise(function(_0x408745,_0x1d634b){var _0x4e9e80=[];for(var _0x1dd719 in _0x27c9ac[_0x4d88('0x52')]){if(_0x27c9ac[_0x4d88('0x52')][_0x4d88('0x47')](_0x1dd719)){var _0x323a5f=_0x27c9ac[_0x4d88('0x52')][_0x1dd719];var _0x4beed8={'id':_0x323a5f['id'],'available':_0x323a5f['available'],'loggedIn':_0x323a5f[_0x4d88('0x4e')],'name':_0x323a5f[_0x4d88('0x53')],'paused':_0x323a5f[_0x4d88('0x51')],'waiting':_0x323a5f['waiting']};_0x4e9e80[_0x4d88('0x23')](_0x4beed8);}}_0x408745({'count':_0x4e9e80[_0x4d88('0x1c')],'rows':_0x4e9e80});});},'SmsQueues':function(_0x55db7d){return new Promise(function(_0x1744fe,_0x2ffdf3){var _0x4c5e63=[];for(var _0x1daedb in _0x27c9ac[_0x4d88('0x54')]){if(_0x27c9ac[_0x4d88('0x54')]['hasOwnProperty'](_0x1daedb)){var _0xedc1eb=_0x27c9ac[_0x4d88('0x54')][_0x1daedb];var _0x3cf23d={'id':_0xedc1eb['id'],'available':_0xedc1eb['available'],'loggedIn':_0xedc1eb['loggedIn'],'name':_0xedc1eb[_0x4d88('0x53')],'paused':_0xedc1eb[_0x4d88('0x51')],'waiting':_0xedc1eb[_0x4d88('0x4f')]};_0x4c5e63[_0x4d88('0x23')](_0x3cf23d);}}_0x1744fe({'count':_0x4c5e63[_0x4d88('0x1c')],'rows':_0x4c5e63});});},'FaxQueues':function(_0x37fe40){return new Promise(function(_0x4cd4f9,_0x4c8aef){var _0x5cae24=[];for(var _0xc25850 in _0x27c9ac[_0x4d88('0x55')]){if(_0x27c9ac['faxQueues'][_0x4d88('0x47')](_0xc25850)){var _0xae907e=_0x27c9ac['faxQueues'][_0xc25850];var _0x3a0d19={'id':_0xae907e['id'],'available':_0xae907e[_0x4d88('0x4d')],'loggedIn':_0xae907e[_0x4d88('0x4e')],'name':_0xae907e[_0x4d88('0x53')],'paused':_0xae907e['paused'],'waiting':_0xae907e[_0x4d88('0x4f')]};_0x5cae24[_0x4d88('0x23')](_0x3a0d19);}}_0x4cd4f9({'count':_0x5cae24[_0x4d88('0x1c')],'rows':_0x5cae24});});},'WhatsappQueues':function(_0x4ec8d9){return new Promise(function(_0x4c5403,_0x1b2144){var _0x54bd0b=[];for(var _0x4ea2f8 in _0x27c9ac[_0x4d88('0x56')]){if(_0x27c9ac['whatsappQueues']['hasOwnProperty'](_0x4ea2f8)){var _0x5400d6=_0x27c9ac['whatsappQueues'][_0x4ea2f8];var _0x5a7dc2={'id':_0x5400d6['id'],'available':_0x5400d6[_0x4d88('0x4d')],'loggedIn':_0x5400d6['loggedIn'],'name':_0x5400d6[_0x4d88('0x53')],'paused':_0x5400d6[_0x4d88('0x51')],'waiting':_0x5400d6[_0x4d88('0x4f')]};_0x54bd0b['push'](_0x5a7dc2);}}_0x4c5403({'count':_0x54bd0b['length'],'rows':_0x54bd0b});});},'ChatQueuesWaitingInteractions':function(_0x249359){return new Promise(function(_0x48c3b2,_0x54eb73){var _0x1db15c=_[_0x4d88('0x57')](_0x27c9ac[_0x4d88('0x58')]);_0x48c3b2({'count':_0x1db15c['length'],'rows':_0x1db15c});});},'MailQueuesWaitingInteractions':function(_0x12bf88){return new Promise(function(_0x2db54d,_0x149bb9){var _0x40e856=_['values'](_0x27c9ac[_0x4d88('0x59')]);_0x2db54d({'count':_0x40e856['length'],'rows':_0x40e856});});},'OpenchannelQueuesWaitingInteractions':function(_0xb1b4cb){return new Promise(function(_0x4069c8,_0x269d4a){var _0x31c3a7=_[_0x4d88('0x57')](_0x27c9ac[_0x4d88('0x5a')]);_0x4069c8({'count':_0x31c3a7['length'],'rows':_0x31c3a7});});},'SmsQueuesWaitingInteractions':function(_0x54bc6b){return new Promise(function(_0x38f03c,_0x24d7e0){var _0x59ed71=_[_0x4d88('0x57')](_0x27c9ac['smsQueuesWaitingInteractions']);_0x38f03c({'count':_0x59ed71[_0x4d88('0x1c')],'rows':_0x59ed71});});},'FaxQueuesWaitingInteractions':function(_0x526a0a){return new Promise(function(_0x5a1abc,_0x194840){var _0x23f5af=_[_0x4d88('0x57')](_0x27c9ac[_0x4d88('0x5b')]);_0x5a1abc({'count':_0x23f5af[_0x4d88('0x1c')],'rows':_0x23f5af});});},'WhatsappQueuesWaitingInteractions':function(_0x449105){return new Promise(function(_0xa61d0,_0x4317a2){var _0x10d2c1=_[_0x4d88('0x57')](_0x27c9ac[_0x4d88('0x5c')]);_0xa61d0({'count':_0x10d2c1[_0x4d88('0x1c')],'rows':_0x10d2c1});});}};var _0xc2872d=jayson[_0x4d88('0x5d')](_0x5d705b)[_0x4d88('0x5e')]();_0xc2872d['on'](_0x4d88('0x33'),function(_0x4d7d49){logger['error'](JSON['stringify'](_0x4d7d49));return _0x14b9a5(_0x4d7d49);});_0xc2872d[_0x4d88('0x15')](0x232c,'127.0.0.1',function(){console[_0x4d88('0x5f')](_0x4d88('0x60'),0x232c);return _0x1c9aad(_0x4d88('0x61')+0x232c);});});}; \ No newline at end of file +var _0x6ebe=['length','existsSync','app','autoreply','appdata','split','mail','push','slice','join','dialogflow','dialogflowv2','tag','TagId','%s:%s:%s','./interval','condition','intervals','priority','info','Push\x20new\x20rule','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','execute','stringify','matchPath','stack','routing\x20is\x20empty','agent','agents','busy','end','QueueReport','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','busyQueue','emit','hasOwnProperty','capacity','chatQueues','paused','waiting','mailQueues','available','loggedIn','name','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','values','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','http','127.0.0.1','log','lodash','util','path','jayson/promise','bluebird','uuid','../../../config/environment','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/chatQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','%s.%s.%s','isNil','IntervalId','Intervals','interval','listen','rules','channel','message','interaction','applications','isArray'];(function(_0x32b122,_0x1ad490){var _0x4ad25a=function(_0x590ee6){while(--_0x590ee6){_0x32b122['push'](_0x32b122['shift']());}};_0x4ad25a(++_0x1ad490);}(_0x6ebe,0x146));var _0xe6eb=function(_0x1d47ff,_0x514759){_0x1d47ff=_0x1d47ff-0x0;var _0x1a6021=_0x6ebe[_0x1d47ff];return _0x1a6021;};'use strict';var _=require(_0xe6eb('0x0'));var util=require(_0xe6eb('0x1'));var path=require(_0xe6eb('0x2'));var fs=require('fs');var jayson=require(_0xe6eb('0x3'));var BPromise=require(_0xe6eb('0x4'));var uuid=require(_0xe6eb('0x5'));var config=require(_0xe6eb('0x6'));var logger=require(_0xe6eb('0x7'))(_0xe6eb('0x8'));var rpc={'openchannelQueueReport':require(_0xe6eb('0x9')),'mailQueueReport':require('../rpc/mailQueueReport'),'chatQueueReport':require(_0xe6eb('0xa')),'smsQueueReport':require('../rpc/smsQueueReport'),'faxQueueReport':require(_0xe6eb('0xb')),'whatsappQueueReport':require(_0xe6eb('0xc'))};var RuleEngine=require(_0xe6eb('0xd'));function getId(_0x20f609,_0x4d5882,_0x3e973c){return util['format'](_0xe6eb('0xe'),_0x20f609,_0x4d5882||0x0,_0x3e973c||0x0);}function getIntervals(_0x371cf5,_0xc1221b){var _0x4158a9=[];if(!_[_0xe6eb('0xf')](_0xc1221b[_0xe6eb('0x10')])&&!_[_0xe6eb('0xf')](_0x371cf5[_0xc1221b['IntervalId']])&&!_['isNil'](_0x371cf5[_0xc1221b[_0xe6eb('0x10')]][_0xe6eb('0x11')])){_0x4158a9=_['map'](_0x371cf5[_0xc1221b[_0xe6eb('0x10')]][_0xe6eb('0x11')],_0xe6eb('0x12'));}else if(!_[_0xe6eb('0xf')](_0xc1221b[_0xe6eb('0x12')])){_0x4158a9=[_0xc1221b[_0xe6eb('0x12')]];}return _0x4158a9;}exports[_0xe6eb('0x13')]=function(_0x1f019e){_0x1f019e[_0xe6eb('0x14')]={};return new BPromise(function(_0x2e6ed9,_0x107d6f){var _0x4778f4={'Start':function(_0x54bc8a){var _0x3c6b38=this;return new Promise(function(_0x59f028,_0x502656){if(_0x54bc8a){try{var _0x18a25d=[];var _0x1659cf=getId(_0x54bc8a[_0xe6eb('0x15')],_0x54bc8a[_0xe6eb('0x16')]?_0x54bc8a[_0xe6eb('0x16')]['id']:0x0,_0x54bc8a['interaction']?_0x54bc8a[_0xe6eb('0x17')]['id']:0x0);if(_0x54bc8a[_0xe6eb('0x18')]&&_[_0xe6eb('0x19')](_0x54bc8a[_0xe6eb('0x18')])&&_0x54bc8a[_0xe6eb('0x18')]['length']){for(var _0x1ab63a=0x0;_0x1ab63a<_0x54bc8a[_0xe6eb('0x18')][_0xe6eb('0x1a')];_0x1ab63a+=0x1){var _0xda6e02=_0x54bc8a[_0xe6eb('0x18')][_0x1ab63a];if(fs[_0xe6eb('0x1b')](path['join'](__dirname,_0xe6eb('0x18'),_0xda6e02['app']+'.js'))){var _0x242634=[];switch(_0xda6e02[_0xe6eb('0x1c')]['toLowerCase']()){case _0xe6eb('0x1d'):var _0x5704dc=_0xda6e02[_0xe6eb('0x1e')][_0xe6eb('0x1f')](',');if(_0x54bc8a[_0xe6eb('0x15')]===_0xe6eb('0x20')){_0x242634[_0xe6eb('0x21')](_0x5704dc[0x0]);_0x242634['push'](_0x5704dc[0x1]);_0x242634['push'](_0x5704dc[_0xe6eb('0x22')](0x2,_0x5704dc['length'])[_0xe6eb('0x23')](','));}else{_0x242634[_0xe6eb('0x21')](_0x5704dc[0x0]);_0x242634[_0xe6eb('0x21')](_0x5704dc[_0xe6eb('0x22')](0x1,_0x5704dc[_0xe6eb('0x1a')])[_0xe6eb('0x23')](','));}break;case _0xe6eb('0x24'):var _0x4c515c=_0xda6e02[_0xe6eb('0x1e')][_0xe6eb('0x1f')](',');_0x242634[_0xe6eb('0x21')](_0x4c515c[0x0]);_0x242634[_0xe6eb('0x21')](_0x4c515c[0x1]);_0x242634['push'](_0x4c515c[_0xe6eb('0x22')](0x2,_0x4c515c['length'])['join'](','));break;case _0xe6eb('0x25'):var _0x30c04b=_0xda6e02[_0xe6eb('0x1e')][_0xe6eb('0x1f')](',');_0x242634[_0xe6eb('0x21')](_0x30c04b[0x0]);_0x242634[_0xe6eb('0x21')](_0x30c04b[0x1]);_0x242634['push'](_0x30c04b[0x2]);_0x242634[_0xe6eb('0x21')](_0x30c04b[0x3]);_0x242634[_0xe6eb('0x21')](_0x30c04b['slice'](0x4,_0x30c04b[_0xe6eb('0x1a')])[_0xe6eb('0x23')](','));break;case'amazonlex':var _0x5ed918=_0xda6e02[_0xe6eb('0x1e')]['split'](',');_0x242634['push'](_0x5ed918[0x0]);_0x242634[_0xe6eb('0x21')](_0x5ed918[0x1]);_0x242634[_0xe6eb('0x21')](_0x5ed918[0x2]);_0x242634[_0xe6eb('0x21')](_0x5ed918[0x3]);_0x242634[_0xe6eb('0x21')](_0x5ed918[_0xe6eb('0x22')](0x4,_0x5ed918[_0xe6eb('0x1a')])[_0xe6eb('0x23')](','));break;case _0xe6eb('0x16'):_0x242634['push'](_0xda6e02[_0xe6eb('0x1e')]);break;case _0xe6eb('0x26'):_0x242634[_0xe6eb('0x21')](_0xda6e02[_0xe6eb('0x27')]);_0x242634['push'](_0xda6e02['appdata']);break;default:_0x242634=_['isNil'](_0xda6e02[_0xe6eb('0x1e')])?[]:_0xda6e02[_0xe6eb('0x1e')][_0xe6eb('0x1f')](',');}var _0x3e3734={'id':util['format'](_0xe6eb('0x28'),_0x1659cf,_0xda6e02['id'],_0xda6e02[_0xe6eb('0x1c')]),'condition':require(_0xe6eb('0x29'))[_0xe6eb('0x2a')](_0x1659cf,getIntervals(_0x1f019e[_0xe6eb('0x2b')],_0xda6e02),_0x1f019e),'consequence':require('./applications/'+_0xda6e02[_0xe6eb('0x1c')])['consequence'](_0x1659cf,_0x242634,_0x1f019e,_0x54bc8a),'p':_0xda6e02[_0xe6eb('0x2c')]||0x0};logger[_0xe6eb('0x2d')](_0xe6eb('0x2e'),_0x3e3734['id'],'on\x20interval',getIntervals(_0x1f019e[_0xe6eb('0x2b')],_0xda6e02)[_0xe6eb('0x23')](_0xe6eb('0x2f')));_0x18a25d[_0xe6eb('0x21')](_0x3e3734);}else{logger[_0xe6eb('0x30')](_0xe6eb('0x31'),path[_0xe6eb('0x23')](__dirname,_0xe6eb('0x18'),_0xda6e02['app']+'.js'));}}_0x1f019e['rules'][_0x1659cf]=new RuleEngine(_0x18a25d);_0x1f019e[_0xe6eb('0x14')][_0x1659cf][_0xe6eb('0x32')](_0x54bc8a,function(_0x285b07){logger[_0xe6eb('0x2d')]('Applications\x20executed',JSON[_0xe6eb('0x33')](_0x285b07[_0xe6eb('0x34')]));if(_0x1f019e[_0xe6eb('0x14')][_0x1659cf]){_0x1f019e['rules'][_0x1659cf]['emit']('complete');}});return _0x59f028({'code':0xc8,'message':_0x54bc8a});}else{logger[_0xe6eb('0x2d')]('No\x20applications\x20to\x20execute');return _0x59f028({'code':0xc8,'message':_0x54bc8a});}}catch(_0x21b8dd){logger['error'](_0x21b8dd[_0xe6eb('0x35')]);return _0x502656(_0x3c6b38['error'](0x1f4,_0x21b8dd));}}return _0x502656(_0xe6eb('0x36'));});},'AcceptMessage':function(_0xd42382){var _0x2b9f8d=this;return new Promise(function(_0x1f8524,_0x5ea948){if(_0xd42382[_0xe6eb('0x37')]&&_0xd42382['agent']['id']){if(_0x1f019e[_0xe6eb('0x38')][_0xd42382[_0xe6eb('0x37')]['id']]){_0x1f019e[_0xe6eb('0x38')][_0xd42382['agent']['id']][_0xe6eb('0x39')]=![];_0x1f019e[_0xe6eb('0x38')][_0xd42382[_0xe6eb('0x37')]['id']]['busyQueue']=undefined;}}if(_0xd42382[_0xe6eb('0x16')]&&_0xd42382[_0xe6eb('0x16')]['id']){try{var _0x271051=getId(_0xd42382[_0xe6eb('0x15')],_0xd42382[_0xe6eb('0x16')]?_0xd42382[_0xe6eb('0x16')]['id']:0x0,_0xd42382['interaction']?_0xd42382[_0xe6eb('0x17')]['id']:0x0);if(_0x1f019e[_0xe6eb('0x14')][_0x271051]){_0x1f019e[_0xe6eb('0x14')][_0x271051]['emit'](_0xe6eb('0x3a'));if(rpc[_0xd42382[_0xe6eb('0x15')]+_0xe6eb('0x3b')]){rpc[_0xd42382[_0xe6eb('0x15')]+_0xe6eb('0x3b')]['update'](_0x271051,{'UserId':_0xd42382[_0xe6eb('0x16')][_0xe6eb('0x3c')]})[_0xe6eb('0x3d')](function(_0x3bda59){logger[_0xe6eb('0x30')](_0xe6eb('0x3e'));});}}return _0x1f8524({'code':0xc8,'message':_0xd42382});}catch(_0x41fbfe){logger[_0xe6eb('0x30')](_0x41fbfe[_0xe6eb('0x35')]);return _0x5ea948(_0x2b9f8d[_0xe6eb('0x30')](0x1f4,_0x41fbfe));}}logger[_0xe6eb('0x30')](_0xe6eb('0x3f'));return _0x5ea948(_0x2b9f8d['error'](0x1f4,_0xe6eb('0x3f')));});},'RejectMessage':function(_0x56ca62){var _0x26f0c2=this;return new Promise(function(_0x1a0ab4,_0x4246a8){if(_0x56ca62['agent']&&_0x56ca62[_0xe6eb('0x37')]['id']){try{if(_0x1f019e[_0xe6eb('0x38')][_0x56ca62[_0xe6eb('0x37')]['id']]){_0x1f019e['agents'][_0x56ca62[_0xe6eb('0x37')]['id']][_0xe6eb('0x39')]=![];_0x1f019e[_0xe6eb('0x38')][_0x56ca62[_0xe6eb('0x37')]['id']][_0xe6eb('0x40')]=undefined;}return _0x1a0ab4({'code':0xc8,'message':_0x56ca62});}catch(_0x196b13){logger[_0xe6eb('0x30')](_0x196b13[_0xe6eb('0x35')]);return _0x4246a8(_0x26f0c2['error'](0x1f4,_0x196b13));}}logger['error'](_0xe6eb('0x3f'));return _0x4246a8(_0x26f0c2[_0xe6eb('0x30')](0x1f4,_0xe6eb('0x3f')));});},'AbandonInteraction':function(_0x3f69a5){var _0xa0485b=this;return new Promise(function(_0x7a366,_0x26ef8d){if(_0x3f69a5['channel']&&_0x3f69a5[_0xe6eb('0x17')]&&_0x3f69a5[_0xe6eb('0x17')]['id']){try{var _0x3a5012=getId(_0x3f69a5[_0xe6eb('0x15')],_0x3f69a5['message']?_0x3f69a5[_0xe6eb('0x16')]['id']:0x0,_0x3f69a5[_0xe6eb('0x17')]?_0x3f69a5[_0xe6eb('0x17')]['id']:0x0);if(_0x1f019e[_0xe6eb('0x14')][_0x3a5012]){_0x1f019e[_0xe6eb('0x14')][_0x3a5012][_0xe6eb('0x41')](_0xe6eb('0x3a'));}return _0x7a366({'code':0xc8,'message':_0x3f69a5});}catch(_0x3b51ea){logger[_0xe6eb('0x30')](_0x3b51ea[_0xe6eb('0x35')]);return _0x26ef8d(_0xa0485b[_0xe6eb('0x30')](0x1f4,_0x3b51ea));}}logger[_0xe6eb('0x30')](_0xe6eb('0x3f'));return _0x26ef8d(_0xa0485b[_0xe6eb('0x30')](0x1f4,_0xe6eb('0x3f')));});},'AgentCapacity':function(_0x10eff0){var _0x1197d3=this;return new Promise(function(_0x28449b,_0x54f02b){if(_0x1f019e[_0xe6eb('0x38')][_0xe6eb('0x42')](_0x10eff0['id'])){for(var _0x5321aa in _0x10eff0[_0xe6eb('0x43')]){if(_0x10eff0[_0xe6eb('0x43')][_0xe6eb('0x42')](_0x5321aa)){if(_0x1f019e['agents'][_0x10eff0['id']]['hasOwnProperty'](_0x5321aa+'CurrentCapacity')){_0x1f019e[_0xe6eb('0x38')][_0x10eff0['id']][_0x5321aa+'CurrentCapacity']=parseInt(_0x10eff0['capacity'][_0x5321aa],0xa);}}}_0x1f019e['agents'][_0x10eff0['id']]['updateRealtime']();return _0x28449b({'code':0xc8,'message':_0x1f019e[_0xe6eb('0x38')][_0x10eff0['id']]});}else{return _0x54f02b(_0x1197d3['error'](0x1f4,'agent\x20not\x20found'));}});},'Agents':function(_0xd268d2){return new Promise(function(_0x39bae8,_0x2b72ba){var _0x2b4504=_['values'](_0x1f019e[_0xe6eb('0x38')]);_0x39bae8({'count':_0x2b4504[_0xe6eb('0x1a')],'rows':_0x2b4504});});},'ChatQueues':function(_0x445323){return new Promise(function(_0x3e316a,_0x2c186c){var _0x45ee14=[];for(var _0x5927bd in _0x1f019e[_0xe6eb('0x44')]){if(_0x1f019e[_0xe6eb('0x44')][_0xe6eb('0x42')](_0x5927bd)){var _0x2c4e25=_0x1f019e['chatQueues'][_0x5927bd];var _0x50d27f={'id':_0x2c4e25['id'],'available':_0x2c4e25['available'],'loggedIn':_0x2c4e25['loggedIn'],'name':_0x2c4e25['name'],'paused':_0x2c4e25[_0xe6eb('0x45')],'waiting':_0x2c4e25[_0xe6eb('0x46')]};_0x45ee14['push'](_0x50d27f);}}_0x3e316a({'count':_0x45ee14['length'],'rows':_0x45ee14});});},'MailQueues':function(_0x4bf956){return new Promise(function(_0x3c828f,_0x3c6d98){var _0x31d1b4=[];for(var _0x2c8b45 in _0x1f019e[_0xe6eb('0x47')]){if(_0x1f019e['mailQueues'][_0xe6eb('0x42')](_0x2c8b45)){var _0x432e91=_0x1f019e['mailQueues'][_0x2c8b45];var _0x2cd109={'id':_0x432e91['id'],'available':_0x432e91[_0xe6eb('0x48')],'loggedIn':_0x432e91[_0xe6eb('0x49')],'name':_0x432e91[_0xe6eb('0x4a')],'paused':_0x432e91[_0xe6eb('0x45')],'waiting':_0x432e91[_0xe6eb('0x46')]};_0x31d1b4[_0xe6eb('0x21')](_0x2cd109);}}_0x3c828f({'count':_0x31d1b4['length'],'rows':_0x31d1b4});});},'OpenchannelQueues':function(_0x1a01a3){return new Promise(function(_0x5e5711,_0x4c28ff){var _0x359e3e=[];for(var _0x1b62ab in _0x1f019e[_0xe6eb('0x4b')]){if(_0x1f019e[_0xe6eb('0x4b')][_0xe6eb('0x42')](_0x1b62ab)){var _0x109d72=_0x1f019e['openchannelQueues'][_0x1b62ab];var _0x5459ea={'id':_0x109d72['id'],'available':_0x109d72[_0xe6eb('0x48')],'loggedIn':_0x109d72[_0xe6eb('0x49')],'name':_0x109d72['name'],'paused':_0x109d72[_0xe6eb('0x45')],'waiting':_0x109d72[_0xe6eb('0x46')]};_0x359e3e['push'](_0x5459ea);}}_0x5e5711({'count':_0x359e3e[_0xe6eb('0x1a')],'rows':_0x359e3e});});},'SmsQueues':function(_0x50c7f6){return new Promise(function(_0x40f469,_0x248efa){var _0x37136e=[];for(var _0xc1eaa7 in _0x1f019e[_0xe6eb('0x4c')]){if(_0x1f019e[_0xe6eb('0x4c')][_0xe6eb('0x42')](_0xc1eaa7)){var _0x330c06=_0x1f019e[_0xe6eb('0x4c')][_0xc1eaa7];var _0x3b9cdd={'id':_0x330c06['id'],'available':_0x330c06['available'],'loggedIn':_0x330c06[_0xe6eb('0x49')],'name':_0x330c06[_0xe6eb('0x4a')],'paused':_0x330c06[_0xe6eb('0x45')],'waiting':_0x330c06[_0xe6eb('0x46')]};_0x37136e['push'](_0x3b9cdd);}}_0x40f469({'count':_0x37136e[_0xe6eb('0x1a')],'rows':_0x37136e});});},'FaxQueues':function(_0x2fc620){return new Promise(function(_0x37a914,_0x47c34e){var _0x5b9e82=[];for(var _0xc7e987 in _0x1f019e[_0xe6eb('0x4d')]){if(_0x1f019e[_0xe6eb('0x4d')][_0xe6eb('0x42')](_0xc7e987)){var _0x5464d2=_0x1f019e[_0xe6eb('0x4d')][_0xc7e987];var _0x1cdbae={'id':_0x5464d2['id'],'available':_0x5464d2['available'],'loggedIn':_0x5464d2[_0xe6eb('0x49')],'name':_0x5464d2[_0xe6eb('0x4a')],'paused':_0x5464d2[_0xe6eb('0x45')],'waiting':_0x5464d2['waiting']};_0x5b9e82[_0xe6eb('0x21')](_0x1cdbae);}}_0x37a914({'count':_0x5b9e82[_0xe6eb('0x1a')],'rows':_0x5b9e82});});},'WhatsappQueues':function(_0x424e91){return new Promise(function(_0x544cb1,_0xa45a41){var _0x346f8f=[];for(var _0x38910a in _0x1f019e['whatsappQueues']){if(_0x1f019e[_0xe6eb('0x4e')][_0xe6eb('0x42')](_0x38910a)){var _0x54fc47=_0x1f019e[_0xe6eb('0x4e')][_0x38910a];var _0x1fbaf7={'id':_0x54fc47['id'],'available':_0x54fc47[_0xe6eb('0x48')],'loggedIn':_0x54fc47[_0xe6eb('0x49')],'name':_0x54fc47[_0xe6eb('0x4a')],'paused':_0x54fc47[_0xe6eb('0x45')],'waiting':_0x54fc47[_0xe6eb('0x46')]};_0x346f8f[_0xe6eb('0x21')](_0x1fbaf7);}}_0x544cb1({'count':_0x346f8f[_0xe6eb('0x1a')],'rows':_0x346f8f});});},'ChatQueuesWaitingInteractions':function(_0x536e61){return new Promise(function(_0x73a01c,_0x33aa12){var _0x105eeb=_['values'](_0x1f019e[_0xe6eb('0x4f')]);_0x73a01c({'count':_0x105eeb['length'],'rows':_0x105eeb});});},'MailQueuesWaitingInteractions':function(_0x162d8c){return new Promise(function(_0x5b79e8,_0x5b5f3a){var _0x329226=_[_0xe6eb('0x50')](_0x1f019e[_0xe6eb('0x51')]);_0x5b79e8({'count':_0x329226[_0xe6eb('0x1a')],'rows':_0x329226});});},'OpenchannelQueuesWaitingInteractions':function(_0x41de6f){return new Promise(function(_0x52bb31,_0x1388e8){var _0x33a302=_[_0xe6eb('0x50')](_0x1f019e[_0xe6eb('0x52')]);_0x52bb31({'count':_0x33a302[_0xe6eb('0x1a')],'rows':_0x33a302});});},'SmsQueuesWaitingInteractions':function(_0x27a9ce){return new Promise(function(_0x12facd,_0x13f69e){var _0x513d1c=_[_0xe6eb('0x50')](_0x1f019e[_0xe6eb('0x53')]);_0x12facd({'count':_0x513d1c[_0xe6eb('0x1a')],'rows':_0x513d1c});});},'FaxQueuesWaitingInteractions':function(_0x885f74){return new Promise(function(_0x1e0118,_0x2d9ee5){var _0x5d3349=_[_0xe6eb('0x50')](_0x1f019e[_0xe6eb('0x54')]);_0x1e0118({'count':_0x5d3349['length'],'rows':_0x5d3349});});},'WhatsappQueuesWaitingInteractions':function(_0x2991ef){return new Promise(function(_0xd76508,_0x1458a2){var _0x1fe3f7=_['values'](_0x1f019e['whatsappQueuesWaitingInteractions']);_0xd76508({'count':_0x1fe3f7[_0xe6eb('0x1a')],'rows':_0x1fe3f7});});}};var _0x32b34a=jayson['server'](_0x4778f4)[_0xe6eb('0x55')]();_0x32b34a['on'](_0xe6eb('0x30'),function(_0x20a793){logger[_0xe6eb('0x30')](JSON[_0xe6eb('0x33')](_0x20a793));return _0x107d6f(_0x20a793);});_0x32b34a[_0xe6eb('0x13')](0x232c,_0xe6eb('0x56'),function(){console[_0xe6eb('0x57')]('Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232c);return _0x2e6ed9('RPC\x20listening\x20on\x20port:'+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index 339c3a8..a9be9cc 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 _0x2ebf=['then','error','message','result','catch','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','push','Command','format','iftime\x20%s','indexOf','true','[%s][INTERVAL]\x20%s','all','some','[%s][INTERVAL]\x20%s\x20%s','join','when','\x20|\x20','stack','bluebird','client','http','request'];(function(_0x4b72ca,_0x246afd){var _0x869cf1=function(_0x15392d){while(--_0x15392d){_0x4b72ca['push'](_0x4b72ca['shift']());}};_0x869cf1(++_0x246afd);}(_0x2ebf,0x175));var _0xf2eb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2ebf[_0x3dd15e];return _0x231fd0;};'use strict';var util=require('util');var BPromise=require(_0xf2eb('0x0'));var jayson=require('jayson/promise');var _=require('lodash');var logger=require('../../../config/logger')('routing');var client=jayson[_0xf2eb('0x1')][_0xf2eb('0x2')]({'port':0x232a});function request(_0x5e90ef,_0x277eca){return new BPromise(function(_0x1cd34f,_0x45afed){return client[_0xf2eb('0x3')](_0x5e90ef,_0x277eca)[_0xf2eb('0x4')](function(_0x3f0fff){if(_0x3f0fff[_0xf2eb('0x5')]){return _0x45afed(_0x3f0fff[_0xf2eb('0x5')][_0xf2eb('0x6')]);}else{return _0x1cd34f(_0x3f0fff[_0xf2eb('0x7')]);}})[_0xf2eb('0x8')](function(_0x1e6289){return _0x45afed(_0x1e6289);});});}exports[_0xf2eb('0x9')]=function(_0x3c1c0b,_0x30ee2a,_0x3f398b){return function(_0x10708f){if(_0x3f398b[_0xf2eb('0xa')]&&!_0x3f398b[_0xf2eb('0xa')][_0x3c1c0b]){logger[_0xf2eb('0xb')](_0xf2eb('0xc'),_0x3c1c0b);return _0x10708f[_0xf2eb('0xd')]();}var _0x477216=[];for(var _0x33366d=0x0;_0x33366d<_0x30ee2a[_0xf2eb('0xe')];_0x33366d+=0x1){_0x477216[_0xf2eb('0xf')](request(_0xf2eb('0x10'),{'command':util[_0xf2eb('0x11')](_0xf2eb('0x12'),_0x30ee2a[_0x33366d])})['then'](function(_0x30b761){return _0x30b761&&_0x30b761[_0xf2eb('0x6')]&&_0x30b761[_0xf2eb('0x6')][_0xf2eb('0x13')](_0xf2eb('0x14'))>=0x0?!![]:![];})[_0xf2eb('0x8')](function(_0x5a2a81){logger['error'](_0xf2eb('0x15'),_0x3c1c0b,_0x30ee2a[_0x33366d]);}));}BPromise[_0xf2eb('0x16')](_0x477216)['then'](function(_0x1cab27){var _0x550cae=_[_0xf2eb('0x17')](_0x1cab27);logger[_0xf2eb('0xb')](_0xf2eb('0x18'),_0x3c1c0b,_0x30ee2a[_0xf2eb('0x19')]('\x20|\x20'),_0x550cae);_0x10708f[_0xf2eb('0x1a')](_0x550cae);})[_0xf2eb('0x8')](function(_0x175c8c){console['log'](_0x175c8c);logger[_0xf2eb('0x5')](_0xf2eb('0x18'),_0x3c1c0b,_0x30ee2a[_0xf2eb('0x19')](_0xf2eb('0x1b')),_0x175c8c[_0xf2eb('0x1c')]);_0x10708f[_0xf2eb('0xd')]();});};}; \ No newline at end of file +var _0xf1db=['[%s][INTERVAL]\x20ROUTING\x20STOPPED','length','push','Command','format','iftime\x20%s','then','indexOf','true','some','info','[%s][INTERVAL]\x20%s\x20%s','\x20|\x20','when','join','util','jayson/promise','lodash','../../../config/logger','routing','client','http','request','error','message','result','catch','condition','rules'];(function(_0x344237,_0x4c60c4){var _0x56f359=function(_0x4ffdfb){while(--_0x4ffdfb){_0x344237['push'](_0x344237['shift']());}};_0x56f359(++_0x4c60c4);}(_0xf1db,0x131));var _0xbf1d=function(_0x1ca41e,_0x19fb04){_0x1ca41e=_0x1ca41e-0x0;var _0x31d283=_0xf1db[_0x1ca41e];return _0x31d283;};'use strict';var util=require(_0xbf1d('0x0'));var BPromise=require('bluebird');var jayson=require(_0xbf1d('0x1'));var _=require(_0xbf1d('0x2'));var logger=require(_0xbf1d('0x3'))(_0xbf1d('0x4'));var client=jayson[_0xbf1d('0x5')][_0xbf1d('0x6')]({'port':0x232a});function request(_0x748b22,_0x2226a0){return new BPromise(function(_0x3f42f5,_0x4efb91){return client[_0xbf1d('0x7')](_0x748b22,_0x2226a0)['then'](function(_0x2ee1c0){if(_0x2ee1c0[_0xbf1d('0x8')]){return _0x4efb91(_0x2ee1c0['error'][_0xbf1d('0x9')]);}else{return _0x3f42f5(_0x2ee1c0[_0xbf1d('0xa')]);}})[_0xbf1d('0xb')](function(_0x55e685){return _0x4efb91(_0x55e685);});});}exports[_0xbf1d('0xc')]=function(_0x1fd24a,_0x5a321e,_0x38e0eb){return function(_0x23251d){if(_0x38e0eb[_0xbf1d('0xd')]&&!_0x38e0eb[_0xbf1d('0xd')][_0x1fd24a]){logger['info'](_0xbf1d('0xe'),_0x1fd24a);return _0x23251d['stop']();}var _0x2f22d4=[];for(var _0x3ea4a4=0x0;_0x3ea4a4<_0x5a321e[_0xbf1d('0xf')];_0x3ea4a4+=0x1){_0x2f22d4[_0xbf1d('0x10')](request(_0xbf1d('0x11'),{'command':util[_0xbf1d('0x12')](_0xbf1d('0x13'),_0x5a321e[_0x3ea4a4])})[_0xbf1d('0x14')](function(_0x5a0328){return _0x5a0328&&_0x5a0328[_0xbf1d('0x9')]&&_0x5a0328[_0xbf1d('0x9')][_0xbf1d('0x15')](_0xbf1d('0x16'))>=0x0?!![]:![];})[_0xbf1d('0xb')](function(_0x5c7129){logger[_0xbf1d('0x8')]('[%s][INTERVAL]\x20%s',_0x1fd24a,_0x5a321e[_0x3ea4a4]);}));}BPromise['all'](_0x2f22d4)[_0xbf1d('0x14')](function(_0x18ce0f){var _0x501a46=_[_0xbf1d('0x17')](_0x18ce0f);logger[_0xbf1d('0x18')](_0xbf1d('0x19'),_0x1fd24a,_0x5a321e['join'](_0xbf1d('0x1a')),_0x501a46);_0x23251d[_0xbf1d('0x1b')](_0x501a46);})[_0xbf1d('0xb')](function(_0x546d65){console['log'](_0x546d65);logger[_0xbf1d('0x8')](_0xbf1d('0x19'),_0x1fd24a,_0x5a321e[_0xbf1d('0x1c')](_0xbf1d('0x1a')),_0x546d65['stack']);_0x23251d['stop']();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index b481683..92d1bfc 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 _0x44a3=['agentacw','request','CreateVoiceAgentReport','agentcalled','debug','[%s][agents][agentcalled]','uniqueid','destuniqueid','agentcalledAt','now','connectedlinenum','connectedlinename','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','agentringnoanswer','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','timeout','reason','holdtime','ringtime','talktime','push','forIn','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','[%s][agents][queuecallerabandon]','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connect','lastevent','answered_elsewhere','answeredelsewheredestinationuniqueid','isNil','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diffTime','agentcompleteAt','complete','blindtransfer','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfereruniqueid','transfer','transfertype','blind','transferexten','extension','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','ATTENDED','origtransfererexten','transferuniqueid','transfereeuniqueid','agententerreason','secondtransfererlinkedid','secondtransfererexten','transfertargetuniqueid','clone','calleridname','hangup','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','agent','[%s][agents][hangup]','lodash','util','./utils','info','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','queue','membername','interface','calleridnum','then','type','agentcomplete','acw'];(function(_0x132995,_0x487969){var _0x4dfb3f=function(_0x5b20a2){while(--_0x5b20a2){_0x132995['push'](_0x132995['shift']());}};_0x4dfb3f(++_0x487969);}(_0x44a3,0x1a9));var _0x344a=function(_0x4534e3,_0x56de6e){_0x4534e3=_0x4534e3-0x0;var _0x50c3a3=_0x44a3[_0x4534e3];return _0x50c3a3;};'use strict';var _=require(_0x344a('0x0'));var util=require(_0x344a('0x1'));var utils=require(_0x344a('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x23cef2,_0xdffe0b){utils[_0x344a('0x3')](util[_0x344a('0x4')](_0x344a('0x5'),_0x23cef2['uniqueid'],_0x23cef2[_0x344a('0x6')],_0x23cef2[_0x344a('0x7')],_0x23cef2[_0x344a('0x8')],_0x23cef2[_0x344a('0x9')],_0x23cef2[_0x344a('0xa')],_0x23cef2['connectedlinenum'],_0x23cef2['lastevent']));if(_0x23cef2['queue']){utils['getVoiceQueueByName'](_0x23cef2[_0x344a('0x7')])[_0x344a('0xb')](function(_0x3c725e){if(_0x3c725e){_0x23cef2[_0x344a('0xc')]=_0x3c725e[_0x344a('0xc')];_0x23cef2['agentacw']=_0x23cef2[_0x344a('0xd')]?_0x3c725e[_0x344a('0xe')]:![];_0x23cef2['acwtime']=_0x23cef2[_0x344a('0xf')]?_0x3c725e['acwTimeout']:0x0;}utils[_0x344a('0x10')]('CreateVoiceAgentReport',_0x23cef2);});}else{utils[_0x344a('0x10')](_0x344a('0x11'),_0x23cef2);}if(_0xdffe0b){delete transfers[_0x23cef2['uniqueid']];}else{delete agents[_0x23cef2['destuniqueid']];}}exports[_0x344a('0x12')]=function(_0x2ad7eb){try{utils[_0x344a('0x13')](util[_0x344a('0x4')](_0x344a('0x14'),_0x2ad7eb[_0x344a('0x15')]),_0x2ad7eb);agents[_0x2ad7eb['destuniqueid']]=_0x2ad7eb;agents[_0x2ad7eb[_0x344a('0x16')]][_0x344a('0x17')]=utils[_0x344a('0x18')]();agents[_0x2ad7eb[_0x344a('0x16')]]['lastevent']='called';agents[_0x2ad7eb[_0x344a('0x16')]][_0x344a('0x19')]=null;agents[_0x2ad7eb[_0x344a('0x16')]][_0x344a('0x1a')]=null;utils['info'](util[_0x344a('0x4')](_0x344a('0x1b'),_0x2ad7eb['uniqueid'],agents[_0x2ad7eb[_0x344a('0x16')]][_0x344a('0x8')],_0x2ad7eb[_0x344a('0x16')]));}catch(_0x45a827){utils[_0x344a('0x1c')](util[_0x344a('0x4')](_0x344a('0x14'),_0x2ad7eb[_0x344a('0x15')]),_0x45a827);}};exports[_0x344a('0x1d')]=function(_0x450922){try{if(!_['isNil'](agents[_0x450922[_0x344a('0x16')]])){utils[_0x344a('0x13')](util[_0x344a('0x4')](_0x344a('0x1e'),_0x450922[_0x344a('0x15')]),_0x450922);utils[_0x344a('0x3')](util[_0x344a('0x4')](_0x344a('0x1f'),_0x450922[_0x344a('0x15')],agents[_0x450922[_0x344a('0x16')]][_0x344a('0x8')],_0x450922[_0x344a('0x16')]));agents[_0x450922[_0x344a('0x16')]][_0x344a('0x1d')]=!![];agents[_0x450922['destuniqueid']][_0x344a('0x20')]=utils['now']();agents[_0x450922[_0x344a('0x16')]]['lastevent']=_0x344a('0x21');agents[_0x450922[_0x344a('0x16')]][_0x344a('0x22')]=_0x344a('0x21');agents[_0x450922[_0x344a('0x16')]][_0x344a('0x23')]=_0x450922[_0x344a('0x24')]?parseInt(_0x450922[_0x344a('0x24')])/0x3e8:0x0;agents[_0x450922['destuniqueid']][_0x344a('0x25')]=0x0;unanswered[_0x344a('0x26')](_0x450922[_0x344a('0x16')]);}}catch(_0xc02d6){utils[_0x344a('0x1c')](util[_0x344a('0x4')]('[%s][agents][agentringnoanswer]',_0x450922[_0x344a('0x15')]),_0xc02d6);}};exports['queuecallerabandon']=function(_0x593cf6){try{_[_0x344a('0x27')](agents,function(_0x14fa86,_0x5a36bb){if(_0x14fa86['uniqueid']==_0x593cf6['uniqueid']&&!_['includes'](unanswered,_0x14fa86[_0x344a('0x16')])){utils[_0x344a('0x13')](util[_0x344a('0x4')]('[%s][agents][queuecallerabandon]',_0x593cf6[_0x344a('0x15')]),_0x593cf6);utils[_0x344a('0x3')](util[_0x344a('0x4')](_0x344a('0x28'),_0x593cf6[_0x344a('0x15')],_0x14fa86[_0x344a('0x8')],_0x14fa86[_0x344a('0x16')]));_0x14fa86['agentringnoanswer']=!![];_0x14fa86[_0x344a('0x20')]=utils['now']();_0x14fa86['lastevent']='abandoned';_0x14fa86[_0x344a('0x22')]=_0x344a('0x29');_0x14fa86[_0x344a('0x23')]=_0x593cf6[_0x344a('0x23')];_0x14fa86[_0x344a('0x25')]=0x0;writeDB(_0x14fa86);}});}catch(_0xdf6a8f){utils['error'](util[_0x344a('0x4')](_0x344a('0x2a'),_0x593cf6[_0x344a('0x15')]),_0xdf6a8f);}};exports['agentconnect']=function(_0x3698eb){try{if(agents[_0x3698eb[_0x344a('0x16')]]){utils[_0x344a('0x13')](util[_0x344a('0x4')](_0x344a('0x2b'),_0x3698eb['uniqueid']),_0x3698eb);utils[_0x344a('0x3')](util[_0x344a('0x4')](_0x344a('0x2c'),_0x3698eb[_0x344a('0x15')],agents[_0x3698eb[_0x344a('0x16')]]['membername'],_0x3698eb[_0x344a('0x16')]));agents[_0x3698eb[_0x344a('0x16')]][_0x344a('0x2d')]=utils[_0x344a('0x18')]();agents[_0x3698eb[_0x344a('0x16')]]['connectedlinenum']=_0x3698eb[_0x344a('0x19')];agents[_0x3698eb[_0x344a('0x16')]][_0x344a('0x1a')]=_0x3698eb[_0x344a('0x1a')];agents[_0x3698eb[_0x344a('0x16')]][_0x344a('0x23')]=_0x3698eb[_0x344a('0x24')];agents[_0x3698eb[_0x344a('0x16')]]['lastevent']=_0x344a('0x2e');_[_0x344a('0x27')](agents,function(_0x3d34c3,_0x28bad9){if(_0x3d34c3[_0x344a('0x16')]!=_0x3698eb['destuniqueid']&&_0x3d34c3[_0x344a('0x15')]==_0x3698eb[_0x344a('0x15')]){_0x3d34c3[_0x344a('0x25')]=0x0;_0x3d34c3[_0x344a('0x23')]=_0x3698eb[_0x344a('0x24')];_0x3d34c3[_0x344a('0x1d')]=!![];_0x3d34c3[_0x344a('0x20')]=utils[_0x344a('0x18')]();_0x3d34c3[_0x344a('0x2f')]='answered_elsewhere';_0x3d34c3[_0x344a('0x22')]=_0x344a('0x30');_0x3d34c3[_0x344a('0x31')]=_0x3698eb[_0x344a('0x16')];_0x3d34c3['answeredelsewheremembername']=_0x3698eb[_0x344a('0x8')];writeDB(_0x3d34c3);}});}}catch(_0x3069ca){utils[_0x344a('0x1c')](util[_0x344a('0x4')](_0x344a('0x2b'),_0x3698eb[_0x344a('0x15')]),_0x3069ca);}};exports[_0x344a('0xd')]=function(_0x372e7d){try{if(!_[_0x344a('0x32')](agents[_0x372e7d[_0x344a('0x16')]])){utils[_0x344a('0x13')](util['format'](_0x344a('0x33'),_0x372e7d[_0x344a('0x15')]),_0x372e7d);utils['info'](util[_0x344a('0x4')](_0x344a('0x34'),_0x372e7d['uniqueid'],agents[_0x372e7d[_0x344a('0x16')]][_0x344a('0x8')],_0x372e7d['destuniqueid']));agents[_0x372e7d[_0x344a('0x16')]][_0x344a('0xd')]=!![];agents[_0x372e7d[_0x344a('0x16')]]['agentcompleteAt']=utils[_0x344a('0x18')]();agents[_0x372e7d['destuniqueid']][_0x344a('0x25')]=utils[_0x344a('0x35')](agents[_0x372e7d[_0x344a('0x16')]][_0x344a('0x36')],agents[_0x372e7d['destuniqueid']]['agentconnectAt']);agents[_0x372e7d[_0x344a('0x16')]][_0x344a('0x22')]=_0x372e7d[_0x344a('0x22')];agents[_0x372e7d[_0x344a('0x16')]][_0x344a('0x2f')]=_0x344a('0x37');writeDB(agents[_0x372e7d[_0x344a('0x16')]]);}}catch(_0x23c214){utils[_0x344a('0x1c')](util[_0x344a('0x4')]('[%s][agents][agentcomplete]',_0x372e7d[_0x344a('0x15')]),_0x23c214);}};exports[_0x344a('0x38')]=function(_0x6fad37){try{if(!_[_0x344a('0x32')](agents[_0x6fad37['transfereruniqueid']])){utils[_0x344a('0x13')](util['format']('[%s][agents][blindtransfer]',_0x6fad37[_0x344a('0x15')]),_0x6fad37);utils[_0x344a('0x3')](util['format'](_0x344a('0x39'),_0x6fad37[_0x344a('0x15')],agents[_0x6fad37[_0x344a('0x3a')]][_0x344a('0x8')],agents[_0x6fad37['transfereruniqueid']][_0x344a('0x15')]));agents[_0x6fad37[_0x344a('0x3a')]][_0x344a('0x3b')]=!![];agents[_0x6fad37[_0x344a('0x3a')]][_0x344a('0x3c')]=_0x344a('0x3d');agents[_0x6fad37[_0x344a('0x3a')]][_0x344a('0x3e')]=_0x6fad37[_0x344a('0x3f')];agents[_0x6fad37[_0x344a('0x3a')]]['transferuniqueid']=agents[_0x6fad37[_0x344a('0x3a')]]['uniqueid'];}}catch(_0x1b7f6c){utils[_0x344a('0x1c')](util[_0x344a('0x4')]('[%s][agents][blindtransfer]',_0x6fad37[_0x344a('0x15')]),_0x1b7f6c);}};exports[_0x344a('0x40')]=function(_0x188c6b){try{utils[_0x344a('0x13')](util[_0x344a('0x4')](_0x344a('0x41'),_0x188c6b[_0x344a('0x42')]),_0x188c6b);if(_0x188c6b[_0x344a('0x42')]==_0x188c6b[_0x344a('0x43')]){if(!_['isNil'](agents[_0x188c6b[_0x344a('0x44')]])){utils[_0x344a('0x3')](util[_0x344a('0x4')](_0x344a('0x45'),_0x188c6b[_0x344a('0x42')],agents[_0x188c6b['secondtransfereruniqueid']][_0x344a('0x8')]));agents[_0x188c6b[_0x344a('0x44')]][_0x344a('0x3b')]=!![];agents[_0x188c6b[_0x344a('0x44')]]['transfertype']=_0x344a('0x46');agents[_0x188c6b[_0x344a('0x44')]]['transferexten']=_0x188c6b[_0x344a('0x47')];agents[_0x188c6b[_0x344a('0x44')]][_0x344a('0x48')]=_0x188c6b[_0x344a('0x42')];}if(_0x188c6b[_0x344a('0x49')]&&agents[_0x188c6b[_0x344a('0x49')]]){agents[_0x188c6b[_0x344a('0x49')]]['agententerreason']=0x1;transfers[_0x188c6b['transfereeuniqueid']]=_['clone'](agents[_0x188c6b[_0x344a('0x49')]]);transfers[_0x188c6b[_0x344a('0x49')]][_0x344a('0xa')]=agents[_0x188c6b[_0x344a('0x44')]]['calleridnum'];transfers[_0x188c6b[_0x344a('0x49')]]['calleridname']=agents[_0x188c6b['secondtransfereruniqueid']]['calleridname'];transfers[_0x188c6b['transfereeuniqueid']][_0x344a('0x17')]=utils[_0x344a('0x18')]();transfers[_0x188c6b[_0x344a('0x49')]][_0x344a('0x2d')]=utils['now']();transfers[_0x188c6b['transfereeuniqueid']]['holdtime']=0x0;transfers[_0x188c6b[_0x344a('0x49')]][_0x344a('0x4a')]=0x2;}}else if(_0x188c6b[_0x344a('0x44')]==_0x188c6b[_0x344a('0x4b')]){if(!_[_0x344a('0x32')](agents[_0x188c6b['origtransfereruniqueid']])){utils[_0x344a('0x3')](util[_0x344a('0x4')](_0x344a('0x45'),_0x188c6b['origtransfereruniqueid'],agents[_0x188c6b[_0x344a('0x42')]]['membername']));agents[_0x188c6b['origtransfereruniqueid']][_0x344a('0x3b')]=!![];agents[_0x188c6b['origtransfereruniqueid']]['transfertype']=_0x344a('0x46');agents[_0x188c6b[_0x344a('0x42')]]['transferexten']=_0x188c6b[_0x344a('0x4c')];agents[_0x188c6b['origtransfereruniqueid']][_0x344a('0x48')]=_0x188c6b[_0x344a('0x44')];}if(_0x188c6b[_0x344a('0x4d')]&&agents[_0x188c6b['transfertargetuniqueid']]){agents[_0x188c6b['transfertargetuniqueid']][_0x344a('0x4a')]=0x1;transfers[_0x188c6b[_0x344a('0x4d')]]=_[_0x344a('0x4e')](agents[_0x188c6b[_0x344a('0x4d')]]);transfers[_0x188c6b['transfertargetuniqueid']]['calleridnum']=agents[_0x188c6b[_0x344a('0x42')]][_0x344a('0xa')];transfers[_0x188c6b[_0x344a('0x4d')]]['calleridname']=agents[_0x188c6b[_0x344a('0x42')]][_0x344a('0x4f')];transfers[_0x188c6b['transfertargetuniqueid']][_0x344a('0x17')]=utils['now']();transfers[_0x188c6b[_0x344a('0x4d')]]['agentconnectAt']=utils['now']();transfers[_0x188c6b['transfertargetuniqueid']][_0x344a('0x23')]=0x0;transfers[_0x188c6b[_0x344a('0x4d')]][_0x344a('0x4a')]=0x2;}}}catch(_0xce0446){utils[_0x344a('0x1c')](util[_0x344a('0x4')]('[%s][agents][attendedtransfer]',_0x188c6b[_0x344a('0x42')]),_0xce0446);}};exports[_0x344a('0x50')]=function(_0x20a892){try{utils[_0x344a('0x13')](util[_0x344a('0x4')]('[%s][agents][hangup]',_0x20a892[_0x344a('0x15')]),_0x20a892);if(agents[_0x20a892[_0x344a('0x15')]]&&agents[_0x20a892['uniqueid']][_0x344a('0x22')]===_0x344a('0x21')){if(_0x20a892[_0x344a('0x51')]==='21'){agents[_0x20a892[_0x344a('0x15')]]['reason']=_0x344a('0x52');agents[_0x20a892[_0x344a('0x15')]][_0x344a('0x2f')]=_0x344a('0x52');}utils[_0x344a('0x3')](util[_0x344a('0x4')](_0x344a('0x53'),_0x20a892[_0x344a('0x15')],agents[_0x20a892['uniqueid']][_0x344a('0x8')],agents[_0x20a892[_0x344a('0x15')]][_0x344a('0x22')],agents[_0x20a892[_0x344a('0x15')]][_0x344a('0x2f')]));writeDB(agents[_0x20a892[_0x344a('0x15')]]);var _0x212b08=unanswered[_0x344a('0x54')](_0x20a892['uniqueid']);if(_0x212b08>-0x1){unanswered[_0x344a('0x55')](_0x212b08,0x1);}}if(transfers[_0x20a892[_0x344a('0x15')]]){transfers[_0x20a892[_0x344a('0x15')]][_0x344a('0xd')]=!![];transfers[_0x20a892['uniqueid']][_0x344a('0x36')]=utils[_0x344a('0x18')]();transfers[_0x20a892[_0x344a('0x15')]][_0x344a('0x25')]=utils[_0x344a('0x35')](transfers[_0x20a892[_0x344a('0x15')]][_0x344a('0x36')],transfers[_0x20a892[_0x344a('0x15')]]['agentconnectAt']);transfers[_0x20a892[_0x344a('0x15')]][_0x344a('0x22')]=_0x344a('0x56');transfers[_0x20a892[_0x344a('0x15')]]['lastevent']=_0x344a('0x37');utils[_0x344a('0x3')](util[_0x344a('0x4')](_0x344a('0x53'),_0x20a892[_0x344a('0x15')],transfers[_0x20a892[_0x344a('0x15')]]['membername'],transfers[_0x20a892[_0x344a('0x15')]][_0x344a('0x22')],transfers[_0x20a892[_0x344a('0x15')]]['lastevent']));writeDB(transfers[_0x20a892[_0x344a('0x15')]],!![]);}if(agents[_0x20a892[_0x344a('0x15')]]&&agents[_0x20a892[_0x344a('0x15')]][_0x344a('0x2d')]){agents[_0x20a892[_0x344a('0x15')]]['agentcomplete']=!![];agents[_0x20a892[_0x344a('0x15')]][_0x344a('0x36')]=utils[_0x344a('0x18')]();agents[_0x20a892['uniqueid']][_0x344a('0x25')]=utils['diffTime'](agents[_0x20a892['uniqueid']][_0x344a('0x36')],agents[_0x20a892[_0x344a('0x15')]][_0x344a('0x2d')]);agents[_0x20a892[_0x344a('0x15')]][_0x344a('0x22')]=agents[_0x20a892[_0x344a('0x15')]][_0x344a('0x3b')]?_0x344a('0x3b'):'agent';agents[_0x20a892[_0x344a('0x15')]][_0x344a('0x2f')]='complete';utils['info'](util[_0x344a('0x4')](_0x344a('0x53'),_0x20a892[_0x344a('0x15')],agents[_0x20a892[_0x344a('0x15')]]['membername'],agents[_0x20a892[_0x344a('0x15')]][_0x344a('0x22')],agents[_0x20a892[_0x344a('0x15')]]['lastevent']));writeDB(agents[_0x20a892[_0x344a('0x15')]]);}}catch(_0x1c50c3){utils[_0x344a('0x1c')](util['format'](_0x344a('0x57'),_0x20a892[_0x344a('0x15')]),_0x1c50c3);}}; \ No newline at end of file +var _0xe1e3=['agentcompleteAt','[%s][agents][agentcomplete]','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfer','transfertype','extension','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','secondtransfereruniqueid','transferexten','transfereeuniqueid','calleridname','agentcalledAt','agententerreason','secondtransfererlinkedid','ATTENDED','secondtransfererexten','transferuniqueid','transfertargetuniqueid','clone','hangup','[%s][agents][hangup]','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','splice','agent','complete','lodash','util','format','uniqueid','channel','queue','membername','interface','calleridnum','lastevent','getVoiceQueueByName','then','agentcomplete','acwtime','agentacw','acwTimeout','CreateVoiceAgentReport','[%s][agents][agentcalled]','destuniqueid','now','called','info','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','debug','agentringnoanswer','agentringnoanswerAt','timeout','talktime','error','queuecallerabandon','includes','[%s][agents][queuecallerabandon]','abandoned','reason','holdtime','agentconnect','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connectedlinenum','connectedlinename','ringtime','connect','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','[%s][agents][agentconnect]','isNil','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diffTime'];(function(_0x1c9d4c,_0x70734e){var _0x29e448=function(_0x81fa75){while(--_0x81fa75){_0x1c9d4c['push'](_0x1c9d4c['shift']());}};_0x29e448(++_0x70734e);}(_0xe1e3,0x1bb));var _0x3e1e=function(_0x4579ee,_0x4c61cf){_0x4579ee=_0x4579ee-0x0;var _0x384ed7=_0xe1e3[_0x4579ee];return _0x384ed7;};'use strict';var _=require(_0x3e1e('0x0'));var util=require(_0x3e1e('0x1'));var utils=require('./utils');var agents={};var transfers={};var unanswered=[];function writeDB(_0xdbdabb,_0x5e9f9a){utils['info'](util[_0x3e1e('0x2')]('[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0xdbdabb[_0x3e1e('0x3')],_0xdbdabb[_0x3e1e('0x4')],_0xdbdabb[_0x3e1e('0x5')],_0xdbdabb[_0x3e1e('0x6')],_0xdbdabb[_0x3e1e('0x7')],_0xdbdabb[_0x3e1e('0x8')],_0xdbdabb['connectedlinenum'],_0xdbdabb[_0x3e1e('0x9')]));if(_0xdbdabb[_0x3e1e('0x5')]){utils[_0x3e1e('0xa')](_0xdbdabb[_0x3e1e('0x5')])[_0x3e1e('0xb')](function(_0x1e5173){if(_0x1e5173){_0xdbdabb['type']=_0x1e5173['type'];_0xdbdabb['agentacw']=_0xdbdabb[_0x3e1e('0xc')]?_0x1e5173['acw']:![];_0xdbdabb[_0x3e1e('0xd')]=_0xdbdabb[_0x3e1e('0xe')]?_0x1e5173[_0x3e1e('0xf')]:0x0;}utils['request'](_0x3e1e('0x10'),_0xdbdabb);});}else{utils['request']('CreateVoiceAgentReport',_0xdbdabb);}if(_0x5e9f9a){delete transfers[_0xdbdabb['uniqueid']];}else{delete agents[_0xdbdabb['destuniqueid']];}}exports['agentcalled']=function(_0x14ad58){try{utils['debug'](util['format'](_0x3e1e('0x11'),_0x14ad58[_0x3e1e('0x3')]),_0x14ad58);agents[_0x14ad58[_0x3e1e('0x12')]]=_0x14ad58;agents[_0x14ad58['destuniqueid']]['agentcalledAt']=utils[_0x3e1e('0x13')]();agents[_0x14ad58[_0x3e1e('0x12')]]['lastevent']=_0x3e1e('0x14');agents[_0x14ad58[_0x3e1e('0x12')]]['connectedlinenum']=null;agents[_0x14ad58[_0x3e1e('0x12')]]['connectedlinename']=null;utils[_0x3e1e('0x15')](util[_0x3e1e('0x2')](_0x3e1e('0x16'),_0x14ad58[_0x3e1e('0x3')],agents[_0x14ad58[_0x3e1e('0x12')]][_0x3e1e('0x6')],_0x14ad58['destuniqueid']));}catch(_0x5dccb8){utils['error'](util[_0x3e1e('0x2')](_0x3e1e('0x11'),_0x14ad58[_0x3e1e('0x3')]),_0x5dccb8);}};exports['agentringnoanswer']=function(_0x1c5acd){try{if(!_['isNil'](agents[_0x1c5acd[_0x3e1e('0x12')]])){utils[_0x3e1e('0x17')](util[_0x3e1e('0x2')]('[%s][agents][agentringnoanswer]',_0x1c5acd[_0x3e1e('0x3')]),_0x1c5acd);utils[_0x3e1e('0x15')](util[_0x3e1e('0x2')]('[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout',_0x1c5acd['uniqueid'],agents[_0x1c5acd[_0x3e1e('0x12')]][_0x3e1e('0x6')],_0x1c5acd['destuniqueid']));agents[_0x1c5acd[_0x3e1e('0x12')]][_0x3e1e('0x18')]=!![];agents[_0x1c5acd[_0x3e1e('0x12')]][_0x3e1e('0x19')]=utils[_0x3e1e('0x13')]();agents[_0x1c5acd[_0x3e1e('0x12')]][_0x3e1e('0x9')]=_0x3e1e('0x1a');agents[_0x1c5acd['destuniqueid']]['reason']=_0x3e1e('0x1a');agents[_0x1c5acd[_0x3e1e('0x12')]]['holdtime']=_0x1c5acd['ringtime']?parseInt(_0x1c5acd['ringtime'])/0x3e8:0x0;agents[_0x1c5acd[_0x3e1e('0x12')]][_0x3e1e('0x1b')]=0x0;unanswered['push'](_0x1c5acd[_0x3e1e('0x12')]);}}catch(_0x5ac814){utils[_0x3e1e('0x1c')](util[_0x3e1e('0x2')]('[%s][agents][agentringnoanswer]',_0x1c5acd[_0x3e1e('0x3')]),_0x5ac814);}};exports[_0x3e1e('0x1d')]=function(_0x45ed0e){try{_['forIn'](agents,function(_0xdef39,_0x4ec149){if(_0xdef39['uniqueid']==_0x45ed0e['uniqueid']&&!_[_0x3e1e('0x1e')](unanswered,_0xdef39['destuniqueid'])){utils['debug'](util[_0x3e1e('0x2')](_0x3e1e('0x1f'),_0x45ed0e[_0x3e1e('0x3')]),_0x45ed0e);utils[_0x3e1e('0x15')](util[_0x3e1e('0x2')]('[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0x45ed0e['uniqueid'],_0xdef39['membername'],_0xdef39['destuniqueid']));_0xdef39[_0x3e1e('0x18')]=!![];_0xdef39[_0x3e1e('0x19')]=utils[_0x3e1e('0x13')]();_0xdef39[_0x3e1e('0x9')]=_0x3e1e('0x20');_0xdef39[_0x3e1e('0x21')]=_0x3e1e('0x20');_0xdef39[_0x3e1e('0x22')]=_0x45ed0e['holdtime'];_0xdef39[_0x3e1e('0x1b')]=0x0;writeDB(_0xdef39);}});}catch(_0x348ef5){utils['error'](util[_0x3e1e('0x2')](_0x3e1e('0x1f'),_0x45ed0e[_0x3e1e('0x3')]),_0x348ef5);}};exports[_0x3e1e('0x23')]=function(_0x55a082){try{if(agents[_0x55a082['destuniqueid']]){utils[_0x3e1e('0x17')](util[_0x3e1e('0x2')]('[%s][agents][agentconnect]',_0x55a082[_0x3e1e('0x3')]),_0x55a082);utils[_0x3e1e('0x15')](util['format'](_0x3e1e('0x24'),_0x55a082[_0x3e1e('0x3')],agents[_0x55a082[_0x3e1e('0x12')]][_0x3e1e('0x6')],_0x55a082[_0x3e1e('0x12')]));agents[_0x55a082['destuniqueid']][_0x3e1e('0x25')]=utils[_0x3e1e('0x13')]();agents[_0x55a082[_0x3e1e('0x12')]][_0x3e1e('0x26')]=_0x55a082['connectedlinenum'];agents[_0x55a082[_0x3e1e('0x12')]][_0x3e1e('0x27')]=_0x55a082[_0x3e1e('0x27')];agents[_0x55a082[_0x3e1e('0x12')]][_0x3e1e('0x22')]=_0x55a082[_0x3e1e('0x28')];agents[_0x55a082[_0x3e1e('0x12')]]['lastevent']=_0x3e1e('0x29');_['forIn'](agents,function(_0x53bdf5,_0x4f598e){if(_0x53bdf5[_0x3e1e('0x12')]!=_0x55a082[_0x3e1e('0x12')]&&_0x53bdf5['uniqueid']==_0x55a082[_0x3e1e('0x3')]){_0x53bdf5[_0x3e1e('0x1b')]=0x0;_0x53bdf5['holdtime']=_0x55a082[_0x3e1e('0x28')];_0x53bdf5[_0x3e1e('0x18')]=!![];_0x53bdf5['agentringnoanswerAt']=utils['now']();_0x53bdf5[_0x3e1e('0x9')]='answered_elsewhere';_0x53bdf5['reason']=_0x3e1e('0x2a');_0x53bdf5[_0x3e1e('0x2b')]=_0x55a082[_0x3e1e('0x12')];_0x53bdf5[_0x3e1e('0x2c')]=_0x55a082[_0x3e1e('0x6')];writeDB(_0x53bdf5);}});}}catch(_0x55ea1d){utils['error'](util[_0x3e1e('0x2')](_0x3e1e('0x2d'),_0x55a082[_0x3e1e('0x3')]),_0x55ea1d);}};exports['agentcomplete']=function(_0x1124d0){try{if(!_[_0x3e1e('0x2e')](agents[_0x1124d0[_0x3e1e('0x12')]])){utils['debug'](util[_0x3e1e('0x2')]('[%s][agents][agentcomplete]',_0x1124d0['uniqueid']),_0x1124d0);utils[_0x3e1e('0x15')](util[_0x3e1e('0x2')](_0x3e1e('0x2f'),_0x1124d0[_0x3e1e('0x3')],agents[_0x1124d0['destuniqueid']]['membername'],_0x1124d0['destuniqueid']));agents[_0x1124d0['destuniqueid']][_0x3e1e('0xc')]=!![];agents[_0x1124d0[_0x3e1e('0x12')]]['agentcompleteAt']=utils['now']();agents[_0x1124d0[_0x3e1e('0x12')]][_0x3e1e('0x1b')]=utils[_0x3e1e('0x30')](agents[_0x1124d0['destuniqueid']][_0x3e1e('0x31')],agents[_0x1124d0['destuniqueid']][_0x3e1e('0x25')]);agents[_0x1124d0[_0x3e1e('0x12')]][_0x3e1e('0x21')]=_0x1124d0[_0x3e1e('0x21')];agents[_0x1124d0[_0x3e1e('0x12')]][_0x3e1e('0x9')]='complete';writeDB(agents[_0x1124d0[_0x3e1e('0x12')]]);}}catch(_0x1ce1cd){utils['error'](util[_0x3e1e('0x2')](_0x3e1e('0x32'),_0x1124d0['uniqueid']),_0x1ce1cd);}};exports[_0x3e1e('0x33')]=function(_0x347b3f){try{if(!_[_0x3e1e('0x2e')](agents[_0x347b3f[_0x3e1e('0x34')]])){utils['debug'](util[_0x3e1e('0x2')](_0x3e1e('0x35'),_0x347b3f[_0x3e1e('0x3')]),_0x347b3f);utils[_0x3e1e('0x15')](util['format'](_0x3e1e('0x36'),_0x347b3f[_0x3e1e('0x3')],agents[_0x347b3f[_0x3e1e('0x34')]][_0x3e1e('0x6')],agents[_0x347b3f[_0x3e1e('0x34')]][_0x3e1e('0x3')]));agents[_0x347b3f[_0x3e1e('0x34')]][_0x3e1e('0x37')]=!![];agents[_0x347b3f['transfereruniqueid']][_0x3e1e('0x38')]='blind';agents[_0x347b3f['transfereruniqueid']]['transferexten']=_0x347b3f[_0x3e1e('0x39')];agents[_0x347b3f[_0x3e1e('0x34')]]['transferuniqueid']=agents[_0x347b3f[_0x3e1e('0x34')]]['uniqueid'];}}catch(_0x5b2416){utils[_0x3e1e('0x1c')](util['format']('[%s][agents][blindtransfer]',_0x347b3f['uniqueid']),_0x5b2416);}};exports[_0x3e1e('0x3a')]=function(_0xe577b2){try{utils[_0x3e1e('0x17')](util[_0x3e1e('0x2')](_0x3e1e('0x3b'),_0xe577b2[_0x3e1e('0x3c')]),_0xe577b2);if(_0xe577b2[_0x3e1e('0x3c')]==_0xe577b2['origtransfererlinkedid']){if(!_[_0x3e1e('0x2e')](agents[_0xe577b2['secondtransfereruniqueid']])){utils[_0x3e1e('0x15')](util[_0x3e1e('0x2')](_0x3e1e('0x3d'),_0xe577b2['origtransfereruniqueid'],agents[_0xe577b2['secondtransfereruniqueid']][_0x3e1e('0x6')]));agents[_0xe577b2[_0x3e1e('0x3e')]]['transfer']=!![];agents[_0xe577b2[_0x3e1e('0x3e')]]['transfertype']='ATTENDED';agents[_0xe577b2[_0x3e1e('0x3e')]][_0x3e1e('0x3f')]=_0xe577b2['origtransfererexten'];agents[_0xe577b2[_0x3e1e('0x3e')]]['transferuniqueid']=_0xe577b2['origtransfereruniqueid'];}if(_0xe577b2[_0x3e1e('0x40')]&&agents[_0xe577b2['transfereeuniqueid']]){agents[_0xe577b2[_0x3e1e('0x40')]]['agententerreason']=0x1;transfers[_0xe577b2[_0x3e1e('0x40')]]=_['clone'](agents[_0xe577b2[_0x3e1e('0x40')]]);transfers[_0xe577b2[_0x3e1e('0x40')]]['calleridnum']=agents[_0xe577b2['secondtransfereruniqueid']]['calleridnum'];transfers[_0xe577b2[_0x3e1e('0x40')]][_0x3e1e('0x41')]=agents[_0xe577b2[_0x3e1e('0x3e')]]['calleridname'];transfers[_0xe577b2[_0x3e1e('0x40')]][_0x3e1e('0x42')]=utils[_0x3e1e('0x13')]();transfers[_0xe577b2['transfereeuniqueid']]['agentconnectAt']=utils[_0x3e1e('0x13')]();transfers[_0xe577b2['transfereeuniqueid']][_0x3e1e('0x22')]=0x0;transfers[_0xe577b2[_0x3e1e('0x40')]][_0x3e1e('0x43')]=0x2;}}else if(_0xe577b2['secondtransfereruniqueid']==_0xe577b2[_0x3e1e('0x44')]){if(!_['isNil'](agents[_0xe577b2[_0x3e1e('0x3c')]])){utils[_0x3e1e('0x15')](util['format'](_0x3e1e('0x3d'),_0xe577b2['origtransfereruniqueid'],agents[_0xe577b2[_0x3e1e('0x3c')]]['membername']));agents[_0xe577b2[_0x3e1e('0x3c')]]['transfer']=!![];agents[_0xe577b2[_0x3e1e('0x3c')]][_0x3e1e('0x38')]=_0x3e1e('0x45');agents[_0xe577b2['origtransfereruniqueid']][_0x3e1e('0x3f')]=_0xe577b2[_0x3e1e('0x46')];agents[_0xe577b2['origtransfereruniqueid']][_0x3e1e('0x47')]=_0xe577b2['secondtransfereruniqueid'];}if(_0xe577b2['transfertargetuniqueid']&&agents[_0xe577b2['transfertargetuniqueid']]){agents[_0xe577b2[_0x3e1e('0x48')]][_0x3e1e('0x43')]=0x1;transfers[_0xe577b2[_0x3e1e('0x48')]]=_[_0x3e1e('0x49')](agents[_0xe577b2[_0x3e1e('0x48')]]);transfers[_0xe577b2[_0x3e1e('0x48')]][_0x3e1e('0x8')]=agents[_0xe577b2['origtransfereruniqueid']][_0x3e1e('0x8')];transfers[_0xe577b2[_0x3e1e('0x48')]][_0x3e1e('0x41')]=agents[_0xe577b2[_0x3e1e('0x3c')]][_0x3e1e('0x41')];transfers[_0xe577b2[_0x3e1e('0x48')]][_0x3e1e('0x42')]=utils[_0x3e1e('0x13')]();transfers[_0xe577b2['transfertargetuniqueid']]['agentconnectAt']=utils[_0x3e1e('0x13')]();transfers[_0xe577b2[_0x3e1e('0x48')]][_0x3e1e('0x22')]=0x0;transfers[_0xe577b2[_0x3e1e('0x48')]][_0x3e1e('0x43')]=0x2;}}}catch(_0x2e950d){utils[_0x3e1e('0x1c')](util[_0x3e1e('0x2')](_0x3e1e('0x3b'),_0xe577b2[_0x3e1e('0x3c')]),_0x2e950d);}};exports[_0x3e1e('0x4a')]=function(_0x50ba57){try{utils['debug'](util['format'](_0x3e1e('0x4b'),_0x50ba57[_0x3e1e('0x3')]),_0x50ba57);if(agents[_0x50ba57[_0x3e1e('0x3')]]&&agents[_0x50ba57[_0x3e1e('0x3')]][_0x3e1e('0x21')]==='timeout'){if(_0x50ba57[_0x3e1e('0x4c')]==='21'){agents[_0x50ba57[_0x3e1e('0x3')]][_0x3e1e('0x21')]=_0x3e1e('0x4d');agents[_0x50ba57[_0x3e1e('0x3')]]['lastevent']=_0x3e1e('0x4d');}utils[_0x3e1e('0x15')](util[_0x3e1e('0x2')](_0x3e1e('0x4e'),_0x50ba57[_0x3e1e('0x3')],agents[_0x50ba57[_0x3e1e('0x3')]]['membername'],agents[_0x50ba57[_0x3e1e('0x3')]][_0x3e1e('0x21')],agents[_0x50ba57[_0x3e1e('0x3')]][_0x3e1e('0x9')]));writeDB(agents[_0x50ba57[_0x3e1e('0x3')]]);var _0x372581=unanswered['indexOf'](_0x50ba57[_0x3e1e('0x3')]);if(_0x372581>-0x1){unanswered[_0x3e1e('0x4f')](_0x372581,0x1);}}if(transfers[_0x50ba57[_0x3e1e('0x3')]]){transfers[_0x50ba57[_0x3e1e('0x3')]][_0x3e1e('0xc')]=!![];transfers[_0x50ba57[_0x3e1e('0x3')]]['agentcompleteAt']=utils[_0x3e1e('0x13')]();transfers[_0x50ba57['uniqueid']][_0x3e1e('0x1b')]=utils[_0x3e1e('0x30')](transfers[_0x50ba57['uniqueid']][_0x3e1e('0x31')],transfers[_0x50ba57[_0x3e1e('0x3')]][_0x3e1e('0x25')]);transfers[_0x50ba57[_0x3e1e('0x3')]]['reason']=_0x3e1e('0x50');transfers[_0x50ba57['uniqueid']][_0x3e1e('0x9')]=_0x3e1e('0x51');utils[_0x3e1e('0x15')](util[_0x3e1e('0x2')](_0x3e1e('0x4e'),_0x50ba57[_0x3e1e('0x3')],transfers[_0x50ba57['uniqueid']][_0x3e1e('0x6')],transfers[_0x50ba57[_0x3e1e('0x3')]][_0x3e1e('0x21')],transfers[_0x50ba57[_0x3e1e('0x3')]]['lastevent']));writeDB(transfers[_0x50ba57[_0x3e1e('0x3')]],!![]);}if(agents[_0x50ba57[_0x3e1e('0x3')]]&&agents[_0x50ba57[_0x3e1e('0x3')]][_0x3e1e('0x25')]){agents[_0x50ba57['uniqueid']][_0x3e1e('0xc')]=!![];agents[_0x50ba57[_0x3e1e('0x3')]][_0x3e1e('0x31')]=utils[_0x3e1e('0x13')]();agents[_0x50ba57[_0x3e1e('0x3')]][_0x3e1e('0x1b')]=utils['diffTime'](agents[_0x50ba57['uniqueid']]['agentcompleteAt'],agents[_0x50ba57[_0x3e1e('0x3')]]['agentconnectAt']);agents[_0x50ba57[_0x3e1e('0x3')]]['reason']=agents[_0x50ba57[_0x3e1e('0x3')]][_0x3e1e('0x37')]?_0x3e1e('0x37'):_0x3e1e('0x50');agents[_0x50ba57['uniqueid']][_0x3e1e('0x9')]='complete';utils[_0x3e1e('0x15')](util['format'](_0x3e1e('0x4e'),_0x50ba57[_0x3e1e('0x3')],agents[_0x50ba57['uniqueid']][_0x3e1e('0x6')],agents[_0x50ba57[_0x3e1e('0x3')]][_0x3e1e('0x21')],agents[_0x50ba57['uniqueid']]['lastevent']));writeDB(agents[_0x50ba57[_0x3e1e('0x3')]]);}}catch(_0x20bb6d){utils[_0x3e1e('0x1c')](util['format'](_0x3e1e('0x4b'),_0x50ba57['uniqueid']),_0x20bb6d);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index d975ee4..b5fe951 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 _0x10e4=['xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','xmd-cdrtype','type','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','newexten','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','cdr','split','lastIndexOf','includes','noop','set','gotoif','[%s][calls][newexten]','lodash','util','NO\x20ANSWER','FAILED','ANSWERED','blinds','uniqueid','transfereeuniqueid','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','queue','membername','connectedlinenum','lastevent','accountcode','then','UserId','CreateVoiceCallReport','request','newchannel','debug','[%s][calls][newchannel]','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','exten','context','now','DOCUMENTATION','error','newstate','channelstate','isNil','systemanswertime','linkedid','transfer','destinationchannel','answertime','disposition','toNumber','hangup','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime','duration','billableseconds','[%s][calls][hangup]','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','userfield','origtransfererchannel','_attended','musiconholdstart','musiconholdstartAt','[%s][calls][musiconholdstart]','[%s][calls][musiconholdstop]','[%s][calls][musiconholdstop]\x20mohtime:%s','mohtime','varset','[%s][calls][varset]','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','source','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','variable','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-callerid-preview','xmd-queue','xmcs-queue','lastapplication','Queue','lastdata'];(function(_0x4ebdf4,_0x57d47f){var _0x18d1c1=function(_0x83f2a0){while(--_0x83f2a0){_0x4ebdf4['push'](_0x4ebdf4['shift']());}};_0x18d1c1(++_0x57d47f);}(_0x10e4,0x1b1));var _0x410e=function(_0x55b37c,_0x5a1b1c){_0x55b37c=_0x55b37c-0x0;var _0x3fe615=_0x10e4[_0x55b37c];return _0x3fe615;};'use strict';var _=require(_0x410e('0x0'));var util=require(_0x410e('0x1'));var utils=require('./utils');var transfers=require('./transfers.controller');var dispositions=[_0x410e('0x2'),_0x410e('0x3'),'FAILED',_0x410e('0x2'),'NO\x20ANSWER',_0x410e('0x2'),_0x410e('0x4'),'BUSY','FAILED','FAILED',_0x410e('0x3')];var channels={};function writeDB(_0x39a920){var _0x341502;if(transfers[_0x410e('0x5')][_0x39a920['uniqueid']]){_0x341502=_0x39a920['uniqueid'];_0x39a920[_0x410e('0x6')]=transfers[_0x410e('0x5')][_0x39a920[_0x410e('0x6')]][_0x410e('0x7')];}utils[_0x410e('0x8')](util[_0x410e('0x9')](_0x410e('0xa'),_0x39a920['uniqueid'],_0x39a920[_0x410e('0xb')],_0x39a920[_0x410e('0xc')],_0x39a920[_0x410e('0xd')],_0x39a920['interface'],_0x39a920['calleridnum'],_0x39a920[_0x410e('0xe')],_0x39a920[_0x410e('0xf')]));if(_0x39a920[_0x410e('0x10')]){utils['getUserByInternal'](_0x39a920['accountcode'])[_0x410e('0x11')](function(_0x243b48){if(_0x243b48){_0x39a920[_0x410e('0x12')]=_0x243b48['id'];}utils['request'](_0x410e('0x13'),_0x39a920);});}else{utils[_0x410e('0x14')](_0x410e('0x13'),_0x39a920);}if(channels[_0x39a920[_0x410e('0x6')]]){delete channels[_0x39a920[_0x410e('0x6')]];}else if(_0x341502&&channels[_0x341502]){delete transfers['blinds'][_0x341502];delete channels[_0x341502];}}exports[_0x410e('0x15')]=function(_0x43a5af){try{utils[_0x410e('0x16')](util[_0x410e('0x9')](_0x410e('0x17'),_0x43a5af['uniqueid']),_0x43a5af);if(_0x43a5af[_0x410e('0x6')]==_0x43a5af['linkedid']&&_0x43a5af[_0x410e('0xb')]!=_0x410e('0x18')){utils[_0x410e('0x8')](util[_0x410e('0x9')](_0x410e('0x19'),_0x43a5af[_0x410e('0x6')],_0x43a5af['context'],_0x43a5af[_0x410e('0x1a')]));channels[_0x43a5af[_0x410e('0x6')]]={'uniqueid':_0x43a5af[_0x410e('0x6')],'accountcode':_0x43a5af[_0x410e('0x10')],'source':_0x43a5af['calleridnum'],'destination':_0x43a5af[_0x410e('0x1a')],'destinationcontext':_0x43a5af[_0x410e('0x1b')],'channel':_0x43a5af['channel'],'starttime':utils[_0x410e('0x1c')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x410e('0x2'),'amaflags':_0x410e('0x1d')};}}catch(_0x2f1481){utils[_0x410e('0x1e')](util['format'](_0x410e('0x17'),_0x43a5af['uniqueid']),_0x2f1481);}};exports[_0x410e('0x1f')]=function(_0x52c3ac){try{utils['debug'](util[_0x410e('0x9')]('[%s][calls][newstate]',_0x52c3ac[_0x410e('0x6')]),_0x52c3ac);if(!_['isNil'](channels[_0x52c3ac[_0x410e('0x6')]])&&_0x52c3ac[_0x410e('0x20')]==0x6){utils['info'](util[_0x410e('0x9')]('[%s][calls][newstate]\x20context:%s\x20channel:%s',_0x52c3ac[_0x410e('0x6')],_0x52c3ac['context'],_0x52c3ac[_0x410e('0xb')]));if(_[_0x410e('0x21')](channels[_0x52c3ac[_0x410e('0x6')]]['systemanswertime'])){channels[_0x52c3ac[_0x410e('0x6')]][_0x410e('0x22')]=utils[_0x410e('0x1c')]();}}else if(!_['isNil'](channels[_0x52c3ac[_0x410e('0x23')]])&&_0x52c3ac[_0x410e('0x20')]==0x6&&_0x52c3ac['context']!=_0x410e('0x24')){utils[_0x410e('0x8')](util[_0x410e('0x9')]('[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x52c3ac[_0x410e('0x6')],_0x52c3ac[_0x410e('0x23')],_0x52c3ac[_0x410e('0x1b')],_0x52c3ac[_0x410e('0xb')]));channels[_0x52c3ac[_0x410e('0x23')]]['accountcode']=_0x52c3ac[_0x410e('0x10')];channels[_0x52c3ac[_0x410e('0x23')]][_0x410e('0x25')]=_0x52c3ac[_0x410e('0xb')];if(_[_0x410e('0x21')](channels[_0x52c3ac[_0x410e('0x23')]][_0x410e('0x26')])){channels[_0x52c3ac[_0x410e('0x23')]][_0x410e('0x26')]=utils[_0x410e('0x1c')]();}channels[_0x52c3ac['linkedid']][_0x410e('0x27')]=dispositions[_[_0x410e('0x28')](_0x52c3ac['channelstate'])]||_0x410e('0x4');}}catch(_0x37cfd9){utils['error'](util['format']('[%s][calls][newstate]',_0x52c3ac['uniqueid']),_0x37cfd9);}};exports[_0x410e('0x29')]=function(_0x172457){try{if(!_[_0x410e('0x21')](channels[_0x172457['uniqueid']])){utils['debug'](util[_0x410e('0x9')]('[%s][calls][hangup]',_0x172457['uniqueid']),_0x172457);if(_['isNil'](channels[_0x172457[_0x410e('0x6')]][_0x410e('0x2a')])){channels[_0x172457[_0x410e('0x6')]][_0x410e('0x2a')]=_0x172457[_0x410e('0x2b')]+'\x20<'+_0x172457['calleridnum']+'>';}utils[_0x410e('0x8')](util[_0x410e('0x9')](_0x410e('0x2c'),_0x172457[_0x410e('0x6')],channels[_0x172457[_0x410e('0x6')]][_0x410e('0x2a')],_0x172457[_0x410e('0x2d')]));channels[_0x172457[_0x410e('0x6')]][_0x410e('0x2e')]=utils[_0x410e('0x1c')]();channels[_0x172457[_0x410e('0x6')]][_0x410e('0x2f')]=utils['diffTime'](channels[_0x172457['uniqueid']][_0x410e('0x2e')],channels[_0x172457[_0x410e('0x6')]]['starttime']);channels[_0x172457[_0x410e('0x6')]][_0x410e('0x30')]=channels[_0x172457[_0x410e('0x6')]]['answertime']?utils['diffTime'](channels[_0x172457['uniqueid']][_0x410e('0x2e')],channels[_0x172457['uniqueid']][_0x410e('0x26')]):0x0;writeDB(channels[_0x172457['uniqueid']]);}}catch(_0x506c87){utils[_0x410e('0x1e')](util['format'](_0x410e('0x31'),_0x172457[_0x410e('0x6')]),_0x506c87);}};exports[_0x410e('0x32')]=function(_0x2a55c8){try{if(!_[_0x410e('0x21')](channels[_0x2a55c8[_0x410e('0x33')]])){utils['debug'](util[_0x410e('0x9')](_0x410e('0x34'),_0x2a55c8[_0x410e('0x35')]),_0x2a55c8);if(channels[_0x2a55c8[_0x410e('0x33')]][_0x410e('0xb')]==_0x2a55c8['transfereechannel']){utils[_0x410e('0x8')](util['format'](_0x410e('0x36'),_0x2a55c8[_0x410e('0x35')],_0x2a55c8[_0x410e('0x33')],_0x2a55c8[_0x410e('0x37')]));channels[_0x2a55c8[_0x410e('0x33')]][_0x410e('0x25')]=_0x2a55c8[_0x410e('0x37')];channels[_0x2a55c8[_0x410e('0x33')]][_0x410e('0x38')]='_attended';}else if(channels[_0x2a55c8['localtwolinkedid']][_0x410e('0xb')]=_0x2a55c8['transfertargetchannel']){utils[_0x410e('0x8')](util[_0x410e('0x9')](_0x410e('0x36'),_0x2a55c8['origtransfereruniqueid'],_0x2a55c8['localtwolinkedid'],_0x2a55c8[_0x410e('0x39')]));channels[_0x2a55c8['localtwolinkedid']]['destinationchannel']=_0x2a55c8[_0x410e('0x39')];channels[_0x2a55c8[_0x410e('0x33')]]['userfield']=_0x410e('0x3a');}}}catch(_0xb5c033){utils[_0x410e('0x1e')](util[_0x410e('0x9')](_0x410e('0x34'),_0x2a55c8[_0x410e('0x35')]),_0xb5c033);}};exports[_0x410e('0x3b')]=function(_0x4978aa){try{if(!_[_0x410e('0x21')](channels[_0x4978aa[_0x410e('0x6')]])){utils[_0x410e('0x16')](util[_0x410e('0x9')]('[%s][calls][musiconholdstart]',_0x4978aa[_0x410e('0x6')]),_0x4978aa);channels[_0x4978aa[_0x410e('0x6')]][_0x410e('0x3c')]=utils[_0x410e('0x1c')]();utils[_0x410e('0x8')](util['format']('[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s',_0x4978aa['uniqueid'],channels[_0x4978aa[_0x410e('0x6')]][_0x410e('0x3c')]));}}catch(_0x3848ba){utils[_0x410e('0x1e')](util[_0x410e('0x9')](_0x410e('0x3d'),_0x4978aa[_0x410e('0x6')]),_0x3848ba);}};exports['musiconholdstop']=function(_0x452b61){try{if(!_[_0x410e('0x21')](channels[_0x452b61[_0x410e('0x6')]])){utils[_0x410e('0x16')](util[_0x410e('0x9')](_0x410e('0x3e'),_0x452b61[_0x410e('0x6')]),_0x452b61);if(!_[_0x410e('0x21')](channels[_0x452b61[_0x410e('0x6')]][_0x410e('0x3c')])){channels[_0x452b61[_0x410e('0x6')]]['mohtime']+=utils['diffTime'](utils[_0x410e('0x1c')](),channels[_0x452b61[_0x410e('0x6')]][_0x410e('0x3c')]);utils[_0x410e('0x8')](util[_0x410e('0x9')](_0x410e('0x3f'),_0x452b61['uniqueid'],channels[_0x452b61[_0x410e('0x6')]][_0x410e('0x40')]));delete channels[_0x452b61[_0x410e('0x6')]][_0x410e('0x3c')];}}}catch(_0x19a0dc){utils[_0x410e('0x1e')](util[_0x410e('0x9')](_0x410e('0x3e'),_0x452b61[_0x410e('0x6')]),_0x19a0dc);}};exports[_0x410e('0x41')]=function(_0x4e49d6){try{if(!_[_0x410e('0x21')](channels[_0x4e49d6[_0x410e('0x6')]])){utils[_0x410e('0x16')](util[_0x410e('0x9')](_0x410e('0x42'),_0x4e49d6['uniqueid']),_0x4e49d6);if(!_[_0x410e('0x21')](_0x4e49d6['variable'][_0x410e('0x43')])){utils[_0x410e('0x8')](util[_0x410e('0x9')](_0x410e('0x44'),_0x4e49d6[_0x410e('0x6')],_0x4e49d6[_0x410e('0x45')]));channels[_0x4e49d6[_0x410e('0x6')]][_0x410e('0x46')]=_0x4e49d6[_0x410e('0x45')];}if(!_['isNil'](_0x4e49d6['variable'][_0x410e('0x47')])){utils['info'](util[_0x410e('0x9')](_0x410e('0x48'),_0x4e49d6[_0x410e('0x6')],_0x4e49d6['value']));channels[_0x4e49d6[_0x410e('0x6')]]['destination']=_0x4e49d6['value'];channels[_0x4e49d6[_0x410e('0x6')]][_0x410e('0x2a')]='\x22'+_0x4e49d6[_0x410e('0x45')]+'\x22\x20<'+_0x4e49d6[_0x410e('0x45')]+'>';}if(!_['isNil'](_0x4e49d6[_0x410e('0x49')]['xmd-callerid-preview'])||!_[_0x410e('0x21')](_0x4e49d6['variable'][_0x410e('0x4a')])){utils[_0x410e('0x8')](util[_0x410e('0x9')](_0x410e('0x4b'),_0x4e49d6[_0x410e('0x6')],!_[_0x410e('0x21')](_0x4e49d6[_0x410e('0x49')][_0x410e('0x4c')])?_0x410e('0x4c'):_0x410e('0x4a'),_0x4e49d6['value']));channels[_0x4e49d6[_0x410e('0x6')]][_0x410e('0x2a')]=_0x4e49d6[_0x410e('0x45')];}if(!_[_0x410e('0x21')](_0x4e49d6[_0x410e('0x49')][_0x410e('0x4d')])||!_[_0x410e('0x21')](_0x4e49d6['variable'][_0x410e('0x4e')])){utils[_0x410e('0x8')](util[_0x410e('0x9')](_0x410e('0x4b'),_0x4e49d6[_0x410e('0x6')],!_[_0x410e('0x21')](_0x4e49d6['variable'][_0x410e('0x4d')])?_0x410e('0x4d'):_0x410e('0x4e'),_0x4e49d6[_0x410e('0x45')]));channels[_0x4e49d6[_0x410e('0x6')]][_0x410e('0x4f')]=_0x410e('0x50');channels[_0x4e49d6[_0x410e('0x6')]][_0x410e('0x51')]=_0x4e49d6['value'];channels[_0x4e49d6[_0x410e('0x6')]]['queue']=!![];}if(!_[_0x410e('0x21')](_0x4e49d6[_0x410e('0x49')][_0x410e('0x52')])){utils['info'](util['format'](_0x410e('0x53'),_0x4e49d6['uniqueid'],_0x4e49d6[_0x410e('0x45')]));channels[_0x4e49d6[_0x410e('0x6')]]['ContactId']=_0x4e49d6['value'];}if(!_['isNil'](_0x4e49d6['variable'][_0x410e('0x54')])){utils[_0x410e('0x8')](util[_0x410e('0x9')]('[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s',_0x4e49d6[_0x410e('0x6')],_0x4e49d6[_0x410e('0x45')]));channels[_0x4e49d6[_0x410e('0x6')]][_0x410e('0x55')]=_0x4e49d6[_0x410e('0x45')];}if(!_[_0x410e('0x21')](_0x4e49d6['variable']['outboundrouteid'])){utils[_0x410e('0x8')](util['format'](_0x410e('0x56'),_0x4e49d6[_0x410e('0x6')],_0x4e49d6[_0x410e('0x45')]));channels[_0x4e49d6[_0x410e('0x6')]][_0x410e('0x57')]=_0x4e49d6[_0x410e('0x45')];}if(!_[_0x410e('0x21')](_0x4e49d6[_0x410e('0x49')][_0x410e('0x58')])){utils[_0x410e('0x8')](util[_0x410e('0x9')](_0x410e('0x59'),_0x4e49d6[_0x410e('0x6')],_0x4e49d6['value']));channels[_0x4e49d6[_0x410e('0x6')]]['sipcallid']=_0x4e49d6[_0x410e('0x45')];}}}catch(_0x67d01c){utils[_0x410e('0x1e')](util['format'](_0x410e('0x42'),_0x4e49d6[_0x410e('0x6')]),_0x67d01c);}};exports[_0x410e('0x5a')]=function(_0x222039){try{if(!_['isNil'](channels[_0x222039[_0x410e('0x6')]])){utils[_0x410e('0x16')](util[_0x410e('0x9')]('[%s][calls][newexten]',_0x222039[_0x410e('0x6')]),_0x222039);utils[_0x410e('0x8')](util[_0x410e('0x9')](_0x410e('0x5b'),_0x222039[_0x410e('0x6')],_0x222039[_0x410e('0x5c')],_0x222039[_0x410e('0x5d')]));if(_0x222039[_0x410e('0x5c')][_0x410e('0x5e')]()=='set'&&_['startsWith'](_0x222039['appdata'][_0x410e('0x5e')](),_0x410e('0x5f'))){var _0xfea4be=_0x222039[_0x410e('0x5d')][_0x410e('0x60')]('=');var _0x2406f2=_0xfea4be[0x0]['substring'](_0xfea4be[0x0]['lastIndexOf']('(')+0x1,_0xfea4be[0x0][_0x410e('0x61')](')'));var _0x31a5ad=_0xfea4be[0x1];channels[_0x222039['uniqueid']][_0x2406f2]=_0x31a5ad;}if(!_[_0x410e('0x62')]([_0x410e('0x29'),_0x410e('0x63'),'execif',_0x410e('0x64'),_0x410e('0x65')],_0x222039[_0x410e('0x5c')]['toLowerCase']())){channels[_0x222039[_0x410e('0x6')]][_0x410e('0x4f')]=_0x222039[_0x410e('0x5c')];channels[_0x222039['uniqueid']][_0x410e('0x51')]=_0x222039[_0x410e('0x5d')];}}}catch(_0xe14d83){utils[_0x410e('0x1e')](util['format'](_0x410e('0x66'),_0x222039[_0x410e('0x6')]),_0xe14d83);}}; \ No newline at end of file +var _0x42e2=['[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-callerid-preview','xmd-callerid','xmd-queue','xmcs-queue','lastapplication','Queue','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','outboundrouteid','routeid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','newexten','[%s][calls][newexten]','application','appdata','toLowerCase','set','cdr','substring','lastIndexOf','includes','noop','execif','gotoif','lastdata','lodash','./utils','FAILED','NO\x20ANSWER','ANSWERED','BUSY','blinds','uniqueid','transfereeuniqueid','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','queue','membername','interface','calleridnum','connectedlinenum','lastevent','accountcode','getUserByInternal','then','UserId','request','CreateVoiceCallReport','debug','[%s][calls][newchannel]','channel','OutgoingSpoolFailed','context','exten','now','DOCUMENTATION','error','[%s][calls][newstate]','isNil','systemanswertime','linkedid','channelstate','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','toNumber','hangup','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','duration','diffTime','endtime','starttime','billableseconds','[%s][calls][hangup]','attendedtransfer','[%s][calls][attendedtransfer]','origtransfereruniqueid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','localtwolinkedid','secondtransfererchannel','userfield','_attended','transfertargetchannel','origtransfererchannel','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','[%s][calls][musiconholdstop]','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','varset','[%s][calls][varset]','variable','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','source','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination'];(function(_0x791148,_0x56bbe3){var _0x4bd2f2=function(_0x41bf8f){while(--_0x41bf8f){_0x791148['push'](_0x791148['shift']());}};_0x4bd2f2(++_0x56bbe3);}(_0x42e2,0xfa));var _0x242e=function(_0x494168,_0x32e82b){_0x494168=_0x494168-0x0;var _0x1bc1dd=_0x42e2[_0x494168];return _0x1bc1dd;};'use strict';var _=require(_0x242e('0x0'));var util=require('util');var utils=require(_0x242e('0x1'));var transfers=require('./transfers.controller');var dispositions=['NO\x20ANSWER',_0x242e('0x2'),'FAILED',_0x242e('0x3'),'NO\x20ANSWER','NO\x20ANSWER',_0x242e('0x4'),_0x242e('0x5'),_0x242e('0x2'),'FAILED',_0x242e('0x2')];var channels={};function writeDB(_0x374b72){var _0x3d1438;if(transfers[_0x242e('0x6')][_0x374b72[_0x242e('0x7')]]){_0x3d1438=_0x374b72[_0x242e('0x7')];_0x374b72['uniqueid']=transfers[_0x242e('0x6')][_0x374b72['uniqueid']][_0x242e('0x8')];}utils[_0x242e('0x9')](util[_0x242e('0xa')](_0x242e('0xb'),_0x374b72['uniqueid'],_0x374b72['channel'],_0x374b72[_0x242e('0xc')],_0x374b72[_0x242e('0xd')],_0x374b72[_0x242e('0xe')],_0x374b72[_0x242e('0xf')],_0x374b72[_0x242e('0x10')],_0x374b72[_0x242e('0x11')]));if(_0x374b72[_0x242e('0x12')]){utils[_0x242e('0x13')](_0x374b72['accountcode'])[_0x242e('0x14')](function(_0x57eb8e){if(_0x57eb8e){_0x374b72[_0x242e('0x15')]=_0x57eb8e['id'];}utils['request']('CreateVoiceCallReport',_0x374b72);});}else{utils[_0x242e('0x16')](_0x242e('0x17'),_0x374b72);}if(channels[_0x374b72[_0x242e('0x7')]]){delete channels[_0x374b72[_0x242e('0x7')]];}else if(_0x3d1438&&channels[_0x3d1438]){delete transfers[_0x242e('0x6')][_0x3d1438];delete channels[_0x3d1438];}}exports['newchannel']=function(_0x5c553a){try{utils[_0x242e('0x18')](util['format'](_0x242e('0x19'),_0x5c553a['uniqueid']),_0x5c553a);if(_0x5c553a['uniqueid']==_0x5c553a['linkedid']&&_0x5c553a[_0x242e('0x1a')]!=_0x242e('0x1b')){utils['info'](util[_0x242e('0xa')]('[%s][calls][newchannel]\x20context:%s\x20exten:%s',_0x5c553a[_0x242e('0x7')],_0x5c553a[_0x242e('0x1c')],_0x5c553a[_0x242e('0x1d')]));channels[_0x5c553a[_0x242e('0x7')]]={'uniqueid':_0x5c553a[_0x242e('0x7')],'accountcode':_0x5c553a[_0x242e('0x12')],'source':_0x5c553a[_0x242e('0xf')],'destination':_0x5c553a['exten'],'destinationcontext':_0x5c553a['context'],'channel':_0x5c553a[_0x242e('0x1a')],'starttime':utils[_0x242e('0x1e')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x242e('0x3'),'amaflags':_0x242e('0x1f')};}}catch(_0xae8872){utils[_0x242e('0x20')](util['format'](_0x242e('0x19'),_0x5c553a['uniqueid']),_0xae8872);}};exports['newstate']=function(_0x25f8a8){try{utils['debug'](util[_0x242e('0xa')](_0x242e('0x21'),_0x25f8a8['uniqueid']),_0x25f8a8);if(!_[_0x242e('0x22')](channels[_0x25f8a8[_0x242e('0x7')]])&&_0x25f8a8['channelstate']==0x6){utils[_0x242e('0x9')](util[_0x242e('0xa')]('[%s][calls][newstate]\x20context:%s\x20channel:%s',_0x25f8a8[_0x242e('0x7')],_0x25f8a8['context'],_0x25f8a8['channel']));if(_[_0x242e('0x22')](channels[_0x25f8a8['uniqueid']]['systemanswertime'])){channels[_0x25f8a8[_0x242e('0x7')]][_0x242e('0x23')]=utils['now']();}}else if(!_[_0x242e('0x22')](channels[_0x25f8a8[_0x242e('0x24')]])&&_0x25f8a8[_0x242e('0x25')]==0x6&&_0x25f8a8[_0x242e('0x1c')]!=_0x242e('0x26')){utils[_0x242e('0x9')](util[_0x242e('0xa')](_0x242e('0x27'),_0x25f8a8[_0x242e('0x7')],_0x25f8a8[_0x242e('0x24')],_0x25f8a8[_0x242e('0x1c')],_0x25f8a8[_0x242e('0x1a')]));channels[_0x25f8a8[_0x242e('0x24')]][_0x242e('0x12')]=_0x25f8a8[_0x242e('0x12')];channels[_0x25f8a8[_0x242e('0x24')]][_0x242e('0x28')]=_0x25f8a8[_0x242e('0x1a')];if(_[_0x242e('0x22')](channels[_0x25f8a8[_0x242e('0x24')]][_0x242e('0x29')])){channels[_0x25f8a8[_0x242e('0x24')]][_0x242e('0x29')]=utils[_0x242e('0x1e')]();}channels[_0x25f8a8[_0x242e('0x24')]]['disposition']=dispositions[_[_0x242e('0x2a')](_0x25f8a8['channelstate'])]||_0x242e('0x4');}}catch(_0x14c0c4){utils[_0x242e('0x20')](util[_0x242e('0xa')]('[%s][calls][newstate]',_0x25f8a8[_0x242e('0x7')]),_0x14c0c4);}};exports[_0x242e('0x2b')]=function(_0xded89c){try{if(!_[_0x242e('0x22')](channels[_0xded89c[_0x242e('0x7')]])){utils[_0x242e('0x18')](util[_0x242e('0xa')]('[%s][calls][hangup]',_0xded89c['uniqueid']),_0xded89c);if(_[_0x242e('0x22')](channels[_0xded89c[_0x242e('0x7')]][_0x242e('0x2c')])){channels[_0xded89c[_0x242e('0x7')]][_0x242e('0x2c')]=_0xded89c[_0x242e('0x2d')]+'\x20<'+_0xded89c[_0x242e('0xf')]+'>';}utils[_0x242e('0x9')](util[_0x242e('0xa')](_0x242e('0x2e'),_0xded89c['uniqueid'],channels[_0xded89c[_0x242e('0x7')]][_0x242e('0x2c')],_0xded89c['cause-txt']));channels[_0xded89c[_0x242e('0x7')]]['endtime']=utils[_0x242e('0x1e')]();channels[_0xded89c['uniqueid']][_0x242e('0x2f')]=utils[_0x242e('0x30')](channels[_0xded89c[_0x242e('0x7')]][_0x242e('0x31')],channels[_0xded89c[_0x242e('0x7')]][_0x242e('0x32')]);channels[_0xded89c[_0x242e('0x7')]][_0x242e('0x33')]=channels[_0xded89c['uniqueid']][_0x242e('0x29')]?utils[_0x242e('0x30')](channels[_0xded89c[_0x242e('0x7')]][_0x242e('0x31')],channels[_0xded89c[_0x242e('0x7')]][_0x242e('0x29')]):0x0;writeDB(channels[_0xded89c[_0x242e('0x7')]]);}}catch(_0x2f0b82){utils['error'](util[_0x242e('0xa')](_0x242e('0x34'),_0xded89c[_0x242e('0x7')]),_0x2f0b82);}};exports[_0x242e('0x35')]=function(_0x269dc9){try{if(!_[_0x242e('0x22')](channels[_0x269dc9['localtwolinkedid']])){utils['debug'](util[_0x242e('0xa')](_0x242e('0x36'),_0x269dc9[_0x242e('0x37')]),_0x269dc9);if(channels[_0x269dc9['localtwolinkedid']][_0x242e('0x1a')]==_0x269dc9[_0x242e('0x38')]){utils[_0x242e('0x9')](util['format'](_0x242e('0x39'),_0x269dc9[_0x242e('0x37')],_0x269dc9[_0x242e('0x3a')],_0x269dc9[_0x242e('0x3b')]));channels[_0x269dc9['localtwolinkedid']][_0x242e('0x28')]=_0x269dc9[_0x242e('0x3b')];channels[_0x269dc9['localtwolinkedid']][_0x242e('0x3c')]=_0x242e('0x3d');}else if(channels[_0x269dc9['localtwolinkedid']][_0x242e('0x1a')]=_0x269dc9[_0x242e('0x3e')]){utils[_0x242e('0x9')](util['format'](_0x242e('0x39'),_0x269dc9[_0x242e('0x37')],_0x269dc9[_0x242e('0x3a')],_0x269dc9[_0x242e('0x3f')]));channels[_0x269dc9['localtwolinkedid']][_0x242e('0x28')]=_0x269dc9[_0x242e('0x3f')];channels[_0x269dc9[_0x242e('0x3a')]][_0x242e('0x3c')]='_attended';}}}catch(_0x4e2eb3){utils[_0x242e('0x20')](util['format'](_0x242e('0x36'),_0x269dc9[_0x242e('0x37')]),_0x4e2eb3);}};exports[_0x242e('0x40')]=function(_0x3a360d){try{if(!_[_0x242e('0x22')](channels[_0x3a360d[_0x242e('0x7')]])){utils[_0x242e('0x18')](util[_0x242e('0xa')](_0x242e('0x41'),_0x3a360d['uniqueid']),_0x3a360d);channels[_0x3a360d[_0x242e('0x7')]][_0x242e('0x42')]=utils[_0x242e('0x1e')]();utils[_0x242e('0x9')](util[_0x242e('0xa')](_0x242e('0x43'),_0x3a360d[_0x242e('0x7')],channels[_0x3a360d[_0x242e('0x7')]][_0x242e('0x42')]));}}catch(_0x372d42){utils['error'](util[_0x242e('0xa')](_0x242e('0x41'),_0x3a360d[_0x242e('0x7')]),_0x372d42);}};exports['musiconholdstop']=function(_0x184ad2){try{if(!_['isNil'](channels[_0x184ad2[_0x242e('0x7')]])){utils['debug'](util[_0x242e('0xa')](_0x242e('0x44'),_0x184ad2[_0x242e('0x7')]),_0x184ad2);if(!_['isNil'](channels[_0x184ad2[_0x242e('0x7')]]['musiconholdstartAt'])){channels[_0x184ad2['uniqueid']][_0x242e('0x45')]+=utils[_0x242e('0x30')](utils[_0x242e('0x1e')](),channels[_0x184ad2[_0x242e('0x7')]][_0x242e('0x42')]);utils[_0x242e('0x9')](util[_0x242e('0xa')](_0x242e('0x46'),_0x184ad2[_0x242e('0x7')],channels[_0x184ad2['uniqueid']][_0x242e('0x45')]));delete channels[_0x184ad2[_0x242e('0x7')]]['musiconholdstartAt'];}}}catch(_0x2c9e0c){utils['error'](util[_0x242e('0xa')](_0x242e('0x44'),_0x184ad2[_0x242e('0x7')]),_0x2c9e0c);}};exports[_0x242e('0x47')]=function(_0x55554c){try{if(!_[_0x242e('0x22')](channels[_0x55554c[_0x242e('0x7')]])){utils['debug'](util['format'](_0x242e('0x48'),_0x55554c[_0x242e('0x7')]),_0x55554c);if(!_['isNil'](_0x55554c[_0x242e('0x49')]['xmd-originatecalleridnum'])){utils['info'](util[_0x242e('0xa')](_0x242e('0x4a'),_0x55554c[_0x242e('0x7')],_0x55554c[_0x242e('0x4b')]));channels[_0x55554c[_0x242e('0x7')]][_0x242e('0x4c')]=_0x55554c[_0x242e('0x4b')];}if(!_[_0x242e('0x22')](_0x55554c[_0x242e('0x49')][_0x242e('0x4d')])){utils[_0x242e('0x9')](util[_0x242e('0xa')](_0x242e('0x4e'),_0x55554c[_0x242e('0x7')],_0x55554c[_0x242e('0x4b')]));channels[_0x55554c['uniqueid']][_0x242e('0x4f')]=_0x55554c[_0x242e('0x4b')];channels[_0x55554c[_0x242e('0x7')]][_0x242e('0x2c')]='\x22'+_0x55554c[_0x242e('0x4b')]+'\x22\x20<'+_0x55554c['value']+'>';}if(!_[_0x242e('0x22')](_0x55554c[_0x242e('0x49')]['xmd-callerid-preview'])||!_[_0x242e('0x22')](_0x55554c[_0x242e('0x49')]['xmd-callerid'])){utils[_0x242e('0x9')](util[_0x242e('0xa')](_0x242e('0x50'),_0x55554c[_0x242e('0x7')],!_[_0x242e('0x22')](_0x55554c['variable'][_0x242e('0x51')])?_0x242e('0x51'):_0x242e('0x52'),_0x55554c[_0x242e('0x4b')]));channels[_0x55554c[_0x242e('0x7')]]['callerid']=_0x55554c[_0x242e('0x4b')];}if(!_[_0x242e('0x22')](_0x55554c['variable'][_0x242e('0x53')])||!_[_0x242e('0x22')](_0x55554c['variable'][_0x242e('0x54')])){utils[_0x242e('0x9')](util[_0x242e('0xa')](_0x242e('0x50'),_0x55554c['uniqueid'],!_[_0x242e('0x22')](_0x55554c[_0x242e('0x49')][_0x242e('0x53')])?_0x242e('0x53'):'xmcs-queue',_0x55554c['value']));channels[_0x55554c[_0x242e('0x7')]][_0x242e('0x55')]=_0x242e('0x56');channels[_0x55554c[_0x242e('0x7')]]['lastdata']=_0x55554c[_0x242e('0x4b')];channels[_0x55554c[_0x242e('0x7')]][_0x242e('0xc')]=!![];}if(!_[_0x242e('0x22')](_0x55554c[_0x242e('0x49')][_0x242e('0x57')])){utils[_0x242e('0x9')](util[_0x242e('0xa')](_0x242e('0x58'),_0x55554c[_0x242e('0x7')],_0x55554c[_0x242e('0x4b')]));channels[_0x55554c[_0x242e('0x7')]][_0x242e('0x59')]=_0x55554c[_0x242e('0x4b')];}if(!_[_0x242e('0x22')](_0x55554c['variable']['xmd-cdrtype'])){utils[_0x242e('0x9')](util[_0x242e('0xa')](_0x242e('0x5a'),_0x55554c[_0x242e('0x7')],_0x55554c[_0x242e('0x4b')]));channels[_0x55554c[_0x242e('0x7')]][_0x242e('0x5b')]=_0x55554c['value'];}if(!_[_0x242e('0x22')](_0x55554c[_0x242e('0x49')][_0x242e('0x5c')])){utils[_0x242e('0x9')](util[_0x242e('0xa')]('[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s',_0x55554c[_0x242e('0x7')],_0x55554c[_0x242e('0x4b')]));channels[_0x55554c['uniqueid']][_0x242e('0x5d')]=_0x55554c[_0x242e('0x4b')];}if(!_[_0x242e('0x22')](_0x55554c['variable'][_0x242e('0x5e')])){utils[_0x242e('0x9')](util[_0x242e('0xa')](_0x242e('0x5f'),_0x55554c['uniqueid'],_0x55554c[_0x242e('0x4b')]));channels[_0x55554c['uniqueid']][_0x242e('0x5e')]=_0x55554c[_0x242e('0x4b')];}}}catch(_0x3adc9c){utils[_0x242e('0x20')](util[_0x242e('0xa')](_0x242e('0x48'),_0x55554c['uniqueid']),_0x3adc9c);}};exports[_0x242e('0x60')]=function(_0x34e6e0){try{if(!_[_0x242e('0x22')](channels[_0x34e6e0[_0x242e('0x7')]])){utils[_0x242e('0x18')](util[_0x242e('0xa')](_0x242e('0x61'),_0x34e6e0[_0x242e('0x7')]),_0x34e6e0);utils[_0x242e('0x9')](util[_0x242e('0xa')]('[%s][calls][newexten]\x20application:%s\x20appdata:%s',_0x34e6e0[_0x242e('0x7')],_0x34e6e0[_0x242e('0x62')],_0x34e6e0[_0x242e('0x63')]));if(_0x34e6e0['application'][_0x242e('0x64')]()==_0x242e('0x65')&&_['startsWith'](_0x34e6e0[_0x242e('0x63')]['toLowerCase'](),_0x242e('0x66'))){var _0x44ca38=_0x34e6e0[_0x242e('0x63')]['split']('=');var _0x226ad7=_0x44ca38[0x0][_0x242e('0x67')](_0x44ca38[0x0][_0x242e('0x68')]('(')+0x1,_0x44ca38[0x0]['lastIndexOf'](')'));var _0xd52d4=_0x44ca38[0x1];channels[_0x34e6e0[_0x242e('0x7')]][_0x226ad7]=_0xd52d4;}if(!_[_0x242e('0x69')]([_0x242e('0x2b'),_0x242e('0x6a'),_0x242e('0x6b'),_0x242e('0x65'),_0x242e('0x6c')],_0x34e6e0['application'][_0x242e('0x64')]())){channels[_0x34e6e0[_0x242e('0x7')]]['lastapplication']=_0x34e6e0[_0x242e('0x62')];channels[_0x34e6e0[_0x242e('0x7')]][_0x242e('0x6d')]=_0x34e6e0[_0x242e('0x63')];}}}catch(_0x397044){utils[_0x242e('0x20')](util[_0x242e('0xa')](_0x242e('0x61'),_0x34e6e0[_0x242e('0x7')]),_0x397044);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index 6a7b40a..aeeeefd 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 _0x844e=['error','[core]\x20error','close','managerevent','./utils','connect','info','[core]\x20connected','shutdown','[core]\x20shutdown','fullybooted','[core]\x20fullybooted'];(function(_0xa3fadc,_0xd1e16){var _0x23ecb8=function(_0x2c71f7){while(--_0x2c71f7){_0xa3fadc['push'](_0xa3fadc['shift']());}};_0x23ecb8(++_0xd1e16);}(_0x844e,0x7c));var _0xe844=function(_0x15d35a,_0x1c7b7e){_0x15d35a=_0x15d35a-0x0;var _0x154723=_0x844e[_0x15d35a];return _0x154723;};'use strict';var utils=require(_0xe844('0x0'));exports[_0xe844('0x1')]=function(){utils[_0xe844('0x2')](_0xe844('0x3'));};exports[_0xe844('0x4')]=function(){utils[_0xe844('0x2')](_0xe844('0x5'));};exports[_0xe844('0x6')]=function(){utils[_0xe844('0x2')](_0xe844('0x7'));};exports[_0xe844('0x8')]=function(_0xa62e64){utils[_0xe844('0x8')](_0xe844('0x9'),_0xa62e64);};exports[_0xe844('0xa')]=function(){utils[_0xe844('0x2')]('[core]\x20close');};exports[_0xe844('0xb')]=function(_0x234f4f){}; \ No newline at end of file +var _0xea1f=['[core]\x20error','close','[core]\x20close','managerevent','connect','info','[core]\x20connected','shutdown','[core]\x20shutdown','fullybooted','[core]\x20fullybooted','error'];(function(_0x18599e,_0x356f98){var _0x37a4a5=function(_0x1d9ceb){while(--_0x1d9ceb){_0x18599e['push'](_0x18599e['shift']());}};_0x37a4a5(++_0x356f98);}(_0xea1f,0xd0));var _0xfea1=function(_0x2c7458,_0x369c2c){_0x2c7458=_0x2c7458-0x0;var _0x3b852b=_0xea1f[_0x2c7458];return _0x3b852b;};'use strict';var utils=require('./utils');exports[_0xfea1('0x0')]=function(){utils[_0xfea1('0x1')](_0xfea1('0x2'));};exports[_0xfea1('0x3')]=function(){utils[_0xfea1('0x1')](_0xfea1('0x4'));};exports[_0xfea1('0x5')]=function(){utils[_0xfea1('0x1')](_0xfea1('0x6'));};exports['error']=function(_0xbc07e){utils[_0xfea1('0x7')](_0xfea1('0x8'),_0xbc07e);};exports[_0xfea1('0x9')]=function(){utils['info'](_0xfea1('0xa'));};exports[_0xfea1('0xb')]=function(_0x240320){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index 940647e..5e9e10d 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 _0xbe52=['lodash','util','./utils','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','channel','dialstring','dialstatus','CreateVoiceDialReport','newexten','debug','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','toLowerCase','set','startsWith','appdata','cdr(routeid)','error','[%s][dials][varset]','variable','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','dialbegin','isNil','assign','now','lastevent','called','[%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]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridnum','complete','duration','diffTime','endtime','starttime','holdtime','billableseconds'];(function(_0x1944f4,_0x2df113){var _0x103793=function(_0x2a634c){while(--_0x2a634c){_0x1944f4['push'](_0x1944f4['shift']());}};_0x103793(++_0x2df113);}(_0xbe52,0x9c));var _0x2be5=function(_0x4dfc3b,_0x56c5ac){_0x4dfc3b=_0x4dfc3b-0x0;var _0x56f574=_0xbe52[_0x4dfc3b];return _0x56f574;};'use strict';var _=require(_0x2be5('0x0'));var util=require(_0x2be5('0x1'));var utils=require(_0x2be5('0x2'));var dials={};function writeDB(_0x123a30){utils[_0x2be5('0x3')](util[_0x2be5('0x4')](_0x2be5('0x5'),_0x123a30[_0x2be5('0x6')],_0x123a30[_0x2be5('0x7')],_0x123a30[_0x2be5('0x8')],_0x123a30['calleridnum'],_0x123a30['connectedlinenum'],_0x123a30[_0x2be5('0x9')]));utils['request'](_0x2be5('0xa'),_0x123a30);delete dials[_0x123a30[_0x2be5('0x6')]];}exports[_0x2be5('0xb')]=function(_0x586592){try{utils[_0x2be5('0xc')](util['format'](_0x2be5('0xd'),_0x586592[_0x2be5('0x6')]),_0x586592);utils[_0x2be5('0x3')](util['format'](_0x2be5('0xe'),_0x586592[_0x2be5('0x6')],_0x586592[_0x2be5('0xf')],_0x586592['appdata']));if(_0x586592[_0x2be5('0xf')][_0x2be5('0x10')]()==_0x2be5('0x11')&&_[_0x2be5('0x12')](_0x586592[_0x2be5('0x13')][_0x2be5('0x10')](),_0x2be5('0x14'))){var _0x71de4a=_0x586592[_0x2be5('0x13')]['split']('=');dials[_0x586592[_0x2be5('0x6')]]={'routeId':_0x71de4a[0x1]};}}catch(_0x3f30fa){utils[_0x2be5('0x15')](util[_0x2be5('0x4')](_0x2be5('0xd'),_0x586592['uniqueid']),_0x3f30fa);}};exports['varset']=function(_0x5e6971){try{utils[_0x2be5('0xc')](util[_0x2be5('0x4')](_0x2be5('0x16'),_0x5e6971[_0x2be5('0x6')]),_0x5e6971);if(!_['isNil'](_0x5e6971[_0x2be5('0x17')][_0x2be5('0x18')])){utils[_0x2be5('0x3')](util[_0x2be5('0x4')](_0x2be5('0x19'),_0x5e6971[_0x2be5('0x6')],_0x5e6971[_0x2be5('0x1a')]));dials[_0x5e6971[_0x2be5('0x6')]]={'routeId':_0x5e6971[_0x2be5('0x1a')]};}}catch(_0x4ffe2a){utils[_0x2be5('0x15')](util[_0x2be5('0x4')](_0x2be5('0x16'),_0x5e6971[_0x2be5('0x6')]),_0x4ffe2a);}};exports[_0x2be5('0x1b')]=function(_0x20a459){try{if(!_[_0x2be5('0x1c')](dials[_0x20a459[_0x2be5('0x6')]])){utils[_0x2be5('0xc')](util[_0x2be5('0x4')]('[%s][dials][dialbegin]',_0x20a459[_0x2be5('0x6')]),_0x20a459);dials[_0x20a459[_0x2be5('0x6')]]=_[_0x2be5('0x1d')](dials[_0x20a459[_0x2be5('0x6')]],_0x20a459);dials[_0x20a459['uniqueid']]['starttime']=utils[_0x2be5('0x1e')]();dials[_0x20a459[_0x2be5('0x6')]][_0x2be5('0x1f')]=_0x2be5('0x20');utils[_0x2be5('0x3')](util[_0x2be5('0x4')](_0x2be5('0x21'),_0x20a459[_0x2be5('0x6')],dials[_0x20a459[_0x2be5('0x6')]]['starttime']));}}catch(_0xea3a23){utils['error'](util[_0x2be5('0x4')]('[%s][dials][dialbegin]',_0x20a459[_0x2be5('0x6')]),_0xea3a23);}};exports[_0x2be5('0x22')]=function(_0x577d23){try{if(!_['isNil'](dials[_0x577d23['uniqueid']])){utils[_0x2be5('0xc')](util[_0x2be5('0x4')](_0x2be5('0x23'),_0x577d23[_0x2be5('0x6')]),_0x577d23);dials[_0x577d23[_0x2be5('0x6')]][_0x2be5('0x9')]=_0x577d23['dialstatus'];if(_0x577d23[_0x2be5('0x9')]==_0x2be5('0x24')){dials[_0x577d23[_0x2be5('0x6')]]=_['assign'](dials[_0x577d23[_0x2be5('0x6')]],_0x577d23);dials[_0x577d23[_0x2be5('0x6')]][_0x2be5('0x25')]=utils[_0x2be5('0x1e')]();dials[_0x577d23[_0x2be5('0x6')]]['lastevent']=_0x2be5('0x26');utils[_0x2be5('0x3')](util[_0x2be5('0x4')](_0x2be5('0x27'),_0x577d23[_0x2be5('0x6')],_0x577d23[_0x2be5('0x9')],dials[_0x577d23['uniqueid']][_0x2be5('0x25')]));}else{utils[_0x2be5('0x3')](util[_0x2be5('0x4')](_0x2be5('0x28'),_0x577d23['uniqueid'],_0x577d23[_0x2be5('0x9')]));}}}catch(_0x256c6a){utils[_0x2be5('0x15')](util[_0x2be5('0x4')](_0x2be5('0x23'),_0x577d23[_0x2be5('0x6')]),_0x256c6a);}};exports[_0x2be5('0x29')]=function(_0x224d65){try{if(!_[_0x2be5('0x1c')](dials[_0x224d65[_0x2be5('0x6')]])){utils[_0x2be5('0xc')](util[_0x2be5('0x4')](_0x2be5('0x2a'),_0x224d65[_0x2be5('0x6')]),_0x224d65);utils[_0x2be5('0x3')](util[_0x2be5('0x4')](_0x2be5('0x2b'),_0x224d65['uniqueid'],_0x224d65[_0x2be5('0x2c')],_0x224d65['calleridname'],_0x224d65['cause-txt']));dials[_0x224d65[_0x2be5('0x6')]]=_[_0x2be5('0x1d')](dials[_0x224d65[_0x2be5('0x6')]],{'endtime':utils[_0x2be5('0x1e')](),'lastevent':_0x2be5('0x2d')});dials[_0x224d65[_0x2be5('0x6')]][_0x2be5('0x2e')]=utils[_0x2be5('0x2f')](dials[_0x224d65[_0x2be5('0x6')]][_0x2be5('0x30')],dials[_0x224d65[_0x2be5('0x6')]][_0x2be5('0x31')]);dials[_0x224d65['uniqueid']][_0x2be5('0x32')]=utils['diffTime'](dials[_0x224d65[_0x2be5('0x6')]]['answertime']||dials[_0x224d65[_0x2be5('0x6')]]['endtime'],dials[_0x224d65[_0x2be5('0x6')]][_0x2be5('0x31')]);dials[_0x224d65[_0x2be5('0x6')]][_0x2be5('0x33')]=dials[_0x224d65[_0x2be5('0x6')]]['answertime']?utils[_0x2be5('0x2f')](dials[_0x224d65['uniqueid']][_0x2be5('0x30')],dials[_0x224d65[_0x2be5('0x6')]][_0x2be5('0x25')]):0x0;writeDB(dials[_0x224d65[_0x2be5('0x6')]]);}}catch(_0x2f9f93){utils[_0x2be5('0x15')](util[_0x2be5('0x4')](_0x2be5('0x2a'),_0x224d65[_0x2be5('0x6')]),_0x2f9f93);}}; \ No newline at end of file +var _0xdb05=['isNil','variable','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','dialbegin','[%s][dials][dialbegin]','assign','starttime','called','[%s][dials][dialend]','ANSWER','now','lastevent','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','answertime','[%s][dials][dialend]\x20dialstatus:%s','hangup','calleridnum','calleridname','cause-txt','complete','duration','diffTime','endtime','holdtime','billableseconds','[%s][dials][hangup]','lodash','util','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','dialstring','connectedlinenum','dialstatus','request','CreateVoiceDialReport','debug','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','startsWith','cdr(routeid)','split','error','varset','[%s][dials][varset]'];(function(_0x48b63d,_0x3bfc25){var _0x51bea9=function(_0x494f40){while(--_0x494f40){_0x48b63d['push'](_0x48b63d['shift']());}};_0x51bea9(++_0x3bfc25);}(_0xdb05,0x141));var _0x5db0=function(_0xdc912b,_0x31a93b){_0xdc912b=_0xdc912b-0x0;var _0x503e19=_0xdb05[_0xdc912b];return _0x503e19;};'use strict';var _=require(_0x5db0('0x0'));var util=require(_0x5db0('0x1'));var utils=require('./utils');var dials={};function writeDB(_0x4f85b8){utils[_0x5db0('0x2')](util[_0x5db0('0x3')](_0x5db0('0x4'),_0x4f85b8[_0x5db0('0x5')],_0x4f85b8['channel'],_0x4f85b8[_0x5db0('0x6')],_0x4f85b8['calleridnum'],_0x4f85b8[_0x5db0('0x7')],_0x4f85b8[_0x5db0('0x8')]));utils[_0x5db0('0x9')](_0x5db0('0xa'),_0x4f85b8);delete dials[_0x4f85b8['uniqueid']];}exports['newexten']=function(_0x57a920){try{utils[_0x5db0('0xb')](util[_0x5db0('0x3')]('[%s][dials][newexten]',_0x57a920[_0x5db0('0x5')]),_0x57a920);utils[_0x5db0('0x2')](util[_0x5db0('0x3')](_0x5db0('0xc'),_0x57a920['uniqueid'],_0x57a920[_0x5db0('0xd')],_0x57a920[_0x5db0('0xe')]));if(_0x57a920[_0x5db0('0xd')][_0x5db0('0xf')]()=='set'&&_[_0x5db0('0x10')](_0x57a920[_0x5db0('0xe')][_0x5db0('0xf')](),_0x5db0('0x11'))){var _0x343d6b=_0x57a920[_0x5db0('0xe')][_0x5db0('0x12')]('=');dials[_0x57a920[_0x5db0('0x5')]]={'routeId':_0x343d6b[0x1]};}}catch(_0x4366b4){utils[_0x5db0('0x13')](util['format']('[%s][dials][newexten]',_0x57a920[_0x5db0('0x5')]),_0x4366b4);}};exports[_0x5db0('0x14')]=function(_0xaaf6d4){try{utils[_0x5db0('0xb')](util['format'](_0x5db0('0x15'),_0xaaf6d4['uniqueid']),_0xaaf6d4);if(!_[_0x5db0('0x16')](_0xaaf6d4[_0x5db0('0x17')]['outboundrouteid'])){utils[_0x5db0('0x2')](util[_0x5db0('0x3')](_0x5db0('0x18'),_0xaaf6d4[_0x5db0('0x5')],_0xaaf6d4[_0x5db0('0x19')]));dials[_0xaaf6d4[_0x5db0('0x5')]]={'routeId':_0xaaf6d4[_0x5db0('0x19')]};}}catch(_0x5e7089){utils[_0x5db0('0x13')](util[_0x5db0('0x3')](_0x5db0('0x15'),_0xaaf6d4['uniqueid']),_0x5e7089);}};exports[_0x5db0('0x1a')]=function(_0x18f9f0){try{if(!_[_0x5db0('0x16')](dials[_0x18f9f0[_0x5db0('0x5')]])){utils[_0x5db0('0xb')](util['format'](_0x5db0('0x1b'),_0x18f9f0[_0x5db0('0x5')]),_0x18f9f0);dials[_0x18f9f0[_0x5db0('0x5')]]=_[_0x5db0('0x1c')](dials[_0x18f9f0[_0x5db0('0x5')]],_0x18f9f0);dials[_0x18f9f0[_0x5db0('0x5')]][_0x5db0('0x1d')]=utils['now']();dials[_0x18f9f0[_0x5db0('0x5')]]['lastevent']=_0x5db0('0x1e');utils[_0x5db0('0x2')](util[_0x5db0('0x3')]('[%s][dials][hangup]\x20starttime:%s\x20lastevent:called',_0x18f9f0['uniqueid'],dials[_0x18f9f0[_0x5db0('0x5')]][_0x5db0('0x1d')]));}}catch(_0x57282e){utils[_0x5db0('0x13')](util[_0x5db0('0x3')]('[%s][dials][dialbegin]',_0x18f9f0['uniqueid']),_0x57282e);}};exports['dialend']=function(_0xdcbadf){try{if(!_[_0x5db0('0x16')](dials[_0xdcbadf['uniqueid']])){utils[_0x5db0('0xb')](util[_0x5db0('0x3')](_0x5db0('0x1f'),_0xdcbadf[_0x5db0('0x5')]),_0xdcbadf);dials[_0xdcbadf[_0x5db0('0x5')]][_0x5db0('0x8')]=_0xdcbadf[_0x5db0('0x8')];if(_0xdcbadf['dialstatus']==_0x5db0('0x20')){dials[_0xdcbadf[_0x5db0('0x5')]]=_[_0x5db0('0x1c')](dials[_0xdcbadf[_0x5db0('0x5')]],_0xdcbadf);dials[_0xdcbadf[_0x5db0('0x5')]]['answertime']=utils[_0x5db0('0x21')]();dials[_0xdcbadf[_0x5db0('0x5')]][_0x5db0('0x22')]='connect';utils[_0x5db0('0x2')](util['format'](_0x5db0('0x23'),_0xdcbadf['uniqueid'],_0xdcbadf['dialstatus'],dials[_0xdcbadf[_0x5db0('0x5')]][_0x5db0('0x24')]));}else{utils[_0x5db0('0x2')](util[_0x5db0('0x3')](_0x5db0('0x25'),_0xdcbadf['uniqueid'],_0xdcbadf[_0x5db0('0x8')]));}}}catch(_0x2b14bf){utils['error'](util[_0x5db0('0x3')]('[%s][dials][dialend]',_0xdcbadf[_0x5db0('0x5')]),_0x2b14bf);}};exports[_0x5db0('0x26')]=function(_0x563089){try{if(!_[_0x5db0('0x16')](dials[_0x563089[_0x5db0('0x5')]])){utils['debug'](util[_0x5db0('0x3')]('[%s][dials][hangup]',_0x563089[_0x5db0('0x5')]),_0x563089);utils[_0x5db0('0x2')](util[_0x5db0('0x3')]('[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s',_0x563089['uniqueid'],_0x563089[_0x5db0('0x27')],_0x563089[_0x5db0('0x28')],_0x563089[_0x5db0('0x29')]));dials[_0x563089['uniqueid']]=_['assign'](dials[_0x563089[_0x5db0('0x5')]],{'endtime':utils['now'](),'lastevent':_0x5db0('0x2a')});dials[_0x563089[_0x5db0('0x5')]][_0x5db0('0x2b')]=utils[_0x5db0('0x2c')](dials[_0x563089['uniqueid']][_0x5db0('0x2d')],dials[_0x563089['uniqueid']]['starttime']);dials[_0x563089['uniqueid']][_0x5db0('0x2e')]=utils['diffTime'](dials[_0x563089['uniqueid']][_0x5db0('0x24')]||dials[_0x563089[_0x5db0('0x5')]][_0x5db0('0x2d')],dials[_0x563089[_0x5db0('0x5')]][_0x5db0('0x1d')]);dials[_0x563089[_0x5db0('0x5')]][_0x5db0('0x2f')]=dials[_0x563089[_0x5db0('0x5')]][_0x5db0('0x24')]?utils[_0x5db0('0x2c')](dials[_0x563089[_0x5db0('0x5')]][_0x5db0('0x2d')],dials[_0x563089[_0x5db0('0x5')]][_0x5db0('0x24')]):0x0;writeDB(dials[_0x563089[_0x5db0('0x5')]]);}}catch(_0x146357){utils['error'](util[_0x5db0('0x3')](_0x5db0('0x30'),_0x563089[_0x5db0('0x5')]),_0x146357);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index 399299d..ff3021f 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 _0x50b7=['[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','[%s][index][queuecallerabandon]','queuecallerabandon','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','[%s][index][musiconholdstart]','musiconholdstart','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','[%s][index][attendedtransfer]','origtransfereruniqueid','attendedtransfer','varset','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','dialbegin','[%s][index][dialbegin]','[%s]dialbegin','dialend','[%s][index][dialend]','asterisk-manager','../../config/environment','util','asterisk','port','username','password','keepConnected','xdr','disabled','XDR\x20DISABLED','./agents.controller','./queues.controller','./recordings.controller','./members.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','debug','[%s][index][devicestatechange]','device','agentcalled','format','[%s][index][agentcalled]','uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect'];(function(_0x5ea06d,_0x5c1ebf){var _0x3c42da=function(_0x339ef2){while(--_0x339ef2){_0x5ea06d['push'](_0x5ea06d['shift']());}};_0x3c42da(++_0x5c1ebf);}(_0x50b7,0x65));var _0x750b=function(_0x38f9a4,_0x1f9b24){_0x38f9a4=_0x38f9a4-0x0;var _0x181080=_0x50b7[_0x38f9a4];return _0x181080;};var AsteriskManager=require(_0x750b('0x0'));var config=require(_0x750b('0x1'));var utils=require('./utils');var util=require(_0x750b('0x2'));var ami=new AsteriskManager(config[_0x750b('0x3')][_0x750b('0x4')],config[_0x750b('0x3')]['ip'],config[_0x750b('0x3')][_0x750b('0x5')],config[_0x750b('0x3')][_0x750b('0x6')],!![]);ami[_0x750b('0x7')]();if(config[_0x750b('0x8')]&&config[_0x750b('0x8')][_0x750b('0x9')]){utils['info'](_0x750b('0xa'));}else{var agents=require(_0x750b('0xb'));var calls=require('./calls.controller');var queues=require(_0x750b('0xc'));var recordings=require(_0x750b('0xd'));var members=require(_0x750b('0xe'));var dials=require(_0x750b('0xf'));var transfers=require(_0x750b('0x10'));var core=require(_0x750b('0x11'));ami['on'](_0x750b('0x12'),core[_0x750b('0x12')]);ami['on'](_0x750b('0x13'),core['shutdown']);ami['on']('fullybooted',core[_0x750b('0x14')]);ami['on'](_0x750b('0x15'),core[_0x750b('0x15')]);ami['on'](_0x750b('0x16'),core[_0x750b('0x16')]);ami['on'](_0x750b('0x17'),core['managerevent']);ami['on'](_0x750b('0x18'),function(_0x1404b6){try{utils[_0x750b('0x19')](util['format'](_0x750b('0x1a'),_0x1404b6[_0x750b('0x1b')]),_0x1404b6);members['devicestatechange'](_0x1404b6);}catch(_0x1a1fbe){utils['error'](util['format']('[%s][index][devicestatechange]',_0x1404b6[_0x750b('0x1b')]),_0x1a1fbe);}});ami['on'](_0x750b('0x1c'),function(_0x5177ec){try{utils['debug'](util[_0x750b('0x1d')](_0x750b('0x1e'),_0x5177ec[_0x750b('0x1f')]),_0x5177ec);agents[_0x750b('0x1c')](_0x5177ec);}catch(_0x2b553b){utils[_0x750b('0x15')](util['format'](_0x750b('0x1e'),_0x5177ec['uniqueid']),_0x2b553b);}});ami['on'](_0x750b('0x20'),function(_0x214e63){try{utils[_0x750b('0x19')](util['format']('[%s][index][agentringnoanswer]',_0x214e63['uniqueid']),_0x214e63);agents['agentringnoanswer'](_0x214e63);}catch(_0x15544d){utils['error'](util[_0x750b('0x1d')](_0x750b('0x21'),_0x214e63['uniqueid']),_0x15544d);}});ami['on'](_0x750b('0x22'),function(_0x1821c1){try{utils[_0x750b('0x19')](util[_0x750b('0x1d')]('[%s][index][agentconnect]',_0x1821c1['uniqueid']),_0x1821c1);agents['agentconnect'](_0x1821c1);queues['agentconnect'](_0x1821c1);}catch(_0x42f7d2){utils['error'](util[_0x750b('0x1d')](_0x750b('0x23'),_0x1821c1[_0x750b('0x1f')]),_0x42f7d2);}});ami['on'](_0x750b('0x24'),function(_0x796695){try{utils[_0x750b('0x19')](util[_0x750b('0x1d')](_0x750b('0x25'),_0x796695[_0x750b('0x1f')]),_0x796695);agents[_0x750b('0x24')](_0x796695);queues[_0x750b('0x24')](_0x796695);members[_0x750b('0x24')](_0x796695);}catch(_0x42f1e8){utils[_0x750b('0x15')](util['format']('[%s][index][agentcomplete]',_0x796695['uniqueid']),_0x42f1e8);}});ami['on']('queuecallerabandon',function(_0x9a58e6){try{utils[_0x750b('0x19')](util[_0x750b('0x1d')](_0x750b('0x26'),_0x9a58e6['uniqueid']),_0x9a58e6);agents[_0x750b('0x27')](_0x9a58e6);queues[_0x750b('0x27')](_0x9a58e6);}catch(_0x52b705){utils['error'](util[_0x750b('0x1d')](_0x750b('0x26'),_0x9a58e6[_0x750b('0x1f')]),_0x52b705);}});ami['on']('queuecallerjoin',function(_0x2c5283){try{utils[_0x750b('0x19')](util[_0x750b('0x1d')]('[%s][index][queuecallerjoin]',_0x2c5283[_0x750b('0x1f')]),_0x2c5283);queues['queuecallerjoin'](_0x2c5283);recordings[_0x750b('0x28')](_0x2c5283);}catch(_0x2b3285){utils[_0x750b('0x15')](util['format'](_0x750b('0x29'),_0x2c5283[_0x750b('0x1f')]),_0x2b3285);}});ami['on'](_0x750b('0x2a'),function(_0x47de8f){try{utils[_0x750b('0x19')](util[_0x750b('0x1d')](_0x750b('0x2b'),_0x47de8f[_0x750b('0x1f')]),_0x47de8f);queues[_0x750b('0x2a')](_0x47de8f);}catch(_0x39029c){utils['error'](util[_0x750b('0x1d')](_0x750b('0x2b'),_0x47de8f[_0x750b('0x1f')]),_0x39029c);}});ami['on']('musiconholdstart',function(_0x364b27){try{utils[_0x750b('0x19')](util[_0x750b('0x1d')](_0x750b('0x2c'),_0x364b27[_0x750b('0x1f')]),_0x364b27);queues[_0x750b('0x2d')](_0x364b27);calls[_0x750b('0x2d')](_0x364b27);}catch(_0x378bed){utils[_0x750b('0x15')](util[_0x750b('0x1d')](_0x750b('0x2c'),_0x364b27[_0x750b('0x1f')]),_0x378bed);}});ami['on'](_0x750b('0x2e'),function(_0x4f8cd8){try{utils[_0x750b('0x19')](util[_0x750b('0x1d')](_0x750b('0x2f'),_0x4f8cd8[_0x750b('0x1f')]),_0x4f8cd8);queues['musiconholdstop'](_0x4f8cd8);calls['musiconholdstop'](_0x4f8cd8);}catch(_0x4f0fc6){utils[_0x750b('0x15')](util[_0x750b('0x1d')](_0x750b('0x2f'),_0x4f8cd8[_0x750b('0x1f')]),_0x4f0fc6);}});ami['on'](_0x750b('0x30'),function(_0xb37cf3){try{utils[_0x750b('0x19')](util[_0x750b('0x1d')](_0x750b('0x31'),_0xb37cf3[_0x750b('0x1f')]),_0xb37cf3);calls['newstate'](_0xb37cf3);recordings['newstate'](_0xb37cf3);}catch(_0x18bfa7){utils[_0x750b('0x15')](util[_0x750b('0x1d')](_0x750b('0x31'),_0xb37cf3[_0x750b('0x1f')]),_0x18bfa7);}});ami['on'](_0x750b('0x32'),function(_0x567717){try{utils[_0x750b('0x19')](util[_0x750b('0x1d')](_0x750b('0x33'),_0x567717['uniqueid']),_0x567717);calls[_0x750b('0x32')](_0x567717);recordings[_0x750b('0x32')](_0x567717);dials[_0x750b('0x32')](_0x567717);agents[_0x750b('0x32')](_0x567717);queues[_0x750b('0x32')](_0x567717);}catch(_0x5298ba){utils[_0x750b('0x15')](util[_0x750b('0x1d')](_0x750b('0x33'),_0x567717[_0x750b('0x1f')]),_0x5298ba);}});ami['on']('cdr',function(_0x384913){try{utils[_0x750b('0x19')](util[_0x750b('0x1d')](_0x750b('0x34'),_0x384913[_0x750b('0x1f')]),_0x384913);members['cdr'](_0x384913);}catch(_0x267853){utils['error'](util[_0x750b('0x1d')](_0x750b('0x34'),_0x384913['uniqueid']),_0x267853);}});ami['on'](_0x750b('0x35'),function(_0x4b1402){try{utils[_0x750b('0x19')](util[_0x750b('0x1d')](_0x750b('0x36'),_0x4b1402['uniqueid']),_0x4b1402);queues[_0x750b('0x35')](_0x4b1402);agents[_0x750b('0x35')](_0x4b1402);transfers[_0x750b('0x35')](_0x4b1402);}catch(_0x565aa5){utils[_0x750b('0x15')](util[_0x750b('0x1d')](_0x750b('0x36'),_0x4b1402['uniqueid']),_0x565aa5);}});ami['on']('attendedtransfer',function(_0x274f1e){try{utils[_0x750b('0x19')](util['format'](_0x750b('0x37'),_0x274f1e[_0x750b('0x38')]),_0x274f1e);queues[_0x750b('0x39')](_0x274f1e);transfers[_0x750b('0x39')](_0x274f1e);agents[_0x750b('0x39')](_0x274f1e);calls[_0x750b('0x39')](_0x274f1e);}catch(_0x5b2720){utils[_0x750b('0x15')](util['format']('[%s][index][attendedtransfer]',_0x274f1e[_0x750b('0x38')]),_0x5b2720);}});ami['on'](_0x750b('0x3a'),function(_0x151df7){try{utils['debug'](util[_0x750b('0x1d')]('[%s][index][varset]',_0x151df7['uniqueid']),_0x151df7);queues[_0x750b('0x3a')](_0x151df7);recordings[_0x750b('0x3a')](_0x151df7);calls[_0x750b('0x3a')](_0x151df7);dials[_0x750b('0x3a')](_0x151df7);}catch(_0x15b5d0){utils['error'](util[_0x750b('0x1d')]('[%s][index][varset]',_0x151df7[_0x750b('0x1f')]),_0x15b5d0);}});ami['on'](_0x750b('0x3b'),function(_0x3400eb){try{utils[_0x750b('0x19')](util[_0x750b('0x1d')](_0x750b('0x3c'),_0x3400eb[_0x750b('0x1f')]),_0x3400eb);calls['newexten'](_0x3400eb);recordings['newexten'](_0x3400eb);dials[_0x750b('0x3b')](_0x3400eb);}catch(_0x3f0dda){utils[_0x750b('0x15')](util[_0x750b('0x1d')](_0x750b('0x3c'),_0x3400eb['uniqueid']),_0x3f0dda);}});ami['on'](_0x750b('0x3d'),function(_0x44f9fe){try{utils['debug'](util[_0x750b('0x1d')](_0x750b('0x3e'),_0x44f9fe[_0x750b('0x1f')]),_0x44f9fe);calls['newchannel'](_0x44f9fe);recordings[_0x750b('0x3d')](_0x44f9fe);}catch(_0x55f829){utils[_0x750b('0x15')](util[_0x750b('0x1d')](_0x750b('0x3e'),_0x44f9fe[_0x750b('0x1f')]),_0x55f829);}});ami['on'](_0x750b('0x3f'),function(_0x3bd2d2){try{utils[_0x750b('0x19')](util[_0x750b('0x1d')](_0x750b('0x40'),_0x3bd2d2[_0x750b('0x1f')]),_0x3bd2d2);dials[_0x750b('0x3f')](_0x3bd2d2);}catch(_0x1889f1){utils[_0x750b('0x15')](util[_0x750b('0x1d')](_0x750b('0x41'),_0x3bd2d2[_0x750b('0x1f')]),_0x1889f1);}});ami['on'](_0x750b('0x42'),function(_0x3a32aa){try{utils['debug'](util[_0x750b('0x1d')](_0x750b('0x43'),_0x3a32aa[_0x750b('0x1f')]),_0x3a32aa);dials['dialend'](_0x3a32aa);}catch(_0x53d1ce){utils[_0x750b('0x15')](util[_0x750b('0x1d')]('[%s][index][dialend]',_0x3a32aa[_0x750b('0x1f')]),_0x53d1ce);}});} \ No newline at end of file +var _0xe69f=['asterisk','port','username','keepConnected','xdr','disabled','info','XDR\x20DISABLED','./agents.controller','./calls.controller','./queues.controller','./recordings.controller','./members.controller','./dials.controller','./transfers.controller','./core.controller','connect','fullybooted','error','close','managerevent','debug','format','[%s][index][devicestatechange]','device','devicestatechange','agentcalled','[%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]','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','[%s][index][varset]','varset','newexten','[%s][index][newexten]','[%s][index][newchannel]','newchannel','[%s][index][dialbegin]','dialbegin','[%s][index][dialend]','asterisk-manager','../../config/environment','./utils'];(function(_0x5a50a2,_0x883230){var _0x31b7ae=function(_0x143576){while(--_0x143576){_0x5a50a2['push'](_0x5a50a2['shift']());}};_0x31b7ae(++_0x883230);}(_0xe69f,0x195));var _0xfe69=function(_0x301238,_0x455242){_0x301238=_0x301238-0x0;var _0x4222f8=_0xe69f[_0x301238];return _0x4222f8;};var AsteriskManager=require(_0xfe69('0x0'));var config=require(_0xfe69('0x1'));var utils=require(_0xfe69('0x2'));var util=require('util');var ami=new AsteriskManager(config[_0xfe69('0x3')][_0xfe69('0x4')],config[_0xfe69('0x3')]['ip'],config[_0xfe69('0x3')][_0xfe69('0x5')],config[_0xfe69('0x3')]['password'],!![]);ami[_0xfe69('0x6')]();if(config[_0xfe69('0x7')]&&config['xdr'][_0xfe69('0x8')]){utils[_0xfe69('0x9')](_0xfe69('0xa'));}else{var agents=require(_0xfe69('0xb'));var calls=require(_0xfe69('0xc'));var queues=require(_0xfe69('0xd'));var recordings=require(_0xfe69('0xe'));var members=require(_0xfe69('0xf'));var dials=require(_0xfe69('0x10'));var transfers=require(_0xfe69('0x11'));var core=require(_0xfe69('0x12'));ami['on'](_0xfe69('0x13'),core[_0xfe69('0x13')]);ami['on']('shutdown',core['shutdown']);ami['on'](_0xfe69('0x14'),core[_0xfe69('0x14')]);ami['on'](_0xfe69('0x15'),core['error']);ami['on']('close',core[_0xfe69('0x16')]);ami['on'](_0xfe69('0x17'),core['managerevent']);ami['on']('devicestatechange',function(_0xe3ae01){try{utils[_0xfe69('0x18')](util[_0xfe69('0x19')](_0xfe69('0x1a'),_0xe3ae01[_0xfe69('0x1b')]),_0xe3ae01);members[_0xfe69('0x1c')](_0xe3ae01);}catch(_0xcb49a7){utils[_0xfe69('0x15')](util['format']('[%s][index][devicestatechange]',_0xe3ae01['device']),_0xcb49a7);}});ami['on'](_0xfe69('0x1d'),function(_0x29a0b6){try{utils[_0xfe69('0x18')](util[_0xfe69('0x19')](_0xfe69('0x1e'),_0x29a0b6[_0xfe69('0x1f')]),_0x29a0b6);agents[_0xfe69('0x1d')](_0x29a0b6);}catch(_0x22248a){utils[_0xfe69('0x15')](util[_0xfe69('0x19')](_0xfe69('0x1e'),_0x29a0b6[_0xfe69('0x1f')]),_0x22248a);}});ami['on'](_0xfe69('0x20'),function(_0x40133c){try{utils[_0xfe69('0x18')](util['format'](_0xfe69('0x21'),_0x40133c['uniqueid']),_0x40133c);agents[_0xfe69('0x20')](_0x40133c);}catch(_0x4449e5){utils[_0xfe69('0x15')](util[_0xfe69('0x19')](_0xfe69('0x21'),_0x40133c[_0xfe69('0x1f')]),_0x4449e5);}});ami['on'](_0xfe69('0x22'),function(_0x594608){try{utils['debug'](util[_0xfe69('0x19')]('[%s][index][agentconnect]',_0x594608['uniqueid']),_0x594608);agents[_0xfe69('0x22')](_0x594608);queues[_0xfe69('0x22')](_0x594608);}catch(_0xf50e7){utils[_0xfe69('0x15')](util['format'](_0xfe69('0x23'),_0x594608['uniqueid']),_0xf50e7);}});ami['on'](_0xfe69('0x24'),function(_0x4000ce){try{utils[_0xfe69('0x18')](util[_0xfe69('0x19')](_0xfe69('0x25'),_0x4000ce[_0xfe69('0x1f')]),_0x4000ce);agents[_0xfe69('0x24')](_0x4000ce);queues[_0xfe69('0x24')](_0x4000ce);members[_0xfe69('0x24')](_0x4000ce);}catch(_0x4ef33c){utils[_0xfe69('0x15')](util[_0xfe69('0x19')](_0xfe69('0x25'),_0x4000ce[_0xfe69('0x1f')]),_0x4ef33c);}});ami['on'](_0xfe69('0x26'),function(_0x454a43){try{utils[_0xfe69('0x18')](util[_0xfe69('0x19')](_0xfe69('0x27'),_0x454a43['uniqueid']),_0x454a43);agents[_0xfe69('0x26')](_0x454a43);queues[_0xfe69('0x26')](_0x454a43);}catch(_0x109f97){utils[_0xfe69('0x15')](util[_0xfe69('0x19')](_0xfe69('0x27'),_0x454a43[_0xfe69('0x1f')]),_0x109f97);}});ami['on'](_0xfe69('0x28'),function(_0x5e41e9){try{utils[_0xfe69('0x18')](util[_0xfe69('0x19')]('[%s][index][queuecallerjoin]',_0x5e41e9[_0xfe69('0x1f')]),_0x5e41e9);queues['queuecallerjoin'](_0x5e41e9);recordings[_0xfe69('0x28')](_0x5e41e9);}catch(_0x28ad42){utils['error'](util[_0xfe69('0x19')](_0xfe69('0x29'),_0x5e41e9[_0xfe69('0x1f')]),_0x28ad42);}});ami['on'](_0xfe69('0x2a'),function(_0x58d133){try{utils[_0xfe69('0x18')](util[_0xfe69('0x19')](_0xfe69('0x2b'),_0x58d133[_0xfe69('0x1f')]),_0x58d133);queues[_0xfe69('0x2a')](_0x58d133);}catch(_0x562a9c){utils[_0xfe69('0x15')](util[_0xfe69('0x19')]('[%s][index][queuecallerleave]',_0x58d133[_0xfe69('0x1f')]),_0x562a9c);}});ami['on'](_0xfe69('0x2c'),function(_0x34c607){try{utils[_0xfe69('0x18')](util['format']('[%s][index][musiconholdstart]',_0x34c607[_0xfe69('0x1f')]),_0x34c607);queues['musiconholdstart'](_0x34c607);calls[_0xfe69('0x2c')](_0x34c607);}catch(_0x28ec01){utils[_0xfe69('0x15')](util['format'](_0xfe69('0x2d'),_0x34c607['uniqueid']),_0x28ec01);}});ami['on']('musiconholdstop',function(_0x1358bc){try{utils['debug'](util['format'](_0xfe69('0x2e'),_0x1358bc[_0xfe69('0x1f')]),_0x1358bc);queues[_0xfe69('0x2f')](_0x1358bc);calls[_0xfe69('0x2f')](_0x1358bc);}catch(_0x44ded1){utils['error'](util['format'](_0xfe69('0x2e'),_0x1358bc[_0xfe69('0x1f')]),_0x44ded1);}});ami['on'](_0xfe69('0x30'),function(_0x393f8c){try{utils[_0xfe69('0x18')](util[_0xfe69('0x19')]('[%s][index][newstate]',_0x393f8c['uniqueid']),_0x393f8c);calls[_0xfe69('0x30')](_0x393f8c);recordings[_0xfe69('0x30')](_0x393f8c);}catch(_0x4e884b){utils[_0xfe69('0x15')](util[_0xfe69('0x19')](_0xfe69('0x31'),_0x393f8c['uniqueid']),_0x4e884b);}});ami['on'](_0xfe69('0x32'),function(_0x5d2487){try{utils['debug'](util[_0xfe69('0x19')](_0xfe69('0x33'),_0x5d2487[_0xfe69('0x1f')]),_0x5d2487);calls[_0xfe69('0x32')](_0x5d2487);recordings[_0xfe69('0x32')](_0x5d2487);dials[_0xfe69('0x32')](_0x5d2487);agents[_0xfe69('0x32')](_0x5d2487);queues[_0xfe69('0x32')](_0x5d2487);}catch(_0x4f5df7){utils[_0xfe69('0x15')](util[_0xfe69('0x19')](_0xfe69('0x33'),_0x5d2487[_0xfe69('0x1f')]),_0x4f5df7);}});ami['on'](_0xfe69('0x34'),function(_0x2790c4){try{utils[_0xfe69('0x18')](util[_0xfe69('0x19')](_0xfe69('0x35'),_0x2790c4[_0xfe69('0x1f')]),_0x2790c4);members[_0xfe69('0x34')](_0x2790c4);}catch(_0x4baf27){utils[_0xfe69('0x15')](util[_0xfe69('0x19')](_0xfe69('0x35'),_0x2790c4[_0xfe69('0x1f')]),_0x4baf27);}});ami['on'](_0xfe69('0x36'),function(_0x287305){try{utils[_0xfe69('0x18')](util[_0xfe69('0x19')](_0xfe69('0x37'),_0x287305['uniqueid']),_0x287305);queues['blindtransfer'](_0x287305);agents[_0xfe69('0x36')](_0x287305);transfers[_0xfe69('0x36')](_0x287305);}catch(_0x1759e7){utils[_0xfe69('0x15')](util[_0xfe69('0x19')]('[%s][index][blindtransfer]',_0x287305['uniqueid']),_0x1759e7);}});ami['on'](_0xfe69('0x38'),function(_0x1326f3){try{utils[_0xfe69('0x18')](util[_0xfe69('0x19')](_0xfe69('0x39'),_0x1326f3['origtransfereruniqueid']),_0x1326f3);queues[_0xfe69('0x38')](_0x1326f3);transfers[_0xfe69('0x38')](_0x1326f3);agents['attendedtransfer'](_0x1326f3);calls[_0xfe69('0x38')](_0x1326f3);}catch(_0x32bbca){utils[_0xfe69('0x15')](util[_0xfe69('0x19')](_0xfe69('0x39'),_0x1326f3[_0xfe69('0x3a')]),_0x32bbca);}});ami['on']('varset',function(_0x113517){try{utils[_0xfe69('0x18')](util[_0xfe69('0x19')](_0xfe69('0x3b'),_0x113517[_0xfe69('0x1f')]),_0x113517);queues[_0xfe69('0x3c')](_0x113517);recordings[_0xfe69('0x3c')](_0x113517);calls[_0xfe69('0x3c')](_0x113517);dials[_0xfe69('0x3c')](_0x113517);}catch(_0x1fbf4e){utils[_0xfe69('0x15')](util[_0xfe69('0x19')](_0xfe69('0x3b'),_0x113517['uniqueid']),_0x1fbf4e);}});ami['on'](_0xfe69('0x3d'),function(_0x40877b){try{utils[_0xfe69('0x18')](util[_0xfe69('0x19')]('[%s][index][newexten]',_0x40877b[_0xfe69('0x1f')]),_0x40877b);calls[_0xfe69('0x3d')](_0x40877b);recordings[_0xfe69('0x3d')](_0x40877b);dials[_0xfe69('0x3d')](_0x40877b);}catch(_0x56ded7){utils[_0xfe69('0x15')](util['format'](_0xfe69('0x3e'),_0x40877b[_0xfe69('0x1f')]),_0x56ded7);}});ami['on']('newchannel',function(_0x12b936){try{utils[_0xfe69('0x18')](util[_0xfe69('0x19')](_0xfe69('0x3f'),_0x12b936[_0xfe69('0x1f')]),_0x12b936);calls['newchannel'](_0x12b936);recordings[_0xfe69('0x40')](_0x12b936);}catch(_0x49a590){utils[_0xfe69('0x15')](util[_0xfe69('0x19')](_0xfe69('0x3f'),_0x12b936['uniqueid']),_0x49a590);}});ami['on']('dialbegin',function(_0x37cec0){try{utils['debug'](util[_0xfe69('0x19')](_0xfe69('0x41'),_0x37cec0[_0xfe69('0x1f')]),_0x37cec0);dials[_0xfe69('0x42')](_0x37cec0);}catch(_0x4173dc){utils['error'](util['format']('[%s]dialbegin',_0x37cec0[_0xfe69('0x1f')]),_0x4173dc);}});ami['on']('dialend',function(_0x3b7229){try{utils['debug'](util[_0xfe69('0x19')](_0xfe69('0x43'),_0x3b7229['uniqueid']),_0x3b7229);dials['dialend'](_0x3b7229);}catch(_0x2bfdba){utils[_0xfe69('0x15')](util['format'](_0xfe69('0x43'),_0x3b7229[_0xfe69('0x1f')]),_0x2bfdba);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index dde66ba..7556afb 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 _0x1417=['duration','enterAt','agentcomplete','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','assign','[%s][members][agentcomplete]','cdr','[%s][members][cdr]','data1','source','data3','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','destinationchannel','destination','lodash','util','./utils','Local/_attended@transfer','Queue:','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','channel','data2','membername','type','getUserByInterface','then','name','internal','CreateMemberReport','getUserByName','split','error','format','[%s][members][writeDB]','devicestatechange','debug','[%s][members][devicestatechange]','device','info','state','INUSE','BUSY','voice','TALKING','agent','NOT_INUSE','isNil','exitAt','now'];(function(_0x47623f,_0x148f3a){var _0x282ce8=function(_0x35bca1){while(--_0x35bca1){_0x47623f['push'](_0x47623f['shift']());}};_0x282ce8(++_0x148f3a);}(_0x1417,0x17b));var _0x7141=function(_0x1303fd,_0x1b33cd){_0x1303fd=_0x1303fd-0x0;var _0x42cf21=_0x1417[_0x1303fd];return _0x42cf21;};'use strict';var _=require(_0x7141('0x0'));var util=require(_0x7141('0x1'));var utils=require(_0x7141('0x2'));var members={};var exclude=[_0x7141('0x3'),_0x7141('0x4')];function writeDB(_0x5f0b2b){utils['info'](util['format'](_0x7141('0x5'),_0x5f0b2b[_0x7141('0x6')],_0x5f0b2b[_0x7141('0x7')],_0x5f0b2b[_0x7141('0x8')],_0x5f0b2b[_0x7141('0x9')],_0x5f0b2b[_0x7141('0xa')],_0x5f0b2b[_0x7141('0xb')]));if(_0x5f0b2b[_0x7141('0x7')]){utils[_0x7141('0xc')](_0x5f0b2b[_0x7141('0x7')])[_0x7141('0xd')](function(_0x16037b){if(_0x16037b){_0x5f0b2b[_0x7141('0xa')]=_0x16037b[_0x7141('0xe')];_0x5f0b2b[_0x7141('0xf')]=_0x16037b[_0x7141('0xf')];utils['request'](_0x7141('0x10'),_0x5f0b2b);}else{utils[_0x7141('0x11')](_0x5f0b2b[_0x7141('0x7')][_0x7141('0x12')]('/')[0x1])[_0x7141('0xd')](function(_0x3a065c){if(_0x3a065c){_0x5f0b2b['membername']=_0x3a065c['name'];_0x5f0b2b[_0x7141('0xf')]=_0x3a065c[_0x7141('0xf')];utils['request']('CreateMemberReport',_0x5f0b2b);}});}})['catch'](function(_0x3c0e8a){utils[_0x7141('0x13')](util[_0x7141('0x14')](_0x7141('0x15'),_0x5f0b2b[_0x7141('0x6')]),_0x3c0e8a);});}delete members[_0x5f0b2b[_0x7141('0x7')]];}function startsWith(_0x1f708b,_0x273147){return _['some'](_0x1f708b,function(_0x58c97f){return _['startsWith'](_0x273147,_0x58c97f);});}exports[_0x7141('0x16')]=function(_0x49bdf0){try{utils[_0x7141('0x17')](util[_0x7141('0x14')](_0x7141('0x18'),members[_0x49bdf0[_0x7141('0x19')]]?members[_0x49bdf0[_0x7141('0x19')]][_0x7141('0x6')]:_0x49bdf0[_0x7141('0x19')]),_0x49bdf0);utils[_0x7141('0x1a')](util['format']('[%s][members][devicestatechange]\x20state:%s\x20interface:%s',members[_0x49bdf0['device']]?members[_0x49bdf0['device']][_0x7141('0x6')]:_0x49bdf0[_0x7141('0x19')],_0x49bdf0[_0x7141('0x1b')],_0x49bdf0[_0x7141('0x19')]));switch(_0x49bdf0[_0x7141('0x1b')]){case _0x7141('0x1c'):case _0x7141('0x1d'):if(!startsWith(exclude,_0x49bdf0[_0x7141('0x19')])){members[_0x49bdf0[_0x7141('0x19')]]={'channel':_0x7141('0x1e'),'interface':_0x49bdf0[_0x7141('0x19')],'type':_0x7141('0x1f'),'enterAt':utils['now'](),'role':_0x7141('0x20')};}break;case _0x7141('0x21'):if(!_[_0x7141('0x22')](members[_0x49bdf0['device']])){members[_0x49bdf0[_0x7141('0x19')]][_0x7141('0x23')]=utils[_0x7141('0x24')]();members[_0x49bdf0['device']][_0x7141('0x25')]=utils['diffTime'](members[_0x49bdf0['device']][_0x7141('0x23')],members[_0x49bdf0[_0x7141('0x19')]][_0x7141('0x26')]);if(members[_0x49bdf0[_0x7141('0x19')]][_0x7141('0x6')]){writeDB(members[_0x49bdf0[_0x7141('0x19')]]);}}break;default:break;}}catch(_0x4a73d6){utils[_0x7141('0x13')](util[_0x7141('0x14')]('[%s][members][devicestatechange]',members[_0x49bdf0[_0x7141('0x19')]]?members[_0x49bdf0['device']]['uniqueid']:_0x49bdf0['device']),_0x4a73d6);}};exports[_0x7141('0x27')]=function(_0xf86c71){try{if(!_[_0x7141('0x22')](members[_0xf86c71['interface']])){utils['debug'](util[_0x7141('0x14')]('[%s][members][agentcomplete]',_0xf86c71[_0x7141('0x6')]),_0xf86c71);utils[_0x7141('0x1a')](util['format'](_0x7141('0x28'),_0xf86c71['uniqueid'],_0xf86c71[_0x7141('0x7')],_0xf86c71[_0x7141('0x29')]));members[_0xf86c71['interface']]=_[_0x7141('0x2a')](members[_0xf86c71['interface']],{'data4':_0xf86c71['queue'],'uniqueid':_0xf86c71[_0x7141('0x6')]});}}catch(_0x11bcc9){utils[_0x7141('0x13')](util['format'](_0x7141('0x2b'),_0xf86c71[_0x7141('0x6')]),_0x11bcc9);}};exports[_0x7141('0x2c')]=function(_0x1afcc1){try{utils[_0x7141('0x17')](util['format'](_0x7141('0x2d'),_0x1afcc1['uniqueid']),_0x1afcc1);if(_0x1afcc1[_0x7141('0x8')]){var _0x5454c5=_0x1afcc1[_0x7141('0x8')][_0x7141('0x12')]('-')[0x0];if(!_[_0x7141('0x22')](members[_0x5454c5])){members[_0x5454c5]=_[_0x7141('0x2a')](members[_0x5454c5],{'data1':members[_0x5454c5][_0x7141('0x2e')]||_0x1afcc1[_0x7141('0xb')],'data2':members[_0x5454c5][_0x7141('0x9')]||_0x1afcc1[_0x7141('0x2f')],'data3':members[_0x5454c5][_0x7141('0x30')]||_0x1afcc1['destination'],'uniqueid':members[_0x5454c5][_0x7141('0x6')]||_0x1afcc1[_0x7141('0x6')]});utils[_0x7141('0x1a')](util[_0x7141('0x14')](_0x7141('0x31'),_0x1afcc1[_0x7141('0x6')],members[_0x5454c5]['data1'],members[_0x5454c5][_0x7141('0x9')],members[_0x5454c5]['data3']));if(members[_0x5454c5][_0x7141('0x23')]){writeDB(members[_0x5454c5]);}}}if(_0x1afcc1[_0x7141('0x32')]){var _0x535c3f=_0x1afcc1['destinationchannel'][_0x7141('0x12')]('-')[0x0];if(!_['isNil'](members[_0x535c3f])){members[_0x535c3f]=_[_0x7141('0x2a')](members[_0x535c3f],{'data1':members[_0x535c3f][_0x7141('0x2e')]||_0x1afcc1[_0x7141('0xb')],'data2':members[_0x535c3f][_0x7141('0x9')]||_0x1afcc1[_0x7141('0x2f')],'data3':members[_0x535c3f][_0x7141('0x30')]||_0x1afcc1[_0x7141('0x33')],'uniqueid':members[_0x535c3f]['uniqueid']||_0x1afcc1[_0x7141('0x6')]});utils[_0x7141('0x1a')](util[_0x7141('0x14')](_0x7141('0x31'),_0x1afcc1['uniqueid'],members[_0x535c3f][_0x7141('0x2e')],members[_0x535c3f]['data2'],members[_0x535c3f]['data3']));if(members[_0x535c3f]['exitAt']){writeDB(members[_0x535c3f]);}}}}catch(_0x17a77f){utils['error'](util['format']('[%s][members][cdr]',_0x1afcc1[_0x7141('0x6')]),_0x17a77f);}}; \ No newline at end of file +var _0x871e=['lodash','./utils','Local/_attended@transfer','Queue:','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','channel','data2','membername','type','getUserByInterface','then','name','internal','CreateMemberReport','getUserByName','split','request','catch','error','[%s][members][writeDB]','some','startsWith','devicestatechange','debug','[%s][members][devicestatechange]','device','info','state','INUSE','BUSY','voice','TALKING','now','agent','NOT_INUSE','isNil','exitAt','duration','diffTime','agentcomplete','[%s][members][agentcomplete]','queue','cdr','[%s][members][cdr]','assign','data1','source','data3','destination','destinationchannel','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s'];(function(_0x476bf4,_0x2a3755){var _0x788ffe=function(_0x13fa11){while(--_0x13fa11){_0x476bf4['push'](_0x476bf4['shift']());}};_0x788ffe(++_0x2a3755);}(_0x871e,0x1b0));var _0xe871=function(_0x29b35c,_0x2001c5){_0x29b35c=_0x29b35c-0x0;var _0x5ab131=_0x871e[_0x29b35c];return _0x5ab131;};'use strict';var _=require(_0xe871('0x0'));var util=require('util');var utils=require(_0xe871('0x1'));var members={};var exclude=[_0xe871('0x2'),_0xe871('0x3')];function writeDB(_0x352807){utils['info'](util[_0xe871('0x4')](_0xe871('0x5'),_0x352807[_0xe871('0x6')],_0x352807[_0xe871('0x7')],_0x352807[_0xe871('0x8')],_0x352807[_0xe871('0x9')],_0x352807[_0xe871('0xa')],_0x352807[_0xe871('0xb')]));if(_0x352807[_0xe871('0x7')]){utils[_0xe871('0xc')](_0x352807['interface'])[_0xe871('0xd')](function(_0x5c4eda){if(_0x5c4eda){_0x352807['membername']=_0x5c4eda[_0xe871('0xe')];_0x352807[_0xe871('0xf')]=_0x5c4eda[_0xe871('0xf')];utils['request'](_0xe871('0x10'),_0x352807);}else{utils[_0xe871('0x11')](_0x352807[_0xe871('0x7')][_0xe871('0x12')]('/')[0x1])[_0xe871('0xd')](function(_0x38806d){if(_0x38806d){_0x352807[_0xe871('0xa')]=_0x38806d['name'];_0x352807[_0xe871('0xf')]=_0x38806d[_0xe871('0xf')];utils[_0xe871('0x13')](_0xe871('0x10'),_0x352807);}});}})[_0xe871('0x14')](function(_0x3f226c){utils[_0xe871('0x15')](util[_0xe871('0x4')](_0xe871('0x16'),_0x352807['uniqueid']),_0x3f226c);});}delete members[_0x352807[_0xe871('0x7')]];}function startsWith(_0x48ebad,_0x4f7aec){return _[_0xe871('0x17')](_0x48ebad,function(_0x18e9ef){return _[_0xe871('0x18')](_0x4f7aec,_0x18e9ef);});}exports[_0xe871('0x19')]=function(_0x2288c8){try{utils[_0xe871('0x1a')](util[_0xe871('0x4')](_0xe871('0x1b'),members[_0x2288c8[_0xe871('0x1c')]]?members[_0x2288c8['device']][_0xe871('0x6')]:_0x2288c8['device']),_0x2288c8);utils[_0xe871('0x1d')](util[_0xe871('0x4')]('[%s][members][devicestatechange]\x20state:%s\x20interface:%s',members[_0x2288c8[_0xe871('0x1c')]]?members[_0x2288c8[_0xe871('0x1c')]][_0xe871('0x6')]:_0x2288c8[_0xe871('0x1c')],_0x2288c8[_0xe871('0x1e')],_0x2288c8[_0xe871('0x1c')]));switch(_0x2288c8[_0xe871('0x1e')]){case _0xe871('0x1f'):case _0xe871('0x20'):if(!startsWith(exclude,_0x2288c8[_0xe871('0x1c')])){members[_0x2288c8[_0xe871('0x1c')]]={'channel':_0xe871('0x21'),'interface':_0x2288c8[_0xe871('0x1c')],'type':_0xe871('0x22'),'enterAt':utils[_0xe871('0x23')](),'role':_0xe871('0x24')};}break;case _0xe871('0x25'):if(!_[_0xe871('0x26')](members[_0x2288c8[_0xe871('0x1c')]])){members[_0x2288c8[_0xe871('0x1c')]][_0xe871('0x27')]=utils[_0xe871('0x23')]();members[_0x2288c8[_0xe871('0x1c')]][_0xe871('0x28')]=utils[_0xe871('0x29')](members[_0x2288c8[_0xe871('0x1c')]]['exitAt'],members[_0x2288c8['device']]['enterAt']);if(members[_0x2288c8[_0xe871('0x1c')]][_0xe871('0x6')]){writeDB(members[_0x2288c8[_0xe871('0x1c')]]);}}break;default:break;}}catch(_0xb53d1a){utils['error'](util[_0xe871('0x4')]('[%s][members][devicestatechange]',members[_0x2288c8['device']]?members[_0x2288c8['device']][_0xe871('0x6')]:_0x2288c8[_0xe871('0x1c')]),_0xb53d1a);}};exports[_0xe871('0x2a')]=function(_0x2624fa){try{if(!_[_0xe871('0x26')](members[_0x2624fa[_0xe871('0x7')]])){utils[_0xe871('0x1a')](util[_0xe871('0x4')](_0xe871('0x2b'),_0x2624fa[_0xe871('0x6')]),_0x2624fa);utils[_0xe871('0x1d')](util['format']('[%s][members][agentcomplete]\x20interface:%s\x20queue:%s',_0x2624fa['uniqueid'],_0x2624fa[_0xe871('0x7')],_0x2624fa['queue']));members[_0x2624fa[_0xe871('0x7')]]=_['assign'](members[_0x2624fa['interface']],{'data4':_0x2624fa[_0xe871('0x2c')],'uniqueid':_0x2624fa[_0xe871('0x6')]});}}catch(_0xd1406e){utils[_0xe871('0x15')](util[_0xe871('0x4')](_0xe871('0x2b'),_0x2624fa[_0xe871('0x6')]),_0xd1406e);}};exports[_0xe871('0x2d')]=function(_0x1394c4){try{utils['debug'](util[_0xe871('0x4')](_0xe871('0x2e'),_0x1394c4[_0xe871('0x6')]),_0x1394c4);if(_0x1394c4[_0xe871('0x8')]){var _0x352788=_0x1394c4[_0xe871('0x8')][_0xe871('0x12')]('-')[0x0];if(!_['isNil'](members[_0x352788])){members[_0x352788]=_[_0xe871('0x2f')](members[_0x352788],{'data1':members[_0x352788][_0xe871('0x30')]||_0x1394c4[_0xe871('0xb')],'data2':members[_0x352788][_0xe871('0x9')]||_0x1394c4[_0xe871('0x31')],'data3':members[_0x352788][_0xe871('0x32')]||_0x1394c4[_0xe871('0x33')],'uniqueid':members[_0x352788][_0xe871('0x6')]||_0x1394c4[_0xe871('0x6')]});utils['info'](util[_0xe871('0x4')]('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x1394c4['uniqueid'],members[_0x352788]['data1'],members[_0x352788]['data2'],members[_0x352788]['data3']));if(members[_0x352788]['exitAt']){writeDB(members[_0x352788]);}}}if(_0x1394c4[_0xe871('0x34')]){var _0x4dbcab=_0x1394c4[_0xe871('0x34')][_0xe871('0x12')]('-')[0x0];if(!_['isNil'](members[_0x4dbcab])){members[_0x4dbcab]=_['assign'](members[_0x4dbcab],{'data1':members[_0x4dbcab]['data1']||_0x1394c4[_0xe871('0xb')],'data2':members[_0x4dbcab][_0xe871('0x9')]||_0x1394c4['source'],'data3':members[_0x4dbcab][_0xe871('0x32')]||_0x1394c4[_0xe871('0x33')],'uniqueid':members[_0x4dbcab][_0xe871('0x6')]||_0x1394c4['uniqueid']});utils[_0xe871('0x1d')](util[_0xe871('0x4')](_0xe871('0x35'),_0x1394c4[_0xe871('0x6')],members[_0x4dbcab][_0xe871('0x30')],members[_0x4dbcab][_0xe871('0x9')],members[_0x4dbcab]['data3']));if(members[_0x4dbcab][_0xe871('0x27')]){writeDB(members[_0x4dbcab]);}}}}catch(_0x5cadc4){utils['error'](util[_0xe871('0x4')]('[%s][members][cdr]',_0x1394c4[_0xe871('0x6')]),_0x5cadc4);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index 62d4b6d..4dd439d 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 _0x80bf=['[%s][queues][agentcomplete]','blindtransfer','BLIND','transferexten','extension','transfereeuniqueid','transferuniqueid','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','[%s][queues][blindtransfer]','attendedtransfer','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','transfertype','ATTENDED','origtransfererexten','ATTENDEDTRANSFER','transfereelinkedid','clone','transfertargetuniqueid','queuecallerjoinAt','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','calleridname','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','transfertargetlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]','musiconholdstart','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','[%s][queues][musiconholdstart]','musiconholdstop','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','[%s][queues][musiconholdstop]','lodash','util','./utils','info','format','channel','calleridnum','queuecallerexitreason','getVoiceQueueByName','queue','then','type','CreateVoiceQueueReport','request','transfereduniqueid','uniqueid','queuecallerjoin','debug','[%s][queues][queuecallerjoin]','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','now','hangup','isNil','[%s][queues][hangup]','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','error','varset','[%s][queues][varset]','variable','queuestatus','value','toUpperCase','CONTINUE','queuecallerabandonAt','queuecallerexitAt','queueposition','queuecallerabandon','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','queuecallerleave','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','connectedlinename','holdtime','diffTime','count','agentconnect','[%s][queues][agentconnect]','membername','destaccountcode','queuecallerexit','assigned','accountcode','lastAssignedTo','agentcomplete','transfer','TRANSFER','COMPLETEDBY','reason','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x80bf,0x1e2));var _0xf80b=function(_0x2bcc7d,_0x151cf8){_0x2bcc7d=_0x2bcc7d-0x0;var _0x434aad=_0x80bf[_0x2bcc7d];return _0x434aad;};'use strict';var _=require(_0xf80b('0x0'));var util=require(_0xf80b('0x1'));var utils=require(_0xf80b('0x2'));var queues={};function writeDB(_0x2cbbec){utils[_0xf80b('0x3')](util[_0xf80b('0x4')]('[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s',_0x2cbbec['uniqueid'],_0x2cbbec[_0xf80b('0x5')],_0x2cbbec['queue'],_0x2cbbec['lastAssignedTo'],_0x2cbbec[_0xf80b('0x6')],_0x2cbbec['accountcode'],_0x2cbbec[_0xf80b('0x7')]));if(_0x2cbbec['queue']){utils[_0xf80b('0x8')](_0x2cbbec[_0xf80b('0x9')])[_0xf80b('0xa')](function(_0x27fbcd){if(_0x27fbcd){_0x2cbbec[_0xf80b('0xb')]=_0x27fbcd['type'];}utils['request'](_0xf80b('0xc'),_0x2cbbec);});}else{utils[_0xf80b('0xd')](_0xf80b('0xc'),_0x2cbbec);}if(_0x2cbbec[_0xf80b('0xe')]){delete queues[_0x2cbbec[_0xf80b('0xe')]];}else{delete queues[_0x2cbbec[_0xf80b('0xf')]];}}exports[_0xf80b('0x10')]=function(_0x2a0582){try{utils[_0xf80b('0x11')](util['format'](_0xf80b('0x12'),_0x2a0582[_0xf80b('0xf')]),_0x2a0582);utils['info'](util['format'](_0xf80b('0x13'),_0x2a0582[_0xf80b('0xf')],_0x2a0582[_0xf80b('0x9')],_0x2a0582[_0xf80b('0x14')]));queues[_0x2a0582['uniqueid']]=_[_0xf80b('0x15')](_0x2a0582,{'originalposition':_0x2a0582[_0xf80b('0x14')],'queuecallerjoinAt':utils[_0xf80b('0x16')](),'mohtime':0x0});}catch(_0x5c2539){utils['error'](util[_0xf80b('0x4')](_0xf80b('0x12'),_0x2a0582[_0xf80b('0xf')]),_0x5c2539);}};exports[_0xf80b('0x17')]=function(_0x5267e1){try{if(!_[_0xf80b('0x18')](queues[_0x5267e1['uniqueid']])){utils[_0xf80b('0x11')](util[_0xf80b('0x4')](_0xf80b('0x19'),_0x5267e1[_0xf80b('0xf')]),_0x5267e1);if(queues[_0x5267e1[_0xf80b('0xf')]][_0xf80b('0x1a')]){if(!queues[_0x5267e1[_0xf80b('0xf')]]['queuecallerabandon']&&!queues[_0x5267e1[_0xf80b('0xf')]]['queuecallerexit']){queues[_0x5267e1[_0xf80b('0xf')]][_0xf80b('0x1b')]=!![];queues[_0x5267e1[_0xf80b('0xf')]][_0xf80b('0x1c')]=utils[_0xf80b('0x16')]();queues[_0x5267e1[_0xf80b('0xf')]][_0xf80b('0x7')]=_0xf80b('0x1d');}utils['info'](util['format'](_0xf80b('0x1e'),_0x5267e1[_0xf80b('0xf')],queues[_0x5267e1[_0xf80b('0xf')]][_0xf80b('0x1f')],queues[_0x5267e1[_0xf80b('0xf')]][_0xf80b('0x7')]));writeDB(queues[_0x5267e1[_0xf80b('0xf')]]);}else if(queues[_0x5267e1[_0xf80b('0xf')]]['transfereduniqueid']){utils[_0xf80b('0x3')](util[_0xf80b('0x4')](_0xf80b('0x20'),_0x5267e1[_0xf80b('0xf')],queues[_0x5267e1['uniqueid']][_0xf80b('0x1f')],queues[_0x5267e1['uniqueid']][_0xf80b('0xe')]));queues[queues[_0x5267e1[_0xf80b('0xf')]]['transfereduniqueid']]=queues[_0x5267e1[_0xf80b('0xf')]];queues[queues[_0x5267e1[_0xf80b('0xf')]][_0xf80b('0xe')]][_0xf80b('0x21')]=0x2;delete queues[_0x5267e1['uniqueid']];}}}catch(_0x48ebe1){utils[_0xf80b('0x22')](util['format'](_0xf80b('0x19'),_0x5267e1[_0xf80b('0xf')]),_0x48ebe1);}};exports[_0xf80b('0x23')]=function(_0x456432){try{utils[_0xf80b('0x11')](util['format'](_0xf80b('0x24'),_0x456432[_0xf80b('0xf')]),_0x456432);if(!_[_0xf80b('0x18')](_0x456432[_0xf80b('0x25')][_0xf80b('0x26')])&&_0x456432[_0xf80b('0x27')][_0xf80b('0x28')]()!==_0xf80b('0x29')){if(!_['isNil'](queues[_0x456432[_0xf80b('0xf')]])){queues[_0x456432['uniqueid']]['queuecallerabandon']=![];queues[_0x456432['uniqueid']][_0xf80b('0x2a')]=null;queues[_0x456432['uniqueid']]['queuecallerexit']=!![];queues[_0x456432['uniqueid']][_0xf80b('0x2b')]=utils['now']();queues[_0x456432[_0xf80b('0xf')]][_0xf80b('0x7')]=_0x456432[_0xf80b('0x27')][_0xf80b('0x28')]();utils[_0xf80b('0x3')](util['format']('[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s',_0x456432['uniqueid'],queues[_0x456432['uniqueid']][_0xf80b('0x1f')],_0x456432['value'],queues[_0x456432['uniqueid']][_0xf80b('0x7')]));writeDB(queues[_0x456432[_0xf80b('0xf')]]);}}else if(!_[_0xf80b('0x18')](_0x456432[_0xf80b('0x25')][_0xf80b('0x2c')])){if(!_[_0xf80b('0x18')](queues[_0x456432[_0xf80b('0xf')]])&&!queues[_0x456432[_0xf80b('0xf')]][_0xf80b('0x2d')]){queues[_0x456432['uniqueid']][_0xf80b('0x2d')]=![];queues[_0x456432[_0xf80b('0xf')]][_0xf80b('0x2a')]=null;queues[_0x456432[_0xf80b('0xf')]]['queuecallerexit']=!![];queues[_0x456432[_0xf80b('0xf')]][_0xf80b('0x2b')]=utils[_0xf80b('0x16')]();queues[_0x456432[_0xf80b('0xf')]][_0xf80b('0x7')]=_0xf80b('0x2e');utils[_0xf80b('0x3')](util[_0xf80b('0x4')](_0xf80b('0x2f'),_0x456432[_0xf80b('0xf')],queues[_0x456432[_0xf80b('0xf')]][_0xf80b('0x1f')],_0x456432[_0xf80b('0x27')],queues[_0x456432['uniqueid']][_0xf80b('0x7')]));}}}catch(_0x430450){utils[_0xf80b('0x22')](util['format'](_0xf80b('0x24'),_0x456432[_0xf80b('0xf')]),_0x430450);}};exports[_0xf80b('0x2d')]=function(_0x4450c1){try{if(!_[_0xf80b('0x18')](queues[_0x4450c1[_0xf80b('0xf')]])){utils[_0xf80b('0x11')](util[_0xf80b('0x4')]('[%s][queues][queuecallerabandon]',_0x4450c1[_0xf80b('0xf')]),_0x4450c1);queues[_0x4450c1[_0xf80b('0xf')]]['queuecallerexit']=![];queues[_0x4450c1[_0xf80b('0xf')]]['queuecallerexitAt']=null;queues[_0x4450c1[_0xf80b('0xf')]][_0xf80b('0x2d')]=!![];queues[_0x4450c1[_0xf80b('0xf')]][_0xf80b('0x2a')]=utils[_0xf80b('0x16')]();queues[_0x4450c1[_0xf80b('0xf')]]['queuecallerexitreason']=_0xf80b('0x30');utils[_0xf80b('0x3')](util['format'](_0xf80b('0x31'),_0x4450c1[_0xf80b('0xf')],queues[_0x4450c1['uniqueid']][_0xf80b('0x1f')],queues[_0x4450c1[_0xf80b('0xf')]][_0xf80b('0x7')]));}}catch(_0x131460){utils[_0xf80b('0x22')](util[_0xf80b('0x4')](_0xf80b('0x32'),_0x4450c1['uniqueid']),_0x131460);}};exports[_0xf80b('0x33')]=function(_0x18df20){try{if(!_['isNil'](queues[_0x18df20[_0xf80b('0xf')]])){utils[_0xf80b('0x11')](util['format'](_0xf80b('0x34'),_0x18df20[_0xf80b('0xf')]),_0x18df20);utils[_0xf80b('0x3')](util[_0xf80b('0x4')](_0xf80b('0x35'),_0x18df20['uniqueid'],queues[_0x18df20[_0xf80b('0xf')]][_0xf80b('0x1f')],_0x18df20[_0xf80b('0x36')],_0x18df20[_0xf80b('0x37')]));queues[_0x18df20[_0xf80b('0xf')]]['queuecallerleave']=!![];queues[_0x18df20[_0xf80b('0xf')]][_0xf80b('0x1a')]=utils[_0xf80b('0x16')]();queues[_0x18df20[_0xf80b('0xf')]][_0xf80b('0x38')]=utils[_0xf80b('0x39')](queues[_0x18df20[_0xf80b('0xf')]][_0xf80b('0x1a')],queues[_0x18df20['uniqueid']]['queuecallerjoinAt']);queues[_0x18df20[_0xf80b('0xf')]][_0xf80b('0x14')]=_0x18df20[_0xf80b('0x14')];queues[_0x18df20[_0xf80b('0xf')]][_0xf80b('0x3a')]=_0x18df20[_0xf80b('0x3a')];queues[_0x18df20[_0xf80b('0xf')]][_0xf80b('0x36')]=_0x18df20[_0xf80b('0x36')];queues[_0x18df20['uniqueid']][_0xf80b('0x37')]=_0x18df20[_0xf80b('0x37')];}}catch(_0x55f020){utils[_0xf80b('0x22')](util[_0xf80b('0x4')](_0xf80b('0x34'),_0x18df20['uniqueid']),_0x55f020);}};exports[_0xf80b('0x3b')]=function(_0x55ebf9){try{if(!_['isNil'](queues[_0x55ebf9[_0xf80b('0xf')]])){utils[_0xf80b('0x11')](util[_0xf80b('0x4')](_0xf80b('0x3c'),_0x55ebf9['uniqueid']),_0x55ebf9);utils[_0xf80b('0x3')](util[_0xf80b('0x4')]('[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s',_0x55ebf9[_0xf80b('0xf')],queues[_0x55ebf9[_0xf80b('0xf')]]['name'],_0x55ebf9[_0xf80b('0x3d')],_0x55ebf9[_0xf80b('0x3e')]));queues[_0x55ebf9[_0xf80b('0xf')]][_0xf80b('0x2d')]=![];queues[_0x55ebf9['uniqueid']][_0xf80b('0x2d')]=![];queues[_0x55ebf9[_0xf80b('0xf')]]['queuecallerabandonAt']=null;queues[_0x55ebf9[_0xf80b('0xf')]][_0xf80b('0x3f')]=![];queues[_0x55ebf9['uniqueid']]['queuecallerexitreason']=null;queues[_0x55ebf9[_0xf80b('0xf')]][_0xf80b('0x2b')]=null;queues[_0x55ebf9[_0xf80b('0xf')]][_0xf80b('0x40')]=!![];queues[_0x55ebf9[_0xf80b('0xf')]][_0xf80b('0x41')]=_0x55ebf9[_0xf80b('0x3e')];queues[_0x55ebf9[_0xf80b('0xf')]][_0xf80b('0x42')]=_0x55ebf9[_0xf80b('0x3d')];}}catch(_0x5a2f73){utils[_0xf80b('0x22')](util[_0xf80b('0x4')](_0xf80b('0x3c'),_0x55ebf9[_0xf80b('0xf')]),_0x5a2f73);}};exports[_0xf80b('0x43')]=function(_0x46401d){try{if(!_['isNil'](queues[_0x46401d['uniqueid']])){if(queues[_0x46401d[_0xf80b('0xf')]][_0xf80b('0x1a')]){utils[_0xf80b('0x11')](util[_0xf80b('0x4')]('[%s][queues][agentcomplete]',_0x46401d[_0xf80b('0xf')]),_0x46401d);queues[_0x46401d[_0xf80b('0xf')]]['queuecallerabandon']=![];queues[_0x46401d['uniqueid']][_0xf80b('0x2d')]=![];queues[_0x46401d[_0xf80b('0xf')]][_0xf80b('0x2a')]=null;queues[_0x46401d[_0xf80b('0xf')]][_0xf80b('0x3f')]=![];queues[_0x46401d[_0xf80b('0xf')]][_0xf80b('0x2b')]=null;queues[_0x46401d[_0xf80b('0xf')]]['assigned']=!![];queues[_0x46401d[_0xf80b('0xf')]]['lastAssignedTo']=_0x46401d['membername'];queues[_0x46401d[_0xf80b('0xf')]][_0xf80b('0x1b')]=!![];queues[_0x46401d[_0xf80b('0xf')]][_0xf80b('0x1c')]=utils[_0xf80b('0x16')]();if(_0x46401d['reason']==_0xf80b('0x44')){if(!queues[_0x46401d[_0xf80b('0xf')]][_0xf80b('0x44')]){queues[_0x46401d[_0xf80b('0xf')]][_0xf80b('0x7')]=_0xf80b('0x45');}}else{queues[_0x46401d[_0xf80b('0xf')]]['queuecallerexitreason']=_0xf80b('0x46')+_0x46401d[_0xf80b('0x47')][_0xf80b('0x28')]();}utils[_0xf80b('0x3')](util[_0xf80b('0x4')](_0xf80b('0x48'),_0x46401d[_0xf80b('0xf')],queues[_0x46401d[_0xf80b('0xf')]]['name'],_0x46401d[_0xf80b('0x3d')],queues[_0x46401d[_0xf80b('0xf')]][_0xf80b('0x7')]));writeDB(queues[_0x46401d[_0xf80b('0xf')]]);}}}catch(_0x4db6ad){utils[_0xf80b('0x22')](util[_0xf80b('0x4')](_0xf80b('0x49'),_0x46401d['uniqueid']),_0x4db6ad);}};exports[_0xf80b('0x4a')]=function(_0x323ee0){try{if(!_[_0xf80b('0x18')](queues[_0x323ee0['transfereeuniqueid']])){utils[_0xf80b('0x11')](util[_0xf80b('0x4')]('[%s][queues][blindtransfer]',_0x323ee0['uniqueid']),_0x323ee0);queues[_0x323ee0['transfereeuniqueid']][_0xf80b('0x44')]=!![];queues[_0x323ee0['transfereeuniqueid']]['transfertype']=_0xf80b('0x4b');queues[_0x323ee0['transfereeuniqueid']][_0xf80b('0x4c')]=_0x323ee0[_0xf80b('0x4d')];queues[_0x323ee0[_0xf80b('0x4e')]][_0xf80b('0x4f')]=_0x323ee0[_0xf80b('0x4e')];queues[_0x323ee0[_0xf80b('0x4e')]][_0xf80b('0x7')]='BLINDTRANSFER';utils['info'](util[_0xf80b('0x4')](_0xf80b('0x50'),_0x323ee0[_0xf80b('0xf')],queues[_0x323ee0[_0xf80b('0x4e')]]['name'],_0x323ee0[_0xf80b('0x4e')],_0x323ee0[_0xf80b('0x4d')]));}}catch(_0x49da6c){utils[_0xf80b('0x22')](util[_0xf80b('0x4')](_0xf80b('0x51'),_0x323ee0[_0xf80b('0xf')]),_0x49da6c);}};exports[_0xf80b('0x52')]=function(_0x6ff71d){try{utils[_0xf80b('0x11')](util[_0xf80b('0x4')]('[%s][queues][attendedtransfer]',_0x6ff71d[_0xf80b('0x53')]),_0x6ff71d);if(_0x6ff71d[_0xf80b('0x53')]==_0x6ff71d[_0xf80b('0x54')]){if(!_[_0xf80b('0x18')](queues[_0x6ff71d['secondtransfererlinkedid']])){utils[_0xf80b('0x3')](util['format']('[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x6ff71d['origtransfereruniqueid'],queues[_0x6ff71d[_0xf80b('0x55')]][_0xf80b('0x1f')],_0x6ff71d['origtransfererexten']));queues[_0x6ff71d[_0xf80b('0x55')]][_0xf80b('0x44')]=!![];queues[_0x6ff71d[_0xf80b('0x55')]][_0xf80b('0x56')]=_0xf80b('0x57');queues[_0x6ff71d[_0xf80b('0x55')]][_0xf80b('0x4c')]=_0x6ff71d[_0xf80b('0x58')];queues[_0x6ff71d[_0xf80b('0x55')]][_0xf80b('0x4f')]=_0x6ff71d['origtransfereruniqueid'];queues[_0x6ff71d[_0xf80b('0x55')]][_0xf80b('0x7')]=_0xf80b('0x59');}if(!_[_0xf80b('0x18')](queues[_0x6ff71d['origtransfererlinkedid']])){if(_0x6ff71d[_0xf80b('0x5a')]&&queues[_0x6ff71d['transfereelinkedid']]){queues[_0x6ff71d[_0xf80b('0x5a')]][_0xf80b('0x21')]=0x1;queues[_0x6ff71d[_0xf80b('0x4e')]]=_[_0xf80b('0x5b')](queues[_0x6ff71d[_0xf80b('0x5a')]]);queues[_0x6ff71d[_0xf80b('0x4e')]][_0xf80b('0xe')]=_0x6ff71d[_0xf80b('0x5c')];queues[_0x6ff71d['transfereeuniqueid']][_0xf80b('0x21')]=0x2;queues[_0x6ff71d[_0xf80b('0x4e')]][_0xf80b('0x6')]=queues[_0x6ff71d[_0xf80b('0x55')]][_0xf80b('0x6')];queues[_0x6ff71d[_0xf80b('0x4e')]]['calleridname']=queues[_0x6ff71d[_0xf80b('0x55')]]['calleridname'];queues[_0x6ff71d[_0xf80b('0x4e')]][_0xf80b('0x5d')]=utils[_0xf80b('0x16')]();queues[_0x6ff71d['transfereeuniqueid']][_0xf80b('0x1a')]=utils[_0xf80b('0x16')]();queues[_0x6ff71d['transfereeuniqueid']][_0xf80b('0x38')]=0x0;queues[_0x6ff71d[_0xf80b('0x4e')]][_0xf80b('0x5e')]=0x0;utils[_0xf80b('0x3')](util[_0xf80b('0x4')](_0xf80b('0x5f'),_0x6ff71d['origtransfereruniqueid'],queues[_0x6ff71d[_0xf80b('0x4e')]]['name'],queues[_0x6ff71d['transfereeuniqueid']][_0xf80b('0x6')],queues[_0x6ff71d[_0xf80b('0x4e')]][_0xf80b('0x60')]));}else{utils['info'](util[_0xf80b('0x4')](_0xf80b('0x61'),_0x6ff71d[_0xf80b('0x53')],queues[_0x6ff71d['origtransfererlinkedid']]['name'],_0x6ff71d[_0xf80b('0x55')]));queues[_0x6ff71d[_0xf80b('0x54')]][_0xf80b('0xe')]=_0x6ff71d[_0xf80b('0x55')];}}}else if(_0x6ff71d[_0xf80b('0x62')]==_0x6ff71d[_0xf80b('0x55')]){if(!_['isNil'](queues[_0x6ff71d[_0xf80b('0x54')]])){utils[_0xf80b('0x3')](util[_0xf80b('0x4')](_0xf80b('0x63'),_0x6ff71d[_0xf80b('0x53')],queues[_0x6ff71d[_0xf80b('0x54')]][_0xf80b('0x1f')],_0x6ff71d['secondtransfereruniqueid'],_0x6ff71d[_0xf80b('0x64')]));queues[_0x6ff71d[_0xf80b('0x54')]][_0xf80b('0x44')]=!![];queues[_0x6ff71d[_0xf80b('0x54')]][_0xf80b('0x56')]=_0xf80b('0x57');queues[_0x6ff71d[_0xf80b('0x54')]][_0xf80b('0x4c')]=_0x6ff71d[_0xf80b('0x64')];queues[_0x6ff71d[_0xf80b('0x54')]][_0xf80b('0x4f')]=_0x6ff71d[_0xf80b('0x62')];queues[_0x6ff71d[_0xf80b('0x54')]][_0xf80b('0x7')]=_0xf80b('0x59');}if(!_['isNil'](queues[_0x6ff71d[_0xf80b('0x55')]])){if(_0x6ff71d['transfertargetlinkedid']&&queues[_0x6ff71d['transfertargetlinkedid']]){queues[_0x6ff71d[_0xf80b('0x65')]][_0xf80b('0x21')]=0x1;queues[_0x6ff71d[_0xf80b('0x5c')]]=_[_0xf80b('0x5b')](queues[_0x6ff71d[_0xf80b('0x65')]]);queues[_0x6ff71d[_0xf80b('0x5c')]][_0xf80b('0xe')]=_0x6ff71d[_0xf80b('0x5c')];queues[_0x6ff71d[_0xf80b('0x5c')]][_0xf80b('0x21')]=0x2;queues[_0x6ff71d['transfertargetuniqueid']][_0xf80b('0x6')]=queues[_0x6ff71d[_0xf80b('0x54')]]['calleridnum'];queues[_0x6ff71d['transfertargetuniqueid']][_0xf80b('0x60')]=queues[_0x6ff71d['origtransfererlinkedid']][_0xf80b('0x60')];queues[_0x6ff71d[_0xf80b('0x5c')]][_0xf80b('0x5d')]=utils['now']();queues[_0x6ff71d[_0xf80b('0x5c')]][_0xf80b('0x1a')]=utils[_0xf80b('0x16')]();queues[_0x6ff71d[_0xf80b('0x5c')]]['holdtime']=0x0;queues[_0x6ff71d[_0xf80b('0x5c')]][_0xf80b('0x5e')]=0x0;utils[_0xf80b('0x3')](util[_0xf80b('0x4')](_0xf80b('0x66'),_0x6ff71d[_0xf80b('0x53')],queues[_0x6ff71d[_0xf80b('0x5c')]][_0xf80b('0x1f')],queues[_0x6ff71d[_0xf80b('0x5c')]]['transfereduniqueid'],queues[_0x6ff71d[_0xf80b('0x5c')]][_0xf80b('0x6')],queues[_0x6ff71d[_0xf80b('0x5c')]][_0xf80b('0x60')]));}else{utils[_0xf80b('0x3')](util[_0xf80b('0x4')](_0xf80b('0x61'),_0x6ff71d['origtransfereruniqueid'],queues[_0x6ff71d['secondtransfererlinkedid']][_0xf80b('0x1f')],_0x6ff71d[_0xf80b('0x54')]));queues[_0x6ff71d[_0xf80b('0x55')]][_0xf80b('0xe')]=_0x6ff71d[_0xf80b('0x54')];}}}}catch(_0x16ff06){utils[_0xf80b('0x22')](util[_0xf80b('0x4')](_0xf80b('0x67'),_0x6ff71d[_0xf80b('0x53')]),_0x16ff06);}};exports[_0xf80b('0x68')]=function(_0x87f681){try{if(!_['isNil'](queues[_0x87f681[_0xf80b('0xf')]])){utils[_0xf80b('0x11')](util['format']('[%s][queues][musiconholdstart]',_0x87f681[_0xf80b('0xf')]),_0x87f681);queues[_0x87f681[_0xf80b('0xf')]][_0xf80b('0x69')]=utils['now']();utils[_0xf80b('0x3')](util[_0xf80b('0x4')](_0xf80b('0x6a'),_0x87f681[_0xf80b('0xf')],queues[_0x87f681[_0xf80b('0xf')]][_0xf80b('0x1f')],queues[_0x87f681[_0xf80b('0xf')]][_0xf80b('0x69')]));}}catch(_0xfbbbf1){utils[_0xf80b('0x22')](util[_0xf80b('0x4')](_0xf80b('0x6b'),_0x87f681[_0xf80b('0xf')]),_0xfbbbf1);}};exports[_0xf80b('0x6c')]=function(_0x12ce21){try{if(!_['isNil'](queues[_0x12ce21['uniqueid']])){if(!_['isNil'](queues[_0x12ce21['uniqueid']][_0xf80b('0x69')])){utils[_0xf80b('0x11')](util['format']('[%s][queues][musiconholdstop]',_0x12ce21[_0xf80b('0xf')]),_0x12ce21);queues[_0x12ce21[_0xf80b('0xf')]][_0xf80b('0x5e')]+=utils[_0xf80b('0x39')](utils[_0xf80b('0x16')](),queues[_0x12ce21['uniqueid']][_0xf80b('0x69')]);utils['info'](util[_0xf80b('0x4')](_0xf80b('0x6d'),_0x12ce21[_0xf80b('0xf')],queues[_0x12ce21[_0xf80b('0xf')]]['name'],queues[_0x12ce21[_0xf80b('0xf')]][_0xf80b('0x5e')]));delete queues[_0x12ce21[_0xf80b('0xf')]][_0xf80b('0x69')];}}}catch(_0x1cac86){utils[_0xf80b('0x22')](util[_0xf80b('0x4')](_0xf80b('0x6e'),_0x12ce21['uniqueid']),_0x1cac86);}}; \ No newline at end of file +var _0x3cd5=['BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','attendedtransfer','[%s][queues][attendedtransfer]','origtransfererlinkedid','secondtransfererlinkedid','origtransfererexten','origtransfereruniqueid','ATTENDEDTRANSFER','transfereelinkedid','transfertargetuniqueid','calleridname','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','ATTENDED','transfertargetlinkedid','queuecallerenterreason','clone','musiconholdstart','[%s][queues][musiconholdstart]','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstop','[%s][queues][musiconholdstop]','lodash','info','uniqueid','channel','queue','lastAssignedTo','calleridnum','accountcode','queuecallerexitreason','then','type','request','CreateVoiceQueueReport','transfereduniqueid','debug','assign','error','format','isNil','[%s][queues][hangup]','queuecallerabandon','queuecallercompleteAt','now','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','[%s][queues][varset]','variable','queuestatus','value','CONTINUE','queuecallerexit','[%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','ABANDONED','[%s][queues][queuecallerabandon]','[%s][queues][queuecallerleave]','connectedlinename','queuecallerleave','queuecallerleaveAt','diffTime','queuecallerjoinAt','count','connectedlinenum','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','assigned','destaccountcode','agentcomplete','[%s][queues][agentcomplete]','queuecallercomplete','reason','TRANSFER','COMPLETEDBY','toUpperCase','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','transfereeuniqueid','transfer','transfertype','BLIND','transferexten','extension','transferuniqueid'];(function(_0x35ef6b,_0x202c42){var _0x3ad145=function(_0x3092de){while(--_0x3092de){_0x35ef6b['push'](_0x35ef6b['shift']());}};_0x3ad145(++_0x202c42);}(_0x3cd5,0xde));var _0x53cd=function(_0x22ffbf,_0x16f31e){_0x22ffbf=_0x22ffbf-0x0;var _0x360c17=_0x3cd5[_0x22ffbf];return _0x360c17;};'use strict';var _=require(_0x53cd('0x0'));var util=require('util');var utils=require('./utils');var queues={};function writeDB(_0x44fcd8){utils[_0x53cd('0x1')](util['format']('[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s',_0x44fcd8[_0x53cd('0x2')],_0x44fcd8[_0x53cd('0x3')],_0x44fcd8[_0x53cd('0x4')],_0x44fcd8[_0x53cd('0x5')],_0x44fcd8[_0x53cd('0x6')],_0x44fcd8[_0x53cd('0x7')],_0x44fcd8[_0x53cd('0x8')]));if(_0x44fcd8[_0x53cd('0x4')]){utils['getVoiceQueueByName'](_0x44fcd8[_0x53cd('0x4')])[_0x53cd('0x9')](function(_0x1e4981){if(_0x1e4981){_0x44fcd8[_0x53cd('0xa')]=_0x1e4981['type'];}utils[_0x53cd('0xb')](_0x53cd('0xc'),_0x44fcd8);});}else{utils[_0x53cd('0xb')](_0x53cd('0xc'),_0x44fcd8);}if(_0x44fcd8[_0x53cd('0xd')]){delete queues[_0x44fcd8['transfereduniqueid']];}else{delete queues[_0x44fcd8[_0x53cd('0x2')]];}}exports['queuecallerjoin']=function(_0x11b75d){try{utils[_0x53cd('0xe')](util['format']('[%s][queues][queuecallerjoin]',_0x11b75d[_0x53cd('0x2')]),_0x11b75d);utils[_0x53cd('0x1')](util['format']('[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s',_0x11b75d['uniqueid'],_0x11b75d['queue'],_0x11b75d['position']));queues[_0x11b75d[_0x53cd('0x2')]]=_[_0x53cd('0xf')](_0x11b75d,{'originalposition':_0x11b75d['position'],'queuecallerjoinAt':utils['now'](),'mohtime':0x0});}catch(_0x41fd47){utils[_0x53cd('0x10')](util[_0x53cd('0x11')]('[%s][queues][queuecallerjoin]',_0x11b75d['uniqueid']),_0x41fd47);}};exports['hangup']=function(_0x559ad4){try{if(!_[_0x53cd('0x12')](queues[_0x559ad4[_0x53cd('0x2')]])){utils[_0x53cd('0xe')](util[_0x53cd('0x11')](_0x53cd('0x13'),_0x559ad4[_0x53cd('0x2')]),_0x559ad4);if(queues[_0x559ad4[_0x53cd('0x2')]]['queuecallerleaveAt']){if(!queues[_0x559ad4['uniqueid']][_0x53cd('0x14')]&&!queues[_0x559ad4[_0x53cd('0x2')]]['queuecallerexit']){queues[_0x559ad4['uniqueid']]['queuecallercomplete']=!![];queues[_0x559ad4[_0x53cd('0x2')]][_0x53cd('0x15')]=utils[_0x53cd('0x16')]();queues[_0x559ad4[_0x53cd('0x2')]][_0x53cd('0x8')]=_0x53cd('0x17');}utils[_0x53cd('0x1')](util[_0x53cd('0x11')](_0x53cd('0x18'),_0x559ad4[_0x53cd('0x2')],queues[_0x559ad4[_0x53cd('0x2')]][_0x53cd('0x19')],queues[_0x559ad4['uniqueid']][_0x53cd('0x8')]));writeDB(queues[_0x559ad4[_0x53cd('0x2')]]);}else if(queues[_0x559ad4[_0x53cd('0x2')]][_0x53cd('0xd')]){utils[_0x53cd('0x1')](util[_0x53cd('0x11')]('[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s',_0x559ad4[_0x53cd('0x2')],queues[_0x559ad4['uniqueid']][_0x53cd('0x19')],queues[_0x559ad4[_0x53cd('0x2')]]['transfereduniqueid']));queues[queues[_0x559ad4[_0x53cd('0x2')]][_0x53cd('0xd')]]=queues[_0x559ad4[_0x53cd('0x2')]];queues[queues[_0x559ad4[_0x53cd('0x2')]][_0x53cd('0xd')]]['queuecallerenterreason']=0x2;delete queues[_0x559ad4[_0x53cd('0x2')]];}}}catch(_0xc0f99b){utils[_0x53cd('0x10')](util[_0x53cd('0x11')](_0x53cd('0x13'),_0x559ad4['uniqueid']),_0xc0f99b);}};exports['varset']=function(_0xb49d57){try{utils[_0x53cd('0xe')](util[_0x53cd('0x11')](_0x53cd('0x1a'),_0xb49d57[_0x53cd('0x2')]),_0xb49d57);if(!_[_0x53cd('0x12')](_0xb49d57[_0x53cd('0x1b')][_0x53cd('0x1c')])&&_0xb49d57[_0x53cd('0x1d')]['toUpperCase']()!==_0x53cd('0x1e')){if(!_[_0x53cd('0x12')](queues[_0xb49d57['uniqueid']])){queues[_0xb49d57[_0x53cd('0x2')]][_0x53cd('0x14')]=![];queues[_0xb49d57[_0x53cd('0x2')]]['queuecallerabandonAt']=null;queues[_0xb49d57[_0x53cd('0x2')]][_0x53cd('0x1f')]=!![];queues[_0xb49d57[_0x53cd('0x2')]]['queuecallerexitAt']=utils[_0x53cd('0x16')]();queues[_0xb49d57['uniqueid']][_0x53cd('0x8')]=_0xb49d57[_0x53cd('0x1d')]['toUpperCase']();utils[_0x53cd('0x1')](util[_0x53cd('0x11')](_0x53cd('0x20'),_0xb49d57[_0x53cd('0x2')],queues[_0xb49d57[_0x53cd('0x2')]][_0x53cd('0x19')],_0xb49d57['value'],queues[_0xb49d57[_0x53cd('0x2')]][_0x53cd('0x8')]));writeDB(queues[_0xb49d57['uniqueid']]);}}else if(!_[_0x53cd('0x12')](_0xb49d57['variable'][_0x53cd('0x21')])){if(!_[_0x53cd('0x12')](queues[_0xb49d57['uniqueid']])&&!queues[_0xb49d57['uniqueid']][_0x53cd('0x14')]){queues[_0xb49d57['uniqueid']]['queuecallerabandon']=![];queues[_0xb49d57['uniqueid']][_0x53cd('0x22')]=null;queues[_0xb49d57[_0x53cd('0x2')]][_0x53cd('0x1f')]=!![];queues[_0xb49d57[_0x53cd('0x2')]][_0x53cd('0x23')]=utils['now']();queues[_0xb49d57[_0x53cd('0x2')]][_0x53cd('0x8')]=_0x53cd('0x24');utils['info'](util['format'](_0x53cd('0x25'),_0xb49d57[_0x53cd('0x2')],queues[_0xb49d57[_0x53cd('0x2')]][_0x53cd('0x19')],_0xb49d57[_0x53cd('0x1d')],queues[_0xb49d57[_0x53cd('0x2')]][_0x53cd('0x8')]));}}}catch(_0x4cc9c9){utils[_0x53cd('0x10')](util[_0x53cd('0x11')](_0x53cd('0x1a'),_0xb49d57[_0x53cd('0x2')]),_0x4cc9c9);}};exports['queuecallerabandon']=function(_0x5af35e){try{if(!_[_0x53cd('0x12')](queues[_0x5af35e[_0x53cd('0x2')]])){utils['debug'](util[_0x53cd('0x11')]('[%s][queues][queuecallerabandon]',_0x5af35e[_0x53cd('0x2')]),_0x5af35e);queues[_0x5af35e['uniqueid']][_0x53cd('0x1f')]=![];queues[_0x5af35e['uniqueid']]['queuecallerexitAt']=null;queues[_0x5af35e[_0x53cd('0x2')]][_0x53cd('0x14')]=!![];queues[_0x5af35e[_0x53cd('0x2')]]['queuecallerabandonAt']=utils[_0x53cd('0x16')]();queues[_0x5af35e[_0x53cd('0x2')]][_0x53cd('0x8')]=_0x53cd('0x26');utils[_0x53cd('0x1')](util[_0x53cd('0x11')]('[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s',_0x5af35e[_0x53cd('0x2')],queues[_0x5af35e['uniqueid']]['name'],queues[_0x5af35e[_0x53cd('0x2')]][_0x53cd('0x8')]));}}catch(_0x1ed270){utils[_0x53cd('0x10')](util['format'](_0x53cd('0x27'),_0x5af35e['uniqueid']),_0x1ed270);}};exports['queuecallerleave']=function(_0x24118d){try{if(!_[_0x53cd('0x12')](queues[_0x24118d['uniqueid']])){utils['debug'](util[_0x53cd('0x11')](_0x53cd('0x28'),_0x24118d[_0x53cd('0x2')]),_0x24118d);utils[_0x53cd('0x1')](util['format']('[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x24118d['uniqueid'],queues[_0x24118d[_0x53cd('0x2')]][_0x53cd('0x19')],_0x24118d['connectedlinenum'],_0x24118d[_0x53cd('0x29')]));queues[_0x24118d['uniqueid']][_0x53cd('0x2a')]=!![];queues[_0x24118d[_0x53cd('0x2')]][_0x53cd('0x2b')]=utils[_0x53cd('0x16')]();queues[_0x24118d[_0x53cd('0x2')]]['holdtime']=utils[_0x53cd('0x2c')](queues[_0x24118d[_0x53cd('0x2')]][_0x53cd('0x2b')],queues[_0x24118d[_0x53cd('0x2')]][_0x53cd('0x2d')]);queues[_0x24118d[_0x53cd('0x2')]]['position']=_0x24118d['position'];queues[_0x24118d['uniqueid']][_0x53cd('0x2e')]=_0x24118d[_0x53cd('0x2e')];queues[_0x24118d['uniqueid']]['connectedlinenum']=_0x24118d[_0x53cd('0x2f')];queues[_0x24118d[_0x53cd('0x2')]][_0x53cd('0x29')]=_0x24118d[_0x53cd('0x29')];}}catch(_0x1f6f12){utils['error'](util[_0x53cd('0x11')]('[%s][queues][queuecallerleave]',_0x24118d[_0x53cd('0x2')]),_0x1f6f12);}};exports[_0x53cd('0x30')]=function(_0x46e10e){try{if(!_[_0x53cd('0x12')](queues[_0x46e10e['uniqueid']])){utils[_0x53cd('0xe')](util['format'](_0x53cd('0x31'),_0x46e10e[_0x53cd('0x2')]),_0x46e10e);utils[_0x53cd('0x1')](util['format'](_0x53cd('0x32'),_0x46e10e[_0x53cd('0x2')],queues[_0x46e10e['uniqueid']][_0x53cd('0x19')],_0x46e10e[_0x53cd('0x33')],_0x46e10e['destaccountcode']));queues[_0x46e10e[_0x53cd('0x2')]][_0x53cd('0x14')]=![];queues[_0x46e10e['uniqueid']][_0x53cd('0x14')]=![];queues[_0x46e10e[_0x53cd('0x2')]][_0x53cd('0x22')]=null;queues[_0x46e10e[_0x53cd('0x2')]][_0x53cd('0x1f')]=![];queues[_0x46e10e['uniqueid']]['queuecallerexitreason']=null;queues[_0x46e10e['uniqueid']][_0x53cd('0x23')]=null;queues[_0x46e10e['uniqueid']][_0x53cd('0x34')]=!![];queues[_0x46e10e['uniqueid']][_0x53cd('0x7')]=_0x46e10e[_0x53cd('0x35')];queues[_0x46e10e[_0x53cd('0x2')]][_0x53cd('0x5')]=_0x46e10e[_0x53cd('0x33')];}}catch(_0x324da6){utils[_0x53cd('0x10')](util['format'](_0x53cd('0x31'),_0x46e10e[_0x53cd('0x2')]),_0x324da6);}};exports[_0x53cd('0x36')]=function(_0x3c2afd){try{if(!_[_0x53cd('0x12')](queues[_0x3c2afd['uniqueid']])){if(queues[_0x3c2afd[_0x53cd('0x2')]][_0x53cd('0x2b')]){utils[_0x53cd('0xe')](util['format'](_0x53cd('0x37'),_0x3c2afd[_0x53cd('0x2')]),_0x3c2afd);queues[_0x3c2afd[_0x53cd('0x2')]]['queuecallerabandon']=![];queues[_0x3c2afd[_0x53cd('0x2')]]['queuecallerabandon']=![];queues[_0x3c2afd['uniqueid']][_0x53cd('0x22')]=null;queues[_0x3c2afd['uniqueid']][_0x53cd('0x1f')]=![];queues[_0x3c2afd[_0x53cd('0x2')]][_0x53cd('0x23')]=null;queues[_0x3c2afd[_0x53cd('0x2')]]['assigned']=!![];queues[_0x3c2afd['uniqueid']][_0x53cd('0x5')]=_0x3c2afd[_0x53cd('0x33')];queues[_0x3c2afd['uniqueid']][_0x53cd('0x38')]=!![];queues[_0x3c2afd[_0x53cd('0x2')]][_0x53cd('0x15')]=utils[_0x53cd('0x16')]();if(_0x3c2afd[_0x53cd('0x39')]=='transfer'){if(!queues[_0x3c2afd['uniqueid']]['transfer']){queues[_0x3c2afd[_0x53cd('0x2')]]['queuecallerexitreason']=_0x53cd('0x3a');}}else{queues[_0x3c2afd[_0x53cd('0x2')]][_0x53cd('0x8')]=_0x53cd('0x3b')+_0x3c2afd[_0x53cd('0x39')][_0x53cd('0x3c')]();}utils['info'](util[_0x53cd('0x11')](_0x53cd('0x3d'),_0x3c2afd['uniqueid'],queues[_0x3c2afd['uniqueid']]['name'],_0x3c2afd[_0x53cd('0x33')],queues[_0x3c2afd[_0x53cd('0x2')]]['queuecallerexitreason']));writeDB(queues[_0x3c2afd['uniqueid']]);}}}catch(_0xb65f84){utils[_0x53cd('0x10')](util[_0x53cd('0x11')](_0x53cd('0x37'),_0x3c2afd[_0x53cd('0x2')]),_0xb65f84);}};exports['blindtransfer']=function(_0x9cf3e4){try{if(!_[_0x53cd('0x12')](queues[_0x9cf3e4[_0x53cd('0x3e')]])){utils[_0x53cd('0xe')](util[_0x53cd('0x11')]('[%s][queues][blindtransfer]',_0x9cf3e4[_0x53cd('0x2')]),_0x9cf3e4);queues[_0x9cf3e4[_0x53cd('0x3e')]][_0x53cd('0x3f')]=!![];queues[_0x9cf3e4[_0x53cd('0x3e')]][_0x53cd('0x40')]=_0x53cd('0x41');queues[_0x9cf3e4[_0x53cd('0x3e')]][_0x53cd('0x42')]=_0x9cf3e4[_0x53cd('0x43')];queues[_0x9cf3e4[_0x53cd('0x3e')]][_0x53cd('0x44')]=_0x9cf3e4[_0x53cd('0x3e')];queues[_0x9cf3e4[_0x53cd('0x3e')]][_0x53cd('0x8')]=_0x53cd('0x45');utils[_0x53cd('0x1')](util[_0x53cd('0x11')](_0x53cd('0x46'),_0x9cf3e4[_0x53cd('0x2')],queues[_0x9cf3e4[_0x53cd('0x3e')]][_0x53cd('0x19')],_0x9cf3e4[_0x53cd('0x3e')],_0x9cf3e4[_0x53cd('0x43')]));}}catch(_0x14539c){utils[_0x53cd('0x10')](util[_0x53cd('0x11')]('[%s][queues][blindtransfer]',_0x9cf3e4['uniqueid']),_0x14539c);}};exports[_0x53cd('0x47')]=function(_0x171a47){try{utils[_0x53cd('0xe')](util[_0x53cd('0x11')](_0x53cd('0x48'),_0x171a47['origtransfereruniqueid']),_0x171a47);if(_0x171a47['origtransfereruniqueid']==_0x171a47[_0x53cd('0x49')]){if(!_[_0x53cd('0x12')](queues[_0x171a47['secondtransfererlinkedid']])){utils[_0x53cd('0x1')](util['format']('[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x171a47['origtransfereruniqueid'],queues[_0x171a47[_0x53cd('0x4a')]][_0x53cd('0x19')],_0x171a47[_0x53cd('0x4b')]));queues[_0x171a47['secondtransfererlinkedid']][_0x53cd('0x3f')]=!![];queues[_0x171a47['secondtransfererlinkedid']][_0x53cd('0x40')]='ATTENDED';queues[_0x171a47[_0x53cd('0x4a')]]['transferexten']=_0x171a47[_0x53cd('0x4b')];queues[_0x171a47[_0x53cd('0x4a')]][_0x53cd('0x44')]=_0x171a47[_0x53cd('0x4c')];queues[_0x171a47[_0x53cd('0x4a')]][_0x53cd('0x8')]=_0x53cd('0x4d');}if(!_[_0x53cd('0x12')](queues[_0x171a47['origtransfererlinkedid']])){if(_0x171a47[_0x53cd('0x4e')]&&queues[_0x171a47[_0x53cd('0x4e')]]){queues[_0x171a47[_0x53cd('0x4e')]]['queuecallerenterreason']=0x1;queues[_0x171a47[_0x53cd('0x3e')]]=_['clone'](queues[_0x171a47['transfereelinkedid']]);queues[_0x171a47['transfereeuniqueid']][_0x53cd('0xd')]=_0x171a47[_0x53cd('0x4f')];queues[_0x171a47[_0x53cd('0x3e')]]['queuecallerenterreason']=0x2;queues[_0x171a47[_0x53cd('0x3e')]][_0x53cd('0x6')]=queues[_0x171a47[_0x53cd('0x4a')]][_0x53cd('0x6')];queues[_0x171a47[_0x53cd('0x3e')]][_0x53cd('0x50')]=queues[_0x171a47[_0x53cd('0x4a')]]['calleridname'];queues[_0x171a47[_0x53cd('0x3e')]]['queuecallerjoinAt']=utils[_0x53cd('0x16')]();queues[_0x171a47[_0x53cd('0x3e')]][_0x53cd('0x2b')]=utils[_0x53cd('0x16')]();queues[_0x171a47[_0x53cd('0x3e')]]['holdtime']=0x0;queues[_0x171a47['transfereeuniqueid']][_0x53cd('0x51')]=0x0;utils[_0x53cd('0x1')](util[_0x53cd('0x11')](_0x53cd('0x52'),_0x171a47[_0x53cd('0x4c')],queues[_0x171a47[_0x53cd('0x3e')]]['name'],queues[_0x171a47[_0x53cd('0x3e')]][_0x53cd('0x6')],queues[_0x171a47[_0x53cd('0x3e')]][_0x53cd('0x50')]));}else{utils[_0x53cd('0x1')](util[_0x53cd('0x11')](_0x53cd('0x53'),_0x171a47[_0x53cd('0x4c')],queues[_0x171a47[_0x53cd('0x49')]][_0x53cd('0x19')],_0x171a47[_0x53cd('0x4a')]));queues[_0x171a47[_0x53cd('0x49')]][_0x53cd('0xd')]=_0x171a47['secondtransfererlinkedid'];}}}else if(_0x171a47[_0x53cd('0x54')]==_0x171a47['secondtransfererlinkedid']){if(!_[_0x53cd('0x12')](queues[_0x171a47[_0x53cd('0x49')]])){utils[_0x53cd('0x1')](util[_0x53cd('0x11')](_0x53cd('0x55'),_0x171a47[_0x53cd('0x4c')],queues[_0x171a47[_0x53cd('0x49')]]['name'],_0x171a47[_0x53cd('0x54')],_0x171a47[_0x53cd('0x56')]));queues[_0x171a47[_0x53cd('0x49')]][_0x53cd('0x3f')]=!![];queues[_0x171a47[_0x53cd('0x49')]][_0x53cd('0x40')]=_0x53cd('0x57');queues[_0x171a47['origtransfererlinkedid']]['transferexten']=_0x171a47['secondtransfererexten'];queues[_0x171a47[_0x53cd('0x49')]][_0x53cd('0x44')]=_0x171a47[_0x53cd('0x54')];queues[_0x171a47[_0x53cd('0x49')]][_0x53cd('0x8')]=_0x53cd('0x4d');}if(!_[_0x53cd('0x12')](queues[_0x171a47[_0x53cd('0x4a')]])){if(_0x171a47[_0x53cd('0x58')]&&queues[_0x171a47['transfertargetlinkedid']]){queues[_0x171a47[_0x53cd('0x58')]][_0x53cd('0x59')]=0x1;queues[_0x171a47['transfertargetuniqueid']]=_[_0x53cd('0x5a')](queues[_0x171a47[_0x53cd('0x58')]]);queues[_0x171a47[_0x53cd('0x4f')]][_0x53cd('0xd')]=_0x171a47['transfertargetuniqueid'];queues[_0x171a47[_0x53cd('0x4f')]][_0x53cd('0x59')]=0x2;queues[_0x171a47[_0x53cd('0x4f')]][_0x53cd('0x6')]=queues[_0x171a47[_0x53cd('0x49')]]['calleridnum'];queues[_0x171a47['transfertargetuniqueid']][_0x53cd('0x50')]=queues[_0x171a47[_0x53cd('0x49')]][_0x53cd('0x50')];queues[_0x171a47[_0x53cd('0x4f')]][_0x53cd('0x2d')]=utils['now']();queues[_0x171a47[_0x53cd('0x4f')]]['queuecallerleaveAt']=utils['now']();queues[_0x171a47[_0x53cd('0x4f')]]['holdtime']=0x0;queues[_0x171a47[_0x53cd('0x4f')]][_0x53cd('0x51')]=0x0;utils[_0x53cd('0x1')](util[_0x53cd('0x11')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s',_0x171a47[_0x53cd('0x4c')],queues[_0x171a47[_0x53cd('0x4f')]][_0x53cd('0x19')],queues[_0x171a47[_0x53cd('0x4f')]]['transfereduniqueid'],queues[_0x171a47['transfertargetuniqueid']][_0x53cd('0x6')],queues[_0x171a47[_0x53cd('0x4f')]]['calleridname']));}else{utils[_0x53cd('0x1')](util[_0x53cd('0x11')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x171a47[_0x53cd('0x4c')],queues[_0x171a47[_0x53cd('0x4a')]][_0x53cd('0x19')],_0x171a47[_0x53cd('0x49')]));queues[_0x171a47[_0x53cd('0x4a')]][_0x53cd('0xd')]=_0x171a47['origtransfererlinkedid'];}}}}catch(_0x5f164b){utils['error'](util[_0x53cd('0x11')](_0x53cd('0x48'),_0x171a47['origtransfereruniqueid']),_0x5f164b);}};exports[_0x53cd('0x5b')]=function(_0x4ac4b4){try{if(!_[_0x53cd('0x12')](queues[_0x4ac4b4[_0x53cd('0x2')]])){utils['debug'](util[_0x53cd('0x11')](_0x53cd('0x5c'),_0x4ac4b4[_0x53cd('0x2')]),_0x4ac4b4);queues[_0x4ac4b4[_0x53cd('0x2')]][_0x53cd('0x5d')]=utils[_0x53cd('0x16')]();utils[_0x53cd('0x1')](util[_0x53cd('0x11')](_0x53cd('0x5e'),_0x4ac4b4[_0x53cd('0x2')],queues[_0x4ac4b4['uniqueid']][_0x53cd('0x19')],queues[_0x4ac4b4[_0x53cd('0x2')]][_0x53cd('0x5d')]));}}catch(_0xab3f85){utils['error'](util[_0x53cd('0x11')](_0x53cd('0x5c'),_0x4ac4b4[_0x53cd('0x2')]),_0xab3f85);}};exports[_0x53cd('0x5f')]=function(_0xb850e5){try{if(!_[_0x53cd('0x12')](queues[_0xb850e5[_0x53cd('0x2')]])){if(!_[_0x53cd('0x12')](queues[_0xb850e5[_0x53cd('0x2')]][_0x53cd('0x5d')])){utils[_0x53cd('0xe')](util['format']('[%s][queues][musiconholdstop]',_0xb850e5[_0x53cd('0x2')]),_0xb850e5);queues[_0xb850e5[_0x53cd('0x2')]][_0x53cd('0x51')]+=utils[_0x53cd('0x2c')](utils[_0x53cd('0x16')](),queues[_0xb850e5[_0x53cd('0x2')]][_0x53cd('0x5d')]);utils[_0x53cd('0x1')](util[_0x53cd('0x11')]('[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s',_0xb850e5['uniqueid'],queues[_0xb850e5['uniqueid']][_0x53cd('0x19')],queues[_0xb850e5[_0x53cd('0x2')]][_0x53cd('0x51')]));delete queues[_0xb850e5[_0x53cd('0x2')]][_0x53cd('0x5d')];}}}catch(_0x3d67e8){utils[_0x53cd('0x10')](util['format'](_0x53cd('0x60'),_0xb850e5[_0x53cd('0x2')]),_0x3d67e8);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index 758dbf3..54124ee 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 _0x5a1a=['connectedlinename','type','outbound','newexten','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','cdr','split','substring','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','lodash','util','./utils','info','format','[%s][recordings][writeDB]','uniqueid','accountcode','getUserByInternal','then','name','UserId','request','CreateVoiceRecording','newchannel','debug','[%s][recordings][newchannel]','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','channel','newstate','[%s][recordings][newstate]','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','varset','isNil','variable','mixmonitor_filename','[%s][recordings][varset]','value','endsWith','.wav49','replace','.WAV','find','monitors','push','error','hangup','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','connectedlinenum'];(function(_0x57998d,_0x294f8d){var _0x3d660f=function(_0x3808a4){while(--_0x3808a4){_0x57998d['push'](_0x57998d['shift']());}};_0x3d660f(++_0x294f8d);}(_0x5a1a,0x162));var _0xa5a1=function(_0x14d770,_0x41b389){_0x14d770=_0x14d770-0x0;var _0x4283a5=_0x5a1a[_0x14d770];return _0x4283a5;};'use strict';var _=require(_0xa5a1('0x0'));var util=require(_0xa5a1('0x1'));var utils=require(_0xa5a1('0x2'));var recordings={};function writeDB(_0x2ba077){utils[_0xa5a1('0x3')](util[_0xa5a1('0x4')](_0xa5a1('0x5'),_0x2ba077[_0xa5a1('0x6')]));if(_0x2ba077[_0xa5a1('0x7')]){utils[_0xa5a1('0x8')](_0x2ba077['accountcode'])[_0xa5a1('0x9')](function(_0x3edd42){if(_0x3edd42){_0x2ba077['membername']=_0x3edd42[_0xa5a1('0xa')];_0x2ba077[_0xa5a1('0xb')]=_0x3edd42['id'];}utils[_0xa5a1('0xc')](_0xa5a1('0xd'),_0x2ba077);});}else{utils[_0xa5a1('0xc')](_0xa5a1('0xd'),_0x2ba077);}}exports[_0xa5a1('0xe')]=function(_0xd9e3fa){try{utils[_0xa5a1('0xf')](util[_0xa5a1('0x4')](_0xa5a1('0x10'),_0xd9e3fa['uniqueid']),_0xd9e3fa);if(_0xd9e3fa[_0xa5a1('0x6')]==_0xd9e3fa[_0xa5a1('0x11')]){utils[_0xa5a1('0x3')](util['format'](_0xa5a1('0x12'),_0xd9e3fa[_0xa5a1('0x6')],_0xd9e3fa[_0xa5a1('0x13')],_0xd9e3fa['exten']));recordings[_0xd9e3fa['uniqueid']]={'uniqueid':_0xd9e3fa['uniqueid'],'accountcode':_0xd9e3fa[_0xa5a1('0x7')],'exten':_0xd9e3fa[_0xa5a1('0x14')],'context':_0xd9e3fa[_0xa5a1('0x13')],'channel':_0xd9e3fa[_0xa5a1('0x15')],'monitors':[]};}}catch(_0x2b2265){utils['error'](util[_0xa5a1('0x4')]('[%s][recordings][newchannel]',_0xd9e3fa[_0xa5a1('0x6')]),_0x2b2265);}};exports[_0xa5a1('0x16')]=function(_0x84c81){try{utils[_0xa5a1('0xf')](util[_0xa5a1('0x4')](_0xa5a1('0x17'),_0x84c81[_0xa5a1('0x6')]),_0x84c81);if(!_['isNil'](recordings[_0x84c81[_0xa5a1('0x6')]])&&_0x84c81[_0xa5a1('0x18')]==0x6){utils[_0xa5a1('0x3')](util[_0xa5a1('0x4')](_0xa5a1('0x19'),_0x84c81[_0xa5a1('0x6')],_0x84c81[_0xa5a1('0x13')],_0x84c81[_0xa5a1('0x15')]));}else if(!_['isNil'](recordings[_0x84c81['linkedid']])&&_0x84c81[_0xa5a1('0x18')]==0x6&&_0x84c81['context']!=_0xa5a1('0x1a')){utils[_0xa5a1('0x3')](util[_0xa5a1('0x4')](_0xa5a1('0x1b'),_0x84c81[_0xa5a1('0x6')],_0x84c81['linkedid'],_0x84c81[_0xa5a1('0x13')],_0x84c81[_0xa5a1('0x15')]));recordings[_0x84c81[_0xa5a1('0x11')]][_0xa5a1('0x7')]=_0x84c81[_0xa5a1('0x7')];}}catch(_0x3f3e40){utils['error'](util[_0xa5a1('0x4')](_0xa5a1('0x17'),_0x84c81['uniqueid']),_0x3f3e40);}};exports[_0xa5a1('0x1c')]=function(_0x3c64c1){try{if(!_[_0xa5a1('0x1d')](_0x3c64c1['variable'])&&!_[_0xa5a1('0x1d')](_0x3c64c1[_0xa5a1('0x1e')][_0xa5a1('0x1f')])){utils[_0xa5a1('0xf')](util[_0xa5a1('0x4')](_0xa5a1('0x20'),_0x3c64c1[_0xa5a1('0x6')]),_0x3c64c1);utils[_0xa5a1('0x3')](util[_0xa5a1('0x4')]('[%s][recordings][varset]\x20variable:%s\x20value:%s',_0x3c64c1[_0xa5a1('0x6')],_0x3c64c1[_0xa5a1('0x1e')],_0x3c64c1[_0xa5a1('0x21')]));if(_[_0xa5a1('0x22')](_0x3c64c1['value'],_0xa5a1('0x23'))){_0x3c64c1[_0xa5a1('0x21')]=_0x3c64c1[_0xa5a1('0x21')][_0xa5a1('0x24')](_0xa5a1('0x23'),_0xa5a1('0x25'));}if(recordings[_0x3c64c1[_0xa5a1('0x11')]]){var _0x57a5e8=_[_0xa5a1('0x26')](recordings[_0x3c64c1[_0xa5a1('0x11')]][_0xa5a1('0x27')],{'value':_0x3c64c1[_0xa5a1('0x21')]});if(_['isNil'](_0x57a5e8)){recordings[_0x3c64c1[_0xa5a1('0x11')]][_0xa5a1('0x27')][_0xa5a1('0x28')]({'value':_0x3c64c1[_0xa5a1('0x21')]});}}}}catch(_0x265246){utils[_0xa5a1('0x29')](util[_0xa5a1('0x4')]('[%s][recordings][varset]',_0x3c64c1[_0xa5a1('0x6')]),_0x265246);}};exports[_0xa5a1('0x2a')]=function(_0x3d439e){try{if(!_['isNil'](recordings[_0x3d439e[_0xa5a1('0x6')]])){utils[_0xa5a1('0xf')](util[_0xa5a1('0x4')](_0xa5a1('0x2b'),_0x3d439e['uniqueid']),_0x3d439e);utils['info'](util[_0xa5a1('0x4')](_0xa5a1('0x2c'),_0x3d439e[_0xa5a1('0x6')],_0x3d439e[_0xa5a1('0x2d')],_0x3d439e['calleridname'],_0x3d439e['cause-txt']));recordings[_0x3d439e[_0xa5a1('0x6')]][_0xa5a1('0x2d')]=_0x3d439e[_0xa5a1('0x2d')];recordings[_0x3d439e[_0xa5a1('0x6')]][_0xa5a1('0x2e')]=_0x3d439e[_0xa5a1('0x2e')];recordings[_0x3d439e['uniqueid']][_0xa5a1('0x2f')]=_0x3d439e[_0xa5a1('0x2f')];recordings[_0x3d439e[_0xa5a1('0x6')]][_0xa5a1('0x30')]=_0x3d439e[_0xa5a1('0x30')];if(recordings[_0x3d439e[_0xa5a1('0x6')]][_0xa5a1('0x31')]==_0xa5a1('0x32')&&recordings[_0x3d439e[_0xa5a1('0x6')]][_0xa5a1('0x7')]){recordings[_0x3d439e['uniqueid']]['connectedlinenum']=recordings[_0x3d439e[_0xa5a1('0x6')]]['accountcode'];recordings[_0x3d439e[_0xa5a1('0x6')]][_0xa5a1('0x30')]='';}recordings[_0x3d439e[_0xa5a1('0x6')]][_0xa5a1('0x27')]['forEach'](function(_0x4d99f0){var _0x4f000f=_['clone'](recordings[_0x3d439e[_0xa5a1('0x6')]]);_0x4f000f[_0xa5a1('0x21')]=_0x4d99f0['value'];writeDB(_0x4f000f);});delete recordings[_0x3d439e['uniqueid']];}}catch(_0x296dcb){utils['error'](util[_0xa5a1('0x4')](_0xa5a1('0x2b'),_0x3d439e[_0xa5a1('0x6')]),_0x296dcb);}};exports[_0xa5a1('0x33')]=function(_0x31eabb){try{if(!_[_0xa5a1('0x1d')](recordings[_0x31eabb[_0xa5a1('0x6')]])){utils[_0xa5a1('0xf')](util['format'](_0xa5a1('0x34'),_0x31eabb['uniqueid']),_0x31eabb);utils[_0xa5a1('0x3')](util[_0xa5a1('0x4')](_0xa5a1('0x35'),_0x31eabb['uniqueid'],_0x31eabb[_0xa5a1('0x36')],_0x31eabb[_0xa5a1('0x37')]));if(_0x31eabb['application'][_0xa5a1('0x38')]()==_0xa5a1('0x39')&&_[_0xa5a1('0x3a')](_0x31eabb['appdata'][_0xa5a1('0x38')](),_0xa5a1('0x3b'))){var _0x4a9858=_0x31eabb['appdata'][_0xa5a1('0x3c')]('=');var _0x5a9d63=_0x4a9858[0x0][_0xa5a1('0x3d')](_0x4a9858[0x0][_0xa5a1('0x3e')]('(')+0x1,_0x4a9858[0x0][_0xa5a1('0x3e')](')'));var _0x3a79a7=_0x4a9858[0x1];recordings[_0x31eabb[_0xa5a1('0x6')]][_0x5a9d63]=_0x3a79a7;}}}catch(_0x49fee1){utils[_0xa5a1('0x29')](util['format'](_0xa5a1('0x34'),_0x31eabb[_0xa5a1('0x6')]),_0x49fee1);}};exports[_0xa5a1('0x3f')]=function(_0x2427c9){try{if(!_[_0xa5a1('0x1d')](recordings[_0x2427c9[_0xa5a1('0x6')]])){utils['debug'](util[_0xa5a1('0x4')](_0xa5a1('0x40'),_0x2427c9['uniqueid']),_0x2427c9);utils[_0xa5a1('0x3')](util[_0xa5a1('0x4')](_0xa5a1('0x41'),_0x2427c9['uniqueid'],_0x2427c9['queue']));recordings[_0x2427c9[_0xa5a1('0x6')]][_0xa5a1('0x42')]=_0x2427c9[_0xa5a1('0x42')];}}catch(_0x3eb69b){utils['error'](util[_0xa5a1('0x4')](_0xa5a1('0x40'),_0x2427c9[_0xa5a1('0x6')]),_0x3eb69b);}}; \ No newline at end of file +var _0x999b=['lodash','info','format','accountcode','getUserByInternal','then','membername','name','UserId','request','CreateVoiceRecording','debug','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','uniqueid','context','exten','channel','error','[%s][recordings][newchannel]','newstate','isNil','[%s][recordings][newstate]\x20context:%s\x20channel:%s','channelstate','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','[%s][recordings][newstate]','variable','[%s][recordings][varset]','value','.wav49','replace','.WAV','monitors','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridname','calleridnum','connectedlinenum','connectedlinename','forEach','clone','newexten','[%s][recordings][newexten]','application','appdata','toLowerCase','cdr','split','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue'];(function(_0x526818,_0x30c916){var _0x44c7e3=function(_0x364d90){while(--_0x364d90){_0x526818['push'](_0x526818['shift']());}};_0x44c7e3(++_0x30c916);}(_0x999b,0x99));var _0xb999=function(_0x11402,_0x3126ad){_0x11402=_0x11402-0x0;var _0x110195=_0x999b[_0x11402];return _0x110195;};'use strict';var _=require(_0xb999('0x0'));var util=require('util');var utils=require('./utils');var recordings={};function writeDB(_0x411efe){utils[_0xb999('0x1')](util[_0xb999('0x2')]('[%s][recordings][writeDB]',_0x411efe['uniqueid']));if(_0x411efe[_0xb999('0x3')]){utils[_0xb999('0x4')](_0x411efe[_0xb999('0x3')])[_0xb999('0x5')](function(_0x295724){if(_0x295724){_0x411efe[_0xb999('0x6')]=_0x295724[_0xb999('0x7')];_0x411efe[_0xb999('0x8')]=_0x295724['id'];}utils[_0xb999('0x9')](_0xb999('0xa'),_0x411efe);});}else{utils['request'](_0xb999('0xa'),_0x411efe);}}exports['newchannel']=function(_0x5bccb3){try{utils[_0xb999('0xb')](util[_0xb999('0x2')]('[%s][recordings][newchannel]',_0x5bccb3['uniqueid']),_0x5bccb3);if(_0x5bccb3['uniqueid']==_0x5bccb3[_0xb999('0xc')]){utils[_0xb999('0x1')](util[_0xb999('0x2')](_0xb999('0xd'),_0x5bccb3[_0xb999('0xe')],_0x5bccb3[_0xb999('0xf')],_0x5bccb3[_0xb999('0x10')]));recordings[_0x5bccb3[_0xb999('0xe')]]={'uniqueid':_0x5bccb3[_0xb999('0xe')],'accountcode':_0x5bccb3[_0xb999('0x3')],'exten':_0x5bccb3[_0xb999('0x10')],'context':_0x5bccb3[_0xb999('0xf')],'channel':_0x5bccb3[_0xb999('0x11')],'monitors':[]};}}catch(_0x2a3190){utils[_0xb999('0x12')](util[_0xb999('0x2')](_0xb999('0x13'),_0x5bccb3[_0xb999('0xe')]),_0x2a3190);}};exports[_0xb999('0x14')]=function(_0xd597e5){try{utils[_0xb999('0xb')](util['format']('[%s][recordings][newstate]',_0xd597e5[_0xb999('0xe')]),_0xd597e5);if(!_[_0xb999('0x15')](recordings[_0xd597e5['uniqueid']])&&_0xd597e5['channelstate']==0x6){utils[_0xb999('0x1')](util[_0xb999('0x2')](_0xb999('0x16'),_0xd597e5[_0xb999('0xe')],_0xd597e5['context'],_0xd597e5[_0xb999('0x11')]));}else if(!_[_0xb999('0x15')](recordings[_0xd597e5['linkedid']])&&_0xd597e5[_0xb999('0x17')]==0x6&&_0xd597e5[_0xb999('0xf')]!='transfer'){utils[_0xb999('0x1')](util[_0xb999('0x2')](_0xb999('0x18'),_0xd597e5[_0xb999('0xe')],_0xd597e5[_0xb999('0xc')],_0xd597e5[_0xb999('0xf')],_0xd597e5[_0xb999('0x11')]));recordings[_0xd597e5[_0xb999('0xc')]][_0xb999('0x3')]=_0xd597e5[_0xb999('0x3')];}}catch(_0x4412f8){utils[_0xb999('0x12')](util[_0xb999('0x2')](_0xb999('0x19'),_0xd597e5[_0xb999('0xe')]),_0x4412f8);}};exports['varset']=function(_0x31943e){try{if(!_[_0xb999('0x15')](_0x31943e[_0xb999('0x1a')])&&!_[_0xb999('0x15')](_0x31943e[_0xb999('0x1a')]['mixmonitor_filename'])){utils[_0xb999('0xb')](util[_0xb999('0x2')](_0xb999('0x1b'),_0x31943e['uniqueid']),_0x31943e);utils[_0xb999('0x1')](util[_0xb999('0x2')]('[%s][recordings][varset]\x20variable:%s\x20value:%s',_0x31943e[_0xb999('0xe')],_0x31943e[_0xb999('0x1a')],_0x31943e[_0xb999('0x1c')]));if(_['endsWith'](_0x31943e[_0xb999('0x1c')],_0xb999('0x1d'))){_0x31943e['value']=_0x31943e[_0xb999('0x1c')][_0xb999('0x1e')](_0xb999('0x1d'),_0xb999('0x1f'));}if(recordings[_0x31943e['linkedid']]){var _0x15e634=_['find'](recordings[_0x31943e[_0xb999('0xc')]][_0xb999('0x20')],{'value':_0x31943e[_0xb999('0x1c')]});if(_[_0xb999('0x15')](_0x15e634)){recordings[_0x31943e[_0xb999('0xc')]][_0xb999('0x20')]['push']({'value':_0x31943e[_0xb999('0x1c')]});}}}}catch(_0x135b29){utils['error'](util[_0xb999('0x2')]('[%s][recordings][varset]',_0x31943e[_0xb999('0xe')]),_0x135b29);}};exports['hangup']=function(_0x16375f){try{if(!_[_0xb999('0x15')](recordings[_0x16375f['uniqueid']])){utils[_0xb999('0xb')](util[_0xb999('0x2')](_0xb999('0x21'),_0x16375f['uniqueid']),_0x16375f);utils['info'](util['format'](_0xb999('0x22'),_0x16375f['uniqueid'],_0x16375f['calleridnum'],_0x16375f[_0xb999('0x23')],_0x16375f['cause-txt']));recordings[_0x16375f['uniqueid']][_0xb999('0x24')]=_0x16375f[_0xb999('0x24')];recordings[_0x16375f[_0xb999('0xe')]][_0xb999('0x23')]=_0x16375f[_0xb999('0x23')];recordings[_0x16375f[_0xb999('0xe')]]['connectedlinenum']=_0x16375f[_0xb999('0x25')];recordings[_0x16375f['uniqueid']][_0xb999('0x26')]=_0x16375f[_0xb999('0x26')];if(recordings[_0x16375f[_0xb999('0xe')]]['type']=='outbound'&&recordings[_0x16375f['uniqueid']][_0xb999('0x3')]){recordings[_0x16375f[_0xb999('0xe')]]['connectedlinenum']=recordings[_0x16375f[_0xb999('0xe')]][_0xb999('0x3')];recordings[_0x16375f[_0xb999('0xe')]][_0xb999('0x26')]='';}recordings[_0x16375f[_0xb999('0xe')]]['monitors'][_0xb999('0x27')](function(_0x378f80){var _0x323146=_[_0xb999('0x28')](recordings[_0x16375f['uniqueid']]);_0x323146[_0xb999('0x1c')]=_0x378f80[_0xb999('0x1c')];writeDB(_0x323146);});delete recordings[_0x16375f[_0xb999('0xe')]];}}catch(_0x13ef27){utils[_0xb999('0x12')](util['format'](_0xb999('0x21'),_0x16375f[_0xb999('0xe')]),_0x13ef27);}};exports[_0xb999('0x29')]=function(_0x15cf33){try{if(!_[_0xb999('0x15')](recordings[_0x15cf33[_0xb999('0xe')]])){utils[_0xb999('0xb')](util[_0xb999('0x2')](_0xb999('0x2a'),_0x15cf33[_0xb999('0xe')]),_0x15cf33);utils[_0xb999('0x1')](util['format']('[%s][recordings][newexten]\x20application:%s\x20appdata:%s',_0x15cf33['uniqueid'],_0x15cf33[_0xb999('0x2b')],_0x15cf33[_0xb999('0x2c')]));if(_0x15cf33[_0xb999('0x2b')][_0xb999('0x2d')]()=='set'&&_['startsWith'](_0x15cf33[_0xb999('0x2c')]['toLowerCase'](),_0xb999('0x2e'))){var _0xd13664=_0x15cf33[_0xb999('0x2c')][_0xb999('0x2f')]('=');var _0x320aae=_0xd13664[0x0]['substring'](_0xd13664[0x0]['lastIndexOf']('(')+0x1,_0xd13664[0x0]['lastIndexOf'](')'));var _0x452dab=_0xd13664[0x1];recordings[_0x15cf33[_0xb999('0xe')]][_0x320aae]=_0x452dab;}}}catch(_0x375f5b){utils['error'](util[_0xb999('0x2')](_0xb999('0x2a'),_0x15cf33[_0xb999('0xe')]),_0x375f5b);}};exports['queuecallerjoin']=function(_0x5ba36d){try{if(!_[_0xb999('0x15')](recordings[_0x5ba36d[_0xb999('0xe')]])){utils[_0xb999('0xb')](util[_0xb999('0x2')](_0xb999('0x30'),_0x5ba36d[_0xb999('0xe')]),_0x5ba36d);utils[_0xb999('0x1')](util[_0xb999('0x2')](_0xb999('0x31'),_0x5ba36d[_0xb999('0xe')],_0x5ba36d['queue']));recordings[_0x5ba36d['uniqueid']][_0xb999('0x32')]=_0x5ba36d[_0xb999('0x32')];}}catch(_0x7622dc){utils['error'](util[_0xb999('0x2')](_0xb999('0x30'),_0x5ba36d[_0xb999('0xe')]),_0x7622dc);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index 756c5a4..91363d9 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 _0xe915=['CreateVoiceTransferReport','blindtransfer','debug','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','uniqueid','transfereecalleridname','blind','blinds','error','[%s][transfers][blindtransfer]','attendedtransfer','origtransfereruniqueid','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','transfertargetcalleridnum','transfertargetcalleridname','origtransfererchannel','secondtransfererconnectedlinenum','origtransfereraccountcode','secondtransferercontext','origtransfererlinkedid','origtransfererexten','isNil','transfereechannel','assign','transfertargetchannel','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetlinkedid','[%s][transfers][attendedtransfer]','lodash','util','./utils','info','format','[%s][transfers][writeDB]\x20type:%s','attended','request'];(function(_0x3f1fc8,_0x1eb0ab){var _0x243afa=function(_0x392c97){while(--_0x392c97){_0x3f1fc8['push'](_0x3f1fc8['shift']());}};_0x243afa(++_0x1eb0ab);}(_0xe915,0x128));var _0x5e91=function(_0x4b77be,_0x3f1aaf){_0x4b77be=_0x4b77be-0x0;var _0x4724f4=_0xe915[_0x4b77be];return _0x4724f4;};'use strict';var _=require(_0x5e91('0x0'));var util=require(_0x5e91('0x1'));var utils=require(_0x5e91('0x2'));function writeDB(_0x91a739){utils[_0x5e91('0x3')](util[_0x5e91('0x4')](_0x5e91('0x5'),_0x91a739['type']===_0x5e91('0x6')?_0x91a739['origtransfereruniqueid']:_0x91a739['uniqueid'],_0x91a739['type']));utils[_0x5e91('0x7')](_0x5e91('0x8'),_0x91a739);}exports['blinds']={};exports[_0x5e91('0x9')]=function(_0x48c052){try{utils[_0x5e91('0xa')](util['format']('[%s][transfers][blindtransfer]',_0x48c052['uniqueid']),_0x48c052);utils['info'](util[_0x5e91('0x4')](_0x5e91('0xb'),_0x48c052[_0x5e91('0xc')],_0x48c052['transferercalleridnum'],_0x48c052['transferercalleridname'],_0x48c052['transfereecalleridnum'],_0x48c052[_0x5e91('0xd')]));_0x48c052['type']=_0x5e91('0xe');exports[_0x5e91('0xf')][_0x48c052['transfereruniqueid']]=_0x48c052;writeDB(_0x48c052);}catch(_0x138f5b){utils[_0x5e91('0x10')](util['format'](_0x5e91('0x11'),_0x48c052['uniqueid']),_0x138f5b);}};exports[_0x5e91('0x12')]=function(_0x491ab7){try{utils['debug'](util[_0x5e91('0x4')]('[%s][transfers][attendedtransfer]',_0x491ab7[_0x5e91('0x13')]),_0x491ab7);utils[_0x5e91('0x3')](util['format'](_0x5e91('0x14'),_0x491ab7[_0x5e91('0x13')],_0x491ab7[_0x5e91('0x15')],_0x491ab7['origtransferercalleridname'],_0x491ab7[_0x5e91('0x16')],_0x491ab7[_0x5e91('0x17')]));_0x491ab7=_['assign'](_0x491ab7,{'transfererchannel':_0x491ab7[_0x5e91('0x18')],'transferercalleridnum':_0x491ab7[_0x5e91('0x15')],'transferercalleridname':_0x491ab7['origtransferercalleridname'],'transfererconnectedlinenum':_0x491ab7[_0x5e91('0x19')],'transfererconnectedlinename':_0x491ab7['secondtransfererconnectedlinename'],'transfereraccountcode':_0x491ab7[_0x5e91('0x1a')],'transferercontext':_0x491ab7[_0x5e91('0x1b')],'transfererexten':_0x491ab7['secondtransfererexten'],'transfererlinkedid':_0x491ab7[_0x5e91('0x1c')],'context':_0x491ab7['origtransferercontext'],'extension':_0x491ab7[_0x5e91('0x1d')],'type':_0x5e91('0x6')});if(_[_0x5e91('0x1e')](_0x491ab7[_0x5e91('0x1f')])){_0x491ab7=_[_0x5e91('0x20')](_0x491ab7,{'transfereechannel':_0x491ab7[_0x5e91('0x21')],'transfereecalleridnum':_0x491ab7[_0x5e91('0x16')],'transfereecalleridname':_0x491ab7[_0x5e91('0x17')],'transfereeconnectedlinenum':_0x491ab7[_0x5e91('0x22')],'transfereeconnectedlinename':_0x491ab7[_0x5e91('0x23')],'transfereeaccountcode':_0x491ab7['transfertargetaccountcode'],'transfereecontext':_0x491ab7['transfertargetcontext'],'transfereeexten':_0x491ab7['transfertargetexten'],'transfereelinkedid':_0x491ab7[_0x5e91('0x24')]});}writeDB(_0x491ab7);}catch(_0x2db64b){utils[_0x5e91('0x10')](util[_0x5e91('0x4')](_0x5e91('0x25'),_0x491ab7[_0x5e91('0x13')]),_0x2db64b);}}; \ No newline at end of file +var _0xdb7a=['transfereecalleridnum','transfereruniqueid','attendedtransfer','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','assign','origtransfererchannel','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','origtransfererlinkedid','origtransferercontext','origtransfererexten','isNil','transfereechannel','transfertargetchannel','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetexten','transfertargetlinkedid','error','[%s][transfers][attendedtransfer]','lodash','util','./utils','info','format','type','attended','origtransfereruniqueid','uniqueid','CreateVoiceTransferReport','blinds','blindtransfer','debug','[%s][transfers][blindtransfer]','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname'];(function(_0x2e9f94,_0xc6ebd){var _0x5afaf1=function(_0x2d0c19){while(--_0x2d0c19){_0x2e9f94['push'](_0x2e9f94['shift']());}};_0x5afaf1(++_0xc6ebd);}(_0xdb7a,0xf1));var _0xadb7=function(_0x2c582c,_0x4b4e0e){_0x2c582c=_0x2c582c-0x0;var _0x1d5935=_0xdb7a[_0x2c582c];return _0x1d5935;};'use strict';var _=require(_0xadb7('0x0'));var util=require(_0xadb7('0x1'));var utils=require(_0xadb7('0x2'));function writeDB(_0x24ad0b){utils[_0xadb7('0x3')](util[_0xadb7('0x4')]('[%s][transfers][writeDB]\x20type:%s',_0x24ad0b[_0xadb7('0x5')]===_0xadb7('0x6')?_0x24ad0b[_0xadb7('0x7')]:_0x24ad0b[_0xadb7('0x8')],_0x24ad0b[_0xadb7('0x5')]));utils['request'](_0xadb7('0x9'),_0x24ad0b);}exports[_0xadb7('0xa')]={};exports[_0xadb7('0xb')]=function(_0x5d8dd7){try{utils[_0xadb7('0xc')](util[_0xadb7('0x4')](_0xadb7('0xd'),_0x5d8dd7[_0xadb7('0x8')]),_0x5d8dd7);utils[_0xadb7('0x3')](util[_0xadb7('0x4')](_0xadb7('0xe'),_0x5d8dd7[_0xadb7('0x8')],_0x5d8dd7[_0xadb7('0xf')],_0x5d8dd7[_0xadb7('0x10')],_0x5d8dd7[_0xadb7('0x11')],_0x5d8dd7['transfereecalleridname']));_0x5d8dd7[_0xadb7('0x5')]='blind';exports[_0xadb7('0xa')][_0x5d8dd7[_0xadb7('0x12')]]=_0x5d8dd7;writeDB(_0x5d8dd7);}catch(_0x3d67cd){utils['error'](util[_0xadb7('0x4')](_0xadb7('0xd'),_0x5d8dd7[_0xadb7('0x8')]),_0x3d67cd);}};exports[_0xadb7('0x13')]=function(_0x1d17ad){try{utils[_0xadb7('0xc')](util[_0xadb7('0x4')]('[%s][transfers][attendedtransfer]',_0x1d17ad[_0xadb7('0x7')]),_0x1d17ad);utils[_0xadb7('0x3')](util[_0xadb7('0x4')](_0xadb7('0x14'),_0x1d17ad[_0xadb7('0x7')],_0x1d17ad[_0xadb7('0x15')],_0x1d17ad[_0xadb7('0x16')],_0x1d17ad[_0xadb7('0x17')],_0x1d17ad['transfertargetcalleridname']));_0x1d17ad=_[_0xadb7('0x18')](_0x1d17ad,{'transfererchannel':_0x1d17ad[_0xadb7('0x19')],'transferercalleridnum':_0x1d17ad[_0xadb7('0x15')],'transferercalleridname':_0x1d17ad['origtransferercalleridname'],'transfererconnectedlinenum':_0x1d17ad[_0xadb7('0x1a')],'transfererconnectedlinename':_0x1d17ad[_0xadb7('0x1b')],'transfereraccountcode':_0x1d17ad[_0xadb7('0x1c')],'transferercontext':_0x1d17ad[_0xadb7('0x1d')],'transfererexten':_0x1d17ad['secondtransfererexten'],'transfererlinkedid':_0x1d17ad[_0xadb7('0x1e')],'context':_0x1d17ad[_0xadb7('0x1f')],'extension':_0x1d17ad[_0xadb7('0x20')],'type':_0xadb7('0x6')});if(_[_0xadb7('0x21')](_0x1d17ad[_0xadb7('0x22')])){_0x1d17ad=_['assign'](_0x1d17ad,{'transfereechannel':_0x1d17ad[_0xadb7('0x23')],'transfereecalleridnum':_0x1d17ad[_0xadb7('0x17')],'transfereecalleridname':_0x1d17ad[_0xadb7('0x24')],'transfereeconnectedlinenum':_0x1d17ad[_0xadb7('0x25')],'transfereeconnectedlinename':_0x1d17ad[_0xadb7('0x26')],'transfereeaccountcode':_0x1d17ad['transfertargetaccountcode'],'transfereecontext':_0x1d17ad['transfertargetcontext'],'transfereeexten':_0x1d17ad[_0xadb7('0x27')],'transfereelinkedid':_0x1d17ad[_0xadb7('0x28')]});}writeDB(_0x1d17ad);}catch(_0x3b43a2){utils[_0xadb7('0x29')](util[_0xadb7('0x4')](_0xadb7('0x2a'),_0x1d17ad[_0xadb7('0x7')]),_0x3b43a2);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index 78797bb..c4b58c7 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 _0x9564=['add','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','diffTime','diff','sumTime','now','isAfter','isBefore','bluebird','jayson/promise','moment','client','http','xdr','info','inspect','debug','error','request','then','[utils][request]\x20name:%s','GetUser','name','interface','[utils][getUser]\x20where:%s','stringify','result','length','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','found','notfound','catch','[utils][getUserByInternal]','getUserByInterface','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s'];(function(_0x49a17d,_0x38066e){var _0x1810c0=function(_0x5ba6f8){while(--_0x5ba6f8){_0x49a17d['push'](_0x49a17d['shift']());}};_0x1810c0(++_0x38066e);}(_0x9564,0x1eb));var _0x4956=function(_0x121985,_0x252db3){_0x121985=_0x121985-0x0;var _0x20bc79=_0x9564[_0x121985];return _0x20bc79;};'use strict';var BPromise=require(_0x4956('0x0'));var jayson=require(_0x4956('0x1'));var moment=require(_0x4956('0x2'));var util=require('util');var client=jayson[_0x4956('0x3')][_0x4956('0x4')]({'port':0x2329});var logger=require('../../config/logger')(_0x4956('0x5'));exports['info']=function(_0x56483f,_0x2fe989){logger[_0x4956('0x6')](_0x56483f,_0x2fe989?util[_0x4956('0x7')](_0x2fe989,{'showHidden':![],'depth':null}):'');};exports[_0x4956('0x8')]=function(_0x36f960,_0x10875c){logger[_0x4956('0x8')](_0x36f960,_0x10875c?util[_0x4956('0x7')](_0x10875c,{'showHidden':![],'depth':null}):'');};exports[_0x4956('0x9')]=function(_0x3da208,_0xeec245){logger[_0x4956('0x9')](_0x3da208,_0xeec245?util[_0x4956('0x7')](_0xeec245,{'showHidden':![],'depth':null}):'');};exports[_0x4956('0xa')]=function(_0x442327,_0x3c6b96){return client['request'](_0x442327,{'body':_0x3c6b96})[_0x4956('0xb')](function(_0x5dab31){logger[_0x4956('0x8')](_0x4956('0xc'),_0x442327,_0x5dab31?util[_0x4956('0x7')](_0x5dab31,{'showHidden':![],'depth':null}):'');})['catch'](function(_0x13ae9f){logger[_0x4956('0x9')](_0x4956('0xc'),_0x442327,_0x13ae9f?util['inspect'](_0x13ae9f,{'showHidden':![],'depth':null}):'');});};function getUser(_0x47b0c2){return client[_0x4956('0xa')](_0x4956('0xd'),{'options':{'raw':!![],'attributes':['id','internal',_0x4956('0xe'),_0x4956('0xf')],'where':_0x47b0c2,'limit':0x1}})[_0x4956('0xb')](function(_0x1097ce){logger[_0x4956('0x8')](_0x4956('0x10'),JSON[_0x4956('0x11')](_0x47b0c2),_0x1097ce?util[_0x4956('0x7')](_0x1097ce,{'showHidden':![],'depth':null}):'');return _0x1097ce[_0x4956('0x12')][_0x4956('0x13')]?_0x1097ce['result'][0x0]:null;});}exports[_0x4956('0x14')]=function(_0x18b0d6){return new BPromise(function(_0x2738dc,_0x32fe5e){if(_0x18b0d6){return getUser({'internal':_0x18b0d6})[_0x4956('0xb')](function(_0x2d648e){logger[_0x4956('0x6')](_0x4956('0x15'),_0x18b0d6,_0x2d648e?_0x4956('0x16'):_0x4956('0x17'));return _0x2738dc(_0x2d648e);})[_0x4956('0x18')](function(_0x325541){logger[_0x4956('0x9')](_0x4956('0x19'),_0x325541?util[_0x4956('0x7')](_0x325541,{'showHidden':![],'depth':null}):'');return _0x2738dc(null);});}return _0x2738dc(null);});};exports[_0x4956('0x1a')]=function(_0x1e0c8a){return new BPromise(function(_0x1b4a80,_0x2a15a7){if(_0x1e0c8a){return getUser({'interface':_0x1e0c8a})[_0x4956('0xb')](function(_0x112f87){logger['info']('[utils][getUserByInterface]\x20interface:%s\x20%s',_0x1e0c8a,_0x112f87?_0x4956('0x16'):_0x4956('0x17'));return _0x1b4a80(_0x112f87);})['catch'](function(_0x1dee67){logger[_0x4956('0x9')](_0x4956('0x1b'),_0x1dee67?util['inspect'](_0x1dee67,{'showHidden':![],'depth':null}):'');return _0x1b4a80(null);});}return _0x1b4a80(null);});};exports[_0x4956('0x1c')]=function(_0x1bd82b){return new BPromise(function(_0x438d7a,_0x1987ad){if(_0x1bd82b){return getUser({'name':_0x1bd82b})[_0x4956('0xb')](function(_0x107c06){logger['info'](_0x4956('0x1d'),_0x1bd82b,_0x107c06?'found':_0x4956('0x17'));return _0x438d7a(_0x107c06);})[_0x4956('0x18')](function(_0x3e1095){logger[_0x4956('0x9')](_0x4956('0x1e'),_0x3e1095?util[_0x4956('0x7')](_0x3e1095,{'showHidden':![],'depth':null}):'');return _0x438d7a(null);});}return _0x438d7a(null);});};exports[_0x4956('0x1f')]=function(_0x130d2f){return new BPromise(function(_0x4a2096,_0x5659db){if(_0x130d2f){return client['request'](_0x4956('0x20'),{'options':{'raw':!![],'attributes':['id',_0x4956('0xe'),'type',_0x4956('0x21'),_0x4956('0x22')],'where':{'name':_0x130d2f},'limit':0x1}})[_0x4956('0xb')](function(_0x1996a3){logger['debug'](_0x4956('0x23'),_0x130d2f,_0x1996a3?util[_0x4956('0x7')](_0x1996a3,{'showHidden':![],'depth':null}):'');logger['info'](_0x4956('0x24'),_0x130d2f,_0x1996a3?_0x4956('0x16'):_0x4956('0x17'));return _0x4a2096(_0x1996a3[_0x4956('0x12')][_0x4956('0x13')]?_0x1996a3[_0x4956('0x12')][0x0]:null);})[_0x4956('0x18')](function(_0x1c66d9){logger[_0x4956('0x9')]('[utils][getVoiceQueueByName]',_0x1c66d9?util[_0x4956('0x7')](_0x1c66d9,{'showHidden':![],'depth':null}):'');return _0x4a2096(null);});}return _0x4a2096(null);});};exports['addTime']=function(_0x250d75,_0x17905b){return moment(_0x250d75)[_0x4956('0x25')](_0x17905b,_0x4956('0x26'))[_0x4956('0x27')](_0x4956('0x28'));};exports[_0x4956('0x29')]=function(_0x3c2da5,_0x231e68){return moment(_0x3c2da5)['subtract'](_0x231e68,_0x4956('0x26'))[_0x4956('0x27')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x4956('0x2a')]=function(_0x1053a1,_0x5270d1){return moment(_0x1053a1)[_0x4956('0x2b')](moment(_0x5270d1),_0x4956('0x26'));};exports[_0x4956('0x2c')]=function(_0x5a5d26,_0x2afabc){return parseInt(_0x5a5d26,0xa)+parseInt(_0x2afabc,0xa);};exports[_0x4956('0x2d')]=function(){return moment()[_0x4956('0x27')](_0x4956('0x28'));};exports[_0x4956('0x2e')]=function(_0x188706,_0x3d6192){if(_0x3d6192){return moment(_0x188706)[_0x4956('0x2e')](_0x3d6192);}return!![];};exports[_0x4956('0x2f')]=function(_0x4bad27,_0x5b9ee5){if(_0x5b9ee5){return moment(_0x4bad27)[_0x4956('0x2f')](_0x5b9ee5);}else if(_0x4bad27){return!![];}return![];}; \ No newline at end of file +var _0xaefb=['getVoiceQueueByName','GetVoiceQueue','type','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','addTime','add','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','diffTime','sumTime','now','isAfter','isBefore','bluebird','moment','client','http','xdr','info','inspect','debug','error','request','[utils][request]\x20name:%s','catch','name','interface','then','[utils][getUser]\x20where:%s','length','result','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','found','notfound','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]'];(function(_0xa22539,_0x4683ca){var _0x12d52f=function(_0x165b7d){while(--_0x165b7d){_0xa22539['push'](_0xa22539['shift']());}};_0x12d52f(++_0x4683ca);}(_0xaefb,0xca));var _0xbaef=function(_0x22205c,_0x473493){_0x22205c=_0x22205c-0x0;var _0x3f5efe=_0xaefb[_0x22205c];return _0x3f5efe;};'use strict';var BPromise=require(_0xbaef('0x0'));var jayson=require('jayson/promise');var moment=require(_0xbaef('0x1'));var util=require('util');var client=jayson[_0xbaef('0x2')][_0xbaef('0x3')]({'port':0x2329});var logger=require('../../config/logger')(_0xbaef('0x4'));exports[_0xbaef('0x5')]=function(_0x27ba28,_0xbdf26e){logger[_0xbaef('0x5')](_0x27ba28,_0xbdf26e?util[_0xbaef('0x6')](_0xbdf26e,{'showHidden':![],'depth':null}):'');};exports[_0xbaef('0x7')]=function(_0x4a3631,_0x10c777){logger[_0xbaef('0x7')](_0x4a3631,_0x10c777?util[_0xbaef('0x6')](_0x10c777,{'showHidden':![],'depth':null}):'');};exports[_0xbaef('0x8')]=function(_0x5d60db,_0x349db9){logger[_0xbaef('0x8')](_0x5d60db,_0x349db9?util[_0xbaef('0x6')](_0x349db9,{'showHidden':![],'depth':null}):'');};exports['request']=function(_0x247cae,_0x2298c7){return client[_0xbaef('0x9')](_0x247cae,{'body':_0x2298c7})['then'](function(_0x2ede97){logger[_0xbaef('0x7')](_0xbaef('0xa'),_0x247cae,_0x2ede97?util['inspect'](_0x2ede97,{'showHidden':![],'depth':null}):'');})[_0xbaef('0xb')](function(_0x170070){logger[_0xbaef('0x8')]('[utils][request]\x20name:%s',_0x247cae,_0x170070?util[_0xbaef('0x6')](_0x170070,{'showHidden':![],'depth':null}):'');});};function getUser(_0x484483){return client[_0xbaef('0x9')]('GetUser',{'options':{'raw':!![],'attributes':['id','internal',_0xbaef('0xc'),_0xbaef('0xd')],'where':_0x484483,'limit':0x1}})[_0xbaef('0xe')](function(_0xb2a308){logger['debug'](_0xbaef('0xf'),JSON['stringify'](_0x484483),_0xb2a308?util['inspect'](_0xb2a308,{'showHidden':![],'depth':null}):'');return _0xb2a308['result'][_0xbaef('0x10')]?_0xb2a308[_0xbaef('0x11')][0x0]:null;});}exports[_0xbaef('0x12')]=function(_0x207774){return new BPromise(function(_0xc39f78,_0x3cedbc){if(_0x207774){return getUser({'internal':_0x207774})['then'](function(_0x538526){logger['info'](_0xbaef('0x13'),_0x207774,_0x538526?_0xbaef('0x14'):_0xbaef('0x15'));return _0xc39f78(_0x538526);})[_0xbaef('0xb')](function(_0x38f049){logger['error']('[utils][getUserByInternal]',_0x38f049?util[_0xbaef('0x6')](_0x38f049,{'showHidden':![],'depth':null}):'');return _0xc39f78(null);});}return _0xc39f78(null);});};exports[_0xbaef('0x16')]=function(_0x18e9ee){return new BPromise(function(_0x15801,_0x526f24){if(_0x18e9ee){return getUser({'interface':_0x18e9ee})[_0xbaef('0xe')](function(_0x52e6e5){logger[_0xbaef('0x5')](_0xbaef('0x17'),_0x18e9ee,_0x52e6e5?_0xbaef('0x14'):_0xbaef('0x15'));return _0x15801(_0x52e6e5);})['catch'](function(_0x495c20){logger[_0xbaef('0x8')](_0xbaef('0x18'),_0x495c20?util['inspect'](_0x495c20,{'showHidden':![],'depth':null}):'');return _0x15801(null);});}return _0x15801(null);});};exports[_0xbaef('0x19')]=function(_0x4b5e80){return new BPromise(function(_0x3989d2,_0x488c99){if(_0x4b5e80){return getUser({'name':_0x4b5e80})[_0xbaef('0xe')](function(_0x4caa46){logger[_0xbaef('0x5')](_0xbaef('0x1a'),_0x4b5e80,_0x4caa46?_0xbaef('0x14'):_0xbaef('0x15'));return _0x3989d2(_0x4caa46);})['catch'](function(_0x36dc0f){logger[_0xbaef('0x8')](_0xbaef('0x1b'),_0x36dc0f?util['inspect'](_0x36dc0f,{'showHidden':![],'depth':null}):'');return _0x3989d2(null);});}return _0x3989d2(null);});};exports[_0xbaef('0x1c')]=function(_0x730335){return new BPromise(function(_0x5579b4,_0x168a36){if(_0x730335){return client[_0xbaef('0x9')](_0xbaef('0x1d'),{'options':{'raw':!![],'attributes':['id',_0xbaef('0xc'),_0xbaef('0x1e'),_0xbaef('0x1f'),_0xbaef('0x20')],'where':{'name':_0x730335},'limit':0x1}})[_0xbaef('0xe')](function(_0x28c3da){logger['debug'](_0xbaef('0x21'),_0x730335,_0x28c3da?util['inspect'](_0x28c3da,{'showHidden':![],'depth':null}):'');logger[_0xbaef('0x5')]('[utils][getVoiceQueueByName]\x20name:%s\x20%s',_0x730335,_0x28c3da?_0xbaef('0x14'):_0xbaef('0x15'));return _0x5579b4(_0x28c3da[_0xbaef('0x11')][_0xbaef('0x10')]?_0x28c3da[_0xbaef('0x11')][0x0]:null);})[_0xbaef('0xb')](function(_0x196d26){logger[_0xbaef('0x8')]('[utils][getVoiceQueueByName]',_0x196d26?util['inspect'](_0x196d26,{'showHidden':![],'depth':null}):'');return _0x5579b4(null);});}return _0x5579b4(null);});};exports[_0xbaef('0x22')]=function(_0x1eaae7,_0x318fa1){return moment(_0x1eaae7)[_0xbaef('0x23')](_0x318fa1,_0xbaef('0x24'))[_0xbaef('0x25')](_0xbaef('0x26'));};exports[_0xbaef('0x27')]=function(_0xb6be71,_0x407be9){return moment(_0xb6be71)[_0xbaef('0x28')](_0x407be9,'seconds')[_0xbaef('0x25')](_0xbaef('0x26'));};exports[_0xbaef('0x29')]=function(_0x4d8711,_0x4d3c){return moment(_0x4d8711)['diff'](moment(_0x4d3c),_0xbaef('0x24'));};exports[_0xbaef('0x2a')]=function(_0x21c66d,_0x473c51){return parseInt(_0x21c66d,0xa)+parseInt(_0x473c51,0xa);};exports[_0xbaef('0x2b')]=function(){return moment()[_0xbaef('0x25')](_0xbaef('0x26'));};exports[_0xbaef('0x2c')]=function(_0x120f68,_0x570d4f){if(_0x570d4f){return moment(_0x120f68)[_0xbaef('0x2c')](_0x570d4f);}return!![];};exports[_0xbaef('0x2d')]=function(_0x3e1b2e,_0x4b19d2){if(_0x4b19d2){return moment(_0x3e1b2e)[_0xbaef('0x2d')](_0x4b19d2);}else if(_0x3e1b2e){return!![];}return![];}; \ No newline at end of file